From: support Date: Tue, 25 Oct 2022 08:59:20 +0000 (+0000) Subject: Built motion from commit 15aa0e42.|2.6.19 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=a96b461e453c02590c5297ecf9aa17f082231bc0;p=motion2.git Built motion from commit 15aa0e42.|2.6.19 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b90dd24..362f09e 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-24T16:17:15.617Z", + "time": "2022-10-25T08:51:37.014Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 18ef972..2cd8d23 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-24T16:17:15.617Z", + "time": "2022-10-25T08:51:37.014Z", "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 c4d3a3b..1c5c9e0 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 _0xc360=['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]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','VIRTUAL','getDataValue','action','contactManager','integration','jscripty','urlForward','browser','script'];(function(_0x2b1e99,_0xcb3464){var _0x99721b=function(_0x242133){while(--_0x242133){_0x2b1e99['push'](_0x2b1e99['shift']());}};_0x99721b(++_0xcb3464);}(_0xc360,0x15f));var _0x0c36=function(_0x2b24d0,_0x49b3d7){_0x2b24d0=_0x2b24d0-0x0;var _0x1a2482=_0xc360[_0x2b24d0];return _0x1a2482;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0c36('0x0')],'get':function(_0x1d1cff){return this[_0x0c36('0x1')](_0x0c36('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x0c36('0x3'),_0x0c36('0x4'),'motionbar',_0x0c36('0x5'),_0x0c36('0x6'),_0x0c36('0x7'),'bot',_0x0c36('0x8')]],'msg':_0x0c36('0x9')}},'comment':_0x0c36('0x9')},'data1':{'type':Sequelize[_0x0c36('0xa')](0x1000),'comment':_0x0c36('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x0c36('0xc')},'data3':{'type':Sequelize[_0x0c36('0xa')](0x1000),'comment':_0x0c36('0xd')},'data4':{'type':Sequelize[_0x0c36('0xa')](0x1000),'comments':_0x0c36('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x0c36('0xf')},'data6':{'type':Sequelize[_0x0c36('0xa')],'comments':_0x0c36('0x10')},'data7':{'type':Sequelize['TEXT'],'comments':_0x0c36('0x11')}}; \ No newline at end of file +var _0x9fe3=['urlForward[headers],\x20browser[wsindowHeight]','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','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]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x3178ca,_0x133bc2){var _0x47d0d7=function(_0x4dabeb){while(--_0x4dabeb){_0x3178ca['push'](_0x3178ca['shift']());}};_0x47d0d7(++_0x133bc2);}(_0x9fe3,0x1b1));var _0x39fe=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x9fe3[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require(_0x39fe('0x0'));module['exports']={'name':{'type':Sequelize[_0x39fe('0x1')],'get':function(_0x161312){return this[_0x39fe('0x2')](_0x39fe('0x3'));}},'action':{'type':Sequelize[_0x39fe('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x39fe('0x5'),_0x39fe('0x6'),_0x39fe('0x7'),_0x39fe('0x8'),'urlForward',_0x39fe('0x9'),'bot',_0x39fe('0xa')]],'msg':_0x39fe('0xb')}},'comment':_0x39fe('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x39fe('0xc')},'data2':{'type':Sequelize[_0x39fe('0x4')](0x1000),'comment':_0x39fe('0xd')},'data3':{'type':Sequelize[_0x39fe('0x4')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x39fe('0x4')](0x1000),'comments':_0x39fe('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x39fe('0x4')],'comments':_0x39fe('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9de1314..d847e07 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 _0x714b=['destroy','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','send','body','Action','find','catch'];(function(_0x75b810,_0x5873cf){var _0x26de6b=function(_0x173af6){while(--_0x173af6){_0x75b810['push'](_0x75b810['shift']());}};_0x26de6b(++_0x5873cf);}(_0x714b,0xb1));var _0xb714=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x714b[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xb714('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb714('0x1'));var jsonpatch=require(_0xb714('0x2'));var rp=require(_0xb714('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb714('0x4'));var util=require('util');var path=require(_0xb714('0x5'));var sox=require('sox');var csv=require(_0xb714('0x6'));var ejs=require(_0xb714('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb714('0x8'));var squel=require(_0xb714('0x9'));var crypto=require(_0xb714('0xa'));var jsforce=require(_0xb714('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb714('0x6'));var querystring=require(_0xb714('0xc'));var Papa=require(_0xb714('0xd'));var Redis=require('ioredis');var authService=require(_0xb714('0xe'));var qs=require(_0xb714('0xf'));var as=require(_0xb714('0x10'));var hardwareService=require(_0xb714('0x11'));var logger=require(_0xb714('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xb714('0x13'));var licenseUtil=require(_0xb714('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c08d8,_0x50d65e){_0x50d65e=_0x50d65e||0xcc;return function(_0x4d2bb1){if(_0x4d2bb1){return _0x5c08d8[_0xb714('0x15')](_0x50d65e);}return _0x5c08d8[_0xb714('0x16')](_0x50d65e)[_0xb714('0x17')]();};}function respondWithResult(_0x87a208,_0x44d97c){_0x44d97c=_0x44d97c||0xc8;return function(_0x1be75b){if(_0x1be75b){return _0x87a208['status'](_0x44d97c)['json'](_0x1be75b);}};}function respondWithFilteredResult(_0x28ce68,_0x4cc930){return function(_0x4c48d4){if(_0x4c48d4){var _0x37eef8=typeof _0x4cc930[_0xb714('0x18')]===_0xb714('0x19')&&typeof _0x4cc930[_0xb714('0x1a')]===_0xb714('0x19');var _0x395b09=_0x4c48d4[_0xb714('0x1b')];var _0x3ff7a8=_0x37eef8?0x0:_0x4cc930['offset'];var _0x27717a=_0x37eef8?_0x4c48d4[_0xb714('0x1b')]:_0x4cc930[_0xb714('0x18')]+_0x4cc930[_0xb714('0x1a')];var _0xc61033;if(_0x27717a>=_0x395b09){_0x27717a=_0x395b09;_0xc61033=0xc8;}else{_0xc61033=0xce;}_0x28ce68[_0xb714('0x16')](_0xc61033);return _0x28ce68[_0xb714('0x1c')](_0xb714('0x1d'),_0x3ff7a8+'-'+_0x27717a+'/'+_0x395b09)[_0xb714('0x1e')](_0x4c48d4);}return null;};}function patchUpdates(_0x580ee2){return function(_0x40209a){try{jsonpatch[_0xb714('0x1f')](_0x40209a,_0x580ee2,!![]);}catch(_0x3177c3){return BPromise[_0xb714('0x20')](_0x3177c3);}return _0x40209a[_0xb714('0x21')]();};}function saveUpdates(_0x2aebc0,_0x1eab52){return function(_0x4c8519){if(_0x4c8519){return _0x4c8519[_0xb714('0x22')](_0x2aebc0)[_0xb714('0x23')](function(_0x3f4ec8){return _0x3f4ec8;});}return null;};}function removeEntity(_0x4be929,_0x17e48b){return function(_0x510c10){if(_0x510c10){return _0x510c10['destroy']()[_0xb714('0x23')](function(){_0x4be929[_0xb714('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2206d0,_0x1b6a9e){return function(_0x68a7e9){if(!_0x68a7e9){_0x2206d0[_0xb714('0x15')](0x194);}return _0x68a7e9;};}function handleError(_0x128b1a,_0x4d7951){_0x4d7951=_0x4d7951||0x1f4;return function(_0x39d0d6){logger[_0xb714('0x24')](_0x39d0d6[_0xb714('0x25')]);if(_0x39d0d6['name']){delete _0x39d0d6['name'];}_0x128b1a[_0xb714('0x16')](_0x4d7951)[_0xb714('0x26')](_0x39d0d6);};}exports[_0xb714('0x22')]=function(_0x2fb1df,_0x1b4b3c){if(_0x2fb1df['body']['id']){delete _0x2fb1df[_0xb714('0x27')]['id'];}return db[_0xb714('0x28')][_0xb714('0x29')]({'where':{'id':_0x2fb1df['params']['id']}})['then'](handleEntityNotFound(_0x1b4b3c,null))[_0xb714('0x23')](saveUpdates(_0x2fb1df[_0xb714('0x27')],null))['then'](respondWithResult(_0x1b4b3c,null))[_0xb714('0x2a')](handleError(_0x1b4b3c,null));};exports[_0xb714('0x2b')]=function(_0xc780de,_0x4b6955){return db[_0xb714('0x28')]['find']({'where':{'id':_0xc780de['params']['id']}})[_0xb714('0x23')](handleEntityNotFound(_0x4b6955,null))[_0xb714('0x23')](removeEntity(_0x4b6955,null))['catch'](handleError(_0x4b6955,null));}; \ No newline at end of file +var _0x44a3=['apply','reject','update','then','end','sendStatus','stack','name','send','body','Action','find','catch','destroy','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','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','json','offset','undefined','count','set','Content-Range'];(function(_0x34fedc,_0x30255f){var _0xbd34b=function(_0x25b598){while(--_0x25b598){_0x34fedc['push'](_0x34fedc['shift']());}};_0xbd34b(++_0x30255f);}(_0x44a3,0x1da));var _0x344a=function(_0x3a175b,_0x505d13){_0x3a175b=_0x3a175b-0x0;var _0x9b84fa=_0x44a3[_0x3a175b];return _0x9b84fa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x344a('0x0'));var jsonpatch=require(_0x344a('0x1'));var rp=require(_0x344a('0x2'));var moment=require(_0x344a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x344a('0x4'));var util=require('util');var path=require(_0x344a('0x5'));var sox=require(_0x344a('0x6'));var csv=require(_0x344a('0x7'));var ejs=require(_0x344a('0x8'));var fs=require('fs');var fs_extra=require(_0x344a('0x9'));var _=require(_0x344a('0xa'));var squel=require(_0x344a('0xb'));var crypto=require(_0x344a('0xc'));var jsforce=require(_0x344a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x344a('0x7'));var querystring=require(_0x344a('0xe'));var Papa=require('papaparse');var Redis=require(_0x344a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x10'));var as=require(_0x344a('0x11'));var hardwareService=require(_0x344a('0x12'));var logger=require(_0x344a('0x13'))(_0x344a('0x14'));var utils=require(_0x344a('0x15'));var config=require(_0x344a('0x16'));var licenseUtil=require(_0x344a('0x17'));var db=require(_0x344a('0x18'))['db'];function respondWithStatusCode(_0x4a7531,_0x2c7d22){_0x2c7d22=_0x2c7d22||0xcc;return function(_0xb87cbd){if(_0xb87cbd){return _0x4a7531['sendStatus'](_0x2c7d22);}return _0x4a7531['status'](_0x2c7d22)['end']();};}function respondWithResult(_0x5abb76,_0x2878cd){_0x2878cd=_0x2878cd||0xc8;return function(_0x4a4290){if(_0x4a4290){return _0x5abb76[_0x344a('0x19')](_0x2878cd)[_0x344a('0x1a')](_0x4a4290);}};}function respondWithFilteredResult(_0x4712ff,_0x87f28b){return function(_0x52509f){if(_0x52509f){var _0x22e8b3=typeof _0x87f28b[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x87f28b['limit']===_0x344a('0x1c');var _0x25c840=_0x52509f[_0x344a('0x1d')];var _0x3c8a8d=_0x22e8b3?0x0:_0x87f28b[_0x344a('0x1b')];var _0x3f5155=_0x22e8b3?_0x52509f[_0x344a('0x1d')]:_0x87f28b[_0x344a('0x1b')]+_0x87f28b['limit'];var _0x16b509;if(_0x3f5155>=_0x25c840){_0x3f5155=_0x25c840;_0x16b509=0xc8;}else{_0x16b509=0xce;}_0x4712ff['status'](_0x16b509);return _0x4712ff[_0x344a('0x1e')](_0x344a('0x1f'),_0x3c8a8d+'-'+_0x3f5155+'/'+_0x25c840)['json'](_0x52509f);}return null;};}function patchUpdates(_0x43fda4){return function(_0x482446){try{jsonpatch[_0x344a('0x20')](_0x482446,_0x43fda4,!![]);}catch(_0x1c9087){return BPromise[_0x344a('0x21')](_0x1c9087);}return _0x482446['save']();};}function saveUpdates(_0x44c9ed,_0x27c1f3){return function(_0x481cee){if(_0x481cee){return _0x481cee[_0x344a('0x22')](_0x44c9ed)['then'](function(_0x1cda8f){return _0x1cda8f;});}return null;};}function removeEntity(_0x228e58,_0x1a4aa3){return function(_0xbb9e5c){if(_0xbb9e5c){return _0xbb9e5c['destroy']()[_0x344a('0x23')](function(){_0x228e58[_0x344a('0x19')](0xcc)[_0x344a('0x24')]();});}};}function handleEntityNotFound(_0x23cd58,_0x39d12a){return function(_0x58de39){if(!_0x58de39){_0x23cd58[_0x344a('0x25')](0x194);}return _0x58de39;};}function handleError(_0xcafa41,_0x433fd6){_0x433fd6=_0x433fd6||0x1f4;return function(_0x34f1a4){logger['error'](_0x34f1a4[_0x344a('0x26')]);if(_0x34f1a4[_0x344a('0x27')]){delete _0x34f1a4[_0x344a('0x27')];}_0xcafa41[_0x344a('0x19')](_0x433fd6)[_0x344a('0x28')](_0x34f1a4);};}exports[_0x344a('0x22')]=function(_0x4fd65d,_0xbf09be){if(_0x4fd65d[_0x344a('0x29')]['id']){delete _0x4fd65d[_0x344a('0x29')]['id'];}return db[_0x344a('0x2a')][_0x344a('0x2b')]({'where':{'id':_0x4fd65d['params']['id']}})[_0x344a('0x23')](handleEntityNotFound(_0xbf09be,null))['then'](saveUpdates(_0x4fd65d['body'],null))[_0x344a('0x23')](respondWithResult(_0xbf09be,null))[_0x344a('0x2c')](handleError(_0xbf09be,null));};exports[_0x344a('0x2d')]=function(_0x21b858,_0x22b7a0){return db['Action'][_0x344a('0x2b')]({'where':{'id':_0x21b858['params']['id']}})[_0x344a('0x23')](handleEntityNotFound(_0x22b7a0,null))[_0x344a('0x23')](removeEntity(_0x22b7a0,null))[_0x344a('0x2c')](handleError(_0x22b7a0,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 514bee9..57a929d 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 _0x0590=['moment','request-promise','rimraf','../../config/environment','exports','define','tools_actions','../../config/logger','api'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0590,0x166));var _0x0059=function(_0x5a5b56,_0x25b0cf){_0x5a5b56=_0x5a5b56-0x0;var _0xc6d035=_0x0590[_0x5a5b56];return _0xc6d035;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0059('0x0'))(_0x0059('0x1'));var moment=require(_0x0059('0x2'));var BPromise=require('bluebird');var rp=require(_0x0059('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0059('0x4'));var config=require(_0x0059('0x5'));var attributes=require('./action.attributes');module[_0x0059('0x6')]=function(_0xb88d6f,_0x489111){return _0xb88d6f[_0x0059('0x7')]('Action',attributes,{'tableName':_0x0059('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cff=['lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','tools_actions'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0x1cff,0x1cc));var _0xf1cf=function(_0x27c582,_0x6652de){_0x27c582=_0x27c582-0x0;var _0x24b4e7=_0x1cff[_0x27c582];return _0x24b4e7;};'use strict';var _=require(_0xf1cf('0x0'));var util=require('util');var logger=require(_0xf1cf('0x1'))('api');var moment=require(_0xf1cf('0x2'));var BPromise=require('bluebird');var rp=require(_0xf1cf('0x3'));var fs=require('fs');var path=require(_0xf1cf('0x4'));var rimraf=require(_0xf1cf('0x5'));var config=require(_0xf1cf('0x6'));var attributes=require('./action.attributes');module[_0xf1cf('0x7')]=function(_0x4ee429,_0x44e83f){return _0x4ee429[_0xf1cf('0x8')]('Action',attributes,{'tableName':_0xf1cf('0x9'),'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 2494ec6..130af9c 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7217,0x19e));var _0x7721=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7217[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\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(_0xa0b359,_0x3ef1bd){var _0x11f480=function(_0x5f0706){while(--_0x5f0706){_0xa0b359['push'](_0xa0b359['shift']());}};_0x11f480(++_0x3ef1bd);}(_0x1261,0x144));var _0x1126=function(_0x5b5947,_0x11623c){_0x5b5947=_0x5b5947-0x0;var _0x7623e0=_0x1261[_0x5b5947];return _0x7623e0;};'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')]('Action,\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 diff --git a/server/api/action/index.js b/server/api/action/index.js index b91b120..232bb6f 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 _0x891f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated','update','delete','/:id','exports','multer','util','path','connect-timeout','express'];(function(_0x31ed0a,_0x248431){var _0x30a689=function(_0x426283){while(--_0x426283){_0x31ed0a['push'](_0x31ed0a['shift']());}};_0x30a689(++_0x248431);}(_0x891f,0x6b));var _0xf891=function(_0x41da2a,_0x252b01){_0x41da2a=_0x41da2a-0x0;var _0x15e039=_0x891f[_0x41da2a];return _0x15e039;};'use strict';var multer=require(_0xf891('0x0'));var util=require(_0xf891('0x1'));var path=require(_0xf891('0x2'));var timeout=require(_0xf891('0x3'));var express=require(_0xf891('0x4'));var router=express[_0xf891('0x5')]();var fs_extra=require(_0xf891('0x6'));var auth=require(_0xf891('0x7'));var interaction=require(_0xf891('0x8'));var config=require(_0xf891('0x9'));var controller=require('./action.controller');router[_0xf891('0xa')]('/:id',auth[_0xf891('0xb')](),controller[_0xf891('0xc')]);router[_0xf891('0xd')](_0xf891('0xe'),auth[_0xf891('0xb')](),controller['destroy']);module[_0xf891('0xf')]=router; \ No newline at end of file +var _0x4798=['/:id','isAuthenticated','update','destroy','exports','path','express','Router','../../components/auth/service','../../config/environment','put'];(function(_0x215788,_0x5d430c){var _0x1dacb9=function(_0x417e22){while(--_0x417e22){_0x215788['push'](_0x215788['shift']());}};_0x1dacb9(++_0x5d430c);}(_0x4798,0x118));var _0x8479=function(_0x5562fe,_0x4e809c){_0x5562fe=_0x5562fe-0x0;var _0x1829c7=_0x4798[_0x5562fe];return _0x1829c7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8479('0x0'));var timeout=require('connect-timeout');var express=require(_0x8479('0x1'));var router=express[_0x8479('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8479('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8479('0x4'));var controller=require('./action.controller');router[_0x8479('0x5')](_0x8479('0x6'),auth[_0x8479('0x7')](),controller[_0x8479('0x8')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8479('0x9')]);module[_0x8479('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 728f055..3dc5908 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 _0x24ca=['sequelize','STRING','TEXT'];(function(_0x2de0ec,_0x38812f){var _0x13aa7b=function(_0x340176){while(--_0x340176){_0x2de0ec['push'](_0x2de0ec['shift']());}};_0x13aa7b(++_0x38812f);}(_0x24ca,0x1bc));var _0xa24c=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x24ca[_0x5a19fc];return _0x34b413;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file +var _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0x5fd1,0x155));var _0x15fd=function(_0x7c7843,_0x2f5468){_0x7c7843=_0x7c7843-0x0;var _0x393bc0=_0x5fd1[_0x7c7843];return _0x393bc0;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index c915987..26f0f64 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 _0x11fb=['save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','AnalyticCustomReport','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','right_join','SUM(%s)','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)','includes','IS\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','order','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','left_join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','%s.%s\x20=\x20%s.%s','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','savename','COUNT(*)','SELECT','run','runReport','cross_join','DESC','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x11fb,0x131));var _0xb11f=function(_0x54957a,_0x2f0bcf){_0x54957a=_0x54957a-0x0;var _0x52d5d3=_0x11fb[_0x54957a];return _0x52d5d3;};'use strict';var emlformat=require(_0xb11f('0x0'));var rimraf=require(_0xb11f('0x1'));var zipdir=require(_0xb11f('0x2'));var jsonpatch=require(_0xb11f('0x3'));var rp=require(_0xb11f('0x4'));var moment=require(_0xb11f('0x5'));var BPromise=require(_0xb11f('0x6'));var Mustache=require(_0xb11f('0x7'));var util=require('util');var path=require(_0xb11f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb11f('0x9'));var fs=require('fs');var fs_extra=require(_0xb11f('0xa'));var _=require(_0xb11f('0xb'));var squel=require(_0xb11f('0xc'));var crypto=require(_0xb11f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb11f('0xe'));var toCsv=require(_0xb11f('0xf'));var querystring=require(_0xb11f('0x10'));var Papa=require(_0xb11f('0x11'));var Redis=require(_0xb11f('0x12'));var authService=require(_0xb11f('0x13'));var qs=require(_0xb11f('0x14'));var as=require(_0xb11f('0x15'));var hardwareService=require(_0xb11f('0x16'));var logger=require(_0xb11f('0x17'))(_0xb11f('0x18'));var utils=require(_0xb11f('0x19'));var config=require(_0xb11f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb11f('0x1b'))['db'];var dbH=require(_0xb11f('0x1b'))[_0xb11f('0x1c')];function respondWithStatusCode(_0x5177ad,_0x40a2e3){_0x40a2e3=_0x40a2e3||0xcc;return function(_0x333360){if(_0x333360){return _0x5177ad[_0xb11f('0x1d')](_0x40a2e3);}return _0x5177ad[_0xb11f('0x1e')](_0x40a2e3)[_0xb11f('0x1f')]();};}function respondWithResult(_0x51e1c6,_0x193122){_0x193122=_0x193122||0xc8;return function(_0x2962e6){if(_0x2962e6){return _0x51e1c6[_0xb11f('0x1e')](_0x193122)[_0xb11f('0x20')](_0x2962e6);}};}function respondWithFilteredResult(_0x466f11,_0x15e48f){return function(_0x187a4f){if(_0x187a4f){var _0x3e4694=typeof _0x15e48f[_0xb11f('0x21')]===_0xb11f('0x22')&&typeof _0x15e48f[_0xb11f('0x23')]===_0xb11f('0x22');var _0x2dbb60=_0x187a4f[_0xb11f('0x24')];var _0x38df8b=_0x3e4694?0x0:_0x15e48f[_0xb11f('0x21')];var _0x14be34=_0x3e4694?_0x187a4f[_0xb11f('0x24')]:_0x15e48f[_0xb11f('0x21')]+_0x15e48f[_0xb11f('0x23')];var _0x317f53;if(_0x14be34>=_0x2dbb60){_0x14be34=_0x2dbb60;_0x317f53=0xc8;}else{_0x317f53=0xce;}_0x466f11[_0xb11f('0x1e')](_0x317f53);return _0x466f11['set'](_0xb11f('0x25'),_0x38df8b+'-'+_0x14be34+'/'+_0x2dbb60)[_0xb11f('0x20')](_0x187a4f);}return null;};}function patchUpdates(_0x3f1dd2){return function(_0x484c31){try{jsonpatch['apply'](_0x484c31,_0x3f1dd2,!![]);}catch(_0x4b13e3){return BPromise[_0xb11f('0x26')](_0x4b13e3);}return _0x484c31[_0xb11f('0x27')]();};}function saveUpdates(_0x2f11b9,_0x262bba){return function(_0x31d4e4){if(_0x31d4e4){return _0x31d4e4[_0xb11f('0x28')](_0x2f11b9)[_0xb11f('0x29')](function(_0x249ccb){return _0x249ccb;});}return null;};}function removeEntity(_0x2c5ad2,_0x21561e){return function(_0x2c42e1){if(_0x2c42e1){return _0x2c42e1[_0xb11f('0x2a')]()['then'](function(){var _0x31b137=_0x2c42e1['get']({'plain':!![]});var _0x4ccd02=_0xb11f('0x2b');return db[_0xb11f('0x2c')][_0xb11f('0x2a')]({'where':{'type':_0x4ccd02,'resourceId':_0x31b137['id']}})[_0xb11f('0x29')](function(){return _0x2c42e1;});})['then'](function(){_0x2c5ad2[_0xb11f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54be11,_0x14adf1){return function(_0x592c00){if(!_0x592c00){_0x54be11[_0xb11f('0x1d')](0x194);}return _0x592c00;};}function handleError(_0x3bb1a7,_0x5bd105){_0x5bd105=_0x5bd105||0x1f4;return function(_0x5113f8){logger[_0xb11f('0x2d')](_0x5113f8[_0xb11f('0x2e')]);if(_0x5113f8[_0xb11f('0x2f')]){delete _0x5113f8[_0xb11f('0x2f')];}_0x3bb1a7[_0xb11f('0x1e')](_0x5bd105)[_0xb11f('0x30')](_0x5113f8);};}exports['index']=function(_0x3b1d0f,_0x44f6ae){var _0x59efe7={},_0x59d8a9={},_0x4e7837={'count':0x0,'rows':[]};var _0x24a5dd=_[_0xb11f('0x31')](db['AnalyticCustomReport']['rawAttributes'],function(_0x4d63ef){return{'name':_0x4d63ef[_0xb11f('0x32')],'type':_0x4d63ef['type'][_0xb11f('0x33')]};});_0x59d8a9[_0xb11f('0x34')]=_[_0xb11f('0x31')](_0x24a5dd,_0xb11f('0x2f'));_0x59d8a9[_0xb11f('0x35')]=_[_0xb11f('0x36')](_0x3b1d0f[_0xb11f('0x35')]);_0x59d8a9['filters']=_[_0xb11f('0x37')](_0x59d8a9['model'],_0x59d8a9[_0xb11f('0x35')]);_0x59efe7[_0xb11f('0x38')]=_['intersection'](_0x59d8a9['model'],qs[_0xb11f('0x39')](_0x3b1d0f[_0xb11f('0x35')][_0xb11f('0x39')]));_0x59efe7[_0xb11f('0x38')]=_0x59efe7['attributes'][_0xb11f('0x3a')]?_0x59efe7[_0xb11f('0x38')]:_0x59d8a9[_0xb11f('0x34')];if(!_0x3b1d0f['query'][_0xb11f('0x3b')](_0xb11f('0x3c'))){_0x59efe7[_0xb11f('0x23')]=qs['limit'](_0x3b1d0f[_0xb11f('0x35')][_0xb11f('0x23')]);_0x59efe7[_0xb11f('0x21')]=qs[_0xb11f('0x21')](_0x3b1d0f[_0xb11f('0x35')]['offset']);}_0x59efe7['order']=qs[_0xb11f('0x3d')](_0x3b1d0f['query'][_0xb11f('0x3d')]);_0x59efe7[_0xb11f('0x3e')]=qs[_0xb11f('0x3f')](_[_0xb11f('0x40')](_0x3b1d0f[_0xb11f('0x35')],_0x59d8a9[_0xb11f('0x3f')]),_0x24a5dd);if(_0x3b1d0f[_0xb11f('0x35')][_0xb11f('0x41')]){_0x59efe7[_0xb11f('0x3e')]=_[_0xb11f('0x42')](_0x59efe7['where'],{'$or':_[_0xb11f('0x31')](_0x24a5dd,function(_0x2acac3){if(_0x2acac3[_0xb11f('0x43')]!==_0xb11f('0x44')){var _0x29c5e8={};_0x29c5e8[_0x2acac3[_0xb11f('0x2f')]]={'$like':'%'+_0x3b1d0f['query'][_0xb11f('0x41')]+'%'};return _0x29c5e8;}})});}_0x59efe7=_[_0xb11f('0x42')]({},_0x59efe7,_0x3b1d0f[_0xb11f('0x45')]);var _0x53051f={'where':_0x59efe7[_0xb11f('0x3e')]};return db['AnalyticCustomReport'][_0xb11f('0x24')](_0x53051f)['then'](function(_0x235091){_0x4e7837[_0xb11f('0x24')]=_0x235091;if(_0x3b1d0f[_0xb11f('0x35')][_0xb11f('0x46')]){_0x59efe7[_0xb11f('0x47')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xb11f('0x48')](_0x59efe7);})[_0xb11f('0x29')](function(_0x57206b){_0x4e7837[_0xb11f('0x49')]=_0x57206b;return _0x4e7837;})[_0xb11f('0x29')](respondWithFilteredResult(_0x44f6ae,_0x59efe7))[_0xb11f('0x4a')](handleError(_0x44f6ae,null));};exports[_0xb11f('0x4b')]=function(_0xd2cd95,_0x442b00){var _0x2212c4={'raw':![],'where':{'id':_0xd2cd95[_0xb11f('0x4c')]['id']}},_0x4baf4e={};_0x4baf4e['model']=_['keys'](db[_0xb11f('0x4d')][_0xb11f('0x4e')]);_0x4baf4e[_0xb11f('0x35')]=_[_0xb11f('0x36')](_0xd2cd95[_0xb11f('0x35')]);_0x4baf4e[_0xb11f('0x3f')]=_['intersection'](_0x4baf4e[_0xb11f('0x34')],_0x4baf4e[_0xb11f('0x35')]);_0x2212c4['attributes']=_[_0xb11f('0x37')](_0x4baf4e['model'],qs[_0xb11f('0x39')](_0xd2cd95[_0xb11f('0x35')][_0xb11f('0x39')]));_0x2212c4['attributes']=_0x2212c4[_0xb11f('0x38')]['length']?_0x2212c4[_0xb11f('0x38')]:_0x4baf4e[_0xb11f('0x34')];if(_0xd2cd95['query'][_0xb11f('0x46')]){_0x2212c4[_0xb11f('0x47')]=[{'all':!![]}];}_0x2212c4=_['merge']({},_0x2212c4,_0xd2cd95[_0xb11f('0x45')]);return db[_0xb11f('0x4d')][_0xb11f('0x4f')](_0x2212c4)[_0xb11f('0x29')](handleEntityNotFound(_0x442b00,null))[_0xb11f('0x29')](respondWithResult(_0x442b00,null))[_0xb11f('0x4a')](handleError(_0x442b00,null));};exports[_0xb11f('0x50')]=function(_0x351ee5,_0x2ce91e){return db[_0xb11f('0x4d')][_0xb11f('0x50')](_0x351ee5['body'],{})['then'](function(_0xf3cc2b){var _0x18eefb=_0x351ee5[_0xb11f('0x51')]['get']({'plain':!![]});if(!_0x18eefb)throw new Error(_0xb11f('0x52'));if(_0x18eefb[_0xb11f('0x53')]===_0xb11f('0x51')){var _0x1653e7=_0xf3cc2b['get']({'plain':!![]});var _0x492cef='Reports';return db[_0xb11f('0x54')][_0xb11f('0x4f')]({'where':{'name':_0x492cef,'userProfileId':_0x18eefb[_0xb11f('0x55')]},'raw':!![]})[_0xb11f('0x29')](function(_0x479815){if(_0x479815&&_0x479815[_0xb11f('0x56')]===0x0){return db['UserProfileResource'][_0xb11f('0x50')]({'name':_0x1653e7['name'],'resourceId':_0x1653e7['id'],'type':_0xb11f('0x2b'),'sectionId':_0x479815['id']},{})[_0xb11f('0x29')](function(){return _0xf3cc2b;});}else{return _0xf3cc2b;}})[_0xb11f('0x4a')](function(_0x5cb97f){logger[_0xb11f('0x2d')](_0xb11f('0x57'),_0x5cb97f);throw _0x5cb97f;});}return _0xf3cc2b;})['then'](respondWithResult(_0x2ce91e,0xc9))[_0xb11f('0x4a')](handleError(_0x2ce91e,null));};exports[_0xb11f('0x28')]=function(_0x3f032e,_0x593d17){if(_0x3f032e[_0xb11f('0x58')]['id']){delete _0x3f032e[_0xb11f('0x58')]['id'];}return db[_0xb11f('0x4d')][_0xb11f('0x4f')]({'where':{'id':_0x3f032e[_0xb11f('0x4c')]['id']}})[_0xb11f('0x29')](handleEntityNotFound(_0x593d17,null))[_0xb11f('0x29')](saveUpdates(_0x3f032e['body'],null))[_0xb11f('0x29')](respondWithResult(_0x593d17,null))[_0xb11f('0x4a')](handleError(_0x593d17,null));};exports[_0xb11f('0x2a')]=function(_0x3d8e8f,_0x1e2320){return db[_0xb11f('0x4d')][_0xb11f('0x4f')]({'where':{'id':_0x3d8e8f[_0xb11f('0x4c')]['id']}})[_0xb11f('0x29')](handleEntityNotFound(_0x1e2320,null))[_0xb11f('0x29')](removeEntity(_0x1e2320,null))['catch'](handleError(_0x1e2320,null));};exports[_0xb11f('0x59')]=function(_0x25ec45,_0x9fa56f){var _0x34421b=0xa;var _0x5e5dbb=[_0xb11f('0x5a'),'left_join',_0xb11f('0x5b'),'cross_join'];var _0x5a1eef={'SUM':_0xb11f('0x5c'),'COUNT':_0xb11f('0x5d'),'COUNT DISTINCT':_0xb11f('0x5e'),'MAX':_0xb11f('0x5f'),'MIN':_0xb11f('0x60'),'AVG':_0xb11f('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb11f('0x62')};var _0x3d9b24={'SEC_TO_TIME':_0xb11f('0x63'),'DATE':_0xb11f('0x64'),'HOUR':_0xb11f('0x65'),'ROUND':_0xb11f('0x66'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1985ad=function(_0x26174a){return!_[_0xb11f('0x67')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb11f('0x68'),'IS\x20NOT\x20EMPTY'],_0x26174a);};var _0x340531=function(_0xaf67f){if(!_0xaf67f||!_0xaf67f[_0xb11f('0x69')][_0xb11f('0x3a')]){return'';}for(var _0x4997fc='(',_0x49fc47=0x0;_0x49fc47<_0xaf67f['rules'][_0xb11f('0x3a')];_0x49fc47+=0x1){_0x49fc47>0x0&&(_0x4997fc+='\x20'+_0xaf67f[_0xb11f('0x6a')]+'\x20');_0x4997fc+=_0xaf67f[_0xb11f('0x69')][_0x49fc47][_0xb11f('0x6b')]?_0x340531(_0xaf67f[_0xb11f('0x69')][_0x49fc47][_0xb11f('0x6b')]):_0xaf67f[_0xb11f('0x69')][_0x49fc47]['field']+'\x20'+_0xaf67f[_0xb11f('0x69')][_0x49fc47][_0xb11f('0x6c')]+(_0x1985ad(_0xaf67f[_0xb11f('0x69')][_0x49fc47][_0xb11f('0x6c')])?'\x20'+_0xaf67f['rules'][_0x49fc47][_0xb11f('0x6d')]:'');}return _0x4997fc+')';};var _0x314fa1={'where':{'id':_0x25ec45['params']['id']}},_0x3f7f96,_0x40692a,_0x56f0ad,_0x1cebe0,_0x4202b9;_0x314fa1=_[_0xb11f('0x42')]({},_0x314fa1,_0x25ec45[_0xb11f('0x45')]);return db[_0xb11f('0x4d')][_0xb11f('0x4f')](_0x314fa1)[_0xb11f('0x29')](function(_0x55ea29){if(_0x55ea29){_0x3f7f96=_0x55ea29;return _0x55ea29[_0xb11f('0x6e')]();}return null;})[_0xb11f('0x29')](function(_0x14db42){if(_0x14db42){if(!_0x14db42[_0xb11f('0x3a')]){throw new db[(_0xb11f('0x6f'))][(_0xb11f('0x70'))](_0xb11f('0x71'),0x193);}_0x40692a=_0x14db42;return db[_0xb11f('0x72')][_0xb11f('0x48')]({'raw':!![]});}return null;})[_0xb11f('0x29')](function(_0x34dd7e){if(_0x34dd7e){_0x56f0ad=_[_0xb11f('0x73')](_0x34dd7e,'id');var _0x5bd649;var _0x408b24=squel[_0xb11f('0x74')]();_0x408b24[_0xb11f('0x75')](_0x3f7f96[_0xb11f('0x76')]);for(var _0x3284f6=0x0;_0x3284f6<_0x40692a['length'];_0x3284f6+=0x1){_0x5bd649=_0x40692a[_0x3284f6][_0xb11f('0x77')]?_0x56f0ad[_0x40692a[_0x3284f6]['MetricId']][_0xb11f('0x78')]:_0x40692a[_0x3284f6][_0xb11f('0x79')];_0x5bd649=_0x40692a[_0x3284f6][_0xb11f('0x7a')]?_[_0xb11f('0x7b')](_0x5a1eef[_0x40692a[_0x3284f6][_0xb11f('0x7a')]],'%s',_0x5bd649):_0x5bd649;_0x5bd649=_0x40692a[_0x3284f6][_0xb11f('0x7c')]?_[_0xb11f('0x7b')](_0x3d9b24[_0x40692a[_0x3284f6][_0xb11f('0x7c')]],'%s',_0x5bd649):_0x5bd649;if(_0x40692a[_0x3284f6][_0xb11f('0x7d')]){_0x408b24[_0xb11f('0x6b')](_0x5bd649);}_0x40692a[_0x3284f6][_0xb11f('0x7e')]&&_0x408b24[_0xb11f('0x7f')](_0x5bd649,_0x40692a[_0x3284f6]['orderBy']==='DESC'?![]:!![]);_0x408b24[_0xb11f('0x79')](_0x5bd649,_0x40692a[_0x3284f6][_0xb11f('0x80')]||_0x5bd649);}if(_0x3f7f96[_0xb11f('0x81')]){_0x3f7f96['joins']=JSON[_0xb11f('0x82')](_0x3f7f96[_0xb11f('0x81')]);for(var _0x472f09=0x0;_0x472f09<_0x3f7f96['joins'][_0xb11f('0x3a')];_0x472f09+=0x1){if(_0x3f7f96['joins'][_0x472f09][_0xb11f('0x43')]&&_['includes'](_0x5e5dbb,_0x3f7f96[_0xb11f('0x81')][_0x472f09][_0xb11f('0x43')])&&_0x3f7f96[_0xb11f('0x81')][_0x472f09][_0xb11f('0x83')]&&_0x3f7f96[_0xb11f('0x81')][_0x472f09]['foreignTable']&&_0x3f7f96[_0xb11f('0x81')][_0x472f09][_0xb11f('0x84')]){_0x408b24[_0x3f7f96[_0xb11f('0x81')][_0x472f09]['type']](_0x3f7f96['joins'][_0x472f09]['foreignTable'],null,util[_0xb11f('0x7c')]('%s.%s\x20=\x20%s.%s',_0x3f7f96['table'],_0x3f7f96[_0xb11f('0x81')][_0x472f09]['parentKey'],_0x3f7f96[_0xb11f('0x81')][_0x472f09][_0xb11f('0x85')],_0x3f7f96[_0xb11f('0x81')][_0x472f09][_0xb11f('0x84')]));}}}if(_0x3f7f96[_0xb11f('0x86')]){_0x3f7f96[_0xb11f('0x86')]=JSON[_0xb11f('0x82')](_0x3f7f96[_0xb11f('0x86')]);_0x408b24[_0xb11f('0x3e')](_0x340531(_0x3f7f96[_0xb11f('0x86')][_0xb11f('0x6b')]));}_0x4202b9=_0x408b24['clone']();_0x408b24[_0xb11f('0x23')](_0x34421b);_0x408b24['offset'](0x0);logger[_0xb11f('0x87')](_0xb11f('0x88'),_0x408b24['toString']());return dbH[_0xb11f('0x89')]['query'](_0x408b24[_0xb11f('0x8a')](),{'type':dbH[_0xb11f('0x89')][_0xb11f('0x8b')]['SELECT']});}})[_0xb11f('0x29')](respondWithResult(_0x9fa56f,null))[_0xb11f('0x4a')](handleError(_0x9fa56f,null));};function runReport(_0x145462,_0x3f860e,_0x4a46f4){var _0x5757e7=_0x3f860e[_0xb11f('0x2f')];var _0x398ebf=0xa;var _0x19f64a=[_0xb11f('0x5a'),_0xb11f('0x8c'),_0xb11f('0x5b'),'cross_join'];var _0x454310={'SUM':_0xb11f('0x5c'),'COUNT':_0xb11f('0x5d'),'COUNT DISTINCT':_0xb11f('0x5e'),'MAX':_0xb11f('0x5f'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xb11f('0x8d'),'GROUP_CONCAT ASC':_0xb11f('0x8e'),'GROUP_CONCAT DESC':_0xb11f('0x62')};var _0x1dc041={'SEC_TO_TIME':_0xb11f('0x63'),'DATE':_0xb11f('0x64'),'HOUR':_0xb11f('0x65'),'ROUND':_0xb11f('0x66'),'UNIX_TIMESTAMP':_0xb11f('0x8f')};var _0x2fac8e=function(_0x10b162){return!_[_0xb11f('0x67')]([_0xb11f('0x90'),_0xb11f('0x91'),_0xb11f('0x68'),_0xb11f('0x92')],_0x10b162);};var _0x7f8c97=function(_0x15780b){if(!_0x15780b||!_0x15780b[_0xb11f('0x69')][_0xb11f('0x3a')]){return'';}for(var _0x2ace1f='(',_0x1ef2b1=0x0;_0x1ef2b1<_0x15780b[_0xb11f('0x69')][_0xb11f('0x3a')];_0x1ef2b1+=0x1){_0x1ef2b1>0x0&&(_0x2ace1f+='\x20'+_0x15780b[_0xb11f('0x6a')]+'\x20');_0x2ace1f+=_0x15780b[_0xb11f('0x69')][_0x1ef2b1][_0xb11f('0x6b')]?_0x7f8c97(_0x15780b['rules'][_0x1ef2b1]['group']):_0x15780b[_0xb11f('0x69')][_0x1ef2b1]['field']+'\x20'+_0x15780b[_0xb11f('0x69')][_0x1ef2b1][_0xb11f('0x6c')]+(_0x2fac8e(_0x15780b[_0xb11f('0x69')][_0x1ef2b1]['condition'])?'\x20'+_0x15780b[_0xb11f('0x69')][_0x1ef2b1]['value']:'');}return _0x2ace1f+')';};var _0x58b5f5={'where':{'id':_0x145462['id']}},_0x4b28c2,_0x39035c,_0x3527af,_0x33df96,_0x2ab825;_0x58b5f5=_['merge']({},_0x58b5f5,_0x4a46f4);return db[_0xb11f('0x4d')][_0xb11f('0x4f')](_0x58b5f5)[_0xb11f('0x29')](function(_0x363424){if(_0x363424){_0x4b28c2=_0x363424;return _0x363424[_0xb11f('0x6e')]();}return null;})[_0xb11f('0x29')](function(_0xa10855){if(_0xa10855){if(!_0xa10855[_0xb11f('0x3a')]){throw new db[(_0xb11f('0x6f'))][(_0xb11f('0x70'))](_0xb11f('0x71'),0x193);}_0x39035c=_0xa10855;return db[_0xb11f('0x72')]['findAll']({'raw':!![]});}return null;})[_0xb11f('0x29')](function(_0x2bc50a){if(_0x2bc50a){_0x3527af=_[_0xb11f('0x73')](_0x2bc50a,'id');var _0x15fadb;var _0x101ac4=squel[_0xb11f('0x74')]();_0x101ac4[_0xb11f('0x75')](_0x4b28c2[_0xb11f('0x76')]);for(var _0x19d190=0x0;_0x19d190<_0x39035c[_0xb11f('0x3a')];_0x19d190+=0x1){_0x15fadb=_0x39035c[_0x19d190][_0xb11f('0x77')]?_0x3527af[_0x39035c[_0x19d190][_0xb11f('0x77')]][_0xb11f('0x78')]:_0x39035c[_0x19d190]['field'];_0x15fadb=_0x39035c[_0x19d190][_0xb11f('0x7a')]?_['replace'](_0x454310[_0x39035c[_0x19d190][_0xb11f('0x7a')]],'%s',_0x15fadb):_0x15fadb;_0x15fadb=_0x39035c[_0x19d190][_0xb11f('0x7c')]?_['replace'](_0x1dc041[_0x39035c[_0x19d190][_0xb11f('0x7c')]],'%s',_0x15fadb):_0x15fadb;if(_0x39035c[_0x19d190][_0xb11f('0x7d')]){_0x101ac4[_0xb11f('0x6b')](_0x15fadb);}_0x39035c[_0x19d190][_0xb11f('0x7e')]&&_0x101ac4[_0xb11f('0x7f')](_0x15fadb,_0x39035c[_0x19d190][_0xb11f('0x7e')]==='DESC'?![]:!![]);_0x101ac4[_0xb11f('0x79')](_0x15fadb,_0x39035c[_0x19d190][_0xb11f('0x80')]||_0x15fadb);}if(_0x4b28c2[_0xb11f('0x81')]){_0x4b28c2[_0xb11f('0x81')]=JSON[_0xb11f('0x82')](_0x4b28c2[_0xb11f('0x81')]);for(var _0x5f522f=0x0;_0x5f522f<_0x4b28c2[_0xb11f('0x81')][_0xb11f('0x3a')];_0x5f522f+=0x1){if(_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x43')]&&_[_0xb11f('0x67')](_0x19f64a,_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x43')])&&_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x83')]&&_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x85')]&&_0x4b28c2['joins'][_0x5f522f][_0xb11f('0x84')]){_0x101ac4[_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x43')]](_0x4b28c2[_0xb11f('0x81')][_0x5f522f]['foreignTable'],null,util['format'](_0xb11f('0x93'),_0x4b28c2[_0xb11f('0x76')],_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x83')],_0x4b28c2[_0xb11f('0x81')][_0x5f522f]['foreignTable'],_0x4b28c2[_0xb11f('0x81')][_0x5f522f][_0xb11f('0x84')]));}}}if(_0x4b28c2['conditions']){_0x4b28c2[_0xb11f('0x86')]=JSON[_0xb11f('0x82')](_0x4b28c2[_0xb11f('0x86')]);_0x101ac4[_0xb11f('0x3e')](_0x7f8c97(_0x4b28c2['conditions'][_0xb11f('0x6b')]));}_0x2ab825=_0x101ac4[_0xb11f('0x94')]();_0x101ac4[_0xb11f('0x23')](_0x398ebf);_0x101ac4['offset'](0x0);return;}})['then'](function(){if(_0x3f860e[_0xb11f('0x95')]===_0xb11f('0x96')){return null;}var _0x38b26f=_['merge'](_0x3f860e,{'name':_0x3f860e[_0xb11f('0x97')]||_0x3f860e['name']||_0x4b28c2['name'],'basename':_0x5757e7,'savename':util['format'](_0xb11f('0x98'),_0x3f860e[_0xb11f('0x2f')]||_0x4b28c2[_0xb11f('0x2f')],require(_0xb11f('0x99'))[_0xb11f('0x9a')](0x4),_0x3f860e['output']||_0xb11f('0x9b')),'reportId':_0x4b28c2['id'],'reportType':_0xb11f('0x9c')});return db[_0xb11f('0x9d')][_0xb11f('0x50')](_0x38b26f,{'raw':!![]});})['then'](function(_0x105c96){if(_0x4b28c2[_0xb11f('0x76')]==='cdr'){_0x2ab825[_0xb11f('0x3e')](_0x4b28c2[_0xb11f('0x76')]+_0xb11f('0x9e'),_0x3f860e[_0xb11f('0x9f')],_0x3f860e[_0xb11f('0xa0')]);}else{_0x2ab825['where'](_0x4b28c2[_0xb11f('0x76')]+_0xb11f('0xa1'),_0x3f860e[_0xb11f('0x9f')],_0x3f860e[_0xb11f('0xa0')]);}if(_0x105c96){logger[_0xb11f('0xa2')](_0xb11f('0xa3'),_0x2ab825[_0xb11f('0x8a')]());require(_0xb11f('0xa4'))['fork'](path[_0xb11f('0x5a')](__dirname,'../../components/export/',_0x105c96['output']),[_0x105c96['id'],_0x2ab825['toString'](),path[_0xb11f('0x5a')](__dirname,'../../files/reports',_0x105c96[_0xb11f('0xa5')]),_0x5757e7]);return _0x105c96;}else{var _0x16dfb9=squel['select']();_0x16dfb9['from']('('+_0x2ab825[_0xb11f('0x8a')]()+')','countTable');_0x16dfb9[_0xb11f('0x79')](_0xb11f('0xa6'),_0xb11f('0x24'));_0x2ab825[_0xb11f('0x23')](_0x3f860e[_0xb11f('0x23')]||_0x398ebf);_0x2ab825['offset'](_0x3f860e[_0xb11f('0x21')]||0x0);return dbH[_0xb11f('0x89')][_0xb11f('0x35')](_0x16dfb9[_0xb11f('0x8a')](),{'type':dbH[_0xb11f('0x89')][_0xb11f('0x8b')]['SELECT']})[_0xb11f('0x29')](function(_0xb1b446){if(!_0xb1b446[_0xb11f('0x3a')]){_0x33df96=0x0;}else{_0x33df96=_0xb1b446[0x0]['count']||0x0;}return dbH['sequelize'][_0xb11f('0x35')](_0x2ab825[_0xb11f('0x8a')](),{'type':dbH[_0xb11f('0x89')][_0xb11f('0x8b')][_0xb11f('0xa7')]});})[_0xb11f('0x29')](function(_0x4c6ea3){return{'rows':_0x4c6ea3||[],'count':_0x33df96};});}});}exports[_0xb11f('0xa8')]=function(_0x3d3b8a,_0x39566d){return runReport(_0x3d3b8a[_0xb11f('0x4c')],_0x3d3b8a[_0xb11f('0x35')],_0x3d3b8a['options'])[_0xb11f('0x29')](respondWithResult(_0x39566d,null))[_0xb11f('0x4a')](handleError(_0x39566d,null));};exports[_0xb11f('0xa9')]=runReport;exports['query']=function(_0x26f696,_0x3f1bfb){var _0x1f6011=0xa;var _0x36c97f=['join','left_join',_0xb11f('0x5b'),_0xb11f('0xaa')];var _0x48e2f5={'SUM':_0xb11f('0x5c'),'COUNT':_0xb11f('0x5d'),'COUNT DISTINCT':_0xb11f('0x5e'),'MAX':_0xb11f('0x5f'),'MIN':_0xb11f('0x60'),'AVG':_0xb11f('0x61'),'GROUP_CONCAT':_0xb11f('0x8d'),'GROUP_CONCAT ASC':_0xb11f('0x8e'),'GROUP_CONCAT DESC':_0xb11f('0x62')};var _0x3ffe4c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb11f('0x64'),'HOUR':_0xb11f('0x65'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb11f('0x8f')};var _0x1def94=function(_0x4829c3){return!_[_0xb11f('0x67')]([_0xb11f('0x90'),_0xb11f('0x91'),_0xb11f('0x68'),'IS\x20NOT\x20EMPTY'],_0x4829c3);};var _0x3aa1dd=function(_0x3f0ece){if(!_0x3f0ece||!_0x3f0ece[_0xb11f('0x69')][_0xb11f('0x3a')]){return'';}for(var _0x583ee7='(',_0x5e15da=0x0;_0x5e15da<_0x3f0ece[_0xb11f('0x69')][_0xb11f('0x3a')];_0x5e15da+=0x1){_0x5e15da>0x0&&(_0x583ee7+='\x20'+_0x3f0ece[_0xb11f('0x6a')]+'\x20');_0x583ee7+=_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x6b')]?_0x3aa1dd(_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x6b')]):_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x79')]+'\x20'+_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x6c')]+(_0x1def94(_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x6c')])?'\x20'+_0x3f0ece[_0xb11f('0x69')][_0x5e15da][_0xb11f('0x6d')]:'');}return _0x583ee7+')';};var _0x265410={'where':{'id':_0x26f696[_0xb11f('0x4c')]['id']}},_0x2d0970,_0x46eb9a,_0x41c4e1,_0x5a79a3,_0x2106dd;_0x265410=_[_0xb11f('0x42')]({},_0x265410,_0x26f696[_0xb11f('0x45')]);return db[_0xb11f('0x4d')][_0xb11f('0x4f')](_0x265410)[_0xb11f('0x29')](function(_0x240f64){if(_0x240f64){_0x2d0970=_0x240f64;return _0x240f64[_0xb11f('0x6e')]();}return null;})['then'](function(_0x23875a){if(_0x23875a){if(!_0x23875a[_0xb11f('0x3a')]){throw new db['Sequelize'][(_0xb11f('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x46eb9a=_0x23875a;return db[_0xb11f('0x72')][_0xb11f('0x48')]({'raw':!![]});}return null;})[_0xb11f('0x29')](function(_0x241a71){if(_0x241a71){_0x41c4e1=_[_0xb11f('0x73')](_0x241a71,'id');var _0x44298;var _0x2ff93e=squel[_0xb11f('0x74')]();_0x2ff93e[_0xb11f('0x75')](_0x2d0970[_0xb11f('0x76')]);for(var _0x47cfa2=0x0;_0x47cfa2<_0x46eb9a['length'];_0x47cfa2+=0x1){_0x44298=_0x46eb9a[_0x47cfa2][_0xb11f('0x77')]?_0x41c4e1[_0x46eb9a[_0x47cfa2][_0xb11f('0x77')]][_0xb11f('0x78')]:_0x46eb9a[_0x47cfa2][_0xb11f('0x79')];_0x44298=_0x46eb9a[_0x47cfa2]['function']?_['replace'](_0x48e2f5[_0x46eb9a[_0x47cfa2]['function']],'%s',_0x44298):_0x44298;_0x44298=_0x46eb9a[_0x47cfa2][_0xb11f('0x7c')]?_[_0xb11f('0x7b')](_0x3ffe4c[_0x46eb9a[_0x47cfa2][_0xb11f('0x7c')]],'%s',_0x44298):_0x44298;if(_0x46eb9a[_0x47cfa2][_0xb11f('0x7d')]){_0x2ff93e[_0xb11f('0x6b')](_0x44298);}_0x46eb9a[_0x47cfa2][_0xb11f('0x7e')]&&_0x2ff93e[_0xb11f('0x7f')](_0x44298,_0x46eb9a[_0x47cfa2][_0xb11f('0x7e')]===_0xb11f('0xab')?![]:!![]);_0x2ff93e['field'](_0x44298,_0x46eb9a[_0x47cfa2][_0xb11f('0x80')]||_0x44298);}if(_0x2d0970[_0xb11f('0x81')]){_0x2d0970[_0xb11f('0x81')]=JSON[_0xb11f('0x82')](_0x2d0970[_0xb11f('0x81')]);for(var _0x198c5a=0x0;_0x198c5a<_0x2d0970[_0xb11f('0x81')][_0xb11f('0x3a')];_0x198c5a+=0x1){if(_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x43')]&&_['includes'](_0x36c97f,_0x2d0970['joins'][_0x198c5a][_0xb11f('0x43')])&&_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x83')]&&_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x85')]&&_0x2d0970['joins'][_0x198c5a][_0xb11f('0x84')]){_0x2ff93e[_0x2d0970['joins'][_0x198c5a][_0xb11f('0x43')]](_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x85')],null,util[_0xb11f('0x7c')](_0xb11f('0x93'),_0x2d0970[_0xb11f('0x76')],_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x83')],_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x85')],_0x2d0970[_0xb11f('0x81')][_0x198c5a][_0xb11f('0x84')]));}}}if(_0x2d0970[_0xb11f('0x86')]){_0x2d0970[_0xb11f('0x86')]=JSON[_0xb11f('0x82')](_0x2d0970[_0xb11f('0x86')]);_0x2ff93e['where'](_0x3aa1dd(_0x2d0970['conditions'][_0xb11f('0x6b')]));}_0x2106dd=_0x2ff93e[_0xb11f('0x94')]();_0x2ff93e[_0xb11f('0x23')](_0x1f6011);_0x2ff93e['offset'](0x0);logger[_0xb11f('0x87')](_0xb11f('0x88'),_0x2ff93e['toString']());return dbH[_0xb11f('0x89')][_0xb11f('0x35')](_0x2ff93e['toString'](),{'type':dbH[_0xb11f('0x89')][_0xb11f('0x8b')]['SELECT']});}})[_0xb11f('0x29')](function(){return{'sql':_0x2106dd['toString']()};})['then'](respondWithResult(_0x3f1bfb,null))[_0xb11f('0x4a')](handleError(_0x3f1bfb,null));}; \ No newline at end of file +var _0x4ab6=['SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','format','groupBy','DESC','alias','joins','parse','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','DATE(%s)','HOUR(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','findAll','foreignTable','clone','web','fullPath','%s-%s.%s','generate','output','csv','AnalyticExtractedReport','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','countTable','run','runReport','MIN(%s)','value','metric','orderBy','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','get','UserProfileResource','then','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','length','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join'];(function(_0x48245e,_0x178e51){var _0x4e5e30=function(_0x428bfd){while(--_0x428bfd){_0x48245e['push'](_0x48245e['shift']());}};_0x4e5e30(++_0x178e51);}(_0x4ab6,0x1a6));var _0x64ab=function(_0x45e5f2,_0xc803d0){_0x45e5f2=_0x45e5f2-0x0;var _0x333b0a=_0x4ab6[_0x45e5f2];return _0x333b0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x64ab('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64ab('0x1'));var rp=require('request-promise');var moment=require(_0x64ab('0x2'));var BPromise=require(_0x64ab('0x3'));var Mustache=require(_0x64ab('0x4'));var util=require(_0x64ab('0x5'));var path=require(_0x64ab('0x6'));var sox=require(_0x64ab('0x7'));var csv=require(_0x64ab('0x8'));var ejs=require(_0x64ab('0x9'));var fs=require('fs');var fs_extra=require(_0x64ab('0xa'));var _=require(_0x64ab('0xb'));var squel=require(_0x64ab('0xc'));var crypto=require(_0x64ab('0xd'));var jsforce=require(_0x64ab('0xe'));var deskjs=require(_0x64ab('0xf'));var toCsv=require(_0x64ab('0x8'));var querystring=require(_0x64ab('0x10'));var Papa=require(_0x64ab('0x11'));var Redis=require(_0x64ab('0x12'));var authService=require(_0x64ab('0x13'));var qs=require(_0x64ab('0x14'));var as=require(_0x64ab('0x15'));var hardwareService=require(_0x64ab('0x16'));var logger=require('../../config/logger')(_0x64ab('0x17'));var utils=require(_0x64ab('0x18'));var config=require(_0x64ab('0x19'));var licenseUtil=require(_0x64ab('0x1a'));var db=require(_0x64ab('0x1b'))['db'];var dbH=require('../../mysqldb')[_0x64ab('0x1c')];function respondWithStatusCode(_0x85fa6f,_0x54c906){_0x54c906=_0x54c906||0xcc;return function(_0x2e1935){if(_0x2e1935){return _0x85fa6f[_0x64ab('0x1d')](_0x54c906);}return _0x85fa6f['status'](_0x54c906)[_0x64ab('0x1e')]();};}function respondWithResult(_0x57933d,_0x264f2a){_0x264f2a=_0x264f2a||0xc8;return function(_0x4d7717){if(_0x4d7717){return _0x57933d[_0x64ab('0x1f')](_0x264f2a)[_0x64ab('0x20')](_0x4d7717);}};}function respondWithFilteredResult(_0x190df8,_0x1deae8){return function(_0x6595dc){if(_0x6595dc){var _0x521e30=typeof _0x1deae8[_0x64ab('0x21')]===_0x64ab('0x22')&&typeof _0x1deae8[_0x64ab('0x23')]===_0x64ab('0x22');var _0x150cac=_0x6595dc[_0x64ab('0x24')];var _0x5017e6=_0x521e30?0x0:_0x1deae8[_0x64ab('0x21')];var _0x361291=_0x521e30?_0x6595dc[_0x64ab('0x24')]:_0x1deae8['offset']+_0x1deae8[_0x64ab('0x23')];var _0x3d0432;if(_0x361291>=_0x150cac){_0x361291=_0x150cac;_0x3d0432=0xc8;}else{_0x3d0432=0xce;}_0x190df8['status'](_0x3d0432);return _0x190df8[_0x64ab('0x25')](_0x64ab('0x26'),_0x5017e6+'-'+_0x361291+'/'+_0x150cac)[_0x64ab('0x20')](_0x6595dc);}return null;};}function patchUpdates(_0x31818a){return function(_0x39039d){try{jsonpatch[_0x64ab('0x27')](_0x39039d,_0x31818a,!![]);}catch(_0x402d49){return BPromise['reject'](_0x402d49);}return _0x39039d['save']();};}function saveUpdates(_0x1c8186,_0x5af5f9){return function(_0x3b08e3){if(_0x3b08e3){return _0x3b08e3[_0x64ab('0x28')](_0x1c8186)['then'](function(_0x5c136b){return _0x5c136b;});}return null;};}function removeEntity(_0x4a18d1,_0x404c7a){return function(_0x423377){if(_0x423377){return _0x423377[_0x64ab('0x29')]()['then'](function(){var _0x45099f=_0x423377[_0x64ab('0x2a')]({'plain':!![]});var _0x548716='CustomReports';return db[_0x64ab('0x2b')][_0x64ab('0x29')]({'where':{'type':_0x548716,'resourceId':_0x45099f['id']}})[_0x64ab('0x2c')](function(){return _0x423377;});})[_0x64ab('0x2c')](function(){_0x4a18d1[_0x64ab('0x1f')](0xcc)[_0x64ab('0x1e')]();});}};}function handleEntityNotFound(_0x521cf6,_0x66604e){return function(_0x4e482e){if(!_0x4e482e){_0x521cf6['sendStatus'](0x194);}return _0x4e482e;};}function handleError(_0x255208,_0x175345){_0x175345=_0x175345||0x1f4;return function(_0x38be4e){logger['error'](_0x38be4e[_0x64ab('0x2d')]);if(_0x38be4e[_0x64ab('0x2e')]){delete _0x38be4e[_0x64ab('0x2e')];}_0x255208[_0x64ab('0x1f')](_0x175345)[_0x64ab('0x2f')](_0x38be4e);};}exports[_0x64ab('0x30')]=function(_0x4d0d7f,_0x35f722){var _0x5a5aae={},_0x1abe00={},_0x10998c={'count':0x0,'rows':[]};var _0x2f76c0=_['map'](db[_0x64ab('0x31')][_0x64ab('0x32')],function(_0x2d54c5){return{'name':_0x2d54c5[_0x64ab('0x33')],'type':_0x2d54c5[_0x64ab('0x34')][_0x64ab('0x35')]};});_0x1abe00[_0x64ab('0x36')]=_[_0x64ab('0x37')](_0x2f76c0,_0x64ab('0x2e'));_0x1abe00[_0x64ab('0x38')]=_['keys'](_0x4d0d7f['query']);_0x1abe00['filters']=_[_0x64ab('0x39')](_0x1abe00['model'],_0x1abe00[_0x64ab('0x38')]);_0x5a5aae['attributes']=_[_0x64ab('0x39')](_0x1abe00[_0x64ab('0x36')],qs[_0x64ab('0x3a')](_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x3a')]));_0x5a5aae['attributes']=_0x5a5aae[_0x64ab('0x3b')]['length']?_0x5a5aae[_0x64ab('0x3b')]:_0x1abe00[_0x64ab('0x36')];if(!_0x4d0d7f['query'][_0x64ab('0x3c')](_0x64ab('0x3d'))){_0x5a5aae[_0x64ab('0x23')]=qs[_0x64ab('0x23')](_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x23')]);_0x5a5aae[_0x64ab('0x21')]=qs[_0x64ab('0x21')](_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x21')]);}_0x5a5aae[_0x64ab('0x3e')]=qs[_0x64ab('0x3f')](_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x3f')]);_0x5a5aae[_0x64ab('0x40')]=qs[_0x64ab('0x41')](_[_0x64ab('0x42')](_0x4d0d7f[_0x64ab('0x38')],_0x1abe00['filters']),_0x2f76c0);if(_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x43')]){_0x5a5aae['where']=_[_0x64ab('0x44')](_0x5a5aae[_0x64ab('0x40')],{'$or':_[_0x64ab('0x37')](_0x2f76c0,function(_0x136ce4){if(_0x136ce4['type']!==_0x64ab('0x45')){var _0x3c9357={};_0x3c9357[_0x136ce4[_0x64ab('0x2e')]]={'$like':'%'+_0x4d0d7f['query'][_0x64ab('0x43')]+'%'};return _0x3c9357;}})});}_0x5a5aae=_[_0x64ab('0x44')]({},_0x5a5aae,_0x4d0d7f[_0x64ab('0x46')]);var _0x74b431={'where':_0x5a5aae['where']};return db[_0x64ab('0x31')]['count'](_0x74b431)[_0x64ab('0x2c')](function(_0x1d2a75){_0x10998c[_0x64ab('0x24')]=_0x1d2a75;if(_0x4d0d7f[_0x64ab('0x38')][_0x64ab('0x47')]){_0x5a5aae[_0x64ab('0x48')]=[{'all':!![]}];}return db[_0x64ab('0x31')]['findAll'](_0x5a5aae);})[_0x64ab('0x2c')](function(_0x123f98){_0x10998c[_0x64ab('0x49')]=_0x123f98;return _0x10998c;})[_0x64ab('0x2c')](respondWithFilteredResult(_0x35f722,_0x5a5aae))['catch'](handleError(_0x35f722,null));};exports[_0x64ab('0x4a')]=function(_0x10406c,_0x547329){var _0x52f9d0={'raw':![],'where':{'id':_0x10406c[_0x64ab('0x4b')]['id']}},_0x4a27e9={};_0x4a27e9[_0x64ab('0x36')]=_[_0x64ab('0x4c')](db['AnalyticCustomReport']['rawAttributes']);_0x4a27e9[_0x64ab('0x38')]=_[_0x64ab('0x4c')](_0x10406c['query']);_0x4a27e9[_0x64ab('0x41')]=_[_0x64ab('0x39')](_0x4a27e9[_0x64ab('0x36')],_0x4a27e9['query']);_0x52f9d0[_0x64ab('0x3b')]=_[_0x64ab('0x39')](_0x4a27e9[_0x64ab('0x36')],qs[_0x64ab('0x3a')](_0x10406c['query']['fields']));_0x52f9d0[_0x64ab('0x3b')]=_0x52f9d0[_0x64ab('0x3b')][_0x64ab('0x4d')]?_0x52f9d0[_0x64ab('0x3b')]:_0x4a27e9[_0x64ab('0x36')];if(_0x10406c[_0x64ab('0x38')][_0x64ab('0x47')]){_0x52f9d0[_0x64ab('0x48')]=[{'all':!![]}];}_0x52f9d0=_[_0x64ab('0x44')]({},_0x52f9d0,_0x10406c[_0x64ab('0x46')]);return db[_0x64ab('0x31')][_0x64ab('0x4e')](_0x52f9d0)['then'](handleEntityNotFound(_0x547329,null))[_0x64ab('0x2c')](respondWithResult(_0x547329,null))[_0x64ab('0x4f')](handleError(_0x547329,null));};exports[_0x64ab('0x50')]=function(_0x294e4e,_0x357229){return db[_0x64ab('0x31')][_0x64ab('0x50')](_0x294e4e['body'],{})['then'](function(_0x25ecde){var _0x37a4da=_0x294e4e[_0x64ab('0x51')][_0x64ab('0x2a')]({'plain':!![]});if(!_0x37a4da)throw new Error(_0x64ab('0x52'));if(_0x37a4da[_0x64ab('0x53')]==='user'){var _0x5447d8=_0x25ecde['get']({'plain':!![]});var _0x2fa4ab=_0x64ab('0x54');return db[_0x64ab('0x55')][_0x64ab('0x4e')]({'where':{'name':_0x2fa4ab,'userProfileId':_0x37a4da[_0x64ab('0x56')]},'raw':!![]})[_0x64ab('0x2c')](function(_0x55f9fe){if(_0x55f9fe&&_0x55f9fe[_0x64ab('0x57')]===0x0){return db[_0x64ab('0x2b')][_0x64ab('0x50')]({'name':_0x5447d8['name'],'resourceId':_0x5447d8['id'],'type':_0x64ab('0x58'),'sectionId':_0x55f9fe['id']},{})[_0x64ab('0x2c')](function(){return _0x25ecde;});}else{return _0x25ecde;}})[_0x64ab('0x4f')](function(_0x1a6bb8){logger[_0x64ab('0x59')](_0x64ab('0x5a'),_0x1a6bb8);throw _0x1a6bb8;});}return _0x25ecde;})[_0x64ab('0x2c')](respondWithResult(_0x357229,0xc9))[_0x64ab('0x4f')](handleError(_0x357229,null));};exports[_0x64ab('0x28')]=function(_0x376141,_0x974f18){if(_0x376141[_0x64ab('0x5b')]['id']){delete _0x376141[_0x64ab('0x5b')]['id'];}return db['AnalyticCustomReport'][_0x64ab('0x4e')]({'where':{'id':_0x376141['params']['id']}})[_0x64ab('0x2c')](handleEntityNotFound(_0x974f18,null))['then'](saveUpdates(_0x376141[_0x64ab('0x5b')],null))['then'](respondWithResult(_0x974f18,null))[_0x64ab('0x4f')](handleError(_0x974f18,null));};exports['destroy']=function(_0x328373,_0x2ba652){return db[_0x64ab('0x31')][_0x64ab('0x4e')]({'where':{'id':_0x328373['params']['id']}})[_0x64ab('0x2c')](handleEntityNotFound(_0x2ba652,null))['then'](removeEntity(_0x2ba652,null))[_0x64ab('0x4f')](handleError(_0x2ba652,null));};exports[_0x64ab('0x5c')]=function(_0x524e80,_0x3fb356){var _0x40e5e7=0xa;var _0xb5d628=[_0x64ab('0x5d'),_0x64ab('0x5e'),_0x64ab('0x5f'),_0x64ab('0x60')];var _0x5715c5={'SUM':_0x64ab('0x61'),'COUNT':_0x64ab('0x62'),'COUNT DISTINCT':_0x64ab('0x63'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x64ab('0x64'),'GROUP_CONCAT':_0x64ab('0x65'),'GROUP_CONCAT ASC':_0x64ab('0x66'),'GROUP_CONCAT DESC':_0x64ab('0x67')};var _0xa60754={'SEC_TO_TIME':_0x64ab('0x68'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x64ab('0x69'),'UNIX_TIMESTAMP':_0x64ab('0x6a')};var _0x297450=function(_0xe9ee98){return!_[_0x64ab('0x6b')]([_0x64ab('0x6c'),'IS\x20NOT\x20NULL',_0x64ab('0x6d'),'IS\x20NOT\x20EMPTY'],_0xe9ee98);};var _0x3d5fc8=function(_0x4af6a5){if(!_0x4af6a5||!_0x4af6a5[_0x64ab('0x6e')][_0x64ab('0x4d')]){return'';}for(var _0x5a5997='(',_0x1265da=0x0;_0x1265da<_0x4af6a5[_0x64ab('0x6e')][_0x64ab('0x4d')];_0x1265da+=0x1){_0x1265da>0x0&&(_0x5a5997+='\x20'+_0x4af6a5[_0x64ab('0x6f')]+'\x20');_0x5a5997+=_0x4af6a5[_0x64ab('0x6e')][_0x1265da][_0x64ab('0x70')]?_0x3d5fc8(_0x4af6a5[_0x64ab('0x6e')][_0x1265da][_0x64ab('0x70')]):_0x4af6a5[_0x64ab('0x6e')][_0x1265da]['field']+'\x20'+_0x4af6a5[_0x64ab('0x6e')][_0x1265da][_0x64ab('0x71')]+(_0x297450(_0x4af6a5[_0x64ab('0x6e')][_0x1265da][_0x64ab('0x71')])?'\x20'+_0x4af6a5[_0x64ab('0x6e')][_0x1265da]['value']:'');}return _0x5a5997+')';};var _0x12a5cc={'where':{'id':_0x524e80[_0x64ab('0x4b')]['id']}},_0x19a315,_0x57ecab,_0x53bc5c,_0x2117d5,_0xe4db05;_0x12a5cc=_[_0x64ab('0x44')]({},_0x12a5cc,_0x524e80['options']);return db[_0x64ab('0x31')]['find'](_0x12a5cc)[_0x64ab('0x2c')](function(_0x8ce62f){if(_0x8ce62f){_0x19a315=_0x8ce62f;return _0x8ce62f[_0x64ab('0x72')]();}return null;})[_0x64ab('0x2c')](function(_0x5dfa84){if(_0x5dfa84){if(!_0x5dfa84[_0x64ab('0x4d')]){throw new db[(_0x64ab('0x73'))][(_0x64ab('0x74'))](_0x64ab('0x75'),0x193);}_0x57ecab=_0x5dfa84;return db[_0x64ab('0x76')]['findAll']({'raw':!![]});}return null;})[_0x64ab('0x2c')](function(_0x19d8b9){if(_0x19d8b9){_0x53bc5c=_[_0x64ab('0x77')](_0x19d8b9,'id');var _0x34f84e;var _0x3ec6cb=squel[_0x64ab('0x78')]();_0x3ec6cb[_0x64ab('0x79')](_0x19a315[_0x64ab('0x7a')]);for(var _0x431ba8=0x0;_0x431ba8<_0x57ecab['length'];_0x431ba8+=0x1){_0x34f84e=_0x57ecab[_0x431ba8][_0x64ab('0x7b')]?_0x53bc5c[_0x57ecab[_0x431ba8][_0x64ab('0x7b')]]['metric']:_0x57ecab[_0x431ba8][_0x64ab('0x7c')];_0x34f84e=_0x57ecab[_0x431ba8][_0x64ab('0x7d')]?_[_0x64ab('0x7e')](_0x5715c5[_0x57ecab[_0x431ba8][_0x64ab('0x7d')]],'%s',_0x34f84e):_0x34f84e;_0x34f84e=_0x57ecab[_0x431ba8][_0x64ab('0x7f')]?_[_0x64ab('0x7e')](_0xa60754[_0x57ecab[_0x431ba8][_0x64ab('0x7f')]],'%s',_0x34f84e):_0x34f84e;if(_0x57ecab[_0x431ba8][_0x64ab('0x80')]){_0x3ec6cb[_0x64ab('0x70')](_0x34f84e);}_0x57ecab[_0x431ba8]['orderBy']&&_0x3ec6cb[_0x64ab('0x3e')](_0x34f84e,_0x57ecab[_0x431ba8]['orderBy']===_0x64ab('0x81')?![]:!![]);_0x3ec6cb['field'](_0x34f84e,_0x57ecab[_0x431ba8][_0x64ab('0x82')]||_0x34f84e);}if(_0x19a315[_0x64ab('0x83')]){_0x19a315['joins']=JSON[_0x64ab('0x84')](_0x19a315[_0x64ab('0x83')]);for(var _0x188b70=0x0;_0x188b70<_0x19a315['joins'][_0x64ab('0x4d')];_0x188b70+=0x1){if(_0x19a315[_0x64ab('0x83')][_0x188b70]['type']&&_[_0x64ab('0x6b')](_0xb5d628,_0x19a315[_0x64ab('0x83')][_0x188b70][_0x64ab('0x34')])&&_0x19a315[_0x64ab('0x83')][_0x188b70]['parentKey']&&_0x19a315[_0x64ab('0x83')][_0x188b70]['foreignTable']&&_0x19a315[_0x64ab('0x83')][_0x188b70][_0x64ab('0x85')]){_0x3ec6cb[_0x19a315[_0x64ab('0x83')][_0x188b70][_0x64ab('0x34')]](_0x19a315['joins'][_0x188b70]['foreignTable'],null,util[_0x64ab('0x7f')](_0x64ab('0x86'),_0x19a315[_0x64ab('0x7a')],_0x19a315[_0x64ab('0x83')][_0x188b70][_0x64ab('0x87')],_0x19a315[_0x64ab('0x83')][_0x188b70]['foreignTable'],_0x19a315[_0x64ab('0x83')][_0x188b70][_0x64ab('0x85')]));}}}if(_0x19a315[_0x64ab('0x88')]){_0x19a315[_0x64ab('0x88')]=JSON[_0x64ab('0x84')](_0x19a315[_0x64ab('0x88')]);_0x3ec6cb[_0x64ab('0x40')](_0x3d5fc8(_0x19a315[_0x64ab('0x88')]['group']));}_0xe4db05=_0x3ec6cb['clone']();_0x3ec6cb[_0x64ab('0x23')](_0x40e5e7);_0x3ec6cb[_0x64ab('0x21')](0x0);logger[_0x64ab('0x89')](_0x64ab('0x8a'),_0x3ec6cb[_0x64ab('0x8b')]());return dbH[_0x64ab('0x8c')][_0x64ab('0x38')](_0x3ec6cb[_0x64ab('0x8b')](),{'type':dbH[_0x64ab('0x8c')][_0x64ab('0x8d')][_0x64ab('0x8e')]});}})['then'](respondWithResult(_0x3fb356,null))[_0x64ab('0x4f')](handleError(_0x3fb356,null));};function runReport(_0xa24846,_0x3ab896,_0x4e7ef6){var _0x278038=_0x3ab896['name'];var _0x401f82=0xa;var _0x34c282=[_0x64ab('0x5d'),_0x64ab('0x5e'),'right_join','cross_join'];var _0x2eaf65={'SUM':_0x64ab('0x61'),'COUNT':_0x64ab('0x62'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x64ab('0x8f'),'MIN':'MIN(%s)','AVG':_0x64ab('0x64'),'GROUP_CONCAT':_0x64ab('0x65'),'GROUP_CONCAT ASC':_0x64ab('0x66'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x13f72c={'SEC_TO_TIME':_0x64ab('0x68'),'DATE':_0x64ab('0x90'),'HOUR':_0x64ab('0x91'),'ROUND':_0x64ab('0x69'),'UNIX_TIMESTAMP':_0x64ab('0x6a')};var _0x558d65=function(_0x3fe0c9){return!_[_0x64ab('0x6b')]([_0x64ab('0x6c'),_0x64ab('0x92'),_0x64ab('0x6d'),_0x64ab('0x93')],_0x3fe0c9);};var _0x2ba1f1=function(_0x169aee){if(!_0x169aee||!_0x169aee[_0x64ab('0x6e')]['length']){return'';}for(var _0x1c98c='(',_0x493bba=0x0;_0x493bba<_0x169aee[_0x64ab('0x6e')][_0x64ab('0x4d')];_0x493bba+=0x1){_0x493bba>0x0&&(_0x1c98c+='\x20'+_0x169aee['operator']+'\x20');_0x1c98c+=_0x169aee[_0x64ab('0x6e')][_0x493bba][_0x64ab('0x70')]?_0x2ba1f1(_0x169aee['rules'][_0x493bba]['group']):_0x169aee[_0x64ab('0x6e')][_0x493bba][_0x64ab('0x7c')]+'\x20'+_0x169aee[_0x64ab('0x6e')][_0x493bba]['condition']+(_0x558d65(_0x169aee[_0x64ab('0x6e')][_0x493bba][_0x64ab('0x71')])?'\x20'+_0x169aee[_0x64ab('0x6e')][_0x493bba]['value']:'');}return _0x1c98c+')';};var _0x352e7d={'where':{'id':_0xa24846['id']}},_0x2bec14,_0x131fd6,_0x5e7e3e,_0x3914c8,_0x1e433a;_0x352e7d=_[_0x64ab('0x44')]({},_0x352e7d,_0x4e7ef6);return db[_0x64ab('0x31')][_0x64ab('0x4e')](_0x352e7d)[_0x64ab('0x2c')](function(_0xf41e62){if(_0xf41e62){_0x2bec14=_0xf41e62;return _0xf41e62[_0x64ab('0x72')]();}return null;})[_0x64ab('0x2c')](function(_0x4a40af){if(_0x4a40af){if(!_0x4a40af[_0x64ab('0x4d')]){throw new db['Sequelize'][(_0x64ab('0x74'))](_0x64ab('0x75'),0x193);}_0x131fd6=_0x4a40af;return db[_0x64ab('0x76')][_0x64ab('0x94')]({'raw':!![]});}return null;})['then'](function(_0x663822){if(_0x663822){_0x5e7e3e=_[_0x64ab('0x77')](_0x663822,'id');var _0x4286c7;var _0x5b13d7=squel[_0x64ab('0x78')]();_0x5b13d7['from'](_0x2bec14[_0x64ab('0x7a')]);for(var _0x117bde=0x0;_0x117bde<_0x131fd6['length'];_0x117bde+=0x1){_0x4286c7=_0x131fd6[_0x117bde]['MetricId']?_0x5e7e3e[_0x131fd6[_0x117bde][_0x64ab('0x7b')]]['metric']:_0x131fd6[_0x117bde][_0x64ab('0x7c')];_0x4286c7=_0x131fd6[_0x117bde][_0x64ab('0x7d')]?_['replace'](_0x2eaf65[_0x131fd6[_0x117bde][_0x64ab('0x7d')]],'%s',_0x4286c7):_0x4286c7;_0x4286c7=_0x131fd6[_0x117bde][_0x64ab('0x7f')]?_['replace'](_0x13f72c[_0x131fd6[_0x117bde][_0x64ab('0x7f')]],'%s',_0x4286c7):_0x4286c7;if(_0x131fd6[_0x117bde][_0x64ab('0x80')]){_0x5b13d7[_0x64ab('0x70')](_0x4286c7);}_0x131fd6[_0x117bde]['orderBy']&&_0x5b13d7[_0x64ab('0x3e')](_0x4286c7,_0x131fd6[_0x117bde]['orderBy']===_0x64ab('0x81')?![]:!![]);_0x5b13d7[_0x64ab('0x7c')](_0x4286c7,_0x131fd6[_0x117bde][_0x64ab('0x82')]||_0x4286c7);}if(_0x2bec14[_0x64ab('0x83')]){_0x2bec14[_0x64ab('0x83')]=JSON[_0x64ab('0x84')](_0x2bec14[_0x64ab('0x83')]);for(var _0x85ba68=0x0;_0x85ba68<_0x2bec14[_0x64ab('0x83')][_0x64ab('0x4d')];_0x85ba68+=0x1){if(_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x34')]&&_[_0x64ab('0x6b')](_0x34c282,_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x34')])&&_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x87')]&&_0x2bec14[_0x64ab('0x83')][_0x85ba68]['foreignTable']&&_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x85')]){_0x5b13d7[_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x34')]](_0x2bec14['joins'][_0x85ba68]['foreignTable'],null,util[_0x64ab('0x7f')](_0x64ab('0x86'),_0x2bec14[_0x64ab('0x7a')],_0x2bec14['joins'][_0x85ba68]['parentKey'],_0x2bec14[_0x64ab('0x83')][_0x85ba68][_0x64ab('0x95')],_0x2bec14[_0x64ab('0x83')][_0x85ba68]['foreignKey']));}}}if(_0x2bec14[_0x64ab('0x88')]){_0x2bec14['conditions']=JSON[_0x64ab('0x84')](_0x2bec14[_0x64ab('0x88')]);_0x5b13d7['where'](_0x2ba1f1(_0x2bec14['conditions'][_0x64ab('0x70')]));}_0x1e433a=_0x5b13d7[_0x64ab('0x96')]();_0x5b13d7[_0x64ab('0x23')](_0x401f82);_0x5b13d7[_0x64ab('0x21')](0x0);return;}})[_0x64ab('0x2c')](function(){if(_0x3ab896['output']===_0x64ab('0x97')){return null;}var _0x27b94b=_[_0x64ab('0x44')](_0x3ab896,{'name':_0x3ab896[_0x64ab('0x98')]||_0x3ab896['name']||_0x2bec14[_0x64ab('0x2e')],'basename':_0x278038,'savename':util[_0x64ab('0x7f')](_0x64ab('0x99'),_0x3ab896[_0x64ab('0x2e')]||_0x2bec14[_0x64ab('0x2e')],require('randomstring')[_0x64ab('0x9a')](0x4),_0x3ab896[_0x64ab('0x9b')]||_0x64ab('0x9c')),'reportId':_0x2bec14['id'],'reportType':'custom'});return db[_0x64ab('0x9d')]['create'](_0x27b94b,{'raw':!![]});})[_0x64ab('0x2c')](function(_0x148090){if(_0x2bec14[_0x64ab('0x7a')]==='cdr'){_0x1e433a[_0x64ab('0x40')](_0x2bec14[_0x64ab('0x7a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3ab896[_0x64ab('0x9e')],_0x3ab896['endDate']);}else{_0x1e433a[_0x64ab('0x40')](_0x2bec14[_0x64ab('0x7a')]+_0x64ab('0x9f'),_0x3ab896[_0x64ab('0x9e')],_0x3ab896[_0x64ab('0xa0')]);}if(_0x148090){logger[_0x64ab('0xa1')](_0x64ab('0xa2'),_0x1e433a[_0x64ab('0x8b')]());require(_0x64ab('0xa3'))[_0x64ab('0xa4')](path['join'](__dirname,_0x64ab('0xa5'),_0x148090[_0x64ab('0x9b')]),[_0x148090['id'],_0x1e433a[_0x64ab('0x8b')](),path[_0x64ab('0x5d')](__dirname,'../../files/reports',_0x148090['savename']),_0x278038]);return _0x148090;}else{var _0x167177=squel[_0x64ab('0x78')]();_0x167177[_0x64ab('0x79')]('('+_0x1e433a[_0x64ab('0x8b')]()+')',_0x64ab('0xa6'));_0x167177['field']('COUNT(*)','count');_0x1e433a['limit'](_0x3ab896['limit']||_0x401f82);_0x1e433a[_0x64ab('0x21')](_0x3ab896[_0x64ab('0x21')]||0x0);return dbH[_0x64ab('0x8c')][_0x64ab('0x38')](_0x167177[_0x64ab('0x8b')](),{'type':dbH[_0x64ab('0x8c')]['QueryTypes'][_0x64ab('0x8e')]})[_0x64ab('0x2c')](function(_0x2a2230){if(!_0x2a2230[_0x64ab('0x4d')]){_0x3914c8=0x0;}else{_0x3914c8=_0x2a2230[0x0][_0x64ab('0x24')]||0x0;}return dbH[_0x64ab('0x8c')]['query'](_0x1e433a[_0x64ab('0x8b')](),{'type':dbH[_0x64ab('0x8c')][_0x64ab('0x8d')][_0x64ab('0x8e')]});})[_0x64ab('0x2c')](function(_0x877b4f){return{'rows':_0x877b4f||[],'count':_0x3914c8};});}});}exports[_0x64ab('0xa7')]=function(_0x4b6846,_0x399a32){return runReport(_0x4b6846[_0x64ab('0x4b')],_0x4b6846[_0x64ab('0x38')],_0x4b6846[_0x64ab('0x46')])[_0x64ab('0x2c')](respondWithResult(_0x399a32,null))['catch'](handleError(_0x399a32,null));};exports[_0x64ab('0xa8')]=runReport;exports[_0x64ab('0x38')]=function(_0x5f12f7,_0x262bd3){var _0x4bd492=0xa;var _0x11b0cc=[_0x64ab('0x5d'),_0x64ab('0x5e'),_0x64ab('0x5f'),_0x64ab('0x60')];var _0x6bde46={'SUM':_0x64ab('0x61'),'COUNT':_0x64ab('0x62'),'COUNT DISTINCT':_0x64ab('0x63'),'MAX':'MAX(%s)','MIN':_0x64ab('0xa9'),'AVG':_0x64ab('0x64'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x17cbac={'SEC_TO_TIME':_0x64ab('0x68'),'DATE':_0x64ab('0x90'),'HOUR':_0x64ab('0x91'),'ROUND':_0x64ab('0x69'),'UNIX_TIMESTAMP':_0x64ab('0x6a')};var _0xc01f66=function(_0x538efd){return!_['includes'](['IS\x20NULL',_0x64ab('0x92'),_0x64ab('0x6d'),_0x64ab('0x93')],_0x538efd);};var _0x1e6757=function(_0x10e33f){if(!_0x10e33f||!_0x10e33f[_0x64ab('0x6e')][_0x64ab('0x4d')]){return'';}for(var _0x4f255c='(',_0x1390c2=0x0;_0x1390c2<_0x10e33f[_0x64ab('0x6e')][_0x64ab('0x4d')];_0x1390c2+=0x1){_0x1390c2>0x0&&(_0x4f255c+='\x20'+_0x10e33f[_0x64ab('0x6f')]+'\x20');_0x4f255c+=_0x10e33f[_0x64ab('0x6e')][_0x1390c2]['group']?_0x1e6757(_0x10e33f[_0x64ab('0x6e')][_0x1390c2][_0x64ab('0x70')]):_0x10e33f[_0x64ab('0x6e')][_0x1390c2][_0x64ab('0x7c')]+'\x20'+_0x10e33f[_0x64ab('0x6e')][_0x1390c2][_0x64ab('0x71')]+(_0xc01f66(_0x10e33f['rules'][_0x1390c2][_0x64ab('0x71')])?'\x20'+_0x10e33f[_0x64ab('0x6e')][_0x1390c2][_0x64ab('0xaa')]:'');}return _0x4f255c+')';};var _0x20c701={'where':{'id':_0x5f12f7[_0x64ab('0x4b')]['id']}},_0x2cff7d,_0x545f42,_0x282f16,_0x5e200b,_0xcf61d7;_0x20c701=_['merge']({},_0x20c701,_0x5f12f7['options']);return db[_0x64ab('0x31')]['find'](_0x20c701)[_0x64ab('0x2c')](function(_0x20649f){if(_0x20649f){_0x2cff7d=_0x20649f;return _0x20649f[_0x64ab('0x72')]();}return null;})[_0x64ab('0x2c')](function(_0x1e8c8b){if(_0x1e8c8b){if(!_0x1e8c8b[_0x64ab('0x4d')]){throw new db['Sequelize'][(_0x64ab('0x74'))](_0x64ab('0x75'),0x193);}_0x545f42=_0x1e8c8b;return db[_0x64ab('0x76')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3a07fa){if(_0x3a07fa){_0x282f16=_[_0x64ab('0x77')](_0x3a07fa,'id');var _0x2664ee;var _0x483c05=squel[_0x64ab('0x78')]();_0x483c05['from'](_0x2cff7d[_0x64ab('0x7a')]);for(var _0x5f51e1=0x0;_0x5f51e1<_0x545f42[_0x64ab('0x4d')];_0x5f51e1+=0x1){_0x2664ee=_0x545f42[_0x5f51e1][_0x64ab('0x7b')]?_0x282f16[_0x545f42[_0x5f51e1]['MetricId']][_0x64ab('0xab')]:_0x545f42[_0x5f51e1][_0x64ab('0x7c')];_0x2664ee=_0x545f42[_0x5f51e1]['function']?_[_0x64ab('0x7e')](_0x6bde46[_0x545f42[_0x5f51e1][_0x64ab('0x7d')]],'%s',_0x2664ee):_0x2664ee;_0x2664ee=_0x545f42[_0x5f51e1]['format']?_[_0x64ab('0x7e')](_0x17cbac[_0x545f42[_0x5f51e1][_0x64ab('0x7f')]],'%s',_0x2664ee):_0x2664ee;if(_0x545f42[_0x5f51e1][_0x64ab('0x80')]){_0x483c05['group'](_0x2664ee);}_0x545f42[_0x5f51e1][_0x64ab('0xac')]&&_0x483c05[_0x64ab('0x3e')](_0x2664ee,_0x545f42[_0x5f51e1]['orderBy']==='DESC'?![]:!![]);_0x483c05['field'](_0x2664ee,_0x545f42[_0x5f51e1][_0x64ab('0x82')]||_0x2664ee);}if(_0x2cff7d[_0x64ab('0x83')]){_0x2cff7d[_0x64ab('0x83')]=JSON[_0x64ab('0x84')](_0x2cff7d[_0x64ab('0x83')]);for(var _0x46193b=0x0;_0x46193b<_0x2cff7d['joins'][_0x64ab('0x4d')];_0x46193b+=0x1){if(_0x2cff7d[_0x64ab('0x83')][_0x46193b]['type']&&_[_0x64ab('0x6b')](_0x11b0cc,_0x2cff7d[_0x64ab('0x83')][_0x46193b]['type'])&&_0x2cff7d[_0x64ab('0x83')][_0x46193b][_0x64ab('0x87')]&&_0x2cff7d[_0x64ab('0x83')][_0x46193b][_0x64ab('0x95')]&&_0x2cff7d['joins'][_0x46193b][_0x64ab('0x85')]){_0x483c05[_0x2cff7d['joins'][_0x46193b]['type']](_0x2cff7d['joins'][_0x46193b][_0x64ab('0x95')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2cff7d['table'],_0x2cff7d['joins'][_0x46193b][_0x64ab('0x87')],_0x2cff7d['joins'][_0x46193b][_0x64ab('0x95')],_0x2cff7d[_0x64ab('0x83')][_0x46193b][_0x64ab('0x85')]));}}}if(_0x2cff7d[_0x64ab('0x88')]){_0x2cff7d['conditions']=JSON[_0x64ab('0x84')](_0x2cff7d['conditions']);_0x483c05[_0x64ab('0x40')](_0x1e6757(_0x2cff7d['conditions'][_0x64ab('0x70')]));}_0xcf61d7=_0x483c05[_0x64ab('0x96')]();_0x483c05[_0x64ab('0x23')](_0x4bd492);_0x483c05[_0x64ab('0x21')](0x0);logger[_0x64ab('0x89')]('Limited\x20Query:',_0x483c05[_0x64ab('0x8b')]());return dbH[_0x64ab('0x8c')][_0x64ab('0x38')](_0x483c05[_0x64ab('0x8b')](),{'type':dbH['sequelize'][_0x64ab('0x8d')][_0x64ab('0x8e')]});}})[_0x64ab('0x2c')](function(){return{'sql':_0xcf61d7[_0x64ab('0x8b')]()};})[_0x64ab('0x2c')](respondWithResult(_0x262bd3,null))[_0x64ab('0x4f')](handleError(_0x262bd3,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 8c41add..578958c 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 _0xda7b=['./analyticCustomReport.attributes','exports','define','analytics_custom_reports','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x23fc4b,_0x2602f8){var _0x9d10c1=function(_0x14096b){while(--_0x14096b){_0x23fc4b['push'](_0x23fc4b['shift']());}};_0x9d10c1(++_0x2602f8);}(_0xda7b,0x1f3));var _0xbda7=function(_0x4bfd80,_0x34ce14){_0x4bfd80=_0x4bfd80-0x0;var _0x920c6c=_0xda7b[_0x4bfd80];return _0x920c6c;};'use strict';var _=require(_0xbda7('0x0'));var util=require('util');var logger=require(_0xbda7('0x1'))('api');var moment=require(_0xbda7('0x2'));var BPromise=require(_0xbda7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbda7('0x4'));var rimraf=require(_0xbda7('0x5'));var config=require(_0xbda7('0x6'));var attributes=require(_0xbda7('0x7'));module[_0xbda7('0x8')]=function(_0x2fa8d3,_0x1ff07c){return _0x2fa8d3[_0xbda7('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0xbda7('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x697c=['rimraf','../../config/environment','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xedbb74,_0x6069a){var _0x1e1c35=function(_0x42527d){while(--_0x42527d){_0xedbb74['push'](_0xedbb74['shift']());}};_0x1e1c35(++_0x6069a);}(_0x697c,0x131));var _0xc697=function(_0xb50b94,_0x6b7a4){_0xb50b94=_0xb50b94-0x0;var _0x1cc5a0=_0x697c[_0xb50b94];return _0x1cc5a0;};'use strict';var _=require(_0xc697('0x0'));var util=require(_0xc697('0x1'));var logger=require(_0xc697('0x2'))(_0xc697('0x3'));var moment=require(_0xc697('0x4'));var BPromise=require(_0xc697('0x5'));var rp=require(_0xc697('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc697('0x7'));var config=require(_0xc697('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0xc697('0x9')]=function(_0x131eb4,_0x3a9903){return _0x131eb4['define'](_0xc697('0xa'),attributes,{'tableName':_0xc697('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index b85feef..6aa384f 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 _0x91c5=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x91c5,0x1ae));var _0x591c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91c5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x591c('0x0'));var util=require(_0x591c('0x1'));var moment=require('moment');var BPromise=require(_0x591c('0x2'));var rs=require(_0x591c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x591c('0x4'))['db'];var utils=require(_0x591c('0x5'));var logger=require(_0x591c('0x6'))(_0x591c('0x7'));var config=require(_0x591c('0x8'));var jayson=require(_0x591c('0x9'));var client=jayson[_0x591c('0xa')][_0x591c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53b554,_0xba6cfe,_0x1e2569){return new BPromise(function(_0x3888bc,_0x496def){return client[_0x591c('0xc')](_0x53b554,_0x1e2569)[_0x591c('0xd')](function(_0x8ffeb1){logger[_0x591c('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0xba6cfe,_0x591c('0xf'));logger[_0x591c('0x10')](_0x591c('0x11'),_0xba6cfe,_0x591c('0xf'),JSON['stringify'](_0x8ffeb1));if(_0x8ffeb1[_0x591c('0x12')]){if(_0x8ffeb1[_0x591c('0x12')][_0x591c('0x13')]===0x1f4){logger['error'](_0x591c('0x14'),_0xba6cfe,_0x8ffeb1['error'][_0x591c('0x15')]);return _0x496def(_0x8ffeb1[_0x591c('0x12')][_0x591c('0x15')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0xba6cfe,_0x8ffeb1[_0x591c('0x12')][_0x591c('0x15')]);return _0x3888bc(_0x8ffeb1[_0x591c('0x12')][_0x591c('0x15')]);}else{logger['info'](_0x591c('0x14'),_0xba6cfe,_0x591c('0xf'));_0x3888bc(_0x8ffeb1[_0x591c('0x16')]['message']);}})[_0x591c('0x17')](function(_0x355469){logger[_0x591c('0x12')](_0x591c('0x14'),_0xba6cfe,_0x355469);_0x496def(_0x355469);});});} \ No newline at end of file +var _0x5bf3=['http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4eb1b5,_0x32b0c6){var _0x1ebed6=function(_0x2cca8f){while(--_0x2cca8f){_0x4eb1b5['push'](_0x4eb1b5['shift']());}};_0x1ebed6(++_0x32b0c6);}(_0x5bf3,0x1a4));var _0x35bf=function(_0x165bc9,_0x4f30d6){_0x165bc9=_0x165bc9-0x0;var _0x2c4540=_0x5bf3[_0x165bc9];return _0x2c4540;};'use strict';var _=require('lodash');var util=require(_0x35bf('0x0'));var moment=require(_0x35bf('0x1'));var BPromise=require(_0x35bf('0x2'));var rs=require(_0x35bf('0x3'));var fs=require('fs');var Redis=require(_0x35bf('0x4'));var db=require(_0x35bf('0x5'))['db'];var utils=require(_0x35bf('0x6'));var logger=require(_0x35bf('0x7'))(_0x35bf('0x8'));var config=require(_0x35bf('0x9'));var jayson=require(_0x35bf('0xa'));var client=jayson[_0x35bf('0xb')][_0x35bf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34c9cf,_0x5c2a59,_0x5de66f){return new BPromise(function(_0x10922b,_0xc1fc1e){return client[_0x35bf('0xd')](_0x34c9cf,_0x5de66f)[_0x35bf('0xe')](function(_0x4da803){logger[_0x35bf('0xf')](_0x35bf('0x10'),_0x5c2a59,_0x35bf('0x11'));logger[_0x35bf('0x12')](_0x35bf('0x13'),_0x5c2a59,'request\x20sent',JSON['stringify'](_0x4da803));if(_0x4da803['error']){if(_0x4da803[_0x35bf('0x14')]['code']===0x1f4){logger['error'](_0x35bf('0x10'),_0x5c2a59,_0x4da803[_0x35bf('0x14')][_0x35bf('0x15')]);return _0xc1fc1e(_0x4da803[_0x35bf('0x14')][_0x35bf('0x15')]);}logger[_0x35bf('0x14')](_0x35bf('0x10'),_0x5c2a59,_0x4da803[_0x35bf('0x14')][_0x35bf('0x15')]);return _0x10922b(_0x4da803[_0x35bf('0x14')]['message']);}else{logger[_0x35bf('0xf')](_0x35bf('0x10'),_0x5c2a59,_0x35bf('0x11'));_0x10922b(_0x4da803[_0x35bf('0x16')][_0x35bf('0x15')]);}})[_0x35bf('0x17')](function(_0x39f1fa){logger['error'](_0x35bf('0x10'),_0x5c2a59,_0x39f1fa);_0xc1fc1e(_0x39f1fa);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 36b48d1..ff87647 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 _0x90e0=['/:id/preview','preview','/:id/run','/:id/query','query','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show'];(function(_0xa787cb,_0x1b48c7){var _0x5964f8=function(_0x390d65){while(--_0x390d65){_0xa787cb['push'](_0xa787cb['shift']());}};_0x5964f8(++_0x1b48c7);}(_0x90e0,0x153));var _0x090e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90e0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x090e('0x0'));var util=require(_0x090e('0x1'));var path=require('path');var timeout=require(_0x090e('0x2'));var express=require(_0x090e('0x3'));var router=express[_0x090e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x090e('0x5'));var config=require(_0x090e('0x6'));var controller=require(_0x090e('0x7'));router['get']('/',auth[_0x090e('0x8')](),controller[_0x090e('0x9')]);router[_0x090e('0xa')](_0x090e('0xb'),auth[_0x090e('0x8')](),controller[_0x090e('0xc')]);router[_0x090e('0xa')](_0x090e('0xd'),auth[_0x090e('0x8')](),controller[_0x090e('0xe')]);router['get'](_0x090e('0xf'),auth[_0x090e('0x8')](),controller['run']);router[_0x090e('0xa')](_0x090e('0x10'),auth['isAuthenticated'](),controller[_0x090e('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x090e('0x12')](_0x090e('0xb'),auth['isAuthenticated'](),controller[_0x090e('0x13')]);router[_0x090e('0x14')](_0x090e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x090e('0x15')]=router; \ No newline at end of file +var _0x7e1d=['put','update','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','query','post','create'];(function(_0x499bd9,_0x51a209){var _0x5eb275=function(_0x4ce722){while(--_0x4ce722){_0x499bd9['push'](_0x499bd9['shift']());}};_0x5eb275(++_0x51a209);}(_0x7e1d,0xbf));var _0xd7e1=function(_0x4ecfe8,_0x57a7bc){_0x4ecfe8=_0x4ecfe8-0x0;var _0x332ed3=_0x7e1d[_0x4ecfe8];return _0x332ed3;};'use strict';var multer=require('multer');var util=require(_0xd7e1('0x0'));var path=require(_0xd7e1('0x1'));var timeout=require(_0xd7e1('0x2'));var express=require(_0xd7e1('0x3'));var router=express['Router']();var fs_extra=require(_0xd7e1('0x4'));var auth=require(_0xd7e1('0x5'));var interaction=require(_0xd7e1('0x6'));var config=require(_0xd7e1('0x7'));var controller=require(_0xd7e1('0x8'));router[_0xd7e1('0x9')]('/',auth[_0xd7e1('0xa')](),controller[_0xd7e1('0xb')]);router[_0xd7e1('0x9')](_0xd7e1('0xc'),auth[_0xd7e1('0xa')](),controller[_0xd7e1('0xd')]);router[_0xd7e1('0x9')](_0xd7e1('0xe'),auth['isAuthenticated'](),controller['preview']);router[_0xd7e1('0x9')](_0xd7e1('0xf'),auth[_0xd7e1('0xa')](),controller['run']);router[_0xd7e1('0x9')]('/:id/query',auth[_0xd7e1('0xa')](),controller[_0xd7e1('0x10')]);router[_0xd7e1('0x11')]('/',auth[_0xd7e1('0xa')](),controller[_0xd7e1('0x12')]);router[_0xd7e1('0x13')](_0xd7e1('0xc'),auth['isAuthenticated'](),controller[_0xd7e1('0x14')]);router['delete'](_0xd7e1('0xc'),auth[_0xd7e1('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 2b2a457..e7a9d50 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 _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x46ed,0x168));var _0xd46e=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x46ed[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0x33c5=['STRING','TEXT','exports'];(function(_0x1a43d5,_0xc8eb23){var _0x36b836=function(_0x3b2e2b){while(--_0x3b2e2b){_0x1a43d5['push'](_0x1a43d5['shift']());}};_0x36b836(++_0xc8eb23);}(_0x33c5,0xe6));var _0x533c=function(_0xf6aec0,_0x51ffd6){_0xf6aec0=_0xf6aec0-0x0;var _0x59a51b=_0x33c5[_0xf6aec0];return _0x59a51b;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c8a9ed0..c572f23 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 _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x5b9168,_0x203c8a){var _0x1c8403=function(_0x59b381){while(--_0x59b381){_0x5b9168['push'](_0x5b9168['shift']());}};_0x1c8403(++_0x203c8a);}(_0xba34,0x119));var _0x4ba3=function(_0x55a269,_0x3be6d9){_0x55a269=_0x55a269-0x0;var _0x29968a=_0xba34[_0x55a269];return _0x29968a;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file +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(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x5dad5a,_0x24f358){_0x5dad5a=_0x5dad5a-0x0;var _0x19d88a=_0xc6ac[_0x5dad5a];return _0x19d88a;};'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 diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index cb0345e..4f5c278 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 _0xdb1f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x4f0dc8,_0xb40b72){var _0x240785=function(_0x590c2d){while(--_0x590c2d){_0x4f0dc8['push'](_0x4f0dc8['shift']());}};_0x240785(++_0xb40b72);}(_0xdb1f,0x128));var _0xfdb1=function(_0x34b7e0,_0x2f90f2){_0x34b7e0=_0x34b7e0-0x0;var _0x320937=_0xdb1f[_0x34b7e0];return _0x320937;};'use strict';var _=require(_0xfdb1('0x0'));var util=require(_0xfdb1('0x1'));var logger=require(_0xfdb1('0x2'))('api');var moment=require(_0xfdb1('0x3'));var BPromise=require(_0xfdb1('0x4'));var rp=require(_0xfdb1('0x5'));var fs=require('fs');var path=require(_0xfdb1('0x6'));var rimraf=require(_0xfdb1('0x7'));var config=require(_0xfdb1('0x8'));var attributes=require(_0xfdb1('0x9'));module[_0xfdb1('0xa')]=function(_0x3aff69,_0x423aab){return _0x3aff69[_0xfdb1('0xb')]('AnalyticDefaultReport',attributes,{'tableName':_0xfdb1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5c3=['analytics_default_reports','lodash','util','../../config/logger','moment','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x3a4ce4,_0x4f9e46){var _0x5837ea=function(_0x3fe823){while(--_0x3fe823){_0x3a4ce4['push'](_0x3a4ce4['shift']());}};_0x5837ea(++_0x4f9e46);}(_0xd5c3,0xe8));var _0x3d5c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd5c3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x3d5c('0x0'));var util=require(_0x3d5c('0x1'));var logger=require(_0x3d5c('0x2'))('api');var moment=require(_0x3d5c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d5c('0x4'));var rimraf=require(_0x3d5c('0x5'));var config=require('../../config/environment');var attributes=require(_0x3d5c('0x6'));module[_0x3d5c('0x7')]=function(_0x1325b9,_0x5bd7b7){return _0x1325b9[_0x3d5c('0x8')](_0x3d5c('0x9'),attributes,{'tableName':_0x3d5c('0xa'),'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 4ffc9ca..4f50eb7 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 _0xf08d=['then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x24cef0,_0x42a80f){var _0x2b767b=function(_0x2529ee){while(--_0x2529ee){_0x24cef0['push'](_0x24cef0['shift']());}};_0x2b767b(++_0x42a80f);}(_0xf08d,0xd0));var _0xdf08=function(_0x1e4fbf,_0x2862c4){_0x1e4fbf=_0x1e4fbf-0x0;var _0x2441a8=_0xf08d[_0x1e4fbf];return _0x2441a8;};'use strict';var _=require(_0xdf08('0x0'));var util=require(_0xdf08('0x1'));var moment=require(_0xdf08('0x2'));var BPromise=require(_0xdf08('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf08('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf08('0x5'));var logger=require(_0xdf08('0x6'))(_0xdf08('0x7'));var config=require(_0xdf08('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdf08('0x9')][_0xdf08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2893f9,_0x137c59,_0x226707){return new BPromise(function(_0x45d7ee,_0x43dc03){return client[_0xdf08('0xb')](_0x2893f9,_0x226707)[_0xdf08('0xc')](function(_0x2481ff){logger['info'](_0xdf08('0xd'),_0x137c59,_0xdf08('0xe'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x137c59,_0xdf08('0xe'),JSON[_0xdf08('0xf')](_0x2481ff));if(_0x2481ff[_0xdf08('0x10')]){if(_0x2481ff[_0xdf08('0x10')]['code']===0x1f4){logger['error'](_0xdf08('0xd'),_0x137c59,_0x2481ff[_0xdf08('0x10')][_0xdf08('0x11')]);return _0x43dc03(_0x2481ff[_0xdf08('0x10')][_0xdf08('0x11')]);}logger['error'](_0xdf08('0xd'),_0x137c59,_0x2481ff[_0xdf08('0x10')][_0xdf08('0x11')]);return _0x45d7ee(_0x2481ff[_0xdf08('0x10')][_0xdf08('0x11')]);}else{logger[_0xdf08('0x12')](_0xdf08('0xd'),_0x137c59,_0xdf08('0xe'));_0x45d7ee(_0x2481ff['result'][_0xdf08('0x11')]);}})[_0xdf08('0x13')](function(_0x367399){logger['error'](_0xdf08('0xd'),_0x137c59,_0x367399);_0x43dc03(_0x367399);});});} \ No newline at end of file +var _0x91af=['info','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x1c2538,_0x36370f){var _0x16e08a=function(_0x105fd3){while(--_0x105fd3){_0x1c2538['push'](_0x1c2538['shift']());}};_0x16e08a(++_0x36370f);}(_0x91af,0x92));var _0xf91a=function(_0x55e5a4,_0x4b9468){_0x55e5a4=_0x55e5a4-0x0;var _0x39d7a0=_0x91af[_0x55e5a4];return _0x39d7a0;};'use strict';var _=require(_0xf91a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf91a('0x1'));var fs=require('fs');var Redis=require(_0xf91a('0x2'));var db=require(_0xf91a('0x3'))['db'];var utils=require(_0xf91a('0x4'));var logger=require('../../config/logger')(_0xf91a('0x5'));var config=require(_0xf91a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf91a('0x7')][_0xf91a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58028d,_0x1355fe,_0x5d358c){return new BPromise(function(_0x2e179d,_0x21a9c5){return client[_0xf91a('0x9')](_0x58028d,_0x5d358c)[_0xf91a('0xa')](function(_0x4687d1){logger['info'](_0xf91a('0xb'),_0x1355fe,_0xf91a('0xc'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x1355fe,_0xf91a('0xc'),JSON['stringify'](_0x4687d1));if(_0x4687d1[_0xf91a('0xd')]){if(_0x4687d1['error'][_0xf91a('0xe')]===0x1f4){logger[_0xf91a('0xd')](_0xf91a('0xb'),_0x1355fe,_0x4687d1['error'][_0xf91a('0xf')]);return _0x21a9c5(_0x4687d1['error'][_0xf91a('0xf')]);}logger[_0xf91a('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1355fe,_0x4687d1['error']['message']);return _0x2e179d(_0x4687d1[_0xf91a('0xd')][_0xf91a('0xf')]);}else{logger[_0xf91a('0x10')](_0xf91a('0xb'),_0x1355fe,_0xf91a('0xc'));_0x2e179d(_0x4687d1['result'][_0xf91a('0xf')]);}})[_0xf91a('0x11')](function(_0x366c5d){logger[_0xf91a('0xd')](_0xf91a('0xb'),_0x1355fe,_0x366c5d);_0x21a9c5(_0x366c5d);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index bff2ccd..a68e8c0 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 _0x9129=['./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','run','/:id/query','query','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x395162,_0x5af476){var _0x13f769=function(_0x300065){while(--_0x300065){_0x395162['push'](_0x395162['shift']());}};_0x13f769(++_0x5af476);}(_0x9129,0xcc));var _0x9912=function(_0xfee10f,_0x53470e){_0xfee10f=_0xfee10f-0x0;var _0xb91051=_0x9129[_0xfee10f];return _0xb91051;};'use strict';var multer=require(_0x9912('0x0'));var util=require(_0x9912('0x1'));var path=require('path');var timeout=require(_0x9912('0x2'));var express=require('express');var router=express[_0x9912('0x3')]();var fs_extra=require(_0x9912('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9912('0x5'));var controller=require(_0x9912('0x6'));router[_0x9912('0x7')]('/',auth[_0x9912('0x8')](),controller[_0x9912('0x9')]);router['get'](_0x9912('0xa'),auth[_0x9912('0x8')](),controller[_0x9912('0xb')]);router['get']('/:id/preview',auth[_0x9912('0x8')](),controller['preview']);router[_0x9912('0x7')]('/:id/run',auth[_0x9912('0x8')](),controller[_0x9912('0xc')]);router[_0x9912('0x7')](_0x9912('0xd'),auth[_0x9912('0x8')](),controller[_0x9912('0xe')]);router[_0x9912('0xf')]('/',auth['isAuthenticated'](),controller[_0x9912('0x10')]);router['put'](_0x9912('0xa'),auth[_0x9912('0x8')](),controller[_0x9912('0x11')]);router[_0x9912('0x12')](_0x9912('0xa'),auth[_0x9912('0x8')](),controller[_0x9912('0x13')]);module[_0x9912('0x14')]=router; \ No newline at end of file +var _0x9df5=['Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','query','put','update','delete','exports','util','path','express'];(function(_0x4ef25d,_0x5c71ca){var _0x34040f=function(_0x3329f2){while(--_0x3329f2){_0x4ef25d['push'](_0x4ef25d['shift']());}};_0x34040f(++_0x5c71ca);}(_0x9df5,0x165));var _0x59df=function(_0x4d753b,_0x2c0cf2){_0x4d753b=_0x4d753b-0x0;var _0x36a72d=_0x9df5[_0x4d753b];return _0x36a72d;};'use strict';var multer=require('multer');var util=require(_0x59df('0x0'));var path=require(_0x59df('0x1'));var timeout=require('connect-timeout');var express=require(_0x59df('0x2'));var router=express[_0x59df('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x59df('0x4'));var interaction=require(_0x59df('0x5'));var config=require('../../config/environment');var controller=require(_0x59df('0x6'));router[_0x59df('0x7')]('/',auth[_0x59df('0x8')](),controller['index']);router[_0x59df('0x7')](_0x59df('0x9'),auth[_0x59df('0x8')](),controller[_0x59df('0xa')]);router[_0x59df('0x7')](_0x59df('0xb'),auth['isAuthenticated'](),controller[_0x59df('0xc')]);router[_0x59df('0x7')](_0x59df('0xd'),auth['isAuthenticated'](),controller[_0x59df('0xe')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x59df('0xf')]);router['post']('/',auth[_0x59df('0x8')](),controller['create']);router[_0x59df('0x10')](_0x59df('0x9'),auth[_0x59df('0x8')](),controller[_0x59df('0x11')]);router[_0x59df('0x12')](_0x59df('0x9'),auth[_0x59df('0x8')](),controller['destroy']);module[_0x59df('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 f313113..0c0cbf6 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 _0xe1d3=['manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','DATE'];(function(_0x2191fb,_0x216516){var _0x31d7a1=function(_0x2035f7){while(--_0x2035f7){_0x2191fb['push'](_0x2191fb['shift']());}};_0x31d7a1(++_0x216516);}(_0xe1d3,0x19c));var _0x3e1d=function(_0x1fb16c,_0x440bfd){_0x1fb16c=_0x1fb16c-0x0;var _0xee214e=_0xe1d3[_0x1fb16c];return _0xee214e;};'use strict';var Sequelize=require(_0x3e1d('0x0'));var moment=require(_0x3e1d('0x1'));module[_0x3e1d('0x2')]={'name':{'type':Sequelize[_0x3e1d('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x3e1d('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x3e1d('0x4')](_0x3e1d('0x5'),_0x3e1d('0x6'),'xlsx'),'allowNull':![],'defaultValue':_0x3e1d('0x5')},'savename':{'type':Sequelize[_0x3e1d('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3e1d('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x3e1d('0x4')](_0x3e1d('0x8'),_0x3e1d('0x9')),'allowNull':![],'defaultValue':_0x3e1d('0x8')},'reportId':{'type':Sequelize[_0x3e1d('0xa')](0xb)[_0x3e1d('0xb')]},'reportType':{'type':Sequelize[_0x3e1d('0x3')]}}; \ No newline at end of file +var _0x37a5=['ENUM','csv','DATE','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x47bbd5,_0xfab6bc){var _0xea2a13=function(_0xc1964c){while(--_0xc1964c){_0x47bbd5['push'](_0x47bbd5['shift']());}};_0xea2a13(++_0xfab6bc);}(_0x37a5,0x1e6));var _0x537a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x37a5[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0x537a('0x0'));var moment=require(_0x537a('0x1'));module[_0x537a('0x2')]={'name':{'type':Sequelize[_0x537a('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x537a('0x4')](_0x537a('0x5'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x537a('0x5')},'savename':{'type':Sequelize[_0x537a('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x537a('0x6')]},'endDate':{'type':Sequelize[_0x537a('0x6')]},'status':{'type':Sequelize[_0x537a('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x537a('0x4')](_0x537a('0x7'),_0x537a('0x8')),'allowNull':![],'defaultValue':_0x537a('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x537a('0x9')]},'reportType':{'type':Sequelize[_0x537a('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 35a1db7..bdc3355 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 _0xba48=['options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','update','download','basename','savename','output','join','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','AnalyticExtractedReport','fieldName','type','key','model','map','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','catch','params','rawAttributes','keys','includeAll','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba48,0x12f));var _0x8ba4=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xba48[_0x186376];return _0x2dbdd9;};'use strict';var emlformat=require(_0x8ba4('0x0'));var rimraf=require(_0x8ba4('0x1'));var zipdir=require(_0x8ba4('0x2'));var jsonpatch=require(_0x8ba4('0x3'));var rp=require(_0x8ba4('0x4'));var moment=require(_0x8ba4('0x5'));var BPromise=require(_0x8ba4('0x6'));var Mustache=require('mustache');var util=require(_0x8ba4('0x7'));var path=require(_0x8ba4('0x8'));var sox=require(_0x8ba4('0x9'));var csv=require(_0x8ba4('0xa'));var ejs=require(_0x8ba4('0xb'));var fs=require('fs');var fs_extra=require(_0x8ba4('0xc'));var _=require('lodash');var squel=require(_0x8ba4('0xd'));var crypto=require(_0x8ba4('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8ba4('0xa'));var querystring=require('querystring');var Papa=require(_0x8ba4('0xf'));var Redis=require('ioredis');var authService=require(_0x8ba4('0x10'));var qs=require(_0x8ba4('0x11'));var as=require(_0x8ba4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ba4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8ba4('0x14'));var licenseUtil=require(_0x8ba4('0x15'));var db=require(_0x8ba4('0x16'))['db'];function respondWithStatusCode(_0x2d2b88,_0xd5cf5b){_0xd5cf5b=_0xd5cf5b||0xcc;return function(_0x1d79a7){if(_0x1d79a7){return _0x2d2b88[_0x8ba4('0x17')](_0xd5cf5b);}return _0x2d2b88[_0x8ba4('0x18')](_0xd5cf5b)[_0x8ba4('0x19')]();};}function respondWithResult(_0x493854,_0x25d4f3){_0x25d4f3=_0x25d4f3||0xc8;return function(_0x5885af){if(_0x5885af){return _0x493854[_0x8ba4('0x18')](_0x25d4f3)[_0x8ba4('0x1a')](_0x5885af);}};}function respondWithFilteredResult(_0x4cc13d,_0x39123a){return function(_0x4e4fb2){if(_0x4e4fb2){var _0x146c2c=typeof _0x39123a[_0x8ba4('0x1b')]==='undefined'&&typeof _0x39123a[_0x8ba4('0x1c')]===_0x8ba4('0x1d');var _0x2f2fde=_0x4e4fb2[_0x8ba4('0x1e')];var _0x208289=_0x146c2c?0x0:_0x39123a[_0x8ba4('0x1b')];var _0x4932f0=_0x146c2c?_0x4e4fb2[_0x8ba4('0x1e')]:_0x39123a[_0x8ba4('0x1b')]+_0x39123a[_0x8ba4('0x1c')];var _0x170b31;if(_0x4932f0>=_0x2f2fde){_0x4932f0=_0x2f2fde;_0x170b31=0xc8;}else{_0x170b31=0xce;}_0x4cc13d['status'](_0x170b31);return _0x4cc13d[_0x8ba4('0x1f')](_0x8ba4('0x20'),_0x208289+'-'+_0x4932f0+'/'+_0x2f2fde)[_0x8ba4('0x1a')](_0x4e4fb2);}return null;};}function patchUpdates(_0x14072f){return function(_0x1b01a7){try{jsonpatch[_0x8ba4('0x21')](_0x1b01a7,_0x14072f,!![]);}catch(_0x468e48){return BPromise[_0x8ba4('0x22')](_0x468e48);}return _0x1b01a7[_0x8ba4('0x23')]();};}function saveUpdates(_0x7ba7f4,_0x1e6665){return function(_0x1f2fa8){if(_0x1f2fa8){return _0x1f2fa8['update'](_0x7ba7f4)[_0x8ba4('0x24')](function(_0x2a0493){return _0x2a0493;});}return null;};}function removeEntity(_0x30292b,_0x736f9c){return function(_0x1b6a68){if(_0x1b6a68){return _0x1b6a68[_0x8ba4('0x25')]()[_0x8ba4('0x24')](function(){var _0x4d8e59=_0x1b6a68[_0x8ba4('0x26')]({'plain':!![]});var _0xe3732c=_0x8ba4('0x27');return db[_0x8ba4('0x28')]['destroy']({'where':{'type':_0xe3732c,'resourceId':_0x4d8e59['id']}})[_0x8ba4('0x24')](function(){return _0x1b6a68;});})['then'](function(){_0x30292b[_0x8ba4('0x18')](0xcc)[_0x8ba4('0x19')]();});}};}function handleEntityNotFound(_0x504d02,_0x2bf764){return function(_0x447f07){if(!_0x447f07){_0x504d02[_0x8ba4('0x17')](0x194);}return _0x447f07;};}function handleError(_0x3afcea,_0x141562){_0x141562=_0x141562||0x1f4;return function(_0x65ab5d){logger[_0x8ba4('0x29')](_0x65ab5d[_0x8ba4('0x2a')]);if(_0x65ab5d[_0x8ba4('0x2b')]){delete _0x65ab5d[_0x8ba4('0x2b')];}_0x3afcea[_0x8ba4('0x18')](_0x141562)[_0x8ba4('0x2c')](_0x65ab5d);};}exports['index']=function(_0x102a4e,_0x4fa9ef){var _0x1e01a9={},_0x353a61={},_0xd0503={'count':0x0,'rows':[]};var _0x132f38=_['map'](db[_0x8ba4('0x2d')]['rawAttributes'],function(_0x4902ee){return{'name':_0x4902ee[_0x8ba4('0x2e')],'type':_0x4902ee[_0x8ba4('0x2f')][_0x8ba4('0x30')]};});_0x353a61[_0x8ba4('0x31')]=_[_0x8ba4('0x32')](_0x132f38,_0x8ba4('0x2b'));_0x353a61['query']=_['keys'](_0x102a4e['query']);_0x353a61[_0x8ba4('0x33')]=_['intersection'](_0x353a61[_0x8ba4('0x31')],_0x353a61['query']);_0x1e01a9[_0x8ba4('0x34')]=_[_0x8ba4('0x35')](_0x353a61['model'],qs[_0x8ba4('0x36')](_0x102a4e[_0x8ba4('0x37')]['fields']));_0x1e01a9['attributes']=_0x1e01a9[_0x8ba4('0x34')][_0x8ba4('0x38')]?_0x1e01a9['attributes']:_0x353a61['model'];if(!_0x102a4e['query'][_0x8ba4('0x39')](_0x8ba4('0x3a'))){_0x1e01a9[_0x8ba4('0x1c')]=qs['limit'](_0x102a4e[_0x8ba4('0x37')][_0x8ba4('0x1c')]);_0x1e01a9['offset']=qs[_0x8ba4('0x1b')](_0x102a4e['query']['offset']);}_0x1e01a9[_0x8ba4('0x3b')]=qs['sort'](_0x102a4e[_0x8ba4('0x37')][_0x8ba4('0x3c')]);_0x1e01a9[_0x8ba4('0x3d')]=qs[_0x8ba4('0x33')](_[_0x8ba4('0x3e')](_0x102a4e[_0x8ba4('0x37')],_0x353a61[_0x8ba4('0x33')]),_0x132f38);if(_0x102a4e['query'][_0x8ba4('0x3f')]){_0x1e01a9[_0x8ba4('0x3d')]=_[_0x8ba4('0x40')](_0x1e01a9[_0x8ba4('0x3d')],{'$or':_[_0x8ba4('0x32')](_0x132f38,function(_0x4d5607){if(_0x4d5607[_0x8ba4('0x2f')]!==_0x8ba4('0x41')){var _0x56d218={};_0x56d218[_0x4d5607[_0x8ba4('0x2b')]]={'$like':'%'+_0x102a4e[_0x8ba4('0x37')][_0x8ba4('0x3f')]+'%'};return _0x56d218;}})});}_0x1e01a9=_[_0x8ba4('0x40')]({},_0x1e01a9,_0x102a4e['options']);var _0x5896f4={'where':_0x1e01a9[_0x8ba4('0x3d')]};return db[_0x8ba4('0x2d')][_0x8ba4('0x1e')](_0x5896f4)[_0x8ba4('0x24')](function(_0x39d40f){_0xd0503[_0x8ba4('0x1e')]=_0x39d40f;if(_0x102a4e[_0x8ba4('0x37')]['includeAll']){_0x1e01a9['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x8ba4('0x42')](_0x1e01a9);})[_0x8ba4('0x24')](function(_0x316e5f){_0xd0503['rows']=_0x316e5f;return _0xd0503;})[_0x8ba4('0x24')](respondWithFilteredResult(_0x4fa9ef,_0x1e01a9))[_0x8ba4('0x43')](handleError(_0x4fa9ef,null));};exports['show']=function(_0x52466e,_0xd24ad5){var _0xc20218={'raw':!![],'where':{'id':_0x52466e[_0x8ba4('0x44')]['id']}},_0x1a378b={};_0x1a378b[_0x8ba4('0x31')]=_['keys'](db[_0x8ba4('0x2d')][_0x8ba4('0x45')]);_0x1a378b[_0x8ba4('0x37')]=_[_0x8ba4('0x46')](_0x52466e['query']);_0x1a378b[_0x8ba4('0x33')]=_['intersection'](_0x1a378b[_0x8ba4('0x31')],_0x1a378b['query']);_0xc20218[_0x8ba4('0x34')]=_[_0x8ba4('0x35')](_0x1a378b[_0x8ba4('0x31')],qs[_0x8ba4('0x36')](_0x52466e['query'][_0x8ba4('0x36')]));_0xc20218[_0x8ba4('0x34')]=_0xc20218[_0x8ba4('0x34')][_0x8ba4('0x38')]?_0xc20218['attributes']:_0x1a378b[_0x8ba4('0x31')];if(_0x52466e[_0x8ba4('0x37')][_0x8ba4('0x47')]){_0xc20218[_0x8ba4('0x48')]=[{'all':!![]}];}_0xc20218=_['merge']({},_0xc20218,_0x52466e[_0x8ba4('0x49')]);return db[_0x8ba4('0x2d')][_0x8ba4('0x4a')](_0xc20218)[_0x8ba4('0x24')](handleEntityNotFound(_0xd24ad5,null))[_0x8ba4('0x24')](respondWithResult(_0xd24ad5,null))[_0x8ba4('0x43')](handleError(_0xd24ad5,null));};exports[_0x8ba4('0x4b')]=function(_0x4fca59,_0x1924e7){return db[_0x8ba4('0x2d')]['create'](_0x4fca59[_0x8ba4('0x4c')],{})[_0x8ba4('0x24')](function(_0x4fa705){var _0x292e6e=_0x4fca59[_0x8ba4('0x4d')]['get']({'plain':!![]});if(!_0x292e6e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x292e6e['role']===_0x8ba4('0x4d')){var _0x52acc8=_0x4fa705[_0x8ba4('0x26')]({'plain':!![]});var _0x2e5019='ExtractedReports';return db[_0x8ba4('0x4e')]['find']({'where':{'name':_0x2e5019,'userProfileId':_0x292e6e[_0x8ba4('0x4f')]},'raw':!![]})[_0x8ba4('0x24')](function(_0x350e24){if(_0x350e24&&_0x350e24[_0x8ba4('0x50')]===0x0){return db['UserProfileResource'][_0x8ba4('0x4b')]({'name':_0x52acc8[_0x8ba4('0x2b')],'resourceId':_0x52acc8['id'],'type':_0x350e24[_0x8ba4('0x2b')],'sectionId':_0x350e24['id']},{})[_0x8ba4('0x24')](function(){return _0x4fa705;});}else{return _0x4fa705;}})[_0x8ba4('0x43')](function(_0x46bd03){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46bd03);throw _0x46bd03;});}return _0x4fa705;})[_0x8ba4('0x24')](respondWithResult(_0x1924e7,0xc9))['catch'](handleError(_0x1924e7,null));};exports[_0x8ba4('0x51')]=function(_0x48f276,_0x1953fe){if(_0x48f276[_0x8ba4('0x4c')]['id']){delete _0x48f276[_0x8ba4('0x4c')]['id'];}return db[_0x8ba4('0x2d')][_0x8ba4('0x4a')]({'where':{'id':_0x48f276[_0x8ba4('0x44')]['id']}})['then'](handleEntityNotFound(_0x1953fe,null))[_0x8ba4('0x24')](saveUpdates(_0x48f276[_0x8ba4('0x4c')],null))['then'](respondWithResult(_0x1953fe,null))['catch'](handleError(_0x1953fe,null));};exports['destroy']=function(_0x221d0c,_0x4b0bdb){return db[_0x8ba4('0x2d')]['find']({'where':{'id':_0x221d0c['params']['id']}})['then'](handleEntityNotFound(_0x4b0bdb,null))[_0x8ba4('0x24')](removeEntity(_0x4b0bdb,null))[_0x8ba4('0x43')](handleError(_0x4b0bdb,null));};exports[_0x8ba4('0x52')]=function(_0x4c54ef,_0x56b018,_0xed9e06){return db[_0x8ba4('0x2d')][_0x8ba4('0x4a')]({'where':{'id':_0x4c54ef[_0x8ba4('0x44')]['id']},'attributes':['name',_0x8ba4('0x53'),_0x8ba4('0x54'),_0x8ba4('0x55')],'raw':!![]})[_0x8ba4('0x24')](handleEntityNotFound(_0x56b018,null))['then'](function(_0x1f1cb9){if(_0x1f1cb9){if(!fs['existsSync'](path[_0x8ba4('0x56')](config[_0x8ba4('0x57')],'server/files/reports',_0x1f1cb9[_0x8ba4('0x54')]))){throw new db[(_0x8ba4('0x58'))]['ValidationError'](_0x8ba4('0x59'));}if(_0x4c54ef['query'][_0x8ba4('0x5a')]){return _0x56b018['sendStatus'](0xc8);}return _0x56b018[_0x8ba4('0x52')](path[_0x8ba4('0x56')](config[_0x8ba4('0x57')],_0x8ba4('0x5b'),_0x1f1cb9[_0x8ba4('0x54')]),util[_0x8ba4('0x5c')](_0x8ba4('0x5d'),_0x1f1cb9[_0x8ba4('0x53')]||_0x1f1cb9[_0x8ba4('0x2b')],_0x1f1cb9[_0x8ba4('0x55')]['toLowerCase']()));}})['catch'](handleError(_0x56b018,null));}; \ No newline at end of file +var _0x734e=['Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','download','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','params','find','output','existsSync','join','root','server/files/reports','savename'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x734e,0x18f));var _0xe734=function(_0x7dfb21,_0x54cbb5){_0x7dfb21=_0x7dfb21-0x0;var _0x544f45=_0x734e[_0x7dfb21];return _0x544f45;};'use strict';var emlformat=require(_0xe734('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe734('0x1'));var jsonpatch=require(_0xe734('0x2'));var rp=require(_0xe734('0x3'));var moment=require(_0xe734('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xe734('0x5'));var sox=require(_0xe734('0x6'));var csv=require('to-csv');var ejs=require(_0xe734('0x7'));var fs=require('fs');var fs_extra=require(_0xe734('0x8'));var _=require(_0xe734('0x9'));var squel=require(_0xe734('0xa'));var crypto=require(_0xe734('0xb'));var jsforce=require(_0xe734('0xc'));var deskjs=require(_0xe734('0xd'));var toCsv=require(_0xe734('0xe'));var querystring=require(_0xe734('0xf'));var Papa=require(_0xe734('0x10'));var Redis=require('ioredis');var authService=require(_0xe734('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe734('0x12'));var hardwareService=require(_0xe734('0x13'));var logger=require(_0xe734('0x14'))(_0xe734('0x15'));var utils=require('../../config/utils');var config=require(_0xe734('0x16'));var licenseUtil=require(_0xe734('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e7c75,_0x1c342e){_0x1c342e=_0x1c342e||0xcc;return function(_0x36c518){if(_0x36c518){return _0x5e7c75[_0xe734('0x18')](_0x1c342e);}return _0x5e7c75[_0xe734('0x19')](_0x1c342e)[_0xe734('0x1a')]();};}function respondWithResult(_0x21e3a5,_0x1178b5){_0x1178b5=_0x1178b5||0xc8;return function(_0x2631f4){if(_0x2631f4){return _0x21e3a5[_0xe734('0x19')](_0x1178b5)[_0xe734('0x1b')](_0x2631f4);}};}function respondWithFilteredResult(_0x428671,_0x5be318){return function(_0x4d2690){if(_0x4d2690){var _0xa73ccd=typeof _0x5be318['offset']===_0xe734('0x1c')&&typeof _0x5be318[_0xe734('0x1d')]===_0xe734('0x1c');var _0x507d2a=_0x4d2690['count'];var _0xaf4f95=_0xa73ccd?0x0:_0x5be318['offset'];var _0x4291ab=_0xa73ccd?_0x4d2690[_0xe734('0x1e')]:_0x5be318[_0xe734('0x1f')]+_0x5be318[_0xe734('0x1d')];var _0x29930c;if(_0x4291ab>=_0x507d2a){_0x4291ab=_0x507d2a;_0x29930c=0xc8;}else{_0x29930c=0xce;}_0x428671[_0xe734('0x19')](_0x29930c);return _0x428671[_0xe734('0x20')](_0xe734('0x21'),_0xaf4f95+'-'+_0x4291ab+'/'+_0x507d2a)[_0xe734('0x1b')](_0x4d2690);}return null;};}function patchUpdates(_0x5191c8){return function(_0x507dc0){try{jsonpatch['apply'](_0x507dc0,_0x5191c8,!![]);}catch(_0x2dd95f){return BPromise[_0xe734('0x22')](_0x2dd95f);}return _0x507dc0[_0xe734('0x23')]();};}function saveUpdates(_0x30c315,_0xc2b02){return function(_0x2b8721){if(_0x2b8721){return _0x2b8721['update'](_0x30c315)['then'](function(_0x5be503){return _0x5be503;});}return null;};}function removeEntity(_0x52d408,_0x110c50){return function(_0xeae0b3){if(_0xeae0b3){return _0xeae0b3['destroy']()[_0xe734('0x24')](function(){var _0x44cb59=_0xeae0b3[_0xe734('0x25')]({'plain':!![]});var _0x4857d9=_0xe734('0x26');return db[_0xe734('0x27')]['destroy']({'where':{'type':_0x4857d9,'resourceId':_0x44cb59['id']}})['then'](function(){return _0xeae0b3;});})[_0xe734('0x24')](function(){_0x52d408[_0xe734('0x19')](0xcc)[_0xe734('0x1a')]();});}};}function handleEntityNotFound(_0x42e769,_0x3747b2){return function(_0x15e585){if(!_0x15e585){_0x42e769[_0xe734('0x18')](0x194);}return _0x15e585;};}function handleError(_0x56e635,_0x34166e){_0x34166e=_0x34166e||0x1f4;return function(_0x57dec1){logger[_0xe734('0x28')](_0x57dec1[_0xe734('0x29')]);if(_0x57dec1[_0xe734('0x2a')]){delete _0x57dec1[_0xe734('0x2a')];}_0x56e635['status'](_0x34166e)[_0xe734('0x2b')](_0x57dec1);};}exports[_0xe734('0x2c')]=function(_0x49cc7f,_0x81949b){var _0x5b0e4b={},_0xa1b7ee={},_0x4ca8d6={'count':0x0,'rows':[]};var _0x308d5a=_['map'](db['AnalyticExtractedReport'][_0xe734('0x2d')],function(_0x44eb14){return{'name':_0x44eb14[_0xe734('0x2e')],'type':_0x44eb14[_0xe734('0x2f')]['key']};});_0xa1b7ee['model']=_[_0xe734('0x30')](_0x308d5a,_0xe734('0x2a'));_0xa1b7ee[_0xe734('0x31')]=_[_0xe734('0x32')](_0x49cc7f[_0xe734('0x31')]);_0xa1b7ee['filters']=_[_0xe734('0x33')](_0xa1b7ee[_0xe734('0x34')],_0xa1b7ee['query']);_0x5b0e4b[_0xe734('0x35')]=_[_0xe734('0x33')](_0xa1b7ee[_0xe734('0x34')],qs[_0xe734('0x36')](_0x49cc7f[_0xe734('0x31')]['fields']));_0x5b0e4b[_0xe734('0x35')]=_0x5b0e4b['attributes'][_0xe734('0x37')]?_0x5b0e4b[_0xe734('0x35')]:_0xa1b7ee[_0xe734('0x34')];if(!_0x49cc7f['query'][_0xe734('0x38')](_0xe734('0x39'))){_0x5b0e4b[_0xe734('0x1d')]=qs[_0xe734('0x1d')](_0x49cc7f[_0xe734('0x31')][_0xe734('0x1d')]);_0x5b0e4b[_0xe734('0x1f')]=qs[_0xe734('0x1f')](_0x49cc7f['query'][_0xe734('0x1f')]);}_0x5b0e4b[_0xe734('0x3a')]=qs[_0xe734('0x3b')](_0x49cc7f[_0xe734('0x31')][_0xe734('0x3b')]);_0x5b0e4b[_0xe734('0x3c')]=qs['filters'](_[_0xe734('0x3d')](_0x49cc7f[_0xe734('0x31')],_0xa1b7ee[_0xe734('0x3e')]),_0x308d5a);if(_0x49cc7f[_0xe734('0x31')][_0xe734('0x3f')]){_0x5b0e4b[_0xe734('0x3c')]=_[_0xe734('0x40')](_0x5b0e4b[_0xe734('0x3c')],{'$or':_[_0xe734('0x30')](_0x308d5a,function(_0x3c3a7d){if(_0x3c3a7d['type']!==_0xe734('0x41')){var _0x447bd2={};_0x447bd2[_0x3c3a7d[_0xe734('0x2a')]]={'$like':'%'+_0x49cc7f['query']['filter']+'%'};return _0x447bd2;}})});}_0x5b0e4b=_['merge']({},_0x5b0e4b,_0x49cc7f[_0xe734('0x42')]);var _0x268992={'where':_0x5b0e4b[_0xe734('0x3c')]};return db[_0xe734('0x43')][_0xe734('0x1e')](_0x268992)[_0xe734('0x24')](function(_0x528580){_0x4ca8d6[_0xe734('0x1e')]=_0x528580;if(_0x49cc7f['query'][_0xe734('0x44')]){_0x5b0e4b[_0xe734('0x45')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x5b0e4b);})[_0xe734('0x24')](function(_0x5b0b7e){_0x4ca8d6[_0xe734('0x46')]=_0x5b0b7e;return _0x4ca8d6;})[_0xe734('0x24')](respondWithFilteredResult(_0x81949b,_0x5b0e4b))[_0xe734('0x47')](handleError(_0x81949b,null));};exports[_0xe734('0x48')]=function(_0x1b0a08,_0x3aa32c){var _0x52b79f={'raw':!![],'where':{'id':_0x1b0a08['params']['id']}},_0x30ed05={};_0x30ed05[_0xe734('0x34')]=_['keys'](db[_0xe734('0x43')]['rawAttributes']);_0x30ed05[_0xe734('0x31')]=_[_0xe734('0x32')](_0x1b0a08[_0xe734('0x31')]);_0x30ed05['filters']=_[_0xe734('0x33')](_0x30ed05[_0xe734('0x34')],_0x30ed05[_0xe734('0x31')]);_0x52b79f[_0xe734('0x35')]=_['intersection'](_0x30ed05['model'],qs[_0xe734('0x36')](_0x1b0a08[_0xe734('0x31')][_0xe734('0x36')]));_0x52b79f[_0xe734('0x35')]=_0x52b79f['attributes'][_0xe734('0x37')]?_0x52b79f[_0xe734('0x35')]:_0x30ed05[_0xe734('0x34')];if(_0x1b0a08[_0xe734('0x31')][_0xe734('0x44')]){_0x52b79f[_0xe734('0x45')]=[{'all':!![]}];}_0x52b79f=_[_0xe734('0x40')]({},_0x52b79f,_0x1b0a08['options']);return db[_0xe734('0x43')]['find'](_0x52b79f)['then'](handleEntityNotFound(_0x3aa32c,null))[_0xe734('0x24')](respondWithResult(_0x3aa32c,null))[_0xe734('0x47')](handleError(_0x3aa32c,null));};exports[_0xe734('0x49')]=function(_0x58e972,_0x3b0255){return db[_0xe734('0x43')]['create'](_0x58e972[_0xe734('0x4a')],{})[_0xe734('0x24')](function(_0x3c40d6){var _0x4fab0a=_0x58e972[_0xe734('0x4b')]['get']({'plain':!![]});if(!_0x4fab0a)throw new Error(_0xe734('0x4c'));if(_0x4fab0a[_0xe734('0x4d')]==='user'){var _0x3626b6=_0x3c40d6[_0xe734('0x25')]({'plain':!![]});var _0x526aaa=_0xe734('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x526aaa,'userProfileId':_0x4fab0a[_0xe734('0x4e')]},'raw':!![]})[_0xe734('0x24')](function(_0x3bb043){if(_0x3bb043&&_0x3bb043[_0xe734('0x4f')]===0x0){return db[_0xe734('0x27')][_0xe734('0x49')]({'name':_0x3626b6[_0xe734('0x2a')],'resourceId':_0x3626b6['id'],'type':_0x3bb043[_0xe734('0x2a')],'sectionId':_0x3bb043['id']},{})[_0xe734('0x24')](function(){return _0x3c40d6;});}else{return _0x3c40d6;}})[_0xe734('0x47')](function(_0x4c33c5){logger[_0xe734('0x28')](_0xe734('0x50'),_0x4c33c5);throw _0x4c33c5;});}return _0x3c40d6;})[_0xe734('0x24')](respondWithResult(_0x3b0255,0xc9))[_0xe734('0x47')](handleError(_0x3b0255,null));};exports[_0xe734('0x51')]=function(_0xda90e9,_0x26114e){if(_0xda90e9[_0xe734('0x4a')]['id']){delete _0xda90e9[_0xe734('0x4a')]['id'];}return db[_0xe734('0x43')]['find']({'where':{'id':_0xda90e9['params']['id']}})[_0xe734('0x24')](handleEntityNotFound(_0x26114e,null))['then'](saveUpdates(_0xda90e9['body'],null))[_0xe734('0x24')](respondWithResult(_0x26114e,null))['catch'](handleError(_0x26114e,null));};exports[_0xe734('0x52')]=function(_0x187744,_0x30db7d){return db[_0xe734('0x43')]['find']({'where':{'id':_0x187744[_0xe734('0x53')]['id']}})['then'](handleEntityNotFound(_0x30db7d,null))[_0xe734('0x24')](removeEntity(_0x30db7d,null))[_0xe734('0x47')](handleError(_0x30db7d,null));};exports['download']=function(_0x350675,_0x22ad40,_0xc2d096){return db[_0xe734('0x43')][_0xe734('0x54')]({'where':{'id':_0x350675['params']['id']},'attributes':[_0xe734('0x2a'),'basename','savename',_0xe734('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x22ad40,null))[_0xe734('0x24')](function(_0xffb35d){if(_0xffb35d){if(!fs[_0xe734('0x56')](path[_0xe734('0x57')](config[_0xe734('0x58')],_0xe734('0x59'),_0xffb35d[_0xe734('0x5a')]))){throw new db[(_0xe734('0x5b'))][(_0xe734('0x5c'))](_0xe734('0x5d'));}if(_0x350675['query']['exists']){return _0x22ad40[_0xe734('0x18')](0xc8);}return _0x22ad40[_0xe734('0x5e')](path[_0xe734('0x57')](config[_0xe734('0x58')],_0xe734('0x59'),_0xffb35d[_0xe734('0x5a')]),util[_0xe734('0x5f')](_0xe734('0x60'),_0xffb35d['basename']||_0xffb35d[_0xe734('0x2a')],_0xffb35d[_0xe734('0x55')][_0xe734('0x61')]()));}})[_0xe734('0x47')](handleError(_0x22ad40,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0f86691..d7c122b 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 _0x7e74=['exports','define','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x1c4c46,_0x3f3e8b){var _0x38e0e0=function(_0xa8038a){while(--_0xa8038a){_0x1c4c46['push'](_0x1c4c46['shift']());}};_0x38e0e0(++_0x3f3e8b);}(_0x7e74,0x16f));var _0x47e7=function(_0x29a0d7,_0x4ecd68){_0x29a0d7=_0x29a0d7-0x0;var _0x3e336f=_0x7e74[_0x29a0d7];return _0x3e336f;};'use strict';var _=require(_0x47e7('0x0'));var util=require(_0x47e7('0x1'));var logger=require(_0x47e7('0x2'))(_0x47e7('0x3'));var moment=require(_0x47e7('0x4'));var BPromise=require(_0x47e7('0x5'));var rp=require(_0x47e7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47e7('0x7'));var config=require(_0x47e7('0x8'));var attributes=require(_0x47e7('0x9'));module[_0x47e7('0xa')]=function(_0x4b110b,_0x2123f5){return _0x4b110b[_0x47e7('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0x47e7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47e4=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x1357aa,_0xd2f202){var _0x368ebc=function(_0x5a3adf){while(--_0x5a3adf){_0x1357aa['push'](_0x1357aa['shift']());}};_0x368ebc(++_0xd2f202);}(_0x47e4,0x15a));var _0x447e=function(_0x29d530,_0x5da0d7){_0x29d530=_0x29d530-0x0;var _0x242905=_0x47e4[_0x29d530];return _0x242905;};'use strict';var _=require(_0x447e('0x0'));var util=require(_0x447e('0x1'));var logger=require(_0x447e('0x2'))(_0x447e('0x3'));var moment=require(_0x447e('0x4'));var BPromise=require(_0x447e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x447e('0x6'));var rimraf=require('rimraf');var config=require(_0x447e('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x447e('0x8')]=function(_0x48f696,_0x16905d){return _0x48f696[_0x447e('0x9')](_0x447e('0xa'),attributes,{'tableName':_0x447e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 63610a1..3a106a3 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 _0xe51d=['ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring'];(function(_0xd902ad,_0x34a4db){var _0x2dda06=function(_0x29e470){while(--_0x29e470){_0xd902ad['push'](_0xd902ad['shift']());}};_0x2dda06(++_0x34a4db);}(_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});function respondWithRpcPromise(_0x5d1507,_0x21477c,_0x38ec14){return new BPromise(function(_0x2d6634,_0x3ff147){return client[_0xde51('0xa')](_0x5d1507,_0x38ec14)['then'](function(_0x5a95af){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x21477c,'request\x20sent');logger['debug'](_0xde51('0xb'),_0x21477c,_0xde51('0xc'),JSON[_0xde51('0xd')](_0x5a95af));if(_0x5a95af['error']){if(_0x5a95af[_0xde51('0xe')][_0xde51('0xf')]===0x1f4){logger[_0xde51('0xe')](_0xde51('0x10'),_0x21477c,_0x5a95af[_0xde51('0xe')][_0xde51('0x11')]);return _0x3ff147(_0x5a95af[_0xde51('0xe')][_0xde51('0x11')]);}logger[_0xde51('0xe')](_0xde51('0x10'),_0x21477c,_0x5a95af[_0xde51('0xe')][_0xde51('0x11')]);return _0x2d6634(_0x5a95af['error'][_0xde51('0x11')]);}else{logger[_0xde51('0x12')](_0xde51('0x10'),_0x21477c,'request\x20sent');_0x2d6634(_0x5a95af[_0xde51('0x13')][_0xde51('0x11')]);}})['catch'](function(_0x358ee5){logger[_0xde51('0xe')](_0xde51('0x10'),_0x21477c,_0x358ee5);_0x3ff147(_0x358ee5);});});} \ No newline at end of file +var _0x29fa=['error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x32518f,_0x45f6ef){var _0x383217=function(_0x43c371){while(--_0x43c371){_0x32518f['push'](_0x32518f['shift']());}};_0x383217(++_0x45f6ef);}(_0x29fa,0x1e8));var _0xa29f=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x29fa[_0x2e8418];return _0x548fe6;};'use strict';var _=require(_0xa29f('0x0'));var util=require(_0xa29f('0x1'));var moment=require('moment');var BPromise=require(_0xa29f('0x2'));var rs=require(_0xa29f('0x3'));var fs=require('fs');var Redis=require(_0xa29f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa29f('0x5'));var logger=require('../../config/logger')(_0xa29f('0x6'));var config=require(_0xa29f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa29f('0x8')][_0xa29f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2abed0,_0x369a07,_0x3499c1){return new BPromise(function(_0x2e0660,_0x16975e){return client[_0xa29f('0xa')](_0x2abed0,_0x3499c1)[_0xa29f('0xb')](function(_0x336028){logger['info'](_0xa29f('0xc'),_0x369a07,_0xa29f('0xd'));logger[_0xa29f('0xe')](_0xa29f('0xf'),_0x369a07,_0xa29f('0xd'),JSON['stringify'](_0x336028));if(_0x336028['error']){if(_0x336028[_0xa29f('0x10')][_0xa29f('0x11')]===0x1f4){logger[_0xa29f('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x369a07,_0x336028[_0xa29f('0x10')]['message']);return _0x16975e(_0x336028[_0xa29f('0x10')][_0xa29f('0x12')]);}logger[_0xa29f('0x10')](_0xa29f('0xc'),_0x369a07,_0x336028[_0xa29f('0x10')][_0xa29f('0x12')]);return _0x2e0660(_0x336028['error'][_0xa29f('0x12')]);}else{logger[_0xa29f('0x13')](_0xa29f('0xc'),_0x369a07,_0xa29f('0xd'));_0x2e0660(_0x336028[_0xa29f('0x14')]['message']);}})['catch'](function(_0x2979c0){logger[_0xa29f('0x10')](_0xa29f('0xc'),_0x369a07,_0x2979c0);_0x16975e(_0x2979c0);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index b2876c8..a222e57 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 _0x4f59=['isAuthenticated','index','show','/:id/download','download','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4f59,0x68));var _0x94f5=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0x4f59[_0xb875ee];return _0x4c7f3a;};'use strict';var multer=require(_0x94f5('0x0'));var util=require(_0x94f5('0x1'));var path=require(_0x94f5('0x2'));var timeout=require(_0x94f5('0x3'));var express=require(_0x94f5('0x4'));var router=express[_0x94f5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x94f5('0x6'));var interaction=require(_0x94f5('0x7'));var config=require(_0x94f5('0x8'));var controller=require(_0x94f5('0x9'));router[_0x94f5('0xa')]('/',auth[_0x94f5('0xb')](),controller[_0x94f5('0xc')]);router[_0x94f5('0xa')]('/:id',auth[_0x94f5('0xb')](),controller[_0x94f5('0xd')]);router[_0x94f5('0xa')](_0x94f5('0xe'),auth[_0x94f5('0xb')](),controller[_0x94f5('0xf')]);router['post']('/',auth[_0x94f5('0xb')](),controller[_0x94f5('0x10')]);router[_0x94f5('0x11')]('/:id',auth[_0x94f5('0xb')](),controller[_0x94f5('0x12')]);router[_0x94f5('0x13')](_0x94f5('0x14'),auth[_0x94f5('0xb')](),controller[_0x94f5('0x15')]);module[_0x94f5('0x16')]=router; \ No newline at end of file +var _0xca4f=['get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticExtractedReport.controller'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0xca4f,0x160));var _0xfca4=function(_0x4448ce,_0xea7546){_0x4448ce=_0x4448ce-0x0;var _0x4fad2e=_0xca4f[_0x4448ce];return _0x4fad2e;};'use strict';var multer=require(_0xfca4('0x0'));var util=require(_0xfca4('0x1'));var path=require(_0xfca4('0x2'));var timeout=require(_0xfca4('0x3'));var express=require(_0xfca4('0x4'));var router=express[_0xfca4('0x5')]();var fs_extra=require(_0xfca4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfca4('0x7'));var controller=require(_0xfca4('0x8'));router[_0xfca4('0x9')]('/',auth[_0xfca4('0xa')](),controller[_0xfca4('0xb')]);router[_0xfca4('0x9')](_0xfca4('0xc'),auth[_0xfca4('0xa')](),controller['show']);router[_0xfca4('0x9')](_0xfca4('0xd'),auth[_0xfca4('0xa')](),controller[_0xfca4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfca4('0xf')]);router[_0xfca4('0x10')](_0xfca4('0xc'),auth[_0xfca4('0xa')](),controller['update']);router[_0xfca4('0x11')](_0xfca4('0xc'),auth['isAuthenticated'](),controller[_0xfca4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1422d0a..47c332a 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 _0xf3e9=['STRING','BOOLEAN','sequelize','exports'];(function(_0x352392,_0x3337c7){var _0x567118=function(_0x142120){while(--_0x142120){_0x352392['push'](_0x352392['shift']());}};_0x567118(++_0x3337c7);}(_0xf3e9,0x14e));var _0x9f3e=function(_0x3883a0,_0x38ddbf){_0x3883a0=_0x3883a0-0x0;var _0x16dc7e=_0xf3e9[_0x3883a0];return _0x16dc7e;};'use strict';var Sequelize=require(_0x9f3e('0x0'));module[_0x9f3e('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x9f3e('0x2')]},'function':{'type':Sequelize[_0x9f3e('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x9f3e('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x9f3e('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8d97=['BOOLEAN','exports','STRING'];(function(_0x3c3e72,_0x3e1858){var _0x48a7e5=function(_0x3d1c72){while(--_0x3d1c72){_0x3c3e72['push'](_0x3c3e72['shift']());}};_0x48a7e5(++_0x3e1858);}(_0x8d97,0x193));var _0x78d9=function(_0x1c9b62,_0x451c35){_0x1c9b62=_0x1c9b62-0x0;var _0x2d407c=_0x8d97[_0x1c9b62];return _0x2d407c;};'use strict';var Sequelize=require('sequelize');module[_0x78d9('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x78d9('0x1')]},'format':{'type':Sequelize[_0x78d9('0x1')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x78d9('0x1')]},'custom':{'type':Sequelize[_0x78d9('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 5b71c86..bf922e9 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 _0x7494=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','show','rawAttributes','options','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7494,0x1e8));var _0x4749=function(_0x4b9ba1,_0x211e29){_0x4b9ba1=_0x4b9ba1-0x0;var _0x26b052=_0x7494[_0x4b9ba1];return _0x26b052;};'use strict';var emlformat=require(_0x4749('0x0'));var rimraf=require(_0x4749('0x1'));var zipdir=require(_0x4749('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4749('0x3'));var moment=require('moment');var BPromise=require(_0x4749('0x4'));var Mustache=require(_0x4749('0x5'));var util=require(_0x4749('0x6'));var path=require(_0x4749('0x7'));var sox=require(_0x4749('0x8'));var csv=require(_0x4749('0x9'));var ejs=require(_0x4749('0xa'));var fs=require('fs');var fs_extra=require(_0x4749('0xb'));var _=require('lodash');var squel=require(_0x4749('0xc'));var crypto=require(_0x4749('0xd'));var jsforce=require(_0x4749('0xe'));var deskjs=require(_0x4749('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4749('0x10'));var Papa=require('papaparse');var Redis=require(_0x4749('0x11'));var authService=require(_0x4749('0x12'));var qs=require(_0x4749('0x13'));var as=require(_0x4749('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4749('0x15'))('api');var utils=require(_0x4749('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4749('0x17'));var db=require(_0x4749('0x18'))['db'];function respondWithStatusCode(_0xd412d1,_0x171248){_0x171248=_0x171248||0xcc;return function(_0x45845e){if(_0x45845e){return _0xd412d1[_0x4749('0x19')](_0x171248);}return _0xd412d1[_0x4749('0x1a')](_0x171248)[_0x4749('0x1b')]();};}function respondWithResult(_0x55c44a,_0x203d33){_0x203d33=_0x203d33||0xc8;return function(_0x4fc66a){if(_0x4fc66a){return _0x55c44a[_0x4749('0x1a')](_0x203d33)[_0x4749('0x1c')](_0x4fc66a);}};}function respondWithFilteredResult(_0x1cbc3e,_0x2fcfa2){return function(_0x3bd2c5){if(_0x3bd2c5){var _0x378a70=typeof _0x2fcfa2['offset']===_0x4749('0x1d')&&typeof _0x2fcfa2[_0x4749('0x1e')]===_0x4749('0x1d');var _0x53576e=_0x3bd2c5['count'];var _0x1f235e=_0x378a70?0x0:_0x2fcfa2[_0x4749('0x1f')];var _0x362e4f=_0x378a70?_0x3bd2c5[_0x4749('0x20')]:_0x2fcfa2['offset']+_0x2fcfa2['limit'];var _0x14db2b;if(_0x362e4f>=_0x53576e){_0x362e4f=_0x53576e;_0x14db2b=0xc8;}else{_0x14db2b=0xce;}_0x1cbc3e[_0x4749('0x1a')](_0x14db2b);return _0x1cbc3e[_0x4749('0x21')](_0x4749('0x22'),_0x1f235e+'-'+_0x362e4f+'/'+_0x53576e)[_0x4749('0x1c')](_0x3bd2c5);}return null;};}function patchUpdates(_0x241a76){return function(_0x2794ea){try{jsonpatch['apply'](_0x2794ea,_0x241a76,!![]);}catch(_0x11b599){return BPromise[_0x4749('0x23')](_0x11b599);}return _0x2794ea['save']();};}function saveUpdates(_0x1ad389,_0x176420){return function(_0x8516d6){if(_0x8516d6){return _0x8516d6[_0x4749('0x24')](_0x1ad389)[_0x4749('0x25')](function(_0x14ad62){return _0x14ad62;});}return null;};}function removeEntity(_0x3b950c,_0x35f298){return function(_0xeab13c){if(_0xeab13c){return _0xeab13c[_0x4749('0x26')]()[_0x4749('0x25')](function(){_0x3b950c['status'](0xcc)[_0x4749('0x1b')]();});}};}function handleEntityNotFound(_0x91547d,_0x4e649d){return function(_0x9f1632){if(!_0x9f1632){_0x91547d[_0x4749('0x19')](0x194);}return _0x9f1632;};}function handleError(_0x4fef74,_0x36dd51){_0x36dd51=_0x36dd51||0x1f4;return function(_0x469f32){logger[_0x4749('0x27')](_0x469f32[_0x4749('0x28')]);if(_0x469f32[_0x4749('0x29')]){delete _0x469f32['name'];}_0x4fef74[_0x4749('0x1a')](_0x36dd51)[_0x4749('0x2a')](_0x469f32);};}exports['index']=function(_0x299b47,_0x53b71a){var _0x5072e9={},_0x1bc56e={},_0x9e49fc={'count':0x0,'rows':[]};var _0x967886=_[_0x4749('0x2b')](db[_0x4749('0x2c')]['rawAttributes'],function(_0x4a58c1){return{'name':_0x4a58c1[_0x4749('0x2d')],'type':_0x4a58c1[_0x4749('0x2e')][_0x4749('0x2f')]};});_0x1bc56e['model']=_[_0x4749('0x2b')](_0x967886,_0x4749('0x29'));_0x1bc56e[_0x4749('0x30')]=_[_0x4749('0x31')](_0x299b47['query']);_0x1bc56e[_0x4749('0x32')]=_[_0x4749('0x33')](_0x1bc56e[_0x4749('0x34')],_0x1bc56e[_0x4749('0x30')]);_0x5072e9['attributes']=_[_0x4749('0x33')](_0x1bc56e[_0x4749('0x34')],qs[_0x4749('0x35')](_0x299b47[_0x4749('0x30')][_0x4749('0x35')]));_0x5072e9[_0x4749('0x36')]=_0x5072e9[_0x4749('0x36')][_0x4749('0x37')]?_0x5072e9[_0x4749('0x36')]:_0x1bc56e['model'];if(!_0x299b47['query'][_0x4749('0x38')](_0x4749('0x39'))){_0x5072e9[_0x4749('0x1e')]=qs[_0x4749('0x1e')](_0x299b47['query'][_0x4749('0x1e')]);_0x5072e9[_0x4749('0x1f')]=qs[_0x4749('0x1f')](_0x299b47['query'][_0x4749('0x1f')]);}_0x5072e9[_0x4749('0x3a')]=qs[_0x4749('0x3b')](_0x299b47['query'][_0x4749('0x3b')]);_0x5072e9['where']=qs[_0x4749('0x32')](_[_0x4749('0x3c')](_0x299b47['query'],_0x1bc56e[_0x4749('0x32')]),_0x967886);if(_0x299b47[_0x4749('0x30')][_0x4749('0x3d')]){_0x5072e9[_0x4749('0x3e')]=_[_0x4749('0x3f')](_0x5072e9['where'],{'$or':_[_0x4749('0x2b')](_0x967886,function(_0x4fd305){if(_0x4fd305[_0x4749('0x2e')]!=='VIRTUAL'){var _0x5c0fdf={};_0x5c0fdf[_0x4fd305['name']]={'$like':'%'+_0x299b47[_0x4749('0x30')][_0x4749('0x3d')]+'%'};return _0x5c0fdf;}})});}_0x5072e9=_[_0x4749('0x3f')]({},_0x5072e9,_0x299b47['options']);var _0x43f449={'where':_0x5072e9[_0x4749('0x3e')]};return db['AnalyticFieldReport'][_0x4749('0x20')](_0x43f449)['then'](function(_0x6e6ba7){_0x9e49fc[_0x4749('0x20')]=_0x6e6ba7;if(_0x299b47[_0x4749('0x30')][_0x4749('0x40')]){_0x5072e9[_0x4749('0x41')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x4749('0x42')](_0x5072e9);})[_0x4749('0x25')](function(_0xd9cf08){_0x9e49fc['rows']=_0xd9cf08;return _0x9e49fc;})[_0x4749('0x25')](respondWithFilteredResult(_0x53b71a,_0x5072e9))[_0x4749('0x43')](handleError(_0x53b71a,null));};exports[_0x4749('0x44')]=function(_0x50e3ca,_0x1b0ba3){var _0x2c6ae8={'raw':![],'where':{'id':_0x50e3ca['params']['id']}},_0x161790={};_0x161790[_0x4749('0x34')]=_['keys'](db[_0x4749('0x2c')][_0x4749('0x45')]);_0x161790['query']=_[_0x4749('0x31')](_0x50e3ca[_0x4749('0x30')]);_0x161790[_0x4749('0x32')]=_[_0x4749('0x33')](_0x161790[_0x4749('0x34')],_0x161790[_0x4749('0x30')]);_0x2c6ae8['attributes']=_[_0x4749('0x33')](_0x161790[_0x4749('0x34')],qs[_0x4749('0x35')](_0x50e3ca[_0x4749('0x30')][_0x4749('0x35')]));_0x2c6ae8[_0x4749('0x36')]=_0x2c6ae8[_0x4749('0x36')][_0x4749('0x37')]?_0x2c6ae8['attributes']:_0x161790[_0x4749('0x34')];if(_0x50e3ca[_0x4749('0x30')][_0x4749('0x40')]){_0x2c6ae8[_0x4749('0x41')]=[{'all':!![]}];}_0x2c6ae8=_[_0x4749('0x3f')]({},_0x2c6ae8,_0x50e3ca[_0x4749('0x46')]);return db[_0x4749('0x2c')][_0x4749('0x47')](_0x2c6ae8)[_0x4749('0x25')](handleEntityNotFound(_0x1b0ba3,null))[_0x4749('0x25')](respondWithResult(_0x1b0ba3,null))['catch'](handleError(_0x1b0ba3,null));};exports[_0x4749('0x48')]=function(_0x2d0638,_0x1eb7ae){return db['AnalyticFieldReport'][_0x4749('0x48')](_0x2d0638[_0x4749('0x49')],{})[_0x4749('0x25')](respondWithResult(_0x1eb7ae,0xc9))[_0x4749('0x43')](handleError(_0x1eb7ae,null));};exports['bulkCreate']=function(_0x39ad55,_0x863db4){return db[_0x4749('0x2c')][_0x4749('0x4a')](_0x39ad55[_0x4749('0x49')],{'raw':![],'individualHooks':!![]})[_0x4749('0x25')](respondWithResult(_0x863db4,0xc9))['catch'](handleError(_0x863db4,null));};exports[_0x4749('0x24')]=function(_0x4e8b51,_0x4afab3){if(_0x4e8b51['body']['id']){delete _0x4e8b51[_0x4749('0x49')]['id'];}return db[_0x4749('0x2c')][_0x4749('0x47')]({'where':{'id':_0x4e8b51[_0x4749('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4afab3,null))[_0x4749('0x25')](saveUpdates(_0x4e8b51['body'],null))[_0x4749('0x25')](respondWithResult(_0x4afab3,null))['catch'](handleError(_0x4afab3,null));};exports[_0x4749('0x26')]=function(_0x3ce349,_0x4b8815){return db[_0x4749('0x2c')][_0x4749('0x47')]({'where':{'id':_0x3ce349['params']['id']}})[_0x4749('0x25')](handleEntityNotFound(_0x4b8815,null))[_0x4749('0x25')](removeEntity(_0x4b8815,null))[_0x4749('0x43')](handleError(_0x4b8815,null));};exports[_0x4749('0x4c')]=function(_0x399242,_0x30f4bf){return db[_0x4749('0x2c')][_0x4749('0x26')]({'where':{'id':_0x399242[_0x4749('0x30')][_0x4749('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x4749('0x25')](respondWithResult(_0x30f4bf,0xcc))[_0x4749('0x43')](handleError(_0x30f4bf,null));};exports[_0x4749('0x4e')]=function(_0x541129,_0x30a1ca,_0x522f72){return db[_0x4749('0x4f')][_0x4749('0x50')]({'where':{'id':_0x541129[_0x4749('0x4b')]['id']}})['then'](handleEntityNotFound(_0x30a1ca,null))[_0x4749('0x25')](function(_0x144513){if(_0x144513){return db[_0x4749('0x51')][_0x4749('0x52')](function(_0x1478da){return db[_0x4749('0x2c')][_0x4749('0x26')]({'where':{'CustomReportId':_0x541129['params']['id']},'transaction':_0x1478da})['then'](function(_0x2706de){var _0x3be598=_[_0x4749('0x2b')](_0x541129[_0x4749('0x49')],function(_0x42e934){delete _0x42e934['id'];_0x42e934[_0x4749('0x53')]=_0x541129[_0x4749('0x4b')]['id'];return _0x42e934;});return db[_0x4749('0x2c')][_0x4749('0x4a')](_0x3be598,{'transaction':_0x1478da});});})[_0x4749('0x25')](function(){return db[_0x4749('0x2c')][_0x4749('0x42')]({'where':{'CustomReportId':_0x541129[_0x4749('0x4b')]['id']}});});}})[_0x4749('0x25')](respondWithResult(_0x30a1ca,null))[_0x4749('0x43')](handleError(_0x30a1ca,null));}; \ No newline at end of file +var _0xcad5=['catch','show','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','undefined','limit','offset','count','set','json','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','AnalyticFieldReport','includeAll','include','findAll'];(function(_0x6e1e6e,_0x32eb2b){var _0x3f1e93=function(_0x379838){while(--_0x379838){_0x6e1e6e['push'](_0x6e1e6e['shift']());}};_0x3f1e93(++_0x32eb2b);}(_0xcad5,0x1ae));var _0x5cad=function(_0x2ef93d,_0x39bb6f){_0x2ef93d=_0x2ef93d-0x0;var _0x4cf938=_0xcad5[_0x2ef93d];return _0x4cf938;};'use strict';var emlformat=require(_0x5cad('0x0'));var rimraf=require(_0x5cad('0x1'));var zipdir=require(_0x5cad('0x2'));var jsonpatch=require(_0x5cad('0x3'));var rp=require(_0x5cad('0x4'));var moment=require('moment');var BPromise=require(_0x5cad('0x5'));var Mustache=require('mustache');var util=require(_0x5cad('0x6'));var path=require(_0x5cad('0x7'));var sox=require(_0x5cad('0x8'));var csv=require(_0x5cad('0x9'));var ejs=require(_0x5cad('0xa'));var fs=require('fs');var fs_extra=require(_0x5cad('0xb'));var _=require(_0x5cad('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5cad('0xd'));var deskjs=require(_0x5cad('0xe'));var toCsv=require(_0x5cad('0x9'));var querystring=require(_0x5cad('0xf'));var Papa=require(_0x5cad('0x10'));var Redis=require(_0x5cad('0x11'));var authService=require(_0x5cad('0x12'));var qs=require(_0x5cad('0x13'));var as=require(_0x5cad('0x14'));var hardwareService=require(_0x5cad('0x15'));var logger=require(_0x5cad('0x16'))(_0x5cad('0x17'));var utils=require(_0x5cad('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5cad('0x19'))['db'];function respondWithStatusCode(_0x1f690c,_0x741a02){_0x741a02=_0x741a02||0xcc;return function(_0x5e7ea5){if(_0x5e7ea5){return _0x1f690c['sendStatus'](_0x741a02);}return _0x1f690c[_0x5cad('0x1a')](_0x741a02)[_0x5cad('0x1b')]();};}function respondWithResult(_0x210da5,_0xb6cd77){_0xb6cd77=_0xb6cd77||0xc8;return function(_0x113ec8){if(_0x113ec8){return _0x210da5['status'](_0xb6cd77)['json'](_0x113ec8);}};}function respondWithFilteredResult(_0x23d7f3,_0x5da8f8){return function(_0x261b76){if(_0x261b76){var _0x2f630c=typeof _0x5da8f8['offset']===_0x5cad('0x1c')&&typeof _0x5da8f8[_0x5cad('0x1d')]===_0x5cad('0x1c');var _0xaedf1d=_0x261b76['count'];var _0x362b43=_0x2f630c?0x0:_0x5da8f8[_0x5cad('0x1e')];var _0x222916=_0x2f630c?_0x261b76[_0x5cad('0x1f')]:_0x5da8f8['offset']+_0x5da8f8['limit'];var _0x1413cf;if(_0x222916>=_0xaedf1d){_0x222916=_0xaedf1d;_0x1413cf=0xc8;}else{_0x1413cf=0xce;}_0x23d7f3[_0x5cad('0x1a')](_0x1413cf);return _0x23d7f3[_0x5cad('0x20')]('Content-Range',_0x362b43+'-'+_0x222916+'/'+_0xaedf1d)[_0x5cad('0x21')](_0x261b76);}return null;};}function patchUpdates(_0x5988ff){return function(_0x23f18d){try{jsonpatch['apply'](_0x23f18d,_0x5988ff,!![]);}catch(_0x1bbe1a){return BPromise[_0x5cad('0x22')](_0x1bbe1a);}return _0x23f18d[_0x5cad('0x23')]();};}function saveUpdates(_0x14f1da,_0x5d8c0d){return function(_0x3e066d){if(_0x3e066d){return _0x3e066d[_0x5cad('0x24')](_0x14f1da)['then'](function(_0x5215e8){return _0x5215e8;});}return null;};}function removeEntity(_0x34c7da,_0x4c9743){return function(_0x5b34d4){if(_0x5b34d4){return _0x5b34d4[_0x5cad('0x25')]()[_0x5cad('0x26')](function(){_0x34c7da[_0x5cad('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dc4e0,_0xa6306e){return function(_0x9eb145){if(!_0x9eb145){_0x1dc4e0[_0x5cad('0x27')](0x194);}return _0x9eb145;};}function handleError(_0x51a4a9,_0x945f3a){_0x945f3a=_0x945f3a||0x1f4;return function(_0x2636de){logger[_0x5cad('0x28')](_0x2636de['stack']);if(_0x2636de[_0x5cad('0x29')]){delete _0x2636de[_0x5cad('0x29')];}_0x51a4a9[_0x5cad('0x1a')](_0x945f3a)[_0x5cad('0x2a')](_0x2636de);};}exports[_0x5cad('0x2b')]=function(_0x1ca04d,_0x26ac79){var _0x33c855={},_0x2721d9={},_0x5dafba={'count':0x0,'rows':[]};var _0x36f676=_[_0x5cad('0x2c')](db['AnalyticFieldReport'][_0x5cad('0x2d')],function(_0x527497){return{'name':_0x527497['fieldName'],'type':_0x527497[_0x5cad('0x2e')][_0x5cad('0x2f')]};});_0x2721d9['model']=_[_0x5cad('0x2c')](_0x36f676,_0x5cad('0x29'));_0x2721d9[_0x5cad('0x30')]=_[_0x5cad('0x31')](_0x1ca04d[_0x5cad('0x30')]);_0x2721d9[_0x5cad('0x32')]=_[_0x5cad('0x33')](_0x2721d9[_0x5cad('0x34')],_0x2721d9[_0x5cad('0x30')]);_0x33c855[_0x5cad('0x35')]=_[_0x5cad('0x33')](_0x2721d9['model'],qs[_0x5cad('0x36')](_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x36')]));_0x33c855[_0x5cad('0x35')]=_0x33c855['attributes'][_0x5cad('0x37')]?_0x33c855[_0x5cad('0x35')]:_0x2721d9[_0x5cad('0x34')];if(!_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x38')](_0x5cad('0x39'))){_0x33c855[_0x5cad('0x1d')]=qs[_0x5cad('0x1d')](_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x1d')]);_0x33c855['offset']=qs[_0x5cad('0x1e')](_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x1e')]);}_0x33c855[_0x5cad('0x3a')]=qs['sort'](_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x3b')]);_0x33c855[_0x5cad('0x3c')]=qs[_0x5cad('0x32')](_['pick'](_0x1ca04d[_0x5cad('0x30')],_0x2721d9[_0x5cad('0x32')]),_0x36f676);if(_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x3d')]){_0x33c855['where']=_[_0x5cad('0x3e')](_0x33c855[_0x5cad('0x3c')],{'$or':_['map'](_0x36f676,function(_0x154c0a){if(_0x154c0a['type']!=='VIRTUAL'){var _0x107689={};_0x107689[_0x154c0a['name']]={'$like':'%'+_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x3d')]+'%'};return _0x107689;}})});}_0x33c855=_[_0x5cad('0x3e')]({},_0x33c855,_0x1ca04d[_0x5cad('0x3f')]);var _0x3c2365={'where':_0x33c855[_0x5cad('0x3c')]};return db[_0x5cad('0x40')][_0x5cad('0x1f')](_0x3c2365)[_0x5cad('0x26')](function(_0x1fc89c){_0x5dafba[_0x5cad('0x1f')]=_0x1fc89c;if(_0x1ca04d[_0x5cad('0x30')][_0x5cad('0x41')]){_0x33c855[_0x5cad('0x42')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x5cad('0x43')](_0x33c855);})[_0x5cad('0x26')](function(_0x8423ae){_0x5dafba['rows']=_0x8423ae;return _0x5dafba;})['then'](respondWithFilteredResult(_0x26ac79,_0x33c855))[_0x5cad('0x44')](handleError(_0x26ac79,null));};exports[_0x5cad('0x45')]=function(_0x3f67d0,_0x55df56){var _0x2298df={'raw':![],'where':{'id':_0x3f67d0['params']['id']}},_0x58acf6={};_0x58acf6[_0x5cad('0x34')]=_[_0x5cad('0x31')](db[_0x5cad('0x40')][_0x5cad('0x2d')]);_0x58acf6['query']=_[_0x5cad('0x31')](_0x3f67d0[_0x5cad('0x30')]);_0x58acf6[_0x5cad('0x32')]=_['intersection'](_0x58acf6[_0x5cad('0x34')],_0x58acf6['query']);_0x2298df[_0x5cad('0x35')]=_['intersection'](_0x58acf6[_0x5cad('0x34')],qs[_0x5cad('0x36')](_0x3f67d0[_0x5cad('0x30')][_0x5cad('0x36')]));_0x2298df[_0x5cad('0x35')]=_0x2298df[_0x5cad('0x35')][_0x5cad('0x37')]?_0x2298df[_0x5cad('0x35')]:_0x58acf6[_0x5cad('0x34')];if(_0x3f67d0['query']['includeAll']){_0x2298df[_0x5cad('0x42')]=[{'all':!![]}];}_0x2298df=_[_0x5cad('0x3e')]({},_0x2298df,_0x3f67d0['options']);return db[_0x5cad('0x40')][_0x5cad('0x46')](_0x2298df)[_0x5cad('0x26')](handleEntityNotFound(_0x55df56,null))[_0x5cad('0x26')](respondWithResult(_0x55df56,null))[_0x5cad('0x44')](handleError(_0x55df56,null));};exports[_0x5cad('0x47')]=function(_0x5f24f0,_0x2e85ca){return db[_0x5cad('0x40')][_0x5cad('0x47')](_0x5f24f0[_0x5cad('0x48')],{})['then'](respondWithResult(_0x2e85ca,0xc9))[_0x5cad('0x44')](handleError(_0x2e85ca,null));};exports[_0x5cad('0x49')]=function(_0x2ab5df,_0x1d4132){return db[_0x5cad('0x40')][_0x5cad('0x49')](_0x2ab5df[_0x5cad('0x48')],{'raw':![],'individualHooks':!![]})[_0x5cad('0x26')](respondWithResult(_0x1d4132,0xc9))[_0x5cad('0x44')](handleError(_0x1d4132,null));};exports[_0x5cad('0x24')]=function(_0xe1a5a4,_0x4794b2){if(_0xe1a5a4[_0x5cad('0x48')]['id']){delete _0xe1a5a4[_0x5cad('0x48')]['id'];}return db[_0x5cad('0x40')][_0x5cad('0x46')]({'where':{'id':_0xe1a5a4[_0x5cad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4794b2,null))[_0x5cad('0x26')](saveUpdates(_0xe1a5a4['body'],null))['then'](respondWithResult(_0x4794b2,null))[_0x5cad('0x44')](handleError(_0x4794b2,null));};exports['destroy']=function(_0x2f6b05,_0x21d067){return db[_0x5cad('0x40')][_0x5cad('0x46')]({'where':{'id':_0x2f6b05[_0x5cad('0x4a')]['id']}})['then'](handleEntityNotFound(_0x21d067,null))[_0x5cad('0x26')](removeEntity(_0x21d067,null))['catch'](handleError(_0x21d067,null));};exports[_0x5cad('0x4b')]=function(_0x5e3cd9,_0x2e051c){return db[_0x5cad('0x40')][_0x5cad('0x25')]({'where':{'id':_0x5e3cd9['query'][_0x5cad('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x5cad('0x26')](respondWithResult(_0x2e051c,0xcc))[_0x5cad('0x44')](handleError(_0x2e051c,null));};exports[_0x5cad('0x4d')]=function(_0x10999d,_0xff8f75,_0xf7acdc){return db[_0x5cad('0x4e')][_0x5cad('0x4f')]({'where':{'id':_0x10999d[_0x5cad('0x4a')]['id']}})[_0x5cad('0x26')](handleEntityNotFound(_0xff8f75,null))[_0x5cad('0x26')](function(_0x23087a){if(_0x23087a){return db[_0x5cad('0x50')][_0x5cad('0x51')](function(_0x3f0420){return db[_0x5cad('0x40')]['destroy']({'where':{'CustomReportId':_0x10999d[_0x5cad('0x4a')]['id']},'transaction':_0x3f0420})[_0x5cad('0x26')](function(_0x4447be){var _0x47fdd5=_[_0x5cad('0x2c')](_0x10999d['body'],function(_0x5c66c9){delete _0x5c66c9['id'];_0x5c66c9[_0x5cad('0x52')]=_0x10999d[_0x5cad('0x4a')]['id'];return _0x5c66c9;});return db['AnalyticFieldReport'][_0x5cad('0x49')](_0x47fdd5,{'transaction':_0x3f0420});});})[_0x5cad('0x26')](function(){return db['AnalyticFieldReport'][_0x5cad('0x43')]({'where':{'CustomReportId':_0x10999d['params']['id']}});});}})[_0x5cad('0x26')](respondWithResult(_0xff8f75,null))[_0x5cad('0x44')](handleError(_0xff8f75,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index c462fdc..7a124b3 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 _0x7a7c=['exports','define','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a7c,0xf5));var _0xc7a7=function(_0x5685df,_0x2d90b1){_0x5685df=_0x5685df-0x0;var _0x598211=_0x7a7c[_0x5685df];return _0x598211;};'use strict';var _=require(_0xc7a7('0x0'));var util=require(_0xc7a7('0x1'));var logger=require(_0xc7a7('0x2'))(_0xc7a7('0x3'));var moment=require('moment');var BPromise=require(_0xc7a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7a7('0x5'));var rimraf=require(_0xc7a7('0x6'));var config=require(_0xc7a7('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0xc7a7('0x8')]=function(_0x3bb62b,_0x1f6fc4){return _0x3bb62b[_0xc7a7('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0xc7a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0906=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','util'];(function(_0x5d1534,_0x572c80){var _0x2f5871=function(_0x30fa2e){while(--_0x30fa2e){_0x5d1534['push'](_0x5d1534['shift']());}};_0x2f5871(++_0x572c80);}(_0x0906,0x8f));var _0x6090=function(_0x345d8c,_0x165e29){_0x345d8c=_0x345d8c-0x0;var _0x1bd35e=_0x0906[_0x345d8c];return _0x1bd35e;};'use strict';var _=require('lodash');var util=require(_0x6090('0x0'));var logger=require(_0x6090('0x1'))(_0x6090('0x2'));var moment=require(_0x6090('0x3'));var BPromise=require(_0x6090('0x4'));var rp=require(_0x6090('0x5'));var fs=require('fs');var path=require(_0x6090('0x6'));var rimraf=require('rimraf');var config=require(_0x6090('0x7'));var attributes=require(_0x6090('0x8'));module[_0x6090('0x9')]=function(_0x50d384,_0x55bfad){return _0x50d384[_0x6090('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x6090('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 bb2a851..8802c37 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 _0x017a=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5d897d,_0x8f648e){var _0x21a626=function(_0x43d4c9){while(--_0x43d4c9){_0x5d897d['push'](_0x5d897d['shift']());}};_0x21a626(++_0x8f648e);}(_0x017a,0x109));var _0xa017=function(_0x8dd49d,_0x44905f){_0x8dd49d=_0x8dd49d-0x0;var _0x9c74eb=_0x017a[_0x8dd49d];return _0x9c74eb;};'use strict';var _=require(_0xa017('0x0'));var util=require('util');var moment=require(_0xa017('0x1'));var BPromise=require(_0xa017('0x2'));var rs=require(_0xa017('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa017('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa017('0x5'))(_0xa017('0x6'));var config=require(_0xa017('0x7'));var jayson=require(_0xa017('0x8'));var client=jayson[_0xa017('0x9')][_0xa017('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d6701,_0x38fd91,_0x5b2eda){return new BPromise(function(_0x52f000,_0x4abacf){return client[_0xa017('0xb')](_0x2d6701,_0x5b2eda)['then'](function(_0x4e6559){logger[_0xa017('0xc')](_0xa017('0xd'),_0x38fd91,_0xa017('0xe'));logger['debug'](_0xa017('0xf'),_0x38fd91,_0xa017('0xe'),JSON[_0xa017('0x10')](_0x4e6559));if(_0x4e6559['error']){if(_0x4e6559[_0xa017('0x11')][_0xa017('0x12')]===0x1f4){logger[_0xa017('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x38fd91,_0x4e6559[_0xa017('0x11')][_0xa017('0x13')]);return _0x4abacf(_0x4e6559[_0xa017('0x11')][_0xa017('0x13')]);}logger['error'](_0xa017('0xd'),_0x38fd91,_0x4e6559[_0xa017('0x11')][_0xa017('0x13')]);return _0x52f000(_0x4e6559[_0xa017('0x11')][_0xa017('0x13')]);}else{logger[_0xa017('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x38fd91,_0xa017('0xe'));_0x52f000(_0x4e6559[_0xa017('0x14')][_0xa017('0x13')]);}})[_0xa017('0x15')](function(_0x55ed48){logger[_0xa017('0x11')](_0xa017('0xd'),_0x38fd91,_0x55ed48);_0x4abacf(_0x55ed48);});});} \ No newline at end of file +var _0x40dd=['../../mysqldb','../../config/logger','rpc','client','request','then','info','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x163f58,_0x1c8ae4){var _0x472ed9=function(_0xca7deb){while(--_0xca7deb){_0x163f58['push'](_0x163f58['shift']());}};_0x472ed9(++_0x1c8ae4);}(_0x40dd,0x1b2));var _0xd40d=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x40dd[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xd40d('0x0'));var util=require(_0xd40d('0x1'));var moment=require(_0xd40d('0x2'));var BPromise=require(_0xd40d('0x3'));var rs=require(_0xd40d('0x4'));var fs=require('fs');var Redis=require(_0xd40d('0x5'));var db=require(_0xd40d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd40d('0x7'))(_0xd40d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd40d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x756e3,_0x2000df,_0x53ffaa){return new BPromise(function(_0x2eb4ff,_0xe49b3e){return client[_0xd40d('0xa')](_0x756e3,_0x53ffaa)[_0xd40d('0xb')](function(_0x4338b6){logger[_0xd40d('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2000df,_0xd40d('0xd'));logger['debug'](_0xd40d('0xe'),_0x2000df,_0xd40d('0xd'),JSON['stringify'](_0x4338b6));if(_0x4338b6['error']){if(_0x4338b6[_0xd40d('0xf')][_0xd40d('0x10')]===0x1f4){logger['error'](_0xd40d('0x11'),_0x2000df,_0x4338b6[_0xd40d('0xf')][_0xd40d('0x12')]);return _0xe49b3e(_0x4338b6['error'][_0xd40d('0x12')]);}logger[_0xd40d('0xf')](_0xd40d('0x11'),_0x2000df,_0x4338b6[_0xd40d('0xf')][_0xd40d('0x12')]);return _0x2eb4ff(_0x4338b6['error'][_0xd40d('0x12')]);}else{logger['info'](_0xd40d('0x11'),_0x2000df,_0xd40d('0xd'));_0x2eb4ff(_0x4338b6[_0xd40d('0x13')][_0xd40d('0x12')]);}})['catch'](function(_0x3356b4){logger[_0xd40d('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2000df,_0x3356b4);_0xe49b3e(_0x3356b4);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 8be3023..7a38e02 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(_0x2654ec,_0x30d1ba){var _0x4c3b5=function(_0x464e80){while(--_0x464e80){_0x2654ec['push'](_0x2654ec['shift']());}};_0x4c3b5(++_0x30d1ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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(_0x412dae,_0x190e54){var _0x6bb6ad=function(_0x275d8f){while(--_0x275d8f){_0x412dae['push'](_0x412dae['shift']());}};_0x6bb6ad(++_0x190e54);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 a86cbc9..7dbbfa1 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 _0x1a83=['STRING','sequelize','exports'];(function(_0x2c4e32,_0x3a5590){var _0x1eac30=function(_0x236c8e){while(--_0x236c8e){_0x2c4e32['push'](_0x2c4e32['shift']());}};_0x1eac30(++_0x3a5590);}(_0x1a83,0x1c0));var _0x31a8=function(_0xf28cc5,_0x5a0cd2){_0xf28cc5=_0xf28cc5-0x0;var _0xd96383=_0x1a83[_0xf28cc5];return _0xd96383;};'use strict';var Sequelize=require(_0x31a8('0x0'));module[_0x31a8('0x1')]={'name':{'type':Sequelize[_0x31a8('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x31a8('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x31a8('0x2')]}}; \ No newline at end of file +var _0xe28e=['name','TEXT','sequelize','exports','STRING'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xe28e,0x1ba));var _0xee28=function(_0x13dbae,_0x3e2b24){_0x13dbae=_0x13dbae-0x0;var _0x201ddf=_0xe28e[_0x13dbae];return _0x201ddf;};'use strict';var Sequelize=require(_0xee28('0x0'));module[_0xee28('0x1')]={'name':{'type':Sequelize[_0xee28('0x2')],'allowNull':![],'unique':_0xee28('0x3')},'table':{'type':Sequelize[_0xee28('0x2')]},'metric':{'type':Sequelize[_0xee28('0x4')]},'description':{'type':Sequelize[_0xee28('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7506aa3..c3395d9 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 _0x9957=['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','Metrics','UserProfileResource','end','error','name','map','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticMetric','include','findAll','rawAttributes','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_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(){var _0x472195=_0x563799['get']({'plain':!![]});var _0x39df42=_0x7995('0x28');return db[_0x7995('0x29')][_0x7995('0x27')]({'where':{'type':_0x39df42,'resourceId':_0x472195['id']}})[_0x7995('0x26')](function(){return _0x563799;});})[_0x7995('0x26')](function(){_0x204507['status'](0xcc)[_0x7995('0x2a')]();});}};}function handleEntityNotFound(_0x5911c3,_0x229742){return function(_0x49bc7e){if(!_0x49bc7e){_0x5911c3[_0x7995('0x1b')](0x194);}return _0x49bc7e;};}function handleError(_0x132a42,_0x11c1eb){_0x11c1eb=_0x11c1eb||0x1f4;return function(_0x4b6f99){logger[_0x7995('0x2b')](_0x4b6f99['stack']);if(_0x4b6f99[_0x7995('0x2c')]){delete _0x4b6f99[_0x7995('0x2c')];}_0x132a42[_0x7995('0x1c')](_0x11c1eb)['send'](_0x4b6f99);};}exports['index']=function(_0x48e573,_0x3573be){var _0xe6b0b3={},_0x327a81={},_0x2b874d={'count':0x0,'rows':[]};var _0x2e3493=_[_0x7995('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0xfa8f15){return{'name':_0xfa8f15['fieldName'],'type':_0xfa8f15[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x327a81[_0x7995('0x30')]=_[_0x7995('0x2d')](_0x2e3493,_0x7995('0x2c'));_0x327a81['query']=_[_0x7995('0x31')](_0x48e573[_0x7995('0x32')]);_0x327a81['filters']=_['intersection'](_0x327a81['model'],_0x327a81[_0x7995('0x32')]);_0xe6b0b3[_0x7995('0x33')]=_['intersection'](_0x327a81[_0x7995('0x30')],qs['fields'](_0x48e573[_0x7995('0x32')][_0x7995('0x34')]));_0xe6b0b3[_0x7995('0x33')]=_0xe6b0b3['attributes']['length']?_0xe6b0b3[_0x7995('0x33')]:_0x327a81['model'];if(!_0x48e573['query'][_0x7995('0x35')](_0x7995('0x36'))){_0xe6b0b3['limit']=qs[_0x7995('0x21')](_0x48e573[_0x7995('0x32')][_0x7995('0x21')]);_0xe6b0b3[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x48e573['query'][_0x7995('0x20')]);}_0xe6b0b3[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x48e573[_0x7995('0x32')]['sort']);_0xe6b0b3[_0x7995('0x39')]=qs[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x48e573[_0x7995('0x32')],_0x327a81[_0x7995('0x3a')]),_0x2e3493);if(_0x48e573[_0x7995('0x32')]['filter']){_0xe6b0b3[_0x7995('0x39')]=_[_0x7995('0x3c')](_0xe6b0b3[_0x7995('0x39')],{'$or':_[_0x7995('0x2d')](_0x2e3493,function(_0x2e04cd){if(_0x2e04cd[_0x7995('0x2e')]!==_0x7995('0x3d')){var _0x270c0e={};_0x270c0e[_0x2e04cd[_0x7995('0x2c')]]={'$like':'%'+_0x48e573[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x270c0e;}})});}_0xe6b0b3=_[_0x7995('0x3c')]({},_0xe6b0b3,_0x48e573[_0x7995('0x3f')]);var _0x53cda2={'where':_0xe6b0b3['where']};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x53cda2)['then'](function(_0x4b0855){_0x2b874d[_0x7995('0x1f')]=_0x4b0855;if(_0x48e573['query']['includeAll']){_0xe6b0b3[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x42')](_0xe6b0b3);})['then'](function(_0x46ac4f){_0x2b874d['rows']=_0x46ac4f;return _0x2b874d;})[_0x7995('0x26')](respondWithFilteredResult(_0x3573be,_0xe6b0b3))['catch'](handleError(_0x3573be,null));};exports['show']=function(_0x39c5b8,_0x403f54){var _0xc04e5={'raw':!![],'where':{'id':_0x39c5b8['params']['id']}},_0x3f1c35={};_0x3f1c35[_0x7995('0x30')]=_[_0x7995('0x31')](db[_0x7995('0x40')][_0x7995('0x43')]);_0x3f1c35['query']=_['keys'](_0x39c5b8[_0x7995('0x32')]);_0x3f1c35['filters']=_[_0x7995('0x44')](_0x3f1c35['model'],_0x3f1c35[_0x7995('0x32')]);_0xc04e5['attributes']=_[_0x7995('0x44')](_0x3f1c35[_0x7995('0x30')],qs['fields'](_0x39c5b8[_0x7995('0x32')][_0x7995('0x34')]));_0xc04e5[_0x7995('0x33')]=_0xc04e5[_0x7995('0x33')]['length']?_0xc04e5[_0x7995('0x33')]:_0x3f1c35[_0x7995('0x30')];if(_0x39c5b8[_0x7995('0x32')]['includeAll']){_0xc04e5[_0x7995('0x41')]=[{'all':!![]}];}_0xc04e5=_[_0x7995('0x3c')]({},_0xc04e5,_0x39c5b8[_0x7995('0x3f')]);return db[_0x7995('0x40')][_0x7995('0x45')](_0xc04e5)['then'](handleEntityNotFound(_0x403f54,null))[_0x7995('0x26')](respondWithResult(_0x403f54,null))[_0x7995('0x46')](handleError(_0x403f54,null));};exports['create']=function(_0x3d1dbb,_0x5843ba){return db[_0x7995('0x40')][_0x7995('0x47')](_0x3d1dbb[_0x7995('0x48')],{})[_0x7995('0x26')](function(_0xddf537){var _0x14b537=_0x3d1dbb[_0x7995('0x49')]['get']({'plain':!![]});if(!_0x14b537)throw new Error(_0x7995('0x4a'));if(_0x14b537[_0x7995('0x4b')]===_0x7995('0x49')){var _0x4ffc8a=_0xddf537[_0x7995('0x4c')]({'plain':!![]});var _0x1fe77e=_0x7995('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1fe77e,'userProfileId':_0x14b537['userProfileId']},'raw':!![]})[_0x7995('0x26')](function(_0x1fd1ca){if(_0x1fd1ca&&_0x1fd1ca['autoAssociation']===0x0){return db[_0x7995('0x29')][_0x7995('0x47')]({'name':_0x4ffc8a[_0x7995('0x2c')],'resourceId':_0x4ffc8a['id'],'type':_0x1fd1ca[_0x7995('0x2c')],'sectionId':_0x1fd1ca['id']},{})[_0x7995('0x26')](function(){return _0xddf537;});}else{return _0xddf537;}})['catch'](function(_0x29ee32){logger['error'](_0x7995('0x4d'),_0x29ee32);throw _0x29ee32;});}return _0xddf537;})[_0x7995('0x26')](respondWithResult(_0x5843ba,0xc9))[_0x7995('0x46')](handleError(_0x5843ba,null));};exports['update']=function(_0x5e1f34,_0x54e2b1){if(_0x5e1f34['body']['id']){delete _0x5e1f34[_0x7995('0x48')]['id'];}return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0x5e1f34[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x54e2b1,null))[_0x7995('0x26')](saveUpdates(_0x5e1f34[_0x7995('0x48')],null))[_0x7995('0x26')](respondWithResult(_0x54e2b1,null))[_0x7995('0x46')](handleError(_0x54e2b1,null));};exports[_0x7995('0x27')]=function(_0xa7af8c,_0x133c63){return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0xa7af8c[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x133c63,null))[_0x7995('0x26')](removeEntity(_0x133c63,null))[_0x7995('0x46')](handleError(_0x133c63,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Metrics','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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(_0x1e9c76,_0x4b0ef4){var _0x52ce7e=function(_0x251de9){while(--_0x251de9){_0x1e9c76['push'](_0x1e9c76['shift']());}};_0x52ce7e(++_0x4b0ef4);}(_0x98a8,0x12c));var _0x898a=function(_0x3730c0,_0x5545ed){_0x3730c0=_0x3730c0-0x0;var _0x54b5d5=_0x98a8[_0x3730c0];return _0x54b5d5;};'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'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){var _0x32eca5=_0x274cdf[_0x898a('0x25')]({'plain':!![]});var _0x1426e3='Metrics';return db[_0x898a('0x26')]['destroy']({'where':{'type':_0x1426e3,'resourceId':_0x32eca5['id']}})['then'](function(){return _0x274cdf;});})['then'](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x420b25,_0x40b3db){return function(_0x28ae6a){if(!_0x28ae6a){_0x420b25[_0x898a('0x27')](0x194);}return _0x28ae6a;};}function handleError(_0x398e98,_0xac1fc4){_0xac1fc4=_0xac1fc4||0x1f4;return function(_0xd31922){logger['error'](_0xd31922['stack']);if(_0xd31922['name']){delete _0xd31922[_0x898a('0x28')];}_0x398e98[_0x898a('0x1a')](_0xac1fc4)[_0x898a('0x29')](_0xd31922);};}exports[_0x898a('0x2a')]=function(_0x34f447,_0x560000){var _0xe3c983={},_0xf74645={},_0x18773a={'count':0x0,'rows':[]};var _0x4287da=_[_0x898a('0x2b')](db[_0x898a('0x2c')]['rawAttributes'],function(_0x7a1eb5){return{'name':_0x7a1eb5[_0x898a('0x2d')],'type':_0x7a1eb5[_0x898a('0x2e')][_0x898a('0x2f')]};});_0xf74645[_0x898a('0x30')]=_['map'](_0x4287da,'name');_0xf74645[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34f447[_0x898a('0x31')]);_0xf74645['filters']=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],_0xf74645[_0x898a('0x31')]);_0xe3c983[_0x898a('0x34')]=_[_0x898a('0x33')](_0xf74645[_0x898a('0x30')],qs[_0x898a('0x35')](_0x34f447[_0x898a('0x31')]['fields']));_0xe3c983[_0x898a('0x34')]=_0xe3c983['attributes']['length']?_0xe3c983[_0x898a('0x34')]:_0xf74645['model'];if(!_0x34f447[_0x898a('0x31')]['hasOwnProperty'](_0x898a('0x36'))){_0xe3c983['limit']=qs[_0x898a('0x37')](_0x34f447[_0x898a('0x31')][_0x898a('0x37')]);_0xe3c983['offset']=qs['offset'](_0x34f447['query'][_0x898a('0x1e')]);}_0xe3c983[_0x898a('0x38')]=qs['sort'](_0x34f447[_0x898a('0x31')][_0x898a('0x39')]);_0xe3c983[_0x898a('0x3a')]=qs[_0x898a('0x3b')](_['pick'](_0x34f447['query'],_0xf74645[_0x898a('0x3b')]),_0x4287da);if(_0x34f447[_0x898a('0x31')]['filter']){_0xe3c983['where']=_[_0x898a('0x3c')](_0xe3c983[_0x898a('0x3a')],{'$or':_[_0x898a('0x2b')](_0x4287da,function(_0xa45405){if(_0xa45405['type']!==_0x898a('0x3d')){var _0x369c02={};_0x369c02[_0xa45405['name']]={'$like':'%'+_0x34f447['query']['filter']+'%'};return _0x369c02;}})});}_0xe3c983=_[_0x898a('0x3c')]({},_0xe3c983,_0x34f447[_0x898a('0x3e')]);var _0x35d767={'where':_0xe3c983[_0x898a('0x3a')]};return db[_0x898a('0x2c')][_0x898a('0x1d')](_0x35d767)[_0x898a('0x23')](function(_0x1432ec){_0x18773a[_0x898a('0x1d')]=_0x1432ec;if(_0x34f447[_0x898a('0x31')][_0x898a('0x3f')]){_0xe3c983[_0x898a('0x40')]=[{'all':!![]}];}return db[_0x898a('0x2c')][_0x898a('0x41')](_0xe3c983);})[_0x898a('0x23')](function(_0x4c8628){_0x18773a[_0x898a('0x42')]=_0x4c8628;return _0x18773a;})[_0x898a('0x23')](respondWithFilteredResult(_0x560000,_0xe3c983))[_0x898a('0x43')](handleError(_0x560000,null));};exports['show']=function(_0x34029e,_0x2e5451){var _0x3a8663={'raw':!![],'where':{'id':_0x34029e[_0x898a('0x44')]['id']}},_0x6ab441={};_0x6ab441[_0x898a('0x30')]=_[_0x898a('0x32')](db[_0x898a('0x2c')]['rawAttributes']);_0x6ab441[_0x898a('0x31')]=_[_0x898a('0x32')](_0x34029e[_0x898a('0x31')]);_0x6ab441[_0x898a('0x3b')]=_['intersection'](_0x6ab441[_0x898a('0x30')],_0x6ab441[_0x898a('0x31')]);_0x3a8663['attributes']=_[_0x898a('0x33')](_0x6ab441['model'],qs[_0x898a('0x35')](_0x34029e['query']['fields']));_0x3a8663[_0x898a('0x34')]=_0x3a8663['attributes'][_0x898a('0x45')]?_0x3a8663[_0x898a('0x34')]:_0x6ab441['model'];if(_0x34029e[_0x898a('0x31')][_0x898a('0x3f')]){_0x3a8663['include']=[{'all':!![]}];}_0x3a8663=_[_0x898a('0x3c')]({},_0x3a8663,_0x34029e[_0x898a('0x3e')]);return db[_0x898a('0x2c')][_0x898a('0x46')](_0x3a8663)['then'](handleEntityNotFound(_0x2e5451,null))[_0x898a('0x23')](respondWithResult(_0x2e5451,null))[_0x898a('0x43')](handleError(_0x2e5451,null));};exports['create']=function(_0x25adcc,_0x1d8c16){return db['AnalyticMetric'][_0x898a('0x47')](_0x25adcc['body'],{})[_0x898a('0x23')](function(_0x41f291){var _0x32ccb9=_0x25adcc['user'][_0x898a('0x25')]({'plain':!![]});if(!_0x32ccb9)throw new Error(_0x898a('0x48'));if(_0x32ccb9[_0x898a('0x49')]===_0x898a('0x4a')){var _0x5a8a2c=_0x41f291[_0x898a('0x25')]({'plain':!![]});var _0x529d7c=_0x898a('0x4b');return db[_0x898a('0x4c')][_0x898a('0x46')]({'where':{'name':_0x529d7c,'userProfileId':_0x32ccb9['userProfileId']},'raw':!![]})[_0x898a('0x23')](function(_0x3c4db0){if(_0x3c4db0&&_0x3c4db0[_0x898a('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a8a2c[_0x898a('0x28')],'resourceId':_0x5a8a2c['id'],'type':_0x3c4db0[_0x898a('0x28')],'sectionId':_0x3c4db0['id']},{})[_0x898a('0x23')](function(){return _0x41f291;});}else{return _0x41f291;}})[_0x898a('0x43')](function(_0x28b8c9){logger[_0x898a('0x4e')](_0x898a('0x4f'),_0x28b8c9);throw _0x28b8c9;});}return _0x41f291;})[_0x898a('0x23')](respondWithResult(_0x1d8c16,0xc9))[_0x898a('0x43')](handleError(_0x1d8c16,null));};exports[_0x898a('0x22')]=function(_0x2382a9,_0x5e9329){if(_0x2382a9[_0x898a('0x50')]['id']){delete _0x2382a9[_0x898a('0x50')]['id'];}return db['AnalyticMetric'][_0x898a('0x46')]({'where':{'id':_0x2382a9['params']['id']}})['then'](handleEntityNotFound(_0x5e9329,null))[_0x898a('0x23')](saveUpdates(_0x2382a9[_0x898a('0x50')],null))[_0x898a('0x23')](respondWithResult(_0x5e9329,null))['catch'](handleError(_0x5e9329,null));};exports['destroy']=function(_0x11a07a,_0x1f5e4b){return db['AnalyticMetric'][_0x898a('0x46')]({'where':{'id':_0x11a07a[_0x898a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f5e4b,null))[_0x898a('0x23')](removeEntity(_0x1f5e4b,null))[_0x898a('0x43')](handleError(_0x1f5e4b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 12dad25..7cb7869 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 _0x5419=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment'];(function(_0x1fb471,_0x5904f9){var _0x3b1354=function(_0x4dc5ef){while(--_0x4dc5ef){_0x1fb471['push'](_0x1fb471['shift']());}};_0x3b1354(++_0x5904f9);}(_0x5419,0x175));var _0x9541=function(_0x21bf3e,_0x82e5f2){_0x21bf3e=_0x21bf3e-0x0;var _0x3fdb5a=_0x5419[_0x21bf3e];return _0x3fdb5a;};'use strict';var _=require(_0x9541('0x0'));var util=require(_0x9541('0x1'));var logger=require(_0x9541('0x2'))(_0x9541('0x3'));var moment=require(_0x9541('0x4'));var BPromise=require(_0x9541('0x5'));var rp=require(_0x9541('0x6'));var fs=require('fs');var path=require(_0x9541('0x7'));var rimraf=require(_0x9541('0x8'));var config=require(_0x9541('0x9'));var attributes=require('./analyticMetric.attributes');module[_0x9541('0xa')]=function(_0x1f9139,_0xbdabaf){return _0x1f9139[_0x9541('0xb')](_0x9541('0xc'),attributes,{'tableName':_0x9541('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d7e=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x7f3667,_0x30c3f1){var _0x2c4c24=function(_0xf070f3){while(--_0xf070f3){_0x7f3667['push'](_0x7f3667['shift']());}};_0x2c4c24(++_0x30c3f1);}(_0x1d7e,0x7d));var _0xe1d7=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x1d7e[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0xe1d7('0x0'));var logger=require(_0xe1d7('0x1'))(_0xe1d7('0x2'));var moment=require('moment');var BPromise=require(_0xe1d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1d7('0x4'));var rimraf=require(_0xe1d7('0x5'));var config=require(_0xe1d7('0x6'));var attributes=require(_0xe1d7('0x7'));module[_0xe1d7('0x8')]=function(_0x4058fe,_0x252026){return _0x4058fe[_0xe1d7('0x9')](_0xe1d7('0xa'),attributes,{'tableName':_0xe1d7('0xb'),'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 0f8c5c1..971f6b3 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 _0x8162=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x11384d,_0x3294b4){var _0x4694f0=function(_0x876213){while(--_0x876213){_0x11384d['push'](_0x11384d['shift']());}};_0x4694f0(++_0x3294b4);}(_0x8162,0xb5));var _0x2816=function(_0x1fac98,_0x3a615e){_0x1fac98=_0x1fac98-0x0;var _0x56dfff=_0x8162[_0x1fac98];return _0x56dfff;};'use strict';var _=require(_0x2816('0x0'));var util=require(_0x2816('0x1'));var moment=require(_0x2816('0x2'));var BPromise=require(_0x2816('0x3'));var rs=require(_0x2816('0x4'));var fs=require('fs');var Redis=require(_0x2816('0x5'));var db=require(_0x2816('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2816('0x7'))(_0x2816('0x8'));var config=require(_0x2816('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2816('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x274cee,_0x58c25c,_0x281757){return new BPromise(function(_0x573575,_0xb6f04f){return client[_0x2816('0xb')](_0x274cee,_0x281757)['then'](function(_0x12ac32){logger[_0x2816('0xc')](_0x2816('0xd'),_0x58c25c,_0x2816('0xe'));logger[_0x2816('0xf')](_0x2816('0x10'),_0x58c25c,_0x2816('0xe'),JSON[_0x2816('0x11')](_0x12ac32));if(_0x12ac32[_0x2816('0x12')]){if(_0x12ac32[_0x2816('0x12')][_0x2816('0x13')]===0x1f4){logger['error'](_0x2816('0xd'),_0x58c25c,_0x12ac32[_0x2816('0x12')][_0x2816('0x14')]);return _0xb6f04f(_0x12ac32['error'][_0x2816('0x14')]);}logger['error'](_0x2816('0xd'),_0x58c25c,_0x12ac32[_0x2816('0x12')][_0x2816('0x14')]);return _0x573575(_0x12ac32['error']['message']);}else{logger[_0x2816('0xc')](_0x2816('0xd'),_0x58c25c,_0x2816('0xe'));_0x573575(_0x12ac32[_0x2816('0x15')]['message']);}})[_0x2816('0x16')](function(_0x5be4a3){logger['error'](_0x2816('0xd'),_0x58c25c,_0x5be4a3);_0xb6f04f(_0x5be4a3);});});} \ No newline at end of file +var _0x49df=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','request','AnalyticMetric,\x20%s,\x20%s'];(function(_0x5c5127,_0x4ee5af){var _0x4f34dc=function(_0x48122c){while(--_0x48122c){_0x5c5127['push'](_0x5c5127['shift']());}};_0x4f34dc(++_0x4ee5af);}(_0x49df,0x18e));var _0xf49d=function(_0x5bfaa7,_0x404773){_0x5bfaa7=_0x5bfaa7-0x0;var _0xe1b1a3=_0x49df[_0x5bfaa7];return _0xe1b1a3;};'use strict';var _=require(_0xf49d('0x0'));var util=require('util');var moment=require(_0xf49d('0x1'));var BPromise=require(_0xf49d('0x2'));var rs=require(_0xf49d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf49d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf49d('0x5'));var config=require(_0xf49d('0x6'));var jayson=require(_0xf49d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3969c3,_0x320c60,_0x39257c){return new BPromise(function(_0x302f36,_0x521a72){return client[_0xf49d('0x8')](_0x3969c3,_0x39257c)['then'](function(_0x43794d){logger['info'](_0xf49d('0x9'),_0x320c60,'request\x20sent');logger[_0xf49d('0xa')](_0xf49d('0xb'),_0x320c60,_0xf49d('0xc'),JSON['stringify'](_0x43794d));if(_0x43794d[_0xf49d('0xd')]){if(_0x43794d[_0xf49d('0xd')][_0xf49d('0xe')]===0x1f4){logger['error'](_0xf49d('0x9'),_0x320c60,_0x43794d[_0xf49d('0xd')][_0xf49d('0xf')]);return _0x521a72(_0x43794d[_0xf49d('0xd')][_0xf49d('0xf')]);}logger['error'](_0xf49d('0x9'),_0x320c60,_0x43794d[_0xf49d('0xd')]['message']);return _0x302f36(_0x43794d[_0xf49d('0xd')][_0xf49d('0xf')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x320c60,_0xf49d('0xc'));_0x302f36(_0x43794d['result'][_0xf49d('0xf')]);}})[_0xf49d('0x10')](function(_0x288556){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x320c60,_0x288556);_0x521a72(_0x288556);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index edf382e..240160a 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 _0xafa5=['./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5c59f0,_0x222e3d){var _0x1c87e8=function(_0x5ecba3){while(--_0x5ecba3){_0x5c59f0['push'](_0x5c59f0['shift']());}};_0x1c87e8(++_0x222e3d);}(_0xafa5,0x1af));var _0x5afa=function(_0x30e70e,_0x72c846){_0x30e70e=_0x30e70e-0x0;var _0x4a047d=_0xafa5[_0x30e70e];return _0x4a047d;};'use strict';var multer=require('multer');var util=require(_0x5afa('0x0'));var path=require(_0x5afa('0x1'));var timeout=require(_0x5afa('0x2'));var express=require(_0x5afa('0x3'));var router=express[_0x5afa('0x4')]();var fs_extra=require(_0x5afa('0x5'));var auth=require(_0x5afa('0x6'));var interaction=require(_0x5afa('0x7'));var config=require(_0x5afa('0x8'));var controller=require(_0x5afa('0x9'));router[_0x5afa('0xa')]('/',auth['isAuthenticated'](),controller[_0x5afa('0xb')]);router[_0x5afa('0xa')](_0x5afa('0xc'),auth[_0x5afa('0xd')](),controller[_0x5afa('0xe')]);router[_0x5afa('0xf')]('/',auth[_0x5afa('0xd')](),controller[_0x5afa('0x10')]);router[_0x5afa('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5afa('0x12')]);router[_0x5afa('0x13')](_0x5afa('0xc'),auth[_0x5afa('0xd')](),controller[_0x5afa('0x14')]);module[_0x5afa('0x15')]=router; \ No newline at end of file +var _0xd9c8=['post','isAuthenticated','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd9c8[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0x8d9c('0x0'));var util=require(_0x8d9c('0x1'));var path=require('path');var timeout=require(_0x8d9c('0x2'));var express=require(_0x8d9c('0x3'));var router=express[_0x8d9c('0x4')]();var fs_extra=require(_0x8d9c('0x5'));var auth=require(_0x8d9c('0x6'));var interaction=require(_0x8d9c('0x7'));var config=require(_0x8d9c('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8d9c('0x9')]);router[_0x8d9c('0xa')](_0x8d9c('0xb'),auth['isAuthenticated'](),controller[_0x8d9c('0xc')]);router[_0x8d9c('0xd')]('/',auth[_0x8d9c('0xe')](),controller[_0x8d9c('0xf')]);router[_0x8d9c('0x10')](_0x8d9c('0xb'),auth[_0x8d9c('0xe')](),controller[_0x8d9c('0x11')]);router['delete'](_0x8d9c('0xb'),auth['isAuthenticated'](),controller[_0x8d9c('0x12')]);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 1fb0e6f..4fda9b2 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 _0x9726=['TEXT','sequelize'];(function(_0x4a80b7,_0x2b4239){var _0x23d634=function(_0x4383bd){while(--_0x4383bd){_0x4a80b7['push'](_0x4a80b7['shift']());}};_0x23d634(++_0x2b4239);}(_0x9726,0x177));var _0x6972=function(_0x7fcb0f,_0x2a5852){_0x7fcb0f=_0x7fcb0f-0x0;var _0x84ff73=_0x9726[_0x7fcb0f];return _0x84ff73;};'use strict';var Sequelize=require(_0x6972('0x0'));module['exports']={'tree':{'type':Sequelize[_0x6972('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8323=['TEXT','sequelize','exports'];(function(_0x4cda60,_0x2e72ec){var _0x6b531f=function(_0x327f09){while(--_0x327f09){_0x4cda60['push'](_0x4cda60['shift']());}};_0x6b531f(++_0x2e72ec);}(_0x8323,0xe5));var _0x3832=function(_0x8e9fc3,_0x46ecac){_0x8e9fc3=_0x8e9fc3-0x0;var _0x46e02d=_0x8323[_0x8e9fc3];return _0x46e02d;};'use strict';var Sequelize=require(_0x3832('0x0'));module[_0x3832('0x1')]={'tree':{'type':Sequelize[_0x3832('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 c8445d0..7f6136b 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 _0xc425=['mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','AnalyticTreeReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x555ee4,_0x3ae4ae){var _0x5b3a5e=function(_0x4996ed){while(--_0x4996ed){_0x555ee4['push'](_0x555ee4['shift']());}};_0x5b3a5e(++_0x3ae4ae);}(_0xc425,0x11e));var _0x5c42=function(_0x137557,_0x29eb2b){_0x137557=_0x137557-0x0;var _0x4d1908=_0xc425[_0x137557];return _0x4d1908;};'use strict';var emlformat=require(_0x5c42('0x0'));var rimraf=require(_0x5c42('0x1'));var zipdir=require(_0x5c42('0x2'));var jsonpatch=require(_0x5c42('0x3'));var rp=require(_0x5c42('0x4'));var moment=require(_0x5c42('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5c42('0x6'));var util=require(_0x5c42('0x7'));var path=require(_0x5c42('0x8'));var sox=require(_0x5c42('0x9'));var csv=require(_0x5c42('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c42('0xb'));var _=require('lodash');var squel=require(_0x5c42('0xc'));var crypto=require('crypto');var jsforce=require(_0x5c42('0xd'));var deskjs=require(_0x5c42('0xe'));var toCsv=require(_0x5c42('0xa'));var querystring=require(_0x5c42('0xf'));var Papa=require(_0x5c42('0x10'));var Redis=require('ioredis');var authService=require(_0x5c42('0x11'));var qs=require(_0x5c42('0x12'));var as=require(_0x5c42('0x13'));var hardwareService=require(_0x5c42('0x14'));var logger=require(_0x5c42('0x15'))('api');var utils=require(_0x5c42('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5c42('0x17'))['db'];function respondWithStatusCode(_0x2c1f93,_0x53482f){_0x53482f=_0x53482f||0xcc;return function(_0x492e44){if(_0x492e44){return _0x2c1f93['sendStatus'](_0x53482f);}return _0x2c1f93[_0x5c42('0x18')](_0x53482f)[_0x5c42('0x19')]();};}function respondWithResult(_0x374b9f,_0x11ff81){_0x11ff81=_0x11ff81||0xc8;return function(_0x217c96){if(_0x217c96){return _0x374b9f[_0x5c42('0x18')](_0x11ff81)[_0x5c42('0x1a')](_0x217c96);}};}function respondWithFilteredResult(_0x1e120c,_0x3c62b9){return function(_0x1522e1){if(_0x1522e1){var _0x5f583f=typeof _0x3c62b9[_0x5c42('0x1b')]===_0x5c42('0x1c')&&typeof _0x3c62b9[_0x5c42('0x1d')]===_0x5c42('0x1c');var _0x30408b=_0x1522e1[_0x5c42('0x1e')];var _0x5c3e63=_0x5f583f?0x0:_0x3c62b9[_0x5c42('0x1b')];var _0x405665=_0x5f583f?_0x1522e1[_0x5c42('0x1e')]:_0x3c62b9[_0x5c42('0x1b')]+_0x3c62b9[_0x5c42('0x1d')];var _0x2c47b3;if(_0x405665>=_0x30408b){_0x405665=_0x30408b;_0x2c47b3=0xc8;}else{_0x2c47b3=0xce;}_0x1e120c[_0x5c42('0x18')](_0x2c47b3);return _0x1e120c[_0x5c42('0x1f')]('Content-Range',_0x5c3e63+'-'+_0x405665+'/'+_0x30408b)['json'](_0x1522e1);}return null;};}function patchUpdates(_0xb7bd3c){return function(_0xf5bc22){try{jsonpatch[_0x5c42('0x20')](_0xf5bc22,_0xb7bd3c,!![]);}catch(_0x3bc1b9){return BPromise[_0x5c42('0x21')](_0x3bc1b9);}return _0xf5bc22[_0x5c42('0x22')]();};}function saveUpdates(_0x126274,_0xeff789){return function(_0x1dd10f){if(_0x1dd10f){return _0x1dd10f[_0x5c42('0x23')](_0x126274)[_0x5c42('0x24')](function(_0x162ce0){return _0x162ce0;});}return null;};}function removeEntity(_0x38095b,_0x1a1568){return function(_0x575ff0){if(_0x575ff0){return _0x575ff0[_0x5c42('0x25')]()[_0x5c42('0x24')](function(){_0x38095b['status'](0xcc)[_0x5c42('0x19')]();});}};}function handleEntityNotFound(_0x546988,_0x155983){return function(_0x490bc8){if(!_0x490bc8){_0x546988[_0x5c42('0x26')](0x194);}return _0x490bc8;};}function handleError(_0x1a4e43,_0x4f4f3a){_0x4f4f3a=_0x4f4f3a||0x1f4;return function(_0x405d6c){logger['error'](_0x405d6c[_0x5c42('0x27')]);if(_0x405d6c['name']){delete _0x405d6c[_0x5c42('0x28')];}_0x1a4e43[_0x5c42('0x18')](_0x4f4f3a)[_0x5c42('0x29')](_0x405d6c);};}exports[_0x5c42('0x2a')]=function(_0x48bb4f,_0x15e09e){var _0x108f1a={},_0x4d4a9d={},_0x41bebe={'count':0x0,'rows':[]};var _0x1ef65c=_[_0x5c42('0x2b')](db['AnalyticTreeReport'][_0x5c42('0x2c')],function(_0x161d18){return{'name':_0x161d18[_0x5c42('0x2d')],'type':_0x161d18['type']['key']};});_0x4d4a9d[_0x5c42('0x2e')]=_['map'](_0x1ef65c,_0x5c42('0x28'));_0x4d4a9d[_0x5c42('0x2f')]=_[_0x5c42('0x30')](_0x48bb4f[_0x5c42('0x2f')]);_0x4d4a9d[_0x5c42('0x31')]=_[_0x5c42('0x32')](_0x4d4a9d[_0x5c42('0x2e')],_0x4d4a9d[_0x5c42('0x2f')]);_0x108f1a[_0x5c42('0x33')]=_[_0x5c42('0x32')](_0x4d4a9d[_0x5c42('0x2e')],qs[_0x5c42('0x34')](_0x48bb4f['query'][_0x5c42('0x34')]));_0x108f1a['attributes']=_0x108f1a[_0x5c42('0x33')]['length']?_0x108f1a['attributes']:_0x4d4a9d['model'];if(!_0x48bb4f[_0x5c42('0x2f')][_0x5c42('0x35')](_0x5c42('0x36'))){_0x108f1a[_0x5c42('0x1d')]=qs[_0x5c42('0x1d')](_0x48bb4f['query'][_0x5c42('0x1d')]);_0x108f1a['offset']=qs[_0x5c42('0x1b')](_0x48bb4f[_0x5c42('0x2f')][_0x5c42('0x1b')]);}_0x108f1a['order']=qs[_0x5c42('0x37')](_0x48bb4f[_0x5c42('0x2f')][_0x5c42('0x37')]);_0x108f1a[_0x5c42('0x38')]=qs[_0x5c42('0x31')](_['pick'](_0x48bb4f['query'],_0x4d4a9d[_0x5c42('0x31')]),_0x1ef65c);if(_0x48bb4f['query']['filter']){_0x108f1a[_0x5c42('0x38')]=_[_0x5c42('0x39')](_0x108f1a[_0x5c42('0x38')],{'$or':_[_0x5c42('0x2b')](_0x1ef65c,function(_0x3b00c6){if(_0x3b00c6[_0x5c42('0x3a')]!==_0x5c42('0x3b')){var _0x3baa8b={};_0x3baa8b[_0x3b00c6[_0x5c42('0x28')]]={'$like':'%'+_0x48bb4f[_0x5c42('0x2f')][_0x5c42('0x3c')]+'%'};return _0x3baa8b;}})});}_0x108f1a=_[_0x5c42('0x39')]({},_0x108f1a,_0x48bb4f[_0x5c42('0x3d')]);var _0x4a053f={'where':_0x108f1a[_0x5c42('0x38')]};return db[_0x5c42('0x3e')]['count'](_0x4a053f)[_0x5c42('0x24')](function(_0x2b6088){_0x41bebe['count']=_0x2b6088;if(_0x48bb4f[_0x5c42('0x2f')][_0x5c42('0x3f')]){_0x108f1a[_0x5c42('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x5c42('0x41')](_0x108f1a);})['then'](function(_0x17c706){_0x41bebe[_0x5c42('0x42')]=_0x17c706;return _0x41bebe;})[_0x5c42('0x24')](respondWithFilteredResult(_0x15e09e,_0x108f1a))['catch'](handleError(_0x15e09e,null));};exports[_0x5c42('0x43')]=function(_0x3c8a9b,_0x1658cb){var _0x8e9afd={'raw':!![],'where':{'id':_0x3c8a9b[_0x5c42('0x44')]['id']}},_0x4b5847={};_0x4b5847[_0x5c42('0x2e')]=_[_0x5c42('0x30')](db['AnalyticTreeReport'][_0x5c42('0x2c')]);_0x4b5847[_0x5c42('0x2f')]=_[_0x5c42('0x30')](_0x3c8a9b['query']);_0x4b5847['filters']=_[_0x5c42('0x32')](_0x4b5847[_0x5c42('0x2e')],_0x4b5847[_0x5c42('0x2f')]);_0x8e9afd[_0x5c42('0x33')]=_['intersection'](_0x4b5847[_0x5c42('0x2e')],qs[_0x5c42('0x34')](_0x3c8a9b[_0x5c42('0x2f')]['fields']));_0x8e9afd[_0x5c42('0x33')]=_0x8e9afd[_0x5c42('0x33')]['length']?_0x8e9afd['attributes']:_0x4b5847[_0x5c42('0x2e')];if(_0x3c8a9b[_0x5c42('0x2f')][_0x5c42('0x3f')]){_0x8e9afd['include']=[{'all':!![]}];}_0x8e9afd=_[_0x5c42('0x39')]({},_0x8e9afd,_0x3c8a9b['options']);return db[_0x5c42('0x3e')][_0x5c42('0x45')](_0x8e9afd)[_0x5c42('0x24')](handleEntityNotFound(_0x1658cb,null))[_0x5c42('0x24')](respondWithResult(_0x1658cb,null))[_0x5c42('0x46')](handleError(_0x1658cb,null));};exports[_0x5c42('0x47')]=function(_0x436016,_0x37658b){return db[_0x5c42('0x3e')][_0x5c42('0x47')](_0x436016['body'],{})[_0x5c42('0x24')](respondWithResult(_0x37658b,0xc9))['catch'](handleError(_0x37658b,null));};exports[_0x5c42('0x23')]=function(_0x18df3a,_0x4a73d0){if(_0x18df3a['body']['id']){delete _0x18df3a[_0x5c42('0x48')]['id'];}return db[_0x5c42('0x3e')][_0x5c42('0x45')]({'where':{'id':_0x18df3a['params']['id']}})[_0x5c42('0x24')](handleEntityNotFound(_0x4a73d0,null))[_0x5c42('0x24')](saveUpdates(_0x18df3a[_0x5c42('0x48')],null))[_0x5c42('0x24')](respondWithResult(_0x4a73d0,null))['catch'](handleError(_0x4a73d0,null));};exports[_0x5c42('0x25')]=function(_0x41d4c1,_0x890e6a){return db['AnalyticTreeReport']['find']({'where':{'id':_0x41d4c1['params']['id']}})[_0x5c42('0x24')](handleEntityNotFound(_0x890e6a,null))[_0x5c42('0x24')](removeEntity(_0x890e6a,null))[_0x5c42('0x46')](handleError(_0x890e6a,null));}; \ No newline at end of file +var _0xa18d=['moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','query','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','params','keys','rawAttributes','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2f249f,_0x511d6d){var _0x3ba98f=function(_0x495c3e){while(--_0x495c3e){_0x2f249f['push'](_0x2f249f['shift']());}};_0x3ba98f(++_0x511d6d);}(_0xa18d,0xd6));var _0xda18=function(_0x44fa6f,_0x5dec12){_0x44fa6f=_0x44fa6f-0x0;var _0xbbabd7=_0xa18d[_0x44fa6f];return _0xbbabd7;};'use strict';var emlformat=require(_0xda18('0x0'));var rimraf=require(_0xda18('0x1'));var zipdir=require(_0xda18('0x2'));var jsonpatch=require(_0xda18('0x3'));var rp=require(_0xda18('0x4'));var moment=require(_0xda18('0x5'));var BPromise=require(_0xda18('0x6'));var Mustache=require(_0xda18('0x7'));var util=require('util');var path=require(_0xda18('0x8'));var sox=require(_0xda18('0x9'));var csv=require(_0xda18('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda18('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xda18('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xda18('0xa'));var querystring=require(_0xda18('0xd'));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(_0xda18('0xe'));var logger=require(_0xda18('0xf'))(_0xda18('0x10'));var utils=require(_0xda18('0x11'));var config=require(_0xda18('0x12'));var licenseUtil=require(_0xda18('0x13'));var db=require(_0xda18('0x14'))['db'];function respondWithStatusCode(_0x3a436b,_0x3b2508){_0x3b2508=_0x3b2508||0xcc;return function(_0xd6e225){if(_0xd6e225){return _0x3a436b[_0xda18('0x15')](_0x3b2508);}return _0x3a436b[_0xda18('0x16')](_0x3b2508)['end']();};}function respondWithResult(_0x324282,_0x5f20e5){_0x5f20e5=_0x5f20e5||0xc8;return function(_0x282dbc){if(_0x282dbc){return _0x324282['status'](_0x5f20e5)[_0xda18('0x17')](_0x282dbc);}};}function respondWithFilteredResult(_0x58ac7b,_0x141ced){return function(_0x12b18b){if(_0x12b18b){var _0x58711b=typeof _0x141ced[_0xda18('0x18')]==='undefined'&&typeof _0x141ced[_0xda18('0x19')]===_0xda18('0x1a');var _0x1d3126=_0x12b18b['count'];var _0x1ea206=_0x58711b?0x0:_0x141ced[_0xda18('0x18')];var _0x243ccf=_0x58711b?_0x12b18b[_0xda18('0x1b')]:_0x141ced[_0xda18('0x18')]+_0x141ced[_0xda18('0x19')];var _0x15758f;if(_0x243ccf>=_0x1d3126){_0x243ccf=_0x1d3126;_0x15758f=0xc8;}else{_0x15758f=0xce;}_0x58ac7b[_0xda18('0x16')](_0x15758f);return _0x58ac7b[_0xda18('0x1c')](_0xda18('0x1d'),_0x1ea206+'-'+_0x243ccf+'/'+_0x1d3126)['json'](_0x12b18b);}return null;};}function patchUpdates(_0x3388da){return function(_0x2cc608){try{jsonpatch[_0xda18('0x1e')](_0x2cc608,_0x3388da,!![]);}catch(_0x292941){return BPromise[_0xda18('0x1f')](_0x292941);}return _0x2cc608[_0xda18('0x20')]();};}function saveUpdates(_0x2be394,_0x52cfba){return function(_0x5d30a3){if(_0x5d30a3){return _0x5d30a3[_0xda18('0x21')](_0x2be394)['then'](function(_0x2401cd){return _0x2401cd;});}return null;};}function removeEntity(_0x191612,_0x43a66e){return function(_0x44a935){if(_0x44a935){return _0x44a935[_0xda18('0x22')]()['then'](function(){_0x191612[_0xda18('0x16')](0xcc)[_0xda18('0x23')]();});}};}function handleEntityNotFound(_0x57a923,_0x194cec){return function(_0x52ed1d){if(!_0x52ed1d){_0x57a923[_0xda18('0x15')](0x194);}return _0x52ed1d;};}function handleError(_0x41460a,_0x40ec27){_0x40ec27=_0x40ec27||0x1f4;return function(_0x24e422){logger[_0xda18('0x24')](_0x24e422[_0xda18('0x25')]);if(_0x24e422[_0xda18('0x26')]){delete _0x24e422['name'];}_0x41460a[_0xda18('0x16')](_0x40ec27)[_0xda18('0x27')](_0x24e422);};}exports[_0xda18('0x28')]=function(_0x24b69e,_0x432783){var _0x18e252={},_0x19cfeb={},_0x55d624={'count':0x0,'rows':[]};var _0x4ce6a1=_[_0xda18('0x29')](db[_0xda18('0x2a')]['rawAttributes'],function(_0x15ee1c){return{'name':_0x15ee1c[_0xda18('0x2b')],'type':_0x15ee1c[_0xda18('0x2c')]['key']};});_0x19cfeb['model']=_[_0xda18('0x29')](_0x4ce6a1,'name');_0x19cfeb['query']=_['keys'](_0x24b69e['query']);_0x19cfeb[_0xda18('0x2d')]=_['intersection'](_0x19cfeb[_0xda18('0x2e')],_0x19cfeb['query']);_0x18e252[_0xda18('0x2f')]=_[_0xda18('0x30')](_0x19cfeb[_0xda18('0x2e')],qs['fields'](_0x24b69e['query'][_0xda18('0x31')]));_0x18e252['attributes']=_0x18e252[_0xda18('0x2f')][_0xda18('0x32')]?_0x18e252['attributes']:_0x19cfeb[_0xda18('0x2e')];if(!_0x24b69e['query'][_0xda18('0x33')](_0xda18('0x34'))){_0x18e252[_0xda18('0x19')]=qs[_0xda18('0x19')](_0x24b69e[_0xda18('0x35')][_0xda18('0x19')]);_0x18e252[_0xda18('0x18')]=qs[_0xda18('0x18')](_0x24b69e[_0xda18('0x35')]['offset']);}_0x18e252['order']=qs['sort'](_0x24b69e[_0xda18('0x35')][_0xda18('0x36')]);_0x18e252[_0xda18('0x37')]=qs[_0xda18('0x2d')](_[_0xda18('0x38')](_0x24b69e[_0xda18('0x35')],_0x19cfeb['filters']),_0x4ce6a1);if(_0x24b69e['query'][_0xda18('0x39')]){_0x18e252['where']=_[_0xda18('0x3a')](_0x18e252['where'],{'$or':_[_0xda18('0x29')](_0x4ce6a1,function(_0x29114){if(_0x29114[_0xda18('0x2c')]!==_0xda18('0x3b')){var _0x8dc047={};_0x8dc047[_0x29114['name']]={'$like':'%'+_0x24b69e['query'][_0xda18('0x39')]+'%'};return _0x8dc047;}})});}_0x18e252=_['merge']({},_0x18e252,_0x24b69e[_0xda18('0x3c')]);var _0x210336={'where':_0x18e252[_0xda18('0x37')]};return db['AnalyticTreeReport'][_0xda18('0x1b')](_0x210336)[_0xda18('0x3d')](function(_0x451a37){_0x55d624[_0xda18('0x1b')]=_0x451a37;if(_0x24b69e['query'][_0xda18('0x3e')]){_0x18e252[_0xda18('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xda18('0x40')](_0x18e252);})[_0xda18('0x3d')](function(_0x30b257){_0x55d624[_0xda18('0x41')]=_0x30b257;return _0x55d624;})[_0xda18('0x3d')](respondWithFilteredResult(_0x432783,_0x18e252))['catch'](handleError(_0x432783,null));};exports['show']=function(_0x4dde91,_0x3ea709){var _0x756587={'raw':!![],'where':{'id':_0x4dde91[_0xda18('0x42')]['id']}},_0x4f6dbf={};_0x4f6dbf['model']=_[_0xda18('0x43')](db[_0xda18('0x2a')][_0xda18('0x44')]);_0x4f6dbf[_0xda18('0x35')]=_[_0xda18('0x43')](_0x4dde91[_0xda18('0x35')]);_0x4f6dbf[_0xda18('0x2d')]=_['intersection'](_0x4f6dbf['model'],_0x4f6dbf['query']);_0x756587['attributes']=_['intersection'](_0x4f6dbf[_0xda18('0x2e')],qs[_0xda18('0x31')](_0x4dde91[_0xda18('0x35')]['fields']));_0x756587[_0xda18('0x2f')]=_0x756587['attributes'][_0xda18('0x32')]?_0x756587[_0xda18('0x2f')]:_0x4f6dbf[_0xda18('0x2e')];if(_0x4dde91[_0xda18('0x35')][_0xda18('0x3e')]){_0x756587[_0xda18('0x3f')]=[{'all':!![]}];}_0x756587=_['merge']({},_0x756587,_0x4dde91[_0xda18('0x3c')]);return db[_0xda18('0x2a')]['find'](_0x756587)['then'](handleEntityNotFound(_0x3ea709,null))[_0xda18('0x3d')](respondWithResult(_0x3ea709,null))[_0xda18('0x45')](handleError(_0x3ea709,null));};exports[_0xda18('0x46')]=function(_0x57f53d,_0xcfdba2){return db[_0xda18('0x2a')][_0xda18('0x46')](_0x57f53d[_0xda18('0x47')],{})[_0xda18('0x3d')](respondWithResult(_0xcfdba2,0xc9))[_0xda18('0x45')](handleError(_0xcfdba2,null));};exports[_0xda18('0x21')]=function(_0xae5cd6,_0x38ffa2){if(_0xae5cd6['body']['id']){delete _0xae5cd6[_0xda18('0x47')]['id'];}return db[_0xda18('0x2a')][_0xda18('0x48')]({'where':{'id':_0xae5cd6[_0xda18('0x42')]['id']}})['then'](handleEntityNotFound(_0x38ffa2,null))[_0xda18('0x3d')](saveUpdates(_0xae5cd6[_0xda18('0x47')],null))[_0xda18('0x3d')](respondWithResult(_0x38ffa2,null))[_0xda18('0x45')](handleError(_0x38ffa2,null));};exports[_0xda18('0x22')]=function(_0x2bd4fd,_0x72d750){return db[_0xda18('0x2a')]['find']({'where':{'id':_0x2bd4fd[_0xda18('0x42')]['id']}})[_0xda18('0x3d')](handleEntityNotFound(_0x72d750,null))[_0xda18('0x3d')](removeEntity(_0x72d750,null))[_0xda18('0x45')](handleError(_0x72d750,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1394cb5..bfe9e28 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 _0xed08=['path','../../config/environment','./analyticTreeReport.attributes','define','analytics_report_trees','lodash','api','moment','request-promise'];(function(_0x15f28f,_0x515cd0){var _0x1f6082=function(_0x47465b){while(--_0x47465b){_0x15f28f['push'](_0x15f28f['shift']());}};_0x1f6082(++_0x515cd0);}(_0xed08,0x152));var _0x8ed0=function(_0x3d8938,_0x3f1107){_0x3d8938=_0x3d8938-0x0;var _0x7562=_0xed08[_0x3d8938];return _0x7562;};'use strict';var _=require(_0x8ed0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8ed0('0x1'));var moment=require(_0x8ed0('0x2'));var BPromise=require('bluebird');var rp=require(_0x8ed0('0x3'));var fs=require('fs');var path=require(_0x8ed0('0x4'));var rimraf=require('rimraf');var config=require(_0x8ed0('0x5'));var attributes=require(_0x8ed0('0x6'));module['exports']=function(_0x3f38e0,_0x24ba12){return _0x3f38e0[_0x8ed0('0x7')]('AnalyticTreeReport',attributes,{'tableName':_0x8ed0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x286b=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','../../config/logger'];(function(_0x1bf713,_0x2a079b){var _0x4b2b7b=function(_0x25f828){while(--_0x25f828){_0x1bf713['push'](_0x1bf713['shift']());}};_0x4b2b7b(++_0x2a079b);}(_0x286b,0x1c2));var _0xb286=function(_0x2afcf6,_0x24b28f){_0x2afcf6=_0x2afcf6-0x0;var _0x5232ad=_0x286b[_0x2afcf6];return _0x5232ad;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb286('0x0'))(_0xb286('0x1'));var moment=require(_0xb286('0x2'));var BPromise=require('bluebird');var rp=require(_0xb286('0x3'));var fs=require('fs');var path=require(_0xb286('0x4'));var rimraf=require(_0xb286('0x5'));var config=require(_0xb286('0x6'));var attributes=require(_0xb286('0x7'));module[_0xb286('0x8')]=function(_0x412b08,_0x1f0fc4){return _0x412b08[_0xb286('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0xb286('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 d7210df..a86c054 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x38f993,_0x20d110){var _0xaefddb=function(_0x4c51bb){while(--_0x4c51bb){_0x38f993['push'](_0x38f993['shift']());}};_0xaefddb(++_0x20d110);}(_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 moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0xadb5,0xad));var _0x5adb=function(_0xa93e9d,_0x5b5753){_0xa93e9d=_0xa93e9d-0x0;var _0x51e2ef=_0xadb5[_0xa93e9d];return _0x51e2ef;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 6f31574..d972de7 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 _0x24b8=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','show','put','/:id','update','delete','destroy'];(function(_0x326b39,_0x28db22){var _0x12c667=function(_0x371f73){while(--_0x371f73){_0x326b39['push'](_0x326b39['shift']());}};_0x12c667(++_0x28db22);}(_0x24b8,0x10b));var _0x824b=function(_0x2bf1d6,_0x410efd){_0x2bf1d6=_0x2bf1d6-0x0;var _0x1be08a=_0x24b8[_0x2bf1d6];return _0x1be08a;};'use strict';var multer=require(_0x824b('0x0'));var util=require(_0x824b('0x1'));var path=require(_0x824b('0x2'));var timeout=require(_0x824b('0x3'));var express=require(_0x824b('0x4'));var router=express[_0x824b('0x5')]();var fs_extra=require(_0x824b('0x6'));var auth=require(_0x824b('0x7'));var interaction=require(_0x824b('0x8'));var config=require(_0x824b('0x9'));var controller=require(_0x824b('0xa'));router['get']('/',auth[_0x824b('0xb')](),controller['index']);router['get']('/:id',auth[_0x824b('0xb')](),controller[_0x824b('0xc')]);router['post']('/',auth[_0x824b('0xb')](),controller['create']);router[_0x824b('0xd')](_0x824b('0xe'),auth['isAuthenticated'](),controller[_0x824b('0xf')]);router[_0x824b('0x10')](_0x824b('0xe'),auth['isAuthenticated'](),controller[_0x824b('0x11')]);module[_0x824b('0x12')]=router; \ No newline at end of file +var _0x9643=['get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./analyticTreeReport.controller'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x9643,0x13c));var _0x3964=function(_0x267af0,_0x14b547){_0x267af0=_0x267af0-0x0;var _0x37889a=_0x9643[_0x267af0];return _0x37889a;};'use strict';var multer=require(_0x3964('0x0'));var util=require(_0x3964('0x1'));var path=require(_0x3964('0x2'));var timeout=require(_0x3964('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3964('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3964('0x5'));var config=require('../../config/environment');var controller=require(_0x3964('0x6'));router[_0x3964('0x7')]('/',auth[_0x3964('0x8')](),controller[_0x3964('0x9')]);router[_0x3964('0x7')](_0x3964('0xa'),auth[_0x3964('0x8')](),controller[_0x3964('0xb')]);router[_0x3964('0xc')]('/',auth['isAuthenticated'](),controller[_0x3964('0xd')]);router[_0x3964('0xe')](_0x3964('0xa'),auth[_0x3964('0x8')](),controller[_0x3964('0xf')]);router['delete'](_0x3964('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x3964('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index e8f13fa..c31f56e 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 _0xe14d=['exports','STRING','sequelize'];(function(_0x24c39a,_0x48fc91){var _0x4c2fa6=function(_0x300241){while(--_0x300241){_0x24c39a['push'](_0x24c39a['shift']());}};_0x4c2fa6(++_0x48fc91);}(_0xe14d,0x1ee));var _0xde14=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xe14d[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'name':{'type':Sequelize[_0xde14('0x2')]},'basename':{'type':Sequelize[_0xde14('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x17ba=['sequelize','exports','STRING'];(function(_0x2ab914,_0x210788){var _0x35c276=function(_0x2b79d0){while(--_0x2b79d0){_0x2ab914['push'](_0x2ab914['shift']());}};_0x35c276(++_0x210788);}(_0x17ba,0xab));var _0xa17b=function(_0x41edaa,_0x335b24){_0x41edaa=_0x41edaa-0x0;var _0xb0bcb4=_0x17ba[_0x41edaa];return _0xb0bcb4;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xa17b('0x2')]},'type':{'type':Sequelize[_0xa17b('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index c26e1e0..584e6a0 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 _0xd2a7=['server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','Attachment','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','clone','get','updatedAt','omit','body','create','find','file','basename','filename','mimetype','download','findOne'];(function(_0x464cee,_0x302661){var _0x1f6d44=function(_0xff2b71){while(--_0xff2b71){_0x464cee['push'](_0x464cee['shift']());}};_0x1f6d44(++_0x302661);}(_0xd2a7,0x1c5));var _0x7d2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2a7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7d2a('0x0'));var rimraf=require(_0x7d2a('0x1'));var zipdir=require(_0x7d2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d2a('0x3'));var BPromise=require(_0x7d2a('0x4'));var Mustache=require(_0x7d2a('0x5'));var util=require(_0x7d2a('0x6'));var path=require(_0x7d2a('0x7'));var sox=require(_0x7d2a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d2a('0x9'));var _=require(_0x7d2a('0xa'));var squel=require(_0x7d2a('0xb'));var crypto=require('crypto');var jsforce=require(_0x7d2a('0xc'));var deskjs=require(_0x7d2a('0xd'));var toCsv=require(_0x7d2a('0xe'));var querystring=require(_0x7d2a('0xf'));var Papa=require(_0x7d2a('0x10'));var Redis=require(_0x7d2a('0x11'));var authService=require(_0x7d2a('0x12'));var qs=require(_0x7d2a('0x13'));var as=require(_0x7d2a('0x14'));var hardwareService=require(_0x7d2a('0x15'));var logger=require('../../config/logger')(_0x7d2a('0x16'));var utils=require(_0x7d2a('0x17'));var config=require(_0x7d2a('0x18'));var licenseUtil=require(_0x7d2a('0x19'));var db=require(_0x7d2a('0x1a'))['db'];function respondWithStatusCode(_0x5e7724,_0x379962){_0x379962=_0x379962||0xcc;return function(_0x15c842){if(_0x15c842){return _0x5e7724[_0x7d2a('0x1b')](_0x379962);}return _0x5e7724[_0x7d2a('0x1c')](_0x379962)[_0x7d2a('0x1d')]();};}function respondWithResult(_0x54b05d,_0x2904b6){_0x2904b6=_0x2904b6||0xc8;return function(_0x265024){if(_0x265024){return _0x54b05d[_0x7d2a('0x1c')](_0x2904b6)[_0x7d2a('0x1e')](_0x265024);}};}function respondWithFilteredResult(_0x51093e,_0x19bd81){return function(_0x59d62a){if(_0x59d62a){var _0x347410=typeof _0x19bd81[_0x7d2a('0x1f')]===_0x7d2a('0x20')&&typeof _0x19bd81[_0x7d2a('0x21')]===_0x7d2a('0x20');var _0x17a13c=_0x59d62a['count'];var _0x33a8a6=_0x347410?0x0:_0x19bd81['offset'];var _0x17c313=_0x347410?_0x59d62a[_0x7d2a('0x22')]:_0x19bd81['offset']+_0x19bd81[_0x7d2a('0x21')];var _0x1d5661;if(_0x17c313>=_0x17a13c){_0x17c313=_0x17a13c;_0x1d5661=0xc8;}else{_0x1d5661=0xce;}_0x51093e[_0x7d2a('0x1c')](_0x1d5661);return _0x51093e[_0x7d2a('0x23')](_0x7d2a('0x24'),_0x33a8a6+'-'+_0x17c313+'/'+_0x17a13c)['json'](_0x59d62a);}return null;};}function patchUpdates(_0x1a9a28){return function(_0x3687d3){try{jsonpatch[_0x7d2a('0x25')](_0x3687d3,_0x1a9a28,!![]);}catch(_0x2c982e){return BPromise[_0x7d2a('0x26')](_0x2c982e);}return _0x3687d3[_0x7d2a('0x27')]();};}function saveUpdates(_0x69df9,_0x718410){return function(_0x51395f){if(_0x51395f){return _0x51395f[_0x7d2a('0x28')](_0x69df9)['then'](function(_0x28c8b7){return _0x28c8b7;});}return null;};}function removeEntity(_0x2e841c,_0x52c16b){return function(_0x2882a4){if(_0x2882a4){return _0x2882a4[_0x7d2a('0x29')]()[_0x7d2a('0x2a')](function(){_0x2e841c[_0x7d2a('0x1c')](0xcc)[_0x7d2a('0x1d')]();});}};}function handleEntityNotFound(_0x3c809f,_0x1e0f75){return function(_0x3c499b){if(!_0x3c499b){_0x3c809f['sendStatus'](0x194);}return _0x3c499b;};}function handleError(_0x200472,_0x55cc87){_0x55cc87=_0x55cc87||0x1f4;return function(_0x54ee07){logger[_0x7d2a('0x2b')](_0x54ee07['stack']);if(_0x54ee07[_0x7d2a('0x2c')]){delete _0x54ee07['name'];}_0x200472[_0x7d2a('0x1c')](_0x55cc87)[_0x7d2a('0x2d')](_0x54ee07);};}exports['index']=function(_0x3149ac,_0x3e50ef){var _0x27b998={},_0x1b32e6={},_0x46159f={'count':0x0,'rows':[]};var _0x1584d9=_[_0x7d2a('0x2e')](db[_0x7d2a('0x2f')][_0x7d2a('0x30')],function(_0x51d58a){return{'name':_0x51d58a['fieldName'],'type':_0x51d58a[_0x7d2a('0x31')][_0x7d2a('0x32')]};});_0x1b32e6['model']=_[_0x7d2a('0x2e')](_0x1584d9,'name');_0x1b32e6[_0x7d2a('0x33')]=_[_0x7d2a('0x34')](_0x3149ac['query']);_0x1b32e6['filters']=_[_0x7d2a('0x35')](_0x1b32e6[_0x7d2a('0x36')],_0x1b32e6[_0x7d2a('0x33')]);_0x27b998[_0x7d2a('0x37')]=_[_0x7d2a('0x35')](_0x1b32e6[_0x7d2a('0x36')],qs[_0x7d2a('0x38')](_0x3149ac['query'][_0x7d2a('0x38')]));_0x27b998['attributes']=_0x27b998[_0x7d2a('0x37')]['length']?_0x27b998['attributes']:_0x1b32e6['model'];if(!_0x3149ac['query']['hasOwnProperty'](_0x7d2a('0x39'))){_0x27b998[_0x7d2a('0x21')]=qs[_0x7d2a('0x21')](_0x3149ac[_0x7d2a('0x33')][_0x7d2a('0x21')]);_0x27b998[_0x7d2a('0x1f')]=qs[_0x7d2a('0x1f')](_0x3149ac['query']['offset']);}_0x27b998['order']=qs[_0x7d2a('0x3a')](_0x3149ac[_0x7d2a('0x33')][_0x7d2a('0x3a')]);_0x27b998[_0x7d2a('0x3b')]=qs['filters'](_[_0x7d2a('0x3c')](_0x3149ac[_0x7d2a('0x33')],_0x1b32e6[_0x7d2a('0x3d')]),_0x1584d9);if(_0x3149ac[_0x7d2a('0x33')][_0x7d2a('0x3e')]){_0x27b998[_0x7d2a('0x3b')]=_[_0x7d2a('0x3f')](_0x27b998['where'],{'$or':_['map'](_0x1584d9,function(_0x37091f){if(_0x37091f[_0x7d2a('0x31')]!==_0x7d2a('0x40')){var _0x415f98={};_0x415f98[_0x37091f[_0x7d2a('0x2c')]]={'$like':'%'+_0x3149ac[_0x7d2a('0x33')]['filter']+'%'};return _0x415f98;}})});}_0x27b998=_[_0x7d2a('0x3f')]({},_0x27b998,_0x3149ac[_0x7d2a('0x41')]);var _0x489f7e={'where':_0x27b998[_0x7d2a('0x3b')]};return db[_0x7d2a('0x2f')][_0x7d2a('0x22')](_0x489f7e)[_0x7d2a('0x2a')](function(_0x3e0105){_0x46159f[_0x7d2a('0x22')]=_0x3e0105;if(_0x3149ac[_0x7d2a('0x33')][_0x7d2a('0x42')]){_0x27b998['include']=[{'all':!![]}];}return db[_0x7d2a('0x2f')][_0x7d2a('0x43')](_0x27b998);})[_0x7d2a('0x2a')](function(_0x26fe1c){_0x46159f[_0x7d2a('0x44')]=_0x26fe1c;return _0x46159f;})[_0x7d2a('0x2a')](respondWithFilteredResult(_0x3e50ef,_0x27b998))[_0x7d2a('0x45')](handleError(_0x3e50ef,null));};exports[_0x7d2a('0x46')]=function(_0xe9ca9e,_0x16e2bd){var _0x30d678={'raw':!![],'where':{'id':_0xe9ca9e[_0x7d2a('0x47')]['id']}},_0x4e4c57={};_0x4e4c57['model']=_[_0x7d2a('0x34')](db[_0x7d2a('0x2f')][_0x7d2a('0x30')]);_0x4e4c57[_0x7d2a('0x33')]=_[_0x7d2a('0x34')](_0xe9ca9e[_0x7d2a('0x33')]);_0x4e4c57[_0x7d2a('0x3d')]=_[_0x7d2a('0x35')](_0x4e4c57[_0x7d2a('0x36')],_0x4e4c57[_0x7d2a('0x33')]);_0x30d678[_0x7d2a('0x37')]=_[_0x7d2a('0x35')](_0x4e4c57['model'],qs[_0x7d2a('0x38')](_0xe9ca9e['query'][_0x7d2a('0x38')]));_0x30d678[_0x7d2a('0x37')]=_0x30d678['attributes'][_0x7d2a('0x48')]?_0x30d678[_0x7d2a('0x37')]:_0x4e4c57[_0x7d2a('0x36')];if(_0xe9ca9e[_0x7d2a('0x33')][_0x7d2a('0x42')]){_0x30d678[_0x7d2a('0x49')]=[{'all':!![]}];}_0x30d678=_[_0x7d2a('0x3f')]({},_0x30d678,_0xe9ca9e[_0x7d2a('0x41')]);return db[_0x7d2a('0x2f')]['find'](_0x30d678)[_0x7d2a('0x2a')](handleEntityNotFound(_0x16e2bd,null))['then'](respondWithResult(_0x16e2bd,null))['catch'](handleError(_0x16e2bd,null));};exports[_0x7d2a('0x4a')]=function(_0x40fcb0,_0x49ad3c){var _0x18b7a3={'where':{'id':_0x40fcb0[_0x7d2a('0x47')]['id']}},_0x1cc870={};_0x1cc870['model']=_['keys'](db['Attachment'][_0x7d2a('0x30')]);_0x18b7a3[_0x7d2a('0x37')]=_[_0x7d2a('0x35')](_0x1cc870['model'],qs['fields'](_0x40fcb0[_0x7d2a('0x33')][_0x7d2a('0x38')]));_0x18b7a3[_0x7d2a('0x37')]=_0x18b7a3[_0x7d2a('0x37')]['length']?_0x18b7a3['attributes']:_0x1cc870[_0x7d2a('0x36')];if(_0x40fcb0[_0x7d2a('0x33')][_0x7d2a('0x42')]){_0x18b7a3[_0x7d2a('0x49')]=[{'all':!![]}];}_0x18b7a3=_['merge']({},_0x18b7a3,_0x40fcb0['options']);return db['Attachment']['find'](_0x18b7a3)[_0x7d2a('0x2a')](handleEntityNotFound(_0x49ad3c,null))[_0x7d2a('0x2a')](function(_0x50e0ab){if(_0x50e0ab){var _0x55d57e=_0x50e0ab[_0x7d2a('0x4b')]({'plain':!![]});_0x55d57e=qs['omit'](_0x55d57e,['id','createdAt',_0x7d2a('0x4c')]);_0x40fcb0['body']=_[_0x7d2a('0x4d')](_0x40fcb0[_0x7d2a('0x4e')],['id','createdAt',_0x7d2a('0x4c')]);return db['Attachment'][_0x7d2a('0x4f')](_[_0x7d2a('0x3f')](_0x55d57e,_0x40fcb0['body']),{'include':_0x40fcb0[_0x7d2a('0x33')][_0x7d2a('0x42')]?[{'all':!![]}]:undefined});}})[_0x7d2a('0x2a')](respondWithResult(_0x49ad3c,0xc9))[_0x7d2a('0x45')](handleError(_0x49ad3c,null));};exports[_0x7d2a('0x28')]=function(_0x78a4f4,_0x40992d){if(_0x78a4f4[_0x7d2a('0x4e')]['id']){delete _0x78a4f4[_0x7d2a('0x4e')]['id'];}return db[_0x7d2a('0x2f')][_0x7d2a('0x50')]({'where':{'id':_0x78a4f4[_0x7d2a('0x47')]['id']}})[_0x7d2a('0x2a')](handleEntityNotFound(_0x40992d,null))[_0x7d2a('0x2a')](saveUpdates(_0x78a4f4[_0x7d2a('0x4e')],null))[_0x7d2a('0x2a')](respondWithResult(_0x40992d,null))[_0x7d2a('0x45')](handleError(_0x40992d,null));};exports['destroy']=function(_0x372af0,_0x4475d5){return db[_0x7d2a('0x2f')][_0x7d2a('0x50')]({'where':{'id':_0x372af0[_0x7d2a('0x47')]['id']}})[_0x7d2a('0x2a')](handleEntityNotFound(_0x4475d5,null))['then'](removeEntity(_0x4475d5,null))[_0x7d2a('0x45')](handleError(_0x4475d5,null));};exports[_0x7d2a('0x4f')]=function(_0x2b2db1,_0x4a626a,_0x2133f6){_0x2b2db1[_0x7d2a('0x4e')][_0x7d2a('0x2c')]=_0x2b2db1[_0x7d2a('0x51')]['originalname'];_0x2b2db1[_0x7d2a('0x4e')][_0x7d2a('0x52')]=_0x2b2db1['file'][_0x7d2a('0x53')];_0x2b2db1['body']['type']=_0x2b2db1['file'][_0x7d2a('0x54')];return db[_0x7d2a('0x2f')][_0x7d2a('0x4f')](_0x2b2db1[_0x7d2a('0x4e')])[_0x7d2a('0x2a')](respondWithResult(_0x4a626a,0xc9))[_0x7d2a('0x45')](handleError(_0x4a626a,null));};exports[_0x7d2a('0x55')]=function(_0x57ffe8,_0x108d07,_0x58ff5c){return db[_0x7d2a('0x2f')][_0x7d2a('0x56')]({'where':{'id':_0x57ffe8[_0x7d2a('0x47')]['id']},'raw':!![]})[_0x7d2a('0x2a')](handleEntityNotFound(_0x108d07,null))[_0x7d2a('0x2a')](function(_0x5c3167){if(_0x5c3167){var _0x57afb7=_0x5c3167['ChatOfflineMessageId']!==null;var _0xf435ca=path['join'](config['root'],_0x7d2a('0x57'));if(_0x57afb7){_0xf435ca=path[_0x7d2a('0x58')](_0xf435ca,_0x7d2a('0x59'));}var _0x5b6026=path[_0x7d2a('0x58')](_0xf435ca,_0x5c3167[_0x7d2a('0x52')]);return _0x108d07[_0x7d2a('0x55')](_0x5b6026);}})[_0x7d2a('0x45')](handleError(_0x108d07,null));}; \ No newline at end of file +var _0x72aa=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','find','clone','params','get','omit','body','createdAt','updatedAt','create','update','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce'];(function(_0x1f14fa,_0xe5444e){var _0xc87f91=function(_0x4c80ed){while(--_0x4c80ed){_0x1f14fa['push'](_0x1f14fa['shift']());}};_0xc87f91(++_0xe5444e);}(_0x72aa,0x1c3));var _0xa72a=function(_0xc4ea4f,_0x858344){_0xc4ea4f=_0xc4ea4f-0x0;var _0x4db3cf=_0x72aa[_0xc4ea4f];return _0x4db3cf;};'use strict';var emlformat=require(_0xa72a('0x0'));var rimraf=require(_0xa72a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa72a('0x2'));var rp=require(_0xa72a('0x3'));var moment=require(_0xa72a('0x4'));var BPromise=require(_0xa72a('0x5'));var Mustache=require(_0xa72a('0x6'));var util=require(_0xa72a('0x7'));var path=require(_0xa72a('0x8'));var sox=require(_0xa72a('0x9'));var csv=require(_0xa72a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa72a('0xb'));var _=require(_0xa72a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa72a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa72a('0xa'));var querystring=require(_0xa72a('0xe'));var Papa=require(_0xa72a('0xf'));var Redis=require(_0xa72a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa72a('0x11'));var as=require(_0xa72a('0x12'));var hardwareService=require(_0xa72a('0x13'));var logger=require('../../config/logger')(_0xa72a('0x14'));var utils=require(_0xa72a('0x15'));var config=require(_0xa72a('0x16'));var licenseUtil=require(_0xa72a('0x17'));var db=require(_0xa72a('0x18'))['db'];function respondWithStatusCode(_0x96d1b2,_0x5557f2){_0x5557f2=_0x5557f2||0xcc;return function(_0x5219d3){if(_0x5219d3){return _0x96d1b2[_0xa72a('0x19')](_0x5557f2);}return _0x96d1b2[_0xa72a('0x1a')](_0x5557f2)['end']();};}function respondWithResult(_0xb1959f,_0x198d2e){_0x198d2e=_0x198d2e||0xc8;return function(_0x1b140f){if(_0x1b140f){return _0xb1959f[_0xa72a('0x1a')](_0x198d2e)[_0xa72a('0x1b')](_0x1b140f);}};}function respondWithFilteredResult(_0x1c51be,_0x269187){return function(_0x647537){if(_0x647537){var _0x4b586e=typeof _0x269187[_0xa72a('0x1c')]===_0xa72a('0x1d')&&typeof _0x269187[_0xa72a('0x1e')]===_0xa72a('0x1d');var _0x1f26fa=_0x647537['count'];var _0x5aedbc=_0x4b586e?0x0:_0x269187[_0xa72a('0x1c')];var _0x5619e7=_0x4b586e?_0x647537['count']:_0x269187[_0xa72a('0x1c')]+_0x269187[_0xa72a('0x1e')];var _0x1c1aa5;if(_0x5619e7>=_0x1f26fa){_0x5619e7=_0x1f26fa;_0x1c1aa5=0xc8;}else{_0x1c1aa5=0xce;}_0x1c51be[_0xa72a('0x1a')](_0x1c1aa5);return _0x1c51be[_0xa72a('0x1f')](_0xa72a('0x20'),_0x5aedbc+'-'+_0x5619e7+'/'+_0x1f26fa)[_0xa72a('0x1b')](_0x647537);}return null;};}function patchUpdates(_0x12be4d){return function(_0x2167c9){try{jsonpatch['apply'](_0x2167c9,_0x12be4d,!![]);}catch(_0x3ba8cc){return BPromise[_0xa72a('0x21')](_0x3ba8cc);}return _0x2167c9[_0xa72a('0x22')]();};}function saveUpdates(_0x5048f5,_0x8a2cf5){return function(_0x196a8b){if(_0x196a8b){return _0x196a8b['update'](_0x5048f5)[_0xa72a('0x23')](function(_0x1d9b4e){return _0x1d9b4e;});}return null;};}function removeEntity(_0x1a888d,_0x23a6bf){return function(_0x19fd96){if(_0x19fd96){return _0x19fd96[_0xa72a('0x24')]()[_0xa72a('0x23')](function(){_0x1a888d[_0xa72a('0x1a')](0xcc)[_0xa72a('0x25')]();});}};}function handleEntityNotFound(_0x4f679b,_0x5b3a11){return function(_0x4bb1fc){if(!_0x4bb1fc){_0x4f679b[_0xa72a('0x19')](0x194);}return _0x4bb1fc;};}function handleError(_0x33cb82,_0x5b5c22){_0x5b5c22=_0x5b5c22||0x1f4;return function(_0x118f24){logger[_0xa72a('0x26')](_0x118f24[_0xa72a('0x27')]);if(_0x118f24['name']){delete _0x118f24[_0xa72a('0x28')];}_0x33cb82[_0xa72a('0x1a')](_0x5b5c22)[_0xa72a('0x29')](_0x118f24);};}exports[_0xa72a('0x2a')]=function(_0x49cb2a,_0x4dccfb){var _0x597341={},_0x1d7eaf={},_0x355cd9={'count':0x0,'rows':[]};var _0x2ce4dd=_[_0xa72a('0x2b')](db[_0xa72a('0x2c')][_0xa72a('0x2d')],function(_0x7deb56){return{'name':_0x7deb56[_0xa72a('0x2e')],'type':_0x7deb56[_0xa72a('0x2f')][_0xa72a('0x30')]};});_0x1d7eaf[_0xa72a('0x31')]=_[_0xa72a('0x2b')](_0x2ce4dd,'name');_0x1d7eaf['query']=_[_0xa72a('0x32')](_0x49cb2a[_0xa72a('0x33')]);_0x1d7eaf[_0xa72a('0x34')]=_[_0xa72a('0x35')](_0x1d7eaf[_0xa72a('0x31')],_0x1d7eaf[_0xa72a('0x33')]);_0x597341[_0xa72a('0x36')]=_[_0xa72a('0x35')](_0x1d7eaf[_0xa72a('0x31')],qs[_0xa72a('0x37')](_0x49cb2a[_0xa72a('0x33')][_0xa72a('0x37')]));_0x597341[_0xa72a('0x36')]=_0x597341[_0xa72a('0x36')][_0xa72a('0x38')]?_0x597341[_0xa72a('0x36')]:_0x1d7eaf[_0xa72a('0x31')];if(!_0x49cb2a[_0xa72a('0x33')][_0xa72a('0x39')]('nolimit')){_0x597341['limit']=qs[_0xa72a('0x1e')](_0x49cb2a[_0xa72a('0x33')][_0xa72a('0x1e')]);_0x597341[_0xa72a('0x1c')]=qs[_0xa72a('0x1c')](_0x49cb2a['query'][_0xa72a('0x1c')]);}_0x597341[_0xa72a('0x3a')]=qs['sort'](_0x49cb2a[_0xa72a('0x33')]['sort']);_0x597341[_0xa72a('0x3b')]=qs[_0xa72a('0x34')](_[_0xa72a('0x3c')](_0x49cb2a[_0xa72a('0x33')],_0x1d7eaf[_0xa72a('0x34')]),_0x2ce4dd);if(_0x49cb2a[_0xa72a('0x33')]['filter']){_0x597341[_0xa72a('0x3b')]=_['merge'](_0x597341[_0xa72a('0x3b')],{'$or':_[_0xa72a('0x2b')](_0x2ce4dd,function(_0x1ad45c){if(_0x1ad45c[_0xa72a('0x2f')]!==_0xa72a('0x3d')){var _0xfa9431={};_0xfa9431[_0x1ad45c[_0xa72a('0x28')]]={'$like':'%'+_0x49cb2a['query']['filter']+'%'};return _0xfa9431;}})});}_0x597341=_[_0xa72a('0x3e')]({},_0x597341,_0x49cb2a[_0xa72a('0x3f')]);var _0x18354b={'where':_0x597341[_0xa72a('0x3b')]};return db['Attachment'][_0xa72a('0x40')](_0x18354b)[_0xa72a('0x23')](function(_0x291525){_0x355cd9['count']=_0x291525;if(_0x49cb2a[_0xa72a('0x33')][_0xa72a('0x41')]){_0x597341[_0xa72a('0x42')]=[{'all':!![]}];}return db[_0xa72a('0x2c')][_0xa72a('0x43')](_0x597341);})[_0xa72a('0x23')](function(_0x31690a){_0x355cd9[_0xa72a('0x44')]=_0x31690a;return _0x355cd9;})[_0xa72a('0x23')](respondWithFilteredResult(_0x4dccfb,_0x597341))[_0xa72a('0x45')](handleError(_0x4dccfb,null));};exports[_0xa72a('0x46')]=function(_0x5a9d8a,_0x1d5397){var _0x54aee7={'raw':!![],'where':{'id':_0x5a9d8a['params']['id']}},_0x17516b={};_0x17516b[_0xa72a('0x31')]=_[_0xa72a('0x32')](db['Attachment'][_0xa72a('0x2d')]);_0x17516b[_0xa72a('0x33')]=_[_0xa72a('0x32')](_0x5a9d8a['query']);_0x17516b['filters']=_[_0xa72a('0x35')](_0x17516b[_0xa72a('0x31')],_0x17516b[_0xa72a('0x33')]);_0x54aee7['attributes']=_[_0xa72a('0x35')](_0x17516b[_0xa72a('0x31')],qs[_0xa72a('0x37')](_0x5a9d8a[_0xa72a('0x33')][_0xa72a('0x37')]));_0x54aee7['attributes']=_0x54aee7[_0xa72a('0x36')]['length']?_0x54aee7[_0xa72a('0x36')]:_0x17516b[_0xa72a('0x31')];if(_0x5a9d8a[_0xa72a('0x33')][_0xa72a('0x41')]){_0x54aee7[_0xa72a('0x42')]=[{'all':!![]}];}_0x54aee7=_[_0xa72a('0x3e')]({},_0x54aee7,_0x5a9d8a[_0xa72a('0x3f')]);return db['Attachment'][_0xa72a('0x47')](_0x54aee7)[_0xa72a('0x23')](handleEntityNotFound(_0x1d5397,null))[_0xa72a('0x23')](respondWithResult(_0x1d5397,null))[_0xa72a('0x45')](handleError(_0x1d5397,null));};exports[_0xa72a('0x48')]=function(_0x254484,_0x4476db){var _0x592d1f={'where':{'id':_0x254484[_0xa72a('0x49')]['id']}},_0x5751d1={};_0x5751d1[_0xa72a('0x31')]=_['keys'](db['Attachment']['rawAttributes']);_0x592d1f[_0xa72a('0x36')]=_[_0xa72a('0x35')](_0x5751d1[_0xa72a('0x31')],qs[_0xa72a('0x37')](_0x254484['query']['fields']));_0x592d1f[_0xa72a('0x36')]=_0x592d1f[_0xa72a('0x36')][_0xa72a('0x38')]?_0x592d1f[_0xa72a('0x36')]:_0x5751d1['model'];if(_0x254484[_0xa72a('0x33')]['includeAll']){_0x592d1f[_0xa72a('0x42')]=[{'all':!![]}];}_0x592d1f=_['merge']({},_0x592d1f,_0x254484['options']);return db['Attachment']['find'](_0x592d1f)[_0xa72a('0x23')](handleEntityNotFound(_0x4476db,null))['then'](function(_0x5a727d){if(_0x5a727d){var _0x2ea662=_0x5a727d[_0xa72a('0x4a')]({'plain':!![]});_0x2ea662=qs[_0xa72a('0x4b')](_0x2ea662,['id','createdAt','updatedAt']);_0x254484[_0xa72a('0x4c')]=_[_0xa72a('0x4b')](_0x254484[_0xa72a('0x4c')],['id',_0xa72a('0x4d'),_0xa72a('0x4e')]);return db[_0xa72a('0x2c')][_0xa72a('0x4f')](_['merge'](_0x2ea662,_0x254484[_0xa72a('0x4c')]),{'include':_0x254484['query']['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x4476db,0xc9))[_0xa72a('0x45')](handleError(_0x4476db,null));};exports[_0xa72a('0x50')]=function(_0x43ecae,_0xdbaa53){if(_0x43ecae[_0xa72a('0x4c')]['id']){delete _0x43ecae[_0xa72a('0x4c')]['id'];}return db['Attachment']['find']({'where':{'id':_0x43ecae[_0xa72a('0x49')]['id']}})[_0xa72a('0x23')](handleEntityNotFound(_0xdbaa53,null))['then'](saveUpdates(_0x43ecae[_0xa72a('0x4c')],null))['then'](respondWithResult(_0xdbaa53,null))[_0xa72a('0x45')](handleError(_0xdbaa53,null));};exports[_0xa72a('0x24')]=function(_0x4a0309,_0x222059){return db[_0xa72a('0x2c')][_0xa72a('0x47')]({'where':{'id':_0x4a0309[_0xa72a('0x49')]['id']}})[_0xa72a('0x23')](handleEntityNotFound(_0x222059,null))[_0xa72a('0x23')](removeEntity(_0x222059,null))[_0xa72a('0x45')](handleError(_0x222059,null));};exports[_0xa72a('0x4f')]=function(_0x49690b,_0x368f95,_0x1b1a4f){_0x49690b['body'][_0xa72a('0x28')]=_0x49690b[_0xa72a('0x51')][_0xa72a('0x52')];_0x49690b[_0xa72a('0x4c')][_0xa72a('0x53')]=_0x49690b[_0xa72a('0x51')][_0xa72a('0x54')];_0x49690b[_0xa72a('0x4c')][_0xa72a('0x2f')]=_0x49690b['file'][_0xa72a('0x55')];return db[_0xa72a('0x2c')][_0xa72a('0x4f')](_0x49690b[_0xa72a('0x4c')])[_0xa72a('0x23')](respondWithResult(_0x368f95,0xc9))['catch'](handleError(_0x368f95,null));};exports[_0xa72a('0x56')]=function(_0x387c99,_0x4816a9,_0x527979){return db[_0xa72a('0x2c')][_0xa72a('0x57')]({'where':{'id':_0x387c99[_0xa72a('0x49')]['id']},'raw':!![]})[_0xa72a('0x23')](handleEntityNotFound(_0x4816a9,null))[_0xa72a('0x23')](function(_0x493e46){if(_0x493e46){var _0x4eb3cc=_0x493e46[_0xa72a('0x58')]!==null;var _0x54fe79=path[_0xa72a('0x59')](config[_0xa72a('0x5a')],_0xa72a('0x5b'));if(_0x4eb3cc){_0x54fe79=path[_0xa72a('0x59')](_0x54fe79,_0xa72a('0x5c'));}var _0x19e00f=path[_0xa72a('0x59')](_0x54fe79,_0x493e46[_0xa72a('0x53')]);return _0x4816a9[_0xa72a('0x56')](_0x19e00f);}})['catch'](handleError(_0x4816a9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index efe78e3..9ff6b1a 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 _0x7fac=['bluebird','request-promise','../../config/environment','exports','define','Attachment','lodash','util','../../config/logger','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7fac,0x1e6));var _0xc7fa=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x7fac[_0x478414];return _0x5eb6b9;};'use strict';var _=require(_0xc7fa('0x0'));var util=require(_0xc7fa('0x1'));var logger=require(_0xc7fa('0x2'))('api');var moment=require(_0xc7fa('0x3'));var BPromise=require(_0xc7fa('0x4'));var rp=require(_0xc7fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc7fa('0x6'));var attributes=require('./attachment.attributes');module[_0xc7fa('0x7')]=function(_0x1b33e7,_0x44bbac){return _0x1b33e7[_0xc7fa('0x8')](_0xc7fa('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b12=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Attachment','attachments','lodash','util'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3b12,0x19e));var _0x23b1=function(_0x12f0fd,_0x493307){_0x12f0fd=_0x12f0fd-0x0;var _0x33355d=_0x3b12[_0x12f0fd];return _0x33355d;};'use strict';var _=require(_0x23b1('0x0'));var util=require(_0x23b1('0x1'));var logger=require('../../config/logger')(_0x23b1('0x2'));var moment=require(_0x23b1('0x3'));var BPromise=require(_0x23b1('0x4'));var rp=require(_0x23b1('0x5'));var fs=require('fs');var path=require(_0x23b1('0x6'));var rimraf=require(_0x23b1('0x7'));var config=require(_0x23b1('0x8'));var attributes=require('./attachment.attributes');module[_0x23b1('0x9')]=function(_0x28f6f9,_0x2408a5){return _0x28f6f9[_0x23b1('0xa')](_0x23b1('0xb'),attributes,{'tableName':_0x23b1('0xc'),'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 34c5d63..9741a05 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 _0xb6b1=['raw','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','Attachment,\x20%s,\x20%s','message','info','result','catch','CreateAttachment','Attachment','create','body','options'];(function(_0x4672e9,_0x5caff9){var _0x2407fd=function(_0x41bd9e){while(--_0x41bd9e){_0x4672e9['push'](_0x4672e9['shift']());}};_0x2407fd(++_0x5caff9);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xb6b1[_0x5a2d3f];return _0x5c65d8;};'use strict';var _=require(_0x1b6b('0x0'));var util=require('util');var moment=require(_0x1b6b('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b6b('0x2'));var fs=require('fs');var Redis=require(_0x1b6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b6b('0x4'));var logger=require('../../config/logger')(_0x1b6b('0x5'));var config=require(_0x1b6b('0x6'));var jayson=require(_0x1b6b('0x7'));var client=jayson[_0x1b6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41d09e,_0x51cfed,_0xae4115){return new BPromise(function(_0x5042f7,_0x21f403){return client[_0x1b6b('0x9')](_0x41d09e,_0xae4115)[_0x1b6b('0xa')](function(_0x29258a){logger['info']('Attachment,\x20%s,\x20%s',_0x51cfed,_0x1b6b('0xb'));logger[_0x1b6b('0xc')](_0x1b6b('0xd'),_0x51cfed,_0x1b6b('0xb'),JSON[_0x1b6b('0xe')](_0x29258a));if(_0x29258a[_0x1b6b('0xf')]){if(_0x29258a[_0x1b6b('0xf')]['code']===0x1f4){logger[_0x1b6b('0xf')](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')]['message']);return _0x21f403(_0x29258a[_0x1b6b('0xf')]['message']);}logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);return _0x5042f7(_0x29258a[_0x1b6b('0xf')][_0x1b6b('0x11')]);}else{logger[_0x1b6b('0x12')](_0x1b6b('0x10'),_0x51cfed,'request\x20sent');_0x5042f7(_0x29258a[_0x1b6b('0x13')][_0x1b6b('0x11')]);}})[_0x1b6b('0x14')](function(_0x33dc7e){logger['error'](_0x1b6b('0x10'),_0x51cfed,_0x33dc7e);_0x21f403(_0x33dc7e);});});}exports[_0x1b6b('0x15')]=function(_0x2e608b){var _0x59e671=this;return new Promise(function(_0x923711,_0x15d44b){return db[_0x1b6b('0x16')][_0x1b6b('0x17')](_0x2e608b[_0x1b6b('0x18')],{'raw':_0x2e608b[_0x1b6b('0x19')]?_0x2e608b[_0x1b6b('0x19')][_0x1b6b('0x1a')]===undefined?!![]:![]:!![]})[_0x1b6b('0xa')](function(_0x20a5a3){logger['info'](_0x1b6b('0x15'),_0x2e608b);logger[_0x1b6b('0xc')](_0x1b6b('0x15'),_0x2e608b,JSON[_0x1b6b('0xe')](_0x20a5a3));_0x923711(_0x20a5a3);})[_0x1b6b('0x14')](function(_0x276713){logger[_0x1b6b('0xf')](_0x1b6b('0x15'),_0x276713[_0x1b6b('0x11')],_0x2e608b);_0x15d44b(_0x59e671['error'](0x1f4,_0x276713[_0x1b6b('0x11')]));});});}; \ No newline at end of file +var _0x6a24=['create','body','options','raw','then','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x6a24,0xd1));var _0x46a2=function(_0x4f2694,_0x3c4a1d){_0x4f2694=_0x4f2694-0x0;var _0x53a1a1=_0x6a24[_0x4f2694];return _0x53a1a1;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var moment=require('moment');var BPromise=require(_0x46a2('0x2'));var rs=require(_0x46a2('0x3'));var fs=require('fs');var Redis=require(_0x46a2('0x4'));var db=require(_0x46a2('0x5'))['db'];var utils=require(_0x46a2('0x6'));var logger=require('../../config/logger')(_0x46a2('0x7'));var config=require(_0x46a2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x46a2('0x9')][_0x46a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506698,_0x49870f,_0x2092f3){return new BPromise(function(_0x321b88,_0x587092){return client[_0x46a2('0xb')](_0x506698,_0x2092f3)['then'](function(_0x395578){logger['info'](_0x46a2('0xc'),_0x49870f,_0x46a2('0xd'));logger[_0x46a2('0xe')](_0x46a2('0xf'),_0x49870f,_0x46a2('0xd'),JSON[_0x46a2('0x10')](_0x395578));if(_0x395578[_0x46a2('0x11')]){if(_0x395578[_0x46a2('0x11')]['code']===0x1f4){logger['error'](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')]['message']);return _0x587092(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}logger[_0x46a2('0x11')](_0x46a2('0xc'),_0x49870f,_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);return _0x321b88(_0x395578[_0x46a2('0x11')][_0x46a2('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x49870f,_0x46a2('0xd'));_0x321b88(_0x395578[_0x46a2('0x13')]['message']);}})[_0x46a2('0x14')](function(_0x2d755b){logger['error'](_0x46a2('0xc'),_0x49870f,_0x2d755b);_0x587092(_0x2d755b);});});}exports[_0x46a2('0x15')]=function(_0x577f18){var _0x27250b=this;return new Promise(function(_0x24f75f,_0x529bb5){return db[_0x46a2('0x16')][_0x46a2('0x17')](_0x577f18[_0x46a2('0x18')],{'raw':_0x577f18[_0x46a2('0x19')]?_0x577f18[_0x46a2('0x19')][_0x46a2('0x1a')]===undefined?!![]:![]:!![]})[_0x46a2('0x1b')](function(_0x202294){logger[_0x46a2('0x1c')](_0x46a2('0x15'),_0x577f18);logger[_0x46a2('0xe')](_0x46a2('0x15'),_0x577f18,JSON[_0x46a2('0x10')](_0x202294));_0x24f75f(_0x202294);})['catch'](function(_0xa37d90){logger['error'](_0x46a2('0x15'),_0xa37d90[_0x46a2('0x12')],_0x577f18);_0x529bb5(_0x27250b['error'](0x1f4,_0xa37d90[_0x46a2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ddd3fd8..e126f29 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 _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x354107,_0x57f4f9){var _0x1813e6=function(_0x2fa32e){while(--_0x2fa32e){_0x354107['push'](_0x354107['shift']());}};_0x1813e6(++_0x57f4f9);}(_0xadb5,0xad));var _0x5adb=function(_0x56fe22,_0x58a02f){_0x56fe22=_0x56fe22-0x0;var _0x3eee1e=_0xadb5[_0x56fe22];return _0x3eee1e;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3e80d5,_0x4f0faa){var _0x4fb5c7=function(_0x107ff1){while(--_0x107ff1){_0x3e80d5['push'](_0x3e80d5['shift']());}};_0x4fb5c7(++_0x4f0faa);}(_0x2032,0xd9));var _0x2203=function(_0x438eda,_0x3742c5){_0x438eda=_0x438eda-0x0;var _0x2c743b=_0x2032[_0x438eda];return _0x2c743b;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 61d61ec..342e638 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 _0xf5e8=['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','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blocked','admin','agent','minutes','clearBlockUser','getLicense','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','use','ad-login','User','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url'];(function(_0x408719,_0x44c832){var _0x56fa67=function(_0x531690){while(--_0x531690){_0x408719['push'](_0x408719['shift']());}};_0x56fa67(++_0x44c832);}(_0xf5e8,0xfa));var _0x8f5e=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0xf5e8[_0x47568e];return _0x33815b;};'use strict';var passport=require(_0x8f5e('0x0'));var LocalStrategy=require(_0x8f5e('0x1'))[_0x8f5e('0x2')];var moment=require(_0x8f5e('0x3'));var ActiveDirectory=require(_0x8f5e('0x4'));var BPromise=require('bluebird');var util=require(_0x8f5e('0x5'));var db=require(_0x8f5e('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x8f5e('0x7'));var config=require(_0x8f5e('0x8'));var logger=require(_0x8f5e('0x9'))(_0x8f5e('0xa'));function isActiveDirectoryConfigured(_0x48ed61){var _0x49a02f=![];if(typeof _0x48ed61[_0x8f5e('0xb')]!==_0x8f5e('0xc')){_0x49a02f=_0x48ed61[_0x8f5e('0xb')]['baseDN']&&_0x48ed61[_0x8f5e('0xb')][_0x8f5e('0xd')]&&_0x48ed61[_0x8f5e('0xb')][_0x8f5e('0xe')];}return _0x49a02f;}function adAuthenticate(_0x2d3064,_0x352193,_0x488803){return new BPromise(function(_0x1afc61,_0xfa8aa2){try{var _0xa1642f=new ActiveDirectory(_0x2d3064);_0xa1642f[_0x8f5e('0xf')](_0x352193,_0x488803,function(_0x401607,_0x15796b){if(_0x401607){logger[_0x8f5e('0x10')](_0x8f5e('0x11'),_0x352193,util['inspect'](_0x401607,{'showHidden':![],'depth':null}));_0xfa8aa2(_0x8f5e('0x12'));}else if(!_0x15796b){logger[_0x8f5e('0x10')](_0x8f5e('0x13'),_0x352193);_0xfa8aa2(_0x8f5e('0x12'));}else{_0x1afc61(_0x15796b);}});}catch(_0x3879ad){_0xfa8aa2(_0x3879ad);}});}function ActiveDirectoryAuthenticate(_0x4cc268,_0x35aea9,_0x44d097,_0x21f48e){var _0x1a297e,_0x3efc37;if(!isActiveDirectoryConfigured(config)){logger[_0x8f5e('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x35aea9);return _0x21f48e(null,![],{'message':_0x8f5e('0x12')});}return db['Setting'][_0x8f5e('0x14')]({'where':{'id':0x1},'attributes':[_0x8f5e('0x15'),_0x8f5e('0x16')],'raw':!![]})[_0x8f5e('0x17')](function(_0x4aaf31){_0x1a297e=_0x4aaf31;if(!_0x1a297e['adSsoEnabled']){logger[_0x8f5e('0x10')](_0x8f5e('0x18'),_0x35aea9);throw new Error(_0x8f5e('0x12'));}return _0x4cc268[_0x8f5e('0x14')]({'attributes':['id',_0x8f5e('0x19'),_0x8f5e('0x1a'),'salt',_0x8f5e('0x1b'),_0x8f5e('0x1c'),_0x8f5e('0x1d'),'blockedAt','online'],'where':{'name':_0x35aea9,'role':{'$or':[_0x8f5e('0x1e'),'user',_0x8f5e('0x1f')]},'adSsoEnabled':!![]}});})['then'](function(_0x1488f0){if(!_0x1488f0||_0x1488f0&&_0x1488f0[_0x8f5e('0x19')]!==_0x35aea9){throw new Error(_0x8f5e('0x12'));}_0x3efc37=_0x1488f0;var _0x2fdcda=_0x3efc37[_0x8f5e('0x19')]+'@'+config[_0x8f5e('0xb')][_0x8f5e('0xe')];return adAuthenticate(config[_0x8f5e('0xb')],_0x2fdcda,_0x44d097);})[_0x8f5e('0x17')](function(_0x33bc36){if(_0x3efc37[_0x8f5e('0x1c')]){throw new Error(_0x8f5e('0x12'));}if(_0x1a297e['blockDuration']>0x0){if(_0x3efc37['blocked']){if(moment(_0x3efc37['blockedAt'])['add'](_0x1a297e['blockDuration'],_0x8f5e('0x20'))>moment()){throw new Error(_0x8f5e('0x12'));}return utils[_0x8f5e('0x21')](_0x3efc37,0x0,![],null)[_0x8f5e('0x17')](function(){return utils[_0x8f5e('0x22')](_0x3efc37);})[_0x8f5e('0x17')](function(){return _0x21f48e(null,_0x3efc37);});}else{return utils[_0x8f5e('0x22')](_0x3efc37)[_0x8f5e('0x17')](function(){return _0x21f48e(null,_0x3efc37);});}}else{return utils['getLicense'](_0x3efc37)[_0x8f5e('0x17')](function(){return _0x21f48e(null,_0x3efc37);});}})['catch'](function(_0x42d76f){return _0x21f48e(null,![],_0x42d76f);});}function handleError(_0x21a301,_0x1a0b72,_0x2430e5){return _0x21a301[_0x8f5e('0x23')](_0x1a0b72||0x1f4)[_0x8f5e('0x24')]({'message':_0x2430e5?_0x2430e5['message']||_0x2430e5:''});}exports[_0x8f5e('0x25')]=function(_0x1f6a74,_0x442d76,_0x12ec1f){passport[_0x8f5e('0xf')]('ad-login',function(_0x532ea7,_0x4d7ce9,_0xba3a96){var _0x4b1148=_0x532ea7||_0xba3a96;if(_0x4b1148){return handleError(_0x442d76,0x191,_0x4b1148);}if(!_0x4d7ce9){return handleError(_0x442d76,0x194,{'message':_0x8f5e('0x26')});}else{var _0x1c34b7={'payload':{'id':_0x4d7ce9['id'],'role':_0x4d7ce9[_0x8f5e('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x8f5e('0x27')](_0x1c34b7)[_0x8f5e('0x17')](function(_0x3905c0){_0x442d76['json']({'id':_0x4d7ce9['id'],'token':_0x3905c0,'statusCall':'','isAlreadyLogged':_0x4d7ce9[_0x8f5e('0x28')]});});}})(_0x1f6a74,_0x442d76,_0x12ec1f);};passport[_0x8f5e('0x29')](_0x8f5e('0x2a'),new LocalStrategy({'usernameField':_0x8f5e('0x19'),'passwordField':_0x8f5e('0x1a')},function(_0x3f36d9,_0x2eb85e,_0x7f3361){return ActiveDirectoryAuthenticate(db[_0x8f5e('0x2b')],_0x3f36d9,_0x2eb85e,_0x7f3361);})); \ No newline at end of file +var _0xcd8d=['clearBlockUser','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','passport','passport-local','Strategy','moment','util','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','then','adSsoEnabled','findOne','password','salt','disabled','blocked','online','admin','agent','name','blockDuration','blockedAt','add'];(function(_0x4727f1,_0x2ff773){var _0x2977ce=function(_0x29be89){while(--_0x29be89){_0x4727f1['push'](_0x4727f1['shift']());}};_0x2977ce(++_0x2ff773);}(_0xcd8d,0x13e));var _0xdcd8=function(_0x2f32c4,_0x531dc6){_0x2f32c4=_0x2f32c4-0x0;var _0x3f3018=_0xcd8d[_0x2f32c4];return _0x3f3018;};'use strict';var passport=require(_0xdcd8('0x0'));var LocalStrategy=require(_0xdcd8('0x1'))[_0xdcd8('0x2')];var moment=require(_0xdcd8('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0xdcd8('0x4'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xdcd8('0x5'));var config=require(_0xdcd8('0x6'));var logger=require(_0xdcd8('0x7'))(_0xdcd8('0x8'));function isActiveDirectoryConfigured(_0x18abbd){var _0x2e3281=![];if(typeof _0x18abbd[_0xdcd8('0x9')]!==_0xdcd8('0xa')){_0x2e3281=_0x18abbd[_0xdcd8('0x9')][_0xdcd8('0xb')]&&_0x18abbd[_0xdcd8('0x9')][_0xdcd8('0xc')]&&_0x18abbd[_0xdcd8('0x9')]['domain'];}return _0x2e3281;}function adAuthenticate(_0x4fdf26,_0x421c06,_0x52770d){return new BPromise(function(_0x1fcf72,_0x1f2ff6){try{var _0x2c5616=new ActiveDirectory(_0x4fdf26);_0x2c5616['authenticate'](_0x421c06,_0x52770d,function(_0x8758c7,_0xe6d091){if(_0x8758c7){logger[_0xdcd8('0xd')](_0xdcd8('0xe'),_0x421c06,util[_0xdcd8('0xf')](_0x8758c7,{'showHidden':![],'depth':null}));_0x1f2ff6(_0xdcd8('0x10'));}else if(!_0xe6d091){logger['error'](_0xdcd8('0x11'),_0x421c06);_0x1f2ff6(_0xdcd8('0x10'));}else{_0x1fcf72(_0xe6d091);}});}catch(_0x4f04ca){_0x1f2ff6(_0x4f04ca);}});}function ActiveDirectoryAuthenticate(_0x316ad9,_0x50e768,_0x3b1989,_0xec131b){var _0x1f1372,_0x34fd8a;if(!isActiveDirectoryConfigured(config)){logger[_0xdcd8('0xd')](_0xdcd8('0x12'),_0x50e768);return _0xec131b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xdcd8('0x13')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0xdcd8('0x14')](function(_0x193d03){_0x1f1372=_0x193d03;if(!_0x1f1372[_0xdcd8('0x15')]){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x50e768);throw new Error(_0xdcd8('0x10'));}return _0x316ad9[_0xdcd8('0x16')]({'attributes':['id','name',_0xdcd8('0x17'),_0xdcd8('0x18'),'role',_0xdcd8('0x19'),_0xdcd8('0x1a'),'blockedAt',_0xdcd8('0x1b')],'where':{'name':_0x50e768,'role':{'$or':[_0xdcd8('0x1c'),'user',_0xdcd8('0x1d')]},'adSsoEnabled':!![]}});})[_0xdcd8('0x14')](function(_0x172bca){if(!_0x172bca||_0x172bca&&_0x172bca['name']!==_0x50e768){throw new Error(_0xdcd8('0x10'));}_0x34fd8a=_0x172bca;var _0x75a381=_0x34fd8a[_0xdcd8('0x1e')]+'@'+config[_0xdcd8('0x9')]['domain'];return adAuthenticate(config[_0xdcd8('0x9')],_0x75a381,_0x3b1989);})['then'](function(_0x3912e5){if(_0x34fd8a[_0xdcd8('0x19')]){throw new Error(_0xdcd8('0x10'));}if(_0x1f1372[_0xdcd8('0x1f')]>0x0){if(_0x34fd8a[_0xdcd8('0x1a')]){if(moment(_0x34fd8a[_0xdcd8('0x20')])[_0xdcd8('0x21')](_0x1f1372['blockDuration'],'minutes')>moment()){throw new Error(_0xdcd8('0x10'));}return utils[_0xdcd8('0x22')](_0x34fd8a,0x0,![],null)[_0xdcd8('0x14')](function(){return utils[_0xdcd8('0x23')](_0x34fd8a);})[_0xdcd8('0x14')](function(){return _0xec131b(null,_0x34fd8a);});}else{return utils[_0xdcd8('0x23')](_0x34fd8a)['then'](function(){return _0xec131b(null,_0x34fd8a);});}}else{return utils[_0xdcd8('0x23')](_0x34fd8a)['then'](function(){return _0xec131b(null,_0x34fd8a);});}})[_0xdcd8('0x24')](function(_0x36816b){return _0xec131b(null,![],_0x36816b);});}function handleError(_0x3341ce,_0x5f2200,_0xa18d09){return _0x3341ce[_0xdcd8('0x25')](_0x5f2200||0x1f4)[_0xdcd8('0x26')]({'message':_0xa18d09?_0xa18d09['message']||_0xa18d09:''});}exports[_0xdcd8('0x27')]=function(_0x2d5778,_0x23d501,_0x505abe){passport['authenticate'](_0xdcd8('0x28'),function(_0xe7747b,_0x4f3ec5,_0x3a7663){var _0x10d625=_0xe7747b||_0x3a7663;if(_0x10d625){return handleError(_0x23d501,0x191,_0x10d625);}if(!_0x4f3ec5){return handleError(_0x23d501,0x194,{'message':_0xdcd8('0x29')});}else{var _0xca743e={'payload':{'id':_0x4f3ec5['id'],'role':_0x4f3ec5['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xca743e)['then'](function(_0x2b3963){_0x23d501[_0xdcd8('0x2a')]({'id':_0x4f3ec5['id'],'token':_0x2b3963,'statusCall':'','isAlreadyLogged':_0x4f3ec5[_0xdcd8('0x1b')]});});}})(_0x2d5778,_0x23d501,_0x505abe);};passport[_0xdcd8('0x2b')](_0xdcd8('0x28'),new LocalStrategy({'usernameField':_0xdcd8('0x1e'),'passwordField':_0xdcd8('0x17')},function(_0x271eb6,_0x946aab,_0x56d581){return ActiveDirectoryAuthenticate(db['User'],_0x271eb6,_0x946aab,_0x56d581);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a1b1658..75883ea 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 _0x2cf4=['login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x214f40,_0x17e44b){var _0x22a380=function(_0x47a1c6){while(--_0x47a1c6){_0x214f40['push'](_0x214f40['shift']());}};_0x22a380(++_0x17e44b);}(_0x2cf4,0x11f));var _0x42cf=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x2cf4[_0x3cb3ca];return _0x214366;};'use strict';var express=require(_0x42cf('0x0'));var router=express[_0x42cf('0x1')]();var controller=require(_0x42cf('0x2'));router['post']('/',controller[_0x42cf('0x3')]);module[_0x42cf('0x4')]=router; \ No newline at end of file +var _0xb50b=['login','exports','express','./authActiveDirectory.controller'];(function(_0x7c43a9,_0x2ed443){var _0x573edb=function(_0x2be93d){while(--_0x2be93d){_0x7c43a9['push'](_0x7c43a9['shift']());}};_0x573edb(++_0x2ed443);}(_0xb50b,0x15a));var _0xbb50=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0xb50b[_0x319cb9];return _0x1735fc;};'use strict';var express=require(_0xbb50('0x0'));var router=express['Router']();var controller=require(_0xbb50('0x1'));router['post']('/',controller[_0xbb50('0x2')]);module[_0xbb50('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 95a7446..cc46ef1 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x23603,_0x281eee){var _0x2357a1=function(_0x265b78){while(--_0x265b78){_0x23603['push'](_0x23603['shift']());}};_0x2357a1(++_0x281eee);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x7a54,0x106));var _0x47a5=function(_0x595630,_0x904aeb){_0x595630=_0x595630-0x0;var _0x2464ec=_0x7a54[_0x595630];return _0x2464ec;};'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 ee6e203..a1ed68e 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 _0x64d7=['setTokenCookie','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback'];(function(_0x32b3b2,_0x4571ca){var _0x3f42cc=function(_0x170106){while(--_0x170106){_0x32b3b2['push'](_0x32b3b2['shift']());}};_0x3f42cc(++_0x4571ca);}(_0x64d7,0x19f));var _0x764d=function(_0xbb4325,_0x293598){_0xbb4325=_0xbb4325-0x0;var _0xf7423a=_0x64d7[_0xbb4325];return _0xf7423a;};'use strict';var express=require(_0x764d('0x0'));var passport=require('passport');var router=express[_0x764d('0x1')]();var controller=require(_0x764d('0x2'));var userController=require(_0x764d('0x3'));var authService=require(_0x764d('0x4'));router[_0x764d('0x5')]('/',controller[_0x764d('0x6')]);router[_0x764d('0x5')]('/callback',controller[_0x764d('0x7')],authService['isMiddleware'],userController[_0x764d('0x6')],authService[_0x764d('0x8')]);module['exports']=router; \ No newline at end of file +var _0xbd3a=['login','/callback','callback','isMiddleware','setTokenCookie','passport','Router','./authGoogle.controller','../../components/auth/service','get'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xbd3a,0x1e5));var _0xabd3=function(_0x420348,_0x42038c){_0x420348=_0x420348-0x0;var _0x2c09e5=_0xbd3a[_0x420348];return _0x2c09e5;};'use strict';var express=require('express');var passport=require(_0xabd3('0x0'));var router=express[_0xabd3('0x1')]();var controller=require(_0xabd3('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xabd3('0x3'));router[_0xabd3('0x4')]('/',controller[_0xabd3('0x5')]);router[_0xabd3('0x4')](_0xabd3('0x6'),controller[_0xabd3('0x7')],authService[_0xabd3('0x8')],userController[_0xabd3('0x5')],authService[_0xabd3('0x9')]);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 97a102f..9b22476 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 _0xa237=['merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','message','status','login','authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','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','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','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','use','local-login','util','Strategy','jayson/promise','lodash','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions'];(function(_0x2e3531,_0x1f0a91){var _0x39f792=function(_0x453003){while(--_0x453003){_0x2e3531['push'](_0x2e3531['shift']());}};_0x39f792(++_0x1f0a91);}(_0xa237,0x7c));var _0x7a23=function(_0x12524e,_0x28d790){_0x12524e=_0x12524e-0x0;var _0x6274e=_0xa237[_0x12524e];return _0x6274e;};'use strict';var util=require(_0x7a23('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x7a23('0x1')];var jayson=require(_0x7a23('0x2'));var _=require(_0x7a23('0x3'));var rs=require(_0x7a23('0x4'));var moment=require(_0x7a23('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x7a23('0x6'));var utils=require(_0x7a23('0x7'));var client=jayson[_0x7a23('0x8')][_0x7a23('0x9')]({'port':0x232b});function localAuthenticate(_0x40e9a3,_0x20f11d,_0x1f8a97,_0x337eff){var _0x232784,_0x59100e;return db[_0x7a23('0xa')][_0x7a23('0xb')]({'where':{'id':0x1},'attributes':[_0x7a23('0xc'),_0x7a23('0xd')],'raw':!![]})[_0x7a23('0xe')](function(_0x5a8c2d){_0x232784=_0x5a8c2d;return _0x40e9a3[_0x7a23('0xb')]({'attributes':['id',_0x7a23('0xf'),_0x7a23('0x10'),'salt',_0x7a23('0x11'),'disabled',_0x7a23('0x12'),_0x7a23('0x13'),_0x7a23('0x14')],'where':{'name':_0x20f11d,'role':{'$or':[_0x7a23('0x15'),_0x7a23('0x16'),_0x7a23('0x17')]}}});})['then'](function(_0x5177aa){if(!_0x5177aa||_0x5177aa&&_0x5177aa[_0x7a23('0xf')]!==_0x20f11d){throw new Error(_0x7a23('0x18'));}else{_0x59100e=_0x5177aa;return _0x59100e;}})['then'](function(){_0x59100e['authenticate'](_0x1f8a97,function(_0x3d010a,_0x10f458){var _0x5b5637=_0x59100e[_0x7a23('0x14')]+0x1;if(_0x3d010a){return _0x337eff(_0x3d010a);}else if(!_0x10f458){if(_0x59100e[_0x7a23('0x19')]){return _0x337eff(null,![],{'message':_0x7a23('0x18')});}else if(_0x232784['allowedLoginAttempts']>0x0){if(_0x59100e[_0x7a23('0x12')]){if(_0x232784[_0x7a23('0xd')]>0x0){if(moment(_0x59100e['blockedAt'])[_0x7a23('0x1a')](_0x232784[_0x7a23('0xd')],_0x7a23('0x1b'))>moment()){return _0x337eff(null,![],{'message':_0x7a23('0x18')});}else{return utils[_0x7a23('0x1c')](_0x59100e,_0x5b5637,![],null)[_0x7a23('0xe')](function(){return _0x337eff(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x337eff(null,![],{'message':_0x7a23('0x18')});}}else{if(_0x5b5637>=_0x232784[_0x7a23('0xc')]){return utils[_0x7a23('0x1c')](_0x59100e,0x0,!![],moment())[_0x7a23('0xe')](function(){return _0x337eff(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x7a23('0x1c')](_0x59100e,_0x5b5637,![],null)[_0x7a23('0xe')](function(){return _0x337eff(null,![],{'message':_0x7a23('0x18')});});}}}else{return _0x337eff(null,![],{'message':_0x7a23('0x18')});}}else{if(_0x59100e[_0x7a23('0x19')]){return _0x337eff(null,![],{'message':_0x7a23('0x18')});}else if(_0x232784['allowedLoginAttempts']>0x0){if(_0x59100e[_0x7a23('0x12')]){if(_0x232784[_0x7a23('0xd')]>0x0){if(moment(_0x59100e[_0x7a23('0x13')])[_0x7a23('0x1a')](_0x232784['blockDuration'],'minutes')>moment()){return _0x337eff(null,![],{'message':_0x7a23('0x18')});}else{return utils['clearBlockUser'](_0x59100e,0x0,![],null)[_0x7a23('0xe')](function(){return utils[_0x7a23('0x1d')](_0x59100e);})[_0x7a23('0xe')](function(){return _0x337eff(null,_0x59100e);});}}else{return _0x337eff(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x7a23('0x1c')](_0x59100e,0x0,![],null)[_0x7a23('0xe')](function(){return utils['getLicense'](_0x59100e);})[_0x7a23('0xe')](function(){return _0x337eff(null,_0x59100e);})[_0x7a23('0x1e')](function(_0x4f0e1a){return _0x337eff(null,![],_0x4f0e1a);});}}else{if(_0x59100e['blocked']){return _0x337eff(null,![],{'message':_0x7a23('0x18')});}else{return utils[_0x7a23('0x1d')](_0x59100e)[_0x7a23('0xe')](function(){return _0x337eff(null,_0x59100e);});}}}});})[_0x7a23('0x1e')](function(_0x5d70d4){return _0x337eff(null,![],_0x5d70d4);});}function sendServiceMail(_0x1a55e6){return db[_0x7a23('0x1f')][_0x7a23('0x20')]({'where':{'service':!![]},'attributes':['id',_0x7a23('0xf'),_0x7a23('0x21')],'include':[{'model':db[_0x7a23('0x22')],'as':_0x7a23('0x23'),'include':[{'model':db[_0x7a23('0x24')],'as':_0x7a23('0x24')}]}]})[_0x7a23('0xe')](function(_0x2bf609){if(!_0x2bf609){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1fa127=_0x2bf609[_0x7a23('0x25')]();var _0x2a0eb1={'account':_0x1fa127,'message':_[_0x7a23('0x26')]({'from':util['format'](_0x7a23('0x27'),_0x2bf609[_0x7a23('0xf')],_0x2bf609[_0x7a23('0x21')]||_0x2bf609[_0x7a23('0x23')]['user'])},_0x1a55e6)};return client[_0x7a23('0x28')](_0x7a23('0x29'),_0x2a0eb1);})[_0x7a23('0xe')](function(_0x5c42b8){if(_0x5c42b8[_0x7a23('0x2a')]){throw new Error(util[_0x7a23('0x2b')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x5c42b8[_0x7a23('0x2a')][_0x7a23('0x2c')]||JSON['stringify'](_0x5c42b8['error'])));}return!![];});}function handleError(_0x45f19c,_0x31b285,_0x5e18f6){return _0x45f19c[_0x7a23('0x2d')](_0x31b285||0x1f4)['send']({'message':_0x5e18f6?_0x5e18f6[_0x7a23('0x2c')]||_0x5e18f6:''});}exports[_0x7a23('0x2e')]=function(_0x582ec2,_0x14d23b,_0x5a390a){passport[_0x7a23('0x2f')]('local-login',function(_0x4d17b6,_0x5dc53c,_0x37b939){var _0x2adcf6=_0x4d17b6||_0x37b939;if(_0x2adcf6){return handleError(_0x14d23b,0x191,_0x2adcf6);}if(!_0x5dc53c){return handleError(_0x14d23b,0x194,{'message':_0x7a23('0x30')});}else{var _0x48e73b={'payload':{'id':_0x5dc53c['id'],'role':_0x5dc53c[_0x7a23('0x11')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x48e73b)['then'](function(_0x592b17){_0x14d23b[_0x7a23('0x31')]({'id':_0x5dc53c['id'],'token':_0x592b17,'statusCall':'','isAlreadyLogged':_0x5dc53c[_0x7a23('0x32')]});});}})(_0x582ec2,_0x14d23b,_0x5a390a);};exports[_0x7a23('0x33')]=function(_0x777331,_0x2818ca){if(!_0x777331[_0x7a23('0x34')][_0x7a23('0x21')]){return handleError(_0x2818ca,0x1f4,{'message':_0x7a23('0x35')});}var _0x5d652f=rs[_0x7a23('0x36')]();_0x777331['body']['email']=_0x777331[_0x7a23('0x34')][_0x7a23('0x21')]['trim']()[_0x7a23('0x37')]();var _0x544d1b;return db[_0x7a23('0xa')][_0x7a23('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x7a23('0xd')],'raw':!![]})[_0x7a23('0xe')](function(_0x3a43fc){_0x544d1b=_0x3a43fc;return db[_0x7a23('0x38')]['find']({'where':{'email':_0x777331[_0x7a23('0x34')]['email']}});})[_0x7a23('0xe')](function(_0xfe9755){if(!_0xfe9755){throw new Error(_0x7a23('0x39'));}if(_0xfe9755[_0x7a23('0x19')]){throw new Error(_0x7a23('0x3a'));}if(_0xfe9755[_0x7a23('0x12')]){if(moment(_0xfe9755[_0x7a23('0x13')])[_0x7a23('0x1a')](_0x544d1b['blockDuration'],_0x7a23('0x1b'))>moment()){throw new Error(_0x7a23('0x3b'));}else{_0xfe9755['blocked']=![];_0xfe9755[_0x7a23('0x13')]=null;}}_0xfe9755[_0x7a23('0x3c')]=_0x5d652f;_0xfe9755[_0x7a23('0x3d')]=Date[_0x7a23('0x3e')]()+0x36ee80;return _0xfe9755[_0x7a23('0x3f')]();})[_0x7a23('0xe')](function(){return sendServiceMail({'to':_0x777331[_0x7a23('0x34')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7a23('0x40')+_0x7a23('0x41')+_0x777331[_0x7a23('0x42')][_0x7a23('0x43')]+_0x7a23('0x44')+_0x5d652f+'\x0a\x0a'+_0x7a23('0x45')});})[_0x7a23('0xe')](function(){_0x2818ca[_0x7a23('0x2d')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0xbe786d){return handleError(_0x2818ca,0x1f4,_0xbe786d);});};exports[_0x7a23('0x46')]=function(_0x2ed2cf,_0x451dbb){return db[_0x7a23('0x38')][_0x7a23('0x20')]({'where':{'resetPasswordToken':_0x2ed2cf[_0x7a23('0x47')][_0x7a23('0x48')],'resetPasswordExpires':{'$gt':Date[_0x7a23('0x3e')]()}}})['then'](function(_0x5641a1){if(!_0x5641a1){throw new Error(_0x7a23('0x49'));}return db['Setting']['findOne']({'attributes':['id','securePassword',_0x7a23('0x4a'),'passwordHistoryLimit']})[_0x7a23('0xe')](function(_0x573aa4){if(_0x573aa4['securePassword'])authService[_0x7a23('0x4b')](_0x2ed2cf[_0x7a23('0x34')]['password']);if(!_0x573aa4[_0x7a23('0x4a')]||!_0x5641a1[_0x7a23('0x4c')])return _0x5641a1;authService[_0x7a23('0x4d')](_0x2ed2cf[_0x7a23('0x34')][_0x7a23('0x10')],_0x5641a1[_0x7a23('0x4c')],_0x573aa4[_0x7a23('0x4e')]);return _0x5641a1;})[_0x7a23('0xe')](function(){_0x5641a1[_0x7a23('0x10')]=_0x2ed2cf[_0x7a23('0x34')][_0x7a23('0x10')];_0x5641a1[_0x7a23('0x3c')]=null;_0x5641a1[_0x7a23('0x3d')]=null;return _0x5641a1['save']();});})[_0x7a23('0xe')](function(){_0x451dbb[_0x7a23('0x2d')](0xc8)['send']({'message':'Password\x20reset!'});})[_0x7a23('0x1e')](function(_0x102a1c){return handleError(_0x451dbb,0x1f4,_0x102a1c);});};passport[_0x7a23('0x4f')](_0x7a23('0x50'),new LocalStrategy({'usernameField':_0x7a23('0xf'),'passwordField':_0x7a23('0x10')},function(_0x2f0531,_0x5f4c28,_0x2182d6){return localAuthenticate(db['User'],_0x2f0531,_0x5f4c28,_0x2182d6);})); \ No newline at end of file +var _0xed4f=['signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','validatePasswordHistory','passwordHistoryLimit','save','Password\x20reset!','use','util','passport','passport-local','jayson/promise','lodash','../../config/utils','http','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','blockedAt','loginAttempts','agent','authenticate','blocked','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','disabled','add','minutes','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login'];(function(_0x416c14,_0x8f64df){var _0x13a057=function(_0x4131b2){while(--_0x4131b2){_0x416c14['push'](_0x416c14['shift']());}};_0x13a057(++_0x8f64df);}(_0xed4f,0x111));var _0xfed4=function(_0x5d9024,_0x213750){_0x5d9024=_0x5d9024-0x0;var _0x6e7987=_0xed4f[_0x5d9024];return _0x6e7987;};'use strict';var util=require(_0xfed4('0x0'));var passport=require(_0xfed4('0x1'));var LocalStrategy=require(_0xfed4('0x2'))['Strategy'];var jayson=require(_0xfed4('0x3'));var _=require(_0xfed4('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xfed4('0x5'));var client=jayson['client'][_0xfed4('0x6')]({'port':0x232b});function localAuthenticate(_0x4f82d1,_0x1312de,_0x5d6685,_0x1cfb5e){var _0x45203a,_0x510943;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xfed4('0x7'),_0xfed4('0x8')],'raw':!![]})[_0xfed4('0x9')](function(_0x4c171a){_0x45203a=_0x4c171a;return _0x4f82d1[_0xfed4('0xa')]({'attributes':['id',_0xfed4('0xb'),_0xfed4('0xc'),_0xfed4('0xd'),_0xfed4('0xe'),'disabled','blocked',_0xfed4('0xf'),_0xfed4('0x10')],'where':{'name':_0x1312de,'role':{'$or':['admin','user',_0xfed4('0x11')]}}});})[_0xfed4('0x9')](function(_0x5b9030){if(!_0x5b9030||_0x5b9030&&_0x5b9030[_0xfed4('0xb')]!==_0x1312de){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x510943=_0x5b9030;return _0x510943;}})[_0xfed4('0x9')](function(){_0x510943[_0xfed4('0x12')](_0x5d6685,function(_0x10251b,_0x5b7558){var _0x261ab8=_0x510943[_0xfed4('0x10')]+0x1;if(_0x10251b){return _0x1cfb5e(_0x10251b);}else if(!_0x5b7558){if(_0x510943['disabled']){return _0x1cfb5e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x45203a['allowedLoginAttempts']>0x0){if(_0x510943[_0xfed4('0x13')]){if(_0x45203a[_0xfed4('0x8')]>0x0){if(moment(_0x510943[_0xfed4('0xf')])['add'](_0x45203a['blockDuration'],'minutes')>moment()){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});}else{return utils[_0xfed4('0x15')](_0x510943,_0x261ab8,![],null)[_0xfed4('0x9')](function(){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});});}}else{return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});}}else{if(_0x261ab8>=_0x45203a[_0xfed4('0x7')]){return utils[_0xfed4('0x15')](_0x510943,0x0,!![],moment())['then'](function(){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});});}else{return utils[_0xfed4('0x15')](_0x510943,_0x261ab8,![],null)['then'](function(){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});});}}}else{return _0x1cfb5e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x510943[_0xfed4('0x16')]){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});}else if(_0x45203a[_0xfed4('0x7')]>0x0){if(_0x510943[_0xfed4('0x13')]){if(_0x45203a['blockDuration']>0x0){if(moment(_0x510943[_0xfed4('0xf')])[_0xfed4('0x17')](_0x45203a[_0xfed4('0x8')],_0xfed4('0x18'))>moment()){return _0x1cfb5e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xfed4('0x15')](_0x510943,0x0,![],null)[_0xfed4('0x9')](function(){return utils['getLicense'](_0x510943);})[_0xfed4('0x9')](function(){return _0x1cfb5e(null,_0x510943);});}}else{return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});}}else{return utils[_0xfed4('0x15')](_0x510943,0x0,![],null)[_0xfed4('0x9')](function(){return utils[_0xfed4('0x19')](_0x510943);})[_0xfed4('0x9')](function(){return _0x1cfb5e(null,_0x510943);})[_0xfed4('0x1a')](function(_0x5313e4){return _0x1cfb5e(null,![],_0x5313e4);});}}else{if(_0x510943[_0xfed4('0x13')]){return _0x1cfb5e(null,![],{'message':_0xfed4('0x14')});}else{return utils[_0xfed4('0x19')](_0x510943)[_0xfed4('0x9')](function(){return _0x1cfb5e(null,_0x510943);});}}}});})[_0xfed4('0x1a')](function(_0x976a9){return _0x1cfb5e(null,![],_0x976a9);});}function sendServiceMail(_0x5f3899){return db[_0xfed4('0x1b')][_0xfed4('0x1c')]({'where':{'service':!![]},'attributes':['id','name',_0xfed4('0x1d')],'include':[{'model':db['MailServerOut'],'as':_0xfed4('0x1e'),'include':[{'model':db['CloudProvider'],'as':_0xfed4('0x1f')}]}]})[_0xfed4('0x9')](function(_0x236359){if(!_0x236359){throw new Error(_0xfed4('0x20'));}var _0x3095fe=_0x236359[_0xfed4('0x21')]();var _0x1eb961={'account':_0x3095fe,'message':_[_0xfed4('0x22')]({'from':util[_0xfed4('0x23')](_0xfed4('0x24'),_0x236359[_0xfed4('0xb')],_0x236359[_0xfed4('0x1d')]||_0x236359['Smtp']['user'])},_0x5f3899)};return client[_0xfed4('0x25')](_0xfed4('0x26'),_0x1eb961);})['then'](function(_0x23f051){if(_0x23f051[_0xfed4('0x27')]){throw new Error(util['format'](_0xfed4('0x28'),_0x23f051[_0xfed4('0x27')][_0xfed4('0x29')]||JSON[_0xfed4('0x2a')](_0x23f051[_0xfed4('0x27')])));}return!![];});}function handleError(_0x35afa2,_0x117636,_0x15d519){return _0x35afa2[_0xfed4('0x2b')](_0x117636||0x1f4)[_0xfed4('0x2c')]({'message':_0x15d519?_0x15d519['message']||_0x15d519:''});}exports[_0xfed4('0x2d')]=function(_0x581157,_0x3766ed,_0x2192bb){passport[_0xfed4('0x12')](_0xfed4('0x2e'),function(_0x28d505,_0x429833,_0x586557){var _0x15fd68=_0x28d505||_0x586557;if(_0x15fd68){return handleError(_0x3766ed,0x191,_0x15fd68);}if(!_0x429833){return handleError(_0x3766ed,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3fd64c={'payload':{'id':_0x429833['id'],'role':_0x429833[_0xfed4('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xfed4('0x2f')](_0x3fd64c)[_0xfed4('0x9')](function(_0xe4b1b5){_0x3766ed[_0xfed4('0x30')]({'id':_0x429833['id'],'token':_0xe4b1b5,'statusCall':'','isAlreadyLogged':_0x429833[_0xfed4('0x31')]});});}})(_0x581157,_0x3766ed,_0x2192bb);};exports['forgot']=function(_0x9c26da,_0x85b335){if(!_0x9c26da[_0xfed4('0x32')][_0xfed4('0x1d')]){return handleError(_0x85b335,0x1f4,{'message':_0xfed4('0x33')});}var _0x2a2f04=rs[_0xfed4('0x34')]();_0x9c26da[_0xfed4('0x32')][_0xfed4('0x1d')]=_0x9c26da[_0xfed4('0x32')][_0xfed4('0x1d')][_0xfed4('0x35')]()[_0xfed4('0x36')]();var _0x544ed7;return db[_0xfed4('0x37')]['findOne']({'where':{'id':0x1},'attributes':[_0xfed4('0x7'),_0xfed4('0x8')],'raw':!![]})['then'](function(_0x185075){_0x544ed7=_0x185075;return db[_0xfed4('0x38')]['find']({'where':{'email':_0x9c26da[_0xfed4('0x32')][_0xfed4('0x1d')]}});})[_0xfed4('0x9')](function(_0x3f99bd){if(!_0x3f99bd){throw new Error(_0xfed4('0x39'));}if(_0x3f99bd[_0xfed4('0x16')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3f99bd['blocked']){if(moment(_0x3f99bd['blockedAt'])[_0xfed4('0x17')](_0x544ed7[_0xfed4('0x8')],_0xfed4('0x18'))>moment()){throw new Error(_0xfed4('0x3a'));}else{_0x3f99bd['blocked']=![];_0x3f99bd['blockedAt']=null;}}_0x3f99bd[_0xfed4('0x3b')]=_0x2a2f04;_0x3f99bd[_0xfed4('0x3c')]=Date[_0xfed4('0x3d')]()+0x36ee80;return _0x3f99bd['save']();})['then'](function(){return sendServiceMail({'to':_0x9c26da[_0xfed4('0x32')][_0xfed4('0x1d')],'subject':_0xfed4('0x3e'),'text':_0xfed4('0x3f')+_0xfed4('0x40')+'https://'+_0x9c26da[_0xfed4('0x41')]['host']+_0xfed4('0x42')+_0x2a2f04+'\x0a\x0a'+_0xfed4('0x43')});})[_0xfed4('0x9')](function(){_0x85b335[_0xfed4('0x2b')](0xc8)[_0xfed4('0x2c')]({'message':_0xfed4('0x44')});})[_0xfed4('0x1a')](function(_0x18181f){return handleError(_0x85b335,0x1f4,_0x18181f);});};exports[_0xfed4('0x45')]=function(_0x344653,_0x42713d){return db[_0xfed4('0x38')][_0xfed4('0x1c')]({'where':{'resetPasswordToken':_0x344653['params'][_0xfed4('0x46')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xfed4('0x9')](function(_0x42cd3e){if(!_0x42cd3e){throw new Error(_0xfed4('0x47'));}return db[_0xfed4('0x37')][_0xfed4('0xa')]({'attributes':['id',_0xfed4('0x48'),_0xfed4('0x49'),'passwordHistoryLimit']})['then'](function(_0x1b411e){if(_0x1b411e[_0xfed4('0x48')])authService[_0xfed4('0x4a')](_0x344653[_0xfed4('0x32')][_0xfed4('0xc')]);if(!_0x1b411e[_0xfed4('0x49')]||!_0x42cd3e['previousPasswords'])return _0x42cd3e;authService[_0xfed4('0x4b')](_0x344653['body']['password'],_0x42cd3e['previousPasswords'],_0x1b411e[_0xfed4('0x4c')]);return _0x42cd3e;})[_0xfed4('0x9')](function(){_0x42cd3e[_0xfed4('0xc')]=_0x344653[_0xfed4('0x32')][_0xfed4('0xc')];_0x42cd3e[_0xfed4('0x3b')]=null;_0x42cd3e[_0xfed4('0x3c')]=null;return _0x42cd3e[_0xfed4('0x4d')]();});})['then'](function(){_0x42713d['status'](0xc8)[_0xfed4('0x2c')]({'message':_0xfed4('0x4e')});})[_0xfed4('0x1a')](function(_0x48329d){return handleError(_0x42713d,0x1f4,_0x48329d);});};passport[_0xfed4('0x4f')]('local-login',new LocalStrategy({'usernameField':_0xfed4('0xb'),'passwordField':_0xfed4('0xc')},function(_0xe2874e,_0x31fc23,_0x3dbdab){return localAuthenticate(db[_0xfed4('0x38')],_0xe2874e,_0x31fc23,_0x3dbdab);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 51f4aa4..61672c2 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 _0x0d6a=['/reset/:token','reset','exports','express','Router','./authLocal.controller','post','/forgot','forgot'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0d6a,0x186));var _0xa0d6=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x0d6a[_0x4b2863];return _0x567d67;};'use strict';var express=require(_0xa0d6('0x0'));var router=express[_0xa0d6('0x1')]();var controller=require(_0xa0d6('0x2'));router[_0xa0d6('0x3')]('/',controller['login']);router[_0xa0d6('0x3')](_0xa0d6('0x4'),controller[_0xa0d6('0x5')]);router[_0xa0d6('0x3')](_0xa0d6('0x6'),controller[_0xa0d6('0x7')]);module[_0xa0d6('0x8')]=router; \ No newline at end of file +var _0x2bf6=['exports','express','Router','post','/forgot','forgot','/reset/:token','reset'];(function(_0x4da736,_0x55e2b1){var _0x270d2e=function(_0x1f97bf){while(--_0x1f97bf){_0x4da736['push'](_0x4da736['shift']());}};_0x270d2e(++_0x55e2b1);}(_0x2bf6,0xd1));var _0x62bf=function(_0x49fc33,_0x471664){_0x49fc33=_0x49fc33-0x0;var _0x5cf941=_0x2bf6[_0x49fc33];return _0x5cf941;};'use strict';var express=require(_0x62bf('0x0'));var router=express[_0x62bf('0x1')]();var controller=require('./authLocal.controller');router[_0x62bf('0x2')]('/',controller['login']);router[_0x62bf('0x2')](_0x62bf('0x3'),controller[_0x62bf('0x4')]);router['post'](_0x62bf('0x5'),controller[_0x62bf('0x6')]);module[_0x62bf('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 b4e58b6..23e52cb 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 _0x8848=['BOOLEAN','INTEGER','STRING'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x8848,0x188));var _0x8884=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0x8848[_0x173f10];return _0x53142d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8884('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x8884('0x0')]},'description':{'type':Sequelize[_0x8884('0x0')]},'status':{'type':Sequelize[_0x8884('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8884('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0xea19=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x58ff8e,_0x39fe0d){var _0x701683=function(_0x163930){while(--_0x163930){_0x58ff8e['push'](_0x58ff8e['shift']());}};_0x701683(++_0x39fe0d);}(_0xea19,0x1ca));var _0x9ea1=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xea19[_0x1e3671];return _0x48d5f5;};'use strict';var Sequelize=require(_0x9ea1('0x0'));module[_0x9ea1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x9ea1('0x2')]},'description':{'type':Sequelize[_0x9ea1('0x2')]},'status':{'type':Sequelize[_0x9ea1('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9ea1('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index fec9b1f..3edf3cb 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 _0x1c1b=['limit','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','Condition','ids','omit','getConditions','findOne','order','hasOwnProperty','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','status','stack','name','send','map','Automation','fieldName','type','key','keys','query','intersection','model','attributes','fields','length'];(function(_0x2797bc,_0x3617b0){var _0x24a66c=function(_0x2bc0ff){while(--_0x2bc0ff){_0x2797bc['push'](_0x2797bc['shift']());}};_0x24a66c(++_0x3617b0);}(_0x1c1b,0xc8));var _0xb1c1=function(_0x428dad,_0x7ff665){_0x428dad=_0x428dad-0x0;var _0x4d112f=_0x1c1b[_0x428dad];return _0x4d112f;};'use strict';var emlformat=require(_0xb1c1('0x0'));var rimraf=require(_0xb1c1('0x1'));var zipdir=require(_0xb1c1('0x2'));var jsonpatch=require(_0xb1c1('0x3'));var rp=require(_0xb1c1('0x4'));var moment=require(_0xb1c1('0x5'));var BPromise=require(_0xb1c1('0x6'));var Mustache=require(_0xb1c1('0x7'));var util=require(_0xb1c1('0x8'));var path=require(_0xb1c1('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1c1('0xa'));var _=require(_0xb1c1('0xb'));var squel=require(_0xb1c1('0xc'));var crypto=require(_0xb1c1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb1c1('0xe'));var querystring=require(_0xb1c1('0xf'));var Papa=require('papaparse');var Redis=require(_0xb1c1('0x10'));var authService=require(_0xb1c1('0x11'));var qs=require(_0xb1c1('0x12'));var as=require(_0xb1c1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1c1('0x14'))(_0xb1c1('0x15'));var utils=require(_0xb1c1('0x16'));var config=require(_0xb1c1('0x17'));var licenseUtil=require(_0xb1c1('0x18'));var db=require(_0xb1c1('0x19'))['db'];function respondWithStatusCode(_0x4e55e7,_0x2b52b5){_0x2b52b5=_0x2b52b5||0xcc;return function(_0x2fdd7e){if(_0x2fdd7e){return _0x4e55e7[_0xb1c1('0x1a')](_0x2b52b5);}return _0x4e55e7['status'](_0x2b52b5)[_0xb1c1('0x1b')]();};}function respondWithResult(_0x54397f,_0x1d1ec4){_0x1d1ec4=_0x1d1ec4||0xc8;return function(_0x419f4e){if(_0x419f4e){return _0x54397f['status'](_0x1d1ec4)[_0xb1c1('0x1c')](_0x419f4e);}};}function respondWithFilteredResult(_0x2f8c31,_0x57182c){return function(_0x3db660){if(_0x3db660){var _0x18c2f5=typeof _0x57182c[_0xb1c1('0x1d')]===_0xb1c1('0x1e')&&typeof _0x57182c['limit']===_0xb1c1('0x1e');var _0x32d539=_0x3db660[_0xb1c1('0x1f')];var _0x41b19e=_0x18c2f5?0x0:_0x57182c[_0xb1c1('0x1d')];var _0x877e79=_0x18c2f5?_0x3db660['count']:_0x57182c[_0xb1c1('0x1d')]+_0x57182c['limit'];var _0x387ee3;if(_0x877e79>=_0x32d539){_0x877e79=_0x32d539;_0x387ee3=0xc8;}else{_0x387ee3=0xce;}_0x2f8c31['status'](_0x387ee3);return _0x2f8c31[_0xb1c1('0x20')](_0xb1c1('0x21'),_0x41b19e+'-'+_0x877e79+'/'+_0x32d539)[_0xb1c1('0x1c')](_0x3db660);}return null;};}function patchUpdates(_0x9f66f1){return function(_0x3d3622){try{jsonpatch[_0xb1c1('0x22')](_0x3d3622,_0x9f66f1,!![]);}catch(_0x56cc37){return BPromise[_0xb1c1('0x23')](_0x56cc37);}return _0x3d3622[_0xb1c1('0x24')]();};}function saveUpdates(_0x29e58a,_0x272cf8){return function(_0xfee761){if(_0xfee761){return _0xfee761['update'](_0x29e58a)[_0xb1c1('0x25')](function(_0x93abcd){return _0x93abcd;});}return null;};}function removeEntity(_0x19bb60,_0x63f135){return function(_0x539b2c){if(_0x539b2c){return _0x539b2c[_0xb1c1('0x26')]()[_0xb1c1('0x25')](function(){_0x19bb60[_0xb1c1('0x27')](0xcc)[_0xb1c1('0x1b')]();});}};}function handleEntityNotFound(_0x57bf46,_0x2ca9e5){return function(_0x383b02){if(!_0x383b02){_0x57bf46[_0xb1c1('0x1a')](0x194);}return _0x383b02;};}function handleError(_0x1ddd99,_0x181f16){_0x181f16=_0x181f16||0x1f4;return function(_0x27b12a){logger['error'](_0x27b12a[_0xb1c1('0x28')]);if(_0x27b12a['name']){delete _0x27b12a[_0xb1c1('0x29')];}_0x1ddd99[_0xb1c1('0x27')](_0x181f16)[_0xb1c1('0x2a')](_0x27b12a);};}exports['index']=function(_0x38434d,_0x3687c9){var _0x287af3={},_0x1a8b93={},_0x1fd7d9={'count':0x0,'rows':[]};var _0x2d1d3a=_[_0xb1c1('0x2b')](db[_0xb1c1('0x2c')]['rawAttributes'],function(_0xb2e091){return{'name':_0xb2e091[_0xb1c1('0x2d')],'type':_0xb2e091[_0xb1c1('0x2e')][_0xb1c1('0x2f')]};});_0x1a8b93['model']=_[_0xb1c1('0x2b')](_0x2d1d3a,'name');_0x1a8b93['query']=_[_0xb1c1('0x30')](_0x38434d[_0xb1c1('0x31')]);_0x1a8b93['filters']=_[_0xb1c1('0x32')](_0x1a8b93[_0xb1c1('0x33')],_0x1a8b93[_0xb1c1('0x31')]);_0x287af3[_0xb1c1('0x34')]=_[_0xb1c1('0x32')](_0x1a8b93[_0xb1c1('0x33')],qs[_0xb1c1('0x35')](_0x38434d[_0xb1c1('0x31')][_0xb1c1('0x35')]));_0x287af3[_0xb1c1('0x34')]=_0x287af3[_0xb1c1('0x34')][_0xb1c1('0x36')]?_0x287af3[_0xb1c1('0x34')]:_0x1a8b93[_0xb1c1('0x33')];if(!_0x38434d[_0xb1c1('0x31')]['hasOwnProperty']('nolimit')){_0x287af3[_0xb1c1('0x37')]=qs[_0xb1c1('0x37')](_0x38434d[_0xb1c1('0x31')][_0xb1c1('0x37')]);_0x287af3[_0xb1c1('0x1d')]=qs[_0xb1c1('0x1d')](_0x38434d[_0xb1c1('0x31')]['offset']);}_0x287af3['order']=qs[_0xb1c1('0x38')](_0x38434d[_0xb1c1('0x31')][_0xb1c1('0x38')]);_0x287af3['where']=qs[_0xb1c1('0x39')](_[_0xb1c1('0x3a')](_0x38434d[_0xb1c1('0x31')],_0x1a8b93[_0xb1c1('0x39')]),_0x2d1d3a);if(_0x38434d[_0xb1c1('0x31')][_0xb1c1('0x3b')]){_0x287af3[_0xb1c1('0x3c')]=_[_0xb1c1('0x3d')](_0x287af3['where'],{'$or':_['map'](_0x2d1d3a,function(_0x38cb3d){if(_0x38cb3d['type']!==_0xb1c1('0x3e')){var _0x1705a4={};_0x1705a4[_0x38cb3d[_0xb1c1('0x29')]]={'$like':'%'+_0x38434d[_0xb1c1('0x31')][_0xb1c1('0x3b')]+'%'};return _0x1705a4;}})});}_0x287af3=_['merge']({},_0x287af3,_0x38434d['options']);var _0x13f7b2={'where':_0x287af3['where']};return db[_0xb1c1('0x2c')][_0xb1c1('0x1f')](_0x13f7b2)['then'](function(_0x67ca0){_0x1fd7d9[_0xb1c1('0x1f')]=_0x67ca0;if(_0x38434d['query'][_0xb1c1('0x3f')]){_0x287af3['include']=[{'all':!![]}];}return db[_0xb1c1('0x2c')][_0xb1c1('0x40')](_0x287af3);})[_0xb1c1('0x25')](function(_0x58a484){_0x1fd7d9[_0xb1c1('0x41')]=_0x58a484;return _0x1fd7d9;})[_0xb1c1('0x25')](respondWithFilteredResult(_0x3687c9,_0x287af3))[_0xb1c1('0x42')](handleError(_0x3687c9,null));};exports[_0xb1c1('0x43')]=function(_0x2d12b1,_0x42ecc5){var _0x32fa62={'raw':![],'where':{'id':_0x2d12b1[_0xb1c1('0x44')]['id']}},_0xe6964f={};_0xe6964f[_0xb1c1('0x33')]=_[_0xb1c1('0x30')](db[_0xb1c1('0x2c')][_0xb1c1('0x45')]);_0xe6964f[_0xb1c1('0x31')]=_['keys'](_0x2d12b1['query']);_0xe6964f[_0xb1c1('0x39')]=_[_0xb1c1('0x32')](_0xe6964f['model'],_0xe6964f[_0xb1c1('0x31')]);_0x32fa62[_0xb1c1('0x34')]=_[_0xb1c1('0x32')](_0xe6964f[_0xb1c1('0x33')],qs['fields'](_0x2d12b1[_0xb1c1('0x31')][_0xb1c1('0x35')]));_0x32fa62[_0xb1c1('0x34')]=_0x32fa62['attributes'][_0xb1c1('0x36')]?_0x32fa62[_0xb1c1('0x34')]:_0xe6964f['model'];if(_0x2d12b1[_0xb1c1('0x31')][_0xb1c1('0x3f')]){_0x32fa62['include']=[{'all':!![]}];}_0x32fa62=_[_0xb1c1('0x3d')]({},_0x32fa62,_0x2d12b1[_0xb1c1('0x46')]);return db['Automation'][_0xb1c1('0x47')](_0x32fa62)[_0xb1c1('0x25')](handleEntityNotFound(_0x42ecc5,null))[_0xb1c1('0x25')](respondWithResult(_0x42ecc5,null))['catch'](handleError(_0x42ecc5,null));};exports['create']=function(_0x547016,_0x397003){return db['Automation'][_0xb1c1('0x48')](_0x547016[_0xb1c1('0x49')],{})[_0xb1c1('0x25')](respondWithResult(_0x397003,0xc9))['catch'](handleError(_0x397003,null));};exports['update']=function(_0xde9864,_0x3d57d0){if(_0xde9864[_0xb1c1('0x49')]['id']){delete _0xde9864[_0xb1c1('0x49')]['id'];}return db[_0xb1c1('0x2c')][_0xb1c1('0x47')]({'where':{'id':_0xde9864[_0xb1c1('0x44')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x3d57d0,null))[_0xb1c1('0x25')](saveUpdates(_0xde9864['body'],null))[_0xb1c1('0x25')](respondWithResult(_0x3d57d0,null))[_0xb1c1('0x42')](handleError(_0x3d57d0,null));};exports[_0xb1c1('0x26')]=function(_0x2f0b99,_0x2a58a3){return db[_0xb1c1('0x2c')]['find']({'where':{'id':_0x2f0b99[_0xb1c1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a58a3,null))['then'](removeEntity(_0x2a58a3,null))[_0xb1c1('0x42')](handleError(_0x2a58a3,null));};exports['addConditions']=function(_0x1ea308,_0x4c67a1,_0x25c1c2){return db[_0xb1c1('0x4a')][_0xb1c1('0x47')]({'where':{'id':_0x1ea308['params']['id']}})['then'](handleEntityNotFound(_0x4c67a1,null))[_0xb1c1('0x25')](function(_0x473155){if(_0x473155){return _0x473155['addConditions'](_0x1ea308[_0xb1c1('0x49')][_0xb1c1('0x4b')],_[_0xb1c1('0x4c')](_0x1ea308[_0xb1c1('0x49')],[_0xb1c1('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x4c67a1,null))[_0xb1c1('0x42')](handleError(_0x4c67a1,null));};exports[_0xb1c1('0x4d')]=function(_0x13c306,_0x35d94c,_0x4896ee){var _0x56ec58={};var _0x19f1f4={};var _0x2eedef;var _0x3d1243;return db[_0xb1c1('0x2c')][_0xb1c1('0x4e')]({'where':{'id':_0x13c306[_0xb1c1('0x44')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x35d94c,null))['then'](function(_0x4ecbc4){if(_0x4ecbc4){_0x2eedef=_0x4ecbc4;_0x19f1f4[_0xb1c1('0x33')]=_[_0xb1c1('0x30')](db['Condition'][_0xb1c1('0x45')]);_0x19f1f4[_0xb1c1('0x31')]=_[_0xb1c1('0x30')](_0x13c306[_0xb1c1('0x31')]);_0x19f1f4[_0xb1c1('0x39')]=_[_0xb1c1('0x32')](_0x19f1f4[_0xb1c1('0x33')],_0x19f1f4[_0xb1c1('0x31')]);_0x56ec58[_0xb1c1('0x34')]=_[_0xb1c1('0x32')](_0x19f1f4['model'],qs['fields'](_0x13c306['query'][_0xb1c1('0x35')]));_0x56ec58[_0xb1c1('0x34')]=_0x56ec58[_0xb1c1('0x34')][_0xb1c1('0x36')]?_0x56ec58['attributes']:_0x19f1f4[_0xb1c1('0x33')];_0x56ec58[_0xb1c1('0x4f')]=qs['sort'](_0x13c306['query']['sort']);_0x56ec58[_0xb1c1('0x3c')]=qs[_0xb1c1('0x39')](_[_0xb1c1('0x3a')](_0x13c306[_0xb1c1('0x31')],_0x19f1f4[_0xb1c1('0x39')]));if(_0x13c306[_0xb1c1('0x31')][_0xb1c1('0x3b')]){_0x56ec58['where']=_[_0xb1c1('0x3d')](_0x56ec58['where'],{'$or':_[_0xb1c1('0x2b')](_0x56ec58[_0xb1c1('0x34')],function(_0x502b69){var _0x37edda={};_0x37edda[_0x502b69]={'$like':'%'+_0x13c306[_0xb1c1('0x31')][_0xb1c1('0x3b')]+'%'};return _0x37edda;})});}_0x56ec58=_[_0xb1c1('0x3d')]({},_0x56ec58,_0x13c306['options']);return _0x2eedef['getConditions'](_0x56ec58);}})[_0xb1c1('0x25')](function(_0x3a9570){if(_0x3a9570){_0x3d1243=_0x3a9570[_0xb1c1('0x36')];if(!_0x13c306[_0xb1c1('0x31')][_0xb1c1('0x50')](_0xb1c1('0x51'))){_0x56ec58[_0xb1c1('0x37')]=qs[_0xb1c1('0x37')](_0x13c306[_0xb1c1('0x31')][_0xb1c1('0x37')]);_0x56ec58[_0xb1c1('0x1d')]=qs[_0xb1c1('0x1d')](_0x13c306[_0xb1c1('0x31')][_0xb1c1('0x1d')]);}return _0x2eedef[_0xb1c1('0x4d')](_0x56ec58);}})[_0xb1c1('0x25')](function(_0x34bba2){if(_0x34bba2){return _0x34bba2?{'count':_0x3d1243,'rows':_0x34bba2}:null;}})['then'](respondWithResult(_0x35d94c,null))[_0xb1c1('0x42')](handleError(_0x35d94c,null));};exports[_0xb1c1('0x52')]=function(_0x221284,_0x5ee748,_0x318bcb){return db[_0xb1c1('0x53')]['find']({'where':{'id':_0x221284[_0xb1c1('0x44')]['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x5ee748,null))[_0xb1c1('0x25')](function(_0x1d80ec){if(_0x1d80ec){return _0x1d80ec['addActions'](_0x221284[_0xb1c1('0x49')]['ids'],_[_0xb1c1('0x4c')](_0x221284[_0xb1c1('0x49')],['ids','id'])||{});}})[_0xb1c1('0x25')](respondWithResult(_0x5ee748,null))[_0xb1c1('0x42')](handleError(_0x5ee748,null));};exports[_0xb1c1('0x54')]=function(_0xb0e814,_0x397abf,_0x5c8ca6){var _0x1e91c7={};var _0x2c6605={};var _0x18acd9;var _0x1d95ec;return db['Automation'][_0xb1c1('0x4e')]({'where':{'id':_0xb0e814['params']['id']}})[_0xb1c1('0x25')](handleEntityNotFound(_0x397abf,null))[_0xb1c1('0x25')](function(_0x380cf2){if(_0x380cf2){_0x18acd9=_0x380cf2;_0x2c6605[_0xb1c1('0x33')]=_[_0xb1c1('0x30')](db[_0xb1c1('0x53')][_0xb1c1('0x45')]);_0x2c6605[_0xb1c1('0x31')]=_[_0xb1c1('0x30')](_0xb0e814[_0xb1c1('0x31')]);_0x2c6605[_0xb1c1('0x39')]=_[_0xb1c1('0x32')](_0x2c6605['model'],_0x2c6605[_0xb1c1('0x31')]);_0x1e91c7[_0xb1c1('0x34')]=_[_0xb1c1('0x32')](_0x2c6605['model'],qs[_0xb1c1('0x35')](_0xb0e814[_0xb1c1('0x31')][_0xb1c1('0x35')]));_0x1e91c7['attributes']=_0x1e91c7['attributes'][_0xb1c1('0x36')]?_0x1e91c7['attributes']:_0x2c6605[_0xb1c1('0x33')];_0x1e91c7[_0xb1c1('0x4f')]=qs[_0xb1c1('0x38')](_0xb0e814['query'][_0xb1c1('0x38')]);_0x1e91c7[_0xb1c1('0x3c')]=qs['filters'](_['pick'](_0xb0e814[_0xb1c1('0x31')],_0x2c6605['filters']));if(_0xb0e814['query'][_0xb1c1('0x3b')]){_0x1e91c7['where']=_[_0xb1c1('0x3d')](_0x1e91c7[_0xb1c1('0x3c')],{'$or':_['map'](_0x1e91c7[_0xb1c1('0x34')],function(_0x7670a9){var _0xf1094f={};_0xf1094f[_0x7670a9]={'$like':'%'+_0xb0e814[_0xb1c1('0x31')]['filter']+'%'};return _0xf1094f;})});}_0x1e91c7=_['merge']({},_0x1e91c7,_0xb0e814[_0xb1c1('0x46')]);return _0x18acd9[_0xb1c1('0x54')](_0x1e91c7);}})['then'](function(_0x413d83){if(_0x413d83){_0x1d95ec=_0x413d83[_0xb1c1('0x36')];if(!_0xb0e814[_0xb1c1('0x31')][_0xb1c1('0x50')](_0xb1c1('0x51'))){_0x1e91c7[_0xb1c1('0x37')]=qs[_0xb1c1('0x37')](_0xb0e814[_0xb1c1('0x31')][_0xb1c1('0x37')]);_0x1e91c7[_0xb1c1('0x1d')]=qs[_0xb1c1('0x1d')](_0xb0e814[_0xb1c1('0x31')][_0xb1c1('0x1d')]);}return _0x18acd9[_0xb1c1('0x54')](_0x1e91c7);}})[_0xb1c1('0x25')](function(_0x23a22e){if(_0x23a22e){return _0x23a22e?{'count':_0x1d95ec,'rows':_0x23a22e}:null;}})['then'](respondWithResult(_0x397abf,null))[_0xb1c1('0x42')](handleError(_0x397abf,null));}; \ No newline at end of file +var _0x168e=['fields','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','catch','show','length','include','find','create','body','params','addConditions','ids','omit','getConditions','findOne','Condition','pick','hasOwnProperty','Action','addActions','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','json','apply','update','then','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x168e,0x1ea));var _0xe168=function(_0xfa0af,_0x21827e){_0xfa0af=_0xfa0af-0x0;var _0x3ee174=_0x168e[_0xfa0af];return _0x3ee174;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe168('0x0'));var rp=require(_0xe168('0x1'));var moment=require(_0xe168('0x2'));var BPromise=require(_0xe168('0x3'));var Mustache=require('mustache');var util=require(_0xe168('0x4'));var path=require(_0xe168('0x5'));var sox=require(_0xe168('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe168('0x7'));var _=require(_0xe168('0x8'));var squel=require(_0xe168('0x9'));var crypto=require(_0xe168('0xa'));var jsforce=require(_0xe168('0xb'));var deskjs=require(_0xe168('0xc'));var toCsv=require(_0xe168('0xd'));var querystring=require('querystring');var Papa=require(_0xe168('0xe'));var Redis=require(_0xe168('0xf'));var authService=require(_0xe168('0x10'));var qs=require(_0xe168('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe168('0x12'));var logger=require(_0xe168('0x13'))('api');var utils=require(_0xe168('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe168('0x15'))['db'];function respondWithStatusCode(_0x380416,_0x59858d){_0x59858d=_0x59858d||0xcc;return function(_0x4f3268){if(_0x4f3268){return _0x380416['sendStatus'](_0x59858d);}return _0x380416[_0xe168('0x16')](_0x59858d)[_0xe168('0x17')]();};}function respondWithResult(_0x21b11a,_0x2c7ced){_0x2c7ced=_0x2c7ced||0xc8;return function(_0x3d3e9c){if(_0x3d3e9c){return _0x21b11a['status'](_0x2c7ced)['json'](_0x3d3e9c);}};}function respondWithFilteredResult(_0x39adae,_0x480dff){return function(_0xdcd480){if(_0xdcd480){var _0x9088de=typeof _0x480dff[_0xe168('0x18')]===_0xe168('0x19')&&typeof _0x480dff[_0xe168('0x1a')]===_0xe168('0x19');var _0xf637d9=_0xdcd480['count'];var _0x226826=_0x9088de?0x0:_0x480dff[_0xe168('0x18')];var _0x11d64d=_0x9088de?_0xdcd480['count']:_0x480dff['offset']+_0x480dff[_0xe168('0x1a')];var _0x43624b;if(_0x11d64d>=_0xf637d9){_0x11d64d=_0xf637d9;_0x43624b=0xc8;}else{_0x43624b=0xce;}_0x39adae[_0xe168('0x16')](_0x43624b);return _0x39adae[_0xe168('0x1b')](_0xe168('0x1c'),_0x226826+'-'+_0x11d64d+'/'+_0xf637d9)[_0xe168('0x1d')](_0xdcd480);}return null;};}function patchUpdates(_0x55cd9a){return function(_0x2853f2){try{jsonpatch[_0xe168('0x1e')](_0x2853f2,_0x55cd9a,!![]);}catch(_0x60ef2a){return BPromise['reject'](_0x60ef2a);}return _0x2853f2['save']();};}function saveUpdates(_0x451184,_0x13a9c6){return function(_0x737651){if(_0x737651){return _0x737651[_0xe168('0x1f')](_0x451184)['then'](function(_0x266926){return _0x266926;});}return null;};}function removeEntity(_0x237711,_0x448241){return function(_0x3d3212){if(_0x3d3212){return _0x3d3212['destroy']()[_0xe168('0x20')](function(){_0x237711[_0xe168('0x16')](0xcc)[_0xe168('0x17')]();});}};}function handleEntityNotFound(_0x1188e5,_0x6749b3){return function(_0x2bf254){if(!_0x2bf254){_0x1188e5['sendStatus'](0x194);}return _0x2bf254;};}function handleError(_0x77aa18,_0x16c971){_0x16c971=_0x16c971||0x1f4;return function(_0x55f58b){logger[_0xe168('0x21')](_0x55f58b[_0xe168('0x22')]);if(_0x55f58b['name']){delete _0x55f58b[_0xe168('0x23')];}_0x77aa18[_0xe168('0x16')](_0x16c971)[_0xe168('0x24')](_0x55f58b);};}exports[_0xe168('0x25')]=function(_0x303046,_0x3da944){var _0x208202={},_0x1bfb68={},_0x390bdd={'count':0x0,'rows':[]};var _0x8bce3f=_[_0xe168('0x26')](db[_0xe168('0x27')][_0xe168('0x28')],function(_0x1e50b5){return{'name':_0x1e50b5[_0xe168('0x29')],'type':_0x1e50b5[_0xe168('0x2a')]['key']};});_0x1bfb68[_0xe168('0x2b')]=_[_0xe168('0x26')](_0x8bce3f,_0xe168('0x23'));_0x1bfb68['query']=_[_0xe168('0x2c')](_0x303046['query']);_0x1bfb68[_0xe168('0x2d')]=_[_0xe168('0x2e')](_0x1bfb68['model'],_0x1bfb68[_0xe168('0x2f')]);_0x208202[_0xe168('0x30')]=_['intersection'](_0x1bfb68[_0xe168('0x2b')],qs['fields'](_0x303046[_0xe168('0x2f')][_0xe168('0x31')]));_0x208202[_0xe168('0x30')]=_0x208202['attributes']['length']?_0x208202[_0xe168('0x30')]:_0x1bfb68['model'];if(!_0x303046[_0xe168('0x2f')]['hasOwnProperty'](_0xe168('0x32'))){_0x208202[_0xe168('0x1a')]=qs[_0xe168('0x1a')](_0x303046[_0xe168('0x2f')][_0xe168('0x1a')]);_0x208202[_0xe168('0x18')]=qs[_0xe168('0x18')](_0x303046[_0xe168('0x2f')][_0xe168('0x18')]);}_0x208202[_0xe168('0x33')]=qs[_0xe168('0x34')](_0x303046[_0xe168('0x2f')][_0xe168('0x34')]);_0x208202[_0xe168('0x35')]=qs[_0xe168('0x2d')](_['pick'](_0x303046['query'],_0x1bfb68[_0xe168('0x2d')]),_0x8bce3f);if(_0x303046[_0xe168('0x2f')][_0xe168('0x36')]){_0x208202[_0xe168('0x35')]=_[_0xe168('0x37')](_0x208202[_0xe168('0x35')],{'$or':_['map'](_0x8bce3f,function(_0x131250){if(_0x131250[_0xe168('0x2a')]!=='VIRTUAL'){var _0x51108f={};_0x51108f[_0x131250[_0xe168('0x23')]]={'$like':'%'+_0x303046[_0xe168('0x2f')][_0xe168('0x36')]+'%'};return _0x51108f;}})});}_0x208202=_['merge']({},_0x208202,_0x303046[_0xe168('0x38')]);var _0x53d1e5={'where':_0x208202[_0xe168('0x35')]};return db[_0xe168('0x27')]['count'](_0x53d1e5)[_0xe168('0x20')](function(_0x4364e5){_0x390bdd['count']=_0x4364e5;if(_0x303046[_0xe168('0x2f')][_0xe168('0x39')]){_0x208202['include']=[{'all':!![]}];}return db['Automation'][_0xe168('0x3a')](_0x208202);})[_0xe168('0x20')](function(_0x17fd43){_0x390bdd['rows']=_0x17fd43;return _0x390bdd;})[_0xe168('0x20')](respondWithFilteredResult(_0x3da944,_0x208202))[_0xe168('0x3b')](handleError(_0x3da944,null));};exports[_0xe168('0x3c')]=function(_0x58db54,_0xe279f2){var _0x34dfda={'raw':![],'where':{'id':_0x58db54['params']['id']}},_0x3bc349={};_0x3bc349[_0xe168('0x2b')]=_['keys'](db[_0xe168('0x27')][_0xe168('0x28')]);_0x3bc349[_0xe168('0x2f')]=_[_0xe168('0x2c')](_0x58db54[_0xe168('0x2f')]);_0x3bc349[_0xe168('0x2d')]=_[_0xe168('0x2e')](_0x3bc349['model'],_0x3bc349[_0xe168('0x2f')]);_0x34dfda[_0xe168('0x30')]=_['intersection'](_0x3bc349['model'],qs['fields'](_0x58db54[_0xe168('0x2f')][_0xe168('0x31')]));_0x34dfda[_0xe168('0x30')]=_0x34dfda[_0xe168('0x30')][_0xe168('0x3d')]?_0x34dfda['attributes']:_0x3bc349[_0xe168('0x2b')];if(_0x58db54[_0xe168('0x2f')]['includeAll']){_0x34dfda[_0xe168('0x3e')]=[{'all':!![]}];}_0x34dfda=_[_0xe168('0x37')]({},_0x34dfda,_0x58db54['options']);return db[_0xe168('0x27')][_0xe168('0x3f')](_0x34dfda)[_0xe168('0x20')](handleEntityNotFound(_0xe279f2,null))['then'](respondWithResult(_0xe279f2,null))[_0xe168('0x3b')](handleError(_0xe279f2,null));};exports[_0xe168('0x40')]=function(_0x290dea,_0x495a47){return db[_0xe168('0x27')]['create'](_0x290dea[_0xe168('0x41')],{})[_0xe168('0x20')](respondWithResult(_0x495a47,0xc9))[_0xe168('0x3b')](handleError(_0x495a47,null));};exports[_0xe168('0x1f')]=function(_0x2a1c7d,_0x31c221){if(_0x2a1c7d['body']['id']){delete _0x2a1c7d['body']['id'];}return db[_0xe168('0x27')][_0xe168('0x3f')]({'where':{'id':_0x2a1c7d[_0xe168('0x42')]['id']}})['then'](handleEntityNotFound(_0x31c221,null))['then'](saveUpdates(_0x2a1c7d['body'],null))[_0xe168('0x20')](respondWithResult(_0x31c221,null))[_0xe168('0x3b')](handleError(_0x31c221,null));};exports['destroy']=function(_0x37e691,_0x17d632){return db[_0xe168('0x27')]['find']({'where':{'id':_0x37e691[_0xe168('0x42')]['id']}})[_0xe168('0x20')](handleEntityNotFound(_0x17d632,null))['then'](removeEntity(_0x17d632,null))[_0xe168('0x3b')](handleError(_0x17d632,null));};exports[_0xe168('0x43')]=function(_0x1076d0,_0x5ae2f1,_0x2ec083){return db['Condition'][_0xe168('0x3f')]({'where':{'id':_0x1076d0['params']['id']}})[_0xe168('0x20')](handleEntityNotFound(_0x5ae2f1,null))[_0xe168('0x20')](function(_0x3bfb7e){if(_0x3bfb7e){return _0x3bfb7e['addConditions'](_0x1076d0[_0xe168('0x41')][_0xe168('0x44')],_[_0xe168('0x45')](_0x1076d0[_0xe168('0x41')],[_0xe168('0x44'),'id'])||{});}})['then'](respondWithResult(_0x5ae2f1,null))[_0xe168('0x3b')](handleError(_0x5ae2f1,null));};exports[_0xe168('0x46')]=function(_0x33ce7e,_0x40b930,_0x10a802){var _0x197262={};var _0xde48cb={};var _0x58f474;var _0x3b27e6;return db[_0xe168('0x27')][_0xe168('0x47')]({'where':{'id':_0x33ce7e[_0xe168('0x42')]['id']}})[_0xe168('0x20')](handleEntityNotFound(_0x40b930,null))[_0xe168('0x20')](function(_0x5669f5){if(_0x5669f5){_0x58f474=_0x5669f5;_0xde48cb[_0xe168('0x2b')]=_[_0xe168('0x2c')](db[_0xe168('0x48')][_0xe168('0x28')]);_0xde48cb[_0xe168('0x2f')]=_[_0xe168('0x2c')](_0x33ce7e[_0xe168('0x2f')]);_0xde48cb[_0xe168('0x2d')]=_[_0xe168('0x2e')](_0xde48cb[_0xe168('0x2b')],_0xde48cb[_0xe168('0x2f')]);_0x197262[_0xe168('0x30')]=_[_0xe168('0x2e')](_0xde48cb[_0xe168('0x2b')],qs[_0xe168('0x31')](_0x33ce7e['query'][_0xe168('0x31')]));_0x197262[_0xe168('0x30')]=_0x197262[_0xe168('0x30')][_0xe168('0x3d')]?_0x197262[_0xe168('0x30')]:_0xde48cb[_0xe168('0x2b')];_0x197262[_0xe168('0x33')]=qs[_0xe168('0x34')](_0x33ce7e[_0xe168('0x2f')][_0xe168('0x34')]);_0x197262[_0xe168('0x35')]=qs[_0xe168('0x2d')](_[_0xe168('0x49')](_0x33ce7e[_0xe168('0x2f')],_0xde48cb['filters']));if(_0x33ce7e['query']['filter']){_0x197262[_0xe168('0x35')]=_['merge'](_0x197262['where'],{'$or':_['map'](_0x197262[_0xe168('0x30')],function(_0x4a953a){var _0x1d10f1={};_0x1d10f1[_0x4a953a]={'$like':'%'+_0x33ce7e[_0xe168('0x2f')]['filter']+'%'};return _0x1d10f1;})});}_0x197262=_[_0xe168('0x37')]({},_0x197262,_0x33ce7e[_0xe168('0x38')]);return _0x58f474[_0xe168('0x46')](_0x197262);}})['then'](function(_0x3641ed){if(_0x3641ed){_0x3b27e6=_0x3641ed[_0xe168('0x3d')];if(!_0x33ce7e[_0xe168('0x2f')][_0xe168('0x4a')](_0xe168('0x32'))){_0x197262[_0xe168('0x1a')]=qs[_0xe168('0x1a')](_0x33ce7e['query']['limit']);_0x197262['offset']=qs[_0xe168('0x18')](_0x33ce7e[_0xe168('0x2f')][_0xe168('0x18')]);}return _0x58f474[_0xe168('0x46')](_0x197262);}})[_0xe168('0x20')](function(_0x2242a5){if(_0x2242a5){return _0x2242a5?{'count':_0x3b27e6,'rows':_0x2242a5}:null;}})['then'](respondWithResult(_0x40b930,null))[_0xe168('0x3b')](handleError(_0x40b930,null));};exports['addActions']=function(_0x3e172f,_0x42a844,_0x59e6ad){return db[_0xe168('0x4b')][_0xe168('0x3f')]({'where':{'id':_0x3e172f[_0xe168('0x42')]['id']}})['then'](handleEntityNotFound(_0x42a844,null))['then'](function(_0x294858){if(_0x294858){return _0x294858[_0xe168('0x4c')](_0x3e172f[_0xe168('0x41')][_0xe168('0x44')],_[_0xe168('0x45')](_0x3e172f[_0xe168('0x41')],[_0xe168('0x44'),'id'])||{});}})[_0xe168('0x20')](respondWithResult(_0x42a844,null))[_0xe168('0x3b')](handleError(_0x42a844,null));};exports['getActions']=function(_0x2f02a6,_0x4e5725,_0x23681b){var _0x550742={};var _0xd5618d={};var _0x3bae02;var _0x39f637;return db[_0xe168('0x27')][_0xe168('0x47')]({'where':{'id':_0x2f02a6[_0xe168('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e5725,null))['then'](function(_0x38e457){if(_0x38e457){_0x3bae02=_0x38e457;_0xd5618d['model']=_[_0xe168('0x2c')](db[_0xe168('0x4b')][_0xe168('0x28')]);_0xd5618d[_0xe168('0x2f')]=_[_0xe168('0x2c')](_0x2f02a6[_0xe168('0x2f')]);_0xd5618d[_0xe168('0x2d')]=_[_0xe168('0x2e')](_0xd5618d['model'],_0xd5618d[_0xe168('0x2f')]);_0x550742['attributes']=_[_0xe168('0x2e')](_0xd5618d[_0xe168('0x2b')],qs[_0xe168('0x31')](_0x2f02a6[_0xe168('0x2f')][_0xe168('0x31')]));_0x550742[_0xe168('0x30')]=_0x550742[_0xe168('0x30')][_0xe168('0x3d')]?_0x550742['attributes']:_0xd5618d[_0xe168('0x2b')];_0x550742[_0xe168('0x33')]=qs['sort'](_0x2f02a6['query']['sort']);_0x550742[_0xe168('0x35')]=qs[_0xe168('0x2d')](_[_0xe168('0x49')](_0x2f02a6[_0xe168('0x2f')],_0xd5618d[_0xe168('0x2d')]));if(_0x2f02a6[_0xe168('0x2f')][_0xe168('0x36')]){_0x550742[_0xe168('0x35')]=_[_0xe168('0x37')](_0x550742[_0xe168('0x35')],{'$or':_[_0xe168('0x26')](_0x550742['attributes'],function(_0x147727){var _0x37ba73={};_0x37ba73[_0x147727]={'$like':'%'+_0x2f02a6[_0xe168('0x2f')][_0xe168('0x36')]+'%'};return _0x37ba73;})});}_0x550742=_['merge']({},_0x550742,_0x2f02a6[_0xe168('0x38')]);return _0x3bae02['getActions'](_0x550742);}})[_0xe168('0x20')](function(_0x125c17){if(_0x125c17){_0x39f637=_0x125c17['length'];if(!_0x2f02a6[_0xe168('0x2f')][_0xe168('0x4a')]('nolimit')){_0x550742['limit']=qs[_0xe168('0x1a')](_0x2f02a6[_0xe168('0x2f')][_0xe168('0x1a')]);_0x550742[_0xe168('0x18')]=qs[_0xe168('0x18')](_0x2f02a6[_0xe168('0x2f')]['offset']);}return _0x3bae02['getActions'](_0x550742);}})[_0xe168('0x20')](function(_0x2e36a1){if(_0x2e36a1){return _0x2e36a1?{'count':_0x39f637,'rows':_0x2e36a1}:null;}})[_0xe168('0x20')](respondWithResult(_0x4e5725,null))[_0xe168('0x3b')](handleError(_0x4e5725,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 54b1d54..b8a5a75 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 _0x2568=['tools_automations','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation'];(function(_0x265773,_0x5d1b6e){var _0x4ed75d=function(_0x3b7ce7){while(--_0x3b7ce7){_0x265773['push'](_0x265773['shift']());}};_0x4ed75d(++_0x5d1b6e);}(_0x2568,0xa9));var _0x8256=function(_0x2ca322,_0x37f83f){_0x2ca322=_0x2ca322-0x0;var _0x509bca=_0x2568[_0x2ca322];return _0x509bca;};'use strict';var _=require('lodash');var util=require(_0x8256('0x0'));var logger=require(_0x8256('0x1'))(_0x8256('0x2'));var moment=require(_0x8256('0x3'));var BPromise=require('bluebird');var rp=require(_0x8256('0x4'));var fs=require('fs');var path=require(_0x8256('0x5'));var rimraf=require('rimraf');var config=require(_0x8256('0x6'));var attributes=require(_0x8256('0x7'));module[_0x8256('0x8')]=function(_0x26804e,_0x36d18b){return _0x26804e[_0x8256('0x9')](_0x8256('0xa'),attributes,{'tableName':_0x8256('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd45a=['api','moment','bluebird','path','rimraf','../../config/environment','./automation.attributes','define','tools_automations','lodash','util'];(function(_0x114f51,_0x418f91){var _0x23ba4b=function(_0x1a59d1){while(--_0x1a59d1){_0x114f51['push'](_0x114f51['shift']());}};_0x23ba4b(++_0x418f91);}(_0xd45a,0xcf));var _0xad45=function(_0x2ba36b,_0x254206){_0x2ba36b=_0x2ba36b-0x0;var _0x163030=_0xd45a[_0x2ba36b];return _0x163030;};'use strict';var _=require(_0xad45('0x0'));var util=require(_0xad45('0x1'));var logger=require('../../config/logger')(_0xad45('0x2'));var moment=require(_0xad45('0x3'));var BPromise=require(_0xad45('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad45('0x5'));var rimraf=require(_0xad45('0x6'));var config=require(_0xad45('0x7'));var attributes=require(_0xad45('0x8'));module['exports']=function(_0x428708,_0x61b526){return _0x428708[_0xad45('0x9')]('Automation',attributes,{'tableName':_0xad45('0xa'),'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 91cc31a..44118ab 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 _0xf7d9=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x52fb0c,_0x97790b){var _0x11697d=function(_0x80af74){while(--_0x80af74){_0x52fb0c['push'](_0x52fb0c['shift']());}};_0x11697d(++_0x97790b);}(_0xf7d9,0x122));var _0x9f7d=function(_0x3523c5,_0x426d73){_0x3523c5=_0x3523c5-0x0;var _0x2f1beb=_0xf7d9[_0x3523c5];return _0x2f1beb;};'use strict';var _=require(_0x9f7d('0x0'));var util=require(_0x9f7d('0x1'));var moment=require(_0x9f7d('0x2'));var BPromise=require(_0x9f7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f7d('0x5'))(_0x9f7d('0x6'));var config=require(_0x9f7d('0x7'));var jayson=require(_0x9f7d('0x8'));var client=jayson[_0x9f7d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc6b9,_0xf09259,_0x2333e8){return new BPromise(function(_0x218628,_0x2893a5){return client[_0x9f7d('0xa')](_0x4dc6b9,_0x2333e8)[_0x9f7d('0xb')](function(_0x5290e2){logger[_0x9f7d('0xc')](_0x9f7d('0xd'),_0xf09259,'request\x20sent');logger[_0x9f7d('0xe')](_0x9f7d('0xf'),_0xf09259,_0x9f7d('0x10'),JSON['stringify'](_0x5290e2));if(_0x5290e2[_0x9f7d('0x11')]){if(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x12')]===0x1f4){logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x5290e2[_0x9f7d('0x11')]['message']);return _0x2893a5(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x13')]);}logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x5290e2['error'][_0x9f7d('0x13')]);return _0x218628(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x13')]);}else{logger[_0x9f7d('0xc')](_0x9f7d('0xd'),_0xf09259,_0x9f7d('0x10'));_0x218628(_0x5290e2[_0x9f7d('0x14')]['message']);}})['catch'](function(_0x402609){logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x402609);_0x2893a5(_0x402609);});});} \ No newline at end of file +var _0xd5fc=['info','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x34697c,_0x20ab9d){var _0x9db760=function(_0x49889f){while(--_0x49889f){_0x34697c['push'](_0x34697c['shift']());}};_0x9db760(++_0x20ab9d);}(_0xd5fc,0xae));var _0xcd5f=function(_0x13c3c2,_0x229f57){_0x13c3c2=_0x13c3c2-0x0;var _0xeea492=_0xd5fc[_0x13c3c2];return _0xeea492;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('Automation,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index d4d0289..7f2472a 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 _0x5044=['../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getActions','post','create','addConditions','/:id/actions','addActions','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4ee5d1,_0x873e57){var _0x18bc14=function(_0xba1b9b){while(--_0xba1b9b){_0x4ee5d1['push'](_0x4ee5d1['shift']());}};_0x18bc14(++_0x873e57);}(_0x5044,0xc8));var _0x4504=function(_0x32032a,_0x24e8d1){_0x32032a=_0x32032a-0x0;var _0x5d5792=_0x5044[_0x32032a];return _0x5d5792;};'use strict';var multer=require('multer');var util=require(_0x4504('0x0'));var path=require('path');var timeout=require(_0x4504('0x1'));var express=require(_0x4504('0x2'));var router=express[_0x4504('0x3')]();var fs_extra=require(_0x4504('0x4'));var auth=require(_0x4504('0x5'));var interaction=require(_0x4504('0x6'));var config=require(_0x4504('0x7'));var controller=require(_0x4504('0x8'));router['get']('/',auth[_0x4504('0x9')](),controller[_0x4504('0xa')]);router[_0x4504('0xb')](_0x4504('0xc'),auth[_0x4504('0x9')](),controller[_0x4504('0xd')]);router[_0x4504('0xb')](_0x4504('0xe'),auth[_0x4504('0x9')](),controller['getConditions']);router[_0x4504('0xb')]('/:id/actions',auth[_0x4504('0x9')](),controller[_0x4504('0xf')]);router[_0x4504('0x10')]('/',auth[_0x4504('0x9')](),controller[_0x4504('0x11')]);router[_0x4504('0x10')](_0x4504('0xe'),auth[_0x4504('0x9')](),controller[_0x4504('0x12')]);router[_0x4504('0x10')](_0x4504('0x13'),auth[_0x4504('0x9')](),controller[_0x4504('0x14')]);router['put'](_0x4504('0xc'),auth[_0x4504('0x9')](),controller['update']);router[_0x4504('0x15')](_0x4504('0xc'),auth[_0x4504('0x9')](),controller[_0x4504('0x16')]);module['exports']=router; \ No newline at end of file +var _0x4f5a=['multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','post','create','addActions','put','delete','exports'];(function(_0x190323,_0x4e67dd){var _0x1f0899=function(_0x72e018){while(--_0x72e018){_0x190323['push'](_0x190323['shift']());}};_0x1f0899(++_0x4e67dd);}(_0x4f5a,0xaa));var _0xa4f5=function(_0x4a31c3,_0x442619){_0x4a31c3=_0x4a31c3-0x0;var _0x9047d7=_0x4f5a[_0x4a31c3];return _0x9047d7;};'use strict';var multer=require(_0xa4f5('0x0'));var util=require(_0xa4f5('0x1'));var path=require('path');var timeout=require(_0xa4f5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa4f5('0x3'));var config=require(_0xa4f5('0x4'));var controller=require('./automation.controller');router[_0xa4f5('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa4f5('0x6'),auth[_0xa4f5('0x7')](),controller[_0xa4f5('0x8')]);router[_0xa4f5('0x5')](_0xa4f5('0x9'),auth['isAuthenticated'](),controller[_0xa4f5('0xa')]);router['get']('/:id/actions',auth[_0xa4f5('0x7')](),controller['getActions']);router[_0xa4f5('0xb')]('/',auth[_0xa4f5('0x7')](),controller[_0xa4f5('0xc')]);router[_0xa4f5('0xb')](_0xa4f5('0x9'),auth['isAuthenticated'](),controller['addConditions']);router[_0xa4f5('0xb')]('/:id/actions',auth[_0xa4f5('0x7')](),controller[_0xa4f5('0xd')]);router[_0xa4f5('0xe')](_0xa4f5('0x6'),auth[_0xa4f5('0x7')](),controller['update']);router[_0xa4f5('0xf')](_0xa4f5('0x6'),auth[_0xa4f5('0x7')](),controller['destroy']);module[_0xa4f5('0x10')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 974af81..3de1fa2 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 _0x5324=['ENUM','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\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','always','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'];(function(_0x2a13f3,_0x38636a){var _0x8987ac=function(_0x4e9eef){while(--_0x4e9eef){_0x2a13f3['push'](_0x2a13f3['shift']());}};_0x8987ac(++_0x38636a);}(_0x5324,0x154));var _0x4532=function(_0x3e6f29,_0x4dda33){_0x3e6f29=_0x3e6f29-0x0;var _0xd8dd25=_0x5324[_0x3e6f29];return _0xd8dd25;};'use strict';var Sequelize=require(_0x4532('0x0'));module[_0x4532('0x1')]={'name':{'type':Sequelize[_0x4532('0x2')],'unique':_0x4532('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x4532('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x4532('0x2')]},'active':{'type':Sequelize[_0x4532('0x5')],'defaultValue':0x0,'comment':_0x4532('0x6')},'limitCalls':{'type':Sequelize[_0x4532('0x7')](0x4)[_0x4532('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4532('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4532('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4532('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4532('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)[_0x4532('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x4532('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)[_0x4532('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4532('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4532('0x10')},'dialTimezone':{'type':Sequelize[_0x4532('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4532('0x2')],'defaultValue':_0x4532('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x4532('0x12')),'defaultValue':_0x4532('0x13')},'dialAMDActive':{'type':Sequelize[_0x4532('0x5')],'defaultValue':0x0,'comment':_0x4532('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x4532('0x7')](0x9)[_0x4532('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4532('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x4532('0x7')](0x9)[_0x4532('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4532('0x7')](0x9)[_0x4532('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4532('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x4532('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4532('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4532('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4532('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4532('0x7')](0x9)[_0x4532('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4532('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4532('0x7')](0x9)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4532('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x4532('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4532('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4532('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4532('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4532('0x1d')](_0x4532('0x1e'),'ASC'),'defaultValue':_0x4532('0x1e')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4532('0x1f')},'dialCutDigit':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4532('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4532('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4532('0x7')](0x3)[_0x4532('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4532('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4532('0x7')](0x5)[_0x4532('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4532('0x28')}}; \ No newline at end of file +var _0x575d=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#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\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','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)'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x575d,0xc8));var _0xd575=function(_0x36a83e,_0x2dfaaa){_0x36a83e=_0x36a83e-0x0;var _0x2d6049=_0x575d[_0x36a83e];return _0x2d6049;};'use strict';var Sequelize=require(_0xd575('0x0'));module[_0xd575('0x1')]={'name':{'type':Sequelize[_0xd575('0x2')],'unique':_0xd575('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd575('0x4')](_0xd575('0x5')),'allowNull':![],'defaultValue':_0xd575('0x5')},'description':{'type':Sequelize[_0xd575('0x2')]},'active':{'type':Sequelize[_0xd575('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xd575('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd575('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd575('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd575('0x9')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'defaultValue':0x3,'comment':_0xd575('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd575('0xf')},'dialTimezone':{'type':Sequelize[_0xd575('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd575('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xd575('0x4')]('always',_0xd575('0x11'),_0xd575('0x12')),'defaultValue':_0xd575('0x13')},'dialAMDActive':{'type':Sequelize[_0xd575('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xd575('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd575('0x9')](0x9)[_0xd575('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd575('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd575('0x9')](0x9)[_0xd575('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd575('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd575('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd575('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xd575('0x9')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd575('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd575('0x9')](0x9)[_0xd575('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd575('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd575('0x9')](0x9)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd575('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd575('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd575('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd575('0x9')](0x9)[_0xd575('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd575('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd575('0x4')](_0xd575('0x1c'),_0xd575('0x1d')),'defaultValue':_0xd575('0x1c')},'dialPrefix':{'type':Sequelize[_0xd575('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd575('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xd575('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd575('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd575('0x9')](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd575('0x9')](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd575('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd575('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd575('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd575('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 348c385..5d794f0 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 _0xbaca=['save','then','get','sendStatus','error','stack','name','index','Campaign','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','autoAssociation','rawAttributes','include','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','from','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','into','cm_hopper','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','ci.item','ci.OrderBY','cm_contact_has_items','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject'];(function(_0xa464a1,_0x4ec344){var _0x19e814=function(_0x37a871){while(--_0x37a871){_0xa464a1['push'](_0xa464a1['shift']());}};_0x19e814(++_0x4ec344);}(_0xbaca,0xfc));var _0xabac=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0xbaca[_0x351b46];return _0x1515df;};'use strict';var emlformat=require(_0xabac('0x0'));var rimraf=require(_0xabac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabac('0x2'));var rp=require(_0xabac('0x3'));var moment=require('moment');var BPromise=require(_0xabac('0x4'));var Mustache=require('mustache');var util=require(_0xabac('0x5'));var path=require(_0xabac('0x6'));var sox=require(_0xabac('0x7'));var csv=require(_0xabac('0x8'));var ejs=require(_0xabac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xabac('0xa'));var crypto=require(_0xabac('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xabac('0x8'));var querystring=require(_0xabac('0xc'));var Papa=require(_0xabac('0xd'));var Redis=require('ioredis');var authService=require(_0xabac('0xe'));var qs=require(_0xabac('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabac('0x10'));var logger=require('../../config/logger')(_0xabac('0x11'));var utils=require(_0xabac('0x12'));var config=require(_0xabac('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xabac('0x14'))['db'];function respondWithStatusCode(_0xbd90d,_0x16f966){_0x16f966=_0x16f966||0xcc;return function(_0x5d9804){if(_0x5d9804){return _0xbd90d['sendStatus'](_0x16f966);}return _0xbd90d['status'](_0x16f966)[_0xabac('0x15')]();};}function respondWithResult(_0x40883b,_0x1484a4){_0x1484a4=_0x1484a4||0xc8;return function(_0x4e0a5){if(_0x4e0a5){return _0x40883b['status'](_0x1484a4)[_0xabac('0x16')](_0x4e0a5);}};}function respondWithFilteredResult(_0x3cbd4e,_0x267e31){return function(_0x3f54bc){if(_0x3f54bc){var _0x54381d=typeof _0x267e31[_0xabac('0x17')]===_0xabac('0x18')&&typeof _0x267e31[_0xabac('0x19')]===_0xabac('0x18');var _0x331da9=_0x3f54bc[_0xabac('0x1a')];var _0x3cd537=_0x54381d?0x0:_0x267e31['offset'];var _0x174d5b=_0x54381d?_0x3f54bc['count']:_0x267e31[_0xabac('0x17')]+_0x267e31[_0xabac('0x19')];var _0x42ccfb;if(_0x174d5b>=_0x331da9){_0x174d5b=_0x331da9;_0x42ccfb=0xc8;}else{_0x42ccfb=0xce;}_0x3cbd4e[_0xabac('0x1b')](_0x42ccfb);return _0x3cbd4e[_0xabac('0x1c')](_0xabac('0x1d'),_0x3cd537+'-'+_0x174d5b+'/'+_0x331da9)[_0xabac('0x16')](_0x3f54bc);}return null;};}function patchUpdates(_0x4313d7){return function(_0x42922d){try{jsonpatch[_0xabac('0x1e')](_0x42922d,_0x4313d7,!![]);}catch(_0x4ecae5){return BPromise[_0xabac('0x1f')](_0x4ecae5);}return _0x42922d[_0xabac('0x20')]();};}function saveUpdates(_0x459c84,_0x2b0586){return function(_0x3e8dc0){if(_0x3e8dc0){return _0x3e8dc0['update'](_0x459c84)[_0xabac('0x21')](function(_0x4ca55f){return _0x4ca55f;});}return null;};}function removeEntity(_0x5892f3,_0x159dc6){return function(_0xba977d){if(_0xba977d){return _0xba977d['destroy']()[_0xabac('0x21')](function(){var _0x55e6a5=_0xba977d[_0xabac('0x22')]({'plain':!![]});var _0x12d962='IvrCampaigns';return db['UserProfileResource']['destroy']({'where':{'type':_0x12d962,'resourceId':_0x55e6a5['id']}})[_0xabac('0x21')](function(){return _0xba977d;});})[_0xabac('0x21')](function(){_0x5892f3[_0xabac('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ec8a4,_0x62dd1e){return function(_0x191d7c){if(!_0x191d7c){_0x2ec8a4[_0xabac('0x23')](0x194);}return _0x191d7c;};}function handleError(_0x3471ab,_0x3e4a13){_0x3e4a13=_0x3e4a13||0x1f4;return function(_0xb34291){logger[_0xabac('0x24')](_0xb34291[_0xabac('0x25')]);if(_0xb34291[_0xabac('0x26')]){delete _0xb34291[_0xabac('0x26')];}_0x3471ab[_0xabac('0x1b')](_0x3e4a13)['send'](_0xb34291);};}exports[_0xabac('0x27')]=function(_0x5714d4,_0x3a624d){var _0xf2ada5={},_0x571024={},_0x308f6f={'count':0x0,'rows':[]};var _0x1eb6ee=_['map'](db[_0xabac('0x28')]['rawAttributes'],function(_0x46f2c0){return{'name':_0x46f2c0[_0xabac('0x29')],'type':_0x46f2c0['type'][_0xabac('0x2a')]};});_0x571024[_0xabac('0x2b')]=_['map'](_0x1eb6ee,_0xabac('0x26'));_0x571024[_0xabac('0x2c')]=_[_0xabac('0x2d')](_0x5714d4[_0xabac('0x2c')]);_0x571024[_0xabac('0x2e')]=_['intersection'](_0x571024[_0xabac('0x2b')],_0x571024[_0xabac('0x2c')]);_0xf2ada5['attributes']=_[_0xabac('0x2f')](_0x571024[_0xabac('0x2b')],qs[_0xabac('0x30')](_0x5714d4[_0xabac('0x2c')]['fields']));_0xf2ada5[_0xabac('0x31')]=_0xf2ada5[_0xabac('0x31')][_0xabac('0x32')]?_0xf2ada5[_0xabac('0x31')]:_0x571024[_0xabac('0x2b')];if(!_0x5714d4[_0xabac('0x2c')][_0xabac('0x33')](_0xabac('0x34'))){_0xf2ada5[_0xabac('0x19')]=qs[_0xabac('0x19')](_0x5714d4['query'][_0xabac('0x19')]);_0xf2ada5[_0xabac('0x17')]=qs[_0xabac('0x17')](_0x5714d4['query'][_0xabac('0x17')]);}_0xf2ada5[_0xabac('0x35')]=qs[_0xabac('0x36')](_0x5714d4[_0xabac('0x2c')][_0xabac('0x36')]);_0xf2ada5[_0xabac('0x37')]=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0x5714d4[_0xabac('0x2c')],_0x571024[_0xabac('0x2e')]),_0x1eb6ee);if(_0x5714d4[_0xabac('0x2c')][_0xabac('0x39')]){_0xf2ada5[_0xabac('0x37')]=_['merge'](_0xf2ada5[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0x1eb6ee,function(_0x1ab8e7){if(_0x1ab8e7[_0xabac('0x3b')]!==_0xabac('0x3c')){var _0x403b06={};_0x403b06[_0x1ab8e7[_0xabac('0x26')]]={'$like':'%'+_0x5714d4['query'][_0xabac('0x39')]+'%'};return _0x403b06;}})});}_0xf2ada5=_[_0xabac('0x3d')]({},_0xf2ada5,_0x5714d4[_0xabac('0x3e')]);var _0x39c157={'where':_0xf2ada5['where']};return db[_0xabac('0x28')][_0xabac('0x1a')](_0x39c157)[_0xabac('0x21')](function(_0x201d51){_0x308f6f[_0xabac('0x1a')]=_0x201d51;if(_0x5714d4['query']['includeAll']){_0xf2ada5['include']=[{'all':!![]}];}return db['Campaign'][_0xabac('0x3f')](_0xf2ada5);})[_0xabac('0x21')](function(_0x1bb9bf){_0x308f6f[_0xabac('0x40')]=_0x1bb9bf;return _0x308f6f;})[_0xabac('0x21')](respondWithFilteredResult(_0x3a624d,_0xf2ada5))[_0xabac('0x41')](handleError(_0x3a624d,null));};exports[_0xabac('0x42')]=function(_0x41ffcd,_0x1b3f34){var _0x4f7792={'raw':![],'where':{'id':_0x41ffcd[_0xabac('0x43')]['id']}},_0x354541={};_0x354541[_0xabac('0x2b')]=_['keys'](db[_0xabac('0x28')]['rawAttributes']);_0x354541[_0xabac('0x2c')]=_[_0xabac('0x2d')](_0x41ffcd[_0xabac('0x2c')]);_0x354541[_0xabac('0x2e')]=_[_0xabac('0x2f')](_0x354541[_0xabac('0x2b')],_0x354541[_0xabac('0x2c')]);_0x4f7792[_0xabac('0x31')]=_['intersection'](_0x354541[_0xabac('0x2b')],qs[_0xabac('0x30')](_0x41ffcd[_0xabac('0x2c')][_0xabac('0x30')]));_0x4f7792[_0xabac('0x31')]=_0x4f7792[_0xabac('0x31')][_0xabac('0x32')]?_0x4f7792[_0xabac('0x31')]:_0x354541[_0xabac('0x2b')];if(_0x41ffcd[_0xabac('0x2c')][_0xabac('0x44')]){_0x4f7792['include']=[{'all':!![]}];}_0x4f7792=_['merge']({},_0x4f7792,_0x41ffcd[_0xabac('0x3e')]);return db[_0xabac('0x28')][_0xabac('0x45')](_0x4f7792)[_0xabac('0x21')](handleEntityNotFound(_0x1b3f34,null))[_0xabac('0x21')](respondWithResult(_0x1b3f34,null))[_0xabac('0x41')](handleError(_0x1b3f34,null));};exports[_0xabac('0x46')]=function(_0x50ec3b,_0x50dd71){return db[_0xabac('0x28')][_0xabac('0x46')](_0x50ec3b[_0xabac('0x47')],{})[_0xabac('0x21')](function(_0x18449a){var _0x13227a=_0x50ec3b[_0xabac('0x48')][_0xabac('0x22')]({'plain':!![]});if(!_0x13227a)throw new Error(_0xabac('0x49'));if(_0x13227a[_0xabac('0x4a')]===_0xabac('0x48')){var _0x2af818=_0x18449a[_0xabac('0x22')]({'plain':!![]});var _0x199ab5=_0xabac('0x4b');return db[_0xabac('0x4c')][_0xabac('0x45')]({'where':{'name':_0x199ab5,'userProfileId':_0x13227a['userProfileId']},'raw':!![]})[_0xabac('0x21')](function(_0x54a04d){if(_0x54a04d&&_0x54a04d[_0xabac('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x2af818['name'],'resourceId':_0x2af818['id'],'type':_0x54a04d[_0xabac('0x26')],'sectionId':_0x54a04d['id']},{})['then'](function(){return _0x18449a;});}else{return _0x18449a;}})[_0xabac('0x41')](function(_0x1cb946){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cb946);throw _0x1cb946;});}return _0x18449a;})[_0xabac('0x21')](respondWithResult(_0x50dd71,0xc9))[_0xabac('0x41')](handleError(_0x50dd71,null));};exports['clone']=function(_0x2edc16,_0x2e6b2e){var _0x1c5553={'where':{'id':_0x2edc16[_0xabac('0x43')]['id']}},_0xcc22ed={};_0xcc22ed[_0xabac('0x2b')]=_[_0xabac('0x2d')](db[_0xabac('0x28')][_0xabac('0x4e')]);_0x1c5553[_0xabac('0x31')]=_[_0xabac('0x2f')](_0xcc22ed[_0xabac('0x2b')],qs[_0xabac('0x30')](_0x2edc16[_0xabac('0x2c')][_0xabac('0x30')]));_0x1c5553[_0xabac('0x31')]=_0x1c5553[_0xabac('0x31')][_0xabac('0x32')]?_0x1c5553[_0xabac('0x31')]:_0xcc22ed[_0xabac('0x2b')];if(_0x2edc16[_0xabac('0x2c')][_0xabac('0x44')]){_0x1c5553[_0xabac('0x4f')]=[{'all':!![]}];}_0x1c5553=_['merge']({},_0x1c5553,_0x2edc16[_0xabac('0x3e')]);return db['Campaign'][_0xabac('0x45')](_0x1c5553)[_0xabac('0x21')](handleEntityNotFound(_0x2e6b2e,null))[_0xabac('0x21')](function(_0x3d6878){if(_0x3d6878){var _0x3f1b5a=_0x3d6878[_0xabac('0x22')]({'plain':!![]});_0x3f1b5a=qs[_0xabac('0x50')](_0x3f1b5a,['id',_0xabac('0x51'),_0xabac('0x52')]);_0x2edc16[_0xabac('0x47')]=_[_0xabac('0x50')](_0x2edc16[_0xabac('0x47')],['id','createdAt',_0xabac('0x52')]);return db[_0xabac('0x28')][_0xabac('0x46')](_[_0xabac('0x3d')](_0x3f1b5a,_0x2edc16[_0xabac('0x47')]),{'include':_0x2edc16['query'][_0xabac('0x44')]?[{'all':!![]}]:undefined})[_0xabac('0x21')](function(_0xf8ecbc){var _0x44ce6b=_0x2edc16[_0xabac('0x48')]['get']({'plain':!![]});if(!_0x44ce6b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44ce6b[_0xabac('0x4a')]===_0xabac('0x48')){var _0x490821=_0xf8ecbc[_0xabac('0x22')]({'plain':!![]});var _0x6bc7a4=_0xabac('0x4b');return db[_0xabac('0x4c')][_0xabac('0x45')]({'where':{'name':_0x6bc7a4,'userProfileId':_0x44ce6b[_0xabac('0x53')]},'raw':!![]})[_0xabac('0x21')](function(_0x25e25e){if(_0x25e25e&&_0x25e25e[_0xabac('0x4d')]===0x0){return db['UserProfileResource'][_0xabac('0x46')]({'name':_0x490821[_0xabac('0x26')],'resourceId':_0x490821['id'],'type':_0x25e25e[_0xabac('0x26')],'sectionId':_0x25e25e['id']},{})[_0xabac('0x21')](function(){return _0xf8ecbc;});}else{return _0xf8ecbc;}})[_0xabac('0x41')](function(_0x2ed8ca){logger[_0xabac('0x24')](_0xabac('0x54'),_0x2ed8ca);throw _0x2ed8ca;});}return _0xf8ecbc;});}})[_0xabac('0x21')](respondWithResult(_0x2e6b2e,0xc9))[_0xabac('0x41')](handleError(_0x2e6b2e,null));};exports[_0xabac('0x55')]=function(_0x42cbef,_0xc1b4ae){if(_0x42cbef[_0xabac('0x47')]['id']){delete _0x42cbef['body']['id'];}return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x42cbef['params']['id']}})[_0xabac('0x21')](handleEntityNotFound(_0xc1b4ae,null))[_0xabac('0x21')](saveUpdates(_0x42cbef[_0xabac('0x47')],null))[_0xabac('0x21')](respondWithResult(_0xc1b4ae,null))[_0xabac('0x41')](handleError(_0xc1b4ae,null));};exports[_0xabac('0x56')]=function(_0x5507b4,_0x7c45b1){return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x5507b4[_0xabac('0x43')]['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x7c45b1,null))[_0xabac('0x21')](removeEntity(_0x7c45b1,null))[_0xabac('0x41')](handleError(_0x7c45b1,null));};exports['getHoppers']=function(_0x2ac6a8,_0x3573c7,_0x889cf2){var _0x135057={'raw':!![],'where':{}};var _0x3aa068={};var _0x1d6b8e={'count':0x0,'rows':[]};return db[_0xabac('0x28')][_0xabac('0x57')]({'where':{'id':_0x2ac6a8[_0xabac('0x43')]['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x3573c7,null))[_0xabac('0x21')](function(_0x30e525){if(_0x30e525){_0x3aa068['model']=_[_0xabac('0x2d')](db[_0xabac('0x58')][_0xabac('0x4e')]);_0x3aa068[_0xabac('0x2c')]=_[_0xabac('0x2d')](_0x2ac6a8[_0xabac('0x2c')]);_0x3aa068[_0xabac('0x2e')]=_[_0xabac('0x2f')](_0x3aa068[_0xabac('0x2b')],_0x3aa068[_0xabac('0x2c')]);_0x135057[_0xabac('0x31')]=_[_0xabac('0x2f')](_0x3aa068['model'],qs['fields'](_0x2ac6a8[_0xabac('0x2c')][_0xabac('0x30')]));_0x135057[_0xabac('0x31')]=_0x135057[_0xabac('0x31')][_0xabac('0x32')]?_0x135057[_0xabac('0x31')]:_0x3aa068[_0xabac('0x2b')];if(!_0x2ac6a8['query'][_0xabac('0x33')](_0xabac('0x34'))){_0x135057['limit']=qs[_0xabac('0x19')](_0x2ac6a8[_0xabac('0x2c')][_0xabac('0x19')]);_0x135057['offset']=qs['offset'](_0x2ac6a8['query'][_0xabac('0x17')]);}_0x135057[_0xabac('0x35')]=qs['sort'](_0x2ac6a8[_0xabac('0x2c')][_0xabac('0x36')]);_0x135057[_0xabac('0x37')]=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0x2ac6a8[_0xabac('0x2c')],_0x3aa068[_0xabac('0x2e')]));_0x135057[_0xabac('0x37')][_0xabac('0x59')]=_0x30e525['id'];if(_0x2ac6a8[_0xabac('0x2c')][_0xabac('0x39')]){_0x135057[_0xabac('0x37')]=_[_0xabac('0x3d')](_0x135057[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0x135057['attributes'],function(_0x23dd76){var _0x19448b={};_0x19448b[_0x23dd76]={'$like':'%'+_0x2ac6a8[_0xabac('0x2c')][_0xabac('0x39')]+'%'};return _0x19448b;})});}_0x135057=_[_0xabac('0x3d')]({},_0x135057,_0x2ac6a8['options']);return db[_0xabac('0x58')][_0xabac('0x1a')]({'where':_0x135057[_0xabac('0x37')]})['then'](function(_0x30be11){_0x1d6b8e[_0xabac('0x1a')]=_0x30be11;if(_0x2ac6a8[_0xabac('0x2c')]['includeAll']){_0x135057['include']=[{'all':!![]}];}return db[_0xabac('0x58')][_0xabac('0x3f')](_0x135057);})['then'](function(_0x34a827){_0x1d6b8e[_0xabac('0x40')]=_0x34a827;return _0x1d6b8e;});}})[_0xabac('0x21')](respondWithFilteredResult(_0x3573c7,_0x135057))['catch'](handleError(_0x3573c7,null));};exports[_0xabac('0x5a')]=function(_0x498dda,_0x4abe55,_0x2b9eba){var _0xa31a74={'raw':!![],'where':{}};var _0x39950c={};var _0x509ac1={'count':0x0,'rows':[]};return db[_0xabac('0x28')][_0xabac('0x57')]({'where':{'id':_0x498dda[_0xabac('0x43')]['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x4abe55,null))[_0xabac('0x21')](function(_0x445a94){if(_0x445a94){_0x39950c['model']=_[_0xabac('0x2d')](db['CmHopperHistory'][_0xabac('0x4e')]);_0x39950c[_0xabac('0x2c')]=_['keys'](_0x498dda[_0xabac('0x2c')]);_0x39950c[_0xabac('0x2e')]=_[_0xabac('0x2f')](_0x39950c[_0xabac('0x2b')],_0x39950c[_0xabac('0x2c')]);_0xa31a74['attributes']=_['intersection'](_0x39950c['model'],qs[_0xabac('0x30')](_0x498dda[_0xabac('0x2c')][_0xabac('0x30')]));_0xa31a74['attributes']=_0xa31a74[_0xabac('0x31')][_0xabac('0x32')]?_0xa31a74[_0xabac('0x31')]:_0x39950c['model'];if(!_0x498dda[_0xabac('0x2c')]['hasOwnProperty'](_0xabac('0x34'))){_0xa31a74[_0xabac('0x19')]=qs['limit'](_0x498dda['query'][_0xabac('0x19')]);_0xa31a74[_0xabac('0x17')]=qs['offset'](_0x498dda[_0xabac('0x2c')]['offset']);}_0xa31a74[_0xabac('0x35')]=qs[_0xabac('0x36')](_0x498dda[_0xabac('0x2c')][_0xabac('0x36')]);_0xa31a74[_0xabac('0x37')]=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0x498dda['query'],_0x39950c[_0xabac('0x2e')]));_0xa31a74[_0xabac('0x37')]['CampaignId']=_0x445a94['id'];if(_0x498dda[_0xabac('0x2c')][_0xabac('0x39')]){_0xa31a74[_0xabac('0x37')]=_[_0xabac('0x3d')](_0xa31a74[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0xa31a74['attributes'],function(_0x4896b0){var _0x229c23={};_0x229c23[_0x4896b0]={'$like':'%'+_0x498dda[_0xabac('0x2c')]['filter']+'%'};return _0x229c23;})});}_0xa31a74=_['merge']({},_0xa31a74,_0x498dda[_0xabac('0x3e')]);return db[_0xabac('0x5b')][_0xabac('0x1a')]({'where':_0xa31a74[_0xabac('0x37')]})[_0xabac('0x21')](function(_0x3fe47f){_0x509ac1['count']=_0x3fe47f;if(_0x498dda['query']['includeAll']){_0xa31a74['include']=[{'all':!![]}];}return db[_0xabac('0x5b')]['findAll'](_0xa31a74);})[_0xabac('0x21')](function(_0x309125){_0x509ac1['rows']=_0x309125;return _0x509ac1;});}})[_0xabac('0x21')](respondWithFilteredResult(_0x4abe55,_0xa31a74))['catch'](handleError(_0x4abe55,null));};exports[_0xabac('0x5c')]=function(_0x1e10b6,_0x52cf62,_0x3dedae){var _0x168965={'raw':!![],'where':{}};var _0x5e445f={};var _0x4b8675={'count':0x0,'rows':[]};return db[_0xabac('0x28')][_0xabac('0x57')]({'where':{'id':_0x1e10b6[_0xabac('0x43')]['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x52cf62,null))[_0xabac('0x21')](function(_0x3b4670){if(_0x3b4670){_0x5e445f['model']=_['keys'](db['CmHopperFinal'][_0xabac('0x4e')]);_0x5e445f[_0xabac('0x2c')]=_['keys'](_0x1e10b6[_0xabac('0x2c')]);_0x5e445f[_0xabac('0x2e')]=_['intersection'](_0x5e445f[_0xabac('0x2b')],_0x5e445f['query']);_0x168965[_0xabac('0x31')]=_[_0xabac('0x2f')](_0x5e445f[_0xabac('0x2b')],qs[_0xabac('0x30')](_0x1e10b6['query'][_0xabac('0x30')]));_0x168965[_0xabac('0x31')]=_0x168965[_0xabac('0x31')][_0xabac('0x32')]?_0x168965[_0xabac('0x31')]:_0x5e445f[_0xabac('0x2b')];if(!_0x1e10b6[_0xabac('0x2c')][_0xabac('0x33')]('nolimit')){_0x168965['limit']=qs[_0xabac('0x19')](_0x1e10b6[_0xabac('0x2c')][_0xabac('0x19')]);_0x168965['offset']=qs['offset'](_0x1e10b6[_0xabac('0x2c')][_0xabac('0x17')]);}_0x168965[_0xabac('0x35')]=qs[_0xabac('0x36')](_0x1e10b6[_0xabac('0x2c')]['sort']);_0x168965[_0xabac('0x37')]=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0x1e10b6[_0xabac('0x2c')],_0x5e445f[_0xabac('0x2e')]));_0x168965[_0xabac('0x37')][_0xabac('0x59')]=_0x3b4670['id'];if(_0x1e10b6[_0xabac('0x2c')][_0xabac('0x39')]){_0x168965[_0xabac('0x37')]=_[_0xabac('0x3d')](_0x168965['where'],{'$or':_[_0xabac('0x3a')](_0x168965[_0xabac('0x31')],function(_0x3affbc){var _0x3da961={};_0x3da961[_0x3affbc]={'$like':'%'+_0x1e10b6[_0xabac('0x2c')]['filter']+'%'};return _0x3da961;})});}_0x168965=_[_0xabac('0x3d')]({},_0x168965,_0x1e10b6[_0xabac('0x3e')]);return db['CmHopperFinal'][_0xabac('0x1a')]({'where':_0x168965[_0xabac('0x37')]})[_0xabac('0x21')](function(_0x19c2da){_0x4b8675[_0xabac('0x1a')]=_0x19c2da;if(_0x1e10b6[_0xabac('0x2c')][_0xabac('0x44')]){_0x168965[_0xabac('0x4f')]=[{'all':!![]}];}return db[_0xabac('0x5d')][_0xabac('0x3f')](_0x168965);})[_0xabac('0x21')](function(_0x1a7ba1){_0x4b8675[_0xabac('0x40')]=_0x1a7ba1;return _0x4b8675;});}})[_0xabac('0x21')](respondWithFilteredResult(_0x52cf62,_0x168965))[_0xabac('0x41')](handleError(_0x52cf62,null));};exports[_0xabac('0x5e')]=function(_0x3223cc,_0x5e96cb,_0x2b6b16){var _0x24d29c={'raw':!![],'where':{}};var _0x2e0c6f={};var _0x4e38ff={'count':0x0,'rows':[]};return db[_0xabac('0x28')][_0xabac('0x57')]({'where':{'id':_0x3223cc[_0xabac('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e96cb,null))['then'](function(_0x1d4d87){if(_0x1d4d87){_0x2e0c6f[_0xabac('0x2b')]=_[_0xabac('0x2d')](db['CmHopperBlack']['rawAttributes']);_0x2e0c6f['query']=_[_0xabac('0x2d')](_0x3223cc[_0xabac('0x2c')]);_0x2e0c6f['filters']=_['intersection'](_0x2e0c6f['model'],_0x2e0c6f[_0xabac('0x2c')]);_0x24d29c[_0xabac('0x31')]=_[_0xabac('0x2f')](_0x2e0c6f[_0xabac('0x2b')],qs[_0xabac('0x30')](_0x3223cc['query'][_0xabac('0x30')]));_0x24d29c['attributes']=_0x24d29c[_0xabac('0x31')][_0xabac('0x32')]?_0x24d29c['attributes']:_0x2e0c6f[_0xabac('0x2b')];if(!_0x3223cc[_0xabac('0x2c')]['hasOwnProperty'](_0xabac('0x34'))){_0x24d29c['limit']=qs[_0xabac('0x19')](_0x3223cc[_0xabac('0x2c')][_0xabac('0x19')]);_0x24d29c[_0xabac('0x17')]=qs[_0xabac('0x17')](_0x3223cc[_0xabac('0x2c')][_0xabac('0x17')]);}_0x24d29c[_0xabac('0x35')]=qs[_0xabac('0x36')](_0x3223cc[_0xabac('0x2c')][_0xabac('0x36')]);_0x24d29c[_0xabac('0x37')]=qs['filters'](_[_0xabac('0x38')](_0x3223cc[_0xabac('0x2c')],_0x2e0c6f[_0xabac('0x2e')]));_0x24d29c[_0xabac('0x37')][_0xabac('0x59')]=_0x1d4d87['id'];if(_0x3223cc[_0xabac('0x2c')][_0xabac('0x39')]){_0x24d29c[_0xabac('0x37')]=_['merge'](_0x24d29c[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0x24d29c[_0xabac('0x31')],function(_0x379fd0){var _0x52c45c={};_0x52c45c[_0x379fd0]={'$like':'%'+_0x3223cc[_0xabac('0x2c')][_0xabac('0x39')]+'%'};return _0x52c45c;})});}_0x24d29c=_['merge']({},_0x24d29c,_0x3223cc[_0xabac('0x3e')]);return db[_0xabac('0x5f')][_0xabac('0x1a')]({'where':_0x24d29c[_0xabac('0x37')]})[_0xabac('0x21')](function(_0x5dbb72){_0x4e38ff['count']=_0x5dbb72;if(_0x3223cc['query'][_0xabac('0x44')]){_0x24d29c[_0xabac('0x4f')]=[{'all':!![]}];}return db[_0xabac('0x5f')][_0xabac('0x3f')](_0x24d29c);})[_0xabac('0x21')](function(_0xe37d20){_0x4e38ff[_0xabac('0x40')]=_0xe37d20;return _0x4e38ff;});}})[_0xabac('0x21')](respondWithFilteredResult(_0x5e96cb,_0x24d29c))['catch'](handleError(_0x5e96cb,null));};exports[_0xabac('0x60')]=function(_0x330324,_0x413f0e,_0x467f73){var _0x51c300={};var _0x2ab4bc={};var _0x2c272f;var _0x37a1bc;return db['Campaign']['findOne']({'where':{'id':_0x330324['params']['id']}})['then'](handleEntityNotFound(_0x413f0e,null))[_0xabac('0x21')](function(_0x1e8064){if(_0x1e8064){_0x2c272f=_0x1e8064;_0x2ab4bc['model']=_['keys'](db[_0xabac('0x61')][_0xabac('0x4e')]);_0x2ab4bc[_0xabac('0x2c')]=_[_0xabac('0x2d')](_0x330324[_0xabac('0x2c')]);_0x2ab4bc[_0xabac('0x2e')]=_['intersection'](_0x2ab4bc['model'],_0x2ab4bc[_0xabac('0x2c')]);_0x51c300[_0xabac('0x31')]=_[_0xabac('0x2f')](_0x2ab4bc['model'],qs['fields'](_0x330324[_0xabac('0x2c')]['fields']));_0x51c300[_0xabac('0x31')]=_0x51c300['attributes']['length']?_0x51c300[_0xabac('0x31')]:_0x2ab4bc[_0xabac('0x2b')];_0x51c300[_0xabac('0x35')]=qs[_0xabac('0x36')](_0x330324['query']['sort']);_0x51c300[_0xabac('0x37')]=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0x330324[_0xabac('0x2c')],_0x2ab4bc[_0xabac('0x2e')]));if(_0x330324[_0xabac('0x2c')][_0xabac('0x39')]){_0x51c300['where']=_[_0xabac('0x3d')](_0x51c300[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0x51c300[_0xabac('0x31')],function(_0x2effdd){var _0x2ce3d3={};_0x2ce3d3[_0x2effdd]={'$like':'%'+_0x330324[_0xabac('0x2c')][_0xabac('0x39')]+'%'};return _0x2ce3d3;})});}_0x51c300=_[_0xabac('0x3d')]({},_0x51c300,_0x330324['options']);return _0x2c272f[_0xabac('0x60')](_0x51c300);}})[_0xabac('0x21')](function(_0x5abf97){if(_0x5abf97){_0x37a1bc=_0x5abf97[_0xabac('0x32')];if(!_0x330324[_0xabac('0x2c')]['hasOwnProperty']('nolimit')){_0x51c300[_0xabac('0x19')]=qs[_0xabac('0x19')](_0x330324[_0xabac('0x2c')][_0xabac('0x19')]);_0x51c300[_0xabac('0x17')]=qs[_0xabac('0x17')](_0x330324[_0xabac('0x2c')]['offset']);}return _0x2c272f[_0xabac('0x60')](_0x51c300);}})[_0xabac('0x21')](function(_0x532ebe){if(_0x532ebe){return _0x532ebe?{'count':_0x37a1bc,'rows':_0x532ebe}:null;}})[_0xabac('0x21')](respondWithResult(_0x413f0e,null))['catch'](handleError(_0x413f0e,null));};exports[_0xabac('0x62')]=function(_0x70d28d,_0x5a790f,_0x24853c){var _0x5c5415,_0x33bad0;var _0x3da35c=[];var _0x2c0caa=moment()[_0xabac('0x63')](_0xabac('0x64'));return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x70d28d['params']['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x5a790f,null))[_0xabac('0x21')](function(_0x26b5f2){if(_0x26b5f2){_0x33bad0=_0x26b5f2;return _0x26b5f2[_0xabac('0x62')](_0x70d28d[_0xabac('0x47')][_0xabac('0x65')],_[_0xabac('0x50')](_0x70d28d[_0xabac('0x47')],['ids','id'])||{});}return null;})[_0xabac('0x66')](function(_0x2f683){var _0x14fe10;var _0x4d86da;_0x5c5415=_0x2f683||[];var _0x507448=[];if(_0x2f683){for(var _0x39d47b=0x0;_0x39d47b<_0x2f683['length'];_0x39d47b+=0x1){var _0x56145f=_0x2f683[_0x39d47b]['get']({'plain':!![]});_0x33bad0['dialCheckDuplicateType']=_0x70d28d['body'][_0xabac('0x67')]?_0x70d28d['body'][_0xabac('0x67')]:_0x33bad0[_0xabac('0x67')];switch(_0x33bad0[_0xabac('0x67')]){case _0xabac('0x68'):_0x14fe10=squel[_0xabac('0x69')]()['into']('cm_hopper')[_0xabac('0x6a')]([_0xabac('0x6b'),_0xabac('0x6c'),_0xabac('0x6d'),_0xabac('0x6e'),_0xabac('0x59'),'createdAt',_0xabac('0x52')],squel[_0xabac('0x6f')]()['field'](_0xabac('0x6b'),_0xabac('0x6b'))[_0xabac('0x70')](_0xabac('0x71'),_0xabac('0x6c'))[_0xabac('0x70')]('id',_0xabac('0x6d'))[_0xabac('0x70')](_0x56145f[_0xabac('0x72')]['toString'](),_0xabac('0x6e'))[_0xabac('0x70')](_0x70d28d[_0xabac('0x43')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x2c0caa+'\x27',_0xabac('0x51'))[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27',_0xabac('0x52'))['from'](_0xabac('0x73'))[_0xabac('0x37')](_0xabac('0x74'))[_0xabac('0x37')](_0xabac('0x75'),_0x56145f['CmListId'][_0xabac('0x76')]())[_0xabac('0x37')](_0xabac('0x77'))[_0xabac('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0xabac('0x6f')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0xabac('0x78')]('cm_hopper_final')[_0xabac('0x37')]('CampaignId\x20=\x20?',_0x70d28d[_0xabac('0x43')]['id'][_0xabac('0x76')]()))[_0xabac('0x37')](_0xabac('0x79'),squel[_0xabac('0x6f')]()[_0xabac('0x70')]('COALESCE(phone,\x27\x27)')[_0xabac('0x78')]('cm_hopper')[_0xabac('0x37')](_0xabac('0x7a'),_0x70d28d[_0xabac('0x43')]['id'][_0xabac('0x76')]())))[_0xabac('0x76')]();break;case'onlyIfOpen':_0x14fe10=squel[_0xabac('0x69')]()[_0xabac('0x7b')](_0xabac('0x7c'))[_0xabac('0x6a')](['phone',_0xabac('0x6c'),_0xabac('0x6d'),_0xabac('0x6e'),_0xabac('0x59'),_0xabac('0x51'),_0xabac('0x52')],squel['select']()[_0xabac('0x70')]('phone','phone')[_0xabac('0x70')](_0xabac('0x71'),_0xabac('0x6c'))['field']('id',_0xabac('0x6d'))['field'](_0x56145f['CmListId'][_0xabac('0x76')](),_0xabac('0x6e'))[_0xabac('0x70')](_0x70d28d[_0xabac('0x43')]['id']['toString'](),_0xabac('0x59'))[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27',_0xabac('0x51'))[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27',_0xabac('0x52'))[_0xabac('0x78')](_0xabac('0x73'))[_0xabac('0x37')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x56145f[_0xabac('0x72')][_0xabac('0x76')]())[_0xabac('0x37')](_0xabac('0x77'))[_0xabac('0x37')](_0xabac('0x79'),squel[_0xabac('0x6f')]()['field'](_0xabac('0x7d'))['from']('cm_hopper')[_0xabac('0x37')](_0xabac('0x7a'),_0x70d28d[_0xabac('0x43')]['id']['toString']())))['toString']();break;default:_0x14fe10=squel[_0xabac('0x69')]()[_0xabac('0x7b')](_0xabac('0x7c'))[_0xabac('0x6a')](['phone','scheduledAt',_0xabac('0x6d'),_0xabac('0x6e'),_0xabac('0x59'),_0xabac('0x51'),'updatedAt'],squel['select']()[_0xabac('0x70')](_0xabac('0x6b'),_0xabac('0x6b'))['field']('NOW()',_0xabac('0x6c'))['field']('id',_0xabac('0x6d'))[_0xabac('0x70')](_0x56145f[_0xabac('0x72')]['toString'](),'ListId')[_0xabac('0x70')](_0x70d28d[_0xabac('0x43')]['id'][_0xabac('0x76')](),_0xabac('0x59'))[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27','createdAt')[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27',_0xabac('0x52'))['from'](_0xabac('0x73'))[_0xabac('0x37')](_0xabac('0x74'))[_0xabac('0x37')](_0xabac('0x75'),_0x56145f[_0xabac('0x72')]['toString']())['where'](_0xabac('0x77')))[_0xabac('0x76')]();}_0x4d86da=squel[_0xabac('0x69')]()[_0xabac('0x7b')](_0xabac('0x7e'))[_0xabac('0x6a')]([_0xabac('0x7f'),_0xabac('0x6c'),_0xabac('0x6b'),'OrderBy','createdAt',_0xabac('0x52')],squel[_0xabac('0x6f')]()[_0xabac('0x70')]('h.id','id')['field'](_0xabac('0x71'),'scheduledAt')['field'](_0xabac('0x80'),_0xabac('0x6b'))[_0xabac('0x70')](_0xabac('0x81'),'OrderBy')['field']('\x27'+_0x2c0caa+'\x27',_0xabac('0x51'))[_0xabac('0x70')]('\x27'+_0x2c0caa+'\x27',_0xabac('0x52'))['from'](_0xabac('0x82'),'ci')['join'](_0xabac('0x7c'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xabac('0x37')](_0xabac('0x83'),_0x56145f[_0xabac('0x72')]['toString']())[_0xabac('0x37')](_0xabac('0x84'),_0x70d28d[_0xabac('0x43')]['id'][_0xabac('0x76')]())[_0xabac('0x37')](_0xabac('0x85'),_0x2c0caa))[_0xabac('0x76')]();_0x507448[_0xabac('0x86')](db[_0xabac('0x87')]['query'](_0x14fe10));_0x3da35c[_0xabac('0x86')](db[_0xabac('0x87')][_0xabac('0x2c')](_0x4d86da));}return BPromise['all'](_0x507448);}})[_0xabac('0x21')](function(){return BPromise[_0xabac('0x88')](_0x3da35c);})[_0xabac('0x21')](function(){return _0x5c5415;})[_0xabac('0x21')](respondWithResult(_0x5a790f,null))['catch'](handleError(_0x5a790f,null));};exports[_0xabac('0x89')]=function(_0x3fe4cd,_0x1852db,_0x17b65d){return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x3fe4cd['params']['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x1852db,null))[_0xabac('0x21')](function(_0x3490ee){if(_0x3490ee){return _0x3490ee[_0xabac('0x89')](_0x3fe4cd[_0xabac('0x2c')][_0xabac('0x65')]);}})['then'](function(_0x512838){if(_0x512838){return db['CmHopper'][_0xabac('0x56')]({'where':{'ListId':_0x3fe4cd[_0xabac('0x2c')][_0xabac('0x65')],'CampaignId':_0x3fe4cd[_0xabac('0x43')]['id']}})[_0xabac('0x21')](function(){return _0x512838;});}})[_0xabac('0x21')](respondWithStatusCode(_0x1852db,null))[_0xabac('0x41')](handleError(_0x1852db,null));};exports[_0xabac('0x8a')]=function(_0xcf8beb,_0x3bdc03,_0x24f177){var _0x189bc3={};var _0x5b1034={};var _0x557670;var _0x11cb24;return db[_0xabac('0x28')]['findOne']({'where':{'id':_0xcf8beb['params']['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x3bdc03,null))[_0xabac('0x21')](function(_0x182471){if(_0x182471){_0x557670=_0x182471;_0x5b1034[_0xabac('0x2b')]=_[_0xabac('0x2d')](db['CmList'][_0xabac('0x4e')]);_0x5b1034[_0xabac('0x2c')]=_[_0xabac('0x2d')](_0xcf8beb['query']);_0x5b1034[_0xabac('0x2e')]=_[_0xabac('0x2f')](_0x5b1034[_0xabac('0x2b')],_0x5b1034[_0xabac('0x2c')]);_0x189bc3[_0xabac('0x31')]=_['intersection'](_0x5b1034['model'],qs[_0xabac('0x30')](_0xcf8beb['query']['fields']));_0x189bc3[_0xabac('0x31')]=_0x189bc3['attributes'][_0xabac('0x32')]?_0x189bc3[_0xabac('0x31')]:_0x5b1034['model'];_0x189bc3['order']=qs[_0xabac('0x36')](_0xcf8beb[_0xabac('0x2c')][_0xabac('0x36')]);_0x189bc3['where']=qs[_0xabac('0x2e')](_[_0xabac('0x38')](_0xcf8beb['query'],_0x5b1034['filters']));if(_0xcf8beb[_0xabac('0x2c')][_0xabac('0x39')]){_0x189bc3['where']=_[_0xabac('0x3d')](_0x189bc3[_0xabac('0x37')],{'$or':_[_0xabac('0x3a')](_0x189bc3[_0xabac('0x31')],function(_0xc5242e){var _0x36d829={};_0x36d829[_0xc5242e]={'$like':'%'+_0xcf8beb['query'][_0xabac('0x39')]+'%'};return _0x36d829;})});}_0x189bc3=_[_0xabac('0x3d')]({},_0x189bc3,_0xcf8beb[_0xabac('0x3e')]);return _0x557670['getBlackLists'](_0x189bc3);}})['then'](function(_0x16c0cf){if(_0x16c0cf){_0x11cb24=_0x16c0cf['length'];if(!_0xcf8beb[_0xabac('0x2c')][_0xabac('0x33')](_0xabac('0x34'))){_0x189bc3[_0xabac('0x19')]=qs[_0xabac('0x19')](_0xcf8beb['query']['limit']);_0x189bc3[_0xabac('0x17')]=qs[_0xabac('0x17')](_0xcf8beb[_0xabac('0x2c')][_0xabac('0x17')]);}return _0x557670[_0xabac('0x8a')](_0x189bc3);}})[_0xabac('0x21')](function(_0x4ed552){if(_0x4ed552){return _0x4ed552?{'count':_0x11cb24,'rows':_0x4ed552}:null;}})[_0xabac('0x21')](respondWithResult(_0x3bdc03,null))['catch'](handleError(_0x3bdc03,null));};exports[_0xabac('0x8b')]=function(_0x155341,_0xc44f98,_0x55c34d){var _0x277b6b,_0x48b17a;var _0x21fcd8=[];var _0x5bd78b=moment()[_0xabac('0x63')](_0xabac('0x64'));return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x155341[_0xabac('0x43')]['id']}})['then'](handleEntityNotFound(_0xc44f98,null))[_0xabac('0x21')](function(_0x41559e){if(_0x41559e){_0x48b17a=_0x41559e;return _0x41559e[_0xabac('0x8b')](_0x155341[_0xabac('0x47')][_0xabac('0x65')],_[_0xabac('0x50')](_0x155341['body'],[_0xabac('0x65'),'id'])||{});}return null;})['spread'](function(_0x3e237f){var _0x20446d;var _0x2d0fb0;_0x277b6b=_0x3e237f||[];var _0x37bfac=[];if(_0x3e237f){for(var _0x3316b6=0x0;_0x3316b6<_0x3e237f[_0xabac('0x32')];_0x3316b6+=0x1){var _0x3640f5=_0x3e237f[_0x3316b6][_0xabac('0x22')]({'plain':!![]});_0x20446d=squel['insert']()[_0xabac('0x7b')](_0xabac('0x8c'))[_0xabac('0x6a')]([_0xabac('0x6b'),_0xabac('0x6d'),_0xabac('0x6e'),_0xabac('0x59'),_0xabac('0x51'),_0xabac('0x52')],squel[_0xabac('0x6f')]()[_0xabac('0x70')](_0xabac('0x6b'),_0xabac('0x6b'))[_0xabac('0x70')]('id',_0xabac('0x6d'))['field'](_0x3640f5[_0xabac('0x72')][_0xabac('0x76')](),_0xabac('0x6e'))[_0xabac('0x70')](_0x155341[_0xabac('0x43')]['id']['toString'](),_0xabac('0x59'))[_0xabac('0x70')](_0xabac('0x71'),_0xabac('0x51'))[_0xabac('0x70')]('NOW()',_0xabac('0x52'))[_0xabac('0x78')](_0xabac('0x73'))[_0xabac('0x37')]('deletedAt\x20IS\x20NULL')[_0xabac('0x37')](_0xabac('0x75'),_0x3640f5['CmListId'][_0xabac('0x76')]())['where'](_0xabac('0x77')))['toString']();_0x37bfac[_0xabac('0x86')](db['sequelize'][_0xabac('0x2c')](_0x20446d));}return BPromise['all'](_0x37bfac);}})[_0xabac('0x21')](function(){return _0x277b6b;})['then'](respondWithResult(_0xc44f98,null))[_0xabac('0x41')](handleError(_0xc44f98,null));};exports[_0xabac('0x8d')]=function(_0x5cffca,_0x350f7b,_0x10f24d){return db[_0xabac('0x28')][_0xabac('0x45')]({'where':{'id':_0x5cffca[_0xabac('0x43')]['id']}})[_0xabac('0x21')](handleEntityNotFound(_0x350f7b,null))['then'](function(_0x1c9d3f){if(_0x1c9d3f){return _0x1c9d3f['removeBlackLists'](_0x5cffca['query'][_0xabac('0x65')]);}})['then'](function(_0x472f3f){if(_0x472f3f){return db[_0xabac('0x5f')][_0xabac('0x56')]({'where':{'ListId':_0x5cffca[_0xabac('0x2c')][_0xabac('0x65')],'CampaignId':_0x5cffca[_0xabac('0x43')]['id']}})[_0xabac('0x21')](function(){return _0x472f3f;});}})[_0xabac('0x21')](respondWithStatusCode(_0x350f7b,null))[_0xabac('0x41')](handleError(_0x350f7b,null));}; \ No newline at end of file +var _0x5453=['Campaign','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','UserProfileSection','error','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId','toString','from','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','insert','cm_contacts','deletedAt\x20IS\x20NULL','cmHopperId','OrderBy','h.id','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','index','map'];(function(_0x3da5ce,_0x2787ea){var _0x3d217a=function(_0x4f1c3d){while(--_0x4f1c3d){_0x3da5ce['push'](_0x3da5ce['shift']());}};_0x3d217a(++_0x2787ea);}(_0x5453,0x18b));var _0x3545=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5453[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x3545('0x0'));var rimraf=require(_0x3545('0x1'));var zipdir=require(_0x3545('0x2'));var jsonpatch=require(_0x3545('0x3'));var rp=require(_0x3545('0x4'));var moment=require(_0x3545('0x5'));var BPromise=require(_0x3545('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3545('0x7'));var sox=require(_0x3545('0x8'));var csv=require('to-csv');var ejs=require(_0x3545('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3545('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3545('0xb'));var deskjs=require(_0x3545('0xc'));var toCsv=require(_0x3545('0xd'));var querystring=require('querystring');var Papa=require(_0x3545('0xe'));var Redis=require(_0x3545('0xf'));var authService=require(_0x3545('0x10'));var qs=require(_0x3545('0x11'));var as=require(_0x3545('0x12'));var hardwareService=require(_0x3545('0x13'));var logger=require(_0x3545('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3545('0x15'));var licenseUtil=require(_0x3545('0x16'));var db=require(_0x3545('0x17'))['db'];function respondWithStatusCode(_0x3de48b,_0x54fcf4){_0x54fcf4=_0x54fcf4||0xcc;return function(_0x4b9316){if(_0x4b9316){return _0x3de48b['sendStatus'](_0x54fcf4);}return _0x3de48b[_0x3545('0x18')](_0x54fcf4)[_0x3545('0x19')]();};}function respondWithResult(_0x5ddba6,_0x427f72){_0x427f72=_0x427f72||0xc8;return function(_0x5b5474){if(_0x5b5474){return _0x5ddba6['status'](_0x427f72)[_0x3545('0x1a')](_0x5b5474);}};}function respondWithFilteredResult(_0x1a4a55,_0x569ebd){return function(_0x29921b){if(_0x29921b){var _0x1717f6=typeof _0x569ebd['offset']===_0x3545('0x1b')&&typeof _0x569ebd['limit']===_0x3545('0x1b');var _0x16e2f8=_0x29921b[_0x3545('0x1c')];var _0x2c008a=_0x1717f6?0x0:_0x569ebd['offset'];var _0x573970=_0x1717f6?_0x29921b[_0x3545('0x1c')]:_0x569ebd['offset']+_0x569ebd[_0x3545('0x1d')];var _0x21c623;if(_0x573970>=_0x16e2f8){_0x573970=_0x16e2f8;_0x21c623=0xc8;}else{_0x21c623=0xce;}_0x1a4a55[_0x3545('0x18')](_0x21c623);return _0x1a4a55[_0x3545('0x1e')](_0x3545('0x1f'),_0x2c008a+'-'+_0x573970+'/'+_0x16e2f8)[_0x3545('0x1a')](_0x29921b);}return null;};}function patchUpdates(_0x10037f){return function(_0x365bc3){try{jsonpatch[_0x3545('0x20')](_0x365bc3,_0x10037f,!![]);}catch(_0x329228){return BPromise[_0x3545('0x21')](_0x329228);}return _0x365bc3['save']();};}function saveUpdates(_0x57de12,_0x20800f){return function(_0x580791){if(_0x580791){return _0x580791[_0x3545('0x22')](_0x57de12)[_0x3545('0x23')](function(_0x5bd498){return _0x5bd498;});}return null;};}function removeEntity(_0x473c00,_0x528b30){return function(_0x5de099){if(_0x5de099){return _0x5de099[_0x3545('0x24')]()[_0x3545('0x23')](function(){var _0x5bb284=_0x5de099[_0x3545('0x25')]({'plain':!![]});var _0x21c4e5=_0x3545('0x26');return db[_0x3545('0x27')][_0x3545('0x24')]({'where':{'type':_0x21c4e5,'resourceId':_0x5bb284['id']}})[_0x3545('0x23')](function(){return _0x5de099;});})['then'](function(){_0x473c00[_0x3545('0x18')](0xcc)[_0x3545('0x19')]();});}};}function handleEntityNotFound(_0x1cc167,_0xeea892){return function(_0x864712){if(!_0x864712){_0x1cc167[_0x3545('0x28')](0x194);}return _0x864712;};}function handleError(_0x3535e6,_0x5360df){_0x5360df=_0x5360df||0x1f4;return function(_0x46450f){logger['error'](_0x46450f['stack']);if(_0x46450f['name']){delete _0x46450f['name'];}_0x3535e6[_0x3545('0x18')](_0x5360df)['send'](_0x46450f);};}exports[_0x3545('0x29')]=function(_0x900e88,_0x341ad3){var _0x2f6057={},_0x3d78a9={},_0x77931f={'count':0x0,'rows':[]};var _0x2fb95f=_[_0x3545('0x2a')](db[_0x3545('0x2b')][_0x3545('0x2c')],function(_0x1277a8){return{'name':_0x1277a8['fieldName'],'type':_0x1277a8['type'][_0x3545('0x2d')]};});_0x3d78a9[_0x3545('0x2e')]=_['map'](_0x2fb95f,_0x3545('0x2f'));_0x3d78a9[_0x3545('0x30')]=_[_0x3545('0x31')](_0x900e88[_0x3545('0x30')]);_0x3d78a9[_0x3545('0x32')]=_[_0x3545('0x33')](_0x3d78a9[_0x3545('0x2e')],_0x3d78a9[_0x3545('0x30')]);_0x2f6057[_0x3545('0x34')]=_[_0x3545('0x33')](_0x3d78a9['model'],qs[_0x3545('0x35')](_0x900e88[_0x3545('0x30')][_0x3545('0x35')]));_0x2f6057[_0x3545('0x34')]=_0x2f6057[_0x3545('0x34')][_0x3545('0x36')]?_0x2f6057['attributes']:_0x3d78a9['model'];if(!_0x900e88[_0x3545('0x30')][_0x3545('0x37')](_0x3545('0x38'))){_0x2f6057[_0x3545('0x1d')]=qs[_0x3545('0x1d')](_0x900e88[_0x3545('0x30')]['limit']);_0x2f6057[_0x3545('0x39')]=qs['offset'](_0x900e88['query']['offset']);}_0x2f6057[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x900e88['query'][_0x3545('0x3b')]);_0x2f6057[_0x3545('0x3c')]=qs[_0x3545('0x32')](_[_0x3545('0x3d')](_0x900e88[_0x3545('0x30')],_0x3d78a9[_0x3545('0x32')]),_0x2fb95f);if(_0x900e88[_0x3545('0x30')][_0x3545('0x3e')]){_0x2f6057['where']=_[_0x3545('0x3f')](_0x2f6057[_0x3545('0x3c')],{'$or':_[_0x3545('0x2a')](_0x2fb95f,function(_0x2ec932){if(_0x2ec932[_0x3545('0x40')]!==_0x3545('0x41')){var _0x51a06a={};_0x51a06a[_0x2ec932['name']]={'$like':'%'+_0x900e88[_0x3545('0x30')][_0x3545('0x3e')]+'%'};return _0x51a06a;}})});}_0x2f6057=_[_0x3545('0x3f')]({},_0x2f6057,_0x900e88[_0x3545('0x42')]);var _0x2f13b8={'where':_0x2f6057['where']};return db[_0x3545('0x2b')][_0x3545('0x1c')](_0x2f13b8)[_0x3545('0x23')](function(_0x4d5469){_0x77931f[_0x3545('0x1c')]=_0x4d5469;if(_0x900e88[_0x3545('0x30')]['includeAll']){_0x2f6057[_0x3545('0x43')]=[{'all':!![]}];}return db[_0x3545('0x2b')][_0x3545('0x44')](_0x2f6057);})['then'](function(_0xee3a73){_0x77931f[_0x3545('0x45')]=_0xee3a73;return _0x77931f;})[_0x3545('0x23')](respondWithFilteredResult(_0x341ad3,_0x2f6057))[_0x3545('0x46')](handleError(_0x341ad3,null));};exports[_0x3545('0x47')]=function(_0x44af9d,_0x530854){var _0x505898={'raw':![],'where':{'id':_0x44af9d[_0x3545('0x48')]['id']}},_0x5c9303={};_0x5c9303[_0x3545('0x2e')]=_[_0x3545('0x31')](db[_0x3545('0x2b')]['rawAttributes']);_0x5c9303[_0x3545('0x30')]=_[_0x3545('0x31')](_0x44af9d[_0x3545('0x30')]);_0x5c9303[_0x3545('0x32')]=_[_0x3545('0x33')](_0x5c9303[_0x3545('0x2e')],_0x5c9303[_0x3545('0x30')]);_0x505898[_0x3545('0x34')]=_[_0x3545('0x33')](_0x5c9303['model'],qs['fields'](_0x44af9d[_0x3545('0x30')]['fields']));_0x505898[_0x3545('0x34')]=_0x505898[_0x3545('0x34')]['length']?_0x505898[_0x3545('0x34')]:_0x5c9303[_0x3545('0x2e')];if(_0x44af9d[_0x3545('0x30')][_0x3545('0x49')]){_0x505898['include']=[{'all':!![]}];}_0x505898=_['merge']({},_0x505898,_0x44af9d[_0x3545('0x42')]);return db[_0x3545('0x2b')]['find'](_0x505898)[_0x3545('0x23')](handleEntityNotFound(_0x530854,null))['then'](respondWithResult(_0x530854,null))[_0x3545('0x46')](handleError(_0x530854,null));};exports[_0x3545('0x4a')]=function(_0x5f4e9c,_0x3350a9){return db['Campaign'][_0x3545('0x4a')](_0x5f4e9c[_0x3545('0x4b')],{})[_0x3545('0x23')](function(_0x181301){var _0x24ee85=_0x5f4e9c[_0x3545('0x4c')][_0x3545('0x25')]({'plain':!![]});if(!_0x24ee85)throw new Error(_0x3545('0x4d'));if(_0x24ee85[_0x3545('0x4e')]==='user'){var _0x1e16c1=_0x181301['get']({'plain':!![]});var _0x309c3b='IvrCampaigns';return db['UserProfileSection'][_0x3545('0x4f')]({'where':{'name':_0x309c3b,'userProfileId':_0x24ee85[_0x3545('0x50')]},'raw':!![]})[_0x3545('0x23')](function(_0x278b8e){if(_0x278b8e&&_0x278b8e[_0x3545('0x51')]===0x0){return db[_0x3545('0x27')][_0x3545('0x4a')]({'name':_0x1e16c1[_0x3545('0x2f')],'resourceId':_0x1e16c1['id'],'type':_0x278b8e[_0x3545('0x2f')],'sectionId':_0x278b8e['id']},{})[_0x3545('0x23')](function(){return _0x181301;});}else{return _0x181301;}})['catch'](function(_0x2e506b){logger['error'](_0x3545('0x52'),_0x2e506b);throw _0x2e506b;});}return _0x181301;})[_0x3545('0x23')](respondWithResult(_0x3350a9,0xc9))[_0x3545('0x46')](handleError(_0x3350a9,null));};exports[_0x3545('0x53')]=function(_0x3db67c,_0x5d3ed2){var _0x557a73={'where':{'id':_0x3db67c[_0x3545('0x48')]['id']}},_0x2416a8={};_0x2416a8[_0x3545('0x2e')]=_[_0x3545('0x31')](db['Campaign'][_0x3545('0x2c')]);_0x557a73[_0x3545('0x34')]=_['intersection'](_0x2416a8[_0x3545('0x2e')],qs['fields'](_0x3db67c[_0x3545('0x30')]['fields']));_0x557a73['attributes']=_0x557a73[_0x3545('0x34')][_0x3545('0x36')]?_0x557a73[_0x3545('0x34')]:_0x2416a8[_0x3545('0x2e')];if(_0x3db67c[_0x3545('0x30')][_0x3545('0x49')]){_0x557a73[_0x3545('0x43')]=[{'all':!![]}];}_0x557a73=_[_0x3545('0x3f')]({},_0x557a73,_0x3db67c[_0x3545('0x42')]);return db[_0x3545('0x2b')][_0x3545('0x4f')](_0x557a73)[_0x3545('0x23')](handleEntityNotFound(_0x5d3ed2,null))[_0x3545('0x23')](function(_0x2a8a6d){if(_0x2a8a6d){var _0x424e89=_0x2a8a6d[_0x3545('0x25')]({'plain':!![]});_0x424e89=qs[_0x3545('0x54')](_0x424e89,['id','createdAt',_0x3545('0x55')]);_0x3db67c[_0x3545('0x4b')]=_[_0x3545('0x54')](_0x3db67c[_0x3545('0x4b')],['id',_0x3545('0x56'),_0x3545('0x55')]);return db[_0x3545('0x2b')][_0x3545('0x4a')](_[_0x3545('0x3f')](_0x424e89,_0x3db67c[_0x3545('0x4b')]),{'include':_0x3db67c[_0x3545('0x30')][_0x3545('0x49')]?[{'all':!![]}]:undefined})[_0x3545('0x23')](function(_0x373852){var _0x37a077=_0x3db67c[_0x3545('0x4c')][_0x3545('0x25')]({'plain':!![]});if(!_0x37a077)throw new Error(_0x3545('0x4d'));if(_0x37a077[_0x3545('0x4e')]===_0x3545('0x4c')){var _0x176ac3=_0x373852[_0x3545('0x25')]({'plain':!![]});var _0x1c0d67=_0x3545('0x26');return db[_0x3545('0x57')]['find']({'where':{'name':_0x1c0d67,'userProfileId':_0x37a077[_0x3545('0x50')]},'raw':!![]})[_0x3545('0x23')](function(_0x2ddf75){if(_0x2ddf75&&_0x2ddf75[_0x3545('0x51')]===0x0){return db[_0x3545('0x27')][_0x3545('0x4a')]({'name':_0x176ac3[_0x3545('0x2f')],'resourceId':_0x176ac3['id'],'type':_0x2ddf75['name'],'sectionId':_0x2ddf75['id']},{})[_0x3545('0x23')](function(){return _0x373852;});}else{return _0x373852;}})[_0x3545('0x46')](function(_0x4f40da){logger[_0x3545('0x58')](_0x3545('0x52'),_0x4f40da);throw _0x4f40da;});}return _0x373852;});}})[_0x3545('0x23')](respondWithResult(_0x5d3ed2,0xc9))['catch'](handleError(_0x5d3ed2,null));};exports['update']=function(_0x269419,_0x5d2bea){if(_0x269419[_0x3545('0x4b')]['id']){delete _0x269419[_0x3545('0x4b')]['id'];}return db[_0x3545('0x2b')][_0x3545('0x4f')]({'where':{'id':_0x269419[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x5d2bea,null))[_0x3545('0x23')](saveUpdates(_0x269419[_0x3545('0x4b')],null))[_0x3545('0x23')](respondWithResult(_0x5d2bea,null))[_0x3545('0x46')](handleError(_0x5d2bea,null));};exports[_0x3545('0x24')]=function(_0x571416,_0x4d4e91){return db[_0x3545('0x2b')][_0x3545('0x4f')]({'where':{'id':_0x571416[_0x3545('0x48')]['id']}})['then'](handleEntityNotFound(_0x4d4e91,null))[_0x3545('0x23')](removeEntity(_0x4d4e91,null))['catch'](handleError(_0x4d4e91,null));};exports[_0x3545('0x59')]=function(_0x3c3bdf,_0x384638,_0x3ea02f){var _0x4028ab={'raw':!![],'where':{}};var _0x428eaa={};var _0x179991={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3c3bdf[_0x3545('0x48')]['id']}})['then'](handleEntityNotFound(_0x384638,null))[_0x3545('0x23')](function(_0x255561){if(_0x255561){_0x428eaa[_0x3545('0x2e')]=_[_0x3545('0x31')](db[_0x3545('0x5a')][_0x3545('0x2c')]);_0x428eaa[_0x3545('0x30')]=_[_0x3545('0x31')](_0x3c3bdf['query']);_0x428eaa[_0x3545('0x32')]=_[_0x3545('0x33')](_0x428eaa[_0x3545('0x2e')],_0x428eaa[_0x3545('0x30')]);_0x4028ab[_0x3545('0x34')]=_['intersection'](_0x428eaa[_0x3545('0x2e')],qs['fields'](_0x3c3bdf[_0x3545('0x30')][_0x3545('0x35')]));_0x4028ab['attributes']=_0x4028ab[_0x3545('0x34')][_0x3545('0x36')]?_0x4028ab[_0x3545('0x34')]:_0x428eaa[_0x3545('0x2e')];if(!_0x3c3bdf[_0x3545('0x30')][_0x3545('0x37')](_0x3545('0x38'))){_0x4028ab['limit']=qs['limit'](_0x3c3bdf['query'][_0x3545('0x1d')]);_0x4028ab['offset']=qs[_0x3545('0x39')](_0x3c3bdf[_0x3545('0x30')][_0x3545('0x39')]);}_0x4028ab[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x3c3bdf[_0x3545('0x30')][_0x3545('0x3b')]);_0x4028ab[_0x3545('0x3c')]=qs['filters'](_['pick'](_0x3c3bdf[_0x3545('0x30')],_0x428eaa[_0x3545('0x32')]));_0x4028ab[_0x3545('0x3c')][_0x3545('0x5b')]=_0x255561['id'];if(_0x3c3bdf[_0x3545('0x30')][_0x3545('0x3e')]){_0x4028ab[_0x3545('0x3c')]=_[_0x3545('0x3f')](_0x4028ab[_0x3545('0x3c')],{'$or':_[_0x3545('0x2a')](_0x4028ab['attributes'],function(_0x2b4bed){var _0x5f25b6={};_0x5f25b6[_0x2b4bed]={'$like':'%'+_0x3c3bdf[_0x3545('0x30')][_0x3545('0x3e')]+'%'};return _0x5f25b6;})});}_0x4028ab=_[_0x3545('0x3f')]({},_0x4028ab,_0x3c3bdf[_0x3545('0x42')]);return db['CmHopper'][_0x3545('0x1c')]({'where':_0x4028ab[_0x3545('0x3c')]})[_0x3545('0x23')](function(_0x1a5198){_0x179991[_0x3545('0x1c')]=_0x1a5198;if(_0x3c3bdf[_0x3545('0x30')][_0x3545('0x49')]){_0x4028ab['include']=[{'all':!![]}];}return db[_0x3545('0x5a')]['findAll'](_0x4028ab);})[_0x3545('0x23')](function(_0x15964a){_0x179991[_0x3545('0x45')]=_0x15964a;return _0x179991;});}})[_0x3545('0x23')](respondWithFilteredResult(_0x384638,_0x4028ab))['catch'](handleError(_0x384638,null));};exports[_0x3545('0x5c')]=function(_0x4ef84b,_0x5f1f40,_0xaf94fd){var _0x3a5035={'raw':!![],'where':{}};var _0x1eade9={};var _0x431548={'count':0x0,'rows':[]};return db['Campaign'][_0x3545('0x5d')]({'where':{'id':_0x4ef84b['params']['id']}})['then'](handleEntityNotFound(_0x5f1f40,null))[_0x3545('0x23')](function(_0x427247){if(_0x427247){_0x1eade9[_0x3545('0x2e')]=_['keys'](db[_0x3545('0x5e')][_0x3545('0x2c')]);_0x1eade9[_0x3545('0x30')]=_[_0x3545('0x31')](_0x4ef84b[_0x3545('0x30')]);_0x1eade9[_0x3545('0x32')]=_[_0x3545('0x33')](_0x1eade9['model'],_0x1eade9[_0x3545('0x30')]);_0x3a5035['attributes']=_[_0x3545('0x33')](_0x1eade9[_0x3545('0x2e')],qs[_0x3545('0x35')](_0x4ef84b[_0x3545('0x30')][_0x3545('0x35')]));_0x3a5035[_0x3545('0x34')]=_0x3a5035[_0x3545('0x34')][_0x3545('0x36')]?_0x3a5035['attributes']:_0x1eade9[_0x3545('0x2e')];if(!_0x4ef84b['query'][_0x3545('0x37')](_0x3545('0x38'))){_0x3a5035[_0x3545('0x1d')]=qs[_0x3545('0x1d')](_0x4ef84b[_0x3545('0x30')]['limit']);_0x3a5035['offset']=qs[_0x3545('0x39')](_0x4ef84b[_0x3545('0x30')][_0x3545('0x39')]);}_0x3a5035[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x4ef84b[_0x3545('0x30')][_0x3545('0x3b')]);_0x3a5035['where']=qs[_0x3545('0x32')](_[_0x3545('0x3d')](_0x4ef84b['query'],_0x1eade9['filters']));_0x3a5035[_0x3545('0x3c')][_0x3545('0x5b')]=_0x427247['id'];if(_0x4ef84b[_0x3545('0x30')][_0x3545('0x3e')]){_0x3a5035['where']=_['merge'](_0x3a5035[_0x3545('0x3c')],{'$or':_[_0x3545('0x2a')](_0x3a5035['attributes'],function(_0x13d47d){var _0x5e7c85={};_0x5e7c85[_0x13d47d]={'$like':'%'+_0x4ef84b['query'][_0x3545('0x3e')]+'%'};return _0x5e7c85;})});}_0x3a5035=_[_0x3545('0x3f')]({},_0x3a5035,_0x4ef84b[_0x3545('0x42')]);return db[_0x3545('0x5e')][_0x3545('0x1c')]({'where':_0x3a5035['where']})[_0x3545('0x23')](function(_0x469e0c){_0x431548[_0x3545('0x1c')]=_0x469e0c;if(_0x4ef84b['query'][_0x3545('0x49')]){_0x3a5035['include']=[{'all':!![]}];}return db[_0x3545('0x5e')][_0x3545('0x44')](_0x3a5035);})[_0x3545('0x23')](function(_0x5b0118){_0x431548[_0x3545('0x45')]=_0x5b0118;return _0x431548;});}})[_0x3545('0x23')](respondWithFilteredResult(_0x5f1f40,_0x3a5035))[_0x3545('0x46')](handleError(_0x5f1f40,null));};exports[_0x3545('0x5f')]=function(_0x1b9928,_0x2e18e7,_0x42fb6f){var _0x5d4014={'raw':!![],'where':{}};var _0x2322dd={};var _0x291b8c={'count':0x0,'rows':[]};return db[_0x3545('0x2b')][_0x3545('0x5d')]({'where':{'id':_0x1b9928[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x2e18e7,null))[_0x3545('0x23')](function(_0x218a28){if(_0x218a28){_0x2322dd[_0x3545('0x2e')]=_[_0x3545('0x31')](db[_0x3545('0x60')][_0x3545('0x2c')]);_0x2322dd['query']=_[_0x3545('0x31')](_0x1b9928[_0x3545('0x30')]);_0x2322dd[_0x3545('0x32')]=_[_0x3545('0x33')](_0x2322dd[_0x3545('0x2e')],_0x2322dd[_0x3545('0x30')]);_0x5d4014[_0x3545('0x34')]=_[_0x3545('0x33')](_0x2322dd[_0x3545('0x2e')],qs[_0x3545('0x35')](_0x1b9928[_0x3545('0x30')][_0x3545('0x35')]));_0x5d4014['attributes']=_0x5d4014['attributes'][_0x3545('0x36')]?_0x5d4014[_0x3545('0x34')]:_0x2322dd[_0x3545('0x2e')];if(!_0x1b9928['query'][_0x3545('0x37')]('nolimit')){_0x5d4014[_0x3545('0x1d')]=qs[_0x3545('0x1d')](_0x1b9928[_0x3545('0x30')][_0x3545('0x1d')]);_0x5d4014[_0x3545('0x39')]=qs['offset'](_0x1b9928[_0x3545('0x30')][_0x3545('0x39')]);}_0x5d4014[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x1b9928[_0x3545('0x30')][_0x3545('0x3b')]);_0x5d4014[_0x3545('0x3c')]=qs[_0x3545('0x32')](_[_0x3545('0x3d')](_0x1b9928['query'],_0x2322dd[_0x3545('0x32')]));_0x5d4014['where'][_0x3545('0x5b')]=_0x218a28['id'];if(_0x1b9928[_0x3545('0x30')][_0x3545('0x3e')]){_0x5d4014[_0x3545('0x3c')]=_[_0x3545('0x3f')](_0x5d4014[_0x3545('0x3c')],{'$or':_[_0x3545('0x2a')](_0x5d4014[_0x3545('0x34')],function(_0x48aa79){var _0x219cb5={};_0x219cb5[_0x48aa79]={'$like':'%'+_0x1b9928['query'][_0x3545('0x3e')]+'%'};return _0x219cb5;})});}_0x5d4014=_['merge']({},_0x5d4014,_0x1b9928['options']);return db[_0x3545('0x60')]['count']({'where':_0x5d4014[_0x3545('0x3c')]})[_0x3545('0x23')](function(_0x18b862){_0x291b8c['count']=_0x18b862;if(_0x1b9928[_0x3545('0x30')][_0x3545('0x49')]){_0x5d4014[_0x3545('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3545('0x44')](_0x5d4014);})[_0x3545('0x23')](function(_0x1c20cd){_0x291b8c[_0x3545('0x45')]=_0x1c20cd;return _0x291b8c;});}})[_0x3545('0x23')](respondWithFilteredResult(_0x2e18e7,_0x5d4014))[_0x3545('0x46')](handleError(_0x2e18e7,null));};exports[_0x3545('0x61')]=function(_0x10e9f8,_0xc2bd4b,_0x5c949f){var _0xb8d80e={'raw':!![],'where':{}};var _0x23421c={};var _0x361769={'count':0x0,'rows':[]};return db['Campaign'][_0x3545('0x5d')]({'where':{'id':_0x10e9f8['params']['id']}})[_0x3545('0x23')](handleEntityNotFound(_0xc2bd4b,null))['then'](function(_0x120bb0){if(_0x120bb0){_0x23421c[_0x3545('0x2e')]=_['keys'](db[_0x3545('0x62')][_0x3545('0x2c')]);_0x23421c[_0x3545('0x30')]=_[_0x3545('0x31')](_0x10e9f8['query']);_0x23421c[_0x3545('0x32')]=_[_0x3545('0x33')](_0x23421c[_0x3545('0x2e')],_0x23421c[_0x3545('0x30')]);_0xb8d80e[_0x3545('0x34')]=_[_0x3545('0x33')](_0x23421c[_0x3545('0x2e')],qs[_0x3545('0x35')](_0x10e9f8[_0x3545('0x30')][_0x3545('0x35')]));_0xb8d80e[_0x3545('0x34')]=_0xb8d80e[_0x3545('0x34')][_0x3545('0x36')]?_0xb8d80e[_0x3545('0x34')]:_0x23421c[_0x3545('0x2e')];if(!_0x10e9f8['query'][_0x3545('0x37')](_0x3545('0x38'))){_0xb8d80e[_0x3545('0x1d')]=qs['limit'](_0x10e9f8['query'][_0x3545('0x1d')]);_0xb8d80e[_0x3545('0x39')]=qs[_0x3545('0x39')](_0x10e9f8['query']['offset']);}_0xb8d80e['order']=qs[_0x3545('0x3b')](_0x10e9f8[_0x3545('0x30')][_0x3545('0x3b')]);_0xb8d80e['where']=qs[_0x3545('0x32')](_[_0x3545('0x3d')](_0x10e9f8[_0x3545('0x30')],_0x23421c[_0x3545('0x32')]));_0xb8d80e['where'][_0x3545('0x5b')]=_0x120bb0['id'];if(_0x10e9f8['query']['filter']){_0xb8d80e[_0x3545('0x3c')]=_['merge'](_0xb8d80e[_0x3545('0x3c')],{'$or':_['map'](_0xb8d80e[_0x3545('0x34')],function(_0x5f3e9b){var _0x275c99={};_0x275c99[_0x5f3e9b]={'$like':'%'+_0x10e9f8[_0x3545('0x30')]['filter']+'%'};return _0x275c99;})});}_0xb8d80e=_[_0x3545('0x3f')]({},_0xb8d80e,_0x10e9f8[_0x3545('0x42')]);return db[_0x3545('0x62')]['count']({'where':_0xb8d80e[_0x3545('0x3c')]})[_0x3545('0x23')](function(_0x3a1af6){_0x361769[_0x3545('0x1c')]=_0x3a1af6;if(_0x10e9f8[_0x3545('0x30')][_0x3545('0x49')]){_0xb8d80e[_0x3545('0x43')]=[{'all':!![]}];}return db[_0x3545('0x62')]['findAll'](_0xb8d80e);})[_0x3545('0x23')](function(_0x13edbe){_0x361769['rows']=_0x13edbe;return _0x361769;});}})[_0x3545('0x23')](respondWithFilteredResult(_0xc2bd4b,_0xb8d80e))['catch'](handleError(_0xc2bd4b,null));};exports['getLists']=function(_0x2ee527,_0x46b1a6,_0x40b46c){var _0x13fe4b={};var _0x2ae752={};var _0x2f41bb;var _0x26d69f;return db[_0x3545('0x2b')][_0x3545('0x5d')]({'where':{'id':_0x2ee527[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x46b1a6,null))[_0x3545('0x23')](function(_0x381834){if(_0x381834){_0x2f41bb=_0x381834;_0x2ae752[_0x3545('0x2e')]=_['keys'](db[_0x3545('0x63')][_0x3545('0x2c')]);_0x2ae752[_0x3545('0x30')]=_[_0x3545('0x31')](_0x2ee527[_0x3545('0x30')]);_0x2ae752[_0x3545('0x32')]=_['intersection'](_0x2ae752[_0x3545('0x2e')],_0x2ae752[_0x3545('0x30')]);_0x13fe4b['attributes']=_[_0x3545('0x33')](_0x2ae752['model'],qs[_0x3545('0x35')](_0x2ee527[_0x3545('0x30')][_0x3545('0x35')]));_0x13fe4b[_0x3545('0x34')]=_0x13fe4b[_0x3545('0x34')]['length']?_0x13fe4b[_0x3545('0x34')]:_0x2ae752['model'];_0x13fe4b[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x2ee527[_0x3545('0x30')][_0x3545('0x3b')]);_0x13fe4b[_0x3545('0x3c')]=qs[_0x3545('0x32')](_[_0x3545('0x3d')](_0x2ee527[_0x3545('0x30')],_0x2ae752[_0x3545('0x32')]));if(_0x2ee527[_0x3545('0x30')][_0x3545('0x3e')]){_0x13fe4b[_0x3545('0x3c')]=_[_0x3545('0x3f')](_0x13fe4b['where'],{'$or':_[_0x3545('0x2a')](_0x13fe4b[_0x3545('0x34')],function(_0x5ca39b){var _0x5c4c97={};_0x5c4c97[_0x5ca39b]={'$like':'%'+_0x2ee527['query'][_0x3545('0x3e')]+'%'};return _0x5c4c97;})});}_0x13fe4b=_['merge']({},_0x13fe4b,_0x2ee527['options']);return _0x2f41bb[_0x3545('0x64')](_0x13fe4b);}})[_0x3545('0x23')](function(_0x39595b){if(_0x39595b){_0x26d69f=_0x39595b['length'];if(!_0x2ee527['query'][_0x3545('0x37')](_0x3545('0x38'))){_0x13fe4b[_0x3545('0x1d')]=qs[_0x3545('0x1d')](_0x2ee527[_0x3545('0x30')]['limit']);_0x13fe4b[_0x3545('0x39')]=qs[_0x3545('0x39')](_0x2ee527[_0x3545('0x30')]['offset']);}return _0x2f41bb[_0x3545('0x64')](_0x13fe4b);}})[_0x3545('0x23')](function(_0x1acb08){if(_0x1acb08){return _0x1acb08?{'count':_0x26d69f,'rows':_0x1acb08}:null;}})[_0x3545('0x23')](respondWithResult(_0x46b1a6,null))[_0x3545('0x46')](handleError(_0x46b1a6,null));};exports[_0x3545('0x65')]=function(_0x5de7be,_0x1598ee,_0x370f47){var _0x1b8e14,_0x9bc9c1;var _0x419263=[];var _0x301ecc=moment()['format'](_0x3545('0x66'));return db[_0x3545('0x2b')][_0x3545('0x4f')]({'where':{'id':_0x5de7be[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x1598ee,null))[_0x3545('0x23')](function(_0x550279){if(_0x550279){_0x9bc9c1=_0x550279;return _0x550279['addLists'](_0x5de7be[_0x3545('0x4b')][_0x3545('0x67')],_[_0x3545('0x54')](_0x5de7be[_0x3545('0x4b')],[_0x3545('0x67'),'id'])||{});}return null;})[_0x3545('0x68')](function(_0x5cb465){var _0x593b61;var _0x250d85;_0x1b8e14=_0x5cb465||[];var _0x475d4e=[];if(_0x5cb465){for(var _0x575aeb=0x0;_0x575aeb<_0x5cb465[_0x3545('0x36')];_0x575aeb+=0x1){var _0x2cc35b=_0x5cb465[_0x575aeb]['get']({'plain':!![]});_0x9bc9c1[_0x3545('0x69')]=_0x5de7be[_0x3545('0x4b')][_0x3545('0x69')]?_0x5de7be[_0x3545('0x4b')][_0x3545('0x69')]:_0x9bc9c1['dialCheckDuplicateType'];switch(_0x9bc9c1[_0x3545('0x69')]){case _0x3545('0x6a'):_0x593b61=squel['insert']()[_0x3545('0x6b')](_0x3545('0x6c'))[_0x3545('0x6d')](['phone',_0x3545('0x6e'),_0x3545('0x6f'),_0x3545('0x70'),_0x3545('0x5b'),_0x3545('0x56'),_0x3545('0x55')],squel[_0x3545('0x71')]()[_0x3545('0x72')]('phone',_0x3545('0x73'))[_0x3545('0x72')](_0x3545('0x74'),_0x3545('0x6e'))['field']('id',_0x3545('0x6f'))[_0x3545('0x72')](_0x2cc35b[_0x3545('0x75')][_0x3545('0x76')](),_0x3545('0x70'))[_0x3545('0x72')](_0x5de7be['params']['id'][_0x3545('0x76')](),_0x3545('0x5b'))[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27',_0x3545('0x56'))[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27',_0x3545('0x55'))[_0x3545('0x77')]('cm_contacts')[_0x3545('0x3c')]('deletedAt\x20IS\x20NULL')[_0x3545('0x3c')]('ListId\x20=\x20?',_0x2cc35b['CmListId'][_0x3545('0x76')]())[_0x3545('0x3c')](_0x3545('0x78'))[_0x3545('0x3c')](_0x3545('0x79'),squel[_0x3545('0x71')]()['field'](_0x3545('0x7a'))['from'](_0x3545('0x7b'))[_0x3545('0x3c')]('CampaignId\x20=\x20?',_0x5de7be[_0x3545('0x48')]['id']['toString']()))[_0x3545('0x3c')](_0x3545('0x79'),squel[_0x3545('0x71')]()[_0x3545('0x72')](_0x3545('0x7c'))[_0x3545('0x77')](_0x3545('0x6c'))[_0x3545('0x3c')](_0x3545('0x7d'),_0x5de7be['params']['id'][_0x3545('0x76')]())))[_0x3545('0x76')]();break;case _0x3545('0x7e'):_0x593b61=squel[_0x3545('0x7f')]()[_0x3545('0x6b')](_0x3545('0x6c'))['fromQuery']([_0x3545('0x73'),_0x3545('0x6e'),_0x3545('0x6f'),'ListId',_0x3545('0x5b'),_0x3545('0x56'),_0x3545('0x55')],squel[_0x3545('0x71')]()[_0x3545('0x72')](_0x3545('0x73'),'phone')['field'](_0x3545('0x74'),_0x3545('0x6e'))[_0x3545('0x72')]('id',_0x3545('0x6f'))[_0x3545('0x72')](_0x2cc35b['CmListId'][_0x3545('0x76')](),_0x3545('0x70'))['field'](_0x5de7be[_0x3545('0x48')]['id']['toString'](),_0x3545('0x5b'))[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27','createdAt')[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27',_0x3545('0x55'))[_0x3545('0x77')](_0x3545('0x80'))[_0x3545('0x3c')](_0x3545('0x81'))[_0x3545('0x3c')]('ListId\x20=\x20?',_0x2cc35b[_0x3545('0x75')][_0x3545('0x76')]())[_0x3545('0x3c')](_0x3545('0x78'))[_0x3545('0x3c')](_0x3545('0x79'),squel[_0x3545('0x71')]()[_0x3545('0x72')]('COALESCE(phone,\x27\x27)')['from'](_0x3545('0x6c'))['where']('CampaignId\x20=\x20?',_0x5de7be['params']['id']['toString']())))['toString']();break;default:_0x593b61=squel['insert']()[_0x3545('0x6b')](_0x3545('0x6c'))[_0x3545('0x6d')](['phone',_0x3545('0x6e'),_0x3545('0x6f'),_0x3545('0x70'),'CampaignId',_0x3545('0x56'),_0x3545('0x55')],squel[_0x3545('0x71')]()[_0x3545('0x72')](_0x3545('0x73'),'phone')['field'](_0x3545('0x74'),'scheduledAt')[_0x3545('0x72')]('id','ContactId')[_0x3545('0x72')](_0x2cc35b['CmListId'][_0x3545('0x76')](),'ListId')[_0x3545('0x72')](_0x5de7be[_0x3545('0x48')]['id']['toString'](),'CampaignId')[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27','createdAt')[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27',_0x3545('0x55'))[_0x3545('0x77')](_0x3545('0x80'))[_0x3545('0x3c')](_0x3545('0x81'))[_0x3545('0x3c')]('ListId\x20=\x20?',_0x2cc35b[_0x3545('0x75')]['toString']())['where'](_0x3545('0x78')))['toString']();}_0x250d85=squel['insert']()[_0x3545('0x6b')]('cm_hopper_additional_phones')[_0x3545('0x6d')]([_0x3545('0x82'),_0x3545('0x6e'),_0x3545('0x73'),_0x3545('0x83'),'createdAt',_0x3545('0x55')],squel[_0x3545('0x71')]()[_0x3545('0x72')](_0x3545('0x84'),'id')['field'](_0x3545('0x74'),_0x3545('0x6e'))[_0x3545('0x72')]('ci.item',_0x3545('0x73'))[_0x3545('0x72')]('ci.OrderBY',_0x3545('0x83'))[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27',_0x3545('0x56'))[_0x3545('0x72')]('\x27'+_0x301ecc+'\x27','updatedAt')[_0x3545('0x77')]('cm_contact_has_items','ci')[_0x3545('0x85')](_0x3545('0x6c'),'h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0x3545('0x86'),_0x2cc35b[_0x3545('0x75')]['toString']())[_0x3545('0x3c')](_0x3545('0x87'),_0x5de7be[_0x3545('0x48')]['id'][_0x3545('0x76')]())[_0x3545('0x3c')](_0x3545('0x88'),_0x301ecc))[_0x3545('0x76')]();_0x475d4e['push'](db['sequelize'][_0x3545('0x30')](_0x593b61));_0x419263[_0x3545('0x89')](db[_0x3545('0x8a')][_0x3545('0x30')](_0x250d85));}return BPromise[_0x3545('0x8b')](_0x475d4e);}})[_0x3545('0x23')](function(){return BPromise[_0x3545('0x8b')](_0x419263);})['then'](function(){return _0x1b8e14;})[_0x3545('0x23')](respondWithResult(_0x1598ee,null))[_0x3545('0x46')](handleError(_0x1598ee,null));};exports[_0x3545('0x8c')]=function(_0x2edbe3,_0x681b1b,_0x38e85b){return db['Campaign'][_0x3545('0x4f')]({'where':{'id':_0x2edbe3[_0x3545('0x48')]['id']}})['then'](handleEntityNotFound(_0x681b1b,null))[_0x3545('0x23')](function(_0x8f094c){if(_0x8f094c){return _0x8f094c[_0x3545('0x8c')](_0x2edbe3[_0x3545('0x30')][_0x3545('0x67')]);}})[_0x3545('0x23')](function(_0x14b63e){if(_0x14b63e){return db[_0x3545('0x5a')][_0x3545('0x24')]({'where':{'ListId':_0x2edbe3[_0x3545('0x30')][_0x3545('0x67')],'CampaignId':_0x2edbe3[_0x3545('0x48')]['id']}})[_0x3545('0x23')](function(){return _0x14b63e;});}})[_0x3545('0x23')](respondWithStatusCode(_0x681b1b,null))['catch'](handleError(_0x681b1b,null));};exports[_0x3545('0x8d')]=function(_0x5e8014,_0x2b18d4,_0x1d01ce){var _0x3e16ae={};var _0x4ab5dc={};var _0x3cc121;var _0x3124ff;return db[_0x3545('0x2b')][_0x3545('0x5d')]({'where':{'id':_0x5e8014[_0x3545('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b18d4,null))[_0x3545('0x23')](function(_0x265413){if(_0x265413){_0x3cc121=_0x265413;_0x4ab5dc[_0x3545('0x2e')]=_[_0x3545('0x31')](db[_0x3545('0x63')][_0x3545('0x2c')]);_0x4ab5dc[_0x3545('0x30')]=_[_0x3545('0x31')](_0x5e8014[_0x3545('0x30')]);_0x4ab5dc[_0x3545('0x32')]=_['intersection'](_0x4ab5dc[_0x3545('0x2e')],_0x4ab5dc[_0x3545('0x30')]);_0x3e16ae[_0x3545('0x34')]=_['intersection'](_0x4ab5dc[_0x3545('0x2e')],qs[_0x3545('0x35')](_0x5e8014[_0x3545('0x30')][_0x3545('0x35')]));_0x3e16ae['attributes']=_0x3e16ae[_0x3545('0x34')][_0x3545('0x36')]?_0x3e16ae[_0x3545('0x34')]:_0x4ab5dc[_0x3545('0x2e')];_0x3e16ae[_0x3545('0x3a')]=qs[_0x3545('0x3b')](_0x5e8014[_0x3545('0x30')][_0x3545('0x3b')]);_0x3e16ae[_0x3545('0x3c')]=qs[_0x3545('0x32')](_['pick'](_0x5e8014[_0x3545('0x30')],_0x4ab5dc[_0x3545('0x32')]));if(_0x5e8014[_0x3545('0x30')][_0x3545('0x3e')]){_0x3e16ae[_0x3545('0x3c')]=_[_0x3545('0x3f')](_0x3e16ae['where'],{'$or':_['map'](_0x3e16ae[_0x3545('0x34')],function(_0x152e35){var _0x13eed7={};_0x13eed7[_0x152e35]={'$like':'%'+_0x5e8014[_0x3545('0x30')][_0x3545('0x3e')]+'%'};return _0x13eed7;})});}_0x3e16ae=_['merge']({},_0x3e16ae,_0x5e8014[_0x3545('0x42')]);return _0x3cc121[_0x3545('0x8d')](_0x3e16ae);}})[_0x3545('0x23')](function(_0x43410c){if(_0x43410c){_0x3124ff=_0x43410c[_0x3545('0x36')];if(!_0x5e8014[_0x3545('0x30')]['hasOwnProperty'](_0x3545('0x38'))){_0x3e16ae['limit']=qs[_0x3545('0x1d')](_0x5e8014['query'][_0x3545('0x1d')]);_0x3e16ae[_0x3545('0x39')]=qs[_0x3545('0x39')](_0x5e8014['query'][_0x3545('0x39')]);}return _0x3cc121[_0x3545('0x8d')](_0x3e16ae);}})[_0x3545('0x23')](function(_0x408676){if(_0x408676){return _0x408676?{'count':_0x3124ff,'rows':_0x408676}:null;}})[_0x3545('0x23')](respondWithResult(_0x2b18d4,null))['catch'](handleError(_0x2b18d4,null));};exports[_0x3545('0x8e')]=function(_0x4c2ae2,_0x56dffe,_0x2c868c){var _0xf6d8d2,_0x1ce974;var _0x1b5b50=[];var _0x582d91=moment()[_0x3545('0x8f')](_0x3545('0x66'));return db['Campaign'][_0x3545('0x4f')]({'where':{'id':_0x4c2ae2[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x56dffe,null))[_0x3545('0x23')](function(_0x7d1356){if(_0x7d1356){_0x1ce974=_0x7d1356;return _0x7d1356[_0x3545('0x8e')](_0x4c2ae2[_0x3545('0x4b')][_0x3545('0x67')],_['omit'](_0x4c2ae2[_0x3545('0x4b')],[_0x3545('0x67'),'id'])||{});}return null;})['spread'](function(_0x5948f0){var _0x6c8529;var _0x2f4aff;_0xf6d8d2=_0x5948f0||[];var _0x2e95e5=[];if(_0x5948f0){for(var _0x4167e1=0x0;_0x4167e1<_0x5948f0['length'];_0x4167e1+=0x1){var _0x870ef4=_0x5948f0[_0x4167e1][_0x3545('0x25')]({'plain':!![]});_0x6c8529=squel[_0x3545('0x7f')]()['into'](_0x3545('0x90'))['fromQuery']([_0x3545('0x73'),'ContactId',_0x3545('0x70'),_0x3545('0x5b'),_0x3545('0x56'),_0x3545('0x55')],squel['select']()['field'](_0x3545('0x73'),_0x3545('0x73'))[_0x3545('0x72')]('id','ContactId')[_0x3545('0x72')](_0x870ef4[_0x3545('0x75')][_0x3545('0x76')](),'ListId')[_0x3545('0x72')](_0x4c2ae2[_0x3545('0x48')]['id']['toString'](),'CampaignId')[_0x3545('0x72')](_0x3545('0x74'),'createdAt')[_0x3545('0x72')]('NOW()',_0x3545('0x55'))[_0x3545('0x77')](_0x3545('0x80'))[_0x3545('0x3c')](_0x3545('0x81'))[_0x3545('0x3c')]('ListId\x20=\x20?',_0x870ef4[_0x3545('0x75')]['toString']())[_0x3545('0x3c')](_0x3545('0x78')))['toString']();_0x2e95e5[_0x3545('0x89')](db[_0x3545('0x8a')][_0x3545('0x30')](_0x6c8529));}return BPromise[_0x3545('0x8b')](_0x2e95e5);}})['then'](function(){return _0xf6d8d2;})['then'](respondWithResult(_0x56dffe,null))['catch'](handleError(_0x56dffe,null));};exports[_0x3545('0x91')]=function(_0x86c0c2,_0x3ef7cb,_0x263dde){return db[_0x3545('0x2b')]['find']({'where':{'id':_0x86c0c2[_0x3545('0x48')]['id']}})[_0x3545('0x23')](handleEntityNotFound(_0x3ef7cb,null))['then'](function(_0x3a3c0a){if(_0x3a3c0a){return _0x3a3c0a[_0x3545('0x91')](_0x86c0c2[_0x3545('0x30')][_0x3545('0x67')]);}})[_0x3545('0x23')](function(_0x11cb6d){if(_0x11cb6d){return db[_0x3545('0x62')][_0x3545('0x24')]({'where':{'ListId':_0x86c0c2[_0x3545('0x30')][_0x3545('0x67')],'CampaignId':_0x86c0c2[_0x3545('0x48')]['id']}})[_0x3545('0x23')](function(){return _0x11cb6d;});}})[_0x3545('0x23')](respondWithStatusCode(_0x3ef7cb,null))['catch'](handleError(_0x3ef7cb,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6c848ec..6154881 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x5bb215,_0x268c07){var _0x5c615f=function(_0x2d458c){while(--_0x2d458c){_0x5bb215['push'](_0x5bb215['shift']());}};_0x5c615f(++_0x268c07);}(_0x7a54,0x106));var _0x47a5=function(_0x186e9b,_0x4869b6){_0x186e9b=_0x186e9b-0x0;var _0x48177c=_0x7a54[_0x186e9b];return _0x48177c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 5d727c4..d5d9158 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 _0x9234=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','findAll','options','raw','where','attributes','map','include','model','lodash','moment','bluebird'];(function(_0x510bf0,_0x595be7){var _0xd9877f=function(_0x98aff){while(--_0x98aff){_0x510bf0['push'](_0x510bf0['shift']());}};_0xd9877f(++_0x595be7);}(_0x9234,0x1bd));var _0x4923=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x9234[_0x3cb30b];return _0x2ca717;};'use strict';var _=require(_0x4923('0x0'));var util=require('util');var moment=require(_0x4923('0x1'));var BPromise=require(_0x4923('0x2'));var rs=require(_0x4923('0x3'));var fs=require('fs');var Redis=require(_0x4923('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4923('0x5'));var logger=require(_0x4923('0x6'))('rpc');var config=require(_0x4923('0x7'));var jayson=require(_0x4923('0x8'));var client=jayson[_0x4923('0x9')][_0x4923('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17b854,_0x133b0d,_0x2de396){return new BPromise(function(_0x548676,_0x1fffc2){return client['request'](_0x17b854,_0x2de396)[_0x4923('0xb')](function(_0x2c4057){logger[_0x4923('0xc')]('Campaign,\x20%s,\x20%s',_0x133b0d,_0x4923('0xd'));logger[_0x4923('0xe')](_0x4923('0xf'),_0x133b0d,_0x4923('0xd'),JSON[_0x4923('0x10')](_0x2c4057));if(_0x2c4057[_0x4923('0x11')]){if(_0x2c4057[_0x4923('0x11')][_0x4923('0x12')]===0x1f4){logger[_0x4923('0x11')](_0x4923('0x13'),_0x133b0d,_0x2c4057['error']['message']);return _0x1fffc2(_0x2c4057[_0x4923('0x11')][_0x4923('0x14')]);}logger[_0x4923('0x11')]('Campaign,\x20%s,\x20%s',_0x133b0d,_0x2c4057[_0x4923('0x11')][_0x4923('0x14')]);return _0x548676(_0x2c4057[_0x4923('0x11')][_0x4923('0x14')]);}else{logger[_0x4923('0xc')](_0x4923('0x13'),_0x133b0d,_0x4923('0xd'));_0x548676(_0x2c4057[_0x4923('0x15')][_0x4923('0x14')]);}})[_0x4923('0x16')](function(_0x559e4a){logger[_0x4923('0x11')](_0x4923('0x13'),_0x133b0d,_0x559e4a);_0x1fffc2(_0x559e4a);});});}exports[_0x4923('0x17')]=function(_0x1be04d){var _0x517b95=this;return new Promise(function(_0x50fd18,_0x16955b){return db['Campaign'][_0x4923('0x18')]({'raw':_0x1be04d[_0x4923('0x19')]?_0x1be04d['options'][_0x4923('0x1a')]===undefined?!![]:![]:!![],'where':_0x1be04d[_0x4923('0x19')]?_0x1be04d[_0x4923('0x19')][_0x4923('0x1b')]||null:null,'attributes':_0x1be04d['options']?_0x1be04d[_0x4923('0x19')][_0x4923('0x1c')]||null:null,'limit':_0x1be04d['options']?_0x1be04d[_0x4923('0x19')]['limit']||null:null,'include':_0x1be04d[_0x4923('0x19')]?_0x1be04d[_0x4923('0x19')]['include']?_[_0x4923('0x1d')](_0x1be04d[_0x4923('0x19')][_0x4923('0x1e')],function(_0x161cf9){return{'model':db[_0x161cf9[_0x4923('0x1f')]],'as':_0x161cf9['as'],'attributes':_0x161cf9[_0x4923('0x1c')],'include':_0x161cf9[_0x4923('0x1e')]?_['map'](_0x161cf9['include'],function(_0x23ec97){return{'model':db[_0x23ec97[_0x4923('0x1f')]],'as':_0x23ec97['as'],'attributes':_0x23ec97[_0x4923('0x1c')],'include':_0x23ec97[_0x4923('0x1e')]?_[_0x4923('0x1d')](_0x23ec97[_0x4923('0x1e')],function(_0x13681b){return{'model':db[_0x13681b[_0x4923('0x1f')]],'as':_0x13681b['as'],'attributes':_0x13681b[_0x4923('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4923('0xb')](function(_0x3a7852){logger['info'](_0x4923('0x17'),_0x1be04d);logger[_0x4923('0xe')](_0x4923('0x17'),_0x1be04d,JSON[_0x4923('0x10')](_0x3a7852));_0x50fd18(_0x3a7852);})[_0x4923('0x16')](function(_0x47158c){logger[_0x4923('0x11')](_0x4923('0x17'),_0x47158c[_0x4923('0x14')],_0x1be04d);_0x16955b(_0x517b95[_0x4923('0x11')](0x1f4,_0x47158c[_0x4923('0x14')]));});});}; \ No newline at end of file +var _0x1782=['info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then'];(function(_0x48fda4,_0x2a3651){var _0x39bedb=function(_0x1e023b){while(--_0x1e023b){_0x48fda4['push'](_0x48fda4['shift']());}};_0x39bedb(++_0x2a3651);}(_0x1782,0x13e));var _0x2178=function(_0x5cf767,_0x3f09d1){_0x5cf767=_0x5cf767-0x0;var _0x41d91c=_0x1782[_0x5cf767];return _0x41d91c;};'use strict';var _=require(_0x2178('0x0'));var util=require('util');var moment=require(_0x2178('0x1'));var BPromise=require(_0x2178('0x2'));var rs=require(_0x2178('0x3'));var fs=require('fs');var Redis=require(_0x2178('0x4'));var db=require(_0x2178('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2178('0x6'))(_0x2178('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2178('0x8')][_0x2178('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad34,_0x53b9f9,_0x4cf22a){return new BPromise(function(_0x3b4115,_0x2b3991){return client[_0x2178('0xa')](_0x50ad34,_0x4cf22a)[_0x2178('0xb')](function(_0x1cb1e6){logger[_0x2178('0xc')]('Campaign,\x20%s,\x20%s',_0x53b9f9,_0x2178('0xd'));logger[_0x2178('0xe')](_0x2178('0xf'),_0x53b9f9,_0x2178('0xd'),JSON[_0x2178('0x10')](_0x1cb1e6));if(_0x1cb1e6[_0x2178('0x11')]){if(_0x1cb1e6[_0x2178('0x11')][_0x2178('0x12')]===0x1f4){logger[_0x2178('0x11')](_0x2178('0x13'),_0x53b9f9,_0x1cb1e6['error'][_0x2178('0x14')]);return _0x2b3991(_0x1cb1e6[_0x2178('0x11')]['message']);}logger[_0x2178('0x11')](_0x2178('0x13'),_0x53b9f9,_0x1cb1e6[_0x2178('0x11')][_0x2178('0x14')]);return _0x3b4115(_0x1cb1e6[_0x2178('0x11')]['message']);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x53b9f9,_0x2178('0xd'));_0x3b4115(_0x1cb1e6['result'][_0x2178('0x14')]);}})[_0x2178('0x15')](function(_0x5edc68){logger['error'](_0x2178('0x13'),_0x53b9f9,_0x5edc68);_0x2b3991(_0x5edc68);});});}exports[_0x2178('0x16')]=function(_0x561990){var _0x3d7e36=this;return new Promise(function(_0x39dd60,_0x1cece2){return db[_0x2178('0x17')][_0x2178('0x18')]({'raw':_0x561990[_0x2178('0x19')]?_0x561990[_0x2178('0x19')][_0x2178('0x1a')]===undefined?!![]:![]:!![],'where':_0x561990[_0x2178('0x19')]?_0x561990[_0x2178('0x19')][_0x2178('0x1b')]||null:null,'attributes':_0x561990[_0x2178('0x19')]?_0x561990['options'][_0x2178('0x1c')]||null:null,'limit':_0x561990[_0x2178('0x19')]?_0x561990[_0x2178('0x19')][_0x2178('0x1d')]||null:null,'include':_0x561990[_0x2178('0x19')]?_0x561990[_0x2178('0x19')][_0x2178('0x1e')]?_[_0x2178('0x1f')](_0x561990[_0x2178('0x19')][_0x2178('0x1e')],function(_0x3c03f7){return{'model':db[_0x3c03f7[_0x2178('0x20')]],'as':_0x3c03f7['as'],'attributes':_0x3c03f7[_0x2178('0x1c')],'include':_0x3c03f7[_0x2178('0x1e')]?_[_0x2178('0x1f')](_0x3c03f7[_0x2178('0x1e')],function(_0x393f67){return{'model':db[_0x393f67[_0x2178('0x20')]],'as':_0x393f67['as'],'attributes':_0x393f67[_0x2178('0x1c')],'include':_0x393f67[_0x2178('0x1e')]?_[_0x2178('0x1f')](_0x393f67[_0x2178('0x1e')],function(_0x330618){return{'model':db[_0x330618['model']],'as':_0x330618['as'],'attributes':_0x330618[_0x2178('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2178('0xb')](function(_0x50804b){logger['info'](_0x2178('0x16'),_0x561990);logger['debug'](_0x2178('0x16'),_0x561990,JSON[_0x2178('0x10')](_0x50804b));_0x39dd60(_0x50804b);})[_0x2178('0x15')](function(_0x47a28f){logger['error'](_0x2178('0x16'),_0x47a28f[_0x2178('0x14')],_0x561990);_0x1cece2(_0x3d7e36[_0x2178('0x11')](0x1f4,_0x47a28f['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7001a87..4f9f55a 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 _0xc5b1=['update','destroy','removeLists','delete','removeBlackLists','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists'];(function(_0x1376c2,_0x2a07ef){var _0x39232a=function(_0x43d810){while(--_0x43d810){_0x1376c2['push'](_0x1376c2['shift']());}};_0x39232a(++_0x2a07ef);}(_0xc5b1,0x106));var _0x1c5b=function(_0x5740bb,_0x215865){_0x5740bb=_0x5740bb-0x0;var _0x60a2d2=_0xc5b1[_0x5740bb];return _0x60a2d2;};'use strict';var multer=require(_0x1c5b('0x0'));var util=require(_0x1c5b('0x1'));var path=require(_0x1c5b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1c5b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1c5b('0x4'));var config=require(_0x1c5b('0x5'));var controller=require('./campaign.controller');router[_0x1c5b('0x6')]('/',auth['isAuthenticated'](),controller[_0x1c5b('0x7')]);router[_0x1c5b('0x6')](_0x1c5b('0x8'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0xa')]);router['get'](_0x1c5b('0xb'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0xc')]);router[_0x1c5b('0x6')](_0x1c5b('0xd'),auth['isAuthenticated'](),controller[_0x1c5b('0xe')]);router[_0x1c5b('0x6')](_0x1c5b('0xf'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x10')]);router['get']('/:id/hopper_black',auth[_0x1c5b('0x9')](),controller['getHopperBlacks']);router['get'](_0x1c5b('0x11'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x12')]);router[_0x1c5b('0x6')](_0x1c5b('0x13'),auth[_0x1c5b('0x9')](),controller['getBlackLists']);router[_0x1c5b('0x14')]('/',auth['isAuthenticated'](),controller[_0x1c5b('0x15')]);router[_0x1c5b('0x14')](_0x1c5b('0x16'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x17')]);router[_0x1c5b('0x14')](_0x1c5b('0x11'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x18')]);router[_0x1c5b('0x14')](_0x1c5b('0x13'),auth['isAuthenticated'](),controller[_0x1c5b('0x19')]);router['put']('/:id',auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x1a')]);router['delete']('/:id',auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x1b')]);router['delete'](_0x1c5b('0x11'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x1c')]);router[_0x1c5b('0x1d')](_0x1c5b('0x13'),auth[_0x1c5b('0x9')](),controller[_0x1c5b('0x1e')]);module[_0x1c5b('0x1f')]=router; \ No newline at end of file +var _0xeb53=['get','index','/:id','isAuthenticated','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','update','delete','/:id/lists','removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./campaign.controller'];(function(_0xe51920,_0x4a1092){var _0x4e4c70=function(_0x71151){while(--_0x71151){_0xe51920['push'](_0xe51920['shift']());}};_0x4e4c70(++_0x4a1092);}(_0xeb53,0xca));var _0x3eb5=function(_0x357bb5,_0x28b8d3){_0x357bb5=_0x357bb5-0x0;var _0xf08844=_0xeb53[_0x357bb5];return _0xf08844;};'use strict';var multer=require(_0x3eb5('0x0'));var util=require(_0x3eb5('0x1'));var path=require(_0x3eb5('0x2'));var timeout=require(_0x3eb5('0x3'));var express=require(_0x3eb5('0x4'));var router=express['Router']();var fs_extra=require(_0x3eb5('0x5'));var auth=require(_0x3eb5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3eb5('0x7'));router[_0x3eb5('0x8')]('/',auth['isAuthenticated'](),controller[_0x3eb5('0x9')]);router[_0x3eb5('0x8')](_0x3eb5('0xa'),auth[_0x3eb5('0xb')](),controller[_0x3eb5('0xc')]);router[_0x3eb5('0x8')](_0x3eb5('0xd'),auth['isAuthenticated'](),controller['getHoppers']);router[_0x3eb5('0x8')]('/:id/hopper_histories',auth[_0x3eb5('0xb')](),controller[_0x3eb5('0xe')]);router[_0x3eb5('0x8')](_0x3eb5('0xf'),auth[_0x3eb5('0xb')](),controller['getHopperFinals']);router['get'](_0x3eb5('0x10'),auth[_0x3eb5('0xb')](),controller['getHopperBlacks']);router['get']('/:id/lists',auth[_0x3eb5('0xb')](),controller[_0x3eb5('0x11')]);router[_0x3eb5('0x8')](_0x3eb5('0x12'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x3eb5('0x13')]('/',auth['isAuthenticated'](),controller[_0x3eb5('0x14')]);router[_0x3eb5('0x13')](_0x3eb5('0x15'),auth['isAuthenticated'](),controller[_0x3eb5('0x16')]);router[_0x3eb5('0x13')]('/:id/lists',auth['isAuthenticated'](),controller[_0x3eb5('0x17')]);router[_0x3eb5('0x13')](_0x3eb5('0x12'),auth[_0x3eb5('0xb')](),controller[_0x3eb5('0x18')]);router['put'](_0x3eb5('0xa'),auth[_0x3eb5('0xb')](),controller[_0x3eb5('0x19')]);router[_0x3eb5('0x1a')](_0x3eb5('0xa'),auth[_0x3eb5('0xb')](),controller['destroy']);router[_0x3eb5('0x1a')](_0x3eb5('0x1b'),auth[_0x3eb5('0xb')](),controller['removeLists']);router[_0x3eb5('0x1a')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x3eb5('0x1c')]);module[_0x3eb5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index ef98ba9..3fa1481 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 _0x2ca6=['getDataValue','sequelize','exports','STRING','TEXT','medium','VIRTUAL'];(function(_0x390791,_0x56a05f){var _0x543bc6=function(_0x5a5e8f){while(--_0x5a5e8f){_0x390791['push'](_0x390791['shift']());}};_0x543bc6(++_0x56a05f);}(_0x2ca6,0xb0));var _0x62ca=function(_0x2489d5,_0x118404){_0x2489d5=_0x2489d5-0x0;var _0x453f4e=_0x2ca6[_0x2489d5];return _0x453f4e;};'use strict';var Sequelize=require(_0x62ca('0x0'));module[_0x62ca('0x1')]={'key':{'type':Sequelize[_0x62ca('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x62ca('0x3')],'length':_0x62ca('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x62ca('0x5')],'get':function(){return this[_0x62ca('0x6')]('key');}}}; \ No newline at end of file +var _0xa362=['STRING','TEXT','medium','VIRTUAL','key','sequelize','exports'];(function(_0x503950,_0x5022eb){var _0x1657a9=function(_0x4c1e8f){while(--_0x4c1e8f){_0x503950['push'](_0x503950['shift']());}};_0x1657a9(++_0x5022eb);}(_0xa362,0xe5));var _0x2a36=function(_0xe2ec77,_0x242e37){_0xe2ec77=_0xe2ec77-0x0;var _0x40d177=_0xa362[_0xe2ec77];return _0x40d177;};'use strict';var Sequelize=require(_0x2a36('0x0'));module[_0x2a36('0x1')]={'key':{'type':Sequelize[_0x2a36('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x2a36('0x3')],'length':_0x2a36('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x2a36('0x2')]},'name':{'type':Sequelize[_0x2a36('0x5')],'get':function(){return this['getDataValue'](_0x2a36('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 455191a..62d022c 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 _0xffdc=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','CannedAnswers','UserProfileResource','end','error','stack','name','send','index','CannedAnswer','rawAttributes','type'];(function(_0xd80a30,_0x15e548){var _0x1b0c5e=function(_0x4893d6){while(--_0x4893d6){_0xd80a30['push'](_0xd80a30['shift']());}};_0x1b0c5e(++_0x15e548);}(_0xffdc,0x182));var _0xcffd=function(_0x53a8bf,_0x59b79f){_0x53a8bf=_0x53a8bf-0x0;var _0x1cee30=_0xffdc[_0x53a8bf];return _0x1cee30;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcffd('0x0'));var jsonpatch=require(_0xcffd('0x1'));var rp=require(_0xcffd('0x2'));var moment=require('moment');var BPromise=require(_0xcffd('0x3'));var Mustache=require(_0xcffd('0x4'));var util=require(_0xcffd('0x5'));var path=require('path');var sox=require(_0xcffd('0x6'));var csv=require(_0xcffd('0x7'));var ejs=require(_0xcffd('0x8'));var fs=require('fs');var fs_extra=require(_0xcffd('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcffd('0xa'));var jsforce=require(_0xcffd('0xb'));var deskjs=require(_0xcffd('0xc'));var toCsv=require(_0xcffd('0x7'));var querystring=require(_0xcffd('0xd'));var Papa=require(_0xcffd('0xe'));var Redis=require(_0xcffd('0xf'));var authService=require(_0xcffd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcffd('0x11'));var hardwareService=require(_0xcffd('0x12'));var logger=require(_0xcffd('0x13'))(_0xcffd('0x14'));var utils=require(_0xcffd('0x15'));var config=require(_0xcffd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcffd('0x17'))['db'];function respondWithStatusCode(_0x84983f,_0x47879e){_0x47879e=_0x47879e||0xcc;return function(_0x2d87cc){if(_0x2d87cc){return _0x84983f[_0xcffd('0x18')](_0x47879e);}return _0x84983f[_0xcffd('0x19')](_0x47879e)['end']();};}function respondWithResult(_0x559b03,_0x70832c){_0x70832c=_0x70832c||0xc8;return function(_0xc38187){if(_0xc38187){return _0x559b03['status'](_0x70832c)[_0xcffd('0x1a')](_0xc38187);}};}function respondWithFilteredResult(_0x445a73,_0x23babd){return function(_0x57cc4f){if(_0x57cc4f){var _0x1d554a=typeof _0x23babd['offset']==='undefined'&&typeof _0x23babd[_0xcffd('0x1b')]===_0xcffd('0x1c');var _0x5b2721=_0x57cc4f[_0xcffd('0x1d')];var _0x2e2fdc=_0x1d554a?0x0:_0x23babd['offset'];var _0x3f143c=_0x1d554a?_0x57cc4f[_0xcffd('0x1d')]:_0x23babd[_0xcffd('0x1e')]+_0x23babd[_0xcffd('0x1b')];var _0x4ef531;if(_0x3f143c>=_0x5b2721){_0x3f143c=_0x5b2721;_0x4ef531=0xc8;}else{_0x4ef531=0xce;}_0x445a73[_0xcffd('0x19')](_0x4ef531);return _0x445a73[_0xcffd('0x1f')](_0xcffd('0x20'),_0x2e2fdc+'-'+_0x3f143c+'/'+_0x5b2721)[_0xcffd('0x1a')](_0x57cc4f);}return null;};}function patchUpdates(_0x20adad){return function(_0x177fe7){try{jsonpatch[_0xcffd('0x21')](_0x177fe7,_0x20adad,!![]);}catch(_0x1e60ea){return BPromise['reject'](_0x1e60ea);}return _0x177fe7[_0xcffd('0x22')]();};}function saveUpdates(_0x40f4e1,_0x8e199b){return function(_0x5895c9){if(_0x5895c9){return _0x5895c9[_0xcffd('0x23')](_0x40f4e1)[_0xcffd('0x24')](function(_0x473c82){return _0x473c82;});}return null;};}function removeEntity(_0x1c91a5,_0x39d8bd){return function(_0x5a8677){if(_0x5a8677){return _0x5a8677[_0xcffd('0x25')]()[_0xcffd('0x24')](function(){var _0x1ae068=_0x5a8677['get']({'plain':!![]});var _0x2aa886=_0xcffd('0x26');return db[_0xcffd('0x27')]['destroy']({'where':{'type':_0x2aa886,'resourceId':_0x1ae068['id']}})['then'](function(){return _0x5a8677;});})['then'](function(){_0x1c91a5['status'](0xcc)[_0xcffd('0x28')]();});}};}function handleEntityNotFound(_0x5b0787,_0x2ac475){return function(_0x30415f){if(!_0x30415f){_0x5b0787[_0xcffd('0x18')](0x194);}return _0x30415f;};}function handleError(_0x39dc42,_0x1684bc){_0x1684bc=_0x1684bc||0x1f4;return function(_0x30a96c){logger[_0xcffd('0x29')](_0x30a96c[_0xcffd('0x2a')]);if(_0x30a96c[_0xcffd('0x2b')]){delete _0x30a96c[_0xcffd('0x2b')];}_0x39dc42[_0xcffd('0x19')](_0x1684bc)[_0xcffd('0x2c')](_0x30a96c);};}exports[_0xcffd('0x2d')]=function(_0x3bded6,_0x4ef4a8){var _0x37e40e={},_0x4f4b35={},_0xe76191={'count':0x0,'rows':[]};var _0x103ff4=_['map'](db[_0xcffd('0x2e')][_0xcffd('0x2f')],function(_0x14c216){return{'name':_0x14c216['fieldName'],'type':_0x14c216[_0xcffd('0x30')][_0xcffd('0x31')]};});_0x4f4b35[_0xcffd('0x32')]=_['map'](_0x103ff4,_0xcffd('0x2b'));_0x4f4b35[_0xcffd('0x33')]=_[_0xcffd('0x34')](_0x3bded6[_0xcffd('0x33')]);_0x4f4b35[_0xcffd('0x35')]=_[_0xcffd('0x36')](_0x4f4b35[_0xcffd('0x32')],_0x4f4b35[_0xcffd('0x33')]);_0x37e40e[_0xcffd('0x37')]=_[_0xcffd('0x36')](_0x4f4b35['model'],qs[_0xcffd('0x38')](_0x3bded6[_0xcffd('0x33')][_0xcffd('0x38')]));_0x37e40e[_0xcffd('0x37')]=_0x37e40e['attributes'][_0xcffd('0x39')]?_0x37e40e['attributes']:_0x4f4b35[_0xcffd('0x32')];if(!_0x3bded6[_0xcffd('0x33')][_0xcffd('0x3a')]('nolimit')){_0x37e40e['limit']=qs[_0xcffd('0x1b')](_0x3bded6[_0xcffd('0x33')][_0xcffd('0x1b')]);_0x37e40e[_0xcffd('0x1e')]=qs[_0xcffd('0x1e')](_0x3bded6[_0xcffd('0x33')][_0xcffd('0x1e')]);}_0x37e40e['order']=qs[_0xcffd('0x3b')](_0x3bded6['query'][_0xcffd('0x3b')]);_0x37e40e[_0xcffd('0x3c')]=qs[_0xcffd('0x35')](_[_0xcffd('0x3d')](_0x3bded6[_0xcffd('0x33')],_0x4f4b35['filters']),_0x103ff4);if(_0x3bded6[_0xcffd('0x33')][_0xcffd('0x3e')]){_0x37e40e[_0xcffd('0x3c')]=_[_0xcffd('0x3f')](_0x37e40e[_0xcffd('0x3c')],{'$or':[{'key':{'$like':'%'+_0x3bded6[_0xcffd('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x3bded6[_0xcffd('0x33')][_0xcffd('0x3e')]+'%'}}]});}_0x37e40e=_[_0xcffd('0x3f')]({},_0x37e40e,_0x3bded6[_0xcffd('0x40')]);var _0x3545a2={'where':_0x37e40e['where']};return db[_0xcffd('0x2e')][_0xcffd('0x1d')](_0x3545a2)[_0xcffd('0x24')](function(_0xb8a04f){_0xe76191[_0xcffd('0x1d')]=_0xb8a04f;if(_0x3bded6[_0xcffd('0x33')][_0xcffd('0x41')]){_0x37e40e[_0xcffd('0x42')]=[{'all':!![]}];}return db[_0xcffd('0x2e')][_0xcffd('0x43')](_0x37e40e);})[_0xcffd('0x24')](function(_0x5333b2){_0xe76191[_0xcffd('0x44')]=_0x5333b2;return _0xe76191;})[_0xcffd('0x24')](respondWithFilteredResult(_0x4ef4a8,_0x37e40e))[_0xcffd('0x45')](handleError(_0x4ef4a8,null));};exports['show']=function(_0x5371e1,_0x4e5135){var _0x1eeb18={'raw':!![],'where':{'id':_0x5371e1['params']['id']}},_0x43b7bd={};_0x43b7bd['model']=_[_0xcffd('0x34')](db['CannedAnswer'][_0xcffd('0x2f')]);_0x43b7bd[_0xcffd('0x33')]=_['keys'](_0x5371e1[_0xcffd('0x33')]);_0x43b7bd['filters']=_['intersection'](_0x43b7bd[_0xcffd('0x32')],_0x43b7bd['query']);_0x1eeb18[_0xcffd('0x37')]=_[_0xcffd('0x36')](_0x43b7bd[_0xcffd('0x32')],qs['fields'](_0x5371e1[_0xcffd('0x33')]['fields']));_0x1eeb18[_0xcffd('0x37')]=_0x1eeb18[_0xcffd('0x37')][_0xcffd('0x39')]?_0x1eeb18[_0xcffd('0x37')]:_0x43b7bd[_0xcffd('0x32')];if(_0x5371e1['query'][_0xcffd('0x41')]){_0x1eeb18[_0xcffd('0x42')]=[{'all':!![]}];}_0x1eeb18=_['merge']({},_0x1eeb18,_0x5371e1[_0xcffd('0x40')]);return db['CannedAnswer'][_0xcffd('0x46')](_0x1eeb18)[_0xcffd('0x24')](handleEntityNotFound(_0x4e5135,null))['then'](respondWithResult(_0x4e5135,null))[_0xcffd('0x45')](handleError(_0x4e5135,null));};exports[_0xcffd('0x23')]=function(_0x8c83d5,_0x201e79){if(_0x8c83d5[_0xcffd('0x47')]['id']){delete _0x8c83d5[_0xcffd('0x47')]['id'];}return db[_0xcffd('0x2e')][_0xcffd('0x46')]({'where':{'id':_0x8c83d5[_0xcffd('0x48')]['id']}})[_0xcffd('0x24')](handleEntityNotFound(_0x201e79,null))[_0xcffd('0x24')](saveUpdates(_0x8c83d5[_0xcffd('0x47')],null))[_0xcffd('0x24')](respondWithResult(_0x201e79,null))[_0xcffd('0x45')](handleError(_0x201e79,null));};exports[_0xcffd('0x25')]=function(_0x11118f,_0x1fe955){return db[_0xcffd('0x2e')][_0xcffd('0x46')]({'where':{'id':_0x11118f[_0xcffd('0x48')]['id']}})['then'](handleEntityNotFound(_0x1fe955,null))[_0xcffd('0x24')](removeEntity(_0x1fe955,null))['catch'](handleError(_0x1fe955,null));};exports[_0xcffd('0x49')]=function(_0x570880,_0x147ae0){var _0x303749={'key':_0x570880['body']['key']};if(_0x570880['body'][_0xcffd('0x4a')]){_0x303749['MailAccountId']=_0x570880[_0xcffd('0x47')][_0xcffd('0x4a')];}else if(_0x570880[_0xcffd('0x47')][_0xcffd('0x4b')]){_0x303749[_0xcffd('0x4b')]=_0x570880[_0xcffd('0x47')][_0xcffd('0x4b')];}else if(_0x570880[_0xcffd('0x47')][_0xcffd('0x4c')]){_0x303749[_0xcffd('0x4c')]=_0x570880['body'][_0xcffd('0x4c')];}else if(_0x570880[_0xcffd('0x47')][_0xcffd('0x4d')]){_0x303749[_0xcffd('0x4d')]=_0x570880[_0xcffd('0x47')]['ChatWebsiteId'];}return db[_0xcffd('0x2e')][_0xcffd('0x46')]({'where':_0x303749})[_0xcffd('0x24')](function(_0x566912){if(_0x566912){throw new db[(_0xcffd('0x4e'))][(_0xcffd('0x4f'))](_0xcffd('0x50'));}return db[_0xcffd('0x2e')][_0xcffd('0x49')](_0x570880[_0xcffd('0x47')]);})[_0xcffd('0x24')](function(_0x25208b){var _0x29126a=_0x570880[_0xcffd('0x51')][_0xcffd('0x52')]({'plain':!![]});if(!_0x29126a)throw new Error(_0xcffd('0x53'));if(_0x29126a['role']==='user'){var _0x365b60=_0x25208b[_0xcffd('0x52')]({'plain':!![]});return db[_0xcffd('0x54')][_0xcffd('0x46')]({'where':{'name':_0xcffd('0x26'),'userProfileId':_0x29126a['userProfileId']},'raw':!![]})['then'](function(_0x30f363){if(_0x30f363&&_0x30f363[_0xcffd('0x55')]===0x0){return db[_0xcffd('0x27')][_0xcffd('0x49')]({'name':_0x365b60[_0xcffd('0x2b')],'resourceId':_0x365b60['id'],'type':_0x30f363[_0xcffd('0x2b')],'sectionId':_0x30f363['id']},{})[_0xcffd('0x24')](function(){return _0x25208b;});}else{return _0x25208b;}})[_0xcffd('0x45')](function(_0xb8968d){logger[_0xcffd('0x29')](_0xcffd('0x56'),_0xb8968d);throw _0xb8968d;});}return _0x25208b;})[_0xcffd('0x24')](respondWithResult(_0x147ae0,0xc9))[_0xcffd('0x45')](handleError(_0x147ae0,null));}; \ No newline at end of file +var _0x4e33=['keys','rawAttributes','include','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','send','index','map','CannedAnswer','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','params'];(function(_0x5934f3,_0x55f354){var _0x44e3f4=function(_0x481815){while(--_0x481815){_0x5934f3['push'](_0x5934f3['shift']());}};_0x44e3f4(++_0x55f354);}(_0x4e33,0x1b5));var _0x34e3=function(_0x153e7d,_0x10a35f){_0x153e7d=_0x153e7d-0x0;var _0x3c22dd=_0x4e33[_0x153e7d];return _0x3c22dd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x34e3('0x0'));var rp=require(_0x34e3('0x1'));var moment=require(_0x34e3('0x2'));var BPromise=require(_0x34e3('0x3'));var Mustache=require(_0x34e3('0x4'));var util=require('util');var path=require(_0x34e3('0x5'));var sox=require('sox');var csv=require(_0x34e3('0x6'));var ejs=require(_0x34e3('0x7'));var fs=require('fs');var fs_extra=require(_0x34e3('0x8'));var _=require(_0x34e3('0x9'));var squel=require(_0x34e3('0xa'));var crypto=require('crypto');var jsforce=require(_0x34e3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x34e3('0x6'));var querystring=require(_0x34e3('0xc'));var Papa=require(_0x34e3('0xd'));var Redis=require('ioredis');var authService=require(_0x34e3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x34e3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x34e3('0x10'))(_0x34e3('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x34e3('0x12'))['db'];function respondWithStatusCode(_0xe3751b,_0x320104){_0x320104=_0x320104||0xcc;return function(_0x1f4e6f){if(_0x1f4e6f){return _0xe3751b[_0x34e3('0x13')](_0x320104);}return _0xe3751b[_0x34e3('0x14')](_0x320104)[_0x34e3('0x15')]();};}function respondWithResult(_0x538f7f,_0x51267a){_0x51267a=_0x51267a||0xc8;return function(_0x533115){if(_0x533115){return _0x538f7f[_0x34e3('0x14')](_0x51267a)[_0x34e3('0x16')](_0x533115);}};}function respondWithFilteredResult(_0x44da4f,_0x4b072e){return function(_0x42a5b9){if(_0x42a5b9){var _0x393c48=typeof _0x4b072e[_0x34e3('0x17')]===_0x34e3('0x18')&&typeof _0x4b072e[_0x34e3('0x19')]===_0x34e3('0x18');var _0x4f81b7=_0x42a5b9[_0x34e3('0x1a')];var _0x258106=_0x393c48?0x0:_0x4b072e[_0x34e3('0x17')];var _0x1be3f7=_0x393c48?_0x42a5b9[_0x34e3('0x1a')]:_0x4b072e[_0x34e3('0x17')]+_0x4b072e['limit'];var _0x4a90e7;if(_0x1be3f7>=_0x4f81b7){_0x1be3f7=_0x4f81b7;_0x4a90e7=0xc8;}else{_0x4a90e7=0xce;}_0x44da4f[_0x34e3('0x14')](_0x4a90e7);return _0x44da4f[_0x34e3('0x1b')](_0x34e3('0x1c'),_0x258106+'-'+_0x1be3f7+'/'+_0x4f81b7)[_0x34e3('0x16')](_0x42a5b9);}return null;};}function patchUpdates(_0x4370ba){return function(_0x43cf7a){try{jsonpatch[_0x34e3('0x1d')](_0x43cf7a,_0x4370ba,!![]);}catch(_0x460ab1){return BPromise[_0x34e3('0x1e')](_0x460ab1);}return _0x43cf7a[_0x34e3('0x1f')]();};}function saveUpdates(_0x5f3597,_0x3dea01){return function(_0x47c1a4){if(_0x47c1a4){return _0x47c1a4[_0x34e3('0x20')](_0x5f3597)[_0x34e3('0x21')](function(_0x4154c1){return _0x4154c1;});}return null;};}function removeEntity(_0x42fc9f,_0x48dbdd){return function(_0x11bf91){if(_0x11bf91){return _0x11bf91[_0x34e3('0x22')]()['then'](function(){var _0x17f687=_0x11bf91[_0x34e3('0x23')]({'plain':!![]});var _0x28fc37=_0x34e3('0x24');return db[_0x34e3('0x25')][_0x34e3('0x22')]({'where':{'type':_0x28fc37,'resourceId':_0x17f687['id']}})[_0x34e3('0x21')](function(){return _0x11bf91;});})[_0x34e3('0x21')](function(){_0x42fc9f[_0x34e3('0x14')](0xcc)[_0x34e3('0x15')]();});}};}function handleEntityNotFound(_0xdd062c,_0x777774){return function(_0x399137){if(!_0x399137){_0xdd062c[_0x34e3('0x13')](0x194);}return _0x399137;};}function handleError(_0x1a6180,_0xdc3433){_0xdc3433=_0xdc3433||0x1f4;return function(_0x294e29){logger[_0x34e3('0x26')](_0x294e29['stack']);if(_0x294e29['name']){delete _0x294e29[_0x34e3('0x27')];}_0x1a6180[_0x34e3('0x14')](_0xdc3433)[_0x34e3('0x28')](_0x294e29);};}exports[_0x34e3('0x29')]=function(_0x786732,_0x89ea7c){var _0x3f534b={},_0x109189={},_0x420c44={'count':0x0,'rows':[]};var _0x569ce2=_[_0x34e3('0x2a')](db[_0x34e3('0x2b')]['rawAttributes'],function(_0x4c9821){return{'name':_0x4c9821[_0x34e3('0x2c')],'type':_0x4c9821[_0x34e3('0x2d')][_0x34e3('0x2e')]};});_0x109189['model']=_[_0x34e3('0x2a')](_0x569ce2,'name');_0x109189[_0x34e3('0x2f')]=_['keys'](_0x786732['query']);_0x109189[_0x34e3('0x30')]=_[_0x34e3('0x31')](_0x109189[_0x34e3('0x32')],_0x109189[_0x34e3('0x2f')]);_0x3f534b[_0x34e3('0x33')]=_[_0x34e3('0x31')](_0x109189[_0x34e3('0x32')],qs['fields'](_0x786732[_0x34e3('0x2f')][_0x34e3('0x34')]));_0x3f534b[_0x34e3('0x33')]=_0x3f534b['attributes'][_0x34e3('0x35')]?_0x3f534b['attributes']:_0x109189[_0x34e3('0x32')];if(!_0x786732[_0x34e3('0x2f')][_0x34e3('0x36')]('nolimit')){_0x3f534b[_0x34e3('0x19')]=qs[_0x34e3('0x19')](_0x786732[_0x34e3('0x2f')][_0x34e3('0x19')]);_0x3f534b[_0x34e3('0x17')]=qs[_0x34e3('0x17')](_0x786732[_0x34e3('0x2f')]['offset']);}_0x3f534b[_0x34e3('0x37')]=qs[_0x34e3('0x38')](_0x786732['query'][_0x34e3('0x38')]);_0x3f534b['where']=qs[_0x34e3('0x30')](_[_0x34e3('0x39')](_0x786732[_0x34e3('0x2f')],_0x109189[_0x34e3('0x30')]),_0x569ce2);if(_0x786732['query'][_0x34e3('0x3a')]){_0x3f534b[_0x34e3('0x3b')]=_[_0x34e3('0x3c')](_0x3f534b['where'],{'$or':[{'key':{'$like':'%'+_0x786732['query'][_0x34e3('0x3a')]+'%'}},{'value':{'$like':'%'+_0x786732[_0x34e3('0x2f')][_0x34e3('0x3a')]+'%'}}]});}_0x3f534b=_['merge']({},_0x3f534b,_0x786732[_0x34e3('0x3d')]);var _0x53f4fc={'where':_0x3f534b[_0x34e3('0x3b')]};return db[_0x34e3('0x2b')][_0x34e3('0x1a')](_0x53f4fc)[_0x34e3('0x21')](function(_0x417038){_0x420c44[_0x34e3('0x1a')]=_0x417038;if(_0x786732[_0x34e3('0x2f')][_0x34e3('0x3e')]){_0x3f534b['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x34e3('0x3f')](_0x3f534b);})[_0x34e3('0x21')](function(_0x2b2af2){_0x420c44[_0x34e3('0x40')]=_0x2b2af2;return _0x420c44;})[_0x34e3('0x21')](respondWithFilteredResult(_0x89ea7c,_0x3f534b))[_0x34e3('0x41')](handleError(_0x89ea7c,null));};exports['show']=function(_0x218d2b,_0x36472e){var _0x2732b3={'raw':!![],'where':{'id':_0x218d2b[_0x34e3('0x42')]['id']}},_0x596305={};_0x596305[_0x34e3('0x32')]=_[_0x34e3('0x43')](db[_0x34e3('0x2b')][_0x34e3('0x44')]);_0x596305[_0x34e3('0x2f')]=_[_0x34e3('0x43')](_0x218d2b['query']);_0x596305[_0x34e3('0x30')]=_[_0x34e3('0x31')](_0x596305['model'],_0x596305[_0x34e3('0x2f')]);_0x2732b3['attributes']=_[_0x34e3('0x31')](_0x596305['model'],qs['fields'](_0x218d2b[_0x34e3('0x2f')][_0x34e3('0x34')]));_0x2732b3[_0x34e3('0x33')]=_0x2732b3[_0x34e3('0x33')][_0x34e3('0x35')]?_0x2732b3[_0x34e3('0x33')]:_0x596305[_0x34e3('0x32')];if(_0x218d2b[_0x34e3('0x2f')][_0x34e3('0x3e')]){_0x2732b3[_0x34e3('0x45')]=[{'all':!![]}];}_0x2732b3=_[_0x34e3('0x3c')]({},_0x2732b3,_0x218d2b['options']);return db[_0x34e3('0x2b')][_0x34e3('0x46')](_0x2732b3)[_0x34e3('0x21')](handleEntityNotFound(_0x36472e,null))[_0x34e3('0x21')](respondWithResult(_0x36472e,null))[_0x34e3('0x41')](handleError(_0x36472e,null));};exports[_0x34e3('0x20')]=function(_0x308565,_0x4807f9){if(_0x308565[_0x34e3('0x47')]['id']){delete _0x308565[_0x34e3('0x47')]['id'];}return db[_0x34e3('0x2b')][_0x34e3('0x46')]({'where':{'id':_0x308565[_0x34e3('0x42')]['id']}})[_0x34e3('0x21')](handleEntityNotFound(_0x4807f9,null))[_0x34e3('0x21')](saveUpdates(_0x308565[_0x34e3('0x47')],null))['then'](respondWithResult(_0x4807f9,null))[_0x34e3('0x41')](handleError(_0x4807f9,null));};exports[_0x34e3('0x22')]=function(_0x2d2317,_0x268701){return db[_0x34e3('0x2b')][_0x34e3('0x46')]({'where':{'id':_0x2d2317[_0x34e3('0x42')]['id']}})['then'](handleEntityNotFound(_0x268701,null))[_0x34e3('0x21')](removeEntity(_0x268701,null))[_0x34e3('0x41')](handleError(_0x268701,null));};exports[_0x34e3('0x48')]=function(_0xa1fa51,_0x309c88){var _0x2a8590={'key':_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x2e')]};if(_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x49')]){_0x2a8590['MailAccountId']=_0xa1fa51[_0x34e3('0x47')]['MailAccountId'];}else if(_0xa1fa51[_0x34e3('0x47')]['SmsAccountId']){_0x2a8590[_0x34e3('0x4a')]=_0xa1fa51['body'][_0x34e3('0x4a')];}else if(_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x4b')]){_0x2a8590[_0x34e3('0x4b')]=_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x4b')];}else if(_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x4c')]){_0x2a8590['ChatWebsiteId']=_0xa1fa51[_0x34e3('0x47')][_0x34e3('0x4c')];}return db[_0x34e3('0x2b')][_0x34e3('0x46')]({'where':_0x2a8590})[_0x34e3('0x21')](function(_0x28c912){if(_0x28c912){throw new db[(_0x34e3('0x4d'))][(_0x34e3('0x4e'))](_0x34e3('0x4f'));}return db[_0x34e3('0x2b')][_0x34e3('0x48')](_0xa1fa51[_0x34e3('0x47')]);})[_0x34e3('0x21')](function(_0x42a996){var _0x5ad46c=_0xa1fa51[_0x34e3('0x50')][_0x34e3('0x23')]({'plain':!![]});if(!_0x5ad46c)throw new Error(_0x34e3('0x51'));if(_0x5ad46c[_0x34e3('0x52')]===_0x34e3('0x50')){var _0x20c35d=_0x42a996['get']({'plain':!![]});return db['UserProfileSection'][_0x34e3('0x46')]({'where':{'name':_0x34e3('0x24'),'userProfileId':_0x5ad46c[_0x34e3('0x53')]},'raw':!![]})[_0x34e3('0x21')](function(_0x3bcc38){if(_0x3bcc38&&_0x3bcc38['autoAssociation']===0x0){return db[_0x34e3('0x25')][_0x34e3('0x48')]({'name':_0x20c35d[_0x34e3('0x27')],'resourceId':_0x20c35d['id'],'type':_0x3bcc38['name'],'sectionId':_0x3bcc38['id']},{})[_0x34e3('0x21')](function(){return _0x42a996;});}else{return _0x42a996;}})[_0x34e3('0x41')](function(_0x2fa677){logger[_0x34e3('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fa677);throw _0x2fa677;});}return _0x42a996;})[_0x34e3('0x21')](respondWithResult(_0x309c88,0xc9))[_0x34e3('0x41')](handleError(_0x309c88,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 1c44cf7..13e9e14 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 _0xeebc=['lodash','../../config/logger','moment','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x218d1b,_0x5cf934){var _0x405ad0=function(_0x1e7d68){while(--_0x1e7d68){_0x218d1b['push'](_0x218d1b['shift']());}};_0x405ad0(++_0x5cf934);}(_0xeebc,0x79));var _0xceeb=function(_0x491703,_0x349860){_0x491703=_0x491703-0x0;var _0x53d338=_0xeebc[_0x491703];return _0x53d338;};'use strict';var _=require(_0xceeb('0x0'));var util=require('util');var logger=require(_0xceeb('0x1'))('api');var moment=require(_0xceeb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xceeb('0x3'));var config=require(_0xceeb('0x4'));var attributes=require(_0xceeb('0x5'));module[_0xceeb('0x6')]=function(_0x3bef84,_0x287895){return _0x3bef84[_0xceeb('0x7')](_0xceeb('0x8'),attributes,{'tableName':_0xceeb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xceeb('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7b70=['moment','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','define','CannedAnswer','utf8mb4','lodash','api'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7b70,0xc4));var _0x07b7=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x7b70[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x07b7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x07b7('0x1'));var moment=require(_0x07b7('0x2'));var BPromise=require(_0x07b7('0x3'));var rp=require(_0x07b7('0x4'));var fs=require('fs');var path=require(_0x07b7('0x5'));var rimraf=require(_0x07b7('0x6'));var config=require('../../config/environment');var attributes=require(_0x07b7('0x7'));module['exports']=function(_0x1de428,_0x19e16d){return _0x1de428[_0x07b7('0x8')](_0x07b7('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x07b7('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 4aded27..9b78835 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(_0x5420c5,_0x48d0ac){var _0x164f68=function(_0x15d032){while(--_0x15d032){_0x5420c5['push'](_0x5420c5['shift']());}};_0x164f68(++_0x48d0ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xba4983,_0x4b1f8b){var _0x216a79=function(_0x2c9e6f){while(--_0x2c9e6f){_0xba4983['push'](_0xba4983['shift']());}};_0x216a79(++_0x4b1f8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 4c7a613..7d5673e 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 _0xb033=['isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','get'];(function(_0xc1da2f,_0x4aa1c5){var _0x11f1b1=function(_0x346f6a){while(--_0x346f6a){_0xc1da2f['push'](_0xc1da2f['shift']());}};_0x11f1b1(++_0x4aa1c5);}(_0xb033,0x180));var _0x3b03=function(_0x3616e4,_0xf41415){_0x3616e4=_0x3616e4-0x0;var _0x20c9ab=_0xb033[_0x3616e4];return _0x20c9ab;};'use strict';var multer=require('multer');var util=require(_0x3b03('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3b03('0x1'));var router=express[_0x3b03('0x2')]();var fs_extra=require(_0x3b03('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3b03('0x4'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x3b03('0x5')]('/',auth[_0x3b03('0x6')](),controller[_0x3b03('0x7')]);router[_0x3b03('0x5')](_0x3b03('0x8'),auth[_0x3b03('0x6')](),controller[_0x3b03('0x9')]);router[_0x3b03('0xa')]('/',auth[_0x3b03('0x6')](),controller[_0x3b03('0xb')]);router[_0x3b03('0xc')](_0x3b03('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3b03('0x8'),auth[_0x3b03('0x6')](),controller[_0x3b03('0xd')]);module[_0x3b03('0xe')]=router; \ No newline at end of file +var _0x6fc3=['connect-timeout','express','Router','fs-extra','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x6fc3,0x13b));var _0x36fc=function(_0x185399,_0x5d382d){_0x185399=_0x185399-0x0;var _0x4d08e3=_0x6fc3[_0x185399];return _0x4d08e3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x36fc('0x0'));var express=require(_0x36fc('0x1'));var router=express[_0x36fc('0x2')]();var fs_extra=require(_0x36fc('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x36fc('0x4'));var controller=require(_0x36fc('0x5'));router[_0x36fc('0x6')]('/',auth[_0x36fc('0x7')](),controller[_0x36fc('0x8')]);router[_0x36fc('0x6')](_0x36fc('0x9'),auth[_0x36fc('0x7')](),controller['show']);router[_0x36fc('0xa')]('/',auth['isAuthenticated'](),controller[_0x36fc('0xb')]);router[_0x36fc('0xc')](_0x36fc('0x9'),auth[_0x36fc('0x7')](),controller[_0x36fc('0xd')]);router['delete'](_0x36fc('0x9'),auth[_0x36fc('0x7')](),controller[_0x36fc('0xe')]);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 399ab9b..6f0054f 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 _0xacc5=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x4ec40b,_0x242c15){var _0x360697=function(_0x1017e7){while(--_0x1017e7){_0x4ec40b['push'](_0x4ec40b['shift']());}};_0x360697(++_0x242c15);}(_0xacc5,0x104));var _0x5acc=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xacc5[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x5acc('0x0'));module[_0x5acc('0x1')]={'calldate':{'type':Sequelize[_0x5acc('0x2')],'allowNull':![],'defaultValue':_0x5acc('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x5acc('0x4')]},'dst':{'type':Sequelize[_0x5acc('0x4')]},'dcontext':{'type':Sequelize[_0x5acc('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x5acc('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5acc('0x4')]},'amaflags':{'type':Sequelize[_0x5acc('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x5acc('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x5acc('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x5acc('0x4')]},'type':{'type':Sequelize[_0x5acc('0x4')]},'tag':{'type':Sequelize[_0x5acc('0x4')]}}; \ No newline at end of file +var _0xab3a=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x603641,_0x529e6){var _0x4e6e1b=function(_0x3b8072){while(--_0x3b8072){_0x603641['push'](_0x603641['shift']());}};_0x4e6e1b(++_0x529e6);}(_0xab3a,0x1d3));var _0xaab3=function(_0x57426f,_0x52f0d3){_0x57426f=_0x57426f-0x0;var _0xe15733=_0xab3a[_0x57426f];return _0xe15733;};'use strict';var Sequelize=require(_0xaab3('0x0'));module[_0xaab3('0x1')]={'calldate':{'type':Sequelize[_0xaab3('0x2')],'allowNull':![],'defaultValue':_0xaab3('0x3')},'clid':{'type':Sequelize[_0xaab3('0x4')]},'src':{'type':Sequelize[_0xaab3('0x4')]},'dst':{'type':Sequelize[_0xaab3('0x4')]},'dcontext':{'type':Sequelize[_0xaab3('0x4')]},'channel':{'type':Sequelize[_0xaab3('0x4')]},'dstchannel':{'type':Sequelize[_0xaab3('0x4')]},'lastapp':{'type':Sequelize[_0xaab3('0x4')]},'lastdata':{'type':Sequelize[_0xaab3('0x4')]},'duration':{'type':Sequelize[_0xaab3('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xaab3('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xaab3('0x4')]},'userfield':{'type':Sequelize[_0xaab3('0x4')]},'uniqueid':{'type':Sequelize[_0xaab3('0x4')]},'linkedid':{'type':Sequelize[_0xaab3('0x4')]},'sequence':{'type':Sequelize[_0xaab3('0x4')]},'peeraccount':{'type':Sequelize[_0xaab3('0x4')]},'type':{'type':Sequelize[_0xaab3('0x4')]},'tag':{'type':Sequelize[_0xaab3('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 3162bd6..65e7625 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 _0x8819=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','zip-dir','fast-json-patch'];(function(_0xaf63c5,_0x3ad012){var _0x4f4ac5=function(_0x4d36b4){while(--_0x4d36b4){_0xaf63c5['push'](_0xaf63c5['shift']());}};_0x4f4ac5(++_0x3ad012);}(_0x8819,0x94));var _0x9881=function(_0x27411f,_0x38e1d9){_0x27411f=_0x27411f-0x0;var _0x37d0f5=_0x8819[_0x27411f];return _0x37d0f5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9881('0x0'));var jsonpatch=require(_0x9881('0x1'));var rp=require(_0x9881('0x2'));var moment=require(_0x9881('0x3'));var BPromise=require(_0x9881('0x4'));var Mustache=require('mustache');var util=require(_0x9881('0x5'));var path=require(_0x9881('0x6'));var sox=require(_0x9881('0x7'));var csv=require(_0x9881('0x8'));var ejs=require(_0x9881('0x9'));var fs=require('fs');var fs_extra=require(_0x9881('0xa'));var _=require('lodash');var squel=require(_0x9881('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9881('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9881('0xd'));var Redis=require('ioredis');var authService=require(_0x9881('0xe'));var qs=require(_0x9881('0xf'));var as=require(_0x9881('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9881('0x11'))(_0x9881('0x12'));var utils=require(_0x9881('0x13'));var config=require(_0x9881('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9881('0x15'))['db'];function respondWithStatusCode(_0x26ee3f,_0x5c6d2d){_0x5c6d2d=_0x5c6d2d||0xcc;return function(_0x42850e){if(_0x42850e){return _0x26ee3f['sendStatus'](_0x5c6d2d);}return _0x26ee3f['status'](_0x5c6d2d)['end']();};}function respondWithResult(_0x58f526,_0x12794f){_0x12794f=_0x12794f||0xc8;return function(_0x3178d7){if(_0x3178d7){return _0x58f526[_0x9881('0x16')](_0x12794f)[_0x9881('0x17')](_0x3178d7);}};}function respondWithFilteredResult(_0x39d127,_0x1d57ea){return function(_0x4b9d1b){if(_0x4b9d1b){var _0x411513=typeof _0x1d57ea[_0x9881('0x18')]===_0x9881('0x19')&&typeof _0x1d57ea['limit']==='undefined';var _0x4c92c9=_0x4b9d1b[_0x9881('0x1a')];var _0x4c3493=_0x411513?0x0:_0x1d57ea[_0x9881('0x18')];var _0x5a9848=_0x411513?_0x4b9d1b['count']:_0x1d57ea[_0x9881('0x18')]+_0x1d57ea[_0x9881('0x1b')];var _0x1cbac3;if(_0x5a9848>=_0x4c92c9){_0x5a9848=_0x4c92c9;_0x1cbac3=0xc8;}else{_0x1cbac3=0xce;}_0x39d127[_0x9881('0x16')](_0x1cbac3);return _0x39d127[_0x9881('0x1c')](_0x9881('0x1d'),_0x4c3493+'-'+_0x5a9848+'/'+_0x4c92c9)[_0x9881('0x17')](_0x4b9d1b);}return null;};}function patchUpdates(_0x1243cc){return function(_0x1ee450){try{jsonpatch[_0x9881('0x1e')](_0x1ee450,_0x1243cc,!![]);}catch(_0x32ca84){return BPromise[_0x9881('0x1f')](_0x32ca84);}return _0x1ee450[_0x9881('0x20')]();};}function saveUpdates(_0x300fa6,_0x174b39){return function(_0x58485d){if(_0x58485d){return _0x58485d['update'](_0x300fa6)[_0x9881('0x21')](function(_0x513545){return _0x513545;});}return null;};}function removeEntity(_0x499461,_0x1ba558){return function(_0x30ed15){if(_0x30ed15){return _0x30ed15['destroy']()['then'](function(){_0x499461[_0x9881('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bddc1,_0x161f8d){return function(_0x16eeca){if(!_0x16eeca){_0x2bddc1[_0x9881('0x22')](0x194);}return _0x16eeca;};}function handleError(_0x2c3cd1,_0x14e6f9){_0x14e6f9=_0x14e6f9||0x1f4;return function(_0x2f6b7c){logger[_0x9881('0x23')](_0x2f6b7c[_0x9881('0x24')]);if(_0x2f6b7c[_0x9881('0x25')]){delete _0x2f6b7c[_0x9881('0x25')];}_0x2c3cd1[_0x9881('0x16')](_0x14e6f9)[_0x9881('0x26')](_0x2f6b7c);};}exports['index']=function(_0x31956e,_0x41fe0d){var _0x5c2815={},_0x236979={},_0x3d7120={'count':0x0,'rows':[]};var _0x4970be=_[_0x9881('0x27')](db[_0x9881('0x28')][_0x9881('0x29')],function(_0x204f2b){return{'name':_0x204f2b[_0x9881('0x2a')],'type':_0x204f2b[_0x9881('0x2b')][_0x9881('0x2c')]};});_0x236979[_0x9881('0x2d')]=_['map'](_0x4970be,_0x9881('0x25'));_0x236979[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x31956e[_0x9881('0x2e')]);_0x236979[_0x9881('0x30')]=_[_0x9881('0x31')](_0x236979['model'],_0x236979[_0x9881('0x2e')]);_0x5c2815[_0x9881('0x32')]=_['intersection'](_0x236979[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x31956e[_0x9881('0x2e')][_0x9881('0x33')]));_0x5c2815[_0x9881('0x32')]=_0x5c2815['attributes'][_0x9881('0x34')]?_0x5c2815[_0x9881('0x32')]:_0x236979[_0x9881('0x2d')];if(!_0x31956e[_0x9881('0x2e')][_0x9881('0x35')](_0x9881('0x36'))){_0x5c2815[_0x9881('0x1b')]=qs[_0x9881('0x1b')](_0x31956e[_0x9881('0x2e')][_0x9881('0x1b')]);_0x5c2815[_0x9881('0x18')]=qs[_0x9881('0x18')](_0x31956e[_0x9881('0x2e')][_0x9881('0x18')]);}_0x5c2815[_0x9881('0x37')]=qs[_0x9881('0x38')](_0x31956e['query'][_0x9881('0x38')]);_0x5c2815['where']=qs[_0x9881('0x30')](_['pick'](_0x31956e[_0x9881('0x2e')],_0x236979[_0x9881('0x30')]),_0x4970be);if(_0x31956e['query'][_0x9881('0x39')]){_0x5c2815['where']=_[_0x9881('0x3a')](_0x5c2815[_0x9881('0x3b')],{'$or':_[_0x9881('0x27')](_0x4970be,function(_0x204fc3){if(_0x204fc3['type']!==_0x9881('0x3c')){var _0x3d183e={};_0x3d183e[_0x204fc3[_0x9881('0x25')]]={'$like':'%'+_0x31956e[_0x9881('0x2e')][_0x9881('0x39')]+'%'};return _0x3d183e;}})});}_0x5c2815=_[_0x9881('0x3a')]({},_0x5c2815,_0x31956e[_0x9881('0x3d')]);var _0x4feb70={'where':_0x5c2815[_0x9881('0x3b')]};return db['Cdr'][_0x9881('0x1a')](_0x4feb70)[_0x9881('0x21')](function(_0x1c0396){_0x3d7120['count']=_0x1c0396;if(_0x31956e[_0x9881('0x2e')][_0x9881('0x3e')]){_0x5c2815[_0x9881('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0x9881('0x40')](_0x5c2815);})[_0x9881('0x21')](function(_0x4fe13d){_0x3d7120[_0x9881('0x41')]=_0x4fe13d;return _0x3d7120;})[_0x9881('0x21')](respondWithFilteredResult(_0x41fe0d,_0x5c2815))[_0x9881('0x42')](handleError(_0x41fe0d,null));};exports[_0x9881('0x43')]=function(_0x424ed1,_0x1eae2f){var _0x2ac606={'raw':!![],'where':{'id':_0x424ed1[_0x9881('0x44')]['id']}},_0x4421bc={};_0x4421bc[_0x9881('0x2d')]=_['keys'](db[_0x9881('0x28')][_0x9881('0x29')]);_0x4421bc[_0x9881('0x2e')]=_[_0x9881('0x2f')](_0x424ed1[_0x9881('0x2e')]);_0x4421bc['filters']=_[_0x9881('0x31')](_0x4421bc[_0x9881('0x2d')],_0x4421bc[_0x9881('0x2e')]);_0x2ac606[_0x9881('0x32')]=_['intersection'](_0x4421bc[_0x9881('0x2d')],qs[_0x9881('0x33')](_0x424ed1[_0x9881('0x2e')]['fields']));_0x2ac606[_0x9881('0x32')]=_0x2ac606[_0x9881('0x32')][_0x9881('0x34')]?_0x2ac606[_0x9881('0x32')]:_0x4421bc[_0x9881('0x2d')];if(_0x424ed1[_0x9881('0x2e')][_0x9881('0x3e')]){_0x2ac606[_0x9881('0x3f')]=[{'all':!![]}];}_0x2ac606=_[_0x9881('0x3a')]({},_0x2ac606,_0x424ed1[_0x9881('0x3d')]);return db['Cdr'][_0x9881('0x45')](_0x2ac606)[_0x9881('0x21')](handleEntityNotFound(_0x1eae2f,null))[_0x9881('0x21')](respondWithResult(_0x1eae2f,null))['catch'](handleError(_0x1eae2f,null));};exports[_0x9881('0x46')]=function(_0x24a52b,_0x1e1f0f){return db['Cdr']['create'](_0x24a52b[_0x9881('0x47')],{})[_0x9881('0x21')](respondWithResult(_0x1e1f0f,0xc9))[_0x9881('0x42')](handleError(_0x1e1f0f,null));};exports[_0x9881('0x48')]=function(_0x49c478,_0x514263){if(_0x49c478[_0x9881('0x47')]['id']){delete _0x49c478[_0x9881('0x47')]['id'];}return db[_0x9881('0x28')]['find']({'where':{'id':_0x49c478[_0x9881('0x44')]['id']}})[_0x9881('0x21')](handleEntityNotFound(_0x514263,null))['then'](saveUpdates(_0x49c478[_0x9881('0x47')],null))[_0x9881('0x21')](respondWithResult(_0x514263,null))[_0x9881('0x42')](handleError(_0x514263,null));};exports[_0x9881('0x49')]=function(_0x21720a,_0x32cb89){return db[_0x9881('0x28')]['find']({'where':{'id':_0x21720a[_0x9881('0x44')]['id']}})['then'](handleEntityNotFound(_0x32cb89,null))[_0x9881('0x21')](removeEntity(_0x32cb89,null))[_0x9881('0x42')](handleError(_0x32cb89,null));};exports[_0x9881('0x4a')]=function(_0x16ca26,_0x590acc){return db['Cdr'][_0x9881('0x4a')]()[_0x9881('0x21')](respondWithResult(_0x590acc,null))[_0x9881('0x42')](handleError(_0x590acc,null));}; \ No newline at end of file +var _0x86f4=['bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Cdr','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1daed9,_0xa4075e){var _0x37b134=function(_0x260e8f){while(--_0x260e8f){_0x1daed9['push'](_0x1daed9['shift']());}};_0x37b134(++_0xa4075e);}(_0x86f4,0x18a));var _0x486f=function(_0x2814f3,_0x593a48){_0x2814f3=_0x2814f3-0x0;var _0x3a38e3=_0x86f4[_0x2814f3];return _0x3a38e3;};'use strict';var emlformat=require(_0x486f('0x0'));var rimraf=require(_0x486f('0x1'));var zipdir=require(_0x486f('0x2'));var jsonpatch=require(_0x486f('0x3'));var rp=require(_0x486f('0x4'));var moment=require(_0x486f('0x5'));var BPromise=require(_0x486f('0x6'));var Mustache=require('mustache');var util=require(_0x486f('0x7'));var path=require(_0x486f('0x8'));var sox=require('sox');var csv=require(_0x486f('0x9'));var ejs=require(_0x486f('0xa'));var fs=require('fs');var fs_extra=require(_0x486f('0xb'));var _=require(_0x486f('0xc'));var squel=require(_0x486f('0xd'));var crypto=require(_0x486f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x486f('0xf'));var toCsv=require(_0x486f('0x9'));var querystring=require(_0x486f('0x10'));var Papa=require(_0x486f('0x11'));var Redis=require(_0x486f('0x12'));var authService=require(_0x486f('0x13'));var qs=require(_0x486f('0x14'));var as=require(_0x486f('0x15'));var hardwareService=require(_0x486f('0x16'));var logger=require(_0x486f('0x17'))(_0x486f('0x18'));var utils=require(_0x486f('0x19'));var config=require(_0x486f('0x1a'));var licenseUtil=require(_0x486f('0x1b'));var db=require(_0x486f('0x1c'))['db'];function respondWithStatusCode(_0x4312fb,_0x1c4e55){_0x1c4e55=_0x1c4e55||0xcc;return function(_0x4eb4f9){if(_0x4eb4f9){return _0x4312fb[_0x486f('0x1d')](_0x1c4e55);}return _0x4312fb['status'](_0x1c4e55)[_0x486f('0x1e')]();};}function respondWithResult(_0x2cc608,_0x1ac871){_0x1ac871=_0x1ac871||0xc8;return function(_0x50bee8){if(_0x50bee8){return _0x2cc608['status'](_0x1ac871)[_0x486f('0x1f')](_0x50bee8);}};}function respondWithFilteredResult(_0x3a4fef,_0x51334f){return function(_0x16830e){if(_0x16830e){var _0x2ab753=typeof _0x51334f[_0x486f('0x20')]==='undefined'&&typeof _0x51334f['limit']===_0x486f('0x21');var _0x3eeae0=_0x16830e[_0x486f('0x22')];var _0x39bfac=_0x2ab753?0x0:_0x51334f['offset'];var _0x59deb8=_0x2ab753?_0x16830e[_0x486f('0x22')]:_0x51334f[_0x486f('0x20')]+_0x51334f[_0x486f('0x23')];var _0x20a1f7;if(_0x59deb8>=_0x3eeae0){_0x59deb8=_0x3eeae0;_0x20a1f7=0xc8;}else{_0x20a1f7=0xce;}_0x3a4fef[_0x486f('0x24')](_0x20a1f7);return _0x3a4fef[_0x486f('0x25')](_0x486f('0x26'),_0x39bfac+'-'+_0x59deb8+'/'+_0x3eeae0)[_0x486f('0x1f')](_0x16830e);}return null;};}function patchUpdates(_0xe0b1cc){return function(_0x3d79bc){try{jsonpatch[_0x486f('0x27')](_0x3d79bc,_0xe0b1cc,!![]);}catch(_0x4ccac0){return BPromise[_0x486f('0x28')](_0x4ccac0);}return _0x3d79bc[_0x486f('0x29')]();};}function saveUpdates(_0x26a909,_0x4a0eb5){return function(_0x4d784e){if(_0x4d784e){return _0x4d784e[_0x486f('0x2a')](_0x26a909)[_0x486f('0x2b')](function(_0x16a530){return _0x16a530;});}return null;};}function removeEntity(_0x14b309,_0x351f81){return function(_0x26822b){if(_0x26822b){return _0x26822b[_0x486f('0x2c')]()[_0x486f('0x2b')](function(){_0x14b309[_0x486f('0x24')](0xcc)[_0x486f('0x1e')]();});}};}function handleEntityNotFound(_0x2e983b,_0x71a26f){return function(_0x387462){if(!_0x387462){_0x2e983b[_0x486f('0x1d')](0x194);}return _0x387462;};}function handleError(_0x8b3277,_0x30b322){_0x30b322=_0x30b322||0x1f4;return function(_0x6f1e8e){logger[_0x486f('0x2d')](_0x6f1e8e[_0x486f('0x2e')]);if(_0x6f1e8e[_0x486f('0x2f')]){delete _0x6f1e8e[_0x486f('0x2f')];}_0x8b3277[_0x486f('0x24')](_0x30b322)['send'](_0x6f1e8e);};}exports['index']=function(_0x52fb3a,_0x5b4718){var _0x173512={},_0x5c994a={},_0x2003a3={'count':0x0,'rows':[]};var _0x3ffa45=_['map'](db[_0x486f('0x30')]['rawAttributes'],function(_0x1f9dee){return{'name':_0x1f9dee[_0x486f('0x31')],'type':_0x1f9dee[_0x486f('0x32')][_0x486f('0x33')]};});_0x5c994a[_0x486f('0x34')]=_[_0x486f('0x35')](_0x3ffa45,'name');_0x5c994a[_0x486f('0x36')]=_[_0x486f('0x37')](_0x52fb3a[_0x486f('0x36')]);_0x5c994a[_0x486f('0x38')]=_[_0x486f('0x39')](_0x5c994a[_0x486f('0x34')],_0x5c994a[_0x486f('0x36')]);_0x173512[_0x486f('0x3a')]=_['intersection'](_0x5c994a[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x52fb3a['query'][_0x486f('0x3b')]));_0x173512[_0x486f('0x3a')]=_0x173512[_0x486f('0x3a')][_0x486f('0x3c')]?_0x173512[_0x486f('0x3a')]:_0x5c994a['model'];if(!_0x52fb3a[_0x486f('0x36')][_0x486f('0x3d')](_0x486f('0x3e'))){_0x173512[_0x486f('0x23')]=qs[_0x486f('0x23')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x23')]);_0x173512['offset']=qs[_0x486f('0x20')](_0x52fb3a[_0x486f('0x36')][_0x486f('0x20')]);}_0x173512['order']=qs['sort'](_0x52fb3a[_0x486f('0x36')][_0x486f('0x3f')]);_0x173512['where']=qs[_0x486f('0x38')](_['pick'](_0x52fb3a[_0x486f('0x36')],_0x5c994a[_0x486f('0x38')]),_0x3ffa45);if(_0x52fb3a['query']['filter']){_0x173512[_0x486f('0x40')]=_[_0x486f('0x41')](_0x173512[_0x486f('0x40')],{'$or':_[_0x486f('0x35')](_0x3ffa45,function(_0xdedd85){if(_0xdedd85[_0x486f('0x32')]!==_0x486f('0x42')){var _0x1742e0={};_0x1742e0[_0xdedd85[_0x486f('0x2f')]]={'$like':'%'+_0x52fb3a[_0x486f('0x36')][_0x486f('0x43')]+'%'};return _0x1742e0;}})});}_0x173512=_[_0x486f('0x41')]({},_0x173512,_0x52fb3a[_0x486f('0x44')]);var _0x43d9be={'where':_0x173512['where']};return db[_0x486f('0x30')][_0x486f('0x22')](_0x43d9be)['then'](function(_0x12f7dc){_0x2003a3[_0x486f('0x22')]=_0x12f7dc;if(_0x52fb3a[_0x486f('0x36')][_0x486f('0x45')]){_0x173512[_0x486f('0x46')]=[{'all':!![]}];}return db[_0x486f('0x30')][_0x486f('0x47')](_0x173512);})[_0x486f('0x2b')](function(_0x3205e0){_0x2003a3['rows']=_0x3205e0;return _0x2003a3;})['then'](respondWithFilteredResult(_0x5b4718,_0x173512))[_0x486f('0x48')](handleError(_0x5b4718,null));};exports[_0x486f('0x49')]=function(_0x3cf897,_0x42ef68){var _0x2937a6={'raw':!![],'where':{'id':_0x3cf897[_0x486f('0x4a')]['id']}},_0x250979={};_0x250979[_0x486f('0x34')]=_[_0x486f('0x37')](db['Cdr'][_0x486f('0x4b')]);_0x250979[_0x486f('0x36')]=_[_0x486f('0x37')](_0x3cf897[_0x486f('0x36')]);_0x250979['filters']=_[_0x486f('0x39')](_0x250979['model'],_0x250979[_0x486f('0x36')]);_0x2937a6[_0x486f('0x3a')]=_[_0x486f('0x39')](_0x250979[_0x486f('0x34')],qs[_0x486f('0x3b')](_0x3cf897[_0x486f('0x36')]['fields']));_0x2937a6['attributes']=_0x2937a6[_0x486f('0x3a')][_0x486f('0x3c')]?_0x2937a6[_0x486f('0x3a')]:_0x250979[_0x486f('0x34')];if(_0x3cf897['query'][_0x486f('0x45')]){_0x2937a6[_0x486f('0x46')]=[{'all':!![]}];}_0x2937a6=_[_0x486f('0x41')]({},_0x2937a6,_0x3cf897['options']);return db[_0x486f('0x30')][_0x486f('0x4c')](_0x2937a6)[_0x486f('0x2b')](handleEntityNotFound(_0x42ef68,null))[_0x486f('0x2b')](respondWithResult(_0x42ef68,null))[_0x486f('0x48')](handleError(_0x42ef68,null));};exports[_0x486f('0x4d')]=function(_0xb65e98,_0x21f222){return db['Cdr'][_0x486f('0x4d')](_0xb65e98['body'],{})[_0x486f('0x2b')](respondWithResult(_0x21f222,0xc9))[_0x486f('0x48')](handleError(_0x21f222,null));};exports[_0x486f('0x2a')]=function(_0x1055cf,_0x34033e){if(_0x1055cf[_0x486f('0x4e')]['id']){delete _0x1055cf['body']['id'];}return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x1055cf[_0x486f('0x4a')]['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x34033e,null))[_0x486f('0x2b')](saveUpdates(_0x1055cf[_0x486f('0x4e')],null))[_0x486f('0x2b')](respondWithResult(_0x34033e,null))[_0x486f('0x48')](handleError(_0x34033e,null));};exports[_0x486f('0x2c')]=function(_0x5cd989,_0x300de9){return db[_0x486f('0x30')][_0x486f('0x4c')]({'where':{'id':_0x5cd989['params']['id']}})[_0x486f('0x2b')](handleEntityNotFound(_0x300de9,null))[_0x486f('0x2b')](removeEntity(_0x300de9,null))[_0x486f('0x48')](handleError(_0x300de9,null));};exports['describe']=function(_0x195c9c,_0x372d2f){return db[_0x486f('0x30')][_0x486f('0x4f')]()['then'](respondWithResult(_0x372d2f,null))['catch'](handleError(_0x372d2f,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index b390a9d..f3180c8 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(_0xd94408,_0x31df46){var _0x5b06ee=function(_0x37911c){while(--_0x37911c){_0xd94408['push'](_0xd94408['shift']());}};_0x5b06ee(++_0x31df46);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x592f08,_0x25c7b6){var _0x4cd8fb=function(_0x5887b1){while(--_0x5887b1){_0x592f08['push'](_0x592f08['shift']());}};_0x4cd8fb(++_0x25c7b6);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 68e4dec..4827642 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 _0x8669=['randomstring','ioredis','../../config/logger','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8669,0x1eb));var _0x9866=function(_0x23e015,_0x44c03d){_0x23e015=_0x23e015-0x0;var _0x5e5208=_0x8669[_0x23e015];return _0x5e5208;};'use strict';var _=require('lodash');var util=require(_0x9866('0x0'));var moment=require(_0x9866('0x1'));var BPromise=require(_0x9866('0x2'));var rs=require(_0x9866('0x3'));var fs=require('fs');var Redis=require(_0x9866('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9866('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9866('0x6'));var client=jayson[_0x9866('0x7')][_0x9866('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41d1d5,_0x3a2382,_0x5c67a7){return new BPromise(function(_0x541138,_0x4687a9){return client['request'](_0x41d1d5,_0x5c67a7)[_0x9866('0x9')](function(_0x157d36){logger[_0x9866('0xa')](_0x9866('0xb'),_0x3a2382,_0x9866('0xc'));logger[_0x9866('0xd')](_0x9866('0xe'),_0x3a2382,'request\x20sent',JSON['stringify'](_0x157d36));if(_0x157d36[_0x9866('0xf')]){if(_0x157d36[_0x9866('0xf')][_0x9866('0x10')]===0x1f4){logger['error'](_0x9866('0xb'),_0x3a2382,_0x157d36[_0x9866('0xf')]['message']);return _0x4687a9(_0x157d36[_0x9866('0xf')][_0x9866('0x11')]);}logger[_0x9866('0xf')](_0x9866('0xb'),_0x3a2382,_0x157d36[_0x9866('0xf')][_0x9866('0x11')]);return _0x541138(_0x157d36[_0x9866('0xf')][_0x9866('0x11')]);}else{logger['info'](_0x9866('0xb'),_0x3a2382,'request\x20sent');_0x541138(_0x157d36[_0x9866('0x12')][_0x9866('0x11')]);}})['catch'](function(_0x42daf2){logger[_0x9866('0xf')](_0x9866('0xb'),_0x3a2382,_0x42daf2);_0x4687a9(_0x42daf2);});});} \ No newline at end of file +var _0xcece=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash'];(function(_0x11b502,_0x3b3f9){var _0x532480=function(_0x1b55a7){while(--_0x1b55a7){_0x11b502['push'](_0x11b502['shift']());}};_0x532480(++_0x3b3f9);}(_0xcece,0x12f));var _0xecec=function(_0x385329,_0x4fbae6){_0x385329=_0x385329-0x0;var _0x2d88dc=_0xcece[_0x385329];return _0x2d88dc;};'use strict';var _=require(_0xecec('0x0'));var util=require('util');var moment=require(_0xecec('0x1'));var BPromise=require(_0xecec('0x2'));var rs=require(_0xecec('0x3'));var fs=require('fs');var Redis=require(_0xecec('0x4'));var db=require(_0xecec('0x5'))['db'];var utils=require(_0xecec('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xecec('0x7'));var jayson=require(_0xecec('0x8'));var client=jayson['client'][_0xecec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e3568,_0x2dd0f1,_0x58886a){return new BPromise(function(_0x1f51fa,_0x575e64){return client[_0xecec('0xa')](_0x3e3568,_0x58886a)[_0xecec('0xb')](function(_0x4ba43a){logger[_0xecec('0xc')](_0xecec('0xd'),_0x2dd0f1,_0xecec('0xe'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x2dd0f1,_0xecec('0xe'),JSON['stringify'](_0x4ba43a));if(_0x4ba43a['error']){if(_0x4ba43a[_0xecec('0xf')]['code']===0x1f4){logger['error'](_0xecec('0xd'),_0x2dd0f1,_0x4ba43a[_0xecec('0xf')][_0xecec('0x10')]);return _0x575e64(_0x4ba43a[_0xecec('0xf')][_0xecec('0x10')]);}logger[_0xecec('0xf')](_0xecec('0xd'),_0x2dd0f1,_0x4ba43a['error'][_0xecec('0x10')]);return _0x1f51fa(_0x4ba43a[_0xecec('0xf')][_0xecec('0x10')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x2dd0f1,_0xecec('0xe'));_0x1f51fa(_0x4ba43a[_0xecec('0x11')][_0xecec('0x10')]);}})[_0xecec('0x12')](function(_0x158312){logger['error'](_0xecec('0xd'),_0x2dd0f1,_0x158312);_0x575e64(_0x158312);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index e7d226d..8e7c34a 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x42f3e4,_0x2646fd){var _0x1d7aa6=function(_0x4a721d){while(--_0x4a721d){_0x42f3e4['push'](_0x42f3e4['shift']());}};_0x1d7aa6(++_0x2646fd);}(_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 +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2b30e1,_0x5989e0){var _0xa082ed=function(_0x502150){while(--_0x502150){_0x2b30e1['push'](_0x2b30e1['shift']());}};_0xa082ed(++_0x5989e0);}(_0xb10b,0x12a));var _0xbb10=function(_0x27650e,_0x278f7a){_0x27650e=_0x27650e-0x0;var _0x28fe08=_0xb10b[_0x27650e];return _0x28fe08;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 2d1e417..1c21c6e 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 _0x1912=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1912,0x9d));var _0x2191=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1912[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x2191('0x0'));module[_0x2191('0x1')]={'priority':{'type':Sequelize[_0x2191('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2191('0x3')],'allowNull':![],'defaultValue':_0x2191('0x4')},'appdata':{'type':Sequelize[_0x2191('0x5')]()},'description':{'type':Sequelize[_0x2191('0x3')]},'interval':{'type':Sequelize[_0x2191('0x3')],'defaultValue':_0x2191('0x6')}}; \ No newline at end of file +var _0xb492=['STRING','noop','TEXT','*,*,*,*'];(function(_0x36c8c6,_0x527c52){var _0x45c1e0=function(_0x41daf3){while(--_0x41daf3){_0x36c8c6['push'](_0x36c8c6['shift']());}};_0x45c1e0(++_0x527c52);}(_0xb492,0x8c));var _0x2b49=function(_0x26f451,_0x11a72e){_0x26f451=_0x26f451-0x0;var _0x342138=_0xb492[_0x26f451];return _0x342138;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2b49('0x0')],'allowNull':![],'defaultValue':_0x2b49('0x1')},'appdata':{'type':Sequelize[_0x2b49('0x2')]()},'description':{'type':Sequelize[_0x2b49('0x0')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2b49('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index b758740..2824979 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 _0x0db9=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','stack','name','send','show','model','keys','rawAttributes','query','intersection','fields','attributes','includeAll','include','merge','options','catch','body','ChatApplication','find','destroy','params','eml-format','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x0db9,0xa3));var _0x90db=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x0db9[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x90db('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x90db('0x1'));var moment=require(_0x90db('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x90db('0x3'));var util=require('util');var path=require(_0x90db('0x4'));var sox=require(_0x90db('0x5'));var csv=require('to-csv');var ejs=require(_0x90db('0x6'));var fs=require('fs');var fs_extra=require(_0x90db('0x7'));var _=require(_0x90db('0x8'));var squel=require(_0x90db('0x9'));var crypto=require(_0x90db('0xa'));var jsforce=require(_0x90db('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x90db('0xc'));var querystring=require(_0x90db('0xd'));var Papa=require(_0x90db('0xe'));var Redis=require(_0x90db('0xf'));var authService=require(_0x90db('0x10'));var qs=require(_0x90db('0x11'));var as=require(_0x90db('0x12'));var hardwareService=require(_0x90db('0x13'));var logger=require(_0x90db('0x14'))(_0x90db('0x15'));var utils=require(_0x90db('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x90db('0x17'));var db=require(_0x90db('0x18'))['db'];function respondWithStatusCode(_0x45ad3c,_0x436327){_0x436327=_0x436327||0xcc;return function(_0x1b410d){if(_0x1b410d){return _0x45ad3c[_0x90db('0x19')](_0x436327);}return _0x45ad3c[_0x90db('0x1a')](_0x436327)[_0x90db('0x1b')]();};}function respondWithResult(_0x7826f7,_0x309aea){_0x309aea=_0x309aea||0xc8;return function(_0x334e22){if(_0x334e22){return _0x7826f7[_0x90db('0x1a')](_0x309aea)[_0x90db('0x1c')](_0x334e22);}};}function respondWithFilteredResult(_0xda2abe,_0x544226){return function(_0x3124d4){if(_0x3124d4){var _0x5ef456=typeof _0x544226[_0x90db('0x1d')]===_0x90db('0x1e')&&typeof _0x544226[_0x90db('0x1f')]===_0x90db('0x1e');var _0x32ff04=_0x3124d4[_0x90db('0x20')];var _0x15e33e=_0x5ef456?0x0:_0x544226[_0x90db('0x1d')];var _0x24a16a=_0x5ef456?_0x3124d4[_0x90db('0x20')]:_0x544226['offset']+_0x544226[_0x90db('0x1f')];var _0x445a22;if(_0x24a16a>=_0x32ff04){_0x24a16a=_0x32ff04;_0x445a22=0xc8;}else{_0x445a22=0xce;}_0xda2abe['status'](_0x445a22);return _0xda2abe['set'](_0x90db('0x21'),_0x15e33e+'-'+_0x24a16a+'/'+_0x32ff04)[_0x90db('0x1c')](_0x3124d4);}return null;};}function patchUpdates(_0x300dc2){return function(_0x3a58c4){try{jsonpatch[_0x90db('0x22')](_0x3a58c4,_0x300dc2,!![]);}catch(_0x168eaf){return BPromise[_0x90db('0x23')](_0x168eaf);}return _0x3a58c4['save']();};}function saveUpdates(_0xb45340,_0x1aeab9){return function(_0x23934a){if(_0x23934a){return _0x23934a[_0x90db('0x24')](_0xb45340)['then'](function(_0x43028e){return _0x43028e;});}return null;};}function removeEntity(_0x5a98f6,_0x459068){return function(_0x19f9c6){if(_0x19f9c6){return _0x19f9c6['destroy']()[_0x90db('0x25')](function(){_0x5a98f6[_0x90db('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f8469,_0x3e3fbd){return function(_0x5b3c09){if(!_0x5b3c09){_0x2f8469[_0x90db('0x19')](0x194);}return _0x5b3c09;};}function handleError(_0xe026cf,_0x1cc660){_0x1cc660=_0x1cc660||0x1f4;return function(_0x94cd84){logger['error'](_0x94cd84[_0x90db('0x26')]);if(_0x94cd84[_0x90db('0x27')]){delete _0x94cd84[_0x90db('0x27')];}_0xe026cf[_0x90db('0x1a')](_0x1cc660)[_0x90db('0x28')](_0x94cd84);};}exports[_0x90db('0x29')]=function(_0x44b5b6,_0x3c7f67){var _0x4c6311={'raw':!![],'where':{'id':_0x44b5b6['params']['id']}},_0x3489d1={};_0x3489d1[_0x90db('0x2a')]=_[_0x90db('0x2b')](db['ChatApplication'][_0x90db('0x2c')]);_0x3489d1[_0x90db('0x2d')]=_[_0x90db('0x2b')](_0x44b5b6[_0x90db('0x2d')]);_0x3489d1['filters']=_[_0x90db('0x2e')](_0x3489d1[_0x90db('0x2a')],_0x3489d1[_0x90db('0x2d')]);_0x4c6311['attributes']=_['intersection'](_0x3489d1[_0x90db('0x2a')],qs[_0x90db('0x2f')](_0x44b5b6[_0x90db('0x2d')]['fields']));_0x4c6311[_0x90db('0x30')]=_0x4c6311[_0x90db('0x30')]['length']?_0x4c6311[_0x90db('0x30')]:_0x3489d1[_0x90db('0x2a')];if(_0x44b5b6['query'][_0x90db('0x31')]){_0x4c6311[_0x90db('0x32')]=[{'all':!![]}];}_0x4c6311=_[_0x90db('0x33')]({},_0x4c6311,_0x44b5b6[_0x90db('0x34')]);return db['ChatApplication']['find'](_0x4c6311)[_0x90db('0x25')](handleEntityNotFound(_0x3c7f67,null))['then'](respondWithResult(_0x3c7f67,null))[_0x90db('0x35')](handleError(_0x3c7f67,null));};exports[_0x90db('0x24')]=function(_0x45cebb,_0x540176){if(_0x45cebb[_0x90db('0x36')]['id']){delete _0x45cebb['body']['id'];}return db[_0x90db('0x37')][_0x90db('0x38')]({'where':{'id':_0x45cebb['params']['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x540176,null))[_0x90db('0x25')](saveUpdates(_0x45cebb[_0x90db('0x36')],null))[_0x90db('0x25')](respondWithResult(_0x540176,null))[_0x90db('0x35')](handleError(_0x540176,null));};exports[_0x90db('0x39')]=function(_0x4de656,_0x88789f){return db[_0x90db('0x37')]['find']({'where':{'id':_0x4de656[_0x90db('0x3a')]['id']}})[_0x90db('0x25')](handleEntityNotFound(_0x88789f,null))[_0x90db('0x25')](removeEntity(_0x88789f,null))['catch'](handleError(_0x88789f,null));}; \ No newline at end of file +var _0x7e05=['path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','reject','save','update','then','destroy','error','name','send','params','keys','ChatApplication','query','filters','model','attributes','intersection','fields','includeAll','include','merge','find','catch','body','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x1cbf75,_0x325719){var _0xe8aec9=function(_0x1af7ec){while(--_0x1af7ec){_0x1cbf75['push'](_0x1cbf75['shift']());}};_0xe8aec9(++_0x325719);}(_0x7e05,0x69));var _0x57e0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e05[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x57e0('0x0'));var rimraf=require(_0x57e0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57e0('0x2'));var rp=require('request-promise');var moment=require(_0x57e0('0x3'));var BPromise=require(_0x57e0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x57e0('0x5'));var sox=require(_0x57e0('0x6'));var csv=require(_0x57e0('0x7'));var ejs=require(_0x57e0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57e0('0x9'));var squel=require('squel');var crypto=require(_0x57e0('0xa'));var jsforce=require(_0x57e0('0xb'));var deskjs=require(_0x57e0('0xc'));var toCsv=require(_0x57e0('0x7'));var querystring=require(_0x57e0('0xd'));var Papa=require(_0x57e0('0xe'));var Redis=require(_0x57e0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x57e0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57e0('0x11'));var logger=require('../../config/logger')(_0x57e0('0x12'));var utils=require(_0x57e0('0x13'));var config=require(_0x57e0('0x14'));var licenseUtil=require(_0x57e0('0x15'));var db=require(_0x57e0('0x16'))['db'];function respondWithStatusCode(_0x254141,_0x142d1f){_0x142d1f=_0x142d1f||0xcc;return function(_0x114d14){if(_0x114d14){return _0x254141[_0x57e0('0x17')](_0x142d1f);}return _0x254141['status'](_0x142d1f)[_0x57e0('0x18')]();};}function respondWithResult(_0x1ed2c1,_0x4a4562){_0x4a4562=_0x4a4562||0xc8;return function(_0x32babd){if(_0x32babd){return _0x1ed2c1['status'](_0x4a4562)[_0x57e0('0x19')](_0x32babd);}};}function respondWithFilteredResult(_0x3797e2,_0x746a9d){return function(_0x2e0beb){if(_0x2e0beb){var _0x304ec4=typeof _0x746a9d['offset']===_0x57e0('0x1a')&&typeof _0x746a9d[_0x57e0('0x1b')]===_0x57e0('0x1a');var _0x22c344=_0x2e0beb[_0x57e0('0x1c')];var _0x52cf5a=_0x304ec4?0x0:_0x746a9d[_0x57e0('0x1d')];var _0x2500ea=_0x304ec4?_0x2e0beb[_0x57e0('0x1c')]:_0x746a9d[_0x57e0('0x1d')]+_0x746a9d[_0x57e0('0x1b')];var _0x1f5dce;if(_0x2500ea>=_0x22c344){_0x2500ea=_0x22c344;_0x1f5dce=0xc8;}else{_0x1f5dce=0xce;}_0x3797e2[_0x57e0('0x1e')](_0x1f5dce);return _0x3797e2['set'](_0x57e0('0x1f'),_0x52cf5a+'-'+_0x2500ea+'/'+_0x22c344)[_0x57e0('0x19')](_0x2e0beb);}return null;};}function patchUpdates(_0x2007ff){return function(_0x3814a3){try{jsonpatch['apply'](_0x3814a3,_0x2007ff,!![]);}catch(_0x143e51){return BPromise[_0x57e0('0x20')](_0x143e51);}return _0x3814a3[_0x57e0('0x21')]();};}function saveUpdates(_0x3bc1c0,_0x5d83c6){return function(_0xc5b15){if(_0xc5b15){return _0xc5b15[_0x57e0('0x22')](_0x3bc1c0)[_0x57e0('0x23')](function(_0x4dbdc7){return _0x4dbdc7;});}return null;};}function removeEntity(_0x595696,_0x44e84c){return function(_0x3a6a14){if(_0x3a6a14){return _0x3a6a14[_0x57e0('0x24')]()[_0x57e0('0x23')](function(){_0x595696[_0x57e0('0x1e')](0xcc)[_0x57e0('0x18')]();});}};}function handleEntityNotFound(_0x46fff4,_0x257e51){return function(_0x34b9a4){if(!_0x34b9a4){_0x46fff4['sendStatus'](0x194);}return _0x34b9a4;};}function handleError(_0x3a3047,_0x541c24){_0x541c24=_0x541c24||0x1f4;return function(_0x12a4ec){logger[_0x57e0('0x25')](_0x12a4ec['stack']);if(_0x12a4ec[_0x57e0('0x26')]){delete _0x12a4ec[_0x57e0('0x26')];}_0x3a3047['status'](_0x541c24)[_0x57e0('0x27')](_0x12a4ec);};}exports['show']=function(_0x5d06bc,_0x1a5402){var _0x1b7d9c={'raw':!![],'where':{'id':_0x5d06bc[_0x57e0('0x28')]['id']}},_0x2cef3e={};_0x2cef3e['model']=_[_0x57e0('0x29')](db[_0x57e0('0x2a')]['rawAttributes']);_0x2cef3e['query']=_['keys'](_0x5d06bc[_0x57e0('0x2b')]);_0x2cef3e[_0x57e0('0x2c')]=_['intersection'](_0x2cef3e[_0x57e0('0x2d')],_0x2cef3e[_0x57e0('0x2b')]);_0x1b7d9c[_0x57e0('0x2e')]=_[_0x57e0('0x2f')](_0x2cef3e['model'],qs[_0x57e0('0x30')](_0x5d06bc[_0x57e0('0x2b')]['fields']));_0x1b7d9c['attributes']=_0x1b7d9c['attributes']['length']?_0x1b7d9c['attributes']:_0x2cef3e[_0x57e0('0x2d')];if(_0x5d06bc[_0x57e0('0x2b')][_0x57e0('0x31')]){_0x1b7d9c[_0x57e0('0x32')]=[{'all':!![]}];}_0x1b7d9c=_[_0x57e0('0x33')]({},_0x1b7d9c,_0x5d06bc['options']);return db['ChatApplication'][_0x57e0('0x34')](_0x1b7d9c)[_0x57e0('0x23')](handleEntityNotFound(_0x1a5402,null))[_0x57e0('0x23')](respondWithResult(_0x1a5402,null))[_0x57e0('0x35')](handleError(_0x1a5402,null));};exports[_0x57e0('0x22')]=function(_0x1e1b90,_0x267d30){if(_0x1e1b90[_0x57e0('0x36')]['id']){delete _0x1e1b90[_0x57e0('0x36')]['id'];}return db[_0x57e0('0x2a')][_0x57e0('0x34')]({'where':{'id':_0x1e1b90['params']['id']}})[_0x57e0('0x23')](handleEntityNotFound(_0x267d30,null))[_0x57e0('0x23')](saveUpdates(_0x1e1b90['body'],null))['then'](respondWithResult(_0x267d30,null))[_0x57e0('0x35')](handleError(_0x267d30,null));};exports['destroy']=function(_0x24b74f,_0x3ae7be){return db['ChatApplication']['find']({'where':{'id':_0x24b74f[_0x57e0('0x28')]['id']}})[_0x57e0('0x23')](handleEntityNotFound(_0x3ae7be,null))[_0x57e0('0x23')](removeEntity(_0x3ae7be,null))[_0x57e0('0x35')](handleError(_0x3ae7be,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4993361..7fad744 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 _0x28eb=['utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x28eb,0x105));var _0xb28e=function(_0x266ca7,_0x15005f){_0x266ca7=_0x266ca7-0x0;var _0x2969ca=_0x28eb[_0x266ca7];return _0x2969ca;};'use strict';var _=require(_0xb28e('0x0'));var util=require(_0xb28e('0x1'));var logger=require(_0xb28e('0x2'))('api');var moment=require(_0xb28e('0x3'));var BPromise=require(_0xb28e('0x4'));var rp=require(_0xb28e('0x5'));var fs=require('fs');var path=require(_0xb28e('0x6'));var rimraf=require(_0xb28e('0x7'));var config=require(_0xb28e('0x8'));var attributes=require(_0xb28e('0x9'));module['exports']=function(_0x42b823,_0x4638f9){return _0x42b823[_0xb28e('0xa')](_0xb28e('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb28e('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfd25=['utf8mb4','lodash','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','chat_applications'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xfd25,0x169));var _0x5fd2=function(_0x4b31ea,_0x4dbc5f){_0x4b31ea=_0x4b31ea-0x0;var _0x3bb0f5=_0xfd25[_0x4b31ea];return _0x3bb0f5;};'use strict';var _=require(_0x5fd2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5fd2('0x1'));var moment=require(_0x5fd2('0x2'));var BPromise=require(_0x5fd2('0x3'));var rp=require(_0x5fd2('0x4'));var fs=require('fs');var path=require(_0x5fd2('0x5'));var rimraf=require(_0x5fd2('0x6'));var config=require('../../config/environment');var attributes=require(_0x5fd2('0x7'));module[_0x5fd2('0x8')]=function(_0x31ddb3,_0xbee3e){return _0x31ddb3[_0x5fd2('0x9')]('ChatApplication',attributes,{'tableName':_0x5fd2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5fd2('0xb'),'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 af7a4fd..b02491a 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 _0x906c=['result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x906c,0x192));var _0xc906=function(_0x4b759f,_0x25b082){_0x4b759f=_0x4b759f-0x0;var _0x4518cc=_0x906c[_0x4b759f];return _0x4518cc;};'use strict';var _=require(_0xc906('0x0'));var util=require('util');var moment=require(_0xc906('0x1'));var BPromise=require('bluebird');var rs=require(_0xc906('0x2'));var fs=require('fs');var Redis=require(_0xc906('0x3'));var db=require(_0xc906('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc906('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc906('0x6'));var client=jayson['client'][_0xc906('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30cefe,_0x412740,_0x2ae2a1){return new BPromise(function(_0x5191ea,_0xfbb96c){return client[_0xc906('0x8')](_0x30cefe,_0x2ae2a1)[_0xc906('0x9')](function(_0x3a2697){logger['info'](_0xc906('0xa'),_0x412740,_0xc906('0xb'));logger[_0xc906('0xc')](_0xc906('0xd'),_0x412740,'request\x20sent',JSON['stringify'](_0x3a2697));if(_0x3a2697[_0xc906('0xe')]){if(_0x3a2697['error'][_0xc906('0xf')]===0x1f4){logger['error'](_0xc906('0xa'),_0x412740,_0x3a2697['error'][_0xc906('0x10')]);return _0xfbb96c(_0x3a2697[_0xc906('0xe')][_0xc906('0x10')]);}logger[_0xc906('0xe')](_0xc906('0xa'),_0x412740,_0x3a2697['error']['message']);return _0x5191ea(_0x3a2697[_0xc906('0xe')][_0xc906('0x10')]);}else{logger[_0xc906('0x11')](_0xc906('0xa'),_0x412740,'request\x20sent');_0x5191ea(_0x3a2697[_0xc906('0x12')][_0xc906('0x10')]);}})[_0xc906('0x13')](function(_0x4eba5f){logger[_0xc906('0xe')](_0xc906('0xa'),_0x412740,_0x4eba5f);_0xfbb96c(_0x4eba5f);});});} \ No newline at end of file +var _0x6491=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','moment','bluebird'];(function(_0x33c70e,_0xd8cb0b){var _0x5a33e5=function(_0x3b7f9d){while(--_0x3b7f9d){_0x33c70e['push'](_0x33c70e['shift']());}};_0x5a33e5(++_0xd8cb0b);}(_0x6491,0x10f));var _0x1649=function(_0x3856a9,_0x59ed19){_0x3856a9=_0x3856a9-0x0;var _0x541756=_0x6491[_0x3856a9];return _0x541756;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1649('0x0'));var BPromise=require(_0x1649('0x1'));var rs=require(_0x1649('0x2'));var fs=require('fs');var Redis=require(_0x1649('0x3'));var db=require(_0x1649('0x4'))['db'];var utils=require(_0x1649('0x5'));var logger=require(_0x1649('0x6'))(_0x1649('0x7'));var config=require(_0x1649('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1649('0x9')][_0x1649('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39f62e,_0x25d8de,_0x16b1eb){return new BPromise(function(_0x40fe4d,_0x18bd9d){return client[_0x1649('0xb')](_0x39f62e,_0x16b1eb)[_0x1649('0xc')](function(_0x15d87e){logger['info'](_0x1649('0xd'),_0x25d8de,'request\x20sent');logger[_0x1649('0xe')](_0x1649('0xf'),_0x25d8de,_0x1649('0x10'),JSON['stringify'](_0x15d87e));if(_0x15d87e[_0x1649('0x11')]){if(_0x15d87e[_0x1649('0x11')][_0x1649('0x12')]===0x1f4){logger[_0x1649('0x11')](_0x1649('0xd'),_0x25d8de,_0x15d87e[_0x1649('0x11')][_0x1649('0x13')]);return _0x18bd9d(_0x15d87e['error'][_0x1649('0x13')]);}logger[_0x1649('0x11')]('ChatApplication,\x20%s,\x20%s',_0x25d8de,_0x15d87e[_0x1649('0x11')][_0x1649('0x13')]);return _0x40fe4d(_0x15d87e[_0x1649('0x11')]['message']);}else{logger['info'](_0x1649('0xd'),_0x25d8de,_0x1649('0x10'));_0x40fe4d(_0x15d87e['result']['message']);}})[_0x1649('0x14')](function(_0x143980){logger[_0x1649('0x11')](_0x1649('0xd'),_0x25d8de,_0x143980);_0x18bd9d(_0x143980);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index bae263c..6a8a66e 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 _0x212c=['isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x352cd3,_0x3489ae){var _0x5a5be1=function(_0x58fdcd){while(--_0x58fdcd){_0x352cd3['push'](_0x352cd3['shift']());}};_0x5a5be1(++_0x3489ae);}(_0x212c,0x1af));var _0xc212=function(_0x3b7f17,_0x5ba525){_0x3b7f17=_0x3b7f17-0x0;var _0x1195dc=_0x212c[_0x3b7f17];return _0x1195dc;};'use strict';var multer=require(_0xc212('0x0'));var util=require(_0xc212('0x1'));var path=require(_0xc212('0x2'));var timeout=require(_0xc212('0x3'));var express=require('express');var router=express[_0xc212('0x4')]();var fs_extra=require(_0xc212('0x5'));var auth=require(_0xc212('0x6'));var interaction=require(_0xc212('0x7'));var config=require(_0xc212('0x8'));var controller=require('./chatApplication.controller');router[_0xc212('0x9')](_0xc212('0xa'),auth[_0xc212('0xb')](),controller[_0xc212('0xc')]);router[_0xc212('0xd')]('/:id',auth[_0xc212('0xb')](),controller[_0xc212('0xe')]);router[_0xc212('0xf')](_0xc212('0xa'),auth[_0xc212('0xb')](),controller['destroy']);module[_0xc212('0x10')]=router; \ No newline at end of file +var _0x67ca=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','path','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','get'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x67ca,0x78));var _0xa67c=function(_0x13d90d,_0x12b0f7){_0x13d90d=_0x13d90d-0x0;var _0x84bc48=_0x67ca[_0x13d90d];return _0x84bc48;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa67c('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa67c('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xa67c('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xa67c('0x3'));var controller=require(_0xa67c('0x4'));router[_0xa67c('0x5')](_0xa67c('0x6'),auth[_0xa67c('0x7')](),controller[_0xa67c('0x8')]);router[_0xa67c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa67c('0xa')]);router[_0xa67c('0xb')](_0xa67c('0x6'),auth[_0xa67c('0x7')](),controller[_0xa67c('0xc')]);module[_0xa67c('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index ff84bdc..367ec4e 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 _0x6c99=['sequelize','exports','STRING'];(function(_0x2410da,_0x15fc59){var _0x17db47=function(_0x4b8ed3){while(--_0x4b8ed3){_0x2410da['push'](_0x2410da['shift']());}};_0x17db47(++_0x15fc59);}(_0x6c99,0x19b));var _0x96c9=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x6c99[_0x310504];return _0x5b36d0;};'use strict';var Sequelize=require(_0x96c9('0x0'));module[_0x96c9('0x1')]={'name':{'type':Sequelize[_0x96c9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x96c9('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x287f=['exports','STRING','BOOLEAN','sequelize'];(function(_0x35468d,_0x2a7240){var _0x30da52=function(_0xd9d2f){while(--_0xd9d2f){_0x35468d['push'](_0x35468d['shift']());}};_0x30da52(++_0x2a7240);}(_0x287f,0xc7));var _0xf287=function(_0x14080c,_0x485b3){_0x14080c=_0x14080c-0x0;var _0x254794=_0x287f[_0x14080c];return _0x254794;};'use strict';var Sequelize=require(_0xf287('0x0'));module[_0xf287('0x1')]={'name':{'type':Sequelize[_0xf287('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf287('0x2')]},'write':{'type':Sequelize[_0xf287('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 343b117..0367a10 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 _0xb982=['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','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','ChatGroup','findAll','rows','catch','show','length','include','create','body','find','params','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','pick','getMembers','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0xb982,0x1d3));var _0x2b98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb982[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2b98('0x0'));var rimraf=require(_0x2b98('0x1'));var zipdir=require(_0x2b98('0x2'));var jsonpatch=require(_0x2b98('0x3'));var rp=require(_0x2b98('0x4'));var moment=require(_0x2b98('0x5'));var BPromise=require(_0x2b98('0x6'));var Mustache=require(_0x2b98('0x7'));var util=require(_0x2b98('0x8'));var path=require('path');var sox=require(_0x2b98('0x9'));var csv=require(_0x2b98('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b98('0xb'));var _=require('lodash');var squel=require(_0x2b98('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2b98('0xd'));var Papa=require(_0x2b98('0xe'));var Redis=require(_0x2b98('0xf'));var authService=require(_0x2b98('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b98('0x11'));var logger=require(_0x2b98('0x12'))(_0x2b98('0x13'));var utils=require('../../config/utils');var config=require(_0x2b98('0x14'));var licenseUtil=require(_0x2b98('0x15'));var db=require(_0x2b98('0x16'))['db'];config[_0x2b98('0x17')]=_[_0x2b98('0x18')](config[_0x2b98('0x17')],{'host':_0x2b98('0x19'),'port':0x18eb});var socket=require(_0x2b98('0x1a'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x2b98('0x1b')](socket);function respondWithStatusCode(_0x1534a6,_0x41f740){_0x41f740=_0x41f740||0xcc;return function(_0x58189a){if(_0x58189a){return _0x1534a6[_0x2b98('0x1c')](_0x41f740);}return _0x1534a6['status'](_0x41f740)[_0x2b98('0x1d')]();};}function respondWithResult(_0x592457,_0x36521f){_0x36521f=_0x36521f||0xc8;return function(_0x4e09e7){if(_0x4e09e7){return _0x592457[_0x2b98('0x1e')](_0x36521f)[_0x2b98('0x1f')](_0x4e09e7);}};}function respondWithFilteredResult(_0x580fff,_0x286e22){return function(_0x289c3a){if(_0x289c3a){var _0x1910eb=typeof _0x286e22[_0x2b98('0x20')]===_0x2b98('0x21')&&typeof _0x286e22['limit']==='undefined';var _0x46f101=_0x289c3a[_0x2b98('0x22')];var _0x685ea7=_0x1910eb?0x0:_0x286e22[_0x2b98('0x20')];var _0x3876bb=_0x1910eb?_0x289c3a[_0x2b98('0x22')]:_0x286e22[_0x2b98('0x20')]+_0x286e22[_0x2b98('0x23')];var _0x72a6ba;if(_0x3876bb>=_0x46f101){_0x3876bb=_0x46f101;_0x72a6ba=0xc8;}else{_0x72a6ba=0xce;}_0x580fff[_0x2b98('0x1e')](_0x72a6ba);return _0x580fff[_0x2b98('0x24')]('Content-Range',_0x685ea7+'-'+_0x3876bb+'/'+_0x46f101)['json'](_0x289c3a);}return null;};}function patchUpdates(_0x4d3e9b){return function(_0x3f2446){try{jsonpatch[_0x2b98('0x25')](_0x3f2446,_0x4d3e9b,!![]);}catch(_0x5d08a5){return BPromise[_0x2b98('0x26')](_0x5d08a5);}return _0x3f2446['save']();};}function saveUpdates(_0x4cab34,_0x457c37){return function(_0x414627){if(_0x414627){return _0x414627[_0x2b98('0x27')](_0x4cab34)[_0x2b98('0x28')](function(_0xcf3f7a){return _0xcf3f7a;});}return null;};}function removeEntity(_0x29339c,_0x313830){return function(_0x3f6498){if(_0x3f6498){return _0x3f6498[_0x2b98('0x29')]()[_0x2b98('0x28')](function(){_0x29339c['status'](0xcc)[_0x2b98('0x1d')]();});}};}function handleEntityNotFound(_0x4f80d9,_0x40c063){return function(_0x456a4a){if(!_0x456a4a){_0x4f80d9[_0x2b98('0x1c')](0x194);}return _0x456a4a;};}function handleError(_0x3f4a34,_0x3ce673){_0x3ce673=_0x3ce673||0x1f4;return function(_0x587de6){logger['error'](_0x587de6[_0x2b98('0x2a')]);if(_0x587de6['name']){delete _0x587de6[_0x2b98('0x2b')];}_0x3f4a34['status'](_0x3ce673)[_0x2b98('0x2c')](_0x587de6);};}exports['index']=function(_0x1d7d76,_0x1ec185){var _0x44e747={},_0x2b04fe={},_0x256709={'count':0x0,'rows':[]};var _0x486ae0=_[_0x2b98('0x2d')](db['ChatGroup'][_0x2b98('0x2e')],function(_0x21dff4){return{'name':_0x21dff4['fieldName'],'type':_0x21dff4[_0x2b98('0x2f')][_0x2b98('0x30')]};});_0x2b04fe[_0x2b98('0x31')]=_[_0x2b98('0x2d')](_0x486ae0,_0x2b98('0x2b'));_0x2b04fe[_0x2b98('0x32')]=_[_0x2b98('0x33')](_0x1d7d76[_0x2b98('0x32')]);_0x2b04fe[_0x2b98('0x34')]=_[_0x2b98('0x35')](_0x2b04fe[_0x2b98('0x31')],_0x2b04fe[_0x2b98('0x32')]);_0x44e747[_0x2b98('0x36')]=_['intersection'](_0x2b04fe[_0x2b98('0x31')],qs[_0x2b98('0x37')](_0x1d7d76[_0x2b98('0x32')][_0x2b98('0x37')]));_0x44e747['attributes']=_0x44e747[_0x2b98('0x36')]['length']?_0x44e747[_0x2b98('0x36')]:_0x2b04fe[_0x2b98('0x31')];if(!_0x1d7d76[_0x2b98('0x32')]['hasOwnProperty'](_0x2b98('0x38'))){_0x44e747[_0x2b98('0x23')]=qs[_0x2b98('0x23')](_0x1d7d76[_0x2b98('0x32')][_0x2b98('0x23')]);_0x44e747[_0x2b98('0x20')]=qs[_0x2b98('0x20')](_0x1d7d76[_0x2b98('0x32')][_0x2b98('0x20')]);}_0x44e747[_0x2b98('0x39')]=qs['sort'](_0x1d7d76['query'][_0x2b98('0x3a')]);_0x44e747[_0x2b98('0x3b')]=qs['filters'](_['pick'](_0x1d7d76[_0x2b98('0x32')],_0x2b04fe['filters']),_0x486ae0);if(_0x1d7d76[_0x2b98('0x32')]['filter']){_0x44e747[_0x2b98('0x3b')]=_['merge'](_0x44e747['where'],{'$or':_[_0x2b98('0x2d')](_0x486ae0,function(_0x4eb80c){if(_0x4eb80c[_0x2b98('0x2f')]!==_0x2b98('0x3c')){var _0x3f68ae={};_0x3f68ae[_0x4eb80c['name']]={'$like':'%'+_0x1d7d76[_0x2b98('0x32')][_0x2b98('0x3d')]+'%'};return _0x3f68ae;}})});}_0x44e747=_[_0x2b98('0x3e')]({},_0x44e747,_0x1d7d76[_0x2b98('0x3f')]);var _0x768433={'where':_0x44e747[_0x2b98('0x3b')]};return db['ChatGroup']['count'](_0x768433)[_0x2b98('0x28')](function(_0x4324d1){_0x256709['count']=_0x4324d1;if(_0x1d7d76[_0x2b98('0x32')][_0x2b98('0x40')]){_0x44e747['include']=[{'all':!![]}];}return db[_0x2b98('0x41')][_0x2b98('0x42')](_0x44e747);})['then'](function(_0x3f2306){_0x256709[_0x2b98('0x43')]=_0x3f2306;return _0x256709;})[_0x2b98('0x28')](respondWithFilteredResult(_0x1ec185,_0x44e747))[_0x2b98('0x44')](handleError(_0x1ec185,null));};exports[_0x2b98('0x45')]=function(_0x55d9e8,_0x5cc2db){var _0x3dbdaf={'raw':!![],'where':{'id':_0x55d9e8['params']['id']}},_0xe7685d={};_0xe7685d[_0x2b98('0x31')]=_[_0x2b98('0x33')](db[_0x2b98('0x41')][_0x2b98('0x2e')]);_0xe7685d[_0x2b98('0x32')]=_[_0x2b98('0x33')](_0x55d9e8[_0x2b98('0x32')]);_0xe7685d[_0x2b98('0x34')]=_[_0x2b98('0x35')](_0xe7685d[_0x2b98('0x31')],_0xe7685d['query']);_0x3dbdaf[_0x2b98('0x36')]=_[_0x2b98('0x35')](_0xe7685d[_0x2b98('0x31')],qs[_0x2b98('0x37')](_0x55d9e8[_0x2b98('0x32')][_0x2b98('0x37')]));_0x3dbdaf[_0x2b98('0x36')]=_0x3dbdaf['attributes'][_0x2b98('0x46')]?_0x3dbdaf[_0x2b98('0x36')]:_0xe7685d[_0x2b98('0x31')];if(_0x55d9e8[_0x2b98('0x32')][_0x2b98('0x40')]){_0x3dbdaf[_0x2b98('0x47')]=[{'all':!![]}];}_0x3dbdaf=_[_0x2b98('0x3e')]({},_0x3dbdaf,_0x55d9e8[_0x2b98('0x3f')]);return db[_0x2b98('0x41')]['find'](_0x3dbdaf)[_0x2b98('0x28')](handleEntityNotFound(_0x5cc2db,null))[_0x2b98('0x28')](respondWithResult(_0x5cc2db,null))[_0x2b98('0x44')](handleError(_0x5cc2db,null));};exports['create']=function(_0x53e6dc,_0x3fdcca){return db[_0x2b98('0x41')][_0x2b98('0x48')](_0x53e6dc[_0x2b98('0x49')],{})[_0x2b98('0x28')](respondWithResult(_0x3fdcca,0xc9))[_0x2b98('0x44')](handleError(_0x3fdcca,null));};exports['update']=function(_0x55bd9b,_0x3536ce){if(_0x55bd9b[_0x2b98('0x49')]['id']){delete _0x55bd9b[_0x2b98('0x49')]['id'];}return db['ChatGroup'][_0x2b98('0x4a')]({'where':{'id':_0x55bd9b['params']['id']}})['then'](handleEntityNotFound(_0x3536ce,null))[_0x2b98('0x28')](saveUpdates(_0x55bd9b['body'],null))[_0x2b98('0x28')](respondWithResult(_0x3536ce,null))['catch'](handleError(_0x3536ce,null));};exports[_0x2b98('0x29')]=function(_0x4ec7b0,_0x1bf8ed){return db[_0x2b98('0x41')][_0x2b98('0x4a')]({'where':{'id':_0x4ec7b0[_0x2b98('0x4b')]['id']}})[_0x2b98('0x28')](handleEntityNotFound(_0x1bf8ed,null))['then'](removeEntity(_0x1bf8ed,null))[_0x2b98('0x44')](handleError(_0x1bf8ed,null));};exports[_0x2b98('0x4c')]=function(_0x534949,_0x35cc0f){return db[_0x2b98('0x41')][_0x2b98('0x4c')]()[_0x2b98('0x28')](respondWithResult(_0x35cc0f,null))[_0x2b98('0x44')](handleError(_0x35cc0f,null));};exports['getUnread']=function(_0x23172d,_0x413afd,_0x4970fe){return db[_0x2b98('0x4d')]['count']({'where':{'ChatGroupId':_0x23172d[_0x2b98('0x4b')]['id'],'ToId':_0x23172d[_0x2b98('0x4e')]['id'],'read':![]}})[_0x2b98('0x28')](function(_0x5da52f){return{'id':_[_0x2b98('0x4f')](_0x23172d[_0x2b98('0x4b')]['id']),'count':_0x5da52f};})[_0x2b98('0x28')](respondWithResult(_0x413afd,null))[_0x2b98('0x44')](handleError(_0x413afd,null));};exports[_0x2b98('0x50')]=function(_0x1846e6,_0x2e13e1,_0x37d527){return db[_0x2b98('0x41')][_0x2b98('0x4a')]({'where':{'id':_0x1846e6[_0x2b98('0x4b')]['id']}})[_0x2b98('0x28')](handleEntityNotFound(_0x2e13e1,null))[_0x2b98('0x28')](function(_0x3a3bb8){if(_0x3a3bb8){return _0x3a3bb8[_0x2b98('0x50')](_0x1846e6['body'][_0x2b98('0x51')],_[_0x2b98('0x52')](_0x1846e6[_0x2b98('0x49')],[_0x2b98('0x51'),'id'])||{});}})['then'](respondWithResult(_0x2e13e1,null))[_0x2b98('0x44')](handleError(_0x2e13e1,null));};exports['getMembers']=function(_0x396153,_0x4e4c32,_0x20640a){var _0x13ec57={};var _0x5617d4={};var _0x38ed34;var _0xe0e0cd;return db[_0x2b98('0x41')][_0x2b98('0x53')]({'where':{'id':_0x396153[_0x2b98('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e4c32,null))[_0x2b98('0x28')](function(_0x4f255d){if(_0x4f255d){_0x38ed34=_0x4f255d;_0x5617d4[_0x2b98('0x31')]=_[_0x2b98('0x33')](db[_0x2b98('0x54')][_0x2b98('0x2e')]);_0x5617d4[_0x2b98('0x32')]=_[_0x2b98('0x33')](_0x396153['query']);_0x5617d4[_0x2b98('0x34')]=_[_0x2b98('0x35')](_0x5617d4[_0x2b98('0x31')],_0x5617d4[_0x2b98('0x32')]);_0x13ec57[_0x2b98('0x36')]=_['intersection'](_0x5617d4[_0x2b98('0x31')],qs[_0x2b98('0x37')](_0x396153[_0x2b98('0x32')]['fields']));_0x13ec57[_0x2b98('0x36')]=_0x13ec57[_0x2b98('0x36')]['length']?_0x13ec57[_0x2b98('0x36')]:_0x5617d4[_0x2b98('0x31')];_0x13ec57[_0x2b98('0x39')]=qs[_0x2b98('0x3a')](_0x396153[_0x2b98('0x32')][_0x2b98('0x3a')]);_0x13ec57['where']=qs['filters'](_[_0x2b98('0x55')](_0x396153['query'],_0x5617d4[_0x2b98('0x34')]));if(_0x396153['query']['filter']){_0x13ec57['where']=_[_0x2b98('0x3e')](_0x13ec57[_0x2b98('0x3b')],{'$or':_[_0x2b98('0x2d')](_0x13ec57[_0x2b98('0x36')],function(_0x509f3e){var _0x4c9446={};_0x4c9446[_0x509f3e]={'$like':'%'+_0x396153[_0x2b98('0x32')]['filter']+'%'};return _0x4c9446;})});}_0x13ec57=_['merge']({},_0x13ec57,_0x396153[_0x2b98('0x3f')]);return _0x38ed34[_0x2b98('0x56')](_0x13ec57);}})[_0x2b98('0x28')](function(_0x24890f){if(_0x24890f){_0xe0e0cd=_0x24890f[_0x2b98('0x46')];if(!_0x396153[_0x2b98('0x32')][_0x2b98('0x57')](_0x2b98('0x38'))){_0x13ec57[_0x2b98('0x23')]=qs[_0x2b98('0x23')](_0x396153['query']['limit']);_0x13ec57[_0x2b98('0x20')]=qs[_0x2b98('0x20')](_0x396153['query']['offset']);}return _0x38ed34[_0x2b98('0x56')](_0x13ec57);}})[_0x2b98('0x28')](function(_0x1ff8d6){if(_0x1ff8d6){return _0x1ff8d6?{'count':_0xe0e0cd,'rows':_0x1ff8d6}:null;}})[_0x2b98('0x28')](respondWithResult(_0x4e4c32,null))[_0x2b98('0x44')](handleError(_0x4e4c32,null));};exports[_0x2b98('0x58')]=function(_0x5554dd,_0x4b227a,_0x2b4ee9){return db[_0x2b98('0x41')][_0x2b98('0x4a')]({'where':{'id':_0x5554dd[_0x2b98('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b227a,null))[_0x2b98('0x28')](function(_0x5b6026){if(_0x5b6026){return _0x5b6026['removeMembers'](_0x5554dd[_0x2b98('0x32')]['ids']);}})['then'](respondWithStatusCode(_0x4b227a,null))[_0x2b98('0x44')](handleError(_0x4b227a,null));};exports[_0x2b98('0x59')]=function(_0x139ed6,_0x6be0ad,_0xd91ee){if(_0x139ed6[_0x2b98('0x49')]['id']){delete _0x139ed6[_0x2b98('0x49')]['id'];}return db[_0x2b98('0x41')][_0x2b98('0x4a')]({'where':{'id':_0x139ed6[_0x2b98('0x4b')]['id']}})[_0x2b98('0x28')](handleEntityNotFound(_0x6be0ad,null))[_0x2b98('0x28')](function(_0xca3056){if(_0xca3056){_0x139ed6[_0x2b98('0x49')][_0x2b98('0x5a')]=_0xca3056['id'];return db[_0x2b98('0x4d')][_0x2b98('0x48')](_0x139ed6['body']);}})[_0x2b98('0x28')](respondWithResult(_0x6be0ad,null))[_0x2b98('0x44')](handleError(_0x6be0ad,null));};exports[_0x2b98('0x5b')]=function(_0x22279e,_0x2f028c,_0x23d160){var _0x7f3d01={};var _0x15a30d={};var _0x469a38;var _0x29f32d;return db[_0x2b98('0x41')][_0x2b98('0x53')]({'where':{'id':_0x22279e[_0x2b98('0x4b')]['id']}})[_0x2b98('0x28')](handleEntityNotFound(_0x2f028c,null))['then'](function(_0xd2d251){if(_0xd2d251){_0x469a38=_0xd2d251;_0x15a30d['model']=_['keys'](db['ChatInternalMessage'][_0x2b98('0x2e')]);_0x15a30d[_0x2b98('0x32')]=_[_0x2b98('0x33')](_0x22279e[_0x2b98('0x32')]);_0x15a30d[_0x2b98('0x34')]=_[_0x2b98('0x35')](_0x15a30d[_0x2b98('0x31')],_0x15a30d[_0x2b98('0x32')]);_0x7f3d01[_0x2b98('0x36')]=_[_0x2b98('0x35')](_0x15a30d[_0x2b98('0x31')],qs[_0x2b98('0x37')](_0x22279e[_0x2b98('0x32')][_0x2b98('0x37')]));_0x7f3d01[_0x2b98('0x36')]=_0x7f3d01[_0x2b98('0x36')][_0x2b98('0x46')]?_0x7f3d01[_0x2b98('0x36')]:_0x15a30d[_0x2b98('0x31')];_0x7f3d01[_0x2b98('0x39')]=qs[_0x2b98('0x3a')](_0x22279e[_0x2b98('0x32')][_0x2b98('0x3a')]);_0x7f3d01[_0x2b98('0x3b')]=qs[_0x2b98('0x34')](_[_0x2b98('0x55')](_0x22279e[_0x2b98('0x32')],_0x15a30d['filters']));if(_0x22279e[_0x2b98('0x32')][_0x2b98('0x3d')]){_0x7f3d01[_0x2b98('0x3b')]=_[_0x2b98('0x3e')](_0x7f3d01['where'],{'$or':_[_0x2b98('0x2d')](_0x7f3d01[_0x2b98('0x36')],function(_0x218d80){var _0x2da025={};_0x2da025[_0x218d80]={'$like':'%'+_0x22279e[_0x2b98('0x32')][_0x2b98('0x3d')]+'%'};return _0x2da025;})});}if(_0x22279e[_0x2b98('0x32')]['$gte']){var _0x4197bd=_0x22279e[_0x2b98('0x32')][_0x2b98('0x5c')][_0x2b98('0x5d')](',');var _0xe45294={};_0xe45294[_0x4197bd[0x0]]={'$gte':moment(_0x4197bd[0x1])[_0x2b98('0x5e')](_0x2b98('0x5f'))};_0x7f3d01[_0x2b98('0x3b')]=_[_0x2b98('0x3e')](_0x7f3d01[_0x2b98('0x3b')],_0xe45294);}_0x7f3d01=_[_0x2b98('0x3e')]({},_0x7f3d01,_0x22279e[_0x2b98('0x3f')]);return _0x469a38[_0x2b98('0x5b')](_0x7f3d01);}})['then'](function(_0x32d91d){if(_0x32d91d){_0x29f32d=_0x32d91d['length'];if(!_0x22279e[_0x2b98('0x32')]['hasOwnProperty'](_0x2b98('0x38'))){_0x7f3d01[_0x2b98('0x23')]=qs['limit'](_0x22279e[_0x2b98('0x32')][_0x2b98('0x23')]);_0x7f3d01[_0x2b98('0x20')]=qs['offset'](_0x22279e[_0x2b98('0x32')][_0x2b98('0x20')]);}return _0x469a38[_0x2b98('0x5b')](_0x7f3d01);}})['then'](function(_0x2114bd){if(_0x2114bd){return _0x2114bd?{'count':_0x29f32d,'rows':_0x2114bd}:null;}})[_0x2b98('0x28')](respondWithResult(_0x2f028c,null))[_0x2b98('0x44')](handleError(_0x2f028c,null));}; \ No newline at end of file +var _0x049d=['./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','name','send','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','ChatGroup','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','ids','omit','findOne','User','filter','getMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost'];(function(_0x44b454,_0xd8d71d){var _0x1e6eef=function(_0x232acd){while(--_0x232acd){_0x44b454['push'](_0x44b454['shift']());}};_0x1e6eef(++_0xd8d71d);}(_0x049d,0xa8));var _0xd049=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x049d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xd049('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd049('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd049('0x2'));var moment=require('moment');var BPromise=require(_0xd049('0x3'));var Mustache=require('mustache');var util=require(_0xd049('0x4'));var path=require(_0xd049('0x5'));var sox=require('sox');var csv=require(_0xd049('0x6'));var ejs=require(_0xd049('0x7'));var fs=require('fs');var fs_extra=require(_0xd049('0x8'));var _=require(_0xd049('0x9'));var squel=require(_0xd049('0xa'));var crypto=require('crypto');var jsforce=require(_0xd049('0xb'));var deskjs=require(_0xd049('0xc'));var toCsv=require(_0xd049('0x6'));var querystring=require(_0xd049('0xd'));var Papa=require(_0xd049('0xe'));var Redis=require('ioredis');var authService=require(_0xd049('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd049('0x10'));var logger=require(_0xd049('0x11'))(_0xd049('0x12'));var utils=require(_0xd049('0x13'));var config=require(_0xd049('0x14'));var licenseUtil=require(_0xd049('0x15'));var db=require(_0xd049('0x16'))['db'];config[_0xd049('0x17')]=_[_0xd049('0x18')](config[_0xd049('0x17')],{'host':_0xd049('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd049('0x17')]));require(_0xd049('0x1a'))[_0xd049('0x1b')](socket);function respondWithStatusCode(_0x2c4a0a,_0x56a771){_0x56a771=_0x56a771||0xcc;return function(_0x33379f){if(_0x33379f){return _0x2c4a0a[_0xd049('0x1c')](_0x56a771);}return _0x2c4a0a[_0xd049('0x1d')](_0x56a771)[_0xd049('0x1e')]();};}function respondWithResult(_0x1bbecd,_0x1b1ee1){_0x1b1ee1=_0x1b1ee1||0xc8;return function(_0x1b37e9){if(_0x1b37e9){return _0x1bbecd[_0xd049('0x1d')](_0x1b1ee1)[_0xd049('0x1f')](_0x1b37e9);}};}function respondWithFilteredResult(_0x15fa72,_0x36c8cf){return function(_0x2baea8){if(_0x2baea8){var _0x49639e=typeof _0x36c8cf[_0xd049('0x20')]===_0xd049('0x21')&&typeof _0x36c8cf['limit']===_0xd049('0x21');var _0x2393ac=_0x2baea8['count'];var _0x96bd17=_0x49639e?0x0:_0x36c8cf[_0xd049('0x20')];var _0xefe906=_0x49639e?_0x2baea8[_0xd049('0x22')]:_0x36c8cf[_0xd049('0x20')]+_0x36c8cf[_0xd049('0x23')];var _0xc772fb;if(_0xefe906>=_0x2393ac){_0xefe906=_0x2393ac;_0xc772fb=0xc8;}else{_0xc772fb=0xce;}_0x15fa72[_0xd049('0x1d')](_0xc772fb);return _0x15fa72[_0xd049('0x24')](_0xd049('0x25'),_0x96bd17+'-'+_0xefe906+'/'+_0x2393ac)['json'](_0x2baea8);}return null;};}function patchUpdates(_0x32b248){return function(_0x136ccd){try{jsonpatch[_0xd049('0x26')](_0x136ccd,_0x32b248,!![]);}catch(_0x128551){return BPromise[_0xd049('0x27')](_0x128551);}return _0x136ccd[_0xd049('0x28')]();};}function saveUpdates(_0x5e67ec,_0x13d02a){return function(_0x8c698f){if(_0x8c698f){return _0x8c698f[_0xd049('0x29')](_0x5e67ec)[_0xd049('0x2a')](function(_0x301c99){return _0x301c99;});}return null;};}function removeEntity(_0x1186be,_0x37f685){return function(_0x30b488){if(_0x30b488){return _0x30b488['destroy']()[_0xd049('0x2a')](function(){_0x1186be[_0xd049('0x1d')](0xcc)[_0xd049('0x1e')]();});}};}function handleEntityNotFound(_0x1f94e7,_0x171759){return function(_0x3ccf5a){if(!_0x3ccf5a){_0x1f94e7[_0xd049('0x1c')](0x194);}return _0x3ccf5a;};}function handleError(_0x441ce6,_0x2499d1){_0x2499d1=_0x2499d1||0x1f4;return function(_0x43b3f3){logger['error'](_0x43b3f3['stack']);if(_0x43b3f3[_0xd049('0x2b')]){delete _0x43b3f3[_0xd049('0x2b')];}_0x441ce6[_0xd049('0x1d')](_0x2499d1)[_0xd049('0x2c')](_0x43b3f3);};}exports['index']=function(_0x1b3f8b,_0x717c00){var _0x280436={},_0x46eb1f={},_0xd7adf8={'count':0x0,'rows':[]};var _0x5a9596=_['map'](db['ChatGroup']['rawAttributes'],function(_0x45835d){return{'name':_0x45835d[_0xd049('0x2d')],'type':_0x45835d[_0xd049('0x2e')][_0xd049('0x2f')]};});_0x46eb1f[_0xd049('0x30')]=_[_0xd049('0x31')](_0x5a9596,_0xd049('0x2b'));_0x46eb1f[_0xd049('0x32')]=_[_0xd049('0x33')](_0x1b3f8b['query']);_0x46eb1f['filters']=_[_0xd049('0x34')](_0x46eb1f[_0xd049('0x30')],_0x46eb1f['query']);_0x280436[_0xd049('0x35')]=_[_0xd049('0x34')](_0x46eb1f[_0xd049('0x30')],qs[_0xd049('0x36')](_0x1b3f8b[_0xd049('0x32')]['fields']));_0x280436[_0xd049('0x35')]=_0x280436[_0xd049('0x35')][_0xd049('0x37')]?_0x280436[_0xd049('0x35')]:_0x46eb1f[_0xd049('0x30')];if(!_0x1b3f8b[_0xd049('0x32')][_0xd049('0x38')](_0xd049('0x39'))){_0x280436[_0xd049('0x23')]=qs[_0xd049('0x23')](_0x1b3f8b[_0xd049('0x32')][_0xd049('0x23')]);_0x280436[_0xd049('0x20')]=qs['offset'](_0x1b3f8b[_0xd049('0x32')][_0xd049('0x20')]);}_0x280436[_0xd049('0x3a')]=qs[_0xd049('0x3b')](_0x1b3f8b[_0xd049('0x32')]['sort']);_0x280436[_0xd049('0x3c')]=qs[_0xd049('0x3d')](_[_0xd049('0x3e')](_0x1b3f8b['query'],_0x46eb1f[_0xd049('0x3d')]),_0x5a9596);if(_0x1b3f8b[_0xd049('0x32')]['filter']){_0x280436['where']=_[_0xd049('0x3f')](_0x280436['where'],{'$or':_['map'](_0x5a9596,function(_0x348aac){if(_0x348aac[_0xd049('0x2e')]!==_0xd049('0x40')){var _0x53d8af={};_0x53d8af[_0x348aac[_0xd049('0x2b')]]={'$like':'%'+_0x1b3f8b[_0xd049('0x32')]['filter']+'%'};return _0x53d8af;}})});}_0x280436=_[_0xd049('0x3f')]({},_0x280436,_0x1b3f8b[_0xd049('0x41')]);var _0x1f6d7d={'where':_0x280436[_0xd049('0x3c')]};return db[_0xd049('0x42')][_0xd049('0x22')](_0x1f6d7d)[_0xd049('0x2a')](function(_0x4db973){_0xd7adf8[_0xd049('0x22')]=_0x4db973;if(_0x1b3f8b[_0xd049('0x32')][_0xd049('0x43')]){_0x280436[_0xd049('0x44')]=[{'all':!![]}];}return db[_0xd049('0x42')][_0xd049('0x45')](_0x280436);})[_0xd049('0x2a')](function(_0x406712){_0xd7adf8[_0xd049('0x46')]=_0x406712;return _0xd7adf8;})['then'](respondWithFilteredResult(_0x717c00,_0x280436))[_0xd049('0x47')](handleError(_0x717c00,null));};exports[_0xd049('0x48')]=function(_0x14b00b,_0x31b6f8){var _0x3df931={'raw':!![],'where':{'id':_0x14b00b['params']['id']}},_0x1e3f15={};_0x1e3f15['model']=_[_0xd049('0x33')](db['ChatGroup'][_0xd049('0x49')]);_0x1e3f15[_0xd049('0x32')]=_[_0xd049('0x33')](_0x14b00b[_0xd049('0x32')]);_0x1e3f15[_0xd049('0x3d')]=_[_0xd049('0x34')](_0x1e3f15[_0xd049('0x30')],_0x1e3f15[_0xd049('0x32')]);_0x3df931[_0xd049('0x35')]=_[_0xd049('0x34')](_0x1e3f15[_0xd049('0x30')],qs['fields'](_0x14b00b[_0xd049('0x32')]['fields']));_0x3df931[_0xd049('0x35')]=_0x3df931['attributes'][_0xd049('0x37')]?_0x3df931[_0xd049('0x35')]:_0x1e3f15[_0xd049('0x30')];if(_0x14b00b[_0xd049('0x32')][_0xd049('0x43')]){_0x3df931['include']=[{'all':!![]}];}_0x3df931=_['merge']({},_0x3df931,_0x14b00b[_0xd049('0x41')]);return db['ChatGroup'][_0xd049('0x4a')](_0x3df931)['then'](handleEntityNotFound(_0x31b6f8,null))['then'](respondWithResult(_0x31b6f8,null))[_0xd049('0x47')](handleError(_0x31b6f8,null));};exports[_0xd049('0x4b')]=function(_0x55ec08,_0x978fa4){return db[_0xd049('0x42')]['create'](_0x55ec08[_0xd049('0x4c')],{})['then'](respondWithResult(_0x978fa4,0xc9))[_0xd049('0x47')](handleError(_0x978fa4,null));};exports[_0xd049('0x29')]=function(_0x349b58,_0x1d9254){if(_0x349b58[_0xd049('0x4c')]['id']){delete _0x349b58[_0xd049('0x4c')]['id'];}return db['ChatGroup'][_0xd049('0x4a')]({'where':{'id':_0x349b58[_0xd049('0x4d')]['id']}})[_0xd049('0x2a')](handleEntityNotFound(_0x1d9254,null))[_0xd049('0x2a')](saveUpdates(_0x349b58[_0xd049('0x4c')],null))['then'](respondWithResult(_0x1d9254,null))[_0xd049('0x47')](handleError(_0x1d9254,null));};exports[_0xd049('0x4e')]=function(_0x230e94,_0x51af55){return db[_0xd049('0x42')]['find']({'where':{'id':_0x230e94[_0xd049('0x4d')]['id']}})[_0xd049('0x2a')](handleEntityNotFound(_0x51af55,null))[_0xd049('0x2a')](removeEntity(_0x51af55,null))[_0xd049('0x47')](handleError(_0x51af55,null));};exports['describe']=function(_0x421f2b,_0x171e46){return db[_0xd049('0x42')][_0xd049('0x4f')]()[_0xd049('0x2a')](respondWithResult(_0x171e46,null))[_0xd049('0x47')](handleError(_0x171e46,null));};exports[_0xd049('0x50')]=function(_0x10021f,_0x2249a0,_0x1abfce){return db[_0xd049('0x51')]['count']({'where':{'ChatGroupId':_0x10021f[_0xd049('0x4d')]['id'],'ToId':_0x10021f[_0xd049('0x52')]['id'],'read':![]}})[_0xd049('0x2a')](function(_0xcce276){return{'id':_[_0xd049('0x53')](_0x10021f[_0xd049('0x4d')]['id']),'count':_0xcce276};})['then'](respondWithResult(_0x2249a0,null))[_0xd049('0x47')](handleError(_0x2249a0,null));};exports['addMembers']=function(_0xb15f47,_0x43f8ac,_0x36e529){return db[_0xd049('0x42')][_0xd049('0x4a')]({'where':{'id':_0xb15f47[_0xd049('0x4d')]['id']}})['then'](handleEntityNotFound(_0x43f8ac,null))[_0xd049('0x2a')](function(_0x20319b){if(_0x20319b){return _0x20319b['addMembers'](_0xb15f47[_0xd049('0x4c')][_0xd049('0x54')],_[_0xd049('0x55')](_0xb15f47[_0xd049('0x4c')],[_0xd049('0x54'),'id'])||{});}})[_0xd049('0x2a')](respondWithResult(_0x43f8ac,null))[_0xd049('0x47')](handleError(_0x43f8ac,null));};exports['getMembers']=function(_0x372d8f,_0x33781a,_0x250ca6){var _0x3a4b0f={};var _0x22e083={};var _0x285fdb;var _0x5b3663;return db['ChatGroup'][_0xd049('0x56')]({'where':{'id':_0x372d8f[_0xd049('0x4d')]['id']}})[_0xd049('0x2a')](handleEntityNotFound(_0x33781a,null))[_0xd049('0x2a')](function(_0xccd771){if(_0xccd771){_0x285fdb=_0xccd771;_0x22e083['model']=_[_0xd049('0x33')](db[_0xd049('0x57')][_0xd049('0x49')]);_0x22e083[_0xd049('0x32')]=_[_0xd049('0x33')](_0x372d8f[_0xd049('0x32')]);_0x22e083[_0xd049('0x3d')]=_[_0xd049('0x34')](_0x22e083[_0xd049('0x30')],_0x22e083[_0xd049('0x32')]);_0x3a4b0f[_0xd049('0x35')]=_[_0xd049('0x34')](_0x22e083[_0xd049('0x30')],qs[_0xd049('0x36')](_0x372d8f[_0xd049('0x32')][_0xd049('0x36')]));_0x3a4b0f['attributes']=_0x3a4b0f[_0xd049('0x35')][_0xd049('0x37')]?_0x3a4b0f[_0xd049('0x35')]:_0x22e083[_0xd049('0x30')];_0x3a4b0f[_0xd049('0x3a')]=qs[_0xd049('0x3b')](_0x372d8f[_0xd049('0x32')][_0xd049('0x3b')]);_0x3a4b0f[_0xd049('0x3c')]=qs[_0xd049('0x3d')](_['pick'](_0x372d8f[_0xd049('0x32')],_0x22e083['filters']));if(_0x372d8f[_0xd049('0x32')][_0xd049('0x58')]){_0x3a4b0f[_0xd049('0x3c')]=_[_0xd049('0x3f')](_0x3a4b0f[_0xd049('0x3c')],{'$or':_[_0xd049('0x31')](_0x3a4b0f['attributes'],function(_0x4abe1d){var _0x315f1e={};_0x315f1e[_0x4abe1d]={'$like':'%'+_0x372d8f['query'][_0xd049('0x58')]+'%'};return _0x315f1e;})});}_0x3a4b0f=_[_0xd049('0x3f')]({},_0x3a4b0f,_0x372d8f[_0xd049('0x41')]);return _0x285fdb[_0xd049('0x59')](_0x3a4b0f);}})[_0xd049('0x2a')](function(_0x5e3337){if(_0x5e3337){_0x5b3663=_0x5e3337[_0xd049('0x37')];if(!_0x372d8f[_0xd049('0x32')]['hasOwnProperty'](_0xd049('0x39'))){_0x3a4b0f[_0xd049('0x23')]=qs['limit'](_0x372d8f[_0xd049('0x32')][_0xd049('0x23')]);_0x3a4b0f[_0xd049('0x20')]=qs[_0xd049('0x20')](_0x372d8f['query']['offset']);}return _0x285fdb['getMembers'](_0x3a4b0f);}})[_0xd049('0x2a')](function(_0x33b6c8){if(_0x33b6c8){return _0x33b6c8?{'count':_0x5b3663,'rows':_0x33b6c8}:null;}})[_0xd049('0x2a')](respondWithResult(_0x33781a,null))[_0xd049('0x47')](handleError(_0x33781a,null));};exports['removeMembers']=function(_0x569d75,_0x1763d7,_0x44d4c5){return db[_0xd049('0x42')][_0xd049('0x4a')]({'where':{'id':_0x569d75['params']['id']}})[_0xd049('0x2a')](handleEntityNotFound(_0x1763d7,null))[_0xd049('0x2a')](function(_0x3904af){if(_0x3904af){return _0x3904af['removeMembers'](_0x569d75[_0xd049('0x32')]['ids']);}})['then'](respondWithStatusCode(_0x1763d7,null))[_0xd049('0x47')](handleError(_0x1763d7,null));};exports[_0xd049('0x5a')]=function(_0x4a64f1,_0x11af7c,_0x524c77){if(_0x4a64f1['body']['id']){delete _0x4a64f1[_0xd049('0x4c')]['id'];}return db[_0xd049('0x42')][_0xd049('0x4a')]({'where':{'id':_0x4a64f1['params']['id']}})[_0xd049('0x2a')](handleEntityNotFound(_0x11af7c,null))[_0xd049('0x2a')](function(_0x573263){if(_0x573263){_0x4a64f1[_0xd049('0x4c')][_0xd049('0x5b')]=_0x573263['id'];return db[_0xd049('0x51')][_0xd049('0x4b')](_0x4a64f1[_0xd049('0x4c')]);}})[_0xd049('0x2a')](respondWithResult(_0x11af7c,null))['catch'](handleError(_0x11af7c,null));};exports[_0xd049('0x5c')]=function(_0x1a2f36,_0x49f7b3,_0x1dbb61){var _0x61565e={};var _0x98a5cf={};var _0x58288f;var _0x195233;return db[_0xd049('0x42')][_0xd049('0x56')]({'where':{'id':_0x1a2f36[_0xd049('0x4d')]['id']}})['then'](handleEntityNotFound(_0x49f7b3,null))[_0xd049('0x2a')](function(_0x7b34b8){if(_0x7b34b8){_0x58288f=_0x7b34b8;_0x98a5cf[_0xd049('0x30')]=_['keys'](db[_0xd049('0x51')][_0xd049('0x49')]);_0x98a5cf[_0xd049('0x32')]=_[_0xd049('0x33')](_0x1a2f36[_0xd049('0x32')]);_0x98a5cf[_0xd049('0x3d')]=_[_0xd049('0x34')](_0x98a5cf[_0xd049('0x30')],_0x98a5cf[_0xd049('0x32')]);_0x61565e[_0xd049('0x35')]=_[_0xd049('0x34')](_0x98a5cf[_0xd049('0x30')],qs[_0xd049('0x36')](_0x1a2f36[_0xd049('0x32')][_0xd049('0x36')]));_0x61565e[_0xd049('0x35')]=_0x61565e[_0xd049('0x35')]['length']?_0x61565e[_0xd049('0x35')]:_0x98a5cf[_0xd049('0x30')];_0x61565e[_0xd049('0x3a')]=qs[_0xd049('0x3b')](_0x1a2f36[_0xd049('0x32')]['sort']);_0x61565e[_0xd049('0x3c')]=qs['filters'](_[_0xd049('0x3e')](_0x1a2f36[_0xd049('0x32')],_0x98a5cf[_0xd049('0x3d')]));if(_0x1a2f36[_0xd049('0x32')]['filter']){_0x61565e[_0xd049('0x3c')]=_[_0xd049('0x3f')](_0x61565e[_0xd049('0x3c')],{'$or':_['map'](_0x61565e[_0xd049('0x35')],function(_0xc5b1ab){var _0x2287be={};_0x2287be[_0xc5b1ab]={'$like':'%'+_0x1a2f36['query'][_0xd049('0x58')]+'%'};return _0x2287be;})});}if(_0x1a2f36['query'][_0xd049('0x5d')]){var _0x1b15b0=_0x1a2f36[_0xd049('0x32')][_0xd049('0x5d')][_0xd049('0x5e')](',');var _0xdaf171={};_0xdaf171[_0x1b15b0[0x0]]={'$gte':moment(_0x1b15b0[0x1])[_0xd049('0x5f')](_0xd049('0x60'))};_0x61565e['where']=_[_0xd049('0x3f')](_0x61565e[_0xd049('0x3c')],_0xdaf171);}_0x61565e=_['merge']({},_0x61565e,_0x1a2f36[_0xd049('0x41')]);return _0x58288f[_0xd049('0x5c')](_0x61565e);}})['then'](function(_0x1d1fdb){if(_0x1d1fdb){_0x195233=_0x1d1fdb[_0xd049('0x37')];if(!_0x1a2f36[_0xd049('0x32')][_0xd049('0x38')](_0xd049('0x39'))){_0x61565e[_0xd049('0x23')]=qs[_0xd049('0x23')](_0x1a2f36['query'][_0xd049('0x23')]);_0x61565e[_0xd049('0x20')]=qs[_0xd049('0x20')](_0x1a2f36['query'][_0xd049('0x20')]);}return _0x58288f['getMessages'](_0x61565e);}})[_0xd049('0x2a')](function(_0x4dfcac){if(_0x4dfcac){return _0x4dfcac?{'count':_0x195233,'rows':_0x4dfcac}:null;}})[_0xd049('0x2a')](respondWithResult(_0x49f7b3,null))[_0xd049('0x47')](handleError(_0x49f7b3,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e544872..f73c2da 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 _0x4888=['emit','hasOwnProperty','hook','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x41013b,_0x428de5){var _0x3f9601=function(_0x8587d3){while(--_0x8587d3){_0x41013b['push'](_0x41013b['shift']());}};_0x3f9601(++_0x428de5);}(_0x4888,0x198));var _0x8488=function(_0x5350ec,_0x316fd1){_0x5350ec=_0x5350ec-0x0;var _0x47da97=_0x4888[_0x5350ec];return _0x47da97;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8488('0x2')](0x0);var events={'afterCreate':_0x8488('0x3'),'afterUpdate':_0x8488('0x4'),'afterDestroy':_0x8488('0x5')};function emitEvent(_0x19e51d){return function(_0x571e4b,_0x267093,_0xf45c3f){ChatGroupEvents[_0x8488('0x6')](_0x19e51d+':'+_0x571e4b['id'],_0x571e4b);ChatGroupEvents[_0x8488('0x6')](_0x19e51d,_0x571e4b);_0xf45c3f(null);};}for(var e in events){if(events[_0x8488('0x7')](e)){var event=events[e];ChatGroup[_0x8488('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x1a9b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','save'];(function(_0x5302c2,_0x172b86){var _0x46182c=function(_0x2cd650){while(--_0x2cd650){_0x5302c2['push'](_0x5302c2['shift']());}};_0x46182c(++_0x172b86);}(_0x1a9b,0xf6));var _0xb1a9=function(_0x108fea,_0x1d3617){_0x108fea=_0x108fea-0x0;var _0x499199=_0x1a9b[_0x108fea];return _0x499199;};'use strict';var EventEmitter=require(_0xb1a9('0x0'));var ChatGroup=require(_0xb1a9('0x1'))['db'][_0xb1a9('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb1a9('0x3'),'afterUpdate':_0xb1a9('0x4'),'afterDestroy':_0xb1a9('0x5')};function emitEvent(_0x16dab3){return function(_0x1b473a,_0x312774,_0x409e8c){ChatGroupEvents[_0xb1a9('0x6')](_0x16dab3+':'+_0x1b473a['id'],_0x1b473a);ChatGroupEvents['emit'](_0x16dab3,_0x1b473a);_0x409e8c(null);};}for(var e in events){if(events[_0xb1a9('0x7')](e)){var event=events[e];ChatGroup[_0xb1a9('0x8')](e,emitEvent(event));}}module[_0xb1a9('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f486a26..62939bd 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 _0x26f6=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x5dee43,_0x35aa9b){var _0x3bcfb0=function(_0x22dad2){while(--_0x22dad2){_0x5dee43['push'](_0x5dee43['shift']());}};_0x3bcfb0(++_0x35aa9b);}(_0x26f6,0xfd));var _0x626f=function(_0x4897ae,_0x574381){_0x4897ae=_0x4897ae-0x0;var _0x8f8f7c=_0x26f6[_0x4897ae];return _0x8f8f7c;};'use strict';var _=require(_0x626f('0x0'));var util=require(_0x626f('0x1'));var logger=require(_0x626f('0x2'))('api');var moment=require(_0x626f('0x3'));var BPromise=require(_0x626f('0x4'));var rp=require(_0x626f('0x5'));var fs=require('fs');var path=require(_0x626f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x626f('0x7'));module[_0x626f('0x8')]=function(_0x35bf4d,_0x581fee){return _0x35bf4d[_0x626f('0x9')](_0x626f('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe418=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xe418,0x155));var _0x8e41=function(_0x7b3f49,_0x59869f){_0x7b3f49=_0x7b3f49-0x0;var _0x34beb6=_0xe418[_0x7b3f49];return _0x34beb6;};'use strict';var _=require('lodash');var util=require(_0x8e41('0x0'));var logger=require(_0x8e41('0x1'))(_0x8e41('0x2'));var moment=require(_0x8e41('0x3'));var BPromise=require(_0x8e41('0x4'));var rp=require(_0x8e41('0x5'));var fs=require('fs');var path=require(_0x8e41('0x6'));var rimraf=require(_0x8e41('0x7'));var config=require('../../config/environment');var attributes=require(_0x8e41('0x8'));module[_0x8e41('0x9')]=function(_0x2ccf5c,_0x2effc2){return _0x2ccf5c[_0x8e41('0xa')]('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index aaa3c5b..01a58d5 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 _0x1353=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','then','info','request\x20sent','debug','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x578432,_0x3977e0){var _0x2ee8b3=function(_0x5acd9f){while(--_0x5acd9f){_0x578432['push'](_0x578432['shift']());}};_0x2ee8b3(++_0x3977e0);}(_0x1353,0xb3));var _0x3135=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x1353[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x3135('0x0'));var util=require(_0x3135('0x1'));var moment=require(_0x3135('0x2'));var BPromise=require(_0x3135('0x3'));var rs=require(_0x3135('0x4'));var fs=require('fs');var Redis=require(_0x3135('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3135('0x6'));var logger=require(_0x3135('0x7'))(_0x3135('0x8'));var config=require(_0x3135('0x9'));var jayson=require(_0x3135('0xa'));var client=jayson['client'][_0x3135('0xb')]({'port':0x232a});config[_0x3135('0xc')]=_['defaults'](config[_0x3135('0xc')],{'host':_0x3135('0xd'),'port':0x18eb});var socket=require(_0x3135('0xe'))(new Redis(config[_0x3135('0xc')]));require(_0x3135('0xf'))['register'](socket);function respondWithRpcPromise(_0xab9e19,_0x1c0a36,_0x22c939){return new BPromise(function(_0x249bf0,_0x3721de){return client['request'](_0xab9e19,_0x22c939)[_0x3135('0x10')](function(_0x499acd){logger[_0x3135('0x11')]('ChatGroup,\x20%s,\x20%s',_0x1c0a36,_0x3135('0x12'));logger[_0x3135('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1c0a36,_0x3135('0x12'),JSON['stringify'](_0x499acd));if(_0x499acd[_0x3135('0x14')]){if(_0x499acd[_0x3135('0x14')][_0x3135('0x15')]===0x1f4){logger['error'](_0x3135('0x16'),_0x1c0a36,_0x499acd['error']['message']);return _0x3721de(_0x499acd[_0x3135('0x14')][_0x3135('0x17')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x1c0a36,_0x499acd['error'][_0x3135('0x17')]);return _0x249bf0(_0x499acd[_0x3135('0x14')][_0x3135('0x17')]);}else{logger[_0x3135('0x11')]('ChatGroup,\x20%s,\x20%s',_0x1c0a36,_0x3135('0x12'));_0x249bf0(_0x499acd[_0x3135('0x18')][_0x3135('0x17')]);}})[_0x3135('0x19')](function(_0x67a9fb){logger[_0x3135('0x14')](_0x3135('0x16'),_0x1c0a36,_0x67a9fb);_0x3721de(_0x67a9fb);});});} \ No newline at end of file +var _0xf6d1=['ChatGroup,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x136cbb,_0x2a97f9){var _0x333a69=function(_0x5dc5bb){while(--_0x5dc5bb){_0x136cbb['push'](_0x136cbb['shift']());}};_0x333a69(++_0x2a97f9);}(_0xf6d1,0x99));var _0x1f6d=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xf6d1[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x1f6d('0x0'));var util=require(_0x1f6d('0x1'));var moment=require(_0x1f6d('0x2'));var BPromise=require(_0x1f6d('0x3'));var rs=require(_0x1f6d('0x4'));var fs=require('fs');var Redis=require(_0x1f6d('0x5'));var db=require(_0x1f6d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f6d('0x7'))('rpc');var config=require(_0x1f6d('0x8'));var jayson=require(_0x1f6d('0x9'));var client=jayson[_0x1f6d('0xa')][_0x1f6d('0xb')]({'port':0x232a});config[_0x1f6d('0xc')]=_[_0x1f6d('0xd')](config[_0x1f6d('0xc')],{'host':_0x1f6d('0xe'),'port':0x18eb});var socket=require(_0x1f6d('0xf'))(new Redis(config[_0x1f6d('0xc')]));require(_0x1f6d('0x10'))[_0x1f6d('0x11')](socket);function respondWithRpcPromise(_0x523958,_0x25ec55,_0x4f33bd){return new BPromise(function(_0x456882,_0x4aaba1){return client[_0x1f6d('0x12')](_0x523958,_0x4f33bd)[_0x1f6d('0x13')](function(_0x3d813c){logger[_0x1f6d('0x14')]('ChatGroup,\x20%s,\x20%s',_0x25ec55,'request\x20sent');logger[_0x1f6d('0x15')](_0x1f6d('0x16'),_0x25ec55,_0x1f6d('0x17'),JSON[_0x1f6d('0x18')](_0x3d813c));if(_0x3d813c[_0x1f6d('0x19')]){if(_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1a')]===0x1f4){logger[_0x1f6d('0x19')](_0x1f6d('0x1b'),_0x25ec55,_0x3d813c[_0x1f6d('0x19')]['message']);return _0x4aaba1(_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1c')]);}logger[_0x1f6d('0x19')]('ChatGroup,\x20%s,\x20%s',_0x25ec55,_0x3d813c[_0x1f6d('0x19')][_0x1f6d('0x1c')]);return _0x456882(_0x3d813c['error'][_0x1f6d('0x1c')]);}else{logger[_0x1f6d('0x14')](_0x1f6d('0x1b'),_0x25ec55,_0x1f6d('0x17'));_0x456882(_0x3d813c[_0x1f6d('0x1d')][_0x1f6d('0x1c')]);}})['catch'](function(_0x24c5b8){logger[_0x1f6d('0x19')](_0x1f6d('0x1b'),_0x25ec55,_0x24c5b8);_0x4aaba1(_0x24c5b8);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 122411f..2833183 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 _0x6476=['chatGroup:','save','update','emit','register','length'];(function(_0x5048f6,_0xf9eadc){var _0x4aa085=function(_0x414ecb){while(--_0x414ecb){_0x5048f6['push'](_0x5048f6['shift']());}};_0x4aa085(++_0xf9eadc);}(_0x6476,0x17b));var _0x6647=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x6476[_0x12d033];return _0x3b4e80;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x6647('0x0'),'remove',_0x6647('0x1')];function createListener(_0x2e6339,_0x4d2fe3){return function(_0x58e57e){_0x4d2fe3[_0x6647('0x2')](_0x2e6339,_0x58e57e);};}function removeListener(_0x1123e8,_0x30e24e){return function(){ChatGroupEvents['removeListener'](_0x1123e8,_0x30e24e);};}exports[_0x6647('0x3')]=function(_0x305d41){for(var _0x37a4b1=0x0,_0x554295=events[_0x6647('0x4')];_0x37a4b1<_0x554295;_0x37a4b1++){var _0x40d8fc=events[_0x37a4b1];var _0x5991df=createListener(_0x6647('0x5')+_0x40d8fc,_0x305d41);ChatGroupEvents['on'](_0x40d8fc,_0x5991df);}}; \ No newline at end of file +var _0x7aa1=['update','removeListener','register','chatGroup:','./chatGroup.events','save','remove'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x7aa1,0x12a));var _0x17aa=function(_0x5085de,_0x6e0678){_0x5085de=_0x5085de-0x0;var _0x52b6c3=_0x7aa1[_0x5085de];return _0x52b6c3;};'use strict';var ChatGroupEvents=require(_0x17aa('0x0'));var events=[_0x17aa('0x1'),_0x17aa('0x2'),_0x17aa('0x3')];function createListener(_0x4c4ad7,_0x425ea9){return function(_0x5bd760){_0x425ea9['emit'](_0x4c4ad7,_0x5bd760);};}function removeListener(_0x42855e,_0x2b4eb1){return function(){ChatGroupEvents[_0x17aa('0x4')](_0x42855e,_0x2b4eb1);};}exports[_0x17aa('0x5')]=function(_0x583219){for(var _0x4301d4=0x0,_0x32994b=events['length'];_0x4301d4<_0x32994b;_0x4301d4++){var _0xdcee76=events[_0x4301d4];var _0x1e2739=createListener(_0x17aa('0x6')+_0xdcee76,_0x583219);ChatGroupEvents['on'](_0xdcee76,_0x1e2739);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 0c22aeb..787b5e2 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 _0xcdde=['./chatGroup.controller','get','isAuthenticated','show','getUnread','/:id/members','/:id/messages','post','addMessage','/:id','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3a5259,_0x34c361){var _0x402adc=function(_0x3ebd28){while(--_0x3ebd28){_0x3a5259['push'](_0x3a5259['shift']());}};_0x402adc(++_0x34c361);}(_0xcdde,0x1a7));var _0xecdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdde[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xecdd('0x0'));var util=require(_0xecdd('0x1'));var path=require(_0xecdd('0x2'));var timeout=require(_0xecdd('0x3'));var express=require(_0xecdd('0x4'));var router=express['Router']();var fs_extra=require(_0xecdd('0x5'));var auth=require(_0xecdd('0x6'));var interaction=require(_0xecdd('0x7'));var config=require(_0xecdd('0x8'));var controller=require(_0xecdd('0x9'));router[_0xecdd('0xa')]('/',auth[_0xecdd('0xb')](),controller['index']);router[_0xecdd('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xecdd('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xecdd('0xc')]);router['get']('/:id/unread',auth[_0xecdd('0xb')](),controller[_0xecdd('0xd')]);router['get'](_0xecdd('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xecdd('0xa')](_0xecdd('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0xecdd('0x10')]('/',auth[_0xecdd('0xb')](),controller['create']);router[_0xecdd('0x10')](_0xecdd('0xe'),auth[_0xecdd('0xb')](),controller['addMembers']);router['post'](_0xecdd('0xf'),auth[_0xecdd('0xb')](),controller[_0xecdd('0x11')]);router['put'](_0xecdd('0x12'),auth['isAuthenticated'](),controller[_0xecdd('0x13')]);router[_0xecdd('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xecdd('0x15')]);router[_0xecdd('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0xecdd('0x16')]);module[_0xecdd('0x17')]=router; \ No newline at end of file +var _0x4973=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','/:id/members','/:id/messages','getMessages','post','create','addMembers','update','delete','destroy','removeMembers','exports','util','path'];(function(_0x480e73,_0x4fc890){var _0x4db556=function(_0x19df7b){while(--_0x19df7b){_0x480e73['push'](_0x480e73['shift']());}};_0x4db556(++_0x4fc890);}(_0x4973,0xbb));var _0x3497=function(_0xd22918,_0x1de1a1){_0xd22918=_0xd22918-0x0;var _0x30c9f9=_0x4973[_0xd22918];return _0x30c9f9;};'use strict';var multer=require('multer');var util=require(_0x3497('0x0'));var path=require(_0x3497('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3497('0x2')]();var fs_extra=require(_0x3497('0x3'));var auth=require(_0x3497('0x4'));var interaction=require(_0x3497('0x5'));var config=require(_0x3497('0x6'));var controller=require(_0x3497('0x7'));router[_0x3497('0x8')]('/',auth[_0x3497('0x9')](),controller[_0x3497('0xa')]);router[_0x3497('0x8')](_0x3497('0xb'),auth[_0x3497('0x9')](),controller[_0x3497('0xc')]);router[_0x3497('0x8')](_0x3497('0xd'),auth[_0x3497('0x9')](),controller[_0x3497('0xe')]);router[_0x3497('0x8')](_0x3497('0xf'),auth[_0x3497('0x9')](),controller['getUnread']);router['get'](_0x3497('0x10'),auth[_0x3497('0x9')](),controller['getMembers']);router[_0x3497('0x8')](_0x3497('0x11'),auth[_0x3497('0x9')](),controller[_0x3497('0x12')]);router[_0x3497('0x13')]('/',auth[_0x3497('0x9')](),controller[_0x3497('0x14')]);router['post'](_0x3497('0x10'),auth[_0x3497('0x9')](),controller[_0x3497('0x15')]);router[_0x3497('0x13')](_0x3497('0x11'),auth[_0x3497('0x9')](),controller['addMessage']);router['put'](_0x3497('0xd'),auth[_0x3497('0x9')](),controller[_0x3497('0x16')]);router[_0x3497('0x17')](_0x3497('0xd'),auth[_0x3497('0x9')](),controller[_0x3497('0x18')]);router[_0x3497('0x17')](_0x3497('0x10'),auth[_0x3497('0x9')](),controller[_0x3497('0x19')]);module[_0x3497('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 62858e2..6227887 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 _0xa9c6=['thumb','TEXT','STRING','DATE','long','out','sequelize','BOOLEAN','INTEGER','ENUM','star'];(function(_0xf19481,_0x175a45){var _0x32ffb9=function(_0x3a8fed){while(--_0x3a8fed){_0xf19481['push'](_0xf19481['shift']());}};_0x32ffb9(++_0x175a45);}(_0xa9c6,0x12f));var _0x6a9c=function(_0x17d5af,_0x2ef8a7){_0x17d5af=_0x17d5af-0x0;var _0x4363c8=_0xa9c6[_0x17d5af];return _0x4363c8;};'use strict';var Sequelize=require(_0x6a9c('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6a9c('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6a9c('0x2')]},'ratingType':{'type':Sequelize[_0x6a9c('0x3')](_0x6a9c('0x4'),_0x6a9c('0x5')),'defaultValue':_0x6a9c('0x4')},'ratingMessage':{'type':Sequelize[_0x6a9c('0x6')]},'pathTranscript':{'type':Sequelize[_0x6a9c('0x6')]},'mailTranscript':{'type':Sequelize[_0x6a9c('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6a9c('0x8')]},'disposition':{'type':Sequelize[_0x6a9c('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x6a9c('0x7')]},'osName':{'type':Sequelize[_0x6a9c('0x7')]},'osVersion':{'type':Sequelize[_0x6a9c('0x7')]},'deviceModel':{'type':Sequelize[_0x6a9c('0x7')]},'deviceVendor':{'type':Sequelize[_0x6a9c('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6a9c('0x6')]},'customerIp':{'type':Sequelize[_0x6a9c('0x7')]},'formData':{'type':Sequelize[_0x6a9c('0x6')](_0x6a9c('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x6a9c('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6a9c('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6a9c('0x7')]},'customerPort':{'type':Sequelize[_0x6a9c('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x6a9c('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x6a9c('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7b14=['TEXT','DATE','STRING','long','out','BOOLEAN','sequelize','exports','INTEGER','ENUM','star'];(function(_0x567a45,_0x2d70e6){var _0x8d4cc3=function(_0x20ccba){while(--_0x20ccba){_0x567a45['push'](_0x567a45['shift']());}};_0x8d4cc3(++_0x2d70e6);}(_0x7b14,0x171));var _0x47b1=function(_0x32b7b8,_0xc36409){_0x32b7b8=_0x32b7b8-0x0;var _0x3d381d=_0x7b14[_0x32b7b8];return _0x3d381d;};'use strict';var Sequelize=require(_0x47b1('0x0'));module[_0x47b1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x47b1('0x2')]},'ratingType':{'type':Sequelize[_0x47b1('0x3')](_0x47b1('0x4'),'thumb'),'defaultValue':_0x47b1('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x47b1('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x47b1('0x6')]},'disposition':{'type':Sequelize[_0x47b1('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x47b1('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x47b1('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x47b1('0x7')]},'osVersion':{'type':Sequelize[_0x47b1('0x7')]},'deviceModel':{'type':Sequelize[_0x47b1('0x7')]},'deviceVendor':{'type':Sequelize[_0x47b1('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x47b1('0x5')]},'customerIp':{'type':Sequelize[_0x47b1('0x7')]},'formData':{'type':Sequelize[_0x47b1('0x5')](_0x47b1('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x47b1('0x3')]('in',_0x47b1('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x47b1('0x7')]},'customerPort':{'type':Sequelize[_0x47b1('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x47b1('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x47b1('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x47b1('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 70d53bd..3abacc4 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 _0x0e42=['create','destroy','describe','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','vidaooTopic','follow','isNull','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','agentAlias','System','customer','%s%d','Visitor','ContactId','website_alias','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','push','rows','addTags','omit','spread','Tag','color','emit','removeTags','toString','files','server','transcript-%d-%s.zip','firstName','attachments','ChatWebsite','Account','Owner','get','mkdirSync','Chat','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','direction','lastName','read','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','json','update','name','send','render','merge','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','findAll','user','show','params','model','keys','ChatInteraction','filters','intersection','query','attributes','fields','length','includeAll','include','options','find'];(function(_0x1ed938,_0x3ee138){var _0x30b8a1=function(_0x4b7103){while(--_0x4b7103){_0x1ed938['push'](_0x1ed938['shift']());}};_0x30b8a1(++_0x3ee138);}(_0x0e42,0x14e));var _0x20e4=function(_0x14989b,_0xc4ae0){_0x14989b=_0x14989b-0x0;var _0x1c9f55=_0x0e42[_0x14989b];return _0x1c9f55;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x20e4('0x0'));var rp=require(_0x20e4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x20e4('0x2'));var path=require(_0x20e4('0x3'));var ejs=require(_0x20e4('0x4'));var fs=require('fs');var _=require(_0x20e4('0x5'));var Redis=require(_0x20e4('0x6'));var interaction=require(_0x20e4('0x7'));var qs=require(_0x20e4('0x8'));var pdf=require(_0x20e4('0x9'));var logger=require(_0x20e4('0xa'))(_0x20e4('0xb'));var config=require(_0x20e4('0xc'));var db=require(_0x20e4('0xd'))['db'];config['redis']=_[_0x20e4('0xe')](config[_0x20e4('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x20e4('0x10'))(new Redis(config[_0x20e4('0xf')]));require(_0x20e4('0x11'))['register'](socket);var jayson=require(_0x20e4('0x12'));var client=jayson[_0x20e4('0x13')][_0x20e4('0x14')]({'port':0x232b});var client9004=jayson[_0x20e4('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0xf6d6a9,_0x110f51,_0x487461,_0x202f17){return new BPromise(function(_0x15ad61,_0x5be9d5){var _0x1cbf48=_0x202f17||client;return _0x1cbf48['request'](_0xf6d6a9,_0x487461)[_0x20e4('0x15')](function(_0x185292){logger['info'](_0x20e4('0x16'),_0x110f51,_0x20e4('0x17'));logger[_0x20e4('0x18')](_0x20e4('0x19'),_0x110f51,_0x20e4('0x17'),JSON[_0x20e4('0x1a')](_0x185292));if(_0x185292[_0x20e4('0x1b')]){if(_0x185292[_0x20e4('0x1b')][_0x20e4('0x1c')]===0x1f4){logger[_0x20e4('0x1b')](_0x20e4('0x16'),_0x110f51,_0x185292[_0x20e4('0x1b')][_0x20e4('0x1d')]);return _0x5be9d5(_0x185292[_0x20e4('0x1b')][_0x20e4('0x1d')]);}logger[_0x20e4('0x1b')](_0x20e4('0x16'),_0x110f51,_0x185292[_0x20e4('0x1b')][_0x20e4('0x1d')]);return _0x15ad61(_0x185292['error']['message']);}else{logger[_0x20e4('0x1e')](_0x20e4('0x16'),_0x110f51,_0x20e4('0x17'));_0x15ad61(_0x185292[_0x20e4('0x1f')][_0x20e4('0x1d')]);}})[_0x20e4('0x20')](function(_0x3bba22){logger[_0x20e4('0x1b')](_0x20e4('0x16'),_0x110f51,_0x3bba22);_0x5be9d5(_0x3bba22);});});}function respondWithStatusCode(_0xddec2b,_0x1b29e3){_0x1b29e3=_0x1b29e3||0xcc;return function(_0x5d17dc){if(_0x5d17dc){return _0xddec2b[_0x20e4('0x21')](_0x1b29e3);}return _0xddec2b[_0x20e4('0x22')](_0x1b29e3)[_0x20e4('0x23')]();};}function respondWithResult(_0x55b72c,_0x34f0b5){_0x34f0b5=_0x34f0b5||0xc8;return function(_0x3179aa){if(_0x3179aa){return _0x55b72c['status'](_0x34f0b5)['json'](_0x3179aa);}};}function respondWithFilteredResult(_0x43dad0,_0x435512){return function(_0x5e43cd){if(_0x5e43cd){var _0x4713b8=typeof _0x435512[_0x20e4('0x24')]===_0x20e4('0x25')&&typeof _0x435512[_0x20e4('0x26')]==='undefined';var _0x4781f4=_0x5e43cd[_0x20e4('0x27')];var _0x4cc6d5=_0x4713b8?0x0:_0x435512[_0x20e4('0x24')];var _0x1f6606=_0x4713b8?_0x5e43cd[_0x20e4('0x27')]:_0x435512[_0x20e4('0x24')]+_0x435512[_0x20e4('0x26')];var _0x290a54;if(_0x1f6606>=_0x4781f4){_0x1f6606=_0x4781f4;_0x290a54=0xc8;}else{_0x290a54=0xce;}_0x43dad0[_0x20e4('0x22')](_0x290a54);return _0x43dad0['set']('Content-Range',_0x4cc6d5+'-'+_0x1f6606+'/'+_0x4781f4)[_0x20e4('0x28')](_0x5e43cd);}return null;};}function saveUpdates(_0x1cf996){return function(_0xf8adbf){if(_0xf8adbf){return _0xf8adbf[_0x20e4('0x29')](_0x1cf996)[_0x20e4('0x15')](function(_0x45276){return _0x45276;});}return null;};}function removeEntity(_0xb6535a){return function(_0x456821){if(_0x456821){return _0x456821['destroy']()[_0x20e4('0x15')](function(){_0xb6535a['status'](0xcc)[_0x20e4('0x23')]();});}};}function handleEntityNotFound(_0x59c991){return function(_0x24131f){if(!_0x24131f){_0x59c991['sendStatus'](0x194);}return _0x24131f;};}function handleError(_0x4abc43,_0x3dd2a6){_0x3dd2a6=_0x3dd2a6||0x1f4;return function(_0x347144){logger['error'](_0x347144['stack']);if(_0x347144[_0x20e4('0x2a')]){delete _0x347144[_0x20e4('0x2a')];}_0x4abc43[_0x20e4('0x22')](_0x3dd2a6)[_0x20e4('0x2b')](_0x347144);};}function getMustacheRender(_0x4b258b,_0x1b3080){return Mustache[_0x20e4('0x2c')](_0x4b258b,_[_0x20e4('0x2d')](_0x1b3080[_0x20e4('0x2e')],{'contact':_0x1b3080[_0x20e4('0x2f')],'message':_0x1b3080[_0x20e4('0x1d')],'agent':_0x1b3080[_0x20e4('0x30')],'interaction':_0x1b3080[_0x20e4('0x31')],'account':_0x1b3080[_0x20e4('0x32')]}))||'';}exports[_0x20e4('0x33')]=function(_0x3aeec5,_0x1f7726){var _0x4cd982={};var _0x5d1c11=_[_0x20e4('0x34')](db['ChatInteraction'][_0x20e4('0x35')],function(_0x1e7e0d){return{'name':_0x1e7e0d[_0x20e4('0x36')],'type':_0x1e7e0d[_0x20e4('0x37')][_0x20e4('0x38')]};});_0x4cd982=qs['getOptions'](_0x5d1c11,_0x3aeec5);return interaction[_0x20e4('0x39')]('chat',_0x3aeec5['query'],_0x3aeec5[_0x20e4('0x3a')],_0x4cd982,_0x5d1c11)[_0x20e4('0x15')](respondWithFilteredResult(_0x1f7726,_0x4cd982))['catch'](handleError(_0x1f7726,null));};exports[_0x20e4('0x3b')]=function(_0x572852,_0x4ee3a8){var _0x57d49c={'raw':![],'where':{'id':_0x572852[_0x20e4('0x3c')]['id']}},_0x35bfb4={};_0x35bfb4[_0x20e4('0x3d')]=_[_0x20e4('0x3e')](db[_0x20e4('0x3f')][_0x20e4('0x35')]);_0x35bfb4['query']=_[_0x20e4('0x3e')](_0x572852['query']);_0x35bfb4[_0x20e4('0x40')]=_[_0x20e4('0x41')](_0x35bfb4['model'],_0x35bfb4[_0x20e4('0x42')]);_0x57d49c[_0x20e4('0x43')]=_[_0x20e4('0x41')](_0x35bfb4[_0x20e4('0x3d')],qs[_0x20e4('0x44')](_0x572852[_0x20e4('0x42')][_0x20e4('0x44')]));_0x57d49c[_0x20e4('0x43')]=_0x57d49c[_0x20e4('0x43')][_0x20e4('0x45')]?_0x57d49c[_0x20e4('0x43')]:_0x35bfb4['model'];if(_0x572852['query'][_0x20e4('0x46')]){_0x57d49c[_0x20e4('0x47')]=[{'all':!![]}];}_0x57d49c=_[_0x20e4('0x2d')]({},_0x57d49c,_0x572852[_0x20e4('0x48')]);return db[_0x20e4('0x3f')][_0x20e4('0x49')](_0x57d49c)[_0x20e4('0x15')](handleEntityNotFound(_0x4ee3a8,null))[_0x20e4('0x15')](respondWithResult(_0x4ee3a8,null))[_0x20e4('0x20')](handleError(_0x4ee3a8,null));};exports[_0x20e4('0x4a')]=function(_0x580d5c,_0x44b281){return db[_0x20e4('0x3f')][_0x20e4('0x4a')](_0x580d5c[_0x20e4('0x2e')],{})[_0x20e4('0x15')](respondWithResult(_0x44b281,0xc9))[_0x20e4('0x20')](handleError(_0x44b281,null));};exports['update']=function(_0x412be1,_0x248394){if(_0x412be1['body']['id']){delete _0x412be1[_0x20e4('0x2e')]['id'];}return db['ChatInteraction'][_0x20e4('0x49')]({'where':{'id':_0x412be1[_0x20e4('0x3c')]['id']}})['then'](handleEntityNotFound(_0x248394,null))['then'](saveUpdates(_0x412be1[_0x20e4('0x2e')],null))[_0x20e4('0x15')](respondWithResult(_0x248394,null))[_0x20e4('0x20')](handleError(_0x248394,null));};exports[_0x20e4('0x4b')]=function(_0x33bd67,_0x5bca1c){return db[_0x20e4('0x3f')][_0x20e4('0x49')]({'where':{'id':_0x33bd67[_0x20e4('0x3c')]['id']}})[_0x20e4('0x15')](handleEntityNotFound(_0x5bca1c,null))['then'](removeEntity(_0x5bca1c,null))[_0x20e4('0x20')](handleError(_0x5bca1c,null));};exports['describe']=function(_0x2eac7a,_0x413708){return db[_0x20e4('0x3f')][_0x20e4('0x4c')]()[_0x20e4('0x15')](respondWithResult(_0x413708,null))[_0x20e4('0x20')](handleError(_0x413708,null));};exports['createVidaooSession']=function(_0x39434c,_0x3c7ffb){var _0x419be2=_0x39434c['params']['id'];var _0x3d01a4;var _0x537bbb;var _0xb20207;return db[_0x20e4('0x3f')][_0x20e4('0x4d')]({'where':{'id':_0x419be2}})[_0x20e4('0x15')](function(_0x3864dd){_0x3d01a4=_0x3864dd;return db['ChatWebsite'][_0x20e4('0x4d')]({'where':{'id':_0x3864dd[_0x20e4('0x4e')]},'attributes':['id',_0x20e4('0x4f'),_0x20e4('0x50'),'vidaooTopic',_0x20e4('0x51'),_0x20e4('0x52')],'raw':!![]});})[_0x20e4('0x15')](function(_0x18fbbe){if(_0x18fbbe&&_0x18fbbe[_0x20e4('0x4f')]&&_0x18fbbe[_0x20e4('0x50')]){_0x537bbb=_0x18fbbe;var _0x13034c={'interaction':{'id':_0x419be2},'agent':{'id':_0x39434c[_0x20e4('0x3a')]['id'],'name':_0x39434c[_0x20e4('0x3a')][_0x20e4('0x2a')],'fullname':_0x39434c[_0x20e4('0x3a')][_0x20e4('0x53')],'email':_0x39434c[_0x20e4('0x3a')][_0x20e4('0x54')]},'contact':_0x39434c[_0x20e4('0x2e')]['contact'],'account':_0x39434c[_0x20e4('0x2e')][_0x20e4('0x32')]};var _0x404e69={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x18fbbe[_0x20e4('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x39434c[_0x20e4('0x3a')][_0x20e4('0x54')]],'buttons':null,'topic':_0x537bbb[_0x20e4('0x55')],'note':_['isNull'](_0x537bbb['vidaooNote'])?null:getMustacheRender(_0x537bbb['vidaooNote'],_0x13034c),'metadata':null},'redirect':_0x20e4('0x56'),'json':!![]};try{if(!_[_0x20e4('0x57')](_0x537bbb[_0x20e4('0x52')])){var _0x5029fc=getMustacheRender(_0x537bbb['vidaooMetadata'],_0x13034c);var _0x1e4332=JSON[_0x20e4('0x58')](_0x5029fc);_0x404e69['body']['metadata']=_0x1e4332;}}catch(_0x11a5a5){throw new db[(_0x20e4('0x59'))][(_0x20e4('0x5a'))](_0x20e4('0x5b'));}return rp(_0x404e69);}else{throw new db[(_0x20e4('0x59'))][(_0x20e4('0x5a'))](_0x20e4('0x5c'));}})[_0x20e4('0x15')](function(_0x5ba9e3){_0xb20207=_0x5ba9e3;if(_0xb20207['id']){var _0x477162={'body':_0xb20207[_0x20e4('0x5d')],'ChatWebsiteId':_0x537bbb['id'],'ChatInteractionId':_0x3d01a4['id'],'direction':_0x20e4('0x5e'),'UserId':_0x39434c[_0x20e4('0x3a')]['id']};return db[_0x20e4('0x5f')]['create'](_0x477162,{});}else{throw new db['Sequelize'][(_0x20e4('0x5a'))](_0x20e4('0x60'));}})['then'](function(){return _0x3d01a4[_0x20e4('0x61')]({'vidaooSessionId':_0xb20207['id']});})[_0x20e4('0x15')](respondWithResult(_0x3c7ffb,null))[_0x20e4('0x20')](handleError(_0x3c7ffb,null));};exports['customUpdate']=function(_0x5def37,_0x1856ce){if(_0x5def37[_0x20e4('0x2e')]['id']){delete _0x5def37[_0x20e4('0x2e')]['id'];}return db[_0x20e4('0x3f')][_0x20e4('0x49')]({'where':{'id':_0x5def37[_0x20e4('0x3c')]['id']},'include':[{'model':db['CmContact'],'as':_0x20e4('0x62')}]})[_0x20e4('0x15')](handleEntityNotFound(_0x1856ce,null))[_0x20e4('0x15')](saveUpdates(_0x5def37[_0x20e4('0x2e')],null))['then'](respondWithResult(_0x1856ce,null))[_0x20e4('0x20')](handleError(_0x1856ce,null));};exports['abandon']=function(_0x5090f7,_0x591705){if(_0x5090f7[_0x20e4('0x2e')]['id']){delete _0x5090f7[_0x20e4('0x2e')]['id'];}return db['ChatInteraction'][_0x20e4('0x49')]({'where':{'id':_0x5090f7['params']['id']}})[_0x20e4('0x15')](function(_0x462005){if(!_0x462005){logger[_0x20e4('0x1b')](_0x20e4('0x63'),'abandon',0x194,_0x20e4('0x64'));_0x591705[_0x20e4('0x21')](0x194);}else{if(_0x462005[_0x20e4('0x65')]){throw new db[(_0x20e4('0x59'))][(_0x20e4('0x5a'))]('Interaction\x20already\x20assigned');}}return _0x462005;})[_0x20e4('0x15')](function(_0x4e62b6){if(_0x4e62b6){return _0x4e62b6[_0x20e4('0x29')]({'closed':_0x5090f7['body'][_0x20e4('0x66')],'disposition':_0x5090f7['body'][_0x20e4('0x67')]})[_0x20e4('0x15')](function(_0x3f25d9){return _0x3f25d9;});}})[_0x20e4('0x15')](function(){return respondWithRpcPromise(_0x20e4('0x68'),_0x20e4('0x69'),_0x5090f7[_0x20e4('0x2e')],client9004);})[_0x20e4('0x15')](respondWithResult(_0x591705,null))[_0x20e4('0x20')](handleError(_0x591705,null));};exports[_0x20e4('0x6a')]=function(_0x10b27b,_0x22e38c){_0x10b27b[_0x20e4('0x2e')][_0x20e4('0x2a')]=_0x10b27b[_0x20e4('0x6b')][_0x20e4('0x6c')];_0x10b27b['body'][_0x20e4('0x6d')]=_0x10b27b['file']['filename'];_0x10b27b['body'][_0x20e4('0x37')]=_0x10b27b[_0x20e4('0x6b')][_0x20e4('0x6e')];return db[_0x20e4('0x6f')][_0x20e4('0x4a')](_0x10b27b[_0x20e4('0x2e')])[_0x20e4('0x15')](respondWithResult(_0x22e38c,0xc9))[_0x20e4('0x20')](handleError(_0x22e38c,null));};exports[_0x20e4('0x70')]=function(_0x17d0c5,_0x2d7f94){return db[_0x20e4('0x3f')][_0x20e4('0x4d')]({'where':{'id':_0x17d0c5['params']['id']},'raw':!![]})[_0x20e4('0x15')](handleEntityNotFound(_0x2d7f94,null))[_0x20e4('0x15')](function(_0x1fc07c){if(_0x1fc07c){if(_0x1fc07c[_0x20e4('0x66')]){return _0x2d7f94[_0x20e4('0x22')](0x193)['json']({'status':0x193,'message':_0x20e4('0x71')});}return db[_0x20e4('0x6f')]['findOne']({'where':{'id':_0x17d0c5[_0x20e4('0x42')][_0x20e4('0x72')]},'raw':!![]})[_0x20e4('0x15')](handleEntityNotFound(_0x2d7f94,null));}})[_0x20e4('0x15')](function(_0x2ce824){if(_0x2ce824){var _0x30597d=_0x2ce824[_0x20e4('0x73')]!==null;var _0x4f3935=path[_0x20e4('0x74')](config[_0x20e4('0x75')],_0x20e4('0x76'));if(_0x30597d){_0x4f3935=path['join'](_0x4f3935,_0x20e4('0x77'));}var _0x5a239a=path[_0x20e4('0x74')](_0x4f3935,_0x2ce824['basename']);return _0x2d7f94[_0x20e4('0x78')](_0x5a239a);}})[_0x20e4('0x20')](handleError(_0x2d7f94,null));};exports['close']=function(_0x1186b2,_0x159c3e){var _0xef777e=null;var _0x43c1c6=null;var _0x4a711d=null;if(_0x1186b2[_0x20e4('0x2e')]['id']){delete _0x1186b2[_0x20e4('0x2e')]['id'];}if(_0x1186b2['body'][_0x20e4('0x79')]){_0x4a711d=path[_0x20e4('0x74')](config[_0x20e4('0x75')],_0x20e4('0x7a'),util[_0x20e4('0x7b')](_0x20e4('0x7c'),Date[_0x20e4('0x7d')]()));_0x1186b2[_0x20e4('0x2e')][_0x20e4('0x7e')]=_0x4a711d;}return db['ChatInteraction'][_0x20e4('0x49')]({'where':{'id':_0x1186b2[_0x20e4('0x3c')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x20e4('0x7f'),'include':[{'model':db[_0x20e4('0x80')],'as':_0x20e4('0x80')}]}]})[_0x20e4('0x15')](handleEntityNotFound(_0x159c3e,null))[_0x20e4('0x15')](saveUpdates(_0x1186b2[_0x20e4('0x2e')],null))[_0x20e4('0x15')](function(_0x293710){if(_0x293710){_0xef777e=_0x293710;return db['ChatWebsite'][_0x20e4('0x49')]({'where':{'id':_0xef777e['ChatWebsiteId']}});}})[_0x20e4('0x15')](function(_0x12ffcf){if(_0x12ffcf){_0x43c1c6=_0x12ffcf;return db[_0x20e4('0x81')][_0x20e4('0x49')]({'where':{'id':_0xef777e['ContactId']}});}})['then'](function(_0x3cffb1){if(_0x3cffb1){if(_0x4a711d){var _0x3dff75=null;for(var _0x303d15=0x1;_0x303d15<_0xef777e[_0x20e4('0x7f')]['length'];++_0x303d15){_0x3dff75=_0xef777e['Messages'][_0x303d15];var _0x4bd331=_0x3dff75[_0x20e4('0x65')]?util[_0x20e4('0x7b')]('%s%d',_0x43c1c6[_0x20e4('0x82')],_0x3dff75[_0x20e4('0x65')]):_0x20e4('0x83');var _0x5cf134=_0x1186b2[_0x20e4('0x2e')][_0x20e4('0x84')]||util[_0x20e4('0x7b')](_0x20e4('0x85'),_0x20e4('0x86'),_0x3dff75[_0x20e4('0x87')]);switch(_0x43c1c6['agentIdentifier']){case _0x20e4('0x88'):_0x4bd331=_0x3dff75[_0x20e4('0x65')]?util[_0x20e4('0x7b')](_0x20e4('0x85'),_0x43c1c6[_0x20e4('0x82')],_0x3dff75[_0x20e4('0x65')]):_0x20e4('0x83');break;case'agent_alias':_0x4bd331=_0x3dff75['UserId']?_0x3dff75[_0x20e4('0x80')][_0x20e4('0x89')]||_0x3dff75[_0x20e4('0x80')]['fullname']:_0x20e4('0x83');break;case _0x20e4('0x8a'):_0x4bd331=_0x3dff75['UserId']?_0x3dff75[_0x20e4('0x80')][_0x20e4('0x53')]:_0x20e4('0x83');break;default:_0x4bd331=_0x3dff75[_0x20e4('0x65')]?util[_0x20e4('0x7b')](_0x20e4('0x85'),_0x43c1c6['agentAlias'],_0x3dff75['UserId']):_0x20e4('0x83');}var _0x1abbaf=util[_0x20e4('0x7b')]('[%s]\x20%s:\x20%s\x0a',moment(_0x3dff75[_0x20e4('0x8b')])['format'](_0x20e4('0x8c')),_0x3dff75['direction']==='in'?_0x5cf134:_0x4bd331,_0x3dff75[_0x20e4('0x2e')]);if(!_0x3dff75[_0x20e4('0x8d')]){fs[_0x20e4('0x8e')](_0x4a711d,_0x1abbaf);}}return db['MailAccount'][_0x20e4('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x20e4('0x8f')],'as':_0x20e4('0x90'),'raw':!![],'include':[{'model':db[_0x20e4('0x91')],'as':_0x20e4('0x91'),'raw':!![]}]}]});}}})['then'](function(_0x12a861){if(!_0x12a861||!_0x12a861['Smtp']||!_0x1186b2[_0x20e4('0x2e')])return _0xef777e;var _0x147bda=_0x12a861[_0x20e4('0x92')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x147bda,'message':{'from':util[_0x20e4('0x7b')](_0x20e4('0x93'),_0x12a861[_0x20e4('0x2a')],_0x12a861[_0x20e4('0x54')]||_0x12a861[_0x20e4('0x90')]['user']),'to':_0x1186b2[_0x20e4('0x2e')][_0x20e4('0x79')],'subject':_0x20e4('0x94'),'text':util[_0x20e4('0x7b')](_0x20e4('0x95'),_0x1186b2[_0x20e4('0x2e')][_0x20e4('0x79')]),'attachments':[{'path':_0x4a711d}]}})['then'](function(){return _0xef777e;})[_0x20e4('0x20')](function(_0x3f6872){logger[_0x20e4('0x1b')](_0x3f6872);});})[_0x20e4('0x15')](respondWithStatusCode(_0x159c3e,0xc8))[_0x20e4('0x20')](handleError(_0x159c3e,null));};exports[_0x20e4('0x96')]=function(_0x3772a4,_0x6d2f3c){return db[_0x20e4('0x5f')][_0x20e4('0x49')]({'where':{'id':_0x3772a4['params']['id']}})[_0x20e4('0x15')](handleEntityNotFound(_0x6d2f3c,null))[_0x20e4('0x15')](function(_0x47e2de){if(_0x47e2de){return _0x47e2de[_0x20e4('0x96')](_0x3772a4['body'][_0x20e4('0x97')],_['omit'](_0x3772a4[_0x20e4('0x2e')],[_0x20e4('0x97'),'id'])||{});}})[_0x20e4('0x15')](respondWithResult(_0x6d2f3c,null))['catch'](handleError(_0x6d2f3c,null));};exports[_0x20e4('0x98')]=function(_0x28b358,_0x7f2445){var _0x153539={'raw':![],'where':{}};var _0x4a196c={};var _0x32d4f7={'count':0x0,'rows':[]};return db[_0x20e4('0x3f')][_0x20e4('0x4d')]({'where':{'id':_0x28b358[_0x20e4('0x3c')]['id']}})[_0x20e4('0x15')](handleEntityNotFound(_0x7f2445,null))[_0x20e4('0x15')](function(_0x5157cd){if(_0x5157cd){_0x4a196c[_0x20e4('0x3d')]=_['keys'](db[_0x20e4('0x5f')][_0x20e4('0x35')]);_0x4a196c[_0x20e4('0x42')]=_[_0x20e4('0x3e')](_0x28b358[_0x20e4('0x42')]);_0x4a196c[_0x20e4('0x40')]=_[_0x20e4('0x41')](_0x4a196c[_0x20e4('0x3d')],_0x4a196c[_0x20e4('0x42')]);_0x153539['attributes']=_[_0x20e4('0x41')](_0x4a196c[_0x20e4('0x3d')],qs[_0x20e4('0x44')](_0x28b358[_0x20e4('0x42')][_0x20e4('0x44')]));_0x153539[_0x20e4('0x43')]=_0x153539['attributes'][_0x20e4('0x45')]?_0x153539[_0x20e4('0x43')]:_0x4a196c['model'];if(!_0x28b358[_0x20e4('0x42')][_0x20e4('0x99')](_0x20e4('0x9a'))){_0x153539['limit']=qs['limit'](_0x28b358[_0x20e4('0x42')][_0x20e4('0x26')]);_0x153539[_0x20e4('0x24')]=qs[_0x20e4('0x24')](_0x28b358[_0x20e4('0x42')][_0x20e4('0x24')]);}_0x153539[_0x20e4('0x9b')]=qs['sort'](_0x28b358[_0x20e4('0x42')][_0x20e4('0x9c')]);_0x153539[_0x20e4('0x9d')]=qs[_0x20e4('0x40')](_[_0x20e4('0x9e')](_0x28b358[_0x20e4('0x42')],_0x4a196c['filters']));_0x153539['where'][_0x20e4('0x9f')]=_0x5157cd['id'];if(_0x28b358[_0x20e4('0x42')][_0x20e4('0xa0')]){_0x153539[_0x20e4('0x9d')]=_[_0x20e4('0x2d')](_0x153539['where'],{'$or':_[_0x20e4('0x34')](_0x153539[_0x20e4('0x43')],function(_0x268ffd){var _0x3e76b9={};_0x3e76b9[_0x268ffd]={'$like':'%'+_0x28b358['query']['filter']+'%'};return _0x3e76b9;})});}if(_0x28b358[_0x20e4('0x42')][_0x20e4('0xa1')]){var _0x368a28=_0x28b358[_0x20e4('0x42')][_0x20e4('0xa1')][_0x20e4('0xa2')](',');var _0x53520f={};_0x53520f[_0x368a28[0x0]]={'$gte':moment(_0x368a28[0x1])[_0x20e4('0x7b')](_0x20e4('0xa3'))};_0x153539[_0x20e4('0x9d')]=_[_0x20e4('0x2d')](_0x153539['where'],_0x53520f);}_0x153539=_[_0x20e4('0x2d')]({},_0x153539,_0x28b358[_0x20e4('0x48')]);return db[_0x20e4('0x5f')][_0x20e4('0x27')]({'where':_0x153539[_0x20e4('0x9d')]})[_0x20e4('0x15')](function(_0x5ee5ed){_0x32d4f7[_0x20e4('0x27')]=_0x5ee5ed;if(_0x28b358[_0x20e4('0x42')]['includeAll']){_0x153539['include']=[{'all':!![]}];}return db[_0x20e4('0x5f')]['findAll'](_0x153539);})[_0x20e4('0x15')](function(_0x4177be){_0x32d4f7['rows']=_0x4177be;return _0x32d4f7;});}})['then'](respondWithFilteredResult(_0x7f2445,_0x153539))['catch'](handleError(_0x7f2445,null));};exports[_0x20e4('0xa4')]=function(_0x28b305,_0x880704){var _0xfb5f24={'where':{}},_0x9f9772={},_0x38ad8d={'count':0x0,'rows':[]};return db[_0x20e4('0x3f')]['findOne']({'where':{'id':_0x28b305['params']['id']}})[_0x20e4('0x15')](handleEntityNotFound(_0x880704,null))[_0x20e4('0x15')](function(_0x1b1a0e){if(_0x1b1a0e){_0x9f9772[_0x20e4('0x3d')]=_['keys'](db[_0x20e4('0x5f')]['rawAttributes']);_0x9f9772[_0x20e4('0x42')]=_[_0x20e4('0x3e')](_0x28b305[_0x20e4('0x42')]);_0x9f9772[_0x20e4('0x40')]=_[_0x20e4('0x41')](_0x9f9772[_0x20e4('0x3d')],_0x9f9772['query']);_0xfb5f24[_0x20e4('0x43')]=_[_0x20e4('0x41')](_0x9f9772[_0x20e4('0x3d')],qs[_0x20e4('0x44')](_0x28b305[_0x20e4('0x42')][_0x20e4('0x44')]));_0xfb5f24[_0x20e4('0x43')]=_0xfb5f24[_0x20e4('0x43')][_0x20e4('0x45')]?_0xfb5f24['attributes']:_0x9f9772[_0x20e4('0x3d')];if(!_0x28b305['query'][_0x20e4('0x99')](_0x20e4('0x9a'))){_0xfb5f24['limit']=qs[_0x20e4('0x26')](_0x28b305[_0x20e4('0x42')]['limit']);_0xfb5f24['offset']=qs[_0x20e4('0x24')](_0x28b305[_0x20e4('0x42')]['offset']);}_0xfb5f24[_0x20e4('0x9b')]=qs[_0x20e4('0x9c')](_0x28b305[_0x20e4('0x42')][_0x20e4('0x9c')]);_0xfb5f24['where']=qs[_0x20e4('0x40')](_[_0x20e4('0x9e')](_0x28b305[_0x20e4('0x42')],_0x9f9772[_0x20e4('0x40')]));_0xfb5f24[_0x20e4('0x9d')][_0x20e4('0x9f')]=_0x1b1a0e['id'];if(_0x28b305[_0x20e4('0x42')]['filter']){_0xfb5f24[_0x20e4('0x9d')]=_[_0x20e4('0x2d')](_0xfb5f24[_0x20e4('0x9d')],{'$or':_[_0x20e4('0x34')](_0xfb5f24[_0x20e4('0x43')],function(_0x52f208){var _0x408b95={};_0x408b95[_0x52f208]={'$like':'%'+_0x28b305[_0x20e4('0x42')]['filter']+'%'};return _0x408b95;})});}_0xfb5f24['where'][_0x20e4('0x8d')]=![];if(_0x28b305[_0x20e4('0x42')]['id']){_0xfb5f24['where']['id']={'$gt':_0x28b305[_0x20e4('0x42')]['id']};}_0xfb5f24=_[_0x20e4('0x2d')]({},_0xfb5f24,_0x28b305[_0x20e4('0x48')]);return db[_0x20e4('0x5f')][_0x20e4('0x27')]({'where':_0xfb5f24['where']})[_0x20e4('0x15')](function(_0x21c583){_0x38ad8d['count']=_0x21c583;_0xfb5f24['include']=[];if(_0x28b305[_0x20e4('0x42')]['includeAgent']){_0xfb5f24[_0x20e4('0x47')][_0x20e4('0xa5')]({'model':db[_0x20e4('0x80')],'as':_0x20e4('0x80'),'attributes':['id','fullname',_0x20e4('0x89')]});}if(_0x28b305[_0x20e4('0x42')][_0x20e4('0x46')]){_0xfb5f24[_0x20e4('0x47')]=[{'all':!![]}];}return db[_0x20e4('0x5f')]['findAll'](_0xfb5f24);})[_0x20e4('0x15')](function(_0xfc88fc){_0x38ad8d[_0x20e4('0xa6')]=_0xfc88fc;return _0x38ad8d;});}})[_0x20e4('0x15')](respondWithFilteredResult(_0x880704,_0xfb5f24))[_0x20e4('0x20')](handleError(_0x880704,null));};exports[_0x20e4('0xa7')]=function(_0x23a920,_0x3ad567){return db[_0x20e4('0x3f')][_0x20e4('0x49')]({'where':{'id':_0x23a920[_0x20e4('0x3c')]['id']}})[_0x20e4('0x15')](handleEntityNotFound(_0x3ad567,null))['then'](function(_0x5cda52){if(_0x5cda52){return _0x5cda52['setTags'](_0x23a920[_0x20e4('0x2e')]['ids'],_[_0x20e4('0xa8')](_0x23a920[_0x20e4('0x2e')],[_0x20e4('0x97'),'id'])||{})[_0x20e4('0xa9')](function(){return db[_0x20e4('0xaa')][_0x20e4('0x39')]({'attributes':['id',_0x20e4('0x2a'),_0x20e4('0xab')],'where':{'id':_0x23a920[_0x20e4('0x2e')][_0x20e4('0x97')]}});})[_0x20e4('0x15')](function(_0x33e1eb){socket[_0x20e4('0xac')]('chatInteractionTags:save',{'id':Number(_0x23a920[_0x20e4('0x3c')]['id']),'tags':_0x33e1eb||[]});return{'id':Number(_0x23a920[_0x20e4('0x3c')]['id']),'tags':_0x33e1eb||[]};});}})[_0x20e4('0x15')](respondWithResult(_0x3ad567,null))[_0x20e4('0x20')](handleError(_0x3ad567,null));};exports[_0x20e4('0xad')]=function(_0xe9a5de,_0x38dcd7){return db['ChatInteraction'][_0x20e4('0x49')]({'where':{'id':_0xe9a5de['params']['id']}})['then'](handleEntityNotFound(_0x38dcd7,null))[_0x20e4('0x15')](function(_0x33712b){if(_0x33712b){return _0x33712b[_0x20e4('0xad')](_0xe9a5de[_0x20e4('0x42')]['ids']);}})[_0x20e4('0x15')](respondWithStatusCode(_0x38dcd7,null))[_0x20e4('0x20')](handleError(_0x38dcd7,null));};exports[_0x20e4('0x78')]=function(_0x5985a7,_0x36b332){var _0xe45735=moment()['unix']()[_0x20e4('0xae')]();var _0x520ebf=path[_0x20e4('0x74')](config[_0x20e4('0x75')],'server',_0x20e4('0xaf'),'tmp');var _0x1baceb=path[_0x20e4('0x74')](config[_0x20e4('0x75')],_0x20e4('0xb0'),_0x20e4('0xaf'),'attachments');var _0xba5e76=path[_0x20e4('0x74')](_0x520ebf,_0xe45735);var _0x492287=util[_0x20e4('0x7b')](_0x20e4('0xb1'),_0x5985a7[_0x20e4('0x3c')]['id'],_0xe45735);var _0x413ec8=path[_0x20e4('0x74')](_0x520ebf,_0x492287);var _0xcddf31=[];_0xcddf31['push']({'model':db['User'],'as':_0x20e4('0x80'),'attributes':['id',_0x20e4('0x53')],'raw':!![]});_0xcddf31[_0x20e4('0xa5')]({'model':db['CmContact'],'as':_0x20e4('0x62'),'attributes':['id',_0x20e4('0xb2'),'lastName'],'raw':!![]});if(_0x5985a7['query'][_0x20e4('0xb3')]){_0xcddf31[_0x20e4('0xa5')]({'model':db[_0x20e4('0x6f')],'as':'Attachment','raw':!![]});}var _0x20b1fd=[{'model':db[_0x20e4('0x5f')],'as':_0x20e4('0x7f'),'attributes':['id',_0x20e4('0x2e'),_0x20e4('0x8b'),'direction',_0x20e4('0x8d'),'read'],'include':_0xcddf31}];_0x20b1fd[_0x20e4('0xa5')]({'model':db[_0x20e4('0xb4')],'as':_0x20e4('0xb5'),'attributes':['id',_0x20e4('0x2a')]});_0x20b1fd[_0x20e4('0xa5')]({'model':db[_0x20e4('0x80')],'as':_0x20e4('0xb6'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x20e4('0x49')]({'where':{'id':_0x5985a7[_0x20e4('0x3c')]['id']},'include':_0x20b1fd})[_0x20e4('0x15')](handleEntityNotFound(_0x36b332,null))[_0x20e4('0x15')](function(_0x2ac219){if(_0x2ac219){var _0xc052e=_0x2ac219[_0x20e4('0xb7')]({'plain':!![]});fs[_0x20e4('0xb8')](_0xba5e76);var _0x40d6e8={'channel':_0x20e4('0xb9'),'account':_0xc052e['Account']['name'],'agent':_0xc052e[_0x20e4('0xb6')]?_0xc052e[_0x20e4('0xb6')][_0x20e4('0x53')]:'N.A.','createdAt':moment(_0xc052e[_0x20e4('0x8b')])[_0x20e4('0x7b')](_0x20e4('0xa3'))[_0x20e4('0xae')](),'closedAt':_0xc052e[_0x20e4('0x66')]?moment(_0xc052e['closedAt'])[_0x20e4('0x7b')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0xc052e['disposition'],'chatInfo':{'browser':_0xc052e['browserName'],'os':_0xc052e[_0x20e4('0xba')],'referer':_0xc052e[_0x20e4('0xbb')],'customerIp':_0xc052e['customerIp'],'customerPort':_0xc052e[_0x20e4('0xbc')]?_0xc052e['customerPort']:'N.A.'},'messages':_(_0xc052e[_0x20e4('0x7f')])[_0x20e4('0xbd')]()['filter']({'secret':![]})[_0x20e4('0x34')](function(_0x55d9ff){if(_0x55d9ff[_0x20e4('0x6f')]){var _0x27b663=path['join'](_0x1baceb,_0x55d9ff[_0x20e4('0x6f')][_0x20e4('0x6d')]);if(fs[_0x20e4('0xbe')](_0x27b663)){fs[_0x20e4('0xbf')](_0x27b663)[_0x20e4('0xc0')](fs['createWriteStream'](path[_0x20e4('0x74')](_0xba5e76,_0x55d9ff[_0x20e4('0x6f')]['basename'])));}}return{'date':moment(_0x55d9ff[_0x20e4('0x8b')])[_0x20e4('0x7b')](_0x20e4('0xa3'))['toString'](),'sender':_0x55d9ff[_0x20e4('0xc1')]===_0x20e4('0x5e')?_0x55d9ff[_0x20e4('0x80')]?_0x55d9ff[_0x20e4('0x80')]['fullname']:_0x20e4('0x83'):_0x55d9ff['Contact']['firstName']+(_0x55d9ff[_0x20e4('0x62')][_0x20e4('0xc2')]?'\x20'+_0x55d9ff[_0x20e4('0x62')][_0x20e4('0xc2')]:''),'body':_0x55d9ff['Attachment']?_0x55d9ff[_0x20e4('0x6f')]['basename']:_0x55d9ff[_0x20e4('0x2e')],'direction':_0x55d9ff[_0x20e4('0xc1')]===_0x20e4('0x5e')?'A':'C','secret':_0x55d9ff['secret'],'read':_0x55d9ff[_0x20e4('0xc3')],'attachment':_0x55d9ff[_0x20e4('0x6f')]};})[_0x20e4('0xc4')]()};return ejs[_0x20e4('0xc5')](path[_0x20e4('0x74')](config['root'],_0x20e4('0xb0'),_0x20e4('0xc6'),_0x20e4('0xc7')),{'interaction':_0x40d6e8})['then'](function(_0x463bbb){var _0x1cc618=path[_0x20e4('0x74')](_0xba5e76,'transcript-'+_0xc052e['id']+'-'+_0xe45735+_0x20e4('0xc8'));var _0x26b1c3={'path':_0x1cc618,'channel':_0x20e4('0xb9'),'interactionId':_0xc052e['id']};return pdf[_0x20e4('0xc9')](_0x463bbb,_0x26b1c3);})[_0x20e4('0x15')](function(){return new Promise(function(_0x4fdc64,_0xe1d666){zipdir(_0xba5e76,{'saveTo':_0x413ec8},function(_0x28f7ec,_0x1a97cb){if(_0x28f7ec)return _0xe1d666(_0x28f7ec);return _0x4fdc64(_0x1a97cb);});})[_0x20e4('0x15')](function(){return new BPromise(function(_0x253233,_0x1886a5){rimraf(_0xba5e76,function(_0x7bb7dc){if(_0x7bb7dc)_0x1886a5(_0x7bb7dc);return _0x253233();});});})[_0x20e4('0x15')](function(){return _0x36b332[_0x20e4('0x78')](_0x413ec8,_0x492287,function(_0x55ffd8){if(_0x55ffd8){logger[_0x20e4('0x1b')](_0x20e4('0xca'),_0x55ffd8);}else{fs[_0x20e4('0xcb')](_0x413ec8);}});});});}else{return _0x36b332[_0x20e4('0x21')](0xc8);}})[_0x20e4('0x20')](handleError(_0x36b332,null));}; \ No newline at end of file +var _0x3a15=['customerPort','N.A.','tail','existsSync','createReadStream','pipe','firstName','lastName','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','err','rimraf','request-promise','bluebird','mustache','util','lodash','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','./chatInteraction.socket','register','jayson/promise','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','update','destroy','stack','name','send','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','key','getOptions','findAll','chat','query','user','show','params','model','keys','attributes','intersection','fields','length','include','options','create','find','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','closed','disposition','AbandonInteraction','file','originalname','basename','filename','type','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','close','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','User','CmContact','ContactId','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','%s%d','createdAt','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','pick','filter','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','ChatInteractionId','push','alias','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','toString','files','tmp','server','attachments','transcript-%d-%s.zip','read','Owner','mkdirSync','Chat','closedAt','browserName','osName','referer','customerIp'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x3a15,0xde));var _0x53a1=function(_0x51bd64,_0x1c8850){_0x51bd64=_0x51bd64-0x0;var _0x2c7ee4=_0x3a15[_0x51bd64];return _0x2c7ee4;};'use strict';var rimraf=require(_0x53a1('0x0'));var zipdir=require('zip-dir');var rp=require(_0x53a1('0x1'));var moment=require('moment');var BPromise=require(_0x53a1('0x2'));var Mustache=require(_0x53a1('0x3'));var util=require(_0x53a1('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x53a1('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x53a1('0x6'));var logger=require('../../config/logger')(_0x53a1('0x7'));var config=require(_0x53a1('0x8'));var db=require(_0x53a1('0x9'))['db'];config['redis']=_[_0x53a1('0xa')](config[_0x53a1('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x53a1('0xc'))[_0x53a1('0xd')](socket);var jayson=require(_0x53a1('0xe'));var client=jayson[_0x53a1('0xf')]['http']({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1a5c95,_0x12f86c,_0x50cd84,_0x1a89e9){return new BPromise(function(_0x17d23b,_0x33b513){var _0x4a14bc=_0x1a89e9||client;return _0x4a14bc[_0x53a1('0x10')](_0x1a5c95,_0x50cd84)[_0x53a1('0x11')](function(_0x3d66f5){logger[_0x53a1('0x12')](_0x53a1('0x13'),_0x12f86c,_0x53a1('0x14'));logger[_0x53a1('0x15')](_0x53a1('0x16'),_0x12f86c,_0x53a1('0x14'),JSON['stringify'](_0x3d66f5));if(_0x3d66f5[_0x53a1('0x17')]){if(_0x3d66f5[_0x53a1('0x17')][_0x53a1('0x18')]===0x1f4){logger[_0x53a1('0x17')](_0x53a1('0x13'),_0x12f86c,_0x3d66f5[_0x53a1('0x17')][_0x53a1('0x19')]);return _0x33b513(_0x3d66f5['error'][_0x53a1('0x19')]);}logger['error'](_0x53a1('0x13'),_0x12f86c,_0x3d66f5[_0x53a1('0x17')][_0x53a1('0x19')]);return _0x17d23b(_0x3d66f5[_0x53a1('0x17')][_0x53a1('0x19')]);}else{logger[_0x53a1('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x12f86c,_0x53a1('0x14'));_0x17d23b(_0x3d66f5[_0x53a1('0x1a')]['message']);}})[_0x53a1('0x1b')](function(_0x32c5f5){logger['error'](_0x53a1('0x13'),_0x12f86c,_0x32c5f5);_0x33b513(_0x32c5f5);});});}function respondWithStatusCode(_0x11253c,_0x5173a3){_0x5173a3=_0x5173a3||0xcc;return function(_0x14718c){if(_0x14718c){return _0x11253c[_0x53a1('0x1c')](_0x5173a3);}return _0x11253c['status'](_0x5173a3)[_0x53a1('0x1d')]();};}function respondWithResult(_0x1a4dab,_0x471e34){_0x471e34=_0x471e34||0xc8;return function(_0x26f84a){if(_0x26f84a){return _0x1a4dab['status'](_0x471e34)[_0x53a1('0x1e')](_0x26f84a);}};}function respondWithFilteredResult(_0x428866,_0x2a71f1){return function(_0x1027d4){if(_0x1027d4){var _0x3bf15c=typeof _0x2a71f1[_0x53a1('0x1f')]==='undefined'&&typeof _0x2a71f1[_0x53a1('0x20')]===_0x53a1('0x21');var _0x17d3ff=_0x1027d4[_0x53a1('0x22')];var _0x348d5f=_0x3bf15c?0x0:_0x2a71f1[_0x53a1('0x1f')];var _0x13f5f7=_0x3bf15c?_0x1027d4[_0x53a1('0x22')]:_0x2a71f1[_0x53a1('0x1f')]+_0x2a71f1[_0x53a1('0x20')];var _0x255768;if(_0x13f5f7>=_0x17d3ff){_0x13f5f7=_0x17d3ff;_0x255768=0xc8;}else{_0x255768=0xce;}_0x428866[_0x53a1('0x23')](_0x255768);return _0x428866['set'](_0x53a1('0x24'),_0x348d5f+'-'+_0x13f5f7+'/'+_0x17d3ff)[_0x53a1('0x1e')](_0x1027d4);}return null;};}function saveUpdates(_0x2ac270){return function(_0x300b4d){if(_0x300b4d){return _0x300b4d[_0x53a1('0x25')](_0x2ac270)[_0x53a1('0x11')](function(_0x2271d7){return _0x2271d7;});}return null;};}function removeEntity(_0x4e10ff){return function(_0x5aba04){if(_0x5aba04){return _0x5aba04[_0x53a1('0x26')]()[_0x53a1('0x11')](function(){_0x4e10ff[_0x53a1('0x23')](0xcc)[_0x53a1('0x1d')]();});}};}function handleEntityNotFound(_0x116f82){return function(_0x7c89a9){if(!_0x7c89a9){_0x116f82['sendStatus'](0x194);}return _0x7c89a9;};}function handleError(_0x53df98,_0x13a2b1){_0x13a2b1=_0x13a2b1||0x1f4;return function(_0x37f834){logger[_0x53a1('0x17')](_0x37f834[_0x53a1('0x27')]);if(_0x37f834[_0x53a1('0x28')]){delete _0x37f834[_0x53a1('0x28')];}_0x53df98[_0x53a1('0x23')](_0x13a2b1)[_0x53a1('0x29')](_0x37f834);};}function getMustacheRender(_0x1c1211,_0x536409){return Mustache['render'](_0x1c1211,_[_0x53a1('0x2a')](_0x536409[_0x53a1('0x2b')],{'contact':_0x536409[_0x53a1('0x2c')],'message':_0x536409['message'],'agent':_0x536409[_0x53a1('0x2d')],'interaction':_0x536409[_0x53a1('0x2e')],'account':_0x536409[_0x53a1('0x2f')]}))||'';}exports[_0x53a1('0x30')]=function(_0x1d9496,_0x33cbec){var _0x4c3bb8={};var _0x3a4c1d=_[_0x53a1('0x31')](db[_0x53a1('0x32')][_0x53a1('0x33')],function(_0x4a83a2){return{'name':_0x4a83a2[_0x53a1('0x34')],'type':_0x4a83a2['type'][_0x53a1('0x35')]};});_0x4c3bb8=qs[_0x53a1('0x36')](_0x3a4c1d,_0x1d9496);return interaction[_0x53a1('0x37')](_0x53a1('0x38'),_0x1d9496[_0x53a1('0x39')],_0x1d9496[_0x53a1('0x3a')],_0x4c3bb8,_0x3a4c1d)[_0x53a1('0x11')](respondWithFilteredResult(_0x33cbec,_0x4c3bb8))[_0x53a1('0x1b')](handleError(_0x33cbec,null));};exports[_0x53a1('0x3b')]=function(_0x4b71a0,_0x2ae1f4){var _0x24776a={'raw':![],'where':{'id':_0x4b71a0[_0x53a1('0x3c')]['id']}},_0x3a47a5={};_0x3a47a5[_0x53a1('0x3d')]=_['keys'](db[_0x53a1('0x32')][_0x53a1('0x33')]);_0x3a47a5[_0x53a1('0x39')]=_[_0x53a1('0x3e')](_0x4b71a0[_0x53a1('0x39')]);_0x3a47a5['filters']=_['intersection'](_0x3a47a5[_0x53a1('0x3d')],_0x3a47a5[_0x53a1('0x39')]);_0x24776a[_0x53a1('0x3f')]=_[_0x53a1('0x40')](_0x3a47a5['model'],qs['fields'](_0x4b71a0['query'][_0x53a1('0x41')]));_0x24776a[_0x53a1('0x3f')]=_0x24776a[_0x53a1('0x3f')][_0x53a1('0x42')]?_0x24776a['attributes']:_0x3a47a5[_0x53a1('0x3d')];if(_0x4b71a0['query']['includeAll']){_0x24776a[_0x53a1('0x43')]=[{'all':!![]}];}_0x24776a=_['merge']({},_0x24776a,_0x4b71a0[_0x53a1('0x44')]);return db[_0x53a1('0x32')]['find'](_0x24776a)[_0x53a1('0x11')](handleEntityNotFound(_0x2ae1f4,null))['then'](respondWithResult(_0x2ae1f4,null))[_0x53a1('0x1b')](handleError(_0x2ae1f4,null));};exports['create']=function(_0x308f91,_0x4ad64a){return db['ChatInteraction'][_0x53a1('0x45')](_0x308f91['body'],{})['then'](respondWithResult(_0x4ad64a,0xc9))[_0x53a1('0x1b')](handleError(_0x4ad64a,null));};exports[_0x53a1('0x25')]=function(_0x29a00f,_0x5cf7e0){if(_0x29a00f[_0x53a1('0x2b')]['id']){delete _0x29a00f[_0x53a1('0x2b')]['id'];}return db[_0x53a1('0x32')][_0x53a1('0x46')]({'where':{'id':_0x29a00f[_0x53a1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5cf7e0,null))[_0x53a1('0x11')](saveUpdates(_0x29a00f[_0x53a1('0x2b')],null))['then'](respondWithResult(_0x5cf7e0,null))[_0x53a1('0x1b')](handleError(_0x5cf7e0,null));};exports[_0x53a1('0x26')]=function(_0x2ac036,_0x42d96c){return db[_0x53a1('0x32')]['find']({'where':{'id':_0x2ac036[_0x53a1('0x3c')]['id']}})[_0x53a1('0x11')](handleEntityNotFound(_0x42d96c,null))['then'](removeEntity(_0x42d96c,null))['catch'](handleError(_0x42d96c,null));};exports[_0x53a1('0x47')]=function(_0x40152c,_0x2b277d){return db[_0x53a1('0x32')][_0x53a1('0x47')]()[_0x53a1('0x11')](respondWithResult(_0x2b277d,null))[_0x53a1('0x1b')](handleError(_0x2b277d,null));};exports[_0x53a1('0x48')]=function(_0x7dd2ee,_0x1c370b){var _0x57de5b=_0x7dd2ee['params']['id'];var _0xda708a;var _0x5ea173;var _0x1d38dc;return db[_0x53a1('0x32')][_0x53a1('0x49')]({'where':{'id':_0x57de5b}})['then'](function(_0x232009){_0xda708a=_0x232009;return db[_0x53a1('0x4a')][_0x53a1('0x49')]({'where':{'id':_0x232009[_0x53a1('0x4b')]},'attributes':['id',_0x53a1('0x4c'),'vidaooEscalation',_0x53a1('0x4d'),_0x53a1('0x4e'),_0x53a1('0x4f')],'raw':!![]});})[_0x53a1('0x11')](function(_0x1229bf){if(_0x1229bf&&_0x1229bf[_0x53a1('0x4c')]&&_0x1229bf[_0x53a1('0x50')]){_0x5ea173=_0x1229bf;var _0x1ddf80={'interaction':{'id':_0x57de5b},'agent':{'id':_0x7dd2ee['user']['id'],'name':_0x7dd2ee['user']['name'],'fullname':_0x7dd2ee[_0x53a1('0x3a')][_0x53a1('0x51')],'email':_0x7dd2ee[_0x53a1('0x3a')][_0x53a1('0x52')]},'contact':_0x7dd2ee['body'][_0x53a1('0x2c')],'account':_0x7dd2ee['body'][_0x53a1('0x2f')]};var _0x265ee2={'rejectUnauthorized':![],'method':_0x53a1('0x53'),'url':_0x53a1('0x54'),'headers':{'X-APIKEY':_0x1229bf['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x7dd2ee['user'][_0x53a1('0x52')]],'buttons':null,'topic':_0x5ea173[_0x53a1('0x4d')],'note':_[_0x53a1('0x55')](_0x5ea173[_0x53a1('0x4e')])?null:getMustacheRender(_0x5ea173['vidaooNote'],_0x1ddf80),'metadata':null},'redirect':_0x53a1('0x56'),'json':!![]};try{if(!_[_0x53a1('0x55')](_0x5ea173['vidaooMetadata'])){var _0x3190ba=getMustacheRender(_0x5ea173[_0x53a1('0x4f')],_0x1ddf80);var _0x11bcc1=JSON[_0x53a1('0x57')](_0x3190ba);_0x265ee2[_0x53a1('0x2b')]['metadata']=_0x11bcc1;}}catch(_0x35af82){throw new db[(_0x53a1('0x58'))][(_0x53a1('0x59'))](_0x53a1('0x5a'));}return rp(_0x265ee2);}else{throw new db[(_0x53a1('0x58'))]['ValidationError'](_0x53a1('0x5b'));}})[_0x53a1('0x11')](function(_0x30bd3e){_0x1d38dc=_0x30bd3e;if(_0x1d38dc['id']){var _0x1624ee={'body':_0x1d38dc[_0x53a1('0x5c')],'ChatWebsiteId':_0x5ea173['id'],'ChatInteractionId':_0xda708a['id'],'direction':'out','UserId':_0x7dd2ee['user']['id']};return db[_0x53a1('0x5d')][_0x53a1('0x45')](_0x1624ee,{});}else{throw new db[(_0x53a1('0x58'))]['ValidationError'](_0x53a1('0x5e'));}})[_0x53a1('0x11')](function(){return _0xda708a[_0x53a1('0x5f')]({'vidaooSessionId':_0x1d38dc['id']});})['then'](respondWithResult(_0x1c370b,null))[_0x53a1('0x1b')](handleError(_0x1c370b,null));};exports[_0x53a1('0x60')]=function(_0x193d33,_0x28eb0e){if(_0x193d33[_0x53a1('0x2b')]['id']){delete _0x193d33[_0x53a1('0x2b')]['id'];}return db[_0x53a1('0x32')][_0x53a1('0x46')]({'where':{'id':_0x193d33['params']['id']},'include':[{'model':db['CmContact'],'as':_0x53a1('0x61')}]})[_0x53a1('0x11')](handleEntityNotFound(_0x28eb0e,null))[_0x53a1('0x11')](saveUpdates(_0x193d33[_0x53a1('0x2b')],null))[_0x53a1('0x11')](respondWithResult(_0x28eb0e,null))['catch'](handleError(_0x28eb0e,null));};exports[_0x53a1('0x62')]=function(_0x530265,_0x14776b){if(_0x530265[_0x53a1('0x2b')]['id']){delete _0x530265[_0x53a1('0x2b')]['id'];}return db[_0x53a1('0x32')][_0x53a1('0x46')]({'where':{'id':_0x530265[_0x53a1('0x3c')]['id']}})['then'](function(_0x41e61c){if(!_0x41e61c){logger[_0x53a1('0x17')](_0x53a1('0x63'),_0x53a1('0x62'),0x194,'entity\x20not\x20found');_0x14776b[_0x53a1('0x1c')](0x194);}else{if(_0x41e61c[_0x53a1('0x64')]){throw new db['Sequelize']['ValidationError']('Interaction\x20already\x20assigned');}}return _0x41e61c;})[_0x53a1('0x11')](function(_0x6ebb33){if(_0x6ebb33){return _0x6ebb33['update']({'closed':_0x530265[_0x53a1('0x2b')][_0x53a1('0x65')],'disposition':_0x530265[_0x53a1('0x2b')][_0x53a1('0x66')]})[_0x53a1('0x11')](function(_0x57b4dc){return _0x57b4dc;});}})[_0x53a1('0x11')](function(){return respondWithRpcPromise(_0x53a1('0x67'),_0x53a1('0x62'),_0x530265[_0x53a1('0x2b')],client9004);})['then'](respondWithResult(_0x14776b,null))[_0x53a1('0x1b')](handleError(_0x14776b,null));};exports['attachmentUpload']=function(_0xf00eb9,_0x102b54){_0xf00eb9[_0x53a1('0x2b')][_0x53a1('0x28')]=_0xf00eb9[_0x53a1('0x68')][_0x53a1('0x69')];_0xf00eb9[_0x53a1('0x2b')][_0x53a1('0x6a')]=_0xf00eb9['file'][_0x53a1('0x6b')];_0xf00eb9[_0x53a1('0x2b')][_0x53a1('0x6c')]=_0xf00eb9[_0x53a1('0x68')][_0x53a1('0x6d')];return db[_0x53a1('0x6e')][_0x53a1('0x45')](_0xf00eb9['body'])['then'](respondWithResult(_0x102b54,0xc9))[_0x53a1('0x1b')](handleError(_0x102b54,null));};exports[_0x53a1('0x6f')]=function(_0x5db8de,_0x143524){return db[_0x53a1('0x32')][_0x53a1('0x49')]({'where':{'id':_0x5db8de[_0x53a1('0x3c')]['id']},'raw':!![]})[_0x53a1('0x11')](handleEntityNotFound(_0x143524,null))[_0x53a1('0x11')](function(_0x215161){if(_0x215161){if(_0x215161[_0x53a1('0x65')]){return _0x143524[_0x53a1('0x23')](0x193)[_0x53a1('0x1e')]({'status':0x193,'message':_0x53a1('0x70')});}return db[_0x53a1('0x6e')]['findOne']({'where':{'id':_0x5db8de[_0x53a1('0x39')][_0x53a1('0x71')]},'raw':!![]})[_0x53a1('0x11')](handleEntityNotFound(_0x143524,null));}})[_0x53a1('0x11')](function(_0x20efc4){if(_0x20efc4){var _0x5ca204=_0x20efc4[_0x53a1('0x72')]!==null;var _0x2182b2=path[_0x53a1('0x73')](config[_0x53a1('0x74')],_0x53a1('0x75'));if(_0x5ca204){_0x2182b2=path[_0x53a1('0x73')](_0x2182b2,'offline-chat/');}var _0x1e4c6a=path[_0x53a1('0x73')](_0x2182b2,_0x20efc4[_0x53a1('0x6a')]);return _0x143524['download'](_0x1e4c6a);}})[_0x53a1('0x1b')](handleError(_0x143524,null));};exports[_0x53a1('0x76')]=function(_0x4b99a2,_0x14b633){var _0x49ff14=null;var _0x191111=null;var _0x1a1e73=null;if(_0x4b99a2[_0x53a1('0x2b')]['id']){delete _0x4b99a2[_0x53a1('0x2b')]['id'];}if(_0x4b99a2['body']['mailTranscript']){_0x1a1e73=path[_0x53a1('0x73')](config[_0x53a1('0x74')],_0x53a1('0x77'),util[_0x53a1('0x78')](_0x53a1('0x79'),Date[_0x53a1('0x7a')]()));_0x4b99a2['body']['pathTranscript']=_0x1a1e73;}return db['ChatInteraction'][_0x53a1('0x46')]({'where':{'id':_0x4b99a2['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x53a1('0x7b'),'include':[{'model':db[_0x53a1('0x7c')],'as':_0x53a1('0x7c')}]}]})[_0x53a1('0x11')](handleEntityNotFound(_0x14b633,null))[_0x53a1('0x11')](saveUpdates(_0x4b99a2[_0x53a1('0x2b')],null))[_0x53a1('0x11')](function(_0xddc9bf){if(_0xddc9bf){_0x49ff14=_0xddc9bf;return db[_0x53a1('0x4a')][_0x53a1('0x46')]({'where':{'id':_0x49ff14[_0x53a1('0x4b')]}});}})['then'](function(_0x486038){if(_0x486038){_0x191111=_0x486038;return db[_0x53a1('0x7d')]['find']({'where':{'id':_0x49ff14[_0x53a1('0x7e')]}});}})['then'](function(_0x40ca34){if(_0x40ca34){if(_0x1a1e73){var _0xf95a2a=null;for(var _0x697910=0x1;_0x697910<_0x49ff14[_0x53a1('0x7b')][_0x53a1('0x42')];++_0x697910){_0xf95a2a=_0x49ff14['Messages'][_0x697910];var _0x512e5b=_0xf95a2a[_0x53a1('0x64')]?util[_0x53a1('0x78')]('%s%d',_0x191111['agentAlias'],_0xf95a2a[_0x53a1('0x64')]):_0x53a1('0x7f');var _0x526330=_0x4b99a2[_0x53a1('0x2b')][_0x53a1('0x80')]||util[_0x53a1('0x78')]('%s%d',_0x53a1('0x81'),_0xf95a2a['ContactId']);switch(_0x191111[_0x53a1('0x82')]){case _0x53a1('0x83'):_0x512e5b=_0xf95a2a[_0x53a1('0x64')]?util[_0x53a1('0x78')]('%s%d',_0x191111[_0x53a1('0x84')],_0xf95a2a['UserId']):_0x53a1('0x7f');break;case'agent_alias':_0x512e5b=_0xf95a2a[_0x53a1('0x64')]?_0xf95a2a[_0x53a1('0x7c')]['alias']||_0xf95a2a[_0x53a1('0x7c')][_0x53a1('0x51')]:_0x53a1('0x7f');break;case'agent_fullname':_0x512e5b=_0xf95a2a[_0x53a1('0x64')]?_0xf95a2a['User'][_0x53a1('0x51')]:_0x53a1('0x7f');break;default:_0x512e5b=_0xf95a2a[_0x53a1('0x64')]?util[_0x53a1('0x78')](_0x53a1('0x85'),_0x191111[_0x53a1('0x84')],_0xf95a2a[_0x53a1('0x64')]):_0x53a1('0x7f');}var _0x14d402=util[_0x53a1('0x78')]('[%s]\x20%s:\x20%s\x0a',moment(_0xf95a2a[_0x53a1('0x86')])[_0x53a1('0x78')]('MM/DD/YYYY\x20HH:mm:ss'),_0xf95a2a['direction']==='in'?_0x526330:_0x512e5b,_0xf95a2a[_0x53a1('0x2b')]);if(!_0xf95a2a[_0x53a1('0x87')]){fs[_0x53a1('0x88')](_0x1a1e73,_0x14d402);}}return db[_0x53a1('0x89')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x53a1('0x8a')],'as':_0x53a1('0x8b'),'raw':!![],'include':[{'model':db[_0x53a1('0x8c')],'as':_0x53a1('0x8c'),'raw':!![]}]}]});}}})[_0x53a1('0x11')](function(_0x2a611a){if(!_0x2a611a||!_0x2a611a['Smtp']||!_0x4b99a2[_0x53a1('0x2b')])return _0x49ff14;var _0x517f1d=_0x2a611a[_0x53a1('0x8d')]();return respondWithRpcPromise('SendMail',_0x53a1('0x8e'),{'account':_0x517f1d,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2a611a[_0x53a1('0x28')],_0x2a611a['email']||_0x2a611a[_0x53a1('0x8b')][_0x53a1('0x3a')]),'to':_0x4b99a2['body'][_0x53a1('0x8f')],'subject':_0x53a1('0x90'),'text':util[_0x53a1('0x78')](_0x53a1('0x91'),_0x4b99a2[_0x53a1('0x2b')][_0x53a1('0x8f')]),'attachments':[{'path':_0x1a1e73}]}})[_0x53a1('0x11')](function(){return _0x49ff14;})[_0x53a1('0x1b')](function(_0x281892){logger[_0x53a1('0x17')](_0x281892);});})[_0x53a1('0x11')](respondWithStatusCode(_0x14b633,0xc8))[_0x53a1('0x1b')](handleError(_0x14b633,null));};exports[_0x53a1('0x92')]=function(_0x3e063e,_0x4291df){return db['ChatMessage'][_0x53a1('0x46')]({'where':{'id':_0x3e063e[_0x53a1('0x3c')]['id']}})[_0x53a1('0x11')](handleEntityNotFound(_0x4291df,null))['then'](function(_0x4466b4){if(_0x4466b4){return _0x4466b4['addMessage'](_0x3e063e['body'][_0x53a1('0x93')],_[_0x53a1('0x94')](_0x3e063e['body'],[_0x53a1('0x93'),'id'])||{});}})[_0x53a1('0x11')](respondWithResult(_0x4291df,null))[_0x53a1('0x1b')](handleError(_0x4291df,null));};exports[_0x53a1('0x95')]=function(_0x4f8613,_0x22e646){var _0x427aab={'raw':![],'where':{}};var _0x3e417d={};var _0x10d871={'count':0x0,'rows':[]};return db[_0x53a1('0x32')]['findOne']({'where':{'id':_0x4f8613[_0x53a1('0x3c')]['id']}})[_0x53a1('0x11')](handleEntityNotFound(_0x22e646,null))[_0x53a1('0x11')](function(_0x44cd4b){if(_0x44cd4b){_0x3e417d[_0x53a1('0x3d')]=_['keys'](db[_0x53a1('0x5d')][_0x53a1('0x33')]);_0x3e417d[_0x53a1('0x39')]=_['keys'](_0x4f8613['query']);_0x3e417d[_0x53a1('0x96')]=_[_0x53a1('0x40')](_0x3e417d[_0x53a1('0x3d')],_0x3e417d[_0x53a1('0x39')]);_0x427aab['attributes']=_[_0x53a1('0x40')](_0x3e417d[_0x53a1('0x3d')],qs['fields'](_0x4f8613[_0x53a1('0x39')]['fields']));_0x427aab[_0x53a1('0x3f')]=_0x427aab['attributes'][_0x53a1('0x42')]?_0x427aab[_0x53a1('0x3f')]:_0x3e417d['model'];if(!_0x4f8613[_0x53a1('0x39')][_0x53a1('0x97')](_0x53a1('0x98'))){_0x427aab[_0x53a1('0x20')]=qs[_0x53a1('0x20')](_0x4f8613[_0x53a1('0x39')][_0x53a1('0x20')]);_0x427aab[_0x53a1('0x1f')]=qs[_0x53a1('0x1f')](_0x4f8613['query'][_0x53a1('0x1f')]);}_0x427aab[_0x53a1('0x99')]=qs[_0x53a1('0x9a')](_0x4f8613[_0x53a1('0x39')]['sort']);_0x427aab[_0x53a1('0x9b')]=qs[_0x53a1('0x96')](_[_0x53a1('0x9c')](_0x4f8613[_0x53a1('0x39')],_0x3e417d[_0x53a1('0x96')]));_0x427aab[_0x53a1('0x9b')]['ChatInteractionId']=_0x44cd4b['id'];if(_0x4f8613[_0x53a1('0x39')][_0x53a1('0x9d')]){_0x427aab[_0x53a1('0x9b')]=_[_0x53a1('0x2a')](_0x427aab['where'],{'$or':_[_0x53a1('0x31')](_0x427aab[_0x53a1('0x3f')],function(_0x3fce61){var _0x16cf27={};_0x16cf27[_0x3fce61]={'$like':'%'+_0x4f8613[_0x53a1('0x39')]['filter']+'%'};return _0x16cf27;})});}if(_0x4f8613[_0x53a1('0x39')]['$gte']){var _0x4a1616=_0x4f8613['query']['$gte'][_0x53a1('0x9e')](',');var _0x3bb17a={};_0x3bb17a[_0x4a1616[0x0]]={'$gte':moment(_0x4a1616[0x1])['format'](_0x53a1('0x9f'))};_0x427aab['where']=_['merge'](_0x427aab[_0x53a1('0x9b')],_0x3bb17a);}_0x427aab=_[_0x53a1('0x2a')]({},_0x427aab,_0x4f8613[_0x53a1('0x44')]);return db[_0x53a1('0x5d')]['count']({'where':_0x427aab[_0x53a1('0x9b')]})['then'](function(_0x541bbd){_0x10d871[_0x53a1('0x22')]=_0x541bbd;if(_0x4f8613[_0x53a1('0x39')][_0x53a1('0xa0')]){_0x427aab['include']=[{'all':!![]}];}return db[_0x53a1('0x5d')][_0x53a1('0x37')](_0x427aab);})['then'](function(_0x2aba59){_0x10d871[_0x53a1('0xa1')]=_0x2aba59;return _0x10d871;});}})[_0x53a1('0x11')](respondWithFilteredResult(_0x22e646,_0x427aab))[_0x53a1('0x1b')](handleError(_0x22e646,null));};exports['getMyMessages']=function(_0xa7cf0d,_0x57be75){var _0x275093={'where':{}},_0x5bd589={},_0x282e21={'count':0x0,'rows':[]};return db[_0x53a1('0x32')][_0x53a1('0x49')]({'where':{'id':_0xa7cf0d['params']['id']}})['then'](handleEntityNotFound(_0x57be75,null))['then'](function(_0x1047ea){if(_0x1047ea){_0x5bd589[_0x53a1('0x3d')]=_[_0x53a1('0x3e')](db[_0x53a1('0x5d')]['rawAttributes']);_0x5bd589[_0x53a1('0x39')]=_[_0x53a1('0x3e')](_0xa7cf0d[_0x53a1('0x39')]);_0x5bd589[_0x53a1('0x96')]=_[_0x53a1('0x40')](_0x5bd589[_0x53a1('0x3d')],_0x5bd589[_0x53a1('0x39')]);_0x275093[_0x53a1('0x3f')]=_[_0x53a1('0x40')](_0x5bd589[_0x53a1('0x3d')],qs[_0x53a1('0x41')](_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0x41')]));_0x275093[_0x53a1('0x3f')]=_0x275093[_0x53a1('0x3f')][_0x53a1('0x42')]?_0x275093[_0x53a1('0x3f')]:_0x5bd589[_0x53a1('0x3d')];if(!_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0x97')](_0x53a1('0x98'))){_0x275093['limit']=qs[_0x53a1('0x20')](_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0x20')]);_0x275093[_0x53a1('0x1f')]=qs[_0x53a1('0x1f')](_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0x1f')]);}_0x275093['order']=qs['sort'](_0xa7cf0d[_0x53a1('0x39')]['sort']);_0x275093[_0x53a1('0x9b')]=qs['filters'](_[_0x53a1('0x9c')](_0xa7cf0d[_0x53a1('0x39')],_0x5bd589[_0x53a1('0x96')]));_0x275093[_0x53a1('0x9b')][_0x53a1('0xa2')]=_0x1047ea['id'];if(_0xa7cf0d[_0x53a1('0x39')]['filter']){_0x275093[_0x53a1('0x9b')]=_[_0x53a1('0x2a')](_0x275093['where'],{'$or':_[_0x53a1('0x31')](_0x275093[_0x53a1('0x3f')],function(_0x1bffd3){var _0x5af6b7={};_0x5af6b7[_0x1bffd3]={'$like':'%'+_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0x9d')]+'%'};return _0x5af6b7;})});}_0x275093[_0x53a1('0x9b')][_0x53a1('0x87')]=![];if(_0xa7cf0d['query']['id']){_0x275093[_0x53a1('0x9b')]['id']={'$gt':_0xa7cf0d[_0x53a1('0x39')]['id']};}_0x275093=_[_0x53a1('0x2a')]({},_0x275093,_0xa7cf0d['options']);return db['ChatMessage'][_0x53a1('0x22')]({'where':_0x275093[_0x53a1('0x9b')]})['then'](function(_0x208841){_0x282e21['count']=_0x208841;_0x275093['include']=[];if(_0xa7cf0d[_0x53a1('0x39')]['includeAgent']){_0x275093[_0x53a1('0x43')][_0x53a1('0xa3')]({'model':db[_0x53a1('0x7c')],'as':_0x53a1('0x7c'),'attributes':['id',_0x53a1('0x51'),_0x53a1('0xa4')]});}if(_0xa7cf0d[_0x53a1('0x39')][_0x53a1('0xa0')]){_0x275093['include']=[{'all':!![]}];}return db['ChatMessage'][_0x53a1('0x37')](_0x275093);})[_0x53a1('0x11')](function(_0x4dc428){_0x282e21['rows']=_0x4dc428;return _0x282e21;});}})['then'](respondWithFilteredResult(_0x57be75,_0x275093))[_0x53a1('0x1b')](handleError(_0x57be75,null));};exports[_0x53a1('0xa5')]=function(_0x1d5e1f,_0xb368ab){return db[_0x53a1('0x32')]['find']({'where':{'id':_0x1d5e1f['params']['id']}})[_0x53a1('0x11')](handleEntityNotFound(_0xb368ab,null))[_0x53a1('0x11')](function(_0x5290e2){if(_0x5290e2){return _0x5290e2[_0x53a1('0xa6')](_0x1d5e1f['body'][_0x53a1('0x93')],_[_0x53a1('0x94')](_0x1d5e1f[_0x53a1('0x2b')],['ids','id'])||{})[_0x53a1('0xa7')](function(){return db['Tag'][_0x53a1('0x37')]({'attributes':['id',_0x53a1('0x28'),_0x53a1('0xa8')],'where':{'id':_0x1d5e1f['body']['ids']}});})['then'](function(_0x190084){socket['emit'](_0x53a1('0xa9'),{'id':Number(_0x1d5e1f[_0x53a1('0x3c')]['id']),'tags':_0x190084||[]});return{'id':Number(_0x1d5e1f[_0x53a1('0x3c')]['id']),'tags':_0x190084||[]};});}})[_0x53a1('0x11')](respondWithResult(_0xb368ab,null))['catch'](handleError(_0xb368ab,null));};exports[_0x53a1('0xaa')]=function(_0xd1e900,_0x7d48d9){return db[_0x53a1('0x32')]['find']({'where':{'id':_0xd1e900[_0x53a1('0x3c')]['id']}})[_0x53a1('0x11')](handleEntityNotFound(_0x7d48d9,null))[_0x53a1('0x11')](function(_0x1ca795){if(_0x1ca795){return _0x1ca795[_0x53a1('0xaa')](_0xd1e900['query'][_0x53a1('0x93')]);}})[_0x53a1('0x11')](respondWithStatusCode(_0x7d48d9,null))[_0x53a1('0x1b')](handleError(_0x7d48d9,null));};exports['download']=function(_0x4eb911,_0x142525){var _0x6b3b8b=moment()['unix']()[_0x53a1('0xab')]();var _0x3b8c26=path[_0x53a1('0x73')](config['root'],'server',_0x53a1('0xac'),_0x53a1('0xad'));var _0x40bcee=path[_0x53a1('0x73')](config[_0x53a1('0x74')],_0x53a1('0xae'),_0x53a1('0xac'),_0x53a1('0xaf'));var _0x510d00=path[_0x53a1('0x73')](_0x3b8c26,_0x6b3b8b);var _0x53f8fd=util[_0x53a1('0x78')](_0x53a1('0xb0'),_0x4eb911['params']['id'],_0x6b3b8b);var _0x176c59=path[_0x53a1('0x73')](_0x3b8c26,_0x53f8fd);var _0x258397=[];_0x258397[_0x53a1('0xa3')]({'model':db['User'],'as':'User','attributes':['id',_0x53a1('0x51')],'raw':!![]});_0x258397[_0x53a1('0xa3')]({'model':db[_0x53a1('0x7d')],'as':_0x53a1('0x61'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x4eb911[_0x53a1('0x39')][_0x53a1('0xaf')]){_0x258397[_0x53a1('0xa3')]({'model':db[_0x53a1('0x6e')],'as':_0x53a1('0x6e'),'raw':!![]});}var _0x1f4a9f=[{'model':db[_0x53a1('0x5d')],'as':'Messages','attributes':['id',_0x53a1('0x2b'),_0x53a1('0x86'),'direction','secret',_0x53a1('0xb1')],'include':_0x258397}];_0x1f4a9f['push']({'model':db[_0x53a1('0x4a')],'as':'Account','attributes':['id',_0x53a1('0x28')]});_0x1f4a9f[_0x53a1('0xa3')]({'model':db['User'],'as':_0x53a1('0xb2'),'attributes':['id',_0x53a1('0x51')]});return db[_0x53a1('0x32')][_0x53a1('0x46')]({'where':{'id':_0x4eb911[_0x53a1('0x3c')]['id']},'include':_0x1f4a9f})['then'](handleEntityNotFound(_0x142525,null))[_0x53a1('0x11')](function(_0x52c127){if(_0x52c127){var _0x11a98b=_0x52c127['get']({'plain':!![]});fs[_0x53a1('0xb3')](_0x510d00);var _0x58f97d={'channel':_0x53a1('0xb4'),'account':_0x11a98b['Account'][_0x53a1('0x28')],'agent':_0x11a98b[_0x53a1('0xb2')]?_0x11a98b['Owner'][_0x53a1('0x51')]:'N.A.','createdAt':moment(_0x11a98b[_0x53a1('0x86')])[_0x53a1('0x78')]('YYYY-MM-DD\x20HH:mm:ss')[_0x53a1('0xab')](),'closedAt':_0x11a98b['closed']?moment(_0x11a98b[_0x53a1('0xb5')])[_0x53a1('0x78')](_0x53a1('0x9f'))[_0x53a1('0xab')]():'','disposition':_0x11a98b['disposition'],'chatInfo':{'browser':_0x11a98b[_0x53a1('0xb6')],'os':_0x11a98b[_0x53a1('0xb7')],'referer':_0x11a98b[_0x53a1('0xb8')],'customerIp':_0x11a98b[_0x53a1('0xb9')],'customerPort':_0x11a98b['customerPort']?_0x11a98b[_0x53a1('0xba')]:_0x53a1('0xbb')},'messages':_(_0x11a98b['Messages'])[_0x53a1('0xbc')]()[_0x53a1('0x9d')]({'secret':![]})['map'](function(_0x3ee993){if(_0x3ee993[_0x53a1('0x6e')]){var _0xd8264d=path[_0x53a1('0x73')](_0x40bcee,_0x3ee993['Attachment']['basename']);if(fs[_0x53a1('0xbd')](_0xd8264d)){fs[_0x53a1('0xbe')](_0xd8264d)[_0x53a1('0xbf')](fs['createWriteStream'](path[_0x53a1('0x73')](_0x510d00,_0x3ee993['Attachment'][_0x53a1('0x6a')])));}}return{'date':moment(_0x3ee993[_0x53a1('0x86')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x53a1('0xab')](),'sender':_0x3ee993['direction']==='out'?_0x3ee993['User']?_0x3ee993['User']['fullname']:_0x53a1('0x7f'):_0x3ee993[_0x53a1('0x61')][_0x53a1('0xc0')]+(_0x3ee993[_0x53a1('0x61')][_0x53a1('0xc1')]?'\x20'+_0x3ee993[_0x53a1('0x61')][_0x53a1('0xc1')]:''),'body':_0x3ee993[_0x53a1('0x6e')]?_0x3ee993[_0x53a1('0x6e')][_0x53a1('0x6a')]:_0x3ee993[_0x53a1('0x2b')],'direction':_0x3ee993['direction']===_0x53a1('0xc2')?'A':'C','secret':_0x3ee993['secret'],'read':_0x3ee993[_0x53a1('0xb1')],'attachment':_0x3ee993[_0x53a1('0x6e')]};})[_0x53a1('0xc3')]()};return ejs[_0x53a1('0xc4')](path[_0x53a1('0x73')](config[_0x53a1('0x74')],'server',_0x53a1('0xc5'),_0x53a1('0xc6')),{'interaction':_0x58f97d})[_0x53a1('0x11')](function(_0x120878){var _0x36b6b0=path['join'](_0x510d00,_0x53a1('0xc7')+_0x11a98b['id']+'-'+_0x6b3b8b+_0x53a1('0xc8'));var _0x460d21={'path':_0x36b6b0,'channel':_0x53a1('0xb4'),'interactionId':_0x11a98b['id']};return pdf[_0x53a1('0xc9')](_0x120878,_0x460d21);})[_0x53a1('0x11')](function(){return new Promise(function(_0x1fe3ce,_0x2ccedf){zipdir(_0x510d00,{'saveTo':_0x176c59},function(_0x2918c2,_0x307684){if(_0x2918c2)return _0x2ccedf(_0x2918c2);return _0x1fe3ce(_0x307684);});})['then'](function(){return new BPromise(function(_0x26d733,_0x1e7170){rimraf(_0x510d00,function(_0x42e33d){if(_0x42e33d)_0x1e7170(_0x42e33d);return _0x26d733();});});})[_0x53a1('0x11')](function(){return _0x142525[_0x53a1('0xca')](_0x176c59,_0x53f8fd,function(_0xbcb0cf){if(_0xbcb0cf){logger['error'](_0x53a1('0xcb'),_0xbcb0cf);}else{fs['unlinkSync'](_0x176c59);}});});});}else{return _0x142525[_0x53a1('0x1c')](0xc8);}})[_0x53a1('0x1b')](handleError(_0x142525,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 87bc9b0..6053c45 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 _0x4514=['events','../../mysqldb','ChatInteraction','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0x4514,0xfc));var _0x4451=function(_0x27900c,_0x2868fd){_0x27900c=_0x27900c-0x0;var _0x3ea8e0=_0x4514[_0x27900c];return _0x3ea8e0;};'use strict';var EventEmitter=require(_0x4451('0x0'));var ChatInteraction=require(_0x4451('0x1'))['db'][_0x4451('0x2')];var ChatMessage=require(_0x4451('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4451('0x3')](0x0);var events={'afterCreate':_0x4451('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3be86e){return function(_0x1c621f,_0x348baf,_0x13e94b){_0x1c621f[_0x4451('0x5')]({'attributes':['id'],'raw':!![]})[_0x4451('0x6')](function(_0x55d661){_0x1c621f[_0x4451('0x7')](_0x4451('0x8'),_0x55d661[_0x4451('0x9')](function(_0x2d83be){return{'id':_0x2d83be['id']};}));return ChatMessage[_0x4451('0xa')]({'where':{'ChatInteractionId':_0x1c621f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4451('0x6')](function(_0x484370){_0x1c621f[_0x4451('0x7')](_0x4451('0xb'),_0x484370[_0x4451('0xc')]);ChatInteractionEvents[_0x4451('0xd')](_0x3be86e+':'+_0x1c621f['id'],_0x1c621f);ChatInteractionEvents[_0x4451('0xd')](_0x3be86e,_0x1c621f);_0x13e94b(null);})[_0x4451('0xe')](_0x13e94b(null));};}for(var e in events){if(events[_0x4451('0xf')](e)){var event=events[e];ChatInteraction[_0x4451('0x10')](e,emitEvent(event));}}module[_0x4451('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x425b=['length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x425b,0x191));var _0xb425=function(_0xc4ddc3,_0x4c7d3f){_0xc4ddc3=_0xc4ddc3-0x0;var _0x28045e=_0x425b[_0xc4ddc3];return _0x28045e;};'use strict';var EventEmitter=require(_0xb425('0x0'));var ChatInteraction=require(_0xb425('0x1'))['db'][_0xb425('0x2')];var ChatMessage=require(_0xb425('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb425('0x3')](0x0);var events={'afterCreate':_0xb425('0x4'),'afterUpdate':_0xb425('0x5'),'afterDestroy':'remove'};function emitEvent(_0x424a2a){return function(_0x3bee6f,_0x2b3332,_0x3177fe){_0x3bee6f[_0xb425('0x6')]({'attributes':['id'],'raw':!![]})[_0xb425('0x7')](function(_0x1d1c8e){_0x3bee6f[_0xb425('0x8')](_0xb425('0x9'),_0x1d1c8e[_0xb425('0xa')](function(_0x50bb20){return{'id':_0x50bb20['id']};}));return ChatMessage[_0xb425('0xb')]({'where':{'ChatInteractionId':_0x3bee6f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x57e9cd){_0x3bee6f['setDataValue'](_0xb425('0xc'),_0x57e9cd[_0xb425('0xd')]);ChatInteractionEvents[_0xb425('0xe')](_0x424a2a+':'+_0x3bee6f['id'],_0x3bee6f);ChatInteractionEvents['emit'](_0x424a2a,_0x3bee6f);_0x3177fe(null);})[_0xb425('0xf')](_0x3177fe(null));};}for(var e in events){if(events[_0xb425('0x10')](e)){var event=events[e];ChatInteraction[_0xb425('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 927a5eb..13995d0 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 _0xcd82=['utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0xcd82,0x11e));var _0x2cd8=function(_0x1ac5ed,_0x37c9ea){_0x1ac5ed=_0x1ac5ed-0x0;var _0x56cda8=_0xcd82[_0x1ac5ed];return _0x56cda8;};'use strict';var _=require(_0x2cd8('0x0'));var util=require(_0x2cd8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2cd8('0x2'));var rp=require(_0x2cd8('0x3'));var fs=require('fs');var path=require(_0x2cd8('0x4'));var rimraf=require(_0x2cd8('0x5'));var config=require('../../config/environment');var attributes=require(_0x2cd8('0x6'));module[_0x2cd8('0x7')]=function(_0x15bc39,_0x2932af){return _0x15bc39['define'](_0x2cd8('0x8'),attributes,{'tableName':_0x2cd8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1241e2,_0x242932,_0x3406ba){if(_0x1241e2[_0x2cd8('0xa')](_0x2cd8('0xb'))){_0x1241e2['closedAt']=moment()[_0x2cd8('0xc')](_0x2cd8('0xd'));}_0x3406ba(null,_0x1241e2);}},'charset':'utf8mb4','collate':_0x2cd8('0xe')});}; \ No newline at end of file +var _0xbc24=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format'];(function(_0x20d06a,_0x16b092){var _0x1c48ef=function(_0x2da6d5){while(--_0x2da6d5){_0x20d06a['push'](_0x20d06a['shift']());}};_0x1c48ef(++_0x16b092);}(_0xbc24,0x106));var _0x4bc2=function(_0x1e0ee7,_0x4c6ec9){_0x1e0ee7=_0x1e0ee7-0x0;var _0x4c8045=_0xbc24[_0x1e0ee7];return _0x4c8045;};'use strict';var _=require(_0x4bc2('0x0'));var util=require(_0x4bc2('0x1'));var logger=require(_0x4bc2('0x2'))(_0x4bc2('0x3'));var moment=require(_0x4bc2('0x4'));var BPromise=require(_0x4bc2('0x5'));var rp=require(_0x4bc2('0x6'));var fs=require('fs');var path=require(_0x4bc2('0x7'));var rimraf=require(_0x4bc2('0x8'));var config=require(_0x4bc2('0x9'));var attributes=require(_0x4bc2('0xa'));module[_0x4bc2('0xb')]=function(_0x1b9baf,_0x38778c){return _0x1b9baf[_0x4bc2('0xc')](_0x4bc2('0xd'),attributes,{'tableName':_0x4bc2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b9239,_0x25808c,_0x1fe0ec){if(_0x5b9239[_0x4bc2('0xf')]('closed')){_0x5b9239[_0x4bc2('0x10')]=moment()[_0x4bc2('0x11')](_0x4bc2('0x12'));}_0x1fe0ec(null,_0x5b9239);}},'charset':_0x4bc2('0x13'),'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 47189e8..9cb4162 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 _0x837b=['omit','ids','spread','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','request\x20sent','debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','attributes','limit','AddTagsToChatInteraction','find','where','addTags'];(function(_0x106517,_0x9ada4d){var _0x5a6280=function(_0x33805e){while(--_0x33805e){_0x106517['push'](_0x106517['shift']());}};_0x5a6280(++_0x9ada4d);}(_0x837b,0x14c));var _0xb837=function(_0x2c7f80,_0x2b0052){_0x2c7f80=_0x2c7f80-0x0;var _0x11fe38=_0x837b[_0x2c7f80];return _0x11fe38;};'use strict';var _=require(_0xb837('0x0'));var util=require('util');var moment=require(_0xb837('0x1'));var BPromise=require('bluebird');var rs=require(_0xb837('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb837('0x3'))['db'];var utils=require(_0xb837('0x4'));var logger=require(_0xb837('0x5'))(_0xb837('0x6'));var config=require('../../config/environment');var jayson=require(_0xb837('0x7'));var client=jayson[_0xb837('0x8')]['http']({'port':0x232a});config[_0xb837('0x9')]=_[_0xb837('0xa')](config['redis'],{'host':_0xb837('0xb'),'port':0x18eb});var socket=require(_0xb837('0xc'))(new Redis(config[_0xb837('0x9')]));require(_0xb837('0xd'))['register'](socket);function respondWithRpcPromise(_0x318b8a,_0x4c78a2,_0x161000){return new BPromise(function(_0x377511,_0x39575a){return client[_0xb837('0xe')](_0x318b8a,_0x161000)[_0xb837('0xf')](function(_0x3f0eaf){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4c78a2,_0xb837('0x10'));logger[_0xb837('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4c78a2,_0xb837('0x10'),JSON[_0xb837('0x12')](_0x3f0eaf));if(_0x3f0eaf[_0xb837('0x13')]){if(_0x3f0eaf[_0xb837('0x13')][_0xb837('0x14')]===0x1f4){logger[_0xb837('0x13')](_0xb837('0x15'),_0x4c78a2,_0x3f0eaf[_0xb837('0x13')][_0xb837('0x16')]);return _0x39575a(_0x3f0eaf[_0xb837('0x13')][_0xb837('0x16')]);}logger[_0xb837('0x13')](_0xb837('0x15'),_0x4c78a2,_0x3f0eaf['error'][_0xb837('0x16')]);return _0x377511(_0x3f0eaf[_0xb837('0x13')][_0xb837('0x16')]);}else{logger[_0xb837('0x17')](_0xb837('0x15'),_0x4c78a2,_0xb837('0x10'));_0x377511(_0x3f0eaf['result']['message']);}})[_0xb837('0x18')](function(_0x3f7107){logger['error'](_0xb837('0x15'),_0x4c78a2,_0x3f7107);_0x39575a(_0x3f7107);});});}exports[_0xb837('0x19')]=function(_0x2fcd94){var _0x458587=this;return new Promise(function(_0x40e6fc,_0x15ef9d){return db[_0xb837('0x1a')][_0xb837('0x1b')](_0x2fcd94[_0xb837('0x1c')],{'raw':_0x2fcd94[_0xb837('0x1d')]?_0x2fcd94[_0xb837('0x1d')][_0xb837('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fcd94[_0xb837('0x1d')]?_0x2fcd94[_0xb837('0x1d')]['where']||null:null,'attributes':_0x2fcd94[_0xb837('0x1d')]?_0x2fcd94[_0xb837('0x1d')][_0xb837('0x1f')]||null:null,'limit':_0x2fcd94['options']?_0x2fcd94[_0xb837('0x1d')][_0xb837('0x20')]||null:null})[_0xb837('0xf')](function(_0x2ed1cb){logger[_0xb837('0x17')](_0xb837('0x19'),_0x2fcd94);logger[_0xb837('0x11')]('UpdateChatInteraction',_0x2fcd94,JSON[_0xb837('0x12')](_0x2ed1cb));_0x40e6fc(_0x2ed1cb);})['catch'](function(_0x3413a9){logger[_0xb837('0x13')](_0xb837('0x19'),_0x3413a9['message'],_0x2fcd94);_0x15ef9d(_0x458587['error'](0x1f4,_0x3413a9[_0xb837('0x16')]));});});};exports[_0xb837('0x21')]=function(_0x1446d0){return new Promise(function(_0xcea74c,_0x12d1a1){return db['ChatInteraction'][_0xb837('0x22')]({'where':_0x1446d0[_0xb837('0x1d')]?_0x1446d0['options'][_0xb837('0x23')]||null:null})[_0xb837('0xf')](function(_0x582ab4){if(_0x582ab4){return _0x582ab4[_0xb837('0x24')](_0x1446d0['body']['ids'],_[_0xb837('0x25')](_0x1446d0['body'],[_0xb837('0x26'),'id'])||{});}})[_0xb837('0x27')](function(_0x45a6e9){logger[_0xb837('0x17')]('AddTags',_0x1446d0);logger['debug'](_0xb837('0x28'),_0x1446d0,JSON[_0xb837('0x12')](_0x45a6e9));_0xcea74c(_0x45a6e9);})[_0xb837('0x18')](function(_0x3a74a9){logger['error']('AddTags',_0x3a74a9['message'],_0x1446d0);_0x12d1a1(_this['error'](0x1f4,_0x3a74a9[_0xb837('0x16')]));});});}; \ No newline at end of file +var _0xb51e=['debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','localhost','./chatInteraction.socket','request','then','info','request\x20sent'];(function(_0x286282,_0x21c62d){var _0x452868=function(_0x206985){while(--_0x206985){_0x286282['push'](_0x286282['shift']());}};_0x452868(++_0x21c62d);}(_0xb51e,0x87));var _0xeb51=function(_0x20adc7,_0x16cd8c){_0x20adc7=_0x20adc7-0x0;var _0x22b4f1=_0xb51e[_0x20adc7];return _0x22b4f1;};'use strict';var _=require(_0xeb51('0x0'));var util=require(_0xeb51('0x1'));var moment=require(_0xeb51('0x2'));var BPromise=require(_0xeb51('0x3'));var rs=require(_0xeb51('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb51('0x5'))['db'];var utils=require(_0xeb51('0x6'));var logger=require('../../config/logger')(_0xeb51('0x7'));var config=require(_0xeb51('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeb51('0x9')]({'port':0x232a});config[_0xeb51('0xa')]=_['defaults'](config[_0xeb51('0xa')],{'host':_0xeb51('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb51('0xa')]));require(_0xeb51('0xc'))['register'](socket);function respondWithRpcPromise(_0x1e8190,_0x30b61c,_0x588610){return new BPromise(function(_0x1b8e49,_0x4c658f){return client[_0xeb51('0xd')](_0x1e8190,_0x588610)[_0xeb51('0xe')](function(_0x5f4238){logger[_0xeb51('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x30b61c,_0xeb51('0x10'));logger[_0xeb51('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x30b61c,_0xeb51('0x10'),JSON[_0xeb51('0x12')](_0x5f4238));if(_0x5f4238[_0xeb51('0x13')]){if(_0x5f4238[_0xeb51('0x13')][_0xeb51('0x14')]===0x1f4){logger[_0xeb51('0x13')](_0xeb51('0x15'),_0x30b61c,_0x5f4238[_0xeb51('0x13')][_0xeb51('0x16')]);return _0x4c658f(_0x5f4238['error'][_0xeb51('0x16')]);}logger[_0xeb51('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x30b61c,_0x5f4238['error'][_0xeb51('0x16')]);return _0x1b8e49(_0x5f4238['error'][_0xeb51('0x16')]);}else{logger[_0xeb51('0xf')](_0xeb51('0x15'),_0x30b61c,'request\x20sent');_0x1b8e49(_0x5f4238[_0xeb51('0x17')]['message']);}})[_0xeb51('0x18')](function(_0x316af4){logger[_0xeb51('0x13')](_0xeb51('0x15'),_0x30b61c,_0x316af4);_0x4c658f(_0x316af4);});});}exports[_0xeb51('0x19')]=function(_0x52e004){var _0x544269=this;return new Promise(function(_0x31bcbf,_0x495ddc){return db[_0xeb51('0x1a')][_0xeb51('0x1b')](_0x52e004[_0xeb51('0x1c')],{'raw':_0x52e004[_0xeb51('0x1d')]?_0x52e004[_0xeb51('0x1d')][_0xeb51('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52e004['options']?_0x52e004['options'][_0xeb51('0x1f')]||null:null,'attributes':_0x52e004['options']?_0x52e004[_0xeb51('0x1d')][_0xeb51('0x20')]||null:null,'limit':_0x52e004[_0xeb51('0x1d')]?_0x52e004[_0xeb51('0x1d')]['limit']||null:null})['then'](function(_0x563984){logger[_0xeb51('0xf')](_0xeb51('0x19'),_0x52e004);logger[_0xeb51('0x11')](_0xeb51('0x19'),_0x52e004,JSON[_0xeb51('0x12')](_0x563984));_0x31bcbf(_0x563984);})[_0xeb51('0x18')](function(_0x4d403d){logger[_0xeb51('0x13')](_0xeb51('0x19'),_0x4d403d[_0xeb51('0x16')],_0x52e004);_0x495ddc(_0x544269[_0xeb51('0x13')](0x1f4,_0x4d403d['message']));});});};exports['AddTagsToChatInteraction']=function(_0x225e43){return new Promise(function(_0xe03ab5,_0x1e5f9a){return db[_0xeb51('0x1a')][_0xeb51('0x21')]({'where':_0x225e43[_0xeb51('0x1d')]?_0x225e43['options']['where']||null:null})['then'](function(_0x2b9318){if(_0x2b9318){return _0x2b9318[_0xeb51('0x22')](_0x225e43[_0xeb51('0x1c')]['ids'],_['omit'](_0x225e43[_0xeb51('0x1c')],[_0xeb51('0x23'),'id'])||{});}})[_0xeb51('0x24')](function(_0x46de1c){logger[_0xeb51('0xf')](_0xeb51('0x25'),_0x225e43);logger[_0xeb51('0x11')](_0xeb51('0x25'),_0x225e43,JSON[_0xeb51('0x12')](_0x46de1c));_0xe03ab5(_0x46de1c);})[_0xeb51('0x18')](function(_0x5db673){logger[_0xeb51('0x13')](_0xeb51('0x25'),_0x5db673[_0xeb51('0x16')],_0x225e43);_0x1e5f9a(_this['error'](0x1f4,_0x5db673[_0xeb51('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4be20a1..e1a8eaf 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 _0x1b9c=['removeListener','length','chatInteraction:','./chatInteraction.events','save','update'];(function(_0x183214,_0x2b0629){var _0x701714=function(_0x24f5fc){while(--_0x24f5fc){_0x183214['push'](_0x183214['shift']());}};_0x701714(++_0x2b0629);}(_0x1b9c,0x1ad));var _0xc1b9=function(_0x473773,_0x55bf3c){_0x473773=_0x473773-0x0;var _0x14a95c=_0x1b9c[_0x473773];return _0x14a95c;};'use strict';var ChatInteractionEvents=require(_0xc1b9('0x0'));var events=[_0xc1b9('0x1'),'remove',_0xc1b9('0x2')];function createListener(_0xe4413e,_0x5551a4){return function(_0x8d93c4){_0x5551a4['emit'](_0xe4413e,_0x8d93c4);};}function removeListener(_0x90b4e4,_0x5593de){return function(){ChatInteractionEvents[_0xc1b9('0x3')](_0x90b4e4,_0x5593de);};}exports['register']=function(_0x21e501){for(var _0x56a1f5=0x0,_0x52ac80=events[_0xc1b9('0x4')];_0x56a1f5<_0x52ac80;_0x56a1f5++){var _0x1b9fe7=events[_0x56a1f5];var _0x584782=createListener(_0xc1b9('0x5')+_0x1b9fe7,_0x21e501);ChatInteractionEvents['on'](_0x1b9fe7,_0x584782);}}; \ No newline at end of file +var _0x686d=['update','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x372198,_0x31cb62){var _0x510048=function(_0x4b370d){while(--_0x4b370d){_0x372198['push'](_0x372198['shift']());}};_0x510048(++_0x31cb62);}(_0x686d,0x172));var _0xd686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x686d[_0x20a584];return _0x4b41a8;};'use strict';var ChatInteractionEvents=require(_0xd686('0x0'));var events=[_0xd686('0x1'),'remove',_0xd686('0x2')];function createListener(_0xd8c3b2,_0x489671){return function(_0x5b7a13){_0x489671['emit'](_0xd8c3b2,_0x5b7a13);};}function removeListener(_0x16af4c,_0x1e5a5e){return function(){ChatInteractionEvents['removeListener'](_0x16af4c,_0x1e5a5e);};}exports[_0xd686('0x3')]=function(_0x5cc0b3){for(var _0x144020=0x0,_0x2e44cf=events[_0xd686('0x4')];_0x144020<_0x2e44cf;_0x144020++){var _0x511a5e=events[_0x144020];var _0xbb3ea0=createListener(_0xd686('0x5')+_0x511a5e,_0x5cc0b3);ChatInteractionEvents['on'](_0x511a5e,_0xbb3ea0);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 00163cc..8329785 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 _0x6dc2=['/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','root','server/files/attachments/','format','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','chat','chatinteraction:addtags','addTags','tracked','chatinteraction:update','put','customUpdate','/:id/abandon','abandon','close','chatinteraction:destroy','destroy','delete','/:id/tags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages'];(function(_0xddfab6,_0x57f0f6){var _0x238867=function(_0x13e72e){while(--_0x13e72e){_0xddfab6['push'](_0xddfab6['shift']());}};_0x238867(++_0x57f0f6);}(_0x6dc2,0xc5));var _0x26dc=function(_0x26e9c6,_0x3b7098){_0x26e9c6=_0x26e9c6-0x0;var _0x461ebc=_0x6dc2[_0x26e9c6];return _0x461ebc;};'use strict';var multer=require(_0x26dc('0x0'));var util=require(_0x26dc('0x1'));var path=require(_0x26dc('0x2'));var timeout=require(_0x26dc('0x3'));var express=require(_0x26dc('0x4'));var router=express[_0x26dc('0x5')]();var fs_extra=require(_0x26dc('0x6'));var auth=require(_0x26dc('0x7'));var interaction=require(_0x26dc('0x8'));var config=require(_0x26dc('0x9'));var controller=require(_0x26dc('0xa'));router[_0x26dc('0xb')]('/',auth[_0x26dc('0xc')](),controller[_0x26dc('0xd')]);router[_0x26dc('0xb')](_0x26dc('0xe'),auth[_0x26dc('0xc')](),controller[_0x26dc('0xf')]);router[_0x26dc('0xb')](_0x26dc('0x10'),auth[_0x26dc('0x11')](),controller[_0x26dc('0x12')]);router[_0x26dc('0xb')](_0x26dc('0x13'),auth[_0x26dc('0x11')](),controller[_0x26dc('0x14')]);router[_0x26dc('0xb')](_0x26dc('0x15'),auth['isAuthenticated'](),controller[_0x26dc('0x16')]);router[_0x26dc('0xb')](_0x26dc('0x17'),auth[_0x26dc('0x11')](),controller[_0x26dc('0x18')]);router[_0x26dc('0xb')](_0x26dc('0x19'),auth[_0x26dc('0xc')](),controller[_0x26dc('0x1a')]);router[_0x26dc('0x1b')]('/',auth['isAuthenticated'](),controller[_0x26dc('0x1c')]);router[_0x26dc('0x1b')]('/:id/vidaoo',auth[_0x26dc('0xc')](),controller[_0x26dc('0x1d')]);var upload=multer({'storage':multer[_0x26dc('0x1e')]({'destination':function(_0x11bf94,_0x1b880c,_0xf92c3f){_0xf92c3f(null,path['join'](config[_0x26dc('0x1f')],_0x26dc('0x20')));},'filename':function(_0x5f243b,_0x4712b0,_0x21eba9){_0x21eba9(null,util[_0x26dc('0x21')]('%s-%s',Date['now'](),_0x4712b0[_0x26dc('0x22')][_0x26dc('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x26dc('0x1b')](_0x26dc('0x24'),upload[_0x26dc('0x25')]('file'),controller[_0x26dc('0x26')]);router['post']('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x26dc('0x27')]);router[_0x26dc('0x1b')]('/:id/tags',auth[_0x26dc('0xc')](),interaction['tracked'](_0x26dc('0x28'),_0x26dc('0x29')),controller[_0x26dc('0x2a')]);router['put'](_0x26dc('0x10'),auth['isAuthenticated'](),interaction[_0x26dc('0x2b')](_0x26dc('0x28'),_0x26dc('0x2c')),controller['update']);router[_0x26dc('0x2d')]('/:id/custom_update',controller[_0x26dc('0x2e')]);router['put'](_0x26dc('0x2f'),auth[_0x26dc('0x11')](),controller[_0x26dc('0x30')]);router['put']('/:id/close',controller[_0x26dc('0x31')]);router['delete']('/:id',auth[_0x26dc('0xc')](),interaction[_0x26dc('0x2b')](_0x26dc('0x28'),_0x26dc('0x32')),controller[_0x26dc('0x33')]);router[_0x26dc('0x34')](_0x26dc('0x35'),auth[_0x26dc('0xc')](),controller['removeTags']);module[_0x26dc('0x36')]=router; \ No newline at end of file +var _0x2e57=['originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','%s-%s'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x2e57,0x1a7));var _0x72e5=function(_0x58fae4,_0x4be087){_0x58fae4=_0x58fae4-0x0;var _0x516951=_0x2e57[_0x58fae4];return _0x516951;};'use strict';var multer=require(_0x72e5('0x0'));var util=require(_0x72e5('0x1'));var path=require('path');var timeout=require(_0x72e5('0x2'));var express=require(_0x72e5('0x3'));var router=express[_0x72e5('0x4')]();var fs_extra=require(_0x72e5('0x5'));var auth=require(_0x72e5('0x6'));var interaction=require(_0x72e5('0x7'));var config=require(_0x72e5('0x8'));var controller=require('./chatInteraction.controller');router[_0x72e5('0x9')]('/',auth[_0x72e5('0xa')](),controller[_0x72e5('0xb')]);router[_0x72e5('0x9')](_0x72e5('0xc'),auth[_0x72e5('0xa')](),controller['describe']);router[_0x72e5('0x9')](_0x72e5('0xd'),auth[_0x72e5('0xe')](),controller[_0x72e5('0xf')]);router[_0x72e5('0x9')](_0x72e5('0x10'),auth[_0x72e5('0xe')](),controller[_0x72e5('0x11')]);router[_0x72e5('0x9')](_0x72e5('0x12'),auth[_0x72e5('0xa')](),controller[_0x72e5('0x13')]);router['get'](_0x72e5('0x14'),auth['isChatInteractionAuthorized'](),controller[_0x72e5('0x15')]);router[_0x72e5('0x9')](_0x72e5('0x16'),auth['isAuthenticated'](),controller[_0x72e5('0x17')]);router[_0x72e5('0x18')]('/',auth[_0x72e5('0xa')](),controller[_0x72e5('0x19')]);router[_0x72e5('0x18')](_0x72e5('0x1a'),auth[_0x72e5('0xa')](),controller[_0x72e5('0x1b')]);var upload=multer({'storage':multer[_0x72e5('0x1c')]({'destination':function(_0x20e3c3,_0x440860,_0x1e00fe){_0x1e00fe(null,path[_0x72e5('0x1d')](config[_0x72e5('0x1e')],'server/files/attachments/'));},'filename':function(_0xef41ec,_0xeccd47,_0x2d783d){_0x2d783d(null,util[_0x72e5('0x1f')](_0x72e5('0x20'),Date['now'](),_0xeccd47[_0x72e5('0x21')][_0x72e5('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x72e5('0x18')](_0x72e5('0x23'),upload[_0x72e5('0x24')](_0x72e5('0x25')),controller[_0x72e5('0x26')]);router[_0x72e5('0x18')]('/:id/messages',auth[_0x72e5('0xe')](),controller[_0x72e5('0x27')]);router['post'](_0x72e5('0x28'),auth['isAuthenticated'](),interaction[_0x72e5('0x29')](_0x72e5('0x2a'),_0x72e5('0x2b')),controller[_0x72e5('0x2c')]);router[_0x72e5('0x2d')](_0x72e5('0xd'),auth['isAuthenticated'](),interaction[_0x72e5('0x29')](_0x72e5('0x2a'),'chatinteraction:update'),controller[_0x72e5('0x2e')]);router['put'](_0x72e5('0x2f'),controller[_0x72e5('0x30')]);router['put'](_0x72e5('0x31'),auth[_0x72e5('0xe')](),controller[_0x72e5('0x32')]);router[_0x72e5('0x2d')](_0x72e5('0x33'),controller[_0x72e5('0x34')]);router[_0x72e5('0x35')](_0x72e5('0xd'),auth['isAuthenticated'](),interaction[_0x72e5('0x29')](_0x72e5('0x2a'),_0x72e5('0x36')),controller[_0x72e5('0x37')]);router['delete'](_0x72e5('0x28'),auth[_0x72e5('0xa')](),controller['removeTags']);module[_0x72e5('0x38')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index b9f1378..223d10d 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 _0x2435=['BOOLEAN','INTEGER','TEXT','medium'];(function(_0x14a63a,_0x5a0ad1){var _0x1cc157=function(_0x136390){while(--_0x136390){_0x14a63a['push'](_0x14a63a['shift']());}};_0x1cc157(++_0x5a0ad1);}(_0x2435,0x146));var _0x5243=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x2435[_0x20a558];return _0x53d3f7;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x5243('0x0')](_0x5243('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x5243('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5243('0x3')]}}; \ No newline at end of file +var _0x6611=['BOOLEAN','INTEGER'];(function(_0x4b6791,_0x390a9f){var _0x47de56=function(_0x4f3236){while(--_0x4f3236){_0x4b6791['push'](_0x4b6791['shift']());}};_0x47de56(++_0x390a9f);}(_0x6611,0x9e));var _0x1661=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6611[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1661('0x0')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1661('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ccc8872..a161f93 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 _0xf038=['get','messages','lastMessageAt','createdAt','format','lastMessage','getUsers','User','agent','admin','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','length','push','user','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','ChatInternalMessage','rawAttributes','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','find','describe'];(function(_0x23b204,_0x4b773c){var _0x29ac3b=function(_0x26dedf){while(--_0x26dedf){_0x23b204['push'](_0x23b204['shift']());}};_0x29ac3b(++_0x4b773c);}(_0xf038,0x1ea));var _0x8f03=function(_0x12e3e3,_0x501eaf){_0x12e3e3=_0x12e3e3-0x0;var _0x26602e=_0xf038[_0x12e3e3];return _0x26602e;};'use strict';var emlformat=require(_0x8f03('0x0'));var rimraf=require(_0x8f03('0x1'));var zipdir=require(_0x8f03('0x2'));var jsonpatch=require(_0x8f03('0x3'));var rp=require(_0x8f03('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8f03('0x5'));var util=require(_0x8f03('0x6'));var path=require(_0x8f03('0x7'));var sox=require(_0x8f03('0x8'));var csv=require(_0x8f03('0x9'));var ejs=require(_0x8f03('0xa'));var fs=require('fs');var fs_extra=require(_0x8f03('0xb'));var _=require(_0x8f03('0xc'));var squel=require(_0x8f03('0xd'));var crypto=require(_0x8f03('0xe'));var jsforce=require(_0x8f03('0xf'));var deskjs=require(_0x8f03('0x10'));var toCsv=require(_0x8f03('0x9'));var querystring=require(_0x8f03('0x11'));var Papa=require('papaparse');var Redis=require(_0x8f03('0x12'));var authService=require(_0x8f03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8f03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f03('0x15'))(_0x8f03('0x16'));var utils=require(_0x8f03('0x17'));var config=require(_0x8f03('0x18'));var licenseUtil=require(_0x8f03('0x19'));var db=require(_0x8f03('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x8f03('0x1b'),'port':0x18eb});var socket=require(_0x8f03('0x1c'))(new Redis(config[_0x8f03('0x1d')]));require(_0x8f03('0x1e'))['register'](socket);function respondWithStatusCode(_0x5bdbf2,_0x44f3cb){_0x44f3cb=_0x44f3cb||0xcc;return function(_0x58b779){if(_0x58b779){return _0x5bdbf2[_0x8f03('0x1f')](_0x44f3cb);}return _0x5bdbf2[_0x8f03('0x20')](_0x44f3cb)[_0x8f03('0x21')]();};}function respondWithResult(_0x512ca9,_0x295d6){_0x295d6=_0x295d6||0xc8;return function(_0x3d2c7f){if(_0x3d2c7f){return _0x512ca9[_0x8f03('0x20')](_0x295d6)['json'](_0x3d2c7f);}};}function respondWithFilteredResult(_0xca857d,_0x295a48){return function(_0x330af9){if(_0x330af9){var _0xd11178=typeof _0x295a48[_0x8f03('0x22')]==='undefined'&&typeof _0x295a48['limit']===_0x8f03('0x23');var _0x474fdb=_0x330af9[_0x8f03('0x24')];var _0x5e368c=_0xd11178?0x0:_0x295a48[_0x8f03('0x22')];var _0x2738d5=_0xd11178?_0x330af9[_0x8f03('0x24')]:_0x295a48[_0x8f03('0x22')]+_0x295a48[_0x8f03('0x25')];var _0x14c714;if(_0x2738d5>=_0x474fdb){_0x2738d5=_0x474fdb;_0x14c714=0xc8;}else{_0x14c714=0xce;}_0xca857d[_0x8f03('0x20')](_0x14c714);return _0xca857d['set'](_0x8f03('0x26'),_0x5e368c+'-'+_0x2738d5+'/'+_0x474fdb)[_0x8f03('0x27')](_0x330af9);}return null;};}function patchUpdates(_0x5402bb){return function(_0xfc4058){try{jsonpatch[_0x8f03('0x28')](_0xfc4058,_0x5402bb,!![]);}catch(_0x49632f){return BPromise[_0x8f03('0x29')](_0x49632f);}return _0xfc4058[_0x8f03('0x2a')]();};}function saveUpdates(_0x580f02,_0x5b8919){return function(_0x37f537){if(_0x37f537){return _0x37f537[_0x8f03('0x2b')](_0x580f02)['then'](function(_0x385ce1){return _0x385ce1;});}return null;};}function removeEntity(_0xe11c87,_0x44b20d){return function(_0x49d176){if(_0x49d176){return _0x49d176[_0x8f03('0x2c')]()[_0x8f03('0x2d')](function(){_0xe11c87[_0x8f03('0x20')](0xcc)[_0x8f03('0x21')]();});}};}function handleEntityNotFound(_0x1f8071,_0x15d017){return function(_0x4f8b08){if(!_0x4f8b08){_0x1f8071['sendStatus'](0x194);}return _0x4f8b08;};}function handleError(_0x3907f8,_0x55c641){_0x55c641=_0x55c641||0x1f4;return function(_0xdcaa50){logger['error'](_0xdcaa50[_0x8f03('0x2e')]);if(_0xdcaa50[_0x8f03('0x2f')]){delete _0xdcaa50[_0x8f03('0x2f')];}_0x3907f8[_0x8f03('0x20')](_0x55c641)[_0x8f03('0x30')](_0xdcaa50);};}exports[_0x8f03('0x31')]=function(_0x525ee5,_0x3357f2){var _0x56bf55={},_0x562cb9={},_0x546482={'count':0x0,'rows':[]};var _0x49ec7f=_[_0x8f03('0x32')](db[_0x8f03('0x33')][_0x8f03('0x34')],function(_0x3ce409){return{'name':_0x3ce409['fieldName'],'type':_0x3ce409['type']['key']};});_0x562cb9[_0x8f03('0x35')]=_[_0x8f03('0x32')](_0x49ec7f,_0x8f03('0x2f'));_0x562cb9['query']=_['keys'](_0x525ee5[_0x8f03('0x36')]);_0x562cb9[_0x8f03('0x37')]=_['intersection'](_0x562cb9[_0x8f03('0x35')],_0x562cb9[_0x8f03('0x36')]);_0x56bf55[_0x8f03('0x38')]=_[_0x8f03('0x39')](_0x562cb9[_0x8f03('0x35')],qs[_0x8f03('0x3a')](_0x525ee5[_0x8f03('0x36')][_0x8f03('0x3a')]));_0x56bf55['attributes']=_0x56bf55[_0x8f03('0x38')]['length']?_0x56bf55[_0x8f03('0x38')]:_0x562cb9[_0x8f03('0x35')];if(!_0x525ee5[_0x8f03('0x36')][_0x8f03('0x3b')](_0x8f03('0x3c'))){_0x56bf55['limit']=qs[_0x8f03('0x25')](_0x525ee5[_0x8f03('0x36')]['limit']);_0x56bf55[_0x8f03('0x22')]=qs[_0x8f03('0x22')](_0x525ee5[_0x8f03('0x36')]['offset']);}_0x56bf55[_0x8f03('0x3d')]=qs['sort'](_0x525ee5[_0x8f03('0x36')][_0x8f03('0x3e')]);_0x56bf55[_0x8f03('0x3f')]=qs['filters'](_[_0x8f03('0x40')](_0x525ee5[_0x8f03('0x36')],_0x562cb9[_0x8f03('0x37')]),_0x49ec7f);if(_0x525ee5[_0x8f03('0x36')][_0x8f03('0x41')]){_0x56bf55['where']=_[_0x8f03('0x42')](_0x56bf55['where'],{'$or':_[_0x8f03('0x32')](_0x49ec7f,function(_0x395873){if(_0x395873['type']!=='VIRTUAL'){var _0x14ad0f={};_0x14ad0f[_0x395873[_0x8f03('0x2f')]]={'$like':'%'+_0x525ee5[_0x8f03('0x36')][_0x8f03('0x41')]+'%'};return _0x14ad0f;}})});}_0x56bf55=_[_0x8f03('0x42')]({},_0x56bf55,_0x525ee5['options']);var _0x4825cf={'where':_0x56bf55[_0x8f03('0x3f')]};return db[_0x8f03('0x33')][_0x8f03('0x24')](_0x4825cf)['then'](function(_0x268498){_0x546482[_0x8f03('0x24')]=_0x268498;if(_0x525ee5[_0x8f03('0x36')][_0x8f03('0x43')]){_0x56bf55[_0x8f03('0x44')]=[{'all':!![]}];}return db[_0x8f03('0x33')][_0x8f03('0x45')](_0x56bf55);})['then'](function(_0x2a44ea){_0x546482[_0x8f03('0x46')]=_0x2a44ea;return _0x546482;})[_0x8f03('0x2d')](respondWithFilteredResult(_0x3357f2,_0x56bf55))[_0x8f03('0x47')](handleError(_0x3357f2,null));};exports[_0x8f03('0x48')]=function(_0xcdef67,_0x5eb5cb){var _0x3fb31e={'raw':!![],'where':{'id':_0xcdef67[_0x8f03('0x49')]['id']}},_0x75adeb={};_0x75adeb[_0x8f03('0x35')]=_[_0x8f03('0x4a')](db[_0x8f03('0x33')][_0x8f03('0x34')]);_0x75adeb[_0x8f03('0x36')]=_[_0x8f03('0x4a')](_0xcdef67['query']);_0x75adeb['filters']=_['intersection'](_0x75adeb[_0x8f03('0x35')],_0x75adeb['query']);_0x3fb31e['attributes']=_['intersection'](_0x75adeb[_0x8f03('0x35')],qs[_0x8f03('0x3a')](_0xcdef67[_0x8f03('0x36')][_0x8f03('0x3a')]));_0x3fb31e[_0x8f03('0x38')]=_0x3fb31e[_0x8f03('0x38')]['length']?_0x3fb31e[_0x8f03('0x38')]:_0x75adeb[_0x8f03('0x35')];if(_0xcdef67[_0x8f03('0x36')][_0x8f03('0x43')]){_0x3fb31e[_0x8f03('0x44')]=[{'all':!![]}];}_0x3fb31e=_['merge']({},_0x3fb31e,_0xcdef67[_0x8f03('0x4b')]);return db[_0x8f03('0x33')]['find'](_0x3fb31e)[_0x8f03('0x2d')](handleEntityNotFound(_0x5eb5cb,null))['then'](respondWithResult(_0x5eb5cb,null))[_0x8f03('0x47')](handleError(_0x5eb5cb,null));};exports[_0x8f03('0x4c')]=function(_0x1f58e0,_0x4cc274){return db['ChatInternalMessage']['create'](_0x1f58e0[_0x8f03('0x4d')],{})[_0x8f03('0x2d')](respondWithResult(_0x4cc274,0xc9))[_0x8f03('0x47')](handleError(_0x4cc274,null));};exports[_0x8f03('0x2b')]=function(_0x368dde,_0x5aa2e0){if(_0x368dde[_0x8f03('0x4d')]['id']){delete _0x368dde[_0x8f03('0x4d')]['id'];}return db[_0x8f03('0x33')][_0x8f03('0x4e')]({'where':{'id':_0x368dde['params']['id']}})['then'](handleEntityNotFound(_0x5aa2e0,null))[_0x8f03('0x2d')](saveUpdates(_0x368dde[_0x8f03('0x4d')],null))['then'](respondWithResult(_0x5aa2e0,null))[_0x8f03('0x47')](handleError(_0x5aa2e0,null));};exports[_0x8f03('0x2c')]=function(_0x2bad2c,_0x3a9d72){return db[_0x8f03('0x33')][_0x8f03('0x4e')]({'where':{'id':_0x2bad2c['params']['id']}})[_0x8f03('0x2d')](handleEntityNotFound(_0x3a9d72,null))[_0x8f03('0x2d')](removeEntity(_0x3a9d72,null))[_0x8f03('0x47')](handleError(_0x3a9d72,null));};exports[_0x8f03('0x4f')]=function(_0x254ef0,_0x1473a5){return db['ChatInternalMessage'][_0x8f03('0x4f')]()[_0x8f03('0x2d')](respondWithResult(_0x1473a5,null))[_0x8f03('0x47')](handleError(_0x1473a5,null));};function wrapUser(_0x2c3d18){return function(_0xe298a5){var _0xe75147=_0x2c3d18[_0x8f03('0x50')]({'plain':!![]});_0xe75147[_0x8f03('0x51')]=[];if(_0xe298a5){_0xe75147[_0x8f03('0x52')]=_0xe298a5[_0x8f03('0x53')];_0xe75147['lastMessage']=_0xe298a5;}else{_0xe75147[_0x8f03('0x52')]=moment(0x0)[_0x8f03('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0xe75147[_0x8f03('0x55')]={};}return _0xe75147;};}exports[_0x8f03('0x56')]=function(_0x2fb0ea,_0x2b61ea,_0x40a581){var _0x17a829=[];return db[_0x8f03('0x57')]['findAll']({'where':{'role':[_0x8f03('0x58'),_0x8f03('0x59'),'user']},'attributes':['id',_0x8f03('0x5a'),'name','role',_0x8f03('0x5b'),_0x8f03('0x5c'),_0x8f03('0x5d'),_0x8f03('0x5e'),_0x8f03('0x5f'),_0x8f03('0x60')],'order':qs[_0x8f03('0x3e')](_0x8f03('0x61')),'include':[{'model':db['VoiceQueue'],'as':_0x8f03('0x62'),'attributes':['id',_0x8f03('0x2f'),_0x8f03('0x63')],'through':{'attributes':[]}}]})[_0x8f03('0x2d')](function(_0xaac356){if(_0xaac356){var _0x11d991=_0x2fb0ea['user'][_0x8f03('0x50')]({'plain':!![]});if(!_0x11d991)throw new Error(_0x8f03('0x64'));if(_0x11d991[_0x8f03('0x65')]==='user'){return db[_0x8f03('0x66')][_0x8f03('0x4e')]({'where':{'name':'Agents','userProfileId':_0x11d991[_0x8f03('0x67')]},'raw':!![]})[_0x8f03('0x2d')](function(_0x5b68f7){if(_0x5b68f7){if(_0x5b68f7[_0x8f03('0x68')]===0x0){return db[_0x8f03('0x69')][_0x8f03('0x45')]({'where':{'sectionId':_0x5b68f7['id']},'raw':!![]})['then'](function(_0x2afc0f){var _0x43b0fa=[];if(_[_0x8f03('0x6a')](_0x2afc0f)){_0x43b0fa=_[_0x8f03('0x41')](_0xaac356,function(_0x54bbbe){if(_0x54bbbe['role']!==_0x8f03('0x58')){return _0x54bbbe;}});return _0x43b0fa;}else{for(var _0x42fb2=0x0;_0x42fb2<_0xaac356[_0x8f03('0x6b')];_0x42fb2++){var _0xdfb7c6=_0xaac356[_0x42fb2];if(_0xdfb7c6[_0x8f03('0x65')]===_0x8f03('0x58')){var _0x2e4dc7=_[_0x8f03('0x4e')](_0x2afc0f,function(_0x14fc38){return _0x14fc38['resourceId']===_0xdfb7c6['id'];});if(_0x2e4dc7)_0x43b0fa[_0x8f03('0x6c')](_0xdfb7c6);}else{_0x43b0fa[_0x8f03('0x6c')](_0xdfb7c6);}}return _0x43b0fa;}});}else{return _0xaac356;}}else{var _0x202322=_[_0x8f03('0x41')](_0xaac356,function(_0x4a9833){if(_0x4a9833['role']!==_0x8f03('0x58')){return _0x4a9833;}});return _0x202322;}});}else{return _0xaac356;}}})[_0x8f03('0x2d')](function(_0x4e4947){var _0x20845e=[];if(_0x4e4947){_0x17a829=_0x4e4947;for(var _0x38d747=0x0;_0x38d747<_0x4e4947['length'];_0x38d747+=0x1){_0x17a829[_0x38d747][_0x8f03('0x51')]=[];_0x20845e[_0x8f03('0x6c')](db[_0x8f03('0x33')]['find']({'where':{'FromId':[_0x2fb0ea[_0x8f03('0x6d')]['id'],_0x4e4947[_0x38d747]['id']],'ToId':[_0x2fb0ea[_0x8f03('0x6d')]['id'],_0x4e4947[_0x38d747]['id']],'ChatGroupId':null},'attributes':['id',_0x8f03('0x53'),_0x8f03('0x6e'),_0x8f03('0x6f'),'read','body'],'order':qs[_0x8f03('0x3e')](_0x8f03('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x8f03('0x2d')](wrapUser(_0x4e4947[_0x38d747])));}return BPromise[_0x8f03('0x71')](_0x20845e);}return[];})[_0x8f03('0x2d')](function(_0xc87025){return{'rows':_0xc87025,'count':_0xc87025[_0x8f03('0x6b')]};})[_0x8f03('0x2d')](respondWithResult(_0x2b61ea,null))[_0x8f03('0x47')](handleError(_0x2b61ea,null));}; \ No newline at end of file +var _0x7aa8=['key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','ChatInternalMessage','includeAll','findAll','rows','params','include','find','catch','create','body','describe','get','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','isEmpty','length','push','messages','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','redis','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x1c8e15,_0x288b5e){var _0x336251=function(_0x349808){while(--_0x349808){_0x1c8e15['push'](_0x1c8e15['shift']());}};_0x336251(++_0x288b5e);}(_0x7aa8,0xa9));var _0x87aa=function(_0x3f850e,_0x388709){_0x3f850e=_0x3f850e-0x0;var _0x3958f4=_0x7aa8[_0x3f850e];return _0x3958f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87aa('0x0'));var zipdir=require(_0x87aa('0x1'));var jsonpatch=require(_0x87aa('0x2'));var rp=require(_0x87aa('0x3'));var moment=require(_0x87aa('0x4'));var BPromise=require(_0x87aa('0x5'));var Mustache=require(_0x87aa('0x6'));var util=require(_0x87aa('0x7'));var path=require(_0x87aa('0x8'));var sox=require(_0x87aa('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87aa('0xa'));var _=require(_0x87aa('0xb'));var squel=require(_0x87aa('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x87aa('0xd'));var toCsv=require(_0x87aa('0xe'));var querystring=require('querystring');var Papa=require(_0x87aa('0xf'));var Redis=require(_0x87aa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x87aa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x87aa('0x12'))(_0x87aa('0x13'));var utils=require(_0x87aa('0x14'));var config=require(_0x87aa('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x87aa('0x16'))['db'];config['redis']=_[_0x87aa('0x17')](config['redis'],{'host':_0x87aa('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87aa('0x19')]));require(_0x87aa('0x1a'))[_0x87aa('0x1b')](socket);function respondWithStatusCode(_0x1f8c08,_0x59d2fb){_0x59d2fb=_0x59d2fb||0xcc;return function(_0x34d17d){if(_0x34d17d){return _0x1f8c08[_0x87aa('0x1c')](_0x59d2fb);}return _0x1f8c08[_0x87aa('0x1d')](_0x59d2fb)[_0x87aa('0x1e')]();};}function respondWithResult(_0x4ad68a,_0x4fb0c9){_0x4fb0c9=_0x4fb0c9||0xc8;return function(_0x1213ab){if(_0x1213ab){return _0x4ad68a[_0x87aa('0x1d')](_0x4fb0c9)[_0x87aa('0x1f')](_0x1213ab);}};}function respondWithFilteredResult(_0x28e36f,_0x29ec50){return function(_0x4616b4){if(_0x4616b4){var _0x1b843d=typeof _0x29ec50['offset']==='undefined'&&typeof _0x29ec50['limit']===_0x87aa('0x20');var _0x4b0b4a=_0x4616b4[_0x87aa('0x21')];var _0x5da8f4=_0x1b843d?0x0:_0x29ec50['offset'];var _0x5ab5e2=_0x1b843d?_0x4616b4[_0x87aa('0x21')]:_0x29ec50[_0x87aa('0x22')]+_0x29ec50[_0x87aa('0x23')];var _0x5a5f91;if(_0x5ab5e2>=_0x4b0b4a){_0x5ab5e2=_0x4b0b4a;_0x5a5f91=0xc8;}else{_0x5a5f91=0xce;}_0x28e36f[_0x87aa('0x1d')](_0x5a5f91);return _0x28e36f['set'](_0x87aa('0x24'),_0x5da8f4+'-'+_0x5ab5e2+'/'+_0x4b0b4a)[_0x87aa('0x1f')](_0x4616b4);}return null;};}function patchUpdates(_0x29fbdd){return function(_0x75657d){try{jsonpatch[_0x87aa('0x25')](_0x75657d,_0x29fbdd,!![]);}catch(_0x53fb3a){return BPromise[_0x87aa('0x26')](_0x53fb3a);}return _0x75657d[_0x87aa('0x27')]();};}function saveUpdates(_0x32ac69,_0x5b9384){return function(_0x43e236){if(_0x43e236){return _0x43e236[_0x87aa('0x28')](_0x32ac69)[_0x87aa('0x29')](function(_0x305a20){return _0x305a20;});}return null;};}function removeEntity(_0x564a53,_0x2b8061){return function(_0x5b638f){if(_0x5b638f){return _0x5b638f[_0x87aa('0x2a')]()['then'](function(){_0x564a53['status'](0xcc)[_0x87aa('0x1e')]();});}};}function handleEntityNotFound(_0xf79a08,_0x1e6ab6){return function(_0x364a18){if(!_0x364a18){_0xf79a08[_0x87aa('0x1c')](0x194);}return _0x364a18;};}function handleError(_0x591591,_0x111682){_0x111682=_0x111682||0x1f4;return function(_0x237a0b){logger[_0x87aa('0x2b')](_0x237a0b['stack']);if(_0x237a0b[_0x87aa('0x2c')]){delete _0x237a0b['name'];}_0x591591[_0x87aa('0x1d')](_0x111682)[_0x87aa('0x2d')](_0x237a0b);};}exports[_0x87aa('0x2e')]=function(_0x3f8b3c,_0x59c029){var _0xf2d221={},_0x94fd44={},_0x4af1ed={'count':0x0,'rows':[]};var _0x23f20e=_[_0x87aa('0x2f')](db['ChatInternalMessage'][_0x87aa('0x30')],function(_0x58dad5){return{'name':_0x58dad5[_0x87aa('0x31')],'type':_0x58dad5[_0x87aa('0x32')][_0x87aa('0x33')]};});_0x94fd44[_0x87aa('0x34')]=_[_0x87aa('0x2f')](_0x23f20e,_0x87aa('0x2c'));_0x94fd44[_0x87aa('0x35')]=_[_0x87aa('0x36')](_0x3f8b3c['query']);_0x94fd44['filters']=_[_0x87aa('0x37')](_0x94fd44[_0x87aa('0x34')],_0x94fd44['query']);_0xf2d221[_0x87aa('0x38')]=_[_0x87aa('0x37')](_0x94fd44['model'],qs[_0x87aa('0x39')](_0x3f8b3c[_0x87aa('0x35')]['fields']));_0xf2d221[_0x87aa('0x38')]=_0xf2d221[_0x87aa('0x38')]['length']?_0xf2d221[_0x87aa('0x38')]:_0x94fd44[_0x87aa('0x34')];if(!_0x3f8b3c[_0x87aa('0x35')][_0x87aa('0x3a')](_0x87aa('0x3b'))){_0xf2d221[_0x87aa('0x23')]=qs[_0x87aa('0x23')](_0x3f8b3c[_0x87aa('0x35')][_0x87aa('0x23')]);_0xf2d221[_0x87aa('0x22')]=qs['offset'](_0x3f8b3c['query'][_0x87aa('0x22')]);}_0xf2d221['order']=qs['sort'](_0x3f8b3c[_0x87aa('0x35')][_0x87aa('0x3c')]);_0xf2d221[_0x87aa('0x3d')]=qs[_0x87aa('0x3e')](_[_0x87aa('0x3f')](_0x3f8b3c[_0x87aa('0x35')],_0x94fd44[_0x87aa('0x3e')]),_0x23f20e);if(_0x3f8b3c['query'][_0x87aa('0x40')]){_0xf2d221[_0x87aa('0x3d')]=_['merge'](_0xf2d221[_0x87aa('0x3d')],{'$or':_[_0x87aa('0x2f')](_0x23f20e,function(_0x3c2d6a){if(_0x3c2d6a[_0x87aa('0x32')]!==_0x87aa('0x41')){var _0x518a20={};_0x518a20[_0x3c2d6a[_0x87aa('0x2c')]]={'$like':'%'+_0x3f8b3c[_0x87aa('0x35')][_0x87aa('0x40')]+'%'};return _0x518a20;}})});}_0xf2d221=_[_0x87aa('0x42')]({},_0xf2d221,_0x3f8b3c[_0x87aa('0x43')]);var _0x5568ad={'where':_0xf2d221['where']};return db[_0x87aa('0x44')][_0x87aa('0x21')](_0x5568ad)['then'](function(_0x34b7a8){_0x4af1ed[_0x87aa('0x21')]=_0x34b7a8;if(_0x3f8b3c['query'][_0x87aa('0x45')]){_0xf2d221['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x87aa('0x46')](_0xf2d221);})[_0x87aa('0x29')](function(_0x29f17f){_0x4af1ed[_0x87aa('0x47')]=_0x29f17f;return _0x4af1ed;})['then'](respondWithFilteredResult(_0x59c029,_0xf2d221))['catch'](handleError(_0x59c029,null));};exports['show']=function(_0x397a21,_0x402b5e){var _0x46dc97={'raw':!![],'where':{'id':_0x397a21[_0x87aa('0x48')]['id']}},_0x2f98c9={};_0x2f98c9[_0x87aa('0x34')]=_[_0x87aa('0x36')](db['ChatInternalMessage'][_0x87aa('0x30')]);_0x2f98c9[_0x87aa('0x35')]=_[_0x87aa('0x36')](_0x397a21[_0x87aa('0x35')]);_0x2f98c9[_0x87aa('0x3e')]=_[_0x87aa('0x37')](_0x2f98c9[_0x87aa('0x34')],_0x2f98c9['query']);_0x46dc97[_0x87aa('0x38')]=_[_0x87aa('0x37')](_0x2f98c9[_0x87aa('0x34')],qs[_0x87aa('0x39')](_0x397a21[_0x87aa('0x35')]['fields']));_0x46dc97[_0x87aa('0x38')]=_0x46dc97[_0x87aa('0x38')]['length']?_0x46dc97['attributes']:_0x2f98c9[_0x87aa('0x34')];if(_0x397a21[_0x87aa('0x35')][_0x87aa('0x45')]){_0x46dc97[_0x87aa('0x49')]=[{'all':!![]}];}_0x46dc97=_[_0x87aa('0x42')]({},_0x46dc97,_0x397a21[_0x87aa('0x43')]);return db['ChatInternalMessage'][_0x87aa('0x4a')](_0x46dc97)[_0x87aa('0x29')](handleEntityNotFound(_0x402b5e,null))['then'](respondWithResult(_0x402b5e,null))[_0x87aa('0x4b')](handleError(_0x402b5e,null));};exports[_0x87aa('0x4c')]=function(_0x5dc522,_0x376c4f){return db[_0x87aa('0x44')][_0x87aa('0x4c')](_0x5dc522['body'],{})['then'](respondWithResult(_0x376c4f,0xc9))[_0x87aa('0x4b')](handleError(_0x376c4f,null));};exports[_0x87aa('0x28')]=function(_0x2b1eed,_0x758819){if(_0x2b1eed[_0x87aa('0x4d')]['id']){delete _0x2b1eed[_0x87aa('0x4d')]['id'];}return db[_0x87aa('0x44')][_0x87aa('0x4a')]({'where':{'id':_0x2b1eed[_0x87aa('0x48')]['id']}})[_0x87aa('0x29')](handleEntityNotFound(_0x758819,null))[_0x87aa('0x29')](saveUpdates(_0x2b1eed[_0x87aa('0x4d')],null))[_0x87aa('0x29')](respondWithResult(_0x758819,null))['catch'](handleError(_0x758819,null));};exports['destroy']=function(_0xa71b11,_0x2d782b){return db['ChatInternalMessage'][_0x87aa('0x4a')]({'where':{'id':_0xa71b11[_0x87aa('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d782b,null))[_0x87aa('0x29')](removeEntity(_0x2d782b,null))['catch'](handleError(_0x2d782b,null));};exports[_0x87aa('0x4e')]=function(_0x269a38,_0xc4c6a5){return db[_0x87aa('0x44')][_0x87aa('0x4e')]()[_0x87aa('0x29')](respondWithResult(_0xc4c6a5,null))['catch'](handleError(_0xc4c6a5,null));};function wrapUser(_0x21de28){return function(_0x3c7eb9){var _0x1f1984=_0x21de28[_0x87aa('0x4f')]({'plain':!![]});_0x1f1984['messages']=[];if(_0x3c7eb9){_0x1f1984['lastMessageAt']=_0x3c7eb9[_0x87aa('0x50')];_0x1f1984[_0x87aa('0x51')]=_0x3c7eb9;}else{_0x1f1984[_0x87aa('0x52')]=moment(0x0)[_0x87aa('0x53')](_0x87aa('0x54'));_0x1f1984[_0x87aa('0x51')]={};}return _0x1f1984;};}exports[_0x87aa('0x55')]=function(_0x438394,_0x30d23b,_0x37838c){var _0x4a00da=[];return db[_0x87aa('0x56')][_0x87aa('0x46')]({'where':{'role':[_0x87aa('0x57'),'admin',_0x87aa('0x58')]},'attributes':['id','fullname',_0x87aa('0x2c'),'role',_0x87aa('0x59'),_0x87aa('0x5a'),_0x87aa('0x5b'),_0x87aa('0x5c'),_0x87aa('0x5d'),_0x87aa('0x5e')],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x87aa('0x5f'),'attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x87aa('0x29')](function(_0x4246be){if(_0x4246be){var _0x4607be=_0x438394[_0x87aa('0x58')]['get']({'plain':!![]});if(!_0x4607be)throw new Error(_0x87aa('0x60'));if(_0x4607be[_0x87aa('0x61')]===_0x87aa('0x58')){return db[_0x87aa('0x62')][_0x87aa('0x4a')]({'where':{'name':'Agents','userProfileId':_0x4607be[_0x87aa('0x63')]},'raw':!![]})[_0x87aa('0x29')](function(_0x1c93de){if(_0x1c93de){if(_0x1c93de['autoAssociation']===0x0){return db[_0x87aa('0x64')][_0x87aa('0x46')]({'where':{'sectionId':_0x1c93de['id']},'raw':!![]})['then'](function(_0x3bdddc){var _0x4f079a=[];if(_[_0x87aa('0x65')](_0x3bdddc)){_0x4f079a=_[_0x87aa('0x40')](_0x4246be,function(_0x3b883e){if(_0x3b883e[_0x87aa('0x61')]!=='agent'){return _0x3b883e;}});return _0x4f079a;}else{for(var _0x2689b1=0x0;_0x2689b1<_0x4246be[_0x87aa('0x66')];_0x2689b1++){var _0x36836f=_0x4246be[_0x2689b1];if(_0x36836f[_0x87aa('0x61')]===_0x87aa('0x57')){var _0x4fdc5f=_['find'](_0x3bdddc,function(_0x212535){return _0x212535['resourceId']===_0x36836f['id'];});if(_0x4fdc5f)_0x4f079a[_0x87aa('0x67')](_0x36836f);}else{_0x4f079a[_0x87aa('0x67')](_0x36836f);}}return _0x4f079a;}});}else{return _0x4246be;}}else{var _0x42356f=_[_0x87aa('0x40')](_0x4246be,function(_0xbca36){if(_0xbca36[_0x87aa('0x61')]!==_0x87aa('0x57')){return _0xbca36;}});return _0x42356f;}});}else{return _0x4246be;}}})['then'](function(_0x2a297e){var _0x34b1c0=[];if(_0x2a297e){_0x4a00da=_0x2a297e;for(var _0x3ade28=0x0;_0x3ade28<_0x2a297e[_0x87aa('0x66')];_0x3ade28+=0x1){_0x4a00da[_0x3ade28][_0x87aa('0x68')]=[];_0x34b1c0[_0x87aa('0x67')](db[_0x87aa('0x44')][_0x87aa('0x4a')]({'where':{'FromId':[_0x438394[_0x87aa('0x58')]['id'],_0x2a297e[_0x3ade28]['id']],'ToId':[_0x438394[_0x87aa('0x58')]['id'],_0x2a297e[_0x3ade28]['id']],'ChatGroupId':null},'attributes':['id',_0x87aa('0x50'),_0x87aa('0x69'),_0x87aa('0x6a'),_0x87aa('0x6b'),_0x87aa('0x4d')],'order':qs[_0x87aa('0x3c')](_0x87aa('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2a297e[_0x3ade28])));}return BPromise[_0x87aa('0x6d')](_0x34b1c0);}return[];})[_0x87aa('0x29')](function(_0x5c31b4){return{'rows':_0x5c31b4,'count':_0x5c31b4[_0x87aa('0x66')]};})[_0x87aa('0x29')](respondWithResult(_0x30d23b,null))[_0x87aa('0x4b')](handleError(_0x30d23b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 4e29dd7..4295755 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 _0x943a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','save','update'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x943a,0x84));var _0xa943=function(_0x4baac8,_0x5f1dc7){_0x4baac8=_0x4baac8-0x0;var _0x56ebc5=_0x943a[_0x4baac8];return _0x56ebc5;};'use strict';var EventEmitter=require(_0xa943('0x0'));var ChatInternalMessage=require(_0xa943('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa943('0x2'),'afterUpdate':_0xa943('0x3'),'afterDestroy':_0xa943('0x4')};function emitEvent(_0x47a2cb){return function(_0x56f1fd,_0x186955,_0x2bbb60){ChatInternalMessageEvents[_0xa943('0x5')](_0x47a2cb+':'+_0x56f1fd['id'],_0x56f1fd);ChatInternalMessageEvents[_0xa943('0x5')](_0x47a2cb,_0x56f1fd);_0x2bbb60(null);};}for(var e in events){if(events[_0xa943('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xa943('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x49a1=['hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','emit'];(function(_0x8b1425,_0x57171c){var _0x416663=function(_0x1ea508){while(--_0x1ea508){_0x8b1425['push'](_0x8b1425['shift']());}};_0x416663(++_0x57171c);}(_0x49a1,0x190));var _0x149a=function(_0x29aa0c,_0x46d2e9){_0x29aa0c=_0x29aa0c-0x0;var _0x491a1d=_0x49a1[_0x29aa0c];return _0x491a1d;};'use strict';var EventEmitter=require(_0x149a('0x0'));var ChatInternalMessage=require(_0x149a('0x1'))['db'][_0x149a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x149a('0x3')](0x0);var events={'afterCreate':_0x149a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x49a483){return function(_0x3f7895,_0x13623b,_0x51b039){ChatInternalMessageEvents[_0x149a('0x5')](_0x49a483+':'+_0x3f7895['id'],_0x3f7895);ChatInternalMessageEvents[_0x149a('0x5')](_0x49a483,_0x3f7895);_0x51b039(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x149a('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 0b48223..d97df86 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 _0x4f54=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1301df,_0x58d8ff){var _0x26c233=function(_0x42c800){while(--_0x42c800){_0x1301df['push'](_0x1301df['shift']());}};_0x26c233(++_0x58d8ff);}(_0x4f54,0x1c6));var _0x44f5=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4f54[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x44f5('0x0'));var util=require('util');var logger=require(_0x44f5('0x1'))(_0x44f5('0x2'));var moment=require(_0x44f5('0x3'));var BPromise=require(_0x44f5('0x4'));var rp=require(_0x44f5('0x5'));var fs=require('fs');var path=require(_0x44f5('0x6'));var rimraf=require(_0x44f5('0x7'));var config=require('../../config/environment');var attributes=require(_0x44f5('0x8'));module['exports']=function(_0xee464d,_0x191305){return _0xee464d['define'](_0x44f5('0x9'),attributes,{'tableName':_0x44f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x44f5('0xb'),'collate':_0x44f5('0xc')});}; \ No newline at end of file +var _0x28b7=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x28b7,0x17c));var _0x728b=function(_0x285c76,_0x12ea80){_0x285c76=_0x285c76-0x0;var _0x5ced11=_0x28b7[_0x285c76];return _0x5ced11;};'use strict';var _=require(_0x728b('0x0'));var util=require(_0x728b('0x1'));var logger=require(_0x728b('0x2'))(_0x728b('0x3'));var moment=require(_0x728b('0x4'));var BPromise=require(_0x728b('0x5'));var rp=require(_0x728b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x728b('0x7'));var config=require(_0x728b('0x8'));var attributes=require(_0x728b('0x9'));module[_0x728b('0xa')]=function(_0x2101d5,_0x44b8e4){return _0x2101d5[_0x728b('0xb')](_0x728b('0xc'),attributes,{'tableName':_0x728b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x728b('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index f5ad55c..3cc3de6 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 _0x934a=['./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x934a,0x127));var _0xa934=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0x934a[_0x2714ec];return _0x2608e5;};'use strict';var _=require(_0xa934('0x0'));var util=require('util');var moment=require(_0xa934('0x1'));var BPromise=require(_0xa934('0x2'));var rs=require(_0xa934('0x3'));var fs=require('fs');var Redis=require(_0xa934('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa934('0x5'));var logger=require(_0xa934('0x6'))(_0xa934('0x7'));var config=require(_0xa934('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa934('0x9')][_0xa934('0xa')]({'port':0x232a});config[_0xa934('0xb')]=_['defaults'](config[_0xa934('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa934('0xc'))(new Redis(config[_0xa934('0xb')]));require(_0xa934('0xd'))[_0xa934('0xe')](socket);function respondWithRpcPromise(_0x17372b,_0x3d3774,_0x27e438){return new BPromise(function(_0x31c980,_0x116e97){return client[_0xa934('0xf')](_0x17372b,_0x27e438)[_0xa934('0x10')](function(_0xd58e8c){logger[_0xa934('0x11')](_0xa934('0x12'),_0x3d3774,'request\x20sent');logger[_0xa934('0x13')](_0xa934('0x14'),_0x3d3774,'request\x20sent',JSON[_0xa934('0x15')](_0xd58e8c));if(_0xd58e8c['error']){if(_0xd58e8c['error'][_0xa934('0x16')]===0x1f4){logger[_0xa934('0x17')](_0xa934('0x12'),_0x3d3774,_0xd58e8c[_0xa934('0x17')][_0xa934('0x18')]);return _0x116e97(_0xd58e8c[_0xa934('0x17')][_0xa934('0x18')]);}logger[_0xa934('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x3d3774,_0xd58e8c['error'][_0xa934('0x18')]);return _0x31c980(_0xd58e8c['error'][_0xa934('0x18')]);}else{logger[_0xa934('0x11')](_0xa934('0x12'),_0x3d3774,_0xa934('0x19'));_0x31c980(_0xd58e8c[_0xa934('0x1a')][_0xa934('0x18')]);}})[_0xa934('0x1b')](function(_0x2c13ff){logger[_0xa934('0x17')](_0xa934('0x12'),_0x3d3774,_0x2c13ff);_0x116e97(_0x2c13ff);});});} \ No newline at end of file +var _0xf101=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','util','moment','bluebird','randomstring'];(function(_0x34fc32,_0x1b372f){var _0x567758=function(_0x54ca0f){while(--_0x54ca0f){_0x34fc32['push'](_0x34fc32['shift']());}};_0x567758(++_0x1b372f);}(_0xf101,0x141));var _0x1f10=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0xf101[_0xab2afb];return _0x25262b;};'use strict';var _=require('lodash');var util=require(_0x1f10('0x0'));var moment=require(_0x1f10('0x1'));var BPromise=require(_0x1f10('0x2'));var rs=require(_0x1f10('0x3'));var fs=require('fs');var Redis=require(_0x1f10('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f10('0x5'))(_0x1f10('0x6'));var config=require(_0x1f10('0x7'));var jayson=require(_0x1f10('0x8'));var client=jayson[_0x1f10('0x9')]['http']({'port':0x232a});config['redis']=_[_0x1f10('0xa')](config[_0x1f10('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1f10('0xc'))(new Redis(config[_0x1f10('0xb')]));require(_0x1f10('0xd'))[_0x1f10('0xe')](socket);function respondWithRpcPromise(_0x4c3e55,_0x2fb802,_0x33a239){return new BPromise(function(_0x5bee7e,_0x4d2183){return client[_0x1f10('0xf')](_0x4c3e55,_0x33a239)[_0x1f10('0x10')](function(_0x43cdb9){logger['info'](_0x1f10('0x11'),_0x2fb802,'request\x20sent');logger[_0x1f10('0x12')](_0x1f10('0x13'),_0x2fb802,_0x1f10('0x14'),JSON['stringify'](_0x43cdb9));if(_0x43cdb9['error']){if(_0x43cdb9[_0x1f10('0x15')][_0x1f10('0x16')]===0x1f4){logger[_0x1f10('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2fb802,_0x43cdb9['error'][_0x1f10('0x17')]);return _0x4d2183(_0x43cdb9[_0x1f10('0x15')]['message']);}logger[_0x1f10('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2fb802,_0x43cdb9['error']['message']);return _0x5bee7e(_0x43cdb9[_0x1f10('0x15')][_0x1f10('0x17')]);}else{logger[_0x1f10('0x18')](_0x1f10('0x11'),_0x2fb802,_0x1f10('0x14'));_0x5bee7e(_0x43cdb9['result']['message']);}})['catch'](function(_0x15a2f8){logger[_0x1f10('0x15')](_0x1f10('0x11'),_0x2fb802,_0x15a2f8);_0x4d2183(_0x15a2f8);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 88734fc..dc22198 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 _0xd378=['update','emit','removeListener','register','remove'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0xd378,0x1d0));var _0x8d37=function(_0x547b1c,_0xae1569){_0x547b1c=_0x547b1c-0x0;var _0x13defa=_0xd378[_0x547b1c];return _0x13defa;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x8d37('0x0'),_0x8d37('0x1')];function createListener(_0x3c77bc,_0x6426e7){return function(_0x39ed33){_0x6426e7[_0x8d37('0x2')](_0x3c77bc,_0x39ed33);};}function removeListener(_0x29ab0d,_0x2bcfe2){return function(){ChatInternalMessageEvents[_0x8d37('0x3')](_0x29ab0d,_0x2bcfe2);};}exports[_0x8d37('0x4')]=function(_0x48efda){for(var _0x486b67=0x0,_0x41d501=events['length'];_0x486b67<_0x41d501;_0x486b67++){var _0x4e4679=events[_0x486b67];var _0x405812=createListener('chatInternalMessage:'+_0x4e4679,_0x48efda);ChatInternalMessageEvents['on'](_0x4e4679,_0x405812);}}; \ No newline at end of file +var _0x93f9=['save','remove','emit','removeListener','length','./chatInternalMessage.events'];(function(_0x26c4f9,_0x2773ec){var _0x3e7e9f=function(_0x247ed6){while(--_0x247ed6){_0x26c4f9['push'](_0x26c4f9['shift']());}};_0x3e7e9f(++_0x2773ec);}(_0x93f9,0xd1));var _0x993f=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x93f9[_0x5783f4];return _0x28e380;};'use strict';var ChatInternalMessageEvents=require(_0x993f('0x0'));var events=[_0x993f('0x1'),_0x993f('0x2'),'update'];function createListener(_0x686b67,_0x11c5e7){return function(_0x5f35d8){_0x11c5e7[_0x993f('0x3')](_0x686b67,_0x5f35d8);};}function removeListener(_0x2a47ac,_0x5d7f39){return function(){ChatInternalMessageEvents[_0x993f('0x4')](_0x2a47ac,_0x5d7f39);};}exports['register']=function(_0x2f2b9a){for(var _0x22cc65=0x0,_0x3df05d=events[_0x993f('0x5')];_0x22cc65<_0x3df05d;_0x22cc65++){var _0x789c03=events[_0x22cc65];var _0x56c68f=createListener('chatInternalMessage:'+_0x789c03,_0x2f2b9a);ChatInternalMessageEvents['on'](_0x789c03,_0x56c68f);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 1b2a28c..b5f0abb 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 _0x6dfe=['path','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','/:id','show','post','create','put','update','delete','exports','util'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x6dfe,0x1a3));var _0xe6df=function(_0x59bfb8,_0x5dde3f){_0x59bfb8=_0x59bfb8-0x0;var _0x428495=_0x6dfe[_0x59bfb8];return _0x428495;};'use strict';var multer=require('multer');var util=require(_0xe6df('0x0'));var path=require(_0xe6df('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe6df('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe6df('0x3'));var interaction=require(_0xe6df('0x4'));var config=require('../../config/environment');var controller=require(_0xe6df('0x5'));router[_0xe6df('0x6')]('/',auth[_0xe6df('0x7')](),controller[_0xe6df('0x8')]);router[_0xe6df('0x6')](_0xe6df('0x9'),auth['isAuthenticated'](),controller[_0xe6df('0xa')]);router[_0xe6df('0x6')](_0xe6df('0xb'),auth[_0xe6df('0x7')](),controller['getUsers']);router[_0xe6df('0x6')](_0xe6df('0xc'),auth[_0xe6df('0x7')](),controller[_0xe6df('0xd')]);router[_0xe6df('0xe')]('/',auth[_0xe6df('0x7')](),controller[_0xe6df('0xf')]);router[_0xe6df('0x10')](_0xe6df('0xc'),controller[_0xe6df('0x11')]);router[_0xe6df('0x12')](_0xe6df('0xc'),auth[_0xe6df('0x7')](),controller['destroy']);module[_0xe6df('0x13')]=router; \ No newline at end of file +var _0x0b80=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','destroy','exports','multer','util'];(function(_0x49c445,_0x350b54){var _0x118bb4=function(_0xdce3dc){while(--_0xdce3dc){_0x49c445['push'](_0x49c445['shift']());}};_0x118bb4(++_0x350b54);}(_0x0b80,0x196));var _0x00b8=function(_0x2f3f03,_0x3576b4){_0x2f3f03=_0x2f3f03-0x0;var _0x28ca10=_0x0b80[_0x2f3f03];return _0x28ca10;};'use strict';var multer=require(_0x00b8('0x0'));var util=require(_0x00b8('0x1'));var path=require(_0x00b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x00b8('0x3'));var router=express[_0x00b8('0x4')]();var fs_extra=require(_0x00b8('0x5'));var auth=require(_0x00b8('0x6'));var interaction=require(_0x00b8('0x7'));var config=require(_0x00b8('0x8'));var controller=require(_0x00b8('0x9'));router[_0x00b8('0xa')]('/',auth[_0x00b8('0xb')](),controller[_0x00b8('0xc')]);router[_0x00b8('0xa')](_0x00b8('0xd'),auth[_0x00b8('0xb')](),controller[_0x00b8('0xe')]);router[_0x00b8('0xa')](_0x00b8('0xf'),auth['isAuthenticated'](),controller[_0x00b8('0x10')]);router[_0x00b8('0xa')](_0x00b8('0x11'),auth['isAuthenticated'](),controller[_0x00b8('0x12')]);router[_0x00b8('0x13')]('/',auth[_0x00b8('0xb')](),controller[_0x00b8('0x14')]);router['put']('/:id',controller[_0x00b8('0x15')]);router['delete'](_0x00b8('0x11'),auth[_0x00b8('0xb')](),controller[_0x00b8('0x16')]);module[_0x00b8('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index aaa71b5..b113474 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 _0xce3a=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x2b6061,_0xd17e1a){var _0x1efbe1=function(_0x26b4ee){while(--_0x26b4ee){_0x2b6061['push'](_0x2b6061['shift']());}};_0x1efbe1(++_0xd17e1a);}(_0xce3a,0x194));var _0xace3=function(_0x3a657f,_0x25679f){_0x3a657f=_0x3a657f-0x0;var _0x415e94=_0xce3a[_0x3a657f];return _0x415e94;};'use strict';var Sequelize=require(_0xace3('0x0'));module[_0xace3('0x1')]={'body':{'type':Sequelize[_0xace3('0x2')](_0xace3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xace3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xace3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xace3('0x5')]('in',_0xace3('0x6')),'defaultValue':_0xace3('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xace3('0x7')]},'providerName':{'type':Sequelize[_0xace3('0x8')]},'providerResponse':{'type':Sequelize[_0xace3('0x2')]}}; \ No newline at end of file +var _0x0833=['medium','BOOLEAN','out','STRING','sequelize','exports','TEXT'];(function(_0x1892a3,_0x5e5d83){var _0x551b4e=function(_0x1c39cc){while(--_0x1c39cc){_0x1892a3['push'](_0x1892a3['shift']());}};_0x551b4e(++_0x5e5d83);}(_0x0833,0x1bd));var _0x3083=function(_0x1aeff5,_0x365dc2){_0x1aeff5=_0x1aeff5-0x0;var _0x193808=_0x0833[_0x1aeff5];return _0x193808;};'use strict';var Sequelize=require(_0x3083('0x0'));module[_0x3083('0x1')]={'body':{'type':Sequelize[_0x3083('0x2')](_0x3083('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3083('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x3083('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3083('0x6')]},'providerResponse':{'type':Sequelize[_0x3083('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6114a1e..740c892 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 _0x30dd=['Sequelize','SELECT','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','accept','EventManager','acceptmessage','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','QueryTypes','contact','SIP/%s','event','rejectmessage','parse','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','destroy','end','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','show','params','options','find','create','body','update','describe','chat-interactions','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','format','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x30dd,0x1ab));var _0xd30d=function(_0x3fb9f7,_0x297de6){_0x3fb9f7=_0x3fb9f7-0x0;var _0x70fabc=_0x30dd[_0x3fb9f7];return _0x70fabc;};'use strict';var emlformat=require(_0xd30d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd30d('0x1'));var rp=require(_0xd30d('0x2'));var moment=require(_0xd30d('0x3'));var BPromise=require(_0xd30d('0x4'));var Mustache=require(_0xd30d('0x5'));var util=require(_0xd30d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd30d('0x7'));var ejs=require(_0xd30d('0x8'));var fs=require('fs');var fs_extra=require(_0xd30d('0x9'));var _=require(_0xd30d('0xa'));var squel=require(_0xd30d('0xb'));var crypto=require(_0xd30d('0xc'));var jsforce=require(_0xd30d('0xd'));var deskjs=require(_0xd30d('0xe'));var toCsv=require(_0xd30d('0x7'));var querystring=require(_0xd30d('0xf'));var Papa=require(_0xd30d('0x10'));var Redis=require(_0xd30d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd30d('0x12'));var as=require(_0xd30d('0x13'));var hardwareService=require(_0xd30d('0x14'));var logger=require(_0xd30d('0x15'))(_0xd30d('0x16'));var utils=require(_0xd30d('0x17'));var config=require(_0xd30d('0x18'));var licenseUtil=require(_0xd30d('0x19'));var db=require(_0xd30d('0x1a'))['db'];config[_0xd30d('0x1b')]=_[_0xd30d('0x1c')](config['redis'],{'host':_0xd30d('0x1d'),'port':0x18eb});var socket=require(_0xd30d('0x1e'))(new Redis(config[_0xd30d('0x1b')]));require('./chatMessage.socket')[_0xd30d('0x1f')](socket);var jayson=require(_0xd30d('0x20'));var client=jayson['client'][_0xd30d('0x21')]({'port':0x232c});var client9002=jayson[_0xd30d('0x22')][_0xd30d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5cc3bf,_0x1dcffe,_0x32c1e5,_0x344bae){return new BPromise(function(_0x37713f,_0x3cb322){var _0x7e0d63=_0x344bae||client;return _0x7e0d63[_0xd30d('0x23')](_0x5cc3bf,_0x32c1e5)[_0xd30d('0x24')](function(_0x3dbff2){logger[_0xd30d('0x25')]('ChatMessage,\x20%s,\x20%s',_0x1dcffe,_0xd30d('0x26'));logger[_0xd30d('0x27')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1dcffe,_0xd30d('0x26'),JSON['stringify'](_0x3dbff2));if(_0x3dbff2[_0xd30d('0x28')]){if(_0x3dbff2[_0xd30d('0x28')]['code']===0x1f4){logger[_0xd30d('0x28')](_0xd30d('0x29'),_0x1dcffe,_0x3dbff2[_0xd30d('0x28')][_0xd30d('0x2a')]);return _0x3cb322(_0x3dbff2[_0xd30d('0x28')]['message']);}logger[_0xd30d('0x28')]('ChatMessage,\x20%s,\x20%s',_0x1dcffe,_0x3dbff2[_0xd30d('0x28')]['message']);return _0x37713f(_0x3dbff2[_0xd30d('0x28')][_0xd30d('0x2a')]);}else{logger[_0xd30d('0x25')](_0xd30d('0x29'),_0x1dcffe,_0xd30d('0x26'));_0x37713f(_0x3dbff2[_0xd30d('0x2b')][_0xd30d('0x2a')]);}})[_0xd30d('0x2c')](function(_0x1a1814){logger[_0xd30d('0x28')](_0xd30d('0x29'),_0x1dcffe,_0x1a1814);_0x3cb322(_0x1a1814);});});}function respondWithStatusCode(_0x19d376,_0xd16469){_0xd16469=_0xd16469||0xcc;return function(_0x51d91d){if(_0x51d91d){return _0x19d376[_0xd30d('0x2d')](_0xd16469);}return _0x19d376[_0xd30d('0x2e')](_0xd16469)['end']();};}function respondWithResult(_0xa4c709,_0x207608){_0x207608=_0x207608||0xc8;return function(_0x540479){if(_0x540479){return _0xa4c709[_0xd30d('0x2e')](_0x207608)['json'](_0x540479);}};}function respondWithFilteredResult(_0x4b3de9,_0x4a7857){return function(_0x2b3945){if(_0x2b3945){var _0x10b7c5=typeof _0x4a7857['offset']===_0xd30d('0x2f')&&typeof _0x4a7857['limit']==='undefined';var _0x5f178a=_0x2b3945[_0xd30d('0x30')];var _0x99a141=_0x10b7c5?0x0:_0x4a7857['offset'];var _0x441c46=_0x10b7c5?_0x2b3945[_0xd30d('0x30')]:_0x4a7857[_0xd30d('0x31')]+_0x4a7857['limit'];var _0x39970c;if(_0x441c46>=_0x5f178a){_0x441c46=_0x5f178a;_0x39970c=0xc8;}else{_0x39970c=0xce;}_0x4b3de9[_0xd30d('0x2e')](_0x39970c);return _0x4b3de9[_0xd30d('0x32')](_0xd30d('0x33'),_0x99a141+'-'+_0x441c46+'/'+_0x5f178a)[_0xd30d('0x34')](_0x2b3945);}return null;};}function patchUpdates(_0x29851c){return function(_0x2bf8d2){try{jsonpatch[_0xd30d('0x35')](_0x2bf8d2,_0x29851c,!![]);}catch(_0x9c538d){return BPromise['reject'](_0x9c538d);}return _0x2bf8d2['save']();};}function saveUpdates(_0x580399,_0x38cac9){return function(_0x23246d){if(_0x23246d){return _0x23246d['update'](_0x580399)['then'](function(_0x118920){return _0x118920;});}return null;};}function removeEntity(_0x53c508,_0x2883b1){return function(_0x4e63c6){if(_0x4e63c6){return _0x4e63c6[_0xd30d('0x36')]()[_0xd30d('0x24')](function(){_0x53c508[_0xd30d('0x2e')](0xcc)[_0xd30d('0x37')]();});}};}function handleEntityNotFound(_0x4b616e,_0x14917a){return function(_0x5d71c0){if(!_0x5d71c0){_0x4b616e[_0xd30d('0x2d')](0x194);}return _0x5d71c0;};}function handleError(_0x3ec58f,_0x353ac6){_0x353ac6=_0x353ac6||0x1f4;return function(_0x5d70a9){logger['error'](_0x5d70a9['stack']);if(_0x5d70a9[_0xd30d('0x38')]){delete _0x5d70a9['name'];}_0x3ec58f[_0xd30d('0x2e')](_0x353ac6)[_0xd30d('0x39')](_0x5d70a9);};}exports[_0xd30d('0x3a')]=function(_0x294c50,_0x1ec303){var _0x20c6c9={},_0x2f151d={},_0x33beb0={'count':0x0,'rows':[]};var _0x5d5c42=_[_0xd30d('0x3b')](db[_0xd30d('0x3c')][_0xd30d('0x3d')],function(_0x28eeb5){return{'name':_0x28eeb5[_0xd30d('0x3e')],'type':_0x28eeb5['type'][_0xd30d('0x3f')]};});_0x2f151d[_0xd30d('0x40')]=_[_0xd30d('0x3b')](_0x5d5c42,_0xd30d('0x38'));_0x2f151d[_0xd30d('0x41')]=_[_0xd30d('0x42')](_0x294c50[_0xd30d('0x41')]);_0x2f151d[_0xd30d('0x43')]=_[_0xd30d('0x44')](_0x2f151d[_0xd30d('0x40')],_0x2f151d[_0xd30d('0x41')]);_0x20c6c9[_0xd30d('0x45')]=_[_0xd30d('0x44')](_0x2f151d[_0xd30d('0x40')],qs['fields'](_0x294c50[_0xd30d('0x41')][_0xd30d('0x46')]));_0x20c6c9[_0xd30d('0x45')]=_0x20c6c9[_0xd30d('0x45')][_0xd30d('0x47')]?_0x20c6c9[_0xd30d('0x45')]:_0x2f151d['model'];if(!_0x294c50[_0xd30d('0x41')]['hasOwnProperty']('nolimit')){_0x20c6c9[_0xd30d('0x48')]=qs[_0xd30d('0x48')](_0x294c50[_0xd30d('0x41')]['limit']);_0x20c6c9[_0xd30d('0x31')]=qs[_0xd30d('0x31')](_0x294c50[_0xd30d('0x41')][_0xd30d('0x31')]);}_0x20c6c9[_0xd30d('0x49')]=qs[_0xd30d('0x4a')](_0x294c50[_0xd30d('0x41')][_0xd30d('0x4a')]);_0x20c6c9[_0xd30d('0x4b')]=qs[_0xd30d('0x43')](_['pick'](_0x294c50[_0xd30d('0x41')],_0x2f151d[_0xd30d('0x43')]),_0x5d5c42);if(_0x294c50[_0xd30d('0x41')][_0xd30d('0x4c')]){_0x20c6c9[_0xd30d('0x4b')]=_[_0xd30d('0x4d')](_0x20c6c9[_0xd30d('0x4b')],{'$or':_[_0xd30d('0x3b')](_0x5d5c42,function(_0x1d873d){if(_0x1d873d[_0xd30d('0x4e')]!=='VIRTUAL'){var _0x50dd3e={};_0x50dd3e[_0x1d873d[_0xd30d('0x38')]]={'$like':'%'+_0x294c50['query'][_0xd30d('0x4c')]+'%'};return _0x50dd3e;}})});}_0x20c6c9=_[_0xd30d('0x4d')]({},_0x20c6c9,_0x294c50['options']);var _0x4dec84={'where':_0x20c6c9[_0xd30d('0x4b')]};return db[_0xd30d('0x3c')][_0xd30d('0x30')](_0x4dec84)[_0xd30d('0x24')](function(_0x1672c1){_0x33beb0['count']=_0x1672c1;if(_0x294c50[_0xd30d('0x41')][_0xd30d('0x4f')]){_0x20c6c9[_0xd30d('0x50')]=[{'all':!![]}];}return db['ChatMessage'][_0xd30d('0x51')](_0x20c6c9);})[_0xd30d('0x24')](function(_0x44ea6a){_0x33beb0[_0xd30d('0x52')]=_0x44ea6a;return _0x33beb0;})['then'](respondWithFilteredResult(_0x1ec303,_0x20c6c9))[_0xd30d('0x2c')](handleError(_0x1ec303,null));};exports[_0xd30d('0x53')]=function(_0x2ec9e4,_0x47c512){var _0xce43c7={'raw':!![],'where':{'id':_0x2ec9e4[_0xd30d('0x54')]['id']}},_0x5dffb6={};_0x5dffb6['model']=_[_0xd30d('0x42')](db[_0xd30d('0x3c')][_0xd30d('0x3d')]);_0x5dffb6['query']=_[_0xd30d('0x42')](_0x2ec9e4[_0xd30d('0x41')]);_0x5dffb6[_0xd30d('0x43')]=_['intersection'](_0x5dffb6['model'],_0x5dffb6[_0xd30d('0x41')]);_0xce43c7['attributes']=_[_0xd30d('0x44')](_0x5dffb6[_0xd30d('0x40')],qs[_0xd30d('0x46')](_0x2ec9e4[_0xd30d('0x41')][_0xd30d('0x46')]));_0xce43c7[_0xd30d('0x45')]=_0xce43c7[_0xd30d('0x45')][_0xd30d('0x47')]?_0xce43c7[_0xd30d('0x45')]:_0x5dffb6[_0xd30d('0x40')];if(_0x2ec9e4[_0xd30d('0x41')]['includeAll']){_0xce43c7[_0xd30d('0x50')]=[{'all':!![]}];}_0xce43c7=_[_0xd30d('0x4d')]({},_0xce43c7,_0x2ec9e4[_0xd30d('0x55')]);return db[_0xd30d('0x3c')][_0xd30d('0x56')](_0xce43c7)['then'](handleEntityNotFound(_0x47c512,null))[_0xd30d('0x24')](respondWithResult(_0x47c512,null))[_0xd30d('0x2c')](handleError(_0x47c512,null));};exports['create']=function(_0x437882,_0x144cac){return db[_0xd30d('0x3c')][_0xd30d('0x57')](_0x437882[_0xd30d('0x58')],{})['then'](respondWithResult(_0x144cac,0xc9))[_0xd30d('0x2c')](handleError(_0x144cac,null));};exports[_0xd30d('0x59')]=function(_0x33fd1c,_0x52b686){if(_0x33fd1c[_0xd30d('0x58')]['id']){delete _0x33fd1c[_0xd30d('0x58')]['id'];}return db[_0xd30d('0x3c')][_0xd30d('0x56')]({'where':{'id':_0x33fd1c[_0xd30d('0x54')]['id']}})[_0xd30d('0x24')](handleEntityNotFound(_0x52b686,null))['then'](saveUpdates(_0x33fd1c[_0xd30d('0x58')],null))[_0xd30d('0x24')](respondWithResult(_0x52b686,null))[_0xd30d('0x2c')](handleError(_0x52b686,null));};exports[_0xd30d('0x36')]=function(_0x1fb840,_0x42528d){return db[_0xd30d('0x3c')]['find']({'where':{'id':_0x1fb840['params']['id']}})[_0xd30d('0x24')](handleEntityNotFound(_0x42528d,null))[_0xd30d('0x24')](removeEntity(_0x42528d,null))[_0xd30d('0x2c')](handleError(_0x42528d,null));};exports[_0xd30d('0x5a')]=function(_0x3fbec7,_0x44db0a){return db[_0xd30d('0x3c')][_0xd30d('0x5a')]()[_0xd30d('0x24')](respondWithResult(_0x44db0a,null))['catch'](handleError(_0x44db0a,null));};var interaction_log=require(_0xd30d('0x15'))(_0xd30d('0x5b'));exports['accept']=function(_0x158269,_0x586c46,_0x2ebca8){var _0x4bb854={'agent':{},'channel':_0xd30d('0x5c')};if(_0x158269['body']['id']){delete _0x158269['body']['id'];}_0x158269['body'][_0xd30d('0x5d')]=!![];_0x158269[_0xd30d('0x58')][_0xd30d('0x5e')]=moment()['format'](_0xd30d('0x5f'));_0x158269[_0xd30d('0x58')][_0xd30d('0x60')]=_0x158269[_0xd30d('0x58')]['UserId']||_0x158269[_0xd30d('0x61')]['id'];_0x4bb854['agent']['id']=_0x158269[_0xd30d('0x58')][_0xd30d('0x60')];return db[_0xd30d('0x3c')][_0xd30d('0x56')]({'where':{'id':_0x158269[_0xd30d('0x54')]['id'],'UserId':null}})[_0xd30d('0x24')](handleEntityNotFound(_0x586c46,null))[_0xd30d('0x24')](saveUpdates(_0x158269['body'],null))[_0xd30d('0x24')](function(_0x205a18){if(_0x205a18){_0x4bb854[_0xd30d('0x2a')]=_0x205a18['get']({'plain':!![]});return db[_0xd30d('0x62')][_0xd30d('0x56')]({'where':{'id':_0x205a18[_0xd30d('0x63')]}});}return null;})[_0xd30d('0x24')](handleEntityNotFound(_0x586c46,null))[_0xd30d('0x24')](function(_0x5b911e){if(_0x5b911e){return _0x5b911e[_0xd30d('0x59')]({'UserId':_0x158269['body'][_0xd30d('0x60')],'read1stAt':_['isNil'](_0x5b911e['read1stAt'])?moment()[_0xd30d('0x64')](_0xd30d('0x5f')):undefined});}return null;})['then'](function(_0x18b257){if(_0x18b257){_0x4bb854[_0xd30d('0x65')]=_0x18b257[_0xd30d('0x66')]({'plain':!![]});interaction_log['info'](_0xd30d('0x67'),_0x158269[_0xd30d('0x61')]['id'],_0x158269['user'][_0xd30d('0x38')],_0x158269[_0xd30d('0x61')]['role'],_0x4bb854[_0xd30d('0x65')]['id'],_0x158269[_0xd30d('0x58')]?JSON[_0xd30d('0x68')](_0x158269[_0xd30d('0x58')]):_0xd30d('0x69'));return respondWithRpcPromise(_0xd30d('0x6a'),'acceptMessage',_0x4bb854);}return null;})[_0xd30d('0x24')](function(_0x1d68bd){var _0x5b28e4=_0xd30d('0x6b')+_0x1d68bd['message'][_0xd30d('0x6c')];return db['sequelize']['query'](_0x5b28e4,{'type':db[_0xd30d('0x6d')]['QueryTypes'][_0xd30d('0x6e')],'raw':!![]})['then'](function(_0x882260){return _0x882260;});})[_0xd30d('0x24')](function(_0xa3775){if(_0xa3775){_0x4bb854[_0xd30d('0x2a')]['contact']=_0xa3775[0x0];if(!_0x158269[_0xd30d('0x58')][_0xd30d('0x60')])return;return db[_0xd30d('0x6f')][_0xd30d('0x56')]({'where':{'id':_0x158269[_0xd30d('0x58')][_0xd30d('0x60')],'role':_0xd30d('0x70')},'attributes':['id',_0xd30d('0x38'),_0xd30d('0x71'),_0xd30d('0x72'),_0xd30d('0x73')],'raw':!![]});}return null;})[_0xd30d('0x24')](function(_0x341e4){if(!_0x341e4)return null;_0x4bb854[_0xd30d('0x2a')][_0xd30d('0x70')]=_0x341e4;return _0x4bb854;})[_0xd30d('0x24')](function(_0x5f42a7){if(_0x5f42a7){if(_0x158269[_0xd30d('0x58')][_0xd30d('0x74')]){_0x4bb854[_0xd30d('0x2a')][_0xd30d('0x75')]=util[_0xd30d('0x64')]('SIP/%s',_0x158269[_0xd30d('0x61')]['name']);_0x4bb854[_0xd30d('0x2a')][_0xd30d('0x76')]=_0x4bb854[_0xd30d('0x76')];_0x4bb854['message'][_0xd30d('0x77')]=_0x4bb854[_0xd30d('0x76')];_0x4bb854[_0xd30d('0x2a')]['event']=_0xd30d('0x78');return respondWithRpcPromise(_0xd30d('0x79'),_0xd30d('0x79'),{'event':_0xd30d('0x7a'),'message':_[_0xd30d('0x4d')](_0x4bb854['message'],JSON['parse'](_0x4bb854[_0xd30d('0x65')][_0xd30d('0x7b')]))},client9002)[_0xd30d('0x24')](function(){return _0x4bb854;});}return _0x4bb854;}return null;})[_0xd30d('0x24')](respondWithResult(_0x586c46,null))[_0xd30d('0x2c')](handleError(_0x586c46,null));};var interaction_log=require(_0xd30d('0x15'))(_0xd30d('0x5b'));exports[_0xd30d('0x7c')]=function(_0x32dc0f,_0x3ca5c1,_0x1c4423){var _0x4c7d1b={'agent':{},'channel':'chat'};if(_0x32dc0f[_0xd30d('0x58')]['id']){delete _0x32dc0f[_0xd30d('0x58')]['id'];}_0x32dc0f['body']['UserId']=_0x32dc0f['body']['UserId']||_0x32dc0f[_0xd30d('0x61')]['id'];_0x4c7d1b[_0xd30d('0x70')]['id']=_0x32dc0f[_0xd30d('0x58')][_0xd30d('0x60')];return db[_0xd30d('0x3c')][_0xd30d('0x56')]({'where':{'id':_0x32dc0f[_0xd30d('0x54')]['id'],'UserId':null}})[_0xd30d('0x24')](handleEntityNotFound(_0x3ca5c1,null))[_0xd30d('0x24')](function(_0x1ed0b4){if(_0x1ed0b4){_0x4c7d1b['message']=_0x1ed0b4[_0xd30d('0x66')]({'plain':!![]});return db[_0xd30d('0x62')][_0xd30d('0x56')]({'where':{'id':_0x1ed0b4[_0xd30d('0x63')]}});}return null;})[_0xd30d('0x24')](handleEntityNotFound(_0x3ca5c1,null))[_0xd30d('0x24')](function(_0x11df78){if(_0x11df78){_0x4c7d1b['interaction']=_0x11df78[_0xd30d('0x66')]({'plain':!![]});interaction_log[_0xd30d('0x25')](_0xd30d('0x7d'),_0x32dc0f['user']['id'],_0x32dc0f[_0xd30d('0x61')][_0xd30d('0x38')],_0x32dc0f['user'][_0xd30d('0x7e')],_0x4c7d1b['interaction']['id'],_0x32dc0f[_0xd30d('0x58')]?JSON[_0xd30d('0x68')](_0x32dc0f[_0xd30d('0x58')]):_0xd30d('0x69'));return respondWithRpcPromise(_0xd30d('0x7f'),'rejectMessage',_0x4c7d1b);}return null;})[_0xd30d('0x24')](function(_0x81597c){var _0x5acd99=_0xd30d('0x6b')+_0x81597c[_0xd30d('0x2a')][_0xd30d('0x6c')];return db['sequelize'][_0xd30d('0x41')](_0x5acd99,{'type':db['Sequelize'][_0xd30d('0x80')]['SELECT'],'raw':!![]})[_0xd30d('0x24')](function(_0x1e25e1){return _0x1e25e1;});})[_0xd30d('0x24')](function(_0x12b5d7){if(_0x12b5d7){_0x4c7d1b['message'][_0xd30d('0x81')]=_0x12b5d7[0x0];if(!_0x32dc0f[_0xd30d('0x58')][_0xd30d('0x60')])return;return db[_0xd30d('0x6f')][_0xd30d('0x56')]({'where':{'id':_0x32dc0f[_0xd30d('0x58')]['UserId'],'role':_0xd30d('0x70')},'attributes':['id',_0xd30d('0x38'),'fullname',_0xd30d('0x72'),_0xd30d('0x73')],'raw':!![]});}return null;})[_0xd30d('0x24')](function(_0x16d8b2){if(!_0x16d8b2)return null;_0x4c7d1b[_0xd30d('0x2a')][_0xd30d('0x70')]=_0x16d8b2;return _0x4c7d1b;})[_0xd30d('0x24')](function(_0x225488){if(_0x225488){_0x225488['message'][_0xd30d('0x75')]=util[_0xd30d('0x64')](_0xd30d('0x82'),_0x32dc0f['user'][_0xd30d('0x38')]);_0x225488['message']['channel']=_0x4c7d1b[_0xd30d('0x76')];_0x225488[_0xd30d('0x2a')][_0xd30d('0x77')]=_0x4c7d1b[_0xd30d('0x76')];_0x225488['message'][_0xd30d('0x83')]=_0xd30d('0x7c');respondWithRpcPromise('EventManager','EventManager',{'event':_0xd30d('0x84'),'message':_['merge'](_0x4c7d1b[_0xd30d('0x2a')],JSON[_0xd30d('0x85')](_0x4c7d1b[_0xd30d('0x65')][_0xd30d('0x7b')]))},client9002);return _0x4c7d1b;}return null;})[_0xd30d('0x24')](respondWithResult(_0x3ca5c1,null))[_0xd30d('0x2c')](handleError(_0x3ca5c1,null));}; \ No newline at end of file +var _0x4580=['chat-interactions','accept','chat','read','readAt','format','UserId','get','ChatInteractionId','update','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','channel','motionChannel','EventManager','parse','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SIP/%s','event','rejectmessage','formData','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','http','client','request','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','then','destroy','name','index','map','ChatMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','include','find','create','body','params','describe','../../config/logger'];(function(_0x12e719,_0x4f5581){var _0x3bdd30=function(_0x489472){while(--_0x489472){_0x12e719['push'](_0x12e719['shift']());}};_0x3bdd30(++_0x4f5581);}(_0x4580,0x136));var _0x0458=function(_0x3a2f45,_0x628b19){_0x3a2f45=_0x3a2f45-0x0;var _0x25b26c=_0x4580[_0x3a2f45];return _0x25b26c;};'use strict';var emlformat=require(_0x0458('0x0'));var rimraf=require(_0x0458('0x1'));var zipdir=require(_0x0458('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0458('0x3'));var moment=require('moment');var BPromise=require(_0x0458('0x4'));var Mustache=require(_0x0458('0x5'));var util=require(_0x0458('0x6'));var path=require(_0x0458('0x7'));var sox=require(_0x0458('0x8'));var csv=require('to-csv');var ejs=require(_0x0458('0x9'));var fs=require('fs');var fs_extra=require(_0x0458('0xa'));var _=require('lodash');var squel=require(_0x0458('0xb'));var crypto=require(_0x0458('0xc'));var jsforce=require(_0x0458('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0458('0xe'));var querystring=require(_0x0458('0xf'));var Papa=require(_0x0458('0x10'));var Redis=require(_0x0458('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0458('0x12'));var hardwareService=require(_0x0458('0x13'));var logger=require('../../config/logger')(_0x0458('0x14'));var utils=require(_0x0458('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0458('0x16'))['db'];config[_0x0458('0x17')]=_[_0x0458('0x18')](config[_0x0458('0x17')],{'host':_0x0458('0x19'),'port':0x18eb});var socket=require(_0x0458('0x1a'))(new Redis(config[_0x0458('0x17')]));require(_0x0458('0x1b'))['register'](socket);var jayson=require(_0x0458('0x1c'));var client=jayson['client'][_0x0458('0x1d')]({'port':0x232c});var client9002=jayson[_0x0458('0x1e')][_0x0458('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x261989,_0x14b116,_0x5db9d9,_0x4f4141){return new BPromise(function(_0xc4706c,_0x4677af){var _0x1dd5e7=_0x4f4141||client;return _0x1dd5e7[_0x0458('0x1f')](_0x261989,_0x5db9d9)['then'](function(_0x276ab2){logger[_0x0458('0x20')](_0x0458('0x21'),_0x14b116,'request\x20sent');logger['debug'](_0x0458('0x22'),_0x14b116,_0x0458('0x23'),JSON[_0x0458('0x24')](_0x276ab2));if(_0x276ab2['error']){if(_0x276ab2[_0x0458('0x25')]['code']===0x1f4){logger[_0x0458('0x25')](_0x0458('0x21'),_0x14b116,_0x276ab2['error']['message']);return _0x4677af(_0x276ab2['error'][_0x0458('0x26')]);}logger[_0x0458('0x25')](_0x0458('0x21'),_0x14b116,_0x276ab2[_0x0458('0x25')][_0x0458('0x26')]);return _0xc4706c(_0x276ab2[_0x0458('0x25')]['message']);}else{logger[_0x0458('0x20')](_0x0458('0x21'),_0x14b116,_0x0458('0x23'));_0xc4706c(_0x276ab2[_0x0458('0x27')][_0x0458('0x26')]);}})[_0x0458('0x28')](function(_0x418386){logger['error'](_0x0458('0x21'),_0x14b116,_0x418386);_0x4677af(_0x418386);});});}function respondWithStatusCode(_0x72c84f,_0x4e9dec){_0x4e9dec=_0x4e9dec||0xcc;return function(_0x4d6eac){if(_0x4d6eac){return _0x72c84f[_0x0458('0x29')](_0x4e9dec);}return _0x72c84f[_0x0458('0x2a')](_0x4e9dec)[_0x0458('0x2b')]();};}function respondWithResult(_0x464cf5,_0x2fed83){_0x2fed83=_0x2fed83||0xc8;return function(_0x198546){if(_0x198546){return _0x464cf5[_0x0458('0x2a')](_0x2fed83)[_0x0458('0x2c')](_0x198546);}};}function respondWithFilteredResult(_0x302ffa,_0x1763bf){return function(_0x157b7e){if(_0x157b7e){var _0x26f52f=typeof _0x1763bf[_0x0458('0x2d')]==='undefined'&&typeof _0x1763bf[_0x0458('0x2e')]===_0x0458('0x2f');var _0xfee443=_0x157b7e[_0x0458('0x30')];var _0x11ccf1=_0x26f52f?0x0:_0x1763bf[_0x0458('0x2d')];var _0x4e8c9e=_0x26f52f?_0x157b7e[_0x0458('0x30')]:_0x1763bf[_0x0458('0x2d')]+_0x1763bf[_0x0458('0x2e')];var _0x3dc4d8;if(_0x4e8c9e>=_0xfee443){_0x4e8c9e=_0xfee443;_0x3dc4d8=0xc8;}else{_0x3dc4d8=0xce;}_0x302ffa[_0x0458('0x2a')](_0x3dc4d8);return _0x302ffa[_0x0458('0x31')]('Content-Range',_0x11ccf1+'-'+_0x4e8c9e+'/'+_0xfee443)[_0x0458('0x2c')](_0x157b7e);}return null;};}function patchUpdates(_0x3b6b72){return function(_0x4b4da2){try{jsonpatch[_0x0458('0x32')](_0x4b4da2,_0x3b6b72,!![]);}catch(_0x46ab77){return BPromise[_0x0458('0x33')](_0x46ab77);}return _0x4b4da2['save']();};}function saveUpdates(_0xb7bd01,_0x2de457){return function(_0x4e4efb){if(_0x4e4efb){return _0x4e4efb['update'](_0xb7bd01)[_0x0458('0x34')](function(_0x45f380){return _0x45f380;});}return null;};}function removeEntity(_0x2f5555,_0x21f6f8){return function(_0x5d4ecb){if(_0x5d4ecb){return _0x5d4ecb[_0x0458('0x35')]()[_0x0458('0x34')](function(){_0x2f5555['status'](0xcc)[_0x0458('0x2b')]();});}};}function handleEntityNotFound(_0x1b24dc,_0x9f98c0){return function(_0x28949f){if(!_0x28949f){_0x1b24dc[_0x0458('0x29')](0x194);}return _0x28949f;};}function handleError(_0x46eb04,_0x587e65){_0x587e65=_0x587e65||0x1f4;return function(_0x3b1d7d){logger[_0x0458('0x25')](_0x3b1d7d['stack']);if(_0x3b1d7d[_0x0458('0x36')]){delete _0x3b1d7d[_0x0458('0x36')];}_0x46eb04[_0x0458('0x2a')](_0x587e65)['send'](_0x3b1d7d);};}exports[_0x0458('0x37')]=function(_0x2905a4,_0x1e45b5){var _0x754d74={},_0x2ff3ab={},_0x4d57a3={'count':0x0,'rows':[]};var _0xe28213=_[_0x0458('0x38')](db[_0x0458('0x39')][_0x0458('0x3a')],function(_0x18ec57){return{'name':_0x18ec57[_0x0458('0x3b')],'type':_0x18ec57['type']['key']};});_0x2ff3ab[_0x0458('0x3c')]=_['map'](_0xe28213,'name');_0x2ff3ab[_0x0458('0x3d')]=_[_0x0458('0x3e')](_0x2905a4[_0x0458('0x3d')]);_0x2ff3ab[_0x0458('0x3f')]=_['intersection'](_0x2ff3ab[_0x0458('0x3c')],_0x2ff3ab[_0x0458('0x3d')]);_0x754d74['attributes']=_[_0x0458('0x40')](_0x2ff3ab[_0x0458('0x3c')],qs[_0x0458('0x41')](_0x2905a4[_0x0458('0x3d')][_0x0458('0x41')]));_0x754d74[_0x0458('0x42')]=_0x754d74['attributes'][_0x0458('0x43')]?_0x754d74['attributes']:_0x2ff3ab[_0x0458('0x3c')];if(!_0x2905a4['query'][_0x0458('0x44')]('nolimit')){_0x754d74[_0x0458('0x2e')]=qs[_0x0458('0x2e')](_0x2905a4[_0x0458('0x3d')][_0x0458('0x2e')]);_0x754d74[_0x0458('0x2d')]=qs[_0x0458('0x2d')](_0x2905a4[_0x0458('0x3d')][_0x0458('0x2d')]);}_0x754d74[_0x0458('0x45')]=qs[_0x0458('0x46')](_0x2905a4[_0x0458('0x3d')]['sort']);_0x754d74[_0x0458('0x47')]=qs[_0x0458('0x3f')](_[_0x0458('0x48')](_0x2905a4[_0x0458('0x3d')],_0x2ff3ab[_0x0458('0x3f')]),_0xe28213);if(_0x2905a4['query']['filter']){_0x754d74['where']=_[_0x0458('0x49')](_0x754d74['where'],{'$or':_[_0x0458('0x38')](_0xe28213,function(_0x3ff470){if(_0x3ff470[_0x0458('0x4a')]!==_0x0458('0x4b')){var _0x1c2362={};_0x1c2362[_0x3ff470['name']]={'$like':'%'+_0x2905a4['query'][_0x0458('0x4c')]+'%'};return _0x1c2362;}})});}_0x754d74=_[_0x0458('0x49')]({},_0x754d74,_0x2905a4[_0x0458('0x4d')]);var _0x541ae4={'where':_0x754d74[_0x0458('0x47')]};return db[_0x0458('0x39')][_0x0458('0x30')](_0x541ae4)[_0x0458('0x34')](function(_0x349d32){_0x4d57a3[_0x0458('0x30')]=_0x349d32;if(_0x2905a4['query'][_0x0458('0x4e')]){_0x754d74['include']=[{'all':!![]}];}return db['ChatMessage'][_0x0458('0x4f')](_0x754d74);})[_0x0458('0x34')](function(_0x170ce8){_0x4d57a3[_0x0458('0x50')]=_0x170ce8;return _0x4d57a3;})[_0x0458('0x34')](respondWithFilteredResult(_0x1e45b5,_0x754d74))[_0x0458('0x28')](handleError(_0x1e45b5,null));};exports[_0x0458('0x51')]=function(_0x2e76b4,_0x3a4ba6){var _0x32c3dd={'raw':!![],'where':{'id':_0x2e76b4['params']['id']}},_0x7768f={};_0x7768f[_0x0458('0x3c')]=_[_0x0458('0x3e')](db[_0x0458('0x39')][_0x0458('0x3a')]);_0x7768f[_0x0458('0x3d')]=_['keys'](_0x2e76b4[_0x0458('0x3d')]);_0x7768f[_0x0458('0x3f')]=_[_0x0458('0x40')](_0x7768f['model'],_0x7768f[_0x0458('0x3d')]);_0x32c3dd[_0x0458('0x42')]=_[_0x0458('0x40')](_0x7768f[_0x0458('0x3c')],qs[_0x0458('0x41')](_0x2e76b4[_0x0458('0x3d')][_0x0458('0x41')]));_0x32c3dd[_0x0458('0x42')]=_0x32c3dd[_0x0458('0x42')][_0x0458('0x43')]?_0x32c3dd[_0x0458('0x42')]:_0x7768f[_0x0458('0x3c')];if(_0x2e76b4[_0x0458('0x3d')][_0x0458('0x4e')]){_0x32c3dd[_0x0458('0x52')]=[{'all':!![]}];}_0x32c3dd=_[_0x0458('0x49')]({},_0x32c3dd,_0x2e76b4['options']);return db['ChatMessage'][_0x0458('0x53')](_0x32c3dd)[_0x0458('0x34')](handleEntityNotFound(_0x3a4ba6,null))[_0x0458('0x34')](respondWithResult(_0x3a4ba6,null))[_0x0458('0x28')](handleError(_0x3a4ba6,null));};exports[_0x0458('0x54')]=function(_0x38cf6d,_0x1f14c5){return db[_0x0458('0x39')][_0x0458('0x54')](_0x38cf6d[_0x0458('0x55')],{})[_0x0458('0x34')](respondWithResult(_0x1f14c5,0xc9))[_0x0458('0x28')](handleError(_0x1f14c5,null));};exports['update']=function(_0x4014e3,_0x58857e){if(_0x4014e3['body']['id']){delete _0x4014e3[_0x0458('0x55')]['id'];}return db[_0x0458('0x39')][_0x0458('0x53')]({'where':{'id':_0x4014e3['params']['id']}})[_0x0458('0x34')](handleEntityNotFound(_0x58857e,null))['then'](saveUpdates(_0x4014e3[_0x0458('0x55')],null))[_0x0458('0x34')](respondWithResult(_0x58857e,null))[_0x0458('0x28')](handleError(_0x58857e,null));};exports[_0x0458('0x35')]=function(_0x3bbc80,_0x4fb1cb){return db[_0x0458('0x39')][_0x0458('0x53')]({'where':{'id':_0x3bbc80[_0x0458('0x56')]['id']}})[_0x0458('0x34')](handleEntityNotFound(_0x4fb1cb,null))[_0x0458('0x34')](removeEntity(_0x4fb1cb,null))[_0x0458('0x28')](handleError(_0x4fb1cb,null));};exports[_0x0458('0x57')]=function(_0x5bae36,_0x6bb4c1){return db['ChatMessage'][_0x0458('0x57')]()[_0x0458('0x34')](respondWithResult(_0x6bb4c1,null))['catch'](handleError(_0x6bb4c1,null));};var interaction_log=require(_0x0458('0x58'))(_0x0458('0x59'));exports[_0x0458('0x5a')]=function(_0x1d09ed,_0xa4a72a,_0x55693d){var _0x58654c={'agent':{},'channel':_0x0458('0x5b')};if(_0x1d09ed[_0x0458('0x55')]['id']){delete _0x1d09ed[_0x0458('0x55')]['id'];}_0x1d09ed[_0x0458('0x55')][_0x0458('0x5c')]=!![];_0x1d09ed[_0x0458('0x55')][_0x0458('0x5d')]=moment()[_0x0458('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')]=_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')]||_0x1d09ed['user']['id'];_0x58654c['agent']['id']=_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')];return db[_0x0458('0x39')]['find']({'where':{'id':_0x1d09ed[_0x0458('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xa4a72a,null))[_0x0458('0x34')](saveUpdates(_0x1d09ed['body'],null))['then'](function(_0x362f5b){if(_0x362f5b){_0x58654c[_0x0458('0x26')]=_0x362f5b[_0x0458('0x60')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x362f5b[_0x0458('0x61')]}});}return null;})[_0x0458('0x34')](handleEntityNotFound(_0xa4a72a,null))[_0x0458('0x34')](function(_0x59cbc7){if(_0x59cbc7){return _0x59cbc7[_0x0458('0x62')]({'UserId':_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')],'read1stAt':_[_0x0458('0x63')](_0x59cbc7[_0x0458('0x64')])?moment()[_0x0458('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x31da7f){if(_0x31da7f){_0x58654c[_0x0458('0x65')]=_0x31da7f[_0x0458('0x60')]({'plain':!![]});interaction_log[_0x0458('0x20')](_0x0458('0x66'),_0x1d09ed[_0x0458('0x67')]['id'],_0x1d09ed[_0x0458('0x67')][_0x0458('0x36')],_0x1d09ed[_0x0458('0x67')][_0x0458('0x68')],_0x58654c[_0x0458('0x65')]['id'],_0x1d09ed[_0x0458('0x55')]?JSON[_0x0458('0x24')](_0x1d09ed['body']):_0x0458('0x69'));return respondWithRpcPromise(_0x0458('0x6a'),_0x0458('0x6b'),_0x58654c);}return null;})[_0x0458('0x34')](function(_0x2b9446){var _0x2df0a8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b9446[_0x0458('0x26')][_0x0458('0x6c')];return db[_0x0458('0x6d')][_0x0458('0x3d')](_0x2df0a8,{'type':db[_0x0458('0x6e')][_0x0458('0x6f')][_0x0458('0x70')],'raw':!![]})[_0x0458('0x34')](function(_0x2ad9f0){return _0x2ad9f0;});})[_0x0458('0x34')](function(_0x4ea3f0){if(_0x4ea3f0){_0x58654c['message'][_0x0458('0x71')]=_0x4ea3f0[0x0];if(!_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')])return;return db[_0x0458('0x72')][_0x0458('0x53')]({'where':{'id':_0x1d09ed[_0x0458('0x55')][_0x0458('0x5f')],'role':_0x0458('0x73')},'attributes':['id','name',_0x0458('0x74'),_0x0458('0x75'),_0x0458('0x76')],'raw':!![]});}return null;})[_0x0458('0x34')](function(_0x1aaf65){if(!_0x1aaf65)return null;_0x58654c[_0x0458('0x26')][_0x0458('0x73')]=_0x1aaf65;return _0x58654c;})[_0x0458('0x34')](function(_0x17c782){if(_0x17c782){if(_0x1d09ed['body']['manual']){_0x58654c[_0x0458('0x26')][_0x0458('0x77')]=util[_0x0458('0x5e')]('SIP/%s',_0x1d09ed[_0x0458('0x67')]['name']);_0x58654c[_0x0458('0x26')][_0x0458('0x78')]=_0x58654c[_0x0458('0x78')];_0x58654c['message'][_0x0458('0x79')]=_0x58654c[_0x0458('0x78')];_0x58654c['message']['event']='accept';return respondWithRpcPromise(_0x0458('0x7a'),_0x0458('0x7a'),{'event':'acceptmessage','message':_[_0x0458('0x49')](_0x58654c[_0x0458('0x26')],JSON[_0x0458('0x7b')](_0x58654c['interaction']['formData']))},client9002)[_0x0458('0x34')](function(){return _0x58654c;});}return _0x58654c;}return null;})[_0x0458('0x34')](respondWithResult(_0xa4a72a,null))[_0x0458('0x28')](handleError(_0xa4a72a,null));};var interaction_log=require(_0x0458('0x58'))(_0x0458('0x59'));exports[_0x0458('0x33')]=function(_0x4be26d,_0x3d7ff0,_0x2e72eb){var _0x58b3be={'agent':{},'channel':_0x0458('0x5b')};if(_0x4be26d[_0x0458('0x55')]['id']){delete _0x4be26d[_0x0458('0x55')]['id'];}_0x4be26d[_0x0458('0x55')][_0x0458('0x5f')]=_0x4be26d[_0x0458('0x55')]['UserId']||_0x4be26d[_0x0458('0x67')]['id'];_0x58b3be[_0x0458('0x73')]['id']=_0x4be26d[_0x0458('0x55')]['UserId'];return db['ChatMessage'][_0x0458('0x53')]({'where':{'id':_0x4be26d['params']['id'],'UserId':null}})[_0x0458('0x34')](handleEntityNotFound(_0x3d7ff0,null))[_0x0458('0x34')](function(_0x3636b6){if(_0x3636b6){_0x58b3be[_0x0458('0x26')]=_0x3636b6['get']({'plain':!![]});return db[_0x0458('0x7c')]['find']({'where':{'id':_0x3636b6[_0x0458('0x61')]}});}return null;})[_0x0458('0x34')](handleEntityNotFound(_0x3d7ff0,null))['then'](function(_0x4c8e5e){if(_0x4c8e5e){_0x58b3be[_0x0458('0x65')]=_0x4c8e5e[_0x0458('0x60')]({'plain':!![]});interaction_log[_0x0458('0x20')](_0x0458('0x7d'),_0x4be26d[_0x0458('0x67')]['id'],_0x4be26d[_0x0458('0x67')][_0x0458('0x36')],_0x4be26d[_0x0458('0x67')]['role'],_0x58b3be[_0x0458('0x65')]['id'],_0x4be26d[_0x0458('0x55')]?JSON[_0x0458('0x24')](_0x4be26d[_0x0458('0x55')]):_0x0458('0x69'));return respondWithRpcPromise(_0x0458('0x7e'),_0x0458('0x7f'),_0x58b3be);}return null;})[_0x0458('0x34')](function(_0x2eac78){var _0x3ed047=_0x0458('0x80')+_0x2eac78[_0x0458('0x26')][_0x0458('0x6c')];return db[_0x0458('0x6d')][_0x0458('0x3d')](_0x3ed047,{'type':db[_0x0458('0x6e')][_0x0458('0x6f')][_0x0458('0x70')],'raw':!![]})['then'](function(_0x36a2e6){return _0x36a2e6;});})[_0x0458('0x34')](function(_0x4fc6ef){if(_0x4fc6ef){_0x58b3be[_0x0458('0x26')][_0x0458('0x71')]=_0x4fc6ef[0x0];if(!_0x4be26d['body'][_0x0458('0x5f')])return;return db['User'][_0x0458('0x53')]({'where':{'id':_0x4be26d['body'][_0x0458('0x5f')],'role':_0x0458('0x73')},'attributes':['id',_0x0458('0x36'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x0458('0x34')](function(_0xcd6c6e){if(!_0xcd6c6e)return null;_0x58b3be[_0x0458('0x26')][_0x0458('0x73')]=_0xcd6c6e;return _0x58b3be;})['then'](function(_0x215598){if(_0x215598){_0x215598[_0x0458('0x26')][_0x0458('0x77')]=util['format'](_0x0458('0x81'),_0x4be26d[_0x0458('0x67')][_0x0458('0x36')]);_0x215598[_0x0458('0x26')][_0x0458('0x78')]=_0x58b3be['channel'];_0x215598[_0x0458('0x26')][_0x0458('0x79')]=_0x58b3be[_0x0458('0x78')];_0x215598[_0x0458('0x26')][_0x0458('0x82')]=_0x0458('0x33');respondWithRpcPromise(_0x0458('0x7a'),_0x0458('0x7a'),{'event':_0x0458('0x83'),'message':_[_0x0458('0x49')](_0x58b3be['message'],JSON[_0x0458('0x7b')](_0x58b3be[_0x0458('0x65')][_0x0458('0x84')]))},client9002);return _0x58b3be;}return null;})[_0x0458('0x34')](respondWithResult(_0x3d7ff0,null))[_0x0458('0x28')](handleError(_0x3d7ff0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 769a6a0..678d198 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 _0x54aa=['../../mysqldb','ChatMessage','save','emit','exports','events'];(function(_0x238cd5,_0x5eaefc){var _0x196bfb=function(_0x5c7d53){while(--_0x5c7d53){_0x238cd5['push'](_0x238cd5['shift']());}};_0x196bfb(++_0x5eaefc);}(_0x54aa,0x1a9));var _0xa54a=function(_0x596c48,_0x5f4b40){_0x596c48=_0x596c48-0x0;var _0x2508d0=_0x54aa[_0x596c48];return _0x2508d0;};'use strict';var EventEmitter=require(_0xa54a('0x0'));var ChatMessage=require(_0xa54a('0x1'))['db'][_0xa54a('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa54a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x11e72c){return function(_0x53829d,_0x5147b6,_0x35d176){ChatMessageEvents['emit'](_0x11e72c+':'+_0x53829d['id'],_0x53829d);ChatMessageEvents[_0xa54a('0x4')](_0x11e72c,_0x53829d);_0x35d176(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xa54a('0x5')]=ChatMessageEvents; \ No newline at end of file +var _0x6e6d=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x1e4a4a,_0x625229){var _0x215c1d=function(_0x2d6a79){while(--_0x2d6a79){_0x1e4a4a['push'](_0x1e4a4a['shift']());}};_0x215c1d(++_0x625229);}(_0x6e6d,0x7d));var _0xd6e6=function(_0x3c6022,_0x5c4610){_0x3c6022=_0x3c6022-0x0;var _0x54fcd2=_0x6e6d[_0x3c6022];return _0x54fcd2;};'use strict';var EventEmitter=require(_0xd6e6('0x0'));var ChatMessage=require(_0xd6e6('0x1'))['db'][_0xd6e6('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd6e6('0x3')](0x0);var events={'afterCreate':_0xd6e6('0x4'),'afterUpdate':_0xd6e6('0x5'),'afterDestroy':_0xd6e6('0x6')};function emitEvent(_0x143fc1){return function(_0x39747c,_0x23e654,_0x4d9e98){ChatMessageEvents[_0xd6e6('0x7')](_0x143fc1+':'+_0x39747c['id'],_0x39747c);ChatMessageEvents[_0xd6e6('0x7')](_0x143fc1,_0x39747c);_0x4d9e98(null);};}for(var e in events){if(events[_0xd6e6('0x8')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xd6e6('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index dbbf3f3..c4de903 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 _0x1403=['secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x289874,_0x1b6752){var _0x2f8bbb=function(_0x23ee80){while(--_0x23ee80){_0x289874['push'](_0x289874['shift']());}};_0x2f8bbb(++_0x1b6752);}(_0x1403,0x9b));var _0x3140=function(_0x4873e7,_0xadd09b){_0x4873e7=_0x4873e7-0x0;var _0x589ef4=_0x1403[_0x4873e7];return _0x589ef4;};'use strict';var _=require('lodash');var util=require(_0x3140('0x0'));var logger=require(_0x3140('0x1'))(_0x3140('0x2'));var moment=require(_0x3140('0x3'));var BPromise=require(_0x3140('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3140('0x5'));var rimraf=require(_0x3140('0x6'));var config=require(_0x3140('0x7'));var attributes=require(_0x3140('0x8'));module['exports']=function(_0x5cb034,_0x5cfeb0){return _0x5cb034[_0x3140('0x9')](_0x3140('0xa'),attributes,{'tableName':_0x3140('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x3140('0xc')],'type':_0x3140('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47d0f4,_0x269c6b,_0xa63ba6){var _0x2491e3=_0x5cb034[_0x3140('0xe')];var _0x35818a=_0x47d0f4[_0x3140('0xf')]({'plain':!![]});if(_0x35818a[_0x3140('0x10')][_0x3140('0x11')]()==='in'||_0x35818a[_0x3140('0x10')][_0x3140('0x11')]()===_0x3140('0x12')&&!_0x35818a[_0x3140('0x13')]&&!_[_0x3140('0x14')](_0x35818a[_0x3140('0x15')])){_0x2491e3[_0x3140('0x16')][_0x3140('0x17')]({'where':{'id':_0x35818a[_0x3140('0x18')]}})['then'](function(_0x505750){if(_0x505750){_0x505750['update']({'lastMsgAt':_0x35818a[_0x3140('0x19')],'lastMsgDirection':_0x35818a[_0x3140('0x10')][_0x3140('0x11')]()});}})['catch'](function(_0x136b5b){console[_0x3140('0x1a')](_0x136b5b);});}_0xa63ba6();}},'charset':_0x3140('0x1b'),'collate':_0x3140('0x1c')});}; \ No newline at end of file +var _0xccfc=['then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','ChatMessage','chat_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId'];(function(_0x176108,_0x21f3b8){var _0x1f2f7c=function(_0x32a8b4){while(--_0x32a8b4){_0x176108['push'](_0x176108['shift']());}};_0x1f2f7c(++_0x21f3b8);}(_0xccfc,0x19a));var _0xcccf=function(_0x50b94a,_0x3445be){_0x50b94a=_0x50b94a-0x0;var _0x38b60c=_0xccfc[_0x50b94a];return _0x38b60c;};'use strict';var _=require(_0xcccf('0x0'));var util=require(_0xcccf('0x1'));var logger=require('../../config/logger')(_0xcccf('0x2'));var moment=require(_0xcccf('0x3'));var BPromise=require(_0xcccf('0x4'));var rp=require(_0xcccf('0x5'));var fs=require('fs');var path=require(_0xcccf('0x6'));var rimraf=require(_0xcccf('0x7'));var config=require('../../config/environment');var attributes=require(_0xcccf('0x8'));module['exports']=function(_0x57f6e2,_0x74b960){return _0x57f6e2['define'](_0xcccf('0x9'),attributes,{'tableName':_0xcccf('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xcccf('0xb')],'type':_0xcccf('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xcbcef8,_0x5f269f,_0x1eb048){var _0xb95854=_0x57f6e2[_0xcccf('0xd')];var _0x6c691=_0xcbcef8['get']({'plain':!![]});if(_0x6c691[_0xcccf('0xe')][_0xcccf('0xf')]()==='in'||_0x6c691['direction']['toLowerCase']()==='out'&&!_0x6c691[_0xcccf('0x10')]&&!_[_0xcccf('0x11')](_0x6c691[_0xcccf('0x12')])){_0xb95854[_0xcccf('0x13')][_0xcccf('0x14')]({'where':{'id':_0x6c691[_0xcccf('0x15')]}})[_0xcccf('0x16')](function(_0x2a8cc9){if(_0x2a8cc9){_0x2a8cc9[_0xcccf('0x17')]({'lastMsgAt':_0x6c691[_0xcccf('0x18')],'lastMsgDirection':_0x6c691[_0xcccf('0xe')][_0xcccf('0xf')]()});}})['catch'](function(_0x12050e){console['error'](_0x12050e);});}_0x1eb048();}},'charset':_0xcccf('0x19'),'collate':_0xcccf('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 2aa7d8b..4dc7d2b 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 _0xd399=['http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','ChatMessage','create','body','options','CreateChatMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3251d0,_0x4d310c){var _0x28dd57=function(_0x19bcb4){while(--_0x19bcb4){_0x3251d0['push'](_0x3251d0['shift']());}};_0x28dd57(++_0x4d310c);}(_0xd399,0x181));var _0x9d39=function(_0x4d71b7,_0x3a110d){_0x4d71b7=_0x4d71b7-0x0;var _0x252631=_0xd399[_0x4d71b7];return _0x252631;};'use strict';var _=require(_0x9d39('0x0'));var util=require(_0x9d39('0x1'));var moment=require(_0x9d39('0x2'));var BPromise=require(_0x9d39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d39('0x4'));var db=require(_0x9d39('0x5'))['db'];var utils=require(_0x9d39('0x6'));var logger=require(_0x9d39('0x7'))(_0x9d39('0x8'));var config=require('../../config/environment');var jayson=require(_0x9d39('0x9'));var client=jayson[_0x9d39('0xa')][_0x9d39('0xb')]({'port':0x232a});config['redis']=_[_0x9d39('0xc')](config[_0x9d39('0xd')],{'host':_0x9d39('0xe'),'port':0x18eb});var socket=require(_0x9d39('0xf'))(new Redis(config[_0x9d39('0xd')]));require(_0x9d39('0x10'))[_0x9d39('0x11')](socket);function respondWithRpcPromise(_0x482e61,_0x49a963,_0x1b4583){return new BPromise(function(_0x17d13e,_0x43572f){return client[_0x9d39('0x12')](_0x482e61,_0x1b4583)[_0x9d39('0x13')](function(_0x2886e6){logger[_0x9d39('0x14')]('ChatMessage,\x20%s,\x20%s',_0x49a963,'request\x20sent');logger[_0x9d39('0x15')](_0x9d39('0x16'),_0x49a963,_0x9d39('0x17'),JSON[_0x9d39('0x18')](_0x2886e6));if(_0x2886e6[_0x9d39('0x19')]){if(_0x2886e6[_0x9d39('0x19')][_0x9d39('0x1a')]===0x1f4){logger[_0x9d39('0x19')]('ChatMessage,\x20%s,\x20%s',_0x49a963,_0x2886e6[_0x9d39('0x19')][_0x9d39('0x1b')]);return _0x43572f(_0x2886e6[_0x9d39('0x19')][_0x9d39('0x1b')]);}logger[_0x9d39('0x19')]('ChatMessage,\x20%s,\x20%s',_0x49a963,_0x2886e6[_0x9d39('0x19')][_0x9d39('0x1b')]);return _0x17d13e(_0x2886e6[_0x9d39('0x19')]['message']);}else{logger['info'](_0x9d39('0x1c'),_0x49a963,_0x9d39('0x17'));_0x17d13e(_0x2886e6[_0x9d39('0x1d')]['message']);}})[_0x9d39('0x1e')](function(_0x8f9a6c){logger[_0x9d39('0x19')](_0x9d39('0x1c'),_0x49a963,_0x8f9a6c);_0x43572f(_0x8f9a6c);});});}exports['CreateChatMessage']=function(_0x48c2fd){var _0x750458=this;return new Promise(function(_0x284f67,_0xd2ced7){return db[_0x9d39('0x1f')][_0x9d39('0x20')](_0x48c2fd[_0x9d39('0x21')],{'raw':_0x48c2fd[_0x9d39('0x22')]?_0x48c2fd['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x23f0fe){logger[_0x9d39('0x14')](_0x9d39('0x23'),_0x48c2fd);logger[_0x9d39('0x15')](_0x9d39('0x23'),_0x48c2fd,JSON['stringify'](_0x23f0fe));_0x284f67(_0x23f0fe);})[_0x9d39('0x1e')](function(_0x406060){logger[_0x9d39('0x19')](_0x9d39('0x23'),_0x406060['message'],_0x48c2fd);_0xd2ced7(_0x750458[_0x9d39('0x19')](0x1f4,_0x406060[_0x9d39('0x1b')]));});});}; \ No newline at end of file +var _0xa40d=['body','options','raw','info','CreateChatMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ChatMessage','create'];(function(_0x629f05,_0x3f7c6f){var _0x4119ea=function(_0x5b3ba2){while(--_0x5b3ba2){_0x629f05['push'](_0x629f05['shift']());}};_0x4119ea(++_0x3f7c6f);}(_0xa40d,0x140));var _0xda40=function(_0x3e29df,_0x42fdf8){_0x3e29df=_0x3e29df-0x0;var _0x3e3ba9=_0xa40d[_0x3e29df];return _0x3e3ba9;};'use strict';var _=require(_0xda40('0x0'));var util=require(_0xda40('0x1'));var moment=require(_0xda40('0x2'));var BPromise=require(_0xda40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda40('0x4'));var db=require(_0xda40('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda40('0x6'))(_0xda40('0x7'));var config=require('../../config/environment');var jayson=require(_0xda40('0x8'));var client=jayson[_0xda40('0x9')][_0xda40('0xa')]({'port':0x232a});config[_0xda40('0xb')]=_[_0xda40('0xc')](config[_0xda40('0xb')],{'host':_0xda40('0xd'),'port':0x18eb});var socket=require(_0xda40('0xe'))(new Redis(config[_0xda40('0xb')]));require(_0xda40('0xf'))[_0xda40('0x10')](socket);function respondWithRpcPromise(_0x87c09f,_0x57e818,_0x828ace){return new BPromise(function(_0x4fdf7,_0x4008cb){return client[_0xda40('0x11')](_0x87c09f,_0x828ace)[_0xda40('0x12')](function(_0x2099a8){logger['info'](_0xda40('0x13'),_0x57e818,_0xda40('0x14'));logger[_0xda40('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x57e818,_0xda40('0x14'),JSON[_0xda40('0x16')](_0x2099a8));if(_0x2099a8[_0xda40('0x17')]){if(_0x2099a8['error'][_0xda40('0x18')]===0x1f4){logger['error'](_0xda40('0x13'),_0x57e818,_0x2099a8[_0xda40('0x17')][_0xda40('0x19')]);return _0x4008cb(_0x2099a8['error'][_0xda40('0x19')]);}logger[_0xda40('0x17')](_0xda40('0x13'),_0x57e818,_0x2099a8[_0xda40('0x17')][_0xda40('0x19')]);return _0x4fdf7(_0x2099a8[_0xda40('0x17')]['message']);}else{logger['info'](_0xda40('0x13'),_0x57e818,_0xda40('0x14'));_0x4fdf7(_0x2099a8[_0xda40('0x1a')][_0xda40('0x19')]);}})[_0xda40('0x1b')](function(_0x1a2770){logger[_0xda40('0x17')](_0xda40('0x13'),_0x57e818,_0x1a2770);_0x4008cb(_0x1a2770);});});}exports['CreateChatMessage']=function(_0x289bd5){var _0x50eed8=this;return new Promise(function(_0x303d45,_0x207410){return db[_0xda40('0x1c')][_0xda40('0x1d')](_0x289bd5[_0xda40('0x1e')],{'raw':_0x289bd5['options']?_0x289bd5[_0xda40('0x1f')][_0xda40('0x20')]===undefined?!![]:![]:!![]})[_0xda40('0x12')](function(_0x4eb632){logger[_0xda40('0x21')](_0xda40('0x22'),_0x289bd5);logger[_0xda40('0x15')](_0xda40('0x22'),_0x289bd5,JSON[_0xda40('0x16')](_0x4eb632));_0x303d45(_0x4eb632);})[_0xda40('0x1b')](function(_0xaa3258){logger['error'](_0xda40('0x22'),_0xaa3258[_0xda40('0x19')],_0x289bd5);_0x207410(_0x50eed8[_0xda40('0x17')](0x1f4,_0xaa3258['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a467ca0..f173584 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 _0x60c2=['removeListener','register','length','save','remove','update','emit'];(function(_0x527771,_0x466d7b){var _0x1e9a21=function(_0x67cad8){while(--_0x67cad8){_0x527771['push'](_0x527771['shift']());}};_0x1e9a21(++_0x466d7b);}(_0x60c2,0x8f));var _0x260c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x60c2[_0xa464c9];return _0x3d73c4;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x260c('0x0'),_0x260c('0x1'),_0x260c('0x2')];function createListener(_0x3ad4c5,_0x2f5bc8){return function(_0x759b92){_0x2f5bc8[_0x260c('0x3')](_0x3ad4c5,_0x759b92);};}function removeListener(_0x309bde,_0x17a599){return function(){ChatMessageEvents[_0x260c('0x4')](_0x309bde,_0x17a599);};}exports[_0x260c('0x5')]=function(_0x13c7d0){for(var _0x558b0c=0x0,_0x14fab2=events[_0x260c('0x6')];_0x558b0c<_0x14fab2;_0x558b0c++){var _0x3b432d=events[_0x558b0c];var _0xf22c37=createListener('chatMessage:'+_0x3b432d,_0x13c7d0);ChatMessageEvents['on'](_0x3b432d,_0xf22c37);}}; \ No newline at end of file +var _0xb66c=['chatMessage:','./chatMessage.events','remove','removeListener','register','length'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0xb66c,0x175));var _0xcb66=function(_0xc5d436,_0x3fb8b8){_0xc5d436=_0xc5d436-0x0;var _0x1ac952=_0xb66c[_0xc5d436];return _0x1ac952;};'use strict';var ChatMessageEvents=require(_0xcb66('0x0'));var events=['save',_0xcb66('0x1'),'update'];function createListener(_0x2afcb8,_0x24ea13){return function(_0xf7ccc5){_0x24ea13['emit'](_0x2afcb8,_0xf7ccc5);};}function removeListener(_0x35d439,_0x386241){return function(){ChatMessageEvents[_0xcb66('0x2')](_0x35d439,_0x386241);};}exports[_0xcb66('0x3')]=function(_0x5d766d){for(var _0x518163=0x0,_0x19adf5=events[_0xcb66('0x4')];_0x518163<_0x19adf5;_0x518163++){var _0xa3993=events[_0x518163];var _0x439f3d=createListener(_0xcb66('0x5')+_0xa3993,_0x5d766d);ChatMessageEvents['on'](_0xa3993,_0x439f3d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 69bfecb..ed5aee1 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 _0x3dcb=['../../config/environment','isAuthenticated','get','/describe','describe','show','post','chat','chatmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29e24c,_0x168327){var _0x1bfa32=function(_0x46f400){while(--_0x46f400){_0x29e24c['push'](_0x29e24c['shift']());}};_0x1bfa32(++_0x168327);}(_0x3dcb,0x13d));var _0xb3dc=function(_0x4f5a83,_0x2e5c25){_0x4f5a83=_0x4f5a83-0x0;var _0xd165f9=_0x3dcb[_0x4f5a83];return _0xd165f9;};'use strict';var multer=require(_0xb3dc('0x0'));var util=require(_0xb3dc('0x1'));var path=require(_0xb3dc('0x2'));var timeout=require(_0xb3dc('0x3'));var express=require('express');var router=express[_0xb3dc('0x4')]();var fs_extra=require(_0xb3dc('0x5'));var auth=require(_0xb3dc('0x6'));var interaction=require(_0xb3dc('0x7'));var config=require(_0xb3dc('0x8'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0xb3dc('0x9')](),controller['index']);router[_0xb3dc('0xa')](_0xb3dc('0xb'),auth[_0xb3dc('0x9')](),controller[_0xb3dc('0xc')]);router[_0xb3dc('0xa')]('/:id',auth[_0xb3dc('0x9')](),controller[_0xb3dc('0xd')]);router[_0xb3dc('0xe')]('/',auth[_0xb3dc('0x9')](),interaction['tracked'](_0xb3dc('0xf'),_0xb3dc('0x10')),controller[_0xb3dc('0x11')]);router[_0xb3dc('0x12')](_0xb3dc('0x13'),controller[_0xb3dc('0x14')]);router['put'](_0xb3dc('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0xb3dc('0x12')](_0xb3dc('0x16'),auth[_0xb3dc('0x9')](),controller['reject']);router[_0xb3dc('0x17')]('/:id',auth[_0xb3dc('0x9')](),controller[_0xb3dc('0x18')]);module['exports']=router; \ No newline at end of file +var _0x7b6e=['reject','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','chatmessage:create','create','update','put','/:id/accept','accept'];(function(_0x4bddb3,_0x54faf0){var _0x198ed7=function(_0x263bd7){while(--_0x263bd7){_0x4bddb3['push'](_0x4bddb3['shift']());}};_0x198ed7(++_0x54faf0);}(_0x7b6e,0x117));var _0xe7b6=function(_0x132887,_0x8a429e){_0x132887=_0x132887-0x0;var _0x4edd79=_0x7b6e[_0x132887];return _0x4edd79;};'use strict';var multer=require('multer');var util=require(_0xe7b6('0x0'));var path=require('path');var timeout=require(_0xe7b6('0x1'));var express=require(_0xe7b6('0x2'));var router=express[_0xe7b6('0x3')]();var fs_extra=require(_0xe7b6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe7b6('0x5'));var config=require(_0xe7b6('0x6'));var controller=require(_0xe7b6('0x7'));router[_0xe7b6('0x8')]('/',auth[_0xe7b6('0x9')](),controller[_0xe7b6('0xa')]);router['get']('/describe',auth[_0xe7b6('0x9')](),controller[_0xe7b6('0xb')]);router[_0xe7b6('0x8')](_0xe7b6('0xc'),auth[_0xe7b6('0x9')](),controller[_0xe7b6('0xd')]);router[_0xe7b6('0xe')]('/',auth[_0xe7b6('0x9')](),interaction['tracked']('chat',_0xe7b6('0xf')),controller[_0xe7b6('0x10')]);router['put']('/:id',controller[_0xe7b6('0x11')]);router[_0xe7b6('0x12')](_0xe7b6('0x13'),auth[_0xe7b6('0x9')](),controller[_0xe7b6('0x14')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xe7b6('0x15')]);router[_0xe7b6('0x16')]('/:id',auth[_0xe7b6('0x9')](),controller[_0xe7b6('0x17')]);module[_0xe7b6('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ff5c171..265d42b 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 _0x757a=['exports','TEXT'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x757a,0xde));var _0xa757=function(_0x10734c,_0x5ba664){_0x10734c=_0x10734c-0x0;var _0x40e81d=_0x757a[_0x10734c];return _0x40e81d;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x40d042,_0x3ed545){var _0x5b4901=function(_0x3a0f75){while(--_0x3a0f75){_0x40d042['push'](_0x40d042['shift']());}};_0x5b4901(++_0x3ed545);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 525bd4b..64906a6 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x495e47,_0x1cfb0e){var _0x2ce11c=function(_0x43057f){while(--_0x43057f){_0x495e47['push'](_0x495e47['shift']());}};_0x2ce11c(++_0x1cfb0e);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x7a54,0x106));var _0x47a5=function(_0x5b5088,_0xa04f3f){_0x5b5088=_0x5b5088-0x0;var _0x22f947=_0x7a54[_0x5b5088];return _0x22f947;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 712d6eb..8bc93d3 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 _0xa6a4=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove'];(function(_0x43fba9,_0x36b884){var _0x24cb3e=function(_0x7f8441){while(--_0x7f8441){_0x43fba9['push'](_0x43fba9['shift']());}};_0x24cb3e(++_0x36b884);}(_0xa6a4,0xe9));var _0x4a6a=function(_0x43fb6b,_0xd25c0f){_0x43fb6b=_0x43fb6b-0x0;var _0x16dd9e=_0xa6a4[_0x43fb6b];return _0x16dd9e;};'use strict';var EventEmitter=require(_0x4a6a('0x0'));var ChatOfflineMessage=require(_0x4a6a('0x1'))['db'][_0x4a6a('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4a6a('0x3')](0x0);var events={'afterCreate':_0x4a6a('0x4'),'afterUpdate':_0x4a6a('0x5'),'afterDestroy':_0x4a6a('0x6')};function emitEvent(_0x1d70ef){return function(_0x5f53ea,_0x4a946a,_0x36aa0c){ChatOfflineMessageEvents[_0x4a6a('0x7')](_0x1d70ef+':'+_0x5f53ea['id'],_0x5f53ea);ChatOfflineMessageEvents[_0x4a6a('0x7')](_0x1d70ef,_0x5f53ea);_0x36aa0c(null);};}for(var e in events){if(events[_0x4a6a('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x4a6a('0x9')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x6a33=['hook','exports','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x48b819,_0x5159df){var _0x16b470=function(_0x46083e){while(--_0x46083e){_0x48b819['push'](_0x48b819['shift']());}};_0x16b470(++_0x5159df);}(_0x6a33,0x9b));var _0x36a3=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x6a33[_0x47fd36];return _0x21a0fc;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require('../../mysqldb')['db'][_0x36a3('0x0')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x36a3('0x1')](0x0);var events={'afterCreate':_0x36a3('0x2'),'afterUpdate':_0x36a3('0x3'),'afterDestroy':_0x36a3('0x4')};function emitEvent(_0x441486){return function(_0x3c14af,_0x99f59b,_0x46bb4c){ChatOfflineMessageEvents[_0x36a3('0x5')](_0x441486+':'+_0x3c14af['id'],_0x3c14af);ChatOfflineMessageEvents[_0x36a3('0x5')](_0x441486,_0x3c14af);_0x46bb4c(null);};}for(var e in events){if(events[_0x36a3('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x36a3('0x7')](e,emitEvent(event));}}module[_0x36a3('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2571d00..4efe412 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 _0x52f6=['utf8mb4','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x2493a0,_0x30e38d){var _0x261a78=function(_0x309150){while(--_0x309150){_0x2493a0['push'](_0x2493a0['shift']());}};_0x261a78(++_0x30e38d);}(_0x52f6,0x157));var _0x652f=function(_0x38448c,_0xf81883){_0x38448c=_0x38448c-0x0;var _0x441f82=_0x52f6[_0x38448c];return _0x441f82;};'use strict';var attributes=require(_0x652f('0x0'));module[_0x652f('0x1')]=function(_0x33bc2f){return _0x33bc2f[_0x652f('0x2')](_0x652f('0x3'),attributes,{'tableName':_0x652f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x652f('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1f46=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x2a390b,_0xf49f9b){var _0x5df10a=function(_0x115dbe){while(--_0x115dbe){_0x2a390b['push'](_0x2a390b['shift']());}};_0x5df10a(++_0xf49f9b);}(_0x1f46,0x1b4));var _0x61f4=function(_0x11cd43,_0x1e235e){_0x11cd43=_0x11cd43-0x0;var _0x5ef8d5=_0x1f46[_0x11cd43];return _0x5ef8d5;};'use strict';var attributes=require(_0x61f4('0x0'));module[_0x61f4('0x1')]=function(_0x5aeda4){return _0x5aeda4[_0x61f4('0x2')](_0x61f4('0x3'),attributes,{'tableName':_0x61f4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x61f4('0x5'),'collate':_0x61f4('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 942cef7..29dfdd2 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 _0x6726=['request\x20sent','debug','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x46c644,_0x5eca5a){var _0x1058fa=function(_0x28073f){while(--_0x28073f){_0x46c644['push'](_0x46c644['shift']());}};_0x1058fa(++_0x5eca5a);}(_0x6726,0xdb));var _0x6672=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x6726[_0x65c903];return _0x23e1d7;};'use strict';var _=require('lodash');var util=require(_0x6672('0x0'));var moment=require(_0x6672('0x1'));var BPromise=require('bluebird');var rs=require(_0x6672('0x2'));var fs=require('fs');var Redis=require(_0x6672('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6672('0x4'));var logger=require('../../config/logger')(_0x6672('0x5'));var config=require(_0x6672('0x6'));var jayson=require(_0x6672('0x7'));var client=jayson[_0x6672('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa1d3b7,_0x303146,_0x263321){return new BPromise(function(_0x379b90,_0xc53855){return client[_0x6672('0x9')](_0xa1d3b7,_0x263321)[_0x6672('0xa')](function(_0x3c093b){logger[_0x6672('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x303146,_0x6672('0xc'));logger[_0x6672('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x303146,_0x6672('0xc'),JSON[_0x6672('0xe')](_0x3c093b));if(_0x3c093b[_0x6672('0xf')]){if(_0x3c093b[_0x6672('0xf')][_0x6672('0x10')]===0x1f4){logger[_0x6672('0xf')](_0x6672('0x11'),_0x303146,_0x3c093b[_0x6672('0xf')][_0x6672('0x12')]);return _0xc53855(_0x3c093b['error'][_0x6672('0x12')]);}logger[_0x6672('0xf')](_0x6672('0x11'),_0x303146,_0x3c093b[_0x6672('0xf')][_0x6672('0x12')]);return _0x379b90(_0x3c093b[_0x6672('0xf')][_0x6672('0x12')]);}else{logger['info'](_0x6672('0x11'),_0x303146,_0x6672('0xc'));_0x379b90(_0x3c093b[_0x6672('0x13')][_0x6672('0x12')]);}})[_0x6672('0x14')](function(_0x6884f){logger[_0x6672('0xf')](_0x6672('0x11'),_0x303146,_0x6884f);_0xc53855(_0x6884f);});});} \ No newline at end of file +var _0x68b8=['request','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x68b8,0x1d8));var _0x868b=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0x68b8[_0x4d8789];return _0x404e41;};'use strict';var _=require(_0x868b('0x0'));var util=require(_0x868b('0x1'));var moment=require(_0x868b('0x2'));var BPromise=require(_0x868b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x868b('0x4'));var db=require(_0x868b('0x5'))['db'];var utils=require(_0x868b('0x6'));var logger=require(_0x868b('0x7'))('rpc');var config=require(_0x868b('0x8'));var jayson=require(_0x868b('0x9'));var client=jayson['client'][_0x868b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x107cfe,_0x1d107d,_0x766ed3){return new BPromise(function(_0x17ce24,_0x157d0a){return client[_0x868b('0xb')](_0x107cfe,_0x766ed3)['then'](function(_0x53c451){logger['info'](_0x868b('0xc'),_0x1d107d,'request\x20sent');logger['debug'](_0x868b('0xd'),_0x1d107d,_0x868b('0xe'),JSON[_0x868b('0xf')](_0x53c451));if(_0x53c451[_0x868b('0x10')]){if(_0x53c451[_0x868b('0x10')][_0x868b('0x11')]===0x1f4){logger['error'](_0x868b('0xc'),_0x1d107d,_0x53c451[_0x868b('0x10')][_0x868b('0x12')]);return _0x157d0a(_0x53c451[_0x868b('0x10')][_0x868b('0x12')]);}logger['error'](_0x868b('0xc'),_0x1d107d,_0x53c451['error']['message']);return _0x17ce24(_0x53c451['error'][_0x868b('0x12')]);}else{logger['info'](_0x868b('0xc'),_0x1d107d,_0x868b('0xe'));_0x17ce24(_0x53c451[_0x868b('0x13')][_0x868b('0x12')]);}})[_0x868b('0x14')](function(_0x390010){logger[_0x868b('0x10')](_0x868b('0xc'),_0x1d107d,_0x390010);_0x157d0a(_0x390010);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index bdc43ab..f9abcc2 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 _0xe2c3=['isAuthenticated','index','describe','/:id','show','post','create','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get'];(function(_0x4f08dd,_0x3784ec){var _0x3017ee=function(_0x7d95be){while(--_0x7d95be){_0x4f08dd['push'](_0x4f08dd['shift']());}};_0x3017ee(++_0x3784ec);}(_0xe2c3,0x1c1));var _0x3e2c=function(_0x45bd84,_0x4a61bb){_0x45bd84=_0x45bd84-0x0;var _0x551b62=_0xe2c3[_0x45bd84];return _0x551b62;};'use strict';var multer=require(_0x3e2c('0x0'));var util=require(_0x3e2c('0x1'));var path=require(_0x3e2c('0x2'));var timeout=require(_0x3e2c('0x3'));var express=require('express');var router=express[_0x3e2c('0x4')]();var fs_extra=require(_0x3e2c('0x5'));var auth=require(_0x3e2c('0x6'));var interaction=require(_0x3e2c('0x7'));var config=require(_0x3e2c('0x8'));var controller=require(_0x3e2c('0x9'));router[_0x3e2c('0xa')]('/',auth[_0x3e2c('0xb')](),controller[_0x3e2c('0xc')]);router[_0x3e2c('0xa')]('/describe',auth[_0x3e2c('0xb')](),controller[_0x3e2c('0xd')]);router[_0x3e2c('0xa')](_0x3e2c('0xe'),auth[_0x3e2c('0xb')](),controller[_0x3e2c('0xf')]);router[_0x3e2c('0x10')]('/',auth[_0x3e2c('0xb')](),controller[_0x3e2c('0x11')]);router['put'](_0x3e2c('0xe'),auth[_0x3e2c('0xb')](),controller['update']);router[_0x3e2c('0x12')](_0x3e2c('0xe'),auth[_0x3e2c('0xb')](),controller['destroy']);module[_0x3e2c('0x13')]=router; \ No newline at end of file +var _0x6a41=['describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe'];(function(_0x426bb6,_0x14e2ea){var _0x3421ab=function(_0x341ccc){while(--_0x341ccc){_0x426bb6['push'](_0x426bb6['shift']());}};_0x3421ab(++_0x14e2ea);}(_0x6a41,0x105));var _0x16a4=function(_0xb3205f,_0x13694e){_0xb3205f=_0xb3205f-0x0;var _0x3eac2d=_0x6a41[_0xb3205f];return _0x3eac2d;};'use strict';var multer=require(_0x16a4('0x0'));var util=require(_0x16a4('0x1'));var path=require('path');var timeout=require(_0x16a4('0x2'));var express=require(_0x16a4('0x3'));var router=express[_0x16a4('0x4')]();var fs_extra=require(_0x16a4('0x5'));var auth=require(_0x16a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x16a4('0x7'));var controller=require(_0x16a4('0x8'));router['get']('/',auth[_0x16a4('0x9')](),controller['index']);router[_0x16a4('0xa')](_0x16a4('0xb'),auth['isAuthenticated'](),controller[_0x16a4('0xc')]);router['get'](_0x16a4('0xd'),auth[_0x16a4('0x9')](),controller[_0x16a4('0xe')]);router[_0x16a4('0xf')]('/',auth[_0x16a4('0x9')](),controller[_0x16a4('0x10')]);router[_0x16a4('0x11')](_0x16a4('0xd'),auth[_0x16a4('0x9')](),controller[_0x16a4('0x12')]);router['delete']('/:id',auth[_0x16a4('0x9')](),controller[_0x16a4('0x13')]);module[_0x16a4('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a9ac3a9..3509682 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 _0xaee1=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x51f2c0,_0xb7c46e){var _0x34ffd5=function(_0x2238c0){while(--_0x2238c0){_0x51f2c0['push'](_0x51f2c0['shift']());}};_0x34ffd5(++_0xb7c46e);}(_0xaee1,0x8a));var _0x1aee=function(_0x583c9c,_0x1cfa5a){_0x583c9c=_0x583c9c-0x0;var _0x3b5d86=_0xaee1[_0x583c9c];return _0x3b5d86;};'use strict';var Sequelize=require(_0x1aee('0x0'));module[_0x1aee('0x1')]={'name':{'type':Sequelize[_0x1aee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1aee('0x3')](_0x1aee('0x4'),_0x1aee('0x5')),'defaultValue':_0x1aee('0x4')},'selector':{'type':Sequelize[_0x1aee('0x2')]},'timeout':{'type':Sequelize[_0x1aee('0x6')]}}; \ No newline at end of file +var _0x2f3b=['exports','STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x2820c8,_0x9cc2c9){var _0x38c7ba=function(_0x80429){while(--_0x80429){_0x2820c8['push'](_0x2820c8['shift']());}};_0x38c7ba(++_0x9cc2c9);}(_0x2f3b,0xc6));var _0xb2f3=function(_0x4e64fc,_0x12bb94){_0x4e64fc=_0x4e64fc-0x0;var _0x3b6898=_0x2f3b[_0x4e64fc];return _0x3b6898;};'use strict';var Sequelize=require('sequelize');module[_0xb2f3('0x0')]={'name':{'type':Sequelize[_0xb2f3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb2f3('0x2')](_0xb2f3('0x3'),_0xb2f3('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xb2f3('0x1')]},'timeout':{'type':Sequelize[_0xb2f3('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index e45154a..81ccdd6 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 _0xab36=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0xb3b5ed,_0x386a22){var _0x373859=function(_0x2b71fb){while(--_0x2b71fb){_0xb3b5ed['push'](_0xb3b5ed['shift']());}};_0x373859(++_0x386a22);}(_0xab36,0x1df));var _0x6ab3=function(_0x1b673b,_0x3b3ac0){_0x1b673b=_0x1b673b-0x0;var _0x3ee6f0=_0xab36[_0x1b673b];return _0x3ee6f0;};'use strict';var emlformat=require(_0x6ab3('0x0'));var rimraf=require(_0x6ab3('0x1'));var zipdir=require(_0x6ab3('0x2'));var jsonpatch=require(_0x6ab3('0x3'));var rp=require(_0x6ab3('0x4'));var moment=require('moment');var BPromise=require(_0x6ab3('0x5'));var Mustache=require(_0x6ab3('0x6'));var util=require(_0x6ab3('0x7'));var path=require('path');var sox=require(_0x6ab3('0x8'));var csv=require(_0x6ab3('0x9'));var ejs=require(_0x6ab3('0xa'));var fs=require('fs');var fs_extra=require(_0x6ab3('0xb'));var _=require(_0x6ab3('0xc'));var squel=require(_0x6ab3('0xd'));var crypto=require('crypto');var jsforce=require(_0x6ab3('0xe'));var deskjs=require(_0x6ab3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6ab3('0x10'));var Papa=require('papaparse');var Redis=require(_0x6ab3('0x11'));var authService=require(_0x6ab3('0x12'));var qs=require(_0x6ab3('0x13'));var as=require(_0x6ab3('0x14'));var hardwareService=require(_0x6ab3('0x15'));var logger=require(_0x6ab3('0x16'))('api');var utils=require(_0x6ab3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6ab3('0x18'));var db=require(_0x6ab3('0x19'))['db'];function respondWithStatusCode(_0x183508,_0x2fe47b){_0x2fe47b=_0x2fe47b||0xcc;return function(_0x23d0ae){if(_0x23d0ae){return _0x183508['sendStatus'](_0x2fe47b);}return _0x183508[_0x6ab3('0x1a')](_0x2fe47b)[_0x6ab3('0x1b')]();};}function respondWithResult(_0x32acd8,_0x313481){_0x313481=_0x313481||0xc8;return function(_0x1412c2){if(_0x1412c2){return _0x32acd8['status'](_0x313481)[_0x6ab3('0x1c')](_0x1412c2);}};}function respondWithFilteredResult(_0x51a0c4,_0x246b5b){return function(_0x27595a){if(_0x27595a){var _0xc20d35=typeof _0x246b5b[_0x6ab3('0x1d')]===_0x6ab3('0x1e')&&typeof _0x246b5b[_0x6ab3('0x1f')]===_0x6ab3('0x1e');var _0xfa65b4=_0x27595a[_0x6ab3('0x20')];var _0x586dcb=_0xc20d35?0x0:_0x246b5b[_0x6ab3('0x1d')];var _0x5db46c=_0xc20d35?_0x27595a[_0x6ab3('0x20')]:_0x246b5b[_0x6ab3('0x1d')]+_0x246b5b[_0x6ab3('0x1f')];var _0x2c1b52;if(_0x5db46c>=_0xfa65b4){_0x5db46c=_0xfa65b4;_0x2c1b52=0xc8;}else{_0x2c1b52=0xce;}_0x51a0c4[_0x6ab3('0x1a')](_0x2c1b52);return _0x51a0c4[_0x6ab3('0x21')](_0x6ab3('0x22'),_0x586dcb+'-'+_0x5db46c+'/'+_0xfa65b4)['json'](_0x27595a);}return null;};}function patchUpdates(_0x253bb2){return function(_0x22b143){try{jsonpatch[_0x6ab3('0x23')](_0x22b143,_0x253bb2,!![]);}catch(_0x4cb92c){return BPromise[_0x6ab3('0x24')](_0x4cb92c);}return _0x22b143['save']();};}function saveUpdates(_0x4bf937,_0x1ac3c6){return function(_0x4e6680){if(_0x4e6680){return _0x4e6680[_0x6ab3('0x25')](_0x4bf937)[_0x6ab3('0x26')](function(_0x30aec0){return _0x30aec0;});}return null;};}function removeEntity(_0x1f0579,_0x344e9f){return function(_0x30af9e){if(_0x30af9e){return _0x30af9e[_0x6ab3('0x27')]()[_0x6ab3('0x26')](function(){_0x1f0579[_0x6ab3('0x1a')](0xcc)[_0x6ab3('0x1b')]();});}};}function handleEntityNotFound(_0x16cfb2,_0x1284d8){return function(_0x10d362){if(!_0x10d362){_0x16cfb2[_0x6ab3('0x28')](0x194);}return _0x10d362;};}function handleError(_0x5d75f6,_0x23cb5b){_0x23cb5b=_0x23cb5b||0x1f4;return function(_0x554cf0){logger[_0x6ab3('0x29')](_0x554cf0[_0x6ab3('0x2a')]);if(_0x554cf0[_0x6ab3('0x2b')]){delete _0x554cf0[_0x6ab3('0x2b')];}_0x5d75f6[_0x6ab3('0x1a')](_0x23cb5b)[_0x6ab3('0x2c')](_0x554cf0);};}exports['show']=function(_0x5b5647,_0x365edb){var _0x57c04b={'raw':!![],'where':{'id':_0x5b5647[_0x6ab3('0x2d')]['id']}},_0x5370d7={};_0x5370d7[_0x6ab3('0x2e')]=_[_0x6ab3('0x2f')](db[_0x6ab3('0x30')][_0x6ab3('0x31')]);_0x5370d7[_0x6ab3('0x32')]=_[_0x6ab3('0x2f')](_0x5b5647[_0x6ab3('0x32')]);_0x5370d7['filters']=_[_0x6ab3('0x33')](_0x5370d7[_0x6ab3('0x2e')],_0x5370d7[_0x6ab3('0x32')]);_0x57c04b[_0x6ab3('0x34')]=_[_0x6ab3('0x33')](_0x5370d7[_0x6ab3('0x2e')],qs[_0x6ab3('0x35')](_0x5b5647[_0x6ab3('0x32')]['fields']));_0x57c04b[_0x6ab3('0x34')]=_0x57c04b['attributes']['length']?_0x57c04b[_0x6ab3('0x34')]:_0x5370d7['model'];if(_0x5b5647[_0x6ab3('0x32')][_0x6ab3('0x36')]){_0x57c04b[_0x6ab3('0x37')]=[{'all':!![]}];}_0x57c04b=_[_0x6ab3('0x38')]({},_0x57c04b,_0x5b5647[_0x6ab3('0x39')]);return db[_0x6ab3('0x30')][_0x6ab3('0x3a')](_0x57c04b)[_0x6ab3('0x26')](handleEntityNotFound(_0x365edb,null))[_0x6ab3('0x26')](respondWithResult(_0x365edb,null))[_0x6ab3('0x3b')](handleError(_0x365edb,null));};exports[_0x6ab3('0x3c')]=function(_0x22e39a,_0xdfe14b){return db[_0x6ab3('0x30')]['create'](_0x22e39a[_0x6ab3('0x3d')],{})[_0x6ab3('0x26')](respondWithResult(_0xdfe14b,0xc9))[_0x6ab3('0x3b')](handleError(_0xdfe14b,null));};exports[_0x6ab3('0x25')]=function(_0x315c99,_0xd70937){if(_0x315c99['body']['id']){delete _0x315c99[_0x6ab3('0x3d')]['id'];}return db['ChatProactiveAction'][_0x6ab3('0x3a')]({'where':{'id':_0x315c99[_0x6ab3('0x2d')]['id']}})['then'](handleEntityNotFound(_0xd70937,null))[_0x6ab3('0x26')](saveUpdates(_0x315c99[_0x6ab3('0x3d')],null))['then'](respondWithResult(_0xd70937,null))['catch'](handleError(_0xd70937,null));};exports[_0x6ab3('0x27')]=function(_0x4a3988,_0x2ec0c7){return db[_0x6ab3('0x30')]['find']({'where':{'id':_0x4a3988['params']['id']}})[_0x6ab3('0x26')](handleEntityNotFound(_0x2ec0c7,null))[_0x6ab3('0x26')](removeEntity(_0x2ec0c7,null))['catch'](handleError(_0x2ec0c7,null));}; \ No newline at end of file +var _0xf6c1=['count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','includeAll','include','options','catch','create','body','params','find','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3c3b8c,_0x440db6){var _0x2a377e=function(_0x52cf2c){while(--_0x52cf2c){_0x3c3b8c['push'](_0x3c3b8c['shift']());}};_0x2a377e(++_0x440db6);}(_0xf6c1,0x99));var _0x1f6c=function(_0x2d5beb,_0x552f69){_0x2d5beb=_0x2d5beb-0x0;var _0x134b5b=_0xf6c1[_0x2d5beb];return _0x134b5b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f6c('0x0'));var jsonpatch=require(_0x1f6c('0x1'));var rp=require(_0x1f6c('0x2'));var moment=require('moment');var BPromise=require(_0x1f6c('0x3'));var Mustache=require('mustache');var util=require(_0x1f6c('0x4'));var path=require(_0x1f6c('0x5'));var sox=require(_0x1f6c('0x6'));var csv=require(_0x1f6c('0x7'));var ejs=require(_0x1f6c('0x8'));var fs=require('fs');var fs_extra=require(_0x1f6c('0x9'));var _=require('lodash');var squel=require(_0x1f6c('0xa'));var crypto=require(_0x1f6c('0xb'));var jsforce=require(_0x1f6c('0xc'));var deskjs=require(_0x1f6c('0xd'));var toCsv=require(_0x1f6c('0x7'));var querystring=require(_0x1f6c('0xe'));var Papa=require(_0x1f6c('0xf'));var Redis=require(_0x1f6c('0x10'));var authService=require(_0x1f6c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f6c('0x12'))(_0x1f6c('0x13'));var utils=require(_0x1f6c('0x14'));var config=require(_0x1f6c('0x15'));var licenseUtil=require(_0x1f6c('0x16'));var db=require(_0x1f6c('0x17'))['db'];function respondWithStatusCode(_0x507a06,_0x7963a9){_0x7963a9=_0x7963a9||0xcc;return function(_0x1e7060){if(_0x1e7060){return _0x507a06[_0x1f6c('0x18')](_0x7963a9);}return _0x507a06[_0x1f6c('0x19')](_0x7963a9)[_0x1f6c('0x1a')]();};}function respondWithResult(_0x1315b7,_0x31fc67){_0x31fc67=_0x31fc67||0xc8;return function(_0x147c01){if(_0x147c01){return _0x1315b7['status'](_0x31fc67)[_0x1f6c('0x1b')](_0x147c01);}};}function respondWithFilteredResult(_0x302026,_0x26652b){return function(_0x43ce04){if(_0x43ce04){var _0xc8b6f2=typeof _0x26652b[_0x1f6c('0x1c')]==='undefined'&&typeof _0x26652b['limit']===_0x1f6c('0x1d');var _0x30a8dc=_0x43ce04['count'];var _0x2328f2=_0xc8b6f2?0x0:_0x26652b['offset'];var _0x31c887=_0xc8b6f2?_0x43ce04[_0x1f6c('0x1e')]:_0x26652b[_0x1f6c('0x1c')]+_0x26652b[_0x1f6c('0x1f')];var _0xd71b77;if(_0x31c887>=_0x30a8dc){_0x31c887=_0x30a8dc;_0xd71b77=0xc8;}else{_0xd71b77=0xce;}_0x302026[_0x1f6c('0x19')](_0xd71b77);return _0x302026[_0x1f6c('0x20')](_0x1f6c('0x21'),_0x2328f2+'-'+_0x31c887+'/'+_0x30a8dc)[_0x1f6c('0x1b')](_0x43ce04);}return null;};}function patchUpdates(_0x459944){return function(_0x44b1c5){try{jsonpatch[_0x1f6c('0x22')](_0x44b1c5,_0x459944,!![]);}catch(_0x196356){return BPromise[_0x1f6c('0x23')](_0x196356);}return _0x44b1c5[_0x1f6c('0x24')]();};}function saveUpdates(_0x55881f,_0x2644e9){return function(_0x511191){if(_0x511191){return _0x511191[_0x1f6c('0x25')](_0x55881f)[_0x1f6c('0x26')](function(_0x536eb6){return _0x536eb6;});}return null;};}function removeEntity(_0x1aa1f6,_0x4ef92a){return function(_0x32a812){if(_0x32a812){return _0x32a812[_0x1f6c('0x27')]()[_0x1f6c('0x26')](function(){_0x1aa1f6[_0x1f6c('0x19')](0xcc)[_0x1f6c('0x1a')]();});}};}function handleEntityNotFound(_0x386016,_0x8b998c){return function(_0x236f17){if(!_0x236f17){_0x386016[_0x1f6c('0x18')](0x194);}return _0x236f17;};}function handleError(_0x147385,_0x4ffb66){_0x4ffb66=_0x4ffb66||0x1f4;return function(_0xa16408){logger[_0x1f6c('0x28')](_0xa16408[_0x1f6c('0x29')]);if(_0xa16408['name']){delete _0xa16408[_0x1f6c('0x2a')];}_0x147385[_0x1f6c('0x19')](_0x4ffb66)[_0x1f6c('0x2b')](_0xa16408);};}exports[_0x1f6c('0x2c')]=function(_0xeaeccd,_0x15df56){var _0x51a230={'raw':!![],'where':{'id':_0xeaeccd['params']['id']}},_0x420853={};_0x420853[_0x1f6c('0x2d')]=_[_0x1f6c('0x2e')](db[_0x1f6c('0x2f')][_0x1f6c('0x30')]);_0x420853[_0x1f6c('0x31')]=_['keys'](_0xeaeccd[_0x1f6c('0x31')]);_0x420853['filters']=_['intersection'](_0x420853[_0x1f6c('0x2d')],_0x420853[_0x1f6c('0x31')]);_0x51a230[_0x1f6c('0x32')]=_[_0x1f6c('0x33')](_0x420853['model'],qs[_0x1f6c('0x34')](_0xeaeccd[_0x1f6c('0x31')][_0x1f6c('0x34')]));_0x51a230[_0x1f6c('0x32')]=_0x51a230[_0x1f6c('0x32')]['length']?_0x51a230['attributes']:_0x420853[_0x1f6c('0x2d')];if(_0xeaeccd[_0x1f6c('0x31')][_0x1f6c('0x35')]){_0x51a230[_0x1f6c('0x36')]=[{'all':!![]}];}_0x51a230=_['merge']({},_0x51a230,_0xeaeccd[_0x1f6c('0x37')]);return db['ChatProactiveAction']['find'](_0x51a230)[_0x1f6c('0x26')](handleEntityNotFound(_0x15df56,null))[_0x1f6c('0x26')](respondWithResult(_0x15df56,null))[_0x1f6c('0x38')](handleError(_0x15df56,null));};exports[_0x1f6c('0x39')]=function(_0x44f909,_0x271aa0){return db[_0x1f6c('0x2f')][_0x1f6c('0x39')](_0x44f909[_0x1f6c('0x3a')],{})[_0x1f6c('0x26')](respondWithResult(_0x271aa0,0xc9))[_0x1f6c('0x38')](handleError(_0x271aa0,null));};exports[_0x1f6c('0x25')]=function(_0x16e207,_0x2fc1c6){if(_0x16e207[_0x1f6c('0x3a')]['id']){delete _0x16e207[_0x1f6c('0x3a')]['id'];}return db[_0x1f6c('0x2f')]['find']({'where':{'id':_0x16e207[_0x1f6c('0x3b')]['id']}})[_0x1f6c('0x26')](handleEntityNotFound(_0x2fc1c6,null))[_0x1f6c('0x26')](saveUpdates(_0x16e207[_0x1f6c('0x3a')],null))[_0x1f6c('0x26')](respondWithResult(_0x2fc1c6,null))['catch'](handleError(_0x2fc1c6,null));};exports['destroy']=function(_0x29a9ef,_0x845949){return db[_0x1f6c('0x2f')][_0x1f6c('0x3c')]({'where':{'id':_0x29a9ef[_0x1f6c('0x3b')]['id']}})[_0x1f6c('0x26')](handleEntityNotFound(_0x845949,null))['then'](removeEntity(_0x845949,null))[_0x1f6c('0x38')](handleError(_0x845949,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 681b57d..72837fa 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 _0x22f0=['api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x1ec8b7,_0x1d1b94){var _0x281722=function(_0x556075){while(--_0x556075){_0x1ec8b7['push'](_0x1ec8b7['shift']());}};_0x281722(++_0x1d1b94);}(_0x22f0,0xf9));var _0x022f=function(_0x2c6a9c,_0x244ed9){_0x2c6a9c=_0x2c6a9c-0x0;var _0x21591f=_0x22f0[_0x2c6a9c];return _0x21591f;};'use strict';var _=require(_0x022f('0x0'));var util=require(_0x022f('0x1'));var logger=require(_0x022f('0x2'))(_0x022f('0x3'));var moment=require(_0x022f('0x4'));var BPromise=require('bluebird');var rp=require(_0x022f('0x5'));var fs=require('fs');var path=require(_0x022f('0x6'));var rimraf=require(_0x022f('0x7'));var config=require(_0x022f('0x8'));var attributes=require(_0x022f('0x9'));module[_0x022f('0xa')]=function(_0x1ad02f,_0x10f4bd){return _0x1ad02f[_0x022f('0xb')](_0x022f('0xc'),attributes,{'tableName':_0x022f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbb8=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash'];(function(_0x2a87fe,_0x52c61c){var _0x539085=function(_0x966460){while(--_0x966460){_0x2a87fe['push'](_0x2a87fe['shift']());}};_0x539085(++_0x52c61c);}(_0xdbb8,0xe3));var _0x8dbb=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xdbb8[_0x59bcb1];return _0x4a737f;};'use strict';var _=require(_0x8dbb('0x0'));var util=require(_0x8dbb('0x1'));var logger=require(_0x8dbb('0x2'))(_0x8dbb('0x3'));var moment=require(_0x8dbb('0x4'));var BPromise=require(_0x8dbb('0x5'));var rp=require(_0x8dbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8dbb('0x7'));var config=require('../../config/environment');var attributes=require(_0x8dbb('0x8'));module[_0x8dbb('0x9')]=function(_0x3f86ca,_0x1199af){return _0x3f86ca[_0x8dbb('0xa')]('ChatProactiveAction',attributes,{'tableName':_0x8dbb('0xb'),'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 7146693..843b9b4 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 _0xa117=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','lodash','util'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0xa117,0x11c));var _0x7a11=function(_0x348567,_0x151fc1){_0x348567=_0x348567-0x0;var _0x2deeef=_0xa117[_0x348567];return _0x2deeef;};'use strict';var _=require(_0x7a11('0x0'));var util=require(_0x7a11('0x1'));var moment=require(_0x7a11('0x2'));var BPromise=require(_0x7a11('0x3'));var rs=require(_0x7a11('0x4'));var fs=require('fs');var Redis=require(_0x7a11('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a11('0x6'));var logger=require(_0x7a11('0x7'))(_0x7a11('0x8'));var config=require(_0x7a11('0x9'));var jayson=require(_0x7a11('0xa'));var client=jayson['client'][_0x7a11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x385b18,_0x41306b,_0x5814bc){return new BPromise(function(_0x4879df,_0x276463){return client['request'](_0x385b18,_0x5814bc)[_0x7a11('0xc')](function(_0x44a722){logger[_0x7a11('0xd')](_0x7a11('0xe'),_0x41306b,'request\x20sent');logger[_0x7a11('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x41306b,'request\x20sent',JSON[_0x7a11('0x10')](_0x44a722));if(_0x44a722['error']){if(_0x44a722[_0x7a11('0x11')][_0x7a11('0x12')]===0x1f4){logger[_0x7a11('0x11')](_0x7a11('0xe'),_0x41306b,_0x44a722[_0x7a11('0x11')]['message']);return _0x276463(_0x44a722[_0x7a11('0x11')][_0x7a11('0x13')]);}logger[_0x7a11('0x11')](_0x7a11('0xe'),_0x41306b,_0x44a722['error'][_0x7a11('0x13')]);return _0x4879df(_0x44a722[_0x7a11('0x11')][_0x7a11('0x13')]);}else{logger[_0x7a11('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x41306b,_0x7a11('0x14'));_0x4879df(_0x44a722[_0x7a11('0x15')][_0x7a11('0x13')]);}})['catch'](function(_0x4e3818){logger[_0x7a11('0x11')](_0x7a11('0xe'),_0x41306b,_0x4e3818);_0x276463(_0x4e3818);});});} \ No newline at end of file +var _0x2972=['code','message','ChatProactiveAction,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0x2972,0x144));var _0x2297=function(_0x21a59d,_0x1d8c25){_0x21a59d=_0x21a59d-0x0;var _0x3fc7ae=_0x2972[_0x21a59d];return _0x3fc7ae;};'use strict';var _=require(_0x2297('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2297('0x1'));var rs=require(_0x2297('0x2'));var fs=require('fs');var Redis=require(_0x2297('0x3'));var db=require(_0x2297('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2297('0x5'))(_0x2297('0x6'));var config=require(_0x2297('0x7'));var jayson=require(_0x2297('0x8'));var client=jayson[_0x2297('0x9')][_0x2297('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f65a3,_0x4d0c06,_0x50bff7){return new BPromise(function(_0x41f7a0,_0x414dbb){return client[_0x2297('0xb')](_0x4f65a3,_0x50bff7)['then'](function(_0x845a95){logger[_0x2297('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x4d0c06,_0x2297('0xd'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4d0c06,_0x2297('0xd'),JSON[_0x2297('0xe')](_0x845a95));if(_0x845a95[_0x2297('0xf')]){if(_0x845a95[_0x2297('0xf')][_0x2297('0x10')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x4d0c06,_0x845a95[_0x2297('0xf')][_0x2297('0x11')]);return _0x414dbb(_0x845a95['error'][_0x2297('0x11')]);}logger['error'](_0x2297('0x12'),_0x4d0c06,_0x845a95[_0x2297('0xf')][_0x2297('0x11')]);return _0x41f7a0(_0x845a95[_0x2297('0xf')][_0x2297('0x11')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x4d0c06,'request\x20sent');_0x41f7a0(_0x845a95['result'][_0x2297('0x11')]);}})[_0x2297('0x13')](function(_0x38d337){logger[_0x2297('0xf')](_0x2297('0x12'),_0x4d0c06,_0x38d337);_0x414dbb(_0x38d337);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index f71d08d..b5b52cc 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 _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x5b449b,_0x5fdca9){_0x5b449b=_0x5b449b-0x0;var _0x43660a=_0xb4c7[_0x5b449b];return _0x43660a;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file +var _0x2675=['../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','express','Router'];(function(_0x3344ed,_0x555e9d){var _0x1196de=function(_0x18312b){while(--_0x18312b){_0x3344ed['push'](_0x3344ed['shift']());}};_0x1196de(++_0x555e9d);}(_0x2675,0x75));var _0x5267=function(_0x1c947f,_0x347428){_0x1c947f=_0x1c947f-0x0;var _0x2618da=_0x2675[_0x1c947f];return _0x2618da;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller[_0x5267('0x9')]);router[_0x5267('0xa')]('/',auth['isAuthenticated'](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x8')](),controller['update']);router[_0x5267('0xd')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller['destroy']);module[_0x5267('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 7cc356b..72199b7 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 _0xeac8=['STRING','name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x13c304,_0x4791de){var _0x12696e=function(_0x2070d4){while(--_0x2070d4){_0x13c304['push'](_0x13c304['shift']());}};_0x12696e(++_0x4791de);}(_0xeac8,0x1d6));var _0x8eac=function(_0x2e8496,_0xa4934a){_0x2e8496=_0x2e8496-0x0;var _0x31979b=_0xeac8[_0x2e8496];return _0x31979b;};'use strict';var Sequelize=require(_0x8eac('0x0'));module[_0x8eac('0x1')]={'name':{'type':Sequelize[_0x8eac('0x2')],'unique':_0x8eac('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8eac('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8eac('0x4')](_0x8eac('0x5'),_0x8eac('0x6'),_0x8eac('0x7'))}}; \ No newline at end of file +var _0xb3b7=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x1d2d4c,_0x340107){var _0x58ed56=function(_0xf95ad){while(--_0xf95ad){_0x1d2d4c['push'](_0x1d2d4c['shift']());}};_0x58ed56(++_0x340107);}(_0xb3b7,0xdf));var _0x7b3b=function(_0x40c370,_0x421b26){_0x40c370=_0x40c370-0x0;var _0x326048=_0xb3b7[_0x40c370];return _0x326048;};'use strict';var Sequelize=require(_0x7b3b('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b3b('0x1')],'unique':_0x7b3b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7b3b('0x1')]},'timeout':{'type':Sequelize[_0x7b3b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7b3b('0x4')]('rrmemory',_0x7b3b('0x5'),_0x7b3b('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 1b56e4f..2100079 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 _0x272f=['lodash','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','type','getOptions','include','rows','catch','params','model','keys','rawAttributes','query','filters','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','destroy','describe','getMembers','intersection','hasOwnProperty','nolimit','sort','where','pick','ChatQueueId','filter','UserChatQueue','findAll','User','findAndCountAll','UserId','agent','format','SIP','chatPause','createdAt','updatedAt','getTeams','findOne','Team','order','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','removeTeams','select','tq.TeamId','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util'];(function(_0x543f4d,_0x5953de){var _0x173378=function(_0x59aaff){while(--_0x59aaff){_0x543f4d['push'](_0x543f4d['shift']());}};_0x173378(++_0x5953de);}(_0x272f,0x1ee));var _0xf272=function(_0x225c4b,_0x45d0e9){_0x225c4b=_0x225c4b-0x0;var _0x3305b1=_0x272f[_0x225c4b];return _0x3305b1;};'use strict';var BPromise=require(_0xf272('0x0'));var util=require(_0xf272('0x1'));var _=require(_0xf272('0x2'));var squel=require(_0xf272('0x3'));var Redis=require(_0xf272('0x4'));var qs=require(_0xf272('0x5'));var logger=require('../../config/logger')(_0xf272('0x6'));var config=require('../../config/environment');var db=require(_0xf272('0x7'))['db'];config[_0xf272('0x8')]=_['defaults'](config[_0xf272('0x8')],{'host':_0xf272('0x9'),'port':0x18eb});var socket=require(_0xf272('0xa'))(new Redis(config[_0xf272('0x8')]));require(_0xf272('0xb'))[_0xf272('0xc')](socket);function respondWithStatusCode(_0x248ebc,_0x52769c){_0x52769c=_0x52769c||0xcc;return function(_0x849b2c){if(_0x849b2c){return _0x248ebc[_0xf272('0xd')](_0x52769c);}return _0x248ebc['status'](_0x52769c)[_0xf272('0xe')]();};}function respondWithResult(_0x265db8,_0x433a28){_0x433a28=_0x433a28||0xc8;return function(_0x3fea1b){if(_0x3fea1b){return _0x265db8[_0xf272('0xf')](_0x433a28)[_0xf272('0x10')](_0x3fea1b);}};}function respondWithFilteredResult(_0xb4f29e,_0x107e5c){return function(_0x991223){if(_0x991223){var _0x231901=typeof _0x107e5c['offset']===_0xf272('0x11')&&typeof _0x107e5c[_0xf272('0x12')]===_0xf272('0x11');var _0x4bfcf4=_0x991223[_0xf272('0x13')];var _0x505152=_0x231901?0x0:_0x107e5c[_0xf272('0x14')];var _0x4895e4=_0x231901?_0x991223[_0xf272('0x13')]:_0x107e5c[_0xf272('0x14')]+_0x107e5c[_0xf272('0x12')];var _0x2214f4;if(_0x4895e4>=_0x4bfcf4){_0x4895e4=_0x4bfcf4;_0x2214f4=0xc8;}else{_0x2214f4=0xce;}_0xb4f29e['status'](_0x2214f4);return _0xb4f29e[_0xf272('0x15')](_0xf272('0x16'),_0x505152+'-'+_0x4895e4+'/'+_0x4bfcf4)[_0xf272('0x10')](_0x991223);}return null;};}function saveUpdates(_0x26f93a){return function(_0x3f640c){if(_0x3f640c){return _0x3f640c[_0xf272('0x17')](_0x26f93a)[_0xf272('0x18')](function(_0x570a67){return _0x570a67;});}return null;};}function removeEntity(_0x4fb668){return function(_0x1c9620){if(_0x1c9620){return _0x1c9620['destroy']()['then'](function(){var _0x501675=_0x1c9620[_0xf272('0x19')]({'plain':!![]});var _0x2c68d0=_0xf272('0x1a');return db[_0xf272('0x1b')]['destroy']({'where':{'type':_0x2c68d0,'resourceId':_0x501675['id']}})['then'](function(){return _0x1c9620;});})['then'](function(){_0x4fb668[_0xf272('0xf')](0xcc)[_0xf272('0xe')]();});}};}function handleEntityNotFound(_0x46ec78){return function(_0x314337){if(!_0x314337){_0x46ec78[_0xf272('0xd')](0x194);}return _0x314337;};}function handleError(_0x1596e9,_0x59d556){_0x59d556=_0x59d556||0x1f4;return function(_0xb7cccb){logger[_0xf272('0x1c')](_0xb7cccb[_0xf272('0x1d')]);if(_0xb7cccb[_0xf272('0x1e')]){delete _0xb7cccb['name'];}_0x1596e9['status'](_0x59d556)[_0xf272('0x1f')](_0xb7cccb);};}exports[_0xf272('0x20')]=function(_0xcbf388,_0x1bddd1){var _0x29a87a={};var _0x5d6449={'count':0x0,'rows':[]};var _0x3db6b5=_[_0xf272('0x21')](db[_0xf272('0x22')]['rawAttributes'],function(_0x398a6d){return{'name':_0x398a6d['fieldName'],'type':_0x398a6d[_0xf272('0x23')]['key']};});_0x29a87a=qs[_0xf272('0x24')](_0x3db6b5,_0xcbf388);var _0x58ddaf={'where':_0x29a87a['where']};return db[_0xf272('0x22')][_0xf272('0x13')](_0x58ddaf)[_0xf272('0x18')](function(_0x571746){_0x5d6449[_0xf272('0x13')]=_0x571746;_0x29a87a[_0xf272('0x25')]=qs[_0xf272('0x25')](_0xcbf388['query']);return db[_0xf272('0x22')]['findAll'](_0x29a87a);})[_0xf272('0x18')](function(_0x273cd6){_0x5d6449[_0xf272('0x26')]=_0x273cd6;return _0x5d6449;})[_0xf272('0x18')](respondWithFilteredResult(_0x1bddd1,_0x29a87a))[_0xf272('0x27')](handleError(_0x1bddd1,null));};exports['show']=function(_0x2f1b53,_0x2bce85){var _0x176fdf={'raw':!![],'where':{'id':_0x2f1b53[_0xf272('0x28')]['id']}},_0x1ee4fa={};_0x1ee4fa[_0xf272('0x29')]=_[_0xf272('0x2a')](db[_0xf272('0x22')][_0xf272('0x2b')]);_0x1ee4fa[_0xf272('0x2c')]=_[_0xf272('0x2a')](_0x2f1b53[_0xf272('0x2c')]);_0x1ee4fa[_0xf272('0x2d')]=_['intersection'](_0x1ee4fa[_0xf272('0x29')],_0x1ee4fa[_0xf272('0x2c')]);_0x176fdf[_0xf272('0x2e')]=_['intersection'](_0x1ee4fa[_0xf272('0x29')],qs['fields'](_0x2f1b53[_0xf272('0x2c')][_0xf272('0x2f')]));_0x176fdf[_0xf272('0x2e')]=_0x176fdf[_0xf272('0x2e')][_0xf272('0x30')]?_0x176fdf['attributes']:_0x1ee4fa[_0xf272('0x29')];if(_0x2f1b53[_0xf272('0x2c')][_0xf272('0x31')]){_0x176fdf['include']=[{'all':!![]}];}_0x176fdf=_[_0xf272('0x32')]({},_0x176fdf,_0x2f1b53[_0xf272('0x33')]);return db['ChatQueue'][_0xf272('0x34')](_0x176fdf)['then'](handleEntityNotFound(_0x2bce85,null))[_0xf272('0x18')](respondWithResult(_0x2bce85,null))['catch'](handleError(_0x2bce85,null));};exports[_0xf272('0x35')]=function(_0x381655,_0x1ab4de){return db[_0xf272('0x22')][_0xf272('0x35')](_0x381655[_0xf272('0x36')],{})['then'](function(_0x393778){var _0xc02997=_0x381655['user'][_0xf272('0x19')]({'plain':!![]});if(!_0xc02997)throw new Error(_0xf272('0x37'));if(_0xc02997[_0xf272('0x38')]===_0xf272('0x39')){var _0x9461b4=_0x393778[_0xf272('0x19')]({'plain':!![]});var _0xba876=_0xf272('0x1a');return db[_0xf272('0x3a')]['find']({'where':{'name':_0xba876,'userProfileId':_0xc02997[_0xf272('0x3b')]},'raw':!![]})[_0xf272('0x18')](function(_0x22dc79){if(_0x22dc79&&_0x22dc79[_0xf272('0x3c')]===0x0){return db[_0xf272('0x1b')][_0xf272('0x35')]({'name':_0x9461b4['name'],'resourceId':_0x9461b4['id'],'type':_0x22dc79['name'],'sectionId':_0x22dc79['id']},{})['then'](function(){return _0x393778;});}else{return _0x393778;}})[_0xf272('0x27')](function(_0xd1f941){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd1f941);throw _0xd1f941;});}return _0x393778;})[_0xf272('0x18')](respondWithResult(_0x1ab4de,0xc9))[_0xf272('0x27')](handleError(_0x1ab4de,null));};exports[_0xf272('0x17')]=function(_0x4ee7d9,_0x15853f){if(_0x4ee7d9[_0xf272('0x36')]['id']){delete _0x4ee7d9[_0xf272('0x36')]['id'];}return db[_0xf272('0x22')][_0xf272('0x34')]({'where':{'id':_0x4ee7d9[_0xf272('0x28')]['id']}})['then'](handleEntityNotFound(_0x15853f,null))[_0xf272('0x18')](saveUpdates(_0x4ee7d9[_0xf272('0x36')],null))[_0xf272('0x18')](respondWithResult(_0x15853f,null))['catch'](handleError(_0x15853f,null));};exports[_0xf272('0x3d')]=function(_0x47e1f7,_0x5b4d8b){return db[_0xf272('0x22')]['find']({'where':{'id':_0x47e1f7[_0xf272('0x28')]['id']}})[_0xf272('0x18')](handleEntityNotFound(_0x5b4d8b,null))[_0xf272('0x18')](removeEntity(_0x5b4d8b,null))['catch'](handleError(_0x5b4d8b,null));};exports[_0xf272('0x3e')]=function(_0x45a672,_0x4eedbe){return db[_0xf272('0x22')][_0xf272('0x3e')]()[_0xf272('0x18')](respondWithResult(_0x4eedbe,null))[_0xf272('0x27')](handleError(_0x4eedbe,null));};exports[_0xf272('0x3f')]=function(_0x45d335,_0x15f662){var _0x12d767={'raw':!![],'where':{}},_0x5c57ab={},_0x45a9b0;return db['ChatQueue']['findOne']({'where':{'id':_0x45d335[_0xf272('0x28')]['id']}})[_0xf272('0x18')](handleEntityNotFound(_0x15f662,null))['then'](function(_0x212225){if(_0x212225){_0x45a9b0=_0x212225[_0xf272('0x19')]({'plain':!![]});_0x5c57ab['model']=_[_0xf272('0x2a')](db['UserChatQueue']['rawAttributes']);_0x5c57ab[_0xf272('0x2c')]=_['keys'](_0x45d335['query']);_0x5c57ab[_0xf272('0x2d')]=_[_0xf272('0x40')](_0x5c57ab[_0xf272('0x29')],_0x5c57ab[_0xf272('0x2c')]);_0x12d767[_0xf272('0x2e')]=_[_0xf272('0x40')](_0x5c57ab['model'],qs[_0xf272('0x2f')](_0x45d335['query'][_0xf272('0x2f')]));_0x12d767['attributes']=_0x12d767[_0xf272('0x2e')]['length']?_0x12d767[_0xf272('0x2e')]:_0x5c57ab['model'];if(!_0x45d335[_0xf272('0x2c')][_0xf272('0x41')](_0xf272('0x42'))){_0x12d767['limit']=qs[_0xf272('0x12')](_0x45d335[_0xf272('0x2c')][_0xf272('0x12')]);_0x12d767[_0xf272('0x14')]=qs[_0xf272('0x14')](_0x45d335[_0xf272('0x2c')][_0xf272('0x14')]);}_0x12d767['order']=qs[_0xf272('0x43')](_0x45d335[_0xf272('0x2c')][_0xf272('0x43')]);_0x12d767[_0xf272('0x44')]=qs['filters'](_[_0xf272('0x45')](_0x45d335[_0xf272('0x2c')],_0x5c57ab[_0xf272('0x2d')]));_0x12d767[_0xf272('0x44')][_0xf272('0x46')]=_0x212225['id'];if(_0x45d335[_0xf272('0x2c')][_0xf272('0x47')]){_0x12d767[_0xf272('0x44')]=_['merge'](_0x12d767['where'],{'$or':_[_0xf272('0x21')](_0x12d767[_0xf272('0x2e')],function(_0x71664e){var _0x415d2f={};_0x415d2f[_0x71664e]={'$like':'%'+_0x45d335['query'][_0xf272('0x47')]+'%'};return _0x415d2f;})});}_0x12d767=_[_0xf272('0x32')]({},_0x12d767,_0x45d335[_0xf272('0x33')]);return db[_0xf272('0x48')][_0xf272('0x49')](_0x12d767);}})[_0xf272('0x18')](function(_0x23c0ff){if(_0x23c0ff){return db[_0xf272('0x4a')][_0xf272('0x4b')]({'where':{'id':_[_0xf272('0x21')](_0x23c0ff,_0xf272('0x4c')),'role':_0xf272('0x4d')},'attributes':['id','name','chatPause','updatedAt','createdAt']});}})[_0xf272('0x18')](function(_0x972763){if(_0x972763){return{'count':_0x972763[_0xf272('0x13')],'rows':_[_0xf272('0x21')](_0x972763[_0xf272('0x26')],function(_0x13f37f){return{'membername':_0x13f37f[_0xf272('0x1e')],'UserId':_0x13f37f['id'],'queue_name':_0x45a9b0[_0xf272('0x1e')],'ChatQueueId':_0x45a9b0['id'],'interface':util[_0xf272('0x4e')]('%s/%s',_0xf272('0x4f'),_0x13f37f[_0xf272('0x1e')]),'penalty':0x0,'paused':_0x13f37f[_0xf272('0x50')],'createdAt':_0x13f37f[_0xf272('0x51')],'updatedAt':_0x13f37f[_0xf272('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf272('0x18')](respondWithFilteredResult(_0x15f662,_0x12d767))['catch'](handleError(_0x15f662,null));};exports[_0xf272('0x53')]=function(_0x5cb010,_0x5387be){var _0x4e53d4={};var _0x2f0ba7={};var _0x535c00;var _0x5d1104;return db['ChatQueue'][_0xf272('0x54')]({'where':{'id':_0x5cb010[_0xf272('0x28')]['id']}})[_0xf272('0x18')](handleEntityNotFound(_0x5387be,null))[_0xf272('0x18')](function(_0x4f89b3){if(_0x4f89b3){_0x535c00=_0x4f89b3;_0x2f0ba7[_0xf272('0x29')]=_[_0xf272('0x2a')](db[_0xf272('0x55')][_0xf272('0x2b')]);_0x2f0ba7[_0xf272('0x2c')]=_[_0xf272('0x2a')](_0x5cb010[_0xf272('0x2c')]);_0x2f0ba7[_0xf272('0x2d')]=_['intersection'](_0x2f0ba7[_0xf272('0x29')],_0x2f0ba7[_0xf272('0x2c')]);_0x4e53d4['attributes']=_['intersection'](_0x2f0ba7[_0xf272('0x29')],qs[_0xf272('0x2f')](_0x5cb010['query']['fields']));_0x4e53d4['attributes']=_0x4e53d4[_0xf272('0x2e')]['length']?_0x4e53d4[_0xf272('0x2e')]:_0x2f0ba7[_0xf272('0x29')];_0x4e53d4[_0xf272('0x56')]=qs['sort'](_0x5cb010[_0xf272('0x2c')][_0xf272('0x43')]);_0x4e53d4['where']=qs[_0xf272('0x2d')](_[_0xf272('0x45')](_0x5cb010['query'],_0x2f0ba7[_0xf272('0x2d')]));if(_0x5cb010[_0xf272('0x2c')][_0xf272('0x47')]){_0x4e53d4[_0xf272('0x44')]=_[_0xf272('0x32')](_0x4e53d4[_0xf272('0x44')],{'$or':_[_0xf272('0x21')](_0x4e53d4[_0xf272('0x2e')],function(_0x37380b){var _0x4ac7c6={};_0x4ac7c6[_0x37380b]={'$like':'%'+_0x5cb010[_0xf272('0x2c')][_0xf272('0x47')]+'%'};return _0x4ac7c6;})});}_0x4e53d4=_['merge']({},_0x4e53d4,_0x5cb010[_0xf272('0x33')]);return _0x535c00[_0xf272('0x53')](_0x4e53d4);}})[_0xf272('0x18')](function(_0x322e0b){if(_0x322e0b){_0x5d1104=_0x322e0b[_0xf272('0x30')];if(!_0x5cb010[_0xf272('0x2c')][_0xf272('0x41')](_0xf272('0x42'))){_0x4e53d4[_0xf272('0x12')]=qs['limit'](_0x5cb010[_0xf272('0x2c')][_0xf272('0x12')]);_0x4e53d4[_0xf272('0x14')]=qs[_0xf272('0x14')](_0x5cb010[_0xf272('0x2c')][_0xf272('0x14')]);}return _0x535c00['getTeams'](_0x4e53d4);}})[_0xf272('0x18')](function(_0x2f979b){if(_0x2f979b){return _0x2f979b?{'count':_0x5d1104,'rows':_0x2f979b}:null;}})[_0xf272('0x18')](respondWithResult(_0x5387be,null))[_0xf272('0x27')](handleError(_0x5387be,null));};exports['addTeams']=function(_0x4141ed,_0x25ad70){var _0x2c6ec3=_0x4141ed['body'][_0xf272('0x57')];return db[_0xf272('0x55')][_0xf272('0x49')]({'where':{'id':_0x2c6ec3},'attributes':['id'],'include':[{'model':db[_0xf272('0x4a')],'as':'Agents','attributes':['id','name',_0xf272('0x58'),_0xf272('0x59'),_0xf272('0x5a')],'raw':!![]}]})[_0xf272('0x18')](function(_0x11bbb9){if(_0x11bbb9){var _0x3c4a2e=_[_0xf272('0x5b')](_0x11bbb9,function(_0x51a356){var _0x3ae7c9=_0x51a356[_0xf272('0x19')]({'plain':!![]});return _0x3ae7c9[_0xf272('0x5c')];});return db[_0xf272('0x22')][_0xf272('0x34')]({'where':{'id':_0x4141ed['params']['id']}})[_0xf272('0x18')](function(_0x44cb14){return db[_0xf272('0x5d')][_0xf272('0x5e')](function(_0x3cd0c0){return _0x44cb14['addTeams'](_0x2c6ec3,{'transaction':_0x3cd0c0})[_0xf272('0x18')](function(){return BPromise[_0xf272('0x5f')](_0x3c4a2e,function(_0x1f5e4e){return db[_0xf272('0x48')][_0xf272('0x60')]({'where':{'UserId':_0x1f5e4e['id'],'ChatQueueId':_0x4141ed['params']['id']},'transaction':_0x3cd0c0});});})[_0xf272('0x18')](function(){_0x3c4a2e['forEach'](function(_0x317f1f){socket[_0xf272('0x61')](_0xf272('0x62'),{'UserId':_0x317f1f['id'],'ChatQueueId':_0x44cb14['id']});});});});});}})['then'](respondWithStatusCode(_0x25ad70,null))['catch'](handleError(_0x25ad70,null));};exports[_0xf272('0x63')]=function(_0x30369e,_0xcfb7b6){return db['Team'][_0xf272('0x49')]({'where':{'id':_0x30369e[_0xf272('0x2c')][_0xf272('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf272('0x4a')],'as':_0xf272('0x5c'),'attributes':['id'],'raw':!![]}]})[_0xf272('0x18')](handleEntityNotFound(_0xcfb7b6,null))[_0xf272('0x18')](function(_0x42bb79){var _0xd493d7=_[_0xf272('0x21')](_0x42bb79,'id');var _0x694003=[];var _0x265812=[];var _0x236212=squel[_0xf272('0x64')]();_0x236212['field'](_0xf272('0x65'))['from'](_0xf272('0x66'),'tq')[_0xf272('0x67')]('user_has_teams','ut',_0xf272('0x68'))[_0xf272('0x44')](_0xf272('0x69'),_0x30369e[_0xf272('0x28')]['id']);for(var _0x9bc57b=0x0;_0x9bc57b<_0x42bb79[_0xf272('0x30')];_0x9bc57b+=0x1){let _0x4a7017=_0x42bb79[_0x9bc57b];for(var _0x3e9f36=0x0;_0x3e9f36<_0x4a7017[_0xf272('0x5c')][_0xf272('0x30')];_0x3e9f36+=0x1){let _0x3e952f=_0x4a7017[_0xf272('0x5c')][_0x3e9f36];var _0x44b688=_0x236212['clone']();_0x44b688[_0xf272('0x44')](_0xf272('0x6a'),_0x3e952f['id']);_0x265812['push'](db[_0xf272('0x5d')]['query'](_0x44b688[_0xf272('0x6b')](),{'type':db[_0xf272('0x5d')][_0xf272('0x6c')][_0xf272('0x6d')]})[_0xf272('0x18')](function(_0x1c0aaf){if(_0x1c0aaf['length']===0x1){return _0x3e952f['id'];}else{var _0x41404e=_[_0xf272('0x6e')](_[_0xf272('0x21')](_0x1c0aaf,_0xf272('0x6f')),function(_0x1ccbb0){return _['includes'](_0xd493d7,_0x1ccbb0);});if(_0x41404e){return _0x3e952f['id'];}}}));}}return BPromise[_0xf272('0x70')](_0x265812)[_0xf272('0x18')](function(_0x2610ed){_0x694003=_(_0x694003)[_0xf272('0x71')](_0x2610ed)[_0xf272('0x72')]()[_0xf272('0x73')]();return db['ChatQueue'][_0xf272('0x34')]({'where':{'id':_0x30369e['params']['id']}})['then'](function(_0x30333d){return db[_0xf272('0x5d')][_0xf272('0x5e')](function(_0x1e5e29){return _0x30333d['removeTeams'](_0x30369e[_0xf272('0x2c')][_0xf272('0x57')],{'transaction':_0x1e5e29})['then'](function(){if(!_[_0xf272('0x74')](_0x694003)){return _0x30333d[_0xf272('0x75')](_0x694003,{'transaction':_0x1e5e29});}})[_0xf272('0x18')](function(){_0x694003[_0xf272('0x76')](function(_0xa74252){socket['emit'](_0xf272('0x77'),{'UserId':_0xa74252,'ChatQueueId':_0x30333d['id']});});});});});});})[_0xf272('0x18')](respondWithStatusCode(_0xcfb7b6,null))[_0xf272('0x27')](handleError(_0xcfb7b6,null));};exports[_0xf272('0x78')]=function(_0x338761,_0x18db7f){return db[_0xf272('0x22')][_0xf272('0x34')]({'where':{'id':_0x338761[_0xf272('0x28')]['id']}})[_0xf272('0x18')](handleEntityNotFound(_0x18db7f,null))[_0xf272('0x18')](function(_0x2cf6d2){if(_0x2cf6d2){return _0x2cf6d2['addAgents'](_0x338761['body']['ids'],_[_0xf272('0x79')](_0x338761[_0xf272('0x36')],['ids','id'])||{})['spread'](function(_0xf4891a){for(var _0x4ac5f0=0x0;_0x4ac5f0<_0x338761[_0xf272('0x36')][_0xf272('0x57')]['length'];_0x4ac5f0+=0x1){socket['emit'](_0xf272('0x62'),{'UserId':Number(_0x338761['body'][_0xf272('0x57')][_0x4ac5f0]),'ChatQueueId':Number(_0x338761[_0xf272('0x28')]['id'])});}return _0xf4891a;});}})[_0xf272('0x18')](respondWithResult(_0x18db7f,null))['catch'](handleError(_0x18db7f,null));};exports[_0xf272('0x75')]=function(_0x3f3123,_0x4ba569){return db[_0xf272('0x22')][_0xf272('0x34')]({'where':{'id':_0x3f3123['params']['id']}})['then'](handleEntityNotFound(_0x4ba569,null))[_0xf272('0x18')](function(_0x3adbcd){if(_0x3adbcd){return _0x3adbcd['removeAgents'](_0x3f3123['query'][_0xf272('0x57')])[_0xf272('0x18')](function(){if(_[_0xf272('0x7a')](_0x3f3123[_0xf272('0x2c')][_0xf272('0x57')])){for(var _0x578f2d=0x0;_0x578f2d<_0x3f3123[_0xf272('0x2c')][_0xf272('0x57')]['length'];_0x578f2d+=0x1){socket[_0xf272('0x61')]('userChatQueue:remove',{'UserId':Number(_0x3f3123[_0xf272('0x2c')][_0xf272('0x57')][_0x578f2d]),'ChatQueueId':Number(_0x3f3123[_0xf272('0x28')]['id'])});}}else{socket['emit'](_0xf272('0x77'),{'UserId':Number(_0x3f3123[_0xf272('0x2c')][_0xf272('0x57')]),'ChatQueueId':Number(_0x3f3123[_0xf272('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x4ba569,null))[_0xf272('0x27')](handleError(_0x4ba569,null));};exports[_0xf272('0x7b')]=function(_0x321171,_0x1fa98a){var _0x37bec8={};var _0x5a4c65={};var _0x54dbee;var _0x5a035c;return db[_0xf272('0x22')][_0xf272('0x54')]({'where':{'id':_0x321171[_0xf272('0x28')]['id']}})['then'](handleEntityNotFound(_0x1fa98a,null))[_0xf272('0x18')](function(_0x1b48b9){if(_0x1b48b9){_0x54dbee=_0x1b48b9;_0x5a4c65[_0xf272('0x29')]=_[_0xf272('0x2a')](db[_0xf272('0x4a')][_0xf272('0x2b')]);_0x5a4c65[_0xf272('0x2c')]=_[_0xf272('0x2a')](_0x321171[_0xf272('0x2c')]);_0x5a4c65[_0xf272('0x2d')]=_[_0xf272('0x40')](_0x5a4c65[_0xf272('0x29')],_0x5a4c65['query']);_0x37bec8[_0xf272('0x2e')]=_[_0xf272('0x40')](_0x5a4c65['model'],qs[_0xf272('0x2f')](_0x321171[_0xf272('0x2c')][_0xf272('0x2f')]));_0x37bec8[_0xf272('0x2e')]=_0x37bec8[_0xf272('0x2e')][_0xf272('0x30')]?_0x37bec8['attributes']:_0x5a4c65[_0xf272('0x29')];_0x37bec8['order']=qs['sort'](_0x321171[_0xf272('0x2c')][_0xf272('0x43')]);_0x37bec8[_0xf272('0x44')]=qs['filters'](_[_0xf272('0x45')](_0x321171['query'],_0x5a4c65[_0xf272('0x2d')]));if(_0x321171[_0xf272('0x2c')]['filter']){_0x37bec8[_0xf272('0x44')]=_['merge'](_0x37bec8[_0xf272('0x44')],{'$or':_[_0xf272('0x21')](_0x37bec8[_0xf272('0x2e')],function(_0x2cd679){var _0x3891cb={};_0x3891cb[_0x2cd679]={'$like':'%'+_0x321171['query']['filter']+'%'};return _0x3891cb;})});}_0x37bec8=_[_0xf272('0x32')]({},_0x37bec8,_0x321171['options']);return _0x54dbee[_0xf272('0x7b')](_0x37bec8);}})['then'](function(_0x596135){if(_0x596135){_0x5a035c=_0x596135[_0xf272('0x30')];if(!_0x321171['query']['hasOwnProperty'](_0xf272('0x42'))){_0x37bec8[_0xf272('0x12')]=qs[_0xf272('0x12')](_0x321171[_0xf272('0x2c')]['limit']);_0x37bec8[_0xf272('0x14')]=qs['offset'](_0x321171[_0xf272('0x2c')][_0xf272('0x14')]);}return _0x54dbee[_0xf272('0x7b')](_0x37bec8);}})[_0xf272('0x18')](function(_0x3bf295){if(_0x3bf295){return _0x3bf295?{'count':_0x5a035c,'rows':_0x3bf295}:null;}})[_0xf272('0x18')](respondWithResult(_0x1fa98a,null))[_0xf272('0x27')](handleError(_0x1fa98a,null));}; \ No newline at end of file +var _0x3de1=['omit','spread','userChatQueue:save','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','status','end','json','offset','undefined','count','limit','set','then','destroy','get','ChatQueues','UserProfileResource','sendStatus','error','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','include','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserChatQueue','hasOwnProperty','nolimit','sort','pick','where','filter','findAll','findAndCountAll','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','findOne','Team','order','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','select','field','tq.TeamId','from','team_has_chat_queues','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','every','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents'];(function(_0x2662c8,_0x1351c7){var _0x27fba5=function(_0x1493cc){while(--_0x1493cc){_0x2662c8['push'](_0x2662c8['shift']());}};_0x27fba5(++_0x1351c7);}(_0x3de1,0x170));var _0x13de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de1[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x13de('0x0'));var util=require(_0x13de('0x1'));var _=require(_0x13de('0x2'));var squel=require('squel');var Redis=require(_0x13de('0x3'));var qs=require(_0x13de('0x4'));var logger=require('../../config/logger')(_0x13de('0x5'));var config=require(_0x13de('0x6'));var db=require(_0x13de('0x7'))['db'];config[_0x13de('0x8')]=_['defaults'](config[_0x13de('0x8')],{'host':_0x13de('0x9'),'port':0x18eb});var socket=require(_0x13de('0xa'))(new Redis(config[_0x13de('0x8')]));require(_0x13de('0xb'))[_0x13de('0xc')](socket);function respondWithStatusCode(_0x25333e,_0x41f1a5){_0x41f1a5=_0x41f1a5||0xcc;return function(_0xffe4f4){if(_0xffe4f4){return _0x25333e['sendStatus'](_0x41f1a5);}return _0x25333e[_0x13de('0xd')](_0x41f1a5)[_0x13de('0xe')]();};}function respondWithResult(_0x56d766,_0x4cc713){_0x4cc713=_0x4cc713||0xc8;return function(_0x4d9dec){if(_0x4d9dec){return _0x56d766['status'](_0x4cc713)[_0x13de('0xf')](_0x4d9dec);}};}function respondWithFilteredResult(_0x5bf0b5,_0x327799){return function(_0x9d442){if(_0x9d442){var _0x30f6bd=typeof _0x327799[_0x13de('0x10')]===_0x13de('0x11')&&typeof _0x327799['limit']===_0x13de('0x11');var _0x22a452=_0x9d442['count'];var _0x53bcfb=_0x30f6bd?0x0:_0x327799[_0x13de('0x10')];var _0x47d36c=_0x30f6bd?_0x9d442[_0x13de('0x12')]:_0x327799[_0x13de('0x10')]+_0x327799[_0x13de('0x13')];var _0xabab30;if(_0x47d36c>=_0x22a452){_0x47d36c=_0x22a452;_0xabab30=0xc8;}else{_0xabab30=0xce;}_0x5bf0b5['status'](_0xabab30);return _0x5bf0b5[_0x13de('0x14')]('Content-Range',_0x53bcfb+'-'+_0x47d36c+'/'+_0x22a452)[_0x13de('0xf')](_0x9d442);}return null;};}function saveUpdates(_0x57b81c){return function(_0x43e30b){if(_0x43e30b){return _0x43e30b['update'](_0x57b81c)[_0x13de('0x15')](function(_0x3fcee7){return _0x3fcee7;});}return null;};}function removeEntity(_0x23c6be){return function(_0x33d0eb){if(_0x33d0eb){return _0x33d0eb[_0x13de('0x16')]()[_0x13de('0x15')](function(){var _0x14fb5a=_0x33d0eb[_0x13de('0x17')]({'plain':!![]});var _0x290f7e=_0x13de('0x18');return db[_0x13de('0x19')]['destroy']({'where':{'type':_0x290f7e,'resourceId':_0x14fb5a['id']}})[_0x13de('0x15')](function(){return _0x33d0eb;});})[_0x13de('0x15')](function(){_0x23c6be[_0x13de('0xd')](0xcc)[_0x13de('0xe')]();});}};}function handleEntityNotFound(_0x19fdc2){return function(_0x4a7151){if(!_0x4a7151){_0x19fdc2[_0x13de('0x1a')](0x194);}return _0x4a7151;};}function handleError(_0xd1e657,_0x33e64e){_0x33e64e=_0x33e64e||0x1f4;return function(_0x25ccd9){logger[_0x13de('0x1b')](_0x25ccd9['stack']);if(_0x25ccd9[_0x13de('0x1c')]){delete _0x25ccd9['name'];}_0xd1e657[_0x13de('0xd')](_0x33e64e)['send'](_0x25ccd9);};}exports[_0x13de('0x1d')]=function(_0x3a88eb,_0x391e94){var _0x4068d1={};var _0x42bf7d={'count':0x0,'rows':[]};var _0x59786e=_[_0x13de('0x1e')](db[_0x13de('0x1f')][_0x13de('0x20')],function(_0x2ef45c){return{'name':_0x2ef45c[_0x13de('0x21')],'type':_0x2ef45c[_0x13de('0x22')][_0x13de('0x23')]};});_0x4068d1=qs[_0x13de('0x24')](_0x59786e,_0x3a88eb);var _0x3d9d24={'where':_0x4068d1['where']};return db[_0x13de('0x1f')]['count'](_0x3d9d24)[_0x13de('0x15')](function(_0x3525ee){_0x42bf7d[_0x13de('0x12')]=_0x3525ee;_0x4068d1[_0x13de('0x25')]=qs[_0x13de('0x25')](_0x3a88eb['query']);return db[_0x13de('0x1f')]['findAll'](_0x4068d1);})[_0x13de('0x15')](function(_0xc892d8){_0x42bf7d['rows']=_0xc892d8;return _0x42bf7d;})['then'](respondWithFilteredResult(_0x391e94,_0x4068d1))[_0x13de('0x26')](handleError(_0x391e94,null));};exports[_0x13de('0x27')]=function(_0x5487bb,_0x144cea){var _0x543c31={'raw':!![],'where':{'id':_0x5487bb[_0x13de('0x28')]['id']}},_0x1e5bdf={};_0x1e5bdf[_0x13de('0x29')]=_[_0x13de('0x2a')](db[_0x13de('0x1f')][_0x13de('0x20')]);_0x1e5bdf[_0x13de('0x2b')]=_['keys'](_0x5487bb['query']);_0x1e5bdf[_0x13de('0x2c')]=_[_0x13de('0x2d')](_0x1e5bdf['model'],_0x1e5bdf['query']);_0x543c31[_0x13de('0x2e')]=_[_0x13de('0x2d')](_0x1e5bdf[_0x13de('0x29')],qs[_0x13de('0x2f')](_0x5487bb[_0x13de('0x2b')][_0x13de('0x2f')]));_0x543c31['attributes']=_0x543c31[_0x13de('0x2e')][_0x13de('0x30')]?_0x543c31[_0x13de('0x2e')]:_0x1e5bdf[_0x13de('0x29')];if(_0x5487bb[_0x13de('0x2b')][_0x13de('0x31')]){_0x543c31[_0x13de('0x25')]=[{'all':!![]}];}_0x543c31=_[_0x13de('0x32')]({},_0x543c31,_0x5487bb[_0x13de('0x33')]);return db[_0x13de('0x1f')][_0x13de('0x34')](_0x543c31)[_0x13de('0x15')](handleEntityNotFound(_0x144cea,null))[_0x13de('0x15')](respondWithResult(_0x144cea,null))['catch'](handleError(_0x144cea,null));};exports['create']=function(_0x15ba11,_0x47337c){return db[_0x13de('0x1f')][_0x13de('0x35')](_0x15ba11[_0x13de('0x36')],{})['then'](function(_0x50725d){var _0x449187=_0x15ba11['user'][_0x13de('0x17')]({'plain':!![]});if(!_0x449187)throw new Error(_0x13de('0x37'));if(_0x449187[_0x13de('0x38')]==='user'){var _0x493e5f=_0x50725d[_0x13de('0x17')]({'plain':!![]});var _0x5ad727='ChatQueues';return db[_0x13de('0x39')]['find']({'where':{'name':_0x5ad727,'userProfileId':_0x449187[_0x13de('0x3a')]},'raw':!![]})[_0x13de('0x15')](function(_0x1a66b2){if(_0x1a66b2&&_0x1a66b2[_0x13de('0x3b')]===0x0){return db[_0x13de('0x19')]['create']({'name':_0x493e5f[_0x13de('0x1c')],'resourceId':_0x493e5f['id'],'type':_0x1a66b2[_0x13de('0x1c')],'sectionId':_0x1a66b2['id']},{})['then'](function(){return _0x50725d;});}else{return _0x50725d;}})['catch'](function(_0x137123){logger[_0x13de('0x1b')](_0x13de('0x3c'),_0x137123);throw _0x137123;});}return _0x50725d;})[_0x13de('0x15')](respondWithResult(_0x47337c,0xc9))[_0x13de('0x26')](handleError(_0x47337c,null));};exports[_0x13de('0x3d')]=function(_0x520a43,_0x3a6fd6){if(_0x520a43[_0x13de('0x36')]['id']){delete _0x520a43['body']['id'];}return db[_0x13de('0x1f')][_0x13de('0x34')]({'where':{'id':_0x520a43[_0x13de('0x28')]['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x3a6fd6,null))[_0x13de('0x15')](saveUpdates(_0x520a43['body'],null))[_0x13de('0x15')](respondWithResult(_0x3a6fd6,null))[_0x13de('0x26')](handleError(_0x3a6fd6,null));};exports[_0x13de('0x16')]=function(_0x150b7b,_0x278574){return db[_0x13de('0x1f')][_0x13de('0x34')]({'where':{'id':_0x150b7b[_0x13de('0x28')]['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x278574,null))[_0x13de('0x15')](removeEntity(_0x278574,null))[_0x13de('0x26')](handleError(_0x278574,null));};exports[_0x13de('0x3e')]=function(_0x5b92c1,_0x494427){return db[_0x13de('0x1f')]['describe']()[_0x13de('0x15')](respondWithResult(_0x494427,null))[_0x13de('0x26')](handleError(_0x494427,null));};exports[_0x13de('0x3f')]=function(_0x3d4dd3,_0x3694c0){var _0x3ef33c={'raw':!![],'where':{}},_0x34c4e2={},_0x56fb2b;return db[_0x13de('0x1f')]['findOne']({'where':{'id':_0x3d4dd3['params']['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x3694c0,null))[_0x13de('0x15')](function(_0x4adf83){if(_0x4adf83){_0x56fb2b=_0x4adf83['get']({'plain':!![]});_0x34c4e2[_0x13de('0x29')]=_[_0x13de('0x2a')](db[_0x13de('0x40')][_0x13de('0x20')]);_0x34c4e2['query']=_[_0x13de('0x2a')](_0x3d4dd3[_0x13de('0x2b')]);_0x34c4e2['filters']=_[_0x13de('0x2d')](_0x34c4e2['model'],_0x34c4e2[_0x13de('0x2b')]);_0x3ef33c[_0x13de('0x2e')]=_[_0x13de('0x2d')](_0x34c4e2[_0x13de('0x29')],qs['fields'](_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x2f')]));_0x3ef33c['attributes']=_0x3ef33c[_0x13de('0x2e')][_0x13de('0x30')]?_0x3ef33c[_0x13de('0x2e')]:_0x34c4e2[_0x13de('0x29')];if(!_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x41')](_0x13de('0x42'))){_0x3ef33c['limit']=qs['limit'](_0x3d4dd3['query'][_0x13de('0x13')]);_0x3ef33c[_0x13de('0x10')]=qs[_0x13de('0x10')](_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x10')]);}_0x3ef33c['order']=qs[_0x13de('0x43')](_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x43')]);_0x3ef33c['where']=qs[_0x13de('0x2c')](_[_0x13de('0x44')](_0x3d4dd3['query'],_0x34c4e2[_0x13de('0x2c')]));_0x3ef33c[_0x13de('0x45')]['ChatQueueId']=_0x4adf83['id'];if(_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x46')]){_0x3ef33c[_0x13de('0x45')]=_[_0x13de('0x32')](_0x3ef33c[_0x13de('0x45')],{'$or':_[_0x13de('0x1e')](_0x3ef33c[_0x13de('0x2e')],function(_0x2bffc2){var _0x46835e={};_0x46835e[_0x2bffc2]={'$like':'%'+_0x3d4dd3[_0x13de('0x2b')][_0x13de('0x46')]+'%'};return _0x46835e;})});}_0x3ef33c=_[_0x13de('0x32')]({},_0x3ef33c,_0x3d4dd3[_0x13de('0x33')]);return db[_0x13de('0x40')][_0x13de('0x47')](_0x3ef33c);}})[_0x13de('0x15')](function(_0x32bfa8){if(_0x32bfa8){return db['User'][_0x13de('0x48')]({'where':{'id':_[_0x13de('0x1e')](_0x32bfa8,'UserId'),'role':_0x13de('0x49')},'attributes':['id',_0x13de('0x1c'),_0x13de('0x4a'),_0x13de('0x4b'),_0x13de('0x4c')]});}})[_0x13de('0x15')](function(_0x4949db){if(_0x4949db){return{'count':_0x4949db['count'],'rows':_[_0x13de('0x1e')](_0x4949db[_0x13de('0x4d')],function(_0x27b661){return{'membername':_0x27b661[_0x13de('0x1c')],'UserId':_0x27b661['id'],'queue_name':_0x56fb2b['name'],'ChatQueueId':_0x56fb2b['id'],'interface':util[_0x13de('0x4e')](_0x13de('0x4f'),'SIP',_0x27b661[_0x13de('0x1c')]),'penalty':0x0,'paused':_0x27b661[_0x13de('0x4a')],'createdAt':_0x27b661[_0x13de('0x4c')],'updatedAt':_0x27b661[_0x13de('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x13de('0x15')](respondWithFilteredResult(_0x3694c0,_0x3ef33c))[_0x13de('0x26')](handleError(_0x3694c0,null));};exports['getTeams']=function(_0x243434,_0x2707ab){var _0xf27d96={};var _0x508daf={};var _0x1554b2;var _0x429840;return db[_0x13de('0x1f')][_0x13de('0x50')]({'where':{'id':_0x243434[_0x13de('0x28')]['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x2707ab,null))[_0x13de('0x15')](function(_0x4d21e4){if(_0x4d21e4){_0x1554b2=_0x4d21e4;_0x508daf['model']=_[_0x13de('0x2a')](db[_0x13de('0x51')][_0x13de('0x20')]);_0x508daf[_0x13de('0x2b')]=_['keys'](_0x243434[_0x13de('0x2b')]);_0x508daf['filters']=_[_0x13de('0x2d')](_0x508daf[_0x13de('0x29')],_0x508daf[_0x13de('0x2b')]);_0xf27d96['attributes']=_[_0x13de('0x2d')](_0x508daf[_0x13de('0x29')],qs['fields'](_0x243434[_0x13de('0x2b')][_0x13de('0x2f')]));_0xf27d96[_0x13de('0x2e')]=_0xf27d96[_0x13de('0x2e')][_0x13de('0x30')]?_0xf27d96['attributes']:_0x508daf[_0x13de('0x29')];_0xf27d96[_0x13de('0x52')]=qs[_0x13de('0x43')](_0x243434[_0x13de('0x2b')][_0x13de('0x43')]);_0xf27d96[_0x13de('0x45')]=qs[_0x13de('0x2c')](_[_0x13de('0x44')](_0x243434[_0x13de('0x2b')],_0x508daf[_0x13de('0x2c')]));if(_0x243434[_0x13de('0x2b')]['filter']){_0xf27d96[_0x13de('0x45')]=_[_0x13de('0x32')](_0xf27d96[_0x13de('0x45')],{'$or':_[_0x13de('0x1e')](_0xf27d96[_0x13de('0x2e')],function(_0x5b38ae){var _0x5547b2={};_0x5547b2[_0x5b38ae]={'$like':'%'+_0x243434[_0x13de('0x2b')][_0x13de('0x46')]+'%'};return _0x5547b2;})});}_0xf27d96=_[_0x13de('0x32')]({},_0xf27d96,_0x243434[_0x13de('0x33')]);return _0x1554b2[_0x13de('0x53')](_0xf27d96);}})[_0x13de('0x15')](function(_0x5c3e01){if(_0x5c3e01){_0x429840=_0x5c3e01[_0x13de('0x30')];if(!_0x243434[_0x13de('0x2b')][_0x13de('0x41')](_0x13de('0x42'))){_0xf27d96[_0x13de('0x13')]=qs[_0x13de('0x13')](_0x243434[_0x13de('0x2b')][_0x13de('0x13')]);_0xf27d96[_0x13de('0x10')]=qs[_0x13de('0x10')](_0x243434[_0x13de('0x2b')]['offset']);}return _0x1554b2[_0x13de('0x53')](_0xf27d96);}})[_0x13de('0x15')](function(_0xf8ac5e){if(_0xf8ac5e){return _0xf8ac5e?{'count':_0x429840,'rows':_0xf8ac5e}:null;}})[_0x13de('0x15')](respondWithResult(_0x2707ab,null))['catch'](handleError(_0x2707ab,null));};exports[_0x13de('0x54')]=function(_0x80485,_0x3ff4b1){var _0x45de19=_0x80485[_0x13de('0x36')][_0x13de('0x55')];return db['Team'][_0x13de('0x47')]({'where':{'id':_0x45de19},'attributes':['id'],'include':[{'model':db[_0x13de('0x56')],'as':_0x13de('0x57'),'attributes':['id',_0x13de('0x1c'),_0x13de('0x58'),_0x13de('0x59'),_0x13de('0x5a')],'raw':!![]}]})[_0x13de('0x15')](function(_0xdef1db){if(_0xdef1db){var _0x2a1cca=_[_0x13de('0x5b')](_0xdef1db,function(_0x4a000b){var _0x11de90=_0x4a000b[_0x13de('0x17')]({'plain':!![]});return _0x11de90[_0x13de('0x57')];});return db[_0x13de('0x1f')]['find']({'where':{'id':_0x80485[_0x13de('0x28')]['id']}})[_0x13de('0x15')](function(_0x1ef6d3){return db[_0x13de('0x5c')][_0x13de('0x5d')](function(_0x40ff8e){return _0x1ef6d3[_0x13de('0x54')](_0x45de19,{'transaction':_0x40ff8e})[_0x13de('0x15')](function(){return BPromise[_0x13de('0x5e')](_0x2a1cca,function(_0x5072ac){return db['UserChatQueue'][_0x13de('0x5f')]({'where':{'UserId':_0x5072ac['id'],'ChatQueueId':_0x80485['params']['id']},'transaction':_0x40ff8e});});})[_0x13de('0x15')](function(){_0x2a1cca['forEach'](function(_0x5750f7){socket[_0x13de('0x60')]('userChatQueue:save',{'UserId':_0x5750f7['id'],'ChatQueueId':_0x1ef6d3['id']});});});});});}})[_0x13de('0x15')](respondWithStatusCode(_0x3ff4b1,null))[_0x13de('0x26')](handleError(_0x3ff4b1,null));};exports['removeTeams']=function(_0x4be593,_0xab412c){return db[_0x13de('0x51')][_0x13de('0x47')]({'where':{'id':_0x4be593[_0x13de('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x13de('0x56')],'as':_0x13de('0x57'),'attributes':['id'],'raw':!![]}]})[_0x13de('0x15')](handleEntityNotFound(_0xab412c,null))['then'](function(_0x5d12e2){var _0x5d5fce=_[_0x13de('0x1e')](_0x5d12e2,'id');var _0x3dfe5a=[];var _0x11e0aa=[];var _0x1a24e7=squel[_0x13de('0x61')]();_0x1a24e7[_0x13de('0x62')](_0x13de('0x63'))[_0x13de('0x64')](_0x13de('0x65'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x13de('0x45')](_0x13de('0x66'),_0x4be593['params']['id']);for(var _0x3bba86=0x0;_0x3bba86<_0x5d12e2['length'];_0x3bba86+=0x1){let _0x58f435=_0x5d12e2[_0x3bba86];for(var _0x27ec58=0x0;_0x27ec58<_0x58f435[_0x13de('0x57')][_0x13de('0x30')];_0x27ec58+=0x1){let _0x3b22a5=_0x58f435[_0x13de('0x57')][_0x27ec58];var _0x9f8d32=_0x1a24e7[_0x13de('0x67')]();_0x9f8d32[_0x13de('0x45')]('ut.UserId\x20=\x20?',_0x3b22a5['id']);_0x11e0aa['push'](db['sequelize']['query'](_0x9f8d32[_0x13de('0x68')](),{'type':db[_0x13de('0x5c')][_0x13de('0x69')]['SELECT']})[_0x13de('0x15')](function(_0x2eb74c){if(_0x2eb74c['length']===0x1){return _0x3b22a5['id'];}else{var _0x278967=_[_0x13de('0x6a')](_[_0x13de('0x1e')](_0x2eb74c,'TeamId'),function(_0x2eaa7e){return _['includes'](_0x5d5fce,_0x2eaa7e);});if(_0x278967){return _0x3b22a5['id'];}}}));}}return BPromise[_0x13de('0x6b')](_0x11e0aa)['then'](function(_0x305044){_0x3dfe5a=_(_0x3dfe5a)[_0x13de('0x6c')](_0x305044)[_0x13de('0x6d')]()[_0x13de('0x6e')]();return db['ChatQueue'][_0x13de('0x34')]({'where':{'id':_0x4be593['params']['id']}})[_0x13de('0x15')](function(_0x3280eb){return db[_0x13de('0x5c')][_0x13de('0x5d')](function(_0x40bb66){return _0x3280eb[_0x13de('0x6f')](_0x4be593[_0x13de('0x2b')][_0x13de('0x55')],{'transaction':_0x40bb66})[_0x13de('0x15')](function(){if(!_[_0x13de('0x70')](_0x3dfe5a)){return _0x3280eb[_0x13de('0x71')](_0x3dfe5a,{'transaction':_0x40bb66});}})[_0x13de('0x15')](function(){_0x3dfe5a[_0x13de('0x72')](function(_0x3c7920){socket[_0x13de('0x60')]('userChatQueue:remove',{'UserId':_0x3c7920,'ChatQueueId':_0x3280eb['id']});});});});});});})[_0x13de('0x15')](respondWithStatusCode(_0xab412c,null))[_0x13de('0x26')](handleError(_0xab412c,null));};exports['addAgents']=function(_0x2f23a0,_0x11ab96){return db['ChatQueue'][_0x13de('0x34')]({'where':{'id':_0x2f23a0[_0x13de('0x28')]['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x11ab96,null))[_0x13de('0x15')](function(_0x270238){if(_0x270238){return _0x270238[_0x13de('0x73')](_0x2f23a0[_0x13de('0x36')]['ids'],_[_0x13de('0x74')](_0x2f23a0[_0x13de('0x36')],[_0x13de('0x55'),'id'])||{})[_0x13de('0x75')](function(_0x5d96b7){for(var _0x5be97e=0x0;_0x5be97e<_0x2f23a0[_0x13de('0x36')][_0x13de('0x55')][_0x13de('0x30')];_0x5be97e+=0x1){socket[_0x13de('0x60')](_0x13de('0x76'),{'UserId':Number(_0x2f23a0[_0x13de('0x36')][_0x13de('0x55')][_0x5be97e]),'ChatQueueId':Number(_0x2f23a0['params']['id'])});}return _0x5d96b7;});}})['then'](respondWithResult(_0x11ab96,null))[_0x13de('0x26')](handleError(_0x11ab96,null));};exports['removeAgents']=function(_0x4871d9,_0x422fbd){return db[_0x13de('0x1f')]['find']({'where':{'id':_0x4871d9[_0x13de('0x28')]['id']}})['then'](handleEntityNotFound(_0x422fbd,null))[_0x13de('0x15')](function(_0x3de88c){if(_0x3de88c){return _0x3de88c[_0x13de('0x71')](_0x4871d9[_0x13de('0x2b')][_0x13de('0x55')])['then'](function(){if(_[_0x13de('0x77')](_0x4871d9[_0x13de('0x2b')]['ids'])){for(var _0x29f18c=0x0;_0x29f18c<_0x4871d9[_0x13de('0x2b')][_0x13de('0x55')][_0x13de('0x30')];_0x29f18c+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x4871d9[_0x13de('0x2b')][_0x13de('0x55')][_0x29f18c]),'ChatQueueId':Number(_0x4871d9[_0x13de('0x28')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x4871d9['query'][_0x13de('0x55')]),'ChatQueueId':Number(_0x4871d9[_0x13de('0x28')]['id'])});}});}})[_0x13de('0x15')](respondWithStatusCode(_0x422fbd,null))[_0x13de('0x26')](handleError(_0x422fbd,null));};exports[_0x13de('0x78')]=function(_0x351127,_0x5f0b70){var _0x270aff={};var _0x567b18={};var _0x162c1e;var _0x61018d;return db[_0x13de('0x1f')][_0x13de('0x50')]({'where':{'id':_0x351127[_0x13de('0x28')]['id']}})[_0x13de('0x15')](handleEntityNotFound(_0x5f0b70,null))[_0x13de('0x15')](function(_0xbe2346){if(_0xbe2346){_0x162c1e=_0xbe2346;_0x567b18[_0x13de('0x29')]=_[_0x13de('0x2a')](db[_0x13de('0x56')][_0x13de('0x20')]);_0x567b18[_0x13de('0x2b')]=_['keys'](_0x351127[_0x13de('0x2b')]);_0x567b18[_0x13de('0x2c')]=_[_0x13de('0x2d')](_0x567b18[_0x13de('0x29')],_0x567b18[_0x13de('0x2b')]);_0x270aff[_0x13de('0x2e')]=_[_0x13de('0x2d')](_0x567b18['model'],qs[_0x13de('0x2f')](_0x351127['query'][_0x13de('0x2f')]));_0x270aff['attributes']=_0x270aff[_0x13de('0x2e')][_0x13de('0x30')]?_0x270aff['attributes']:_0x567b18[_0x13de('0x29')];_0x270aff[_0x13de('0x52')]=qs[_0x13de('0x43')](_0x351127[_0x13de('0x2b')]['sort']);_0x270aff[_0x13de('0x45')]=qs[_0x13de('0x2c')](_[_0x13de('0x44')](_0x351127['query'],_0x567b18['filters']));if(_0x351127[_0x13de('0x2b')][_0x13de('0x46')]){_0x270aff[_0x13de('0x45')]=_['merge'](_0x270aff[_0x13de('0x45')],{'$or':_['map'](_0x270aff[_0x13de('0x2e')],function(_0x4f0818){var _0x2538ec={};_0x2538ec[_0x4f0818]={'$like':'%'+_0x351127[_0x13de('0x2b')][_0x13de('0x46')]+'%'};return _0x2538ec;})});}_0x270aff=_[_0x13de('0x32')]({},_0x270aff,_0x351127[_0x13de('0x33')]);return _0x162c1e[_0x13de('0x78')](_0x270aff);}})[_0x13de('0x15')](function(_0x1cf2c7){if(_0x1cf2c7){_0x61018d=_0x1cf2c7[_0x13de('0x30')];if(!_0x351127[_0x13de('0x2b')][_0x13de('0x41')](_0x13de('0x42'))){_0x270aff[_0x13de('0x13')]=qs[_0x13de('0x13')](_0x351127[_0x13de('0x2b')][_0x13de('0x13')]);_0x270aff['offset']=qs[_0x13de('0x10')](_0x351127['query'][_0x13de('0x10')]);}return _0x162c1e[_0x13de('0x78')](_0x270aff);}})[_0x13de('0x15')](function(_0x5b27fa){if(_0x5b27fa){return _0x5b27fa?{'count':_0x61018d,'rows':_0x5b27fa}:null;}})[_0x13de('0x15')](respondWithResult(_0x5f0b70,null))[_0x13de('0x26')](handleError(_0x5f0b70,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e320b01..69bc35e 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 _0x8eb1=['../../mysqldb','ChatQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8eb1,0x108));var _0x18eb=function(_0x30a04c,_0x1949e1){_0x30a04c=_0x30a04c-0x0;var _0x1da59b=_0x8eb1[_0x30a04c];return _0x1da59b;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x18eb('0x0'))['db'][_0x18eb('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x18eb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x18eb('0x3')};function emitEvent(_0x51b833){return function(_0x264b0e,_0x2bf482,_0x4a33b8){ChatQueueEvents['emit'](_0x51b833+':'+_0x264b0e['id'],_0x264b0e);ChatQueueEvents[_0x18eb('0x4')](_0x51b833,_0x264b0e);_0x4a33b8(null);};}for(var e in events){if(events[_0x18eb('0x5')](e)){var event=events[e];ChatQueue[_0x18eb('0x6')](e,emitEvent(event));}}module[_0x18eb('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x82f0=['ChatQueue','save','update','emit','exports','events','../../mysqldb'];(function(_0x2b0649,_0x233956){var _0x131ab9=function(_0x42c09f){while(--_0x42c09f){_0x2b0649['push'](_0x2b0649['shift']());}};_0x131ab9(++_0x233956);}(_0x82f0,0xc9));var _0x082f=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x82f0[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x082f('0x0'));var ChatQueue=require(_0x082f('0x1'))['db'][_0x082f('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x082f('0x3'),'afterUpdate':_0x082f('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc15ea5){return function(_0x18593a,_0x5bfe40,_0x43414e){ChatQueueEvents[_0x082f('0x5')](_0xc15ea5+':'+_0x18593a['id'],_0x18593a);ChatQueueEvents['emit'](_0xc15ea5,_0x18593a);_0x43414e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x082f('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index dff7294..d49dc95 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 _0x78bb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','ChatQueue','chat_queues','lodash','util','../../config/logger','api'];(function(_0x53a442,_0x1b0063){var _0x2e8e36=function(_0x191266){while(--_0x191266){_0x53a442['push'](_0x53a442['shift']());}};_0x2e8e36(++_0x1b0063);}(_0x78bb,0x74));var _0xb78b=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x78bb[_0xd2d54];return _0x78b113;};'use strict';var _=require(_0xb78b('0x0'));var util=require(_0xb78b('0x1'));var logger=require(_0xb78b('0x2'))(_0xb78b('0x3'));var moment=require(_0xb78b('0x4'));var BPromise=require(_0xb78b('0x5'));var rp=require(_0xb78b('0x6'));var fs=require('fs');var path=require(_0xb78b('0x7'));var rimraf=require(_0xb78b('0x8'));var config=require(_0xb78b('0x9'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x15c70c,_0x28005f){return _0x15c70c['define'](_0xb78b('0xa'),attributes,{'tableName':_0xb78b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd6a=['chat_queues','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatQueue.attributes','exports'];(function(_0x526fdd,_0x48a18e){var _0x5f0d48=function(_0x783b8d){while(--_0x783b8d){_0x526fdd['push'](_0x526fdd['shift']());}};_0x5f0d48(++_0x48a18e);}(_0xdd6a,0x169));var _0xadd6=function(_0x723288,_0x361804){_0x723288=_0x723288-0x0;var _0x45fecf=_0xdd6a[_0x723288];return _0x45fecf;};'use strict';var _=require(_0xadd6('0x0'));var util=require('util');var logger=require(_0xadd6('0x1'))(_0xadd6('0x2'));var moment=require(_0xadd6('0x3'));var BPromise=require(_0xadd6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xadd6('0x5'));var rimraf=require('rimraf');var config=require(_0xadd6('0x6'));var attributes=require(_0xadd6('0x7'));module[_0xadd6('0x8')]=function(_0x266dce,_0x51f135){return _0x266dce['define']('ChatQueue',attributes,{'tableName':_0xadd6('0x9'),'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 adcc5a4..3c957e7 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 _0xa0a3=['ChatQueue','findAll','options','where','attributes','limit','include','map','model','ShowChatQueue','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatQueue.socket','register','then','request\x20sent','debug','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','catch','GetChatQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x172318,_0x25c35f){_0x172318=_0x172318-0x0;var _0xf34564=_0xa0a3[_0x172318];return _0xf34564;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var moment=require(_0x3a0a('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a0a('0x2'));var fs=require('fs');var Redis=require(_0x3a0a('0x3'));var db=require(_0x3a0a('0x4'))['db'];var utils=require(_0x3a0a('0x5'));var logger=require(_0x3a0a('0x6'))(_0x3a0a('0x7'));var config=require(_0x3a0a('0x8'));var jayson=require(_0x3a0a('0x9'));var client=jayson[_0x3a0a('0xa')][_0x3a0a('0xb')]({'port':0x232a});config[_0x3a0a('0xc')]=_[_0x3a0a('0xd')](config[_0x3a0a('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a0a('0xc')]));require(_0x3a0a('0xe'))[_0x3a0a('0xf')](socket);function respondWithRpcPromise(_0x3460be,_0x43e9ec,_0x272435){return new BPromise(function(_0x42235e,_0x53f366){return client['request'](_0x3460be,_0x272435)[_0x3a0a('0x10')](function(_0x3b1003){logger['info']('ChatQueue,\x20%s,\x20%s',_0x43e9ec,_0x3a0a('0x11'));logger[_0x3a0a('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x43e9ec,_0x3a0a('0x11'),JSON[_0x3a0a('0x13')](_0x3b1003));if(_0x3b1003[_0x3a0a('0x14')]){if(_0x3b1003[_0x3a0a('0x14')][_0x3a0a('0x15')]===0x1f4){logger[_0x3a0a('0x14')](_0x3a0a('0x16'),_0x43e9ec,_0x3b1003[_0x3a0a('0x14')][_0x3a0a('0x17')]);return _0x53f366(_0x3b1003[_0x3a0a('0x14')][_0x3a0a('0x17')]);}logger[_0x3a0a('0x14')](_0x3a0a('0x16'),_0x43e9ec,_0x3b1003[_0x3a0a('0x14')]['message']);return _0x42235e(_0x3b1003[_0x3a0a('0x14')]['message']);}else{logger[_0x3a0a('0x18')](_0x3a0a('0x16'),_0x43e9ec,_0x3a0a('0x11'));_0x42235e(_0x3b1003['result'][_0x3a0a('0x17')]);}})[_0x3a0a('0x19')](function(_0x4f0372){logger[_0x3a0a('0x14')](_0x3a0a('0x16'),_0x43e9ec,_0x4f0372);_0x53f366(_0x4f0372);});});}exports[_0x3a0a('0x1a')]=function(_0x36ca41){var _0x91d764=this;return new Promise(function(_0x423990,_0x3e99f9){return db[_0x3a0a('0x1b')][_0x3a0a('0x1c')]({'raw':_0x36ca41[_0x3a0a('0x1d')]?_0x36ca41['options']['raw']===undefined?!![]:![]:!![],'where':_0x36ca41['options']?_0x36ca41[_0x3a0a('0x1d')][_0x3a0a('0x1e')]||null:null,'attributes':_0x36ca41[_0x3a0a('0x1d')]?_0x36ca41[_0x3a0a('0x1d')][_0x3a0a('0x1f')]||null:null,'limit':_0x36ca41['options']?_0x36ca41[_0x3a0a('0x1d')][_0x3a0a('0x20')]||null:null,'include':_0x36ca41[_0x3a0a('0x1d')]?_0x36ca41['options'][_0x3a0a('0x21')]?_[_0x3a0a('0x22')](_0x36ca41['options']['include'],function(_0x16e93d){return{'model':db[_0x16e93d[_0x3a0a('0x23')]],'as':_0x16e93d['as'],'attributes':_0x16e93d[_0x3a0a('0x1f')],'include':_0x16e93d['include']?_[_0x3a0a('0x22')](_0x16e93d[_0x3a0a('0x21')],function(_0x130ca6){return{'model':db[_0x130ca6[_0x3a0a('0x23')]],'as':_0x130ca6['as'],'attributes':_0x130ca6[_0x3a0a('0x1f')],'include':_0x130ca6['include']?_['map'](_0x130ca6[_0x3a0a('0x21')],function(_0x3d01d8){return{'model':db[_0x3d01d8['model']],'as':_0x3d01d8['as'],'attributes':_0x3d01d8['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a0a('0x10')](function(_0x2e7481){logger[_0x3a0a('0x18')](_0x3a0a('0x1a'),_0x36ca41);logger['debug']('GetChatQueue',_0x36ca41,JSON[_0x3a0a('0x13')](_0x2e7481));_0x423990(_0x2e7481);})[_0x3a0a('0x19')](function(_0x177181){logger['error'](_0x3a0a('0x1a'),_0x177181[_0x3a0a('0x17')],_0x36ca41);_0x3e99f9(_0x91d764[_0x3a0a('0x14')](0x1f4,_0x177181[_0x3a0a('0x17')]));});});};exports[_0x3a0a('0x24')]=function(_0x3184cb){var _0x26ff5d=this;return new Promise(function(_0x1218fd,_0x21be1c){return db['ChatQueue'][_0x3a0a('0x25')]({'raw':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb[_0x3a0a('0x1d')][_0x3a0a('0x26')]===undefined?!![]:![]:!![],'where':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb['options'][_0x3a0a('0x1e')]||null:null,'attributes':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb[_0x3a0a('0x1d')][_0x3a0a('0x1f')]||null:null,'include':_0x3184cb[_0x3a0a('0x1d')]?_0x3184cb[_0x3a0a('0x1d')]['include']?_[_0x3a0a('0x22')](_0x3184cb[_0x3a0a('0x1d')][_0x3a0a('0x21')],function(_0x32c2e1){return{'model':db[_0x32c2e1[_0x3a0a('0x23')]],'as':_0x32c2e1['as'],'attributes':_0x32c2e1[_0x3a0a('0x1f')],'include':_0x32c2e1[_0x3a0a('0x21')]?_[_0x3a0a('0x22')](_0x32c2e1['include'],function(_0x2301be){return{'model':db[_0x2301be[_0x3a0a('0x23')]],'as':_0x2301be['as'],'attributes':_0x2301be[_0x3a0a('0x1f')],'include':_0x2301be[_0x3a0a('0x21')]?_[_0x3a0a('0x22')](_0x2301be[_0x3a0a('0x21')],function(_0x2ab6d2){return{'model':db[_0x2ab6d2[_0x3a0a('0x23')]],'as':_0x2ab6d2['as'],'attributes':_0x2ab6d2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a0a('0x10')](function(_0x143696){logger[_0x3a0a('0x18')](_0x3a0a('0x24'),_0x3184cb);logger[_0x3a0a('0x12')](_0x3a0a('0x24'),_0x3184cb,JSON[_0x3a0a('0x13')](_0x143696));_0x1218fd(_0x143696);})[_0x3a0a('0x19')](function(_0xea232d){logger['error'](_0x3a0a('0x24'),_0xea232d['message'],_0x3184cb);_0x21be1c(_0x26ff5d[_0x3a0a('0x14')](0x1f4,_0xea232d[_0x3a0a('0x17')]));});});}; \ No newline at end of file +var _0x153c=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','then','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ChatQueue','findAll','options','raw','where','include','map','model','attributes','GetChatQueue','debug','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x41bc22,_0x18f647){var _0x56b23c=function(_0x321e62){while(--_0x321e62){_0x41bc22['push'](_0x41bc22['shift']());}};_0x56b23c(++_0x18f647);}(_0x153c,0x8c));var _0xc153=function(_0x1f8a6e,_0x5bb5d0){_0x1f8a6e=_0x1f8a6e-0x0;var _0x389dd8=_0x153c[_0x1f8a6e];return _0x389dd8;};'use strict';var _=require(_0xc153('0x0'));var util=require(_0xc153('0x1'));var moment=require(_0xc153('0x2'));var BPromise=require(_0xc153('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc153('0x4'));var db=require(_0xc153('0x5'))['db'];var utils=require(_0xc153('0x6'));var logger=require(_0xc153('0x7'))(_0xc153('0x8'));var config=require(_0xc153('0x9'));var jayson=require(_0xc153('0xa'));var client=jayson['client'][_0xc153('0xb')]({'port':0x232a});config[_0xc153('0xc')]=_[_0xc153('0xd')](config[_0xc153('0xc')],{'host':_0xc153('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0xc153('0xf')](socket);function respondWithRpcPromise(_0x3566e3,_0x12ecca,_0x4040b3){return new BPromise(function(_0x1d706e,_0x5367d7){return client['request'](_0x3566e3,_0x4040b3)[_0xc153('0x10')](function(_0x44905b){logger['info'](_0xc153('0x11'),_0x12ecca,_0xc153('0x12'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x12ecca,_0xc153('0x12'),JSON[_0xc153('0x13')](_0x44905b));if(_0x44905b[_0xc153('0x14')]){if(_0x44905b['error'][_0xc153('0x15')]===0x1f4){logger[_0xc153('0x14')](_0xc153('0x11'),_0x12ecca,_0x44905b['error'][_0xc153('0x16')]);return _0x5367d7(_0x44905b[_0xc153('0x14')]['message']);}logger['error'](_0xc153('0x11'),_0x12ecca,_0x44905b[_0xc153('0x14')][_0xc153('0x16')]);return _0x1d706e(_0x44905b[_0xc153('0x14')][_0xc153('0x16')]);}else{logger[_0xc153('0x17')](_0xc153('0x11'),_0x12ecca,_0xc153('0x12'));_0x1d706e(_0x44905b['result'][_0xc153('0x16')]);}})[_0xc153('0x18')](function(_0x19fc4e){logger['error'](_0xc153('0x11'),_0x12ecca,_0x19fc4e);_0x5367d7(_0x19fc4e);});});}exports['GetChatQueue']=function(_0x596131){var _0x2198ff=this;return new Promise(function(_0x285e71,_0x2954d){return db[_0xc153('0x19')][_0xc153('0x1a')]({'raw':_0x596131[_0xc153('0x1b')]?_0x596131['options'][_0xc153('0x1c')]===undefined?!![]:![]:!![],'where':_0x596131['options']?_0x596131[_0xc153('0x1b')][_0xc153('0x1d')]||null:null,'attributes':_0x596131[_0xc153('0x1b')]?_0x596131[_0xc153('0x1b')]['attributes']||null:null,'limit':_0x596131['options']?_0x596131[_0xc153('0x1b')]['limit']||null:null,'include':_0x596131[_0xc153('0x1b')]?_0x596131[_0xc153('0x1b')][_0xc153('0x1e')]?_[_0xc153('0x1f')](_0x596131['options'][_0xc153('0x1e')],function(_0x39bbdb){return{'model':db[_0x39bbdb[_0xc153('0x20')]],'as':_0x39bbdb['as'],'attributes':_0x39bbdb[_0xc153('0x21')],'include':_0x39bbdb[_0xc153('0x1e')]?_[_0xc153('0x1f')](_0x39bbdb['include'],function(_0x319405){return{'model':db[_0x319405['model']],'as':_0x319405['as'],'attributes':_0x319405[_0xc153('0x21')],'include':_0x319405[_0xc153('0x1e')]?_['map'](_0x319405[_0xc153('0x1e')],function(_0x38033f){return{'model':db[_0x38033f['model']],'as':_0x38033f['as'],'attributes':_0x38033f[_0xc153('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc153('0x10')](function(_0x27315f){logger['info'](_0xc153('0x22'),_0x596131);logger[_0xc153('0x23')](_0xc153('0x22'),_0x596131,JSON['stringify'](_0x27315f));_0x285e71(_0x27315f);})[_0xc153('0x18')](function(_0x136524){logger[_0xc153('0x14')](_0xc153('0x22'),_0x136524['message'],_0x596131);_0x2954d(_0x2198ff[_0xc153('0x14')](0x1f4,_0x136524['message']));});});};exports[_0xc153('0x24')]=function(_0x5c1741){var _0x3be25b=this;return new Promise(function(_0x23a5be,_0x4f2e7c){return db[_0xc153('0x19')]['find']({'raw':_0x5c1741['options']?_0x5c1741[_0xc153('0x1b')][_0xc153('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c1741[_0xc153('0x1b')]?_0x5c1741[_0xc153('0x1b')][_0xc153('0x1d')]||null:null,'attributes':_0x5c1741['options']?_0x5c1741[_0xc153('0x1b')][_0xc153('0x21')]||null:null,'include':_0x5c1741[_0xc153('0x1b')]?_0x5c1741[_0xc153('0x1b')][_0xc153('0x1e')]?_[_0xc153('0x1f')](_0x5c1741[_0xc153('0x1b')][_0xc153('0x1e')],function(_0x3b57a7){return{'model':db[_0x3b57a7[_0xc153('0x20')]],'as':_0x3b57a7['as'],'attributes':_0x3b57a7['attributes'],'include':_0x3b57a7['include']?_[_0xc153('0x1f')](_0x3b57a7['include'],function(_0x3e1de5){return{'model':db[_0x3e1de5[_0xc153('0x20')]],'as':_0x3e1de5['as'],'attributes':_0x3e1de5[_0xc153('0x21')],'include':_0x3e1de5['include']?_[_0xc153('0x1f')](_0x3e1de5[_0xc153('0x1e')],function(_0x1c1d4d){return{'model':db[_0x1c1d4d[_0xc153('0x20')]],'as':_0x1c1d4d['as'],'attributes':_0x1c1d4d[_0xc153('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc153('0x10')](function(_0x412455){logger[_0xc153('0x17')]('ShowChatQueue',_0x5c1741);logger['debug'](_0xc153('0x24'),_0x5c1741,JSON[_0xc153('0x13')](_0x412455));_0x23a5be(_0x412455);})[_0xc153('0x18')](function(_0x447c3c){logger[_0xc153('0x14')](_0xc153('0x24'),_0x447c3c['message'],_0x5c1741);_0x4f2e7c(_0x3be25b[_0xc153('0x14')](0x1f4,_0x447c3c[_0xc153('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8b2b003..7d0ca4e 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 _0x00bb=['removeListener','length','chatQueue:','./chatQueue.events','save','remove','emit'];(function(_0x5f08a6,_0x400121){var _0x5d0641=function(_0x304467){while(--_0x304467){_0x5f08a6['push'](_0x5f08a6['shift']());}};_0x5d0641(++_0x400121);}(_0x00bb,0x1d8));var _0xb00b=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x00bb[_0x33032e];return _0x13316b;};'use strict';var ChatQueueEvents=require(_0xb00b('0x0'));var events=[_0xb00b('0x1'),_0xb00b('0x2'),'update'];function createListener(_0x170f94,_0x47a3bf){return function(_0x278c5e){_0x47a3bf[_0xb00b('0x3')](_0x170f94,_0x278c5e);};}function removeListener(_0x582ef9,_0x14b5d0){return function(){ChatQueueEvents[_0xb00b('0x4')](_0x582ef9,_0x14b5d0);};}exports['register']=function(_0x574cf8){for(var _0x532ffb=0x0,_0x36e363=events[_0xb00b('0x5')];_0x532ffb<_0x36e363;_0x532ffb++){var _0x41dfc9=events[_0x532ffb];var _0x37f07d=createListener(_0xb00b('0x6')+_0x41dfc9,_0x574cf8);ChatQueueEvents['on'](_0x41dfc9,_0x37f07d);}}; \ No newline at end of file +var _0xda55=['chatQueue:','./chatQueue.events','save','emit','removeListener','length'];(function(_0x5964d3,_0x41e285){var _0x41c5dd=function(_0x3dee3e){while(--_0x3dee3e){_0x5964d3['push'](_0x5964d3['shift']());}};_0x41c5dd(++_0x41e285);}(_0xda55,0x6d));var _0x5da5=function(_0x34ca5a,_0x2f14b1){_0x34ca5a=_0x34ca5a-0x0;var _0x38c2be=_0xda55[_0x34ca5a];return _0x38c2be;};'use strict';var ChatQueueEvents=require(_0x5da5('0x0'));var events=[_0x5da5('0x1'),'remove','update'];function createListener(_0x13ecbc,_0x240a49){return function(_0x26a443){_0x240a49[_0x5da5('0x2')](_0x13ecbc,_0x26a443);};}function removeListener(_0x1c3afd,_0x5da254){return function(){ChatQueueEvents[_0x5da5('0x3')](_0x1c3afd,_0x5da254);};}exports['register']=function(_0x356a37){for(var _0x58e7b3=0x0,_0x2fd877=events[_0x5da5('0x4')];_0x58e7b3<_0x2fd877;_0x58e7b3++){var _0x71b187=events[_0x58e7b3];var _0x46290d=createListener(_0x5da5('0x5')+_0x71b187,_0x356a37);ChatQueueEvents['on'](_0x71b187,_0x46290d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e926c52..e3fb326 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3e74,0x175));var _0x43e7=function(_0x15757e,_0x8031c2){_0x15757e=_0x15757e-0x0;var _0x5a5843=_0x3e74[_0x15757e];return _0x5a5843;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e74,0x175));var _0x43e7=function(_0x571896,_0x2edf00){_0x571896=_0x571896-0x0;var _0x20a002=_0x3e74[_0x571896];return _0x20a002;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f29054d..e4599d9 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 _0x71ef=['moment','exports','STRING','DATE'];(function(_0x5923e8,_0xc8d316){var _0x7a1148=function(_0x95a6bc){while(--_0x95a6bc){_0x5923e8['push'](_0x5923e8['shift']());}};_0x7a1148(++_0xc8d316);}(_0x71ef,0x140));var _0xf71e=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0x71ef[_0x1399d6];return _0x4a9db4;};'use strict';var moment=require(_0xf71e('0x0'));var Sequelize=require('sequelize');module[_0xf71e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf71e('0x2')]},'joinAt':{'type':Sequelize[_0xf71e('0x3')]},'leaveAt':{'type':Sequelize[_0xf71e('0x3')]},'acceptAt':{'type':Sequelize[_0xf71e('0x3')]},'exitAt':{'type':Sequelize[_0xf71e('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x100a=['moment','sequelize','exports','STRING','DATE'];(function(_0x20c88b,_0x1e45e1){var _0x1204db=function(_0x198dd9){while(--_0x198dd9){_0x20c88b['push'](_0x20c88b['shift']());}};_0x1204db(++_0x1e45e1);}(_0x100a,0x87));var _0xa100=function(_0x4d166c,_0x5a4732){_0x4d166c=_0x4d166c-0x0;var _0x4c68b2=_0x100a[_0x4d166c];return _0x4c68b2;};'use strict';var moment=require(_0xa100('0x0'));var Sequelize=require(_0xa100('0x1'));module[_0xa100('0x2')]={'uniqueid':{'type':Sequelize[_0xa100('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa100('0x3')]},'joinAt':{'type':Sequelize[_0xa100('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa100('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8fbcb94..8b31c4c 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 _0x7163=['key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','params','includeAll','find','create','body','catch','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type'];(function(_0x123af9,_0x9ae1a8){var _0x379fa9=function(_0x306b03){while(--_0x306b03){_0x123af9['push'](_0x123af9['shift']());}};_0x379fa9(++_0x9ae1a8);}(_0x7163,0x1ef));var _0x3716=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x7163[_0xa2c0a3];return _0x52c618;};'use strict';var emlformat=require(_0x3716('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3716('0x1'));var rp=require(_0x3716('0x2'));var moment=require(_0x3716('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3716('0x4'));var util=require(_0x3716('0x5'));var path=require(_0x3716('0x6'));var sox=require(_0x3716('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3716('0x8'));var _=require(_0x3716('0x9'));var squel=require(_0x3716('0xa'));var crypto=require(_0x3716('0xb'));var jsforce=require(_0x3716('0xc'));var deskjs=require(_0x3716('0xd'));var toCsv=require(_0x3716('0xe'));var querystring=require(_0x3716('0xf'));var Papa=require(_0x3716('0x10'));var Redis=require(_0x3716('0x11'));var authService=require(_0x3716('0x12'));var qs=require(_0x3716('0x13'));var as=require(_0x3716('0x14'));var hardwareService=require(_0x3716('0x15'));var logger=require(_0x3716('0x16'))(_0x3716('0x17'));var utils=require(_0x3716('0x18'));var config=require(_0x3716('0x19'));var licenseUtil=require(_0x3716('0x1a'));var db=require(_0x3716('0x1b'))['db'];function respondWithStatusCode(_0x2c32cf,_0x2bbb95){_0x2bbb95=_0x2bbb95||0xcc;return function(_0x21925a){if(_0x21925a){return _0x2c32cf[_0x3716('0x1c')](_0x2bbb95);}return _0x2c32cf[_0x3716('0x1d')](_0x2bbb95)[_0x3716('0x1e')]();};}function respondWithResult(_0xc095c4,_0x131c5a){_0x131c5a=_0x131c5a||0xc8;return function(_0x4d1791){if(_0x4d1791){return _0xc095c4['status'](_0x131c5a)['json'](_0x4d1791);}};}function respondWithFilteredResult(_0x493b7d,_0x372785){return function(_0x5bbc0a){if(_0x5bbc0a){var _0x166835=typeof _0x372785[_0x3716('0x1f')]===_0x3716('0x20')&&typeof _0x372785['limit']==='undefined';var _0x5f3833=_0x5bbc0a['count'];var _0x27fa57=_0x166835?0x0:_0x372785[_0x3716('0x1f')];var _0x5d16c4=_0x166835?_0x5bbc0a[_0x3716('0x21')]:_0x372785[_0x3716('0x1f')]+_0x372785[_0x3716('0x22')];var _0xf6c764;if(_0x5d16c4>=_0x5f3833){_0x5d16c4=_0x5f3833;_0xf6c764=0xc8;}else{_0xf6c764=0xce;}_0x493b7d[_0x3716('0x1d')](_0xf6c764);return _0x493b7d[_0x3716('0x23')](_0x3716('0x24'),_0x27fa57+'-'+_0x5d16c4+'/'+_0x5f3833)['json'](_0x5bbc0a);}return null;};}function patchUpdates(_0x4cd0a6){return function(_0x524db1){try{jsonpatch[_0x3716('0x25')](_0x524db1,_0x4cd0a6,!![]);}catch(_0x49a885){return BPromise[_0x3716('0x26')](_0x49a885);}return _0x524db1[_0x3716('0x27')]();};}function saveUpdates(_0x2cccca,_0x233517){return function(_0x2b5296){if(_0x2b5296){return _0x2b5296[_0x3716('0x28')](_0x2cccca)[_0x3716('0x29')](function(_0x12bc19){return _0x12bc19;});}return null;};}function removeEntity(_0x1f18b2,_0x483bdd){return function(_0xec15ce){if(_0xec15ce){return _0xec15ce[_0x3716('0x2a')]()[_0x3716('0x29')](function(){_0x1f18b2['status'](0xcc)[_0x3716('0x1e')]();});}};}function handleEntityNotFound(_0x3e7452,_0x4daec7){return function(_0x3fd2bf){if(!_0x3fd2bf){_0x3e7452['sendStatus'](0x194);}return _0x3fd2bf;};}function handleError(_0x224451,_0x2c3df6){_0x2c3df6=_0x2c3df6||0x1f4;return function(_0x203310){logger['error'](_0x203310[_0x3716('0x2b')]);if(_0x203310['name']){delete _0x203310[_0x3716('0x2c')];}_0x224451[_0x3716('0x1d')](_0x2c3df6)['send'](_0x203310);};}exports[_0x3716('0x2d')]=function(_0x3dcf6b,_0x1c29b8){var _0xc5211={},_0x1e413c={},_0x4f76dc={'count':0x0,'rows':[]};var _0x2fdfa1=_[_0x3716('0x2e')](db[_0x3716('0x2f')][_0x3716('0x30')],function(_0x4fee70){return{'name':_0x4fee70[_0x3716('0x31')],'type':_0x4fee70[_0x3716('0x32')][_0x3716('0x33')]};});_0x1e413c[_0x3716('0x34')]=_[_0x3716('0x2e')](_0x2fdfa1,'name');_0x1e413c[_0x3716('0x35')]=_[_0x3716('0x36')](_0x3dcf6b[_0x3716('0x35')]);_0x1e413c['filters']=_['intersection'](_0x1e413c[_0x3716('0x34')],_0x1e413c[_0x3716('0x35')]);_0xc5211[_0x3716('0x37')]=_[_0x3716('0x38')](_0x1e413c['model'],qs[_0x3716('0x39')](_0x3dcf6b[_0x3716('0x35')][_0x3716('0x39')]));_0xc5211[_0x3716('0x37')]=_0xc5211[_0x3716('0x37')][_0x3716('0x3a')]?_0xc5211['attributes']:_0x1e413c[_0x3716('0x34')];if(!_0x3dcf6b[_0x3716('0x35')][_0x3716('0x3b')]('nolimit')){_0xc5211['limit']=qs[_0x3716('0x22')](_0x3dcf6b['query'][_0x3716('0x22')]);_0xc5211[_0x3716('0x1f')]=qs[_0x3716('0x1f')](_0x3dcf6b[_0x3716('0x35')][_0x3716('0x1f')]);}_0xc5211[_0x3716('0x3c')]=qs[_0x3716('0x3d')](_0x3dcf6b[_0x3716('0x35')]['sort']);_0xc5211[_0x3716('0x3e')]=qs[_0x3716('0x3f')](_[_0x3716('0x40')](_0x3dcf6b['query'],_0x1e413c[_0x3716('0x3f')]),_0x2fdfa1);if(_0x3dcf6b['query'][_0x3716('0x41')]){_0xc5211[_0x3716('0x3e')]=_[_0x3716('0x42')](_0xc5211[_0x3716('0x3e')],{'$or':_[_0x3716('0x2e')](_0x2fdfa1,function(_0x207d5e){if(_0x207d5e[_0x3716('0x32')]!==_0x3716('0x43')){var _0x4028b9={};_0x4028b9[_0x207d5e[_0x3716('0x2c')]]={'$like':'%'+_0x3dcf6b[_0x3716('0x35')]['filter']+'%'};return _0x4028b9;}})});}_0xc5211=_[_0x3716('0x42')]({},_0xc5211,_0x3dcf6b[_0x3716('0x44')]);var _0xe69c79={'where':_0xc5211[_0x3716('0x3e')]};return db['ChatQueueReport'][_0x3716('0x21')](_0xe69c79)[_0x3716('0x29')](function(_0x48a539){_0x4f76dc[_0x3716('0x21')]=_0x48a539;if(_0x3dcf6b[_0x3716('0x35')]['includeAll']){_0xc5211[_0x3716('0x45')]=[{'all':!![]}];}return db[_0x3716('0x2f')]['findAll'](_0xc5211);})[_0x3716('0x29')](function(_0xe4b86a){_0x4f76dc['rows']=_0xe4b86a;return _0x4f76dc;})[_0x3716('0x29')](respondWithFilteredResult(_0x1c29b8,_0xc5211))['catch'](handleError(_0x1c29b8,null));};exports[_0x3716('0x46')]=function(_0x215ca6,_0x50dabb){var _0x55147c={'raw':!![],'where':{'id':_0x215ca6[_0x3716('0x47')]['id']}},_0x100807={};_0x100807[_0x3716('0x34')]=_['keys'](db[_0x3716('0x2f')][_0x3716('0x30')]);_0x100807['query']=_[_0x3716('0x36')](_0x215ca6['query']);_0x100807[_0x3716('0x3f')]=_[_0x3716('0x38')](_0x100807[_0x3716('0x34')],_0x100807['query']);_0x55147c['attributes']=_[_0x3716('0x38')](_0x100807[_0x3716('0x34')],qs['fields'](_0x215ca6[_0x3716('0x35')][_0x3716('0x39')]));_0x55147c[_0x3716('0x37')]=_0x55147c[_0x3716('0x37')][_0x3716('0x3a')]?_0x55147c[_0x3716('0x37')]:_0x100807[_0x3716('0x34')];if(_0x215ca6['query'][_0x3716('0x48')]){_0x55147c[_0x3716('0x45')]=[{'all':!![]}];}_0x55147c=_[_0x3716('0x42')]({},_0x55147c,_0x215ca6[_0x3716('0x44')]);return db[_0x3716('0x2f')][_0x3716('0x49')](_0x55147c)[_0x3716('0x29')](handleEntityNotFound(_0x50dabb,null))['then'](respondWithResult(_0x50dabb,null))['catch'](handleError(_0x50dabb,null));};exports['create']=function(_0x5b5df8,_0x1ef5da){return db[_0x3716('0x2f')][_0x3716('0x4a')](_0x5b5df8[_0x3716('0x4b')],{})['then'](respondWithResult(_0x1ef5da,0xc9))[_0x3716('0x4c')](handleError(_0x1ef5da,null));};exports['update']=function(_0xf06450,_0x524088){if(_0xf06450[_0x3716('0x4b')]['id']){delete _0xf06450['body']['id'];}return db[_0x3716('0x2f')][_0x3716('0x49')]({'where':{'id':_0xf06450[_0x3716('0x47')]['id']}})[_0x3716('0x29')](handleEntityNotFound(_0x524088,null))[_0x3716('0x29')](saveUpdates(_0xf06450[_0x3716('0x4b')],null))[_0x3716('0x29')](respondWithResult(_0x524088,null))[_0x3716('0x4c')](handleError(_0x524088,null));};exports[_0x3716('0x2a')]=function(_0xca5eca,_0x3f05de){return db['ChatQueueReport']['find']({'where':{'id':_0xca5eca[_0x3716('0x47')]['id']}})[_0x3716('0x29')](handleEntityNotFound(_0x3f05de,null))['then'](removeEntity(_0x3f05de,null))[_0x3716('0x4c')](handleError(_0x3f05de,null));};exports[_0x3716('0x4d')]=function(_0x2e439e,_0x2ae48b){return db[_0x3716('0x2f')]['describe']()[_0x3716('0x29')](respondWithResult(_0x2ae48b,null))[_0x3716('0x4c')](handleError(_0x2ae48b,null));}; \ No newline at end of file +var _0xd43e=['to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ChatQueueReport','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xd43e,0x88));var _0xed43=function(_0x5b9168,_0x203c8a){_0x5b9168=_0x5b9168-0x0;var _0x1c8403=_0xd43e[_0x5b9168];return _0x1c8403;};'use strict';var emlformat=require(_0xed43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed43('0x1'));var jsonpatch=require(_0xed43('0x2'));var rp=require(_0xed43('0x3'));var moment=require(_0xed43('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xed43('0x5'));var path=require(_0xed43('0x6'));var sox=require(_0xed43('0x7'));var csv=require(_0xed43('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed43('0x9'));var _=require(_0xed43('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xed43('0xb'));var toCsv=require(_0xed43('0x8'));var querystring=require(_0xed43('0xc'));var Papa=require(_0xed43('0xd'));var Redis=require(_0xed43('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xed43('0xf'));var as=require(_0xed43('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed43('0x11'))(_0xed43('0x12'));var utils=require(_0xed43('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xed43('0x14'))['db'];function respondWithStatusCode(_0x34027b,_0x4eed04){_0x4eed04=_0x4eed04||0xcc;return function(_0x1519aa){if(_0x1519aa){return _0x34027b[_0xed43('0x15')](_0x4eed04);}return _0x34027b[_0xed43('0x16')](_0x4eed04)[_0xed43('0x17')]();};}function respondWithResult(_0x2adbc5,_0x403a89){_0x403a89=_0x403a89||0xc8;return function(_0x597544){if(_0x597544){return _0x2adbc5[_0xed43('0x16')](_0x403a89)['json'](_0x597544);}};}function respondWithFilteredResult(_0x2ec9c3,_0x4a9621){return function(_0x2d457a){if(_0x2d457a){var _0x4caa03=typeof _0x4a9621['offset']===_0xed43('0x18')&&typeof _0x4a9621['limit']===_0xed43('0x18');var _0x1ada9c=_0x2d457a[_0xed43('0x19')];var _0x5f5093=_0x4caa03?0x0:_0x4a9621[_0xed43('0x1a')];var _0xa8a443=_0x4caa03?_0x2d457a['count']:_0x4a9621['offset']+_0x4a9621[_0xed43('0x1b')];var _0x46a875;if(_0xa8a443>=_0x1ada9c){_0xa8a443=_0x1ada9c;_0x46a875=0xc8;}else{_0x46a875=0xce;}_0x2ec9c3[_0xed43('0x16')](_0x46a875);return _0x2ec9c3['set'](_0xed43('0x1c'),_0x5f5093+'-'+_0xa8a443+'/'+_0x1ada9c)[_0xed43('0x1d')](_0x2d457a);}return null;};}function patchUpdates(_0x5bbd5c){return function(_0x3570ef){try{jsonpatch[_0xed43('0x1e')](_0x3570ef,_0x5bbd5c,!![]);}catch(_0x336ce7){return BPromise['reject'](_0x336ce7);}return _0x3570ef['save']();};}function saveUpdates(_0x2a6329,_0x42fb48){return function(_0x7f4c4c){if(_0x7f4c4c){return _0x7f4c4c[_0xed43('0x1f')](_0x2a6329)[_0xed43('0x20')](function(_0x45a24a){return _0x45a24a;});}return null;};}function removeEntity(_0x556440,_0x414c7a){return function(_0x30b5cf){if(_0x30b5cf){return _0x30b5cf[_0xed43('0x21')]()['then'](function(){_0x556440[_0xed43('0x16')](0xcc)[_0xed43('0x17')]();});}};}function handleEntityNotFound(_0x28a908,_0x90350a){return function(_0x549f91){if(!_0x549f91){_0x28a908[_0xed43('0x15')](0x194);}return _0x549f91;};}function handleError(_0x53f575,_0x3e7442){_0x3e7442=_0x3e7442||0x1f4;return function(_0xed8706){logger[_0xed43('0x22')](_0xed8706[_0xed43('0x23')]);if(_0xed8706['name']){delete _0xed8706[_0xed43('0x24')];}_0x53f575['status'](_0x3e7442)['send'](_0xed8706);};}exports[_0xed43('0x25')]=function(_0x51f128,_0x587d85){var _0x1b2f66={},_0x139750={},_0x325ab5={'count':0x0,'rows':[]};var _0x1f1207=_[_0xed43('0x26')](db['ChatQueueReport'][_0xed43('0x27')],function(_0x32c395){return{'name':_0x32c395[_0xed43('0x28')],'type':_0x32c395[_0xed43('0x29')][_0xed43('0x2a')]};});_0x139750['model']=_[_0xed43('0x26')](_0x1f1207,_0xed43('0x24'));_0x139750[_0xed43('0x2b')]=_['keys'](_0x51f128[_0xed43('0x2b')]);_0x139750[_0xed43('0x2c')]=_[_0xed43('0x2d')](_0x139750[_0xed43('0x2e')],_0x139750[_0xed43('0x2b')]);_0x1b2f66[_0xed43('0x2f')]=_[_0xed43('0x2d')](_0x139750[_0xed43('0x2e')],qs['fields'](_0x51f128['query'][_0xed43('0x30')]));_0x1b2f66['attributes']=_0x1b2f66[_0xed43('0x2f')][_0xed43('0x31')]?_0x1b2f66['attributes']:_0x139750[_0xed43('0x2e')];if(!_0x51f128[_0xed43('0x2b')][_0xed43('0x32')](_0xed43('0x33'))){_0x1b2f66[_0xed43('0x1b')]=qs[_0xed43('0x1b')](_0x51f128[_0xed43('0x2b')][_0xed43('0x1b')]);_0x1b2f66['offset']=qs['offset'](_0x51f128[_0xed43('0x2b')][_0xed43('0x1a')]);}_0x1b2f66[_0xed43('0x34')]=qs[_0xed43('0x35')](_0x51f128[_0xed43('0x2b')]['sort']);_0x1b2f66[_0xed43('0x36')]=qs['filters'](_[_0xed43('0x37')](_0x51f128[_0xed43('0x2b')],_0x139750[_0xed43('0x2c')]),_0x1f1207);if(_0x51f128['query'][_0xed43('0x38')]){_0x1b2f66[_0xed43('0x36')]=_['merge'](_0x1b2f66[_0xed43('0x36')],{'$or':_[_0xed43('0x26')](_0x1f1207,function(_0x5bf247){if(_0x5bf247[_0xed43('0x29')]!=='VIRTUAL'){var _0x16c207={};_0x16c207[_0x5bf247[_0xed43('0x24')]]={'$like':'%'+_0x51f128['query'][_0xed43('0x38')]+'%'};return _0x16c207;}})});}_0x1b2f66=_[_0xed43('0x39')]({},_0x1b2f66,_0x51f128[_0xed43('0x3a')]);var _0x4a6ff6={'where':_0x1b2f66[_0xed43('0x36')]};return db[_0xed43('0x3b')][_0xed43('0x19')](_0x4a6ff6)[_0xed43('0x20')](function(_0xa6a7c3){_0x325ab5[_0xed43('0x19')]=_0xa6a7c3;if(_0x51f128['query'][_0xed43('0x3c')]){_0x1b2f66['include']=[{'all':!![]}];}return db[_0xed43('0x3b')][_0xed43('0x3d')](_0x1b2f66);})[_0xed43('0x20')](function(_0x2a9a15){_0x325ab5[_0xed43('0x3e')]=_0x2a9a15;return _0x325ab5;})[_0xed43('0x20')](respondWithFilteredResult(_0x587d85,_0x1b2f66))[_0xed43('0x3f')](handleError(_0x587d85,null));};exports[_0xed43('0x40')]=function(_0x19d7de,_0x32ddec){var _0x3ec9c0={'raw':!![],'where':{'id':_0x19d7de[_0xed43('0x41')]['id']}},_0x57ac6b={};_0x57ac6b[_0xed43('0x2e')]=_[_0xed43('0x42')](db['ChatQueueReport'][_0xed43('0x27')]);_0x57ac6b[_0xed43('0x2b')]=_[_0xed43('0x42')](_0x19d7de['query']);_0x57ac6b[_0xed43('0x2c')]=_['intersection'](_0x57ac6b['model'],_0x57ac6b[_0xed43('0x2b')]);_0x3ec9c0[_0xed43('0x2f')]=_[_0xed43('0x2d')](_0x57ac6b[_0xed43('0x2e')],qs['fields'](_0x19d7de[_0xed43('0x2b')][_0xed43('0x30')]));_0x3ec9c0['attributes']=_0x3ec9c0['attributes'][_0xed43('0x31')]?_0x3ec9c0['attributes']:_0x57ac6b[_0xed43('0x2e')];if(_0x19d7de['query'][_0xed43('0x3c')]){_0x3ec9c0[_0xed43('0x43')]=[{'all':!![]}];}_0x3ec9c0=_[_0xed43('0x39')]({},_0x3ec9c0,_0x19d7de[_0xed43('0x3a')]);return db[_0xed43('0x3b')][_0xed43('0x44')](_0x3ec9c0)['then'](handleEntityNotFound(_0x32ddec,null))[_0xed43('0x20')](respondWithResult(_0x32ddec,null))[_0xed43('0x3f')](handleError(_0x32ddec,null));};exports[_0xed43('0x45')]=function(_0x2ff4cf,_0x298662){return db[_0xed43('0x3b')]['create'](_0x2ff4cf[_0xed43('0x46')],{})[_0xed43('0x20')](respondWithResult(_0x298662,0xc9))[_0xed43('0x3f')](handleError(_0x298662,null));};exports[_0xed43('0x1f')]=function(_0x567327,_0xeda46e){if(_0x567327[_0xed43('0x46')]['id']){delete _0x567327['body']['id'];}return db[_0xed43('0x3b')][_0xed43('0x44')]({'where':{'id':_0x567327[_0xed43('0x41')]['id']}})[_0xed43('0x20')](handleEntityNotFound(_0xeda46e,null))[_0xed43('0x20')](saveUpdates(_0x567327[_0xed43('0x46')],null))[_0xed43('0x20')](respondWithResult(_0xeda46e,null))[_0xed43('0x3f')](handleError(_0xeda46e,null));};exports[_0xed43('0x21')]=function(_0x5f1968,_0x47cb1e){return db[_0xed43('0x3b')][_0xed43('0x44')]({'where':{'id':_0x5f1968[_0xed43('0x41')]['id']}})['then'](handleEntityNotFound(_0x47cb1e,null))['then'](removeEntity(_0x47cb1e,null))[_0xed43('0x3f')](handleError(_0x47cb1e,null));};exports[_0xed43('0x47')]=function(_0x399b30,_0x31846d){return db[_0xed43('0x3b')][_0xed43('0x47')]()[_0xed43('0x20')](respondWithResult(_0x31846d,null))[_0xed43('0x3f')](handleError(_0x31846d,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 008e03f..fd5a0e7 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(_0x27faed,_0x217be4){var _0x2aaeab=function(_0x2e8b17){while(--_0x2e8b17){_0x27faed['push'](_0x27faed['shift']());}};_0x2aaeab(++_0x217be4);}(_0x757a,0xde));var _0xa757=function(_0x14f957,_0x25c3a7){_0x14f957=_0x14f957-0x0;var _0x5af3c8=_0x757a[_0x14f957];return _0x5af3c8;};'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 _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x10cc02,_0x9f88bd){var _0x18187a=function(_0x13d345){while(--_0x13d345){_0x10cc02['push'](_0x10cc02['shift']());}};_0x18187a(++_0x9f88bd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xcb91[_0x151721];return _0x2deaa7;};'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')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index c2eadd0..50bfe57 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 _0x9829=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','then','UpdateChatQueueReport','update','where','attributes','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info'];(function(_0x93a15c,_0x2ec812){var _0x1e32e4=function(_0x174b05){while(--_0x174b05){_0x93a15c['push'](_0x93a15c['shift']());}};_0x1e32e4(++_0x2ec812);}(_0x9829,0xfb));var _0x9982=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x9829[_0x25c326];return _0x762452;};'use strict';var _=require(_0x9982('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9982('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9982('0x2'));var db=require(_0x9982('0x3'))['db'];var utils=require(_0x9982('0x4'));var logger=require('../../config/logger')(_0x9982('0x5'));var config=require(_0x9982('0x6'));var jayson=require(_0x9982('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44a7f4,_0x45c41d,_0x4b7b7b){return new BPromise(function(_0x3d2209,_0x385713){return client[_0x9982('0x8')](_0x44a7f4,_0x4b7b7b)['then'](function(_0x4cbfd0){logger[_0x9982('0x9')](_0x9982('0xa'),_0x45c41d,_0x9982('0xb'));logger[_0x9982('0xc')](_0x9982('0xd'),_0x45c41d,_0x9982('0xb'),JSON[_0x9982('0xe')](_0x4cbfd0));if(_0x4cbfd0[_0x9982('0xf')]){if(_0x4cbfd0[_0x9982('0xf')]['code']===0x1f4){logger[_0x9982('0xf')](_0x9982('0xa'),_0x45c41d,_0x4cbfd0['error']['message']);return _0x385713(_0x4cbfd0[_0x9982('0xf')]['message']);}logger[_0x9982('0xf')](_0x9982('0xa'),_0x45c41d,_0x4cbfd0[_0x9982('0xf')][_0x9982('0x10')]);return _0x3d2209(_0x4cbfd0[_0x9982('0xf')][_0x9982('0x10')]);}else{logger[_0x9982('0x9')](_0x9982('0xa'),_0x45c41d,_0x9982('0xb'));_0x3d2209(_0x4cbfd0[_0x9982('0x11')][_0x9982('0x10')]);}})[_0x9982('0x12')](function(_0x5598cd){logger[_0x9982('0xf')](_0x9982('0xa'),_0x45c41d,_0x5598cd);_0x385713(_0x5598cd);});});}exports[_0x9982('0x13')]=function(_0xecdd2a){var _0x1368e0=this;return new Promise(function(_0xa0534c,_0x34dc32){return db[_0x9982('0x14')]['create'](_0xecdd2a[_0x9982('0x15')],{'raw':_0xecdd2a['options']?_0xecdd2a[_0x9982('0x16')][_0x9982('0x17')]===undefined?!![]:![]:!![]})[_0x9982('0x18')](function(_0x1e71f9){logger[_0x9982('0x9')](_0x9982('0x13'),_0xecdd2a);logger[_0x9982('0xc')]('CreateChatQueueReport',_0xecdd2a,JSON[_0x9982('0xe')](_0x1e71f9));_0xa0534c(_0x1e71f9);})[_0x9982('0x12')](function(_0x2b5c35){logger[_0x9982('0xf')](_0x9982('0x13'),_0x2b5c35[_0x9982('0x10')],_0xecdd2a);_0x34dc32(_0x1368e0[_0x9982('0xf')](0x1f4,_0x2b5c35[_0x9982('0x10')]));});});};exports[_0x9982('0x19')]=function(_0x358345){var _0x95dd7c=this;return new Promise(function(_0x354ab7,_0x5a0f25){return db[_0x9982('0x14')][_0x9982('0x1a')](_0x358345[_0x9982('0x15')],{'raw':_0x358345[_0x9982('0x16')]?_0x358345[_0x9982('0x16')][_0x9982('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x358345['options']?_0x358345['options'][_0x9982('0x1b')]||null:null,'attributes':_0x358345['options']?_0x358345[_0x9982('0x16')][_0x9982('0x1c')]||null:null,'limit':_0x358345[_0x9982('0x16')]?_0x358345[_0x9982('0x16')]['limit']||null:null})[_0x9982('0x18')](function(_0x1ff242){logger[_0x9982('0x9')](_0x9982('0x19'),_0x358345);logger[_0x9982('0xc')]('UpdateChatQueueReport',_0x358345,JSON[_0x9982('0xe')](_0x1ff242));_0x354ab7(_0x1ff242);})[_0x9982('0x12')](function(_0x868f62){logger[_0x9982('0xf')](_0x9982('0x19'),_0x868f62[_0x9982('0x10')],_0x358345);_0x5a0f25(_0x95dd7c['error'](0x1f4,_0x868f62['message']));});});}; \ No newline at end of file +var _0x79ad=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','debug','UpdateChatQueueReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x79ad,0x16e));var _0xd79a=function(_0x5d0792,_0x486759){_0x5d0792=_0x5d0792-0x0;var _0x2885a6=_0x79ad[_0x5d0792];return _0x2885a6;};'use strict';var _=require(_0xd79a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd79a('0x1'));var rs=require(_0xd79a('0x2'));var fs=require('fs');var Redis=require(_0xd79a('0x3'));var db=require(_0xd79a('0x4'))['db'];var utils=require(_0xd79a('0x5'));var logger=require(_0xd79a('0x6'))(_0xd79a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd79a('0x8')][_0xd79a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d3a5a,_0x273f8d,_0x12bf8c){return new BPromise(function(_0x263519,_0x2d3ec9){return client[_0xd79a('0xa')](_0x1d3a5a,_0x12bf8c)[_0xd79a('0xb')](function(_0x3080b0){logger[_0xd79a('0xc')](_0xd79a('0xd'),_0x273f8d,_0xd79a('0xe'));logger['debug'](_0xd79a('0xf'),_0x273f8d,_0xd79a('0xe'),JSON[_0xd79a('0x10')](_0x3080b0));if(_0x3080b0[_0xd79a('0x11')]){if(_0x3080b0[_0xd79a('0x11')][_0xd79a('0x12')]===0x1f4){logger[_0xd79a('0x11')](_0xd79a('0xd'),_0x273f8d,_0x3080b0[_0xd79a('0x11')]['message']);return _0x2d3ec9(_0x3080b0['error'][_0xd79a('0x13')]);}logger['error'](_0xd79a('0xd'),_0x273f8d,_0x3080b0[_0xd79a('0x11')][_0xd79a('0x13')]);return _0x263519(_0x3080b0[_0xd79a('0x11')][_0xd79a('0x13')]);}else{logger[_0xd79a('0xc')](_0xd79a('0xd'),_0x273f8d,_0xd79a('0xe'));_0x263519(_0x3080b0[_0xd79a('0x14')][_0xd79a('0x13')]);}})[_0xd79a('0x15')](function(_0x10f490){logger['error'](_0xd79a('0xd'),_0x273f8d,_0x10f490);_0x2d3ec9(_0x10f490);});});}exports[_0xd79a('0x16')]=function(_0x13a3e1){var _0x96a4b8=this;return new Promise(function(_0x41d296,_0x1a678b){return db[_0xd79a('0x17')][_0xd79a('0x18')](_0x13a3e1[_0xd79a('0x19')],{'raw':_0x13a3e1[_0xd79a('0x1a')]?_0x13a3e1[_0xd79a('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xd79a('0xb')](function(_0x558db5){logger['info']('CreateChatQueueReport',_0x13a3e1);logger[_0xd79a('0x1b')](_0xd79a('0x16'),_0x13a3e1,JSON[_0xd79a('0x10')](_0x558db5));_0x41d296(_0x558db5);})['catch'](function(_0x389520){logger[_0xd79a('0x11')](_0xd79a('0x16'),_0x389520[_0xd79a('0x13')],_0x13a3e1);_0x1a678b(_0x96a4b8['error'](0x1f4,_0x389520['message']));});});};exports['UpdateChatQueueReport']=function(_0x59d86b){var _0x170aa1=this;return new Promise(function(_0x5dcadd,_0x4dbc80){return db[_0xd79a('0x17')]['update'](_0x59d86b['body'],{'raw':_0x59d86b[_0xd79a('0x1a')]?_0x59d86b[_0xd79a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d86b['options']?_0x59d86b['options']['where']||null:null,'attributes':_0x59d86b[_0xd79a('0x1a')]?_0x59d86b[_0xd79a('0x1a')]['attributes']||null:null,'limit':_0x59d86b[_0xd79a('0x1a')]?_0x59d86b['options']['limit']||null:null})[_0xd79a('0xb')](function(_0x5be5bd){logger[_0xd79a('0xc')]('UpdateChatQueueReport',_0x59d86b);logger[_0xd79a('0x1b')](_0xd79a('0x1c'),_0x59d86b,JSON[_0xd79a('0x10')](_0x5be5bd));_0x5dcadd(_0x5be5bd);})[_0xd79a('0x15')](function(_0x37d02c){logger[_0xd79a('0x11')]('UpdateChatQueueReport',_0x37d02c[_0xd79a('0x13')],_0x59d86b);_0x4dbc80(_0x170aa1[_0xd79a('0x11')](0x1f4,_0x37d02c[_0xd79a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a191296..19ca60c 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 _0x10b6=['isAuthenticated','index','/describe','describe','/:id','show','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get'];(function(_0x560497,_0x342635){var _0x6250c1=function(_0x15fd4c){while(--_0x15fd4c){_0x560497['push'](_0x560497['shift']());}};_0x6250c1(++_0x342635);}(_0x10b6,0x172));var _0x610b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x10b6[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x610b('0x0'));var util=require(_0x610b('0x1'));var path=require(_0x610b('0x2'));var timeout=require(_0x610b('0x3'));var express=require('express');var router=express[_0x610b('0x4')]();var fs_extra=require(_0x610b('0x5'));var auth=require(_0x610b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x610b('0x7'));var controller=require(_0x610b('0x8'));router[_0x610b('0x9')]('/',auth[_0x610b('0xa')](),controller[_0x610b('0xb')]);router[_0x610b('0x9')](_0x610b('0xc'),auth['isAuthenticated'](),controller[_0x610b('0xd')]);router[_0x610b('0x9')](_0x610b('0xe'),auth[_0x610b('0xa')](),controller[_0x610b('0xf')]);router['post']('/',auth[_0x610b('0xa')](),controller['create']);router[_0x610b('0x10')](_0x610b('0xe'),auth[_0x610b('0xa')](),controller['update']);router['delete'](_0x610b('0xe'),auth[_0x610b('0xa')](),controller[_0x610b('0x11')]);module[_0x610b('0x12')]=router; \ No newline at end of file +var _0x72ec=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','get','/describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3d18d1,_0x365c54){var _0x1409e9=function(_0x29defd){while(--_0x29defd){_0x3d18d1['push'](_0x3d18d1['shift']());}};_0x1409e9(++_0x365c54);}(_0x72ec,0x95));var _0xc72e=function(_0x70504d,_0x34e810){_0x70504d=_0x70504d-0x0;var _0x47e29b=_0x72ec[_0x70504d];return _0x47e29b;};'use strict';var multer=require(_0xc72e('0x0'));var util=require(_0xc72e('0x1'));var path=require(_0xc72e('0x2'));var timeout=require(_0xc72e('0x3'));var express=require(_0xc72e('0x4'));var router=express[_0xc72e('0x5')]();var fs_extra=require(_0xc72e('0x6'));var auth=require(_0xc72e('0x7'));var interaction=require(_0xc72e('0x8'));var config=require(_0xc72e('0x9'));var controller=require(_0xc72e('0xa'));router['get']('/',auth[_0xc72e('0xb')](),controller['index']);router[_0xc72e('0xc')](_0xc72e('0xd'),auth[_0xc72e('0xb')](),controller['describe']);router[_0xc72e('0xc')]('/:id',auth[_0xc72e('0xb')](),controller['show']);router[_0xc72e('0xe')]('/',auth[_0xc72e('0xb')](),controller[_0xc72e('0xf')]);router[_0xc72e('0x10')](_0xc72e('0x11'),auth[_0xc72e('0xb')](),controller[_0xc72e('0x12')]);router[_0xc72e('0x13')](_0xc72e('0x11'),auth[_0xc72e('0xb')](),controller[_0xc72e('0x14')]);module[_0xc72e('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 373898b..af2341b 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0x54ef,0x112));var _0xf54e=function(_0x34731d,_0x2660af){_0x34731d=_0x34731d-0x0;var _0x2f379e=_0x54ef[_0x34731d];return _0x2f379e;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0xaef372,_0xc57733){var _0x181170=function(_0x55b6db){while(--_0x55b6db){_0xaef372['push'](_0xaef372['shift']());}};_0x181170(++_0xc57733);}(_0xf4eb,0xec));var _0xbf4e=function(_0x307c62,_0x3e7463){_0x307c62=_0x307c62-0x0;var _0x2d4e20=_0xf4eb[_0x307c62];return _0x2d4e20;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 40a49a5..ae2492e 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 _0xdab4=['error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','filters','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x4b39ec,_0x26ae2a){var _0x574102=function(_0x1e9d24){while(--_0x1e9d24){_0x4b39ec['push'](_0x4b39ec['shift']());}};_0x574102(++_0x26ae2a);}(_0xdab4,0x11a));var _0x4dab=function(_0x3619f0,_0x393b23){_0x3619f0=_0x3619f0-0x0;var _0x369c02=_0xdab4[_0x3619f0];return _0x369c02;};'use strict';var emlformat=require(_0x4dab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4dab('0x1'));var jsonpatch=require(_0x4dab('0x2'));var rp=require(_0x4dab('0x3'));var moment=require(_0x4dab('0x4'));var BPromise=require(_0x4dab('0x5'));var Mustache=require(_0x4dab('0x6'));var util=require(_0x4dab('0x7'));var path=require(_0x4dab('0x8'));var sox=require(_0x4dab('0x9'));var csv=require('to-csv');var ejs=require(_0x4dab('0xa'));var fs=require('fs');var fs_extra=require(_0x4dab('0xb'));var _=require(_0x4dab('0xc'));var squel=require(_0x4dab('0xd'));var crypto=require(_0x4dab('0xe'));var jsforce=require(_0x4dab('0xf'));var deskjs=require(_0x4dab('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4dab('0x11'));var Papa=require(_0x4dab('0x12'));var Redis=require('ioredis');var authService=require(_0x4dab('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4dab('0x14'));var hardwareService=require(_0x4dab('0x15'));var logger=require(_0x4dab('0x16'))('api');var utils=require(_0x4dab('0x17'));var config=require(_0x4dab('0x18'));var licenseUtil=require(_0x4dab('0x19'));var db=require(_0x4dab('0x1a'))['db'];function respondWithStatusCode(_0x47d367,_0x51c024){_0x51c024=_0x51c024||0xcc;return function(_0x127b40){if(_0x127b40){return _0x47d367[_0x4dab('0x1b')](_0x51c024);}return _0x47d367['status'](_0x51c024)[_0x4dab('0x1c')]();};}function respondWithResult(_0x5b07dd,_0x2750db){_0x2750db=_0x2750db||0xc8;return function(_0x395fda){if(_0x395fda){return _0x5b07dd[_0x4dab('0x1d')](_0x2750db)[_0x4dab('0x1e')](_0x395fda);}};}function respondWithFilteredResult(_0x4cec35,_0x55743e){return function(_0x4b3019){if(_0x4b3019){var _0x7f4222=typeof _0x55743e[_0x4dab('0x1f')]===_0x4dab('0x20')&&typeof _0x55743e['limit']==='undefined';var _0x93d100=_0x4b3019[_0x4dab('0x21')];var _0x595864=_0x7f4222?0x0:_0x55743e[_0x4dab('0x1f')];var _0x4c6e11=_0x7f4222?_0x4b3019[_0x4dab('0x21')]:_0x55743e['offset']+_0x55743e[_0x4dab('0x22')];var _0x1b422f;if(_0x4c6e11>=_0x93d100){_0x4c6e11=_0x93d100;_0x1b422f=0xc8;}else{_0x1b422f=0xce;}_0x4cec35[_0x4dab('0x1d')](_0x1b422f);return _0x4cec35[_0x4dab('0x23')](_0x4dab('0x24'),_0x595864+'-'+_0x4c6e11+'/'+_0x93d100)[_0x4dab('0x1e')](_0x4b3019);}return null;};}function patchUpdates(_0x95a064){return function(_0x53e814){try{jsonpatch[_0x4dab('0x25')](_0x53e814,_0x95a064,!![]);}catch(_0x1fd2a7){return BPromise[_0x4dab('0x26')](_0x1fd2a7);}return _0x53e814['save']();};}function saveUpdates(_0x21fd93,_0x37549a){return function(_0x4dd0f3){if(_0x4dd0f3){return _0x4dd0f3[_0x4dab('0x27')](_0x21fd93)[_0x4dab('0x28')](function(_0x3c5077){return _0x3c5077;});}return null;};}function removeEntity(_0x17ab24,_0x269cb0){return function(_0xfc646b){if(_0xfc646b){return _0xfc646b[_0x4dab('0x29')]()[_0x4dab('0x28')](function(){_0x17ab24[_0x4dab('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc834,_0x983dec){return function(_0x34ce06){if(!_0x34ce06){_0x4dc834[_0x4dab('0x1b')](0x194);}return _0x34ce06;};}function handleError(_0x34da6a,_0x20d922){_0x20d922=_0x20d922||0x1f4;return function(_0x10925f){logger[_0x4dab('0x2a')](_0x10925f[_0x4dab('0x2b')]);if(_0x10925f['name']){delete _0x10925f[_0x4dab('0x2c')];}_0x34da6a[_0x4dab('0x1d')](_0x20d922)[_0x4dab('0x2d')](_0x10925f);};}exports[_0x4dab('0x2e')]=function(_0x37450c,_0x2b2e68){var _0x3f88d5={},_0x5c913c={},_0xfff2a0={'count':0x0,'rows':[]};var _0x2e5387=_[_0x4dab('0x2f')](db[_0x4dab('0x30')][_0x4dab('0x31')],function(_0x5baab8){return{'name':_0x5baab8[_0x4dab('0x32')],'type':_0x5baab8[_0x4dab('0x33')][_0x4dab('0x34')]};});_0x5c913c['model']=_[_0x4dab('0x2f')](_0x2e5387,_0x4dab('0x2c'));_0x5c913c['query']=_['keys'](_0x37450c[_0x4dab('0x35')]);_0x5c913c['filters']=_[_0x4dab('0x36')](_0x5c913c[_0x4dab('0x37')],_0x5c913c[_0x4dab('0x35')]);_0x3f88d5['attributes']=_['intersection'](_0x5c913c[_0x4dab('0x37')],qs[_0x4dab('0x38')](_0x37450c[_0x4dab('0x35')]['fields']));_0x3f88d5[_0x4dab('0x39')]=_0x3f88d5[_0x4dab('0x39')][_0x4dab('0x3a')]?_0x3f88d5['attributes']:_0x5c913c[_0x4dab('0x37')];if(!_0x37450c[_0x4dab('0x35')][_0x4dab('0x3b')]('nolimit')){_0x3f88d5['limit']=qs[_0x4dab('0x22')](_0x37450c[_0x4dab('0x35')][_0x4dab('0x22')]);_0x3f88d5[_0x4dab('0x1f')]=qs[_0x4dab('0x1f')](_0x37450c['query'][_0x4dab('0x1f')]);}_0x3f88d5[_0x4dab('0x3c')]=qs[_0x4dab('0x3d')](_0x37450c[_0x4dab('0x35')][_0x4dab('0x3d')]);_0x3f88d5['where']=qs['filters'](_[_0x4dab('0x3e')](_0x37450c[_0x4dab('0x35')],_0x5c913c['filters']),_0x2e5387);if(_0x37450c[_0x4dab('0x35')][_0x4dab('0x3f')]){_0x3f88d5['where']=_[_0x4dab('0x40')](_0x3f88d5[_0x4dab('0x41')],{'$or':_['map'](_0x2e5387,function(_0x2d2340){if(_0x2d2340[_0x4dab('0x33')]!==_0x4dab('0x42')){var _0x172993={};_0x172993[_0x2d2340['name']]={'$like':'%'+_0x37450c[_0x4dab('0x35')]['filter']+'%'};return _0x172993;}})});}_0x3f88d5=_[_0x4dab('0x40')]({},_0x3f88d5,_0x37450c['options']);var _0x27114e={'where':_0x3f88d5[_0x4dab('0x41')]};return db['ChatTransferReport'][_0x4dab('0x21')](_0x27114e)[_0x4dab('0x28')](function(_0x134b92){_0xfff2a0['count']=_0x134b92;if(_0x37450c[_0x4dab('0x35')][_0x4dab('0x43')]){_0x3f88d5[_0x4dab('0x44')]=[{'all':!![]}];}return db[_0x4dab('0x30')][_0x4dab('0x45')](_0x3f88d5);})[_0x4dab('0x28')](function(_0x477120){_0xfff2a0[_0x4dab('0x46')]=_0x477120;return _0xfff2a0;})['then'](respondWithFilteredResult(_0x2b2e68,_0x3f88d5))[_0x4dab('0x47')](handleError(_0x2b2e68,null));};exports[_0x4dab('0x48')]=function(_0x41195f,_0x2798c9){var _0x71a014={'raw':!![],'where':{'id':_0x41195f[_0x4dab('0x49')]['id']}},_0x490bd9={};_0x490bd9['model']=_['keys'](db['ChatTransferReport'][_0x4dab('0x31')]);_0x490bd9[_0x4dab('0x35')]=_[_0x4dab('0x4a')](_0x41195f['query']);_0x490bd9[_0x4dab('0x4b')]=_[_0x4dab('0x36')](_0x490bd9['model'],_0x490bd9['query']);_0x71a014[_0x4dab('0x39')]=_[_0x4dab('0x36')](_0x490bd9[_0x4dab('0x37')],qs[_0x4dab('0x38')](_0x41195f['query'][_0x4dab('0x38')]));_0x71a014[_0x4dab('0x39')]=_0x71a014['attributes'][_0x4dab('0x3a')]?_0x71a014[_0x4dab('0x39')]:_0x490bd9[_0x4dab('0x37')];if(_0x41195f['query'][_0x4dab('0x43')]){_0x71a014['include']=[{'all':!![]}];}_0x71a014=_[_0x4dab('0x40')]({},_0x71a014,_0x41195f[_0x4dab('0x4c')]);return db[_0x4dab('0x30')]['find'](_0x71a014)[_0x4dab('0x28')](handleEntityNotFound(_0x2798c9,null))[_0x4dab('0x28')](respondWithResult(_0x2798c9,null))[_0x4dab('0x47')](handleError(_0x2798c9,null));};exports[_0x4dab('0x4d')]=function(_0xa414b5,_0x429adf){return db[_0x4dab('0x30')]['create'](_0xa414b5[_0x4dab('0x4e')],{})[_0x4dab('0x28')](respondWithResult(_0x429adf,0xc9))[_0x4dab('0x47')](handleError(_0x429adf,null));};exports[_0x4dab('0x27')]=function(_0x18d84a,_0x733de){if(_0x18d84a['body']['id']){delete _0x18d84a[_0x4dab('0x4e')]['id'];}return db[_0x4dab('0x30')]['find']({'where':{'id':_0x18d84a[_0x4dab('0x49')]['id']}})[_0x4dab('0x28')](handleEntityNotFound(_0x733de,null))['then'](saveUpdates(_0x18d84a['body'],null))[_0x4dab('0x28')](respondWithResult(_0x733de,null))['catch'](handleError(_0x733de,null));};exports[_0x4dab('0x29')]=function(_0x5dff65,_0x36e5ed){return db['ChatTransferReport'][_0x4dab('0x4f')]({'where':{'id':_0x5dff65['params']['id']}})['then'](handleEntityNotFound(_0x36e5ed,null))[_0x4dab('0x28')](removeEntity(_0x36e5ed,null))[_0x4dab('0x47')](handleError(_0x36e5ed,null));};exports[_0x4dab('0x50')]=function(_0x1eb3a2,_0x416323){return db['ChatTransferReport'][_0x4dab('0x50')]()[_0x4dab('0x28')](respondWithResult(_0x416323,null))[_0x4dab('0x47')](handleError(_0x416323,null));}; \ No newline at end of file +var _0xd3d5=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','intersection','length','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','nolimit'];(function(_0x31d833,_0xda825a){var _0x16d362=function(_0x46cb6c){while(--_0x46cb6c){_0x31d833['push'](_0x31d833['shift']());}};_0x16d362(++_0xda825a);}(_0xd3d5,0xf6));var _0x5d3d=function(_0x274a6c,_0x1a7726){_0x274a6c=_0x274a6c-0x0;var _0x30a5cf=_0xd3d5[_0x274a6c];return _0x30a5cf;};'use strict';var emlformat=require(_0x5d3d('0x0'));var rimraf=require(_0x5d3d('0x1'));var zipdir=require(_0x5d3d('0x2'));var jsonpatch=require(_0x5d3d('0x3'));var rp=require(_0x5d3d('0x4'));var moment=require(_0x5d3d('0x5'));var BPromise=require(_0x5d3d('0x6'));var Mustache=require(_0x5d3d('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5d3d('0x8'));var ejs=require(_0x5d3d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5d3d('0xa'));var crypto=require('crypto');var jsforce=require(_0x5d3d('0xb'));var deskjs=require(_0x5d3d('0xc'));var toCsv=require(_0x5d3d('0x8'));var querystring=require(_0x5d3d('0xd'));var Papa=require(_0x5d3d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5d3d('0xf'));var as=require(_0x5d3d('0x10'));var hardwareService=require(_0x5d3d('0x11'));var logger=require(_0x5d3d('0x12'))(_0x5d3d('0x13'));var utils=require(_0x5d3d('0x14'));var config=require(_0x5d3d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d3d('0x16'))['db'];function respondWithStatusCode(_0x1543f0,_0x50f004){_0x50f004=_0x50f004||0xcc;return function(_0x4b4103){if(_0x4b4103){return _0x1543f0[_0x5d3d('0x17')](_0x50f004);}return _0x1543f0[_0x5d3d('0x18')](_0x50f004)[_0x5d3d('0x19')]();};}function respondWithResult(_0x25b340,_0xdcca91){_0xdcca91=_0xdcca91||0xc8;return function(_0x1c51ba){if(_0x1c51ba){return _0x25b340[_0x5d3d('0x18')](_0xdcca91)[_0x5d3d('0x1a')](_0x1c51ba);}};}function respondWithFilteredResult(_0x5e9cd8,_0x212f8c){return function(_0x550be2){if(_0x550be2){var _0x43a47b=typeof _0x212f8c[_0x5d3d('0x1b')]===_0x5d3d('0x1c')&&typeof _0x212f8c[_0x5d3d('0x1d')]==='undefined';var _0x1ea164=_0x550be2[_0x5d3d('0x1e')];var _0x35317d=_0x43a47b?0x0:_0x212f8c['offset'];var _0x309990=_0x43a47b?_0x550be2[_0x5d3d('0x1e')]:_0x212f8c[_0x5d3d('0x1b')]+_0x212f8c[_0x5d3d('0x1d')];var _0x170d9b;if(_0x309990>=_0x1ea164){_0x309990=_0x1ea164;_0x170d9b=0xc8;}else{_0x170d9b=0xce;}_0x5e9cd8[_0x5d3d('0x18')](_0x170d9b);return _0x5e9cd8[_0x5d3d('0x1f')](_0x5d3d('0x20'),_0x35317d+'-'+_0x309990+'/'+_0x1ea164)[_0x5d3d('0x1a')](_0x550be2);}return null;};}function patchUpdates(_0x23de3f){return function(_0x4d9a11){try{jsonpatch[_0x5d3d('0x21')](_0x4d9a11,_0x23de3f,!![]);}catch(_0x435d11){return BPromise[_0x5d3d('0x22')](_0x435d11);}return _0x4d9a11[_0x5d3d('0x23')]();};}function saveUpdates(_0x4a083b,_0x421f4d){return function(_0x42db5c){if(_0x42db5c){return _0x42db5c[_0x5d3d('0x24')](_0x4a083b)[_0x5d3d('0x25')](function(_0x4325de){return _0x4325de;});}return null;};}function removeEntity(_0x326c82,_0x13b787){return function(_0x4cf820){if(_0x4cf820){return _0x4cf820[_0x5d3d('0x26')]()[_0x5d3d('0x25')](function(){_0x326c82[_0x5d3d('0x18')](0xcc)[_0x5d3d('0x19')]();});}};}function handleEntityNotFound(_0xd0ccbe,_0x3e4230){return function(_0xf2c7ef){if(!_0xf2c7ef){_0xd0ccbe[_0x5d3d('0x17')](0x194);}return _0xf2c7ef;};}function handleError(_0x4014da,_0x3c93f0){_0x3c93f0=_0x3c93f0||0x1f4;return function(_0x4a8a89){logger[_0x5d3d('0x27')](_0x4a8a89['stack']);if(_0x4a8a89[_0x5d3d('0x28')]){delete _0x4a8a89[_0x5d3d('0x28')];}_0x4014da['status'](_0x3c93f0)[_0x5d3d('0x29')](_0x4a8a89);};}exports['index']=function(_0xb819f5,_0x37e91a){var _0x5cdb58={},_0x7b346={},_0x1bc53b={'count':0x0,'rows':[]};var _0x5113a9=_['map'](db[_0x5d3d('0x2a')][_0x5d3d('0x2b')],function(_0x51afbe){return{'name':_0x51afbe[_0x5d3d('0x2c')],'type':_0x51afbe[_0x5d3d('0x2d')][_0x5d3d('0x2e')]};});_0x7b346[_0x5d3d('0x2f')]=_[_0x5d3d('0x30')](_0x5113a9,_0x5d3d('0x28'));_0x7b346[_0x5d3d('0x31')]=_['keys'](_0xb819f5[_0x5d3d('0x31')]);_0x7b346[_0x5d3d('0x32')]=_['intersection'](_0x7b346[_0x5d3d('0x2f')],_0x7b346[_0x5d3d('0x31')]);_0x5cdb58[_0x5d3d('0x33')]=_['intersection'](_0x7b346['model'],qs[_0x5d3d('0x34')](_0xb819f5['query'][_0x5d3d('0x34')]));_0x5cdb58[_0x5d3d('0x33')]=_0x5cdb58[_0x5d3d('0x33')]['length']?_0x5cdb58[_0x5d3d('0x33')]:_0x7b346[_0x5d3d('0x2f')];if(!_0xb819f5['query']['hasOwnProperty'](_0x5d3d('0x35'))){_0x5cdb58[_0x5d3d('0x1d')]=qs[_0x5d3d('0x1d')](_0xb819f5[_0x5d3d('0x31')][_0x5d3d('0x1d')]);_0x5cdb58[_0x5d3d('0x1b')]=qs[_0x5d3d('0x1b')](_0xb819f5['query'][_0x5d3d('0x1b')]);}_0x5cdb58[_0x5d3d('0x36')]=qs[_0x5d3d('0x37')](_0xb819f5[_0x5d3d('0x31')][_0x5d3d('0x37')]);_0x5cdb58[_0x5d3d('0x38')]=qs[_0x5d3d('0x32')](_[_0x5d3d('0x39')](_0xb819f5[_0x5d3d('0x31')],_0x7b346[_0x5d3d('0x32')]),_0x5113a9);if(_0xb819f5[_0x5d3d('0x31')][_0x5d3d('0x3a')]){_0x5cdb58['where']=_[_0x5d3d('0x3b')](_0x5cdb58['where'],{'$or':_[_0x5d3d('0x30')](_0x5113a9,function(_0x333fd4){if(_0x333fd4[_0x5d3d('0x2d')]!==_0x5d3d('0x3c')){var _0x5631a6={};_0x5631a6[_0x333fd4[_0x5d3d('0x28')]]={'$like':'%'+_0xb819f5['query'][_0x5d3d('0x3a')]+'%'};return _0x5631a6;}})});}_0x5cdb58=_[_0x5d3d('0x3b')]({},_0x5cdb58,_0xb819f5[_0x5d3d('0x3d')]);var _0x165590={'where':_0x5cdb58[_0x5d3d('0x38')]};return db[_0x5d3d('0x2a')][_0x5d3d('0x1e')](_0x165590)[_0x5d3d('0x25')](function(_0x117b76){_0x1bc53b['count']=_0x117b76;if(_0xb819f5['query'][_0x5d3d('0x3e')]){_0x5cdb58['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x5d3d('0x3f')](_0x5cdb58);})[_0x5d3d('0x25')](function(_0x157cc5){_0x1bc53b['rows']=_0x157cc5;return _0x1bc53b;})[_0x5d3d('0x25')](respondWithFilteredResult(_0x37e91a,_0x5cdb58))['catch'](handleError(_0x37e91a,null));};exports[_0x5d3d('0x40')]=function(_0x264d38,_0x5e94dd){var _0x42a610={'raw':!![],'where':{'id':_0x264d38[_0x5d3d('0x41')]['id']}},_0x269d3b={};_0x269d3b['model']=_[_0x5d3d('0x42')](db['ChatTransferReport'][_0x5d3d('0x2b')]);_0x269d3b[_0x5d3d('0x31')]=_[_0x5d3d('0x42')](_0x264d38[_0x5d3d('0x31')]);_0x269d3b[_0x5d3d('0x32')]=_[_0x5d3d('0x43')](_0x269d3b[_0x5d3d('0x2f')],_0x269d3b[_0x5d3d('0x31')]);_0x42a610[_0x5d3d('0x33')]=_[_0x5d3d('0x43')](_0x269d3b[_0x5d3d('0x2f')],qs['fields'](_0x264d38[_0x5d3d('0x31')][_0x5d3d('0x34')]));_0x42a610[_0x5d3d('0x33')]=_0x42a610[_0x5d3d('0x33')][_0x5d3d('0x44')]?_0x42a610['attributes']:_0x269d3b['model'];if(_0x264d38[_0x5d3d('0x31')][_0x5d3d('0x3e')]){_0x42a610[_0x5d3d('0x45')]=[{'all':!![]}];}_0x42a610=_[_0x5d3d('0x3b')]({},_0x42a610,_0x264d38[_0x5d3d('0x3d')]);return db[_0x5d3d('0x2a')][_0x5d3d('0x46')](_0x42a610)[_0x5d3d('0x25')](handleEntityNotFound(_0x5e94dd,null))[_0x5d3d('0x25')](respondWithResult(_0x5e94dd,null))[_0x5d3d('0x47')](handleError(_0x5e94dd,null));};exports[_0x5d3d('0x48')]=function(_0x4eb42a,_0x3b8ef5){return db[_0x5d3d('0x2a')][_0x5d3d('0x48')](_0x4eb42a[_0x5d3d('0x49')],{})[_0x5d3d('0x25')](respondWithResult(_0x3b8ef5,0xc9))['catch'](handleError(_0x3b8ef5,null));};exports[_0x5d3d('0x24')]=function(_0x2daf73,_0x3a3e7e){if(_0x2daf73[_0x5d3d('0x49')]['id']){delete _0x2daf73[_0x5d3d('0x49')]['id'];}return db[_0x5d3d('0x2a')]['find']({'where':{'id':_0x2daf73[_0x5d3d('0x41')]['id']}})[_0x5d3d('0x25')](handleEntityNotFound(_0x3a3e7e,null))[_0x5d3d('0x25')](saveUpdates(_0x2daf73['body'],null))[_0x5d3d('0x25')](respondWithResult(_0x3a3e7e,null))['catch'](handleError(_0x3a3e7e,null));};exports[_0x5d3d('0x26')]=function(_0x1b4dac,_0x59bed6){return db[_0x5d3d('0x2a')][_0x5d3d('0x46')]({'where':{'id':_0x1b4dac[_0x5d3d('0x41')]['id']}})[_0x5d3d('0x25')](handleEntityNotFound(_0x59bed6,null))['then'](removeEntity(_0x59bed6,null))[_0x5d3d('0x47')](handleError(_0x59bed6,null));};exports[_0x5d3d('0x4a')]=function(_0x42f858,_0x5cbef7){return db[_0x5d3d('0x2a')]['describe']()[_0x5d3d('0x25')](respondWithResult(_0x5cbef7,null))[_0x5d3d('0x47')](handleError(_0x5cbef7,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 77d10cf..6d914ed 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 _0xcfa1=['api','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x27d217,_0x475037){var _0x5cef01=function(_0x1f66a3){while(--_0x1f66a3){_0x27d217['push'](_0x27d217['shift']());}};_0x5cef01(++_0x475037);}(_0xcfa1,0x80));var _0x1cfa=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcfa1[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x1cfa('0x0'));var util=require(_0x1cfa('0x1'));var logger=require('../../config/logger')(_0x1cfa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1cfa('0x3'));var fs=require('fs');var path=require(_0x1cfa('0x4'));var rimraf=require(_0x1cfa('0x5'));var config=require(_0x1cfa('0x6'));var attributes=require(_0x1cfa('0x7'));module[_0x1cfa('0x8')]=function(_0x2a793c,_0xd5a873){return _0x2a793c[_0x1cfa('0x9')](_0x1cfa('0xa'),attributes,{'tableName':_0x1cfa('0xb'),'paranoid':![],'indexes':[{'name':_0x1cfa('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ecb=['../../config/logger','api','bluebird','path','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0x7ecb,0x1c7));var _0xb7ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ecb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb7ec('0x0'));var util=require('util');var logger=require(_0xb7ec('0x1'))(_0xb7ec('0x2'));var moment=require('moment');var BPromise=require(_0xb7ec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7ec('0x4'));var rimraf=require(_0xb7ec('0x5'));var config=require('../../config/environment');var attributes=require(_0xb7ec('0x6'));module[_0xb7ec('0x7')]=function(_0x4718b2,_0x502efa){return _0x4718b2[_0xb7ec('0x8')](_0xb7ec('0x9'),attributes,{'tableName':_0xb7ec('0xa'),'paranoid':![],'indexes':[{'name':_0xb7ec('0xb'),'fields':[_0xb7ec('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 2dbffd7..9bb9f88 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 _0x01de=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x35a049,_0x58e987){var _0x272abc=function(_0x1cf89a){while(--_0x1cf89a){_0x35a049['push'](_0x35a049['shift']());}};_0x272abc(++_0x58e987);}(_0x01de,0x81));var _0xe01d=function(_0x3b3f6c,_0x3315f4){_0x3b3f6c=_0x3b3f6c-0x0;var _0x1b7f33=_0x01de[_0x3b3f6c];return _0x1b7f33;};'use strict';var _=require('lodash');var util=require(_0xe01d('0x0'));var moment=require(_0xe01d('0x1'));var BPromise=require(_0xe01d('0x2'));var rs=require(_0xe01d('0x3'));var fs=require('fs');var Redis=require(_0xe01d('0x4'));var db=require(_0xe01d('0x5'))['db'];var utils=require(_0xe01d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe01d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe01d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21ba82,_0x5b3503,_0x5f0bad){return new BPromise(function(_0x2a857b,_0x27f92e){return client[_0xe01d('0x9')](_0x21ba82,_0x5f0bad)[_0xe01d('0xa')](function(_0x113738){logger[_0xe01d('0xb')](_0xe01d('0xc'),_0x5b3503,_0xe01d('0xd'));logger[_0xe01d('0xe')](_0xe01d('0xf'),_0x5b3503,'request\x20sent',JSON[_0xe01d('0x10')](_0x113738));if(_0x113738[_0xe01d('0x11')]){if(_0x113738[_0xe01d('0x11')][_0xe01d('0x12')]===0x1f4){logger[_0xe01d('0x11')](_0xe01d('0xc'),_0x5b3503,_0x113738[_0xe01d('0x11')][_0xe01d('0x13')]);return _0x27f92e(_0x113738[_0xe01d('0x11')][_0xe01d('0x13')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x5b3503,_0x113738['error']['message']);return _0x2a857b(_0x113738['error'][_0xe01d('0x13')]);}else{logger[_0xe01d('0xb')](_0xe01d('0xc'),_0x5b3503,_0xe01d('0xd'));_0x2a857b(_0x113738[_0xe01d('0x14')][_0xe01d('0x13')]);}})[_0xe01d('0x15')](function(_0x317b40){logger[_0xe01d('0x11')](_0xe01d('0xc'),_0x5b3503,_0x317b40);_0x27f92e(_0x317b40);});});} \ No newline at end of file +var _0xd62a=['then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd62a,0x172));var _0xad62=function(_0x3a3a6b,_0x59b6ec){_0x3a3a6b=_0x3a3a6b-0x0;var _0x66450a=_0xd62a[_0x3a3a6b];return _0x66450a;};'use strict';var _=require('lodash');var util=require(_0xad62('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xad62('0x1'));var fs=require('fs');var Redis=require(_0xad62('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xad62('0x3'));var logger=require(_0xad62('0x4'))(_0xad62('0x5'));var config=require('../../config/environment');var jayson=require(_0xad62('0x6'));var client=jayson[_0xad62('0x7')][_0xad62('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x580db0,_0x2f09cf,_0x410239){return new BPromise(function(_0xc5b52e,_0x5a9ad4){return client[_0xad62('0x9')](_0x580db0,_0x410239)[_0xad62('0xa')](function(_0xdb6abb){logger[_0xad62('0xb')](_0xad62('0xc'),_0x2f09cf,_0xad62('0xd'));logger[_0xad62('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2f09cf,_0xad62('0xd'),JSON['stringify'](_0xdb6abb));if(_0xdb6abb[_0xad62('0xf')]){if(_0xdb6abb[_0xad62('0xf')][_0xad62('0x10')]===0x1f4){logger[_0xad62('0xf')](_0xad62('0xc'),_0x2f09cf,_0xdb6abb[_0xad62('0xf')][_0xad62('0x11')]);return _0x5a9ad4(_0xdb6abb[_0xad62('0xf')][_0xad62('0x11')]);}logger[_0xad62('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x2f09cf,_0xdb6abb[_0xad62('0xf')][_0xad62('0x11')]);return _0xc5b52e(_0xdb6abb[_0xad62('0xf')][_0xad62('0x11')]);}else{logger['info'](_0xad62('0xc'),_0x2f09cf,_0xad62('0xd'));_0xc5b52e(_0xdb6abb[_0xad62('0x12')][_0xad62('0x11')]);}})[_0xad62('0x13')](function(_0xd9c823){logger['error'](_0xad62('0xc'),_0x2f09cf,_0xd9c823);_0x5a9ad4(_0xd9c823);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index ef8d2bb..e593143 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 _0x25a4=['/:id','show','isAuthenticated','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','index','/describe','describe','get'];(function(_0x3f3bd7,_0x361f3b){var _0x688ea2=function(_0x419d9c){while(--_0x419d9c){_0x3f3bd7['push'](_0x3f3bd7['shift']());}};_0x688ea2(++_0x361f3b);}(_0x25a4,0x9b));var _0x425a=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x25a4[_0x9df060];return _0x338dfe;};'use strict';var multer=require('multer');var util=require(_0x425a('0x0'));var path=require(_0x425a('0x1'));var timeout=require(_0x425a('0x2'));var express=require(_0x425a('0x3'));var router=express[_0x425a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x425a('0x5'));var interaction=require(_0x425a('0x6'));var config=require(_0x425a('0x7'));var controller=require(_0x425a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x425a('0x9')]);router['get'](_0x425a('0xa'),auth['isAuthenticated'](),controller[_0x425a('0xb')]);router[_0x425a('0xc')](_0x425a('0xd'),auth['isAuthenticated'](),controller[_0x425a('0xe')]);router['post']('/',auth[_0x425a('0xf')](),controller[_0x425a('0x10')]);router[_0x425a('0x11')](_0x425a('0xd'),auth[_0x425a('0xf')](),controller[_0x425a('0x12')]);router[_0x425a('0x13')](_0x425a('0xd'),auth[_0x425a('0xf')](),controller[_0x425a('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6622=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','index','get','/describe','isAuthenticated','describe','post','create','put','/:id'];(function(_0x8bf294,_0x1ca4ae){var _0x596021=function(_0x2d1e15){while(--_0x2d1e15){_0x8bf294['push'](_0x8bf294['shift']());}};_0x596021(++_0x1ca4ae);}(_0x6622,0x115));var _0x2662=function(_0x37ae26,_0x2ecd70){_0x37ae26=_0x37ae26-0x0;var _0x1b1902=_0x6622[_0x37ae26];return _0x1b1902;};'use strict';var multer=require(_0x2662('0x0'));var util=require('util');var path=require(_0x2662('0x1'));var timeout=require(_0x2662('0x2'));var express=require('express');var router=express[_0x2662('0x3')]();var fs_extra=require(_0x2662('0x4'));var auth=require(_0x2662('0x5'));var interaction=require(_0x2662('0x6'));var config=require('../../config/environment');var controller=require(_0x2662('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2662('0x8')]);router[_0x2662('0x9')](_0x2662('0xa'),auth[_0x2662('0xb')](),controller[_0x2662('0xc')]);router['get']('/:id',auth[_0x2662('0xb')](),controller['show']);router[_0x2662('0xd')]('/',auth[_0x2662('0xb')](),controller[_0x2662('0xe')]);router[_0x2662('0xf')](_0x2662('0x10'),auth[_0x2662('0xb')](),controller[_0x2662('0x11')]);router[_0x2662('0x12')](_0x2662('0x10'),auth[_0x2662('0xb')](),controller[_0x2662('0x13')]);module[_0x2662('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 3d904fd..043d586 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 _0xea96=['mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','star','stringify','name','text','input','onlineForm','parse','getDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xea96,0x183));var _0x6ea9=function(_0x4b835c,_0xa85bb1){_0x4b835c=_0x4b835c-0x0;var _0x18e7f2=_0xea96[_0x4b835c];return _0x18e7f2;};'use strict';var Sequelize=require(_0x6ea9('0x0'));var rs=require(_0x6ea9('0x1'));module['exports']={'name':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'unique':_0x6ea9('0x3')},'description':{'type':Sequelize[_0x6ea9('0x2')]},'mapKey':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x4')},'mapKeyOffline':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x4')},'key':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6ea9('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'defaultValue':_0x6ea9('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6ea9('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'defaultValue':_0x6ea9('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'defaultValue':_0x6ea9('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6ea9('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6ea9('0x2')]},'animation':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6ea9('0xa')](_0x6ea9('0xb'),'squared'),'defaultValue':_0x6ea9('0xb')},'header_online':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0xc')},'start_chat_button':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0xd')},'offline_chat_button':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6ea9('0x10')]},'closingQuestion':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x13')},'noteTitle':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6ea9('0x16')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6ea9('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize['ENUM'](_0x6ea9('0x18'),'thumb'),'defaultValue':_0x6ea9('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6ea9('0x10')],'defaultValue':function(){return JSON[_0x6ea9('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x6ea9('0x1a'),'type':_0x6ea9('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x6ea9('0x1c'),'props':{'title':_0x6ea9('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6ea9('0x4'),'type':_0x6ea9('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x6ea9('0x1d'))?JSON[_0x6ea9('0x1e')](this[_0x6ea9('0x1f')](_0x6ea9('0x1d'))):{};},'set':function(_0x3c7e68){return this['setDataValue']('onlineForm',JSON[_0x6ea9('0x19')](_0x3c7e68));}},'offlineForm':{'type':Sequelize[_0x6ea9('0x10')],'defaultValue':function(){return JSON[_0x6ea9('0x19')]({'items':[{'type':_0x6ea9('0x1c'),'props':{'title':_0x6ea9('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6ea9('0x4'),'type':_0x6ea9('0x4')},'variable':null},{'type':_0x6ea9('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0x6ea9('0x21'),'helpText':_0x6ea9('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x6ea9('0x1f')](_0x6ea9('0x23'))?JSON[_0x6ea9('0x1e')](this['getDataValue'](_0x6ea9('0x23'))):{};},'set':function(_0x1ef0ec){return this['setDataValue'](_0x6ea9('0x23'),JSON[_0x6ea9('0x19')](_0x1ef0ec));}},'token':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6ea9('0x2')]},'forwardOffline':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6ea9('0x26')},'skipUnmanaged':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x17')},'sendUnmanaged':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x16')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6ea9('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6ea9('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6ea9('0x10')],'defaultValue':function(){return _0x6ea9('0x27');}},'notificationSound':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x6ea9('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ea9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6ea9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':_0x6ea9('0x29')},'verticalAlignment':{'type':Sequelize[_0x6ea9('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x6ea9('0x2')]},'customerAvatar':{'type':Sequelize[_0x6ea9('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6ea9('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6ea9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6ea9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6ea9('0x8')],'comment':_0x6ea9('0x2a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6ea9('0x2b'),'set':function(_0x13460b){if(!_0x13460b)this[_0x6ea9('0x2c')](_0x6ea9('0x2d'),null);this[_0x6ea9('0x2c')]('mandatoryDisposition',_0x13460b);}},'vidaooEscalation':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6ea9('0x2')]},'vidaooTopic':{'type':Sequelize[_0x6ea9('0x2')],'allowNull':![],'defaultValue':_0x6ea9('0x2e')},'vidaooNote':{'type':Sequelize[_0x6ea9('0x2')],'defaultValue':function(){return _0x6ea9('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x6ea9('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6ea9('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6ea9('0x10')]}}; \ No newline at end of file +var _0xeb65=['setDataValue','input','textarea','Leave\x20your\x20comments','getDataValue','parse','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','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','star','thumb','stringify','name','text','onlineForm'];(function(_0x540cf4,_0x21e29e){var _0x254c12=function(_0x5da45e){while(--_0x5da45e){_0x540cf4['push'](_0x540cf4['shift']());}};_0x254c12(++_0x21e29e);}(_0xeb65,0x110));var _0x5eb6=function(_0x565a48,_0x2fd653){_0x565a48=_0x565a48-0x0;var _0x2ce86b=_0xeb65[_0x565a48];return _0x2ce86b;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x5eb6('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x5eb6('0x1')]},'mapKey':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x2')},'mapKeyOffline':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x3')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'defaultValue':_0x5eb6('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'defaultValue':_0x5eb6('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'defaultValue':_0x5eb6('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5eb6('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5eb6('0x1')]},'animation':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5eb6('0x8')](_0x5eb6('0x9'),_0x5eb6('0xa')),'defaultValue':_0x5eb6('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x5eb6('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0xc')},'header_offline':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5eb6('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5eb6('0xe')]},'closingQuestion':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0xf')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5eb6('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x11')},'noteTitle':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x12')},'placeholderMessage':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x13')},'closingMessage':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x14')},'closingMessageButton':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0xc')},'skipMessageButton':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x15')},'conditionAgreement':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x5eb6('0x8')](_0x5eb6('0x16'),_0x5eb6('0x17')),'defaultValue':_0x5eb6('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x5eb6('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5eb6('0xe')],'defaultValue':function(){return JSON[_0x5eb6('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x5eb6('0x19'),'type':_0x5eb6('0x1a'),'required':!![]},'props':{'title':_0x5eb6('0x19'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5eb6('0x2'),'type':_0x5eb6('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x5eb6('0x1b'))?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x3b6b8b){return this[_0x5eb6('0x1c')](_0x5eb6('0x1b'),JSON[_0x5eb6('0x18')](_0x3b6b8b));}},'offlineForm':{'type':Sequelize[_0x5eb6('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5eb6('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x5eb6('0x2')},'variable':null},{'type':_0x5eb6('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x5eb6('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x5eb6('0x20')]('offlineForm')?JSON[_0x5eb6('0x21')](this['getDataValue'](_0x5eb6('0x22'))):{};},'set':function(_0x376f87){return this[_0x5eb6('0x1c')](_0x5eb6('0x22'),JSON[_0x5eb6('0x18')](_0x376f87));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5eb6('0x23')]();}},'autoclose':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5eb6('0x1')]},'waitingTitle':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5eb6('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x27')},'skipUnmanaged':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5eb6('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5eb6('0x28');}},'notificationSound':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x5eb6('0x2b')},'defaultTitle':{'type':Sequelize[_0x5eb6('0x1')]},'customerAvatar':{'type':Sequelize[_0x5eb6('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5eb6('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'defaultValue':_0x5eb6('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5eb6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5eb6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':_0x5eb6('0x2d')},'systemAvatar':{'type':Sequelize[_0x5eb6('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5eb6('0x6')],'comment':_0x5eb6('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![],'comment':_0x5eb6('0x2f'),'set':function(_0x22d130){if(!_0x22d130)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x5eb6('0x30'),_0x22d130);}},'vidaooEscalation':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x5eb6('0x1')]},'vidaooTopic':{'type':Sequelize[_0x5eb6('0x1')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x5eb6('0x1')],'defaultValue':function(){return _0x5eb6('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x5eb6('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x5eb6('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5eb6('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index b4fd1ba..301d7af 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 _0xa9fc=['destroy','ChatWebsites','UserProfileResource','end','sendStatus','stack','name','send','getSnippet','timezone','format','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','inspect','No\x20timezone','map','Interval','Intervals','get','all','some','user-agent-parser','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','vendor','type','index','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','rows','catch','show','params','Pause','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','Disposition','getDispositions','ChatWebsiteId','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','notify','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','ListId','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','list','priority','asc','account','from','contact','headers','threadId','ChatInteraction','externalUrl','interaction','lastName','messageId','created','push','applications','close','*,*,*,*','ChatMessage','UserId','User','unshift','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','EventManager','updatedAt','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','sendMail','\x22%s\x22\x20<%s>','MailAccountId','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Contact','Owner','internal','Tag','Tags','tag','getProactiveActions','virtual','License','increment','utf8','origin','3.5.0','remote','connection','render','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','READ_COMMITTED','ChatApplication','findAndCountAll','getApplications','addProactiveActions','omit','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','handleError','../../mysqldb','redis','defaults','localhost','register','http','client','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','status','json','undefined','limit','count','offset','update'];(function(_0x1b57af,_0x839caa){var _0x242d5d=function(_0xf5e00e){while(--_0xf5e00e){_0x1b57af['push'](_0x1b57af['shift']());}};_0x242d5d(++_0x839caa);}(_0xa9fc,0xfd));var _0xca9f=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0xa9fc[_0x368587];return _0x42d33c;};'use strict';var Mustache=require('mustache');var util=require(_0xca9f('0x0'));var path=require(_0xca9f('0x1'));var ejs=require(_0xca9f('0x2'));var fs=require('fs');var fs_extra=require(_0xca9f('0x3'));var _=require(_0xca9f('0x4'));var querystring=require(_0xca9f('0x5'));var htmlToText=require(_0xca9f('0x6'));var Redis=require(_0xca9f('0x7'));var jayson=require('jayson/promise');var url=require('url');var qs=require(_0xca9f('0x8'));var logger=require(_0xca9f('0x9'))(_0xca9f('0xa'));var config=require(_0xca9f('0xb'));var APIOutOfIntervalError=require('../../errors/api')['APIOutOfIntervalError'];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require('../../errors/api')[_0xca9f('0xc')];var db=require(_0xca9f('0xd'))['db'];config[_0xca9f('0xe')]=_[_0xca9f('0xf')](config[_0xca9f('0xe')],{'host':_0xca9f('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xca9f('0xe')]));require('./chatWebsite.socket')[_0xca9f('0x11')](socket);var client=jayson['client'][_0xca9f('0x12')]({'port':0x232c});var client9002=jayson[_0xca9f('0x13')][_0xca9f('0x12')]({'port':0x232a});var client9003=jayson[_0xca9f('0x13')][_0xca9f('0x12')]({'port':0x232b});var client9001=jayson[_0xca9f('0x13')][_0xca9f('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x4f72c5,_0x18377e,_0x2d0189,_0x424d27){return new Promise(function(_0x37cc03,_0x2d11cb){var _0x36dc70=_0x424d27||client;return _0x36dc70['request'](_0x4f72c5,_0x2d0189)[_0xca9f('0x14')](function(_0x30ae2a){logger['info'](_0xca9f('0x15'),_0x18377e,_0xca9f('0x16'));logger[_0xca9f('0x17')](_0xca9f('0x18'),_0x18377e,_0xca9f('0x16'),JSON[_0xca9f('0x19')](_0x30ae2a));if(_0x30ae2a['error']){if(_0x30ae2a['error'][_0xca9f('0x1a')]===0x1f4){logger[_0xca9f('0x1b')](_0xca9f('0x15'),_0x18377e,_0x30ae2a[_0xca9f('0x1b')][_0xca9f('0x1c')]);return _0x2d11cb(_0x30ae2a[_0xca9f('0x1b')][_0xca9f('0x1c')]);}logger[_0xca9f('0x1b')](_0xca9f('0x15'),_0x18377e,_0x30ae2a[_0xca9f('0x1b')][_0xca9f('0x1c')]);return _0x37cc03(_0x30ae2a[_0xca9f('0x1b')]['message']);}else{logger[_0xca9f('0x1d')](_0xca9f('0x15'),_0x18377e,'request\x20sent');_0x37cc03(_0x30ae2a['result'][_0xca9f('0x1c')]);}})['catch'](function(_0x4ff5b4){logger[_0xca9f('0x1b')](_0xca9f('0x15'),_0x18377e,_0x4ff5b4);_0x2d11cb(_0x4ff5b4);});});}function respondWithStatusCode(_0x3d79b0,_0x173966){_0x173966=_0x173966||0xcc;return function(_0xa34f){if(_0xa34f){return _0x3d79b0['sendStatus'](_0x173966);}return _0x3d79b0[_0xca9f('0x1e')](_0x173966)['end']();};}function respondWithResult(_0x150b46,_0x4a0827){_0x4a0827=_0x4a0827||0xc8;return function(_0x40d00c){if(_0x40d00c){return _0x150b46[_0xca9f('0x1e')](_0x4a0827)[_0xca9f('0x1f')](_0x40d00c);}};}function respondWithFilteredResult(_0x449004,_0x296c16){return function(_0x1f6fab){if(_0x1f6fab){var _0x2cb22f=typeof _0x296c16['offset']===_0xca9f('0x20')&&typeof _0x296c16[_0xca9f('0x21')]==='undefined';var _0x19e8ac=_0x1f6fab[_0xca9f('0x22')];var _0x4b37de=_0x2cb22f?0x0:_0x296c16[_0xca9f('0x23')];var _0x135c51=_0x2cb22f?_0x1f6fab[_0xca9f('0x22')]:_0x296c16[_0xca9f('0x23')]+_0x296c16[_0xca9f('0x21')];var _0x44d7ec;if(_0x135c51>=_0x19e8ac){_0x135c51=_0x19e8ac;_0x44d7ec=0xc8;}else{_0x44d7ec=0xce;}_0x449004[_0xca9f('0x1e')](_0x44d7ec);return _0x449004['set']('Content-Range',_0x4b37de+'-'+_0x135c51+'/'+_0x19e8ac)[_0xca9f('0x1f')](_0x1f6fab);}return null;};}function saveUpdates(_0x43bc6e){return function(_0xde54bf){if(_0xde54bf){return _0xde54bf[_0xca9f('0x24')](_0x43bc6e)[_0xca9f('0x14')](function(_0x1332c4){return _0x1332c4;});}return null;};}function removeEntity(_0x5d5694){return function(_0x3b7969){if(_0x3b7969){return _0x3b7969[_0xca9f('0x25')]()['then'](function(){var _0x2dd14e=_0x3b7969['get']({'plain':!![]});var _0x1af3eb=_0xca9f('0x26');return db[_0xca9f('0x27')][_0xca9f('0x25')]({'where':{'type':_0x1af3eb,'resourceId':_0x2dd14e['id']}})['then'](function(){return _0x3b7969;});})[_0xca9f('0x14')](function(){_0x5d5694[_0xca9f('0x1e')](0xcc)[_0xca9f('0x28')]();});}};}function handleEntityNotFound(_0x2b78b3){return function(_0x19ee44){if(!_0x19ee44){_0x2b78b3[_0xca9f('0x29')](0x194);}return _0x19ee44;};}function handleError(_0x8debf,_0x90c31f){_0x90c31f=_0x90c31f||0x1f4;return function(_0x3eb0b4){logger[_0xca9f('0x1b')](_0x3eb0b4[_0xca9f('0x2a')]);if(_0x3eb0b4[_0xca9f('0x2b')]){delete _0x3eb0b4['name'];}_0x8debf[_0xca9f('0x1e')](_0x90c31f)[_0xca9f('0x2c')](_0x3eb0b4);};}function iftimePromise(_0x238997,_0x52309c){return respondWithRpcPromise('Command',_0xca9f('0x2d'),{'command':_0x52309c[_0xca9f('0x2e')]?util[_0xca9f('0x2f')](_0xca9f('0x30'),_0x238997[_0xca9f('0x31')],_0x52309c['timezone']):util[_0xca9f('0x2f')](_0xca9f('0x32'),_0x238997[_0xca9f('0x31')])},client9002)[_0xca9f('0x14')](function(_0xefedc8){var _0x5e0de0=_0xefedc8&&_0xefedc8['indexOf'](_0xca9f('0x33'))>=0x0?!![]:![];logger[_0xca9f('0x1d')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x52309c['id'],_0x238997['id'],_0x238997['interval'],_0x5e0de0?_0xca9f('0x34'):'OFFLINE',_0x52309c[_0xca9f('0x2e')]?_0x52309c[_0xca9f('0x2e')]:'No\x20timezone');return _0x5e0de0;})['catch'](function(_0x5588ea){logger[_0xca9f('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x52309c['id'],_0x238997['id'],_0x238997['interval'],util[_0xca9f('0x35')](_0x5588ea,{'showHidden':![],'depth':null}),_0x52309c[_0xca9f('0x2e')]?_0x52309c['timezone']:_0xca9f('0x36'));return![];});}function checkWebsiteIntervals(_0x87bb97){var _0x163090=_[_0xca9f('0x37')](_0x87bb97[_0xca9f('0x38')][_0xca9f('0x39')],function(_0x55b6ee){var _0x4494df=_0x55b6ee[_0xca9f('0x3a')]({'plain':!![]});return iftimePromise(_0x4494df,_0x87bb97);});return Promise[_0xca9f('0x3b')](_0x163090)['then'](function(_0x1931bc){return _[_0xca9f('0x3c')](_0x1931bc);});}function createInteractionObject(_0x133796,_0x56c6e5,_0x3abe1b,_0x11f2a8){var _0x61320a=require(_0xca9f('0x3d'));var _0x12d7b9=new _0x61320a();var _0x520035=_0x12d7b9[_0xca9f('0x3e')](_0x3abe1b['user-agent'])[_0xca9f('0x3f')]();var _0xe90b13=_0x56c6e5[_0xca9f('0x40')];if(_0x3abe1b[_0xca9f('0x41')]){_0xe90b13=_0x3abe1b[_0xca9f('0x41')];}else if(_0x3abe1b[_0xca9f('0x42')]){_0xe90b13=_[_0xca9f('0x43')](_0x3abe1b[_0xca9f('0x42')][_0xca9f('0x44')](','));}return{'ContactId':_0x11f2a8['id'],'ChatWebsiteId':_0x133796,'from':(_0x11f2a8[_0xca9f('0x45')]||'')+'\x20'+(_0x11f2a8['lastName']||''),'customerIp':_0xe90b13,'customerPort':_0x3abe1b[_0xca9f('0x46')]?_0x3abe1b[_0xca9f('0x46')]:null,'referer':_0x56c6e5[_0xca9f('0x47')],'browserName':_0x520035[_0xca9f('0x48')][_0xca9f('0x2b')]&&_0x520035['browser'][_0xca9f('0x49')]?util[_0xca9f('0x2f')](_0xca9f('0x4a'),_0x520035['browser'][_0xca9f('0x2b')],_0x520035[_0xca9f('0x48')][_0xca9f('0x49')]):_0xca9f('0x4b'),'browserVersion':_0x520035[_0xca9f('0x48')][_0xca9f('0x49')]||'unknown','osName':util[_0xca9f('0x2f')](_0xca9f('0x4a'),_0x520035['os'][_0xca9f('0x2b')],_0x520035['os'][_0xca9f('0x49')]),'osVersion':_0x520035['os'][_0xca9f('0x49')],'deviceModel':_0x520035[_0xca9f('0x4c')][_0xca9f('0x4d')]&&_0x520035[_0xca9f('0x4c')][_0xca9f('0x4e')]?util[_0xca9f('0x2f')]('%s\x20%s\x20%s',_0x520035[_0xca9f('0x4c')]['model'],_0x520035[_0xca9f('0x4c')][_0xca9f('0x4e')],_0x520035[_0xca9f('0x4c')][_0xca9f('0x4f')]):null,'deviceVendor':_0x520035[_0xca9f('0x4c')][_0xca9f('0x4e')],'deviceType':_0x520035['device']['type'],'formData':JSON[_0xca9f('0x19')](_0x56c6e5)};}exports[_0xca9f('0x50')]=function(_0x509c9d,_0x1b1047){var _0x5582ca={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2de39c={},_0x338d6f={'count':0x0,'rows':[]};var _0x397125=_[_0xca9f('0x37')](db[_0xca9f('0x51')][_0xca9f('0x52')],function(_0x45f9bc){return{'name':_0x45f9bc[_0xca9f('0x53')],'type':_0x45f9bc[_0xca9f('0x4f')][_0xca9f('0x54')]};});_0x2de39c[_0xca9f('0x4d')]=_['map'](_0x397125,_0xca9f('0x2b'));_0x2de39c[_0xca9f('0x55')]=_[_0xca9f('0x56')](_0x509c9d[_0xca9f('0x55')]);_0x2de39c[_0xca9f('0x57')]=_[_0xca9f('0x58')](_0x2de39c[_0xca9f('0x4d')],_0x2de39c['query']);_0x5582ca[_0xca9f('0x59')]=_[_0xca9f('0x58')](_0x2de39c['model'],qs[_0xca9f('0x5a')](_0x509c9d[_0xca9f('0x55')]['fields']));_0x5582ca[_0xca9f('0x59')]=_0x5582ca[_0xca9f('0x59')][_0xca9f('0x5b')]?_0x5582ca[_0xca9f('0x59')]:_0x2de39c[_0xca9f('0x4d')];if(!_0x509c9d[_0xca9f('0x55')][_0xca9f('0x5c')](_0xca9f('0x5d'))){_0x5582ca['limit']=qs['limit'](_0x509c9d[_0xca9f('0x55')]['limit']);_0x5582ca[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0x509c9d[_0xca9f('0x55')][_0xca9f('0x23')]);}_0x5582ca[_0xca9f('0x5e')]=qs[_0xca9f('0x5f')](_0x509c9d['query'][_0xca9f('0x5f')]);_0x5582ca[_0xca9f('0x60')]=qs[_0xca9f('0x57')](_[_0xca9f('0x61')](_0x509c9d[_0xca9f('0x55')],_0x2de39c[_0xca9f('0x57')]),_0x397125);if(_0x509c9d[_0xca9f('0x55')][_0xca9f('0x62')]){_0x5582ca[_0xca9f('0x60')]=_['merge'](_0x5582ca['where'],{'$or':_['map'](_0x397125,function(_0x207067){if(_0x207067[_0xca9f('0x4f')]!==_0xca9f('0x63')){var _0x3fb80d={};_0x3fb80d[_0x207067[_0xca9f('0x2b')]]={'$like':'%'+_0x509c9d[_0xca9f('0x55')][_0xca9f('0x62')]+'%'};return _0x3fb80d;}})});}_0x5582ca=_[_0xca9f('0x64')]({},_0x5582ca,_0x509c9d[_0xca9f('0x65')]);var _0x5e1e2f={'where':_0x5582ca['where']};return db[_0xca9f('0x51')][_0xca9f('0x22')](_0x5e1e2f)[_0xca9f('0x14')](function(_0x8fb35f){_0x338d6f['count']=_0x8fb35f;if(_0x509c9d[_0xca9f('0x55')]['includeAll']){_0x5582ca['include']=[{'all':!![]}];}return db[_0xca9f('0x51')]['findAll'](_0x5582ca);})[_0xca9f('0x14')](function(_0x376b85){_0x338d6f[_0xca9f('0x66')]=_0x376b85;return _0x338d6f;})[_0xca9f('0x14')](respondWithFilteredResult(_0x1b1047,_0x5582ca))[_0xca9f('0x67')](handleError(_0x1b1047,null));};exports[_0xca9f('0x68')]=function(_0x19ae59,_0x95acdf){var _0x20727d={'raw':![],'where':{'id':_0x19ae59[_0xca9f('0x69')]['id']},'include':[{'model':db[_0xca9f('0x6a')],'as':'mandatoryDispositionPause'}]},_0x491a61={};_0x491a61['model']=_[_0xca9f('0x56')](db[_0xca9f('0x51')]['rawAttributes']);_0x491a61[_0xca9f('0x55')]=_[_0xca9f('0x56')](_0x19ae59[_0xca9f('0x55')]);_0x491a61['filters']=_['intersection'](_0x491a61[_0xca9f('0x4d')],_0x491a61[_0xca9f('0x55')]);_0x20727d[_0xca9f('0x59')]=_[_0xca9f('0x58')](_0x491a61[_0xca9f('0x4d')],qs[_0xca9f('0x5a')](_0x19ae59[_0xca9f('0x55')]['fields']));_0x20727d['attributes']=_0x20727d['attributes']['length']?_0x20727d[_0xca9f('0x59')]:_0x491a61[_0xca9f('0x4d')];if(_0x19ae59[_0xca9f('0x55')][_0xca9f('0x6b')]){_0x20727d['include']=[{'all':!![]}];}_0x20727d=_[_0xca9f('0x64')]({},_0x20727d,_0x19ae59['options']);return db[_0xca9f('0x51')][_0xca9f('0x6c')](_0x20727d)['then'](handleEntityNotFound(_0x95acdf,null))['then'](respondWithResult(_0x95acdf,null))[_0xca9f('0x67')](handleError(_0x95acdf,null));};exports[_0xca9f('0x6d')]=function(_0x52d135,_0x23b7b1){return db[_0xca9f('0x51')]['create'](_0x52d135[_0xca9f('0x6e')],{})['then'](function(_0x26e351){var _0x448806=_0x52d135['user'][_0xca9f('0x3a')]({'plain':!![]});if(!_0x448806)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x448806[_0xca9f('0x6f')]===_0xca9f('0x70')){var _0x4b7b59=_0x26e351['get']({'plain':!![]});var _0x3d14cd='ChatWebsites';return db[_0xca9f('0x71')]['find']({'where':{'name':_0x3d14cd,'userProfileId':_0x448806[_0xca9f('0x72')]},'raw':!![]})[_0xca9f('0x14')](function(_0x9c2a4c){if(_0x9c2a4c&&_0x9c2a4c[_0xca9f('0x73')]===0x0){return db[_0xca9f('0x27')][_0xca9f('0x6d')]({'name':_0x4b7b59['name'],'resourceId':_0x4b7b59['id'],'type':_0x9c2a4c['name'],'sectionId':_0x9c2a4c['id']},{})[_0xca9f('0x14')](function(){return _0x26e351;});}else{return _0x26e351;}})['catch'](function(_0x5251a9){logger[_0xca9f('0x1b')](_0xca9f('0x74'),_0x5251a9);throw _0x5251a9;});}return _0x26e351;})[_0xca9f('0x14')](respondWithResult(_0x23b7b1,0xc9))['catch'](handleError(_0x23b7b1,null));};exports[_0xca9f('0x24')]=function(_0x12b983,_0x49484e){if(_0x12b983['body']['id']){delete _0x12b983[_0xca9f('0x6e')]['id'];}return db['ChatWebsite'][_0xca9f('0x6c')]({'where':{'id':_0x12b983[_0xca9f('0x69')]['id']},'include':[{'model':db[_0xca9f('0x6a')],'as':_0xca9f('0x75')}]})[_0xca9f('0x14')](handleEntityNotFound(_0x49484e,null))[_0xca9f('0x14')](saveUpdates(_0x12b983['body'],null))['then'](respondWithResult(_0x49484e,null))[_0xca9f('0x67')](handleError(_0x49484e,null));};exports['destroy']=function(_0x2d7c5a,_0x4ec969){return db['ChatWebsite'][_0xca9f('0x6c')]({'where':{'id':_0x2d7c5a['params']['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x4ec969,null))[_0xca9f('0x14')](removeEntity(_0x4ec969,null))[_0xca9f('0x67')](handleError(_0x4ec969,null));};exports[_0xca9f('0x76')]=function(_0x1e4e99,_0x3c9816){return db['ChatWebsite'][_0xca9f('0x76')]()['then'](respondWithResult(_0x3c9816,null))[_0xca9f('0x67')](handleError(_0x3c9816,null));};exports[_0xca9f('0x77')]=function(_0x2a3954,_0x235b6b){if(_0x2a3954[_0xca9f('0x6e')]['id']){delete _0x2a3954['body']['id'];}return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x2a3954[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x235b6b,null))['then'](function(_0x36a3fe){if(_0x36a3fe){_0x2a3954[_0xca9f('0x6e')]['ChatWebsiteId']=_0x36a3fe['id'];return db[_0xca9f('0x78')][_0xca9f('0x6d')](_0x2a3954['body']);}})[_0xca9f('0x14')](respondWithResult(_0x235b6b,null))[_0xca9f('0x67')](handleError(_0x235b6b,null));};exports[_0xca9f('0x79')]=function(_0x1c0445,_0x2a922b){var _0xc4969f={'raw':![],'where':{}};var _0x2e80f2={};var _0x3d87ef={'count':0x0,'rows':[]};return db[_0xca9f('0x51')]['findOne']({'where':{'id':_0x1c0445[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x2a922b,null))[_0xca9f('0x14')](function(_0x46a58d){if(_0x46a58d){_0x2e80f2[_0xca9f('0x4d')]=_[_0xca9f('0x56')](db[_0xca9f('0x78')][_0xca9f('0x52')]);_0x2e80f2[_0xca9f('0x55')]=_['keys'](_0x1c0445[_0xca9f('0x55')]);_0x2e80f2[_0xca9f('0x57')]=_['intersection'](_0x2e80f2[_0xca9f('0x4d')],_0x2e80f2[_0xca9f('0x55')]);_0xc4969f['attributes']=_['intersection'](_0x2e80f2['model'],qs[_0xca9f('0x5a')](_0x1c0445[_0xca9f('0x55')][_0xca9f('0x5a')]));_0xc4969f[_0xca9f('0x59')]=_0xc4969f['attributes']['length']?_0xc4969f[_0xca9f('0x59')]:_0x2e80f2[_0xca9f('0x4d')];if(!_0x1c0445[_0xca9f('0x55')]['hasOwnProperty']('nolimit')){_0xc4969f[_0xca9f('0x21')]=qs[_0xca9f('0x21')](_0x1c0445[_0xca9f('0x55')][_0xca9f('0x21')]);_0xc4969f[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0x1c0445[_0xca9f('0x55')][_0xca9f('0x23')]);}_0xc4969f[_0xca9f('0x5e')]=qs[_0xca9f('0x5f')](_0x1c0445['query'][_0xca9f('0x5f')]);_0xc4969f[_0xca9f('0x60')]=qs[_0xca9f('0x57')](_['pick'](_0x1c0445[_0xca9f('0x55')],_0x2e80f2[_0xca9f('0x57')]));_0xc4969f[_0xca9f('0x60')][_0xca9f('0x7a')]=_0x46a58d['id'];if(_0x1c0445['query']['filter']){_0xc4969f[_0xca9f('0x60')]=_[_0xca9f('0x64')](_0xc4969f[_0xca9f('0x60')],{'$or':_[_0xca9f('0x37')](_0xc4969f[_0xca9f('0x59')],function(_0x40e2bd){var _0x490beb={};_0x490beb[_0x40e2bd]={'$like':'%'+_0x1c0445[_0xca9f('0x55')]['filter']+'%'};return _0x490beb;})});}_0xc4969f=_[_0xca9f('0x64')]({},_0xc4969f,_0x1c0445[_0xca9f('0x65')]);return db['Disposition'][_0xca9f('0x22')]({'where':_0xc4969f[_0xca9f('0x60')]})['then'](function(_0x26691a){_0x3d87ef[_0xca9f('0x22')]=_0x26691a;if(_0x1c0445[_0xca9f('0x55')][_0xca9f('0x6b')]){_0xc4969f[_0xca9f('0x7b')]=[{'all':!![]}];}return db[_0xca9f('0x78')][_0xca9f('0x7c')](_0xc4969f);})[_0xca9f('0x14')](function(_0x2b5a67){_0x3d87ef[_0xca9f('0x66')]=_0x2b5a67;return _0x3d87ef;});}})[_0xca9f('0x14')](respondWithFilteredResult(_0x2a922b,_0xc4969f))['catch'](handleError(_0x2a922b,null));};exports['removeDispositions']=function(_0x419d25,_0x5c1074){return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x419d25[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x5c1074,null))[_0xca9f('0x14')](function(_0x5f3b41){if(_0x5f3b41){return _0x5f3b41[_0xca9f('0x7d')](_0x419d25[_0xca9f('0x55')][_0xca9f('0x7e')]);}})[_0xca9f('0x14')](respondWithStatusCode(_0x5c1074,null))[_0xca9f('0x67')](handleError(_0x5c1074,null));};exports[_0xca9f('0x7f')]=function(_0x43e2f3,_0x280c4e){if(_0x43e2f3[_0xca9f('0x6e')]['id']){delete _0x43e2f3[_0xca9f('0x6e')]['id'];}return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x43e2f3[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x280c4e,null))[_0xca9f('0x14')](function(_0x50b0d5){if(_0x50b0d5){_0x43e2f3[_0xca9f('0x6e')][_0xca9f('0x7a')]=_0x50b0d5['id'];return db[_0xca9f('0x80')][_0xca9f('0x6d')](_0x43e2f3[_0xca9f('0x6e')]);}})[_0xca9f('0x14')](respondWithResult(_0x280c4e,null))['catch'](handleError(_0x280c4e,null));};exports[_0xca9f('0x81')]=function(_0xbfdf0,_0x504f24){var _0x247761={'raw':![],'where':{}};var _0x390b25={};var _0x44b89e={'count':0x0,'rows':[]};return db[_0xca9f('0x51')][_0xca9f('0x82')]({'where':{'id':_0xbfdf0[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x504f24,null))[_0xca9f('0x14')](function(_0x419f76){if(_0x419f76){_0x390b25['model']=_['keys'](db[_0xca9f('0x80')][_0xca9f('0x52')]);_0x390b25['query']=_[_0xca9f('0x56')](_0xbfdf0[_0xca9f('0x55')]);_0x390b25[_0xca9f('0x57')]=_[_0xca9f('0x58')](_0x390b25[_0xca9f('0x4d')],_0x390b25[_0xca9f('0x55')]);_0x247761[_0xca9f('0x59')]=_['intersection'](_0x390b25['model'],qs[_0xca9f('0x5a')](_0xbfdf0[_0xca9f('0x55')][_0xca9f('0x5a')]));_0x247761['attributes']=_0x247761[_0xca9f('0x59')][_0xca9f('0x5b')]?_0x247761[_0xca9f('0x59')]:_0x390b25['model'];if(!_0xbfdf0['query']['hasOwnProperty'](_0xca9f('0x5d'))){_0x247761[_0xca9f('0x21')]=qs['limit'](_0xbfdf0['query']['limit']);_0x247761[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0xbfdf0[_0xca9f('0x55')]['offset']);}_0x247761['order']=qs[_0xca9f('0x5f')](_0xbfdf0['query'][_0xca9f('0x5f')]);_0x247761[_0xca9f('0x60')]=qs[_0xca9f('0x57')](_[_0xca9f('0x61')](_0xbfdf0[_0xca9f('0x55')],_0x390b25[_0xca9f('0x57')]));_0x247761[_0xca9f('0x60')][_0xca9f('0x7a')]=_0x419f76['id'];if(_0xbfdf0[_0xca9f('0x55')][_0xca9f('0x62')]){_0x247761[_0xca9f('0x60')]=_[_0xca9f('0x64')](_0x247761['where'],{'$or':_[_0xca9f('0x37')](_0x247761['attributes'],function(_0x42dd70){var _0x1b0b37={};_0x1b0b37[_0x42dd70]={'$like':'%'+_0xbfdf0[_0xca9f('0x55')][_0xca9f('0x62')]+'%'};return _0x1b0b37;})});}_0x247761=_[_0xca9f('0x64')]({},_0x247761,_0xbfdf0[_0xca9f('0x65')]);return db['CannedAnswer'][_0xca9f('0x22')]({'where':_0x247761[_0xca9f('0x60')]})['then'](function(_0x534daa){_0x44b89e[_0xca9f('0x22')]=_0x534daa;if(_0xbfdf0[_0xca9f('0x55')]['includeAll']){_0x247761['include']=[{'all':!![]}];}return db[_0xca9f('0x80')]['findAll'](_0x247761);})[_0xca9f('0x14')](function(_0x185a8c){_0x44b89e['rows']=_0x185a8c;return _0x44b89e;});}})[_0xca9f('0x14')](respondWithFilteredResult(_0x504f24,_0x247761))[_0xca9f('0x67')](handleError(_0x504f24,null));};exports[_0xca9f('0x83')]=function(_0x59080c,_0x12c4a7){return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x59080c[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x12c4a7,null))['then'](function(_0x2fcd16){if(_0x2fcd16){return _0x2fcd16[_0xca9f('0x83')](_0x59080c[_0xca9f('0x55')][_0xca9f('0x7e')]);}})[_0xca9f('0x14')](respondWithStatusCode(_0x12c4a7,null))[_0xca9f('0x67')](handleError(_0x12c4a7,null));};exports[_0xca9f('0x84')]=function(_0x2c74b7,_0xc598fe){_0x2c74b7['body'][_0xca9f('0x85')]=_0x2c74b7['file'][_0xca9f('0x86')];return db['ChatWebsite'][_0xca9f('0x6c')]({'where':{'id':_0x2c74b7[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0xc598fe,null))['then'](saveUpdates(_0x2c74b7[_0xca9f('0x6e')],null))['then'](respondWithResult(_0xc598fe,null))[_0xca9f('0x67')](handleError(_0xc598fe,null));};exports['addAvatar']=function(_0x1f82c2,_0x192bb8){_0x1f82c2[_0xca9f('0x6e')][_0xca9f('0x87')]=_0x1f82c2[_0xca9f('0x88')][_0xca9f('0x86')];return db['ChatWebsite']['find']({'where':{'id':_0x1f82c2[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x192bb8,null))[_0xca9f('0x14')](saveUpdates(_0x1f82c2[_0xca9f('0x6e')],null))['then'](respondWithResult(_0x192bb8,null))[_0xca9f('0x67')](handleError(_0x192bb8,null));};exports['addCustomerAvatar']=function(_0x1ff090,_0x5902b6){_0x1ff090[_0xca9f('0x6e')][_0xca9f('0x89')]=_0x1ff090[_0xca9f('0x88')][_0xca9f('0x86')];return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x1ff090['params']['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x5902b6,null))[_0xca9f('0x14')](saveUpdates(_0x1ff090[_0xca9f('0x6e')],null))['then'](respondWithResult(_0x5902b6,null))[_0xca9f('0x67')](handleError(_0x5902b6,null));};exports['addSystemAvatar']=function(_0x1b87c8,_0x396b04){_0x1b87c8[_0xca9f('0x6e')][_0xca9f('0x8a')]=_0x1b87c8['file'][_0xca9f('0x86')];return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x1b87c8[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x396b04,null))[_0xca9f('0x14')](saveUpdates(_0x1b87c8[_0xca9f('0x6e')],null))[_0xca9f('0x14')](respondWithResult(_0x396b04,null))[_0xca9f('0x67')](handleError(_0x396b04,null));};exports[_0xca9f('0x8b')]=function(_0x8ea22f,_0x365a8a){var _0x223732=path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],_0xca9f('0x8e'));var _0x4c7625={'where':{'id':_0x8ea22f['params']['id']},'attributes':['id',_0xca9f('0x85')],'raw':!![]};var _0x4622c6=![];return require(_0xca9f('0x8f'))[_0xca9f('0x90')]()[_0xca9f('0x14')](function(_0x32c2a8){if(_0x32c2a8){_0x4622c6=_0x32c2a8[_0xca9f('0x91')];}})[_0xca9f('0x14')](function(){return db[_0xca9f('0x51')]['find'](_0x4c7625);})[_0xca9f('0x14')](handleEntityNotFound(_0x365a8a,null))[_0xca9f('0x14')](function(_0x4e9574){if(_0x4e9574){if(!_[_0xca9f('0x92')](_0x4e9574['sitepic'])){if(fs[_0xca9f('0x93')](path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],_0xca9f('0x94'),_0x4e9574['sitepic']))&&_0x4622c6){_0x223732=path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],_0xca9f('0x94'),_0x4e9574[_0xca9f('0x85')]);}}return _0x365a8a[_0xca9f('0x95')](_0x223732);}})['catch'](handleError(_0x365a8a,null));};exports['getAvatar']=function(_0x3dec24,_0xe232e5){var _0x29df49=path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],_0xca9f('0x96'));var _0x97a0f5={'where':{'id':_0x3dec24[_0xca9f('0x69')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xca9f('0x51')][_0xca9f('0x6c')](_0x97a0f5)['then'](handleEntityNotFound(_0xe232e5,null))[_0xca9f('0x14')](function(_0x462254){if(_0x462254){if(!_[_0xca9f('0x92')](_0x462254['agentAvatar'])){if(fs['existsSync'](path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],'server/files/images/avatars/',_0x462254[_0xca9f('0x87')]))){_0x29df49=path['join'](config[_0xca9f('0x8d')],_0xca9f('0x97'),_0x462254[_0xca9f('0x87')]);}}return _0xe232e5['download'](_0x29df49);}})[_0xca9f('0x67')](handleError(_0xe232e5,null));};exports[_0xca9f('0x98')]=function(_0x948c25,_0x57e916){var _0x4545cc=path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],'server/files/images/avatars/customer_avatar.png');var _0x4a3d38={'where':{'id':_0x948c25[_0xca9f('0x69')]['id']},'attributes':['id',_0xca9f('0x89'),_0xca9f('0x99')],'raw':!![]};return db[_0xca9f('0x51')][_0xca9f('0x6c')](_0x4a3d38)[_0xca9f('0x14')](handleEntityNotFound(_0x57e916,null))[_0xca9f('0x14')](function(_0xdd77d5){if(_0xdd77d5){if(!_[_0xca9f('0x92')](_0xdd77d5[_0xca9f('0x89')])){if(fs[_0xca9f('0x93')](path[_0xca9f('0x8c')](config['root'],_0xca9f('0x97'),_0xdd77d5[_0xca9f('0x89')]))&&_0xdd77d5['showCustomerAvatar']){_0x4545cc=path[_0xca9f('0x8c')](config['root'],'server/files/images/avatars/',_0xdd77d5[_0xca9f('0x89')]);}}return _0x57e916[_0xca9f('0x95')](_0x4545cc);}})[_0xca9f('0x67')](handleError(_0x57e916,null));};exports['getSystemAvatar']=function(_0x295479,_0xb8fc0e){var _0x502a19=path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],'server/files/images/avatars/system_avatar.png');var _0x354695={'where':{'id':_0x295479[_0xca9f('0x69')]['id']},'attributes':['id',_0xca9f('0x8a')],'raw':!![]};return db['ChatWebsite']['find'](_0x354695)[_0xca9f('0x14')](handleEntityNotFound(_0xb8fc0e,null))[_0xca9f('0x14')](function(_0x3bee67){if(_0x3bee67){if(!_[_0xca9f('0x92')](_0x3bee67[_0xca9f('0x8a')])){if(fs[_0xca9f('0x93')](path['join'](config[_0xca9f('0x8d')],_0xca9f('0x97'),_0x3bee67[_0xca9f('0x8a')]))){_0x502a19=path[_0xca9f('0x8c')](config['root'],_0xca9f('0x97'),_0x3bee67[_0xca9f('0x8a')]);}}return _0xb8fc0e[_0xca9f('0x95')](_0x502a19);}})[_0xca9f('0x67')](handleError(_0xb8fc0e,null));};exports[_0xca9f('0x9a')]=function(_0x2c2686,_0x409bf0){var _0x2ca6f2={'body':_0x2c2686[_0xca9f('0x6e')],'channel':_0xca9f('0x9b')};var _0x2771be=[];var _0x36097d=[];var _0x331e75={};var _0x122302=![];return db[_0xca9f('0x9c')][_0xca9f('0x76')]()[_0xca9f('0x14')](function(_0x5a309c){if(!_0x5a309c){throw new db['Sequelize'][(_0xca9f('0x9d'))](_0xca9f('0x9e'));}_0x2771be=_[_0xca9f('0x9f')](_['keys'](_0x5a309c),[_0xca9f('0xa0'),'updatedAt']);_0x36097d=_['difference'](_[_0xca9f('0x56')](_0x5a309c),[_0xca9f('0xa0'),'updatedAt','CompanyId',_0xca9f('0xa1')]);if(_0x2c2686[_0xca9f('0x6e')]['id']){delete _0x2c2686['body']['id'];}if(_[_0xca9f('0x92')](_0x2c2686['body']['from'])){throw new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xa3'));}if(_[_0xca9f('0x92')](_0x2c2686[_0xca9f('0x6e')][_0xca9f('0x6e')])||_0x2c2686['body'][_0xca9f('0x6e')]===''){throw new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xa4'));}if(_[_0xca9f('0x92')](_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xa5')])){throw new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xa6')+_0x36097d);}if(!_[_0xca9f('0xa7')](_0x36097d,_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xa5')])){throw new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xa8')+_0x36097d);}_0x331e75[_0x2c2686['body'][_0xca9f('0xa5')]]=_0x2c2686[_0xca9f('0x6e')]['from'];})[_0xca9f('0x14')](function(){return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x2c2686[_0xca9f('0x69')]['id']},'include':[{'model':db[_0xca9f('0xa9')],'as':_0xca9f('0xaa'),'include':[{'model':db[_0xca9f('0x9c')],'as':_0xca9f('0xab'),'where':_0x331e75,'limit':0x1,'order':[['updatedAt',_0xca9f('0xac')]]}]},{'model':db['ChatApplication'],'as':_0xca9f('0xad')},{'model':db[_0xca9f('0x38')],'as':_0xca9f('0x38'),'include':[{'model':db[_0xca9f('0x38')],'as':_0xca9f('0x39'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0xca9f('0x14')](function(_0x5d9417){if(!_0x5d9417)throw new APINotFoundError(util[_0xca9f('0x2f')](_0xca9f('0xae'),_0x2c2686[_0xca9f('0x69')]['id']));if(!_0x5d9417['Interval']||!_0x5d9417[_0xca9f('0x38')][_0xca9f('0x39')])return[_0x5d9417,!![]];return[_0x5d9417,checkWebsiteIntervals(_0x5d9417)];})[_0xca9f('0xaf')](function(_0x3fccad,_0x5c8bd2){if(!_0x5c8bd2)throw new APIOutOfIntervalError();if(!_0x3fccad['List'])return;_0x2ca6f2['account']=_0x3fccad;_0x2ca6f2[_0xca9f('0xb0')]=_0x3fccad[_0xca9f('0xaa')];_0x2ca6f2['applications']=_['orderBy'](_0x3fccad[_0xca9f('0xad')],[_0xca9f('0xb1')],[_0xca9f('0xb2')]);if(_0x2ca6f2[_0xca9f('0xb3')][_0xca9f('0xad')]){delete _0x2ca6f2[_0xca9f('0xb3')][_0xca9f('0xad')];}if(_0x2ca6f2[_0xca9f('0xb3')][_0xca9f('0xaa')]&&_0x2ca6f2[_0xca9f('0xb3')]['List'][_0xca9f('0xab')][_0xca9f('0x5b')]){return _0x2ca6f2[_0xca9f('0xb3')][_0xca9f('0xaa')][_0xca9f('0xab')][0x0];}var _0x3614b4=_[_0xca9f('0xf')](_0x2c2686[_0xca9f('0x6e')],{'firstName':_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb4')],'ListId':_0x3fccad['ListId']});_0x3614b4[_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xa5')]]=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb4')];return db['CmContact'][_0xca9f('0x6d')](_0x3614b4,{'fields':_0x2771be,'raw':!![]});})[_0xca9f('0x14')](function(_0x55398d){_0x2ca6f2[_0xca9f('0xb5')]=_0x55398d;var _0x1281e8=createInteractionObject(_0x2c2686['params']['id'],_0x2c2686['body'],_0x2c2686[_0xca9f('0xb6')],_0x55398d);var _0x159000={'ChatWebsiteId':_0x2c2686['params']['id'],'closed':![]};if(_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb7')]){_0x159000[_0xca9f('0xb7')]=_0x2c2686[_0xca9f('0x6e')]['threadId'];return db[_0xca9f('0xb8')]['find']({'where':_0x159000})[_0xca9f('0x14')](function(_0x24c69f){if(_0x24c69f){_0x122302=!![];return _0x24c69f;}_0x1281e8[_0xca9f('0xb7')]=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb7')];_0x1281e8['externalUrl']=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb9')];return db[_0xca9f('0xb8')]['create'](_0x1281e8);});}_0x159000['ContactId']=_0x55398d['id'];if(_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xba')]&&_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xba')]['id']){_0x159000['id']=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xba')]['id'];return db[_0xca9f('0xb8')][_0xca9f('0x6c')]({'where':_0x159000})[_0xca9f('0x14')](function(_0x4f4dff){if(_0x4f4dff){_0x122302=!![];return _0x4f4dff;}return db[_0xca9f('0xb8')][_0xca9f('0x6d')](_0x1281e8);});}return db[_0xca9f('0xb8')][_0xca9f('0x6d')](_0x1281e8);})[_0xca9f('0x14')](function(_0x2508ab){if(!_0x122302)return _0x2508ab;var _0x4d6985={'from':(_0x2ca6f2['contact'][_0xca9f('0x45')]||'')+'\x20'+(_0x2ca6f2[_0xca9f('0xb5')][_0xca9f('0xbb')]||'')};if(_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb7')]&&_0x2c2686['body'][_0xca9f('0xbc')]&&_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xb7')]!=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xbc')]){_0x4d6985['threadId']=_0x2c2686[_0xca9f('0x6e')][_0xca9f('0xbc')];}return _0x2508ab[_0xca9f('0x24')](_0x4d6985);})[_0xca9f('0x14')](function(_0x30bba9){_0x2ca6f2['interaction']=_0x30bba9[_0xca9f('0x3a')]({'plain':!![]});_0x2ca6f2[_0xca9f('0xba')][_0xca9f('0xbd')]=!_0x122302;if(_0x2ca6f2[_0xca9f('0xba')]['created']){if(_0x2ca6f2[_0xca9f('0xb3')]['autoclose']){_0x2ca6f2['applications'][_0xca9f('0xbe')]({'id':0x0,'priority':_0x2ca6f2[_0xca9f('0xbf')]['length']+0x1,'app':_0xca9f('0xc0'),'appdata':'unmanaged','interval':_0xca9f('0xc1')});}}return db[_0xca9f('0xc2')]['create']({'body':_0x2c2686[_0xca9f('0x6e')][_0xca9f('0x6e')],'ChatWebsiteId':_0x2c2686['params']['id'],'ChatInteractionId':_0x30bba9['id'],'direction':'in','ContactId':_0x2ca6f2[_0xca9f('0xb5')]['id'],'AttachmentId':_0x2c2686[_0xca9f('0x6e')]['AttachmentId']});})[_0xca9f('0x14')](function(_0x47325b){_0x2ca6f2[_0xca9f('0x1c')]=_0x47325b;if(!_0x2ca6f2[_0xca9f('0xba')][_0xca9f('0xc3')]){return;}return db[_0xca9f('0xc4')][_0xca9f('0x6c')]({'attributes':['id',_0xca9f('0x2b')],'where':{'id':_0x2ca6f2[_0xca9f('0xba')][_0xca9f('0xc3')]}});})[_0xca9f('0x14')](function(_0x40e632){if(_0x40e632){_0x2ca6f2['applications'][_0xca9f('0xc5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x40e632['name']+','+(_0x2ca6f2[_0xca9f('0xb3')]['waitForTheAssignedAgent']||0xa),'interval':_0xca9f('0xc1')});_0x2ca6f2[_0xca9f('0xc6')]=!![];}if(!_0x2ca6f2[_0xca9f('0xba')][_0xca9f('0xc7')]){return;}return db[_0xca9f('0xc8')][_0xca9f('0x6c')]({'attributes':['id',_0xca9f('0x2b')],'where':{'id':_0x2ca6f2[_0xca9f('0xba')][_0xca9f('0xc7')]}});})[_0xca9f('0x14')](function(_0x59ca2f){if(_0x59ca2f){_0x2ca6f2[_0xca9f('0xbf')][_0xca9f('0xc5')]({'id':0x0,'priority':0x1,'app':_0xca9f('0xc9'),'appdata':_0x59ca2f['name']+','+(_0x2ca6f2['account'][_0xca9f('0xca')]||0x12c),'interval':_0xca9f('0xc1')});}return respondWithRpcPromise(_0xca9f('0xcb'),'startRouting',_0x2ca6f2);})[_0xca9f('0x14')](function(_0x2bf376){respondWithRpcPromise(_0xca9f('0xcc'),_0xca9f('0xcc'),{'event':_0xca9f('0x9a'),'message':_0x2bf376},client9002);return _0x2bf376;})[_0xca9f('0x14')](respondWithResult(_0x409bf0,null))['catch'](APIHandleError(_0x409bf0));};exports['offline']=function(_0x3aedda,_0x39c187){var _0x441705,_0x2c59c3,_0x335695;var _0x417c7e=[];var _0x35d6b6={};var _0x5ac80a=_0x3aedda['files']||[];var _0x3f3570=[];var _0x549fa0;return db[_0xca9f('0x9c')][_0xca9f('0x76')]()[_0xca9f('0x14')](function(_0x96099c){if(!_0x96099c){throw new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))]('no\x20available\x20attributes');}_0x417c7e=_[_0xca9f('0x9f')](_['keys'](_0x96099c),['createdAt',_0xca9f('0xcd'),'CompanyId',_0xca9f('0xa1')]);if(_0x3aedda[_0xca9f('0x6e')]['id']){delete _0x3aedda[_0xca9f('0x6e')]['id'];}if(_[_0xca9f('0x92')](_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xb4')])){throw _0x39c187[_0xca9f('0x1e')](0x1f4)[_0xca9f('0x2c')](new db['Sequelize'][(_0xca9f('0x9d'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x3aedda[_0xca9f('0x6e')][_0xca9f('0x6e')])||_0x3aedda[_0xca9f('0x6e')]['body']===''){throw _0x39c187[_0xca9f('0x1e')](0x1f4)['send'](new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xa4')));}if(_[_0xca9f('0x92')](_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xce')])){throw _0x39c187[_0xca9f('0x1e')](0x1f4)[_0xca9f('0x2c')](new db[(_0xca9f('0xa2'))][(_0xca9f('0x9d'))](_0xca9f('0xcf')+_0x417c7e));}if(!_[_0xca9f('0xa7')](_0x417c7e,_0x3aedda['body'][_0xca9f('0xce')])){throw _0x39c187[_0xca9f('0x1e')](0x1f4)[_0xca9f('0x2c')](new db[(_0xca9f('0xa2'))]['ValidationError'](_0xca9f('0xd0')+_0x417c7e));}_0x35d6b6[_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xce')]]=_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xb4')];})[_0xca9f('0x14')](function(){return db['ChatWebsite'][_0xca9f('0x6c')]({'where':{'id':_0x3aedda[_0xca9f('0x69')]['id']},'include':[{'model':db['CmList'],'as':_0xca9f('0xaa')},{'model':db[_0xca9f('0xd1')],'as':_0xca9f('0xd1')}]});})[_0xca9f('0x14')](handleEntityNotFound(_0x39c187,null))[_0xca9f('0x14')](function(_0x4465cf){if(_0x4465cf&&_0x4465cf[_0xca9f('0xaa')]){_0x2c59c3=_0x4465cf;var _0x41d485=_['defaults'](_0x3aedda[_0xca9f('0x6e')],{'firstName':_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xb4')],'phone':_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xb4')],'ListId':_0x4465cf['ListId']});_0x41d485[_0x3aedda[_0xca9f('0x6e')][_0xca9f('0xce')]]=_0x3aedda['body'][_0xca9f('0xb4')];return db[_0xca9f('0x9c')][_0xca9f('0xd2')]({'where':_0x35d6b6,'defaults':_0x41d485});}})[_0xca9f('0xaf')](function(_0x32cae8){if(_0x32cae8){_0x335695=_0x32cae8;var _0x1a88c5=fs[_0xca9f('0xd3')](path[_0xca9f('0x8c')](config['root'],_0xca9f('0xd4')),'utf8');var _0x5c4e5c=ejs['render'](_0x1a88c5,{'body':_[_0xca9f('0xd5')](_0x3aedda[_0xca9f('0x6e')][_0xca9f('0x6e')]),'bodyTitle':_0x2c59c3[_0xca9f('0xd6')]});return db[_0xca9f('0xd7')]['create']({'body':_0x5c4e5c,'plainBody':htmlToText[_0xca9f('0xd8')](_0x5c4e5c),'ContactId':_0x32cae8['id'],'ChatWebsiteId':_0x2c59c3['id']});}})[_0xca9f('0x14')](function(_0xe923a4){_0x549fa0=_0xe923a4;if(_0x5ac80a['length']){var _0x29b84b=_0x5ac80a[_0xca9f('0x37')](function(_0x314bdf){return{'name':_0x314bdf[_0xca9f('0xd9')],'basename':_0x314bdf['filename'],'type':_0x314bdf['mimetype'],'ChatOfflineMessageId':_0xe923a4['id']};});_0x3f3570=_0x29b84b[_0xca9f('0x37')](_0x4497a4=>{var _0x362568={'filename':_0x4497a4[_0xca9f('0x2b')],'path':path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],_0xca9f('0xda'),_0xca9f('0xdb'),_0xca9f('0xdc'),_0xca9f('0xdd'),_0x4497a4[_0xca9f('0xde')])};return _0x362568;});if(!_0x2c59c3[_0xca9f('0xdf')]){return db[_0xca9f('0xe0')][_0xca9f('0xe1')](function(_0x258d77){return db[_0xca9f('0xe2')][_0xca9f('0xe3')](_0x29b84b,{'transaction':_0x258d77});});}}})[_0xca9f('0x14')](function(){if(_0x549fa0){_0x441705=_0x549fa0;return db[_0xca9f('0xd1')][_0xca9f('0x82')]({'where':{'service':!![]},'include':[{'model':db[_0xca9f('0xe4')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xca9f('0xe5'),'raw':!![]}]}]});}})[_0xca9f('0x14')](function(_0x1b5ddd){if(_0x1b5ddd&&_0x1b5ddd[_0xca9f('0xe6')]&&_0x2c59c3[_0xca9f('0xe7')]&&_0x2c59c3[_0xca9f('0xe8')]){var _0x5d22e5=_0x1b5ddd['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xca9f('0xe9'),{'account':_0x5d22e5,'message':{'from':util[_0xca9f('0x2f')](_0xca9f('0xea'),_0x1b5ddd[_0xca9f('0x2b')],_0x1b5ddd['email']||_0x1b5ddd[_0xca9f('0xe6')][_0xca9f('0x70')]),'to':_0x2c59c3['forwardOfflineAddress'],'subject':_0x2c59c3['offlineMessageSubject'],'html':_0x441705[_0xca9f('0x6e')],'attachments':_0x3f3570}},client9003)[_0xca9f('0x14')](function(){return _0x441705;})[_0xca9f('0x67')](function(_0x1e5d1c){logger['error'](_0x1e5d1c);});}})[_0xca9f('0x14')](function(){if(_0x2c59c3&&_0x2c59c3['openNewInteraction']&&_0x2c59c3[_0xca9f('0xeb')]){var _0x328974=[];if(_0x5ac80a[_0xca9f('0x5b')]){_0x328974=_0x5ac80a['map'](function(_0x223d1a){return{'name':_0x223d1a[_0xca9f('0xd9')],'basename':_0x223d1a[_0xca9f('0x86')],'type':_0x223d1a['mimetype'],'ChatOfflineMessageId':_0x549fa0['id']};});}var _0x2d6d3f;if(!_['isNil'](_0x2c59c3[_0xca9f('0xec')])){var _0x2cd013=_[_0xca9f('0x37')](_0x3aedda['body'],function(_0x365ab3){return _0x365ab3;});var _0x1704c3=_[_0xca9f('0xed')](_0x2cd013)[0x0];var _0x10a35a=_[_0xca9f('0xee')](_0x1704c3,function(_0x2364ce){return _0x2364ce;});_0x2d6d3f=_0x10a35a[0x1][_0x2c59c3[_0xca9f('0xec')]];}var _0x484c24={'from':_0x335695[_0xca9f('0xef')],'firstName':_0x335695[_0xca9f('0x45')],'lastName':_0x335695[_0xca9f('0xbb')],'mapKey':'email','message':{'from':_0x335695[_0xca9f('0xef')],'to':_0x2c59c3[_0xca9f('0xd1')][_0xca9f('0xef')],'cc':'','subject':_['isNil'](_0x2d6d3f)?_0x2c59c3[_0xca9f('0xf0')]:_0x2d6d3f,'messageId':'','sentAt':new Date(),'attach':_0x328974[_0xca9f('0x5b')],'attachments':_0x328974,'originChannel':_0xca9f('0xf1'),'ChatWebsiteId':_0x2c59c3['id'],'ChatOfflineMessageId':_0x441705['id'],'originTo':_0x2c59c3[_0xca9f('0xd1')][_0xca9f('0xef')]},'body':_0x441705[_0xca9f('0x6e')]};var _0xc503d7={'account':{'id':_0x2c59c3[_0xca9f('0xeb')]},'body':_0x484c24,'log':_0xca9f('0xf2')};return respondWithRpcPromise(_0xca9f('0xf2'),_0xca9f('0xf3'),_0xc503d7,client9001)[_0xca9f('0x14')](function(){return _0x441705;})[_0xca9f('0x67')](function(_0xf69cb){logger[_0xca9f('0x1b')](_0xf69cb);});}return;})[_0xca9f('0x14')](function(){if(_0x441705){return _0x441705;}})['then'](respondWithResult(_0x39c187,null))['catch'](function(){for(var _0x4c30d9 of _0x5ac80a){var _0x4f9f2f=path['join'](config[_0xca9f('0x8d')],'server',_0xca9f('0xdb'),_0xca9f('0xdc'),_0xca9f('0xdd'),_0x4c30d9[_0xca9f('0x86')]);fs_extra[_0xca9f('0xf4')](_0x4f9f2f)[_0xca9f('0x67')](function(_0x51cb72){logger[_0xca9f('0x1b')](_0xca9f('0xf5'),_0x4f9f2f,_0x51cb72);});}});};exports[_0xca9f('0xf6')]=function(_0xb3ba93,_0xfe02eb){return db[_0xca9f('0xb8')][_0xca9f('0x6c')]({'where':{'id':_0xb3ba93[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0xfe02eb,null))['then'](function(_0x18c699){if(_0x18c699){return _0x18c699[_0xca9f('0xf6')](_0xb3ba93[_0xca9f('0x6e')]['ids'],_['omit'](_0xb3ba93[_0xca9f('0x6e')],['ids','id'])||{});}})[_0xca9f('0x14')](respondWithResult(_0xfe02eb,null))['catch'](handleError(_0xfe02eb,null));};exports['getInteractions']=function(_0x240547,_0x20d914){var _0x44734d={'raw':![],'where':{}};var _0x5708b2={};var _0x38d93d={'count':0x0,'rows':[]};return db[_0xca9f('0x51')][_0xca9f('0x82')]({'where':{'id':_0x240547[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x20d914,null))[_0xca9f('0x14')](function(_0x182397){if(_0x182397){_0x5708b2['model']=_[_0xca9f('0x56')](db[_0xca9f('0xb8')]['rawAttributes']);_0x5708b2[_0xca9f('0x55')]=_[_0xca9f('0x56')](_0x240547[_0xca9f('0x55')]);_0x5708b2[_0xca9f('0x57')]=_['intersection'](_0x5708b2['model'],_0x5708b2[_0xca9f('0x55')]);_0x44734d[_0xca9f('0x59')]=_[_0xca9f('0x58')](_0x5708b2[_0xca9f('0x4d')],qs[_0xca9f('0x5a')](_0x240547['query'][_0xca9f('0x5a')]));_0x44734d['attributes']=_0x44734d[_0xca9f('0x59')][_0xca9f('0x5b')]?_0x44734d[_0xca9f('0x59')]:_0x5708b2[_0xca9f('0x4d')];if(!_0x240547[_0xca9f('0x55')][_0xca9f('0x5c')](_0xca9f('0x5d'))){_0x44734d[_0xca9f('0x21')]=qs['limit'](_0x240547[_0xca9f('0x55')]['limit']);_0x44734d[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0x240547[_0xca9f('0x55')]['offset']);}_0x44734d[_0xca9f('0x5e')]=qs[_0xca9f('0x5f')](_0x240547['query'][_0xca9f('0x5f')]);_0x44734d['where']=qs[_0xca9f('0x57')](_[_0xca9f('0x61')](_0x240547['query'],_0x5708b2[_0xca9f('0x57')]));_0x44734d[_0xca9f('0x60')][_0xca9f('0x7a')]=_0x182397['id'];if(_0x240547['query'][_0xca9f('0x62')]){_0x44734d[_0xca9f('0x60')]=_[_0xca9f('0x64')](_0x44734d[_0xca9f('0x60')],{'$or':_[_0xca9f('0x37')](_0x44734d[_0xca9f('0x59')],function(_0x3eefbc){var _0x51723d={};_0x51723d[_0x3eefbc]={'$like':'%'+_0x240547[_0xca9f('0x55')][_0xca9f('0x62')]+'%'};return _0x51723d;})});}_0x44734d=_[_0xca9f('0x64')]({},_0x44734d,_0x240547['options']);return db[_0xca9f('0xb8')][_0xca9f('0x22')]({'where':_0x44734d[_0xca9f('0x60')]})[_0xca9f('0x14')](function(_0x403185){_0x38d93d['count']=_0x403185;if(_0x240547['query']['includeAll']){_0x44734d[_0xca9f('0x7b')]=[{'model':db[_0xca9f('0x9c')],'as':_0xca9f('0xf7'),'required':![]},{'model':db[_0xca9f('0xc4')],'as':_0xca9f('0xf8'),'attributes':[_0xca9f('0x2b'),'fullname',_0xca9f('0xf9')],'required':![]},{'model':db[_0xca9f('0xfa')],'as':_0xca9f('0xfb'),'attributes':['id',_0xca9f('0x2b'),'color'],'where':_0x240547[_0xca9f('0x55')][_0xca9f('0xfc')]?{'id':_0x240547['query'][_0xca9f('0xfc')]}:undefined,'required':_0x240547[_0xca9f('0x55')][_0xca9f('0xfc')]?!![]:![]}];}return db[_0xca9f('0xb8')][_0xca9f('0x7c')](_0x44734d);})[_0xca9f('0x14')](function(_0x17833c){_0x38d93d[_0xca9f('0x66')]=_0x17833c;return _0x38d93d;});}})[_0xca9f('0x14')](respondWithFilteredResult(_0x20d914,_0x44734d))[_0xca9f('0x67')](handleError(_0x20d914,null));};exports[_0xca9f('0x2d')]=function(_0x25ec4c,_0x29e558){var _0x392438=0x0;var _0x2af499=0x0;var _0x110e57=![];var _0x5ca130;var _0x3d79db;return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x25ec4c['params']['id']},'include':[{'model':db['Interval'],'as':_0xca9f('0x38'),'include':[{'model':db[_0xca9f('0x38')],'as':_0xca9f('0x39'),'attributes':['id',_0xca9f('0x31')]}]}]})[_0xca9f('0x14')](handleEntityNotFound(_0x29e558,null))[_0xca9f('0x14')](function(_0x1df8d5){if(_0x1df8d5){_0x5ca130=_0x1df8d5;return _0x1df8d5[_0xca9f('0xfd')]({'raw':!![]});}})['then'](function(_0x12364e){if(_0x5ca130){if(_0x12364e){_0x3d79db=_0x12364e;}}return require(_0xca9f('0x8f'))[_0xca9f('0x90')]();})['then'](function(_0x5a6b3e){if(_0x5a6b3e){_0x2af499=_0x5a6b3e[_0xca9f('0xfe')];_0x110e57=_0x5a6b3e['custom'];}})['then'](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0xca9f('0x14')](function(_0x146b17){_0x392438=_0x146b17;if(_0x2af499&&_0x146b17>_0x2af499){return db[_0xca9f('0xff')][_0xca9f('0x82')]({'where':{'id':0x1}})[_0xca9f('0x14')](function(_0xdf0d8e){if(_0xdf0d8e){_0xdf0d8e[_0xca9f('0x100')]('chatLicenseExceeded');}});}})['then'](function(){if(!_0x5ca130[_0xca9f('0x38')]||!_0x5ca130[_0xca9f('0x38')][_0xca9f('0x39')])return!![];return checkWebsiteIntervals(_0x5ca130);})[_0xca9f('0x14')](function(_0x3584c3){var _0x236cf2=fs[_0xca9f('0xd3')](path[_0xca9f('0x8c')](config[_0xca9f('0x8d')],'server/files/chat/iframe.ejs'),_0xca9f('0x101'));var _0x2b24fd=new url['URL'](_0x5ca130['address'])[_0xca9f('0x102')];var _0x2014d3=_0xca9f('0x103');var _0x28f85a=![];var _0x26da36={'chatVersion':_0x2014d3,'chatWebsiteAddressOrigin':_0x2b24fd,'remote':_0x5ca130[_0xca9f('0x104')],'query':querystring[_0xca9f('0x19')](_[_0xca9f('0x64')](_0x5ca130[_0xca9f('0x3a')]({'plain':!![]}),{'customerIp':_0x25ec4c[_0xca9f('0xb6')][_0xca9f('0x42')]||_0x25ec4c[_0xca9f('0xb6')]['x-real-ip']||_0x25ec4c[_0xca9f('0x105')]['remoteAddress']||_0x25ec4c['ip'],'referer':_0x25ec4c[_0xca9f('0xb6')][_0xca9f('0x47')],'openedInteractions':_0x392438,'maxInteractions':_0x2af499,'virtual':_0x110e57[_0xca9f('0xfe')],'online':_0x3584c3,'custom':_0x110e57}))['replace'](/'/g,'\x5c\x27')};_0x29e558[_0xca9f('0x2c')](ejs[_0xca9f('0x106')](Mustache[_0xca9f('0x106')](_0x236cf2,_0x26da36),{'proactiveActions':_0x3d79db,'alignment':_0x5ca130[_0xca9f('0x107')],'verticalAlignment':_0x5ca130[_0xca9f('0x108')],'div_color':_0x5ca130['color'],'labelText':_0x5ca130[_0xca9f('0x109')],'text_color':_0x5ca130[_0xca9f('0x10a')],'text_button_color':_0x5ca130['textButtonColor'],'button_color':_0x5ca130[_0xca9f('0x10b')],'background_color':_0x5ca130[_0xca9f('0x10c')],'hideWhenOffline':_0x5ca130[_0xca9f('0x10d')],'intervalId':_0x5ca130[_0xca9f('0x10e')],'isDevelopment':_0x28f85a,'chatVersion':_0x2014d3}));})['catch'](handleError(_0x29e558,null));};exports['addApplications']=function(_0x1bbd50,_0x31b68e){var _0x171be2=_0x1bbd50[_0xca9f('0x69')]['id'];var _0x8a6f66=_0x1bbd50[_0xca9f('0x6e')];var _0x45735e=0xc8;var _0x4287ad=null;return db[_0xca9f('0xe0')][_0xca9f('0xe1')]({'isolationLevel':db[_0xca9f('0xe0')]['Transaction']['ISOLATION_LEVELS'][_0xca9f('0x10f')]},function(_0x223002){return db[_0xca9f('0x51')][_0xca9f('0x82')]({'where':{'id':_0x171be2},'transaction':_0x223002})[_0xca9f('0x14')](function(_0xc90557){if(_0xc90557){return db[_0xca9f('0x110')]['destroy']({'where':{'ChatWebsiteId':_0x171be2},'transaction':_0x223002})[_0xca9f('0x14')](function(){var _0xac3dd0=_[_0xca9f('0x37')](_0x8a6f66,function(_0x1d4991){_0x1d4991['ChatWebsiteId']=_0x171be2;return _0x1d4991;});return db[_0xca9f('0x110')][_0xca9f('0xe3')](_0xac3dd0,{'transaction':_0x223002});});}else{_0x45735e=0x194;_0x4287ad=[];}});})[_0xca9f('0x14')](function(){if(_0x45735e!==0x194){return db[_0xca9f('0x110')][_0xca9f('0x111')]({'where':{'ChatWebsiteId':_0x171be2},'order':_0xca9f('0xb1')})[_0xca9f('0x14')](function(_0x3752c8){_0x4287ad=_0x3752c8;});}})[_0xca9f('0x67')](function(_0x650705){_0x45735e=0x1f4;logger[_0xca9f('0x1b')](_0x650705[_0xca9f('0x2a')]);if(_0x650705[_0xca9f('0x2b')]){delete _0x650705[_0xca9f('0x2b')];}_0x4287ad=_0x650705;})['finally'](function(){if(_0x4287ad===null){_0x31b68e[_0xca9f('0x29')](_0x45735e);}else{if(_0x45735e===0x1f4){_0x31b68e['status'](_0x45735e)[_0xca9f('0x2c')](_0x4287ad);}else{_0x31b68e['status'](_0x45735e)['json'](_0x4287ad);}}});};exports['getApplications']=function(_0x1f0323,_0x672a97){var _0x2be16e={};var _0x1dcb76={};var _0x2e96cb;var _0x2f55a4;return db[_0xca9f('0x51')]['findOne']({'where':{'id':_0x1f0323['params']['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x672a97,null))[_0xca9f('0x14')](function(_0x739f79){if(_0x739f79){_0x2e96cb=_0x739f79;_0x1dcb76[_0xca9f('0x4d')]=_[_0xca9f('0x56')](db[_0xca9f('0x110')][_0xca9f('0x52')]);_0x1dcb76['query']=_[_0xca9f('0x56')](_0x1f0323['query']);_0x1dcb76['filters']=_[_0xca9f('0x58')](_0x1dcb76['model'],_0x1dcb76[_0xca9f('0x55')]);_0x2be16e[_0xca9f('0x59')]=_['intersection'](_0x1dcb76['model'],qs[_0xca9f('0x5a')](_0x1f0323[_0xca9f('0x55')][_0xca9f('0x5a')]));_0x2be16e[_0xca9f('0x59')]=_0x2be16e[_0xca9f('0x59')][_0xca9f('0x5b')]?_0x2be16e[_0xca9f('0x59')]:_0x1dcb76['model'];_0x2be16e[_0xca9f('0x5e')]=qs[_0xca9f('0x5f')](_0x1f0323[_0xca9f('0x55')][_0xca9f('0x5f')]);_0x2be16e['where']=qs[_0xca9f('0x57')](_['pick'](_0x1f0323[_0xca9f('0x55')],_0x1dcb76[_0xca9f('0x57')]));if(_0x1f0323[_0xca9f('0x55')]['filter']){_0x2be16e['where']=_[_0xca9f('0x64')](_0x2be16e[_0xca9f('0x60')],{'$or':_[_0xca9f('0x37')](_0x2be16e[_0xca9f('0x59')],function(_0x5eedc6){var _0x134eb3={};_0x134eb3[_0x5eedc6]={'$like':'%'+_0x1f0323['query'][_0xca9f('0x62')]+'%'};return _0x134eb3;})});}_0x2be16e=_[_0xca9f('0x64')]({},_0x2be16e,_0x1f0323['options']);return _0x2e96cb[_0xca9f('0x112')](_0x2be16e);}})['then'](function(_0x15574f){if(_0x15574f){_0x2f55a4=_0x15574f[_0xca9f('0x5b')];if(!_0x1f0323[_0xca9f('0x55')][_0xca9f('0x5c')](_0xca9f('0x5d'))){_0x2be16e[_0xca9f('0x21')]=qs['limit'](_0x1f0323['query'][_0xca9f('0x21')]);_0x2be16e['offset']=qs['offset'](_0x1f0323[_0xca9f('0x55')]['offset']);}return _0x2e96cb[_0xca9f('0x112')](_0x2be16e);}})[_0xca9f('0x14')](function(_0xa24131){if(_0xa24131){return _0xa24131?{'count':_0x2f55a4,'rows':_0xa24131}:null;}})['then'](respondWithResult(_0x672a97,null))[_0xca9f('0x67')](handleError(_0x672a97,null));};exports[_0xca9f('0x113')]=function(_0xaec7e9,_0x975f42){return db['chatProactiveAction'][_0xca9f('0x6c')]({'where':{'id':_0xaec7e9[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x975f42,null))[_0xca9f('0x14')](function(_0x5c97cf){if(_0x5c97cf){return _0x5c97cf['addProactiveActions'](_0xaec7e9[_0xca9f('0x6e')][_0xca9f('0x7e')],_[_0xca9f('0x114')](_0xaec7e9[_0xca9f('0x6e')],[_0xca9f('0x7e'),'id'])||{});}})[_0xca9f('0x14')](respondWithResult(_0x975f42,null))['catch'](handleError(_0x975f42,null));};exports['getProactiveActions']=function(_0x57a9d8,_0x1f93b7){var _0x3d1f13={};var _0x22a425={};var _0x2196d5;var _0x42b873;return db['ChatWebsite'][_0xca9f('0x82')]({'where':{'id':_0x57a9d8[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x1f93b7,null))[_0xca9f('0x14')](function(_0xe6d5ef){if(_0xe6d5ef){_0x2196d5=_0xe6d5ef;_0x22a425['model']=_['keys'](db['ChatProactiveAction'][_0xca9f('0x52')]);_0x22a425[_0xca9f('0x55')]=_['keys'](_0x57a9d8['query']);_0x22a425['filters']=_[_0xca9f('0x58')](_0x22a425[_0xca9f('0x4d')],_0x22a425[_0xca9f('0x55')]);_0x3d1f13[_0xca9f('0x59')]=_[_0xca9f('0x58')](_0x22a425[_0xca9f('0x4d')],qs['fields'](_0x57a9d8[_0xca9f('0x55')]['fields']));_0x3d1f13['attributes']=_0x3d1f13[_0xca9f('0x59')][_0xca9f('0x5b')]?_0x3d1f13['attributes']:_0x22a425[_0xca9f('0x4d')];_0x3d1f13[_0xca9f('0x5e')]=qs['sort'](_0x57a9d8['query'][_0xca9f('0x5f')]);_0x3d1f13[_0xca9f('0x60')]=qs[_0xca9f('0x57')](_['pick'](_0x57a9d8[_0xca9f('0x55')],_0x22a425['filters']));if(_0x57a9d8[_0xca9f('0x55')][_0xca9f('0x62')]){_0x3d1f13[_0xca9f('0x60')]=_[_0xca9f('0x64')](_0x3d1f13[_0xca9f('0x60')],{'$or':_[_0xca9f('0x37')](_0x3d1f13[_0xca9f('0x59')],function(_0x173ab0){var _0x5974d2={};_0x5974d2[_0x173ab0]={'$like':'%'+_0x57a9d8['query'][_0xca9f('0x62')]+'%'};return _0x5974d2;})});}_0x3d1f13=_['merge']({},_0x3d1f13,_0x57a9d8[_0xca9f('0x65')]);return _0x2196d5[_0xca9f('0xfd')](_0x3d1f13);}})[_0xca9f('0x14')](function(_0x54c2d1){if(_0x54c2d1){_0x42b873=_0x54c2d1[_0xca9f('0x5b')];if(!_0x57a9d8[_0xca9f('0x55')][_0xca9f('0x5c')](_0xca9f('0x5d'))){_0x3d1f13[_0xca9f('0x21')]=qs['limit'](_0x57a9d8['query'][_0xca9f('0x21')]);_0x3d1f13[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0x57a9d8[_0xca9f('0x55')][_0xca9f('0x23')]);}return _0x2196d5['getProactiveActions'](_0x3d1f13);}})['then'](function(_0x20e55b){if(_0x20e55b){return _0x20e55b?{'count':_0x42b873,'rows':_0x20e55b}:null;}})[_0xca9f('0x14')](respondWithResult(_0x1f93b7,null))[_0xca9f('0x67')](handleError(_0x1f93b7,null));};exports[_0xca9f('0x115')]=function(_0x3ccc81,_0x2b8637){var _0xd040f7=_0x3ccc81[_0xca9f('0x55')]['online']==='false'?_0xca9f('0x116'):_0xca9f('0x117');return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'attributes':['id',_0xd040f7],'where':{'id':_0x3ccc81[_0xca9f('0x69')]['id']}})['then'](handleEntityNotFound(_0x2b8637,null))[_0xca9f('0x14')](function(_0x1e2d30){if(_0x1e2d30){var _0x2d1860=_0x1e2d30[_0xd040f7];var _0x179bc5=_0x2d1860&&_0x2d1860[_0xca9f('0x118')]?_0x2d1860[_0xca9f('0x118')]:[];_0x2b8637['send']({'fromKey':_['isNil'](_0x2d1860[_0xca9f('0x119')])?undefined:_0x2d1860[_0xca9f('0x119')],'count':_0x179bc5[_0xca9f('0x5b')],'rows':_0x179bc5});}})[_0xca9f('0x67')](handleError(_0x2b8637,null));};exports[_0xca9f('0x11a')]=function(_0x512bfe,_0x3d0759){var _0xb48531={'raw':![],'where':{}};var _0x5fa57a={};var _0x4845ae={'count':0x0,'rows':[]};return db[_0xca9f('0x51')][_0xca9f('0x82')]({'where':{'id':_0x512bfe[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x3d0759,null))[_0xca9f('0x14')](function(_0x9fb9e2){if(_0x9fb9e2){_0x5fa57a[_0xca9f('0x4d')]=_[_0xca9f('0x56')](db[_0xca9f('0xd7')]['rawAttributes']);_0x5fa57a['query']=_[_0xca9f('0x56')](_0x512bfe['query']);_0x5fa57a['filters']=_[_0xca9f('0x58')](_0x5fa57a[_0xca9f('0x4d')],_0x5fa57a['query']);_0xb48531[_0xca9f('0x59')]=_['intersection'](_0x5fa57a[_0xca9f('0x4d')],qs[_0xca9f('0x5a')](_0x512bfe['query'][_0xca9f('0x5a')]));_0xb48531[_0xca9f('0x59')]=_0xb48531[_0xca9f('0x59')][_0xca9f('0x5b')]?_0xb48531[_0xca9f('0x59')]:_0x5fa57a[_0xca9f('0x4d')];if(!_0x512bfe['query']['hasOwnProperty']('nolimit')){_0xb48531[_0xca9f('0x21')]=qs['limit'](_0x512bfe[_0xca9f('0x55')][_0xca9f('0x21')]);_0xb48531[_0xca9f('0x23')]=qs['offset'](_0x512bfe[_0xca9f('0x55')]['offset']);}_0xb48531[_0xca9f('0x5e')]=qs[_0xca9f('0x5f')](_0x512bfe[_0xca9f('0x55')][_0xca9f('0x5f')]);_0xb48531['where']=qs[_0xca9f('0x57')](_[_0xca9f('0x61')](_0x512bfe[_0xca9f('0x55')],_0x5fa57a['filters']));_0xb48531[_0xca9f('0x60')][_0xca9f('0x7a')]=_0x9fb9e2['id'];if(_0x512bfe[_0xca9f('0x55')]['filter']){_0xb48531[_0xca9f('0x60')]=_[_0xca9f('0x64')](_0xb48531[_0xca9f('0x60')],{'$or':_['map'](_0xb48531[_0xca9f('0x59')],function(_0x33472e){var _0x25cbaf={};_0x25cbaf[_0x33472e]={'$like':'%'+_0x512bfe[_0xca9f('0x55')][_0xca9f('0x62')]+'%'};return _0x25cbaf;})});}_0xb48531=_[_0xca9f('0x64')]({},_0xb48531,_0x512bfe['options']);return db[_0xca9f('0xd7')]['count']({'where':_0xb48531[_0xca9f('0x60')]})['then'](function(_0x55b609){_0x4845ae[_0xca9f('0x22')]=_0x55b609;if(_0x512bfe[_0xca9f('0x55')][_0xca9f('0x6b')]){_0xb48531[_0xca9f('0x7b')]=[{'all':!![]}];}else{_0xb48531[_0xca9f('0x7b')]=[{'model':db[_0xca9f('0x9c')],'as':_0xca9f('0xf7'),'required':![]},{'model':db['Attachment'],'as':_0xca9f('0x11b'),'required':![]}];}return db[_0xca9f('0xd7')][_0xca9f('0x7c')](_0xb48531);})['then'](function(_0x53e174){_0x4845ae[_0xca9f('0x66')]=_0x53e174;return _0x4845ae;});}})[_0xca9f('0x14')](respondWithFilteredResult(_0x3d0759,_0xb48531))[_0xca9f('0x67')](handleError(_0x3d0759,null));};exports[_0xca9f('0x11c')]=function(_0x4ccab2,_0x37245b){return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x4ccab2[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x37245b,null))[_0xca9f('0x14')](function(_0x38b006){if(_0x38b006){return _0x38b006[_0xca9f('0x11c')](_0x4ccab2[_0xca9f('0x6e')][_0xca9f('0x7e')],_[_0xca9f('0x114')](_0x4ccab2[_0xca9f('0x6e')],['ids','id'])||{})[_0xca9f('0xaf')](function(_0x461688){for(var _0x13319a=0x0;_0x13319a<_0x4ccab2[_0xca9f('0x6e')][_0xca9f('0x7e')][_0xca9f('0x5b')];_0x13319a+=0x1){socket[_0xca9f('0x11d')](_0xca9f('0x11e'),{'UserId':Number(_0x4ccab2['body'][_0xca9f('0x7e')][_0x13319a]),'ChatWebsiteId':Number(_0x4ccab2[_0xca9f('0x69')]['id'])});}return _0x461688;});}})['then'](respondWithResult(_0x37245b,null))['catch'](handleError(_0x37245b,null));};exports[_0xca9f('0x11f')]=function(_0x1ed2fe,_0x5e1a1d){return db[_0xca9f('0x51')][_0xca9f('0x6c')]({'where':{'id':_0x1ed2fe[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x5e1a1d,null))[_0xca9f('0x14')](function(_0x15b7c6){if(_0x15b7c6){return _0x15b7c6[_0xca9f('0x11f')](_0x1ed2fe['query'][_0xca9f('0x7e')])[_0xca9f('0x14')](function(){if(_['isArray'](_0x1ed2fe[_0xca9f('0x55')][_0xca9f('0x7e')])){for(var _0xd7ead=0x0;_0xd7ead<_0x1ed2fe[_0xca9f('0x55')]['ids'][_0xca9f('0x5b')];_0xd7ead+=0x1){socket[_0xca9f('0x11d')](_0xca9f('0x120'),{'UserId':Number(_0x1ed2fe[_0xca9f('0x55')]['ids'][_0xd7ead]),'ChatWebsiteId':Number(_0x1ed2fe['params']['id'])});}}else{socket['emit'](_0xca9f('0x120'),{'UserId':Number(_0x1ed2fe[_0xca9f('0x55')]['ids']),'ChatWebsiteId':Number(_0x1ed2fe[_0xca9f('0x69')]['id'])});}});}})[_0xca9f('0x14')](respondWithStatusCode(_0x5e1a1d,null))[_0xca9f('0x67')](handleError(_0x5e1a1d,null));};exports[_0xca9f('0x121')]=function(_0x2492a0,_0x4283c3){var _0x1466e0={};var _0x2cf498={};var _0x3f4a3a;var _0xd5c09e;return db[_0xca9f('0x51')][_0xca9f('0x82')]({'where':{'id':_0x2492a0[_0xca9f('0x69')]['id']}})[_0xca9f('0x14')](handleEntityNotFound(_0x4283c3,null))[_0xca9f('0x14')](function(_0x2cc3e8){if(_0x2cc3e8){_0x3f4a3a=_0x2cc3e8;_0x2cf498['model']=_[_0xca9f('0x56')](db['User'][_0xca9f('0x52')]);_0x2cf498[_0xca9f('0x55')]=_[_0xca9f('0x56')](_0x2492a0[_0xca9f('0x55')]);_0x2cf498[_0xca9f('0x57')]=_['intersection'](_0x2cf498[_0xca9f('0x4d')],_0x2cf498[_0xca9f('0x55')]);_0x1466e0[_0xca9f('0x59')]=_[_0xca9f('0x58')](_0x2cf498[_0xca9f('0x4d')],qs['fields'](_0x2492a0[_0xca9f('0x55')]['fields']));_0x1466e0[_0xca9f('0x59')]=_0x1466e0['attributes'][_0xca9f('0x5b')]?_0x1466e0['attributes']:_0x2cf498[_0xca9f('0x4d')];_0x1466e0['order']=qs[_0xca9f('0x5f')](_0x2492a0[_0xca9f('0x55')]['sort']);_0x1466e0[_0xca9f('0x60')]=qs[_0xca9f('0x57')](_[_0xca9f('0x61')](_0x2492a0['query'],_0x2cf498[_0xca9f('0x57')]));if(_0x2492a0['query'][_0xca9f('0x62')]){_0x1466e0['where']=_[_0xca9f('0x64')](_0x1466e0[_0xca9f('0x60')],{'$or':_[_0xca9f('0x37')](_0x1466e0['attributes'],function(_0x5f1b4d){var _0x534066={};_0x534066[_0x5f1b4d]={'$like':'%'+_0x2492a0[_0xca9f('0x55')][_0xca9f('0x62')]+'%'};return _0x534066;})});}_0x1466e0=_[_0xca9f('0x64')]({},_0x1466e0,_0x2492a0[_0xca9f('0x65')]);return _0x3f4a3a[_0xca9f('0x121')](_0x1466e0);}})[_0xca9f('0x14')](function(_0x5d329a){if(_0x5d329a){_0xd5c09e=_0x5d329a[_0xca9f('0x5b')];if(!_0x2492a0[_0xca9f('0x55')][_0xca9f('0x5c')](_0xca9f('0x5d'))){_0x1466e0['limit']=qs[_0xca9f('0x21')](_0x2492a0['query'][_0xca9f('0x21')]);_0x1466e0[_0xca9f('0x23')]=qs[_0xca9f('0x23')](_0x2492a0[_0xca9f('0x55')][_0xca9f('0x23')]);}return _0x3f4a3a[_0xca9f('0x121')](_0x1466e0);}})[_0xca9f('0x14')](function(_0x29d97d){if(_0x29d97d){return _0x29d97d?{'count':_0xd5c09e,'rows':_0x29d97d}:null;}})['then'](respondWithResult(_0x4283c3,null))['catch'](handleError(_0x4283c3,null));}; \ No newline at end of file +var _0xf9ae=['merge','options','includeAll','include','rows','params','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','body','Disposition','getDispositions','findOne','nolimit','ChatWebsiteId','findAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addLogo','file','filename','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','sitepic','../../config/license/util','custom','isNil','join','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','ChatApplication','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','List','orderBy','Applications','priority','asc','account','ListId','contact','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','applications','push','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','waitForTheAssignedQueue','startRouting','EventManager','notify','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','render','offlineMessageBody','ChatOfflineMessage','originalname','server','offline-chat','basename','openNewInteraction','Attachment','bulkCreate','CloudProvider','Smtp','forwardOffline','getSmtpOptions','SendMail','sendMail','forwardOfflineAddress','subjectOffline','toPairsIn','mapValues','email','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','order','Owner','internal','Tag','Tags','color','tag','getLicense','virtual','License','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','URL','address','origin','3.5.0','remote','headers','x-real-ip','remoteAddress','replace','labelText','textColor','textButtonColor','hideWhenOffline','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getProactiveActions','getFields','online','false','onlineForm','items','fromKey','Contact','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','querystring','jayson/promise','url','../../components/parsers/qs','api','../../config/environment','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','then','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','destroy','get','ChatWebsites','stack','name','send','getSnippet','format','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','info','ONLINE','OFFLINE','timezone','No\x20timezone','Interval','Intervals','all','user-agent-parser','user-agent','getResult','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','unknown','device','%s\x20%s\x20%s','vendor','type','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','hasOwnProperty','limit','sort','where','pick','filters','filter'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xf9ae,0xc5));var _0xef9a=function(_0x510461,_0x42f9af){_0x510461=_0x510461-0x0;var _0x701009=_0xf9ae[_0x510461];return _0x701009;};'use strict';var Mustache=require(_0xef9a('0x0'));var util=require(_0xef9a('0x1'));var path=require(_0xef9a('0x2'));var ejs=require(_0xef9a('0x3'));var fs=require('fs');var fs_extra=require(_0xef9a('0x4'));var _=require('lodash');var querystring=require(_0xef9a('0x5'));var htmlToText=require('html-to-text');var Redis=require('ioredis');var jayson=require(_0xef9a('0x6'));var url=require(_0xef9a('0x7'));var qs=require(_0xef9a('0x8'));var logger=require('../../config/logger')(_0xef9a('0x9'));var config=require(_0xef9a('0xa'));var APIOutOfIntervalError=require(_0xef9a('0xb'))[_0xef9a('0xc')];var APINotFoundError=require('../../errors/api')[_0xef9a('0xd')];var APIHandleError=require(_0xef9a('0xb'))[_0xef9a('0xe')];var db=require(_0xef9a('0xf'))['db'];config[_0xef9a('0x10')]=_[_0xef9a('0x11')](config['redis'],{'host':_0xef9a('0x12'),'port':0x18eb});var socket=require(_0xef9a('0x13'))(new Redis(config[_0xef9a('0x10')]));require(_0xef9a('0x14'))['register'](socket);var client=jayson[_0xef9a('0x15')][_0xef9a('0x16')]({'port':0x232c});var client9002=jayson['client'][_0xef9a('0x16')]({'port':0x232a});var client9003=jayson['client'][_0xef9a('0x16')]({'port':0x232b});var client9001=jayson[_0xef9a('0x15')][_0xef9a('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x22f793,_0x1e45e3,_0x52b3a7,_0x59d511){return new Promise(function(_0x48e659,_0x417c8d){var _0x393554=_0x59d511||client;return _0x393554[_0xef9a('0x17')](_0x22f793,_0x52b3a7)[_0xef9a('0x18')](function(_0x43b6a9){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1e45e3,_0xef9a('0x19'));logger['debug'](_0xef9a('0x1a'),_0x1e45e3,_0xef9a('0x19'),JSON[_0xef9a('0x1b')](_0x43b6a9));if(_0x43b6a9[_0xef9a('0x1c')]){if(_0x43b6a9[_0xef9a('0x1c')][_0xef9a('0x1d')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1e45e3,_0x43b6a9['error'][_0xef9a('0x1e')]);return _0x417c8d(_0x43b6a9['error'][_0xef9a('0x1e')]);}logger[_0xef9a('0x1c')](_0xef9a('0x1f'),_0x1e45e3,_0x43b6a9[_0xef9a('0x1c')][_0xef9a('0x1e')]);return _0x48e659(_0x43b6a9['error']['message']);}else{logger['info'](_0xef9a('0x1f'),_0x1e45e3,_0xef9a('0x19'));_0x48e659(_0x43b6a9[_0xef9a('0x20')][_0xef9a('0x1e')]);}})[_0xef9a('0x21')](function(_0x5661ca){logger[_0xef9a('0x1c')](_0xef9a('0x1f'),_0x1e45e3,_0x5661ca);_0x417c8d(_0x5661ca);});});}function respondWithStatusCode(_0xe85287,_0x139369){_0x139369=_0x139369||0xcc;return function(_0x39d64f){if(_0x39d64f){return _0xe85287[_0xef9a('0x22')](_0x139369);}return _0xe85287[_0xef9a('0x23')](_0x139369)[_0xef9a('0x24')]();};}function respondWithResult(_0x206876,_0x37c705){_0x37c705=_0x37c705||0xc8;return function(_0x1a79ed){if(_0x1a79ed){return _0x206876[_0xef9a('0x23')](_0x37c705)[_0xef9a('0x25')](_0x1a79ed);}};}function respondWithFilteredResult(_0xaadd94,_0x29bef7){return function(_0x5991bc){if(_0x5991bc){var _0x10d4b1=typeof _0x29bef7['offset']===_0xef9a('0x26')&&typeof _0x29bef7['limit']===_0xef9a('0x26');var _0x21f485=_0x5991bc[_0xef9a('0x27')];var _0x8711c9=_0x10d4b1?0x0:_0x29bef7[_0xef9a('0x28')];var _0x1834b7=_0x10d4b1?_0x5991bc[_0xef9a('0x27')]:_0x29bef7[_0xef9a('0x28')]+_0x29bef7['limit'];var _0x3b2947;if(_0x1834b7>=_0x21f485){_0x1834b7=_0x21f485;_0x3b2947=0xc8;}else{_0x3b2947=0xce;}_0xaadd94[_0xef9a('0x23')](_0x3b2947);return _0xaadd94[_0xef9a('0x29')](_0xef9a('0x2a'),_0x8711c9+'-'+_0x1834b7+'/'+_0x21f485)[_0xef9a('0x25')](_0x5991bc);}return null;};}function saveUpdates(_0x13a9fb){return function(_0x464639){if(_0x464639){return _0x464639['update'](_0x13a9fb)[_0xef9a('0x18')](function(_0x25b318){return _0x25b318;});}return null;};}function removeEntity(_0x2217b6){return function(_0x3743e5){if(_0x3743e5){return _0x3743e5[_0xef9a('0x2b')]()[_0xef9a('0x18')](function(){var _0x2849be=_0x3743e5[_0xef9a('0x2c')]({'plain':!![]});var _0x22cc8a=_0xef9a('0x2d');return db['UserProfileResource'][_0xef9a('0x2b')]({'where':{'type':_0x22cc8a,'resourceId':_0x2849be['id']}})[_0xef9a('0x18')](function(){return _0x3743e5;});})[_0xef9a('0x18')](function(){_0x2217b6[_0xef9a('0x23')](0xcc)[_0xef9a('0x24')]();});}};}function handleEntityNotFound(_0x3f498e){return function(_0x57e9c8){if(!_0x57e9c8){_0x3f498e[_0xef9a('0x22')](0x194);}return _0x57e9c8;};}function handleError(_0x456206,_0x32d98d){_0x32d98d=_0x32d98d||0x1f4;return function(_0x523d91){logger['error'](_0x523d91[_0xef9a('0x2e')]);if(_0x523d91[_0xef9a('0x2f')]){delete _0x523d91[_0xef9a('0x2f')];}_0x456206[_0xef9a('0x23')](_0x32d98d)[_0xef9a('0x30')](_0x523d91);};}function iftimePromise(_0x37789b,_0x1e8e7a){return respondWithRpcPromise('Command',_0xef9a('0x31'),{'command':_0x1e8e7a['timezone']?util[_0xef9a('0x32')](_0xef9a('0x33'),_0x37789b[_0xef9a('0x34')],_0x1e8e7a['timezone']):util[_0xef9a('0x32')](_0xef9a('0x35'),_0x37789b[_0xef9a('0x34')])},client9002)['then'](function(_0xe249c8){var _0x45fd3a=_0xe249c8&&_0xe249c8[_0xef9a('0x36')]('true')>=0x0?!![]:![];logger[_0xef9a('0x37')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1e8e7a['id'],_0x37789b['id'],_0x37789b[_0xef9a('0x34')],_0x45fd3a?_0xef9a('0x38'):_0xef9a('0x39'),_0x1e8e7a[_0xef9a('0x3a')]?_0x1e8e7a['timezone']:'No\x20timezone');return _0x45fd3a;})[_0xef9a('0x21')](function(_0x32ba16){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1e8e7a['id'],_0x37789b['id'],_0x37789b[_0xef9a('0x34')],util['inspect'](_0x32ba16,{'showHidden':![],'depth':null}),_0x1e8e7a['timezone']?_0x1e8e7a['timezone']:_0xef9a('0x3b'));return![];});}function checkWebsiteIntervals(_0x1b96f6){var _0x45085f=_['map'](_0x1b96f6[_0xef9a('0x3c')][_0xef9a('0x3d')],function(_0x1befa3){var _0x37a09b=_0x1befa3['get']({'plain':!![]});return iftimePromise(_0x37a09b,_0x1b96f6);});return Promise[_0xef9a('0x3e')](_0x45085f)[_0xef9a('0x18')](function(_0x84406e){return _['some'](_0x84406e);});}function createInteractionObject(_0x12787a,_0x92d99c,_0x3ab2af,_0x4acd8a){var _0xbcc328=require(_0xef9a('0x3f'));var _0x18905e=new _0xbcc328();var _0x348afd=_0x18905e['setUA'](_0x3ab2af[_0xef9a('0x40')])[_0xef9a('0x41')]();var _0x38af1c=_0x92d99c['customerIp'];if(_0x3ab2af[_0xef9a('0x42')]){_0x38af1c=_0x3ab2af[_0xef9a('0x42')];}else if(_0x3ab2af[_0xef9a('0x43')]){_0x38af1c=_['first'](_0x3ab2af[_0xef9a('0x43')][_0xef9a('0x44')](','));}return{'ContactId':_0x4acd8a['id'],'ChatWebsiteId':_0x12787a,'from':(_0x4acd8a[_0xef9a('0x45')]||'')+'\x20'+(_0x4acd8a[_0xef9a('0x46')]||''),'customerIp':_0x38af1c,'customerPort':_0x3ab2af['x-real-port']?_0x3ab2af[_0xef9a('0x47')]:null,'referer':_0x92d99c[_0xef9a('0x48')],'browserName':_0x348afd['browser'][_0xef9a('0x2f')]&&_0x348afd[_0xef9a('0x49')][_0xef9a('0x4a')]?util['format']('%s\x20%s',_0x348afd[_0xef9a('0x49')]['name'],_0x348afd[_0xef9a('0x49')][_0xef9a('0x4a')]):_0xef9a('0x4b'),'browserVersion':_0x348afd[_0xef9a('0x49')][_0xef9a('0x4a')]||_0xef9a('0x4b'),'osName':util[_0xef9a('0x32')]('%s\x20%s',_0x348afd['os'][_0xef9a('0x2f')],_0x348afd['os'][_0xef9a('0x4a')]),'osVersion':_0x348afd['os'][_0xef9a('0x4a')],'deviceModel':_0x348afd[_0xef9a('0x4c')]['model']&&_0x348afd[_0xef9a('0x4c')]['vendor']?util[_0xef9a('0x32')](_0xef9a('0x4d'),_0x348afd['device']['model'],_0x348afd[_0xef9a('0x4c')][_0xef9a('0x4e')],_0x348afd[_0xef9a('0x4c')]['type']):null,'deviceVendor':_0x348afd['device'][_0xef9a('0x4e')],'deviceType':_0x348afd[_0xef9a('0x4c')][_0xef9a('0x4f')],'formData':JSON[_0xef9a('0x1b')](_0x92d99c)};}exports['index']=function(_0x287d6e,_0x409af1){var _0x5c79ba={'include':[{'model':db[_0xef9a('0x50')],'as':_0xef9a('0x51')}]},_0x16251f={},_0x4d4ce9={'count':0x0,'rows':[]};var _0x1656dd=_[_0xef9a('0x52')](db[_0xef9a('0x53')][_0xef9a('0x54')],function(_0x17bd39){return{'name':_0x17bd39[_0xef9a('0x55')],'type':_0x17bd39['type'][_0xef9a('0x56')]};});_0x16251f['model']=_[_0xef9a('0x52')](_0x1656dd,_0xef9a('0x2f'));_0x16251f[_0xef9a('0x57')]=_['keys'](_0x287d6e[_0xef9a('0x57')]);_0x16251f['filters']=_[_0xef9a('0x58')](_0x16251f[_0xef9a('0x59')],_0x16251f[_0xef9a('0x57')]);_0x5c79ba[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x16251f[_0xef9a('0x59')],qs[_0xef9a('0x5b')](_0x287d6e[_0xef9a('0x57')][_0xef9a('0x5b')]));_0x5c79ba[_0xef9a('0x5a')]=_0x5c79ba[_0xef9a('0x5a')]['length']?_0x5c79ba[_0xef9a('0x5a')]:_0x16251f['model'];if(!_0x287d6e[_0xef9a('0x57')][_0xef9a('0x5c')]('nolimit')){_0x5c79ba[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x287d6e[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x5c79ba[_0xef9a('0x28')]=qs['offset'](_0x287d6e[_0xef9a('0x57')][_0xef9a('0x28')]);}_0x5c79ba['order']=qs[_0xef9a('0x5e')](_0x287d6e[_0xef9a('0x57')][_0xef9a('0x5e')]);_0x5c79ba[_0xef9a('0x5f')]=qs['filters'](_[_0xef9a('0x60')](_0x287d6e[_0xef9a('0x57')],_0x16251f[_0xef9a('0x61')]),_0x1656dd);if(_0x287d6e[_0xef9a('0x57')][_0xef9a('0x62')]){_0x5c79ba[_0xef9a('0x5f')]=_['merge'](_0x5c79ba['where'],{'$or':_[_0xef9a('0x52')](_0x1656dd,function(_0x2a7bf8){if(_0x2a7bf8['type']!=='VIRTUAL'){var _0xe9460c={};_0xe9460c[_0x2a7bf8[_0xef9a('0x2f')]]={'$like':'%'+_0x287d6e[_0xef9a('0x57')][_0xef9a('0x62')]+'%'};return _0xe9460c;}})});}_0x5c79ba=_[_0xef9a('0x63')]({},_0x5c79ba,_0x287d6e[_0xef9a('0x64')]);var _0x567e87={'where':_0x5c79ba[_0xef9a('0x5f')]};return db['ChatWebsite'][_0xef9a('0x27')](_0x567e87)[_0xef9a('0x18')](function(_0x1f2c7d){_0x4d4ce9['count']=_0x1f2c7d;if(_0x287d6e[_0xef9a('0x57')][_0xef9a('0x65')]){_0x5c79ba[_0xef9a('0x66')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x5c79ba);})[_0xef9a('0x18')](function(_0xf6cb25){_0x4d4ce9[_0xef9a('0x67')]=_0xf6cb25;return _0x4d4ce9;})[_0xef9a('0x18')](respondWithFilteredResult(_0x409af1,_0x5c79ba))[_0xef9a('0x21')](handleError(_0x409af1,null));};exports['show']=function(_0x28d828,_0x329d82){var _0x5ab2b1={'raw':![],'where':{'id':_0x28d828[_0xef9a('0x68')]['id']},'include':[{'model':db['Pause'],'as':_0xef9a('0x51')}]},_0x2551f1={};_0x2551f1['model']=_[_0xef9a('0x69')](db[_0xef9a('0x53')][_0xef9a('0x54')]);_0x2551f1['query']=_[_0xef9a('0x69')](_0x28d828[_0xef9a('0x57')]);_0x2551f1[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x2551f1[_0xef9a('0x59')],_0x2551f1[_0xef9a('0x57')]);_0x5ab2b1['attributes']=_[_0xef9a('0x58')](_0x2551f1[_0xef9a('0x59')],qs[_0xef9a('0x5b')](_0x28d828['query'][_0xef9a('0x5b')]));_0x5ab2b1[_0xef9a('0x5a')]=_0x5ab2b1[_0xef9a('0x5a')][_0xef9a('0x6a')]?_0x5ab2b1[_0xef9a('0x5a')]:_0x2551f1[_0xef9a('0x59')];if(_0x28d828[_0xef9a('0x57')][_0xef9a('0x65')]){_0x5ab2b1[_0xef9a('0x66')]=[{'all':!![]}];}_0x5ab2b1=_['merge']({},_0x5ab2b1,_0x28d828[_0xef9a('0x64')]);return db['ChatWebsite'][_0xef9a('0x6b')](_0x5ab2b1)[_0xef9a('0x18')](handleEntityNotFound(_0x329d82,null))['then'](respondWithResult(_0x329d82,null))['catch'](handleError(_0x329d82,null));};exports[_0xef9a('0x6c')]=function(_0x1548c5,_0x16c3fe){return db[_0xef9a('0x53')][_0xef9a('0x6c')](_0x1548c5['body'],{})['then'](function(_0x178480){var _0x154f3c=_0x1548c5[_0xef9a('0x6d')]['get']({'plain':!![]});if(!_0x154f3c)throw new Error(_0xef9a('0x6e'));if(_0x154f3c[_0xef9a('0x6f')]===_0xef9a('0x6d')){var _0x247d2e=_0x178480['get']({'plain':!![]});var _0x574f96='ChatWebsites';return db[_0xef9a('0x70')]['find']({'where':{'name':_0x574f96,'userProfileId':_0x154f3c[_0xef9a('0x71')]},'raw':!![]})['then'](function(_0x238def){if(_0x238def&&_0x238def['autoAssociation']===0x0){return db['UserProfileResource'][_0xef9a('0x6c')]({'name':_0x247d2e[_0xef9a('0x2f')],'resourceId':_0x247d2e['id'],'type':_0x238def[_0xef9a('0x2f')],'sectionId':_0x238def['id']},{})[_0xef9a('0x18')](function(){return _0x178480;});}else{return _0x178480;}})[_0xef9a('0x21')](function(_0x3c23d3){logger[_0xef9a('0x1c')](_0xef9a('0x72'),_0x3c23d3);throw _0x3c23d3;});}return _0x178480;})['then'](respondWithResult(_0x16c3fe,0xc9))['catch'](handleError(_0x16c3fe,null));};exports[_0xef9a('0x73')]=function(_0x3f0db7,_0x3a1af6){if(_0x3f0db7['body']['id']){delete _0x3f0db7['body']['id'];}return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x3f0db7[_0xef9a('0x68')]['id']},'include':[{'model':db[_0xef9a('0x50')],'as':_0xef9a('0x51')}]})[_0xef9a('0x18')](handleEntityNotFound(_0x3a1af6,null))[_0xef9a('0x18')](saveUpdates(_0x3f0db7['body'],null))[_0xef9a('0x18')](respondWithResult(_0x3a1af6,null))[_0xef9a('0x21')](handleError(_0x3a1af6,null));};exports[_0xef9a('0x2b')]=function(_0x4883f0,_0x233883){return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x4883f0[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x233883,null))[_0xef9a('0x18')](removeEntity(_0x233883,null))[_0xef9a('0x21')](handleError(_0x233883,null));};exports[_0xef9a('0x74')]=function(_0xede58,_0x205110){return db[_0xef9a('0x53')][_0xef9a('0x74')]()['then'](respondWithResult(_0x205110,null))[_0xef9a('0x21')](handleError(_0x205110,null));};exports[_0xef9a('0x75')]=function(_0x3fcfdb,_0xe58c2){if(_0x3fcfdb[_0xef9a('0x76')]['id']){delete _0x3fcfdb['body']['id'];}return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x3fcfdb[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0xe58c2,null))[_0xef9a('0x18')](function(_0x52f320){if(_0x52f320){_0x3fcfdb[_0xef9a('0x76')]['ChatWebsiteId']=_0x52f320['id'];return db[_0xef9a('0x77')]['create'](_0x3fcfdb[_0xef9a('0x76')]);}})[_0xef9a('0x18')](respondWithResult(_0xe58c2,null))['catch'](handleError(_0xe58c2,null));};exports[_0xef9a('0x78')]=function(_0x2e9f5d,_0x172e30){var _0x1b15ed={'raw':![],'where':{}};var _0x2cd78c={};var _0x1c56b6={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xef9a('0x79')]({'where':{'id':_0x2e9f5d[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x172e30,null))[_0xef9a('0x18')](function(_0x429bfb){if(_0x429bfb){_0x2cd78c[_0xef9a('0x59')]=_[_0xef9a('0x69')](db['Disposition'][_0xef9a('0x54')]);_0x2cd78c[_0xef9a('0x57')]=_[_0xef9a('0x69')](_0x2e9f5d['query']);_0x2cd78c['filters']=_['intersection'](_0x2cd78c[_0xef9a('0x59')],_0x2cd78c[_0xef9a('0x57')]);_0x1b15ed[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x2cd78c['model'],qs[_0xef9a('0x5b')](_0x2e9f5d['query'][_0xef9a('0x5b')]));_0x1b15ed[_0xef9a('0x5a')]=_0x1b15ed[_0xef9a('0x5a')][_0xef9a('0x6a')]?_0x1b15ed[_0xef9a('0x5a')]:_0x2cd78c[_0xef9a('0x59')];if(!_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x1b15ed[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x1b15ed[_0xef9a('0x28')]=qs[_0xef9a('0x28')](_0x2e9f5d[_0xef9a('0x57')]['offset']);}_0x1b15ed['order']=qs[_0xef9a('0x5e')](_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x5e')]);_0x1b15ed[_0xef9a('0x5f')]=qs[_0xef9a('0x61')](_['pick'](_0x2e9f5d['query'],_0x2cd78c[_0xef9a('0x61')]));_0x1b15ed[_0xef9a('0x5f')][_0xef9a('0x7b')]=_0x429bfb['id'];if(_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x62')]){_0x1b15ed[_0xef9a('0x5f')]=_[_0xef9a('0x63')](_0x1b15ed[_0xef9a('0x5f')],{'$or':_[_0xef9a('0x52')](_0x1b15ed[_0xef9a('0x5a')],function(_0x33acfa){var _0x4aa865={};_0x4aa865[_0x33acfa]={'$like':'%'+_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x62')]+'%'};return _0x4aa865;})});}_0x1b15ed=_['merge']({},_0x1b15ed,_0x2e9f5d['options']);return db[_0xef9a('0x77')]['count']({'where':_0x1b15ed['where']})['then'](function(_0x271b08){_0x1c56b6[_0xef9a('0x27')]=_0x271b08;if(_0x2e9f5d[_0xef9a('0x57')][_0xef9a('0x65')]){_0x1b15ed[_0xef9a('0x66')]=[{'all':!![]}];}return db[_0xef9a('0x77')][_0xef9a('0x7c')](_0x1b15ed);})[_0xef9a('0x18')](function(_0x4da80a){_0x1c56b6['rows']=_0x4da80a;return _0x1c56b6;});}})['then'](respondWithFilteredResult(_0x172e30,_0x1b15ed))['catch'](handleError(_0x172e30,null));};exports[_0xef9a('0x7d')]=function(_0x92b929,_0x54078f){return db[_0xef9a('0x53')]['find']({'where':{'id':_0x92b929['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x54078f,null))[_0xef9a('0x18')](function(_0x46db8c){if(_0x46db8c){return _0x46db8c[_0xef9a('0x7d')](_0x92b929[_0xef9a('0x57')]['ids']);}})[_0xef9a('0x18')](respondWithStatusCode(_0x54078f,null))[_0xef9a('0x21')](handleError(_0x54078f,null));};exports[_0xef9a('0x7e')]=function(_0x19c5f5,_0x132dc0){if(_0x19c5f5['body']['id']){delete _0x19c5f5[_0xef9a('0x76')]['id'];}return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x19c5f5['params']['id']}})['then'](handleEntityNotFound(_0x132dc0,null))[_0xef9a('0x18')](function(_0x4e6ec6){if(_0x4e6ec6){_0x19c5f5[_0xef9a('0x76')][_0xef9a('0x7b')]=_0x4e6ec6['id'];return db[_0xef9a('0x7f')]['create'](_0x19c5f5[_0xef9a('0x76')]);}})[_0xef9a('0x18')](respondWithResult(_0x132dc0,null))[_0xef9a('0x21')](handleError(_0x132dc0,null));};exports['getAnswers']=function(_0x2c5fff,_0x4164d5){var _0x30e923={'raw':![],'where':{}};var _0x193603={};var _0x24419d={'count':0x0,'rows':[]};return db[_0xef9a('0x53')]['findOne']({'where':{'id':_0x2c5fff[_0xef9a('0x68')]['id']}})['then'](handleEntityNotFound(_0x4164d5,null))[_0xef9a('0x18')](function(_0x3b968d){if(_0x3b968d){_0x193603[_0xef9a('0x59')]=_[_0xef9a('0x69')](db[_0xef9a('0x7f')][_0xef9a('0x54')]);_0x193603[_0xef9a('0x57')]=_[_0xef9a('0x69')](_0x2c5fff['query']);_0x193603[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x193603['model'],_0x193603[_0xef9a('0x57')]);_0x30e923[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x193603['model'],qs[_0xef9a('0x5b')](_0x2c5fff['query'][_0xef9a('0x5b')]));_0x30e923[_0xef9a('0x5a')]=_0x30e923['attributes'][_0xef9a('0x6a')]?_0x30e923[_0xef9a('0x5a')]:_0x193603['model'];if(!_0x2c5fff[_0xef9a('0x57')][_0xef9a('0x5c')]('nolimit')){_0x30e923[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x2c5fff[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x30e923[_0xef9a('0x28')]=qs['offset'](_0x2c5fff['query'][_0xef9a('0x28')]);}_0x30e923['order']=qs[_0xef9a('0x5e')](_0x2c5fff[_0xef9a('0x57')]['sort']);_0x30e923['where']=qs[_0xef9a('0x61')](_['pick'](_0x2c5fff['query'],_0x193603[_0xef9a('0x61')]));_0x30e923[_0xef9a('0x5f')][_0xef9a('0x7b')]=_0x3b968d['id'];if(_0x2c5fff['query'][_0xef9a('0x62')]){_0x30e923[_0xef9a('0x5f')]=_[_0xef9a('0x63')](_0x30e923['where'],{'$or':_[_0xef9a('0x52')](_0x30e923[_0xef9a('0x5a')],function(_0x5a85b1){var _0x55009e={};_0x55009e[_0x5a85b1]={'$like':'%'+_0x2c5fff[_0xef9a('0x57')][_0xef9a('0x62')]+'%'};return _0x55009e;})});}_0x30e923=_[_0xef9a('0x63')]({},_0x30e923,_0x2c5fff[_0xef9a('0x64')]);return db['CannedAnswer'][_0xef9a('0x27')]({'where':_0x30e923[_0xef9a('0x5f')]})[_0xef9a('0x18')](function(_0x5e5854){_0x24419d[_0xef9a('0x27')]=_0x5e5854;if(_0x2c5fff['query'][_0xef9a('0x65')]){_0x30e923['include']=[{'all':!![]}];}return db[_0xef9a('0x7f')][_0xef9a('0x7c')](_0x30e923);})[_0xef9a('0x18')](function(_0x280b10){_0x24419d[_0xef9a('0x67')]=_0x280b10;return _0x24419d;});}})[_0xef9a('0x18')](respondWithFilteredResult(_0x4164d5,_0x30e923))[_0xef9a('0x21')](handleError(_0x4164d5,null));};exports[_0xef9a('0x80')]=function(_0x3e303d,_0x4cae5e){return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x3e303d[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x4cae5e,null))[_0xef9a('0x18')](function(_0x3d0d45){if(_0x3d0d45){return _0x3d0d45[_0xef9a('0x80')](_0x3e303d[_0xef9a('0x57')][_0xef9a('0x81')]);}})[_0xef9a('0x18')](respondWithStatusCode(_0x4cae5e,null))['catch'](handleError(_0x4cae5e,null));};exports[_0xef9a('0x82')]=function(_0x49b94a,_0x12d768){_0x49b94a[_0xef9a('0x76')]['sitepic']=_0x49b94a[_0xef9a('0x83')][_0xef9a('0x84')];return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x49b94a['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x12d768,null))[_0xef9a('0x18')](saveUpdates(_0x49b94a[_0xef9a('0x76')],null))[_0xef9a('0x18')](respondWithResult(_0x12d768,null))[_0xef9a('0x21')](handleError(_0x12d768,null));};exports['addAvatar']=function(_0x40694f,_0x3f9749){_0x40694f[_0xef9a('0x76')][_0xef9a('0x85')]=_0x40694f[_0xef9a('0x83')][_0xef9a('0x84')];return db['ChatWebsite']['find']({'where':{'id':_0x40694f['params']['id']}})['then'](handleEntityNotFound(_0x3f9749,null))[_0xef9a('0x18')](saveUpdates(_0x40694f[_0xef9a('0x76')],null))[_0xef9a('0x18')](respondWithResult(_0x3f9749,null))['catch'](handleError(_0x3f9749,null));};exports[_0xef9a('0x86')]=function(_0x259ac0,_0x2d14a7){_0x259ac0[_0xef9a('0x76')]['customerAvatar']=_0x259ac0[_0xef9a('0x83')][_0xef9a('0x84')];return db['ChatWebsite'][_0xef9a('0x6b')]({'where':{'id':_0x259ac0[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x2d14a7,null))[_0xef9a('0x18')](saveUpdates(_0x259ac0[_0xef9a('0x76')],null))[_0xef9a('0x18')](respondWithResult(_0x2d14a7,null))['catch'](handleError(_0x2d14a7,null));};exports[_0xef9a('0x87')]=function(_0x1d3417,_0x330e1d){_0x1d3417['body'][_0xef9a('0x88')]=_0x1d3417[_0xef9a('0x83')][_0xef9a('0x84')];return db[_0xef9a('0x53')]['find']({'where':{'id':_0x1d3417['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x330e1d,null))[_0xef9a('0x18')](saveUpdates(_0x1d3417['body'],null))['then'](respondWithResult(_0x330e1d,null))['catch'](handleError(_0x330e1d,null));};exports['getLogo']=function(_0x3b3c89,_0x11d4ae){var _0x2844c9=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0x1de243={'where':{'id':_0x3b3c89[_0xef9a('0x68')]['id']},'attributes':['id',_0xef9a('0x89')],'raw':!![]};var _0x34275f=![];return require(_0xef9a('0x8a'))['getLicense']()[_0xef9a('0x18')](function(_0x177985){if(_0x177985){_0x34275f=_0x177985[_0xef9a('0x8b')];}})[_0xef9a('0x18')](function(){return db['ChatWebsite'][_0xef9a('0x6b')](_0x1de243);})['then'](handleEntityNotFound(_0x11d4ae,null))[_0xef9a('0x18')](function(_0x527261){if(_0x527261){if(!_[_0xef9a('0x8c')](_0x527261['sitepic'])){if(fs['existsSync'](path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x8f'),_0x527261['sitepic']))&&_0x34275f){_0x2844c9=path['join'](config['root'],'server/files/images/logos/',_0x527261[_0xef9a('0x89')]);}}return _0x11d4ae[_0xef9a('0x90')](_0x2844c9);}})['catch'](handleError(_0x11d4ae,null));};exports[_0xef9a('0x91')]=function(_0xc44a00,_0x502daa){var _0x326ff4=path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x92'));var _0x2757a9={'where':{'id':_0xc44a00['params']['id']},'attributes':['id',_0xef9a('0x85')],'raw':!![]};return db[_0xef9a('0x53')][_0xef9a('0x6b')](_0x2757a9)[_0xef9a('0x18')](handleEntityNotFound(_0x502daa,null))['then'](function(_0x137d8e){if(_0x137d8e){if(!_['isNil'](_0x137d8e[_0xef9a('0x85')])){if(fs[_0xef9a('0x93')](path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x94'),_0x137d8e[_0xef9a('0x85')]))){_0x326ff4=path['join'](config[_0xef9a('0x8e')],'server/files/images/avatars/',_0x137d8e['agentAvatar']);}}return _0x502daa[_0xef9a('0x90')](_0x326ff4);}})['catch'](handleError(_0x502daa,null));};exports['getCustomerAvatar']=function(_0x346928,_0x3d8343){var _0x2b9c4d=path['join'](config[_0xef9a('0x8e')],'server/files/images/avatars/customer_avatar.png');var _0x53427b={'where':{'id':_0x346928[_0xef9a('0x68')]['id']},'attributes':['id','customerAvatar',_0xef9a('0x95')],'raw':!![]};return db[_0xef9a('0x53')][_0xef9a('0x6b')](_0x53427b)[_0xef9a('0x18')](handleEntityNotFound(_0x3d8343,null))[_0xef9a('0x18')](function(_0x2e15d8){if(_0x2e15d8){if(!_[_0xef9a('0x8c')](_0x2e15d8[_0xef9a('0x96')])){if(fs[_0xef9a('0x93')](path[_0xef9a('0x8d')](config['root'],_0xef9a('0x94'),_0x2e15d8[_0xef9a('0x96')]))&&_0x2e15d8['showCustomerAvatar']){_0x2b9c4d=path[_0xef9a('0x8d')](config['root'],_0xef9a('0x94'),_0x2e15d8['customerAvatar']);}}return _0x3d8343[_0xef9a('0x90')](_0x2b9c4d);}})[_0xef9a('0x21')](handleError(_0x3d8343,null));};exports[_0xef9a('0x97')]=function(_0x139973,_0xa25f15){var _0x53e675=path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x98'));var _0x3fc435={'where':{'id':_0x139973['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xef9a('0x53')][_0xef9a('0x6b')](_0x3fc435)[_0xef9a('0x18')](handleEntityNotFound(_0xa25f15,null))[_0xef9a('0x18')](function(_0x29da59){if(_0x29da59){if(!_[_0xef9a('0x8c')](_0x29da59[_0xef9a('0x88')])){if(fs['existsSync'](path['join'](config['root'],_0xef9a('0x94'),_0x29da59[_0xef9a('0x88')]))){_0x53e675=path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x94'),_0x29da59[_0xef9a('0x88')]);}}return _0xa25f15[_0xef9a('0x90')](_0x53e675);}})[_0xef9a('0x21')](handleError(_0xa25f15,null));};exports['notify']=function(_0xba598a,_0x379681){var _0x50dbd6={'body':_0xba598a[_0xef9a('0x76')],'channel':_0xef9a('0x99')};var _0x361354=[];var _0x249573=[];var _0x301df4={};var _0xdad25=![];return db[_0xef9a('0x9a')][_0xef9a('0x74')]()['then'](function(_0x3fa34d){if(!_0x3fa34d){throw new db[(_0xef9a('0x9b'))]['ValidationError'](_0xef9a('0x9c'));}_0x361354=_[_0xef9a('0x9d')](_[_0xef9a('0x69')](_0x3fa34d),['createdAt',_0xef9a('0x9e')]);_0x249573=_['difference'](_[_0xef9a('0x69')](_0x3fa34d),[_0xef9a('0x9f'),_0xef9a('0x9e'),_0xef9a('0xa0'),'ListId']);if(_0xba598a[_0xef9a('0x76')]['id']){delete _0xba598a[_0xef9a('0x76')]['id'];}if(_[_0xef9a('0x8c')](_0xba598a[_0xef9a('0x76')][_0xef9a('0xa1')])){throw new db[(_0xef9a('0x9b'))][(_0xef9a('0xa2'))](_0xef9a('0xa3'));}if(_[_0xef9a('0x8c')](_0xba598a[_0xef9a('0x76')][_0xef9a('0x76')])||_0xba598a[_0xef9a('0x76')][_0xef9a('0x76')]===''){throw new db[(_0xef9a('0x9b'))]['ValidationError'](_0xef9a('0xa4'));}if(_[_0xef9a('0x8c')](_0xba598a[_0xef9a('0x76')][_0xef9a('0xa5')])){throw new db[(_0xef9a('0x9b'))]['ValidationError'](_0xef9a('0xa6')+_0x249573);}if(!_[_0xef9a('0xa7')](_0x249573,_0xba598a[_0xef9a('0x76')][_0xef9a('0xa5')])){throw new db['Sequelize']['ValidationError'](_0xef9a('0xa8')+_0x249573);}_0x301df4[_0xba598a[_0xef9a('0x76')]['mapKey']]=_0xba598a[_0xef9a('0x76')][_0xef9a('0xa1')];})[_0xef9a('0x18')](function(){return db[_0xef9a('0x53')]['find']({'where':{'id':_0xba598a[_0xef9a('0x68')]['id']},'include':[{'model':db[_0xef9a('0xa9')],'as':'List','include':[{'model':db['CmContact'],'as':_0xef9a('0xaa'),'where':_0x301df4,'limit':0x1,'order':[[_0xef9a('0x9e'),_0xef9a('0xab')]]}]},{'model':db[_0xef9a('0xac')],'as':'Applications'},{'model':db['Interval'],'as':_0xef9a('0x3c'),'include':[{'model':db[_0xef9a('0x3c')],'as':_0xef9a('0x3d'),'attributes':['id',_0xef9a('0x34')],'raw':!![]}]}]});})[_0xef9a('0x18')](function(_0x4faab8){if(!_0x4faab8)throw new APINotFoundError(util['format'](_0xef9a('0xad'),_0xba598a[_0xef9a('0x68')]['id']));if(!_0x4faab8[_0xef9a('0x3c')]||!_0x4faab8['Interval'][_0xef9a('0x3d')])return[_0x4faab8,!![]];return[_0x4faab8,checkWebsiteIntervals(_0x4faab8)];})['spread'](function(_0xa9a767,_0xf69d6e){if(!_0xf69d6e)throw new APIOutOfIntervalError();if(!_0xa9a767[_0xef9a('0xae')])return;_0x50dbd6['account']=_0xa9a767;_0x50dbd6['list']=_0xa9a767[_0xef9a('0xae')];_0x50dbd6['applications']=_[_0xef9a('0xaf')](_0xa9a767[_0xef9a('0xb0')],[_0xef9a('0xb1')],[_0xef9a('0xb2')]);if(_0x50dbd6[_0xef9a('0xb3')][_0xef9a('0xb0')]){delete _0x50dbd6[_0xef9a('0xb3')][_0xef9a('0xb0')];}if(_0x50dbd6[_0xef9a('0xb3')][_0xef9a('0xae')]&&_0x50dbd6['account'][_0xef9a('0xae')]['Contacts'][_0xef9a('0x6a')]){return _0x50dbd6[_0xef9a('0xb3')]['List'][_0xef9a('0xaa')][0x0];}var _0xa55a28=_[_0xef9a('0x11')](_0xba598a['body'],{'firstName':_0xba598a['body'][_0xef9a('0xa1')],'ListId':_0xa9a767[_0xef9a('0xb4')]});_0xa55a28[_0xba598a[_0xef9a('0x76')]['mapKey']]=_0xba598a[_0xef9a('0x76')][_0xef9a('0xa1')];return db[_0xef9a('0x9a')]['create'](_0xa55a28,{'fields':_0x361354,'raw':!![]});})[_0xef9a('0x18')](function(_0x45a64d){_0x50dbd6[_0xef9a('0xb5')]=_0x45a64d;var _0x14675a=createInteractionObject(_0xba598a[_0xef9a('0x68')]['id'],_0xba598a[_0xef9a('0x76')],_0xba598a['headers'],_0x45a64d);var _0x3ff892={'ChatWebsiteId':_0xba598a['params']['id'],'closed':![]};if(_0xba598a[_0xef9a('0x76')]['threadId']){_0x3ff892[_0xef9a('0xb6')]=_0xba598a['body']['threadId'];return db[_0xef9a('0xb7')][_0xef9a('0x6b')]({'where':_0x3ff892})[_0xef9a('0x18')](function(_0x19e853){if(_0x19e853){_0xdad25=!![];return _0x19e853;}_0x14675a[_0xef9a('0xb6')]=_0xba598a[_0xef9a('0x76')][_0xef9a('0xb6')];_0x14675a[_0xef9a('0xb8')]=_0xba598a[_0xef9a('0x76')][_0xef9a('0xb8')];return db[_0xef9a('0xb7')][_0xef9a('0x6c')](_0x14675a);});}_0x3ff892[_0xef9a('0xb9')]=_0x45a64d['id'];if(_0xba598a[_0xef9a('0x76')][_0xef9a('0xba')]&&_0xba598a['body'][_0xef9a('0xba')]['id']){_0x3ff892['id']=_0xba598a['body'][_0xef9a('0xba')]['id'];return db[_0xef9a('0xb7')][_0xef9a('0x6b')]({'where':_0x3ff892})[_0xef9a('0x18')](function(_0x10c329){if(_0x10c329){_0xdad25=!![];return _0x10c329;}return db[_0xef9a('0xb7')][_0xef9a('0x6c')](_0x14675a);});}return db[_0xef9a('0xb7')]['create'](_0x14675a);})['then'](function(_0x429e77){if(!_0xdad25)return _0x429e77;var _0x524ec3={'from':(_0x50dbd6[_0xef9a('0xb5')][_0xef9a('0x45')]||'')+'\x20'+(_0x50dbd6[_0xef9a('0xb5')][_0xef9a('0x46')]||'')};if(_0xba598a[_0xef9a('0x76')][_0xef9a('0xb6')]&&_0xba598a['body'][_0xef9a('0xbb')]&&_0xba598a[_0xef9a('0x76')][_0xef9a('0xb6')]!=_0xba598a[_0xef9a('0x76')][_0xef9a('0xbb')]){_0x524ec3[_0xef9a('0xb6')]=_0xba598a[_0xef9a('0x76')][_0xef9a('0xbb')];}return _0x429e77['update'](_0x524ec3);})['then'](function(_0x47656b){_0x50dbd6[_0xef9a('0xba')]=_0x47656b[_0xef9a('0x2c')]({'plain':!![]});_0x50dbd6['interaction']['created']=!_0xdad25;if(_0x50dbd6[_0xef9a('0xba')][_0xef9a('0xbc')]){if(_0x50dbd6['account']['autoclose']){_0x50dbd6[_0xef9a('0xbd')][_0xef9a('0xbe')]({'id':0x0,'priority':_0x50dbd6['applications']['length']+0x1,'app':'close','appdata':_0xef9a('0xbf'),'interval':_0xef9a('0xc0')});}}return db[_0xef9a('0xc1')][_0xef9a('0x6c')]({'body':_0xba598a['body'][_0xef9a('0x76')],'ChatWebsiteId':_0xba598a[_0xef9a('0x68')]['id'],'ChatInteractionId':_0x47656b['id'],'direction':'in','ContactId':_0x50dbd6[_0xef9a('0xb5')]['id'],'AttachmentId':_0xba598a['body']['AttachmentId']});})[_0xef9a('0x18')](function(_0x52f0c4){_0x50dbd6[_0xef9a('0x1e')]=_0x52f0c4;if(!_0x50dbd6[_0xef9a('0xba')][_0xef9a('0xc2')]){return;}return db[_0xef9a('0xc3')]['find']({'attributes':['id',_0xef9a('0x2f')],'where':{'id':_0x50dbd6[_0xef9a('0xba')]['UserId']}});})['then'](function(_0x2a4436){if(_0x2a4436){_0x50dbd6[_0xef9a('0xbd')][_0xef9a('0xc4')]({'id':0x0,'priority':0x0,'app':_0xef9a('0xc5'),'appdata':_0x2a4436[_0xef9a('0x2f')]+','+(_0x50dbd6[_0xef9a('0xb3')][_0xef9a('0xc6')]||0xa),'interval':_0xef9a('0xc0')});_0x50dbd6[_0xef9a('0xc7')]=!![];}if(!_0x50dbd6['interaction'][_0xef9a('0xc8')]){return;}return db[_0xef9a('0xc9')][_0xef9a('0x6b')]({'attributes':['id',_0xef9a('0x2f')],'where':{'id':_0x50dbd6[_0xef9a('0xba')][_0xef9a('0xc8')]}});})[_0xef9a('0x18')](function(_0x45a34b){if(_0x45a34b){_0x50dbd6[_0xef9a('0xbd')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x45a34b[_0xef9a('0x2f')]+','+(_0x50dbd6['account'][_0xef9a('0xca')]||0x12c),'interval':_0xef9a('0xc0')});}return respondWithRpcPromise('Start',_0xef9a('0xcb'),_0x50dbd6);})[_0xef9a('0x18')](function(_0x4e9391){respondWithRpcPromise(_0xef9a('0xcc'),'EventManager',{'event':_0xef9a('0xcd'),'message':_0x4e9391},client9002);return _0x4e9391;})[_0xef9a('0x18')](respondWithResult(_0x379681,null))[_0xef9a('0x21')](APIHandleError(_0x379681));};exports[_0xef9a('0xce')]=function(_0x882a9f,_0x314fc3){var _0x5bbb5b,_0x4294aa,_0x40e66c;var _0x56b99e=[];var _0xd756b7={};var _0x412c9b=_0x882a9f[_0xef9a('0xcf')]||[];var _0x1d3c6c=[];var _0x130879;return db['CmContact'][_0xef9a('0x74')]()[_0xef9a('0x18')](function(_0x4adc5f){if(!_0x4adc5f){throw new db[(_0xef9a('0x9b'))][(_0xef9a('0xa2'))](_0xef9a('0x9c'));}_0x56b99e=_[_0xef9a('0x9d')](_['keys'](_0x4adc5f),[_0xef9a('0x9f'),_0xef9a('0x9e'),_0xef9a('0xa0'),_0xef9a('0xb4')]);if(_0x882a9f[_0xef9a('0x76')]['id']){delete _0x882a9f['body']['id'];}if(_[_0xef9a('0x8c')](_0x882a9f[_0xef9a('0x76')][_0xef9a('0xa1')])){throw _0x314fc3['status'](0x1f4)[_0xef9a('0x30')](new db[(_0xef9a('0x9b'))]['ValidationError'](_0xef9a('0xa3')));}if(_[_0xef9a('0x8c')](_0x882a9f[_0xef9a('0x76')][_0xef9a('0x76')])||_0x882a9f[_0xef9a('0x76')][_0xef9a('0x76')]===''){throw _0x314fc3[_0xef9a('0x23')](0x1f4)['send'](new db[(_0xef9a('0x9b'))][(_0xef9a('0xa2'))](_0xef9a('0xa4')));}if(_['isNil'](_0x882a9f[_0xef9a('0x76')][_0xef9a('0xd0')])){throw _0x314fc3['status'](0x1f4)[_0xef9a('0x30')](new db['Sequelize'][(_0xef9a('0xa2'))](_0xef9a('0xd1')+_0x56b99e));}if(!_[_0xef9a('0xa7')](_0x56b99e,_0x882a9f['body']['mapKeyOffline'])){throw _0x314fc3[_0xef9a('0x23')](0x1f4)[_0xef9a('0x30')](new db[(_0xef9a('0x9b'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x56b99e));}_0xd756b7[_0x882a9f[_0xef9a('0x76')][_0xef9a('0xd0')]]=_0x882a9f[_0xef9a('0x76')][_0xef9a('0xa1')];})['then'](function(){return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x882a9f[_0xef9a('0x68')]['id']},'include':[{'model':db[_0xef9a('0xa9')],'as':_0xef9a('0xae')},{'model':db[_0xef9a('0xd2')],'as':_0xef9a('0xd2')}]});})[_0xef9a('0x18')](handleEntityNotFound(_0x314fc3,null))[_0xef9a('0x18')](function(_0x3af56f){if(_0x3af56f&&_0x3af56f[_0xef9a('0xae')]){_0x4294aa=_0x3af56f;var _0x480833=_[_0xef9a('0x11')](_0x882a9f['body'],{'firstName':_0x882a9f[_0xef9a('0x76')][_0xef9a('0xa1')],'phone':_0x882a9f[_0xef9a('0x76')][_0xef9a('0xa1')],'ListId':_0x3af56f['ListId']});_0x480833[_0x882a9f[_0xef9a('0x76')]['mapKeyOffline']]=_0x882a9f[_0xef9a('0x76')][_0xef9a('0xa1')];return db['CmContact'][_0xef9a('0xd3')]({'where':_0xd756b7,'defaults':_0x480833});}})[_0xef9a('0xd4')](function(_0x52b261){if(_0x52b261){_0x40e66c=_0x52b261;var _0x42db73=fs['readFileSync'](path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0xd5')),'utf8');var _0x20ecb6=ejs[_0xef9a('0xd6')](_0x42db73,{'body':_['toPairs'](_0x882a9f['body']['body']),'bodyTitle':_0x4294aa[_0xef9a('0xd7')]});return db[_0xef9a('0xd8')][_0xef9a('0x6c')]({'body':_0x20ecb6,'plainBody':htmlToText['fromString'](_0x20ecb6),'ContactId':_0x52b261['id'],'ChatWebsiteId':_0x4294aa['id']});}})[_0xef9a('0x18')](function(_0x37ffe6){_0x130879=_0x37ffe6;if(_0x412c9b[_0xef9a('0x6a')]){var _0x2fec2a=_0x412c9b[_0xef9a('0x52')](function(_0x139df5){return{'name':_0x139df5[_0xef9a('0xd9')],'basename':_0x139df5[_0xef9a('0x84')],'type':_0x139df5['mimetype'],'ChatOfflineMessageId':_0x37ffe6['id']};});_0x1d3c6c=_0x2fec2a[_0xef9a('0x52')](_0x36df2f=>{var _0x5626bf={'filename':_0x36df2f[_0xef9a('0x2f')],'path':path[_0xef9a('0x8d')](config['root'],_0xef9a('0xda'),_0xef9a('0xcf'),'attachments',_0xef9a('0xdb'),_0x36df2f[_0xef9a('0xdc')])};return _0x5626bf;});if(!_0x4294aa[_0xef9a('0xdd')]){return db['sequelize']['transaction'](function(_0x1621d0){return db[_0xef9a('0xde')][_0xef9a('0xdf')](_0x2fec2a,{'transaction':_0x1621d0});});}}})[_0xef9a('0x18')](function(){if(_0x130879){_0x5bbb5b=_0x130879;return db['MailAccount'][_0xef9a('0x79')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xef9a('0xe0')],'as':_0xef9a('0xe0'),'raw':!![]}]}]});}})['then'](function(_0x59d138){if(_0x59d138&&_0x59d138[_0xef9a('0xe1')]&&_0x4294aa[_0xef9a('0xe2')]&&_0x4294aa['forwardOfflineAddress']){var _0x20e7da=_0x59d138[_0xef9a('0xe3')]();return respondWithRpcPromise(_0xef9a('0xe4'),_0xef9a('0xe5'),{'account':_0x20e7da,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x59d138[_0xef9a('0x2f')],_0x59d138['email']||_0x59d138[_0xef9a('0xe1')][_0xef9a('0x6d')]),'to':_0x4294aa[_0xef9a('0xe6')],'subject':_0x4294aa['offlineMessageSubject'],'html':_0x5bbb5b[_0xef9a('0x76')],'attachments':_0x1d3c6c}},client9003)['then'](function(){return _0x5bbb5b;})[_0xef9a('0x21')](function(_0x27a68e){logger['error'](_0x27a68e);});}})[_0xef9a('0x18')](function(){if(_0x4294aa&&_0x4294aa[_0xef9a('0xdd')]&&_0x4294aa['MailAccountId']){var _0x3f7cb5=[];if(_0x412c9b[_0xef9a('0x6a')]){_0x3f7cb5=_0x412c9b[_0xef9a('0x52')](function(_0x21dd6e){return{'name':_0x21dd6e['originalname'],'basename':_0x21dd6e[_0xef9a('0x84')],'type':_0x21dd6e['mimetype'],'ChatOfflineMessageId':_0x130879['id']};});}var _0x56180b;if(!_['isNil'](_0x4294aa[_0xef9a('0xe7')])){var _0x4bb8d8=_['map'](_0x882a9f['body'],function(_0x1d7af0){return _0x1d7af0;});var _0xe0e2c4=_[_0xef9a('0xe8')](_0x4bb8d8)[0x0];var _0x5646cd=_[_0xef9a('0xe9')](_0xe0e2c4,function(_0x458c4e){return _0x458c4e;});_0x56180b=_0x5646cd[0x1][_0x4294aa[_0xef9a('0xe7')]];}var _0x5f47d8={'from':_0x40e66c['email'],'firstName':_0x40e66c[_0xef9a('0x45')],'lastName':_0x40e66c[_0xef9a('0x46')],'mapKey':_0xef9a('0xea'),'message':{'from':_0x40e66c['email'],'to':_0x4294aa[_0xef9a('0xd2')][_0xef9a('0xea')],'cc':'','subject':_[_0xef9a('0x8c')](_0x56180b)?_0x4294aa[_0xef9a('0xeb')]:_0x56180b,'messageId':'','sentAt':new Date(),'attach':_0x3f7cb5['length'],'attachments':_0x3f7cb5,'originChannel':_0xef9a('0xec'),'ChatWebsiteId':_0x4294aa['id'],'ChatOfflineMessageId':_0x5bbb5b['id'],'originTo':_0x4294aa['MailAccount'][_0xef9a('0xea')]},'body':_0x5bbb5b[_0xef9a('0x76')]};var _0x3d98b0={'account':{'id':_0x4294aa[_0xef9a('0xed')]},'body':_0x5f47d8,'log':_0xef9a('0xee')};return respondWithRpcPromise(_0xef9a('0xee'),_0xef9a('0xef'),_0x3d98b0,client9001)['then'](function(){return _0x5bbb5b;})['catch'](function(_0x5aaf58){logger[_0xef9a('0x1c')](_0x5aaf58);});}return;})[_0xef9a('0x18')](function(){if(_0x5bbb5b){return _0x5bbb5b;}})['then'](respondWithResult(_0x314fc3,null))['catch'](function(){for(var _0x5b93b8 of _0x412c9b){var _0x1f5c59=path['join'](config[_0xef9a('0x8e')],_0xef9a('0xda'),_0xef9a('0xcf'),_0xef9a('0xf0'),_0xef9a('0xdb'),_0x5b93b8[_0xef9a('0x84')]);fs_extra[_0xef9a('0xf1')](_0x1f5c59)['catch'](function(_0x1da22c){logger[_0xef9a('0x1c')](_0xef9a('0xf2'),_0x1f5c59,_0x1da22c);});}});};exports[_0xef9a('0xf3')]=function(_0x4e70db,_0x2f43bd){return db[_0xef9a('0xb7')]['find']({'where':{'id':_0x4e70db['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x2f43bd,null))[_0xef9a('0x18')](function(_0x4d6969){if(_0x4d6969){return _0x4d6969[_0xef9a('0xf3')](_0x4e70db['body'][_0xef9a('0x81')],_['omit'](_0x4e70db[_0xef9a('0x76')],[_0xef9a('0x81'),'id'])||{});}})[_0xef9a('0x18')](respondWithResult(_0x2f43bd,null))[_0xef9a('0x21')](handleError(_0x2f43bd,null));};exports[_0xef9a('0xf4')]=function(_0x61d390,_0x5849e2){var _0x4aef7b={'raw':![],'where':{}};var _0x16726f={};var _0x17f071={'count':0x0,'rows':[]};return db[_0xef9a('0x53')][_0xef9a('0x79')]({'where':{'id':_0x61d390['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x5849e2,null))['then'](function(_0x4fd5a0){if(_0x4fd5a0){_0x16726f[_0xef9a('0x59')]=_[_0xef9a('0x69')](db[_0xef9a('0xb7')][_0xef9a('0x54')]);_0x16726f['query']=_[_0xef9a('0x69')](_0x61d390[_0xef9a('0x57')]);_0x16726f[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x16726f['model'],_0x16726f[_0xef9a('0x57')]);_0x4aef7b[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x16726f['model'],qs[_0xef9a('0x5b')](_0x61d390[_0xef9a('0x57')][_0xef9a('0x5b')]));_0x4aef7b[_0xef9a('0x5a')]=_0x4aef7b[_0xef9a('0x5a')][_0xef9a('0x6a')]?_0x4aef7b[_0xef9a('0x5a')]:_0x16726f[_0xef9a('0x59')];if(!_0x61d390[_0xef9a('0x57')][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x4aef7b[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x61d390[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x4aef7b[_0xef9a('0x28')]=qs['offset'](_0x61d390[_0xef9a('0x57')][_0xef9a('0x28')]);}_0x4aef7b[_0xef9a('0xf5')]=qs['sort'](_0x61d390[_0xef9a('0x57')]['sort']);_0x4aef7b[_0xef9a('0x5f')]=qs[_0xef9a('0x61')](_[_0xef9a('0x60')](_0x61d390[_0xef9a('0x57')],_0x16726f[_0xef9a('0x61')]));_0x4aef7b[_0xef9a('0x5f')][_0xef9a('0x7b')]=_0x4fd5a0['id'];if(_0x61d390[_0xef9a('0x57')]['filter']){_0x4aef7b[_0xef9a('0x5f')]=_['merge'](_0x4aef7b['where'],{'$or':_[_0xef9a('0x52')](_0x4aef7b['attributes'],function(_0x1bfbbf){var _0x4bbcac={};_0x4bbcac[_0x1bfbbf]={'$like':'%'+_0x61d390[_0xef9a('0x57')][_0xef9a('0x62')]+'%'};return _0x4bbcac;})});}_0x4aef7b=_[_0xef9a('0x63')]({},_0x4aef7b,_0x61d390['options']);return db[_0xef9a('0xb7')][_0xef9a('0x27')]({'where':_0x4aef7b['where']})['then'](function(_0x488939){_0x17f071[_0xef9a('0x27')]=_0x488939;if(_0x61d390[_0xef9a('0x57')][_0xef9a('0x65')]){_0x4aef7b[_0xef9a('0x66')]=[{'model':db[_0xef9a('0x9a')],'as':'Contact','required':![]},{'model':db[_0xef9a('0xc3')],'as':_0xef9a('0xf6'),'attributes':[_0xef9a('0x2f'),'fullname',_0xef9a('0xf7')],'required':![]},{'model':db[_0xef9a('0xf8')],'as':_0xef9a('0xf9'),'attributes':['id',_0xef9a('0x2f'),_0xef9a('0xfa')],'where':_0x61d390[_0xef9a('0x57')][_0xef9a('0xfb')]?{'id':_0x61d390[_0xef9a('0x57')][_0xef9a('0xfb')]}:undefined,'required':_0x61d390[_0xef9a('0x57')][_0xef9a('0xfb')]?!![]:![]}];}return db['ChatInteraction'][_0xef9a('0x7c')](_0x4aef7b);})[_0xef9a('0x18')](function(_0x2b6b24){_0x17f071[_0xef9a('0x67')]=_0x2b6b24;return _0x17f071;});}})[_0xef9a('0x18')](respondWithFilteredResult(_0x5849e2,_0x4aef7b))[_0xef9a('0x21')](handleError(_0x5849e2,null));};exports[_0xef9a('0x31')]=function(_0x369268,_0x4e3826){var _0x29c19d=0x0;var _0x2dcff2=0x0;var _0x548dcd=![];var _0x319f27;var _0x2bed00;return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x369268[_0xef9a('0x68')]['id']},'include':[{'model':db[_0xef9a('0x3c')],'as':'Interval','include':[{'model':db[_0xef9a('0x3c')],'as':'Intervals','attributes':['id',_0xef9a('0x34')]}]}]})[_0xef9a('0x18')](handleEntityNotFound(_0x4e3826,null))[_0xef9a('0x18')](function(_0x304610){if(_0x304610){_0x319f27=_0x304610;return _0x304610['getProactiveActions']({'raw':!![]});}})[_0xef9a('0x18')](function(_0x4b3783){if(_0x319f27){if(_0x4b3783){_0x2bed00=_0x4b3783;}}return require(_0xef9a('0x8a'))[_0xef9a('0xfc')]();})['then'](function(_0x44cade){if(_0x44cade){_0x2dcff2=_0x44cade[_0xef9a('0xfd')];_0x548dcd=_0x44cade[_0xef9a('0x8b')];}})['then'](function(){return db[_0xef9a('0xb7')][_0xef9a('0x27')]({'where':{'closed':![]}});})['then'](function(_0x1cff2f){_0x29c19d=_0x1cff2f;if(_0x2dcff2&&_0x1cff2f>_0x2dcff2){return db[_0xef9a('0xfe')][_0xef9a('0x79')]({'where':{'id':0x1}})[_0xef9a('0x18')](function(_0x241a3b){if(_0x241a3b){_0x241a3b['increment'](_0xef9a('0xff'));}});}})[_0xef9a('0x18')](function(){if(!_0x319f27[_0xef9a('0x3c')]||!_0x319f27['Interval']['Intervals'])return!![];return checkWebsiteIntervals(_0x319f27);})['then'](function(_0x1daf13){var _0x539bb0=fs['readFileSync'](path[_0xef9a('0x8d')](config[_0xef9a('0x8e')],_0xef9a('0x100')),_0xef9a('0x101'));var _0x1dfe7d=new url[(_0xef9a('0x102'))](_0x319f27[_0xef9a('0x103')])[_0xef9a('0x104')];var _0x4a9862=_0xef9a('0x105');var _0x370b34=![];var _0x3ecfdd={'chatVersion':_0x4a9862,'chatWebsiteAddressOrigin':_0x1dfe7d,'remote':_0x319f27[_0xef9a('0x106')],'query':querystring['stringify'](_[_0xef9a('0x63')](_0x319f27[_0xef9a('0x2c')]({'plain':!![]}),{'customerIp':_0x369268[_0xef9a('0x107')][_0xef9a('0x43')]||_0x369268[_0xef9a('0x107')][_0xef9a('0x108')]||_0x369268['connection'][_0xef9a('0x109')]||_0x369268['ip'],'referer':_0x369268['headers'][_0xef9a('0x48')],'openedInteractions':_0x29c19d,'maxInteractions':_0x2dcff2,'virtual':_0x548dcd['virtual'],'online':_0x1daf13,'custom':_0x548dcd}))[_0xef9a('0x10a')](/'/g,'\x5c\x27')};_0x4e3826[_0xef9a('0x30')](ejs[_0xef9a('0xd6')](Mustache[_0xef9a('0xd6')](_0x539bb0,_0x3ecfdd),{'proactiveActions':_0x2bed00,'alignment':_0x319f27['alignment'],'verticalAlignment':_0x319f27['verticalAlignment'],'div_color':_0x319f27[_0xef9a('0xfa')],'labelText':_0x319f27[_0xef9a('0x10b')],'text_color':_0x319f27[_0xef9a('0x10c')],'text_button_color':_0x319f27[_0xef9a('0x10d')],'button_color':_0x319f27['color_button'],'background_color':_0x319f27['backgroundColor'],'hideWhenOffline':_0x319f27[_0xef9a('0x10e')],'intervalId':_0x319f27['IntervalId'],'isDevelopment':_0x370b34,'chatVersion':_0x4a9862}));})[_0xef9a('0x21')](handleError(_0x4e3826,null));};exports[_0xef9a('0x10f')]=function(_0x2fb277,_0x283199){var _0x57946e=_0x2fb277[_0xef9a('0x68')]['id'];var _0x6e33f8=_0x2fb277[_0xef9a('0x76')];var _0x134f68=0xc8;var _0x5cbba7=null;return db[_0xef9a('0x110')]['transaction']({'isolationLevel':db[_0xef9a('0x110')]['Transaction'][_0xef9a('0x111')][_0xef9a('0x112')]},function(_0x4ac7b9){return db['ChatWebsite'][_0xef9a('0x79')]({'where':{'id':_0x57946e},'transaction':_0x4ac7b9})[_0xef9a('0x18')](function(_0x45cf6f){if(_0x45cf6f){return db['ChatApplication'][_0xef9a('0x2b')]({'where':{'ChatWebsiteId':_0x57946e},'transaction':_0x4ac7b9})[_0xef9a('0x18')](function(){var _0x27ec8c=_['map'](_0x6e33f8,function(_0x193dae){_0x193dae[_0xef9a('0x7b')]=_0x57946e;return _0x193dae;});return db[_0xef9a('0xac')][_0xef9a('0xdf')](_0x27ec8c,{'transaction':_0x4ac7b9});});}else{_0x134f68=0x194;_0x5cbba7=[];}});})['then'](function(){if(_0x134f68!==0x194){return db[_0xef9a('0xac')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x57946e},'order':_0xef9a('0xb1')})[_0xef9a('0x18')](function(_0xcc2d07){_0x5cbba7=_0xcc2d07;});}})[_0xef9a('0x21')](function(_0x47a9ec){_0x134f68=0x1f4;logger[_0xef9a('0x1c')](_0x47a9ec[_0xef9a('0x2e')]);if(_0x47a9ec[_0xef9a('0x2f')]){delete _0x47a9ec['name'];}_0x5cbba7=_0x47a9ec;})[_0xef9a('0x113')](function(){if(_0x5cbba7===null){_0x283199[_0xef9a('0x22')](_0x134f68);}else{if(_0x134f68===0x1f4){_0x283199[_0xef9a('0x23')](_0x134f68)['send'](_0x5cbba7);}else{_0x283199[_0xef9a('0x23')](_0x134f68)[_0xef9a('0x25')](_0x5cbba7);}}});};exports[_0xef9a('0x114')]=function(_0x2b925c,_0x427587){var _0x51ea32={};var _0x2c18d9={};var _0x3842d0;var _0x196879;return db[_0xef9a('0x53')][_0xef9a('0x79')]({'where':{'id':_0x2b925c[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x427587,null))[_0xef9a('0x18')](function(_0x8badeb){if(_0x8badeb){_0x3842d0=_0x8badeb;_0x2c18d9[_0xef9a('0x59')]=_[_0xef9a('0x69')](db[_0xef9a('0xac')]['rawAttributes']);_0x2c18d9[_0xef9a('0x57')]=_[_0xef9a('0x69')](_0x2b925c[_0xef9a('0x57')]);_0x2c18d9[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x2c18d9[_0xef9a('0x59')],_0x2c18d9[_0xef9a('0x57')]);_0x51ea32[_0xef9a('0x5a')]=_['intersection'](_0x2c18d9[_0xef9a('0x59')],qs['fields'](_0x2b925c['query'][_0xef9a('0x5b')]));_0x51ea32['attributes']=_0x51ea32['attributes']['length']?_0x51ea32[_0xef9a('0x5a')]:_0x2c18d9[_0xef9a('0x59')];_0x51ea32['order']=qs[_0xef9a('0x5e')](_0x2b925c[_0xef9a('0x57')]['sort']);_0x51ea32[_0xef9a('0x5f')]=qs[_0xef9a('0x61')](_['pick'](_0x2b925c['query'],_0x2c18d9['filters']));if(_0x2b925c[_0xef9a('0x57')][_0xef9a('0x62')]){_0x51ea32[_0xef9a('0x5f')]=_[_0xef9a('0x63')](_0x51ea32[_0xef9a('0x5f')],{'$or':_[_0xef9a('0x52')](_0x51ea32['attributes'],function(_0x450b9d){var _0x4d8f9b={};_0x4d8f9b[_0x450b9d]={'$like':'%'+_0x2b925c[_0xef9a('0x57')][_0xef9a('0x62')]+'%'};return _0x4d8f9b;})});}_0x51ea32=_[_0xef9a('0x63')]({},_0x51ea32,_0x2b925c[_0xef9a('0x64')]);return _0x3842d0[_0xef9a('0x114')](_0x51ea32);}})[_0xef9a('0x18')](function(_0x119fdd){if(_0x119fdd){_0x196879=_0x119fdd[_0xef9a('0x6a')];if(!_0x2b925c['query'][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x51ea32[_0xef9a('0x5d')]=qs['limit'](_0x2b925c[_0xef9a('0x57')]['limit']);_0x51ea32[_0xef9a('0x28')]=qs[_0xef9a('0x28')](_0x2b925c[_0xef9a('0x57')]['offset']);}return _0x3842d0['getApplications'](_0x51ea32);}})['then'](function(_0x7f4348){if(_0x7f4348){return _0x7f4348?{'count':_0x196879,'rows':_0x7f4348}:null;}})['then'](respondWithResult(_0x427587,null))[_0xef9a('0x21')](handleError(_0x427587,null));};exports[_0xef9a('0x115')]=function(_0x2f7f5e,_0x221c41){return db[_0xef9a('0x116')][_0xef9a('0x6b')]({'where':{'id':_0x2f7f5e[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x221c41,null))[_0xef9a('0x18')](function(_0x384267){if(_0x384267){return _0x384267[_0xef9a('0x115')](_0x2f7f5e['body']['ids'],_[_0xef9a('0x117')](_0x2f7f5e[_0xef9a('0x76')],['ids','id'])||{});}})[_0xef9a('0x18')](respondWithResult(_0x221c41,null))[_0xef9a('0x21')](handleError(_0x221c41,null));};exports['getProactiveActions']=function(_0x2f5fca,_0x466671){var _0x1d7fe6={};var _0x324f27={};var _0x40a6cc;var _0x408928;return db[_0xef9a('0x53')][_0xef9a('0x79')]({'where':{'id':_0x2f5fca[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x466671,null))[_0xef9a('0x18')](function(_0x4fe22a){if(_0x4fe22a){_0x40a6cc=_0x4fe22a;_0x324f27['model']=_['keys'](db[_0xef9a('0x118')][_0xef9a('0x54')]);_0x324f27[_0xef9a('0x57')]=_[_0xef9a('0x69')](_0x2f5fca['query']);_0x324f27[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x324f27[_0xef9a('0x59')],_0x324f27['query']);_0x1d7fe6[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x324f27[_0xef9a('0x59')],qs[_0xef9a('0x5b')](_0x2f5fca['query'][_0xef9a('0x5b')]));_0x1d7fe6[_0xef9a('0x5a')]=_0x1d7fe6[_0xef9a('0x5a')][_0xef9a('0x6a')]?_0x1d7fe6[_0xef9a('0x5a')]:_0x324f27[_0xef9a('0x59')];_0x1d7fe6[_0xef9a('0xf5')]=qs[_0xef9a('0x5e')](_0x2f5fca[_0xef9a('0x57')][_0xef9a('0x5e')]);_0x1d7fe6[_0xef9a('0x5f')]=qs[_0xef9a('0x61')](_[_0xef9a('0x60')](_0x2f5fca[_0xef9a('0x57')],_0x324f27[_0xef9a('0x61')]));if(_0x2f5fca[_0xef9a('0x57')][_0xef9a('0x62')]){_0x1d7fe6['where']=_[_0xef9a('0x63')](_0x1d7fe6[_0xef9a('0x5f')],{'$or':_['map'](_0x1d7fe6['attributes'],function(_0x3587ec){var _0x41e5f0={};_0x41e5f0[_0x3587ec]={'$like':'%'+_0x2f5fca[_0xef9a('0x57')]['filter']+'%'};return _0x41e5f0;})});}_0x1d7fe6=_['merge']({},_0x1d7fe6,_0x2f5fca[_0xef9a('0x64')]);return _0x40a6cc[_0xef9a('0x119')](_0x1d7fe6);}})[_0xef9a('0x18')](function(_0x4de82d){if(_0x4de82d){_0x408928=_0x4de82d['length'];if(!_0x2f5fca[_0xef9a('0x57')][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x1d7fe6[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x2f5fca[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x1d7fe6['offset']=qs['offset'](_0x2f5fca[_0xef9a('0x57')][_0xef9a('0x28')]);}return _0x40a6cc[_0xef9a('0x119')](_0x1d7fe6);}})[_0xef9a('0x18')](function(_0x1fe7e2){if(_0x1fe7e2){return _0x1fe7e2?{'count':_0x408928,'rows':_0x1fe7e2}:null;}})[_0xef9a('0x18')](respondWithResult(_0x466671,null))[_0xef9a('0x21')](handleError(_0x466671,null));};exports[_0xef9a('0x11a')]=function(_0x16e549,_0x268415){var _0x6b34a5=_0x16e549[_0xef9a('0x57')][_0xef9a('0x11b')]===_0xef9a('0x11c')?'offlineForm':_0xef9a('0x11d');return db[_0xef9a('0x53')]['find']({'attributes':['id',_0x6b34a5],'where':{'id':_0x16e549[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x268415,null))[_0xef9a('0x18')](function(_0x4c54ca){if(_0x4c54ca){var _0x8f8c85=_0x4c54ca[_0x6b34a5];var _0x38d3e9=_0x8f8c85&&_0x8f8c85[_0xef9a('0x11e')]?_0x8f8c85[_0xef9a('0x11e')]:[];_0x268415[_0xef9a('0x30')]({'fromKey':_[_0xef9a('0x8c')](_0x8f8c85['fromKey'])?undefined:_0x8f8c85[_0xef9a('0x11f')],'count':_0x38d3e9['length'],'rows':_0x38d3e9});}})[_0xef9a('0x21')](handleError(_0x268415,null));};exports['getOfflineMessages']=function(_0x19d0e7,_0x28b56f){var _0x2d86d4={'raw':![],'where':{}};var _0x11a5ef={};var _0x38a9ce={'count':0x0,'rows':[]};return db[_0xef9a('0x53')][_0xef9a('0x79')]({'where':{'id':_0x19d0e7[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x28b56f,null))[_0xef9a('0x18')](function(_0x2052e4){if(_0x2052e4){_0x11a5ef[_0xef9a('0x59')]=_['keys'](db[_0xef9a('0xd8')][_0xef9a('0x54')]);_0x11a5ef['query']=_[_0xef9a('0x69')](_0x19d0e7['query']);_0x11a5ef[_0xef9a('0x61')]=_[_0xef9a('0x58')](_0x11a5ef['model'],_0x11a5ef[_0xef9a('0x57')]);_0x2d86d4[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x11a5ef[_0xef9a('0x59')],qs[_0xef9a('0x5b')](_0x19d0e7[_0xef9a('0x57')]['fields']));_0x2d86d4[_0xef9a('0x5a')]=_0x2d86d4['attributes'][_0xef9a('0x6a')]?_0x2d86d4[_0xef9a('0x5a')]:_0x11a5ef['model'];if(!_0x19d0e7[_0xef9a('0x57')][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x2d86d4[_0xef9a('0x5d')]=qs[_0xef9a('0x5d')](_0x19d0e7[_0xef9a('0x57')][_0xef9a('0x5d')]);_0x2d86d4[_0xef9a('0x28')]=qs['offset'](_0x19d0e7['query']['offset']);}_0x2d86d4['order']=qs['sort'](_0x19d0e7[_0xef9a('0x57')][_0xef9a('0x5e')]);_0x2d86d4[_0xef9a('0x5f')]=qs['filters'](_['pick'](_0x19d0e7[_0xef9a('0x57')],_0x11a5ef[_0xef9a('0x61')]));_0x2d86d4[_0xef9a('0x5f')]['ChatWebsiteId']=_0x2052e4['id'];if(_0x19d0e7[_0xef9a('0x57')][_0xef9a('0x62')]){_0x2d86d4[_0xef9a('0x5f')]=_[_0xef9a('0x63')](_0x2d86d4[_0xef9a('0x5f')],{'$or':_[_0xef9a('0x52')](_0x2d86d4['attributes'],function(_0x50ac60){var _0x347ed0={};_0x347ed0[_0x50ac60]={'$like':'%'+_0x19d0e7[_0xef9a('0x57')]['filter']+'%'};return _0x347ed0;})});}_0x2d86d4=_['merge']({},_0x2d86d4,_0x19d0e7['options']);return db[_0xef9a('0xd8')][_0xef9a('0x27')]({'where':_0x2d86d4[_0xef9a('0x5f')]})[_0xef9a('0x18')](function(_0x19a6a0){_0x38a9ce[_0xef9a('0x27')]=_0x19a6a0;if(_0x19d0e7[_0xef9a('0x57')][_0xef9a('0x65')]){_0x2d86d4[_0xef9a('0x66')]=[{'all':!![]}];}else{_0x2d86d4[_0xef9a('0x66')]=[{'model':db[_0xef9a('0x9a')],'as':_0xef9a('0x120'),'required':![]},{'model':db[_0xef9a('0xde')],'as':'Attachments','required':![]}];}return db[_0xef9a('0xd8')][_0xef9a('0x7c')](_0x2d86d4);})[_0xef9a('0x18')](function(_0x17c0d3){_0x38a9ce[_0xef9a('0x67')]=_0x17c0d3;return _0x38a9ce;});}})['then'](respondWithFilteredResult(_0x28b56f,_0x2d86d4))['catch'](handleError(_0x28b56f,null));};exports[_0xef9a('0x121')]=function(_0x119f0b,_0x1672bc){return db[_0xef9a('0x53')][_0xef9a('0x6b')]({'where':{'id':_0x119f0b['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x1672bc,null))['then'](function(_0x379c4a){if(_0x379c4a){return _0x379c4a[_0xef9a('0x121')](_0x119f0b[_0xef9a('0x76')][_0xef9a('0x81')],_['omit'](_0x119f0b[_0xef9a('0x76')],[_0xef9a('0x81'),'id'])||{})['spread'](function(_0x1613bf){for(var _0x355738=0x0;_0x355738<_0x119f0b[_0xef9a('0x76')][_0xef9a('0x81')][_0xef9a('0x6a')];_0x355738+=0x1){socket['emit'](_0xef9a('0x122'),{'UserId':Number(_0x119f0b[_0xef9a('0x76')][_0xef9a('0x81')][_0x355738]),'ChatWebsiteId':Number(_0x119f0b['params']['id'])});}return _0x1613bf;});}})[_0xef9a('0x18')](respondWithResult(_0x1672bc,null))[_0xef9a('0x21')](handleError(_0x1672bc,null));};exports['removeAgents']=function(_0x2f8f4e,_0x3e9808){return db[_0xef9a('0x53')]['find']({'where':{'id':_0x2f8f4e[_0xef9a('0x68')]['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x3e9808,null))[_0xef9a('0x18')](function(_0x136eba){if(_0x136eba){return _0x136eba[_0xef9a('0x123')](_0x2f8f4e[_0xef9a('0x57')][_0xef9a('0x81')])[_0xef9a('0x18')](function(){if(_[_0xef9a('0x124')](_0x2f8f4e['query'][_0xef9a('0x81')])){for(var _0x480723=0x0;_0x480723<_0x2f8f4e[_0xef9a('0x57')][_0xef9a('0x81')]['length'];_0x480723+=0x1){socket[_0xef9a('0x125')](_0xef9a('0x126'),{'UserId':Number(_0x2f8f4e[_0xef9a('0x57')][_0xef9a('0x81')][_0x480723]),'ChatWebsiteId':Number(_0x2f8f4e[_0xef9a('0x68')]['id'])});}}else{socket[_0xef9a('0x125')](_0xef9a('0x126'),{'UserId':Number(_0x2f8f4e[_0xef9a('0x57')][_0xef9a('0x81')]),'ChatWebsiteId':Number(_0x2f8f4e[_0xef9a('0x68')]['id'])});}});}})[_0xef9a('0x18')](respondWithStatusCode(_0x3e9808,null))[_0xef9a('0x21')](handleError(_0x3e9808,null));};exports[_0xef9a('0x127')]=function(_0x4025f4,_0x1fe2d5){var _0x2773a0={};var _0x186ec9={};var _0x5dd7f1;var _0x1fd9a8;return db[_0xef9a('0x53')]['findOne']({'where':{'id':_0x4025f4['params']['id']}})[_0xef9a('0x18')](handleEntityNotFound(_0x1fe2d5,null))[_0xef9a('0x18')](function(_0x77fc1a){if(_0x77fc1a){_0x5dd7f1=_0x77fc1a;_0x186ec9[_0xef9a('0x59')]=_[_0xef9a('0x69')](db[_0xef9a('0xc3')]['rawAttributes']);_0x186ec9['query']=_[_0xef9a('0x69')](_0x4025f4[_0xef9a('0x57')]);_0x186ec9[_0xef9a('0x61')]=_['intersection'](_0x186ec9[_0xef9a('0x59')],_0x186ec9[_0xef9a('0x57')]);_0x2773a0[_0xef9a('0x5a')]=_[_0xef9a('0x58')](_0x186ec9['model'],qs[_0xef9a('0x5b')](_0x4025f4[_0xef9a('0x57')]['fields']));_0x2773a0[_0xef9a('0x5a')]=_0x2773a0[_0xef9a('0x5a')]['length']?_0x2773a0[_0xef9a('0x5a')]:_0x186ec9[_0xef9a('0x59')];_0x2773a0[_0xef9a('0xf5')]=qs[_0xef9a('0x5e')](_0x4025f4['query'][_0xef9a('0x5e')]);_0x2773a0[_0xef9a('0x5f')]=qs[_0xef9a('0x61')](_[_0xef9a('0x60')](_0x4025f4[_0xef9a('0x57')],_0x186ec9[_0xef9a('0x61')]));if(_0x4025f4['query'][_0xef9a('0x62')]){_0x2773a0[_0xef9a('0x5f')]=_[_0xef9a('0x63')](_0x2773a0[_0xef9a('0x5f')],{'$or':_[_0xef9a('0x52')](_0x2773a0[_0xef9a('0x5a')],function(_0x366463){var _0x579605={};_0x579605[_0x366463]={'$like':'%'+_0x4025f4[_0xef9a('0x57')]['filter']+'%'};return _0x579605;})});}_0x2773a0=_[_0xef9a('0x63')]({},_0x2773a0,_0x4025f4['options']);return _0x5dd7f1[_0xef9a('0x127')](_0x2773a0);}})[_0xef9a('0x18')](function(_0x213153){if(_0x213153){_0x1fd9a8=_0x213153['length'];if(!_0x4025f4['query'][_0xef9a('0x5c')](_0xef9a('0x7a'))){_0x2773a0['limit']=qs['limit'](_0x4025f4['query'][_0xef9a('0x5d')]);_0x2773a0[_0xef9a('0x28')]=qs[_0xef9a('0x28')](_0x4025f4[_0xef9a('0x57')][_0xef9a('0x28')]);}return _0x5dd7f1['getAgents'](_0x2773a0);}})[_0xef9a('0x18')](function(_0x55b55d){if(_0x55b55d){return _0x55b55d?{'count':_0x1fd9a8,'rows':_0x55b55d}:null;}})[_0xef9a('0x18')](respondWithResult(_0x1fe2d5,null))['catch'](handleError(_0x1fe2d5,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index a3a0fbe..ce30580 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 _0xc090=['update','remove','emit','hook','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x2f20e1,_0x9b9fad){var _0xc2a856=function(_0x1307a5){while(--_0x1307a5){_0x2f20e1['push'](_0x2f20e1['shift']());}};_0xc2a856(++_0x9b9fad);}(_0xc090,0x112));var _0x0c09=function(_0xa7597,_0x8edd65){_0xa7597=_0xa7597-0x0;var _0x25d273=_0xc090[_0xa7597];return _0x25d273;};'use strict';var EventEmitter=require(_0x0c09('0x0'));var ChatWebsite=require(_0x0c09('0x1'))['db'][_0x0c09('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0c09('0x3')](0x0);var events={'afterCreate':_0x0c09('0x4'),'afterUpdate':_0x0c09('0x5'),'afterDestroy':_0x0c09('0x6')};function emitEvent(_0x260c36){return function(_0x11984f,_0x487f03,_0x2e968b){ChatWebsiteEvents[_0x0c09('0x7')](_0x260c36+':'+_0x11984f['id'],_0x11984f);ChatWebsiteEvents['emit'](_0x260c36,_0x11984f);_0x2e968b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x0c09('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x4fde=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','update'];(function(_0x43afbb,_0x448109){var _0xa9ddec=function(_0x4e965f){while(--_0x4e965f){_0x43afbb['push'](_0x43afbb['shift']());}};_0xa9ddec(++_0x448109);}(_0x4fde,0x19f));var _0xe4fd=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x4fde[_0x5be7aa];return _0x215408;};'use strict';var EventEmitter=require(_0xe4fd('0x0'));var ChatWebsite=require(_0xe4fd('0x1'))['db'][_0xe4fd('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe4fd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe4fd('0x4'),'afterDestroy':_0xe4fd('0x5')};function emitEvent(_0x4bf61e){return function(_0x36d49f,_0x3c4c49,_0x8b810a){ChatWebsiteEvents[_0xe4fd('0x6')](_0x4bf61e+':'+_0x36d49f['id'],_0x36d49f);ChatWebsiteEvents[_0xe4fd('0x6')](_0x4bf61e,_0x36d49f);_0x8b810a(null);};}for(var e in events){if(events[_0xe4fd('0x7')](e)){var event=events[e];ChatWebsite[_0xe4fd('0x8')](e,emitEvent(event));}}module[_0xe4fd('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 2a41408..dd9a231 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 _0x3f68=['chat_websites','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','define'];(function(_0x223d84,_0x1db87b){var _0x3ae043=function(_0x3a78b7){while(--_0x3a78b7){_0x223d84['push'](_0x223d84['shift']());}};_0x3ae043(++_0x1db87b);}(_0x3f68,0x1d5));var _0x83f6=function(_0x4785fc,_0x216a89){_0x4785fc=_0x4785fc-0x0;var _0x363332=_0x3f68[_0x4785fc];return _0x363332;};'use strict';var _=require(_0x83f6('0x0'));var util=require(_0x83f6('0x1'));var logger=require('../../config/logger')(_0x83f6('0x2'));var moment=require(_0x83f6('0x3'));var BPromise=require(_0x83f6('0x4'));var rp=require(_0x83f6('0x5'));var fs=require('fs');var path=require(_0x83f6('0x6'));var rimraf=require(_0x83f6('0x7'));var config=require('../../config/environment');var attributes=require(_0x83f6('0x8'));module[_0x83f6('0x9')]=function(_0x5af2b1,_0xdaf088){return _0x5af2b1[_0x83f6('0xa')]('ChatWebsite',attributes,{'tableName':_0x83f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c65=['moment','bluebird','request-promise','rimraf','exports','define','ChatWebsite','lodash','util','../../config/logger'];(function(_0x4586f9,_0x39aee8){var _0x41d034=function(_0x31002c){while(--_0x31002c){_0x4586f9['push'](_0x4586f9['shift']());}};_0x41d034(++_0x39aee8);}(_0x5c65,0xb1));var _0x55c6=function(_0x528c42,_0x596eb4){_0x528c42=_0x528c42-0x0;var _0x607b50=_0x5c65[_0x528c42];return _0x607b50;};'use strict';var _=require(_0x55c6('0x0'));var util=require(_0x55c6('0x1'));var logger=require(_0x55c6('0x2'))('api');var moment=require(_0x55c6('0x3'));var BPromise=require(_0x55c6('0x4'));var rp=require(_0x55c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x55c6('0x6'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0x55c6('0x7')]=function(_0x5c01cf,_0x10a484){return _0x5c01cf[_0x55c6('0x8')](_0x55c6('0x9'),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 9c0c77c..adf0e0b 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 _0x459e=['info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request'];(function(_0x2593ea,_0xff1577){var _0x49e40e=function(_0x48607b){while(--_0x48607b){_0x2593ea['push'](_0x2593ea['shift']());}};_0x49e40e(++_0xff1577);}(_0x459e,0x183));var _0xe459=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x459e[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xe459('0x0'));var util=require(_0xe459('0x1'));var moment=require(_0xe459('0x2'));var BPromise=require(_0xe459('0x3'));var rs=require(_0xe459('0x4'));var fs=require('fs');var Redis=require(_0xe459('0x5'));var db=require(_0xe459('0x6'))['db'];var utils=require(_0xe459('0x7'));var logger=require(_0xe459('0x8'))('rpc');var config=require(_0xe459('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe459('0xa')][_0xe459('0xb')]({'port':0x232a});config[_0xe459('0xc')]=_[_0xe459('0xd')](config[_0xe459('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe459('0xe'))(new Redis(config[_0xe459('0xc')]));require(_0xe459('0xf'))[_0xe459('0x10')](socket);function respondWithRpcPromise(_0x55e5fe,_0x556927,_0x25f803){return new BPromise(function(_0x2f856c,_0x3bc3bc){return client[_0xe459('0x11')](_0x55e5fe,_0x25f803)['then'](function(_0x436759){logger[_0xe459('0x12')](_0xe459('0x13'),_0x556927,_0xe459('0x14'));logger[_0xe459('0x15')](_0xe459('0x16'),_0x556927,'request\x20sent',JSON[_0xe459('0x17')](_0x436759));if(_0x436759[_0xe459('0x18')]){if(_0x436759[_0xe459('0x18')][_0xe459('0x19')]===0x1f4){logger[_0xe459('0x18')](_0xe459('0x13'),_0x556927,_0x436759['error']['message']);return _0x3bc3bc(_0x436759['error'][_0xe459('0x1a')]);}logger[_0xe459('0x18')](_0xe459('0x13'),_0x556927,_0x436759['error'][_0xe459('0x1a')]);return _0x2f856c(_0x436759['error'][_0xe459('0x1a')]);}else{logger[_0xe459('0x12')](_0xe459('0x13'),_0x556927,_0xe459('0x14'));_0x2f856c(_0x436759['result'][_0xe459('0x1a')]);}})['catch'](function(_0x5d4b8d){logger[_0xe459('0x18')](_0xe459('0x13'),_0x556927,_0x5d4b8d);_0x3bc3bc(_0x5d4b8d);});});} \ No newline at end of file +var _0x581d=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch'];(function(_0xaf803f,_0x22b3f6){var _0x40669f=function(_0x57aa19){while(--_0x57aa19){_0xaf803f['push'](_0xaf803f['shift']());}};_0x40669f(++_0x22b3f6);}(_0x581d,0xa8));var _0xd581=function(_0x80a3c,_0x24c35a){_0x80a3c=_0x80a3c-0x0;var _0x41b3bf=_0x581d[_0x80a3c];return _0x41b3bf;};'use strict';var _=require(_0xd581('0x0'));var util=require(_0xd581('0x1'));var moment=require(_0xd581('0x2'));var BPromise=require(_0xd581('0x3'));var rs=require(_0xd581('0x4'));var fs=require('fs');var Redis=require(_0xd581('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd581('0x6'));var logger=require(_0xd581('0x7'))(_0xd581('0x8'));var config=require(_0xd581('0x9'));var jayson=require(_0xd581('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xd581('0xb')]=_[_0xd581('0xc')](config[_0xd581('0xb')],{'host':_0xd581('0xd'),'port':0x18eb});var socket=require(_0xd581('0xe'))(new Redis(config[_0xd581('0xb')]));require(_0xd581('0xf'))[_0xd581('0x10')](socket);function respondWithRpcPromise(_0x3f5fe5,_0xd3a3b4,_0x23497f){return new BPromise(function(_0x5dcc88,_0x2c5d9d){return client['request'](_0x3f5fe5,_0x23497f)[_0xd581('0x11')](function(_0x565ab8){logger['info'](_0xd581('0x12'),_0xd3a3b4,'request\x20sent');logger[_0xd581('0x13')](_0xd581('0x14'),_0xd3a3b4,_0xd581('0x15'),JSON[_0xd581('0x16')](_0x565ab8));if(_0x565ab8[_0xd581('0x17')]){if(_0x565ab8['error'][_0xd581('0x18')]===0x1f4){logger['error'](_0xd581('0x12'),_0xd3a3b4,_0x565ab8[_0xd581('0x17')]['message']);return _0x2c5d9d(_0x565ab8['error'][_0xd581('0x19')]);}logger['error'](_0xd581('0x12'),_0xd3a3b4,_0x565ab8[_0xd581('0x17')][_0xd581('0x19')]);return _0x5dcc88(_0x565ab8[_0xd581('0x17')][_0xd581('0x19')]);}else{logger[_0xd581('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0xd3a3b4,_0xd581('0x15'));_0x5dcc88(_0x565ab8['result'][_0xd581('0x19')]);}})[_0xd581('0x1b')](function(_0x217553){logger[_0xd581('0x17')]('ChatWebsite,\x20%s,\x20%s',_0xd3a3b4,_0x217553);_0x2c5d9d(_0x217553);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 2f516f3..b2392f5 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 _0xba6f=['./chatWebsite.events','save','emit','register','chatWebsite:'];(function(_0x1b49ba,_0x3533f7){var _0x490b2a=function(_0x54f4a1){while(--_0x54f4a1){_0x1b49ba['push'](_0x1b49ba['shift']());}};_0x490b2a(++_0x3533f7);}(_0xba6f,0x73));var _0xfba6=function(_0x51fd25,_0x2fcbb){_0x51fd25=_0x51fd25-0x0;var _0x4529ae=_0xba6f[_0x51fd25];return _0x4529ae;};'use strict';var ChatWebsiteEvents=require(_0xfba6('0x0'));var events=[_0xfba6('0x1'),'remove','update'];function createListener(_0x9e3004,_0x29d888){return function(_0x1ef3cd){_0x29d888[_0xfba6('0x2')](_0x9e3004,_0x1ef3cd);};}function removeListener(_0x54b38e,_0x401bb9){return function(){ChatWebsiteEvents['removeListener'](_0x54b38e,_0x401bb9);};}exports[_0xfba6('0x3')]=function(_0x5ad294){for(var _0x455a4d=0x0,_0x48463f=events['length'];_0x455a4d<_0x48463f;_0x455a4d++){var _0x2166c9=events[_0x455a4d];var _0x5a68cc=createListener(_0xfba6('0x4')+_0x2166c9,_0x5ad294);ChatWebsiteEvents['on'](_0x2166c9,_0x5a68cc);}}; \ No newline at end of file +var _0x4b05=['removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update','emit'];(function(_0x73f378,_0x550420){var _0x57db43=function(_0xdecd43){while(--_0xdecd43){_0x73f378['push'](_0x73f378['shift']());}};_0x57db43(++_0x550420);}(_0x4b05,0x1e1));var _0x54b0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4b05[_0x122ef9];return _0x42fba0;};'use strict';var ChatWebsiteEvents=require(_0x54b0('0x0'));var events=[_0x54b0('0x1'),_0x54b0('0x2'),_0x54b0('0x3')];function createListener(_0x6c4a55,_0x276028){return function(_0x2aabb7){_0x276028[_0x54b0('0x4')](_0x6c4a55,_0x2aabb7);};}function removeListener(_0x412cbd,_0xe8132e){return function(){ChatWebsiteEvents[_0x54b0('0x5')](_0x412cbd,_0xe8132e);};}exports[_0x54b0('0x6')]=function(_0x39b968){for(var _0x5cbae1=0x0,_0x332243=events[_0x54b0('0x7')];_0x5cbae1<_0x332243;_0x5cbae1++){var _0x1b6653=events[_0x5cbae1];var _0x5e72fd=createListener(_0x54b0('0x8')+_0x1b6653,_0x39b968);ChatWebsiteEvents['on'](_0x1b6653,_0x5e72fd);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index b255003..b969ae3 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 _0xef04=['../../components/interaction/service','isAuthenticated','index','/describe','describe','get','/:id','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/users','getAgents','post','create','/:id/dispositions','diskStorage','join','format','%s-%s','now','originalname','single','addLogo','root','file','addAvatar','addCustomerAvatar','server/files/images/avatars/','addSystemAvatar','notify','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xef04,0x111));var _0x4ef0=function(_0x38c121,_0x29c927){_0x38c121=_0x38c121-0x0;var _0x21c1f5=_0xef04[_0x38c121];return _0x21c1f5;};'use strict';var multer=require(_0x4ef0('0x0'));var util=require('util');var path=require(_0x4ef0('0x1'));var timeout=require(_0x4ef0('0x2'));var express=require(_0x4ef0('0x3'));var router=express[_0x4ef0('0x4')]();var fs_extra=require(_0x4ef0('0x5'));var auth=require(_0x4ef0('0x6'));var interaction=require(_0x4ef0('0x7'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x9')]);router['get'](_0x4ef0('0xa'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0xb')]);router[_0x4ef0('0xc')](_0x4ef0('0xd'),auth[_0x4ef0('0x8')](),controller['show']);router['get']('/:id/dispositions',auth[_0x4ef0('0x8')](),controller['getDispositions']);router[_0x4ef0('0xc')](_0x4ef0('0xe'),auth['isAuthenticated'](),controller[_0x4ef0('0xf')]);router['get'](_0x4ef0('0x10'),controller[_0x4ef0('0x11')]);router[_0x4ef0('0xc')](_0x4ef0('0x12'),controller[_0x4ef0('0x13')]);router['get'](_0x4ef0('0x14'),controller[_0x4ef0('0x15')]);router[_0x4ef0('0xc')](_0x4ef0('0x16'),controller['getSystemAvatar']);router[_0x4ef0('0xc')](_0x4ef0('0x17'),auth[_0x4ef0('0x8')](),controller['getInteractions']);router[_0x4ef0('0xc')](_0x4ef0('0x18'),controller['getSnippet']);router[_0x4ef0('0xc')]('/:id/applications',auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x19')]);router[_0x4ef0('0xc')](_0x4ef0('0x1a'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x1b')]);router[_0x4ef0('0xc')](_0x4ef0('0x1c'),controller[_0x4ef0('0x1d')]);router['get']('/:id/offline_messages',auth[_0x4ef0('0x8')](),controller['getOfflineMessages']);router[_0x4ef0('0xc')](_0x4ef0('0x1e'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x1f')]);router[_0x4ef0('0x20')]('/',auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x21')]);router['post'](_0x4ef0('0x22'),auth[_0x4ef0('0x8')](),controller['addDisposition']);router[_0x4ef0('0x20')](_0x4ef0('0xe'),auth[_0x4ef0('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x4ef0('0x23')]({'destination':function(_0x2a6333,_0x561e51,_0x39f5b2){_0x39f5b2(null,path[_0x4ef0('0x24')](config['root'],'server/files/images/logos/'));},'filename':function(_0x5f5cf5,_0xcfefe5,_0x518299){_0x518299(null,util[_0x4ef0('0x25')](_0x4ef0('0x26'),Date[_0x4ef0('0x27')](),_0xcfefe5[_0x4ef0('0x28')]));}})});router[_0x4ef0('0x20')](_0x4ef0('0x10'),upload[_0x4ef0('0x29')]('file'),controller[_0x4ef0('0x2a')]);var upload=multer({'storage':multer[_0x4ef0('0x23')]({'destination':function(_0x1132a8,_0x272497,_0x1b66b2){_0x1b66b2(null,path['join'](config[_0x4ef0('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x4445bf,_0x513d6b,_0x1fe5ca){_0x1fe5ca(null,util[_0x4ef0('0x25')](_0x4ef0('0x26'),Date[_0x4ef0('0x27')](),_0x513d6b[_0x4ef0('0x28')]));}})});router[_0x4ef0('0x20')]('/:id/avatar',upload[_0x4ef0('0x29')](_0x4ef0('0x2c')),controller[_0x4ef0('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x9e2798,_0x472395,_0x41fbeb){_0x41fbeb(null,path[_0x4ef0('0x24')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x1f722b,_0x429c58,_0x3a6d9e){_0x3a6d9e(null,util[_0x4ef0('0x25')](_0x4ef0('0x26'),Date[_0x4ef0('0x27')](),_0x429c58[_0x4ef0('0x28')]));}})});router[_0x4ef0('0x20')](_0x4ef0('0x14'),upload[_0x4ef0('0x29')](_0x4ef0('0x2c')),controller[_0x4ef0('0x2e')]);var upload=multer({'storage':multer[_0x4ef0('0x23')]({'destination':function(_0x1c811e,_0x412da5,_0x3f9b8a){_0x3f9b8a(null,path[_0x4ef0('0x24')](config[_0x4ef0('0x2b')],_0x4ef0('0x2f')));},'filename':function(_0x4529d3,_0x1e73fe,_0x318b55){_0x318b55(null,util['format'](_0x4ef0('0x26'),Date['now'](),_0x1e73fe[_0x4ef0('0x28')]));}})});router[_0x4ef0('0x20')](_0x4ef0('0x16'),upload[_0x4ef0('0x29')](_0x4ef0('0x2c')),controller[_0x4ef0('0x30')]);router['post']('/:id/notify',controller[_0x4ef0('0x31')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x1c6a7b,_0x25bf8a,_0x591773){const _0x164f38=path[_0x4ef0('0x24')](config[_0x4ef0('0x2b')],'server/files','attachments',_0x4ef0('0x32'));fs_extra[_0x4ef0('0x33')](_0x164f38,function(){_0x591773(null,_0x164f38);});},'filename':function(_0x5a7a2c,_0xfa322c,_0x42fc50){const _0x32c42f=_0xfa322c[_0x4ef0('0x28')][_0x4ef0('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x30c468=path[_0x4ef0('0x35')](_0x32c42f);const _0x2a1d1c=Date[_0x4ef0('0x27')]()+'-'+_0x32c42f[_0x4ef0('0x34')](_0x30c468,'')+_0x30c468;_0x42fc50(null,_0x2a1d1c);}})});router[_0x4ef0('0x20')](_0x4ef0('0x36'),offlineUploadMulter[_0x4ef0('0x37')](),controller[_0x4ef0('0x38')]);router[_0x4ef0('0x20')](_0x4ef0('0x17'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x39')]);router['post'](_0x4ef0('0x3a'),auth['isAuthenticated'](),controller[_0x4ef0('0x3b')]);router[_0x4ef0('0x20')](_0x4ef0('0x1a'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x3c')]);router['post'](_0x4ef0('0x1e'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x3d')]);router[_0x4ef0('0x3e')]('/:id',auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x3f')]);router['delete'](_0x4ef0('0xd'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x40')]);router[_0x4ef0('0x41')](_0x4ef0('0x22'),auth['isAuthenticated'](),controller[_0x4ef0('0x42')]);router['delete'](_0x4ef0('0xe'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x43')]);router[_0x4ef0('0x41')](_0x4ef0('0x1e'),auth[_0x4ef0('0x8')](),controller[_0x4ef0('0x44')]);module[_0x4ef0('0x45')]=router; \ No newline at end of file +var _0x8167=['file','addLogo','server/files/images/avatars/','single','addAvatar','format','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any','offline','/:id/interactions','addInteraction','addApplications','/:id/proactive_actions','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getFields','/:id/offline_messages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','now','originalname','/:id/logo'];(function(_0x573f5b,_0x3b1368){var _0x4118ca=function(_0x3b5600){while(--_0x3b5600){_0x573f5b['push'](_0x573f5b['shift']());}};_0x4118ca(++_0x3b1368);}(_0x8167,0x136));var _0x7816=function(_0x2c6106,_0x24820c){_0x2c6106=_0x2c6106-0x0;var _0x446d8a=_0x8167[_0x2c6106];return _0x446d8a;};'use strict';var multer=require(_0x7816('0x0'));var util=require(_0x7816('0x1'));var path=require(_0x7816('0x2'));var timeout=require(_0x7816('0x3'));var express=require(_0x7816('0x4'));var router=express[_0x7816('0x5')]();var fs_extra=require(_0x7816('0x6'));var auth=require(_0x7816('0x7'));var interaction=require(_0x7816('0x8'));var config=require(_0x7816('0x9'));var controller=require('./chatWebsite.controller');router[_0x7816('0xa')]('/',auth['isAuthenticated'](),controller[_0x7816('0xb')]);router[_0x7816('0xa')](_0x7816('0xc'),auth['isAuthenticated'](),controller[_0x7816('0xd')]);router['get'](_0x7816('0xe'),auth[_0x7816('0xf')](),controller['show']);router[_0x7816('0xa')](_0x7816('0x10'),auth[_0x7816('0xf')](),controller[_0x7816('0x11')]);router[_0x7816('0xa')](_0x7816('0x12'),auth[_0x7816('0xf')](),controller['getAnswers']);router[_0x7816('0xa')]('/:id/logo',controller['getLogo']);router[_0x7816('0xa')](_0x7816('0x13'),controller['getAvatar']);router[_0x7816('0xa')](_0x7816('0x14'),controller[_0x7816('0x15')]);router[_0x7816('0xa')](_0x7816('0x16'),controller[_0x7816('0x17')]);router[_0x7816('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x7816('0x18')]);router[_0x7816('0xa')](_0x7816('0x19'),controller[_0x7816('0x1a')]);router[_0x7816('0xa')](_0x7816('0x1b'),auth[_0x7816('0xf')](),controller[_0x7816('0x1c')]);router[_0x7816('0xa')]('/:id/proactive_actions',auth[_0x7816('0xf')](),controller[_0x7816('0x1d')]);router[_0x7816('0xa')]('/:id/fields',controller[_0x7816('0x1e')]);router[_0x7816('0xa')](_0x7816('0x1f'),auth[_0x7816('0xf')](),controller['getOfflineMessages']);router[_0x7816('0xa')](_0x7816('0x20'),auth['isAuthenticated'](),controller['getAgents']);router[_0x7816('0x21')]('/',auth['isAuthenticated'](),controller[_0x7816('0x22')]);router[_0x7816('0x21')](_0x7816('0x10'),auth[_0x7816('0xf')](),controller[_0x7816('0x23')]);router['post']('/:id/canned_answers',auth[_0x7816('0xf')](),controller[_0x7816('0x24')]);var upload=multer({'storage':multer[_0x7816('0x25')]({'destination':function(_0x70beb2,_0x5a9bc2,_0x44ef7e){_0x44ef7e(null,path[_0x7816('0x26')](config[_0x7816('0x27')],_0x7816('0x28')));},'filename':function(_0x38df7b,_0xf01f0,_0x1b7439){_0x1b7439(null,util['format'](_0x7816('0x29'),Date[_0x7816('0x2a')](),_0xf01f0[_0x7816('0x2b')]));}})});router['post'](_0x7816('0x2c'),upload['single'](_0x7816('0x2d')),controller[_0x7816('0x2e')]);var upload=multer({'storage':multer[_0x7816('0x25')]({'destination':function(_0x4562b5,_0x2c2774,_0xfbcb99){_0xfbcb99(null,path[_0x7816('0x26')](config['root'],_0x7816('0x2f')));},'filename':function(_0x1b1d6d,_0xf43d41,_0x255742){_0x255742(null,util['format'](_0x7816('0x29'),Date['now'](),_0xf43d41[_0x7816('0x2b')]));}})});router['post']('/:id/avatar',upload[_0x7816('0x30')](_0x7816('0x2d')),controller[_0x7816('0x31')]);var upload=multer({'storage':multer[_0x7816('0x25')]({'destination':function(_0x449a77,_0x278074,_0x444102){_0x444102(null,path[_0x7816('0x26')](config['root'],_0x7816('0x2f')));},'filename':function(_0x539739,_0x2aab88,_0xeea89f){_0xeea89f(null,util[_0x7816('0x32')](_0x7816('0x29'),Date[_0x7816('0x2a')](),_0x2aab88['originalname']));}})});router[_0x7816('0x21')]('/:id/customer_avatar',upload[_0x7816('0x30')](_0x7816('0x2d')),controller[_0x7816('0x33')]);var upload=multer({'storage':multer[_0x7816('0x25')]({'destination':function(_0x490b22,_0x972218,_0x2f5363){_0x2f5363(null,path[_0x7816('0x26')](config[_0x7816('0x27')],'server/files/images/avatars/'));},'filename':function(_0x37c8c8,_0x48b7f5,_0x415f46){_0x415f46(null,util[_0x7816('0x32')](_0x7816('0x29'),Date[_0x7816('0x2a')](),_0x48b7f5[_0x7816('0x2b')]));}})});router[_0x7816('0x21')]('/:id/system_avatar',upload[_0x7816('0x30')](_0x7816('0x2d')),controller[_0x7816('0x34')]);router[_0x7816('0x21')]('/:id/notify',controller[_0x7816('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x7816('0x25')]({'destination':function(_0x438b6a,_0xfd2dab,_0x289927){const _0x48a6d9=path[_0x7816('0x26')](config[_0x7816('0x27')],_0x7816('0x36'),_0x7816('0x37'),_0x7816('0x38'));fs_extra[_0x7816('0x39')](_0x48a6d9,function(){_0x289927(null,_0x48a6d9);});},'filename':function(_0x30fdc9,_0xabc22,_0x2d2f7f){const _0x872740=_0xabc22[_0x7816('0x2b')][_0x7816('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5a1a74=path['extname'](_0x872740);const _0x58e3b8=Date[_0x7816('0x2a')]()+'-'+_0x872740[_0x7816('0x3a')](_0x5a1a74,'')+_0x5a1a74;_0x2d2f7f(null,_0x58e3b8);}})});router[_0x7816('0x21')](_0x7816('0x3b'),offlineUploadMulter[_0x7816('0x3c')](),controller[_0x7816('0x3d')]);router['post'](_0x7816('0x3e'),auth['isAuthenticated'](),controller[_0x7816('0x3f')]);router['post'](_0x7816('0x1b'),auth[_0x7816('0xf')](),controller[_0x7816('0x40')]);router['post'](_0x7816('0x41'),auth[_0x7816('0xf')](),controller['addProactiveActions']);router[_0x7816('0x21')](_0x7816('0x20'),auth[_0x7816('0xf')](),controller['addAgents']);router['put'](_0x7816('0xe'),auth[_0x7816('0xf')](),controller[_0x7816('0x42')]);router[_0x7816('0x43')](_0x7816('0xe'),auth[_0x7816('0xf')](),controller[_0x7816('0x44')]);router[_0x7816('0x43')]('/:id/dispositions',auth[_0x7816('0xf')](),controller[_0x7816('0x45')]);router[_0x7816('0x43')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x7816('0x43')](_0x7816('0x20'),auth[_0x7816('0xf')](),controller['removeAgents']);module[_0x7816('0x46')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 1ffa29e..10530f9 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 _0x30d3=['isAuthenticated','exports','beaver-logger/server','express','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use'];(function(_0x5bd688,_0x182339){var _0xa84424=function(_0xc9fbb4){while(--_0xc9fbb4){_0x5bd688['push'](_0x5bd688['shift']());}};_0xa84424(++_0x182339);}(_0x30d3,0xc6));var _0x330d=function(_0x6c7031,_0x434dbf){_0x6c7031=_0x6c7031-0x0;var _0xc677f6=_0x30d3[_0x6c7031];return _0xc677f6;};var beaverLogger=require(_0x330d('0x0'));var express=require(_0x330d('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x330d('0x2')]();var isProduction=config[_0x330d('0x3')]===_0x330d('0x4')||![];function clientSideLogs(_0x2f7591,_0x17ed29,_0x480612){var _0x4a5a34=_0x2f7591[_0x330d('0x5')][_0x330d('0x6')](_0x330d('0x7'));if(!_0x4a5a34){throw new Error(_0x330d('0x8'));}return beaverLogger[_0x330d('0x9')]({'uri':_0x330d('0xa'),'logger':_0x4a5a34,'enableCors':!isProduction})(_0x2f7591,_0x17ed29,_0x480612);}router[_0x330d('0xb')](auth[_0x330d('0xc')](),clientSideLogs);module[_0x330d('0xd')]=router; \ No newline at end of file +var _0x0e6c=['production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x0e6c,0x13c));var _0xc0e6=function(_0x41200c,_0x195027){_0x41200c=_0x41200c-0x0;var _0x2a4cf4=_0x0e6c[_0x41200c];return _0x2a4cf4;};var beaverLogger=require(_0xc0e6('0x0'));var express=require(_0xc0e6('0x1'));var auth=require(_0xc0e6('0x2'));var config=require(_0xc0e6('0x3'));var router=express[_0xc0e6('0x4')]();var isProduction=config[_0xc0e6('0x5')]===_0xc0e6('0x6')||![];function clientSideLogs(_0x1f2f55,_0x2a5999,_0xede790){var _0x41af34=_0x1f2f55[_0xc0e6('0x7')][_0xc0e6('0x8')](_0xc0e6('0x9'));if(!_0x41af34){throw new Error(_0xc0e6('0xa'));}return beaverLogger[_0xc0e6('0xb')]({'uri':_0xc0e6('0xc'),'logger':_0x41af34,'enableCors':!isProduction})(_0x1f2f55,_0x2a5999,_0xede790);}router[_0xc0e6('0xd')](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 21ac330..836c356 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 _0x1f37=['Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','ENUM','Google','MicrosoftAzure'];(function(_0x58a994,_0x2e1bcf){var _0x40a74c=function(_0xd5e396){while(--_0xd5e396){_0x58a994['push'](_0x58a994['shift']());}};_0x40a74c(++_0x2e1bcf);}(_0x1f37,0x1d8));var _0x71f3=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x1f37[_0x4394b6];return _0x360244;};'use strict';var Sequelize=require('sequelize');module[_0x71f3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x71f3('0x1')]('AmazonAWS',_0x71f3('0x2'),_0x71f3('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x71f3('0x1')](_0x71f3('0x4'),_0x71f3('0x5'))},'data1':{'type':Sequelize[_0x71f3('0x6')],'comment':_0x71f3('0x7')},'data2':{'type':Sequelize['STRING'],'comment':_0x71f3('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0x71f3('0x9')},'data4':{'type':Sequelize[_0x71f3('0x6')],'comment':_0x71f3('0xa')},'data5':{'type':Sequelize[_0x71f3('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize['TEXT'],'comment':_0x71f3('0xc')},'data7':{'type':Sequelize[_0x71f3('0xb')],'comment':_0x71f3('0xd')}}; \ No newline at end of file +var _0x5d9e=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x4eaad4,_0x5e4a95){var _0x1527f9=function(_0x487873){while(--_0x487873){_0x4eaad4['push'](_0x4eaad4['shift']());}};_0x1527f9(++_0x5e4a95);}(_0x5d9e,0x199));var _0xe5d9=function(_0x37b1d2,_0x59b821){_0x37b1d2=_0x37b1d2-0x0;var _0x5ce1bb=_0x5d9e[_0x37b1d2];return _0x5ce1bb;};'use strict';var Sequelize=require(_0xe5d9('0x0'));module[_0xe5d9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe5d9('0x2')](_0xe5d9('0x3'),_0xe5d9('0x4'),_0xe5d9('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe5d9('0x2')](_0xe5d9('0x6'),_0xe5d9('0x7'))},'data1':{'type':Sequelize[_0xe5d9('0x8')],'comment':_0xe5d9('0x9')},'data2':{'type':Sequelize[_0xe5d9('0x8')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xe5d9('0x8')],'comment':_0xe5d9('0xa')},'data4':{'type':Sequelize['STRING'],'comment':_0xe5d9('0xb')},'data5':{'type':Sequelize[_0xe5d9('0xc')],'comment':_0xe5d9('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xe5d9('0xc')],'comment':_0xe5d9('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 04bde99..9ba196d 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 _0x3ae0=['json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','sendStatus','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','params','length','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','find','encryptString','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','get','parse','from','state','base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','ioredis','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','status'];(function(_0x34ae7e,_0x1e8cdd){var _0x2a5324=function(_0x4f1dfc){while(--_0x4f1dfc){_0x34ae7e['push'](_0x34ae7e['shift']());}};_0x2a5324(++_0x1e8cdd);}(_0x3ae0,0x110));var _0x03ae=function(_0x57349e,_0x34c1c1){_0x57349e=_0x57349e-0x0;var _0x2a2671=_0x3ae0[_0x57349e];return _0x2a2671;};'use strict';var _=require(_0x03ae('0x0'));var Redis=require(_0x03ae('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x03ae('0x2'))(_0x03ae('0x3'));var db=require(_0x03ae('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config['redis']=_[_0x03ae('0x5')](config[_0x03ae('0x6')],{'host':_0x03ae('0x7'),'port':0x18eb});var socket=require(_0x03ae('0x8'))(new Redis(config[_0x03ae('0x6')]));var redis=new Redis(config[_0x03ae('0x6')]);function respondWithStatusCode(_0x3a64fc,_0x1aa2a0){_0x1aa2a0=_0x1aa2a0||0xcc;return function(_0x2d2093){if(_0x2d2093){return _0x3a64fc['sendStatus'](_0x1aa2a0);}return _0x3a64fc[_0x03ae('0x9')](_0x1aa2a0)['end']();};}function respondWithResult(_0x51ee33,_0x2c327f){_0x2c327f=_0x2c327f||0xc8;return function(_0x53f7bc){if(_0x53f7bc){return _0x51ee33[_0x03ae('0x9')](_0x2c327f)[_0x03ae('0xa')](_0x53f7bc);}};}function respondWithFilteredResult(_0x5a2aa8,_0x2d87c0){return function(_0x43c660){if(_0x43c660){var _0x2d0517=typeof _0x2d87c0['offset']===_0x03ae('0xb')&&typeof _0x2d87c0[_0x03ae('0xc')]==='undefined';var _0x549c2a=_0x43c660[_0x03ae('0xd')];var _0x21682e=_0x2d0517?0x0:_0x2d87c0[_0x03ae('0xe')];var _0x403a8a=_0x2d0517?_0x43c660['count']:_0x2d87c0[_0x03ae('0xe')]+_0x2d87c0[_0x03ae('0xc')];var _0x541da5;if(_0x403a8a>=_0x549c2a){_0x403a8a=_0x549c2a;_0x541da5=0xc8;}else{_0x541da5=0xce;}_0x5a2aa8['status'](_0x541da5);return _0x5a2aa8[_0x03ae('0xf')](_0x03ae('0x10'),_0x21682e+'-'+_0x403a8a+'/'+_0x549c2a)[_0x03ae('0xa')](_0x43c660);}return null;};}function saveUpdates(_0x371aa2){return function(_0x596f5b){if(_0x596f5b){return _0x596f5b[_0x03ae('0x11')](_0x371aa2)[_0x03ae('0x12')](function(_0x2c81f){return _0x2c81f;});}return null;};}function removeEntity(_0x2cdb86){return function(_0x54f93a){if(_0x54f93a){return _0x54f93a[_0x03ae('0x13')]()[_0x03ae('0x12')](function(){_0x2cdb86[_0x03ae('0x9')](0xcc)[_0x03ae('0x14')]();});}};}function handleEntityNotFound(_0x2b3643){return function(_0x2cf171){if(!_0x2cf171){_0x2b3643[_0x03ae('0x15')](0x194);}return _0x2cf171;};}function handleError(_0xa8c24f,_0x43a149){_0x43a149=_0x43a149||0x1f4;return function(_0x509b0e){logger[_0x03ae('0x16')](_0x509b0e['stack']);if(_0x509b0e[_0x03ae('0x17')]){delete _0x509b0e[_0x03ae('0x17')];}_0xa8c24f[_0x03ae('0x9')](_0x43a149)[_0x03ae('0x18')](_0x509b0e);};}function maskClientSecret(_0x5674f9){return _[_0x03ae('0x19')](_0x5674f9[_0x03ae('0x1a')](0x0,0x3),0x14,'*');}exports[_0x03ae('0x1b')]=function(_0x560dbd,_0x78e833){var _0x126ba7={},_0x342eda={},_0x9c832b={'count':0x0,'rows':[]};var _0x28c9fb=_[_0x03ae('0x1c')](db[_0x03ae('0x1d')][_0x03ae('0x1e')],function(_0x527c7d){return{'name':_0x527c7d['fieldName'],'type':_0x527c7d[_0x03ae('0x1f')][_0x03ae('0x20')]};});_0x342eda[_0x03ae('0x21')]=_[_0x03ae('0x1c')](_0x28c9fb,_0x03ae('0x17'));_0x342eda[_0x03ae('0x22')]=_[_0x03ae('0x23')](_0x560dbd[_0x03ae('0x22')]);_0x342eda[_0x03ae('0x24')]=_[_0x03ae('0x25')](_0x342eda[_0x03ae('0x21')],_0x342eda['query']);_0x126ba7[_0x03ae('0x26')]=_[_0x03ae('0x25')](_0x342eda['model'],qs[_0x03ae('0x27')](_0x560dbd[_0x03ae('0x22')]['fields']));_0x126ba7['attributes']=_0x126ba7[_0x03ae('0x26')]['length']?_0x126ba7['attributes']:_0x342eda['model'];if(!_0x560dbd[_0x03ae('0x22')]['hasOwnProperty'](_0x03ae('0x28'))){_0x126ba7[_0x03ae('0xc')]=qs[_0x03ae('0xc')](_0x560dbd[_0x03ae('0x22')][_0x03ae('0xc')]);_0x126ba7[_0x03ae('0xe')]=qs['offset'](_0x560dbd[_0x03ae('0x22')][_0x03ae('0xe')]);}_0x126ba7[_0x03ae('0x29')]=qs[_0x03ae('0x2a')](_0x560dbd[_0x03ae('0x22')]['sort']);_0x126ba7[_0x03ae('0x2b')]=qs[_0x03ae('0x24')](_[_0x03ae('0x2c')](_0x560dbd[_0x03ae('0x22')],_0x342eda[_0x03ae('0x24')]),_0x28c9fb);if(_0x560dbd[_0x03ae('0x22')]['filter']){_0x126ba7['where']=_[_0x03ae('0x2d')](_0x126ba7[_0x03ae('0x2b')],{'$or':_['map'](_0x28c9fb,function(_0x554c95){if(_0x554c95[_0x03ae('0x1f')]!==_0x03ae('0x2e')){var _0x21333d={};_0x21333d[_0x554c95[_0x03ae('0x17')]]={'$like':'%'+_0x560dbd[_0x03ae('0x22')][_0x03ae('0x2f')]+'%'};return _0x21333d;}})});}_0x126ba7=_['merge']({},_0x126ba7,_0x560dbd[_0x03ae('0x30')]);var _0x528c3a={'where':_0x126ba7[_0x03ae('0x2b')]};return db[_0x03ae('0x1d')]['count'](_0x528c3a)[_0x03ae('0x12')](function(_0x394e58){_0x9c832b[_0x03ae('0xd')]=_0x394e58;if(_0x560dbd[_0x03ae('0x22')][_0x03ae('0x31')]){_0x126ba7[_0x03ae('0x32')]=[{'all':!![]}];}return db[_0x03ae('0x1d')][_0x03ae('0x33')](_0x126ba7);})[_0x03ae('0x12')](function(_0x6f4c34){_0x9c832b[_0x03ae('0x34')]=_[_0x03ae('0x1c')](_0x6f4c34,function(_0x1c5bb8){if(_0x1c5bb8[_0x03ae('0x35')]===_0x03ae('0x36')){var _0x4b85fc=encryptor[_0x03ae('0x37')](_0x1c5bb8[_0x03ae('0x38')]);_0x1c5bb8[_0x03ae('0x38')]=maskClientSecret(_0x4b85fc);}return _0x1c5bb8;});return _0x9c832b;})[_0x03ae('0x12')](respondWithFilteredResult(_0x78e833,_0x126ba7))[_0x03ae('0x39')](handleError(_0x78e833,null));};exports['show']=function(_0x52db40,_0x29c6be){var _0x5d07da={'raw':!![],'where':{'id':_0x52db40[_0x03ae('0x3a')]['id']}},_0x184d38={};_0x184d38['model']=_[_0x03ae('0x23')](db[_0x03ae('0x1d')][_0x03ae('0x1e')]);_0x184d38['query']=_[_0x03ae('0x23')](_0x52db40[_0x03ae('0x22')]);_0x184d38[_0x03ae('0x24')]=_['intersection'](_0x184d38['model'],_0x184d38[_0x03ae('0x22')]);_0x5d07da[_0x03ae('0x26')]=_[_0x03ae('0x25')](_0x184d38['model'],qs[_0x03ae('0x27')](_0x52db40[_0x03ae('0x22')][_0x03ae('0x27')]));_0x5d07da[_0x03ae('0x26')]=_0x5d07da[_0x03ae('0x26')][_0x03ae('0x3b')]?_0x5d07da['attributes']:_0x184d38['model'];if(_0x52db40[_0x03ae('0x22')][_0x03ae('0x31')]){_0x5d07da['include']=[{'all':!![]}];}_0x5d07da=_[_0x03ae('0x2d')]({},_0x5d07da,_0x52db40[_0x03ae('0x30')]);return db['CloudProvider']['find'](_0x5d07da)[_0x03ae('0x12')](handleEntityNotFound(_0x29c6be,null))[_0x03ae('0x12')](function(_0x15787b){if(_0x15787b[_0x03ae('0x35')]===_0x03ae('0x36')){var _0x3e65dc=encryptor[_0x03ae('0x37')](_0x15787b[_0x03ae('0x38')]);_0x15787b[_0x03ae('0x38')]=maskClientSecret(_0x3e65dc);}return _0x15787b;})[_0x03ae('0x12')](respondWithResult(_0x29c6be,null))[_0x03ae('0x39')](handleError(_0x29c6be,null));};exports[_0x03ae('0x3c')]=function(_0x2a72ef,_0x388220){if(!_0x2a72ef['body']['name'])throw new Error(_0x03ae('0x3d'));if(!_0x2a72ef[_0x03ae('0x3e')][_0x03ae('0x35')])throw new Error(_0x03ae('0x3f'));var _0x594031=db['CloudProvider'][_0x03ae('0x1e')]['service'][_0x03ae('0x40')];if(!_0x594031['includes'](_0x2a72ef[_0x03ae('0x3e')][_0x03ae('0x35')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x594031['join'](',\x20'));if(_0x2a72ef[_0x03ae('0x3e')][_0x03ae('0x35')]==='MicrosoftAzure'&&_0x2a72ef['body'][_0x03ae('0x38')]){_0x2a72ef['body'][_0x03ae('0x38')]=encryptor['encryptString'](_0x2a72ef[_0x03ae('0x3e')][_0x03ae('0x38')]);}return db[_0x03ae('0x1d')][_0x03ae('0x3c')](_0x2a72ef['body'],{})['then'](respondWithResult(_0x388220,0xc9))[_0x03ae('0x39')](handleError(_0x388220,null));};exports[_0x03ae('0x11')]=function(_0x5cc266,_0x55463c){if(_0x5cc266[_0x03ae('0x3e')]['id']){delete _0x5cc266[_0x03ae('0x3e')]['id'];}return db[_0x03ae('0x1d')][_0x03ae('0x41')]({'where':{'id':_0x5cc266[_0x03ae('0x3a')]['id']}})['then'](handleEntityNotFound(_0x55463c,null))[_0x03ae('0x12')](function(_0xbca63d){if(_0xbca63d[_0x03ae('0x35')]===_0x03ae('0x36')&&_0x5cc266[_0x03ae('0x3e')]['data3']){_0x5cc266['body'][_0x03ae('0x38')]=encryptor[_0x03ae('0x42')](_0x5cc266[_0x03ae('0x3e')][_0x03ae('0x38')]);}return _0xbca63d;})[_0x03ae('0x12')](saveUpdates(_0x5cc266['body'],null))['then'](respondWithResult(_0x55463c,null))[_0x03ae('0x39')](handleError(_0x55463c,null));};exports[_0x03ae('0x13')]=function(_0x3d5eb7,_0x5e987f){return db[_0x03ae('0x1d')]['find']({'where':{'id':_0x3d5eb7[_0x03ae('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5e987f,null))['then'](removeEntity(_0x5e987f,null))[_0x03ae('0x39')](handleError(_0x5e987f,null));};exports[_0x03ae('0x43')]=function(_0x35ae87,_0x34151f){return db[_0x03ae('0x1d')][_0x03ae('0x44')]({'where':{'id':_0x35ae87[_0x03ae('0x3a')]['id']},'raw':!![]})[_0x03ae('0x12')](function(_0x51f4c0){if(!_0x51f4c0)return _0x34151f[_0x03ae('0x15')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x51f4c0,_0x35ae87[_0x03ae('0x45')]['id'])};})['then'](respondWithResult(_0x34151f,null))[_0x03ae('0x39')](handleError(_0x34151f,null));};exports[_0x03ae('0x46')]=function(_0x1b2139,_0x564a1c){var _0x4cadb9=_0x1b2139[_0x03ae('0x3e')];var _0x32188d;var _0x1ea4b8;if(_0x4cadb9[_0x03ae('0x16')])throw _0x4cadb9;redis[_0x03ae('0x47')](_0x4cadb9['state'])['then'](function(_0x38ffbb){if(!_0x38ffbb)throw new Error('Invalid\x20state\x20parameter');_0x32188d=JSON[_0x03ae('0x48')](_0x38ffbb);var _0x467f4a=Buffer[_0x03ae('0x49')](_0x4cadb9[_0x03ae('0x4a')],_0x03ae('0x4b'))[_0x03ae('0x4c')](_0x03ae('0x4d'));_0x1ea4b8=JSON['parse'](_0x467f4a);if(!oauth[_0x03ae('0x4e')](_0x4cadb9['id_token'],_0x32188d[_0x03ae('0x4f')]))throw new Error(_0x03ae('0x50'));redis[_0x03ae('0x51')](_0x4cadb9['state']);return oauth[_0x03ae('0x52')](_0x4cadb9[_0x03ae('0x53')],_0x32188d);})['then'](function(_0x49b5e5){_0x32188d[_0x03ae('0x54')]=_0x49b5e5['access_token'];_0x32188d[_0x03ae('0x55')]=_0x49b5e5[_0x03ae('0x56')];return db[_0x03ae('0x1d')][_0x03ae('0x11')]({'data5':_0x32188d[_0x03ae('0x54')],'data6':_0x32188d[_0x03ae('0x55')]},{'where':{'id':_0x32188d['id']}});})['then'](function(){oauth[_0x03ae('0x57')](_0x32188d);socket[_0x03ae('0x58')](_0x03ae('0x59'),{'id':_0x1ea4b8['id']});return;})[_0x03ae('0x12')](respondWithStatusCode(_0x564a1c,null))['catch'](function(_0x14f1cf){if(_0x1ea4b8){socket['emit'](_0x03ae('0x5a'),{'id':_0x1ea4b8['id']});}if(!_0x32188d){logger[_0x03ae('0x16')](_0x03ae('0x5b'),_0x14f1cf);return _0x564a1c['status'](0x1f4)[_0x03ae('0x18')](_0x14f1cf[_0x03ae('0x5c')]);}logger[_0x03ae('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x32188d['id'],JSON[_0x03ae('0x5d')](_0x14f1cf));});}; \ No newline at end of file +var _0xc5d6=['update','then','destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','fieldName','type','key','query','filters','attributes','model','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','MicrosoftAzure','data3','show','params','keys','intersection','fields','service','decryptString','create','Service\x20parameter\x20not\x20specified','rawAttributes','values','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','catch','find','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','ioredis','../../components/encryptor','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0xc5d6,0x10b));var _0x6c5d=function(_0x351a4c,_0x2c7ac7){_0x351a4c=_0x351a4c-0x0;var _0x4ab784=_0xc5d6[_0x351a4c];return _0x4ab784;};'use strict';var _=require('lodash');var Redis=require(_0x6c5d('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x6c5d('0x1'));var config=require('../../config/environment');var logger=require(_0x6c5d('0x2'))(_0x6c5d('0x3'));var db=require(_0x6c5d('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x6c5d('0x5')]=_[_0x6c5d('0x6')](config['redis'],{'host':_0x6c5d('0x7'),'port':0x18eb});var socket=require(_0x6c5d('0x8'))(new Redis(config[_0x6c5d('0x5')]));var redis=new Redis(config[_0x6c5d('0x5')]);function respondWithStatusCode(_0x2b47cf,_0x594cc6){_0x594cc6=_0x594cc6||0xcc;return function(_0x529106){if(_0x529106){return _0x2b47cf[_0x6c5d('0x9')](_0x594cc6);}return _0x2b47cf[_0x6c5d('0xa')](_0x594cc6)['end']();};}function respondWithResult(_0x436d8c,_0x4b23f8){_0x4b23f8=_0x4b23f8||0xc8;return function(_0x2dfcda){if(_0x2dfcda){return _0x436d8c[_0x6c5d('0xa')](_0x4b23f8)['json'](_0x2dfcda);}};}function respondWithFilteredResult(_0x445253,_0x365ba5){return function(_0x2b9761){if(_0x2b9761){var _0x5a8791=typeof _0x365ba5['offset']===_0x6c5d('0xb')&&typeof _0x365ba5[_0x6c5d('0xc')]===_0x6c5d('0xb');var _0x32aef5=_0x2b9761[_0x6c5d('0xd')];var _0x3bc8cd=_0x5a8791?0x0:_0x365ba5['offset'];var _0x59b31a=_0x5a8791?_0x2b9761[_0x6c5d('0xd')]:_0x365ba5[_0x6c5d('0xe')]+_0x365ba5[_0x6c5d('0xc')];var _0x23c67a;if(_0x59b31a>=_0x32aef5){_0x59b31a=_0x32aef5;_0x23c67a=0xc8;}else{_0x23c67a=0xce;}_0x445253[_0x6c5d('0xa')](_0x23c67a);return _0x445253[_0x6c5d('0xf')](_0x6c5d('0x10'),_0x3bc8cd+'-'+_0x59b31a+'/'+_0x32aef5)[_0x6c5d('0x11')](_0x2b9761);}return null;};}function saveUpdates(_0x1fc6de){return function(_0x3112d0){if(_0x3112d0){return _0x3112d0[_0x6c5d('0x12')](_0x1fc6de)[_0x6c5d('0x13')](function(_0xc29cca){return _0xc29cca;});}return null;};}function removeEntity(_0x2ce50d){return function(_0x3a1d49){if(_0x3a1d49){return _0x3a1d49[_0x6c5d('0x14')]()['then'](function(){_0x2ce50d[_0x6c5d('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d9c5){return function(_0x11018d){if(!_0x11018d){_0x11d9c5[_0x6c5d('0x9')](0x194);}return _0x11018d;};}function handleError(_0x26e02b,_0x29bde4){_0x29bde4=_0x29bde4||0x1f4;return function(_0x28ff55){logger[_0x6c5d('0x15')](_0x28ff55[_0x6c5d('0x16')]);if(_0x28ff55[_0x6c5d('0x17')]){delete _0x28ff55[_0x6c5d('0x17')];}_0x26e02b['status'](_0x29bde4)[_0x6c5d('0x18')](_0x28ff55);};}function maskClientSecret(_0xb71270){return _[_0x6c5d('0x19')](_0xb71270[_0x6c5d('0x1a')](0x0,0x3),0x14,'*');}exports[_0x6c5d('0x1b')]=function(_0x1a4388,_0x5aa135){var _0x293637={},_0x326a56={},_0x51a646={'count':0x0,'rows':[]};var _0x5bb0a0=_[_0x6c5d('0x1c')](db[_0x6c5d('0x1d')]['rawAttributes'],function(_0x577374){return{'name':_0x577374[_0x6c5d('0x1e')],'type':_0x577374[_0x6c5d('0x1f')][_0x6c5d('0x20')]};});_0x326a56['model']=_[_0x6c5d('0x1c')](_0x5bb0a0,_0x6c5d('0x17'));_0x326a56[_0x6c5d('0x21')]=_['keys'](_0x1a4388[_0x6c5d('0x21')]);_0x326a56[_0x6c5d('0x22')]=_['intersection'](_0x326a56['model'],_0x326a56['query']);_0x293637[_0x6c5d('0x23')]=_['intersection'](_0x326a56[_0x6c5d('0x24')],qs['fields'](_0x1a4388[_0x6c5d('0x21')]['fields']));_0x293637[_0x6c5d('0x23')]=_0x293637['attributes'][_0x6c5d('0x25')]?_0x293637[_0x6c5d('0x23')]:_0x326a56[_0x6c5d('0x24')];if(!_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0x26')]('nolimit')){_0x293637[_0x6c5d('0xc')]=qs[_0x6c5d('0xc')](_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0xc')]);_0x293637[_0x6c5d('0xe')]=qs[_0x6c5d('0xe')](_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0xe')]);}_0x293637[_0x6c5d('0x27')]=qs[_0x6c5d('0x28')](_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0x28')]);_0x293637[_0x6c5d('0x29')]=qs[_0x6c5d('0x22')](_['pick'](_0x1a4388['query'],_0x326a56[_0x6c5d('0x22')]),_0x5bb0a0);if(_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0x2a')]){_0x293637[_0x6c5d('0x29')]=_[_0x6c5d('0x2b')](_0x293637[_0x6c5d('0x29')],{'$or':_[_0x6c5d('0x1c')](_0x5bb0a0,function(_0x33ec4b){if(_0x33ec4b[_0x6c5d('0x1f')]!==_0x6c5d('0x2c')){var _0x527c3b={};_0x527c3b[_0x33ec4b['name']]={'$like':'%'+_0x1a4388['query']['filter']+'%'};return _0x527c3b;}})});}_0x293637=_[_0x6c5d('0x2b')]({},_0x293637,_0x1a4388[_0x6c5d('0x2d')]);var _0x18ab88={'where':_0x293637[_0x6c5d('0x29')]};return db[_0x6c5d('0x1d')]['count'](_0x18ab88)[_0x6c5d('0x13')](function(_0x5cdfcc){_0x51a646['count']=_0x5cdfcc;if(_0x1a4388[_0x6c5d('0x21')][_0x6c5d('0x2e')]){_0x293637[_0x6c5d('0x2f')]=[{'all':!![]}];}return db[_0x6c5d('0x1d')]['findAll'](_0x293637);})[_0x6c5d('0x13')](function(_0x17388b){_0x51a646[_0x6c5d('0x30')]=_[_0x6c5d('0x1c')](_0x17388b,function(_0x4345b9){if(_0x4345b9['service']===_0x6c5d('0x31')){var _0xc92c7=encryptor['decryptString'](_0x4345b9['data3']);_0x4345b9[_0x6c5d('0x32')]=maskClientSecret(_0xc92c7);}return _0x4345b9;});return _0x51a646;})[_0x6c5d('0x13')](respondWithFilteredResult(_0x5aa135,_0x293637))['catch'](handleError(_0x5aa135,null));};exports[_0x6c5d('0x33')]=function(_0x243eef,_0x2fb213){var _0x4973fb={'raw':!![],'where':{'id':_0x243eef[_0x6c5d('0x34')]['id']}},_0x53da50={};_0x53da50[_0x6c5d('0x24')]=_[_0x6c5d('0x35')](db[_0x6c5d('0x1d')]['rawAttributes']);_0x53da50[_0x6c5d('0x21')]=_[_0x6c5d('0x35')](_0x243eef['query']);_0x53da50['filters']=_[_0x6c5d('0x36')](_0x53da50['model'],_0x53da50[_0x6c5d('0x21')]);_0x4973fb[_0x6c5d('0x23')]=_[_0x6c5d('0x36')](_0x53da50['model'],qs['fields'](_0x243eef[_0x6c5d('0x21')][_0x6c5d('0x37')]));_0x4973fb[_0x6c5d('0x23')]=_0x4973fb[_0x6c5d('0x23')]['length']?_0x4973fb[_0x6c5d('0x23')]:_0x53da50[_0x6c5d('0x24')];if(_0x243eef['query']['includeAll']){_0x4973fb[_0x6c5d('0x2f')]=[{'all':!![]}];}_0x4973fb=_['merge']({},_0x4973fb,_0x243eef[_0x6c5d('0x2d')]);return db[_0x6c5d('0x1d')]['find'](_0x4973fb)[_0x6c5d('0x13')](handleEntityNotFound(_0x2fb213,null))[_0x6c5d('0x13')](function(_0x13d9e4){if(_0x13d9e4[_0x6c5d('0x38')]===_0x6c5d('0x31')){var _0x5df897=encryptor[_0x6c5d('0x39')](_0x13d9e4[_0x6c5d('0x32')]);_0x13d9e4[_0x6c5d('0x32')]=maskClientSecret(_0x5df897);}return _0x13d9e4;})[_0x6c5d('0x13')](respondWithResult(_0x2fb213,null))['catch'](handleError(_0x2fb213,null));};exports[_0x6c5d('0x3a')]=function(_0x26d09e,_0x48e74e){if(!_0x26d09e['body'][_0x6c5d('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x26d09e['body'][_0x6c5d('0x38')])throw new Error(_0x6c5d('0x3b'));var _0x5e23ed=db[_0x6c5d('0x1d')][_0x6c5d('0x3c')][_0x6c5d('0x38')][_0x6c5d('0x3d')];if(!_0x5e23ed[_0x6c5d('0x3e')](_0x26d09e[_0x6c5d('0x3f')][_0x6c5d('0x38')]))throw new Error(_0x6c5d('0x40')+_0x5e23ed['join'](',\x20'));if(_0x26d09e['body'][_0x6c5d('0x38')]===_0x6c5d('0x31')&&_0x26d09e[_0x6c5d('0x3f')][_0x6c5d('0x32')]){_0x26d09e[_0x6c5d('0x3f')][_0x6c5d('0x32')]=encryptor[_0x6c5d('0x41')](_0x26d09e['body']['data3']);}return db[_0x6c5d('0x1d')][_0x6c5d('0x3a')](_0x26d09e['body'],{})[_0x6c5d('0x13')](respondWithResult(_0x48e74e,0xc9))[_0x6c5d('0x42')](handleError(_0x48e74e,null));};exports[_0x6c5d('0x12')]=function(_0x2f870b,_0x3e51b1){if(_0x2f870b['body']['id']){delete _0x2f870b[_0x6c5d('0x3f')]['id'];}return db[_0x6c5d('0x1d')][_0x6c5d('0x43')]({'where':{'id':_0x2f870b[_0x6c5d('0x34')]['id']}})['then'](handleEntityNotFound(_0x3e51b1,null))[_0x6c5d('0x13')](function(_0x206c87){if(_0x206c87[_0x6c5d('0x38')]===_0x6c5d('0x31')&&_0x2f870b[_0x6c5d('0x3f')][_0x6c5d('0x32')]){_0x2f870b[_0x6c5d('0x3f')][_0x6c5d('0x32')]=encryptor[_0x6c5d('0x41')](_0x2f870b[_0x6c5d('0x3f')]['data3']);}return _0x206c87;})[_0x6c5d('0x13')](saveUpdates(_0x2f870b[_0x6c5d('0x3f')],null))['then'](respondWithResult(_0x3e51b1,null))['catch'](handleError(_0x3e51b1,null));};exports[_0x6c5d('0x14')]=function(_0x36fc30,_0x28780e){return db[_0x6c5d('0x1d')]['find']({'where':{'id':_0x36fc30['params']['id']}})[_0x6c5d('0x13')](handleEntityNotFound(_0x28780e,null))['then'](removeEntity(_0x28780e,null))[_0x6c5d('0x42')](handleError(_0x28780e,null));};exports[_0x6c5d('0x44')]=function(_0x20219c,_0x4d510e){return db[_0x6c5d('0x1d')]['findOne']({'where':{'id':_0x20219c[_0x6c5d('0x34')]['id']},'raw':!![]})[_0x6c5d('0x13')](function(_0x2024df){if(!_0x2024df)return _0x4d510e[_0x6c5d('0x9')](0x194);return{'url':oauth[_0x6c5d('0x45')](_0x2024df,_0x20219c[_0x6c5d('0x46')]['id'])};})[_0x6c5d('0x13')](respondWithResult(_0x4d510e,null))['catch'](handleError(_0x4d510e,null));};exports['oauth2MicrosoftCallback']=function(_0x2a4e90,_0x3c778d){var _0x2f7cfe=_0x2a4e90[_0x6c5d('0x3f')];var _0x4415e4;var _0x35c6ab;if(_0x2f7cfe['error'])throw _0x2f7cfe;redis[_0x6c5d('0x47')](_0x2f7cfe[_0x6c5d('0x48')])[_0x6c5d('0x13')](function(_0x1111b0){if(!_0x1111b0)throw new Error(_0x6c5d('0x49'));_0x4415e4=JSON[_0x6c5d('0x4a')](_0x1111b0);var _0x10b2e2=Buffer[_0x6c5d('0x4b')](_0x2f7cfe[_0x6c5d('0x48')],_0x6c5d('0x4c'))['toString'](_0x6c5d('0x4d'));_0x35c6ab=JSON[_0x6c5d('0x4a')](_0x10b2e2);if(!oauth[_0x6c5d('0x4e')](_0x2f7cfe[_0x6c5d('0x4f')],_0x4415e4['oauth2Claims']))throw new Error(_0x6c5d('0x50'));redis[_0x6c5d('0x51')](_0x2f7cfe[_0x6c5d('0x48')]);return oauth[_0x6c5d('0x52')](_0x2f7cfe[_0x6c5d('0x53')],_0x4415e4);})[_0x6c5d('0x13')](function(_0x121d73){_0x4415e4[_0x6c5d('0x54')]=_0x121d73[_0x6c5d('0x55')];_0x4415e4[_0x6c5d('0x56')]=_0x121d73[_0x6c5d('0x57')];return db[_0x6c5d('0x1d')][_0x6c5d('0x12')]({'data5':_0x4415e4['data5'],'data6':_0x4415e4[_0x6c5d('0x56')]},{'where':{'id':_0x4415e4['id']}});})[_0x6c5d('0x13')](function(){oauth[_0x6c5d('0x58')](_0x4415e4);socket[_0x6c5d('0x59')](_0x6c5d('0x5a'),{'id':_0x35c6ab['id']});return;})[_0x6c5d('0x13')](respondWithStatusCode(_0x3c778d,null))[_0x6c5d('0x42')](function(_0x1c5c6a){if(_0x35c6ab){socket['emit'](_0x6c5d('0x5b'),{'id':_0x35c6ab['id']});}if(!_0x4415e4){logger['error'](_0x6c5d('0x5c'),_0x1c5c6a);return _0x3c778d[_0x6c5d('0xa')](0x1f4)[_0x6c5d('0x18')](_0x1c5c6a[_0x6c5d('0x5d')]);}logger[_0x6c5d('0x15')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x4415e4['id'],JSON[_0x6c5d('0x5e')](_0x1c5c6a));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index eb8ac64..fa67cc0 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 _0x0b0b=['moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','lodash','util','../../config/logger','api'];(function(_0x2262bf,_0xd7cf1){var _0x5115cc=function(_0x18e1f9){while(--_0x18e1f9){_0x2262bf['push'](_0x2262bf['shift']());}};_0x5115cc(++_0xd7cf1);}(_0x0b0b,0x128));var _0xb0b0=function(_0xdfd280,_0x17f746){_0xdfd280=_0xdfd280-0x0;var _0x1c5d8f=_0x0b0b[_0xdfd280];return _0x1c5d8f;};'use strict';var _=require(_0xb0b0('0x0'));var util=require(_0xb0b0('0x1'));var logger=require(_0xb0b0('0x2'))(_0xb0b0('0x3'));var moment=require(_0xb0b0('0x4'));var BPromise=require(_0xb0b0('0x5'));var rp=require(_0xb0b0('0x6'));var fs=require('fs');var path=require(_0xb0b0('0x7'));var rimraf=require('rimraf');var config=require(_0xb0b0('0x8'));var attributes=require(_0xb0b0('0x9'));module[_0xb0b0('0xa')]=function(_0x565baa,_0x48de74){return _0x565baa['define'](_0xb0b0('0xb'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3499=['CloudProvider','util','../../config/logger','api','moment','bluebird','path','rimraf','./cloudProvider.attributes','exports','define'];(function(_0x1dd18b,_0x5bdd0d){var _0x46926c=function(_0x3f40db){while(--_0x3f40db){_0x1dd18b['push'](_0x1dd18b['shift']());}};_0x46926c(++_0x5bdd0d);}(_0x3499,0xf3));var _0x9349=function(_0x718f1f,_0x2e2338){_0x718f1f=_0x718f1f-0x0;var _0x48b289=_0x3499[_0x718f1f];return _0x48b289;};'use strict';var _=require('lodash');var util=require(_0x9349('0x0'));var logger=require(_0x9349('0x1'))(_0x9349('0x2'));var moment=require(_0x9349('0x3'));var BPromise=require(_0x9349('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9349('0x5'));var rimraf=require(_0x9349('0x6'));var config=require('../../config/environment');var attributes=require(_0x9349('0x7'));module[_0x9349('0x8')]=function(_0x35e2b4,_0x533460){return _0x35e2b4[_0x9349('0x9')](_0x9349('0xa'),attributes,{'tableName':'cloud_providers','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 aa40339..ced4d28 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 _0x1a1a=['openid','profile','https://outlook.office.com/SMTP.Send','offline_access','/authorize','map','type','Dynamics365','push','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','/.default','{TENANT_ID}','data2','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','key','value','oauth2Claims','replace','oauth2/','set','decode','payload','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','decryptString','POST','data5','access_token','data6','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','bind','findAll','all','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','redis','defaults','localhost'];(function(_0x1f99cc,_0x35138a){var _0x4e9c75=function(_0x41a9c9){while(--_0x41a9c9){_0x1f99cc['push'](_0x1f99cc['shift']());}};_0x4e9c75(++_0x35138a);}(_0x1a1a,0x12e));var _0xa1a1=function(_0x4d1631,_0x416231){_0x4d1631=_0x4d1631-0x0;var _0x3538a2=_0x1a1a[_0x4d1631];return _0x3538a2;};'use strict';var _=require(_0xa1a1('0x0'));var crypto=require(_0xa1a1('0x1'));var jwt=require(_0xa1a1('0x2'));var moment=require(_0xa1a1('0x3'));var Redis=require(_0xa1a1('0x4'));var rp=require(_0xa1a1('0x5'));var util=require(_0xa1a1('0x6'));var encryptor=require(_0xa1a1('0x7'));var config=require('../../config/environment');var logger=require(_0xa1a1('0x8'))(_0xa1a1('0x9'));var schedule=require(_0xa1a1('0xa'));var db=require('../../mysqldb')['db'];config[_0xa1a1('0xb')]=_[_0xa1a1('0xc')](config[_0xa1a1('0xb')],{'host':_0xa1a1('0xd'),'port':0x18eb});var redis=new Redis(config[_0xa1a1('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xa1a1('0xe'),_0xa1a1('0xf'),'email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0xa1a1('0x10')],'Dynamics365':[_0xa1a1('0xe'),_0xa1a1('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0xa1a1('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x575e54){var _0x122261=_[_0xa1a1('0x13')](AZURE_AUTH_SCOPES[_0x575e54['type']]);if(_0x575e54[_0xa1a1('0x14')]===_0xa1a1('0x15'))_0x122261[_0xa1a1('0x16')](_0x575e54['data7']+'/.default');return _0x122261[_0xa1a1('0x17')]('\x20');}function getAccessTokenScope(_0x3fa648){if(_0x3fa648[_0xa1a1('0x14')]===_0xa1a1('0x18'))return _0xa1a1('0x19');if(_0x3fa648['type']===_0xa1a1('0x15'))return _0x3fa648['data7']+_0xa1a1('0x1a');}function generateMicrosoftAuthorizationUrl(_0x425543,_0x4b1a54){var _0x343949=MICROSOFT_AUTH_URL['replace'](_0xa1a1('0x1b'),_0x425543[_0xa1a1('0x1c')]);var _0x40f400=['code','id_token'];var _0x423d5=Buffer[_0xa1a1('0x1d')](JSON[_0xa1a1('0x1e')]({'id':_0x4b1a54}))[_0xa1a1('0x1f')](_0xa1a1('0x20'));var _0x2a17d1=crypto[_0xa1a1('0x21')](0x10)['toString'](_0xa1a1('0x22'));var _0x28e0fc=getAuthorizationScopes(_0x425543);var _0x51a283=[{'key':_0xa1a1('0x23'),'value':_0x425543[_0xa1a1('0x24')]},{'key':_0xa1a1('0x25'),'value':encodeURIComponent(_0x40f400[_0xa1a1('0x17')]('\x20'))},{'key':_0xa1a1('0x26'),'value':_0x425543[_0xa1a1('0x27')]},{'key':_0xa1a1('0x28'),'value':_0xa1a1('0x29')},{'key':'scope','value':encodeURIComponent(_0x28e0fc)},{'key':_0xa1a1('0x2a'),'value':_0x423d5},{'key':_0xa1a1('0x2b'),'value':_0x2a17d1},{'key':_0xa1a1('0x2c'),'value':_0xa1a1('0x2d')}];var _0x5861f5=_0x343949+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xa1a1('0x13')](_0x51a283,function(_0x4f6c33){return _0x4f6c33[_0xa1a1('0x2e')]+'='+_0x4f6c33[_0xa1a1('0x2f')];})[_0xa1a1('0x17')]('&');_0x425543[_0xa1a1('0x30')]={'issuer':_0x343949[_0xa1a1('0x31')](_0xa1a1('0x32'),''),'audience':_0x425543[_0xa1a1('0x24')],'state':_0x423d5,'nonce':_0x2a17d1};redis[_0xa1a1('0x33')](_0x423d5,JSON[_0xa1a1('0x1e')](_0x425543));return _0x5861f5;}function isValidIdToken(_0x44670b,_0x3c7134){try{var _0x334bfd=jwt[_0xa1a1('0x34')](_0x44670b,{'complete':!![]});var _0x3ac40b=_0x334bfd[_0xa1a1('0x35')];if(_0x3ac40b['iss']!==_0x3c7134[_0xa1a1('0x36')])return![];if(_0x3ac40b[_0xa1a1('0x37')]!==_0x3c7134[_0xa1a1('0x38')])return![];if(_0x3ac40b['nonce']!==_0x3c7134[_0xa1a1('0x2b')])return![];if(moment()[_0xa1a1('0x39')](moment[_0xa1a1('0x3a')](_0x3ac40b[_0xa1a1('0x3b')])))return![];return!![];}catch(_0x1ba598){throw _0x1ba598;}}function refreshOauth2MicrosoftAccessToken(_0x5e5ab3){return Promise[_0xa1a1('0x3c')]()[_0xa1a1('0x3d')](function(){if(_0x5e5ab3[_0xa1a1('0x3e')])return _0x5e5ab3;return db[_0xa1a1('0x3f')][_0xa1a1('0x40')]({'where':{'id':_0x5e5ab3['id']},'raw':!![]});})[_0xa1a1('0x3d')](function(_0x324070){var _0x37aa2f={'grant_type':_0xa1a1('0x41'),'refresh_token':_0x324070['data6'],'scope':getAccessTokenScope(_0x324070),'redirect_uri':_0x324070[_0xa1a1('0x27')],'client_id':_0x324070[_0xa1a1('0x24')],'client_secret':encryptor[_0xa1a1('0x42')](_0x324070[_0xa1a1('0x3e')])};var _0x316aa5={'method':_0xa1a1('0x43'),'uri':MICROSOFT_AUTH_URL[_0xa1a1('0x31')](_0xa1a1('0x1b'),_0x324070[_0xa1a1('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x37aa2f,'json':!![]};return rp(_0x316aa5);})[_0xa1a1('0x3d')](function(_0xecb709){_0x5e5ab3[_0xa1a1('0x44')]=_0xecb709[_0xa1a1('0x45')];_0x5e5ab3[_0xa1a1('0x46')]=_0xecb709[_0xa1a1('0x41')];return db[_0xa1a1('0x3f')][_0xa1a1('0x47')]({'data5':_0x5e5ab3[_0xa1a1('0x44')],'data6':_0x5e5ab3[_0xa1a1('0x46')]},{'where':{'id':_0x5e5ab3['id']}});})['then'](function(){return _0x5e5ab3;})[_0xa1a1('0x48')](function(_0x4a605f){logger[_0xa1a1('0x49')](_0xa1a1('0x4a'),_0x5e5ab3['id'],_0x4a605f);});}function getOauth2MicrosoftAccessToken(_0x422163,_0x5eb82c){var _0x2e5a48={'grant_type':'authorization_code','code':_0x422163,'scope':getAccessTokenScope(_0x5eb82c),'redirect_uri':_0x5eb82c['data4'],'client_id':_0x5eb82c[_0xa1a1('0x24')],'client_secret':encryptor[_0xa1a1('0x42')](_0x5eb82c['data3'])};var _0x12aec2={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0xa1a1('0x1b'),_0x5eb82c[_0xa1a1('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2e5a48,'json':!![]};return rp(_0x12aec2);}function startRefreshInterval(_0x3c910b){var _0x5ee4b1=schedule['intervals'];if(_0x5ee4b1[_0x3c910b['id']])clearInterval(_0x5ee4b1[_0x3c910b['id']]);_0x5ee4b1[_0x3c910b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa1a1('0x4b')](this,{'id':_0x3c910b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x5ee4b1;}function startAllRefreshIntervals(){return db[_0xa1a1('0x3f')][_0xa1a1('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa1a1('0x3d')](function(_0x3f6df7){var _0x452aba=_0x3f6df7[_0xa1a1('0x13')](function(_0x26aaae){return refreshOauth2MicrosoftAccessToken(_0x26aaae)[_0xa1a1('0x3d')](function(_0x289f70){startRefreshInterval(_0x289f70);});});return Promise[_0xa1a1('0x4d')](_0x452aba);})['catch'](function(_0x5507fe){var _0x70c3d6=_0x5507fe?util['inspect'](_0x5507fe,{'showHidden':![],'depth':null}):'';logger[_0xa1a1('0x49')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x70c3d6);});}module[_0xa1a1('0x4e')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xe3c1=['ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','from','stringify','base64','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','map','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','audience','isAfter','unix','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','update','authorization_code','intervals','bind','findAll','all','catch','error','crypto','jsonwebtoken','moment'];(function(_0x4f3c10,_0x4cb1b1){var _0x1802cb=function(_0x4d4a74){while(--_0x4d4a74){_0x4f3c10['push'](_0x4f3c10['shift']());}};_0x1802cb(++_0x4cb1b1);}(_0xe3c1,0x197));var _0x1e3c=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0xe3c1[_0x1f7413];return _0x2d2775;};'use strict';var _=require('lodash');var crypto=require(_0x1e3c('0x0'));var jwt=require(_0x1e3c('0x1'));var moment=require(_0x1e3c('0x2'));var Redis=require(_0x1e3c('0x3'));var rp=require(_0x1e3c('0x4'));var util=require(_0x1e3c('0x5'));var encryptor=require(_0x1e3c('0x6'));var config=require(_0x1e3c('0x7'));var logger=require(_0x1e3c('0x8'))(_0x1e3c('0x9'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x1e3c('0xa'))['db'];config['redis']=_[_0x1e3c('0xb')](config[_0x1e3c('0xc')],{'host':_0x1e3c('0xd'),'port':0x18eb});var redis=new Redis(config[_0x1e3c('0xc')]);var MICROSOFT_AUTH_URL=_0x1e3c('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x1e3c('0xf'),_0x1e3c('0x10'),_0x1e3c('0x11'),_0x1e3c('0x12'),_0x1e3c('0x13'),_0x1e3c('0x14'),_0x1e3c('0x15')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x1e3c('0x16');var MICROSOFT_TOKEN_ENDPOINT=_0x1e3c('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x67ca21){var _0x37f729=_['map'](AZURE_AUTH_SCOPES[_0x67ca21[_0x1e3c('0x18')]]);if(_0x67ca21['type']===_0x1e3c('0x19'))_0x37f729[_0x1e3c('0x1a')](_0x67ca21[_0x1e3c('0x1b')]+_0x1e3c('0x1c'));return _0x37f729[_0x1e3c('0x1d')]('\x20');}function getAccessTokenScope(_0x5d45d){if(_0x5d45d[_0x1e3c('0x18')]===_0x1e3c('0x1e'))return _0x1e3c('0x13');if(_0x5d45d['type']===_0x1e3c('0x19'))return _0x5d45d[_0x1e3c('0x1b')]+_0x1e3c('0x1c');}function generateMicrosoftAuthorizationUrl(_0x2a58f0,_0x4fc0bc){var _0x42d810=MICROSOFT_AUTH_URL[_0x1e3c('0x1f')](_0x1e3c('0x20'),_0x2a58f0[_0x1e3c('0x21')]);var _0x401782=[_0x1e3c('0x22'),'id_token'];var _0x450610=Buffer[_0x1e3c('0x23')](JSON[_0x1e3c('0x24')]({'id':_0x4fc0bc}))['toString'](_0x1e3c('0x25'));var _0x187a57=crypto[_0x1e3c('0x26')](0x10)[_0x1e3c('0x27')](_0x1e3c('0x28'));var _0x12df62=getAuthorizationScopes(_0x2a58f0);var _0x24d2f6=[{'key':_0x1e3c('0x29'),'value':_0x2a58f0[_0x1e3c('0x2a')]},{'key':_0x1e3c('0x2b'),'value':encodeURIComponent(_0x401782[_0x1e3c('0x1d')]('\x20'))},{'key':_0x1e3c('0x2c'),'value':_0x2a58f0[_0x1e3c('0x2d')]},{'key':_0x1e3c('0x2e'),'value':_0x1e3c('0x2f')},{'key':_0x1e3c('0x30'),'value':encodeURIComponent(_0x12df62)},{'key':_0x1e3c('0x31'),'value':_0x450610},{'key':_0x1e3c('0x32'),'value':_0x187a57},{'key':_0x1e3c('0x33'),'value':_0x1e3c('0x34')}];var _0x3b29c8=_0x42d810+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1e3c('0x35')](_0x24d2f6,function(_0x55baa2){return _0x55baa2['key']+'='+_0x55baa2[_0x1e3c('0x36')];})[_0x1e3c('0x1d')]('&');_0x2a58f0[_0x1e3c('0x37')]={'issuer':_0x42d810['replace'](_0x1e3c('0x38'),''),'audience':_0x2a58f0[_0x1e3c('0x2a')],'state':_0x450610,'nonce':_0x187a57};redis[_0x1e3c('0x39')](_0x450610,JSON[_0x1e3c('0x24')](_0x2a58f0));return _0x3b29c8;}function isValidIdToken(_0x561cd3,_0x253a02){try{var _0x3fb046=jwt[_0x1e3c('0x3a')](_0x561cd3,{'complete':!![]});var _0x14b90e=_0x3fb046[_0x1e3c('0x3b')];if(_0x14b90e[_0x1e3c('0x3c')]!==_0x253a02[_0x1e3c('0x3d')])return![];if(_0x14b90e['aud']!==_0x253a02[_0x1e3c('0x3e')])return![];if(_0x14b90e['nonce']!==_0x253a02['nonce'])return![];if(moment()[_0x1e3c('0x3f')](moment[_0x1e3c('0x40')](_0x14b90e['exp'])))return![];return!![];}catch(_0x5289ad){throw _0x5289ad;}}function refreshOauth2MicrosoftAccessToken(_0x1c9ce7){return Promise['resolve']()[_0x1e3c('0x41')](function(){if(_0x1c9ce7[_0x1e3c('0x42')])return _0x1c9ce7;return db[_0x1e3c('0x43')][_0x1e3c('0x44')]({'where':{'id':_0x1c9ce7['id']},'raw':!![]});})[_0x1e3c('0x41')](function(_0x5a2a72){var _0x56d123={'grant_type':_0x1e3c('0x45'),'refresh_token':_0x5a2a72[_0x1e3c('0x46')],'scope':getAccessTokenScope(_0x5a2a72),'redirect_uri':_0x5a2a72['data4'],'client_id':_0x5a2a72[_0x1e3c('0x2a')],'client_secret':encryptor[_0x1e3c('0x47')](_0x5a2a72['data3'])};var _0x5476ce={'method':_0x1e3c('0x48'),'uri':MICROSOFT_AUTH_URL['replace'](_0x1e3c('0x20'),_0x5a2a72['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x56d123,'json':!![]};return rp(_0x5476ce);})[_0x1e3c('0x41')](function(_0x259eec){_0x1c9ce7[_0x1e3c('0x49')]=_0x259eec['access_token'];_0x1c9ce7[_0x1e3c('0x46')]=_0x259eec[_0x1e3c('0x45')];return db[_0x1e3c('0x43')][_0x1e3c('0x4a')]({'data5':_0x1c9ce7[_0x1e3c('0x49')],'data6':_0x1c9ce7[_0x1e3c('0x46')]},{'where':{'id':_0x1c9ce7['id']}});})[_0x1e3c('0x41')](function(){return _0x1c9ce7;})['catch'](function(_0x32d1ea){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x1c9ce7['id'],_0x32d1ea);});}function getOauth2MicrosoftAccessToken(_0x3b0c20,_0x2cb53c){var _0x1ada52={'grant_type':_0x1e3c('0x4b'),'code':_0x3b0c20,'scope':getAccessTokenScope(_0x2cb53c),'redirect_uri':_0x2cb53c[_0x1e3c('0x2d')],'client_id':_0x2cb53c['data1'],'client_secret':encryptor['decryptString'](_0x2cb53c[_0x1e3c('0x42')])};var _0x7e7bb={'method':_0x1e3c('0x48'),'uri':MICROSOFT_AUTH_URL['replace'](_0x1e3c('0x20'),_0x2cb53c[_0x1e3c('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1ada52,'json':!![]};return rp(_0x7e7bb);}function startRefreshInterval(_0x515286){var _0x4dc746=schedule[_0x1e3c('0x4c')];if(_0x4dc746[_0x515286['id']])clearInterval(_0x4dc746[_0x515286['id']]);_0x4dc746[_0x515286['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1e3c('0x4d')](this,{'id':_0x515286['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x1e3c('0x4c')]=_0x4dc746;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x1e3c('0x4e')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1e3c('0x41')](function(_0x1648cf){var _0x200708=_0x1648cf['map'](function(_0x1b2d93){return refreshOauth2MicrosoftAccessToken(_0x1b2d93)['then'](function(_0x208abc){startRefreshInterval(_0x208abc);});});return Promise[_0x1e3c('0x4f')](_0x200708);})[_0x1e3c('0x50')](function(_0x15b73d){var _0x40ed25=_0x15b73d?util['inspect'](_0x15b73d,{'showHidden':![],'depth':null}):'';logger[_0x1e3c('0x51')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x40ed25);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index cc32fb6..a46546d 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 _0xd5a2=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0xa48ac5,_0xde975d){var _0x1e1d7a=function(_0x529efa){while(--_0x529efa){_0xa48ac5['push'](_0xa48ac5['shift']());}};_0x1e1d7a(++_0xde975d);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x568c2c,_0x366739){_0x568c2c=_0x568c2c-0x0;var _0x465923=_0xd5a2[_0x568c2c];return _0x465923;};'use strict';var _=require('lodash');var util=require(_0x2d5a('0x0'));var moment=require(_0x2d5a('0x1'));var BPromise=require(_0x2d5a('0x2'));var rs=require(_0x2d5a('0x3'));var fs=require('fs');var Redis=require(_0x2d5a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d5a('0x5'));var logger=require(_0x2d5a('0x6'))(_0x2d5a('0x7'));var config=require(_0x2d5a('0x8'));var jayson=require(_0x2d5a('0x9'));var client=jayson[_0x2d5a('0xa')][_0x2d5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae103,_0x1cdfc4,_0x7eb4c3){return new BPromise(function(_0x79898c,_0x4d5c52){return client['request'](_0x1ae103,_0x7eb4c3)[_0x2d5a('0xc')](function(_0x562b6a){logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,'request\x20sent');logger[_0x2d5a('0xf')](_0x2d5a('0x10'),_0x1cdfc4,_0x2d5a('0x11'),JSON[_0x2d5a('0x12')](_0x562b6a));if(_0x562b6a[_0x2d5a('0x13')]){if(_0x562b6a['error'][_0x2d5a('0x14')]===0x1f4){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x4d5c52(_0x562b6a['error'][_0x2d5a('0x15')]);}logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x79898c(_0x562b6a[_0x2d5a('0x13')][_0x2d5a('0x15')]);}else{logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,_0x2d5a('0x11'));_0x79898c(_0x562b6a['result'][_0x2d5a('0x15')]);}})[_0x2d5a('0x16')](function(_0x38de62){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x38de62);_0x4d5c52(_0x38de62);});});} \ No newline at end of file +var _0x2581=['request','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','CloudProvider,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x16fb2b,_0xc16fac){var _0x26b2b8=function(_0x30d7fa){while(--_0x30d7fa){_0x16fb2b['push'](_0x16fb2b['shift']());}};_0x26b2b8(++_0xc16fac);}(_0x2581,0xcb));var _0x1258=function(_0x41cf27,_0x41b729){_0x41cf27=_0x41cf27-0x0;var _0x530b52=_0x2581[_0x41cf27];return _0x530b52;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var moment=require(_0x1258('0x2'));var BPromise=require(_0x1258('0x3'));var rs=require(_0x1258('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1258('0x5'))['db'];var utils=require(_0x1258('0x6'));var logger=require(_0x1258('0x7'))(_0x1258('0x8'));var config=require(_0x1258('0x9'));var jayson=require(_0x1258('0xa'));var client=jayson[_0x1258('0xb')][_0x1258('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x582ed7,_0x3e1044,_0x21cd98){return new BPromise(function(_0x468494,_0x18bbac){return client[_0x1258('0xd')](_0x582ed7,_0x21cd98)[_0x1258('0xe')](function(_0x429efc){logger['info']('CloudProvider,\x20%s,\x20%s',_0x3e1044,_0x1258('0xf'));logger[_0x1258('0x10')](_0x1258('0x11'),_0x3e1044,_0x1258('0xf'),JSON['stringify'](_0x429efc));if(_0x429efc[_0x1258('0x12')]){if(_0x429efc[_0x1258('0x12')][_0x1258('0x13')]===0x1f4){logger[_0x1258('0x12')]('CloudProvider,\x20%s,\x20%s',_0x3e1044,_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);return _0x18bbac(_0x429efc[_0x1258('0x12')][_0x1258('0x14')]);}logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x429efc[_0x1258('0x12')]['message']);return _0x468494(_0x429efc[_0x1258('0x12')]['message']);}else{logger[_0x1258('0x16')](_0x1258('0x15'),_0x3e1044,_0x1258('0xf'));_0x468494(_0x429efc[_0x1258('0x17')][_0x1258('0x14')]);}})['catch'](function(_0x1645a6){logger[_0x1258('0x12')](_0x1258('0x15'),_0x3e1044,_0x1645a6);_0x18bbac(_0x1645a6);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6c31f98..d5c00a7 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 _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x199cc7,_0x5bace6){var _0x3fcea6=function(_0x444685){while(--_0x444685){_0x199cc7['push'](_0x199cc7['shift']());}};_0x3fcea6(++_0x5bace6);}(_0xadb5,0xad));var _0x5adb=function(_0x19e1d7,_0x2be996){_0x19e1d7=_0x19e1d7-0x0;var _0x41db5f=_0xadb5[_0x19e1d7];return _0x41db5f;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x764874,_0x3ed544){var _0x29f9d5=function(_0x152dad){while(--_0x152dad){_0x764874['push'](_0x764874['shift']());}};_0x29f9d5(++_0x3ed544);}(_0x5f2f,0x73));var _0xf5f2=function(_0x392713,_0x49cee8){_0x392713=_0x392713-0x0;var _0x28c927=_0x5f2f[_0x392713];return _0x28c927;};'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')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index f8655ba..8f610c7 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 _0x49e9=['exports','STRING','name'];(function(_0x1fd2e6,_0x319411){var _0x38284b=function(_0x220170){while(--_0x220170){_0x1fd2e6['push'](_0x1fd2e6['shift']());}};_0x38284b(++_0x319411);}(_0x49e9,0x1cb));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x949e('0x0')]={'name':{'type':Sequelize[_0x949e('0x1')],'unique':_0x949e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x949e('0x1')]},'companyId':{'type':Sequelize[_0x949e('0x1')]},'website':{'type':Sequelize[_0x949e('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x949e('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x949e('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x949e('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x949e('0x1')]},'sStreet':{'type':Sequelize[_0x949e('0x1')]},'sPostalCode':{'type':Sequelize[_0x949e('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x949e('0x1')]},'description':{'type':Sequelize[_0x949e('0x1')]}}; \ No newline at end of file +var _0xa4a5=['exports','STRING','name','sequelize'];(function(_0x29380f,_0x281388){var _0xb059c7=function(_0x9efd5e){while(--_0x9efd5e){_0x29380f['push'](_0x29380f['shift']());}};_0xb059c7(++_0x281388);}(_0xa4a5,0xef));var _0x5a4a=function(_0x47f4f9,_0x4aa5f0){_0x47f4f9=_0x47f4f9-0x0;var _0x203a46=_0xa4a5[_0x47f4f9];return _0x203a46;};'use strict';var Sequelize=require(_0x5a4a('0x0'));module[_0x5a4a('0x1')]={'name':{'type':Sequelize[_0x5a4a('0x2')],'unique':_0x5a4a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5a4a('0x2')]},'companyId':{'type':Sequelize[_0x5a4a('0x2')]},'website':{'type':Sequelize[_0x5a4a('0x2')]},'phone':{'type':Sequelize[_0x5a4a('0x2')]},'fax':{'type':Sequelize[_0x5a4a('0x2')]},'type':{'type':Sequelize[_0x5a4a('0x2')]},'street':{'type':Sequelize[_0x5a4a('0x2')]},'postalCode':{'type':Sequelize[_0x5a4a('0x2')]},'city':{'type':Sequelize[_0x5a4a('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5a4a('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5a4a('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x5a4a('0x2')]},'sCity':{'type':Sequelize[_0x5a4a('0x2')]},'sCountry':{'type':Sequelize[_0x5a4a('0x2')]},'description':{'type':Sequelize[_0x5a4a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 0727310..d3742c8 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 _0xdbcb=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addContacts','ids','omit','findOne','CmContact','options','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','name','index','CmCompany','keys','query','filters','intersection','model'];(function(_0x326f81,_0x57c9d8){var _0x8a3c6e=function(_0xde3601){while(--_0xde3601){_0x326f81['push'](_0x326f81['shift']());}};_0x8a3c6e(++_0x57c9d8);}(_0xdbcb,0x12f));var _0xbdbc=function(_0x25dfdf,_0x542333){_0x25dfdf=_0x25dfdf-0x0;var _0x5220da=_0xdbcb[_0x25dfdf];return _0x5220da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbdbc('0x0'));var zipdir=require(_0xbdbc('0x1'));var jsonpatch=require(_0xbdbc('0x2'));var rp=require(_0xbdbc('0x3'));var moment=require(_0xbdbc('0x4'));var BPromise=require(_0xbdbc('0x5'));var Mustache=require(_0xbdbc('0x6'));var util=require(_0xbdbc('0x7'));var path=require('path');var sox=require(_0xbdbc('0x8'));var csv=require(_0xbdbc('0x9'));var ejs=require(_0xbdbc('0xa'));var fs=require('fs');var fs_extra=require(_0xbdbc('0xb'));var _=require(_0xbdbc('0xc'));var squel=require(_0xbdbc('0xd'));var crypto=require(_0xbdbc('0xe'));var jsforce=require(_0xbdbc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbdbc('0x9'));var querystring=require('querystring');var Papa=require(_0xbdbc('0x10'));var Redis=require(_0xbdbc('0x11'));var authService=require(_0xbdbc('0x12'));var qs=require(_0xbdbc('0x13'));var as=require(_0xbdbc('0x14'));var hardwareService=require(_0xbdbc('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xbdbc('0x16'));var config=require(_0xbdbc('0x17'));var licenseUtil=require(_0xbdbc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14335d,_0x51e0f5){_0x51e0f5=_0x51e0f5||0xcc;return function(_0x2d6c27){if(_0x2d6c27){return _0x14335d[_0xbdbc('0x19')](_0x51e0f5);}return _0x14335d[_0xbdbc('0x1a')](_0x51e0f5)[_0xbdbc('0x1b')]();};}function respondWithResult(_0x495abb,_0xe41dda){_0xe41dda=_0xe41dda||0xc8;return function(_0x5efb98){if(_0x5efb98){return _0x495abb[_0xbdbc('0x1a')](_0xe41dda)[_0xbdbc('0x1c')](_0x5efb98);}};}function respondWithFilteredResult(_0x4eb118,_0x3f6ba3){return function(_0x2cacff){if(_0x2cacff){var _0xce5d1f=typeof _0x3f6ba3['offset']===_0xbdbc('0x1d')&&typeof _0x3f6ba3[_0xbdbc('0x1e')]==='undefined';var _0x5077ea=_0x2cacff[_0xbdbc('0x1f')];var _0x504810=_0xce5d1f?0x0:_0x3f6ba3[_0xbdbc('0x20')];var _0x4f3bd1=_0xce5d1f?_0x2cacff[_0xbdbc('0x1f')]:_0x3f6ba3[_0xbdbc('0x20')]+_0x3f6ba3[_0xbdbc('0x1e')];var _0x341590;if(_0x4f3bd1>=_0x5077ea){_0x4f3bd1=_0x5077ea;_0x341590=0xc8;}else{_0x341590=0xce;}_0x4eb118[_0xbdbc('0x1a')](_0x341590);return _0x4eb118[_0xbdbc('0x21')](_0xbdbc('0x22'),_0x504810+'-'+_0x4f3bd1+'/'+_0x5077ea)['json'](_0x2cacff);}return null;};}function patchUpdates(_0x5e405c){return function(_0xe66cfc){try{jsonpatch[_0xbdbc('0x23')](_0xe66cfc,_0x5e405c,!![]);}catch(_0xd21760){return BPromise[_0xbdbc('0x24')](_0xd21760);}return _0xe66cfc[_0xbdbc('0x25')]();};}function saveUpdates(_0x1500ff,_0x345d36){return function(_0x2bb9a2){if(_0x2bb9a2){return _0x2bb9a2[_0xbdbc('0x26')](_0x1500ff)[_0xbdbc('0x27')](function(_0x551253){return _0x551253;});}return null;};}function removeEntity(_0x5cee67,_0x2416a4){return function(_0x285158){if(_0x285158){return _0x285158[_0xbdbc('0x28')]()[_0xbdbc('0x27')](function(){var _0x455a30=_0x285158[_0xbdbc('0x29')]({'plain':!![]});var _0x5c16b7=_0xbdbc('0x2a');return db[_0xbdbc('0x2b')][_0xbdbc('0x28')]({'where':{'type':_0x5c16b7,'resourceId':_0x455a30['id']}})['then'](function(){return _0x285158;});})[_0xbdbc('0x27')](function(){_0x5cee67[_0xbdbc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x398321,_0x158201){return function(_0xe962ec){if(!_0xe962ec){_0x398321[_0xbdbc('0x19')](0x194);}return _0xe962ec;};}function handleError(_0x144f2e,_0x114ec5){_0x114ec5=_0x114ec5||0x1f4;return function(_0x20571c){logger[_0xbdbc('0x2c')](_0x20571c['stack']);if(_0x20571c[_0xbdbc('0x2d')]){delete _0x20571c['name'];}_0x144f2e[_0xbdbc('0x1a')](_0x114ec5)['send'](_0x20571c);};}exports[_0xbdbc('0x2e')]=function(_0x2e8458,_0x549643){var _0x4127fb={},_0xcdc5b1={},_0x9496d6={'count':0x0,'rows':[]};return db[_0xbdbc('0x2f')]['describe']()['then'](function(_0x100e07){_0xcdc5b1['model']=_[_0xbdbc('0x30')](_0x100e07);_0xcdc5b1[_0xbdbc('0x31')]=_['keys'](_0x2e8458[_0xbdbc('0x31')]);_0xcdc5b1[_0xbdbc('0x32')]=_[_0xbdbc('0x33')](_0xcdc5b1[_0xbdbc('0x34')],_0xcdc5b1['query']);_0x4127fb[_0xbdbc('0x35')]=_['intersection'](_0xcdc5b1[_0xbdbc('0x34')],qs[_0xbdbc('0x36')](_0x2e8458['query'][_0xbdbc('0x36')]));_0x4127fb[_0xbdbc('0x35')]=_0x4127fb[_0xbdbc('0x35')][_0xbdbc('0x37')]?_0x4127fb[_0xbdbc('0x35')]:_0xcdc5b1[_0xbdbc('0x34')];if(!_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x38')](_0xbdbc('0x39'))){_0x4127fb[_0xbdbc('0x1e')]=qs[_0xbdbc('0x1e')](_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x1e')]);_0x4127fb[_0xbdbc('0x20')]=qs[_0xbdbc('0x20')](_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x20')]);}_0x4127fb[_0xbdbc('0x3a')]=qs[_0xbdbc('0x3b')](_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x3b')]);_0x4127fb[_0xbdbc('0x3c')]=qs[_0xbdbc('0x32')](_[_0xbdbc('0x3d')](_0x2e8458[_0xbdbc('0x31')],_0xcdc5b1[_0xbdbc('0x32')]),_0x100e07);if(_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x3e')]){_0x4127fb[_0xbdbc('0x3c')]=_[_0xbdbc('0x3f')](_0x4127fb[_0xbdbc('0x3c')],{'$or':_[_0xbdbc('0x40')](_0x4127fb[_0xbdbc('0x35')],function(_0x3caa46){var _0xcbe8db={};_0xcbe8db[_0x3caa46]={'$like':'%'+_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x3e')]+'%'};return _0xcbe8db;})});}_0x4127fb=_[_0xbdbc('0x3f')]({},_0x4127fb,_0x2e8458['options']);var _0x4239c2={'where':_0x4127fb[_0xbdbc('0x3c')]};return db['CmCompany']['count'](_0x4239c2)['then'](function(_0x563b43){_0x9496d6[_0xbdbc('0x1f')]=_0x563b43;if(_0x2e8458[_0xbdbc('0x31')][_0xbdbc('0x41')]){_0x4127fb[_0xbdbc('0x42')]=[{'all':!![]}];}return db['CmCompany'][_0xbdbc('0x43')](_0x4127fb);})[_0xbdbc('0x27')](function(_0x25681c){_0x9496d6[_0xbdbc('0x44')]=_0x25681c;return _0x9496d6;})[_0xbdbc('0x27')](respondWithFilteredResult(_0x549643,_0x4127fb))[_0xbdbc('0x45')](handleError(_0x549643,null));})[_0xbdbc('0x45')](handleError(_0x549643,null));};exports[_0xbdbc('0x46')]=function(_0x528900,_0x52d471){var _0x3a8ff2={'raw':![],'where':{'id':_0x528900[_0xbdbc('0x47')]['id']}},_0x4ecc7f={};_0x4ecc7f['model']=_[_0xbdbc('0x30')](db[_0xbdbc('0x2f')][_0xbdbc('0x48')]);_0x4ecc7f['query']=_[_0xbdbc('0x30')](_0x528900[_0xbdbc('0x31')]);_0x4ecc7f[_0xbdbc('0x32')]=_[_0xbdbc('0x33')](_0x4ecc7f[_0xbdbc('0x34')],_0x4ecc7f[_0xbdbc('0x31')]);_0x3a8ff2[_0xbdbc('0x35')]=_[_0xbdbc('0x33')](_0x4ecc7f['model'],qs[_0xbdbc('0x36')](_0x528900['query']['fields']));_0x3a8ff2[_0xbdbc('0x35')]=_0x3a8ff2[_0xbdbc('0x35')][_0xbdbc('0x37')]?_0x3a8ff2[_0xbdbc('0x35')]:_0x4ecc7f[_0xbdbc('0x34')];if(_0x528900[_0xbdbc('0x31')]['includeAll']){_0x3a8ff2[_0xbdbc('0x42')]=[{'all':!![]}];}_0x3a8ff2=_['merge']({},_0x3a8ff2,_0x528900['options']);return db[_0xbdbc('0x2f')]['find'](_0x3a8ff2)[_0xbdbc('0x27')](handleEntityNotFound(_0x52d471,null))['then'](respondWithResult(_0x52d471,null))[_0xbdbc('0x45')](handleError(_0x52d471,null));};exports['create']=function(_0x59d54f,_0x49f7c4){return db[_0xbdbc('0x2f')][_0xbdbc('0x49')](_0x59d54f['body'],{})[_0xbdbc('0x27')](function(_0x45ea2c){var _0x2dec30=_0x59d54f[_0xbdbc('0x4a')][_0xbdbc('0x29')]({'plain':!![]});if(!_0x2dec30)throw new Error(_0xbdbc('0x4b'));if(_0x2dec30['role']===_0xbdbc('0x4a')){var _0x4ada71=_0x45ea2c[_0xbdbc('0x29')]({'plain':!![]});var _0xc3e643=_0xbdbc('0x2a');return db[_0xbdbc('0x4c')][_0xbdbc('0x4d')]({'where':{'name':_0xc3e643,'userProfileId':_0x2dec30['userProfileId']},'raw':!![]})[_0xbdbc('0x27')](function(_0x4b9426){if(_0x4b9426&&_0x4b9426[_0xbdbc('0x4e')]===0x0){return db[_0xbdbc('0x2b')]['create']({'name':_0x4ada71['name'],'resourceId':_0x4ada71['id'],'type':_0x4b9426['name'],'sectionId':_0x4b9426['id']},{})[_0xbdbc('0x27')](function(){return _0x45ea2c;});}else{return _0x45ea2c;}})[_0xbdbc('0x45')](function(_0x5ac03c){logger[_0xbdbc('0x2c')](_0xbdbc('0x4f'),_0x5ac03c);throw _0x5ac03c;});}return _0x45ea2c;})[_0xbdbc('0x27')](respondWithResult(_0x49f7c4,0xc9))['catch'](handleError(_0x49f7c4,null));};exports[_0xbdbc('0x26')]=function(_0x310a8d,_0x5e983f){if(_0x310a8d['body']['id']){delete _0x310a8d['body']['id'];}return db[_0xbdbc('0x2f')][_0xbdbc('0x4d')]({'where':{'id':_0x310a8d[_0xbdbc('0x47')]['id']}})[_0xbdbc('0x27')](handleEntityNotFound(_0x5e983f,null))[_0xbdbc('0x27')](saveUpdates(_0x310a8d[_0xbdbc('0x50')],null))[_0xbdbc('0x27')](respondWithResult(_0x5e983f,null))[_0xbdbc('0x45')](handleError(_0x5e983f,null));};exports['destroy']=function(_0x4b83c7,_0x4dc319){return db[_0xbdbc('0x2f')][_0xbdbc('0x4d')]({'where':{'id':_0x4b83c7[_0xbdbc('0x47')]['id']}})[_0xbdbc('0x27')](handleEntityNotFound(_0x4dc319,null))['then'](removeEntity(_0x4dc319,null))[_0xbdbc('0x45')](handleError(_0x4dc319,null));};exports[_0xbdbc('0x51')]=function(_0x14995f,_0x4c8797){return db[_0xbdbc('0x2f')][_0xbdbc('0x51')]()[_0xbdbc('0x27')](respondWithResult(_0x4c8797,null))['catch'](handleError(_0x4c8797,null));};exports['addContacts']=function(_0x2469ea,_0xdcdd54,_0x292175){return db['CmContact'][_0xbdbc('0x4d')]({'where':{'id':_0x2469ea['params']['id']}})[_0xbdbc('0x27')](handleEntityNotFound(_0xdcdd54,null))[_0xbdbc('0x27')](function(_0x3dc32c){if(_0x3dc32c){return _0x3dc32c[_0xbdbc('0x52')](_0x2469ea['body'][_0xbdbc('0x53')],_[_0xbdbc('0x54')](_0x2469ea[_0xbdbc('0x50')],[_0xbdbc('0x53'),'id'])||{});}})[_0xbdbc('0x27')](respondWithResult(_0xdcdd54,null))[_0xbdbc('0x45')](handleError(_0xdcdd54,null));};exports['getContacts']=function(_0x4e3d19,_0x58f641,_0x1b7827){var _0x321bd4={};var _0x2975db={};var _0x3f5fdf;var _0x27481c;return db[_0xbdbc('0x2f')][_0xbdbc('0x55')]({'where':{'id':_0x4e3d19[_0xbdbc('0x47')]['id']}})[_0xbdbc('0x27')](handleEntityNotFound(_0x58f641,null))[_0xbdbc('0x27')](function(_0x5aa9d2){if(_0x5aa9d2){_0x3f5fdf=_0x5aa9d2;_0x2975db['model']=_[_0xbdbc('0x30')](db[_0xbdbc('0x56')][_0xbdbc('0x48')]);_0x2975db[_0xbdbc('0x31')]=_[_0xbdbc('0x30')](_0x4e3d19['query']);_0x2975db['filters']=_[_0xbdbc('0x33')](_0x2975db[_0xbdbc('0x34')],_0x2975db[_0xbdbc('0x31')]);_0x321bd4[_0xbdbc('0x35')]=_['intersection'](_0x2975db[_0xbdbc('0x34')],qs[_0xbdbc('0x36')](_0x4e3d19[_0xbdbc('0x31')]['fields']));_0x321bd4[_0xbdbc('0x35')]=_0x321bd4['attributes']['length']?_0x321bd4[_0xbdbc('0x35')]:_0x2975db[_0xbdbc('0x34')];_0x321bd4['order']=qs[_0xbdbc('0x3b')](_0x4e3d19[_0xbdbc('0x31')][_0xbdbc('0x3b')]);_0x321bd4[_0xbdbc('0x3c')]=qs[_0xbdbc('0x32')](_[_0xbdbc('0x3d')](_0x4e3d19['query'],_0x2975db[_0xbdbc('0x32')]));if(_0x4e3d19[_0xbdbc('0x31')][_0xbdbc('0x3e')]){_0x321bd4['where']=_['merge'](_0x321bd4[_0xbdbc('0x3c')],{'$or':_[_0xbdbc('0x40')](_0x321bd4[_0xbdbc('0x35')],function(_0x294614){var _0x42a1ff={};_0x42a1ff[_0x294614]={'$like':'%'+_0x4e3d19[_0xbdbc('0x31')][_0xbdbc('0x3e')]+'%'};return _0x42a1ff;})});}_0x321bd4=_[_0xbdbc('0x3f')]({},_0x321bd4,_0x4e3d19[_0xbdbc('0x57')]);return _0x3f5fdf[_0xbdbc('0x58')](_0x321bd4);}})[_0xbdbc('0x27')](function(_0x35385e){if(_0x35385e){_0x27481c=_0x35385e['length'];if(!_0x4e3d19['query']['hasOwnProperty'](_0xbdbc('0x39'))){_0x321bd4[_0xbdbc('0x1e')]=qs[_0xbdbc('0x1e')](_0x4e3d19[_0xbdbc('0x31')]['limit']);_0x321bd4['offset']=qs[_0xbdbc('0x20')](_0x4e3d19[_0xbdbc('0x31')][_0xbdbc('0x20')]);}return _0x3f5fdf[_0xbdbc('0x58')](_0x321bd4);}})['then'](function(_0xb755b8){if(_0xb755b8){return _0xb755b8?{'count':_0x27481c,'rows':_0xb755b8}:null;}})[_0xbdbc('0x27')](respondWithResult(_0x58f641,null))[_0xbdbc('0x45')](handleError(_0x58f641,null));}; \ No newline at end of file +var _0xfd72=['error','stack','name','send','index','CmCompany','keys','query','filters','model','attributes','fields','nolimit','order','sort','where','filter','map','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','ids','getContacts','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','update','then','destroy','get','UserProfileResource'];(function(_0x3dffd3,_0x44a5b7){var _0x2a65af=function(_0x57c5e1){while(--_0x57c5e1){_0x3dffd3['push'](_0x3dffd3['shift']());}};_0x2a65af(++_0x44a5b7);}(_0xfd72,0x182));var _0x2fd7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfd72[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x2fd7('0x0'));var rimraf=require(_0x2fd7('0x1'));var zipdir=require(_0x2fd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fd7('0x3'));var moment=require('moment');var BPromise=require(_0x2fd7('0x4'));var Mustache=require(_0x2fd7('0x5'));var util=require(_0x2fd7('0x6'));var path=require(_0x2fd7('0x7'));var sox=require('sox');var csv=require(_0x2fd7('0x8'));var ejs=require(_0x2fd7('0x9'));var fs=require('fs');var fs_extra=require(_0x2fd7('0xa'));var _=require(_0x2fd7('0xb'));var squel=require(_0x2fd7('0xc'));var crypto=require(_0x2fd7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2fd7('0xe'));var toCsv=require(_0x2fd7('0x8'));var querystring=require('querystring');var Papa=require(_0x2fd7('0xf'));var Redis=require(_0x2fd7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2fd7('0x11'));var as=require(_0x2fd7('0x12'));var hardwareService=require(_0x2fd7('0x13'));var logger=require(_0x2fd7('0x14'))(_0x2fd7('0x15'));var utils=require(_0x2fd7('0x16'));var config=require(_0x2fd7('0x17'));var licenseUtil=require(_0x2fd7('0x18'));var db=require(_0x2fd7('0x19'))['db'];function respondWithStatusCode(_0x554030,_0x337a60){_0x337a60=_0x337a60||0xcc;return function(_0x4bff8c){if(_0x4bff8c){return _0x554030['sendStatus'](_0x337a60);}return _0x554030[_0x2fd7('0x1a')](_0x337a60)['end']();};}function respondWithResult(_0x4dfb68,_0x5e44f2){_0x5e44f2=_0x5e44f2||0xc8;return function(_0x1c0cab){if(_0x1c0cab){return _0x4dfb68['status'](_0x5e44f2)['json'](_0x1c0cab);}};}function respondWithFilteredResult(_0x21d883,_0x1f88e4){return function(_0x38f371){if(_0x38f371){var _0x190b42=typeof _0x1f88e4[_0x2fd7('0x1b')]===_0x2fd7('0x1c')&&typeof _0x1f88e4[_0x2fd7('0x1d')]==='undefined';var _0x2935ee=_0x38f371[_0x2fd7('0x1e')];var _0x339c0b=_0x190b42?0x0:_0x1f88e4[_0x2fd7('0x1b')];var _0xba914b=_0x190b42?_0x38f371[_0x2fd7('0x1e')]:_0x1f88e4['offset']+_0x1f88e4[_0x2fd7('0x1d')];var _0x166061;if(_0xba914b>=_0x2935ee){_0xba914b=_0x2935ee;_0x166061=0xc8;}else{_0x166061=0xce;}_0x21d883[_0x2fd7('0x1a')](_0x166061);return _0x21d883[_0x2fd7('0x1f')]('Content-Range',_0x339c0b+'-'+_0xba914b+'/'+_0x2935ee)[_0x2fd7('0x20')](_0x38f371);}return null;};}function patchUpdates(_0x339ed6){return function(_0x49e1b9){try{jsonpatch[_0x2fd7('0x21')](_0x49e1b9,_0x339ed6,!![]);}catch(_0x3dc2ef){return BPromise['reject'](_0x3dc2ef);}return _0x49e1b9['save']();};}function saveUpdates(_0x166c43,_0x2fd2d2){return function(_0x46ab3a){if(_0x46ab3a){return _0x46ab3a[_0x2fd7('0x22')](_0x166c43)[_0x2fd7('0x23')](function(_0xb766c8){return _0xb766c8;});}return null;};}function removeEntity(_0x1cd919,_0x5ee82a){return function(_0x194923){if(_0x194923){return _0x194923[_0x2fd7('0x24')]()[_0x2fd7('0x23')](function(){var _0x4f5350=_0x194923[_0x2fd7('0x25')]({'plain':!![]});var _0x284575='Companies';return db[_0x2fd7('0x26')][_0x2fd7('0x24')]({'where':{'type':_0x284575,'resourceId':_0x4f5350['id']}})[_0x2fd7('0x23')](function(){return _0x194923;});})['then'](function(){_0x1cd919[_0x2fd7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f52f8,_0x371552){return function(_0x3dee89){if(!_0x3dee89){_0x2f52f8['sendStatus'](0x194);}return _0x3dee89;};}function handleError(_0x30476c,_0x5cc1b6){_0x5cc1b6=_0x5cc1b6||0x1f4;return function(_0x17be1c){logger[_0x2fd7('0x27')](_0x17be1c[_0x2fd7('0x28')]);if(_0x17be1c[_0x2fd7('0x29')]){delete _0x17be1c[_0x2fd7('0x29')];}_0x30476c['status'](_0x5cc1b6)[_0x2fd7('0x2a')](_0x17be1c);};}exports[_0x2fd7('0x2b')]=function(_0x35a30e,_0x5cef87){var _0x463df3={},_0x462231={},_0x239207={'count':0x0,'rows':[]};return db[_0x2fd7('0x2c')]['describe']()['then'](function(_0x2222aa){_0x462231['model']=_[_0x2fd7('0x2d')](_0x2222aa);_0x462231['query']=_[_0x2fd7('0x2d')](_0x35a30e[_0x2fd7('0x2e')]);_0x462231[_0x2fd7('0x2f')]=_['intersection'](_0x462231[_0x2fd7('0x30')],_0x462231[_0x2fd7('0x2e')]);_0x463df3[_0x2fd7('0x31')]=_['intersection'](_0x462231[_0x2fd7('0x30')],qs['fields'](_0x35a30e[_0x2fd7('0x2e')][_0x2fd7('0x32')]));_0x463df3[_0x2fd7('0x31')]=_0x463df3[_0x2fd7('0x31')]['length']?_0x463df3['attributes']:_0x462231[_0x2fd7('0x30')];if(!_0x35a30e[_0x2fd7('0x2e')]['hasOwnProperty'](_0x2fd7('0x33'))){_0x463df3['limit']=qs['limit'](_0x35a30e[_0x2fd7('0x2e')][_0x2fd7('0x1d')]);_0x463df3[_0x2fd7('0x1b')]=qs[_0x2fd7('0x1b')](_0x35a30e['query']['offset']);}_0x463df3[_0x2fd7('0x34')]=qs[_0x2fd7('0x35')](_0x35a30e['query'][_0x2fd7('0x35')]);_0x463df3[_0x2fd7('0x36')]=qs[_0x2fd7('0x2f')](_['pick'](_0x35a30e[_0x2fd7('0x2e')],_0x462231[_0x2fd7('0x2f')]),_0x2222aa);if(_0x35a30e[_0x2fd7('0x2e')][_0x2fd7('0x37')]){_0x463df3[_0x2fd7('0x36')]=_['merge'](_0x463df3['where'],{'$or':_[_0x2fd7('0x38')](_0x463df3[_0x2fd7('0x31')],function(_0x1595f2){var _0x4291a3={};_0x4291a3[_0x1595f2]={'$like':'%'+_0x35a30e[_0x2fd7('0x2e')][_0x2fd7('0x37')]+'%'};return _0x4291a3;})});}_0x463df3=_['merge']({},_0x463df3,_0x35a30e[_0x2fd7('0x39')]);var _0x2e76c2={'where':_0x463df3[_0x2fd7('0x36')]};return db[_0x2fd7('0x2c')][_0x2fd7('0x1e')](_0x2e76c2)[_0x2fd7('0x23')](function(_0xb58f8c){_0x239207[_0x2fd7('0x1e')]=_0xb58f8c;if(_0x35a30e[_0x2fd7('0x2e')]['includeAll']){_0x463df3[_0x2fd7('0x3a')]=[{'all':!![]}];}return db[_0x2fd7('0x2c')][_0x2fd7('0x3b')](_0x463df3);})[_0x2fd7('0x23')](function(_0x8b6da9){_0x239207[_0x2fd7('0x3c')]=_0x8b6da9;return _0x239207;})['then'](respondWithFilteredResult(_0x5cef87,_0x463df3))[_0x2fd7('0x3d')](handleError(_0x5cef87,null));})['catch'](handleError(_0x5cef87,null));};exports[_0x2fd7('0x3e')]=function(_0x3ea977,_0x4f3090){var _0x53afc4={'raw':![],'where':{'id':_0x3ea977[_0x2fd7('0x3f')]['id']}},_0x196586={};_0x196586['model']=_[_0x2fd7('0x2d')](db[_0x2fd7('0x2c')][_0x2fd7('0x40')]);_0x196586[_0x2fd7('0x2e')]=_[_0x2fd7('0x2d')](_0x3ea977[_0x2fd7('0x2e')]);_0x196586['filters']=_[_0x2fd7('0x41')](_0x196586[_0x2fd7('0x30')],_0x196586[_0x2fd7('0x2e')]);_0x53afc4[_0x2fd7('0x31')]=_[_0x2fd7('0x41')](_0x196586[_0x2fd7('0x30')],qs[_0x2fd7('0x32')](_0x3ea977[_0x2fd7('0x2e')][_0x2fd7('0x32')]));_0x53afc4['attributes']=_0x53afc4[_0x2fd7('0x31')][_0x2fd7('0x42')]?_0x53afc4[_0x2fd7('0x31')]:_0x196586['model'];if(_0x3ea977[_0x2fd7('0x2e')][_0x2fd7('0x43')]){_0x53afc4['include']=[{'all':!![]}];}_0x53afc4=_[_0x2fd7('0x44')]({},_0x53afc4,_0x3ea977[_0x2fd7('0x39')]);return db[_0x2fd7('0x2c')][_0x2fd7('0x45')](_0x53afc4)['then'](handleEntityNotFound(_0x4f3090,null))[_0x2fd7('0x23')](respondWithResult(_0x4f3090,null))['catch'](handleError(_0x4f3090,null));};exports[_0x2fd7('0x46')]=function(_0x1c70e5,_0x1cf57){return db[_0x2fd7('0x2c')][_0x2fd7('0x46')](_0x1c70e5[_0x2fd7('0x47')],{})[_0x2fd7('0x23')](function(_0x3e8440){var _0x5a7e5e=_0x1c70e5[_0x2fd7('0x48')][_0x2fd7('0x25')]({'plain':!![]});if(!_0x5a7e5e)throw new Error(_0x2fd7('0x49'));if(_0x5a7e5e[_0x2fd7('0x4a')]===_0x2fd7('0x48')){var _0x3dbd5f=_0x3e8440[_0x2fd7('0x25')]({'plain':!![]});var _0x297134=_0x2fd7('0x4b');return db[_0x2fd7('0x4c')][_0x2fd7('0x45')]({'where':{'name':_0x297134,'userProfileId':_0x5a7e5e[_0x2fd7('0x4d')]},'raw':!![]})['then'](function(_0x447ad7){if(_0x447ad7&&_0x447ad7[_0x2fd7('0x4e')]===0x0){return db[_0x2fd7('0x26')]['create']({'name':_0x3dbd5f[_0x2fd7('0x29')],'resourceId':_0x3dbd5f['id'],'type':_0x447ad7[_0x2fd7('0x29')],'sectionId':_0x447ad7['id']},{})[_0x2fd7('0x23')](function(){return _0x3e8440;});}else{return _0x3e8440;}})[_0x2fd7('0x3d')](function(_0x51d114){logger[_0x2fd7('0x27')](_0x2fd7('0x4f'),_0x51d114);throw _0x51d114;});}return _0x3e8440;})['then'](respondWithResult(_0x1cf57,0xc9))[_0x2fd7('0x3d')](handleError(_0x1cf57,null));};exports[_0x2fd7('0x22')]=function(_0x2ea39f,_0x10ec6e){if(_0x2ea39f[_0x2fd7('0x47')]['id']){delete _0x2ea39f[_0x2fd7('0x47')]['id'];}return db['CmCompany'][_0x2fd7('0x45')]({'where':{'id':_0x2ea39f['params']['id']}})[_0x2fd7('0x23')](handleEntityNotFound(_0x10ec6e,null))[_0x2fd7('0x23')](saveUpdates(_0x2ea39f['body'],null))[_0x2fd7('0x23')](respondWithResult(_0x10ec6e,null))['catch'](handleError(_0x10ec6e,null));};exports[_0x2fd7('0x24')]=function(_0x2d6413,_0x3c2094){return db['CmCompany'][_0x2fd7('0x45')]({'where':{'id':_0x2d6413[_0x2fd7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3c2094,null))['then'](removeEntity(_0x3c2094,null))['catch'](handleError(_0x3c2094,null));};exports['describe']=function(_0x54731d,_0x4841ad){return db['CmCompany'][_0x2fd7('0x50')]()[_0x2fd7('0x23')](respondWithResult(_0x4841ad,null))[_0x2fd7('0x3d')](handleError(_0x4841ad,null));};exports[_0x2fd7('0x51')]=function(_0x36b8f8,_0x3ddfd6,_0x2782c6){return db['CmContact'][_0x2fd7('0x45')]({'where':{'id':_0x36b8f8[_0x2fd7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3ddfd6,null))[_0x2fd7('0x23')](function(_0x5afc6c){if(_0x5afc6c){return _0x5afc6c[_0x2fd7('0x51')](_0x36b8f8['body'][_0x2fd7('0x52')],_['omit'](_0x36b8f8['body'],[_0x2fd7('0x52'),'id'])||{});}})[_0x2fd7('0x23')](respondWithResult(_0x3ddfd6,null))['catch'](handleError(_0x3ddfd6,null));};exports[_0x2fd7('0x53')]=function(_0xf1e904,_0x28f1c5,_0x1fb28e){var _0x1b9bbd={};var _0x1b20b0={};var _0x7a4906;var _0x393c53;return db[_0x2fd7('0x2c')][_0x2fd7('0x54')]({'where':{'id':_0xf1e904[_0x2fd7('0x3f')]['id']}})[_0x2fd7('0x23')](handleEntityNotFound(_0x28f1c5,null))[_0x2fd7('0x23')](function(_0x5c8907){if(_0x5c8907){_0x7a4906=_0x5c8907;_0x1b20b0[_0x2fd7('0x30')]=_[_0x2fd7('0x2d')](db['CmContact'][_0x2fd7('0x40')]);_0x1b20b0[_0x2fd7('0x2e')]=_[_0x2fd7('0x2d')](_0xf1e904[_0x2fd7('0x2e')]);_0x1b20b0[_0x2fd7('0x2f')]=_[_0x2fd7('0x41')](_0x1b20b0['model'],_0x1b20b0['query']);_0x1b9bbd[_0x2fd7('0x31')]=_[_0x2fd7('0x41')](_0x1b20b0['model'],qs[_0x2fd7('0x32')](_0xf1e904[_0x2fd7('0x2e')][_0x2fd7('0x32')]));_0x1b9bbd[_0x2fd7('0x31')]=_0x1b9bbd[_0x2fd7('0x31')][_0x2fd7('0x42')]?_0x1b9bbd[_0x2fd7('0x31')]:_0x1b20b0[_0x2fd7('0x30')];_0x1b9bbd[_0x2fd7('0x34')]=qs['sort'](_0xf1e904['query'][_0x2fd7('0x35')]);_0x1b9bbd[_0x2fd7('0x36')]=qs[_0x2fd7('0x2f')](_['pick'](_0xf1e904[_0x2fd7('0x2e')],_0x1b20b0[_0x2fd7('0x2f')]));if(_0xf1e904[_0x2fd7('0x2e')][_0x2fd7('0x37')]){_0x1b9bbd[_0x2fd7('0x36')]=_[_0x2fd7('0x44')](_0x1b9bbd[_0x2fd7('0x36')],{'$or':_[_0x2fd7('0x38')](_0x1b9bbd['attributes'],function(_0x5ddbe3){var _0x1d9374={};_0x1d9374[_0x5ddbe3]={'$like':'%'+_0xf1e904[_0x2fd7('0x2e')][_0x2fd7('0x37')]+'%'};return _0x1d9374;})});}_0x1b9bbd=_[_0x2fd7('0x44')]({},_0x1b9bbd,_0xf1e904[_0x2fd7('0x39')]);return _0x7a4906[_0x2fd7('0x53')](_0x1b9bbd);}})['then'](function(_0x6c309e){if(_0x6c309e){_0x393c53=_0x6c309e[_0x2fd7('0x42')];if(!_0xf1e904['query']['hasOwnProperty'](_0x2fd7('0x33'))){_0x1b9bbd[_0x2fd7('0x1d')]=qs[_0x2fd7('0x1d')](_0xf1e904[_0x2fd7('0x2e')][_0x2fd7('0x1d')]);_0x1b9bbd['offset']=qs[_0x2fd7('0x1b')](_0xf1e904[_0x2fd7('0x2e')]['offset']);}return _0x7a4906[_0x2fd7('0x53')](_0x1b9bbd);}})[_0x2fd7('0x23')](function(_0xa837a8){if(_0xa837a8){return _0xa837a8?{'count':_0x393c53,'rows':_0xa837a8}:null;}})[_0x2fd7('0x23')](respondWithResult(_0x28f1c5,null))[_0x2fd7('0x3d')](handleError(_0x28f1c5,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 35aab15..45fec10 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 _0xf50f=['exports','cm_companies','lodash','util','bluebird','path','rimraf','./cmCompany.attributes'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xf50f,0x112));var _0xff50=function(_0x53da6b,_0x2ce125){_0x53da6b=_0x53da6b-0x0;var _0x309813=_0xf50f[_0x53da6b];return _0x309813;};'use strict';var _=require(_0xff50('0x0'));var util=require(_0xff50('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xff50('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff50('0x3'));var rimraf=require(_0xff50('0x4'));var config=require('../../config/environment');var attributes=require(_0xff50('0x5'));module[_0xff50('0x6')]=function(_0x250636,_0x4701b1){return _0x250636['define']('CmCompany',attributes,{'tableName':_0xff50('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ff1=['api','request-promise','path','rimraf','exports','CmCompany','cm_companies','../../config/logger'];(function(_0x8f0c8d,_0x5b6a2a){var _0x6c39a5=function(_0x189c6d){while(--_0x189c6d){_0x8f0c8d['push'](_0x8f0c8d['shift']());}};_0x6c39a5(++_0x5b6a2a);}(_0x8ff1,0x10f));var _0x18ff=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x8ff1[_0x172747];return _0x509692;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x18ff('0x0'))(_0x18ff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x18ff('0x2'));var fs=require('fs');var path=require(_0x18ff('0x3'));var rimraf=require(_0x18ff('0x4'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x18ff('0x5')]=function(_0x298118,_0x5680ad){return _0x298118['define'](_0x18ff('0x6'),attributes,{'tableName':_0x18ff('0x7'),'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 edb540d..8fd7577 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 _0x3565=['jayson/promise','client','http','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3565,0x1af));var _0x5356=function(_0x32622d,_0x1ef3bd){_0x32622d=_0x32622d-0x0;var _0x29146a=_0x3565[_0x32622d];return _0x29146a;};'use strict';var _=require(_0x5356('0x0'));var util=require(_0x5356('0x1'));var moment=require(_0x5356('0x2'));var BPromise=require(_0x5356('0x3'));var rs=require(_0x5356('0x4'));var fs=require('fs');var Redis=require(_0x5356('0x5'));var db=require(_0x5356('0x6'))['db'];var utils=require(_0x5356('0x7'));var logger=require(_0x5356('0x8'))('rpc');var config=require(_0x5356('0x9'));var jayson=require(_0x5356('0xa'));var client=jayson[_0x5356('0xb')][_0x5356('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb32b50,_0x5c0770,_0x5a1761){return new BPromise(function(_0x13ba82,_0x3fb29e){return client['request'](_0xb32b50,_0x5a1761)['then'](function(_0xc3d93e){logger[_0x5356('0xd')](_0x5356('0xe'),_0x5c0770,'request\x20sent');logger['debug'](_0x5356('0xf'),_0x5c0770,_0x5356('0x10'),JSON['stringify'](_0xc3d93e));if(_0xc3d93e[_0x5356('0x11')]){if(_0xc3d93e['error'][_0x5356('0x12')]===0x1f4){logger[_0x5356('0x11')]('CmCompany,\x20%s,\x20%s',_0x5c0770,_0xc3d93e[_0x5356('0x11')]['message']);return _0x3fb29e(_0xc3d93e[_0x5356('0x11')]['message']);}logger[_0x5356('0x11')](_0x5356('0xe'),_0x5c0770,_0xc3d93e[_0x5356('0x11')][_0x5356('0x13')]);return _0x13ba82(_0xc3d93e[_0x5356('0x11')]['message']);}else{logger['info'](_0x5356('0xe'),_0x5c0770,_0x5356('0x10'));_0x13ba82(_0xc3d93e[_0x5356('0x14')][_0x5356('0x13')]);}})['catch'](function(_0x4ef6d5){logger[_0x5356('0x11')](_0x5356('0xe'),_0x5c0770,_0x4ef6d5);_0x3fb29e(_0x4ef6d5);});});} \ No newline at end of file +var _0x8ef9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash'];(function(_0x40d11b,_0x217dc5){var _0x3c3e13=function(_0x12e823){while(--_0x12e823){_0x40d11b['push'](_0x40d11b['shift']());}};_0x3c3e13(++_0x217dc5);}(_0x8ef9,0xd7));var _0x98ef=function(_0x5db17b,_0x9e71b1){_0x5db17b=_0x5db17b-0x0;var _0xcc4a8d=_0x8ef9[_0x5db17b];return _0xcc4a8d;};'use strict';var _=require(_0x98ef('0x0'));var util=require(_0x98ef('0x1'));var moment=require(_0x98ef('0x2'));var BPromise=require(_0x98ef('0x3'));var rs=require(_0x98ef('0x4'));var fs=require('fs');var Redis=require(_0x98ef('0x5'));var db=require(_0x98ef('0x6'))['db'];var utils=require(_0x98ef('0x7'));var logger=require(_0x98ef('0x8'))(_0x98ef('0x9'));var config=require(_0x98ef('0xa'));var jayson=require(_0x98ef('0xb'));var client=jayson[_0x98ef('0xc')][_0x98ef('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4bec03,_0x568860,_0x4ad311){return new BPromise(function(_0x4eea2b,_0x3188d1){return client['request'](_0x4bec03,_0x4ad311)[_0x98ef('0xe')](function(_0x2280ec){logger[_0x98ef('0xf')](_0x98ef('0x10'),_0x568860,_0x98ef('0x11'));logger[_0x98ef('0x12')](_0x98ef('0x13'),_0x568860,_0x98ef('0x11'),JSON[_0x98ef('0x14')](_0x2280ec));if(_0x2280ec[_0x98ef('0x15')]){if(_0x2280ec['error']['code']===0x1f4){logger[_0x98ef('0x15')]('CmCompany,\x20%s,\x20%s',_0x568860,_0x2280ec[_0x98ef('0x15')][_0x98ef('0x16')]);return _0x3188d1(_0x2280ec[_0x98ef('0x15')][_0x98ef('0x16')]);}logger['error'](_0x98ef('0x10'),_0x568860,_0x2280ec[_0x98ef('0x15')]['message']);return _0x4eea2b(_0x2280ec['error'][_0x98ef('0x16')]);}else{logger[_0x98ef('0xf')](_0x98ef('0x10'),_0x568860,_0x98ef('0x11'));_0x4eea2b(_0x2280ec[_0x98ef('0x17')][_0x98ef('0x16')]);}})['catch'](function(_0x53d447){logger[_0x98ef('0x15')](_0x98ef('0x10'),_0x568860,_0x53d447);_0x3188d1(_0x53d447);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 2c00742..0e7fcaf 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 _0x3f49=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/:id','isAuthenticated','/:id/contacts','post','addContacts','put','destroy'];(function(_0x2ca636,_0x4f4da1){var _0x168e73=function(_0x282200){while(--_0x282200){_0x2ca636['push'](_0x2ca636['shift']());}};_0x168e73(++_0x4f4da1);}(_0x3f49,0x1b9));var _0x93f4=function(_0x5534f0,_0x4841a1){_0x5534f0=_0x5534f0-0x0;var _0x5089dd=_0x3f49[_0x5534f0];return _0x5089dd;};'use strict';var multer=require(_0x93f4('0x0'));var util=require(_0x93f4('0x1'));var path=require(_0x93f4('0x2'));var timeout=require(_0x93f4('0x3'));var express=require('express');var router=express[_0x93f4('0x4')]();var fs_extra=require(_0x93f4('0x5'));var auth=require(_0x93f4('0x6'));var interaction=require(_0x93f4('0x7'));var config=require(_0x93f4('0x8'));var controller=require(_0x93f4('0x9'));router[_0x93f4('0xa')]('/',auth['isAuthenticated'](),controller[_0x93f4('0xb')]);router[_0x93f4('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x93f4('0xa')](_0x93f4('0xc'),auth[_0x93f4('0xd')](),controller['show']);router['get'](_0x93f4('0xe'),auth['isAuthenticated'](),controller['getContacts']);router[_0x93f4('0xf')]('/',auth[_0x93f4('0xd')](),controller['create']);router[_0x93f4('0xf')](_0x93f4('0xe'),auth[_0x93f4('0xd')](),controller[_0x93f4('0x10')]);router[_0x93f4('0x11')](_0x93f4('0xc'),auth[_0x93f4('0xd')](),controller['update']);router['delete']('/:id',auth[_0x93f4('0xd')](),controller[_0x93f4('0x12')]);module[_0x93f4('0x13')]=router; \ No newline at end of file +var _0xa195=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','/:id/contacts','addContacts','put','update','delete','exports','multer','util','path','express'];(function(_0x388914,_0x3c63f9){var _0x1f9111=function(_0x23dd69){while(--_0x23dd69){_0x388914['push'](_0x388914['shift']());}};_0x1f9111(++_0x3c63f9);}(_0xa195,0x13e));var _0x5a19=function(_0x5da106,_0x50b4c3){_0x5da106=_0x5da106-0x0;var _0x393e19=_0xa195[_0x5da106];return _0x393e19;};'use strict';var multer=require(_0x5a19('0x0'));var util=require(_0x5a19('0x1'));var path=require(_0x5a19('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a19('0x3'));var router=express[_0x5a19('0x4')]();var fs_extra=require(_0x5a19('0x5'));var auth=require(_0x5a19('0x6'));var interaction=require(_0x5a19('0x7'));var config=require('../../config/environment');var controller=require(_0x5a19('0x8'));router[_0x5a19('0x9')]('/',auth[_0x5a19('0xa')](),controller[_0x5a19('0xb')]);router['get'](_0x5a19('0xc'),auth[_0x5a19('0xa')](),controller[_0x5a19('0xd')]);router[_0x5a19('0x9')](_0x5a19('0xe'),auth[_0x5a19('0xa')](),controller[_0x5a19('0xf')]);router[_0x5a19('0x9')]('/:id/contacts',auth[_0x5a19('0xa')](),controller[_0x5a19('0x10')]);router['post']('/',auth[_0x5a19('0xa')](),controller['create']);router['post'](_0x5a19('0x11'),auth['isAuthenticated'](),controller[_0x5a19('0x12')]);router[_0x5a19('0x13')](_0x5a19('0xe'),auth[_0x5a19('0xa')](),controller[_0x5a19('0x14')]);router[_0x5a19('0x15')]('/:id',auth[_0x5a19('0xa')](),controller['destroy']);module[_0x5a19('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 edad918..5a3295a 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 _0x5c48=['exports','STRING','INTEGER','UNSIGNED','NOW'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0x5c48,0x1c7));var _0x85c4=function(_0x59055e,_0x5add8f){_0x59055e=_0x59055e-0x0;var _0xd6174b=_0x5c48[_0x59055e];return _0xd6174b;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x85c4('0x0')]={'firstName':{'type':Sequelize[_0x85c4('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x85c4('0x1')]},'street':{'type':Sequelize[_0x85c4('0x1')]},'postalCode':{'type':Sequelize[_0x85c4('0x1')]},'city':{'type':Sequelize[_0x85c4('0x1')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x85c4('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x85c4('0x1')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x85c4('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x85c4('0x1')]},'skype':{'type':Sequelize[_0x85c4('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x85c4('0x1')]},'wechat':{'type':Sequelize[_0x85c4('0x1')]},'telegram':{'type':Sequelize[_0x85c4('0x1')]},'UserId':{'type':Sequelize[_0x85c4('0x2')]},'AdditionalPhones':{'type':Sequelize[_0x85c4('0x1')]},'priority':{'type':Sequelize[_0x85c4('0x2')](0x2)[_0x85c4('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x85c4('0x4')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x85c4('0x2')]}}; \ No newline at end of file +var _0xfc4c=['INTEGER','lodash','sequelize','exports','STRING','UNSIGNED','NOW'];(function(_0x4fce48,_0x188ce1){var _0x2609c4=function(_0xb5a412){while(--_0xb5a412){_0x4fce48['push'](_0x4fce48['shift']());}};_0x2609c4(++_0x188ce1);}(_0xfc4c,0x104));var _0xcfc4=function(_0xcf97b,_0x27ee21){_0xcf97b=_0xcf97b-0x0;var _0x39bcdd=_0xfc4c[_0xcf97b];return _0x39bcdd;};'use strict';var _=require(_0xcfc4('0x0'));var Sequelize=require(_0xcfc4('0x1'));module[_0xcfc4('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xcfc4('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xcfc4('0x3')]},'country':{'type':Sequelize[_0xcfc4('0x3')]},'dateOfBirth':{'type':Sequelize[_0xcfc4('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xcfc4('0x3')]},'mobile':{'type':Sequelize[_0xcfc4('0x3')]},'fax':{'type':Sequelize[_0xcfc4('0x3')]},'email':{'type':Sequelize[_0xcfc4('0x3')]},'url':{'type':Sequelize[_0xcfc4('0x3')]},'facebook':{'type':Sequelize[_0xcfc4('0x3')]},'fb_data':{'type':Sequelize[_0xcfc4('0x3')]},'twitter':{'type':Sequelize[_0xcfc4('0x3')]},'skype':{'type':Sequelize[_0xcfc4('0x3')]},'teams':{'type':Sequelize[_0xcfc4('0x3')]},'viber':{'type':Sequelize[_0xcfc4('0x3')]},'line':{'type':Sequelize[_0xcfc4('0x3')]},'wechat':{'type':Sequelize[_0xcfc4('0x3')]},'telegram':{'type':Sequelize[_0xcfc4('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xcfc4('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xcfc4('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xcfc4('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 36def5b..dc3fc08 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 _0xbfcb=['fields','order','filter','include','rows','getHopperHistories','rawAttributes','ContactId','count','CmHopperFinal','pick','includeAll','getJscriptySessions','nolimit','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','User','agent','No\x20ListId\x20specified','binding','fork','stringify','start\x20child\x20process\x20correctly!','exit','importUpdates','../../components/import/cm/csvUpdates','message','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','toLowerCase','Invalid\x20channel','channel','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','VoiceCallReport','findAndCountAll','startCase','Website','closed','closedAt','disposition','thirdDisposition','Account','key','Owner','browserName','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','threadId','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','limit','set','Content-Range','update','destroy','sendStatus','stack','name','send','describe','then','findAll','query','user','catch','CmContact','find','params','tags','keys','cf_','columnName','analytics','CmCustomField','displayName','alias','custom','type','values','info','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','length','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsMessage','FaxInteraction','FaxMessage','CmContactHasItem','CmHopperHistory','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','create','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','spread','contact','all','show','Tags','color','tag','Phones','ItemType','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','startsWith','isEmpty','table','id\x20=\x20?','sequelize','text','phone','findOne','model','Tag','filters','intersection','attributes','sort','options','getTags','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','description','ItemTypeId','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','PHONE','CmHopperId','ItemType.OrderBy','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfcb,0x69));var _0xbbfc=function(_0x19707a,_0x46a4b1){_0x19707a=_0x19707a-0x0;var _0xa0f2b6=_0xbfcb[_0x19707a];return _0xa0f2b6;};'use strict';var moment=require(_0xbbfc('0x0'));var BPromise=require(_0xbbfc('0x1'));var util=require(_0xbbfc('0x2'));var path=require(_0xbbfc('0x3'));var fs=require('fs');var _=require(_0xbbfc('0x4'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xbbfc('0x5'));var contacts=require(_0xbbfc('0x6'));var qs=require(_0xbbfc('0x7'));var logger=require(_0xbbfc('0x8'))(_0xbbfc('0x9'));var config=require(_0xbbfc('0xa'));var shared=require(_0xbbfc('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xbbfc('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbbfc('0xd'))(new Redis(config['redis']));require(_0xbbfc('0xe'))['register'](socket);function respondWithResult(_0xdefebe,_0x46d591){_0x46d591=_0x46d591||0xc8;return function(_0x51c904){if(_0x51c904){return _0xdefebe[_0xbbfc('0xf')](_0x46d591)[_0xbbfc('0x10')](_0x51c904);}};}function respondWithFilteredResult(_0x417336,_0x434385){return function(_0xabf66e){if(_0xabf66e){var _0xf1685a=typeof _0x434385[_0xbbfc('0x11')]===_0xbbfc('0x12')&&typeof _0x434385[_0xbbfc('0x13')]===_0xbbfc('0x12');var _0x14988c=_0xabf66e['count'];var _0x5d1f90=_0xf1685a?0x0:_0x434385[_0xbbfc('0x11')];var _0x48fc76=_0xf1685a?_0xabf66e['count']:_0x434385[_0xbbfc('0x11')]+_0x434385['limit'];var _0xec846e;if(_0x48fc76>=_0x14988c){_0x48fc76=_0x14988c;_0xec846e=0xc8;}else{_0xec846e=0xce;}_0x417336['status'](_0xec846e);return _0x417336[_0xbbfc('0x14')](_0xbbfc('0x15'),_0x5d1f90+'-'+_0x48fc76+'/'+_0x14988c)[_0xbbfc('0x10')](_0xabf66e);}return null;};}function saveUpdates(_0x5a29c6){return function(_0x3ec825){if(_0x3ec825){return _0x3ec825[_0xbbfc('0x16')](_0x5a29c6)['then'](function(_0x4a5840){return _0x4a5840;});}return null;};}function removeEntity(_0x1342e6){return function(_0x280c4b){if(_0x280c4b){return _0x280c4b[_0xbbfc('0x17')]()['then'](function(){_0x1342e6[_0xbbfc('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a217b){return function(_0x29bc50){if(!_0x29bc50){_0x1a217b[_0xbbfc('0x18')](0x194);}return _0x29bc50;};}function handleError(_0x25c0cf,_0x4e9f06){_0x4e9f06=_0x4e9f06||0x1f4;return function(_0x2fed4a){logger['error'](_0x2fed4a[_0xbbfc('0x19')]);if(_0x2fed4a[_0xbbfc('0x1a')]){delete _0x2fed4a[_0xbbfc('0x1a')];}_0x25c0cf[_0xbbfc('0xf')](_0x4e9f06)[_0xbbfc('0x1b')](_0x2fed4a);};}exports['index']=function(_0x42242c,_0x521441){var _0x3a5521={};return contacts[_0xbbfc('0x1c')]()[_0xbbfc('0x1d')](function(_0x197a23){_0x3a5521=qs['getOptions'](_0x197a23,_0x42242c);return contacts[_0xbbfc('0x1e')](_0x42242c[_0xbbfc('0x1f')],_0x42242c[_0xbbfc('0x20')],_0x3a5521,_0x197a23);})[_0xbbfc('0x1d')](respondWithFilteredResult(_0x521441,_0x3a5521))[_0xbbfc('0x21')](handleError(_0x521441,null));};exports[_0xbbfc('0x17')]=function(_0x96d435,_0x5e888f){return db[_0xbbfc('0x22')][_0xbbfc('0x23')]({'where':{'id':_0x96d435[_0xbbfc('0x24')]['id']}})['then'](handleEntityNotFound(_0x5e888f,null))[_0xbbfc('0x1d')](removeEntity(_0x5e888f,null))[_0xbbfc('0x21')](handleError(_0x5e888f,null));};exports[_0xbbfc('0x1c')]=function(_0x512aae,_0x10010f){return db[_0xbbfc('0x22')][_0xbbfc('0x1c')]()[_0xbbfc('0x1d')](function(_0x35365b){delete _0x35365b[_0xbbfc('0x25')];for(var _0x2d2da3=0x0;_0x2d2da30x0){return new Promise(function(_0x57bbfd){var _0x23e0b4=[];for(var _0x54bad4=0x0;_0x54bad4<_0x2ec47f[_0xbbfc('0x39')];_0x54bad4++){_0x23e0b4[_0xbbfc('0x5b')](insertAdditionalPhones(_0x2ec47f[_0x54bad4][_0xbbfc('0x5e')],_0x2ec47f[_0x54bad4]['additionalPhones']));}Promise[_0xbbfc('0x5f')](_0x23e0b4)['then'](function(){_0x57bbfd(0x1);});})['then'](function(){return{'success':_0x33951d,'failure':_0x31e3dc,'duplicates':_0x26d673};});}else{return{'success':_0x33951d,'failure':_0x31e3dc,'duplicates':_0x26d673};}}})[_0xbbfc('0x1d')](respondWithResult(_0x5a027c,0xc9))[_0xbbfc('0x21')](handleError(_0x5a027c,null));};exports[_0xbbfc('0x60')]=function(_0x35b1b3,_0x19c1dd){var _0xc48479;return db[_0xbbfc('0x22')][_0xbbfc('0x1c')]()[_0xbbfc('0x1d')](function(_0x106bf4){return db['CmContact'][_0xbbfc('0x23')]({'where':{'id':_0x35b1b3[_0xbbfc('0x24')]['id']},'include':[{'model':db['Tag'],'as':_0xbbfc('0x61'),'attributes':['id',_0xbbfc('0x1a'),_0xbbfc('0x62')],'required':_0x35b1b3['query'][_0xbbfc('0x63')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0xbbfc('0x64'),'where':{'CmContactId':_0x35b1b3[_0xbbfc('0x24')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xbbfc('0x65')}]}],'order':[db['sequelize'][_0xbbfc('0x66')](_0xbbfc('0x67'))],'attributes':_[_0xbbfc('0x26')](_0x106bf4)});})['then'](function(_0x329155){if(!_[_0xbbfc('0x52')](_0x329155)){_0xc48479=_0x329155[_0xbbfc('0x36')]({'plain':!![]});var _0x2f9519={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x329155&&_0x329155[_0xbbfc('0x5c')]){if(_0x329155['ListId']){_0x2f9519[_0xbbfc('0x59')][_0xbbfc('0x68')][_0xbbfc('0x5b')]({'ListId':{'$ne':_0x329155[_0xbbfc('0x5c')]}});}}return db['CmCustomField'][_0xbbfc('0x1e')](_0x2f9519);}})[_0xbbfc('0x1d')](function(_0x87b8){if(!_[_0xbbfc('0x52')](_0x87b8)){return _[_0xbbfc('0x69')](_0xc48479,_[_0xbbfc('0x6a')](_0x87b8,function(_0x5e4c36){return util[_0xbbfc('0x6b')](_0xbbfc('0x6c'),_0x5e4c36['id']);}));}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x19c1dd,null))[_0xbbfc('0x1d')](respondWithResult(_0x19c1dd,null))[_0xbbfc('0x21')](handleError(_0x19c1dd,null));};exports[_0xbbfc('0x16')]=function(_0x40deed,_0x2d18a0){var _0x2a164c;if(_0x40deed[_0xbbfc('0x34')]['id']){delete _0x40deed['body']['id'];}if(!_[_0xbbfc('0x52')](_0x40deed[_0xbbfc('0x34')][_0xbbfc('0x51')])){var _0x382f5b=_0x40deed[_0xbbfc('0x34')]['dialTimezone'];if(!_['isNil'](shared[_0xbbfc('0x53')][_0x382f5b]))_0x40deed[_0xbbfc('0x34')][_0xbbfc('0x54')]=shared[_0xbbfc('0x53')][_0x382f5b][_0xbbfc('0x54')];}return db[_0xbbfc('0x22')]['find']({'where':{'id':_0x40deed[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x2d18a0,null))['then'](saveUpdates(_0x40deed[_0xbbfc('0x34')],null))[_0xbbfc('0x1d')](function(_0x2ab09b){_0x2a164c=_0x2ab09b;var _0x2981dc={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2ab09b&&_0x2ab09b[_0xbbfc('0x5c')]){if(_0x2ab09b[_0xbbfc('0x5c')]){_0x2981dc['where']['$and'][_0xbbfc('0x5b')]({'ListId':{'$ne':_0x2ab09b['ListId']}});}}return db[_0xbbfc('0x2a')][_0xbbfc('0x1e')](_0x2981dc);})['then'](function(_0x20db0d){if(_0x20db0d){return _[_0xbbfc('0x69')](_['pickBy'](_0x40deed['body'],function(_0xb25c03,_0x187588){return _[_0xbbfc('0x6d')](_0x187588,_0xbbfc('0x27'));}),_['map'](_0x20db0d,function(_0xf0afc6){return util['format'](_0xbbfc('0x6c'),_0xf0afc6['id']);}));}})['then'](function(_0x4682b4){if(_0x4682b4&&!_[_0xbbfc('0x6e')](_0x4682b4)){var _0x5d7cc5=squel[_0xbbfc('0x16')]()[_0xbbfc('0x6f')]('cm_contacts')['setFields'](_0x4682b4)[_0xbbfc('0x59')](_0xbbfc('0x70'),_0x40deed[_0xbbfc('0x24')]['id'])['toParam']();return db[_0xbbfc('0x71')][_0xbbfc('0x1f')](_0x5d7cc5[_0xbbfc('0x72')],{'replacements':_0x5d7cc5['values']});}})[_0xbbfc('0x1d')](function(){if(_0x40deed[_0xbbfc('0x34')][_0xbbfc('0x73')]&&_0x2a164c){return db[_0xbbfc('0x3c')][_0xbbfc('0x16')]({'phone':_0x40deed[_0xbbfc('0x34')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x2a164c['id']}});}})[_0xbbfc('0x1d')](function(){return _0x2a164c;})[_0xbbfc('0x1d')](respondWithResult(_0x2d18a0,null))[_0xbbfc('0x21')](handleError(_0x2d18a0,null));};exports['getTags']=function(_0x47bed2,_0x2c79a4){var _0x5893ca={};var _0x21f480={};var _0x2bd004;var _0x281cd9;return db['CmContact'][_0xbbfc('0x74')]({'where':{'id':_0x47bed2[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x2c79a4,null))[_0xbbfc('0x1d')](function(_0x1a9629){if(_0x1a9629){_0x2bd004=_0x1a9629;_0x21f480[_0xbbfc('0x75')]=_[_0xbbfc('0x26')](db[_0xbbfc('0x76')]['rawAttributes']);_0x21f480[_0xbbfc('0x1f')]=_[_0xbbfc('0x26')](_0x47bed2['query']);_0x21f480[_0xbbfc('0x77')]=_['intersection'](_0x21f480[_0xbbfc('0x75')],_0x21f480[_0xbbfc('0x1f')]);_0x5893ca['attributes']=_[_0xbbfc('0x78')](_0x21f480[_0xbbfc('0x75')],qs['fields'](_0x47bed2[_0xbbfc('0x1f')]['fields']));_0x5893ca[_0xbbfc('0x79')]=_0x5893ca[_0xbbfc('0x79')]['length']?_0x5893ca[_0xbbfc('0x79')]:_0x21f480[_0xbbfc('0x75')];_0x5893ca['order']=qs[_0xbbfc('0x7a')](_0x47bed2[_0xbbfc('0x1f')][_0xbbfc('0x7a')]);_0x5893ca[_0xbbfc('0x59')]=qs[_0xbbfc('0x77')](_['pick'](_0x47bed2[_0xbbfc('0x1f')],_0x21f480['filters']));if(_0x47bed2[_0xbbfc('0x1f')]['filter']){_0x5893ca['where']=_['merge'](_0x5893ca[_0xbbfc('0x59')],{'$or':_[_0xbbfc('0x6a')](_0x5893ca[_0xbbfc('0x79')],function(_0x188f2d){var _0x5f05ab={};_0x5f05ab[_0x188f2d]={'$like':'%'+_0x47bed2['query']['filter']+'%'};return _0x5f05ab;})});}_0x5893ca=_[_0xbbfc('0x33')]({},_0x5893ca,_0x47bed2[_0xbbfc('0x7b')]);return _0x2bd004[_0xbbfc('0x7c')](_0x5893ca);}})[_0xbbfc('0x1d')](function(_0x35bb3e){if(_0x35bb3e){_0x281cd9=_0x35bb3e[_0xbbfc('0x39')];if(!_0x47bed2['query'][_0xbbfc('0x32')]('nolimit')){_0x5893ca['limit']=qs[_0xbbfc('0x13')](_0x47bed2[_0xbbfc('0x1f')][_0xbbfc('0x13')]);_0x5893ca['offset']=qs['offset'](_0x47bed2[_0xbbfc('0x1f')][_0xbbfc('0x11')]);}return _0x2bd004[_0xbbfc('0x7c')](_0x5893ca);}})[_0xbbfc('0x1d')](function(_0x3ee6d7){if(_0x3ee6d7){return _0x3ee6d7?{'count':_0x281cd9,'rows':_0x3ee6d7}:null;}})[_0xbbfc('0x1d')](respondWithResult(_0x2c79a4,null))[_0xbbfc('0x21')](handleError(_0x2c79a4,null));};exports['setTags']=function(_0x16e884,_0x203451){if(_0x16e884[_0xbbfc('0x34')]['id']){delete _0x16e884['body']['id'];}return db['CmContact']['findOne']({'where':{'id':_0x16e884[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x203451,null))['then'](function(_0x36b8c3){if(_0x36b8c3){return _0x36b8c3[_0xbbfc('0x7d')](_0x16e884['body'][_0xbbfc('0x7e')]||[]);}return null;})[_0xbbfc('0x1d')](respondWithResult(_0x203451,null))[_0xbbfc('0x21')](handleError(_0x203451,null));};exports[_0xbbfc('0x7f')]=function(_0x222892,_0x2629b1){var _0x551e8b=[];_0x551e8b[_0xbbfc('0x5b')](addAdditionalPhones(_0x222892[_0xbbfc('0x34')]));Promise[_0xbbfc('0x5f')](_0x551e8b)['then'](function(){_0x551e8b=[];_0x551e8b['push'](deleteCmHopperPhones(_0x222892['body']['id']));_0x551e8b[_0xbbfc('0x5b')](addCmHopperPhones(_0x222892['body']['id']));Promise[_0xbbfc('0x5f')](_0x551e8b)[_0xbbfc('0x1d')](function(){return[0x1];})['then'](respondWithResult(_0x2629b1,null));});};function addAdditionalPhones(_0xd2f449){var _0x364619;return new Promise(function(_0x4ceab4){return db[_0xbbfc('0x48')][_0xbbfc('0x17')]({'where':{'CmContactId':_0xd2f449['id']}})[_0xbbfc('0x1d')](function(){db[_0xbbfc('0x80')]['findAll']({'raw':!![],'attributes':['id',_0xbbfc('0x81')]})['then'](function(_0x20021c){var _0x175c89=[];for(var _0x2aa451=0x0;_0x2aa451<_0xd2f449[_0xbbfc('0x82')]['length'];_0x2aa451++){var _0x22c591=_0xd2f449[_0xbbfc('0x83')]?_['isNil'](_0xd2f449[_0xbbfc('0x83')][_0x2aa451])?'':_0xd2f449[_0xbbfc('0x83')][_0x2aa451]:_0xd2f449['items'][_0x2aa451]['ItemTypeId']?_0xd2f449[_0xbbfc('0x82')][_0x2aa451]['ItemTypeId']:'';var _0x3408ce=_[_0xbbfc('0x52')](_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x84')])?'':_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x84')];var _0x4d6df4=_0x22c591+':'+_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x73')]+'§'+_0x3408ce;if(_[_0xbbfc('0x52')](_0x364619))_0x364619=_0x4d6df4;else _0x364619+=';'+_0x4d6df4;var _0x2dc418=null;var _0x20d846=null;if(_0xd2f449[_0xbbfc('0x83')]){if(!_['isNil'](_0xd2f449[_0xbbfc('0x83')][_0x2aa451])){_0x20d846=_[_0xbbfc('0x23')](_0x20021c,function(_0x32acae){return _0x32acae['id']===_0xd2f449['item_types'][_0x2aa451];});if(!_[_0xbbfc('0x52')](_0x20d846)){_0x2dc418=_0x20d846[_0xbbfc('0x81')];}}}else{if(!_['isNil'](_0xd2f449[_0xbbfc('0x82')][_0x2aa451])){_0x20d846=_['find'](_0x20021c,function(_0x2df28c){return _0x2df28c['id']===_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x85')];});if(!_['isNil'](_0x20d846)){_0x2dc418=_0x2aa451;}}}if(_[_0xbbfc('0x52')](_0x2dc418)){_0x2dc418=0x64;}_0x175c89[_0xbbfc('0x5b')](addAdditionalPhone(_0xd2f449['id'],_0xd2f449['items'][_0x2aa451][_0xbbfc('0x73')],_0xd2f449[_0xbbfc('0x83')]?_['isNil'](_0xd2f449[_0xbbfc('0x83')][_0x2aa451])?null:_0xd2f449['item_types'][_0x2aa451]:_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x85')]?_0xd2f449[_0xbbfc('0x82')][_0x2aa451][_0xbbfc('0x85')]:null,_0x2dc418,_0x3408ce));}Promise[_0xbbfc('0x5f')](_0x175c89)[_0xbbfc('0x1d')](function(){db['CmContact'][_0xbbfc('0x16')]({'AdditionalPhones':_0x364619},{'where':{'id':_0xd2f449['id']}})['then'](function(){_0x4ceab4(0x1);});});});});});}function addAdditionalPhone(_0x4d40b3,_0x131949,_0x383c89,_0x335544,_0x2618fa){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x4d40b3,'item':_0x131949}})[_0xbbfc('0x1d')](function(_0x559b38){if(_0x559b38)logger['info'](_0xbbfc('0x86'),_0x559b38);else{db['CmContactHasItem'][_0xbbfc('0x50')]({'CmContactId':_0x4d40b3,'item':_0x131949,'ItemTypeId':_0x383c89,'OrderBy':_0x335544,'ItemClass':'PHONE','description':_0x2618fa});}});}function deleteCmHopperPhones(_0x53142a){return new Promise(function(_0x4dec7b){return db[_0xbbfc('0x3c')][_0xbbfc('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x53142a}})[_0xbbfc('0x1d')](function(_0x53137e){db[_0xbbfc('0x87')]['destroy']({'where':{'CmHopperId':{'$in':_[_0xbbfc('0x6a')](_0x53137e,'id')}}});})[_0xbbfc('0x1d')](function(){_0x4dec7b(0x1);});});}function addCmHopperPhones(_0x979a9c){return new Promise(function(_0x5732ed){return db[_0xbbfc('0x3c')][_0xbbfc('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x979a9c}})[_0xbbfc('0x1d')](function(_0x31539d){var _0x4256e0=[];_[_0xbbfc('0x6a')](_0x31539d,function(_0x406288){_0x4256e0['push'](createCmHopperPhone(_0x979a9c,_0x406288['id']));});Promise[_0xbbfc('0x5f')](_0x4256e0)[_0xbbfc('0x1d')](function(){_0x5732ed(0x1);});});});}function createCmHopperPhone(_0xfd9f31,_0x119d3f){return new Promise(function(_0x59e461){db[_0xbbfc('0x48')][_0xbbfc('0x1e')]({'raw':!![],'attributes':[_0xbbfc('0x88'),_0xbbfc('0x81')],'where':{'CmContactId':_0xfd9f31,'ItemClass':_0xbbfc('0x89')},'include':[{'model':db[_0xbbfc('0x80')],'attributes':[_0xbbfc('0x81')],'as':_0xbbfc('0x65')}],'order':['OrderBy',db[_0xbbfc('0x71')][_0xbbfc('0x66')]('`ItemType`.OrderBy')]})[_0xbbfc('0x1d')](function(_0x48db8c){var _0x3da7e3=0x1;var _0x38368e=_[_0xbbfc('0x6a')](_0x48db8c,function(_0x473643){_0x473643[_0xbbfc('0x8a')]=_0x119d3f;_0x473643['phone']=_0x473643[_0xbbfc('0x88')];_0x473643[_0xbbfc('0x81')]=_0x3da7e3;delete _0x473643[_0xbbfc('0x8b')];_0x3da7e3=_0x3da7e3+0x1;return _0x473643;});return db['CmHopperAdditionalPhone'][_0xbbfc('0x56')](_0x38368e,{});})[_0xbbfc('0x1d')](function(){_0x59e461(0x1);});});}function insertAdditionalPhones(_0x107736,_0xa950c2){return new Promise(function(_0x204081){var _0x10ec50=[];for(var _0x4c9fd2=0x0;_0x4c9fd2<_0xa950c2[_0xbbfc('0x39')];_0x4c9fd2++){var _0x29480d=_0xa950c2[_0x4c9fd2];_0x10ec50[_0xbbfc('0x5b')](parseContactItemType(_0x29480d));}Promise[_0xbbfc('0x5f')](_0x10ec50)[_0xbbfc('0x1d')](function(){var _0x3606e0={'id':_0x107736['id'],'items':_0xa950c2};return addAdditionalPhones(_0x3606e0)['then'](function(){return addCmHopperPhones(_0x107736['id']);});})[_0xbbfc('0x1d')](function(){_0x204081(_0x107736);});});}function parseContactItemType(_0x23ea76){return new Promise(function(_0x217054){if(_0x23ea76[_0xbbfc('0x32')](_0xbbfc('0x85'))){_0x217054(_0x23ea76);}else{return db['ContactItemType'][_0xbbfc('0x23')]({'where':{'name':_0x23ea76[_0xbbfc('0x65')]}})[_0xbbfc('0x1d')](function(_0x41978a){if(_[_0xbbfc('0x52')](_0x41978a))_0x23ea76[_0xbbfc('0x85')]=null;else _0x23ea76['ItemTypeId']=_0x41978a['id'];_0x217054(_0x23ea76);});}});}exports[_0xbbfc('0x8c')]=function(_0xc3cc9e,_0x1c47c9){return db[_0xbbfc('0x48')]['findAll']({'raw':!![],'where':{'CmContactId':_0xc3cc9e[_0xbbfc('0x24')]['id'],'ItemClass':_0xbbfc('0x89')},'include':[{'model':db[_0xbbfc('0x80')],'as':'ItemType'}],'order':[[_0xbbfc('0x81')],[db[_0xbbfc('0x71')]['literal'](_0xbbfc('0x8d'))]]})['then'](function(_0x5ebbc4){return _0x5ebbc4;})[_0xbbfc('0x1d')](respondWithResult(_0x1c47c9,null))[_0xbbfc('0x21')](handleError(_0x1c47c9,null));};exports[_0xbbfc('0x8e')]=function(_0x55b6f8,_0x5702fd){return db[_0xbbfc('0x48')][_0xbbfc('0x1e')]({'raw':!![],'where':{'CmContactId':_0x55b6f8[_0xbbfc('0x34')][_0xbbfc('0x8f')]}})['then'](function(_0xeafb81){var _0x1b4071=_[_0xbbfc('0x6a')](_0xeafb81,function(_0x97b0e6){_0x97b0e6[_0xbbfc('0x90')]=_0x55b6f8['body']['toContactId'];return _0x97b0e6;});return db[_0xbbfc('0x48')]['bulkCreate'](_0x1b4071,{});})['then'](function(){return addCmHopperPhones(_0x55b6f8[_0xbbfc('0x34')][_0xbbfc('0x91')]);})['then'](function(){return['ok'];})['then'](respondWithResult(_0x5702fd,null))[_0xbbfc('0x21')](handleError(_0x5702fd,null));};exports[_0xbbfc('0x92')]=function(_0x3c81b7,_0x41360d){var _0x4c845a=[];_0x4c845a[_0xbbfc('0x5b')](createCmHopperPhone(_0x3c81b7[_0xbbfc('0x34')]['id'],_0x3c81b7['body']['hopperId']));Promise[_0xbbfc('0x5f')](_0x4c845a)[_0xbbfc('0x1d')](function(){return[0x1];})[_0xbbfc('0x1d')](respondWithResult(_0x41360d,null));};exports[_0xbbfc('0x93')]=function(_0x16d96e,_0x45b3c5){var _0x3fb92b={'raw':![],'where':{}};var _0x1f03b0={};var _0x560c51={'count':0x0,'rows':[]};return db[_0xbbfc('0x22')][_0xbbfc('0x74')]({'where':{'id':_0x16d96e['params']['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x45b3c5,null))[_0xbbfc('0x1d')](function(_0x295be5){if(_0x295be5){_0x1f03b0[_0xbbfc('0x75')]=_[_0xbbfc('0x26')](db[_0xbbfc('0x3c')]['rawAttributes']);_0x1f03b0[_0xbbfc('0x1f')]=_[_0xbbfc('0x26')](_0x16d96e[_0xbbfc('0x1f')]);_0x1f03b0[_0xbbfc('0x77')]=_[_0xbbfc('0x78')](_0x1f03b0[_0xbbfc('0x75')],_0x1f03b0[_0xbbfc('0x1f')]);_0x3fb92b[_0xbbfc('0x79')]=_[_0xbbfc('0x78')](_0x1f03b0['model'],qs[_0xbbfc('0x94')](_0x16d96e[_0xbbfc('0x1f')]['fields']));_0x3fb92b[_0xbbfc('0x79')]=_0x3fb92b[_0xbbfc('0x79')][_0xbbfc('0x39')]?_0x3fb92b[_0xbbfc('0x79')]:_0x1f03b0['model'];if(!_0x16d96e['query']['hasOwnProperty']('nolimit')){_0x3fb92b[_0xbbfc('0x13')]=qs[_0xbbfc('0x13')](_0x16d96e[_0xbbfc('0x1f')][_0xbbfc('0x13')]);_0x3fb92b['offset']=qs[_0xbbfc('0x11')](_0x16d96e[_0xbbfc('0x1f')][_0xbbfc('0x11')]);}_0x3fb92b[_0xbbfc('0x95')]=qs[_0xbbfc('0x7a')](_0x16d96e[_0xbbfc('0x1f')][_0xbbfc('0x7a')]);_0x3fb92b[_0xbbfc('0x59')]=qs[_0xbbfc('0x77')](_['pick'](_0x16d96e[_0xbbfc('0x1f')],_0x1f03b0[_0xbbfc('0x77')]));_0x3fb92b['where']['ContactId']=_0x295be5['id'];if(_0x16d96e[_0xbbfc('0x1f')][_0xbbfc('0x96')]){_0x3fb92b[_0xbbfc('0x59')]=_[_0xbbfc('0x33')](_0x3fb92b[_0xbbfc('0x59')],{'$or':_[_0xbbfc('0x6a')](_0x3fb92b['attributes'],function(_0x49db7d){var _0x531666={};_0x531666[_0x49db7d]={'$like':'%'+_0x16d96e[_0xbbfc('0x1f')][_0xbbfc('0x96')]+'%'};return _0x531666;})});}_0x3fb92b=_[_0xbbfc('0x33')]({},_0x3fb92b,_0x16d96e[_0xbbfc('0x7b')]);return db[_0xbbfc('0x3c')]['count']({'where':_0x3fb92b[_0xbbfc('0x59')]})[_0xbbfc('0x1d')](function(_0x445f0c){_0x560c51['count']=_0x445f0c;if(_0x16d96e['query']['includeAll']){_0x3fb92b[_0xbbfc('0x97')]=[{'all':!![]}];}return db[_0xbbfc('0x3c')][_0xbbfc('0x1e')](_0x3fb92b);})[_0xbbfc('0x1d')](function(_0x497d34){_0x560c51[_0xbbfc('0x98')]=_0x497d34;return _0x560c51;});}})[_0xbbfc('0x1d')](respondWithFilteredResult(_0x45b3c5,_0x3fb92b))[_0xbbfc('0x21')](handleError(_0x45b3c5,null));};exports[_0xbbfc('0x99')]=function(_0x310cbc,_0x77beec){var _0x4040c6={'raw':!![],'where':{}};var _0x10d0b4={};var _0x3813a1={'count':0x0,'rows':[]};return db[_0xbbfc('0x22')][_0xbbfc('0x74')]({'where':{'id':_0x310cbc[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x77beec,null))[_0xbbfc('0x1d')](function(_0x4586d3){if(_0x4586d3){_0x10d0b4[_0xbbfc('0x75')]=_[_0xbbfc('0x26')](db['CmHopperHistory'][_0xbbfc('0x9a')]);_0x10d0b4[_0xbbfc('0x1f')]=_[_0xbbfc('0x26')](_0x310cbc['query']);_0x10d0b4[_0xbbfc('0x77')]=_[_0xbbfc('0x78')](_0x10d0b4[_0xbbfc('0x75')],_0x10d0b4[_0xbbfc('0x1f')]);_0x4040c6[_0xbbfc('0x79')]=_['intersection'](_0x10d0b4[_0xbbfc('0x75')],qs['fields'](_0x310cbc[_0xbbfc('0x1f')][_0xbbfc('0x94')]));_0x4040c6[_0xbbfc('0x79')]=_0x4040c6['attributes'][_0xbbfc('0x39')]?_0x4040c6['attributes']:_0x10d0b4['model'];if(!_0x310cbc[_0xbbfc('0x1f')][_0xbbfc('0x32')]('nolimit')){_0x4040c6['limit']=qs[_0xbbfc('0x13')](_0x310cbc['query'][_0xbbfc('0x13')]);_0x4040c6[_0xbbfc('0x11')]=qs['offset'](_0x310cbc['query']['offset']);}_0x4040c6[_0xbbfc('0x95')]=qs[_0xbbfc('0x7a')](_0x310cbc[_0xbbfc('0x1f')][_0xbbfc('0x7a')]);_0x4040c6[_0xbbfc('0x59')]=qs[_0xbbfc('0x77')](_['pick'](_0x310cbc[_0xbbfc('0x1f')],_0x10d0b4[_0xbbfc('0x77')]));_0x4040c6[_0xbbfc('0x59')][_0xbbfc('0x9b')]=_0x4586d3['id'];if(_0x310cbc[_0xbbfc('0x1f')][_0xbbfc('0x96')]){_0x4040c6['where']=_['merge'](_0x4040c6[_0xbbfc('0x59')],{'$or':_[_0xbbfc('0x6a')](_0x4040c6['attributes'],function(_0x27d20a){var _0x35e260={};_0x35e260[_0x27d20a]={'$like':'%'+_0x310cbc[_0xbbfc('0x1f')][_0xbbfc('0x96')]+'%'};return _0x35e260;})});}_0x4040c6=_[_0xbbfc('0x33')]({},_0x4040c6,_0x310cbc[_0xbbfc('0x7b')]);return db['CmHopperHistory']['count']({'where':_0x4040c6[_0xbbfc('0x59')]})[_0xbbfc('0x1d')](function(_0x26b785){_0x3813a1[_0xbbfc('0x9c')]=_0x26b785;if(_0x310cbc[_0xbbfc('0x1f')]['includeAll']){_0x4040c6['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xbbfc('0x1e')](_0x4040c6);})[_0xbbfc('0x1d')](function(_0x36ff2f){_0x3813a1[_0xbbfc('0x98')]=_0x36ff2f;return _0x3813a1;});}})[_0xbbfc('0x1d')](respondWithFilteredResult(_0x77beec,_0x4040c6))['catch'](handleError(_0x77beec,null));};exports['getHopperFinals']=function(_0x51cd8d,_0x28298f){var _0x54dde0={'raw':!![],'where':{}};var _0x5e5782={};var _0x3ae4dc={'count':0x0,'rows':[]};return db['CmContact'][_0xbbfc('0x74')]({'where':{'id':_0x51cd8d[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x28298f,null))[_0xbbfc('0x1d')](function(_0x5127f1){if(_0x5127f1){_0x5e5782[_0xbbfc('0x75')]=_[_0xbbfc('0x26')](db[_0xbbfc('0x9d')][_0xbbfc('0x9a')]);_0x5e5782[_0xbbfc('0x1f')]=_[_0xbbfc('0x26')](_0x51cd8d['query']);_0x5e5782[_0xbbfc('0x77')]=_[_0xbbfc('0x78')](_0x5e5782[_0xbbfc('0x75')],_0x5e5782[_0xbbfc('0x1f')]);_0x54dde0[_0xbbfc('0x79')]=_[_0xbbfc('0x78')](_0x5e5782[_0xbbfc('0x75')],qs[_0xbbfc('0x94')](_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x94')]));_0x54dde0[_0xbbfc('0x79')]=_0x54dde0[_0xbbfc('0x79')][_0xbbfc('0x39')]?_0x54dde0[_0xbbfc('0x79')]:_0x5e5782[_0xbbfc('0x75')];if(!_0x51cd8d[_0xbbfc('0x1f')]['hasOwnProperty']('nolimit')){_0x54dde0[_0xbbfc('0x13')]=qs[_0xbbfc('0x13')](_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x13')]);_0x54dde0['offset']=qs[_0xbbfc('0x11')](_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x11')]);}_0x54dde0[_0xbbfc('0x95')]=qs[_0xbbfc('0x7a')](_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x7a')]);_0x54dde0[_0xbbfc('0x59')]=qs[_0xbbfc('0x77')](_[_0xbbfc('0x9e')](_0x51cd8d['query'],_0x5e5782[_0xbbfc('0x77')]));_0x54dde0[_0xbbfc('0x59')][_0xbbfc('0x9b')]=_0x5127f1['id'];if(_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x96')]){_0x54dde0[_0xbbfc('0x59')]=_[_0xbbfc('0x33')](_0x54dde0[_0xbbfc('0x59')],{'$or':_[_0xbbfc('0x6a')](_0x54dde0[_0xbbfc('0x79')],function(_0xe8d50c){var _0x4627d3={};_0x4627d3[_0xe8d50c]={'$like':'%'+_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x96')]+'%'};return _0x4627d3;})});}_0x54dde0=_[_0xbbfc('0x33')]({},_0x54dde0,_0x51cd8d[_0xbbfc('0x7b')]);return db['CmHopperFinal'][_0xbbfc('0x9c')]({'where':_0x54dde0[_0xbbfc('0x59')]})[_0xbbfc('0x1d')](function(_0x1cc6a5){_0x3ae4dc[_0xbbfc('0x9c')]=_0x1cc6a5;if(_0x51cd8d[_0xbbfc('0x1f')][_0xbbfc('0x9f')]){_0x54dde0['include']=[{'all':!![]}];}return db[_0xbbfc('0x9d')][_0xbbfc('0x1e')](_0x54dde0);})['then'](function(_0x3db340){_0x3ae4dc[_0xbbfc('0x98')]=_0x3db340;return _0x3ae4dc;});}})[_0xbbfc('0x1d')](respondWithFilteredResult(_0x28298f,_0x54dde0))[_0xbbfc('0x21')](handleError(_0x28298f,null));};exports[_0xbbfc('0xa0')]=function(_0x4c1f91,_0x281435){var _0x3df6fd={'raw':!![],'where':{}};var _0x2efd7e={};var _0x575b44={'count':0x0,'rows':[]};return db[_0xbbfc('0x22')][_0xbbfc('0x74')]({'where':{'id':_0x4c1f91[_0xbbfc('0x24')]['id']}})[_0xbbfc('0x1d')](handleEntityNotFound(_0x281435,null))[_0xbbfc('0x1d')](function(_0x289b9e){if(_0x289b9e){_0x2efd7e[_0xbbfc('0x75')]=_[_0xbbfc('0x26')](db[_0xbbfc('0x4d')][_0xbbfc('0x9a')]);_0x2efd7e[_0xbbfc('0x1f')]=_[_0xbbfc('0x26')](_0x4c1f91[_0xbbfc('0x1f')]);_0x2efd7e['filters']=_[_0xbbfc('0x78')](_0x2efd7e[_0xbbfc('0x75')],_0x2efd7e[_0xbbfc('0x1f')]);_0x3df6fd['attributes']=_['intersection'](_0x2efd7e[_0xbbfc('0x75')],qs[_0xbbfc('0x94')](_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x94')]));_0x3df6fd[_0xbbfc('0x79')]=_0x3df6fd['attributes'][_0xbbfc('0x39')]?_0x3df6fd[_0xbbfc('0x79')]:_0x2efd7e[_0xbbfc('0x75')];if(!_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x32')](_0xbbfc('0xa1'))){_0x3df6fd[_0xbbfc('0x13')]=qs[_0xbbfc('0x13')](_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x13')]);_0x3df6fd[_0xbbfc('0x11')]=qs[_0xbbfc('0x11')](_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x11')]);}_0x3df6fd['order']=qs[_0xbbfc('0x7a')](_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x7a')]);_0x3df6fd[_0xbbfc('0x59')]=qs['filters'](_[_0xbbfc('0x9e')](_0x4c1f91[_0xbbfc('0x1f')],_0x2efd7e[_0xbbfc('0x77')]));_0x3df6fd[_0xbbfc('0x59')][_0xbbfc('0x9b')]=_0x289b9e['id'];if(_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x96')]){_0x3df6fd[_0xbbfc('0x59')]=_[_0xbbfc('0x33')](_0x3df6fd[_0xbbfc('0x59')],{'$or':_[_0xbbfc('0x6a')](_0x3df6fd[_0xbbfc('0x79')],function(_0x471d74){var _0x472e97={};_0x472e97[_0x471d74]={'$like':'%'+_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x96')]+'%'};return _0x472e97;})});}_0x3df6fd=_['merge']({},_0x3df6fd,_0x4c1f91[_0xbbfc('0x7b')]);return db[_0xbbfc('0x4d')][_0xbbfc('0x9c')]({'where':_0x3df6fd[_0xbbfc('0x59')]})[_0xbbfc('0x1d')](function(_0x24104c){_0x575b44[_0xbbfc('0x9c')]=_0x24104c;if(_0x4c1f91[_0xbbfc('0x1f')][_0xbbfc('0x9f')]){_0x3df6fd[_0xbbfc('0x97')]=[{'all':!![]}];}return db[_0xbbfc('0x4d')][_0xbbfc('0x1e')](_0x3df6fd);})['then'](function(_0x169437){_0x575b44[_0xbbfc('0x98')]=_0x169437;return _0x575b44;});}})['then'](respondWithFilteredResult(_0x281435,_0x3df6fd))[_0xbbfc('0x21')](handleError(_0x281435,null));};exports[_0xbbfc('0xa2')]=function(_0x3415ae,_0x437553){try{if(!_0x3415ae['body'][_0xbbfc('0x5c')]){throw new Error('No\x20ListId\x20specified');}if(!_0x3415ae['body'][_0xbbfc('0xa3')]){throw new Error(_0xbbfc('0xa4'));}if(!_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xa5')]){throw new Error(_0xbbfc('0xa6'));}if(!_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x5058bc=_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xa3')][_0xbbfc('0xa8')](',');var _0x5d045e=_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xa5')][_0xbbfc('0xa8')](',');if(!_0x5058bc['length']||!_0x5d045e['length']||_0x5058bc[_0xbbfc('0x39')]!==_0x5d045e[_0xbbfc('0x39')]){throw new Error(_0xbbfc('0xa9'));}_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0x94')]=_['zipObject'](_0x5058bc,_0x5d045e);if(!_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0x94')][_0xbbfc('0x73')]){throw new Error(_0xbbfc('0xaa'));}if(!_0x3415ae[_0xbbfc('0x34')]['fields'][_0xbbfc('0xab')]){throw new Error(_0xbbfc('0xac'));}var _0x14e546=path['join'](config['root'],_0xbbfc('0xad'),_0x3415ae[_0xbbfc('0xae')]['filename']);fs['chmodSync'](_0x14e546,parseInt(_0xbbfc('0xaf'),0x8));var _0x47e377=require(_0xbbfc('0xb0'))['fork'](path[_0xbbfc('0x3a')](__dirname,_0xbbfc('0xb1')),[_0x14e546,_0x3415ae['body']['binding_keys'],_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xa5')],_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0x5c')],_0x3415ae[_0xbbfc('0x34')][_0xbbfc('0xb2')],_0x3415ae[_0xbbfc('0x34')]['duplicates'],_0x3415ae[_0xbbfc('0x34')]['socket_timestamp']]);return _0x437553[_0xbbfc('0xf')](0xc8)[_0xbbfc('0x10')]({'message':_0xbbfc('0xb3'),'pid':_0x47e377[_0xbbfc('0xb4')]});}catch(_0x31caa6){return _0x437553[_0xbbfc('0xf')](0x1f4)[_0xbbfc('0x1b')](_0x31caa6);}};exports[_0xbbfc('0xb5')]=function(_0x3cf89f,_0x12f1bd){var _0x32a30b=fs[_0xbbfc('0xb6')](_0x3cf89f[_0xbbfc('0xae')][_0xbbfc('0x3')]);Papa[_0xbbfc('0xb7')](_0x32a30b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x8c0ce8){return _0x12f1bd[_0xbbfc('0xf')](0xc8)[_0xbbfc('0x10')]({'file':_0x3cf89f['file'],'fields':_0x8c0ce8[_0xbbfc('0xb8')]['fields']});}});};exports[_0xbbfc('0xb9')]=function(_0x471f68,_0xd44aee){return db[_0xbbfc('0xba')][_0xbbfc('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbbfc('0xbb')}})[_0xbbfc('0x1d')](function(_0x50b4b3){var _0x1a76ef=![];if(!_0x471f68[_0xbbfc('0x34')][_0xbbfc('0x5c')]){throw new Error(_0xbbfc('0xbc'));}if(!_0x471f68['body'][_0xbbfc('0xbd')][_0xbbfc('0x73')]){throw new Error(_0xbbfc('0xaa'));}if(!_0x471f68[_0xbbfc('0x34')][_0xbbfc('0xbd')][_0xbbfc('0xab')]){throw new Error(_0xbbfc('0xac'));}if(!_0x471f68[_0xbbfc('0x34')][_0xbbfc('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x457c15=require(_0xbbfc('0xb0'))[_0xbbfc('0xbe')](path[_0xbbfc('0x3a')](__dirname,'../../components/import/cm/csv2'),[_0x471f68[_0xbbfc('0x24')]['id'],JSON['stringify'](_0x471f68[_0xbbfc('0x34')]),JSON[_0xbbfc('0xbf')](_0x50b4b3)]);_0x457c15['on']('message',function(){_0x1a76ef=!![];return _0xd44aee[_0xbbfc('0xf')](0xc8)[_0xbbfc('0x10')]({'message':_0xbbfc('0xc0'),'pid':_0x457c15['pid']});});_0x457c15['on'](_0xbbfc('0xc1'),function(_0x2b4048){if(_0x2b4048&&!_0x1a76ef){return _0xd44aee[_0xbbfc('0xf')](0x1f4)[_0xbbfc('0x10')]({'message':'error\x20child\x20process','pid':_0x457c15['pid']});}});})[_0xbbfc('0x21')](handleError(_0xd44aee,null));};exports[_0xbbfc('0xc2')]=function(_0x3bd632,_0x178ad8){return db[_0xbbfc('0xba')][_0xbbfc('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xbbfc('0xbb')}})[_0xbbfc('0x1d')](function(_0x372ffe){var _0x237e77=![];if(!_0x3bd632[_0xbbfc('0x34')][_0xbbfc('0x5c')]){throw new Error(_0xbbfc('0xbc'));}if(!_0x3bd632['body'][_0xbbfc('0xbd')][_0xbbfc('0x73')]){throw new Error(_0xbbfc('0xaa'));}if(!_0x3bd632['body'][_0xbbfc('0xbd')][_0xbbfc('0xab')]){throw new Error(_0xbbfc('0xac'));}if(!_0x3bd632[_0xbbfc('0x34')][_0xbbfc('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x9d2b6c=require(_0xbbfc('0xb0'))[_0xbbfc('0xbe')](path['join'](__dirname,_0xbbfc('0xc3')),[_0x3bd632[_0xbbfc('0x24')]['id'],JSON['stringify'](_0x3bd632[_0xbbfc('0x34')]),JSON['stringify'](_0x372ffe)]);_0x9d2b6c['on'](_0xbbfc('0xc4'),function(){_0x237e77=!![];return _0x178ad8['status'](0xc8)[_0xbbfc('0x10')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x9d2b6c['pid']});});_0x9d2b6c['on']('exit',function(_0x5f116f){if(_0x5f116f&&!_0x237e77){return _0x178ad8[_0xbbfc('0xf')](0x1f4)[_0xbbfc('0x10')]({'message':_0xbbfc('0xc5'),'pid':_0x9d2b6c[_0xbbfc('0xb4')]});}});})[_0xbbfc('0x21')](handleError(_0x178ad8,null));};exports[_0xbbfc('0xc6')]=function(_0x26cef6,_0x486e79){var _0xf10e4f=[_0xbbfc('0xc7'),_0xbbfc('0xc8'),_0xbbfc('0xc9'),_0xbbfc('0xca'),_0xbbfc('0xcb'),_0xbbfc('0xcc'),_0xbbfc('0xcd')];var _0x4267c3={'offset':0x0,'order':qs['sort'](_0xbbfc('0xce'))},_0x2cb34c={'count':0x0,'rows':[]};Promise['resolve']()['then'](function(){if(_0x26cef6['query']['channel']){if(!_['includes'](_0xf10e4f,_0x26cef6[_0xbbfc('0x1f')]['channel'][_0xbbfc('0xcf')]())){throw new Error(_0xbbfc('0xd0'));}_0xf10e4f=[_0x26cef6[_0xbbfc('0x1f')][_0xbbfc('0xd1')][_0xbbfc('0xcf')]()];}if(_0x26cef6['query'][_0xbbfc('0xd2')]){try{var _0x524864=JSON['parse'](_0x26cef6[_0xbbfc('0x1f')][_0xbbfc('0xd2')]);if(!moment(_0x524864[_0xbbfc('0x35')])[_0xbbfc('0xd3')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x524864['to'])['isValid']()){throw new Error(_0xbbfc('0xd4'));}}catch(_0x303a8e){throw new Error(_0xbbfc('0xd5'));}}if(!_0x26cef6[_0xbbfc('0x1f')][_0xbbfc('0x32')](_0xbbfc('0xa1'))){_0x4267c3['limit']=qs['limit'](_0x26cef6['query'][_0xbbfc('0x13')]||0xa);_0x4267c3[_0xbbfc('0x11')]=qs[_0xbbfc('0x11')](_0x26cef6['query']['offset']);}var _0x88d0a8=_0xf10e4f[_0xbbfc('0x6a')](function(_0x56754c){if(_0x56754c===_0xbbfc('0xcd')){var _0x3daad2={'attributes':['id','uniqueid',_0xbbfc('0x2e'),_0xbbfc('0xd6'),_0xbbfc('0xd7'),_0xbbfc('0xd8'),_0xbbfc('0xd9'),'endtime',_0xbbfc('0xda'),_0xbbfc('0xdb'),_0xbbfc('0xdc'),_0xbbfc('0xdd'),_0xbbfc('0xde'),_0xbbfc('0xdf'),_0xbbfc('0xe0')],'where':{'ContactId':_0x26cef6['params']['id']},'include':[{'model':db[_0xbbfc('0xba')],'as':_0xbbfc('0xba'),'attributes':['id',_0xbbfc('0x1a'),_0xbbfc('0xe1'),_0xbbfc('0x2c')]}],'order':[['createdAt',_0xbbfc('0xe2')]]};if(_0x26cef6[_0xbbfc('0x1f')][_0xbbfc('0xd2')]){_0x3daad2[_0xbbfc('0x59')][_0xbbfc('0xdc')]={'$gte':_0x524864[_0xbbfc('0x35')],'$lte':_0x524864['to']};}return db[_0xbbfc('0xe3')][_0xbbfc('0xe4')](_0x3daad2)[_0xbbfc('0x1d')](function(_0xb5bbb0){_0x2cb34c[_0xbbfc('0x9c')]+=_0xb5bbb0[_0xbbfc('0x9c')];return _[_0xbbfc('0x6a')](_0xb5bbb0[_0xbbfc('0x98')],function(_0xdc2c3d){var _0x4903d1=_0xdc2c3d[_0xbbfc('0x36')]({'plain':!![]});_0x4903d1[_0xbbfc('0xd1')]=_0x56754c;if(_0x4903d1['User']){_0x4903d1[_0xbbfc('0xba')]={'id':_0x4903d1[_0xbbfc('0xba')]['id'],'name':_0x4903d1[_0xbbfc('0xba')][_0xbbfc('0x1a')],'fullname':_0x4903d1[_0xbbfc('0xba')]['fullname'],'alias':_0x4903d1[_0xbbfc('0xba')]['alias']};}return _0x4903d1;});});}else{var _0x29586=_[_0xbbfc('0xe5')](_0x56754c)+(_0x56754c===_0xbbfc('0xc8')?_0xbbfc('0xe6'):'Account');var _0x5de7a2={'attributes':['id',_0xbbfc('0xe7'),_0xbbfc('0xe8'),_0xbbfc('0xdc'),'note',_0xbbfc('0xe9'),'secondDisposition',_0xbbfc('0xea'),_0xbbfc('0xe0'),_0x29586+'Id'],'where':{'ContactId':_0x26cef6['params']['id']},'include':[{'model':db[_0x29586],'as':_0xbbfc('0xeb'),'attributes':['id','name',_0xbbfc('0xec')]},{'model':db['User'],'as':_0xbbfc('0xed'),'attributes':['id',_0xbbfc('0x1a'),_0xbbfc('0xe1')]},{'model':db[_0xbbfc('0x76')],'as':_0xbbfc('0x61'),'attributes':['id',_0xbbfc('0x1a'),_0xbbfc('0x62')],'through':{'attributes':[]}}],'order':[['createdAt',_0xbbfc('0xe2')]]};if(_0x26cef6[_0xbbfc('0x1f')]['range']){_0x5de7a2['where'][_0xbbfc('0xdc')]={'$gte':_0x524864[_0xbbfc('0x35')],'$lte':_0x524864['to']};}switch(_0x56754c){case _0xbbfc('0xc8'):_0x5de7a2['attributes']['push'](_0xbbfc('0xee'),'customerIp',_0xbbfc('0xef'),_0xbbfc('0xf0'),'osName',_0xbbfc('0xf1'),_0xbbfc('0xf2'),_0xbbfc('0xf3'),_0xbbfc('0xf4'));break;case _0xbbfc('0xc7'):_0x5de7a2['attributes']['push'](_0xbbfc('0xf5'),'substatus');break;case'openchannel':_0x5de7a2[_0xbbfc('0x79')][_0xbbfc('0x5b')]('externalUrl',_0xbbfc('0xf6'));break;}return db[_[_0xbbfc('0xe5')](_0x56754c)+_0xbbfc('0xf7')][_0xbbfc('0xe4')](_0x5de7a2)[_0xbbfc('0x1d')](function(_0x17875a){_0x2cb34c['count']+=_0x17875a[_0xbbfc('0x9c')];return _[_0xbbfc('0x6a')](_0x17875a[_0xbbfc('0x98')],function(_0x2278af){var _0x360769=_0x2278af['get']({'plain':!![]});_0x360769['channel']=_0x56754c;if(_0x360769['Owner']){_0x360769[_0xbbfc('0xed')]={'id':_0x360769[_0xbbfc('0xed')]['id'],'name':_0x360769[_0xbbfc('0xed')][_0xbbfc('0x1a')],'fullname':_0x360769[_0xbbfc('0xed')][_0xbbfc('0xe1')]};}return _0x360769;});});}});return Promise[_0xbbfc('0x5f')](_0x88d0a8);})[_0xbbfc('0x1d')](function(_0x5f38f7){return _(_0x5f38f7)[_0xbbfc('0xf8')]()[_0xbbfc('0xf9')](_0xbbfc('0xdc'))[_0xbbfc('0xfa')]()[_0xbbfc('0xfb')]();})[_0xbbfc('0x1d')](function(_0x166a04){_0x2cb34c[_0xbbfc('0x98')]=_0x4267c3[_0xbbfc('0x13')]?_0x166a04[_0xbbfc('0xfc')](_0x4267c3['offset'],_0x4267c3[_0xbbfc('0x11')]+_0x4267c3[_0xbbfc('0x13')]):_0x166a04;return _0x2cb34c;})[_0xbbfc('0x1d')](respondWithFilteredResult(_0x486e79,_0x4267c3))[_0xbbfc('0x21')](handleError(_0x486e79,null));}; \ No newline at end of file +var _0x5fa5=['customerIp','deviceModel','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','Owner','flatten','reverse','slice','moment','bluebird','path','lodash','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','redis','defaults','localhost','./cmContact.socket','json','offset','undefined','limit','count','status','set','update','then','sendStatus','error','name','index','describe','findAll','query','user','catch','destroy','CmContact','params','tags','keys','length','startsWith','cf_','columnName','displayName','alias','custom','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','WhatsappInteraction','isNil','dialTimezone','utcOffset','additionalPhones','duplicates','where','$or','ListId','spread','push','all','show','find','Tag','Tags','Phones','ItemType','sequelize','Phones.OrderBy','$and','CmCustomField','omit','map','format','timezones','pickBy','table','cm_contacts','setFields','id\x20=\x20?','phone','CmHopper','getTags','findOne','model','rawAttributes','filters','attributes','intersection','fields','order','sort','pick','filter','options','setTags','ids','setAdditionalPhones','CmContactHasItem','OrderBy','item_types','items','ItemTypeId','description','item','PHONE','ContactItemType','literal','`ItemType`.OrderBy','CmHopperId','CmHopperAdditionalPhone','fromContactId','CmContactId','toContactId','bulkCreate','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','ContactId','includeAll','include','rows','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','socket_timestamp','pid','send','meta','User','binding','firstName','No\x20firstName\x20column\x20specified','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','agent','../../components/import/cm/csvUpdates','getJourney','sms','fax','whatsapp','resolve','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','voice','source','destination','callerid','starttime','duration','userSecondDisposition','UserId','fullname','createdAt','DESC','findAndCountAll','channel','startCase','chat','Website','Account','note','disposition','secondDisposition','thirdDisposition','key','color'];(function(_0x3e4fa5,_0x2cbc12){var _0x1141ff=function(_0x295dce){while(--_0x295dce){_0x3e4fa5['push'](_0x3e4fa5['shift']());}};_0x1141ff(++_0x2cbc12);}(_0x5fa5,0x1e8));var _0x55fa=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x5fa5[_0x45d55e];return _0x29812a;};'use strict';var moment=require(_0x55fa('0x0'));var BPromise=require(_0x55fa('0x1'));var util=require('util');var path=require(_0x55fa('0x2'));var fs=require('fs');var _=require(_0x55fa('0x3'));var squel=require('squel');var Papa=require(_0x55fa('0x4'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0x55fa('0x5'));var logger=require(_0x55fa('0x6'))(_0x55fa('0x7'));var config=require(_0x55fa('0x8'));var shared=require(_0x55fa('0x9'));var db=require('../../mysqldb')['db'];config[_0x55fa('0xa')]=_[_0x55fa('0xb')](config['redis'],{'host':_0x55fa('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55fa('0xa')]));require(_0x55fa('0xd'))['register'](socket);function respondWithResult(_0x4b692d,_0x4e24e3){_0x4e24e3=_0x4e24e3||0xc8;return function(_0x3fac89){if(_0x3fac89){return _0x4b692d['status'](_0x4e24e3)[_0x55fa('0xe')](_0x3fac89);}};}function respondWithFilteredResult(_0xaae41b,_0x572a61){return function(_0x11abef){if(_0x11abef){var _0x16c58f=typeof _0x572a61[_0x55fa('0xf')]===_0x55fa('0x10')&&typeof _0x572a61[_0x55fa('0x11')]===_0x55fa('0x10');var _0x2081a5=_0x11abef[_0x55fa('0x12')];var _0x57f2d9=_0x16c58f?0x0:_0x572a61[_0x55fa('0xf')];var _0x46cbe6=_0x16c58f?_0x11abef['count']:_0x572a61[_0x55fa('0xf')]+_0x572a61['limit'];var _0x5d7fa3;if(_0x46cbe6>=_0x2081a5){_0x46cbe6=_0x2081a5;_0x5d7fa3=0xc8;}else{_0x5d7fa3=0xce;}_0xaae41b[_0x55fa('0x13')](_0x5d7fa3);return _0xaae41b[_0x55fa('0x14')]('Content-Range',_0x57f2d9+'-'+_0x46cbe6+'/'+_0x2081a5)[_0x55fa('0xe')](_0x11abef);}return null;};}function saveUpdates(_0x4b0ff2){return function(_0x30549e){if(_0x30549e){return _0x30549e[_0x55fa('0x15')](_0x4b0ff2)[_0x55fa('0x16')](function(_0x22d942){return _0x22d942;});}return null;};}function removeEntity(_0x17eb47){return function(_0x576152){if(_0x576152){return _0x576152['destroy']()[_0x55fa('0x16')](function(){_0x17eb47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bceaa){return function(_0x5e55d3){if(!_0x5e55d3){_0x4bceaa[_0x55fa('0x17')](0x194);}return _0x5e55d3;};}function handleError(_0x3b626f,_0x426c79){_0x426c79=_0x426c79||0x1f4;return function(_0x535f92){logger[_0x55fa('0x18')](_0x535f92['stack']);if(_0x535f92[_0x55fa('0x19')]){delete _0x535f92['name'];}_0x3b626f[_0x55fa('0x13')](_0x426c79)['send'](_0x535f92);};}exports[_0x55fa('0x1a')]=function(_0xcaad16,_0x49cc60){var _0x29f16b={};return contacts[_0x55fa('0x1b')]()['then'](function(_0x25dc26){_0x29f16b=qs['getOptions'](_0x25dc26,_0xcaad16);return contacts[_0x55fa('0x1c')](_0xcaad16[_0x55fa('0x1d')],_0xcaad16[_0x55fa('0x1e')],_0x29f16b,_0x25dc26);})[_0x55fa('0x16')](respondWithFilteredResult(_0x49cc60,_0x29f16b))[_0x55fa('0x1f')](handleError(_0x49cc60,null));};exports[_0x55fa('0x20')]=function(_0x33aae8,_0x3d5768){return db[_0x55fa('0x21')]['find']({'where':{'id':_0x33aae8[_0x55fa('0x22')]['id']}})[_0x55fa('0x16')](handleEntityNotFound(_0x3d5768,null))[_0x55fa('0x16')](removeEntity(_0x3d5768,null))[_0x55fa('0x1f')](handleError(_0x3d5768,null));};exports[_0x55fa('0x1b')]=function(_0x3f95fc,_0x2d9b35){return db[_0x55fa('0x21')][_0x55fa('0x1b')]()[_0x55fa('0x16')](function(_0xd01917){delete _0xd01917[_0x55fa('0x23')];for(var _0x203791=0x0;_0x2037910x0){return new Promise(function(_0xfe4c6a){var _0x4b404a=[];for(var _0x4305f3=0x0;_0x4305f3<_0x2abe20[_0x55fa('0x25')];_0x4305f3++){_0x4b404a[_0x55fa('0x56')](insertAdditionalPhones(_0x2abe20[_0x4305f3]['contact'],_0x2abe20[_0x4305f3][_0x55fa('0x50')]));}Promise[_0x55fa('0x57')](_0x4b404a)[_0x55fa('0x16')](function(){_0xfe4c6a(0x1);});})[_0x55fa('0x16')](function(){return{'success':_0x142d4f,'failure':_0x2044fd,'duplicates':_0x2a66c9};});}else{return{'success':_0x142d4f,'failure':_0x2044fd,'duplicates':_0x2a66c9};}}})['then'](respondWithResult(_0x42235e,0xc9))['catch'](handleError(_0x42235e,null));};exports[_0x55fa('0x58')]=function(_0x49e574,_0x48826c){var _0x28a3ea;return db[_0x55fa('0x21')][_0x55fa('0x1b')]()[_0x55fa('0x16')](function(_0x201146){return db[_0x55fa('0x21')][_0x55fa('0x59')]({'where':{'id':_0x49e574[_0x55fa('0x22')]['id']},'include':[{'model':db[_0x55fa('0x5a')],'as':_0x55fa('0x5b'),'attributes':['id',_0x55fa('0x19'),'color'],'required':_0x49e574[_0x55fa('0x1d')]['tag']?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x55fa('0x5c'),'where':{'CmContactId':_0x49e574[_0x55fa('0x22')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x55fa('0x5d')}]}],'order':[db[_0x55fa('0x5e')]['literal'](_0x55fa('0x5f'))],'attributes':_[_0x55fa('0x24')](_0x201146)});})[_0x55fa('0x16')](function(_0x301299){if(!_[_0x55fa('0x4d')](_0x301299)){_0x28a3ea=_0x301299['get']({'plain':!![]});var _0xb3433c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x301299&&_0x301299[_0x55fa('0x54')]){if(_0x301299[_0x55fa('0x54')]){_0xb3433c[_0x55fa('0x52')][_0x55fa('0x60')][_0x55fa('0x56')]({'ListId':{'$ne':_0x301299[_0x55fa('0x54')]}});}}return db[_0x55fa('0x61')][_0x55fa('0x1c')](_0xb3433c);}})['then'](function(_0x40455f){if(!_[_0x55fa('0x4d')](_0x40455f)){return _[_0x55fa('0x62')](_0x28a3ea,_[_0x55fa('0x63')](_0x40455f,function(_0x4305a8){return util[_0x55fa('0x64')]('cf_%d',_0x4305a8['id']);}));}})[_0x55fa('0x16')](handleEntityNotFound(_0x48826c,null))[_0x55fa('0x16')](respondWithResult(_0x48826c,null))[_0x55fa('0x1f')](handleError(_0x48826c,null));};exports[_0x55fa('0x15')]=function(_0x54aec7,_0x180d5d){var _0x55326d;if(_0x54aec7[_0x55fa('0x32')]['id']){delete _0x54aec7[_0x55fa('0x32')]['id'];}if(!_[_0x55fa('0x4d')](_0x54aec7[_0x55fa('0x32')][_0x55fa('0x4e')])){var _0x43abd9=_0x54aec7[_0x55fa('0x32')][_0x55fa('0x4e')];if(!_[_0x55fa('0x4d')](shared[_0x55fa('0x65')][_0x43abd9]))_0x54aec7[_0x55fa('0x32')][_0x55fa('0x4f')]=shared[_0x55fa('0x65')][_0x43abd9][_0x55fa('0x4f')];}return db['CmContact'][_0x55fa('0x59')]({'where':{'id':_0x54aec7[_0x55fa('0x22')]['id']}})[_0x55fa('0x16')](handleEntityNotFound(_0x180d5d,null))['then'](saveUpdates(_0x54aec7[_0x55fa('0x32')],null))[_0x55fa('0x16')](function(_0x4f1194){_0x55326d=_0x4f1194;var _0x16c9e7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4f1194&&_0x4f1194[_0x55fa('0x54')]){if(_0x4f1194[_0x55fa('0x54')]){_0x16c9e7['where'][_0x55fa('0x60')][_0x55fa('0x56')]({'ListId':{'$ne':_0x4f1194['ListId']}});}}return db[_0x55fa('0x61')][_0x55fa('0x1c')](_0x16c9e7);})[_0x55fa('0x16')](function(_0xcfbd10){if(_0xcfbd10){return _[_0x55fa('0x62')](_[_0x55fa('0x66')](_0x54aec7[_0x55fa('0x32')],function(_0x3f758c,_0x568ce5){return _[_0x55fa('0x26')](_0x568ce5,'cf_');}),_[_0x55fa('0x63')](_0xcfbd10,function(_0x57c9b7){return util[_0x55fa('0x64')]('cf_%d',_0x57c9b7['id']);}));}})[_0x55fa('0x16')](function(_0x198a5b){if(_0x198a5b&&!_['isEmpty'](_0x198a5b)){var _0x147429=squel['update']()[_0x55fa('0x67')](_0x55fa('0x68'))[_0x55fa('0x69')](_0x198a5b)['where'](_0x55fa('0x6a'),_0x54aec7[_0x55fa('0x22')]['id'])['toParam']();return db[_0x55fa('0x5e')][_0x55fa('0x1d')](_0x147429['text'],{'replacements':_0x147429[_0x55fa('0x2c')]});}})[_0x55fa('0x16')](function(){if(_0x54aec7['body'][_0x55fa('0x6b')]&&_0x55326d){return db[_0x55fa('0x6c')][_0x55fa('0x15')]({'phone':_0x54aec7[_0x55fa('0x32')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x55326d['id']}});}})[_0x55fa('0x16')](function(){return _0x55326d;})[_0x55fa('0x16')](respondWithResult(_0x180d5d,null))[_0x55fa('0x1f')](handleError(_0x180d5d,null));};exports[_0x55fa('0x6d')]=function(_0x729670,_0x5c3bbc){var _0x57d0fc={};var _0x25c5a9={};var _0x5b0f15;var _0x246040;return db[_0x55fa('0x21')][_0x55fa('0x6e')]({'where':{'id':_0x729670[_0x55fa('0x22')]['id']}})['then'](handleEntityNotFound(_0x5c3bbc,null))[_0x55fa('0x16')](function(_0x5b9dcd){if(_0x5b9dcd){_0x5b0f15=_0x5b9dcd;_0x25c5a9[_0x55fa('0x6f')]=_[_0x55fa('0x24')](db[_0x55fa('0x5a')][_0x55fa('0x70')]);_0x25c5a9['query']=_[_0x55fa('0x24')](_0x729670['query']);_0x25c5a9[_0x55fa('0x71')]=_['intersection'](_0x25c5a9['model'],_0x25c5a9['query']);_0x57d0fc[_0x55fa('0x72')]=_[_0x55fa('0x73')](_0x25c5a9[_0x55fa('0x6f')],qs[_0x55fa('0x74')](_0x729670[_0x55fa('0x1d')][_0x55fa('0x74')]));_0x57d0fc[_0x55fa('0x72')]=_0x57d0fc['attributes']['length']?_0x57d0fc[_0x55fa('0x72')]:_0x25c5a9['model'];_0x57d0fc[_0x55fa('0x75')]=qs['sort'](_0x729670[_0x55fa('0x1d')][_0x55fa('0x76')]);_0x57d0fc[_0x55fa('0x52')]=qs[_0x55fa('0x71')](_[_0x55fa('0x77')](_0x729670[_0x55fa('0x1d')],_0x25c5a9[_0x55fa('0x71')]));if(_0x729670['query'][_0x55fa('0x78')]){_0x57d0fc[_0x55fa('0x52')]=_[_0x55fa('0x31')](_0x57d0fc[_0x55fa('0x52')],{'$or':_['map'](_0x57d0fc['attributes'],function(_0x4ce744){var _0x126c3f={};_0x126c3f[_0x4ce744]={'$like':'%'+_0x729670[_0x55fa('0x1d')]['filter']+'%'};return _0x126c3f;})});}_0x57d0fc=_[_0x55fa('0x31')]({},_0x57d0fc,_0x729670[_0x55fa('0x79')]);return _0x5b0f15[_0x55fa('0x6d')](_0x57d0fc);}})[_0x55fa('0x16')](function(_0x4cf8b8){if(_0x4cf8b8){_0x246040=_0x4cf8b8[_0x55fa('0x25')];if(!_0x729670[_0x55fa('0x1d')][_0x55fa('0x30')]('nolimit')){_0x57d0fc['limit']=qs[_0x55fa('0x11')](_0x729670['query'][_0x55fa('0x11')]);_0x57d0fc[_0x55fa('0xf')]=qs[_0x55fa('0xf')](_0x729670['query'][_0x55fa('0xf')]);}return _0x5b0f15[_0x55fa('0x6d')](_0x57d0fc);}})[_0x55fa('0x16')](function(_0x353c7e){if(_0x353c7e){return _0x353c7e?{'count':_0x246040,'rows':_0x353c7e}:null;}})[_0x55fa('0x16')](respondWithResult(_0x5c3bbc,null))[_0x55fa('0x1f')](handleError(_0x5c3bbc,null));};exports[_0x55fa('0x7a')]=function(_0x1196b3,_0x591c97){if(_0x1196b3[_0x55fa('0x32')]['id']){delete _0x1196b3['body']['id'];}return db['CmContact']['findOne']({'where':{'id':_0x1196b3['params']['id']}})[_0x55fa('0x16')](handleEntityNotFound(_0x591c97,null))[_0x55fa('0x16')](function(_0x1ba218){if(_0x1ba218){return _0x1ba218[_0x55fa('0x7a')](_0x1196b3[_0x55fa('0x32')][_0x55fa('0x7b')]||[]);}return null;})[_0x55fa('0x16')](respondWithResult(_0x591c97,null))['catch'](handleError(_0x591c97,null));};exports[_0x55fa('0x7c')]=function(_0x55cafc,_0x44aa9e){var _0x5268ca=[];_0x5268ca[_0x55fa('0x56')](addAdditionalPhones(_0x55cafc[_0x55fa('0x32')]));Promise[_0x55fa('0x57')](_0x5268ca)['then'](function(){_0x5268ca=[];_0x5268ca[_0x55fa('0x56')](deleteCmHopperPhones(_0x55cafc['body']['id']));_0x5268ca[_0x55fa('0x56')](addCmHopperPhones(_0x55cafc[_0x55fa('0x32')]['id']));Promise[_0x55fa('0x57')](_0x5268ca)['then'](function(){return[0x1];})[_0x55fa('0x16')](respondWithResult(_0x44aa9e,null));});};function addAdditionalPhones(_0x45791d){var _0x57d0e7;return new Promise(function(_0x4fcc18){return db[_0x55fa('0x7d')]['destroy']({'where':{'CmContactId':_0x45791d['id']}})['then'](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x55fa('0x7e')]})[_0x55fa('0x16')](function(_0x36cc15){var _0x520b09=[];for(var _0x1581a3=0x0;_0x1581a3<_0x45791d['items'][_0x55fa('0x25')];_0x1581a3++){var _0x5d8140=_0x45791d[_0x55fa('0x7f')]?_[_0x55fa('0x4d')](_0x45791d[_0x55fa('0x7f')][_0x1581a3])?'':_0x45791d['item_types'][_0x1581a3]:_0x45791d[_0x55fa('0x80')][_0x1581a3][_0x55fa('0x81')]?_0x45791d[_0x55fa('0x80')][_0x1581a3][_0x55fa('0x81')]:'';var _0x33e8d3=_[_0x55fa('0x4d')](_0x45791d['items'][_0x1581a3][_0x55fa('0x82')])?'':_0x45791d[_0x55fa('0x80')][_0x1581a3]['description'];var _0x5c834d=_0x5d8140+':'+_0x45791d[_0x55fa('0x80')][_0x1581a3][_0x55fa('0x6b')]+'§'+_0x33e8d3;if(_['isNil'](_0x57d0e7))_0x57d0e7=_0x5c834d;else _0x57d0e7+=';'+_0x5c834d;var _0x3a1e4d=null;var _0x5b4d89=null;if(_0x45791d[_0x55fa('0x7f')]){if(!_[_0x55fa('0x4d')](_0x45791d[_0x55fa('0x7f')][_0x1581a3])){_0x5b4d89=_[_0x55fa('0x59')](_0x36cc15,function(_0x346209){return _0x346209['id']===_0x45791d['item_types'][_0x1581a3];});if(!_['isNil'](_0x5b4d89)){_0x3a1e4d=_0x5b4d89['OrderBy'];}}}else{if(!_[_0x55fa('0x4d')](_0x45791d['items'][_0x1581a3])){_0x5b4d89=_[_0x55fa('0x59')](_0x36cc15,function(_0x3f6413){return _0x3f6413['id']===_0x45791d[_0x55fa('0x80')][_0x1581a3][_0x55fa('0x81')];});if(!_[_0x55fa('0x4d')](_0x5b4d89)){_0x3a1e4d=_0x1581a3;}}}if(_['isNil'](_0x3a1e4d)){_0x3a1e4d=0x64;}_0x520b09[_0x55fa('0x56')](addAdditionalPhone(_0x45791d['id'],_0x45791d['items'][_0x1581a3]['phone'],_0x45791d[_0x55fa('0x7f')]?_[_0x55fa('0x4d')](_0x45791d[_0x55fa('0x7f')][_0x1581a3])?null:_0x45791d[_0x55fa('0x7f')][_0x1581a3]:_0x45791d['items'][_0x1581a3][_0x55fa('0x81')]?_0x45791d[_0x55fa('0x80')][_0x1581a3][_0x55fa('0x81')]:null,_0x3a1e4d,_0x33e8d3));}Promise[_0x55fa('0x57')](_0x520b09)[_0x55fa('0x16')](function(){db['CmContact'][_0x55fa('0x15')]({'AdditionalPhones':_0x57d0e7},{'where':{'id':_0x45791d['id']}})[_0x55fa('0x16')](function(){_0x4fcc18(0x1);});});});});});}function addAdditionalPhone(_0x410ff2,_0x57f712,_0x1ac234,_0x553430,_0x1ef9b6){return db[_0x55fa('0x7d')][_0x55fa('0x59')]({'where':{'CmContactId':_0x410ff2,'item':_0x57f712}})[_0x55fa('0x16')](function(_0x43167e){if(_0x43167e)logger[_0x55fa('0x2d')]('contact\x20phone\x20exists',_0x43167e);else{db[_0x55fa('0x7d')][_0x55fa('0x3b')]({'CmContactId':_0x410ff2,'item':_0x57f712,'ItemTypeId':_0x1ac234,'OrderBy':_0x553430,'ItemClass':'PHONE','description':_0x1ef9b6});}});}function deleteCmHopperPhones(_0x401e99){return new Promise(function(_0x8ce4d1){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x401e99}})['then'](function(_0x4b52af){db['CmHopperAdditionalPhone'][_0x55fa('0x20')]({'where':{'CmHopperId':{'$in':_[_0x55fa('0x63')](_0x4b52af,'id')}}});})[_0x55fa('0x16')](function(){_0x8ce4d1(0x1);});});}function addCmHopperPhones(_0x449f67){return new Promise(function(_0x9e8865){return db[_0x55fa('0x6c')][_0x55fa('0x1c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x449f67}})[_0x55fa('0x16')](function(_0x51a06b){var _0x196ca8=[];_['map'](_0x51a06b,function(_0x36ab00){_0x196ca8[_0x55fa('0x56')](createCmHopperPhone(_0x449f67,_0x36ab00['id']));});Promise['all'](_0x196ca8)[_0x55fa('0x16')](function(){_0x9e8865(0x1);});});});}function createCmHopperPhone(_0x27f52b,_0x28d775){return new Promise(function(_0x4b0bee){db['CmContactHasItem'][_0x55fa('0x1c')]({'raw':!![],'attributes':[_0x55fa('0x83'),_0x55fa('0x7e')],'where':{'CmContactId':_0x27f52b,'ItemClass':_0x55fa('0x84')},'include':[{'model':db[_0x55fa('0x85')],'attributes':[_0x55fa('0x7e')],'as':'ItemType'}],'order':['OrderBy',db[_0x55fa('0x5e')][_0x55fa('0x86')](_0x55fa('0x87'))]})['then'](function(_0x4c9ff8){var _0x22bb00=0x1;var _0x4aa9f0=_['map'](_0x4c9ff8,function(_0x46fa77){_0x46fa77[_0x55fa('0x88')]=_0x28d775;_0x46fa77['phone']=_0x46fa77[_0x55fa('0x83')];_0x46fa77[_0x55fa('0x7e')]=_0x22bb00;delete _0x46fa77['ItemType.OrderBy'];_0x22bb00=_0x22bb00+0x1;return _0x46fa77;});return db[_0x55fa('0x89')]['bulkCreate'](_0x4aa9f0,{});})[_0x55fa('0x16')](function(){_0x4b0bee(0x1);});});}function insertAdditionalPhones(_0x33078c,_0x1fd0db){return new Promise(function(_0x15e42b){var _0x4c7c87=[];for(var _0x275d0c=0x0;_0x275d0c<_0x1fd0db['length'];_0x275d0c++){var _0x2cf226=_0x1fd0db[_0x275d0c];_0x4c7c87[_0x55fa('0x56')](parseContactItemType(_0x2cf226));}Promise['all'](_0x4c7c87)[_0x55fa('0x16')](function(){var _0x4b9a17={'id':_0x33078c['id'],'items':_0x1fd0db};return addAdditionalPhones(_0x4b9a17)['then'](function(){return addCmHopperPhones(_0x33078c['id']);});})[_0x55fa('0x16')](function(){_0x15e42b(_0x33078c);});});}function parseContactItemType(_0x5763e6){return new Promise(function(_0x510130){if(_0x5763e6[_0x55fa('0x30')](_0x55fa('0x81'))){_0x510130(_0x5763e6);}else{return db[_0x55fa('0x85')]['find']({'where':{'name':_0x5763e6[_0x55fa('0x5d')]}})['then'](function(_0x5516f9){if(_['isNil'](_0x5516f9))_0x5763e6[_0x55fa('0x81')]=null;else _0x5763e6[_0x55fa('0x81')]=_0x5516f9['id'];_0x510130(_0x5763e6);});}});}exports['getAdditionalPhones']=function(_0x340841,_0x56dbc5){return db[_0x55fa('0x7d')][_0x55fa('0x1c')]({'raw':!![],'where':{'CmContactId':_0x340841[_0x55fa('0x22')]['id'],'ItemClass':_0x55fa('0x84')},'include':[{'model':db['ContactItemType'],'as':_0x55fa('0x5d')}],'order':[['OrderBy'],[db[_0x55fa('0x5e')][_0x55fa('0x86')](_0x55fa('0x87'))]]})[_0x55fa('0x16')](function(_0x345352){return _0x345352;})[_0x55fa('0x16')](respondWithResult(_0x56dbc5,null))[_0x55fa('0x1f')](handleError(_0x56dbc5,null));};exports['duplicateAdditionalPhones']=function(_0x531a8f,_0xdbb0e7){return db[_0x55fa('0x7d')][_0x55fa('0x1c')]({'raw':!![],'where':{'CmContactId':_0x531a8f[_0x55fa('0x32')][_0x55fa('0x8a')]}})[_0x55fa('0x16')](function(_0x379542){var _0x492dc6=_[_0x55fa('0x63')](_0x379542,function(_0x4825ac){_0x4825ac[_0x55fa('0x8b')]=_0x531a8f['body'][_0x55fa('0x8c')];return _0x4825ac;});return db[_0x55fa('0x7d')][_0x55fa('0x8d')](_0x492dc6,{});})[_0x55fa('0x16')](function(){return addCmHopperPhones(_0x531a8f[_0x55fa('0x32')][_0x55fa('0x8c')]);})[_0x55fa('0x16')](function(){return['ok'];})[_0x55fa('0x16')](respondWithResult(_0xdbb0e7,null))[_0x55fa('0x1f')](handleError(_0xdbb0e7,null));};exports[_0x55fa('0x8e')]=function(_0x3aeb91,_0x12e59e){var _0xb6a6c9=[];_0xb6a6c9['push'](createCmHopperPhone(_0x3aeb91['body']['id'],_0x3aeb91[_0x55fa('0x32')][_0x55fa('0x8f')]));Promise[_0x55fa('0x57')](_0xb6a6c9)['then'](function(){return[0x1];})['then'](respondWithResult(_0x12e59e,null));};exports[_0x55fa('0x90')]=function(_0x21461d,_0x4a78a3){var _0x5222ae={'raw':![],'where':{}};var _0x3a88ab={};var _0x4211c7={'count':0x0,'rows':[]};return db[_0x55fa('0x21')][_0x55fa('0x6e')]({'where':{'id':_0x21461d['params']['id']}})[_0x55fa('0x16')](handleEntityNotFound(_0x4a78a3,null))['then'](function(_0x46e970){if(_0x46e970){_0x3a88ab[_0x55fa('0x6f')]=_[_0x55fa('0x24')](db[_0x55fa('0x6c')][_0x55fa('0x70')]);_0x3a88ab[_0x55fa('0x1d')]=_[_0x55fa('0x24')](_0x21461d['query']);_0x3a88ab[_0x55fa('0x71')]=_[_0x55fa('0x73')](_0x3a88ab[_0x55fa('0x6f')],_0x3a88ab[_0x55fa('0x1d')]);_0x5222ae[_0x55fa('0x72')]=_['intersection'](_0x3a88ab['model'],qs[_0x55fa('0x74')](_0x21461d[_0x55fa('0x1d')][_0x55fa('0x74')]));_0x5222ae[_0x55fa('0x72')]=_0x5222ae[_0x55fa('0x72')][_0x55fa('0x25')]?_0x5222ae[_0x55fa('0x72')]:_0x3a88ab[_0x55fa('0x6f')];if(!_0x21461d[_0x55fa('0x1d')]['hasOwnProperty'](_0x55fa('0x91'))){_0x5222ae[_0x55fa('0x11')]=qs[_0x55fa('0x11')](_0x21461d[_0x55fa('0x1d')][_0x55fa('0x11')]);_0x5222ae[_0x55fa('0xf')]=qs[_0x55fa('0xf')](_0x21461d[_0x55fa('0x1d')][_0x55fa('0xf')]);}_0x5222ae[_0x55fa('0x75')]=qs[_0x55fa('0x76')](_0x21461d[_0x55fa('0x1d')][_0x55fa('0x76')]);_0x5222ae[_0x55fa('0x52')]=qs['filters'](_['pick'](_0x21461d['query'],_0x3a88ab[_0x55fa('0x71')]));_0x5222ae[_0x55fa('0x52')][_0x55fa('0x92')]=_0x46e970['id'];if(_0x21461d[_0x55fa('0x1d')]['filter']){_0x5222ae[_0x55fa('0x52')]=_['merge'](_0x5222ae[_0x55fa('0x52')],{'$or':_[_0x55fa('0x63')](_0x5222ae[_0x55fa('0x72')],function(_0x49b826){var _0xececbe={};_0xececbe[_0x49b826]={'$like':'%'+_0x21461d[_0x55fa('0x1d')][_0x55fa('0x78')]+'%'};return _0xececbe;})});}_0x5222ae=_[_0x55fa('0x31')]({},_0x5222ae,_0x21461d[_0x55fa('0x79')]);return db[_0x55fa('0x6c')][_0x55fa('0x12')]({'where':_0x5222ae[_0x55fa('0x52')]})[_0x55fa('0x16')](function(_0x521ea2){_0x4211c7[_0x55fa('0x12')]=_0x521ea2;if(_0x21461d['query'][_0x55fa('0x93')]){_0x5222ae[_0x55fa('0x94')]=[{'all':!![]}];}return db['CmHopper'][_0x55fa('0x1c')](_0x5222ae);})[_0x55fa('0x16')](function(_0x3567d2){_0x4211c7[_0x55fa('0x95')]=_0x3567d2;return _0x4211c7;});}})[_0x55fa('0x16')](respondWithFilteredResult(_0x4a78a3,_0x5222ae))[_0x55fa('0x1f')](handleError(_0x4a78a3,null));};exports['getHopperHistories']=function(_0x5b2705,_0x16a177){var _0x28f7f7={'raw':!![],'where':{}};var _0x274818={};var _0x5cd28f={'count':0x0,'rows':[]};return db[_0x55fa('0x21')]['findOne']({'where':{'id':_0x5b2705[_0x55fa('0x22')]['id']}})['then'](handleEntityNotFound(_0x16a177,null))['then'](function(_0x37e7a4){if(_0x37e7a4){_0x274818[_0x55fa('0x6f')]=_[_0x55fa('0x24')](db['CmHopperHistory']['rawAttributes']);_0x274818['query']=_['keys'](_0x5b2705['query']);_0x274818[_0x55fa('0x71')]=_[_0x55fa('0x73')](_0x274818[_0x55fa('0x6f')],_0x274818[_0x55fa('0x1d')]);_0x28f7f7[_0x55fa('0x72')]=_[_0x55fa('0x73')](_0x274818['model'],qs['fields'](_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x74')]));_0x28f7f7[_0x55fa('0x72')]=_0x28f7f7['attributes'][_0x55fa('0x25')]?_0x28f7f7[_0x55fa('0x72')]:_0x274818[_0x55fa('0x6f')];if(!_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x30')]('nolimit')){_0x28f7f7[_0x55fa('0x11')]=qs[_0x55fa('0x11')](_0x5b2705['query'][_0x55fa('0x11')]);_0x28f7f7[_0x55fa('0xf')]=qs[_0x55fa('0xf')](_0x5b2705[_0x55fa('0x1d')][_0x55fa('0xf')]);}_0x28f7f7[_0x55fa('0x75')]=qs[_0x55fa('0x76')](_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x76')]);_0x28f7f7['where']=qs[_0x55fa('0x71')](_[_0x55fa('0x77')](_0x5b2705[_0x55fa('0x1d')],_0x274818[_0x55fa('0x71')]));_0x28f7f7[_0x55fa('0x52')]['ContactId']=_0x37e7a4['id'];if(_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x78')]){_0x28f7f7[_0x55fa('0x52')]=_[_0x55fa('0x31')](_0x28f7f7['where'],{'$or':_['map'](_0x28f7f7['attributes'],function(_0x2c1cd9){var _0x2b938b={};_0x2b938b[_0x2c1cd9]={'$like':'%'+_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x78')]+'%'};return _0x2b938b;})});}_0x28f7f7=_[_0x55fa('0x31')]({},_0x28f7f7,_0x5b2705[_0x55fa('0x79')]);return db['CmHopperHistory'][_0x55fa('0x12')]({'where':_0x28f7f7[_0x55fa('0x52')]})[_0x55fa('0x16')](function(_0x2151ca){_0x5cd28f[_0x55fa('0x12')]=_0x2151ca;if(_0x5b2705[_0x55fa('0x1d')][_0x55fa('0x93')]){_0x28f7f7[_0x55fa('0x94')]=[{'all':!![]}];}return db[_0x55fa('0x46')][_0x55fa('0x1c')](_0x28f7f7);})[_0x55fa('0x16')](function(_0x3d4242){_0x5cd28f[_0x55fa('0x95')]=_0x3d4242;return _0x5cd28f;});}})[_0x55fa('0x16')](respondWithFilteredResult(_0x16a177,_0x28f7f7))[_0x55fa('0x1f')](handleError(_0x16a177,null));};exports[_0x55fa('0x96')]=function(_0x53bd4a,_0x4f054a){var _0x1a99e1={'raw':!![],'where':{}};var _0x1dc8f0={};var _0x1d27b6={'count':0x0,'rows':[]};return db[_0x55fa('0x21')]['findOne']({'where':{'id':_0x53bd4a[_0x55fa('0x22')]['id']}})[_0x55fa('0x16')](handleEntityNotFound(_0x4f054a,null))[_0x55fa('0x16')](function(_0x15e94e){if(_0x15e94e){_0x1dc8f0[_0x55fa('0x6f')]=_[_0x55fa('0x24')](db['CmHopperFinal'][_0x55fa('0x70')]);_0x1dc8f0[_0x55fa('0x1d')]=_[_0x55fa('0x24')](_0x53bd4a[_0x55fa('0x1d')]);_0x1dc8f0['filters']=_[_0x55fa('0x73')](_0x1dc8f0[_0x55fa('0x6f')],_0x1dc8f0[_0x55fa('0x1d')]);_0x1a99e1[_0x55fa('0x72')]=_[_0x55fa('0x73')](_0x1dc8f0[_0x55fa('0x6f')],qs[_0x55fa('0x74')](_0x53bd4a['query'][_0x55fa('0x74')]));_0x1a99e1[_0x55fa('0x72')]=_0x1a99e1[_0x55fa('0x72')][_0x55fa('0x25')]?_0x1a99e1[_0x55fa('0x72')]:_0x1dc8f0[_0x55fa('0x6f')];if(!_0x53bd4a['query'][_0x55fa('0x30')]('nolimit')){_0x1a99e1['limit']=qs[_0x55fa('0x11')](_0x53bd4a['query'][_0x55fa('0x11')]);_0x1a99e1['offset']=qs[_0x55fa('0xf')](_0x53bd4a['query']['offset']);}_0x1a99e1[_0x55fa('0x75')]=qs[_0x55fa('0x76')](_0x53bd4a[_0x55fa('0x1d')][_0x55fa('0x76')]);_0x1a99e1[_0x55fa('0x52')]=qs['filters'](_['pick'](_0x53bd4a[_0x55fa('0x1d')],_0x1dc8f0[_0x55fa('0x71')]));_0x1a99e1[_0x55fa('0x52')][_0x55fa('0x92')]=_0x15e94e['id'];if(_0x53bd4a['query'][_0x55fa('0x78')]){_0x1a99e1[_0x55fa('0x52')]=_[_0x55fa('0x31')](_0x1a99e1['where'],{'$or':_['map'](_0x1a99e1[_0x55fa('0x72')],function(_0x2555d0){var _0xcd2749={};_0xcd2749[_0x2555d0]={'$like':'%'+_0x53bd4a[_0x55fa('0x1d')][_0x55fa('0x78')]+'%'};return _0xcd2749;})});}_0x1a99e1=_[_0x55fa('0x31')]({},_0x1a99e1,_0x53bd4a[_0x55fa('0x79')]);return db[_0x55fa('0x45')][_0x55fa('0x12')]({'where':_0x1a99e1[_0x55fa('0x52')]})['then'](function(_0x362e3c){_0x1d27b6[_0x55fa('0x12')]=_0x362e3c;if(_0x53bd4a[_0x55fa('0x1d')][_0x55fa('0x93')]){_0x1a99e1[_0x55fa('0x94')]=[{'all':!![]}];}return db[_0x55fa('0x45')]['findAll'](_0x1a99e1);})[_0x55fa('0x16')](function(_0x3a8ec4){_0x1d27b6[_0x55fa('0x95')]=_0x3a8ec4;return _0x1d27b6;});}})[_0x55fa('0x16')](respondWithFilteredResult(_0x4f054a,_0x1a99e1))['catch'](handleError(_0x4f054a,null));};exports[_0x55fa('0x97')]=function(_0x1ed98f,_0x2c78b9){var _0xff0bba={'raw':!![],'where':{}};var _0x177b47={};var _0x56f160={'count':0x0,'rows':[]};return db['CmContact'][_0x55fa('0x6e')]({'where':{'id':_0x1ed98f[_0x55fa('0x22')]['id']}})['then'](handleEntityNotFound(_0x2c78b9,null))['then'](function(_0x59d7ce){if(_0x59d7ce){_0x177b47[_0x55fa('0x6f')]=_[_0x55fa('0x24')](db['JscriptySessionReport'][_0x55fa('0x70')]);_0x177b47[_0x55fa('0x1d')]=_[_0x55fa('0x24')](_0x1ed98f[_0x55fa('0x1d')]);_0x177b47['filters']=_['intersection'](_0x177b47[_0x55fa('0x6f')],_0x177b47[_0x55fa('0x1d')]);_0xff0bba[_0x55fa('0x72')]=_[_0x55fa('0x73')](_0x177b47['model'],qs[_0x55fa('0x74')](_0x1ed98f['query'][_0x55fa('0x74')]));_0xff0bba['attributes']=_0xff0bba[_0x55fa('0x72')][_0x55fa('0x25')]?_0xff0bba[_0x55fa('0x72')]:_0x177b47[_0x55fa('0x6f')];if(!_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0x30')]('nolimit')){_0xff0bba[_0x55fa('0x11')]=qs[_0x55fa('0x11')](_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0x11')]);_0xff0bba[_0x55fa('0xf')]=qs[_0x55fa('0xf')](_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0xf')]);}_0xff0bba[_0x55fa('0x75')]=qs[_0x55fa('0x76')](_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0x76')]);_0xff0bba['where']=qs[_0x55fa('0x71')](_['pick'](_0x1ed98f[_0x55fa('0x1d')],_0x177b47[_0x55fa('0x71')]));_0xff0bba[_0x55fa('0x52')][_0x55fa('0x92')]=_0x59d7ce['id'];if(_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0x78')]){_0xff0bba[_0x55fa('0x52')]=_[_0x55fa('0x31')](_0xff0bba['where'],{'$or':_[_0x55fa('0x63')](_0xff0bba[_0x55fa('0x72')],function(_0x2f8869){var _0x4008b4={};_0x4008b4[_0x2f8869]={'$like':'%'+_0x1ed98f[_0x55fa('0x1d')][_0x55fa('0x78')]+'%'};return _0x4008b4;})});}_0xff0bba=_[_0x55fa('0x31')]({},_0xff0bba,_0x1ed98f['options']);return db[_0x55fa('0x98')][_0x55fa('0x12')]({'where':_0xff0bba[_0x55fa('0x52')]})['then'](function(_0x22b792){_0x56f160[_0x55fa('0x12')]=_0x22b792;if(_0x1ed98f[_0x55fa('0x1d')]['includeAll']){_0xff0bba[_0x55fa('0x94')]=[{'all':!![]}];}return db[_0x55fa('0x98')]['findAll'](_0xff0bba);})[_0x55fa('0x16')](function(_0x3a14ab){_0x56f160[_0x55fa('0x95')]=_0x3a14ab;return _0x56f160;});}})[_0x55fa('0x16')](respondWithFilteredResult(_0x2c78b9,_0xff0bba))[_0x55fa('0x1f')](handleError(_0x2c78b9,null));};exports[_0x55fa('0x99')]=function(_0x18a86a,_0x3b3ac9){try{if(!_0x18a86a['body']['ListId']){throw new Error(_0x55fa('0x9a'));}if(!_0x18a86a[_0x55fa('0x32')][_0x55fa('0x9b')]){throw new Error(_0x55fa('0x9c'));}if(!_0x18a86a[_0x55fa('0x32')][_0x55fa('0x9d')]){throw new Error(_0x55fa('0x9e'));}if(!_0x18a86a[_0x55fa('0x32')]['socket_timestamp']){throw new Error(_0x55fa('0x9f'));}var _0x4b720a=_0x18a86a['body'][_0x55fa('0x9b')][_0x55fa('0xa0')](',');var _0x3b4f3f=_0x18a86a['body'][_0x55fa('0x9d')]['split'](',');if(!_0x4b720a[_0x55fa('0x25')]||!_0x3b4f3f[_0x55fa('0x25')]||_0x4b720a[_0x55fa('0x25')]!==_0x3b4f3f[_0x55fa('0x25')]){throw new Error(_0x55fa('0xa1'));}_0x18a86a[_0x55fa('0x32')][_0x55fa('0x74')]=_[_0x55fa('0xa2')](_0x4b720a,_0x3b4f3f);if(!_0x18a86a[_0x55fa('0x32')][_0x55fa('0x74')]['phone']){throw new Error(_0x55fa('0xa3'));}if(!_0x18a86a[_0x55fa('0x32')]['fields']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x42b6c8=path[_0x55fa('0x36')](config[_0x55fa('0xa4')],'server/files/tmp',_0x18a86a[_0x55fa('0xa5')][_0x55fa('0xa6')]);fs[_0x55fa('0xa7')](_0x42b6c8,parseInt(_0x55fa('0xa8'),0x8));var _0xb0b63d=require(_0x55fa('0xa9'))[_0x55fa('0xaa')](path['join'](__dirname,_0x55fa('0xab')),[_0x42b6c8,_0x18a86a['body']['binding_keys'],_0x18a86a[_0x55fa('0x32')]['binding_values'],_0x18a86a[_0x55fa('0x32')][_0x55fa('0x54')],_0x18a86a['body'][_0x55fa('0xac')],_0x18a86a[_0x55fa('0x32')][_0x55fa('0x51')],_0x18a86a[_0x55fa('0x32')][_0x55fa('0xad')]]);return _0x3b3ac9[_0x55fa('0x13')](0xc8)[_0x55fa('0xe')]({'message':'File\x20uploaded\x20correctly!','pid':_0xb0b63d[_0x55fa('0xae')]});}catch(_0x5596b7){return _0x3b3ac9[_0x55fa('0x13')](0x1f4)[_0x55fa('0xaf')](_0x5596b7);}};exports['upload']=function(_0x349d3d,_0x29630b){var _0x584cac=fs['createReadStream'](_0x349d3d[_0x55fa('0xa5')][_0x55fa('0x2')]);Papa['parse'](_0x584cac,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3f036a){return _0x29630b[_0x55fa('0x13')](0xc8)[_0x55fa('0xe')]({'file':_0x349d3d[_0x55fa('0xa5')],'fields':_0x3f036a[_0x55fa('0xb0')][_0x55fa('0x74')]});}});};exports['import']=function(_0x547648,_0x38aa33){return db[_0x55fa('0xb1')][_0x55fa('0x1c')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x55fa('0x16')](function(_0x320aa2){var _0x2d5124=![];if(!_0x547648[_0x55fa('0x32')][_0x55fa('0x54')]){throw new Error(_0x55fa('0x9a'));}if(!_0x547648[_0x55fa('0x32')]['binding'][_0x55fa('0x6b')]){throw new Error(_0x55fa('0xa3'));}if(!_0x547648[_0x55fa('0x32')][_0x55fa('0xb2')][_0x55fa('0xb3')]){throw new Error(_0x55fa('0xb4'));}if(!_0x547648[_0x55fa('0x32')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x22b684=require('child_process')[_0x55fa('0xaa')](path[_0x55fa('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x547648['params']['id'],JSON[_0x55fa('0xb5')](_0x547648['body']),JSON[_0x55fa('0xb5')](_0x320aa2)]);_0x22b684['on'](_0x55fa('0xb6'),function(){_0x2d5124=!![];return _0x38aa33[_0x55fa('0x13')](0xc8)[_0x55fa('0xe')]({'message':_0x55fa('0xb7'),'pid':_0x22b684['pid']});});_0x22b684['on'](_0x55fa('0xb8'),function(_0x9c6ac4){if(_0x9c6ac4&&!_0x2d5124){return _0x38aa33[_0x55fa('0x13')](0x1f4)[_0x55fa('0xe')]({'message':_0x55fa('0xb9'),'pid':_0x22b684[_0x55fa('0xae')]});}});})[_0x55fa('0x1f')](handleError(_0x38aa33,null));};exports['importUpdates']=function(_0xc23580,_0x47d0c3){return db[_0x55fa('0xb1')][_0x55fa('0x1c')]({'raw':!![],'attributes':['id'],'where':{'role':_0x55fa('0xba')}})[_0x55fa('0x16')](function(_0x1c5a1f){var _0x5c1293=![];if(!_0xc23580[_0x55fa('0x32')][_0x55fa('0x54')]){throw new Error('No\x20ListId\x20specified');}if(!_0xc23580[_0x55fa('0x32')][_0x55fa('0xb2')]['phone']){throw new Error(_0x55fa('0xa3'));}if(!_0xc23580[_0x55fa('0x32')][_0x55fa('0xb2')][_0x55fa('0xb3')]){throw new Error(_0x55fa('0xb4'));}if(!_0xc23580['body'][_0x55fa('0xad')]){throw new Error(_0x55fa('0x9f'));}var _0x5c1ccc=require('child_process')[_0x55fa('0xaa')](path[_0x55fa('0x36')](__dirname,_0x55fa('0xbb')),[_0xc23580['params']['id'],JSON[_0x55fa('0xb5')](_0xc23580['body']),JSON[_0x55fa('0xb5')](_0x1c5a1f)]);_0x5c1ccc['on'](_0x55fa('0xb6'),function(){_0x5c1293=!![];return _0x47d0c3['status'](0xc8)[_0x55fa('0xe')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x5c1ccc[_0x55fa('0xae')]});});_0x5c1ccc['on']('exit',function(_0x2b50ee){if(_0x2b50ee&&!_0x5c1293){return _0x47d0c3[_0x55fa('0x13')](0x1f4)[_0x55fa('0xe')]({'message':'error\x20child\x20process','pid':_0x5c1ccc['pid']});}});})[_0x55fa('0x1f')](handleError(_0x47d0c3,null));};exports[_0x55fa('0xbc')]=function(_0x3a2755,_0x4726e6){var _0x23a1a8=['mail','chat',_0x55fa('0xbd'),'openchannel',_0x55fa('0xbe'),_0x55fa('0xbf'),'voice'];var _0x5d5b01={'offset':0x0,'order':qs[_0x55fa('0x76')]('-createdAt')},_0x566c83={'count':0x0,'rows':[]};Promise[_0x55fa('0xc0')]()['then'](function(){if(_0x3a2755[_0x55fa('0x1d')]['channel']){if(!_[_0x55fa('0xc1')](_0x23a1a8,_0x3a2755[_0x55fa('0x1d')]['channel'][_0x55fa('0xc2')]())){throw new Error(_0x55fa('0xc3'));}_0x23a1a8=[_0x3a2755[_0x55fa('0x1d')]['channel'][_0x55fa('0xc2')]()];}if(_0x3a2755['query'][_0x55fa('0xc4')]){try{var _0x3f5865=JSON[_0x55fa('0xc5')](_0x3a2755[_0x55fa('0x1d')]['range']);if(!moment(_0x3f5865['from'])[_0x55fa('0xc6')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x3f5865['to'])['isValid']()){throw new Error(_0x55fa('0xc7'));}}catch(_0x5326bf){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x3a2755[_0x55fa('0x1d')][_0x55fa('0x30')](_0x55fa('0x91'))){_0x5d5b01[_0x55fa('0x11')]=qs[_0x55fa('0x11')](_0x3a2755['query'][_0x55fa('0x11')]||0xa);_0x5d5b01[_0x55fa('0xf')]=qs['offset'](_0x3a2755['query'][_0x55fa('0xf')]);}var _0x320924=_0x23a1a8[_0x55fa('0x63')](function(_0x31aaef){if(_0x31aaef===_0x55fa('0xc8')){var _0x904bae={'attributes':['id','uniqueid','type',_0x55fa('0xc9'),_0x55fa('0xca'),_0x55fa('0xcb'),_0x55fa('0xcc'),'endtime',_0x55fa('0xcd'),'note','createdAt','userDisposition',_0x55fa('0xce'),'userThirdDisposition',_0x55fa('0xcf')],'where':{'ContactId':_0x3a2755[_0x55fa('0x22')]['id']},'include':[{'model':db[_0x55fa('0xb1')],'as':_0x55fa('0xb1'),'attributes':['id',_0x55fa('0x19'),_0x55fa('0xd0'),'alias']}],'order':[[_0x55fa('0xd1'),_0x55fa('0xd2')]]};if(_0x3a2755['query'][_0x55fa('0xc4')]){_0x904bae[_0x55fa('0x52')][_0x55fa('0xd1')]={'$gte':_0x3f5865[_0x55fa('0x38')],'$lte':_0x3f5865['to']};}return db['VoiceCallReport'][_0x55fa('0xd3')](_0x904bae)[_0x55fa('0x16')](function(_0x369eb9){_0x566c83[_0x55fa('0x12')]+=_0x369eb9[_0x55fa('0x12')];return _[_0x55fa('0x63')](_0x369eb9[_0x55fa('0x95')],function(_0x589efb){var _0x4365f9=_0x589efb[_0x55fa('0x33')]({'plain':!![]});_0x4365f9[_0x55fa('0xd4')]=_0x31aaef;if(_0x4365f9[_0x55fa('0xb1')]){_0x4365f9[_0x55fa('0xb1')]={'id':_0x4365f9[_0x55fa('0xb1')]['id'],'name':_0x4365f9[_0x55fa('0xb1')][_0x55fa('0x19')],'fullname':_0x4365f9[_0x55fa('0xb1')][_0x55fa('0xd0')],'alias':_0x4365f9[_0x55fa('0xb1')]['alias']};}return _0x4365f9;});});}else{var _0x29fc64=_[_0x55fa('0xd5')](_0x31aaef)+(_0x31aaef===_0x55fa('0xd6')?_0x55fa('0xd7'):_0x55fa('0xd8'));var _0x431a61={'attributes':['id','closed','closedAt',_0x55fa('0xd1'),_0x55fa('0xd9'),_0x55fa('0xda'),_0x55fa('0xdb'),_0x55fa('0xdc'),_0x55fa('0xcf'),_0x29fc64+'Id'],'where':{'ContactId':_0x3a2755[_0x55fa('0x22')]['id']},'include':[{'model':db[_0x29fc64],'as':_0x55fa('0xd8'),'attributes':['id','name',_0x55fa('0xdd')]},{'model':db[_0x55fa('0xb1')],'as':'Owner','attributes':['id','name',_0x55fa('0xd0')]},{'model':db[_0x55fa('0x5a')],'as':_0x55fa('0x5b'),'attributes':['id','name',_0x55fa('0xde')],'through':{'attributes':[]}}],'order':[[_0x55fa('0xd1'),_0x55fa('0xd2')]]};if(_0x3a2755['query'][_0x55fa('0xc4')]){_0x431a61['where']['createdAt']={'$gte':_0x3f5865[_0x55fa('0x38')],'$lte':_0x3f5865['to']};}switch(_0x31aaef){case _0x55fa('0xd6'):_0x431a61[_0x55fa('0x72')][_0x55fa('0x56')]('browserName',_0x55fa('0xdf'),'customerPort',_0x55fa('0xe0'),'osName','ratingMessage','ratingType',_0x55fa('0xe1'),_0x55fa('0xe2'));break;case'mail':_0x431a61['attributes'][_0x55fa('0x56')](_0x55fa('0xe3'),_0x55fa('0xe4'));break;case _0x55fa('0xe5'):_0x431a61[_0x55fa('0x72')]['push'](_0x55fa('0xe6'),_0x55fa('0xe7'));break;}return db[_[_0x55fa('0xd5')](_0x31aaef)+_0x55fa('0xe8')]['findAndCountAll'](_0x431a61)[_0x55fa('0x16')](function(_0xbe29ed){_0x566c83[_0x55fa('0x12')]+=_0xbe29ed[_0x55fa('0x12')];return _[_0x55fa('0x63')](_0xbe29ed[_0x55fa('0x95')],function(_0x316681){var _0xa76463=_0x316681['get']({'plain':!![]});_0xa76463['channel']=_0x31aaef;if(_0xa76463[_0x55fa('0xe9')]){_0xa76463['Owner']={'id':_0xa76463[_0x55fa('0xe9')]['id'],'name':_0xa76463[_0x55fa('0xe9')]['name'],'fullname':_0xa76463[_0x55fa('0xe9')][_0x55fa('0xd0')]};}return _0xa76463;});});}});return Promise['all'](_0x320924);})[_0x55fa('0x16')](function(_0x4d3c6c){return _(_0x4d3c6c)[_0x55fa('0xea')]()['sortBy'](_0x55fa('0xd1'))[_0x55fa('0xeb')]()['value']();})[_0x55fa('0x16')](function(_0x18ca69){_0x566c83[_0x55fa('0x95')]=_0x5d5b01['limit']?_0x18ca69[_0x55fa('0xec')](_0x5d5b01[_0x55fa('0xf')],_0x5d5b01[_0x55fa('0xf')]+_0x5d5b01[_0x55fa('0x11')]):_0x18ca69;return _0x566c83;})[_0x55fa('0x16')](respondWithFilteredResult(_0x4726e6,_0x5d5b01))[_0x55fa('0x1f')](handleError(_0x4726e6,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 047a1b6..0fb1229 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 _0xcd99=['save','emit','hasOwnProperty','hook','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x5676fc,_0x1507e4){var _0x13999b=function(_0x11395a){while(--_0x11395a){_0x5676fc['push'](_0x5676fc['shift']());}};_0x13999b(++_0x1507e4);}(_0xcd99,0x18c));var _0x9cd9=function(_0x13ea04,_0x301eb8){_0x13ea04=_0x13ea04-0x0;var _0x5ef653=_0xcd99[_0x13ea04];return _0x5ef653;};'use strict';var EventEmitter=require(_0x9cd9('0x0'));var CmContact=require(_0x9cd9('0x1'))['db'][_0x9cd9('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9cd9('0x3')](0x0);var events={'afterCreate':_0x9cd9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x50935f){return function(_0x57af45,_0x2ba912,_0x43e673){CmContactEvents[_0x9cd9('0x5')](_0x50935f+':'+_0x57af45['id'],_0x57af45);CmContactEvents[_0x9cd9('0x5')](_0x50935f,_0x57af45);_0x43e673(null);};}for(var e in events){if(events[_0x9cd9('0x6')](e)){var event=events[e];CmContact[_0x9cd9('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0xb01c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','update','remove'];(function(_0x3b9161,_0x2849b6){var _0x28efdf=function(_0x3bf76b){while(--_0x3bf76b){_0x3b9161['push'](_0x3b9161['shift']());}};_0x28efdf(++_0x2849b6);}(_0xb01c,0xf4));var _0xcb01=function(_0x816739,_0x5b3c98){_0x816739=_0x816739-0x0;var _0x22dcae=_0xb01c[_0x816739];return _0x22dcae;};'use strict';var EventEmitter=require(_0xcb01('0x0'));var CmContact=require(_0xcb01('0x1'))['db'][_0xcb01('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xcb01('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcb01('0x4'),'afterDestroy':_0xcb01('0x5')};function emitEvent(_0x3660c4){return function(_0x3c2285,_0x2618b2,_0x222988){CmContactEvents[_0xcb01('0x6')](_0x3660c4+':'+_0x3c2285['id'],_0x3c2285);CmContactEvents[_0xcb01('0x6')](_0x3660c4,_0x3c2285);_0x222988(null);};}for(var e in events){if(events[_0xcb01('0x7')](e)){var event=events[e];CmContact[_0xcb01('0x8')](e,emitEvent(event));}}module[_0xcb01('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index fb42649..d46bfc2 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 _0x47be=['VoiceQueue','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','onlyIfOpen','BlackLists','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','phone','firstName','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','models','get','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','findOne','then','isNil','dialTimezone','timezones','utcOffset','add','minutes','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','catch','error','inspect','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0x47be,0xf5));var _0xe47b=function(_0x2b2b33,_0x56606f){_0x2b2b33=_0x2b2b33-0x0;var _0x229157=_0x47be[_0x2b2b33];return _0x229157;};'use strict';var _=require('lodash');var util=require(_0xe47b('0x0'));var logger=require('../../config/logger')(_0xe47b('0x1'));var moment=require(_0xe47b('0x2'));var BPromise=require(_0xe47b('0x3'));var rp=require(_0xe47b('0x4'));var fs=require('fs');var path=require(_0xe47b('0x5'));var rimraf=require(_0xe47b('0x6'));var config=require(_0xe47b('0x7'));var shared=require(_0xe47b('0x8'));var attributes=require(_0xe47b('0x9'));module[_0xe47b('0xa')]=function(_0x47a7bc,_0x56ffb7){return _0x47a7bc['define'](_0xe47b('0xb'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xe47b('0xc'),'fields':[_0xe47b('0xc')]},{'name':'fti_cm_contacts','fields':[_0xe47b('0xd'),'lastName',_0xe47b('0xc'),_0xe47b('0xe'),_0xe47b('0xf'),_0xe47b('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xe47b('0x11'),'collate':_0xe47b('0x12'),'hooks':{'afterCreate':function(_0x48b559,_0x2d9cab,_0x14377d){var _0x20b74b=_0x47a7bc[_0xe47b('0x13')];var _0xf140c3=_0x48b559[_0xe47b('0x14')]({'plain':!![]});function _0x47e005(){return function(_0x51c427){logger['error'](_0xe47b('0x15'),_0xe47b('0x16'),util['inspect'](_0x51c427,{'showHidden':![],'depth':null}));};}function _0x387854(_0x2450a6,_0x3babce){var _0x31464e=_0x3babce[_0xe47b('0x17')]?_0x3babce[_0xe47b('0x17')]:moment()[_0xe47b('0x18')](_0xe47b('0x19'));return new BPromise(function(_0xa0885e,_0x4f9838){if(_['isNil'](_0x3babce['dialTimezone'])){_0xa0885e({'ret':_0x31464e});}else{_0x20b74b['VoiceQueue'][_0xe47b('0x1a')]({'where':{'id':_0x2450a6['id']}})[_0xe47b('0x1b')](function(_0x5593c2){if(!_[_0xe47b('0x1c')](_0x5593c2)){var _0x5e9af4=_0x5593c2[_0xe47b('0x1d')];if(!_[_0xe47b('0x1c')](_0x5e9af4)){var _0x4a7d6e=shared[_0xe47b('0x1e')];var _0x40c563=_0x4a7d6e[_0x5e9af4];var _0x58d20e=_0x4a7d6e[_0x3babce[_0xe47b('0x1d')]];if(!_[_0xe47b('0x1c')](_0x40c563)&&!_[_0xe47b('0x1c')](_0x58d20e)){var _0x9999d8=_0x40c563[_0xe47b('0x1f')]-_0x58d20e[_0xe47b('0x1f')];_0x31464e=_0x3babce[_0xe47b('0x17')]?_0x3babce[_0xe47b('0x17')]:moment();var _0x3dab39=moment(_0x31464e)[_0xe47b('0x20')](_0x9999d8,_0xe47b('0x21'));_0xa0885e({'ret':_0x3dab39[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0xa0885e({'ret':_0x31464e});}else _0xa0885e({'ret':_0x31464e});}else{_0xa0885e({'ret':_0x31464e});}});}});return 0xa;}var _0x182d47=function(_0x5ccf36){return new BPromise(function(_0x386ede,_0x3d7071){_0x387854(_0x5ccf36,_0xf140c3)[_0xe47b('0x1b')](function(_0x444a71){_0xf140c3[_0xe47b('0x17')]=_0x444a71['ret'];_0x20b74b['CmHopper'][_0xe47b('0x1a')]({'where':{'phone':_0xf140c3[_0xe47b('0xc')],'VoiceQueueId':_0x5ccf36['id']}})[_0xe47b('0x1b')](function(_0x5747c7){if(!_[_0xe47b('0x1c')](_0x5747c7)){throw new Error(_0xe47b('0x22')+_0xf140c3[_0xe47b('0xc')]+_0xe47b('0x23')+_0x5ccf36['id']);}return _0x20b74b['CmHopper'][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'priority':_0xf140c3[_0xe47b('0x26')]?_0xf140c3[_0xe47b('0x26')]:0x2,'scheduledat':_0xf140c3['scheduledat']?_0xf140c3[_0xe47b('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3[_0xe47b('0x27')]?_0xf140c3[_0xe47b('0x27')]:undefined,'callbackat':_0xf140c3[_0xe47b('0x27')]?moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5ccf36['id']});})['catch'](function(_0x54e819){_0x3d7071(_0x54e819);});});});};var _0x3b342e=function(_0x1c9ed2){return new BPromise(function(_0x32e271,_0xd3d7d4){_0x387854(_0x1c9ed2,_0xf140c3)[_0xe47b('0x1b')](function(_0x4c5e4){_0xf140c3[_0xe47b('0x17')]=_0x4c5e4['ret'];_0x20b74b['CmHopper'][_0xe47b('0x1a')]({'where':{'phone':_0xf140c3['phone'],'VoiceQueueId':_0x1c9ed2['id']}})[_0xe47b('0x1b')](function(_0x27d39e){if(!_[_0xe47b('0x1c')](_0x27d39e)){throw new Error(_0xe47b('0x22')+_0xf140c3[_0xe47b('0xc')]+_0xe47b('0x28')+_0x1c9ed2['id']);}return _0x20b74b[_0xe47b('0x29')]['findOne']({'where':{'calleridnum':_0xf140c3[_0xe47b('0xc')],'VoiceQueueId':_0x1c9ed2['id']}});})[_0xe47b('0x1b')](function(_0xdd470){if(!_[_0xe47b('0x1c')](_0xdd470)){throw new Error(_0xe47b('0x2a')+_0xf140c3['phone']+_0xe47b('0x2b')+_0x1c9ed2['id']);}return _0x20b74b['CmHopper'][_0xe47b('0x24')]({'phone':_0xf140c3['phone'],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3['ListId'],'priority':_0xf140c3[_0xe47b('0x26')]?_0xf140c3[_0xe47b('0x26')]:0x2,'scheduledat':_0xf140c3[_0xe47b('0x17')]?_0xf140c3[_0xe47b('0x17')]:moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3['callbackUniqueid']?_0xf140c3[_0xe47b('0x27')]:undefined,'callbackat':_0xf140c3['callbackUniqueid']?moment()[_0xe47b('0x18')](_0xe47b('0x19')):undefined,'VoiceQueueId':_0x1c9ed2['id']});})[_0xe47b('0x2c')](function(_0x5d1f9b){_0xd3d7d4(_0x5d1f9b);});});});};function _0xb3bef3(){return function(_0x420194){logger[_0xe47b('0x2d')]('cmContact',_0xe47b('0x16'),util[_0xe47b('0x2e')](_0x420194,{'showHidden':![],'depth':null}));};}function _0x247369(_0x5f20b2,_0x5ccf7f){var _0x1964ab=_0x5ccf7f['scheduledat']?_0x5ccf7f[_0xe47b('0x17')]:moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x556a13,_0x2a6147){if(_[_0xe47b('0x1c')](_0x5ccf7f[_0xe47b('0x1d')])){_0x556a13({'ret':_0x1964ab});}else{_0x20b74b['Campaign']['findOne']({'where':{'id':_0x5f20b2['id']}})[_0xe47b('0x1b')](function(_0x5a5f8e){if(!_[_0xe47b('0x1c')](_0x5a5f8e)){var _0x157044=_0x5a5f8e[_0xe47b('0x1d')];if(!_[_0xe47b('0x1c')](_0x157044)){var _0x3219f9=shared[_0xe47b('0x1e')];var _0x42392b=_0x3219f9[_0x157044];var _0x4d1ac6=_0x3219f9[_0x5ccf7f[_0xe47b('0x1d')]];if(!_[_0xe47b('0x1c')](_0x42392b)&&!_[_0xe47b('0x1c')](_0x4d1ac6)){var _0x1d520e=_0x42392b[_0xe47b('0x1f')]-_0x4d1ac6[_0xe47b('0x1f')];_0x1964ab=_0x5ccf7f['scheduledat']?_0x5ccf7f[_0xe47b('0x17')]:moment();var _0x1fb647=moment(_0x1964ab)[_0xe47b('0x20')](_0x1d520e,'minutes');_0x556a13({'ret':_0x1fb647[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x556a13({'ret':_0x1964ab});}else _0x556a13({'ret':_0x1964ab});}else{_0x556a13({'ret':_0x1964ab});}});}});return 0xa;}var _0x37e8a0=function(_0x4bd64d){return new BPromise(function(_0x36502a,_0x5d9eb5){_0x247369(_0x4bd64d,_0xf140c3)['then'](function(_0x561375){_0xf140c3['scheduledat']=_0x561375[_0xe47b('0x2f')];_0x20b74b['CmHopper'][_0xe47b('0x1a')]({'where':{'phone':_0xf140c3['phone'],'CampaignId':_0x4bd64d['id']}})[_0xe47b('0x1b')](function(_0x35ce9a){if(!_[_0xe47b('0x1c')](_0x35ce9a)){throw new Error(_0xe47b('0x22')+_0xf140c3[_0xe47b('0xc')]+_0xe47b('0x30')+_0x4bd64d['id']);}return _0x20b74b[_0xe47b('0x31')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3['ListId'],'priority':_0xf140c3['priority']?_0xf140c3[_0xe47b('0x26')]:0x2,'scheduledat':_0xf140c3[_0xe47b('0x17')]?_0xf140c3[_0xe47b('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3[_0xe47b('0x27')]?_0xf140c3[_0xe47b('0x27')]:undefined,'callbackat':_0xf140c3[_0xe47b('0x27')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x4bd64d['id']});})['catch'](function(_0x51e4e4){_0x5d9eb5(_0x51e4e4);});});});};var _0x2fe858=function(_0x189602){return new BPromise(function(_0x2a6464,_0xafb853){_0x247369(_0x189602,_0xf140c3)[_0xe47b('0x1b')](function(_0x36ed08){_0xf140c3['scheduledat']=_0x36ed08['ret'];_0x20b74b[_0xe47b('0x31')]['findOne']({'where':{'phone':_0xf140c3[_0xe47b('0xc')],'CampaignId':_0x189602['id']}})['then'](function(_0x2684e9){if(!_[_0xe47b('0x1c')](_0x2684e9)){throw new Error(_0xe47b('0x22')+_0xf140c3[_0xe47b('0xc')]+_0xe47b('0x32')+_0x189602['id']);}return _0x20b74b[_0xe47b('0x29')]['findOne']({'where':{'calleridnum':_0xf140c3[_0xe47b('0xc')],'CampaignId':_0x189602['id']}});})[_0xe47b('0x1b')](function(_0xb2a728){if(!_[_0xe47b('0x1c')](_0xb2a728)){throw new Error(_0xe47b('0x2a')+_0xf140c3['phone']+_0xe47b('0x33')+_0x189602['id']);}return _0x20b74b[_0xe47b('0x31')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'priority':_0xf140c3[_0xe47b('0x26')]?_0xf140c3[_0xe47b('0x26')]:0x2,'scheduledat':_0xf140c3[_0xe47b('0x17')]?_0xf140c3[_0xe47b('0x17')]:moment()['format'](_0xe47b('0x19')),'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3['callbackUniqueid']?_0xf140c3['callbackUniqueid']:undefined,'callbackat':_0xf140c3[_0xe47b('0x27')]?moment()['format'](_0xe47b('0x19')):undefined,'CampaignId':_0x189602['id']});})['catch'](function(_0xb0c4d9){_0xafb853(_0xb0c4d9);});});});};if(_0xf140c3[_0xe47b('0x25')]){_0x20b74b['VoiceQueue'][_0xe47b('0x34')]({'where':{'type':_0xe47b('0x35')},'attributes':['id',_0xe47b('0x36'),_0xe47b('0x1d')],'include':[{'model':_0x20b74b[_0xe47b('0x37')],'as':_0xe47b('0x38'),'where':{'id':_0xf140c3[_0xe47b('0x25')]}}]})['then'](function(_0x1f007f){if(_0x1f007f){var _0x386893=[];for(var _0x6658ac=0x0,_0x244483;_0x6658ac<_0x1f007f[_0xe47b('0x39')];_0x6658ac+=0x1){_0x244483=_0x1f007f[_0x6658ac][_0xe47b('0x14')]({'plain':!![]});switch(_0x244483['dialCheckDuplicateType']){case _0xe47b('0x3a'):_0x3b342e(_0x244483)['catch'](_0x47e005());break;case'onlyIfOpen':_0x182d47(_0x244483)[_0xe47b('0x2c')](_0x47e005());break;default:_0x247369(_0x244483,_0xf140c3)['then'](function(_0xf8c121){_0xf140c3[_0xe47b('0x17')]=_0xf8c121['ret'];_0x20b74b[_0xe47b('0x31')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'scheduledat':_0xf140c3[_0xe47b('0x17')]?_0xf140c3['scheduledat']:moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xf140c3['priority']?_0xf140c3[_0xe47b('0x26')]:0x2,'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3['callbackUniqueid']?_0xf140c3[_0xe47b('0x27')]:undefined,'callbackat':_0xf140c3[_0xe47b('0x27')]?moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x244483['id']})['catch'](_0x47e005());});}}}})[_0xe47b('0x1b')](function(){return _0x20b74b[_0xe47b('0x3b')]['findAll']({'where':{'type':_0xe47b('0x35')},'attributes':['id'],'include':[{'model':_0x20b74b['CmList'],'as':'BlackLists','where':{'id':_0xf140c3[_0xe47b('0x25')]}}]})[_0xe47b('0x1b')](function(_0x49ae59){if(_0x49ae59){var _0x4890a5=[];for(var _0xad026e=0x0,_0x58e630;_0xad026e<_0x49ae59['length'];_0xad026e+=0x1){_0x58e630=_0x49ae59[_0xad026e]['get']({'plain':!![]});_0x20b74b[_0xe47b('0x3c')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'VoiceQueueId':_0x58e630['id']})[_0xe47b('0x2c')](function(_0x63bea1){logger[_0xe47b('0x2d')](_0xe47b('0x3d'),_0xe47b('0x16'),_0x63bea1[_0xe47b('0x3e')]);});}}});})[_0xe47b('0x1b')](function(){return _0x20b74b[_0xe47b('0x3f')][_0xe47b('0x34')]({'attributes':['id',_0xe47b('0x36'),_0xe47b('0x1d')],'include':[{'model':_0x20b74b[_0xe47b('0x37')],'as':_0xe47b('0x38'),'where':{'id':_0xf140c3[_0xe47b('0x25')]}}]})[_0xe47b('0x1b')](function(_0x501acf){if(_0x501acf){var _0x284087=[];for(var _0x1045ff=0x0,_0xb39b97;_0x1045ff<_0x501acf[_0xe47b('0x39')];_0x1045ff+=0x1){_0xb39b97=_0x501acf[_0x1045ff][_0xe47b('0x14')]({'plain':!![]});switch(_0xb39b97[_0xe47b('0x36')]){case _0xe47b('0x3a'):_0x2fe858(_0xb39b97)[_0xe47b('0x2c')](_0xb3bef3());break;case _0xe47b('0x40'):_0x37e8a0(_0xb39b97)[_0xe47b('0x2c')](_0xb3bef3());break;default:_0x20b74b[_0xe47b('0x31')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'scheduledat':_0xf140c3[_0xe47b('0x17')]?_0xf140c3[_0xe47b('0x17')]:moment()[_0xe47b('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xf140c3[_0xe47b('0x26')]?_0xf140c3[_0xe47b('0x26')]:0x2,'callback':_0xf140c3[_0xe47b('0x27')]?!![]:![],'callbackuniqueid':_0xf140c3[_0xe47b('0x27')]?_0xf140c3['callbackUniqueid']:undefined,'callbackat':_0xf140c3[_0xe47b('0x27')]?moment()[_0xe47b('0x18')](_0xe47b('0x19')):undefined,'CampaignId':_0xb39b97['id']})[_0xe47b('0x2c')](_0xb3bef3());}}}});})['then'](function(){return _0x20b74b['Campaign'][_0xe47b('0x34')]({'attributes':['id'],'include':[{'model':_0x20b74b[_0xe47b('0x37')],'as':_0xe47b('0x41'),'where':{'id':_0xf140c3['ListId']}}]})[_0xe47b('0x1b')](function(_0x49c720){if(_0x49c720){var _0x2cc6cf=[];for(var _0x59f1cb=0x0,_0x22425c;_0x59f1cb<_0x49c720[_0xe47b('0x39')];_0x59f1cb+=0x1){_0x22425c=_0x49c720[_0x59f1cb]['get']({'plain':!![]});_0x20b74b[_0xe47b('0x3c')][_0xe47b('0x24')]({'phone':_0xf140c3[_0xe47b('0xc')],'ContactId':_0xf140c3['id'],'ListId':_0xf140c3[_0xe47b('0x25')],'CampaignId':_0x22425c['id']})[_0xe47b('0x2c')](function(_0x510464){logger[_0xe47b('0x2d')](_0xe47b('0x3d'),_0xe47b('0x16'),_0x510464[_0xe47b('0x3e')]);});}}});})[_0xe47b('0x1b')](function(){_0x14377d();})[_0xe47b('0x2c')](function(_0x118d6c){logger[_0xe47b('0x2d')](_0xe47b('0x3d'),'afterCreate',_0x118d6c[_0xe47b('0x3e')]);_0x14377d(_0x118d6c);});}else{_0x14377d(new Error(_0xe47b('0x42')));}},'afterDestroy':function(_0x9014c3,_0x17ee25,_0x438d8a){var _0x2c24db=_0x47a7bc[_0xe47b('0x13')];var _0x437875=_0x9014c3['get']({'plain':!![]});return _0x2c24db['CmHopper'][_0xe47b('0x34')]({'raw':!![],'where':{'ListId':_0x437875[_0xe47b('0x25')],'ContactId':_0x437875['id']}})['then'](function(_0x4c388c){if(!_[_0xe47b('0x43')](_0x4c388c)){var _0x4b1674=[];for(var _0x55f2ba=0x0;_0x55f2ba<_0x4c388c[_0xe47b('0x39')];_0x55f2ba+=0x1){var _0x476928=_0x2c24db[_0xe47b('0x31')][_0xe47b('0x44')]({'where':{'ListId':_0x4c388c[_0x55f2ba][_0xe47b('0x25')],'ContactId':_0x4c388c[_0x55f2ba][_0xe47b('0x45')],'VoiceQueueId':_0x4c388c[_0x55f2ba][_0xe47b('0x46')],'CampaignId':_0x4c388c[_0x55f2ba]['CampaignId']}});_0x4b1674[_0xe47b('0x47')](_0x476928);}return BPromise[_0xe47b('0x48')](_0x4b1674);}})[_0xe47b('0x1b')](function(_0x22d246){logger[_0xe47b('0x49')](_0xe47b('0x4a'),util[_0xe47b('0x2e')](_0x22d246,{'showHidden':![],'depth':null}));_0x438d8a();})[_0xe47b('0x2c')](function(_0x22c230){logger[_0xe47b('0x2d')](_0xe47b('0x4b'),util[_0xe47b('0x2e')](_0x22c230,{'showHidden':![],'depth':null}));_0x438d8a(_0x22c230);});}}});}; \ No newline at end of file +var _0x170a=['CmHopperBlack','message','Campaign','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','ContactId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','moment','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','exports','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','afterCreate','inspect','scheduledat','format','isNil','VoiceQueue','findOne','then','dialTimezone','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','create','ListId','priority','callbackUniqueid','catch','CmHopperFinal','error','cmContact','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','always','onlyIfOpen','BlackLists'];(function(_0x152879,_0x38672b){var _0x56861b=function(_0x3dace3){while(--_0x3dace3){_0x152879['push'](_0x152879['shift']());}};_0x56861b(++_0x38672b);}(_0x170a,0x128));var _0xa170=function(_0x84325a,_0x36aff8){_0x84325a=_0x84325a-0x0;var _0x145498=_0x170a[_0x84325a];return _0x145498;};'use strict';var _=require(_0xa170('0x0'));var util=require(_0xa170('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa170('0x2'));var BPromise=require(_0xa170('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa170('0x4'));var rimraf=require(_0xa170('0x5'));var config=require(_0xa170('0x6'));var shared=require(_0xa170('0x7'));var attributes=require('./cmContact.attributes');module[_0xa170('0x8')]=function(_0x42677f,_0x367ef6){return _0x42677f['define'](_0xa170('0x9'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xa170('0xa'),'fields':['phone']},{'name':_0xa170('0xb'),'fields':[_0xa170('0xc'),_0xa170('0xd'),_0xa170('0xa'),_0xa170('0xe'),_0xa170('0xf'),_0xa170('0x10')],'type':_0xa170('0x11')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xa170('0x12'),'hooks':{'afterCreate':function(_0x3c4319,_0x57cfa3,_0x4397c2){var _0x1f5621=_0x42677f[_0xa170('0x13')];var _0x8e8e62=_0x3c4319[_0xa170('0x14')]({'plain':!![]});function _0x50f4b1(){return function(_0x2f2be1){logger['error']('cmContact',_0xa170('0x15'),util[_0xa170('0x16')](_0x2f2be1,{'showHidden':![],'depth':null}));};}function _0x21b457(_0x43a83e,_0x36ec90){var _0x49df49=_0x36ec90['scheduledat']?_0x36ec90[_0xa170('0x17')]:moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x2ec558,_0x5f934d){if(_[_0xa170('0x19')](_0x36ec90['dialTimezone'])){_0x2ec558({'ret':_0x49df49});}else{_0x1f5621[_0xa170('0x1a')][_0xa170('0x1b')]({'where':{'id':_0x43a83e['id']}})[_0xa170('0x1c')](function(_0x3a2f91){if(!_[_0xa170('0x19')](_0x3a2f91)){var _0x51b75d=_0x3a2f91[_0xa170('0x1d')];if(!_[_0xa170('0x19')](_0x51b75d)){var _0x37435c=shared[_0xa170('0x1e')];var _0x55fc44=_0x37435c[_0x51b75d];var _0x44e472=_0x37435c[_0x36ec90[_0xa170('0x1d')]];if(!_[_0xa170('0x19')](_0x55fc44)&&!_['isNil'](_0x44e472)){var _0x2f08f1=_0x55fc44[_0xa170('0x1f')]-_0x44e472[_0xa170('0x1f')];_0x49df49=_0x36ec90[_0xa170('0x17')]?_0x36ec90[_0xa170('0x17')]:moment();var _0x380a61=moment(_0x49df49)[_0xa170('0x20')](_0x2f08f1,_0xa170('0x21'));_0x2ec558({'ret':_0x380a61[_0xa170('0x18')](_0xa170('0x22'))});}else _0x2ec558({'ret':_0x49df49});}else _0x2ec558({'ret':_0x49df49});}else{_0x2ec558({'ret':_0x49df49});}});}});return 0xa;}var _0x10df83=function(_0x50d546){return new BPromise(function(_0x1a3e66,_0x2a633b){_0x21b457(_0x50d546,_0x8e8e62)[_0xa170('0x1c')](function(_0x1d7ac7){_0x8e8e62[_0xa170('0x17')]=_0x1d7ac7[_0xa170('0x23')];_0x1f5621[_0xa170('0x24')][_0xa170('0x1b')]({'where':{'phone':_0x8e8e62[_0xa170('0xa')],'VoiceQueueId':_0x50d546['id']}})[_0xa170('0x1c')](function(_0x49b524){if(!_[_0xa170('0x19')](_0x49b524)){throw new Error(_0xa170('0x25')+_0x8e8e62[_0xa170('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x50d546['id']);}return _0x1f5621[_0xa170('0x24')][_0xa170('0x26')]({'phone':_0x8e8e62[_0xa170('0xa')],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'priority':_0x8e8e62[_0xa170('0x28')]?_0x8e8e62[_0xa170('0x28')]:0x2,'scheduledat':_0x8e8e62[_0xa170('0x17')]?_0x8e8e62['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x8e8e62[_0xa170('0x29')]?!![]:![],'callbackuniqueid':_0x8e8e62[_0xa170('0x29')]?_0x8e8e62[_0xa170('0x29')]:undefined,'callbackat':_0x8e8e62[_0xa170('0x29')]?moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x50d546['id']});})[_0xa170('0x2a')](function(_0xca2276){_0x2a633b(_0xca2276);});});});};var _0x487ce3=function(_0xf7de72){return new BPromise(function(_0xa4d14e,_0x2361c5){_0x21b457(_0xf7de72,_0x8e8e62)[_0xa170('0x1c')](function(_0x4fd496){_0x8e8e62[_0xa170('0x17')]=_0x4fd496[_0xa170('0x23')];_0x1f5621[_0xa170('0x24')]['findOne']({'where':{'phone':_0x8e8e62[_0xa170('0xa')],'VoiceQueueId':_0xf7de72['id']}})[_0xa170('0x1c')](function(_0x34466c){if(!_[_0xa170('0x19')](_0x34466c)){throw new Error(_0xa170('0x25')+_0x8e8e62[_0xa170('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xf7de72['id']);}return _0x1f5621[_0xa170('0x2b')][_0xa170('0x1b')]({'where':{'calleridnum':_0x8e8e62[_0xa170('0xa')],'VoiceQueueId':_0xf7de72['id']}});})['then'](function(_0x57826a){if(!_[_0xa170('0x19')](_0x57826a)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x8e8e62[_0xa170('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0xf7de72['id']);}return _0x1f5621[_0xa170('0x24')][_0xa170('0x26')]({'phone':_0x8e8e62[_0xa170('0xa')],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'priority':_0x8e8e62[_0xa170('0x28')]?_0x8e8e62[_0xa170('0x28')]:0x2,'scheduledat':_0x8e8e62[_0xa170('0x17')]?_0x8e8e62[_0xa170('0x17')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x8e8e62[_0xa170('0x29')]?!![]:![],'callbackuniqueid':_0x8e8e62[_0xa170('0x29')]?_0x8e8e62[_0xa170('0x29')]:undefined,'callbackat':_0x8e8e62[_0xa170('0x29')]?moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xf7de72['id']});})['catch'](function(_0x5dfd9d){_0x2361c5(_0x5dfd9d);});});});};function _0x2f4323(){return function(_0x4fcb9c){logger[_0xa170('0x2c')](_0xa170('0x2d'),'afterCreate',util[_0xa170('0x16')](_0x4fcb9c,{'showHidden':![],'depth':null}));};}function _0x11f0f9(_0x4371c0,_0xfccbe6){var _0x257c4f=_0xfccbe6[_0xa170('0x17')]?_0xfccbe6['scheduledat']:moment()[_0xa170('0x18')](_0xa170('0x22'));return new BPromise(function(_0x3d7a40,_0x4acb6a){if(_['isNil'](_0xfccbe6['dialTimezone'])){_0x3d7a40({'ret':_0x257c4f});}else{_0x1f5621['Campaign'][_0xa170('0x1b')]({'where':{'id':_0x4371c0['id']}})['then'](function(_0x560372){if(!_['isNil'](_0x560372)){var _0x7d9ea9=_0x560372['dialTimezone'];if(!_[_0xa170('0x19')](_0x7d9ea9)){var _0x5d40cf=shared[_0xa170('0x1e')];var _0x2223fe=_0x5d40cf[_0x7d9ea9];var _0x44da06=_0x5d40cf[_0xfccbe6[_0xa170('0x1d')]];if(!_[_0xa170('0x19')](_0x2223fe)&&!_['isNil'](_0x44da06)){var _0x3b2fb7=_0x2223fe[_0xa170('0x1f')]-_0x44da06[_0xa170('0x1f')];_0x257c4f=_0xfccbe6[_0xa170('0x17')]?_0xfccbe6[_0xa170('0x17')]:moment();var _0x4214bc=moment(_0x257c4f)[_0xa170('0x20')](_0x3b2fb7,'minutes');_0x3d7a40({'ret':_0x4214bc[_0xa170('0x18')](_0xa170('0x22'))});}else _0x3d7a40({'ret':_0x257c4f});}else _0x3d7a40({'ret':_0x257c4f});}else{_0x3d7a40({'ret':_0x257c4f});}});}});return 0xa;}var _0x5a9931=function(_0x22aa6a){return new BPromise(function(_0x4d98fb,_0x320af7){_0x11f0f9(_0x22aa6a,_0x8e8e62)[_0xa170('0x1c')](function(_0x20ae39){_0x8e8e62[_0xa170('0x17')]=_0x20ae39[_0xa170('0x23')];_0x1f5621[_0xa170('0x24')]['findOne']({'where':{'phone':_0x8e8e62[_0xa170('0xa')],'CampaignId':_0x22aa6a['id']}})[_0xa170('0x1c')](function(_0x6dd7fd){if(!_[_0xa170('0x19')](_0x6dd7fd)){throw new Error(_0xa170('0x25')+_0x8e8e62['phone']+_0xa170('0x2e')+_0x22aa6a['id']);}return _0x1f5621[_0xa170('0x24')]['create']({'phone':_0x8e8e62[_0xa170('0xa')],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62['ListId'],'priority':_0x8e8e62[_0xa170('0x28')]?_0x8e8e62['priority']:0x2,'scheduledat':_0x8e8e62[_0xa170('0x17')]?_0x8e8e62[_0xa170('0x17')]:moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x8e8e62[_0xa170('0x29')]?!![]:![],'callbackuniqueid':_0x8e8e62[_0xa170('0x29')]?_0x8e8e62[_0xa170('0x29')]:undefined,'callbackat':_0x8e8e62[_0xa170('0x29')]?moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x22aa6a['id']});})['catch'](function(_0x45c8c4){_0x320af7(_0x45c8c4);});});});};var _0x1fb1b1=function(_0x3bcea1){return new BPromise(function(_0x1b0fad,_0x2ab9dc){_0x11f0f9(_0x3bcea1,_0x8e8e62)[_0xa170('0x1c')](function(_0x285104){_0x8e8e62[_0xa170('0x17')]=_0x285104[_0xa170('0x23')];_0x1f5621[_0xa170('0x24')][_0xa170('0x1b')]({'where':{'phone':_0x8e8e62[_0xa170('0xa')],'CampaignId':_0x3bcea1['id']}})[_0xa170('0x1c')](function(_0x2f434c){if(!_[_0xa170('0x19')](_0x2f434c)){throw new Error(_0xa170('0x25')+_0x8e8e62['phone']+_0xa170('0x2f')+_0x3bcea1['id']);}return _0x1f5621[_0xa170('0x2b')]['findOne']({'where':{'calleridnum':_0x8e8e62[_0xa170('0xa')],'CampaignId':_0x3bcea1['id']}});})[_0xa170('0x1c')](function(_0x148cf3){if(!_[_0xa170('0x19')](_0x148cf3)){throw new Error(_0xa170('0x30')+_0x8e8e62[_0xa170('0xa')]+_0xa170('0x31')+_0x3bcea1['id']);}return _0x1f5621[_0xa170('0x24')][_0xa170('0x26')]({'phone':_0x8e8e62['phone'],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'priority':_0x8e8e62['priority']?_0x8e8e62[_0xa170('0x28')]:0x2,'scheduledat':_0x8e8e62[_0xa170('0x17')]?_0x8e8e62[_0xa170('0x17')]:moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x8e8e62[_0xa170('0x29')]?!![]:![],'callbackuniqueid':_0x8e8e62[_0xa170('0x29')]?_0x8e8e62['callbackUniqueid']:undefined,'callbackat':_0x8e8e62[_0xa170('0x29')]?moment()[_0xa170('0x18')](_0xa170('0x22')):undefined,'CampaignId':_0x3bcea1['id']});})[_0xa170('0x2a')](function(_0x1eef44){_0x2ab9dc(_0x1eef44);});});});};if(_0x8e8e62['ListId']){_0x1f5621['VoiceQueue'][_0xa170('0x32')]({'where':{'type':_0xa170('0x33')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x1f5621[_0xa170('0x34')],'as':_0xa170('0x35'),'where':{'id':_0x8e8e62['ListId']}}]})[_0xa170('0x1c')](function(_0x2673ab){if(_0x2673ab){var _0xda6f5e=[];for(var _0x54f84e=0x0,_0x1bab56;_0x54f84e<_0x2673ab[_0xa170('0x36')];_0x54f84e+=0x1){_0x1bab56=_0x2673ab[_0x54f84e]['get']({'plain':!![]});switch(_0x1bab56[_0xa170('0x37')]){case _0xa170('0x38'):_0x487ce3(_0x1bab56)[_0xa170('0x2a')](_0x50f4b1());break;case _0xa170('0x39'):_0x10df83(_0x1bab56)[_0xa170('0x2a')](_0x50f4b1());break;default:_0x11f0f9(_0x1bab56,_0x8e8e62)['then'](function(_0x37e85f){_0x8e8e62['scheduledat']=_0x37e85f['ret'];_0x1f5621[_0xa170('0x24')][_0xa170('0x26')]({'phone':_0x8e8e62['phone'],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'scheduledat':_0x8e8e62['scheduledat']?_0x8e8e62[_0xa170('0x17')]:moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x8e8e62[_0xa170('0x28')]?_0x8e8e62[_0xa170('0x28')]:0x2,'callback':_0x8e8e62['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x8e8e62[_0xa170('0x29')]?_0x8e8e62[_0xa170('0x29')]:undefined,'callbackat':_0x8e8e62['callbackUniqueid']?moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x1bab56['id']})[_0xa170('0x2a')](_0x50f4b1());});}}}})[_0xa170('0x1c')](function(){return _0x1f5621['VoiceQueue'][_0xa170('0x32')]({'where':{'type':_0xa170('0x33')},'attributes':['id'],'include':[{'model':_0x1f5621[_0xa170('0x34')],'as':_0xa170('0x3a'),'where':{'id':_0x8e8e62[_0xa170('0x27')]}}]})['then'](function(_0xdf0026){if(_0xdf0026){var _0x2f7215=[];for(var _0x49f4f3=0x0,_0x438ca0;_0x49f4f3<_0xdf0026[_0xa170('0x36')];_0x49f4f3+=0x1){_0x438ca0=_0xdf0026[_0x49f4f3][_0xa170('0x14')]({'plain':!![]});_0x1f5621[_0xa170('0x3b')][_0xa170('0x26')]({'phone':_0x8e8e62['phone'],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62['ListId'],'VoiceQueueId':_0x438ca0['id']})[_0xa170('0x2a')](function(_0x400ff6){logger[_0xa170('0x2c')]('cmContact,\x20%s,\x20%s',_0xa170('0x15'),_0x400ff6[_0xa170('0x3c')]);});}}});})[_0xa170('0x1c')](function(){return _0x1f5621['Campaign'][_0xa170('0x32')]({'attributes':['id',_0xa170('0x37'),'dialTimezone'],'include':[{'model':_0x1f5621[_0xa170('0x34')],'as':_0xa170('0x35'),'where':{'id':_0x8e8e62[_0xa170('0x27')]}}]})['then'](function(_0x18c741){if(_0x18c741){var _0x48742e=[];for(var _0x65c170=0x0,_0x3f8b48;_0x65c170<_0x18c741[_0xa170('0x36')];_0x65c170+=0x1){_0x3f8b48=_0x18c741[_0x65c170][_0xa170('0x14')]({'plain':!![]});switch(_0x3f8b48['dialCheckDuplicateType']){case _0xa170('0x38'):_0x1fb1b1(_0x3f8b48)['catch'](_0x2f4323());break;case _0xa170('0x39'):_0x5a9931(_0x3f8b48)[_0xa170('0x2a')](_0x2f4323());break;default:_0x1f5621[_0xa170('0x24')][_0xa170('0x26')]({'phone':_0x8e8e62[_0xa170('0xa')],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'scheduledat':_0x8e8e62[_0xa170('0x17')]?_0x8e8e62[_0xa170('0x17')]:moment()[_0xa170('0x18')](_0xa170('0x22')),'priority':_0x8e8e62[_0xa170('0x28')]?_0x8e8e62['priority']:0x2,'callback':_0x8e8e62['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x8e8e62['callbackUniqueid']?_0x8e8e62[_0xa170('0x29')]:undefined,'callbackat':_0x8e8e62[_0xa170('0x29')]?moment()[_0xa170('0x18')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3f8b48['id']})['catch'](_0x2f4323());}}}});})['then'](function(){return _0x1f5621[_0xa170('0x3d')]['findAll']({'attributes':['id'],'include':[{'model':_0x1f5621[_0xa170('0x34')],'as':_0xa170('0x3a'),'where':{'id':_0x8e8e62['ListId']}}]})[_0xa170('0x1c')](function(_0x3b30dc){if(_0x3b30dc){var _0xafec24=[];for(var _0x3270c8=0x0,_0x2bcfaa;_0x3270c8<_0x3b30dc[_0xa170('0x36')];_0x3270c8+=0x1){_0x2bcfaa=_0x3b30dc[_0x3270c8][_0xa170('0x14')]({'plain':!![]});_0x1f5621[_0xa170('0x3b')]['create']({'phone':_0x8e8e62['phone'],'ContactId':_0x8e8e62['id'],'ListId':_0x8e8e62[_0xa170('0x27')],'CampaignId':_0x2bcfaa['id']})[_0xa170('0x2a')](function(_0x3fdf12){logger['error'](_0xa170('0x3e'),'afterCreate',_0x3fdf12['message']);});}}});})[_0xa170('0x1c')](function(){_0x4397c2();})[_0xa170('0x2a')](function(_0x91501c){logger[_0xa170('0x2c')]('cmContact,\x20%s,\x20%s','afterCreate',_0x91501c[_0xa170('0x3c')]);_0x4397c2(_0x91501c);});}else{_0x4397c2(new Error(_0xa170('0x3f')));}},'afterDestroy':function(_0x55a825,_0x209283,_0x402fb2){var _0x42e4a7=_0x42677f[_0xa170('0x13')];var _0x55d7c8=_0x55a825[_0xa170('0x14')]({'plain':!![]});return _0x42e4a7[_0xa170('0x24')][_0xa170('0x32')]({'raw':!![],'where':{'ListId':_0x55d7c8[_0xa170('0x27')],'ContactId':_0x55d7c8['id']}})[_0xa170('0x1c')](function(_0x52b02d){if(!_[_0xa170('0x40')](_0x52b02d)){var _0x3e1b5b=[];for(var _0xe1f354=0x0;_0xe1f354<_0x52b02d[_0xa170('0x36')];_0xe1f354+=0x1){var _0x4f5db5=_0x42e4a7[_0xa170('0x24')][_0xa170('0x41')]({'where':{'ListId':_0x52b02d[_0xe1f354]['ListId'],'ContactId':_0x52b02d[_0xe1f354][_0xa170('0x42')],'VoiceQueueId':_0x52b02d[_0xe1f354]['VoiceQueueId'],'CampaignId':_0x52b02d[_0xe1f354]['CampaignId']}});_0x3e1b5b['push'](_0x4f5db5);}return BPromise[_0xa170('0x43')](_0x3e1b5b);}})[_0xa170('0x1c')](function(_0x5f19f5){logger[_0xa170('0x44')](_0xa170('0x45'),util[_0xa170('0x16')](_0x5f19f5,{'showHidden':![],'depth':null}));_0x402fb2();})[_0xa170('0x2a')](function(_0xcfb593){logger['error'](_0xa170('0x46'),util[_0xa170('0x16')](_0xcfb593,{'showHidden':![],'depth':null}));_0x402fb2(_0xcfb593);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 88054dd..c7bee05 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(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x193b41,_0x2fecc4){var _0x147280=function(_0x122954){while(--_0x122954){_0x193b41['push'](_0x193b41['shift']());}};_0x147280(++_0x2fecc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 8827c51..4ff36d8 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 _0x97a2=['PHONE','sequelize','INTEGER','STRING'];(function(_0x152ef6,_0x1cec9){var _0x82781c=function(_0x7e92b9){while(--_0x7e92b9){_0x152ef6['push'](_0x152ef6['shift']());}};_0x82781c(++_0x1cec9);}(_0x97a2,0x1b1));var _0x297a=function(_0x38cf2d,_0x35a091){_0x38cf2d=_0x38cf2d-0x0;var _0x1e06cd=_0x97a2[_0x38cf2d];return _0x1e06cd;};'use strict';var Sequelize=require(_0x297a('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x297a('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x297a('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x297a('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x297a('0x2')],'defaultValue':_0x297a('0x3')},'OrderBy':{'type':Sequelize[_0x297a('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x297a('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x02ef=['sequelize','INTEGER','STRING'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x02ef,0x11a));var _0xf02e=function(_0x51a023,_0x40ff38){_0x51a023=_0x51a023-0x0;var _0x1dfe91=_0x02ef[_0x51a023];return _0x1dfe91;};'use strict';var Sequelize=require(_0xf02e('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xf02e('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xf02e('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xf02e('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xf02e('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xf02e('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 439c703..f0c6172 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 _0xe249=['includeAll','include','findAll','rows','catch','show','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','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','name','send','index','map','CmContactHasItem','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count'];(function(_0x7967fc,_0x14e753){var _0x351203=function(_0x38a68a){while(--_0x38a68a){_0x7967fc['push'](_0x7967fc['shift']());}};_0x351203(++_0x14e753);}(_0xe249,0x172));var _0x9e24=function(_0x5f540f,_0x390da4){_0x5f540f=_0x5f540f-0x0;var _0x15e8f8=_0xe249[_0x5f540f];return _0x15e8f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e24('0x0'));var zipdir=require(_0x9e24('0x1'));var jsonpatch=require(_0x9e24('0x2'));var rp=require(_0x9e24('0x3'));var moment=require(_0x9e24('0x4'));var BPromise=require(_0x9e24('0x5'));var Mustache=require(_0x9e24('0x6'));var util=require('util');var path=require(_0x9e24('0x7'));var sox=require(_0x9e24('0x8'));var csv=require(_0x9e24('0x9'));var ejs=require(_0x9e24('0xa'));var fs=require('fs');var fs_extra=require(_0x9e24('0xb'));var _=require(_0x9e24('0xc'));var squel=require(_0x9e24('0xd'));var crypto=require(_0x9e24('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9e24('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9e24('0x10'));var Papa=require(_0x9e24('0x11'));var Redis=require(_0x9e24('0x12'));var authService=require(_0x9e24('0x13'));var qs=require(_0x9e24('0x14'));var as=require(_0x9e24('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e24('0x16'))(_0x9e24('0x17'));var utils=require(_0x9e24('0x18'));var config=require(_0x9e24('0x19'));var licenseUtil=require(_0x9e24('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41885d,_0x5a083f){_0x5a083f=_0x5a083f||0xcc;return function(_0x1da12c){if(_0x1da12c){return _0x41885d[_0x9e24('0x1b')](_0x5a083f);}return _0x41885d[_0x9e24('0x1c')](_0x5a083f)[_0x9e24('0x1d')]();};}function respondWithResult(_0x19b387,_0x4a8640){_0x4a8640=_0x4a8640||0xc8;return function(_0x269e35){if(_0x269e35){return _0x19b387[_0x9e24('0x1c')](_0x4a8640)[_0x9e24('0x1e')](_0x269e35);}};}function respondWithFilteredResult(_0x561fa5,_0x53ef35){return function(_0x41dfe4){if(_0x41dfe4){var _0x25ea1e=typeof _0x53ef35[_0x9e24('0x1f')]==='undefined'&&typeof _0x53ef35['limit']===_0x9e24('0x20');var _0x1320a4=_0x41dfe4['count'];var _0x6e9a8d=_0x25ea1e?0x0:_0x53ef35[_0x9e24('0x1f')];var _0x4b37d3=_0x25ea1e?_0x41dfe4['count']:_0x53ef35['offset']+_0x53ef35[_0x9e24('0x21')];var _0x2756a9;if(_0x4b37d3>=_0x1320a4){_0x4b37d3=_0x1320a4;_0x2756a9=0xc8;}else{_0x2756a9=0xce;}_0x561fa5[_0x9e24('0x1c')](_0x2756a9);return _0x561fa5[_0x9e24('0x22')]('Content-Range',_0x6e9a8d+'-'+_0x4b37d3+'/'+_0x1320a4)[_0x9e24('0x1e')](_0x41dfe4);}return null;};}function patchUpdates(_0x18925d){return function(_0x2626db){try{jsonpatch[_0x9e24('0x23')](_0x2626db,_0x18925d,!![]);}catch(_0x17347a){return BPromise[_0x9e24('0x24')](_0x17347a);}return _0x2626db[_0x9e24('0x25')]();};}function saveUpdates(_0x178763,_0x1dd77b){return function(_0x2552ae){if(_0x2552ae){return _0x2552ae[_0x9e24('0x26')](_0x178763)[_0x9e24('0x27')](function(_0x3650ce){return _0x3650ce;});}return null;};}function removeEntity(_0x2d56a5,_0x164f9a){return function(_0x4b43bd){if(_0x4b43bd){return _0x4b43bd[_0x9e24('0x28')]()[_0x9e24('0x27')](function(){var _0x19032d=_0x4b43bd['get']({'plain':!![]});var _0x25d31f=_0x9e24('0x29');return db[_0x9e24('0x2a')][_0x9e24('0x28')]({'where':{'type':_0x25d31f,'resourceId':_0x19032d['id']}})['then'](function(){return _0x4b43bd;});})[_0x9e24('0x27')](function(){_0x2d56a5[_0x9e24('0x1c')](0xcc)[_0x9e24('0x1d')]();});}};}function handleEntityNotFound(_0x103b7a,_0x2492ca){return function(_0x577729){if(!_0x577729){_0x103b7a['sendStatus'](0x194);}return _0x577729;};}function handleError(_0x275ff3,_0x523a0b){_0x523a0b=_0x523a0b||0x1f4;return function(_0x5616e9){logger[_0x9e24('0x2b')](_0x5616e9['stack']);if(_0x5616e9[_0x9e24('0x2c')]){delete _0x5616e9[_0x9e24('0x2c')];}_0x275ff3[_0x9e24('0x1c')](_0x523a0b)[_0x9e24('0x2d')](_0x5616e9);};}exports[_0x9e24('0x2e')]=function(_0x2e0cb5,_0x3d2a03){var _0x573fd5={},_0xc65870={},_0x1fdea2={'count':0x0,'rows':[]};var _0x4c8b6a=_[_0x9e24('0x2f')](db[_0x9e24('0x30')][_0x9e24('0x31')],function(_0x5b4c44){return{'name':_0x5b4c44['fieldName'],'type':_0x5b4c44[_0x9e24('0x32')][_0x9e24('0x33')]};});_0xc65870['model']=_[_0x9e24('0x2f')](_0x4c8b6a,_0x9e24('0x2c'));_0xc65870[_0x9e24('0x34')]=_[_0x9e24('0x35')](_0x2e0cb5[_0x9e24('0x34')]);_0xc65870[_0x9e24('0x36')]=_[_0x9e24('0x37')](_0xc65870['model'],_0xc65870['query']);_0x573fd5['attributes']=_[_0x9e24('0x37')](_0xc65870[_0x9e24('0x38')],qs[_0x9e24('0x39')](_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x39')]));_0x573fd5['attributes']=_0x573fd5[_0x9e24('0x3a')][_0x9e24('0x3b')]?_0x573fd5['attributes']:_0xc65870[_0x9e24('0x38')];if(!_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x3c')](_0x9e24('0x3d'))){_0x573fd5['limit']=qs[_0x9e24('0x21')](_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x21')]);_0x573fd5[_0x9e24('0x1f')]=qs[_0x9e24('0x1f')](_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x1f')]);}_0x573fd5[_0x9e24('0x3e')]=qs['sort'](_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x3f')]);_0x573fd5['where']=qs[_0x9e24('0x36')](_['pick'](_0x2e0cb5[_0x9e24('0x34')],_0xc65870[_0x9e24('0x36')]),_0x4c8b6a);if(_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x40')]){_0x573fd5[_0x9e24('0x41')]=_[_0x9e24('0x42')](_0x573fd5[_0x9e24('0x41')],{'$or':_[_0x9e24('0x2f')](_0x4c8b6a,function(_0x494970){if(_0x494970[_0x9e24('0x32')]!==_0x9e24('0x43')){var _0x2fc608={};_0x2fc608[_0x494970[_0x9e24('0x2c')]]={'$like':'%'+_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x40')]+'%'};return _0x2fc608;}})});}_0x573fd5=_['merge']({},_0x573fd5,_0x2e0cb5[_0x9e24('0x44')]);var _0x42b2a7={'where':_0x573fd5['where']};return db[_0x9e24('0x30')][_0x9e24('0x45')](_0x42b2a7)[_0x9e24('0x27')](function(_0x5c1f80){_0x1fdea2[_0x9e24('0x45')]=_0x5c1f80;if(_0x2e0cb5[_0x9e24('0x34')][_0x9e24('0x46')]){_0x573fd5[_0x9e24('0x47')]=[{'all':!![]}];}return db[_0x9e24('0x30')][_0x9e24('0x48')](_0x573fd5);})['then'](function(_0x4ba964){_0x1fdea2[_0x9e24('0x49')]=_0x4ba964;return _0x1fdea2;})['then'](respondWithFilteredResult(_0x3d2a03,_0x573fd5))[_0x9e24('0x4a')](handleError(_0x3d2a03,null));};exports[_0x9e24('0x4b')]=function(_0x4ec434,_0xb90ec3){var _0x4d4449={'raw':!![],'where':{'id':_0x4ec434['params']['id']}},_0x256b7f={};_0x256b7f[_0x9e24('0x38')]=_[_0x9e24('0x35')](db[_0x9e24('0x30')][_0x9e24('0x31')]);_0x256b7f[_0x9e24('0x34')]=_['keys'](_0x4ec434[_0x9e24('0x34')]);_0x256b7f[_0x9e24('0x36')]=_[_0x9e24('0x37')](_0x256b7f['model'],_0x256b7f['query']);_0x4d4449['attributes']=_[_0x9e24('0x37')](_0x256b7f[_0x9e24('0x38')],qs[_0x9e24('0x39')](_0x4ec434['query']['fields']));_0x4d4449['attributes']=_0x4d4449[_0x9e24('0x3a')]['length']?_0x4d4449[_0x9e24('0x3a')]:_0x256b7f['model'];if(_0x4ec434[_0x9e24('0x34')][_0x9e24('0x46')]){_0x4d4449[_0x9e24('0x47')]=[{'all':!![]}];}_0x4d4449=_[_0x9e24('0x42')]({},_0x4d4449,_0x4ec434[_0x9e24('0x44')]);return db[_0x9e24('0x30')]['find'](_0x4d4449)[_0x9e24('0x27')](handleEntityNotFound(_0xb90ec3,null))[_0x9e24('0x27')](respondWithResult(_0xb90ec3,null))[_0x9e24('0x4a')](handleError(_0xb90ec3,null));};exports[_0x9e24('0x4c')]=function(_0x344e6e,_0x48b84b){return db[_0x9e24('0x30')][_0x9e24('0x4c')](_0x344e6e[_0x9e24('0x4d')],{})['then'](function(_0x18d1a0){var _0x42778b=_0x344e6e[_0x9e24('0x4e')][_0x9e24('0x4f')]({'plain':!![]});if(!_0x42778b)throw new Error(_0x9e24('0x50'));if(_0x42778b[_0x9e24('0x51')]===_0x9e24('0x4e')){var _0x5b79ef=_0x18d1a0[_0x9e24('0x4f')]({'plain':!![]});var _0x7e3dd7='CmContactHasItems';return db[_0x9e24('0x52')][_0x9e24('0x53')]({'where':{'name':_0x7e3dd7,'userProfileId':_0x42778b[_0x9e24('0x54')]},'raw':!![]})[_0x9e24('0x27')](function(_0x41fd48){if(_0x41fd48&&_0x41fd48[_0x9e24('0x55')]===0x0){return db[_0x9e24('0x2a')][_0x9e24('0x4c')]({'name':_0x5b79ef[_0x9e24('0x2c')],'resourceId':_0x5b79ef['id'],'type':_0x41fd48['name'],'sectionId':_0x41fd48['id']},{})[_0x9e24('0x27')](function(){return _0x18d1a0;});}else{return _0x18d1a0;}})['catch'](function(_0x936dd4){logger[_0x9e24('0x2b')](_0x9e24('0x56'),_0x936dd4);throw _0x936dd4;});}return _0x18d1a0;})['then'](respondWithResult(_0x48b84b,0xc9))[_0x9e24('0x4a')](handleError(_0x48b84b,null));};exports[_0x9e24('0x26')]=function(_0x5ea97c,_0x2c29f8){if(_0x5ea97c[_0x9e24('0x4d')]['id']){delete _0x5ea97c[_0x9e24('0x4d')]['id'];}return db['CmContactHasItem'][_0x9e24('0x53')]({'where':{'id':_0x5ea97c[_0x9e24('0x57')]['id']}})[_0x9e24('0x27')](handleEntityNotFound(_0x2c29f8,null))['then'](saveUpdates(_0x5ea97c[_0x9e24('0x4d')],null))[_0x9e24('0x27')](respondWithResult(_0x2c29f8,null))[_0x9e24('0x4a')](handleError(_0x2c29f8,null));};exports[_0x9e24('0x28')]=function(_0x11b679,_0x33236f){return db['CmContactHasItem'][_0x9e24('0x53')]({'where':{'id':_0x11b679['params']['id']}})[_0x9e24('0x27')](handleEntityNotFound(_0x33236f,null))[_0x9e24('0x27')](removeEntity(_0x33236f,null))[_0x9e24('0x4a')](handleError(_0x33236f,null));}; \ No newline at end of file +var _0x650f=['count','offset','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','name','status','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','get','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit'];(function(_0x2da5,_0x155a77){var _0x393fa9=function(_0xfb161e){while(--_0xfb161e){_0x2da5['push'](_0x2da5['shift']());}};_0x393fa9(++_0x155a77);}(_0x650f,0x1c1));var _0xf650=function(_0x4ba636,_0x71c18c){_0x4ba636=_0x4ba636-0x0;var _0x487c69=_0x650f[_0x4ba636];return _0x487c69;};'use strict';var emlformat=require(_0xf650('0x0'));var rimraf=require(_0xf650('0x1'));var zipdir=require(_0xf650('0x2'));var jsonpatch=require(_0xf650('0x3'));var rp=require(_0xf650('0x4'));var moment=require('moment');var BPromise=require(_0xf650('0x5'));var Mustache=require('mustache');var util=require(_0xf650('0x6'));var path=require(_0xf650('0x7'));var sox=require(_0xf650('0x8'));var csv=require(_0xf650('0x9'));var ejs=require(_0xf650('0xa'));var fs=require('fs');var fs_extra=require(_0xf650('0xb'));var _=require(_0xf650('0xc'));var squel=require('squel');var crypto=require(_0xf650('0xd'));var jsforce=require(_0xf650('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf650('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf650('0x10'));var hardwareService=require(_0xf650('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf650('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf650('0x13'));var db=require(_0xf650('0x14'))['db'];function respondWithStatusCode(_0x2a1302,_0xe942c2){_0xe942c2=_0xe942c2||0xcc;return function(_0x24c656){if(_0x24c656){return _0x2a1302[_0xf650('0x15')](_0xe942c2);}return _0x2a1302['status'](_0xe942c2)[_0xf650('0x16')]();};}function respondWithResult(_0x24ad5c,_0x123618){_0x123618=_0x123618||0xc8;return function(_0x147dea){if(_0x147dea){return _0x24ad5c['status'](_0x123618)[_0xf650('0x17')](_0x147dea);}};}function respondWithFilteredResult(_0x5589a6,_0x3cb81c){return function(_0x3fbfae){if(_0x3fbfae){var _0x4acc05=typeof _0x3cb81c['offset']==='undefined'&&typeof _0x3cb81c[_0xf650('0x18')]==='undefined';var _0x59a65b=_0x3fbfae[_0xf650('0x19')];var _0x3dbf11=_0x4acc05?0x0:_0x3cb81c['offset'];var _0x46b299=_0x4acc05?_0x3fbfae['count']:_0x3cb81c[_0xf650('0x1a')]+_0x3cb81c[_0xf650('0x18')];var _0x21ac28;if(_0x46b299>=_0x59a65b){_0x46b299=_0x59a65b;_0x21ac28=0xc8;}else{_0x21ac28=0xce;}_0x5589a6['status'](_0x21ac28);return _0x5589a6[_0xf650('0x1b')](_0xf650('0x1c'),_0x3dbf11+'-'+_0x46b299+'/'+_0x59a65b)[_0xf650('0x17')](_0x3fbfae);}return null;};}function patchUpdates(_0x3eaf28){return function(_0x2f8d74){try{jsonpatch[_0xf650('0x1d')](_0x2f8d74,_0x3eaf28,!![]);}catch(_0x2f5628){return BPromise[_0xf650('0x1e')](_0x2f5628);}return _0x2f8d74[_0xf650('0x1f')]();};}function saveUpdates(_0x350c5e,_0x5a35eb){return function(_0x3e4931){if(_0x3e4931){return _0x3e4931[_0xf650('0x20')](_0x350c5e)[_0xf650('0x21')](function(_0x4998dd){return _0x4998dd;});}return null;};}function removeEntity(_0x105794,_0x1a17e4){return function(_0x9c2632){if(_0x9c2632){return _0x9c2632[_0xf650('0x22')]()[_0xf650('0x21')](function(){var _0x2b456c=_0x9c2632['get']({'plain':!![]});var _0x4de1cb=_0xf650('0x23');return db[_0xf650('0x24')]['destroy']({'where':{'type':_0x4de1cb,'resourceId':_0x2b456c['id']}})[_0xf650('0x21')](function(){return _0x9c2632;});})['then'](function(){_0x105794['status'](0xcc)[_0xf650('0x16')]();});}};}function handleEntityNotFound(_0x39b3cb,_0x1560da){return function(_0x3429a0){if(!_0x3429a0){_0x39b3cb[_0xf650('0x15')](0x194);}return _0x3429a0;};}function handleError(_0x3e8cd6,_0x4c0905){_0x4c0905=_0x4c0905||0x1f4;return function(_0x370d56){logger['error'](_0x370d56['stack']);if(_0x370d56['name']){delete _0x370d56[_0xf650('0x25')];}_0x3e8cd6[_0xf650('0x26')](_0x4c0905)[_0xf650('0x27')](_0x370d56);};}exports[_0xf650('0x28')]=function(_0x3cbd49,_0x492ee8){var _0x560b77={},_0xf05c5a={},_0x3ef1e1={'count':0x0,'rows':[]};var _0x6381b3=_['map'](db[_0xf650('0x29')][_0xf650('0x2a')],function(_0x6a6c5a){return{'name':_0x6a6c5a[_0xf650('0x2b')],'type':_0x6a6c5a[_0xf650('0x2c')][_0xf650('0x2d')]};});_0xf05c5a[_0xf650('0x2e')]=_[_0xf650('0x2f')](_0x6381b3,'name');_0xf05c5a[_0xf650('0x30')]=_['keys'](_0x3cbd49['query']);_0xf05c5a[_0xf650('0x31')]=_[_0xf650('0x32')](_0xf05c5a[_0xf650('0x2e')],_0xf05c5a[_0xf650('0x30')]);_0x560b77[_0xf650('0x33')]=_[_0xf650('0x32')](_0xf05c5a['model'],qs[_0xf650('0x34')](_0x3cbd49[_0xf650('0x30')][_0xf650('0x34')]));_0x560b77[_0xf650('0x33')]=_0x560b77[_0xf650('0x33')][_0xf650('0x35')]?_0x560b77['attributes']:_0xf05c5a['model'];if(!_0x3cbd49[_0xf650('0x30')]['hasOwnProperty']('nolimit')){_0x560b77[_0xf650('0x18')]=qs[_0xf650('0x18')](_0x3cbd49['query'][_0xf650('0x18')]);_0x560b77['offset']=qs[_0xf650('0x1a')](_0x3cbd49[_0xf650('0x30')][_0xf650('0x1a')]);}_0x560b77[_0xf650('0x36')]=qs[_0xf650('0x37')](_0x3cbd49[_0xf650('0x30')]['sort']);_0x560b77[_0xf650('0x38')]=qs[_0xf650('0x31')](_[_0xf650('0x39')](_0x3cbd49[_0xf650('0x30')],_0xf05c5a[_0xf650('0x31')]),_0x6381b3);if(_0x3cbd49[_0xf650('0x30')]['filter']){_0x560b77[_0xf650('0x38')]=_[_0xf650('0x3a')](_0x560b77['where'],{'$or':_[_0xf650('0x2f')](_0x6381b3,function(_0x958dfc){if(_0x958dfc[_0xf650('0x2c')]!==_0xf650('0x3b')){var _0x2b8cdf={};_0x2b8cdf[_0x958dfc[_0xf650('0x25')]]={'$like':'%'+_0x3cbd49[_0xf650('0x30')]['filter']+'%'};return _0x2b8cdf;}})});}_0x560b77=_[_0xf650('0x3a')]({},_0x560b77,_0x3cbd49[_0xf650('0x3c')]);var _0x1c2722={'where':_0x560b77[_0xf650('0x38')]};return db[_0xf650('0x29')][_0xf650('0x19')](_0x1c2722)[_0xf650('0x21')](function(_0x210225){_0x3ef1e1['count']=_0x210225;if(_0x3cbd49['query'][_0xf650('0x3d')]){_0x560b77[_0xf650('0x3e')]=[{'all':!![]}];}return db[_0xf650('0x29')][_0xf650('0x3f')](_0x560b77);})[_0xf650('0x21')](function(_0x160162){_0x3ef1e1['rows']=_0x160162;return _0x3ef1e1;})['then'](respondWithFilteredResult(_0x492ee8,_0x560b77))[_0xf650('0x40')](handleError(_0x492ee8,null));};exports[_0xf650('0x41')]=function(_0x2f0480,_0x1b4eab){var _0x72f624={'raw':!![],'where':{'id':_0x2f0480[_0xf650('0x42')]['id']}},_0x55b734={};_0x55b734[_0xf650('0x2e')]=_['keys'](db[_0xf650('0x29')]['rawAttributes']);_0x55b734['query']=_[_0xf650('0x43')](_0x2f0480[_0xf650('0x30')]);_0x55b734['filters']=_[_0xf650('0x32')](_0x55b734[_0xf650('0x2e')],_0x55b734[_0xf650('0x30')]);_0x72f624[_0xf650('0x33')]=_['intersection'](_0x55b734['model'],qs['fields'](_0x2f0480[_0xf650('0x30')][_0xf650('0x34')]));_0x72f624[_0xf650('0x33')]=_0x72f624['attributes'][_0xf650('0x35')]?_0x72f624[_0xf650('0x33')]:_0x55b734[_0xf650('0x2e')];if(_0x2f0480[_0xf650('0x30')][_0xf650('0x3d')]){_0x72f624[_0xf650('0x3e')]=[{'all':!![]}];}_0x72f624=_['merge']({},_0x72f624,_0x2f0480[_0xf650('0x3c')]);return db[_0xf650('0x29')][_0xf650('0x44')](_0x72f624)[_0xf650('0x21')](handleEntityNotFound(_0x1b4eab,null))[_0xf650('0x21')](respondWithResult(_0x1b4eab,null))[_0xf650('0x40')](handleError(_0x1b4eab,null));};exports['create']=function(_0x176284,_0x29b20f){return db[_0xf650('0x29')][_0xf650('0x45')](_0x176284['body'],{})[_0xf650('0x21')](function(_0x4302dd){var _0x3b2c20=_0x176284['user'][_0xf650('0x46')]({'plain':!![]});if(!_0x3b2c20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b2c20[_0xf650('0x47')]===_0xf650('0x48')){var _0x255ce5=_0x4302dd['get']({'plain':!![]});var _0x569b19=_0xf650('0x23');return db[_0xf650('0x49')]['find']({'where':{'name':_0x569b19,'userProfileId':_0x3b2c20[_0xf650('0x4a')]},'raw':!![]})[_0xf650('0x21')](function(_0x96c950){if(_0x96c950&&_0x96c950[_0xf650('0x4b')]===0x0){return db[_0xf650('0x24')][_0xf650('0x45')]({'name':_0x255ce5[_0xf650('0x25')],'resourceId':_0x255ce5['id'],'type':_0x96c950[_0xf650('0x25')],'sectionId':_0x96c950['id']},{})[_0xf650('0x21')](function(){return _0x4302dd;});}else{return _0x4302dd;}})['catch'](function(_0x228cad){logger[_0xf650('0x4c')](_0xf650('0x4d'),_0x228cad);throw _0x228cad;});}return _0x4302dd;})[_0xf650('0x21')](respondWithResult(_0x29b20f,0xc9))[_0xf650('0x40')](handleError(_0x29b20f,null));};exports[_0xf650('0x20')]=function(_0x2103c7,_0xa710b7){if(_0x2103c7[_0xf650('0x4e')]['id']){delete _0x2103c7['body']['id'];}return db[_0xf650('0x29')]['find']({'where':{'id':_0x2103c7[_0xf650('0x42')]['id']}})[_0xf650('0x21')](handleEntityNotFound(_0xa710b7,null))[_0xf650('0x21')](saveUpdates(_0x2103c7[_0xf650('0x4e')],null))[_0xf650('0x21')](respondWithResult(_0xa710b7,null))[_0xf650('0x40')](handleError(_0xa710b7,null));};exports[_0xf650('0x22')]=function(_0x4eb65a,_0x4560ec){return db[_0xf650('0x29')][_0xf650('0x44')]({'where':{'id':_0x4eb65a[_0xf650('0x42')]['id']}})[_0xf650('0x21')](handleEntityNotFound(_0x4560ec,null))[_0xf650('0x21')](removeEntity(_0x4560ec,null))[_0xf650('0x40')](handleError(_0x4560ec,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index ed213ec..fee869c 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 _0x2b3c=['./cmContactHasItem.attributes','CmContactHasItem','cm_contact_has_items','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x15263e,_0x58d1ad){var _0xfa15b6=function(_0x4beecc){while(--_0x4beecc){_0x15263e['push'](_0x15263e['shift']());}};_0xfa15b6(++_0x58d1ad);}(_0x2b3c,0xc9));var _0xc2b3=function(_0x29efd7,_0x25bbf5){_0x29efd7=_0x29efd7-0x0;var _0x11fb6d=_0x2b3c[_0x29efd7];return _0x11fb6d;};'use strict';var _=require('lodash');var util=require(_0xc2b3('0x0'));var logger=require(_0xc2b3('0x1'))(_0xc2b3('0x2'));var moment=require(_0xc2b3('0x3'));var BPromise=require(_0xc2b3('0x4'));var rp=require(_0xc2b3('0x5'));var fs=require('fs');var path=require(_0xc2b3('0x6'));var rimraf=require(_0xc2b3('0x7'));var config=require('../../config/environment');var attributes=require(_0xc2b3('0x8'));module['exports']=function(_0x1d3809,_0x7359c9){return _0x1d3809['define'](_0xc2b3('0x9'),attributes,{'tableName':_0xc2b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6080=['lodash','util','../../config/logger','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x4657de,_0x472cb1){var _0x4c68aa=function(_0x2b5247){while(--_0x2b5247){_0x4657de['push'](_0x4657de['shift']());}};_0x4c68aa(++_0x472cb1);}(_0x6080,0x11e));var _0x0608=function(_0x5cf6e4,_0x9129c9){_0x5cf6e4=_0x5cf6e4-0x0;var _0x410278=_0x6080[_0x5cf6e4];return _0x410278;};'use strict';var _=require(_0x0608('0x0'));var util=require(_0x0608('0x1'));var logger=require(_0x0608('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0608('0x3'));var fs=require('fs');var path=require(_0x0608('0x4'));var rimraf=require('rimraf');var config=require(_0x0608('0x5'));var attributes=require(_0x0608('0x6'));module[_0x0608('0x7')]=function(_0x3cb3a8,_0x5d76ab){return _0x3cb3a8[_0x0608('0x8')](_0x0608('0x9'),attributes,{'tableName':_0x0608('0xa'),'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 6af14e1..33ada0f 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 _0xdd21=['../../config/environment','jayson/promise','http','request','then','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','CmContactHasItem,\x20%s,\x20%s','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d5853,_0x398ac2){var _0x5608df=function(_0x581ba6){while(--_0x581ba6){_0x3d5853['push'](_0x3d5853['shift']());}};_0x5608df(++_0x398ac2);}(_0xdd21,0x19b));var _0x1dd2=function(_0xf771fe,_0x1d1fa8){_0xf771fe=_0xf771fe-0x0;var _0x27eecc=_0xdd21[_0xf771fe];return _0x27eecc;};'use strict';var _=require(_0x1dd2('0x0'));var util=require(_0x1dd2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1dd2('0x2'));var fs=require('fs');var Redis=require(_0x1dd2('0x3'));var db=require(_0x1dd2('0x4'))['db'];var utils=require(_0x1dd2('0x5'));var logger=require(_0x1dd2('0x6'))('rpc');var config=require(_0x1dd2('0x7'));var jayson=require(_0x1dd2('0x8'));var client=jayson['client'][_0x1dd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56e5f4,_0x42ec7c,_0x50b991){return new BPromise(function(_0x547622,_0x502618){return client[_0x1dd2('0xa')](_0x56e5f4,_0x50b991)[_0x1dd2('0xb')](function(_0x2b5354){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x42ec7c,_0x1dd2('0xc'));logger['debug'](_0x1dd2('0xd'),_0x42ec7c,_0x1dd2('0xc'),JSON[_0x1dd2('0xe')](_0x2b5354));if(_0x2b5354[_0x1dd2('0xf')]){if(_0x2b5354['error']['code']===0x1f4){logger[_0x1dd2('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x42ec7c,_0x2b5354[_0x1dd2('0xf')][_0x1dd2('0x10')]);return _0x502618(_0x2b5354[_0x1dd2('0xf')][_0x1dd2('0x10')]);}logger[_0x1dd2('0xf')](_0x1dd2('0x11'),_0x42ec7c,_0x2b5354[_0x1dd2('0xf')]['message']);return _0x547622(_0x2b5354[_0x1dd2('0xf')][_0x1dd2('0x10')]);}else{logger['info'](_0x1dd2('0x11'),_0x42ec7c,'request\x20sent');_0x547622(_0x2b5354[_0x1dd2('0x12')][_0x1dd2('0x10')]);}})['catch'](function(_0x36793e){logger[_0x1dd2('0xf')](_0x1dd2('0x11'),_0x42ec7c,_0x36793e);_0x502618(_0x36793e);});});} \ No newline at end of file +var _0x8eaa=['ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4d05dd,_0x258cdd){var _0x1c5226=function(_0x1a857c){while(--_0x1a857c){_0x4d05dd['push'](_0x4d05dd['shift']());}};_0x1c5226(++_0x258cdd);}(_0x8eaa,0x119));var _0xa8ea=function(_0x193cc8,_0x295d92){_0x193cc8=_0x193cc8-0x0;var _0x4e171d=_0x8eaa[_0x193cc8];return _0x4e171d;};'use strict';var _=require(_0xa8ea('0x0'));var util=require(_0xa8ea('0x1'));var moment=require(_0xa8ea('0x2'));var BPromise=require(_0xa8ea('0x3'));var rs=require(_0xa8ea('0x4'));var fs=require('fs');var Redis=require(_0xa8ea('0x5'));var db=require(_0xa8ea('0x6'))['db'];var utils=require(_0xa8ea('0x7'));var logger=require('../../config/logger')(_0xa8ea('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa8ea('0x9')][_0xa8ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e709,_0x306598,_0x504099){return new BPromise(function(_0x21ea08,_0x536321){return client[_0xa8ea('0xb')](_0x4e709,_0x504099)['then'](function(_0x3ca2d4){logger[_0xa8ea('0xc')](_0xa8ea('0xd'),_0x306598,'request\x20sent');logger[_0xa8ea('0xe')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x306598,_0xa8ea('0xf'),JSON[_0xa8ea('0x10')](_0x3ca2d4));if(_0x3ca2d4[_0xa8ea('0x11')]){if(_0x3ca2d4[_0xa8ea('0x11')][_0xa8ea('0x12')]===0x1f4){logger[_0xa8ea('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x306598,_0x3ca2d4[_0xa8ea('0x11')][_0xa8ea('0x13')]);return _0x536321(_0x3ca2d4[_0xa8ea('0x11')][_0xa8ea('0x13')]);}logger[_0xa8ea('0x11')](_0xa8ea('0xd'),_0x306598,_0x3ca2d4[_0xa8ea('0x11')][_0xa8ea('0x13')]);return _0x21ea08(_0x3ca2d4[_0xa8ea('0x11')]['message']);}else{logger[_0xa8ea('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x306598,_0xa8ea('0xf'));_0x21ea08(_0x3ca2d4[_0xa8ea('0x14')][_0xa8ea('0x13')]);}})[_0xa8ea('0x15')](function(_0x3ba1db){logger[_0xa8ea('0x11')](_0xa8ea('0xd'),_0x306598,_0x3ba1db);_0x536321(_0x3ba1db);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index acba576..78a6907 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 _0x2864=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','multer'];(function(_0x2fe123,_0x397321){var _0x585623=function(_0x385c90){while(--_0x385c90){_0x2fe123['push'](_0x2fe123['shift']());}};_0x585623(++_0x397321);}(_0x2864,0x179));var _0x4286=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x2864[_0x40be86];return _0xda3c3b;};'use strict';var multer=require(_0x4286('0x0'));var util=require(_0x4286('0x1'));var path=require('path');var timeout=require(_0x4286('0x2'));var express=require(_0x4286('0x3'));var router=express[_0x4286('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4286('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4286('0x6'));var controller=require(_0x4286('0x7'));router[_0x4286('0x8')]('/',auth[_0x4286('0x9')](),controller[_0x4286('0xa')]);router[_0x4286('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4286('0xb')]);router[_0x4286('0xc')]('/',auth[_0x4286('0x9')](),controller[_0x4286('0xd')]);router[_0x4286('0xe')](_0x4286('0xf'),auth[_0x4286('0x9')](),controller[_0x4286('0x10')]);router[_0x4286('0x11')]('/:id',auth[_0x4286('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbb59=['post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show'];(function(_0x463e39,_0x5d48b2){var _0x44f0c0=function(_0x280e99){while(--_0x280e99){_0x463e39['push'](_0x463e39['shift']());}};_0x44f0c0(++_0x5d48b2);}(_0xbb59,0x1d2));var _0x9bb5=function(_0x19ce65,_0x24828e){_0x19ce65=_0x19ce65-0x0;var _0x2b6ea8=_0xbb59[_0x19ce65];return _0x2b6ea8;};'use strict';var multer=require(_0x9bb5('0x0'));var util=require('util');var path=require(_0x9bb5('0x1'));var timeout=require(_0x9bb5('0x2'));var express=require(_0x9bb5('0x3'));var router=express[_0x9bb5('0x4')]();var fs_extra=require(_0x9bb5('0x5'));var auth=require(_0x9bb5('0x6'));var interaction=require(_0x9bb5('0x7'));var config=require(_0x9bb5('0x8'));var controller=require(_0x9bb5('0x9'));router[_0x9bb5('0xa')]('/',auth[_0x9bb5('0xb')](),controller['index']);router['get'](_0x9bb5('0xc'),auth[_0x9bb5('0xb')](),controller[_0x9bb5('0xd')]);router[_0x9bb5('0xe')]('/',auth['isAuthenticated'](),controller[_0x9bb5('0xf')]);router[_0x9bb5('0x10')](_0x9bb5('0xc'),auth[_0x9bb5('0xb')](),controller[_0x9bb5('0x11')]);router[_0x9bb5('0x12')](_0x9bb5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9bb5('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b2a8af5..efd80aa 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 _0x1a5c=['long','type','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT'];(function(_0x124ab0,_0x5556fe){var _0x51be00=function(_0x51ecc2){while(--_0x51ecc2){_0x124ab0['push'](_0x124ab0['shift']());}};_0x51be00(++_0x5556fe);}(_0x1a5c,0x1cb));var _0xc1a5=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x1a5c[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require(_0xc1a5('0x0'));var _=require(_0xc1a5('0x1'));module[_0xc1a5('0x2')]={'name':{'type':Sequelize[_0xc1a5('0x3')],'get':function(_0x6eb0cb){return this[_0xc1a5('0x4')](_0xc1a5('0x5'));}},'alias':{'type':Sequelize[_0xc1a5('0x6')],'allowNull':![],'set':function(_0x239b60){this[_0xc1a5('0x7')](_0xc1a5('0x5'),_0x239b60?_0x239b60:this[_0xc1a5('0x4')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xc1a5('0x8')](_0xc1a5('0x9')),'get':function(){if(this[_0xc1a5('0x4')](_0xc1a5('0xa'))==='select'){return JSON[_0xc1a5('0xb')](this[_0xc1a5('0x4')](_0xc1a5('0xc')));}else{return this[_0xc1a5('0x4')](_0xc1a5('0xc'));}},'set':function(_0x366101){if(Array[_0xc1a5('0xd')](_0x366101)){this[_0xc1a5('0x7')](_0xc1a5('0xc'),JSON[_0xc1a5('0xe')](_0x366101));}else{this[_0xc1a5('0x7')]('values',_0x366101);}}},'required':{'type':Sequelize[_0xc1a5('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc1a5('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc1a5('0x10')](_0xc1a5('0x11'))}}; \ No newline at end of file +var _0x672f=['VIRTUAL','alias','STRING','setDataValue','getDataValue','name','TEXT','long','values','BOOLEAN','ENUM','voice'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x672f,0x15c));var _0xf672=function(_0x5436f2,_0x5e07a6){_0x5436f2=_0x5436f2-0x0;var _0x5c526e=_0x672f[_0x5436f2];return _0x5c526e;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0xf672('0x0')],'get':function(_0x5975d7){return this['getDataValue'](_0xf672('0x1'));}},'alias':{'type':Sequelize[_0xf672('0x2')],'allowNull':![],'set':function(_0xcd95e0){this[_0xf672('0x3')](_0xf672('0x1'),_0xcd95e0?_0xcd95e0:this[_0xf672('0x4')](_0xf672('0x5')));}},'type':{'type':Sequelize[_0xf672('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0xf672('0x6')](_0xf672('0x7')),'get':function(){if(this['getDataValue']('type')==='select'){return JSON['parse'](this[_0xf672('0x4')](_0xf672('0x8')));}else{return this[_0xf672('0x4')]('values');}},'set':function(_0xbe943b){if(Array['isArray'](_0xbe943b)){this['setDataValue'](_0xf672('0x8'),JSON['stringify'](_0xbe943b));}else{this['setDataValue'](_0xf672('0x8'),_0xbe943b);}}},'required':{'type':Sequelize[_0xf672('0x9')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf672('0xa')](_0xf672('0xb'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index c7bc308..4d84320 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 _0x2d7c=['attributes','intersection','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','body','destroy','transaction','create','Sequelize','TEXT','number','INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../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','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','filters'];(function(_0x244819,_0x1a7b04){var _0x294ebc=function(_0x2d04aa){while(--_0x2d04aa){_0x244819['push'](_0x244819['shift']());}};_0x294ebc(++_0x1a7b04);}(_0x2d7c,0x12d));var _0xc2d7=function(_0x11fd4e,_0x1a32ec){_0x11fd4e=_0x11fd4e-0x0;var _0x324371=_0x2d7c[_0x11fd4e];return _0x324371;};'use strict';var emlformat=require(_0xc2d7('0x0'));var rimraf=require(_0xc2d7('0x1'));var zipdir=require(_0xc2d7('0x2'));var jsonpatch=require(_0xc2d7('0x3'));var rp=require(_0xc2d7('0x4'));var moment=require(_0xc2d7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc2d7('0x6'));var util=require(_0xc2d7('0x7'));var path=require(_0xc2d7('0x8'));var sox=require(_0xc2d7('0x9'));var csv=require(_0xc2d7('0xa'));var ejs=require(_0xc2d7('0xb'));var fs=require('fs');var fs_extra=require(_0xc2d7('0xc'));var _=require('lodash');var squel=require(_0xc2d7('0xd'));var crypto=require(_0xc2d7('0xe'));var jsforce=require(_0xc2d7('0xf'));var deskjs=require(_0xc2d7('0x10'));var toCsv=require(_0xc2d7('0xa'));var querystring=require(_0xc2d7('0x11'));var Papa=require('papaparse');var Redis=require(_0xc2d7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc2d7('0x13'));var hardwareService=require(_0xc2d7('0x14'));var logger=require(_0xc2d7('0x15'))(_0xc2d7('0x16'));var utils=require(_0xc2d7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc2d7('0x18'));var db=require(_0xc2d7('0x19'))['db'];function respondWithStatusCode(_0x502125,_0xc4668f){_0xc4668f=_0xc4668f||0xcc;return function(_0x2fd576){if(_0x2fd576){return _0x502125[_0xc2d7('0x1a')](_0xc4668f);}return _0x502125[_0xc2d7('0x1b')](_0xc4668f)[_0xc2d7('0x1c')]();};}function respondWithResult(_0x1d0543,_0x5a7a43){_0x5a7a43=_0x5a7a43||0xc8;return function(_0x6cd0ca){if(_0x6cd0ca){return _0x1d0543[_0xc2d7('0x1b')](_0x5a7a43)[_0xc2d7('0x1d')](_0x6cd0ca);}};}function respondWithFilteredResult(_0x35ee16,_0x39c85b){return function(_0x44633f){if(_0x44633f){var _0x372c70=typeof _0x39c85b[_0xc2d7('0x1e')]===_0xc2d7('0x1f')&&typeof _0x39c85b[_0xc2d7('0x20')]===_0xc2d7('0x1f');var _0x465396=_0x44633f[_0xc2d7('0x21')];var _0x1ba3cc=_0x372c70?0x0:_0x39c85b[_0xc2d7('0x1e')];var _0x107a5d=_0x372c70?_0x44633f['count']:_0x39c85b['offset']+_0x39c85b[_0xc2d7('0x20')];var _0x4d4374;if(_0x107a5d>=_0x465396){_0x107a5d=_0x465396;_0x4d4374=0xc8;}else{_0x4d4374=0xce;}_0x35ee16['status'](_0x4d4374);return _0x35ee16[_0xc2d7('0x22')](_0xc2d7('0x23'),_0x1ba3cc+'-'+_0x107a5d+'/'+_0x465396)[_0xc2d7('0x1d')](_0x44633f);}return null;};}function patchUpdates(_0x2098cd){return function(_0x4548f9){try{jsonpatch[_0xc2d7('0x24')](_0x4548f9,_0x2098cd,!![]);}catch(_0x5f3ba1){return BPromise[_0xc2d7('0x25')](_0x5f3ba1);}return _0x4548f9[_0xc2d7('0x26')]();};}function saveUpdates(_0x17a510,_0x20e955){return function(_0x5ea661){if(_0x5ea661){return _0x5ea661[_0xc2d7('0x27')](_0x17a510)[_0xc2d7('0x28')](function(_0x215e2c){return _0x215e2c;});}return null;};}function removeEntity(_0x1248dd,_0x3c79fa){return function(_0x4f615d){if(_0x4f615d){return _0x4f615d['destroy']()[_0xc2d7('0x28')](function(){_0x1248dd[_0xc2d7('0x1b')](0xcc)[_0xc2d7('0x1c')]();});}};}function handleEntityNotFound(_0x5829d6,_0xe4a16b){return function(_0x3ebf84){if(!_0x3ebf84){_0x5829d6['sendStatus'](0x194);}return _0x3ebf84;};}function handleError(_0x137079,_0x134adb){_0x134adb=_0x134adb||0x1f4;return function(_0x35544f){logger[_0xc2d7('0x29')](_0x35544f['stack']);if(_0x35544f[_0xc2d7('0x2a')]){delete _0x35544f[_0xc2d7('0x2a')];}_0x137079[_0xc2d7('0x1b')](_0x134adb)[_0xc2d7('0x2b')](_0x35544f);};}exports[_0xc2d7('0x2c')]=function(_0xf114e,_0x24f0b3){var _0x533945={},_0x45ac0e={},_0x4e4795={'count':0x0,'rows':[]};var _0x400753=_[_0xc2d7('0x2d')](db[_0xc2d7('0x2e')][_0xc2d7('0x2f')],function(_0x29db53){return{'name':_0x29db53[_0xc2d7('0x30')],'type':_0x29db53[_0xc2d7('0x31')][_0xc2d7('0x32')]};});_0x45ac0e[_0xc2d7('0x33')]=_[_0xc2d7('0x34')](_[_0xc2d7('0x2d')](_0x400753,_0xc2d7('0x2a')),[_0xc2d7('0x2a')]);_0x45ac0e['query']=_['keys'](_0xf114e[_0xc2d7('0x35')]);_0x45ac0e[_0xc2d7('0x36')]=_['intersection'](_0x45ac0e[_0xc2d7('0x33')],_0x45ac0e[_0xc2d7('0x35')]);_0x533945[_0xc2d7('0x37')]=_[_0xc2d7('0x38')](_0x45ac0e[_0xc2d7('0x33')],qs[_0xc2d7('0x39')](_0xf114e['query']['fields']));_0x533945[_0xc2d7('0x37')]=_0x533945[_0xc2d7('0x37')][_0xc2d7('0x3a')]?_0x533945[_0xc2d7('0x37')]:_0x45ac0e[_0xc2d7('0x33')];if(!_0xf114e[_0xc2d7('0x35')]['hasOwnProperty']('nolimit')){_0x533945[_0xc2d7('0x20')]=qs[_0xc2d7('0x20')](_0xf114e[_0xc2d7('0x35')][_0xc2d7('0x20')]);_0x533945[_0xc2d7('0x1e')]=qs[_0xc2d7('0x1e')](_0xf114e[_0xc2d7('0x35')]['offset']);}_0x533945['order']=qs[_0xc2d7('0x3b')](_0xf114e['query'][_0xc2d7('0x3b')]);_0x533945[_0xc2d7('0x3c')]=qs['filters'](_[_0xc2d7('0x3d')](_0xf114e[_0xc2d7('0x35')],_0x45ac0e[_0xc2d7('0x36')]),_0x400753);if(_0xf114e[_0xc2d7('0x35')][_0xc2d7('0x3e')]){_0x533945['where']=_[_0xc2d7('0x3f')](_0x533945[_0xc2d7('0x3c')],{'$or':_['map'](_0x400753,function(_0x1f0e1e){if(_0x1f0e1e[_0xc2d7('0x31')]!==_0xc2d7('0x40')){var _0x2eff95={};_0x2eff95[_0x1f0e1e[_0xc2d7('0x2a')]]={'$like':'%'+_0xf114e[_0xc2d7('0x35')][_0xc2d7('0x3e')]+'%'};return _0x2eff95;}})});}_0x533945=_['merge']({},_0x533945,_0xf114e[_0xc2d7('0x41')]);var _0x415ecc={'where':_0x533945[_0xc2d7('0x3c')]};return db[_0xc2d7('0x2e')]['count'](_0x415ecc)[_0xc2d7('0x28')](function(_0x1d228c){_0x4e4795[_0xc2d7('0x21')]=_0x1d228c;if(_0xf114e[_0xc2d7('0x35')][_0xc2d7('0x42')]){_0x533945[_0xc2d7('0x43')]=[{'all':!![]}];}return db['CmCustomField'][_0xc2d7('0x44')](_0x533945);})['then'](function(_0x6e18cb){_0x4e4795['rows']=_0x6e18cb;return _0x4e4795;})[_0xc2d7('0x28')](respondWithFilteredResult(_0x24f0b3,_0x533945))[_0xc2d7('0x45')](handleError(_0x24f0b3,null));};exports[_0xc2d7('0x46')]=function(_0x50a4ef,_0x496bd5){var _0x3fb28b={'raw':!![],'where':{'id':_0x50a4ef[_0xc2d7('0x47')]['id']}},_0x273108={};_0x273108['model']=_['keys'](db[_0xc2d7('0x2e')][_0xc2d7('0x2f')]);_0x273108[_0xc2d7('0x35')]=_[_0xc2d7('0x48')](_0x50a4ef[_0xc2d7('0x35')]);_0x273108[_0xc2d7('0x36')]=_[_0xc2d7('0x38')](_0x273108[_0xc2d7('0x33')],_0x273108['query']);_0x3fb28b[_0xc2d7('0x37')]=_[_0xc2d7('0x38')](_0x273108[_0xc2d7('0x33')],qs[_0xc2d7('0x39')](_0x50a4ef[_0xc2d7('0x35')][_0xc2d7('0x39')]));_0x3fb28b[_0xc2d7('0x37')]=_0x3fb28b[_0xc2d7('0x37')][_0xc2d7('0x3a')]?_0x3fb28b['attributes']:_0x273108[_0xc2d7('0x33')];if(_0x50a4ef[_0xc2d7('0x35')][_0xc2d7('0x42')]){_0x3fb28b['include']=[{'all':!![]}];}_0x3fb28b=_['merge']({},_0x3fb28b,_0x50a4ef[_0xc2d7('0x41')]);return db[_0xc2d7('0x2e')][_0xc2d7('0x49')](_0x3fb28b)[_0xc2d7('0x28')](handleEntityNotFound(_0x496bd5,null))[_0xc2d7('0x28')](respondWithResult(_0x496bd5,null))[_0xc2d7('0x45')](handleError(_0x496bd5,null));};exports[_0xc2d7('0x27')]=function(_0xe260dd,_0x33ca2e){if(_0xe260dd[_0xc2d7('0x4a')]['id']){delete _0xe260dd[_0xc2d7('0x4a')]['id'];}return db[_0xc2d7('0x2e')][_0xc2d7('0x49')]({'where':{'id':_0xe260dd[_0xc2d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x33ca2e,null))[_0xc2d7('0x28')](saveUpdates(_0xe260dd[_0xc2d7('0x4a')],null))['then'](respondWithResult(_0x33ca2e,null))[_0xc2d7('0x45')](handleError(_0x33ca2e,null));};exports[_0xc2d7('0x4b')]=function(_0x47e0e1,_0x102850){return db[_0xc2d7('0x2e')]['find']({'where':{'id':_0x47e0e1[_0xc2d7('0x47')]['id']}})['then'](handleEntityNotFound(_0x102850,null))[_0xc2d7('0x28')](removeEntity(_0x102850,null))[_0xc2d7('0x45')](handleError(_0x102850,null));};exports['create']=function(_0x29b610,_0x571c0f){var _0x562dbc;return db['sequelize'][_0xc2d7('0x4c')](function(_0x1db72c){return db[_0xc2d7('0x2e')][_0xc2d7('0x4d')](_0x29b610[_0xc2d7('0x4a')],{'transaction':_0x1db72c})[_0xc2d7('0x28')](function(_0x1bae88){_0x562dbc=_0x1bae88;var _0x3a59c5={'type':db[_0xc2d7('0x4e')][_0xc2d7('0x4f')],'transaction':_0x1db72c};switch(_0x29b610[_0xc2d7('0x4a')]['type']){case'text':_0x3a59c5[_0xc2d7('0x31')]=db[_0xc2d7('0x4e')][_0xc2d7('0x4f')];break;case _0xc2d7('0x50'):_0x3a59c5[_0xc2d7('0x31')]=db['Sequelize'][_0xc2d7('0x51')];break;case _0xc2d7('0x52'):_0x3a59c5[_0xc2d7('0x31')]=db[_0xc2d7('0x4e')]['BOOLEAN'];_0x3a59c5[_0xc2d7('0x53')]=![];break;default:}return db[_0xc2d7('0x54')][_0xc2d7('0x55')][_0xc2d7('0x56')]('cm_contacts',util[_0xc2d7('0x57')](_0xc2d7('0x58'),_0x562dbc['id']),_0x3a59c5);})[_0xc2d7('0x28')](function(){return _0x562dbc;});})[_0xc2d7('0x28')](respondWithResult(_0x571c0f,0xc9))[_0xc2d7('0x45')](handleError(_0x571c0f,null));}; \ No newline at end of file +var _0x7b88=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','key','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','params','keys','find','catch','body','sequelize','create','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x1e7ebe,_0x25b41e){var _0x1aea69=function(_0x3adc9e){while(--_0x3adc9e){_0x1e7ebe['push'](_0x1e7ebe['shift']());}};_0x1aea69(++_0x25b41e);}(_0x7b88,0x1ed));var _0x87b8=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x7b88[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0x87b8('0x0'));var rimraf=require(_0x87b8('0x1'));var zipdir=require(_0x87b8('0x2'));var jsonpatch=require(_0x87b8('0x3'));var rp=require(_0x87b8('0x4'));var moment=require(_0x87b8('0x5'));var BPromise=require(_0x87b8('0x6'));var Mustache=require('mustache');var util=require(_0x87b8('0x7'));var path=require(_0x87b8('0x8'));var sox=require(_0x87b8('0x9'));var csv=require(_0x87b8('0xa'));var ejs=require(_0x87b8('0xb'));var fs=require('fs');var fs_extra=require(_0x87b8('0xc'));var _=require(_0x87b8('0xd'));var squel=require(_0x87b8('0xe'));var crypto=require(_0x87b8('0xf'));var jsforce=require(_0x87b8('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x87b8('0x11'));var Papa=require('papaparse');var Redis=require(_0x87b8('0x12'));var authService=require(_0x87b8('0x13'));var qs=require(_0x87b8('0x14'));var as=require(_0x87b8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x87b8('0x16'));var licenseUtil=require(_0x87b8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x89ca5c,_0x146981){_0x146981=_0x146981||0xcc;return function(_0x21f22e){if(_0x21f22e){return _0x89ca5c[_0x87b8('0x18')](_0x146981);}return _0x89ca5c[_0x87b8('0x19')](_0x146981)[_0x87b8('0x1a')]();};}function respondWithResult(_0x472789,_0x139556){_0x139556=_0x139556||0xc8;return function(_0x1e5585){if(_0x1e5585){return _0x472789[_0x87b8('0x19')](_0x139556)['json'](_0x1e5585);}};}function respondWithFilteredResult(_0x13061d,_0x3787c4){return function(_0x59e706){if(_0x59e706){var _0x35d453=typeof _0x3787c4['offset']===_0x87b8('0x1b')&&typeof _0x3787c4[_0x87b8('0x1c')]===_0x87b8('0x1b');var _0x3c375a=_0x59e706[_0x87b8('0x1d')];var _0x5b1820=_0x35d453?0x0:_0x3787c4[_0x87b8('0x1e')];var _0x4f0339=_0x35d453?_0x59e706[_0x87b8('0x1d')]:_0x3787c4[_0x87b8('0x1e')]+_0x3787c4[_0x87b8('0x1c')];var _0x18b5a7;if(_0x4f0339>=_0x3c375a){_0x4f0339=_0x3c375a;_0x18b5a7=0xc8;}else{_0x18b5a7=0xce;}_0x13061d[_0x87b8('0x19')](_0x18b5a7);return _0x13061d[_0x87b8('0x1f')](_0x87b8('0x20'),_0x5b1820+'-'+_0x4f0339+'/'+_0x3c375a)[_0x87b8('0x21')](_0x59e706);}return null;};}function patchUpdates(_0x325ac0){return function(_0x562afe){try{jsonpatch[_0x87b8('0x22')](_0x562afe,_0x325ac0,!![]);}catch(_0x1d00fb){return BPromise['reject'](_0x1d00fb);}return _0x562afe[_0x87b8('0x23')]();};}function saveUpdates(_0xa271e9,_0x3d192c){return function(_0x3262fc){if(_0x3262fc){return _0x3262fc[_0x87b8('0x24')](_0xa271e9)['then'](function(_0x2a5eb6){return _0x2a5eb6;});}return null;};}function removeEntity(_0x5d5620,_0x1f40b9){return function(_0x41a6bb){if(_0x41a6bb){return _0x41a6bb[_0x87b8('0x25')]()[_0x87b8('0x26')](function(){_0x5d5620['status'](0xcc)[_0x87b8('0x1a')]();});}};}function handleEntityNotFound(_0x243883,_0x226e1e){return function(_0xa667d9){if(!_0xa667d9){_0x243883['sendStatus'](0x194);}return _0xa667d9;};}function handleError(_0x46c4ae,_0x39554c){_0x39554c=_0x39554c||0x1f4;return function(_0x2fc99e){logger[_0x87b8('0x27')](_0x2fc99e[_0x87b8('0x28')]);if(_0x2fc99e[_0x87b8('0x29')]){delete _0x2fc99e['name'];}_0x46c4ae[_0x87b8('0x19')](_0x39554c)[_0x87b8('0x2a')](_0x2fc99e);};}exports[_0x87b8('0x2b')]=function(_0x1dda34,_0x133205){var _0x26d5db={},_0x38d2f2={},_0x3cabbe={'count':0x0,'rows':[]};var _0x5df39b=_[_0x87b8('0x2c')](db[_0x87b8('0x2d')][_0x87b8('0x2e')],function(_0x27e05a){return{'name':_0x27e05a['fieldName'],'type':_0x27e05a['type'][_0x87b8('0x2f')]};});_0x38d2f2['model']=_[_0x87b8('0x30')](_[_0x87b8('0x2c')](_0x5df39b,_0x87b8('0x29')),[_0x87b8('0x29')]);_0x38d2f2[_0x87b8('0x31')]=_['keys'](_0x1dda34['query']);_0x38d2f2[_0x87b8('0x32')]=_[_0x87b8('0x33')](_0x38d2f2[_0x87b8('0x34')],_0x38d2f2[_0x87b8('0x31')]);_0x26d5db[_0x87b8('0x35')]=_[_0x87b8('0x33')](_0x38d2f2['model'],qs[_0x87b8('0x36')](_0x1dda34[_0x87b8('0x31')]['fields']));_0x26d5db[_0x87b8('0x35')]=_0x26d5db[_0x87b8('0x35')][_0x87b8('0x37')]?_0x26d5db[_0x87b8('0x35')]:_0x38d2f2[_0x87b8('0x34')];if(!_0x1dda34[_0x87b8('0x31')][_0x87b8('0x38')]('nolimit')){_0x26d5db[_0x87b8('0x1c')]=qs[_0x87b8('0x1c')](_0x1dda34['query'][_0x87b8('0x1c')]);_0x26d5db['offset']=qs[_0x87b8('0x1e')](_0x1dda34[_0x87b8('0x31')][_0x87b8('0x1e')]);}_0x26d5db['order']=qs[_0x87b8('0x39')](_0x1dda34[_0x87b8('0x31')][_0x87b8('0x39')]);_0x26d5db[_0x87b8('0x3a')]=qs['filters'](_['pick'](_0x1dda34[_0x87b8('0x31')],_0x38d2f2[_0x87b8('0x32')]),_0x5df39b);if(_0x1dda34['query'][_0x87b8('0x3b')]){_0x26d5db[_0x87b8('0x3a')]=_[_0x87b8('0x3c')](_0x26d5db[_0x87b8('0x3a')],{'$or':_[_0x87b8('0x2c')](_0x5df39b,function(_0x36969f){if(_0x36969f[_0x87b8('0x3d')]!==_0x87b8('0x3e')){var _0xcae14={};_0xcae14[_0x36969f[_0x87b8('0x29')]]={'$like':'%'+_0x1dda34['query']['filter']+'%'};return _0xcae14;}})});}_0x26d5db=_[_0x87b8('0x3c')]({},_0x26d5db,_0x1dda34[_0x87b8('0x3f')]);var _0x364a70={'where':_0x26d5db[_0x87b8('0x3a')]};return db['CmCustomField'][_0x87b8('0x1d')](_0x364a70)[_0x87b8('0x26')](function(_0x5e2598){_0x3cabbe[_0x87b8('0x1d')]=_0x5e2598;if(_0x1dda34[_0x87b8('0x31')][_0x87b8('0x40')]){_0x26d5db['include']=[{'all':!![]}];}return db[_0x87b8('0x2d')][_0x87b8('0x41')](_0x26d5db);})['then'](function(_0x50dfc1){_0x3cabbe['rows']=_0x50dfc1;return _0x3cabbe;})['then'](respondWithFilteredResult(_0x133205,_0x26d5db))['catch'](handleError(_0x133205,null));};exports['show']=function(_0xbc4446,_0x61c206){var _0x2d1468={'raw':!![],'where':{'id':_0xbc4446[_0x87b8('0x42')]['id']}},_0x112b5f={};_0x112b5f['model']=_['keys'](db['CmCustomField'][_0x87b8('0x2e')]);_0x112b5f[_0x87b8('0x31')]=_[_0x87b8('0x43')](_0xbc4446['query']);_0x112b5f[_0x87b8('0x32')]=_[_0x87b8('0x33')](_0x112b5f[_0x87b8('0x34')],_0x112b5f[_0x87b8('0x31')]);_0x2d1468[_0x87b8('0x35')]=_[_0x87b8('0x33')](_0x112b5f['model'],qs[_0x87b8('0x36')](_0xbc4446[_0x87b8('0x31')][_0x87b8('0x36')]));_0x2d1468[_0x87b8('0x35')]=_0x2d1468[_0x87b8('0x35')][_0x87b8('0x37')]?_0x2d1468[_0x87b8('0x35')]:_0x112b5f[_0x87b8('0x34')];if(_0xbc4446[_0x87b8('0x31')][_0x87b8('0x40')]){_0x2d1468['include']=[{'all':!![]}];}_0x2d1468=_[_0x87b8('0x3c')]({},_0x2d1468,_0xbc4446[_0x87b8('0x3f')]);return db[_0x87b8('0x2d')][_0x87b8('0x44')](_0x2d1468)[_0x87b8('0x26')](handleEntityNotFound(_0x61c206,null))['then'](respondWithResult(_0x61c206,null))[_0x87b8('0x45')](handleError(_0x61c206,null));};exports[_0x87b8('0x24')]=function(_0x5e8357,_0x5130d7){if(_0x5e8357[_0x87b8('0x46')]['id']){delete _0x5e8357[_0x87b8('0x46')]['id'];}return db[_0x87b8('0x2d')]['find']({'where':{'id':_0x5e8357['params']['id']}})['then'](handleEntityNotFound(_0x5130d7,null))[_0x87b8('0x26')](saveUpdates(_0x5e8357[_0x87b8('0x46')],null))[_0x87b8('0x26')](respondWithResult(_0x5130d7,null))[_0x87b8('0x45')](handleError(_0x5130d7,null));};exports[_0x87b8('0x25')]=function(_0x407557,_0x456e8a){return db[_0x87b8('0x2d')][_0x87b8('0x44')]({'where':{'id':_0x407557[_0x87b8('0x42')]['id']}})['then'](handleEntityNotFound(_0x456e8a,null))[_0x87b8('0x26')](removeEntity(_0x456e8a,null))[_0x87b8('0x45')](handleError(_0x456e8a,null));};exports['create']=function(_0x25b179,_0x5806dc){var _0x25cd1a;return db[_0x87b8('0x47')]['transaction'](function(_0x56a18c){return db['CmCustomField'][_0x87b8('0x48')](_0x25b179['body'],{'transaction':_0x56a18c})[_0x87b8('0x26')](function(_0x9ae3a){_0x25cd1a=_0x9ae3a;var _0x2eb09c={'type':db[_0x87b8('0x49')][_0x87b8('0x4a')],'transaction':_0x56a18c};switch(_0x25b179[_0x87b8('0x46')][_0x87b8('0x3d')]){case _0x87b8('0x4b'):_0x2eb09c[_0x87b8('0x3d')]=db['Sequelize'][_0x87b8('0x4a')];break;case'number':_0x2eb09c[_0x87b8('0x3d')]=db[_0x87b8('0x49')][_0x87b8('0x4c')];break;case _0x87b8('0x4d'):_0x2eb09c[_0x87b8('0x3d')]=db['Sequelize'][_0x87b8('0x4e')];_0x2eb09c[_0x87b8('0x4f')]=![];break;default:}return db[_0x87b8('0x47')][_0x87b8('0x50')][_0x87b8('0x51')](_0x87b8('0x52'),util[_0x87b8('0x53')](_0x87b8('0x54'),_0x25cd1a['id']),_0x2eb09c);})[_0x87b8('0x26')](function(){return _0x25cd1a;});})[_0x87b8('0x26')](respondWithResult(_0x5806dc,0xc9))[_0x87b8('0x45')](handleError(_0x5806dc,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 3997e2a..f017a59 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 _0x2579=['bluebird','request-promise','path','../../config/environment','exports','define','CmCustomField','cm_custom_fields','lodash','util','api'];(function(_0x1e3d38,_0x106d12){var _0x497698=function(_0x393727){while(--_0x393727){_0x1e3d38['push'](_0x1e3d38['shift']());}};_0x497698(++_0x106d12);}(_0x2579,0x173));var _0x9257=function(_0x16ac79,_0x19ca16){_0x16ac79=_0x16ac79-0x0;var _0x2c0f0f=_0x2579[_0x16ac79];return _0x2c0f0f;};'use strict';var _=require(_0x9257('0x0'));var util=require(_0x9257('0x1'));var logger=require('../../config/logger')(_0x9257('0x2'));var moment=require('moment');var BPromise=require(_0x9257('0x3'));var rp=require(_0x9257('0x4'));var fs=require('fs');var path=require(_0x9257('0x5'));var rimraf=require('rimraf');var config=require(_0x9257('0x6'));var attributes=require('./cmCustomField.attributes');module[_0x9257('0x7')]=function(_0xc2e0bf,_0x4d9649){return _0xc2e0bf[_0x9257('0x8')](_0x9257('0x9'),attributes,{'tableName':_0x9257('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8654=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports'];(function(_0x4b0f0e,_0x57d1f0){var _0x36acb4=function(_0x595704){while(--_0x595704){_0x4b0f0e['push'](_0x4b0f0e['shift']());}};_0x36acb4(++_0x57d1f0);}(_0x8654,0x1cc));var _0x4865=function(_0x3adb8e,_0x479df6){_0x3adb8e=_0x3adb8e-0x0;var _0x1795c0=_0x8654[_0x3adb8e];return _0x1795c0;};'use strict';var _=require(_0x4865('0x0'));var util=require(_0x4865('0x1'));var logger=require(_0x4865('0x2'))('api');var moment=require(_0x4865('0x3'));var BPromise=require(_0x4865('0x4'));var rp=require(_0x4865('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4865('0x6'));var config=require(_0x4865('0x7'));var attributes=require(_0x4865('0x8'));module[_0x4865('0x9')]=function(_0x19e399,_0x1b647c){return _0x19e399['define']('CmCustomField',attributes,{'tableName':'cm_custom_fields','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 8e3393a..32116a6 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 _0xa6d2=['client','http','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xa6d2,0x11c));var _0x2a6d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa6d2[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x2a6d('0x0'));var util=require(_0x2a6d('0x1'));var moment=require(_0x2a6d('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a6d('0x3'));var fs=require('fs');var Redis=require(_0x2a6d('0x4'));var db=require(_0x2a6d('0x5'))['db'];var utils=require(_0x2a6d('0x6'));var logger=require(_0x2a6d('0x7'))('rpc');var config=require(_0x2a6d('0x8'));var jayson=require(_0x2a6d('0x9'));var client=jayson[_0x2a6d('0xa')][_0x2a6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41aa6e,_0x5ea17f,_0x275d15){return new BPromise(function(_0x9adc9b,_0x4837fb){return client['request'](_0x41aa6e,_0x275d15)['then'](function(_0x3a7551){logger['info']('CmCustomField,\x20%s,\x20%s',_0x5ea17f,_0x2a6d('0xc'));logger[_0x2a6d('0xd')](_0x2a6d('0xe'),_0x5ea17f,'request\x20sent',JSON[_0x2a6d('0xf')](_0x3a7551));if(_0x3a7551[_0x2a6d('0x10')]){if(_0x3a7551[_0x2a6d('0x10')]['code']===0x1f4){logger['error'](_0x2a6d('0x11'),_0x5ea17f,_0x3a7551[_0x2a6d('0x10')][_0x2a6d('0x12')]);return _0x4837fb(_0x3a7551[_0x2a6d('0x10')][_0x2a6d('0x12')]);}logger['error'](_0x2a6d('0x11'),_0x5ea17f,_0x3a7551[_0x2a6d('0x10')][_0x2a6d('0x12')]);return _0x9adc9b(_0x3a7551['error'][_0x2a6d('0x12')]);}else{logger[_0x2a6d('0x13')](_0x2a6d('0x11'),_0x5ea17f,'request\x20sent');_0x9adc9b(_0x3a7551[_0x2a6d('0x14')][_0x2a6d('0x12')]);}})['catch'](function(_0x2fee10){logger[_0x2a6d('0x10')]('CmCustomField,\x20%s,\x20%s',_0x5ea17f,_0x2fee10);_0x4837fb(_0x2fee10);});});} \ No newline at end of file +var _0x5e94=['code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xcaf035,_0x4cfffa){var _0x149bf0=function(_0x34cd04){while(--_0x34cd04){_0xcaf035['push'](_0xcaf035['shift']());}};_0x149bf0(++_0x4cfffa);}(_0x5e94,0xb5));var _0x45e9=function(_0x4ad72f,_0x5a9055){_0x4ad72f=_0x4ad72f-0x0;var _0x279dcf=_0x5e94[_0x4ad72f];return _0x279dcf;};'use strict';var _=require(_0x45e9('0x0'));var util=require(_0x45e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x45e9('0x2'));var fs=require('fs');var Redis=require(_0x45e9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x45e9('0x4'));var logger=require('../../config/logger')(_0x45e9('0x5'));var config=require(_0x45e9('0x6'));var jayson=require(_0x45e9('0x7'));var client=jayson['client'][_0x45e9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30e759,_0x129055,_0x27fee5){return new BPromise(function(_0x25e5fa,_0x2f4225){return client[_0x45e9('0x9')](_0x30e759,_0x27fee5)[_0x45e9('0xa')](function(_0x3556b0){logger[_0x45e9('0xb')]('CmCustomField,\x20%s,\x20%s',_0x129055,'request\x20sent');logger[_0x45e9('0xc')](_0x45e9('0xd'),_0x129055,_0x45e9('0xe'),JSON[_0x45e9('0xf')](_0x3556b0));if(_0x3556b0[_0x45e9('0x10')]){if(_0x3556b0[_0x45e9('0x10')][_0x45e9('0x11')]===0x1f4){logger[_0x45e9('0x10')](_0x45e9('0x12'),_0x129055,_0x3556b0[_0x45e9('0x10')]['message']);return _0x2f4225(_0x3556b0[_0x45e9('0x10')]['message']);}logger[_0x45e9('0x10')](_0x45e9('0x12'),_0x129055,_0x3556b0['error'][_0x45e9('0x13')]);return _0x25e5fa(_0x3556b0[_0x45e9('0x10')][_0x45e9('0x13')]);}else{logger[_0x45e9('0xb')]('CmCustomField,\x20%s,\x20%s',_0x129055,_0x45e9('0xe'));_0x25e5fa(_0x3556b0[_0x45e9('0x14')][_0x45e9('0x13')]);}})[_0x45e9('0x15')](function(_0x5bff43){logger['error'](_0x45e9('0x12'),_0x129055,_0x5bff43);_0x2f4225(_0x5bff43);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index ee37700..9c650d8 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 _0x9df5=['get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller'];(function(_0x581274,_0x370501){var _0x2d720a=function(_0x152afb){while(--_0x152afb){_0x581274['push'](_0x581274['shift']());}};_0x2d720a(++_0x370501);}(_0x9df5,0x9b));var _0x59df=function(_0x4ae7e0,_0x15fee0){_0x4ae7e0=_0x4ae7e0-0x0;var _0x304d8a=_0x9df5[_0x4ae7e0];return _0x304d8a;};'use strict';var multer=require(_0x59df('0x0'));var util=require(_0x59df('0x1'));var path=require(_0x59df('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x59df('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x59df('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x59df('0x5'));var controller=require(_0x59df('0x6'));router[_0x59df('0x7')]('/',auth[_0x59df('0x8')](),controller['index']);router[_0x59df('0x7')](_0x59df('0x9'),auth['isAuthenticated'](),controller[_0x59df('0xa')]);router[_0x59df('0xb')]('/',auth[_0x59df('0x8')](),controller[_0x59df('0xc')]);router[_0x59df('0xd')](_0x59df('0x9'),auth[_0x59df('0x8')](),controller[_0x59df('0xe')]);router[_0x59df('0xf')](_0x59df('0x9'),auth['isAuthenticated'](),controller[_0x59df('0x10')]);module[_0x59df('0x11')]=router; \ No newline at end of file +var _0x126e=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x126e,0x108));var _0xe126=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x126e[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0xe126('0x0'));var path=require(_0xe126('0x1'));var timeout=require(_0xe126('0x2'));var express=require(_0xe126('0x3'));var router=express[_0xe126('0x4')]();var fs_extra=require(_0xe126('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe126('0x6'));var config=require(_0xe126('0x7'));var controller=require(_0xe126('0x8'));router[_0xe126('0x9')]('/',auth[_0xe126('0xa')](),controller[_0xe126('0xb')]);router[_0xe126('0x9')]('/:id',auth[_0xe126('0xa')](),controller[_0xe126('0xc')]);router[_0xe126('0xd')]('/',auth[_0xe126('0xa')](),controller[_0xe126('0xe')]);router['put'](_0xe126('0xf'),auth[_0xe126('0xa')](),controller['update']);router[_0xe126('0x10')](_0xe126('0xf'),auth['isAuthenticated'](),controller[_0xe126('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 9d4536d..6a10bb4 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 _0xa35e=['sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment'];(function(_0x25bd0c,_0x103172){var _0x16f18e=function(_0x3f9444){while(--_0x3f9444){_0x25bd0c['push'](_0x25bd0c['shift']());}};_0x16f18e(++_0x103172);}(_0xa35e,0xbd));var _0xea35=function(_0x566b67,_0x4b2769){_0x566b67=_0x566b67-0x0;var _0x4da054=_0xa35e[_0x566b67];return _0x4da054;};'use strict';var moment=require(_0xea35('0x0'));var Sequelize=require(_0xea35('0x1'));module[_0xea35('0x2')]={'phone':{'type':Sequelize[_0xea35('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xea35('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xea35('0x5')],'defaultValue':moment()[_0xea35('0x6')](_0xea35('0x7'))},'countbusyretry':{'type':Sequelize[_0xea35('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea35('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xea35('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xea35('0x8')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xea35('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xea35('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xea35('0x8')],'unique':_0xea35('0x9')},'UserId':{'type':Sequelize[_0xea35('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xea35('0x8')],'unique':_0xea35('0x9')},'CampaignId':{'type':Sequelize[_0xea35('0x8')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea35('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xea35('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xea35('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xea35('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x68a2=['BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','STRING'];(function(_0x447770,_0x690294){var _0x4b3fc7=function(_0x50455a){while(--_0x50455a){_0x447770['push'](_0x447770['shift']());}};_0x4b3fc7(++_0x690294);}(_0x68a2,0x15e));var _0x268a=function(_0x3d5921,_0x4ecb26){_0x3d5921=_0x3d5921-0x0;var _0x3baba9=_0x68a2[_0x3d5921];return _0x3baba9;};'use strict';var moment=require(_0x268a('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x268a('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x268a('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x268a('0x3')],'defaultValue':moment()['format'](_0x268a('0x4'))},'countbusyretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x268a('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x268a('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x268a('0x3')]},'priority':{'type':Sequelize[_0x268a('0x5')](0x2)[_0x268a('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x268a('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x268a('0x5')],'unique':_0x268a('0x7')},'ListId':{'type':Sequelize[_0x268a('0x5')],'unique':_0x268a('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x268a('0x5')],'unique':_0x268a('0x7')},'CampaignId':{'type':Sequelize[_0x268a('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x268a('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x268a('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x268a('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 22af9ae..23262be 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 _0x80d9=['$iLike','$notILike','$contains','$contained','$any','attributes','model','fields','length','hasOwnProperty','where','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','omit','createdAt','updatedAt','state','statedesc','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','CmContact','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','filter','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Contact','CmCompany','List','VoiceQueue','Queue','dialActive','getPreviewRecall','scheduledat','Company','CmList','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','push','utcOffset','json','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','offset','undefined','limit','count','Content-Range','update','then','sendStatus','error','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','keys','query','filters','intersection','$and','$gt','$ne','$eq','$not','$between','$notIn','$like','$notLike'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x80d9,0x15c));var _0x980d=function(_0x53b869,_0xc8f8a4){_0x53b869=_0x53b869-0x0;var _0x104414=_0x80d9[_0x53b869];return _0x104414;};'use strict';var moment=require(_0x980d('0x0'));var _=require('lodash');var qs=require(_0x980d('0x1'));var logger=require(_0x980d('0x2'))(_0x980d('0x3'));var shared=require('../../config/environment');var db=require(_0x980d('0x4'))['db'];function respondWithResult(_0x3a9d1e,_0x38d1b9){_0x38d1b9=_0x38d1b9||0xc8;return function(_0x279d93){if(_0x279d93){return _0x3a9d1e[_0x980d('0x5')](_0x38d1b9)['json'](_0x279d93);}};}function respondWithFilteredResult(_0x4c3533,_0x2fd4b9){return function(_0x50854e){if(_0x50854e){var _0x5d9eb0=typeof _0x2fd4b9[_0x980d('0x6')]===_0x980d('0x7')&&typeof _0x2fd4b9[_0x980d('0x8')]===_0x980d('0x7');var _0x3b1043=_0x50854e[_0x980d('0x9')];var _0x1c4589=_0x5d9eb0?0x0:_0x2fd4b9['offset'];var _0x55b479=_0x5d9eb0?_0x50854e['count']:_0x2fd4b9[_0x980d('0x6')]+_0x2fd4b9[_0x980d('0x8')];var _0x4a9536;if(_0x55b479>=_0x3b1043){_0x55b479=_0x3b1043;_0x4a9536=0xc8;}else{_0x4a9536=0xce;}_0x4c3533[_0x980d('0x5')](_0x4a9536);return _0x4c3533['set'](_0x980d('0xa'),_0x1c4589+'-'+_0x55b479+'/'+_0x3b1043)['json'](_0x50854e);}return null;};}function saveUpdates(_0xc0168a,_0x19cb9b){return function(_0x171a61){if(_0x171a61){return _0x171a61[_0x980d('0xb')](_0xc0168a)[_0x980d('0xc')](function(_0x18469c){return _0x18469c;});}return null;};}function handleEntityNotFound(_0x109ddf,_0x3a317b){return function(_0x5f524e){if(!_0x5f524e){_0x109ddf[_0x980d('0xd')](0x194);}return _0x5f524e;};}function handleError(_0x138882,_0x3fc5f7){_0x3fc5f7=_0x3fc5f7||0x1f4;return function(_0x3846bd){logger[_0x980d('0xe')](_0x3846bd[_0x980d('0xf')]);if(_0x3846bd['name']){delete _0x3846bd[_0x980d('0x10')];}_0x138882[_0x980d('0x5')](_0x3fc5f7)['send'](_0x3846bd);};}exports[_0x980d('0x11')]=function(_0x4e9d73,_0x23f64c){var _0x1bc7e4={},_0x39192b={},_0x3c06c5={'count':0x0,'rows':[]};var _0x2a9ce4=_[_0x980d('0x12')](db[_0x980d('0x13')][_0x980d('0x14')],function(_0xa59cc9){return{'name':_0xa59cc9[_0x980d('0x15')],'type':_0xa59cc9[_0x980d('0x16')]['key']};});_0x39192b['model']=_[_0x980d('0x12')](_0x2a9ce4,'name');_0x39192b['query']=_[_0x980d('0x17')](_0x4e9d73[_0x980d('0x18')]);_0x39192b[_0x980d('0x19')]=_[_0x980d('0x1a')](_0x39192b['model'],_0x39192b['query']);_0x39192b[_0x980d('0x19')]=_['concat'](_0x39192b[_0x980d('0x19')],[_0x980d('0x1b'),'$or',_0x980d('0x1c'),'$gte','$lt','$lte',_0x980d('0x1d'),_0x980d('0x1e'),_0x980d('0x1f'),_0x980d('0x20'),'$notBetween','$in',_0x980d('0x21'),_0x980d('0x22'),_0x980d('0x23'),_0x980d('0x24'),_0x980d('0x25'),'$like','$overlap',_0x980d('0x26'),_0x980d('0x27'),_0x980d('0x28')]);_0x1bc7e4[_0x980d('0x29')]=_[_0x980d('0x1a')](_0x39192b[_0x980d('0x2a')],qs['fields'](_0x4e9d73[_0x980d('0x18')][_0x980d('0x2b')]));_0x1bc7e4[_0x980d('0x29')]=_0x1bc7e4[_0x980d('0x29')][_0x980d('0x2c')]?_0x1bc7e4[_0x980d('0x29')]:_0x39192b[_0x980d('0x2a')];if(!_0x4e9d73[_0x980d('0x18')][_0x980d('0x2d')]('nolimit')){_0x1bc7e4[_0x980d('0x8')]=qs[_0x980d('0x8')](_0x4e9d73[_0x980d('0x18')]['limit']);_0x1bc7e4['offset']=qs[_0x980d('0x6')](_0x4e9d73['query'][_0x980d('0x6')]);}_0x1bc7e4['order']=qs['sort'](_0x4e9d73['query']['sort']);_0x1bc7e4['where']=qs['filters'](_['pick'](_0x4e9d73[_0x980d('0x18')],_0x39192b[_0x980d('0x19')]),_0x2a9ce4);if(_0x4e9d73[_0x980d('0x18')]['filter']){_0x1bc7e4[_0x980d('0x2e')]=_[_0x980d('0x2f')](_0x1bc7e4[_0x980d('0x2e')],{'$or':_[_0x980d('0x12')](_0x2a9ce4,function(_0x120bf1){if(_0x120bf1[_0x980d('0x16')]!==_0x980d('0x30')){var _0x56b08e={};_0x56b08e[_0x120bf1[_0x980d('0x10')]]={'$like':'%'+_0x4e9d73[_0x980d('0x18')]['filter']+'%'};return _0x56b08e;}})});}_0x1bc7e4=_[_0x980d('0x2f')]({},_0x1bc7e4,_0x4e9d73['options']);var _0x293f7d={'where':_0x1bc7e4[_0x980d('0x2e')]};return db[_0x980d('0x13')]['count'](_0x293f7d)['then'](function(_0x5d5903){_0x3c06c5[_0x980d('0x9')]=_0x5d5903;if(_0x4e9d73['query']['includeAll']){_0x1bc7e4[_0x980d('0x31')]=[{'all':!![]}];}return db[_0x980d('0x13')][_0x980d('0x32')](_0x1bc7e4);})['then'](function(_0x41174b){_0x3c06c5[_0x980d('0x33')]=_0x41174b;return _0x3c06c5;})[_0x980d('0xc')](respondWithFilteredResult(_0x23f64c,_0x1bc7e4))[_0x980d('0x34')](handleError(_0x23f64c,null));};exports[_0x980d('0x35')]=function(_0x4e2aac,_0x5a8515){var _0x18f844={'raw':!![],'where':{'id':_0x4e2aac['params']['id']}},_0x5d356d={};_0x5d356d['model']=_['keys'](db[_0x980d('0x13')][_0x980d('0x14')]);_0x5d356d[_0x980d('0x18')]=_['keys'](_0x4e2aac[_0x980d('0x18')]);_0x5d356d[_0x980d('0x19')]=_[_0x980d('0x1a')](_0x5d356d[_0x980d('0x2a')],_0x5d356d[_0x980d('0x18')]);_0x18f844[_0x980d('0x29')]=_[_0x980d('0x1a')](_0x5d356d['model'],qs[_0x980d('0x2b')](_0x4e2aac[_0x980d('0x18')][_0x980d('0x2b')]));_0x18f844['attributes']=_0x18f844[_0x980d('0x29')][_0x980d('0x2c')]?_0x18f844[_0x980d('0x29')]:_0x5d356d[_0x980d('0x2a')];if(_0x4e2aac[_0x980d('0x18')][_0x980d('0x36')]){_0x18f844[_0x980d('0x31')]=[{'all':!![]}];}_0x18f844=_['merge']({},_0x18f844,_0x4e2aac[_0x980d('0x37')]);return db['CmHopper'][_0x980d('0x38')](_0x18f844)[_0x980d('0xc')](handleEntityNotFound(_0x5a8515,null))[_0x980d('0xc')](respondWithResult(_0x5a8515,null))[_0x980d('0x34')](handleError(_0x5a8515,null));};exports[_0x980d('0x39')]=function(_0x20479d,_0x31581d){return db[_0x980d('0x13')]['create'](_0x20479d['body'],{})[_0x980d('0xc')](respondWithResult(_0x31581d,0xc9))[_0x980d('0x34')](handleError(_0x31581d,null));};exports[_0x980d('0xb')]=function(_0x3ee5e1,_0x1d724a){if(_0x3ee5e1['body']['id']){delete _0x3ee5e1[_0x980d('0x3a')]['id'];}return db[_0x980d('0x13')]['find']({'where':{'id':_0x3ee5e1[_0x980d('0x3b')]['id']}})[_0x980d('0xc')](handleEntityNotFound(_0x1d724a,null))[_0x980d('0xc')](saveUpdates(_0x3ee5e1[_0x980d('0x3a')],null))[_0x980d('0xc')](respondWithResult(_0x1d724a,null))[_0x980d('0x34')](handleError(_0x1d724a,null));};exports[_0x980d('0x3c')]=function(_0x135c26,_0x7515ac){return db['CmHopper'][_0x980d('0x3c')]()[_0x980d('0xc')](respondWithResult(_0x7515ac,null))[_0x980d('0x34')](handleError(_0x7515ac,null));};exports[_0x980d('0x3d')]=function(_0x2e18c6,_0x7d0acf){var _0x2e6cdf;var _0x4f0a6e=_0x2e18c6[_0x980d('0x3b')]['id'];return db['CmHopper'][_0x980d('0x38')]({'where':{'id':_0x2e18c6[_0x980d('0x3b')]['id']}})[_0x980d('0xc')](handleEntityNotFound(_0x7d0acf,null))[_0x980d('0xc')](function(_0xb1d509){if(_0xb1d509){return _0xb1d509['destroy']()[_0x980d('0xc')](function(_0x448b3c){return _0x448b3c;});}})[_0x980d('0xc')](function(_0x12c1ea){_0x2e6cdf=_0x12c1ea;if(_0x12c1ea){if(_0x12c1ea[_0x980d('0x3e')]||_0x12c1ea[_0x980d('0x3f')]){return db[_0x12c1ea[_0x980d('0x3e')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x12c1ea['VoiceQueueId']?_0x12c1ea[_0x980d('0x3e')]:_0x12c1ea[_0x980d('0x3f')]},'attributes':['id',_0x980d('0x10')],'raw':!![]});}}})[_0x980d('0xc')](function(_0x177bb2){var _0x316f6c={};if(_0x177bb2){_['merge'](_0x316f6c,_[_0x980d('0x40')](_0x2e6cdf['dataValues'],[_0x980d('0x41'),_0x980d('0x42'),'id']));_0x316f6c[_0x980d('0x43')]=0x15;_0x316f6c[_0x980d('0x44')]='deleted';_0x316f6c['campaign']=_0x177bb2[_0x980d('0x10')];_0x316f6c[_0x980d('0x45')]=_0x2e18c6[_0x980d('0x46')]['name'];_0x316f6c['UserId']=_0x2e18c6[_0x980d('0x46')]['id'];_0x316f6c['deleted']=!![];_0x316f6c[_0x980d('0x47')]=moment()[_0x980d('0x48')](_0x980d('0x49'));_0x316f6c[_0x980d('0x4a')]=_0x2e6cdf[_0x980d('0x4b')];_0x316f6c[_0x980d('0x4c')]=_0x2e6cdf[_0x980d('0x3e')]?_0x980d('0x4d'):'ivr';return db['CmContact'][_0x980d('0x38')]({'where':{'id':_0x316f6c['ContactId']},'attributes':[_0x980d('0x4e'),_0x980d('0x4f')]})['then'](function(_0x2b28e4){if(!_[_0x980d('0x50')](_0x7d0acf)&&!_[_0x980d('0x50')](_0x2b28e4[_0x980d('0x4e')])){_0x316f6c['calleridname']=_0x2b28e4[_0x980d('0x4e')];if(!_['isNil'](_0x2b28e4['lastName'])){_0x316f6c[_0x980d('0x51')]+='\x20'+_0x2b28e4['lastName'];}}})[_0x980d('0x52')](function(){return db['CmHopperFinal'][_0x980d('0x39')](_0x316f6c);});}})[_0x980d('0xc')](function(_0x5a74e5){return db[_0x980d('0x53')][_0x980d('0x3d')]({'where':{'CmHopperId':_0x4f0a6e}});})[_0x980d('0xc')](function(){return _0x7d0acf[_0x980d('0x5')](0xcc)[_0x980d('0x54')]();})[_0x980d('0x34')](handleError(_0x7d0acf,null));};exports[_0x980d('0x55')]=function(_0x3b5008,_0x3190b4){var _0x6df3f7=[];return db[_0x980d('0x56')][_0x980d('0x3c')]()['then'](function(_0x5416f1){_0x6df3f7=_['keys'](_0x5416f1);return _0x3b5008[_0x980d('0x46')]['getVoiceQueues']({'where':{'type':_0x980d('0x57'),'dialActive':!![],'dialMethod':_0x980d('0x58')},'attributes':['id',_0x980d('0x59'),_0x980d('0x5a')],'raw':!![]});})['then'](function(_0x395a95){if(_0x395a95&&_0x395a95[_0x980d('0x2c')]){return db['sequelize'][_0x980d('0x5b')](function(_0x5aebee){var _0x39dd5b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x980d('0x12')](_0x395a95,'id')},'$or':[{'UserId':null},{'UserId':_0x3b5008[_0x980d('0x46')]['id']}]};var _0x3e6234={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x395a95)[_0x980d('0x5c')](['dialPreviewAutoRecallMe',0x0])[_0x980d('0x12')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x3b5008['user']['id']}]};var _0x3fa7be={'$or':[_0x39dd5b,_0x3e6234]};var _0x360944=[];if(_0x3b5008[_0x980d('0x3a')][_0x980d('0x5d')]&&_0x3b5008[_0x980d('0x3a')][_0x980d('0x5d')]===_0x980d('0x5e')){if(!_[_0x980d('0x5f')](_0x3b5008[_0x980d('0x3a')][_0x980d('0x60')])){_0x3fa7be['id']={'$in':_0x3b5008['body'][_0x980d('0x60')]};}_0x360944=[['priority',_0x980d('0x61')],[_0x980d('0x62'),_0x395a95[0x0]['dialOrderByScheduledAt']===_0x980d('0x61')?_0x980d('0x63'):_0x980d('0x61')],db[_0x980d('0x64')]['literal'](_0x980d('0x65')),['id',_0x980d('0x63')]];}else{if(!_[_0x980d('0x5f')](_0x3b5008[_0x980d('0x3a')][_0x980d('0x60')])){_0x3fa7be['id']={'$notIn':_0x3b5008[_0x980d('0x3a')][_0x980d('0x60')]};}_0x360944=[[_0x980d('0x66'),_0x980d('0x63')],[_0x980d('0x62'),_0x395a95[0x0]['dialOrderByScheduledAt']],db[_0x980d('0x64')][_0x980d('0x67')](_0x980d('0x68')),['id',_0x980d('0x61')]];}return db[_0x980d('0x13')][_0x980d('0x69')]({'attributes':['id','scheduledat','phone',_0x980d('0x6a')],'where':_0x3fa7be,'order':_0x360944,'transaction':_0x5aebee,'lock':_0x5aebee[_0x980d('0x6b')][_0x980d('0x6c')],'include':[{'model':db[_0x980d('0x56')],'as':_0x980d('0x6d'),'attributes':_0x6df3f7,'include':[{'model':db[_0x980d('0x6e')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x980d('0x6f'),'attributes':['id','name']},{'model':db[_0x980d('0x70')],'as':_0x980d('0x71'),'attributes':['id',_0x980d('0x10'),_0x980d('0x72')]}]})['then'](function(_0x4996f3){if(_0x4996f3){return _0x4996f3[_0x980d('0xb')]({'UserId':_0x3b5008['user']['id']},{'transaction':_0x5aebee});}});});}})[_0x980d('0xc')](handleEntityNotFound(_0x3190b4,null))[_0x980d('0xc')](respondWithResult(_0x3190b4,null))[_0x980d('0x34')](handleError(_0x3190b4,null));};exports[_0x980d('0x73')]=function(_0x579623,_0x32540e,_0x569c2d){var _0x2e2fe1=[];var _0x30e444=_0x579623[_0x980d('0x3b')]['id'];var _0xd56320=_0x579623['user']['id'];return db[_0x980d('0x56')][_0x980d('0x3c')]()[_0x980d('0xc')](function(_0xe2df60){_0x2e2fe1=_[_0x980d('0x17')](_0xe2df60);return db[_0x980d('0x64')]['transaction'](function(_0x313f04){const _0x40bc31={'id':_0x30e444};return db['CmHopper'][_0x980d('0x69')]({'attributes':['id',_0x980d('0x74'),'recallme'],'where':_0x40bc31,'transaction':_0x313f04,'lock':_0x313f04['LOCK']['UPDATE'],'include':[{'model':db[_0x980d('0x56')],'as':_0x980d('0x6d'),'attributes':_0x2e2fe1,'include':[{'model':db[_0x980d('0x6e')],'as':_0x980d('0x75'),'attributes':['id',_0x980d('0x10')]}]},{'model':db[_0x980d('0x76')],'as':_0x980d('0x6f'),'attributes':['id',_0x980d('0x10')]},{'model':db[_0x980d('0x70')],'as':_0x980d('0x71'),'attributes':['id','name',_0x980d('0x72')]}]})[_0x980d('0xc')](function(_0x1543a8){if(_0x1543a8){return _0x1543a8[_0x980d('0xb')]({'UserId':_0xd56320},{'transaction':_0x313f04});}});});})[_0x980d('0xc')](handleEntityNotFound(_0x32540e,null))[_0x980d('0xc')](respondWithResult(_0x32540e,null))['catch'](handleError(_0x32540e,null));};exports['getOpenContacts']=function(_0x358fc8,_0x232828){return _0x358fc8['user'][_0x980d('0x77')]({'where':{'type':_0x980d('0x57'),'dialActive':!![],'dialMethod':_0x980d('0x58')},'attributes':['id'],'raw':!![]})[_0x980d('0xc')](function(_0x9691){if(_0x9691&&_0x9691[_0x980d('0x2c')]){return db['CmHopper'][_0x980d('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x980d('0x48')](_0x980d('0x49'))},'VoiceQueueId':{'$in':_[_0x980d('0x12')](_0x9691,'id')},'$or':[{'UserId':null},{'UserId':_0x358fc8['user']['id']}]}});}return 0x0;})[_0x980d('0xc')](function(_0x495d56){if(!_['isNil'](_0x495d56)&&_['isNumber'](_0x495d56)){return _0x232828[_0x980d('0x5')](0xc8)['json']({'contacts':_0x495d56});}else{logger[_0x980d('0xe')](_0x980d('0x78'),_0x980d('0x79'),0x194,_0x980d('0x7a'));_0x232828[_0x980d('0xd')](0x194);}})[_0x980d('0x34')](handleError(_0x232828,null));};exports['getTimezones']=function(_0x1cce28,_0x6b83e9){var _0x5ea5e4=shared[_0x980d('0x7b')];var _0x573c58=[];_['map'](_0x5ea5e4,function(_0x336709){_0x573c58[_0x980d('0x7c')]({'id':_0x336709[_0x980d('0x10')],'name':_0x336709[_0x980d('0x10')],'utcOffset':_0x336709[_0x980d('0x7d')]});});return _0x6b83e9[_0x980d('0x5')](0xc8)[_0x980d('0x7e')]({'tz':_0x573c58});};exports[_0x980d('0x7f')]=function(_0x15c87b,_0x3517bd){var _0x28dbea=shared[_0x980d('0x7b')];var _0x1e14c5={};if(!_[_0x980d('0x50')](_0x28dbea[_0x15c87b['body']['id']]))_0x1e14c5=_0x28dbea[_0x15c87b[_0x980d('0x3a')]['id']];return _0x3517bd['status'](0xc8)['json'](_0x1e14c5);}; \ No newline at end of file +var _0x106f=['where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','find','catch','create','body','describe','destroy','params','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','ivr','CmContact','firstName','isNil','calleridname','lastName','CmHopperFinal','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','value','direction','prev','hopperIds','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','recallme','UPDATE','CmList','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','getTimezone','moment','lodash','../../config/logger','api','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','update','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$iLike','$notILike','$like','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x34951f,_0x277327){var _0x487db1=function(_0x452a5f){while(--_0x452a5f){_0x34951f['push'](_0x34951f['shift']());}};_0x487db1(++_0x277327);}(_0x106f,0x162));var _0xf106=function(_0x27333b,_0x3ba850){_0x27333b=_0x27333b-0x0;var _0x535b10=_0x106f[_0x27333b];return _0x535b10;};'use strict';var moment=require(_0xf106('0x0'));var _=require(_0xf106('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xf106('0x2'))(_0xf106('0x3'));var shared=require('../../config/environment');var db=require(_0xf106('0x4'))['db'];function respondWithResult(_0x4ab04f,_0x1236af){_0x1236af=_0x1236af||0xc8;return function(_0x370f6a){if(_0x370f6a){return _0x4ab04f[_0xf106('0x5')](_0x1236af)[_0xf106('0x6')](_0x370f6a);}};}function respondWithFilteredResult(_0x253f6d,_0x282fd4){return function(_0xc9588d){if(_0xc9588d){var _0x546acc=typeof _0x282fd4[_0xf106('0x7')]===_0xf106('0x8')&&typeof _0x282fd4['limit']==='undefined';var _0x507ad9=_0xc9588d['count'];var _0x52befe=_0x546acc?0x0:_0x282fd4[_0xf106('0x7')];var _0x3761d5=_0x546acc?_0xc9588d[_0xf106('0x9')]:_0x282fd4[_0xf106('0x7')]+_0x282fd4[_0xf106('0xa')];var _0x32ba4d;if(_0x3761d5>=_0x507ad9){_0x3761d5=_0x507ad9;_0x32ba4d=0xc8;}else{_0x32ba4d=0xce;}_0x253f6d[_0xf106('0x5')](_0x32ba4d);return _0x253f6d[_0xf106('0xb')](_0xf106('0xc'),_0x52befe+'-'+_0x3761d5+'/'+_0x507ad9)[_0xf106('0x6')](_0xc9588d);}return null;};}function saveUpdates(_0x31eebf,_0x5e9da8){return function(_0x2bd234){if(_0x2bd234){return _0x2bd234[_0xf106('0xd')](_0x31eebf)['then'](function(_0x59854c){return _0x59854c;});}return null;};}function handleEntityNotFound(_0x322351,_0x2cdbf6){return function(_0x292a0d){if(!_0x292a0d){_0x322351['sendStatus'](0x194);}return _0x292a0d;};}function handleError(_0x26bd1b,_0x26186f){_0x26186f=_0x26186f||0x1f4;return function(_0xf05683){logger['error'](_0xf05683[_0xf106('0xe')]);if(_0xf05683[_0xf106('0xf')]){delete _0xf05683['name'];}_0x26bd1b[_0xf106('0x5')](_0x26186f)[_0xf106('0x10')](_0xf05683);};}exports[_0xf106('0x11')]=function(_0x5e4c8f,_0x5d02c0){var _0x13b6b4={},_0x726d7c={},_0x7e15d1={'count':0x0,'rows':[]};var _0x4d395d=_[_0xf106('0x12')](db[_0xf106('0x13')][_0xf106('0x14')],function(_0x17b243){return{'name':_0x17b243[_0xf106('0x15')],'type':_0x17b243[_0xf106('0x16')][_0xf106('0x17')]};});_0x726d7c[_0xf106('0x18')]=_[_0xf106('0x12')](_0x4d395d,'name');_0x726d7c['query']=_[_0xf106('0x19')](_0x5e4c8f['query']);_0x726d7c[_0xf106('0x1a')]=_[_0xf106('0x1b')](_0x726d7c[_0xf106('0x18')],_0x726d7c[_0xf106('0x1c')]);_0x726d7c[_0xf106('0x1a')]=_['concat'](_0x726d7c['filters'],[_0xf106('0x1d'),_0xf106('0x1e'),_0xf106('0x1f'),_0xf106('0x20'),_0xf106('0x21'),_0xf106('0x22'),_0xf106('0x23'),_0xf106('0x24'),_0xf106('0x25'),_0xf106('0x26'),_0xf106('0x27'),_0xf106('0x28'),'$notIn','$like','$notLike',_0xf106('0x29'),_0xf106('0x2a'),_0xf106('0x2b'),_0xf106('0x2c'),_0xf106('0x2d'),_0xf106('0x2e'),'$any']);_0x13b6b4[_0xf106('0x2f')]=_[_0xf106('0x1b')](_0x726d7c[_0xf106('0x18')],qs[_0xf106('0x30')](_0x5e4c8f['query'][_0xf106('0x30')]));_0x13b6b4[_0xf106('0x2f')]=_0x13b6b4[_0xf106('0x2f')][_0xf106('0x31')]?_0x13b6b4[_0xf106('0x2f')]:_0x726d7c[_0xf106('0x18')];if(!_0x5e4c8f['query'][_0xf106('0x32')](_0xf106('0x33'))){_0x13b6b4[_0xf106('0xa')]=qs[_0xf106('0xa')](_0x5e4c8f['query'][_0xf106('0xa')]);_0x13b6b4[_0xf106('0x7')]=qs['offset'](_0x5e4c8f[_0xf106('0x1c')][_0xf106('0x7')]);}_0x13b6b4[_0xf106('0x34')]=qs[_0xf106('0x35')](_0x5e4c8f[_0xf106('0x1c')][_0xf106('0x35')]);_0x13b6b4[_0xf106('0x36')]=qs[_0xf106('0x1a')](_[_0xf106('0x37')](_0x5e4c8f[_0xf106('0x1c')],_0x726d7c[_0xf106('0x1a')]),_0x4d395d);if(_0x5e4c8f['query']['filter']){_0x13b6b4[_0xf106('0x36')]=_[_0xf106('0x38')](_0x13b6b4[_0xf106('0x36')],{'$or':_['map'](_0x4d395d,function(_0x149645){if(_0x149645[_0xf106('0x16')]!==_0xf106('0x39')){var _0xebb99={};_0xebb99[_0x149645[_0xf106('0xf')]]={'$like':'%'+_0x5e4c8f['query'][_0xf106('0x3a')]+'%'};return _0xebb99;}})});}_0x13b6b4=_['merge']({},_0x13b6b4,_0x5e4c8f[_0xf106('0x3b')]);var _0x2e4c93={'where':_0x13b6b4[_0xf106('0x36')]};return db[_0xf106('0x13')]['count'](_0x2e4c93)[_0xf106('0x3c')](function(_0x3d1e1f){_0x7e15d1[_0xf106('0x9')]=_0x3d1e1f;if(_0x5e4c8f['query']['includeAll']){_0x13b6b4['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x13b6b4);})[_0xf106('0x3c')](function(_0x5de95b){_0x7e15d1['rows']=_0x5de95b;return _0x7e15d1;})[_0xf106('0x3c')](respondWithFilteredResult(_0x5d02c0,_0x13b6b4))['catch'](handleError(_0x5d02c0,null));};exports['show']=function(_0x26ffc3,_0x1a3b02){var _0x2d4c90={'raw':!![],'where':{'id':_0x26ffc3['params']['id']}},_0x3e557d={};_0x3e557d[_0xf106('0x18')]=_[_0xf106('0x19')](db['CmHopper'][_0xf106('0x14')]);_0x3e557d[_0xf106('0x1c')]=_[_0xf106('0x19')](_0x26ffc3[_0xf106('0x1c')]);_0x3e557d[_0xf106('0x1a')]=_[_0xf106('0x1b')](_0x3e557d[_0xf106('0x18')],_0x3e557d['query']);_0x2d4c90['attributes']=_[_0xf106('0x1b')](_0x3e557d['model'],qs['fields'](_0x26ffc3[_0xf106('0x1c')][_0xf106('0x30')]));_0x2d4c90['attributes']=_0x2d4c90['attributes'][_0xf106('0x31')]?_0x2d4c90['attributes']:_0x3e557d[_0xf106('0x18')];if(_0x26ffc3[_0xf106('0x1c')][_0xf106('0x3d')]){_0x2d4c90[_0xf106('0x3e')]=[{'all':!![]}];}_0x2d4c90=_[_0xf106('0x38')]({},_0x2d4c90,_0x26ffc3[_0xf106('0x3b')]);return db[_0xf106('0x13')][_0xf106('0x3f')](_0x2d4c90)[_0xf106('0x3c')](handleEntityNotFound(_0x1a3b02,null))[_0xf106('0x3c')](respondWithResult(_0x1a3b02,null))[_0xf106('0x40')](handleError(_0x1a3b02,null));};exports[_0xf106('0x41')]=function(_0x39763c,_0x252ee1){return db[_0xf106('0x13')][_0xf106('0x41')](_0x39763c[_0xf106('0x42')],{})[_0xf106('0x3c')](respondWithResult(_0x252ee1,0xc9))['catch'](handleError(_0x252ee1,null));};exports[_0xf106('0xd')]=function(_0x20942e,_0xd0e741){if(_0x20942e[_0xf106('0x42')]['id']){delete _0x20942e[_0xf106('0x42')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x20942e['params']['id']}})['then'](handleEntityNotFound(_0xd0e741,null))[_0xf106('0x3c')](saveUpdates(_0x20942e['body'],null))['then'](respondWithResult(_0xd0e741,null))[_0xf106('0x40')](handleError(_0xd0e741,null));};exports[_0xf106('0x43')]=function(_0xd50443,_0x105337){return db['CmHopper'][_0xf106('0x43')]()[_0xf106('0x3c')](respondWithResult(_0x105337,null))[_0xf106('0x40')](handleError(_0x105337,null));};exports[_0xf106('0x44')]=function(_0x1bf065,_0x519192){var _0x59bd01;var _0x37dc6a=_0x1bf065[_0xf106('0x45')]['id'];return db[_0xf106('0x13')]['find']({'where':{'id':_0x1bf065[_0xf106('0x45')]['id']}})[_0xf106('0x3c')](handleEntityNotFound(_0x519192,null))[_0xf106('0x3c')](function(_0x1ddfce){if(_0x1ddfce){return _0x1ddfce['destroy']()[_0xf106('0x3c')](function(_0x5b80a8){return _0x5b80a8;});}})['then'](function(_0x148730){_0x59bd01=_0x148730;if(_0x148730){if(_0x148730[_0xf106('0x46')]||_0x148730['CampaignId']){return db[_0x148730[_0xf106('0x46')]?_0xf106('0x47'):_0xf106('0x48')][_0xf106('0x3f')]({'where':{'id':_0x148730[_0xf106('0x46')]?_0x148730[_0xf106('0x46')]:_0x148730['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xf106('0x3c')](function(_0x53b682){var _0x20c935={};if(_0x53b682){_['merge'](_0x20c935,_[_0xf106('0x49')](_0x59bd01[_0xf106('0x4a')],[_0xf106('0x4b'),_0xf106('0x4c'),'id']));_0x20c935['state']=0x15;_0x20c935[_0xf106('0x4d')]=_0xf106('0x4e');_0x20c935[_0xf106('0x4f')]=_0x53b682[_0xf106('0xf')];_0x20c935[_0xf106('0x50')]=_0x1bf065[_0xf106('0x51')][_0xf106('0xf')];_0x20c935[_0xf106('0x52')]=_0x1bf065[_0xf106('0x51')]['id'];_0x20c935[_0xf106('0x4e')]=!![];_0x20c935[_0xf106('0x53')]=moment()[_0xf106('0x54')](_0xf106('0x55'));_0x20c935[_0xf106('0x56')]=_0x59bd01[_0xf106('0x57')];_0x20c935[_0xf106('0x58')]=_0x59bd01['VoiceQueueId']?'queue':_0xf106('0x59');return db[_0xf106('0x5a')][_0xf106('0x3f')]({'where':{'id':_0x20c935['ContactId']},'attributes':[_0xf106('0x5b'),'lastName']})[_0xf106('0x3c')](function(_0x332a79){if(!_[_0xf106('0x5c')](_0x519192)&&!_['isNil'](_0x332a79[_0xf106('0x5b')])){_0x20c935['calleridname']=_0x332a79[_0xf106('0x5b')];if(!_[_0xf106('0x5c')](_0x332a79['lastName'])){_0x20c935[_0xf106('0x5d')]+='\x20'+_0x332a79[_0xf106('0x5e')];}}})['finally'](function(){return db[_0xf106('0x5f')][_0xf106('0x41')](_0x20c935);});}})['then'](function(_0x24f283){return db['CmHopperAdditionalPhone'][_0xf106('0x44')]({'where':{'CmHopperId':_0x37dc6a}});})[_0xf106('0x3c')](function(){return _0x519192['status'](0xcc)[_0xf106('0x60')]();})['catch'](handleError(_0x519192,null));};exports['getPreview']=function(_0x151d33,_0x1b903b){var _0x15bf0f=[];return db[_0xf106('0x5a')][_0xf106('0x43')]()[_0xf106('0x3c')](function(_0xe2c0ee){_0x15bf0f=_[_0xf106('0x19')](_0xe2c0ee);return _0x151d33[_0xf106('0x51')][_0xf106('0x61')]({'where':{'type':_0xf106('0x62'),'dialActive':!![],'dialMethod':_0xf106('0x63')},'attributes':['id',_0xf106('0x64'),_0xf106('0x65')],'raw':!![]});})[_0xf106('0x3c')](function(_0x40bc98){if(_0x40bc98&&_0x40bc98['length']){return db[_0xf106('0x66')]['transaction'](function(_0x40be0c){var _0x505f8f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xf106('0x55'))},'VoiceQueueId':{'$in':_['map'](_0x40bc98,'id')},'$or':[{'UserId':null},{'UserId':_0x151d33[_0xf106('0x51')]['id']}]};var _0x3c07c6={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x40bc98)[_0xf106('0x3a')]([_0xf106('0x65'),0x0])[_0xf106('0x12')]('id')[_0xf106('0x67')]()},'$or':[{'UserId':null},{'UserId':_0x151d33[_0xf106('0x51')]['id']}]};var _0x1eac36={'$or':[_0x505f8f,_0x3c07c6]};var _0x409d13=[];if(_0x151d33['body'][_0xf106('0x68')]&&_0x151d33[_0xf106('0x42')]['direction']===_0xf106('0x69')){if(!_['isEmpty'](_0x151d33[_0xf106('0x42')][_0xf106('0x6a')])){_0x1eac36['id']={'$in':_0x151d33[_0xf106('0x42')][_0xf106('0x6a')]};}_0x409d13=[['priority',_0xf106('0x6b')],[_0xf106('0x6c'),_0x40bc98[0x0][_0xf106('0x64')]===_0xf106('0x6b')?'DESC':_0xf106('0x6b')],db[_0xf106('0x66')][_0xf106('0x6d')](_0xf106('0x6e')),['id',_0xf106('0x6f')]];}else{if(!_[_0xf106('0x70')](_0x151d33[_0xf106('0x42')][_0xf106('0x6a')])){_0x1eac36['id']={'$notIn':_0x151d33[_0xf106('0x42')][_0xf106('0x6a')]};}_0x409d13=[[_0xf106('0x71'),_0xf106('0x6f')],['scheduledAt',_0x40bc98[0x0][_0xf106('0x64')]],db[_0xf106('0x66')][_0xf106('0x6d')](_0xf106('0x72')),['id',_0xf106('0x6b')]];}return db['CmHopper'][_0xf106('0x73')]({'attributes':['id',_0xf106('0x74'),_0xf106('0x57'),'recallme'],'where':_0x1eac36,'order':_0x409d13,'transaction':_0x40be0c,'lock':_0x40be0c[_0xf106('0x75')]['UPDATE'],'include':[{'model':db[_0xf106('0x5a')],'as':_0xf106('0x76'),'attributes':_0x15bf0f,'include':[{'model':db[_0xf106('0x77')],'as':_0xf106('0x78'),'attributes':['id',_0xf106('0xf')]}]},{'model':db['CmList'],'as':_0xf106('0x79'),'attributes':['id','name']},{'model':db[_0xf106('0x47')],'as':_0xf106('0x7a'),'attributes':['id',_0xf106('0xf'),_0xf106('0x7b')]}]})[_0xf106('0x3c')](function(_0x27f68c){if(_0x27f68c){return _0x27f68c[_0xf106('0xd')]({'UserId':_0x151d33[_0xf106('0x51')]['id']},{'transaction':_0x40be0c});}});});}})['then'](handleEntityNotFound(_0x1b903b,null))[_0xf106('0x3c')](respondWithResult(_0x1b903b,null))['catch'](handleError(_0x1b903b,null));};exports[_0xf106('0x7c')]=function(_0x4393b1,_0x5974ed,_0x1d4b0f){var _0x340317=[];var _0x5258ad=_0x4393b1[_0xf106('0x45')]['id'];var _0x5eafcf=_0x4393b1[_0xf106('0x51')]['id'];return db[_0xf106('0x5a')][_0xf106('0x43')]()['then'](function(_0x35263c){_0x340317=_['keys'](_0x35263c);return db[_0xf106('0x66')]['transaction'](function(_0x26fc26){const _0x28e042={'id':_0x5258ad};return db[_0xf106('0x13')][_0xf106('0x73')]({'attributes':['id',_0xf106('0x74'),_0xf106('0x7d')],'where':_0x28e042,'transaction':_0x26fc26,'lock':_0x26fc26[_0xf106('0x75')][_0xf106('0x7e')],'include':[{'model':db[_0xf106('0x5a')],'as':_0xf106('0x76'),'attributes':_0x340317,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xf106('0xf')]}]},{'model':db[_0xf106('0x7f')],'as':_0xf106('0x79'),'attributes':['id',_0xf106('0xf')]},{'model':db[_0xf106('0x47')],'as':_0xf106('0x7a'),'attributes':['id','name',_0xf106('0x7b')]}]})[_0xf106('0x3c')](function(_0x4b5ef5){if(_0x4b5ef5){return _0x4b5ef5[_0xf106('0xd')]({'UserId':_0x5eafcf},{'transaction':_0x26fc26});}});});})[_0xf106('0x3c')](handleEntityNotFound(_0x5974ed,null))['then'](respondWithResult(_0x5974ed,null))[_0xf106('0x40')](handleError(_0x5974ed,null));};exports[_0xf106('0x80')]=function(_0x1ce81f,_0x5a1d5e){return _0x1ce81f[_0xf106('0x51')][_0xf106('0x61')]({'where':{'type':_0xf106('0x62'),'dialActive':!![],'dialMethod':_0xf106('0x63')},'attributes':['id'],'raw':!![]})[_0xf106('0x3c')](function(_0x2f6a31){if(_0x2f6a31&&_0x2f6a31[_0xf106('0x31')]){return db[_0xf106('0x13')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xf106('0x55'))},'VoiceQueueId':{'$in':_['map'](_0x2f6a31,'id')},'$or':[{'UserId':null},{'UserId':_0x1ce81f['user']['id']}]}});}return 0x0;})[_0xf106('0x3c')](function(_0x5547ed){if(!_[_0xf106('0x5c')](_0x5547ed)&&_['isNumber'](_0x5547ed)){return _0x5a1d5e[_0xf106('0x5')](0xc8)[_0xf106('0x6')]({'contacts':_0x5547ed});}else{logger['error'](_0xf106('0x81'),_0xf106('0x80'),0x194,_0xf106('0x82'));_0x5a1d5e[_0xf106('0x83')](0x194);}})[_0xf106('0x40')](handleError(_0x5a1d5e,null));};exports[_0xf106('0x84')]=function(_0x50d390,_0x92e626){var _0x4760fd=shared['timezones'];var _0x4b6927=[];_[_0xf106('0x12')](_0x4760fd,function(_0x1f2297){_0x4b6927[_0xf106('0x85')]({'id':_0x1f2297[_0xf106('0xf')],'name':_0x1f2297[_0xf106('0xf')],'utcOffset':_0x1f2297[_0xf106('0x86')]});});return _0x92e626[_0xf106('0x5')](0xc8)[_0xf106('0x6')]({'tz':_0x4b6927});};exports[_0xf106('0x87')]=function(_0x578815,_0x3e037e){var _0x10fb6e=shared['timezones'];var _0x4986c9={};if(!_[_0xf106('0x5c')](_0x10fb6e[_0x578815[_0xf106('0x42')]['id']]))_0x4986c9=_0x10fb6e[_0x578815['body']['id']];return _0x3e037e[_0xf106('0x5')](0xc8)['json'](_0x4986c9);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 2d68ead..ed502c6 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 _0x7c09=['scheduledat','phone','priority','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x989031,_0x49924b){var _0x47ca12=function(_0x279d0e){while(--_0x279d0e){_0x989031['push'](_0x989031['shift']());}};_0x47ca12(++_0x49924b);}(_0x7c09,0x102));var _0x97c0=function(_0x192147,_0x3fc103){_0x192147=_0x192147-0x0;var _0x425b4d=_0x7c09[_0x192147];return _0x425b4d;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[{'name':_0x97c0('0xc'),'fields':[_0x97c0('0xc')]},{'name':'phone','fields':[_0x97c0('0xd')]},{'name':'priority','fields':[_0x97c0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','priority','lodash','util','../../config/logger'];(function(_0x45179b,_0x2e9d90){var _0x191fb3=function(_0x72f162){while(--_0x72f162){_0x45179b['push'](_0x45179b['shift']());}};_0x191fb3(++_0x2e9d90);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xe')]},{'name':'phone','fields':['phone']},{'name':_0xae3d('0xf'),'fields':[_0xae3d('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 734f054..ef870c2 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 _0x6688=['findOne','phone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','name','voicePause','CmList','lodash','util','moment','../../config/logger','CmHopper','options','raw','where','attributes','limit','include','map','model','info','GetCmHopper','stringify','error','message','then','debug','ShowCmHopper','CreateCmHopper','body','catch','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','transaction','order','LOCK','Contact','User','Agent','length','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UserId','UPDATE','all','GetContactRecallMe','GetCmHopperPreview','describe','keys'];(function(_0x22008d,_0xd13c17){var _0x4d3080=function(_0x317895){while(--_0x317895){_0x22008d['push'](_0x22008d['shift']());}};_0x4d3080(++_0xd13c17);}(_0x6688,0x19e));var _0x8668=function(_0x3045c1,_0x184319){_0x3045c1=_0x3045c1-0x0;var _0x254c71=_0x6688[_0x3045c1];return _0x254c71;};'use strict';var _=require(_0x8668('0x0'));var util=require(_0x8668('0x1'));var moment=require(_0x8668('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x8668('0x3'))('rpc');exports['GetCmHopper']=function(_0x300f92){var _0xa121da=this;return new Promise(function(_0x30fb3f,_0x5738a0){return db[_0x8668('0x4')]['findAll']({'raw':_0x300f92[_0x8668('0x5')]?_0x300f92[_0x8668('0x5')][_0x8668('0x6')]===undefined?!![]:![]:!![],'where':_0x300f92[_0x8668('0x5')]?_0x300f92[_0x8668('0x5')][_0x8668('0x7')]||null:null,'attributes':_0x300f92['options']?_0x300f92[_0x8668('0x5')][_0x8668('0x8')]||null:null,'limit':_0x300f92[_0x8668('0x5')]?_0x300f92['options'][_0x8668('0x9')]||null:null,'include':_0x300f92[_0x8668('0x5')]?_0x300f92[_0x8668('0x5')][_0x8668('0xa')]?_[_0x8668('0xb')](_0x300f92[_0x8668('0x5')][_0x8668('0xa')],function(_0x493794){return{'model':db[_0x493794[_0x8668('0xc')]],'as':_0x493794['as'],'attributes':_0x493794['attributes'],'include':_0x493794[_0x8668('0xa')]?_[_0x8668('0xb')](_0x493794[_0x8668('0xa')],function(_0x5767f7){return{'model':db[_0x5767f7['model']],'as':_0x5767f7['as'],'attributes':_0x5767f7[_0x8668('0x8')],'include':_0x5767f7[_0x8668('0xa')]?_['map'](_0x5767f7['include'],function(_0xa0519f){return{'model':db[_0xa0519f['model']],'as':_0xa0519f['as'],'attributes':_0xa0519f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c52d4){logger[_0x8668('0xd')](_0x8668('0xe'),_0x300f92);logger['debug'](_0x8668('0xe'),_0x300f92,JSON[_0x8668('0xf')](_0x4c52d4));_0x30fb3f(_0x4c52d4);})['catch'](function(_0x5a6c28){logger[_0x8668('0x10')](_0x8668('0xe'),_0x5a6c28[_0x8668('0x11')],_0x300f92);_0x5738a0(_0xa121da[_0x8668('0x10')](0x1f4,_0x5a6c28[_0x8668('0x11')]));});});};exports['ShowCmHopper']=function(_0x22ec49){var _0x3efbe8=this;return new Promise(function(_0x1a29b7,_0x259038){return db['CmHopper']['find']({'raw':_0x22ec49[_0x8668('0x5')]?_0x22ec49[_0x8668('0x5')][_0x8668('0x6')]===undefined?!![]:![]:!![],'where':_0x22ec49['options']?_0x22ec49['options'][_0x8668('0x7')]||null:null,'attributes':_0x22ec49[_0x8668('0x5')]?_0x22ec49[_0x8668('0x5')][_0x8668('0x8')]||null:null,'include':_0x22ec49[_0x8668('0x5')]?_0x22ec49['options'][_0x8668('0xa')]?_[_0x8668('0xb')](_0x22ec49[_0x8668('0x5')]['include'],function(_0x5a285b){return{'model':db[_0x5a285b[_0x8668('0xc')]],'as':_0x5a285b['as'],'attributes':_0x5a285b[_0x8668('0x8')],'include':_0x5a285b[_0x8668('0xa')]?_[_0x8668('0xb')](_0x5a285b[_0x8668('0xa')],function(_0x277f5d){return{'model':db[_0x277f5d[_0x8668('0xc')]],'as':_0x277f5d['as'],'attributes':_0x277f5d['attributes'],'include':_0x277f5d['include']?_[_0x8668('0xb')](_0x277f5d[_0x8668('0xa')],function(_0x4a2742){return{'model':db[_0x4a2742['model']],'as':_0x4a2742['as'],'attributes':_0x4a2742[_0x8668('0x8')]};}):[]};}):[]};}):[]:[]})[_0x8668('0x12')](function(_0x2d8636){logger['info']('ShowCmHopper',_0x22ec49);logger[_0x8668('0x13')](_0x8668('0x14'),_0x22ec49,JSON[_0x8668('0xf')](_0x2d8636));_0x1a29b7(_0x2d8636);})['catch'](function(_0x3631fc){logger[_0x8668('0x10')](_0x8668('0x14'),_0x3631fc[_0x8668('0x11')],_0x22ec49);_0x259038(_0x3efbe8[_0x8668('0x10')](0x1f4,_0x3631fc[_0x8668('0x11')]));});});};exports[_0x8668('0x15')]=function(_0x520260){var _0x30faf4=this;return new Promise(function(_0x55e8aa,_0x44d565){return db[_0x8668('0x4')]['create'](_0x520260[_0x8668('0x16')],{'raw':_0x520260[_0x8668('0x5')]?_0x520260['options']['raw']===undefined?!![]:![]:!![]})[_0x8668('0x12')](function(_0x530bbd){logger[_0x8668('0xd')]('CreateCmHopper',_0x520260);logger['debug'](_0x8668('0x15'),_0x520260,JSON[_0x8668('0xf')](_0x530bbd));_0x55e8aa(_0x530bbd);})[_0x8668('0x17')](function(_0x13eaa6){logger[_0x8668('0x10')](_0x8668('0x15'),_0x13eaa6[_0x8668('0x11')],_0x520260);_0x44d565(_0x30faf4['error'](0x1f4,_0x13eaa6[_0x8668('0x11')]));});});};exports[_0x8668('0x18')]=function(_0x56c4e1){var _0x3c6165=this;return new Promise(function(_0x50aac2,_0x57a776){return db[_0x8668('0x4')][_0x8668('0x19')](_0x56c4e1['body'],{'raw':_0x56c4e1[_0x8668('0x5')]?_0x56c4e1[_0x8668('0x5')][_0x8668('0x6')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56c4e1[_0x8668('0x5')]?_0x56c4e1['options']['where']||null:null,'attributes':_0x56c4e1[_0x8668('0x5')]?_0x56c4e1[_0x8668('0x5')]['attributes']||null:null,'limit':_0x56c4e1[_0x8668('0x5')]?_0x56c4e1[_0x8668('0x5')][_0x8668('0x9')]||null:null})[_0x8668('0x12')](function(_0x20d54e){logger[_0x8668('0xd')](_0x8668('0x18'),_0x56c4e1);logger[_0x8668('0xd')](_0x8668('0x1a'),JSON[_0x8668('0xf')](_0x56c4e1[_0x8668('0x5')]['where']),_0x56c4e1['body'][_0x8668('0x1b')]);logger[_0x8668('0x13')](_0x8668('0x18'),_0x56c4e1,JSON['stringify'](_0x20d54e));_0x50aac2(_0x20d54e);})['catch'](function(_0x31140d){logger[_0x8668('0x10')](_0x8668('0x18'),_0x31140d['message'],_0x56c4e1);_0x57a776(_0x3c6165[_0x8668('0x10')](0x1f4,_0x31140d['message']));});});};exports[_0x8668('0x1c')]=function(_0x1068dc){var _0xf2c201=this;return new Promise(function(_0x4f618f,_0x1c33a8){return db[_0x8668('0x4')][_0x8668('0x1d')]({'where':_0x1068dc[_0x8668('0x5')]?_0x1068dc[_0x8668('0x5')][_0x8668('0x7')]||null:null})[_0x8668('0x12')](function(_0x86b5ff){logger[_0x8668('0xd')](_0x8668('0x1c'),_0x1068dc);logger[_0x8668('0x13')](_0x8668('0x1c'),_0x1068dc,JSON[_0x8668('0xf')](_0x86b5ff));_0x4f618f(_0x86b5ff);})[_0x8668('0x17')](function(_0x5759ad){logger[_0x8668('0x10')](_0x8668('0x1c'),_0x5759ad[_0x8668('0x11')],_0x1068dc);_0x1c33a8(_0xf2c201['error'](0x1f4,_0x5759ad['message']));});});};exports[_0x8668('0x1e')]=function(_0x3fe241){var _0x1e6871=this;return new Promise(function(_0x10f571,_0x1c6b11){return db[_0x8668('0x1f')]['describe']()[_0x8668('0x12')](function(_0x1d88b9){return db['sequelize'][_0x8668('0x20')](function(_0x533163){return db[_0x8668('0x4')]['findAll']({'where':_0x3fe241[_0x8668('0x5')]?_0x3fe241[_0x8668('0x5')][_0x8668('0x7')]||null:null,'attributes':_0x3fe241[_0x8668('0x5')]?_0x3fe241[_0x8668('0x5')][_0x8668('0x8')]||null:null,'limit':_0x3fe241[_0x8668('0x5')]?_0x3fe241[_0x8668('0x5')][_0x8668('0x9')]||null:null,'order':_0x3fe241[_0x8668('0x5')]?_0x3fe241[_0x8668('0x5')][_0x8668('0x21')]||null:null,'transaction':_0x533163,'lock':_0x533163[_0x8668('0x22')]['UPDATE'],'include':[{'model':db[_0x8668('0x1f')],'as':_0x8668('0x23'),'attributes':_['keys'](_0x1d88b9)},{'model':db[_0x8668('0x24')],'as':_0x8668('0x25'),'attributes':['id','name','voicePause']}]})['then'](function(_0x1c31f1){var _0x446a2f=[];var _0x1e3452=[];for(var _0x15abef=0x0;_0x15abef<_0x1c31f1[_0x8668('0x26')];_0x15abef+=0x1){var _0x3320d0=_0x1c31f1[_0x15abef]['UserId'];if(_0x3320d0===null){_0x446a2f[_0x8668('0x27')](_0x1c31f1[_0x15abef][_0x8668('0x19')](_0x3fe241[_0x8668('0x16')],{'transaction':_0x533163}));}else if(!_0x1e3452[_0x8668('0x28')](_0x3320d0)){_0x1e3452['push'](_0x3320d0);_0x446a2f[_0x8668('0x27')](_0x1c31f1[_0x15abef][_0x8668('0x19')](_0x3fe241[_0x8668('0x16')],{'transaction':_0x533163}));}}return BPromise['all'](_0x446a2f);});})['then'](function(_0x38d7c5){logger['info']('GetContactDialer',_0x3fe241);if(_0x38d7c5[_0x8668('0x26')]>0x0){logger['info'](_0x8668('0x29'),_0x38d7c5[0x0][_0x8668('0x2a')]['id'],_0x38d7c5[0x0]['dataValues'][_0x8668('0x2b')],_0x38d7c5[0x0][_0x8668('0x2a')]['active']);}logger[_0x8668('0x13')](_0x8668('0x1e'),_0x3fe241,JSON['stringify'](_0x38d7c5));_0x10f571(_0x38d7c5);})[_0x8668('0x17')](function(_0x4144a6){logger[_0x8668('0x10')](_0x8668('0x1e'),_0x4144a6['message'],_0x3fe241);_0x1c6b11(_0x1e6871[_0x8668('0x10')](0x1f4,_0x4144a6[_0x8668('0x11')]));});});});};exports[_0x8668('0x2c')]=function(_0x1d5f50){var _0x47812b=this;return new Promise(function(_0x480bce,_0x3cf77d){return db[_0x8668('0x2d')][_0x8668('0x20')](function(_0x8a2b1f){return db[_0x8668('0x2e')][_0x8668('0x2f')](_0x1d5f50['body'],{'raw':_0x1d5f50[_0x8668('0x5')]?_0x1d5f50[_0x8668('0x5')][_0x8668('0x6')]===undefined?!![]:![]:!![],'transaction':_0x8a2b1f})[_0x8668('0x12')](function(){logger['info'](_0x8668('0x30'),JSON[_0x8668('0xf')](_0x1d5f50[_0x8668('0x5')][_0x8668('0x7')]),_0x1d5f50['options'][_0x8668('0x7')][_0x8668('0x1b')]);return db['CmHopper']['destroy']({'where':_0x1d5f50[_0x8668('0x5')]?_0x1d5f50[_0x8668('0x5')][_0x8668('0x7')]||null:null,'transaction':_0x8a2b1f});});})[_0x8668('0x12')](function(_0x2f9593){logger[_0x8668('0xd')](_0x8668('0x2c'),_0x1d5f50);logger[_0x8668('0x13')](_0x8668('0x2c'),_0x1d5f50,JSON[_0x8668('0xf')](_0x2f9593));_0x480bce(_0x2f9593);})[_0x8668('0x17')](function(_0x34fec8){logger['error'](_0x8668('0x2c'),_0x34fec8[_0x8668('0x11')],_0x1d5f50);_0x3cf77d(_0x47812b[_0x8668('0x10')](0x1f4,_0x34fec8[_0x8668('0x11')]));});});};exports[_0x8668('0x31')]=function(_0x501b55){var _0x5f204f=this;return new Promise(function(_0x1b730e,_0x5a55bf){return db[_0x8668('0x4')][_0x8668('0x32')]({'raw':_0x501b55[_0x8668('0x5')]?_0x501b55[_0x8668('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x501b55[_0x8668('0x5')]?_0x501b55['options']['where']||null:null,'attributes':[[db[_0x8668('0x2d')]['fn'](_0x8668('0x33'),db['sequelize']['fn']('IF',db[_0x8668('0x2d')][_0x8668('0x34')](_0x8668('0x35')+util[_0x8668('0x36')](_0x8668('0x37'),moment()[_0x8668('0x36')](_0x8668('0x38')))+_0x8668('0x39')))),_0x8668('0x3a')]]})['then'](function(_0x549fb){logger[_0x8668('0xd')](_0x8668('0x31'),_0x501b55);logger[_0x8668('0x13')](_0x8668('0x31'),_0x501b55,JSON[_0x8668('0xf')](_0x549fb));_0x1b730e(_0x549fb);})[_0x8668('0x17')](function(_0x4d05d8){logger[_0x8668('0x10')](_0x8668('0x31'),_0x4d05d8[_0x8668('0x11')],_0x501b55);_0x5a55bf(_0x5f204f[_0x8668('0x10')](0x1f4,_0x4d05d8[_0x8668('0x11')]));});});};exports['GetContactRecallMe']=function(_0x2bf78c){var _0x3bd3ae=this;return new Promise(function(_0x4e1a75,_0x10c69f){return db[_0x8668('0x1f')]['describe']()[_0x8668('0x12')](function(){return db[_0x8668('0x2d')]['transaction'](function(_0x4e226e){return db[_0x8668('0x4')][_0x8668('0x32')]({'where':_0x2bf78c[_0x8668('0x5')]?_0x2bf78c['options'][_0x8668('0x7')]||null:null,'attributes':_0x2bf78c[_0x8668('0x5')]?_0x2bf78c['options'][_0x8668('0x8')]||null:null,'limit':0x1,'order':_0x2bf78c[_0x8668('0x5')]?_0x2bf78c[_0x8668('0x5')]['order']||null:null,'group':db['CmHopper'][_0x8668('0x3b')],'transaction':_0x4e226e,'lock':_0x4e226e[_0x8668('0x22')][_0x8668('0x3c')],'include':_0x2bf78c[_0x8668('0x5')]?_0x2bf78c[_0x8668('0x5')]['include']?_[_0x8668('0xb')](_0x2bf78c[_0x8668('0x5')][_0x8668('0xa')],function(_0x25e84c){return{'model':db[_0x25e84c[_0x8668('0xc')]],'as':_0x25e84c['as'],'attributes':_0x25e84c[_0x8668('0x8')],'include':_0x25e84c[_0x8668('0xa')]?_[_0x8668('0xb')](_0x25e84c[_0x8668('0xa')],function(_0x156185){return{'model':db[_0x156185[_0x8668('0xc')]],'as':_0x156185['as'],'attributes':_0x156185[_0x8668('0x8')],'include':_0x156185[_0x8668('0xa')]?_[_0x8668('0xb')](_0x156185[_0x8668('0xa')],function(_0x3eb5fa){return{'model':db[_0x3eb5fa[_0x8668('0xc')]],'as':_0x3eb5fa['as'],'attributes':_0x3eb5fa[_0x8668('0x8')]};}):[]};}):[]};}):[]:[]})[_0x8668('0x12')](function(_0x2bca25){var _0x2e946b=[];for(var _0x4d937a=0x0;_0x4d937a<_0x2bca25[_0x8668('0x26')];_0x4d937a+=0x1){_0x2e946b[_0x8668('0x27')](_0x2bca25[_0x4d937a][_0x8668('0x19')](_0x2bf78c[_0x8668('0x16')],{'transaction':_0x4e226e}));}return BPromise[_0x8668('0x3d')](_0x2e946b);});})[_0x8668('0x12')](function(_0x16bf89){logger[_0x8668('0xd')]('GetContactRecallMe',_0x2bf78c);logger[_0x8668('0x13')]('GetContactRecallMe',_0x2bf78c,JSON[_0x8668('0xf')](_0x16bf89));_0x4e1a75(_0x16bf89);})[_0x8668('0x17')](function(_0x279ff7){logger['error'](_0x8668('0x3e'),_0x279ff7[_0x8668('0x11')],_0x2bf78c);_0x10c69f(_0x3bd3ae[_0x8668('0x10')](0x1f4,_0x279ff7['message']));});});});};exports[_0x8668('0x3f')]=function(_0x3dfa65){var _0x49ca91=this;return new Promise(function(_0x404c78,_0x333ba2){db[_0x8668('0x1f')][_0x8668('0x40')]()['then'](function(_0x505b54){return db[_0x8668('0x4')]['findAll']({'raw':_0x3dfa65[_0x8668('0x5')]?_0x3dfa65[_0x8668('0x5')][_0x8668('0x6')]===undefined?!![]:![]:!![],'where':_0x3dfa65[_0x8668('0x5')]?_0x3dfa65['options'][_0x8668('0x7')]||null:null,'attributes':_0x3dfa65[_0x8668('0x5')]?_0x3dfa65['options'][_0x8668('0x8')]||null:null,'limit':_0x3dfa65[_0x8668('0x5')]?_0x3dfa65['options'][_0x8668('0x9')]||null:null,'include':_0x3dfa65['options']?_0x3dfa65['options'][_0x8668('0xa')]?_[_0x8668('0xb')](_0x3dfa65[_0x8668('0x5')][_0x8668('0xa')],function(_0x447c0a){return{'model':db[_0x447c0a[_0x8668('0xc')]],'as':_0x447c0a['as'],'attributes':_0x447c0a['as']===_0x8668('0x23')?_[_0x8668('0x41')](_0x505b54):_0x447c0a[_0x8668('0x8')],'include':_0x447c0a[_0x8668('0xa')]?_[_0x8668('0xb')](_0x447c0a['include'],function(_0x249eca){return{'model':db[_0x249eca[_0x8668('0xc')]],'as':_0x249eca['as'],'attributes':_0x249eca[_0x8668('0x8')],'include':_0x249eca['include']?_['map'](_0x249eca[_0x8668('0xa')],function(_0x1def5f){return{'model':db[_0x1def5f[_0x8668('0xc')]],'as':_0x1def5f['as'],'attributes':_0x1def5f['attributes']};}):[]};}):[]};}):[]:[]})[_0x8668('0x12')](function(_0x370e65){logger[_0x8668('0xd')](_0x8668('0xe'),_0x3dfa65);logger[_0x8668('0x13')]('GetCmHopper',_0x3dfa65,JSON['stringify'](_0x370e65));_0x404c78(_0x370e65);})[_0x8668('0x17')](function(_0x46f685){logger[_0x8668('0x10')](_0x8668('0xe'),_0x46f685[_0x8668('0x11')],_0x3dfa65);_0x333ba2(_0x49ca91[_0x8668('0x10')](0x1f4,_0x46f685[_0x8668('0x11')]));});});});};exports['GetContactByPhone']=function(_0x415cd9){var _0x39637a=this;return new Promise(function(_0x3e1480,_0x40b643){return db[_0x8668('0x1f')][_0x8668('0x42')]({'raw':!![],'where':{'phone':_0x415cd9['options']['where'][_0x8668('0x43')]},'attributes':['id','dialTimezone'],'order':[['id',_0x8668('0x44')]]})[_0x8668('0x12')](function(_0x22c88f){logger['info'](_0x8668('0x45'),_0x415cd9);logger[_0x8668('0x13')]('getContactByPhone',_0x415cd9,JSON[_0x8668('0xf')](_0x22c88f));_0x3e1480(_0x22c88f);})[_0x8668('0x17')](function(_0x47b605){logger['error']('getContactByPhone',_0x47b605[_0x8668('0x11')],_0x415cd9);_0x40b643(_0x39637a[_0x8668('0x10')](0x1f4,_0x47b605[_0x8668('0x11')]));});});};exports[_0x8668('0x46')]=function(_0x161979){var _0x4b7c29=this;return new Promise(function(_0x41a8b9,_0x500953){return db[_0x8668('0x2d')][_0x8668('0x20')](function(_0x6aff58){var _0x26bcdc=_0x161979[_0x8668('0x5')]&&_0x161979['options'][_0x8668('0x7')]?_0x161979[_0x8668('0x5')]['where']:{};return db[_0x8668('0x4')]['update'](_0x161979['body'],{'where':_0x26bcdc,'transaction':_0x6aff58})['then'](function(_0x5720d3){logger[_0x8668('0xd')]('ResetActiveCalls',_0x161979);logger[_0x8668('0x13')](_0x8668('0x46'),_0x161979,JSON[_0x8668('0xf')](_0x5720d3));_0x41a8b9(_0x5720d3);})[_0x8668('0x17')](function(_0x2841cd){logger[_0x8668('0x10')](_0x8668('0x46'),_0x2841cd[_0x8668('0x11')],_0x161979);_0x500953(_0x4b7c29[_0x8668('0x10')](0x1f4,_0x2841cd[_0x8668('0x11')]));});});});};exports[_0x8668('0x47')]=function(_0x303d9c){var _0x5ec8b5=this;var _0x2d4960=_0x303d9c[_0x8668('0x16')]['where']['voiceQueueIds'];var _0x22bd7f=_0x303d9c[_0x8668('0x16')][_0x8668('0x7')][_0x8668('0x48')];var _0x59ab65=_0x303d9c[_0x8668('0x16')][_0x8668('0x7')][_0x8668('0x49')];return new Promise(function(_0x50c251,_0x2429bb){return db['CmHopper'][_0x8668('0x32')]({'where':{'voiceQueueId':{'$in':_0x2d4960},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0x8668('0x4a')+_0x22bd7f+_0x8668('0x4b')),'$gt':db[_0x8668('0x2d')][_0x8668('0x34')](_0x8668('0x4c'))}},'UserId':{'$in':_0x59ab65}},'include':[{'model':db[_0x8668('0x1f')],'as':_0x8668('0x23')},{'model':db[_0x8668('0x24')],'as':_0x8668('0x25'),'attributes':['id',_0x8668('0x4d'),_0x8668('0x4e')]},{'model':db[_0x8668('0x4f')],'as':'List'}]})[_0x8668('0x12')](function(_0x420d2d){if(_0x420d2d[_0x8668('0x26')]>0x0){return db['sequelize']['transaction'](function(_0x119a30){return db['CmHopper'][_0x8668('0x19')]({'recallmeNotifiedDate':db[_0x8668('0x2d')]['literal']('NOW()')},{'where':{'id':{'$in':_[_0x8668('0xb')](_0x420d2d,'id')}},'transaction':_0x119a30})['then'](function(){_0x50c251(_0x420d2d);})[_0x8668('0x17')](function(_0x41d3d4){logger['error'](_0x8668('0x47'),_0x41d3d4[_0x8668('0x11')],_0x303d9c);_0x2429bb(_0x5ec8b5['error'](0x1f4,_0x41d3d4[_0x8668('0x11')]));});})[_0x8668('0x17')](function(_0x54cf8e){logger[_0x8668('0x10')](_0x8668('0x47'),_0x54cf8e['message'],_0x303d9c);_0x2429bb(_0x5ec8b5['error'](0x1f4,_0x54cf8e[_0x8668('0x11')]));});}else{_0x50c251(_0x420d2d);}});});}; \ No newline at end of file +var _0x8ae9=['raw','attributes','limit','include','model','map','then','debug','stringify','message','error','find','info','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','where','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','catch','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','UPDATE','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','order','LOCK','GetCmHopperPreview','Contact','GetContactByPhone','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','CmList','List','lodash','util','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options'];(function(_0xa052d4,_0x88006f){var _0x3f56b9=function(_0x5554d7){while(--_0x5554d7){_0xa052d4['push'](_0xa052d4['shift']());}};_0x3f56b9(++_0x88006f);}(_0x8ae9,0x179));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x98ae('0x0'));var util=require(_0x98ae('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x98ae('0x2'))(_0x98ae('0x3'));exports[_0x98ae('0x4')]=function(_0x5a6b34){var _0x4eea43=this;return new Promise(function(_0x1423b7,_0x45d5ad){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'raw':_0x5a6b34['options']?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')]['where']||null:null,'attributes':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0xa')]||null:null,'include':_0x5a6b34[_0x98ae('0x7')]?_0x5a6b34[_0x98ae('0x7')][_0x98ae('0xb')]?_['map'](_0x5a6b34[_0x98ae('0x7')][_0x98ae('0xb')],function(_0x51918e){return{'model':db[_0x51918e[_0x98ae('0xc')]],'as':_0x51918e['as'],'attributes':_0x51918e[_0x98ae('0x9')],'include':_0x51918e[_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x51918e['include'],function(_0x3bb1e9){return{'model':db[_0x3bb1e9[_0x98ae('0xc')]],'as':_0x3bb1e9['as'],'attributes':_0x3bb1e9['attributes'],'include':_0x3bb1e9[_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x3bb1e9[_0x98ae('0xb')],function(_0x5e7578){return{'model':db[_0x5e7578[_0x98ae('0xc')]],'as':_0x5e7578['as'],'attributes':_0x5e7578['attributes']};}):[]};}):[]};}):[]:[]})[_0x98ae('0xe')](function(_0x530b86){logger['info'](_0x98ae('0x4'),_0x5a6b34);logger[_0x98ae('0xf')](_0x98ae('0x4'),_0x5a6b34,JSON[_0x98ae('0x10')](_0x530b86));_0x1423b7(_0x530b86);})['catch'](function(_0xb45dff){logger['error'](_0x98ae('0x4'),_0xb45dff[_0x98ae('0x11')],_0x5a6b34);_0x45d5ad(_0x4eea43[_0x98ae('0x12')](0x1f4,_0xb45dff['message']));});});};exports['ShowCmHopper']=function(_0x1f90c2){var _0x328382=this;return new Promise(function(_0x445ad0,_0x521314){return db[_0x98ae('0x5')][_0x98ae('0x13')]({'raw':_0x1f90c2[_0x98ae('0x7')]?_0x1f90c2['options'][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x1f90c2[_0x98ae('0x7')]?_0x1f90c2[_0x98ae('0x7')]['where']||null:null,'attributes':_0x1f90c2['options']?_0x1f90c2[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'include':_0x1f90c2[_0x98ae('0x7')]?_0x1f90c2['options'][_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x1f90c2[_0x98ae('0x7')]['include'],function(_0xe43740){return{'model':db[_0xe43740[_0x98ae('0xc')]],'as':_0xe43740['as'],'attributes':_0xe43740['attributes'],'include':_0xe43740['include']?_['map'](_0xe43740['include'],function(_0x3f308e){return{'model':db[_0x3f308e[_0x98ae('0xc')]],'as':_0x3f308e['as'],'attributes':_0x3f308e[_0x98ae('0x9')],'include':_0x3f308e[_0x98ae('0xb')]?_['map'](_0x3f308e['include'],function(_0x43b883){return{'model':db[_0x43b883[_0x98ae('0xc')]],'as':_0x43b883['as'],'attributes':_0x43b883[_0x98ae('0x9')]};}):[]};}):[]};}):[]:[]})[_0x98ae('0xe')](function(_0xd42fa){logger[_0x98ae('0x14')](_0x98ae('0x15'),_0x1f90c2);logger[_0x98ae('0xf')](_0x98ae('0x15'),_0x1f90c2,JSON[_0x98ae('0x10')](_0xd42fa));_0x445ad0(_0xd42fa);})['catch'](function(_0xbb54e){logger[_0x98ae('0x12')]('ShowCmHopper',_0xbb54e['message'],_0x1f90c2);_0x521314(_0x328382[_0x98ae('0x12')](0x1f4,_0xbb54e[_0x98ae('0x11')]));});});};exports[_0x98ae('0x16')]=function(_0x2a3950){var _0x3202b1=this;return new Promise(function(_0x3fa925,_0x2e8d6c){return db[_0x98ae('0x5')]['create'](_0x2a3950[_0x98ae('0x17')],{'raw':_0x2a3950[_0x98ae('0x7')]?_0x2a3950[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![]})[_0x98ae('0xe')](function(_0x278bdd){logger['info'](_0x98ae('0x16'),_0x2a3950);logger[_0x98ae('0xf')](_0x98ae('0x16'),_0x2a3950,JSON[_0x98ae('0x10')](_0x278bdd));_0x3fa925(_0x278bdd);})['catch'](function(_0x10cfcd){logger['error'](_0x98ae('0x16'),_0x10cfcd[_0x98ae('0x11')],_0x2a3950);_0x2e8d6c(_0x3202b1['error'](0x1f4,_0x10cfcd[_0x98ae('0x11')]));});});};exports[_0x98ae('0x18')]=function(_0x522c66){var _0x276d02=this;return new Promise(function(_0x2d7008,_0x5f290f){return db[_0x98ae('0x5')][_0x98ae('0x19')](_0x522c66[_0x98ae('0x17')],{'raw':_0x522c66[_0x98ae('0x7')]?_0x522c66[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x522c66[_0x98ae('0x7')]?_0x522c66['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x522c66[_0x98ae('0x7')]?_0x522c66['options'][_0x98ae('0x9')]||null:null,'limit':_0x522c66['options']?_0x522c66[_0x98ae('0x7')][_0x98ae('0xa')]||null:null})[_0x98ae('0xe')](function(_0xe0e73e){logger[_0x98ae('0x14')](_0x98ae('0x18'),_0x522c66);logger[_0x98ae('0x14')](_0x98ae('0x1b'),JSON[_0x98ae('0x10')](_0x522c66[_0x98ae('0x7')]['where']),_0x522c66[_0x98ae('0x17')][_0x98ae('0x1c')]);logger['debug'](_0x98ae('0x18'),_0x522c66,JSON['stringify'](_0xe0e73e));_0x2d7008(_0xe0e73e);})[_0x98ae('0x1d')](function(_0x597d8f){logger[_0x98ae('0x12')]('UpdateCmHopper',_0x597d8f[_0x98ae('0x11')],_0x522c66);_0x5f290f(_0x276d02[_0x98ae('0x12')](0x1f4,_0x597d8f[_0x98ae('0x11')]));});});};exports[_0x98ae('0x1e')]=function(_0x541730){var _0x3ddf84=this;return new Promise(function(_0x3f7d52,_0x5288fe){return db['CmHopper']['destroy']({'where':_0x541730['options']?_0x541730[_0x98ae('0x7')][_0x98ae('0x1a')]||null:null})[_0x98ae('0xe')](function(_0x481504){logger[_0x98ae('0x14')]('DestroyCmHopper',_0x541730);logger[_0x98ae('0xf')](_0x98ae('0x1e'),_0x541730,JSON[_0x98ae('0x10')](_0x481504));_0x3f7d52(_0x481504);})[_0x98ae('0x1d')](function(_0xeecc14){logger[_0x98ae('0x12')]('DestroyCmHopper',_0xeecc14[_0x98ae('0x11')],_0x541730);_0x5288fe(_0x3ddf84['error'](0x1f4,_0xeecc14[_0x98ae('0x11')]));});});};exports[_0x98ae('0x1f')]=function(_0x47c8ad){var _0x236a01=this;return new Promise(function(_0x11edaf,_0x9dbceb){return db[_0x98ae('0x20')][_0x98ae('0x21')]()[_0x98ae('0xe')](function(_0x105be9){return db[_0x98ae('0x22')][_0x98ae('0x23')](function(_0x37f9b1){return db[_0x98ae('0x5')]['findAll']({'where':_0x47c8ad[_0x98ae('0x7')]?_0x47c8ad['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x47c8ad[_0x98ae('0x7')]?_0x47c8ad[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':_0x47c8ad[_0x98ae('0x7')]?_0x47c8ad[_0x98ae('0x7')][_0x98ae('0xa')]||null:null,'order':_0x47c8ad['options']?_0x47c8ad[_0x98ae('0x7')]['order']||null:null,'transaction':_0x37f9b1,'lock':_0x37f9b1['LOCK'][_0x98ae('0x24')],'include':[{'model':db[_0x98ae('0x20')],'as':'Contact','attributes':_[_0x98ae('0x25')](_0x105be9)},{'model':db[_0x98ae('0x26')],'as':_0x98ae('0x27'),'attributes':['id',_0x98ae('0x28'),_0x98ae('0x29')]}]})['then'](function(_0x5166e1){var _0x565627=[];var _0x40ea49=[];for(var _0x285394=0x0;_0x285394<_0x5166e1[_0x98ae('0x2a')];_0x285394+=0x1){var _0x1408c6=_0x5166e1[_0x285394][_0x98ae('0x2b')];if(_0x1408c6===null){_0x565627[_0x98ae('0x2c')](_0x5166e1[_0x285394][_0x98ae('0x19')](_0x47c8ad[_0x98ae('0x17')],{'transaction':_0x37f9b1}));}else if(!_0x40ea49[_0x98ae('0x2d')](_0x1408c6)){_0x40ea49[_0x98ae('0x2c')](_0x1408c6);_0x565627[_0x98ae('0x2c')](_0x5166e1[_0x285394][_0x98ae('0x19')](_0x47c8ad['body'],{'transaction':_0x37f9b1}));}}return BPromise[_0x98ae('0x2e')](_0x565627);});})['then'](function(_0x3b8cda){logger[_0x98ae('0x14')](_0x98ae('0x1f'),_0x47c8ad);if(_0x3b8cda[_0x98ae('0x2a')]>0x0){logger[_0x98ae('0x14')](_0x98ae('0x2f'),_0x3b8cda[0x0][_0x98ae('0x30')]['id'],_0x3b8cda[0x0][_0x98ae('0x30')][_0x98ae('0x31')],_0x3b8cda[0x0][_0x98ae('0x30')][_0x98ae('0x1c')]);}logger[_0x98ae('0xf')](_0x98ae('0x1f'),_0x47c8ad,JSON[_0x98ae('0x10')](_0x3b8cda));_0x11edaf(_0x3b8cda);})['catch'](function(_0x4a8c41){logger[_0x98ae('0x12')](_0x98ae('0x1f'),_0x4a8c41[_0x98ae('0x11')],_0x47c8ad);_0x9dbceb(_0x236a01[_0x98ae('0x12')](0x1f4,_0x4a8c41[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x32')]=function(_0x1ea1de){var _0x400477=this;return new Promise(function(_0x370072,_0x18b1cc){return db[_0x98ae('0x22')][_0x98ae('0x23')](function(_0x204b9c){return db[_0x98ae('0x33')][_0x98ae('0x34')](_0x1ea1de[_0x98ae('0x17')],{'raw':_0x1ea1de[_0x98ae('0x7')]?_0x1ea1de[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'transaction':_0x204b9c})[_0x98ae('0xe')](function(){logger[_0x98ae('0x14')](_0x98ae('0x35'),JSON[_0x98ae('0x10')](_0x1ea1de[_0x98ae('0x7')][_0x98ae('0x1a')]),_0x1ea1de[_0x98ae('0x7')]['where'][_0x98ae('0x1c')]);return db['CmHopper']['destroy']({'where':_0x1ea1de[_0x98ae('0x7')]?_0x1ea1de[_0x98ae('0x7')][_0x98ae('0x1a')]||null:null,'transaction':_0x204b9c});});})['then'](function(_0x59656a){logger[_0x98ae('0x14')]('MoveContactManagedDialer',_0x1ea1de);logger[_0x98ae('0xf')](_0x98ae('0x32'),_0x1ea1de,JSON[_0x98ae('0x10')](_0x59656a));_0x370072(_0x59656a);})[_0x98ae('0x1d')](function(_0x40eacb){logger[_0x98ae('0x12')](_0x98ae('0x32'),_0x40eacb[_0x98ae('0x11')],_0x1ea1de);_0x18b1cc(_0x400477['error'](0x1f4,_0x40eacb[_0x98ae('0x11')]));});});};exports[_0x98ae('0x36')]=function(_0x3a723a){var _0x4f007d=this;return new Promise(function(_0xb58176,_0xab8d04){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'raw':_0x3a723a[_0x98ae('0x7')]?_0x3a723a[_0x98ae('0x7')][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x3a723a['options']?_0x3a723a['options'][_0x98ae('0x1a')]||null:null,'attributes':[[db[_0x98ae('0x22')]['fn'](_0x98ae('0x37'),db[_0x98ae('0x22')]['fn']('IF',db[_0x98ae('0x22')][_0x98ae('0x38')]('`scheduledat`\x20>=\x20'+util['format'](_0x98ae('0x39'),moment()[_0x98ae('0x3a')](_0x98ae('0x3b')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x98ae('0xe')](function(_0x57e0ab){logger['info'](_0x98ae('0x36'),_0x3a723a);logger[_0x98ae('0xf')]('CountReScheduled',_0x3a723a,JSON['stringify'](_0x57e0ab));_0xb58176(_0x57e0ab);})[_0x98ae('0x1d')](function(_0xc04a27){logger[_0x98ae('0x12')](_0x98ae('0x36'),_0xc04a27['message'],_0x3a723a);_0xab8d04(_0x4f007d[_0x98ae('0x12')](0x1f4,_0xc04a27[_0x98ae('0x11')]));});});};exports[_0x98ae('0x3c')]=function(_0x18041a){var _0xe088f5=this;return new Promise(function(_0x24b5f7,_0x5cb7eb){return db['CmContact'][_0x98ae('0x21')]()[_0x98ae('0xe')](function(){return db['sequelize']['transaction'](function(_0xe9a5f1){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'where':_0x18041a[_0x98ae('0x7')]?_0x18041a['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x18041a['options']?_0x18041a[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':0x1,'order':_0x18041a[_0x98ae('0x7')]?_0x18041a['options'][_0x98ae('0x3d')]||null:null,'group':db[_0x98ae('0x5')][_0x98ae('0x2b')],'transaction':_0xe9a5f1,'lock':_0xe9a5f1[_0x98ae('0x3e')][_0x98ae('0x24')],'include':_0x18041a[_0x98ae('0x7')]?_0x18041a[_0x98ae('0x7')][_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x18041a[_0x98ae('0x7')][_0x98ae('0xb')],function(_0x5e1dc8){return{'model':db[_0x5e1dc8[_0x98ae('0xc')]],'as':_0x5e1dc8['as'],'attributes':_0x5e1dc8[_0x98ae('0x9')],'include':_0x5e1dc8['include']?_[_0x98ae('0xd')](_0x5e1dc8[_0x98ae('0xb')],function(_0xe6929e){return{'model':db[_0xe6929e[_0x98ae('0xc')]],'as':_0xe6929e['as'],'attributes':_0xe6929e[_0x98ae('0x9')],'include':_0xe6929e['include']?_[_0x98ae('0xd')](_0xe6929e['include'],function(_0x1eeed6){return{'model':db[_0x1eeed6[_0x98ae('0xc')]],'as':_0x1eeed6['as'],'attributes':_0x1eeed6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x533e8a){var _0x3649e7=[];for(var _0x28cd72=0x0;_0x28cd72<_0x533e8a[_0x98ae('0x2a')];_0x28cd72+=0x1){_0x3649e7[_0x98ae('0x2c')](_0x533e8a[_0x28cd72][_0x98ae('0x19')](_0x18041a[_0x98ae('0x17')],{'transaction':_0xe9a5f1}));}return BPromise['all'](_0x3649e7);});})[_0x98ae('0xe')](function(_0x5be3c5){logger[_0x98ae('0x14')](_0x98ae('0x3c'),_0x18041a);logger[_0x98ae('0xf')](_0x98ae('0x3c'),_0x18041a,JSON[_0x98ae('0x10')](_0x5be3c5));_0x24b5f7(_0x5be3c5);})[_0x98ae('0x1d')](function(_0xa35669){logger[_0x98ae('0x12')](_0x98ae('0x3c'),_0xa35669[_0x98ae('0x11')],_0x18041a);_0x5cb7eb(_0xe088f5[_0x98ae('0x12')](0x1f4,_0xa35669[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x3f')]=function(_0x4400a8){var _0x3e950e=this;return new Promise(function(_0x3befa4,_0x4ba27d){db[_0x98ae('0x20')][_0x98ae('0x21')]()['then'](function(_0x5edef4){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'raw':_0x4400a8[_0x98ae('0x7')]?_0x4400a8['options'][_0x98ae('0x8')]===undefined?!![]:![]:!![],'where':_0x4400a8[_0x98ae('0x7')]?_0x4400a8['options'][_0x98ae('0x1a')]||null:null,'attributes':_0x4400a8[_0x98ae('0x7')]?_0x4400a8[_0x98ae('0x7')][_0x98ae('0x9')]||null:null,'limit':_0x4400a8[_0x98ae('0x7')]?_0x4400a8['options'][_0x98ae('0xa')]||null:null,'include':_0x4400a8[_0x98ae('0x7')]?_0x4400a8[_0x98ae('0x7')]['include']?_[_0x98ae('0xd')](_0x4400a8['options'][_0x98ae('0xb')],function(_0x3cf593){return{'model':db[_0x3cf593['model']],'as':_0x3cf593['as'],'attributes':_0x3cf593['as']===_0x98ae('0x40')?_[_0x98ae('0x25')](_0x5edef4):_0x3cf593[_0x98ae('0x9')],'include':_0x3cf593[_0x98ae('0xb')]?_[_0x98ae('0xd')](_0x3cf593[_0x98ae('0xb')],function(_0x532386){return{'model':db[_0x532386[_0x98ae('0xc')]],'as':_0x532386['as'],'attributes':_0x532386[_0x98ae('0x9')],'include':_0x532386['include']?_[_0x98ae('0xd')](_0x532386[_0x98ae('0xb')],function(_0x5f789){return{'model':db[_0x5f789[_0x98ae('0xc')]],'as':_0x5f789['as'],'attributes':_0x5f789[_0x98ae('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x596930){logger['info'](_0x98ae('0x4'),_0x4400a8);logger['debug'](_0x98ae('0x4'),_0x4400a8,JSON[_0x98ae('0x10')](_0x596930));_0x3befa4(_0x596930);})[_0x98ae('0x1d')](function(_0x2ca8c5){logger[_0x98ae('0x12')](_0x98ae('0x4'),_0x2ca8c5['message'],_0x4400a8);_0x4ba27d(_0x3e950e[_0x98ae('0x12')](0x1f4,_0x2ca8c5[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x41')]=function(_0x76aade){var _0x33d14f=this;return new Promise(function(_0x3502e2,_0x5de92d){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x76aade[_0x98ae('0x7')][_0x98ae('0x1a')][_0x98ae('0x42')]},'attributes':['id',_0x98ae('0x43')],'order':[['id','DESC']]})['then'](function(_0x20e1dd){logger[_0x98ae('0x14')]('getContactByPhone',_0x76aade);logger[_0x98ae('0xf')](_0x98ae('0x44'),_0x76aade,JSON[_0x98ae('0x10')](_0x20e1dd));_0x3502e2(_0x20e1dd);})[_0x98ae('0x1d')](function(_0x5b0f80){logger[_0x98ae('0x12')](_0x98ae('0x44'),_0x5b0f80[_0x98ae('0x11')],_0x76aade);_0x5de92d(_0x33d14f[_0x98ae('0x12')](0x1f4,_0x5b0f80[_0x98ae('0x11')]));});});};exports[_0x98ae('0x45')]=function(_0x53ad1b){var _0x2d5c84=this;return new Promise(function(_0x4e8699,_0x1fb64d){return db[_0x98ae('0x22')]['transaction'](function(_0x350256){var _0x503e42=_0x53ad1b[_0x98ae('0x7')]&&_0x53ad1b[_0x98ae('0x7')][_0x98ae('0x1a')]?_0x53ad1b[_0x98ae('0x7')][_0x98ae('0x1a')]:{};return db[_0x98ae('0x5')][_0x98ae('0x19')](_0x53ad1b[_0x98ae('0x17')],{'where':_0x503e42,'transaction':_0x350256})[_0x98ae('0xe')](function(_0x4c168a){logger[_0x98ae('0x14')]('ResetActiveCalls',_0x53ad1b);logger[_0x98ae('0xf')](_0x98ae('0x45'),_0x53ad1b,JSON[_0x98ae('0x10')](_0x4c168a));_0x4e8699(_0x4c168a);})[_0x98ae('0x1d')](function(_0x12de87){logger[_0x98ae('0x12')]('ResetActiveCalls',_0x12de87['message'],_0x53ad1b);_0x1fb64d(_0x2d5c84[_0x98ae('0x12')](0x1f4,_0x12de87[_0x98ae('0x11')]));});});});};exports[_0x98ae('0x46')]=function(_0xca7086){var _0x534e8d=this;var _0x4e35fc=_0xca7086[_0x98ae('0x17')][_0x98ae('0x1a')][_0x98ae('0x47')];var _0x42d13f=_0xca7086[_0x98ae('0x17')][_0x98ae('0x1a')][_0x98ae('0x48')];var _0x1e0269=_0xca7086[_0x98ae('0x17')][_0x98ae('0x1a')][_0x98ae('0x49')];return new Promise(function(_0x35f7c3,_0xb1ad0d){return db[_0x98ae('0x5')][_0x98ae('0x6')]({'where':{'voiceQueueId':{'$in':_0x4e35fc},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x98ae('0x22')][_0x98ae('0x38')](_0x98ae('0x4a')+_0x42d13f+'\x20MINUTE'),'$gt':db[_0x98ae('0x22')]['literal']('NOW()')}},'UserId':{'$in':_0x1e0269}},'include':[{'model':db['CmContact'],'as':_0x98ae('0x40')},{'model':db[_0x98ae('0x26')],'as':_0x98ae('0x27'),'attributes':['id',_0x98ae('0x28'),_0x98ae('0x29')]},{'model':db[_0x98ae('0x4b')],'as':_0x98ae('0x4c')}]})[_0x98ae('0xe')](function(_0x53dc96){if(_0x53dc96[_0x98ae('0x2a')]>0x0){return db[_0x98ae('0x22')]['transaction'](function(_0x55dcac){return db[_0x98ae('0x5')][_0x98ae('0x19')]({'recallmeNotifiedDate':db[_0x98ae('0x22')][_0x98ae('0x38')]('NOW()')},{'where':{'id':{'$in':_[_0x98ae('0xd')](_0x53dc96,'id')}},'transaction':_0x55dcac})[_0x98ae('0xe')](function(){_0x35f7c3(_0x53dc96);})['catch'](function(_0x5be4bc){logger[_0x98ae('0x12')](_0x98ae('0x46'),_0x5be4bc[_0x98ae('0x11')],_0xca7086);_0xb1ad0d(_0x534e8d[_0x98ae('0x12')](0x1f4,_0x5be4bc[_0x98ae('0x11')]));});})[_0x98ae('0x1d')](function(_0x350f22){logger['error'](_0x98ae('0x46'),_0x350f22['message'],_0xca7086);_0xb1ad0d(_0x534e8d[_0x98ae('0x12')](0x1f4,_0x350f22['message']));});}else{_0x35f7c3(_0x53dc96);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 1cbfeb9..ec1cd74 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 _0xa0a2=['getTimezones','/:id','show','getPreviewRecall','create','/preview','getPreview','post','/timezone','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','describe','getOpenContacts','/timezones'];(function(_0x4580b0,_0x1f3173){var _0x5464f6=function(_0xbf5a05){while(--_0xbf5a05){_0x4580b0['push'](_0x4580b0['shift']());}};_0x5464f6(++_0x1f3173);}(_0xa0a2,0xf0));var _0x2a0a=function(_0x244862,_0x3da79e){_0x244862=_0x244862-0x0;var _0x2bce23=_0xa0a2[_0x244862];return _0x2bce23;};'use strict';var express=require(_0x2a0a('0x0'));var router=express[_0x2a0a('0x1')]();var auth=require(_0x2a0a('0x2'));var controller=require(_0x2a0a('0x3'));router[_0x2a0a('0x4')]('/',auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x6')]);router[_0x2a0a('0x4')]('/describe',auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x7')]);router['get']('/opencontacts',auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x8')]);router[_0x2a0a('0x4')](_0x2a0a('0x9'),auth[_0x2a0a('0x5')](),controller[_0x2a0a('0xa')]);router['get'](_0x2a0a('0xb'),auth[_0x2a0a('0x5')](),controller[_0x2a0a('0xc')]);router[_0x2a0a('0x4')]('/:id/previewrecall',auth[_0x2a0a('0x5')](),controller[_0x2a0a('0xd')]);router['post']('/',auth[_0x2a0a('0x5')](),controller[_0x2a0a('0xe')]);router['post'](_0x2a0a('0xf'),auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x10')]);router[_0x2a0a('0x11')](_0x2a0a('0x12'),auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x13')]);router[_0x2a0a('0x14')](_0x2a0a('0xb'),auth[_0x2a0a('0x5')](),controller[_0x2a0a('0x15')]);router[_0x2a0a('0x16')](_0x2a0a('0xb'),auth['isAuthenticated'](),controller[_0x2a0a('0x17')]);module[_0x2a0a('0x18')]=router; \ No newline at end of file +var _0x39cc=['getPreviewRecall','post','getPreview','/timezone','getTimezone','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getTimezones','/:id','show','/:id/previewrecall'];(function(_0x534e8b,_0x1f8fd9){var _0x5542cc=function(_0x1f31f2){while(--_0x1f31f2){_0x534e8b['push'](_0x534e8b['shift']());}};_0x5542cc(++_0x1f8fd9);}(_0x39cc,0x195));var _0xc39c=function(_0x9ca3a,_0x236fdb){_0x9ca3a=_0x9ca3a-0x0;var _0x14a0ca=_0x39cc[_0x9ca3a];return _0x14a0ca;};'use strict';var express=require(_0xc39c('0x0'));var router=express[_0xc39c('0x1')]();var auth=require(_0xc39c('0x2'));var controller=require(_0xc39c('0x3'));router[_0xc39c('0x4')]('/',auth[_0xc39c('0x5')](),controller['index']);router[_0xc39c('0x4')](_0xc39c('0x6'),auth[_0xc39c('0x5')](),controller[_0xc39c('0x7')]);router[_0xc39c('0x4')](_0xc39c('0x8'),auth[_0xc39c('0x5')](),controller['getOpenContacts']);router['get']('/timezones',auth['isAuthenticated'](),controller[_0xc39c('0x9')]);router['get'](_0xc39c('0xa'),auth[_0xc39c('0x5')](),controller[_0xc39c('0xb')]);router[_0xc39c('0x4')](_0xc39c('0xc'),auth[_0xc39c('0x5')](),controller[_0xc39c('0xd')]);router[_0xc39c('0xe')]('/',auth[_0xc39c('0x5')](),controller['create']);router[_0xc39c('0xe')]('/preview',auth[_0xc39c('0x5')](),controller[_0xc39c('0xf')]);router[_0xc39c('0xe')](_0xc39c('0x10'),auth[_0xc39c('0x5')](),controller[_0xc39c('0x11')]);router['put'](_0xc39c('0xa'),auth[_0xc39c('0x5')](),controller[_0xc39c('0x12')]);router[_0xc39c('0x13')](_0xc39c('0xa'),auth['isAuthenticated'](),controller[_0xc39c('0x14')]);module[_0xc39c('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 8631c07..1937511 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 _0x2510=['INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x2510,0x107));var _0x0251=function(_0x514023,_0x38130f){_0x514023=_0x514023-0x0;var _0xc952d6=_0x2510[_0x514023];return _0xc952d6;};'use strict';var moment=require(_0x0251('0x0'));var Sequelize=require(_0x0251('0x1'));module[_0x0251('0x2')]={'CmHopperId':{'type':Sequelize[_0x0251('0x3')]},'phone':{'type':Sequelize[_0x0251('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0251('0x5')],'defaultValue':moment()['format'](_0x0251('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0251('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a40=['sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','moment'];(function(_0x497a9d,_0x1ae5df){var _0x22b092=function(_0x797d63){while(--_0x797d63){_0x497a9d['push'](_0x497a9d['shift']());}};_0x22b092(++_0x1ae5df);}(_0x6a40,0x1c7));var _0x06a4=function(_0xd8ae9,_0x46e1cf){_0xd8ae9=_0xd8ae9-0x0;var _0x5b9de5=_0x6a40[_0xd8ae9];return _0x5b9de5;};'use strict';var moment=require(_0x06a4('0x0'));var Sequelize=require(_0x06a4('0x1'));module[_0x06a4('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x06a4('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x06a4('0x4')],'defaultValue':moment()[_0x06a4('0x5')](_0x06a4('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x06a4('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x06a4('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x06a4('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x06a4('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 442d141..77a1f69 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 _0x7e2f=['bluebird','mustache','util','path','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/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','moment'];(function(_0x1fab0a,_0x111c1b){var _0x4c20a0=function(_0x4d5e0b){while(--_0x4d5e0b){_0x1fab0a['push'](_0x1fab0a['shift']());}};_0x4c20a0(++_0x111c1b);}(_0x7e2f,0x101));var _0xf7e2=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0x7e2f[_0x1486e5];return _0x29d89b;};'use strict';var emlformat=require(_0xf7e2('0x0'));var rimraf=require(_0xf7e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7e2('0x2'));var rp=require('request-promise');var moment=require(_0xf7e2('0x3'));var BPromise=require(_0xf7e2('0x4'));var Mustache=require(_0xf7e2('0x5'));var util=require(_0xf7e2('0x6'));var path=require(_0xf7e2('0x7'));var sox=require(_0xf7e2('0x8'));var csv=require(_0xf7e2('0x9'));var ejs=require(_0xf7e2('0xa'));var fs=require('fs');var fs_extra=require(_0xf7e2('0xb'));var _=require('lodash');var squel=require(_0xf7e2('0xc'));var crypto=require('crypto');var jsforce=require(_0xf7e2('0xd'));var deskjs=require(_0xf7e2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf7e2('0xf'));var Papa=require('papaparse');var Redis=require(_0xf7e2('0x10'));var authService=require(_0xf7e2('0x11'));var qs=require(_0xf7e2('0x12'));var as=require(_0xf7e2('0x13'));var hardwareService=require(_0xf7e2('0x14'));var logger=require(_0xf7e2('0x15'))(_0xf7e2('0x16'));var utils=require(_0xf7e2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf7e2('0x18'));var db=require(_0xf7e2('0x19'))['db'];function respondWithStatusCode(_0x164d07,_0x17ef18){_0x17ef18=_0x17ef18||0xcc;return function(_0x4b168d){if(_0x4b168d){return _0x164d07[_0xf7e2('0x1a')](_0x17ef18);}return _0x164d07[_0xf7e2('0x1b')](_0x17ef18)['end']();};}function respondWithResult(_0x47974f,_0x1a5b76){_0x1a5b76=_0x1a5b76||0xc8;return function(_0x253d46){if(_0x253d46){return _0x47974f[_0xf7e2('0x1b')](_0x1a5b76)[_0xf7e2('0x1c')](_0x253d46);}};}function respondWithFilteredResult(_0x3a0b7d,_0x169161){return function(_0x3e5211){if(_0x3e5211){var _0x2c3853=typeof _0x169161[_0xf7e2('0x1d')]==='undefined'&&typeof _0x169161['limit']===_0xf7e2('0x1e');var _0x16d9d0=_0x3e5211[_0xf7e2('0x1f')];var _0x9048d3=_0x2c3853?0x0:_0x169161[_0xf7e2('0x1d')];var _0x1f3c28=_0x2c3853?_0x3e5211[_0xf7e2('0x1f')]:_0x169161[_0xf7e2('0x1d')]+_0x169161[_0xf7e2('0x20')];var _0x210f3c;if(_0x1f3c28>=_0x16d9d0){_0x1f3c28=_0x16d9d0;_0x210f3c=0xc8;}else{_0x210f3c=0xce;}_0x3a0b7d[_0xf7e2('0x1b')](_0x210f3c);return _0x3a0b7d[_0xf7e2('0x21')](_0xf7e2('0x22'),_0x9048d3+'-'+_0x1f3c28+'/'+_0x16d9d0)[_0xf7e2('0x1c')](_0x3e5211);}return null;};}function patchUpdates(_0xece596){return function(_0x20a93f){try{jsonpatch[_0xf7e2('0x23')](_0x20a93f,_0xece596,!![]);}catch(_0xc9f814){return BPromise[_0xf7e2('0x24')](_0xc9f814);}return _0x20a93f['save']();};}function saveUpdates(_0x48cb99,_0x29114c){return function(_0x32e73f){if(_0x32e73f){return _0x32e73f[_0xf7e2('0x25')](_0x48cb99)[_0xf7e2('0x26')](function(_0x123fc6){return _0x123fc6;});}return null;};}function removeEntity(_0x7e8339,_0x48b805){return function(_0x512ed4){if(_0x512ed4){return _0x512ed4[_0xf7e2('0x27')]()[_0xf7e2('0x26')](function(){var _0x429a68=_0x512ed4[_0xf7e2('0x28')]({'plain':!![]});var _0x487d5a='CmHopperAdditionalPhones';return db['UserProfileResource'][_0xf7e2('0x27')]({'where':{'type':_0x487d5a,'resourceId':_0x429a68['id']}})[_0xf7e2('0x26')](function(){return _0x512ed4;});})[_0xf7e2('0x26')](function(){_0x7e8339[_0xf7e2('0x1b')](0xcc)[_0xf7e2('0x29')]();});}};}function handleEntityNotFound(_0x5899bb,_0x54bb3c){return function(_0x4ef1c7){if(!_0x4ef1c7){_0x5899bb['sendStatus'](0x194);}return _0x4ef1c7;};}function handleError(_0x27d193,_0x2922f1){_0x2922f1=_0x2922f1||0x1f4;return function(_0x352997){logger[_0xf7e2('0x2a')](_0x352997[_0xf7e2('0x2b')]);if(_0x352997[_0xf7e2('0x2c')]){delete _0x352997['name'];}_0x27d193[_0xf7e2('0x1b')](_0x2922f1)[_0xf7e2('0x2d')](_0x352997);};}exports[_0xf7e2('0x2e')]=function(_0x3e5d14,_0x54bce6){var _0x2f471d={},_0x26b6c8={},_0x5dcc97={'count':0x0,'rows':[]};var _0x4b8b88=_[_0xf7e2('0x2f')](db[_0xf7e2('0x30')]['rawAttributes'],function(_0x9a1db1){return{'name':_0x9a1db1[_0xf7e2('0x31')],'type':_0x9a1db1[_0xf7e2('0x32')][_0xf7e2('0x33')]};});_0x26b6c8[_0xf7e2('0x34')]=_[_0xf7e2('0x2f')](_0x4b8b88,_0xf7e2('0x2c'));_0x26b6c8['query']=_[_0xf7e2('0x35')](_0x3e5d14[_0xf7e2('0x36')]);_0x26b6c8[_0xf7e2('0x37')]=_[_0xf7e2('0x38')](_0x26b6c8[_0xf7e2('0x34')],_0x26b6c8[_0xf7e2('0x36')]);_0x2f471d[_0xf7e2('0x39')]=_['intersection'](_0x26b6c8['model'],qs[_0xf7e2('0x3a')](_0x3e5d14[_0xf7e2('0x36')]['fields']));_0x2f471d[_0xf7e2('0x39')]=_0x2f471d[_0xf7e2('0x39')][_0xf7e2('0x3b')]?_0x2f471d['attributes']:_0x26b6c8['model'];if(!_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x3c')](_0xf7e2('0x3d'))){_0x2f471d[_0xf7e2('0x20')]=qs['limit'](_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x20')]);_0x2f471d['offset']=qs['offset'](_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x1d')]);}_0x2f471d[_0xf7e2('0x3e')]=qs[_0xf7e2('0x3f')](_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x3f')]);_0x2f471d[_0xf7e2('0x40')]=qs[_0xf7e2('0x37')](_['pick'](_0x3e5d14[_0xf7e2('0x36')],_0x26b6c8['filters']),_0x4b8b88);if(_0x3e5d14['query'][_0xf7e2('0x41')]){_0x2f471d['where']=_['merge'](_0x2f471d['where'],{'$or':_['map'](_0x4b8b88,function(_0x4ddfea){if(_0x4ddfea['type']!==_0xf7e2('0x42')){var _0x59dc2f={};_0x59dc2f[_0x4ddfea[_0xf7e2('0x2c')]]={'$like':'%'+_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x41')]+'%'};return _0x59dc2f;}})});}_0x2f471d=_['merge']({},_0x2f471d,_0x3e5d14[_0xf7e2('0x43')]);var _0x1179f7={'where':_0x2f471d['where']};return db[_0xf7e2('0x30')]['count'](_0x1179f7)[_0xf7e2('0x26')](function(_0x29b491){_0x5dcc97[_0xf7e2('0x1f')]=_0x29b491;if(_0x3e5d14[_0xf7e2('0x36')][_0xf7e2('0x44')]){_0x2f471d[_0xf7e2('0x45')]=[{'all':!![]}];}return db[_0xf7e2('0x30')][_0xf7e2('0x46')](_0x2f471d);})[_0xf7e2('0x26')](function(_0x3979a2){_0x5dcc97[_0xf7e2('0x47')]=_0x3979a2;return _0x5dcc97;})[_0xf7e2('0x26')](respondWithFilteredResult(_0x54bce6,_0x2f471d))[_0xf7e2('0x48')](handleError(_0x54bce6,null));};exports['show']=function(_0x1cf358,_0x5dc3c2){var _0x31d0c7={'raw':!![],'where':{'id':_0x1cf358['params']['id']}},_0xb698c9={};_0xb698c9[_0xf7e2('0x34')]=_[_0xf7e2('0x35')](db[_0xf7e2('0x30')][_0xf7e2('0x49')]);_0xb698c9[_0xf7e2('0x36')]=_[_0xf7e2('0x35')](_0x1cf358[_0xf7e2('0x36')]);_0xb698c9[_0xf7e2('0x37')]=_[_0xf7e2('0x38')](_0xb698c9[_0xf7e2('0x34')],_0xb698c9[_0xf7e2('0x36')]);_0x31d0c7['attributes']=_['intersection'](_0xb698c9[_0xf7e2('0x34')],qs[_0xf7e2('0x3a')](_0x1cf358[_0xf7e2('0x36')][_0xf7e2('0x3a')]));_0x31d0c7['attributes']=_0x31d0c7[_0xf7e2('0x39')]['length']?_0x31d0c7[_0xf7e2('0x39')]:_0xb698c9['model'];if(_0x1cf358[_0xf7e2('0x36')]['includeAll']){_0x31d0c7[_0xf7e2('0x45')]=[{'all':!![]}];}_0x31d0c7=_['merge']({},_0x31d0c7,_0x1cf358[_0xf7e2('0x43')]);return db['CmHopperAdditionalPhone']['find'](_0x31d0c7)[_0xf7e2('0x26')](handleEntityNotFound(_0x5dc3c2,null))[_0xf7e2('0x26')](respondWithResult(_0x5dc3c2,null))[_0xf7e2('0x48')](handleError(_0x5dc3c2,null));};exports['create']=function(_0x3fd0b7,_0x4cc735){return db['CmHopperAdditionalPhone'][_0xf7e2('0x4a')](_0x3fd0b7['body'],{})['then'](function(_0x410aa5){var _0x115d98=_0x3fd0b7[_0xf7e2('0x4b')]['get']({'plain':!![]});if(!_0x115d98)throw new Error(_0xf7e2('0x4c'));if(_0x115d98[_0xf7e2('0x4d')]===_0xf7e2('0x4b')){var _0x5211cb=_0x410aa5[_0xf7e2('0x28')]({'plain':!![]});var _0x25d3e6=_0xf7e2('0x4e');return db[_0xf7e2('0x4f')][_0xf7e2('0x50')]({'where':{'name':_0x25d3e6,'userProfileId':_0x115d98[_0xf7e2('0x51')]},'raw':!![]})[_0xf7e2('0x26')](function(_0x3035b7){if(_0x3035b7&&_0x3035b7[_0xf7e2('0x52')]===0x0){return db[_0xf7e2('0x53')][_0xf7e2('0x4a')]({'name':_0x5211cb['name'],'resourceId':_0x5211cb['id'],'type':_0x3035b7[_0xf7e2('0x2c')],'sectionId':_0x3035b7['id']},{})[_0xf7e2('0x26')](function(){return _0x410aa5;});}else{return _0x410aa5;}})[_0xf7e2('0x48')](function(_0x493b92){logger[_0xf7e2('0x2a')](_0xf7e2('0x54'),_0x493b92);throw _0x493b92;});}return _0x410aa5;})['then'](respondWithResult(_0x4cc735,0xc9))['catch'](handleError(_0x4cc735,null));};exports[_0xf7e2('0x25')]=function(_0x50453e,_0x5d3b54){if(_0x50453e[_0xf7e2('0x55')]['id']){delete _0x50453e[_0xf7e2('0x55')]['id'];}return db[_0xf7e2('0x30')][_0xf7e2('0x50')]({'where':{'id':_0x50453e[_0xf7e2('0x56')]['id']}})['then'](handleEntityNotFound(_0x5d3b54,null))[_0xf7e2('0x26')](saveUpdates(_0x50453e[_0xf7e2('0x55')],null))[_0xf7e2('0x26')](respondWithResult(_0x5d3b54,null))[_0xf7e2('0x48')](handleError(_0x5d3b54,null));};exports[_0xf7e2('0x27')]=function(_0x1473e4,_0x2dc142){return db[_0xf7e2('0x30')]['find']({'where':{'id':_0x1473e4[_0xf7e2('0x56')]['id']}})[_0xf7e2('0x26')](handleEntityNotFound(_0x2dc142,null))[_0xf7e2('0x26')](removeEntity(_0x2dc142,null))[_0xf7e2('0x48')](handleError(_0x2dc142,null));}; \ No newline at end of file +var _0x766d=['Content-Range','apply','reject','save','update','destroy','then','CmHopperAdditionalPhones','error','stack','name','index','rawAttributes','fieldName','type','map','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset'];(function(_0x2480b5,_0x1899e9){var _0x108649=function(_0x205847){while(--_0x205847){_0x2480b5['push'](_0x2480b5['shift']());}};_0x108649(++_0x1899e9);}(_0x766d,0x1cd));var _0xd766=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x766d[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xd766('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd766('0x1'));var jsonpatch=require(_0xd766('0x2'));var rp=require('request-promise');var moment=require(_0xd766('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd766('0x4'));var util=require(_0xd766('0x5'));var path=require('path');var sox=require(_0xd766('0x6'));var csv=require(_0xd766('0x7'));var ejs=require(_0xd766('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd766('0x9'));var squel=require(_0xd766('0xa'));var crypto=require(_0xd766('0xb'));var jsforce=require(_0xd766('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd766('0x7'));var querystring=require(_0xd766('0xd'));var Papa=require(_0xd766('0xe'));var Redis=require(_0xd766('0xf'));var authService=require(_0xd766('0x10'));var qs=require(_0xd766('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd766('0x12'));var logger=require(_0xd766('0x13'))(_0xd766('0x14'));var utils=require(_0xd766('0x15'));var config=require(_0xd766('0x16'));var licenseUtil=require(_0xd766('0x17'));var db=require(_0xd766('0x18'))['db'];function respondWithStatusCode(_0x80c84d,_0x40cb66){_0x40cb66=_0x40cb66||0xcc;return function(_0x5e96a1){if(_0x5e96a1){return _0x80c84d['sendStatus'](_0x40cb66);}return _0x80c84d[_0xd766('0x19')](_0x40cb66)[_0xd766('0x1a')]();};}function respondWithResult(_0x260ab9,_0x349659){_0x349659=_0x349659||0xc8;return function(_0x5d4dc2){if(_0x5d4dc2){return _0x260ab9[_0xd766('0x19')](_0x349659)['json'](_0x5d4dc2);}};}function respondWithFilteredResult(_0x3edcef,_0x143cd9){return function(_0x31566e){if(_0x31566e){var _0x37f490=typeof _0x143cd9['offset']===_0xd766('0x1b')&&typeof _0x143cd9[_0xd766('0x1c')]===_0xd766('0x1b');var _0x13bab7=_0x31566e['count'];var _0x37dc55=_0x37f490?0x0:_0x143cd9['offset'];var _0xe4b2cb=_0x37f490?_0x31566e[_0xd766('0x1d')]:_0x143cd9[_0xd766('0x1e')]+_0x143cd9[_0xd766('0x1c')];var _0x2946f6;if(_0xe4b2cb>=_0x13bab7){_0xe4b2cb=_0x13bab7;_0x2946f6=0xc8;}else{_0x2946f6=0xce;}_0x3edcef[_0xd766('0x19')](_0x2946f6);return _0x3edcef['set'](_0xd766('0x1f'),_0x37dc55+'-'+_0xe4b2cb+'/'+_0x13bab7)['json'](_0x31566e);}return null;};}function patchUpdates(_0x5a3d17){return function(_0x59d961){try{jsonpatch[_0xd766('0x20')](_0x59d961,_0x5a3d17,!![]);}catch(_0x48e20d){return BPromise[_0xd766('0x21')](_0x48e20d);}return _0x59d961[_0xd766('0x22')]();};}function saveUpdates(_0x1e7d88,_0x190475){return function(_0x5ea7ad){if(_0x5ea7ad){return _0x5ea7ad[_0xd766('0x23')](_0x1e7d88)['then'](function(_0x4cda2d){return _0x4cda2d;});}return null;};}function removeEntity(_0x14381f,_0x478761){return function(_0x4d5c68){if(_0x4d5c68){return _0x4d5c68[_0xd766('0x24')]()[_0xd766('0x25')](function(){var _0x2ac2ba=_0x4d5c68['get']({'plain':!![]});var _0x200190=_0xd766('0x26');return db['UserProfileResource'][_0xd766('0x24')]({'where':{'type':_0x200190,'resourceId':_0x2ac2ba['id']}})[_0xd766('0x25')](function(){return _0x4d5c68;});})[_0xd766('0x25')](function(){_0x14381f[_0xd766('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19e139,_0x4930c9){return function(_0x24d9cc){if(!_0x24d9cc){_0x19e139['sendStatus'](0x194);}return _0x24d9cc;};}function handleError(_0x22b938,_0x1d4b60){_0x1d4b60=_0x1d4b60||0x1f4;return function(_0x5bb6f9){logger[_0xd766('0x27')](_0x5bb6f9[_0xd766('0x28')]);if(_0x5bb6f9[_0xd766('0x29')]){delete _0x5bb6f9[_0xd766('0x29')];}_0x22b938[_0xd766('0x19')](_0x1d4b60)['send'](_0x5bb6f9);};}exports[_0xd766('0x2a')]=function(_0x1258d1,_0x207b7c){var _0x5414c4={},_0x22b7ae={},_0xd5e833={'count':0x0,'rows':[]};var _0x1d51c3=_['map'](db['CmHopperAdditionalPhone'][_0xd766('0x2b')],function(_0x4c17ad){return{'name':_0x4c17ad[_0xd766('0x2c')],'type':_0x4c17ad[_0xd766('0x2d')]['key']};});_0x22b7ae['model']=_[_0xd766('0x2e')](_0x1d51c3,_0xd766('0x29'));_0x22b7ae[_0xd766('0x2f')]=_['keys'](_0x1258d1[_0xd766('0x2f')]);_0x22b7ae[_0xd766('0x30')]=_['intersection'](_0x22b7ae[_0xd766('0x31')],_0x22b7ae['query']);_0x5414c4[_0xd766('0x32')]=_[_0xd766('0x33')](_0x22b7ae[_0xd766('0x31')],qs[_0xd766('0x34')](_0x1258d1[_0xd766('0x2f')][_0xd766('0x34')]));_0x5414c4[_0xd766('0x32')]=_0x5414c4[_0xd766('0x32')][_0xd766('0x35')]?_0x5414c4[_0xd766('0x32')]:_0x22b7ae[_0xd766('0x31')];if(!_0x1258d1[_0xd766('0x2f')]['hasOwnProperty'](_0xd766('0x36'))){_0x5414c4['limit']=qs[_0xd766('0x1c')](_0x1258d1[_0xd766('0x2f')]['limit']);_0x5414c4[_0xd766('0x1e')]=qs['offset'](_0x1258d1[_0xd766('0x2f')]['offset']);}_0x5414c4[_0xd766('0x37')]=qs[_0xd766('0x38')](_0x1258d1[_0xd766('0x2f')]['sort']);_0x5414c4['where']=qs['filters'](_[_0xd766('0x39')](_0x1258d1[_0xd766('0x2f')],_0x22b7ae['filters']),_0x1d51c3);if(_0x1258d1[_0xd766('0x2f')][_0xd766('0x3a')]){_0x5414c4[_0xd766('0x3b')]=_[_0xd766('0x3c')](_0x5414c4[_0xd766('0x3b')],{'$or':_[_0xd766('0x2e')](_0x1d51c3,function(_0x27e488){if(_0x27e488[_0xd766('0x2d')]!==_0xd766('0x3d')){var _0xc42985={};_0xc42985[_0x27e488[_0xd766('0x29')]]={'$like':'%'+_0x1258d1[_0xd766('0x2f')][_0xd766('0x3a')]+'%'};return _0xc42985;}})});}_0x5414c4=_['merge']({},_0x5414c4,_0x1258d1[_0xd766('0x3e')]);var _0x4254df={'where':_0x5414c4[_0xd766('0x3b')]};return db[_0xd766('0x3f')][_0xd766('0x1d')](_0x4254df)[_0xd766('0x25')](function(_0x2d5549){_0xd5e833[_0xd766('0x1d')]=_0x2d5549;if(_0x1258d1[_0xd766('0x2f')][_0xd766('0x40')]){_0x5414c4[_0xd766('0x41')]=[{'all':!![]}];}return db[_0xd766('0x3f')][_0xd766('0x42')](_0x5414c4);})['then'](function(_0x156839){_0xd5e833[_0xd766('0x43')]=_0x156839;return _0xd5e833;})[_0xd766('0x25')](respondWithFilteredResult(_0x207b7c,_0x5414c4))[_0xd766('0x44')](handleError(_0x207b7c,null));};exports[_0xd766('0x45')]=function(_0x51f84f,_0x1cc589){var _0x73b46e={'raw':!![],'where':{'id':_0x51f84f[_0xd766('0x46')]['id']}},_0x21936b={};_0x21936b[_0xd766('0x31')]=_[_0xd766('0x47')](db[_0xd766('0x3f')][_0xd766('0x2b')]);_0x21936b[_0xd766('0x2f')]=_[_0xd766('0x47')](_0x51f84f['query']);_0x21936b['filters']=_[_0xd766('0x33')](_0x21936b[_0xd766('0x31')],_0x21936b[_0xd766('0x2f')]);_0x73b46e[_0xd766('0x32')]=_[_0xd766('0x33')](_0x21936b[_0xd766('0x31')],qs[_0xd766('0x34')](_0x51f84f[_0xd766('0x2f')][_0xd766('0x34')]));_0x73b46e[_0xd766('0x32')]=_0x73b46e[_0xd766('0x32')][_0xd766('0x35')]?_0x73b46e['attributes']:_0x21936b[_0xd766('0x31')];if(_0x51f84f[_0xd766('0x2f')][_0xd766('0x40')]){_0x73b46e['include']=[{'all':!![]}];}_0x73b46e=_[_0xd766('0x3c')]({},_0x73b46e,_0x51f84f[_0xd766('0x3e')]);return db[_0xd766('0x3f')][_0xd766('0x48')](_0x73b46e)[_0xd766('0x25')](handleEntityNotFound(_0x1cc589,null))[_0xd766('0x25')](respondWithResult(_0x1cc589,null))[_0xd766('0x44')](handleError(_0x1cc589,null));};exports['create']=function(_0x245c8c,_0x2b01e4){return db[_0xd766('0x3f')][_0xd766('0x49')](_0x245c8c[_0xd766('0x4a')],{})['then'](function(_0x5d23b3){var _0x36741c=_0x245c8c[_0xd766('0x4b')][_0xd766('0x4c')]({'plain':!![]});if(!_0x36741c)throw new Error(_0xd766('0x4d'));if(_0x36741c['role']===_0xd766('0x4b')){var _0x53f4eb=_0x5d23b3[_0xd766('0x4c')]({'plain':!![]});var _0x2d4d54=_0xd766('0x26');return db[_0xd766('0x4e')][_0xd766('0x48')]({'where':{'name':_0x2d4d54,'userProfileId':_0x36741c['userProfileId']},'raw':!![]})[_0xd766('0x25')](function(_0x117ca1){if(_0x117ca1&&_0x117ca1[_0xd766('0x4f')]===0x0){return db[_0xd766('0x50')][_0xd766('0x49')]({'name':_0x53f4eb[_0xd766('0x29')],'resourceId':_0x53f4eb['id'],'type':_0x117ca1[_0xd766('0x29')],'sectionId':_0x117ca1['id']},{})[_0xd766('0x25')](function(){return _0x5d23b3;});}else{return _0x5d23b3;}})[_0xd766('0x44')](function(_0x111a13){logger['error'](_0xd766('0x51'),_0x111a13);throw _0x111a13;});}return _0x5d23b3;})[_0xd766('0x25')](respondWithResult(_0x2b01e4,0xc9))[_0xd766('0x44')](handleError(_0x2b01e4,null));};exports['update']=function(_0x1f1867,_0x1fc692){if(_0x1f1867[_0xd766('0x4a')]['id']){delete _0x1f1867[_0xd766('0x4a')]['id'];}return db[_0xd766('0x3f')][_0xd766('0x48')]({'where':{'id':_0x1f1867[_0xd766('0x46')]['id']}})[_0xd766('0x25')](handleEntityNotFound(_0x1fc692,null))[_0xd766('0x25')](saveUpdates(_0x1f1867['body'],null))['then'](respondWithResult(_0x1fc692,null))['catch'](handleError(_0x1fc692,null));};exports[_0xd766('0x24')]=function(_0x5aa668,_0x3e37da){return db['CmHopperAdditionalPhone'][_0xd766('0x48')]({'where':{'id':_0x5aa668[_0xd766('0x46')]['id']}})[_0xd766('0x25')](handleEntityNotFound(_0x3e37da,null))[_0xd766('0x25')](removeEntity(_0x3e37da,null))[_0xd766('0x44')](handleError(_0x3e37da,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 458fa9e..827fbfa 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 _0xecc1=['./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x27a143,_0x12269c){var _0x33b2a3=function(_0x3b98da){while(--_0x3b98da){_0x27a143['push'](_0x27a143['shift']());}};_0x33b2a3(++_0x12269c);}(_0xecc1,0x1e5));var _0x1ecc=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xecc1[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0x1ecc('0x0'));var util=require('util');var logger=require(_0x1ecc('0x1'))(_0x1ecc('0x2'));var moment=require(_0x1ecc('0x3'));var BPromise=require(_0x1ecc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ecc('0x5'));var rimraf=require('rimraf');var config=require(_0x1ecc('0x6'));var attributes=require(_0x1ecc('0x7'));module[_0x1ecc('0x8')]=function(_0x1b30bf,_0xe5136a){return _0x1b30bf[_0x1ecc('0x9')](_0x1ecc('0xa'),attributes,{'tableName':_0x1ecc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc0e=['bluebird','request-promise','path','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','../../config/logger','api','moment'];(function(_0x4a9bdd,_0x5098f5){var _0x1ba3a4=function(_0x3b157f){while(--_0x3b157f){_0x4a9bdd['push'](_0x4a9bdd['shift']());}};_0x1ba3a4(++_0x5098f5);}(_0xcc0e,0x8c));var _0xecc0=function(_0x326afa,_0x842680){_0x326afa=_0x326afa-0x0;var _0x3255cf=_0xcc0e[_0x326afa];return _0x3255cf;};'use strict';var _=require(_0xecc0('0x0'));var util=require('util');var logger=require(_0xecc0('0x1'))(_0xecc0('0x2'));var moment=require(_0xecc0('0x3'));var BPromise=require(_0xecc0('0x4'));var rp=require(_0xecc0('0x5'));var fs=require('fs');var path=require(_0xecc0('0x6'));var rimraf=require('rimraf');var config=require(_0xecc0('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0xecc0('0x8')]=function(_0x298ada,_0x4d7d90){return _0x298ada[_0xecc0('0x9')](_0xecc0('0xa'),attributes,{'tableName':_0xecc0('0xb'),'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 cfa4c51..1d348e6 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 _0xf8d0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','result','CmHopperAdditionalPhone,\x20%s,\x20%s','VerifyAdditionalPhones','CmHopper','ContactId','body','ListId','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','catch','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','countagentrejectretry','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring'];(function(_0x4c4ca2,_0x30d812){var _0x17dac3=function(_0x4f07e6){while(--_0x4f07e6){_0x4c4ca2['push'](_0x4c4ca2['shift']());}};_0x17dac3(++_0x30d812);}(_0xf8d0,0x199));var _0x0f8d=function(_0x5c8147,_0x3192ce){_0x5c8147=_0x5c8147-0x0;var _0x147d1d=_0xf8d0[_0x5c8147];return _0x147d1d;};'use strict';var _=require(_0x0f8d('0x0'));var util=require(_0x0f8d('0x1'));var moment=require('moment');var BPromise=require(_0x0f8d('0x2'));var rs=require(_0x0f8d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f8d('0x4'))['db'];var utils=require(_0x0f8d('0x5'));var logger=require(_0x0f8d('0x6'))(_0x0f8d('0x7'));var config=require(_0x0f8d('0x8'));var jayson=require(_0x0f8d('0x9'));var client=jayson[_0x0f8d('0xa')][_0x0f8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fa813,_0x1822e6,_0x579177){return new BPromise(function(_0x4bcae1,_0x259d64){return client['request'](_0x1fa813,_0x579177)[_0x0f8d('0xc')](function(_0x53c119){logger[_0x0f8d('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1822e6,_0x0f8d('0xe'));logger[_0x0f8d('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x1822e6,'request\x20sent',JSON[_0x0f8d('0x10')](_0x53c119));if(_0x53c119[_0x0f8d('0x11')]){if(_0x53c119[_0x0f8d('0x11')][_0x0f8d('0x12')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1822e6,_0x53c119['error'][_0x0f8d('0x13')]);return _0x259d64(_0x53c119[_0x0f8d('0x11')][_0x0f8d('0x13')]);}logger[_0x0f8d('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1822e6,_0x53c119[_0x0f8d('0x11')][_0x0f8d('0x13')]);return _0x4bcae1(_0x53c119[_0x0f8d('0x11')][_0x0f8d('0x13')]);}else{logger[_0x0f8d('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1822e6,'request\x20sent');_0x4bcae1(_0x53c119[_0x0f8d('0x14')][_0x0f8d('0x13')]);}})['catch'](function(_0x9a42dc){logger[_0x0f8d('0x11')](_0x0f8d('0x15'),_0x1822e6,_0x9a42dc);_0x259d64(_0x9a42dc);});});}exports[_0x0f8d('0x16')]=function(_0x5136b5){var _0x252b12=this;return new Promise(function(_0x1b759d,_0x306bcd){return db[_0x0f8d('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x5136b5['body'][_0x0f8d('0x18')],'ListId':_0x5136b5[_0x0f8d('0x19')][_0x0f8d('0x1a')],'VoiceQueueId':_0x5136b5['body'][_0x0f8d('0x1b')]===undefined?null:_0x5136b5[_0x0f8d('0x19')][_0x0f8d('0x1b')],'CampaignId':_0x5136b5[_0x0f8d('0x19')][_0x0f8d('0x1c')]===undefined?null:_0x5136b5[_0x0f8d('0x19')][_0x0f8d('0x1c')]}})['then'](function(_0x5b0a83){if(_0x5b0a83!=null){return db['CmHopperAdditionalPhone'][_0x0f8d('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x5b0a83['id'],'OrderBy':{'$gt':_0x5b0a83[_0x0f8d('0x1e')]}},'order':[[_0x0f8d('0x1e'),_0x0f8d('0x1f')]]})['then'](function(_0x59e711){var _0x18258e=0x0;if(_0x59e711){if(_0x59e711[_0x0f8d('0x20')]+_0x59e711[_0x0f8d('0x21')]+_0x59e711[_0x0f8d('0x22')]+_0x59e711[_0x0f8d('0x23')]+_0x59e711[_0x0f8d('0x24')]+_0x59e711[_0x0f8d('0x25')]+_0x59e711[_0x0f8d('0x26')]+_0x59e711['countagentrejectretry']<_0x5136b5[_0x0f8d('0x27')][_0x0f8d('0x28')])_0x18258e=0x1;_0x1b759d({'additional':_0x18258e});}else{return db[_0x0f8d('0x29')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5b0a83['id']},'order':[['OrderBy','ASC']]})[_0x0f8d('0xc')](function(_0x31d7c7){var _0x2060fc=0x0;if(_0x31d7c7){if(_0x31d7c7[_0x0f8d('0x20')]+_0x31d7c7[_0x0f8d('0x21')]+_0x31d7c7[_0x0f8d('0x22')]+_0x31d7c7[_0x0f8d('0x23')]+_0x31d7c7[_0x0f8d('0x24')]+_0x31d7c7['countabandonedretry']+_0x31d7c7['countmachineretry']+_0x31d7c7['countagentrejectretry']<_0x5136b5[_0x0f8d('0x27')][_0x0f8d('0x28')])_0x2060fc=0x1;_0x1b759d({'additional':_0x2060fc});}else{_0x1b759d({'additional':0x0});}})[_0x0f8d('0x2a')](function(_0x33d2cc){logger[_0x0f8d('0x11')]('VerifyAdditionalPhones',_0x33d2cc['message']);_0x306bcd(_0x252b12['error'](0x1f4,_0x33d2cc[_0x0f8d('0x13')]));});}})['catch'](function(_0x3ea121){logger[_0x0f8d('0x11')](_0x0f8d('0x16'),_0x3ea121[_0x0f8d('0x13')]);_0x306bcd(_0x252b12[_0x0f8d('0x11')](0x1f4,_0x3ea121[_0x0f8d('0x13')]));});}else _0x1b759d({'additional':0x0});});});};exports[_0x0f8d('0x2b')]=function(_0x54cc04){var _0x53dfc6=this;return new Promise(function(_0x5003c3,_0x135163){return db[_0x0f8d('0x17')][_0x0f8d('0x1d')]({'raw':!![],'where':{'ContactId':_0x54cc04['body'][_0x0f8d('0x18')],'ListId':_0x54cc04[_0x0f8d('0x19')][_0x0f8d('0x1a')],'VoiceQueueId':_0x54cc04[_0x0f8d('0x19')][_0x0f8d('0x1b')]===undefined?null:_0x54cc04[_0x0f8d('0x19')][_0x0f8d('0x1b')],'CampaignId':_0x54cc04['body'][_0x0f8d('0x1c')]===undefined?null:_0x54cc04[_0x0f8d('0x19')][_0x0f8d('0x1c')]}})[_0x0f8d('0xc')](function(_0x3a8039){if(_0x3a8039!=null){return db[_0x0f8d('0x29')][_0x0f8d('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x3a8039['id'],'OrderBy':{'$gte':_0x3a8039[_0x0f8d('0x1e')]}},'order':[[_0x0f8d('0x1e'),'ASC']]})[_0x0f8d('0xc')](function(_0x91b029){if(_0x91b029)return activateAdditionalPhone(_0x3a8039,_0x54cc04[_0x0f8d('0x19')],_0x91b029,_0x54cc04[_0x0f8d('0x2c')],_0x54cc04[_0x0f8d('0x2d')])[_0x0f8d('0xc')](function(_0x4af1c4){_0x5003c3(_0x4af1c4);});else{return db[_0x0f8d('0x29')][_0x0f8d('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x3a8039['id']},'order':[[_0x0f8d('0x1e'),_0x0f8d('0x1f')]]})[_0x0f8d('0xc')](function(_0x7462b0){if(_0x7462b0)return activateAdditionalPhone(_0x3a8039,_0x54cc04['body'],_0x7462b0,_0x54cc04[_0x0f8d('0x2c')],_0x54cc04[_0x0f8d('0x2d')])[_0x0f8d('0xc')](function(_0x5d7a85){_0x5003c3(_0x5d7a85);});else{_0x5003c3({'id':_0x3a8039['id'],'phone':''});}})[_0x0f8d('0x2a')](function(_0x193f85){logger[_0x0f8d('0x11')](_0x0f8d('0x16'),_0x193f85['message']);_0x135163(_0x53dfc6['error'](0x1f4,_0x193f85[_0x0f8d('0x13')]));});}})[_0x0f8d('0x2a')](function(_0x1e1f96){logger[_0x0f8d('0x11')]('VerifyAdditionalPhones',_0x1e1f96[_0x0f8d('0x13')]);_0x135163(_0x53dfc6[_0x0f8d('0x11')](0x1f4,_0x1e1f96[_0x0f8d('0x13')]));});}else _0x5003c3(0x1);});});};function activateAdditionalPhone(_0x2ff7bf,_0x26a13e,_0x563be2,_0x3ffea0,_0x136da1){return new Promise(function(_0x5cf2c9,_0xa89ebe){var _0x48e44c;if(_['isNil'](_0x563be2[_0x0f8d('0x2e')])){_0x563be2[_0x0f8d('0x2e')]=moment();}if(moment()>moment(_0x563be2[_0x0f8d('0x2e')])){_0x48e44c=moment()['add'](_0x136da1||0x3,'minutes');}else{if(_0x563be2[_0x0f8d('0x1e')]==0x0){_0x48e44c=moment(_0x563be2[_0x0f8d('0x2e')]);}else{_0x48e44c=moment()[_0x0f8d('0x2f')](_0x136da1||0x3,_0x0f8d('0x30'));}}if(_[_0x0f8d('0x31')](_0x48e44c)){_0x48e44c=moment()['add'](_0x136da1||0x3,_0x0f8d('0x30'));}var _0x4d980f={'phone':_0x2ff7bf[_0x0f8d('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x2ff7bf[_0x0f8d('0x1e')])?0x0:_0x2ff7bf[_0x0f8d('0x1e')],'scheduledat':moment()[_0x0f8d('0x2f')](_0x3ffea0||0x1,_0x0f8d('0x30')),'countbusyretry':_0x26a13e['countbusyretry'],'countcongestionretry':_0x26a13e[_0x0f8d('0x21')],'countnoanswerretry':_0x26a13e[_0x0f8d('0x22')],'countnosuchnumberretry':_0x26a13e[_0x0f8d('0x23')],'countdropretry':_0x26a13e['countdropretry'],'countabandonedretry':_0x26a13e[_0x0f8d('0x25')],'countmachineretry':_0x26a13e['countmachineretry'],'countagentrejectretry':_0x26a13e[_0x0f8d('0x33')],'createdAt':_0x26a13e[_0x0f8d('0x34')],'updatedAt':_0x26a13e[_0x0f8d('0x35')]};var _0x1497c3={'CmHopperId':_0x2ff7bf['id'],'phone':_0x563be2[_0x0f8d('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x563be2[_0x0f8d('0x1e')])?0x0:_0x563be2[_0x0f8d('0x1e')],'scheduledat':_0x48e44c,'countbusyretry':_0x563be2[_0x0f8d('0x20')],'countcongestionretry':_0x563be2[_0x0f8d('0x21')],'countnoanswerretry':_0x563be2[_0x0f8d('0x22')],'countnosuchnumberretry':_0x563be2['countnosuchnumberretry'],'countdropretry':_0x563be2[_0x0f8d('0x24')],'countabandonedretry':_0x563be2[_0x0f8d('0x25')],'countmachineretry':_0x563be2[_0x0f8d('0x26')],'countagentrejectretry':_0x563be2[_0x0f8d('0x33')],'createdAt':_0x563be2['createdAt'],'updatedAt':_0x563be2[_0x0f8d('0x35')]};return db[_0x0f8d('0x36')]['transaction'](function(_0x5e8dfa){return db['CmHopperAdditionalPhone'][_0x0f8d('0x37')](_0x4d980f,{'where':{'id':_0x563be2['id']}},{'transaction':_0x5e8dfa})[_0x0f8d('0xc')](function(){return db[_0x0f8d('0x17')][_0x0f8d('0x37')](_0x1497c3,{'where':{'id':_0x2ff7bf['id']}},{'transaction':_0x5e8dfa});});})[_0x0f8d('0xc')](function(_0x342930){_0x5cf2c9({'id':_0x2ff7bf['id'],'phone':_0x563be2[_0x0f8d('0x32')]});})[_0x0f8d('0x2a')](function(_0x3b813d){logger[_0x0f8d('0x11')](_0x0f8d('0x38'),_0x3b813d[_0x0f8d('0x13')]);_0xa89ebe({'error':_0x3b813d[_0x0f8d('0x13')]});});});}exports[_0x0f8d('0x39')]=function(_0x5483be){var _0x218d9b=this;return new Promise(function(_0xd16a46,_0x593958){return db[_0x0f8d('0x17')][_0x0f8d('0x37')](_0x5483be[_0x0f8d('0x19')][_0x0f8d('0x3a')],{'where':{'id':_0x5483be[_0x0f8d('0x19')]['id']}})[_0x0f8d('0xc')](function(_0x163795){_0xd16a46(_0x163795);})[_0x0f8d('0x2a')](function(_0x49c0b6){logger[_0x0f8d('0x11')](_0x0f8d('0x39'),_0x49c0b6[_0x0f8d('0x13')]);_0x593958(_0x218d9b[_0x0f8d('0x11')](0x1f4,_0x49c0b6[_0x0f8d('0x13')]));});});}; \ No newline at end of file +var _0x4714=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','VerifyAdditionalPhones','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','countcongestionretry','ListId','duration','waitTime','isNil','scheduledat','add','minutes','phone','countagentrejectretry','createdAt','updatedAt','countnoanswerretry','sequelize','transaction','CmHopper','update','IncrementPreviewCounters','util','moment','bluebird','randomstring','ioredis'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x4714,0x183));var _0x4471=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4714[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x4471('0x0'));var moment=require(_0x4471('0x1'));var BPromise=require(_0x4471('0x2'));var rs=require(_0x4471('0x3'));var fs=require('fs');var Redis=require(_0x4471('0x4'));var db=require(_0x4471('0x5'))['db'];var utils=require(_0x4471('0x6'));var logger=require(_0x4471('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4471('0x8'));var client=jayson[_0x4471('0x9')][_0x4471('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3187bf,_0x5d081a,_0x864b73){return new BPromise(function(_0x4809d1,_0x9ba3e5){return client[_0x4471('0xb')](_0x3187bf,_0x864b73)[_0x4471('0xc')](function(_0x23fdc5){logger['info'](_0x4471('0xd'),_0x5d081a,_0x4471('0xe'));logger[_0x4471('0xf')](_0x4471('0x10'),_0x5d081a,_0x4471('0xe'),JSON['stringify'](_0x23fdc5));if(_0x23fdc5['error']){if(_0x23fdc5[_0x4471('0x11')]['code']===0x1f4){logger[_0x4471('0x11')](_0x4471('0xd'),_0x5d081a,_0x23fdc5['error'][_0x4471('0x12')]);return _0x9ba3e5(_0x23fdc5[_0x4471('0x11')]['message']);}logger[_0x4471('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5d081a,_0x23fdc5['error'][_0x4471('0x12')]);return _0x4809d1(_0x23fdc5['error'][_0x4471('0x12')]);}else{logger[_0x4471('0x13')](_0x4471('0xd'),_0x5d081a,'request\x20sent');_0x4809d1(_0x23fdc5[_0x4471('0x14')]['message']);}})[_0x4471('0x15')](function(_0x32c9e6){logger[_0x4471('0x11')](_0x4471('0xd'),_0x5d081a,_0x32c9e6);_0x9ba3e5(_0x32c9e6);});});}exports[_0x4471('0x16')]=function(_0x5236e8){var _0x1bfc07=this;return new Promise(function(_0xf156be,_0xcfaf37){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x5236e8[_0x4471('0x17')][_0x4471('0x18')],'ListId':_0x5236e8[_0x4471('0x17')]['ListId'],'VoiceQueueId':_0x5236e8[_0x4471('0x17')][_0x4471('0x19')]===undefined?null:_0x5236e8[_0x4471('0x17')][_0x4471('0x19')],'CampaignId':_0x5236e8['body']['CampaignId']===undefined?null:_0x5236e8[_0x4471('0x17')][_0x4471('0x1a')]}})[_0x4471('0xc')](function(_0xc0bdca){if(_0xc0bdca!=null){return db[_0x4471('0x1b')][_0x4471('0x1c')]({'raw':!![],'where':{'CmHopperId':_0xc0bdca['id'],'OrderBy':{'$gt':_0xc0bdca[_0x4471('0x1d')]}},'order':[[_0x4471('0x1d'),_0x4471('0x1e')]]})[_0x4471('0xc')](function(_0x586b02){var _0x4fc82f=0x0;if(_0x586b02){if(_0x586b02[_0x4471('0x1f')]+_0x586b02['countcongestionretry']+_0x586b02['countnoanswerretry']+_0x586b02[_0x4471('0x20')]+_0x586b02[_0x4471('0x21')]+_0x586b02[_0x4471('0x22')]+_0x586b02[_0x4471('0x23')]+_0x586b02['countagentrejectretry']<_0x5236e8[_0x4471('0x24')][_0x4471('0x25')])_0x4fc82f=0x1;_0xf156be({'additional':_0x4fc82f});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0xc0bdca['id']},'order':[['OrderBy','ASC']]})[_0x4471('0xc')](function(_0x2c7a88){var _0x56efbf=0x0;if(_0x2c7a88){if(_0x2c7a88[_0x4471('0x1f')]+_0x2c7a88[_0x4471('0x26')]+_0x2c7a88['countnoanswerretry']+_0x2c7a88['countnosuchnumberretry']+_0x2c7a88[_0x4471('0x21')]+_0x2c7a88[_0x4471('0x22')]+_0x2c7a88['countmachineretry']+_0x2c7a88['countagentrejectretry']<_0x5236e8[_0x4471('0x24')][_0x4471('0x25')])_0x56efbf=0x1;_0xf156be({'additional':_0x56efbf});}else{_0xf156be({'additional':0x0});}})['catch'](function(_0x419cea){logger[_0x4471('0x11')]('VerifyAdditionalPhones',_0x419cea[_0x4471('0x12')]);_0xcfaf37(_0x1bfc07[_0x4471('0x11')](0x1f4,_0x419cea[_0x4471('0x12')]));});}})[_0x4471('0x15')](function(_0x22309f){logger[_0x4471('0x11')]('VerifyAdditionalPhones',_0x22309f[_0x4471('0x12')]);_0xcfaf37(_0x1bfc07[_0x4471('0x11')](0x1f4,_0x22309f[_0x4471('0x12')]));});}else _0xf156be({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x492027){var _0x3548c2=this;return new Promise(function(_0xf89956,_0x1b82ba){return db['CmHopper'][_0x4471('0x1c')]({'raw':!![],'where':{'ContactId':_0x492027[_0x4471('0x17')][_0x4471('0x18')],'ListId':_0x492027[_0x4471('0x17')][_0x4471('0x27')],'VoiceQueueId':_0x492027[_0x4471('0x17')][_0x4471('0x19')]===undefined?null:_0x492027[_0x4471('0x17')][_0x4471('0x19')],'CampaignId':_0x492027[_0x4471('0x17')][_0x4471('0x1a')]===undefined?null:_0x492027[_0x4471('0x17')][_0x4471('0x1a')]}})[_0x4471('0xc')](function(_0xaca8ed){if(_0xaca8ed!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0xaca8ed['id'],'OrderBy':{'$gte':_0xaca8ed[_0x4471('0x1d')]}},'order':[[_0x4471('0x1d'),_0x4471('0x1e')]]})[_0x4471('0xc')](function(_0x262fd7){if(_0x262fd7)return activateAdditionalPhone(_0xaca8ed,_0x492027[_0x4471('0x17')],_0x262fd7,_0x492027[_0x4471('0x28')],_0x492027[_0x4471('0x29')])[_0x4471('0xc')](function(_0xe8be6f){_0xf89956(_0xe8be6f);});else{return db[_0x4471('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xaca8ed['id']},'order':[[_0x4471('0x1d'),'ASC']]})[_0x4471('0xc')](function(_0x326d29){if(_0x326d29)return activateAdditionalPhone(_0xaca8ed,_0x492027['body'],_0x326d29,_0x492027[_0x4471('0x28')],_0x492027[_0x4471('0x29')])[_0x4471('0xc')](function(_0x52273b){_0xf89956(_0x52273b);});else{_0xf89956({'id':_0xaca8ed['id'],'phone':''});}})[_0x4471('0x15')](function(_0x1eed55){logger['error'](_0x4471('0x16'),_0x1eed55['message']);_0x1b82ba(_0x3548c2[_0x4471('0x11')](0x1f4,_0x1eed55['message']));});}})[_0x4471('0x15')](function(_0x314f1e){logger[_0x4471('0x11')](_0x4471('0x16'),_0x314f1e['message']);_0x1b82ba(_0x3548c2['error'](0x1f4,_0x314f1e[_0x4471('0x12')]));});}else _0xf89956(0x1);});});};function activateAdditionalPhone(_0x4583ec,_0x58e14b,_0x4e0e2d,_0x2060f1,_0x386fcb){return new Promise(function(_0x521962,_0xedc568){var _0xc14f4e;if(_[_0x4471('0x2a')](_0x4e0e2d[_0x4471('0x2b')])){_0x4e0e2d[_0x4471('0x2b')]=moment();}if(moment()>moment(_0x4e0e2d['scheduledat'])){_0xc14f4e=moment()['add'](_0x386fcb||0x3,'minutes');}else{if(_0x4e0e2d[_0x4471('0x1d')]==0x0){_0xc14f4e=moment(_0x4e0e2d['scheduledat']);}else{_0xc14f4e=moment()[_0x4471('0x2c')](_0x386fcb||0x3,'minutes');}}if(_[_0x4471('0x2a')](_0xc14f4e)){_0xc14f4e=moment()[_0x4471('0x2c')](_0x386fcb||0x3,_0x4471('0x2d'));}var _0x29cec5={'phone':_0x4583ec[_0x4471('0x2e')],'active':0x0,'OrderBy':_[_0x4471('0x2a')](_0x4583ec['OrderBy'])?0x0:_0x4583ec[_0x4471('0x1d')],'scheduledat':moment()[_0x4471('0x2c')](_0x2060f1||0x1,'minutes'),'countbusyretry':_0x58e14b[_0x4471('0x1f')],'countcongestionretry':_0x58e14b[_0x4471('0x26')],'countnoanswerretry':_0x58e14b['countnoanswerretry'],'countnosuchnumberretry':_0x58e14b['countnosuchnumberretry'],'countdropretry':_0x58e14b[_0x4471('0x21')],'countabandonedretry':_0x58e14b[_0x4471('0x22')],'countmachineretry':_0x58e14b[_0x4471('0x23')],'countagentrejectretry':_0x58e14b[_0x4471('0x2f')],'createdAt':_0x58e14b[_0x4471('0x30')],'updatedAt':_0x58e14b[_0x4471('0x31')]};var _0x3a28eb={'CmHopperId':_0x4583ec['id'],'phone':_0x4e0e2d['phone'],'active':0x0,'OrderBy':_[_0x4471('0x2a')](_0x4e0e2d[_0x4471('0x1d')])?0x0:_0x4e0e2d[_0x4471('0x1d')],'scheduledat':_0xc14f4e,'countbusyretry':_0x4e0e2d[_0x4471('0x1f')],'countcongestionretry':_0x4e0e2d['countcongestionretry'],'countnoanswerretry':_0x4e0e2d[_0x4471('0x32')],'countnosuchnumberretry':_0x4e0e2d[_0x4471('0x20')],'countdropretry':_0x4e0e2d['countdropretry'],'countabandonedretry':_0x4e0e2d[_0x4471('0x22')],'countmachineretry':_0x4e0e2d[_0x4471('0x23')],'countagentrejectretry':_0x4e0e2d[_0x4471('0x2f')],'createdAt':_0x4e0e2d[_0x4471('0x30')],'updatedAt':_0x4e0e2d[_0x4471('0x31')]};return db[_0x4471('0x33')][_0x4471('0x34')](function(_0x37f889){return db[_0x4471('0x1b')]['update'](_0x29cec5,{'where':{'id':_0x4e0e2d['id']}},{'transaction':_0x37f889})[_0x4471('0xc')](function(){return db[_0x4471('0x35')][_0x4471('0x36')](_0x3a28eb,{'where':{'id':_0x4583ec['id']}},{'transaction':_0x37f889});});})[_0x4471('0xc')](function(_0x42a135){_0x521962({'id':_0x4583ec['id'],'phone':_0x4e0e2d[_0x4471('0x2e')]});})[_0x4471('0x15')](function(_0x43572d){logger[_0x4471('0x11')]('activateAdditionalPhone',_0x43572d['message']);_0xedc568({'error':_0x43572d[_0x4471('0x12')]});});});}exports[_0x4471('0x37')]=function(_0x540e8f){var _0x1e6c3a=this;return new Promise(function(_0x57145a,_0x4bd74c){return db[_0x4471('0x35')][_0x4471('0x36')](_0x540e8f[_0x4471('0x17')]['field'],{'where':{'id':_0x540e8f['body']['id']}})['then'](function(_0x14b7b5){_0x57145a(_0x14b7b5);})[_0x4471('0x15')](function(_0x304dfb){logger['error']('IncrementPreviewCounters',_0x304dfb['message']);_0x4bd74c(_0x1e6c3a[_0x4471('0x11')](0x1f4,_0x304dfb['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index b89af4e..0115c73 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 _0xe5db=['/:id','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','post','create'];(function(_0x75c3eb,_0x271b5a){var _0x6e6585=function(_0x3d48f5){while(--_0x3d48f5){_0x75c3eb['push'](_0x75c3eb['shift']());}};_0x6e6585(++_0x271b5a);}(_0xe5db,0x1f3));var _0xbe5d=function(_0x325b45,_0x4352c0){_0x325b45=_0x325b45-0x0;var _0x138f33=_0xe5db[_0x325b45];return _0x138f33;};'use strict';var multer=require('multer');var util=require(_0xbe5d('0x0'));var path=require('path');var timeout=require(_0xbe5d('0x1'));var express=require(_0xbe5d('0x2'));var router=express[_0xbe5d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe5d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbe5d('0x5'));var controller=require(_0xbe5d('0x6'));router[_0xbe5d('0x7')]('/',auth[_0xbe5d('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xbe5d('0x9')]('/',auth['isAuthenticated'](),controller[_0xbe5d('0xa')]);router['put'](_0xbe5d('0xb'),auth[_0xbe5d('0x8')](),controller[_0xbe5d('0xc')]);router[_0xbe5d('0xd')](_0xbe5d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xbe5d('0xe')]=router; \ No newline at end of file +var _0x3704=['create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x3704,0x6c));var _0x4370=function(_0x502b1c,_0x463985){_0x502b1c=_0x502b1c-0x0;var _0x40d88d=_0x3704[_0x502b1c];return _0x40d88d;};'use strict';var multer=require('multer');var util=require(_0x4370('0x0'));var path=require(_0x4370('0x1'));var timeout=require('connect-timeout');var express=require(_0x4370('0x2'));var router=express[_0x4370('0x3')]();var fs_extra=require(_0x4370('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4370('0x5'));var config=require(_0x4370('0x6'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x4370('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4370('0x8'),auth['isAuthenticated'](),controller[_0x4370('0x9')]);router['post']('/',auth[_0x4370('0xa')](),controller[_0x4370('0xb')]);router[_0x4370('0xc')](_0x4370('0x8'),auth[_0x4370('0xa')](),controller[_0x4370('0xd')]);router[_0x4370('0xe')](_0x4370('0x8'),auth['isAuthenticated'](),controller[_0x4370('0xf')]);module[_0x4370('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index ed34c7d..cd4961b 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 _0x236e=['exports','STRING','contactListQueue','INTEGER','moment','sequelize'];(function(_0x2c60ab,_0xd9feb5){var _0x1aa197=function(_0x34d3ca){while(--_0x34d3ca){_0x2c60ab['push'](_0x2c60ab['shift']());}};_0x1aa197(++_0xd9feb5);}(_0x236e,0x148));var _0xe236=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x236e[_0x34bc30];return _0x5706de;};'use strict';var moment=require(_0xe236('0x0'));var Sequelize=require(_0xe236('0x1'));module[_0xe236('0x2')]={'phone':{'type':Sequelize[_0xe236('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xe236('0x4')},'ListId':{'type':Sequelize[_0xe236('0x5')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xe236('0x5')],'unique':_0xe236('0x4')}}; \ No newline at end of file +var _0xcde7=['contactListQueue','exports','STRING','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcde7,0x65));var _0x7cde=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xcde7[_0x178e48];return _0x440d7e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x7cde('0x0')]={'phone':{'type':Sequelize[_0x7cde('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7cde('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x7cde('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x7cde('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0c8470c..e9bc894 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 _0x70e3=['save','update','destroy','then','end','sendStatus','error','stack','name','map','CmHopperBlack','rawAttributes','type','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','keys','options','find','catch','body','params','describe','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x4c4645,_0x19bfd9){var _0x3efa18=function(_0x1ecf14){while(--_0x1ecf14){_0x4c4645['push'](_0x4c4645['shift']());}};_0x3efa18(++_0x19bfd9);}(_0x70e3,0xae));var _0x370e=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x70e3[_0x484c03];return _0x294127;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x370e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x370e('0x1'));var moment=require('moment');var BPromise=require(_0x370e('0x2'));var Mustache=require(_0x370e('0x3'));var util=require(_0x370e('0x4'));var path=require('path');var sox=require(_0x370e('0x5'));var csv=require(_0x370e('0x6'));var ejs=require(_0x370e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x370e('0x8'));var squel=require(_0x370e('0x9'));var crypto=require('crypto');var jsforce=require(_0x370e('0xa'));var deskjs=require(_0x370e('0xb'));var toCsv=require(_0x370e('0x6'));var querystring=require('querystring');var Papa=require(_0x370e('0xc'));var Redis=require(_0x370e('0xd'));var authService=require(_0x370e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x370e('0xf'));var hardwareService=require(_0x370e('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x370e('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a68f8,_0x168baf){_0x168baf=_0x168baf||0xcc;return function(_0x575008){if(_0x575008){return _0x1a68f8['sendStatus'](_0x168baf);}return _0x1a68f8[_0x370e('0x12')](_0x168baf)['end']();};}function respondWithResult(_0xe70b1f,_0x4b331c){_0x4b331c=_0x4b331c||0xc8;return function(_0x21cc48){if(_0x21cc48){return _0xe70b1f['status'](_0x4b331c)[_0x370e('0x13')](_0x21cc48);}};}function respondWithFilteredResult(_0x5394cf,_0x472a4a){return function(_0x291bf0){if(_0x291bf0){var _0x515270=typeof _0x472a4a[_0x370e('0x14')]===_0x370e('0x15')&&typeof _0x472a4a[_0x370e('0x16')]===_0x370e('0x15');var _0x6e65d4=_0x291bf0[_0x370e('0x17')];var _0x21f619=_0x515270?0x0:_0x472a4a[_0x370e('0x14')];var _0x5dccf0=_0x515270?_0x291bf0[_0x370e('0x17')]:_0x472a4a[_0x370e('0x14')]+_0x472a4a[_0x370e('0x16')];var _0x6120ce;if(_0x5dccf0>=_0x6e65d4){_0x5dccf0=_0x6e65d4;_0x6120ce=0xc8;}else{_0x6120ce=0xce;}_0x5394cf[_0x370e('0x12')](_0x6120ce);return _0x5394cf[_0x370e('0x18')](_0x370e('0x19'),_0x21f619+'-'+_0x5dccf0+'/'+_0x6e65d4)[_0x370e('0x13')](_0x291bf0);}return null;};}function patchUpdates(_0x4833b3){return function(_0x1105be){try{jsonpatch['apply'](_0x1105be,_0x4833b3,!![]);}catch(_0x331724){return BPromise[_0x370e('0x1a')](_0x331724);}return _0x1105be[_0x370e('0x1b')]();};}function saveUpdates(_0x1d1348,_0x200fe5){return function(_0x44591d){if(_0x44591d){return _0x44591d[_0x370e('0x1c')](_0x1d1348)['then'](function(_0x2dcc49){return _0x2dcc49;});}return null;};}function removeEntity(_0xd15072,_0x49d3c6){return function(_0x134446){if(_0x134446){return _0x134446[_0x370e('0x1d')]()[_0x370e('0x1e')](function(){_0xd15072[_0x370e('0x12')](0xcc)[_0x370e('0x1f')]();});}};}function handleEntityNotFound(_0xe8e5d1,_0x51f278){return function(_0x3d841b){if(!_0x3d841b){_0xe8e5d1[_0x370e('0x20')](0x194);}return _0x3d841b;};}function handleError(_0x5c3873,_0x18a410){_0x18a410=_0x18a410||0x1f4;return function(_0x451eb7){logger[_0x370e('0x21')](_0x451eb7[_0x370e('0x22')]);if(_0x451eb7[_0x370e('0x23')]){delete _0x451eb7[_0x370e('0x23')];}_0x5c3873[_0x370e('0x12')](_0x18a410)['send'](_0x451eb7);};}exports['index']=function(_0x56d4f6,_0x2de037){var _0x2e05dd={},_0x2244f7={},_0x5ddd7d={'count':0x0,'rows':[]};var _0xa9db42=_[_0x370e('0x24')](db[_0x370e('0x25')][_0x370e('0x26')],function(_0x2fb8ed){return{'name':_0x2fb8ed['fieldName'],'type':_0x2fb8ed[_0x370e('0x27')]['key']};});_0x2244f7[_0x370e('0x28')]=_[_0x370e('0x24')](_0xa9db42,_0x370e('0x23'));_0x2244f7['query']=_['keys'](_0x56d4f6['query']);_0x2244f7[_0x370e('0x29')]=_[_0x370e('0x2a')](_0x2244f7['model'],_0x2244f7['query']);_0x2e05dd[_0x370e('0x2b')]=_[_0x370e('0x2a')](_0x2244f7[_0x370e('0x28')],qs[_0x370e('0x2c')](_0x56d4f6[_0x370e('0x2d')][_0x370e('0x2c')]));_0x2e05dd[_0x370e('0x2b')]=_0x2e05dd[_0x370e('0x2b')][_0x370e('0x2e')]?_0x2e05dd[_0x370e('0x2b')]:_0x2244f7[_0x370e('0x28')];if(!_0x56d4f6[_0x370e('0x2d')][_0x370e('0x2f')](_0x370e('0x30'))){_0x2e05dd[_0x370e('0x16')]=qs[_0x370e('0x16')](_0x56d4f6[_0x370e('0x2d')][_0x370e('0x16')]);_0x2e05dd[_0x370e('0x14')]=qs[_0x370e('0x14')](_0x56d4f6[_0x370e('0x2d')]['offset']);}_0x2e05dd[_0x370e('0x31')]=qs[_0x370e('0x32')](_0x56d4f6['query'][_0x370e('0x32')]);_0x2e05dd[_0x370e('0x33')]=qs[_0x370e('0x29')](_[_0x370e('0x34')](_0x56d4f6[_0x370e('0x2d')],_0x2244f7[_0x370e('0x29')]),_0xa9db42);if(_0x56d4f6[_0x370e('0x2d')][_0x370e('0x35')]){_0x2e05dd[_0x370e('0x33')]=_[_0x370e('0x36')](_0x2e05dd[_0x370e('0x33')],{'$or':_[_0x370e('0x24')](_0xa9db42,function(_0xfa354f){if(_0xfa354f[_0x370e('0x27')]!=='VIRTUAL'){var _0x334991={};_0x334991[_0xfa354f[_0x370e('0x23')]]={'$like':'%'+_0x56d4f6[_0x370e('0x2d')][_0x370e('0x35')]+'%'};return _0x334991;}})});}_0x2e05dd=_[_0x370e('0x36')]({},_0x2e05dd,_0x56d4f6['options']);var _0x5952c7={'where':_0x2e05dd['where']};return db[_0x370e('0x25')]['count'](_0x5952c7)[_0x370e('0x1e')](function(_0x5caf7a){_0x5ddd7d[_0x370e('0x17')]=_0x5caf7a;if(_0x56d4f6[_0x370e('0x2d')][_0x370e('0x37')]){_0x2e05dd[_0x370e('0x38')]=[{'all':!![]}];}return db[_0x370e('0x25')][_0x370e('0x39')](_0x2e05dd);})[_0x370e('0x1e')](function(_0x2f7515){_0x5ddd7d[_0x370e('0x3a')]=_0x2f7515;return _0x5ddd7d;})['then'](respondWithFilteredResult(_0x2de037,_0x2e05dd))['catch'](handleError(_0x2de037,null));};exports[_0x370e('0x3b')]=function(_0x567353,_0x135570){var _0x310474={'raw':!![],'where':{'id':_0x567353['params']['id']}},_0x490978={};_0x490978[_0x370e('0x28')]=_[_0x370e('0x3c')](db[_0x370e('0x25')][_0x370e('0x26')]);_0x490978[_0x370e('0x2d')]=_['keys'](_0x567353[_0x370e('0x2d')]);_0x490978[_0x370e('0x29')]=_[_0x370e('0x2a')](_0x490978[_0x370e('0x28')],_0x490978[_0x370e('0x2d')]);_0x310474[_0x370e('0x2b')]=_[_0x370e('0x2a')](_0x490978[_0x370e('0x28')],qs['fields'](_0x567353[_0x370e('0x2d')][_0x370e('0x2c')]));_0x310474[_0x370e('0x2b')]=_0x310474[_0x370e('0x2b')]['length']?_0x310474[_0x370e('0x2b')]:_0x490978[_0x370e('0x28')];if(_0x567353[_0x370e('0x2d')][_0x370e('0x37')]){_0x310474['include']=[{'all':!![]}];}_0x310474=_[_0x370e('0x36')]({},_0x310474,_0x567353[_0x370e('0x3d')]);return db[_0x370e('0x25')][_0x370e('0x3e')](_0x310474)[_0x370e('0x1e')](handleEntityNotFound(_0x135570,null))[_0x370e('0x1e')](respondWithResult(_0x135570,null))[_0x370e('0x3f')](handleError(_0x135570,null));};exports[_0x370e('0x1c')]=function(_0x4039eb,_0x53b492){if(_0x4039eb[_0x370e('0x40')]['id']){delete _0x4039eb[_0x370e('0x40')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x4039eb[_0x370e('0x41')]['id']}})[_0x370e('0x1e')](handleEntityNotFound(_0x53b492,null))['then'](saveUpdates(_0x4039eb[_0x370e('0x40')],null))[_0x370e('0x1e')](respondWithResult(_0x53b492,null))[_0x370e('0x3f')](handleError(_0x53b492,null));};exports['destroy']=function(_0x7c3d6e,_0x56eb77){return db[_0x370e('0x25')]['find']({'where':{'id':_0x7c3d6e[_0x370e('0x41')]['id']}})[_0x370e('0x1e')](handleEntityNotFound(_0x56eb77,null))[_0x370e('0x1e')](removeEntity(_0x56eb77,null))[_0x370e('0x3f')](handleError(_0x56eb77,null));};exports[_0x370e('0x42')]=function(_0x2f160a,_0x37a9dc){return db['CmHopperBlack'][_0x370e('0x42')]()['then'](respondWithResult(_0x37a9dc,null))[_0x370e('0x3f')](handleError(_0x37a9dc,null));}; \ No newline at end of file +var _0xc41e=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','params','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','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','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','send','index','CmHopperBlack','rawAttributes','fieldName','key','map','name','query','keys','filters','intersection','attributes','model'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0xc41e,0x9c));var _0xec41=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xc41e[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xec41('0x0'));var jsonpatch=require(_0xec41('0x1'));var rp=require(_0xec41('0x2'));var moment=require(_0xec41('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xec41('0x4'));var util=require(_0xec41('0x5'));var path=require(_0xec41('0x6'));var sox=require(_0xec41('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec41('0x8'));var _=require(_0xec41('0x9'));var squel=require('squel');var crypto=require(_0xec41('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xec41('0xb'));var toCsv=require(_0xec41('0xc'));var querystring=require('querystring');var Papa=require(_0xec41('0xd'));var Redis=require(_0xec41('0xe'));var authService=require(_0xec41('0xf'));var qs=require(_0xec41('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec41('0x11'));var logger=require(_0xec41('0x12'))('api');var utils=require(_0xec41('0x13'));var config=require(_0xec41('0x14'));var licenseUtil=require(_0xec41('0x15'));var db=require(_0xec41('0x16'))['db'];function respondWithStatusCode(_0x2f49f0,_0x5c1740){_0x5c1740=_0x5c1740||0xcc;return function(_0x3f5ad2){if(_0x3f5ad2){return _0x2f49f0[_0xec41('0x17')](_0x5c1740);}return _0x2f49f0[_0xec41('0x18')](_0x5c1740)[_0xec41('0x19')]();};}function respondWithResult(_0x518460,_0x41fee3){_0x41fee3=_0x41fee3||0xc8;return function(_0x12615b){if(_0x12615b){return _0x518460[_0xec41('0x18')](_0x41fee3)[_0xec41('0x1a')](_0x12615b);}};}function respondWithFilteredResult(_0x549c73,_0x30f086){return function(_0x31118c){if(_0x31118c){var _0x5ccc1c=typeof _0x30f086['offset']==='undefined'&&typeof _0x30f086[_0xec41('0x1b')]==='undefined';var _0x2c5468=_0x31118c['count'];var _0x591aef=_0x5ccc1c?0x0:_0x30f086['offset'];var _0x1172a7=_0x5ccc1c?_0x31118c[_0xec41('0x1c')]:_0x30f086[_0xec41('0x1d')]+_0x30f086[_0xec41('0x1b')];var _0x5014ea;if(_0x1172a7>=_0x2c5468){_0x1172a7=_0x2c5468;_0x5014ea=0xc8;}else{_0x5014ea=0xce;}_0x549c73['status'](_0x5014ea);return _0x549c73[_0xec41('0x1e')](_0xec41('0x1f'),_0x591aef+'-'+_0x1172a7+'/'+_0x2c5468)[_0xec41('0x1a')](_0x31118c);}return null;};}function patchUpdates(_0x56a5c5){return function(_0x4826e4){try{jsonpatch[_0xec41('0x20')](_0x4826e4,_0x56a5c5,!![]);}catch(_0x418f4d){return BPromise['reject'](_0x418f4d);}return _0x4826e4[_0xec41('0x21')]();};}function saveUpdates(_0x2a6e8d,_0x56b9d6){return function(_0x57322c){if(_0x57322c){return _0x57322c[_0xec41('0x22')](_0x2a6e8d)['then'](function(_0x1d036b){return _0x1d036b;});}return null;};}function removeEntity(_0x2d4e75,_0x163043){return function(_0x4f78b5){if(_0x4f78b5){return _0x4f78b5[_0xec41('0x23')]()[_0xec41('0x24')](function(){_0x2d4e75[_0xec41('0x18')](0xcc)[_0xec41('0x19')]();});}};}function handleEntityNotFound(_0x3f0d16,_0x3bab16){return function(_0x4bbb4e){if(!_0x4bbb4e){_0x3f0d16[_0xec41('0x17')](0x194);}return _0x4bbb4e;};}function handleError(_0x3b9c8f,_0x108dda){_0x108dda=_0x108dda||0x1f4;return function(_0x5c4238){logger['error'](_0x5c4238['stack']);if(_0x5c4238['name']){delete _0x5c4238['name'];}_0x3b9c8f['status'](_0x108dda)[_0xec41('0x25')](_0x5c4238);};}exports[_0xec41('0x26')]=function(_0x1fb4da,_0x33e778){var _0x2b0c19={},_0xf9d92e={},_0x456aa0={'count':0x0,'rows':[]};var _0x324c08=_['map'](db[_0xec41('0x27')][_0xec41('0x28')],function(_0x2d39e3){return{'name':_0x2d39e3[_0xec41('0x29')],'type':_0x2d39e3['type'][_0xec41('0x2a')]};});_0xf9d92e['model']=_[_0xec41('0x2b')](_0x324c08,_0xec41('0x2c'));_0xf9d92e[_0xec41('0x2d')]=_[_0xec41('0x2e')](_0x1fb4da['query']);_0xf9d92e[_0xec41('0x2f')]=_[_0xec41('0x30')](_0xf9d92e['model'],_0xf9d92e[_0xec41('0x2d')]);_0x2b0c19[_0xec41('0x31')]=_[_0xec41('0x30')](_0xf9d92e[_0xec41('0x32')],qs[_0xec41('0x33')](_0x1fb4da[_0xec41('0x2d')][_0xec41('0x33')]));_0x2b0c19[_0xec41('0x31')]=_0x2b0c19[_0xec41('0x31')][_0xec41('0x34')]?_0x2b0c19[_0xec41('0x31')]:_0xf9d92e[_0xec41('0x32')];if(!_0x1fb4da['query'][_0xec41('0x35')](_0xec41('0x36'))){_0x2b0c19[_0xec41('0x1b')]=qs[_0xec41('0x1b')](_0x1fb4da['query'][_0xec41('0x1b')]);_0x2b0c19['offset']=qs[_0xec41('0x1d')](_0x1fb4da[_0xec41('0x2d')]['offset']);}_0x2b0c19[_0xec41('0x37')]=qs[_0xec41('0x38')](_0x1fb4da[_0xec41('0x2d')][_0xec41('0x38')]);_0x2b0c19[_0xec41('0x39')]=qs[_0xec41('0x2f')](_['pick'](_0x1fb4da[_0xec41('0x2d')],_0xf9d92e[_0xec41('0x2f')]),_0x324c08);if(_0x1fb4da[_0xec41('0x2d')][_0xec41('0x3a')]){_0x2b0c19[_0xec41('0x39')]=_[_0xec41('0x3b')](_0x2b0c19[_0xec41('0x39')],{'$or':_[_0xec41('0x2b')](_0x324c08,function(_0x22cf05){if(_0x22cf05['type']!==_0xec41('0x3c')){var _0x3f1e76={};_0x3f1e76[_0x22cf05[_0xec41('0x2c')]]={'$like':'%'+_0x1fb4da[_0xec41('0x2d')][_0xec41('0x3a')]+'%'};return _0x3f1e76;}})});}_0x2b0c19=_[_0xec41('0x3b')]({},_0x2b0c19,_0x1fb4da[_0xec41('0x3d')]);var _0x465601={'where':_0x2b0c19['where']};return db[_0xec41('0x27')][_0xec41('0x1c')](_0x465601)[_0xec41('0x24')](function(_0x494cbb){_0x456aa0[_0xec41('0x1c')]=_0x494cbb;if(_0x1fb4da[_0xec41('0x2d')][_0xec41('0x3e')]){_0x2b0c19[_0xec41('0x3f')]=[{'all':!![]}];}return db[_0xec41('0x27')]['findAll'](_0x2b0c19);})[_0xec41('0x24')](function(_0x523d1d){_0x456aa0['rows']=_0x523d1d;return _0x456aa0;})['then'](respondWithFilteredResult(_0x33e778,_0x2b0c19))[_0xec41('0x40')](handleError(_0x33e778,null));};exports['show']=function(_0x5d6702,_0x11274f){var _0x5cc51b={'raw':!![],'where':{'id':_0x5d6702[_0xec41('0x41')]['id']}},_0x1cfaef={};_0x1cfaef[_0xec41('0x32')]=_[_0xec41('0x2e')](db[_0xec41('0x27')][_0xec41('0x28')]);_0x1cfaef['query']=_['keys'](_0x5d6702[_0xec41('0x2d')]);_0x1cfaef[_0xec41('0x2f')]=_[_0xec41('0x30')](_0x1cfaef[_0xec41('0x32')],_0x1cfaef[_0xec41('0x2d')]);_0x5cc51b[_0xec41('0x31')]=_[_0xec41('0x30')](_0x1cfaef[_0xec41('0x32')],qs['fields'](_0x5d6702[_0xec41('0x2d')]['fields']));_0x5cc51b['attributes']=_0x5cc51b[_0xec41('0x31')]['length']?_0x5cc51b[_0xec41('0x31')]:_0x1cfaef['model'];if(_0x5d6702[_0xec41('0x2d')][_0xec41('0x3e')]){_0x5cc51b['include']=[{'all':!![]}];}_0x5cc51b=_[_0xec41('0x3b')]({},_0x5cc51b,_0x5d6702[_0xec41('0x3d')]);return db[_0xec41('0x27')]['find'](_0x5cc51b)[_0xec41('0x24')](handleEntityNotFound(_0x11274f,null))[_0xec41('0x24')](respondWithResult(_0x11274f,null))[_0xec41('0x40')](handleError(_0x11274f,null));};exports[_0xec41('0x22')]=function(_0x4bea22,_0x195821){if(_0x4bea22[_0xec41('0x42')]['id']){delete _0x4bea22['body']['id'];}return db[_0xec41('0x27')][_0xec41('0x43')]({'where':{'id':_0x4bea22['params']['id']}})[_0xec41('0x24')](handleEntityNotFound(_0x195821,null))[_0xec41('0x24')](saveUpdates(_0x4bea22[_0xec41('0x42')],null))[_0xec41('0x24')](respondWithResult(_0x195821,null))[_0xec41('0x40')](handleError(_0x195821,null));};exports[_0xec41('0x23')]=function(_0x442901,_0x5b2b13){return db['CmHopperBlack']['find']({'where':{'id':_0x442901[_0xec41('0x41')]['id']}})[_0xec41('0x24')](handleEntityNotFound(_0x5b2b13,null))['then'](removeEntity(_0x5b2b13,null))['catch'](handleError(_0x5b2b13,null));};exports['describe']=function(_0x4589da,_0xd646d9){return db[_0xec41('0x27')][_0xec41('0x44')]()[_0xec41('0x24')](respondWithResult(_0xd646d9,null))[_0xec41('0x40')](handleError(_0xd646d9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index ec5edf8..8e5cec5 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 _0xe7ef=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x19242e,_0x1093b0){var _0x217ba2=function(_0x230d2c){while(--_0x230d2c){_0x19242e['push'](_0x19242e['shift']());}};_0x217ba2(++_0x1093b0);}(_0xe7ef,0xc5));var _0xfe7e=function(_0x19fd06,_0x1e296f){_0x19fd06=_0x19fd06-0x0;var _0x302f82=_0xe7ef[_0x19fd06];return _0x302f82;};'use strict';var _=require(_0xfe7e('0x0'));var util=require(_0xfe7e('0x1'));var logger=require(_0xfe7e('0x2'))('api');var moment=require(_0xfe7e('0x3'));var BPromise=require(_0xfe7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe7e('0x5'));var rimraf=require(_0xfe7e('0x6'));var config=require('../../config/environment');var attributes=require(_0xfe7e('0x7'));module[_0xfe7e('0x8')]=function(_0x23b18b,_0x552e62){return _0x23b18b[_0xfe7e('0x9')](_0xfe7e('0xa'),attributes,{'tableName':_0xfe7e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91c7=['define','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x28b0a1,_0x99bd0a){var _0x21470c=function(_0x45bf01){while(--_0x45bf01){_0x28b0a1['push'](_0x28b0a1['shift']());}};_0x21470c(++_0x99bd0a);}(_0x91c7,0x184));var _0x791c=function(_0x257a0,_0x42d2b4){_0x257a0=_0x257a0-0x0;var _0x8a44ed=_0x91c7[_0x257a0];return _0x8a44ed;};'use strict';var _=require('lodash');var util=require(_0x791c('0x0'));var logger=require(_0x791c('0x1'))(_0x791c('0x2'));var moment=require(_0x791c('0x3'));var BPromise=require('bluebird');var rp=require(_0x791c('0x4'));var fs=require('fs');var path=require(_0x791c('0x5'));var rimraf=require(_0x791c('0x6'));var config=require(_0x791c('0x7'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x3478d5,_0x522aa2){return _0x3478d5[_0x791c('0x8')]('CmHopperBlack',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 017a43c..03358c2 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 _0x6e4c=['GetCmHopperBlack','debug','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','bluebird','randomstring','ioredis','../../mysqldb','rpc','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x19925b,_0x2454d7){var _0x3b2c8e=function(_0x4fee09){while(--_0x4fee09){_0x19925b['push'](_0x19925b['shift']());}};_0x3b2c8e(++_0x2454d7);}(_0x6e4c,0x15a));var _0xc6e4=function(_0x5bd60b,_0x13465a){_0x5bd60b=_0x5bd60b-0x0;var _0x2dcff0=_0x6e4c[_0x5bd60b];return _0x2dcff0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc6e4('0x0'));var rs=require(_0xc6e4('0x1'));var fs=require('fs');var Redis=require(_0xc6e4('0x2'));var db=require(_0xc6e4('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc6e4('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc6e4('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x11c918,_0x129aaa,_0x442b87){return new BPromise(function(_0x33d71e,_0xd79710){return client[_0xc6e4('0x6')](_0x11c918,_0x442b87)[_0xc6e4('0x7')](function(_0x13b2aa){logger[_0xc6e4('0x8')](_0xc6e4('0x9'),_0x129aaa,_0xc6e4('0xa'));logger['debug'](_0xc6e4('0xb'),_0x129aaa,_0xc6e4('0xa'),JSON[_0xc6e4('0xc')](_0x13b2aa));if(_0x13b2aa['error']){if(_0x13b2aa['error'][_0xc6e4('0xd')]===0x1f4){logger['error'](_0xc6e4('0x9'),_0x129aaa,_0x13b2aa['error'][_0xc6e4('0xe')]);return _0xd79710(_0x13b2aa[_0xc6e4('0xf')][_0xc6e4('0xe')]);}logger[_0xc6e4('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x129aaa,_0x13b2aa['error'][_0xc6e4('0xe')]);return _0x33d71e(_0x13b2aa['error'][_0xc6e4('0xe')]);}else{logger['info'](_0xc6e4('0x9'),_0x129aaa,_0xc6e4('0xa'));_0x33d71e(_0x13b2aa[_0xc6e4('0x10')][_0xc6e4('0xe')]);}})[_0xc6e4('0x11')](function(_0x5c8b3f){logger[_0xc6e4('0xf')](_0xc6e4('0x9'),_0x129aaa,_0x5c8b3f);_0xd79710(_0x5c8b3f);});});}exports['GetCmHopperBlack']=function(_0x574c3e){var _0x5a3604=this;return new Promise(function(_0x4aa779,_0x2ca6dc){return db[_0xc6e4('0x12')][_0xc6e4('0x13')]({'raw':_0x574c3e['options']?_0x574c3e[_0xc6e4('0x14')][_0xc6e4('0x15')]===undefined?!![]:![]:!![],'where':_0x574c3e[_0xc6e4('0x14')]?_0x574c3e[_0xc6e4('0x14')][_0xc6e4('0x16')]||null:null,'attributes':_0x574c3e[_0xc6e4('0x14')]?_0x574c3e[_0xc6e4('0x14')][_0xc6e4('0x17')]||null:null,'limit':_0x574c3e[_0xc6e4('0x14')]?_0x574c3e[_0xc6e4('0x14')][_0xc6e4('0x18')]||null:null,'include':_0x574c3e[_0xc6e4('0x14')]?_0x574c3e['options'][_0xc6e4('0x19')]?_['map'](_0x574c3e[_0xc6e4('0x14')]['include'],function(_0x2d3560){return{'model':db[_0x2d3560[_0xc6e4('0x1a')]],'as':_0x2d3560['as'],'attributes':_0x2d3560['attributes'],'include':_0x2d3560[_0xc6e4('0x19')]?_['map'](_0x2d3560['include'],function(_0x423a20){return{'model':db[_0x423a20[_0xc6e4('0x1a')]],'as':_0x423a20['as'],'attributes':_0x423a20[_0xc6e4('0x17')],'include':_0x423a20[_0xc6e4('0x19')]?_[_0xc6e4('0x1b')](_0x423a20[_0xc6e4('0x19')],function(_0x276d0c){return{'model':db[_0x276d0c['model']],'as':_0x276d0c['as'],'attributes':_0x276d0c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6e4('0x7')](function(_0x232c87){logger[_0xc6e4('0x8')](_0xc6e4('0x1c'),_0x574c3e);logger[_0xc6e4('0x1d')](_0xc6e4('0x1c'),_0x574c3e,JSON[_0xc6e4('0xc')](_0x232c87));_0x4aa779(_0x232c87);})[_0xc6e4('0x11')](function(_0x4da76e){logger[_0xc6e4('0xf')](_0xc6e4('0x1c'),_0x4da76e[_0xc6e4('0xe')],_0x574c3e);_0x2ca6dc(_0x5a3604[_0xc6e4('0xf')](0x1f4,_0x4da76e[_0xc6e4('0xe')]));});});};exports['UpdateCmHopperBlack']=function(_0x43836e){var _0x2fe30b=this;return new Promise(function(_0x1138e7,_0x551be0){return db[_0xc6e4('0x12')]['update'](_0x43836e[_0xc6e4('0x1e')],{'raw':_0x43836e[_0xc6e4('0x14')]?_0x43836e[_0xc6e4('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43836e[_0xc6e4('0x14')]?_0x43836e['options'][_0xc6e4('0x16')]||null:null,'attributes':_0x43836e['options']?_0x43836e[_0xc6e4('0x14')][_0xc6e4('0x17')]||null:null,'limit':_0x43836e['options']?_0x43836e[_0xc6e4('0x14')][_0xc6e4('0x18')]||null:null})[_0xc6e4('0x7')](function(_0xd8b5aa){logger[_0xc6e4('0x8')]('UpdateCmHopperBlack',_0x43836e);logger[_0xc6e4('0x1d')](_0xc6e4('0x1f'),_0x43836e,JSON[_0xc6e4('0xc')](_0xd8b5aa));_0x1138e7(_0xd8b5aa);})[_0xc6e4('0x11')](function(_0x36d8da){logger[_0xc6e4('0xf')](_0xc6e4('0x1f'),_0x36d8da['message'],_0x43836e);_0x551be0(_0x2fe30b[_0xc6e4('0xf')](0x1f4,_0x36d8da[_0xc6e4('0xe')]));});});};exports[_0xc6e4('0x20')]=function(_0x283aac){var _0x4cdb41=this;return new Promise(function(_0x1ad043,_0x2f3556){return db['CmHopperBlack'][_0xc6e4('0x21')]({'where':_0x283aac['options']?_0x283aac[_0xc6e4('0x14')][_0xc6e4('0x16')]||null:null})[_0xc6e4('0x7')](function(_0x394209){logger['info'](_0xc6e4('0x20'),_0x283aac);logger['debug'](_0xc6e4('0x20'),_0x283aac,JSON['stringify'](_0x394209));_0x1ad043(_0x394209);})[_0xc6e4('0x11')](function(_0x22af96){logger['error'](_0xc6e4('0x20'),_0x22af96[_0xc6e4('0xe')],_0x283aac);_0x2f3556(_0x4cdb41[_0xc6e4('0xf')](0x1f4,_0x22af96[_0xc6e4('0xe')]));});});}; \ No newline at end of file +var _0x5279=['limit','include','map','model','attributes','catch','UpdateCmHopperBlack','update','where','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x5279,0x80));var _0x9527=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5279[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x9527('0x0'));var util=require(_0x9527('0x1'));var moment=require(_0x9527('0x2'));var BPromise=require(_0x9527('0x3'));var rs=require(_0x9527('0x4'));var fs=require('fs');var Redis=require(_0x9527('0x5'));var db=require(_0x9527('0x6'))['db'];var utils=require(_0x9527('0x7'));var logger=require(_0x9527('0x8'))(_0x9527('0x9'));var config=require(_0x9527('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9527('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x400c3a,_0x47e69c,_0x2ee811){return new BPromise(function(_0x4608cd,_0x2e96b4){return client[_0x9527('0xc')](_0x400c3a,_0x2ee811)[_0x9527('0xd')](function(_0x19408d){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x47e69c,'request\x20sent');logger[_0x9527('0xe')](_0x9527('0xf'),_0x47e69c,_0x9527('0x10'),JSON[_0x9527('0x11')](_0x19408d));if(_0x19408d[_0x9527('0x12')]){if(_0x19408d[_0x9527('0x12')][_0x9527('0x13')]===0x1f4){logger[_0x9527('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x47e69c,_0x19408d[_0x9527('0x12')][_0x9527('0x14')]);return _0x2e96b4(_0x19408d[_0x9527('0x12')][_0x9527('0x14')]);}logger[_0x9527('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x47e69c,_0x19408d['error']['message']);return _0x4608cd(_0x19408d[_0x9527('0x12')][_0x9527('0x14')]);}else{logger[_0x9527('0x15')]('CmHopperBlack,\x20%s,\x20%s',_0x47e69c,_0x9527('0x10'));_0x4608cd(_0x19408d[_0x9527('0x16')][_0x9527('0x14')]);}})['catch'](function(_0x35b395){logger[_0x9527('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x47e69c,_0x35b395);_0x2e96b4(_0x35b395);});});}exports[_0x9527('0x17')]=function(_0x45ca8b){var _0x568278=this;return new Promise(function(_0x7a3882,_0x520ee5){return db[_0x9527('0x18')][_0x9527('0x19')]({'raw':_0x45ca8b[_0x9527('0x1a')]?_0x45ca8b['options'][_0x9527('0x1b')]===undefined?!![]:![]:!![],'where':_0x45ca8b[_0x9527('0x1a')]?_0x45ca8b[_0x9527('0x1a')]['where']||null:null,'attributes':_0x45ca8b[_0x9527('0x1a')]?_0x45ca8b['options']['attributes']||null:null,'limit':_0x45ca8b[_0x9527('0x1a')]?_0x45ca8b[_0x9527('0x1a')][_0x9527('0x1c')]||null:null,'include':_0x45ca8b[_0x9527('0x1a')]?_0x45ca8b[_0x9527('0x1a')][_0x9527('0x1d')]?_[_0x9527('0x1e')](_0x45ca8b[_0x9527('0x1a')][_0x9527('0x1d')],function(_0x12bcf5){return{'model':db[_0x12bcf5[_0x9527('0x1f')]],'as':_0x12bcf5['as'],'attributes':_0x12bcf5[_0x9527('0x20')],'include':_0x12bcf5[_0x9527('0x1d')]?_['map'](_0x12bcf5['include'],function(_0x28b9fe){return{'model':db[_0x28b9fe[_0x9527('0x1f')]],'as':_0x28b9fe['as'],'attributes':_0x28b9fe[_0x9527('0x20')],'include':_0x28b9fe['include']?_[_0x9527('0x1e')](_0x28b9fe[_0x9527('0x1d')],function(_0x4fc381){return{'model':db[_0x4fc381[_0x9527('0x1f')]],'as':_0x4fc381['as'],'attributes':_0x4fc381[_0x9527('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9527('0xd')](function(_0x559c34){logger[_0x9527('0x15')]('GetCmHopperBlack',_0x45ca8b);logger[_0x9527('0xe')](_0x9527('0x17'),_0x45ca8b,JSON['stringify'](_0x559c34));_0x7a3882(_0x559c34);})[_0x9527('0x21')](function(_0x403314){logger['error']('GetCmHopperBlack',_0x403314[_0x9527('0x14')],_0x45ca8b);_0x520ee5(_0x568278['error'](0x1f4,_0x403314[_0x9527('0x14')]));});});};exports[_0x9527('0x22')]=function(_0x16bfa8){var _0x488bc3=this;return new Promise(function(_0x2c2190,_0x124295){return db[_0x9527('0x18')][_0x9527('0x23')](_0x16bfa8['body'],{'raw':_0x16bfa8['options']?_0x16bfa8[_0x9527('0x1a')][_0x9527('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16bfa8[_0x9527('0x1a')]?_0x16bfa8[_0x9527('0x1a')][_0x9527('0x24')]||null:null,'attributes':_0x16bfa8[_0x9527('0x1a')]?_0x16bfa8[_0x9527('0x1a')][_0x9527('0x20')]||null:null,'limit':_0x16bfa8[_0x9527('0x1a')]?_0x16bfa8[_0x9527('0x1a')]['limit']||null:null})[_0x9527('0xd')](function(_0x2fe9c0){logger[_0x9527('0x15')](_0x9527('0x22'),_0x16bfa8);logger[_0x9527('0xe')](_0x9527('0x22'),_0x16bfa8,JSON[_0x9527('0x11')](_0x2fe9c0));_0x2c2190(_0x2fe9c0);})[_0x9527('0x21')](function(_0x4e79){logger[_0x9527('0x12')]('UpdateCmHopperBlack',_0x4e79['message'],_0x16bfa8);_0x124295(_0x488bc3['error'](0x1f4,_0x4e79['message']));});});};exports[_0x9527('0x25')]=function(_0x4128ee){var _0x4adeb8=this;return new Promise(function(_0x4eff49,_0x23c747){return db['CmHopperBlack'][_0x9527('0x26')]({'where':_0x4128ee[_0x9527('0x1a')]?_0x4128ee[_0x9527('0x1a')]['where']||null:null})[_0x9527('0xd')](function(_0x2e93fa){logger[_0x9527('0x15')](_0x9527('0x25'),_0x4128ee);logger['debug'](_0x9527('0x25'),_0x4128ee,JSON[_0x9527('0x11')](_0x2e93fa));_0x4eff49(_0x2e93fa);})[_0x9527('0x21')](function(_0x5717ba){logger[_0x9527('0x12')](_0x9527('0x25'),_0x5717ba[_0x9527('0x14')],_0x4128ee);_0x23c747(_0x4adeb8[_0x9527('0x12')](0x1f4,_0x5717ba['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index e1080c9..055ab80 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 _0x7046=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','show','put','/:id','update','delete'];(function(_0x4390f7,_0x37803d){var _0x314f24=function(_0x144aa5){while(--_0x144aa5){_0x4390f7['push'](_0x4390f7['shift']());}};_0x314f24(++_0x37803d);}(_0x7046,0x144));var _0x6704=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7046[_0x199572];return _0x13cfa3;};'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('0xe')](_0x6704('0xf'),auth[_0x6704('0xa')](),controller[_0x6704('0x10')]);router[_0x6704('0x11')](_0x6704('0xf'),auth[_0x6704('0xa')](),controller['destroy']);module[_0x6704('0x12')]=router; \ No newline at end of file +var _0xdf55=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','delete','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x242300,_0x3314f3){var _0x4d3198=function(_0x4f0495){while(--_0x4f0495){_0x242300['push'](_0x242300['shift']());}};_0x4d3198(++_0x3314f3);}(_0xdf55,0x83));var _0x5df5=function(_0x5bc4e2,_0x427ff9){_0x5bc4e2=_0x5bc4e2-0x0;var _0x4c93f9=_0xdf55[_0x5bc4e2];return _0x4c93f9;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var fs_extra=require(_0x5df5('0x4'));var auth=require(_0x5df5('0x5'));var interaction=require(_0x5df5('0x6'));var config=require('../../config/environment');var controller=require(_0x5df5('0x7'));router[_0x5df5('0x8')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0xa')]);router[_0x5df5('0x8')](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xc')]);router['get'](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xe')]);router['put']('/:id',auth[_0x5df5('0x9')](),controller['update']);router[_0x5df5('0xf')](_0x5df5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x5df5('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 7a1c657..72bd7db 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 _0x480e=['BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','endtime','setDataValue','diff','seconds'];(function(_0x2abb08,_0x2e60f0){var _0x30ff85=function(_0x5daf45){while(--_0x5daf45){_0x2abb08['push'](_0x2abb08['shift']());}};_0x30ff85(++_0x2e60f0);}(_0x480e,0xe7));var _0xe480=function(_0x3f8fa2,_0x524a4){_0x3f8fa2=_0x3f8fa2-0x0;var _0x4dbd6c=_0x480e[_0x3f8fa2];return _0x4dbd6c;};'use strict';var Sequelize=require(_0xe480('0x0'));var moment=require(_0xe480('0x1'));module['exports']={'state':{'type':Sequelize[_0xe480('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe480('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe480('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe480('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe480('0x4')]},'ringtime':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe480('0x3')]},'reason':{'type':Sequelize[_0xe480('0x3')]},'disposition':{'type':Sequelize[_0xe480('0x3')]},'secondDisposition':{'type':Sequelize[_0xe480('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xe480('0x4')],'set':function(_0x14642d){var _0x217027=this['getDataValue'](_0xe480('0x5'));if(_0x217027&&_0x14642d){this[_0xe480('0x6')]('followuptime',moment(_0x14642d)[_0xe480('0x7')](moment(_0x217027),_0xe480('0x8')));}}},'amd':{'type':Sequelize[_0xe480('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe480('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe480('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe480('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe480('0x4')]},'callback':{'type':Sequelize[_0xe480('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe480('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe480('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe480('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe480('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8388=['getDataValue','endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x47c6b9,_0x210b3c){var _0x34f34d=function(_0x47c336){while(--_0x47c336){_0x47c6b9['push'](_0x47c6b9['shift']());}};_0x34f34d(++_0x210b3c);}(_0x8388,0xea));var _0x8838=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0x8388[_0x4ed32d];return _0xf624df;};'use strict';var Sequelize=require(_0x8838('0x0'));var moment=require(_0x8838('0x1'));module[_0x8838('0x2')]={'state':{'type':Sequelize[_0x8838('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x8838('0x4')]},'scheduledat':{'type':Sequelize[_0x8838('0x5')]},'countbusyretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8838('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x8838('0x4')]},'originatecalleridname':{'type':Sequelize[_0x8838('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8838('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8838('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8838('0x5')]},'endtime':{'type':Sequelize[_0x8838('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8838('0x4')]},'campaigntype':{'type':Sequelize[_0x8838('0x4')]},'membername':{'type':Sequelize[_0x8838('0x4')]},'reason':{'type':Sequelize[_0x8838('0x4')]},'disposition':{'type':Sequelize[_0x8838('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8838('0x4')]},'dispositionat':{'type':Sequelize[_0x8838('0x5')],'set':function(_0x1ee47f){var _0x3e7e78=this[_0x8838('0x6')](_0x8838('0x7'));if(_0x3e7e78&&_0x1ee47f){this['setDataValue'](_0x8838('0x8'),moment(_0x1ee47f)[_0x8838('0x9')](moment(_0x3e7e78),_0x8838('0xa')));}}},'amd':{'type':Sequelize[_0x8838('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8838('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8838('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8838('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8838('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8838('0x5')]},'deleted':{'type':Sequelize[_0x8838('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8838('0x5')]},'recallme':{'type':Sequelize[_0x8838('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8838('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8838('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 528a3ee..7e0d7b0 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 _0x7880=['index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','where','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','phone','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x18dab3,_0x2c480a){var _0x54a26c=function(_0x10e739){while(--_0x10e739){_0x18dab3['push'](_0x18dab3['shift']());}};_0x54a26c(++_0x2c480a);}(_0x7880,0x1f4));var _0x0788=function(_0x3d5f84,_0x569548){_0x3d5f84=_0x3d5f84-0x0;var _0x1981b8=_0x7880[_0x3d5f84];return _0x1981b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':!![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['CmHopperFinal'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['describe']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')]()['then'](respondWithResult(_0x39c3cc,null))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x19aad6,_0x4563cd){if(_0x19aad6[_0x0788('0x4b')]['uniqueid']){delete _0x19aad6['body'][_0x0788('0x4c')];}return db[_0x0788('0x2d')]['find']({'where':{'uniqueid':_0x19aad6[_0x0788('0x46')]['id']}})['then'](handleEntityNotFound(_0x4563cd,null))[_0x0788('0x26')](saveUpdates(_0x19aad6[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x4563cd,null))[_0x0788('0x44')](handleError(_0x4563cd,null));};exports[_0x0788('0x4d')]=function(_0x379928,_0x1722d4,_0x25ac3c){return db['CmHopperFinal'][_0x0788('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x379928[_0x0788('0x46')]['id']},'attributes':[[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x4f')))),_0x0788('0x50')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x0788('0x52')],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x54')))),_0x0788('0x55')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x56')))),_0x0788('0x57')],[db['sequelize']['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x58')))),_0x0788('0x59')],[db['sequelize']['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5a')))),_0x0788('0x5b')],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5c')))),_0x0788('0x5d')]]})[_0x0788('0x26')](handleEntityNotFound(_0x1722d4,null))[_0x0788('0x26')](respondWithResult(_0x1722d4,null))[_0x0788('0x44')](handleError(_0x1722d4,null));};exports[_0x0788('0x5e')]=function(_0x2a8b14,_0x59fcbc,_0xe1a934){return db[_0x0788('0x2d')][_0x0788('0x42')]({'raw':![],'where':{'CampaignId':_0x2a8b14[_0x0788('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x4f')))),'noSuchContacts'],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5f')))),_0x0788('0x52')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x54')))),_0x0788('0x55')],[db[_0x0788('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x56')))),'congestionContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x0788('0x5a')))),'abandonedContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x60')))),_0x0788('0x61')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db['sequelize'][_0x0788('0x53')](_0x0788('0x5c')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x59fcbc,null))[_0x0788('0x26')](respondWithResult(_0x59fcbc,null))[_0x0788('0x44')](handleError(_0x59fcbc,null));};exports[_0x0788('0x62')]=function(_0x219252,_0x3628d6,_0x192798){return db['VoiceQueue'][_0x0788('0x49')]({'where':{'id':_0x219252[_0x0788('0x46')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x3628d6,null))[_0x0788('0x26')](function(_0x4e0282){var _0x35c612;if(_0x4e0282){_0x35c612=squel[_0x0788('0x63')]()[_0x0788('0x64')](_0x0788('0x65'))['fromQuery'](['phone',_0x0788('0x66'),_0x0788('0x67'),_0x0788('0x68'),_0x0788('0x69'),_0x0788('0x6a'),_0x0788('0x6b')],squel[_0x0788('0x6c')]()[_0x0788('0x6d')](_0x0788('0x6e'),'phone')[_0x0788('0x6d')](_0x0788('0x6f'),_0x0788('0x66'))['field']('ANY_VALUE(ContactId)',_0x0788('0x67'))['field'](_0x0788('0x70'),_0x0788('0x68'))[_0x0788('0x6d')](_0x0788('0x71'),_0x0788('0x69'))[_0x0788('0x6d')](_0x0788('0x6f'),_0x0788('0x6a'))[_0x0788('0x6d')]('NOW()',_0x0788('0x6b'))[_0x0788('0x72')](_0x0788('0x73'))['where'](_0x0788('0x74'),_0x219252[_0x0788('0x46')]['id'][_0x0788('0x75')]())['where'](_0x0788('0x76'),_0x219252[_0x0788('0x4b')][_0x0788('0x77')][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x79'))[_0x0788('0x78')](_0x0788('0x7a'),squel[_0x0788('0x6c')]()['field'](_0x0788('0x7b'))[_0x0788('0x72')](_0x0788('0x65'))[_0x0788('0x78')](_0x0788('0x74'),_0x219252['params']['id'][_0x0788('0x75')]()))[_0x0788('0x78')](_0x0788('0x7a'),squel['select']()[_0x0788('0x6d')](_0x0788('0x7c'))[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')]('VoiceQueueId\x20=\x20?',_0x219252[_0x0788('0x46')]['id'][_0x0788('0x75')]())['where'](_0x0788('0x7d')))[_0x0788('0x7e')]('ContactId'))[_0x0788('0x75')]();return db[_0x0788('0x4e')][_0x0788('0x34')](_0x35c612);}return[];})['then'](respondWithResult(_0x3628d6,null))[_0x0788('0x44')](handleError(_0x3628d6,null));};exports[_0x0788('0x7f')]=function(_0xbb5b1d,_0x53730a,_0xddfb97){return db[_0x0788('0x80')][_0x0788('0x49')]({'where':{'id':_0xbb5b1d[_0x0788('0x46')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x53730a,null))[_0x0788('0x26')](function(_0x2545a7){var _0x174931;if(_0x2545a7){_0x174931=squel['insert']()[_0x0788('0x64')](_0x0788('0x65'))[_0x0788('0x81')]([_0x0788('0x7b'),'scheduledAt','ContactId',_0x0788('0x68'),_0x0788('0x82'),'createdAt',_0x0788('0x6b')],squel[_0x0788('0x6c')]()[_0x0788('0x6d')]('ANY_VALUE(calleridnum)','phone')[_0x0788('0x6d')](_0x0788('0x6f'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x0788('0x67'))[_0x0788('0x6d')]('ANY_VALUE(ListId)',_0x0788('0x68'))[_0x0788('0x6d')](_0x0788('0x83'),_0x0788('0x82'))[_0x0788('0x6d')]('NOW()',_0x0788('0x6a'))['field'](_0x0788('0x6f'),'updatedAt')[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x76'),_0xbb5b1d[_0x0788('0x4b')][_0x0788('0x77')][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x0788('0x6d')](_0x0788('0x7b'))[_0x0788('0x72')](_0x0788('0x65'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]()))[_0x0788('0x78')](_0x0788('0x7a'),squel[_0x0788('0x6c')]()['field']('calleridnum')[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x7d')))['group']('ContactId'))[_0x0788('0x75')]();return db[_0x0788('0x4e')][_0x0788('0x34')](_0x174931);}return[];})[_0x0788('0x26')](respondWithResult(_0x53730a,null))[_0x0788('0x44')](handleError(_0x53730a,null));};exports[_0x0788('0x85')]=function(_0x52dd97,_0x2f6851,_0x1311d7){return db[_0x0788('0x86')][_0x0788('0x87')]({'where':{'VoiceQueueId':_0x52dd97[_0x0788('0x4b')][_0x0788('0x69')],'CampaignId':_0x52dd97[_0x0788('0x4b')][_0x0788('0x82')],'ContactId':_0x52dd97[_0x0788('0x4b')]['ContactId']}})[_0x0788('0x26')](handleEntityNotFound(_0x2f6851,null))[_0x0788('0x26')](function(_0x178f52){if(_0x178f52){return _0x178f52;}return null;})[_0x0788('0x26')](respondWithResult(_0x2f6851,null))[_0x0788('0x44')](handleError(_0x2f6851,null));}; \ No newline at end of file +var _0x90b1=['uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','ListId','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','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/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','CmHopperFinal','includeAll','rows','include','find','catch','update','body'];(function(_0x51821c,_0x2e39c5){var _0x20bde8=function(_0x2d307a){while(--_0x2d307a){_0x51821c['push'](_0x51821c['shift']());}};_0x20bde8(++_0x2e39c5);}(_0x90b1,0x1bb));var _0x190b=function(_0x4f5ef9,_0x2eaea0){_0x4f5ef9=_0x4f5ef9-0x0;var _0x4e43c1=_0x90b1[_0x4f5ef9];return _0x4e43c1;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('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(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['CmHopperFinal'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':!![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['describe']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['describe']()[_0x190b('0x22')](respondWithResult(_0xadc789,null))[_0x190b('0x42')](handleError(_0xadc789,null));};exports[_0x190b('0x43')]=function(_0x505e52,_0x4cb561){if(_0x505e52[_0x190b('0x44')][_0x190b('0x45')]){delete _0x505e52[_0x190b('0x44')][_0x190b('0x45')];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'uniqueid':_0x505e52['params']['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x4cb561,null))[_0x190b('0x22')](saveUpdates(_0x505e52[_0x190b('0x44')],null))['then'](respondWithResult(_0x4cb561,null))[_0x190b('0x42')](handleError(_0x4cb561,null));};exports[_0x190b('0x46')]=function(_0x215ab6,_0x503700,_0xbc6757){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x215ab6[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db['sequelize']['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),_0x190b('0x50')],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0x503700,null))[_0x190b('0x22')](respondWithResult(_0x503700,null))['catch'](handleError(_0x503700,null));};exports[_0x190b('0x58')]=function(_0x270b59,_0xffe7cb,_0x405e04){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'CampaignId':_0x270b59[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x59')))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),'busyContacts'],[db[_0x190b('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x190b('0x5a')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x5b')))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0xffe7cb,null))['then'](respondWithResult(_0xffe7cb,null))[_0x190b('0x42')](handleError(_0xffe7cb,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2495c9,_0x348beb,_0x360d39){return db[_0x190b('0x5c')]['find']({'where':{'id':_0x2495c9[_0x190b('0x48')]['id']}})['then'](handleEntityNotFound(_0x348beb,null))[_0x190b('0x22')](function(_0x5073d2){var _0x49b60c;if(_0x5073d2){_0x49b60c=squel[_0x190b('0x5d')]()['into'](_0x190b('0x5e'))[_0x190b('0x5f')]([_0x190b('0x60'),_0x190b('0x61'),_0x190b('0x62'),'ListId',_0x190b('0x63'),_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),'phone')[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))['field'](_0x190b('0x69'),_0x190b('0x62'))[_0x190b('0x66')](_0x190b('0x6a'),'ListId')[_0x190b('0x66')](_0x190b('0x6b'),_0x190b('0x63'))['field'](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')]('NOW()',_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']())[_0x190b('0x3a')](_0x190b('0x6f'),_0x2495c9['body'][_0x190b('0x70')][_0x190b('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x190b('0x3a')](_0x190b('0x72'),squel['select']()['field'](_0x190b('0x60'))[_0x190b('0x6c')](_0x190b('0x5e'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']()))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9[_0x190b('0x48')]['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')]['query'](_0x49b60c);}return[];})['then'](respondWithResult(_0x348beb,null))[_0x190b('0x42')](handleError(_0x348beb,null));};exports[_0x190b('0x76')]=function(_0x4b988d,_0x40ac95,_0x18c5f4){return db[_0x190b('0x77')]['find']({'where':{'id':_0x4b988d[_0x190b('0x48')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x40ac95,null))['then'](function(_0x23298e){var _0x2ba27b;if(_0x23298e){_0x2ba27b=squel['insert']()[_0x190b('0x78')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x190b('0x62'),_0x190b('0x79'),'CampaignId',_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),_0x190b('0x60'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))[_0x190b('0x66')](_0x190b('0x69'),_0x190b('0x62'))['field'](_0x190b('0x6a'),'ListId')['field'](_0x190b('0x7a'),_0x190b('0x7b'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x6f'),_0x4b988d[_0x190b('0x44')][_0x190b('0x70')][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x7d'))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x60'))['from'](_0x190b('0x5e'))[_0x190b('0x3a')]('CampaignId\x20=\x20?',_0x4b988d['params']['id'][_0x190b('0x71')]()))[_0x190b('0x3a')](_0x190b('0x72'),squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')][_0x190b('0x2d')](_0x2ba27b);}return[];})[_0x190b('0x22')](respondWithResult(_0x40ac95,null))[_0x190b('0x42')](handleError(_0x40ac95,null));};exports['checkContactHopper']=function(_0x476c86,_0x298824,_0x5e7c76){return db[_0x190b('0x7e')][_0x190b('0x7f')]({'where':{'VoiceQueueId':_0x476c86[_0x190b('0x44')][_0x190b('0x63')],'CampaignId':_0x476c86[_0x190b('0x44')][_0x190b('0x7b')],'ContactId':_0x476c86[_0x190b('0x44')][_0x190b('0x62')]}})['then'](handleEntityNotFound(_0x298824,null))[_0x190b('0x22')](function(_0x1b3168){if(_0x1b3168){return _0x1b3168;}return null;})[_0x190b('0x22')](respondWithResult(_0x298824,null))[_0x190b('0x42')](handleError(_0x298824,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 546edda..09f56ef 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 _0x5228=['./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xe0364f,_0x1a462c){var _0xeaf880=function(_0x1ed559){while(--_0x1ed559){_0xe0364f['push'](_0xe0364f['shift']());}};_0xeaf880(++_0x1a462c);}(_0x5228,0x19c));var _0x8522=function(_0x119fd2,_0x5e8982){_0x119fd2=_0x119fd2-0x0;var _0xee4a8c=_0x5228[_0x119fd2];return _0xee4a8c;};'use strict';var _=require(_0x8522('0x0'));var util=require(_0x8522('0x1'));var logger=require(_0x8522('0x2'))('api');var moment=require(_0x8522('0x3'));var BPromise=require(_0x8522('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8522('0x5'));var rimraf=require(_0x8522('0x6'));var config=require(_0x8522('0x7'));var attributes=require(_0x8522('0x8'));module[_0x8522('0x9')]=function(_0x1c8253,_0x2c01d6){return _0x1c8253[_0x8522('0xa')](_0x8522('0xb'),attributes,{'tableName':_0x8522('0xc'),'paranoid':![],'indexes':[{'name':_0x8522('0xd'),'fields':[_0x8522('0xd')]},{'name':'uniqueid','fields':[_0x8522('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8751=['CmHopperFinal','cm_hopper_final','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes','define'];(function(_0xc81d38,_0xe1a6b6){var _0x46a243=function(_0x1f52b3){while(--_0x1f52b3){_0xc81d38['push'](_0xc81d38['shift']());}};_0x46a243(++_0xe1a6b6);}(_0x8751,0x15f));var _0x1875=function(_0x2581e8,_0xbc46d7){_0x2581e8=_0x2581e8-0x0;var _0x4f3c74=_0x8751[_0x2581e8];return _0x4f3c74;};'use strict';var _=require(_0x1875('0x0'));var util=require(_0x1875('0x1'));var logger=require(_0x1875('0x2'))(_0x1875('0x3'));var moment=require('moment');var BPromise=require(_0x1875('0x4'));var rp=require(_0x1875('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1875('0x6'));var attributes=require(_0x1875('0x7'));module['exports']=function(_0x358031,_0x5c2c2e){return _0x358031[_0x1875('0x8')](_0x1875('0x9'),attributes,{'tableName':_0x1875('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0x1875('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 7eb3998..60433e3 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x18dc3b,_0x353693){var _0x2a5c8b=function(_0x5ecee0){while(--_0x5ecee0){_0x18dc3b['push'](_0x18dc3b['shift']());}};_0x2a5c8b(++_0x353693);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f1ff3,_0x2736a1){_0x4f1ff3=_0x4f1ff3-0x0;var _0x1768a5=_0xb10b[_0x4f1ff3];return _0x1768a5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4d26c9,_0x134162){var _0x1c60f2=function(_0x5b866d){while(--_0x5b866d){_0x4d26c9['push'](_0x4d26c9['shift']());}};_0x1c60f2(++_0x134162);}(_0xb10b,0x12a));var _0xbb10=function(_0x59ed12,_0xf96ab6){_0x59ed12=_0x59ed12-0x0;var _0x3b6f60=_0xb10b[_0x59ed12];return _0x3b6f60;};'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 827bfbe..095423b 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 _0x6599=['get','/describe','isAuthenticated','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x6599,0x16e));var _0x9659=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0x6599[_0x38c632];return _0x12737e;};'use strict';var multer=require(_0x9659('0x0'));var util=require(_0x9659('0x1'));var path=require(_0x9659('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9659('0x3')]();var fs_extra=require(_0x9659('0x4'));var auth=require(_0x9659('0x5'));var interaction=require(_0x9659('0x6'));var config=require(_0x9659('0x7'));var controller=require(_0x9659('0x8'));router[_0x9659('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9659('0x9')](_0x9659('0xa'),auth[_0x9659('0xb')](),controller[_0x9659('0xc')]);router[_0x9659('0x9')](_0x9659('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x9659('0x9')](_0x9659('0xe'),auth[_0x9659('0xb')](),controller[_0x9659('0xf')]);router[_0x9659('0x9')](_0x9659('0x10'),auth[_0x9659('0xb')](),controller[_0x9659('0x11')]);router[_0x9659('0x12')](_0x9659('0x13'),auth[_0x9659('0xb')](),controller[_0x9659('0x14')]);router[_0x9659('0x12')](_0x9659('0x15'),auth[_0x9659('0xb')](),controller[_0x9659('0x16')]);router[_0x9659('0x12')]('/checkContactHopper',auth[_0x9659('0xb')](),controller[_0x9659('0x17')]);router[_0x9659('0x18')]('/:id',auth[_0x9659('0xb')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x542a=['show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','/:id','update','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe'];(function(_0x54e48e,_0x2c51e4){var _0x508aa4=function(_0x5aa466){while(--_0x5aa466){_0x54e48e['push'](_0x54e48e['shift']());}};_0x508aa4(++_0x2c51e4);}(_0x542a,0x71));var _0xa542=function(_0x5de0b1,_0x407bea){_0x5de0b1=_0x5de0b1-0x0;var _0x1f7498=_0x542a[_0x5de0b1];return _0x1f7498;};'use strict';var multer=require(_0xa542('0x0'));var util=require(_0xa542('0x1'));var path=require(_0xa542('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa542('0x3')]();var fs_extra=require(_0xa542('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa542('0x5'));var config=require(_0xa542('0x6'));var controller=require(_0xa542('0x7'));router[_0xa542('0x8')]('/',auth[_0xa542('0x9')](),controller['index']);router[_0xa542('0x8')](_0xa542('0xa'),auth[_0xa542('0x9')](),controller[_0xa542('0xb')]);router[_0xa542('0x8')]('/:id',auth[_0xa542('0x9')](),controller[_0xa542('0xc')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xa542('0x9')](),controller[_0xa542('0xd')]);router[_0xa542('0x8')](_0xa542('0xe'),auth[_0xa542('0x9')](),controller[_0xa542('0xf')]);router[_0xa542('0x10')](_0xa542('0x11'),auth[_0xa542('0x9')](),controller[_0xa542('0x12')]);router[_0xa542('0x10')](_0xa542('0x13'),auth[_0xa542('0x9')](),controller[_0xa542('0x14')]);router[_0xa542('0x10')](_0xa542('0x15'),auth['isAuthenticated'](),controller[_0xa542('0x16')]);router['put'](_0xa542('0x17'),auth['isAuthenticated'](),controller[_0xa542('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index da0a660..7907cfa 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 _0x96c7=['STRING','BOOLEAN','sequelize','DATE','INTEGER'];(function(_0x19af30,_0x5c43c1){var _0x4a362f=function(_0x1759e8){while(--_0x1759e8){_0x19af30['push'](_0x19af30['shift']());}};_0x4a362f(++_0x5c43c1);}(_0x96c7,0x1a1));var _0x796c=function(_0x4a4386,_0x60caab){_0x4a4386=_0x4a4386-0x0;var _0x842cb9=_0x96c7[_0x4a4386];return _0x842cb9;};'use strict';var Sequelize=require(_0x796c('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x796c('0x1')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x796c('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x796c('0x3')]},'originatecalleridname':{'type':Sequelize[_0x796c('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x796c('0x3')]},'starttime':{'type':Sequelize[_0x796c('0x1')]},'responsetime':{'type':Sequelize[_0x796c('0x1')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x796c('0x1')]},'endtime':{'type':Sequelize[_0x796c('0x1')]},'ringtime':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x796c('0x3')]},'campaigntype':{'type':Sequelize[_0x796c('0x3')]},'membername':{'type':Sequelize[_0x796c('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x796c('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x796c('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x796c('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x796c('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x796c('0x1')]},'recallme':{'type':Sequelize[_0x796c('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x796c('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x796c('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x796c('0x3')]}}; \ No newline at end of file +var _0x96dd=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x59a578,_0x300511){var _0x1475e8=function(_0x50dab3){while(--_0x50dab3){_0x59a578['push'](_0x59a578['shift']());}};_0x1475e8(++_0x300511);}(_0x96dd,0x73));var _0xd96d=function(_0x4ef1ff,_0x5090a3){_0x4ef1ff=_0x4ef1ff-0x0;var _0x3d70c1=_0x96dd[_0x4ef1ff];return _0x3d70c1;};'use strict';var Sequelize=require(_0xd96d('0x0'));module[_0xd96d('0x1')]={'state':{'type':Sequelize[_0xd96d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd96d('0x3')]},'scheduledat':{'type':Sequelize[_0xd96d('0x4')]},'countbusyretry':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd96d('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd96d('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd96d('0x3')]},'calleridnum':{'type':Sequelize[_0xd96d('0x3')]},'calleridname':{'type':Sequelize[_0xd96d('0x3')]},'starttime':{'type':Sequelize[_0xd96d('0x4')]},'responsetime':{'type':Sequelize[_0xd96d('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd96d('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd96d('0x3')]},'campaign':{'type':Sequelize[_0xd96d('0x3')]},'campaigntype':{'type':Sequelize[_0xd96d('0x3')]},'membername':{'type':Sequelize[_0xd96d('0x3')]},'reason':{'type':Sequelize[_0xd96d('0x3')]},'amd':{'type':Sequelize[_0xd96d('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd96d('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd96d('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd96d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd96d('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd96d('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd96d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd96d('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index d79427e..762b40b 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 _0x510c=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','count','includeAll','include','findAll','catch','show','params','length','options','create','describe','update','body','uniqueid','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x1d49ed,_0x56a01c){var _0x28d473=function(_0x1e8679){while(--_0x1e8679){_0x1d49ed['push'](_0x1d49ed['shift']());}};_0x28d473(++_0x56a01c);}(_0x510c,0xda));var _0xc510=function(_0x26a069,_0x132dbf){_0x26a069=_0x26a069-0x0;var _0x11f4e7=_0x510c[_0x26a069];return _0x11f4e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc510('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc510('0x1'));var rp=require(_0xc510('0x2'));var moment=require(_0xc510('0x3'));var BPromise=require(_0xc510('0x4'));var Mustache=require(_0xc510('0x5'));var util=require(_0xc510('0x6'));var path=require(_0xc510('0x7'));var sox=require(_0xc510('0x8'));var csv=require(_0xc510('0x9'));var ejs=require(_0xc510('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc510('0xb'));var squel=require(_0xc510('0xc'));var crypto=require(_0xc510('0xd'));var jsforce=require(_0xc510('0xe'));var deskjs=require(_0xc510('0xf'));var toCsv=require(_0xc510('0x9'));var querystring=require(_0xc510('0x10'));var Papa=require('papaparse');var Redis=require(_0xc510('0x11'));var authService=require(_0xc510('0x12'));var qs=require(_0xc510('0x13'));var as=require(_0xc510('0x14'));var hardwareService=require(_0xc510('0x15'));var logger=require('../../config/logger')(_0xc510('0x16'));var utils=require(_0xc510('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc510('0x18'));var db=require(_0xc510('0x19'))['db'];function respondWithStatusCode(_0x342aa9,_0x50ddd4){_0x50ddd4=_0x50ddd4||0xcc;return function(_0x4d08fb){if(_0x4d08fb){return _0x342aa9[_0xc510('0x1a')](_0x50ddd4);}return _0x342aa9['status'](_0x50ddd4)['end']();};}function respondWithResult(_0x1e8953,_0x3f33b1){_0x3f33b1=_0x3f33b1||0xc8;return function(_0x4653d1){if(_0x4653d1){return _0x1e8953[_0xc510('0x1b')](_0x3f33b1)['json'](_0x4653d1);}};}function respondWithFilteredResult(_0x39e339,_0x78a270){return function(_0x3466e0){if(_0x3466e0){var _0x2eeab7=typeof _0x78a270[_0xc510('0x1c')]===_0xc510('0x1d')&&typeof _0x78a270[_0xc510('0x1e')]==='undefined';var _0x50824b=_0x3466e0['count'];var _0x12c4d8=_0x2eeab7?0x0:_0x78a270['offset'];var _0x928c66=_0x2eeab7?_0x3466e0['count']:_0x78a270['offset']+_0x78a270[_0xc510('0x1e')];var _0x3c320b;if(_0x928c66>=_0x50824b){_0x928c66=_0x50824b;_0x3c320b=0xc8;}else{_0x3c320b=0xce;}_0x39e339[_0xc510('0x1b')](_0x3c320b);return _0x39e339[_0xc510('0x1f')](_0xc510('0x20'),_0x12c4d8+'-'+_0x928c66+'/'+_0x50824b)[_0xc510('0x21')](_0x3466e0);}return null;};}function patchUpdates(_0x50373c){return function(_0x76d6d7){try{jsonpatch[_0xc510('0x22')](_0x76d6d7,_0x50373c,!![]);}catch(_0x5725f9){return BPromise[_0xc510('0x23')](_0x5725f9);}return _0x76d6d7['save']();};}function saveUpdates(_0x387f46,_0x4bd949){return function(_0x47ed29){if(_0x47ed29){return _0x47ed29['update'](_0x387f46)[_0xc510('0x24')](function(_0x4db726){return _0x4db726;});}return null;};}function removeEntity(_0x3cbc54,_0x221d6a){return function(_0x53b967){if(_0x53b967){return _0x53b967[_0xc510('0x25')]()['then'](function(){_0x3cbc54['status'](0xcc)[_0xc510('0x26')]();});}};}function handleEntityNotFound(_0xdc532,_0x1a4bc9){return function(_0x52fde1){if(!_0x52fde1){_0xdc532[_0xc510('0x1a')](0x194);}return _0x52fde1;};}function handleError(_0x36b1df,_0x357576){_0x357576=_0x357576||0x1f4;return function(_0x5398cd){logger[_0xc510('0x27')](_0x5398cd[_0xc510('0x28')]);if(_0x5398cd[_0xc510('0x29')]){delete _0x5398cd[_0xc510('0x29')];}_0x36b1df[_0xc510('0x1b')](_0x357576)['send'](_0x5398cd);};}exports[_0xc510('0x2a')]=function(_0xa10eb,_0x7f8ccc){var _0xc7326c={},_0x3cbab5={},_0x4c0779={'count':0x0,'rows':[]};var _0x34ddce=_[_0xc510('0x2b')](db[_0xc510('0x2c')][_0xc510('0x2d')],function(_0x29688c){return{'name':_0x29688c[_0xc510('0x2e')],'type':_0x29688c['type'][_0xc510('0x2f')]};});_0x3cbab5[_0xc510('0x30')]=_[_0xc510('0x2b')](_0x34ddce,_0xc510('0x29'));_0x3cbab5[_0xc510('0x31')]=_[_0xc510('0x32')](_0xa10eb[_0xc510('0x31')]);_0x3cbab5[_0xc510('0x33')]=_['intersection'](_0x3cbab5[_0xc510('0x30')],_0x3cbab5[_0xc510('0x31')]);_0xc7326c[_0xc510('0x34')]=_[_0xc510('0x35')](_0x3cbab5[_0xc510('0x30')],qs[_0xc510('0x36')](_0xa10eb['query'][_0xc510('0x36')]));_0xc7326c[_0xc510('0x34')]=_0xc7326c[_0xc510('0x34')]['length']?_0xc7326c[_0xc510('0x34')]:_0x3cbab5[_0xc510('0x30')];if(!_0xa10eb[_0xc510('0x31')][_0xc510('0x37')]('nolimit')){_0xc7326c[_0xc510('0x1e')]=qs[_0xc510('0x1e')](_0xa10eb[_0xc510('0x31')]['limit']);_0xc7326c['offset']=qs[_0xc510('0x1c')](_0xa10eb[_0xc510('0x31')][_0xc510('0x1c')]);}_0xc7326c[_0xc510('0x38')]=qs[_0xc510('0x39')](_0xa10eb[_0xc510('0x31')][_0xc510('0x39')]);_0xc7326c['where']=qs['filters'](_[_0xc510('0x3a')](_0xa10eb[_0xc510('0x31')],_0x3cbab5[_0xc510('0x33')]),_0x34ddce);if(_0xa10eb[_0xc510('0x31')][_0xc510('0x3b')]){_0xc7326c[_0xc510('0x3c')]=_[_0xc510('0x3d')](_0xc7326c[_0xc510('0x3c')],{'$or':_[_0xc510('0x2b')](_0x34ddce,function(_0x2b5700){if(_0x2b5700[_0xc510('0x3e')]!==_0xc510('0x3f')){var _0x23a38b={};_0x23a38b[_0x2b5700[_0xc510('0x29')]]={'$like':'%'+_0xa10eb['query'][_0xc510('0x3b')]+'%'};return _0x23a38b;}})});}_0xc7326c=_[_0xc510('0x3d')]({},_0xc7326c,_0xa10eb['options']);var _0x25224d={'where':_0xc7326c[_0xc510('0x3c')]};return db[_0xc510('0x2c')]['count'](_0x25224d)[_0xc510('0x24')](function(_0x1841ea){_0x4c0779[_0xc510('0x40')]=_0x1841ea;if(_0xa10eb[_0xc510('0x31')][_0xc510('0x41')]){_0xc7326c[_0xc510('0x42')]=[{'all':!![]}];}return db[_0xc510('0x2c')][_0xc510('0x43')](_0xc7326c);})['then'](function(_0x19d273){_0x4c0779['rows']=_0x19d273;return _0x4c0779;})[_0xc510('0x24')](respondWithFilteredResult(_0x7f8ccc,_0xc7326c))[_0xc510('0x44')](handleError(_0x7f8ccc,null));};exports[_0xc510('0x45')]=function(_0x2b0a2c,_0x5f1f45){var _0x37c643={'raw':!![],'where':{'id':_0x2b0a2c[_0xc510('0x46')]['id']}},_0x19f3f2={};_0x19f3f2['model']=_[_0xc510('0x32')](db[_0xc510('0x2c')][_0xc510('0x2d')]);_0x19f3f2['query']=_['keys'](_0x2b0a2c[_0xc510('0x31')]);_0x19f3f2[_0xc510('0x33')]=_[_0xc510('0x35')](_0x19f3f2[_0xc510('0x30')],_0x19f3f2[_0xc510('0x31')]);_0x37c643[_0xc510('0x34')]=_[_0xc510('0x35')](_0x19f3f2[_0xc510('0x30')],qs[_0xc510('0x36')](_0x2b0a2c[_0xc510('0x31')][_0xc510('0x36')]));_0x37c643[_0xc510('0x34')]=_0x37c643[_0xc510('0x34')][_0xc510('0x47')]?_0x37c643[_0xc510('0x34')]:_0x19f3f2[_0xc510('0x30')];if(_0x2b0a2c[_0xc510('0x31')][_0xc510('0x41')]){_0x37c643[_0xc510('0x42')]=[{'all':!![]}];}_0x37c643=_['merge']({},_0x37c643,_0x2b0a2c[_0xc510('0x48')]);return db[_0xc510('0x2c')]['find'](_0x37c643)[_0xc510('0x24')](handleEntityNotFound(_0x5f1f45,null))[_0xc510('0x24')](respondWithResult(_0x5f1f45,null))[_0xc510('0x44')](handleError(_0x5f1f45,null));};exports['create']=function(_0x56de9a,_0x1addbb){return db['CmHopperHistory'][_0xc510('0x49')](_0x56de9a['body'],{})['then'](respondWithResult(_0x1addbb,0xc9))['catch'](handleError(_0x1addbb,null));};exports[_0xc510('0x4a')]=function(_0xc22d4b,_0x5b42fc){return db[_0xc510('0x2c')][_0xc510('0x4a')]()[_0xc510('0x24')](respondWithResult(_0x5b42fc,null))[_0xc510('0x44')](handleError(_0x5b42fc,null));};exports[_0xc510('0x4b')]=function(_0x3ce160,_0x3ec61f){if(_0x3ce160[_0xc510('0x4c')][_0xc510('0x4d')]){delete _0x3ce160[_0xc510('0x4c')]['uniqueid'];}return db[_0xc510('0x2c')][_0xc510('0x4e')]({'where':{'uniqueid':_0x3ce160[_0xc510('0x46')]['id']}})[_0xc510('0x24')](handleEntityNotFound(_0x3ec61f,null))[_0xc510('0x24')](saveUpdates(_0x3ce160[_0xc510('0x4c')],null))[_0xc510('0x24')](respondWithResult(_0x3ec61f,null))[_0xc510('0x44')](handleError(_0x3ec61f,null));}; \ No newline at end of file +var _0xfdff=['find','create','body','describe','uniqueid','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','save','update','then','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','length','options'];(function(_0x2844ae,_0x321476){var _0x3e157f=function(_0x32ed05){while(--_0x32ed05){_0x2844ae['push'](_0x2844ae['shift']());}};_0x3e157f(++_0x321476);}(_0xfdff,0x10d));var _0xffdf=function(_0x549451,_0x2eaf21){_0x549451=_0x549451-0x0;var _0x1b87ef=_0xfdff[_0x549451];return _0x1b87ef;};'use strict';var emlformat=require(_0xffdf('0x0'));var rimraf=require(_0xffdf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xffdf('0x2'));var moment=require(_0xffdf('0x3'));var BPromise=require(_0xffdf('0x4'));var Mustache=require('mustache');var util=require(_0xffdf('0x5'));var path=require('path');var sox=require(_0xffdf('0x6'));var csv=require(_0xffdf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xffdf('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xffdf('0x9'));var jsforce=require(_0xffdf('0xa'));var deskjs=require(_0xffdf('0xb'));var toCsv=require(_0xffdf('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xffdf('0xc'));var authService=require(_0xffdf('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffdf('0xe'));var logger=require(_0xffdf('0xf'))('api');var utils=require(_0xffdf('0x10'));var config=require(_0xffdf('0x11'));var licenseUtil=require(_0xffdf('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f26a,_0x1fb719){_0x1fb719=_0x1fb719||0xcc;return function(_0x10cd11){if(_0x10cd11){return _0x43f26a[_0xffdf('0x13')](_0x1fb719);}return _0x43f26a['status'](_0x1fb719)[_0xffdf('0x14')]();};}function respondWithResult(_0x516768,_0x211c9c){_0x211c9c=_0x211c9c||0xc8;return function(_0x62db7f){if(_0x62db7f){return _0x516768[_0xffdf('0x15')](_0x211c9c)[_0xffdf('0x16')](_0x62db7f);}};}function respondWithFilteredResult(_0x3e5973,_0x51cfe7){return function(_0x2b689a){if(_0x2b689a){var _0x3d7389=typeof _0x51cfe7['offset']===_0xffdf('0x17')&&typeof _0x51cfe7[_0xffdf('0x18')]===_0xffdf('0x17');var _0x4c4838=_0x2b689a[_0xffdf('0x19')];var _0x50aa26=_0x3d7389?0x0:_0x51cfe7[_0xffdf('0x1a')];var _0x40205d=_0x3d7389?_0x2b689a[_0xffdf('0x19')]:_0x51cfe7[_0xffdf('0x1a')]+_0x51cfe7['limit'];var _0x471391;if(_0x40205d>=_0x4c4838){_0x40205d=_0x4c4838;_0x471391=0xc8;}else{_0x471391=0xce;}_0x3e5973[_0xffdf('0x15')](_0x471391);return _0x3e5973[_0xffdf('0x1b')]('Content-Range',_0x50aa26+'-'+_0x40205d+'/'+_0x4c4838)[_0xffdf('0x16')](_0x2b689a);}return null;};}function patchUpdates(_0x31b064){return function(_0x5b340c){try{jsonpatch['apply'](_0x5b340c,_0x31b064,!![]);}catch(_0x2eb44d){return BPromise['reject'](_0x2eb44d);}return _0x5b340c[_0xffdf('0x1c')]();};}function saveUpdates(_0x20dab7,_0x309c4f){return function(_0x3e209f){if(_0x3e209f){return _0x3e209f[_0xffdf('0x1d')](_0x20dab7)[_0xffdf('0x1e')](function(_0x3bb785){return _0x3bb785;});}return null;};}function removeEntity(_0x38b7cc,_0x256724){return function(_0x95d763){if(_0x95d763){return _0x95d763['destroy']()[_0xffdf('0x1e')](function(){_0x38b7cc[_0xffdf('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d7f88,_0x1f4bcb){return function(_0x483db8){if(!_0x483db8){_0x1d7f88[_0xffdf('0x13')](0x194);}return _0x483db8;};}function handleError(_0x5eeb72,_0x442620){_0x442620=_0x442620||0x1f4;return function(_0x15ca51){logger['error'](_0x15ca51['stack']);if(_0x15ca51['name']){delete _0x15ca51[_0xffdf('0x1f')];}_0x5eeb72[_0xffdf('0x15')](_0x442620)['send'](_0x15ca51);};}exports[_0xffdf('0x20')]=function(_0x2d8b41,_0x484443){var _0x19b3ea={},_0x5963a9={},_0x34fc24={'count':0x0,'rows':[]};var _0x554200=_[_0xffdf('0x21')](db[_0xffdf('0x22')][_0xffdf('0x23')],function(_0x267e6b){return{'name':_0x267e6b[_0xffdf('0x24')],'type':_0x267e6b[_0xffdf('0x25')]['key']};});_0x5963a9[_0xffdf('0x26')]=_[_0xffdf('0x21')](_0x554200,_0xffdf('0x1f'));_0x5963a9[_0xffdf('0x27')]=_[_0xffdf('0x28')](_0x2d8b41[_0xffdf('0x27')]);_0x5963a9['filters']=_[_0xffdf('0x29')](_0x5963a9[_0xffdf('0x26')],_0x5963a9['query']);_0x19b3ea[_0xffdf('0x2a')]=_[_0xffdf('0x29')](_0x5963a9[_0xffdf('0x26')],qs[_0xffdf('0x2b')](_0x2d8b41[_0xffdf('0x27')][_0xffdf('0x2b')]));_0x19b3ea[_0xffdf('0x2a')]=_0x19b3ea[_0xffdf('0x2a')]['length']?_0x19b3ea[_0xffdf('0x2a')]:_0x5963a9[_0xffdf('0x26')];if(!_0x2d8b41[_0xffdf('0x27')][_0xffdf('0x2c')]('nolimit')){_0x19b3ea[_0xffdf('0x18')]=qs[_0xffdf('0x18')](_0x2d8b41[_0xffdf('0x27')]['limit']);_0x19b3ea[_0xffdf('0x1a')]=qs[_0xffdf('0x1a')](_0x2d8b41['query'][_0xffdf('0x1a')]);}_0x19b3ea[_0xffdf('0x2d')]=qs[_0xffdf('0x2e')](_0x2d8b41['query'][_0xffdf('0x2e')]);_0x19b3ea[_0xffdf('0x2f')]=qs[_0xffdf('0x30')](_[_0xffdf('0x31')](_0x2d8b41[_0xffdf('0x27')],_0x5963a9[_0xffdf('0x30')]),_0x554200);if(_0x2d8b41[_0xffdf('0x27')]['filter']){_0x19b3ea[_0xffdf('0x2f')]=_[_0xffdf('0x32')](_0x19b3ea[_0xffdf('0x2f')],{'$or':_['map'](_0x554200,function(_0x1e3320){if(_0x1e3320[_0xffdf('0x25')]!==_0xffdf('0x33')){var _0x50d485={};_0x50d485[_0x1e3320[_0xffdf('0x1f')]]={'$like':'%'+_0x2d8b41[_0xffdf('0x27')][_0xffdf('0x34')]+'%'};return _0x50d485;}})});}_0x19b3ea=_[_0xffdf('0x32')]({},_0x19b3ea,_0x2d8b41['options']);var _0x37e914={'where':_0x19b3ea[_0xffdf('0x2f')]};return db['CmHopperHistory']['count'](_0x37e914)[_0xffdf('0x1e')](function(_0x4d71da){_0x34fc24[_0xffdf('0x19')]=_0x4d71da;if(_0x2d8b41[_0xffdf('0x27')][_0xffdf('0x35')]){_0x19b3ea[_0xffdf('0x36')]=[{'all':!![]}];}return db[_0xffdf('0x22')][_0xffdf('0x37')](_0x19b3ea);})['then'](function(_0x32851f){_0x34fc24[_0xffdf('0x38')]=_0x32851f;return _0x34fc24;})[_0xffdf('0x1e')](respondWithFilteredResult(_0x484443,_0x19b3ea))[_0xffdf('0x39')](handleError(_0x484443,null));};exports['show']=function(_0xe8c2ad,_0x4292c5){var _0x31b379={'raw':!![],'where':{'id':_0xe8c2ad[_0xffdf('0x3a')]['id']}},_0x84fe2={};_0x84fe2[_0xffdf('0x26')]=_[_0xffdf('0x28')](db[_0xffdf('0x22')]['rawAttributes']);_0x84fe2[_0xffdf('0x27')]=_['keys'](_0xe8c2ad[_0xffdf('0x27')]);_0x84fe2[_0xffdf('0x30')]=_['intersection'](_0x84fe2[_0xffdf('0x26')],_0x84fe2['query']);_0x31b379[_0xffdf('0x2a')]=_[_0xffdf('0x29')](_0x84fe2[_0xffdf('0x26')],qs['fields'](_0xe8c2ad[_0xffdf('0x27')]['fields']));_0x31b379[_0xffdf('0x2a')]=_0x31b379[_0xffdf('0x2a')][_0xffdf('0x3b')]?_0x31b379[_0xffdf('0x2a')]:_0x84fe2[_0xffdf('0x26')];if(_0xe8c2ad['query'][_0xffdf('0x35')]){_0x31b379[_0xffdf('0x36')]=[{'all':!![]}];}_0x31b379=_[_0xffdf('0x32')]({},_0x31b379,_0xe8c2ad[_0xffdf('0x3c')]);return db['CmHopperHistory'][_0xffdf('0x3d')](_0x31b379)['then'](handleEntityNotFound(_0x4292c5,null))[_0xffdf('0x1e')](respondWithResult(_0x4292c5,null))['catch'](handleError(_0x4292c5,null));};exports['create']=function(_0xa4c26a,_0x4f37b0){return db['CmHopperHistory'][_0xffdf('0x3e')](_0xa4c26a[_0xffdf('0x3f')],{})[_0xffdf('0x1e')](respondWithResult(_0x4f37b0,0xc9))[_0xffdf('0x39')](handleError(_0x4f37b0,null));};exports[_0xffdf('0x40')]=function(_0x144d8f,_0x10e0de){return db[_0xffdf('0x22')]['describe']()[_0xffdf('0x1e')](respondWithResult(_0x10e0de,null))[_0xffdf('0x39')](handleError(_0x10e0de,null));};exports[_0xffdf('0x1d')]=function(_0x10d6bd,_0x5932f8){if(_0x10d6bd[_0xffdf('0x3f')][_0xffdf('0x41')]){delete _0x10d6bd['body'][_0xffdf('0x41')];}return db[_0xffdf('0x22')][_0xffdf('0x3d')]({'where':{'uniqueid':_0x10d6bd[_0xffdf('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5932f8,null))['then'](saveUpdates(_0x10d6bd[_0xffdf('0x3f')],null))['then'](respondWithResult(_0x5932f8,null))[_0xffdf('0x39')](handleError(_0x5932f8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e94cc4e..34cfe4f 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 _0x3a15=['endtime','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','CmHopperHistory','cm_hopper_history'];(function(_0x347412,_0xab844a){var _0x624e05=function(_0x2e7cdd){while(--_0x2e7cdd){_0x347412['push'](_0x347412['shift']());}};_0x624e05(++_0xab844a);}(_0x3a15,0xde));var _0x53a1=function(_0x1bbe79,_0x1707f5){_0x1bbe79=_0x1bbe79-0x0;var _0x4da933=_0x3a15[_0x1bbe79];return _0x4da933;};'use strict';var _=require(_0x53a1('0x0'));var util=require('util');var logger=require(_0x53a1('0x1'))('api');var moment=require(_0x53a1('0x2'));var BPromise=require(_0x53a1('0x3'));var rp=require(_0x53a1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x53a1('0x5'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x5acff4,_0x292b62){return _0x5acff4['define'](_0x53a1('0x6'),attributes,{'tableName':_0x53a1('0x7'),'paranoid':![],'indexes':[{'name':_0x53a1('0x8'),'fields':['endtime']},{'name':_0x53a1('0x9'),'fields':[_0x53a1('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x77d4=['exports','define','endtime','uniqueid','util','api','bluebird','request-promise','../../config/environment','./cmHopperHistory.attributes'];(function(_0x4ef721,_0x1513f3){var _0x1b035e=function(_0x1b409f){while(--_0x1b409f){_0x4ef721['push'](_0x4ef721['shift']());}};_0x1b035e(++_0x1513f3);}(_0x77d4,0x108));var _0x477d=function(_0x1b820f,_0x425eb4){_0x1b820f=_0x1b820f-0x0;var _0x423354=_0x77d4[_0x1b820f];return _0x423354;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var logger=require('../../config/logger')(_0x477d('0x1'));var moment=require('moment');var BPromise=require(_0x477d('0x2'));var rp=require(_0x477d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x477d('0x4'));var attributes=require(_0x477d('0x5'));module[_0x477d('0x6')]=function(_0x471fca,_0x2545e5){return _0x471fca[_0x477d('0x7')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x477d('0x8'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x477d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 4edd2c1..4cd36f6 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 _0x3dbb=['sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','where','COUNT'];(function(_0x311421,_0x558f91){var _0x3b279e=function(_0xfb0a01){while(--_0xfb0a01){_0x311421['push'](_0x311421['shift']());}};_0x3b279e(++_0x558f91);}(_0x3dbb,0x67));var _0xb3db=function(_0x274e0e,_0x3aace4){_0x274e0e=_0x274e0e-0x0;var _0x4ca356=_0x3dbb[_0x274e0e];return _0x4ca356;};'use strict';var _=require(_0xb3db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb3db('0x1'));var rs=require(_0xb3db('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3db('0x3'))['db'];var utils=require(_0xb3db('0x4'));var logger=require(_0xb3db('0x5'))(_0xb3db('0x6'));var config=require('../../config/environment');var jayson=require(_0xb3db('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe5b11b,_0xb11a52,_0x3e6f98){return new BPromise(function(_0x4ab503,_0x20ae30){return client['request'](_0xe5b11b,_0x3e6f98)[_0xb3db('0x8')](function(_0x43fdd4){logger['info'](_0xb3db('0x9'),_0xb11a52,_0xb3db('0xa'));logger[_0xb3db('0xb')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xb11a52,_0xb3db('0xa'),JSON[_0xb3db('0xc')](_0x43fdd4));if(_0x43fdd4[_0xb3db('0xd')]){if(_0x43fdd4[_0xb3db('0xd')][_0xb3db('0xe')]===0x1f4){logger['error'](_0xb3db('0x9'),_0xb11a52,_0x43fdd4['error'][_0xb3db('0xf')]);return _0x20ae30(_0x43fdd4[_0xb3db('0xd')][_0xb3db('0xf')]);}logger['error'](_0xb3db('0x9'),_0xb11a52,_0x43fdd4[_0xb3db('0xd')][_0xb3db('0xf')]);return _0x4ab503(_0x43fdd4['error'][_0xb3db('0xf')]);}else{logger[_0xb3db('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0xb11a52,_0xb3db('0xa'));_0x4ab503(_0x43fdd4[_0xb3db('0x11')][_0xb3db('0xf')]);}})[_0xb3db('0x12')](function(_0x38da8c){logger[_0xb3db('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0xb11a52,_0x38da8c);_0x20ae30(_0x38da8c);});});}exports[_0xb3db('0x13')]=function(_0x40939f){var _0x5dd370=this;return new Promise(function(_0x1e9e84,_0x4210aa){return db[_0xb3db('0x14')][_0xb3db('0x15')](_0x40939f[_0xb3db('0x16')],{'raw':_0x40939f['options']?_0x40939f[_0xb3db('0x17')][_0xb3db('0x18')]===undefined?!![]:![]:!![]})[_0xb3db('0x8')](function(_0x325d53){logger['info'](_0xb3db('0x13'),_0x40939f);logger[_0xb3db('0xb')](_0xb3db('0x13'),_0x40939f,JSON[_0xb3db('0xc')](_0x325d53));_0x1e9e84(_0x325d53);})[_0xb3db('0x12')](function(_0x52d719){logger[_0xb3db('0xd')]('CreateCmHopperHistory',_0x52d719[_0xb3db('0xf')],_0x40939f);_0x4210aa(_0x5dd370[_0xb3db('0xd')](0x1f4,_0x52d719[_0xb3db('0xf')]));});});};exports['AvgHandleTime']=function(_0x42cf59){var _0x391598=this;return new Promise(function(_0x46c69a,_0x2c8e16){return db[_0xb3db('0x14')]['findAll']({'raw':_0x42cf59['options']?_0x42cf59[_0xb3db('0x17')][_0xb3db('0x18')]===undefined?!![]:![]:!![],'where':_0x42cf59[_0xb3db('0x17')]?_0x42cf59[_0xb3db('0x17')][_0xb3db('0x19')]||null:null,'attributes':[[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')][_0xb3db('0x1c')]('id')),_0xb3db('0x1d')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x1f')))),_0xb3db('0x20')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2010,\x201,\x20null'))),_0xb3db('0x21')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xb3db('0x22')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x23'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xb3db('0x24')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x23'),db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x25')))),_0xb3db('0x26')]]})['then'](function(_0x5596ae){logger[_0xb3db('0x10')](_0xb3db('0x27'),_0x42cf59);logger[_0xb3db('0xb')](_0xb3db('0x27'),_0x42cf59,JSON['stringify'](_0x5596ae));_0x46c69a(_0x5596ae);})['catch'](function(_0x3e59e0){logger['error'](_0xb3db('0x27'),_0x3e59e0['message'],_0x42cf59);_0x2c8e16(_0x391598['error'](0x1f4,_0x3e59e0[_0xb3db('0xf')]));});});};exports[_0xb3db('0x28')]=function(_0x555a20){var _0x5a1880=this;return new Promise(function(_0x506f1e,_0x125a0c){return db['CmHopperHistory'][_0xb3db('0x29')]({'raw':_0x555a20[_0xb3db('0x17')]?_0x555a20['options'][_0xb3db('0x18')]===undefined?!![]:![]:!![],'where':_0x555a20[_0xb3db('0x17')]?_0x555a20[_0xb3db('0x17')][_0xb3db('0x19')]||null:null,'attributes':[[_0xb3db('0x2a'),'name'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal'](_0xb3db('0x2b')))),_0xb3db('0x2c')],[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db['sequelize']['literal'](_0xb3db('0x2d')))),_0xb3db('0x2e')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xb3db('0x1e')](_0xb3db('0x1f')))),_0xb3db('0x2f')],[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xb3db('0x30')],[db['sequelize']['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x31')))),'outboundCongestionCallsDay'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')]['literal'](_0xb3db('0x32')))),_0xb3db('0x33')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0xb3db('0x1a'),db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x34')))),_0xb3db('0x35')],[db[_0xb3db('0x1b')]['fn']('COUNT',db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x36')))),_0xb3db('0x37')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x38')))),'outboundOriginateFailureCallsDay'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x39')))),_0xb3db('0x3a')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x3b')))),_0xb3db('0x3a')],[db[_0xb3db('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xb3db('0x3c')]],'group':[_0xb3db('0x2a')]})[_0xb3db('0x8')](function(_0x4a9209){logger[_0xb3db('0x10')](_0xb3db('0x28'),_0x555a20);logger['debug'](_0xb3db('0x28'),_0x555a20,JSON[_0xb3db('0xc')](_0x4a9209));_0x506f1e(_0x4a9209);})[_0xb3db('0x12')](function(_0x31dd93){logger[_0xb3db('0xd')]('GetVoiceQueueHopperHistory',_0x31dd93['message'],_0x555a20);_0x125a0c(_0x5a1880[_0xb3db('0xd')](0x1f4,_0x31dd93[_0xb3db('0xf')]));});});};exports[_0xb3db('0x3d')]=function(_0x4be0cd){var _0xd1a45=this;return new Promise(function(_0x4cf00c,_0x329bc8){return db[_0xb3db('0x14')][_0xb3db('0x29')]({'raw':_0x4be0cd[_0xb3db('0x17')]?_0x4be0cd['options'][_0xb3db('0x18')]===undefined?!![]:![]:!![],'where':_0x4be0cd[_0xb3db('0x17')]?_0x4be0cd['options'][_0xb3db('0x19')]||null:null,'attributes':[[_0xb3db('0x2a'),_0xb3db('0x3e')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db[_0xb3db('0x1b')]['col']('id')),_0xb3db('0x3f')],[db[_0xb3db('0x1b')]['fn'](_0xb3db('0x1a'),db['sequelize']['fn']('IF',db[_0xb3db('0x1b')][_0xb3db('0x1e')](_0xb3db('0x1f')))),_0xb3db('0x40')]],'group':['campaign']})[_0xb3db('0x8')](function(_0x1075fa){logger[_0xb3db('0x10')](_0xb3db('0x3d'),_0x4be0cd);logger[_0xb3db('0xb')]('GetCampaignHopperHistory',_0x4be0cd,JSON[_0xb3db('0xc')](_0x1075fa));_0x4cf00c(_0x1075fa);})[_0xb3db('0x12')](function(_0x9a62f6){logger[_0xb3db('0xd')]('GetCampaignHopperHistory',_0x9a62f6['message'],_0x4be0cd);_0x329bc8(_0xd1a45['error'](0x1f4,_0x9a62f6[_0xb3db('0xf')]));});});}; \ No newline at end of file +var _0xcd60=['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','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0xcd60,0xf0));var _0x0cd6=function(_0x551a0a,_0x4db6c0){_0x551a0a=_0x551a0a-0x0;var _0x4c64fd=_0xcd60[_0x551a0a];return _0x4c64fd;};'use strict';var _=require(_0x0cd6('0x0'));var util=require(_0x0cd6('0x1'));var moment=require(_0x0cd6('0x2'));var BPromise=require(_0x0cd6('0x3'));var rs=require(_0x0cd6('0x4'));var fs=require('fs');var Redis=require(_0x0cd6('0x5'));var db=require(_0x0cd6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cd6('0x7'))(_0x0cd6('0x8'));var config=require(_0x0cd6('0x9'));var jayson=require(_0x0cd6('0xa'));var client=jayson[_0x0cd6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ceb47,_0x460833,_0x47c8b2){return new BPromise(function(_0x4714bf,_0x4fb298){return client[_0x0cd6('0xc')](_0x2ceb47,_0x47c8b2)[_0x0cd6('0xd')](function(_0x14f396){logger[_0x0cd6('0xe')](_0x0cd6('0xf'),_0x460833,'request\x20sent');logger[_0x0cd6('0x10')](_0x0cd6('0x11'),_0x460833,_0x0cd6('0x12'),JSON[_0x0cd6('0x13')](_0x14f396));if(_0x14f396[_0x0cd6('0x14')]){if(_0x14f396['error']['code']===0x1f4){logger[_0x0cd6('0x14')](_0x0cd6('0xf'),_0x460833,_0x14f396[_0x0cd6('0x14')]['message']);return _0x4fb298(_0x14f396[_0x0cd6('0x14')]['message']);}logger[_0x0cd6('0x14')](_0x0cd6('0xf'),_0x460833,_0x14f396[_0x0cd6('0x14')][_0x0cd6('0x15')]);return _0x4714bf(_0x14f396[_0x0cd6('0x14')][_0x0cd6('0x15')]);}else{logger[_0x0cd6('0xe')](_0x0cd6('0xf'),_0x460833,_0x0cd6('0x12'));_0x4714bf(_0x14f396[_0x0cd6('0x16')][_0x0cd6('0x15')]);}})[_0x0cd6('0x17')](function(_0x30d35c){logger[_0x0cd6('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0x460833,_0x30d35c);_0x4fb298(_0x30d35c);});});}exports[_0x0cd6('0x18')]=function(_0x202d73){var _0x48ac27=this;return new Promise(function(_0x5c37ee,_0x5bebbc){return db[_0x0cd6('0x19')]['create'](_0x202d73['body'],{'raw':_0x202d73[_0x0cd6('0x1a')]?_0x202d73['options'][_0x0cd6('0x1b')]===undefined?!![]:![]:!![]})[_0x0cd6('0xd')](function(_0x1b29b1){logger[_0x0cd6('0xe')](_0x0cd6('0x18'),_0x202d73);logger[_0x0cd6('0x10')](_0x0cd6('0x18'),_0x202d73,JSON[_0x0cd6('0x13')](_0x1b29b1));_0x5c37ee(_0x1b29b1);})['catch'](function(_0x643aa0){logger[_0x0cd6('0x14')](_0x0cd6('0x18'),_0x643aa0['message'],_0x202d73);_0x5bebbc(_0x48ac27['error'](0x1f4,_0x643aa0['message']));});});};exports[_0x0cd6('0x1c')]=function(_0x5c8b8b){var _0x5ac9c0=this;return new Promise(function(_0x4e0eb1,_0x4beec7){return db[_0x0cd6('0x19')][_0x0cd6('0x1d')]({'raw':_0x5c8b8b[_0x0cd6('0x1a')]?_0x5c8b8b[_0x0cd6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5c8b8b['options']?_0x5c8b8b[_0x0cd6('0x1a')]['where']||null:null,'attributes':[[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')][_0x0cd6('0x20')]('id')),_0x0cd6('0x21')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x23')))),_0x0cd6('0x24')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')]['literal'](_0x0cd6('0x25')))),_0x0cd6('0x26')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db['sequelize']['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x27')))),_0x0cd6('0x28')],[db[_0x0cd6('0x1e')]['fn']('AVG',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x29')))),_0x0cd6('0x2a')],[db['sequelize']['fn'](_0x0cd6('0x2b'),db[_0x0cd6('0x1e')]['fn']('IF',db['sequelize'][_0x0cd6('0x22')](_0x0cd6('0x2c')))),_0x0cd6('0x2d')]]})['then'](function(_0x2bf56d){logger[_0x0cd6('0xe')]('AvgHandleTime',_0x5c8b8b);logger[_0x0cd6('0x10')](_0x0cd6('0x1c'),_0x5c8b8b,JSON[_0x0cd6('0x13')](_0x2bf56d));_0x4e0eb1(_0x2bf56d);})['catch'](function(_0x23d159){logger[_0x0cd6('0x14')](_0x0cd6('0x1c'),_0x23d159['message'],_0x5c8b8b);_0x4beec7(_0x5ac9c0[_0x0cd6('0x14')](0x1f4,_0x23d159['message']));});});};exports[_0x0cd6('0x2e')]=function(_0x3b723b){var _0x4058e2=this;return new Promise(function(_0x5574dd,_0x2ac6ab){return db[_0x0cd6('0x19')][_0x0cd6('0x1d')]({'raw':_0x3b723b[_0x0cd6('0x1a')]?_0x3b723b[_0x0cd6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3b723b['options']?_0x3b723b[_0x0cd6('0x1a')][_0x0cd6('0x2f')]||null:null,'attributes':[[_0x0cd6('0x30'),_0x0cd6('0x31')],[db['sequelize']['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x32')))),_0x0cd6('0x33')],[db['sequelize']['fn'](_0x0cd6('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x0cd6('0x22')](_0x0cd6('0x34')))),'outboundNoAnswerCallsDay'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x23')))),'outboundAnswerCallsDay'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x35')))),_0x0cd6('0x36')],[db[_0x0cd6('0x1e')]['fn']('COUNT',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')]['literal'](_0x0cd6('0x37')))),_0x0cd6('0x38')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x39')))),'outboundDropCallsDayTimeout'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db['sequelize'][_0x0cd6('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0cd6('0x3a')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x3b')))),'outboundUnknownCallsDay'],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x0cd6('0x3c')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x3d')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0x0cd6('0x3e')],[db[_0x0cd6('0x1e')]['fn']('COUNT',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0x0cd6('0x3f')],[db[_0x0cd6('0x1e')]['fn']('COUNT',db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')](_0x0cd6('0x40')))),_0x0cd6('0x3e')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db[_0x0cd6('0x1e')][_0x0cd6('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x0cd6('0x41')]],'group':['campaign']})[_0x0cd6('0xd')](function(_0x1c0500){logger[_0x0cd6('0xe')](_0x0cd6('0x2e'),_0x3b723b);logger[_0x0cd6('0x10')](_0x0cd6('0x2e'),_0x3b723b,JSON[_0x0cd6('0x13')](_0x1c0500));_0x5574dd(_0x1c0500);})[_0x0cd6('0x17')](function(_0x4bd5dd){logger[_0x0cd6('0x14')](_0x0cd6('0x2e'),_0x4bd5dd[_0x0cd6('0x15')],_0x3b723b);_0x2ac6ab(_0x4058e2[_0x0cd6('0x14')](0x1f4,_0x4bd5dd['message']));});});};exports['GetCampaignHopperHistory']=function(_0x155c6c){var _0x49b08f=this;return new Promise(function(_0x38e284,_0x1825c3){return db[_0x0cd6('0x19')][_0x0cd6('0x1d')]({'raw':_0x155c6c[_0x0cd6('0x1a')]?_0x155c6c[_0x0cd6('0x1a')][_0x0cd6('0x1b')]===undefined?!![]:![]:!![],'where':_0x155c6c[_0x0cd6('0x1a')]?_0x155c6c['options'][_0x0cd6('0x2f')]||null:null,'attributes':[[_0x0cd6('0x30'),_0x0cd6('0x31')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')][_0x0cd6('0x20')]('id')),_0x0cd6('0x42')],[db[_0x0cd6('0x1e')]['fn'](_0x0cd6('0x1f'),db[_0x0cd6('0x1e')]['fn']('IF',db['sequelize'][_0x0cd6('0x22')](_0x0cd6('0x23')))),_0x0cd6('0x43')]],'group':[_0x0cd6('0x30')]})[_0x0cd6('0xd')](function(_0x556a11){logger[_0x0cd6('0xe')](_0x0cd6('0x44'),_0x155c6c);logger[_0x0cd6('0x10')]('GetCampaignHopperHistory',_0x155c6c,JSON[_0x0cd6('0x13')](_0x556a11));_0x38e284(_0x556a11);})[_0x0cd6('0x17')](function(_0x31b4bc){logger[_0x0cd6('0x14')](_0x0cd6('0x44'),_0x31b4bc['message'],_0x155c6c);_0x1825c3(_0x49b08f[_0x0cd6('0x14')](0x1f4,_0x31b4bc[_0x0cd6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0bdb908..1d6fcc0 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 _0x2dae=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','/:id','isAuthenticated','create','put','update'];(function(_0x526753,_0x5a3c1a){var _0x52986a=function(_0x233f7c){while(--_0x233f7c){_0x526753['push'](_0x526753['shift']());}};_0x52986a(++_0x5a3c1a);}(_0x2dae,0xff));var _0xe2da=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0x2dae[_0x1c5142];return _0x1268cb;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe2da('0x9')](_0xe2da('0xc'),auth[_0xe2da('0xd')](),controller['show']);router['post']('/',auth[_0xe2da('0xd')](),controller[_0xe2da('0xe')]);router[_0xe2da('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe2da('0x10')]);module['exports']=router; \ No newline at end of file +var _0x15d0=['../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','show','post','create','/:id','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x15d0,0xb7));var _0x015d=function(_0x5831f1,_0x358111){_0x5831f1=_0x5831f1-0x0;var _0x77ec77=_0x15d0[_0x5831f1];return _0x77ec77;};'use strict';var multer=require(_0x015d('0x0'));var util=require('util');var path=require(_0x015d('0x1'));var timeout=require(_0x015d('0x2'));var express=require('express');var router=express[_0x015d('0x3')]();var fs_extra=require(_0x015d('0x4'));var auth=require(_0x015d('0x5'));var interaction=require(_0x015d('0x6'));var config=require(_0x015d('0x7'));var controller=require(_0x015d('0x8'));router['get']('/',auth[_0x015d('0x9')](),controller[_0x015d('0xa')]);router[_0x015d('0xb')](_0x015d('0xc'),auth['isAuthenticated'](),controller[_0x015d('0xd')]);router['get']('/:id',auth[_0x015d('0x9')](),controller[_0x015d('0xe')]);router[_0x015d('0xf')]('/',auth[_0x015d('0x9')](),controller[_0x015d('0x10')]);router['put'](_0x015d('0x11'),auth[_0x015d('0x9')](),controller['update']);module[_0x015d('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c02d4cd..f3632a0 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 _0xeddd=['name','sequelize','exports','STRING'];(function(_0xc5ce8f,_0x44c5fb){var _0x3cfb03=function(_0x461fbd){while(--_0x461fbd){_0xc5ce8f['push'](_0xc5ce8f['shift']());}};_0x3cfb03(++_0x44c5fb);}(_0xeddd,0x69));var _0xdedd=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xeddd[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require(_0xdedd('0x0'));module[_0xdedd('0x1')]={'name':{'type':Sequelize[_0xdedd('0x2')],'unique':_0xdedd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xdedd('0x2')]}}; \ No newline at end of file +var _0x6f72=['exports','STRING','name'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x6f72,0xae));var _0x26f7=function(_0x93557a,_0x43aa42){_0x93557a=_0x93557a-0x0;var _0x57c4bb=_0x6f72[_0x93557a];return _0x57c4bb;};'use strict';var Sequelize=require('sequelize');module[_0x26f7('0x0')]={'name':{'type':Sequelize[_0x26f7('0x1')],'unique':_0x26f7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x26f7('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 8d52608..29ff1fd 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 _0x954d=['end','status','json','offset','undefined','limit','count','set','reject','save','update','then','get','Lists','UserProfileResource','destroy','stack','name','send','map','CmList','rawAttributes','key','model','keys','query','filters','attributes','intersection','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','includeAll','include','findAll','rows','catch','show','params','fields','length','options','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','ListId','Disposition','order','removeDispositions','ids','tags','join','isArray','push','each','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','CmContact','concat','format','raw','getContactsCsv','ContactItemType','OrderBy','select','from','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','alias','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','findOne','sequelize','transaction','addCustomFields','text','TEXT','number','Sequelize','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus'];(function(_0x3a19ac,_0x484eff){var _0x2d7461=function(_0x1aeb9d){while(--_0x1aeb9d){_0x3a19ac['push'](_0x3a19ac['shift']());}};_0x2d7461(++_0x484eff);}(_0x954d,0x129));var _0xd954=function(_0x13ce0f,_0x354d4c){_0x13ce0f=_0x13ce0f-0x0;var _0x1beae8=_0x954d[_0x13ce0f];return _0x1beae8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd954('0x0'));var zipdir=require(_0xd954('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd954('0x2'));var moment=require(_0xd954('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd954('0x4'));var path=require(_0xd954('0x5'));var sox=require(_0xd954('0x6'));var csv=require('to-csv');var ejs=require(_0xd954('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd954('0x8'));var crypto=require(_0xd954('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd954('0xa'));var toCsv=require(_0xd954('0xb'));var querystring=require(_0xd954('0xc'));var Papa=require(_0xd954('0xd'));var Redis=require(_0xd954('0xe'));var authService=require(_0xd954('0xf'));var qs=require(_0xd954('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd954('0x11'));var logger=require(_0xd954('0x12'))(_0xd954('0x13'));var utils=require(_0xd954('0x14'));var config=require(_0xd954('0x15'));var licenseUtil=require(_0xd954('0x16'));var db=require(_0xd954('0x17'))['db'];var csv_results;config[_0xd954('0x18')]=_[_0xd954('0x19')](config[_0xd954('0x18')],{'host':_0xd954('0x1a'),'port':0x18eb});var socket=require(_0xd954('0x1b'))(new Redis(config[_0xd954('0x18')]));require(_0xd954('0x1c'))[_0xd954('0x1d')](socket);function respondWithStatusCode(_0x5ba256,_0x2135d4){_0x2135d4=_0x2135d4||0xcc;return function(_0x3092fd){if(_0x3092fd){return _0x5ba256[_0xd954('0x1e')](_0x2135d4);}return _0x5ba256['status'](_0x2135d4)[_0xd954('0x1f')]();};}function respondWithResult(_0x39c0e6,_0x35e8e6){_0x35e8e6=_0x35e8e6||0xc8;return function(_0x3cf567){if(_0x3cf567){return _0x39c0e6[_0xd954('0x20')](_0x35e8e6)[_0xd954('0x21')](_0x3cf567);}};}function respondWithFilteredResult(_0x23260d,_0x397a51){return function(_0x58bd75){if(_0x58bd75){var _0x3cf7e4=typeof _0x397a51[_0xd954('0x22')]===_0xd954('0x23')&&typeof _0x397a51[_0xd954('0x24')]===_0xd954('0x23');var _0x481176=_0x58bd75[_0xd954('0x25')];var _0x1b21d3=_0x3cf7e4?0x0:_0x397a51['offset'];var _0x137dca=_0x3cf7e4?_0x58bd75[_0xd954('0x25')]:_0x397a51[_0xd954('0x22')]+_0x397a51[_0xd954('0x24')];var _0x3180ef;if(_0x137dca>=_0x481176){_0x137dca=_0x481176;_0x3180ef=0xc8;}else{_0x3180ef=0xce;}_0x23260d['status'](_0x3180ef);return _0x23260d[_0xd954('0x26')]('Content-Range',_0x1b21d3+'-'+_0x137dca+'/'+_0x481176)[_0xd954('0x21')](_0x58bd75);}return null;};}function patchUpdates(_0x482844){return function(_0x1ae683){try{jsonpatch['apply'](_0x1ae683,_0x482844,!![]);}catch(_0x537fdd){return BPromise[_0xd954('0x27')](_0x537fdd);}return _0x1ae683[_0xd954('0x28')]();};}function saveUpdates(_0x3145f4,_0x3e3b49){return function(_0x102288){if(_0x102288){return _0x102288[_0xd954('0x29')](_0x3145f4)[_0xd954('0x2a')](function(_0x4f4f81){return _0x4f4f81;});}return null;};}function removeEntity(_0x56a9c5,_0x593fe0){return function(_0x436b8e){if(_0x436b8e){return _0x436b8e['destroy']()[_0xd954('0x2a')](function(){var _0x2d2545=_0x436b8e[_0xd954('0x2b')]({'plain':!![]});var _0x1eb95c=_0xd954('0x2c');return db[_0xd954('0x2d')][_0xd954('0x2e')]({'where':{'type':_0x1eb95c,'resourceId':_0x2d2545['id']}})[_0xd954('0x2a')](function(){return _0x436b8e;});})[_0xd954('0x2a')](function(){_0x56a9c5[_0xd954('0x20')](0xcc)[_0xd954('0x1f')]();});}};}function handleEntityNotFound(_0x354d1a,_0x32e688){return function(_0x1838b3){if(!_0x1838b3){_0x354d1a[_0xd954('0x1e')](0x194);}return _0x1838b3;};}function handleError(_0x540813,_0x1a8c88){_0x1a8c88=_0x1a8c88||0x1f4;return function(_0x3726aa){logger['error'](_0x3726aa[_0xd954('0x2f')]);if(_0x3726aa[_0xd954('0x30')]){delete _0x3726aa['name'];}_0x540813['status'](_0x1a8c88)[_0xd954('0x31')](_0x3726aa);};}exports['index']=function(_0x35f6d2,_0x8ec05f){var _0xcf0628={},_0x27f0bb={},_0x414c06={'count':0x0,'rows':[]};var _0x464e80=_[_0xd954('0x32')](db[_0xd954('0x33')][_0xd954('0x34')],function(_0x1c637e){return{'name':_0x1c637e['fieldName'],'type':_0x1c637e['type'][_0xd954('0x35')]};});_0x27f0bb[_0xd954('0x36')]=_['map'](_0x464e80,_0xd954('0x30'));_0x27f0bb['query']=_[_0xd954('0x37')](_0x35f6d2[_0xd954('0x38')]);_0x27f0bb[_0xd954('0x39')]=_['intersection'](_0x27f0bb['model'],_0x27f0bb[_0xd954('0x38')]);_0xcf0628[_0xd954('0x3a')]=_[_0xd954('0x3b')](_0x27f0bb['model'],qs['fields'](_0x35f6d2['query']['fields']));_0xcf0628['attributes']=_0xcf0628[_0xd954('0x3a')]['length']?_0xcf0628[_0xd954('0x3a')]:_0x27f0bb[_0xd954('0x36')];if(!_0x35f6d2[_0xd954('0x38')][_0xd954('0x3c')](_0xd954('0x3d'))){_0xcf0628[_0xd954('0x24')]=qs['limit'](_0x35f6d2['query'][_0xd954('0x24')]);_0xcf0628[_0xd954('0x22')]=qs[_0xd954('0x22')](_0x35f6d2['query'][_0xd954('0x22')]);}_0xcf0628['order']=qs[_0xd954('0x3e')](_0x35f6d2['query'][_0xd954('0x3e')]);_0xcf0628[_0xd954('0x3f')]=qs[_0xd954('0x39')](_[_0xd954('0x40')](_0x35f6d2[_0xd954('0x38')],_0x27f0bb[_0xd954('0x39')]),_0x464e80);if(_0x35f6d2[_0xd954('0x38')][_0xd954('0x41')]){_0xcf0628[_0xd954('0x3f')]=_['merge'](_0xcf0628[_0xd954('0x3f')],{'$or':_[_0xd954('0x32')](_0x464e80,function(_0x548daa){if(_0x548daa[_0xd954('0x42')]!=='VIRTUAL'){var _0x13af9a={};_0x13af9a[_0x548daa['name']]={'$like':'%'+_0x35f6d2[_0xd954('0x38')][_0xd954('0x41')]+'%'};return _0x13af9a;}})});}_0xcf0628=_[_0xd954('0x43')]({},_0xcf0628,_0x35f6d2['options']);var _0x22f1d9={'where':_0xcf0628[_0xd954('0x3f')]};return db[_0xd954('0x33')][_0xd954('0x25')](_0x22f1d9)[_0xd954('0x2a')](function(_0x37e3b1){_0x414c06['count']=_0x37e3b1;if(_0x35f6d2[_0xd954('0x38')][_0xd954('0x44')]){_0xcf0628[_0xd954('0x45')]=[{'all':!![]}];}return db[_0xd954('0x33')][_0xd954('0x46')](_0xcf0628);})[_0xd954('0x2a')](function(_0x2d1af2){_0x414c06[_0xd954('0x47')]=_0x2d1af2;return _0x414c06;})['then'](respondWithFilteredResult(_0x8ec05f,_0xcf0628))[_0xd954('0x48')](handleError(_0x8ec05f,null));};exports[_0xd954('0x49')]=function(_0x38f746,_0x1a585e){var _0x1759ce={'raw':![],'where':{'id':_0x38f746[_0xd954('0x4a')]['id']}},_0x549926={};_0x549926['model']=_[_0xd954('0x37')](db[_0xd954('0x33')]['rawAttributes']);_0x549926[_0xd954('0x38')]=_[_0xd954('0x37')](_0x38f746['query']);_0x549926[_0xd954('0x39')]=_['intersection'](_0x549926['model'],_0x549926[_0xd954('0x38')]);_0x1759ce[_0xd954('0x3a')]=_['intersection'](_0x549926[_0xd954('0x36')],qs[_0xd954('0x4b')](_0x38f746[_0xd954('0x38')][_0xd954('0x4b')]));_0x1759ce[_0xd954('0x3a')]=_0x1759ce[_0xd954('0x3a')][_0xd954('0x4c')]?_0x1759ce[_0xd954('0x3a')]:_0x549926[_0xd954('0x36')];if(_0x38f746[_0xd954('0x38')][_0xd954('0x44')]){_0x1759ce['include']=[{'all':!![]}];}_0x1759ce=_[_0xd954('0x43')]({},_0x1759ce,_0x38f746[_0xd954('0x4d')]);return db[_0xd954('0x33')]['find'](_0x1759ce)[_0xd954('0x2a')](handleEntityNotFound(_0x1a585e,null))[_0xd954('0x2a')](respondWithResult(_0x1a585e,null))[_0xd954('0x48')](handleError(_0x1a585e,null));};exports[_0xd954('0x4e')]=function(_0x5ef7aa,_0xbc52f){return db[_0xd954('0x33')]['create'](_0x5ef7aa[_0xd954('0x4f')],{})[_0xd954('0x2a')](function(_0x54a1a2){var _0x5140bb=_0x5ef7aa[_0xd954('0x50')][_0xd954('0x2b')]({'plain':!![]});if(!_0x5140bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5140bb[_0xd954('0x51')]===_0xd954('0x50')){var _0x544716=_0x54a1a2['get']({'plain':!![]});var _0x1be9d6=_0xd954('0x2c');return db[_0xd954('0x52')]['find']({'where':{'name':_0x1be9d6,'userProfileId':_0x5140bb[_0xd954('0x53')]},'raw':!![]})[_0xd954('0x2a')](function(_0x303af2){if(_0x303af2&&_0x303af2[_0xd954('0x54')]===0x0){return db[_0xd954('0x2d')][_0xd954('0x4e')]({'name':_0x544716['name'],'resourceId':_0x544716['id'],'type':_0x303af2[_0xd954('0x30')],'sectionId':_0x303af2['id']},{})['then'](function(){return _0x54a1a2;});}else{return _0x54a1a2;}})[_0xd954('0x48')](function(_0x348979){logger[_0xd954('0x55')](_0xd954('0x56'),_0x348979);throw _0x348979;});}return _0x54a1a2;})[_0xd954('0x2a')](respondWithResult(_0xbc52f,0xc9))[_0xd954('0x48')](handleError(_0xbc52f,null));};exports[_0xd954('0x29')]=function(_0x5e77a6,_0x59f640){if(_0x5e77a6[_0xd954('0x4f')]['id']){delete _0x5e77a6[_0xd954('0x4f')]['id'];}return db[_0xd954('0x33')][_0xd954('0x57')]({'where':{'id':_0x5e77a6[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x59f640,null))[_0xd954('0x2a')](saveUpdates(_0x5e77a6[_0xd954('0x4f')],null))['then'](respondWithResult(_0x59f640,null))[_0xd954('0x48')](handleError(_0x59f640,null));};exports[_0xd954('0x2e')]=function(_0x5a757,_0x3e60f2){return db[_0xd954('0x33')][_0xd954('0x57')]({'where':{'id':_0x5a757[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x3e60f2,null))[_0xd954('0x2a')](removeEntity(_0x3e60f2,null))[_0xd954('0x48')](handleError(_0x3e60f2,null));};exports[_0xd954('0x58')]=function(_0x2da832,_0x22293c){return db['CmList'][_0xd954('0x58')]()['then'](respondWithResult(_0x22293c,null))[_0xd954('0x48')](handleError(_0x22293c,null));};exports[_0xd954('0x59')]=function(_0x345e81,_0x272700,_0x120c81){if(_0x345e81[_0xd954('0x4f')]['id']){delete _0x345e81[_0xd954('0x4f')]['id'];}return db['CmList']['find']({'where':{'id':_0x345e81['params']['id']}})['then'](handleEntityNotFound(_0x272700,null))[_0xd954('0x2a')](function(_0x1e422a){if(_0x1e422a){_0x345e81[_0xd954('0x4f')][_0xd954('0x5a')]=_0x1e422a['id'];return db[_0xd954('0x5b')]['create'](_0x345e81['body']);}})[_0xd954('0x2a')](respondWithResult(_0x272700,null))[_0xd954('0x48')](handleError(_0x272700,null));};exports['getDispositions']=function(_0xedd6c5,_0x4129ca,_0x1ef2bc){var _0x5f2e50={'raw':![],'where':{}};var _0x5e9619={};var _0x72737d={'count':0x0,'rows':[]};return db[_0xd954('0x33')]['findOne']({'where':{'id':_0xedd6c5[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x4129ca,null))[_0xd954('0x2a')](function(_0x2e1565){if(_0x2e1565){_0x5e9619[_0xd954('0x36')]=_[_0xd954('0x37')](db['Disposition'][_0xd954('0x34')]);_0x5e9619['query']=_['keys'](_0xedd6c5[_0xd954('0x38')]);_0x5e9619[_0xd954('0x39')]=_[_0xd954('0x3b')](_0x5e9619['model'],_0x5e9619['query']);_0x5f2e50[_0xd954('0x3a')]=_[_0xd954('0x3b')](_0x5e9619[_0xd954('0x36')],qs[_0xd954('0x4b')](_0xedd6c5[_0xd954('0x38')][_0xd954('0x4b')]));_0x5f2e50[_0xd954('0x3a')]=_0x5f2e50[_0xd954('0x3a')]['length']?_0x5f2e50[_0xd954('0x3a')]:_0x5e9619['model'];if(!_0xedd6c5[_0xd954('0x38')][_0xd954('0x3c')](_0xd954('0x3d'))){_0x5f2e50['limit']=qs['limit'](_0xedd6c5['query'][_0xd954('0x24')]);_0x5f2e50[_0xd954('0x22')]=qs[_0xd954('0x22')](_0xedd6c5['query'][_0xd954('0x22')]);}_0x5f2e50[_0xd954('0x5c')]=qs[_0xd954('0x3e')](_0xedd6c5[_0xd954('0x38')]['sort']);_0x5f2e50[_0xd954('0x3f')]=qs[_0xd954('0x39')](_[_0xd954('0x40')](_0xedd6c5[_0xd954('0x38')],_0x5e9619[_0xd954('0x39')]));_0x5f2e50[_0xd954('0x3f')]['ListId']=_0x2e1565['id'];if(_0xedd6c5[_0xd954('0x38')][_0xd954('0x41')]){_0x5f2e50['where']=_[_0xd954('0x43')](_0x5f2e50[_0xd954('0x3f')],{'$or':_[_0xd954('0x32')](_0x5f2e50[_0xd954('0x3a')],function(_0x126b57){var _0x1a0104={};_0x1a0104[_0x126b57]={'$like':'%'+_0xedd6c5[_0xd954('0x38')][_0xd954('0x41')]+'%'};return _0x1a0104;})});}_0x5f2e50=_[_0xd954('0x43')]({},_0x5f2e50,_0xedd6c5[_0xd954('0x4d')]);return db[_0xd954('0x5b')][_0xd954('0x25')]({'where':_0x5f2e50[_0xd954('0x3f')]})[_0xd954('0x2a')](function(_0xbf928f){_0x72737d['count']=_0xbf928f;if(_0xedd6c5['query'][_0xd954('0x44')]){_0x5f2e50[_0xd954('0x45')]=[{'all':!![]}];}return db['Disposition'][_0xd954('0x46')](_0x5f2e50);})[_0xd954('0x2a')](function(_0x391c7a){_0x72737d[_0xd954('0x47')]=_0x391c7a;return _0x72737d;});}})[_0xd954('0x2a')](respondWithFilteredResult(_0x4129ca,_0x5f2e50))[_0xd954('0x48')](handleError(_0x4129ca,null));};exports[_0xd954('0x5d')]=function(_0x38dd4e,_0x57ca85,_0x3c44a1){return db[_0xd954('0x33')]['find']({'where':{'id':_0x38dd4e[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x57ca85,null))[_0xd954('0x2a')](function(_0x16762a){if(_0x16762a){return _0x16762a[_0xd954('0x5d')](_0x38dd4e['query'][_0xd954('0x5e')]);}})[_0xd954('0x2a')](respondWithStatusCode(_0x57ca85,null))[_0xd954('0x48')](handleError(_0x57ca85,null));};exports['addContacts']=function(_0x2af458,_0x36c11f,_0x345ae4){return db[_0xd954('0x33')][_0xd954('0x57')]({'where':{'id':_0x2af458[_0xd954('0x4a')]['id']}})['then'](handleEntityNotFound(_0x36c11f,null))[_0xd954('0x2a')](function(_0x5263cc){if(_0x5263cc){var _0x1c904d=[];var _0x440f1b={'success':[],'errors':[]};return db['CmContact'][_0xd954('0x58')]()[_0xd954('0x2a')](function(_0x41fbfe){if(_0x2af458[_0xd954('0x4f')][_0xd954('0x5f')]&&_['isArray'](_0x2af458[_0xd954('0x4f')]['tags'])){if(_0x2af458[_0xd954('0x4f')][_0xd954('0x5f')]['length']){_0x2af458['body'][_0xd954('0x5f')]=_0x2af458[_0xd954('0x4f')]['tags'][_0xd954('0x60')](';')+';';}else{_0x2af458[_0xd954('0x4f')]['tags']=null;}}else{_0x2af458[_0xd954('0x4f')][_0xd954('0x5f')]=null;}if(_0x2af458[_0xd954('0x4f')]&&_[_0xd954('0x61')](_0x2af458[_0xd954('0x4f')])){for(var _0x5447c9=0x0;_0x5447c9<_0x2af458[_0xd954('0x4f')][_0xd954('0x4c')];_0x5447c9+=0x1){_0x2af458[_0xd954('0x4f')][_0x5447c9][_0xd954('0x5a')]=_0x2af458[_0xd954('0x4a')]['id'];_0x1c904d[_0xd954('0x62')](_0x2af458[_0xd954('0x4f')][_0x5447c9]);}return BPromise[_0xd954('0x63')](_0x1c904d,function(_0x532f83){return db['CmContact'][_0xd954('0x4e')](_[_0xd954('0x64')](_0x532f83,[_0xd954('0x5e'),'id'])||{},{'fields':_[_0xd954('0x37')](_0x41fbfe),'raw':!![]})[_0xd954('0x2a')](function(_0x5046b0){_0x440f1b[_0xd954('0x65')]['push'](_0x5046b0[_0xd954('0x66')]);})[_0xd954('0x48')](function(_0x492ac7){_0x440f1b[_0xd954('0x67')]['push']({'data':_0x532f83,'error':_0x492ac7[_0xd954('0x68')]});});})[_0xd954('0x2a')](function(_0x35b568){return _0x440f1b;})['catch'](function(_0x412b3e){return _0x412b3e;});}else{_0x36c11f[_0xd954('0x20')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xd954('0x2a')](respondWithResult(_0x36c11f,null))['catch'](handleError(_0x36c11f,null));};exports[_0xd954('0x69')]=function(_0x203f11,_0x27f807,_0xe89c39){var _0x3fa7cf;return db['CmList'][_0xd954('0x57')]({'where':{'id':_0x203f11['params']['id']},'include':[{'model':db[_0xd954('0x6a')],'as':_0xd954('0x6b')}]})['then'](handleEntityNotFound(_0x27f807,null))['then'](function(_0xbd4b69){if(_0xbd4b69){_0x3fa7cf=_0xbd4b69;return db[_0xd954('0x6c')]['rawAttributes'];}})[_0xd954('0x2a')](function(_0x25f06e){if(_0x25f06e){var _0x577579={};var _0x47372f={};_0x47372f[_0xd954('0x36')]=_[_0xd954('0x6d')](_[_0xd954('0x37')](_0x25f06e),_[_0xd954('0x32')](_0x3fa7cf['CustomFields'],function(_0x16c998){return util[_0xd954('0x6e')]('cf_%d',_0x16c998['id']);}));_0x47372f[_0xd954('0x38')]=_[_0xd954('0x37')](_0x203f11[_0xd954('0x38')]);_0x47372f[_0xd954('0x39')]=_['intersection'](_0x47372f[_0xd954('0x36')],_0x47372f[_0xd954('0x38')]);_0x577579[_0xd954('0x3a')]=_[_0xd954('0x3b')](_0x47372f[_0xd954('0x36')],qs[_0xd954('0x4b')](_0x203f11[_0xd954('0x38')][_0xd954('0x4b')]));_0x577579[_0xd954('0x3a')]=_0x577579['attributes'][_0xd954('0x4c')]?_0x577579['attributes']:_0x47372f[_0xd954('0x36')];if(!_0x203f11[_0xd954('0x38')][_0xd954('0x3c')](_0xd954('0x3d'))){_0x577579[_0xd954('0x24')]=qs['limit'](_0x203f11[_0xd954('0x38')]['limit']);_0x577579[_0xd954('0x22')]=qs[_0xd954('0x22')](_0x203f11[_0xd954('0x38')][_0xd954('0x22')]);}_0x577579['order']=qs[_0xd954('0x3e')](_0x203f11[_0xd954('0x38')]['sort']);_0x577579[_0xd954('0x3f')]=qs[_0xd954('0x39')](_[_0xd954('0x40')](_0x203f11['query'],_0x47372f[_0xd954('0x39')]));_0x577579[_0xd954('0x6f')]=!![];if(_0x203f11['query']['filter']){_0x577579[_0xd954('0x3f')]=_[_0xd954('0x43')](_0x577579['where'],{'$or':_[_0xd954('0x32')](_0x577579[_0xd954('0x3a')],function(_0x1bd5c0){var _0x1d2940={};_0x1d2940[_0x1bd5c0]={'$like':'%'+_0x203f11['query'][_0xd954('0x41')]+'%'};return _0x1d2940;})});}_0x577579=_[_0xd954('0x43')]({},_0x577579,_0x203f11[_0xd954('0x4d')]);return _0x3fa7cf['getContacts'](_0x577579);}})[_0xd954('0x2a')](respondWithResult(_0x27f807,null))['catch'](handleError(_0x27f807,null));};exports[_0xd954('0x70')]=function(_0x4fd056,_0x2e5563,_0x5c2c11){var _0x1237e3;var _0x5bb820;var _0x96c8b;var _0x18f768=_0x4fd056[_0xd954('0x4a')]['id'];csv_results=[];return db[_0xd954('0x71')][_0xd954('0x46')]({'attributes':['id',_0xd954('0x30')],'raw':!![],'order':[_0xd954('0x72')]})['then'](function(_0x4aec8a){_0x1237e3=_0x4aec8a;var _0x10935c=_[_0xd954('0x37')](db[_0xd954('0x6c')][_0xd954('0x34')]);return db[_0xd954('0x6a')][_0xd954('0x46')]({'raw':!![],'attributes':['id','alias']})[_0xd954('0x2a')](function(_0x5aef9d){_0x5bb820=_0x5aef9d;var _0xded965=squel[_0xd954('0x73')]()[_0xd954('0x4b')](_0x10935c)[_0xd954('0x74')]('cm_contacts','c')[_0xd954('0x3f')](_0xd954('0x75'),_0x18f768)['where']('c.deletedAt\x20is\x20null')[_0xd954('0x76')]();for(var _0x3d8720=0x0;_0x3d8720<_0x5bb820[_0xd954('0x4c')];_0x3d8720++){_0xded965[_0xd954('0x77')](_0xd954('0x78')+_0x5bb820[_0x3d8720]['id'],_0xd954('0x79')+_0x5bb820[_0x3d8720][_0xd954('0x7a')]);}for(var _0x3d8720=0x0;_0x3d8720<_0x1237e3[_0xd954('0x4c')];_0x3d8720++){_0xded965[_0xd954('0x77')](squel['select']()[_0xd954('0x77')]('item')[_0xd954('0x74')](_0xd954('0x7b'))[_0xd954('0x3f')](_0xd954('0x7c'),_0x1237e3[_0x3d8720]['id'])[_0xd954('0x3f')](_0xd954('0x7d')),'additionalPhone_'+_0x1237e3[_0x3d8720][_0xd954('0x30')]);_0xded965[_0xd954('0x77')](squel['select']()['field'](_0xd954('0x7e'))[_0xd954('0x74')](_0xd954('0x7b'))[_0xd954('0x3f')](_0xd954('0x7c'),_0x1237e3[_0x3d8720]['id'])['where']('CmContactId\x20=\x20c.id'),_0xd954('0x7f')+_0x1237e3[_0x3d8720][_0xd954('0x30')]);}var _0x18e392=[];_0x18e392[_0xd954('0x62')](_0xded965[_0xd954('0x80')]());BPromise[_0xd954('0x63')](_0x18e392,handleQuery)[_0xd954('0x2a')](function(_0x128678){handleQuery(_0xded965['toString']());var _0x2ac840=csv_results[0x0];if(!_[_0xd954('0x81')](_0x2ac840)){var _0x146872=toCsv(_0x2ac840);var _0x20a734=Date[_0xd954('0x82')]();fs[_0xd954('0x83')](util['format'](_0xd954('0x84'),_0x18f768,_0x20a734),_0x146872);_0x2e5563[_0xd954('0x85')](_0xd954('0x86'),_0xd954('0x87')+util[_0xd954('0x6e')](_0xd954('0x88'),_0x18f768,_0x20a734));_0x2e5563[_0xd954('0x85')]('Content-type',_0xd954('0x89'));return _0x2e5563['download'](util[_0xd954('0x6e')](_0xd954('0x84'),_0x18f768,_0x20a734));}else{return _0x2e5563['sendStatus'](0xcc);}});});});};exports[_0xd954('0x8a')]=function(_0x22f4d6,_0x408b2b,_0x544f38){var _0xb0118;delete _0x22f4d6[_0xd954('0x4f')]['id'];return db[_0xd954('0x33')][_0xd954('0x8b')]({'where':{'id':_0x22f4d6['params']['id']}})['then'](handleEntityNotFound(_0x408b2b,null))[_0xd954('0x2a')](function(_0x433bcd){if(_0x433bcd){return db[_0xd954('0x8c')][_0xd954('0x8d')](function(_0x7a4441){return db['CmCustomField']['create'](_0x22f4d6[_0xd954('0x4f')],{'transaction':_0x7a4441})[_0xd954('0x2a')](function(_0x3dc7a0){_0xb0118=_0x3dc7a0;return _0x433bcd[_0xd954('0x8e')](_0x3dc7a0,{'transaction':_0x7a4441});})[_0xd954('0x2a')](function(){var _0x1080d1={'type':db['Sequelize']['TEXT'],'transaction':_0x7a4441};switch(_0x22f4d6[_0xd954('0x4f')][_0xd954('0x42')]){case _0xd954('0x8f'):_0x1080d1[_0xd954('0x42')]=db['Sequelize'][_0xd954('0x90')];break;case _0xd954('0x91'):_0x1080d1[_0xd954('0x42')]=db[_0xd954('0x92')][_0xd954('0x93')];break;case _0xd954('0x94'):_0x1080d1[_0xd954('0x42')]=db[_0xd954('0x92')]['BOOLEAN'];_0x1080d1[_0xd954('0x95')]=![];break;default:}return db[_0xd954('0x8c')][_0xd954('0x96')][_0xd954('0x97')](_0xd954('0x98'),util[_0xd954('0x6e')]('cf_%s',_0xb0118['id']),_0x1080d1);})[_0xd954('0x2a')](function(){return _0xb0118;});});}})[_0xd954('0x2a')](respondWithResult(_0x408b2b,null))[_0xd954('0x48')](handleError(_0x408b2b,null));};exports[_0xd954('0x99')]=function(_0x2b2f47,_0x3967a8,_0x5dfc98){var _0x4372ac={};var _0xf194d8={};var _0x4e00ea;var _0x5636c5;return db[_0xd954('0x33')]['findOne']({'where':{'id':_0x2b2f47[_0xd954('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3967a8,null))[_0xd954('0x2a')](function(_0x333c3c){if(_0x333c3c){_0x4e00ea=_0x333c3c;_0xf194d8[_0xd954('0x36')]=_[_0xd954('0x37')](db['CmCustomField'][_0xd954('0x34')]);_0xf194d8[_0xd954('0x38')]=_[_0xd954('0x37')](_0x2b2f47['query']);_0xf194d8[_0xd954('0x39')]=_[_0xd954('0x3b')](_0xf194d8[_0xd954('0x36')],_0xf194d8[_0xd954('0x38')]);_0x4372ac['attributes']=_['intersection'](_0xf194d8[_0xd954('0x36')],qs[_0xd954('0x4b')](_0x2b2f47[_0xd954('0x38')]['fields']));_0x4372ac['attributes']=_0x4372ac['attributes'][_0xd954('0x4c')]?_0x4372ac['attributes']:_0xf194d8[_0xd954('0x36')];_0x4372ac[_0xd954('0x5c')]=qs[_0xd954('0x3e')](_0x2b2f47[_0xd954('0x38')][_0xd954('0x3e')]);_0x4372ac[_0xd954('0x3f')]=qs[_0xd954('0x39')](_[_0xd954('0x40')](_0x2b2f47[_0xd954('0x38')],_0xf194d8[_0xd954('0x39')]));_0x4372ac[_0xd954('0x3f')]=_[_0xd954('0x43')](_0x4372ac[_0xd954('0x3f')],{'$or':[{'ListId':_0x333c3c['id']},{'ListId':null}]});if(_0x2b2f47[_0xd954('0x38')][_0xd954('0x41')]){_0x4372ac['where']=_[_0xd954('0x43')](_0x4372ac[_0xd954('0x3f')],{'$or':_[_0xd954('0x32')](_0x4372ac[_0xd954('0x3a')],function(_0x4c54c5){var _0x3e3a2c={};_0x3e3a2c[_0x4c54c5]={'$like':'%'+_0x2b2f47['query']['filter']+'%'};return _0x3e3a2c;})});}_0x4372ac=_['merge']({},_0x4372ac,_0x2b2f47[_0xd954('0x4d')]);return db['CmCustomField'][_0xd954('0x9a')](_0x4372ac);}})[_0xd954('0x2a')](respondWithResult(_0x3967a8,null))[_0xd954('0x48')](handleError(_0x3967a8,null));};exports[_0xd954('0x9b')]=function(_0x34e72e,_0x548090){return db['CmCustomField'][_0xd954('0x9a')]({'where':{'ListId':null}})[_0xd954('0x2a')](handleEntityNotFound(_0x548090,null))[_0xd954('0x2a')](function(_0x8611a8){return _0x8611a8;})[_0xd954('0x2a')](respondWithResult(_0x548090,null))[_0xd954('0x48')](handleError(_0x548090,null));};exports[_0xd954('0x9c')]=function(_0x2214f4,_0x30ecef,_0x528c81){return db[_0xd954('0x33')][_0xd954('0x57')]({'where':{'id':_0x2214f4['params']['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x30ecef,null))['then'](function(_0x121e3a){if(_0x121e3a){return _0x121e3a[_0xd954('0x9c')](_0x2214f4['body'][_0xd954('0x5e')],_[_0xd954('0x64')](_0x2214f4[_0xd954('0x4f')],[_0xd954('0x5e'),'id'])||{})[_0xd954('0x9d')](function(_0x7b746c){for(var _0x235e96=0x0;_0x235e96<_0x2214f4[_0xd954('0x4f')][_0xd954('0x5e')][_0xd954('0x4c')];_0x235e96+=0x1){socket[_0xd954('0x9e')](_0xd954('0x9f'),{'UserId':Number(_0x2214f4[_0xd954('0x4f')][_0xd954('0x5e')][_0x235e96]),'CmListId':Number(_0x2214f4['params']['id'])});}return _0x7b746c;});}})[_0xd954('0x2a')](respondWithResult(_0x30ecef,null))[_0xd954('0x48')](handleError(_0x30ecef,null));};exports[_0xd954('0xa0')]=function(_0x1c8846,_0x24c5cd,_0xeb1b3a){return db['CmList'][_0xd954('0x57')]({'where':{'id':_0x1c8846[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x24c5cd,null))[_0xd954('0x2a')](function(_0x1cad3f){if(_0x1cad3f){return _0x1cad3f[_0xd954('0xa0')](_0x1c8846[_0xd954('0x38')][_0xd954('0x5e')])[_0xd954('0x2a')](function(){if(_['isArray'](_0x1c8846[_0xd954('0x38')]['ids'])){for(var _0x26d3f8=0x0;_0x26d3f8<_0x1c8846[_0xd954('0x38')][_0xd954('0x5e')][_0xd954('0x4c')];_0x26d3f8+=0x1){socket[_0xd954('0x9e')](_0xd954('0xa1'),{'UserId':Number(_0x1c8846[_0xd954('0x38')][_0xd954('0x5e')][_0x26d3f8]),'CmListId':Number(_0x1c8846[_0xd954('0x4a')]['id'])});}}else{socket['emit'](_0xd954('0xa1'),{'UserId':Number(_0x1c8846['query'][_0xd954('0x5e')]),'CmListId':Number(_0x1c8846[_0xd954('0x4a')]['id'])});}});}})[_0xd954('0x2a')](respondWithStatusCode(_0x24c5cd,null))[_0xd954('0x48')](handleError(_0x24c5cd,null));};exports[_0xd954('0xa2')]=function(_0x3fe14b,_0x7cfe3e,_0x25177f){var _0x2cdcdc={};var _0xd49b0f={};var _0x14f82e;var _0x2a040b;return db[_0xd954('0x33')][_0xd954('0x8b')]({'where':{'id':_0x3fe14b[_0xd954('0x4a')]['id']}})[_0xd954('0x2a')](handleEntityNotFound(_0x7cfe3e,null))[_0xd954('0x2a')](function(_0x4ebe8f){if(_0x4ebe8f){_0x14f82e=_0x4ebe8f;_0xd49b0f['model']=_['keys'](db['User'][_0xd954('0x34')]);_0xd49b0f[_0xd954('0x38')]=_[_0xd954('0x37')](_0x3fe14b[_0xd954('0x38')]);_0xd49b0f['filters']=_[_0xd954('0x3b')](_0xd49b0f[_0xd954('0x36')],_0xd49b0f[_0xd954('0x38')]);_0x2cdcdc[_0xd954('0x3a')]=_[_0xd954('0x3b')](_0xd49b0f[_0xd954('0x36')],qs[_0xd954('0x4b')](_0x3fe14b['query'][_0xd954('0x4b')]));_0x2cdcdc['attributes']=_0x2cdcdc['attributes'][_0xd954('0x4c')]?_0x2cdcdc['attributes']:_0xd49b0f[_0xd954('0x36')];_0x2cdcdc[_0xd954('0x5c')]=qs[_0xd954('0x3e')](_0x3fe14b['query']['sort']);_0x2cdcdc[_0xd954('0x3f')]=qs[_0xd954('0x39')](_[_0xd954('0x40')](_0x3fe14b[_0xd954('0x38')],_0xd49b0f[_0xd954('0x39')]));if(_0x3fe14b[_0xd954('0x38')][_0xd954('0x41')]){_0x2cdcdc['where']=_[_0xd954('0x43')](_0x2cdcdc['where'],{'$or':_[_0xd954('0x32')](_0x2cdcdc[_0xd954('0x3a')],function(_0x24d312){var _0xf5af3f={};_0xf5af3f[_0x24d312]={'$like':'%'+_0x3fe14b[_0xd954('0x38')]['filter']+'%'};return _0xf5af3f;})});}_0x2cdcdc=_[_0xd954('0x43')]({},_0x2cdcdc,_0x3fe14b[_0xd954('0x4d')]);return _0x14f82e[_0xd954('0xa2')](_0x2cdcdc);}})['then'](function(_0x4abe27){if(_0x4abe27){_0x2a040b=_0x4abe27[_0xd954('0x4c')];if(!_0x3fe14b[_0xd954('0x38')][_0xd954('0x3c')](_0xd954('0x3d'))){_0x2cdcdc[_0xd954('0x24')]=qs[_0xd954('0x24')](_0x3fe14b[_0xd954('0x38')][_0xd954('0x24')]);_0x2cdcdc[_0xd954('0x22')]=qs[_0xd954('0x22')](_0x3fe14b[_0xd954('0x38')][_0xd954('0x22')]);}return _0x14f82e[_0xd954('0xa2')](_0x2cdcdc);}})[_0xd954('0x2a')](function(_0x133a26){if(_0x133a26){return _0x133a26?{'count':_0x2a040b,'rows':_0x133a26}:null;}})[_0xd954('0x2a')](respondWithResult(_0x7cfe3e,null))[_0xd954('0x48')](handleError(_0x7cfe3e,null));};function handleQuery(_0xb2d6f6){logger[_0xd954('0xa3')](_0xb2d6f6);return db[_0xd954('0x8c')][_0xd954('0x38')](_0xb2d6f6)[_0xd954('0x9d')](function(_0x1dddcb){csv_results[_0xd954('0x62')](_0x1dddcb);})[_0xd954('0x48')](function(_0x247f0e){logger['error'](_0x247f0e[_0xd954('0x68')]);});} \ No newline at end of file +var _0x680c=['setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','getAgents','User','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','Lists','end','error','stack','name','send','index','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','Disposition','rawAttributes','length','nolimit','pick','ListId','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync'];(function(_0x163999,_0x5c8a82){var _0x52dfce=function(_0x5d5e2f){while(--_0x5d5e2f){_0x163999['push'](_0x163999['shift']());}};_0x52dfce(++_0x5c8a82);}(_0x680c,0xc2));var _0xc680=function(_0x26a351,_0x5dd04c){_0x26a351=_0x26a351-0x0;var _0x1ef7fe=_0x680c[_0x26a351];return _0x1ef7fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc680('0x0'));var zipdir=require(_0xc680('0x1'));var jsonpatch=require(_0xc680('0x2'));var rp=require(_0xc680('0x3'));var moment=require(_0xc680('0x4'));var BPromise=require(_0xc680('0x5'));var Mustache=require(_0xc680('0x6'));var util=require(_0xc680('0x7'));var path=require(_0xc680('0x8'));var sox=require(_0xc680('0x9'));var csv=require(_0xc680('0xa'));var ejs=require(_0xc680('0xb'));var fs=require('fs');var fs_extra=require(_0xc680('0xc'));var _=require('lodash');var squel=require(_0xc680('0xd'));var crypto=require(_0xc680('0xe'));var jsforce=require(_0xc680('0xf'));var deskjs=require(_0xc680('0x10'));var toCsv=require(_0xc680('0xa'));var querystring=require(_0xc680('0x11'));var Papa=require('papaparse');var Redis=require(_0xc680('0x12'));var authService=require(_0xc680('0x13'));var qs=require(_0xc680('0x14'));var as=require(_0xc680('0x15'));var hardwareService=require(_0xc680('0x16'));var logger=require(_0xc680('0x17'))(_0xc680('0x18'));var utils=require(_0xc680('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc680('0x1a'));var db=require(_0xc680('0x1b'))['db'];var csv_results;config[_0xc680('0x1c')]=_['defaults'](config[_0xc680('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xc680('0x1d'))(new Redis(config[_0xc680('0x1c')]));require('./cmList.socket')[_0xc680('0x1e')](socket);function respondWithStatusCode(_0x11e3dc,_0x4aa7bd){_0x4aa7bd=_0x4aa7bd||0xcc;return function(_0x344534){if(_0x344534){return _0x11e3dc[_0xc680('0x1f')](_0x4aa7bd);}return _0x11e3dc[_0xc680('0x20')](_0x4aa7bd)['end']();};}function respondWithResult(_0x41562c,_0x51e2ad){_0x51e2ad=_0x51e2ad||0xc8;return function(_0x317332){if(_0x317332){return _0x41562c[_0xc680('0x20')](_0x51e2ad)[_0xc680('0x21')](_0x317332);}};}function respondWithFilteredResult(_0x152f2d,_0xa50a62){return function(_0x38c331){if(_0x38c331){var _0x4be01b=typeof _0xa50a62['offset']===_0xc680('0x22')&&typeof _0xa50a62['limit']==='undefined';var _0x5169e1=_0x38c331[_0xc680('0x23')];var _0x1fcff6=_0x4be01b?0x0:_0xa50a62[_0xc680('0x24')];var _0x344a17=_0x4be01b?_0x38c331['count']:_0xa50a62[_0xc680('0x24')]+_0xa50a62[_0xc680('0x25')];var _0x196cd9;if(_0x344a17>=_0x5169e1){_0x344a17=_0x5169e1;_0x196cd9=0xc8;}else{_0x196cd9=0xce;}_0x152f2d[_0xc680('0x20')](_0x196cd9);return _0x152f2d[_0xc680('0x26')](_0xc680('0x27'),_0x1fcff6+'-'+_0x344a17+'/'+_0x5169e1)[_0xc680('0x21')](_0x38c331);}return null;};}function patchUpdates(_0x310fed){return function(_0x338b8e){try{jsonpatch[_0xc680('0x28')](_0x338b8e,_0x310fed,!![]);}catch(_0x14fadd){return BPromise['reject'](_0x14fadd);}return _0x338b8e[_0xc680('0x29')]();};}function saveUpdates(_0x5edbd8,_0x15576a){return function(_0x4f726e){if(_0x4f726e){return _0x4f726e['update'](_0x5edbd8)[_0xc680('0x2a')](function(_0x3d7187){return _0x3d7187;});}return null;};}function removeEntity(_0x172263,_0x2f6b04){return function(_0x1ec569){if(_0x1ec569){return _0x1ec569[_0xc680('0x2b')]()[_0xc680('0x2a')](function(){var _0x4bf55f=_0x1ec569[_0xc680('0x2c')]({'plain':!![]});var _0x3878ec=_0xc680('0x2d');return db['UserProfileResource'][_0xc680('0x2b')]({'where':{'type':_0x3878ec,'resourceId':_0x4bf55f['id']}})[_0xc680('0x2a')](function(){return _0x1ec569;});})[_0xc680('0x2a')](function(){_0x172263[_0xc680('0x20')](0xcc)[_0xc680('0x2e')]();});}};}function handleEntityNotFound(_0x426460,_0x32a632){return function(_0x435501){if(!_0x435501){_0x426460[_0xc680('0x1f')](0x194);}return _0x435501;};}function handleError(_0x29d163,_0x4123f2){_0x4123f2=_0x4123f2||0x1f4;return function(_0x1ab731){logger[_0xc680('0x2f')](_0x1ab731[_0xc680('0x30')]);if(_0x1ab731[_0xc680('0x31')]){delete _0x1ab731[_0xc680('0x31')];}_0x29d163['status'](_0x4123f2)[_0xc680('0x32')](_0x1ab731);};}exports[_0xc680('0x33')]=function(_0x3fa446,_0x28199c){var _0xec1f54={},_0x50c819={},_0x45ee4c={'count':0x0,'rows':[]};var _0x220160=_[_0xc680('0x34')](db[_0xc680('0x35')]['rawAttributes'],function(_0x16f617){return{'name':_0x16f617[_0xc680('0x36')],'type':_0x16f617[_0xc680('0x37')][_0xc680('0x38')]};});_0x50c819[_0xc680('0x39')]=_[_0xc680('0x34')](_0x220160,_0xc680('0x31'));_0x50c819[_0xc680('0x3a')]=_[_0xc680('0x3b')](_0x3fa446[_0xc680('0x3a')]);_0x50c819[_0xc680('0x3c')]=_[_0xc680('0x3d')](_0x50c819[_0xc680('0x39')],_0x50c819[_0xc680('0x3a')]);_0xec1f54[_0xc680('0x3e')]=_[_0xc680('0x3d')](_0x50c819[_0xc680('0x39')],qs[_0xc680('0x3f')](_0x3fa446['query'][_0xc680('0x3f')]));_0xec1f54[_0xc680('0x3e')]=_0xec1f54[_0xc680('0x3e')]['length']?_0xec1f54[_0xc680('0x3e')]:_0x50c819['model'];if(!_0x3fa446[_0xc680('0x3a')][_0xc680('0x40')]('nolimit')){_0xec1f54[_0xc680('0x25')]=qs[_0xc680('0x25')](_0x3fa446[_0xc680('0x3a')][_0xc680('0x25')]);_0xec1f54['offset']=qs['offset'](_0x3fa446[_0xc680('0x3a')]['offset']);}_0xec1f54[_0xc680('0x41')]=qs[_0xc680('0x42')](_0x3fa446[_0xc680('0x3a')][_0xc680('0x42')]);_0xec1f54[_0xc680('0x43')]=qs['filters'](_['pick'](_0x3fa446['query'],_0x50c819['filters']),_0x220160);if(_0x3fa446[_0xc680('0x3a')][_0xc680('0x44')]){_0xec1f54[_0xc680('0x43')]=_[_0xc680('0x45')](_0xec1f54[_0xc680('0x43')],{'$or':_[_0xc680('0x34')](_0x220160,function(_0x4fb449){if(_0x4fb449[_0xc680('0x37')]!==_0xc680('0x46')){var _0x442d9a={};_0x442d9a[_0x4fb449[_0xc680('0x31')]]={'$like':'%'+_0x3fa446[_0xc680('0x3a')][_0xc680('0x44')]+'%'};return _0x442d9a;}})});}_0xec1f54=_['merge']({},_0xec1f54,_0x3fa446[_0xc680('0x47')]);var _0x29de8c={'where':_0xec1f54[_0xc680('0x43')]};return db[_0xc680('0x35')][_0xc680('0x23')](_0x29de8c)[_0xc680('0x2a')](function(_0x2f3ef3){_0x45ee4c[_0xc680('0x23')]=_0x2f3ef3;if(_0x3fa446['query'][_0xc680('0x48')]){_0xec1f54['include']=[{'all':!![]}];}return db[_0xc680('0x35')][_0xc680('0x49')](_0xec1f54);})['then'](function(_0x1cccee){_0x45ee4c[_0xc680('0x4a')]=_0x1cccee;return _0x45ee4c;})[_0xc680('0x2a')](respondWithFilteredResult(_0x28199c,_0xec1f54))[_0xc680('0x4b')](handleError(_0x28199c,null));};exports[_0xc680('0x4c')]=function(_0x123b81,_0xd07632){var _0x445dc5={'raw':![],'where':{'id':_0x123b81[_0xc680('0x4d')]['id']}},_0xf0e382={};_0xf0e382[_0xc680('0x39')]=_[_0xc680('0x3b')](db['CmList']['rawAttributes']);_0xf0e382[_0xc680('0x3a')]=_['keys'](_0x123b81['query']);_0xf0e382[_0xc680('0x3c')]=_['intersection'](_0xf0e382[_0xc680('0x39')],_0xf0e382[_0xc680('0x3a')]);_0x445dc5[_0xc680('0x3e')]=_[_0xc680('0x3d')](_0xf0e382[_0xc680('0x39')],qs[_0xc680('0x3f')](_0x123b81['query'][_0xc680('0x3f')]));_0x445dc5[_0xc680('0x3e')]=_0x445dc5[_0xc680('0x3e')]['length']?_0x445dc5[_0xc680('0x3e')]:_0xf0e382['model'];if(_0x123b81['query'][_0xc680('0x48')]){_0x445dc5[_0xc680('0x4e')]=[{'all':!![]}];}_0x445dc5=_[_0xc680('0x45')]({},_0x445dc5,_0x123b81[_0xc680('0x47')]);return db['CmList'][_0xc680('0x4f')](_0x445dc5)['then'](handleEntityNotFound(_0xd07632,null))[_0xc680('0x2a')](respondWithResult(_0xd07632,null))[_0xc680('0x4b')](handleError(_0xd07632,null));};exports[_0xc680('0x50')]=function(_0x21263f,_0x30a6cc){return db[_0xc680('0x35')][_0xc680('0x50')](_0x21263f[_0xc680('0x51')],{})[_0xc680('0x2a')](function(_0x2ed53b){var _0x3f5661=_0x21263f[_0xc680('0x52')][_0xc680('0x2c')]({'plain':!![]});if(!_0x3f5661)throw new Error(_0xc680('0x53'));if(_0x3f5661['role']===_0xc680('0x52')){var _0x23e014=_0x2ed53b[_0xc680('0x2c')]({'plain':!![]});var _0x455853='Lists';return db['UserProfileSection']['find']({'where':{'name':_0x455853,'userProfileId':_0x3f5661[_0xc680('0x54')]},'raw':!![]})['then'](function(_0x2c8ee7){if(_0x2c8ee7&&_0x2c8ee7[_0xc680('0x55')]===0x0){return db[_0xc680('0x56')][_0xc680('0x50')]({'name':_0x23e014[_0xc680('0x31')],'resourceId':_0x23e014['id'],'type':_0x2c8ee7[_0xc680('0x31')],'sectionId':_0x2c8ee7['id']},{})[_0xc680('0x2a')](function(){return _0x2ed53b;});}else{return _0x2ed53b;}})[_0xc680('0x4b')](function(_0xc5f26d){logger[_0xc680('0x2f')](_0xc680('0x57'),_0xc5f26d);throw _0xc5f26d;});}return _0x2ed53b;})[_0xc680('0x2a')](respondWithResult(_0x30a6cc,0xc9))[_0xc680('0x4b')](handleError(_0x30a6cc,null));};exports[_0xc680('0x58')]=function(_0xbdf73b,_0x2656ec){if(_0xbdf73b[_0xc680('0x51')]['id']){delete _0xbdf73b[_0xc680('0x51')]['id'];}return db[_0xc680('0x35')]['find']({'where':{'id':_0xbdf73b[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x2656ec,null))[_0xc680('0x2a')](saveUpdates(_0xbdf73b[_0xc680('0x51')],null))['then'](respondWithResult(_0x2656ec,null))[_0xc680('0x4b')](handleError(_0x2656ec,null));};exports[_0xc680('0x2b')]=function(_0x44f694,_0x56a4eb){return db[_0xc680('0x35')]['find']({'where':{'id':_0x44f694[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x56a4eb,null))['then'](removeEntity(_0x56a4eb,null))['catch'](handleError(_0x56a4eb,null));};exports[_0xc680('0x59')]=function(_0x100218,_0x361049){return db[_0xc680('0x35')]['describe']()[_0xc680('0x2a')](respondWithResult(_0x361049,null))['catch'](handleError(_0x361049,null));};exports['addDisposition']=function(_0x2ea0a3,_0x5aabde,_0x43f68e){if(_0x2ea0a3[_0xc680('0x51')]['id']){delete _0x2ea0a3[_0xc680('0x51')]['id'];}return db[_0xc680('0x35')][_0xc680('0x4f')]({'where':{'id':_0x2ea0a3['params']['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x5aabde,null))[_0xc680('0x2a')](function(_0x4146ee){if(_0x4146ee){_0x2ea0a3[_0xc680('0x51')]['ListId']=_0x4146ee['id'];return db['Disposition'][_0xc680('0x50')](_0x2ea0a3[_0xc680('0x51')]);}})['then'](respondWithResult(_0x5aabde,null))[_0xc680('0x4b')](handleError(_0x5aabde,null));};exports['getDispositions']=function(_0x9e459a,_0x25463f,_0x450059){var _0x31aec6={'raw':![],'where':{}};var _0x4443c8={};var _0x5bbd8e={'count':0x0,'rows':[]};return db[_0xc680('0x35')][_0xc680('0x5a')]({'where':{'id':_0x9e459a['params']['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x25463f,null))[_0xc680('0x2a')](function(_0x9bd6ca){if(_0x9bd6ca){_0x4443c8['model']=_[_0xc680('0x3b')](db[_0xc680('0x5b')][_0xc680('0x5c')]);_0x4443c8[_0xc680('0x3a')]=_[_0xc680('0x3b')](_0x9e459a['query']);_0x4443c8[_0xc680('0x3c')]=_[_0xc680('0x3d')](_0x4443c8[_0xc680('0x39')],_0x4443c8['query']);_0x31aec6['attributes']=_['intersection'](_0x4443c8['model'],qs[_0xc680('0x3f')](_0x9e459a[_0xc680('0x3a')][_0xc680('0x3f')]));_0x31aec6[_0xc680('0x3e')]=_0x31aec6[_0xc680('0x3e')][_0xc680('0x5d')]?_0x31aec6[_0xc680('0x3e')]:_0x4443c8['model'];if(!_0x9e459a[_0xc680('0x3a')]['hasOwnProperty'](_0xc680('0x5e'))){_0x31aec6[_0xc680('0x25')]=qs['limit'](_0x9e459a[_0xc680('0x3a')]['limit']);_0x31aec6['offset']=qs['offset'](_0x9e459a[_0xc680('0x3a')][_0xc680('0x24')]);}_0x31aec6[_0xc680('0x41')]=qs['sort'](_0x9e459a[_0xc680('0x3a')][_0xc680('0x42')]);_0x31aec6[_0xc680('0x43')]=qs[_0xc680('0x3c')](_[_0xc680('0x5f')](_0x9e459a[_0xc680('0x3a')],_0x4443c8[_0xc680('0x3c')]));_0x31aec6['where'][_0xc680('0x60')]=_0x9bd6ca['id'];if(_0x9e459a[_0xc680('0x3a')][_0xc680('0x44')]){_0x31aec6['where']=_[_0xc680('0x45')](_0x31aec6['where'],{'$or':_['map'](_0x31aec6[_0xc680('0x3e')],function(_0x1bec9f){var _0x21e5a3={};_0x21e5a3[_0x1bec9f]={'$like':'%'+_0x9e459a[_0xc680('0x3a')][_0xc680('0x44')]+'%'};return _0x21e5a3;})});}_0x31aec6=_[_0xc680('0x45')]({},_0x31aec6,_0x9e459a['options']);return db[_0xc680('0x5b')][_0xc680('0x23')]({'where':_0x31aec6[_0xc680('0x43')]})[_0xc680('0x2a')](function(_0x432822){_0x5bbd8e[_0xc680('0x23')]=_0x432822;if(_0x9e459a[_0xc680('0x3a')][_0xc680('0x48')]){_0x31aec6[_0xc680('0x4e')]=[{'all':!![]}];}return db[_0xc680('0x5b')][_0xc680('0x49')](_0x31aec6);})[_0xc680('0x2a')](function(_0x384955){_0x5bbd8e['rows']=_0x384955;return _0x5bbd8e;});}})[_0xc680('0x2a')](respondWithFilteredResult(_0x25463f,_0x31aec6))['catch'](handleError(_0x25463f,null));};exports[_0xc680('0x61')]=function(_0x29280d,_0x2f7ce6,_0x5c5927){return db[_0xc680('0x35')]['find']({'where':{'id':_0x29280d[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x2f7ce6,null))['then'](function(_0xe5b318){if(_0xe5b318){return _0xe5b318[_0xc680('0x61')](_0x29280d[_0xc680('0x3a')][_0xc680('0x62')]);}})[_0xc680('0x2a')](respondWithStatusCode(_0x2f7ce6,null))['catch'](handleError(_0x2f7ce6,null));};exports[_0xc680('0x63')]=function(_0x53bdb8,_0x432117,_0x3ddac9){return db[_0xc680('0x35')][_0xc680('0x4f')]({'where':{'id':_0x53bdb8[_0xc680('0x4d')]['id']}})['then'](handleEntityNotFound(_0x432117,null))[_0xc680('0x2a')](function(_0x21f75a){if(_0x21f75a){var _0x5eaf42=[];var _0x1bd977={'success':[],'errors':[]};return db[_0xc680('0x64')][_0xc680('0x59')]()[_0xc680('0x2a')](function(_0x41bc18){if(_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')]&&_['isArray'](_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')])){if(_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')][_0xc680('0x5d')]){_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')]=_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')][_0xc680('0x66')](';')+';';}else{_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')]=null;}}else{_0x53bdb8[_0xc680('0x51')][_0xc680('0x65')]=null;}if(_0x53bdb8['body']&&_[_0xc680('0x67')](_0x53bdb8[_0xc680('0x51')])){for(var _0x86bf31=0x0;_0x86bf31<_0x53bdb8[_0xc680('0x51')][_0xc680('0x5d')];_0x86bf31+=0x1){_0x53bdb8['body'][_0x86bf31][_0xc680('0x60')]=_0x53bdb8[_0xc680('0x4d')]['id'];_0x5eaf42[_0xc680('0x68')](_0x53bdb8[_0xc680('0x51')][_0x86bf31]);}return BPromise[_0xc680('0x69')](_0x5eaf42,function(_0x51dd9c){return db[_0xc680('0x64')]['create'](_[_0xc680('0x6a')](_0x51dd9c,[_0xc680('0x62'),'id'])||{},{'fields':_[_0xc680('0x3b')](_0x41bc18),'raw':!![]})[_0xc680('0x2a')](function(_0x1f2c82){_0x1bd977[_0xc680('0x6b')][_0xc680('0x68')](_0x1f2c82['dataValues']);})['catch'](function(_0x439613){_0x1bd977[_0xc680('0x6c')]['push']({'data':_0x51dd9c,'error':_0x439613[_0xc680('0x6d')]});});})[_0xc680('0x2a')](function(_0x4b00b2){return _0x1bd977;})['catch'](function(_0xce2bab){return _0xce2bab;});}else{_0x432117['status'](0x190)[_0xc680('0x21')]({'message':_0xc680('0x6e')});}});}})[_0xc680('0x2a')](respondWithResult(_0x432117,null))[_0xc680('0x4b')](handleError(_0x432117,null));};exports[_0xc680('0x6f')]=function(_0x468e13,_0x5666cd,_0x5c2abb){var _0x265112;return db['CmList'][_0xc680('0x4f')]({'where':{'id':_0x468e13[_0xc680('0x4d')]['id']},'include':[{'model':db[_0xc680('0x70')],'as':_0xc680('0x71')}]})[_0xc680('0x2a')](handleEntityNotFound(_0x5666cd,null))[_0xc680('0x2a')](function(_0x2ac7b2){if(_0x2ac7b2){_0x265112=_0x2ac7b2;return db[_0xc680('0x64')]['rawAttributes'];}})[_0xc680('0x2a')](function(_0x386a8c){if(_0x386a8c){var _0x4314f1={};var _0x3191d8={};_0x3191d8[_0xc680('0x39')]=_[_0xc680('0x72')](_[_0xc680('0x3b')](_0x386a8c),_['map'](_0x265112[_0xc680('0x71')],function(_0x5dd77d){return util[_0xc680('0x73')](_0xc680('0x74'),_0x5dd77d['id']);}));_0x3191d8['query']=_[_0xc680('0x3b')](_0x468e13[_0xc680('0x3a')]);_0x3191d8[_0xc680('0x3c')]=_[_0xc680('0x3d')](_0x3191d8[_0xc680('0x39')],_0x3191d8[_0xc680('0x3a')]);_0x4314f1[_0xc680('0x3e')]=_['intersection'](_0x3191d8[_0xc680('0x39')],qs['fields'](_0x468e13[_0xc680('0x3a')][_0xc680('0x3f')]));_0x4314f1['attributes']=_0x4314f1[_0xc680('0x3e')][_0xc680('0x5d')]?_0x4314f1[_0xc680('0x3e')]:_0x3191d8[_0xc680('0x39')];if(!_0x468e13['query']['hasOwnProperty'](_0xc680('0x5e'))){_0x4314f1[_0xc680('0x25')]=qs['limit'](_0x468e13['query'][_0xc680('0x25')]);_0x4314f1['offset']=qs['offset'](_0x468e13[_0xc680('0x3a')][_0xc680('0x24')]);}_0x4314f1[_0xc680('0x41')]=qs[_0xc680('0x42')](_0x468e13['query'][_0xc680('0x42')]);_0x4314f1[_0xc680('0x43')]=qs[_0xc680('0x3c')](_[_0xc680('0x5f')](_0x468e13[_0xc680('0x3a')],_0x3191d8[_0xc680('0x3c')]));_0x4314f1['raw']=!![];if(_0x468e13[_0xc680('0x3a')][_0xc680('0x44')]){_0x4314f1[_0xc680('0x43')]=_[_0xc680('0x45')](_0x4314f1[_0xc680('0x43')],{'$or':_[_0xc680('0x34')](_0x4314f1[_0xc680('0x3e')],function(_0x316e4c){var _0x239a54={};_0x239a54[_0x316e4c]={'$like':'%'+_0x468e13[_0xc680('0x3a')][_0xc680('0x44')]+'%'};return _0x239a54;})});}_0x4314f1=_['merge']({},_0x4314f1,_0x468e13[_0xc680('0x47')]);return _0x265112['getContacts'](_0x4314f1);}})[_0xc680('0x2a')](respondWithResult(_0x5666cd,null))[_0xc680('0x4b')](handleError(_0x5666cd,null));};exports['getContactsCsv']=function(_0x2a767a,_0xbb7e27,_0x520493){var _0x5a4ffe;var _0x7e9331;var _0x27b10d;var _0x2fd8aa=_0x2a767a['params']['id'];csv_results=[];return db[_0xc680('0x75')]['findAll']({'attributes':['id',_0xc680('0x31')],'raw':!![],'order':[_0xc680('0x76')]})[_0xc680('0x2a')](function(_0x38be99){_0x5a4ffe=_0x38be99;var _0x30d1aa=_['keys'](db[_0xc680('0x64')][_0xc680('0x5c')]);return db[_0xc680('0x70')]['findAll']({'raw':!![],'attributes':['id',_0xc680('0x77')]})[_0xc680('0x2a')](function(_0x2eb701){_0x7e9331=_0x2eb701;var _0x448fa6=squel[_0xc680('0x78')]()[_0xc680('0x3f')](_0x30d1aa)[_0xc680('0x79')](_0xc680('0x7a'),'c')[_0xc680('0x43')](_0xc680('0x7b'),_0x2fd8aa)[_0xc680('0x43')](_0xc680('0x7c'))['distinct']();for(var _0x555fdf=0x0;_0x555fdf<_0x7e9331[_0xc680('0x5d')];_0x555fdf++){_0x448fa6[_0xc680('0x7d')](_0xc680('0x7e')+_0x7e9331[_0x555fdf]['id'],'customField_'+_0x7e9331[_0x555fdf][_0xc680('0x77')]);}for(var _0x555fdf=0x0;_0x555fdf<_0x5a4ffe['length'];_0x555fdf++){_0x448fa6[_0xc680('0x7d')](squel[_0xc680('0x78')]()[_0xc680('0x7d')]('item')['from'](_0xc680('0x7f'))[_0xc680('0x43')](_0xc680('0x80'),_0x5a4ffe[_0x555fdf]['id'])['where'](_0xc680('0x81')),'additionalPhone_'+_0x5a4ffe[_0x555fdf][_0xc680('0x31')]);_0x448fa6[_0xc680('0x7d')](squel['select']()['field'](_0xc680('0x82'))['from']('cm_contact_has_items')['where'](_0xc680('0x80'),_0x5a4ffe[_0x555fdf]['id'])['where'](_0xc680('0x81')),_0xc680('0x83')+_0x5a4ffe[_0x555fdf][_0xc680('0x31')]);}var _0x504462=[];_0x504462[_0xc680('0x68')](_0x448fa6['toString']());BPromise[_0xc680('0x69')](_0x504462,handleQuery)[_0xc680('0x2a')](function(_0x26629c){handleQuery(_0x448fa6[_0xc680('0x84')]());var _0x5849e7=csv_results[0x0];if(!_[_0xc680('0x85')](_0x5849e7)){var _0x51fc69=toCsv(_0x5849e7);var _0x5acae9=Date[_0xc680('0x86')]();fs[_0xc680('0x87')](util[_0xc680('0x73')]('/tmp/list_%d_%s.csv',_0x2fd8aa,_0x5acae9),_0x51fc69);_0xbb7e27[_0xc680('0x88')](_0xc680('0x89'),'attachment;\x20filename='+util['format'](_0xc680('0x8a'),_0x2fd8aa,_0x5acae9));_0xbb7e27[_0xc680('0x88')](_0xc680('0x8b'),_0xc680('0x8c'));return _0xbb7e27[_0xc680('0x8d')](util[_0xc680('0x73')](_0xc680('0x8e'),_0x2fd8aa,_0x5acae9));}else{return _0xbb7e27[_0xc680('0x1f')](0xcc);}});});});};exports[_0xc680('0x8f')]=function(_0xe38524,_0x4dda3d,_0x2f1822){var _0xe231ca;delete _0xe38524['body']['id'];return db[_0xc680('0x35')][_0xc680('0x5a')]({'where':{'id':_0xe38524[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x4dda3d,null))['then'](function(_0x419aa2){if(_0x419aa2){return db[_0xc680('0x90')]['transaction'](function(_0x417924){return db[_0xc680('0x70')][_0xc680('0x50')](_0xe38524[_0xc680('0x51')],{'transaction':_0x417924})[_0xc680('0x2a')](function(_0x59b9ab){_0xe231ca=_0x59b9ab;return _0x419aa2[_0xc680('0x91')](_0x59b9ab,{'transaction':_0x417924});})[_0xc680('0x2a')](function(){var _0x114cbb={'type':db[_0xc680('0x92')][_0xc680('0x93')],'transaction':_0x417924};switch(_0xe38524[_0xc680('0x51')]['type']){case _0xc680('0x94'):_0x114cbb[_0xc680('0x37')]=db['Sequelize'][_0xc680('0x93')];break;case'number':_0x114cbb[_0xc680('0x37')]=db[_0xc680('0x92')]['INTEGER'];break;case _0xc680('0x95'):_0x114cbb[_0xc680('0x37')]=db[_0xc680('0x92')][_0xc680('0x96')];_0x114cbb[_0xc680('0x97')]=![];break;default:}return db[_0xc680('0x90')][_0xc680('0x98')][_0xc680('0x99')]('cm_contacts',util[_0xc680('0x73')](_0xc680('0x9a'),_0xe231ca['id']),_0x114cbb);})['then'](function(){return _0xe231ca;});});}})[_0xc680('0x2a')](respondWithResult(_0x4dda3d,null))[_0xc680('0x4b')](handleError(_0x4dda3d,null));};exports['getCustomFields']=function(_0x3ae318,_0x3cc1f9,_0x548341){var _0x14fb65={};var _0x9475cf={};var _0x47103f;var _0x6ef0fa;return db[_0xc680('0x35')][_0xc680('0x5a')]({'where':{'id':_0x3ae318[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x3cc1f9,null))[_0xc680('0x2a')](function(_0x30d5ba){if(_0x30d5ba){_0x47103f=_0x30d5ba;_0x9475cf[_0xc680('0x39')]=_[_0xc680('0x3b')](db[_0xc680('0x70')][_0xc680('0x5c')]);_0x9475cf[_0xc680('0x3a')]=_['keys'](_0x3ae318['query']);_0x9475cf[_0xc680('0x3c')]=_[_0xc680('0x3d')](_0x9475cf[_0xc680('0x39')],_0x9475cf[_0xc680('0x3a')]);_0x14fb65[_0xc680('0x3e')]=_['intersection'](_0x9475cf[_0xc680('0x39')],qs['fields'](_0x3ae318[_0xc680('0x3a')][_0xc680('0x3f')]));_0x14fb65[_0xc680('0x3e')]=_0x14fb65[_0xc680('0x3e')][_0xc680('0x5d')]?_0x14fb65['attributes']:_0x9475cf[_0xc680('0x39')];_0x14fb65[_0xc680('0x41')]=qs[_0xc680('0x42')](_0x3ae318[_0xc680('0x3a')][_0xc680('0x42')]);_0x14fb65[_0xc680('0x43')]=qs[_0xc680('0x3c')](_[_0xc680('0x5f')](_0x3ae318[_0xc680('0x3a')],_0x9475cf[_0xc680('0x3c')]));_0x14fb65[_0xc680('0x43')]=_['merge'](_0x14fb65['where'],{'$or':[{'ListId':_0x30d5ba['id']},{'ListId':null}]});if(_0x3ae318['query'][_0xc680('0x44')]){_0x14fb65[_0xc680('0x43')]=_[_0xc680('0x45')](_0x14fb65[_0xc680('0x43')],{'$or':_[_0xc680('0x34')](_0x14fb65[_0xc680('0x3e')],function(_0x4945f){var _0x3bfc72={};_0x3bfc72[_0x4945f]={'$like':'%'+_0x3ae318['query'][_0xc680('0x44')]+'%'};return _0x3bfc72;})});}_0x14fb65=_[_0xc680('0x45')]({},_0x14fb65,_0x3ae318[_0xc680('0x47')]);return db[_0xc680('0x70')]['findAndCountAll'](_0x14fb65);}})[_0xc680('0x2a')](respondWithResult(_0x3cc1f9,null))[_0xc680('0x4b')](handleError(_0x3cc1f9,null));};exports[_0xc680('0x9b')]=function(_0x27e16f,_0x14183b){return db[_0xc680('0x70')][_0xc680('0x9c')]({'where':{'ListId':null}})[_0xc680('0x2a')](handleEntityNotFound(_0x14183b,null))['then'](function(_0x50cdea){return _0x50cdea;})[_0xc680('0x2a')](respondWithResult(_0x14183b,null))[_0xc680('0x4b')](handleError(_0x14183b,null));};exports[_0xc680('0x9d')]=function(_0x45ac70,_0xafa389,_0x48dc9b){return db['CmList']['find']({'where':{'id':_0x45ac70[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0xafa389,null))[_0xc680('0x2a')](function(_0xbc248c){if(_0xbc248c){return _0xbc248c[_0xc680('0x9d')](_0x45ac70[_0xc680('0x51')][_0xc680('0x62')],_[_0xc680('0x6a')](_0x45ac70[_0xc680('0x51')],['ids','id'])||{})[_0xc680('0x9e')](function(_0x4b7657){for(var _0x22fa0d=0x0;_0x22fa0d<_0x45ac70[_0xc680('0x51')][_0xc680('0x62')][_0xc680('0x5d')];_0x22fa0d+=0x1){socket[_0xc680('0x9f')](_0xc680('0xa0'),{'UserId':Number(_0x45ac70['body'][_0xc680('0x62')][_0x22fa0d]),'CmListId':Number(_0x45ac70[_0xc680('0x4d')]['id'])});}return _0x4b7657;});}})[_0xc680('0x2a')](respondWithResult(_0xafa389,null))[_0xc680('0x4b')](handleError(_0xafa389,null));};exports[_0xc680('0xa1')]=function(_0x1422dc,_0x1f84b0,_0x18eb45){return db[_0xc680('0x35')]['find']({'where':{'id':_0x1422dc[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x1f84b0,null))[_0xc680('0x2a')](function(_0x356730){if(_0x356730){return _0x356730[_0xc680('0xa1')](_0x1422dc[_0xc680('0x3a')][_0xc680('0x62')])[_0xc680('0x2a')](function(){if(_[_0xc680('0x67')](_0x1422dc[_0xc680('0x3a')][_0xc680('0x62')])){for(var _0x34c7d3=0x0;_0x34c7d3<_0x1422dc['query'][_0xc680('0x62')]['length'];_0x34c7d3+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x1422dc[_0xc680('0x3a')][_0xc680('0x62')][_0x34c7d3]),'CmListId':Number(_0x1422dc[_0xc680('0x4d')]['id'])});}}else{socket[_0xc680('0x9f')]('userCmList:remove',{'UserId':Number(_0x1422dc['query'][_0xc680('0x62')]),'CmListId':Number(_0x1422dc['params']['id'])});}});}})[_0xc680('0x2a')](respondWithStatusCode(_0x1f84b0,null))[_0xc680('0x4b')](handleError(_0x1f84b0,null));};exports[_0xc680('0xa2')]=function(_0x474a85,_0x2b1160,_0x3494b8){var _0x2c2e22={};var _0x1c97ea={};var _0x550a8a;var _0x1a5473;return db[_0xc680('0x35')][_0xc680('0x5a')]({'where':{'id':_0x474a85[_0xc680('0x4d')]['id']}})[_0xc680('0x2a')](handleEntityNotFound(_0x2b1160,null))['then'](function(_0x290c61){if(_0x290c61){_0x550a8a=_0x290c61;_0x1c97ea[_0xc680('0x39')]=_['keys'](db[_0xc680('0xa3')][_0xc680('0x5c')]);_0x1c97ea[_0xc680('0x3a')]=_[_0xc680('0x3b')](_0x474a85[_0xc680('0x3a')]);_0x1c97ea[_0xc680('0x3c')]=_[_0xc680('0x3d')](_0x1c97ea['model'],_0x1c97ea[_0xc680('0x3a')]);_0x2c2e22[_0xc680('0x3e')]=_[_0xc680('0x3d')](_0x1c97ea[_0xc680('0x39')],qs['fields'](_0x474a85[_0xc680('0x3a')]['fields']));_0x2c2e22[_0xc680('0x3e')]=_0x2c2e22[_0xc680('0x3e')][_0xc680('0x5d')]?_0x2c2e22[_0xc680('0x3e')]:_0x1c97ea[_0xc680('0x39')];_0x2c2e22[_0xc680('0x41')]=qs[_0xc680('0x42')](_0x474a85[_0xc680('0x3a')][_0xc680('0x42')]);_0x2c2e22['where']=qs[_0xc680('0x3c')](_[_0xc680('0x5f')](_0x474a85[_0xc680('0x3a')],_0x1c97ea['filters']));if(_0x474a85[_0xc680('0x3a')][_0xc680('0x44')]){_0x2c2e22['where']=_['merge'](_0x2c2e22['where'],{'$or':_[_0xc680('0x34')](_0x2c2e22[_0xc680('0x3e')],function(_0x1e1a93){var _0x299fc8={};_0x299fc8[_0x1e1a93]={'$like':'%'+_0x474a85[_0xc680('0x3a')]['filter']+'%'};return _0x299fc8;})});}_0x2c2e22=_['merge']({},_0x2c2e22,_0x474a85[_0xc680('0x47')]);return _0x550a8a[_0xc680('0xa2')](_0x2c2e22);}})['then'](function(_0xf5a6f7){if(_0xf5a6f7){_0x1a5473=_0xf5a6f7['length'];if(!_0x474a85[_0xc680('0x3a')][_0xc680('0x40')](_0xc680('0x5e'))){_0x2c2e22[_0xc680('0x25')]=qs[_0xc680('0x25')](_0x474a85[_0xc680('0x3a')]['limit']);_0x2c2e22[_0xc680('0x24')]=qs[_0xc680('0x24')](_0x474a85[_0xc680('0x3a')][_0xc680('0x24')]);}return _0x550a8a[_0xc680('0xa2')](_0x2c2e22);}})['then'](function(_0x457ca9){if(_0x457ca9){return _0x457ca9?{'count':_0x1a5473,'rows':_0x457ca9}:null;}})[_0xc680('0x2a')](respondWithResult(_0x2b1160,null))['catch'](handleError(_0x2b1160,null));};function handleQuery(_0xdbe274){logger[_0xc680('0xa4')](_0xdbe274);return db[_0xc680('0x90')][_0xc680('0x3a')](_0xdbe274)[_0xc680('0x9e')](function(_0x566caf){csv_results['push'](_0x566caf);})[_0xc680('0x4b')](function(_0x97dd69){logger[_0xc680('0x2f')](_0x97dd69['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index a426330..6952d84 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x5fc3[_0x3ceb54];return _0x26d8a6;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x68cd52,_0x14f980){var _0x386d35=function(_0x5ab6c4){while(--_0x5ab6c4){_0x68cd52['push'](_0x68cd52['shift']());}};_0x386d35(++_0x14f980);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 6734c54..5b72bbb 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 _0x750a=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','moment','bluebird','request-promise'];(function(_0x382345,_0xdf03d9){var _0x286bed=function(_0x4d894c){while(--_0x4d894c){_0x382345['push'](_0x382345['shift']());}};_0x286bed(++_0xdf03d9);}(_0x750a,0x140));var _0xa750=function(_0x50558f,_0x2f673e){_0x50558f=_0x50558f-0x0;var _0x3c4e80=_0x750a[_0x50558f];return _0x3c4e80;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api'];(function(_0x4a7015,_0x2549de){var _0x3ac494=function(_0x1c67ca){while(--_0x1c67ca){_0x4a7015['push'](_0x4a7015['shift']());}};_0x3ac494(++_0x2549de);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index ea7ea86..0942afb 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 _0x8924=['../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x564989,_0x5aa378){var _0x3a0eee=function(_0x2443ea){while(--_0x2443ea){_0x564989['push'](_0x564989['shift']());}};_0x3a0eee(++_0x5aa378);}(_0x8924,0x1e8));var _0x4892=function(_0x417774,_0x1b95e6){_0x417774=_0x417774-0x0;var _0x10015d=_0x8924[_0x417774];return _0x10015d;};'use strict';var _=require(_0x4892('0x0'));var util=require('util');var moment=require(_0x4892('0x1'));var BPromise=require(_0x4892('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4892('0x3'));var db=require(_0x4892('0x4'))['db'];var utils=require(_0x4892('0x5'));var logger=require(_0x4892('0x6'))(_0x4892('0x7'));var config=require('../../config/environment');var jayson=require(_0x4892('0x8'));var client=jayson[_0x4892('0x9')][_0x4892('0xa')]({'port':0x232a});config['redis']=_[_0x4892('0xb')](config['redis'],{'host':_0x4892('0xc'),'port':0x18eb});var socket=require(_0x4892('0xd'))(new Redis(config[_0x4892('0xe')]));require('./cmList.socket')[_0x4892('0xf')](socket);function respondWithRpcPromise(_0x17e8d4,_0x85d9ef,_0x3df25d){return new BPromise(function(_0x549b30,_0x2b0666){return client[_0x4892('0x10')](_0x17e8d4,_0x3df25d)[_0x4892('0x11')](function(_0x19b3d6){logger[_0x4892('0x12')](_0x4892('0x13'),_0x85d9ef,_0x4892('0x14'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x85d9ef,'request\x20sent',JSON[_0x4892('0x15')](_0x19b3d6));if(_0x19b3d6['error']){if(_0x19b3d6[_0x4892('0x16')]['code']===0x1f4){logger['error'](_0x4892('0x13'),_0x85d9ef,_0x19b3d6[_0x4892('0x16')][_0x4892('0x17')]);return _0x2b0666(_0x19b3d6[_0x4892('0x16')][_0x4892('0x17')]);}logger[_0x4892('0x16')](_0x4892('0x13'),_0x85d9ef,_0x19b3d6[_0x4892('0x16')][_0x4892('0x17')]);return _0x549b30(_0x19b3d6[_0x4892('0x16')][_0x4892('0x17')]);}else{logger[_0x4892('0x12')]('CmList,\x20%s,\x20%s',_0x85d9ef,_0x4892('0x14'));_0x549b30(_0x19b3d6[_0x4892('0x18')]['message']);}})[_0x4892('0x19')](function(_0x272317){logger[_0x4892('0x16')](_0x4892('0x13'),_0x85d9ef,_0x272317);_0x2b0666(_0x272317);});});} \ No newline at end of file +var _0xf0bf=['message','CmList,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./cmList.socket','then','info','request\x20sent','debug','error'];(function(_0x109494,_0x5e9981){var _0x3953b5=function(_0x52a391){while(--_0x52a391){_0x109494['push'](_0x109494['shift']());}};_0x3953b5(++_0x5e9981);}(_0xf0bf,0x64));var _0xff0b=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xf0bf[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xff0b('0x0'));var moment=require(_0xff0b('0x1'));var BPromise=require(_0xff0b('0x2'));var rs=require(_0xff0b('0x3'));var fs=require('fs');var Redis=require(_0xff0b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xff0b('0x5'))(_0xff0b('0x6'));var config=require(_0xff0b('0x7'));var jayson=require(_0xff0b('0x8'));var client=jayson[_0xff0b('0x9')][_0xff0b('0xa')]({'port':0x232a});config['redis']=_[_0xff0b('0xb')](config[_0xff0b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xff0b('0xd'))(new Redis(config['redis']));require(_0xff0b('0xe'))['register'](socket);function respondWithRpcPromise(_0x15cf9f,_0x34b2f3,_0x54a5fd){return new BPromise(function(_0x484184,_0x3f4b51){return client['request'](_0x15cf9f,_0x54a5fd)[_0xff0b('0xf')](function(_0x570a77){logger[_0xff0b('0x10')]('CmList,\x20%s,\x20%s',_0x34b2f3,_0xff0b('0x11'));logger[_0xff0b('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x34b2f3,_0xff0b('0x11'),JSON['stringify'](_0x570a77));if(_0x570a77[_0xff0b('0x13')]){if(_0x570a77[_0xff0b('0x13')]['code']===0x1f4){logger[_0xff0b('0x13')]('CmList,\x20%s,\x20%s',_0x34b2f3,_0x570a77[_0xff0b('0x13')][_0xff0b('0x14')]);return _0x3f4b51(_0x570a77[_0xff0b('0x13')][_0xff0b('0x14')]);}logger[_0xff0b('0x13')]('CmList,\x20%s,\x20%s',_0x34b2f3,_0x570a77[_0xff0b('0x13')]['message']);return _0x484184(_0x570a77[_0xff0b('0x13')][_0xff0b('0x14')]);}else{logger[_0xff0b('0x10')](_0xff0b('0x15'),_0x34b2f3,'request\x20sent');_0x484184(_0x570a77[_0xff0b('0x16')][_0xff0b('0x14')]);}})[_0xff0b('0x17')](function(_0x45267a){logger['error'](_0xff0b('0x15'),_0x34b2f3,_0x45267a);_0x3f4b51(_0x45267a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4d2f343..6d90a1a 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 _0x0199=['length','cmList:','./cmList.events','save','remove','update','emit','removeListener','register'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0x0199,0x1d6));var _0x9019=function(_0x237a85,_0x32ad46){_0x237a85=_0x237a85-0x0;var _0x13fcd5=_0x0199[_0x237a85];return _0x13fcd5;};'use strict';var CmListEvents=require(_0x9019('0x0'));var events=[_0x9019('0x1'),_0x9019('0x2'),_0x9019('0x3')];function createListener(_0x155c83,_0x44541d){return function(_0xdac46f){_0x44541d[_0x9019('0x4')](_0x155c83,_0xdac46f);};}function removeListener(_0x5873b2,_0x2f9d95){return function(){CmListEvents[_0x9019('0x5')](_0x5873b2,_0x2f9d95);};}exports[_0x9019('0x6')]=function(_0x56e47f){for(var _0x82c1d4=0x0,_0x30c7a3=events[_0x9019('0x7')];_0x82c1d4<_0x30c7a3;_0x82c1d4++){var _0x50eff5=events[_0x82c1d4];var _0x31e293=createListener(_0x9019('0x8')+_0x50eff5,_0x56e47f);CmListEvents['on'](_0x50eff5,_0x31e293);}}; \ No newline at end of file +var _0x7be4=['./cmList.events','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x2cbb74,_0x241c10){var _0xa6d18=function(_0x5a2940){while(--_0x5a2940){_0x2cbb74['push'](_0x2cbb74['shift']());}};_0xa6d18(++_0x241c10);}(_0x7be4,0x1c8));var _0x47be=function(_0x1cd426,_0x2e4c3e){_0x1cd426=_0x1cd426-0x0;var _0x92fd89=_0x7be4[_0x1cd426];return _0x92fd89;};'use strict';var CmListEvents=require(_0x47be('0x0'));var events=['save',_0x47be('0x1'),_0x47be('0x2')];function createListener(_0x773963,_0x3e2751){return function(_0x39d1c0){_0x3e2751[_0x47be('0x3')](_0x773963,_0x39d1c0);};}function removeListener(_0x12860d,_0x3c7244){return function(){CmListEvents[_0x47be('0x4')](_0x12860d,_0x3c7244);};}exports[_0x47be('0x5')]=function(_0x47e08e){for(var _0x11a17c=0x0,_0x2bb267=events[_0x47be('0x6')];_0x11a17c<_0x2bb267;_0x11a17c++){var _0x28929d=events[_0x11a17c];var _0x30ef58=createListener(_0x47be('0x7')+_0x28929d,_0x47e08e);CmListEvents['on'](_0x28929d,_0x30ef58);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index ecf53fc..fc5dabb 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 _0x0dcf=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','create','post','addDisposition','addContacts','addCustomField','addAgents','put','delete','removeDispositions','removeAgents','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x597ed6,_0x2edb30){var _0x23059a=function(_0x3743de){while(--_0x3743de){_0x597ed6['push'](_0x597ed6['shift']());}};_0x23059a(++_0x2edb30);}(_0x0dcf,0x64));var _0xf0dc=function(_0x1ccae7,_0xfeda15){_0x1ccae7=_0x1ccae7-0x0;var _0x860611=_0x0dcf[_0x1ccae7];return _0x860611;};'use strict';var multer=require(_0xf0dc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf0dc('0x1'));var express=require(_0xf0dc('0x2'));var router=express['Router']();var fs_extra=require(_0xf0dc('0x3'));var auth=require(_0xf0dc('0x4'));var interaction=require(_0xf0dc('0x5'));var config=require(_0xf0dc('0x6'));var controller=require('./cmList.controller');router[_0xf0dc('0x7')]('/',auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x9')]);router['get'](_0xf0dc('0xa'),auth['isAuthenticated'](),controller[_0xf0dc('0xb')]);router[_0xf0dc('0x7')](_0xf0dc('0xc'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0xd')]);router[_0xf0dc('0x7')](_0xf0dc('0xe'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0xf')]);router[_0xf0dc('0x7')](_0xf0dc('0x10'),auth[_0xf0dc('0x8')](),controller['getDispositions']);router[_0xf0dc('0x7')](_0xf0dc('0x11'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x12')]);router[_0xf0dc('0x7')](_0xf0dc('0x13'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x14')]);router[_0xf0dc('0x7')](_0xf0dc('0x15'),auth[_0xf0dc('0x8')](),controller['getCustomFields']);router[_0xf0dc('0x7')](_0xf0dc('0x16'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x17')]);router['post']('/',auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x18')]);router[_0xf0dc('0x19')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf0dc('0x1a')]);router[_0xf0dc('0x19')]('/:id/contacts',auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x1b')]);router['post'](_0xf0dc('0x15'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x1c')]);router[_0xf0dc('0x19')]('/:id/users',auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x1d')]);router[_0xf0dc('0x1e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf0dc('0x1f')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xf0dc('0x1f')](_0xf0dc('0x10'),auth['isAuthenticated'](),controller[_0xf0dc('0x20')]);router['delete'](_0xf0dc('0x16'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x21')]);module[_0xf0dc('0x22')]=router; \ No newline at end of file +var _0x9fca=['get','/global_fields','/:id','show','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index'];(function(_0x5c3e7c,_0x39ca9e){var _0x40cdf0=function(_0x251ddc){while(--_0x251ddc){_0x5c3e7c['push'](_0x5c3e7c['shift']());}};_0x40cdf0(++_0x39ca9e);}(_0x9fca,0x7f));var _0xa9fc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9fca[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xa9fc('0x0'));var util=require(_0xa9fc('0x1'));var path=require(_0xa9fc('0x2'));var timeout=require(_0xa9fc('0x3'));var express=require(_0xa9fc('0x4'));var router=express[_0xa9fc('0x5')]();var fs_extra=require(_0xa9fc('0x6'));var auth=require(_0xa9fc('0x7'));var interaction=require(_0xa9fc('0x8'));var config=require(_0xa9fc('0x9'));var controller=require(_0xa9fc('0xa'));router['get']('/',auth[_0xa9fc('0xb')](),controller[_0xa9fc('0xc')]);router[_0xa9fc('0xd')]('/describe',auth[_0xa9fc('0xb')](),controller['describe']);router[_0xa9fc('0xd')](_0xa9fc('0xe'),auth[_0xa9fc('0xb')](),controller['getGlobalCustomFields']);router[_0xa9fc('0xd')](_0xa9fc('0xf'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x10')]);router['get']('/:id/dispositions',auth[_0xa9fc('0xb')](),controller['getDispositions']);router[_0xa9fc('0xd')](_0xa9fc('0x11'),auth['isAuthenticated'](),controller[_0xa9fc('0x12')]);router[_0xa9fc('0xd')](_0xa9fc('0x13'),auth['isAuthenticated'](),controller[_0xa9fc('0x14')]);router[_0xa9fc('0xd')](_0xa9fc('0x15'),auth[_0xa9fc('0xb')](),controller['getCustomFields']);router[_0xa9fc('0xd')](_0xa9fc('0x16'),auth[_0xa9fc('0xb')](),controller['getAgents']);router[_0xa9fc('0x17')]('/',auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x18')]);router[_0xa9fc('0x17')](_0xa9fc('0x19'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x1a')]);router[_0xa9fc('0x17')](_0xa9fc('0x11'),auth['isAuthenticated'](),controller[_0xa9fc('0x1b')]);router[_0xa9fc('0x17')](_0xa9fc('0x15'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x1c')]);router[_0xa9fc('0x17')](_0xa9fc('0x16'),auth['isAuthenticated'](),controller[_0xa9fc('0x1d')]);router[_0xa9fc('0x1e')](_0xa9fc('0xf'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x1f')]);router[_0xa9fc('0x20')](_0xa9fc('0xf'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x21')]);router[_0xa9fc('0x20')](_0xa9fc('0x19'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xa9fc('0x20')](_0xa9fc('0x16'),auth[_0xa9fc('0xb')](),controller[_0xa9fc('0x22')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index a8a3d15..01a99d2 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 _0x14c7=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x23019b,_0x45b9db){var _0xd49cae=function(_0x3ad33e){while(--_0x3ad33e){_0x23019b['push'](_0x23019b['shift']());}};_0xd49cae(++_0x45b9db);}(_0x14c7,0x183));var _0x714c=function(_0x4f8a9d,_0x41770c){_0x4f8a9d=_0x4f8a9d-0x0;var _0x3f490e=_0x14c7[_0x4f8a9d];return _0x3f490e;};'use strict';var Sequelize=require(_0x714c('0x0'));module[_0x714c('0x1')]={'name':{'type':Sequelize[_0x714c('0x2')],'get':function(_0x36ae3b){return this['getDataValue'](_0x714c('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x714c('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x714c('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x57fd=['getDataValue','field','STRING','sequelize','exports'];(function(_0x96a41f,_0x4ce2a1){var _0x558c68=function(_0x22de36){while(--_0x22de36){_0x96a41f['push'](_0x96a41f['shift']());}};_0x558c68(++_0x4ce2a1);}(_0x57fd,0xb7));var _0xd57f=function(_0x2c914b,_0x12e1fc){_0x2c914b=_0x2c914b-0x0;var _0x56bb18=_0x57fd[_0x2c914b];return _0x56bb18;};'use strict';var Sequelize=require(_0xd57f('0x0'));module[_0xd57f('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1ddbc3){return this[_0xd57f('0x2')](_0xd57f('0x3'));}},'field':{'type':Sequelize[_0xd57f('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xd57f('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xd57f('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 7b09e6f..efbec87 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x2020e9,_0x74e5d7){var _0x199c13=function(_0x5875fd){while(--_0x5875fd){_0x2020e9['push'](_0x2020e9['shift']());}};_0x199c13(++_0x74e5d7);}(_0x7a54,0x106));var _0x47a5=function(_0x886020,_0x372453){_0x886020=_0x886020-0x0;var _0x2225e2=_0x7a54[_0x886020];return _0x2225e2;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0x3f5880,_0x2beec0){var _0x1cc879=function(_0x38b7b1){while(--_0x38b7b1){_0x3f5880['push'](_0x3f5880['shift']());}};_0x1cc879(++_0x2beec0);}(_0x7a54,0x106));var _0x47a5=function(_0x48eb70,_0x245034){_0x48eb70=_0x48eb70-0x0;var _0x41e855=_0x7a54[_0x48eb70];return _0x41e855;};'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 9063ca1..4b3b77e 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 _0x7dfe=['moment','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger'];(function(_0x573b76,_0x3fcca8){var _0x22e32c=function(_0xb4aa75){while(--_0xb4aa75){_0x573b76['push'](_0x573b76['shift']());}};_0x22e32c(++_0x3fcca8);}(_0x7dfe,0xbd));var _0xe7df=function(_0x13907b,_0x86ef33){_0x13907b=_0x13907b-0x0;var _0x6bf1da=_0x7dfe[_0x13907b];return _0x6bf1da;};'use strict';var _=require(_0xe7df('0x0'));var util=require(_0xe7df('0x1'));var logger=require(_0xe7df('0x2'))('api');var moment=require(_0xe7df('0x3'));var BPromise=require(_0xe7df('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7df('0x5'));var rimraf=require(_0xe7df('0x6'));var config=require(_0xe7df('0x7'));var attributes=require(_0xe7df('0x8'));module[_0xe7df('0x9')]=function(_0xff1259,_0x4f8d87){return _0xff1259[_0xe7df('0xa')]('Condition',attributes,{'tableName':_0xe7df('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f1f=['util','api','moment','bluebird','request-promise','path','./condition.attributes','exports','define','Condition','tools_conditions','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f1f,0xa7));var _0xf8f1=function(_0x42304a,_0x14be94){_0x42304a=_0x42304a-0x0;var _0x159335=_0x8f1f[_0x42304a];return _0x159335;};'use strict';var _=require(_0xf8f1('0x0'));var util=require(_0xf8f1('0x1'));var logger=require('../../config/logger')(_0xf8f1('0x2'));var moment=require(_0xf8f1('0x3'));var BPromise=require(_0xf8f1('0x4'));var rp=require(_0xf8f1('0x5'));var fs=require('fs');var path=require(_0xf8f1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf8f1('0x7'));module[_0xf8f1('0x8')]=function(_0x29a98f,_0x54ecde){return _0x29a98f[_0xf8f1('0x9')](_0xf8f1('0xa'),attributes,{'tableName':_0xf8f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index ef30d9b..e0da87b 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 _0x758e=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','Condition,\x20%s,\x20%s'];(function(_0x200f4e,_0x5d79a1){var _0x25ef41=function(_0x335bde){while(--_0x335bde){_0x200f4e['push'](_0x200f4e['shift']());}};_0x25ef41(++_0x5d79a1);}(_0x758e,0x1a7));var _0xe758=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x758e[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xe758('0x0'));var util=require('util');var moment=require(_0xe758('0x1'));var BPromise=require(_0xe758('0x2'));var rs=require(_0xe758('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe758('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe758('0x5'));var config=require(_0xe758('0x6'));var jayson=require(_0xe758('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xaf9ab2,_0x1cc526,_0xf3849e){return new BPromise(function(_0x4a8416,_0x3781b2){return client[_0xe758('0x8')](_0xaf9ab2,_0xf3849e)[_0xe758('0x9')](function(_0x373be8){logger[_0xe758('0xa')]('Condition,\x20%s,\x20%s',_0x1cc526,_0xe758('0xb'));logger[_0xe758('0xc')](_0xe758('0xd'),_0x1cc526,_0xe758('0xb'),JSON['stringify'](_0x373be8));if(_0x373be8[_0xe758('0xe')]){if(_0x373be8[_0xe758('0xe')][_0xe758('0xf')]===0x1f4){logger[_0xe758('0xe')](_0xe758('0x10'),_0x1cc526,_0x373be8[_0xe758('0xe')][_0xe758('0x11')]);return _0x3781b2(_0x373be8['error']['message']);}logger[_0xe758('0xe')](_0xe758('0x10'),_0x1cc526,_0x373be8['error'][_0xe758('0x11')]);return _0x4a8416(_0x373be8[_0xe758('0xe')][_0xe758('0x11')]);}else{logger[_0xe758('0xa')](_0xe758('0x10'),_0x1cc526,_0xe758('0xb'));_0x4a8416(_0x373be8[_0xe758('0x12')]['message']);}})[_0xe758('0x13')](function(_0x5c5a51){logger['error'](_0xe758('0x10'),_0x1cc526,_0x5c5a51);_0x3781b2(_0x5c5a51);});});} \ No newline at end of file +var _0xaf2b=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2b076b,_0x455a17){var _0x98ef20=function(_0x54706e){while(--_0x54706e){_0x2b076b['push'](_0x2b076b['shift']());}};_0x98ef20(++_0x455a17);}(_0xaf2b,0xbc));var _0xbaf2=function(_0x28f5cb,_0x37fadc){_0x28f5cb=_0x28f5cb-0x0;var _0x27cd13=_0xaf2b[_0x28f5cb];return _0x27cd13;};'use strict';var _=require(_0xbaf2('0x0'));var util=require('util');var moment=require(_0xbaf2('0x1'));var BPromise=require(_0xbaf2('0x2'));var rs=require(_0xbaf2('0x3'));var fs=require('fs');var Redis=require(_0xbaf2('0x4'));var db=require(_0xbaf2('0x5'))['db'];var utils=require(_0xbaf2('0x6'));var logger=require(_0xbaf2('0x7'))(_0xbaf2('0x8'));var config=require('../../config/environment');var jayson=require(_0xbaf2('0x9'));var client=jayson[_0xbaf2('0xa')][_0xbaf2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x321563,_0x4b4b84,_0x2a4de6){return new BPromise(function(_0x15864d,_0x6a58d){return client[_0xbaf2('0xc')](_0x321563,_0x2a4de6)[_0xbaf2('0xd')](function(_0x93fbae){logger[_0xbaf2('0xe')](_0xbaf2('0xf'),_0x4b4b84,_0xbaf2('0x10'));logger[_0xbaf2('0x11')](_0xbaf2('0x12'),_0x4b4b84,_0xbaf2('0x10'),JSON[_0xbaf2('0x13')](_0x93fbae));if(_0x93fbae[_0xbaf2('0x14')]){if(_0x93fbae['error'][_0xbaf2('0x15')]===0x1f4){logger[_0xbaf2('0x14')](_0xbaf2('0xf'),_0x4b4b84,_0x93fbae[_0xbaf2('0x14')][_0xbaf2('0x16')]);return _0x6a58d(_0x93fbae[_0xbaf2('0x14')][_0xbaf2('0x16')]);}logger[_0xbaf2('0x14')](_0xbaf2('0xf'),_0x4b4b84,_0x93fbae[_0xbaf2('0x14')]['message']);return _0x15864d(_0x93fbae[_0xbaf2('0x14')][_0xbaf2('0x16')]);}else{logger[_0xbaf2('0xe')]('Condition,\x20%s,\x20%s',_0x4b4b84,'request\x20sent');_0x15864d(_0x93fbae[_0xbaf2('0x17')]['message']);}})[_0xbaf2('0x18')](function(_0x1209c6){logger[_0xbaf2('0x14')](_0xbaf2('0xf'),_0x4b4b84,_0x1209c6);_0x6a58d(_0x1209c6);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 3cd542f..0beb036 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 _0x0740=['../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x5532fa,_0x5be060){var _0x14573d=function(_0x29da07){while(--_0x29da07){_0x5532fa['push'](_0x5532fa['shift']());}};_0x14573d(++_0x5be060);}(_0x0740,0x90));var _0x0074=function(_0x5e2ebf,_0x4f3620){_0x5e2ebf=_0x5e2ebf-0x0;var _0x330df5=_0x0740[_0x5e2ebf];return _0x330df5;};'use strict';var multer=require(_0x0074('0x0'));var util=require(_0x0074('0x1'));var path=require(_0x0074('0x2'));var timeout=require('connect-timeout');var express=require(_0x0074('0x3'));var router=express['Router']();var fs_extra=require(_0x0074('0x4'));var auth=require(_0x0074('0x5'));var interaction=require(_0x0074('0x6'));var config=require(_0x0074('0x7'));var controller=require(_0x0074('0x8'));router[_0x0074('0x9')](_0x0074('0xa'),auth['isAuthenticated'](),controller[_0x0074('0xb')]);router[_0x0074('0xc')]('/:id',auth[_0x0074('0xd')](),controller[_0x0074('0xe')]);module['exports']=router; \ No newline at end of file +var _0x6f9c=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','multer'];(function(_0xbe7c99,_0x464391){var _0x22f4e2=function(_0x2b79e3){while(--_0x2b79e3){_0xbe7c99['push'](_0xbe7c99['shift']());}};_0x22f4e2(++_0x464391);}(_0x6f9c,0x110));var _0xc6f9=function(_0x3acfa8,_0x50daa0){_0x3acfa8=_0x3acfa8-0x0;var _0x11af75=_0x6f9c[_0x3acfa8];return _0x11af75;};'use strict';var multer=require(_0xc6f9('0x0'));var util=require(_0xc6f9('0x1'));var path=require(_0xc6f9('0x2'));var timeout=require(_0xc6f9('0x3'));var express=require(_0xc6f9('0x4'));var router=express['Router']();var fs_extra=require(_0xc6f9('0x5'));var auth=require(_0xc6f9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc6f9('0x7'));var controller=require(_0xc6f9('0x8'));router[_0xc6f9('0x9')](_0xc6f9('0xa'),auth[_0xc6f9('0xb')](),controller['update']);router[_0xc6f9('0xc')](_0xc6f9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 8fced93..fd3cab5 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 _0x649a=['INTEGER','sequelize','exports','STRING','name'];(function(_0xcbc7d0,_0x4ad63c){var _0x37b8c6=function(_0x153fee){while(--_0x153fee){_0xcbc7d0['push'](_0xcbc7d0['shift']());}};_0x37b8c6(++_0x4ad63c);}(_0x649a,0x1c3));var _0xa649=function(_0x4dc35f,_0x377c51){_0x4dc35f=_0x4dc35f-0x0;var _0x1f8820=_0x649a[_0x4dc35f];return _0x1f8820;};'use strict';var Sequelize=require(_0xa649('0x0'));module[_0xa649('0x1')]={'name':{'type':Sequelize[_0xa649('0x2')],'allowNull':![],'unique':_0xa649('0x3')},'OrderBy':{'type':Sequelize[_0xa649('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa649('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xea1a=['sequelize','exports','STRING','name'];(function(_0x151159,_0x4f35fc){var _0x3c7f71=function(_0x4af24a){while(--_0x4af24a){_0x151159['push'](_0x151159['shift']());}};_0x3c7f71(++_0x4f35fc);}(_0xea1a,0x158));var _0xaea1=function(_0x19ecf7,_0x308815){_0x19ecf7=_0x19ecf7-0x0;var _0x51bd71=_0xea1a[_0x19ecf7];return _0x51bd71;};'use strict';var Sequelize=require(_0xaea1('0x0'));module[_0xaea1('0x1')]={'name':{'type':Sequelize[_0xaea1('0x2')],'allowNull':![],'unique':_0xaea1('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xaea1('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index e04e4e3..27cdbf2 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 _0xe5af=['rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','stack','name','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','catch','error','CmContactHasItem'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe5af,0x9c));var _0xfe5a=function(_0x4d7530,_0xdee31){_0x4d7530=_0x4d7530-0x0;var _0x1afc9e=_0xe5af[_0x4d7530];return _0x1afc9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe5a('0x0'));var zipdir=require(_0xfe5a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfe5a('0x2'));var moment=require(_0xfe5a('0x3'));var BPromise=require(_0xfe5a('0x4'));var Mustache=require('mustache');var util=require(_0xfe5a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfe5a('0x6'));var ejs=require(_0xfe5a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfe5a('0x8'));var crypto=require(_0xfe5a('0x9'));var jsforce=require(_0xfe5a('0xa'));var deskjs=require(_0xfe5a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfe5a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe5a('0xd'));var qs=require(_0xfe5a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe5a('0xf'));var logger=require(_0xfe5a('0x10'))(_0xfe5a('0x11'));var utils=require(_0xfe5a('0x12'));var config=require(_0xfe5a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe5a('0x14'))['db'];function respondWithStatusCode(_0x9d1f4f,_0x20b206){_0x20b206=_0x20b206||0xcc;return function(_0x374ded){if(_0x374ded){return _0x9d1f4f[_0xfe5a('0x15')](_0x20b206);}return _0x9d1f4f['status'](_0x20b206)[_0xfe5a('0x16')]();};}function respondWithResult(_0x17bbbe,_0x42969b){_0x42969b=_0x42969b||0xc8;return function(_0x362115){if(_0x362115){return _0x17bbbe[_0xfe5a('0x17')](_0x42969b)[_0xfe5a('0x18')](_0x362115);}};}function respondWithFilteredResult(_0x375380,_0xeb454){return function(_0x111d4d){if(_0x111d4d){var _0x18c57b=typeof _0xeb454[_0xfe5a('0x19')]===_0xfe5a('0x1a')&&typeof _0xeb454[_0xfe5a('0x1b')]===_0xfe5a('0x1a');var _0x3edcab=_0x111d4d[_0xfe5a('0x1c')];var _0x5bf597=_0x18c57b?0x0:_0xeb454[_0xfe5a('0x19')];var _0x456707=_0x18c57b?_0x111d4d['count']:_0xeb454[_0xfe5a('0x19')]+_0xeb454[_0xfe5a('0x1b')];var _0x39d905;if(_0x456707>=_0x3edcab){_0x456707=_0x3edcab;_0x39d905=0xc8;}else{_0x39d905=0xce;}_0x375380['status'](_0x39d905);return _0x375380['set'](_0xfe5a('0x1d'),_0x5bf597+'-'+_0x456707+'/'+_0x3edcab)[_0xfe5a('0x18')](_0x111d4d);}return null;};}function patchUpdates(_0xded538){return function(_0x3b3022){try{jsonpatch[_0xfe5a('0x1e')](_0x3b3022,_0xded538,!![]);}catch(_0x355869){return BPromise['reject'](_0x355869);}return _0x3b3022[_0xfe5a('0x1f')]();};}function saveUpdates(_0x592521,_0x3dfa57){return function(_0x39d825){if(_0x39d825){return _0x39d825[_0xfe5a('0x20')](_0x592521)['then'](function(_0x4bbef1){return _0x4bbef1;});}return null;};}function removeEntity(_0x247be4,_0x3e55fd){return function(_0x494df3){if(_0x494df3){return _0x494df3[_0xfe5a('0x21')]()[_0xfe5a('0x22')](function(){var _0x578d3e=_0x494df3[_0xfe5a('0x23')]({'plain':!![]});var _0x3a4f3c=_0xfe5a('0x24');return db[_0xfe5a('0x25')]['destroy']({'where':{'type':_0x3a4f3c,'resourceId':_0x578d3e['id']}})[_0xfe5a('0x22')](function(){return _0x494df3;});})[_0xfe5a('0x22')](function(){_0x247be4[_0xfe5a('0x17')](0xcc)[_0xfe5a('0x16')]();});}};}function handleEntityNotFound(_0x36bf20,_0x222490){return function(_0xdbf1e0){if(!_0xdbf1e0){_0x36bf20[_0xfe5a('0x15')](0x194);}return _0xdbf1e0;};}function handleError(_0x55d89e,_0x4df546){_0x4df546=_0x4df546||0x1f4;return function(_0x712b44){logger['error'](_0x712b44[_0xfe5a('0x26')]);if(_0x712b44[_0xfe5a('0x27')]){delete _0x712b44[_0xfe5a('0x27')];}_0x55d89e['status'](_0x4df546)['send'](_0x712b44);};}exports['index']=function(_0x32d31e,_0x582f2d){var _0x51d1f4={},_0x498b64={},_0x3b6e4d={'count':0x0,'rows':[]};var _0x14c66d=_[_0xfe5a('0x28')](db[_0xfe5a('0x29')][_0xfe5a('0x2a')],function(_0x286f27){return{'name':_0x286f27[_0xfe5a('0x2b')],'type':_0x286f27[_0xfe5a('0x2c')][_0xfe5a('0x2d')]};});_0x498b64[_0xfe5a('0x2e')]=_[_0xfe5a('0x28')](_0x14c66d,'name');_0x498b64[_0xfe5a('0x2f')]=_[_0xfe5a('0x30')](_0x32d31e['query']);_0x498b64[_0xfe5a('0x31')]=_[_0xfe5a('0x32')](_0x498b64[_0xfe5a('0x2e')],_0x498b64[_0xfe5a('0x2f')]);_0x51d1f4[_0xfe5a('0x33')]=_['intersection'](_0x498b64['model'],qs[_0xfe5a('0x34')](_0x32d31e['query'][_0xfe5a('0x34')]));_0x51d1f4[_0xfe5a('0x33')]=_0x51d1f4[_0xfe5a('0x33')][_0xfe5a('0x35')]?_0x51d1f4['attributes']:_0x498b64[_0xfe5a('0x2e')];if(!_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x36')]('nolimit')){_0x51d1f4[_0xfe5a('0x1b')]=qs[_0xfe5a('0x1b')](_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x1b')]);_0x51d1f4['offset']=qs[_0xfe5a('0x19')](_0x32d31e['query'][_0xfe5a('0x19')]);}_0x51d1f4[_0xfe5a('0x37')]=qs['sort'](_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x38')]);_0x51d1f4[_0xfe5a('0x39')]=qs[_0xfe5a('0x31')](_['pick'](_0x32d31e[_0xfe5a('0x2f')],_0x498b64[_0xfe5a('0x31')]),_0x14c66d);if(_0x32d31e[_0xfe5a('0x2f')]['filter']){_0x51d1f4[_0xfe5a('0x39')]=_[_0xfe5a('0x3a')](_0x51d1f4[_0xfe5a('0x39')],{'$or':_[_0xfe5a('0x28')](_0x14c66d,function(_0xec56ad){if(_0xec56ad[_0xfe5a('0x2c')]!==_0xfe5a('0x3b')){var _0x243271={};_0x243271[_0xec56ad[_0xfe5a('0x27')]]={'$like':'%'+_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x3c')]+'%'};return _0x243271;}})});}_0x51d1f4=_['merge']({},_0x51d1f4,_0x32d31e[_0xfe5a('0x3d')]);var _0x315396={'where':_0x51d1f4[_0xfe5a('0x39')]};return db[_0xfe5a('0x29')][_0xfe5a('0x1c')](_0x315396)[_0xfe5a('0x22')](function(_0x3475fb){_0x3b6e4d['count']=_0x3475fb;if(_0x32d31e[_0xfe5a('0x2f')][_0xfe5a('0x3e')]){_0x51d1f4['include']=[{'all':!![]}];}return db['ContactItemType'][_0xfe5a('0x3f')](_0x51d1f4);})['then'](function(_0x54096d){_0x3b6e4d[_0xfe5a('0x40')]=_0x54096d;return _0x3b6e4d;})[_0xfe5a('0x22')](respondWithFilteredResult(_0x582f2d,_0x51d1f4))['catch'](handleError(_0x582f2d,null));};exports[_0xfe5a('0x41')]=function(_0x5a9c92,_0x5112a9){var _0x1dbb2c={'raw':!![],'where':{'id':_0x5a9c92[_0xfe5a('0x42')]['id']}},_0x1a92ef={};_0x1a92ef[_0xfe5a('0x2e')]=_[_0xfe5a('0x30')](db['ContactItemType'][_0xfe5a('0x2a')]);_0x1a92ef[_0xfe5a('0x2f')]=_[_0xfe5a('0x30')](_0x5a9c92[_0xfe5a('0x2f')]);_0x1a92ef[_0xfe5a('0x31')]=_[_0xfe5a('0x32')](_0x1a92ef[_0xfe5a('0x2e')],_0x1a92ef[_0xfe5a('0x2f')]);_0x1dbb2c[_0xfe5a('0x33')]=_[_0xfe5a('0x32')](_0x1a92ef[_0xfe5a('0x2e')],qs[_0xfe5a('0x34')](_0x5a9c92[_0xfe5a('0x2f')][_0xfe5a('0x34')]));_0x1dbb2c['attributes']=_0x1dbb2c[_0xfe5a('0x33')][_0xfe5a('0x35')]?_0x1dbb2c['attributes']:_0x1a92ef['model'];if(_0x5a9c92[_0xfe5a('0x2f')][_0xfe5a('0x3e')]){_0x1dbb2c[_0xfe5a('0x43')]=[{'all':!![]}];}_0x1dbb2c=_[_0xfe5a('0x3a')]({},_0x1dbb2c,_0x5a9c92[_0xfe5a('0x3d')]);return db[_0xfe5a('0x29')][_0xfe5a('0x44')](_0x1dbb2c)['then'](handleEntityNotFound(_0x5112a9,null))[_0xfe5a('0x22')](respondWithResult(_0x5112a9,null))['catch'](handleError(_0x5112a9,null));};exports[_0xfe5a('0x45')]=function(_0x5a807e,_0x433562){return db[_0xfe5a('0x29')][_0xfe5a('0x45')](_0x5a807e[_0xfe5a('0x46')],{})['then'](function(_0x394073){var _0x3f8447=_0x5a807e['user'][_0xfe5a('0x23')]({'plain':!![]});if(!_0x3f8447)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f8447['role']===_0xfe5a('0x47')){var _0x4e02c9=_0x394073[_0xfe5a('0x23')]({'plain':!![]});var _0x4536ba=_0xfe5a('0x24');return db[_0xfe5a('0x48')]['find']({'where':{'name':_0x4536ba,'userProfileId':_0x3f8447[_0xfe5a('0x49')]},'raw':!![]})['then'](function(_0x34247f){if(_0x34247f&&_0x34247f[_0xfe5a('0x4a')]===0x0){return db[_0xfe5a('0x25')]['create']({'name':_0x4e02c9[_0xfe5a('0x27')],'resourceId':_0x4e02c9['id'],'type':_0x34247f[_0xfe5a('0x27')],'sectionId':_0x34247f['id']},{})['then'](function(){return _0x394073;});}else{return _0x394073;}})[_0xfe5a('0x4b')](function(_0x42f2e2){logger[_0xfe5a('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42f2e2);throw _0x42f2e2;});}return _0x394073;})[_0xfe5a('0x22')](respondWithResult(_0x433562,0xc9))[_0xfe5a('0x4b')](handleError(_0x433562,null));};exports[_0xfe5a('0x20')]=function(_0x4d3bd8,_0x36395a){if(_0x4d3bd8[_0xfe5a('0x46')]['id']){delete _0x4d3bd8['body']['id'];}return db[_0xfe5a('0x29')]['find']({'where':{'id':_0x4d3bd8[_0xfe5a('0x42')]['id']}})[_0xfe5a('0x22')](handleEntityNotFound(_0x36395a,null))[_0xfe5a('0x22')](saveUpdates(_0x4d3bd8[_0xfe5a('0x46')],null))[_0xfe5a('0x22')](respondWithResult(_0x36395a,null))[_0xfe5a('0x4b')](handleError(_0x36395a,null));};exports[_0xfe5a('0x21')]=function(_0x3432d1,_0x127a9f){return db[_0xfe5a('0x29')][_0xfe5a('0x44')]({'where':{'id':_0x3432d1[_0xfe5a('0x42')]['id']}})[_0xfe5a('0x22')](handleEntityNotFound(_0x127a9f,null))[_0xfe5a('0x22')](db[_0xfe5a('0x4d')][_0xfe5a('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3432d1['params']['id']}}))[_0xfe5a('0x22')](removeEntity(_0x127a9f,null))[_0xfe5a('0x4b')](handleError(_0x127a9f,null));}; \ No newline at end of file +var _0x36ee=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','stack','index','map','ContactItemType','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x32ef84,_0x2048fa){var _0x3d7245=function(_0x26f42f){while(--_0x26f42f){_0x32ef84['push'](_0x32ef84['shift']());}};_0x3d7245(++_0x2048fa);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){var _0xb32195=_0x4749a8[_0xe36e('0x28')]({'plain':!![]});var _0x1507f9=_0xe36e('0x29');return db['UserProfileResource'][_0xe36e('0x27')]({'where':{'type':_0x1507f9,'resourceId':_0xb32195['id']}})[_0xe36e('0x26')](function(){return _0x4749a8;});})[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d757c,_0x5a3133){return function(_0xf7b02e){if(!_0xf7b02e){_0x2d757c['sendStatus'](0x194);}return _0xf7b02e;};}function handleError(_0x19f001,_0x5884cb){_0x5884cb=_0x5884cb||0x1f4;return function(_0x410504){logger['error'](_0x410504[_0xe36e('0x2a')]);if(_0x410504['name']){delete _0x410504['name'];}_0x19f001['status'](_0x5884cb)['send'](_0x410504);};}exports[_0xe36e('0x2b')]=function(_0x1fc639,_0x4cf185){var _0x4ac819={},_0x1fa1ec={},_0xb8d44e={'count':0x0,'rows':[]};var _0x259e19=_[_0xe36e('0x2c')](db[_0xe36e('0x2d')][_0xe36e('0x2e')],function(_0x57bb9b){return{'name':_0x57bb9b[_0xe36e('0x2f')],'type':_0x57bb9b[_0xe36e('0x30')]['key']};});_0x1fa1ec[_0xe36e('0x31')]=_[_0xe36e('0x2c')](_0x259e19,_0xe36e('0x32'));_0x1fa1ec[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x1fc639[_0xe36e('0x33')]);_0x1fa1ec[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x1fa1ec[_0xe36e('0x31')],_0x1fa1ec[_0xe36e('0x33')]);_0x4ac819[_0xe36e('0x37')]=_['intersection'](_0x1fa1ec[_0xe36e('0x31')],qs['fields'](_0x1fc639['query'][_0xe36e('0x38')]));_0x4ac819['attributes']=_0x4ac819[_0xe36e('0x37')][_0xe36e('0x39')]?_0x4ac819[_0xe36e('0x37')]:_0x1fa1ec[_0xe36e('0x31')];if(!_0x1fc639['query']['hasOwnProperty'](_0xe36e('0x3a'))){_0x4ac819[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x1fc639[_0xe36e('0x33')]['limit']);_0x4ac819[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x1fc639[_0xe36e('0x33')]['offset']);}_0x4ac819[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x1fc639['query'][_0xe36e('0x3c')]);_0x4ac819[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x1fc639[_0xe36e('0x33')],_0x1fa1ec[_0xe36e('0x35')]),_0x259e19);if(_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x4ac819[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x4ac819[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x259e19,function(_0x3c4703){if(_0x3c4703['type']!==_0xe36e('0x41')){var _0x134fb2={};_0x134fb2[_0x3c4703[_0xe36e('0x32')]]={'$like':'%'+_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x134fb2;}})});}_0x4ac819=_['merge']({},_0x4ac819,_0x1fc639['options']);var _0x4094c6={'where':_0x4ac819[_0xe36e('0x3d')]};return db[_0xe36e('0x2d')][_0xe36e('0x1f')](_0x4094c6)[_0xe36e('0x26')](function(_0x34a1ba){_0xb8d44e[_0xe36e('0x1f')]=_0x34a1ba;if(_0x1fc639[_0xe36e('0x33')]['includeAll']){_0x4ac819[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2d')]['findAll'](_0x4ac819);})[_0xe36e('0x26')](function(_0x5ef3e4){_0xb8d44e[_0xe36e('0x43')]=_0x5ef3e4;return _0xb8d44e;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4cf185,_0x4ac819))[_0xe36e('0x44')](handleError(_0x4cf185,null));};exports[_0xe36e('0x45')]=function(_0x3b1269,_0x4c5e10){var _0x2ffc34={'raw':!![],'where':{'id':_0x3b1269[_0xe36e('0x46')]['id']}},_0x2961c9={};_0x2961c9[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x2d')]['rawAttributes']);_0x2961c9[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x3b1269[_0xe36e('0x33')]);_0x2961c9[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x2961c9['model'],_0x2961c9[_0xe36e('0x33')]);_0x2ffc34[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x2961c9[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x3b1269[_0xe36e('0x33')][_0xe36e('0x38')]));_0x2ffc34[_0xe36e('0x37')]=_0x2ffc34[_0xe36e('0x37')]['length']?_0x2ffc34['attributes']:_0x2961c9[_0xe36e('0x31')];if(_0x3b1269['query'][_0xe36e('0x47')]){_0x2ffc34[_0xe36e('0x42')]=[{'all':!![]}];}_0x2ffc34=_[_0xe36e('0x40')]({},_0x2ffc34,_0x3b1269[_0xe36e('0x48')]);return db['ContactItemType'][_0xe36e('0x49')](_0x2ffc34)[_0xe36e('0x26')](handleEntityNotFound(_0x4c5e10,null))['then'](respondWithResult(_0x4c5e10,null))[_0xe36e('0x44')](handleError(_0x4c5e10,null));};exports[_0xe36e('0x4a')]=function(_0x2c26e6,_0x42eae5){return db[_0xe36e('0x2d')][_0xe36e('0x4a')](_0x2c26e6[_0xe36e('0x4b')],{})[_0xe36e('0x26')](function(_0x17555e){var _0x3a99aa=_0x2c26e6[_0xe36e('0x4c')][_0xe36e('0x28')]({'plain':!![]});if(!_0x3a99aa)throw new Error(_0xe36e('0x4d'));if(_0x3a99aa[_0xe36e('0x4e')]===_0xe36e('0x4c')){var _0x5678d3=_0x17555e[_0xe36e('0x28')]({'plain':!![]});var _0x55aadf='ContactItemTypes';return db[_0xe36e('0x4f')][_0xe36e('0x49')]({'where':{'name':_0x55aadf,'userProfileId':_0x3a99aa['userProfileId']},'raw':!![]})[_0xe36e('0x26')](function(_0x3814eb){if(_0x3814eb&&_0x3814eb[_0xe36e('0x50')]===0x0){return db[_0xe36e('0x51')][_0xe36e('0x4a')]({'name':_0x5678d3[_0xe36e('0x32')],'resourceId':_0x5678d3['id'],'type':_0x3814eb[_0xe36e('0x32')],'sectionId':_0x3814eb['id']},{})[_0xe36e('0x26')](function(){return _0x17555e;});}else{return _0x17555e;}})[_0xe36e('0x44')](function(_0x55d190){logger[_0xe36e('0x52')](_0xe36e('0x53'),_0x55d190);throw _0x55d190;});}return _0x17555e;})['then'](respondWithResult(_0x42eae5,0xc9))[_0xe36e('0x44')](handleError(_0x42eae5,null));};exports[_0xe36e('0x25')]=function(_0x3e1040,_0x206f75){if(_0x3e1040[_0xe36e('0x4b')]['id']){delete _0x3e1040['body']['id'];}return db['ContactItemType']['find']({'where':{'id':_0x3e1040['params']['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x206f75,null))[_0xe36e('0x26')](saveUpdates(_0x3e1040[_0xe36e('0x4b')],null))[_0xe36e('0x26')](respondWithResult(_0x206f75,null))[_0xe36e('0x44')](handleError(_0x206f75,null));};exports[_0xe36e('0x27')]=function(_0x7c3766,_0x17965c){return db[_0xe36e('0x2d')]['find']({'where':{'id':_0x7c3766[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x17965c,null))['then'](db[_0xe36e('0x54')][_0xe36e('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x7c3766[_0xe36e('0x46')]['id']}}))[_0xe36e('0x26')](removeEntity(_0x17965c,null))[_0xe36e('0x44')](handleError(_0x17965c,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index a17f1c4..127732f 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 _0x51eb=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x51eb,0x1ba));var _0xb51e=function(_0x1554fd,_0x2fe785){_0x1554fd=_0x1554fd-0x0;var _0x56b577=_0x51eb[_0x1554fd];return _0x56b577;};'use strict';var _=require(_0xb51e('0x0'));var util=require(_0xb51e('0x1'));var logger=require(_0xb51e('0x2'))(_0xb51e('0x3'));var moment=require('moment');var BPromise=require(_0xb51e('0x4'));var rp=require(_0xb51e('0x5'));var fs=require('fs');var path=require(_0xb51e('0x6'));var rimraf=require(_0xb51e('0x7'));var config=require(_0xb51e('0x8'));var attributes=require(_0xb51e('0x9'));module[_0xb51e('0xa')]=function(_0x4ad79b,_0x4e063d){return _0x4ad79b[_0xb51e('0xb')](_0xb51e('0xc'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ad7=['exports','define','ContactItemType','tools_contact_item_types','lodash','api','bluebird','request-promise','path','./contactItemType.attributes'];(function(_0x3a9883,_0x3c53cf){var _0x49a0ef=function(_0x5a16aa){while(--_0x5a16aa){_0x3a9883['push'](_0x3a9883['shift']());}};_0x49a0ef(++_0x3c53cf);}(_0x7ad7,0xe0));var _0x77ad=function(_0x3b9ba6,_0x4e7d1f){_0x3b9ba6=_0x3b9ba6-0x0;var _0x445105=_0x7ad7[_0x3b9ba6];return _0x445105;};'use strict';var _=require(_0x77ad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x77ad('0x1'));var moment=require('moment');var BPromise=require(_0x77ad('0x2'));var rp=require(_0x77ad('0x3'));var fs=require('fs');var path=require(_0x77ad('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x77ad('0x5'));module[_0x77ad('0x6')]=function(_0x1ace74,_0x29486f){return _0x1ace74[_0x77ad('0x7')](_0x77ad('0x8'),attributes,{'tableName':_0x77ad('0x9'),'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 aade266..635f4a1 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 _0xc91e=['client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xc91e,0xf3));var _0xec91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc91e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xec91('0x0'));var moment=require(_0xec91('0x1'));var BPromise=require(_0xec91('0x2'));var rs=require(_0xec91('0x3'));var fs=require('fs');var Redis=require(_0xec91('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xec91('0x5'));var logger=require(_0xec91('0x6'))(_0xec91('0x7'));var config=require(_0xec91('0x8'));var jayson=require(_0xec91('0x9'));var client=jayson[_0xec91('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fd3e4,_0x200d13,_0x2642a0){return new BPromise(function(_0x231256,_0x801b57){return client[_0xec91('0xb')](_0x1fd3e4,_0x2642a0)[_0xec91('0xc')](function(_0x527010){logger[_0xec91('0xd')](_0xec91('0xe'),_0x200d13,_0xec91('0xf'));logger[_0xec91('0x10')](_0xec91('0x11'),_0x200d13,_0xec91('0xf'),JSON[_0xec91('0x12')](_0x527010));if(_0x527010[_0xec91('0x13')]){if(_0x527010[_0xec91('0x13')][_0xec91('0x14')]===0x1f4){logger[_0xec91('0x13')](_0xec91('0xe'),_0x200d13,_0x527010[_0xec91('0x13')][_0xec91('0x15')]);return _0x801b57(_0x527010[_0xec91('0x13')][_0xec91('0x15')]);}logger['error'](_0xec91('0xe'),_0x200d13,_0x527010[_0xec91('0x13')]['message']);return _0x231256(_0x527010[_0xec91('0x13')][_0xec91('0x15')]);}else{logger['info'](_0xec91('0xe'),_0x200d13,'request\x20sent');_0x231256(_0x527010[_0xec91('0x16')][_0xec91('0x15')]);}})['catch'](function(_0x5eb6e1){logger['error'](_0xec91('0xe'),_0x200d13,_0x5eb6e1);_0x801b57(_0x5eb6e1);});});} \ No newline at end of file +var _0xe083=['request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s'];(function(_0x1250c5,_0x35e550){var _0x2afac5=function(_0x197ba2){while(--_0x197ba2){_0x1250c5['push'](_0x1250c5['shift']());}};_0x2afac5(++_0x35e550);}(_0xe083,0x76));var _0x3e08=function(_0x4a8973,_0x30d011){_0x4a8973=_0x4a8973-0x0;var _0x150b1d=_0xe083[_0x4a8973];return _0x150b1d;};'use strict';var _=require(_0x3e08('0x0'));var util=require(_0x3e08('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3e08('0x2'));var fs=require('fs');var Redis=require(_0x3e08('0x3'));var db=require(_0x3e08('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e08('0x5'))(_0x3e08('0x6'));var config=require('../../config/environment');var jayson=require(_0x3e08('0x7'));var client=jayson[_0x3e08('0x8')][_0x3e08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51bd77,_0x203348,_0x2ddcdd){return new BPromise(function(_0x4378ca,_0x5d9589){return client[_0x3e08('0xa')](_0x51bd77,_0x2ddcdd)[_0x3e08('0xb')](function(_0xfc6661){logger[_0x3e08('0xc')](_0x3e08('0xd'),_0x203348,_0x3e08('0xe'));logger[_0x3e08('0xf')](_0x3e08('0x10'),_0x203348,'request\x20sent',JSON[_0x3e08('0x11')](_0xfc6661));if(_0xfc6661[_0x3e08('0x12')]){if(_0xfc6661['error'][_0x3e08('0x13')]===0x1f4){logger[_0x3e08('0x12')](_0x3e08('0xd'),_0x203348,_0xfc6661[_0x3e08('0x12')][_0x3e08('0x14')]);return _0x5d9589(_0xfc6661[_0x3e08('0x12')]['message']);}logger[_0x3e08('0x12')](_0x3e08('0xd'),_0x203348,_0xfc6661[_0x3e08('0x12')][_0x3e08('0x14')]);return _0x4378ca(_0xfc6661[_0x3e08('0x12')][_0x3e08('0x14')]);}else{logger['info'](_0x3e08('0xd'),_0x203348,_0x3e08('0xe'));_0x4378ca(_0xfc6661['result']['message']);}})[_0x3e08('0x15')](function(_0x10c847){logger[_0x3e08('0x12')](_0x3e08('0xd'),_0x203348,_0x10c847);_0x5d9589(_0x10c847);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 8b3cce9..2c84cef 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 _0x9120=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x40be86,_0x68fe5d){var _0xda3c3b=function(_0x39deab){while(--_0x39deab){_0x40be86['push'](_0x40be86['shift']());}};_0xda3c3b(++_0x68fe5d);}(_0x9120,0xf1));var _0x0912=function(_0x3a9737,_0xb3e2d0){_0x3a9737=_0x3a9737-0x0;var _0xcf6a9d=_0x9120[_0x3a9737];return _0xcf6a9d;};'use strict';var multer=require(_0x0912('0x0'));var util=require(_0x0912('0x1'));var path=require(_0x0912('0x2'));var timeout=require('connect-timeout');var express=require(_0x0912('0x3'));var router=express[_0x0912('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0912('0x5'));var interaction=require(_0x0912('0x6'));var config=require(_0x0912('0x7'));var controller=require(_0x0912('0x8'));router[_0x0912('0x9')]('/',auth[_0x0912('0xa')](),controller[_0x0912('0xb')]);router['get'](_0x0912('0xc'),auth[_0x0912('0xa')](),controller[_0x0912('0xd')]);router[_0x0912('0xe')]('/',auth[_0x0912('0xa')](),controller[_0x0912('0xf')]);router['put'](_0x0912('0xc'),auth[_0x0912('0xa')](),controller[_0x0912('0x10')]);router[_0x0912('0x11')](_0x0912('0xc'),auth[_0x0912('0xa')](),controller[_0x0912('0x12')]);module[_0x0912('0x13')]=router; \ No newline at end of file +var _0xd111=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','get','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x41b04c,_0x35837c){var _0x338984=function(_0x57430e){while(--_0x57430e){_0x41b04c['push'](_0x41b04c['shift']());}};_0x338984(++_0x35837c);}(_0xd111,0x14f));var _0x1d11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd111[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1d11('0x0'));var util=require(_0x1d11('0x1'));var path=require(_0x1d11('0x2'));var timeout=require(_0x1d11('0x3'));var express=require(_0x1d11('0x4'));var router=express[_0x1d11('0x5')]();var fs_extra=require(_0x1d11('0x6'));var auth=require(_0x1d11('0x7'));var interaction=require(_0x1d11('0x8'));var config=require(_0x1d11('0x9'));var controller=require(_0x1d11('0xa'));router['get']('/',auth[_0x1d11('0xb')](),controller['index']);router[_0x1d11('0xc')](_0x1d11('0xd'),auth[_0x1d11('0xb')](),controller['show']);router[_0x1d11('0xe')]('/',auth[_0x1d11('0xb')](),controller[_0x1d11('0xf')]);router[_0x1d11('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1d11('0x11')]);router['delete']('/:id',auth[_0x1d11('0xb')](),controller[_0x1d11('0x12')]);module[_0x1d11('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 27371c3..dc868d0 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x56e2b3,_0x2153f7){var _0x3581f1=function(_0x27bc57){while(--_0x27bc57){_0x56e2b3['push'](_0x56e2b3['shift']());}};_0x3581f1(++_0x2153f7);}(_0xb10b,0x12a));var _0xbb10=function(_0x24c15a,_0x261c48){_0x24c15a=_0x24c15a-0x0;var _0x2a3137=_0xb10b[_0x24c15a];return _0x2a3137;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x3e0f9d,_0x187bc9){var _0x184b9c=function(_0x1e2196){while(--_0x1e2196){_0x3e0f9d['push'](_0x3e0f9d['shift']());}};_0x184b9c(++_0x187bc9);}(_0xb10b,0x12a));var _0xbb10=function(_0x29af75,_0x152b87){_0x29af75=_0x29af75-0x0;var _0x32b56b=_0xb10b[_0x29af75];return _0x32b56b;};'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 b66602e..9394b13 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 _0x82d4=['map','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','intersection','find','create','Dashboard','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','user','role','userProfileId','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','zip-dir','request-promise','bluebird','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x82d4,0xcf));var _0x482d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82d4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x482d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x482d('0x1'));var moment=require('moment');var BPromise=require(_0x482d('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x482d('0x3'));var sox=require('sox');var csv=require(_0x482d('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x482d('0x5'));var squel=require(_0x482d('0x6'));var crypto=require('crypto');var jsforce=require(_0x482d('0x7'));var deskjs=require(_0x482d('0x8'));var toCsv=require(_0x482d('0x4'));var querystring=require(_0x482d('0x9'));var Papa=require(_0x482d('0xa'));var Redis=require(_0x482d('0xb'));var authService=require(_0x482d('0xc'));var qs=require(_0x482d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x482d('0xe'));var logger=require(_0x482d('0xf'))(_0x482d('0x10'));var utils=require('../../config/utils');var config=require(_0x482d('0x11'));var licenseUtil=require(_0x482d('0x12'));var db=require('../../mysqldb')['db'];config[_0x482d('0x13')]=_[_0x482d('0x14')](config[_0x482d('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x482d('0x15'))(new Redis(config[_0x482d('0x13')]));require(_0x482d('0x16'))[_0x482d('0x17')](socket);function respondWithStatusCode(_0x4d81eb,_0x40685d){_0x40685d=_0x40685d||0xcc;return function(_0x1abf85){if(_0x1abf85){return _0x4d81eb[_0x482d('0x18')](_0x40685d);}return _0x4d81eb[_0x482d('0x19')](_0x40685d)['end']();};}function respondWithResult(_0x23c092,_0x5c2d78){_0x5c2d78=_0x5c2d78||0xc8;return function(_0xa202b5){if(_0xa202b5){return _0x23c092[_0x482d('0x19')](_0x5c2d78)[_0x482d('0x1a')](_0xa202b5);}};}function respondWithFilteredResult(_0x2d6209,_0x132d89){return function(_0x111629){if(_0x111629){var _0x5cbf7e=typeof _0x132d89[_0x482d('0x1b')]===_0x482d('0x1c')&&typeof _0x132d89['limit']===_0x482d('0x1c');var _0x382b46=_0x111629['count'];var _0x548ce9=_0x5cbf7e?0x0:_0x132d89[_0x482d('0x1b')];var _0x567d10=_0x5cbf7e?_0x111629['count']:_0x132d89['offset']+_0x132d89[_0x482d('0x1d')];var _0xaa5a9e;if(_0x567d10>=_0x382b46){_0x567d10=_0x382b46;_0xaa5a9e=0xc8;}else{_0xaa5a9e=0xce;}_0x2d6209[_0x482d('0x19')](_0xaa5a9e);return _0x2d6209[_0x482d('0x1e')](_0x482d('0x1f'),_0x548ce9+'-'+_0x567d10+'/'+_0x382b46)[_0x482d('0x1a')](_0x111629);}return null;};}function patchUpdates(_0x43414d){return function(_0x3339da){try{jsonpatch['apply'](_0x3339da,_0x43414d,!![]);}catch(_0x206907){return BPromise[_0x482d('0x20')](_0x206907);}return _0x3339da[_0x482d('0x21')]();};}function saveUpdates(_0x4a84da,_0xe1f230){return function(_0xfc4ff0){if(_0xfc4ff0){return _0xfc4ff0[_0x482d('0x22')](_0x4a84da)[_0x482d('0x23')](function(_0x42f0df){return _0x42f0df;});}return null;};}function removeEntity(_0x79397a,_0x145a1b){return function(_0x4b33a2){if(_0x4b33a2){return _0x4b33a2[_0x482d('0x24')]()[_0x482d('0x23')](function(){var _0x16476e=_0x4b33a2[_0x482d('0x25')]({'plain':!![]});var _0x30e74a=_0x482d('0x26');return db[_0x482d('0x27')][_0x482d('0x24')]({'where':{'type':_0x30e74a,'resourceId':_0x16476e['id']}})[_0x482d('0x23')](function(){return _0x4b33a2;});})[_0x482d('0x23')](function(){_0x79397a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c6ce,_0x39dfc4){return function(_0x2790a3){if(!_0x2790a3){_0x43c6ce['sendStatus'](0x194);}return _0x2790a3;};}function handleError(_0x768c72,_0x248313){_0x248313=_0x248313||0x1f4;return function(_0x42cf0c){logger[_0x482d('0x28')](_0x42cf0c[_0x482d('0x29')]);if(_0x42cf0c[_0x482d('0x2a')]){delete _0x42cf0c[_0x482d('0x2a')];}_0x768c72['status'](_0x248313)[_0x482d('0x2b')](_0x42cf0c);};}exports[_0x482d('0x2c')]=function(_0x2688da,_0x468e44){var _0x1da892={},_0xfe8c6d={},_0x2ac5e2={'count':0x0,'rows':[]};var _0x2e92f8=_[_0x482d('0x2d')](db['Dashboard'][_0x482d('0x2e')],function(_0x6fa3a0){return{'name':_0x6fa3a0[_0x482d('0x2f')],'type':_0x6fa3a0[_0x482d('0x30')][_0x482d('0x31')]};});_0xfe8c6d[_0x482d('0x32')]=_[_0x482d('0x2d')](_0x2e92f8,_0x482d('0x2a'));_0xfe8c6d['query']=_[_0x482d('0x33')](_0x2688da[_0x482d('0x34')]);_0xfe8c6d[_0x482d('0x35')]=_['intersection'](_0xfe8c6d[_0x482d('0x32')],_0xfe8c6d['query']);_0x1da892['attributes']=_['intersection'](_0xfe8c6d[_0x482d('0x32')],qs[_0x482d('0x36')](_0x2688da['query'][_0x482d('0x36')]));_0x1da892[_0x482d('0x37')]=_0x1da892[_0x482d('0x37')][_0x482d('0x38')]?_0x1da892['attributes']:_0xfe8c6d[_0x482d('0x32')];if(!_0x2688da['query'][_0x482d('0x39')](_0x482d('0x3a'))){_0x1da892['limit']=qs['limit'](_0x2688da['query'][_0x482d('0x1d')]);_0x1da892[_0x482d('0x1b')]=qs['offset'](_0x2688da[_0x482d('0x34')]['offset']);}_0x1da892[_0x482d('0x3b')]=qs[_0x482d('0x3c')](_0x2688da[_0x482d('0x34')]['sort']);_0x1da892[_0x482d('0x3d')]=qs[_0x482d('0x35')](_[_0x482d('0x3e')](_0x2688da[_0x482d('0x34')],_0xfe8c6d[_0x482d('0x35')]),_0x2e92f8);if(_0x2688da[_0x482d('0x34')][_0x482d('0x3f')]){_0x1da892[_0x482d('0x3d')]=_[_0x482d('0x40')](_0x1da892[_0x482d('0x3d')],{'$or':_[_0x482d('0x2d')](_0x2e92f8,function(_0x881186){if(_0x881186[_0x482d('0x30')]!==_0x482d('0x41')){var _0x513bc2={};_0x513bc2[_0x881186['name']]={'$like':'%'+_0x2688da[_0x482d('0x34')]['filter']+'%'};return _0x513bc2;}})});}_0x1da892=_[_0x482d('0x40')]({},_0x1da892,_0x2688da[_0x482d('0x42')]);var _0x3ead0e={'where':_0x1da892[_0x482d('0x3d')]};return db['Dashboard'][_0x482d('0x43')](_0x3ead0e)[_0x482d('0x23')](function(_0xb5f26f){_0x2ac5e2[_0x482d('0x43')]=_0xb5f26f;if(_0x2688da['query'][_0x482d('0x44')]){_0x1da892[_0x482d('0x45')]=[{'all':!![]}];}return db['Dashboard'][_0x482d('0x46')](_0x1da892);})[_0x482d('0x23')](function(_0x4a2c3e){_0x2ac5e2['rows']=_0x4a2c3e;return _0x2ac5e2;})[_0x482d('0x23')](respondWithFilteredResult(_0x468e44,_0x1da892))[_0x482d('0x47')](handleError(_0x468e44,null));};exports[_0x482d('0x48')]=function(_0x36410d,_0x29ded2){var _0x32b8f6={'raw':![],'where':{'id':_0x36410d['params']['id']}},_0x3c243a={};_0x3c243a[_0x482d('0x32')]=_[_0x482d('0x33')](db['Dashboard'][_0x482d('0x2e')]);_0x3c243a[_0x482d('0x34')]=_[_0x482d('0x33')](_0x36410d[_0x482d('0x34')]);_0x3c243a[_0x482d('0x35')]=_[_0x482d('0x49')](_0x3c243a[_0x482d('0x32')],_0x3c243a[_0x482d('0x34')]);_0x32b8f6[_0x482d('0x37')]=_[_0x482d('0x49')](_0x3c243a[_0x482d('0x32')],qs[_0x482d('0x36')](_0x36410d['query'][_0x482d('0x36')]));_0x32b8f6[_0x482d('0x37')]=_0x32b8f6[_0x482d('0x37')][_0x482d('0x38')]?_0x32b8f6[_0x482d('0x37')]:_0x3c243a[_0x482d('0x32')];if(_0x36410d[_0x482d('0x34')]['includeAll']){_0x32b8f6[_0x482d('0x45')]=[{'all':!![]}];}_0x32b8f6=_[_0x482d('0x40')]({},_0x32b8f6,_0x36410d[_0x482d('0x42')]);return db['Dashboard'][_0x482d('0x4a')](_0x32b8f6)[_0x482d('0x23')](handleEntityNotFound(_0x29ded2,null))[_0x482d('0x23')](respondWithResult(_0x29ded2,null))[_0x482d('0x47')](handleError(_0x29ded2,null));};exports[_0x482d('0x4b')]=function(_0x4aa23a,_0x60132b){return db[_0x482d('0x4c')][_0x482d('0x4b')](_0x4aa23a[_0x482d('0x4d')],{})['then'](function(_0xc07fc7){var _0x38f4d5=_0x4aa23a['user'][_0x482d('0x25')]({'plain':!![]});if(!_0x38f4d5)throw new Error(_0x482d('0x4e'));if(_0x38f4d5['role']==='user'){var _0x53d8e0=_0xc07fc7[_0x482d('0x25')]({'plain':!![]});var _0x2f19e6=_0x482d('0x26');return db[_0x482d('0x4f')]['find']({'where':{'name':_0x2f19e6,'userProfileId':_0x38f4d5['userProfileId']},'raw':!![]})[_0x482d('0x23')](function(_0x4c525b){if(_0x4c525b&&_0x4c525b[_0x482d('0x50')]===0x0){return db[_0x482d('0x27')][_0x482d('0x4b')]({'name':_0x53d8e0[_0x482d('0x2a')],'resourceId':_0x53d8e0['id'],'type':_0x4c525b[_0x482d('0x2a')],'sectionId':_0x4c525b['id']},{})[_0x482d('0x23')](function(){return _0xc07fc7;});}else{return _0xc07fc7;}})[_0x482d('0x47')](function(_0x475a8a){logger[_0x482d('0x28')](_0x482d('0x51'),_0x475a8a);throw _0x475a8a;});}return _0xc07fc7;})['then'](respondWithResult(_0x60132b,0xc9))['catch'](handleError(_0x60132b,null));};exports[_0x482d('0x52')]=function(_0x5b0b8b,_0x1bb403){var _0x5e7abf={'where':{'id':_0x5b0b8b[_0x482d('0x53')]['id']}},_0x40cea3={};_0x40cea3['model']=_[_0x482d('0x33')](db[_0x482d('0x4c')][_0x482d('0x2e')]);_0x5e7abf['attributes']=_[_0x482d('0x49')](_0x40cea3[_0x482d('0x32')],qs[_0x482d('0x36')](_0x5b0b8b[_0x482d('0x34')]['fields']));_0x5e7abf[_0x482d('0x37')]=_0x5e7abf[_0x482d('0x37')][_0x482d('0x38')]?_0x5e7abf[_0x482d('0x37')]:_0x40cea3[_0x482d('0x32')];if(_0x5b0b8b[_0x482d('0x34')][_0x482d('0x44')]){_0x5e7abf[_0x482d('0x45')]=[{'all':!![]}];}_0x5e7abf=_[_0x482d('0x40')]({},_0x5e7abf,_0x5b0b8b[_0x482d('0x42')]);return db['Dashboard']['find'](_0x5e7abf)['then'](handleEntityNotFound(_0x1bb403,null))[_0x482d('0x23')](function(_0xddf3c){if(_0xddf3c){var _0x428c35=_0xddf3c[_0x482d('0x25')]({'plain':!![]});_0x428c35=qs[_0x482d('0x54')](_0x428c35,['id',_0x482d('0x55'),_0x482d('0x56')]);_0x5b0b8b[_0x482d('0x4d')]=_['omit'](_0x5b0b8b[_0x482d('0x4d')],['id',_0x482d('0x55'),_0x482d('0x56')]);return db['Dashboard'][_0x482d('0x4b')](_[_0x482d('0x40')](_0x428c35,_0x5b0b8b[_0x482d('0x4d')]),{'include':_0x5b0b8b[_0x482d('0x34')][_0x482d('0x44')]?[{'all':!![]}]:undefined})[_0x482d('0x23')](function(_0x52cddc){var _0x348913=_0x5b0b8b[_0x482d('0x57')][_0x482d('0x25')]({'plain':!![]});if(!_0x348913)throw new Error(_0x482d('0x4e'));if(_0x348913[_0x482d('0x58')]==='user'){var _0x5df6a1=_0x52cddc[_0x482d('0x25')]({'plain':!![]});var _0x6b0010=_0x482d('0x26');return db[_0x482d('0x4f')][_0x482d('0x4a')]({'where':{'name':_0x6b0010,'userProfileId':_0x348913[_0x482d('0x59')]},'raw':!![]})[_0x482d('0x23')](function(_0x4d585a){if(_0x4d585a&&_0x4d585a[_0x482d('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x5df6a1[_0x482d('0x2a')],'resourceId':_0x5df6a1['id'],'type':_0x4d585a[_0x482d('0x2a')],'sectionId':_0x4d585a['id']},{})[_0x482d('0x23')](function(){return _0x52cddc;});}else{return _0x52cddc;}})[_0x482d('0x47')](function(_0x4df10c){logger[_0x482d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4df10c);throw _0x4df10c;});}return _0x52cddc;});}})[_0x482d('0x23')](respondWithResult(_0x1bb403,0xc9))[_0x482d('0x47')](handleError(_0x1bb403,null));};exports['update']=function(_0xbe5bc8,_0x37097b){if(_0xbe5bc8[_0x482d('0x4d')]['id']){delete _0xbe5bc8[_0x482d('0x4d')]['id'];}return db['Dashboard']['find']({'where':{'id':_0xbe5bc8['params']['id']}})['then'](handleEntityNotFound(_0x37097b,null))[_0x482d('0x23')](saveUpdates(_0xbe5bc8['body'],null))[_0x482d('0x23')](respondWithResult(_0x37097b,null))[_0x482d('0x47')](handleError(_0x37097b,null));};exports[_0x482d('0x24')]=function(_0x20a9ff,_0x533735){return db['Dashboard']['find']({'where':{'id':_0x20a9ff['params']['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x533735,null))[_0x482d('0x23')](removeEntity(_0x533735,null))['catch'](handleError(_0x533735,null));};function widgetAttributes(_0x11ba0b){try{switch(_0x11ba0b[_0x482d('0x30')]){case _0x482d('0x5a'):return[{'name':_0x482d('0x5b'),'value':_0x11ba0b[_0x482d('0x5b')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b['attrs'][0x0]?_0x11ba0b['attrs'][0x0]['value']:undefined)||_0x482d('0x5d')}];case'custom':return[{'name':_0x482d('0x5e'),'value':_0x11ba0b[_0x482d('0x5e')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x0]?_0x11ba0b['attrs'][0x0][_0x482d('0x5f')]:undefined)||''}];case _0x482d('0x60'):return[{'name':'attrHourFormat','value':_0x11ba0b[_0x482d('0x61')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x0]?_0x11ba0b['attrs'][0x0][_0x482d('0x5f')]:undefined)||'HH:mm:ss'},{'name':_0x482d('0x62'),'value':_0x11ba0b[_0x482d('0x62')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x1]?_0x11ba0b['attrs'][0x1][_0x482d('0x5f')]:undefined)||'0.00'},{'name':_0x482d('0x63'),'value':_0x11ba0b['attrFontSize']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x2]?_0x11ba0b['attrs'][0x2]['value']:undefined)||0xc}];case _0x482d('0x64'):return[{'name':_0x482d('0x65'),'value':_0x11ba0b['attrMetric']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x0]?_0x11ba0b['attrs'][0x0][_0x482d('0x5f')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x11ba0b[_0x482d('0x66')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x1]?_0x11ba0b[_0x482d('0x5c')][0x1][_0x482d('0x5f')]:undefined)||[]},{'name':'attrFontSize','value':_0x11ba0b[_0x482d('0x63')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x2]?_0x11ba0b[_0x482d('0x5c')][0x2][_0x482d('0x5f')]:undefined)||0x14},{'name':_0x482d('0x67'),'value':_0x11ba0b[_0x482d('0x67')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x3]?_0x11ba0b[_0x482d('0x5c')][0x3][_0x482d('0x5f')]:undefined)||_0x482d('0x68')},{'name':_0x482d('0x69'),'value':_0x11ba0b[_0x482d('0x69')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x4]?_0x11ba0b['attrs'][0x4][_0x482d('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x11ba0b[_0x482d('0x6a')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x5]?_0x11ba0b['attrs'][0x5][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6b'),'value':_0x11ba0b[_0x482d('0x6b')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x6]?_0x11ba0b[_0x482d('0x5c')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x11ba0b[_0x482d('0x6c')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x7]?_0x11ba0b[_0x482d('0x5c')][0x7][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6d'),'value':_0x11ba0b['attrWhatsappAccounts']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x8]?_0x11ba0b[_0x482d('0x5c')][0x8][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6e'),'value':_0x11ba0b['attrChatWebsites']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x9]?_0x11ba0b[_0x482d('0x5c')][0x9][_0x482d('0x5f')]:undefined)||''}];case _0x482d('0x6f'):case _0x482d('0x70'):return[{'name':_0x482d('0x71'),'value':_0x11ba0b[_0x482d('0x71')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x0]?_0x11ba0b[_0x482d('0x5c')][0x0][_0x482d('0x5f')]:undefined)||'total'},{'name':_0x482d('0x72'),'value':_0x11ba0b[_0x482d('0x72')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b['attrs'][0x1]?_0x11ba0b[_0x482d('0x5c')][0x1]['value']:undefined)||null},{'name':_0x482d('0x73'),'value':_0x11ba0b[_0x482d('0x73')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x2]?_0x11ba0b[_0x482d('0x5c')][0x2][_0x482d('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x11ba0b[_0x482d('0x66')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x3]?_0x11ba0b[_0x482d('0x5c')][0x3][_0x482d('0x5f')]:undefined)||[]},{'name':_0x482d('0x67'),'value':_0x11ba0b[_0x482d('0x67')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x4]?_0x11ba0b[_0x482d('0x5c')][0x4]['value']:undefined)||_0x482d('0x68')},{'name':'attrEmailAccounts','value':_0x11ba0b[_0x482d('0x69')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x5]?_0x11ba0b[_0x482d('0x5c')][0x5][_0x482d('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x11ba0b['attrFaxAccounts']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x6]?_0x11ba0b['attrs'][0x6][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6b'),'value':_0x11ba0b[_0x482d('0x6b')]||(_0x11ba0b['attrs']&&_0x11ba0b[_0x482d('0x5c')][0x7]?_0x11ba0b[_0x482d('0x5c')][0x7][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6c'),'value':_0x11ba0b[_0x482d('0x6c')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x8]?_0x11ba0b['attrs'][0x8][_0x482d('0x5f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x11ba0b[_0x482d('0x6d')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x9]?_0x11ba0b[_0x482d('0x5c')][0x9][_0x482d('0x5f')]:undefined)||''},{'name':_0x482d('0x6e'),'value':_0x11ba0b[_0x482d('0x6e')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0xa]?_0x11ba0b['attrs'][0xa][_0x482d('0x5f')]:undefined)||''}];case _0x482d('0x74'):return[{'name':_0x482d('0x75'),'type':_0x11ba0b['reportType']||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x0]?_0x11ba0b[_0x482d('0x5c')][0x0][_0x482d('0x30')]:undefined)||null,'value':_0x11ba0b[_0x482d('0x75')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b['attrs'][0x0]?_0x11ba0b[_0x482d('0x5c')][0x0][_0x482d('0x5f')]:undefined)||null},{'name':_0x482d('0x76'),'value':_0x11ba0b[_0x482d('0x76')]||(_0x11ba0b[_0x482d('0x5c')]&&_0x11ba0b[_0x482d('0x5c')][0x1]?_0x11ba0b[_0x482d('0x5c')][0x1][_0x482d('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x4394f8){logger[_0x482d('0x28')](_0x482d('0x77'),JSON[_0x482d('0x78')](_0x4394f8));return[];}}exports[_0x482d('0x79')]=function(_0x53bec5,_0x3ecdd8,_0x29de67){if(_0x53bec5[_0x482d('0x4d')]['id']){delete _0x53bec5['body']['id'];}return db[_0x482d('0x4c')][_0x482d('0x4a')]({'where':{'id':_0x53bec5['params']['id']}})[_0x482d('0x23')](handleEntityNotFound(_0x3ecdd8,null))[_0x482d('0x23')](function(_0x15e6c5){if(_0x15e6c5){_0x53bec5[_0x482d('0x4d')][_0x482d('0x7a')]=_0x15e6c5['id'];_0x53bec5[_0x482d('0x4d')]['attrs']=widgetAttributes(_0x53bec5[_0x482d('0x4d')]);return db[_0x482d('0x7b')][_0x482d('0x4b')](_0x53bec5[_0x482d('0x4d')]);}})[_0x482d('0x23')](respondWithResult(_0x3ecdd8,null))[_0x482d('0x47')](handleError(_0x3ecdd8,null));};exports['getItems']=function(_0x10c0c3,_0x3cf428,_0xe165ab){var _0x456159={};var _0x703d57={};var _0x44da20;var _0x47518b;return db[_0x482d('0x4c')][_0x482d('0x7c')]({'where':{'id':_0x10c0c3['params']['id']}})['then'](handleEntityNotFound(_0x3cf428,null))[_0x482d('0x23')](function(_0x234240){if(_0x234240){_0x44da20=_0x234240;_0x703d57[_0x482d('0x32')]=_['keys'](db[_0x482d('0x7b')][_0x482d('0x2e')]);_0x703d57[_0x482d('0x34')]=_[_0x482d('0x33')](_0x10c0c3[_0x482d('0x34')]);_0x703d57[_0x482d('0x35')]=_['intersection'](_0x703d57[_0x482d('0x32')],_0x703d57[_0x482d('0x34')]);_0x456159[_0x482d('0x37')]=_[_0x482d('0x49')](_0x703d57['model'],qs[_0x482d('0x36')](_0x10c0c3[_0x482d('0x34')][_0x482d('0x36')]));_0x456159[_0x482d('0x37')]=_0x456159[_0x482d('0x37')][_0x482d('0x38')]?_0x456159[_0x482d('0x37')]:_0x703d57[_0x482d('0x32')];_0x456159['order']=qs[_0x482d('0x3c')](_0x10c0c3['query'][_0x482d('0x3c')]);_0x456159['where']=qs[_0x482d('0x35')](_[_0x482d('0x3e')](_0x10c0c3[_0x482d('0x34')],_0x703d57[_0x482d('0x35')]));if(_0x10c0c3[_0x482d('0x34')][_0x482d('0x3f')]){_0x456159[_0x482d('0x3d')]=_[_0x482d('0x40')](_0x456159[_0x482d('0x3d')],{'$or':_['map'](_0x456159['attributes'],function(_0x277b50){var _0x5c0afb={};_0x5c0afb[_0x277b50]={'$like':'%'+_0x10c0c3[_0x482d('0x34')]['filter']+'%'};return _0x5c0afb;})});}_0x456159=_[_0x482d('0x40')]({},_0x456159,_0x10c0c3[_0x482d('0x42')]);return _0x44da20[_0x482d('0x7d')](_0x456159);}})[_0x482d('0x23')](function(_0x3907a4){if(_0x3907a4){_0x47518b=_0x3907a4['length'];if(!_0x10c0c3['query'][_0x482d('0x39')]('nolimit')){_0x456159[_0x482d('0x1d')]=qs['limit'](_0x10c0c3[_0x482d('0x34')][_0x482d('0x1d')]);_0x456159[_0x482d('0x1b')]=qs['offset'](_0x10c0c3['query'][_0x482d('0x1b')]);}return _0x44da20['getItems'](_0x456159);}})[_0x482d('0x23')](function(_0x85c3e2){if(_0x85c3e2){return _0x85c3e2?{'count':_0x47518b,'rows':_0x85c3e2}:null;}})[_0x482d('0x23')](respondWithResult(_0x3cf428,null))[_0x482d('0x47')](handleError(_0x3cf428,null));}; \ No newline at end of file +var _0x0509=['undefined','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Dashboard','rawAttributes','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','merge','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','role','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChatWebsites','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','getItems','pick','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','offset'];(function(_0x26f169,_0x2d01b2){var _0x43aad9=function(_0x4395ea){while(--_0x4395ea){_0x26f169['push'](_0x26f169['shift']());}};_0x43aad9(++_0x2d01b2);}(_0x0509,0x1ed));var _0x9050=function(_0x7f870e,_0x393b9c){_0x7f870e=_0x7f870e-0x0;var _0x752210=_0x0509[_0x7f870e];return _0x752210;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9050('0x0'));var zipdir=require(_0x9050('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9050('0x2'));var moment=require(_0x9050('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9050('0x4'));var util=require(_0x9050('0x5'));var path=require(_0x9050('0x6'));var sox=require(_0x9050('0x7'));var csv=require(_0x9050('0x8'));var ejs=require(_0x9050('0x9'));var fs=require('fs');var fs_extra=require(_0x9050('0xa'));var _=require(_0x9050('0xb'));var squel=require(_0x9050('0xc'));var crypto=require(_0x9050('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9050('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9050('0xf'));var Redis=require('ioredis');var authService=require(_0x9050('0x10'));var qs=require(_0x9050('0x11'));var as=require(_0x9050('0x12'));var hardwareService=require(_0x9050('0x13'));var logger=require(_0x9050('0x14'))(_0x9050('0x15'));var utils=require(_0x9050('0x16'));var config=require(_0x9050('0x17'));var licenseUtil=require(_0x9050('0x18'));var db=require(_0x9050('0x19'))['db'];config[_0x9050('0x1a')]=_[_0x9050('0x1b')](config[_0x9050('0x1a')],{'host':_0x9050('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9050('0x1a')]));require(_0x9050('0x1d'))[_0x9050('0x1e')](socket);function respondWithStatusCode(_0x5749bb,_0x1a2b36){_0x1a2b36=_0x1a2b36||0xcc;return function(_0x11ae41){if(_0x11ae41){return _0x5749bb[_0x9050('0x1f')](_0x1a2b36);}return _0x5749bb[_0x9050('0x20')](_0x1a2b36)[_0x9050('0x21')]();};}function respondWithResult(_0x23b3f,_0x1dcbf4){_0x1dcbf4=_0x1dcbf4||0xc8;return function(_0x429f21){if(_0x429f21){return _0x23b3f[_0x9050('0x20')](_0x1dcbf4)['json'](_0x429f21);}};}function respondWithFilteredResult(_0x195f2d,_0xaa2109){return function(_0x33ab58){if(_0x33ab58){var _0x5caf56=typeof _0xaa2109[_0x9050('0x22')]===_0x9050('0x23')&&typeof _0xaa2109[_0x9050('0x24')]===_0x9050('0x23');var _0x2a3587=_0x33ab58[_0x9050('0x25')];var _0x44a428=_0x5caf56?0x0:_0xaa2109[_0x9050('0x22')];var _0x427ec7=_0x5caf56?_0x33ab58['count']:_0xaa2109[_0x9050('0x22')]+_0xaa2109[_0x9050('0x24')];var _0xffc94a;if(_0x427ec7>=_0x2a3587){_0x427ec7=_0x2a3587;_0xffc94a=0xc8;}else{_0xffc94a=0xce;}_0x195f2d[_0x9050('0x20')](_0xffc94a);return _0x195f2d[_0x9050('0x26')]('Content-Range',_0x44a428+'-'+_0x427ec7+'/'+_0x2a3587)[_0x9050('0x27')](_0x33ab58);}return null;};}function patchUpdates(_0x4648d0){return function(_0x574c76){try{jsonpatch[_0x9050('0x28')](_0x574c76,_0x4648d0,!![]);}catch(_0x20de8b){return BPromise['reject'](_0x20de8b);}return _0x574c76[_0x9050('0x29')]();};}function saveUpdates(_0x130677,_0x3ef5d9){return function(_0x1cc58a){if(_0x1cc58a){return _0x1cc58a[_0x9050('0x2a')](_0x130677)[_0x9050('0x2b')](function(_0x10f53f){return _0x10f53f;});}return null;};}function removeEntity(_0x8cac4b,_0x987cde){return function(_0x119ef8){if(_0x119ef8){return _0x119ef8[_0x9050('0x2c')]()['then'](function(){var _0xca77b5=_0x119ef8[_0x9050('0x2d')]({'plain':!![]});var _0xb43503='CustomDashboards';return db[_0x9050('0x2e')][_0x9050('0x2c')]({'where':{'type':_0xb43503,'resourceId':_0xca77b5['id']}})[_0x9050('0x2b')](function(){return _0x119ef8;});})['then'](function(){_0x8cac4b[_0x9050('0x20')](0xcc)[_0x9050('0x21')]();});}};}function handleEntityNotFound(_0x10b444,_0x21f29f){return function(_0x3fe4c3){if(!_0x3fe4c3){_0x10b444[_0x9050('0x1f')](0x194);}return _0x3fe4c3;};}function handleError(_0x2709d6,_0x1f7db7){_0x1f7db7=_0x1f7db7||0x1f4;return function(_0x3c23a8){logger[_0x9050('0x2f')](_0x3c23a8[_0x9050('0x30')]);if(_0x3c23a8['name']){delete _0x3c23a8[_0x9050('0x31')];}_0x2709d6[_0x9050('0x20')](_0x1f7db7)[_0x9050('0x32')](_0x3c23a8);};}exports[_0x9050('0x33')]=function(_0x1b5b9b,_0xcf1eee){var _0x45311d={},_0x24ff52={},_0x4650df={'count':0x0,'rows':[]};var _0x9fb04c=_['map'](db[_0x9050('0x34')][_0x9050('0x35')],function(_0x4f4b77){return{'name':_0x4f4b77['fieldName'],'type':_0x4f4b77['type']['key']};});_0x24ff52[_0x9050('0x36')]=_[_0x9050('0x37')](_0x9fb04c,'name');_0x24ff52[_0x9050('0x38')]=_['keys'](_0x1b5b9b[_0x9050('0x38')]);_0x24ff52[_0x9050('0x39')]=_[_0x9050('0x3a')](_0x24ff52[_0x9050('0x36')],_0x24ff52[_0x9050('0x38')]);_0x45311d[_0x9050('0x3b')]=_[_0x9050('0x3a')](_0x24ff52[_0x9050('0x36')],qs[_0x9050('0x3c')](_0x1b5b9b[_0x9050('0x38')][_0x9050('0x3c')]));_0x45311d['attributes']=_0x45311d[_0x9050('0x3b')][_0x9050('0x3d')]?_0x45311d[_0x9050('0x3b')]:_0x24ff52['model'];if(!_0x1b5b9b[_0x9050('0x38')][_0x9050('0x3e')](_0x9050('0x3f'))){_0x45311d['limit']=qs[_0x9050('0x24')](_0x1b5b9b[_0x9050('0x38')]['limit']);_0x45311d['offset']=qs[_0x9050('0x22')](_0x1b5b9b[_0x9050('0x38')][_0x9050('0x22')]);}_0x45311d[_0x9050('0x40')]=qs[_0x9050('0x41')](_0x1b5b9b[_0x9050('0x38')][_0x9050('0x41')]);_0x45311d[_0x9050('0x42')]=qs[_0x9050('0x39')](_['pick'](_0x1b5b9b[_0x9050('0x38')],_0x24ff52[_0x9050('0x39')]),_0x9fb04c);if(_0x1b5b9b[_0x9050('0x38')][_0x9050('0x43')]){_0x45311d[_0x9050('0x42')]=_['merge'](_0x45311d[_0x9050('0x42')],{'$or':_['map'](_0x9fb04c,function(_0x926cbe){if(_0x926cbe['type']!==_0x9050('0x44')){var _0xbfb73e={};_0xbfb73e[_0x926cbe[_0x9050('0x31')]]={'$like':'%'+_0x1b5b9b['query'][_0x9050('0x43')]+'%'};return _0xbfb73e;}})});}_0x45311d=_['merge']({},_0x45311d,_0x1b5b9b['options']);var _0xa31707={'where':_0x45311d[_0x9050('0x42')]};return db[_0x9050('0x34')][_0x9050('0x25')](_0xa31707)[_0x9050('0x2b')](function(_0x5a12d9){_0x4650df['count']=_0x5a12d9;if(_0x1b5b9b['query'][_0x9050('0x45')]){_0x45311d[_0x9050('0x46')]=[{'all':!![]}];}return db[_0x9050('0x34')][_0x9050('0x47')](_0x45311d);})['then'](function(_0x2557eb){_0x4650df[_0x9050('0x48')]=_0x2557eb;return _0x4650df;})['then'](respondWithFilteredResult(_0xcf1eee,_0x45311d))['catch'](handleError(_0xcf1eee,null));};exports[_0x9050('0x49')]=function(_0x28d1d2,_0x1c9b09){var _0x506a44={'raw':![],'where':{'id':_0x28d1d2[_0x9050('0x4a')]['id']}},_0x2e72d4={};_0x2e72d4['model']=_[_0x9050('0x4b')](db[_0x9050('0x34')][_0x9050('0x35')]);_0x2e72d4[_0x9050('0x38')]=_[_0x9050('0x4b')](_0x28d1d2[_0x9050('0x38')]);_0x2e72d4[_0x9050('0x39')]=_[_0x9050('0x3a')](_0x2e72d4[_0x9050('0x36')],_0x2e72d4[_0x9050('0x38')]);_0x506a44[_0x9050('0x3b')]=_['intersection'](_0x2e72d4[_0x9050('0x36')],qs[_0x9050('0x3c')](_0x28d1d2['query'][_0x9050('0x3c')]));_0x506a44[_0x9050('0x3b')]=_0x506a44[_0x9050('0x3b')][_0x9050('0x3d')]?_0x506a44[_0x9050('0x3b')]:_0x2e72d4['model'];if(_0x28d1d2['query'][_0x9050('0x45')]){_0x506a44[_0x9050('0x46')]=[{'all':!![]}];}_0x506a44=_[_0x9050('0x4c')]({},_0x506a44,_0x28d1d2[_0x9050('0x4d')]);return db[_0x9050('0x34')]['find'](_0x506a44)[_0x9050('0x2b')](handleEntityNotFound(_0x1c9b09,null))['then'](respondWithResult(_0x1c9b09,null))[_0x9050('0x4e')](handleError(_0x1c9b09,null));};exports[_0x9050('0x4f')]=function(_0x4cab98,_0x5da3c0){return db[_0x9050('0x34')][_0x9050('0x4f')](_0x4cab98[_0x9050('0x50')],{})[_0x9050('0x2b')](function(_0x107fde){var _0x29e898=_0x4cab98['user'][_0x9050('0x2d')]({'plain':!![]});if(!_0x29e898)throw new Error(_0x9050('0x51'));if(_0x29e898['role']===_0x9050('0x52')){var _0x4f199a=_0x107fde['get']({'plain':!![]});var _0x131ef5=_0x9050('0x53');return db[_0x9050('0x54')][_0x9050('0x55')]({'where':{'name':_0x131ef5,'userProfileId':_0x29e898[_0x9050('0x56')]},'raw':!![]})[_0x9050('0x2b')](function(_0x30a79a){if(_0x30a79a&&_0x30a79a[_0x9050('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f199a[_0x9050('0x31')],'resourceId':_0x4f199a['id'],'type':_0x30a79a[_0x9050('0x31')],'sectionId':_0x30a79a['id']},{})[_0x9050('0x2b')](function(){return _0x107fde;});}else{return _0x107fde;}})[_0x9050('0x4e')](function(_0xf50522){logger[_0x9050('0x2f')](_0x9050('0x58'),_0xf50522);throw _0xf50522;});}return _0x107fde;})[_0x9050('0x2b')](respondWithResult(_0x5da3c0,0xc9))[_0x9050('0x4e')](handleError(_0x5da3c0,null));};exports[_0x9050('0x59')]=function(_0x270a9b,_0x387cd8){var _0x231699={'where':{'id':_0x270a9b['params']['id']}},_0x1cbc14={};_0x1cbc14[_0x9050('0x36')]=_[_0x9050('0x4b')](db['Dashboard']['rawAttributes']);_0x231699[_0x9050('0x3b')]=_[_0x9050('0x3a')](_0x1cbc14[_0x9050('0x36')],qs[_0x9050('0x3c')](_0x270a9b['query'][_0x9050('0x3c')]));_0x231699[_0x9050('0x3b')]=_0x231699[_0x9050('0x3b')][_0x9050('0x3d')]?_0x231699[_0x9050('0x3b')]:_0x1cbc14['model'];if(_0x270a9b[_0x9050('0x38')][_0x9050('0x45')]){_0x231699[_0x9050('0x46')]=[{'all':!![]}];}_0x231699=_[_0x9050('0x4c')]({},_0x231699,_0x270a9b[_0x9050('0x4d')]);return db['Dashboard'][_0x9050('0x55')](_0x231699)[_0x9050('0x2b')](handleEntityNotFound(_0x387cd8,null))['then'](function(_0x382881){if(_0x382881){var _0x7a9ec8=_0x382881['get']({'plain':!![]});_0x7a9ec8=qs['omit'](_0x7a9ec8,['id',_0x9050('0x5a'),_0x9050('0x5b')]);_0x270a9b['body']=_['omit'](_0x270a9b['body'],['id',_0x9050('0x5a'),_0x9050('0x5b')]);return db[_0x9050('0x34')][_0x9050('0x4f')](_[_0x9050('0x4c')](_0x7a9ec8,_0x270a9b[_0x9050('0x50')]),{'include':_0x270a9b[_0x9050('0x38')]['includeAll']?[{'all':!![]}]:undefined})[_0x9050('0x2b')](function(_0x299433){var _0x4d0e22=_0x270a9b[_0x9050('0x52')]['get']({'plain':!![]});if(!_0x4d0e22)throw new Error(_0x9050('0x51'));if(_0x4d0e22[_0x9050('0x5c')]==='user'){var _0x3af251=_0x299433[_0x9050('0x2d')]({'plain':!![]});var _0x4f7879=_0x9050('0x53');return db[_0x9050('0x54')]['find']({'where':{'name':_0x4f7879,'userProfileId':_0x4d0e22[_0x9050('0x56')]},'raw':!![]})[_0x9050('0x2b')](function(_0x4e0ed1){if(_0x4e0ed1&&_0x4e0ed1[_0x9050('0x57')]===0x0){return db['UserProfileResource'][_0x9050('0x4f')]({'name':_0x3af251['name'],'resourceId':_0x3af251['id'],'type':_0x4e0ed1[_0x9050('0x31')],'sectionId':_0x4e0ed1['id']},{})[_0x9050('0x2b')](function(){return _0x299433;});}else{return _0x299433;}})[_0x9050('0x4e')](function(_0x7c70ef){logger[_0x9050('0x2f')](_0x9050('0x58'),_0x7c70ef);throw _0x7c70ef;});}return _0x299433;});}})[_0x9050('0x2b')](respondWithResult(_0x387cd8,0xc9))[_0x9050('0x4e')](handleError(_0x387cd8,null));};exports[_0x9050('0x2a')]=function(_0x2f4f34,_0x2141f3){if(_0x2f4f34[_0x9050('0x50')]['id']){delete _0x2f4f34[_0x9050('0x50')]['id'];}return db[_0x9050('0x34')]['find']({'where':{'id':_0x2f4f34[_0x9050('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2141f3,null))[_0x9050('0x2b')](saveUpdates(_0x2f4f34[_0x9050('0x50')],null))[_0x9050('0x2b')](respondWithResult(_0x2141f3,null))[_0x9050('0x4e')](handleError(_0x2141f3,null));};exports[_0x9050('0x2c')]=function(_0x34bcc7,_0x54c967){return db[_0x9050('0x34')][_0x9050('0x55')]({'where':{'id':_0x34bcc7[_0x9050('0x4a')]['id']}})[_0x9050('0x2b')](handleEntityNotFound(_0x54c967,null))[_0x9050('0x2b')](removeEntity(_0x54c967,null))[_0x9050('0x4e')](handleError(_0x54c967,null));};function widgetAttributes(_0xb55371){try{switch(_0xb55371[_0x9050('0x5d')]){case _0x9050('0x5e'):return[{'name':'attrUrl','value':_0xb55371[_0x9050('0x5f')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||_0x9050('0x62')}];case _0x9050('0x63'):return[{'name':_0x9050('0x64'),'value':_0xb55371['attrPath']||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||''}];case _0x9050('0x65'):return[{'name':_0x9050('0x66'),'value':_0xb55371[_0x9050('0x66')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||_0x9050('0x67')},{'name':'attrTimezone','value':_0xb55371[_0x9050('0x68')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x1]?_0xb55371[_0x9050('0x60')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0xb55371[_0x9050('0x69')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x2]?_0xb55371[_0x9050('0x60')][0x2]['value']:undefined)||0xc}];case _0x9050('0x6a'):return[{'name':'attrMetric','value':_0xb55371[_0x9050('0x6b')]||(_0xb55371['attrs']&&_0xb55371['attrs'][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||_0x9050('0x6c')},{'name':_0x9050('0x6d'),'value':_0xb55371[_0x9050('0x6d')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x1]?_0xb55371['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0xb55371[_0x9050('0x69')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x2]?_0xb55371[_0x9050('0x60')][0x2][_0x9050('0x61')]:undefined)||0x14},{'name':'attrChannel','value':_0xb55371[_0x9050('0x6e')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x3]?_0xb55371[_0x9050('0x60')][0x3][_0x9050('0x61')]:undefined)||_0x9050('0x6f')},{'name':_0x9050('0x70'),'value':_0xb55371['attrEmailAccounts']||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x4]?_0xb55371[_0x9050('0x60')][0x4][_0x9050('0x61')]:undefined)||''},{'name':_0x9050('0x71'),'value':_0xb55371[_0x9050('0x71')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x5]?_0xb55371[_0x9050('0x60')][0x5][_0x9050('0x61')]:undefined)||''},{'name':_0x9050('0x72'),'value':_0xb55371['attrSmsAccounts']||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x6]?_0xb55371[_0x9050('0x60')][0x6][_0x9050('0x61')]:undefined)||''},{'name':_0x9050('0x73'),'value':_0xb55371[_0x9050('0x73')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x7]?_0xb55371[_0x9050('0x60')][0x7][_0x9050('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xb55371[_0x9050('0x74')]||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x8]?_0xb55371[_0x9050('0x60')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0xb55371['attrChatWebsites']||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x9]?_0xb55371[_0x9050('0x60')][0x9]['value']:undefined)||''}];case _0x9050('0x75'):case _0x9050('0x76'):return[{'name':'attrSerie1','value':_0xb55371[_0x9050('0x77')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||_0x9050('0x6c')},{'name':_0x9050('0x78'),'value':_0xb55371[_0x9050('0x78')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x1]?_0xb55371['attrs'][0x1][_0x9050('0x61')]:undefined)||null},{'name':_0x9050('0x79'),'value':_0xb55371[_0x9050('0x79')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x2]?_0xb55371[_0x9050('0x60')][0x2][_0x9050('0x61')]:undefined)||null},{'name':'attrVoiceQueues','value':_0xb55371['attrVoiceQueues']||(_0xb55371[_0x9050('0x60')]&&_0xb55371['attrs'][0x3]?_0xb55371[_0x9050('0x60')][0x3][_0x9050('0x61')]:undefined)||[]},{'name':_0x9050('0x6e'),'value':_0xb55371[_0x9050('0x6e')]||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x4]?_0xb55371[_0x9050('0x60')][0x4]['value']:undefined)||_0x9050('0x6f')},{'name':_0x9050('0x70'),'value':_0xb55371['attrEmailAccounts']||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x5]?_0xb55371[_0x9050('0x60')][0x5][_0x9050('0x61')]:undefined)||''},{'name':_0x9050('0x71'),'value':_0xb55371[_0x9050('0x71')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x6]?_0xb55371[_0x9050('0x60')][0x6][_0x9050('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xb55371[_0x9050('0x72')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x7]?_0xb55371['attrs'][0x7][_0x9050('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xb55371['attrOpenchannelAccounts']||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x8]?_0xb55371[_0x9050('0x60')][0x8][_0x9050('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xb55371[_0x9050('0x74')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x9]?_0xb55371[_0x9050('0x60')][0x9][_0x9050('0x61')]:undefined)||''},{'name':_0x9050('0x7a'),'value':_0xb55371['attrChatWebsites']||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0xa]?_0xb55371[_0x9050('0x60')][0xa]['value']:undefined)||''}];case _0x9050('0x7b'):return[{'name':'attrReport','type':_0xb55371[_0x9050('0x7c')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x5d')]:undefined)||null,'value':_0xb55371[_0x9050('0x7d')]||(_0xb55371[_0x9050('0x60')]&&_0xb55371[_0x9050('0x60')][0x0]?_0xb55371[_0x9050('0x60')][0x0][_0x9050('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0xb55371[_0x9050('0x7e')]||(_0xb55371['attrs']&&_0xb55371[_0x9050('0x60')][0x1]?_0xb55371['attrs'][0x1][_0x9050('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x2d3dcc){logger['error'](_0x9050('0x7f'),JSON['stringify'](_0x2d3dcc));return[];}}exports[_0x9050('0x80')]=function(_0x497471,_0x4491b9,_0x220973){if(_0x497471['body']['id']){delete _0x497471[_0x9050('0x50')]['id'];}return db[_0x9050('0x34')][_0x9050('0x55')]({'where':{'id':_0x497471['params']['id']}})['then'](handleEntityNotFound(_0x4491b9,null))['then'](function(_0x436750){if(_0x436750){_0x497471[_0x9050('0x50')]['DashboardId']=_0x436750['id'];_0x497471['body'][_0x9050('0x60')]=widgetAttributes(_0x497471[_0x9050('0x50')]);return db[_0x9050('0x81')][_0x9050('0x4f')](_0x497471[_0x9050('0x50')]);}})[_0x9050('0x2b')](respondWithResult(_0x4491b9,null))[_0x9050('0x4e')](handleError(_0x4491b9,null));};exports[_0x9050('0x82')]=function(_0x2cd13f,_0x1469fa,_0xeff3c4){var _0x35fadd={};var _0x160bfc={};var _0x44aa00;var _0x21c22a;return db[_0x9050('0x34')]['findOne']({'where':{'id':_0x2cd13f[_0x9050('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1469fa,null))[_0x9050('0x2b')](function(_0x418ef4){if(_0x418ef4){_0x44aa00=_0x418ef4;_0x160bfc['model']=_[_0x9050('0x4b')](db[_0x9050('0x81')][_0x9050('0x35')]);_0x160bfc['query']=_[_0x9050('0x4b')](_0x2cd13f[_0x9050('0x38')]);_0x160bfc[_0x9050('0x39')]=_[_0x9050('0x3a')](_0x160bfc[_0x9050('0x36')],_0x160bfc['query']);_0x35fadd['attributes']=_[_0x9050('0x3a')](_0x160bfc['model'],qs[_0x9050('0x3c')](_0x2cd13f[_0x9050('0x38')][_0x9050('0x3c')]));_0x35fadd[_0x9050('0x3b')]=_0x35fadd[_0x9050('0x3b')]['length']?_0x35fadd[_0x9050('0x3b')]:_0x160bfc[_0x9050('0x36')];_0x35fadd[_0x9050('0x40')]=qs[_0x9050('0x41')](_0x2cd13f[_0x9050('0x38')][_0x9050('0x41')]);_0x35fadd[_0x9050('0x42')]=qs['filters'](_[_0x9050('0x83')](_0x2cd13f['query'],_0x160bfc['filters']));if(_0x2cd13f[_0x9050('0x38')]['filter']){_0x35fadd[_0x9050('0x42')]=_[_0x9050('0x4c')](_0x35fadd[_0x9050('0x42')],{'$or':_[_0x9050('0x37')](_0x35fadd[_0x9050('0x3b')],function(_0x5e1aa3){var _0x29de48={};_0x29de48[_0x5e1aa3]={'$like':'%'+_0x2cd13f[_0x9050('0x38')][_0x9050('0x43')]+'%'};return _0x29de48;})});}_0x35fadd=_[_0x9050('0x4c')]({},_0x35fadd,_0x2cd13f['options']);return _0x44aa00[_0x9050('0x82')](_0x35fadd);}})[_0x9050('0x2b')](function(_0x537d6f){if(_0x537d6f){_0x21c22a=_0x537d6f[_0x9050('0x3d')];if(!_0x2cd13f[_0x9050('0x38')][_0x9050('0x3e')](_0x9050('0x3f'))){_0x35fadd[_0x9050('0x24')]=qs[_0x9050('0x24')](_0x2cd13f[_0x9050('0x38')]['limit']);_0x35fadd['offset']=qs[_0x9050('0x22')](_0x2cd13f['query'][_0x9050('0x22')]);}return _0x44aa00[_0x9050('0x82')](_0x35fadd);}})['then'](function(_0x3cb94c){if(_0x3cb94c){return _0x3cb94c?{'count':_0x21c22a,'rows':_0x3cb94c}:null;}})[_0x9050('0x2b')](respondWithResult(_0x1469fa,null))[_0x9050('0x4e')](handleError(_0x1469fa,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index ac7f29a..af4d793 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 _0x7fab=['hook','exports','events','../../mysqldb','Dashboard','save','update','remove','emit','hasOwnProperty'];(function(_0x54dfff,_0x13369b){var _0x4cf1dd=function(_0xa808f0){while(--_0xa808f0){_0x54dfff['push'](_0x54dfff['shift']());}};_0x4cf1dd(++_0x13369b);}(_0x7fab,0x1b0));var _0xb7fa=function(_0x15294d,_0x4f6a0d){_0x15294d=_0x15294d-0x0;var _0x4f6dab=_0x7fab[_0x15294d];return _0x4f6dab;};'use strict';var EventEmitter=require(_0xb7fa('0x0'));var Dashboard=require(_0xb7fa('0x1'))['db'][_0xb7fa('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb7fa('0x3'),'afterUpdate':_0xb7fa('0x4'),'afterDestroy':_0xb7fa('0x5')};function emitEvent(_0x136178){return function(_0x332985,_0x2e3983,_0x57aee5){DashboardEvents[_0xb7fa('0x6')](_0x136178+':'+_0x332985['id'],_0x332985);DashboardEvents[_0xb7fa('0x6')](_0x136178,_0x332985);_0x57aee5(null);};}for(var e in events){if(events[_0xb7fa('0x7')](e)){var event=events[e];Dashboard[_0xb7fa('0x8')](e,emitEvent(event));}}module[_0xb7fa('0x9')]=DashboardEvents; \ No newline at end of file +var _0x80ea=['update','remove','hasOwnProperty','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x4b5e6d,_0x43c640){var _0x1af022=function(_0x11dc32){while(--_0x11dc32){_0x4b5e6d['push'](_0x4b5e6d['shift']());}};_0x1af022(++_0x43c640);}(_0x80ea,0x1cf));var _0xa80e=function(_0x42fea3,_0x5ae69b){_0x42fea3=_0x42fea3-0x0;var _0x27df4a=_0x80ea[_0x42fea3];return _0x27df4a;};'use strict';var EventEmitter=require(_0xa80e('0x0'));var Dashboard=require(_0xa80e('0x1'))['db'][_0xa80e('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa80e('0x3')](0x0);var events={'afterCreate':_0xa80e('0x4'),'afterUpdate':_0xa80e('0x5'),'afterDestroy':_0xa80e('0x6')};function emitEvent(_0x521626){return function(_0x1d1c5b,_0x1935bb,_0xa60975){DashboardEvents['emit'](_0x521626+':'+_0x1d1c5b['id'],_0x1d1c5b);DashboardEvents['emit'](_0x521626,_0x1d1c5b);_0xa60975(null);};}for(var e in events){if(events[_0xa80e('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xa80e('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 865665a..7faa5b9 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 _0x1d38=['define','Dashboard','dashboards','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports'];(function(_0x1cd229,_0x332e93){var _0x1c0133=function(_0x3c1167){while(--_0x3c1167){_0x1cd229['push'](_0x1cd229['shift']());}};_0x1c0133(++_0x332e93);}(_0x1d38,0x116));var _0x81d3=function(_0x1f2a85,_0x5a4f3b){_0x1f2a85=_0x1f2a85-0x0;var _0x5c8fda=_0x1d38[_0x1f2a85];return _0x5c8fda;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x81d3('0x0'))(_0x81d3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x81d3('0x2'));var fs=require('fs');var path=require(_0x81d3('0x3'));var rimraf=require(_0x81d3('0x4'));var config=require(_0x81d3('0x5'));var attributes=require(_0x81d3('0x6'));module[_0x81d3('0x7')]=function(_0x4e6405,_0x5e244d){return _0x4e6405[_0x81d3('0x8')](_0x81d3('0x9'),attributes,{'tableName':_0x81d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd31=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x2ed1a0,_0x36acd9){var _0x3d272e=function(_0x41460c){while(--_0x41460c){_0x2ed1a0['push'](_0x2ed1a0['shift']());}};_0x3d272e(++_0x36acd9);}(_0xbd31,0x79));var _0x1bd3=function(_0x1c20d0,_0x5322b0){_0x1c20d0=_0x1c20d0-0x0;var _0xaf2a73=_0xbd31[_0x1c20d0];return _0xaf2a73;};'use strict';var _=require(_0x1bd3('0x0'));var util=require(_0x1bd3('0x1'));var logger=require(_0x1bd3('0x2'))(_0x1bd3('0x3'));var moment=require(_0x1bd3('0x4'));var BPromise=require(_0x1bd3('0x5'));var rp=require(_0x1bd3('0x6'));var fs=require('fs');var path=require(_0x1bd3('0x7'));var rimraf=require(_0x1bd3('0x8'));var config=require(_0x1bd3('0x9'));var attributes=require(_0x1bd3('0xa'));module['exports']=function(_0x49b622,_0x593335){return _0x49b622['define']('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 7756d59..1c0086e 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 _0xfd8a=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./dashboard.socket','register','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','catch'];(function(_0x44a274,_0x17b558){var _0x582fdc=function(_0x2f006a){while(--_0x2f006a){_0x44a274['push'](_0x44a274['shift']());}};_0x582fdc(++_0x17b558);}(_0xfd8a,0x16c));var _0xafd8=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0xfd8a[_0x3c22e0];return _0x215811;};'use strict';var _=require(_0xafd8('0x0'));var util=require(_0xafd8('0x1'));var moment=require(_0xafd8('0x2'));var BPromise=require('bluebird');var rs=require(_0xafd8('0x3'));var fs=require('fs');var Redis=require(_0xafd8('0x4'));var db=require(_0xafd8('0x5'))['db'];var utils=require(_0xafd8('0x6'));var logger=require(_0xafd8('0x7'))(_0xafd8('0x8'));var config=require('../../config/environment');var jayson=require(_0xafd8('0x9'));var client=jayson['client'][_0xafd8('0xa')]({'port':0x232a});config[_0xafd8('0xb')]=_[_0xafd8('0xc')](config[_0xafd8('0xb')],{'host':_0xafd8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xafd8('0xe'))[_0xafd8('0xf')](socket);function respondWithRpcPromise(_0xcbe146,_0x1a4ed1,_0x54944d){return new BPromise(function(_0x3260ee,_0x473b04){return client['request'](_0xcbe146,_0x54944d)[_0xafd8('0x10')](function(_0x1e82ff){logger[_0xafd8('0x11')]('Dashboard,\x20%s,\x20%s',_0x1a4ed1,_0xafd8('0x12'));logger[_0xafd8('0x13')](_0xafd8('0x14'),_0x1a4ed1,_0xafd8('0x12'),JSON[_0xafd8('0x15')](_0x1e82ff));if(_0x1e82ff[_0xafd8('0x16')]){if(_0x1e82ff[_0xafd8('0x16')][_0xafd8('0x17')]===0x1f4){logger[_0xafd8('0x16')](_0xafd8('0x18'),_0x1a4ed1,_0x1e82ff[_0xafd8('0x16')]['message']);return _0x473b04(_0x1e82ff['error'][_0xafd8('0x19')]);}logger['error'](_0xafd8('0x18'),_0x1a4ed1,_0x1e82ff[_0xafd8('0x16')]['message']);return _0x3260ee(_0x1e82ff[_0xafd8('0x16')][_0xafd8('0x19')]);}else{logger[_0xafd8('0x11')](_0xafd8('0x18'),_0x1a4ed1,_0xafd8('0x12'));_0x3260ee(_0x1e82ff[_0xafd8('0x1a')][_0xafd8('0x19')]);}})[_0xafd8('0x1b')](function(_0x3f0484){logger[_0xafd8('0x16')](_0xafd8('0x18'),_0x1a4ed1,_0x3f0484);_0x473b04(_0x3f0484);});});} \ No newline at end of file +var _0xa4d1=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','localhost','./dashboard.socket','register','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x54a2c3,_0x57cc09){var _0x2a60ed=function(_0x50b1fa){while(--_0x50b1fa){_0x54a2c3['push'](_0x54a2c3['shift']());}};_0x2a60ed(++_0x57cc09);}(_0xa4d1,0x16a));var _0x1a4d=function(_0x4eb42c,_0x434cf0){_0x4eb42c=_0x4eb42c-0x0;var _0x11c8e7=_0xa4d1[_0x4eb42c];return _0x11c8e7;};'use strict';var _=require(_0x1a4d('0x0'));var util=require('util');var moment=require(_0x1a4d('0x1'));var BPromise=require(_0x1a4d('0x2'));var rs=require(_0x1a4d('0x3'));var fs=require('fs');var Redis=require(_0x1a4d('0x4'));var db=require(_0x1a4d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a4d('0x6'))('rpc');var config=require(_0x1a4d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1a4d('0x8')]['http']({'port':0x232a});config[_0x1a4d('0x9')]=_[_0x1a4d('0xa')](config[_0x1a4d('0x9')],{'host':_0x1a4d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a4d('0x9')]));require(_0x1a4d('0xc'))[_0x1a4d('0xd')](socket);function respondWithRpcPromise(_0x22c3b2,_0x272593,_0x17946e){return new BPromise(function(_0x692efe,_0x1e4593){return client['request'](_0x22c3b2,_0x17946e)[_0x1a4d('0xe')](function(_0x48d62c){logger['info'](_0x1a4d('0xf'),_0x272593,_0x1a4d('0x10'));logger[_0x1a4d('0x11')](_0x1a4d('0x12'),_0x272593,'request\x20sent',JSON['stringify'](_0x48d62c));if(_0x48d62c[_0x1a4d('0x13')]){if(_0x48d62c[_0x1a4d('0x13')]['code']===0x1f4){logger[_0x1a4d('0x13')]('Dashboard,\x20%s,\x20%s',_0x272593,_0x48d62c[_0x1a4d('0x13')][_0x1a4d('0x14')]);return _0x1e4593(_0x48d62c[_0x1a4d('0x13')][_0x1a4d('0x14')]);}logger[_0x1a4d('0x13')](_0x1a4d('0xf'),_0x272593,_0x48d62c[_0x1a4d('0x13')][_0x1a4d('0x14')]);return _0x692efe(_0x48d62c[_0x1a4d('0x13')][_0x1a4d('0x14')]);}else{logger[_0x1a4d('0x15')](_0x1a4d('0xf'),_0x272593,'request\x20sent');_0x692efe(_0x48d62c[_0x1a4d('0x16')][_0x1a4d('0x14')]);}})[_0x1a4d('0x17')](function(_0x27e62d){logger['error'](_0x1a4d('0xf'),_0x272593,_0x27e62d);_0x1e4593(_0x27e62d);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 91b7835..aced1dd 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 _0x7a29=['emit','removeListener','length','save','remove','update'];(function(_0xef9d34,_0x487683){var _0x4e71a0=function(_0x4edd58){while(--_0x4edd58){_0xef9d34['push'](_0xef9d34['shift']());}};_0x4e71a0(++_0x487683);}(_0x7a29,0x14d));var _0x97a2=function(_0x3151d0,_0x48b726){_0x3151d0=_0x3151d0-0x0;var _0x30cb1d=_0x7a29[_0x3151d0];return _0x30cb1d;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x97a2('0x0'),_0x97a2('0x1'),_0x97a2('0x2')];function createListener(_0x32753,_0xa75827){return function(_0x1a1c1b){_0xa75827[_0x97a2('0x3')](_0x32753,_0x1a1c1b);};}function removeListener(_0x1638ca,_0x36e1a7){return function(){DashboardEvents[_0x97a2('0x4')](_0x1638ca,_0x36e1a7);};}exports['register']=function(_0x432547){for(var _0x4cf4e0=0x0,_0x471f26=events[_0x97a2('0x5')];_0x4cf4e0<_0x471f26;_0x4cf4e0++){var _0x461cd0=events[_0x4cf4e0];var _0x29b7aa=createListener('dashboard:'+_0x461cd0,_0x432547);DashboardEvents['on'](_0x461cd0,_0x29b7aa);}}; \ No newline at end of file +var _0x5a73=['dashboard:','./dashboard.events','save','update','emit','removeListener','register','length'];(function(_0xdf5452,_0x19af67){var _0xf35e7b=function(_0x4a4ad8){while(--_0x4a4ad8){_0xdf5452['push'](_0xdf5452['shift']());}};_0xf35e7b(++_0x19af67);}(_0x5a73,0xb1));var _0x35a7=function(_0x5db081,_0x270109){_0x5db081=_0x5db081-0x0;var _0x2d881e=_0x5a73[_0x5db081];return _0x2d881e;};'use strict';var DashboardEvents=require(_0x35a7('0x0'));var events=[_0x35a7('0x1'),'remove',_0x35a7('0x2')];function createListener(_0x538ee4,_0x489abe){return function(_0x2465a5){_0x489abe[_0x35a7('0x3')](_0x538ee4,_0x2465a5);};}function removeListener(_0x1fc0af,_0x1e7767){return function(){DashboardEvents[_0x35a7('0x4')](_0x1fc0af,_0x1e7767);};}exports[_0x35a7('0x5')]=function(_0x530218){for(var _0xbd4a21=0x0,_0x1dd877=events[_0x35a7('0x6')];_0xbd4a21<_0x1dd877;_0xbd4a21++){var _0x5b9e08=events[_0xbd4a21];var _0x4adb55=createListener(_0x35a7('0x7')+_0x5b9e08,_0x530218);DashboardEvents['on'](_0x5b9e08,_0x4adb55);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 4b186f1..5c5f043 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 _0x8ebb=['post','create','/:id/clone','clone','addItem','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','/:id/items','getItems'];(function(_0x3bf356,_0x5bc71f){var _0xe9ddd1=function(_0x25184f){while(--_0x25184f){_0x3bf356['push'](_0x3bf356['shift']());}};_0xe9ddd1(++_0x5bc71f);}(_0x8ebb,0x76));var _0xb8eb=function(_0x2306a0,_0x19045e){_0x2306a0=_0x2306a0-0x0;var _0x425eb8=_0x8ebb[_0x2306a0];return _0x425eb8;};'use strict';var multer=require(_0xb8eb('0x0'));var util=require('util');var path=require(_0xb8eb('0x1'));var timeout=require('connect-timeout');var express=require(_0xb8eb('0x2'));var router=express[_0xb8eb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb8eb('0x4'));var interaction=require(_0xb8eb('0x5'));var config=require(_0xb8eb('0x6'));var controller=require(_0xb8eb('0x7'));router[_0xb8eb('0x8')]('/',auth['isAuthenticated'](),controller[_0xb8eb('0x9')]);router[_0xb8eb('0x8')](_0xb8eb('0xa'),auth[_0xb8eb('0xb')](),controller['show']);router[_0xb8eb('0x8')](_0xb8eb('0xc'),auth[_0xb8eb('0xb')](),controller[_0xb8eb('0xd')]);router[_0xb8eb('0xe')]('/',auth[_0xb8eb('0xb')](),controller[_0xb8eb('0xf')]);router[_0xb8eb('0xe')](_0xb8eb('0x10'),auth[_0xb8eb('0xb')](),controller[_0xb8eb('0x11')]);router[_0xb8eb('0xe')](_0xb8eb('0xc'),auth[_0xb8eb('0xb')](),controller[_0xb8eb('0x12')]);router['put']('/:id',auth[_0xb8eb('0xb')](),controller['update']);router[_0xb8eb('0x13')](_0xb8eb('0xa'),auth[_0xb8eb('0xb')](),controller[_0xb8eb('0x14')]);module[_0xb8eb('0x15')]=router; \ No newline at end of file +var _0xe40b=['./dashboard.controller','get','isAuthenticated','index','getItems','post','create','/:id/clone','clone','/:id/items','put','update','/:id','exports','multer','express','Router','../../components/auth/service'];(function(_0xe4636b,_0x2620dd){var _0xe2b2b1=function(_0x5b2a4b){while(--_0x5b2a4b){_0xe4636b['push'](_0xe4636b['shift']());}};_0xe2b2b1(++_0x2620dd);}(_0xe40b,0x11c));var _0xbe40=function(_0x3014e8,_0x4f14d5){_0x3014e8=_0x3014e8-0x0;var _0x35b417=_0xe40b[_0x3014e8];return _0x35b417;};'use strict';var multer=require(_0xbe40('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe40('0x1'));var router=express[_0xbe40('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbe40('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe40('0x4'));router[_0xbe40('0x5')]('/',auth[_0xbe40('0x6')](),controller[_0xbe40('0x7')]);router[_0xbe40('0x5')]('/:id',auth[_0xbe40('0x6')](),controller['show']);router[_0xbe40('0x5')]('/:id/items',auth[_0xbe40('0x6')](),controller[_0xbe40('0x8')]);router[_0xbe40('0x9')]('/',auth[_0xbe40('0x6')](),controller[_0xbe40('0xa')]);router[_0xbe40('0x9')](_0xbe40('0xb'),auth[_0xbe40('0x6')](),controller[_0xbe40('0xc')]);router[_0xbe40('0x9')](_0xbe40('0xd'),auth[_0xbe40('0x6')](),controller['addItem']);router[_0xbe40('0xe')]('/:id',auth[_0xbe40('0x6')](),controller[_0xbe40('0xf')]);router['delete'](_0xbe40('0x10'),auth[_0xbe40('0x6')](),controller['destroy']);module[_0xbe40('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 9a47413..94a0b75 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 _0xeff8=['sequelize','squel','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x23592b,_0x70ad58){var _0x41d8ae=function(_0x3f8e97){while(--_0x3f8e97){_0x23592b['push'](_0x23592b['shift']());}};_0x41d8ae(++_0x70ad58);}(_0xeff8,0x186));var _0x8eff=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xeff8[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x8eff('0x0'));var squel=require(_0x8eff('0x1'));var _=require('lodash');module[_0x8eff('0x2')]={'title':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eff('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x8eff('0x4')),'get':function(){try{return JSON[_0x8eff('0x5')](this[_0x8eff('0x6')](_0x8eff('0x7')));}catch(_0x4ac51c){return[];}},'set':function(_0x469641){try{this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')](_0x469641));}catch(_0x491f01){this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x8eff('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x8eff('0xa')]},'background':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![],'defaultValue':_0x8eff('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8eff('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eff('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5d17=['#ffffff','sequelize','squel','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0x5d17,0x114));var _0x75d1=function(_0x3f2228,_0x3b27d5){_0x3f2228=_0x3f2228-0x0;var _0x285ae4=_0x5d17[_0x3f2228];return _0x285ae4;};'use strict';var Sequelize=require(_0x75d1('0x0'));var squel=require(_0x75d1('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x75d1('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x75d1('0x3')]('long'),'get':function(){try{return JSON[_0x75d1('0x4')](this[_0x75d1('0x5')](_0x75d1('0x6')));}catch(_0x32bd45){return[];}},'set':function(_0x56ac0a){try{this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')](_0x56ac0a));}catch(_0x1ee61b){this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x75d1('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75d1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x75d1('0x2')]},'titleFontSize':{'type':Sequelize[_0x75d1('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 4c23f2a..609d923 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 _0x7f27=['attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','body','create','params','eml-format','rimraf','request-promise','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','name','send','show','model','keys','DashboardItem','rawAttributes','query','intersection','fields','attributes','length','includeAll','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts'];(function(_0x24c38f,_0x49ff05){var _0xeec58e=function(_0x14b2d0){while(--_0x14b2d0){_0x24c38f['push'](_0x24c38f['shift']());}};_0xeec58e(++_0x49ff05);}(_0x7f27,0x12e));var _0x77f2=function(_0x585136,_0x2d38d3){_0x585136=_0x585136-0x0;var _0x3ef2b0=_0x7f27[_0x585136];return _0x3ef2b0;};'use strict';var emlformat=require(_0x77f2('0x0'));var rimraf=require(_0x77f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x77f2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x77f2('0x3'));var util=require(_0x77f2('0x4'));var path=require(_0x77f2('0x5'));var sox=require('sox');var csv=require(_0x77f2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77f2('0x7'));var _=require(_0x77f2('0x8'));var squel=require('squel');var crypto=require(_0x77f2('0x9'));var jsforce=require(_0x77f2('0xa'));var deskjs=require(_0x77f2('0xb'));var toCsv=require(_0x77f2('0x6'));var querystring=require('querystring');var Papa=require(_0x77f2('0xc'));var Redis=require(_0x77f2('0xd'));var authService=require(_0x77f2('0xe'));var qs=require(_0x77f2('0xf'));var as=require(_0x77f2('0x10'));var hardwareService=require(_0x77f2('0x11'));var logger=require(_0x77f2('0x12'))(_0x77f2('0x13'));var utils=require(_0x77f2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x77f2('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x77f2('0x16')](config[_0x77f2('0x17')],{'host':_0x77f2('0x18'),'port':0x18eb});var socket=require(_0x77f2('0x19'))(new Redis(config[_0x77f2('0x17')]));require(_0x77f2('0x1a'))['register'](socket);function respondWithStatusCode(_0x330e80,_0x131db3){_0x131db3=_0x131db3||0xcc;return function(_0x273c33){if(_0x273c33){return _0x330e80[_0x77f2('0x1b')](_0x131db3);}return _0x330e80[_0x77f2('0x1c')](_0x131db3)[_0x77f2('0x1d')]();};}function respondWithResult(_0x64471d,_0x1a1809){_0x1a1809=_0x1a1809||0xc8;return function(_0xd63885){if(_0xd63885){return _0x64471d['status'](_0x1a1809)[_0x77f2('0x1e')](_0xd63885);}};}function respondWithFilteredResult(_0x528f02,_0x1a63a0){return function(_0xffdf18){if(_0xffdf18){var _0x2368ec=typeof _0x1a63a0['offset']===_0x77f2('0x1f')&&typeof _0x1a63a0[_0x77f2('0x20')]===_0x77f2('0x1f');var _0x270ba7=_0xffdf18[_0x77f2('0x21')];var _0x15c7eb=_0x2368ec?0x0:_0x1a63a0[_0x77f2('0x22')];var _0x171b37=_0x2368ec?_0xffdf18[_0x77f2('0x21')]:_0x1a63a0[_0x77f2('0x22')]+_0x1a63a0[_0x77f2('0x20')];var _0x460941;if(_0x171b37>=_0x270ba7){_0x171b37=_0x270ba7;_0x460941=0xc8;}else{_0x460941=0xce;}_0x528f02[_0x77f2('0x1c')](_0x460941);return _0x528f02[_0x77f2('0x23')](_0x77f2('0x24'),_0x15c7eb+'-'+_0x171b37+'/'+_0x270ba7)['json'](_0xffdf18);}return null;};}function patchUpdates(_0x3db6d2){return function(_0xed3992){try{jsonpatch[_0x77f2('0x25')](_0xed3992,_0x3db6d2,!![]);}catch(_0x897e3c){return BPromise[_0x77f2('0x26')](_0x897e3c);}return _0xed3992['save']();};}function saveUpdates(_0x2afa88,_0x384f93){return function(_0x37a421){if(_0x37a421){return _0x37a421[_0x77f2('0x27')](_0x2afa88)[_0x77f2('0x28')](function(_0x37fba4){return _0x37fba4;});}return null;};}function removeEntity(_0x311e2b,_0x42f510){return function(_0x47d610){if(_0x47d610){return _0x47d610[_0x77f2('0x29')]()[_0x77f2('0x28')](function(){_0x311e2b[_0x77f2('0x1c')](0xcc)[_0x77f2('0x1d')]();});}};}function handleEntityNotFound(_0x4e4265,_0x404101){return function(_0x13f9c7){if(!_0x13f9c7){_0x4e4265[_0x77f2('0x1b')](0x194);}return _0x13f9c7;};}function handleError(_0x17bae7,_0x178235){_0x178235=_0x178235||0x1f4;return function(_0x5a260f){logger['error'](_0x5a260f['stack']);if(_0x5a260f[_0x77f2('0x2a')]){delete _0x5a260f['name'];}_0x17bae7[_0x77f2('0x1c')](_0x178235)[_0x77f2('0x2b')](_0x5a260f);};}exports[_0x77f2('0x2c')]=function(_0x1ba486,_0x5402b2){var _0x499943={'raw':![],'where':{'id':_0x1ba486['params']['id']}},_0x1f89e5={};_0x1f89e5[_0x77f2('0x2d')]=_[_0x77f2('0x2e')](db[_0x77f2('0x2f')][_0x77f2('0x30')]);_0x1f89e5[_0x77f2('0x31')]=_[_0x77f2('0x2e')](_0x1ba486[_0x77f2('0x31')]);_0x1f89e5['filters']=_['intersection'](_0x1f89e5[_0x77f2('0x2d')],_0x1f89e5[_0x77f2('0x31')]);_0x499943['attributes']=_[_0x77f2('0x32')](_0x1f89e5['model'],qs[_0x77f2('0x33')](_0x1ba486['query']['fields']));_0x499943['attributes']=_0x499943[_0x77f2('0x34')][_0x77f2('0x35')]?_0x499943[_0x77f2('0x34')]:_0x1f89e5['model'];if(_0x1ba486[_0x77f2('0x31')][_0x77f2('0x36')]){_0x499943['include']=[{'all':!![]}];}_0x499943=_['merge']({},_0x499943,_0x1ba486[_0x77f2('0x37')]);return db[_0x77f2('0x2f')][_0x77f2('0x38')](_0x499943)[_0x77f2('0x28')](handleEntityNotFound(_0x5402b2,null))[_0x77f2('0x28')](respondWithResult(_0x5402b2,null))[_0x77f2('0x39')](handleError(_0x5402b2,null));};exports[_0x77f2('0x29')]=function(_0x2f3700,_0xde504){return db['DashboardItem']['find']({'where':{'id':_0x2f3700['params']['id']}})[_0x77f2('0x28')](handleEntityNotFound(_0xde504,null))[_0x77f2('0x28')](removeEntity(_0xde504,null))['catch'](handleError(_0xde504,null));};function widgetAttributes(_0x1c0441){try{switch(_0x1c0441[_0x77f2('0x3a')]){case _0x77f2('0x3b'):return[{'name':_0x77f2('0x3c'),'value':_0x1c0441[_0x77f2('0x3c')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0][_0x77f2('0x3e')]:undefined)||_0x77f2('0x3f')}];case _0x77f2('0x40'):return[{'name':_0x77f2('0x41'),'value':_0x1c0441['attrPath']||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0][_0x77f2('0x3e')]:undefined)||''}];case'clock':return[{'name':_0x77f2('0x42'),'value':_0x1c0441[_0x77f2('0x42')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0][_0x77f2('0x3e')]:undefined)||_0x77f2('0x43')},{'name':_0x77f2('0x44'),'value':_0x1c0441[_0x77f2('0x44')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x1]?_0x1c0441[_0x77f2('0x3d')][0x1][_0x77f2('0x3e')]:undefined)||_0x77f2('0x45')},{'name':_0x77f2('0x46'),'value':_0x1c0441['attrFontSize']||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x2]?_0x1c0441[_0x77f2('0x3d')][0x2][_0x77f2('0x3e')]:undefined)||0xc}];case _0x77f2('0x47'):return[{'name':_0x77f2('0x48'),'value':_0x1c0441[_0x77f2('0x48')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0][_0x77f2('0x3e')]:undefined)||_0x77f2('0x49')},{'name':_0x77f2('0x4a'),'value':_0x1c0441[_0x77f2('0x4a')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x1]?_0x1c0441[_0x77f2('0x3d')][0x1][_0x77f2('0x3e')]:undefined)||[]},{'name':'attrFontSize','value':_0x1c0441[_0x77f2('0x46')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x2]?_0x1c0441[_0x77f2('0x3d')][0x2][_0x77f2('0x3e')]:undefined)||0x14},{'name':_0x77f2('0x4b'),'value':_0x1c0441[_0x77f2('0x4b')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x3]?_0x1c0441[_0x77f2('0x3d')][0x3][_0x77f2('0x3e')]:undefined)||_0x77f2('0x4c')},{'name':_0x77f2('0x4d'),'value':_0x1c0441[_0x77f2('0x4d')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x4]?_0x1c0441[_0x77f2('0x3d')][0x4][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x4e'),'value':_0x1c0441[_0x77f2('0x4e')]||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x5]?_0x1c0441[_0x77f2('0x3d')][0x5][_0x77f2('0x3e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1c0441[_0x77f2('0x4f')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x6]?_0x1c0441[_0x77f2('0x3d')][0x6][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x50'),'value':_0x1c0441[_0x77f2('0x50')]||(_0x1c0441['attrs']&&_0x1c0441['attrs'][0x7]?_0x1c0441[_0x77f2('0x3d')][0x7][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x51'),'value':_0x1c0441[_0x77f2('0x51')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x8]?_0x1c0441[_0x77f2('0x3d')][0x8]['value']:undefined)||''},{'name':_0x77f2('0x52'),'value':_0x1c0441[_0x77f2('0x52')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x9]?_0x1c0441['attrs'][0x9][_0x77f2('0x3e')]:undefined)||''}];case _0x77f2('0x53'):case'pie-chart':return[{'name':_0x77f2('0x54'),'value':_0x1c0441[_0x77f2('0x54')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0]['value']:undefined)||_0x77f2('0x49')},{'name':_0x77f2('0x55'),'value':_0x1c0441[_0x77f2('0x55')]||(_0x1c0441['attrs']&&_0x1c0441['attrs'][0x1]?_0x1c0441[_0x77f2('0x3d')][0x1]['value']:undefined)||null},{'name':_0x77f2('0x56'),'value':_0x1c0441[_0x77f2('0x56')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x2]?_0x1c0441[_0x77f2('0x3d')][0x2]['value']:undefined)||null},{'name':_0x77f2('0x4a'),'value':_0x1c0441[_0x77f2('0x4a')]||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x3]?_0x1c0441[_0x77f2('0x3d')][0x3][_0x77f2('0x3e')]:undefined)||[]},{'name':_0x77f2('0x4b'),'value':_0x1c0441[_0x77f2('0x4b')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x4]?_0x1c0441['attrs'][0x4]['value']:undefined)||_0x77f2('0x4c')},{'name':_0x77f2('0x4d'),'value':_0x1c0441['attrEmailAccounts']||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0x5]?_0x1c0441[_0x77f2('0x3d')][0x5][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x4e'),'value':_0x1c0441['attrFaxAccounts']||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x6]?_0x1c0441[_0x77f2('0x3d')][0x6][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x4f'),'value':_0x1c0441[_0x77f2('0x4f')]||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x7]?_0x1c0441['attrs'][0x7][_0x77f2('0x3e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1c0441['attrOpenchannelAccounts']||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x8]?_0x1c0441[_0x77f2('0x3d')][0x8][_0x77f2('0x3e')]:undefined)||''},{'name':_0x77f2('0x51'),'value':_0x1c0441[_0x77f2('0x51')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x9]?_0x1c0441['attrs'][0x9][_0x77f2('0x3e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1c0441[_0x77f2('0x52')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441[_0x77f2('0x3d')][0xa]?_0x1c0441['attrs'][0xa][_0x77f2('0x3e')]:undefined)||''}];case'web-report':return[{'name':_0x77f2('0x57'),'type':_0x1c0441[_0x77f2('0x58')]||(_0x1c0441[_0x77f2('0x3d')]&&_0x1c0441['attrs'][0x0]?_0x1c0441[_0x77f2('0x3d')][0x0][_0x77f2('0x3a')]:undefined)||null,'value':_0x1c0441[_0x77f2('0x57')]||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x0]?_0x1c0441['attrs'][0x0]['value']:undefined)||null},{'name':_0x77f2('0x59'),'value':_0x1c0441[_0x77f2('0x59')]||(_0x1c0441['attrs']&&_0x1c0441[_0x77f2('0x3d')][0x1]?_0x1c0441[_0x77f2('0x3d')][0x1][_0x77f2('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x1559b4){logger[_0x77f2('0x5a')](_0x77f2('0x5b'),JSON['stringify'](_0x1559b4));return[];}}exports['create']=function(_0x38115c,_0x48eb49){if(_0x38115c[_0x77f2('0x5c')]){_0x38115c[_0x77f2('0x5c')]['attrs']=widgetAttributes(_0x38115c[_0x77f2('0x5c')]);}return db['DashboardItem'][_0x77f2('0x5d')](_0x38115c[_0x77f2('0x5c')],{})[_0x77f2('0x28')](respondWithResult(_0x48eb49,0xc9))[_0x77f2('0x39')](handleError(_0x48eb49,null));};exports[_0x77f2('0x27')]=function(_0x54d746,_0x392e88){if(_0x54d746[_0x77f2('0x5c')]['id']){delete _0x54d746[_0x77f2('0x5c')]['id'];}_0x54d746[_0x77f2('0x5c')]['attrs']=widgetAttributes(_0x54d746[_0x77f2('0x5c')]);return db[_0x77f2('0x2f')]['find']({'where':{'id':_0x54d746[_0x77f2('0x5e')]['id']}})[_0x77f2('0x28')](handleEntityNotFound(_0x392e88,null))['then'](saveUpdates(_0x54d746['body'],null))[_0x77f2('0x28')](respondWithResult(_0x392e88,null))['catch'](handleError(_0x392e88,null));}; \ No newline at end of file +var _0x0a05=['redis','defaults','localhost','./dashboardItem.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','length','include','find','catch','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','multibar-chart','attrSerie1','attrSerie3','attrWhatsappAccounts','attrChatWebsites','web-report','attrReport','reportType','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0a05,0x9e));var _0x50a0=function(_0xfb9aaa,_0x37935d){_0xfb9aaa=_0xfb9aaa-0x0;var _0x103bf7=_0x0a05[_0xfb9aaa];return _0x103bf7;};'use strict';var emlformat=require(_0x50a0('0x0'));var rimraf=require(_0x50a0('0x1'));var zipdir=require(_0x50a0('0x2'));var jsonpatch=require(_0x50a0('0x3'));var rp=require(_0x50a0('0x4'));var moment=require(_0x50a0('0x5'));var BPromise=require(_0x50a0('0x6'));var Mustache=require('mustache');var util=require(_0x50a0('0x7'));var path=require('path');var sox=require(_0x50a0('0x8'));var csv=require('to-csv');var ejs=require(_0x50a0('0x9'));var fs=require('fs');var fs_extra=require(_0x50a0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x50a0('0xb'));var jsforce=require(_0x50a0('0xc'));var deskjs=require(_0x50a0('0xd'));var toCsv=require(_0x50a0('0xe'));var querystring=require('querystring');var Papa=require(_0x50a0('0xf'));var Redis=require('ioredis');var authService=require(_0x50a0('0x10'));var qs=require(_0x50a0('0x11'));var as=require(_0x50a0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50a0('0x13'))('api');var utils=require(_0x50a0('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50a0('0x15'))['db'];config[_0x50a0('0x16')]=_[_0x50a0('0x17')](config[_0x50a0('0x16')],{'host':_0x50a0('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x50a0('0x16')]));require(_0x50a0('0x19'))[_0x50a0('0x1a')](socket);function respondWithStatusCode(_0x2a083d,_0x113142){_0x113142=_0x113142||0xcc;return function(_0x572bcb){if(_0x572bcb){return _0x2a083d['sendStatus'](_0x113142);}return _0x2a083d['status'](_0x113142)['end']();};}function respondWithResult(_0x2a4ce7,_0x2b6b20){_0x2b6b20=_0x2b6b20||0xc8;return function(_0x3c641e){if(_0x3c641e){return _0x2a4ce7[_0x50a0('0x1b')](_0x2b6b20)[_0x50a0('0x1c')](_0x3c641e);}};}function respondWithFilteredResult(_0x474f10,_0x4a9c6f){return function(_0x4e2e05){if(_0x4e2e05){var _0x4303b1=typeof _0x4a9c6f[_0x50a0('0x1d')]===_0x50a0('0x1e')&&typeof _0x4a9c6f[_0x50a0('0x1f')]===_0x50a0('0x1e');var _0x48ec1e=_0x4e2e05[_0x50a0('0x20')];var _0x5d7536=_0x4303b1?0x0:_0x4a9c6f[_0x50a0('0x1d')];var _0x2d7773=_0x4303b1?_0x4e2e05[_0x50a0('0x20')]:_0x4a9c6f[_0x50a0('0x1d')]+_0x4a9c6f['limit'];var _0x62c40a;if(_0x2d7773>=_0x48ec1e){_0x2d7773=_0x48ec1e;_0x62c40a=0xc8;}else{_0x62c40a=0xce;}_0x474f10['status'](_0x62c40a);return _0x474f10[_0x50a0('0x21')](_0x50a0('0x22'),_0x5d7536+'-'+_0x2d7773+'/'+_0x48ec1e)['json'](_0x4e2e05);}return null;};}function patchUpdates(_0x190263){return function(_0x449c5d){try{jsonpatch[_0x50a0('0x23')](_0x449c5d,_0x190263,!![]);}catch(_0x89e493){return BPromise[_0x50a0('0x24')](_0x89e493);}return _0x449c5d[_0x50a0('0x25')]();};}function saveUpdates(_0x427094,_0x263c00){return function(_0x4b5467){if(_0x4b5467){return _0x4b5467['update'](_0x427094)[_0x50a0('0x26')](function(_0x44958b){return _0x44958b;});}return null;};}function removeEntity(_0xba9168,_0x4c9d9b){return function(_0x40b91c){if(_0x40b91c){return _0x40b91c[_0x50a0('0x27')]()[_0x50a0('0x26')](function(){_0xba9168['status'](0xcc)[_0x50a0('0x28')]();});}};}function handleEntityNotFound(_0x498a52,_0x3d0b47){return function(_0xf174f5){if(!_0xf174f5){_0x498a52[_0x50a0('0x29')](0x194);}return _0xf174f5;};}function handleError(_0x4d7d78,_0xde56f1){_0xde56f1=_0xde56f1||0x1f4;return function(_0x2e0dd9){logger[_0x50a0('0x2a')](_0x2e0dd9['stack']);if(_0x2e0dd9[_0x50a0('0x2b')]){delete _0x2e0dd9[_0x50a0('0x2b')];}_0x4d7d78[_0x50a0('0x1b')](_0xde56f1)[_0x50a0('0x2c')](_0x2e0dd9);};}exports['show']=function(_0x54d1de,_0x56e4f5){var _0x5524ae={'raw':![],'where':{'id':_0x54d1de[_0x50a0('0x2d')]['id']}},_0x271aa3={};_0x271aa3[_0x50a0('0x2e')]=_[_0x50a0('0x2f')](db[_0x50a0('0x30')][_0x50a0('0x31')]);_0x271aa3[_0x50a0('0x32')]=_['keys'](_0x54d1de['query']);_0x271aa3[_0x50a0('0x33')]=_['intersection'](_0x271aa3[_0x50a0('0x2e')],_0x271aa3['query']);_0x5524ae[_0x50a0('0x34')]=_[_0x50a0('0x35')](_0x271aa3[_0x50a0('0x2e')],qs[_0x50a0('0x36')](_0x54d1de[_0x50a0('0x32')][_0x50a0('0x36')]));_0x5524ae[_0x50a0('0x34')]=_0x5524ae[_0x50a0('0x34')][_0x50a0('0x37')]?_0x5524ae[_0x50a0('0x34')]:_0x271aa3[_0x50a0('0x2e')];if(_0x54d1de[_0x50a0('0x32')]['includeAll']){_0x5524ae[_0x50a0('0x38')]=[{'all':!![]}];}_0x5524ae=_['merge']({},_0x5524ae,_0x54d1de['options']);return db[_0x50a0('0x30')][_0x50a0('0x39')](_0x5524ae)['then'](handleEntityNotFound(_0x56e4f5,null))[_0x50a0('0x26')](respondWithResult(_0x56e4f5,null))[_0x50a0('0x3a')](handleError(_0x56e4f5,null));};exports[_0x50a0('0x27')]=function(_0x8eb59b,_0x234778){return db[_0x50a0('0x30')][_0x50a0('0x39')]({'where':{'id':_0x8eb59b[_0x50a0('0x2d')]['id']}})[_0x50a0('0x26')](handleEntityNotFound(_0x234778,null))[_0x50a0('0x26')](removeEntity(_0x234778,null))[_0x50a0('0x3a')](handleError(_0x234778,null));};function widgetAttributes(_0x15ca93){try{switch(_0x15ca93[_0x50a0('0x3b')]){case'iframe':return[{'name':_0x50a0('0x3c'),'value':_0x15ca93[_0x50a0('0x3c')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x0]?_0x15ca93[_0x50a0('0x3d')][0x0][_0x50a0('0x3e')]:undefined)||_0x50a0('0x3f')}];case _0x50a0('0x40'):return[{'name':'attrPath','value':_0x15ca93[_0x50a0('0x41')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x0]?_0x15ca93['attrs'][0x0][_0x50a0('0x3e')]:undefined)||''}];case _0x50a0('0x42'):return[{'name':'attrHourFormat','value':_0x15ca93[_0x50a0('0x43')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x0]?_0x15ca93[_0x50a0('0x3d')][0x0]['value']:undefined)||_0x50a0('0x44')},{'name':_0x50a0('0x45'),'value':_0x15ca93[_0x50a0('0x45')]||(_0x15ca93['attrs']&&_0x15ca93[_0x50a0('0x3d')][0x1]?_0x15ca93[_0x50a0('0x3d')][0x1]['value']:undefined)||'0.00'},{'name':_0x50a0('0x46'),'value':_0x15ca93[_0x50a0('0x46')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x2]?_0x15ca93[_0x50a0('0x3d')][0x2]['value']:undefined)||0xc}];case _0x50a0('0x47'):return[{'name':_0x50a0('0x48'),'value':_0x15ca93['attrMetric']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x0]?_0x15ca93['attrs'][0x0]['value']:undefined)||_0x50a0('0x49')},{'name':'attrVoiceQueues','value':_0x15ca93[_0x50a0('0x4a')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x1]?_0x15ca93[_0x50a0('0x3d')][0x1][_0x50a0('0x3e')]:undefined)||[]},{'name':_0x50a0('0x46'),'value':_0x15ca93[_0x50a0('0x46')]||(_0x15ca93['attrs']&&_0x15ca93[_0x50a0('0x3d')][0x2]?_0x15ca93[_0x50a0('0x3d')][0x2]['value']:undefined)||0x14},{'name':_0x50a0('0x4b'),'value':_0x15ca93[_0x50a0('0x4b')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x3]?_0x15ca93[_0x50a0('0x3d')][0x3][_0x50a0('0x3e')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x15ca93['attrEmailAccounts']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x4]?_0x15ca93[_0x50a0('0x3d')][0x4][_0x50a0('0x3e')]:undefined)||''},{'name':_0x50a0('0x4c'),'value':_0x15ca93[_0x50a0('0x4c')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x5]?_0x15ca93[_0x50a0('0x3d')][0x5][_0x50a0('0x3e')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x15ca93[_0x50a0('0x4d')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x6]?_0x15ca93[_0x50a0('0x3d')][0x6]['value']:undefined)||''},{'name':_0x50a0('0x4e'),'value':_0x15ca93['attrOpenchannelAccounts']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x7]?_0x15ca93[_0x50a0('0x3d')][0x7][_0x50a0('0x3e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x15ca93['attrWhatsappAccounts']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x8]?_0x15ca93[_0x50a0('0x3d')][0x8][_0x50a0('0x3e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x15ca93['attrChatWebsites']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x9]?_0x15ca93['attrs'][0x9]['value']:undefined)||''}];case _0x50a0('0x4f'):case'pie-chart':return[{'name':_0x50a0('0x50'),'value':_0x15ca93[_0x50a0('0x50')]||(_0x15ca93['attrs']&&_0x15ca93[_0x50a0('0x3d')][0x0]?_0x15ca93[_0x50a0('0x3d')][0x0]['value']:undefined)||_0x50a0('0x49')},{'name':'attrSerie2','value':_0x15ca93['attrSerie2']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x1]?_0x15ca93[_0x50a0('0x3d')][0x1][_0x50a0('0x3e')]:undefined)||null},{'name':_0x50a0('0x51'),'value':_0x15ca93[_0x50a0('0x51')]||(_0x15ca93['attrs']&&_0x15ca93[_0x50a0('0x3d')][0x2]?_0x15ca93[_0x50a0('0x3d')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x15ca93[_0x50a0('0x4a')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x3]?_0x15ca93[_0x50a0('0x3d')][0x3][_0x50a0('0x3e')]:undefined)||[]},{'name':_0x50a0('0x4b'),'value':_0x15ca93['attrChannel']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x4]?_0x15ca93[_0x50a0('0x3d')][0x4][_0x50a0('0x3e')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x15ca93['attrEmailAccounts']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x5]?_0x15ca93[_0x50a0('0x3d')][0x5][_0x50a0('0x3e')]:undefined)||''},{'name':_0x50a0('0x4c'),'value':_0x15ca93[_0x50a0('0x4c')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x6]?_0x15ca93[_0x50a0('0x3d')][0x6][_0x50a0('0x3e')]:undefined)||''},{'name':_0x50a0('0x4d'),'value':_0x15ca93[_0x50a0('0x4d')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x7]?_0x15ca93[_0x50a0('0x3d')][0x7][_0x50a0('0x3e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x15ca93[_0x50a0('0x4e')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x8]?_0x15ca93[_0x50a0('0x3d')][0x8][_0x50a0('0x3e')]:undefined)||''},{'name':_0x50a0('0x52'),'value':_0x15ca93[_0x50a0('0x52')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x9]?_0x15ca93[_0x50a0('0x3d')][0x9]['value']:undefined)||''},{'name':_0x50a0('0x53'),'value':_0x15ca93[_0x50a0('0x53')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0xa]?_0x15ca93['attrs'][0xa]['value']:undefined)||''}];case _0x50a0('0x54'):return[{'name':_0x50a0('0x55'),'type':_0x15ca93[_0x50a0('0x56')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93[_0x50a0('0x3d')][0x0]?_0x15ca93[_0x50a0('0x3d')][0x0]['type']:undefined)||null,'value':_0x15ca93[_0x50a0('0x55')]||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x0]?_0x15ca93[_0x50a0('0x3d')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x15ca93['attrRefresh']||(_0x15ca93[_0x50a0('0x3d')]&&_0x15ca93['attrs'][0x1]?_0x15ca93['attrs'][0x1][_0x50a0('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x34974b){logger[_0x50a0('0x2a')]('widgetAttributes:\x20%s',JSON['stringify'](_0x34974b));return[];}}exports[_0x50a0('0x57')]=function(_0x53602e,_0x5da081){if(_0x53602e[_0x50a0('0x58')]){_0x53602e[_0x50a0('0x58')]['attrs']=widgetAttributes(_0x53602e[_0x50a0('0x58')]);}return db['DashboardItem'][_0x50a0('0x57')](_0x53602e[_0x50a0('0x58')],{})[_0x50a0('0x26')](respondWithResult(_0x5da081,0xc9))[_0x50a0('0x3a')](handleError(_0x5da081,null));};exports[_0x50a0('0x59')]=function(_0xc65b9,_0xe6a02d){if(_0xc65b9[_0x50a0('0x58')]['id']){delete _0xc65b9[_0x50a0('0x58')]['id'];}_0xc65b9['body'][_0x50a0('0x3d')]=widgetAttributes(_0xc65b9[_0x50a0('0x58')]);return db['DashboardItem'][_0x50a0('0x39')]({'where':{'id':_0xc65b9['params']['id']}})['then'](handleEntityNotFound(_0xe6a02d,null))['then'](saveUpdates(_0xc65b9['body'],null))[_0x50a0('0x26')](respondWithResult(_0xe6a02d,null))[_0x50a0('0x3a')](handleError(_0xe6a02d,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 2df2b03..8d22e23 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 _0x9275=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x59d369,_0x56a533){var _0x58c3eb=function(_0x2acb03){while(--_0x2acb03){_0x59d369['push'](_0x59d369['shift']());}};_0x58c3eb(++_0x56a533);}(_0x9275,0x170));var _0x5927=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x9275[_0xb24a3e];return _0x4038d7;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x5927('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5927('0x1')](0x0);var events={'afterCreate':_0x5927('0x2'),'afterUpdate':_0x5927('0x3'),'afterDestroy':_0x5927('0x4')};function emitEvent(_0x2f5ca9){return function(_0x11e18d,_0x562469,_0x437c69){DashboardItemEvents[_0x5927('0x5')](_0x2f5ca9+':'+_0x11e18d['id'],_0x11e18d);DashboardItemEvents['emit'](_0x2f5ca9,_0x11e18d);_0x437c69(null);};}for(var e in events){if(events[_0x5927('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x5927('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xa9ed=['remove','emit','hook','events','../../mysqldb','setMaxListeners','update'];(function(_0x5d7ea1,_0x1091e9){var _0x5724a6=function(_0x6d0375){while(--_0x6d0375){_0x5d7ea1['push'](_0x5d7ea1['shift']());}};_0x5724a6(++_0x1091e9);}(_0xa9ed,0x11b));var _0xda9e=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0xa9ed[_0x2b1551];return _0x2fc2a1;};'use strict';var EventEmitter=require(_0xda9e('0x0'));var DashboardItem=require(_0xda9e('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xda9e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xda9e('0x3'),'afterDestroy':_0xda9e('0x4')};function emitEvent(_0x2527b1){return function(_0x49dc91,_0xcc01f4,_0x290fc5){DashboardItemEvents[_0xda9e('0x5')](_0x2527b1+':'+_0x49dc91['id'],_0x49dc91);DashboardItemEvents['emit'](_0x2527b1,_0x49dc91);_0x290fc5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xda9e('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 914545d..dda5e45 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 _0x63e1=['util','api','moment','bluebird','path','rimraf','./dashboardItem.attributes','exports','define','DashboardItem','lodash'];(function(_0x42bfab,_0x4b6189){var _0x570f5f=function(_0x29da1f){while(--_0x29da1f){_0x42bfab['push'](_0x42bfab['shift']());}};_0x570f5f(++_0x4b6189);}(_0x63e1,0x6d));var _0x163e=function(_0x426c48,_0x46a23d){_0x426c48=_0x426c48-0x0;var _0x390fd0=_0x63e1[_0x426c48];return _0x390fd0;};'use strict';var _=require(_0x163e('0x0'));var util=require(_0x163e('0x1'));var logger=require('../../config/logger')(_0x163e('0x2'));var moment=require(_0x163e('0x3'));var BPromise=require(_0x163e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x163e('0x5'));var rimraf=require(_0x163e('0x6'));var config=require('../../config/environment');var attributes=require(_0x163e('0x7'));module[_0x163e('0x8')]=function(_0x260bd,_0x4e2ac6){return _0x260bd[_0x163e('0x9')](_0x163e('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c97=['exports','define','DashboardItem','dashboard_items','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x335cfa,_0x1e7634){var _0xb7a81b=function(_0x36cf8b){while(--_0x36cf8b){_0x335cfa['push'](_0x335cfa['shift']());}};_0xb7a81b(++_0x1e7634);}(_0x0c97,0x64));var _0x70c9=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x0c97[_0x4653f7];return _0x5454da;};'use strict';var _=require('lodash');var util=require(_0x70c9('0x0'));var logger=require('../../config/logger')(_0x70c9('0x1'));var moment=require('moment');var BPromise=require(_0x70c9('0x2'));var rp=require(_0x70c9('0x3'));var fs=require('fs');var path=require(_0x70c9('0x4'));var rimraf=require(_0x70c9('0x5'));var config=require(_0x70c9('0x6'));var attributes=require(_0x70c9('0x7'));module[_0x70c9('0x8')]=function(_0xdeb2fa,_0x5a4400){return _0xdeb2fa[_0x70c9('0x9')](_0x70c9('0xa'),attributes,{'tableName':_0x70c9('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 3033a64..abd956e 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 _0x40c5=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','then','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result'];(function(_0x3e6876,_0x57426f){var _0x4aea2c=function(_0x4796a8){while(--_0x4796a8){_0x3e6876['push'](_0x3e6876['shift']());}};_0x4aea2c(++_0x57426f);}(_0x40c5,0x88));var _0x540c=function(_0x40aa74,_0x1bfbf4){_0x40aa74=_0x40aa74-0x0;var _0x24a8a2=_0x40c5[_0x40aa74];return _0x24a8a2;};'use strict';var _=require(_0x540c('0x0'));var util=require(_0x540c('0x1'));var moment=require(_0x540c('0x2'));var BPromise=require(_0x540c('0x3'));var rs=require(_0x540c('0x4'));var fs=require('fs');var Redis=require(_0x540c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x540c('0x6'))(_0x540c('0x7'));var config=require(_0x540c('0x8'));var jayson=require(_0x540c('0x9'));var client=jayson[_0x540c('0xa')]['http']({'port':0x232a});config[_0x540c('0xb')]=_['defaults'](config[_0x540c('0xb')],{'host':_0x540c('0xc'),'port':0x18eb});var socket=require(_0x540c('0xd'))(new Redis(config['redis']));require(_0x540c('0xe'))['register'](socket);function respondWithRpcPromise(_0x34160d,_0x1e1728,_0x778e7d){return new BPromise(function(_0x321f1e,_0x3abb2a){return client['request'](_0x34160d,_0x778e7d)[_0x540c('0xf')](function(_0x443985){logger['info'](_0x540c('0x10'),_0x1e1728,'request\x20sent');logger[_0x540c('0x11')](_0x540c('0x12'),_0x1e1728,'request\x20sent',JSON[_0x540c('0x13')](_0x443985));if(_0x443985[_0x540c('0x14')]){if(_0x443985[_0x540c('0x14')][_0x540c('0x15')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x1e1728,_0x443985[_0x540c('0x14')]['message']);return _0x3abb2a(_0x443985['error'][_0x540c('0x16')]);}logger[_0x540c('0x14')]('DashboardItem,\x20%s,\x20%s',_0x1e1728,_0x443985[_0x540c('0x14')][_0x540c('0x16')]);return _0x321f1e(_0x443985['error'][_0x540c('0x16')]);}else{logger[_0x540c('0x17')](_0x540c('0x10'),_0x1e1728,_0x540c('0x18'));_0x321f1e(_0x443985[_0x540c('0x19')][_0x540c('0x16')]);}})[_0x540c('0x1a')](function(_0xe67c93){logger[_0x540c('0x14')]('DashboardItem,\x20%s,\x20%s',_0x1e1728,_0xe67c93);_0x3abb2a(_0xe67c93);});});} \ No newline at end of file +var _0xbb0b=['redis','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','defaults'];(function(_0x34aa1b,_0x477610){var _0x4cff5f=function(_0x5bdd0b){while(--_0x5bdd0b){_0x34aa1b['push'](_0x34aa1b['shift']());}};_0x4cff5f(++_0x477610);}(_0xbb0b,0x1d1));var _0xbbb0=function(_0xb2ced3,_0x582d89){_0xb2ced3=_0xb2ced3-0x0;var _0x18e671=_0xbb0b[_0xb2ced3];return _0x18e671;};'use strict';var _=require(_0xbbb0('0x0'));var util=require(_0xbbb0('0x1'));var moment=require(_0xbbb0('0x2'));var BPromise=require(_0xbbb0('0x3'));var rs=require(_0xbbb0('0x4'));var fs=require('fs');var Redis=require(_0xbbb0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbbb0('0x6'))(_0xbbb0('0x7'));var config=require(_0xbbb0('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbbb0('0x9')]({'port':0x232a});config['redis']=_[_0xbbb0('0xa')](config[_0xbbb0('0xb')],{'host':_0xbbb0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbbb0('0xb')]));require(_0xbbb0('0xd'))[_0xbbb0('0xe')](socket);function respondWithRpcPromise(_0x5c3e5b,_0x45f761,_0x38f217){return new BPromise(function(_0x37f396,_0x3af9f1){return client[_0xbbb0('0xf')](_0x5c3e5b,_0x38f217)[_0xbbb0('0x10')](function(_0x22e5aa){logger[_0xbbb0('0x11')](_0xbbb0('0x12'),_0x45f761,_0xbbb0('0x13'));logger[_0xbbb0('0x14')](_0xbbb0('0x15'),_0x45f761,_0xbbb0('0x13'),JSON[_0xbbb0('0x16')](_0x22e5aa));if(_0x22e5aa['error']){if(_0x22e5aa[_0xbbb0('0x17')][_0xbbb0('0x18')]===0x1f4){logger[_0xbbb0('0x17')](_0xbbb0('0x12'),_0x45f761,_0x22e5aa['error'][_0xbbb0('0x19')]);return _0x3af9f1(_0x22e5aa[_0xbbb0('0x17')][_0xbbb0('0x19')]);}logger[_0xbbb0('0x17')](_0xbbb0('0x12'),_0x45f761,_0x22e5aa[_0xbbb0('0x17')][_0xbbb0('0x19')]);return _0x37f396(_0x22e5aa[_0xbbb0('0x17')][_0xbbb0('0x19')]);}else{logger[_0xbbb0('0x11')]('DashboardItem,\x20%s,\x20%s',_0x45f761,_0xbbb0('0x13'));_0x37f396(_0x22e5aa[_0xbbb0('0x1a')]['message']);}})[_0xbbb0('0x1b')](function(_0xa1707){logger[_0xbbb0('0x17')](_0xbbb0('0x12'),_0x45f761,_0xa1707);_0x3af9f1(_0xa1707);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index a27fa20..34b2efd 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 _0x93fc=['remove','update','removeListener','dashboardItem:','./dashboardItem.events','save'];(function(_0x414fff,_0x312ba9){var _0x3140ad=function(_0x216004){while(--_0x216004){_0x414fff['push'](_0x414fff['shift']());}};_0x3140ad(++_0x312ba9);}(_0x93fc,0x1e4));var _0xc93f=function(_0x33a5bb,_0x492972){_0x33a5bb=_0x33a5bb-0x0;var _0x3fdae6=_0x93fc[_0x33a5bb];return _0x3fdae6;};'use strict';var DashboardItemEvents=require(_0xc93f('0x0'));var events=[_0xc93f('0x1'),_0xc93f('0x2'),_0xc93f('0x3')];function createListener(_0x5dc965,_0x48bc89){return function(_0x17d5b8){_0x48bc89['emit'](_0x5dc965,_0x17d5b8);};}function removeListener(_0x27dcdf,_0x26b402){return function(){DashboardItemEvents[_0xc93f('0x4')](_0x27dcdf,_0x26b402);};}exports['register']=function(_0x282980){for(var _0x4a3a96=0x0,_0x995748=events['length'];_0x4a3a96<_0x995748;_0x4a3a96++){var _0x1b58d8=events[_0x4a3a96];var _0x2e04b4=createListener(_0xc93f('0x5')+_0x1b58d8,_0x282980);DashboardItemEvents['on'](_0x1b58d8,_0x2e04b4);}}; \ No newline at end of file +var _0xa3d9=['removeListener','register','length','dashboardItem:'];(function(_0x5908b8,_0x544699){var _0xe24a76=function(_0x2bd33f){while(--_0x2bd33f){_0x5908b8['push'](_0x5908b8['shift']());}};_0xe24a76(++_0x544699);}(_0xa3d9,0x138));var _0x9a3d=function(_0x1a20ec,_0x27626c){_0x1a20ec=_0x1a20ec-0x0;var _0x3a2ec1=_0xa3d9[_0x1a20ec];return _0x3a2ec1;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove','update'];function createListener(_0x4a5e7e,_0x4156e9){return function(_0x34b603){_0x4156e9['emit'](_0x4a5e7e,_0x34b603);};}function removeListener(_0x591ce3,_0x535ea0){return function(){DashboardItemEvents[_0x9a3d('0x0')](_0x591ce3,_0x535ea0);};}exports[_0x9a3d('0x1')]=function(_0x365334){for(var _0xcc9da=0x0,_0x1f5d60=events[_0x9a3d('0x2')];_0xcc9da<_0x1f5d60;_0xcc9da++){var _0x21c4b0=events[_0xcc9da];var _0xf19ae1=createListener(_0x9a3d('0x3')+_0x21c4b0,_0x365334);DashboardItemEvents['on'](_0x21c4b0,_0xf19ae1);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index f973309..ab098bf 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 _0x7de1=['destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','show','/:id','update'];(function(_0x3fbec3,_0x2b1471){var _0x10e7d4=function(_0x4df45f){while(--_0x4df45f){_0x3fbec3['push'](_0x3fbec3['shift']());}};_0x10e7d4(++_0x2b1471);}(_0x7de1,0xab));var _0x17de=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x7de1[_0x29c261];return _0x1a9335;};'use strict';var multer=require(_0x17de('0x0'));var util=require('util');var path=require(_0x17de('0x1'));var timeout=require(_0x17de('0x2'));var express=require(_0x17de('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x17de('0x4'));var config=require('../../config/environment');var controller=require(_0x17de('0x5'));router[_0x17de('0x6')]('/:id',auth[_0x17de('0x7')](),controller[_0x17de('0x8')]);router['post']('/',auth[_0x17de('0x7')](),controller['create']);router['put'](_0x17de('0x9'),auth['isAuthenticated'](),controller[_0x17de('0xa')]);router['delete']('/:id',auth[_0x17de('0x7')](),controller[_0x17de('0xb')]);module[_0x17de('0xc')]=router; \ No newline at end of file +var _0x700f=['/:id','show','post','put','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x700f,0xec));var _0xf700=function(_0x484051,_0x5ed01a){_0x484051=_0x484051-0x0;var _0x162620=_0x700f[_0x484051];return _0x162620;};'use strict';var multer=require(_0xf700('0x0'));var util=require(_0xf700('0x1'));var path=require(_0xf700('0x2'));var timeout=require(_0xf700('0x3'));var express=require(_0xf700('0x4'));var router=express[_0xf700('0x5')]();var fs_extra=require(_0xf700('0x6'));var auth=require(_0xf700('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf700('0x8'));var controller=require(_0xf700('0x9'));router[_0xf700('0xa')](_0xf700('0xb'),auth['isAuthenticated'](),controller[_0xf700('0xc')]);router[_0xf700('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf700('0xe')](_0xf700('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf700('0xf')]('/:id',auth[_0xf700('0x10')](),controller[_0xf700('0x11')]);module[_0xf700('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 65cd37e..a3c4d54 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 _0x5b52=['sequelize','ENUM','first','second','STRING'];(function(_0xe8cb8c,_0x5bd978){var _0x762834=function(_0x14c9f2){while(--_0x14c9f2){_0xe8cb8c['push'](_0xe8cb8c['shift']());}};_0x762834(++_0x5bd978);}(_0x5b52,0x131));var _0x25b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b52[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x25b5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x25b5('0x1')](_0x25b5('0x2'),_0x25b5('0x3'),'third'),'allowNull':![],'defaultValue':_0x25b5('0x2')},'description':{'type':Sequelize[_0x25b5('0x4')]}}; \ No newline at end of file +var _0x0f65=['STRING','ENUM','first','third','sequelize','exports'];(function(_0x5a0884,_0x1e5618){var _0x408cba=function(_0x2f6cc9){while(--_0x2f6cc9){_0x5a0884['push'](_0x5a0884['shift']());}};_0x408cba(++_0x1e5618);}(_0x0f65,0xb2));var _0x50f6=function(_0x17fd65,_0x556d01){_0x17fd65=_0x17fd65-0x0;var _0x27d033=_0x0f65[_0x17fd65];return _0x27d033;};'use strict';var Sequelize=require(_0x50f6('0x0'));module[_0x50f6('0x1')]={'name':{'type':Sequelize[_0x50f6('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x50f6('0x3')](_0x50f6('0x4'),'second',_0x50f6('0x5')),'allowNull':![],'defaultValue':_0x50f6('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 03fa779..71c01da 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 _0x872a=['catch','params','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows'];(function(_0x7510b0,_0x109b04){var _0x590028=function(_0x292c9c){while(--_0x292c9c){_0x7510b0['push'](_0x7510b0['shift']());}};_0x590028(++_0x109b04);}(_0x872a,0x100));var _0xa872=function(_0x2f4023,_0x251164){_0x2f4023=_0x2f4023-0x0;var _0x398b31=_0x872a[_0x2f4023];return _0x398b31;};'use strict';var emlformat=require(_0xa872('0x0'));var rimraf=require(_0xa872('0x1'));var zipdir=require(_0xa872('0x2'));var jsonpatch=require(_0xa872('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa872('0x4'));var util=require(_0xa872('0x5'));var path=require(_0xa872('0x6'));var sox=require(_0xa872('0x7'));var csv=require(_0xa872('0x8'));var ejs=require(_0xa872('0x9'));var fs=require('fs');var fs_extra=require(_0xa872('0xa'));var _=require('lodash');var squel=require(_0xa872('0xb'));var crypto=require(_0xa872('0xc'));var jsforce=require(_0xa872('0xd'));var deskjs=require(_0xa872('0xe'));var toCsv=require(_0xa872('0x8'));var querystring=require(_0xa872('0xf'));var Papa=require(_0xa872('0x10'));var Redis=require(_0xa872('0x11'));var authService=require(_0xa872('0x12'));var qs=require(_0xa872('0x13'));var as=require(_0xa872('0x14'));var hardwareService=require(_0xa872('0x15'));var logger=require(_0xa872('0x16'))(_0xa872('0x17'));var utils=require('../../config/utils');var config=require(_0xa872('0x18'));var licenseUtil=require(_0xa872('0x19'));var db=require(_0xa872('0x1a'))['db'];function respondWithStatusCode(_0x50a4e4,_0x3df1ed){_0x3df1ed=_0x3df1ed||0xcc;return function(_0x322863){if(_0x322863){return _0x50a4e4[_0xa872('0x1b')](_0x3df1ed);}return _0x50a4e4[_0xa872('0x1c')](_0x3df1ed)[_0xa872('0x1d')]();};}function respondWithResult(_0x5ea257,_0x3d2b0e){_0x3d2b0e=_0x3d2b0e||0xc8;return function(_0x5cd621){if(_0x5cd621){return _0x5ea257[_0xa872('0x1c')](_0x3d2b0e)[_0xa872('0x1e')](_0x5cd621);}};}function respondWithFilteredResult(_0x255abf,_0x947d7){return function(_0x54b97c){if(_0x54b97c){var _0x2619b1=typeof _0x947d7[_0xa872('0x1f')]==='undefined'&&typeof _0x947d7[_0xa872('0x20')]===_0xa872('0x21');var _0x3f5dc6=_0x54b97c['count'];var _0xa61ab3=_0x2619b1?0x0:_0x947d7[_0xa872('0x1f')];var _0x3c05b5=_0x2619b1?_0x54b97c[_0xa872('0x22')]:_0x947d7[_0xa872('0x1f')]+_0x947d7['limit'];var _0x26cc07;if(_0x3c05b5>=_0x3f5dc6){_0x3c05b5=_0x3f5dc6;_0x26cc07=0xc8;}else{_0x26cc07=0xce;}_0x255abf['status'](_0x26cc07);return _0x255abf[_0xa872('0x23')]('Content-Range',_0xa61ab3+'-'+_0x3c05b5+'/'+_0x3f5dc6)[_0xa872('0x1e')](_0x54b97c);}return null;};}function patchUpdates(_0x58bd91){return function(_0x18e3a5){try{jsonpatch['apply'](_0x18e3a5,_0x58bd91,!![]);}catch(_0xe589b5){return BPromise[_0xa872('0x24')](_0xe589b5);}return _0x18e3a5['save']();};}function saveUpdates(_0x380c1c,_0x21db5b){return function(_0x5ad012){if(_0x5ad012){return _0x5ad012[_0xa872('0x25')](_0x380c1c)[_0xa872('0x26')](function(_0x1b24f7){return _0x1b24f7;});}return null;};}function removeEntity(_0x431365,_0x167057){return function(_0x28db80){if(_0x28db80){return _0x28db80[_0xa872('0x27')]()['then'](function(){var _0x1d6686=_0x28db80[_0xa872('0x28')]({'plain':!![]});var _0x28876a=_0xa872('0x29');return db[_0xa872('0x2a')][_0xa872('0x27')]({'where':{'type':_0x28876a,'resourceId':_0x1d6686['id']}})[_0xa872('0x26')](function(){return _0x28db80;});})['then'](function(){_0x431365[_0xa872('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dd475,_0x4053c0){return function(_0x1e24c7){if(!_0x1e24c7){_0x1dd475['sendStatus'](0x194);}return _0x1e24c7;};}function handleError(_0x149f8d,_0x7c7f13){_0x7c7f13=_0x7c7f13||0x1f4;return function(_0x25322d){logger[_0xa872('0x2b')](_0x25322d['stack']);if(_0x25322d[_0xa872('0x2c')]){delete _0x25322d['name'];}_0x149f8d['status'](_0x7c7f13)[_0xa872('0x2d')](_0x25322d);};}exports['index']=function(_0x215a61,_0x408bdf){var _0x45131d={},_0x252831={},_0x391725={'count':0x0,'rows':[]};var _0x4a990d=_[_0xa872('0x2e')](db[_0xa872('0x2f')][_0xa872('0x30')],function(_0x486565){return{'name':_0x486565[_0xa872('0x31')],'type':_0x486565[_0xa872('0x32')][_0xa872('0x33')]};});_0x252831[_0xa872('0x34')]=_[_0xa872('0x2e')](_0x4a990d,_0xa872('0x2c'));_0x252831['query']=_[_0xa872('0x35')](_0x215a61[_0xa872('0x36')]);_0x252831[_0xa872('0x37')]=_[_0xa872('0x38')](_0x252831['model'],_0x252831[_0xa872('0x36')]);_0x45131d[_0xa872('0x39')]=_[_0xa872('0x38')](_0x252831[_0xa872('0x34')],qs[_0xa872('0x3a')](_0x215a61[_0xa872('0x36')][_0xa872('0x3a')]));_0x45131d[_0xa872('0x39')]=_0x45131d[_0xa872('0x39')][_0xa872('0x3b')]?_0x45131d[_0xa872('0x39')]:_0x252831[_0xa872('0x34')];if(!_0x215a61[_0xa872('0x36')][_0xa872('0x3c')](_0xa872('0x3d'))){_0x45131d[_0xa872('0x20')]=qs[_0xa872('0x20')](_0x215a61[_0xa872('0x36')][_0xa872('0x20')]);_0x45131d['offset']=qs['offset'](_0x215a61['query']['offset']);}_0x45131d[_0xa872('0x3e')]=qs[_0xa872('0x3f')](_0x215a61[_0xa872('0x36')]['sort']);_0x45131d[_0xa872('0x40')]=qs[_0xa872('0x37')](_['pick'](_0x215a61[_0xa872('0x36')],_0x252831[_0xa872('0x37')]),_0x4a990d);if(_0x215a61[_0xa872('0x36')]['filter']){_0x45131d[_0xa872('0x40')]=_[_0xa872('0x41')](_0x45131d[_0xa872('0x40')],{'$or':_['map'](_0x4a990d,function(_0xcae52b){if(_0xcae52b[_0xa872('0x32')]!==_0xa872('0x42')){var _0xd61b59={};_0xd61b59[_0xcae52b[_0xa872('0x2c')]]={'$like':'%'+_0x215a61[_0xa872('0x36')][_0xa872('0x43')]+'%'};return _0xd61b59;}})});}_0x45131d=_['merge']({},_0x45131d,_0x215a61['options']);var _0x2b2d7f={'where':_0x45131d[_0xa872('0x40')]};return db[_0xa872('0x2f')]['count'](_0x2b2d7f)[_0xa872('0x26')](function(_0x19a54b){_0x391725['count']=_0x19a54b;if(_0x215a61['query'][_0xa872('0x44')]){_0x45131d[_0xa872('0x45')]=[{'all':!![]}];}return db[_0xa872('0x2f')][_0xa872('0x46')](_0x45131d);})['then'](function(_0x46b2a2){_0x391725[_0xa872('0x47')]=_0x46b2a2;return _0x391725;})['then'](respondWithFilteredResult(_0x408bdf,_0x45131d))[_0xa872('0x48')](handleError(_0x408bdf,null));};exports['show']=function(_0x3d44d1,_0x16a28d){var _0xb89882={'raw':!![],'where':{'id':_0x3d44d1[_0xa872('0x49')]['id']}},_0x243769={};_0x243769[_0xa872('0x34')]=_[_0xa872('0x35')](db['Disposition'][_0xa872('0x30')]);_0x243769[_0xa872('0x36')]=_['keys'](_0x3d44d1[_0xa872('0x36')]);_0x243769['filters']=_[_0xa872('0x38')](_0x243769[_0xa872('0x34')],_0x243769['query']);_0xb89882[_0xa872('0x39')]=_[_0xa872('0x38')](_0x243769['model'],qs[_0xa872('0x3a')](_0x3d44d1[_0xa872('0x36')][_0xa872('0x3a')]));_0xb89882[_0xa872('0x39')]=_0xb89882[_0xa872('0x39')]['length']?_0xb89882[_0xa872('0x39')]:_0x243769[_0xa872('0x34')];if(_0x3d44d1[_0xa872('0x36')]['includeAll']){_0xb89882[_0xa872('0x45')]=[{'all':!![]}];}_0xb89882=_[_0xa872('0x41')]({},_0xb89882,_0x3d44d1['options']);return db[_0xa872('0x2f')][_0xa872('0x4a')](_0xb89882)[_0xa872('0x26')](handleEntityNotFound(_0x16a28d,null))['then'](respondWithResult(_0x16a28d,null))['catch'](handleError(_0x16a28d,null));};exports[_0xa872('0x4b')]=function(_0x1fc7d1,_0x125020){return db['Disposition'][_0xa872('0x4b')](_0x1fc7d1[_0xa872('0x4c')],{})['then'](function(_0x414d3c){var _0x459f0d=_0x1fc7d1['user'][_0xa872('0x28')]({'plain':!![]});if(!_0x459f0d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x459f0d[_0xa872('0x4d')]==='user'){var _0x3023db=_0x414d3c[_0xa872('0x28')]({'plain':!![]});var _0x11ac13=_0xa872('0x29');return db[_0xa872('0x4e')][_0xa872('0x4a')]({'where':{'name':_0x11ac13,'userProfileId':_0x459f0d[_0xa872('0x4f')]},'raw':!![]})[_0xa872('0x26')](function(_0x3c5ec3){if(_0x3c5ec3&&_0x3c5ec3[_0xa872('0x50')]===0x0){return db[_0xa872('0x2a')][_0xa872('0x4b')]({'name':_0x3023db[_0xa872('0x2c')],'resourceId':_0x3023db['id'],'type':_0x3c5ec3[_0xa872('0x2c')],'sectionId':_0x3c5ec3['id']},{})['then'](function(){return _0x414d3c;});}else{return _0x414d3c;}})['catch'](function(_0xce77ed){logger[_0xa872('0x2b')](_0xa872('0x51'),_0xce77ed);throw _0xce77ed;});}return _0x414d3c;})['then'](respondWithResult(_0x125020,0xc9))['catch'](handleError(_0x125020,null));};exports[_0xa872('0x25')]=function(_0x46c828,_0x2297f8){if(_0x46c828[_0xa872('0x4c')]['id']){delete _0x46c828[_0xa872('0x4c')]['id'];}return db[_0xa872('0x2f')][_0xa872('0x4a')]({'where':{'id':_0x46c828[_0xa872('0x49')]['id']}})['then'](handleEntityNotFound(_0x2297f8,null))['then'](saveUpdates(_0x46c828[_0xa872('0x4c')],null))[_0xa872('0x26')](respondWithResult(_0x2297f8,null))[_0xa872('0x48')](handleError(_0x2297f8,null));};exports[_0xa872('0x27')]=function(_0x460bb3,_0x2e601f){return db[_0xa872('0x2f')][_0xa872('0x4a')]({'where':{'id':_0x460bb3[_0xa872('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e601f,null))[_0xa872('0x26')](removeEntity(_0x2e601f,null))[_0xa872('0x48')](handleError(_0x2e601f,null));}; \ No newline at end of file +var _0x14c2=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','Dispositions','destroy','error','stack','send','map','Disposition','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','catch','merge','find','create','user','role','UserProfileSection','userProfileId','UserProfileResource','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x5c6469,_0x54afe8){var _0x4a85d0=function(_0x668156){while(--_0x668156){_0x5c6469['push'](_0x5c6469['shift']());}};_0x4a85d0(++_0x54afe8);}(_0x14c2,0x180));var _0x214c=function(_0x3fe512,_0x37937e){_0x3fe512=_0x3fe512-0x0;var _0x4827c9=_0x14c2[_0x3fe512];return _0x4827c9;};'use strict';var emlformat=require(_0x214c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x214c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x214c('0x2'));var moment=require(_0x214c('0x3'));var BPromise=require(_0x214c('0x4'));var Mustache=require('mustache');var util=require(_0x214c('0x5'));var path=require(_0x214c('0x6'));var sox=require(_0x214c('0x7'));var csv=require(_0x214c('0x8'));var ejs=require(_0x214c('0x9'));var fs=require('fs');var fs_extra=require(_0x214c('0xa'));var _=require(_0x214c('0xb'));var squel=require('squel');var crypto=require(_0x214c('0xc'));var jsforce=require(_0x214c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x214c('0xe'));var Papa=require(_0x214c('0xf'));var Redis=require('ioredis');var authService=require(_0x214c('0x10'));var qs=require(_0x214c('0x11'));var as=require(_0x214c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x214c('0x13'))(_0x214c('0x14'));var utils=require(_0x214c('0x15'));var config=require(_0x214c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x214c('0x17'))['db'];function respondWithStatusCode(_0xb7c799,_0x30750e){_0x30750e=_0x30750e||0xcc;return function(_0x3df35a){if(_0x3df35a){return _0xb7c799[_0x214c('0x18')](_0x30750e);}return _0xb7c799[_0x214c('0x19')](_0x30750e)[_0x214c('0x1a')]();};}function respondWithResult(_0x4f2690,_0x104aab){_0x104aab=_0x104aab||0xc8;return function(_0x1b067e){if(_0x1b067e){return _0x4f2690[_0x214c('0x19')](_0x104aab)[_0x214c('0x1b')](_0x1b067e);}};}function respondWithFilteredResult(_0x364666,_0x23f99c){return function(_0x37f483){if(_0x37f483){var _0x2bb298=typeof _0x23f99c[_0x214c('0x1c')]==='undefined'&&typeof _0x23f99c[_0x214c('0x1d')]==='undefined';var _0x319e88=_0x37f483['count'];var _0x273376=_0x2bb298?0x0:_0x23f99c[_0x214c('0x1c')];var _0x390fe5=_0x2bb298?_0x37f483[_0x214c('0x1e')]:_0x23f99c[_0x214c('0x1c')]+_0x23f99c[_0x214c('0x1d')];var _0x3921aa;if(_0x390fe5>=_0x319e88){_0x390fe5=_0x319e88;_0x3921aa=0xc8;}else{_0x3921aa=0xce;}_0x364666[_0x214c('0x19')](_0x3921aa);return _0x364666[_0x214c('0x1f')](_0x214c('0x20'),_0x273376+'-'+_0x390fe5+'/'+_0x319e88)[_0x214c('0x1b')](_0x37f483);}return null;};}function patchUpdates(_0x2717ba){return function(_0x30a79c){try{jsonpatch[_0x214c('0x21')](_0x30a79c,_0x2717ba,!![]);}catch(_0x4dea8c){return BPromise[_0x214c('0x22')](_0x4dea8c);}return _0x30a79c[_0x214c('0x23')]();};}function saveUpdates(_0x1d83ad,_0x3f71c8){return function(_0x2b98d3){if(_0x2b98d3){return _0x2b98d3[_0x214c('0x24')](_0x1d83ad)['then'](function(_0x1e6ed7){return _0x1e6ed7;});}return null;};}function removeEntity(_0x5b34ae,_0x5efcc6){return function(_0x4a385d){if(_0x4a385d){return _0x4a385d['destroy']()[_0x214c('0x25')](function(){var _0x26e95c=_0x4a385d[_0x214c('0x26')]({'plain':!![]});var _0x4d3ce2=_0x214c('0x27');return db['UserProfileResource'][_0x214c('0x28')]({'where':{'type':_0x4d3ce2,'resourceId':_0x26e95c['id']}})[_0x214c('0x25')](function(){return _0x4a385d;});})['then'](function(){_0x5b34ae[_0x214c('0x19')](0xcc)[_0x214c('0x1a')]();});}};}function handleEntityNotFound(_0xbbea8c,_0x5de0be){return function(_0x204e00){if(!_0x204e00){_0xbbea8c[_0x214c('0x18')](0x194);}return _0x204e00;};}function handleError(_0xce1aee,_0x48c83b){_0x48c83b=_0x48c83b||0x1f4;return function(_0x9da0d){logger[_0x214c('0x29')](_0x9da0d[_0x214c('0x2a')]);if(_0x9da0d['name']){delete _0x9da0d['name'];}_0xce1aee['status'](_0x48c83b)[_0x214c('0x2b')](_0x9da0d);};}exports['index']=function(_0x19bf45,_0x217abc){var _0x56117f={},_0x5d3856={},_0x31cb67={'count':0x0,'rows':[]};var _0x50ca38=_[_0x214c('0x2c')](db[_0x214c('0x2d')][_0x214c('0x2e')],function(_0x2a8ca7){return{'name':_0x2a8ca7[_0x214c('0x2f')],'type':_0x2a8ca7[_0x214c('0x30')]['key']};});_0x5d3856[_0x214c('0x31')]=_[_0x214c('0x2c')](_0x50ca38,'name');_0x5d3856['query']=_[_0x214c('0x32')](_0x19bf45[_0x214c('0x33')]);_0x5d3856[_0x214c('0x34')]=_[_0x214c('0x35')](_0x5d3856['model'],_0x5d3856[_0x214c('0x33')]);_0x56117f[_0x214c('0x36')]=_[_0x214c('0x35')](_0x5d3856[_0x214c('0x31')],qs[_0x214c('0x37')](_0x19bf45['query'][_0x214c('0x37')]));_0x56117f['attributes']=_0x56117f[_0x214c('0x36')][_0x214c('0x38')]?_0x56117f[_0x214c('0x36')]:_0x5d3856[_0x214c('0x31')];if(!_0x19bf45[_0x214c('0x33')][_0x214c('0x39')](_0x214c('0x3a'))){_0x56117f['limit']=qs[_0x214c('0x1d')](_0x19bf45['query'][_0x214c('0x1d')]);_0x56117f[_0x214c('0x1c')]=qs[_0x214c('0x1c')](_0x19bf45['query'][_0x214c('0x1c')]);}_0x56117f[_0x214c('0x3b')]=qs[_0x214c('0x3c')](_0x19bf45[_0x214c('0x33')][_0x214c('0x3c')]);_0x56117f[_0x214c('0x3d')]=qs[_0x214c('0x34')](_[_0x214c('0x3e')](_0x19bf45[_0x214c('0x33')],_0x5d3856[_0x214c('0x34')]),_0x50ca38);if(_0x19bf45['query'][_0x214c('0x3f')]){_0x56117f[_0x214c('0x3d')]=_['merge'](_0x56117f[_0x214c('0x3d')],{'$or':_[_0x214c('0x2c')](_0x50ca38,function(_0x710c38){if(_0x710c38[_0x214c('0x30')]!==_0x214c('0x40')){var _0x51b9b0={};_0x51b9b0[_0x710c38['name']]={'$like':'%'+_0x19bf45[_0x214c('0x33')][_0x214c('0x3f')]+'%'};return _0x51b9b0;}})});}_0x56117f=_['merge']({},_0x56117f,_0x19bf45[_0x214c('0x41')]);var _0x4585bd={'where':_0x56117f['where']};return db[_0x214c('0x2d')][_0x214c('0x1e')](_0x4585bd)[_0x214c('0x25')](function(_0x2f3801){_0x31cb67[_0x214c('0x1e')]=_0x2f3801;if(_0x19bf45[_0x214c('0x33')][_0x214c('0x42')]){_0x56117f[_0x214c('0x43')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x56117f);})[_0x214c('0x25')](function(_0x3b9c2d){_0x31cb67['rows']=_0x3b9c2d;return _0x31cb67;})['then'](respondWithFilteredResult(_0x217abc,_0x56117f))[_0x214c('0x44')](handleError(_0x217abc,null));};exports['show']=function(_0x1175bb,_0x3f2995){var _0x58ffab={'raw':!![],'where':{'id':_0x1175bb['params']['id']}},_0x2c204a={};_0x2c204a[_0x214c('0x31')]=_['keys'](db[_0x214c('0x2d')]['rawAttributes']);_0x2c204a[_0x214c('0x33')]=_[_0x214c('0x32')](_0x1175bb[_0x214c('0x33')]);_0x2c204a[_0x214c('0x34')]=_[_0x214c('0x35')](_0x2c204a[_0x214c('0x31')],_0x2c204a[_0x214c('0x33')]);_0x58ffab[_0x214c('0x36')]=_[_0x214c('0x35')](_0x2c204a[_0x214c('0x31')],qs[_0x214c('0x37')](_0x1175bb[_0x214c('0x33')]['fields']));_0x58ffab['attributes']=_0x58ffab[_0x214c('0x36')][_0x214c('0x38')]?_0x58ffab['attributes']:_0x2c204a[_0x214c('0x31')];if(_0x1175bb[_0x214c('0x33')]['includeAll']){_0x58ffab[_0x214c('0x43')]=[{'all':!![]}];}_0x58ffab=_[_0x214c('0x45')]({},_0x58ffab,_0x1175bb[_0x214c('0x41')]);return db[_0x214c('0x2d')][_0x214c('0x46')](_0x58ffab)[_0x214c('0x25')](handleEntityNotFound(_0x3f2995,null))['then'](respondWithResult(_0x3f2995,null))[_0x214c('0x44')](handleError(_0x3f2995,null));};exports[_0x214c('0x47')]=function(_0xa21fda,_0xef5de5){return db['Disposition'][_0x214c('0x47')](_0xa21fda['body'],{})[_0x214c('0x25')](function(_0x354456){var _0x11c0b3=_0xa21fda[_0x214c('0x48')][_0x214c('0x26')]({'plain':!![]});if(!_0x11c0b3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11c0b3[_0x214c('0x49')]===_0x214c('0x48')){var _0x45cc1e=_0x354456[_0x214c('0x26')]({'plain':!![]});var _0x380350=_0x214c('0x27');return db[_0x214c('0x4a')][_0x214c('0x46')]({'where':{'name':_0x380350,'userProfileId':_0x11c0b3[_0x214c('0x4b')]},'raw':!![]})[_0x214c('0x25')](function(_0x203aa9){if(_0x203aa9&&_0x203aa9['autoAssociation']===0x0){return db[_0x214c('0x4c')][_0x214c('0x47')]({'name':_0x45cc1e[_0x214c('0x4d')],'resourceId':_0x45cc1e['id'],'type':_0x203aa9[_0x214c('0x4d')],'sectionId':_0x203aa9['id']},{})[_0x214c('0x25')](function(){return _0x354456;});}else{return _0x354456;}})[_0x214c('0x44')](function(_0x2f6d28){logger[_0x214c('0x29')](_0x214c('0x4e'),_0x2f6d28);throw _0x2f6d28;});}return _0x354456;})['then'](respondWithResult(_0xef5de5,0xc9))[_0x214c('0x44')](handleError(_0xef5de5,null));};exports[_0x214c('0x24')]=function(_0xea2781,_0xa05d1a){if(_0xea2781[_0x214c('0x4f')]['id']){delete _0xea2781[_0x214c('0x4f')]['id'];}return db[_0x214c('0x2d')][_0x214c('0x46')]({'where':{'id':_0xea2781[_0x214c('0x50')]['id']}})[_0x214c('0x25')](handleEntityNotFound(_0xa05d1a,null))[_0x214c('0x25')](saveUpdates(_0xea2781[_0x214c('0x4f')],null))['then'](respondWithResult(_0xa05d1a,null))[_0x214c('0x44')](handleError(_0xa05d1a,null));};exports[_0x214c('0x28')]=function(_0x34064e,_0x26425b){return db[_0x214c('0x2d')][_0x214c('0x46')]({'where':{'id':_0x34064e[_0x214c('0x50')]['id']}})[_0x214c('0x25')](handleEntityNotFound(_0x26425b,null))['then'](removeEntity(_0x26425b,null))[_0x214c('0x44')](handleError(_0x26425b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 2b80529..aa79723 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 _0x72e7=['exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','api','request-promise','rimraf','../../config/environment','./disposition.attributes'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x72e7,0x6d));var _0x772e=function(_0x131e1a,_0x2b7ac3){_0x131e1a=_0x131e1a-0x0;var _0x1dd2df=_0x72e7[_0x131e1a];return _0x1dd2df;};'use strict';var _=require('lodash');var util=require(_0x772e('0x0'));var logger=require('../../config/logger')(_0x772e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x772e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x772e('0x3'));var config=require(_0x772e('0x4'));var attributes=require(_0x772e('0x5'));module[_0x772e('0x6')]=function(_0x306cbc,_0x2f3c6b){return _0x306cbc['define'](_0x772e('0x7'),attributes,{'tableName':_0x772e('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x772e('0x9'),'fields':[_0x772e('0xa'),_0x772e('0xb')]},{'unique':!![],'name':_0x772e('0xc'),'fields':['name',_0x772e('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0x772e('0xa'),_0x772e('0xe')]},{'unique':!![],'name':_0x772e('0xf'),'fields':[_0x772e('0xa'),_0x772e('0x10')]},{'unique':!![],'name':_0x772e('0x11'),'fields':[_0x772e('0xa'),_0x772e('0x12')]},{'unique':!![],'name':_0x772e('0x13'),'fields':[_0x772e('0xa'),_0x772e('0x14')]},{'unique':!![],'name':_0x772e('0x15'),'fields':[_0x772e('0xa'),_0x772e('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x315b=['name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','tools_dispositions','name_voice','name','ListId','name_chat','name_mail','MailAccountId'];(function(_0x32acd7,_0x3d83aa){var _0x39d2b8=function(_0x3aaae5){while(--_0x3aaae5){_0x32acd7['push'](_0x32acd7['shift']());}};_0x39d2b8(++_0x3d83aa);}(_0x315b,0xae));var _0xb315=function(_0x2aca18,_0x124dba){_0x2aca18=_0x2aca18-0x0;var _0x3b1501=_0x315b[_0x2aca18];return _0x3b1501;};'use strict';var _=require(_0xb315('0x0'));var util=require(_0xb315('0x1'));var logger=require(_0xb315('0x2'))(_0xb315('0x3'));var moment=require(_0xb315('0x4'));var BPromise=require(_0xb315('0x5'));var rp=require(_0xb315('0x6'));var fs=require('fs');var path=require(_0xb315('0x7'));var rimraf=require(_0xb315('0x8'));var config=require(_0xb315('0x9'));var attributes=require('./disposition.attributes');module['exports']=function(_0x2112c0,_0x2eb5b0){return _0x2112c0[_0xb315('0xa')]('Disposition',attributes,{'tableName':_0xb315('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xb315('0xc'),'fields':[_0xb315('0xd'),_0xb315('0xe')]},{'unique':!![],'name':_0xb315('0xf'),'fields':[_0xb315('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0xb315('0x10'),'fields':['name',_0xb315('0x11')]},{'unique':!![],'name':_0xb315('0x12'),'fields':[_0xb315('0xd'),_0xb315('0x13')]},{'unique':!![],'name':'name_fax','fields':[_0xb315('0xd'),_0xb315('0x14')]},{'unique':!![],'name':_0xb315('0x15'),'fields':[_0xb315('0xd'),_0xb315('0x16')]},{'unique':!![],'name':_0xb315('0x17'),'fields':[_0xb315('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a3f5291..ba9a00f 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(_0x37eeda,_0x52981d){var _0xbb4f77=function(_0xebc6cb){while(--_0xebc6cb){_0x37eeda['push'](_0x37eeda['shift']());}};_0xbb4f77(++_0x52981d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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(_0x49526d,_0x103895){var _0x999d14=function(_0x1c7475){while(--_0x1c7475){_0x49526d['push'](_0x49526d['shift']());}};_0x999d14(++_0x103895);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 19e8908..5271c70 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 _0x9519=['show','post','create','/:id','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index'];(function(_0x229d7e,_0x5bc489){var _0xa78280=function(_0x59850e){while(--_0x59850e){_0x229d7e['push'](_0x229d7e['shift']());}};_0xa78280(++_0x5bc489);}(_0x9519,0x67));var _0x9951=function(_0x444d0c,_0x1847d6){_0x444d0c=_0x444d0c-0x0;var _0x14b15d=_0x9519[_0x444d0c];return _0x14b15d;};'use strict';var multer=require(_0x9951('0x0'));var util=require('util');var path=require(_0x9951('0x1'));var timeout=require('connect-timeout');var express=require(_0x9951('0x2'));var router=express['Router']();var fs_extra=require(_0x9951('0x3'));var auth=require(_0x9951('0x4'));var interaction=require(_0x9951('0x5'));var config=require(_0x9951('0x6'));var controller=require(_0x9951('0x7'));router[_0x9951('0x8')]('/',auth[_0x9951('0x9')](),controller[_0x9951('0xa')]);router[_0x9951('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9951('0xb')]);router[_0x9951('0xc')]('/',auth[_0x9951('0x9')](),controller[_0x9951('0xd')]);router['put'](_0x9951('0xe'),auth[_0x9951('0x9')](),controller[_0x9951('0xf')]);router[_0x9951('0x10')](_0x9951('0xe'),auth[_0x9951('0x9')](),controller[_0x9951('0x11')]);module[_0x9951('0x12')]=router; \ No newline at end of file +var _0x240f=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x240f,0x19e));var _0xf240=function(_0x1f9ab6,_0x57f552){_0x1f9ab6=_0x1f9ab6-0x0;var _0xe8ed1b=_0x240f[_0x1f9ab6];return _0xe8ed1b;};'use strict';var multer=require(_0xf240('0x0'));var util=require(_0xf240('0x1'));var path=require(_0xf240('0x2'));var timeout=require(_0xf240('0x3'));var express=require(_0xf240('0x4'));var router=express['Router']();var fs_extra=require(_0xf240('0x5'));var auth=require(_0xf240('0x6'));var interaction=require(_0xf240('0x7'));var config=require(_0xf240('0x8'));var controller=require(_0xf240('0x9'));router[_0xf240('0xa')]('/',auth[_0xf240('0xb')](),controller[_0xf240('0xc')]);router['get'](_0xf240('0xd'),auth[_0xf240('0xb')](),controller[_0xf240('0xe')]);router[_0xf240('0xf')]('/',auth[_0xf240('0xb')](),controller['create']);router[_0xf240('0x10')](_0xf240('0xd'),auth[_0xf240('0xb')](),controller['update']);router[_0xf240('0x11')]('/:id',auth[_0xf240('0xb')](),controller['destroy']);module[_0xf240('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index d82197b..077c61c 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 _0x9fd4=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','12000','14400','9600','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x2b3888,_0x8660ee){var _0x4beb9a=function(_0x1a5a88){while(--_0x1a5a88){_0x2b3888['push'](_0x2b3888['shift']());}};_0x4beb9a(++_0x8660ee);}(_0x9fd4,0x16c));var _0x49fd=function(_0x13405d,_0xe260e2){_0x13405d=_0x13405d-0x0;var _0x486569=_0x9fd4[_0x13405d];return _0x486569;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'name':{'type':Sequelize[_0x49fd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x49fd('0x2')]},'ecm':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0x4'),'no'),'defaultValue':_0x49fd('0x4')},'headerinfo':{'type':Sequelize[_0x49fd('0x2')],'defaultValue':_0x49fd('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0x6'),_0x49fd('0x7'),_0x49fd('0x8'),'9600',_0x49fd('0x9'),_0x49fd('0xa')),'defaultValue':_0x49fd('0x7')},'maxrate':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0x6'),'4800',_0x49fd('0x8'),_0x49fd('0xb'),_0x49fd('0x9'),_0x49fd('0xa')),'defaultValue':_0x49fd('0xa')},'modem':{'type':Sequelize[_0x49fd('0x2')],'defaultValue':_0x49fd('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x49fd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x49fd('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x49fd('0x3')](_0x49fd('0xe'),_0x49fd('0xf'),_0x49fd('0x10'),_0x49fd('0x11')),'defaultValue':_0x49fd('0xe')},'key':{'type':Sequelize[_0x49fd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x49fd('0x12')],'defaultValue':function(){return _0x49fd('0x13');}},'notificationSound':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x49fd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49fd('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x49fd('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x49fd('0x14')],'defaultValue':![],'comment':_0x49fd('0x16'),'set':function(_0x475eee){if(!_0x475eee)this[_0x49fd('0x17')](_0x49fd('0x18'),null);this['setDataValue'](_0x49fd('0x19'),_0x475eee);}}}; \ No newline at end of file +var _0x7bd0=['STRING','ENUM','yes','localstationid','2400','4800','7200','9600','14400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x7bd0,0x111));var _0x07bd=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x7bd0[_0x58381c];return _0x1a7440;};'use strict';var Sequelize=require(_0x07bd('0x0'));module[_0x07bd('0x1')]={'name':{'type':Sequelize[_0x07bd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x07bd('0x2')]},'ecm':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x4'),'no'),'defaultValue':_0x07bd('0x4')},'headerinfo':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x07bd('0x2')],'unique':_0x07bd('0x5')},'minrate':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x6'),_0x07bd('0x7'),_0x07bd('0x8'),_0x07bd('0x9'),'12000',_0x07bd('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0x6'),_0x07bd('0x7'),'7200',_0x07bd('0x9'),_0x07bd('0xb'),_0x07bd('0xa')),'defaultValue':_0x07bd('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x07bd('0xc')},'gateway':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x07bd('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x07bd('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x07bd('0x3')](_0x07bd('0xe'),_0x07bd('0xf'),_0x07bd('0x10'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x07bd('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x07bd('0x11')],'defaultValue':function(){return _0x07bd('0x12');}},'notificationSound':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x07bd('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x07bd('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x07bd('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x07bd('0x13')],'defaultValue':![],'comment':_0x07bd('0x15'),'set':function(_0x4929d6){if(!_0x4929d6)this[_0x07bd('0x16')](_0x07bd('0x17'),null);this['setDataValue'](_0x07bd('0x18'),_0x4929d6);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 29bc705..7e1c97d 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 _0x5e12=['defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','get','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','FaxAccountId','Disposition','getDispositions','findOne','order','sort','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','getInteractions','FaxInteraction','Owner','fullname','internal','color','tag','addApplications','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','system','appdata','push','Answer','CDR(type)=inbound-fax','gateway','faxdetect','maxrate','minrate','modem','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','updateAccountApplications','VoiceExtension','omit','tech','key','createdAt','updatedAt','TrunkId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmContact','Contacts','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','fax','List','ListId','Send\x20Fax\x20failed','out','filename','ContactId','dataValues','Messages','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x5e12,0x173));var _0x25e1=function(_0x49f1ab,_0x2e925c){_0x49f1ab=_0x49f1ab-0x0;var _0x1b2d97=_0x5e12[_0x49f1ab];return _0x1b2d97;};'use strict';var emlformat=require(_0x25e1('0x0'));var rimraf=require(_0x25e1('0x1'));var zipdir=require(_0x25e1('0x2'));var jsonpatch=require(_0x25e1('0x3'));var rp=require(_0x25e1('0x4'));var moment=require(_0x25e1('0x5'));var BPromise=require(_0x25e1('0x6'));var Mustache=require(_0x25e1('0x7'));var util=require(_0x25e1('0x8'));var path=require(_0x25e1('0x9'));var sox=require(_0x25e1('0xa'));var csv=require('to-csv');var ejs=require(_0x25e1('0xb'));var fs=require('fs');var fs_extra=require(_0x25e1('0xc'));var _=require(_0x25e1('0xd'));var squel=require(_0x25e1('0xe'));var crypto=require(_0x25e1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25e1('0x10'));var Papa=require(_0x25e1('0x11'));var Redis=require(_0x25e1('0x12'));var authService=require(_0x25e1('0x13'));var qs=require(_0x25e1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25e1('0x15'));var logger=require(_0x25e1('0x16'))(_0x25e1('0x17'));var utils=require(_0x25e1('0x18'));var config=require(_0x25e1('0x19'));var licenseUtil=require(_0x25e1('0x1a'));var db=require(_0x25e1('0x1b'))['db'];config[_0x25e1('0x1c')]=_[_0x25e1('0x1d')](config[_0x25e1('0x1c')],{'host':_0x25e1('0x1e'),'port':0x18eb});var socket=require(_0x25e1('0x1f'))(new Redis(config[_0x25e1('0x1c')]));require(_0x25e1('0x20'))[_0x25e1('0x21')](socket);var jayson=require(_0x25e1('0x22'));var client=jayson['client'][_0x25e1('0x23')]({'port':0x232c});var client9002=jayson[_0x25e1('0x24')][_0x25e1('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x40b6ef,_0x3cfa65,_0x400041,_0xf01e2f){return new BPromise(function(_0xcc7ae1,_0x4a3136){var _0x44d85f=_0xf01e2f||client;return _0x44d85f[_0x25e1('0x25')](_0x40b6ef,_0x400041)['then'](function(_0x478a74){logger[_0x25e1('0x26')](_0x25e1('0x27'),_0x3cfa65,_0x25e1('0x28'));logger[_0x25e1('0x29')](_0x25e1('0x2a'),_0x3cfa65,_0x25e1('0x28'),JSON['stringify'](_0x478a74));if(_0x478a74[_0x25e1('0x2b')]){if(_0x478a74[_0x25e1('0x2b')][_0x25e1('0x2c')]===0x1f4){logger[_0x25e1('0x2b')](_0x25e1('0x27'),_0x3cfa65,_0x478a74[_0x25e1('0x2b')][_0x25e1('0x2d')]);return _0x4a3136(_0x478a74[_0x25e1('0x2b')]['message']);}logger['error'](_0x25e1('0x27'),_0x3cfa65,_0x478a74[_0x25e1('0x2b')][_0x25e1('0x2d')]);return _0xcc7ae1(_0x478a74[_0x25e1('0x2b')][_0x25e1('0x2d')]);}else{logger['info'](_0x25e1('0x27'),_0x3cfa65,_0x25e1('0x28'));_0xcc7ae1(_0x478a74[_0x25e1('0x2e')]['message']);}})[_0x25e1('0x2f')](function(_0x3c0e05){logger['error'](_0x25e1('0x27'),_0x3cfa65,_0x3c0e05);_0x4a3136(_0x3c0e05);});});}function respondWithStatusCode(_0x40a213,_0x57ff4f){_0x57ff4f=_0x57ff4f||0xcc;return function(_0x3e3c23){if(_0x3e3c23){return _0x40a213['sendStatus'](_0x57ff4f);}return _0x40a213['status'](_0x57ff4f)['end']();};}function respondWithResult(_0x1ec349,_0x200d6c){_0x200d6c=_0x200d6c||0xc8;return function(_0x25bef5){if(_0x25bef5){return _0x1ec349[_0x25e1('0x30')](_0x200d6c)[_0x25e1('0x31')](_0x25bef5);}};}function respondWithFilteredResult(_0x5645df,_0xd4b143){return function(_0x3e3ed6){if(_0x3e3ed6){var _0xe25bed=typeof _0xd4b143[_0x25e1('0x32')]===_0x25e1('0x33')&&typeof _0xd4b143[_0x25e1('0x34')]===_0x25e1('0x33');var _0x1230a4=_0x3e3ed6[_0x25e1('0x35')];var _0x3b8b43=_0xe25bed?0x0:_0xd4b143[_0x25e1('0x32')];var _0x4d6acc=_0xe25bed?_0x3e3ed6[_0x25e1('0x35')]:_0xd4b143[_0x25e1('0x32')]+_0xd4b143[_0x25e1('0x34')];var _0x3c2326;if(_0x4d6acc>=_0x1230a4){_0x4d6acc=_0x1230a4;_0x3c2326=0xc8;}else{_0x3c2326=0xce;}_0x5645df[_0x25e1('0x30')](_0x3c2326);return _0x5645df[_0x25e1('0x36')](_0x25e1('0x37'),_0x3b8b43+'-'+_0x4d6acc+'/'+_0x1230a4)[_0x25e1('0x31')](_0x3e3ed6);}return null;};}function patchUpdates(_0x10b1f5){return function(_0x12d5ca){try{jsonpatch['apply'](_0x12d5ca,_0x10b1f5,!![]);}catch(_0xc4c8c3){return BPromise[_0x25e1('0x38')](_0xc4c8c3);}return _0x12d5ca['save']();};}function saveUpdates(_0x2f94f0,_0x509a79){return function(_0x475b56){if(_0x475b56){return _0x475b56[_0x25e1('0x39')](_0x2f94f0)['then'](function(_0x201806){return _0x201806;});}return null;};}function removeEntity(_0x547771,_0x44d681){return function(_0x316328){if(_0x316328){return _0x316328[_0x25e1('0x3a')]()[_0x25e1('0x3b')](function(){var _0x3d39b3=_0x316328[_0x25e1('0x3c')]({'plain':!![]});var _0x487868='FaxAccounts';return db[_0x25e1('0x3d')]['destroy']({'where':{'type':_0x487868,'resourceId':_0x3d39b3['id']}})[_0x25e1('0x3b')](function(){return _0x316328;});})[_0x25e1('0x3b')](function(){_0x547771[_0x25e1('0x30')](0xcc)[_0x25e1('0x3e')]();});}};}function handleEntityNotFound(_0x5b3e8d,_0x5e2f1d){return function(_0x1f6050){if(!_0x1f6050){_0x5b3e8d[_0x25e1('0x3f')](0x194);}return _0x1f6050;};}function handleError(_0x8c1452,_0xec57bf){_0xec57bf=_0xec57bf||0x1f4;return function(_0x3a381c){logger['error'](_0x3a381c[_0x25e1('0x40')]);if(_0x3a381c['name']){delete _0x3a381c[_0x25e1('0x41')];}_0x8c1452[_0x25e1('0x30')](_0xec57bf)[_0x25e1('0x42')](_0x3a381c);};}exports[_0x25e1('0x43')]=function(_0x5ac689,_0x4e4413){var _0x492989={'include':[{'model':db[_0x25e1('0x44')],'as':_0x25e1('0x45')}]},_0x36d44a={},_0x488ef9={'count':0x0,'rows':[]};var _0x41d561=_[_0x25e1('0x46')](db[_0x25e1('0x47')][_0x25e1('0x48')],function(_0x48b4f8){return{'name':_0x48b4f8[_0x25e1('0x49')],'type':_0x48b4f8[_0x25e1('0x4a')]['key']};});_0x36d44a['model']=_[_0x25e1('0x46')](_0x41d561,_0x25e1('0x41'));_0x36d44a[_0x25e1('0x4b')]=_[_0x25e1('0x4c')](_0x5ac689['query']);_0x36d44a[_0x25e1('0x4d')]=_[_0x25e1('0x4e')](_0x36d44a[_0x25e1('0x4f')],_0x36d44a['query']);_0x492989[_0x25e1('0x50')]=_[_0x25e1('0x4e')](_0x36d44a[_0x25e1('0x4f')],qs[_0x25e1('0x51')](_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x492989[_0x25e1('0x50')]=_0x492989[_0x25e1('0x50')][_0x25e1('0x52')]?_0x492989[_0x25e1('0x50')]:_0x36d44a[_0x25e1('0x4f')];if(!_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x53')](_0x25e1('0x54'))){_0x492989[_0x25e1('0x34')]=qs['limit'](_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x34')]);_0x492989[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x32')]);}_0x492989['order']=qs['sort'](_0x5ac689[_0x25e1('0x4b')]['sort']);_0x492989[_0x25e1('0x55')]=qs['filters'](_[_0x25e1('0x56')](_0x5ac689[_0x25e1('0x4b')],_0x36d44a[_0x25e1('0x4d')]),_0x41d561);if(_0x5ac689[_0x25e1('0x4b')]['filter']){_0x492989['where']=_[_0x25e1('0x57')](_0x492989[_0x25e1('0x55')],{'$or':_['map'](_0x41d561,function(_0x3935bc){if(_0x3935bc['type']!==_0x25e1('0x58')){var _0x562524={};_0x562524[_0x3935bc['name']]={'$like':'%'+_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x59')]+'%'};return _0x562524;}})});}_0x492989=_[_0x25e1('0x57')]({},_0x492989,_0x5ac689[_0x25e1('0x5a')]);var _0x41d55a={'where':_0x492989[_0x25e1('0x55')]};return db['FaxAccount']['count'](_0x41d55a)[_0x25e1('0x3b')](function(_0x2e8bb5){_0x488ef9[_0x25e1('0x35')]=_0x2e8bb5;if(_0x5ac689[_0x25e1('0x4b')][_0x25e1('0x5b')]){_0x492989[_0x25e1('0x5c')]=[{'all':!![]}];}return db[_0x25e1('0x47')][_0x25e1('0x5d')](_0x492989);})[_0x25e1('0x3b')](function(_0x30b181){_0x488ef9[_0x25e1('0x5e')]=_0x30b181;return _0x488ef9;})[_0x25e1('0x3b')](respondWithFilteredResult(_0x4e4413,_0x492989))[_0x25e1('0x2f')](handleError(_0x4e4413,null));};exports[_0x25e1('0x5f')]=function(_0x34708e,_0x20c714){var _0x5e52d5={'raw':![],'where':{'id':_0x34708e[_0x25e1('0x60')]['id']},'include':[{'model':db[_0x25e1('0x44')],'as':_0x25e1('0x45')}]},_0x1b7c61={};_0x1b7c61[_0x25e1('0x4f')]=_['keys'](db['FaxAccount'][_0x25e1('0x48')]);_0x1b7c61[_0x25e1('0x4b')]=_[_0x25e1('0x4c')](_0x34708e[_0x25e1('0x4b')]);_0x1b7c61[_0x25e1('0x4d')]=_[_0x25e1('0x4e')](_0x1b7c61[_0x25e1('0x4f')],_0x1b7c61['query']);_0x5e52d5[_0x25e1('0x50')]=_[_0x25e1('0x4e')](_0x1b7c61[_0x25e1('0x4f')],qs['fields'](_0x34708e['query'][_0x25e1('0x51')]));_0x5e52d5['attributes']=_0x5e52d5['attributes'][_0x25e1('0x52')]?_0x5e52d5['attributes']:_0x1b7c61['model'];if(_0x34708e[_0x25e1('0x4b')][_0x25e1('0x5b')]){_0x5e52d5['include']=[{'all':!![]}];}_0x5e52d5=_[_0x25e1('0x57')]({},_0x5e52d5,_0x34708e[_0x25e1('0x5a')]);return db[_0x25e1('0x47')][_0x25e1('0x61')](_0x5e52d5)[_0x25e1('0x3b')](handleEntityNotFound(_0x20c714,null))[_0x25e1('0x3b')](respondWithResult(_0x20c714,null))['catch'](handleError(_0x20c714,null));};exports['create']=function(_0xcb2450,_0x4cd1c1){return db['FaxAccount'][_0x25e1('0x62')](_0xcb2450['body'],{})[_0x25e1('0x3b')](function(_0x2bdd32){var _0x231b77=_0xcb2450[_0x25e1('0x63')][_0x25e1('0x3c')]({'plain':!![]});if(!_0x231b77)throw new Error(_0x25e1('0x64'));if(_0x231b77[_0x25e1('0x65')]===_0x25e1('0x63')){var _0x38ff19=_0x2bdd32[_0x25e1('0x3c')]({'plain':!![]});var _0x4ac9fc=_0x25e1('0x66');return db['UserProfileSection'][_0x25e1('0x61')]({'where':{'name':_0x4ac9fc,'userProfileId':_0x231b77['userProfileId']},'raw':!![]})[_0x25e1('0x3b')](function(_0x4f099f){if(_0x4f099f&&_0x4f099f[_0x25e1('0x67')]===0x0){return db[_0x25e1('0x3d')][_0x25e1('0x62')]({'name':_0x38ff19[_0x25e1('0x41')],'resourceId':_0x38ff19['id'],'type':_0x4f099f[_0x25e1('0x41')],'sectionId':_0x4f099f['id']},{})[_0x25e1('0x3b')](function(){return _0x2bdd32;});}else{return _0x2bdd32;}})[_0x25e1('0x2f')](function(_0x9f62dd){logger['error'](_0x25e1('0x68'),_0x9f62dd);throw _0x9f62dd;});}return _0x2bdd32;})[_0x25e1('0x3b')](respondWithResult(_0x4cd1c1,0xc9))['catch'](handleError(_0x4cd1c1,null));};exports[_0x25e1('0x39')]=function(_0xc9a5ab,_0x5400c9){if(_0xc9a5ab['body']['id']){delete _0xc9a5ab['body']['id'];}return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0xc9a5ab[_0x25e1('0x60')]['id']},'include':[{'model':db[_0x25e1('0x44')],'as':_0x25e1('0x45')}]})['then'](handleEntityNotFound(_0x5400c9,null))[_0x25e1('0x3b')](saveUpdates(_0xc9a5ab[_0x25e1('0x69')],null))[_0x25e1('0x3b')](respondWithResult(_0x5400c9,null))[_0x25e1('0x2f')](handleError(_0x5400c9,null));};exports[_0x25e1('0x3a')]=function(_0x5ba35b,_0x21d339){return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0x5ba35b['params']['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x21d339,null))['then'](removeEntity(_0x21d339,null))['catch'](handleError(_0x21d339,null));};exports['describe']=function(_0x342aa8,_0x39fb42){return db['FaxAccount'][_0x25e1('0x6a')]()[_0x25e1('0x3b')](respondWithResult(_0x39fb42,null))[_0x25e1('0x2f')](handleError(_0x39fb42,null));};exports['addDisposition']=function(_0x39db6d,_0x58d323,_0x5f4eae){if(_0x39db6d[_0x25e1('0x69')]['id']){delete _0x39db6d[_0x25e1('0x69')]['id'];}return db[_0x25e1('0x47')]['find']({'where':{'id':_0x39db6d[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x58d323,null))[_0x25e1('0x3b')](function(_0x2bddef){if(_0x2bddef){_0x39db6d[_0x25e1('0x69')][_0x25e1('0x6b')]=_0x2bddef['id'];return db[_0x25e1('0x6c')]['create'](_0x39db6d['body']);}})['then'](respondWithResult(_0x58d323,null))[_0x25e1('0x2f')](handleError(_0x58d323,null));};exports[_0x25e1('0x6d')]=function(_0x1fd33b,_0x3cc99b,_0x5de520){var _0x247c0d={'raw':![],'where':{}};var _0x5cef35={};var _0x22e702={'count':0x0,'rows':[]};return db['FaxAccount'][_0x25e1('0x6e')]({'where':{'id':_0x1fd33b[_0x25e1('0x60')]['id']}})['then'](handleEntityNotFound(_0x3cc99b,null))['then'](function(_0x70ff40){if(_0x70ff40){_0x5cef35[_0x25e1('0x4f')]=_['keys'](db['Disposition'][_0x25e1('0x48')]);_0x5cef35[_0x25e1('0x4b')]=_[_0x25e1('0x4c')](_0x1fd33b[_0x25e1('0x4b')]);_0x5cef35['filters']=_[_0x25e1('0x4e')](_0x5cef35['model'],_0x5cef35[_0x25e1('0x4b')]);_0x247c0d['attributes']=_['intersection'](_0x5cef35[_0x25e1('0x4f')],qs[_0x25e1('0x51')](_0x1fd33b[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x247c0d[_0x25e1('0x50')]=_0x247c0d['attributes']['length']?_0x247c0d['attributes']:_0x5cef35['model'];if(!_0x1fd33b[_0x25e1('0x4b')][_0x25e1('0x53')](_0x25e1('0x54'))){_0x247c0d[_0x25e1('0x34')]=qs[_0x25e1('0x34')](_0x1fd33b['query'][_0x25e1('0x34')]);_0x247c0d['offset']=qs[_0x25e1('0x32')](_0x1fd33b[_0x25e1('0x4b')]['offset']);}_0x247c0d[_0x25e1('0x6f')]=qs[_0x25e1('0x70')](_0x1fd33b[_0x25e1('0x4b')][_0x25e1('0x70')]);_0x247c0d['where']=qs['filters'](_['pick'](_0x1fd33b[_0x25e1('0x4b')],_0x5cef35[_0x25e1('0x4d')]));_0x247c0d['where'][_0x25e1('0x6b')]=_0x70ff40['id'];if(_0x1fd33b[_0x25e1('0x4b')]['filter']){_0x247c0d['where']=_[_0x25e1('0x57')](_0x247c0d[_0x25e1('0x55')],{'$or':_[_0x25e1('0x46')](_0x247c0d[_0x25e1('0x50')],function(_0xb31901){var _0x470965={};_0x470965[_0xb31901]={'$like':'%'+_0x1fd33b['query']['filter']+'%'};return _0x470965;})});}_0x247c0d=_['merge']({},_0x247c0d,_0x1fd33b[_0x25e1('0x5a')]);return db[_0x25e1('0x6c')]['count']({'where':_0x247c0d['where']})[_0x25e1('0x3b')](function(_0x4d85a7){_0x22e702['count']=_0x4d85a7;if(_0x1fd33b[_0x25e1('0x4b')]['includeAll']){_0x247c0d['include']=[{'all':!![]}];}return db['Disposition'][_0x25e1('0x5d')](_0x247c0d);})[_0x25e1('0x3b')](function(_0x59598a){_0x22e702[_0x25e1('0x5e')]=_0x59598a;return _0x22e702;});}})[_0x25e1('0x3b')](respondWithFilteredResult(_0x3cc99b,_0x247c0d))['catch'](handleError(_0x3cc99b,null));};exports[_0x25e1('0x71')]=function(_0x4fd48f,_0x365e7d,_0x3c3e0e){return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0x4fd48f[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x365e7d,null))[_0x25e1('0x3b')](function(_0x26109b){if(_0x26109b){return _0x26109b[_0x25e1('0x71')](_0x4fd48f[_0x25e1('0x4b')][_0x25e1('0x72')]);}})[_0x25e1('0x3b')](respondWithStatusCode(_0x365e7d,null))[_0x25e1('0x2f')](handleError(_0x365e7d,null));};exports[_0x25e1('0x73')]=function(_0x2f5517,_0x1df684,_0x1a8165){if(_0x2f5517[_0x25e1('0x69')]['id']){delete _0x2f5517[_0x25e1('0x69')]['id'];}return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0x2f5517['params']['id']}})['then'](handleEntityNotFound(_0x1df684,null))['then'](function(_0x390e7b){if(_0x390e7b){_0x2f5517[_0x25e1('0x69')][_0x25e1('0x6b')]=_0x390e7b['id'];return db['CannedAnswer'][_0x25e1('0x62')](_0x2f5517[_0x25e1('0x69')]);}})[_0x25e1('0x3b')](respondWithResult(_0x1df684,null))['catch'](handleError(_0x1df684,null));};exports[_0x25e1('0x74')]=function(_0x1b49a1,_0x3bafea,_0xff6a36){var _0xa225d4={'raw':![],'where':{}};var _0x14784a={};var _0x57f5c3={'count':0x0,'rows':[]};return db['FaxAccount'][_0x25e1('0x6e')]({'where':{'id':_0x1b49a1[_0x25e1('0x60')]['id']}})['then'](handleEntityNotFound(_0x3bafea,null))[_0x25e1('0x3b')](function(_0x127494){if(_0x127494){_0x14784a[_0x25e1('0x4f')]=_[_0x25e1('0x4c')](db[_0x25e1('0x75')][_0x25e1('0x48')]);_0x14784a[_0x25e1('0x4b')]=_[_0x25e1('0x4c')](_0x1b49a1[_0x25e1('0x4b')]);_0x14784a[_0x25e1('0x4d')]=_[_0x25e1('0x4e')](_0x14784a[_0x25e1('0x4f')],_0x14784a[_0x25e1('0x4b')]);_0xa225d4[_0x25e1('0x50')]=_[_0x25e1('0x4e')](_0x14784a['model'],qs[_0x25e1('0x51')](_0x1b49a1[_0x25e1('0x4b')][_0x25e1('0x51')]));_0xa225d4[_0x25e1('0x50')]=_0xa225d4['attributes']['length']?_0xa225d4['attributes']:_0x14784a['model'];if(!_0x1b49a1[_0x25e1('0x4b')]['hasOwnProperty'](_0x25e1('0x54'))){_0xa225d4[_0x25e1('0x34')]=qs[_0x25e1('0x34')](_0x1b49a1[_0x25e1('0x4b')]['limit']);_0xa225d4[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x1b49a1['query'][_0x25e1('0x32')]);}_0xa225d4[_0x25e1('0x6f')]=qs[_0x25e1('0x70')](_0x1b49a1[_0x25e1('0x4b')]['sort']);_0xa225d4[_0x25e1('0x55')]=qs[_0x25e1('0x4d')](_[_0x25e1('0x56')](_0x1b49a1[_0x25e1('0x4b')],_0x14784a['filters']));_0xa225d4[_0x25e1('0x55')][_0x25e1('0x6b')]=_0x127494['id'];if(_0x1b49a1[_0x25e1('0x4b')]['filter']){_0xa225d4[_0x25e1('0x55')]=_[_0x25e1('0x57')](_0xa225d4[_0x25e1('0x55')],{'$or':_[_0x25e1('0x46')](_0xa225d4[_0x25e1('0x50')],function(_0x3f50c2){var _0x18f79b={};_0x18f79b[_0x3f50c2]={'$like':'%'+_0x1b49a1[_0x25e1('0x4b')][_0x25e1('0x59')]+'%'};return _0x18f79b;})});}_0xa225d4=_[_0x25e1('0x57')]({},_0xa225d4,_0x1b49a1[_0x25e1('0x5a')]);return db[_0x25e1('0x75')][_0x25e1('0x35')]({'where':_0xa225d4['where']})[_0x25e1('0x3b')](function(_0x47dbd5){_0x57f5c3[_0x25e1('0x35')]=_0x47dbd5;if(_0x1b49a1[_0x25e1('0x4b')][_0x25e1('0x5b')]){_0xa225d4[_0x25e1('0x5c')]=[{'all':!![]}];}return db[_0x25e1('0x75')][_0x25e1('0x5d')](_0xa225d4);})[_0x25e1('0x3b')](function(_0x859b7a){_0x57f5c3[_0x25e1('0x5e')]=_0x859b7a;return _0x57f5c3;});}})[_0x25e1('0x3b')](respondWithFilteredResult(_0x3bafea,_0xa225d4))[_0x25e1('0x2f')](handleError(_0x3bafea,null));};exports[_0x25e1('0x76')]=function(_0x33d57c,_0x4817ad,_0x58cb62){return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0x33d57c[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x4817ad,null))[_0x25e1('0x3b')](function(_0x2d9ccf){if(_0x2d9ccf){return _0x2d9ccf[_0x25e1('0x76')](_0x33d57c[_0x25e1('0x4b')][_0x25e1('0x72')]);}})[_0x25e1('0x3b')](respondWithStatusCode(_0x4817ad,null))[_0x25e1('0x2f')](handleError(_0x4817ad,null));};exports[_0x25e1('0x77')]=function(_0x17710c,_0x346554,_0x176210){return db['FaxInteraction']['find']({'where':{'id':_0x17710c[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x346554,null))[_0x25e1('0x3b')](function(_0x4793fd){if(_0x4793fd){return _0x4793fd[_0x25e1('0x77')](_0x17710c[_0x25e1('0x69')][_0x25e1('0x72')],_['omit'](_0x17710c['body'],[_0x25e1('0x72'),'id'])||{});}})[_0x25e1('0x3b')](respondWithResult(_0x346554,null))['catch'](handleError(_0x346554,null));};exports[_0x25e1('0x78')]=function(_0x504fb8,_0x3c7dc8,_0x440627){var _0x4982ce={'raw':![],'where':{}};var _0x5b56df={};var _0x15f750={'count':0x0,'rows':[]};return db[_0x25e1('0x47')][_0x25e1('0x6e')]({'where':{'id':_0x504fb8['params']['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x3c7dc8,null))[_0x25e1('0x3b')](function(_0x17dc9f){if(_0x17dc9f){_0x5b56df[_0x25e1('0x4f')]=_[_0x25e1('0x4c')](db[_0x25e1('0x79')]['rawAttributes']);_0x5b56df['query']=_['keys'](_0x504fb8[_0x25e1('0x4b')]);_0x5b56df[_0x25e1('0x4d')]=_[_0x25e1('0x4e')](_0x5b56df[_0x25e1('0x4f')],_0x5b56df[_0x25e1('0x4b')]);_0x4982ce['attributes']=_[_0x25e1('0x4e')](_0x5b56df[_0x25e1('0x4f')],qs[_0x25e1('0x51')](_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x4982ce[_0x25e1('0x50')]=_0x4982ce[_0x25e1('0x50')]['length']?_0x4982ce[_0x25e1('0x50')]:_0x5b56df[_0x25e1('0x4f')];if(!_0x504fb8['query'][_0x25e1('0x53')]('nolimit')){_0x4982ce[_0x25e1('0x34')]=qs[_0x25e1('0x34')](_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x34')]);_0x4982ce[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x32')]);}_0x4982ce[_0x25e1('0x6f')]=qs[_0x25e1('0x70')](_0x504fb8[_0x25e1('0x4b')]['sort']);_0x4982ce['where']=qs['filters'](_[_0x25e1('0x56')](_0x504fb8[_0x25e1('0x4b')],_0x5b56df[_0x25e1('0x4d')]));_0x4982ce[_0x25e1('0x55')][_0x25e1('0x6b')]=_0x17dc9f['id'];if(_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x59')]){_0x4982ce[_0x25e1('0x55')]=_['merge'](_0x4982ce[_0x25e1('0x55')],{'$or':_[_0x25e1('0x46')](_0x4982ce[_0x25e1('0x50')],function(_0x5ce275){var _0x5aac65={};_0x5aac65[_0x5ce275]={'$like':'%'+_0x504fb8[_0x25e1('0x4b')]['filter']+'%'};return _0x5aac65;})});}_0x4982ce=_['merge']({},_0x4982ce,_0x504fb8[_0x25e1('0x5a')]);return db['FaxInteraction'][_0x25e1('0x35')]({'where':_0x4982ce['where']})[_0x25e1('0x3b')](function(_0xa9afae){_0x15f750[_0x25e1('0x35')]=_0xa9afae;if(_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x5b')]){_0x4982ce[_0x25e1('0x5c')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x25e1('0x7a'),'attributes':['name',_0x25e1('0x7b'),_0x25e1('0x7c')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x25e1('0x41'),_0x25e1('0x7d')],'where':_0x504fb8[_0x25e1('0x4b')]['tag']?{'id':_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x7e')]}:undefined,'required':_0x504fb8[_0x25e1('0x4b')][_0x25e1('0x7e')]?!![]:![]}];}return db[_0x25e1('0x79')][_0x25e1('0x5d')](_0x4982ce);})[_0x25e1('0x3b')](function(_0x5664b8){_0x15f750['rows']=_0x5664b8;return _0x15f750;});}})[_0x25e1('0x3b')](respondWithFilteredResult(_0x3c7dc8,_0x4982ce))[_0x25e1('0x2f')](handleError(_0x3c7dc8,null));};exports[_0x25e1('0x7f')]=function(_0x49182f,_0x3788d0){var _0x50554d=_0x49182f[_0x25e1('0x60')]['id'];var _0xab33f8=_0x49182f['body'];var _0x33744b=0xc8;var _0x12afa2=null;return db[_0x25e1('0x80')]['transaction']({'isolationLevel':db[_0x25e1('0x80')][_0x25e1('0x81')]['ISOLATION_LEVELS'][_0x25e1('0x82')]},function(_0x3c2949){return db[_0x25e1('0x47')][_0x25e1('0x6e')]({'where':{'id':_0x50554d},'transaction':_0x3c2949})[_0x25e1('0x3b')](function(_0x320658){if(_0x320658){return db[_0x25e1('0x83')]['destroy']({'where':{'FaxAccountId':_0x50554d},'transaction':_0x3c2949})[_0x25e1('0x3b')](function(){var _0xbad1a8=_[_0x25e1('0x46')](_0xab33f8,function(_0x5cbf7d){_0x5cbf7d['FaxAccountId']=_0x50554d;return _0x5cbf7d;});return db[_0x25e1('0x83')][_0x25e1('0x84')](_0xbad1a8,{'transaction':_0x3c2949});});}else{_0x33744b=0x194;_0x12afa2=[];}});})[_0x25e1('0x3b')](function(){if(_0x33744b!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x50554d},'order':_0x25e1('0x85')})[_0x25e1('0x3b')](function(_0x21bb5d){_0x12afa2=_0x21bb5d;});}})[_0x25e1('0x2f')](function(_0x2d9c8f){_0x33744b=0x1f4;logger[_0x25e1('0x2b')](_0x2d9c8f['stack']);if(_0x2d9c8f[_0x25e1('0x41')]){delete _0x2d9c8f[_0x25e1('0x41')];}_0x12afa2=_0x2d9c8f;})[_0x25e1('0x86')](function(){if(_0x12afa2===null){_0x3788d0[_0x25e1('0x3f')](_0x33744b);}else{if(_0x33744b===0x1f4){_0x3788d0[_0x25e1('0x30')](_0x33744b)[_0x25e1('0x42')](_0x12afa2);}else{_0x3788d0[_0x25e1('0x30')](_0x33744b)[_0x25e1('0x31')](_0x12afa2);}}});};exports[_0x25e1('0x87')]=function(_0x54d1bd,_0x4cd812,_0x3fef63){var _0x3db9ae={};var _0x28468c={};var _0x32c04b;var _0x460d76;return db[_0x25e1('0x47')]['findOne']({'where':{'id':_0x54d1bd['params']['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x4cd812,null))['then'](function(_0x233f2b){if(_0x233f2b){_0x32c04b=_0x233f2b;_0x28468c[_0x25e1('0x4f')]=_['keys'](db[_0x25e1('0x83')][_0x25e1('0x48')]);_0x28468c['query']=_[_0x25e1('0x4c')](_0x54d1bd[_0x25e1('0x4b')]);_0x28468c['filters']=_[_0x25e1('0x4e')](_0x28468c['model'],_0x28468c[_0x25e1('0x4b')]);_0x3db9ae['attributes']=_[_0x25e1('0x4e')](_0x28468c[_0x25e1('0x4f')],qs[_0x25e1('0x51')](_0x54d1bd[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x3db9ae[_0x25e1('0x50')]=_0x3db9ae[_0x25e1('0x50')][_0x25e1('0x52')]?_0x3db9ae['attributes']:_0x28468c[_0x25e1('0x4f')];_0x3db9ae[_0x25e1('0x6f')]=qs[_0x25e1('0x70')](_0x54d1bd['query'][_0x25e1('0x70')]);_0x3db9ae[_0x25e1('0x55')]=qs[_0x25e1('0x4d')](_['pick'](_0x54d1bd['query'],_0x28468c[_0x25e1('0x4d')]));if(_0x54d1bd[_0x25e1('0x4b')][_0x25e1('0x59')]){_0x3db9ae[_0x25e1('0x55')]=_[_0x25e1('0x57')](_0x3db9ae[_0x25e1('0x55')],{'$or':_['map'](_0x3db9ae['attributes'],function(_0x38bef9){var _0x596f75={};_0x596f75[_0x38bef9]={'$like':'%'+_0x54d1bd[_0x25e1('0x4b')]['filter']+'%'};return _0x596f75;})});}_0x3db9ae=_['merge']({},_0x3db9ae,_0x54d1bd[_0x25e1('0x5a')]);return _0x32c04b[_0x25e1('0x87')](_0x3db9ae);}})[_0x25e1('0x3b')](function(_0x1325f0){if(_0x1325f0){_0x460d76=_0x1325f0[_0x25e1('0x52')];if(!_0x54d1bd[_0x25e1('0x4b')][_0x25e1('0x53')]('nolimit')){_0x3db9ae['limit']=qs[_0x25e1('0x34')](_0x54d1bd[_0x25e1('0x4b')][_0x25e1('0x34')]);_0x3db9ae[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x54d1bd[_0x25e1('0x4b')]['offset']);}return _0x32c04b[_0x25e1('0x87')](_0x3db9ae);}})['then'](function(_0xf1362d){if(_0xf1362d){return _0xf1362d?{'count':_0x460d76,'rows':_0xf1362d}:null;}})[_0x25e1('0x3b')](respondWithResult(_0x4cd812,null))[_0x25e1('0x2f')](handleError(_0x4cd812,null));};function Extension(_0x5d0f0e,_0x53fbe6,_0x25d18b,_0x139fd1){this[_0x25e1('0x88')]=_0x25e1('0x89');this[_0x25e1('0x8a')]=_0x5d0f0e[_0x25e1('0x8b')];this['app']=_0x139fd1;this[_0x25e1('0x4a')]=_0x25e1('0x8c');this['description']='Fax\x20Extension';this['FaxAccountId']=_0x5d0f0e['id'];this['priority']=_0x53fbe6;this[_0x25e1('0x8d')]=_0x25d18b;}function createExtensionsReciveFax(_0x5da03d){var _0x208418=0x1;var _0x1c3c5b=[];_0x1c3c5b[_0x25e1('0x8e')](new Extension(_0x5da03d,_0x208418,'',_0x25e1('0x8f')));_0x208418+=0x1;_0x1c3c5b[_0x25e1('0x8e')](new Extension(_0x5da03d,_0x208418,_0x25e1('0x90'),'Set'));_0x208418+=0x1;for(var _0x4d3b52 in _0x5da03d){if(_0x5da03d[_0x25e1('0x53')](_0x4d3b52)&&(_0x4d3b52==='ecm'||_0x4d3b52===_0x25e1('0x8b')||_0x4d3b52===_0x25e1('0x91')||_0x4d3b52===_0x25e1('0x92')||_0x4d3b52==='headerinfo'||_0x4d3b52===_0x25e1('0x93')||_0x4d3b52===_0x25e1('0x94')||_0x4d3b52===_0x25e1('0x95')||_0x4d3b52==='t38timeout')){_0x1c3c5b[_0x25e1('0x8e')](new Extension(_0x5da03d,_0x208418,_0x25e1('0x96')+_0x4d3b52+')='+_0x5da03d[_0x4d3b52],_0x25e1('0x97')));_0x208418+=0x1;}}_0x1c3c5b[_0x25e1('0x8e')](new Extension(_0x5da03d,_0x208418,'6',_0x25e1('0x98')));_0x208418+=0x1;_0x1c3c5b[_0x25e1('0x8e')](new Extension(_0x5da03d,_0x208418,_0x25e1('0x99'),_0x25e1('0x9a')));_0x208418=0x0;return _0x1c3c5b;}exports[_0x25e1('0x9b')]=function(_0x2aa7b2,_0x42d8fb,_0x2e3e0d){var _0x5b26ee;return db[_0x25e1('0x80')][_0x25e1('0x9c')](function(_0x291abe){return db[_0x25e1('0x47')][_0x25e1('0x62')](_0x2aa7b2[_0x25e1('0x69')],{'transaction':_0x291abe})[_0x25e1('0x3b')](function(_0x87c7c3){_0x5b26ee=_0x87c7c3[_0x25e1('0x3c')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x5b26ee),{'transaction':_0x291abe});});})[_0x25e1('0x3b')](function(){return _0x5b26ee;})[_0x25e1('0x3b')](respondWithResult(_0x42d8fb,null))[_0x25e1('0x2f')](handleError(_0x42d8fb,null));};exports[_0x25e1('0x9d')]=function(_0x2103db,_0x620c50,_0x4234f1){var _0x2a60e0;return db[_0x25e1('0x80')][_0x25e1('0x9c')](function(_0x2d0a52){return db[_0x25e1('0x47')][_0x25e1('0x39')](_0x2103db[_0x25e1('0x69')],{'where':{'id':_0x2103db[_0x25e1('0x69')]['id']},'transaction':_0x2d0a52})[_0x25e1('0x3b')](function(_0x3c947d){return db[_0x25e1('0x9e')]['destroy']({'where':{'FaxAccountId':_0x2103db[_0x25e1('0x69')]['id']},'transaction':_0x2d0a52})[_0x25e1('0x3b')](function(_0x206bf9){return db[_0x25e1('0x9e')][_0x25e1('0x84')](createExtensionsReciveFax(_[_0x25e1('0x9f')](_0x2103db[_0x25e1('0x69')],[_0x25e1('0xa0'),_0x25e1('0xa1'),_0x25e1('0xa2'),_0x25e1('0xa3'),_0x25e1('0xa4'),'ListId'])),{'transaction':_0x2d0a52});});});})['then'](function(){return db[_0x25e1('0x47')][_0x25e1('0xa5')](_0x2103db[_0x25e1('0x69')]['id']);})[_0x25e1('0x3b')](respondWithResult(_0x620c50,null))['catch'](handleError(_0x620c50,null));};exports[_0x25e1('0xa6')]=function(_0x441f2d,_0x4b4b13,_0x357247){var _0x1f6848={'raw':!![],'where':{}};var _0x12f5ec={};var _0x5ce04f={'count':0x0,'rows':[]};return db[_0x25e1('0x47')][_0x25e1('0x6e')]({'where':{'id':_0x441f2d[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x4b4b13,null))[_0x25e1('0x3b')](function(_0x4f3654){if(_0x4f3654){_0x12f5ec['model']=_[_0x25e1('0x4c')](db['FaxMessage'][_0x25e1('0x48')]);_0x12f5ec['query']=_[_0x25e1('0x4c')](_0x441f2d[_0x25e1('0x4b')]);_0x12f5ec[_0x25e1('0x4d')]=_[_0x25e1('0x4e')](_0x12f5ec[_0x25e1('0x4f')],_0x12f5ec[_0x25e1('0x4b')]);_0x1f6848[_0x25e1('0x50')]=_[_0x25e1('0x4e')](_0x12f5ec[_0x25e1('0x4f')],qs[_0x25e1('0x51')](_0x441f2d[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x1f6848[_0x25e1('0x50')]=_0x1f6848[_0x25e1('0x50')]['length']?_0x1f6848['attributes']:_0x12f5ec[_0x25e1('0x4f')];if(!_0x441f2d['query']['hasOwnProperty'](_0x25e1('0x54'))){_0x1f6848['limit']=qs[_0x25e1('0x34')](_0x441f2d['query'][_0x25e1('0x34')]);_0x1f6848[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x441f2d[_0x25e1('0x4b')][_0x25e1('0x32')]);}_0x1f6848[_0x25e1('0x6f')]=qs[_0x25e1('0x70')](_0x441f2d[_0x25e1('0x4b')]['sort']);_0x1f6848[_0x25e1('0x55')]=qs[_0x25e1('0x4d')](_[_0x25e1('0x56')](_0x441f2d[_0x25e1('0x4b')],_0x12f5ec[_0x25e1('0x4d')]));_0x1f6848['where'][_0x25e1('0x6b')]=_0x4f3654['id'];if(_0x441f2d['query'][_0x25e1('0x59')]){_0x1f6848[_0x25e1('0x55')]=_['merge'](_0x1f6848[_0x25e1('0x55')],{'$or':_['map'](_0x1f6848['attributes'],function(_0x19c97c){var _0x24e6c5={};_0x24e6c5[_0x19c97c]={'$like':'%'+_0x441f2d[_0x25e1('0x4b')][_0x25e1('0x59')]+'%'};return _0x24e6c5;})});}if(_0x441f2d[_0x25e1('0x4b')][_0x25e1('0xa7')]){var _0x509d39=_0x441f2d[_0x25e1('0x4b')][_0x25e1('0xa7')][_0x25e1('0xa8')](',');var _0xd472ad={};_0xd472ad[_0x509d39[0x0]]={'$gte':moment(_0x509d39[0x1])[_0x25e1('0xa9')](_0x25e1('0xaa'))};_0x1f6848[_0x25e1('0x55')]=_[_0x25e1('0x57')](_0x1f6848[_0x25e1('0x55')],_0xd472ad);}_0x1f6848=_['merge']({},_0x1f6848,_0x441f2d[_0x25e1('0x5a')]);return db[_0x25e1('0xab')][_0x25e1('0x35')]({'where':_0x1f6848['where']})[_0x25e1('0x3b')](function(_0x14d433){_0x5ce04f[_0x25e1('0x35')]=_0x14d433;if(_0x441f2d[_0x25e1('0x4b')]['includeAll']){_0x1f6848[_0x25e1('0x5c')]=[{'all':!![]}];}return db[_0x25e1('0xab')]['findAll'](_0x1f6848);})[_0x25e1('0x3b')](function(_0x585b49){_0x5ce04f[_0x25e1('0x5e')]=_0x585b49;return _0x5ce04f;});}})[_0x25e1('0x3b')](respondWithFilteredResult(_0x4b4b13,_0x1f6848))[_0x25e1('0x2f')](handleError(_0x4b4b13,null));};exports[_0x25e1('0x42')]=function(_0x5a3eb5,_0x23e9cc,_0x4cebf6){var _0x3e5a64,_0x3c5353={},_0x35d9c3;if(_0x5a3eb5[_0x25e1('0x69')]['to']){_0x35d9c3=_0x5a3eb5[_0x25e1('0x69')]['to'][0x0];}return db[_0x25e1('0x47')]['find']({'where':{'id':_0x5a3eb5[_0x25e1('0x60')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x25e1('0xac')],'as':_0x25e1('0xad'),'where':{'fax':_0x35d9c3},'limit':0x1,'order':[[_0x25e1('0xa3'),'DESC']]}]}]})[_0x25e1('0x3b')](handleEntityNotFound(_0x23e9cc,null))['then'](function(_0x50439d){_0x3e5a64=_0x50439d;if(_0x5a3eb5['body'][_0x25e1('0xae')]&&_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][_0x25e1('0x52')]){for(var _0x1da12c=0x0;_0x1da12c<_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][_0x25e1('0x52')];_0x1da12c+=0x1){_0x5a3eb5['body']['attachments'][_0x1da12c]={'filename':_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][_0x1da12c][_0x25e1('0x41')],'id':_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][_0x1da12c]['id'],'path':path[_0x25e1('0xaf')](config[_0x25e1('0xb0')],_0x25e1('0xb1'),_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][_0x1da12c]['basename'])};}}return respondWithRpcPromise(_0x25e1('0xb2'),_0x25e1('0xb2'),{'FaxAccountId':_[_0x25e1('0xb3')](_0x5a3eb5[_0x25e1('0x60')]['id'])?undefined:_0x5a3eb5[_0x25e1('0x60')]['id'],'path':_[_0x25e1('0xb3')](_0x5a3eb5['body'][_0x25e1('0xae')][0x0][_0x25e1('0x9')])?undefined:_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][0x0]['path'],'fax':_[_0x25e1('0xb3')](_0x5a3eb5['body']['to'][0x0])?undefined:_0x5a3eb5['body']['to'][0x0]},client9002);})[_0x25e1('0x3b')](function(){if(_0x3e5a64){if(_[_0x25e1('0xb3')](_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xb4')])){_0x5a3eb5['body'][_0x25e1('0xb4')]=util['format']('\x22%s\x22\x20<%s>',_0x3e5a64[_0x25e1('0x41')],_0x3e5a64[_0x25e1('0xb5')]);}if(_0x3e5a64[_0x25e1('0xb6')]){if(_0x3e5a64['List'][_0x25e1('0xad')][_0x25e1('0x52')]){return _0x3e5a64[_0x25e1('0xb6')]['Contacts'][0x0];}else{return db[_0x25e1('0xac')][_0x25e1('0x62')](_['defaults'](_0x5a3eb5[_0x25e1('0x69')],{'firstName':_0x5a3eb5[_0x25e1('0x69')]['to'][0x0],'phone':_0x5a3eb5[_0x25e1('0x69')]['to'][0x0],'fax':_0x5a3eb5[_0x25e1('0x69')]['to'][0x0],'ListId':_0x3e5a64[_0x25e1('0xb7')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x25e1('0xb8'));}})[_0x25e1('0x3b')](function(_0x3d6f5e){if(_0x3d6f5e){return db[_0x25e1('0x79')][_0x25e1('0x61')]({'where':{'ContactId':_0x3d6f5e['id'],'closed':![],'FaxAccountId':_0x3e5a64['id']}})['then'](function(_0x571332){if(_0x571332){return[_0x571332,![]];}return db['FaxInteraction'][_0x25e1('0x62')]({'UserId':_0x5a3eb5[_0x25e1('0x63')]['id'],'ContactId':_0x3d6f5e['id'],'FaxAccountId':_0x3e5a64['id'],'fax':_0x5a3eb5[_0x25e1('0x69')]['to'][0x0],'firstMsgDirection':_0x25e1('0xb9'),'Messages':[_[_0x25e1('0x57')](_0x5a3eb5[_0x25e1('0x69')],{'read':![],'body':_0x5a3eb5[_0x25e1('0x69')]['attachments'][0x0][_0x25e1('0xba')],'FaxAccountId':_0x3e5a64['id'],'UserId':_0x5a3eb5[_0x25e1('0x63')]['id'],'ContactId':_0x3d6f5e['id'],'AttachmentId':_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][0x0]['id']})]},{'include':[{'model':db[_0x25e1('0xab')],'as':'Messages'}]})[_0x25e1('0x3b')](function(_0x1035fe){return[_0x1035fe,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x5ea95a,_0x17fe3b){if(_0x17fe3b){return _0x5ea95a;}return db[_0x25e1('0xab')][_0x25e1('0x62')]({'direction':_0x25e1('0xb9'),'read':![],'body':_0x5a3eb5['body'][_0x25e1('0xae')][0x0][_0x25e1('0xba')],'FaxAccountId':_0x3e5a64['id'],'FaxInteractionId':_0x5ea95a['id'],'UserId':_0x5a3eb5[_0x25e1('0x63')]['id'],'ContactId':_0x5ea95a[_0x25e1('0xbb')],'AttachmentId':_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][0x0]['id']})[_0x25e1('0x3b')](function(_0x566bbe){_0x5ea95a[_0x25e1('0xbc')][_0x25e1('0xbd')]=[];_0x5ea95a[_0x25e1('0xbc')]['Messages'][_0x25e1('0x8e')](_0x566bbe[_0x25e1('0xbc')]);return _0x5ea95a;});})[_0x25e1('0x3b')](function(_0x4d5ad4){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x25e1('0xb3')](_0x5a3eb5[_0x25e1('0x60')]['id'])?undefined:_0x5a3eb5[_0x25e1('0x60')]['id'],'path':_[_0x25e1('0xb3')](_0x5a3eb5['body']['attachments'][0x0][_0x25e1('0x9')])?undefined:_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][0x0]['path'],'fax':_[_0x25e1('0xb3')](_0x5a3eb5[_0x25e1('0x69')]['to'][0x0])?undefined:_0x5a3eb5[_0x25e1('0x69')]['to'][0x0],'AttachmentId':_0x5a3eb5[_0x25e1('0x69')][_0x25e1('0xae')][0x0]['id']},client9002)[_0x25e1('0x3b')](function(_0x439bcb){logger[_0x25e1('0x26')]('SendFaxRpc,\x20%s',_0x439bcb);})[_0x25e1('0x2f')](function(_0x24d8c9){logger[_0x25e1('0x26')](_0x25e1('0xbe'),_0x24d8c9);});return _0x4d5ad4;})[_0x25e1('0x3b')](respondWithResult(_0x23e9cc,null))[_0x25e1('0x2f')](handleError(_0x23e9cc,null));};exports[_0x25e1('0xbf')]=function(_0x271725,_0x35b98f,_0x47e5b9){return db[_0x25e1('0x47')][_0x25e1('0x61')]({'where':{'id':_0x271725[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x35b98f,null))[_0x25e1('0x3b')](function(_0x5b7469){if(_0x5b7469){return _0x5b7469[_0x25e1('0xbf')](_0x271725[_0x25e1('0x69')][_0x25e1('0x72')],_[_0x25e1('0x9f')](_0x271725[_0x25e1('0x69')],[_0x25e1('0x72'),'id'])||{})[_0x25e1('0xc0')](function(_0x40e24e){for(var _0x58a6d4=0x0;_0x58a6d4<_0x271725[_0x25e1('0x69')][_0x25e1('0x72')][_0x25e1('0x52')];_0x58a6d4+=0x1){socket[_0x25e1('0xc1')](_0x25e1('0xc2'),{'UserId':Number(_0x271725[_0x25e1('0x69')][_0x25e1('0x72')][_0x58a6d4]),'FaxAccountId':Number(_0x271725[_0x25e1('0x60')]['id'])});}return _0x40e24e;});}})[_0x25e1('0x3b')](respondWithResult(_0x35b98f,null))[_0x25e1('0x2f')](handleError(_0x35b98f,null));};exports['removeAgents']=function(_0x40a69d,_0x45283b,_0x312d74){return db[_0x25e1('0x47')]['find']({'where':{'id':_0x40a69d['params']['id']}})['then'](handleEntityNotFound(_0x45283b,null))[_0x25e1('0x3b')](function(_0x580318){if(_0x580318){return _0x580318[_0x25e1('0xc3')](_0x40a69d['query'][_0x25e1('0x72')])['then'](function(){if(_[_0x25e1('0xc4')](_0x40a69d[_0x25e1('0x4b')][_0x25e1('0x72')])){for(var _0x6b730e=0x0;_0x6b730e<_0x40a69d[_0x25e1('0x4b')]['ids'][_0x25e1('0x52')];_0x6b730e+=0x1){socket['emit'](_0x25e1('0xc5'),{'UserId':Number(_0x40a69d[_0x25e1('0x4b')][_0x25e1('0x72')][_0x6b730e]),'FaxAccountId':Number(_0x40a69d[_0x25e1('0x60')]['id'])});}}else{socket[_0x25e1('0xc1')](_0x25e1('0xc5'),{'UserId':Number(_0x40a69d[_0x25e1('0x4b')]['ids']),'FaxAccountId':Number(_0x40a69d['params']['id'])});}});}})[_0x25e1('0x3b')](respondWithStatusCode(_0x45283b,null))[_0x25e1('0x2f')](handleError(_0x45283b,null));};exports[_0x25e1('0xc6')]=function(_0x443db3,_0x584fd1,_0x204fef){var _0x31c264={};var _0x101c44={};var _0x33859a;var _0x565e25;return db[_0x25e1('0x47')]['findOne']({'where':{'id':_0x443db3[_0x25e1('0x60')]['id']}})[_0x25e1('0x3b')](handleEntityNotFound(_0x584fd1,null))[_0x25e1('0x3b')](function(_0x4d37fe){if(_0x4d37fe){_0x33859a=_0x4d37fe;_0x101c44[_0x25e1('0x4f')]=_[_0x25e1('0x4c')](db[_0x25e1('0xc7')][_0x25e1('0x48')]);_0x101c44[_0x25e1('0x4b')]=_[_0x25e1('0x4c')](_0x443db3['query']);_0x101c44['filters']=_[_0x25e1('0x4e')](_0x101c44[_0x25e1('0x4f')],_0x101c44[_0x25e1('0x4b')]);_0x31c264[_0x25e1('0x50')]=_[_0x25e1('0x4e')](_0x101c44[_0x25e1('0x4f')],qs['fields'](_0x443db3[_0x25e1('0x4b')][_0x25e1('0x51')]));_0x31c264['attributes']=_0x31c264[_0x25e1('0x50')][_0x25e1('0x52')]?_0x31c264[_0x25e1('0x50')]:_0x101c44[_0x25e1('0x4f')];_0x31c264[_0x25e1('0x6f')]=qs['sort'](_0x443db3['query'][_0x25e1('0x70')]);_0x31c264[_0x25e1('0x55')]=qs[_0x25e1('0x4d')](_[_0x25e1('0x56')](_0x443db3[_0x25e1('0x4b')],_0x101c44[_0x25e1('0x4d')]));if(_0x443db3[_0x25e1('0x4b')][_0x25e1('0x59')]){_0x31c264[_0x25e1('0x55')]=_[_0x25e1('0x57')](_0x31c264[_0x25e1('0x55')],{'$or':_[_0x25e1('0x46')](_0x31c264[_0x25e1('0x50')],function(_0xe3b0ff){var _0x3fefea={};_0x3fefea[_0xe3b0ff]={'$like':'%'+_0x443db3[_0x25e1('0x4b')][_0x25e1('0x59')]+'%'};return _0x3fefea;})});}_0x31c264=_[_0x25e1('0x57')]({},_0x31c264,_0x443db3['options']);return _0x33859a[_0x25e1('0xc6')](_0x31c264);}})[_0x25e1('0x3b')](function(_0x29e42a){if(_0x29e42a){_0x565e25=_0x29e42a[_0x25e1('0x52')];if(!_0x443db3['query']['hasOwnProperty'](_0x25e1('0x54'))){_0x31c264[_0x25e1('0x34')]=qs[_0x25e1('0x34')](_0x443db3[_0x25e1('0x4b')][_0x25e1('0x34')]);_0x31c264[_0x25e1('0x32')]=qs[_0x25e1('0x32')](_0x443db3[_0x25e1('0x4b')][_0x25e1('0x32')]);}return _0x33859a['getAgents'](_0x31c264);}})[_0x25e1('0x3b')](function(_0x49977e){if(_0x49977e){return _0x49977e?{'count':_0x565e25,'rows':_0x49977e}:null;}})[_0x25e1('0x3b')](respondWithResult(_0x584fd1,null))['catch'](handleError(_0x584fd1,null));}; \ No newline at end of file +var _0x18ea=['Send\x20Fax\x20failed','filename','spread','out','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','FaxAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tags','tag','sequelize','transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','stack','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','/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','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','CmContact','Contacts','DESC','attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x18ea,0x195));var _0xa18e=function(_0xd99061,_0x447cd8){_0xd99061=_0xd99061-0x0;var _0x2b134a=_0x18ea[_0xd99061];return _0x2b134a;};'use strict';var emlformat=require(_0xa18e('0x0'));var rimraf=require(_0xa18e('0x1'));var zipdir=require(_0xa18e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa18e('0x3'));var moment=require(_0xa18e('0x4'));var BPromise=require(_0xa18e('0x5'));var Mustache=require('mustache');var util=require(_0xa18e('0x6'));var path=require(_0xa18e('0x7'));var sox=require('sox');var csv=require(_0xa18e('0x8'));var ejs=require(_0xa18e('0x9'));var fs=require('fs');var fs_extra=require(_0xa18e('0xa'));var _=require(_0xa18e('0xb'));var squel=require('squel');var crypto=require(_0xa18e('0xc'));var jsforce=require(_0xa18e('0xd'));var deskjs=require(_0xa18e('0xe'));var toCsv=require(_0xa18e('0x8'));var querystring=require(_0xa18e('0xf'));var Papa=require(_0xa18e('0x10'));var Redis=require(_0xa18e('0x11'));var authService=require(_0xa18e('0x12'));var qs=require(_0xa18e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa18e('0x14'));var logger=require(_0xa18e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa18e('0x16'));var licenseUtil=require(_0xa18e('0x17'));var db=require(_0xa18e('0x18'))['db'];config['redis']=_['defaults'](config[_0xa18e('0x19')],{'host':_0xa18e('0x1a'),'port':0x18eb});var socket=require(_0xa18e('0x1b'))(new Redis(config['redis']));require(_0xa18e('0x1c'))[_0xa18e('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa18e('0x1e')][_0xa18e('0x1f')]({'port':0x232c});var client9002=jayson[_0xa18e('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ad7e9,_0x375d1b,_0x768488,_0x787f5f){return new BPromise(function(_0x1f3dff,_0x8020df){var _0x286de9=_0x787f5f||client;return _0x286de9[_0xa18e('0x20')](_0x1ad7e9,_0x768488)['then'](function(_0x1fb92f){logger[_0xa18e('0x21')](_0xa18e('0x22'),_0x375d1b,_0xa18e('0x23'));logger[_0xa18e('0x24')](_0xa18e('0x25'),_0x375d1b,_0xa18e('0x23'),JSON[_0xa18e('0x26')](_0x1fb92f));if(_0x1fb92f[_0xa18e('0x27')]){if(_0x1fb92f[_0xa18e('0x27')][_0xa18e('0x28')]===0x1f4){logger[_0xa18e('0x27')]('FaxAccount,\x20%s,\x20%s',_0x375d1b,_0x1fb92f[_0xa18e('0x27')]['message']);return _0x8020df(_0x1fb92f[_0xa18e('0x27')]['message']);}logger[_0xa18e('0x27')](_0xa18e('0x22'),_0x375d1b,_0x1fb92f['error']['message']);return _0x1f3dff(_0x1fb92f[_0xa18e('0x27')][_0xa18e('0x29')]);}else{logger['info'](_0xa18e('0x22'),_0x375d1b,'request\x20sent');_0x1f3dff(_0x1fb92f[_0xa18e('0x2a')][_0xa18e('0x29')]);}})['catch'](function(_0x512510){logger[_0xa18e('0x27')]('FaxAccount,\x20%s,\x20%s',_0x375d1b,_0x512510);_0x8020df(_0x512510);});});}function respondWithStatusCode(_0x7f6b65,_0x526da2){_0x526da2=_0x526da2||0xcc;return function(_0x41472d){if(_0x41472d){return _0x7f6b65[_0xa18e('0x2b')](_0x526da2);}return _0x7f6b65['status'](_0x526da2)[_0xa18e('0x2c')]();};}function respondWithResult(_0x16c146,_0x590d57){_0x590d57=_0x590d57||0xc8;return function(_0x2b8667){if(_0x2b8667){return _0x16c146['status'](_0x590d57)[_0xa18e('0x2d')](_0x2b8667);}};}function respondWithFilteredResult(_0x1b3e34,_0x18e587){return function(_0x1d24ad){if(_0x1d24ad){var _0x2fcbd0=typeof _0x18e587[_0xa18e('0x2e')]===_0xa18e('0x2f')&&typeof _0x18e587[_0xa18e('0x30')]===_0xa18e('0x2f');var _0x16f779=_0x1d24ad['count'];var _0x4534f8=_0x2fcbd0?0x0:_0x18e587[_0xa18e('0x2e')];var _0x38bad8=_0x2fcbd0?_0x1d24ad[_0xa18e('0x31')]:_0x18e587['offset']+_0x18e587[_0xa18e('0x30')];var _0x354818;if(_0x38bad8>=_0x16f779){_0x38bad8=_0x16f779;_0x354818=0xc8;}else{_0x354818=0xce;}_0x1b3e34[_0xa18e('0x32')](_0x354818);return _0x1b3e34[_0xa18e('0x33')](_0xa18e('0x34'),_0x4534f8+'-'+_0x38bad8+'/'+_0x16f779)[_0xa18e('0x2d')](_0x1d24ad);}return null;};}function patchUpdates(_0x416d52){return function(_0x5bf164){try{jsonpatch[_0xa18e('0x35')](_0x5bf164,_0x416d52,!![]);}catch(_0x19fb1c){return BPromise[_0xa18e('0x36')](_0x19fb1c);}return _0x5bf164[_0xa18e('0x37')]();};}function saveUpdates(_0x58e35d,_0x371a0e){return function(_0x4bbd23){if(_0x4bbd23){return _0x4bbd23[_0xa18e('0x38')](_0x58e35d)[_0xa18e('0x39')](function(_0x53aca5){return _0x53aca5;});}return null;};}function removeEntity(_0x569463,_0x59bb49){return function(_0x29b81f){if(_0x29b81f){return _0x29b81f[_0xa18e('0x3a')]()[_0xa18e('0x39')](function(){var _0x56f3c7=_0x29b81f['get']({'plain':!![]});var _0x505859=_0xa18e('0x3b');return db[_0xa18e('0x3c')][_0xa18e('0x3a')]({'where':{'type':_0x505859,'resourceId':_0x56f3c7['id']}})[_0xa18e('0x39')](function(){return _0x29b81f;});})[_0xa18e('0x39')](function(){_0x569463['status'](0xcc)[_0xa18e('0x2c')]();});}};}function handleEntityNotFound(_0x28f5c4,_0x1050c5){return function(_0x3b27d3){if(!_0x3b27d3){_0x28f5c4[_0xa18e('0x2b')](0x194);}return _0x3b27d3;};}function handleError(_0xb4e9e0,_0x7641ae){_0x7641ae=_0x7641ae||0x1f4;return function(_0xc9aa0e){logger['error'](_0xc9aa0e['stack']);if(_0xc9aa0e['name']){delete _0xc9aa0e[_0xa18e('0x3d')];}_0xb4e9e0[_0xa18e('0x32')](_0x7641ae)[_0xa18e('0x3e')](_0xc9aa0e);};}exports[_0xa18e('0x3f')]=function(_0x2537a3,_0x1f1a87){var _0x1fd262={'include':[{'model':db[_0xa18e('0x40')],'as':_0xa18e('0x41')}]},_0x3de322={},_0x20ebfb={'count':0x0,'rows':[]};var _0x28744d=_[_0xa18e('0x42')](db[_0xa18e('0x43')][_0xa18e('0x44')],function(_0x45d650){return{'name':_0x45d650['fieldName'],'type':_0x45d650[_0xa18e('0x45')]['key']};});_0x3de322['model']=_['map'](_0x28744d,_0xa18e('0x3d'));_0x3de322[_0xa18e('0x46')]=_['keys'](_0x2537a3[_0xa18e('0x46')]);_0x3de322['filters']=_[_0xa18e('0x47')](_0x3de322['model'],_0x3de322['query']);_0x1fd262[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x3de322[_0xa18e('0x49')],qs[_0xa18e('0x4a')](_0x2537a3[_0xa18e('0x46')][_0xa18e('0x4a')]));_0x1fd262['attributes']=_0x1fd262[_0xa18e('0x48')][_0xa18e('0x4b')]?_0x1fd262[_0xa18e('0x48')]:_0x3de322['model'];if(!_0x2537a3['query'][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0x1fd262['limit']=qs[_0xa18e('0x30')](_0x2537a3['query'][_0xa18e('0x30')]);_0x1fd262[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x2537a3[_0xa18e('0x46')][_0xa18e('0x2e')]);}_0x1fd262[_0xa18e('0x4e')]=qs['sort'](_0x2537a3[_0xa18e('0x46')][_0xa18e('0x4f')]);_0x1fd262[_0xa18e('0x50')]=qs[_0xa18e('0x51')](_[_0xa18e('0x52')](_0x2537a3[_0xa18e('0x46')],_0x3de322['filters']),_0x28744d);if(_0x2537a3[_0xa18e('0x46')][_0xa18e('0x53')]){_0x1fd262[_0xa18e('0x50')]=_[_0xa18e('0x54')](_0x1fd262[_0xa18e('0x50')],{'$or':_['map'](_0x28744d,function(_0x192aaf){if(_0x192aaf[_0xa18e('0x45')]!=='VIRTUAL'){var _0x4f62d3={};_0x4f62d3[_0x192aaf[_0xa18e('0x3d')]]={'$like':'%'+_0x2537a3[_0xa18e('0x46')]['filter']+'%'};return _0x4f62d3;}})});}_0x1fd262=_['merge']({},_0x1fd262,_0x2537a3[_0xa18e('0x55')]);var _0x37fed3={'where':_0x1fd262[_0xa18e('0x50')]};return db[_0xa18e('0x43')][_0xa18e('0x31')](_0x37fed3)[_0xa18e('0x39')](function(_0x3434de){_0x20ebfb['count']=_0x3434de;if(_0x2537a3[_0xa18e('0x46')][_0xa18e('0x56')]){_0x1fd262[_0xa18e('0x57')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x1fd262);})[_0xa18e('0x39')](function(_0x2806f9){_0x20ebfb[_0xa18e('0x58')]=_0x2806f9;return _0x20ebfb;})[_0xa18e('0x39')](respondWithFilteredResult(_0x1f1a87,_0x1fd262))[_0xa18e('0x59')](handleError(_0x1f1a87,null));};exports[_0xa18e('0x5a')]=function(_0x96a1b3,_0x39f01c){var _0x166c7f={'raw':![],'where':{'id':_0x96a1b3[_0xa18e('0x5b')]['id']},'include':[{'model':db[_0xa18e('0x40')],'as':'mandatoryDispositionPause'}]},_0x29584b={};_0x29584b[_0xa18e('0x49')]=_[_0xa18e('0x5c')](db[_0xa18e('0x43')]['rawAttributes']);_0x29584b[_0xa18e('0x46')]=_['keys'](_0x96a1b3[_0xa18e('0x46')]);_0x29584b['filters']=_['intersection'](_0x29584b[_0xa18e('0x49')],_0x29584b['query']);_0x166c7f[_0xa18e('0x48')]=_['intersection'](_0x29584b['model'],qs[_0xa18e('0x4a')](_0x96a1b3['query'][_0xa18e('0x4a')]));_0x166c7f[_0xa18e('0x48')]=_0x166c7f[_0xa18e('0x48')][_0xa18e('0x4b')]?_0x166c7f['attributes']:_0x29584b['model'];if(_0x96a1b3[_0xa18e('0x46')]['includeAll']){_0x166c7f['include']=[{'all':!![]}];}_0x166c7f=_[_0xa18e('0x54')]({},_0x166c7f,_0x96a1b3[_0xa18e('0x55')]);return db['FaxAccount']['find'](_0x166c7f)[_0xa18e('0x39')](handleEntityNotFound(_0x39f01c,null))['then'](respondWithResult(_0x39f01c,null))[_0xa18e('0x59')](handleError(_0x39f01c,null));};exports[_0xa18e('0x5d')]=function(_0x3e0f3f,_0x1ebca4){return db[_0xa18e('0x43')][_0xa18e('0x5d')](_0x3e0f3f[_0xa18e('0x5e')],{})[_0xa18e('0x39')](function(_0x3dafe7){var _0xc39ba5=_0x3e0f3f[_0xa18e('0x5f')][_0xa18e('0x60')]({'plain':!![]});if(!_0xc39ba5)throw new Error(_0xa18e('0x61'));if(_0xc39ba5[_0xa18e('0x62')]===_0xa18e('0x5f')){var _0x4c0fb2=_0x3dafe7[_0xa18e('0x60')]({'plain':!![]});var _0x3f9c74='FaxAccounts';return db[_0xa18e('0x63')]['find']({'where':{'name':_0x3f9c74,'userProfileId':_0xc39ba5['userProfileId']},'raw':!![]})[_0xa18e('0x39')](function(_0x5e601a){if(_0x5e601a&&_0x5e601a['autoAssociation']===0x0){return db[_0xa18e('0x3c')][_0xa18e('0x5d')]({'name':_0x4c0fb2[_0xa18e('0x3d')],'resourceId':_0x4c0fb2['id'],'type':_0x5e601a[_0xa18e('0x3d')],'sectionId':_0x5e601a['id']},{})['then'](function(){return _0x3dafe7;});}else{return _0x3dafe7;}})[_0xa18e('0x59')](function(_0x3656e4){logger[_0xa18e('0x27')](_0xa18e('0x64'),_0x3656e4);throw _0x3656e4;});}return _0x3dafe7;})[_0xa18e('0x39')](respondWithResult(_0x1ebca4,0xc9))[_0xa18e('0x59')](handleError(_0x1ebca4,null));};exports['update']=function(_0x6b4de8,_0x3d8986){if(_0x6b4de8['body']['id']){delete _0x6b4de8['body']['id'];}return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0x6b4de8['params']['id']},'include':[{'model':db[_0xa18e('0x40')],'as':_0xa18e('0x41')}]})[_0xa18e('0x39')](handleEntityNotFound(_0x3d8986,null))[_0xa18e('0x39')](saveUpdates(_0x6b4de8['body'],null))[_0xa18e('0x39')](respondWithResult(_0x3d8986,null))['catch'](handleError(_0x3d8986,null));};exports[_0xa18e('0x3a')]=function(_0x3375bb,_0x27049d){return db[_0xa18e('0x43')]['find']({'where':{'id':_0x3375bb[_0xa18e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x27049d,null))[_0xa18e('0x39')](removeEntity(_0x27049d,null))[_0xa18e('0x59')](handleError(_0x27049d,null));};exports['describe']=function(_0x280df2,_0x5de0f5){return db[_0xa18e('0x43')]['describe']()[_0xa18e('0x39')](respondWithResult(_0x5de0f5,null))[_0xa18e('0x59')](handleError(_0x5de0f5,null));};exports[_0xa18e('0x66')]=function(_0x4fe0d9,_0x15a4af,_0x34d5c2){if(_0x4fe0d9['body']['id']){delete _0x4fe0d9[_0xa18e('0x5e')]['id'];}return db['FaxAccount'][_0xa18e('0x65')]({'where':{'id':_0x4fe0d9[_0xa18e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x15a4af,null))['then'](function(_0x1bc2d6){if(_0x1bc2d6){_0x4fe0d9[_0xa18e('0x5e')][_0xa18e('0x67')]=_0x1bc2d6['id'];return db[_0xa18e('0x68')][_0xa18e('0x5d')](_0x4fe0d9[_0xa18e('0x5e')]);}})[_0xa18e('0x39')](respondWithResult(_0x15a4af,null))['catch'](handleError(_0x15a4af,null));};exports[_0xa18e('0x69')]=function(_0x5dcf88,_0x5407ad,_0x35d7e3){var _0x31aea3={'raw':![],'where':{}};var _0x208e25={};var _0x5dafd6={'count':0x0,'rows':[]};return db[_0xa18e('0x43')][_0xa18e('0x6a')]({'where':{'id':_0x5dcf88['params']['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x5407ad,null))[_0xa18e('0x39')](function(_0x29e7bf){if(_0x29e7bf){_0x208e25[_0xa18e('0x49')]=_[_0xa18e('0x5c')](db[_0xa18e('0x68')][_0xa18e('0x44')]);_0x208e25[_0xa18e('0x46')]=_['keys'](_0x5dcf88['query']);_0x208e25[_0xa18e('0x51')]=_[_0xa18e('0x47')](_0x208e25[_0xa18e('0x49')],_0x208e25[_0xa18e('0x46')]);_0x31aea3[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x208e25['model'],qs[_0xa18e('0x4a')](_0x5dcf88[_0xa18e('0x46')]['fields']));_0x31aea3['attributes']=_0x31aea3[_0xa18e('0x48')][_0xa18e('0x4b')]?_0x31aea3[_0xa18e('0x48')]:_0x208e25[_0xa18e('0x49')];if(!_0x5dcf88[_0xa18e('0x46')][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0x31aea3['limit']=qs[_0xa18e('0x30')](_0x5dcf88['query']['limit']);_0x31aea3[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x5dcf88[_0xa18e('0x46')][_0xa18e('0x2e')]);}_0x31aea3[_0xa18e('0x4e')]=qs[_0xa18e('0x4f')](_0x5dcf88[_0xa18e('0x46')][_0xa18e('0x4f')]);_0x31aea3[_0xa18e('0x50')]=qs['filters'](_[_0xa18e('0x52')](_0x5dcf88['query'],_0x208e25[_0xa18e('0x51')]));_0x31aea3['where'][_0xa18e('0x67')]=_0x29e7bf['id'];if(_0x5dcf88[_0xa18e('0x46')][_0xa18e('0x53')]){_0x31aea3[_0xa18e('0x50')]=_[_0xa18e('0x54')](_0x31aea3['where'],{'$or':_[_0xa18e('0x42')](_0x31aea3[_0xa18e('0x48')],function(_0x2c318e){var _0x42d0f8={};_0x42d0f8[_0x2c318e]={'$like':'%'+_0x5dcf88['query']['filter']+'%'};return _0x42d0f8;})});}_0x31aea3=_[_0xa18e('0x54')]({},_0x31aea3,_0x5dcf88['options']);return db[_0xa18e('0x68')][_0xa18e('0x31')]({'where':_0x31aea3[_0xa18e('0x50')]})[_0xa18e('0x39')](function(_0x3ca95d){_0x5dafd6[_0xa18e('0x31')]=_0x3ca95d;if(_0x5dcf88[_0xa18e('0x46')]['includeAll']){_0x31aea3[_0xa18e('0x57')]=[{'all':!![]}];}return db[_0xa18e('0x68')]['findAll'](_0x31aea3);})['then'](function(_0x3b87a8){_0x5dafd6[_0xa18e('0x58')]=_0x3b87a8;return _0x5dafd6;});}})[_0xa18e('0x39')](respondWithFilteredResult(_0x5407ad,_0x31aea3))[_0xa18e('0x59')](handleError(_0x5407ad,null));};exports['removeDispositions']=function(_0x1dba0e,_0x55e8ee,_0xed0128){return db['FaxAccount'][_0xa18e('0x65')]({'where':{'id':_0x1dba0e[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x55e8ee,null))[_0xa18e('0x39')](function(_0x5c715b){if(_0x5c715b){return _0x5c715b[_0xa18e('0x6b')](_0x1dba0e['query'][_0xa18e('0x6c')]);}})[_0xa18e('0x39')](respondWithStatusCode(_0x55e8ee,null))['catch'](handleError(_0x55e8ee,null));};exports[_0xa18e('0x6d')]=function(_0xee1d8d,_0x2c2205,_0x455dd4){if(_0xee1d8d[_0xa18e('0x5e')]['id']){delete _0xee1d8d[_0xa18e('0x5e')]['id'];}return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0xee1d8d[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x2c2205,null))[_0xa18e('0x39')](function(_0x291be3){if(_0x291be3){_0xee1d8d[_0xa18e('0x5e')][_0xa18e('0x67')]=_0x291be3['id'];return db[_0xa18e('0x6e')][_0xa18e('0x5d')](_0xee1d8d[_0xa18e('0x5e')]);}})[_0xa18e('0x39')](respondWithResult(_0x2c2205,null))[_0xa18e('0x59')](handleError(_0x2c2205,null));};exports[_0xa18e('0x6f')]=function(_0x4ae9c3,_0x443b3e,_0x307010){var _0x2cc754={'raw':![],'where':{}};var _0x2cc432={};var _0x567d0f={'count':0x0,'rows':[]};return db[_0xa18e('0x43')][_0xa18e('0x6a')]({'where':{'id':_0x4ae9c3[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x443b3e,null))[_0xa18e('0x39')](function(_0x147426){if(_0x147426){_0x2cc432[_0xa18e('0x49')]=_[_0xa18e('0x5c')](db[_0xa18e('0x6e')]['rawAttributes']);_0x2cc432['query']=_['keys'](_0x4ae9c3[_0xa18e('0x46')]);_0x2cc432[_0xa18e('0x51')]=_[_0xa18e('0x47')](_0x2cc432[_0xa18e('0x49')],_0x2cc432[_0xa18e('0x46')]);_0x2cc754[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x2cc432[_0xa18e('0x49')],qs['fields'](_0x4ae9c3[_0xa18e('0x46')]['fields']));_0x2cc754[_0xa18e('0x48')]=_0x2cc754[_0xa18e('0x48')][_0xa18e('0x4b')]?_0x2cc754[_0xa18e('0x48')]:_0x2cc432[_0xa18e('0x49')];if(!_0x4ae9c3['query'][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0x2cc754['limit']=qs[_0xa18e('0x30')](_0x4ae9c3[_0xa18e('0x46')][_0xa18e('0x30')]);_0x2cc754[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x4ae9c3[_0xa18e('0x46')][_0xa18e('0x2e')]);}_0x2cc754['order']=qs[_0xa18e('0x4f')](_0x4ae9c3[_0xa18e('0x46')]['sort']);_0x2cc754['where']=qs[_0xa18e('0x51')](_[_0xa18e('0x52')](_0x4ae9c3[_0xa18e('0x46')],_0x2cc432[_0xa18e('0x51')]));_0x2cc754[_0xa18e('0x50')][_0xa18e('0x67')]=_0x147426['id'];if(_0x4ae9c3[_0xa18e('0x46')][_0xa18e('0x53')]){_0x2cc754[_0xa18e('0x50')]=_[_0xa18e('0x54')](_0x2cc754[_0xa18e('0x50')],{'$or':_[_0xa18e('0x42')](_0x2cc754[_0xa18e('0x48')],function(_0x313ae3){var _0x1d095a={};_0x1d095a[_0x313ae3]={'$like':'%'+_0x4ae9c3[_0xa18e('0x46')][_0xa18e('0x53')]+'%'};return _0x1d095a;})});}_0x2cc754=_[_0xa18e('0x54')]({},_0x2cc754,_0x4ae9c3['options']);return db['CannedAnswer'][_0xa18e('0x31')]({'where':_0x2cc754['where']})['then'](function(_0x2c9637){_0x567d0f[_0xa18e('0x31')]=_0x2c9637;if(_0x4ae9c3['query'][_0xa18e('0x56')]){_0x2cc754[_0xa18e('0x57')]=[{'all':!![]}];}return db[_0xa18e('0x6e')][_0xa18e('0x70')](_0x2cc754);})[_0xa18e('0x39')](function(_0x11b094){_0x567d0f[_0xa18e('0x58')]=_0x11b094;return _0x567d0f;});}})[_0xa18e('0x39')](respondWithFilteredResult(_0x443b3e,_0x2cc754))['catch'](handleError(_0x443b3e,null));};exports[_0xa18e('0x71')]=function(_0x131419,_0x348688,_0x20315a){return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0x131419[_0xa18e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x348688,null))['then'](function(_0x1b05d9){if(_0x1b05d9){return _0x1b05d9[_0xa18e('0x71')](_0x131419['query']['ids']);}})[_0xa18e('0x39')](respondWithStatusCode(_0x348688,null))[_0xa18e('0x59')](handleError(_0x348688,null));};exports['addInteraction']=function(_0x8a5ecf,_0x1522da,_0x122f46){return db[_0xa18e('0x72')][_0xa18e('0x65')]({'where':{'id':_0x8a5ecf['params']['id']}})['then'](handleEntityNotFound(_0x1522da,null))[_0xa18e('0x39')](function(_0x107b78){if(_0x107b78){return _0x107b78[_0xa18e('0x73')](_0x8a5ecf[_0xa18e('0x5e')][_0xa18e('0x6c')],_[_0xa18e('0x74')](_0x8a5ecf['body'],[_0xa18e('0x6c'),'id'])||{});}})[_0xa18e('0x39')](respondWithResult(_0x1522da,null))[_0xa18e('0x59')](handleError(_0x1522da,null));};exports[_0xa18e('0x75')]=function(_0x2931f7,_0x5f1737,_0x48415f){var _0x554ad7={'raw':![],'where':{}};var _0x6a7079={};var _0x2d4329={'count':0x0,'rows':[]};return db[_0xa18e('0x43')]['findOne']({'where':{'id':_0x2931f7[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x5f1737,null))[_0xa18e('0x39')](function(_0x411e8e){if(_0x411e8e){_0x6a7079['model']=_[_0xa18e('0x5c')](db[_0xa18e('0x72')]['rawAttributes']);_0x6a7079[_0xa18e('0x46')]=_[_0xa18e('0x5c')](_0x2931f7[_0xa18e('0x46')]);_0x6a7079[_0xa18e('0x51')]=_[_0xa18e('0x47')](_0x6a7079[_0xa18e('0x49')],_0x6a7079[_0xa18e('0x46')]);_0x554ad7[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x6a7079[_0xa18e('0x49')],qs[_0xa18e('0x4a')](_0x2931f7['query'][_0xa18e('0x4a')]));_0x554ad7[_0xa18e('0x48')]=_0x554ad7['attributes'][_0xa18e('0x4b')]?_0x554ad7['attributes']:_0x6a7079[_0xa18e('0x49')];if(!_0x2931f7[_0xa18e('0x46')][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0x554ad7['limit']=qs[_0xa18e('0x30')](_0x2931f7[_0xa18e('0x46')][_0xa18e('0x30')]);_0x554ad7[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x2931f7['query'][_0xa18e('0x2e')]);}_0x554ad7[_0xa18e('0x4e')]=qs['sort'](_0x2931f7[_0xa18e('0x46')]['sort']);_0x554ad7[_0xa18e('0x50')]=qs[_0xa18e('0x51')](_[_0xa18e('0x52')](_0x2931f7[_0xa18e('0x46')],_0x6a7079[_0xa18e('0x51')]));_0x554ad7['where'][_0xa18e('0x67')]=_0x411e8e['id'];if(_0x2931f7[_0xa18e('0x46')][_0xa18e('0x53')]){_0x554ad7[_0xa18e('0x50')]=_[_0xa18e('0x54')](_0x554ad7['where'],{'$or':_[_0xa18e('0x42')](_0x554ad7[_0xa18e('0x48')],function(_0xdee37e){var _0x56e3d1={};_0x56e3d1[_0xdee37e]={'$like':'%'+_0x2931f7['query'][_0xa18e('0x53')]+'%'};return _0x56e3d1;})});}_0x554ad7=_[_0xa18e('0x54')]({},_0x554ad7,_0x2931f7[_0xa18e('0x55')]);return db[_0xa18e('0x72')][_0xa18e('0x31')]({'where':_0x554ad7[_0xa18e('0x50')]})['then'](function(_0x16fe03){_0x2d4329[_0xa18e('0x31')]=_0x16fe03;if(_0x2931f7[_0xa18e('0x46')][_0xa18e('0x56')]){_0x554ad7[_0xa18e('0x57')]=[{'model':db['CmContact'],'as':_0xa18e('0x76'),'required':![]},{'model':db[_0xa18e('0x77')],'as':_0xa18e('0x78'),'attributes':['name',_0xa18e('0x79'),_0xa18e('0x7a')],'required':![]},{'model':db['Tag'],'as':_0xa18e('0x7b'),'attributes':['id','name','color'],'where':_0x2931f7[_0xa18e('0x46')]['tag']?{'id':_0x2931f7[_0xa18e('0x46')]['tag']}:undefined,'required':_0x2931f7[_0xa18e('0x46')][_0xa18e('0x7c')]?!![]:![]}];}return db[_0xa18e('0x72')][_0xa18e('0x70')](_0x554ad7);})['then'](function(_0x26e559){_0x2d4329[_0xa18e('0x58')]=_0x26e559;return _0x2d4329;});}})['then'](respondWithFilteredResult(_0x5f1737,_0x554ad7))[_0xa18e('0x59')](handleError(_0x5f1737,null));};exports['addApplications']=function(_0x14a6b7,_0xa372d4){var _0x5b4f41=_0x14a6b7['params']['id'];var _0x35816a=_0x14a6b7['body'];var _0x31dd54=0xc8;var _0x5c0fcf=null;return db[_0xa18e('0x7d')][_0xa18e('0x7e')]({'isolationLevel':db['sequelize']['Transaction'][_0xa18e('0x7f')]['READ_COMMITTED']},function(_0x1dfb7c){return db[_0xa18e('0x43')][_0xa18e('0x6a')]({'where':{'id':_0x5b4f41},'transaction':_0x1dfb7c})['then'](function(_0x4329ad){if(_0x4329ad){return db[_0xa18e('0x80')][_0xa18e('0x3a')]({'where':{'FaxAccountId':_0x5b4f41},'transaction':_0x1dfb7c})[_0xa18e('0x39')](function(){var _0x341969=_[_0xa18e('0x42')](_0x35816a,function(_0x3ee3b0){_0x3ee3b0[_0xa18e('0x67')]=_0x5b4f41;return _0x3ee3b0;});return db[_0xa18e('0x80')][_0xa18e('0x81')](_0x341969,{'transaction':_0x1dfb7c});});}else{_0x31dd54=0x194;_0x5c0fcf=[];}});})[_0xa18e('0x39')](function(){if(_0x31dd54!==0x194){return db[_0xa18e('0x80')][_0xa18e('0x82')]({'where':{'FaxAccountId':_0x5b4f41},'order':_0xa18e('0x83')})[_0xa18e('0x39')](function(_0x3366fc){_0x5c0fcf=_0x3366fc;});}})[_0xa18e('0x59')](function(_0x795dff){_0x31dd54=0x1f4;logger['error'](_0x795dff[_0xa18e('0x84')]);if(_0x795dff[_0xa18e('0x3d')]){delete _0x795dff['name'];}_0x5c0fcf=_0x795dff;})['finally'](function(){if(_0x5c0fcf===null){_0xa372d4[_0xa18e('0x2b')](_0x31dd54);}else{if(_0x31dd54===0x1f4){_0xa372d4['status'](_0x31dd54)[_0xa18e('0x3e')](_0x5c0fcf);}else{_0xa372d4[_0xa18e('0x32')](_0x31dd54)[_0xa18e('0x2d')](_0x5c0fcf);}}});};exports['getApplications']=function(_0x3760dc,_0x5292fb,_0x2225a7){var _0x56c464={};var _0x29aa79={};var _0x1d547b;var _0x5ac6c1;return db[_0xa18e('0x43')][_0xa18e('0x6a')]({'where':{'id':_0x3760dc[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x5292fb,null))[_0xa18e('0x39')](function(_0x9dcf1d){if(_0x9dcf1d){_0x1d547b=_0x9dcf1d;_0x29aa79[_0xa18e('0x49')]=_[_0xa18e('0x5c')](db[_0xa18e('0x80')][_0xa18e('0x44')]);_0x29aa79[_0xa18e('0x46')]=_['keys'](_0x3760dc['query']);_0x29aa79[_0xa18e('0x51')]=_[_0xa18e('0x47')](_0x29aa79['model'],_0x29aa79['query']);_0x56c464[_0xa18e('0x48')]=_['intersection'](_0x29aa79['model'],qs[_0xa18e('0x4a')](_0x3760dc[_0xa18e('0x46')][_0xa18e('0x4a')]));_0x56c464[_0xa18e('0x48')]=_0x56c464[_0xa18e('0x48')][_0xa18e('0x4b')]?_0x56c464['attributes']:_0x29aa79[_0xa18e('0x49')];_0x56c464[_0xa18e('0x4e')]=qs['sort'](_0x3760dc[_0xa18e('0x46')]['sort']);_0x56c464[_0xa18e('0x50')]=qs[_0xa18e('0x51')](_[_0xa18e('0x52')](_0x3760dc[_0xa18e('0x46')],_0x29aa79[_0xa18e('0x51')]));if(_0x3760dc[_0xa18e('0x46')][_0xa18e('0x53')]){_0x56c464[_0xa18e('0x50')]=_['merge'](_0x56c464['where'],{'$or':_[_0xa18e('0x42')](_0x56c464[_0xa18e('0x48')],function(_0x24f471){var _0x4b417d={};_0x4b417d[_0x24f471]={'$like':'%'+_0x3760dc[_0xa18e('0x46')][_0xa18e('0x53')]+'%'};return _0x4b417d;})});}_0x56c464=_[_0xa18e('0x54')]({},_0x56c464,_0x3760dc[_0xa18e('0x55')]);return _0x1d547b[_0xa18e('0x85')](_0x56c464);}})['then'](function(_0x3f19df){if(_0x3f19df){_0x5ac6c1=_0x3f19df[_0xa18e('0x4b')];if(!_0x3760dc[_0xa18e('0x46')][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0x56c464['limit']=qs['limit'](_0x3760dc[_0xa18e('0x46')][_0xa18e('0x30')]);_0x56c464[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x3760dc[_0xa18e('0x46')]['offset']);}return _0x1d547b['getApplications'](_0x56c464);}})[_0xa18e('0x39')](function(_0x486851){if(_0x486851){return _0x486851?{'count':_0x5ac6c1,'rows':_0x486851}:null;}})[_0xa18e('0x39')](respondWithResult(_0x5292fb,null))[_0xa18e('0x59')](handleError(_0x5292fb,null));};function Extension(_0x353b5a,_0x184743,_0x438828,_0x59c6b7){this[_0xa18e('0x86')]=_0xa18e('0x87');this[_0xa18e('0x88')]=_0x353b5a[_0xa18e('0x89')];this['app']=_0x59c6b7;this[_0xa18e('0x45')]=_0xa18e('0x8a');this[_0xa18e('0x8b')]=_0xa18e('0x8c');this[_0xa18e('0x67')]=_0x353b5a['id'];this[_0xa18e('0x83')]=_0x184743;this['appdata']=_0x438828;}function createExtensionsReciveFax(_0xae6fbd){var _0x29ab3f=0x1;var _0x744655=[];_0x744655[_0xa18e('0x8d')](new Extension(_0xae6fbd,_0x29ab3f,'',_0xa18e('0x8e')));_0x29ab3f+=0x1;_0x744655[_0xa18e('0x8d')](new Extension(_0xae6fbd,_0x29ab3f,_0xa18e('0x8f'),_0xa18e('0x90')));_0x29ab3f+=0x1;for(var _0x1c3fa4 in _0xae6fbd){if(_0xae6fbd[_0xa18e('0x4c')](_0x1c3fa4)&&(_0x1c3fa4===_0xa18e('0x91')||_0x1c3fa4==='localstationid'||_0x1c3fa4===_0xa18e('0x92')||_0x1c3fa4===_0xa18e('0x93')||_0x1c3fa4===_0xa18e('0x94')||_0x1c3fa4===_0xa18e('0x95')||_0x1c3fa4===_0xa18e('0x96')||_0x1c3fa4===_0xa18e('0x97')||_0x1c3fa4==='t38timeout')){_0x744655[_0xa18e('0x8d')](new Extension(_0xae6fbd,_0x29ab3f,'FAXOPT('+_0x1c3fa4+')='+_0xae6fbd[_0x1c3fa4],'Set'));_0x29ab3f+=0x1;}}_0x744655['push'](new Extension(_0xae6fbd,_0x29ab3f,'6','Wait'));_0x29ab3f+=0x1;_0x744655[_0xa18e('0x8d')](new Extension(_0xae6fbd,_0x29ab3f,_0xa18e('0x98'),_0xa18e('0x99')));_0x29ab3f=0x0;return _0x744655;}exports[_0xa18e('0x9a')]=function(_0x598955,_0x5a12d7,_0x19c4c3){var _0x23d8a4;return db[_0xa18e('0x7d')]['transaction'](function(_0x272c00){return db[_0xa18e('0x43')][_0xa18e('0x5d')](_0x598955[_0xa18e('0x5e')],{'transaction':_0x272c00})[_0xa18e('0x39')](function(_0x309854){_0x23d8a4=_0x309854['get']({'plain':!![]});return db[_0xa18e('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x23d8a4),{'transaction':_0x272c00});});})['then'](function(){return _0x23d8a4;})['then'](respondWithResult(_0x5a12d7,null))['catch'](handleError(_0x5a12d7,null));};exports['updateAccountApplications']=function(_0x14577a,_0x36d2ad,_0x4caa38){var _0x4c9938;return db[_0xa18e('0x7d')][_0xa18e('0x7e')](function(_0x432d2e){return db[_0xa18e('0x43')][_0xa18e('0x38')](_0x14577a[_0xa18e('0x5e')],{'where':{'id':_0x14577a['body']['id']},'transaction':_0x432d2e})[_0xa18e('0x39')](function(_0xed0cc5){return db[_0xa18e('0x9b')][_0xa18e('0x3a')]({'where':{'FaxAccountId':_0x14577a[_0xa18e('0x5e')]['id']},'transaction':_0x432d2e})[_0xa18e('0x39')](function(_0x56407c){return db['VoiceExtension'][_0xa18e('0x81')](createExtensionsReciveFax(_[_0xa18e('0x74')](_0x14577a[_0xa18e('0x5e')],[_0xa18e('0x9c'),'key',_0xa18e('0x9d'),_0xa18e('0x9e'),_0xa18e('0x9f'),_0xa18e('0xa0')])),{'transaction':_0x432d2e});});});})['then'](function(){return db[_0xa18e('0x43')]['findById'](_0x14577a[_0xa18e('0x5e')]['id']);})['then'](respondWithResult(_0x36d2ad,null))['catch'](handleError(_0x36d2ad,null));};exports[_0xa18e('0xa1')]=function(_0x2754c0,_0x29e3fa,_0x1a31ce){var _0xc4fa5e={'raw':!![],'where':{}};var _0x2749e1={};var _0x5dd92a={'count':0x0,'rows':[]};return db[_0xa18e('0x43')][_0xa18e('0x6a')]({'where':{'id':_0x2754c0[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x29e3fa,null))[_0xa18e('0x39')](function(_0x323b30){if(_0x323b30){_0x2749e1['model']=_[_0xa18e('0x5c')](db['FaxMessage'][_0xa18e('0x44')]);_0x2749e1[_0xa18e('0x46')]=_['keys'](_0x2754c0[_0xa18e('0x46')]);_0x2749e1[_0xa18e('0x51')]=_['intersection'](_0x2749e1[_0xa18e('0x49')],_0x2749e1[_0xa18e('0x46')]);_0xc4fa5e[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x2749e1[_0xa18e('0x49')],qs[_0xa18e('0x4a')](_0x2754c0['query'][_0xa18e('0x4a')]));_0xc4fa5e['attributes']=_0xc4fa5e[_0xa18e('0x48')][_0xa18e('0x4b')]?_0xc4fa5e[_0xa18e('0x48')]:_0x2749e1['model'];if(!_0x2754c0[_0xa18e('0x46')][_0xa18e('0x4c')](_0xa18e('0x4d'))){_0xc4fa5e[_0xa18e('0x30')]=qs[_0xa18e('0x30')](_0x2754c0['query'][_0xa18e('0x30')]);_0xc4fa5e[_0xa18e('0x2e')]=qs[_0xa18e('0x2e')](_0x2754c0['query'][_0xa18e('0x2e')]);}_0xc4fa5e[_0xa18e('0x4e')]=qs['sort'](_0x2754c0[_0xa18e('0x46')][_0xa18e('0x4f')]);_0xc4fa5e[_0xa18e('0x50')]=qs[_0xa18e('0x51')](_[_0xa18e('0x52')](_0x2754c0['query'],_0x2749e1[_0xa18e('0x51')]));_0xc4fa5e[_0xa18e('0x50')][_0xa18e('0x67')]=_0x323b30['id'];if(_0x2754c0[_0xa18e('0x46')]['filter']){_0xc4fa5e[_0xa18e('0x50')]=_['merge'](_0xc4fa5e[_0xa18e('0x50')],{'$or':_['map'](_0xc4fa5e['attributes'],function(_0x20e26d){var _0x2918cf={};_0x2918cf[_0x20e26d]={'$like':'%'+_0x2754c0[_0xa18e('0x46')][_0xa18e('0x53')]+'%'};return _0x2918cf;})});}if(_0x2754c0[_0xa18e('0x46')][_0xa18e('0xa2')]){var _0x3eeed5=_0x2754c0[_0xa18e('0x46')][_0xa18e('0xa2')][_0xa18e('0xa3')](',');var _0x2f1c04={};_0x2f1c04[_0x3eeed5[0x0]]={'$gte':moment(_0x3eeed5[0x1])[_0xa18e('0xa4')](_0xa18e('0xa5'))};_0xc4fa5e['where']=_[_0xa18e('0x54')](_0xc4fa5e[_0xa18e('0x50')],_0x2f1c04);}_0xc4fa5e=_[_0xa18e('0x54')]({},_0xc4fa5e,_0x2754c0[_0xa18e('0x55')]);return db[_0xa18e('0xa6')][_0xa18e('0x31')]({'where':_0xc4fa5e['where']})[_0xa18e('0x39')](function(_0x22395d){_0x5dd92a[_0xa18e('0x31')]=_0x22395d;if(_0x2754c0[_0xa18e('0x46')][_0xa18e('0x56')]){_0xc4fa5e[_0xa18e('0x57')]=[{'all':!![]}];}return db[_0xa18e('0xa6')][_0xa18e('0x70')](_0xc4fa5e);})[_0xa18e('0x39')](function(_0x5ecc9b){_0x5dd92a[_0xa18e('0x58')]=_0x5ecc9b;return _0x5dd92a;});}})['then'](respondWithFilteredResult(_0x29e3fa,_0xc4fa5e))[_0xa18e('0x59')](handleError(_0x29e3fa,null));};exports['send']=function(_0x589def,_0x38f50d,_0x297ac8){var _0x192d8a,_0x681884={},_0x22de4a;if(_0x589def[_0xa18e('0x5e')]['to']){_0x22de4a=_0x589def[_0xa18e('0x5e')]['to'][0x0];}return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0x589def[_0xa18e('0x5b')]['id']},'include':[{'model':db[_0xa18e('0xa7')],'as':'List','include':[{'model':db[_0xa18e('0xa8')],'as':_0xa18e('0xa9'),'where':{'fax':_0x22de4a},'limit':0x1,'order':[[_0xa18e('0x9e'),_0xa18e('0xaa')]]}]}]})[_0xa18e('0x39')](handleEntityNotFound(_0x38f50d,null))['then'](function(_0x1a4807){_0x192d8a=_0x1a4807;if(_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')]&&_0x589def['body']['attachments'][_0xa18e('0x4b')]){for(var _0x23446b=0x0;_0x23446b<_0x589def['body'][_0xa18e('0xab')][_0xa18e('0x4b')];_0x23446b+=0x1){_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][_0x23446b]={'filename':_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][_0x23446b]['name'],'id':_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][_0x23446b]['id'],'path':path['join'](config['root'],'server/files/attachments',_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][_0x23446b][_0xa18e('0xac')])};}}return respondWithRpcPromise(_0xa18e('0xad'),'CheckAfterSend',{'FaxAccountId':_[_0xa18e('0xae')](_0x589def[_0xa18e('0x5b')]['id'])?undefined:_0x589def[_0xa18e('0x5b')]['id'],'path':_[_0xa18e('0xae')](_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][0x0][_0xa18e('0x7')])?undefined:_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][0x0]['path'],'fax':_['isNil'](_0x589def['body']['to'][0x0])?undefined:_0x589def[_0xa18e('0x5e')]['to'][0x0]},client9002);})['then'](function(){if(_0x192d8a){if(_[_0xa18e('0xae')](_0x589def[_0xa18e('0x5e')][_0xa18e('0xaf')])){_0x589def[_0xa18e('0x5e')][_0xa18e('0xaf')]=util['format'](_0xa18e('0xb0'),_0x192d8a[_0xa18e('0x3d')],_0x192d8a[_0xa18e('0xb1')]);}if(_0x192d8a[_0xa18e('0xb2')]){if(_0x192d8a['List'][_0xa18e('0xa9')][_0xa18e('0x4b')]){return _0x192d8a[_0xa18e('0xb2')]['Contacts'][0x0];}else{return db[_0xa18e('0xa8')][_0xa18e('0x5d')](_['defaults'](_0x589def[_0xa18e('0x5e')],{'firstName':_0x589def[_0xa18e('0x5e')]['to'][0x0],'phone':_0x589def[_0xa18e('0x5e')]['to'][0x0],'fax':_0x589def[_0xa18e('0x5e')]['to'][0x0],'ListId':_0x192d8a[_0xa18e('0xa0')]}));}}else{throw new Error(_0xa18e('0xb3'));}}else{throw new Error(_0xa18e('0xb4'));}})[_0xa18e('0x39')](function(_0x343d0c){if(_0x343d0c){return db[_0xa18e('0x72')][_0xa18e('0x65')]({'where':{'ContactId':_0x343d0c['id'],'closed':![],'FaxAccountId':_0x192d8a['id']}})['then'](function(_0xd68609){if(_0xd68609){return[_0xd68609,![]];}return db[_0xa18e('0x72')][_0xa18e('0x5d')]({'UserId':_0x589def[_0xa18e('0x5f')]['id'],'ContactId':_0x343d0c['id'],'FaxAccountId':_0x192d8a['id'],'fax':_0x589def['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xa18e('0x54')](_0x589def['body'],{'read':![],'body':_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][0x0][_0xa18e('0xb5')],'FaxAccountId':_0x192d8a['id'],'UserId':_0x589def['user']['id'],'ContactId':_0x343d0c['id'],'AttachmentId':_0x589def[_0xa18e('0x5e')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xa18e('0xa6')],'as':'Messages'}]})['then'](function(_0x1705d5){return[_0x1705d5,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa18e('0xb6')](function(_0x4c98cf,_0x31b40a){if(_0x31b40a){return _0x4c98cf;}return db['FaxMessage'][_0xa18e('0x5d')]({'direction':_0xa18e('0xb7'),'read':![],'body':_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][0x0]['filename'],'FaxAccountId':_0x192d8a['id'],'FaxInteractionId':_0x4c98cf['id'],'UserId':_0x589def[_0xa18e('0x5f')]['id'],'ContactId':_0x4c98cf[_0xa18e('0xb8')],'AttachmentId':_0x589def['body'][_0xa18e('0xab')][0x0]['id']})[_0xa18e('0x39')](function(_0x380223){_0x4c98cf['dataValues'][_0xa18e('0xb9')]=[];_0x4c98cf[_0xa18e('0xba')][_0xa18e('0xb9')][_0xa18e('0x8d')](_0x380223['dataValues']);return _0x4c98cf;});})[_0xa18e('0x39')](function(_0x5e8595){respondWithRpcPromise(_0xa18e('0xbb'),_0xa18e('0xbb'),{'FaxAccountId':_[_0xa18e('0xae')](_0x589def[_0xa18e('0x5b')]['id'])?undefined:_0x589def[_0xa18e('0x5b')]['id'],'path':_[_0xa18e('0xae')](_0x589def[_0xa18e('0x5e')][_0xa18e('0xab')][0x0][_0xa18e('0x7')])?undefined:_0x589def['body'][_0xa18e('0xab')][0x0][_0xa18e('0x7')],'fax':_[_0xa18e('0xae')](_0x589def['body']['to'][0x0])?undefined:_0x589def[_0xa18e('0x5e')]['to'][0x0],'AttachmentId':_0x589def[_0xa18e('0x5e')]['attachments'][0x0]['id']},client9002)[_0xa18e('0x39')](function(_0x3f0440){logger[_0xa18e('0x21')](_0xa18e('0xbc'),_0x3f0440);})[_0xa18e('0x59')](function(_0x26414c){logger[_0xa18e('0x21')](_0xa18e('0xbc'),_0x26414c);});return _0x5e8595;})[_0xa18e('0x39')](respondWithResult(_0x38f50d,null))[_0xa18e('0x59')](handleError(_0x38f50d,null));};exports[_0xa18e('0xbd')]=function(_0xc71d31,_0x2b4a76,_0xb0ebf){return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0xc71d31[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x2b4a76,null))['then'](function(_0x372e17){if(_0x372e17){return _0x372e17[_0xa18e('0xbd')](_0xc71d31[_0xa18e('0x5e')]['ids'],_['omit'](_0xc71d31['body'],[_0xa18e('0x6c'),'id'])||{})[_0xa18e('0xb6')](function(_0x203517){for(var _0xa1a35e=0x0;_0xa1a35e<_0xc71d31[_0xa18e('0x5e')][_0xa18e('0x6c')]['length'];_0xa1a35e+=0x1){socket[_0xa18e('0xbe')](_0xa18e('0xbf'),{'UserId':Number(_0xc71d31[_0xa18e('0x5e')][_0xa18e('0x6c')][_0xa1a35e]),'FaxAccountId':Number(_0xc71d31['params']['id'])});}return _0x203517;});}})[_0xa18e('0x39')](respondWithResult(_0x2b4a76,null))['catch'](handleError(_0x2b4a76,null));};exports['removeAgents']=function(_0x5e2196,_0x410bf2,_0x2aaf0d){return db[_0xa18e('0x43')][_0xa18e('0x65')]({'where':{'id':_0x5e2196['params']['id']}})['then'](handleEntityNotFound(_0x410bf2,null))[_0xa18e('0x39')](function(_0x532842){if(_0x532842){return _0x532842[_0xa18e('0xc0')](_0x5e2196[_0xa18e('0x46')][_0xa18e('0x6c')])['then'](function(){if(_[_0xa18e('0xc1')](_0x5e2196['query'][_0xa18e('0x6c')])){for(var _0x2a5c68=0x0;_0x2a5c68<_0x5e2196[_0xa18e('0x46')]['ids'][_0xa18e('0x4b')];_0x2a5c68+=0x1){socket[_0xa18e('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x5e2196[_0xa18e('0x46')][_0xa18e('0x6c')][_0x2a5c68]),'FaxAccountId':Number(_0x5e2196[_0xa18e('0x5b')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x5e2196['query'][_0xa18e('0x6c')]),'FaxAccountId':Number(_0x5e2196[_0xa18e('0x5b')]['id'])});}});}})[_0xa18e('0x39')](respondWithStatusCode(_0x410bf2,null))[_0xa18e('0x59')](handleError(_0x410bf2,null));};exports[_0xa18e('0xc2')]=function(_0x406684,_0x6b53ec,_0x2a5faf){var _0x3a5fca={};var _0x476813={};var _0x94b915;var _0x7208bf;return db[_0xa18e('0x43')]['findOne']({'where':{'id':_0x406684[_0xa18e('0x5b')]['id']}})[_0xa18e('0x39')](handleEntityNotFound(_0x6b53ec,null))[_0xa18e('0x39')](function(_0x2363d4){if(_0x2363d4){_0x94b915=_0x2363d4;_0x476813['model']=_[_0xa18e('0x5c')](db[_0xa18e('0x77')][_0xa18e('0x44')]);_0x476813[_0xa18e('0x46')]=_[_0xa18e('0x5c')](_0x406684[_0xa18e('0x46')]);_0x476813['filters']=_[_0xa18e('0x47')](_0x476813['model'],_0x476813['query']);_0x3a5fca[_0xa18e('0x48')]=_[_0xa18e('0x47')](_0x476813[_0xa18e('0x49')],qs[_0xa18e('0x4a')](_0x406684[_0xa18e('0x46')][_0xa18e('0x4a')]));_0x3a5fca['attributes']=_0x3a5fca['attributes'][_0xa18e('0x4b')]?_0x3a5fca[_0xa18e('0x48')]:_0x476813[_0xa18e('0x49')];_0x3a5fca[_0xa18e('0x4e')]=qs[_0xa18e('0x4f')](_0x406684[_0xa18e('0x46')][_0xa18e('0x4f')]);_0x3a5fca[_0xa18e('0x50')]=qs['filters'](_['pick'](_0x406684[_0xa18e('0x46')],_0x476813[_0xa18e('0x51')]));if(_0x406684[_0xa18e('0x46')][_0xa18e('0x53')]){_0x3a5fca[_0xa18e('0x50')]=_[_0xa18e('0x54')](_0x3a5fca['where'],{'$or':_['map'](_0x3a5fca[_0xa18e('0x48')],function(_0x4de2cd){var _0x14187c={};_0x14187c[_0x4de2cd]={'$like':'%'+_0x406684[_0xa18e('0x46')][_0xa18e('0x53')]+'%'};return _0x14187c;})});}_0x3a5fca=_[_0xa18e('0x54')]({},_0x3a5fca,_0x406684['options']);return _0x94b915['getAgents'](_0x3a5fca);}})[_0xa18e('0x39')](function(_0x17c466){if(_0x17c466){_0x7208bf=_0x17c466[_0xa18e('0x4b')];if(!_0x406684[_0xa18e('0x46')]['hasOwnProperty'](_0xa18e('0x4d'))){_0x3a5fca['limit']=qs[_0xa18e('0x30')](_0x406684[_0xa18e('0x46')][_0xa18e('0x30')]);_0x3a5fca['offset']=qs['offset'](_0x406684[_0xa18e('0x46')][_0xa18e('0x2e')]);}return _0x94b915[_0xa18e('0xc2')](_0x3a5fca);}})['then'](function(_0x18bfc6){if(_0x18bfc6){return _0x18bfc6?{'count':_0x7208bf,'rows':_0x18bfc6}:null;}})[_0xa18e('0x39')](respondWithResult(_0x6b53ec,null))[_0xa18e('0x59')](handleError(_0x6b53ec,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ef90c5f..9a28e45 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 _0xf571=['emit','hasOwnProperty','hook','exports','events','FaxAccount','save','update','remove'];(function(_0x3b07ca,_0x56c4bc){var _0x61e09=function(_0x5cd016){while(--_0x5cd016){_0x3b07ca['push'](_0x3b07ca['shift']());}};_0x61e09(++_0x56c4bc);}(_0xf571,0x1a2));var _0x1f57=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf571[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x1f57('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x1f57('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1f57('0x2'),'afterUpdate':_0x1f57('0x3'),'afterDestroy':_0x1f57('0x4')};function emitEvent(_0xee3268){return function(_0x7084fe,_0x50f510,_0x3d6ad2){FaxAccountEvents[_0x1f57('0x5')](_0xee3268+':'+_0x7084fe['id'],_0x7084fe);FaxAccountEvents[_0x1f57('0x5')](_0xee3268,_0x7084fe);_0x3d6ad2(null);};}for(var e in events){if(events[_0x1f57('0x6')](e)){var event=events[e];FaxAccount[_0x1f57('0x7')](e,emitEvent(event));}}module[_0x1f57('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x8917=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x8917,0xc8));var _0x7891=function(_0x41c387,_0x5816ba){_0x41c387=_0x41c387-0x0;var _0x114fb6=_0x8917[_0x41c387];return _0x114fb6;};'use strict';var EventEmitter=require(_0x7891('0x0'));var FaxAccount=require(_0x7891('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7891('0x2'),'afterUpdate':_0x7891('0x3'),'afterDestroy':_0x7891('0x4')};function emitEvent(_0xdfcc8c){return function(_0x74ae4d,_0x5db3f4,_0xc163aa){FaxAccountEvents[_0x7891('0x5')](_0xdfcc8c+':'+_0x74ae4d['id'],_0x74ae4d);FaxAccountEvents[_0x7891('0x5')](_0xdfcc8c,_0x74ae4d);_0xc163aa(null);};}for(var e in events){if(events[_0x7891('0x6')](e)){var event=events[e];FaxAccount[_0x7891('0x7')](e,emitEvent(event));}}module[_0x7891('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index a8f0454..a6b30e1 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 _0x255a=['request-promise','path','rimraf','./faxAccount.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1abda0,_0x57f78e){var _0x33fe72=function(_0x48a83c){while(--_0x48a83c){_0x1abda0['push'](_0x1abda0['shift']());}};_0x33fe72(++_0x57f78e);}(_0x255a,0x1a8));var _0xa255=function(_0x491048,_0x5d691f){_0x491048=_0x491048-0x0;var _0x2d3c83=_0x255a[_0x491048];return _0x2d3c83;};'use strict';var _=require(_0xa255('0x0'));var util=require(_0xa255('0x1'));var logger=require(_0xa255('0x2'))('api');var moment=require(_0xa255('0x3'));var BPromise=require(_0xa255('0x4'));var rp=require(_0xa255('0x5'));var fs=require('fs');var path=require(_0xa255('0x6'));var rimraf=require(_0xa255('0x7'));var config=require('../../config/environment');var attributes=require(_0xa255('0x8'));module[_0xa255('0x9')]=function(_0x10a91a,_0x2f29ec){return _0x10a91a[_0xa255('0xa')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59af=['define','fax_accounts','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./faxAccount.attributes','exports'];(function(_0x2880ee,_0x2e2650){var _0x10f264=function(_0x532937){while(--_0x532937){_0x2880ee['push'](_0x2880ee['shift']());}};_0x10f264(++_0x2e2650);}(_0x59af,0x12e));var _0xf59a=function(_0x218f0c,_0x209467){_0x218f0c=_0x218f0c-0x0;var _0x24e888=_0x59af[_0x218f0c];return _0x24e888;};'use strict';var _=require(_0xf59a('0x0'));var util=require('util');var logger=require(_0xf59a('0x1'))('api');var moment=require(_0xf59a('0x2'));var BPromise=require(_0xf59a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf59a('0x4'));var rimraf=require('rimraf');var config=require(_0xf59a('0x5'));var attributes=require(_0xf59a('0x6'));module[_0xf59a('0x7')]=function(_0x35ccb6,_0x3e53c4){return _0x35ccb6[_0xf59a('0x8')]('FaxAccount',attributes,{'tableName':_0xf59a('0x9'),'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 93064fa..e4d5b5b 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 _0xcb6d=['isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','find','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','orderBy','priority','defaults','ListId','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','autoclose','length','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','unshift','agent','name','*,*,*,*','queueId','FaxQueue','queue','waitForTheAssignedQueue','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','catch','FaxAccount','findAll','options','raw','attributes','limit','map','model','include','GetFaxAccount','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xcb6d,0x85));var _0xdcb6=function(_0x166f80,_0x52f6c9){_0x166f80=_0x166f80-0x0;var _0x564f98=_0xcb6d[_0x166f80];return _0x564f98;};'use strict';var _=require(_0xdcb6('0x0'));var util=require('util');var moment=require(_0xdcb6('0x1'));var BPromise=require(_0xdcb6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcb6('0x3'));var db=require(_0xdcb6('0x4'))['db'];var utils=require(_0xdcb6('0x5'));var logger=require(_0xdcb6('0x6'))('rpc');var config=require(_0xdcb6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdcb6('0x8')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0xdcb6('0x9')],{'host':_0xdcb6('0xa'),'port':0x18eb});var socket=require(_0xdcb6('0xb'))(new Redis(config[_0xdcb6('0x9')]));require('./faxAccount.socket')[_0xdcb6('0xc')](socket);function respondWithRpcPromise(_0x231091,_0x4f8a3e,_0x2b81d0){return new BPromise(function(_0x1748f7,_0x3ba05f){return client['request'](_0x231091,_0x2b81d0)[_0xdcb6('0xd')](function(_0x30b7d9){logger[_0xdcb6('0xe')]('FaxAccount,\x20%s,\x20%s',_0x4f8a3e,_0xdcb6('0xf'));logger[_0xdcb6('0x10')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4f8a3e,_0xdcb6('0xf'),JSON[_0xdcb6('0x11')](_0x30b7d9));if(_0x30b7d9[_0xdcb6('0x12')]){if(_0x30b7d9[_0xdcb6('0x12')][_0xdcb6('0x13')]===0x1f4){logger[_0xdcb6('0x12')]('FaxAccount,\x20%s,\x20%s',_0x4f8a3e,_0x30b7d9[_0xdcb6('0x12')][_0xdcb6('0x14')]);return _0x3ba05f(_0x30b7d9[_0xdcb6('0x12')][_0xdcb6('0x14')]);}logger[_0xdcb6('0x12')]('FaxAccount,\x20%s,\x20%s',_0x4f8a3e,_0x30b7d9[_0xdcb6('0x12')][_0xdcb6('0x14')]);return _0x1748f7(_0x30b7d9[_0xdcb6('0x12')][_0xdcb6('0x14')]);}else{logger[_0xdcb6('0xe')](_0xdcb6('0x15'),_0x4f8a3e,_0xdcb6('0xf'));_0x1748f7(_0x30b7d9['result'][_0xdcb6('0x14')]);}})[_0xdcb6('0x16')](function(_0x1d49ed){logger[_0xdcb6('0x12')]('FaxAccount,\x20%s,\x20%s',_0x4f8a3e,_0x1d49ed);_0x3ba05f(_0x1d49ed);});});}exports['GetFaxAccount']=function(_0x39513c){var _0x1fd362=this;return new Promise(function(_0xa50dc9,_0x35b2b8){return db[_0xdcb6('0x17')][_0xdcb6('0x18')]({'raw':_0x39513c[_0xdcb6('0x19')]?_0x39513c[_0xdcb6('0x19')][_0xdcb6('0x1a')]===undefined?!![]:![]:!![],'where':_0x39513c[_0xdcb6('0x19')]?_0x39513c['options']['where']||null:null,'attributes':_0x39513c['options']?_0x39513c[_0xdcb6('0x19')][_0xdcb6('0x1b')]||null:null,'limit':_0x39513c[_0xdcb6('0x19')]?_0x39513c[_0xdcb6('0x19')][_0xdcb6('0x1c')]||null:null,'include':_0x39513c['options']?_0x39513c[_0xdcb6('0x19')]['include']?_[_0xdcb6('0x1d')](_0x39513c[_0xdcb6('0x19')]['include'],function(_0x4cc381){return{'model':db[_0x4cc381[_0xdcb6('0x1e')]],'as':_0x4cc381['as'],'attributes':_0x4cc381[_0xdcb6('0x1b')],'include':_0x4cc381[_0xdcb6('0x1f')]?_[_0xdcb6('0x1d')](_0x4cc381['include'],function(_0x575c65){return{'model':db[_0x575c65[_0xdcb6('0x1e')]],'as':_0x575c65['as'],'attributes':_0x575c65[_0xdcb6('0x1b')],'include':_0x575c65[_0xdcb6('0x1f')]?_['map'](_0x575c65[_0xdcb6('0x1f')],function(_0x36a552){return{'model':db[_0x36a552[_0xdcb6('0x1e')]],'as':_0x36a552['as'],'attributes':_0x36a552[_0xdcb6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdcb6('0xd')](function(_0x444c06){logger[_0xdcb6('0xe')](_0xdcb6('0x20'),_0x39513c);logger[_0xdcb6('0x10')](_0xdcb6('0x20'),_0x39513c,JSON[_0xdcb6('0x11')](_0x444c06));_0xa50dc9(_0x444c06);})[_0xdcb6('0x16')](function(_0x432623){logger[_0xdcb6('0x12')](_0xdcb6('0x20'),_0x432623[_0xdcb6('0x14')],_0x39513c);_0x35b2b8(_0x1fd362[_0xdcb6('0x12')](0x1f4,_0x432623[_0xdcb6('0x14')]));});});};exports[_0xdcb6('0x21')]=function(_0x5866a7,_0x51bb38,_0xc5d006){var _0x3ae8cb=this;return new Promise(function(_0x2e1bc1,_0xaa3d55){var _0x54694c={'body':_0x5866a7[_0xdcb6('0x22')],'channel':'fax'};var _0x4a364c=[];var _0x5b7a7b=[];var _0x5dc99c={};return db[_0xdcb6('0x23')][_0xdcb6('0x24')]()['then'](function(_0x46e389){if(!_0x46e389){throw new db[(_0xdcb6('0x25'))][(_0xdcb6('0x26'))](_0xdcb6('0x27'));}_0x4a364c=_[_0xdcb6('0x28')](_[_0xdcb6('0x29')](_0x46e389),[_0xdcb6('0x2a'),_0xdcb6('0x2b')]);_0x5b7a7b=_[_0xdcb6('0x28')](_[_0xdcb6('0x29')](_0x46e389),[_0xdcb6('0x2a'),_0xdcb6('0x2b'),_0xdcb6('0x2c'),'ListId']);if(_0x5866a7[_0xdcb6('0x22')]['id']){delete _0x5866a7[_0xdcb6('0x22')]['id'];}if(_[_0xdcb6('0x2d')](_0x5866a7[_0xdcb6('0x22')]['from'])){throw new db[(_0xdcb6('0x25'))][(_0xdcb6('0x26'))](_0xdcb6('0x2e'));}if(_[_0xdcb6('0x2d')](_0x5866a7['body'][_0xdcb6('0x22')])||_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x22')]===''){throw new db[(_0xdcb6('0x25'))]['ValidationError'](_0xdcb6('0x2f'));}if(_['isNil'](_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x30')])){throw new db[(_0xdcb6('0x25'))][(_0xdcb6('0x26'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b7a7b);}if(!_[_0xdcb6('0x31')](_0x5b7a7b,_0x5866a7['body'][_0xdcb6('0x30')])){throw new db[(_0xdcb6('0x25'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b7a7b);}_0x5dc99c[_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x30')]]=_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x32')];})[_0xdcb6('0xd')](function(){return db[_0xdcb6('0x17')][_0xdcb6('0x33')]({'where':{'id':_0x5866a7[_0xdcb6('0x34')]['id']},'include':[{'model':db['CmList'],'as':_0xdcb6('0x35'),'include':[{'model':db[_0xdcb6('0x23')],'as':_0xdcb6('0x36'),'where':_0x5dc99c,'limit':0x1,'order':[[_0xdcb6('0x2b'),_0xdcb6('0x37')]]}]},{'model':db[_0xdcb6('0x38')],'as':_0xdcb6('0x39')}]});})[_0xdcb6('0xd')](function(_0x26bd2c){if(_0x26bd2c&&_0x26bd2c[_0xdcb6('0x35')]){var _0x4a0a6e=_0x26bd2c[_0xdcb6('0x3a')]({'plain':!![]});_0x54694c[_0xdcb6('0x34')]=_0x4a0a6e;_0x54694c[_0xdcb6('0x3b')]=_0x4a0a6e[_0xdcb6('0x39')];_0x54694c['list']=_0x4a0a6e['List'];_0x54694c[_0xdcb6('0x3b')]=_[_0xdcb6('0x3c')](_0x54694c[_0xdcb6('0x3b')],[_0xdcb6('0x3d')],['asc']);if(_0x54694c[_0xdcb6('0x34')][_0xdcb6('0x39')]){delete _0x54694c[_0xdcb6('0x34')]['Applications'];}if(_0x54694c[_0xdcb6('0x34')]['List']&&_0x54694c[_0xdcb6('0x34')][_0xdcb6('0x35')][_0xdcb6('0x36')]['length']){return _0x54694c[_0xdcb6('0x34')]['List'][_0xdcb6('0x36')][0x0];}var _0x2357a3=_[_0xdcb6('0x3e')](_0x5866a7[_0xdcb6('0x22')],{'firstName':_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x32')],'ListId':_0x4a0a6e[_0xdcb6('0x3f')]});_0x2357a3[_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x30')]]=_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x32')];return db['CmContact'][_0xdcb6('0x40')](_0x2357a3,{'fields':_0x4a364c,'raw':!![]});}})[_0xdcb6('0xd')](function(_0x4b9149){_0x54694c[_0xdcb6('0x41')]=_0x4b9149;if(_0x4b9149){var _0x516efe={'ContactId':_0x4b9149['id'],'FaxAccountId':_0x5866a7[_0xdcb6('0x34')]['id'],'fax':_0x4b9149[_0xdcb6('0x42')]};return db['FaxInteraction'][_0xdcb6('0x33')]({'where':{'ContactId':_0x4b9149['id'],'closed':![],'FaxAccountId':_0x5866a7['account']['id']}})[_0xdcb6('0xd')](function(_0x1829f5){if(_0x1829f5){return[_0x1829f5,![]];}return db[_0xdcb6('0x43')][_0xdcb6('0x40')](_0x516efe)[_0xdcb6('0xd')](function(_0x5b4ffa){return[_0x5b4ffa,!![]];});});}else{throw new Error(_0xdcb6('0x44'));}})[_0xdcb6('0x45')](function(_0x2332a0,_0x50eb92){var _0x23c94a=_0x2332a0[_0xdcb6('0x3a')]({'plain':!![]});if(_0x50eb92){if(_0x54694c[_0xdcb6('0x34')][_0xdcb6('0x46')]){_0x54694c[_0xdcb6('0x3b')]['push']({'id':0x0,'priority':_0x54694c[_0xdcb6('0x3b')][_0xdcb6('0x47')]+0x1,'app':_0xdcb6('0x48'),'appdata':_0xdcb6('0x49'),'interval':'*,*,*,*'});}_0x23c94a[_0xdcb6('0x4a')]=!![];}else{_0x23c94a[_0xdcb6('0x4a')]=![];}_0x54694c[_0xdcb6('0x4b')]=_0x23c94a;return db[_0xdcb6('0x4c')][_0xdcb6('0x40')]({'body':_0x5866a7['body'][_0xdcb6('0x22')],'FaxAccountId':_0x5866a7[_0xdcb6('0x34')]['id'],'FaxInteractionId':_0x2332a0['id'],'direction':'in','ContactId':_0x2332a0[_0xdcb6('0x4d')],'AttachmentId':_0x5866a7[_0xdcb6('0x22')][_0xdcb6('0x4e')]});})['then'](function(_0x9d66c6){_0x54694c['message']=_0x9d66c6;if(!_0x54694c['interaction']['UserId'])return;return db['User'][_0xdcb6('0x33')]({'attributes':['id','name'],'where':{'id':_0x54694c[_0xdcb6('0x4b')][_0xdcb6('0x4f')]}});})['then'](function(_0x4d6841){if(_0x4d6841){_0x54694c[_0xdcb6('0x3b')][_0xdcb6('0x50')]({'id':0x0,'priority':0x0,'app':_0xdcb6('0x51'),'appdata':_0x4d6841[_0xdcb6('0x52')]+','+(_0x54694c[_0xdcb6('0x34')]['waitForTheAssignedAgent']||0xa),'interval':_0xdcb6('0x53')});}if(!_0x54694c[_0xdcb6('0x4b')][_0xdcb6('0x54')])return;return db[_0xdcb6('0x55')][_0xdcb6('0x33')]({'attributes':['id',_0xdcb6('0x52')],'where':{'id':_0x54694c['interaction']['queueId']}});})[_0xdcb6('0xd')](function(_0x32fa67){if(_0x32fa67){_0x54694c[_0xdcb6('0x3b')]['unshift']({'id':0x0,'priority':0x1,'app':_0xdcb6('0x56'),'appdata':_0x32fa67[_0xdcb6('0x52')]+','+(_0x54694c[_0xdcb6('0x34')][_0xdcb6('0x57')]||0x12c),'interval':_0xdcb6('0x53')});}return respondWithRpcPromise('Start',_0xdcb6('0x58'),_0x54694c);})['then'](function(_0x54b743){_0x2e1bc1(_0x54b743);})[_0xdcb6('0x16')](function(_0x5b25a5){_0xaa3d55(_0x3ae8cb[_0xdcb6('0x12')](0x1f4,_0x5b25a5[_0xdcb6('0x14')]));});});}; \ No newline at end of file +var _0x4a5d=['unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','startRouting','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','FaxAccount','options','raw','attributes','include','map','model','GetFaxAccount','body','fax','CmContact','then','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','List','Contacts','DESC','get','Applications','applications','orderBy','priority','asc','length','create','FaxInteraction','spread','push','close'];(function(_0x416f87,_0x42b830){var _0x2bb8d7=function(_0x1aa5a8){while(--_0x1aa5a8){_0x416f87['push'](_0x416f87['shift']());}};_0x2bb8d7(++_0x42b830);}(_0x4a5d,0x164));var _0xd4a5=function(_0x537c37,_0x536e74){_0x537c37=_0x537c37-0x0;var _0x241f84=_0x4a5d[_0x537c37];return _0x241f84;};'use strict';var _=require('lodash');var util=require(_0xd4a5('0x0'));var moment=require(_0xd4a5('0x1'));var BPromise=require(_0xd4a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4a5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4a5('0x4'))(_0xd4a5('0x5'));var config=require(_0xd4a5('0x6'));var jayson=require(_0xd4a5('0x7'));var client=jayson[_0xd4a5('0x8')][_0xd4a5('0x9')]({'port':0x232c});config['redis']=_[_0xd4a5('0xa')](config[_0xd4a5('0xb')],{'host':_0xd4a5('0xc'),'port':0x18eb});var socket=require(_0xd4a5('0xd'))(new Redis(config[_0xd4a5('0xb')]));require('./faxAccount.socket')[_0xd4a5('0xe')](socket);function respondWithRpcPromise(_0x5c7da6,_0x371952,_0x416d8e){return new BPromise(function(_0x2a5df5,_0x64d677){return client['request'](_0x5c7da6,_0x416d8e)['then'](function(_0x4346aa){logger['info'](_0xd4a5('0xf'),_0x371952,_0xd4a5('0x10'));logger[_0xd4a5('0x11')](_0xd4a5('0x12'),_0x371952,_0xd4a5('0x10'),JSON['stringify'](_0x4346aa));if(_0x4346aa[_0xd4a5('0x13')]){if(_0x4346aa[_0xd4a5('0x13')][_0xd4a5('0x14')]===0x1f4){logger[_0xd4a5('0x13')](_0xd4a5('0xf'),_0x371952,_0x4346aa[_0xd4a5('0x13')][_0xd4a5('0x15')]);return _0x64d677(_0x4346aa['error'][_0xd4a5('0x15')]);}logger['error'](_0xd4a5('0xf'),_0x371952,_0x4346aa[_0xd4a5('0x13')]['message']);return _0x2a5df5(_0x4346aa['error'][_0xd4a5('0x15')]);}else{logger[_0xd4a5('0x16')]('FaxAccount,\x20%s,\x20%s',_0x371952,_0xd4a5('0x10'));_0x2a5df5(_0x4346aa[_0xd4a5('0x17')][_0xd4a5('0x15')]);}})[_0xd4a5('0x18')](function(_0x36b13a){logger['error'](_0xd4a5('0xf'),_0x371952,_0x36b13a);_0x64d677(_0x36b13a);});});}exports['GetFaxAccount']=function(_0x511cb4){var _0x343c6e=this;return new Promise(function(_0x4eaf7d,_0xad2d7d){return db[_0xd4a5('0x19')]['findAll']({'raw':_0x511cb4[_0xd4a5('0x1a')]?_0x511cb4['options'][_0xd4a5('0x1b')]===undefined?!![]:![]:!![],'where':_0x511cb4[_0xd4a5('0x1a')]?_0x511cb4[_0xd4a5('0x1a')]['where']||null:null,'attributes':_0x511cb4[_0xd4a5('0x1a')]?_0x511cb4[_0xd4a5('0x1a')][_0xd4a5('0x1c')]||null:null,'limit':_0x511cb4['options']?_0x511cb4[_0xd4a5('0x1a')]['limit']||null:null,'include':_0x511cb4[_0xd4a5('0x1a')]?_0x511cb4[_0xd4a5('0x1a')][_0xd4a5('0x1d')]?_[_0xd4a5('0x1e')](_0x511cb4[_0xd4a5('0x1a')]['include'],function(_0x479f27){return{'model':db[_0x479f27[_0xd4a5('0x1f')]],'as':_0x479f27['as'],'attributes':_0x479f27[_0xd4a5('0x1c')],'include':_0x479f27['include']?_['map'](_0x479f27[_0xd4a5('0x1d')],function(_0x23d593){return{'model':db[_0x23d593[_0xd4a5('0x1f')]],'as':_0x23d593['as'],'attributes':_0x23d593['attributes'],'include':_0x23d593[_0xd4a5('0x1d')]?_[_0xd4a5('0x1e')](_0x23d593['include'],function(_0x1b6335){return{'model':db[_0x1b6335[_0xd4a5('0x1f')]],'as':_0x1b6335['as'],'attributes':_0x1b6335[_0xd4a5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f4ba0){logger[_0xd4a5('0x16')](_0xd4a5('0x20'),_0x511cb4);logger[_0xd4a5('0x11')](_0xd4a5('0x20'),_0x511cb4,JSON['stringify'](_0x3f4ba0));_0x4eaf7d(_0x3f4ba0);})[_0xd4a5('0x18')](function(_0x5a70ce){logger[_0xd4a5('0x13')](_0xd4a5('0x20'),_0x5a70ce[_0xd4a5('0x15')],_0x511cb4);_0xad2d7d(_0x343c6e['error'](0x1f4,_0x5a70ce[_0xd4a5('0x15')]));});});};exports['NotifyFaxAccount']=function(_0x116620,_0x1c999e,_0x55cefd){var _0x16f685=this;return new Promise(function(_0x50df6c,_0x4c8e56){var _0x4e49e1={'body':_0x116620[_0xd4a5('0x21')],'channel':_0xd4a5('0x22')};var _0x10c587=[];var _0x4746b4=[];var _0x3042bc={};return db[_0xd4a5('0x23')]['describe']()[_0xd4a5('0x24')](function(_0x1e1ec9){if(!_0x1e1ec9){throw new db[(_0xd4a5('0x25'))][(_0xd4a5('0x26'))](_0xd4a5('0x27'));}_0x10c587=_[_0xd4a5('0x28')](_[_0xd4a5('0x29')](_0x1e1ec9),[_0xd4a5('0x2a'),_0xd4a5('0x2b')]);_0x4746b4=_[_0xd4a5('0x28')](_[_0xd4a5('0x29')](_0x1e1ec9),[_0xd4a5('0x2a'),_0xd4a5('0x2b'),'CompanyId',_0xd4a5('0x2c')]);if(_0x116620[_0xd4a5('0x21')]['id']){delete _0x116620[_0xd4a5('0x21')]['id'];}if(_[_0xd4a5('0x2d')](_0x116620[_0xd4a5('0x21')]['from'])){throw new db[(_0xd4a5('0x25'))]['ValidationError'](_0xd4a5('0x2e'));}if(_['isNil'](_0x116620[_0xd4a5('0x21')]['body'])||_0x116620[_0xd4a5('0x21')][_0xd4a5('0x21')]===''){throw new db['Sequelize']['ValidationError'](_0xd4a5('0x2f'));}if(_['isNil'](_0x116620[_0xd4a5('0x21')]['mapKey'])){throw new db[(_0xd4a5('0x25'))][(_0xd4a5('0x26'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4746b4);}if(!_[_0xd4a5('0x30')](_0x4746b4,_0x116620['body'][_0xd4a5('0x31')])){throw new db[(_0xd4a5('0x25'))][(_0xd4a5('0x26'))](_0xd4a5('0x32')+_0x4746b4);}_0x3042bc[_0x116620[_0xd4a5('0x21')][_0xd4a5('0x31')]]=_0x116620[_0xd4a5('0x21')][_0xd4a5('0x33')];})[_0xd4a5('0x24')](function(){return db[_0xd4a5('0x19')][_0xd4a5('0x34')]({'where':{'id':_0x116620[_0xd4a5('0x35')]['id']},'include':[{'model':db['CmList'],'as':_0xd4a5('0x36'),'include':[{'model':db[_0xd4a5('0x23')],'as':_0xd4a5('0x37'),'where':_0x3042bc,'limit':0x1,'order':[['updatedAt',_0xd4a5('0x38')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0xd4a5('0x24')](function(_0x34ada0){if(_0x34ada0&&_0x34ada0[_0xd4a5('0x36')]){var _0x558500=_0x34ada0[_0xd4a5('0x39')]({'plain':!![]});_0x4e49e1[_0xd4a5('0x35')]=_0x558500;_0x4e49e1['applications']=_0x558500[_0xd4a5('0x3a')];_0x4e49e1['list']=_0x558500[_0xd4a5('0x36')];_0x4e49e1[_0xd4a5('0x3b')]=_[_0xd4a5('0x3c')](_0x4e49e1[_0xd4a5('0x3b')],[_0xd4a5('0x3d')],[_0xd4a5('0x3e')]);if(_0x4e49e1[_0xd4a5('0x35')][_0xd4a5('0x3a')]){delete _0x4e49e1[_0xd4a5('0x35')][_0xd4a5('0x3a')];}if(_0x4e49e1[_0xd4a5('0x35')]['List']&&_0x4e49e1[_0xd4a5('0x35')][_0xd4a5('0x36')][_0xd4a5('0x37')][_0xd4a5('0x3f')]){return _0x4e49e1[_0xd4a5('0x35')][_0xd4a5('0x36')][_0xd4a5('0x37')][0x0];}var _0x3bfb4b=_['defaults'](_0x116620[_0xd4a5('0x21')],{'firstName':_0x116620[_0xd4a5('0x21')][_0xd4a5('0x33')],'ListId':_0x558500['ListId']});_0x3bfb4b[_0x116620[_0xd4a5('0x21')][_0xd4a5('0x31')]]=_0x116620[_0xd4a5('0x21')][_0xd4a5('0x33')];return db['CmContact'][_0xd4a5('0x40')](_0x3bfb4b,{'fields':_0x10c587,'raw':!![]});}})[_0xd4a5('0x24')](function(_0xc9a78c){_0x4e49e1['contact']=_0xc9a78c;if(_0xc9a78c){var _0x4d949c={'ContactId':_0xc9a78c['id'],'FaxAccountId':_0x116620[_0xd4a5('0x35')]['id'],'fax':_0xc9a78c[_0xd4a5('0x22')]};return db[_0xd4a5('0x41')][_0xd4a5('0x34')]({'where':{'ContactId':_0xc9a78c['id'],'closed':![],'FaxAccountId':_0x116620[_0xd4a5('0x35')]['id']}})['then'](function(_0x36a162){if(_0x36a162){return[_0x36a162,![]];}return db[_0xd4a5('0x41')]['create'](_0x4d949c)[_0xd4a5('0x24')](function(_0x54e12d){return[_0x54e12d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd4a5('0x42')](function(_0x3a8235,_0x18117c){var _0x2bcade=_0x3a8235[_0xd4a5('0x39')]({'plain':!![]});if(_0x18117c){if(_0x4e49e1[_0xd4a5('0x35')]['autoclose']){_0x4e49e1[_0xd4a5('0x3b')][_0xd4a5('0x43')]({'id':0x0,'priority':_0x4e49e1[_0xd4a5('0x3b')][_0xd4a5('0x3f')]+0x1,'app':_0xd4a5('0x44'),'appdata':_0xd4a5('0x45'),'interval':_0xd4a5('0x46')});}_0x2bcade['created']=!![];}else{_0x2bcade[_0xd4a5('0x47')]=![];}_0x4e49e1[_0xd4a5('0x48')]=_0x2bcade;return db[_0xd4a5('0x49')][_0xd4a5('0x40')]({'body':_0x116620[_0xd4a5('0x21')][_0xd4a5('0x21')],'FaxAccountId':_0x116620[_0xd4a5('0x35')]['id'],'FaxInteractionId':_0x3a8235['id'],'direction':'in','ContactId':_0x3a8235[_0xd4a5('0x4a')],'AttachmentId':_0x116620[_0xd4a5('0x21')][_0xd4a5('0x4b')]});})[_0xd4a5('0x24')](function(_0x1849ba){_0x4e49e1[_0xd4a5('0x15')]=_0x1849ba;if(!_0x4e49e1[_0xd4a5('0x48')][_0xd4a5('0x4c')])return;return db[_0xd4a5('0x4d')][_0xd4a5('0x34')]({'attributes':['id',_0xd4a5('0x4e')],'where':{'id':_0x4e49e1[_0xd4a5('0x48')]['UserId']}});})[_0xd4a5('0x24')](function(_0x3cad0a){if(_0x3cad0a){_0x4e49e1[_0xd4a5('0x3b')][_0xd4a5('0x4f')]({'id':0x0,'priority':0x0,'app':_0xd4a5('0x50'),'appdata':_0x3cad0a[_0xd4a5('0x4e')]+','+(_0x4e49e1[_0xd4a5('0x35')][_0xd4a5('0x51')]||0xa),'interval':_0xd4a5('0x46')});}if(!_0x4e49e1[_0xd4a5('0x48')][_0xd4a5('0x52')])return;return db['FaxQueue'][_0xd4a5('0x34')]({'attributes':['id',_0xd4a5('0x4e')],'where':{'id':_0x4e49e1[_0xd4a5('0x48')][_0xd4a5('0x52')]}});})[_0xd4a5('0x24')](function(_0x277a97){if(_0x277a97){_0x4e49e1[_0xd4a5('0x3b')][_0xd4a5('0x4f')]({'id':0x0,'priority':0x1,'app':_0xd4a5('0x53'),'appdata':_0x277a97[_0xd4a5('0x4e')]+','+(_0x4e49e1[_0xd4a5('0x35')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd4a5('0x54'),_0x4e49e1);})[_0xd4a5('0x24')](function(_0x1e5a60){_0x50df6c(_0x1e5a60);})['catch'](function(_0x3b2f4c){_0x4c8e56(_0x16f685[_0xd4a5('0x13')](0x1f4,_0x3b2f4c[_0xd4a5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 75add87..ea5a7e8 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 _0xe95b=['remove','update','emit','removeListener','register','faxAccount:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe95b,0x99));var _0xbe95=function(_0x3d9b22,_0xa968b7){_0x3d9b22=_0x3d9b22-0x0;var _0x30390f=_0xe95b[_0x3d9b22];return _0x30390f;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xbe95('0x0'),_0xbe95('0x1'),_0xbe95('0x2')];function createListener(_0x556373,_0xa73011){return function(_0x35a0eb){_0xa73011[_0xbe95('0x3')](_0x556373,_0x35a0eb);};}function removeListener(_0x2f8970,_0x2f5113){return function(){FaxAccountEvents[_0xbe95('0x4')](_0x2f8970,_0x2f5113);};}exports[_0xbe95('0x5')]=function(_0x3f5d8a){for(var _0x2ce5e2=0x0,_0x5a8b8c=events['length'];_0x2ce5e2<_0x5a8b8c;_0x2ce5e2++){var _0x3a0e5e=events[_0x2ce5e2];var _0x1fe721=createListener(_0xbe95('0x6')+_0x3a0e5e,_0x3f5d8a);FaxAccountEvents['on'](_0x3a0e5e,_0x1fe721);}}; \ No newline at end of file +var _0xb806=['remove','update','emit','removeListener','register','length','./faxAccount.events','save'];(function(_0x485ba3,_0x333f48){var _0x344ab2=function(_0x4efcc5){while(--_0x4efcc5){_0x485ba3['push'](_0x485ba3['shift']());}};_0x344ab2(++_0x333f48);}(_0xb806,0x96));var _0x6b80=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xb806[_0x2642cb];return _0xe6e41;};'use strict';var FaxAccountEvents=require(_0x6b80('0x0'));var events=[_0x6b80('0x1'),_0x6b80('0x2'),_0x6b80('0x3')];function createListener(_0x7bb8de,_0x2cedf1){return function(_0xf04494){_0x2cedf1[_0x6b80('0x4')](_0x7bb8de,_0xf04494);};}function removeListener(_0x4ca530,_0x1f4568){return function(){FaxAccountEvents[_0x6b80('0x5')](_0x4ca530,_0x1f4568);};}exports[_0x6b80('0x6')]=function(_0x3b6d82){for(var _0x2a3b85=0x0,_0x10b6e9=events[_0x6b80('0x7')];_0x2a3b85<_0x10b6e9;_0x2a3b85++){var _0x3076cd=events[_0x2a3b85];var _0xfac7ff=createListener('faxAccount:'+_0x3076cd,_0x3b6d82);FaxAccountEvents['on'](_0x3076cd,_0xfac7ff);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9b23e53..2d1a675 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 _0x0926=['getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','addInteraction','addApplications','addAccountApplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxAccount.controller','get','/describe','/:id','isAuthenticated','show','/:id/dispositions'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0x0926,0x118));var _0x6092=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0x0926[_0x31b5b2];return _0x364f13;};'use strict';var multer=require(_0x6092('0x0'));var util=require(_0x6092('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6092('0x2'));var router=express[_0x6092('0x3')]();var fs_extra=require(_0x6092('0x4'));var auth=require(_0x6092('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6092('0x6'));var controller=require(_0x6092('0x7'));router[_0x6092('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6092('0x8')](_0x6092('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x6092('0x8')](_0x6092('0xa'),auth[_0x6092('0xb')](),controller[_0x6092('0xc')]);router[_0x6092('0x8')](_0x6092('0xd'),auth[_0x6092('0xb')](),controller[_0x6092('0xe')]);router['get'](_0x6092('0xf'),auth[_0x6092('0xb')](),controller['getAnswers']);router['get'](_0x6092('0x10'),auth[_0x6092('0xb')](),controller[_0x6092('0x11')]);router[_0x6092('0x8')](_0x6092('0x12'),auth[_0x6092('0xb')](),controller[_0x6092('0x13')]);router[_0x6092('0x8')](_0x6092('0x14'),auth[_0x6092('0xb')](),controller[_0x6092('0x15')]);router[_0x6092('0x8')](_0x6092('0x16'),auth[_0x6092('0xb')](),controller[_0x6092('0x17')]);router['post']('/',auth[_0x6092('0xb')](),controller[_0x6092('0x18')]);router[_0x6092('0x19')](_0x6092('0xd'),auth[_0x6092('0xb')](),controller[_0x6092('0x1a')]);router[_0x6092('0x19')]('/:id/canned_answers',auth[_0x6092('0xb')](),controller[_0x6092('0x1b')]);router[_0x6092('0x19')](_0x6092('0x10'),auth[_0x6092('0xb')](),controller[_0x6092('0x1c')]);router['post'](_0x6092('0x12'),auth['isAuthenticated'](),controller[_0x6092('0x1d')]);router[_0x6092('0x19')]('/addaccountapplications',auth[_0x6092('0xb')](),controller[_0x6092('0x1e')]);router[_0x6092('0x19')]('/updateaccountapplications',auth[_0x6092('0xb')](),controller[_0x6092('0x1f')]);router['post'](_0x6092('0x20'),auth['isAuthenticated'](),controller[_0x6092('0x21')]);router[_0x6092('0x19')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x6092('0x22')](_0x6092('0xa'),auth[_0x6092('0xb')](),controller[_0x6092('0x23')]);router[_0x6092('0x24')](_0x6092('0xa'),auth[_0x6092('0xb')](),controller[_0x6092('0x25')]);router[_0x6092('0x24')](_0x6092('0xd'),auth[_0x6092('0xb')](),controller[_0x6092('0x26')]);router[_0x6092('0x24')](_0x6092('0xf'),auth[_0x6092('0xb')](),controller[_0x6092('0x27')]);router[_0x6092('0x24')](_0x6092('0x16'),auth[_0x6092('0xb')](),controller[_0x6092('0x28')]);module[_0x6092('0x29')]=router; \ No newline at end of file +var _0xd512=['getMessages','/:id/users','getAgents','post','addAnswer','/:id/interactions','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id','update','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages'];(function(_0x23b41b,_0x28e66e){var _0x40c253=function(_0x58477e){while(--_0x58477e){_0x23b41b['push'](_0x23b41b['shift']());}};_0x40c253(++_0x28e66e);}(_0xd512,0x102));var _0x2d51=function(_0x1d0aee,_0x2c4454){_0x1d0aee=_0x1d0aee-0x0;var _0x34ee2c=_0xd512[_0x1d0aee];return _0x34ee2c;};'use strict';var multer=require(_0x2d51('0x0'));var util=require(_0x2d51('0x1'));var path=require(_0x2d51('0x2'));var timeout=require(_0x2d51('0x3'));var express=require(_0x2d51('0x4'));var router=express[_0x2d51('0x5')]();var fs_extra=require(_0x2d51('0x6'));var auth=require(_0x2d51('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2d51('0x8'));var controller=require('./faxAccount.controller');router[_0x2d51('0x9')]('/',auth[_0x2d51('0xa')](),controller['index']);router[_0x2d51('0x9')](_0x2d51('0xb'),auth[_0x2d51('0xa')](),controller[_0x2d51('0xc')]);router[_0x2d51('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2d51('0xd')]);router[_0x2d51('0x9')](_0x2d51('0xe'),auth[_0x2d51('0xa')](),controller[_0x2d51('0xf')]);router[_0x2d51('0x9')](_0x2d51('0x10'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x11')]);router[_0x2d51('0x9')]('/:id/interactions',auth[_0x2d51('0xa')](),controller[_0x2d51('0x12')]);router[_0x2d51('0x9')](_0x2d51('0x13'),auth['isAuthenticated'](),controller[_0x2d51('0x14')]);router['get'](_0x2d51('0x15'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x16')]);router[_0x2d51('0x9')](_0x2d51('0x17'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x18')]);router[_0x2d51('0x19')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2d51('0xe'),auth[_0x2d51('0xa')](),controller['addDisposition']);router[_0x2d51('0x19')]('/:id/canned_answers',auth[_0x2d51('0xa')](),controller[_0x2d51('0x1a')]);router[_0x2d51('0x19')](_0x2d51('0x1b'),auth[_0x2d51('0xa')](),controller['addInteraction']);router[_0x2d51('0x19')](_0x2d51('0x13'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x1c')]);router[_0x2d51('0x19')](_0x2d51('0x1d'),auth['isAuthenticated'](),controller[_0x2d51('0x1e')]);router[_0x2d51('0x19')](_0x2d51('0x1f'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x20')]);router[_0x2d51('0x19')](_0x2d51('0x21'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x22')]);router[_0x2d51('0x19')](_0x2d51('0x17'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x2d51('0x23'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x24')]);router['delete']('/:id',auth[_0x2d51('0xa')](),controller['destroy']);router[_0x2d51('0x25')](_0x2d51('0xe'),auth['isAuthenticated'](),controller[_0x2d51('0x26')]);router[_0x2d51('0x25')](_0x2d51('0x10'),auth[_0x2d51('0xa')](),controller[_0x2d51('0x27')]);router[_0x2d51('0x25')](_0x2d51('0x17'),auth[_0x2d51('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 5bac339..b9f759e 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 _0x6d76=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0xee2850,_0x4a076a){var _0x51f866=function(_0x392174){while(--_0x392174){_0xee2850['push'](_0xee2850['shift']());}};_0x51f866(++_0x4a076a);}(_0x6d76,0x13a));var _0x66d7=function(_0x55a6da,_0x2b84ec){_0x55a6da=_0x55a6da-0x0;var _0x132462=_0x6d76[_0x55a6da];return _0x132462;};'use strict';var Sequelize=require('sequelize');module[_0x66d7('0x0')]={'priority':{'type':Sequelize[_0x66d7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x66d7('0x2')],'allowNull':![],'defaultValue':_0x66d7('0x3')},'appdata':{'type':Sequelize[_0x66d7('0x4')]()},'description':{'type':Sequelize[_0x66d7('0x2')]},'interval':{'type':Sequelize[_0x66d7('0x2')],'defaultValue':_0x66d7('0x5')}}; \ No newline at end of file +var _0x04d4=['sequelize','exports','STRING','TEXT'];(function(_0x27f889,_0x5d99f4){var _0x272102=function(_0x5de32c){while(--_0x5de32c){_0x27f889['push'](_0x27f889['shift']());}};_0x272102(++_0x5d99f4);}(_0x04d4,0x7c));var _0x404d=function(_0x1102a8,_0x3a2142){_0x1102a8=_0x1102a8-0x0;var _0x102dc1=_0x04d4[_0x1102a8];return _0x102dc1;};'use strict';var Sequelize=require(_0x404d('0x0'));module[_0x404d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x404d('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x404d('0x3')]()},'description':{'type':Sequelize[_0x404d('0x2')]},'interval':{'type':Sequelize[_0x404d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ae04315..6935711 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 _0x86dd=['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','end','undefined','count','offset','set','json','reject','save','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','findAll','show','create','catch','body','params','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x3f6fea,_0x35f25e){var _0x208e6b=function(_0xd6e09){while(--_0xd6e09){_0x3f6fea['push'](_0x3f6fea['shift']());}};_0x208e6b(++_0x35f25e);}(_0x86dd,0x1a7));var _0xd86d=function(_0x1cb6e9,_0x18f418){_0x1cb6e9=_0x1cb6e9-0x0;var _0x350dfd=_0x86dd[_0x1cb6e9];return _0x350dfd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd86d('0x0'));var zipdir=require(_0xd86d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd86d('0x2'));var moment=require(_0xd86d('0x3'));var BPromise=require(_0xd86d('0x4'));var Mustache=require(_0xd86d('0x5'));var util=require(_0xd86d('0x6'));var path=require(_0xd86d('0x7'));var sox=require('sox');var csv=require(_0xd86d('0x8'));var ejs=require(_0xd86d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd86d('0xa'));var squel=require(_0xd86d('0xb'));var crypto=require('crypto');var jsforce=require(_0xd86d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd86d('0x8'));var querystring=require(_0xd86d('0xd'));var Papa=require(_0xd86d('0xe'));var Redis=require(_0xd86d('0xf'));var authService=require(_0xd86d('0x10'));var qs=require(_0xd86d('0x11'));var as=require(_0xd86d('0x12'));var hardwareService=require(_0xd86d('0x13'));var logger=require(_0xd86d('0x14'))(_0xd86d('0x15'));var utils=require(_0xd86d('0x16'));var config=require(_0xd86d('0x17'));var licenseUtil=require(_0xd86d('0x18'));var db=require(_0xd86d('0x19'))['db'];function respondWithStatusCode(_0x5b1dcb,_0x5879c6){_0x5879c6=_0x5879c6||0xcc;return function(_0x72998){if(_0x72998){return _0x5b1dcb[_0xd86d('0x1a')](_0x5879c6);}return _0x5b1dcb[_0xd86d('0x1b')](_0x5879c6)[_0xd86d('0x1c')]();};}function respondWithResult(_0x4842cc,_0x1f11ea){_0x1f11ea=_0x1f11ea||0xc8;return function(_0x101676){if(_0x101676){return _0x4842cc[_0xd86d('0x1b')](_0x1f11ea)['json'](_0x101676);}};}function respondWithFilteredResult(_0x97b8dc,_0x3931dd){return function(_0xa78889){if(_0xa78889){var _0x54ecff=typeof _0x3931dd['offset']==='undefined'&&typeof _0x3931dd['limit']===_0xd86d('0x1d');var _0x217f9c=_0xa78889[_0xd86d('0x1e')];var _0x3afde1=_0x54ecff?0x0:_0x3931dd[_0xd86d('0x1f')];var _0x4eaeaf=_0x54ecff?_0xa78889[_0xd86d('0x1e')]:_0x3931dd[_0xd86d('0x1f')]+_0x3931dd['limit'];var _0x2cc5ab;if(_0x4eaeaf>=_0x217f9c){_0x4eaeaf=_0x217f9c;_0x2cc5ab=0xc8;}else{_0x2cc5ab=0xce;}_0x97b8dc[_0xd86d('0x1b')](_0x2cc5ab);return _0x97b8dc[_0xd86d('0x20')]('Content-Range',_0x3afde1+'-'+_0x4eaeaf+'/'+_0x217f9c)[_0xd86d('0x21')](_0xa78889);}return null;};}function patchUpdates(_0x5617e5){return function(_0x244ad5){try{jsonpatch['apply'](_0x244ad5,_0x5617e5,!![]);}catch(_0x15a63d){return BPromise[_0xd86d('0x22')](_0x15a63d);}return _0x244ad5[_0xd86d('0x23')]();};}function saveUpdates(_0x2da43f,_0x249a56){return function(_0x5cbeab){if(_0x5cbeab){return _0x5cbeab[_0xd86d('0x24')](_0x2da43f)[_0xd86d('0x25')](function(_0x5ec414){return _0x5ec414;});}return null;};}function removeEntity(_0x4ccc3b,_0x323f52){return function(_0x4643e1){if(_0x4643e1){return _0x4643e1[_0xd86d('0x26')]()[_0xd86d('0x25')](function(){_0x4ccc3b[_0xd86d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58448a,_0x44628d){return function(_0x428053){if(!_0x428053){_0x58448a[_0xd86d('0x1a')](0x194);}return _0x428053;};}function handleError(_0x15cee6,_0x1ec96d){_0x1ec96d=_0x1ec96d||0x1f4;return function(_0x146141){logger['error'](_0x146141['stack']);if(_0x146141[_0xd86d('0x27')]){delete _0x146141[_0xd86d('0x27')];}_0x15cee6['status'](_0x1ec96d)[_0xd86d('0x28')](_0x146141);};}exports['index']=function(_0x1b32ee,_0x35d024){var _0x2e4a0c={},_0x2ae959={},_0x2cd273={'count':0x0,'rows':[]};var _0x2e060e=_[_0xd86d('0x29')](db['FaxApplication'][_0xd86d('0x2a')],function(_0x45d18f){return{'name':_0x45d18f[_0xd86d('0x2b')],'type':_0x45d18f[_0xd86d('0x2c')][_0xd86d('0x2d')]};});_0x2ae959['model']=_[_0xd86d('0x29')](_0x2e060e,_0xd86d('0x27'));_0x2ae959[_0xd86d('0x2e')]=_[_0xd86d('0x2f')](_0x1b32ee['query']);_0x2ae959[_0xd86d('0x30')]=_[_0xd86d('0x31')](_0x2ae959[_0xd86d('0x32')],_0x2ae959[_0xd86d('0x2e')]);_0x2e4a0c[_0xd86d('0x33')]=_[_0xd86d('0x31')](_0x2ae959[_0xd86d('0x32')],qs[_0xd86d('0x34')](_0x1b32ee['query']['fields']));_0x2e4a0c[_0xd86d('0x33')]=_0x2e4a0c['attributes'][_0xd86d('0x35')]?_0x2e4a0c[_0xd86d('0x33')]:_0x2ae959[_0xd86d('0x32')];if(!_0x1b32ee[_0xd86d('0x2e')]['hasOwnProperty']('nolimit')){_0x2e4a0c['limit']=qs['limit'](_0x1b32ee[_0xd86d('0x2e')][_0xd86d('0x36')]);_0x2e4a0c[_0xd86d('0x1f')]=qs[_0xd86d('0x1f')](_0x1b32ee[_0xd86d('0x2e')][_0xd86d('0x1f')]);}_0x2e4a0c['order']=qs[_0xd86d('0x37')](_0x1b32ee['query'][_0xd86d('0x37')]);_0x2e4a0c[_0xd86d('0x38')]=qs[_0xd86d('0x30')](_[_0xd86d('0x39')](_0x1b32ee[_0xd86d('0x2e')],_0x2ae959[_0xd86d('0x30')]),_0x2e060e);if(_0x1b32ee[_0xd86d('0x2e')][_0xd86d('0x3a')]){_0x2e4a0c[_0xd86d('0x38')]=_[_0xd86d('0x3b')](_0x2e4a0c[_0xd86d('0x38')],{'$or':_[_0xd86d('0x29')](_0x2e060e,function(_0x3860e9){if(_0x3860e9[_0xd86d('0x2c')]!==_0xd86d('0x3c')){var _0x5cf591={};_0x5cf591[_0x3860e9['name']]={'$like':'%'+_0x1b32ee[_0xd86d('0x2e')][_0xd86d('0x3a')]+'%'};return _0x5cf591;}})});}_0x2e4a0c=_['merge']({},_0x2e4a0c,_0x1b32ee[_0xd86d('0x3d')]);var _0x2b197d={'where':_0x2e4a0c[_0xd86d('0x38')]};return db[_0xd86d('0x3e')]['count'](_0x2b197d)[_0xd86d('0x25')](function(_0x4651fe){_0x2cd273[_0xd86d('0x1e')]=_0x4651fe;if(_0x1b32ee['query'][_0xd86d('0x3f')]){_0x2e4a0c[_0xd86d('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0xd86d('0x41')](_0x2e4a0c);})[_0xd86d('0x25')](function(_0x547c6d){_0x2cd273['rows']=_0x547c6d;return _0x2cd273;})[_0xd86d('0x25')](respondWithFilteredResult(_0x35d024,_0x2e4a0c))['catch'](handleError(_0x35d024,null));};exports[_0xd86d('0x42')]=function(_0x3744d5,_0x182fa9){var _0x4c38f5={'raw':!![],'where':{'id':_0x3744d5['params']['id']}},_0xcccace={};_0xcccace[_0xd86d('0x32')]=_['keys'](db[_0xd86d('0x3e')]['rawAttributes']);_0xcccace['query']=_['keys'](_0x3744d5[_0xd86d('0x2e')]);_0xcccace['filters']=_[_0xd86d('0x31')](_0xcccace[_0xd86d('0x32')],_0xcccace[_0xd86d('0x2e')]);_0x4c38f5[_0xd86d('0x33')]=_[_0xd86d('0x31')](_0xcccace['model'],qs[_0xd86d('0x34')](_0x3744d5[_0xd86d('0x2e')][_0xd86d('0x34')]));_0x4c38f5[_0xd86d('0x33')]=_0x4c38f5[_0xd86d('0x33')][_0xd86d('0x35')]?_0x4c38f5['attributes']:_0xcccace[_0xd86d('0x32')];if(_0x3744d5[_0xd86d('0x2e')]['includeAll']){_0x4c38f5[_0xd86d('0x40')]=[{'all':!![]}];}_0x4c38f5=_['merge']({},_0x4c38f5,_0x3744d5[_0xd86d('0x3d')]);return db[_0xd86d('0x3e')]['find'](_0x4c38f5)[_0xd86d('0x25')](handleEntityNotFound(_0x182fa9,null))[_0xd86d('0x25')](respondWithResult(_0x182fa9,null))['catch'](handleError(_0x182fa9,null));};exports[_0xd86d('0x43')]=function(_0x46d9c2,_0x4156ec){return db[_0xd86d('0x3e')][_0xd86d('0x43')](_0x46d9c2['body'],{})['then'](respondWithResult(_0x4156ec,0xc9))[_0xd86d('0x44')](handleError(_0x4156ec,null));};exports[_0xd86d('0x24')]=function(_0x334966,_0x24cced){if(_0x334966[_0xd86d('0x45')]['id']){delete _0x334966[_0xd86d('0x45')]['id'];}return db[_0xd86d('0x3e')]['find']({'where':{'id':_0x334966[_0xd86d('0x46')]['id']}})['then'](handleEntityNotFound(_0x24cced,null))[_0xd86d('0x25')](saveUpdates(_0x334966[_0xd86d('0x45')],null))['then'](respondWithResult(_0x24cced,null))[_0xd86d('0x44')](handleError(_0x24cced,null));};exports[_0xd86d('0x26')]=function(_0x3cec68,_0x22c998){return db['FaxApplication'][_0xd86d('0x47')]({'where':{'id':_0x3cec68[_0xd86d('0x46')]['id']}})[_0xd86d('0x25')](handleEntityNotFound(_0x22c998,null))['then'](removeEntity(_0x22c998,null))['catch'](handleError(_0x22c998,null));}; \ No newline at end of file +var _0xae69=['attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','query','keys','intersection','model'];(function(_0x338abc,_0x3ec158){var _0x304599=function(_0x43c7eb){while(--_0x43c7eb){_0x338abc['push'](_0x338abc['shift']());}};_0x304599(++_0x3ec158);}(_0xae69,0x13f));var _0x9ae6=function(_0x3ee22c,_0x8806c6){_0x3ee22c=_0x3ee22c-0x0;var _0x405e51=_0xae69[_0x3ee22c];return _0x405e51;};'use strict';var emlformat=require(_0x9ae6('0x0'));var rimraf=require(_0x9ae6('0x1'));var zipdir=require(_0x9ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ae6('0x3'));var moment=require(_0x9ae6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ae6('0x5'));var util=require('util');var path=require(_0x9ae6('0x6'));var sox=require(_0x9ae6('0x7'));var csv=require(_0x9ae6('0x8'));var ejs=require(_0x9ae6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ae6('0xa'));var squel=require(_0x9ae6('0xb'));var crypto=require(_0x9ae6('0xc'));var jsforce=require(_0x9ae6('0xd'));var deskjs=require(_0x9ae6('0xe'));var toCsv=require(_0x9ae6('0x8'));var querystring=require(_0x9ae6('0xf'));var Papa=require(_0x9ae6('0x10'));var Redis=require('ioredis');var authService=require(_0x9ae6('0x11'));var qs=require(_0x9ae6('0x12'));var as=require(_0x9ae6('0x13'));var hardwareService=require(_0x9ae6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x9ae6('0x15'));var config=require(_0x9ae6('0x16'));var licenseUtil=require(_0x9ae6('0x17'));var db=require(_0x9ae6('0x18'))['db'];function respondWithStatusCode(_0xdaab46,_0x38986f){_0x38986f=_0x38986f||0xcc;return function(_0x35b87f){if(_0x35b87f){return _0xdaab46[_0x9ae6('0x19')](_0x38986f);}return _0xdaab46[_0x9ae6('0x1a')](_0x38986f)[_0x9ae6('0x1b')]();};}function respondWithResult(_0x3df40f,_0x2c0cae){_0x2c0cae=_0x2c0cae||0xc8;return function(_0x457936){if(_0x457936){return _0x3df40f[_0x9ae6('0x1a')](_0x2c0cae)[_0x9ae6('0x1c')](_0x457936);}};}function respondWithFilteredResult(_0x5e4965,_0x4bdc1d){return function(_0x5696a3){if(_0x5696a3){var _0x36d49e=typeof _0x4bdc1d[_0x9ae6('0x1d')]===_0x9ae6('0x1e')&&typeof _0x4bdc1d[_0x9ae6('0x1f')]==='undefined';var _0x1cef31=_0x5696a3[_0x9ae6('0x20')];var _0x412bb3=_0x36d49e?0x0:_0x4bdc1d[_0x9ae6('0x1d')];var _0x239df7=_0x36d49e?_0x5696a3[_0x9ae6('0x20')]:_0x4bdc1d[_0x9ae6('0x1d')]+_0x4bdc1d[_0x9ae6('0x1f')];var _0x14c78c;if(_0x239df7>=_0x1cef31){_0x239df7=_0x1cef31;_0x14c78c=0xc8;}else{_0x14c78c=0xce;}_0x5e4965[_0x9ae6('0x1a')](_0x14c78c);return _0x5e4965['set'](_0x9ae6('0x21'),_0x412bb3+'-'+_0x239df7+'/'+_0x1cef31)['json'](_0x5696a3);}return null;};}function patchUpdates(_0x111207){return function(_0x3a63e4){try{jsonpatch[_0x9ae6('0x22')](_0x3a63e4,_0x111207,!![]);}catch(_0x1e9817){return BPromise['reject'](_0x1e9817);}return _0x3a63e4[_0x9ae6('0x23')]();};}function saveUpdates(_0x2cc578,_0x3c4cdc){return function(_0x3faaf9){if(_0x3faaf9){return _0x3faaf9[_0x9ae6('0x24')](_0x2cc578)[_0x9ae6('0x25')](function(_0x11584b){return _0x11584b;});}return null;};}function removeEntity(_0x19e314,_0x2a6582){return function(_0xd24f35){if(_0xd24f35){return _0xd24f35[_0x9ae6('0x26')]()[_0x9ae6('0x25')](function(){_0x19e314[_0x9ae6('0x1a')](0xcc)[_0x9ae6('0x1b')]();});}};}function handleEntityNotFound(_0x31e030,_0x3d82bc){return function(_0x742317){if(!_0x742317){_0x31e030[_0x9ae6('0x19')](0x194);}return _0x742317;};}function handleError(_0x17e0e1,_0xcd0b7){_0xcd0b7=_0xcd0b7||0x1f4;return function(_0x563c9f){logger['error'](_0x563c9f[_0x9ae6('0x27')]);if(_0x563c9f['name']){delete _0x563c9f[_0x9ae6('0x28')];}_0x17e0e1[_0x9ae6('0x1a')](_0xcd0b7)[_0x9ae6('0x29')](_0x563c9f);};}exports[_0x9ae6('0x2a')]=function(_0x3f4210,_0x51e463){var _0x45e8d6={},_0x329ee3={},_0x28bd51={'count':0x0,'rows':[]};var _0x10827b=_['map'](db[_0x9ae6('0x2b')][_0x9ae6('0x2c')],function(_0x5c9833){return{'name':_0x5c9833[_0x9ae6('0x2d')],'type':_0x5c9833[_0x9ae6('0x2e')]['key']};});_0x329ee3['model']=_['map'](_0x10827b,_0x9ae6('0x28'));_0x329ee3[_0x9ae6('0x2f')]=_[_0x9ae6('0x30')](_0x3f4210[_0x9ae6('0x2f')]);_0x329ee3['filters']=_[_0x9ae6('0x31')](_0x329ee3[_0x9ae6('0x32')],_0x329ee3[_0x9ae6('0x2f')]);_0x45e8d6[_0x9ae6('0x33')]=_[_0x9ae6('0x31')](_0x329ee3['model'],qs[_0x9ae6('0x34')](_0x3f4210['query'][_0x9ae6('0x34')]));_0x45e8d6['attributes']=_0x45e8d6[_0x9ae6('0x33')][_0x9ae6('0x35')]?_0x45e8d6[_0x9ae6('0x33')]:_0x329ee3[_0x9ae6('0x32')];if(!_0x3f4210[_0x9ae6('0x2f')]['hasOwnProperty'](_0x9ae6('0x36'))){_0x45e8d6['limit']=qs[_0x9ae6('0x1f')](_0x3f4210[_0x9ae6('0x2f')][_0x9ae6('0x1f')]);_0x45e8d6[_0x9ae6('0x1d')]=qs[_0x9ae6('0x1d')](_0x3f4210['query']['offset']);}_0x45e8d6[_0x9ae6('0x37')]=qs[_0x9ae6('0x38')](_0x3f4210[_0x9ae6('0x2f')][_0x9ae6('0x38')]);_0x45e8d6[_0x9ae6('0x39')]=qs[_0x9ae6('0x3a')](_['pick'](_0x3f4210[_0x9ae6('0x2f')],_0x329ee3[_0x9ae6('0x3a')]),_0x10827b);if(_0x3f4210['query'][_0x9ae6('0x3b')]){_0x45e8d6[_0x9ae6('0x39')]=_[_0x9ae6('0x3c')](_0x45e8d6[_0x9ae6('0x39')],{'$or':_[_0x9ae6('0x3d')](_0x10827b,function(_0x55805c){if(_0x55805c[_0x9ae6('0x2e')]!==_0x9ae6('0x3e')){var _0x2dda06={};_0x2dda06[_0x55805c[_0x9ae6('0x28')]]={'$like':'%'+_0x3f4210[_0x9ae6('0x2f')][_0x9ae6('0x3b')]+'%'};return _0x2dda06;}})});}_0x45e8d6=_[_0x9ae6('0x3c')]({},_0x45e8d6,_0x3f4210[_0x9ae6('0x3f')]);var _0x47dc79={'where':_0x45e8d6[_0x9ae6('0x39')]};return db[_0x9ae6('0x2b')][_0x9ae6('0x20')](_0x47dc79)['then'](function(_0x27a367){_0x28bd51[_0x9ae6('0x20')]=_0x27a367;if(_0x3f4210[_0x9ae6('0x2f')][_0x9ae6('0x40')]){_0x45e8d6[_0x9ae6('0x41')]=[{'all':!![]}];}return db[_0x9ae6('0x2b')][_0x9ae6('0x42')](_0x45e8d6);})[_0x9ae6('0x25')](function(_0x406a7c){_0x28bd51[_0x9ae6('0x43')]=_0x406a7c;return _0x28bd51;})[_0x9ae6('0x25')](respondWithFilteredResult(_0x51e463,_0x45e8d6))[_0x9ae6('0x44')](handleError(_0x51e463,null));};exports[_0x9ae6('0x45')]=function(_0x3a0670,_0x4e632b){var _0x21c126={'raw':!![],'where':{'id':_0x3a0670[_0x9ae6('0x46')]['id']}},_0x31e4e6={};_0x31e4e6[_0x9ae6('0x32')]=_[_0x9ae6('0x30')](db[_0x9ae6('0x2b')][_0x9ae6('0x2c')]);_0x31e4e6[_0x9ae6('0x2f')]=_[_0x9ae6('0x30')](_0x3a0670[_0x9ae6('0x2f')]);_0x31e4e6['filters']=_[_0x9ae6('0x31')](_0x31e4e6[_0x9ae6('0x32')],_0x31e4e6[_0x9ae6('0x2f')]);_0x21c126[_0x9ae6('0x33')]=_[_0x9ae6('0x31')](_0x31e4e6[_0x9ae6('0x32')],qs[_0x9ae6('0x34')](_0x3a0670[_0x9ae6('0x2f')][_0x9ae6('0x34')]));_0x21c126['attributes']=_0x21c126[_0x9ae6('0x33')][_0x9ae6('0x35')]?_0x21c126[_0x9ae6('0x33')]:_0x31e4e6[_0x9ae6('0x32')];if(_0x3a0670[_0x9ae6('0x2f')][_0x9ae6('0x40')]){_0x21c126[_0x9ae6('0x41')]=[{'all':!![]}];}_0x21c126=_[_0x9ae6('0x3c')]({},_0x21c126,_0x3a0670[_0x9ae6('0x3f')]);return db[_0x9ae6('0x2b')][_0x9ae6('0x47')](_0x21c126)[_0x9ae6('0x25')](handleEntityNotFound(_0x4e632b,null))['then'](respondWithResult(_0x4e632b,null))[_0x9ae6('0x44')](handleError(_0x4e632b,null));};exports['create']=function(_0x48018,_0x94ae4c){return db[_0x9ae6('0x2b')][_0x9ae6('0x48')](_0x48018[_0x9ae6('0x49')],{})[_0x9ae6('0x25')](respondWithResult(_0x94ae4c,0xc9))[_0x9ae6('0x44')](handleError(_0x94ae4c,null));};exports[_0x9ae6('0x24')]=function(_0x5a3916,_0x2fb33b){if(_0x5a3916[_0x9ae6('0x49')]['id']){delete _0x5a3916['body']['id'];}return db[_0x9ae6('0x2b')][_0x9ae6('0x47')]({'where':{'id':_0x5a3916['params']['id']}})['then'](handleEntityNotFound(_0x2fb33b,null))['then'](saveUpdates(_0x5a3916[_0x9ae6('0x49')],null))[_0x9ae6('0x25')](respondWithResult(_0x2fb33b,null))[_0x9ae6('0x44')](handleError(_0x2fb33b,null));};exports[_0x9ae6('0x26')]=function(_0x1bbea8,_0x34326e){return db['FaxApplication'][_0x9ae6('0x47')]({'where':{'id':_0x1bbea8[_0x9ae6('0x46')]['id']}})[_0x9ae6('0x25')](handleEntityNotFound(_0x34326e,null))[_0x9ae6('0x25')](removeEntity(_0x34326e,null))['catch'](handleError(_0x34326e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 085a3d4..6c51348 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 _0x26ac=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','util'];(function(_0x18023d,_0x1aa982){var _0x13cd6a=function(_0x24c179){while(--_0x24c179){_0x18023d['push'](_0x18023d['shift']());}};_0x13cd6a(++_0x1aa982);}(_0x26ac,0xf6));var _0xc26a=function(_0x107021,_0x47fd3f){_0x107021=_0x107021-0x0;var _0x12df45=_0x26ac[_0x107021];return _0x12df45;};'use strict';var _=require('lodash');var util=require(_0xc26a('0x0'));var logger=require('../../config/logger')(_0xc26a('0x1'));var moment=require(_0xc26a('0x2'));var BPromise=require(_0xc26a('0x3'));var rp=require(_0xc26a('0x4'));var fs=require('fs');var path=require(_0xc26a('0x5'));var rimraf=require(_0xc26a('0x6'));var config=require(_0xc26a('0x7'));var attributes=require('./faxApplication.attributes');module[_0xc26a('0x8')]=function(_0x273da6,_0xd91d55){return _0x273da6[_0xc26a('0x9')](_0xc26a('0xa'),attributes,{'tableName':_0xc26a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc26a('0xc')});}; \ No newline at end of file +var _0x487b=['utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x45749a,_0x52b3c5){var _0x36e168=function(_0x429717){while(--_0x429717){_0x45749a['push'](_0x45749a['shift']());}};_0x36e168(++_0x52b3c5);}(_0x487b,0x6d));var _0xb487=function(_0x473970,_0xe20c1){_0x473970=_0x473970-0x0;var _0x18366e=_0x487b[_0x473970];return _0x18366e;};'use strict';var _=require(_0xb487('0x0'));var util=require(_0xb487('0x1'));var logger=require('../../config/logger')(_0xb487('0x2'));var moment=require(_0xb487('0x3'));var BPromise=require('bluebird');var rp=require(_0xb487('0x4'));var fs=require('fs');var path=require(_0xb487('0x5'));var rimraf=require('rimraf');var config=require(_0xb487('0x6'));var attributes=require(_0xb487('0x7'));module[_0xb487('0x8')]=function(_0x48e193,_0x514d72){return _0x48e193[_0xb487('0x9')](_0xb487('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb487('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index fae7f43..0a604b9 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 _0xc955=['FaxApplication','update','options','raw','where','attributes','limit','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxApplication,\x20%s,\x20%s','catch','UpdateFaxApplication'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0xc955,0x80));var _0x5c95=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xc955[_0x22f8ab];return _0x2a70e5;};'use strict';var _=require(_0x5c95('0x0'));var util=require(_0x5c95('0x1'));var moment=require(_0x5c95('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c95('0x3'));var fs=require('fs');var Redis=require(_0x5c95('0x4'));var db=require(_0x5c95('0x5'))['db'];var utils=require(_0x5c95('0x6'));var logger=require(_0x5c95('0x7'))(_0x5c95('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5c95('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x590cc5,_0x4bf2cc,_0x20a038){return new BPromise(function(_0x44aa90,_0x21dff0){return client[_0x5c95('0xa')](_0x590cc5,_0x20a038)[_0x5c95('0xb')](function(_0x17afe5){logger[_0x5c95('0xc')]('FaxApplication,\x20%s,\x20%s',_0x4bf2cc,_0x5c95('0xd'));logger['debug'](_0x5c95('0xe'),_0x4bf2cc,_0x5c95('0xd'),JSON[_0x5c95('0xf')](_0x17afe5));if(_0x17afe5[_0x5c95('0x10')]){if(_0x17afe5[_0x5c95('0x10')][_0x5c95('0x11')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4bf2cc,_0x17afe5[_0x5c95('0x10')][_0x5c95('0x12')]);return _0x21dff0(_0x17afe5['error'][_0x5c95('0x12')]);}logger[_0x5c95('0x10')](_0x5c95('0x13'),_0x4bf2cc,_0x17afe5[_0x5c95('0x10')][_0x5c95('0x12')]);return _0x44aa90(_0x17afe5[_0x5c95('0x10')][_0x5c95('0x12')]);}else{logger[_0x5c95('0xc')](_0x5c95('0x13'),_0x4bf2cc,'request\x20sent');_0x44aa90(_0x17afe5['result'][_0x5c95('0x12')]);}})[_0x5c95('0x14')](function(_0x4ab2fb){logger[_0x5c95('0x10')](_0x5c95('0x13'),_0x4bf2cc,_0x4ab2fb);_0x21dff0(_0x4ab2fb);});});}exports[_0x5c95('0x15')]=function(_0x5213aa){var _0x3ff315=this;return new Promise(function(_0x3b7d72,_0x29101a){return db[_0x5c95('0x16')][_0x5c95('0x17')](_0x5213aa['body'],{'raw':_0x5213aa[_0x5c95('0x18')]?_0x5213aa[_0x5c95('0x18')][_0x5c95('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5213aa[_0x5c95('0x18')]?_0x5213aa[_0x5c95('0x18')][_0x5c95('0x1a')]||null:null,'attributes':_0x5213aa['options']?_0x5213aa[_0x5c95('0x18')][_0x5c95('0x1b')]||null:null,'limit':_0x5213aa[_0x5c95('0x18')]?_0x5213aa[_0x5c95('0x18')][_0x5c95('0x1c')]||null:null})['then'](function(_0x3ca0da){logger[_0x5c95('0xc')](_0x5c95('0x15'),_0x5213aa);logger[_0x5c95('0x1d')](_0x5c95('0x15'),_0x5213aa,JSON[_0x5c95('0xf')](_0x3ca0da));_0x3b7d72(_0x3ca0da);})[_0x5c95('0x14')](function(_0x52aba1){logger[_0x5c95('0x10')](_0x5c95('0x15'),_0x52aba1[_0x5c95('0x12')],_0x5213aa);_0x29101a(_0x3ff315['error'](0x1f4,_0x52aba1[_0x5c95('0x12')]));});});}; \ No newline at end of file +var _0x819a=['../../config/logger','rpc','../../config/environment','client','http','request','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxApplication','update','raw','options','attributes','limit','then','UpdateFaxApplication','stringify','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1ba2de,_0x3b3ac9){var _0x5295da=function(_0x1b9576){while(--_0x1b9576){_0x1ba2de['push'](_0x1ba2de['shift']());}};_0x5295da(++_0x3b3ac9);}(_0x819a,0xaf));var _0xa819=function(_0x31fb52,_0xded904){_0x31fb52=_0x31fb52-0x0;var _0x3fc244=_0x819a[_0x31fb52];return _0x3fc244;};'use strict';var _=require(_0xa819('0x0'));var util=require('util');var moment=require(_0xa819('0x1'));var BPromise=require(_0xa819('0x2'));var rs=require(_0xa819('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa819('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa819('0x5'))(_0xa819('0x6'));var config=require(_0xa819('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa819('0x8')][_0xa819('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51a277,_0xeafdf9,_0x5b8519){return new BPromise(function(_0x53e7a2,_0x18a552){return client[_0xa819('0xa')](_0x51a277,_0x5b8519)['then'](function(_0x44d4ca){logger[_0xa819('0xb')](_0xa819('0xc'),_0xeafdf9,'request\x20sent');logger[_0xa819('0xd')](_0xa819('0xe'),_0xeafdf9,_0xa819('0xf'),JSON['stringify'](_0x44d4ca));if(_0x44d4ca['error']){if(_0x44d4ca[_0xa819('0x10')][_0xa819('0x11')]===0x1f4){logger[_0xa819('0x10')](_0xa819('0xc'),_0xeafdf9,_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);return _0x18a552(_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);}logger[_0xa819('0x10')](_0xa819('0xc'),_0xeafdf9,_0x44d4ca[_0xa819('0x10')][_0xa819('0x12')]);return _0x53e7a2(_0x44d4ca['error'][_0xa819('0x12')]);}else{logger['info'](_0xa819('0xc'),_0xeafdf9,'request\x20sent');_0x53e7a2(_0x44d4ca[_0xa819('0x13')][_0xa819('0x12')]);}})[_0xa819('0x14')](function(_0x1fa750){logger['error']('FaxApplication,\x20%s,\x20%s',_0xeafdf9,_0x1fa750);_0x18a552(_0x1fa750);});});}exports['UpdateFaxApplication']=function(_0x4c3a17){var _0x354c5a=this;return new Promise(function(_0x4f72c2,_0x4096ee){return db[_0xa819('0x15')][_0xa819('0x16')](_0x4c3a17['body'],{'raw':_0x4c3a17['options']?_0x4c3a17['options'][_0xa819('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c3a17[_0xa819('0x18')]?_0x4c3a17[_0xa819('0x18')]['where']||null:null,'attributes':_0x4c3a17[_0xa819('0x18')]?_0x4c3a17[_0xa819('0x18')][_0xa819('0x19')]||null:null,'limit':_0x4c3a17[_0xa819('0x18')]?_0x4c3a17[_0xa819('0x18')][_0xa819('0x1a')]||null:null})[_0xa819('0x1b')](function(_0x2e15e8){logger[_0xa819('0xb')](_0xa819('0x1c'),_0x4c3a17);logger['debug']('UpdateFaxApplication',_0x4c3a17,JSON[_0xa819('0x1d')](_0x2e15e8));_0x4f72c2(_0x2e15e8);})[_0xa819('0x14')](function(_0x4050f0){logger[_0xa819('0x10')](_0xa819('0x1c'),_0x4050f0[_0xa819('0x12')],_0x4c3a17);_0x4096ee(_0x354c5a['error'](0x1f4,_0x4050f0[_0xa819('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 13cc6ca..1bac0c6 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 _0x0598=['../../components/auth/service','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x0598,0x92));var _0x8059=function(_0x1c90aa,_0x30961b){_0x1c90aa=_0x1c90aa-0x0;var _0x51b4c4=_0x0598[_0x1c90aa];return _0x51b4c4;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8059('0xa')](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router[_0x8059('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8059('0xd')]);module[_0x8059('0xe')]=router; \ No newline at end of file +var _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x1a5b4f,_0x3cfe15){var _0x3e062c=function(_0xaf8ba1){while(--_0xaf8ba1){_0x1a5b4f['push'](_0x1a5b4f['shift']());}};_0x3e062c(++_0x3cfe15);}(_0x4024,0x89));var _0x4402=function(_0xe3af07,_0x462efc){_0xe3af07=_0xe3af07-0x0;var _0x570765=_0x4024[_0xe3af07];return _0x570765;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2c9997e..409be47 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 _0x32b6=['ENUM','out','INTEGER','sequelize','exports','DATE','STRING'];(function(_0x4e221e,_0x22329a){var _0x2297eb=function(_0x59a4cd){while(--_0x59a4cd){_0x4e221e['push'](_0x4e221e['shift']());}};_0x2297eb(++_0x22329a);}(_0x32b6,0x1d1));var _0x632b=function(_0x59ddd9,_0x20661b){_0x59ddd9=_0x59ddd9-0x0;var _0x367b00=_0x32b6[_0x59ddd9];return _0x367b00;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x632b('0x2')]},'disposition':{'type':Sequelize[_0x632b('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x632b('0x3')]},'read1stAt':{'type':Sequelize[_0x632b('0x2')]},'fax':{'type':Sequelize[_0x632b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x632b('0x4')]('in',_0x632b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x632b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x632b('0x4')]('in',_0x632b('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x632b('0x6')]}}; \ No newline at end of file +var _0xc6ac=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x4d9b14,_0x76a10d){var _0x263a8f=function(_0x1980b7){while(--_0x1980b7){_0x4d9b14['push'](_0x4d9b14['shift']());}};_0x263a8f(++_0x76a10d);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x39aa3e,_0x2fada2){_0x39aa3e=_0x39aa3e-0x0;var _0x1bab37=_0xc6ac[_0x39aa3e];return _0x1bab37;};'use strict';var Sequelize=require(_0xcc6a('0x0'));module[_0xcc6a('0x1')]={'closed':{'type':Sequelize[_0xcc6a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcc6a('0x3')]},'disposition':{'type':Sequelize[_0xcc6a('0x4')]},'secondDisposition':{'type':Sequelize[_0xcc6a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xcc6a('0x4')]},'note':{'type':Sequelize[_0xcc6a('0x4')]},'read1stAt':{'type':Sequelize[_0xcc6a('0x3')]},'fax':{'type':Sequelize[_0xcc6a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xcc6a('0x5')]('in',_0xcc6a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcc6a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xcc6a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xcc6a('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 2ea13cf..616e015 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 _0xafaa=['setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','pipe','createWriteStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','json','undefined','count','limit','set','Content-Range','update','then','destroy','end','name','send','index','map','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags'];(function(_0x11cc86,_0x1cda4e){var _0x357ad0=function(_0x5405df){while(--_0x5405df){_0x11cc86['push'](_0x11cc86['shift']());}};_0x357ad0(++_0x1cda4e);}(_0xafaa,0x15e));var _0xaafa=function(_0x27650e,_0x278f7a){_0x27650e=_0x27650e-0x0;var _0x28fe08=_0xafaa[_0x27650e];return _0x28fe08;};'use strict';var rimraf=require(_0xaafa('0x0'));var zipdir=require(_0xaafa('0x1'));var moment=require(_0xaafa('0x2'));var BPromise=require(_0xaafa('0x3'));var util=require(_0xaafa('0x4'));var path=require(_0xaafa('0x5'));var fs=require('fs');var _=require(_0xaafa('0x6'));var Redis=require(_0xaafa('0x7'));var interaction=require(_0xaafa('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xaafa('0x9'))(_0xaafa('0xa'));var config=require(_0xaafa('0xb'));var db=require(_0xaafa('0xc'))['db'];config[_0xaafa('0xd')]=_['defaults'](config[_0xaafa('0xd')],{'host':_0xaafa('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaafa('0xd')]));require('./faxInteraction.socket')[_0xaafa('0xf')](socket);function respondWithStatusCode(_0x4c38bc,_0x5a355a){_0x5a355a=_0x5a355a||0xcc;return function(_0x5f14c0){if(_0x5f14c0){return _0x4c38bc[_0xaafa('0x10')](_0x5a355a);}return _0x4c38bc[_0xaafa('0x11')](_0x5a355a)['end']();};}function respondWithResult(_0x4e2d34,_0x1aa7c9){_0x1aa7c9=_0x1aa7c9||0xc8;return function(_0x13e63c){if(_0x13e63c){return _0x4e2d34[_0xaafa('0x11')](_0x1aa7c9)[_0xaafa('0x12')](_0x13e63c);}};}function respondWithFilteredResult(_0x151298,_0x185668){return function(_0x494cd7){if(_0x494cd7){var _0x3eec2b=typeof _0x185668['offset']===_0xaafa('0x13')&&typeof _0x185668['limit']===_0xaafa('0x13');var _0x2f5082=_0x494cd7['count'];var _0x5115fd=_0x3eec2b?0x0:_0x185668['offset'];var _0x579a6b=_0x3eec2b?_0x494cd7[_0xaafa('0x14')]:_0x185668['offset']+_0x185668[_0xaafa('0x15')];var _0xae39cf;if(_0x579a6b>=_0x2f5082){_0x579a6b=_0x2f5082;_0xae39cf=0xc8;}else{_0xae39cf=0xce;}_0x151298['status'](_0xae39cf);return _0x151298[_0xaafa('0x16')](_0xaafa('0x17'),_0x5115fd+'-'+_0x579a6b+'/'+_0x2f5082)[_0xaafa('0x12')](_0x494cd7);}return null;};}function saveUpdates(_0x13718b){return function(_0x24beea){if(_0x24beea){return _0x24beea[_0xaafa('0x18')](_0x13718b)[_0xaafa('0x19')](function(_0xe1999c){return _0xe1999c;});}return null;};}function removeEntity(_0x31b898){return function(_0x1952b9){if(_0x1952b9){return _0x1952b9[_0xaafa('0x1a')]()[_0xaafa('0x19')](function(){_0x31b898[_0xaafa('0x11')](0xcc)[_0xaafa('0x1b')]();});}};}function handleEntityNotFound(_0x497a28){return function(_0xca2375){if(!_0xca2375){_0x497a28['sendStatus'](0x194);}return _0xca2375;};}function handleError(_0x2e60e4,_0x3a14ef){_0x3a14ef=_0x3a14ef||0x1f4;return function(_0x22e3dc){logger['error'](_0x22e3dc['stack']);if(_0x22e3dc['name']){delete _0x22e3dc[_0xaafa('0x1c')];}_0x2e60e4['status'](_0x3a14ef)[_0xaafa('0x1d')](_0x22e3dc);};}exports[_0xaafa('0x1e')]=function(_0x3fc7d7,_0x29f217){var _0x340132={};var _0x32e446=_[_0xaafa('0x1f')](db[_0xaafa('0x20')][_0xaafa('0x21')],function(_0x1e9c24){return{'name':_0x1e9c24['fieldName'],'type':_0x1e9c24[_0xaafa('0x22')][_0xaafa('0x23')]};});_0x340132=qs[_0xaafa('0x24')](_0x32e446,_0x3fc7d7);return interaction[_0xaafa('0x25')](_0xaafa('0x26'),_0x3fc7d7[_0xaafa('0x27')],_0x3fc7d7['user'],_0x340132,_0x32e446)[_0xaafa('0x19')](respondWithFilteredResult(_0x29f217,_0x340132))[_0xaafa('0x28')](handleError(_0x29f217,null));};exports[_0xaafa('0x29')]=function(_0x233de5,_0x1a3185){var _0x5591e8={'raw':![],'where':{'id':_0x233de5[_0xaafa('0x2a')]['id']}},_0x1ad4ea={};_0x1ad4ea[_0xaafa('0x2b')]=_[_0xaafa('0x2c')](db[_0xaafa('0x20')][_0xaafa('0x21')]);_0x1ad4ea['query']=_[_0xaafa('0x2c')](_0x233de5[_0xaafa('0x27')]);_0x1ad4ea[_0xaafa('0x2d')]=_[_0xaafa('0x2e')](_0x1ad4ea[_0xaafa('0x2b')],_0x1ad4ea[_0xaafa('0x27')]);_0x5591e8[_0xaafa('0x2f')]=_[_0xaafa('0x2e')](_0x1ad4ea[_0xaafa('0x2b')],qs[_0xaafa('0x30')](_0x233de5[_0xaafa('0x27')][_0xaafa('0x30')]));_0x5591e8['attributes']=_0x5591e8['attributes'][_0xaafa('0x31')]?_0x5591e8[_0xaafa('0x2f')]:_0x1ad4ea['model'];if(_0x233de5[_0xaafa('0x27')][_0xaafa('0x32')]){_0x5591e8[_0xaafa('0x33')]=[{'all':!![]}];}_0x5591e8=_[_0xaafa('0x34')]({},_0x5591e8,_0x233de5[_0xaafa('0x35')]);return db['FaxInteraction'][_0xaafa('0x36')](_0x5591e8)['then'](handleEntityNotFound(_0x1a3185,null))[_0xaafa('0x19')](respondWithResult(_0x1a3185,null))[_0xaafa('0x28')](handleError(_0x1a3185,null));};exports[_0xaafa('0x37')]=function(_0x29c847,_0x4435f8){return db[_0xaafa('0x20')][_0xaafa('0x37')](_0x29c847[_0xaafa('0x38')],{})[_0xaafa('0x19')](respondWithResult(_0x4435f8,0xc9))[_0xaafa('0x28')](handleError(_0x4435f8,null));};exports[_0xaafa('0x18')]=function(_0x5104b0,_0x258c25){if(_0x5104b0[_0xaafa('0x38')]['id']){delete _0x5104b0[_0xaafa('0x38')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x5104b0[_0xaafa('0x2a')]['id']}})[_0xaafa('0x19')](handleEntityNotFound(_0x258c25,null))['then'](saveUpdates(_0x5104b0[_0xaafa('0x38')],null))[_0xaafa('0x19')](respondWithResult(_0x258c25,null))[_0xaafa('0x28')](handleError(_0x258c25,null));};exports[_0xaafa('0x1a')]=function(_0x2740ee,_0x26f025){return db[_0xaafa('0x20')][_0xaafa('0x36')]({'where':{'id':_0x2740ee[_0xaafa('0x2a')]['id']}})[_0xaafa('0x19')](handleEntityNotFound(_0x26f025,null))[_0xaafa('0x19')](removeEntity(_0x26f025,null))['catch'](handleError(_0x26f025,null));};exports['describe']=function(_0x404cf5,_0x570c44){return db[_0xaafa('0x20')][_0xaafa('0x39')]()[_0xaafa('0x19')](respondWithResult(_0x570c44,null))[_0xaafa('0x28')](handleError(_0x570c44,null));};exports[_0xaafa('0x3a')]=function(_0x536a03,_0x10da9b){return db['FaxMessage'][_0xaafa('0x36')]({'where':{'id':_0x536a03[_0xaafa('0x2a')]['id']}})['then'](handleEntityNotFound(_0x10da9b,null))[_0xaafa('0x19')](function(_0x1bdf3a){if(_0x1bdf3a){return _0x1bdf3a['addMessage'](_0x536a03[_0xaafa('0x38')][_0xaafa('0x3b')],_[_0xaafa('0x3c')](_0x536a03[_0xaafa('0x38')],[_0xaafa('0x3b'),'id'])||{});}})[_0xaafa('0x19')](respondWithResult(_0x10da9b,null))[_0xaafa('0x28')](handleError(_0x10da9b,null));};exports[_0xaafa('0x3d')]=function(_0x459d33,_0x208c62){var _0x3bdd65={'raw':![],'where':{}};var _0x109f77={};var _0x133693={'count':0x0,'rows':[]};return db[_0xaafa('0x20')][_0xaafa('0x3e')]({'where':{'id':_0x459d33[_0xaafa('0x2a')]['id']}})[_0xaafa('0x19')](handleEntityNotFound(_0x208c62,null))[_0xaafa('0x19')](function(_0x4012ce){if(_0x4012ce){_0x109f77[_0xaafa('0x2b')]=_[_0xaafa('0x2c')](db[_0xaafa('0x3f')][_0xaafa('0x21')]);_0x109f77[_0xaafa('0x27')]=_['keys'](_0x459d33[_0xaafa('0x27')]);_0x109f77[_0xaafa('0x2d')]=_[_0xaafa('0x2e')](_0x109f77[_0xaafa('0x2b')],_0x109f77['query']);_0x3bdd65['attributes']=_[_0xaafa('0x2e')](_0x109f77[_0xaafa('0x2b')],qs[_0xaafa('0x30')](_0x459d33['query']['fields']));_0x3bdd65[_0xaafa('0x2f')]=_0x3bdd65['attributes'][_0xaafa('0x31')]?_0x3bdd65[_0xaafa('0x2f')]:_0x109f77[_0xaafa('0x2b')];if(!_0x459d33[_0xaafa('0x27')][_0xaafa('0x40')](_0xaafa('0x41'))){_0x3bdd65[_0xaafa('0x15')]=qs[_0xaafa('0x15')](_0x459d33[_0xaafa('0x27')][_0xaafa('0x15')]);_0x3bdd65[_0xaafa('0x42')]=qs[_0xaafa('0x42')](_0x459d33['query']['offset']);}_0x3bdd65[_0xaafa('0x43')]=qs[_0xaafa('0x44')](_0x459d33[_0xaafa('0x27')]['sort']);_0x3bdd65[_0xaafa('0x45')]=qs[_0xaafa('0x2d')](_[_0xaafa('0x46')](_0x459d33[_0xaafa('0x27')],_0x109f77[_0xaafa('0x2d')]));_0x3bdd65[_0xaafa('0x45')]['FaxInteractionId']=_0x4012ce['id'];if(_0x459d33[_0xaafa('0x27')][_0xaafa('0x47')]){_0x3bdd65[_0xaafa('0x45')]=_[_0xaafa('0x34')](_0x3bdd65[_0xaafa('0x45')],{'$or':_[_0xaafa('0x1f')](_0x3bdd65['attributes'],function(_0x56d84d){var _0x47b5f0={};_0x47b5f0[_0x56d84d]={'$like':'%'+_0x459d33['query'][_0xaafa('0x47')]+'%'};return _0x47b5f0;})});}if(_0x459d33['query'][_0xaafa('0x48')]){var _0x2f7844=_0x459d33['query'][_0xaafa('0x48')][_0xaafa('0x49')](',');var _0x2651a4={};_0x2651a4[_0x2f7844[0x0]]={'$gte':moment(_0x2f7844[0x1])[_0xaafa('0x4a')](_0xaafa('0x4b'))};_0x3bdd65['where']=_[_0xaafa('0x34')](_0x3bdd65['where'],_0x2651a4);}_0x3bdd65=_[_0xaafa('0x34')]({},_0x3bdd65,_0x459d33['options']);return db['FaxMessage']['count']({'where':_0x3bdd65['where']})[_0xaafa('0x19')](function(_0x1aa496){_0x133693[_0xaafa('0x14')]=_0x1aa496;if(_0x459d33[_0xaafa('0x27')]['includeAll']){_0x3bdd65[_0xaafa('0x33')]=[{'all':!![]}];}return db[_0xaafa('0x3f')][_0xaafa('0x25')](_0x3bdd65);})[_0xaafa('0x19')](function(_0x21e897){_0x133693[_0xaafa('0x4c')]=_0x21e897;return _0x133693;});}})['then'](respondWithFilteredResult(_0x208c62,_0x3bdd65))[_0xaafa('0x28')](handleError(_0x208c62,null));};exports[_0xaafa('0x4d')]=function(_0x221325,_0x362f96){return db['FaxInteraction'][_0xaafa('0x36')]({'where':{'id':_0x221325[_0xaafa('0x2a')]['id']}})[_0xaafa('0x19')](handleEntityNotFound(_0x362f96,null))['then'](function(_0x245e70){if(_0x245e70){return _0x245e70[_0xaafa('0x4e')](_0x221325[_0xaafa('0x38')][_0xaafa('0x3b')],_[_0xaafa('0x3c')](_0x221325['body'],[_0xaafa('0x3b'),'id'])||{})[_0xaafa('0x4f')](function(){return db[_0xaafa('0x50')]['findAll']({'attributes':['id',_0xaafa('0x1c'),_0xaafa('0x51')],'where':{'id':_0x221325[_0xaafa('0x38')]['ids']}});})[_0xaafa('0x19')](function(_0x3c80b6){socket[_0xaafa('0x52')](_0xaafa('0x53'),{'id':Number(_0x221325[_0xaafa('0x2a')]['id']),'tags':_0x3c80b6||[]});return{'id':Number(_0x221325[_0xaafa('0x2a')]['id']),'tags':_0x3c80b6||[]};});}})[_0xaafa('0x19')](respondWithResult(_0x362f96,null))[_0xaafa('0x28')](handleError(_0x362f96,null));};exports[_0xaafa('0x54')]=function(_0x5349a5,_0x7194d8){return db['FaxInteraction'][_0xaafa('0x36')]({'where':{'id':_0x5349a5[_0xaafa('0x2a')]['id']}})[_0xaafa('0x19')](handleEntityNotFound(_0x7194d8,null))[_0xaafa('0x19')](function(_0x3d4d9f){if(_0x3d4d9f){return _0x3d4d9f['removeTags'](_0x5349a5[_0xaafa('0x27')][_0xaafa('0x3b')]);}})[_0xaafa('0x19')](respondWithStatusCode(_0x7194d8,null))[_0xaafa('0x28')](handleError(_0x7194d8,null));};exports[_0xaafa('0x55')]=function(_0x2f19a6,_0x432187){var _0x4f0814=moment()[_0xaafa('0x56')]()[_0xaafa('0x57')]();var _0x409df2=path[_0xaafa('0x58')](config['root'],_0xaafa('0x59'),_0xaafa('0x5a'),_0xaafa('0x5b'));var _0x336ff1=path[_0xaafa('0x58')](config[_0xaafa('0x5c')],_0xaafa('0x59'),'files',_0xaafa('0x5d'));var _0xd73027=path['join'](_0x409df2,_0x4f0814);var _0x5d4ced=util[_0xaafa('0x4a')](_0xaafa('0x5e'),_0x2f19a6['params']['id'],_0x4f0814);var _0x1b897b=path[_0xaafa('0x58')](_0x409df2,_0x5d4ced);var _0x3217b7=[];_0x3217b7[_0xaafa('0x5f')]({'model':db[_0xaafa('0x60')],'as':_0xaafa('0x60'),'raw':!![]});var _0xd1d563=[{'model':db['FaxMessage'],'as':_0xaafa('0x61'),'attributes':['id',_0xaafa('0x38'),_0xaafa('0x62')],'include':_0x3217b7}];return db[_0xaafa('0x20')]['find']({'where':{'id':_0x2f19a6[_0xaafa('0x2a')]['id']},'include':_0xd1d563})[_0xaafa('0x19')](handleEntityNotFound(_0x432187,null))[_0xaafa('0x19')](function(_0x3b7fb4){if(_0x3b7fb4&&_0x3b7fb4[_0xaafa('0x61')]){var _0x20245f=_0x3b7fb4['get']({'plain':!![]});fs[_0xaafa('0x63')](_0xd73027);for(var _0x5167e5=0x0;_0x5167e5<_0x20245f[_0xaafa('0x61')]['length'];_0x5167e5++){var _0x5d7b56=_0x20245f['Messages'][_0x5167e5][_0xaafa('0x60')];if(_0x5d7b56){var _0x30c5f3=path['join'](_0x336ff1,_0x5d7b56[_0xaafa('0x64')]);if(fs[_0xaafa('0x65')](_0x30c5f3)){fs['createReadStream'](_0x30c5f3)[_0xaafa('0x66')](fs[_0xaafa('0x67')](path['join'](_0xd73027,_0x5d7b56[_0xaafa('0x64')])));}}}return BPromise[_0xaafa('0x68')]()[_0xaafa('0x19')](function(){return new BPromise(function(_0x1d49b1,_0x30adc0){zipdir(_0xd73027,{'saveTo':_0x1b897b},function(_0x194b1d,_0xd73403){if(_0x194b1d)return _0x30adc0(_0x194b1d);return _0x1d49b1(_0xd73403);});})['then'](function(){return new BPromise(function(_0x103baf,_0x591106){rimraf(_0xd73027,function(_0x4acc4a){if(_0x4acc4a)_0x591106(_0x4acc4a);return _0x103baf();});});})[_0xaafa('0x19')](function(){return _0x432187['download'](_0x1b897b,_0x5d4ced,function(_0x3617c0){if(_0x3617c0){console['log'](_0xaafa('0x69'),_0x3617c0);}else{fs[_0xaafa('0x6a')](_0x1b897b);}});});});}else{return _0x432187[_0xaafa('0x10')](0xc8);}})[_0xaafa('0x28')](handleError(_0x432187,null));}; \ No newline at end of file +var _0x695e=['then','end','error','stack','name','send','index','map','FaxInteraction','type','key','getOptions','findAll','fax','show','keys','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','include','find','create','body','catch','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','where','FaxInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','color','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','format','transcript-%d-%s.zip','push','Attachment','Messages','get','basename','existsSync','createReadStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy'];(function(_0x2919e4,_0x535b43){var _0x124dc5=function(_0x427338){while(--_0x427338){_0x2919e4['push'](_0x2919e4['shift']());}};_0x124dc5(++_0x535b43);}(_0x695e,0x170));var _0xe695=function(_0x4565eb,_0x167f79){_0x4565eb=_0x4565eb-0x0;var _0x67832=_0x695e[_0x4565eb];return _0x67832;};'use strict';var rimraf=require(_0xe695('0x0'));var zipdir=require(_0xe695('0x1'));var moment=require(_0xe695('0x2'));var BPromise=require(_0xe695('0x3'));var util=require(_0xe695('0x4'));var path=require(_0xe695('0x5'));var fs=require('fs');var _=require(_0xe695('0x6'));var Redis=require('ioredis');var interaction=require(_0xe695('0x7'));var qs=require(_0xe695('0x8'));var logger=require(_0xe695('0x9'))(_0xe695('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xe695('0xb')](config[_0xe695('0xc')],{'host':_0xe695('0xd'),'port':0x18eb});var socket=require(_0xe695('0xe'))(new Redis(config[_0xe695('0xc')]));require(_0xe695('0xf'))[_0xe695('0x10')](socket);function respondWithStatusCode(_0xd32cc7,_0x134c41){_0x134c41=_0x134c41||0xcc;return function(_0x9a3d5a){if(_0x9a3d5a){return _0xd32cc7[_0xe695('0x11')](_0x134c41);}return _0xd32cc7[_0xe695('0x12')](_0x134c41)['end']();};}function respondWithResult(_0x457cd8,_0x4a6de4){_0x4a6de4=_0x4a6de4||0xc8;return function(_0x26ebdf){if(_0x26ebdf){return _0x457cd8['status'](_0x4a6de4)[_0xe695('0x13')](_0x26ebdf);}};}function respondWithFilteredResult(_0xde5546,_0x4beb8b){return function(_0x40efad){if(_0x40efad){var _0x1020a4=typeof _0x4beb8b[_0xe695('0x14')]===_0xe695('0x15')&&typeof _0x4beb8b['limit']==='undefined';var _0x496476=_0x40efad['count'];var _0xb32d5a=_0x1020a4?0x0:_0x4beb8b[_0xe695('0x14')];var _0x51808f=_0x1020a4?_0x40efad[_0xe695('0x16')]:_0x4beb8b[_0xe695('0x14')]+_0x4beb8b[_0xe695('0x17')];var _0x5fe82b;if(_0x51808f>=_0x496476){_0x51808f=_0x496476;_0x5fe82b=0xc8;}else{_0x5fe82b=0xce;}_0xde5546[_0xe695('0x12')](_0x5fe82b);return _0xde5546[_0xe695('0x18')](_0xe695('0x19'),_0xb32d5a+'-'+_0x51808f+'/'+_0x496476)[_0xe695('0x13')](_0x40efad);}return null;};}function saveUpdates(_0x4932fb){return function(_0x5c314a){if(_0x5c314a){return _0x5c314a[_0xe695('0x1a')](_0x4932fb)['then'](function(_0x3a1e47){return _0x3a1e47;});}return null;};}function removeEntity(_0x56d772){return function(_0x58b3b3){if(_0x58b3b3){return _0x58b3b3[_0xe695('0x1b')]()[_0xe695('0x1c')](function(){_0x56d772[_0xe695('0x12')](0xcc)[_0xe695('0x1d')]();});}};}function handleEntityNotFound(_0x4a2b1c){return function(_0x46dae3){if(!_0x46dae3){_0x4a2b1c[_0xe695('0x11')](0x194);}return _0x46dae3;};}function handleError(_0xb0342c,_0x495278){_0x495278=_0x495278||0x1f4;return function(_0x1724c7){logger[_0xe695('0x1e')](_0x1724c7[_0xe695('0x1f')]);if(_0x1724c7['name']){delete _0x1724c7[_0xe695('0x20')];}_0xb0342c['status'](_0x495278)[_0xe695('0x21')](_0x1724c7);};}exports[_0xe695('0x22')]=function(_0x23959b,_0x454cac){var _0x8f7461={};var _0x21328a=_[_0xe695('0x23')](db[_0xe695('0x24')]['rawAttributes'],function(_0x1ff8f8){return{'name':_0x1ff8f8['fieldName'],'type':_0x1ff8f8[_0xe695('0x25')][_0xe695('0x26')]};});_0x8f7461=qs[_0xe695('0x27')](_0x21328a,_0x23959b);return interaction[_0xe695('0x28')](_0xe695('0x29'),_0x23959b['query'],_0x23959b['user'],_0x8f7461,_0x21328a)[_0xe695('0x1c')](respondWithFilteredResult(_0x454cac,_0x8f7461))['catch'](handleError(_0x454cac,null));};exports[_0xe695('0x2a')]=function(_0x5d751f,_0x227bf8){var _0x3ec690={'raw':![],'where':{'id':_0x5d751f['params']['id']}},_0x5c7b95={};_0x5c7b95['model']=_[_0xe695('0x2b')](db['FaxInteraction'][_0xe695('0x2c')]);_0x5c7b95[_0xe695('0x2d')]=_[_0xe695('0x2b')](_0x5d751f[_0xe695('0x2d')]);_0x5c7b95['filters']=_[_0xe695('0x2e')](_0x5c7b95[_0xe695('0x2f')],_0x5c7b95[_0xe695('0x2d')]);_0x3ec690[_0xe695('0x30')]=_[_0xe695('0x2e')](_0x5c7b95['model'],qs[_0xe695('0x31')](_0x5d751f[_0xe695('0x2d')][_0xe695('0x31')]));_0x3ec690[_0xe695('0x30')]=_0x3ec690[_0xe695('0x30')][_0xe695('0x32')]?_0x3ec690[_0xe695('0x30')]:_0x5c7b95[_0xe695('0x2f')];if(_0x5d751f[_0xe695('0x2d')][_0xe695('0x33')]){_0x3ec690[_0xe695('0x34')]=[{'all':!![]}];}_0x3ec690=_['merge']({},_0x3ec690,_0x5d751f['options']);return db['FaxInteraction'][_0xe695('0x35')](_0x3ec690)[_0xe695('0x1c')](handleEntityNotFound(_0x227bf8,null))[_0xe695('0x1c')](respondWithResult(_0x227bf8,null))['catch'](handleError(_0x227bf8,null));};exports[_0xe695('0x36')]=function(_0x4cee16,_0x4892f8){return db[_0xe695('0x24')][_0xe695('0x36')](_0x4cee16[_0xe695('0x37')],{})[_0xe695('0x1c')](respondWithResult(_0x4892f8,0xc9))[_0xe695('0x38')](handleError(_0x4892f8,null));};exports['update']=function(_0x46be0a,_0x455286){if(_0x46be0a['body']['id']){delete _0x46be0a[_0xe695('0x37')]['id'];}return db['FaxInteraction'][_0xe695('0x35')]({'where':{'id':_0x46be0a[_0xe695('0x39')]['id']}})[_0xe695('0x1c')](handleEntityNotFound(_0x455286,null))[_0xe695('0x1c')](saveUpdates(_0x46be0a[_0xe695('0x37')],null))[_0xe695('0x1c')](respondWithResult(_0x455286,null))[_0xe695('0x38')](handleError(_0x455286,null));};exports[_0xe695('0x1b')]=function(_0x5eb6b6,_0x1c024a){return db[_0xe695('0x24')][_0xe695('0x35')]({'where':{'id':_0x5eb6b6['params']['id']}})[_0xe695('0x1c')](handleEntityNotFound(_0x1c024a,null))[_0xe695('0x1c')](removeEntity(_0x1c024a,null))[_0xe695('0x38')](handleError(_0x1c024a,null));};exports[_0xe695('0x3a')]=function(_0x4cb7f7,_0x932232){return db[_0xe695('0x24')][_0xe695('0x3a')]()[_0xe695('0x1c')](respondWithResult(_0x932232,null))[_0xe695('0x38')](handleError(_0x932232,null));};exports[_0xe695('0x3b')]=function(_0x5217ee,_0x1ca840){return db[_0xe695('0x3c')][_0xe695('0x35')]({'where':{'id':_0x5217ee['params']['id']}})['then'](handleEntityNotFound(_0x1ca840,null))[_0xe695('0x1c')](function(_0x1ea08c){if(_0x1ea08c){return _0x1ea08c[_0xe695('0x3b')](_0x5217ee[_0xe695('0x37')][_0xe695('0x3d')],_[_0xe695('0x3e')](_0x5217ee[_0xe695('0x37')],[_0xe695('0x3d'),'id'])||{});}})[_0xe695('0x1c')](respondWithResult(_0x1ca840,null))[_0xe695('0x38')](handleError(_0x1ca840,null));};exports[_0xe695('0x3f')]=function(_0x20fe04,_0x1f448f){var _0x3f3f33={'raw':![],'where':{}};var _0x1a3e28={};var _0x375574={'count':0x0,'rows':[]};return db[_0xe695('0x24')][_0xe695('0x40')]({'where':{'id':_0x20fe04[_0xe695('0x39')]['id']}})[_0xe695('0x1c')](handleEntityNotFound(_0x1f448f,null))['then'](function(_0x4b3fb3){if(_0x4b3fb3){_0x1a3e28[_0xe695('0x2f')]=_[_0xe695('0x2b')](db[_0xe695('0x3c')][_0xe695('0x2c')]);_0x1a3e28[_0xe695('0x2d')]=_[_0xe695('0x2b')](_0x20fe04[_0xe695('0x2d')]);_0x1a3e28['filters']=_[_0xe695('0x2e')](_0x1a3e28[_0xe695('0x2f')],_0x1a3e28['query']);_0x3f3f33[_0xe695('0x30')]=_[_0xe695('0x2e')](_0x1a3e28[_0xe695('0x2f')],qs[_0xe695('0x31')](_0x20fe04[_0xe695('0x2d')][_0xe695('0x31')]));_0x3f3f33[_0xe695('0x30')]=_0x3f3f33['attributes']['length']?_0x3f3f33[_0xe695('0x30')]:_0x1a3e28[_0xe695('0x2f')];if(!_0x20fe04[_0xe695('0x2d')][_0xe695('0x41')](_0xe695('0x42'))){_0x3f3f33[_0xe695('0x17')]=qs[_0xe695('0x17')](_0x20fe04[_0xe695('0x2d')][_0xe695('0x17')]);_0x3f3f33[_0xe695('0x14')]=qs['offset'](_0x20fe04[_0xe695('0x2d')][_0xe695('0x14')]);}_0x3f3f33[_0xe695('0x43')]=qs['sort'](_0x20fe04[_0xe695('0x2d')]['sort']);_0x3f3f33[_0xe695('0x44')]=qs['filters'](_['pick'](_0x20fe04[_0xe695('0x2d')],_0x1a3e28['filters']));_0x3f3f33['where'][_0xe695('0x45')]=_0x4b3fb3['id'];if(_0x20fe04[_0xe695('0x2d')]['filter']){_0x3f3f33[_0xe695('0x44')]=_['merge'](_0x3f3f33[_0xe695('0x44')],{'$or':_[_0xe695('0x23')](_0x3f3f33['attributes'],function(_0x2e26ad){var _0x3c7458={};_0x3c7458[_0x2e26ad]={'$like':'%'+_0x20fe04['query']['filter']+'%'};return _0x3c7458;})});}if(_0x20fe04[_0xe695('0x2d')][_0xe695('0x46')]){var _0x4b85e3=_0x20fe04[_0xe695('0x2d')][_0xe695('0x46')]['split'](',');var _0x3d94ee={};_0x3d94ee[_0x4b85e3[0x0]]={'$gte':moment(_0x4b85e3[0x1])['format'](_0xe695('0x47'))};_0x3f3f33[_0xe695('0x44')]=_['merge'](_0x3f3f33[_0xe695('0x44')],_0x3d94ee);}_0x3f3f33=_[_0xe695('0x48')]({},_0x3f3f33,_0x20fe04['options']);return db['FaxMessage']['count']({'where':_0x3f3f33[_0xe695('0x44')]})[_0xe695('0x1c')](function(_0x166b2e){_0x375574[_0xe695('0x16')]=_0x166b2e;if(_0x20fe04[_0xe695('0x2d')][_0xe695('0x33')]){_0x3f3f33[_0xe695('0x34')]=[{'all':!![]}];}return db[_0xe695('0x3c')][_0xe695('0x28')](_0x3f3f33);})['then'](function(_0x2f9536){_0x375574[_0xe695('0x49')]=_0x2f9536;return _0x375574;});}})[_0xe695('0x1c')](respondWithFilteredResult(_0x1f448f,_0x3f3f33))[_0xe695('0x38')](handleError(_0x1f448f,null));};exports[_0xe695('0x4a')]=function(_0x35b786,_0x28c1ea){return db[_0xe695('0x24')][_0xe695('0x35')]({'where':{'id':_0x35b786[_0xe695('0x39')]['id']}})['then'](handleEntityNotFound(_0x28c1ea,null))[_0xe695('0x1c')](function(_0x5789a0){if(_0x5789a0){return _0x5789a0[_0xe695('0x4b')](_0x35b786['body'][_0xe695('0x3d')],_[_0xe695('0x3e')](_0x35b786[_0xe695('0x37')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0xe695('0x28')]({'attributes':['id','name',_0xe695('0x4c')],'where':{'id':_0x35b786[_0xe695('0x37')]['ids']}});})[_0xe695('0x1c')](function(_0x4d542){socket['emit'](_0xe695('0x4d'),{'id':Number(_0x35b786['params']['id']),'tags':_0x4d542||[]});return{'id':Number(_0x35b786[_0xe695('0x39')]['id']),'tags':_0x4d542||[]};});}})[_0xe695('0x1c')](respondWithResult(_0x28c1ea,null))[_0xe695('0x38')](handleError(_0x28c1ea,null));};exports[_0xe695('0x4e')]=function(_0x48f399,_0x3a8503){return db[_0xe695('0x24')][_0xe695('0x35')]({'where':{'id':_0x48f399[_0xe695('0x39')]['id']}})[_0xe695('0x1c')](handleEntityNotFound(_0x3a8503,null))[_0xe695('0x1c')](function(_0x1c959b){if(_0x1c959b){return _0x1c959b['removeTags'](_0x48f399['query'][_0xe695('0x3d')]);}})[_0xe695('0x1c')](respondWithStatusCode(_0x3a8503,null))[_0xe695('0x38')](handleError(_0x3a8503,null));};exports[_0xe695('0x4f')]=function(_0x532b56,_0x4a0f39){var _0x120b60=moment()[_0xe695('0x50')]()[_0xe695('0x51')]();var _0x5bc3f9=path[_0xe695('0x52')](config[_0xe695('0x53')],_0xe695('0x54'),_0xe695('0x55'),_0xe695('0x56'));var _0x4d44ae=path[_0xe695('0x52')](config['root'],_0xe695('0x54'),_0xe695('0x55'),'attachments');var _0x294d84=path[_0xe695('0x52')](_0x5bc3f9,_0x120b60);var _0x1db292=util[_0xe695('0x57')](_0xe695('0x58'),_0x532b56[_0xe695('0x39')]['id'],_0x120b60);var _0x508e1e=path[_0xe695('0x52')](_0x5bc3f9,_0x1db292);var _0x17ae78=[];_0x17ae78[_0xe695('0x59')]({'model':db['Attachment'],'as':_0xe695('0x5a'),'raw':!![]});var _0x421a7f=[{'model':db[_0xe695('0x3c')],'as':'Messages','attributes':['id',_0xe695('0x37'),'createdAt'],'include':_0x17ae78}];return db[_0xe695('0x24')]['find']({'where':{'id':_0x532b56[_0xe695('0x39')]['id']},'include':_0x421a7f})['then'](handleEntityNotFound(_0x4a0f39,null))[_0xe695('0x1c')](function(_0x4dfa2a){if(_0x4dfa2a&&_0x4dfa2a[_0xe695('0x5b')]){var _0x370514=_0x4dfa2a[_0xe695('0x5c')]({'plain':!![]});fs['mkdirSync'](_0x294d84);for(var _0x2b903a=0x0;_0x2b903a<_0x370514[_0xe695('0x5b')][_0xe695('0x32')];_0x2b903a++){var _0x7bc012=_0x370514[_0xe695('0x5b')][_0x2b903a][_0xe695('0x5a')];if(_0x7bc012){var _0x466003=path[_0xe695('0x52')](_0x4d44ae,_0x7bc012[_0xe695('0x5d')]);if(fs[_0xe695('0x5e')](_0x466003)){fs[_0xe695('0x5f')](_0x466003)['pipe'](fs['createWriteStream'](path[_0xe695('0x52')](_0x294d84,_0x7bc012[_0xe695('0x5d')])));}}}return BPromise[_0xe695('0x60')]()[_0xe695('0x1c')](function(){return new BPromise(function(_0x361435,_0x2b38ff){zipdir(_0x294d84,{'saveTo':_0x508e1e},function(_0x2931fa,_0x5389a2){if(_0x2931fa)return _0x2b38ff(_0x2931fa);return _0x361435(_0x5389a2);});})[_0xe695('0x1c')](function(){return new BPromise(function(_0x4261ca,_0x4e2e7c){rimraf(_0x294d84,function(_0x5a1180){if(_0x5a1180)_0x4e2e7c(_0x5a1180);return _0x4261ca();});});})[_0xe695('0x1c')](function(){return _0x4a0f39[_0xe695('0x4f')](_0x508e1e,_0x1db292,function(_0x3687d5){if(_0x3687d5){console['log'](_0xe695('0x61'),_0x3687d5);}else{fs[_0xe695('0x62')](_0x508e1e);}});});});}else{return _0x4a0f39[_0xe695('0x11')](0xc8);}})[_0xe695('0x38')](handleError(_0x4a0f39,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 4c1c805..63518c1 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 _0x4a56=['then','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','setDataValue','Users','map','findAll'];(function(_0x3f8383,_0x2672b8){var _0x4ff188=function(_0x334aaa){while(--_0x334aaa){_0x3f8383['push'](_0x3f8383['shift']());}};_0x4ff188(++_0x2672b8);}(_0x4a56,0x1d6));var _0x64a5=function(_0x163a2a,_0x338261){_0x163a2a=_0x163a2a-0x0;var _0x2e3480=_0x4a56[_0x163a2a];return _0x2e3480;};'use strict';var EventEmitter=require(_0x64a5('0x0'));var FaxInteraction=require(_0x64a5('0x1'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x64a5('0x2')](0x0);var events={'afterCreate':_0x64a5('0x3'),'afterUpdate':_0x64a5('0x4'),'afterDestroy':_0x64a5('0x5')};function emitEvent(_0x56a5f8){return function(_0x310663,_0x1769c1,_0x1b49fe){_0x310663['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2e9370){_0x310663[_0x64a5('0x6')](_0x64a5('0x7'),_0x2e9370[_0x64a5('0x8')](function(_0x932265){return{'id':_0x932265['id']};}));return FaxMessage[_0x64a5('0x9')]({'where':{'FaxInteractionId':_0x310663['id'],'direction':'in','read':![]},'raw':!![]});})[_0x64a5('0xa')](function(_0x41ede1){_0x310663[_0x64a5('0x6')]('unreadMessages',_0x41ede1[_0x64a5('0xb')]);FaxInteractionEvents[_0x64a5('0xc')](_0x56a5f8+':'+_0x310663['id'],_0x310663);FaxInteractionEvents[_0x64a5('0xc')](_0x56a5f8,_0x310663);_0x1b49fe(null);})[_0x64a5('0xd')](_0x1b49fe(null));};}for(var e in events){if(events[_0x64a5('0xe')](e)){var event=events[e];FaxInteraction[_0x64a5('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xaf8a=['hook','exports','../../mysqldb','FaxMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x5c0d70,_0x5effb1){var _0xd4b206=function(_0x54003d){while(--_0x54003d){_0x5c0d70['push'](_0x5c0d70['shift']());}};_0xd4b206(++_0x5effb1);}(_0xaf8a,0x68));var _0xaaf8=function(_0x5f4eda,_0x47b8c9){_0x5f4eda=_0x5f4eda-0x0;var _0x1fd698=_0xaf8a[_0x5f4eda];return _0x1fd698;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xaaf8('0x0'))['db'][_0xaaf8('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaaf8('0x2'),'afterUpdate':'update','afterDestroy':_0xaaf8('0x3')};function emitEvent(_0x10b57b){return function(_0x3e6eef,_0x31ad46,_0x2d1331){_0x3e6eef[_0xaaf8('0x4')]({'attributes':['id'],'raw':!![]})[_0xaaf8('0x5')](function(_0x47779f){_0x3e6eef[_0xaaf8('0x6')](_0xaaf8('0x7'),_0x47779f[_0xaaf8('0x8')](function(_0x4ea563){return{'id':_0x4ea563['id']};}));return FaxMessage[_0xaaf8('0x9')]({'where':{'FaxInteractionId':_0x3e6eef['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaaf8('0x5')](function(_0x10e6ea){_0x3e6eef['setDataValue'](_0xaaf8('0xa'),_0x10e6ea[_0xaaf8('0xb')]);FaxInteractionEvents[_0xaaf8('0xc')](_0x10b57b+':'+_0x3e6eef['id'],_0x3e6eef);FaxInteractionEvents[_0xaaf8('0xc')](_0x10b57b,_0x3e6eef);_0x2d1331(null);})[_0xaaf8('0xd')](_0x2d1331(null));};}for(var e in events){if(events[_0xaaf8('0xe')](e)){var event=events[e];FaxInteraction[_0xaaf8('0xf')](e,emitEvent(event));}}module[_0xaaf8('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index ff70274..6ce62bc 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 _0x5ab9=['FaxInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','path','rimraf','./faxInteraction.attributes'];(function(_0x16cb55,_0x1a2432){var _0xda356a=function(_0x3cfa3b){while(--_0x3cfa3b){_0x16cb55['push'](_0x16cb55['shift']());}};_0xda356a(++_0x1a2432);}(_0x5ab9,0x117));var _0x95ab=function(_0x43ee7e,_0x78e09b){_0x43ee7e=_0x43ee7e-0x0;var _0x22d326=_0x5ab9[_0x43ee7e];return _0x22d326;};'use strict';var _=require('lodash');var util=require(_0x95ab('0x0'));var logger=require('../../config/logger')(_0x95ab('0x1'));var moment=require(_0x95ab('0x2'));var BPromise=require(_0x95ab('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95ab('0x4'));var rimraf=require(_0x95ab('0x5'));var config=require('../../config/environment');var attributes=require(_0x95ab('0x6'));module['exports']=function(_0x461eee,_0x23b91d){return _0x461eee['define'](_0x95ab('0x7'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x195203,_0x3431c5,_0x1f32c8){if(_0x195203[_0x95ab('0x8')](_0x95ab('0x9'))){_0x195203[_0x95ab('0xa')]=moment()[_0x95ab('0xb')](_0x95ab('0xc'));}_0x1f32c8(null,_0x195203);}}});}; \ No newline at end of file +var _0x7a5b=['closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x1dc3a1,_0x588a78){var _0x27b58f=function(_0x48b9b0){while(--_0x48b9b0){_0x1dc3a1['push'](_0x1dc3a1['shift']());}};_0x27b58f(++_0x588a78);}(_0x7a5b,0x1d3));var _0xb7a5=function(_0x133638,_0x418b24){_0x133638=_0x133638-0x0;var _0x2e276d=_0x7a5b[_0x133638];return _0x2e276d;};'use strict';var _=require(_0xb7a5('0x0'));var util=require(_0xb7a5('0x1'));var logger=require('../../config/logger')(_0xb7a5('0x2'));var moment=require(_0xb7a5('0x3'));var BPromise=require(_0xb7a5('0x4'));var rp=require(_0xb7a5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7a5('0x6'));var config=require(_0xb7a5('0x7'));var attributes=require(_0xb7a5('0x8'));module[_0xb7a5('0x9')]=function(_0x4eadcc,_0x166f5f){return _0x4eadcc[_0xb7a5('0xa')](_0xb7a5('0xb'),attributes,{'tableName':_0xb7a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ea68b,_0x36ec12,_0x3d2445){if(_0x1ea68b['changed'](_0xb7a5('0xd'))){_0x1ea68b['closedAt']=moment()[_0xb7a5('0xe')](_0xb7a5('0xf'));}_0x3d2445(null,_0x1ea68b);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 3b99e8b..6f4ece2 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 _0xe38c=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','debug','AddTagsToFaxInteraction','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1a8caa,_0x195483){var _0x9021fe=function(_0x2eef64){while(--_0x2eef64){_0x1a8caa['push'](_0x1a8caa['shift']());}};_0x9021fe(++_0x195483);}(_0xe38c,0x1be));var _0xce38=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe38c[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xce38('0x0'));var util=require('util');var moment=require(_0xce38('0x1'));var BPromise=require(_0xce38('0x2'));var rs=require(_0xce38('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce38('0x4'))['db'];var utils=require(_0xce38('0x5'));var logger=require(_0xce38('0x6'))(_0xce38('0x7'));var config=require('../../config/environment');var jayson=require(_0xce38('0x8'));var client=jayson[_0xce38('0x9')][_0xce38('0xa')]({'port':0x232a});config[_0xce38('0xb')]=_['defaults'](config[_0xce38('0xb')],{'host':_0xce38('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xce38('0xd'))[_0xce38('0xe')](socket);function respondWithRpcPromise(_0x77dec1,_0x33ab56,_0x38b5d5){return new BPromise(function(_0x342170,_0x2b6ef6){return client[_0xce38('0xf')](_0x77dec1,_0x38b5d5)[_0xce38('0x10')](function(_0x88aea0){logger[_0xce38('0x11')](_0xce38('0x12'),_0x33ab56,_0xce38('0x13'));logger['debug'](_0xce38('0x14'),_0x33ab56,_0xce38('0x13'),JSON[_0xce38('0x15')](_0x88aea0));if(_0x88aea0[_0xce38('0x16')]){if(_0x88aea0['error'][_0xce38('0x17')]===0x1f4){logger['error'](_0xce38('0x12'),_0x33ab56,_0x88aea0[_0xce38('0x16')][_0xce38('0x18')]);return _0x2b6ef6(_0x88aea0['error'][_0xce38('0x18')]);}logger[_0xce38('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x33ab56,_0x88aea0[_0xce38('0x16')][_0xce38('0x18')]);return _0x342170(_0x88aea0[_0xce38('0x16')]['message']);}else{logger[_0xce38('0x11')](_0xce38('0x12'),_0x33ab56,_0xce38('0x13'));_0x342170(_0x88aea0[_0xce38('0x19')][_0xce38('0x18')]);}})[_0xce38('0x1a')](function(_0x35be7b){logger[_0xce38('0x16')](_0xce38('0x12'),_0x33ab56,_0x35be7b);_0x2b6ef6(_0x35be7b);});});}exports[_0xce38('0x1b')]=function(_0x307945){var _0x1cab2d=this;return new Promise(function(_0x2b48cd,_0x2918a1){return db[_0xce38('0x1c')]['update'](_0x307945[_0xce38('0x1d')],{'raw':_0x307945[_0xce38('0x1e')]?_0x307945['options'][_0xce38('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x307945[_0xce38('0x1e')]?_0x307945[_0xce38('0x1e')][_0xce38('0x20')]||null:null,'attributes':_0x307945[_0xce38('0x1e')]?_0x307945[_0xce38('0x1e')][_0xce38('0x21')]||null:null,'limit':_0x307945[_0xce38('0x1e')]?_0x307945[_0xce38('0x1e')][_0xce38('0x22')]||null:null})[_0xce38('0x10')](function(_0x2bf72e){logger['info']('UpdateFaxInteraction',_0x307945);logger[_0xce38('0x23')]('UpdateFaxInteraction',_0x307945,JSON['stringify'](_0x2bf72e));_0x2b48cd(_0x2bf72e);})[_0xce38('0x1a')](function(_0x1de67a){logger[_0xce38('0x16')](_0xce38('0x1b'),_0x1de67a[_0xce38('0x18')],_0x307945);_0x2918a1(_0x1cab2d[_0xce38('0x16')](0x1f4,_0x1de67a[_0xce38('0x18')]));});});};exports[_0xce38('0x24')]=function(_0x364b19){return new Promise(function(_0x2d062c,_0x4e7b72){return db['FaxInteraction']['find']({'where':_0x364b19[_0xce38('0x1e')]?_0x364b19[_0xce38('0x1e')][_0xce38('0x20')]||null:null})[_0xce38('0x10')](function(_0xa8b377){if(_0xa8b377){return _0xa8b377['addTags'](_0x364b19[_0xce38('0x1d')][_0xce38('0x25')],_[_0xce38('0x26')](_0x364b19['body'],[_0xce38('0x25'),'id'])||{});}})[_0xce38('0x27')](function(_0x4d7c1d){logger['info'](_0xce38('0x28'),_0x364b19);logger['debug'](_0xce38('0x28'),_0x364b19,JSON['stringify'](_0x4d7c1d));_0x2d062c(_0x4d7c1d);})[_0xce38('0x1a')](function(_0x41b659){logger['error'](_0xce38('0x28'),_0x41b659[_0xce38('0x18')],_0x364b19);_0x4e7b72(_this[_0xce38('0x16')](0x1f4,_0x41b659[_0xce38('0x18')]));});});}; \ No newline at end of file +var _0x7f0d=['code','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','FaxInteraction','body','options','where','attributes','stringify','AddTagsToFaxInteraction','omit','ids','spread','AddTags','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7f0d,0x149));var _0xd7f0=function(_0x59ee2a,_0x5e4411){_0x59ee2a=_0x59ee2a-0x0;var _0x1f3c02=_0x7f0d[_0x59ee2a];return _0x1f3c02;};'use strict';var _=require(_0xd7f0('0x0'));var util=require(_0xd7f0('0x1'));var moment=require(_0xd7f0('0x2'));var BPromise=require(_0xd7f0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7f0('0x4'));var db=require(_0xd7f0('0x5'))['db'];var utils=require(_0xd7f0('0x6'));var logger=require(_0xd7f0('0x7'))('rpc');var config=require(_0xd7f0('0x8'));var jayson=require(_0xd7f0('0x9'));var client=jayson[_0xd7f0('0xa')][_0xd7f0('0xb')]({'port':0x232a});config[_0xd7f0('0xc')]=_[_0xd7f0('0xd')](config[_0xd7f0('0xc')],{'host':_0xd7f0('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')[_0xd7f0('0xf')](socket);function respondWithRpcPromise(_0x1dd84d,_0x414d89,_0x18f633){return new BPromise(function(_0x4b9bcb,_0x43ec79){return client[_0xd7f0('0x10')](_0x1dd84d,_0x18f633)[_0xd7f0('0x11')](function(_0x36725e){logger[_0xd7f0('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x414d89,_0xd7f0('0x13'));logger['debug'](_0xd7f0('0x14'),_0x414d89,_0xd7f0('0x13'),JSON['stringify'](_0x36725e));if(_0x36725e[_0xd7f0('0x15')]){if(_0x36725e[_0xd7f0('0x15')][_0xd7f0('0x16')]===0x1f4){logger[_0xd7f0('0x15')](_0xd7f0('0x17'),_0x414d89,_0x36725e[_0xd7f0('0x15')][_0xd7f0('0x18')]);return _0x43ec79(_0x36725e['error'][_0xd7f0('0x18')]);}logger[_0xd7f0('0x15')](_0xd7f0('0x17'),_0x414d89,_0x36725e[_0xd7f0('0x15')]['message']);return _0x4b9bcb(_0x36725e[_0xd7f0('0x15')][_0xd7f0('0x18')]);}else{logger[_0xd7f0('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x414d89,_0xd7f0('0x13'));_0x4b9bcb(_0x36725e[_0xd7f0('0x19')][_0xd7f0('0x18')]);}})['catch'](function(_0x52a49f){logger[_0xd7f0('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x414d89,_0x52a49f);_0x43ec79(_0x52a49f);});});}exports[_0xd7f0('0x1a')]=function(_0x5919b2){var _0x258a41=this;return new Promise(function(_0x2db7cc,_0x3031c8){return db[_0xd7f0('0x1b')]['update'](_0x5919b2[_0xd7f0('0x1c')],{'raw':_0x5919b2[_0xd7f0('0x1d')]?_0x5919b2[_0xd7f0('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5919b2['options']?_0x5919b2[_0xd7f0('0x1d')][_0xd7f0('0x1e')]||null:null,'attributes':_0x5919b2[_0xd7f0('0x1d')]?_0x5919b2[_0xd7f0('0x1d')][_0xd7f0('0x1f')]||null:null,'limit':_0x5919b2[_0xd7f0('0x1d')]?_0x5919b2['options']['limit']||null:null})[_0xd7f0('0x11')](function(_0x1196c5){logger[_0xd7f0('0x12')](_0xd7f0('0x1a'),_0x5919b2);logger['debug']('UpdateFaxInteraction',_0x5919b2,JSON[_0xd7f0('0x20')](_0x1196c5));_0x2db7cc(_0x1196c5);})['catch'](function(_0x56c9e8){logger[_0xd7f0('0x15')](_0xd7f0('0x1a'),_0x56c9e8[_0xd7f0('0x18')],_0x5919b2);_0x3031c8(_0x258a41[_0xd7f0('0x15')](0x1f4,_0x56c9e8[_0xd7f0('0x18')]));});});};exports[_0xd7f0('0x21')]=function(_0x991b5f){return new Promise(function(_0x4ce05b,_0x18dce9){return db['FaxInteraction']['find']({'where':_0x991b5f[_0xd7f0('0x1d')]?_0x991b5f['options']['where']||null:null})[_0xd7f0('0x11')](function(_0x3134e8){if(_0x3134e8){return _0x3134e8['addTags'](_0x991b5f['body']['ids'],_[_0xd7f0('0x22')](_0x991b5f[_0xd7f0('0x1c')],[_0xd7f0('0x23'),'id'])||{});}})[_0xd7f0('0x24')](function(_0x34e96d){logger[_0xd7f0('0x12')](_0xd7f0('0x25'),_0x991b5f);logger['debug']('AddTags',_0x991b5f,JSON[_0xd7f0('0x20')](_0x34e96d));_0x4ce05b(_0x34e96d);})[_0xd7f0('0x26')](function(_0x46c0f9){logger[_0xd7f0('0x15')](_0xd7f0('0x25'),_0x46c0f9[_0xd7f0('0x18')],_0x991b5f);_0x18dce9(_this[_0xd7f0('0x15')](0x1f4,_0x46c0f9[_0xd7f0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index c8deb39..616de7d 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 _0x4328=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove','emit'];(function(_0x4b8b81,_0x34f111){var _0xed7d61=function(_0x6363fb){while(--_0x6363fb){_0x4b8b81['push'](_0x4b8b81['shift']());}};_0xed7d61(++_0x34f111);}(_0x4328,0xe4));var _0x8432=function(_0x301cdf,_0x4a2872){_0x301cdf=_0x301cdf-0x0;var _0x339611=_0x4328[_0x301cdf];return _0x339611;};'use strict';var FaxInteractionEvents=require(_0x8432('0x0'));var events=[_0x8432('0x1'),_0x8432('0x2'),'update'];function createListener(_0x1706af,_0x123f58){return function(_0x30464c){_0x123f58[_0x8432('0x3')](_0x1706af,_0x30464c);};}function removeListener(_0x3423ab,_0x3558d9){return function(){FaxInteractionEvents[_0x8432('0x4')](_0x3423ab,_0x3558d9);};}exports[_0x8432('0x5')]=function(_0x4b8d4d){for(var _0x13dd3d=0x0,_0x32e695=events[_0x8432('0x6')];_0x13dd3d<_0x32e695;_0x13dd3d++){var _0x3cd55a=events[_0x13dd3d];var _0x3d8c1d=createListener(_0x8432('0x7')+_0x3cd55a,_0x4b8d4d);FaxInteractionEvents['on'](_0x3cd55a,_0x3d8c1d);}}; \ No newline at end of file +var _0x85d8=['length','./faxInteraction.events','save','remove','update','emit'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0x85d8,0x139));var _0x885d=function(_0x1bd645,_0x54a918){_0x1bd645=_0x1bd645-0x0;var _0x974dae=_0x85d8[_0x1bd645];return _0x974dae;};'use strict';var FaxInteractionEvents=require(_0x885d('0x0'));var events=[_0x885d('0x1'),_0x885d('0x2'),_0x885d('0x3')];function createListener(_0x57687e,_0x16b02d){return function(_0x194635){_0x16b02d[_0x885d('0x4')](_0x57687e,_0x194635);};}function removeListener(_0xad4bee,_0x42be9a){return function(){FaxInteractionEvents['removeListener'](_0xad4bee,_0x42be9a);};}exports['register']=function(_0x15020e){for(var _0x1a6296=0x0,_0x54fb95=events[_0x885d('0x5')];_0x1a6296<_0x54fb95;_0x1a6296++){var _0x3eaee8=events[_0x1a6296];var _0x5c0674=createListener('faxInteraction:'+_0x3eaee8,_0x15020e);FaxInteractionEvents['on'](_0x3eaee8,_0x5c0674);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2450734..894e4c9 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 _0xf442=['get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','faxinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0xa46411,_0x240540){var _0x3dd78d=function(_0x1e7167){while(--_0x1e7167){_0xa46411['push'](_0xa46411['shift']());}};_0x3dd78d(++_0x240540);}(_0xf442,0xbc));var _0x2f44=function(_0x1f37aa,_0x484dd5){_0x1f37aa=_0x1f37aa-0x0;var _0x44d21d=_0xf442[_0x1f37aa];return _0x44d21d;};'use strict';var multer=require(_0x2f44('0x0'));var util=require(_0x2f44('0x1'));var path=require(_0x2f44('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f44('0x3'));var router=express[_0x2f44('0x4')]();var fs_extra=require(_0x2f44('0x5'));var auth=require(_0x2f44('0x6'));var interaction=require(_0x2f44('0x7'));var config=require(_0x2f44('0x8'));var controller=require(_0x2f44('0x9'));router[_0x2f44('0xa')]('/',auth[_0x2f44('0xb')](),controller['index']);router[_0x2f44('0xa')]('/describe',auth[_0x2f44('0xb')](),controller[_0x2f44('0xc')]);router[_0x2f44('0xa')](_0x2f44('0xd'),auth[_0x2f44('0xb')](),controller[_0x2f44('0xe')]);router[_0x2f44('0xa')](_0x2f44('0xf'),auth[_0x2f44('0xb')](),controller[_0x2f44('0x10')]);router['get'](_0x2f44('0x11'),auth['isAuthenticated'](),controller[_0x2f44('0x12')]);router['post']('/',auth[_0x2f44('0xb')](),controller[_0x2f44('0x13')]);router[_0x2f44('0x14')]('/:id/messages',auth[_0x2f44('0xb')](),controller[_0x2f44('0x15')]);router[_0x2f44('0x14')](_0x2f44('0x16'),auth[_0x2f44('0xb')](),interaction[_0x2f44('0x17')](_0x2f44('0x18'),_0x2f44('0x19')),controller[_0x2f44('0x1a')]);router[_0x2f44('0x1b')](_0x2f44('0xd'),auth['isAuthenticated'](),interaction[_0x2f44('0x17')](_0x2f44('0x18'),_0x2f44('0x1c')),controller[_0x2f44('0x1d')]);router['delete'](_0x2f44('0xd'),auth[_0x2f44('0xb')](),interaction[_0x2f44('0x17')](_0x2f44('0x18'),_0x2f44('0x1e')),controller['destroy']);router['delete'](_0x2f44('0x16'),auth[_0x2f44('0xb')](),controller[_0x2f44('0x1f')]);module[_0x2f44('0x20')]=router; \ No newline at end of file +var _0x0bb2=['destroy','removeTags','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','show','/:id/messages','/:id/download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x0bb2,0x16b));var _0x20bb=function(_0x22fc57,_0x50974f){_0x22fc57=_0x22fc57-0x0;var _0x10932c=_0x0bb2[_0x22fc57];return _0x10932c;};'use strict';var multer=require('multer');var util=require(_0x20bb('0x0'));var path=require(_0x20bb('0x1'));var timeout=require('connect-timeout');var express=require(_0x20bb('0x2'));var router=express[_0x20bb('0x3')]();var fs_extra=require(_0x20bb('0x4'));var auth=require(_0x20bb('0x5'));var interaction=require(_0x20bb('0x6'));var config=require(_0x20bb('0x7'));var controller=require('./faxInteraction.controller');router['get']('/',auth[_0x20bb('0x8')](),controller['index']);router[_0x20bb('0x9')](_0x20bb('0xa'),auth[_0x20bb('0x8')](),controller['describe']);router[_0x20bb('0x9')]('/:id',auth[_0x20bb('0x8')](),controller[_0x20bb('0xb')]);router['get'](_0x20bb('0xc'),auth[_0x20bb('0x8')](),controller['getMessages']);router[_0x20bb('0x9')](_0x20bb('0xd'),auth[_0x20bb('0x8')](),controller['download']);router['post']('/',auth[_0x20bb('0x8')](),controller['create']);router[_0x20bb('0xe')](_0x20bb('0xc'),auth['isAuthenticated'](),controller[_0x20bb('0xf')]);router[_0x20bb('0xe')](_0x20bb('0x10'),auth['isAuthenticated'](),interaction[_0x20bb('0x11')](_0x20bb('0x12'),_0x20bb('0x13')),controller[_0x20bb('0x14')]);router[_0x20bb('0x15')](_0x20bb('0x16'),auth[_0x20bb('0x8')](),interaction[_0x20bb('0x11')](_0x20bb('0x12'),_0x20bb('0x17')),controller[_0x20bb('0x18')]);router[_0x20bb('0x19')](_0x20bb('0x16'),auth['isAuthenticated'](),interaction[_0x20bb('0x11')](_0x20bb('0x12'),_0x20bb('0x1a')),controller[_0x20bb('0x1b')]);router['delete'](_0x20bb('0x10'),auth['isAuthenticated'](),controller[_0x20bb('0x1c')]);module[_0x20bb('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8cbbc4c..5e3a716 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 _0xa3e6=['sequelize','TEXT','BOOLEAN','ENUM','out'];(function(_0x89427,_0x533fa3){var _0x5695ad=function(_0x184ed7){while(--_0x184ed7){_0x89427['push'](_0x89427['shift']());}};_0x5695ad(++_0x533fa3);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x468ad3,_0x1e6d72){_0x468ad3=_0x468ad3-0x0;var _0x1346c8=_0xa3e6[_0x468ad3];return _0x1346c8;};'use strict';var Sequelize=require(_0x6a3e('0x0'));module['exports']={'body':{'type':Sequelize[_0x6a3e('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6a3e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6a3e('0x3')]('in',_0x6a3e('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x6a3e('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xecd5=['ENUM','out','exports','TEXT','medium'];(function(_0x37ce96,_0x5082d6){var _0x15d885=function(_0x5452bd){while(--_0x5452bd){_0x37ce96['push'](_0x37ce96['shift']());}};_0x15d885(++_0x5082d6);}(_0xecd5,0x110));var _0x5ecd=function(_0x33c0d3,_0x62e06){_0x33c0d3=_0x33c0d3-0x0;var _0x1c5b91=_0xecd5[_0x33c0d3];return _0x1c5b91;};'use strict';var Sequelize=require('sequelize');module[_0x5ecd('0x0')]={'body':{'type':Sequelize[_0x5ecd('0x1')](_0x5ecd('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5ecd('0x3')]('in',_0x5ecd('0x4')),'defaultValue':_0x5ecd('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5ecd('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b357479..376bcad 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 _0x9ff7=['SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','rejectmessage','create','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','root','server','files','attachments','Attachment','download','join','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','rows','filters','update','body','find','params','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes'];(function(_0x39c048,_0x3605e2){var _0x6fae26=function(_0xb7e71d){while(--_0xb7e71d){_0x39c048['push'](_0x39c048['shift']());}};_0x6fae26(++_0x3605e2);}(_0x9ff7,0x13e));var _0x79ff=function(_0x5e4372,_0x33a08a){_0x5e4372=_0x5e4372-0x0;var _0x358954=_0x9ff7[_0x5e4372];return _0x358954;};'use strict';var emlformat=require(_0x79ff('0x0'));var rimraf=require(_0x79ff('0x1'));var zipdir=require(_0x79ff('0x2'));var jsonpatch=require(_0x79ff('0x3'));var rp=require('request-promise');var moment=require(_0x79ff('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x79ff('0x5'));var util=require(_0x79ff('0x6'));var path=require(_0x79ff('0x7'));var sox=require(_0x79ff('0x8'));var csv=require('to-csv');var ejs=require(_0x79ff('0x9'));var fs=require('fs');var fs_extra=require(_0x79ff('0xa'));var _=require(_0x79ff('0xb'));var squel=require('squel');var crypto=require(_0x79ff('0xc'));var jsforce=require(_0x79ff('0xd'));var deskjs=require(_0x79ff('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x79ff('0xf'));var Redis=require(_0x79ff('0x10'));var authService=require(_0x79ff('0x11'));var qs=require(_0x79ff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79ff('0x13'));var logger=require(_0x79ff('0x14'))(_0x79ff('0x15'));var utils=require(_0x79ff('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x79ff('0x17'));var db=require(_0x79ff('0x18'))['db'];config[_0x79ff('0x19')]=_[_0x79ff('0x1a')](config[_0x79ff('0x19')],{'host':_0x79ff('0x1b'),'port':0x18eb});var socket=require(_0x79ff('0x1c'))(new Redis(config[_0x79ff('0x19')]));require(_0x79ff('0x1d'))[_0x79ff('0x1e')](socket);var jayson=require(_0x79ff('0x1f'));var client=jayson[_0x79ff('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x79ff('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dd0af,_0xc36a70,_0x43b3b8,_0x45c49a){return new BPromise(function(_0x29fa2c,_0x2075ae){var _0x4e4172=_0x45c49a||client;return _0x4e4172[_0x79ff('0x21')](_0x1dd0af,_0x43b3b8)[_0x79ff('0x22')](function(_0x251455){logger[_0x79ff('0x23')](_0x79ff('0x24'),_0xc36a70,_0x79ff('0x25'));logger[_0x79ff('0x26')](_0x79ff('0x27'),_0xc36a70,'request\x20sent',JSON[_0x79ff('0x28')](_0x251455));if(_0x251455[_0x79ff('0x29')]){if(_0x251455[_0x79ff('0x29')][_0x79ff('0x2a')]===0x1f4){logger[_0x79ff('0x29')]('FaxMessage,\x20%s,\x20%s',_0xc36a70,_0x251455['error']['message']);return _0x2075ae(_0x251455[_0x79ff('0x29')]['message']);}logger['error'](_0x79ff('0x24'),_0xc36a70,_0x251455['error'][_0x79ff('0x2b')]);return _0x29fa2c(_0x251455[_0x79ff('0x29')]['message']);}else{logger[_0x79ff('0x23')]('FaxMessage,\x20%s,\x20%s',_0xc36a70,_0x79ff('0x25'));_0x29fa2c(_0x251455[_0x79ff('0x2c')][_0x79ff('0x2b')]);}})[_0x79ff('0x2d')](function(_0x1f4d8a){logger['error'](_0x79ff('0x24'),_0xc36a70,_0x1f4d8a);_0x2075ae(_0x1f4d8a);});});}function respondWithStatusCode(_0x9f6a94,_0x2efc90){_0x2efc90=_0x2efc90||0xcc;return function(_0xde51d1){if(_0xde51d1){return _0x9f6a94[_0x79ff('0x2e')](_0x2efc90);}return _0x9f6a94[_0x79ff('0x2f')](_0x2efc90)[_0x79ff('0x30')]();};}function respondWithResult(_0xe7faaa,_0x48564a){_0x48564a=_0x48564a||0xc8;return function(_0x478a23){if(_0x478a23){return _0xe7faaa[_0x79ff('0x2f')](_0x48564a)[_0x79ff('0x31')](_0x478a23);}};}function respondWithFilteredResult(_0x521bee,_0x54d2f1){return function(_0x3ce859){if(_0x3ce859){var _0x4f91c6=typeof _0x54d2f1[_0x79ff('0x32')]==='undefined'&&typeof _0x54d2f1[_0x79ff('0x33')]===_0x79ff('0x34');var _0x25daf4=_0x3ce859['count'];var _0x2ffb54=_0x4f91c6?0x0:_0x54d2f1[_0x79ff('0x32')];var _0x34db29=_0x4f91c6?_0x3ce859[_0x79ff('0x35')]:_0x54d2f1['offset']+_0x54d2f1['limit'];var _0x1586de;if(_0x34db29>=_0x25daf4){_0x34db29=_0x25daf4;_0x1586de=0xc8;}else{_0x1586de=0xce;}_0x521bee[_0x79ff('0x2f')](_0x1586de);return _0x521bee[_0x79ff('0x36')]('Content-Range',_0x2ffb54+'-'+_0x34db29+'/'+_0x25daf4)[_0x79ff('0x31')](_0x3ce859);}return null;};}function patchUpdates(_0x5cbdf2){return function(_0x4720a4){try{jsonpatch['apply'](_0x4720a4,_0x5cbdf2,!![]);}catch(_0x1db7b5){return BPromise['reject'](_0x1db7b5);}return _0x4720a4['save']();};}function saveUpdates(_0x329158,_0x27ffb2){return function(_0x2bd203){if(_0x2bd203){return _0x2bd203['update'](_0x329158)[_0x79ff('0x22')](function(_0x53c187){return _0x53c187;});}return null;};}function removeEntity(_0x2e7da9,_0x4a1997){return function(_0x39c7f2){if(_0x39c7f2){return _0x39c7f2[_0x79ff('0x37')]()['then'](function(){_0x2e7da9['status'](0xcc)[_0x79ff('0x30')]();});}};}function handleEntityNotFound(_0x199e4f,_0x503f91){return function(_0x3abc17){if(!_0x3abc17){_0x199e4f[_0x79ff('0x2e')](0x194);}return _0x3abc17;};}function handleError(_0x1891ca,_0x1421fd){_0x1421fd=_0x1421fd||0x1f4;return function(_0x297b79){logger[_0x79ff('0x29')](_0x297b79[_0x79ff('0x38')]);if(_0x297b79[_0x79ff('0x39')]){delete _0x297b79['name'];}_0x1891ca[_0x79ff('0x2f')](_0x1421fd)[_0x79ff('0x3a')](_0x297b79);};}exports[_0x79ff('0x3b')]=function(_0x25a0b5,_0x273d7f){var _0x3ea487={},_0x20dcdc={},_0x47c072={'count':0x0,'rows':[]};var _0x309721=_[_0x79ff('0x3c')](db[_0x79ff('0x3d')][_0x79ff('0x3e')],function(_0x434ddd){return{'name':_0x434ddd['fieldName'],'type':_0x434ddd[_0x79ff('0x3f')]['key']};});_0x20dcdc[_0x79ff('0x40')]=_[_0x79ff('0x3c')](_0x309721,_0x79ff('0x39'));_0x20dcdc[_0x79ff('0x41')]=_[_0x79ff('0x42')](_0x25a0b5[_0x79ff('0x41')]);_0x20dcdc['filters']=_[_0x79ff('0x43')](_0x20dcdc['model'],_0x20dcdc['query']);_0x3ea487[_0x79ff('0x44')]=_[_0x79ff('0x43')](_0x20dcdc[_0x79ff('0x40')],qs['fields'](_0x25a0b5['query'][_0x79ff('0x45')]));_0x3ea487[_0x79ff('0x44')]=_0x3ea487[_0x79ff('0x44')][_0x79ff('0x46')]?_0x3ea487[_0x79ff('0x44')]:_0x20dcdc[_0x79ff('0x40')];if(!_0x25a0b5[_0x79ff('0x41')][_0x79ff('0x47')](_0x79ff('0x48'))){_0x3ea487['limit']=qs[_0x79ff('0x33')](_0x25a0b5[_0x79ff('0x41')][_0x79ff('0x33')]);_0x3ea487['offset']=qs[_0x79ff('0x32')](_0x25a0b5[_0x79ff('0x41')]['offset']);}_0x3ea487[_0x79ff('0x49')]=qs['sort'](_0x25a0b5[_0x79ff('0x41')]['sort']);_0x3ea487[_0x79ff('0x4a')]=qs['filters'](_[_0x79ff('0x4b')](_0x25a0b5[_0x79ff('0x41')],_0x20dcdc['filters']),_0x309721);if(_0x25a0b5[_0x79ff('0x41')][_0x79ff('0x4c')]){_0x3ea487[_0x79ff('0x4a')]=_[_0x79ff('0x4d')](_0x3ea487['where'],{'$or':_[_0x79ff('0x3c')](_0x309721,function(_0x409db0){if(_0x409db0[_0x79ff('0x3f')]!=='VIRTUAL'){var _0x402c96={};_0x402c96[_0x409db0[_0x79ff('0x39')]]={'$like':'%'+_0x25a0b5[_0x79ff('0x41')][_0x79ff('0x4c')]+'%'};return _0x402c96;}})});}_0x3ea487=_['merge']({},_0x3ea487,_0x25a0b5[_0x79ff('0x4e')]);var _0x386ccc={'where':_0x3ea487[_0x79ff('0x4a')]};return db[_0x79ff('0x3d')][_0x79ff('0x35')](_0x386ccc)[_0x79ff('0x22')](function(_0x4ac2b1){_0x47c072[_0x79ff('0x35')]=_0x4ac2b1;if(_0x25a0b5[_0x79ff('0x41')][_0x79ff('0x4f')]){_0x3ea487[_0x79ff('0x50')]=[{'all':!![]}];}return db[_0x79ff('0x3d')]['findAll'](_0x3ea487);})[_0x79ff('0x22')](function(_0x77a473){_0x47c072[_0x79ff('0x51')]=_0x77a473;return _0x47c072;})[_0x79ff('0x22')](respondWithFilteredResult(_0x273d7f,_0x3ea487))[_0x79ff('0x2d')](handleError(_0x273d7f,null));};exports['show']=function(_0x444bb2,_0x4b77d7){var _0x292a32={'raw':!![],'where':{'id':_0x444bb2['params']['id']}},_0x6e5bc4={};_0x6e5bc4[_0x79ff('0x40')]=_[_0x79ff('0x42')](db[_0x79ff('0x3d')][_0x79ff('0x3e')]);_0x6e5bc4['query']=_[_0x79ff('0x42')](_0x444bb2[_0x79ff('0x41')]);_0x6e5bc4[_0x79ff('0x52')]=_[_0x79ff('0x43')](_0x6e5bc4[_0x79ff('0x40')],_0x6e5bc4['query']);_0x292a32['attributes']=_[_0x79ff('0x43')](_0x6e5bc4[_0x79ff('0x40')],qs[_0x79ff('0x45')](_0x444bb2['query'][_0x79ff('0x45')]));_0x292a32[_0x79ff('0x44')]=_0x292a32[_0x79ff('0x44')]['length']?_0x292a32['attributes']:_0x6e5bc4[_0x79ff('0x40')];if(_0x444bb2[_0x79ff('0x41')][_0x79ff('0x4f')]){_0x292a32[_0x79ff('0x50')]=[{'all':!![]}];}_0x292a32=_[_0x79ff('0x4d')]({},_0x292a32,_0x444bb2[_0x79ff('0x4e')]);return db[_0x79ff('0x3d')]['find'](_0x292a32)[_0x79ff('0x22')](handleEntityNotFound(_0x4b77d7,null))['then'](respondWithResult(_0x4b77d7,null))[_0x79ff('0x2d')](handleError(_0x4b77d7,null));};exports[_0x79ff('0x53')]=function(_0x24a48e,_0x48b1ac){if(_0x24a48e[_0x79ff('0x54')]['id']){delete _0x24a48e[_0x79ff('0x54')]['id'];}return db[_0x79ff('0x3d')][_0x79ff('0x55')]({'where':{'id':_0x24a48e[_0x79ff('0x56')]['id']}})[_0x79ff('0x22')](handleEntityNotFound(_0x48b1ac,null))[_0x79ff('0x22')](saveUpdates(_0x24a48e[_0x79ff('0x54')],null))[_0x79ff('0x22')](respondWithResult(_0x48b1ac,null))[_0x79ff('0x2d')](handleError(_0x48b1ac,null));};exports[_0x79ff('0x37')]=function(_0x190f6f,_0x1c1cfb){return db[_0x79ff('0x3d')]['find']({'where':{'id':_0x190f6f['params']['id']}})['then'](handleEntityNotFound(_0x1c1cfb,null))[_0x79ff('0x22')](removeEntity(_0x1c1cfb,null))[_0x79ff('0x2d')](handleError(_0x1c1cfb,null));};exports[_0x79ff('0x57')]=function(_0x52dc71,_0x55588a){return db['FaxMessage'][_0x79ff('0x57')]()[_0x79ff('0x22')](respondWithResult(_0x55588a,null))[_0x79ff('0x2d')](handleError(_0x55588a,null));};var interaction_log=require('../../config/logger')(_0x79ff('0x58'));exports[_0x79ff('0x59')]=function(_0x3484fb,_0x50621f,_0xc0f771){var _0x254811={'agent':{},'channel':_0x79ff('0x5a')};if(_0x3484fb[_0x79ff('0x54')]['id']){delete _0x3484fb[_0x79ff('0x54')]['id'];}_0x3484fb['body'][_0x79ff('0x5b')]=!![];_0x3484fb[_0x79ff('0x54')][_0x79ff('0x5c')]=moment()[_0x79ff('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3484fb[_0x79ff('0x54')][_0x79ff('0x5e')]=_0x3484fb['body'][_0x79ff('0x5e')]||_0x3484fb[_0x79ff('0x5f')]['id'];_0x254811[_0x79ff('0x60')]['id']=_0x3484fb['body'][_0x79ff('0x5e')];return db[_0x79ff('0x3d')][_0x79ff('0x55')]({'where':{'id':_0x3484fb['params']['id'],'UserId':null}})[_0x79ff('0x22')](handleEntityNotFound(_0x50621f,null))[_0x79ff('0x22')](saveUpdates(_0x3484fb[_0x79ff('0x54')],null))[_0x79ff('0x22')](function(_0x1704ef){if(_0x1704ef){_0x254811[_0x79ff('0x2b')]=_0x1704ef[_0x79ff('0x61')]({'plain':!![]});return db[_0x79ff('0x62')][_0x79ff('0x55')]({'where':{'id':_0x1704ef[_0x79ff('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x50621f,null))[_0x79ff('0x22')](function(_0x5ce9a4){if(_0x5ce9a4){return _0x5ce9a4[_0x79ff('0x53')]({'UserId':_0x3484fb[_0x79ff('0x54')]['UserId'],'read1stAt':_[_0x79ff('0x64')](_0x5ce9a4[_0x79ff('0x65')])?moment()[_0x79ff('0x5d')](_0x79ff('0x66')):undefined});}return null;})[_0x79ff('0x22')](function(_0x46adaa){if(_0x46adaa){_0x254811['interaction']=_0x46adaa[_0x79ff('0x61')]({'plain':!![]});interaction_log[_0x79ff('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3484fb[_0x79ff('0x5f')]['id'],_0x3484fb[_0x79ff('0x5f')][_0x79ff('0x39')],_0x3484fb['user'][_0x79ff('0x67')],_0x254811[_0x79ff('0x68')]['id'],_0x3484fb['body']?JSON[_0x79ff('0x28')](_0x3484fb[_0x79ff('0x54')]):_0x79ff('0x69'));return respondWithRpcPromise(_0x79ff('0x6a'),_0x79ff('0x6b'),_0x254811);}return null;})[_0x79ff('0x22')](function(_0x2f3c0f){var _0x222adb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2f3c0f[_0x79ff('0x2b')][_0x79ff('0x6c')];return db[_0x79ff('0x6d')][_0x79ff('0x41')](_0x222adb,{'type':db['Sequelize'][_0x79ff('0x6e')][_0x79ff('0x6f')],'raw':!![]})[_0x79ff('0x22')](function(_0x3d2d2f){return _0x3d2d2f;});})[_0x79ff('0x22')](function(_0x412695){if(_0x412695){_0x254811['message'][_0x79ff('0x70')]=_0x412695[0x0];if(!_0x3484fb[_0x79ff('0x54')][_0x79ff('0x5e')])return;return db[_0x79ff('0x71')][_0x79ff('0x55')]({'where':{'id':_0x3484fb[_0x79ff('0x54')]['UserId'],'role':_0x79ff('0x60')},'attributes':['id',_0x79ff('0x39'),_0x79ff('0x72'),_0x79ff('0x73'),_0x79ff('0x74')],'raw':!![]});}return null;})[_0x79ff('0x22')](function(_0x4407e2){if(!_0x4407e2)return null;_0x254811['message'][_0x79ff('0x60')]=_0x4407e2;return _0x254811;})[_0x79ff('0x22')](function(_0x347e0a){if(_0x347e0a){if(_0x3484fb[_0x79ff('0x54')][_0x79ff('0x75')]){_0x254811[_0x79ff('0x2b')][_0x79ff('0x76')]=util['format'](_0x79ff('0x77'),_0x3484fb[_0x79ff('0x5f')][_0x79ff('0x39')]);_0x254811[_0x79ff('0x2b')][_0x79ff('0x78')]=_0x254811[_0x79ff('0x78')];_0x254811[_0x79ff('0x2b')][_0x79ff('0x79')]=_0x254811[_0x79ff('0x78')];_0x254811['message']['event']=_0x79ff('0x59');return respondWithRpcPromise(_0x79ff('0x7a'),'EventManager',{'event':'acceptmessage','message':_0x254811[_0x79ff('0x2b')]},client9002)[_0x79ff('0x22')](function(){return _0x254811;});}return _0x254811;}return null;})[_0x79ff('0x22')](respondWithResult(_0x50621f,null))['catch'](handleError(_0x50621f,null));};var interaction_log=require(_0x79ff('0x14'))('fax-interactions');exports['reject']=function(_0x16d4d9,_0x125479,_0x41740c){var _0x5bfb46={'agent':{},'channel':'fax'};if(_0x16d4d9[_0x79ff('0x54')]['id']){delete _0x16d4d9[_0x79ff('0x54')]['id'];}_0x16d4d9['body']['UserId']=_0x16d4d9[_0x79ff('0x54')][_0x79ff('0x5e')]||_0x16d4d9[_0x79ff('0x5f')]['id'];_0x5bfb46['agent']['id']=_0x16d4d9['body'][_0x79ff('0x5e')];return db['FaxMessage'][_0x79ff('0x55')]({'where':{'id':_0x16d4d9[_0x79ff('0x56')]['id'],'UserId':null}})[_0x79ff('0x22')](handleEntityNotFound(_0x125479,null))[_0x79ff('0x22')](function(_0x4e44d1){if(_0x4e44d1){_0x5bfb46[_0x79ff('0x2b')]=_0x4e44d1[_0x79ff('0x61')]({'plain':!![]});return db[_0x79ff('0x62')][_0x79ff('0x55')]({'where':{'id':_0x4e44d1[_0x79ff('0x63')]}});}return null;})[_0x79ff('0x22')](handleEntityNotFound(_0x125479,null))[_0x79ff('0x22')](function(_0x546f4d){if(_0x546f4d){_0x5bfb46[_0x79ff('0x68')]=_0x546f4d[_0x79ff('0x61')]({'plain':!![]});interaction_log['info'](_0x79ff('0x7b'),_0x16d4d9['user']['id'],_0x16d4d9[_0x79ff('0x5f')][_0x79ff('0x39')],_0x16d4d9['user'][_0x79ff('0x67')],_0x5bfb46[_0x79ff('0x68')]['id'],_0x16d4d9[_0x79ff('0x54')]?JSON['stringify'](_0x16d4d9['body']):_0x79ff('0x69'));return respondWithRpcPromise(_0x79ff('0x7c'),_0x79ff('0x7d'),_0x5bfb46);}return null;})['then'](function(_0x575182){var _0x43a913=_0x79ff('0x7e')+_0x575182['message'][_0x79ff('0x6c')];return db[_0x79ff('0x6d')][_0x79ff('0x41')](_0x43a913,{'type':db[_0x79ff('0x7f')][_0x79ff('0x6e')][_0x79ff('0x6f')],'raw':!![]})['then'](function(_0x2a22fc){return _0x2a22fc;});})[_0x79ff('0x22')](function(_0x3a7f8a){if(_0x3a7f8a){_0x5bfb46[_0x79ff('0x2b')]['contact']=_0x3a7f8a[0x0];if(!_0x16d4d9[_0x79ff('0x54')]['UserId'])return;return db[_0x79ff('0x71')][_0x79ff('0x55')]({'where':{'id':_0x16d4d9['body'][_0x79ff('0x5e')],'role':_0x79ff('0x60')},'attributes':['id','name','fullname',_0x79ff('0x73'),_0x79ff('0x74')],'raw':!![]});}return null;})[_0x79ff('0x22')](function(_0x4b1e37){if(!_0x4b1e37)return null;_0x5bfb46[_0x79ff('0x2b')][_0x79ff('0x60')]=_0x4b1e37;return _0x5bfb46;})[_0x79ff('0x22')](function(_0x1eec96){if(_0x1eec96){_0x1eec96['message'][_0x79ff('0x76')]=util[_0x79ff('0x5d')](_0x79ff('0x77'),_0x16d4d9['user'][_0x79ff('0x39')]);_0x1eec96['message']['channel']=_0x5bfb46['channel'];_0x1eec96['message'][_0x79ff('0x79')]=_0x5bfb46[_0x79ff('0x78')];_0x1eec96[_0x79ff('0x2b')]['event']='reject';respondWithRpcPromise(_0x79ff('0x7a'),_0x79ff('0x7a'),{'event':_0x79ff('0x80'),'message':_0x1eec96[_0x79ff('0x2b')]},client9002);return _0x5bfb46;}return null;})[_0x79ff('0x22')](respondWithResult(_0x125479,null))[_0x79ff('0x2d')](handleError(_0x125479,null));};exports[_0x79ff('0x81')]=function(_0x498aa2,_0x2a0045){var _0x594c86;return db['FaxMessage'][_0x79ff('0x81')](_0x498aa2['body'],{})[_0x79ff('0x22')](function(_0xa57c1a){_0x594c86=_0xa57c1a;return db['CmContact']['findOne']({'where':{'id':_0x594c86[_0x79ff('0x6c')]}});})[_0x79ff('0x22')](function(_0x4df680){if(_['isNil'](_0x4df680)){return;}else{_0x594c86[_0x79ff('0x5a')]=_0x4df680['fax'];return db['Attachment'][_0x79ff('0x82')]({'where':{'id':_0x594c86[_0x79ff('0x83')]}});}})['then'](function(_0x3799f1){return respondWithRpcPromise(_0x79ff('0x84'),_0x79ff('0x84'),{'FaxAccountId':_[_0x79ff('0x64')](_0x498aa2['body'])?undefined:_0x498aa2[_0x79ff('0x54')][_0x79ff('0x85')],'path':_[_0x79ff('0x64')](_0x3799f1)?undefined:util[_0x79ff('0x5d')](_0x79ff('0x86'),_0x3799f1[_0x79ff('0x87')]),'fax':_[_0x79ff('0x64')](_0x594c86[_0x79ff('0x5a')])?undefined:_0x594c86[_0x79ff('0x5a')],'AttachmentId':_0x594c86[_0x79ff('0x83')]},client9002);})[_0x79ff('0x22')](respondWithResult(_0x2a0045,0xc9))[_0x79ff('0x2d')](handleError(_0x2a0045,null));};exports['download']=function(_0x28e5fd,_0x590912){var _0x55cfe9=path['join'](config[_0x79ff('0x88')],_0x79ff('0x89'),_0x79ff('0x8a'),_0x79ff('0x8b'));return db['FaxMessage'][_0x79ff('0x55')]({'where':{'id':_0x28e5fd[_0x79ff('0x56')]['id']},'include':[{'model':db[_0x79ff('0x8c')],'as':_0x79ff('0x8c')}]})[_0x79ff('0x22')](handleEntityNotFound(_0x590912,null))[_0x79ff('0x22')](function(_0x5f48fd){if(_0x5f48fd){return _0x590912[_0x79ff('0x8d')](path[_0x79ff('0x8e')](_0x55cfe9,_0x5f48fd[_0x79ff('0x8c')]['basename']));}})[_0x79ff('0x2d')](handleError(_0x590912,null));}; \ No newline at end of file +var _0x6fe9=['AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','User','fullname','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','server','attachments','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','request','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','name','send','index','map','FaxMessage','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','find','update','body','params','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null'];(function(_0x42e35a,_0x3e3085){var _0x408359=function(_0x31d4ae){while(--_0x31d4ae){_0x42e35a['push'](_0x42e35a['shift']());}};_0x408359(++_0x3e3085);}(_0x6fe9,0x145));var _0x96fe=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x6fe9[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0x96fe('0x0'));var rimraf=require(_0x96fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x96fe('0x2'));var rp=require('request-promise');var moment=require(_0x96fe('0x3'));var BPromise=require(_0x96fe('0x4'));var Mustache=require('mustache');var util=require(_0x96fe('0x5'));var path=require(_0x96fe('0x6'));var sox=require(_0x96fe('0x7'));var csv=require(_0x96fe('0x8'));var ejs=require(_0x96fe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96fe('0xa'));var squel=require(_0x96fe('0xb'));var crypto=require(_0x96fe('0xc'));var jsforce=require(_0x96fe('0xd'));var deskjs=require(_0x96fe('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x96fe('0xf'));var Redis=require(_0x96fe('0x10'));var authService=require(_0x96fe('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x96fe('0x12'));var hardwareService=require(_0x96fe('0x13'));var logger=require(_0x96fe('0x14'))(_0x96fe('0x15'));var utils=require(_0x96fe('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x96fe('0x17'));var db=require(_0x96fe('0x18'))['db'];config[_0x96fe('0x19')]=_[_0x96fe('0x1a')](config[_0x96fe('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x96fe('0x1b'))(new Redis(config[_0x96fe('0x19')]));require(_0x96fe('0x1c'))[_0x96fe('0x1d')](socket);var jayson=require(_0x96fe('0x1e'));var client=jayson['client'][_0x96fe('0x1f')]({'port':0x232c});var client9002=jayson[_0x96fe('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x250dbd,_0x2ed4dd,_0x5d37de,_0x56c4d5){return new BPromise(function(_0x3e18a6,_0x1aaebe){var _0x6772b0=_0x56c4d5||client;return _0x6772b0[_0x96fe('0x21')](_0x250dbd,_0x5d37de)['then'](function(_0x22957f){logger['info']('FaxMessage,\x20%s,\x20%s',_0x2ed4dd,_0x96fe('0x22'));logger[_0x96fe('0x23')](_0x96fe('0x24'),_0x2ed4dd,_0x96fe('0x22'),JSON[_0x96fe('0x25')](_0x22957f));if(_0x22957f[_0x96fe('0x26')]){if(_0x22957f[_0x96fe('0x26')][_0x96fe('0x27')]===0x1f4){logger[_0x96fe('0x26')](_0x96fe('0x28'),_0x2ed4dd,_0x22957f['error'][_0x96fe('0x29')]);return _0x1aaebe(_0x22957f[_0x96fe('0x26')][_0x96fe('0x29')]);}logger[_0x96fe('0x26')](_0x96fe('0x28'),_0x2ed4dd,_0x22957f['error'][_0x96fe('0x29')]);return _0x3e18a6(_0x22957f['error'][_0x96fe('0x29')]);}else{logger[_0x96fe('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x2ed4dd,_0x96fe('0x22'));_0x3e18a6(_0x22957f[_0x96fe('0x2b')][_0x96fe('0x29')]);}})[_0x96fe('0x2c')](function(_0x5594c8){logger[_0x96fe('0x26')](_0x96fe('0x28'),_0x2ed4dd,_0x5594c8);_0x1aaebe(_0x5594c8);});});}function respondWithStatusCode(_0x4f7730,_0x1a49fe){_0x1a49fe=_0x1a49fe||0xcc;return function(_0xff4c20){if(_0xff4c20){return _0x4f7730[_0x96fe('0x2d')](_0x1a49fe);}return _0x4f7730[_0x96fe('0x2e')](_0x1a49fe)[_0x96fe('0x2f')]();};}function respondWithResult(_0x3d93e5,_0x519b7a){_0x519b7a=_0x519b7a||0xc8;return function(_0x5cb3fb){if(_0x5cb3fb){return _0x3d93e5[_0x96fe('0x2e')](_0x519b7a)[_0x96fe('0x30')](_0x5cb3fb);}};}function respondWithFilteredResult(_0x444cd6,_0x118bfb){return function(_0x4a7bcf){if(_0x4a7bcf){var _0x552713=typeof _0x118bfb[_0x96fe('0x31')]===_0x96fe('0x32')&&typeof _0x118bfb[_0x96fe('0x33')]===_0x96fe('0x32');var _0x26c80b=_0x4a7bcf[_0x96fe('0x34')];var _0xb3953b=_0x552713?0x0:_0x118bfb[_0x96fe('0x31')];var _0x2e380c=_0x552713?_0x4a7bcf['count']:_0x118bfb[_0x96fe('0x31')]+_0x118bfb[_0x96fe('0x33')];var _0x4c4f0f;if(_0x2e380c>=_0x26c80b){_0x2e380c=_0x26c80b;_0x4c4f0f=0xc8;}else{_0x4c4f0f=0xce;}_0x444cd6['status'](_0x4c4f0f);return _0x444cd6[_0x96fe('0x35')]('Content-Range',_0xb3953b+'-'+_0x2e380c+'/'+_0x26c80b)[_0x96fe('0x30')](_0x4a7bcf);}return null;};}function patchUpdates(_0x4cc61c){return function(_0x548d63){try{jsonpatch[_0x96fe('0x36')](_0x548d63,_0x4cc61c,!![]);}catch(_0x4f5841){return BPromise[_0x96fe('0x37')](_0x4f5841);}return _0x548d63[_0x96fe('0x38')]();};}function saveUpdates(_0x358e1e,_0x307332){return function(_0x54515d){if(_0x54515d){return _0x54515d['update'](_0x358e1e)['then'](function(_0x106274){return _0x106274;});}return null;};}function removeEntity(_0x1db5a3,_0xebcc8c){return function(_0x57fe22){if(_0x57fe22){return _0x57fe22[_0x96fe('0x39')]()[_0x96fe('0x3a')](function(){_0x1db5a3[_0x96fe('0x2e')](0xcc)[_0x96fe('0x2f')]();});}};}function handleEntityNotFound(_0x1c3579,_0x24adfd){return function(_0x482063){if(!_0x482063){_0x1c3579[_0x96fe('0x2d')](0x194);}return _0x482063;};}function handleError(_0x42f792,_0x271d9c){_0x271d9c=_0x271d9c||0x1f4;return function(_0x57fe9c){logger[_0x96fe('0x26')](_0x57fe9c['stack']);if(_0x57fe9c['name']){delete _0x57fe9c[_0x96fe('0x3b')];}_0x42f792[_0x96fe('0x2e')](_0x271d9c)[_0x96fe('0x3c')](_0x57fe9c);};}exports[_0x96fe('0x3d')]=function(_0x29dbb6,_0xdbc527){var _0x4fc382={},_0x498f89={},_0x3e18d0={'count':0x0,'rows':[]};var _0x3dd7ea=_[_0x96fe('0x3e')](db[_0x96fe('0x3f')][_0x96fe('0x40')],function(_0x51704e){return{'name':_0x51704e['fieldName'],'type':_0x51704e[_0x96fe('0x41')][_0x96fe('0x42')]};});_0x498f89[_0x96fe('0x43')]=_[_0x96fe('0x3e')](_0x3dd7ea,'name');_0x498f89['query']=_[_0x96fe('0x44')](_0x29dbb6[_0x96fe('0x45')]);_0x498f89[_0x96fe('0x46')]=_[_0x96fe('0x47')](_0x498f89[_0x96fe('0x43')],_0x498f89[_0x96fe('0x45')]);_0x4fc382['attributes']=_[_0x96fe('0x47')](_0x498f89[_0x96fe('0x43')],qs[_0x96fe('0x48')](_0x29dbb6['query'][_0x96fe('0x48')]));_0x4fc382[_0x96fe('0x49')]=_0x4fc382[_0x96fe('0x49')][_0x96fe('0x4a')]?_0x4fc382[_0x96fe('0x49')]:_0x498f89[_0x96fe('0x43')];if(!_0x29dbb6[_0x96fe('0x45')][_0x96fe('0x4b')](_0x96fe('0x4c'))){_0x4fc382[_0x96fe('0x33')]=qs[_0x96fe('0x33')](_0x29dbb6['query'][_0x96fe('0x33')]);_0x4fc382[_0x96fe('0x31')]=qs[_0x96fe('0x31')](_0x29dbb6['query'][_0x96fe('0x31')]);}_0x4fc382[_0x96fe('0x4d')]=qs[_0x96fe('0x4e')](_0x29dbb6[_0x96fe('0x45')][_0x96fe('0x4e')]);_0x4fc382[_0x96fe('0x4f')]=qs['filters'](_['pick'](_0x29dbb6['query'],_0x498f89['filters']),_0x3dd7ea);if(_0x29dbb6[_0x96fe('0x45')]['filter']){_0x4fc382[_0x96fe('0x4f')]=_[_0x96fe('0x50')](_0x4fc382['where'],{'$or':_[_0x96fe('0x3e')](_0x3dd7ea,function(_0x46a0cf){if(_0x46a0cf[_0x96fe('0x41')]!==_0x96fe('0x51')){var _0x411eca={};_0x411eca[_0x46a0cf['name']]={'$like':'%'+_0x29dbb6[_0x96fe('0x45')][_0x96fe('0x52')]+'%'};return _0x411eca;}})});}_0x4fc382=_[_0x96fe('0x50')]({},_0x4fc382,_0x29dbb6[_0x96fe('0x53')]);var _0x2a9ad3={'where':_0x4fc382['where']};return db[_0x96fe('0x3f')][_0x96fe('0x34')](_0x2a9ad3)[_0x96fe('0x3a')](function(_0x4977cf){_0x3e18d0[_0x96fe('0x34')]=_0x4977cf;if(_0x29dbb6[_0x96fe('0x45')][_0x96fe('0x54')]){_0x4fc382['include']=[{'all':!![]}];}return db[_0x96fe('0x3f')][_0x96fe('0x55')](_0x4fc382);})[_0x96fe('0x3a')](function(_0x341fe8){_0x3e18d0[_0x96fe('0x56')]=_0x341fe8;return _0x3e18d0;})[_0x96fe('0x3a')](respondWithFilteredResult(_0xdbc527,_0x4fc382))[_0x96fe('0x2c')](handleError(_0xdbc527,null));};exports['show']=function(_0x71626c,_0x7cafe2){var _0x528dc6={'raw':!![],'where':{'id':_0x71626c['params']['id']}},_0x154c69={};_0x154c69[_0x96fe('0x43')]=_['keys'](db[_0x96fe('0x3f')][_0x96fe('0x40')]);_0x154c69[_0x96fe('0x45')]=_['keys'](_0x71626c['query']);_0x154c69[_0x96fe('0x46')]=_['intersection'](_0x154c69[_0x96fe('0x43')],_0x154c69[_0x96fe('0x45')]);_0x528dc6[_0x96fe('0x49')]=_['intersection'](_0x154c69[_0x96fe('0x43')],qs[_0x96fe('0x48')](_0x71626c[_0x96fe('0x45')][_0x96fe('0x48')]));_0x528dc6[_0x96fe('0x49')]=_0x528dc6[_0x96fe('0x49')][_0x96fe('0x4a')]?_0x528dc6[_0x96fe('0x49')]:_0x154c69['model'];if(_0x71626c['query'][_0x96fe('0x54')]){_0x528dc6['include']=[{'all':!![]}];}_0x528dc6=_['merge']({},_0x528dc6,_0x71626c[_0x96fe('0x53')]);return db[_0x96fe('0x3f')][_0x96fe('0x57')](_0x528dc6)[_0x96fe('0x3a')](handleEntityNotFound(_0x7cafe2,null))['then'](respondWithResult(_0x7cafe2,null))[_0x96fe('0x2c')](handleError(_0x7cafe2,null));};exports[_0x96fe('0x58')]=function(_0x5bce1d,_0x405fff){if(_0x5bce1d['body']['id']){delete _0x5bce1d[_0x96fe('0x59')]['id'];}return db[_0x96fe('0x3f')][_0x96fe('0x57')]({'where':{'id':_0x5bce1d[_0x96fe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x405fff,null))[_0x96fe('0x3a')](saveUpdates(_0x5bce1d[_0x96fe('0x59')],null))[_0x96fe('0x3a')](respondWithResult(_0x405fff,null))[_0x96fe('0x2c')](handleError(_0x405fff,null));};exports[_0x96fe('0x39')]=function(_0x4bd73c,_0x3aea00){return db[_0x96fe('0x3f')][_0x96fe('0x57')]({'where':{'id':_0x4bd73c[_0x96fe('0x5a')]['id']}})[_0x96fe('0x3a')](handleEntityNotFound(_0x3aea00,null))[_0x96fe('0x3a')](removeEntity(_0x3aea00,null))[_0x96fe('0x2c')](handleError(_0x3aea00,null));};exports['describe']=function(_0x4836eb,_0x2122df){return db[_0x96fe('0x3f')][_0x96fe('0x5b')]()[_0x96fe('0x3a')](respondWithResult(_0x2122df,null))[_0x96fe('0x2c')](handleError(_0x2122df,null));};var interaction_log=require(_0x96fe('0x14'))(_0x96fe('0x5c'));exports[_0x96fe('0x5d')]=function(_0x3617a8,_0x5dc511,_0x4919a8){var _0xa3687e={'agent':{},'channel':_0x96fe('0x5e')};if(_0x3617a8[_0x96fe('0x59')]['id']){delete _0x3617a8[_0x96fe('0x59')]['id'];}_0x3617a8['body'][_0x96fe('0x5f')]=!![];_0x3617a8[_0x96fe('0x59')]['readAt']=moment()[_0x96fe('0x60')](_0x96fe('0x61'));_0x3617a8[_0x96fe('0x59')][_0x96fe('0x62')]=_0x3617a8[_0x96fe('0x59')][_0x96fe('0x62')]||_0x3617a8[_0x96fe('0x63')]['id'];_0xa3687e[_0x96fe('0x64')]['id']=_0x3617a8[_0x96fe('0x59')][_0x96fe('0x62')];return db[_0x96fe('0x3f')][_0x96fe('0x57')]({'where':{'id':_0x3617a8[_0x96fe('0x5a')]['id'],'UserId':null}})[_0x96fe('0x3a')](handleEntityNotFound(_0x5dc511,null))[_0x96fe('0x3a')](saveUpdates(_0x3617a8['body'],null))['then'](function(_0x47db4a){if(_0x47db4a){_0xa3687e[_0x96fe('0x29')]=_0x47db4a[_0x96fe('0x65')]({'plain':!![]});return db[_0x96fe('0x66')][_0x96fe('0x57')]({'where':{'id':_0x47db4a[_0x96fe('0x67')]}});}return null;})[_0x96fe('0x3a')](handleEntityNotFound(_0x5dc511,null))[_0x96fe('0x3a')](function(_0x31e8d9){if(_0x31e8d9){return _0x31e8d9['update']({'UserId':_0x3617a8[_0x96fe('0x59')][_0x96fe('0x62')],'read1stAt':_[_0x96fe('0x68')](_0x31e8d9[_0x96fe('0x69')])?moment()['format'](_0x96fe('0x61')):undefined});}return null;})[_0x96fe('0x3a')](function(_0x1a3330){if(_0x1a3330){_0xa3687e[_0x96fe('0x6a')]=_0x1a3330[_0x96fe('0x65')]({'plain':!![]});interaction_log['info'](_0x96fe('0x6b'),_0x3617a8[_0x96fe('0x63')]['id'],_0x3617a8['user'][_0x96fe('0x3b')],_0x3617a8[_0x96fe('0x63')][_0x96fe('0x6c')],_0xa3687e[_0x96fe('0x6a')]['id'],_0x3617a8['body']?JSON[_0x96fe('0x25')](_0x3617a8[_0x96fe('0x59')]):_0x96fe('0x6d'));return respondWithRpcPromise(_0x96fe('0x6e'),'acceptMessage',_0xa3687e);}return null;})['then'](function(_0x2eb681){var _0x3adb7c=_0x96fe('0x6f')+_0x2eb681[_0x96fe('0x29')][_0x96fe('0x70')];return db[_0x96fe('0x71')][_0x96fe('0x45')](_0x3adb7c,{'type':db[_0x96fe('0x72')][_0x96fe('0x73')][_0x96fe('0x74')],'raw':!![]})[_0x96fe('0x3a')](function(_0x4bfd52){return _0x4bfd52;});})[_0x96fe('0x3a')](function(_0x156e80){if(_0x156e80){_0xa3687e[_0x96fe('0x29')][_0x96fe('0x75')]=_0x156e80[0x0];if(!_0x3617a8[_0x96fe('0x59')]['UserId'])return;return db['User'][_0x96fe('0x57')]({'where':{'id':_0x3617a8['body'][_0x96fe('0x62')],'role':'agent'},'attributes':['id',_0x96fe('0x3b'),'fullname',_0x96fe('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x272120){if(!_0x272120)return null;_0xa3687e[_0x96fe('0x29')]['agent']=_0x272120;return _0xa3687e;})['then'](function(_0x2402f5){if(_0x2402f5){if(_0x3617a8[_0x96fe('0x59')][_0x96fe('0x77')]){_0xa3687e['message'][_0x96fe('0x78')]=util[_0x96fe('0x60')](_0x96fe('0x79'),_0x3617a8[_0x96fe('0x63')][_0x96fe('0x3b')]);_0xa3687e[_0x96fe('0x29')][_0x96fe('0x7a')]=_0xa3687e[_0x96fe('0x7a')];_0xa3687e['message'][_0x96fe('0x7b')]=_0xa3687e[_0x96fe('0x7a')];_0xa3687e[_0x96fe('0x29')][_0x96fe('0x7c')]=_0x96fe('0x5d');return respondWithRpcPromise('EventManager',_0x96fe('0x7d'),{'event':_0x96fe('0x7e'),'message':_0xa3687e['message']},client9002)['then'](function(){return _0xa3687e;});}return _0xa3687e;}return null;})[_0x96fe('0x3a')](respondWithResult(_0x5dc511,null))['catch'](handleError(_0x5dc511,null));};var interaction_log=require(_0x96fe('0x14'))(_0x96fe('0x5c'));exports[_0x96fe('0x37')]=function(_0x526b0b,_0x3a23c5,_0x28b722){var _0x3d1952={'agent':{},'channel':_0x96fe('0x5e')};if(_0x526b0b['body']['id']){delete _0x526b0b[_0x96fe('0x59')]['id'];}_0x526b0b[_0x96fe('0x59')]['UserId']=_0x526b0b[_0x96fe('0x59')][_0x96fe('0x62')]||_0x526b0b[_0x96fe('0x63')]['id'];_0x3d1952[_0x96fe('0x64')]['id']=_0x526b0b['body'][_0x96fe('0x62')];return db[_0x96fe('0x3f')][_0x96fe('0x57')]({'where':{'id':_0x526b0b[_0x96fe('0x5a')]['id'],'UserId':null}})[_0x96fe('0x3a')](handleEntityNotFound(_0x3a23c5,null))[_0x96fe('0x3a')](function(_0x23b074){if(_0x23b074){_0x3d1952['message']=_0x23b074[_0x96fe('0x65')]({'plain':!![]});return db[_0x96fe('0x66')][_0x96fe('0x57')]({'where':{'id':_0x23b074[_0x96fe('0x67')]}});}return null;})[_0x96fe('0x3a')](handleEntityNotFound(_0x3a23c5,null))[_0x96fe('0x3a')](function(_0x69fd91){if(_0x69fd91){_0x3d1952[_0x96fe('0x6a')]=_0x69fd91[_0x96fe('0x65')]({'plain':!![]});interaction_log[_0x96fe('0x2a')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x526b0b[_0x96fe('0x63')]['id'],_0x526b0b[_0x96fe('0x63')][_0x96fe('0x3b')],_0x526b0b[_0x96fe('0x63')][_0x96fe('0x6c')],_0x3d1952[_0x96fe('0x6a')]['id'],_0x526b0b['body']?JSON[_0x96fe('0x25')](_0x526b0b[_0x96fe('0x59')]):_0x96fe('0x6d'));return respondWithRpcPromise(_0x96fe('0x7f'),_0x96fe('0x80'),_0x3d1952);}return null;})[_0x96fe('0x3a')](function(_0x4df6d4){var _0x4c2430='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4df6d4['message'][_0x96fe('0x70')];return db['sequelize'][_0x96fe('0x45')](_0x4c2430,{'type':db[_0x96fe('0x72')][_0x96fe('0x73')]['SELECT'],'raw':!![]})[_0x96fe('0x3a')](function(_0xeb6350){return _0xeb6350;});})[_0x96fe('0x3a')](function(_0x4de6e7){if(_0x4de6e7){_0x3d1952[_0x96fe('0x29')][_0x96fe('0x75')]=_0x4de6e7[0x0];if(!_0x526b0b[_0x96fe('0x59')][_0x96fe('0x62')])return;return db[_0x96fe('0x81')][_0x96fe('0x57')]({'where':{'id':_0x526b0b[_0x96fe('0x59')]['UserId'],'role':_0x96fe('0x64')},'attributes':['id',_0x96fe('0x3b'),_0x96fe('0x82'),_0x96fe('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x98649c){if(!_0x98649c)return null;_0x3d1952['message'][_0x96fe('0x64')]=_0x98649c;return _0x3d1952;})[_0x96fe('0x3a')](function(_0x4f7ad7){if(_0x4f7ad7){_0x4f7ad7[_0x96fe('0x29')][_0x96fe('0x78')]=util['format'](_0x96fe('0x79'),_0x526b0b[_0x96fe('0x63')][_0x96fe('0x3b')]);_0x4f7ad7[_0x96fe('0x29')]['channel']=_0x3d1952[_0x96fe('0x7a')];_0x4f7ad7['message'][_0x96fe('0x7b')]=_0x3d1952[_0x96fe('0x7a')];_0x4f7ad7[_0x96fe('0x29')][_0x96fe('0x7c')]=_0x96fe('0x37');respondWithRpcPromise('EventManager',_0x96fe('0x7d'),{'event':_0x96fe('0x83'),'message':_0x4f7ad7['message']},client9002);return _0x3d1952;}return null;})['then'](respondWithResult(_0x3a23c5,null))[_0x96fe('0x2c')](handleError(_0x3a23c5,null));};exports[_0x96fe('0x84')]=function(_0x5689ed,_0x3dbd6a){var _0x4da419;return db[_0x96fe('0x3f')][_0x96fe('0x84')](_0x5689ed['body'],{})[_0x96fe('0x3a')](function(_0x4e4f5c){_0x4da419=_0x4e4f5c;return db[_0x96fe('0x85')][_0x96fe('0x86')]({'where':{'id':_0x4da419[_0x96fe('0x70')]}});})[_0x96fe('0x3a')](function(_0x3eb792){if(_['isNil'](_0x3eb792)){return;}else{_0x4da419[_0x96fe('0x5e')]=_0x3eb792['fax'];return db[_0x96fe('0x87')]['findOne']({'where':{'id':_0x4da419['AttachmentId']}});}})[_0x96fe('0x3a')](function(_0x5411bb){return respondWithRpcPromise(_0x96fe('0x88'),_0x96fe('0x88'),{'FaxAccountId':_['isNil'](_0x5689ed['body'])?undefined:_0x5689ed[_0x96fe('0x59')][_0x96fe('0x89')],'path':_[_0x96fe('0x68')](_0x5411bb)?undefined:util[_0x96fe('0x60')](_0x96fe('0x8a'),_0x5411bb[_0x96fe('0x8b')]),'fax':_[_0x96fe('0x68')](_0x4da419[_0x96fe('0x5e')])?undefined:_0x4da419[_0x96fe('0x5e')],'AttachmentId':_0x4da419[_0x96fe('0x8c')]},client9002);})[_0x96fe('0x3a')](respondWithResult(_0x3dbd6a,0xc9))['catch'](handleError(_0x3dbd6a,null));};exports[_0x96fe('0x8d')]=function(_0x4cea9a,_0x1a90f1){var _0xf88990=path[_0x96fe('0x8e')](config['root'],_0x96fe('0x8f'),'files',_0x96fe('0x90'));return db[_0x96fe('0x3f')][_0x96fe('0x57')]({'where':{'id':_0x4cea9a[_0x96fe('0x5a')]['id']},'include':[{'model':db['Attachment'],'as':_0x96fe('0x87')}]})[_0x96fe('0x3a')](handleEntityNotFound(_0x1a90f1,null))[_0x96fe('0x3a')](function(_0x3388d1){if(_0x3388d1){return _0x1a90f1[_0x96fe('0x8d')](path[_0x96fe('0x8e')](_0xf88990,_0x3388d1[_0x96fe('0x87')][_0x96fe('0x8b')]));}})[_0x96fe('0x2c')](handleError(_0x1a90f1,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index d987866..665f36e 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 _0x6cfd=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','FaxMessage'];(function(_0x44b0af,_0xdb6975){var _0xafaa74=function(_0xf734d3){while(--_0xf734d3){_0x44b0af['push'](_0x44b0af['shift']());}};_0xafaa74(++_0xdb6975);}(_0x6cfd,0x1b7));var _0xd6cf=function(_0x1eb6ea,_0x55050e){_0x1eb6ea=_0x1eb6ea-0x0;var _0x17a663=_0x6cfd[_0x1eb6ea];return _0x17a663;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0xd6cf('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd6cf('0x1')](0x0);var events={'afterCreate':_0xd6cf('0x2'),'afterUpdate':_0xd6cf('0x3'),'afterDestroy':_0xd6cf('0x4')};function emitEvent(_0x5cfa14){return function(_0x3cbd02,_0x1ede7e,_0x150cf6){FaxMessageEvents['emit'](_0x5cfa14+':'+_0x3cbd02['id'],_0x3cbd02);FaxMessageEvents[_0xd6cf('0x5')](_0x5cfa14,_0x3cbd02);_0x150cf6(null);};}for(var e in events){if(events[_0xd6cf('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xd6cf('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x3c85=['remove','emit','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x27589b,_0x1db3ed){var _0x50f792=function(_0x51598a){while(--_0x51598a){_0x27589b['push'](_0x27589b['shift']());}};_0x50f792(++_0x1db3ed);}(_0x3c85,0x1a0));var _0x53c8=function(_0x3acb5f,_0x1f13b5){_0x3acb5f=_0x3acb5f-0x0;var _0xce371a=_0x3c85[_0x3acb5f];return _0xce371a;};'use strict';var EventEmitter=require(_0x53c8('0x0'));var FaxMessage=require(_0x53c8('0x1'))['db'][_0x53c8('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x53c8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x53c8('0x4')};function emitEvent(_0xcc2f5f){return function(_0x44a11e,_0x4be799,_0x270365){FaxMessageEvents[_0x53c8('0x5')](_0xcc2f5f+':'+_0x44a11e['id'],_0x44a11e);FaxMessageEvents[_0x53c8('0x5')](_0xcc2f5f,_0x44a11e);_0x270365(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 3ae2e87..c18872c 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 _0xd62b=['utf8mb4_unicode_ci','../../config/logger','moment','bluebird','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','update','catch','utf8mb4'];(function(_0x509b29,_0x36f0c2){var _0x17e3a6=function(_0x2f723d){while(--_0x2f723d){_0x509b29['push'](_0x509b29['shift']());}};_0x17e3a6(++_0x36f0c2);}(_0xd62b,0x171));var _0xbd62=function(_0x401ccd,_0x140815){_0x401ccd=_0x401ccd-0x0;var _0x5a57ad=_0xd62b[_0x401ccd];return _0x5a57ad;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbd62('0x0'))('api');var moment=require(_0xbd62('0x1'));var BPromise=require(_0xbd62('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbd62('0x3'));var config=require(_0xbd62('0x4'));var attributes=require(_0xbd62('0x5'));module[_0xbd62('0x6')]=function(_0x21872d,_0x1ab037){return _0x21872d[_0xbd62('0x7')]('FaxMessage',attributes,{'tableName':_0xbd62('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x461a65,_0xa38ff9,_0x5f13a6){var _0x16757c=_0x21872d[_0xbd62('0x9')];var _0x2f6827=_0x461a65[_0xbd62('0xa')]({'plain':!![]});if(_0x2f6827[_0xbd62('0xb')][_0xbd62('0xc')]()==='in'||_0x2f6827[_0xbd62('0xb')][_0xbd62('0xc')]()===_0xbd62('0xd')&&!_0x2f6827[_0xbd62('0xe')]&&!_['isNil'](_0x2f6827[_0xbd62('0xf')])){_0x16757c[_0xbd62('0x10')][_0xbd62('0x11')]({'where':{'id':_0x2f6827[_0xbd62('0x12')]}})['then'](function(_0x4e13d5){if(_0x4e13d5){_0x4e13d5[_0xbd62('0x13')]({'lastMsgAt':_0x2f6827['createdAt'],'lastMsgDirection':_0x2f6827[_0xbd62('0xb')][_0xbd62('0xc')]()});}})[_0xbd62('0x14')](function(_0x3dba9f){console['error'](_0x3dba9f);});}_0x5f13a6();}},'charset':_0xbd62('0x15'),'collate':_0xbd62('0x16')});}; \ No newline at end of file +var _0xdc3b=['exports','define','FaxMessage','fax_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','bluebird','../../config/environment'];(function(_0x485ee5,_0x1c562f){var _0x12de85=function(_0x804741){while(--_0x804741){_0x485ee5['push'](_0x485ee5['shift']());}};_0x12de85(++_0x1c562f);}(_0xdc3b,0x1bd));var _0xbdc3=function(_0x1dfc85,_0x204e54){_0x1dfc85=_0x1dfc85-0x0;var _0x185e46=_0xdc3b[_0x1dfc85];return _0x185e46;};'use strict';var _=require(_0xbdc3('0x0'));var util=require(_0xbdc3('0x1'));var logger=require('../../config/logger')(_0xbdc3('0x2'));var moment=require('moment');var BPromise=require(_0xbdc3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbdc3('0x4'));var attributes=require('./faxMessage.attributes');module[_0xbdc3('0x5')]=function(_0x3cd052,_0x3f3e81){return _0x3cd052[_0xbdc3('0x6')](_0xbdc3('0x7'),attributes,{'tableName':_0xbdc3('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xbdc3('0x9')],'type':_0xbdc3('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x174506,_0x5d1712,_0x284e48){var _0x2fc4dc=_0x3cd052['models'];var _0x4c2c1b=_0x174506[_0xbdc3('0xb')]({'plain':!![]});if(_0x4c2c1b['direction']['toLowerCase']()==='in'||_0x4c2c1b[_0xbdc3('0xc')][_0xbdc3('0xd')]()===_0xbdc3('0xe')&&!_0x4c2c1b[_0xbdc3('0xf')]&&!_['isNil'](_0x4c2c1b['UserId'])){_0x2fc4dc[_0xbdc3('0x10')][_0xbdc3('0x11')]({'where':{'id':_0x4c2c1b[_0xbdc3('0x12')]}})[_0xbdc3('0x13')](function(_0x5d970f){if(_0x5d970f){_0x5d970f[_0xbdc3('0x14')]({'lastMsgAt':_0x4c2c1b[_0xbdc3('0x15')],'lastMsgDirection':_0x4c2c1b[_0xbdc3('0xc')][_0xbdc3('0xd')]()});}})[_0xbdc3('0x16')](function(_0x184dbd){console[_0xbdc3('0x17')](_0x184dbd);});}_0x284e48();}},'charset':'utf8mb4','collate':_0xbdc3('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 7060f49..c481985 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 _0x00bb=['redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','FaxMessage,\x20%s,\x20%s','CreateFaxMessage','FaxMessage','create','body','options','raw','catch','update','attributes','UpdateFaxMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3bcff3,_0x2c1887){var _0x565baf=function(_0x262e62){while(--_0x262e62){_0x3bcff3['push'](_0x3bcff3['shift']());}};_0x565baf(++_0x2c1887);}(_0x00bb,0x1d8));var _0xb00b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x00bb[_0xa1e3e3];return _0xc980e9;};'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});config[_0xb00b('0x8')]=_[_0xb00b('0x9')](config[_0xb00b('0x8')],{'host':_0xb00b('0xa'),'port':0x18eb});var socket=require(_0xb00b('0xb'))(new Redis(config[_0xb00b('0x8')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5154d9,_0x1e9b7b,_0x5851d4){return new BPromise(function(_0x46a25c,_0x28d3cc){return client['request'](_0x5154d9,_0x5851d4)[_0xb00b('0xc')](function(_0x5a63ed){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0xb00b('0xd'));logger[_0xb00b('0xe')](_0xb00b('0xf'),_0x1e9b7b,_0xb00b('0xd'),JSON[_0xb00b('0x10')](_0x5a63ed));if(_0x5a63ed[_0xb00b('0x11')]){if(_0x5a63ed['error'][_0xb00b('0x12')]===0x1f4){logger[_0xb00b('0x11')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0x5a63ed[_0xb00b('0x11')][_0xb00b('0x13')]);return _0x28d3cc(_0x5a63ed['error']['message']);}logger[_0xb00b('0x11')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0x5a63ed['error'][_0xb00b('0x13')]);return _0x46a25c(_0x5a63ed[_0xb00b('0x11')][_0xb00b('0x13')]);}else{logger[_0xb00b('0x14')]('FaxMessage,\x20%s,\x20%s',_0x1e9b7b,_0xb00b('0xd'));_0x46a25c(_0x5a63ed['result'][_0xb00b('0x13')]);}})['catch'](function(_0x25d7a0){logger['error'](_0xb00b('0x15'),_0x1e9b7b,_0x25d7a0);_0x28d3cc(_0x25d7a0);});});}exports[_0xb00b('0x16')]=function(_0x53ee68){var _0x55770c=this;return new Promise(function(_0x2b0da1,_0x4a334b){return db[_0xb00b('0x17')][_0xb00b('0x18')](_0x53ee68[_0xb00b('0x19')],{'raw':_0x53ee68[_0xb00b('0x1a')]?_0x53ee68['options'][_0xb00b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x25a973){logger[_0xb00b('0x14')]('CreateFaxMessage',_0x53ee68);logger[_0xb00b('0xe')](_0xb00b('0x16'),_0x53ee68,JSON['stringify'](_0x25a973));_0x2b0da1(_0x25a973);})[_0xb00b('0x1c')](function(_0x1f04d3){logger['error'](_0xb00b('0x16'),_0x1f04d3[_0xb00b('0x13')],_0x53ee68);_0x4a334b(_0x55770c[_0xb00b('0x11')](0x1f4,_0x1f04d3[_0xb00b('0x13')]));});});};exports['UpdateFaxMessage']=function(_0x50be6c){var _0x3785e9=this;return new Promise(function(_0x490380,_0x550587){return db['FaxMessage'][_0xb00b('0x1d')](_0x50be6c[_0xb00b('0x19')],{'raw':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')][_0xb00b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')]['where']||null:null,'attributes':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c['options'][_0xb00b('0x1e')]||null:null,'limit':_0x50be6c[_0xb00b('0x1a')]?_0x50be6c[_0xb00b('0x1a')]['limit']||null:null})[_0xb00b('0xc')](function(_0x280ed3){logger[_0xb00b('0x14')](_0xb00b('0x1f'),_0x50be6c);logger[_0xb00b('0xe')](_0xb00b('0x1f'),_0x50be6c,JSON[_0xb00b('0x10')](_0x280ed3));_0x490380(_0x280ed3);})[_0xb00b('0x1c')](function(_0x149c1a){logger['error'](_0xb00b('0x1f'),_0x149c1a[_0xb00b('0x13')],_0x50be6c);_0x550587(_0x3785e9['error'](0x1f4,_0x149c1a[_0xb00b('0x13')]));});});}; \ No newline at end of file +var _0xb821=['register','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x3667fa,_0x4a9421){var _0x46340e=function(_0x58d928){while(--_0x58d928){_0x3667fa['push'](_0x3667fa['shift']());}};_0x46340e(++_0x4a9421);}(_0xb821,0xa7));var _0x1b82=function(_0x166dd9,_0x2902b4){_0x166dd9=_0x166dd9-0x0;var _0x2ebe5a=_0xb821[_0x166dd9];return _0x2ebe5a;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});config[_0x1b82('0x8')]=_[_0x1b82('0x9')](config[_0x1b82('0x8')],{'host':_0x1b82('0xa'),'port':0x18eb});var socket=require(_0x1b82('0xb'))(new Redis(config[_0x1b82('0x8')]));require(_0x1b82('0xc'))[_0x1b82('0xd')](socket);function respondWithRpcPromise(_0x4955b5,_0x4011f2,_0x30c6ee){return new BPromise(function(_0x44dfd4,_0x14c57a){return client[_0x1b82('0xe')](_0x4955b5,_0x30c6ee)[_0x1b82('0xf')](function(_0x739f99){logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1b82('0x11'));logger[_0x1b82('0x12')](_0x1b82('0x13'),_0x4011f2,_0x1b82('0x11'),JSON['stringify'](_0x739f99));if(_0x739f99[_0x1b82('0x14')]){if(_0x739f99['error']['code']===0x1f4){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);return _0x14c57a(_0x739f99['error'][_0x1b82('0x15')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')]['message']);return _0x44dfd4(_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);}else{logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,'request\x20sent');_0x44dfd4(_0x739f99[_0x1b82('0x16')]['message']);}})[_0x1b82('0x17')](function(_0x1002a1){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1002a1);_0x14c57a(_0x1002a1);});});}exports[_0x1b82('0x18')]=function(_0x2b6ee8){var _0x11af50=this;return new Promise(function(_0x46e5e2,_0x10d45c){return db['FaxMessage'][_0x1b82('0x19')](_0x2b6ee8[_0x1b82('0x1a')],{'raw':_0x2b6ee8[_0x1b82('0x1b')]?_0x2b6ee8[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![]})[_0x1b82('0xf')](function(_0x2d07f4){logger['info'](_0x1b82('0x18'),_0x2b6ee8);logger[_0x1b82('0x12')]('CreateFaxMessage',_0x2b6ee8,JSON[_0x1b82('0x1d')](_0x2d07f4));_0x46e5e2(_0x2d07f4);})[_0x1b82('0x17')](function(_0x1ad9d6){logger['error'](_0x1b82('0x18'),_0x1ad9d6['message'],_0x2b6ee8);_0x10d45c(_0x11af50['error'](0x1f4,_0x1ad9d6['message']));});});};exports[_0x1b82('0x1e')]=function(_0x149d0f){var _0xfd00d1=this;return new Promise(function(_0x257b79,_0x548a3b){return db[_0x1b82('0x1f')][_0x1b82('0x20')](_0x149d0f[_0x1b82('0x1a')],{'raw':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x21')]||null:null,'attributes':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x22')]||null:null,'limit':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f['options'][_0x1b82('0x23')]||null:null})[_0x1b82('0xf')](function(_0x155a34){logger[_0x1b82('0x10')](_0x1b82('0x1e'),_0x149d0f);logger[_0x1b82('0x12')](_0x1b82('0x1e'),_0x149d0f,JSON[_0x1b82('0x1d')](_0x155a34));_0x257b79(_0x155a34);})[_0x1b82('0x17')](function(_0x362657){logger['error'](_0x1b82('0x1e'),_0x362657[_0x1b82('0x15')],_0x149d0f);_0x548a3b(_0xfd00d1[_0x1b82('0x14')](0x1f4,_0x362657[_0x1b82('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 9e9b373..aa8cbc2 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 _0x5125=['length','save','remove','update','emit','removeListener','register'];(function(_0x51c1f8,_0x5cc527){var _0x2ce60b=function(_0xcb8ec2){while(--_0xcb8ec2){_0x51c1f8['push'](_0x51c1f8['shift']());}};_0x2ce60b(++_0x5cc527);}(_0x5125,0x135));var _0x5512=function(_0x2d9da8,_0x5d5072){_0x2d9da8=_0x2d9da8-0x0;var _0x57a29c=_0x5125[_0x2d9da8];return _0x57a29c;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x5512('0x0'),_0x5512('0x1'),_0x5512('0x2')];function createListener(_0x21fd2f,_0xdcae41){return function(_0x87e045){_0xdcae41[_0x5512('0x3')](_0x21fd2f,_0x87e045);};}function removeListener(_0x4a96fa,_0x346041){return function(){FaxMessageEvents[_0x5512('0x4')](_0x4a96fa,_0x346041);};}exports[_0x5512('0x5')]=function(_0x51e23e){for(var _0x48a7c0=0x0,_0x4e9ff5=events[_0x5512('0x6')];_0x48a7c0<_0x4e9ff5;_0x48a7c0++){var _0x506b7c=events[_0x48a7c0];var _0x2fa6e4=createListener('faxMessage:'+_0x506b7c,_0x51e23e);FaxMessageEvents['on'](_0x506b7c,_0x2fa6e4);}}; \ No newline at end of file +var _0x1bfb=['removeListener','register','length','faxMessage:','./faxMessage.events','save','update','emit'];(function(_0x112dc8,_0x102fb3){var _0x260b62=function(_0x569ef){while(--_0x569ef){_0x112dc8['push'](_0x112dc8['shift']());}};_0x260b62(++_0x102fb3);}(_0x1bfb,0xe4));var _0xb1bf=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x1bfb[_0x209fcd];return _0x501d5e;};'use strict';var FaxMessageEvents=require(_0xb1bf('0x0'));var events=[_0xb1bf('0x1'),'remove',_0xb1bf('0x2')];function createListener(_0x5742f6,_0x3f92e5){return function(_0xe8bb6e){_0x3f92e5[_0xb1bf('0x3')](_0x5742f6,_0xe8bb6e);};}function removeListener(_0xc167a3,_0x550b6f){return function(){FaxMessageEvents[_0xb1bf('0x4')](_0xc167a3,_0x550b6f);};}exports[_0xb1bf('0x5')]=function(_0xaac5c4){for(var _0x116fd0=0x0,_0x5a95c0=events[_0xb1bf('0x6')];_0x116fd0<_0x5a95c0;_0x116fd0++){var _0x236795=events[_0x116fd0];var _0x375b89=createListener(_0xb1bf('0x7')+_0x236795,_0xaac5c4);FaxMessageEvents['on'](_0x236795,_0x375b89);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3fd2d04..209e9fd 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 _0xaa88=['describe','get','show','download','post','fax','faxmessage:create','put','/:id','/:id/accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','index','/describe','isAuthenticated'];(function(_0x17323e,_0x3ed331){var _0x577592=function(_0xe72d15){while(--_0xe72d15){_0x17323e['push'](_0x17323e['shift']());}};_0x577592(++_0x3ed331);}(_0xaa88,0x137));var _0x8aa8=function(_0x8b631b,_0x386724){_0x8b631b=_0x8b631b-0x0;var _0x3e6832=_0xaa88[_0x8b631b];return _0x3e6832;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0xe')]('/:id/download',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0x10')]);router[_0x8aa8('0x11')]('/',auth[_0x8aa8('0xc')](),interaction['tracked'](_0x8aa8('0x12'),_0x8aa8('0x13')),controller['create']);router[_0x8aa8('0x14')](_0x8aa8('0x15'),auth[_0x8aa8('0xc')](),controller['update']);router[_0x8aa8('0x14')](_0x8aa8('0x16'),auth[_0x8aa8('0xc')](),controller['accept']);router[_0x8aa8('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0x8aa8('0x17')]);router[_0x8aa8('0x18')](_0x8aa8('0x15'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0x19')]);module[_0x8aa8('0x1a')]=router; \ No newline at end of file +var _0x9bde=['index','/describe','isAuthenticated','describe','/:id','show','download','post','fax','faxmessage:create','create','put','/:id/accept','/:id/reject','reject','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get'];(function(_0x4bf574,_0x185cd8){var _0x2d6b82=function(_0x5d11a2){while(--_0x5d11a2){_0x4bf574['push'](_0x4bf574['shift']());}};_0x2d6b82(++_0x185cd8);}(_0x9bde,0xe1));var _0xe9bd=function(_0x162648,_0xcfed8f){_0x162648=_0x162648-0x0;var _0x270d70=_0x9bde[_0x162648];return _0x270d70;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xe9bd('0xf')]);router[_0xe9bd('0x10')]('/',auth[_0xe9bd('0xb')](),interaction['tracked'](_0xe9bd('0x11'),_0xe9bd('0x12')),controller[_0xe9bd('0x13')]);router[_0xe9bd('0x14')]('/:id',auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x14')](_0xe9bd('0x15'),auth[_0xe9bd('0xb')](),controller['accept']);router['put'](_0xe9bd('0x16'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x17')]);router[_0xe9bd('0x18')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index bc12119..44b7794 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 _0x22b9=['INTEGER','beepall','sequelize','exports','STRING','name'];(function(_0x194bd8,_0x47a1b6){var _0x4ab5e6=function(_0x144b83){while(--_0x144b83){_0x194bd8['push'](_0x194bd8['shift']());}};_0x4ab5e6(++_0x47a1b6);}(_0x22b9,0x8c));var _0x922b=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x22b9[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0x922b('0x0'));module[_0x922b('0x1')]={'name':{'type':Sequelize[_0x922b('0x2')],'unique':_0x922b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x922b('0x2')]},'timeout':{'type':Sequelize[_0x922b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x922b('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x922b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf151=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0xeb9e77,_0x535701){var _0x3468ec=function(_0x2c0ad9){while(--_0x2c0ad9){_0xeb9e77['push'](_0xeb9e77['shift']());}};_0x3468ec(++_0x535701);}(_0xf151,0x1aa));var _0x1f15=function(_0x162d44,_0x4461b8){_0x162d44=_0x162d44-0x0;var _0x3383a6=_0xf151[_0x162d44];return _0x3383a6;};'use strict';var Sequelize=require(_0x1f15('0x0'));module[_0x1f15('0x1')]={'name':{'type':Sequelize[_0x1f15('0x2')],'unique':_0x1f15('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1f15('0x2')]},'timeout':{'type':Sequelize[_0x1f15('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1f15('0x5')](_0x1f15('0x6'),_0x1f15('0x7'),_0x1f15('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 9ec5a63..44325f9 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 _0xb4c7=['removeAgents','userFaxQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','model','keys','filters','intersection','fields','attributes','length','merge','options','catch','create','user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','hasOwnProperty','sort','filter','User','findAndCountAll','UserId','agent','faxPause','createdAt','SIP','updatedAt','getTeams','Team','order','pick','nolimit','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','UserFaxQueue','forEach','emit','userFaxQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','union','value','isEmpty'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x23e87d,_0x270cfe){_0x23e87d=_0x23e87d-0x0;var _0x4966ea=_0xb4c7[_0x23e87d];return _0x4966ea;};'use strict';var BPromise=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));var squel=require(_0x7b4c('0x3'));var Redis=require(_0x7b4c('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x7b4c('0x5'))(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var db=require(_0x7b4c('0x8'))['db'];config[_0x7b4c('0x9')]=_['defaults'](config[_0x7b4c('0x9')],{'host':_0x7b4c('0xa'),'port':0x18eb});var socket=require(_0x7b4c('0xb'))(new Redis(config['redis']));require(_0x7b4c('0xc'))[_0x7b4c('0xd')](socket);function respondWithStatusCode(_0x570daa,_0x433aa2){_0x433aa2=_0x433aa2||0xcc;return function(_0x179b2d){if(_0x179b2d){return _0x570daa[_0x7b4c('0xe')](_0x433aa2);}return _0x570daa[_0x7b4c('0xf')](_0x433aa2)[_0x7b4c('0x10')]();};}function respondWithResult(_0x93d013,_0x1a996f){_0x1a996f=_0x1a996f||0xc8;return function(_0xc62104){if(_0xc62104){return _0x93d013[_0x7b4c('0xf')](_0x1a996f)[_0x7b4c('0x11')](_0xc62104);}};}function respondWithFilteredResult(_0x5d5bc3,_0x554d62){return function(_0x24dd7d){if(_0x24dd7d){var _0x18342b=typeof _0x554d62[_0x7b4c('0x12')]===_0x7b4c('0x13')&&typeof _0x554d62[_0x7b4c('0x14')]===_0x7b4c('0x13');var _0x3ea0da=_0x24dd7d[_0x7b4c('0x15')];var _0x25b90b=_0x18342b?0x0:_0x554d62[_0x7b4c('0x12')];var _0x593a19=_0x18342b?_0x24dd7d[_0x7b4c('0x15')]:_0x554d62[_0x7b4c('0x12')]+_0x554d62[_0x7b4c('0x14')];var _0x2a0e2f;if(_0x593a19>=_0x3ea0da){_0x593a19=_0x3ea0da;_0x2a0e2f=0xc8;}else{_0x2a0e2f=0xce;}_0x5d5bc3[_0x7b4c('0xf')](_0x2a0e2f);return _0x5d5bc3[_0x7b4c('0x16')](_0x7b4c('0x17'),_0x25b90b+'-'+_0x593a19+'/'+_0x3ea0da)[_0x7b4c('0x11')](_0x24dd7d);}return null;};}function saveUpdates(_0x4d3f5e){return function(_0x36e701){if(_0x36e701){return _0x36e701[_0x7b4c('0x18')](_0x4d3f5e)[_0x7b4c('0x19')](function(_0x36c02a){return _0x36c02a;});}return null;};}function removeEntity(_0x59ae96){return function(_0x3ce10c){if(_0x3ce10c){return _0x3ce10c[_0x7b4c('0x1a')]()[_0x7b4c('0x19')](function(){var _0x380b79=_0x3ce10c[_0x7b4c('0x1b')]({'plain':!![]});var _0x1363b4=_0x7b4c('0x1c');return db[_0x7b4c('0x1d')][_0x7b4c('0x1a')]({'where':{'type':_0x1363b4,'resourceId':_0x380b79['id']}})['then'](function(){return _0x3ce10c;});})[_0x7b4c('0x19')](function(){_0x59ae96[_0x7b4c('0xf')](0xcc)[_0x7b4c('0x10')]();});}};}function handleEntityNotFound(_0xabeffb){return function(_0x148a79){if(!_0x148a79){_0xabeffb[_0x7b4c('0xe')](0x194);}return _0x148a79;};}function handleError(_0x176704,_0x3d4826){_0x3d4826=_0x3d4826||0x1f4;return function(_0x2ab9e1){logger[_0x7b4c('0x1e')](_0x2ab9e1['stack']);if(_0x2ab9e1[_0x7b4c('0x1f')]){delete _0x2ab9e1[_0x7b4c('0x1f')];}_0x176704[_0x7b4c('0xf')](_0x3d4826)[_0x7b4c('0x20')](_0x2ab9e1);};}exports[_0x7b4c('0x21')]=function(_0x2bdc4d,_0x37c059){var _0x459eb4={};var _0x1f311e={'count':0x0,'rows':[]};var _0x1a69db=_[_0x7b4c('0x22')](db[_0x7b4c('0x23')][_0x7b4c('0x24')],function(_0x501f75){return{'name':_0x501f75[_0x7b4c('0x25')],'type':_0x501f75[_0x7b4c('0x26')][_0x7b4c('0x27')]};});_0x459eb4=qs[_0x7b4c('0x28')](_0x1a69db,_0x2bdc4d);var _0x207c2f={'where':_0x459eb4[_0x7b4c('0x29')]};return db[_0x7b4c('0x23')][_0x7b4c('0x15')](_0x207c2f)[_0x7b4c('0x19')](function(_0x9a799b){_0x1f311e[_0x7b4c('0x15')]=_0x9a799b;_0x459eb4[_0x7b4c('0x2a')]=qs[_0x7b4c('0x2a')](_0x2bdc4d[_0x7b4c('0x2b')]);return db[_0x7b4c('0x23')][_0x7b4c('0x2c')](_0x459eb4);})[_0x7b4c('0x19')](function(_0xce5781){_0x1f311e[_0x7b4c('0x2d')]=_0xce5781;return _0x1f311e;})['then'](respondWithFilteredResult(_0x37c059,_0x459eb4))['catch'](handleError(_0x37c059,null));};exports['show']=function(_0x2fe0f4,_0x2efff3){var _0x14fb7f={'raw':!![],'where':{'id':_0x2fe0f4['params']['id']}},_0x66e770={};_0x66e770[_0x7b4c('0x2e')]=_[_0x7b4c('0x2f')](db['FaxQueue'][_0x7b4c('0x24')]);_0x66e770['query']=_[_0x7b4c('0x2f')](_0x2fe0f4[_0x7b4c('0x2b')]);_0x66e770[_0x7b4c('0x30')]=_['intersection'](_0x66e770[_0x7b4c('0x2e')],_0x66e770[_0x7b4c('0x2b')]);_0x14fb7f['attributes']=_[_0x7b4c('0x31')](_0x66e770[_0x7b4c('0x2e')],qs[_0x7b4c('0x32')](_0x2fe0f4[_0x7b4c('0x2b')]['fields']));_0x14fb7f['attributes']=_0x14fb7f[_0x7b4c('0x33')][_0x7b4c('0x34')]?_0x14fb7f['attributes']:_0x66e770[_0x7b4c('0x2e')];if(_0x2fe0f4['query']['includeAll']){_0x14fb7f[_0x7b4c('0x2a')]=[{'all':!![]}];}_0x14fb7f=_[_0x7b4c('0x35')]({},_0x14fb7f,_0x2fe0f4[_0x7b4c('0x36')]);return db[_0x7b4c('0x23')]['find'](_0x14fb7f)[_0x7b4c('0x19')](handleEntityNotFound(_0x2efff3,null))[_0x7b4c('0x19')](respondWithResult(_0x2efff3,null))[_0x7b4c('0x37')](handleError(_0x2efff3,null));};exports[_0x7b4c('0x38')]=function(_0x346e0c,_0xddd16){return db[_0x7b4c('0x23')]['create'](_0x346e0c['body'],{})[_0x7b4c('0x19')](function(_0x37f136){var _0x31ef1e=_0x346e0c[_0x7b4c('0x39')][_0x7b4c('0x1b')]({'plain':!![]});if(!_0x31ef1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31ef1e[_0x7b4c('0x3a')]===_0x7b4c('0x39')){var _0x46b9ae=_0x37f136[_0x7b4c('0x1b')]({'plain':!![]});var _0x22f71b=_0x7b4c('0x1c');return db[_0x7b4c('0x3b')][_0x7b4c('0x3c')]({'where':{'name':_0x22f71b,'userProfileId':_0x31ef1e[_0x7b4c('0x3d')]},'raw':!![]})['then'](function(_0x2a4085){if(_0x2a4085&&_0x2a4085['autoAssociation']===0x0){return db[_0x7b4c('0x1d')]['create']({'name':_0x46b9ae[_0x7b4c('0x1f')],'resourceId':_0x46b9ae['id'],'type':_0x2a4085[_0x7b4c('0x1f')],'sectionId':_0x2a4085['id']},{})['then'](function(){return _0x37f136;});}else{return _0x37f136;}})['catch'](function(_0x354578){logger[_0x7b4c('0x1e')](_0x7b4c('0x3e'),_0x354578);throw _0x354578;});}return _0x37f136;})[_0x7b4c('0x19')](respondWithResult(_0xddd16,0xc9))['catch'](handleError(_0xddd16,null));};exports[_0x7b4c('0x18')]=function(_0x2ed731,_0x100774){if(_0x2ed731['body']['id']){delete _0x2ed731[_0x7b4c('0x3f')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x2ed731[_0x7b4c('0x40')]['id']}})['then'](handleEntityNotFound(_0x100774,null))[_0x7b4c('0x19')](saveUpdates(_0x2ed731[_0x7b4c('0x3f')],null))[_0x7b4c('0x19')](respondWithResult(_0x100774,null))[_0x7b4c('0x37')](handleError(_0x100774,null));};exports[_0x7b4c('0x1a')]=function(_0x42f386,_0x13de84){return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x42f386['params']['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x13de84,null))['then'](removeEntity(_0x13de84,null))['catch'](handleError(_0x13de84,null));};exports[_0x7b4c('0x41')]=function(_0x1f1653,_0x54a887){return db['FaxQueue'][_0x7b4c('0x41')]()[_0x7b4c('0x19')](respondWithResult(_0x54a887,null))[_0x7b4c('0x37')](handleError(_0x54a887,null));};exports[_0x7b4c('0x42')]=function(_0x8ebf9b,_0x4759e9){var _0x336796={'raw':!![],'where':{}},_0x1cf7c7={},_0x57ad8c;return db[_0x7b4c('0x23')][_0x7b4c('0x43')]({'where':{'id':_0x8ebf9b[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x4759e9,null))[_0x7b4c('0x19')](function(_0x379f15){if(_0x379f15){_0x57ad8c=_0x379f15[_0x7b4c('0x1b')]({'plain':!![]});_0x1cf7c7[_0x7b4c('0x2e')]=_[_0x7b4c('0x2f')](db['UserFaxQueue']['rawAttributes']);_0x1cf7c7[_0x7b4c('0x2b')]=_[_0x7b4c('0x2f')](_0x8ebf9b[_0x7b4c('0x2b')]);_0x1cf7c7['filters']=_[_0x7b4c('0x31')](_0x1cf7c7[_0x7b4c('0x2e')],_0x1cf7c7['query']);_0x336796[_0x7b4c('0x33')]=_['intersection'](_0x1cf7c7[_0x7b4c('0x2e')],qs['fields'](_0x8ebf9b[_0x7b4c('0x2b')]['fields']));_0x336796[_0x7b4c('0x33')]=_0x336796[_0x7b4c('0x33')]['length']?_0x336796['attributes']:_0x1cf7c7[_0x7b4c('0x2e')];if(!_0x8ebf9b[_0x7b4c('0x2b')][_0x7b4c('0x44')]('nolimit')){_0x336796['limit']=qs[_0x7b4c('0x14')](_0x8ebf9b[_0x7b4c('0x2b')]['limit']);_0x336796['offset']=qs[_0x7b4c('0x12')](_0x8ebf9b[_0x7b4c('0x2b')][_0x7b4c('0x12')]);}_0x336796['order']=qs[_0x7b4c('0x45')](_0x8ebf9b[_0x7b4c('0x2b')]['sort']);_0x336796['where']=qs[_0x7b4c('0x30')](_['pick'](_0x8ebf9b['query'],_0x1cf7c7[_0x7b4c('0x30')]));_0x336796['where']['FaxQueueId']=_0x379f15['id'];if(_0x8ebf9b[_0x7b4c('0x2b')][_0x7b4c('0x46')]){_0x336796[_0x7b4c('0x29')]=_[_0x7b4c('0x35')](_0x336796['where'],{'$or':_['map'](_0x336796[_0x7b4c('0x33')],function(_0x6c226d){var _0x30a7e3={};_0x30a7e3[_0x6c226d]={'$like':'%'+_0x8ebf9b['query'][_0x7b4c('0x46')]+'%'};return _0x30a7e3;})});}_0x336796=_[_0x7b4c('0x35')]({},_0x336796,_0x8ebf9b[_0x7b4c('0x36')]);return db['UserFaxQueue'][_0x7b4c('0x2c')](_0x336796);}})[_0x7b4c('0x19')](function(_0x529803){if(_0x529803){return db[_0x7b4c('0x47')][_0x7b4c('0x48')]({'where':{'id':_[_0x7b4c('0x22')](_0x529803,_0x7b4c('0x49')),'role':_0x7b4c('0x4a')},'attributes':['id',_0x7b4c('0x1f'),_0x7b4c('0x4b'),'updatedAt',_0x7b4c('0x4c')]});}})[_0x7b4c('0x19')](function(_0x4ab9dc){if(_0x4ab9dc){return{'count':_0x4ab9dc[_0x7b4c('0x15')],'rows':_[_0x7b4c('0x22')](_0x4ab9dc[_0x7b4c('0x2d')],function(_0x6b3d5e){return{'membername':_0x6b3d5e['name'],'UserId':_0x6b3d5e['id'],'queue_name':_0x57ad8c[_0x7b4c('0x1f')],'FaxQueueId':_0x57ad8c['id'],'interface':util['format']('%s/%s',_0x7b4c('0x4d'),_0x6b3d5e[_0x7b4c('0x1f')]),'penalty':0x0,'paused':_0x6b3d5e[_0x7b4c('0x4b')],'createdAt':_0x6b3d5e[_0x7b4c('0x4c')],'updatedAt':_0x6b3d5e[_0x7b4c('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4759e9,_0x336796))['catch'](handleError(_0x4759e9,null));};exports[_0x7b4c('0x4f')]=function(_0x3c84af,_0x2b77de){var _0x5e102d={};var _0xade53c={};var _0xc4dae0;var _0x36fc5d;return db['FaxQueue'][_0x7b4c('0x43')]({'where':{'id':_0x3c84af[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x2b77de,null))['then'](function(_0x257e56){if(_0x257e56){_0xc4dae0=_0x257e56;_0xade53c[_0x7b4c('0x2e')]=_['keys'](db[_0x7b4c('0x50')]['rawAttributes']);_0xade53c[_0x7b4c('0x2b')]=_[_0x7b4c('0x2f')](_0x3c84af[_0x7b4c('0x2b')]);_0xade53c['filters']=_['intersection'](_0xade53c[_0x7b4c('0x2e')],_0xade53c[_0x7b4c('0x2b')]);_0x5e102d[_0x7b4c('0x33')]=_['intersection'](_0xade53c[_0x7b4c('0x2e')],qs['fields'](_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x32')]));_0x5e102d[_0x7b4c('0x33')]=_0x5e102d[_0x7b4c('0x33')][_0x7b4c('0x34')]?_0x5e102d['attributes']:_0xade53c[_0x7b4c('0x2e')];_0x5e102d[_0x7b4c('0x51')]=qs['sort'](_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x45')]);_0x5e102d[_0x7b4c('0x29')]=qs[_0x7b4c('0x30')](_[_0x7b4c('0x52')](_0x3c84af[_0x7b4c('0x2b')],_0xade53c[_0x7b4c('0x30')]));if(_0x3c84af[_0x7b4c('0x2b')]['filter']){_0x5e102d[_0x7b4c('0x29')]=_[_0x7b4c('0x35')](_0x5e102d[_0x7b4c('0x29')],{'$or':_[_0x7b4c('0x22')](_0x5e102d[_0x7b4c('0x33')],function(_0x3cbf32){var _0x2f3ba9={};_0x2f3ba9[_0x3cbf32]={'$like':'%'+_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x46')]+'%'};return _0x2f3ba9;})});}_0x5e102d=_[_0x7b4c('0x35')]({},_0x5e102d,_0x3c84af[_0x7b4c('0x36')]);return _0xc4dae0[_0x7b4c('0x4f')](_0x5e102d);}})[_0x7b4c('0x19')](function(_0x225f38){if(_0x225f38){_0x36fc5d=_0x225f38[_0x7b4c('0x34')];if(!_0x3c84af[_0x7b4c('0x2b')][_0x7b4c('0x44')](_0x7b4c('0x53'))){_0x5e102d[_0x7b4c('0x14')]=qs[_0x7b4c('0x14')](_0x3c84af['query']['limit']);_0x5e102d[_0x7b4c('0x12')]=qs[_0x7b4c('0x12')](_0x3c84af['query'][_0x7b4c('0x12')]);}return _0xc4dae0[_0x7b4c('0x4f')](_0x5e102d);}})[_0x7b4c('0x19')](function(_0xc214ce){if(_0xc214ce){return _0xc214ce?{'count':_0x36fc5d,'rows':_0xc214ce}:null;}})[_0x7b4c('0x19')](respondWithResult(_0x2b77de,null))[_0x7b4c('0x37')](handleError(_0x2b77de,null));};exports[_0x7b4c('0x54')]=function(_0x456111,_0x40edf1){var _0x4ff33f=_0x456111[_0x7b4c('0x3f')]['ids'];return db[_0x7b4c('0x50')]['findAll']({'where':{'id':_0x4ff33f},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b4c('0x55'),'attributes':['id','name','online',_0x7b4c('0x56'),_0x7b4c('0x57')],'raw':!![]}]})[_0x7b4c('0x19')](function(_0x530979){if(_0x530979){var _0x46fe2e=_[_0x7b4c('0x58')](_0x530979,function(_0x10e789){var _0x29987e=_0x10e789[_0x7b4c('0x1b')]({'plain':!![]});return _0x29987e[_0x7b4c('0x55')];});return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x456111[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](function(_0x294c8b){return db[_0x7b4c('0x59')][_0x7b4c('0x5a')](function(_0x1989e1){return _0x294c8b['addTeams'](_0x4ff33f,{'transaction':_0x1989e1})[_0x7b4c('0x19')](function(){return BPromise[_0x7b4c('0x5b')](_0x46fe2e,function(_0x35e94a){return db[_0x7b4c('0x5c')]['findOrCreate']({'where':{'UserId':_0x35e94a['id'],'FaxQueueId':_0x456111[_0x7b4c('0x40')]['id']},'transaction':_0x1989e1});});})[_0x7b4c('0x19')](function(){_0x46fe2e[_0x7b4c('0x5d')](function(_0x317cd4){socket[_0x7b4c('0x5e')](_0x7b4c('0x5f'),{'UserId':_0x317cd4['id'],'FaxQueueId':_0x294c8b['id']});});});});});}})[_0x7b4c('0x19')](respondWithStatusCode(_0x40edf1,null))['catch'](handleError(_0x40edf1,null));};exports[_0x7b4c('0x60')]=function(_0x108c99,_0x4d2c85){return db['Team']['findAll']({'where':{'id':_0x108c99[_0x7b4c('0x2b')][_0x7b4c('0x61')]},'attributes':['id'],'include':[{'model':db[_0x7b4c('0x47')],'as':_0x7b4c('0x55'),'attributes':['id'],'raw':!![]}]})[_0x7b4c('0x19')](handleEntityNotFound(_0x4d2c85,null))[_0x7b4c('0x19')](function(_0x2abb3e){var _0x200c98=_[_0x7b4c('0x22')](_0x2abb3e,'id');var _0x2bc889=[];var _0x83e8bb=[];var _0x257fae=squel[_0x7b4c('0x62')]();_0x257fae['field'](_0x7b4c('0x63'))[_0x7b4c('0x64')](_0x7b4c('0x65'),'tq')['join'](_0x7b4c('0x66'),'ut',_0x7b4c('0x67'))[_0x7b4c('0x29')](_0x7b4c('0x68'),_0x108c99[_0x7b4c('0x40')]['id']);for(var _0x57f1a0=0x0;_0x57f1a0<_0x2abb3e[_0x7b4c('0x34')];_0x57f1a0+=0x1){let _0x1cd19e=_0x2abb3e[_0x57f1a0];for(var _0x34abb1=0x0;_0x34abb1<_0x1cd19e[_0x7b4c('0x55')]['length'];_0x34abb1+=0x1){let _0x11842d=_0x1cd19e[_0x7b4c('0x55')][_0x34abb1];var _0xdfa0bc=_0x257fae['clone']();_0xdfa0bc[_0x7b4c('0x29')](_0x7b4c('0x69'),_0x11842d['id']);_0x83e8bb[_0x7b4c('0x6a')](db[_0x7b4c('0x59')]['query'](_0xdfa0bc[_0x7b4c('0x6b')](),{'type':db[_0x7b4c('0x59')][_0x7b4c('0x6c')][_0x7b4c('0x6d')]})['then'](function(_0x288a82){if(_0x288a82['length']===0x1){return _0x11842d['id'];}else{var _0x3b9d97=_['every'](_[_0x7b4c('0x22')](_0x288a82,_0x7b4c('0x6e')),function(_0xb442e3){return _['includes'](_0x200c98,_0xb442e3);});if(_0x3b9d97){return _0x11842d['id'];}}}));}}return BPromise[_0x7b4c('0x6f')](_0x83e8bb)['then'](function(_0xb2d616){_0x2bc889=_(_0x2bc889)[_0x7b4c('0x70')](_0xb2d616)['compact']()[_0x7b4c('0x71')]();return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x108c99[_0x7b4c('0x40')]['id']}})['then'](function(_0x3d1450){return db[_0x7b4c('0x59')]['transaction'](function(_0x17d1fc){return _0x3d1450[_0x7b4c('0x60')](_0x108c99[_0x7b4c('0x2b')][_0x7b4c('0x61')],{'transaction':_0x17d1fc})[_0x7b4c('0x19')](function(){if(!_[_0x7b4c('0x72')](_0x2bc889)){return _0x3d1450[_0x7b4c('0x73')](_0x2bc889,{'transaction':_0x17d1fc});}})['then'](function(){_0x2bc889['forEach'](function(_0xdb202){socket[_0x7b4c('0x5e')](_0x7b4c('0x74'),{'UserId':_0xdb202,'FaxQueueId':_0x3d1450['id']});});});});});});})[_0x7b4c('0x19')](respondWithStatusCode(_0x4d2c85,null))[_0x7b4c('0x37')](handleError(_0x4d2c85,null));};exports['addAgents']=function(_0x228b2b,_0x28cf40){return db[_0x7b4c('0x23')][_0x7b4c('0x3c')]({'where':{'id':_0x228b2b['params']['id']}})['then'](handleEntityNotFound(_0x28cf40,null))[_0x7b4c('0x19')](function(_0x2b1cbe){if(_0x2b1cbe){return _0x2b1cbe[_0x7b4c('0x75')](_0x228b2b[_0x7b4c('0x3f')][_0x7b4c('0x61')],_['omit'](_0x228b2b[_0x7b4c('0x3f')],[_0x7b4c('0x61'),'id'])||{})[_0x7b4c('0x76')](function(_0x20a26c){for(var _0x5c067a=0x0;_0x5c067a<_0x228b2b['body']['ids'][_0x7b4c('0x34')];_0x5c067a+=0x1){socket[_0x7b4c('0x5e')](_0x7b4c('0x5f'),{'UserId':Number(_0x228b2b['body'][_0x7b4c('0x61')][_0x5c067a]),'FaxQueueId':Number(_0x228b2b['params']['id'])});}return _0x20a26c;});}})['then'](respondWithResult(_0x28cf40,null))[_0x7b4c('0x37')](handleError(_0x28cf40,null));};exports['removeAgents']=function(_0x437ef7,_0x1a7b95){return db['FaxQueue']['find']({'where':{'id':_0x437ef7[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x1a7b95,null))[_0x7b4c('0x19')](function(_0x119426){if(_0x119426){return _0x119426['removeAgents'](_0x437ef7['query'][_0x7b4c('0x61')])[_0x7b4c('0x19')](function(){if(_[_0x7b4c('0x77')](_0x437ef7[_0x7b4c('0x2b')][_0x7b4c('0x61')])){for(var _0x14fc2f=0x0;_0x14fc2f<_0x437ef7[_0x7b4c('0x2b')]['ids'][_0x7b4c('0x34')];_0x14fc2f+=0x1){socket[_0x7b4c('0x5e')](_0x7b4c('0x74'),{'UserId':Number(_0x437ef7[_0x7b4c('0x2b')][_0x7b4c('0x61')][_0x14fc2f]),'FaxQueueId':Number(_0x437ef7[_0x7b4c('0x40')]['id'])});}}else{socket[_0x7b4c('0x5e')](_0x7b4c('0x74'),{'UserId':Number(_0x437ef7[_0x7b4c('0x2b')]['ids']),'FaxQueueId':Number(_0x437ef7[_0x7b4c('0x40')]['id'])});}});}})[_0x7b4c('0x19')](respondWithStatusCode(_0x1a7b95,null))[_0x7b4c('0x37')](handleError(_0x1a7b95,null));};exports[_0x7b4c('0x78')]=function(_0x3a1150,_0x3c5e44){var _0x1aae06={};var _0x34a4cc={};var _0x3fd4ed;var _0x59e7b9;return db[_0x7b4c('0x23')][_0x7b4c('0x43')]({'where':{'id':_0x3a1150[_0x7b4c('0x40')]['id']}})[_0x7b4c('0x19')](handleEntityNotFound(_0x3c5e44,null))[_0x7b4c('0x19')](function(_0x1a4ac1){if(_0x1a4ac1){_0x3fd4ed=_0x1a4ac1;_0x34a4cc['model']=_[_0x7b4c('0x2f')](db[_0x7b4c('0x47')]['rawAttributes']);_0x34a4cc['query']=_[_0x7b4c('0x2f')](_0x3a1150['query']);_0x34a4cc[_0x7b4c('0x30')]=_[_0x7b4c('0x31')](_0x34a4cc[_0x7b4c('0x2e')],_0x34a4cc[_0x7b4c('0x2b')]);_0x1aae06['attributes']=_['intersection'](_0x34a4cc[_0x7b4c('0x2e')],qs[_0x7b4c('0x32')](_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x32')]));_0x1aae06[_0x7b4c('0x33')]=_0x1aae06[_0x7b4c('0x33')][_0x7b4c('0x34')]?_0x1aae06[_0x7b4c('0x33')]:_0x34a4cc[_0x7b4c('0x2e')];_0x1aae06[_0x7b4c('0x51')]=qs[_0x7b4c('0x45')](_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x45')]);_0x1aae06[_0x7b4c('0x29')]=qs[_0x7b4c('0x30')](_['pick'](_0x3a1150[_0x7b4c('0x2b')],_0x34a4cc[_0x7b4c('0x30')]));if(_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x46')]){_0x1aae06['where']=_['merge'](_0x1aae06[_0x7b4c('0x29')],{'$or':_[_0x7b4c('0x22')](_0x1aae06[_0x7b4c('0x33')],function(_0x46be32){var _0x84555b={};_0x84555b[_0x46be32]={'$like':'%'+_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x46')]+'%'};return _0x84555b;})});}_0x1aae06=_[_0x7b4c('0x35')]({},_0x1aae06,_0x3a1150[_0x7b4c('0x36')]);return _0x3fd4ed['getAgents'](_0x1aae06);}})[_0x7b4c('0x19')](function(_0x3f29fd){if(_0x3f29fd){_0x59e7b9=_0x3f29fd[_0x7b4c('0x34')];if(!_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x44')](_0x7b4c('0x53'))){_0x1aae06[_0x7b4c('0x14')]=qs[_0x7b4c('0x14')](_0x3a1150[_0x7b4c('0x2b')][_0x7b4c('0x14')]);_0x1aae06[_0x7b4c('0x12')]=qs[_0x7b4c('0x12')](_0x3a1150['query']['offset']);}return _0x3fd4ed[_0x7b4c('0x78')](_0x1aae06);}})[_0x7b4c('0x19')](function(_0xf491ab){if(_0xf491ab){return _0xf491ab?{'count':_0x59e7b9,'rows':_0xf491ab}:null;}})[_0x7b4c('0x19')](respondWithResult(_0x3c5e44,null))[_0x7b4c('0x37')](handleError(_0x3c5e44,null));}; \ No newline at end of file +var _0xeae8=['Content-Range','update','destroy','then','get','FaxQueues','UserProfileResource','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','map','filter','merge','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','Team','online','interface','flatMap','Agents','sequelize','findOrCreate','removeTeams','ids','select','field','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','emit','isArray','getAgents','bluebird','util','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','undefined','limit','count','offset','set'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xeae8,0x66));var _0x8eae=function(_0x20c594,_0x1454f7){_0x20c594=_0x20c594-0x0;var _0x4c39fd=_0xeae8[_0x20c594];return _0x4c39fd;};'use strict';var BPromise=require(_0x8eae('0x0'));var util=require(_0x8eae('0x1'));var _=require(_0x8eae('0x2'));var squel=require('squel');var Redis=require(_0x8eae('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x8eae('0x4'))('api');var config=require(_0x8eae('0x5'));var db=require(_0x8eae('0x6'))['db'];config[_0x8eae('0x7')]=_[_0x8eae('0x8')](config[_0x8eae('0x7')],{'host':_0x8eae('0x9'),'port':0x18eb});var socket=require(_0x8eae('0xa'))(new Redis(config[_0x8eae('0x7')]));require(_0x8eae('0xb'))[_0x8eae('0xc')](socket);function respondWithStatusCode(_0x476ba1,_0x48581b){_0x48581b=_0x48581b||0xcc;return function(_0x4ecbe7){if(_0x4ecbe7){return _0x476ba1[_0x8eae('0xd')](_0x48581b);}return _0x476ba1[_0x8eae('0xe')](_0x48581b)[_0x8eae('0xf')]();};}function respondWithResult(_0x329b64,_0x15ba7d){_0x15ba7d=_0x15ba7d||0xc8;return function(_0x4aba96){if(_0x4aba96){return _0x329b64['status'](_0x15ba7d)['json'](_0x4aba96);}};}function respondWithFilteredResult(_0x9bf1c1,_0x3ade80){return function(_0x5098cf){if(_0x5098cf){var _0x406afc=typeof _0x3ade80['offset']===_0x8eae('0x10')&&typeof _0x3ade80[_0x8eae('0x11')]===_0x8eae('0x10');var _0x10f61e=_0x5098cf[_0x8eae('0x12')];var _0x549d19=_0x406afc?0x0:_0x3ade80[_0x8eae('0x13')];var _0x39d8e7=_0x406afc?_0x5098cf[_0x8eae('0x12')]:_0x3ade80[_0x8eae('0x13')]+_0x3ade80[_0x8eae('0x11')];var _0x1cec9f;if(_0x39d8e7>=_0x10f61e){_0x39d8e7=_0x10f61e;_0x1cec9f=0xc8;}else{_0x1cec9f=0xce;}_0x9bf1c1[_0x8eae('0xe')](_0x1cec9f);return _0x9bf1c1[_0x8eae('0x14')](_0x8eae('0x15'),_0x549d19+'-'+_0x39d8e7+'/'+_0x10f61e)['json'](_0x5098cf);}return null;};}function saveUpdates(_0x5e214e){return function(_0x4e3950){if(_0x4e3950){return _0x4e3950[_0x8eae('0x16')](_0x5e214e)['then'](function(_0x3db47b){return _0x3db47b;});}return null;};}function removeEntity(_0x3fe930){return function(_0x386a97){if(_0x386a97){return _0x386a97[_0x8eae('0x17')]()[_0x8eae('0x18')](function(){var _0x173672=_0x386a97[_0x8eae('0x19')]({'plain':!![]});var _0x42e734=_0x8eae('0x1a');return db[_0x8eae('0x1b')]['destroy']({'where':{'type':_0x42e734,'resourceId':_0x173672['id']}})['then'](function(){return _0x386a97;});})[_0x8eae('0x18')](function(){_0x3fe930[_0x8eae('0xe')](0xcc)[_0x8eae('0xf')]();});}};}function handleEntityNotFound(_0x4d4d8f){return function(_0x1ee7fb){if(!_0x1ee7fb){_0x4d4d8f[_0x8eae('0xd')](0x194);}return _0x1ee7fb;};}function handleError(_0x51fa34,_0x1dc612){_0x1dc612=_0x1dc612||0x1f4;return function(_0x3326b3){logger['error'](_0x3326b3[_0x8eae('0x1c')]);if(_0x3326b3[_0x8eae('0x1d')]){delete _0x3326b3[_0x8eae('0x1d')];}_0x51fa34[_0x8eae('0xe')](_0x1dc612)[_0x8eae('0x1e')](_0x3326b3);};}exports[_0x8eae('0x1f')]=function(_0x3761a6,_0x3efe66){var _0x14c0c5={};var _0x2fc7ec={'count':0x0,'rows':[]};var _0x386bec=_['map'](db[_0x8eae('0x20')][_0x8eae('0x21')],function(_0x141940){return{'name':_0x141940[_0x8eae('0x22')],'type':_0x141940[_0x8eae('0x23')][_0x8eae('0x24')]};});_0x14c0c5=qs[_0x8eae('0x25')](_0x386bec,_0x3761a6);var _0x4e7d7c={'where':_0x14c0c5[_0x8eae('0x26')]};return db['FaxQueue'][_0x8eae('0x12')](_0x4e7d7c)[_0x8eae('0x18')](function(_0x34f0c4){_0x2fc7ec[_0x8eae('0x12')]=_0x34f0c4;_0x14c0c5[_0x8eae('0x27')]=qs['include'](_0x3761a6['query']);return db[_0x8eae('0x20')][_0x8eae('0x28')](_0x14c0c5);})[_0x8eae('0x18')](function(_0x307a19){_0x2fc7ec['rows']=_0x307a19;return _0x2fc7ec;})[_0x8eae('0x18')](respondWithFilteredResult(_0x3efe66,_0x14c0c5))[_0x8eae('0x29')](handleError(_0x3efe66,null));};exports[_0x8eae('0x2a')]=function(_0x3273c0,_0x2f92d0){var _0x2e9c51={'raw':!![],'where':{'id':_0x3273c0[_0x8eae('0x2b')]['id']}},_0x286bb2={};_0x286bb2[_0x8eae('0x2c')]=_[_0x8eae('0x2d')](db[_0x8eae('0x20')][_0x8eae('0x21')]);_0x286bb2[_0x8eae('0x2e')]=_[_0x8eae('0x2d')](_0x3273c0[_0x8eae('0x2e')]);_0x286bb2[_0x8eae('0x2f')]=_[_0x8eae('0x30')](_0x286bb2[_0x8eae('0x2c')],_0x286bb2[_0x8eae('0x2e')]);_0x2e9c51[_0x8eae('0x31')]=_[_0x8eae('0x30')](_0x286bb2['model'],qs[_0x8eae('0x32')](_0x3273c0[_0x8eae('0x2e')][_0x8eae('0x32')]));_0x2e9c51['attributes']=_0x2e9c51[_0x8eae('0x31')][_0x8eae('0x33')]?_0x2e9c51[_0x8eae('0x31')]:_0x286bb2[_0x8eae('0x2c')];if(_0x3273c0['query'][_0x8eae('0x34')]){_0x2e9c51['include']=[{'all':!![]}];}_0x2e9c51=_['merge']({},_0x2e9c51,_0x3273c0[_0x8eae('0x35')]);return db[_0x8eae('0x20')][_0x8eae('0x36')](_0x2e9c51)[_0x8eae('0x18')](handleEntityNotFound(_0x2f92d0,null))[_0x8eae('0x18')](respondWithResult(_0x2f92d0,null))[_0x8eae('0x29')](handleError(_0x2f92d0,null));};exports[_0x8eae('0x37')]=function(_0x53bd4b,_0x71f9be){return db[_0x8eae('0x20')]['create'](_0x53bd4b['body'],{})['then'](function(_0x6cc974){var _0x3b6bba=_0x53bd4b['user'][_0x8eae('0x19')]({'plain':!![]});if(!_0x3b6bba)throw new Error(_0x8eae('0x38'));if(_0x3b6bba['role']===_0x8eae('0x39')){var _0x2ee9c2=_0x6cc974[_0x8eae('0x19')]({'plain':!![]});var _0x11c626=_0x8eae('0x1a');return db['UserProfileSection'][_0x8eae('0x36')]({'where':{'name':_0x11c626,'userProfileId':_0x3b6bba[_0x8eae('0x3a')]},'raw':!![]})[_0x8eae('0x18')](function(_0x488b61){if(_0x488b61&&_0x488b61[_0x8eae('0x3b')]===0x0){return db[_0x8eae('0x1b')]['create']({'name':_0x2ee9c2[_0x8eae('0x1d')],'resourceId':_0x2ee9c2['id'],'type':_0x488b61[_0x8eae('0x1d')],'sectionId':_0x488b61['id']},{})[_0x8eae('0x18')](function(){return _0x6cc974;});}else{return _0x6cc974;}})[_0x8eae('0x29')](function(_0x5923f7){logger[_0x8eae('0x3c')](_0x8eae('0x3d'),_0x5923f7);throw _0x5923f7;});}return _0x6cc974;})[_0x8eae('0x18')](respondWithResult(_0x71f9be,0xc9))[_0x8eae('0x29')](handleError(_0x71f9be,null));};exports['update']=function(_0x985430,_0x284dca){if(_0x985430[_0x8eae('0x3e')]['id']){delete _0x985430[_0x8eae('0x3e')]['id'];}return db['FaxQueue'][_0x8eae('0x36')]({'where':{'id':_0x985430['params']['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x284dca,null))['then'](saveUpdates(_0x985430[_0x8eae('0x3e')],null))[_0x8eae('0x18')](respondWithResult(_0x284dca,null))['catch'](handleError(_0x284dca,null));};exports[_0x8eae('0x17')]=function(_0x22bf50,_0x1fdf59){return db[_0x8eae('0x20')][_0x8eae('0x36')]({'where':{'id':_0x22bf50[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x1fdf59,null))[_0x8eae('0x18')](removeEntity(_0x1fdf59,null))[_0x8eae('0x29')](handleError(_0x1fdf59,null));};exports['describe']=function(_0x35000d,_0x590e0b){return db[_0x8eae('0x20')][_0x8eae('0x3f')]()[_0x8eae('0x18')](respondWithResult(_0x590e0b,null))[_0x8eae('0x29')](handleError(_0x590e0b,null));};exports['getMembers']=function(_0x2a4bc9,_0x32fec2){var _0x27cccb={'raw':!![],'where':{}},_0x448004={},_0xc3f899;return db[_0x8eae('0x20')][_0x8eae('0x40')]({'where':{'id':_0x2a4bc9[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x32fec2,null))[_0x8eae('0x18')](function(_0x319a94){if(_0x319a94){_0xc3f899=_0x319a94['get']({'plain':!![]});_0x448004[_0x8eae('0x2c')]=_[_0x8eae('0x2d')](db['UserFaxQueue'][_0x8eae('0x21')]);_0x448004['query']=_[_0x8eae('0x2d')](_0x2a4bc9['query']);_0x448004[_0x8eae('0x2f')]=_['intersection'](_0x448004[_0x8eae('0x2c')],_0x448004[_0x8eae('0x2e')]);_0x27cccb[_0x8eae('0x31')]=_[_0x8eae('0x30')](_0x448004[_0x8eae('0x2c')],qs[_0x8eae('0x32')](_0x2a4bc9[_0x8eae('0x2e')][_0x8eae('0x32')]));_0x27cccb[_0x8eae('0x31')]=_0x27cccb[_0x8eae('0x31')][_0x8eae('0x33')]?_0x27cccb['attributes']:_0x448004['model'];if(!_0x2a4bc9[_0x8eae('0x2e')][_0x8eae('0x41')](_0x8eae('0x42'))){_0x27cccb[_0x8eae('0x11')]=qs[_0x8eae('0x11')](_0x2a4bc9[_0x8eae('0x2e')]['limit']);_0x27cccb[_0x8eae('0x13')]=qs[_0x8eae('0x13')](_0x2a4bc9[_0x8eae('0x2e')][_0x8eae('0x13')]);}_0x27cccb[_0x8eae('0x43')]=qs[_0x8eae('0x44')](_0x2a4bc9['query'][_0x8eae('0x44')]);_0x27cccb[_0x8eae('0x26')]=qs['filters'](_[_0x8eae('0x45')](_0x2a4bc9[_0x8eae('0x2e')],_0x448004[_0x8eae('0x2f')]));_0x27cccb[_0x8eae('0x26')][_0x8eae('0x46')]=_0x319a94['id'];if(_0x2a4bc9[_0x8eae('0x2e')]['filter']){_0x27cccb[_0x8eae('0x26')]=_['merge'](_0x27cccb[_0x8eae('0x26')],{'$or':_[_0x8eae('0x47')](_0x27cccb[_0x8eae('0x31')],function(_0x537e25){var _0x33a210={};_0x33a210[_0x537e25]={'$like':'%'+_0x2a4bc9[_0x8eae('0x2e')][_0x8eae('0x48')]+'%'};return _0x33a210;})});}_0x27cccb=_[_0x8eae('0x49')]({},_0x27cccb,_0x2a4bc9[_0x8eae('0x35')]);return db[_0x8eae('0x4a')][_0x8eae('0x28')](_0x27cccb);}})[_0x8eae('0x18')](function(_0x226120){if(_0x226120){return db[_0x8eae('0x4b')][_0x8eae('0x4c')]({'where':{'id':_['map'](_0x226120,_0x8eae('0x4d')),'role':_0x8eae('0x4e')},'attributes':['id',_0x8eae('0x1d'),_0x8eae('0x4f'),_0x8eae('0x50'),_0x8eae('0x51')]});}})[_0x8eae('0x18')](function(_0x1d105e){if(_0x1d105e){return{'count':_0x1d105e[_0x8eae('0x12')],'rows':_[_0x8eae('0x47')](_0x1d105e[_0x8eae('0x52')],function(_0x5df388){return{'membername':_0x5df388[_0x8eae('0x1d')],'UserId':_0x5df388['id'],'queue_name':_0xc3f899[_0x8eae('0x1d')],'FaxQueueId':_0xc3f899['id'],'interface':util[_0x8eae('0x53')](_0x8eae('0x54'),_0x8eae('0x55'),_0x5df388[_0x8eae('0x1d')]),'penalty':0x0,'paused':_0x5df388['faxPause'],'createdAt':_0x5df388[_0x8eae('0x51')],'updatedAt':_0x5df388['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8eae('0x18')](respondWithFilteredResult(_0x32fec2,_0x27cccb))['catch'](handleError(_0x32fec2,null));};exports[_0x8eae('0x56')]=function(_0x113b86,_0x573946){var _0x20a577={};var _0x572b8c={};var _0x5ce4ef;var _0x422436;return db['FaxQueue'][_0x8eae('0x40')]({'where':{'id':_0x113b86['params']['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x573946,null))['then'](function(_0x3c57df){if(_0x3c57df){_0x5ce4ef=_0x3c57df;_0x572b8c['model']=_['keys'](db['Team'][_0x8eae('0x21')]);_0x572b8c[_0x8eae('0x2e')]=_['keys'](_0x113b86[_0x8eae('0x2e')]);_0x572b8c[_0x8eae('0x2f')]=_[_0x8eae('0x30')](_0x572b8c['model'],_0x572b8c[_0x8eae('0x2e')]);_0x20a577['attributes']=_[_0x8eae('0x30')](_0x572b8c['model'],qs['fields'](_0x113b86[_0x8eae('0x2e')][_0x8eae('0x32')]));_0x20a577['attributes']=_0x20a577[_0x8eae('0x31')][_0x8eae('0x33')]?_0x20a577['attributes']:_0x572b8c[_0x8eae('0x2c')];_0x20a577[_0x8eae('0x43')]=qs[_0x8eae('0x44')](_0x113b86[_0x8eae('0x2e')][_0x8eae('0x44')]);_0x20a577['where']=qs[_0x8eae('0x2f')](_[_0x8eae('0x45')](_0x113b86['query'],_0x572b8c[_0x8eae('0x2f')]));if(_0x113b86[_0x8eae('0x2e')][_0x8eae('0x48')]){_0x20a577[_0x8eae('0x26')]=_['merge'](_0x20a577[_0x8eae('0x26')],{'$or':_[_0x8eae('0x47')](_0x20a577[_0x8eae('0x31')],function(_0x20660d){var _0x327ead={};_0x327ead[_0x20660d]={'$like':'%'+_0x113b86[_0x8eae('0x2e')][_0x8eae('0x48')]+'%'};return _0x327ead;})});}_0x20a577=_[_0x8eae('0x49')]({},_0x20a577,_0x113b86[_0x8eae('0x35')]);return _0x5ce4ef[_0x8eae('0x56')](_0x20a577);}})[_0x8eae('0x18')](function(_0x59ef33){if(_0x59ef33){_0x422436=_0x59ef33['length'];if(!_0x113b86[_0x8eae('0x2e')][_0x8eae('0x41')](_0x8eae('0x42'))){_0x20a577[_0x8eae('0x11')]=qs[_0x8eae('0x11')](_0x113b86['query'][_0x8eae('0x11')]);_0x20a577['offset']=qs['offset'](_0x113b86[_0x8eae('0x2e')][_0x8eae('0x13')]);}return _0x5ce4ef[_0x8eae('0x56')](_0x20a577);}})[_0x8eae('0x18')](function(_0x255490){if(_0x255490){return _0x255490?{'count':_0x422436,'rows':_0x255490}:null;}})[_0x8eae('0x18')](respondWithResult(_0x573946,null))[_0x8eae('0x29')](handleError(_0x573946,null));};exports[_0x8eae('0x57')]=function(_0x48e08c,_0x3380ea){var _0x3041b6=_0x48e08c[_0x8eae('0x3e')]['ids'];return db[_0x8eae('0x58')]['findAll']({'where':{'id':_0x3041b6},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x8eae('0x1d'),_0x8eae('0x59'),'voicePause',_0x8eae('0x5a')],'raw':!![]}]})['then'](function(_0x4de55c){if(_0x4de55c){var _0x28043f=_[_0x8eae('0x5b')](_0x4de55c,function(_0x229125){var _0xa8a22b=_0x229125[_0x8eae('0x19')]({'plain':!![]});return _0xa8a22b[_0x8eae('0x5c')];});return db[_0x8eae('0x20')][_0x8eae('0x36')]({'where':{'id':_0x48e08c['params']['id']}})['then'](function(_0x2eb092){return db[_0x8eae('0x5d')]['transaction'](function(_0x2f14fd){return _0x2eb092['addTeams'](_0x3041b6,{'transaction':_0x2f14fd})['then'](function(){return BPromise['each'](_0x28043f,function(_0x1a8f28){return db[_0x8eae('0x4a')][_0x8eae('0x5e')]({'where':{'UserId':_0x1a8f28['id'],'FaxQueueId':_0x48e08c[_0x8eae('0x2b')]['id']},'transaction':_0x2f14fd});});})[_0x8eae('0x18')](function(){_0x28043f['forEach'](function(_0x2c45c0){socket['emit']('userFaxQueue:save',{'UserId':_0x2c45c0['id'],'FaxQueueId':_0x2eb092['id']});});});});});}})[_0x8eae('0x18')](respondWithStatusCode(_0x3380ea,null))[_0x8eae('0x29')](handleError(_0x3380ea,null));};exports[_0x8eae('0x5f')]=function(_0x317034,_0x41bef6){return db['Team'][_0x8eae('0x28')]({'where':{'id':_0x317034[_0x8eae('0x2e')][_0x8eae('0x60')]},'attributes':['id'],'include':[{'model':db[_0x8eae('0x4b')],'as':_0x8eae('0x5c'),'attributes':['id'],'raw':!![]}]})[_0x8eae('0x18')](handleEntityNotFound(_0x41bef6,null))['then'](function(_0x10601e){var _0x480cc2=_[_0x8eae('0x47')](_0x10601e,'id');var _0x33bcae=[];var _0x366fa1=[];var _0x57da24=squel[_0x8eae('0x61')]();_0x57da24[_0x8eae('0x62')](_0x8eae('0x63'))['from'](_0x8eae('0x64'),'tq')[_0x8eae('0x65')]('user_has_teams','ut',_0x8eae('0x66'))[_0x8eae('0x26')](_0x8eae('0x67'),_0x317034[_0x8eae('0x2b')]['id']);for(var _0x426680=0x0;_0x426680<_0x10601e[_0x8eae('0x33')];_0x426680+=0x1){let _0x5cdc7a=_0x10601e[_0x426680];for(var _0x4ad1c1=0x0;_0x4ad1c1<_0x5cdc7a[_0x8eae('0x5c')][_0x8eae('0x33')];_0x4ad1c1+=0x1){let _0x3be5dd=_0x5cdc7a[_0x8eae('0x5c')][_0x4ad1c1];var _0x1d1fde=_0x57da24[_0x8eae('0x68')]();_0x1d1fde[_0x8eae('0x26')](_0x8eae('0x69'),_0x3be5dd['id']);_0x366fa1[_0x8eae('0x6a')](db[_0x8eae('0x5d')]['query'](_0x1d1fde[_0x8eae('0x6b')](),{'type':db[_0x8eae('0x5d')]['QueryTypes']['SELECT']})[_0x8eae('0x18')](function(_0x33b9b1){if(_0x33b9b1[_0x8eae('0x33')]===0x1){return _0x3be5dd['id'];}else{var _0x549547=_[_0x8eae('0x6c')](_[_0x8eae('0x47')](_0x33b9b1,_0x8eae('0x6d')),function(_0x5023c2){return _[_0x8eae('0x6e')](_0x480cc2,_0x5023c2);});if(_0x549547){return _0x3be5dd['id'];}}}));}}return BPromise[_0x8eae('0x6f')](_0x366fa1)[_0x8eae('0x18')](function(_0x4e8ecc){_0x33bcae=_(_0x33bcae)['union'](_0x4e8ecc)[_0x8eae('0x70')]()[_0x8eae('0x71')]();return db[_0x8eae('0x20')][_0x8eae('0x36')]({'where':{'id':_0x317034[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](function(_0x378ee4){return db[_0x8eae('0x5d')]['transaction'](function(_0x1b9b16){return _0x378ee4['removeTeams'](_0x317034[_0x8eae('0x2e')][_0x8eae('0x60')],{'transaction':_0x1b9b16})['then'](function(){if(!_[_0x8eae('0x72')](_0x33bcae)){return _0x378ee4[_0x8eae('0x73')](_0x33bcae,{'transaction':_0x1b9b16});}})[_0x8eae('0x18')](function(){_0x33bcae[_0x8eae('0x74')](function(_0x20635f){socket['emit'](_0x8eae('0x75'),{'UserId':_0x20635f,'FaxQueueId':_0x378ee4['id']});});});});});});})[_0x8eae('0x18')](respondWithStatusCode(_0x41bef6,null))[_0x8eae('0x29')](handleError(_0x41bef6,null));};exports['addAgents']=function(_0xbde2b8,_0xc846b8){return db['FaxQueue'][_0x8eae('0x36')]({'where':{'id':_0xbde2b8[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0xc846b8,null))['then'](function(_0x926831){if(_0x926831){return _0x926831[_0x8eae('0x76')](_0xbde2b8[_0x8eae('0x3e')][_0x8eae('0x60')],_[_0x8eae('0x77')](_0xbde2b8[_0x8eae('0x3e')],['ids','id'])||{})['spread'](function(_0xf3d28d){for(var _0xc04b9a=0x0;_0xc04b9a<_0xbde2b8[_0x8eae('0x3e')][_0x8eae('0x60')][_0x8eae('0x33')];_0xc04b9a+=0x1){socket[_0x8eae('0x78')]('userFaxQueue:save',{'UserId':Number(_0xbde2b8[_0x8eae('0x3e')][_0x8eae('0x60')][_0xc04b9a]),'FaxQueueId':Number(_0xbde2b8[_0x8eae('0x2b')]['id'])});}return _0xf3d28d;});}})[_0x8eae('0x18')](respondWithResult(_0xc846b8,null))['catch'](handleError(_0xc846b8,null));};exports[_0x8eae('0x73')]=function(_0x32f653,_0x222cb3){return db[_0x8eae('0x20')][_0x8eae('0x36')]({'where':{'id':_0x32f653[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x222cb3,null))[_0x8eae('0x18')](function(_0xc20b44){if(_0xc20b44){return _0xc20b44[_0x8eae('0x73')](_0x32f653[_0x8eae('0x2e')][_0x8eae('0x60')])[_0x8eae('0x18')](function(){if(_[_0x8eae('0x79')](_0x32f653[_0x8eae('0x2e')][_0x8eae('0x60')])){for(var _0x46000c=0x0;_0x46000c<_0x32f653[_0x8eae('0x2e')][_0x8eae('0x60')][_0x8eae('0x33')];_0x46000c+=0x1){socket[_0x8eae('0x78')]('userFaxQueue:remove',{'UserId':Number(_0x32f653[_0x8eae('0x2e')][_0x8eae('0x60')][_0x46000c]),'FaxQueueId':Number(_0x32f653[_0x8eae('0x2b')]['id'])});}}else{socket[_0x8eae('0x78')]('userFaxQueue:remove',{'UserId':Number(_0x32f653[_0x8eae('0x2e')]['ids']),'FaxQueueId':Number(_0x32f653[_0x8eae('0x2b')]['id'])});}});}})[_0x8eae('0x18')](respondWithStatusCode(_0x222cb3,null))['catch'](handleError(_0x222cb3,null));};exports[_0x8eae('0x7a')]=function(_0x2cd852,_0x29897c){var _0x400da5={};var _0x56b399={};var _0x1500ba;var _0x1c05c8;return db[_0x8eae('0x20')][_0x8eae('0x40')]({'where':{'id':_0x2cd852[_0x8eae('0x2b')]['id']}})[_0x8eae('0x18')](handleEntityNotFound(_0x29897c,null))[_0x8eae('0x18')](function(_0x5c1837){if(_0x5c1837){_0x1500ba=_0x5c1837;_0x56b399['model']=_[_0x8eae('0x2d')](db['User'][_0x8eae('0x21')]);_0x56b399['query']=_[_0x8eae('0x2d')](_0x2cd852[_0x8eae('0x2e')]);_0x56b399[_0x8eae('0x2f')]=_[_0x8eae('0x30')](_0x56b399[_0x8eae('0x2c')],_0x56b399[_0x8eae('0x2e')]);_0x400da5[_0x8eae('0x31')]=_[_0x8eae('0x30')](_0x56b399[_0x8eae('0x2c')],qs[_0x8eae('0x32')](_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x32')]));_0x400da5['attributes']=_0x400da5[_0x8eae('0x31')]['length']?_0x400da5[_0x8eae('0x31')]:_0x56b399[_0x8eae('0x2c')];_0x400da5[_0x8eae('0x43')]=qs[_0x8eae('0x44')](_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x44')]);_0x400da5[_0x8eae('0x26')]=qs['filters'](_[_0x8eae('0x45')](_0x2cd852[_0x8eae('0x2e')],_0x56b399['filters']));if(_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x48')]){_0x400da5['where']=_['merge'](_0x400da5[_0x8eae('0x26')],{'$or':_['map'](_0x400da5[_0x8eae('0x31')],function(_0x1b6bf3){var _0x408c5c={};_0x408c5c[_0x1b6bf3]={'$like':'%'+_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x48')]+'%'};return _0x408c5c;})});}_0x400da5=_['merge']({},_0x400da5,_0x2cd852[_0x8eae('0x35')]);return _0x1500ba[_0x8eae('0x7a')](_0x400da5);}})['then'](function(_0x5d7073){if(_0x5d7073){_0x1c05c8=_0x5d7073[_0x8eae('0x33')];if(!_0x2cd852['query'][_0x8eae('0x41')](_0x8eae('0x42'))){_0x400da5[_0x8eae('0x11')]=qs[_0x8eae('0x11')](_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x11')]);_0x400da5[_0x8eae('0x13')]=qs[_0x8eae('0x13')](_0x2cd852[_0x8eae('0x2e')][_0x8eae('0x13')]);}return _0x1500ba[_0x8eae('0x7a')](_0x400da5);}})[_0x8eae('0x18')](function(_0x27943f){if(_0x27943f){return _0x27943f?{'count':_0x1c05c8,'rows':_0x27943f}:null;}})['then'](respondWithResult(_0x29897c,null))[_0x8eae('0x29')](handleError(_0x29897c,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 87cc622..6f8ff6d 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 _0x57af=['emit','hasOwnProperty','hook','exports','events','FaxQueue','save','remove'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x57af,0x16c));var _0xf57a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x57af[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require(_0xf57a('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xf57a('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf57a('0x2'),'afterUpdate':'update','afterDestroy':_0xf57a('0x3')};function emitEvent(_0x3589e1){return function(_0xae971d,_0x216c42,_0x567e32){FaxQueueEvents[_0xf57a('0x4')](_0x3589e1+':'+_0xae971d['id'],_0xae971d);FaxQueueEvents[_0xf57a('0x4')](_0x3589e1,_0xae971d);_0x567e32(null);};}for(var e in events){if(events[_0xf57a('0x5')](e)){var event=events[e];FaxQueue[_0xf57a('0x6')](e,emitEvent(event));}}module[_0xf57a('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x7d23=['../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x369fe3,_0x90ec18){var _0x55c62e=function(_0x38ec18){while(--_0x38ec18){_0x369fe3['push'](_0x369fe3['shift']());}};_0x55c62e(++_0x90ec18);}(_0x7d23,0x121));var _0x37d2=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7d23[_0x47fd36];return _0x21a0fc;};'use strict';var EventEmitter=require(_0x37d2('0x0'));var FaxQueue=require(_0x37d2('0x1'))['db'][_0x37d2('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x37d2('0x3')](0x0);var events={'afterCreate':_0x37d2('0x4'),'afterUpdate':'update','afterDestroy':_0x37d2('0x5')};function emitEvent(_0x44d9b7){return function(_0x59466d,_0xa0ff08,_0x11e44a){FaxQueueEvents[_0x37d2('0x6')](_0x44d9b7+':'+_0x59466d['id'],_0x59466d);FaxQueueEvents[_0x37d2('0x6')](_0x44d9b7,_0x59466d);_0x11e44a(null);};}for(var e in events){if(events[_0x37d2('0x7')](e)){var event=events[e];FaxQueue[_0x37d2('0x8')](e,emitEvent(event));}}module[_0x37d2('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 bc7afff..9b48973 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 _0x20f9=['../../config/environment','exports','define','fax_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1ae1e2,_0x29d1b0){var _0x5c3809=function(_0x45a263){while(--_0x45a263){_0x1ae1e2['push'](_0x1ae1e2['shift']());}};_0x5c3809(++_0x29d1b0);}(_0x20f9,0x190));var _0x920f=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x20f9[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x920f('0x0'));var util=require(_0x920f('0x1'));var logger=require('../../config/logger')(_0x920f('0x2'));var moment=require(_0x920f('0x3'));var BPromise=require(_0x920f('0x4'));var rp=require(_0x920f('0x5'));var fs=require('fs');var path=require(_0x920f('0x6'));var rimraf=require(_0x920f('0x7'));var config=require(_0x920f('0x8'));var attributes=require('./faxQueue.attributes');module[_0x920f('0x9')]=function(_0xca2d1c,_0x52919c){return _0xca2d1c[_0x920f('0xa')]('FaxQueue',attributes,{'tableName':_0x920f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d18=['api','moment','bluebird','path','../../config/environment','define','fax_queues','lodash','util','../../config/logger'];(function(_0x5227df,_0x727417){var _0x2d1477=function(_0x4c101b){while(--_0x4c101b){_0x5227df['push'](_0x5227df['shift']());}};_0x2d1477(++_0x727417);}(_0x0d18,0x133));var _0x80d1=function(_0x2f6984,_0x41d3ee){_0x2f6984=_0x2f6984-0x0;var _0x1df6ab=_0x0d18[_0x2f6984];return _0x1df6ab;};'use strict';var _=require(_0x80d1('0x0'));var util=require(_0x80d1('0x1'));var logger=require(_0x80d1('0x2'))(_0x80d1('0x3'));var moment=require(_0x80d1('0x4'));var BPromise=require(_0x80d1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80d1('0x6'));var rimraf=require('rimraf');var config=require(_0x80d1('0x7'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x1d52b2,_0x5c41d5){return _0x1d52b2[_0x80d1('0x8')]('FaxQueue',attributes,{'tableName':_0x80d1('0x9'),'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 17c8d6c..63953c3 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 _0x4743=['options','raw','where','attributes','include','model','map','stringify','catch','ShowFaxQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxQueue.socket','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','GetFaxQueue','FaxQueue'];(function(_0x599809,_0x4d3cd0){var _0x364f0b=function(_0x2d1aa4){while(--_0x2d1aa4){_0x599809['push'](_0x599809['shift']());}};_0x364f0b(++_0x4d3cd0);}(_0x4743,0x187));var _0x3474=function(_0x5bdfb2,_0x5eeb10){_0x5bdfb2=_0x5bdfb2-0x0;var _0x5f5240=_0x4743[_0x5bdfb2];return _0x5f5240;};'use strict';var _=require(_0x3474('0x0'));var util=require(_0x3474('0x1'));var moment=require(_0x3474('0x2'));var BPromise=require('bluebird');var rs=require(_0x3474('0x3'));var fs=require('fs');var Redis=require(_0x3474('0x4'));var db=require(_0x3474('0x5'))['db'];var utils=require(_0x3474('0x6'));var logger=require(_0x3474('0x7'))(_0x3474('0x8'));var config=require(_0x3474('0x9'));var jayson=require(_0x3474('0xa'));var client=jayson[_0x3474('0xb')][_0x3474('0xc')]({'port':0x232a});config[_0x3474('0xd')]=_['defaults'](config[_0x3474('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3474('0xe'))(new Redis(config[_0x3474('0xd')]));require(_0x3474('0xf'))['register'](socket);function respondWithRpcPromise(_0x5252ca,_0x3ee747,_0x472844){return new BPromise(function(_0x2cc3db,_0x51966f){return client[_0x3474('0x10')](_0x5252ca,_0x472844)[_0x3474('0x11')](function(_0x37af41){logger[_0x3474('0x12')](_0x3474('0x13'),_0x3ee747,_0x3474('0x14'));logger[_0x3474('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3ee747,_0x3474('0x14'),JSON['stringify'](_0x37af41));if(_0x37af41[_0x3474('0x16')]){if(_0x37af41[_0x3474('0x16')][_0x3474('0x17')]===0x1f4){logger['error'](_0x3474('0x13'),_0x3ee747,_0x37af41['error'][_0x3474('0x18')]);return _0x51966f(_0x37af41['error']['message']);}logger[_0x3474('0x16')](_0x3474('0x13'),_0x3ee747,_0x37af41[_0x3474('0x16')]['message']);return _0x2cc3db(_0x37af41[_0x3474('0x16')]['message']);}else{logger['info'](_0x3474('0x13'),_0x3ee747,_0x3474('0x14'));_0x2cc3db(_0x37af41['result'][_0x3474('0x18')]);}})['catch'](function(_0x4e695a){logger['error'](_0x3474('0x13'),_0x3ee747,_0x4e695a);_0x51966f(_0x4e695a);});});}exports[_0x3474('0x19')]=function(_0x5e240c){var _0x1e26b9=this;return new Promise(function(_0x3f61d7,_0x5999e1){return db[_0x3474('0x1a')]['findAll']({'raw':_0x5e240c[_0x3474('0x1b')]?_0x5e240c[_0x3474('0x1b')][_0x3474('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e240c[_0x3474('0x1b')]?_0x5e240c[_0x3474('0x1b')][_0x3474('0x1d')]||null:null,'attributes':_0x5e240c[_0x3474('0x1b')]?_0x5e240c[_0x3474('0x1b')][_0x3474('0x1e')]||null:null,'limit':_0x5e240c[_0x3474('0x1b')]?_0x5e240c[_0x3474('0x1b')]['limit']||null:null,'include':_0x5e240c[_0x3474('0x1b')]?_0x5e240c[_0x3474('0x1b')][_0x3474('0x1f')]?_['map'](_0x5e240c[_0x3474('0x1b')][_0x3474('0x1f')],function(_0x51cad8){return{'model':db[_0x51cad8[_0x3474('0x20')]],'as':_0x51cad8['as'],'attributes':_0x51cad8[_0x3474('0x1e')],'include':_0x51cad8['include']?_['map'](_0x51cad8[_0x3474('0x1f')],function(_0x38b0af){return{'model':db[_0x38b0af['model']],'as':_0x38b0af['as'],'attributes':_0x38b0af['attributes'],'include':_0x38b0af[_0x3474('0x1f')]?_[_0x3474('0x21')](_0x38b0af[_0x3474('0x1f')],function(_0x351c6d){return{'model':db[_0x351c6d[_0x3474('0x20')]],'as':_0x351c6d['as'],'attributes':_0x351c6d[_0x3474('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3474('0x11')](function(_0x51721f){logger[_0x3474('0x12')](_0x3474('0x19'),_0x5e240c);logger[_0x3474('0x15')](_0x3474('0x19'),_0x5e240c,JSON[_0x3474('0x22')](_0x51721f));_0x3f61d7(_0x51721f);})[_0x3474('0x23')](function(_0x3f3807){logger['error'](_0x3474('0x19'),_0x3f3807['message'],_0x5e240c);_0x5999e1(_0x1e26b9[_0x3474('0x16')](0x1f4,_0x3f3807[_0x3474('0x18')]));});});};exports[_0x3474('0x24')]=function(_0x5ca820){var _0x16e811=this;return new Promise(function(_0x556bac,_0xab2a79){return db[_0x3474('0x1a')][_0x3474('0x25')]({'raw':_0x5ca820[_0x3474('0x1b')]?_0x5ca820[_0x3474('0x1b')][_0x3474('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ca820[_0x3474('0x1b')]?_0x5ca820['options'][_0x3474('0x1d')]||null:null,'attributes':_0x5ca820[_0x3474('0x1b')]?_0x5ca820[_0x3474('0x1b')][_0x3474('0x1e')]||null:null,'include':_0x5ca820[_0x3474('0x1b')]?_0x5ca820[_0x3474('0x1b')]['include']?_['map'](_0x5ca820[_0x3474('0x1b')][_0x3474('0x1f')],function(_0x4b3158){return{'model':db[_0x4b3158[_0x3474('0x20')]],'as':_0x4b3158['as'],'attributes':_0x4b3158[_0x3474('0x1e')],'include':_0x4b3158[_0x3474('0x1f')]?_[_0x3474('0x21')](_0x4b3158[_0x3474('0x1f')],function(_0x1055a6){return{'model':db[_0x1055a6[_0x3474('0x20')]],'as':_0x1055a6['as'],'attributes':_0x1055a6['attributes'],'include':_0x1055a6['include']?_[_0x3474('0x21')](_0x1055a6[_0x3474('0x1f')],function(_0x36612f){return{'model':db[_0x36612f[_0x3474('0x20')]],'as':_0x36612f['as'],'attributes':_0x36612f['attributes']};}):[]};}):[]};}):[]:[]})[_0x3474('0x11')](function(_0x5572fe){logger[_0x3474('0x12')](_0x3474('0x24'),_0x5ca820);logger[_0x3474('0x15')](_0x3474('0x24'),_0x5ca820,JSON[_0x3474('0x22')](_0x5572fe));_0x556bac(_0x5572fe);})[_0x3474('0x23')](function(_0x32d55a){logger[_0x3474('0x16')](_0x3474('0x24'),_0x32d55a[_0x3474('0x18')],_0x5ca820);_0xab2a79(_0x16e811['error'](0x1f4,_0x32d55a[_0x3474('0x18')]));});});}; \ No newline at end of file +var _0x0af9=['request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include','model','attributes','map','stringify','ShowFaxQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x1cfba9,_0x27575f){var _0x533a2f=function(_0x333509){while(--_0x333509){_0x1cfba9['push'](_0x1cfba9['shift']());}};_0x533a2f(++_0x27575f);}(_0x0af9,0x115));var _0x90af=function(_0x3330a6,_0x380de0){_0x3330a6=_0x3330a6-0x0;var _0x2f7b63=_0x0af9[_0x3330a6];return _0x2f7b63;};'use strict';var _=require(_0x90af('0x0'));var util=require(_0x90af('0x1'));var moment=require(_0x90af('0x2'));var BPromise=require('bluebird');var rs=require(_0x90af('0x3'));var fs=require('fs');var Redis=require(_0x90af('0x4'));var db=require(_0x90af('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x90af('0x6'))(_0x90af('0x7'));var config=require(_0x90af('0x8'));var jayson=require(_0x90af('0x9'));var client=jayson[_0x90af('0xa')][_0x90af('0xb')]({'port':0x232a});config[_0x90af('0xc')]=_[_0x90af('0xd')](config['redis'],{'host':_0x90af('0xe'),'port':0x18eb});var socket=require(_0x90af('0xf'))(new Redis(config[_0x90af('0xc')]));require('./faxQueue.socket')[_0x90af('0x10')](socket);function respondWithRpcPromise(_0x552330,_0x138b9d,_0x483212){return new BPromise(function(_0x3ea300,_0x4a1239){return client[_0x90af('0x11')](_0x552330,_0x483212)[_0x90af('0x12')](function(_0x30a378){logger['info'](_0x90af('0x13'),_0x138b9d,_0x90af('0x14'));logger[_0x90af('0x15')](_0x90af('0x16'),_0x138b9d,'request\x20sent',JSON['stringify'](_0x30a378));if(_0x30a378[_0x90af('0x17')]){if(_0x30a378[_0x90af('0x17')][_0x90af('0x18')]===0x1f4){logger[_0x90af('0x17')]('FaxQueue,\x20%s,\x20%s',_0x138b9d,_0x30a378[_0x90af('0x17')][_0x90af('0x19')]);return _0x4a1239(_0x30a378['error'][_0x90af('0x19')]);}logger['error'](_0x90af('0x13'),_0x138b9d,_0x30a378['error']['message']);return _0x3ea300(_0x30a378['error'][_0x90af('0x19')]);}else{logger[_0x90af('0x1a')](_0x90af('0x13'),_0x138b9d,'request\x20sent');_0x3ea300(_0x30a378[_0x90af('0x1b')][_0x90af('0x19')]);}})[_0x90af('0x1c')](function(_0x2a80c8){logger['error'](_0x90af('0x13'),_0x138b9d,_0x2a80c8);_0x4a1239(_0x2a80c8);});});}exports[_0x90af('0x1d')]=function(_0x27b020){var _0x195e1b=this;return new Promise(function(_0x5714ea,_0x4074a3){return db[_0x90af('0x1e')][_0x90af('0x1f')]({'raw':_0x27b020[_0x90af('0x20')]?_0x27b020['options'][_0x90af('0x21')]===undefined?!![]:![]:!![],'where':_0x27b020[_0x90af('0x20')]?_0x27b020['options'][_0x90af('0x22')]||null:null,'attributes':_0x27b020[_0x90af('0x20')]?_0x27b020[_0x90af('0x20')]['attributes']||null:null,'limit':_0x27b020[_0x90af('0x20')]?_0x27b020['options'][_0x90af('0x23')]||null:null,'include':_0x27b020['options']?_0x27b020[_0x90af('0x20')][_0x90af('0x24')]?_['map'](_0x27b020[_0x90af('0x20')][_0x90af('0x24')],function(_0x32149a){return{'model':db[_0x32149a['model']],'as':_0x32149a['as'],'attributes':_0x32149a['attributes'],'include':_0x32149a[_0x90af('0x24')]?_['map'](_0x32149a[_0x90af('0x24')],function(_0x3a8cb4){return{'model':db[_0x3a8cb4[_0x90af('0x25')]],'as':_0x3a8cb4['as'],'attributes':_0x3a8cb4[_0x90af('0x26')],'include':_0x3a8cb4[_0x90af('0x24')]?_[_0x90af('0x27')](_0x3a8cb4[_0x90af('0x24')],function(_0x3ba3d2){return{'model':db[_0x3ba3d2[_0x90af('0x25')]],'as':_0x3ba3d2['as'],'attributes':_0x3ba3d2[_0x90af('0x26')]};}):[]};}):[]};}):[]:[]})[_0x90af('0x12')](function(_0x1fe68b){logger[_0x90af('0x1a')](_0x90af('0x1d'),_0x27b020);logger[_0x90af('0x15')]('GetFaxQueue',_0x27b020,JSON[_0x90af('0x28')](_0x1fe68b));_0x5714ea(_0x1fe68b);})['catch'](function(_0x914a3d){logger[_0x90af('0x17')]('GetFaxQueue',_0x914a3d[_0x90af('0x19')],_0x27b020);_0x4074a3(_0x195e1b['error'](0x1f4,_0x914a3d[_0x90af('0x19')]));});});};exports['ShowFaxQueue']=function(_0x1b5b53){var _0x5be13b=this;return new Promise(function(_0x3b665d,_0xc47eae){return db[_0x90af('0x1e')]['find']({'raw':_0x1b5b53['options']?_0x1b5b53[_0x90af('0x20')][_0x90af('0x21')]===undefined?!![]:![]:!![],'where':_0x1b5b53[_0x90af('0x20')]?_0x1b5b53['options']['where']||null:null,'attributes':_0x1b5b53[_0x90af('0x20')]?_0x1b5b53[_0x90af('0x20')][_0x90af('0x26')]||null:null,'include':_0x1b5b53[_0x90af('0x20')]?_0x1b5b53['options']['include']?_[_0x90af('0x27')](_0x1b5b53[_0x90af('0x20')][_0x90af('0x24')],function(_0x1ff63b){return{'model':db[_0x1ff63b[_0x90af('0x25')]],'as':_0x1ff63b['as'],'attributes':_0x1ff63b[_0x90af('0x26')],'include':_0x1ff63b[_0x90af('0x24')]?_['map'](_0x1ff63b[_0x90af('0x24')],function(_0x1a02b5){return{'model':db[_0x1a02b5['model']],'as':_0x1a02b5['as'],'attributes':_0x1a02b5[_0x90af('0x26')],'include':_0x1a02b5[_0x90af('0x24')]?_[_0x90af('0x27')](_0x1a02b5[_0x90af('0x24')],function(_0x425472){return{'model':db[_0x425472['model']],'as':_0x425472['as'],'attributes':_0x425472[_0x90af('0x26')]};}):[]};}):[]};}):[]:[]})[_0x90af('0x12')](function(_0x3d6584){logger[_0x90af('0x1a')](_0x90af('0x29'),_0x1b5b53);logger['debug']('ShowFaxQueue',_0x1b5b53,JSON['stringify'](_0x3d6584));_0x3b665d(_0x3d6584);})[_0x90af('0x1c')](function(_0x21ee73){logger[_0x90af('0x17')](_0x90af('0x29'),_0x21ee73[_0x90af('0x19')],_0x1b5b53);_0xc47eae(_0x5be13b[_0x90af('0x17')](0x1f4,_0x21ee73[_0x90af('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index fc097b7..527bb74 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 _0x91cc=['./faxQueue.events','save','remove','emit','removeListener','register','length','faxQueue:'];(function(_0x1985f9,_0x27ab82){var _0x292c1f=function(_0x37f57c){while(--_0x37f57c){_0x1985f9['push'](_0x1985f9['shift']());}};_0x292c1f(++_0x27ab82);}(_0x91cc,0x128));var _0xc91c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x91cc[_0x4243a3];return _0x1b2a33;};'use strict';var FaxQueueEvents=require(_0xc91c('0x0'));var events=[_0xc91c('0x1'),_0xc91c('0x2'),'update'];function createListener(_0x514c73,_0x485c21){return function(_0x2e302e){_0x485c21[_0xc91c('0x3')](_0x514c73,_0x2e302e);};}function removeListener(_0x1e493f,_0xb36ed0){return function(){FaxQueueEvents[_0xc91c('0x4')](_0x1e493f,_0xb36ed0);};}exports[_0xc91c('0x5')]=function(_0x53407f){for(var _0x4dc1c4=0x0,_0x4977a2=events[_0xc91c('0x6')];_0x4dc1c4<_0x4977a2;_0x4dc1c4++){var _0x3d3b3e=events[_0x4dc1c4];var _0xa15b1=createListener(_0xc91c('0x7')+_0x3d3b3e,_0x53407f);FaxQueueEvents['on'](_0x3d3b3e,_0xa15b1);}}; \ No newline at end of file +var _0x4a1d=['save','remove','removeListener','length','faxQueue:','./faxQueue.events'];(function(_0x29362,_0x111e27){var _0x206a69=function(_0x5eeadf){while(--_0x5eeadf){_0x29362['push'](_0x29362['shift']());}};_0x206a69(++_0x111e27);}(_0x4a1d,0x113));var _0xd4a1=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x4a1d[_0x278e3c];return _0x3e2d9b;};'use strict';var FaxQueueEvents=require(_0xd4a1('0x0'));var events=[_0xd4a1('0x1'),_0xd4a1('0x2'),'update'];function createListener(_0x48ce0e,_0x5aa7b2){return function(_0x4564f2){_0x5aa7b2['emit'](_0x48ce0e,_0x4564f2);};}function removeListener(_0x10e8d6,_0x30aae2){return function(){FaxQueueEvents[_0xd4a1('0x3')](_0x10e8d6,_0x30aae2);};}exports['register']=function(_0x3ccc2c){for(var _0xb5bac0=0x0,_0x5b177f=events[_0xd4a1('0x4')];_0xb5bac0<_0x5b177f;_0xb5bac0++){var _0x3a1b48=events[_0xb5bac0];var _0x4b646d=createListener(_0xd4a1('0x5')+_0x3a1b48,_0x3ccc2c);FaxQueueEvents['on'](_0x3a1b48,_0x4b646d);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 24b6ccf..2352983 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 _0x9bd9=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x8c5ebd,_0x55decc){var _0x46f257=function(_0x35d759){while(--_0x35d759){_0x8c5ebd['push'](_0x8c5ebd['shift']());}};_0x46f257(++_0x55decc);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x3cb7e8,_0xb8f77){_0x3cb7e8=_0x3cb7e8-0x0;var _0x72798f=_0x9bd9[_0x3cb7e8];return _0x72798f;};'use strict';var multer=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var path=require(_0x99bd('0x2'));var timeout=require(_0x99bd('0x3'));var express=require(_0x99bd('0x4'));var router=express[_0x99bd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x99bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99bd('0x7'));var controller=require(_0x99bd('0x8'));router['get']('/',auth[_0x99bd('0x9')](),controller[_0x99bd('0xa')]);router[_0x99bd('0xb')](_0x99bd('0xc'),auth[_0x99bd('0x9')](),controller[_0x99bd('0xd')]);router[_0x99bd('0xb')](_0x99bd('0xe'),auth[_0x99bd('0x9')](),controller[_0x99bd('0xf')]);router[_0x99bd('0xb')](_0x99bd('0x10'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x11')]);router['get'](_0x99bd('0x12'),auth['isAuthenticated'](),controller[_0x99bd('0x13')]);router['get'](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller['getAgents']);router[_0x99bd('0x15')]('/',auth['isAuthenticated'](),controller[_0x99bd('0x16')]);router['post'](_0x99bd('0x12'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x17')]);router['post'](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x18')]);router[_0x99bd('0x19')](_0x99bd('0xe'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x1a')]);router[_0x99bd('0x1b')](_0x99bd('0xe'),auth['isAuthenticated'](),controller[_0x99bd('0x1c')]);router[_0x99bd('0x1b')](_0x99bd('0x12'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x99bd('0x1b')](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x1d')]);module[_0x99bd('0x1e')]=router; \ No newline at end of file +var _0x4991=['addAgents','put','update','destroy','delete','/:id/teams','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams','getAgents','post','create','addTeams','/:id/users'];(function(_0x55c50d,_0x21b593){var _0x2c62f0=function(_0x1d9623){while(--_0x1d9623){_0x55c50d['push'](_0x55c50d['shift']());}};_0x2c62f0(++_0x21b593);}(_0x4991,0xf7));var _0x1499=function(_0x2eb52f,_0x396d94){_0x2eb52f=_0x2eb52f-0x0;var _0x49bc71=_0x4991[_0x2eb52f];return _0x49bc71;};'use strict';var multer=require(_0x1499('0x0'));var util=require('util');var path=require(_0x1499('0x1'));var timeout=require('connect-timeout');var express=require(_0x1499('0x2'));var router=express[_0x1499('0x3')]();var fs_extra=require(_0x1499('0x4'));var auth=require(_0x1499('0x5'));var interaction=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var controller=require(_0x1499('0x8'));router[_0x1499('0x9')]('/',auth['isAuthenticated'](),controller[_0x1499('0xa')]);router[_0x1499('0x9')](_0x1499('0xb'),auth[_0x1499('0xc')](),controller[_0x1499('0xd')]);router[_0x1499('0x9')](_0x1499('0xe'),auth[_0x1499('0xc')](),controller['show']);router[_0x1499('0x9')](_0x1499('0xf'),auth['isAuthenticated'](),controller[_0x1499('0x10')]);router[_0x1499('0x9')]('/:id/teams',auth[_0x1499('0xc')](),controller[_0x1499('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x1499('0x12')]);router[_0x1499('0x13')]('/',auth[_0x1499('0xc')](),controller[_0x1499('0x14')]);router[_0x1499('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1499('0x15')]);router['post'](_0x1499('0x16'),auth[_0x1499('0xc')](),controller[_0x1499('0x17')]);router[_0x1499('0x18')]('/:id',auth[_0x1499('0xc')](),controller[_0x1499('0x19')]);router['delete'](_0x1499('0xe'),auth[_0x1499('0xc')](),controller[_0x1499('0x1a')]);router[_0x1499('0x1b')](_0x1499('0x1c'),auth[_0x1499('0xc')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x1499('0xc')](),controller[_0x1499('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 1b30e2b..0e903a2 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 _0x6746=['moment','sequelize','exports','STRING','DATE'];(function(_0x4d230b,_0x41c466){var _0x31478a=function(_0x539c09){while(--_0x539c09){_0x4d230b['push'](_0x4d230b['shift']());}};_0x31478a(++_0x41c466);}(_0x6746,0xb9));var _0x6674=function(_0x6b6340,_0x6302c4){_0x6b6340=_0x6b6340-0x0;var _0x3609bf=_0x6746[_0x6b6340];return _0x3609bf;};'use strict';var moment=require(_0x6674('0x0'));var Sequelize=require(_0x6674('0x1'));module[_0x6674('0x2')]={'uniqueid':{'type':Sequelize[_0x6674('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6674('0x4')]},'acceptAt':{'type':Sequelize[_0x6674('0x4')]},'exitAt':{'type':Sequelize[_0x6674('0x4')]},'reason':{'type':Sequelize[_0x6674('0x3')]}}; \ No newline at end of file +var _0xef30=['moment','sequelize','exports','STRING','DATE'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0xef30,0x118));var _0x0ef3=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0xef30[_0x3e8270];return _0x1ccde9;};'use strict';var moment=require(_0x0ef3('0x0'));var Sequelize=require(_0x0ef3('0x1'));module[_0x0ef3('0x2')]={'uniqueid':{'type':Sequelize[_0x0ef3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0ef3('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0ef3('0x4')]},'acceptAt':{'type':Sequelize[_0x0ef3('0x4')]},'exitAt':{'type':Sequelize[_0x0ef3('0x4')]},'reason':{'type':Sequelize[_0x0ef3('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 38f6128..16ea8b6 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 _0x9879=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x47af37,_0x10c182){var _0x1e027e=function(_0x545130){while(--_0x545130){_0x47af37['push'](_0x47af37['shift']());}};_0x1e027e(++_0x10c182);}(_0x9879,0x98));var _0x9987=function(_0x4c53d1,_0x4c808b){_0x4c53d1=_0x4c53d1-0x0;var _0x2a2638=_0x9879[_0x4c53d1];return _0x2a2638;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9987('0x0'));var zipdir=require(_0x9987('0x1'));var jsonpatch=require(_0x9987('0x2'));var rp=require(_0x9987('0x3'));var moment=require(_0x9987('0x4'));var BPromise=require(_0x9987('0x5'));var Mustache=require(_0x9987('0x6'));var util=require(_0x9987('0x7'));var path=require(_0x9987('0x8'));var sox=require(_0x9987('0x9'));var csv=require(_0x9987('0xa'));var ejs=require(_0x9987('0xb'));var fs=require('fs');var fs_extra=require(_0x9987('0xc'));var _=require(_0x9987('0xd'));var squel=require(_0x9987('0xe'));var crypto=require('crypto');var jsforce=require(_0x9987('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9987('0x10'));var Papa=require('papaparse');var Redis=require(_0x9987('0x11'));var authService=require(_0x9987('0x12'));var qs=require(_0x9987('0x13'));var as=require(_0x9987('0x14'));var hardwareService=require(_0x9987('0x15'));var logger=require(_0x9987('0x16'))(_0x9987('0x17'));var utils=require(_0x9987('0x18'));var config=require(_0x9987('0x19'));var licenseUtil=require(_0x9987('0x1a'));var db=require(_0x9987('0x1b'))['db'];function respondWithStatusCode(_0x2c353c,_0x4c91e3){_0x4c91e3=_0x4c91e3||0xcc;return function(_0x24a42b){if(_0x24a42b){return _0x2c353c[_0x9987('0x1c')](_0x4c91e3);}return _0x2c353c[_0x9987('0x1d')](_0x4c91e3)[_0x9987('0x1e')]();};}function respondWithResult(_0x1d66fe,_0x99976){_0x99976=_0x99976||0xc8;return function(_0x40cd6c){if(_0x40cd6c){return _0x1d66fe[_0x9987('0x1d')](_0x99976)[_0x9987('0x1f')](_0x40cd6c);}};}function respondWithFilteredResult(_0x1fcddb,_0x211574){return function(_0x383996){if(_0x383996){var _0x598a6f=typeof _0x211574['offset']===_0x9987('0x20')&&typeof _0x211574[_0x9987('0x21')]===_0x9987('0x20');var _0x38df2b=_0x383996[_0x9987('0x22')];var _0x563b33=_0x598a6f?0x0:_0x211574[_0x9987('0x23')];var _0x30cef2=_0x598a6f?_0x383996[_0x9987('0x22')]:_0x211574[_0x9987('0x23')]+_0x211574[_0x9987('0x21')];var _0x185842;if(_0x30cef2>=_0x38df2b){_0x30cef2=_0x38df2b;_0x185842=0xc8;}else{_0x185842=0xce;}_0x1fcddb[_0x9987('0x1d')](_0x185842);return _0x1fcddb['set'](_0x9987('0x24'),_0x563b33+'-'+_0x30cef2+'/'+_0x38df2b)[_0x9987('0x1f')](_0x383996);}return null;};}function patchUpdates(_0x5c4035){return function(_0x5b2adb){try{jsonpatch[_0x9987('0x25')](_0x5b2adb,_0x5c4035,!![]);}catch(_0x579341){return BPromise['reject'](_0x579341);}return _0x5b2adb[_0x9987('0x26')]();};}function saveUpdates(_0xd18e1f,_0x3deea2){return function(_0x1fcec7){if(_0x1fcec7){return _0x1fcec7[_0x9987('0x27')](_0xd18e1f)[_0x9987('0x28')](function(_0x5c2c13){return _0x5c2c13;});}return null;};}function removeEntity(_0x3c62e4,_0x2fe4b6){return function(_0x10b59c){if(_0x10b59c){return _0x10b59c[_0x9987('0x29')]()['then'](function(){_0x3c62e4[_0x9987('0x1d')](0xcc)[_0x9987('0x1e')]();});}};}function handleEntityNotFound(_0x490475,_0x5ebf79){return function(_0x27fa51){if(!_0x27fa51){_0x490475[_0x9987('0x1c')](0x194);}return _0x27fa51;};}function handleError(_0x5de1d0,_0xb0f9db){_0xb0f9db=_0xb0f9db||0x1f4;return function(_0x2e7059){logger[_0x9987('0x2a')](_0x2e7059[_0x9987('0x2b')]);if(_0x2e7059[_0x9987('0x2c')]){delete _0x2e7059[_0x9987('0x2c')];}_0x5de1d0[_0x9987('0x1d')](_0xb0f9db)[_0x9987('0x2d')](_0x2e7059);};}exports['index']=function(_0x5a86d2,_0x3606cd){var _0x40248f={},_0x26670f={},_0x4edecd={'count':0x0,'rows':[]};var _0x482d99=_[_0x9987('0x2e')](db[_0x9987('0x2f')][_0x9987('0x30')],function(_0x3807e5){return{'name':_0x3807e5[_0x9987('0x31')],'type':_0x3807e5['type'][_0x9987('0x32')]};});_0x26670f['model']=_['map'](_0x482d99,'name');_0x26670f[_0x9987('0x33')]=_[_0x9987('0x34')](_0x5a86d2[_0x9987('0x33')]);_0x26670f[_0x9987('0x35')]=_[_0x9987('0x36')](_0x26670f[_0x9987('0x37')],_0x26670f[_0x9987('0x33')]);_0x40248f[_0x9987('0x38')]=_[_0x9987('0x36')](_0x26670f[_0x9987('0x37')],qs[_0x9987('0x39')](_0x5a86d2[_0x9987('0x33')]['fields']));_0x40248f[_0x9987('0x38')]=_0x40248f[_0x9987('0x38')][_0x9987('0x3a')]?_0x40248f[_0x9987('0x38')]:_0x26670f[_0x9987('0x37')];if(!_0x5a86d2[_0x9987('0x33')][_0x9987('0x3b')]('nolimit')){_0x40248f[_0x9987('0x21')]=qs[_0x9987('0x21')](_0x5a86d2[_0x9987('0x33')][_0x9987('0x21')]);_0x40248f[_0x9987('0x23')]=qs[_0x9987('0x23')](_0x5a86d2[_0x9987('0x33')]['offset']);}_0x40248f['order']=qs['sort'](_0x5a86d2[_0x9987('0x33')][_0x9987('0x3c')]);_0x40248f[_0x9987('0x3d')]=qs[_0x9987('0x35')](_[_0x9987('0x3e')](_0x5a86d2[_0x9987('0x33')],_0x26670f[_0x9987('0x35')]),_0x482d99);if(_0x5a86d2['query'][_0x9987('0x3f')]){_0x40248f[_0x9987('0x3d')]=_['merge'](_0x40248f[_0x9987('0x3d')],{'$or':_[_0x9987('0x2e')](_0x482d99,function(_0x5d6d70){if(_0x5d6d70[_0x9987('0x40')]!==_0x9987('0x41')){var _0x4f445c={};_0x4f445c[_0x5d6d70[_0x9987('0x2c')]]={'$like':'%'+_0x5a86d2[_0x9987('0x33')][_0x9987('0x3f')]+'%'};return _0x4f445c;}})});}_0x40248f=_[_0x9987('0x42')]({},_0x40248f,_0x5a86d2['options']);var _0x481e9d={'where':_0x40248f[_0x9987('0x3d')]};return db[_0x9987('0x2f')]['count'](_0x481e9d)[_0x9987('0x28')](function(_0x1feb50){_0x4edecd[_0x9987('0x22')]=_0x1feb50;if(_0x5a86d2[_0x9987('0x33')][_0x9987('0x43')]){_0x40248f[_0x9987('0x44')]=[{'all':!![]}];}return db[_0x9987('0x2f')][_0x9987('0x45')](_0x40248f);})['then'](function(_0xcbaf54){_0x4edecd[_0x9987('0x46')]=_0xcbaf54;return _0x4edecd;})['then'](respondWithFilteredResult(_0x3606cd,_0x40248f))[_0x9987('0x47')](handleError(_0x3606cd,null));};exports['show']=function(_0x1bd44e,_0x3b3720){var _0xbc37dd={'raw':!![],'where':{'id':_0x1bd44e[_0x9987('0x48')]['id']}},_0x157213={};_0x157213[_0x9987('0x37')]=_['keys'](db[_0x9987('0x2f')]['rawAttributes']);_0x157213[_0x9987('0x33')]=_[_0x9987('0x34')](_0x1bd44e[_0x9987('0x33')]);_0x157213[_0x9987('0x35')]=_['intersection'](_0x157213['model'],_0x157213[_0x9987('0x33')]);_0xbc37dd['attributes']=_['intersection'](_0x157213[_0x9987('0x37')],qs[_0x9987('0x39')](_0x1bd44e[_0x9987('0x33')]['fields']));_0xbc37dd[_0x9987('0x38')]=_0xbc37dd['attributes'][_0x9987('0x3a')]?_0xbc37dd[_0x9987('0x38')]:_0x157213['model'];if(_0x1bd44e[_0x9987('0x33')][_0x9987('0x43')]){_0xbc37dd[_0x9987('0x44')]=[{'all':!![]}];}_0xbc37dd=_[_0x9987('0x42')]({},_0xbc37dd,_0x1bd44e[_0x9987('0x49')]);return db['FaxQueueReport'][_0x9987('0x4a')](_0xbc37dd)['then'](handleEntityNotFound(_0x3b3720,null))[_0x9987('0x28')](respondWithResult(_0x3b3720,null))['catch'](handleError(_0x3b3720,null));};exports[_0x9987('0x4b')]=function(_0x4c3b78,_0x593e3a){return db['FaxQueueReport'][_0x9987('0x4b')](_0x4c3b78[_0x9987('0x4c')],{})[_0x9987('0x28')](respondWithResult(_0x593e3a,0xc9))['catch'](handleError(_0x593e3a,null));};exports[_0x9987('0x27')]=function(_0x5adaea,_0x282300){if(_0x5adaea[_0x9987('0x4c')]['id']){delete _0x5adaea[_0x9987('0x4c')]['id'];}return db['FaxQueueReport'][_0x9987('0x4a')]({'where':{'id':_0x5adaea[_0x9987('0x48')]['id']}})[_0x9987('0x28')](handleEntityNotFound(_0x282300,null))[_0x9987('0x28')](saveUpdates(_0x5adaea[_0x9987('0x4c')],null))['then'](respondWithResult(_0x282300,null))[_0x9987('0x47')](handleError(_0x282300,null));};exports[_0x9987('0x29')]=function(_0x27da49,_0xcb87ce){return db[_0x9987('0x2f')]['find']({'where':{'id':_0x27da49[_0x9987('0x48')]['id']}})[_0x9987('0x28')](handleEntityNotFound(_0xcb87ce,null))['then'](removeEntity(_0xcb87ce,null))[_0x9987('0x47')](handleError(_0xcb87ce,null));};exports[_0x9987('0x4d')]=function(_0x248cca,_0x23f759){return db[_0x9987('0x2f')]['describe']()[_0x9987('0x28')](respondWithResult(_0x23f759,null))[_0x9987('0x47')](handleError(_0x23f759,null));}; \ No newline at end of file +var _0xe58a=['include','findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','stack','name','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x37b32b,_0x3a8bfb){var _0x2c9ed0=function(_0x45ef28){while(--_0x45ef28){_0x37b32b['push'](_0x37b32b['shift']());}};_0x2c9ed0(++_0x3a8bfb);}(_0xe58a,0x9f));var _0xae58=function(_0x291cca,_0x55d36f){_0x291cca=_0x291cca-0x0;var _0x3c240c=_0xe58a[_0x291cca];return _0x3c240c;};'use strict';var emlformat=require(_0xae58('0x0'));var rimraf=require(_0xae58('0x1'));var zipdir=require(_0xae58('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae58('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xae58('0x4'));var util=require('util');var path=require('path');var sox=require(_0xae58('0x5'));var csv=require('to-csv');var ejs=require(_0xae58('0x6'));var fs=require('fs');var fs_extra=require(_0xae58('0x7'));var _=require(_0xae58('0x8'));var squel=require(_0xae58('0x9'));var crypto=require(_0xae58('0xa'));var jsforce=require(_0xae58('0xb'));var deskjs=require(_0xae58('0xc'));var toCsv=require(_0xae58('0xd'));var querystring=require(_0xae58('0xe'));var Papa=require(_0xae58('0xf'));var Redis=require('ioredis');var authService=require(_0xae58('0x10'));var qs=require(_0xae58('0x11'));var as=require(_0xae58('0x12'));var hardwareService=require(_0xae58('0x13'));var logger=require(_0xae58('0x14'))('api');var utils=require(_0xae58('0x15'));var config=require(_0xae58('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xae58('0x17'))['db'];function respondWithStatusCode(_0x574c0d,_0x3a0ce7){_0x3a0ce7=_0x3a0ce7||0xcc;return function(_0x819a8b){if(_0x819a8b){return _0x574c0d[_0xae58('0x18')](_0x3a0ce7);}return _0x574c0d[_0xae58('0x19')](_0x3a0ce7)['end']();};}function respondWithResult(_0x36ee75,_0x52503a){_0x52503a=_0x52503a||0xc8;return function(_0x54f59c){if(_0x54f59c){return _0x36ee75[_0xae58('0x19')](_0x52503a)[_0xae58('0x1a')](_0x54f59c);}};}function respondWithFilteredResult(_0x144e48,_0x12642f){return function(_0x4c57b9){if(_0x4c57b9){var _0x13f61e=typeof _0x12642f[_0xae58('0x1b')]===_0xae58('0x1c')&&typeof _0x12642f[_0xae58('0x1d')]==='undefined';var _0x4dcadf=_0x4c57b9[_0xae58('0x1e')];var _0x3d9b06=_0x13f61e?0x0:_0x12642f[_0xae58('0x1b')];var _0x252488=_0x13f61e?_0x4c57b9[_0xae58('0x1e')]:_0x12642f['offset']+_0x12642f[_0xae58('0x1d')];var _0x3802cc;if(_0x252488>=_0x4dcadf){_0x252488=_0x4dcadf;_0x3802cc=0xc8;}else{_0x3802cc=0xce;}_0x144e48[_0xae58('0x19')](_0x3802cc);return _0x144e48[_0xae58('0x1f')](_0xae58('0x20'),_0x3d9b06+'-'+_0x252488+'/'+_0x4dcadf)[_0xae58('0x1a')](_0x4c57b9);}return null;};}function patchUpdates(_0x3b7fc4){return function(_0x367130){try{jsonpatch[_0xae58('0x21')](_0x367130,_0x3b7fc4,!![]);}catch(_0x544768){return BPromise['reject'](_0x544768);}return _0x367130[_0xae58('0x22')]();};}function saveUpdates(_0x598499,_0x3f199e){return function(_0x4da705){if(_0x4da705){return _0x4da705[_0xae58('0x23')](_0x598499)[_0xae58('0x24')](function(_0x128fd4){return _0x128fd4;});}return null;};}function removeEntity(_0x2ace7f,_0x41d2f2){return function(_0x569f07){if(_0x569f07){return _0x569f07[_0xae58('0x25')]()[_0xae58('0x24')](function(){_0x2ace7f[_0xae58('0x19')](0xcc)[_0xae58('0x26')]();});}};}function handleEntityNotFound(_0x557b6e,_0x2fdc7a){return function(_0x567c8b){if(!_0x567c8b){_0x557b6e['sendStatus'](0x194);}return _0x567c8b;};}function handleError(_0x2b1fff,_0x4e5bd5){_0x4e5bd5=_0x4e5bd5||0x1f4;return function(_0x2c3876){logger['error'](_0x2c3876[_0xae58('0x27')]);if(_0x2c3876[_0xae58('0x28')]){delete _0x2c3876[_0xae58('0x28')];}_0x2b1fff['status'](_0x4e5bd5)['send'](_0x2c3876);};}exports['index']=function(_0x5049de,_0x2afd0e){var _0x5b6505={},_0x551755={},_0xbefe7c={'count':0x0,'rows':[]};var _0x16dc96=_[_0xae58('0x29')](db[_0xae58('0x2a')][_0xae58('0x2b')],function(_0x5eaea4){return{'name':_0x5eaea4[_0xae58('0x2c')],'type':_0x5eaea4[_0xae58('0x2d')][_0xae58('0x2e')]};});_0x551755[_0xae58('0x2f')]=_[_0xae58('0x29')](_0x16dc96,_0xae58('0x28'));_0x551755[_0xae58('0x30')]=_[_0xae58('0x31')](_0x5049de[_0xae58('0x30')]);_0x551755[_0xae58('0x32')]=_[_0xae58('0x33')](_0x551755[_0xae58('0x2f')],_0x551755['query']);_0x5b6505[_0xae58('0x34')]=_[_0xae58('0x33')](_0x551755[_0xae58('0x2f')],qs[_0xae58('0x35')](_0x5049de[_0xae58('0x30')]['fields']));_0x5b6505[_0xae58('0x34')]=_0x5b6505[_0xae58('0x34')]['length']?_0x5b6505[_0xae58('0x34')]:_0x551755[_0xae58('0x2f')];if(!_0x5049de[_0xae58('0x30')][_0xae58('0x36')]('nolimit')){_0x5b6505[_0xae58('0x1d')]=qs['limit'](_0x5049de[_0xae58('0x30')][_0xae58('0x1d')]);_0x5b6505[_0xae58('0x1b')]=qs[_0xae58('0x1b')](_0x5049de['query'][_0xae58('0x1b')]);}_0x5b6505['order']=qs[_0xae58('0x37')](_0x5049de[_0xae58('0x30')]['sort']);_0x5b6505['where']=qs[_0xae58('0x32')](_[_0xae58('0x38')](_0x5049de['query'],_0x551755[_0xae58('0x32')]),_0x16dc96);if(_0x5049de[_0xae58('0x30')][_0xae58('0x39')]){_0x5b6505[_0xae58('0x3a')]=_[_0xae58('0x3b')](_0x5b6505['where'],{'$or':_[_0xae58('0x29')](_0x16dc96,function(_0x5e6ec3){if(_0x5e6ec3[_0xae58('0x2d')]!==_0xae58('0x3c')){var _0x140f2d={};_0x140f2d[_0x5e6ec3[_0xae58('0x28')]]={'$like':'%'+_0x5049de[_0xae58('0x30')][_0xae58('0x39')]+'%'};return _0x140f2d;}})});}_0x5b6505=_[_0xae58('0x3b')]({},_0x5b6505,_0x5049de[_0xae58('0x3d')]);var _0xdbe20d={'where':_0x5b6505[_0xae58('0x3a')]};return db[_0xae58('0x2a')][_0xae58('0x1e')](_0xdbe20d)[_0xae58('0x24')](function(_0x383aeb){_0xbefe7c[_0xae58('0x1e')]=_0x383aeb;if(_0x5049de[_0xae58('0x30')][_0xae58('0x3e')]){_0x5b6505[_0xae58('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xae58('0x40')](_0x5b6505);})['then'](function(_0x1d4276){_0xbefe7c[_0xae58('0x41')]=_0x1d4276;return _0xbefe7c;})['then'](respondWithFilteredResult(_0x2afd0e,_0x5b6505))[_0xae58('0x42')](handleError(_0x2afd0e,null));};exports[_0xae58('0x43')]=function(_0x461dfe,_0xcd7d92){var _0x4f1039={'raw':!![],'where':{'id':_0x461dfe['params']['id']}},_0x58b242={};_0x58b242['model']=_[_0xae58('0x31')](db[_0xae58('0x2a')]['rawAttributes']);_0x58b242[_0xae58('0x30')]=_['keys'](_0x461dfe[_0xae58('0x30')]);_0x58b242[_0xae58('0x32')]=_[_0xae58('0x33')](_0x58b242[_0xae58('0x2f')],_0x58b242['query']);_0x4f1039['attributes']=_[_0xae58('0x33')](_0x58b242['model'],qs[_0xae58('0x35')](_0x461dfe[_0xae58('0x30')]['fields']));_0x4f1039[_0xae58('0x34')]=_0x4f1039[_0xae58('0x34')][_0xae58('0x44')]?_0x4f1039[_0xae58('0x34')]:_0x58b242[_0xae58('0x2f')];if(_0x461dfe[_0xae58('0x30')][_0xae58('0x3e')]){_0x4f1039[_0xae58('0x3f')]=[{'all':!![]}];}_0x4f1039=_['merge']({},_0x4f1039,_0x461dfe[_0xae58('0x3d')]);return db[_0xae58('0x2a')][_0xae58('0x45')](_0x4f1039)[_0xae58('0x24')](handleEntityNotFound(_0xcd7d92,null))[_0xae58('0x24')](respondWithResult(_0xcd7d92,null))[_0xae58('0x42')](handleError(_0xcd7d92,null));};exports[_0xae58('0x46')]=function(_0x33d1c0,_0x3a44e1){return db[_0xae58('0x2a')][_0xae58('0x46')](_0x33d1c0[_0xae58('0x47')],{})[_0xae58('0x24')](respondWithResult(_0x3a44e1,0xc9))[_0xae58('0x42')](handleError(_0x3a44e1,null));};exports[_0xae58('0x23')]=function(_0x51d068,_0x384d93){if(_0x51d068['body']['id']){delete _0x51d068[_0xae58('0x47')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x51d068['params']['id']}})[_0xae58('0x24')](handleEntityNotFound(_0x384d93,null))[_0xae58('0x24')](saveUpdates(_0x51d068['body'],null))['then'](respondWithResult(_0x384d93,null))['catch'](handleError(_0x384d93,null));};exports[_0xae58('0x25')]=function(_0x306a05,_0xafe83c){return db[_0xae58('0x2a')]['find']({'where':{'id':_0x306a05[_0xae58('0x48')]['id']}})[_0xae58('0x24')](handleEntityNotFound(_0xafe83c,null))[_0xae58('0x24')](removeEntity(_0xafe83c,null))[_0xae58('0x42')](handleError(_0xafe83c,null));};exports[_0xae58('0x49')]=function(_0x22fec7,_0x6d677c){return db[_0xae58('0x2a')][_0xae58('0x49')]()[_0xae58('0x24')](respondWithResult(_0x6d677c,null))[_0xae58('0x42')](handleError(_0x6d677c,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1c5a5c3..33c0fc2 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x814b,0x1a2));var _0xb814=function(_0x24a654,_0x2ca441){_0x24a654=_0x24a654-0x0;var _0x458651=_0x814b[_0x24a654];return _0x458651;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x462344,_0x18dd96){var _0x316138=function(_0x4d8a26){while(--_0x4d8a26){_0x462344['push'](_0x462344['shift']());}};_0x316138(++_0x18dd96);}(_0xf494,0x1c6));var _0x4f49=function(_0x2b551e,_0x28680f){_0x2b551e=_0x2b551e-0x0;var _0x230318=_0xf494[_0x2b551e];return _0x230318;};'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 diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 5e154e5..3970ae4 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 _0xdae4=['../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','debug','stringify','UpdateFaxQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x32c395,_0x1567bf){var _0x4da5d1=function(_0x4a3c3c){while(--_0x4a3c3c){_0x32c395['push'](_0x32c395['shift']());}};_0x4da5d1(++_0x1567bf);}(_0xdae4,0x1e8));var _0x4dae=function(_0x1ea580,_0x33fa1d){_0x1ea580=_0x1ea580-0x0;var _0x16d4c1=_0xdae4[_0x1ea580];return _0x16d4c1;};'use strict';var _=require(_0x4dae('0x0'));var util=require(_0x4dae('0x1'));var moment=require(_0x4dae('0x2'));var BPromise=require(_0x4dae('0x3'));var rs=require(_0x4dae('0x4'));var fs=require('fs');var Redis=require(_0x4dae('0x5'));var db=require(_0x4dae('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4dae('0x7'))(_0x4dae('0x8'));var config=require('../../config/environment');var jayson=require(_0x4dae('0x9'));var client=jayson['client'][_0x4dae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x104614,_0x2db37d,_0x2c64b5){return new BPromise(function(_0x529394,_0x57ae29){return client[_0x4dae('0xb')](_0x104614,_0x2c64b5)[_0x4dae('0xc')](function(_0x4d1769){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x2db37d,_0x4dae('0xd'));logger['debug'](_0x4dae('0xe'),_0x2db37d,_0x4dae('0xd'),JSON['stringify'](_0x4d1769));if(_0x4d1769[_0x4dae('0xf')]){if(_0x4d1769[_0x4dae('0xf')][_0x4dae('0x10')]===0x1f4){logger[_0x4dae('0xf')](_0x4dae('0x11'),_0x2db37d,_0x4d1769[_0x4dae('0xf')][_0x4dae('0x12')]);return _0x57ae29(_0x4d1769[_0x4dae('0xf')][_0x4dae('0x12')]);}logger[_0x4dae('0xf')](_0x4dae('0x11'),_0x2db37d,_0x4d1769['error']['message']);return _0x529394(_0x4d1769['error']['message']);}else{logger[_0x4dae('0x13')](_0x4dae('0x11'),_0x2db37d,_0x4dae('0xd'));_0x529394(_0x4d1769[_0x4dae('0x14')][_0x4dae('0x12')]);}})[_0x4dae('0x15')](function(_0x384324){logger[_0x4dae('0xf')](_0x4dae('0x11'),_0x2db37d,_0x384324);_0x57ae29(_0x384324);});});}exports[_0x4dae('0x16')]=function(_0x38cc72){var _0xf13e91=this;return new Promise(function(_0x3f1fee,_0x25d08e){return db[_0x4dae('0x17')]['create'](_0x38cc72[_0x4dae('0x18')],{'raw':_0x38cc72[_0x4dae('0x19')]?_0x38cc72['options'][_0x4dae('0x1a')]===undefined?!![]:![]:!![]})[_0x4dae('0xc')](function(_0x2fb0c6){logger[_0x4dae('0x13')](_0x4dae('0x16'),_0x38cc72);logger[_0x4dae('0x1b')](_0x4dae('0x16'),_0x38cc72,JSON[_0x4dae('0x1c')](_0x2fb0c6));_0x3f1fee(_0x2fb0c6);})[_0x4dae('0x15')](function(_0x1dfaf8){logger[_0x4dae('0xf')](_0x4dae('0x16'),_0x1dfaf8[_0x4dae('0x12')],_0x38cc72);_0x25d08e(_0xf13e91[_0x4dae('0xf')](0x1f4,_0x1dfaf8[_0x4dae('0x12')]));});});};exports[_0x4dae('0x1d')]=function(_0x3efb39){var _0xf5571b=this;return new Promise(function(_0x435c6c,_0x463610){return db[_0x4dae('0x17')][_0x4dae('0x1e')](_0x3efb39[_0x4dae('0x18')],{'raw':_0x3efb39[_0x4dae('0x19')]?_0x3efb39['options'][_0x4dae('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3efb39[_0x4dae('0x19')]?_0x3efb39['options'][_0x4dae('0x1f')]||null:null,'attributes':_0x3efb39[_0x4dae('0x19')]?_0x3efb39[_0x4dae('0x19')]['attributes']||null:null,'limit':_0x3efb39[_0x4dae('0x19')]?_0x3efb39[_0x4dae('0x19')][_0x4dae('0x20')]||null:null})[_0x4dae('0xc')](function(_0x42a2b0){logger[_0x4dae('0x13')](_0x4dae('0x1d'),_0x3efb39);logger[_0x4dae('0x1b')](_0x4dae('0x1d'),_0x3efb39,JSON[_0x4dae('0x1c')](_0x42a2b0));_0x435c6c(_0x42a2b0);})['catch'](function(_0x3c64b4){logger[_0x4dae('0xf')](_0x4dae('0x1d'),_0x3c64b4['message'],_0x3efb39);_0x463610(_0xf5571b[_0x4dae('0xf')](0x1f4,_0x3c64b4[_0x4dae('0x12')]));});});}; \ No newline at end of file +var _0x5207=['limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxQueueReport','create','body','options','raw','then','CreateFaxQueueReport','debug','UpdateFaxQueueReport','where'];(function(_0x5a39a8,_0x56de07){var _0x13bc3e=function(_0x7364b3){while(--_0x7364b3){_0x5a39a8['push'](_0x5a39a8['shift']());}};_0x13bc3e(++_0x56de07);}(_0x5207,0x89));var _0x7520=function(_0x28fa67,_0x186055){_0x28fa67=_0x28fa67-0x0;var _0x1a2d66=_0x5207[_0x28fa67];return _0x1a2d66;};'use strict';var _=require(_0x7520('0x0'));var util=require(_0x7520('0x1'));var moment=require(_0x7520('0x2'));var BPromise=require('bluebird');var rs=require(_0x7520('0x3'));var fs=require('fs');var Redis=require(_0x7520('0x4'));var db=require(_0x7520('0x5'))['db'];var utils=require(_0x7520('0x6'));var logger=require(_0x7520('0x7'))('rpc');var config=require(_0x7520('0x8'));var jayson=require(_0x7520('0x9'));var client=jayson[_0x7520('0xa')][_0x7520('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa963dd,_0x22c0e1,_0x4e457b){return new BPromise(function(_0x21b07a,_0x29a1cb){return client[_0x7520('0xc')](_0xa963dd,_0x4e457b)['then'](function(_0x5681ff){logger[_0x7520('0xd')](_0x7520('0xe'),_0x22c0e1,_0x7520('0xf'));logger['debug'](_0x7520('0x10'),_0x22c0e1,_0x7520('0xf'),JSON[_0x7520('0x11')](_0x5681ff));if(_0x5681ff['error']){if(_0x5681ff[_0x7520('0x12')][_0x7520('0x13')]===0x1f4){logger[_0x7520('0x12')](_0x7520('0xe'),_0x22c0e1,_0x5681ff['error'][_0x7520('0x14')]);return _0x29a1cb(_0x5681ff[_0x7520('0x12')][_0x7520('0x14')]);}logger[_0x7520('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x22c0e1,_0x5681ff[_0x7520('0x12')]['message']);return _0x21b07a(_0x5681ff['error'][_0x7520('0x14')]);}else{logger[_0x7520('0xd')](_0x7520('0xe'),_0x22c0e1,_0x7520('0xf'));_0x21b07a(_0x5681ff[_0x7520('0x15')]['message']);}})[_0x7520('0x16')](function(_0x4a0e94){logger[_0x7520('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x22c0e1,_0x4a0e94);_0x29a1cb(_0x4a0e94);});});}exports['CreateFaxQueueReport']=function(_0x94ce75){var _0x53543f=this;return new Promise(function(_0x256338,_0x3e0531){return db[_0x7520('0x17')][_0x7520('0x18')](_0x94ce75[_0x7520('0x19')],{'raw':_0x94ce75[_0x7520('0x1a')]?_0x94ce75['options'][_0x7520('0x1b')]===undefined?!![]:![]:!![]})[_0x7520('0x1c')](function(_0x306f71){logger['info'](_0x7520('0x1d'),_0x94ce75);logger[_0x7520('0x1e')]('CreateFaxQueueReport',_0x94ce75,JSON[_0x7520('0x11')](_0x306f71));_0x256338(_0x306f71);})['catch'](function(_0x1cb323){logger[_0x7520('0x12')](_0x7520('0x1d'),_0x1cb323['message'],_0x94ce75);_0x3e0531(_0x53543f[_0x7520('0x12')](0x1f4,_0x1cb323['message']));});});};exports[_0x7520('0x1f')]=function(_0xb2de04){var _0x3a259a=this;return new Promise(function(_0x17b18d,_0x282d65){return db[_0x7520('0x17')]['update'](_0xb2de04[_0x7520('0x19')],{'raw':_0xb2de04[_0x7520('0x1a')]?_0xb2de04[_0x7520('0x1a')][_0x7520('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb2de04[_0x7520('0x1a')]?_0xb2de04['options'][_0x7520('0x20')]||null:null,'attributes':_0xb2de04[_0x7520('0x1a')]?_0xb2de04[_0x7520('0x1a')]['attributes']||null:null,'limit':_0xb2de04['options']?_0xb2de04[_0x7520('0x1a')][_0x7520('0x21')]||null:null})['then'](function(_0x6133bc){logger['info'](_0x7520('0x1f'),_0xb2de04);logger[_0x7520('0x1e')](_0x7520('0x1f'),_0xb2de04,JSON[_0x7520('0x11')](_0x6133bc));_0x17b18d(_0x6133bc);})[_0x7520('0x16')](function(_0x4b13f9){logger[_0x7520('0x12')](_0x7520('0x1f'),_0x4b13f9[_0x7520('0x14')],_0xb2de04);_0x282d65(_0x3a259a[_0x7520('0x12')](0x1f4,_0x4b13f9[_0x7520('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 2da0e8c..680d18f 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 _0xf504=['../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x26a855,_0x845170){var _0x301785=function(_0x38d0f6){while(--_0x38d0f6){_0x26a855['push'](_0x26a855['shift']());}};_0x301785(++_0x845170);}(_0xf504,0xa2));var _0x4f50=function(_0x38a8d7,_0x38b43d){_0x38a8d7=_0x38a8d7-0x0;var _0x4b06d6=_0xf504[_0x38a8d7];return _0x4b06d6;};'use strict';var multer=require(_0x4f50('0x0'));var util=require(_0x4f50('0x1'));var path=require(_0x4f50('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4f50('0x3')]();var fs_extra=require(_0x4f50('0x4'));var auth=require(_0x4f50('0x5'));var interaction=require(_0x4f50('0x6'));var config=require(_0x4f50('0x7'));var controller=require(_0x4f50('0x8'));router[_0x4f50('0x9')]('/',auth[_0x4f50('0xa')](),controller['index']);router[_0x4f50('0x9')](_0x4f50('0xb'),auth['isAuthenticated'](),controller[_0x4f50('0xc')]);router['get']('/:id',auth[_0x4f50('0xa')](),controller[_0x4f50('0xd')]);router[_0x4f50('0xe')]('/',auth[_0x4f50('0xa')](),controller[_0x4f50('0xf')]);router[_0x4f50('0x10')](_0x4f50('0x11'),auth[_0x4f50('0xa')](),controller[_0x4f50('0x12')]);router[_0x4f50('0x13')](_0x4f50('0x11'),auth[_0x4f50('0xa')](),controller[_0x4f50('0x14')]);module['exports']=router; \ No newline at end of file +var _0xdae7=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','isAuthenticated','/:id','post'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0xdae7,0xec));var _0x7dae=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0xdae7[_0x4178af];return _0x20f4b1;};'use strict';var multer=require(_0x7dae('0x0'));var util=require(_0x7dae('0x1'));var path=require(_0x7dae('0x2'));var timeout=require(_0x7dae('0x3'));var express=require(_0x7dae('0x4'));var router=express[_0x7dae('0x5')]();var fs_extra=require(_0x7dae('0x6'));var auth=require(_0x7dae('0x7'));var interaction=require(_0x7dae('0x8'));var config=require(_0x7dae('0x9'));var controller=require(_0x7dae('0xa'));router[_0x7dae('0xb')]('/',auth['isAuthenticated'](),controller[_0x7dae('0xc')]);router[_0x7dae('0xb')]('/describe',auth[_0x7dae('0xd')](),controller['describe']);router['get'](_0x7dae('0xe'),auth[_0x7dae('0xd')](),controller['show']);router[_0x7dae('0xf')]('/',auth[_0x7dae('0xd')](),controller[_0x7dae('0x10')]);router['put'](_0x7dae('0xe'),auth['isAuthenticated'](),controller[_0x7dae('0x11')]);router[_0x7dae('0x12')](_0x7dae('0xe'),auth[_0x7dae('0xd')](),controller[_0x7dae('0x13')]);module[_0x7dae('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index a146c51..960bec7 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x52f247,_0x329e5f){var _0x48c78d=function(_0x39e788){while(--_0x39e788){_0x52f247['push'](_0x52f247['shift']());}};_0x48c78d(++_0x329e5f);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x205ffb,_0x1db835){var _0x160df5=function(_0x1535b){while(--_0x1535b){_0x205ffb['push'](_0x205ffb['shift']());}};_0x160df5(++_0x1db835);}(_0xaa88,0x137));var _0x8aa8=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0xaa88[_0x2fd160];return _0x5c2031;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 35ad0b3..fea733f 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 _0x9419=['order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','stack','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit'];(function(_0x48cb7e,_0x256d03){var _0x2771ef=function(_0xab8e63){while(--_0xab8e63){_0x48cb7e['push'](_0x48cb7e['shift']());}};_0x2771ef(++_0x256d03);}(_0x9419,0xa2));var _0x9941=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x9419[_0x4de586];return _0x46baf5;};'use strict';var emlformat=require(_0x9941('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9941('0x1'));var rp=require(_0x9941('0x2'));var moment=require('moment');var BPromise=require(_0x9941('0x3'));var Mustache=require(_0x9941('0x4'));var util=require(_0x9941('0x5'));var path=require('path');var sox=require(_0x9941('0x6'));var csv=require(_0x9941('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9941('0x8'));var squel=require(_0x9941('0x9'));var crypto=require('crypto');var jsforce=require(_0x9941('0xa'));var deskjs=require(_0x9941('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9941('0xc'));var Papa=require(_0x9941('0xd'));var Redis=require(_0x9941('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9941('0xf'));var as=require(_0x9941('0x10'));var hardwareService=require(_0x9941('0x11'));var logger=require('../../config/logger')(_0x9941('0x12'));var utils=require(_0x9941('0x13'));var config=require(_0x9941('0x14'));var licenseUtil=require(_0x9941('0x15'));var db=require(_0x9941('0x16'))['db'];function respondWithStatusCode(_0x218f1d,_0xd10195){_0xd10195=_0xd10195||0xcc;return function(_0x1c8ec8){if(_0x1c8ec8){return _0x218f1d[_0x9941('0x17')](_0xd10195);}return _0x218f1d['status'](_0xd10195)[_0x9941('0x18')]();};}function respondWithResult(_0x57984b,_0x13fe8d){_0x13fe8d=_0x13fe8d||0xc8;return function(_0x40d687){if(_0x40d687){return _0x57984b[_0x9941('0x19')](_0x13fe8d)[_0x9941('0x1a')](_0x40d687);}};}function respondWithFilteredResult(_0x5a5e4c,_0x3743f5){return function(_0x5b3888){if(_0x5b3888){var _0x45bffe=typeof _0x3743f5[_0x9941('0x1b')]===_0x9941('0x1c')&&typeof _0x3743f5['limit']==='undefined';var _0x425921=_0x5b3888['count'];var _0x5c16a7=_0x45bffe?0x0:_0x3743f5[_0x9941('0x1b')];var _0x5c3586=_0x45bffe?_0x5b3888[_0x9941('0x1d')]:_0x3743f5[_0x9941('0x1b')]+_0x3743f5['limit'];var _0x1745a4;if(_0x5c3586>=_0x425921){_0x5c3586=_0x425921;_0x1745a4=0xc8;}else{_0x1745a4=0xce;}_0x5a5e4c[_0x9941('0x19')](_0x1745a4);return _0x5a5e4c[_0x9941('0x1e')](_0x9941('0x1f'),_0x5c16a7+'-'+_0x5c3586+'/'+_0x425921)[_0x9941('0x1a')](_0x5b3888);}return null;};}function patchUpdates(_0x12d2ff){return function(_0x528a6c){try{jsonpatch[_0x9941('0x20')](_0x528a6c,_0x12d2ff,!![]);}catch(_0x334c0e){return BPromise['reject'](_0x334c0e);}return _0x528a6c['save']();};}function saveUpdates(_0xd78759,_0xa12e29){return function(_0x427978){if(_0x427978){return _0x427978[_0x9941('0x21')](_0xd78759)[_0x9941('0x22')](function(_0x425d8f){return _0x425d8f;});}return null;};}function removeEntity(_0xac6381,_0x168834){return function(_0x174dde){if(_0x174dde){return _0x174dde[_0x9941('0x23')]()[_0x9941('0x22')](function(){_0xac6381[_0x9941('0x19')](0xcc)[_0x9941('0x18')]();});}};}function handleEntityNotFound(_0x522dc6,_0x5dc918){return function(_0xbd33d4){if(!_0xbd33d4){_0x522dc6[_0x9941('0x17')](0x194);}return _0xbd33d4;};}function handleError(_0x4606e1,_0x583e33){_0x583e33=_0x583e33||0x1f4;return function(_0x4a0a39){logger['error'](_0x4a0a39[_0x9941('0x24')]);if(_0x4a0a39['name']){delete _0x4a0a39['name'];}_0x4606e1[_0x9941('0x19')](_0x583e33)['send'](_0x4a0a39);};}exports[_0x9941('0x25')]=function(_0x2ef9cd,_0xc2291d){var _0x3dce02={},_0xd85f50={},_0x1089f7={'count':0x0,'rows':[]};var _0x5796ee=_[_0x9941('0x26')](db[_0x9941('0x27')][_0x9941('0x28')],function(_0x4d58fb){return{'name':_0x4d58fb[_0x9941('0x29')],'type':_0x4d58fb[_0x9941('0x2a')]['key']};});_0xd85f50[_0x9941('0x2b')]=_[_0x9941('0x26')](_0x5796ee,_0x9941('0x2c'));_0xd85f50['query']=_[_0x9941('0x2d')](_0x2ef9cd[_0x9941('0x2e')]);_0xd85f50[_0x9941('0x2f')]=_[_0x9941('0x30')](_0xd85f50['model'],_0xd85f50['query']);_0x3dce02[_0x9941('0x31')]=_[_0x9941('0x30')](_0xd85f50[_0x9941('0x2b')],qs['fields'](_0x2ef9cd[_0x9941('0x2e')][_0x9941('0x32')]));_0x3dce02['attributes']=_0x3dce02[_0x9941('0x31')][_0x9941('0x33')]?_0x3dce02[_0x9941('0x31')]:_0xd85f50[_0x9941('0x2b')];if(!_0x2ef9cd['query'][_0x9941('0x34')]('nolimit')){_0x3dce02[_0x9941('0x35')]=qs[_0x9941('0x35')](_0x2ef9cd['query'][_0x9941('0x35')]);_0x3dce02[_0x9941('0x1b')]=qs[_0x9941('0x1b')](_0x2ef9cd[_0x9941('0x2e')][_0x9941('0x1b')]);}_0x3dce02[_0x9941('0x36')]=qs[_0x9941('0x37')](_0x2ef9cd[_0x9941('0x2e')]['sort']);_0x3dce02[_0x9941('0x38')]=qs[_0x9941('0x2f')](_['pick'](_0x2ef9cd[_0x9941('0x2e')],_0xd85f50[_0x9941('0x2f')]),_0x5796ee);if(_0x2ef9cd[_0x9941('0x2e')][_0x9941('0x39')]){_0x3dce02['where']=_[_0x9941('0x3a')](_0x3dce02['where'],{'$or':_['map'](_0x5796ee,function(_0x18e1bc){if(_0x18e1bc[_0x9941('0x2a')]!==_0x9941('0x3b')){var _0xe4d9b8={};_0xe4d9b8[_0x18e1bc[_0x9941('0x2c')]]={'$like':'%'+_0x2ef9cd[_0x9941('0x2e')][_0x9941('0x39')]+'%'};return _0xe4d9b8;}})});}_0x3dce02=_[_0x9941('0x3a')]({},_0x3dce02,_0x2ef9cd['options']);var _0x2b7aea={'where':_0x3dce02[_0x9941('0x38')]};return db['FaxTransferReport'][_0x9941('0x1d')](_0x2b7aea)['then'](function(_0x3e97df){_0x1089f7[_0x9941('0x1d')]=_0x3e97df;if(_0x2ef9cd['query'][_0x9941('0x3c')]){_0x3dce02[_0x9941('0x3d')]=[{'all':!![]}];}return db[_0x9941('0x27')][_0x9941('0x3e')](_0x3dce02);})[_0x9941('0x22')](function(_0xfc7f88){_0x1089f7[_0x9941('0x3f')]=_0xfc7f88;return _0x1089f7;})['then'](respondWithFilteredResult(_0xc2291d,_0x3dce02))['catch'](handleError(_0xc2291d,null));};exports[_0x9941('0x40')]=function(_0x126f7c,_0x1f6137){var _0x7c215b={'raw':!![],'where':{'id':_0x126f7c['params']['id']}},_0x4d566c={};_0x4d566c[_0x9941('0x2b')]=_[_0x9941('0x2d')](db[_0x9941('0x27')][_0x9941('0x28')]);_0x4d566c[_0x9941('0x2e')]=_[_0x9941('0x2d')](_0x126f7c[_0x9941('0x2e')]);_0x4d566c[_0x9941('0x2f')]=_['intersection'](_0x4d566c[_0x9941('0x2b')],_0x4d566c[_0x9941('0x2e')]);_0x7c215b['attributes']=_['intersection'](_0x4d566c[_0x9941('0x2b')],qs[_0x9941('0x32')](_0x126f7c[_0x9941('0x2e')][_0x9941('0x32')]));_0x7c215b[_0x9941('0x31')]=_0x7c215b[_0x9941('0x31')][_0x9941('0x33')]?_0x7c215b['attributes']:_0x4d566c['model'];if(_0x126f7c[_0x9941('0x2e')][_0x9941('0x3c')]){_0x7c215b[_0x9941('0x3d')]=[{'all':!![]}];}_0x7c215b=_[_0x9941('0x3a')]({},_0x7c215b,_0x126f7c[_0x9941('0x41')]);return db['FaxTransferReport'][_0x9941('0x42')](_0x7c215b)[_0x9941('0x22')](handleEntityNotFound(_0x1f6137,null))[_0x9941('0x22')](respondWithResult(_0x1f6137,null))[_0x9941('0x43')](handleError(_0x1f6137,null));};exports[_0x9941('0x44')]=function(_0x55748e,_0x2de5fe){return db['FaxTransferReport']['create'](_0x55748e[_0x9941('0x45')],{})[_0x9941('0x22')](respondWithResult(_0x2de5fe,0xc9))[_0x9941('0x43')](handleError(_0x2de5fe,null));};exports[_0x9941('0x21')]=function(_0xe320f,_0x2f3883){if(_0xe320f[_0x9941('0x45')]['id']){delete _0xe320f[_0x9941('0x45')]['id'];}return db[_0x9941('0x27')][_0x9941('0x42')]({'where':{'id':_0xe320f[_0x9941('0x46')]['id']}})[_0x9941('0x22')](handleEntityNotFound(_0x2f3883,null))[_0x9941('0x22')](saveUpdates(_0xe320f['body'],null))[_0x9941('0x22')](respondWithResult(_0x2f3883,null))['catch'](handleError(_0x2f3883,null));};exports['destroy']=function(_0x154fd2,_0x327494){return db['FaxTransferReport']['find']({'where':{'id':_0x154fd2['params']['id']}})[_0x9941('0x22')](handleEntityNotFound(_0x327494,null))[_0x9941('0x22')](removeEntity(_0x327494,null))['catch'](handleError(_0x327494,null));};exports[_0x9941('0x47')]=function(_0x4c8aee,_0x49d83b){return db[_0x9941('0x27')][_0x9941('0x47')]()['then'](respondWithResult(_0x49d83b,null))[_0x9941('0x43')](handleError(_0x49d83b,null));}; \ No newline at end of file +var _0x35fd=['rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','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/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','fields','includeAll','options','find','create','body','destroy','describe','eml-format'];(function(_0x46111d,_0x5d286b){var _0xe82586=function(_0x39551b){while(--_0x39551b){_0x46111d['push'](_0x46111d['shift']());}};_0xe82586(++_0x5d286b);}(_0x35fd,0x17b));var _0xd35f=function(_0x38b81d,_0xa12762){_0x38b81d=_0x38b81d-0x0;var _0x399584=_0x35fd[_0x38b81d];return _0x399584;};'use strict';var emlformat=require(_0xd35f('0x0'));var rimraf=require(_0xd35f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd35f('0x2'));var rp=require(_0xd35f('0x3'));var moment=require('moment');var BPromise=require(_0xd35f('0x4'));var Mustache=require('mustache');var util=require(_0xd35f('0x5'));var path=require(_0xd35f('0x6'));var sox=require(_0xd35f('0x7'));var csv=require(_0xd35f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd35f('0x9'));var _=require(_0xd35f('0xa'));var squel=require(_0xd35f('0xb'));var crypto=require('crypto');var jsforce=require(_0xd35f('0xc'));var deskjs=require(_0xd35f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd35f('0xe'));var Papa=require(_0xd35f('0xf'));var Redis=require('ioredis');var authService=require(_0xd35f('0x10'));var qs=require(_0xd35f('0x11'));var as=require(_0xd35f('0x12'));var hardwareService=require(_0xd35f('0x13'));var logger=require(_0xd35f('0x14'))(_0xd35f('0x15'));var utils=require('../../config/utils');var config=require(_0xd35f('0x16'));var licenseUtil=require(_0xd35f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cd199,_0x49ae0a){_0x49ae0a=_0x49ae0a||0xcc;return function(_0x305fe7){if(_0x305fe7){return _0x3cd199['sendStatus'](_0x49ae0a);}return _0x3cd199[_0xd35f('0x18')](_0x49ae0a)[_0xd35f('0x19')]();};}function respondWithResult(_0x32deea,_0x452326){_0x452326=_0x452326||0xc8;return function(_0x433ec7){if(_0x433ec7){return _0x32deea[_0xd35f('0x18')](_0x452326)[_0xd35f('0x1a')](_0x433ec7);}};}function respondWithFilteredResult(_0xd80655,_0x57f918){return function(_0x403eae){if(_0x403eae){var _0x4330c7=typeof _0x57f918['offset']==='undefined'&&typeof _0x57f918['limit']===_0xd35f('0x1b');var _0x517036=_0x403eae[_0xd35f('0x1c')];var _0x3d4a64=_0x4330c7?0x0:_0x57f918[_0xd35f('0x1d')];var _0x1c3b96=_0x4330c7?_0x403eae[_0xd35f('0x1c')]:_0x57f918[_0xd35f('0x1d')]+_0x57f918[_0xd35f('0x1e')];var _0x431e52;if(_0x1c3b96>=_0x517036){_0x1c3b96=_0x517036;_0x431e52=0xc8;}else{_0x431e52=0xce;}_0xd80655['status'](_0x431e52);return _0xd80655[_0xd35f('0x1f')](_0xd35f('0x20'),_0x3d4a64+'-'+_0x1c3b96+'/'+_0x517036)[_0xd35f('0x1a')](_0x403eae);}return null;};}function patchUpdates(_0x4a0794){return function(_0x21ac7a){try{jsonpatch[_0xd35f('0x21')](_0x21ac7a,_0x4a0794,!![]);}catch(_0x3a44ca){return BPromise['reject'](_0x3a44ca);}return _0x21ac7a[_0xd35f('0x22')]();};}function saveUpdates(_0x37fa2e,_0x4d239b){return function(_0x21bf3b){if(_0x21bf3b){return _0x21bf3b[_0xd35f('0x23')](_0x37fa2e)[_0xd35f('0x24')](function(_0xdd505d){return _0xdd505d;});}return null;};}function removeEntity(_0x4809a3,_0x4dd0f6){return function(_0x524821){if(_0x524821){return _0x524821['destroy']()[_0xd35f('0x24')](function(){_0x4809a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a49cf,_0x19599b){return function(_0x4bce97){if(!_0x4bce97){_0x3a49cf[_0xd35f('0x25')](0x194);}return _0x4bce97;};}function handleError(_0x4f5ca2,_0x8a0e86){_0x8a0e86=_0x8a0e86||0x1f4;return function(_0x26dd01){logger[_0xd35f('0x26')](_0x26dd01[_0xd35f('0x27')]);if(_0x26dd01[_0xd35f('0x28')]){delete _0x26dd01[_0xd35f('0x28')];}_0x4f5ca2[_0xd35f('0x18')](_0x8a0e86)[_0xd35f('0x29')](_0x26dd01);};}exports[_0xd35f('0x2a')]=function(_0x57f1ee,_0x1ad478){var _0x1d2e2c={},_0x5de1de={},_0xe872f={'count':0x0,'rows':[]};var _0x3142a0=_[_0xd35f('0x2b')](db[_0xd35f('0x2c')][_0xd35f('0x2d')],function(_0x3fee63){return{'name':_0x3fee63[_0xd35f('0x2e')],'type':_0x3fee63[_0xd35f('0x2f')]['key']};});_0x5de1de[_0xd35f('0x30')]=_['map'](_0x3142a0,_0xd35f('0x28'));_0x5de1de[_0xd35f('0x31')]=_['keys'](_0x57f1ee[_0xd35f('0x31')]);_0x5de1de[_0xd35f('0x32')]=_[_0xd35f('0x33')](_0x5de1de[_0xd35f('0x30')],_0x5de1de['query']);_0x1d2e2c[_0xd35f('0x34')]=_[_0xd35f('0x33')](_0x5de1de['model'],qs['fields'](_0x57f1ee[_0xd35f('0x31')]['fields']));_0x1d2e2c[_0xd35f('0x34')]=_0x1d2e2c[_0xd35f('0x34')][_0xd35f('0x35')]?_0x1d2e2c['attributes']:_0x5de1de['model'];if(!_0x57f1ee[_0xd35f('0x31')][_0xd35f('0x36')](_0xd35f('0x37'))){_0x1d2e2c['limit']=qs[_0xd35f('0x1e')](_0x57f1ee[_0xd35f('0x31')]['limit']);_0x1d2e2c['offset']=qs[_0xd35f('0x1d')](_0x57f1ee[_0xd35f('0x31')]['offset']);}_0x1d2e2c['order']=qs[_0xd35f('0x38')](_0x57f1ee[_0xd35f('0x31')][_0xd35f('0x38')]);_0x1d2e2c[_0xd35f('0x39')]=qs[_0xd35f('0x32')](_['pick'](_0x57f1ee[_0xd35f('0x31')],_0x5de1de[_0xd35f('0x32')]),_0x3142a0);if(_0x57f1ee[_0xd35f('0x31')][_0xd35f('0x3a')]){_0x1d2e2c['where']=_[_0xd35f('0x3b')](_0x1d2e2c['where'],{'$or':_[_0xd35f('0x2b')](_0x3142a0,function(_0x344b25){if(_0x344b25[_0xd35f('0x2f')]!==_0xd35f('0x3c')){var _0x4f97c6={};_0x4f97c6[_0x344b25[_0xd35f('0x28')]]={'$like':'%'+_0x57f1ee[_0xd35f('0x31')]['filter']+'%'};return _0x4f97c6;}})});}_0x1d2e2c=_['merge']({},_0x1d2e2c,_0x57f1ee['options']);var _0xad1495={'where':_0x1d2e2c[_0xd35f('0x39')]};return db[_0xd35f('0x2c')][_0xd35f('0x1c')](_0xad1495)[_0xd35f('0x24')](function(_0x21a085){_0xe872f[_0xd35f('0x1c')]=_0x21a085;if(_0x57f1ee[_0xd35f('0x31')]['includeAll']){_0x1d2e2c[_0xd35f('0x3d')]=[{'all':!![]}];}return db[_0xd35f('0x2c')][_0xd35f('0x3e')](_0x1d2e2c);})[_0xd35f('0x24')](function(_0x709e92){_0xe872f[_0xd35f('0x3f')]=_0x709e92;return _0xe872f;})[_0xd35f('0x24')](respondWithFilteredResult(_0x1ad478,_0x1d2e2c))[_0xd35f('0x40')](handleError(_0x1ad478,null));};exports[_0xd35f('0x41')]=function(_0x3fe6d5,_0x19372c){var _0x175132={'raw':!![],'where':{'id':_0x3fe6d5[_0xd35f('0x42')]['id']}},_0x1b8620={};_0x1b8620['model']=_[_0xd35f('0x43')](db[_0xd35f('0x2c')][_0xd35f('0x2d')]);_0x1b8620['query']=_[_0xd35f('0x43')](_0x3fe6d5['query']);_0x1b8620[_0xd35f('0x32')]=_[_0xd35f('0x33')](_0x1b8620[_0xd35f('0x30')],_0x1b8620[_0xd35f('0x31')]);_0x175132[_0xd35f('0x34')]=_[_0xd35f('0x33')](_0x1b8620[_0xd35f('0x30')],qs[_0xd35f('0x44')](_0x3fe6d5['query'][_0xd35f('0x44')]));_0x175132[_0xd35f('0x34')]=_0x175132[_0xd35f('0x34')]['length']?_0x175132['attributes']:_0x1b8620[_0xd35f('0x30')];if(_0x3fe6d5['query'][_0xd35f('0x45')]){_0x175132['include']=[{'all':!![]}];}_0x175132=_[_0xd35f('0x3b')]({},_0x175132,_0x3fe6d5[_0xd35f('0x46')]);return db[_0xd35f('0x2c')][_0xd35f('0x47')](_0x175132)[_0xd35f('0x24')](handleEntityNotFound(_0x19372c,null))['then'](respondWithResult(_0x19372c,null))[_0xd35f('0x40')](handleError(_0x19372c,null));};exports[_0xd35f('0x48')]=function(_0x389549,_0x233daa){return db[_0xd35f('0x2c')][_0xd35f('0x48')](_0x389549[_0xd35f('0x49')],{})[_0xd35f('0x24')](respondWithResult(_0x233daa,0xc9))[_0xd35f('0x40')](handleError(_0x233daa,null));};exports[_0xd35f('0x23')]=function(_0x41a8df,_0x2fd890){if(_0x41a8df[_0xd35f('0x49')]['id']){delete _0x41a8df[_0xd35f('0x49')]['id'];}return db[_0xd35f('0x2c')][_0xd35f('0x47')]({'where':{'id':_0x41a8df['params']['id']}})[_0xd35f('0x24')](handleEntityNotFound(_0x2fd890,null))[_0xd35f('0x24')](saveUpdates(_0x41a8df[_0xd35f('0x49')],null))[_0xd35f('0x24')](respondWithResult(_0x2fd890,null))[_0xd35f('0x40')](handleError(_0x2fd890,null));};exports[_0xd35f('0x4a')]=function(_0x3f8dcb,_0x344f67){return db['FaxTransferReport'][_0xd35f('0x47')]({'where':{'id':_0x3f8dcb[_0xd35f('0x42')]['id']}})[_0xd35f('0x24')](handleEntityNotFound(_0x344f67,null))[_0xd35f('0x24')](removeEntity(_0x344f67,null))[_0xd35f('0x40')](handleError(_0x344f67,null));};exports[_0xd35f('0x4b')]=function(_0x6b29f2,_0x49926c){return db[_0xd35f('0x2c')][_0xd35f('0x4b')]()[_0xd35f('0x24')](respondWithResult(_0x49926c,null))[_0xd35f('0x40')](handleError(_0x49926c,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 2109031..82ab174 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 _0x3c5f=['exports','define','FaxTransferReport','report_fax_transfer','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes'];(function(_0x1fd662,_0x2d6d12){var _0x385597=function(_0x10181f){while(--_0x10181f){_0x1fd662['push'](_0x1fd662['shift']());}};_0x385597(++_0x2d6d12);}(_0x3c5f,0x149));var _0xf3c5=function(_0x2d2886,_0x134a6e){_0x2d2886=_0x2d2886-0x0;var _0x559185=_0x3c5f[_0x2d2886];return _0x559185;};'use strict';var _=require('lodash');var util=require(_0xf3c5('0x0'));var logger=require(_0xf3c5('0x1'))('api');var moment=require(_0xf3c5('0x2'));var BPromise=require(_0xf3c5('0x3'));var rp=require(_0xf3c5('0x4'));var fs=require('fs');var path=require(_0xf3c5('0x5'));var rimraf=require(_0xf3c5('0x6'));var config=require(_0xf3c5('0x7'));var attributes=require(_0xf3c5('0x8'));module[_0xf3c5('0x9')]=function(_0x14c7a1,_0x27b81e){return _0x14c7a1[_0xf3c5('0xa')](_0xf3c5('0xb'),attributes,{'tableName':_0xf3c5('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x749c=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x749c,0x17a));var _0xc749=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x749c[_0x350343];return _0x9afc1c;};'use strict';var _=require(_0xc749('0x0'));var util=require(_0xc749('0x1'));var logger=require(_0xc749('0x2'))(_0xc749('0x3'));var moment=require('moment');var BPromise=require(_0xc749('0x4'));var rp=require(_0xc749('0x5'));var fs=require('fs');var path=require(_0xc749('0x6'));var rimraf=require(_0xc749('0x7'));var config=require(_0xc749('0x8'));var attributes=require(_0xc749('0x9'));module['exports']=function(_0x2b3dbc,_0x4adb3e){return _0x2b3dbc[_0xc749('0xa')](_0xc749('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xc749('0xc'),'fields':[_0xc749('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5273071..73c0fe9 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 _0xea33=['rpc','../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xc28702,_0x145b87){var _0x3b6e9e=function(_0xfac0c1){while(--_0xfac0c1){_0xc28702['push'](_0xc28702['shift']());}};_0x3b6e9e(++_0x145b87);}(_0xea33,0xa9));var _0x3ea3=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xea33[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0x3ea3('0x0'));var util=require(_0x3ea3('0x1'));var moment=require(_0x3ea3('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ea3('0x3'));var fs=require('fs');var Redis=require(_0x3ea3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ea3('0x5'));var logger=require(_0x3ea3('0x6'))(_0x3ea3('0x7'));var config=require(_0x3ea3('0x8'));var jayson=require(_0x3ea3('0x9'));var client=jayson[_0x3ea3('0xa')][_0x3ea3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x347d79,_0x255fe7,_0x24e066){return new BPromise(function(_0x2fce48,_0x1e12a7){return client['request'](_0x347d79,_0x24e066)[_0x3ea3('0xc')](function(_0x344520){logger[_0x3ea3('0xd')](_0x3ea3('0xe'),_0x255fe7,_0x3ea3('0xf'));logger[_0x3ea3('0x10')](_0x3ea3('0x11'),_0x255fe7,_0x3ea3('0xf'),JSON['stringify'](_0x344520));if(_0x344520[_0x3ea3('0x12')]){if(_0x344520[_0x3ea3('0x12')][_0x3ea3('0x13')]===0x1f4){logger['error'](_0x3ea3('0xe'),_0x255fe7,_0x344520[_0x3ea3('0x12')][_0x3ea3('0x14')]);return _0x1e12a7(_0x344520[_0x3ea3('0x12')][_0x3ea3('0x14')]);}logger['error'](_0x3ea3('0xe'),_0x255fe7,_0x344520['error'][_0x3ea3('0x14')]);return _0x2fce48(_0x344520[_0x3ea3('0x12')]['message']);}else{logger['info'](_0x3ea3('0xe'),_0x255fe7,_0x3ea3('0xf'));_0x2fce48(_0x344520['result']['message']);}})[_0x3ea3('0x15')](function(_0x214a3c){logger[_0x3ea3('0x12')](_0x3ea3('0xe'),_0x255fe7,_0x214a3c);_0x1e12a7(_0x214a3c);});});} \ No newline at end of file +var _0xbcb9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x1ae5d8,_0x25e539){var _0x163c9f=function(_0x9736a7){while(--_0x9736a7){_0x1ae5d8['push'](_0x1ae5d8['shift']());}};_0x163c9f(++_0x25e539);}(_0xbcb9,0x174));var _0x9bcb=function(_0x32a56d,_0x1e6981){_0x32a56d=_0x32a56d-0x0;var _0x3bd14e=_0xbcb9[_0x32a56d];return _0x3bd14e;};'use strict';var _=require(_0x9bcb('0x0'));var util=require(_0x9bcb('0x1'));var moment=require(_0x9bcb('0x2'));var BPromise=require('bluebird');var rs=require(_0x9bcb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bcb('0x4'))['db'];var utils=require(_0x9bcb('0x5'));var logger=require(_0x9bcb('0x6'))(_0x9bcb('0x7'));var config=require(_0x9bcb('0x8'));var jayson=require(_0x9bcb('0x9'));var client=jayson[_0x9bcb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25c9e0,_0x40c0cc,_0x26bc12){return new BPromise(function(_0x522516,_0x44fcdd){return client[_0x9bcb('0xb')](_0x25c9e0,_0x26bc12)['then'](function(_0x1e87c9){logger[_0x9bcb('0xc')](_0x9bcb('0xd'),_0x40c0cc,_0x9bcb('0xe'));logger[_0x9bcb('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x40c0cc,_0x9bcb('0xe'),JSON[_0x9bcb('0x10')](_0x1e87c9));if(_0x1e87c9['error']){if(_0x1e87c9[_0x9bcb('0x11')]['code']===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x40c0cc,_0x1e87c9[_0x9bcb('0x11')][_0x9bcb('0x12')]);return _0x44fcdd(_0x1e87c9[_0x9bcb('0x11')][_0x9bcb('0x12')]);}logger[_0x9bcb('0x11')](_0x9bcb('0xd'),_0x40c0cc,_0x1e87c9['error'][_0x9bcb('0x12')]);return _0x522516(_0x1e87c9[_0x9bcb('0x11')]['message']);}else{logger[_0x9bcb('0xc')](_0x9bcb('0xd'),_0x40c0cc,'request\x20sent');_0x522516(_0x1e87c9[_0x9bcb('0x13')][_0x9bcb('0x12')]);}})[_0x9bcb('0x14')](function(_0x58ac50){logger[_0x9bcb('0x11')](_0x9bcb('0xd'),_0x40c0cc,_0x58ac50);_0x44fcdd(_0x58ac50);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index e2bc1aa..2b57356 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 _0x7dd6=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x3ce6c1,_0x3ab7a7){var _0xecc97d=function(_0x4d06d7){while(--_0x4d06d7){_0x3ce6c1['push'](_0x3ce6c1['shift']());}};_0xecc97d(++_0x3ab7a7);}(_0x7dd6,0x17c));var _0x67dd=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x7dd6[_0x25e109];return _0xc0f7d6;};'use strict';var multer=require(_0x67dd('0x0'));var util=require('util');var path=require(_0x67dd('0x1'));var timeout=require(_0x67dd('0x2'));var express=require(_0x67dd('0x3'));var router=express[_0x67dd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x67dd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x67dd('0x6'));var controller=require(_0x67dd('0x7'));router['get']('/',auth[_0x67dd('0x8')](),controller[_0x67dd('0x9')]);router[_0x67dd('0xa')](_0x67dd('0xb'),auth[_0x67dd('0x8')](),controller[_0x67dd('0xc')]);router['get'](_0x67dd('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x67dd('0xe')]('/',auth[_0x67dd('0x8')](),controller[_0x67dd('0xf')]);router[_0x67dd('0x10')](_0x67dd('0xd'),auth['isAuthenticated'](),controller[_0x67dd('0x11')]);router['delete'](_0x67dd('0xd'),auth[_0x67dd('0x8')](),controller[_0x67dd('0x12')]);module[_0x67dd('0x13')]=router; \ No newline at end of file +var _0x265a=['/:id','show','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x46f04a,_0x5f594a){var _0x19012d=function(_0x5d4924){while(--_0x5d4924){_0x46f04a['push'](_0x46f04a['shift']());}};_0x19012d(++_0x5f594a);}(_0x265a,0x8b));var _0xa265=function(_0x21b9fd,_0x3a7ff0){_0x21b9fd=_0x21b9fd-0x0;var _0x416aa1=_0x265a[_0x21b9fd];return _0x416aa1;};'use strict';var multer=require('multer');var util=require(_0xa265('0x0'));var path=require(_0xa265('0x1'));var timeout=require(_0xa265('0x2'));var express=require(_0xa265('0x3'));var router=express[_0xa265('0x4')]();var fs_extra=require(_0xa265('0x5'));var auth=require(_0xa265('0x6'));var interaction=require(_0xa265('0x7'));var config=require(_0xa265('0x8'));var controller=require(_0xa265('0x9'));router[_0xa265('0xa')]('/',auth['isAuthenticated'](),controller[_0xa265('0xb')]);router[_0xa265('0xa')](_0xa265('0xc'),auth[_0xa265('0xd')](),controller[_0xa265('0xe')]);router[_0xa265('0xa')](_0xa265('0xf'),auth[_0xa265('0xd')](),controller[_0xa265('0x10')]);router['post']('/',auth[_0xa265('0xd')](),controller[_0xa265('0x11')]);router['put']('/:id',auth[_0xa265('0xd')](),controller[_0xa265('0x12')]);router[_0xa265('0x13')](_0xa265('0xf'),auth[_0xa265('0xd')](),controller[_0xa265('0x14')]);module[_0xa265('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 655cf7f..55b13e1 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 _0xdb01=['isAuthenticated','index','/:id','get','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','put','destroy','exports','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x5c66cf,_0x8fd541){var _0x4ad777=function(_0xc2b68b){while(--_0xc2b68b){_0x5c66cf['push'](_0x5c66cf['shift']());}};_0x4ad777(++_0x8fd541);}(_0xdb01,0x1ab));var _0x1db0=function(_0x112db5,_0x38a06d){_0x112db5=_0x112db5-0x0;var _0x1d7d06=_0xdb01[_0x112db5];return _0x1d7d06;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1db0('0x0'));var express=require(_0x1db0('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1db0('0x2'));var config=require(_0x1db0('0x3'));var controller=require(_0x1db0('0x4'));router['get']('/',auth[_0x1db0('0x5')](),controller[_0x1db0('0x6')]);router['get'](_0x1db0('0x7'),auth[_0x1db0('0x5')](),controller['show']);router[_0x1db0('0x8')]('/:id/configurations',auth[_0x1db0('0x5')](),controller[_0x1db0('0x9')]);router[_0x1db0('0x8')](_0x1db0('0xa'),auth[_0x1db0('0x5')](),controller[_0x1db0('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1db0('0xc')]);router[_0x1db0('0xd')](_0x1db0('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1db0('0xf')](_0x1db0('0x7'),auth[_0x1db0('0x5')](),controller['update']);router['delete'](_0x1db0('0x7'),auth['isAuthenticated'](),controller[_0x1db0('0x10')]);module[_0x1db0('0x11')]=router; \ No newline at end of file +var _0x61ff=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','destroy','exports'];(function(_0x20baf9,_0x2a21ac){var _0xb29df7=function(_0x1ca90b){while(--_0x1ca90b){_0x20baf9['push'](_0x20baf9['shift']());}};_0xb29df7(++_0x2a21ac);}(_0x61ff,0x1e0));var _0xf61f=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x61ff[_0x42f009];return _0x22a1e0;};'use strict';var multer=require(_0xf61f('0x0'));var util=require(_0xf61f('0x1'));var path=require(_0xf61f('0x2'));var timeout=require(_0xf61f('0x3'));var express=require(_0xf61f('0x4'));var router=express[_0xf61f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf61f('0x6'));var config=require('../../config/environment');var controller=require(_0xf61f('0x7'));router[_0xf61f('0x8')]('/',auth[_0xf61f('0x9')](),controller['index']);router[_0xf61f('0x8')](_0xf61f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf61f('0x8')](_0xf61f('0xb'),auth[_0xf61f('0x9')](),controller[_0xf61f('0xc')]);router[_0xf61f('0x8')](_0xf61f('0xd'),auth['isAuthenticated'](),controller[_0xf61f('0xe')]);router[_0xf61f('0xf')]('/',auth[_0xf61f('0x9')](),controller['create']);router[_0xf61f('0xf')](_0xf61f('0xb'),auth[_0xf61f('0x9')](),controller[_0xf61f('0x10')]);router['put'](_0xf61f('0xa'),auth[_0xf61f('0x9')](),controller[_0xf61f('0x11')]);router['delete'](_0xf61f('0xa'),auth[_0xf61f('0x9')](),controller[_0xf61f('0x12')]);module[_0xf61f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 3b5cb65..8ff7951 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 _0xad8d=['STRING','ENUM','basic','integrationTab','sequelize','exports'];(function(_0x3917a8,_0xa82e69){var _0x3f14ae=function(_0x140842){while(--_0x140842){_0x3917a8['push'](_0x3917a8['shift']());}};_0x3f14ae(++_0xa82e69);}(_0xad8d,0x172));var _0xdad8=function(_0x46bf45,_0x201aaf){_0x46bf45=_0x46bf45-0x0;var _0x10cdc3=_0xad8d[_0x46bf45];return _0x10cdc3;};'use strict';var Sequelize=require(_0xdad8('0x0'));module[_0xdad8('0x1')]={'name':{'type':Sequelize[_0xdad8('0x2')]},'description':{'type':Sequelize[_0xdad8('0x2')]},'username':{'type':Sequelize[_0xdad8('0x2')]},'remoteUri':{'type':Sequelize[_0xdad8('0x2')]},'authType':{'type':Sequelize[_0xdad8('0x3')]('basic'),'defaultValue':_0xdad8('0x4')},'password':{'type':Sequelize[_0xdad8('0x2')]},'consumerKey':{'type':Sequelize[_0xdad8('0x2')]},'consumerSecret':{'type':Sequelize[_0xdad8('0x2')]},'token':{'type':Sequelize[_0xdad8('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xdad8('0x3')](_0xdad8('0x5'),'newTab'),'defaultValue':_0xdad8('0x5')}}; \ No newline at end of file +var _0xc2f2=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x48b3e7,_0x1ba61f){var _0x518cd7=function(_0x1fb413){while(--_0x1fb413){_0x48b3e7['push'](_0x48b3e7['shift']());}};_0x518cd7(++_0x1ba61f);}(_0xc2f2,0xb4));var _0x2c2f=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0xc2f2[_0x1e3671];return _0x48d5f5;};'use strict';var Sequelize=require(_0x2c2f('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c2f('0x1')]},'description':{'type':Sequelize[_0x2c2f('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x2c2f('0x2')]('basic'),'defaultValue':_0x2c2f('0x3')},'password':{'type':Sequelize[_0x2c2f('0x1')]},'consumerKey':{'type':Sequelize[_0x2c2f('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2c2f('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2c2f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2c2f('0x2')](_0x2c2f('0x4'),_0x2c2f('0x5')),'defaultValue':_0x2c2f('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 768da68..9e08785 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 _0x2bcf=['Basic\x20%s','%s:%s','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','error','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','DeskConfiguration','AccountId','Descriptions','getDescriptions','channel','Subjects','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization'];(function(_0x5872f4,_0x399432){var _0xcb6124=function(_0x591aba){while(--_0x591aba){_0x5872f4['push'](_0x5872f4['shift']());}};_0xcb6124(++_0x399432);}(_0x2bcf,0x1d7));var _0xf2bc=function(_0x529f79,_0x5b4c85){_0x529f79=_0x529f79-0x0;var _0x21e1d5=_0x2bcf[_0x529f79];return _0x21e1d5;};'use strict';var emlformat=require(_0xf2bc('0x0'));var rimraf=require(_0xf2bc('0x1'));var zipdir=require(_0xf2bc('0x2'));var jsonpatch=require(_0xf2bc('0x3'));var rp=require(_0xf2bc('0x4'));var moment=require(_0xf2bc('0x5'));var BPromise=require(_0xf2bc('0x6'));var Mustache=require(_0xf2bc('0x7'));var util=require(_0xf2bc('0x8'));var path=require(_0xf2bc('0x9'));var sox=require(_0xf2bc('0xa'));var csv=require(_0xf2bc('0xb'));var ejs=require(_0xf2bc('0xc'));var fs=require('fs');var fs_extra=require(_0xf2bc('0xd'));var _=require(_0xf2bc('0xe'));var squel=require(_0xf2bc('0xf'));var crypto=require(_0xf2bc('0x10'));var jsforce=require(_0xf2bc('0x11'));var deskjs=require(_0xf2bc('0x12'));var toCsv=require(_0xf2bc('0xb'));var querystring=require(_0xf2bc('0x13'));var Papa=require(_0xf2bc('0x14'));var Redis=require(_0xf2bc('0x15'));var authService=require('../../components/auth/service');var qs=require(_0xf2bc('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2bc('0x17'));var logger=require('../../config/logger')(_0xf2bc('0x18'));var utils=require('../../config/utils');var config=require(_0xf2bc('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf2bc('0x1a'));function respondWithStatusCode(_0x371733,_0x18e8e9){_0x18e8e9=_0x18e8e9||0xcc;return function(_0x3829e2){if(_0x3829e2){return _0x371733[_0xf2bc('0x1b')](_0x18e8e9);}return _0x371733[_0xf2bc('0x1c')](_0x18e8e9)[_0xf2bc('0x1d')]();};}function respondWithResult(_0x163966,_0x4b488c){_0x4b488c=_0x4b488c||0xc8;return function(_0x16a728){if(_0x16a728){return _0x163966[_0xf2bc('0x1c')](_0x4b488c)[_0xf2bc('0x1e')](_0x16a728);}};}function respondWithFilteredResult(_0x6203c5,_0x474223){return function(_0x1f2aac){if(_0x1f2aac){var _0x45191c=typeof _0x474223[_0xf2bc('0x1f')]==='undefined'&&typeof _0x474223[_0xf2bc('0x20')]===_0xf2bc('0x21');var _0x105826=_0x1f2aac[_0xf2bc('0x22')];var _0x43957f=_0x45191c?0x0:_0x474223[_0xf2bc('0x1f')];var _0x5c8705=_0x45191c?_0x1f2aac[_0xf2bc('0x22')]:_0x474223[_0xf2bc('0x1f')]+_0x474223[_0xf2bc('0x20')];var _0x43bbd5;if(_0x5c8705>=_0x105826){_0x5c8705=_0x105826;_0x43bbd5=0xc8;}else{_0x43bbd5=0xce;}_0x6203c5[_0xf2bc('0x1c')](_0x43bbd5);return _0x6203c5[_0xf2bc('0x23')]('Content-Range',_0x43957f+'-'+_0x5c8705+'/'+_0x105826)['json'](_0x1f2aac);}return null;};}function patchUpdates(_0x4a36f0){return function(_0x2bd6c0){try{jsonpatch['apply'](_0x2bd6c0,_0x4a36f0,!![]);}catch(_0x2c76ca){return BPromise[_0xf2bc('0x24')](_0x2c76ca);}return _0x2bd6c0[_0xf2bc('0x25')]();};}function saveUpdates(_0x294b0e,_0x453129){return function(_0x1b08b0){if(_0x1b08b0){return _0x1b08b0[_0xf2bc('0x26')](_0x294b0e)['then'](function(_0x20417e){return _0x20417e;});}return null;};}function removeEntity(_0x255d00,_0x212d67){return function(_0x3a8506){if(_0x3a8506){return _0x3a8506[_0xf2bc('0x27')]()['then'](function(){_0x255d00['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x598468,_0x4466fd){return function(_0x6d1ca){if(!_0x6d1ca){_0x598468['sendStatus'](0x194);}return _0x6d1ca;};}function handleError(_0x3b5cbb,_0x2ab897){_0x2ab897=_0x2ab897||0x1f4;return function(_0x1fefd6){logger[_0xf2bc('0x28')](_0x1fefd6['stack']);if(_0x1fefd6[_0xf2bc('0x29')]){delete _0x1fefd6['name'];}_0x3b5cbb['status'](_0x2ab897)[_0xf2bc('0x2a')](_0x1fefd6);};}exports[_0xf2bc('0x2b')]=function(_0x357095,_0x437343){var _0x298a7b={},_0x5d1a25={},_0x4714df={'count':0x0,'rows':[]};var _0x14dde3=_['map'](db[_0xf2bc('0x2c')][_0xf2bc('0x2d')],function(_0x3cbd08){return{'name':_0x3cbd08[_0xf2bc('0x2e')],'type':_0x3cbd08[_0xf2bc('0x2f')][_0xf2bc('0x30')]};});_0x5d1a25[_0xf2bc('0x31')]=_[_0xf2bc('0x32')](_0x14dde3,_0xf2bc('0x29'));_0x5d1a25[_0xf2bc('0x33')]=_[_0xf2bc('0x34')](_0x357095['query']);_0x5d1a25[_0xf2bc('0x35')]=_[_0xf2bc('0x36')](_0x5d1a25[_0xf2bc('0x31')],_0x5d1a25[_0xf2bc('0x33')]);_0x298a7b['attributes']=_[_0xf2bc('0x36')](_0x5d1a25[_0xf2bc('0x31')],qs[_0xf2bc('0x37')](_0x357095[_0xf2bc('0x33')][_0xf2bc('0x37')]));_0x298a7b['attributes']=_0x298a7b[_0xf2bc('0x38')][_0xf2bc('0x39')]?_0x298a7b['attributes']:_0x5d1a25['model'];if(!_0x357095[_0xf2bc('0x33')][_0xf2bc('0x3a')](_0xf2bc('0x3b'))){_0x298a7b[_0xf2bc('0x20')]=qs[_0xf2bc('0x20')](_0x357095[_0xf2bc('0x33')]['limit']);_0x298a7b[_0xf2bc('0x1f')]=qs[_0xf2bc('0x1f')](_0x357095[_0xf2bc('0x33')][_0xf2bc('0x1f')]);}_0x298a7b[_0xf2bc('0x3c')]=qs[_0xf2bc('0x3d')](_0x357095[_0xf2bc('0x33')][_0xf2bc('0x3d')]);_0x298a7b['where']=qs[_0xf2bc('0x35')](_[_0xf2bc('0x3e')](_0x357095[_0xf2bc('0x33')],_0x5d1a25[_0xf2bc('0x35')]),_0x14dde3);if(_0x357095['query'][_0xf2bc('0x3f')]){_0x298a7b[_0xf2bc('0x40')]=_[_0xf2bc('0x41')](_0x298a7b[_0xf2bc('0x40')],{'$or':_[_0xf2bc('0x32')](_0x14dde3,function(_0x34b06e){if(_0x34b06e[_0xf2bc('0x2f')]!==_0xf2bc('0x42')){var _0x178d4b={};_0x178d4b[_0x34b06e[_0xf2bc('0x29')]]={'$like':'%'+_0x357095[_0xf2bc('0x33')][_0xf2bc('0x3f')]+'%'};return _0x178d4b;}})});}_0x298a7b=_[_0xf2bc('0x41')]({},_0x298a7b,_0x357095[_0xf2bc('0x43')]);var _0x4ec48f={'where':_0x298a7b[_0xf2bc('0x40')]};return db[_0xf2bc('0x2c')]['count'](_0x4ec48f)[_0xf2bc('0x44')](function(_0x4c642b){_0x4714df['count']=_0x4c642b;if(_0x357095[_0xf2bc('0x33')]['includeAll']){_0x298a7b['include']=[{'all':!![]}];}return db[_0xf2bc('0x2c')]['findAll'](_0x298a7b);})[_0xf2bc('0x44')](function(_0x456dae){_0x4714df[_0xf2bc('0x45')]=_0x456dae;return _0x4714df;})[_0xf2bc('0x44')](respondWithFilteredResult(_0x437343,_0x298a7b))[_0xf2bc('0x46')](handleError(_0x437343,null));};exports[_0xf2bc('0x47')]=function(_0x2ce06c,_0x281215){var _0x573847={'raw':![],'where':{'id':_0x2ce06c[_0xf2bc('0x48')]['id']}},_0x1e94c7={};_0x1e94c7[_0xf2bc('0x31')]=_[_0xf2bc('0x34')](db['DeskAccount']['rawAttributes']);_0x1e94c7[_0xf2bc('0x33')]=_[_0xf2bc('0x34')](_0x2ce06c[_0xf2bc('0x33')]);_0x1e94c7[_0xf2bc('0x35')]=_[_0xf2bc('0x36')](_0x1e94c7[_0xf2bc('0x31')],_0x1e94c7[_0xf2bc('0x33')]);_0x573847[_0xf2bc('0x38')]=_[_0xf2bc('0x36')](_0x1e94c7[_0xf2bc('0x31')],qs['fields'](_0x2ce06c[_0xf2bc('0x33')][_0xf2bc('0x37')]));_0x573847[_0xf2bc('0x38')]=_0x573847[_0xf2bc('0x38')][_0xf2bc('0x39')]?_0x573847['attributes']:_0x1e94c7[_0xf2bc('0x31')];if(_0x2ce06c[_0xf2bc('0x33')][_0xf2bc('0x49')]){_0x573847['include']=[{'all':!![]}];}_0x573847=_[_0xf2bc('0x41')]({},_0x573847,_0x2ce06c[_0xf2bc('0x43')]);return db['DeskAccount'][_0xf2bc('0x4a')](_0x573847)[_0xf2bc('0x44')](handleEntityNotFound(_0x281215,null))[_0xf2bc('0x44')](respondWithResult(_0x281215,null))[_0xf2bc('0x46')](handleError(_0x281215,null));};exports['create']=function(_0x938628,_0xdfe0c6){return db[_0xf2bc('0x2c')][_0xf2bc('0x4b')](_0x938628[_0xf2bc('0x4c')],{})[_0xf2bc('0x44')](respondWithResult(_0xdfe0c6,0xc9))[_0xf2bc('0x46')](handleError(_0xdfe0c6,null));};exports[_0xf2bc('0x26')]=function(_0x380371,_0x51b641){if(_0x380371[_0xf2bc('0x4c')]['id']){delete _0x380371[_0xf2bc('0x4c')]['id'];}return db[_0xf2bc('0x2c')][_0xf2bc('0x4a')]({'where':{'id':_0x380371[_0xf2bc('0x48')]['id']}})[_0xf2bc('0x44')](handleEntityNotFound(_0x51b641,null))[_0xf2bc('0x44')](saveUpdates(_0x380371['body'],null))['then'](respondWithResult(_0x51b641,null))[_0xf2bc('0x46')](handleError(_0x51b641,null));};exports[_0xf2bc('0x27')]=function(_0x3cbf64,_0x308765){return db[_0xf2bc('0x2c')][_0xf2bc('0x4a')]({'where':{'id':_0x3cbf64[_0xf2bc('0x48')]['id']}})['then'](handleEntityNotFound(_0x308765,null))['then'](removeEntity(_0x308765,null))[_0xf2bc('0x46')](handleError(_0x308765,null));};exports[_0xf2bc('0x4d')]=function(_0x321f8c,_0x5ef482,_0x39075b){var _0x4bb49a={};var _0x301c88={};var _0x2fb607;var _0x1a8215;return db[_0xf2bc('0x2c')][_0xf2bc('0x4e')]({'where':{'id':_0x321f8c[_0xf2bc('0x48')]['id']}})[_0xf2bc('0x44')](handleEntityNotFound(_0x5ef482,null))['then'](function(_0x272cb3){if(_0x272cb3){_0x2fb607=_0x272cb3;_0x301c88[_0xf2bc('0x31')]=_['keys'](db[_0xf2bc('0x4f')][_0xf2bc('0x2d')]);_0x301c88[_0xf2bc('0x33')]=_[_0xf2bc('0x34')](_0x321f8c[_0xf2bc('0x33')]);_0x301c88[_0xf2bc('0x35')]=_[_0xf2bc('0x36')](_0x301c88[_0xf2bc('0x31')],_0x301c88['query']);_0x4bb49a[_0xf2bc('0x38')]=_[_0xf2bc('0x36')](_0x301c88['model'],qs[_0xf2bc('0x37')](_0x321f8c['query'][_0xf2bc('0x37')]));_0x4bb49a[_0xf2bc('0x38')]=_0x4bb49a[_0xf2bc('0x38')][_0xf2bc('0x39')]?_0x4bb49a['attributes']:_0x301c88[_0xf2bc('0x31')];_0x4bb49a[_0xf2bc('0x3c')]=qs[_0xf2bc('0x3d')](_0x321f8c[_0xf2bc('0x33')]['sort']);_0x4bb49a['where']=qs['filters'](_[_0xf2bc('0x3e')](_0x321f8c['query'],_0x301c88[_0xf2bc('0x35')]));if(_0x321f8c[_0xf2bc('0x33')][_0xf2bc('0x3f')]){_0x4bb49a[_0xf2bc('0x40')]=_['merge'](_0x4bb49a['where'],{'$or':_[_0xf2bc('0x32')](_0x4bb49a[_0xf2bc('0x38')],function(_0x3ef723){var _0x50010f={};_0x50010f[_0x3ef723]={'$like':'%'+_0x321f8c[_0xf2bc('0x33')]['filter']+'%'};return _0x50010f;})});}_0x4bb49a=_[_0xf2bc('0x41')]({},_0x4bb49a,_0x321f8c['options']);return _0x2fb607['getConfigurations'](_0x4bb49a);}})[_0xf2bc('0x44')](function(_0x2c973f){if(_0x2c973f){_0x1a8215=_0x2c973f['length'];if(!_0x321f8c[_0xf2bc('0x33')][_0xf2bc('0x3a')]('nolimit')){_0x4bb49a['limit']=qs[_0xf2bc('0x20')](_0x321f8c[_0xf2bc('0x33')]['limit']);_0x4bb49a['offset']=qs[_0xf2bc('0x1f')](_0x321f8c[_0xf2bc('0x33')][_0xf2bc('0x1f')]);}return _0x2fb607[_0xf2bc('0x4d')](_0x4bb49a);}})['then'](function(_0x42a1de){if(_0x42a1de){return _0x42a1de?{'count':_0x1a8215,'rows':_0x42a1de}:null;}})['then'](respondWithResult(_0x5ef482,null))[_0xf2bc('0x46')](handleError(_0x5ef482,null));};exports['addConfiguration']=function(_0x5285d6,_0x584f8b,_0x2be745){if(_0x5285d6[_0xf2bc('0x4c')]['id']){delete _0x5285d6[_0xf2bc('0x4c')]['id'];}return db[_0xf2bc('0x2c')][_0xf2bc('0x4e')]({'where':{'id':_0x5285d6[_0xf2bc('0x48')]['id']}})[_0xf2bc('0x44')](handleEntityNotFound(_0x584f8b,null))[_0xf2bc('0x44')](function(_0x4796d8){if(_0x4796d8){_0x5285d6[_0xf2bc('0x4c')][_0xf2bc('0x50')]=_0x4796d8['id'];_0x5285d6[_0xf2bc('0x4c')]['Subjects']=integrations['getSubjects'](_0x5285d6[_0xf2bc('0x4c')]['channel'],_0x5285d6[_0xf2bc('0x4c')][_0xf2bc('0x2f')]);_0x5285d6[_0xf2bc('0x4c')][_0xf2bc('0x51')]=integrations[_0xf2bc('0x52')](_0x5285d6[_0xf2bc('0x4c')][_0xf2bc('0x53')],_0x5285d6['body'][_0xf2bc('0x2f')]);return db['DeskConfiguration']['create'](_0x5285d6[_0xf2bc('0x4c')],{'include':[{'model':db['DeskField'],'as':_0xf2bc('0x54')},{'model':db[_0xf2bc('0x55')],'as':'Descriptions'}]});}return null;})[_0xf2bc('0x44')](respondWithResult(_0x584f8b,null))[_0xf2bc('0x46')](handleError(_0x584f8b,null));};exports[_0xf2bc('0x56')]=function(_0x1bca07,_0x19179c,_0x1a3a63){var _0x100597=[{'name':_0xf2bc('0x57'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x52d02d='';return db[_0xf2bc('0x2c')][_0xf2bc('0x4e')]({'where':{'id':_0x1bca07['params']['id']},'attributes':['id',_0xf2bc('0x58'),_0xf2bc('0x59'),_0xf2bc('0x5a'),_0xf2bc('0x5b'),_0xf2bc('0x5c'),_0xf2bc('0x5d'),_0xf2bc('0x5e'),'tokenSecret']})[_0xf2bc('0x44')](handleEntityNotFound(_0x19179c,null))[_0xf2bc('0x44')](function(_0x206a1d){if(_0x206a1d){_0x52d02d=_0x206a1d[_0xf2bc('0x58')];var _0x360601=_0x52d02d[_0xf2bc('0x5f')](-0x1);if(_0x360601==='/'){_0x52d02d=_0x52d02d[_0xf2bc('0x60')](0x0,_0x52d02d[_0xf2bc('0x61')](_0x360601));}var _0x1c864e={'method':_0xf2bc('0x62'),'uri':util[_0xf2bc('0x63')](_0xf2bc('0x64'),_0x52d02d),'headers':{'Content-Type':_0xf2bc('0x65'),'Accept':'application/json'},'json':!![]};if(_0x206a1d[_0xf2bc('0x59')]===_0xf2bc('0x66')){_0x1c864e['headers'][_0xf2bc('0x67')]=util['format'](_0xf2bc('0x68'),new Buffer(util[_0xf2bc('0x63')](_0xf2bc('0x69'),_0x206a1d[_0xf2bc('0x5a')],_0x206a1d[_0xf2bc('0x5b')]))['toString'](_0xf2bc('0x6a')));}return rp(_0x1c864e)[_0xf2bc('0x44')](function(_0x5e200f){return _0x100597[_0xf2bc('0x6b')](_[_0xf2bc('0x32')](_0x5e200f[_0xf2bc('0x6c')][_0xf2bc('0x6d')],function(_0x5ec0e5){return{'id':_0x5ec0e5[_0xf2bc('0x29')],'name':_0x5ec0e5[_0xf2bc('0x29')],'type':_0x5ec0e5['type'],'active':_0x5ec0e5[_0xf2bc('0x6e')],'label':_0x5ec0e5[_0xf2bc('0x6f')],'custom':!![]};}));});}})[_0xf2bc('0x44')](function(_0x2bd746){return{'count':_0x2bd746[_0xf2bc('0x39')],'rows':_0x2bd746};})[_0xf2bc('0x44')](respondWithResult(_0x19179c,null))[_0xf2bc('0x46')](function(_0x295a75){var _0x3d1e71=_0x1bca07[_0xf2bc('0x33')][_0xf2bc('0x70')]?0x1f4:_0x295a75[_0xf2bc('0x71')]||0x1f4;logger[_0xf2bc('0x28')](_0xf2bc('0x72'),_0xf2bc('0x56'),_0x3d1e71,JSON['stringify'](_0x295a75));delete _0x295a75[_0xf2bc('0x29')];if(_0x3d1e71===0x191){_0x3d1e71=0x190;}_0x19179c[_0xf2bc('0x1c')](_0x3d1e71)['send'](_0x1bca07['query'][_0xf2bc('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x295a75[_0xf2bc('0x71')]}:_0x295a75);});}; \ No newline at end of file +var _0x97e2=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','DeskAccount','find','create','update','body','findOne','DeskConfiguration','AccountId','Subjects','getSubjects','channel','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','label','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','then','destroy','end','name','index','map','type','key','model','query','filters','intersection'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x97e2,0x126));var _0x297e=function(_0x308916,_0x1fa3c8){_0x308916=_0x308916-0x0;var _0x5c6f9b=_0x97e2[_0x308916];return _0x5c6f9b;};'use strict';var emlformat=require(_0x297e('0x0'));var rimraf=require(_0x297e('0x1'));var zipdir=require(_0x297e('0x2'));var jsonpatch=require(_0x297e('0x3'));var rp=require(_0x297e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x297e('0x5'));var util=require(_0x297e('0x6'));var path=require(_0x297e('0x7'));var sox=require(_0x297e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x297e('0x9'));var _=require(_0x297e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x297e('0xb'));var deskjs=require(_0x297e('0xc'));var toCsv=require(_0x297e('0xd'));var querystring=require(_0x297e('0xe'));var Papa=require(_0x297e('0xf'));var Redis=require(_0x297e('0x10'));var authService=require(_0x297e('0x11'));var qs=require(_0x297e('0x12'));var as=require(_0x297e('0x13'));var hardwareService=require(_0x297e('0x14'));var logger=require(_0x297e('0x15'))(_0x297e('0x16'));var utils=require(_0x297e('0x17'));var config=require(_0x297e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x297e('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e522c,_0x86dce){_0x86dce=_0x86dce||0xcc;return function(_0x6b3f5c){if(_0x6b3f5c){return _0x3e522c[_0x297e('0x1a')](_0x86dce);}return _0x3e522c[_0x297e('0x1b')](_0x86dce)['end']();};}function respondWithResult(_0x1bf836,_0x202893){_0x202893=_0x202893||0xc8;return function(_0x151bac){if(_0x151bac){return _0x1bf836['status'](_0x202893)[_0x297e('0x1c')](_0x151bac);}};}function respondWithFilteredResult(_0x13bd71,_0x567ea6){return function(_0x1a7718){if(_0x1a7718){var _0x481b02=typeof _0x567ea6[_0x297e('0x1d')]==='undefined'&&typeof _0x567ea6[_0x297e('0x1e')]===_0x297e('0x1f');var _0xfe6765=_0x1a7718[_0x297e('0x20')];var _0x3cd998=_0x481b02?0x0:_0x567ea6[_0x297e('0x1d')];var _0x43a4dc=_0x481b02?_0x1a7718[_0x297e('0x20')]:_0x567ea6[_0x297e('0x1d')]+_0x567ea6['limit'];var _0x14f1b9;if(_0x43a4dc>=_0xfe6765){_0x43a4dc=_0xfe6765;_0x14f1b9=0xc8;}else{_0x14f1b9=0xce;}_0x13bd71[_0x297e('0x1b')](_0x14f1b9);return _0x13bd71[_0x297e('0x21')](_0x297e('0x22'),_0x3cd998+'-'+_0x43a4dc+'/'+_0xfe6765)[_0x297e('0x1c')](_0x1a7718);}return null;};}function patchUpdates(_0x5dc5f7){return function(_0x4ad599){try{jsonpatch[_0x297e('0x23')](_0x4ad599,_0x5dc5f7,!![]);}catch(_0x461f86){return BPromise['reject'](_0x461f86);}return _0x4ad599['save']();};}function saveUpdates(_0x57d02c,_0x42555b){return function(_0x52dcd1){if(_0x52dcd1){return _0x52dcd1['update'](_0x57d02c)[_0x297e('0x24')](function(_0xa9e9f7){return _0xa9e9f7;});}return null;};}function removeEntity(_0x5b698e,_0x31e8ec){return function(_0x34e667){if(_0x34e667){return _0x34e667[_0x297e('0x25')]()['then'](function(){_0x5b698e[_0x297e('0x1b')](0xcc)[_0x297e('0x26')]();});}};}function handleEntityNotFound(_0x35da74,_0x1c8241){return function(_0x195909){if(!_0x195909){_0x35da74[_0x297e('0x1a')](0x194);}return _0x195909;};}function handleError(_0x24ec30,_0xac3ff1){_0xac3ff1=_0xac3ff1||0x1f4;return function(_0xbaeeb5){logger['error'](_0xbaeeb5['stack']);if(_0xbaeeb5[_0x297e('0x27')]){delete _0xbaeeb5[_0x297e('0x27')];}_0x24ec30[_0x297e('0x1b')](_0xac3ff1)['send'](_0xbaeeb5);};}exports[_0x297e('0x28')]=function(_0x2e1104,_0x239dc3){var _0x3fcc7c={},_0xeb7eb2={},_0x1f9dda={'count':0x0,'rows':[]};var _0x241dbc=_[_0x297e('0x29')](db['DeskAccount']['rawAttributes'],function(_0xffc94e){return{'name':_0xffc94e['fieldName'],'type':_0xffc94e[_0x297e('0x2a')][_0x297e('0x2b')]};});_0xeb7eb2[_0x297e('0x2c')]=_[_0x297e('0x29')](_0x241dbc,'name');_0xeb7eb2['query']=_['keys'](_0x2e1104[_0x297e('0x2d')]);_0xeb7eb2[_0x297e('0x2e')]=_[_0x297e('0x2f')](_0xeb7eb2[_0x297e('0x2c')],_0xeb7eb2['query']);_0x3fcc7c[_0x297e('0x30')]=_[_0x297e('0x2f')](_0xeb7eb2[_0x297e('0x2c')],qs[_0x297e('0x31')](_0x2e1104['query'][_0x297e('0x31')]));_0x3fcc7c[_0x297e('0x30')]=_0x3fcc7c[_0x297e('0x30')][_0x297e('0x32')]?_0x3fcc7c[_0x297e('0x30')]:_0xeb7eb2['model'];if(!_0x2e1104['query'][_0x297e('0x33')](_0x297e('0x34'))){_0x3fcc7c[_0x297e('0x1e')]=qs['limit'](_0x2e1104['query'][_0x297e('0x1e')]);_0x3fcc7c[_0x297e('0x1d')]=qs['offset'](_0x2e1104[_0x297e('0x2d')]['offset']);}_0x3fcc7c[_0x297e('0x35')]=qs[_0x297e('0x36')](_0x2e1104[_0x297e('0x2d')][_0x297e('0x36')]);_0x3fcc7c[_0x297e('0x37')]=qs[_0x297e('0x2e')](_[_0x297e('0x38')](_0x2e1104[_0x297e('0x2d')],_0xeb7eb2[_0x297e('0x2e')]),_0x241dbc);if(_0x2e1104['query'][_0x297e('0x39')]){_0x3fcc7c[_0x297e('0x37')]=_[_0x297e('0x3a')](_0x3fcc7c[_0x297e('0x37')],{'$or':_[_0x297e('0x29')](_0x241dbc,function(_0x8c4e60){if(_0x8c4e60[_0x297e('0x2a')]!==_0x297e('0x3b')){var _0x19b3a2={};_0x19b3a2[_0x8c4e60[_0x297e('0x27')]]={'$like':'%'+_0x2e1104['query'][_0x297e('0x39')]+'%'};return _0x19b3a2;}})});}_0x3fcc7c=_[_0x297e('0x3a')]({},_0x3fcc7c,_0x2e1104['options']);var _0x9b7016={'where':_0x3fcc7c['where']};return db['DeskAccount'][_0x297e('0x20')](_0x9b7016)[_0x297e('0x24')](function(_0x55251f){_0x1f9dda[_0x297e('0x20')]=_0x55251f;if(_0x2e1104[_0x297e('0x2d')][_0x297e('0x3c')]){_0x3fcc7c[_0x297e('0x3d')]=[{'all':!![]}];}return db['DeskAccount'][_0x297e('0x3e')](_0x3fcc7c);})[_0x297e('0x24')](function(_0xdbb414){_0x1f9dda[_0x297e('0x3f')]=_0xdbb414;return _0x1f9dda;})['then'](respondWithFilteredResult(_0x239dc3,_0x3fcc7c))[_0x297e('0x40')](handleError(_0x239dc3,null));};exports[_0x297e('0x41')]=function(_0x140aed,_0x25a93f){var _0x3310d2={'raw':![],'where':{'id':_0x140aed[_0x297e('0x42')]['id']}},_0x4b459a={};_0x4b459a[_0x297e('0x2c')]=_[_0x297e('0x43')](db['DeskAccount'][_0x297e('0x44')]);_0x4b459a['query']=_[_0x297e('0x43')](_0x140aed[_0x297e('0x2d')]);_0x4b459a['filters']=_[_0x297e('0x2f')](_0x4b459a['model'],_0x4b459a[_0x297e('0x2d')]);_0x3310d2[_0x297e('0x30')]=_[_0x297e('0x2f')](_0x4b459a['model'],qs[_0x297e('0x31')](_0x140aed[_0x297e('0x2d')]['fields']));_0x3310d2['attributes']=_0x3310d2[_0x297e('0x30')][_0x297e('0x32')]?_0x3310d2[_0x297e('0x30')]:_0x4b459a[_0x297e('0x2c')];if(_0x140aed[_0x297e('0x2d')][_0x297e('0x3c')]){_0x3310d2[_0x297e('0x3d')]=[{'all':!![]}];}_0x3310d2=_['merge']({},_0x3310d2,_0x140aed[_0x297e('0x45')]);return db[_0x297e('0x46')][_0x297e('0x47')](_0x3310d2)[_0x297e('0x24')](handleEntityNotFound(_0x25a93f,null))[_0x297e('0x24')](respondWithResult(_0x25a93f,null))['catch'](handleError(_0x25a93f,null));};exports[_0x297e('0x48')]=function(_0x13ca15,_0x179662){return db[_0x297e('0x46')]['create'](_0x13ca15['body'],{})[_0x297e('0x24')](respondWithResult(_0x179662,0xc9))[_0x297e('0x40')](handleError(_0x179662,null));};exports[_0x297e('0x49')]=function(_0x3f2e5d,_0x27b030){if(_0x3f2e5d[_0x297e('0x4a')]['id']){delete _0x3f2e5d[_0x297e('0x4a')]['id'];}return db['DeskAccount'][_0x297e('0x47')]({'where':{'id':_0x3f2e5d[_0x297e('0x42')]['id']}})[_0x297e('0x24')](handleEntityNotFound(_0x27b030,null))[_0x297e('0x24')](saveUpdates(_0x3f2e5d['body'],null))[_0x297e('0x24')](respondWithResult(_0x27b030,null))['catch'](handleError(_0x27b030,null));};exports[_0x297e('0x25')]=function(_0x1f9f80,_0xf98ac9){return db[_0x297e('0x46')][_0x297e('0x47')]({'where':{'id':_0x1f9f80[_0x297e('0x42')]['id']}})[_0x297e('0x24')](handleEntityNotFound(_0xf98ac9,null))[_0x297e('0x24')](removeEntity(_0xf98ac9,null))['catch'](handleError(_0xf98ac9,null));};exports['getConfigurations']=function(_0x5304ac,_0x14afcf,_0x218eb2){var _0xffd8aa={};var _0x5bd514={};var _0x39e125;var _0x5aa55f;return db[_0x297e('0x46')][_0x297e('0x4b')]({'where':{'id':_0x5304ac[_0x297e('0x42')]['id']}})[_0x297e('0x24')](handleEntityNotFound(_0x14afcf,null))[_0x297e('0x24')](function(_0x2cba78){if(_0x2cba78){_0x39e125=_0x2cba78;_0x5bd514['model']=_[_0x297e('0x43')](db[_0x297e('0x4c')][_0x297e('0x44')]);_0x5bd514[_0x297e('0x2d')]=_[_0x297e('0x43')](_0x5304ac[_0x297e('0x2d')]);_0x5bd514[_0x297e('0x2e')]=_[_0x297e('0x2f')](_0x5bd514[_0x297e('0x2c')],_0x5bd514[_0x297e('0x2d')]);_0xffd8aa['attributes']=_[_0x297e('0x2f')](_0x5bd514['model'],qs['fields'](_0x5304ac[_0x297e('0x2d')][_0x297e('0x31')]));_0xffd8aa[_0x297e('0x30')]=_0xffd8aa['attributes'][_0x297e('0x32')]?_0xffd8aa['attributes']:_0x5bd514[_0x297e('0x2c')];_0xffd8aa[_0x297e('0x35')]=qs[_0x297e('0x36')](_0x5304ac[_0x297e('0x2d')]['sort']);_0xffd8aa[_0x297e('0x37')]=qs['filters'](_[_0x297e('0x38')](_0x5304ac['query'],_0x5bd514[_0x297e('0x2e')]));if(_0x5304ac[_0x297e('0x2d')]['filter']){_0xffd8aa[_0x297e('0x37')]=_[_0x297e('0x3a')](_0xffd8aa[_0x297e('0x37')],{'$or':_[_0x297e('0x29')](_0xffd8aa['attributes'],function(_0x1846cc){var _0x588c3b={};_0x588c3b[_0x1846cc]={'$like':'%'+_0x5304ac[_0x297e('0x2d')]['filter']+'%'};return _0x588c3b;})});}_0xffd8aa=_[_0x297e('0x3a')]({},_0xffd8aa,_0x5304ac['options']);return _0x39e125['getConfigurations'](_0xffd8aa);}})[_0x297e('0x24')](function(_0x137816){if(_0x137816){_0x5aa55f=_0x137816[_0x297e('0x32')];if(!_0x5304ac[_0x297e('0x2d')][_0x297e('0x33')](_0x297e('0x34'))){_0xffd8aa[_0x297e('0x1e')]=qs[_0x297e('0x1e')](_0x5304ac[_0x297e('0x2d')][_0x297e('0x1e')]);_0xffd8aa[_0x297e('0x1d')]=qs['offset'](_0x5304ac[_0x297e('0x2d')][_0x297e('0x1d')]);}return _0x39e125['getConfigurations'](_0xffd8aa);}})[_0x297e('0x24')](function(_0x4a2f1c){if(_0x4a2f1c){return _0x4a2f1c?{'count':_0x5aa55f,'rows':_0x4a2f1c}:null;}})[_0x297e('0x24')](respondWithResult(_0x14afcf,null))['catch'](handleError(_0x14afcf,null));};exports['addConfiguration']=function(_0x5f107e,_0x2c4249,_0x5db22e){if(_0x5f107e[_0x297e('0x4a')]['id']){delete _0x5f107e[_0x297e('0x4a')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x5f107e[_0x297e('0x42')]['id']}})[_0x297e('0x24')](handleEntityNotFound(_0x2c4249,null))[_0x297e('0x24')](function(_0xe45540){if(_0xe45540){_0x5f107e[_0x297e('0x4a')][_0x297e('0x4d')]=_0xe45540['id'];_0x5f107e[_0x297e('0x4a')][_0x297e('0x4e')]=integrations[_0x297e('0x4f')](_0x5f107e['body'][_0x297e('0x50')],_0x5f107e[_0x297e('0x4a')][_0x297e('0x2a')]);_0x5f107e['body']['Descriptions']=integrations['getDescriptions'](_0x5f107e[_0x297e('0x4a')]['channel'],_0x5f107e['body'][_0x297e('0x2a')]);return db[_0x297e('0x4c')][_0x297e('0x48')](_0x5f107e[_0x297e('0x4a')],{'include':[{'model':db[_0x297e('0x51')],'as':_0x297e('0x4e')},{'model':db[_0x297e('0x51')],'as':_0x297e('0x52')}]});}return null;})[_0x297e('0x24')](respondWithResult(_0x2c4249,null))[_0x297e('0x40')](handleError(_0x2c4249,null));};exports[_0x297e('0x53')]=function(_0x3abb6a,_0x5a43b2,_0x2a2e77){var _0x217ee8=[{'name':_0x297e('0x54'),'label':_0x297e('0x54'),'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 _0x572c70='';return db['DeskAccount'][_0x297e('0x4b')]({'where':{'id':_0x3abb6a['params']['id']},'attributes':['id',_0x297e('0x55'),_0x297e('0x56'),_0x297e('0x57'),_0x297e('0x58'),'consumerKey',_0x297e('0x59'),_0x297e('0x5a'),_0x297e('0x5b')]})[_0x297e('0x24')](handleEntityNotFound(_0x5a43b2,null))[_0x297e('0x24')](function(_0xd25694){if(_0xd25694){_0x572c70=_0xd25694[_0x297e('0x55')];var _0x3fdacb=_0x572c70[_0x297e('0x5c')](-0x1);if(_0x3fdacb==='/'){_0x572c70=_0x572c70[_0x297e('0x5d')](0x0,_0x572c70['lastIndexOf'](_0x3fdacb));}var _0x6b1e6b={'method':_0x297e('0x5e'),'uri':util[_0x297e('0x5f')](_0x297e('0x60'),_0x572c70),'headers':{'Content-Type':_0x297e('0x61'),'Accept':_0x297e('0x61')},'json':!![]};if(_0xd25694[_0x297e('0x56')]===_0x297e('0x62')){_0x6b1e6b[_0x297e('0x63')]['Authorization']=util[_0x297e('0x5f')](_0x297e('0x64'),new Buffer(util[_0x297e('0x5f')](_0x297e('0x65'),_0xd25694[_0x297e('0x57')],_0xd25694[_0x297e('0x58')]))[_0x297e('0x66')](_0x297e('0x67')));}return rp(_0x6b1e6b)[_0x297e('0x24')](function(_0x29e639){return _0x217ee8[_0x297e('0x68')](_[_0x297e('0x29')](_0x29e639[_0x297e('0x69')]['entries'],function(_0x5b1d1b){return{'id':_0x5b1d1b[_0x297e('0x27')],'name':_0x5b1d1b[_0x297e('0x27')],'type':_0x5b1d1b[_0x297e('0x2a')],'active':_0x5b1d1b[_0x297e('0x6a')],'label':_0x5b1d1b[_0x297e('0x6b')],'custom':!![]};}));});}})[_0x297e('0x24')](function(_0x253616){return{'count':_0x253616[_0x297e('0x32')],'rows':_0x253616};})[_0x297e('0x24')](respondWithResult(_0x5a43b2,null))['catch'](function(_0x4fac1f){var _0x155ff4=_0x3abb6a['query'][_0x297e('0x6c')]?0x1f4:_0x4fac1f['statusCode']||0x1f4;logger[_0x297e('0x6d')](_0x297e('0x6e'),_0x297e('0x53'),_0x155ff4,JSON[_0x297e('0x6f')](_0x4fac1f));delete _0x4fac1f[_0x297e('0x27')];if(_0x155ff4===0x191){_0x155ff4=0x190;}_0x5a43b2[_0x297e('0x1b')](_0x155ff4)[_0x297e('0x70')](_0x3abb6a[_0x297e('0x2d')][_0x297e('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x4fac1f[_0x297e('0x71')]}:_0x4fac1f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 943503e..e1a9989 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 _0x605c=['bluebird','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','../../config/logger','api','moment'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x605c,0x115));var _0xc605=function(_0x251547,_0x1e8a25){_0x251547=_0x251547-0x0;var _0x4c19df=_0x605c[_0x251547];return _0x4c19df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc605('0x0'))(_0xc605('0x1'));var moment=require(_0xc605('0x2'));var BPromise=require(_0xc605('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc605('0x4'));var rimraf=require(_0xc605('0x5'));var config=require('../../config/environment');var attributes=require(_0xc605('0x6'));var integrations=require(_0xc605('0x7'));module[_0xc605('0x8')]=function(_0x1baa92,_0x40226f){return _0x1baa92[_0xc605('0x9')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d8a=['define','DeskAccount','int_desk_accounts','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x230bb8,_0xa1718){var _0x16cb9a=function(_0x2848fe){while(--_0x2848fe){_0x230bb8['push'](_0x230bb8['shift']());}};_0x16cb9a(++_0xa1718);}(_0x3d8a,0xc9));var _0xa3d8=function(_0x194238,_0x4587b8){_0x194238=_0x194238-0x0;var _0x201345=_0x3d8a[_0x194238];return _0x201345;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa3d8('0x0'));var BPromise=require(_0xa3d8('0x1'));var rp=require(_0xa3d8('0x2'));var fs=require('fs');var path=require(_0xa3d8('0x3'));var rimraf=require(_0xa3d8('0x4'));var config=require(_0xa3d8('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xa3d8('0x6'));module[_0xa3d8('0x7')]=function(_0x2c9e76,_0x35744f){return _0x2c9e76[_0xa3d8('0x8')](_0xa3d8('0x9'),attributes,{'tableName':_0xa3d8('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 7946432..9b73d74 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 _0xbf00=['stringify','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','result','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbf00,0x16c));var _0x0bf0=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0xbf00[_0x21c2c8];return _0x4dd745;};'use strict';var _=require('lodash');var util=require(_0x0bf0('0x0'));var moment=require(_0x0bf0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bf0('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0bf0('0x3'))(_0x0bf0('0x4'));var config=require(_0x0bf0('0x5'));var jayson=require(_0x0bf0('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3352b7,_0x4c4411,_0x2b70ef){return new BPromise(function(_0x316075,_0x10ecab){return client[_0x0bf0('0x7')](_0x3352b7,_0x2b70ef)[_0x0bf0('0x8')](function(_0x496c2e){logger[_0x0bf0('0x9')](_0x0bf0('0xa'),_0x4c4411,_0x0bf0('0xb'));logger[_0x0bf0('0xc')](_0x0bf0('0xd'),_0x4c4411,_0x0bf0('0xb'),JSON['stringify'](_0x496c2e));if(_0x496c2e[_0x0bf0('0xe')]){if(_0x496c2e[_0x0bf0('0xe')][_0x0bf0('0xf')]===0x1f4){logger[_0x0bf0('0xe')](_0x0bf0('0xa'),_0x4c4411,_0x496c2e['error']['message']);return _0x10ecab(_0x496c2e[_0x0bf0('0xe')]['message']);}logger[_0x0bf0('0xe')](_0x0bf0('0xa'),_0x4c4411,_0x496c2e[_0x0bf0('0xe')]['message']);return _0x316075(_0x496c2e[_0x0bf0('0xe')]['message']);}else{logger[_0x0bf0('0x9')](_0x0bf0('0xa'),_0x4c4411,_0x0bf0('0xb'));_0x316075(_0x496c2e[_0x0bf0('0x10')][_0x0bf0('0x11')]);}})[_0x0bf0('0x12')](function(_0x7afa7){logger[_0x0bf0('0xe')]('DeskAccount,\x20%s,\x20%s',_0x4c4411,_0x7afa7);_0x10ecab(_0x7afa7);});});}exports[_0x0bf0('0x13')]=function(_0x34c79e){var _0x49f14e=this;return new Promise(function(_0x3b542a,_0x5da0fc){return db[_0x0bf0('0x14')][_0x0bf0('0x15')]({'raw':_0x34c79e['options']?_0x34c79e[_0x0bf0('0x16')][_0x0bf0('0x17')]===undefined?!![]:![]:!![],'where':_0x34c79e[_0x0bf0('0x16')]?_0x34c79e['options'][_0x0bf0('0x18')]||null:null,'attributes':_0x34c79e['options']?_0x34c79e[_0x0bf0('0x16')][_0x0bf0('0x19')]||null:null,'limit':_0x34c79e[_0x0bf0('0x16')]?_0x34c79e['options'][_0x0bf0('0x1a')]||null:null,'include':_0x34c79e[_0x0bf0('0x16')]?_0x34c79e[_0x0bf0('0x16')][_0x0bf0('0x1b')]?_[_0x0bf0('0x1c')](_0x34c79e[_0x0bf0('0x16')][_0x0bf0('0x1b')],function(_0xfc4c94){return{'model':db[_0xfc4c94[_0x0bf0('0x1d')]],'as':_0xfc4c94['as'],'attributes':_0xfc4c94[_0x0bf0('0x19')],'include':_0xfc4c94[_0x0bf0('0x1b')]?_[_0x0bf0('0x1c')](_0xfc4c94[_0x0bf0('0x1b')],function(_0x5512e2){return{'model':db[_0x5512e2[_0x0bf0('0x1d')]],'as':_0x5512e2['as'],'attributes':_0x5512e2[_0x0bf0('0x19')],'include':_0x5512e2['include']?_[_0x0bf0('0x1c')](_0x5512e2['include'],function(_0x4a62d3){return{'model':db[_0x4a62d3[_0x0bf0('0x1d')]],'as':_0x4a62d3['as'],'attributes':_0x4a62d3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x207bd6){logger[_0x0bf0('0x9')](_0x0bf0('0x13'),_0x34c79e);logger[_0x0bf0('0xc')]('GetDeskAccount',_0x34c79e,JSON['stringify'](_0x207bd6));_0x3b542a(_0x207bd6);})['catch'](function(_0xf54e41){logger[_0x0bf0('0xe')]('GetDeskAccount',_0xf54e41['message'],_0x34c79e);_0x5da0fc(_0x49f14e['error'](0x1f4,_0xf54e41[_0x0bf0('0x11')]));});});};exports[_0x0bf0('0x1e')]=function(_0x495c8a){var _0x2f1553=this;return new Promise(function(_0x55dfeb,_0x18baf9){return db[_0x0bf0('0x14')][_0x0bf0('0x1f')]({'raw':_0x495c8a[_0x0bf0('0x16')]?_0x495c8a[_0x0bf0('0x16')][_0x0bf0('0x17')]===undefined?!![]:![]:!![],'where':_0x495c8a[_0x0bf0('0x16')]?_0x495c8a[_0x0bf0('0x16')][_0x0bf0('0x18')]||null:null,'attributes':_0x495c8a['options']?_0x495c8a[_0x0bf0('0x16')][_0x0bf0('0x19')]||null:null,'include':_0x495c8a[_0x0bf0('0x16')]?_0x495c8a[_0x0bf0('0x16')][_0x0bf0('0x1b')]?_[_0x0bf0('0x1c')](_0x495c8a[_0x0bf0('0x16')]['include'],function(_0x32d4ab){return{'model':db[_0x32d4ab[_0x0bf0('0x1d')]],'as':_0x32d4ab['as'],'attributes':_0x32d4ab[_0x0bf0('0x19')],'include':_0x32d4ab['include']?_['map'](_0x32d4ab['include'],function(_0x822081){return{'model':db[_0x822081[_0x0bf0('0x1d')]],'as':_0x822081['as'],'attributes':_0x822081['attributes'],'include':_0x822081[_0x0bf0('0x1b')]?_['map'](_0x822081['include'],function(_0x2db2ad){return{'model':db[_0x2db2ad['model']],'as':_0x2db2ad['as'],'attributes':_0x2db2ad[_0x0bf0('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x181bb7){logger['info']('ShowDeskAccount',_0x495c8a);logger[_0x0bf0('0xc')]('ShowDeskAccount',_0x495c8a,JSON[_0x0bf0('0x20')](_0x181bb7));_0x55dfeb(_0x181bb7);})[_0x0bf0('0x12')](function(_0x84254c){logger['error'](_0x0bf0('0x1e'),_0x84254c['message'],_0x495c8a);_0x18baf9(_0x2f1553[_0x0bf0('0xe')](0x1f4,_0x84254c[_0x0bf0('0x11')]));});});}; \ No newline at end of file +var _0x020b=['model','then','GetDeskAccount','find','raw','ShowDeskAccount','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','DeskAccount','options','where','attributes','limit','include','map'];(function(_0x18f685,_0x18d9d9){var _0x46a02e=function(_0x1064d0){while(--_0x1064d0){_0x18f685['push'](_0x18f685['shift']());}};_0x46a02e(++_0x18d9d9);}(_0x020b,0x15a));var _0xb020=function(_0x223612,_0x3d61d3){_0x223612=_0x223612-0x0;var _0x4198e7=_0x020b[_0x223612];return _0x4198e7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb020('0x0'));var BPromise=require(_0xb020('0x1'));var rs=require(_0xb020('0x2'));var fs=require('fs');var Redis=require(_0xb020('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb020('0x4'));var logger=require(_0xb020('0x5'))('rpc');var config=require(_0xb020('0x6'));var jayson=require(_0xb020('0x7'));var client=jayson[_0xb020('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14330e,_0x4e23f9,_0x41e5ea){return new BPromise(function(_0x8399d3,_0x459fe1){return client[_0xb020('0x9')](_0x14330e,_0x41e5ea)['then'](function(_0x48b47d){logger[_0xb020('0xa')](_0xb020('0xb'),_0x4e23f9,'request\x20sent');logger[_0xb020('0xc')](_0xb020('0xd'),_0x4e23f9,_0xb020('0xe'),JSON[_0xb020('0xf')](_0x48b47d));if(_0x48b47d[_0xb020('0x10')]){if(_0x48b47d[_0xb020('0x10')][_0xb020('0x11')]===0x1f4){logger[_0xb020('0x10')](_0xb020('0xb'),_0x4e23f9,_0x48b47d['error'][_0xb020('0x12')]);return _0x459fe1(_0x48b47d[_0xb020('0x10')][_0xb020('0x12')]);}logger[_0xb020('0x10')](_0xb020('0xb'),_0x4e23f9,_0x48b47d[_0xb020('0x10')]['message']);return _0x8399d3(_0x48b47d[_0xb020('0x10')]['message']);}else{logger[_0xb020('0xa')](_0xb020('0xb'),_0x4e23f9,_0xb020('0xe'));_0x8399d3(_0x48b47d[_0xb020('0x13')][_0xb020('0x12')]);}})[_0xb020('0x14')](function(_0x48a96b){logger[_0xb020('0x10')]('DeskAccount,\x20%s,\x20%s',_0x4e23f9,_0x48a96b);_0x459fe1(_0x48a96b);});});}exports['GetDeskAccount']=function(_0x4c769b){var _0x11348b=this;return new Promise(function(_0x51bd4a,_0xd3190){return db[_0xb020('0x15')]['findAll']({'raw':_0x4c769b['options']?_0x4c769b[_0xb020('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4c769b[_0xb020('0x16')]?_0x4c769b['options'][_0xb020('0x17')]||null:null,'attributes':_0x4c769b['options']?_0x4c769b[_0xb020('0x16')][_0xb020('0x18')]||null:null,'limit':_0x4c769b['options']?_0x4c769b['options'][_0xb020('0x19')]||null:null,'include':_0x4c769b[_0xb020('0x16')]?_0x4c769b[_0xb020('0x16')][_0xb020('0x1a')]?_[_0xb020('0x1b')](_0x4c769b[_0xb020('0x16')]['include'],function(_0x4be729){return{'model':db[_0x4be729[_0xb020('0x1c')]],'as':_0x4be729['as'],'attributes':_0x4be729[_0xb020('0x18')],'include':_0x4be729['include']?_[_0xb020('0x1b')](_0x4be729[_0xb020('0x1a')],function(_0x4f4d9a){return{'model':db[_0x4f4d9a[_0xb020('0x1c')]],'as':_0x4f4d9a['as'],'attributes':_0x4f4d9a[_0xb020('0x18')],'include':_0x4f4d9a[_0xb020('0x1a')]?_['map'](_0x4f4d9a[_0xb020('0x1a')],function(_0x2517dd){return{'model':db[_0x2517dd[_0xb020('0x1c')]],'as':_0x2517dd['as'],'attributes':_0x2517dd[_0xb020('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb020('0x1d')](function(_0x144db8){logger[_0xb020('0xa')](_0xb020('0x1e'),_0x4c769b);logger[_0xb020('0xc')](_0xb020('0x1e'),_0x4c769b,JSON[_0xb020('0xf')](_0x144db8));_0x51bd4a(_0x144db8);})[_0xb020('0x14')](function(_0x1ca499){logger[_0xb020('0x10')](_0xb020('0x1e'),_0x1ca499[_0xb020('0x12')],_0x4c769b);_0xd3190(_0x11348b['error'](0x1f4,_0x1ca499[_0xb020('0x12')]));});});};exports['ShowDeskAccount']=function(_0x32821e){var _0x3686c7=this;return new Promise(function(_0x3d0ae3,_0x38ea6f){return db[_0xb020('0x15')][_0xb020('0x1f')]({'raw':_0x32821e[_0xb020('0x16')]?_0x32821e[_0xb020('0x16')][_0xb020('0x20')]===undefined?!![]:![]:!![],'where':_0x32821e['options']?_0x32821e[_0xb020('0x16')][_0xb020('0x17')]||null:null,'attributes':_0x32821e[_0xb020('0x16')]?_0x32821e[_0xb020('0x16')][_0xb020('0x18')]||null:null,'include':_0x32821e['options']?_0x32821e[_0xb020('0x16')][_0xb020('0x1a')]?_[_0xb020('0x1b')](_0x32821e[_0xb020('0x16')]['include'],function(_0x241e94){return{'model':db[_0x241e94['model']],'as':_0x241e94['as'],'attributes':_0x241e94['attributes'],'include':_0x241e94['include']?_[_0xb020('0x1b')](_0x241e94[_0xb020('0x1a')],function(_0x3e5cef){return{'model':db[_0x3e5cef[_0xb020('0x1c')]],'as':_0x3e5cef['as'],'attributes':_0x3e5cef['attributes'],'include':_0x3e5cef['include']?_[_0xb020('0x1b')](_0x3e5cef[_0xb020('0x1a')],function(_0x56f35f){return{'model':db[_0x56f35f['model']],'as':_0x56f35f['as'],'attributes':_0x56f35f[_0xb020('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x241b97){logger[_0xb020('0xa')](_0xb020('0x21'),_0x32821e);logger[_0xb020('0xc')](_0xb020('0x21'),_0x32821e,JSON[_0xb020('0xf')](_0x241b97));_0x3d0ae3(_0x241b97);})[_0xb020('0x14')](function(_0x5d1747){logger[_0xb020('0x10')](_0xb020('0x21'),_0x5d1747[_0xb020('0x12')],_0x32821e);_0x38ea6f(_0x3686c7[_0xb020('0x10')](0x1f4,_0x5d1747[_0xb020('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a516886..2be805d 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 _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(_0x306a4f,_0x1787e9){var _0x1b3a4a=function(_0x484d29){while(--_0x484d29){_0x306a4f['push'](_0x306a4f['shift']());}};_0x1b3a4a(++_0x1787e9);}(_0x34e8,0x12c));var _0x834e=function(_0x1694e9,_0x1ffe32){_0x1694e9=_0x1694e9-0x0;var _0x5195d6=_0x34e8[_0x1694e9];return _0x5195d6;};'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 +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(_0xd35c1b,_0x475106){var _0x519fc0=function(_0x374179){while(--_0x374179){_0xd35c1b['push'](_0xd35c1b['shift']());}};_0x519fc0(++_0x475106);}(_0x34e8,0x12c));var _0x834e=function(_0x2f078d,_0x170d9a){_0x2f078d=_0x2f078d-0x0;var _0x14af6c=_0x34e8[_0x2f078d];return _0x14af6c;};'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 2121a59..17e909a 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 _0xf2ee=['exports','STRING','sequelize'];(function(_0x8ae1c9,_0x1c61ab){var _0x18b221=function(_0x264532){while(--_0x264532){_0x8ae1c9['push'](_0x8ae1c9['shift']());}};_0x18b221(++_0x1c61ab);}(_0xf2ee,0x98));var _0xef2e=function(_0x2e92c4,_0xb48dff){_0x2e92c4=_0x2e92c4-0x0;var _0x41bb83=_0xf2ee[_0x2e92c4];return _0x41bb83;};'use strict';var Sequelize=require(_0xef2e('0x0'));module[_0xef2e('0x1')]={'name':{'type':Sequelize[_0xef2e('0x2')]},'description':{'type':Sequelize[_0xef2e('0x2')]}}; \ No newline at end of file +var _0x381a=['exports','STRING','sequelize'];(function(_0x17791f,_0x1d16d8){var _0x332dc4=function(_0x32873b){while(--_0x32873b){_0x17791f['push'](_0x17791f['shift']());}};_0x332dc4(++_0x1d16d8);}(_0x381a,0x122));var _0xa381=function(_0x4e814f,_0x212439){_0x4e814f=_0x4e814f-0x0;var _0x4f40de=_0x381a[_0x4e814f];return _0x4f40de;};'use strict';var Sequelize=require(_0xa381('0x0'));module[_0xa381('0x1')]={'name':{'type':Sequelize[_0xa381('0x2')]},'description':{'type':Sequelize[_0xa381('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 2b8f4c5..c1e56be 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 _0xa429=['length','model','hasOwnProperty','nolimit','order','where','merge','type','VIRTUAL','filter','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','getFields','findOne','DeskField','sort','pick','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','rawAttributes','fieldName','map','query','keys','filters','attributes','fields'];(function(_0x1b6636,_0x58651a){var _0x21daeb=function(_0x4f347b){while(--_0x4f347b){_0x1b6636['push'](_0x1b6636['shift']());}};_0x21daeb(++_0x58651a);}(_0xa429,0x120));var _0x9a42=function(_0x1806da,_0xe441ff){_0x1806da=_0x1806da-0x0;var _0xbced1c=_0xa429[_0x1806da];return _0xbced1c;};'use strict';var emlformat=require(_0x9a42('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a42('0x1'));var jsonpatch=require(_0x9a42('0x2'));var rp=require(_0x9a42('0x3'));var moment=require(_0x9a42('0x4'));var BPromise=require(_0x9a42('0x5'));var Mustache=require(_0x9a42('0x6'));var util=require('util');var path=require(_0x9a42('0x7'));var sox=require(_0x9a42('0x8'));var csv=require(_0x9a42('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a42('0xa'));var _=require(_0x9a42('0xb'));var squel=require(_0x9a42('0xc'));var crypto=require(_0x9a42('0xd'));var jsforce=require(_0x9a42('0xe'));var deskjs=require(_0x9a42('0xf'));var toCsv=require(_0x9a42('0x9'));var querystring=require(_0x9a42('0x10'));var Papa=require('papaparse');var Redis=require(_0x9a42('0x11'));var authService=require(_0x9a42('0x12'));var qs=require(_0x9a42('0x13'));var as=require(_0x9a42('0x14'));var hardwareService=require(_0x9a42('0x15'));var logger=require(_0x9a42('0x16'))(_0x9a42('0x17'));var utils=require(_0x9a42('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9a42('0x19'));var db=require(_0x9a42('0x1a'))['db'];function respondWithStatusCode(_0x9f983a,_0x455062){_0x455062=_0x455062||0xcc;return function(_0x2f9b6b){if(_0x2f9b6b){return _0x9f983a[_0x9a42('0x1b')](_0x455062);}return _0x9f983a['status'](_0x455062)['end']();};}function respondWithResult(_0x32a5ac,_0x90a201){_0x90a201=_0x90a201||0xc8;return function(_0x5226eb){if(_0x5226eb){return _0x32a5ac[_0x9a42('0x1c')](_0x90a201)['json'](_0x5226eb);}};}function respondWithFilteredResult(_0x368e74,_0x2470b2){return function(_0x293471){if(_0x293471){var _0x2de816=typeof _0x2470b2[_0x9a42('0x1d')]===_0x9a42('0x1e')&&typeof _0x2470b2[_0x9a42('0x1f')]===_0x9a42('0x1e');var _0x141b72=_0x293471[_0x9a42('0x20')];var _0x530080=_0x2de816?0x0:_0x2470b2[_0x9a42('0x1d')];var _0xf14f50=_0x2de816?_0x293471[_0x9a42('0x20')]:_0x2470b2[_0x9a42('0x1d')]+_0x2470b2[_0x9a42('0x1f')];var _0x4fac39;if(_0xf14f50>=_0x141b72){_0xf14f50=_0x141b72;_0x4fac39=0xc8;}else{_0x4fac39=0xce;}_0x368e74[_0x9a42('0x1c')](_0x4fac39);return _0x368e74['set'](_0x9a42('0x21'),_0x530080+'-'+_0xf14f50+'/'+_0x141b72)[_0x9a42('0x22')](_0x293471);}return null;};}function patchUpdates(_0x510cf0){return function(_0x11931e){try{jsonpatch[_0x9a42('0x23')](_0x11931e,_0x510cf0,!![]);}catch(_0x3eab33){return BPromise[_0x9a42('0x24')](_0x3eab33);}return _0x11931e[_0x9a42('0x25')]();};}function saveUpdates(_0x5dfc60,_0x5394c4){return function(_0x1d7af0){if(_0x1d7af0){return _0x1d7af0[_0x9a42('0x26')](_0x5dfc60)[_0x9a42('0x27')](function(_0x2d1b77){return _0x2d1b77;});}return null;};}function removeEntity(_0x2b141f,_0x33cacb){return function(_0x38fed5){if(_0x38fed5){return _0x38fed5[_0x9a42('0x28')]()['then'](function(){_0x2b141f[_0x9a42('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36d574,_0x3b6eec){return function(_0x5bfd4b){if(!_0x5bfd4b){_0x36d574[_0x9a42('0x1b')](0x194);}return _0x5bfd4b;};}function handleError(_0x2c24ff,_0x466f40){_0x466f40=_0x466f40||0x1f4;return function(_0x383b5e){logger['error'](_0x383b5e['stack']);if(_0x383b5e[_0x9a42('0x29')]){delete _0x383b5e['name'];}_0x2c24ff[_0x9a42('0x1c')](_0x466f40)[_0x9a42('0x2a')](_0x383b5e);};}exports[_0x9a42('0x2b')]=function(_0x5afd38,_0x376582){var _0x17de9b={},_0x31d648={},_0x2534c4={'count':0x0,'rows':[]};var _0x38e99d=_['map'](db['DeskConfiguration'][_0x9a42('0x2c')],function(_0x16be37){return{'name':_0x16be37[_0x9a42('0x2d')],'type':_0x16be37['type']['key']};});_0x31d648['model']=_[_0x9a42('0x2e')](_0x38e99d,_0x9a42('0x29'));_0x31d648[_0x9a42('0x2f')]=_[_0x9a42('0x30')](_0x5afd38[_0x9a42('0x2f')]);_0x31d648[_0x9a42('0x31')]=_['intersection'](_0x31d648['model'],_0x31d648[_0x9a42('0x2f')]);_0x17de9b[_0x9a42('0x32')]=_['intersection'](_0x31d648['model'],qs[_0x9a42('0x33')](_0x5afd38['query'][_0x9a42('0x33')]));_0x17de9b['attributes']=_0x17de9b['attributes'][_0x9a42('0x34')]?_0x17de9b[_0x9a42('0x32')]:_0x31d648[_0x9a42('0x35')];if(!_0x5afd38[_0x9a42('0x2f')][_0x9a42('0x36')](_0x9a42('0x37'))){_0x17de9b['limit']=qs['limit'](_0x5afd38[_0x9a42('0x2f')][_0x9a42('0x1f')]);_0x17de9b[_0x9a42('0x1d')]=qs['offset'](_0x5afd38['query']['offset']);}_0x17de9b[_0x9a42('0x38')]=qs['sort'](_0x5afd38[_0x9a42('0x2f')]['sort']);_0x17de9b[_0x9a42('0x39')]=qs['filters'](_['pick'](_0x5afd38['query'],_0x31d648['filters']),_0x38e99d);if(_0x5afd38[_0x9a42('0x2f')]['filter']){_0x17de9b[_0x9a42('0x39')]=_[_0x9a42('0x3a')](_0x17de9b[_0x9a42('0x39')],{'$or':_[_0x9a42('0x2e')](_0x38e99d,function(_0x256079){if(_0x256079[_0x9a42('0x3b')]!==_0x9a42('0x3c')){var _0x43b0eb={};_0x43b0eb[_0x256079[_0x9a42('0x29')]]={'$like':'%'+_0x5afd38['query'][_0x9a42('0x3d')]+'%'};return _0x43b0eb;}})});}_0x17de9b=_[_0x9a42('0x3a')]({},_0x17de9b,_0x5afd38[_0x9a42('0x3e')]);var _0x404f53={'where':_0x17de9b[_0x9a42('0x39')]};return db[_0x9a42('0x3f')][_0x9a42('0x20')](_0x404f53)['then'](function(_0x54a242){_0x2534c4[_0x9a42('0x20')]=_0x54a242;if(_0x5afd38[_0x9a42('0x2f')][_0x9a42('0x40')]){_0x17de9b[_0x9a42('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x9a42('0x42')](_0x17de9b);})[_0x9a42('0x27')](function(_0xd34bad){_0x2534c4[_0x9a42('0x43')]=_0xd34bad;return _0x2534c4;})[_0x9a42('0x27')](respondWithFilteredResult(_0x376582,_0x17de9b))[_0x9a42('0x44')](handleError(_0x376582,null));};exports[_0x9a42('0x45')]=function(_0x4e1100,_0x48e308){var _0x5ead52={'raw':![],'where':{'id':_0x4e1100[_0x9a42('0x46')]['id']}},_0x45e001={};_0x45e001[_0x9a42('0x35')]=_['keys'](db[_0x9a42('0x3f')][_0x9a42('0x2c')]);_0x45e001[_0x9a42('0x2f')]=_[_0x9a42('0x30')](_0x4e1100[_0x9a42('0x2f')]);_0x45e001[_0x9a42('0x31')]=_[_0x9a42('0x47')](_0x45e001['model'],_0x45e001[_0x9a42('0x2f')]);_0x5ead52[_0x9a42('0x32')]=_[_0x9a42('0x47')](_0x45e001[_0x9a42('0x35')],qs[_0x9a42('0x33')](_0x4e1100[_0x9a42('0x2f')][_0x9a42('0x33')]));_0x5ead52[_0x9a42('0x32')]=_0x5ead52[_0x9a42('0x32')]['length']?_0x5ead52[_0x9a42('0x32')]:_0x45e001['model'];if(_0x4e1100[_0x9a42('0x2f')][_0x9a42('0x40')]){_0x5ead52[_0x9a42('0x41')]=[{'all':!![]}];}_0x5ead52=_[_0x9a42('0x3a')]({},_0x5ead52,_0x4e1100[_0x9a42('0x3e')]);return db[_0x9a42('0x3f')][_0x9a42('0x48')](_0x5ead52)['then'](handleEntityNotFound(_0x48e308,null))['then'](respondWithResult(_0x48e308,null))['catch'](handleError(_0x48e308,null));};exports[_0x9a42('0x49')]=function(_0x501bd3,_0x2785b9){return db['DeskConfiguration'][_0x9a42('0x49')](_0x501bd3[_0x9a42('0x4a')],{})[_0x9a42('0x27')](respondWithResult(_0x2785b9,0xc9))[_0x9a42('0x44')](handleError(_0x2785b9,null));};exports[_0x9a42('0x26')]=function(_0x1a1a59,_0x252744){if(_0x1a1a59['body']['id']){delete _0x1a1a59[_0x9a42('0x4a')]['id'];}return db[_0x9a42('0x3f')]['find']({'where':{'id':_0x1a1a59[_0x9a42('0x46')]['id']}})[_0x9a42('0x27')](handleEntityNotFound(_0x252744,null))[_0x9a42('0x27')](saveUpdates(_0x1a1a59['body'],null))[_0x9a42('0x27')](respondWithResult(_0x252744,null))[_0x9a42('0x44')](handleError(_0x252744,null));};exports[_0x9a42('0x28')]=function(_0x49372e,_0x37cbea){return db['DeskConfiguration'][_0x9a42('0x48')]({'where':{'id':_0x49372e['params']['id']}})['then'](handleEntityNotFound(_0x37cbea,null))[_0x9a42('0x27')](removeEntity(_0x37cbea,null))[_0x9a42('0x44')](handleError(_0x37cbea,null));};exports[_0x9a42('0x4b')]=function(_0x177854,_0x127ef5,_0x5b840c){var _0x14c7b4={};var _0x2095a3={};var _0x3eee0a;var _0x4ce7bc;return db['DeskConfiguration'][_0x9a42('0x4c')]({'where':{'id':_0x177854[_0x9a42('0x46')]['id']}})[_0x9a42('0x27')](handleEntityNotFound(_0x127ef5,null))[_0x9a42('0x27')](function(_0x238ab7){if(_0x238ab7){_0x3eee0a=_0x238ab7;_0x2095a3['model']=_[_0x9a42('0x30')](db[_0x9a42('0x4d')][_0x9a42('0x2c')]);_0x2095a3[_0x9a42('0x2f')]=_[_0x9a42('0x30')](_0x177854[_0x9a42('0x2f')]);_0x2095a3[_0x9a42('0x31')]=_[_0x9a42('0x47')](_0x2095a3[_0x9a42('0x35')],_0x2095a3[_0x9a42('0x2f')]);_0x14c7b4['attributes']=_[_0x9a42('0x47')](_0x2095a3['model'],qs['fields'](_0x177854['query'][_0x9a42('0x33')]));_0x14c7b4[_0x9a42('0x32')]=_0x14c7b4[_0x9a42('0x32')][_0x9a42('0x34')]?_0x14c7b4[_0x9a42('0x32')]:_0x2095a3[_0x9a42('0x35')];_0x14c7b4['order']=qs[_0x9a42('0x4e')](_0x177854['query'][_0x9a42('0x4e')]);_0x14c7b4[_0x9a42('0x39')]=qs[_0x9a42('0x31')](_[_0x9a42('0x4f')](_0x177854['query'],_0x2095a3[_0x9a42('0x31')]));if(_0x177854[_0x9a42('0x2f')]['filter']){_0x14c7b4[_0x9a42('0x39')]=_[_0x9a42('0x3a')](_0x14c7b4[_0x9a42('0x39')],{'$or':_[_0x9a42('0x2e')](_0x14c7b4[_0x9a42('0x32')],function(_0x202944){var _0x423f8b={};_0x423f8b[_0x202944]={'$like':'%'+_0x177854[_0x9a42('0x2f')]['filter']+'%'};return _0x423f8b;})});}_0x14c7b4=_['merge']({},_0x14c7b4,_0x177854['options']);return _0x3eee0a['getFields'](_0x14c7b4);}})[_0x9a42('0x27')](function(_0x2cfe28){if(_0x2cfe28){_0x4ce7bc=_0x2cfe28[_0x9a42('0x34')];if(!_0x177854[_0x9a42('0x2f')][_0x9a42('0x36')]('nolimit')){_0x14c7b4[_0x9a42('0x1f')]=qs[_0x9a42('0x1f')](_0x177854['query']['limit']);_0x14c7b4['offset']=qs['offset'](_0x177854[_0x9a42('0x2f')][_0x9a42('0x1d')]);}return _0x3eee0a['getFields'](_0x14c7b4);}})[_0x9a42('0x27')](function(_0x5c93e4){if(_0x5c93e4){return _0x5c93e4?{'count':_0x4ce7bc,'rows':_0x5c93e4}:null;}})[_0x9a42('0x27')](respondWithResult(_0x127ef5,null))[_0x9a42('0x44')](handleError(_0x127ef5,null));};exports[_0x9a42('0x50')]=function(_0x43612b,_0x2cec9d,_0x27be1b){var _0x20dffe={};var _0x5d131b={};var _0x25b88e;var _0x2b88d5;return db[_0x9a42('0x3f')][_0x9a42('0x4c')]({'where':{'id':_0x43612b[_0x9a42('0x46')]['id']}})['then'](handleEntityNotFound(_0x2cec9d,null))[_0x9a42('0x27')](function(_0x55541b){if(_0x55541b){_0x25b88e=_0x55541b;_0x5d131b[_0x9a42('0x35')]=_['keys'](db[_0x9a42('0x4d')][_0x9a42('0x2c')]);_0x5d131b[_0x9a42('0x2f')]=_['keys'](_0x43612b[_0x9a42('0x2f')]);_0x5d131b[_0x9a42('0x31')]=_[_0x9a42('0x47')](_0x5d131b[_0x9a42('0x35')],_0x5d131b[_0x9a42('0x2f')]);_0x20dffe['attributes']=_[_0x9a42('0x47')](_0x5d131b[_0x9a42('0x35')],qs[_0x9a42('0x33')](_0x43612b[_0x9a42('0x2f')][_0x9a42('0x33')]));_0x20dffe[_0x9a42('0x32')]=_0x20dffe[_0x9a42('0x32')]['length']?_0x20dffe[_0x9a42('0x32')]:_0x5d131b['model'];_0x20dffe['order']=qs[_0x9a42('0x4e')](_0x43612b['query'][_0x9a42('0x4e')]);_0x20dffe[_0x9a42('0x39')]=qs[_0x9a42('0x31')](_[_0x9a42('0x4f')](_0x43612b[_0x9a42('0x2f')],_0x5d131b[_0x9a42('0x31')]));if(_0x43612b[_0x9a42('0x2f')][_0x9a42('0x3d')]){_0x20dffe[_0x9a42('0x39')]=_[_0x9a42('0x3a')](_0x20dffe[_0x9a42('0x39')],{'$or':_[_0x9a42('0x2e')](_0x20dffe[_0x9a42('0x32')],function(_0x120ad1){var _0x233e07={};_0x233e07[_0x120ad1]={'$like':'%'+_0x43612b[_0x9a42('0x2f')]['filter']+'%'};return _0x233e07;})});}_0x20dffe=_['merge']({},_0x20dffe,_0x43612b[_0x9a42('0x3e')]);return _0x25b88e[_0x9a42('0x50')](_0x20dffe);}})[_0x9a42('0x27')](function(_0x262b17){if(_0x262b17){_0x2b88d5=_0x262b17[_0x9a42('0x34')];if(!_0x43612b[_0x9a42('0x2f')][_0x9a42('0x36')](_0x9a42('0x37'))){_0x20dffe[_0x9a42('0x1f')]=qs[_0x9a42('0x1f')](_0x43612b[_0x9a42('0x2f')][_0x9a42('0x1f')]);_0x20dffe[_0x9a42('0x1d')]=qs[_0x9a42('0x1d')](_0x43612b['query']['offset']);}return _0x25b88e[_0x9a42('0x50')](_0x20dffe);}})[_0x9a42('0x27')](function(_0x32702b){if(_0x32702b){return _0x32702b?{'count':_0x2b88d5,'rows':_0x32702b}:null;}})[_0x9a42('0x27')](respondWithResult(_0x2cec9d,null))[_0x9a42('0x44')](handleError(_0x2cec9d,null));};exports['getDescriptions']=function(_0x3f628c,_0x5ef4b2,_0x40d23d){var _0x47c612={};var _0x350832={};var _0x4a3845;var _0x5da1c0;return db['DeskConfiguration'][_0x9a42('0x4c')]({'where':{'id':_0x3f628c[_0x9a42('0x46')]['id']}})[_0x9a42('0x27')](handleEntityNotFound(_0x5ef4b2,null))[_0x9a42('0x27')](function(_0x55a216){if(_0x55a216){_0x4a3845=_0x55a216;_0x350832[_0x9a42('0x35')]=_[_0x9a42('0x30')](db[_0x9a42('0x4d')][_0x9a42('0x2c')]);_0x350832[_0x9a42('0x2f')]=_['keys'](_0x3f628c[_0x9a42('0x2f')]);_0x350832[_0x9a42('0x31')]=_['intersection'](_0x350832['model'],_0x350832[_0x9a42('0x2f')]);_0x47c612['attributes']=_[_0x9a42('0x47')](_0x350832[_0x9a42('0x35')],qs[_0x9a42('0x33')](_0x3f628c[_0x9a42('0x2f')][_0x9a42('0x33')]));_0x47c612[_0x9a42('0x32')]=_0x47c612[_0x9a42('0x32')]['length']?_0x47c612[_0x9a42('0x32')]:_0x350832[_0x9a42('0x35')];_0x47c612[_0x9a42('0x38')]=qs['sort'](_0x3f628c[_0x9a42('0x2f')][_0x9a42('0x4e')]);_0x47c612[_0x9a42('0x39')]=qs[_0x9a42('0x31')](_[_0x9a42('0x4f')](_0x3f628c['query'],_0x350832[_0x9a42('0x31')]));if(_0x3f628c['query'][_0x9a42('0x3d')]){_0x47c612[_0x9a42('0x39')]=_[_0x9a42('0x3a')](_0x47c612[_0x9a42('0x39')],{'$or':_[_0x9a42('0x2e')](_0x47c612[_0x9a42('0x32')],function(_0xdd15b6){var _0x5a6c9d={};_0x5a6c9d[_0xdd15b6]={'$like':'%'+_0x3f628c['query'][_0x9a42('0x3d')]+'%'};return _0x5a6c9d;})});}_0x47c612=_['merge']({},_0x47c612,_0x3f628c[_0x9a42('0x3e')]);return _0x4a3845[_0x9a42('0x51')](_0x47c612);}})[_0x9a42('0x27')](function(_0x17018f){if(_0x17018f){_0x5da1c0=_0x17018f[_0x9a42('0x34')];if(!_0x3f628c['query'][_0x9a42('0x36')](_0x9a42('0x37'))){_0x47c612['limit']=qs[_0x9a42('0x1f')](_0x3f628c[_0x9a42('0x2f')]['limit']);_0x47c612[_0x9a42('0x1d')]=qs[_0x9a42('0x1d')](_0x3f628c['query'][_0x9a42('0x1d')]);}return _0x4a3845['getDescriptions'](_0x47c612);}})['then'](function(_0x3abd88){if(_0x3abd88){return _0x3abd88?{'count':_0x5da1c0,'rows':_0x3abd88}:null;}})[_0x9a42('0x27')](respondWithResult(_0x5ef4b2,null))[_0x9a42('0x44')](handleError(_0x5ef4b2,null));};exports['getTags']=function(_0x5c1719,_0x35c06e,_0x4346aa){var _0x1ff5c5={};var _0x40ff86={};var _0x4f7847;var _0x2986ea;return db[_0x9a42('0x3f')][_0x9a42('0x4c')]({'where':{'id':_0x5c1719[_0x9a42('0x46')]['id']}})[_0x9a42('0x27')](handleEntityNotFound(_0x35c06e,null))[_0x9a42('0x27')](function(_0x419499){if(_0x419499){_0x4f7847=_0x419499;_0x40ff86['model']=_[_0x9a42('0x30')](db['Tag'][_0x9a42('0x2c')]);_0x40ff86['query']=_['keys'](_0x5c1719[_0x9a42('0x2f')]);_0x40ff86['filters']=_[_0x9a42('0x47')](_0x40ff86[_0x9a42('0x35')],_0x40ff86['query']);_0x1ff5c5['attributes']=_[_0x9a42('0x47')](_0x40ff86[_0x9a42('0x35')],qs[_0x9a42('0x33')](_0x5c1719[_0x9a42('0x2f')][_0x9a42('0x33')]));_0x1ff5c5[_0x9a42('0x32')]=_0x1ff5c5[_0x9a42('0x32')][_0x9a42('0x34')]?_0x1ff5c5[_0x9a42('0x32')]:_0x40ff86[_0x9a42('0x35')];_0x1ff5c5[_0x9a42('0x38')]=qs[_0x9a42('0x4e')](_0x5c1719[_0x9a42('0x2f')]['sort']);_0x1ff5c5[_0x9a42('0x39')]=qs[_0x9a42('0x31')](_['pick'](_0x5c1719[_0x9a42('0x2f')],_0x40ff86[_0x9a42('0x31')]));if(_0x5c1719[_0x9a42('0x2f')][_0x9a42('0x3d')]){_0x1ff5c5[_0x9a42('0x39')]=_['merge'](_0x1ff5c5['where'],{'$or':_['map'](_0x1ff5c5[_0x9a42('0x32')],function(_0x1f51f9){var _0x5618ad={};_0x5618ad[_0x1f51f9]={'$like':'%'+_0x5c1719['query']['filter']+'%'};return _0x5618ad;})});}_0x1ff5c5=_[_0x9a42('0x3a')]({},_0x1ff5c5,_0x5c1719[_0x9a42('0x3e')]);return _0x4f7847[_0x9a42('0x52')](_0x1ff5c5);}})[_0x9a42('0x27')](function(_0x3fd197){if(_0x3fd197){_0x2986ea=_0x3fd197[_0x9a42('0x34')];if(!_0x5c1719[_0x9a42('0x2f')][_0x9a42('0x36')](_0x9a42('0x37'))){_0x1ff5c5[_0x9a42('0x1f')]=qs['limit'](_0x5c1719[_0x9a42('0x2f')][_0x9a42('0x1f')]);_0x1ff5c5['offset']=qs[_0x9a42('0x1d')](_0x5c1719[_0x9a42('0x2f')][_0x9a42('0x1d')]);}return _0x4f7847[_0x9a42('0x52')](_0x1ff5c5);}})[_0x9a42('0x27')](function(_0x873539){if(_0x873539){return _0x873539?{'count':_0x2986ea,'rows':_0x873539}:null;}})['then'](respondWithResult(_0x35c06e,null))[_0x9a42('0x44')](handleError(_0x35c06e,null));};exports[_0x9a42('0x53')]=function(_0x395c37,_0x4eb05a,_0x3a4c76){if(_0x395c37[_0x9a42('0x4a')]['id']){delete _0x395c37[_0x9a42('0x4a')]['id'];}return db[_0x9a42('0x3f')][_0x9a42('0x4c')]({'where':{'id':_0x395c37[_0x9a42('0x46')]['id']}})[_0x9a42('0x27')](handleEntityNotFound(_0x4eb05a,null))[_0x9a42('0x27')](function(_0xb3ec4f){if(_0xb3ec4f){return _0xb3ec4f[_0x9a42('0x53')](_0x395c37['body'][_0x9a42('0x54')]||[]);}return null;})[_0x9a42('0x27')](respondWithResult(_0x4eb05a,null))[_0x9a42('0x44')](handleError(_0x4eb05a,null));}; \ No newline at end of file +var _0x3d67=['../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','save','update','then','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','merge','find','create','body','params','getFields','DeskField','nolimit','getSubjects','findOne','order','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x414658,_0x32591f){var _0x3f33b8=function(_0x1ce3f3){while(--_0x1ce3f3){_0x414658['push'](_0x414658['shift']());}};_0x3f33b8(++_0x32591f);}(_0x3d67,0xe7));var _0x73d6=function(_0x3d4ea9,_0x3bded6){_0x3d4ea9=_0x3d4ea9-0x0;var _0x29b6c3=_0x3d67[_0x3d4ea9];return _0x29b6c3;};'use strict';var emlformat=require(_0x73d6('0x0'));var rimraf=require(_0x73d6('0x1'));var zipdir=require(_0x73d6('0x2'));var jsonpatch=require(_0x73d6('0x3'));var rp=require(_0x73d6('0x4'));var moment=require(_0x73d6('0x5'));var BPromise=require(_0x73d6('0x6'));var Mustache=require('mustache');var util=require(_0x73d6('0x7'));var path=require(_0x73d6('0x8'));var sox=require(_0x73d6('0x9'));var csv=require(_0x73d6('0xa'));var ejs=require(_0x73d6('0xb'));var fs=require('fs');var fs_extra=require(_0x73d6('0xc'));var _=require('lodash');var squel=require(_0x73d6('0xd'));var crypto=require(_0x73d6('0xe'));var jsforce=require(_0x73d6('0xf'));var deskjs=require(_0x73d6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x73d6('0x11'));var Papa=require(_0x73d6('0x12'));var Redis=require(_0x73d6('0x13'));var authService=require(_0x73d6('0x14'));var qs=require(_0x73d6('0x15'));var as=require(_0x73d6('0x16'));var hardwareService=require(_0x73d6('0x17'));var logger=require(_0x73d6('0x18'))(_0x73d6('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x73d6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19c376,_0x1c44ac){_0x1c44ac=_0x1c44ac||0xcc;return function(_0x3e1387){if(_0x3e1387){return _0x19c376[_0x73d6('0x1b')](_0x1c44ac);}return _0x19c376['status'](_0x1c44ac)[_0x73d6('0x1c')]();};}function respondWithResult(_0x585697,_0xe00941){_0xe00941=_0xe00941||0xc8;return function(_0x7baaa4){if(_0x7baaa4){return _0x585697[_0x73d6('0x1d')](_0xe00941)[_0x73d6('0x1e')](_0x7baaa4);}};}function respondWithFilteredResult(_0x1cba31,_0x130b5f){return function(_0x92ee57){if(_0x92ee57){var _0x4cd924=typeof _0x130b5f[_0x73d6('0x1f')]===_0x73d6('0x20')&&typeof _0x130b5f[_0x73d6('0x21')]===_0x73d6('0x20');var _0x565055=_0x92ee57[_0x73d6('0x22')];var _0x9c8f10=_0x4cd924?0x0:_0x130b5f[_0x73d6('0x1f')];var _0x29ee01=_0x4cd924?_0x92ee57[_0x73d6('0x22')]:_0x130b5f[_0x73d6('0x1f')]+_0x130b5f[_0x73d6('0x21')];var _0x4fec36;if(_0x29ee01>=_0x565055){_0x29ee01=_0x565055;_0x4fec36=0xc8;}else{_0x4fec36=0xce;}_0x1cba31[_0x73d6('0x1d')](_0x4fec36);return _0x1cba31['set']('Content-Range',_0x9c8f10+'-'+_0x29ee01+'/'+_0x565055)['json'](_0x92ee57);}return null;};}function patchUpdates(_0x1f81de){return function(_0x31466a){try{jsonpatch['apply'](_0x31466a,_0x1f81de,!![]);}catch(_0x51c678){return BPromise['reject'](_0x51c678);}return _0x31466a[_0x73d6('0x23')]();};}function saveUpdates(_0x27bfb9,_0x6d2d0b){return function(_0x4fd420){if(_0x4fd420){return _0x4fd420[_0x73d6('0x24')](_0x27bfb9)[_0x73d6('0x25')](function(_0x3b1231){return _0x3b1231;});}return null;};}function removeEntity(_0x29957b,_0x4c511a){return function(_0x501dce){if(_0x501dce){return _0x501dce['destroy']()[_0x73d6('0x25')](function(){_0x29957b[_0x73d6('0x1d')](0xcc)[_0x73d6('0x1c')]();});}};}function handleEntityNotFound(_0x355312,_0x29a7b2){return function(_0xdbab00){if(!_0xdbab00){_0x355312[_0x73d6('0x1b')](0x194);}return _0xdbab00;};}function handleError(_0x42403d,_0x593b61){_0x593b61=_0x593b61||0x1f4;return function(_0x5c6340){logger[_0x73d6('0x26')](_0x5c6340[_0x73d6('0x27')]);if(_0x5c6340[_0x73d6('0x28')]){delete _0x5c6340[_0x73d6('0x28')];}_0x42403d[_0x73d6('0x1d')](_0x593b61)[_0x73d6('0x29')](_0x5c6340);};}exports[_0x73d6('0x2a')]=function(_0x4a4ee2,_0x2a5ef2){var _0x442266={},_0x45f770={},_0x3ab88a={'count':0x0,'rows':[]};var _0xcf612f=_[_0x73d6('0x2b')](db[_0x73d6('0x2c')][_0x73d6('0x2d')],function(_0x5a68a6){return{'name':_0x5a68a6['fieldName'],'type':_0x5a68a6[_0x73d6('0x2e')][_0x73d6('0x2f')]};});_0x45f770[_0x73d6('0x30')]=_[_0x73d6('0x2b')](_0xcf612f,_0x73d6('0x28'));_0x45f770[_0x73d6('0x31')]=_[_0x73d6('0x32')](_0x4a4ee2[_0x73d6('0x31')]);_0x45f770[_0x73d6('0x33')]=_[_0x73d6('0x34')](_0x45f770[_0x73d6('0x30')],_0x45f770[_0x73d6('0x31')]);_0x442266['attributes']=_[_0x73d6('0x34')](_0x45f770['model'],qs[_0x73d6('0x35')](_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x35')]));_0x442266[_0x73d6('0x36')]=_0x442266[_0x73d6('0x36')][_0x73d6('0x37')]?_0x442266[_0x73d6('0x36')]:_0x45f770['model'];if(!_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x38')]('nolimit')){_0x442266[_0x73d6('0x21')]=qs[_0x73d6('0x21')](_0x4a4ee2[_0x73d6('0x31')]['limit']);_0x442266['offset']=qs[_0x73d6('0x1f')](_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x1f')]);}_0x442266['order']=qs[_0x73d6('0x39')](_0x4a4ee2['query'][_0x73d6('0x39')]);_0x442266[_0x73d6('0x3a')]=qs['filters'](_[_0x73d6('0x3b')](_0x4a4ee2[_0x73d6('0x31')],_0x45f770['filters']),_0xcf612f);if(_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x3c')]){_0x442266[_0x73d6('0x3a')]=_['merge'](_0x442266[_0x73d6('0x3a')],{'$or':_['map'](_0xcf612f,function(_0x2acc61){if(_0x2acc61['type']!==_0x73d6('0x3d')){var _0x1345b7={};_0x1345b7[_0x2acc61['name']]={'$like':'%'+_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x3c')]+'%'};return _0x1345b7;}})});}_0x442266=_['merge']({},_0x442266,_0x4a4ee2[_0x73d6('0x3e')]);var _0x4495db={'where':_0x442266['where']};return db[_0x73d6('0x2c')][_0x73d6('0x22')](_0x4495db)[_0x73d6('0x25')](function(_0xc6ddb8){_0x3ab88a[_0x73d6('0x22')]=_0xc6ddb8;if(_0x4a4ee2[_0x73d6('0x31')][_0x73d6('0x3f')]){_0x442266['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x73d6('0x40')](_0x442266);})['then'](function(_0x484e7e){_0x3ab88a[_0x73d6('0x41')]=_0x484e7e;return _0x3ab88a;})['then'](respondWithFilteredResult(_0x2a5ef2,_0x442266))[_0x73d6('0x42')](handleError(_0x2a5ef2,null));};exports[_0x73d6('0x43')]=function(_0x5f2488,_0x4db0ec){var _0x2003fd={'raw':![],'where':{'id':_0x5f2488['params']['id']}},_0x5b5339={};_0x5b5339[_0x73d6('0x30')]=_['keys'](db[_0x73d6('0x2c')][_0x73d6('0x2d')]);_0x5b5339[_0x73d6('0x31')]=_[_0x73d6('0x32')](_0x5f2488[_0x73d6('0x31')]);_0x5b5339[_0x73d6('0x33')]=_[_0x73d6('0x34')](_0x5b5339[_0x73d6('0x30')],_0x5b5339[_0x73d6('0x31')]);_0x2003fd[_0x73d6('0x36')]=_['intersection'](_0x5b5339[_0x73d6('0x30')],qs[_0x73d6('0x35')](_0x5f2488[_0x73d6('0x31')][_0x73d6('0x35')]));_0x2003fd['attributes']=_0x2003fd['attributes'][_0x73d6('0x37')]?_0x2003fd[_0x73d6('0x36')]:_0x5b5339[_0x73d6('0x30')];if(_0x5f2488[_0x73d6('0x31')][_0x73d6('0x3f')]){_0x2003fd[_0x73d6('0x44')]=[{'all':!![]}];}_0x2003fd=_[_0x73d6('0x45')]({},_0x2003fd,_0x5f2488['options']);return db[_0x73d6('0x2c')][_0x73d6('0x46')](_0x2003fd)[_0x73d6('0x25')](handleEntityNotFound(_0x4db0ec,null))[_0x73d6('0x25')](respondWithResult(_0x4db0ec,null))[_0x73d6('0x42')](handleError(_0x4db0ec,null));};exports['create']=function(_0x34b008,_0x3caa9e){return db[_0x73d6('0x2c')][_0x73d6('0x47')](_0x34b008['body'],{})[_0x73d6('0x25')](respondWithResult(_0x3caa9e,0xc9))['catch'](handleError(_0x3caa9e,null));};exports[_0x73d6('0x24')]=function(_0x3759e4,_0x49670b){if(_0x3759e4[_0x73d6('0x48')]['id']){delete _0x3759e4[_0x73d6('0x48')]['id'];}return db['DeskConfiguration'][_0x73d6('0x46')]({'where':{'id':_0x3759e4[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x49670b,null))[_0x73d6('0x25')](saveUpdates(_0x3759e4[_0x73d6('0x48')],null))['then'](respondWithResult(_0x49670b,null))[_0x73d6('0x42')](handleError(_0x49670b,null));};exports['destroy']=function(_0x5545f0,_0x203450){return db[_0x73d6('0x2c')][_0x73d6('0x46')]({'where':{'id':_0x5545f0[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x203450,null))[_0x73d6('0x25')](removeEntity(_0x203450,null))[_0x73d6('0x42')](handleError(_0x203450,null));};exports[_0x73d6('0x4a')]=function(_0xd1a713,_0xc52f8,_0x34fdc5){var _0x41e130={};var _0x2c5c76={};var _0x514e54;var _0xe7d27;return db['DeskConfiguration']['findOne']({'where':{'id':_0xd1a713[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0xc52f8,null))[_0x73d6('0x25')](function(_0x1d64f5){if(_0x1d64f5){_0x514e54=_0x1d64f5;_0x2c5c76[_0x73d6('0x30')]=_[_0x73d6('0x32')](db[_0x73d6('0x4b')][_0x73d6('0x2d')]);_0x2c5c76[_0x73d6('0x31')]=_[_0x73d6('0x32')](_0xd1a713[_0x73d6('0x31')]);_0x2c5c76[_0x73d6('0x33')]=_[_0x73d6('0x34')](_0x2c5c76[_0x73d6('0x30')],_0x2c5c76[_0x73d6('0x31')]);_0x41e130[_0x73d6('0x36')]=_[_0x73d6('0x34')](_0x2c5c76[_0x73d6('0x30')],qs['fields'](_0xd1a713['query'][_0x73d6('0x35')]));_0x41e130[_0x73d6('0x36')]=_0x41e130['attributes'][_0x73d6('0x37')]?_0x41e130[_0x73d6('0x36')]:_0x2c5c76[_0x73d6('0x30')];_0x41e130['order']=qs[_0x73d6('0x39')](_0xd1a713[_0x73d6('0x31')][_0x73d6('0x39')]);_0x41e130[_0x73d6('0x3a')]=qs[_0x73d6('0x33')](_['pick'](_0xd1a713['query'],_0x2c5c76['filters']));if(_0xd1a713[_0x73d6('0x31')][_0x73d6('0x3c')]){_0x41e130[_0x73d6('0x3a')]=_[_0x73d6('0x45')](_0x41e130[_0x73d6('0x3a')],{'$or':_['map'](_0x41e130[_0x73d6('0x36')],function(_0x3745b6){var _0x2f4a12={};_0x2f4a12[_0x3745b6]={'$like':'%'+_0xd1a713[_0x73d6('0x31')]['filter']+'%'};return _0x2f4a12;})});}_0x41e130=_[_0x73d6('0x45')]({},_0x41e130,_0xd1a713[_0x73d6('0x3e')]);return _0x514e54[_0x73d6('0x4a')](_0x41e130);}})[_0x73d6('0x25')](function(_0x36718b){if(_0x36718b){_0xe7d27=_0x36718b[_0x73d6('0x37')];if(!_0xd1a713[_0x73d6('0x31')]['hasOwnProperty'](_0x73d6('0x4c'))){_0x41e130[_0x73d6('0x21')]=qs[_0x73d6('0x21')](_0xd1a713[_0x73d6('0x31')]['limit']);_0x41e130[_0x73d6('0x1f')]=qs[_0x73d6('0x1f')](_0xd1a713[_0x73d6('0x31')][_0x73d6('0x1f')]);}return _0x514e54[_0x73d6('0x4a')](_0x41e130);}})[_0x73d6('0x25')](function(_0x41d338){if(_0x41d338){return _0x41d338?{'count':_0xe7d27,'rows':_0x41d338}:null;}})[_0x73d6('0x25')](respondWithResult(_0xc52f8,null))[_0x73d6('0x42')](handleError(_0xc52f8,null));};exports[_0x73d6('0x4d')]=function(_0x3cf40a,_0x4b7fa9,_0x31933d){var _0x431447={};var _0x25522d={};var _0x14946c;var _0x33d69c;return db['DeskConfiguration'][_0x73d6('0x4e')]({'where':{'id':_0x3cf40a['params']['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x4b7fa9,null))[_0x73d6('0x25')](function(_0x4b1c89){if(_0x4b1c89){_0x14946c=_0x4b1c89;_0x25522d[_0x73d6('0x30')]=_[_0x73d6('0x32')](db[_0x73d6('0x4b')][_0x73d6('0x2d')]);_0x25522d[_0x73d6('0x31')]=_[_0x73d6('0x32')](_0x3cf40a[_0x73d6('0x31')]);_0x25522d['filters']=_[_0x73d6('0x34')](_0x25522d['model'],_0x25522d['query']);_0x431447[_0x73d6('0x36')]=_[_0x73d6('0x34')](_0x25522d[_0x73d6('0x30')],qs[_0x73d6('0x35')](_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x35')]));_0x431447[_0x73d6('0x36')]=_0x431447['attributes'][_0x73d6('0x37')]?_0x431447['attributes']:_0x25522d[_0x73d6('0x30')];_0x431447[_0x73d6('0x4f')]=qs['sort'](_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x39')]);_0x431447[_0x73d6('0x3a')]=qs[_0x73d6('0x33')](_[_0x73d6('0x3b')](_0x3cf40a['query'],_0x25522d[_0x73d6('0x33')]));if(_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x3c')]){_0x431447[_0x73d6('0x3a')]=_[_0x73d6('0x45')](_0x431447[_0x73d6('0x3a')],{'$or':_[_0x73d6('0x2b')](_0x431447[_0x73d6('0x36')],function(_0x1ac837){var _0x238454={};_0x238454[_0x1ac837]={'$like':'%'+_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x3c')]+'%'};return _0x238454;})});}_0x431447=_['merge']({},_0x431447,_0x3cf40a['options']);return _0x14946c[_0x73d6('0x4d')](_0x431447);}})[_0x73d6('0x25')](function(_0x4f4a92){if(_0x4f4a92){_0x33d69c=_0x4f4a92[_0x73d6('0x37')];if(!_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x38')](_0x73d6('0x4c'))){_0x431447[_0x73d6('0x21')]=qs[_0x73d6('0x21')](_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x21')]);_0x431447[_0x73d6('0x1f')]=qs['offset'](_0x3cf40a[_0x73d6('0x31')][_0x73d6('0x1f')]);}return _0x14946c[_0x73d6('0x4d')](_0x431447);}})['then'](function(_0x5a66c6){if(_0x5a66c6){return _0x5a66c6?{'count':_0x33d69c,'rows':_0x5a66c6}:null;}})[_0x73d6('0x25')](respondWithResult(_0x4b7fa9,null))['catch'](handleError(_0x4b7fa9,null));};exports['getDescriptions']=function(_0x275212,_0x31c060,_0x5aba49){var _0x41a7d7={};var _0x46ef2d={};var _0x37e5b4;var _0x3dc7fb;return db['DeskConfiguration'][_0x73d6('0x4e')]({'where':{'id':_0x275212[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x31c060,null))[_0x73d6('0x25')](function(_0x19d9fa){if(_0x19d9fa){_0x37e5b4=_0x19d9fa;_0x46ef2d[_0x73d6('0x30')]=_[_0x73d6('0x32')](db[_0x73d6('0x4b')][_0x73d6('0x2d')]);_0x46ef2d[_0x73d6('0x31')]=_['keys'](_0x275212[_0x73d6('0x31')]);_0x46ef2d[_0x73d6('0x33')]=_[_0x73d6('0x34')](_0x46ef2d['model'],_0x46ef2d['query']);_0x41a7d7[_0x73d6('0x36')]=_[_0x73d6('0x34')](_0x46ef2d[_0x73d6('0x30')],qs[_0x73d6('0x35')](_0x275212[_0x73d6('0x31')][_0x73d6('0x35')]));_0x41a7d7[_0x73d6('0x36')]=_0x41a7d7[_0x73d6('0x36')][_0x73d6('0x37')]?_0x41a7d7[_0x73d6('0x36')]:_0x46ef2d[_0x73d6('0x30')];_0x41a7d7[_0x73d6('0x4f')]=qs[_0x73d6('0x39')](_0x275212[_0x73d6('0x31')][_0x73d6('0x39')]);_0x41a7d7[_0x73d6('0x3a')]=qs['filters'](_[_0x73d6('0x3b')](_0x275212[_0x73d6('0x31')],_0x46ef2d['filters']));if(_0x275212['query']['filter']){_0x41a7d7[_0x73d6('0x3a')]=_['merge'](_0x41a7d7[_0x73d6('0x3a')],{'$or':_[_0x73d6('0x2b')](_0x41a7d7['attributes'],function(_0x38f1d6){var _0x990c4c={};_0x990c4c[_0x38f1d6]={'$like':'%'+_0x275212[_0x73d6('0x31')][_0x73d6('0x3c')]+'%'};return _0x990c4c;})});}_0x41a7d7=_['merge']({},_0x41a7d7,_0x275212[_0x73d6('0x3e')]);return _0x37e5b4[_0x73d6('0x50')](_0x41a7d7);}})['then'](function(_0x57d754){if(_0x57d754){_0x3dc7fb=_0x57d754[_0x73d6('0x37')];if(!_0x275212[_0x73d6('0x31')][_0x73d6('0x38')](_0x73d6('0x4c'))){_0x41a7d7['limit']=qs[_0x73d6('0x21')](_0x275212[_0x73d6('0x31')][_0x73d6('0x21')]);_0x41a7d7[_0x73d6('0x1f')]=qs[_0x73d6('0x1f')](_0x275212[_0x73d6('0x31')][_0x73d6('0x1f')]);}return _0x37e5b4[_0x73d6('0x50')](_0x41a7d7);}})['then'](function(_0x1a5db6){if(_0x1a5db6){return _0x1a5db6?{'count':_0x3dc7fb,'rows':_0x1a5db6}:null;}})[_0x73d6('0x25')](respondWithResult(_0x31c060,null))['catch'](handleError(_0x31c060,null));};exports['getTags']=function(_0x26865,_0x2a151b,_0x46a5b2){var _0x1964ee={};var _0x26df96={};var _0x40942f;var _0x3619a7;return db['DeskConfiguration'][_0x73d6('0x4e')]({'where':{'id':_0x26865[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x2a151b,null))[_0x73d6('0x25')](function(_0x332630){if(_0x332630){_0x40942f=_0x332630;_0x26df96['model']=_['keys'](db[_0x73d6('0x51')][_0x73d6('0x2d')]);_0x26df96[_0x73d6('0x31')]=_[_0x73d6('0x32')](_0x26865[_0x73d6('0x31')]);_0x26df96[_0x73d6('0x33')]=_[_0x73d6('0x34')](_0x26df96[_0x73d6('0x30')],_0x26df96['query']);_0x1964ee[_0x73d6('0x36')]=_[_0x73d6('0x34')](_0x26df96[_0x73d6('0x30')],qs[_0x73d6('0x35')](_0x26865['query']['fields']));_0x1964ee['attributes']=_0x1964ee[_0x73d6('0x36')][_0x73d6('0x37')]?_0x1964ee[_0x73d6('0x36')]:_0x26df96[_0x73d6('0x30')];_0x1964ee[_0x73d6('0x4f')]=qs[_0x73d6('0x39')](_0x26865[_0x73d6('0x31')][_0x73d6('0x39')]);_0x1964ee['where']=qs[_0x73d6('0x33')](_[_0x73d6('0x3b')](_0x26865['query'],_0x26df96['filters']));if(_0x26865[_0x73d6('0x31')][_0x73d6('0x3c')]){_0x1964ee[_0x73d6('0x3a')]=_[_0x73d6('0x45')](_0x1964ee[_0x73d6('0x3a')],{'$or':_['map'](_0x1964ee['attributes'],function(_0x159f4a){var _0x478b2f={};_0x478b2f[_0x159f4a]={'$like':'%'+_0x26865[_0x73d6('0x31')]['filter']+'%'};return _0x478b2f;})});}_0x1964ee=_[_0x73d6('0x45')]({},_0x1964ee,_0x26865[_0x73d6('0x3e')]);return _0x40942f[_0x73d6('0x52')](_0x1964ee);}})['then'](function(_0x496fb1){if(_0x496fb1){_0x3619a7=_0x496fb1[_0x73d6('0x37')];if(!_0x26865['query'][_0x73d6('0x38')](_0x73d6('0x4c'))){_0x1964ee['limit']=qs[_0x73d6('0x21')](_0x26865[_0x73d6('0x31')]['limit']);_0x1964ee[_0x73d6('0x1f')]=qs[_0x73d6('0x1f')](_0x26865[_0x73d6('0x31')]['offset']);}return _0x40942f[_0x73d6('0x52')](_0x1964ee);}})[_0x73d6('0x25')](function(_0x54c2ba){if(_0x54c2ba){return _0x54c2ba?{'count':_0x3619a7,'rows':_0x54c2ba}:null;}})['then'](respondWithResult(_0x2a151b,null))[_0x73d6('0x42')](handleError(_0x2a151b,null));};exports['setTags']=function(_0x48151e,_0x50eecb,_0x3337a5){if(_0x48151e[_0x73d6('0x48')]['id']){delete _0x48151e[_0x73d6('0x48')]['id'];}return db['DeskConfiguration'][_0x73d6('0x4e')]({'where':{'id':_0x48151e[_0x73d6('0x49')]['id']}})[_0x73d6('0x25')](handleEntityNotFound(_0x50eecb,null))[_0x73d6('0x25')](function(_0x3ec604){if(_0x3ec604){return _0x3ec604[_0x73d6('0x53')](_0x48151e[_0x73d6('0x48')][_0x73d6('0x54')]||[]);}return null;})['then'](respondWithResult(_0x50eecb,null))[_0x73d6('0x42')](handleError(_0x50eecb,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index d950b9d..4fa3a1f 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 _0x93d3=['../../config/logger','path','rimraf','../../config/environment','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93d3,0x1e9));var _0x393d=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x93d3[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x393d('0x0'));var util=require('util');var logger=require(_0x393d('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x393d('0x2'));var rimraf=require(_0x393d('0x3'));var config=require(_0x393d('0x4'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x5192c9,_0x4ae031){return _0x5192c9['define']('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ce9=['DeskConfiguration','int_desk_configurations','../../config/logger','api','moment','path','rimraf','./intDeskConfiguration.attributes','define'];(function(_0x18b4d3,_0x1cc71){var _0x665332=function(_0x27e3d9){while(--_0x27e3d9){_0x18b4d3['push'](_0x18b4d3['shift']());}};_0x665332(++_0x1cc71);}(_0x2ce9,0x65));var _0x92ce=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x2ce9[_0x5e709a];return _0x57401a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x92ce('0x0'))(_0x92ce('0x1'));var moment=require(_0x92ce('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x92ce('0x3'));var rimraf=require(_0x92ce('0x4'));var config=require('../../config/environment');var attributes=require(_0x92ce('0x5'));module['exports']=function(_0x197a7c,_0x377eb6){return _0x197a7c[_0x92ce('0x6')](_0x92ce('0x7'),attributes,{'tableName':_0x92ce('0x8'),'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 ed946ba..c0825d8 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 _0x8254=['then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xf1c26,_0x234e15){var _0x36287c=function(_0x25838a){while(--_0x25838a){_0xf1c26['push'](_0xf1c26['shift']());}};_0x36287c(++_0x234e15);}(_0x8254,0x95));var _0x4825=function(_0x43a7e3,_0x27139e){_0x43a7e3=_0x43a7e3-0x0;var _0x2ec240=_0x8254[_0x43a7e3];return _0x2ec240;};'use strict';var _=require(_0x4825('0x0'));var util=require('util');var moment=require(_0x4825('0x1'));var BPromise=require('bluebird');var rs=require(_0x4825('0x2'));var fs=require('fs');var Redis=require(_0x4825('0x3'));var db=require(_0x4825('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4825('0x5'))(_0x4825('0x6'));var config=require(_0x4825('0x7'));var jayson=require(_0x4825('0x8'));var client=jayson[_0x4825('0x9')][_0x4825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a071e,_0x28332c,_0x20cd0e){return new BPromise(function(_0x3c8ed4,_0x547731){return client[_0x4825('0xb')](_0x5a071e,_0x20cd0e)[_0x4825('0xc')](function(_0x2a36c5){logger[_0x4825('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x28332c,_0x4825('0xe'));logger[_0x4825('0xf')](_0x4825('0x10'),_0x28332c,'request\x20sent',JSON[_0x4825('0x11')](_0x2a36c5));if(_0x2a36c5[_0x4825('0x12')]){if(_0x2a36c5[_0x4825('0x12')][_0x4825('0x13')]===0x1f4){logger[_0x4825('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x28332c,_0x2a36c5[_0x4825('0x12')][_0x4825('0x14')]);return _0x547731(_0x2a36c5[_0x4825('0x12')][_0x4825('0x14')]);}logger[_0x4825('0x12')](_0x4825('0x15'),_0x28332c,_0x2a36c5[_0x4825('0x12')][_0x4825('0x14')]);return _0x3c8ed4(_0x2a36c5[_0x4825('0x12')]['message']);}else{logger[_0x4825('0xd')](_0x4825('0x15'),_0x28332c,_0x4825('0xe'));_0x3c8ed4(_0x2a36c5[_0x4825('0x16')]['message']);}})['catch'](function(_0x5286fb){logger[_0x4825('0x12')](_0x4825('0x15'),_0x28332c,_0x5286fb);_0x547731(_0x5286fb);});});} \ No newline at end of file +var _0x839b=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x839b,0x1d5));var _0xb839=function(_0x5eb675,_0xe3e9a){_0x5eb675=_0x5eb675-0x0;var _0x52e4f8=_0x839b[_0x5eb675];return _0x52e4f8;};'use strict';var _=require(_0xb839('0x0'));var util=require(_0xb839('0x1'));var moment=require('moment');var BPromise=require(_0xb839('0x2'));var rs=require(_0xb839('0x3'));var fs=require('fs');var Redis=require(_0xb839('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb839('0x5'));var logger=require('../../config/logger')(_0xb839('0x6'));var config=require(_0xb839('0x7'));var jayson=require(_0xb839('0x8'));var client=jayson[_0xb839('0x9')][_0xb839('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25641e,_0x40a760,_0x37c964){return new BPromise(function(_0x3d50f4,_0x49b08c){return client['request'](_0x25641e,_0x37c964)[_0xb839('0xb')](function(_0x1333cb){logger[_0xb839('0xc')](_0xb839('0xd'),_0x40a760,'request\x20sent');logger[_0xb839('0xe')](_0xb839('0xf'),_0x40a760,_0xb839('0x10'),JSON[_0xb839('0x11')](_0x1333cb));if(_0x1333cb[_0xb839('0x12')]){if(_0x1333cb['error'][_0xb839('0x13')]===0x1f4){logger['error'](_0xb839('0xd'),_0x40a760,_0x1333cb['error'][_0xb839('0x14')]);return _0x49b08c(_0x1333cb[_0xb839('0x12')][_0xb839('0x14')]);}logger['error'](_0xb839('0xd'),_0x40a760,_0x1333cb[_0xb839('0x12')]['message']);return _0x3d50f4(_0x1333cb[_0xb839('0x12')][_0xb839('0x14')]);}else{logger[_0xb839('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x40a760,_0xb839('0x10'));_0x3d50f4(_0x1333cb[_0xb839('0x15')][_0xb839('0x14')]);}})[_0xb839('0x16')](function(_0x57eaac){logger[_0xb839('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x40a760,_0x57eaac);_0x49b08c(_0x57eaac);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 90ef7a3..55e1445 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 _0x20d4=['create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post'];(function(_0xdfe5ed,_0x1762f0){var _0x36b3b=function(_0x285eaf){while(--_0x285eaf){_0xdfe5ed['push'](_0xdfe5ed['shift']());}};_0x36b3b(++_0x1762f0);}(_0x20d4,0xdc));var _0x420d=function(_0x23642e,_0x48ad89){_0x23642e=_0x23642e-0x0;var _0xa76ef=_0x20d4[_0x23642e];return _0xa76ef;};'use strict';var multer=require(_0x420d('0x0'));var util=require(_0x420d('0x1'));var path=require(_0x420d('0x2'));var timeout=require(_0x420d('0x3'));var express=require(_0x420d('0x4'));var router=express[_0x420d('0x5')]();var fs_extra=require(_0x420d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x420d('0x7'));var config=require(_0x420d('0x8'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0x420d('0x9')](),controller[_0x420d('0xa')]);router[_0x420d('0xb')](_0x420d('0xc'),auth[_0x420d('0x9')](),controller['show']);router[_0x420d('0xd')]('/',auth[_0x420d('0x9')](),controller[_0x420d('0xe')]);router[_0x420d('0xf')](_0x420d('0xc'),auth[_0x420d('0x9')](),controller[_0x420d('0x10')]);router[_0x420d('0x11')](_0x420d('0xc'),auth[_0x420d('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x640e=['util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x2e4bd3,_0x4bb4b9){var _0x3ec1a0=function(_0x401acd){while(--_0x401acd){_0x2e4bd3['push'](_0x2e4bd3['shift']());}};_0x3ec1a0(++_0x4bb4b9);}(_0x640e,0x65));var _0xe640=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0x640e[_0x142020];return _0x40da8f;};'use strict';var multer=require(_0xe640('0x0'));var util=require(_0xe640('0x1'));var path=require('path');var timeout=require(_0xe640('0x2'));var express=require(_0xe640('0x3'));var router=express[_0xe640('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe640('0x5'));var controller=require('./intDeskField.controller');router[_0xe640('0x6')]('/',auth[_0xe640('0x7')](),controller[_0xe640('0x8')]);router[_0xe640('0x6')](_0xe640('0x9'),auth[_0xe640('0x7')](),controller[_0xe640('0xa')]);router[_0xe640('0xb')]('/',auth[_0xe640('0x7')](),controller['create']);router[_0xe640('0xc')](_0xe640('0x9'),auth[_0xe640('0x7')](),controller[_0xe640('0xd')]);router[_0xe640('0xe')](_0xe640('0x9'),auth['isAuthenticated'](),controller[_0xe640('0xf')]);module[_0xe640('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 84ca103..8b6d52b 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 _0x563c=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist'];(function(_0x5a300b,_0x3183f6){var _0xaea19f=function(_0x47fe59){while(--_0x47fe59){_0x5a300b['push'](_0x5a300b['shift']());}};_0xaea19f(++_0x3183f6);}(_0x563c,0xc9));var _0xc563=function(_0x4f90dd,_0xd28e6c){_0x4f90dd=_0x4f90dd-0x0;var _0x294603=_0x563c[_0x4f90dd];return _0x294603;};'use strict';var Sequelize=require(_0xc563('0x0'));module[_0xc563('0x1')]={'type':{'type':Sequelize[_0xc563('0x2')]('string',_0xc563('0x3'),_0xc563('0x4'),'keyValue',_0xc563('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc563('0x6'),_0xc563('0x3'),_0xc563('0x4'))},'keyContent':{'type':Sequelize[_0xc563('0x7')]},'idField':{'type':Sequelize[_0xc563('0x7')]},'nameField':{'type':Sequelize[_0xc563('0x7')]},'customField':{'type':Sequelize[_0xc563('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc563('0x7')]}}; \ No newline at end of file +var _0x34ca=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0xe9a485,_0x185300){var _0x59e007=function(_0x1768a6){while(--_0x1768a6){_0xe9a485['push'](_0xe9a485['shift']());}};_0x59e007(++_0x185300);}(_0x34ca,0x192));var _0xa34c=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x34ca[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0xa34c('0x0'));module[_0xa34c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa34c('0x2'),_0xa34c('0x3'),_0xa34c('0x4'),_0xa34c('0x5'),'picklist'),'defaultValue':_0xa34c('0x2')},'content':{'type':Sequelize[_0xa34c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xa34c('0x3'),_0xa34c('0x4'))},'keyContent':{'type':Sequelize[_0xa34c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa34c('0x6')]},'customField':{'type':Sequelize[_0xa34c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa34c('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index ee58a94..7b51b7f 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 _0x2eb2=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','includeAll','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash'];(function(_0x1d83db,_0x89d115){var _0x2dc1d1=function(_0x13fdc3){while(--_0x13fdc3){_0x1d83db['push'](_0x1d83db['shift']());}};_0x2dc1d1(++_0x89d115);}(_0x2eb2,0x19f));var _0x22eb=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x2eb2[_0x5b561d];return _0x431060;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f286c,_0x189f05){_0x189f05=_0x189f05||0xcc;return function(_0x128d43){if(_0x128d43){return _0x1f286c[_0x22eb('0x16')](_0x189f05);}return _0x1f286c[_0x22eb('0x17')](_0x189f05)['end']();};}function respondWithResult(_0x350ade,_0x53f14e){_0x53f14e=_0x53f14e||0xc8;return function(_0x1f5089){if(_0x1f5089){return _0x350ade['status'](_0x53f14e)[_0x22eb('0x18')](_0x1f5089);}};}function respondWithFilteredResult(_0x84c668,_0x53abbf){return function(_0x48b63c){if(_0x48b63c){var _0x4bc29a=typeof _0x53abbf[_0x22eb('0x19')]==='undefined'&&typeof _0x53abbf['limit']===_0x22eb('0x1a');var _0x4d9a71=_0x48b63c['count'];var _0xb7a73a=_0x4bc29a?0x0:_0x53abbf[_0x22eb('0x19')];var _0x385bcb=_0x4bc29a?_0x48b63c[_0x22eb('0x1b')]:_0x53abbf[_0x22eb('0x19')]+_0x53abbf['limit'];var _0x4182a8;if(_0x385bcb>=_0x4d9a71){_0x385bcb=_0x4d9a71;_0x4182a8=0xc8;}else{_0x4182a8=0xce;}_0x84c668[_0x22eb('0x17')](_0x4182a8);return _0x84c668[_0x22eb('0x1c')](_0x22eb('0x1d'),_0xb7a73a+'-'+_0x385bcb+'/'+_0x4d9a71)[_0x22eb('0x18')](_0x48b63c);}return null;};}function patchUpdates(_0x517313){return function(_0x2eb115){try{jsonpatch[_0x22eb('0x1e')](_0x2eb115,_0x517313,!![]);}catch(_0x2fc36e){return BPromise['reject'](_0x2fc36e);}return _0x2eb115['save']();};}function saveUpdates(_0x4335b7,_0x267d97){return function(_0x434ecb){if(_0x434ecb){return _0x434ecb[_0x22eb('0x1f')](_0x4335b7)[_0x22eb('0x20')](function(_0x3e8c1c){return _0x3e8c1c;});}return null;};}function removeEntity(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(_0x2e8f7c){return _0x2e8f7c[_0x22eb('0x21')]()[_0x22eb('0x20')](function(){_0x43dacb[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();});}};}function handleEntityNotFound(_0x4da252,_0x12c133){return function(_0x6f8ff3){if(!_0x6f8ff3){_0x4da252[_0x22eb('0x16')](0x194);}return _0x6f8ff3;};}function handleError(_0x5a001e,_0xe0783c){_0xe0783c=_0xe0783c||0x1f4;return function(_0x259847){logger['error'](_0x259847[_0x22eb('0x23')]);if(_0x259847[_0x22eb('0x24')]){delete _0x259847[_0x22eb('0x24')];}_0x5a001e[_0x22eb('0x17')](_0xe0783c)[_0x22eb('0x25')](_0x259847);};}exports['index']=function(_0x49dd59,_0x2a950e){var _0x25e5bc={},_0x44cf91={},_0x7c0119={'count':0x0,'rows':[]};var _0x1599c7=_[_0x22eb('0x26')](db[_0x22eb('0x27')][_0x22eb('0x28')],function(_0x382784){return{'name':_0x382784[_0x22eb('0x29')],'type':_0x382784[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x44cf91['model']=_[_0x22eb('0x26')](_0x1599c7,'name');_0x44cf91[_0x22eb('0x2c')]=_[_0x22eb('0x2d')](_0x49dd59[_0x22eb('0x2c')]);_0x44cf91[_0x22eb('0x2e')]=_[_0x22eb('0x2f')](_0x44cf91[_0x22eb('0x30')],_0x44cf91[_0x22eb('0x2c')]);_0x25e5bc[_0x22eb('0x31')]=_[_0x22eb('0x2f')](_0x44cf91[_0x22eb('0x30')],qs['fields'](_0x49dd59['query'][_0x22eb('0x32')]));_0x25e5bc['attributes']=_0x25e5bc['attributes'][_0x22eb('0x33')]?_0x25e5bc[_0x22eb('0x31')]:_0x44cf91[_0x22eb('0x30')];if(!_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x34')](_0x22eb('0x35'))){_0x25e5bc[_0x22eb('0x36')]=qs[_0x22eb('0x36')](_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x36')]);_0x25e5bc['offset']=qs[_0x22eb('0x19')](_0x49dd59['query']['offset']);}_0x25e5bc[_0x22eb('0x37')]=qs[_0x22eb('0x38')](_0x49dd59['query'][_0x22eb('0x38')]);_0x25e5bc[_0x22eb('0x39')]=qs[_0x22eb('0x2e')](_[_0x22eb('0x3a')](_0x49dd59[_0x22eb('0x2c')],_0x44cf91['filters']),_0x1599c7);if(_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x3b')]){_0x25e5bc['where']=_[_0x22eb('0x3c')](_0x25e5bc[_0x22eb('0x39')],{'$or':_[_0x22eb('0x26')](_0x1599c7,function(_0x2cc77c){if(_0x2cc77c[_0x22eb('0x2a')]!=='VIRTUAL'){var _0x51c8b5={};_0x51c8b5[_0x2cc77c[_0x22eb('0x24')]]={'$like':'%'+_0x49dd59[_0x22eb('0x2c')]['filter']+'%'};return _0x51c8b5;}})});}_0x25e5bc=_[_0x22eb('0x3c')]({},_0x25e5bc,_0x49dd59[_0x22eb('0x3d')]);var _0x46c6a1={'where':_0x25e5bc['where']};return db[_0x22eb('0x27')][_0x22eb('0x1b')](_0x46c6a1)[_0x22eb('0x20')](function(_0x2a8517){_0x7c0119[_0x22eb('0x1b')]=_0x2a8517;if(_0x49dd59[_0x22eb('0x2c')]['includeAll']){_0x25e5bc[_0x22eb('0x3e')]=[{'all':!![]}];}return db[_0x22eb('0x27')]['findAll'](_0x25e5bc);})[_0x22eb('0x20')](function(_0x44d39f){_0x7c0119[_0x22eb('0x3f')]=_0x44d39f;return _0x7c0119;})[_0x22eb('0x20')](respondWithFilteredResult(_0x2a950e,_0x25e5bc))[_0x22eb('0x40')](handleError(_0x2a950e,null));};exports[_0x22eb('0x41')]=function(_0x1ff04a,_0x78b250){var _0x1bafa3={'raw':!![],'where':{'id':_0x1ff04a[_0x22eb('0x42')]['id']}},_0x82ace8={};_0x82ace8[_0x22eb('0x30')]=_[_0x22eb('0x2d')](db[_0x22eb('0x27')][_0x22eb('0x28')]);_0x82ace8[_0x22eb('0x2c')]=_[_0x22eb('0x2d')](_0x1ff04a[_0x22eb('0x2c')]);_0x82ace8['filters']=_[_0x22eb('0x2f')](_0x82ace8[_0x22eb('0x30')],_0x82ace8['query']);_0x1bafa3[_0x22eb('0x31')]=_[_0x22eb('0x2f')](_0x82ace8['model'],qs['fields'](_0x1ff04a['query'][_0x22eb('0x32')]));_0x1bafa3[_0x22eb('0x31')]=_0x1bafa3['attributes']['length']?_0x1bafa3[_0x22eb('0x31')]:_0x82ace8[_0x22eb('0x30')];if(_0x1ff04a[_0x22eb('0x2c')][_0x22eb('0x43')]){_0x1bafa3[_0x22eb('0x3e')]=[{'all':!![]}];}_0x1bafa3=_[_0x22eb('0x3c')]({},_0x1bafa3,_0x1ff04a[_0x22eb('0x3d')]);return db[_0x22eb('0x27')]['find'](_0x1bafa3)['then'](handleEntityNotFound(_0x78b250,null))[_0x22eb('0x20')](respondWithResult(_0x78b250,null))['catch'](handleError(_0x78b250,null));};exports[_0x22eb('0x44')]=function(_0x4bd819,_0x8a2b2c){return db['DeskField']['create'](_0x4bd819['body'],{})['then'](respondWithResult(_0x8a2b2c,0xc9))[_0x22eb('0x40')](handleError(_0x8a2b2c,null));};exports['update']=function(_0x320211,_0x3b35c6){if(_0x320211['body']['id']){delete _0x320211[_0x22eb('0x45')]['id'];}return db['DeskField'][_0x22eb('0x46')]({'where':{'id':_0x320211[_0x22eb('0x42')]['id']}})[_0x22eb('0x20')](handleEntityNotFound(_0x3b35c6,null))[_0x22eb('0x20')](saveUpdates(_0x320211[_0x22eb('0x45')],null))[_0x22eb('0x20')](respondWithResult(_0x3b35c6,null))[_0x22eb('0x40')](handleError(_0x3b35c6,null));};exports[_0x22eb('0x21')]=function(_0x11942d,_0x527ef1){return db[_0x22eb('0x27')][_0x22eb('0x46')]({'where':{'id':_0x11942d['params']['id']}})[_0x22eb('0x20')](handleEntityNotFound(_0x527ef1,null))[_0x22eb('0x20')](removeEntity(_0x527ef1,null))[_0x22eb('0x40')](handleError(_0x527ef1,null));}; \ No newline at end of file +var _0x1107=['eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','where','merge','type','DeskField','count','includeAll','rows','catch','params','rawAttributes','options','find','create','body','destroy'];(function(_0x98476,_0x25f0aa){var _0x5df151=function(_0x3d2c35){while(--_0x3d2c35){_0x98476['push'](_0x98476['shift']());}};_0x5df151(++_0x25f0aa);}(_0x1107,0xd8));var _0x7110=function(_0x18a772,_0x1a4d3f){_0x18a772=_0x18a772-0x0;var _0xbaac04=_0x1107[_0x18a772];return _0xbaac04;};'use strict';var emlformat=require(_0x7110('0x0'));var rimraf=require(_0x7110('0x1'));var zipdir=require(_0x7110('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7110('0x3'));var BPromise=require(_0x7110('0x4'));var Mustache=require('mustache');var util=require(_0x7110('0x5'));var path=require(_0x7110('0x6'));var sox=require(_0x7110('0x7'));var csv=require(_0x7110('0x8'));var ejs=require(_0x7110('0x9'));var fs=require('fs');var fs_extra=require(_0x7110('0xa'));var _=require(_0x7110('0xb'));var squel=require(_0x7110('0xc'));var crypto=require(_0x7110('0xd'));var jsforce=require(_0x7110('0xe'));var deskjs=require(_0x7110('0xf'));var toCsv=require(_0x7110('0x8'));var querystring=require(_0x7110('0x10'));var Papa=require('papaparse');var Redis=require(_0x7110('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7110('0x12'));var as=require(_0x7110('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7110('0x14'))(_0x7110('0x15'));var utils=require(_0x7110('0x16'));var config=require(_0x7110('0x17'));var licenseUtil=require(_0x7110('0x18'));var db=require(_0x7110('0x19'))['db'];function respondWithStatusCode(_0x427997,_0x35984d){_0x35984d=_0x35984d||0xcc;return function(_0x458ad7){if(_0x458ad7){return _0x427997['sendStatus'](_0x35984d);}return _0x427997[_0x7110('0x1a')](_0x35984d)['end']();};}function respondWithResult(_0x36c44d,_0x56b08b){_0x56b08b=_0x56b08b||0xc8;return function(_0x21cb1d){if(_0x21cb1d){return _0x36c44d[_0x7110('0x1a')](_0x56b08b)[_0x7110('0x1b')](_0x21cb1d);}};}function respondWithFilteredResult(_0x149238,_0x26fe8a){return function(_0x1a8f7f){if(_0x1a8f7f){var _0x2ad1c3=typeof _0x26fe8a['offset']===_0x7110('0x1c')&&typeof _0x26fe8a['limit']===_0x7110('0x1c');var _0x39664d=_0x1a8f7f['count'];var _0x9df9ca=_0x2ad1c3?0x0:_0x26fe8a[_0x7110('0x1d')];var _0x3b590f=_0x2ad1c3?_0x1a8f7f['count']:_0x26fe8a['offset']+_0x26fe8a[_0x7110('0x1e')];var _0x13c8ea;if(_0x3b590f>=_0x39664d){_0x3b590f=_0x39664d;_0x13c8ea=0xc8;}else{_0x13c8ea=0xce;}_0x149238[_0x7110('0x1a')](_0x13c8ea);return _0x149238[_0x7110('0x1f')](_0x7110('0x20'),_0x9df9ca+'-'+_0x3b590f+'/'+_0x39664d)['json'](_0x1a8f7f);}return null;};}function patchUpdates(_0x3bd2bc){return function(_0x3b5f7f){try{jsonpatch[_0x7110('0x21')](_0x3b5f7f,_0x3bd2bc,!![]);}catch(_0x264250){return BPromise[_0x7110('0x22')](_0x264250);}return _0x3b5f7f[_0x7110('0x23')]();};}function saveUpdates(_0x29dcb2,_0x38b7cd){return function(_0x530a3e){if(_0x530a3e){return _0x530a3e[_0x7110('0x24')](_0x29dcb2)['then'](function(_0x3bd510){return _0x3bd510;});}return null;};}function removeEntity(_0xcf45c,_0x2373b4){return function(_0x166862){if(_0x166862){return _0x166862['destroy']()[_0x7110('0x25')](function(){_0xcf45c[_0x7110('0x1a')](0xcc)[_0x7110('0x26')]();});}};}function handleEntityNotFound(_0x54fc43,_0x341eb7){return function(_0x4acb38){if(!_0x4acb38){_0x54fc43['sendStatus'](0x194);}return _0x4acb38;};}function handleError(_0x427943,_0x1370c5){_0x1370c5=_0x1370c5||0x1f4;return function(_0x16b03d){logger[_0x7110('0x27')](_0x16b03d['stack']);if(_0x16b03d[_0x7110('0x28')]){delete _0x16b03d[_0x7110('0x28')];}_0x427943[_0x7110('0x1a')](_0x1370c5)[_0x7110('0x29')](_0x16b03d);};}exports[_0x7110('0x2a')]=function(_0x381203,_0x280781){var _0x389047={},_0x1b163a={},_0x106e19={'count':0x0,'rows':[]};var _0x35264c=_[_0x7110('0x2b')](db['DeskField']['rawAttributes'],function(_0x2d88fb){return{'name':_0x2d88fb['fieldName'],'type':_0x2d88fb['type'][_0x7110('0x2c')]};});_0x1b163a[_0x7110('0x2d')]=_['map'](_0x35264c,_0x7110('0x28'));_0x1b163a['query']=_[_0x7110('0x2e')](_0x381203[_0x7110('0x2f')]);_0x1b163a['filters']=_[_0x7110('0x30')](_0x1b163a[_0x7110('0x2d')],_0x1b163a[_0x7110('0x2f')]);_0x389047['attributes']=_[_0x7110('0x30')](_0x1b163a[_0x7110('0x2d')],qs[_0x7110('0x31')](_0x381203[_0x7110('0x2f')][_0x7110('0x31')]));_0x389047[_0x7110('0x32')]=_0x389047[_0x7110('0x32')][_0x7110('0x33')]?_0x389047[_0x7110('0x32')]:_0x1b163a['model'];if(!_0x381203['query'][_0x7110('0x34')]('nolimit')){_0x389047[_0x7110('0x1e')]=qs[_0x7110('0x1e')](_0x381203[_0x7110('0x2f')][_0x7110('0x1e')]);_0x389047['offset']=qs['offset'](_0x381203[_0x7110('0x2f')]['offset']);}_0x389047[_0x7110('0x35')]=qs[_0x7110('0x36')](_0x381203['query'][_0x7110('0x36')]);_0x389047['where']=qs[_0x7110('0x37')](_[_0x7110('0x38')](_0x381203[_0x7110('0x2f')],_0x1b163a[_0x7110('0x37')]),_0x35264c);if(_0x381203[_0x7110('0x2f')]['filter']){_0x389047[_0x7110('0x39')]=_[_0x7110('0x3a')](_0x389047[_0x7110('0x39')],{'$or':_[_0x7110('0x2b')](_0x35264c,function(_0x9e611a){if(_0x9e611a[_0x7110('0x3b')]!=='VIRTUAL'){var _0x1a6bf2={};_0x1a6bf2[_0x9e611a[_0x7110('0x28')]]={'$like':'%'+_0x381203[_0x7110('0x2f')]['filter']+'%'};return _0x1a6bf2;}})});}_0x389047=_['merge']({},_0x389047,_0x381203['options']);var _0xe0e65c={'where':_0x389047[_0x7110('0x39')]};return db[_0x7110('0x3c')][_0x7110('0x3d')](_0xe0e65c)['then'](function(_0x2648b2){_0x106e19[_0x7110('0x3d')]=_0x2648b2;if(_0x381203['query'][_0x7110('0x3e')]){_0x389047['include']=[{'all':!![]}];}return db['DeskField']['findAll'](_0x389047);})[_0x7110('0x25')](function(_0x4d46e6){_0x106e19[_0x7110('0x3f')]=_0x4d46e6;return _0x106e19;})[_0x7110('0x25')](respondWithFilteredResult(_0x280781,_0x389047))[_0x7110('0x40')](handleError(_0x280781,null));};exports['show']=function(_0x38a01e,_0x4a5a36){var _0x1c86d7={'raw':!![],'where':{'id':_0x38a01e[_0x7110('0x41')]['id']}},_0x280a97={};_0x280a97[_0x7110('0x2d')]=_[_0x7110('0x2e')](db[_0x7110('0x3c')][_0x7110('0x42')]);_0x280a97['query']=_[_0x7110('0x2e')](_0x38a01e['query']);_0x280a97[_0x7110('0x37')]=_['intersection'](_0x280a97[_0x7110('0x2d')],_0x280a97[_0x7110('0x2f')]);_0x1c86d7['attributes']=_[_0x7110('0x30')](_0x280a97[_0x7110('0x2d')],qs[_0x7110('0x31')](_0x38a01e['query']['fields']));_0x1c86d7[_0x7110('0x32')]=_0x1c86d7['attributes'][_0x7110('0x33')]?_0x1c86d7[_0x7110('0x32')]:_0x280a97[_0x7110('0x2d')];if(_0x38a01e[_0x7110('0x2f')][_0x7110('0x3e')]){_0x1c86d7['include']=[{'all':!![]}];}_0x1c86d7=_[_0x7110('0x3a')]({},_0x1c86d7,_0x38a01e[_0x7110('0x43')]);return db[_0x7110('0x3c')][_0x7110('0x44')](_0x1c86d7)['then'](handleEntityNotFound(_0x4a5a36,null))[_0x7110('0x25')](respondWithResult(_0x4a5a36,null))[_0x7110('0x40')](handleError(_0x4a5a36,null));};exports['create']=function(_0x59c99a,_0x29a489){return db[_0x7110('0x3c')][_0x7110('0x45')](_0x59c99a[_0x7110('0x46')],{})[_0x7110('0x25')](respondWithResult(_0x29a489,0xc9))['catch'](handleError(_0x29a489,null));};exports[_0x7110('0x24')]=function(_0x5c1211,_0x1ba0f4){if(_0x5c1211['body']['id']){delete _0x5c1211[_0x7110('0x46')]['id'];}return db[_0x7110('0x3c')][_0x7110('0x44')]({'where':{'id':_0x5c1211['params']['id']}})[_0x7110('0x25')](handleEntityNotFound(_0x1ba0f4,null))[_0x7110('0x25')](saveUpdates(_0x5c1211['body'],null))[_0x7110('0x25')](respondWithResult(_0x1ba0f4,null))[_0x7110('0x40')](handleError(_0x1ba0f4,null));};exports[_0x7110('0x47')]=function(_0x32c28e,_0xb8c57f){return db[_0x7110('0x3c')][_0x7110('0x44')]({'where':{'id':_0x32c28e[_0x7110('0x41')]['id']}})['then'](handleEntityNotFound(_0xb8c57f,null))[_0x7110('0x25')](removeEntity(_0xb8c57f,null))[_0x7110('0x40')](handleError(_0xb8c57f,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e3b02ce..a4aadec 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 _0xc194=['desk_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','exports','define','int_desk_fields'];(function(_0x4cbcca,_0x10e503){var _0x2098f1=function(_0x405758){while(--_0x405758){_0x4cbcca['push'](_0x4cbcca['shift']());}};_0x2098f1(++_0x10e503);}(_0xc194,0x189));var _0x4c19=function(_0x5da240,_0x3ce318){_0x5da240=_0x5da240-0x0;var _0x1a17bc=_0xc194[_0x5da240];return _0x1a17bc;};'use strict';var _=require(_0x4c19('0x0'));var util=require(_0x4c19('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4c19('0x2'));var BPromise=require(_0x4c19('0x3'));var rp=require(_0x4c19('0x4'));var fs=require('fs');var path=require(_0x4c19('0x5'));var rimraf=require(_0x4c19('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x4c19('0x7')]=function(_0x3f30cb,_0x4970ca){return _0x3f30cb[_0x4c19('0x8')]('DeskField',attributes,{'tableName':_0x4c19('0x9'),'paranoid':![],'indexes':[{'name':_0x4c19('0xa'),'fields':[_0x4c19('0xb'),_0x4c19('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62f8=['exports','define','int_desk_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x62f8,0x66));var _0x862f=function(_0x146b42,_0x282dac){_0x146b42=_0x146b42-0x0;var _0x548e50=_0x62f8[_0x146b42];return _0x548e50;};'use strict';var _=require(_0x862f('0x0'));var util=require(_0x862f('0x1'));var logger=require(_0x862f('0x2'))(_0x862f('0x3'));var moment=require(_0x862f('0x4'));var BPromise=require(_0x862f('0x5'));var rp=require(_0x862f('0x6'));var fs=require('fs');var path=require(_0x862f('0x7'));var rimraf=require('rimraf');var config=require(_0x862f('0x8'));var attributes=require(_0x862f('0x9'));module[_0x862f('0xa')]=function(_0x1b1acd,_0x38b099){return _0x1b1acd[_0x862f('0xb')]('DeskField',attributes,{'tableName':_0x862f('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x862f('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 248a010..328b87f 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 _0xbcb9=['client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x15f1cc,_0x1e99c9){var _0x3549d7=function(_0x3e2e04){while(--_0x3e2e04){_0x15f1cc['push'](_0x15f1cc['shift']());}};_0x3549d7(++_0x1e99c9);}(_0xbcb9,0x1da));var _0x9bcb=function(_0x355d77,_0x43e1ad){_0x355d77=_0x355d77-0x0;var _0x198553=_0xbcb9[_0x355d77];return _0x198553;};'use strict';var _=require(_0x9bcb('0x0'));var util=require(_0x9bcb('0x1'));var moment=require(_0x9bcb('0x2'));var BPromise=require(_0x9bcb('0x3'));var rs=require(_0x9bcb('0x4'));var fs=require('fs');var Redis=require(_0x9bcb('0x5'));var db=require(_0x9bcb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9bcb('0x7'))(_0x9bcb('0x8'));var config=require(_0x9bcb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9bcb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x357858,_0x53ff8b,_0x25eb6d){return new BPromise(function(_0x106373,_0x44ba34){return client[_0x9bcb('0xb')](_0x357858,_0x25eb6d)[_0x9bcb('0xc')](function(_0x538fd2){logger[_0x9bcb('0xd')](_0x9bcb('0xe'),_0x53ff8b,_0x9bcb('0xf'));logger[_0x9bcb('0x10')](_0x9bcb('0x11'),_0x53ff8b,_0x9bcb('0xf'),JSON[_0x9bcb('0x12')](_0x538fd2));if(_0x538fd2['error']){if(_0x538fd2['error'][_0x9bcb('0x13')]===0x1f4){logger['error'](_0x9bcb('0xe'),_0x53ff8b,_0x538fd2[_0x9bcb('0x14')][_0x9bcb('0x15')]);return _0x44ba34(_0x538fd2[_0x9bcb('0x14')]['message']);}logger[_0x9bcb('0x14')]('DeskField,\x20%s,\x20%s',_0x53ff8b,_0x538fd2[_0x9bcb('0x14')]['message']);return _0x106373(_0x538fd2[_0x9bcb('0x14')][_0x9bcb('0x15')]);}else{logger[_0x9bcb('0xd')](_0x9bcb('0xe'),_0x53ff8b,_0x9bcb('0xf'));_0x106373(_0x538fd2['result'][_0x9bcb('0x15')]);}})['catch'](function(_0x360705){logger[_0x9bcb('0x14')](_0x9bcb('0xe'),_0x53ff8b,_0x360705);_0x44ba34(_0x360705);});});} \ No newline at end of file +var _0x2c23=['then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x2c23,0xf2));var _0x32c2=function(_0x4614eb,_0x5ee1de){_0x4614eb=_0x4614eb-0x0;var _0x123f27=_0x2c23[_0x4614eb];return _0x123f27;};'use strict';var _=require(_0x32c2('0x0'));var util=require(_0x32c2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x32c2('0x2'));var fs=require('fs');var Redis=require(_0x32c2('0x3'));var db=require(_0x32c2('0x4'))['db'];var utils=require(_0x32c2('0x5'));var logger=require('../../config/logger')(_0x32c2('0x6'));var config=require(_0x32c2('0x7'));var jayson=require(_0x32c2('0x8'));var client=jayson[_0x32c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dd14b,_0x3f2cc3,_0x41474e){return new BPromise(function(_0x47b4ae,_0xefb0eb){return client[_0x32c2('0xa')](_0x2dd14b,_0x41474e)[_0x32c2('0xb')](function(_0x197f2d){logger[_0x32c2('0xc')](_0x32c2('0xd'),_0x3f2cc3,_0x32c2('0xe'));logger[_0x32c2('0xf')](_0x32c2('0x10'),_0x3f2cc3,_0x32c2('0xe'),JSON[_0x32c2('0x11')](_0x197f2d));if(_0x197f2d['error']){if(_0x197f2d[_0x32c2('0x12')][_0x32c2('0x13')]===0x1f4){logger['error'](_0x32c2('0xd'),_0x3f2cc3,_0x197f2d['error']['message']);return _0xefb0eb(_0x197f2d['error'][_0x32c2('0x14')]);}logger[_0x32c2('0x12')](_0x32c2('0xd'),_0x3f2cc3,_0x197f2d[_0x32c2('0x12')][_0x32c2('0x14')]);return _0x47b4ae(_0x197f2d[_0x32c2('0x12')][_0x32c2('0x14')]);}else{logger[_0x32c2('0xc')](_0x32c2('0xd'),_0x3f2cc3,_0x32c2('0xe'));_0x47b4ae(_0x197f2d[_0x32c2('0x15')][_0x32c2('0x14')]);}})[_0x32c2('0x16')](function(_0x5d4cb5){logger['error'](_0x32c2('0xd'),_0x3f2cc3,_0x5d4cb5);_0xefb0eb(_0x5d4cb5);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 79131a3..abc6167 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 _0xe9e5=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index'];(function(_0x35c111,_0x3e43b9){var _0x408930=function(_0x3b3379){while(--_0x3b3379){_0x35c111['push'](_0x35c111['shift']());}};_0x408930(++_0x3e43b9);}(_0xe9e5,0x138));var _0x5e9e=function(_0x488382,_0x2d1a4e){_0x488382=_0x488382-0x0;var _0x4f329b=_0xe9e5[_0x488382];return _0x4f329b;};'use strict';var multer=require(_0x5e9e('0x0'));var util=require(_0x5e9e('0x1'));var path=require(_0x5e9e('0x2'));var timeout=require(_0x5e9e('0x3'));var express=require(_0x5e9e('0x4'));var router=express[_0x5e9e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5e9e('0x6'));var interaction=require(_0x5e9e('0x7'));var config=require(_0x5e9e('0x8'));var controller=require(_0x5e9e('0x9'));router[_0x5e9e('0xa')]('/',auth[_0x5e9e('0xb')](),controller[_0x5e9e('0xc')]);router[_0x5e9e('0xa')](_0x5e9e('0xd'),auth['isAuthenticated'](),controller[_0x5e9e('0xe')]);router[_0x5e9e('0xa')](_0x5e9e('0xf'),auth[_0x5e9e('0xb')](),controller[_0x5e9e('0x10')]);router['get'](_0x5e9e('0x11'),auth[_0x5e9e('0xb')](),controller[_0x5e9e('0x12')]);router[_0x5e9e('0x13')]('/',auth['isAuthenticated'](),controller[_0x5e9e('0x14')]);router[_0x5e9e('0x13')](_0x5e9e('0xf'),auth[_0x5e9e('0xb')](),controller[_0x5e9e('0x15')]);router[_0x5e9e('0x16')](_0x5e9e('0xd'),auth[_0x5e9e('0xb')](),controller[_0x5e9e('0x17')]);router[_0x5e9e('0x18')](_0x5e9e('0xd'),auth[_0x5e9e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5e95=['/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x11b4df,_0x4a7379){var _0x436ba0=function(_0x11c580){while(--_0x11c580){_0x11b4df['push'](_0x11b4df['shift']());}};_0x436ba0(++_0x4a7379);}(_0x5e95,0xce));var _0x55e9=function(_0x435f71,_0xfb5d03){_0x435f71=_0x435f71-0x0;var _0x18e3e1=_0x5e95[_0x435f71];return _0x18e3e1;};'use strict';var multer=require('multer');var util=require(_0x55e9('0x0'));var path=require(_0x55e9('0x1'));var timeout=require(_0x55e9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x55e9('0x3'));var config=require(_0x55e9('0x4'));var controller=require('./intDynamics365Account.controller');router[_0x55e9('0x5')]('/',auth[_0x55e9('0x6')](),controller[_0x55e9('0x7')]);router[_0x55e9('0x5')](_0x55e9('0x8'),auth[_0x55e9('0x6')](),controller[_0x55e9('0x9')]);router['get']('/:id/configurations',auth[_0x55e9('0x6')](),controller['getConfigurations']);router[_0x55e9('0x5')](_0x55e9('0xa'),auth[_0x55e9('0x6')](),controller[_0x55e9('0xb')]);router[_0x55e9('0xc')]('/',auth[_0x55e9('0x6')](),controller[_0x55e9('0xd')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x55e9('0xe')]);router['put'](_0x55e9('0x8'),auth[_0x55e9('0x6')](),controller[_0x55e9('0xf')]);router['delete']('/:id',auth[_0x55e9('0x6')](),controller[_0x55e9('0x10')]);module[_0x55e9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d76b520..70bf8ce 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 _0x3bd7=['STRING'];(function(_0xa869a2,_0x59e366){var _0x5daa67=function(_0x3fadc2){while(--_0x3fadc2){_0xa869a2['push'](_0xa869a2['shift']());}};_0x5daa67(++_0x59e366);}(_0x3bd7,0x199));var _0x73bd=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x3bd7[_0x38eb23];return _0x48506a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x73bd('0x0')]},'username':{'type':Sequelize[_0x73bd('0x0')]},'password':{'type':Sequelize[_0x73bd('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x73bd('0x0')]},'clientId':{'type':Sequelize[_0x73bd('0x0')]},'clientSecret':{'type':Sequelize[_0x73bd('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x73bd('0x0')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x908e=['exports','STRING','sequelize'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x908e,0x182));var _0xe908=function(_0x24984a,_0x10fb2d){_0x24984a=_0x24984a-0x0;var _0x405c82=_0x908e[_0x24984a];return _0x405c82;};'use strict';var Sequelize=require(_0xe908('0x0'));module[_0xe908('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe908('0x2')]},'remoteUri':{'type':Sequelize[_0xe908('0x2')]},'tenantId':{'type':Sequelize[_0xe908('0x2')]},'clientId':{'type':Sequelize[_0xe908('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe908('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index b731fd4..11bb417 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 _0x828b=['remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','push','IntegerAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','update','then','end','name','send','index','Dynamics365Account','rawAttributes','fieldName','key','map','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','query','order','sort','where','filter','merge','type','VIRTUAL','options','rows','show','params','includeAll','include','find','create','body','destroy','catch','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','title','customerid','phonenumber','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','clientId','username','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x828b,0x182));var _0xb828=function(_0x5c7525,_0x39490f){_0x5c7525=_0x5c7525-0x0;var _0x2e2ec8=_0x828b[_0x5c7525];return _0x2e2ec8;};'use strict';var rp=require(_0xb828('0x0'));var util=require('util');var _=require('lodash');var qs=require(_0xb828('0x1'));var logger=require(_0xb828('0x2'))(_0xb828('0x3'));var db=require(_0xb828('0x4'))['db'];var integrations=require(_0xb828('0x5'));function respondWithResult(_0x2db7a2,_0x42e085){_0x42e085=_0x42e085||0xc8;return function(_0x1db075){if(_0x1db075){return _0x2db7a2['status'](_0x42e085)[_0xb828('0x6')](_0x1db075);}};}function respondWithFilteredResult(_0x15cd75,_0x482e34){return function(_0x216d9b){if(_0x216d9b){var _0x508743=typeof _0x482e34[_0xb828('0x7')]===_0xb828('0x8')&&typeof _0x482e34[_0xb828('0x9')]==='undefined';var _0x12f481=_0x216d9b[_0xb828('0xa')];var _0x2f0df3=_0x508743?0x0:_0x482e34['offset'];var _0x33ff96=_0x508743?_0x216d9b[_0xb828('0xa')]:_0x482e34[_0xb828('0x7')]+_0x482e34[_0xb828('0x9')];var _0x50135e;if(_0x33ff96>=_0x12f481){_0x33ff96=_0x12f481;_0x50135e=0xc8;}else{_0x50135e=0xce;}_0x15cd75[_0xb828('0xb')](_0x50135e);return _0x15cd75['set']('Content-Range',_0x2f0df3+'-'+_0x33ff96+'/'+_0x12f481)[_0xb828('0x6')](_0x216d9b);}return null;};}function saveUpdates(_0x5892e7){return function(_0x2ba758){if(_0x2ba758){return _0x2ba758[_0xb828('0xc')](_0x5892e7)['then'](function(_0x46e217){return _0x46e217;});}return null;};}function removeEntity(_0x4ddddb){return function(_0x1db00b){if(_0x1db00b){return _0x1db00b['destroy']()[_0xb828('0xd')](function(){_0x4ddddb[_0xb828('0xb')](0xcc)[_0xb828('0xe')]();});}};}function handleEntityNotFound(_0x1d8233){return function(_0x43fd39){if(!_0x43fd39){_0x1d8233['sendStatus'](0x194);}return _0x43fd39;};}function handleError(_0x1c1ecc,_0x24137f){_0x24137f=_0x24137f||0x1f4;return function(_0x3eeed0){logger['error'](_0x3eeed0['stack']);if(_0x3eeed0[_0xb828('0xf')]){delete _0x3eeed0[_0xb828('0xf')];}_0x1c1ecc['status'](_0x24137f)[_0xb828('0x10')](_0x3eeed0);};}exports[_0xb828('0x11')]=function(_0x52909f,_0x103f3a){var _0x19019e={},_0x45bb24={},_0x4275cd={'count':0x0,'rows':[]};var _0x805ed8=_['map'](db[_0xb828('0x12')][_0xb828('0x13')],function(_0x55bf80){return{'name':_0x55bf80[_0xb828('0x14')],'type':_0x55bf80['type'][_0xb828('0x15')]};});_0x45bb24['model']=_[_0xb828('0x16')](_0x805ed8,'name');_0x45bb24['query']=_[_0xb828('0x17')](_0x52909f['query']);_0x45bb24[_0xb828('0x18')]=_[_0xb828('0x19')](_0x45bb24['model'],_0x45bb24['query']);_0x19019e[_0xb828('0x1a')]=_['intersection'](_0x45bb24[_0xb828('0x1b')],qs[_0xb828('0x1c')](_0x52909f['query'][_0xb828('0x1c')]));_0x19019e[_0xb828('0x1a')]=_0x19019e['attributes'][_0xb828('0x1d')]?_0x19019e[_0xb828('0x1a')]:_0x45bb24[_0xb828('0x1b')];if(!_0x52909f['query'][_0xb828('0x1e')](_0xb828('0x1f'))){_0x19019e['limit']=qs['limit'](_0x52909f[_0xb828('0x20')]['limit']);_0x19019e[_0xb828('0x7')]=qs['offset'](_0x52909f[_0xb828('0x20')][_0xb828('0x7')]);}_0x19019e[_0xb828('0x21')]=qs['sort'](_0x52909f[_0xb828('0x20')][_0xb828('0x22')]);_0x19019e[_0xb828('0x23')]=qs[_0xb828('0x18')](_['pick'](_0x52909f['query'],_0x45bb24[_0xb828('0x18')]),_0x805ed8);if(_0x52909f[_0xb828('0x20')][_0xb828('0x24')]){_0x19019e['where']=_[_0xb828('0x25')](_0x19019e[_0xb828('0x23')],{'$or':_[_0xb828('0x16')](_0x805ed8,function(_0x9957f0){if(_0x9957f0[_0xb828('0x26')]!==_0xb828('0x27')){var _0x4d2399={};_0x4d2399[_0x9957f0[_0xb828('0xf')]]={'$like':'%'+_0x52909f[_0xb828('0x20')][_0xb828('0x24')]+'%'};return _0x4d2399;}})});}_0x19019e=_[_0xb828('0x25')]({},_0x19019e,_0x52909f[_0xb828('0x28')]);var _0x316b4b={'where':_0x19019e[_0xb828('0x23')]};return db[_0xb828('0x12')][_0xb828('0xa')](_0x316b4b)[_0xb828('0xd')](function(_0x3333cf){_0x4275cd['count']=_0x3333cf;if(_0x52909f[_0xb828('0x20')]['includeAll']){_0x19019e['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x19019e);})[_0xb828('0xd')](function(_0x3605d6){_0x4275cd[_0xb828('0x29')]=_0x3605d6;return _0x4275cd;})['then'](respondWithFilteredResult(_0x103f3a,_0x19019e))['catch'](handleError(_0x103f3a,null));};exports[_0xb828('0x2a')]=function(_0x1c21c8,_0x1b2e49){var _0x1b2777={'raw':![],'where':{'id':_0x1c21c8[_0xb828('0x2b')]['id']}},_0x4f626f={};_0x4f626f[_0xb828('0x1b')]=_['keys'](db['Dynamics365Account'][_0xb828('0x13')]);_0x4f626f[_0xb828('0x20')]=_['keys'](_0x1c21c8[_0xb828('0x20')]);_0x4f626f['filters']=_[_0xb828('0x19')](_0x4f626f['model'],_0x4f626f[_0xb828('0x20')]);_0x1b2777[_0xb828('0x1a')]=_[_0xb828('0x19')](_0x4f626f[_0xb828('0x1b')],qs[_0xb828('0x1c')](_0x1c21c8[_0xb828('0x20')][_0xb828('0x1c')]));_0x1b2777['attributes']=_0x1b2777[_0xb828('0x1a')][_0xb828('0x1d')]?_0x1b2777[_0xb828('0x1a')]:_0x4f626f[_0xb828('0x1b')];if(_0x1c21c8[_0xb828('0x20')][_0xb828('0x2c')]){_0x1b2777[_0xb828('0x2d')]=[{'all':!![]}];}_0x1b2777=_[_0xb828('0x25')]({},_0x1b2777,_0x1c21c8['options']);return db[_0xb828('0x12')][_0xb828('0x2e')](_0x1b2777)[_0xb828('0xd')](handleEntityNotFound(_0x1b2e49,null))[_0xb828('0xd')](respondWithResult(_0x1b2e49,null))['catch'](handleError(_0x1b2e49,null));};exports['create']=function(_0x19ef64,_0x25fc89){return db[_0xb828('0x12')][_0xb828('0x2f')](_0x19ef64[_0xb828('0x30')],{})[_0xb828('0xd')](respondWithResult(_0x25fc89,0xc9))['catch'](handleError(_0x25fc89,null));};exports['update']=function(_0x26f135,_0x1dda63){if(_0x26f135[_0xb828('0x30')]['id']){delete _0x26f135['body']['id'];}return db[_0xb828('0x12')][_0xb828('0x2e')]({'where':{'id':_0x26f135['params']['id']}})[_0xb828('0xd')](handleEntityNotFound(_0x1dda63,null))[_0xb828('0xd')](saveUpdates(_0x26f135[_0xb828('0x30')],null))[_0xb828('0xd')](respondWithResult(_0x1dda63,null))['catch'](handleError(_0x1dda63,null));};exports[_0xb828('0x31')]=function(_0x48766e,_0x247be5){return db[_0xb828('0x12')][_0xb828('0x2e')]({'where':{'id':_0x48766e[_0xb828('0x2b')]['id']}})[_0xb828('0xd')](handleEntityNotFound(_0x247be5,null))['then'](removeEntity(_0x247be5,null))[_0xb828('0x32')](handleError(_0x247be5,null));};exports[_0xb828('0x33')]=function(_0x1bdcf5,_0xc690fb){var _0x3e8e2c={};var _0x5b08e1={};var _0x15c9fc;var _0x3c5577;return db[_0xb828('0x12')][_0xb828('0x34')]({'where':{'id':_0x1bdcf5['params']['id']}})[_0xb828('0xd')](handleEntityNotFound(_0xc690fb,null))[_0xb828('0xd')](function(_0x5a82d9){if(_0x5a82d9){_0x15c9fc=_0x5a82d9;_0x5b08e1[_0xb828('0x1b')]=_[_0xb828('0x17')](db['Dynamics365Configuration'][_0xb828('0x13')]);_0x5b08e1[_0xb828('0x20')]=_[_0xb828('0x17')](_0x1bdcf5['query']);_0x5b08e1['filters']=_[_0xb828('0x19')](_0x5b08e1[_0xb828('0x1b')],_0x5b08e1['query']);_0x3e8e2c[_0xb828('0x1a')]=_[_0xb828('0x19')](_0x5b08e1[_0xb828('0x1b')],qs[_0xb828('0x1c')](_0x1bdcf5['query'][_0xb828('0x1c')]));_0x3e8e2c['attributes']=_0x3e8e2c[_0xb828('0x1a')][_0xb828('0x1d')]?_0x3e8e2c[_0xb828('0x1a')]:_0x5b08e1[_0xb828('0x1b')];_0x3e8e2c[_0xb828('0x21')]=qs[_0xb828('0x22')](_0x1bdcf5[_0xb828('0x20')]['sort']);_0x3e8e2c[_0xb828('0x23')]=qs[_0xb828('0x18')](_['pick'](_0x1bdcf5['query'],_0x5b08e1['filters']));if(_0x1bdcf5[_0xb828('0x20')][_0xb828('0x24')]){_0x3e8e2c['where']=_[_0xb828('0x25')](_0x3e8e2c[_0xb828('0x23')],{'$or':_[_0xb828('0x16')](_0x3e8e2c[_0xb828('0x1a')],function(_0xfe4189){var _0x270e25={};_0x270e25[_0xfe4189]={'$like':'%'+_0x1bdcf5[_0xb828('0x20')]['filter']+'%'};return _0x270e25;})});}_0x3e8e2c=_[_0xb828('0x25')]({},_0x3e8e2c,_0x1bdcf5[_0xb828('0x28')]);return _0x15c9fc[_0xb828('0x33')](_0x3e8e2c);}})['then'](function(_0x4382f3){if(_0x4382f3){_0x3c5577=_0x4382f3['length'];if(!_0x1bdcf5['query'][_0xb828('0x1e')]('nolimit')){_0x3e8e2c[_0xb828('0x9')]=qs[_0xb828('0x9')](_0x1bdcf5[_0xb828('0x20')][_0xb828('0x9')]);_0x3e8e2c[_0xb828('0x7')]=qs[_0xb828('0x7')](_0x1bdcf5[_0xb828('0x20')][_0xb828('0x7')]);}return _0x15c9fc[_0xb828('0x33')](_0x3e8e2c);}})['then'](function(_0x3c37e2){if(_0x3c37e2){return _0x3c37e2?{'count':_0x3c5577,'rows':_0x3c37e2}:null;}})['then'](respondWithResult(_0xc690fb,null))[_0xb828('0x32')](handleError(_0xc690fb,null));};exports[_0xb828('0x35')]=function(_0x50a6d8,_0x255777){if(_0x50a6d8['body']['id']){delete _0x50a6d8[_0xb828('0x30')]['id'];}return db[_0xb828('0x12')][_0xb828('0x34')]({'where':{'id':_0x50a6d8[_0xb828('0x2b')]['id']}})['then'](handleEntityNotFound(_0x255777,null))['then'](function(_0xd26ecf){if(_0xd26ecf){_0x50a6d8[_0xb828('0x30')][_0xb828('0x36')]=_0xd26ecf['id'];_0x50a6d8['body'][_0xb828('0x37')]=integrations['getSubjects'](_0x50a6d8['body'][_0xb828('0x38')],_0x50a6d8[_0xb828('0x30')][_0xb828('0x26')]);_0x50a6d8[_0xb828('0x30')][_0xb828('0x39')]=integrations[_0xb828('0x3a')](_0x50a6d8[_0xb828('0x30')][_0xb828('0x38')],_0x50a6d8[_0xb828('0x30')][_0xb828('0x26')]);return db[_0xb828('0x3b')][_0xb828('0x2f')](_0x50a6d8[_0xb828('0x30')],{'include':[{'model':db[_0xb828('0x3c')],'as':_0xb828('0x37')},{'model':db[_0xb828('0x3c')],'as':_0xb828('0x39')}]});}return null;})['then'](respondWithResult(_0x255777,null))['catch'](handleError(_0x255777,null));};function sanitizeRemoteUri(_0x1e5a2d){var _0x3128bb=_0x1e5a2d[_0xb828('0x3d')](-0x1);if(_0x3128bb==='/')return _0x1e5a2d['substring'](0x0,_0x1e5a2d[_0xb828('0x3e')](_0x3128bb));return _0x1e5a2d;}function getWebApiUrl(_0x259942){return util[_0xb828('0x3f')](_0xb828('0x40'),_0x259942);}exports[_0xb828('0x41')]=function(_0x2dbb3e,_0x3eadbf){var _0x4954b3=_0x2dbb3e[_0xb828('0x20')][_0xb828('0x42')];var _0x10cf1d=_0x4954b3==='incident'?_0xb828('0x43'):'PhoneCall';var _0x31d466='';var _0x202b29='';var _0x415dd9='';var _0x14d3e7='';var _0x493626='';var _0x47586f='';var _0x1a46dc='';var _0x2b4fbb='';var _0x3ab88f=[_0xb828('0x44'),'description',_0xb828('0x45'),'ownerid','caseorigincode','subject',_0xb828('0x46'),'regardingobjectid','directioncode',_0xb828('0x47')];var _0x177468=[_0xb828('0x48'),_0xb828('0x49'),'actualserviceunits',_0xb828('0x4a'),_0xb828('0x4b'),'contactidyominame',_0xb828('0x4c'),_0xb828('0x4d'),'createdbyexternalpartyname',_0xb828('0x4e'),_0xb828('0x4f'),'createdbyyominame',_0xb828('0x50'),_0xb828('0x51'),_0xb828('0x52'),_0xb828('0x53'),_0xb828('0x54'),'customeridyominame',_0xb828('0x55'),_0xb828('0x56'),_0xb828('0x57'),_0xb828('0x58'),_0xb828('0x59'),'exchangerate','firstresponsebykpiidname',_0xb828('0x5a'),_0xb828('0x5b'),'influencescore',_0xb828('0x5c'),_0xb828('0x5d'),'masteridname',_0xb828('0x5e'),_0xb828('0x5f'),'modifiedbyname',_0xb828('0x60'),'modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0xb828('0x61'),'msdyn_iotalertname',_0xb828('0x62'),_0xb828('0x63'),_0xb828('0x64'),_0xb828('0x65'),'owneridtype','owneridyominame',_0xb828('0x66'),_0xb828('0x67'),_0xb828('0x68'),_0xb828('0x69'),'productidname',_0xb828('0x6a'),_0xb828('0x6b'),'resolvebykpiidname',_0xb828('0x6c'),_0xb828('0x6d'),_0xb828('0x6e'),_0xb828('0x6f'),'slainvokedidname',_0xb828('0x70'),_0xb828('0x71'),_0xb828('0x72'),_0xb828('0x73'),'subjectidname',_0xb828('0x74'),_0xb828('0x75'),_0xb828('0x76'),_0xb828('0x77'),'utcconversiontimezonecode',_0xb828('0x78')];var _0x5f433c=_0x3ab88f[_0xb828('0x79')](_0x177468);return db[_0xb828('0x12')][_0xb828('0x34')]({'where':{'id':_0x2dbb3e[_0xb828('0x2b')]['id']},'attributes':['id','username',_0xb828('0x7a'),_0xb828('0x7b'),_0xb828('0x7c'),'clientId',_0xb828('0x7d'),_0xb828('0x7e')],'include':[{'model':db[_0xb828('0x7f')],'as':_0xb828('0x7f'),'attributes':['id',_0xb828('0x80'),_0xb828('0x81')]}]})[_0xb828('0xd')](handleEntityNotFound(_0x3eadbf,null))[_0xb828('0xd')](function(_0x4f7da0){if(_0x4f7da0){if(_0x4f7da0[_0xb828('0x7e')]){_0x4f7da0[_0xb828('0x82')]=_0x4f7da0[_0xb828('0x7f')]['data5'];_0x2b4fbb=sanitizeRemoteUri(_0x4f7da0['CloudProvider'][_0xb828('0x81')]);_0x1a46dc=getWebApiUrl(_0x2b4fbb);return _0x4f7da0;}_0x2b4fbb=sanitizeRemoteUri(_0x4f7da0[_0xb828('0x7b')]);_0x1a46dc=getWebApiUrl(_0x2b4fbb);var _0x5a38be={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x4f7da0[_0xb828('0x7c')]+'/oauth2/token','form':{'client_id':_0x4f7da0[_0xb828('0x83')],'resource':_0x2b4fbb,'username':_0x4f7da0[_0xb828('0x84')],'password':_0x4f7da0['password'],'grant_type':_0xb828('0x7a'),'client_secret':_0x4f7da0[_0xb828('0x7d')]},'json':!![]};return rp(_0x5a38be);}})[_0xb828('0xd')](function(_0x166746){_0x47586f=_0x166746[_0xb828('0x82')];var _0x2ec79c={'method':_0xb828('0x85'),'uri':encodeURI(_0x1a46dc+_0xb828('0x86')+_0x10cf1d+'\x27'),'headers':{'Authorization':_0xb828('0x87')+_0x47586f,'If-None-Match':null,'OData-Version':_0xb828('0x88')},'json':!![]};return rp(_0x2ec79c);})[_0xb828('0xd')](function(_0x5aaa27){var _0x532c75=_0x5aaa27[_0xb828('0x89')][0x0];var _0x283bff=_0x532c75['MetadataId'];var _0x277794={'method':_0xb828('0x85'),'uri':_0x1a46dc+'EntityDefinitions('+_0x283bff+_0xb828('0x8a'),'headers':{'Authorization':_0xb828('0x87')+_0x47586f,'If-None-Match':null,'OData-Version':_0xb828('0x88')},'json':!![]};return rp(_0x277794);})[_0xb828('0xd')](function(_0x5a0b53){_0x31d466=_0x5a0b53;_0x202b29=_0x31d466['Attributes'];_0x202b29=_[_0xb828('0x8b')](_0x202b29,function(_0x343302){return!_0x5f433c[_0xb828('0x8c')](_0x343302[_0xb828('0x8d')]);});var _0x5cd60d=[];var _0x3523a9=[];_0x202b29[_0xb828('0x8e')](function(_0x4951c6){if(_0x4951c6['@odata.type']){var _0x3a49be=_0x4951c6[_0xb828('0x8f')][_0xb828('0x90')](_0x4951c6['@odata.type'][_0xb828('0x3e')]('.')+0x1);if(_0x3a49be===_0xb828('0x91')){_0x5cd60d['push'](getSelectList(_0x1a46dc,_0x4954b3,_0x3523a9,_0x31d466['MetadataId'],_0x4951c6[_0xb828('0x92')],_0x47586f));}}});return Promise[_0xb828('0x93')](_0x5cd60d);})['then'](function(_0x45ef04){_0x415dd9=_0x45ef04[0x0];var _0x5acbbe=[];var _0x3f9ba6=[];_0x202b29['forEach'](function(_0x268607){if(!_[_0xb828('0x94')](_0x268607[_0xb828('0x8f')])){var _0x5ca5e6=_0x268607[_0xb828('0x8f')][_0xb828('0x90')](_0x268607['@odata.type']['lastIndexOf']('.')+0x1);if(_0x5ca5e6===_0xb828('0x95')){_0x5acbbe[_0xb828('0x96')](getBooleanList(_0x1a46dc,_0x4954b3,_0x3f9ba6,_0x31d466[_0xb828('0x92')],_0x268607[_0xb828('0x92')],_0x47586f));}}});return Promise[_0xb828('0x93')](_0x5acbbe);})[_0xb828('0xd')](function(_0x2da7e1){_0x14d3e7=_0x2da7e1[0x0];var _0x335a7c=[];var _0x30d988=[];_0x202b29[_0xb828('0x8e')](function(_0x190f0a){if(_0x190f0a[_0xb828('0x8f')]){var _0x95e5cd=_0x190f0a[_0xb828('0x8f')]['substring'](_0x190f0a['@odata.type'][_0xb828('0x3e')]('.')+0x1);if(_0x95e5cd==='StringAttributeMetadata'||_0x95e5cd==='DoubleAttributeMetadata'||_0x95e5cd==='BigIntAttributeMetadata'||_0x95e5cd===_0xb828('0x97')||_0x95e5cd==='MemoAttributeMetadata'||_0x95e5cd==='DateTimeAttributeMetadata'||_0x95e5cd==='StatusAttributeMetadata'||_0x95e5cd===_0xb828('0x98')||_0x95e5cd===_0xb828('0x99')||_0x95e5cd===_0xb828('0x9a')){_0x335a7c[_0xb828('0x96')](getInputList(_0x1a46dc,_0x4954b3,_0x95e5cd,_0x30d988,_0x31d466[_0xb828('0x92')],_0x190f0a[_0xb828('0x92')],_0x47586f));}}});return Promise[_0xb828('0x93')](_0x335a7c);})[_0xb828('0xd')](function(_0x3eea26){_0x493626=_0x3eea26[0x0];var _0x3ea444=_0x415dd9[_0xb828('0x79')](_0x14d3e7)[_0xb828('0x79')](_0x493626);var _0x39b171={'count':_0x3ea444[_0xb828('0x1d')],'rows':_0x3ea444};return _0x39b171;})['then'](respondWithResult(_0x3eadbf,null))[_0xb828('0x32')](function(_0x3adf16){var _0x42e505=_0x2dbb3e[_0xb828('0x20')][_0xb828('0x9b')]?0x1f4:_0x3adf16[_0xb828('0x9c')]||0x1f4;logger[_0xb828('0x9d')](_0x3adf16['stack']);delete _0x3adf16[_0xb828('0xf')];if(_0x42e505===0x191){_0x42e505=0x190;}_0x3eadbf[_0xb828('0xb')](_0x42e505)[_0xb828('0x10')](_0x2dbb3e['query'][_0xb828('0x9b')]?{'message':_0xb828('0x9e'),'statusCode':_0x3adf16['statusCode']}:_0x3adf16);});};function getSelectList(_0x25a9c4,_0x5e0c7e,_0x1873c5,_0x64bc31,_0xa0acbd,_0x386f13){var _0x59d598={'method':_0xb828('0x85'),'uri':_0x25a9c4+_0xb828('0x9f')+_0x64bc31+_0xb828('0xa0')+_0xa0acbd+_0xb828('0xa1')+_0xb828('0xa2'),'headers':{'Authorization':'Bearer\x20'+_0x386f13,'If-None-Match':null,'OData-Version':_0xb828('0x88')},'json':!![]};return rp(_0x59d598)[_0xb828('0xd')](function(_0x2bf731){var _0xf51ac2=[];var _0x5cd475=_0x2bf731['OptionSet'][_0xb828('0xa3')];_0x5cd475['forEach'](function(_0x57ecdf){_0xf51ac2[_0xb828('0x96')]({'name':_0x57ecdf['Label'][_0xb828('0xa4')][_0xb828('0xa5')],'value':String(_0x57ecdf[_0xb828('0xa6')])});});var _0x3d9764={'id':_0x5e0c7e+'_'+_0x2bf731[_0xb828('0x8d')],'name':_0x2bf731[_0xb828('0xa7')][_0xb828('0xa4')][_0xb828('0xa5')],'custom':![],'options':_0xf51ac2};_0x1873c5[_0xb828('0x96')](_0x3d9764);return _0x1873c5;});}function getBooleanList(_0x366828,_0x434617,_0x2d5f04,_0x223406,_0x45a61a,_0x31e758){var _0x83c775={'method':_0xb828('0x85'),'uri':_0x366828+_0xb828('0x9f')+_0x223406+_0xb828('0xa0')+_0x45a61a+_0xb828('0xa8'),'headers':{'Authorization':_0xb828('0x87')+_0x31e758,'If-None-Match':null,'OData-Version':_0xb828('0x88')},'json':!![]};return rp(_0x83c775)[_0xb828('0xd')](function(_0x3abd54){var _0x18b482=[];_0x18b482[_0xb828('0x96')]({'name':_0x3abd54[_0xb828('0xa9')][_0xb828('0xaa')][_0xb828('0xa5')][_0xb828('0xa4')][_0xb828('0xa5')],'value':_0xb828('0xab')},{'name':_0x3abd54[_0xb828('0xa9')][_0xb828('0xac')][_0xb828('0xa5')]['UserLocalizedLabel']['Label'],'value':_0xb828('0xad')});var _0x3be7b4={'id':_0x434617+'_'+_0x3abd54[_0xb828('0x8d')],'name':_0x3abd54[_0xb828('0xa7')][_0xb828('0xa4')][_0xb828('0xa5')],'custom':![],'options':_0x18b482};_0x2d5f04[_0xb828('0x96')](_0x3be7b4);return _0x2d5f04;});}function getInputList(_0x3c0543,_0x1484bc,_0x21268e,_0x2209db,_0x5763df,_0x208281,_0x52bef0){var _0x3a1616={'method':_0xb828('0x85'),'uri':_0x3c0543+_0xb828('0x9f')+_0x5763df+_0xb828('0xa0')+_0x208281+')/Microsoft.Dynamics.CRM.'+_0x21268e+_0xb828('0xae'),'headers':{'Authorization':_0xb828('0x87')+_0x52bef0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3a1616)[_0xb828('0xd')](function(_0x3a93c8){var _0x463e48={'id':_0x1484bc+'_'+_0x3a93c8[_0xb828('0x8d')],'name':_0x3a93c8[_0xb828('0xa7')]['UserLocalizedLabel']?_0x3a93c8[_0xb828('0xa7')][_0xb828('0xa4')]['Label']:_0x3a93c8['LogicalName'],'custom':![],'options':[]};_0x2209db[_0xb828('0x96')](_0x463e48);return _0x2209db;});} \ No newline at end of file +var _0x108a=['offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','catch','length','create','body','find','params','getConfigurations','findOne','Dynamics365Configuration','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data7','data5','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','Attributes','remove','includes','@odata.type','PicklistAttributeMetadata','push','all','forEach','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','?$select=DisplayName,LogicalName','util','lodash','api','../../mysqldb','../../components/integrations/configuration','status'];(function(_0x24c9d0,_0x4967b6){var _0x58c87f=function(_0x380793){while(--_0x380793){_0x24c9d0['push'](_0x24c9d0['shift']());}};_0x58c87f(++_0x4967b6);}(_0x108a,0x172));var _0xa108=function(_0x47cc4d,_0x28794b){_0x47cc4d=_0x47cc4d-0x0;var _0x3442ca=_0x108a[_0x47cc4d];return _0x3442ca;};'use strict';var rp=require('request-promise');var util=require(_0xa108('0x0'));var _=require(_0xa108('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa108('0x2'));var db=require(_0xa108('0x3'))['db'];var integrations=require(_0xa108('0x4'));function respondWithResult(_0x575c28,_0x34c565){_0x34c565=_0x34c565||0xc8;return function(_0x2ce36e){if(_0x2ce36e){return _0x575c28[_0xa108('0x5')](_0x34c565)['json'](_0x2ce36e);}};}function respondWithFilteredResult(_0x26ab84,_0xa90075){return function(_0xe6d22b){if(_0xe6d22b){var _0x4066ae=typeof _0xa90075[_0xa108('0x6')]===_0xa108('0x7')&&typeof _0xa90075[_0xa108('0x8')]===_0xa108('0x7');var _0x5ee7e6=_0xe6d22b[_0xa108('0x9')];var _0x32c869=_0x4066ae?0x0:_0xa90075[_0xa108('0x6')];var _0x5afbbe=_0x4066ae?_0xe6d22b[_0xa108('0x9')]:_0xa90075['offset']+_0xa90075[_0xa108('0x8')];var _0x3bd73b;if(_0x5afbbe>=_0x5ee7e6){_0x5afbbe=_0x5ee7e6;_0x3bd73b=0xc8;}else{_0x3bd73b=0xce;}_0x26ab84['status'](_0x3bd73b);return _0x26ab84[_0xa108('0xa')](_0xa108('0xb'),_0x32c869+'-'+_0x5afbbe+'/'+_0x5ee7e6)[_0xa108('0xc')](_0xe6d22b);}return null;};}function saveUpdates(_0x1debcf){return function(_0x2ca158){if(_0x2ca158){return _0x2ca158[_0xa108('0xd')](_0x1debcf)[_0xa108('0xe')](function(_0xf48242){return _0xf48242;});}return null;};}function removeEntity(_0x464aec){return function(_0x2f34a1){if(_0x2f34a1){return _0x2f34a1[_0xa108('0xf')]()[_0xa108('0xe')](function(){_0x464aec[_0xa108('0x5')](0xcc)[_0xa108('0x10')]();});}};}function handleEntityNotFound(_0x34ccc7){return function(_0x450471){if(!_0x450471){_0x34ccc7[_0xa108('0x11')](0x194);}return _0x450471;};}function handleError(_0x46f9e6,_0x186fdb){_0x186fdb=_0x186fdb||0x1f4;return function(_0x63bfb2){logger[_0xa108('0x12')](_0x63bfb2[_0xa108('0x13')]);if(_0x63bfb2[_0xa108('0x14')]){delete _0x63bfb2[_0xa108('0x14')];}_0x46f9e6['status'](_0x186fdb)[_0xa108('0x15')](_0x63bfb2);};}exports['index']=function(_0x437988,_0xaa4730){var _0x59b39c={},_0x51654e={},_0x3e28a5={'count':0x0,'rows':[]};var _0x21b300=_[_0xa108('0x16')](db['Dynamics365Account'][_0xa108('0x17')],function(_0x1e328b){return{'name':_0x1e328b[_0xa108('0x18')],'type':_0x1e328b[_0xa108('0x19')]['key']};});_0x51654e[_0xa108('0x1a')]=_['map'](_0x21b300,_0xa108('0x14'));_0x51654e['query']=_[_0xa108('0x1b')](_0x437988[_0xa108('0x1c')]);_0x51654e[_0xa108('0x1d')]=_[_0xa108('0x1e')](_0x51654e[_0xa108('0x1a')],_0x51654e[_0xa108('0x1c')]);_0x59b39c[_0xa108('0x1f')]=_['intersection'](_0x51654e[_0xa108('0x1a')],qs[_0xa108('0x20')](_0x437988[_0xa108('0x1c')][_0xa108('0x20')]));_0x59b39c[_0xa108('0x1f')]=_0x59b39c[_0xa108('0x1f')]['length']?_0x59b39c['attributes']:_0x51654e['model'];if(!_0x437988['query'][_0xa108('0x21')](_0xa108('0x22'))){_0x59b39c[_0xa108('0x8')]=qs[_0xa108('0x8')](_0x437988[_0xa108('0x1c')]['limit']);_0x59b39c[_0xa108('0x6')]=qs[_0xa108('0x6')](_0x437988[_0xa108('0x1c')]['offset']);}_0x59b39c[_0xa108('0x23')]=qs[_0xa108('0x24')](_0x437988[_0xa108('0x1c')][_0xa108('0x24')]);_0x59b39c['where']=qs[_0xa108('0x1d')](_[_0xa108('0x25')](_0x437988[_0xa108('0x1c')],_0x51654e[_0xa108('0x1d')]),_0x21b300);if(_0x437988[_0xa108('0x1c')][_0xa108('0x26')]){_0x59b39c[_0xa108('0x27')]=_[_0xa108('0x28')](_0x59b39c['where'],{'$or':_['map'](_0x21b300,function(_0x1e4299){if(_0x1e4299[_0xa108('0x19')]!==_0xa108('0x29')){var _0x4fc8fd={};_0x4fc8fd[_0x1e4299[_0xa108('0x14')]]={'$like':'%'+_0x437988[_0xa108('0x1c')][_0xa108('0x26')]+'%'};return _0x4fc8fd;}})});}_0x59b39c=_[_0xa108('0x28')]({},_0x59b39c,_0x437988[_0xa108('0x2a')]);var _0x4043ec={'where':_0x59b39c[_0xa108('0x27')]};return db[_0xa108('0x2b')][_0xa108('0x9')](_0x4043ec)[_0xa108('0xe')](function(_0x23dd74){_0x3e28a5['count']=_0x23dd74;if(_0x437988['query'][_0xa108('0x2c')]){_0x59b39c[_0xa108('0x2d')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xa108('0x2e')](_0x59b39c);})[_0xa108('0xe')](function(_0x1275af){_0x3e28a5[_0xa108('0x2f')]=_0x1275af;return _0x3e28a5;})[_0xa108('0xe')](respondWithFilteredResult(_0xaa4730,_0x59b39c))[_0xa108('0x30')](handleError(_0xaa4730,null));};exports['show']=function(_0x52d581,_0x40b9b0){var _0x2b25a2={'raw':![],'where':{'id':_0x52d581['params']['id']}},_0x335146={};_0x335146[_0xa108('0x1a')]=_[_0xa108('0x1b')](db[_0xa108('0x2b')][_0xa108('0x17')]);_0x335146['query']=_[_0xa108('0x1b')](_0x52d581[_0xa108('0x1c')]);_0x335146['filters']=_[_0xa108('0x1e')](_0x335146[_0xa108('0x1a')],_0x335146['query']);_0x2b25a2['attributes']=_[_0xa108('0x1e')](_0x335146[_0xa108('0x1a')],qs[_0xa108('0x20')](_0x52d581[_0xa108('0x1c')][_0xa108('0x20')]));_0x2b25a2[_0xa108('0x1f')]=_0x2b25a2[_0xa108('0x1f')][_0xa108('0x31')]?_0x2b25a2['attributes']:_0x335146[_0xa108('0x1a')];if(_0x52d581[_0xa108('0x1c')][_0xa108('0x2c')]){_0x2b25a2[_0xa108('0x2d')]=[{'all':!![]}];}_0x2b25a2=_[_0xa108('0x28')]({},_0x2b25a2,_0x52d581[_0xa108('0x2a')]);return db[_0xa108('0x2b')]['find'](_0x2b25a2)['then'](handleEntityNotFound(_0x40b9b0,null))[_0xa108('0xe')](respondWithResult(_0x40b9b0,null))[_0xa108('0x30')](handleError(_0x40b9b0,null));};exports[_0xa108('0x32')]=function(_0x5d38d7,_0x2998c7){return db['Dynamics365Account'][_0xa108('0x32')](_0x5d38d7[_0xa108('0x33')],{})['then'](respondWithResult(_0x2998c7,0xc9))[_0xa108('0x30')](handleError(_0x2998c7,null));};exports[_0xa108('0xd')]=function(_0x329c2d,_0x5be856){if(_0x329c2d['body']['id']){delete _0x329c2d['body']['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x329c2d['params']['id']}})['then'](handleEntityNotFound(_0x5be856,null))[_0xa108('0xe')](saveUpdates(_0x329c2d['body'],null))[_0xa108('0xe')](respondWithResult(_0x5be856,null))['catch'](handleError(_0x5be856,null));};exports[_0xa108('0xf')]=function(_0x36e56b,_0x3e812a){return db['Dynamics365Account'][_0xa108('0x34')]({'where':{'id':_0x36e56b[_0xa108('0x35')]['id']}})[_0xa108('0xe')](handleEntityNotFound(_0x3e812a,null))[_0xa108('0xe')](removeEntity(_0x3e812a,null))[_0xa108('0x30')](handleError(_0x3e812a,null));};exports[_0xa108('0x36')]=function(_0x1bdf21,_0x493bb5){var _0x57303b={};var _0x399c81={};var _0x571085;var _0xa97b36;return db[_0xa108('0x2b')][_0xa108('0x37')]({'where':{'id':_0x1bdf21[_0xa108('0x35')]['id']}})[_0xa108('0xe')](handleEntityNotFound(_0x493bb5,null))[_0xa108('0xe')](function(_0x1c7ab9){if(_0x1c7ab9){_0x571085=_0x1c7ab9;_0x399c81[_0xa108('0x1a')]=_['keys'](db[_0xa108('0x38')][_0xa108('0x17')]);_0x399c81['query']=_[_0xa108('0x1b')](_0x1bdf21[_0xa108('0x1c')]);_0x399c81[_0xa108('0x1d')]=_[_0xa108('0x1e')](_0x399c81[_0xa108('0x1a')],_0x399c81['query']);_0x57303b[_0xa108('0x1f')]=_[_0xa108('0x1e')](_0x399c81[_0xa108('0x1a')],qs[_0xa108('0x20')](_0x1bdf21[_0xa108('0x1c')][_0xa108('0x20')]));_0x57303b[_0xa108('0x1f')]=_0x57303b[_0xa108('0x1f')][_0xa108('0x31')]?_0x57303b[_0xa108('0x1f')]:_0x399c81[_0xa108('0x1a')];_0x57303b['order']=qs[_0xa108('0x24')](_0x1bdf21[_0xa108('0x1c')]['sort']);_0x57303b['where']=qs[_0xa108('0x1d')](_['pick'](_0x1bdf21[_0xa108('0x1c')],_0x399c81[_0xa108('0x1d')]));if(_0x1bdf21['query'][_0xa108('0x26')]){_0x57303b[_0xa108('0x27')]=_[_0xa108('0x28')](_0x57303b[_0xa108('0x27')],{'$or':_['map'](_0x57303b[_0xa108('0x1f')],function(_0x3e796a){var _0x48a162={};_0x48a162[_0x3e796a]={'$like':'%'+_0x1bdf21[_0xa108('0x1c')]['filter']+'%'};return _0x48a162;})});}_0x57303b=_[_0xa108('0x28')]({},_0x57303b,_0x1bdf21[_0xa108('0x2a')]);return _0x571085['getConfigurations'](_0x57303b);}})[_0xa108('0xe')](function(_0x43b981){if(_0x43b981){_0xa97b36=_0x43b981['length'];if(!_0x1bdf21[_0xa108('0x1c')][_0xa108('0x21')](_0xa108('0x22'))){_0x57303b[_0xa108('0x8')]=qs[_0xa108('0x8')](_0x1bdf21[_0xa108('0x1c')][_0xa108('0x8')]);_0x57303b[_0xa108('0x6')]=qs[_0xa108('0x6')](_0x1bdf21[_0xa108('0x1c')]['offset']);}return _0x571085[_0xa108('0x36')](_0x57303b);}})['then'](function(_0x12f9af){if(_0x12f9af){return _0x12f9af?{'count':_0xa97b36,'rows':_0x12f9af}:null;}})['then'](respondWithResult(_0x493bb5,null))[_0xa108('0x30')](handleError(_0x493bb5,null));};exports['addConfiguration']=function(_0x50b751,_0x5ad858){if(_0x50b751[_0xa108('0x33')]['id']){delete _0x50b751[_0xa108('0x33')]['id'];}return db[_0xa108('0x2b')][_0xa108('0x37')]({'where':{'id':_0x50b751['params']['id']}})[_0xa108('0xe')](handleEntityNotFound(_0x5ad858,null))['then'](function(_0x4d3b11){if(_0x4d3b11){_0x50b751[_0xa108('0x33')]['AccountId']=_0x4d3b11['id'];_0x50b751[_0xa108('0x33')]['Subjects']=integrations[_0xa108('0x39')](_0x50b751[_0xa108('0x33')][_0xa108('0x3a')],_0x50b751[_0xa108('0x33')][_0xa108('0x19')]);_0x50b751['body'][_0xa108('0x3b')]=integrations['getDescriptions'](_0x50b751[_0xa108('0x33')][_0xa108('0x3a')],_0x50b751[_0xa108('0x33')][_0xa108('0x19')]);return db['Dynamics365Configuration'][_0xa108('0x32')](_0x50b751['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0xa108('0x3c')],'as':_0xa108('0x3b')}]});}return null;})[_0xa108('0xe')](respondWithResult(_0x5ad858,null))['catch'](handleError(_0x5ad858,null));};function sanitizeRemoteUri(_0x3f5672){var _0x880825=_0x3f5672[_0xa108('0x3d')](-0x1);if(_0x880825==='/')return _0x3f5672[_0xa108('0x3e')](0x0,_0x3f5672[_0xa108('0x3f')](_0x880825));return _0x3f5672;}function getWebApiUrl(_0x18a6df){return util[_0xa108('0x40')](_0xa108('0x41'),_0x18a6df);}exports[_0xa108('0x42')]=function(_0x39d059,_0x4c4558){var _0xe82536=_0x39d059[_0xa108('0x1c')][_0xa108('0x43')];var _0x40e654=_0xe82536===_0xa108('0x44')?_0xa108('0x45'):_0xa108('0x46');var _0x13afb0='';var _0x3a4261='';var _0x3a002a='';var _0x2d7d0d='';var _0x73ca70='';var _0x31f55e='';var _0x42491f='';var _0x4c85d1='';var _0x326856=['title',_0xa108('0x47'),'customerid',_0xa108('0x48'),_0xa108('0x49'),_0xa108('0x4a'),_0xa108('0x4b'),_0xa108('0x4c'),_0xa108('0x4d'),_0xa108('0x4e')];var _0x37064d=[_0xa108('0x4f'),_0xa108('0x50'),_0xa108('0x51'),_0xa108('0x52'),_0xa108('0x53'),_0xa108('0x54'),_0xa108('0x55'),_0xa108('0x56'),_0xa108('0x57'),_0xa108('0x58'),_0xa108('0x59'),'createdbyyominame','createdon',_0xa108('0x5a'),'createdonbehalfbyyominame',_0xa108('0x5b'),_0xa108('0x5c'),_0xa108('0x5d'),'emailaddress','entitlementidname','entityimage_timestamp',_0xa108('0x5e'),_0xa108('0x5f'),'exchangerate',_0xa108('0x60'),_0xa108('0x61'),_0xa108('0x62'),'influencescore',_0xa108('0x63'),_0xa108('0x64'),_0xa108('0x65'),_0xa108('0x66'),_0xa108('0x67'),_0xa108('0x68'),'modifiedbyyominame','modifiedon',_0xa108('0x69'),'modifiedonbehalfbyyominame',_0xa108('0x6a'),_0xa108('0x6b'),'numberofchildincidents',_0xa108('0x6c'),'overriddencreatedon',_0xa108('0x6d'),_0xa108('0x6e'),_0xa108('0x6f'),_0xa108('0x70'),_0xa108('0x71'),'primarycontactidyominame',_0xa108('0x72'),_0xa108('0x73'),'productserialnumber',_0xa108('0x74'),_0xa108('0x75'),_0xa108('0x76'),_0xa108('0x77'),_0xa108('0x78'),_0xa108('0x79'),'slainvokedidname',_0xa108('0x7a'),_0xa108('0x7b'),_0xa108('0x7c'),_0xa108('0x7d'),'subjectidname',_0xa108('0x7e'),_0xa108('0x7f'),'transactioncurrencyidname',_0xa108('0x80'),'utcconversiontimezonecode',_0xa108('0x81')];var _0x15f263=_0x326856[_0xa108('0x82')](_0x37064d);return db[_0xa108('0x2b')][_0xa108('0x37')]({'where':{'id':_0x39d059[_0xa108('0x35')]['id']},'attributes':['id',_0xa108('0x83'),_0xa108('0x84'),_0xa108('0x85'),_0xa108('0x86'),_0xa108('0x87'),_0xa108('0x88'),_0xa108('0x89')],'include':[{'model':db['CloudProvider'],'as':_0xa108('0x8a'),'attributes':['id','data5',_0xa108('0x8b')]}]})[_0xa108('0xe')](handleEntityNotFound(_0x4c4558,null))[_0xa108('0xe')](function(_0x557ab1){if(_0x557ab1){if(_0x557ab1[_0xa108('0x89')]){_0x557ab1['access_token']=_0x557ab1[_0xa108('0x8a')][_0xa108('0x8c')];_0x4c85d1=sanitizeRemoteUri(_0x557ab1[_0xa108('0x8a')][_0xa108('0x8b')]);_0x42491f=getWebApiUrl(_0x4c85d1);return _0x557ab1;}_0x4c85d1=sanitizeRemoteUri(_0x557ab1[_0xa108('0x85')]);_0x42491f=getWebApiUrl(_0x4c85d1);var _0x5b2117={'method':_0xa108('0x8d'),'uri':_0xa108('0x8e')+_0x557ab1[_0xa108('0x86')]+_0xa108('0x8f'),'form':{'client_id':_0x557ab1['clientId'],'resource':_0x4c85d1,'username':_0x557ab1[_0xa108('0x83')],'password':_0x557ab1[_0xa108('0x84')],'grant_type':'password','client_secret':_0x557ab1['clientSecret']},'json':!![]};return rp(_0x5b2117);}})[_0xa108('0xe')](function(_0x61013d){_0x31f55e=_0x61013d[_0xa108('0x90')];var _0x4da4d2={'method':_0xa108('0x91'),'uri':encodeURI(_0x42491f+_0xa108('0x92')+_0x40e654+'\x27'),'headers':{'Authorization':_0xa108('0x93')+_0x31f55e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4da4d2);})[_0xa108('0xe')](function(_0x28f1e3){var _0xe2b41e=_0x28f1e3[_0xa108('0x94')][0x0];var _0x119cfe=_0xe2b41e[_0xa108('0x95')];var _0x191a3f={'method':_0xa108('0x91'),'uri':_0x42491f+_0xa108('0x96')+_0x119cfe+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xa108('0x93')+_0x31f55e,'If-None-Match':null,'OData-Version':_0xa108('0x97')},'json':!![]};return rp(_0x191a3f);})[_0xa108('0xe')](function(_0x3a8f65){_0x13afb0=_0x3a8f65;_0x3a4261=_0x13afb0[_0xa108('0x98')];_0x3a4261=_[_0xa108('0x99')](_0x3a4261,function(_0x708bb9){return!_0x15f263[_0xa108('0x9a')](_0x708bb9['LogicalName']);});var _0x4b30e2=[];var _0x2d579f=[];_0x3a4261['forEach'](function(_0x4aac8f){if(_0x4aac8f[_0xa108('0x9b')]){var _0x9d0d14=_0x4aac8f[_0xa108('0x9b')][_0xa108('0x3e')](_0x4aac8f[_0xa108('0x9b')][_0xa108('0x3f')]('.')+0x1);if(_0x9d0d14===_0xa108('0x9c')){_0x4b30e2[_0xa108('0x9d')](getSelectList(_0x42491f,_0xe82536,_0x2d579f,_0x13afb0[_0xa108('0x95')],_0x4aac8f[_0xa108('0x95')],_0x31f55e));}}});return Promise[_0xa108('0x9e')](_0x4b30e2);})[_0xa108('0xe')](function(_0x448d3a){_0x3a002a=_0x448d3a[0x0];var _0x27d02e=[];var _0xd07b9d=[];_0x3a4261[_0xa108('0x9f')](function(_0x39d36a){if(!_[_0xa108('0xa0')](_0x39d36a['@odata.type'])){var _0x3f4ca4=_0x39d36a[_0xa108('0x9b')][_0xa108('0x3e')](_0x39d36a[_0xa108('0x9b')][_0xa108('0x3f')]('.')+0x1);if(_0x3f4ca4===_0xa108('0xa1')){_0x27d02e[_0xa108('0x9d')](getBooleanList(_0x42491f,_0xe82536,_0xd07b9d,_0x13afb0[_0xa108('0x95')],_0x39d36a['MetadataId'],_0x31f55e));}}});return Promise[_0xa108('0x9e')](_0x27d02e);})['then'](function(_0x4ab264){_0x2d7d0d=_0x4ab264[0x0];var _0x18c196=[];var _0x8790a7=[];_0x3a4261[_0xa108('0x9f')](function(_0x47ab5f){if(_0x47ab5f[_0xa108('0x9b')]){var _0x13421c=_0x47ab5f[_0xa108('0x9b')][_0xa108('0x3e')](_0x47ab5f[_0xa108('0x9b')][_0xa108('0x3f')]('.')+0x1);if(_0x13421c===_0xa108('0xa2')||_0x13421c===_0xa108('0xa3')||_0x13421c===_0xa108('0xa4')||_0x13421c===_0xa108('0xa5')||_0x13421c===_0xa108('0xa6')||_0x13421c===_0xa108('0xa7')||_0x13421c===_0xa108('0xa8')||_0x13421c==='EntityNameAttributeMetadata'||_0x13421c===_0xa108('0xa9')||_0x13421c===_0xa108('0xaa')){_0x18c196[_0xa108('0x9d')](getInputList(_0x42491f,_0xe82536,_0x13421c,_0x8790a7,_0x13afb0[_0xa108('0x95')],_0x47ab5f[_0xa108('0x95')],_0x31f55e));}}});return Promise[_0xa108('0x9e')](_0x18c196);})[_0xa108('0xe')](function(_0x315f43){_0x73ca70=_0x315f43[0x0];var _0x45907=_0x3a002a[_0xa108('0x82')](_0x2d7d0d)[_0xa108('0x82')](_0x73ca70);var _0x224580={'count':_0x45907[_0xa108('0x31')],'rows':_0x45907};return _0x224580;})[_0xa108('0xe')](respondWithResult(_0x4c4558,null))['catch'](function(_0x753ac2){var _0xdc3c6b=_0x39d059[_0xa108('0x1c')][_0xa108('0xab')]?0x1f4:_0x753ac2[_0xa108('0xac')]||0x1f4;logger['error'](_0x753ac2[_0xa108('0x13')]);delete _0x753ac2['name'];if(_0xdc3c6b===0x191){_0xdc3c6b=0x190;}_0x4c4558['status'](_0xdc3c6b)['send'](_0x39d059[_0xa108('0x1c')][_0xa108('0xab')]?{'message':_0xa108('0xad'),'statusCode':_0x753ac2[_0xa108('0xac')]}:_0x753ac2);});};function getSelectList(_0x56eea3,_0x4ad6dc,_0x30e1a1,_0x301d99,_0x33e13f,_0x3f8941){var _0x41919e={'method':_0xa108('0x91'),'uri':_0x56eea3+'EntityDefinitions('+_0x301d99+_0xa108('0xae')+_0x33e13f+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xa108('0xaf'),'headers':{'Authorization':_0xa108('0x93')+_0x3f8941,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x41919e)['then'](function(_0x20a3e1){var _0x334c64=[];var _0xd083ae=_0x20a3e1[_0xa108('0xb0')][_0xa108('0xb1')];_0xd083ae['forEach'](function(_0x101374){_0x334c64[_0xa108('0x9d')]({'name':_0x101374[_0xa108('0xb2')][_0xa108('0xb3')]['Label'],'value':String(_0x101374[_0xa108('0xb4')])});});var _0x58ce3a={'id':_0x4ad6dc+'_'+_0x20a3e1[_0xa108('0xb5')],'name':_0x20a3e1[_0xa108('0xb6')]['UserLocalizedLabel'][_0xa108('0xb2')],'custom':![],'options':_0x334c64};_0x30e1a1['push'](_0x58ce3a);return _0x30e1a1;});}function getBooleanList(_0x2c49e3,_0x38962a,_0x391e3c,_0xfc0310,_0x595b25,_0x50a152){var _0x44e927={'method':_0xa108('0x91'),'uri':_0x2c49e3+_0xa108('0x96')+_0xfc0310+_0xa108('0xae')+_0x595b25+_0xa108('0xb7'),'headers':{'Authorization':_0xa108('0x93')+_0x50a152,'If-None-Match':null,'OData-Version':_0xa108('0x97')},'json':!![]};return rp(_0x44e927)[_0xa108('0xe')](function(_0x582d77){var _0x49793c=[];_0x49793c[_0xa108('0x9d')]({'name':_0x582d77[_0xa108('0xb0')][_0xa108('0xb8')]['Label'][_0xa108('0xb3')][_0xa108('0xb2')],'value':'true'},{'name':_0x582d77[_0xa108('0xb0')][_0xa108('0xb9')][_0xa108('0xb2')][_0xa108('0xb3')][_0xa108('0xb2')],'value':_0xa108('0xba')});var _0x252569={'id':_0x38962a+'_'+_0x582d77['LogicalName'],'name':_0x582d77[_0xa108('0xb6')][_0xa108('0xb3')][_0xa108('0xb2')],'custom':![],'options':_0x49793c};_0x391e3c[_0xa108('0x9d')](_0x252569);return _0x391e3c;});}function getInputList(_0x4b3290,_0x128ebb,_0x140019,_0xba67ec,_0x3a1ccf,_0x5a7bab,_0x3b3d86){var _0x412ef4={'method':'GET','uri':_0x4b3290+_0xa108('0x96')+_0x3a1ccf+_0xa108('0xae')+_0x5a7bab+')/Microsoft.Dynamics.CRM.'+_0x140019+_0xa108('0xbb'),'headers':{'Authorization':_0xa108('0x93')+_0x3b3d86,'If-None-Match':null,'OData-Version':_0xa108('0x97')},'json':!![]};return rp(_0x412ef4)[_0xa108('0xe')](function(_0xa47705){var _0x3b9788={'id':_0x128ebb+'_'+_0xa47705[_0xa108('0xb5')],'name':_0xa47705[_0xa108('0xb6')][_0xa108('0xb3')]?_0xa47705[_0xa108('0xb6')][_0xa108('0xb3')]['Label']:_0xa47705['LogicalName'],'custom':![],'options':[]};_0xba67ec[_0xa108('0x9d')](_0x3b9788);return _0xba67ec;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 51246e1..f89faa3 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x3ea59e,_0x42d141){var _0x5b01d6=function(_0xedeecf){while(--_0xedeecf){_0x3ea59e['push'](_0x3ea59e['shift']());}};_0x5b01d6(++_0x42d141);}(_0xe706,0xa3));var _0x6e70=function(_0x33a573,_0x5e88b2){_0x33a573=_0x33a573-0x0;var _0xa8c4c0=_0xe706[_0x33a573];return _0xa8c4c0;};'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'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'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 20bba6b..b2d569b 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 _0xef66=['stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','include','map','model','ShowDynamics365Account','where','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','Dynamics365Account,\x20%s,\x20%s','debug'];(function(_0x1bd1d1,_0x177176){var _0x178b20=function(_0x42f762){while(--_0x42f762){_0x1bd1d1['push'](_0x1bd1d1['shift']());}};_0x178b20(++_0x177176);}(_0xef66,0x19e));var _0x6ef6=function(_0x2199f5,_0xcce7be){_0x2199f5=_0x2199f5-0x0;var _0x240fbd=_0xef66[_0x2199f5];return _0x240fbd;};'use strict';var _=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var moment=require(_0x6ef6('0x2'));var BPromise=require(_0x6ef6('0x3'));var rs=require(_0x6ef6('0x4'));var fs=require('fs');var Redis=require(_0x6ef6('0x5'));var db=require(_0x6ef6('0x6'))['db'];var utils=require(_0x6ef6('0x7'));var logger=require(_0x6ef6('0x8'))(_0x6ef6('0x9'));var config=require('../../config/environment');var jayson=require(_0x6ef6('0xa'));var client=jayson['client'][_0x6ef6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c360b,_0x103db2,_0x444beb){return new BPromise(function(_0x467e75,_0x22f6c3){return client['request'](_0x5c360b,_0x444beb)['then'](function(_0x532105){logger[_0x6ef6('0xc')](_0x6ef6('0xd'),_0x103db2,'request\x20sent');logger[_0x6ef6('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x103db2,'request\x20sent',JSON[_0x6ef6('0xf')](_0x532105));if(_0x532105[_0x6ef6('0x10')]){if(_0x532105['error'][_0x6ef6('0x11')]===0x1f4){logger[_0x6ef6('0x10')](_0x6ef6('0xd'),_0x103db2,_0x532105[_0x6ef6('0x10')][_0x6ef6('0x12')]);return _0x22f6c3(_0x532105[_0x6ef6('0x10')][_0x6ef6('0x12')]);}logger[_0x6ef6('0x10')](_0x6ef6('0xd'),_0x103db2,_0x532105[_0x6ef6('0x10')][_0x6ef6('0x12')]);return _0x467e75(_0x532105['error'][_0x6ef6('0x12')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x103db2,'request\x20sent');_0x467e75(_0x532105[_0x6ef6('0x13')][_0x6ef6('0x12')]);}})[_0x6ef6('0x14')](function(_0xfb8bd7){logger[_0x6ef6('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x103db2,_0xfb8bd7);_0x22f6c3(_0xfb8bd7);});});}exports[_0x6ef6('0x15')]=function(_0x2f7234){var _0x1614a4=this;return new Promise(function(_0x401452,_0x13ddc9){return db[_0x6ef6('0x16')][_0x6ef6('0x17')]({'raw':_0x2f7234[_0x6ef6('0x18')]?_0x2f7234[_0x6ef6('0x18')][_0x6ef6('0x19')]===undefined?!![]:![]:!![],'where':_0x2f7234[_0x6ef6('0x18')]?_0x2f7234[_0x6ef6('0x18')]['where']||null:null,'attributes':_0x2f7234[_0x6ef6('0x18')]?_0x2f7234['options'][_0x6ef6('0x1a')]||null:null,'limit':_0x2f7234[_0x6ef6('0x18')]?_0x2f7234['options']['limit']||null:null,'include':_0x2f7234[_0x6ef6('0x18')]?_0x2f7234[_0x6ef6('0x18')][_0x6ef6('0x1b')]?_[_0x6ef6('0x1c')](_0x2f7234[_0x6ef6('0x18')]['include'],function(_0x1fca74){return{'model':db[_0x1fca74[_0x6ef6('0x1d')]],'as':_0x1fca74['as'],'attributes':_0x1fca74[_0x6ef6('0x1a')],'include':_0x1fca74[_0x6ef6('0x1b')]?_[_0x6ef6('0x1c')](_0x1fca74[_0x6ef6('0x1b')],function(_0xbb85af){return{'model':db[_0xbb85af[_0x6ef6('0x1d')]],'as':_0xbb85af['as'],'attributes':_0xbb85af[_0x6ef6('0x1a')],'include':_0xbb85af['include']?_[_0x6ef6('0x1c')](_0xbb85af[_0x6ef6('0x1b')],function(_0x32722c){return{'model':db[_0x32722c['model']],'as':_0x32722c['as'],'attributes':_0x32722c[_0x6ef6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4999ba){logger[_0x6ef6('0xc')]('GetDynamics365Account',_0x2f7234);logger[_0x6ef6('0xe')](_0x6ef6('0x15'),_0x2f7234,JSON[_0x6ef6('0xf')](_0x4999ba));_0x401452(_0x4999ba);})[_0x6ef6('0x14')](function(_0x3a0b0b){logger[_0x6ef6('0x10')](_0x6ef6('0x15'),_0x3a0b0b['message'],_0x2f7234);_0x13ddc9(_0x1614a4[_0x6ef6('0x10')](0x1f4,_0x3a0b0b[_0x6ef6('0x12')]));});});};exports[_0x6ef6('0x1e')]=function(_0x1d4ec0){var _0xc0b2a2=this;return new Promise(function(_0x15ab24,_0xb69826){return db[_0x6ef6('0x16')]['find']({'raw':_0x1d4ec0[_0x6ef6('0x18')]?_0x1d4ec0[_0x6ef6('0x18')][_0x6ef6('0x19')]===undefined?!![]:![]:!![],'where':_0x1d4ec0[_0x6ef6('0x18')]?_0x1d4ec0['options'][_0x6ef6('0x1f')]||null:null,'attributes':_0x1d4ec0['options']?_0x1d4ec0[_0x6ef6('0x18')]['attributes']||null:null,'include':_0x1d4ec0[_0x6ef6('0x18')]?_0x1d4ec0[_0x6ef6('0x18')][_0x6ef6('0x1b')]?_[_0x6ef6('0x1c')](_0x1d4ec0[_0x6ef6('0x18')][_0x6ef6('0x1b')],function(_0x543363){return{'model':db[_0x543363[_0x6ef6('0x1d')]],'as':_0x543363['as'],'attributes':_0x543363['attributes'],'include':_0x543363[_0x6ef6('0x1b')]?_[_0x6ef6('0x1c')](_0x543363[_0x6ef6('0x1b')],function(_0x4b7387){return{'model':db[_0x4b7387[_0x6ef6('0x1d')]],'as':_0x4b7387['as'],'attributes':_0x4b7387[_0x6ef6('0x1a')],'include':_0x4b7387[_0x6ef6('0x1b')]?_[_0x6ef6('0x1c')](_0x4b7387[_0x6ef6('0x1b')],function(_0x2b2bf5){return{'model':db[_0x2b2bf5[_0x6ef6('0x1d')]],'as':_0x2b2bf5['as'],'attributes':_0x2b2bf5[_0x6ef6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6ef6('0x20')](function(_0x4994d9){logger[_0x6ef6('0xc')](_0x6ef6('0x1e'),_0x1d4ec0);logger[_0x6ef6('0xe')](_0x6ef6('0x1e'),_0x1d4ec0,JSON['stringify'](_0x4994d9));_0x15ab24(_0x4994d9);})[_0x6ef6('0x14')](function(_0x3253a3){logger[_0x6ef6('0x10')](_0x6ef6('0x1e'),_0x3253a3['message'],_0x1d4ec0);_0xb69826(_0xc0b2a2[_0x6ef6('0x10')](0x1f4,_0x3253a3[_0x6ef6('0x12')]));});});}; \ No newline at end of file +var _0xdb22=['error','message','info','result','catch','Dynamics365Account','findAll','options','raw','where','limit','map','include','attributes','model','GetDynamics365Account','find','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdb22,0x1c3));var _0x2db2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdb22[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x2db2('0x0'));var util=require('util');var moment=require(_0x2db2('0x1'));var BPromise=require(_0x2db2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2db2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2db2('0x4'))(_0x2db2('0x5'));var config=require(_0x2db2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2db2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30f0b2,_0x4b5065,_0x291099){return new BPromise(function(_0x1e3b80,_0x1fb212){return client['request'](_0x30f0b2,_0x291099)[_0x2db2('0x8')](function(_0x263194){logger['info'](_0x2db2('0x9'),_0x4b5065,_0x2db2('0xa'));logger[_0x2db2('0xb')](_0x2db2('0xc'),_0x4b5065,_0x2db2('0xa'),JSON[_0x2db2('0xd')](_0x263194));if(_0x263194[_0x2db2('0xe')]){if(_0x263194[_0x2db2('0xe')]['code']===0x1f4){logger[_0x2db2('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x4b5065,_0x263194[_0x2db2('0xe')][_0x2db2('0xf')]);return _0x1fb212(_0x263194[_0x2db2('0xe')]['message']);}logger[_0x2db2('0xe')](_0x2db2('0x9'),_0x4b5065,_0x263194[_0x2db2('0xe')][_0x2db2('0xf')]);return _0x1e3b80(_0x263194[_0x2db2('0xe')][_0x2db2('0xf')]);}else{logger[_0x2db2('0x10')](_0x2db2('0x9'),_0x4b5065,_0x2db2('0xa'));_0x1e3b80(_0x263194[_0x2db2('0x11')][_0x2db2('0xf')]);}})[_0x2db2('0x12')](function(_0x18c81f){logger[_0x2db2('0xe')](_0x2db2('0x9'),_0x4b5065,_0x18c81f);_0x1fb212(_0x18c81f);});});}exports['GetDynamics365Account']=function(_0x1dedde){var _0x5e50d7=this;return new Promise(function(_0x406ddd,_0x18e2a7){return db[_0x2db2('0x13')][_0x2db2('0x14')]({'raw':_0x1dedde[_0x2db2('0x15')]?_0x1dedde[_0x2db2('0x15')][_0x2db2('0x16')]===undefined?!![]:![]:!![],'where':_0x1dedde['options']?_0x1dedde[_0x2db2('0x15')][_0x2db2('0x17')]||null:null,'attributes':_0x1dedde[_0x2db2('0x15')]?_0x1dedde['options']['attributes']||null:null,'limit':_0x1dedde['options']?_0x1dedde[_0x2db2('0x15')][_0x2db2('0x18')]||null:null,'include':_0x1dedde[_0x2db2('0x15')]?_0x1dedde[_0x2db2('0x15')]['include']?_[_0x2db2('0x19')](_0x1dedde['options'][_0x2db2('0x1a')],function(_0x5767da){return{'model':db[_0x5767da['model']],'as':_0x5767da['as'],'attributes':_0x5767da[_0x2db2('0x1b')],'include':_0x5767da['include']?_['map'](_0x5767da[_0x2db2('0x1a')],function(_0x5cbdca){return{'model':db[_0x5cbdca[_0x2db2('0x1c')]],'as':_0x5cbdca['as'],'attributes':_0x5cbdca[_0x2db2('0x1b')],'include':_0x5cbdca[_0x2db2('0x1a')]?_[_0x2db2('0x19')](_0x5cbdca[_0x2db2('0x1a')],function(_0x3694a8){return{'model':db[_0x3694a8[_0x2db2('0x1c')]],'as':_0x3694a8['as'],'attributes':_0x3694a8[_0x2db2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2db2('0x8')](function(_0x213c17){logger['info']('GetDynamics365Account',_0x1dedde);logger[_0x2db2('0xb')]('GetDynamics365Account',_0x1dedde,JSON[_0x2db2('0xd')](_0x213c17));_0x406ddd(_0x213c17);})[_0x2db2('0x12')](function(_0x28257c){logger[_0x2db2('0xe')](_0x2db2('0x1d'),_0x28257c[_0x2db2('0xf')],_0x1dedde);_0x18e2a7(_0x5e50d7[_0x2db2('0xe')](0x1f4,_0x28257c[_0x2db2('0xf')]));});});};exports['ShowDynamics365Account']=function(_0x5b2653){var _0x2867f2=this;return new Promise(function(_0x43eb3f,_0x4dda1e){return db[_0x2db2('0x13')][_0x2db2('0x1e')]({'raw':_0x5b2653[_0x2db2('0x15')]?_0x5b2653['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b2653[_0x2db2('0x15')]?_0x5b2653[_0x2db2('0x15')]['where']||null:null,'attributes':_0x5b2653[_0x2db2('0x15')]?_0x5b2653[_0x2db2('0x15')]['attributes']||null:null,'include':_0x5b2653['options']?_0x5b2653['options'][_0x2db2('0x1a')]?_[_0x2db2('0x19')](_0x5b2653['options'][_0x2db2('0x1a')],function(_0x296249){return{'model':db[_0x296249[_0x2db2('0x1c')]],'as':_0x296249['as'],'attributes':_0x296249[_0x2db2('0x1b')],'include':_0x296249['include']?_[_0x2db2('0x19')](_0x296249[_0x2db2('0x1a')],function(_0x23bc73){return{'model':db[_0x23bc73['model']],'as':_0x23bc73['as'],'attributes':_0x23bc73['attributes'],'include':_0x23bc73[_0x2db2('0x1a')]?_[_0x2db2('0x19')](_0x23bc73[_0x2db2('0x1a')],function(_0x3091e4){return{'model':db[_0x3091e4[_0x2db2('0x1c')]],'as':_0x3091e4['as'],'attributes':_0x3091e4[_0x2db2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2db2('0x8')](function(_0x27ea87){logger[_0x2db2('0x10')]('ShowDynamics365Account',_0x5b2653);logger[_0x2db2('0xb')]('ShowDynamics365Account',_0x5b2653,JSON[_0x2db2('0xd')](_0x27ea87));_0x43eb3f(_0x27ea87);})[_0x2db2('0x12')](function(_0x21612d){logger[_0x2db2('0xe')]('ShowDynamics365Account',_0x21612d[_0x2db2('0xf')],_0x5b2653);_0x4dda1e(_0x2867f2['error'](0x1f4,_0x21612d[_0x2db2('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index f42da3a..5fd0179 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 _0xb459=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','exports','util','path'];(function(_0x59308b,_0x1a729f){var _0x380534=function(_0xb6a005){while(--_0xb6a005){_0x59308b['push'](_0x59308b['shift']());}};_0x380534(++_0x1a729f);}(_0xb459,0x1ca));var _0x9b45=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0xb459[_0x3e2489];return _0x2254ce;};'use strict';var multer=require('multer');var util=require(_0x9b45('0x0'));var path=require(_0x9b45('0x1'));var timeout=require('connect-timeout');var express=require(_0x9b45('0x2'));var router=express[_0x9b45('0x3')]();var fs_extra=require(_0x9b45('0x4'));var auth=require(_0x9b45('0x5'));var interaction=require(_0x9b45('0x6'));var config=require(_0x9b45('0x7'));var controller=require(_0x9b45('0x8'));router[_0x9b45('0x9')]('/',auth[_0x9b45('0xa')](),controller['index']);router[_0x9b45('0x9')](_0x9b45('0xb'),auth[_0x9b45('0xa')](),controller['show']);router[_0x9b45('0x9')](_0x9b45('0xc'),auth[_0x9b45('0xa')](),controller[_0x9b45('0xd')]);router['get'](_0x9b45('0xe'),auth[_0x9b45('0xa')](),controller[_0x9b45('0xf')]);router['get'](_0x9b45('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x9b45('0x11')]('/',auth[_0x9b45('0xa')](),controller[_0x9b45('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x9b45('0xb'),auth[_0x9b45('0xa')](),controller['destroy']);module[_0x9b45('0x13')]=router; \ No newline at end of file +var _0x4df2=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/subjects','/:id/descriptions','getDescriptions','create'];(function(_0x42f993,_0x591779){var _0x380e13=function(_0x365279){while(--_0x365279){_0x42f993['push'](_0x42f993['shift']());}};_0x380e13(++_0x591779);}(_0x4df2,0xbf));var _0x24df=function(_0x2fe3df,_0x4e0603){_0x2fe3df=_0x2fe3df-0x0;var _0x50f2cd=_0x4df2[_0x2fe3df];return _0x50f2cd;};'use strict';var multer=require(_0x24df('0x0'));var util=require(_0x24df('0x1'));var path=require(_0x24df('0x2'));var timeout=require('connect-timeout');var express=require(_0x24df('0x3'));var router=express[_0x24df('0x4')]();var fs_extra=require(_0x24df('0x5'));var auth=require(_0x24df('0x6'));var interaction=require(_0x24df('0x7'));var config=require(_0x24df('0x8'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x24df('0x9')](),controller[_0x24df('0xa')]);router['get'](_0x24df('0xb'),auth[_0x24df('0x9')](),controller[_0x24df('0xc')]);router[_0x24df('0xd')]('/:id/fields',auth[_0x24df('0x9')](),controller['getFields']);router[_0x24df('0xd')](_0x24df('0xe'),auth[_0x24df('0x9')](),controller['getSubjects']);router[_0x24df('0xd')](_0x24df('0xf'),auth[_0x24df('0x9')](),controller[_0x24df('0x10')]);router['post']('/',auth[_0x24df('0x9')](),controller[_0x24df('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x24df('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index eb7f2ce..b3ee079 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 _0x7768=['contact','nothing','BOOLEAN','STRING','ENUM','incident','phonecall'];(function(_0x2eee99,_0x102d54){var _0x2689b0=function(_0x560c81){while(--_0x560c81){_0x2eee99['push'](_0x2eee99['shift']());}};_0x2689b0(++_0x102d54);}(_0x7768,0x145));var _0x8776=function(_0x175391,_0x98f011){_0x175391=_0x175391-0x0;var _0x44b8cf=_0x7768[_0x175391];return _0x44b8cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8776('0x0')]},'ticketType':{'type':Sequelize[_0x8776('0x1')](_0x8776('0x2'),_0x8776('0x3')),'defaultValue':_0x8776('0x2')},'moduleCreate':{'type':Sequelize['ENUM'](_0x8776('0x4'),_0x8776('0x5')),'defaultValue':_0x8776('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8776('0x0')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x8776('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x97b7=['STRING','ENUM','incident','contact','nothing','BOOLEAN','sequelize','exports'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x97b7,0x14e));var _0x797b=function(_0x3944f0,_0x5a6429){_0x3944f0=_0x3944f0-0x0;var _0x181472=_0x97b7[_0x3944f0];return _0x181472;};'use strict';var Sequelize=require(_0x797b('0x0'));module[_0x797b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x797b('0x2')]},'ticketType':{'type':Sequelize[_0x797b('0x3')](_0x797b('0x4'),'phonecall'),'defaultValue':_0x797b('0x4')},'moduleCreate':{'type':Sequelize[_0x797b('0x3')](_0x797b('0x5'),_0x797b('0x6')),'defaultValue':_0x797b('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x797b('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x797b('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 30a195e..de6adec 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 _0x8462=['../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','rawAttributes','type','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','limit','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','Dynamics365Configuration','findAll','rows','fields','find','create','body','catch','params','getFields','findOne','order','nolimit','getSubjects','Dynamics365Field','options','getDescriptions','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','api','../../config/utils','../../config/environment'];(function(_0x57b239,_0x582f29){var _0x5a22b9=function(_0x12a820){while(--_0x12a820){_0x57b239['push'](_0x57b239['shift']());}};_0x5a22b9(++_0x582f29);}(_0x8462,0x16c));var _0x2846=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x8462[_0x11a55c];return _0x26c390;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2846('0x0'));var rp=require(_0x2846('0x1'));var moment=require(_0x2846('0x2'));var BPromise=require(_0x2846('0x3'));var Mustache=require('mustache');var util=require(_0x2846('0x4'));var path=require(_0x2846('0x5'));var sox=require(_0x2846('0x6'));var csv=require(_0x2846('0x7'));var ejs=require(_0x2846('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2846('0x9'));var squel=require('squel');var crypto=require(_0x2846('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2846('0xb'));var toCsv=require(_0x2846('0x7'));var querystring=require(_0x2846('0xc'));var Papa=require(_0x2846('0xd'));var Redis=require(_0x2846('0xe'));var authService=require(_0x2846('0xf'));var qs=require(_0x2846('0x10'));var as=require(_0x2846('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2846('0x12'));var utils=require(_0x2846('0x13'));var config=require(_0x2846('0x14'));var licenseUtil=require(_0x2846('0x15'));var db=require(_0x2846('0x16'))['db'];function respondWithStatusCode(_0x4c5463,_0x252727){_0x252727=_0x252727||0xcc;return function(_0x270895){if(_0x270895){return _0x4c5463[_0x2846('0x17')](_0x252727);}return _0x4c5463[_0x2846('0x18')](_0x252727)['end']();};}function respondWithResult(_0x47a587,_0x225b70){_0x225b70=_0x225b70||0xc8;return function(_0x3c7877){if(_0x3c7877){return _0x47a587['status'](_0x225b70)['json'](_0x3c7877);}};}function respondWithFilteredResult(_0x4ce98e,_0x55877f){return function(_0x1d3876){if(_0x1d3876){var _0x36d02d=typeof _0x55877f[_0x2846('0x19')]===_0x2846('0x1a')&&typeof _0x55877f['limit']===_0x2846('0x1a');var _0x262b2d=_0x1d3876[_0x2846('0x1b')];var _0x5449e1=_0x36d02d?0x0:_0x55877f[_0x2846('0x19')];var _0x10012d=_0x36d02d?_0x1d3876[_0x2846('0x1b')]:_0x55877f['offset']+_0x55877f['limit'];var _0x56f926;if(_0x10012d>=_0x262b2d){_0x10012d=_0x262b2d;_0x56f926=0xc8;}else{_0x56f926=0xce;}_0x4ce98e[_0x2846('0x18')](_0x56f926);return _0x4ce98e[_0x2846('0x1c')](_0x2846('0x1d'),_0x5449e1+'-'+_0x10012d+'/'+_0x262b2d)['json'](_0x1d3876);}return null;};}function patchUpdates(_0x4e0353){return function(_0x1de40a){try{jsonpatch[_0x2846('0x1e')](_0x1de40a,_0x4e0353,!![]);}catch(_0x741b7b){return BPromise[_0x2846('0x1f')](_0x741b7b);}return _0x1de40a['save']();};}function saveUpdates(_0x3e6597,_0x5307df){return function(_0x34cb89){if(_0x34cb89){return _0x34cb89[_0x2846('0x20')](_0x3e6597)[_0x2846('0x21')](function(_0x244c7d){return _0x244c7d;});}return null;};}function removeEntity(_0x159444,_0x2fab13){return function(_0x1e73e2){if(_0x1e73e2){return _0x1e73e2[_0x2846('0x22')]()[_0x2846('0x21')](function(){_0x159444[_0x2846('0x18')](0xcc)[_0x2846('0x23')]();});}};}function handleEntityNotFound(_0x32559f,_0x7a633){return function(_0x33b2a5){if(!_0x33b2a5){_0x32559f[_0x2846('0x17')](0x194);}return _0x33b2a5;};}function handleError(_0x1dae2e,_0x11438b){_0x11438b=_0x11438b||0x1f4;return function(_0x3da9a0){logger[_0x2846('0x24')](_0x3da9a0[_0x2846('0x25')]);if(_0x3da9a0[_0x2846('0x26')]){delete _0x3da9a0[_0x2846('0x26')];}_0x1dae2e[_0x2846('0x18')](_0x11438b)[_0x2846('0x27')](_0x3da9a0);};}exports['index']=function(_0x3cd6fe,_0x1d9d2b){var _0x3086c={},_0x171290={},_0x494e4f={'count':0x0,'rows':[]};var _0x5eb46f=_['map'](db['Dynamics365Configuration'][_0x2846('0x28')],function(_0x3c1c0a){return{'name':_0x3c1c0a['fieldName'],'type':_0x3c1c0a[_0x2846('0x29')]['key']};});_0x171290['model']=_[_0x2846('0x2a')](_0x5eb46f,_0x2846('0x26'));_0x171290[_0x2846('0x2b')]=_[_0x2846('0x2c')](_0x3cd6fe[_0x2846('0x2b')]);_0x171290[_0x2846('0x2d')]=_[_0x2846('0x2e')](_0x171290[_0x2846('0x2f')],_0x171290[_0x2846('0x2b')]);_0x3086c[_0x2846('0x30')]=_['intersection'](_0x171290[_0x2846('0x2f')],qs['fields'](_0x3cd6fe['query']['fields']));_0x3086c[_0x2846('0x30')]=_0x3086c[_0x2846('0x30')][_0x2846('0x31')]?_0x3086c[_0x2846('0x30')]:_0x171290[_0x2846('0x2f')];if(!_0x3cd6fe['query'][_0x2846('0x32')]('nolimit')){_0x3086c[_0x2846('0x33')]=qs[_0x2846('0x33')](_0x3cd6fe[_0x2846('0x2b')][_0x2846('0x33')]);_0x3086c['offset']=qs[_0x2846('0x19')](_0x3cd6fe['query']['offset']);}_0x3086c['order']=qs[_0x2846('0x34')](_0x3cd6fe['query'][_0x2846('0x34')]);_0x3086c['where']=qs[_0x2846('0x2d')](_[_0x2846('0x35')](_0x3cd6fe[_0x2846('0x2b')],_0x171290['filters']),_0x5eb46f);if(_0x3cd6fe[_0x2846('0x2b')][_0x2846('0x36')]){_0x3086c['where']=_[_0x2846('0x37')](_0x3086c[_0x2846('0x38')],{'$or':_[_0x2846('0x2a')](_0x5eb46f,function(_0x39fffe){if(_0x39fffe[_0x2846('0x29')]!==_0x2846('0x39')){var _0x25230b={};_0x25230b[_0x39fffe[_0x2846('0x26')]]={'$like':'%'+_0x3cd6fe[_0x2846('0x2b')][_0x2846('0x36')]+'%'};return _0x25230b;}})});}_0x3086c=_[_0x2846('0x37')]({},_0x3086c,_0x3cd6fe['options']);var _0x12dbd6={'where':_0x3086c['where']};return db['Dynamics365Configuration']['count'](_0x12dbd6)['then'](function(_0x553602){_0x494e4f[_0x2846('0x1b')]=_0x553602;if(_0x3cd6fe[_0x2846('0x2b')][_0x2846('0x3a')]){_0x3086c[_0x2846('0x3b')]=[{'all':!![]}];}return db[_0x2846('0x3c')][_0x2846('0x3d')](_0x3086c);})[_0x2846('0x21')](function(_0x621701){_0x494e4f[_0x2846('0x3e')]=_0x621701;return _0x494e4f;})[_0x2846('0x21')](respondWithFilteredResult(_0x1d9d2b,_0x3086c))['catch'](handleError(_0x1d9d2b,null));};exports['show']=function(_0x4e846e,_0x549ef7){var _0x3e61fa={'raw':![],'where':{'id':_0x4e846e['params']['id']}},_0x2f21c1={};_0x2f21c1[_0x2846('0x2f')]=_[_0x2846('0x2c')](db[_0x2846('0x3c')][_0x2846('0x28')]);_0x2f21c1[_0x2846('0x2b')]=_[_0x2846('0x2c')](_0x4e846e[_0x2846('0x2b')]);_0x2f21c1['filters']=_[_0x2846('0x2e')](_0x2f21c1[_0x2846('0x2f')],_0x2f21c1['query']);_0x3e61fa[_0x2846('0x30')]=_[_0x2846('0x2e')](_0x2f21c1[_0x2846('0x2f')],qs[_0x2846('0x3f')](_0x4e846e[_0x2846('0x2b')][_0x2846('0x3f')]));_0x3e61fa[_0x2846('0x30')]=_0x3e61fa[_0x2846('0x30')][_0x2846('0x31')]?_0x3e61fa[_0x2846('0x30')]:_0x2f21c1[_0x2846('0x2f')];if(_0x4e846e[_0x2846('0x2b')][_0x2846('0x3a')]){_0x3e61fa[_0x2846('0x3b')]=[{'all':!![]}];}_0x3e61fa=_[_0x2846('0x37')]({},_0x3e61fa,_0x4e846e['options']);return db[_0x2846('0x3c')][_0x2846('0x40')](_0x3e61fa)['then'](handleEntityNotFound(_0x549ef7,null))[_0x2846('0x21')](respondWithResult(_0x549ef7,null))['catch'](handleError(_0x549ef7,null));};exports[_0x2846('0x41')]=function(_0x2c2e9e,_0x50662c){return db[_0x2846('0x3c')]['create'](_0x2c2e9e[_0x2846('0x42')],{})[_0x2846('0x21')](respondWithResult(_0x50662c,0xc9))[_0x2846('0x43')](handleError(_0x50662c,null));};exports[_0x2846('0x20')]=function(_0xe471ff,_0x313801){if(_0xe471ff[_0x2846('0x42')]['id']){delete _0xe471ff[_0x2846('0x42')]['id'];}return db['Dynamics365Configuration'][_0x2846('0x40')]({'where':{'id':_0xe471ff[_0x2846('0x44')]['id']}})[_0x2846('0x21')](handleEntityNotFound(_0x313801,null))[_0x2846('0x21')](saveUpdates(_0xe471ff[_0x2846('0x42')],null))[_0x2846('0x21')](respondWithResult(_0x313801,null))[_0x2846('0x43')](handleError(_0x313801,null));};exports[_0x2846('0x22')]=function(_0x271cb8,_0x3cf773){return db[_0x2846('0x3c')][_0x2846('0x40')]({'where':{'id':_0x271cb8['params']['id']}})[_0x2846('0x21')](handleEntityNotFound(_0x3cf773,null))['then'](removeEntity(_0x3cf773,null))['catch'](handleError(_0x3cf773,null));};exports[_0x2846('0x45')]=function(_0x37422b,_0x3243ac,_0x5bff5d){var _0x503cf3={};var _0x194cb4={};var _0x1cb998;var _0x25f088;return db[_0x2846('0x3c')][_0x2846('0x46')]({'where':{'id':_0x37422b[_0x2846('0x44')]['id']}})[_0x2846('0x21')](handleEntityNotFound(_0x3243ac,null))[_0x2846('0x21')](function(_0x5c68de){if(_0x5c68de){_0x1cb998=_0x5c68de;_0x194cb4[_0x2846('0x2f')]=_[_0x2846('0x2c')](db['Dynamics365Field']['rawAttributes']);_0x194cb4['query']=_[_0x2846('0x2c')](_0x37422b['query']);_0x194cb4['filters']=_['intersection'](_0x194cb4[_0x2846('0x2f')],_0x194cb4[_0x2846('0x2b')]);_0x503cf3['attributes']=_[_0x2846('0x2e')](_0x194cb4[_0x2846('0x2f')],qs['fields'](_0x37422b['query'][_0x2846('0x3f')]));_0x503cf3[_0x2846('0x30')]=_0x503cf3[_0x2846('0x30')]['length']?_0x503cf3[_0x2846('0x30')]:_0x194cb4[_0x2846('0x2f')];_0x503cf3[_0x2846('0x47')]=qs['sort'](_0x37422b[_0x2846('0x2b')]['sort']);_0x503cf3[_0x2846('0x38')]=qs[_0x2846('0x2d')](_['pick'](_0x37422b[_0x2846('0x2b')],_0x194cb4[_0x2846('0x2d')]));if(_0x37422b[_0x2846('0x2b')]['filter']){_0x503cf3['where']=_[_0x2846('0x37')](_0x503cf3[_0x2846('0x38')],{'$or':_['map'](_0x503cf3['attributes'],function(_0x19e362){var _0x4e3e09={};_0x4e3e09[_0x19e362]={'$like':'%'+_0x37422b[_0x2846('0x2b')][_0x2846('0x36')]+'%'};return _0x4e3e09;})});}_0x503cf3=_[_0x2846('0x37')]({},_0x503cf3,_0x37422b['options']);return _0x1cb998['getFields'](_0x503cf3);}})[_0x2846('0x21')](function(_0x3db006){if(_0x3db006){_0x25f088=_0x3db006['length'];if(!_0x37422b[_0x2846('0x2b')]['hasOwnProperty'](_0x2846('0x48'))){_0x503cf3[_0x2846('0x33')]=qs[_0x2846('0x33')](_0x37422b[_0x2846('0x2b')][_0x2846('0x33')]);_0x503cf3[_0x2846('0x19')]=qs[_0x2846('0x19')](_0x37422b[_0x2846('0x2b')][_0x2846('0x19')]);}return _0x1cb998['getFields'](_0x503cf3);}})['then'](function(_0x1befe5){if(_0x1befe5){return _0x1befe5?{'count':_0x25f088,'rows':_0x1befe5}:null;}})['then'](respondWithResult(_0x3243ac,null))[_0x2846('0x43')](handleError(_0x3243ac,null));};exports[_0x2846('0x49')]=function(_0xf06437,_0x486d8c,_0x5275bf){var _0x3aadd4={};var _0x46fc17={};var _0x3b1b00;var _0x367562;return db[_0x2846('0x3c')]['findOne']({'where':{'id':_0xf06437[_0x2846('0x44')]['id']}})[_0x2846('0x21')](handleEntityNotFound(_0x486d8c,null))[_0x2846('0x21')](function(_0xe78d21){if(_0xe78d21){_0x3b1b00=_0xe78d21;_0x46fc17[_0x2846('0x2f')]=_[_0x2846('0x2c')](db[_0x2846('0x4a')][_0x2846('0x28')]);_0x46fc17[_0x2846('0x2b')]=_[_0x2846('0x2c')](_0xf06437['query']);_0x46fc17['filters']=_[_0x2846('0x2e')](_0x46fc17[_0x2846('0x2f')],_0x46fc17['query']);_0x3aadd4[_0x2846('0x30')]=_[_0x2846('0x2e')](_0x46fc17[_0x2846('0x2f')],qs[_0x2846('0x3f')](_0xf06437['query'][_0x2846('0x3f')]));_0x3aadd4['attributes']=_0x3aadd4[_0x2846('0x30')][_0x2846('0x31')]?_0x3aadd4[_0x2846('0x30')]:_0x46fc17['model'];_0x3aadd4[_0x2846('0x47')]=qs[_0x2846('0x34')](_0xf06437[_0x2846('0x2b')][_0x2846('0x34')]);_0x3aadd4[_0x2846('0x38')]=qs[_0x2846('0x2d')](_['pick'](_0xf06437[_0x2846('0x2b')],_0x46fc17[_0x2846('0x2d')]));if(_0xf06437[_0x2846('0x2b')][_0x2846('0x36')]){_0x3aadd4[_0x2846('0x38')]=_[_0x2846('0x37')](_0x3aadd4[_0x2846('0x38')],{'$or':_[_0x2846('0x2a')](_0x3aadd4[_0x2846('0x30')],function(_0x5e1e3d){var _0x477719={};_0x477719[_0x5e1e3d]={'$like':'%'+_0xf06437[_0x2846('0x2b')][_0x2846('0x36')]+'%'};return _0x477719;})});}_0x3aadd4=_[_0x2846('0x37')]({},_0x3aadd4,_0xf06437[_0x2846('0x4b')]);return _0x3b1b00[_0x2846('0x49')](_0x3aadd4);}})[_0x2846('0x21')](function(_0x2330ab){if(_0x2330ab){_0x367562=_0x2330ab[_0x2846('0x31')];if(!_0xf06437[_0x2846('0x2b')][_0x2846('0x32')](_0x2846('0x48'))){_0x3aadd4[_0x2846('0x33')]=qs[_0x2846('0x33')](_0xf06437[_0x2846('0x2b')][_0x2846('0x33')]);_0x3aadd4[_0x2846('0x19')]=qs[_0x2846('0x19')](_0xf06437['query'][_0x2846('0x19')]);}return _0x3b1b00[_0x2846('0x49')](_0x3aadd4);}})[_0x2846('0x21')](function(_0x580eaf){if(_0x580eaf){return _0x580eaf?{'count':_0x367562,'rows':_0x580eaf}:null;}})[_0x2846('0x21')](respondWithResult(_0x486d8c,null))[_0x2846('0x43')](handleError(_0x486d8c,null));};exports['getDescriptions']=function(_0x41a98d,_0x4cb476,_0x11b0cf){var _0x5c7a7c={};var _0x245cd4={};var _0x3f6dbe;var _0x107add;return db[_0x2846('0x3c')]['findOne']({'where':{'id':_0x41a98d[_0x2846('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cb476,null))[_0x2846('0x21')](function(_0x555dfc){if(_0x555dfc){_0x3f6dbe=_0x555dfc;_0x245cd4['model']=_[_0x2846('0x2c')](db['Dynamics365Field']['rawAttributes']);_0x245cd4[_0x2846('0x2b')]=_[_0x2846('0x2c')](_0x41a98d[_0x2846('0x2b')]);_0x245cd4[_0x2846('0x2d')]=_[_0x2846('0x2e')](_0x245cd4['model'],_0x245cd4[_0x2846('0x2b')]);_0x5c7a7c['attributes']=_[_0x2846('0x2e')](_0x245cd4[_0x2846('0x2f')],qs[_0x2846('0x3f')](_0x41a98d['query']['fields']));_0x5c7a7c[_0x2846('0x30')]=_0x5c7a7c[_0x2846('0x30')][_0x2846('0x31')]?_0x5c7a7c[_0x2846('0x30')]:_0x245cd4[_0x2846('0x2f')];_0x5c7a7c[_0x2846('0x47')]=qs[_0x2846('0x34')](_0x41a98d[_0x2846('0x2b')][_0x2846('0x34')]);_0x5c7a7c[_0x2846('0x38')]=qs[_0x2846('0x2d')](_[_0x2846('0x35')](_0x41a98d[_0x2846('0x2b')],_0x245cd4[_0x2846('0x2d')]));if(_0x41a98d[_0x2846('0x2b')][_0x2846('0x36')]){_0x5c7a7c[_0x2846('0x38')]=_['merge'](_0x5c7a7c[_0x2846('0x38')],{'$or':_[_0x2846('0x2a')](_0x5c7a7c[_0x2846('0x30')],function(_0x54fa47){var _0x54ab37={};_0x54ab37[_0x54fa47]={'$like':'%'+_0x41a98d[_0x2846('0x2b')][_0x2846('0x36')]+'%'};return _0x54ab37;})});}_0x5c7a7c=_[_0x2846('0x37')]({},_0x5c7a7c,_0x41a98d[_0x2846('0x4b')]);return _0x3f6dbe[_0x2846('0x4c')](_0x5c7a7c);}})[_0x2846('0x21')](function(_0x392f49){if(_0x392f49){_0x107add=_0x392f49[_0x2846('0x31')];if(!_0x41a98d['query']['hasOwnProperty'](_0x2846('0x48'))){_0x5c7a7c[_0x2846('0x33')]=qs[_0x2846('0x33')](_0x41a98d[_0x2846('0x2b')]['limit']);_0x5c7a7c[_0x2846('0x19')]=qs[_0x2846('0x19')](_0x41a98d[_0x2846('0x2b')][_0x2846('0x19')]);}return _0x3f6dbe[_0x2846('0x4c')](_0x5c7a7c);}})[_0x2846('0x21')](function(_0x72e58b){if(_0x72e58b){return _0x72e58b?{'count':_0x107add,'rows':_0x72e58b}:null;}})[_0x2846('0x21')](respondWithResult(_0x4cb476,null))[_0x2846('0x43')](handleError(_0x4cb476,null));}; \ No newline at end of file +var _0x51a4=['update','then','destroy','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','body','catch','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save'];(function(_0x56a936,_0x457a1b){var _0x5ec02b=function(_0x242e0b){while(--_0x242e0b){_0x56a936['push'](_0x56a936['shift']());}};_0x5ec02b(++_0x457a1b);}(_0x51a4,0x1b8));var _0x451a=function(_0x127a47,_0xaa4991){_0x127a47=_0x127a47-0x0;var _0x4d76b9=_0x51a4[_0x127a47];return _0x4d76b9;};'use strict';var emlformat=require(_0x451a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x451a('0x1'));var jsonpatch=require(_0x451a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x451a('0x3'));var Mustache=require(_0x451a('0x4'));var util=require(_0x451a('0x5'));var path=require(_0x451a('0x6'));var sox=require(_0x451a('0x7'));var csv=require(_0x451a('0x8'));var ejs=require(_0x451a('0x9'));var fs=require('fs');var fs_extra=require(_0x451a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x451a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x451a('0xc'));var Redis=require(_0x451a('0xd'));var authService=require(_0x451a('0xe'));var qs=require(_0x451a('0xf'));var as=require(_0x451a('0x10'));var hardwareService=require(_0x451a('0x11'));var logger=require('../../config/logger')(_0x451a('0x12'));var utils=require(_0x451a('0x13'));var config=require(_0x451a('0x14'));var licenseUtil=require(_0x451a('0x15'));var db=require(_0x451a('0x16'))['db'];function respondWithStatusCode(_0x22316b,_0xbbd9c6){_0xbbd9c6=_0xbbd9c6||0xcc;return function(_0x2eb564){if(_0x2eb564){return _0x22316b[_0x451a('0x17')](_0xbbd9c6);}return _0x22316b[_0x451a('0x18')](_0xbbd9c6)['end']();};}function respondWithResult(_0x43fa98,_0x435040){_0x435040=_0x435040||0xc8;return function(_0x54d235){if(_0x54d235){return _0x43fa98[_0x451a('0x18')](_0x435040)['json'](_0x54d235);}};}function respondWithFilteredResult(_0x10af8c,_0x5bf630){return function(_0xf943f1){if(_0xf943f1){var _0x3d2c51=typeof _0x5bf630[_0x451a('0x19')]==='undefined'&&typeof _0x5bf630[_0x451a('0x1a')]===_0x451a('0x1b');var _0x4a26be=_0xf943f1[_0x451a('0x1c')];var _0x38f284=_0x3d2c51?0x0:_0x5bf630[_0x451a('0x19')];var _0x3d0ac9=_0x3d2c51?_0xf943f1[_0x451a('0x1c')]:_0x5bf630['offset']+_0x5bf630['limit'];var _0x400b64;if(_0x3d0ac9>=_0x4a26be){_0x3d0ac9=_0x4a26be;_0x400b64=0xc8;}else{_0x400b64=0xce;}_0x10af8c[_0x451a('0x18')](_0x400b64);return _0x10af8c['set'](_0x451a('0x1d'),_0x38f284+'-'+_0x3d0ac9+'/'+_0x4a26be)[_0x451a('0x1e')](_0xf943f1);}return null;};}function patchUpdates(_0x51211b){return function(_0x39b1ed){try{jsonpatch[_0x451a('0x1f')](_0x39b1ed,_0x51211b,!![]);}catch(_0x32f678){return BPromise[_0x451a('0x20')](_0x32f678);}return _0x39b1ed[_0x451a('0x21')]();};}function saveUpdates(_0x3b9b50,_0x48c87c){return function(_0xa59a12){if(_0xa59a12){return _0xa59a12[_0x451a('0x22')](_0x3b9b50)[_0x451a('0x23')](function(_0x453e71){return _0x453e71;});}return null;};}function removeEntity(_0x847092,_0xb12a05){return function(_0x13a987){if(_0x13a987){return _0x13a987[_0x451a('0x24')]()['then'](function(){_0x847092[_0x451a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37ea59,_0x540319){return function(_0x520c4d){if(!_0x520c4d){_0x37ea59[_0x451a('0x17')](0x194);}return _0x520c4d;};}function handleError(_0x5b02e2,_0x157dca){_0x157dca=_0x157dca||0x1f4;return function(_0x568227){logger[_0x451a('0x25')](_0x568227['stack']);if(_0x568227['name']){delete _0x568227[_0x451a('0x26')];}_0x5b02e2['status'](_0x157dca)[_0x451a('0x27')](_0x568227);};}exports[_0x451a('0x28')]=function(_0x3db6d4,_0x97ea14){var _0x5384b6={},_0x268c72={},_0x304f84={'count':0x0,'rows':[]};var _0x2fefa0=_[_0x451a('0x29')](db[_0x451a('0x2a')][_0x451a('0x2b')],function(_0x129c16){return{'name':_0x129c16[_0x451a('0x2c')],'type':_0x129c16['type'][_0x451a('0x2d')]};});_0x268c72['model']=_['map'](_0x2fefa0,_0x451a('0x26'));_0x268c72[_0x451a('0x2e')]=_[_0x451a('0x2f')](_0x3db6d4[_0x451a('0x2e')]);_0x268c72[_0x451a('0x30')]=_[_0x451a('0x31')](_0x268c72[_0x451a('0x32')],_0x268c72[_0x451a('0x2e')]);_0x5384b6['attributes']=_[_0x451a('0x31')](_0x268c72['model'],qs[_0x451a('0x33')](_0x3db6d4['query']['fields']));_0x5384b6[_0x451a('0x34')]=_0x5384b6[_0x451a('0x34')][_0x451a('0x35')]?_0x5384b6['attributes']:_0x268c72[_0x451a('0x32')];if(!_0x3db6d4[_0x451a('0x2e')][_0x451a('0x36')](_0x451a('0x37'))){_0x5384b6[_0x451a('0x1a')]=qs[_0x451a('0x1a')](_0x3db6d4[_0x451a('0x2e')][_0x451a('0x1a')]);_0x5384b6['offset']=qs[_0x451a('0x19')](_0x3db6d4[_0x451a('0x2e')][_0x451a('0x19')]);}_0x5384b6[_0x451a('0x38')]=qs[_0x451a('0x39')](_0x3db6d4['query'][_0x451a('0x39')]);_0x5384b6['where']=qs[_0x451a('0x30')](_[_0x451a('0x3a')](_0x3db6d4['query'],_0x268c72[_0x451a('0x30')]),_0x2fefa0);if(_0x3db6d4[_0x451a('0x2e')][_0x451a('0x3b')]){_0x5384b6[_0x451a('0x3c')]=_[_0x451a('0x3d')](_0x5384b6['where'],{'$or':_['map'](_0x2fefa0,function(_0x380c39){if(_0x380c39[_0x451a('0x3e')]!==_0x451a('0x3f')){var _0x46c142={};_0x46c142[_0x380c39[_0x451a('0x26')]]={'$like':'%'+_0x3db6d4[_0x451a('0x2e')]['filter']+'%'};return _0x46c142;}})});}_0x5384b6=_['merge']({},_0x5384b6,_0x3db6d4['options']);var _0x523a79={'where':_0x5384b6[_0x451a('0x3c')]};return db[_0x451a('0x2a')][_0x451a('0x1c')](_0x523a79)[_0x451a('0x23')](function(_0x30d96c){_0x304f84['count']=_0x30d96c;if(_0x3db6d4[_0x451a('0x2e')][_0x451a('0x40')]){_0x5384b6[_0x451a('0x41')]=[{'all':!![]}];}return db[_0x451a('0x2a')][_0x451a('0x42')](_0x5384b6);})[_0x451a('0x23')](function(_0x4330b2){_0x304f84[_0x451a('0x43')]=_0x4330b2;return _0x304f84;})[_0x451a('0x23')](respondWithFilteredResult(_0x97ea14,_0x5384b6))['catch'](handleError(_0x97ea14,null));};exports['show']=function(_0x4a2867,_0x3b5682){var _0x40120d={'raw':![],'where':{'id':_0x4a2867[_0x451a('0x44')]['id']}},_0x17cbe2={};_0x17cbe2[_0x451a('0x32')]=_[_0x451a('0x2f')](db[_0x451a('0x2a')][_0x451a('0x2b')]);_0x17cbe2[_0x451a('0x2e')]=_[_0x451a('0x2f')](_0x4a2867[_0x451a('0x2e')]);_0x17cbe2[_0x451a('0x30')]=_[_0x451a('0x31')](_0x17cbe2[_0x451a('0x32')],_0x17cbe2['query']);_0x40120d['attributes']=_[_0x451a('0x31')](_0x17cbe2['model'],qs[_0x451a('0x33')](_0x4a2867[_0x451a('0x2e')][_0x451a('0x33')]));_0x40120d[_0x451a('0x34')]=_0x40120d['attributes'][_0x451a('0x35')]?_0x40120d[_0x451a('0x34')]:_0x17cbe2[_0x451a('0x32')];if(_0x4a2867[_0x451a('0x2e')][_0x451a('0x40')]){_0x40120d[_0x451a('0x41')]=[{'all':!![]}];}_0x40120d=_[_0x451a('0x3d')]({},_0x40120d,_0x4a2867[_0x451a('0x45')]);return db['Dynamics365Configuration'][_0x451a('0x46')](_0x40120d)[_0x451a('0x23')](handleEntityNotFound(_0x3b5682,null))[_0x451a('0x23')](respondWithResult(_0x3b5682,null))['catch'](handleError(_0x3b5682,null));};exports[_0x451a('0x47')]=function(_0x4219ed,_0x2c91d1){return db[_0x451a('0x2a')][_0x451a('0x47')](_0x4219ed[_0x451a('0x48')],{})['then'](respondWithResult(_0x2c91d1,0xc9))[_0x451a('0x49')](handleError(_0x2c91d1,null));};exports[_0x451a('0x22')]=function(_0x26d7bf,_0x2e05b8){if(_0x26d7bf[_0x451a('0x48')]['id']){delete _0x26d7bf['body']['id'];}return db[_0x451a('0x2a')]['find']({'where':{'id':_0x26d7bf['params']['id']}})['then'](handleEntityNotFound(_0x2e05b8,null))['then'](saveUpdates(_0x26d7bf['body'],null))[_0x451a('0x23')](respondWithResult(_0x2e05b8,null))['catch'](handleError(_0x2e05b8,null));};exports[_0x451a('0x24')]=function(_0x583827,_0x3291ab){return db[_0x451a('0x2a')][_0x451a('0x46')]({'where':{'id':_0x583827['params']['id']}})['then'](handleEntityNotFound(_0x3291ab,null))[_0x451a('0x23')](removeEntity(_0x3291ab,null))['catch'](handleError(_0x3291ab,null));};exports[_0x451a('0x4a')]=function(_0x2f01df,_0x6da23f,_0x46f394){var _0x569d33={};var _0x50b589={};var _0x547115;var _0x3f8c0e;return db['Dynamics365Configuration'][_0x451a('0x4b')]({'where':{'id':_0x2f01df['params']['id']}})['then'](handleEntityNotFound(_0x6da23f,null))['then'](function(_0xcc2fac){if(_0xcc2fac){_0x547115=_0xcc2fac;_0x50b589['model']=_[_0x451a('0x2f')](db[_0x451a('0x4c')][_0x451a('0x2b')]);_0x50b589[_0x451a('0x2e')]=_['keys'](_0x2f01df[_0x451a('0x2e')]);_0x50b589[_0x451a('0x30')]=_[_0x451a('0x31')](_0x50b589[_0x451a('0x32')],_0x50b589[_0x451a('0x2e')]);_0x569d33['attributes']=_[_0x451a('0x31')](_0x50b589[_0x451a('0x32')],qs[_0x451a('0x33')](_0x2f01df['query']['fields']));_0x569d33[_0x451a('0x34')]=_0x569d33[_0x451a('0x34')][_0x451a('0x35')]?_0x569d33[_0x451a('0x34')]:_0x50b589['model'];_0x569d33[_0x451a('0x38')]=qs[_0x451a('0x39')](_0x2f01df['query'][_0x451a('0x39')]);_0x569d33['where']=qs[_0x451a('0x30')](_[_0x451a('0x3a')](_0x2f01df['query'],_0x50b589[_0x451a('0x30')]));if(_0x2f01df[_0x451a('0x2e')]['filter']){_0x569d33['where']=_['merge'](_0x569d33[_0x451a('0x3c')],{'$or':_[_0x451a('0x29')](_0x569d33[_0x451a('0x34')],function(_0x1e0f3c){var _0x43a798={};_0x43a798[_0x1e0f3c]={'$like':'%'+_0x2f01df['query'][_0x451a('0x3b')]+'%'};return _0x43a798;})});}_0x569d33=_[_0x451a('0x3d')]({},_0x569d33,_0x2f01df[_0x451a('0x45')]);return _0x547115['getFields'](_0x569d33);}})['then'](function(_0x40a14c){if(_0x40a14c){_0x3f8c0e=_0x40a14c['length'];if(!_0x2f01df[_0x451a('0x2e')]['hasOwnProperty'](_0x451a('0x37'))){_0x569d33[_0x451a('0x1a')]=qs['limit'](_0x2f01df[_0x451a('0x2e')][_0x451a('0x1a')]);_0x569d33[_0x451a('0x19')]=qs[_0x451a('0x19')](_0x2f01df['query'][_0x451a('0x19')]);}return _0x547115[_0x451a('0x4a')](_0x569d33);}})[_0x451a('0x23')](function(_0x2824fe){if(_0x2824fe){return _0x2824fe?{'count':_0x3f8c0e,'rows':_0x2824fe}:null;}})['then'](respondWithResult(_0x6da23f,null))[_0x451a('0x49')](handleError(_0x6da23f,null));};exports[_0x451a('0x4d')]=function(_0x5d8829,_0x20d2db,_0x20bd19){var _0x405c95={};var _0x42d8ab={};var _0x25f22e;var _0x5330d1;return db[_0x451a('0x2a')][_0x451a('0x4b')]({'where':{'id':_0x5d8829['params']['id']}})['then'](handleEntityNotFound(_0x20d2db,null))[_0x451a('0x23')](function(_0x1a02ca){if(_0x1a02ca){_0x25f22e=_0x1a02ca;_0x42d8ab['model']=_['keys'](db[_0x451a('0x4c')]['rawAttributes']);_0x42d8ab['query']=_[_0x451a('0x2f')](_0x5d8829[_0x451a('0x2e')]);_0x42d8ab['filters']=_[_0x451a('0x31')](_0x42d8ab[_0x451a('0x32')],_0x42d8ab[_0x451a('0x2e')]);_0x405c95['attributes']=_[_0x451a('0x31')](_0x42d8ab[_0x451a('0x32')],qs[_0x451a('0x33')](_0x5d8829[_0x451a('0x2e')][_0x451a('0x33')]));_0x405c95['attributes']=_0x405c95[_0x451a('0x34')][_0x451a('0x35')]?_0x405c95[_0x451a('0x34')]:_0x42d8ab[_0x451a('0x32')];_0x405c95[_0x451a('0x38')]=qs[_0x451a('0x39')](_0x5d8829[_0x451a('0x2e')][_0x451a('0x39')]);_0x405c95[_0x451a('0x3c')]=qs['filters'](_[_0x451a('0x3a')](_0x5d8829[_0x451a('0x2e')],_0x42d8ab[_0x451a('0x30')]));if(_0x5d8829[_0x451a('0x2e')]['filter']){_0x405c95[_0x451a('0x3c')]=_[_0x451a('0x3d')](_0x405c95['where'],{'$or':_[_0x451a('0x29')](_0x405c95[_0x451a('0x34')],function(_0xfef560){var _0x25d8f2={};_0x25d8f2[_0xfef560]={'$like':'%'+_0x5d8829[_0x451a('0x2e')]['filter']+'%'};return _0x25d8f2;})});}_0x405c95=_[_0x451a('0x3d')]({},_0x405c95,_0x5d8829[_0x451a('0x45')]);return _0x25f22e[_0x451a('0x4d')](_0x405c95);}})['then'](function(_0xa96005){if(_0xa96005){_0x5330d1=_0xa96005[_0x451a('0x35')];if(!_0x5d8829[_0x451a('0x2e')][_0x451a('0x36')](_0x451a('0x37'))){_0x405c95[_0x451a('0x1a')]=qs[_0x451a('0x1a')](_0x5d8829[_0x451a('0x2e')][_0x451a('0x1a')]);_0x405c95['offset']=qs[_0x451a('0x19')](_0x5d8829[_0x451a('0x2e')]['offset']);}return _0x25f22e[_0x451a('0x4d')](_0x405c95);}})[_0x451a('0x23')](function(_0x4d69a2){if(_0x4d69a2){return _0x4d69a2?{'count':_0x5330d1,'rows':_0x4d69a2}:null;}})[_0x451a('0x23')](respondWithResult(_0x20d2db,null))[_0x451a('0x49')](handleError(_0x20d2db,null));};exports[_0x451a('0x4e')]=function(_0x111871,_0x404620,_0x275f5c){var _0x53b40b={};var _0x17e91b={};var _0x7e42a;var _0x86bd64;return db[_0x451a('0x2a')][_0x451a('0x4b')]({'where':{'id':_0x111871[_0x451a('0x44')]['id']}})[_0x451a('0x23')](handleEntityNotFound(_0x404620,null))[_0x451a('0x23')](function(_0x233e06){if(_0x233e06){_0x7e42a=_0x233e06;_0x17e91b[_0x451a('0x32')]=_[_0x451a('0x2f')](db[_0x451a('0x4c')][_0x451a('0x2b')]);_0x17e91b[_0x451a('0x2e')]=_['keys'](_0x111871['query']);_0x17e91b[_0x451a('0x30')]=_[_0x451a('0x31')](_0x17e91b['model'],_0x17e91b['query']);_0x53b40b[_0x451a('0x34')]=_['intersection'](_0x17e91b[_0x451a('0x32')],qs[_0x451a('0x33')](_0x111871[_0x451a('0x2e')]['fields']));_0x53b40b[_0x451a('0x34')]=_0x53b40b[_0x451a('0x34')]['length']?_0x53b40b['attributes']:_0x17e91b[_0x451a('0x32')];_0x53b40b[_0x451a('0x38')]=qs[_0x451a('0x39')](_0x111871['query']['sort']);_0x53b40b[_0x451a('0x3c')]=qs[_0x451a('0x30')](_[_0x451a('0x3a')](_0x111871[_0x451a('0x2e')],_0x17e91b[_0x451a('0x30')]));if(_0x111871['query']['filter']){_0x53b40b[_0x451a('0x3c')]=_['merge'](_0x53b40b[_0x451a('0x3c')],{'$or':_[_0x451a('0x29')](_0x53b40b['attributes'],function(_0x4363fb){var _0x47b42={};_0x47b42[_0x4363fb]={'$like':'%'+_0x111871[_0x451a('0x2e')][_0x451a('0x3b')]+'%'};return _0x47b42;})});}_0x53b40b=_[_0x451a('0x3d')]({},_0x53b40b,_0x111871['options']);return _0x7e42a[_0x451a('0x4e')](_0x53b40b);}})[_0x451a('0x23')](function(_0x5ddbc0){if(_0x5ddbc0){_0x86bd64=_0x5ddbc0[_0x451a('0x35')];if(!_0x111871[_0x451a('0x2e')][_0x451a('0x36')](_0x451a('0x37'))){_0x53b40b[_0x451a('0x1a')]=qs[_0x451a('0x1a')](_0x111871[_0x451a('0x2e')][_0x451a('0x1a')]);_0x53b40b[_0x451a('0x19')]=qs[_0x451a('0x19')](_0x111871[_0x451a('0x2e')][_0x451a('0x19')]);}return _0x7e42a[_0x451a('0x4e')](_0x53b40b);}})['then'](function(_0x4f29b4){if(_0x4f29b4){return _0x4f29b4?{'count':_0x86bd64,'rows':_0x4f29b4}:null;}})['then'](respondWithResult(_0x404620,null))['catch'](handleError(_0x404620,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1a9fde0..4b1608b 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52e05d,_0x45f151){var _0x579d10=function(_0x5b8ba3){while(--_0x5b8ba3){_0x52e05d['push'](_0x52e05d['shift']());}};_0x579d10(++_0x45f151);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0xb4e6[_0x237f8b];return _0x423f94;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','util'];(function(_0x5dc888,_0xeffd84){var _0x3b4ceb=function(_0xebbefe){while(--_0xebbefe){_0x5dc888['push'](_0x5dc888['shift']());}};_0x3b4ceb(++_0xeffd84);}(_0xedd9,0xfc));var _0x9edd=function(_0x4064b6,_0x45ed94){_0x4064b6=_0x4064b6-0x0;var _0x174f0b=_0xedd9[_0x4064b6];return _0x174f0b;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'int_dynamics365_configurations','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 07b75ea..b32a1eb 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 _0xfdd0=['http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0xfdd0,0x1ae));var _0x0fdd=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xfdd0[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x0fdd('0x0'));var util=require(_0x0fdd('0x1'));var moment=require('moment');var BPromise=require(_0x0fdd('0x2'));var rs=require(_0x0fdd('0x3'));var fs=require('fs');var Redis=require(_0x0fdd('0x4'));var db=require(_0x0fdd('0x5'))['db'];var utils=require(_0x0fdd('0x6'));var logger=require(_0x0fdd('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0fdd('0x8'));var client=jayson[_0x0fdd('0x9')][_0x0fdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17550e,_0x240edd,_0xd5170c){return new BPromise(function(_0x2bdf86,_0x34e96a){return client[_0x0fdd('0xb')](_0x17550e,_0xd5170c)[_0x0fdd('0xc')](function(_0x552ee5){logger[_0x0fdd('0xd')](_0x0fdd('0xe'),_0x240edd,_0x0fdd('0xf'));logger[_0x0fdd('0x10')](_0x0fdd('0x11'),_0x240edd,_0x0fdd('0xf'),JSON[_0x0fdd('0x12')](_0x552ee5));if(_0x552ee5[_0x0fdd('0x13')]){if(_0x552ee5[_0x0fdd('0x13')]['code']===0x1f4){logger[_0x0fdd('0x13')](_0x0fdd('0xe'),_0x240edd,_0x552ee5['error'][_0x0fdd('0x14')]);return _0x34e96a(_0x552ee5[_0x0fdd('0x13')][_0x0fdd('0x14')]);}logger[_0x0fdd('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x240edd,_0x552ee5[_0x0fdd('0x13')][_0x0fdd('0x14')]);return _0x2bdf86(_0x552ee5['error'][_0x0fdd('0x14')]);}else{logger[_0x0fdd('0xd')](_0x0fdd('0xe'),_0x240edd,_0x0fdd('0xf'));_0x2bdf86(_0x552ee5[_0x0fdd('0x15')]['message']);}})['catch'](function(_0x194edc){logger['error'](_0x0fdd('0xe'),_0x240edd,_0x194edc);_0x34e96a(_0x194edc);});});} \ No newline at end of file +var _0x8437=['code','Dynamics365Configuration,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8437,0xe1));var _0x7843=function(_0x3124b3,_0x5df3bd){_0x3124b3=_0x3124b3-0x0;var _0x5ce488=_0x8437[_0x3124b3];return _0x5ce488;};'use strict';var _=require(_0x7843('0x0'));var util=require(_0x7843('0x1'));var moment=require(_0x7843('0x2'));var BPromise=require(_0x7843('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7843('0x4'));var db=require(_0x7843('0x5'))['db'];var utils=require(_0x7843('0x6'));var logger=require(_0x7843('0x7'))('rpc');var config=require(_0x7843('0x8'));var jayson=require(_0x7843('0x9'));var client=jayson['client'][_0x7843('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaa2eb4,_0x43c357,_0x5ffaf2){return new BPromise(function(_0x148e40,_0x35faf2){return client['request'](_0xaa2eb4,_0x5ffaf2)[_0x7843('0xb')](function(_0x34fa2e){logger[_0x7843('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x43c357,'request\x20sent');logger[_0x7843('0xd')](_0x7843('0xe'),_0x43c357,'request\x20sent',JSON[_0x7843('0xf')](_0x34fa2e));if(_0x34fa2e[_0x7843('0x10')]){if(_0x34fa2e[_0x7843('0x10')][_0x7843('0x11')]===0x1f4){logger[_0x7843('0x10')](_0x7843('0x12'),_0x43c357,_0x34fa2e[_0x7843('0x10')][_0x7843('0x13')]);return _0x35faf2(_0x34fa2e[_0x7843('0x10')][_0x7843('0x13')]);}logger['error'](_0x7843('0x12'),_0x43c357,_0x34fa2e[_0x7843('0x10')][_0x7843('0x13')]);return _0x148e40(_0x34fa2e[_0x7843('0x10')][_0x7843('0x13')]);}else{logger[_0x7843('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x43c357,_0x7843('0x14'));_0x148e40(_0x34fa2e[_0x7843('0x15')]['message']);}})['catch'](function(_0x4cf3e2){logger[_0x7843('0x10')](_0x7843('0x12'),_0x43c357,_0x4cf3e2);_0x35faf2(_0x4cf3e2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 950e2d8..f77e0cd 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 _0xeb13=['./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xec302d,_0x4eb957){var _0x5d6ed1=function(_0x502505){while(--_0x502505){_0xec302d['push'](_0xec302d['shift']());}};_0x5d6ed1(++_0x4eb957);}(_0xeb13,0x13b));var _0x3eb1=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xeb13[_0xdd2bfa];return _0x55397e;};'use strict';var multer=require(_0x3eb1('0x0'));var util=require(_0x3eb1('0x1'));var path=require('path');var timeout=require(_0x3eb1('0x2'));var express=require(_0x3eb1('0x3'));var router=express['Router']();var fs_extra=require(_0x3eb1('0x4'));var auth=require(_0x3eb1('0x5'));var interaction=require(_0x3eb1('0x6'));var config=require(_0x3eb1('0x7'));var controller=require(_0x3eb1('0x8'));router[_0x3eb1('0x9')]('/',auth[_0x3eb1('0xa')](),controller['index']);router[_0x3eb1('0x9')](_0x3eb1('0xb'),auth[_0x3eb1('0xa')](),controller[_0x3eb1('0xc')]);router[_0x3eb1('0xd')]('/',auth['isAuthenticated'](),controller[_0x3eb1('0xe')]);router[_0x3eb1('0xf')](_0x3eb1('0xb'),auth[_0x3eb1('0xa')](),controller['update']);router[_0x3eb1('0x10')](_0x3eb1('0xb'),auth[_0x3eb1('0xa')](),controller[_0x3eb1('0x11')]);module[_0x3eb1('0x12')]=router; \ No newline at end of file +var _0xd3e3=['get','isAuthenticated','/:id','create','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x3314f1,_0x43ecad){var _0x2380c0=function(_0x3acb94){while(--_0x3acb94){_0x3314f1['push'](_0x3314f1['shift']());}};_0x2380c0(++_0x43ecad);}(_0xd3e3,0x19c));var _0x3d3e=function(_0x5d180a,_0x24766f){_0x5d180a=_0x5d180a-0x0;var _0x4d147d=_0xd3e3[_0x5d180a];return _0x4d147d;};'use strict';var multer=require(_0x3d3e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3d3e('0x1'));var express=require(_0x3d3e('0x2'));var router=express[_0x3d3e('0x3')]();var fs_extra=require(_0x3d3e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3d3e('0x5'));var config=require(_0x3d3e('0x6'));var controller=require(_0x3d3e('0x7'));router[_0x3d3e('0x8')]('/',auth[_0x3d3e('0x9')](),controller['index']);router[_0x3d3e('0x8')](_0x3d3e('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xb')]);router['put'](_0x3d3e('0xa'),auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xc')]);router['delete']('/:id',auth[_0x3d3e('0x9')](),controller[_0x3d3e('0xd')]);module[_0x3d3e('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index b5724e7..4d132c1 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 _0xfc9b=['keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xfc9b,0xe1));var _0xbfc9=function(_0x376019,_0x2c687e){_0x376019=_0x376019-0x0;var _0x3642f2=_0xfc9b[_0x376019];return _0x3642f2;};'use strict';var Sequelize=require(_0xbfc9('0x0'));module[_0xbfc9('0x1')]={'type':{'type':Sequelize[_0xbfc9('0x2')]('string',_0xbfc9('0x3'),_0xbfc9('0x4'),_0xbfc9('0x5'),_0xbfc9('0x6')),'defaultValue':_0xbfc9('0x7')},'content':{'type':Sequelize[_0xbfc9('0x8')]},'key':{'type':Sequelize[_0xbfc9('0x8')]},'keyType':{'type':Sequelize[_0xbfc9('0x2')](_0xbfc9('0x7'),'variable',_0xbfc9('0x4'))},'keyContent':{'type':Sequelize[_0xbfc9('0x8')]},'idField':{'type':Sequelize[_0xbfc9('0x8')]},'nameField':{'type':Sequelize[_0xbfc9('0x8')]},'customField':{'type':Sequelize[_0xbfc9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbfc9('0x8')]}}; \ No newline at end of file +var _0xb6ce=['STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0xb6ce,0x1f1));var _0xeb6c=function(_0xa7e8d4,_0x28758c){_0xa7e8d4=_0xa7e8d4-0x0;var _0x2a5c65=_0xb6ce[_0xa7e8d4];return _0x2a5c65;};'use strict';var Sequelize=require(_0xeb6c('0x0'));module[_0xeb6c('0x1')]={'type':{'type':Sequelize['ENUM'](_0xeb6c('0x2'),_0xeb6c('0x3'),_0xeb6c('0x4'),_0xeb6c('0x5'),_0xeb6c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xeb6c('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xeb6c('0x8')]('string',_0xeb6c('0x3'),_0xeb6c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xeb6c('0x7')]},'nameField':{'type':Sequelize[_0xeb6c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 0fbbb2b..c7ef6f7 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 _0x96c9=['ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','Dynamics365Field','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','catch','show','params','rawAttributes','include','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x4a2a9d,_0x2a0942){var _0xd5b621=function(_0x21e7b4){while(--_0x21e7b4){_0x4a2a9d['push'](_0x4a2a9d['shift']());}};_0xd5b621(++_0x2a0942);}(_0x96c9,0xc9));var _0x996c=function(_0x14365f,_0x36a6d7){_0x14365f=_0x14365f-0x0;var _0x2164bc=_0x96c9[_0x14365f];return _0x2164bc;};'use strict';var emlformat=require(_0x996c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x996c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x996c('0x2'));var moment=require(_0x996c('0x3'));var BPromise=require(_0x996c('0x4'));var Mustache=require(_0x996c('0x5'));var util=require(_0x996c('0x6'));var path=require(_0x996c('0x7'));var sox=require(_0x996c('0x8'));var csv=require('to-csv');var ejs=require(_0x996c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x996c('0xa'));var squel=require(_0x996c('0xb'));var crypto=require('crypto');var jsforce=require(_0x996c('0xc'));var deskjs=require(_0x996c('0xd'));var toCsv=require(_0x996c('0xe'));var querystring=require(_0x996c('0xf'));var Papa=require(_0x996c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x996c('0x11'));var hardwareService=require(_0x996c('0x12'));var logger=require('../../config/logger')(_0x996c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x996c('0x14'));var db=require(_0x996c('0x15'))['db'];function respondWithStatusCode(_0x35d2f2,_0x65f494){_0x65f494=_0x65f494||0xcc;return function(_0x2338df){if(_0x2338df){return _0x35d2f2[_0x996c('0x16')](_0x65f494);}return _0x35d2f2['status'](_0x65f494)['end']();};}function respondWithResult(_0x593821,_0x560a0f){_0x560a0f=_0x560a0f||0xc8;return function(_0x4c42db){if(_0x4c42db){return _0x593821['status'](_0x560a0f)[_0x996c('0x17')](_0x4c42db);}};}function respondWithFilteredResult(_0x2a2929,_0xfb621f){return function(_0x14d023){if(_0x14d023){var _0x2a425d=typeof _0xfb621f[_0x996c('0x18')]==='undefined'&&typeof _0xfb621f[_0x996c('0x19')]===_0x996c('0x1a');var _0x91fa1d=_0x14d023[_0x996c('0x1b')];var _0x30b52a=_0x2a425d?0x0:_0xfb621f[_0x996c('0x18')];var _0x338b62=_0x2a425d?_0x14d023[_0x996c('0x1b')]:_0xfb621f[_0x996c('0x18')]+_0xfb621f['limit'];var _0x166da6;if(_0x338b62>=_0x91fa1d){_0x338b62=_0x91fa1d;_0x166da6=0xc8;}else{_0x166da6=0xce;}_0x2a2929[_0x996c('0x1c')](_0x166da6);return _0x2a2929[_0x996c('0x1d')](_0x996c('0x1e'),_0x30b52a+'-'+_0x338b62+'/'+_0x91fa1d)['json'](_0x14d023);}return null;};}function patchUpdates(_0x256c46){return function(_0x3e5961){try{jsonpatch[_0x996c('0x1f')](_0x3e5961,_0x256c46,!![]);}catch(_0x546973){return BPromise[_0x996c('0x20')](_0x546973);}return _0x3e5961[_0x996c('0x21')]();};}function saveUpdates(_0x50f6f0,_0x59670b){return function(_0x31c1c5){if(_0x31c1c5){return _0x31c1c5[_0x996c('0x22')](_0x50f6f0)[_0x996c('0x23')](function(_0x366465){return _0x366465;});}return null;};}function removeEntity(_0x325021,_0x25916e){return function(_0x3d83b8){if(_0x3d83b8){return _0x3d83b8['destroy']()[_0x996c('0x23')](function(){_0x325021[_0x996c('0x1c')](0xcc)[_0x996c('0x24')]();});}};}function handleEntityNotFound(_0x5eacb1,_0x97256f){return function(_0x217bfe){if(!_0x217bfe){_0x5eacb1['sendStatus'](0x194);}return _0x217bfe;};}function handleError(_0x496b68,_0x115b39){_0x115b39=_0x115b39||0x1f4;return function(_0x1eaa94){logger[_0x996c('0x25')](_0x1eaa94['stack']);if(_0x1eaa94[_0x996c('0x26')]){delete _0x1eaa94[_0x996c('0x26')];}_0x496b68[_0x996c('0x1c')](_0x115b39)[_0x996c('0x27')](_0x1eaa94);};}exports[_0x996c('0x28')]=function(_0x223d2a,_0x90a531){var _0x108019={},_0x550ae0={},_0x3ae36c={'count':0x0,'rows':[]};var _0x35f543=_[_0x996c('0x29')](db[_0x996c('0x2a')]['rawAttributes'],function(_0x3a7b06){return{'name':_0x3a7b06[_0x996c('0x2b')],'type':_0x3a7b06[_0x996c('0x2c')]['key']};});_0x550ae0[_0x996c('0x2d')]=_[_0x996c('0x29')](_0x35f543,'name');_0x550ae0[_0x996c('0x2e')]=_[_0x996c('0x2f')](_0x223d2a['query']);_0x550ae0[_0x996c('0x30')]=_[_0x996c('0x31')](_0x550ae0[_0x996c('0x2d')],_0x550ae0[_0x996c('0x2e')]);_0x108019['attributes']=_[_0x996c('0x31')](_0x550ae0['model'],qs[_0x996c('0x32')](_0x223d2a[_0x996c('0x2e')][_0x996c('0x32')]));_0x108019[_0x996c('0x33')]=_0x108019[_0x996c('0x33')][_0x996c('0x34')]?_0x108019[_0x996c('0x33')]:_0x550ae0[_0x996c('0x2d')];if(!_0x223d2a[_0x996c('0x2e')][_0x996c('0x35')]('nolimit')){_0x108019[_0x996c('0x19')]=qs[_0x996c('0x19')](_0x223d2a['query'][_0x996c('0x19')]);_0x108019[_0x996c('0x18')]=qs[_0x996c('0x18')](_0x223d2a[_0x996c('0x2e')][_0x996c('0x18')]);}_0x108019[_0x996c('0x36')]=qs[_0x996c('0x37')](_0x223d2a[_0x996c('0x2e')][_0x996c('0x37')]);_0x108019[_0x996c('0x38')]=qs['filters'](_['pick'](_0x223d2a['query'],_0x550ae0[_0x996c('0x30')]),_0x35f543);if(_0x223d2a[_0x996c('0x2e')][_0x996c('0x39')]){_0x108019[_0x996c('0x38')]=_['merge'](_0x108019[_0x996c('0x38')],{'$or':_['map'](_0x35f543,function(_0x131c5e){if(_0x131c5e[_0x996c('0x2c')]!==_0x996c('0x3a')){var _0xc533b0={};_0xc533b0[_0x131c5e[_0x996c('0x26')]]={'$like':'%'+_0x223d2a['query'][_0x996c('0x39')]+'%'};return _0xc533b0;}})});}_0x108019=_[_0x996c('0x3b')]({},_0x108019,_0x223d2a[_0x996c('0x3c')]);var _0x44f71d={'where':_0x108019['where']};return db['Dynamics365Field'][_0x996c('0x1b')](_0x44f71d)[_0x996c('0x23')](function(_0x598137){_0x3ae36c['count']=_0x598137;if(_0x223d2a['query'][_0x996c('0x3d')]){_0x108019['include']=[{'all':!![]}];}return db[_0x996c('0x2a')]['findAll'](_0x108019);})[_0x996c('0x23')](function(_0x3191da){_0x3ae36c['rows']=_0x3191da;return _0x3ae36c;})['then'](respondWithFilteredResult(_0x90a531,_0x108019))[_0x996c('0x3e')](handleError(_0x90a531,null));};exports[_0x996c('0x3f')]=function(_0x36bdde,_0x4140aa){var _0x5ed1a1={'raw':!![],'where':{'id':_0x36bdde[_0x996c('0x40')]['id']}},_0x412882={};_0x412882[_0x996c('0x2d')]=_[_0x996c('0x2f')](db[_0x996c('0x2a')][_0x996c('0x41')]);_0x412882[_0x996c('0x2e')]=_[_0x996c('0x2f')](_0x36bdde[_0x996c('0x2e')]);_0x412882[_0x996c('0x30')]=_[_0x996c('0x31')](_0x412882[_0x996c('0x2d')],_0x412882['query']);_0x5ed1a1[_0x996c('0x33')]=_['intersection'](_0x412882[_0x996c('0x2d')],qs['fields'](_0x36bdde['query'][_0x996c('0x32')]));_0x5ed1a1['attributes']=_0x5ed1a1['attributes'][_0x996c('0x34')]?_0x5ed1a1[_0x996c('0x33')]:_0x412882[_0x996c('0x2d')];if(_0x36bdde['query'][_0x996c('0x3d')]){_0x5ed1a1[_0x996c('0x42')]=[{'all':!![]}];}_0x5ed1a1=_[_0x996c('0x3b')]({},_0x5ed1a1,_0x36bdde[_0x996c('0x3c')]);return db[_0x996c('0x2a')][_0x996c('0x43')](_0x5ed1a1)[_0x996c('0x23')](handleEntityNotFound(_0x4140aa,null))[_0x996c('0x23')](respondWithResult(_0x4140aa,null))[_0x996c('0x3e')](handleError(_0x4140aa,null));};exports[_0x996c('0x44')]=function(_0x1bee14,_0xf5c054){return db['Dynamics365Field']['create'](_0x1bee14[_0x996c('0x45')],{})[_0x996c('0x23')](respondWithResult(_0xf5c054,0xc9))['catch'](handleError(_0xf5c054,null));};exports[_0x996c('0x22')]=function(_0x63558d,_0x12317b){if(_0x63558d[_0x996c('0x45')]['id']){delete _0x63558d[_0x996c('0x45')]['id'];}return db[_0x996c('0x2a')][_0x996c('0x43')]({'where':{'id':_0x63558d[_0x996c('0x40')]['id']}})[_0x996c('0x23')](handleEntityNotFound(_0x12317b,null))['then'](saveUpdates(_0x63558d[_0x996c('0x45')],null))['then'](respondWithResult(_0x12317b,null))[_0x996c('0x3e')](handleError(_0x12317b,null));};exports['destroy']=function(_0x2ffe0d,_0xcc8402){return db[_0x996c('0x2a')][_0x996c('0x43')]({'where':{'id':_0x2ffe0d['params']['id']}})[_0x996c('0x23')](handleEntityNotFound(_0xcc8402,null))['then'](removeEntity(_0xcc8402,null))[_0x996c('0x3e')](handleError(_0xcc8402,null));}; \ No newline at end of file +var _0xd979=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','json','apply','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','Dynamics365Field','includeAll','include','rows','show','rawAttributes','options','find','create','catch','body','params','eml-format','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4d6490,_0x3e41aa){var _0x17b4f9=function(_0x5b93e5){while(--_0x5b93e5){_0x4d6490['push'](_0x4d6490['shift']());}};_0x17b4f9(++_0x3e41aa);}(_0xd979,0x7b));var _0x9d97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd979[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9d97('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d97('0x1'));var moment=require(_0x9d97('0x2'));var BPromise=require(_0x9d97('0x3'));var Mustache=require(_0x9d97('0x4'));var util=require(_0x9d97('0x5'));var path=require(_0x9d97('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d97('0x7'));var _=require(_0x9d97('0x8'));var squel=require(_0x9d97('0x9'));var crypto=require('crypto');var jsforce=require(_0x9d97('0xa'));var deskjs=require(_0x9d97('0xb'));var toCsv=require(_0x9d97('0xc'));var querystring=require(_0x9d97('0xd'));var Papa=require(_0x9d97('0xe'));var Redis=require(_0x9d97('0xf'));var authService=require(_0x9d97('0x10'));var qs=require(_0x9d97('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d97('0x12'));var logger=require(_0x9d97('0x13'))(_0x9d97('0x14'));var utils=require('../../config/utils');var config=require(_0x9d97('0x15'));var licenseUtil=require(_0x9d97('0x16'));var db=require(_0x9d97('0x17'))['db'];function respondWithStatusCode(_0xcd698,_0x3adc79){_0x3adc79=_0x3adc79||0xcc;return function(_0x238a75){if(_0x238a75){return _0xcd698['sendStatus'](_0x3adc79);}return _0xcd698['status'](_0x3adc79)['end']();};}function respondWithResult(_0x39344b,_0x48956f){_0x48956f=_0x48956f||0xc8;return function(_0x3a21cd){if(_0x3a21cd){return _0x39344b[_0x9d97('0x18')](_0x48956f)['json'](_0x3a21cd);}};}function respondWithFilteredResult(_0x7e7a35,_0x202515){return function(_0x80298d){if(_0x80298d){var _0x51ce86=typeof _0x202515['offset']===_0x9d97('0x19')&&typeof _0x202515[_0x9d97('0x1a')]===_0x9d97('0x19');var _0x180f46=_0x80298d[_0x9d97('0x1b')];var _0x7a2c47=_0x51ce86?0x0:_0x202515[_0x9d97('0x1c')];var _0x8bd74c=_0x51ce86?_0x80298d['count']:_0x202515[_0x9d97('0x1c')]+_0x202515[_0x9d97('0x1a')];var _0x245d04;if(_0x8bd74c>=_0x180f46){_0x8bd74c=_0x180f46;_0x245d04=0xc8;}else{_0x245d04=0xce;}_0x7e7a35[_0x9d97('0x18')](_0x245d04);return _0x7e7a35['set']('Content-Range',_0x7a2c47+'-'+_0x8bd74c+'/'+_0x180f46)[_0x9d97('0x1d')](_0x80298d);}return null;};}function patchUpdates(_0x295e9d){return function(_0x2f4f77){try{jsonpatch[_0x9d97('0x1e')](_0x2f4f77,_0x295e9d,!![]);}catch(_0x1aed77){return BPromise['reject'](_0x1aed77);}return _0x2f4f77[_0x9d97('0x1f')]();};}function saveUpdates(_0x3fcc5d,_0x36d077){return function(_0xdf6a4){if(_0xdf6a4){return _0xdf6a4[_0x9d97('0x20')](_0x3fcc5d)[_0x9d97('0x21')](function(_0x5a6c8c){return _0x5a6c8c;});}return null;};}function removeEntity(_0x26bbc2,_0x8223b8){return function(_0xa84bed){if(_0xa84bed){return _0xa84bed[_0x9d97('0x22')]()['then'](function(){_0x26bbc2['status'](0xcc)[_0x9d97('0x23')]();});}};}function handleEntityNotFound(_0x12fb70,_0x2a63ad){return function(_0x184d0f){if(!_0x184d0f){_0x12fb70[_0x9d97('0x24')](0x194);}return _0x184d0f;};}function handleError(_0x4eba78,_0x34b991){_0x34b991=_0x34b991||0x1f4;return function(_0x8c4cd9){logger['error'](_0x8c4cd9[_0x9d97('0x25')]);if(_0x8c4cd9[_0x9d97('0x26')]){delete _0x8c4cd9[_0x9d97('0x26')];}_0x4eba78[_0x9d97('0x18')](_0x34b991)[_0x9d97('0x27')](_0x8c4cd9);};}exports[_0x9d97('0x28')]=function(_0x25cd4a,_0x4d064c){var _0x546fc7={},_0x3112bf={},_0x7b003f={'count':0x0,'rows':[]};var _0x584da4=_[_0x9d97('0x29')](db['Dynamics365Field']['rawAttributes'],function(_0x25e78d){return{'name':_0x25e78d[_0x9d97('0x2a')],'type':_0x25e78d[_0x9d97('0x2b')][_0x9d97('0x2c')]};});_0x3112bf[_0x9d97('0x2d')]=_[_0x9d97('0x29')](_0x584da4,_0x9d97('0x26'));_0x3112bf['query']=_[_0x9d97('0x2e')](_0x25cd4a[_0x9d97('0x2f')]);_0x3112bf[_0x9d97('0x30')]=_[_0x9d97('0x31')](_0x3112bf[_0x9d97('0x2d')],_0x3112bf['query']);_0x546fc7[_0x9d97('0x32')]=_['intersection'](_0x3112bf[_0x9d97('0x2d')],qs[_0x9d97('0x33')](_0x25cd4a[_0x9d97('0x2f')][_0x9d97('0x33')]));_0x546fc7['attributes']=_0x546fc7[_0x9d97('0x32')][_0x9d97('0x34')]?_0x546fc7[_0x9d97('0x32')]:_0x3112bf['model'];if(!_0x25cd4a[_0x9d97('0x2f')]['hasOwnProperty']('nolimit')){_0x546fc7[_0x9d97('0x1a')]=qs[_0x9d97('0x1a')](_0x25cd4a[_0x9d97('0x2f')][_0x9d97('0x1a')]);_0x546fc7['offset']=qs['offset'](_0x25cd4a['query'][_0x9d97('0x1c')]);}_0x546fc7['order']=qs[_0x9d97('0x35')](_0x25cd4a[_0x9d97('0x2f')][_0x9d97('0x35')]);_0x546fc7[_0x9d97('0x36')]=qs[_0x9d97('0x30')](_[_0x9d97('0x37')](_0x25cd4a[_0x9d97('0x2f')],_0x3112bf[_0x9d97('0x30')]),_0x584da4);if(_0x25cd4a['query'][_0x9d97('0x38')]){_0x546fc7[_0x9d97('0x36')]=_[_0x9d97('0x39')](_0x546fc7[_0x9d97('0x36')],{'$or':_[_0x9d97('0x29')](_0x584da4,function(_0x95599c){if(_0x95599c[_0x9d97('0x2b')]!=='VIRTUAL'){var _0x896209={};_0x896209[_0x95599c[_0x9d97('0x26')]]={'$like':'%'+_0x25cd4a[_0x9d97('0x2f')]['filter']+'%'};return _0x896209;}})});}_0x546fc7=_[_0x9d97('0x39')]({},_0x546fc7,_0x25cd4a['options']);var _0x297711={'where':_0x546fc7['where']};return db[_0x9d97('0x3a')][_0x9d97('0x1b')](_0x297711)[_0x9d97('0x21')](function(_0x1cffa7){_0x7b003f['count']=_0x1cffa7;if(_0x25cd4a['query'][_0x9d97('0x3b')]){_0x546fc7[_0x9d97('0x3c')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x546fc7);})[_0x9d97('0x21')](function(_0x5e6e8a){_0x7b003f[_0x9d97('0x3d')]=_0x5e6e8a;return _0x7b003f;})['then'](respondWithFilteredResult(_0x4d064c,_0x546fc7))['catch'](handleError(_0x4d064c,null));};exports[_0x9d97('0x3e')]=function(_0x16e42e,_0x3c0287){var _0x1403ea={'raw':!![],'where':{'id':_0x16e42e['params']['id']}},_0x1f4a15={};_0x1f4a15[_0x9d97('0x2d')]=_[_0x9d97('0x2e')](db[_0x9d97('0x3a')][_0x9d97('0x3f')]);_0x1f4a15[_0x9d97('0x2f')]=_[_0x9d97('0x2e')](_0x16e42e['query']);_0x1f4a15[_0x9d97('0x30')]=_[_0x9d97('0x31')](_0x1f4a15[_0x9d97('0x2d')],_0x1f4a15[_0x9d97('0x2f')]);_0x1403ea['attributes']=_[_0x9d97('0x31')](_0x1f4a15['model'],qs['fields'](_0x16e42e[_0x9d97('0x2f')][_0x9d97('0x33')]));_0x1403ea['attributes']=_0x1403ea[_0x9d97('0x32')][_0x9d97('0x34')]?_0x1403ea[_0x9d97('0x32')]:_0x1f4a15['model'];if(_0x16e42e[_0x9d97('0x2f')][_0x9d97('0x3b')]){_0x1403ea[_0x9d97('0x3c')]=[{'all':!![]}];}_0x1403ea=_['merge']({},_0x1403ea,_0x16e42e[_0x9d97('0x40')]);return db[_0x9d97('0x3a')][_0x9d97('0x41')](_0x1403ea)[_0x9d97('0x21')](handleEntityNotFound(_0x3c0287,null))[_0x9d97('0x21')](respondWithResult(_0x3c0287,null))['catch'](handleError(_0x3c0287,null));};exports[_0x9d97('0x42')]=function(_0x4a0fb3,_0x298da1){return db[_0x9d97('0x3a')]['create'](_0x4a0fb3['body'],{})[_0x9d97('0x21')](respondWithResult(_0x298da1,0xc9))[_0x9d97('0x43')](handleError(_0x298da1,null));};exports['update']=function(_0x5d2256,_0x5dab8f){if(_0x5d2256[_0x9d97('0x44')]['id']){delete _0x5d2256['body']['id'];}return db[_0x9d97('0x3a')][_0x9d97('0x41')]({'where':{'id':_0x5d2256[_0x9d97('0x45')]['id']}})[_0x9d97('0x21')](handleEntityNotFound(_0x5dab8f,null))['then'](saveUpdates(_0x5d2256[_0x9d97('0x44')],null))['then'](respondWithResult(_0x5dab8f,null))[_0x9d97('0x43')](handleError(_0x5dab8f,null));};exports[_0x9d97('0x22')]=function(_0x36f0cd,_0x11ed6d){return db['Dynamics365Field']['find']({'where':{'id':_0x36f0cd['params']['id']}})[_0x9d97('0x21')](handleEntityNotFound(_0x11ed6d,null))['then'](removeEntity(_0x11ed6d,null))['catch'](handleError(_0x11ed6d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 64edf30..ba6d392 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 _0x17c5=['api','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x17c5,0x167));var _0x517c=function(_0x3d7a9f,_0x24e0f1){_0x3d7a9f=_0x3d7a9f-0x0;var _0x13f5f1=_0x17c5[_0x3d7a9f];return _0x13f5f1;};'use strict';var _=require('lodash');var util=require(_0x517c('0x0'));var logger=require('../../config/logger')(_0x517c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x517c('0x2'));var rimraf=require(_0x517c('0x3'));var config=require(_0x517c('0x4'));var attributes=require(_0x517c('0x5'));module[_0x517c('0x6')]=function(_0x4f099b,_0x54690d){return _0x4f099b[_0x517c('0x7')]('Dynamics365Field',attributes,{'tableName':_0x517c('0x8'),'paranoid':![],'indexes':[{'name':_0x517c('0x9'),'fields':[_0x517c('0xa'),_0x517c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8394=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x46ad9e,_0x203184){var _0x5727cb=function(_0x32a93e){while(--_0x32a93e){_0x46ad9e['push'](_0x46ad9e['shift']());}};_0x5727cb(++_0x203184);}(_0x8394,0x120));var _0x4839=function(_0xced9e2,_0xb6a6a0){_0xced9e2=_0xced9e2-0x0;var _0x4e69dd=_0x8394[_0xced9e2];return _0x4e69dd;};'use strict';var _=require(_0x4839('0x0'));var util=require(_0x4839('0x1'));var logger=require(_0x4839('0x2'))(_0x4839('0x3'));var moment=require(_0x4839('0x4'));var BPromise=require(_0x4839('0x5'));var rp=require(_0x4839('0x6'));var fs=require('fs');var path=require(_0x4839('0x7'));var rimraf=require(_0x4839('0x8'));var config=require('../../config/environment');var attributes=require(_0x4839('0x9'));module[_0x4839('0xa')]=function(_0x171d63,_0x18b0e4){return _0x171d63['define'](_0x4839('0xb'),attributes,{'tableName':_0x4839('0xc'),'paranoid':![],'indexes':[{'name':_0x4839('0xd'),'fields':[_0x4839('0xe'),_0x4839('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 84638c9..82c0e39 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 _0x0365=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x3f386d,_0x5cbbea){var _0x235a6f=function(_0x4c1ac9){while(--_0x4c1ac9){_0x3f386d['push'](_0x3f386d['shift']());}};_0x235a6f(++_0x5cbbea);}(_0x0365,0x6c));var _0x5036=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0x0365[_0x1d1219];return _0x5b5b89;};'use strict';var _=require(_0x5036('0x0'));var util=require(_0x5036('0x1'));var moment=require(_0x5036('0x2'));var BPromise=require(_0x5036('0x3'));var rs=require(_0x5036('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5036('0x5'));var logger=require('../../config/logger')(_0x5036('0x6'));var config=require(_0x5036('0x7'));var jayson=require(_0x5036('0x8'));var client=jayson[_0x5036('0x9')][_0x5036('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32f1f6,_0x5db33d,_0x232e6d){return new BPromise(function(_0x560dad,_0x282fd7){return client['request'](_0x32f1f6,_0x232e6d)[_0x5036('0xb')](function(_0x4c8263){logger[_0x5036('0xc')](_0x5036('0xd'),_0x5db33d,_0x5036('0xe'));logger[_0x5036('0xf')](_0x5036('0x10'),_0x5db33d,_0x5036('0xe'),JSON[_0x5036('0x11')](_0x4c8263));if(_0x4c8263['error']){if(_0x4c8263[_0x5036('0x12')][_0x5036('0x13')]===0x1f4){logger['error'](_0x5036('0xd'),_0x5db33d,_0x4c8263['error']['message']);return _0x282fd7(_0x4c8263['error']['message']);}logger[_0x5036('0x12')](_0x5036('0xd'),_0x5db33d,_0x4c8263[_0x5036('0x12')][_0x5036('0x14')]);return _0x560dad(_0x4c8263['error'][_0x5036('0x14')]);}else{logger[_0x5036('0xc')](_0x5036('0xd'),_0x5db33d,_0x5036('0xe'));_0x560dad(_0x4c8263['result'][_0x5036('0x14')]);}})[_0x5036('0x15')](function(_0x2fb7e0){logger[_0x5036('0x12')](_0x5036('0xd'),_0x5db33d,_0x2fb7e0);_0x282fd7(_0x2fb7e0);});});} \ No newline at end of file +var _0x2b15=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0x2b15,0x7c));var _0x52b1=function(_0x44511e,_0x2242ba){_0x44511e=_0x44511e-0x0;var _0x243798=_0x2b15[_0x44511e];return _0x243798;};'use strict';var _=require('lodash');var util=require(_0x52b1('0x0'));var moment=require(_0x52b1('0x1'));var BPromise=require(_0x52b1('0x2'));var rs=require(_0x52b1('0x3'));var fs=require('fs');var Redis=require(_0x52b1('0x4'));var db=require(_0x52b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x52b1('0x6'))(_0x52b1('0x7'));var config=require(_0x52b1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x52b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36f950,_0x1acf41,_0xabfe03){return new BPromise(function(_0x17a3c3,_0x4ad73e){return client[_0x52b1('0xa')](_0x36f950,_0xabfe03)[_0x52b1('0xb')](function(_0x4c6670){logger[_0x52b1('0xc')](_0x52b1('0xd'),_0x1acf41,'request\x20sent');logger[_0x52b1('0xe')](_0x52b1('0xf'),_0x1acf41,_0x52b1('0x10'),JSON['stringify'](_0x4c6670));if(_0x4c6670['error']){if(_0x4c6670[_0x52b1('0x11')][_0x52b1('0x12')]===0x1f4){logger[_0x52b1('0x11')](_0x52b1('0xd'),_0x1acf41,_0x4c6670['error'][_0x52b1('0x13')]);return _0x4ad73e(_0x4c6670[_0x52b1('0x11')][_0x52b1('0x13')]);}logger[_0x52b1('0x11')](_0x52b1('0xd'),_0x1acf41,_0x4c6670[_0x52b1('0x11')][_0x52b1('0x13')]);return _0x17a3c3(_0x4c6670['error']['message']);}else{logger[_0x52b1('0xc')](_0x52b1('0xd'),_0x1acf41,_0x52b1('0x10'));_0x17a3c3(_0x4c6670[_0x52b1('0x14')][_0x52b1('0x13')]);}})['catch'](function(_0x525cb7){logger[_0x52b1('0x11')](_0x52b1('0xd'),_0x1acf41,_0x525cb7);_0x4ad73e(_0x525cb7);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 2b6916f..c345188 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 _0x06a8=['/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','create','post','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','show'];(function(_0x5e03fc,_0x1b5ed7){var _0x116ada=function(_0x1bb90e){while(--_0x1bb90e){_0x5e03fc['push'](_0x5e03fc['shift']());}};_0x116ada(++_0x1b5ed7);}(_0x06a8,0x10e));var _0x806a=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x06a8[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x806a('0x0'));var util=require(_0x806a('0x1'));var path=require('path');var timeout=require(_0x806a('0x2'));var express=require('express');var router=express[_0x806a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x806a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x806a('0x5'));var controller=require(_0x806a('0x6'));router[_0x806a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x806a('0x8'),auth['isAuthenticated'](),controller[_0x806a('0x9')]);router[_0x806a('0x7')](_0x806a('0xa'),auth[_0x806a('0xb')](),controller[_0x806a('0xc')]);router[_0x806a('0x7')](_0x806a('0xd'),auth[_0x806a('0xb')](),controller['getFields']);router['post']('/',auth[_0x806a('0xb')](),controller[_0x806a('0xe')]);router[_0x806a('0xf')]('/:id/configurations',auth[_0x806a('0xb')](),controller['addConfiguration']);router[_0x806a('0x10')]('/:id',auth[_0x806a('0xb')](),controller[_0x806a('0x11')]);router[_0x806a('0x12')](_0x806a('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x806a('0x13')]=router; \ No newline at end of file +var _0x74b0=['show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','get','/:id'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x74b0,0x1d5));var _0x074b=function(_0x741a7b,_0x5cb899){_0x741a7b=_0x741a7b-0x0;var _0x43a8e6=_0x74b0[_0x741a7b];return _0x43a8e6;};'use strict';var multer=require(_0x074b('0x0'));var util=require(_0x074b('0x1'));var path=require(_0x074b('0x2'));var timeout=require(_0x074b('0x3'));var express=require(_0x074b('0x4'));var router=express[_0x074b('0x5')]();var fs_extra=require(_0x074b('0x6'));var auth=require(_0x074b('0x7'));var interaction=require(_0x074b('0x8'));var config=require(_0x074b('0x9'));var controller=require(_0x074b('0xa'));router['get']('/',auth[_0x074b('0xb')](),controller['index']);router[_0x074b('0xc')](_0x074b('0xd'),auth[_0x074b('0xb')](),controller[_0x074b('0xe')]);router[_0x074b('0xc')](_0x074b('0xf'),auth[_0x074b('0xb')](),controller[_0x074b('0x10')]);router['get']('/:id/fields',auth[_0x074b('0xb')](),controller[_0x074b('0x11')]);router[_0x074b('0x12')]('/',auth[_0x074b('0xb')](),controller[_0x074b('0x13')]);router[_0x074b('0x12')](_0x074b('0xf'),auth[_0x074b('0xb')](),controller[_0x074b('0x14')]);router[_0x074b('0x15')]('/:id',auth[_0x074b('0xb')](),controller[_0x074b('0x16')]);router['delete'](_0x074b('0xd'),auth[_0x074b('0xb')](),controller['destroy']);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 b913f43..1e81c16 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 _0x627e=['STRING','remoteUri','sequelize','exports'];(function(_0x598d85,_0x12d6c1){var _0x4dfa88=function(_0x3bca53){while(--_0x3bca53){_0x598d85['push'](_0x598d85['shift']());}};_0x4dfa88(++_0x12d6c1);}(_0x627e,0x14a));var _0xe627=function(_0x4ecf6a,_0x124be0){_0x4ecf6a=_0x4ecf6a-0x0;var _0x2d2060=_0x627e[_0x4ecf6a];return _0x2d2060;};'use strict';var Sequelize=require(_0xe627('0x0'));module[_0xe627('0x1')]={'name':{'type':Sequelize[_0xe627('0x2')]},'description':{'type':Sequelize[_0xe627('0x2')]},'username':{'type':Sequelize[_0xe627('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe627('0x2')]},'remoteUri':{'type':Sequelize[_0xe627('0x2')],'unique':_0xe627('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x93e9=['sequelize','exports','STRING','username'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x93e9,0xcc));var _0x993e=function(_0x2c5741,_0x2b1bfb){_0x2c5741=_0x2c5741-0x0;var _0x49ec16=_0x93e9[_0x2c5741];return _0x49ec16;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'name':{'type':Sequelize[_0x993e('0x2')]},'description':{'type':Sequelize[_0x993e('0x2')]},'username':{'type':Sequelize[_0x993e('0x2')],'unique':_0x993e('0x3')},'apiKey':{'type':Sequelize[_0x993e('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x993e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 245ea9a..4a6f351 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 _0x5fc7=['custom_text','custom_dropdown','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','limit','undefined','count','Content-Range','reject','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','FreshdeskAccount','then','include','findAll','rows','catch','show','params','length','create','body','find','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','description','priority','group','source','ticket_type','remove','includes','default'];(function(_0x3096c8,_0x4cf94c){var _0x4cb984=function(_0x5a1efc){while(--_0x5a1efc){_0x3096c8['push'](_0x3096c8['shift']());}};_0x4cb984(++_0x4cf94c);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x5fc7[_0x580b15];return _0x1adb1b;};'use strict';var emlformat=require(_0x75fc('0x0'));var rimraf=require(_0x75fc('0x1'));var zipdir=require(_0x75fc('0x2'));var jsonpatch=require(_0x75fc('0x3'));var rp=require(_0x75fc('0x4'));var moment=require(_0x75fc('0x5'));var BPromise=require(_0x75fc('0x6'));var Mustache=require(_0x75fc('0x7'));var util=require(_0x75fc('0x8'));var path=require(_0x75fc('0x9'));var sox=require(_0x75fc('0xa'));var csv=require(_0x75fc('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75fc('0xc'));var _=require(_0x75fc('0xd'));var squel=require(_0x75fc('0xe'));var crypto=require(_0x75fc('0xf'));var jsforce=require(_0x75fc('0x10'));var deskjs=require(_0x75fc('0x11'));var toCsv=require(_0x75fc('0xb'));var querystring=require(_0x75fc('0x12'));var Papa=require(_0x75fc('0x13'));var Redis=require(_0x75fc('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x75fc('0x15'));var as=require(_0x75fc('0x16'));var hardwareService=require(_0x75fc('0x17'));var logger=require(_0x75fc('0x18'))('api');var utils=require(_0x75fc('0x19'));var config=require(_0x75fc('0x1a'));var licenseUtil=require(_0x75fc('0x1b'));var db=require(_0x75fc('0x1c'))['db'];var integrations=require(_0x75fc('0x1d'));function respondWithStatusCode(_0x22bdb0,_0x22b73d){_0x22b73d=_0x22b73d||0xcc;return function(_0x58748e){if(_0x58748e){return _0x22bdb0['sendStatus'](_0x22b73d);}return _0x22bdb0['status'](_0x22b73d)[_0x75fc('0x1e')]();};}function respondWithResult(_0x2e0e83,_0x2e073b){_0x2e073b=_0x2e073b||0xc8;return function(_0x2cb4ed){if(_0x2cb4ed){return _0x2e0e83[_0x75fc('0x1f')](_0x2e073b)[_0x75fc('0x20')](_0x2cb4ed);}};}function respondWithFilteredResult(_0x3b64b2,_0x3053b6){return function(_0x53f23d){if(_0x53f23d){var _0xf3dec8=typeof _0x3053b6[_0x75fc('0x21')]==='undefined'&&typeof _0x3053b6[_0x75fc('0x22')]===_0x75fc('0x23');var _0x5a3311=_0x53f23d['count'];var _0x25b52b=_0xf3dec8?0x0:_0x3053b6[_0x75fc('0x21')];var _0x3b1edf=_0xf3dec8?_0x53f23d[_0x75fc('0x24')]:_0x3053b6[_0x75fc('0x21')]+_0x3053b6[_0x75fc('0x22')];var _0x523d14;if(_0x3b1edf>=_0x5a3311){_0x3b1edf=_0x5a3311;_0x523d14=0xc8;}else{_0x523d14=0xce;}_0x3b64b2[_0x75fc('0x1f')](_0x523d14);return _0x3b64b2['set'](_0x75fc('0x25'),_0x25b52b+'-'+_0x3b1edf+'/'+_0x5a3311)[_0x75fc('0x20')](_0x53f23d);}return null;};}function patchUpdates(_0x2780e3){return function(_0x294b24){try{jsonpatch['apply'](_0x294b24,_0x2780e3,!![]);}catch(_0x34cf9c){return BPromise[_0x75fc('0x26')](_0x34cf9c);}return _0x294b24['save']();};}function saveUpdates(_0x458cc4,_0x3ed9d5){return function(_0x4d5346){if(_0x4d5346){return _0x4d5346[_0x75fc('0x27')](_0x458cc4)['then'](function(_0x14745f){return _0x14745f;});}return null;};}function removeEntity(_0x924c53,_0x54b684){return function(_0xd8b8e1){if(_0xd8b8e1){return _0xd8b8e1[_0x75fc('0x28')]()['then'](function(){_0x924c53[_0x75fc('0x1f')](0xcc)[_0x75fc('0x1e')]();});}};}function handleEntityNotFound(_0x53fcd2,_0x5774bb){return function(_0x10a59a){if(!_0x10a59a){_0x53fcd2['sendStatus'](0x194);}return _0x10a59a;};}function handleError(_0x19a59e,_0x4268ed){_0x4268ed=_0x4268ed||0x1f4;return function(_0x4f70b4){logger['error'](_0x4f70b4['stack']);if(_0x4f70b4[_0x75fc('0x29')]){delete _0x4f70b4[_0x75fc('0x29')];}_0x19a59e[_0x75fc('0x1f')](_0x4268ed)[_0x75fc('0x2a')](_0x4f70b4);};}exports[_0x75fc('0x2b')]=function(_0xc7025,_0x337058){var _0x54bcd5={},_0x23aa27={},_0x3e99d7={'count':0x0,'rows':[]};var _0x17b0c0=_[_0x75fc('0x2c')](db['FreshdeskAccount'][_0x75fc('0x2d')],function(_0x486e3f){return{'name':_0x486e3f[_0x75fc('0x2e')],'type':_0x486e3f[_0x75fc('0x2f')][_0x75fc('0x30')]};});_0x23aa27[_0x75fc('0x31')]=_['map'](_0x17b0c0,_0x75fc('0x29'));_0x23aa27['query']=_[_0x75fc('0x32')](_0xc7025[_0x75fc('0x33')]);_0x23aa27['filters']=_[_0x75fc('0x34')](_0x23aa27[_0x75fc('0x31')],_0x23aa27['query']);_0x54bcd5[_0x75fc('0x35')]=_[_0x75fc('0x34')](_0x23aa27[_0x75fc('0x31')],qs[_0x75fc('0x36')](_0xc7025[_0x75fc('0x33')][_0x75fc('0x36')]));_0x54bcd5[_0x75fc('0x35')]=_0x54bcd5[_0x75fc('0x35')]['length']?_0x54bcd5[_0x75fc('0x35')]:_0x23aa27[_0x75fc('0x31')];if(!_0xc7025[_0x75fc('0x33')][_0x75fc('0x37')](_0x75fc('0x38'))){_0x54bcd5[_0x75fc('0x22')]=qs[_0x75fc('0x22')](_0xc7025[_0x75fc('0x33')][_0x75fc('0x22')]);_0x54bcd5[_0x75fc('0x21')]=qs[_0x75fc('0x21')](_0xc7025[_0x75fc('0x33')][_0x75fc('0x21')]);}_0x54bcd5['order']=qs[_0x75fc('0x39')](_0xc7025[_0x75fc('0x33')][_0x75fc('0x39')]);_0x54bcd5[_0x75fc('0x3a')]=qs['filters'](_[_0x75fc('0x3b')](_0xc7025[_0x75fc('0x33')],_0x23aa27[_0x75fc('0x3c')]),_0x17b0c0);if(_0xc7025[_0x75fc('0x33')][_0x75fc('0x3d')]){_0x54bcd5[_0x75fc('0x3a')]=_[_0x75fc('0x3e')](_0x54bcd5[_0x75fc('0x3a')],{'$or':_['map'](_0x17b0c0,function(_0x9cd4bd){if(_0x9cd4bd[_0x75fc('0x2f')]!==_0x75fc('0x3f')){var _0x45f2b9={};_0x45f2b9[_0x9cd4bd[_0x75fc('0x29')]]={'$like':'%'+_0xc7025[_0x75fc('0x33')]['filter']+'%'};return _0x45f2b9;}})});}_0x54bcd5=_[_0x75fc('0x3e')]({},_0x54bcd5,_0xc7025[_0x75fc('0x40')]);var _0x51a36b={'where':_0x54bcd5[_0x75fc('0x3a')]};return db[_0x75fc('0x41')][_0x75fc('0x24')](_0x51a36b)[_0x75fc('0x42')](function(_0x325fcd){_0x3e99d7['count']=_0x325fcd;if(_0xc7025[_0x75fc('0x33')]['includeAll']){_0x54bcd5[_0x75fc('0x43')]=[{'all':!![]}];}return db[_0x75fc('0x41')][_0x75fc('0x44')](_0x54bcd5);})[_0x75fc('0x42')](function(_0x2fec87){_0x3e99d7[_0x75fc('0x45')]=_0x2fec87;return _0x3e99d7;})[_0x75fc('0x42')](respondWithFilteredResult(_0x337058,_0x54bcd5))[_0x75fc('0x46')](handleError(_0x337058,null));};exports[_0x75fc('0x47')]=function(_0x58c57d,_0x382ca5){var _0x3e8ec6={'raw':![],'where':{'id':_0x58c57d[_0x75fc('0x48')]['id']}},_0x327bdd={};_0x327bdd[_0x75fc('0x31')]=_['keys'](db[_0x75fc('0x41')][_0x75fc('0x2d')]);_0x327bdd[_0x75fc('0x33')]=_['keys'](_0x58c57d[_0x75fc('0x33')]);_0x327bdd[_0x75fc('0x3c')]=_[_0x75fc('0x34')](_0x327bdd[_0x75fc('0x31')],_0x327bdd[_0x75fc('0x33')]);_0x3e8ec6[_0x75fc('0x35')]=_[_0x75fc('0x34')](_0x327bdd['model'],qs[_0x75fc('0x36')](_0x58c57d[_0x75fc('0x33')]['fields']));_0x3e8ec6[_0x75fc('0x35')]=_0x3e8ec6[_0x75fc('0x35')][_0x75fc('0x49')]?_0x3e8ec6['attributes']:_0x327bdd[_0x75fc('0x31')];if(_0x58c57d['query']['includeAll']){_0x3e8ec6['include']=[{'all':!![]}];}_0x3e8ec6=_[_0x75fc('0x3e')]({},_0x3e8ec6,_0x58c57d[_0x75fc('0x40')]);return db[_0x75fc('0x41')]['find'](_0x3e8ec6)[_0x75fc('0x42')](handleEntityNotFound(_0x382ca5,null))['then'](respondWithResult(_0x382ca5,null))[_0x75fc('0x46')](handleError(_0x382ca5,null));};exports[_0x75fc('0x4a')]=function(_0x35bd3c,_0x947e85){return db['FreshdeskAccount'][_0x75fc('0x4a')](_0x35bd3c[_0x75fc('0x4b')],{})[_0x75fc('0x42')](respondWithResult(_0x947e85,0xc9))[_0x75fc('0x46')](handleError(_0x947e85,null));};exports[_0x75fc('0x27')]=function(_0x887cd4,_0x31037c){if(_0x887cd4['body']['id']){delete _0x887cd4[_0x75fc('0x4b')]['id'];}return db['FreshdeskAccount'][_0x75fc('0x4c')]({'where':{'id':_0x887cd4[_0x75fc('0x48')]['id']}})[_0x75fc('0x42')](handleEntityNotFound(_0x31037c,null))[_0x75fc('0x42')](saveUpdates(_0x887cd4[_0x75fc('0x4b')],null))[_0x75fc('0x42')](respondWithResult(_0x31037c,null))[_0x75fc('0x46')](handleError(_0x31037c,null));};exports[_0x75fc('0x28')]=function(_0x11eade,_0x55af83){return db[_0x75fc('0x41')][_0x75fc('0x4c')]({'where':{'id':_0x11eade[_0x75fc('0x48')]['id']}})[_0x75fc('0x42')](handleEntityNotFound(_0x55af83,null))['then'](removeEntity(_0x55af83,null))['catch'](handleError(_0x55af83,null));};exports[_0x75fc('0x4d')]=function(_0x491e7c,_0x315c57,_0x15ac36){var _0x17e84f={};var _0x46dc62={};var _0x2b0c59;var _0xee6e51;return db[_0x75fc('0x41')][_0x75fc('0x4e')]({'where':{'id':_0x491e7c[_0x75fc('0x48')]['id']}})[_0x75fc('0x42')](handleEntityNotFound(_0x315c57,null))['then'](function(_0x43c82a){if(_0x43c82a){_0x2b0c59=_0x43c82a;_0x46dc62[_0x75fc('0x31')]=_[_0x75fc('0x32')](db['FreshdeskConfiguration']['rawAttributes']);_0x46dc62[_0x75fc('0x33')]=_[_0x75fc('0x32')](_0x491e7c[_0x75fc('0x33')]);_0x46dc62[_0x75fc('0x3c')]=_['intersection'](_0x46dc62[_0x75fc('0x31')],_0x46dc62[_0x75fc('0x33')]);_0x17e84f['attributes']=_[_0x75fc('0x34')](_0x46dc62['model'],qs[_0x75fc('0x36')](_0x491e7c[_0x75fc('0x33')][_0x75fc('0x36')]));_0x17e84f['attributes']=_0x17e84f[_0x75fc('0x35')][_0x75fc('0x49')]?_0x17e84f[_0x75fc('0x35')]:_0x46dc62[_0x75fc('0x31')];_0x17e84f[_0x75fc('0x4f')]=qs[_0x75fc('0x39')](_0x491e7c[_0x75fc('0x33')][_0x75fc('0x39')]);_0x17e84f[_0x75fc('0x3a')]=qs['filters'](_['pick'](_0x491e7c[_0x75fc('0x33')],_0x46dc62['filters']));if(_0x491e7c[_0x75fc('0x33')][_0x75fc('0x3d')]){_0x17e84f['where']=_[_0x75fc('0x3e')](_0x17e84f[_0x75fc('0x3a')],{'$or':_['map'](_0x17e84f[_0x75fc('0x35')],function(_0x3217f4){var _0x441e02={};_0x441e02[_0x3217f4]={'$like':'%'+_0x491e7c['query'][_0x75fc('0x3d')]+'%'};return _0x441e02;})});}_0x17e84f=_[_0x75fc('0x3e')]({},_0x17e84f,_0x491e7c[_0x75fc('0x40')]);return _0x2b0c59[_0x75fc('0x4d')](_0x17e84f);}})[_0x75fc('0x42')](function(_0x3e0611){if(_0x3e0611){_0xee6e51=_0x3e0611[_0x75fc('0x49')];if(!_0x491e7c['query'][_0x75fc('0x37')]('nolimit')){_0x17e84f['limit']=qs['limit'](_0x491e7c[_0x75fc('0x33')][_0x75fc('0x22')]);_0x17e84f[_0x75fc('0x21')]=qs[_0x75fc('0x21')](_0x491e7c['query'][_0x75fc('0x21')]);}return _0x2b0c59[_0x75fc('0x4d')](_0x17e84f);}})['then'](function(_0x47432b){if(_0x47432b){return _0x47432b?{'count':_0xee6e51,'rows':_0x47432b}:null;}})[_0x75fc('0x42')](respondWithResult(_0x315c57,null))['catch'](handleError(_0x315c57,null));};exports[_0x75fc('0x50')]=function(_0x19150f,_0xd5c3c4,_0x29ef31){if(_0x19150f[_0x75fc('0x4b')]['id']){delete _0x19150f[_0x75fc('0x4b')]['id'];}return db[_0x75fc('0x41')][_0x75fc('0x4e')]({'where':{'id':_0x19150f[_0x75fc('0x48')]['id']}})[_0x75fc('0x42')](handleEntityNotFound(_0xd5c3c4,null))['then'](function(_0x45e7aa){if(_0x45e7aa){_0x19150f[_0x75fc('0x4b')][_0x75fc('0x51')]=_0x45e7aa['id'];_0x19150f[_0x75fc('0x4b')][_0x75fc('0x52')]=integrations['getSubjects'](_0x19150f[_0x75fc('0x4b')][_0x75fc('0x53')],_0x19150f['body']['type']);_0x19150f['body'][_0x75fc('0x54')]=integrations[_0x75fc('0x55')](_0x19150f[_0x75fc('0x4b')][_0x75fc('0x53')],_0x19150f[_0x75fc('0x4b')][_0x75fc('0x2f')]);return db['FreshdeskConfiguration']['create'](_0x19150f[_0x75fc('0x4b')],{'include':[{'model':db[_0x75fc('0x56')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x75fc('0x54')}]});}return null;})[_0x75fc('0x42')](respondWithResult(_0xd5c3c4,null))[_0x75fc('0x46')](handleError(_0xd5c3c4,null));};exports[_0x75fc('0x57')]=function(_0x4de63c,_0x567cfd,_0x29cfce){var _0x5743a9='';return db[_0x75fc('0x41')][_0x75fc('0x4e')]({'where':{'id':_0x4de63c[_0x75fc('0x48')]['id']},'attributes':['id',_0x75fc('0x58'),_0x75fc('0x59')]})[_0x75fc('0x42')](handleEntityNotFound(_0x567cfd,null))[_0x75fc('0x42')](function(_0x3a55fe){if(_0x3a55fe){_0x5743a9=_0x3a55fe[_0x75fc('0x58')];var _0x56a110=_0x5743a9[_0x75fc('0x5a')](-0x1);if(_0x56a110==='/'){_0x5743a9=_0x5743a9[_0x75fc('0x5b')](0x0,_0x5743a9[_0x75fc('0x5c')](_0x56a110));}return rp({'method':_0x75fc('0x5d'),'uri':util[_0x75fc('0x5e')]('%s/%s',_0x5743a9,_0x75fc('0x5f')),'headers':{'Authorization':util['format'](_0x75fc('0x60'),new Buffer(util[_0x75fc('0x5e')](_0x75fc('0x61'),_0x3a55fe[_0x75fc('0x59')]))[_0x75fc('0x62')]('base64'))},'json':!![]});}})[_0x75fc('0x42')](function(_0x2bc003){if(_0x2bc003){var _0x309986=[_0x75fc('0x63'),_0x75fc('0x64'),'agent',_0x75fc('0x65'),_0x75fc('0x1f'),_0x75fc('0x66'),_0x75fc('0x67'),_0x75fc('0x68'),_0x75fc('0x69'),'group','company'];_[_0x75fc('0x6a')](_0x2bc003,function(_0x251b2a){return _0x309986[_0x75fc('0x6b')](_0x251b2a[_0x75fc('0x29')])||!_0x251b2a[_0x75fc('0x6c')]&&_0x251b2a[_0x75fc('0x2f')]!==_0x75fc('0x6d')&&_0x251b2a[_0x75fc('0x2f')]!==_0x75fc('0x6e');});return{'count':_0x2bc003['length'],'rows':_[_0x75fc('0x2c')](_0x2bc003,function(_0x443c0f){return{'id':_0x443c0f[_0x75fc('0x29')],'name':_0x443c0f['label'],'custom':!_0x443c0f['default'],'options':_0x443c0f[_0x75fc('0x6f')]?_[_0x75fc('0x2c')](_0x443c0f[_0x75fc('0x6f')],function(_0xb5e7eb){return{'name':_[_0x75fc('0x70')](_0xb5e7eb),'value':_0xb5e7eb};}):[]};})};}})[_0x75fc('0x42')](respondWithResult(_0x567cfd,null))['catch'](function(_0x176ee8){var _0x206ba7=_0x4de63c[_0x75fc('0x33')][_0x75fc('0x71')]?0x1f4:_0x176ee8['statusCode']||0x1f4;logger[_0x75fc('0x72')](_0x75fc('0x73'),'getFields',_0x206ba7,JSON[_0x75fc('0x74')](_0x176ee8));delete _0x176ee8[_0x75fc('0x29')];if(_0x206ba7===0x191){_0x206ba7=0x190;}_0x567cfd[_0x75fc('0x1f')](_0x206ba7)[_0x75fc('0x2a')](_0x4de63c[_0x75fc('0x33')][_0x75fc('0x71')]?{'message':_0x75fc('0x75'),'statusCode':_0x176ee8['statusCode']}:_0x176ee8);});}; \ No newline at end of file +var _0x3b59=['includeAll','findAll','rows','catch','show','params','include','create','body','getConfigurations','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','remoteUri','slice','substring','format','%s/%s','api/v2/ticket_fields','apiKey','toString','subject','agent','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x3b59,0x9c));var _0x93b5=function(_0xf71220,_0x3ec190){_0xf71220=_0xf71220-0x0;var _0x6efb4f=_0x3b59[_0xf71220];return _0x6efb4f;};'use strict';var emlformat=require(_0x93b5('0x0'));var rimraf=require(_0x93b5('0x1'));var zipdir=require(_0x93b5('0x2'));var jsonpatch=require(_0x93b5('0x3'));var rp=require(_0x93b5('0x4'));var moment=require(_0x93b5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x93b5('0x6'));var util=require('util');var path=require(_0x93b5('0x7'));var sox=require(_0x93b5('0x8'));var csv=require(_0x93b5('0x9'));var ejs=require(_0x93b5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93b5('0xb'));var squel=require(_0x93b5('0xc'));var crypto=require(_0x93b5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x93b5('0xe'));var toCsv=require(_0x93b5('0x9'));var querystring=require(_0x93b5('0xf'));var Papa=require(_0x93b5('0x10'));var Redis=require(_0x93b5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x93b5('0x12'));var as=require(_0x93b5('0x13'));var hardwareService=require(_0x93b5('0x14'));var logger=require(_0x93b5('0x15'))(_0x93b5('0x16'));var utils=require('../../config/utils');var config=require(_0x93b5('0x17'));var licenseUtil=require(_0x93b5('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x93b5('0x19'));function respondWithStatusCode(_0x1d80b2,_0x3022c2){_0x3022c2=_0x3022c2||0xcc;return function(_0x3dad37){if(_0x3dad37){return _0x1d80b2[_0x93b5('0x1a')](_0x3022c2);}return _0x1d80b2['status'](_0x3022c2)[_0x93b5('0x1b')]();};}function respondWithResult(_0x151e45,_0x4e9b23){_0x4e9b23=_0x4e9b23||0xc8;return function(_0x15ffe2){if(_0x15ffe2){return _0x151e45[_0x93b5('0x1c')](_0x4e9b23)[_0x93b5('0x1d')](_0x15ffe2);}};}function respondWithFilteredResult(_0x4c3d28,_0x39d8f5){return function(_0x546d3e){if(_0x546d3e){var _0x4cb6bf=typeof _0x39d8f5[_0x93b5('0x1e')]==='undefined'&&typeof _0x39d8f5[_0x93b5('0x1f')]===_0x93b5('0x20');var _0xc92c18=_0x546d3e['count'];var _0x4fa3ae=_0x4cb6bf?0x0:_0x39d8f5['offset'];var _0x16e6e6=_0x4cb6bf?_0x546d3e[_0x93b5('0x21')]:_0x39d8f5[_0x93b5('0x1e')]+_0x39d8f5[_0x93b5('0x1f')];var _0x1c4019;if(_0x16e6e6>=_0xc92c18){_0x16e6e6=_0xc92c18;_0x1c4019=0xc8;}else{_0x1c4019=0xce;}_0x4c3d28[_0x93b5('0x1c')](_0x1c4019);return _0x4c3d28[_0x93b5('0x22')](_0x93b5('0x23'),_0x4fa3ae+'-'+_0x16e6e6+'/'+_0xc92c18)[_0x93b5('0x1d')](_0x546d3e);}return null;};}function patchUpdates(_0x3ba1bc){return function(_0x5c1172){try{jsonpatch['apply'](_0x5c1172,_0x3ba1bc,!![]);}catch(_0x3e2452){return BPromise[_0x93b5('0x24')](_0x3e2452);}return _0x5c1172['save']();};}function saveUpdates(_0x170379,_0x1d8270){return function(_0x2e9e75){if(_0x2e9e75){return _0x2e9e75[_0x93b5('0x25')](_0x170379)[_0x93b5('0x26')](function(_0x194ae3){return _0x194ae3;});}return null;};}function removeEntity(_0x45c8ee,_0x7f6df6){return function(_0x1c7349){if(_0x1c7349){return _0x1c7349[_0x93b5('0x27')]()[_0x93b5('0x26')](function(){_0x45c8ee[_0x93b5('0x1c')](0xcc)[_0x93b5('0x1b')]();});}};}function handleEntityNotFound(_0x3a31db,_0x3494f){return function(_0x7eed38){if(!_0x7eed38){_0x3a31db[_0x93b5('0x1a')](0x194);}return _0x7eed38;};}function handleError(_0x11add6,_0x4977df){_0x4977df=_0x4977df||0x1f4;return function(_0xc6c370){logger[_0x93b5('0x28')](_0xc6c370[_0x93b5('0x29')]);if(_0xc6c370[_0x93b5('0x2a')]){delete _0xc6c370[_0x93b5('0x2a')];}_0x11add6[_0x93b5('0x1c')](_0x4977df)[_0x93b5('0x2b')](_0xc6c370);};}exports[_0x93b5('0x2c')]=function(_0x59389b,_0x2a6b07){var _0x239f96={},_0x54bc50={},_0xf7fc9c={'count':0x0,'rows':[]};var _0x4e4212=_[_0x93b5('0x2d')](db[_0x93b5('0x2e')][_0x93b5('0x2f')],function(_0x1a3495){return{'name':_0x1a3495[_0x93b5('0x30')],'type':_0x1a3495[_0x93b5('0x31')][_0x93b5('0x32')]};});_0x54bc50[_0x93b5('0x33')]=_[_0x93b5('0x2d')](_0x4e4212,_0x93b5('0x2a'));_0x54bc50['query']=_[_0x93b5('0x34')](_0x59389b['query']);_0x54bc50['filters']=_['intersection'](_0x54bc50['model'],_0x54bc50[_0x93b5('0x35')]);_0x239f96[_0x93b5('0x36')]=_[_0x93b5('0x37')](_0x54bc50[_0x93b5('0x33')],qs[_0x93b5('0x38')](_0x59389b[_0x93b5('0x35')][_0x93b5('0x38')]));_0x239f96[_0x93b5('0x36')]=_0x239f96[_0x93b5('0x36')][_0x93b5('0x39')]?_0x239f96[_0x93b5('0x36')]:_0x54bc50['model'];if(!_0x59389b['query'][_0x93b5('0x3a')](_0x93b5('0x3b'))){_0x239f96[_0x93b5('0x1f')]=qs[_0x93b5('0x1f')](_0x59389b[_0x93b5('0x35')][_0x93b5('0x1f')]);_0x239f96['offset']=qs['offset'](_0x59389b['query']['offset']);}_0x239f96['order']=qs[_0x93b5('0x3c')](_0x59389b[_0x93b5('0x35')][_0x93b5('0x3c')]);_0x239f96[_0x93b5('0x3d')]=qs[_0x93b5('0x3e')](_[_0x93b5('0x3f')](_0x59389b[_0x93b5('0x35')],_0x54bc50[_0x93b5('0x3e')]),_0x4e4212);if(_0x59389b[_0x93b5('0x35')][_0x93b5('0x40')]){_0x239f96['where']=_['merge'](_0x239f96['where'],{'$or':_[_0x93b5('0x2d')](_0x4e4212,function(_0x394400){if(_0x394400[_0x93b5('0x31')]!==_0x93b5('0x41')){var _0x751eff={};_0x751eff[_0x394400[_0x93b5('0x2a')]]={'$like':'%'+_0x59389b['query'][_0x93b5('0x40')]+'%'};return _0x751eff;}})});}_0x239f96=_[_0x93b5('0x42')]({},_0x239f96,_0x59389b[_0x93b5('0x43')]);var _0x5d5134={'where':_0x239f96[_0x93b5('0x3d')]};return db[_0x93b5('0x2e')]['count'](_0x5d5134)['then'](function(_0xa46dca){_0xf7fc9c[_0x93b5('0x21')]=_0xa46dca;if(_0x59389b[_0x93b5('0x35')][_0x93b5('0x44')]){_0x239f96['include']=[{'all':!![]}];}return db[_0x93b5('0x2e')][_0x93b5('0x45')](_0x239f96);})[_0x93b5('0x26')](function(_0x30188f){_0xf7fc9c[_0x93b5('0x46')]=_0x30188f;return _0xf7fc9c;})[_0x93b5('0x26')](respondWithFilteredResult(_0x2a6b07,_0x239f96))[_0x93b5('0x47')](handleError(_0x2a6b07,null));};exports[_0x93b5('0x48')]=function(_0x51726a,_0x4cabd8){var _0x22b4cf={'raw':![],'where':{'id':_0x51726a[_0x93b5('0x49')]['id']}},_0x290e26={};_0x290e26[_0x93b5('0x33')]=_[_0x93b5('0x34')](db[_0x93b5('0x2e')][_0x93b5('0x2f')]);_0x290e26[_0x93b5('0x35')]=_[_0x93b5('0x34')](_0x51726a[_0x93b5('0x35')]);_0x290e26['filters']=_[_0x93b5('0x37')](_0x290e26['model'],_0x290e26[_0x93b5('0x35')]);_0x22b4cf[_0x93b5('0x36')]=_[_0x93b5('0x37')](_0x290e26['model'],qs[_0x93b5('0x38')](_0x51726a[_0x93b5('0x35')][_0x93b5('0x38')]));_0x22b4cf[_0x93b5('0x36')]=_0x22b4cf[_0x93b5('0x36')][_0x93b5('0x39')]?_0x22b4cf[_0x93b5('0x36')]:_0x290e26['model'];if(_0x51726a[_0x93b5('0x35')][_0x93b5('0x44')]){_0x22b4cf[_0x93b5('0x4a')]=[{'all':!![]}];}_0x22b4cf=_[_0x93b5('0x42')]({},_0x22b4cf,_0x51726a['options']);return db[_0x93b5('0x2e')]['find'](_0x22b4cf)['then'](handleEntityNotFound(_0x4cabd8,null))['then'](respondWithResult(_0x4cabd8,null))[_0x93b5('0x47')](handleError(_0x4cabd8,null));};exports[_0x93b5('0x4b')]=function(_0x6d8e3b,_0x19717d){return db[_0x93b5('0x2e')][_0x93b5('0x4b')](_0x6d8e3b[_0x93b5('0x4c')],{})['then'](respondWithResult(_0x19717d,0xc9))[_0x93b5('0x47')](handleError(_0x19717d,null));};exports[_0x93b5('0x25')]=function(_0x488c3c,_0x505217){if(_0x488c3c[_0x93b5('0x4c')]['id']){delete _0x488c3c[_0x93b5('0x4c')]['id'];}return db[_0x93b5('0x2e')]['find']({'where':{'id':_0x488c3c['params']['id']}})['then'](handleEntityNotFound(_0x505217,null))[_0x93b5('0x26')](saveUpdates(_0x488c3c['body'],null))['then'](respondWithResult(_0x505217,null))[_0x93b5('0x47')](handleError(_0x505217,null));};exports['destroy']=function(_0x27a39a,_0x5eee7d){return db[_0x93b5('0x2e')]['find']({'where':{'id':_0x27a39a['params']['id']}})[_0x93b5('0x26')](handleEntityNotFound(_0x5eee7d,null))[_0x93b5('0x26')](removeEntity(_0x5eee7d,null))[_0x93b5('0x47')](handleError(_0x5eee7d,null));};exports[_0x93b5('0x4d')]=function(_0x27c467,_0x53b4c1,_0x4b6792){var _0x49c5fd={};var _0x21c070={};var _0xe7b552;var _0x3b47bb;return db[_0x93b5('0x2e')]['findOne']({'where':{'id':_0x27c467['params']['id']}})[_0x93b5('0x26')](handleEntityNotFound(_0x53b4c1,null))['then'](function(_0x4853bf){if(_0x4853bf){_0xe7b552=_0x4853bf;_0x21c070[_0x93b5('0x33')]=_[_0x93b5('0x34')](db['FreshdeskConfiguration'][_0x93b5('0x2f')]);_0x21c070['query']=_[_0x93b5('0x34')](_0x27c467[_0x93b5('0x35')]);_0x21c070[_0x93b5('0x3e')]=_[_0x93b5('0x37')](_0x21c070[_0x93b5('0x33')],_0x21c070['query']);_0x49c5fd['attributes']=_[_0x93b5('0x37')](_0x21c070['model'],qs['fields'](_0x27c467[_0x93b5('0x35')][_0x93b5('0x38')]));_0x49c5fd['attributes']=_0x49c5fd[_0x93b5('0x36')]['length']?_0x49c5fd[_0x93b5('0x36')]:_0x21c070['model'];_0x49c5fd[_0x93b5('0x4e')]=qs['sort'](_0x27c467[_0x93b5('0x35')][_0x93b5('0x3c')]);_0x49c5fd['where']=qs['filters'](_[_0x93b5('0x3f')](_0x27c467[_0x93b5('0x35')],_0x21c070[_0x93b5('0x3e')]));if(_0x27c467['query'][_0x93b5('0x40')]){_0x49c5fd[_0x93b5('0x3d')]=_[_0x93b5('0x42')](_0x49c5fd[_0x93b5('0x3d')],{'$or':_[_0x93b5('0x2d')](_0x49c5fd[_0x93b5('0x36')],function(_0x4b3474){var _0x3d19a6={};_0x3d19a6[_0x4b3474]={'$like':'%'+_0x27c467[_0x93b5('0x35')]['filter']+'%'};return _0x3d19a6;})});}_0x49c5fd=_[_0x93b5('0x42')]({},_0x49c5fd,_0x27c467[_0x93b5('0x43')]);return _0xe7b552[_0x93b5('0x4d')](_0x49c5fd);}})[_0x93b5('0x26')](function(_0x152888){if(_0x152888){_0x3b47bb=_0x152888[_0x93b5('0x39')];if(!_0x27c467[_0x93b5('0x35')][_0x93b5('0x3a')](_0x93b5('0x3b'))){_0x49c5fd[_0x93b5('0x1f')]=qs[_0x93b5('0x1f')](_0x27c467[_0x93b5('0x35')]['limit']);_0x49c5fd[_0x93b5('0x1e')]=qs['offset'](_0x27c467[_0x93b5('0x35')][_0x93b5('0x1e')]);}return _0xe7b552[_0x93b5('0x4d')](_0x49c5fd);}})[_0x93b5('0x26')](function(_0x4efdb7){if(_0x4efdb7){return _0x4efdb7?{'count':_0x3b47bb,'rows':_0x4efdb7}:null;}})['then'](respondWithResult(_0x53b4c1,null))[_0x93b5('0x47')](handleError(_0x53b4c1,null));};exports[_0x93b5('0x4f')]=function(_0x2537c1,_0x465792,_0x288701){if(_0x2537c1[_0x93b5('0x4c')]['id']){delete _0x2537c1[_0x93b5('0x4c')]['id'];}return db['FreshdeskAccount'][_0x93b5('0x50')]({'where':{'id':_0x2537c1['params']['id']}})[_0x93b5('0x26')](handleEntityNotFound(_0x465792,null))[_0x93b5('0x26')](function(_0x1db0ef){if(_0x1db0ef){_0x2537c1['body'][_0x93b5('0x51')]=_0x1db0ef['id'];_0x2537c1[_0x93b5('0x4c')][_0x93b5('0x52')]=integrations[_0x93b5('0x53')](_0x2537c1['body'][_0x93b5('0x54')],_0x2537c1['body'][_0x93b5('0x31')]);_0x2537c1['body'][_0x93b5('0x55')]=integrations[_0x93b5('0x56')](_0x2537c1[_0x93b5('0x4c')]['channel'],_0x2537c1[_0x93b5('0x4c')]['type']);return db['FreshdeskConfiguration'][_0x93b5('0x4b')](_0x2537c1[_0x93b5('0x4c')],{'include':[{'model':db['FreshdeskField'],'as':_0x93b5('0x52')},{'model':db['FreshdeskField'],'as':_0x93b5('0x55')}]});}return null;})['then'](respondWithResult(_0x465792,null))[_0x93b5('0x47')](handleError(_0x465792,null));};exports[_0x93b5('0x57')]=function(_0x4efd03,_0x22c366,_0x8db8db){var _0x2ad932='';return db[_0x93b5('0x2e')][_0x93b5('0x50')]({'where':{'id':_0x4efd03[_0x93b5('0x49')]['id']},'attributes':['id',_0x93b5('0x58'),'apiKey']})[_0x93b5('0x26')](handleEntityNotFound(_0x22c366,null))[_0x93b5('0x26')](function(_0x2dea19){if(_0x2dea19){_0x2ad932=_0x2dea19['remoteUri'];var _0x2ef917=_0x2ad932[_0x93b5('0x59')](-0x1);if(_0x2ef917==='/'){_0x2ad932=_0x2ad932[_0x93b5('0x5a')](0x0,_0x2ad932['lastIndexOf'](_0x2ef917));}return rp({'method':'GET','uri':util[_0x93b5('0x5b')](_0x93b5('0x5c'),_0x2ad932,_0x93b5('0x5d')),'headers':{'Authorization':util[_0x93b5('0x5b')]('Basic\x20%s',new Buffer(util[_0x93b5('0x5b')]('%s:X',_0x2dea19[_0x93b5('0x5e')]))[_0x93b5('0x5f')]('base64'))},'json':!![]});}})[_0x93b5('0x26')](function(_0x4acd54){if(_0x4acd54){var _0x25ed4e=['requester',_0x93b5('0x60'),_0x93b5('0x61'),'description',_0x93b5('0x1c'),'priority',_0x93b5('0x62'),_0x93b5('0x63'),_0x93b5('0x64'),_0x93b5('0x62'),_0x93b5('0x65')];_['remove'](_0x4acd54,function(_0x4997eb){return _0x25ed4e[_0x93b5('0x66')](_0x4997eb[_0x93b5('0x2a')])||!_0x4997eb[_0x93b5('0x67')]&&_0x4997eb[_0x93b5('0x31')]!==_0x93b5('0x68')&&_0x4997eb[_0x93b5('0x31')]!==_0x93b5('0x69');});return{'count':_0x4acd54[_0x93b5('0x39')],'rows':_[_0x93b5('0x2d')](_0x4acd54,function(_0x35ed34){return{'id':_0x35ed34['name'],'name':_0x35ed34['label'],'custom':!_0x35ed34[_0x93b5('0x67')],'options':_0x35ed34[_0x93b5('0x6a')]?_[_0x93b5('0x2d')](_0x35ed34['choices'],function(_0x3b2d9d){return{'name':_[_0x93b5('0x6b')](_0x3b2d9d),'value':_0x3b2d9d};}):[]};})};}})[_0x93b5('0x26')](respondWithResult(_0x22c366,null))[_0x93b5('0x47')](function(_0x2d26c8){var _0x256925=_0x4efd03[_0x93b5('0x35')][_0x93b5('0x6c')]?0x1f4:_0x2d26c8[_0x93b5('0x6d')]||0x1f4;logger[_0x93b5('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x93b5('0x57'),_0x256925,JSON[_0x93b5('0x6e')](_0x2d26c8));delete _0x2d26c8[_0x93b5('0x2a')];if(_0x256925===0x191){_0x256925=0x190;}_0x22c366['status'](_0x256925)[_0x93b5('0x2b')](_0x4efd03[_0x93b5('0x35')][_0x93b5('0x6c')]?{'message':_0x93b5('0x6f'),'statusCode':_0x2d26c8[_0x93b5('0x6d')]}:_0x2d26c8);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index a78b84a..06144c1 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 _0x35d1=['define','int_freshdesk_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x35d1,0x1d0));var _0x135d=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x35d1[_0x3fe393];return _0x534d14;};'use strict';var _=require(_0x135d('0x0'));var util=require(_0x135d('0x1'));var logger=require(_0x135d('0x2'))('api');var moment=require(_0x135d('0x3'));var BPromise=require('bluebird');var rp=require(_0x135d('0x4'));var fs=require('fs');var path=require(_0x135d('0x5'));var rimraf=require(_0x135d('0x6'));var config=require(_0x135d('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x135d('0x8')]=function(_0x26a770,_0x2d591){return _0x26a770[_0x135d('0x9')]('FreshdeskAccount',attributes,{'tableName':_0x135d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2054=['api','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger'];(function(_0x52ec83,_0x43a4c3){var _0xbb5984=function(_0x3fc0a2){while(--_0x3fc0a2){_0x52ec83['push'](_0x52ec83['shift']());}};_0xbb5984(++_0x43a4c3);}(_0x2054,0xe8));var _0x4205=function(_0x4d214f,_0x4a9d72){_0x4d214f=_0x4d214f-0x0;var _0x35d3e0=_0x2054[_0x4d214f];return _0x35d3e0;};'use strict';var _=require('lodash');var util=require(_0x4205('0x0'));var logger=require(_0x4205('0x1'))(_0x4205('0x2'));var moment=require('moment');var BPromise=require(_0x4205('0x3'));var rp=require(_0x4205('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4205('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x4205('0x6'));module['exports']=function(_0xa371ee,_0x18c1e5){return _0xa371ee['define'](_0x4205('0x7'),attributes,{'tableName':_0x4205('0x8'),'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 93627e9..a970033 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 _0xbb6e=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','findAll','options','where','attributes','limit','include','model','map','GetFreshdeskAccount','catch','ShowFreshdeskAccount','FreshdeskAccount','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info'];(function(_0x15ec35,_0x5b9972){var _0x937cce=function(_0x59326b){while(--_0x59326b){_0x15ec35['push'](_0x15ec35['shift']());}};_0x937cce(++_0x5b9972);}(_0xbb6e,0x115));var _0xebb6=function(_0x28a45c,_0x5518be){_0x28a45c=_0x28a45c-0x0;var _0x2d6f58=_0xbb6e[_0x28a45c];return _0x2d6f58;};'use strict';var _=require(_0xebb6('0x0'));var util=require('util');var moment=require(_0xebb6('0x1'));var BPromise=require('bluebird');var rs=require(_0xebb6('0x2'));var fs=require('fs');var Redis=require(_0xebb6('0x3'));var db=require(_0xebb6('0x4'))['db'];var utils=require(_0xebb6('0x5'));var logger=require(_0xebb6('0x6'))(_0xebb6('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xebb6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xac57fc,_0x22a947,_0x486ed1){return new BPromise(function(_0x496f2a,_0x18c68a){return client['request'](_0xac57fc,_0x486ed1)[_0xebb6('0x9')](function(_0x2249cb){logger[_0xebb6('0xa')](_0xebb6('0xb'),_0x22a947,_0xebb6('0xc'));logger[_0xebb6('0xd')](_0xebb6('0xe'),_0x22a947,_0xebb6('0xc'),JSON[_0xebb6('0xf')](_0x2249cb));if(_0x2249cb[_0xebb6('0x10')]){if(_0x2249cb[_0xebb6('0x10')][_0xebb6('0x11')]===0x1f4){logger[_0xebb6('0x10')](_0xebb6('0xb'),_0x22a947,_0x2249cb[_0xebb6('0x10')][_0xebb6('0x12')]);return _0x18c68a(_0x2249cb[_0xebb6('0x10')]['message']);}logger[_0xebb6('0x10')](_0xebb6('0xb'),_0x22a947,_0x2249cb[_0xebb6('0x10')][_0xebb6('0x12')]);return _0x496f2a(_0x2249cb['error'][_0xebb6('0x12')]);}else{logger[_0xebb6('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x22a947,_0xebb6('0xc'));_0x496f2a(_0x2249cb['result'][_0xebb6('0x12')]);}})['catch'](function(_0x544760){logger[_0xebb6('0x10')](_0xebb6('0xb'),_0x22a947,_0x544760);_0x18c68a(_0x544760);});});}exports['GetFreshdeskAccount']=function(_0x1d1735){var _0x528d64=this;return new Promise(function(_0x314df1,_0x2b57b4){return db['FreshdeskAccount'][_0xebb6('0x13')]({'raw':_0x1d1735[_0xebb6('0x14')]?_0x1d1735[_0xebb6('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x1d1735[_0xebb6('0x14')]?_0x1d1735['options'][_0xebb6('0x15')]||null:null,'attributes':_0x1d1735[_0xebb6('0x14')]?_0x1d1735['options'][_0xebb6('0x16')]||null:null,'limit':_0x1d1735[_0xebb6('0x14')]?_0x1d1735[_0xebb6('0x14')][_0xebb6('0x17')]||null:null,'include':_0x1d1735[_0xebb6('0x14')]?_0x1d1735['options'][_0xebb6('0x18')]?_['map'](_0x1d1735[_0xebb6('0x14')][_0xebb6('0x18')],function(_0x427c5d){return{'model':db[_0x427c5d[_0xebb6('0x19')]],'as':_0x427c5d['as'],'attributes':_0x427c5d[_0xebb6('0x16')],'include':_0x427c5d[_0xebb6('0x18')]?_[_0xebb6('0x1a')](_0x427c5d[_0xebb6('0x18')],function(_0x577a67){return{'model':db[_0x577a67[_0xebb6('0x19')]],'as':_0x577a67['as'],'attributes':_0x577a67[_0xebb6('0x16')],'include':_0x577a67['include']?_['map'](_0x577a67[_0xebb6('0x18')],function(_0x1c7a0e){return{'model':db[_0x1c7a0e[_0xebb6('0x19')]],'as':_0x1c7a0e['as'],'attributes':_0x1c7a0e['attributes']};}):[]};}):[]};}):[]:[]})[_0xebb6('0x9')](function(_0x4d40d1){logger[_0xebb6('0xa')](_0xebb6('0x1b'),_0x1d1735);logger['debug'](_0xebb6('0x1b'),_0x1d1735,JSON[_0xebb6('0xf')](_0x4d40d1));_0x314df1(_0x4d40d1);})[_0xebb6('0x1c')](function(_0x1aa5f0){logger[_0xebb6('0x10')](_0xebb6('0x1b'),_0x1aa5f0[_0xebb6('0x12')],_0x1d1735);_0x2b57b4(_0x528d64[_0xebb6('0x10')](0x1f4,_0x1aa5f0[_0xebb6('0x12')]));});});};exports[_0xebb6('0x1d')]=function(_0x12e9c9){var _0x20eb2b=this;return new Promise(function(_0x58e25e,_0x13cc2a){return db[_0xebb6('0x1e')]['find']({'raw':_0x12e9c9['options']?_0x12e9c9[_0xebb6('0x14')][_0xebb6('0x1f')]===undefined?!![]:![]:!![],'where':_0x12e9c9[_0xebb6('0x14')]?_0x12e9c9[_0xebb6('0x14')][_0xebb6('0x15')]||null:null,'attributes':_0x12e9c9['options']?_0x12e9c9['options'][_0xebb6('0x16')]||null:null,'include':_0x12e9c9[_0xebb6('0x14')]?_0x12e9c9[_0xebb6('0x14')][_0xebb6('0x18')]?_[_0xebb6('0x1a')](_0x12e9c9[_0xebb6('0x14')][_0xebb6('0x18')],function(_0x5c97de){return{'model':db[_0x5c97de[_0xebb6('0x19')]],'as':_0x5c97de['as'],'attributes':_0x5c97de['attributes'],'include':_0x5c97de[_0xebb6('0x18')]?_[_0xebb6('0x1a')](_0x5c97de['include'],function(_0x591021){return{'model':db[_0x591021[_0xebb6('0x19')]],'as':_0x591021['as'],'attributes':_0x591021[_0xebb6('0x16')],'include':_0x591021[_0xebb6('0x18')]?_[_0xebb6('0x1a')](_0x591021[_0xebb6('0x18')],function(_0x593244){return{'model':db[_0x593244[_0xebb6('0x19')]],'as':_0x593244['as'],'attributes':_0x593244['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3338c7){logger[_0xebb6('0xa')](_0xebb6('0x1d'),_0x12e9c9);logger[_0xebb6('0xd')](_0xebb6('0x1d'),_0x12e9c9,JSON[_0xebb6('0xf')](_0x3338c7));_0x58e25e(_0x3338c7);})[_0xebb6('0x1c')](function(_0x365ee6){logger[_0xebb6('0x10')]('ShowFreshdeskAccount',_0x365ee6['message'],_0x12e9c9);_0x13cc2a(_0x20eb2b['error'](0x1f4,_0x365ee6[_0xebb6('0x12')]));});});}; \ No newline at end of file +var _0x6ddd=['result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','attributes','limit','map','include','model','ShowFreshdeskAccount','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2f363b,_0x18c675){var _0x27dbb5=function(_0x45ad0e){while(--_0x45ad0e){_0x2f363b['push'](_0x2f363b['shift']());}};_0x27dbb5(++_0x18c675);}(_0x6ddd,0x157));var _0xd6dd=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x6ddd[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xd6dd('0x0'));var util=require(_0xd6dd('0x1'));var moment=require('moment');var BPromise=require(_0xd6dd('0x2'));var rs=require(_0xd6dd('0x3'));var fs=require('fs');var Redis=require(_0xd6dd('0x4'));var db=require(_0xd6dd('0x5'))['db'];var utils=require(_0xd6dd('0x6'));var logger=require(_0xd6dd('0x7'))(_0xd6dd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd6dd('0x9')][_0xd6dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a7584,_0x30a6c6,_0xf177e5){return new BPromise(function(_0x465d54,_0x210e48){return client['request'](_0x2a7584,_0xf177e5)[_0xd6dd('0xb')](function(_0x5f0db4){logger['info'](_0xd6dd('0xc'),_0x30a6c6,_0xd6dd('0xd'));logger[_0xd6dd('0xe')](_0xd6dd('0xf'),_0x30a6c6,_0xd6dd('0xd'),JSON[_0xd6dd('0x10')](_0x5f0db4));if(_0x5f0db4[_0xd6dd('0x11')]){if(_0x5f0db4[_0xd6dd('0x11')]['code']===0x1f4){logger[_0xd6dd('0x11')](_0xd6dd('0xc'),_0x30a6c6,_0x5f0db4['error'][_0xd6dd('0x12')]);return _0x210e48(_0x5f0db4[_0xd6dd('0x11')]['message']);}logger['error'](_0xd6dd('0xc'),_0x30a6c6,_0x5f0db4['error']['message']);return _0x465d54(_0x5f0db4[_0xd6dd('0x11')][_0xd6dd('0x12')]);}else{logger[_0xd6dd('0x13')](_0xd6dd('0xc'),_0x30a6c6,'request\x20sent');_0x465d54(_0x5f0db4[_0xd6dd('0x14')][_0xd6dd('0x12')]);}})[_0xd6dd('0x15')](function(_0x1a5f47){logger[_0xd6dd('0x11')](_0xd6dd('0xc'),_0x30a6c6,_0x1a5f47);_0x210e48(_0x1a5f47);});});}exports[_0xd6dd('0x16')]=function(_0x506203){var _0x1839c6=this;return new Promise(function(_0x364f23,_0x546e3f){return db[_0xd6dd('0x17')]['findAll']({'raw':_0x506203[_0xd6dd('0x18')]?_0x506203[_0xd6dd('0x18')][_0xd6dd('0x19')]===undefined?!![]:![]:!![],'where':_0x506203['options']?_0x506203[_0xd6dd('0x18')]['where']||null:null,'attributes':_0x506203[_0xd6dd('0x18')]?_0x506203[_0xd6dd('0x18')][_0xd6dd('0x1a')]||null:null,'limit':_0x506203[_0xd6dd('0x18')]?_0x506203['options'][_0xd6dd('0x1b')]||null:null,'include':_0x506203[_0xd6dd('0x18')]?_0x506203['options']['include']?_[_0xd6dd('0x1c')](_0x506203['options'][_0xd6dd('0x1d')],function(_0xcb1a59){return{'model':db[_0xcb1a59['model']],'as':_0xcb1a59['as'],'attributes':_0xcb1a59['attributes'],'include':_0xcb1a59[_0xd6dd('0x1d')]?_[_0xd6dd('0x1c')](_0xcb1a59['include'],function(_0x524d26){return{'model':db[_0x524d26[_0xd6dd('0x1e')]],'as':_0x524d26['as'],'attributes':_0x524d26[_0xd6dd('0x1a')],'include':_0x524d26[_0xd6dd('0x1d')]?_[_0xd6dd('0x1c')](_0x524d26[_0xd6dd('0x1d')],function(_0x4e9d5d){return{'model':db[_0x4e9d5d[_0xd6dd('0x1e')]],'as':_0x4e9d5d['as'],'attributes':_0x4e9d5d[_0xd6dd('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd6dd('0xb')](function(_0x13b4ae){logger[_0xd6dd('0x13')]('GetFreshdeskAccount',_0x506203);logger[_0xd6dd('0xe')](_0xd6dd('0x16'),_0x506203,JSON['stringify'](_0x13b4ae));_0x364f23(_0x13b4ae);})[_0xd6dd('0x15')](function(_0x3f9351){logger[_0xd6dd('0x11')]('GetFreshdeskAccount',_0x3f9351[_0xd6dd('0x12')],_0x506203);_0x546e3f(_0x1839c6[_0xd6dd('0x11')](0x1f4,_0x3f9351[_0xd6dd('0x12')]));});});};exports[_0xd6dd('0x1f')]=function(_0x5f5ce7){var _0x36a970=this;return new Promise(function(_0x5cde89,_0x164b18){return db[_0xd6dd('0x17')]['find']({'raw':_0x5f5ce7[_0xd6dd('0x18')]?_0x5f5ce7['options'][_0xd6dd('0x19')]===undefined?!![]:![]:!![],'where':_0x5f5ce7[_0xd6dd('0x18')]?_0x5f5ce7['options'][_0xd6dd('0x20')]||null:null,'attributes':_0x5f5ce7[_0xd6dd('0x18')]?_0x5f5ce7[_0xd6dd('0x18')][_0xd6dd('0x1a')]||null:null,'include':_0x5f5ce7[_0xd6dd('0x18')]?_0x5f5ce7['options'][_0xd6dd('0x1d')]?_[_0xd6dd('0x1c')](_0x5f5ce7[_0xd6dd('0x18')][_0xd6dd('0x1d')],function(_0x5f34da){return{'model':db[_0x5f34da[_0xd6dd('0x1e')]],'as':_0x5f34da['as'],'attributes':_0x5f34da[_0xd6dd('0x1a')],'include':_0x5f34da[_0xd6dd('0x1d')]?_[_0xd6dd('0x1c')](_0x5f34da['include'],function(_0x3d9769){return{'model':db[_0x3d9769[_0xd6dd('0x1e')]],'as':_0x3d9769['as'],'attributes':_0x3d9769[_0xd6dd('0x1a')],'include':_0x3d9769['include']?_[_0xd6dd('0x1c')](_0x3d9769[_0xd6dd('0x1d')],function(_0x165011){return{'model':db[_0x165011['model']],'as':_0x165011['as'],'attributes':_0x165011[_0xd6dd('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b9b5){logger['info'](_0xd6dd('0x1f'),_0x5f5ce7);logger[_0xd6dd('0xe')]('ShowFreshdeskAccount',_0x5f5ce7,JSON[_0xd6dd('0x10')](_0x36b9b5));_0x5cde89(_0x36b9b5);})[_0xd6dd('0x15')](function(_0x2f077a){logger['error'](_0xd6dd('0x1f'),_0x2f077a[_0xd6dd('0x12')],_0x5f5ce7);_0x164b18(_0x36a970[_0xd6dd('0x11')](0x1f4,_0x2f077a[_0xd6dd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 4e0e907..a6c29f7 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 _0x001a=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','/:id','isAuthenticated','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','setTags','put','destroy','exports','multer','util','path'];(function(_0x2b0170,_0x352041){var _0x4f56d7=function(_0x2b21b2){while(--_0x2b21b2){_0x2b0170['push'](_0x2b0170['shift']());}};_0x4f56d7(++_0x352041);}(_0x001a,0x189));var _0xa001=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0x001a[_0x492af5];return _0x59f529;};'use strict';var multer=require(_0xa001('0x0'));var util=require(_0xa001('0x1'));var path=require(_0xa001('0x2'));var timeout=require(_0xa001('0x3'));var express=require(_0xa001('0x4'));var router=express['Router']();var fs_extra=require(_0xa001('0x5'));var auth=require(_0xa001('0x6'));var interaction=require(_0xa001('0x7'));var config=require('../../config/environment');var controller=require(_0xa001('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa001('0x9')](_0xa001('0xa'),auth[_0xa001('0xb')](),controller['show']);router['get']('/:id/fields',auth[_0xa001('0xb')](),controller['getFields']);router['get'](_0xa001('0xc'),auth['isAuthenticated'](),controller[_0xa001('0xd')]);router['get']('/:id/descriptions',auth[_0xa001('0xb')](),controller[_0xa001('0xe')]);router[_0xa001('0x9')](_0xa001('0xf'),auth[_0xa001('0xb')](),controller[_0xa001('0x10')]);router[_0xa001('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa001('0xf'),auth[_0xa001('0xb')](),controller[_0xa001('0x12')]);router[_0xa001('0x13')](_0xa001('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xa001('0xa'),auth['isAuthenticated'](),controller[_0xa001('0x14')]);module[_0xa001('0x15')]=router; \ No newline at end of file +var _0xd12d=['isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','./intFreshdeskConfiguration.controller','get','index','/:id'];(function(_0x42a556,_0x4ed3c4){var _0x354144=function(_0x9610fa){while(--_0x9610fa){_0x42a556['push'](_0x42a556['shift']());}};_0x354144(++_0x4ed3c4);}(_0xd12d,0xae));var _0xdd12=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd12d[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xdd12('0x0'));var util=require(_0xdd12('0x1'));var path=require('path');var timeout=require(_0xdd12('0x2'));var express=require(_0xdd12('0x3'));var router=express[_0xdd12('0x4')]();var fs_extra=require(_0xdd12('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdd12('0x6'));router[_0xdd12('0x7')]('/',auth['isAuthenticated'](),controller[_0xdd12('0x8')]);router[_0xdd12('0x7')](_0xdd12('0x9'),auth[_0xdd12('0xa')](),controller['show']);router['get'](_0xdd12('0xb'),auth[_0xdd12('0xa')](),controller[_0xdd12('0xc')]);router[_0xdd12('0x7')](_0xdd12('0xd'),auth[_0xdd12('0xa')](),controller[_0xdd12('0xe')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xdd12('0x7')](_0xdd12('0xf'),auth[_0xdd12('0xa')](),controller[_0xdd12('0x10')]);router[_0xdd12('0x11')]('/',auth[_0xdd12('0xa')](),controller[_0xdd12('0x12')]);router[_0xdd12('0x11')]('/:id/tags',auth['isAuthenticated'](),controller[_0xdd12('0x13')]);router['put'](_0xdd12('0x9'),auth[_0xdd12('0xa')](),controller[_0xdd12('0x14')]);router[_0xdd12('0x15')](_0xdd12('0x9'),auth['isAuthenticated'](),controller[_0xdd12('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index e1f608a..25d0866 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 _0x8227=['exports','STRING'];(function(_0x4c5e5a,_0x58ade0){var _0x2f5b8d=function(_0x94dfac){while(--_0x94dfac){_0x4c5e5a['push'](_0x4c5e5a['shift']());}};_0x2f5b8d(++_0x58ade0);}(_0x8227,0x178));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x7822('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7822('0x1')]}}; \ No newline at end of file +var _0xc076=['STRING'];(function(_0x261035,_0x5d983f){var _0x241fe8=function(_0x658083){while(--_0x658083){_0x261035['push'](_0x261035['shift']());}};_0x241fe8(++_0x5d983f);}(_0xc076,0x68));var _0x6c07=function(_0xfa9c71,_0x198d5a){_0xfa9c71=_0xfa9c71-0x0;var _0x41a12e=_0xc076[_0xfa9c71];return _0x41a12e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6c07('0x0')]},'description':{'type':Sequelize[_0x6c07('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 63705d8..f5a8708 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 _0x24f1=['type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','findAll','rows','catch','show','includeAll','include','find','create','getFields','params','FreshdeskField','options','findOne','getSubjects','getDescriptions','getTags','setTags','body','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName'];(function(_0x3ccf3e,_0x5baeec){var _0x515330=function(_0x48aae9){while(--_0x48aae9){_0x3ccf3e['push'](_0x3ccf3e['shift']());}};_0x515330(++_0x5baeec);}(_0x24f1,0xcd));var _0x124f=function(_0x1dfd6a,_0x43e2b8){_0x1dfd6a=_0x1dfd6a-0x0;var _0x41fe5e=_0x24f1[_0x1dfd6a];return _0x41fe5e;};'use strict';var emlformat=require(_0x124f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x124f('0x1'));var jsonpatch=require(_0x124f('0x2'));var rp=require(_0x124f('0x3'));var moment=require(_0x124f('0x4'));var BPromise=require(_0x124f('0x5'));var Mustache=require(_0x124f('0x6'));var util=require(_0x124f('0x7'));var path=require(_0x124f('0x8'));var sox=require(_0x124f('0x9'));var csv=require(_0x124f('0xa'));var ejs=require(_0x124f('0xb'));var fs=require('fs');var fs_extra=require(_0x124f('0xc'));var _=require(_0x124f('0xd'));var squel=require(_0x124f('0xe'));var crypto=require('crypto');var jsforce=require(_0x124f('0xf'));var deskjs=require(_0x124f('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x124f('0x11'));var Redis=require('ioredis');var authService=require(_0x124f('0x12'));var qs=require(_0x124f('0x13'));var as=require(_0x124f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x124f('0x15'))('api');var utils=require(_0x124f('0x16'));var config=require(_0x124f('0x17'));var licenseUtil=require(_0x124f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5231e9,_0x12fbdf){_0x12fbdf=_0x12fbdf||0xcc;return function(_0x8d25cb){if(_0x8d25cb){return _0x5231e9[_0x124f('0x19')](_0x12fbdf);}return _0x5231e9[_0x124f('0x1a')](_0x12fbdf)[_0x124f('0x1b')]();};}function respondWithResult(_0x55af66,_0x278f7e){_0x278f7e=_0x278f7e||0xc8;return function(_0x569f1f){if(_0x569f1f){return _0x55af66[_0x124f('0x1a')](_0x278f7e)['json'](_0x569f1f);}};}function respondWithFilteredResult(_0x28f494,_0xb6b4c){return function(_0x3d52f7){if(_0x3d52f7){var _0x5c1eb9=typeof _0xb6b4c[_0x124f('0x1c')]===_0x124f('0x1d')&&typeof _0xb6b4c[_0x124f('0x1e')]===_0x124f('0x1d');var _0x218a61=_0x3d52f7['count'];var _0x169589=_0x5c1eb9?0x0:_0xb6b4c[_0x124f('0x1c')];var _0xdd8858=_0x5c1eb9?_0x3d52f7[_0x124f('0x1f')]:_0xb6b4c[_0x124f('0x1c')]+_0xb6b4c[_0x124f('0x1e')];var _0x2e3c1f;if(_0xdd8858>=_0x218a61){_0xdd8858=_0x218a61;_0x2e3c1f=0xc8;}else{_0x2e3c1f=0xce;}_0x28f494[_0x124f('0x1a')](_0x2e3c1f);return _0x28f494[_0x124f('0x20')](_0x124f('0x21'),_0x169589+'-'+_0xdd8858+'/'+_0x218a61)[_0x124f('0x22')](_0x3d52f7);}return null;};}function patchUpdates(_0x24c84c){return function(_0x210784){try{jsonpatch[_0x124f('0x23')](_0x210784,_0x24c84c,!![]);}catch(_0x20d00b){return BPromise[_0x124f('0x24')](_0x20d00b);}return _0x210784['save']();};}function saveUpdates(_0x39c9bd,_0x5c778f){return function(_0x45f9c6){if(_0x45f9c6){return _0x45f9c6[_0x124f('0x25')](_0x39c9bd)[_0x124f('0x26')](function(_0x391e93){return _0x391e93;});}return null;};}function removeEntity(_0x262c0a,_0x1f5841){return function(_0x1480cd){if(_0x1480cd){return _0x1480cd[_0x124f('0x27')]()[_0x124f('0x26')](function(){_0x262c0a[_0x124f('0x1a')](0xcc)[_0x124f('0x1b')]();});}};}function handleEntityNotFound(_0x28d4a0,_0x1c2045){return function(_0x2dc2c7){if(!_0x2dc2c7){_0x28d4a0[_0x124f('0x19')](0x194);}return _0x2dc2c7;};}function handleError(_0x1edf2b,_0x47f6de){_0x47f6de=_0x47f6de||0x1f4;return function(_0x444586){logger[_0x124f('0x28')](_0x444586['stack']);if(_0x444586[_0x124f('0x29')]){delete _0x444586[_0x124f('0x29')];}_0x1edf2b[_0x124f('0x1a')](_0x47f6de)[_0x124f('0x2a')](_0x444586);};}exports['index']=function(_0x4b505d,_0xc07f52){var _0x4a63c5={},_0x44dae9={},_0x43fd4a={'count':0x0,'rows':[]};var _0x6d37d4=_[_0x124f('0x2b')](db[_0x124f('0x2c')][_0x124f('0x2d')],function(_0x2b2c59){return{'name':_0x2b2c59[_0x124f('0x2e')],'type':_0x2b2c59[_0x124f('0x2f')]['key']};});_0x44dae9[_0x124f('0x30')]=_[_0x124f('0x2b')](_0x6d37d4,'name');_0x44dae9['query']=_[_0x124f('0x31')](_0x4b505d[_0x124f('0x32')]);_0x44dae9[_0x124f('0x33')]=_[_0x124f('0x34')](_0x44dae9['model'],_0x44dae9[_0x124f('0x32')]);_0x4a63c5[_0x124f('0x35')]=_[_0x124f('0x34')](_0x44dae9['model'],qs[_0x124f('0x36')](_0x4b505d['query'][_0x124f('0x36')]));_0x4a63c5[_0x124f('0x35')]=_0x4a63c5['attributes'][_0x124f('0x37')]?_0x4a63c5[_0x124f('0x35')]:_0x44dae9[_0x124f('0x30')];if(!_0x4b505d[_0x124f('0x32')][_0x124f('0x38')](_0x124f('0x39'))){_0x4a63c5[_0x124f('0x1e')]=qs[_0x124f('0x1e')](_0x4b505d[_0x124f('0x32')][_0x124f('0x1e')]);_0x4a63c5[_0x124f('0x1c')]=qs[_0x124f('0x1c')](_0x4b505d[_0x124f('0x32')]['offset']);}_0x4a63c5[_0x124f('0x3a')]=qs[_0x124f('0x3b')](_0x4b505d[_0x124f('0x32')][_0x124f('0x3b')]);_0x4a63c5['where']=qs[_0x124f('0x33')](_[_0x124f('0x3c')](_0x4b505d['query'],_0x44dae9[_0x124f('0x33')]),_0x6d37d4);if(_0x4b505d[_0x124f('0x32')][_0x124f('0x3d')]){_0x4a63c5[_0x124f('0x3e')]=_['merge'](_0x4a63c5[_0x124f('0x3e')],{'$or':_[_0x124f('0x2b')](_0x6d37d4,function(_0x47e89d){if(_0x47e89d[_0x124f('0x2f')]!==_0x124f('0x3f')){var _0x735d56={};_0x735d56[_0x47e89d['name']]={'$like':'%'+_0x4b505d['query'][_0x124f('0x3d')]+'%'};return _0x735d56;}})});}_0x4a63c5=_[_0x124f('0x40')]({},_0x4a63c5,_0x4b505d['options']);var _0x2afd7f={'where':_0x4a63c5[_0x124f('0x3e')]};return db[_0x124f('0x2c')][_0x124f('0x1f')](_0x2afd7f)[_0x124f('0x26')](function(_0x3c896c){_0x43fd4a[_0x124f('0x1f')]=_0x3c896c;if(_0x4b505d[_0x124f('0x32')]['includeAll']){_0x4a63c5['include']=[{'all':!![]}];}return db[_0x124f('0x2c')][_0x124f('0x41')](_0x4a63c5);})[_0x124f('0x26')](function(_0x2e26b3){_0x43fd4a[_0x124f('0x42')]=_0x2e26b3;return _0x43fd4a;})[_0x124f('0x26')](respondWithFilteredResult(_0xc07f52,_0x4a63c5))[_0x124f('0x43')](handleError(_0xc07f52,null));};exports[_0x124f('0x44')]=function(_0x372a82,_0x521ddd){var _0x259834={'raw':![],'where':{'id':_0x372a82['params']['id']}},_0x41de53={};_0x41de53[_0x124f('0x30')]=_[_0x124f('0x31')](db[_0x124f('0x2c')][_0x124f('0x2d')]);_0x41de53['query']=_[_0x124f('0x31')](_0x372a82[_0x124f('0x32')]);_0x41de53[_0x124f('0x33')]=_[_0x124f('0x34')](_0x41de53[_0x124f('0x30')],_0x41de53[_0x124f('0x32')]);_0x259834['attributes']=_['intersection'](_0x41de53['model'],qs[_0x124f('0x36')](_0x372a82[_0x124f('0x32')]['fields']));_0x259834[_0x124f('0x35')]=_0x259834[_0x124f('0x35')][_0x124f('0x37')]?_0x259834[_0x124f('0x35')]:_0x41de53[_0x124f('0x30')];if(_0x372a82[_0x124f('0x32')][_0x124f('0x45')]){_0x259834[_0x124f('0x46')]=[{'all':!![]}];}_0x259834=_[_0x124f('0x40')]({},_0x259834,_0x372a82['options']);return db['FreshdeskConfiguration'][_0x124f('0x47')](_0x259834)[_0x124f('0x26')](handleEntityNotFound(_0x521ddd,null))['then'](respondWithResult(_0x521ddd,null))[_0x124f('0x43')](handleError(_0x521ddd,null));};exports[_0x124f('0x48')]=function(_0x40aac1,_0x4cd2d1){return db[_0x124f('0x2c')][_0x124f('0x48')](_0x40aac1['body'],{})['then'](respondWithResult(_0x4cd2d1,0xc9))['catch'](handleError(_0x4cd2d1,null));};exports['update']=function(_0x416a0b,_0x29ac3b){if(_0x416a0b['body']['id']){delete _0x416a0b['body']['id'];}return db[_0x124f('0x2c')][_0x124f('0x47')]({'where':{'id':_0x416a0b['params']['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x29ac3b,null))[_0x124f('0x26')](saveUpdates(_0x416a0b['body'],null))[_0x124f('0x26')](respondWithResult(_0x29ac3b,null))[_0x124f('0x43')](handleError(_0x29ac3b,null));};exports[_0x124f('0x27')]=function(_0x7a7ac8,_0x44e7f3){return db[_0x124f('0x2c')][_0x124f('0x47')]({'where':{'id':_0x7a7ac8['params']['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x44e7f3,null))[_0x124f('0x26')](removeEntity(_0x44e7f3,null))[_0x124f('0x43')](handleError(_0x44e7f3,null));};exports[_0x124f('0x49')]=function(_0x3a587a,_0x26c04e,_0x164fe8){var _0x1d00bb={};var _0x2469e0={};var _0x3ffc65;var _0x274f96;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3a587a[_0x124f('0x4a')]['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x26c04e,null))[_0x124f('0x26')](function(_0x13b510){if(_0x13b510){_0x3ffc65=_0x13b510;_0x2469e0[_0x124f('0x30')]=_[_0x124f('0x31')](db[_0x124f('0x4b')][_0x124f('0x2d')]);_0x2469e0[_0x124f('0x32')]=_[_0x124f('0x31')](_0x3a587a[_0x124f('0x32')]);_0x2469e0['filters']=_[_0x124f('0x34')](_0x2469e0[_0x124f('0x30')],_0x2469e0[_0x124f('0x32')]);_0x1d00bb[_0x124f('0x35')]=_[_0x124f('0x34')](_0x2469e0[_0x124f('0x30')],qs[_0x124f('0x36')](_0x3a587a[_0x124f('0x32')][_0x124f('0x36')]));_0x1d00bb[_0x124f('0x35')]=_0x1d00bb['attributes'][_0x124f('0x37')]?_0x1d00bb[_0x124f('0x35')]:_0x2469e0['model'];_0x1d00bb[_0x124f('0x3a')]=qs['sort'](_0x3a587a['query'][_0x124f('0x3b')]);_0x1d00bb[_0x124f('0x3e')]=qs['filters'](_[_0x124f('0x3c')](_0x3a587a[_0x124f('0x32')],_0x2469e0['filters']));if(_0x3a587a[_0x124f('0x32')]['filter']){_0x1d00bb[_0x124f('0x3e')]=_[_0x124f('0x40')](_0x1d00bb[_0x124f('0x3e')],{'$or':_['map'](_0x1d00bb[_0x124f('0x35')],function(_0x2dc322){var _0x689675={};_0x689675[_0x2dc322]={'$like':'%'+_0x3a587a['query'][_0x124f('0x3d')]+'%'};return _0x689675;})});}_0x1d00bb=_[_0x124f('0x40')]({},_0x1d00bb,_0x3a587a[_0x124f('0x4c')]);return _0x3ffc65['getFields'](_0x1d00bb);}})[_0x124f('0x26')](function(_0x57a1d0){if(_0x57a1d0){_0x274f96=_0x57a1d0[_0x124f('0x37')];if(!_0x3a587a[_0x124f('0x32')]['hasOwnProperty'](_0x124f('0x39'))){_0x1d00bb[_0x124f('0x1e')]=qs['limit'](_0x3a587a[_0x124f('0x32')][_0x124f('0x1e')]);_0x1d00bb['offset']=qs['offset'](_0x3a587a[_0x124f('0x32')][_0x124f('0x1c')]);}return _0x3ffc65[_0x124f('0x49')](_0x1d00bb);}})[_0x124f('0x26')](function(_0x35aeda){if(_0x35aeda){return _0x35aeda?{'count':_0x274f96,'rows':_0x35aeda}:null;}})[_0x124f('0x26')](respondWithResult(_0x26c04e,null))['catch'](handleError(_0x26c04e,null));};exports['getSubjects']=function(_0x16a16f,_0x2b04d8,_0x4900c7){var _0x10a572={};var _0x120aa7={};var _0x231ca9;var _0x420f91;return db[_0x124f('0x2c')][_0x124f('0x4d')]({'where':{'id':_0x16a16f[_0x124f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2b04d8,null))[_0x124f('0x26')](function(_0x4a162a){if(_0x4a162a){_0x231ca9=_0x4a162a;_0x120aa7[_0x124f('0x30')]=_[_0x124f('0x31')](db[_0x124f('0x4b')][_0x124f('0x2d')]);_0x120aa7['query']=_[_0x124f('0x31')](_0x16a16f[_0x124f('0x32')]);_0x120aa7[_0x124f('0x33')]=_['intersection'](_0x120aa7[_0x124f('0x30')],_0x120aa7[_0x124f('0x32')]);_0x10a572['attributes']=_[_0x124f('0x34')](_0x120aa7[_0x124f('0x30')],qs[_0x124f('0x36')](_0x16a16f[_0x124f('0x32')][_0x124f('0x36')]));_0x10a572[_0x124f('0x35')]=_0x10a572[_0x124f('0x35')][_0x124f('0x37')]?_0x10a572[_0x124f('0x35')]:_0x120aa7['model'];_0x10a572[_0x124f('0x3a')]=qs[_0x124f('0x3b')](_0x16a16f[_0x124f('0x32')][_0x124f('0x3b')]);_0x10a572[_0x124f('0x3e')]=qs['filters'](_['pick'](_0x16a16f['query'],_0x120aa7[_0x124f('0x33')]));if(_0x16a16f[_0x124f('0x32')][_0x124f('0x3d')]){_0x10a572[_0x124f('0x3e')]=_['merge'](_0x10a572[_0x124f('0x3e')],{'$or':_[_0x124f('0x2b')](_0x10a572['attributes'],function(_0x2da015){var _0x100d76={};_0x100d76[_0x2da015]={'$like':'%'+_0x16a16f[_0x124f('0x32')]['filter']+'%'};return _0x100d76;})});}_0x10a572=_['merge']({},_0x10a572,_0x16a16f['options']);return _0x231ca9[_0x124f('0x4e')](_0x10a572);}})[_0x124f('0x26')](function(_0x4699de){if(_0x4699de){_0x420f91=_0x4699de[_0x124f('0x37')];if(!_0x16a16f[_0x124f('0x32')]['hasOwnProperty'](_0x124f('0x39'))){_0x10a572['limit']=qs[_0x124f('0x1e')](_0x16a16f[_0x124f('0x32')][_0x124f('0x1e')]);_0x10a572[_0x124f('0x1c')]=qs['offset'](_0x16a16f[_0x124f('0x32')][_0x124f('0x1c')]);}return _0x231ca9[_0x124f('0x4e')](_0x10a572);}})[_0x124f('0x26')](function(_0x2a5831){if(_0x2a5831){return _0x2a5831?{'count':_0x420f91,'rows':_0x2a5831}:null;}})[_0x124f('0x26')](respondWithResult(_0x2b04d8,null))[_0x124f('0x43')](handleError(_0x2b04d8,null));};exports[_0x124f('0x4f')]=function(_0x208559,_0x45179f,_0x53fd82){var _0x392c4c={};var _0x479870={};var _0x3c8f10;var _0x2b6e46;return db['FreshdeskConfiguration'][_0x124f('0x4d')]({'where':{'id':_0x208559['params']['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x45179f,null))[_0x124f('0x26')](function(_0x346720){if(_0x346720){_0x3c8f10=_0x346720;_0x479870[_0x124f('0x30')]=_[_0x124f('0x31')](db[_0x124f('0x4b')][_0x124f('0x2d')]);_0x479870['query']=_[_0x124f('0x31')](_0x208559['query']);_0x479870[_0x124f('0x33')]=_[_0x124f('0x34')](_0x479870['model'],_0x479870[_0x124f('0x32')]);_0x392c4c[_0x124f('0x35')]=_[_0x124f('0x34')](_0x479870[_0x124f('0x30')],qs[_0x124f('0x36')](_0x208559[_0x124f('0x32')][_0x124f('0x36')]));_0x392c4c['attributes']=_0x392c4c['attributes'][_0x124f('0x37')]?_0x392c4c[_0x124f('0x35')]:_0x479870[_0x124f('0x30')];_0x392c4c[_0x124f('0x3a')]=qs[_0x124f('0x3b')](_0x208559['query'][_0x124f('0x3b')]);_0x392c4c[_0x124f('0x3e')]=qs[_0x124f('0x33')](_[_0x124f('0x3c')](_0x208559[_0x124f('0x32')],_0x479870[_0x124f('0x33')]));if(_0x208559[_0x124f('0x32')]['filter']){_0x392c4c['where']=_[_0x124f('0x40')](_0x392c4c['where'],{'$or':_[_0x124f('0x2b')](_0x392c4c[_0x124f('0x35')],function(_0x11fac1){var _0x140c6b={};_0x140c6b[_0x11fac1]={'$like':'%'+_0x208559['query'][_0x124f('0x3d')]+'%'};return _0x140c6b;})});}_0x392c4c=_[_0x124f('0x40')]({},_0x392c4c,_0x208559['options']);return _0x3c8f10['getDescriptions'](_0x392c4c);}})['then'](function(_0x1dd6f3){if(_0x1dd6f3){_0x2b6e46=_0x1dd6f3['length'];if(!_0x208559['query'][_0x124f('0x38')](_0x124f('0x39'))){_0x392c4c[_0x124f('0x1e')]=qs[_0x124f('0x1e')](_0x208559[_0x124f('0x32')]['limit']);_0x392c4c[_0x124f('0x1c')]=qs[_0x124f('0x1c')](_0x208559[_0x124f('0x32')][_0x124f('0x1c')]);}return _0x3c8f10['getDescriptions'](_0x392c4c);}})[_0x124f('0x26')](function(_0x2cf276){if(_0x2cf276){return _0x2cf276?{'count':_0x2b6e46,'rows':_0x2cf276}:null;}})[_0x124f('0x26')](respondWithResult(_0x45179f,null))[_0x124f('0x43')](handleError(_0x45179f,null));};exports[_0x124f('0x50')]=function(_0x3c46d5,_0x20dff0,_0x3333f3){var _0x18ab69={};var _0x3fe471={};var _0x33ceb3;var _0xfce301;return db[_0x124f('0x2c')][_0x124f('0x4d')]({'where':{'id':_0x3c46d5['params']['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x20dff0,null))[_0x124f('0x26')](function(_0x320162){if(_0x320162){_0x33ceb3=_0x320162;_0x3fe471['model']=_[_0x124f('0x31')](db['Tag'][_0x124f('0x2d')]);_0x3fe471['query']=_['keys'](_0x3c46d5[_0x124f('0x32')]);_0x3fe471['filters']=_['intersection'](_0x3fe471[_0x124f('0x30')],_0x3fe471['query']);_0x18ab69[_0x124f('0x35')]=_[_0x124f('0x34')](_0x3fe471[_0x124f('0x30')],qs[_0x124f('0x36')](_0x3c46d5['query'][_0x124f('0x36')]));_0x18ab69[_0x124f('0x35')]=_0x18ab69[_0x124f('0x35')]['length']?_0x18ab69[_0x124f('0x35')]:_0x3fe471[_0x124f('0x30')];_0x18ab69[_0x124f('0x3a')]=qs[_0x124f('0x3b')](_0x3c46d5['query'][_0x124f('0x3b')]);_0x18ab69[_0x124f('0x3e')]=qs[_0x124f('0x33')](_[_0x124f('0x3c')](_0x3c46d5[_0x124f('0x32')],_0x3fe471['filters']));if(_0x3c46d5[_0x124f('0x32')][_0x124f('0x3d')]){_0x18ab69['where']=_[_0x124f('0x40')](_0x18ab69[_0x124f('0x3e')],{'$or':_[_0x124f('0x2b')](_0x18ab69[_0x124f('0x35')],function(_0x4a1813){var _0x3dba91={};_0x3dba91[_0x4a1813]={'$like':'%'+_0x3c46d5[_0x124f('0x32')][_0x124f('0x3d')]+'%'};return _0x3dba91;})});}_0x18ab69=_[_0x124f('0x40')]({},_0x18ab69,_0x3c46d5[_0x124f('0x4c')]);return _0x33ceb3[_0x124f('0x50')](_0x18ab69);}})[_0x124f('0x26')](function(_0x35df07){if(_0x35df07){_0xfce301=_0x35df07[_0x124f('0x37')];if(!_0x3c46d5[_0x124f('0x32')][_0x124f('0x38')](_0x124f('0x39'))){_0x18ab69[_0x124f('0x1e')]=qs[_0x124f('0x1e')](_0x3c46d5[_0x124f('0x32')][_0x124f('0x1e')]);_0x18ab69[_0x124f('0x1c')]=qs[_0x124f('0x1c')](_0x3c46d5[_0x124f('0x32')][_0x124f('0x1c')]);}return _0x33ceb3[_0x124f('0x50')](_0x18ab69);}})['then'](function(_0x4b72cf){if(_0x4b72cf){return _0x4b72cf?{'count':_0xfce301,'rows':_0x4b72cf}:null;}})[_0x124f('0x26')](respondWithResult(_0x20dff0,null))[_0x124f('0x43')](handleError(_0x20dff0,null));};exports[_0x124f('0x51')]=function(_0x4f9f4a,_0x1b7843,_0x569b57){if(_0x4f9f4a[_0x124f('0x52')]['id']){delete _0x4f9f4a[_0x124f('0x52')]['id'];}return db['FreshdeskConfiguration'][_0x124f('0x4d')]({'where':{'id':_0x4f9f4a[_0x124f('0x4a')]['id']}})[_0x124f('0x26')](handleEntityNotFound(_0x1b7843,null))[_0x124f('0x26')](function(_0x56cd7d){if(_0x56cd7d){return _0x56cd7d[_0x124f('0x51')](_0x4f9f4a[_0x124f('0x52')][_0x124f('0x53')]||[]);}return null;})[_0x124f('0x26')](respondWithResult(_0x1b7843,null))[_0x124f('0x43')](handleError(_0x1b7843,null));}; \ No newline at end of file +var _0xb8cf=['count','Content-Range','reject','save','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','catch','show','params','find','create','body','update','getFields','FreshdeskField','order','hasOwnProperty','findOne','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb8cf,0x12e));var _0xfb8c=function(_0x5d34ca,_0x284212){_0x5d34ca=_0x5d34ca-0x0;var _0x5ab023=_0xb8cf[_0x5d34ca];return _0x5ab023;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfb8c('0x0'));var jsonpatch=require(_0xfb8c('0x1'));var rp=require('request-promise');var moment=require(_0xfb8c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfb8c('0x3'));var util=require(_0xfb8c('0x4'));var path=require(_0xfb8c('0x5'));var sox=require(_0xfb8c('0x6'));var csv=require(_0xfb8c('0x7'));var ejs=require(_0xfb8c('0x8'));var fs=require('fs');var fs_extra=require(_0xfb8c('0x9'));var _=require(_0xfb8c('0xa'));var squel=require(_0xfb8c('0xb'));var crypto=require(_0xfb8c('0xc'));var jsforce=require(_0xfb8c('0xd'));var deskjs=require(_0xfb8c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfb8c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfb8c('0x10'));var as=require(_0xfb8c('0x11'));var hardwareService=require(_0xfb8c('0x12'));var logger=require(_0xfb8c('0x13'))(_0xfb8c('0x14'));var utils=require('../../config/utils');var config=require(_0xfb8c('0x15'));var licenseUtil=require(_0xfb8c('0x16'));var db=require(_0xfb8c('0x17'))['db'];function respondWithStatusCode(_0x3a2dd3,_0x40c19a){_0x40c19a=_0x40c19a||0xcc;return function(_0x5b8512){if(_0x5b8512){return _0x3a2dd3['sendStatus'](_0x40c19a);}return _0x3a2dd3['status'](_0x40c19a)[_0xfb8c('0x18')]();};}function respondWithResult(_0x4248f2,_0x4ad481){_0x4ad481=_0x4ad481||0xc8;return function(_0xd79272){if(_0xd79272){return _0x4248f2[_0xfb8c('0x19')](_0x4ad481)[_0xfb8c('0x1a')](_0xd79272);}};}function respondWithFilteredResult(_0x339654,_0x585fb6){return function(_0x4bb922){if(_0x4bb922){var _0x29792f=typeof _0x585fb6[_0xfb8c('0x1b')]===_0xfb8c('0x1c')&&typeof _0x585fb6[_0xfb8c('0x1d')]===_0xfb8c('0x1c');var _0x4b867d=_0x4bb922[_0xfb8c('0x1e')];var _0x37677d=_0x29792f?0x0:_0x585fb6[_0xfb8c('0x1b')];var _0x5290db=_0x29792f?_0x4bb922[_0xfb8c('0x1e')]:_0x585fb6['offset']+_0x585fb6['limit'];var _0x4ab3b6;if(_0x5290db>=_0x4b867d){_0x5290db=_0x4b867d;_0x4ab3b6=0xc8;}else{_0x4ab3b6=0xce;}_0x339654['status'](_0x4ab3b6);return _0x339654['set'](_0xfb8c('0x1f'),_0x37677d+'-'+_0x5290db+'/'+_0x4b867d)[_0xfb8c('0x1a')](_0x4bb922);}return null;};}function patchUpdates(_0xbe49f0){return function(_0x63c7ed){try{jsonpatch['apply'](_0x63c7ed,_0xbe49f0,!![]);}catch(_0x43bee8){return BPromise[_0xfb8c('0x20')](_0x43bee8);}return _0x63c7ed[_0xfb8c('0x21')]();};}function saveUpdates(_0x24c41e,_0x3fc5d3){return function(_0x548d9f){if(_0x548d9f){return _0x548d9f['update'](_0x24c41e)[_0xfb8c('0x22')](function(_0x49a306){return _0x49a306;});}return null;};}function removeEntity(_0x47a86a,_0x4de150){return function(_0x561b49){if(_0x561b49){return _0x561b49[_0xfb8c('0x23')]()[_0xfb8c('0x22')](function(){_0x47a86a[_0xfb8c('0x19')](0xcc)[_0xfb8c('0x18')]();});}};}function handleEntityNotFound(_0x4685d4,_0x22c844){return function(_0x391bba){if(!_0x391bba){_0x4685d4[_0xfb8c('0x24')](0x194);}return _0x391bba;};}function handleError(_0x451a82,_0xf39828){_0xf39828=_0xf39828||0x1f4;return function(_0x5ca458){logger[_0xfb8c('0x25')](_0x5ca458['stack']);if(_0x5ca458['name']){delete _0x5ca458[_0xfb8c('0x26')];}_0x451a82[_0xfb8c('0x19')](_0xf39828)[_0xfb8c('0x27')](_0x5ca458);};}exports[_0xfb8c('0x28')]=function(_0x164ec0,_0x590879){var _0xaef37e={},_0x4611c6={},_0xda20be={'count':0x0,'rows':[]};var _0x30db53=_[_0xfb8c('0x29')](db['FreshdeskConfiguration'][_0xfb8c('0x2a')],function(_0x11a62c){return{'name':_0x11a62c[_0xfb8c('0x2b')],'type':_0x11a62c['type']['key']};});_0x4611c6[_0xfb8c('0x2c')]=_[_0xfb8c('0x29')](_0x30db53,_0xfb8c('0x26'));_0x4611c6[_0xfb8c('0x2d')]=_[_0xfb8c('0x2e')](_0x164ec0[_0xfb8c('0x2d')]);_0x4611c6[_0xfb8c('0x2f')]=_[_0xfb8c('0x30')](_0x4611c6['model'],_0x4611c6[_0xfb8c('0x2d')]);_0xaef37e[_0xfb8c('0x31')]=_[_0xfb8c('0x30')](_0x4611c6['model'],qs[_0xfb8c('0x32')](_0x164ec0[_0xfb8c('0x2d')]['fields']));_0xaef37e[_0xfb8c('0x31')]=_0xaef37e[_0xfb8c('0x31')][_0xfb8c('0x33')]?_0xaef37e[_0xfb8c('0x31')]:_0x4611c6[_0xfb8c('0x2c')];if(!_0x164ec0[_0xfb8c('0x2d')]['hasOwnProperty']('nolimit')){_0xaef37e[_0xfb8c('0x1d')]=qs[_0xfb8c('0x1d')](_0x164ec0[_0xfb8c('0x2d')][_0xfb8c('0x1d')]);_0xaef37e[_0xfb8c('0x1b')]=qs[_0xfb8c('0x1b')](_0x164ec0[_0xfb8c('0x2d')][_0xfb8c('0x1b')]);}_0xaef37e['order']=qs[_0xfb8c('0x34')](_0x164ec0[_0xfb8c('0x2d')][_0xfb8c('0x34')]);_0xaef37e[_0xfb8c('0x35')]=qs['filters'](_[_0xfb8c('0x36')](_0x164ec0[_0xfb8c('0x2d')],_0x4611c6['filters']),_0x30db53);if(_0x164ec0[_0xfb8c('0x2d')][_0xfb8c('0x37')]){_0xaef37e['where']=_[_0xfb8c('0x38')](_0xaef37e[_0xfb8c('0x35')],{'$or':_['map'](_0x30db53,function(_0x911d4b){if(_0x911d4b[_0xfb8c('0x39')]!==_0xfb8c('0x3a')){var _0x1f7dba={};_0x1f7dba[_0x911d4b[_0xfb8c('0x26')]]={'$like':'%'+_0x164ec0[_0xfb8c('0x2d')][_0xfb8c('0x37')]+'%'};return _0x1f7dba;}})});}_0xaef37e=_[_0xfb8c('0x38')]({},_0xaef37e,_0x164ec0[_0xfb8c('0x3b')]);var _0x3ad227={'where':_0xaef37e[_0xfb8c('0x35')]};return db[_0xfb8c('0x3c')][_0xfb8c('0x1e')](_0x3ad227)[_0xfb8c('0x22')](function(_0x29f58c){_0xda20be[_0xfb8c('0x1e')]=_0x29f58c;if(_0x164ec0['query'][_0xfb8c('0x3d')]){_0xaef37e[_0xfb8c('0x3e')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xfb8c('0x3f')](_0xaef37e);})['then'](function(_0x177f28){_0xda20be['rows']=_0x177f28;return _0xda20be;})[_0xfb8c('0x22')](respondWithFilteredResult(_0x590879,_0xaef37e))[_0xfb8c('0x40')](handleError(_0x590879,null));};exports[_0xfb8c('0x41')]=function(_0x15babe,_0x38eb6b){var _0x1dd138={'raw':![],'where':{'id':_0x15babe[_0xfb8c('0x42')]['id']}},_0x512dde={};_0x512dde[_0xfb8c('0x2c')]=_[_0xfb8c('0x2e')](db['FreshdeskConfiguration'][_0xfb8c('0x2a')]);_0x512dde[_0xfb8c('0x2d')]=_[_0xfb8c('0x2e')](_0x15babe['query']);_0x512dde['filters']=_['intersection'](_0x512dde[_0xfb8c('0x2c')],_0x512dde[_0xfb8c('0x2d')]);_0x1dd138['attributes']=_[_0xfb8c('0x30')](_0x512dde[_0xfb8c('0x2c')],qs[_0xfb8c('0x32')](_0x15babe[_0xfb8c('0x2d')]['fields']));_0x1dd138[_0xfb8c('0x31')]=_0x1dd138[_0xfb8c('0x31')][_0xfb8c('0x33')]?_0x1dd138['attributes']:_0x512dde[_0xfb8c('0x2c')];if(_0x15babe[_0xfb8c('0x2d')][_0xfb8c('0x3d')]){_0x1dd138['include']=[{'all':!![]}];}_0x1dd138=_[_0xfb8c('0x38')]({},_0x1dd138,_0x15babe[_0xfb8c('0x3b')]);return db[_0xfb8c('0x3c')][_0xfb8c('0x43')](_0x1dd138)[_0xfb8c('0x22')](handleEntityNotFound(_0x38eb6b,null))[_0xfb8c('0x22')](respondWithResult(_0x38eb6b,null))['catch'](handleError(_0x38eb6b,null));};exports[_0xfb8c('0x44')]=function(_0x10e447,_0x54ed95){return db[_0xfb8c('0x3c')][_0xfb8c('0x44')](_0x10e447[_0xfb8c('0x45')],{})[_0xfb8c('0x22')](respondWithResult(_0x54ed95,0xc9))[_0xfb8c('0x40')](handleError(_0x54ed95,null));};exports[_0xfb8c('0x46')]=function(_0x2f88e1,_0x41d48e){if(_0x2f88e1[_0xfb8c('0x45')]['id']){delete _0x2f88e1[_0xfb8c('0x45')]['id'];}return db[_0xfb8c('0x3c')][_0xfb8c('0x43')]({'where':{'id':_0x2f88e1[_0xfb8c('0x42')]['id']}})[_0xfb8c('0x22')](handleEntityNotFound(_0x41d48e,null))[_0xfb8c('0x22')](saveUpdates(_0x2f88e1[_0xfb8c('0x45')],null))['then'](respondWithResult(_0x41d48e,null))[_0xfb8c('0x40')](handleError(_0x41d48e,null));};exports[_0xfb8c('0x23')]=function(_0x100ce,_0x43fa85){return db[_0xfb8c('0x3c')][_0xfb8c('0x43')]({'where':{'id':_0x100ce['params']['id']}})[_0xfb8c('0x22')](handleEntityNotFound(_0x43fa85,null))[_0xfb8c('0x22')](removeEntity(_0x43fa85,null))[_0xfb8c('0x40')](handleError(_0x43fa85,null));};exports[_0xfb8c('0x47')]=function(_0x58bf6f,_0x31f889,_0x52b45b){var _0x219852={};var _0x42a978={};var _0x19acd0;var _0x3aa5ae;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x58bf6f[_0xfb8c('0x42')]['id']}})[_0xfb8c('0x22')](handleEntityNotFound(_0x31f889,null))['then'](function(_0x40f157){if(_0x40f157){_0x19acd0=_0x40f157;_0x42a978[_0xfb8c('0x2c')]=_[_0xfb8c('0x2e')](db[_0xfb8c('0x48')][_0xfb8c('0x2a')]);_0x42a978['query']=_[_0xfb8c('0x2e')](_0x58bf6f[_0xfb8c('0x2d')]);_0x42a978[_0xfb8c('0x2f')]=_[_0xfb8c('0x30')](_0x42a978[_0xfb8c('0x2c')],_0x42a978[_0xfb8c('0x2d')]);_0x219852[_0xfb8c('0x31')]=_[_0xfb8c('0x30')](_0x42a978[_0xfb8c('0x2c')],qs['fields'](_0x58bf6f[_0xfb8c('0x2d')][_0xfb8c('0x32')]));_0x219852[_0xfb8c('0x31')]=_0x219852['attributes'][_0xfb8c('0x33')]?_0x219852['attributes']:_0x42a978['model'];_0x219852[_0xfb8c('0x49')]=qs[_0xfb8c('0x34')](_0x58bf6f[_0xfb8c('0x2d')][_0xfb8c('0x34')]);_0x219852[_0xfb8c('0x35')]=qs[_0xfb8c('0x2f')](_[_0xfb8c('0x36')](_0x58bf6f['query'],_0x42a978[_0xfb8c('0x2f')]));if(_0x58bf6f[_0xfb8c('0x2d')][_0xfb8c('0x37')]){_0x219852[_0xfb8c('0x35')]=_['merge'](_0x219852['where'],{'$or':_[_0xfb8c('0x29')](_0x219852['attributes'],function(_0x38368c){var _0x133c07={};_0x133c07[_0x38368c]={'$like':'%'+_0x58bf6f[_0xfb8c('0x2d')]['filter']+'%'};return _0x133c07;})});}_0x219852=_[_0xfb8c('0x38')]({},_0x219852,_0x58bf6f[_0xfb8c('0x3b')]);return _0x19acd0[_0xfb8c('0x47')](_0x219852);}})[_0xfb8c('0x22')](function(_0x2170b5){if(_0x2170b5){_0x3aa5ae=_0x2170b5[_0xfb8c('0x33')];if(!_0x58bf6f[_0xfb8c('0x2d')][_0xfb8c('0x4a')]('nolimit')){_0x219852[_0xfb8c('0x1d')]=qs[_0xfb8c('0x1d')](_0x58bf6f['query'][_0xfb8c('0x1d')]);_0x219852[_0xfb8c('0x1b')]=qs[_0xfb8c('0x1b')](_0x58bf6f[_0xfb8c('0x2d')][_0xfb8c('0x1b')]);}return _0x19acd0['getFields'](_0x219852);}})[_0xfb8c('0x22')](function(_0x44c6c2){if(_0x44c6c2){return _0x44c6c2?{'count':_0x3aa5ae,'rows':_0x44c6c2}:null;}})[_0xfb8c('0x22')](respondWithResult(_0x31f889,null))[_0xfb8c('0x40')](handleError(_0x31f889,null));};exports['getSubjects']=function(_0x23d0dd,_0x755aa5,_0x202108){var _0x54b6ab={};var _0x51442b={};var _0x3feb62;var _0x59d568;return db[_0xfb8c('0x3c')][_0xfb8c('0x4b')]({'where':{'id':_0x23d0dd[_0xfb8c('0x42')]['id']}})[_0xfb8c('0x22')](handleEntityNotFound(_0x755aa5,null))[_0xfb8c('0x22')](function(_0xd5ec3f){if(_0xd5ec3f){_0x3feb62=_0xd5ec3f;_0x51442b[_0xfb8c('0x2c')]=_['keys'](db['FreshdeskField'][_0xfb8c('0x2a')]);_0x51442b[_0xfb8c('0x2d')]=_[_0xfb8c('0x2e')](_0x23d0dd['query']);_0x51442b[_0xfb8c('0x2f')]=_[_0xfb8c('0x30')](_0x51442b['model'],_0x51442b[_0xfb8c('0x2d')]);_0x54b6ab['attributes']=_[_0xfb8c('0x30')](_0x51442b[_0xfb8c('0x2c')],qs[_0xfb8c('0x32')](_0x23d0dd[_0xfb8c('0x2d')]['fields']));_0x54b6ab[_0xfb8c('0x31')]=_0x54b6ab['attributes']['length']?_0x54b6ab[_0xfb8c('0x31')]:_0x51442b[_0xfb8c('0x2c')];_0x54b6ab[_0xfb8c('0x49')]=qs[_0xfb8c('0x34')](_0x23d0dd['query'][_0xfb8c('0x34')]);_0x54b6ab[_0xfb8c('0x35')]=qs[_0xfb8c('0x2f')](_[_0xfb8c('0x36')](_0x23d0dd[_0xfb8c('0x2d')],_0x51442b['filters']));if(_0x23d0dd[_0xfb8c('0x2d')][_0xfb8c('0x37')]){_0x54b6ab['where']=_['merge'](_0x54b6ab['where'],{'$or':_['map'](_0x54b6ab[_0xfb8c('0x31')],function(_0x19250e){var _0x13b5d4={};_0x13b5d4[_0x19250e]={'$like':'%'+_0x23d0dd[_0xfb8c('0x2d')][_0xfb8c('0x37')]+'%'};return _0x13b5d4;})});}_0x54b6ab=_['merge']({},_0x54b6ab,_0x23d0dd['options']);return _0x3feb62[_0xfb8c('0x4c')](_0x54b6ab);}})[_0xfb8c('0x22')](function(_0x1e600f){if(_0x1e600f){_0x59d568=_0x1e600f[_0xfb8c('0x33')];if(!_0x23d0dd[_0xfb8c('0x2d')][_0xfb8c('0x4a')](_0xfb8c('0x4d'))){_0x54b6ab[_0xfb8c('0x1d')]=qs[_0xfb8c('0x1d')](_0x23d0dd[_0xfb8c('0x2d')][_0xfb8c('0x1d')]);_0x54b6ab[_0xfb8c('0x1b')]=qs[_0xfb8c('0x1b')](_0x23d0dd[_0xfb8c('0x2d')]['offset']);}return _0x3feb62['getSubjects'](_0x54b6ab);}})[_0xfb8c('0x22')](function(_0x4fc66c){if(_0x4fc66c){return _0x4fc66c?{'count':_0x59d568,'rows':_0x4fc66c}:null;}})[_0xfb8c('0x22')](respondWithResult(_0x755aa5,null))[_0xfb8c('0x40')](handleError(_0x755aa5,null));};exports[_0xfb8c('0x4e')]=function(_0x4c6526,_0x405052,_0x3fda73){var _0x3881c1={};var _0x36f0e0={};var _0x5838db;var _0x516a57;return db['FreshdeskConfiguration'][_0xfb8c('0x4b')]({'where':{'id':_0x4c6526[_0xfb8c('0x42')]['id']}})['then'](handleEntityNotFound(_0x405052,null))[_0xfb8c('0x22')](function(_0x28b31f){if(_0x28b31f){_0x5838db=_0x28b31f;_0x36f0e0[_0xfb8c('0x2c')]=_[_0xfb8c('0x2e')](db[_0xfb8c('0x48')]['rawAttributes']);_0x36f0e0[_0xfb8c('0x2d')]=_['keys'](_0x4c6526[_0xfb8c('0x2d')]);_0x36f0e0[_0xfb8c('0x2f')]=_['intersection'](_0x36f0e0['model'],_0x36f0e0[_0xfb8c('0x2d')]);_0x3881c1[_0xfb8c('0x31')]=_['intersection'](_0x36f0e0[_0xfb8c('0x2c')],qs['fields'](_0x4c6526[_0xfb8c('0x2d')][_0xfb8c('0x32')]));_0x3881c1['attributes']=_0x3881c1[_0xfb8c('0x31')]['length']?_0x3881c1[_0xfb8c('0x31')]:_0x36f0e0[_0xfb8c('0x2c')];_0x3881c1[_0xfb8c('0x49')]=qs['sort'](_0x4c6526['query'][_0xfb8c('0x34')]);_0x3881c1['where']=qs[_0xfb8c('0x2f')](_[_0xfb8c('0x36')](_0x4c6526[_0xfb8c('0x2d')],_0x36f0e0['filters']));if(_0x4c6526[_0xfb8c('0x2d')][_0xfb8c('0x37')]){_0x3881c1[_0xfb8c('0x35')]=_[_0xfb8c('0x38')](_0x3881c1[_0xfb8c('0x35')],{'$or':_[_0xfb8c('0x29')](_0x3881c1['attributes'],function(_0x6b7224){var _0x3aa7fb={};_0x3aa7fb[_0x6b7224]={'$like':'%'+_0x4c6526[_0xfb8c('0x2d')]['filter']+'%'};return _0x3aa7fb;})});}_0x3881c1=_[_0xfb8c('0x38')]({},_0x3881c1,_0x4c6526[_0xfb8c('0x3b')]);return _0x5838db[_0xfb8c('0x4e')](_0x3881c1);}})[_0xfb8c('0x22')](function(_0x5baa52){if(_0x5baa52){_0x516a57=_0x5baa52[_0xfb8c('0x33')];if(!_0x4c6526[_0xfb8c('0x2d')]['hasOwnProperty'](_0xfb8c('0x4d'))){_0x3881c1[_0xfb8c('0x1d')]=qs[_0xfb8c('0x1d')](_0x4c6526[_0xfb8c('0x2d')][_0xfb8c('0x1d')]);_0x3881c1[_0xfb8c('0x1b')]=qs[_0xfb8c('0x1b')](_0x4c6526[_0xfb8c('0x2d')][_0xfb8c('0x1b')]);}return _0x5838db[_0xfb8c('0x4e')](_0x3881c1);}})['then'](function(_0xb09873){if(_0xb09873){return _0xb09873?{'count':_0x516a57,'rows':_0xb09873}:null;}})[_0xfb8c('0x22')](respondWithResult(_0x405052,null))[_0xfb8c('0x40')](handleError(_0x405052,null));};exports[_0xfb8c('0x4f')]=function(_0x3c568b,_0x3c5462,_0x1872ef){var _0x1fdc33={};var _0x24e0cc={};var _0x2098cc;var _0x249dee;return db[_0xfb8c('0x3c')][_0xfb8c('0x4b')]({'where':{'id':_0x3c568b[_0xfb8c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c5462,null))['then'](function(_0x4a34a6){if(_0x4a34a6){_0x2098cc=_0x4a34a6;_0x24e0cc[_0xfb8c('0x2c')]=_['keys'](db[_0xfb8c('0x50')][_0xfb8c('0x2a')]);_0x24e0cc[_0xfb8c('0x2d')]=_[_0xfb8c('0x2e')](_0x3c568b[_0xfb8c('0x2d')]);_0x24e0cc['filters']=_['intersection'](_0x24e0cc[_0xfb8c('0x2c')],_0x24e0cc[_0xfb8c('0x2d')]);_0x1fdc33[_0xfb8c('0x31')]=_[_0xfb8c('0x30')](_0x24e0cc[_0xfb8c('0x2c')],qs['fields'](_0x3c568b[_0xfb8c('0x2d')][_0xfb8c('0x32')]));_0x1fdc33['attributes']=_0x1fdc33['attributes']['length']?_0x1fdc33[_0xfb8c('0x31')]:_0x24e0cc[_0xfb8c('0x2c')];_0x1fdc33['order']=qs[_0xfb8c('0x34')](_0x3c568b[_0xfb8c('0x2d')][_0xfb8c('0x34')]);_0x1fdc33[_0xfb8c('0x35')]=qs[_0xfb8c('0x2f')](_['pick'](_0x3c568b[_0xfb8c('0x2d')],_0x24e0cc['filters']));if(_0x3c568b[_0xfb8c('0x2d')][_0xfb8c('0x37')]){_0x1fdc33[_0xfb8c('0x35')]=_[_0xfb8c('0x38')](_0x1fdc33[_0xfb8c('0x35')],{'$or':_['map'](_0x1fdc33['attributes'],function(_0x139ff2){var _0x4e2bdc={};_0x4e2bdc[_0x139ff2]={'$like':'%'+_0x3c568b[_0xfb8c('0x2d')]['filter']+'%'};return _0x4e2bdc;})});}_0x1fdc33=_[_0xfb8c('0x38')]({},_0x1fdc33,_0x3c568b[_0xfb8c('0x3b')]);return _0x2098cc[_0xfb8c('0x4f')](_0x1fdc33);}})[_0xfb8c('0x22')](function(_0x34cbba){if(_0x34cbba){_0x249dee=_0x34cbba['length'];if(!_0x3c568b[_0xfb8c('0x2d')]['hasOwnProperty'](_0xfb8c('0x4d'))){_0x1fdc33[_0xfb8c('0x1d')]=qs[_0xfb8c('0x1d')](_0x3c568b[_0xfb8c('0x2d')][_0xfb8c('0x1d')]);_0x1fdc33[_0xfb8c('0x1b')]=qs[_0xfb8c('0x1b')](_0x3c568b[_0xfb8c('0x2d')][_0xfb8c('0x1b')]);}return _0x2098cc[_0xfb8c('0x4f')](_0x1fdc33);}})[_0xfb8c('0x22')](function(_0x3543aa){if(_0x3543aa){return _0x3543aa?{'count':_0x249dee,'rows':_0x3543aa}:null;}})[_0xfb8c('0x22')](respondWithResult(_0x3c5462,null))['catch'](handleError(_0x3c5462,null));};exports['setTags']=function(_0x5efd23,_0x188074,_0x4a2bd5){if(_0x5efd23['body']['id']){delete _0x5efd23[_0xfb8c('0x45')]['id'];}return db['FreshdeskConfiguration'][_0xfb8c('0x4b')]({'where':{'id':_0x5efd23[_0xfb8c('0x42')]['id']}})[_0xfb8c('0x22')](handleEntityNotFound(_0x188074,null))[_0xfb8c('0x22')](function(_0x169b59){if(_0x169b59){return _0x169b59[_0xfb8c('0x51')](_0x5efd23[_0xfb8c('0x45')][_0xfb8c('0x52')]||[]);}return null;})[_0xfb8c('0x22')](respondWithResult(_0x188074,null))[_0xfb8c('0x40')](handleError(_0x188074,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index bdaa4cb..86eabf3 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 _0x030d=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','lodash'];(function(_0x53009a,_0x58134f){var _0xfd0a1c=function(_0x54f842){while(--_0x54f842){_0x53009a['push'](_0x53009a['shift']());}};_0xfd0a1c(++_0x58134f);}(_0x030d,0xe5));var _0xd030=function(_0x657e65,_0x307cb8){_0x657e65=_0x657e65-0x0;var _0x24c8ea=_0x030d[_0x657e65];return _0x24c8ea;};'use strict';var _=require(_0xd030('0x0'));var util=require(_0xd030('0x1'));var logger=require(_0xd030('0x2'))('api');var moment=require(_0xd030('0x3'));var BPromise=require(_0xd030('0x4'));var rp=require(_0xd030('0x5'));var fs=require('fs');var path=require(_0xd030('0x6'));var rimraf=require(_0xd030('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xd030('0x8')]=function(_0x16fb93,_0x237b88){return _0x16fb93[_0xd030('0x9')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb64=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5603c7,_0xd3c00c){var _0xeed043=function(_0x236b91){while(--_0x236b91){_0x5603c7['push'](_0x5603c7['shift']());}};_0xeed043(++_0xd3c00c);}(_0xdb64,0x164));var _0x4db6=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0xdb64[_0x137d1d];return _0x485108;};'use strict';var _=require(_0x4db6('0x0'));var util=require(_0x4db6('0x1'));var logger=require(_0x4db6('0x2'))(_0x4db6('0x3'));var moment=require(_0x4db6('0x4'));var BPromise=require(_0x4db6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4db6('0x6'));var rimraf=require(_0x4db6('0x7'));var config=require('../../config/environment');var attributes=require(_0x4db6('0x8'));module[_0x4db6('0x9')]=function(_0x25eddd,_0x1a3759){return _0x25eddd[_0x4db6('0xa')](_0x4db6('0xb'),attributes,{'tableName':_0x4db6('0xc'),'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 65f94be..348651c 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 _0xc73e=['lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x350dc6,_0x36ab14){var _0x2e5887=function(_0x5370ad){while(--_0x5370ad){_0x350dc6['push'](_0x350dc6['shift']());}};_0x2e5887(++_0x36ab14);}(_0xc73e,0xfc));var _0xec73=function(_0x2a2872,_0xffc2ea){_0x2a2872=_0x2a2872-0x0;var _0x296369=_0xc73e[_0x2a2872];return _0x296369;};'use strict';var _=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var moment=require(_0xec73('0x2'));var BPromise=require('bluebird');var rs=require(_0xec73('0x3'));var fs=require('fs');var Redis=require(_0xec73('0x4'));var db=require(_0xec73('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xec73('0x6'));var config=require(_0xec73('0x7'));var jayson=require(_0xec73('0x8'));var client=jayson['client'][_0xec73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d7461,_0x4f999a,_0x123fb0){return new BPromise(function(_0x24ee6b,_0x4541f6){return client[_0xec73('0xa')](_0x1d7461,_0x123fb0)['then'](function(_0x19fc09){logger[_0xec73('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f999a,_0xec73('0xc'));logger['debug'](_0xec73('0xd'),_0x4f999a,_0xec73('0xc'),JSON[_0xec73('0xe')](_0x19fc09));if(_0x19fc09['error']){if(_0x19fc09[_0xec73('0xf')][_0xec73('0x10')]===0x1f4){logger['error'](_0xec73('0x11'),_0x4f999a,_0x19fc09[_0xec73('0xf')][_0xec73('0x12')]);return _0x4541f6(_0x19fc09[_0xec73('0xf')][_0xec73('0x12')]);}logger[_0xec73('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f999a,_0x19fc09[_0xec73('0xf')]['message']);return _0x24ee6b(_0x19fc09[_0xec73('0xf')][_0xec73('0x12')]);}else{logger[_0xec73('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f999a,_0xec73('0xc'));_0x24ee6b(_0x19fc09[_0xec73('0x13')][_0xec73('0x12')]);}})[_0xec73('0x14')](function(_0x4aec6d){logger[_0xec73('0xf')](_0xec73('0x11'),_0x4f999a,_0x4aec6d);_0x4541f6(_0x4aec6d);});});} \ No newline at end of file +var _0x4a8b=['jayson/promise','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2c1eb0,_0x246538){var _0x27b11c=function(_0x4926e6){while(--_0x4926e6){_0x2c1eb0['push'](_0x2c1eb0['shift']());}};_0x27b11c(++_0x246538);}(_0x4a8b,0x108));var _0xb4a8=function(_0x54aa73,_0x1a53a5){_0x54aa73=_0x54aa73-0x0;var _0x12e83d=_0x4a8b[_0x54aa73];return _0x12e83d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb4a8('0x0'));var BPromise=require('bluebird');var rs=require(_0xb4a8('0x1'));var fs=require('fs');var Redis=require(_0xb4a8('0x2'));var db=require(_0xb4a8('0x3'))['db'];var utils=require(_0xb4a8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb4a8('0x5'));var jayson=require(_0xb4a8('0x6'));var client=jayson['client'][_0xb4a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x595e52,_0x25c702,_0x27b73d){return new BPromise(function(_0x527007,_0x377401){return client['request'](_0x595e52,_0x27b73d)['then'](function(_0x1ec482){logger[_0xb4a8('0x8')](_0xb4a8('0x9'),_0x25c702,_0xb4a8('0xa'));logger[_0xb4a8('0xb')](_0xb4a8('0xc'),_0x25c702,_0xb4a8('0xa'),JSON[_0xb4a8('0xd')](_0x1ec482));if(_0x1ec482['error']){if(_0x1ec482[_0xb4a8('0xe')][_0xb4a8('0xf')]===0x1f4){logger[_0xb4a8('0xe')](_0xb4a8('0x9'),_0x25c702,_0x1ec482[_0xb4a8('0xe')]['message']);return _0x377401(_0x1ec482[_0xb4a8('0xe')][_0xb4a8('0x10')]);}logger[_0xb4a8('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x25c702,_0x1ec482[_0xb4a8('0xe')][_0xb4a8('0x10')]);return _0x527007(_0x1ec482[_0xb4a8('0xe')][_0xb4a8('0x10')]);}else{logger[_0xb4a8('0x8')](_0xb4a8('0x9'),_0x25c702,_0xb4a8('0xa'));_0x527007(_0x1ec482[_0xb4a8('0x11')]['message']);}})['catch'](function(_0x41ed94){logger[_0xb4a8('0xe')](_0xb4a8('0x9'),_0x25c702,_0x41ed94);_0x377401(_0x41ed94);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 172ad2b..2e9c3a2 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 _0xd10b=['path','express','Router','fs-extra','../../components/auth/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','create','update','/:id','destroy','exports','multer','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd10b,0x141));var _0xbd10=function(_0xe2da82,_0x197b63){_0xe2da82=_0xe2da82-0x0;var _0x58fc89=_0xd10b[_0xe2da82];return _0x58fc89;};'use strict';var multer=require(_0xbd10('0x0'));var util=require(_0xbd10('0x1'));var path=require(_0xbd10('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd10('0x3'));var router=express[_0xbd10('0x4')]();var fs_extra=require(_0xbd10('0x5'));var auth=require(_0xbd10('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbd10('0x7'));router[_0xbd10('0x8')]('/',auth[_0xbd10('0x9')](),controller[_0xbd10('0xa')]);router[_0xbd10('0x8')]('/:id',auth[_0xbd10('0x9')](),controller[_0xbd10('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd10('0xc')]);router['put']('/:id',auth[_0xbd10('0x9')](),controller[_0xbd10('0xd')]);router['delete'](_0xbd10('0xe'),auth[_0xbd10('0x9')](),controller[_0xbd10('0xf')]);module[_0xbd10('0x10')]=router; \ No newline at end of file +var _0xff99=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','/:id','post','create','put','isAuthenticated','destroy','util'];(function(_0xf5fa9c,_0x1d9b9e){var _0x38a0cf=function(_0x48bc5f){while(--_0x48bc5f){_0xf5fa9c['push'](_0xf5fa9c['shift']());}};_0x38a0cf(++_0x1d9b9e);}(_0xff99,0x12b));var _0x9ff9=function(_0x31e197,_0x561733){_0x31e197=_0x31e197-0x0;var _0x3a5df1=_0xff99[_0x31e197];return _0x3a5df1;};'use strict';var multer=require('multer');var util=require(_0x9ff9('0x0'));var path=require(_0x9ff9('0x1'));var timeout=require(_0x9ff9('0x2'));var express=require('express');var router=express[_0x9ff9('0x3')]();var fs_extra=require(_0x9ff9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9ff9('0x5'));var config=require(_0x9ff9('0x6'));var controller=require(_0x9ff9('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9ff9('0x8')](_0x9ff9('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x9ff9('0xa')]('/',auth['isAuthenticated'](),controller[_0x9ff9('0xb')]);router[_0x9ff9('0xc')](_0x9ff9('0x9'),auth[_0x9ff9('0xd')](),controller['update']);router['delete'](_0x9ff9('0x9'),auth[_0x9ff9('0xd')](),controller[_0x9ff9('0xe')]);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 055b150..e258cac 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 _0xd6b4=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','picklist','STRING'];(function(_0x352aef,_0x5b78b6){var _0x8732fa=function(_0x357d83){while(--_0x357d83){_0x352aef['push'](_0x352aef['shift']());}};_0x8732fa(++_0x5b78b6);}(_0xd6b4,0xfe));var _0x4d6b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd6b4[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x4d6b('0x0'));module[_0x4d6b('0x1')]={'type':{'type':Sequelize[_0x4d6b('0x2')](_0x4d6b('0x3'),'variable','customVariable',_0x4d6b('0x4'),_0x4d6b('0x5')),'defaultValue':_0x4d6b('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4d6b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4d6b('0x3'),'variable',_0x4d6b('0x7'))},'keyContent':{'type':Sequelize[_0x4d6b('0x6')]},'idField':{'type':Sequelize[_0x4d6b('0x6')]},'nameField':{'type':Sequelize[_0x4d6b('0x6')]},'customField':{'type':Sequelize[_0x4d6b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4d6b('0x6')]}}; \ No newline at end of file +var _0xa56e=['exports','variable','customVariable','keyValue','picklist','STRING','string','BOOLEAN','sequelize'];(function(_0x7d9951,_0xe6a504){var _0x2be1a9=function(_0x521a27){while(--_0x521a27){_0x7d9951['push'](_0x7d9951['shift']());}};_0x2be1a9(++_0xe6a504);}(_0xa56e,0x74));var _0xea56=function(_0x304a2f,_0x55d3df){_0x304a2f=_0x304a2f-0x0;var _0x4a5e83=_0xa56e[_0x304a2f];return _0x4a5e83;};'use strict';var Sequelize=require(_0xea56('0x0'));module[_0xea56('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xea56('0x2'),_0xea56('0x3'),_0xea56('0x4'),_0xea56('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xea56('0x6')]},'key':{'type':Sequelize[_0xea56('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xea56('0x7'),_0xea56('0x2'),_0xea56('0x3'))},'keyContent':{'type':Sequelize[_0xea56('0x6')]},'idField':{'type':Sequelize[_0xea56('0x6')]},'nameField':{'type':Sequelize[_0xea56('0x6')]},'customField':{'type':Sequelize[_0xea56('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f2f9a51..f563093 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 _0xaa88=['model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','stack','name','send','map','FreshdeskField','fieldName','key'];(function(_0x27ee97,_0x32d286){var _0xda5fa1=function(_0x4df088){while(--_0x4df088){_0x27ee97['push'](_0x27ee97['shift']());}};_0xda5fa1(++_0x32d286);}(_0xaa88,0x137));var _0x8aa8=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0xaa88[_0x2797c6];return _0x54809f;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['index']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={},_0x385208={},_0x14be8b={'count':0x0,'rows':[]};var _0x39e892=_[_0x8aa8('0x28')](db[_0x8aa8('0x29')]['rawAttributes'],function(_0x267f4c){return{'name':_0x267f4c[_0x8aa8('0x2a')],'type':_0x267f4c['type'][_0x8aa8('0x2b')]};});_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x28')](_0x39e892,'name');_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x4c5c5c[_0x8aa8('0x2d')]);_0x385208[_0x8aa8('0x2f')]=_[_0x8aa8('0x30')](_0x385208[_0x8aa8('0x2c')],_0x385208[_0x8aa8('0x2d')]);_0x5e96c9[_0x8aa8('0x31')]=_[_0x8aa8('0x30')](_0x385208[_0x8aa8('0x2c')],qs[_0x8aa8('0x32')](_0x4c5c5c['query']['fields']));_0x5e96c9[_0x8aa8('0x31')]=_0x5e96c9[_0x8aa8('0x31')][_0x8aa8('0x33')]?_0x5e96c9[_0x8aa8('0x31')]:_0x385208[_0x8aa8('0x2c')];if(!_0x4c5c5c[_0x8aa8('0x2d')]['hasOwnProperty']('nolimit')){_0x5e96c9[_0x8aa8('0x1f')]=qs['limit'](_0x4c5c5c[_0x8aa8('0x2d')][_0x8aa8('0x1f')]);_0x5e96c9[_0x8aa8('0x1d')]=qs['offset'](_0x4c5c5c[_0x8aa8('0x2d')][_0x8aa8('0x1d')]);}_0x5e96c9[_0x8aa8('0x34')]=qs['sort'](_0x4c5c5c['query'][_0x8aa8('0x35')]);_0x5e96c9[_0x8aa8('0x36')]=qs['filters'](_[_0x8aa8('0x37')](_0x4c5c5c[_0x8aa8('0x2d')],_0x385208['filters']),_0x39e892);if(_0x4c5c5c[_0x8aa8('0x2d')]['filter']){_0x5e96c9['where']=_[_0x8aa8('0x38')](_0x5e96c9['where'],{'$or':_[_0x8aa8('0x28')](_0x39e892,function(_0x944927){if(_0x944927[_0x8aa8('0x39')]!==_0x8aa8('0x3a')){var _0x4ce5e9={};_0x4ce5e9[_0x944927[_0x8aa8('0x26')]]={'$like':'%'+_0x4c5c5c[_0x8aa8('0x2d')]['filter']+'%'};return _0x4ce5e9;}})});}_0x5e96c9=_[_0x8aa8('0x38')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x3b')]);var _0x5ea57a={'where':_0x5e96c9[_0x8aa8('0x36')]};return db[_0x8aa8('0x29')][_0x8aa8('0x20')](_0x5ea57a)[_0x8aa8('0x24')](function(_0x189d53){_0x14be8b[_0x8aa8('0x20')]=_0x189d53;if(_0x4c5c5c[_0x8aa8('0x2d')][_0x8aa8('0x3c')]){_0x5e96c9[_0x8aa8('0x3d')]=[{'all':!![]}];}return db[_0x8aa8('0x29')][_0x8aa8('0x3e')](_0x5e96c9);})[_0x8aa8('0x24')](function(_0x17c730){_0x14be8b[_0x8aa8('0x3f')]=_0x17c730;return _0x14be8b;})[_0x8aa8('0x24')](respondWithFilteredResult(_0x10810d,_0x5e96c9))[_0x8aa8('0x40')](handleError(_0x10810d,null));};exports['show']=function(_0x1aade0,_0x5cdba4){var _0x4833c0={'raw':!![],'where':{'id':_0x1aade0[_0x8aa8('0x41')]['id']}},_0x572132={};_0x572132['model']=_['keys'](db[_0x8aa8('0x29')]['rawAttributes']);_0x572132[_0x8aa8('0x2d')]=_['keys'](_0x1aade0['query']);_0x572132[_0x8aa8('0x2f')]=_[_0x8aa8('0x30')](_0x572132[_0x8aa8('0x2c')],_0x572132[_0x8aa8('0x2d')]);_0x4833c0[_0x8aa8('0x31')]=_[_0x8aa8('0x30')](_0x572132[_0x8aa8('0x2c')],qs['fields'](_0x1aade0[_0x8aa8('0x2d')]['fields']));_0x4833c0[_0x8aa8('0x31')]=_0x4833c0[_0x8aa8('0x31')][_0x8aa8('0x33')]?_0x4833c0[_0x8aa8('0x31')]:_0x572132[_0x8aa8('0x2c')];if(_0x1aade0[_0x8aa8('0x2d')]['includeAll']){_0x4833c0['include']=[{'all':!![]}];}_0x4833c0=_[_0x8aa8('0x38')]({},_0x4833c0,_0x1aade0[_0x8aa8('0x3b')]);return db['FreshdeskField'][_0x8aa8('0x42')](_0x4833c0)[_0x8aa8('0x24')](handleEntityNotFound(_0x5cdba4,null))[_0x8aa8('0x24')](respondWithResult(_0x5cdba4,null))['catch'](handleError(_0x5cdba4,null));};exports['create']=function(_0x52c130,_0x4e05e7){return db[_0x8aa8('0x29')][_0x8aa8('0x43')](_0x52c130['body'],{})[_0x8aa8('0x24')](respondWithResult(_0x4e05e7,0xc9))[_0x8aa8('0x40')](handleError(_0x4e05e7,null));};exports[_0x8aa8('0x44')]=function(_0x1aa1b6,_0x20384a){if(_0x1aa1b6[_0x8aa8('0x45')]['id']){delete _0x1aa1b6['body']['id'];}return db['FreshdeskField'][_0x8aa8('0x42')]({'where':{'id':_0x1aa1b6['params']['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x20384a,null))['then'](saveUpdates(_0x1aa1b6[_0x8aa8('0x45')],null))[_0x8aa8('0x24')](respondWithResult(_0x20384a,null))[_0x8aa8('0x40')](handleError(_0x20384a,null));};exports[_0x8aa8('0x46')]=function(_0x36de37,_0x22b35d){return db[_0x8aa8('0x29')][_0x8aa8('0x42')]({'where':{'id':_0x36de37[_0x8aa8('0x41')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x22b35d,null))[_0x8aa8('0x24')](removeEntity(_0x22b35d,null))[_0x8aa8('0x40')](handleError(_0x22b35d,null));}; \ No newline at end of file +var _0x1d2d=['where','pick','filter','merge','options','FreshdeskField','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0xb2e92d,_0x4ac521){var _0x5c7b21=function(_0x3705fc){while(--_0x3705fc){_0xb2e92d['push'](_0xb2e92d['shift']());}};_0x5c7b21(++_0x4ac521);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5a9729,_0x54d1a2){_0x5a9729=_0x5a9729-0x0;var _0xc088=_0x1d2d[_0x5a9729];return _0xc088;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];function respondWithStatusCode(_0x33f088,_0x129d8f){_0x129d8f=_0x129d8f||0xcc;return function(_0xc3ee82){if(_0xc3ee82){return _0x33f088[_0xd1d2('0x1b')](_0x129d8f);}return _0x33f088[_0xd1d2('0x1c')](_0x129d8f)[_0xd1d2('0x1d')]();};}function respondWithResult(_0x3f670f,_0x4cf702){_0x4cf702=_0x4cf702||0xc8;return function(_0x2e7fec){if(_0x2e7fec){return _0x3f670f[_0xd1d2('0x1c')](_0x4cf702)[_0xd1d2('0x1e')](_0x2e7fec);}};}function respondWithFilteredResult(_0x56de25,_0x35381b){return function(_0xc36ce){if(_0xc36ce){var _0x208425=typeof _0x35381b[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0x35381b[_0xd1d2('0x21')]===_0xd1d2('0x20');var _0x57f2f9=_0xc36ce['count'];var _0x3be186=_0x208425?0x0:_0x35381b['offset'];var _0x247b3a=_0x208425?_0xc36ce[_0xd1d2('0x22')]:_0x35381b[_0xd1d2('0x1f')]+_0x35381b[_0xd1d2('0x21')];var _0x4ab386;if(_0x247b3a>=_0x57f2f9){_0x247b3a=_0x57f2f9;_0x4ab386=0xc8;}else{_0x4ab386=0xce;}_0x56de25['status'](_0x4ab386);return _0x56de25[_0xd1d2('0x23')]('Content-Range',_0x3be186+'-'+_0x247b3a+'/'+_0x57f2f9)['json'](_0xc36ce);}return null;};}function patchUpdates(_0x1ab67c){return function(_0x27e26b){try{jsonpatch[_0xd1d2('0x24')](_0x27e26b,_0x1ab67c,!![]);}catch(_0x40170b){return BPromise['reject'](_0x40170b);}return _0x27e26b[_0xd1d2('0x25')]();};}function saveUpdates(_0xbb4d27,_0x24b8db){return function(_0x4eb082){if(_0x4eb082){return _0x4eb082['update'](_0xbb4d27)[_0xd1d2('0x26')](function(_0x3a1078){return _0x3a1078;});}return null;};}function removeEntity(_0x19d535,_0x2f92ee){return function(_0x3f229c){if(_0x3f229c){return _0x3f229c[_0xd1d2('0x27')]()[_0xd1d2('0x26')](function(){_0x19d535['status'](0xcc)[_0xd1d2('0x1d')]();});}};}function handleEntityNotFound(_0x42da6d,_0x41330f){return function(_0x2e1709){if(!_0x2e1709){_0x42da6d[_0xd1d2('0x1b')](0x194);}return _0x2e1709;};}function handleError(_0x39e991,_0x28b8be){_0x28b8be=_0x28b8be||0x1f4;return function(_0x34faf7){logger[_0xd1d2('0x28')](_0x34faf7[_0xd1d2('0x29')]);if(_0x34faf7[_0xd1d2('0x2a')]){delete _0x34faf7['name'];}_0x39e991['status'](_0x28b8be)[_0xd1d2('0x2b')](_0x34faf7);};}exports[_0xd1d2('0x2c')]=function(_0x1e6072,_0x2b4c1f){var _0xc815ea={},_0x48ade1={},_0x39d694={'count':0x0,'rows':[]};var _0x41171c=_[_0xd1d2('0x2d')](db['FreshdeskField'][_0xd1d2('0x2e')],function(_0x1db17f){return{'name':_0x1db17f[_0xd1d2('0x2f')],'type':_0x1db17f['type'][_0xd1d2('0x30')]};});_0x48ade1[_0xd1d2('0x31')]=_[_0xd1d2('0x2d')](_0x41171c,_0xd1d2('0x2a'));_0x48ade1[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x1e6072[_0xd1d2('0x32')]);_0x48ade1[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],_0x48ade1[_0xd1d2('0x32')]);_0xc815ea[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],qs[_0xd1d2('0x37')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x37')]));_0xc815ea[_0xd1d2('0x36')]=_0xc815ea['attributes'][_0xd1d2('0x38')]?_0xc815ea[_0xd1d2('0x36')]:_0x48ade1[_0xd1d2('0x31')];if(!_0x1e6072['query'][_0xd1d2('0x39')]('nolimit')){_0xc815ea['limit']=qs[_0xd1d2('0x21')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x21')]);_0xc815ea[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x1e6072[_0xd1d2('0x32')]['offset']);}_0xc815ea[_0xd1d2('0x3a')]=qs[_0xd1d2('0x3b')](_0x1e6072['query'][_0xd1d2('0x3b')]);_0xc815ea[_0xd1d2('0x3c')]=qs[_0xd1d2('0x34')](_[_0xd1d2('0x3d')](_0x1e6072['query'],_0x48ade1['filters']),_0x41171c);if(_0x1e6072[_0xd1d2('0x32')]['filter']){_0xc815ea['where']=_['merge'](_0xc815ea[_0xd1d2('0x3c')],{'$or':_['map'](_0x41171c,function(_0x3f4fd7){if(_0x3f4fd7['type']!=='VIRTUAL'){var _0x4bcea4={};_0x4bcea4[_0x3f4fd7[_0xd1d2('0x2a')]]={'$like':'%'+_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x3e')]+'%'};return _0x4bcea4;}})});}_0xc815ea=_[_0xd1d2('0x3f')]({},_0xc815ea,_0x1e6072[_0xd1d2('0x40')]);var _0xb5bec2={'where':_0xc815ea[_0xd1d2('0x3c')]};return db[_0xd1d2('0x41')][_0xd1d2('0x22')](_0xb5bec2)[_0xd1d2('0x26')](function(_0x2cedb4){_0x39d694[_0xd1d2('0x22')]=_0x2cedb4;if(_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x42')]){_0xc815ea['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xd1d2('0x43')](_0xc815ea);})[_0xd1d2('0x26')](function(_0x24fc93){_0x39d694['rows']=_0x24fc93;return _0x39d694;})['then'](respondWithFilteredResult(_0x2b4c1f,_0xc815ea))[_0xd1d2('0x44')](handleError(_0x2b4c1f,null));};exports[_0xd1d2('0x45')]=function(_0x4dc730,_0x2fe92a){var _0x4c5d49={'raw':!![],'where':{'id':_0x4dc730[_0xd1d2('0x46')]['id']}},_0x5a3790={};_0x5a3790['model']=_['keys'](db[_0xd1d2('0x41')][_0xd1d2('0x2e')]);_0x5a3790[_0xd1d2('0x32')]=_['keys'](_0x4dc730[_0xd1d2('0x32')]);_0x5a3790[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x5a3790[_0xd1d2('0x31')],_0x5a3790['query']);_0x4c5d49[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x5a3790['model'],qs[_0xd1d2('0x37')](_0x4dc730['query'][_0xd1d2('0x37')]));_0x4c5d49[_0xd1d2('0x36')]=_0x4c5d49[_0xd1d2('0x36')][_0xd1d2('0x38')]?_0x4c5d49[_0xd1d2('0x36')]:_0x5a3790['model'];if(_0x4dc730['query'][_0xd1d2('0x42')]){_0x4c5d49[_0xd1d2('0x47')]=[{'all':!![]}];}_0x4c5d49=_['merge']({},_0x4c5d49,_0x4dc730[_0xd1d2('0x40')]);return db[_0xd1d2('0x41')][_0xd1d2('0x48')](_0x4c5d49)[_0xd1d2('0x26')](handleEntityNotFound(_0x2fe92a,null))[_0xd1d2('0x26')](respondWithResult(_0x2fe92a,null))[_0xd1d2('0x44')](handleError(_0x2fe92a,null));};exports[_0xd1d2('0x49')]=function(_0x57c668,_0xed9e9){return db[_0xd1d2('0x41')]['create'](_0x57c668[_0xd1d2('0x4a')],{})[_0xd1d2('0x26')](respondWithResult(_0xed9e9,0xc9))['catch'](handleError(_0xed9e9,null));};exports['update']=function(_0x3d4fe3,_0x182ea8){if(_0x3d4fe3['body']['id']){delete _0x3d4fe3[_0xd1d2('0x4a')]['id'];}return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0x3d4fe3[_0xd1d2('0x46')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x182ea8,null))['then'](saveUpdates(_0x3d4fe3['body'],null))[_0xd1d2('0x26')](respondWithResult(_0x182ea8,null))['catch'](handleError(_0x182ea8,null));};exports[_0xd1d2('0x27')]=function(_0xcd4b70,_0x4f4cb9){return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0xcd4b70['params']['id']}})['then'](handleEntityNotFound(_0x4f4cb9,null))[_0xd1d2('0x26')](removeEntity(_0x4f4cb9,null))[_0xd1d2('0x44')](handleError(_0x4f4cb9,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 11ab417..6714adb 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 _0xecb2=['FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x44b355,_0x384ab1){var _0x5ae379=function(_0x13efe6){while(--_0x13efe6){_0x44b355['push'](_0x44b355['shift']());}};_0x5ae379(++_0x384ab1);}(_0xecb2,0x112));var _0x2ecb=function(_0x201887,_0x1cd2de){_0x201887=_0x201887-0x0;var _0xf3faa8=_0xecb2[_0x201887];return _0xf3faa8;};'use strict';var _=require(_0x2ecb('0x0'));var util=require(_0x2ecb('0x1'));var logger=require(_0x2ecb('0x2'))('api');var moment=require(_0x2ecb('0x3'));var BPromise=require(_0x2ecb('0x4'));var rp=require(_0x2ecb('0x5'));var fs=require('fs');var path=require(_0x2ecb('0x6'));var rimraf=require(_0x2ecb('0x7'));var config=require(_0x2ecb('0x8'));var attributes=require(_0x2ecb('0x9'));module[_0x2ecb('0xa')]=function(_0x414871,_0x9e6340){return _0x414871['define'](_0x2ecb('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x2ecb('0xc'),'fields':[_0x2ecb('0xd'),_0x2ecb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1bdd=['../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x59c1e0,_0x5af500){var _0x17436c=function(_0x20685a){while(--_0x20685a){_0x59c1e0['push'](_0x59c1e0['shift']());}};_0x17436c(++_0x5af500);}(_0x1bdd,0x143));var _0xd1bd=function(_0x33dea9,_0x1ff0fd){_0x33dea9=_0x33dea9-0x0;var _0x531efa=_0x1bdd[_0x33dea9];return _0x531efa;};'use strict';var _=require(_0xd1bd('0x0'));var util=require(_0xd1bd('0x1'));var logger=require(_0xd1bd('0x2'))(_0xd1bd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd1bd('0x4'));var fs=require('fs');var path=require(_0xd1bd('0x5'));var rimraf=require(_0xd1bd('0x6'));var config=require(_0xd1bd('0x7'));var attributes=require(_0xd1bd('0x8'));module['exports']=function(_0x23db60,_0x2fc380){return _0x23db60[_0xd1bd('0x9')](_0xd1bd('0xa'),attributes,{'tableName':_0xd1bd('0xb'),'paranoid':![],'indexes':[{'name':_0xd1bd('0xc'),'fields':[_0xd1bd('0xd'),_0xd1bd('0xe')],'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 8c3b4b8..759754d 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 _0x57aa=['FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','moment','bluebird','ioredis','../../mysqldb','jayson/promise','request','then'];(function(_0x1216d2,_0xba895c){var _0x4ce123=function(_0x4791b5){while(--_0x4791b5){_0x1216d2['push'](_0x1216d2['shift']());}};_0x4ce123(++_0xba895c);}(_0x57aa,0xe9));var _0xa57a=function(_0x3ccbc7,_0x3093c8){_0x3ccbc7=_0x3ccbc7-0x0;var _0x50c97a=_0x57aa[_0x3ccbc7];return _0x50c97a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa57a('0x0'));var BPromise=require(_0xa57a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa57a('0x2'));var db=require(_0xa57a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa57a('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4abef0,_0x20127a,_0x1721a4){return new BPromise(function(_0x490f0b,_0x4f3217){return client[_0xa57a('0x5')](_0x4abef0,_0x1721a4)[_0xa57a('0x6')](function(_0x32b141){logger['info'](_0xa57a('0x7'),_0x20127a,_0xa57a('0x8'));logger[_0xa57a('0x9')](_0xa57a('0xa'),_0x20127a,_0xa57a('0x8'),JSON[_0xa57a('0xb')](_0x32b141));if(_0x32b141[_0xa57a('0xc')]){if(_0x32b141[_0xa57a('0xc')]['code']===0x1f4){logger[_0xa57a('0xc')](_0xa57a('0x7'),_0x20127a,_0x32b141['error'][_0xa57a('0xd')]);return _0x4f3217(_0x32b141[_0xa57a('0xc')][_0xa57a('0xd')]);}logger['error'](_0xa57a('0x7'),_0x20127a,_0x32b141[_0xa57a('0xc')][_0xa57a('0xd')]);return _0x490f0b(_0x32b141[_0xa57a('0xc')][_0xa57a('0xd')]);}else{logger[_0xa57a('0xe')](_0xa57a('0x7'),_0x20127a,'request\x20sent');_0x490f0b(_0x32b141[_0xa57a('0xf')]['message']);}})['catch'](function(_0x26a039){logger[_0xa57a('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x20127a,_0x26a039);_0x4f3217(_0x26a039);});});} \ No newline at end of file +var _0x8a3c=['client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x46b3ef,_0x13825d){var _0x14b497=function(_0x17d577){while(--_0x17d577){_0x46b3ef['push'](_0x46b3ef['shift']());}};_0x14b497(++_0x13825d);}(_0x8a3c,0x113));var _0xc8a3=function(_0x5bd072,_0x3f02d6){_0x5bd072=_0x5bd072-0x0;var _0x17c868=_0x8a3c[_0x5bd072];return _0x17c868;};'use strict';var _=require(_0xc8a3('0x0'));var util=require(_0xc8a3('0x1'));var moment=require(_0xc8a3('0x2'));var BPromise=require(_0xc8a3('0x3'));var rs=require(_0xc8a3('0x4'));var fs=require('fs');var Redis=require(_0xc8a3('0x5'));var db=require(_0xc8a3('0x6'))['db'];var utils=require(_0xc8a3('0x7'));var logger=require('../../config/logger')(_0xc8a3('0x8'));var config=require(_0xc8a3('0x9'));var jayson=require(_0xc8a3('0xa'));var client=jayson[_0xc8a3('0xb')][_0xc8a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2718a2,_0x3839d7,_0x2ded4c){return new BPromise(function(_0x568b6a,_0x15e6e2){return client[_0xc8a3('0xd')](_0x2718a2,_0x2ded4c)[_0xc8a3('0xe')](function(_0x3115ea){logger[_0xc8a3('0xf')](_0xc8a3('0x10'),_0x3839d7,_0xc8a3('0x11'));logger[_0xc8a3('0x12')](_0xc8a3('0x13'),_0x3839d7,_0xc8a3('0x11'),JSON[_0xc8a3('0x14')](_0x3115ea));if(_0x3115ea[_0xc8a3('0x15')]){if(_0x3115ea[_0xc8a3('0x15')][_0xc8a3('0x16')]===0x1f4){logger[_0xc8a3('0x15')](_0xc8a3('0x10'),_0x3839d7,_0x3115ea[_0xc8a3('0x15')]['message']);return _0x15e6e2(_0x3115ea['error']['message']);}logger['error'](_0xc8a3('0x10'),_0x3839d7,_0x3115ea[_0xc8a3('0x15')]['message']);return _0x568b6a(_0x3115ea[_0xc8a3('0x15')][_0xc8a3('0x17')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x3839d7,_0xc8a3('0x11'));_0x568b6a(_0x3115ea[_0xc8a3('0x18')][_0xc8a3('0x17')]);}})[_0xc8a3('0x19')](function(_0x2aee60){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x3839d7,_0x2aee60);_0x15e6e2(_0x2aee60);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f204616..384a98e 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 _0x6c76=['getConfigurations','/:id/fields','post','create','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations'];(function(_0x303a96,_0x48290a){var _0x5c3685=function(_0x421ce6){while(--_0x421ce6){_0x303a96['push'](_0x303a96['shift']());}};_0x5c3685(++_0x48290a);}(_0x6c76,0x184));var _0x66c7=function(_0x487715,_0x1f5d76){_0x487715=_0x487715-0x0;var _0x258e07=_0x6c76[_0x487715];return _0x258e07;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0x7')](_0x66c7('0xc'),auth[_0x66c7('0x8')](),controller['getFields']);router[_0x66c7('0xd')]('/',auth[_0x66c7('0x8')](),controller[_0x66c7('0xe')]);router[_0x66c7('0xd')](_0x66c7('0xa'),auth[_0x66c7('0x8')](),controller[_0x66c7('0xf')]);router['put'](_0x66c7('0x10'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x11')]);router[_0x66c7('0x12')](_0x66c7('0x10'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x13')]);module[_0x66c7('0x14')]=router; \ No newline at end of file +var _0xdb94=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshsalesAccount.controller','index','/:id','show','get','/:id/configurations'];(function(_0x1e1f1c,_0x788ad4){var _0x508a08=function(_0x5118da){while(--_0x5118da){_0x1e1f1c['push'](_0x1e1f1c['shift']());}};_0x508a08(++_0x788ad4);}(_0xdb94,0xab));var _0x4db9=function(_0x3ba415,_0x5a10ee){_0x3ba415=_0x3ba415-0x0;var _0x4ba43c=_0xdb94[_0x3ba415];return _0x4ba43c;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db9('0x8')]);router['get'](_0x4db9('0x9'),auth['isAuthenticated'](),controller[_0x4db9('0xa')]);router[_0x4db9('0xb')](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xb')](_0x4db9('0xf'),auth[_0x4db9('0xd')](),controller[_0x4db9('0x10')]);router[_0x4db9('0x11')]('/',auth[_0x4db9('0xd')](),controller['create']);router[_0x4db9('0x11')](_0x4db9('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4db9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4db9('0x13')]);router[_0x4db9('0x14')]('/:id',auth[_0x4db9('0xd')](),controller[_0x4db9('0x15')]);module[_0x4db9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ec61427..abbd4ae 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 _0xdd4f=['username','remoteUri','sequelize','STRING'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1d17d4,_0x25eccb){_0x1d17d4=_0x1d17d4-0x0;var _0x13ab32=_0xdd4f[_0x1d17d4];return _0x13ab32;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x3')},'serverUrl':{'type':Sequelize[_0xfdd4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x236c=['remoteUri','sequelize','STRING','username'];(function(_0x5ed1a4,_0x6d43b8){var _0x4c6082=function(_0x356389){while(--_0x356389){_0x5ed1a4['push'](_0x5ed1a4['shift']());}};_0x4c6082(++_0x6d43b8);}(_0x236c,0x155));var _0xc236=function(_0x214370,_0x24264e){_0x214370=_0x214370-0x0;var _0x989e4f=_0x236c[_0x214370];return _0x989e4f;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'name':{'type':Sequelize[_0xc236('0x1')]},'description':{'type':Sequelize[_0xc236('0x1')]},'username':{'type':Sequelize[_0xc236('0x1')],'unique':_0xc236('0x2')},'apiKey':{'type':Sequelize[_0xc236('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc236('0x3')},'serverUrl':{'type':Sequelize[_0xc236('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index c61ea27..2cdef5a 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 _0x5672=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','then','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','FreshsalesAccount','findAll','rows','catch','show','params','fields','create','body','update','find','destroy','findOne','FreshsalesConfiguration','merge','hasOwnProperty','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','apiKey','slice','substring','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1b56a9,_0x4dd3e4){var _0xdae76=function(_0x3b7eea){while(--_0x3b7eea){_0x1b56a9['push'](_0x1b56a9['shift']());}};_0xdae76(++_0x4dd3e4);}(_0x5672,0x129));var _0x2567=function(_0x26d26f,_0x302cce){_0x26d26f=_0x26d26f-0x0;var _0x5c8c0e=_0x5672[_0x26d26f];return _0x5c8c0e;};'use strict';var emlformat=require(_0x2567('0x0'));var rimraf=require(_0x2567('0x1'));var zipdir=require(_0x2567('0x2'));var jsonpatch=require(_0x2567('0x3'));var rp=require(_0x2567('0x4'));var moment=require(_0x2567('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2567('0x6'));var util=require(_0x2567('0x7'));var path=require(_0x2567('0x8'));var sox=require(_0x2567('0x9'));var csv=require('to-csv');var ejs=require(_0x2567('0xa'));var fs=require('fs');var fs_extra=require(_0x2567('0xb'));var _=require('lodash');var squel=require(_0x2567('0xc'));var crypto=require('crypto');var jsforce=require(_0x2567('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2567('0xe'));var querystring=require(_0x2567('0xf'));var Papa=require('papaparse');var Redis=require(_0x2567('0x10'));var authService=require(_0x2567('0x11'));var qs=require(_0x2567('0x12'));var as=require(_0x2567('0x13'));var hardwareService=require(_0x2567('0x14'));var logger=require(_0x2567('0x15'))(_0x2567('0x16'));var utils=require(_0x2567('0x17'));var config=require(_0x2567('0x18'));var licenseUtil=require(_0x2567('0x19'));var db=require(_0x2567('0x1a'))['db'];var integrations=require(_0x2567('0x1b'));function respondWithStatusCode(_0x4fb875,_0x3252af){_0x3252af=_0x3252af||0xcc;return function(_0x430124){if(_0x430124){return _0x4fb875[_0x2567('0x1c')](_0x3252af);}return _0x4fb875[_0x2567('0x1d')](_0x3252af)['end']();};}function respondWithResult(_0xc0f8a7,_0x1aee53){_0x1aee53=_0x1aee53||0xc8;return function(_0x4b3d85){if(_0x4b3d85){return _0xc0f8a7['status'](_0x1aee53)['json'](_0x4b3d85);}};}function respondWithFilteredResult(_0x310ef7,_0x6a90f){return function(_0x18d6a2){if(_0x18d6a2){var _0x4c9d32=typeof _0x6a90f[_0x2567('0x1e')]===_0x2567('0x1f')&&typeof _0x6a90f[_0x2567('0x20')]===_0x2567('0x1f');var _0xcb508=_0x18d6a2[_0x2567('0x21')];var _0x5925d2=_0x4c9d32?0x0:_0x6a90f[_0x2567('0x1e')];var _0x3de21b=_0x4c9d32?_0x18d6a2[_0x2567('0x21')]:_0x6a90f[_0x2567('0x1e')]+_0x6a90f['limit'];var _0x4fb590;if(_0x3de21b>=_0xcb508){_0x3de21b=_0xcb508;_0x4fb590=0xc8;}else{_0x4fb590=0xce;}_0x310ef7[_0x2567('0x1d')](_0x4fb590);return _0x310ef7[_0x2567('0x22')]('Content-Range',_0x5925d2+'-'+_0x3de21b+'/'+_0xcb508)['json'](_0x18d6a2);}return null;};}function patchUpdates(_0x407f75){return function(_0x10b481){try{jsonpatch[_0x2567('0x23')](_0x10b481,_0x407f75,!![]);}catch(_0x5dd16f){return BPromise[_0x2567('0x24')](_0x5dd16f);}return _0x10b481[_0x2567('0x25')]();};}function saveUpdates(_0x2baaff,_0x5f2113){return function(_0x50240f){if(_0x50240f){return _0x50240f['update'](_0x2baaff)['then'](function(_0x5afc39){return _0x5afc39;});}return null;};}function removeEntity(_0x138250,_0x1d4f21){return function(_0x20da17){if(_0x20da17){return _0x20da17['destroy']()[_0x2567('0x26')](function(){_0x138250['status'](0xcc)[_0x2567('0x27')]();});}};}function handleEntityNotFound(_0x461ecb,_0x2d6559){return function(_0x2cfc4c){if(!_0x2cfc4c){_0x461ecb['sendStatus'](0x194);}return _0x2cfc4c;};}function handleError(_0x4a62ee,_0x21c8a0){_0x21c8a0=_0x21c8a0||0x1f4;return function(_0x25c4ce){logger['error'](_0x25c4ce[_0x2567('0x28')]);if(_0x25c4ce[_0x2567('0x29')]){delete _0x25c4ce[_0x2567('0x29')];}_0x4a62ee[_0x2567('0x1d')](_0x21c8a0)['send'](_0x25c4ce);};}exports[_0x2567('0x2a')]=function(_0x1b081d,_0x43ce59){var _0x1d3b61={},_0x415bf9={},_0x45cd0e={'count':0x0,'rows':[]};var _0x368ab6=_[_0x2567('0x2b')](db['FreshsalesAccount'][_0x2567('0x2c')],function(_0x1e6876){return{'name':_0x1e6876[_0x2567('0x2d')],'type':_0x1e6876[_0x2567('0x2e')][_0x2567('0x2f')]};});_0x415bf9[_0x2567('0x30')]=_['map'](_0x368ab6,_0x2567('0x29'));_0x415bf9[_0x2567('0x31')]=_[_0x2567('0x32')](_0x1b081d['query']);_0x415bf9[_0x2567('0x33')]=_[_0x2567('0x34')](_0x415bf9['model'],_0x415bf9[_0x2567('0x31')]);_0x1d3b61[_0x2567('0x35')]=_[_0x2567('0x34')](_0x415bf9[_0x2567('0x30')],qs['fields'](_0x1b081d[_0x2567('0x31')]['fields']));_0x1d3b61[_0x2567('0x35')]=_0x1d3b61[_0x2567('0x35')][_0x2567('0x36')]?_0x1d3b61[_0x2567('0x35')]:_0x415bf9[_0x2567('0x30')];if(!_0x1b081d[_0x2567('0x31')]['hasOwnProperty']('nolimit')){_0x1d3b61[_0x2567('0x20')]=qs[_0x2567('0x20')](_0x1b081d[_0x2567('0x31')]['limit']);_0x1d3b61[_0x2567('0x1e')]=qs[_0x2567('0x1e')](_0x1b081d['query']['offset']);}_0x1d3b61[_0x2567('0x37')]=qs[_0x2567('0x38')](_0x1b081d[_0x2567('0x31')][_0x2567('0x38')]);_0x1d3b61[_0x2567('0x39')]=qs['filters'](_[_0x2567('0x3a')](_0x1b081d[_0x2567('0x31')],_0x415bf9[_0x2567('0x33')]),_0x368ab6);if(_0x1b081d['query'][_0x2567('0x3b')]){_0x1d3b61[_0x2567('0x39')]=_['merge'](_0x1d3b61[_0x2567('0x39')],{'$or':_['map'](_0x368ab6,function(_0x4c0b8c){if(_0x4c0b8c[_0x2567('0x2e')]!==_0x2567('0x3c')){var _0x5d0293={};_0x5d0293[_0x4c0b8c[_0x2567('0x29')]]={'$like':'%'+_0x1b081d['query'][_0x2567('0x3b')]+'%'};return _0x5d0293;}})});}_0x1d3b61=_['merge']({},_0x1d3b61,_0x1b081d[_0x2567('0x3d')]);var _0x12a84e={'where':_0x1d3b61[_0x2567('0x39')]};return db['FreshsalesAccount']['count'](_0x12a84e)[_0x2567('0x26')](function(_0x2eeb1c){_0x45cd0e[_0x2567('0x21')]=_0x2eeb1c;if(_0x1b081d[_0x2567('0x31')][_0x2567('0x3e')]){_0x1d3b61[_0x2567('0x3f')]=[{'all':!![]}];}return db[_0x2567('0x40')][_0x2567('0x41')](_0x1d3b61);})[_0x2567('0x26')](function(_0x436637){_0x45cd0e[_0x2567('0x42')]=_0x436637;return _0x45cd0e;})[_0x2567('0x26')](respondWithFilteredResult(_0x43ce59,_0x1d3b61))[_0x2567('0x43')](handleError(_0x43ce59,null));};exports[_0x2567('0x44')]=function(_0x1f1a1d,_0xc5df1c){var _0xe116bc={'raw':![],'where':{'id':_0x1f1a1d[_0x2567('0x45')]['id']}},_0x2a9718={};_0x2a9718[_0x2567('0x30')]=_['keys'](db['FreshsalesAccount'][_0x2567('0x2c')]);_0x2a9718[_0x2567('0x31')]=_[_0x2567('0x32')](_0x1f1a1d[_0x2567('0x31')]);_0x2a9718[_0x2567('0x33')]=_[_0x2567('0x34')](_0x2a9718[_0x2567('0x30')],_0x2a9718['query']);_0xe116bc[_0x2567('0x35')]=_[_0x2567('0x34')](_0x2a9718[_0x2567('0x30')],qs['fields'](_0x1f1a1d[_0x2567('0x31')][_0x2567('0x46')]));_0xe116bc[_0x2567('0x35')]=_0xe116bc[_0x2567('0x35')][_0x2567('0x36')]?_0xe116bc[_0x2567('0x35')]:_0x2a9718[_0x2567('0x30')];if(_0x1f1a1d[_0x2567('0x31')][_0x2567('0x3e')]){_0xe116bc[_0x2567('0x3f')]=[{'all':!![]}];}_0xe116bc=_['merge']({},_0xe116bc,_0x1f1a1d[_0x2567('0x3d')]);return db[_0x2567('0x40')]['find'](_0xe116bc)[_0x2567('0x26')](handleEntityNotFound(_0xc5df1c,null))[_0x2567('0x26')](respondWithResult(_0xc5df1c,null))['catch'](handleError(_0xc5df1c,null));};exports[_0x2567('0x47')]=function(_0xf22635,_0x4ea247){return db[_0x2567('0x40')][_0x2567('0x47')](_0xf22635[_0x2567('0x48')],{})[_0x2567('0x26')](respondWithResult(_0x4ea247,0xc9))[_0x2567('0x43')](handleError(_0x4ea247,null));};exports[_0x2567('0x49')]=function(_0x25417a,_0x1bb662){if(_0x25417a[_0x2567('0x48')]['id']){delete _0x25417a[_0x2567('0x48')]['id'];}return db[_0x2567('0x40')][_0x2567('0x4a')]({'where':{'id':_0x25417a['params']['id']}})[_0x2567('0x26')](handleEntityNotFound(_0x1bb662,null))[_0x2567('0x26')](saveUpdates(_0x25417a[_0x2567('0x48')],null))['then'](respondWithResult(_0x1bb662,null))['catch'](handleError(_0x1bb662,null));};exports[_0x2567('0x4b')]=function(_0x25f11d,_0x3a7436){return db[_0x2567('0x40')]['find']({'where':{'id':_0x25f11d[_0x2567('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a7436,null))[_0x2567('0x26')](removeEntity(_0x3a7436,null))[_0x2567('0x43')](handleError(_0x3a7436,null));};exports['getConfigurations']=function(_0x2028e8,_0x360ba5,_0x55d12c){var _0x2215c7={};var _0x106cf1={};var _0x7f6fd8;var _0x2b763b;return db[_0x2567('0x40')][_0x2567('0x4c')]({'where':{'id':_0x2028e8[_0x2567('0x45')]['id']}})['then'](handleEntityNotFound(_0x360ba5,null))[_0x2567('0x26')](function(_0x3e02cb){if(_0x3e02cb){_0x7f6fd8=_0x3e02cb;_0x106cf1[_0x2567('0x30')]=_[_0x2567('0x32')](db[_0x2567('0x4d')][_0x2567('0x2c')]);_0x106cf1['query']=_['keys'](_0x2028e8['query']);_0x106cf1[_0x2567('0x33')]=_[_0x2567('0x34')](_0x106cf1[_0x2567('0x30')],_0x106cf1[_0x2567('0x31')]);_0x2215c7[_0x2567('0x35')]=_[_0x2567('0x34')](_0x106cf1['model'],qs[_0x2567('0x46')](_0x2028e8['query'][_0x2567('0x46')]));_0x2215c7['attributes']=_0x2215c7[_0x2567('0x35')][_0x2567('0x36')]?_0x2215c7[_0x2567('0x35')]:_0x106cf1[_0x2567('0x30')];_0x2215c7[_0x2567('0x37')]=qs[_0x2567('0x38')](_0x2028e8[_0x2567('0x31')][_0x2567('0x38')]);_0x2215c7['where']=qs[_0x2567('0x33')](_['pick'](_0x2028e8[_0x2567('0x31')],_0x106cf1[_0x2567('0x33')]));if(_0x2028e8['query'][_0x2567('0x3b')]){_0x2215c7[_0x2567('0x39')]=_['merge'](_0x2215c7[_0x2567('0x39')],{'$or':_[_0x2567('0x2b')](_0x2215c7['attributes'],function(_0x383b0a){var _0x5bdd73={};_0x5bdd73[_0x383b0a]={'$like':'%'+_0x2028e8[_0x2567('0x31')]['filter']+'%'};return _0x5bdd73;})});}_0x2215c7=_[_0x2567('0x4e')]({},_0x2215c7,_0x2028e8[_0x2567('0x3d')]);return _0x7f6fd8['getConfigurations'](_0x2215c7);}})[_0x2567('0x26')](function(_0x41f40d){if(_0x41f40d){_0x2b763b=_0x41f40d[_0x2567('0x36')];if(!_0x2028e8[_0x2567('0x31')][_0x2567('0x4f')](_0x2567('0x50'))){_0x2215c7[_0x2567('0x20')]=qs[_0x2567('0x20')](_0x2028e8[_0x2567('0x31')][_0x2567('0x20')]);_0x2215c7['offset']=qs['offset'](_0x2028e8[_0x2567('0x31')]['offset']);}return _0x7f6fd8['getConfigurations'](_0x2215c7);}})[_0x2567('0x26')](function(_0x234f9f){if(_0x234f9f){return _0x234f9f?{'count':_0x2b763b,'rows':_0x234f9f}:null;}})[_0x2567('0x26')](respondWithResult(_0x360ba5,null))['catch'](handleError(_0x360ba5,null));};exports[_0x2567('0x51')]=function(_0x4a4b7e,_0x5cecbb,_0x1d189b){if(_0x4a4b7e['body']['id']){delete _0x4a4b7e['body']['id'];}return db[_0x2567('0x40')]['findOne']({'where':{'id':_0x4a4b7e[_0x2567('0x45')]['id']}})[_0x2567('0x26')](handleEntityNotFound(_0x5cecbb,null))[_0x2567('0x26')](function(_0x1da176){if(_0x1da176){_0x4a4b7e['body'][_0x2567('0x52')]=_0x1da176['id'];_0x4a4b7e['body']['Subjects']=integrations['getSubjects'](_0x4a4b7e['body'][_0x2567('0x53')],_0x4a4b7e[_0x2567('0x48')][_0x2567('0x2e')]);_0x4a4b7e[_0x2567('0x48')][_0x2567('0x54')]=integrations[_0x2567('0x55')](_0x4a4b7e[_0x2567('0x48')][_0x2567('0x53')],_0x4a4b7e['body'][_0x2567('0x2e')]);return db['FreshsalesConfiguration'][_0x2567('0x47')](_0x4a4b7e[_0x2567('0x48')],{'include':[{'model':db[_0x2567('0x56')],'as':_0x2567('0x57')},{'model':db[_0x2567('0x56')],'as':_0x2567('0x54')}]});}return null;})['then'](respondWithResult(_0x5cecbb,null))[_0x2567('0x43')](handleError(_0x5cecbb,null));};exports[_0x2567('0x58')]=function(_0x4d6b55,_0x28f9a5,_0x524cdc){var _0x220eee='';var _0x1acb3c='';return db[_0x2567('0x40')][_0x2567('0x4c')]({'where':{'id':_0x4d6b55[_0x2567('0x45')]['id']},'attributes':['id',_0x2567('0x59'),_0x2567('0x5a'),_0x2567('0x5b')]})['then'](handleEntityNotFound(_0x28f9a5,null))[_0x2567('0x26')](function(_0x14b179){if(_0x14b179){_0x1acb3c=_0x14b179[_0x2567('0x59')];_0x220eee=_0x14b179['remoteUri'];var _0x2c9690=_0x14b179['remoteUri'][_0x2567('0x5c')](-0x1);if(_0x2c9690==='/'){_0x220eee=_0x220eee[_0x2567('0x5d')](0x0,_0x220eee['lastIndexOf'](_0x2c9690));}return rp({'method':_0x2567('0x5e'),'uri':util['format'](_0x2567('0x5f'),_0x220eee,_0x2567('0x60')),'headers':{'Authorization':_0x2567('0x61')+_0x14b179[_0x2567('0x5b')]},'json':!![]});}})[_0x2567('0x26')](function(_0x21be78){if(_0x21be78){var _0x556c91=_0x21be78[_0x2567('0x62')];var _0x35d77c=![];var _0x40b3b6=null;for(_0x40b3b6=0x0;_0x40b3b6<_0x556c91[_0x2567('0x36')];_0x40b3b6++){if(_0x556c91[_0x40b3b6][_0x2567('0x63')]===_0x1acb3c){_0x35d77c=!![];}}if(_0x35d77c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2567('0x64')});}}})[_0x2567('0x26')](respondWithResult(_0x28f9a5,null))['catch'](function(_0x5f38a0){var _0x23c3e3=_0x4d6b55[_0x2567('0x31')][_0x2567('0x65')]?0x1f4:_0x5f38a0[_0x2567('0x66')]||0x1f4;logger[_0x2567('0x67')](_0x2567('0x68'),_0x2567('0x58'),_0x23c3e3,JSON['stringify'](_0x5f38a0));delete _0x5f38a0['name'];if(_0x23c3e3===0x191){_0x23c3e3=0x190;}_0x28f9a5[_0x2567('0x1d')](_0x23c3e3)['send'](_0x4d6b55[_0x2567('0x31')][_0x2567('0x65')]?{'message':_0x2567('0x69'),'statusCode':_0x5f38a0[_0x2567('0x66')]}:_0x5f38a0);});}; \ No newline at end of file +var _0x2f29=['format','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','stringify','Wrong\x20credentials','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','findAll','rows','catch','params','fields','includeAll','include','options','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET'];(function(_0x1e24b1,_0x14ab30){var _0x212baf=function(_0x2bd3e9){while(--_0x2bd3e9){_0x1e24b1['push'](_0x1e24b1['shift']());}};_0x212baf(++_0x14ab30);}(_0x2f29,0x197));var _0x92f2=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x2f29[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x92f2('0x0'));var rp=require(_0x92f2('0x1'));var moment=require(_0x92f2('0x2'));var BPromise=require(_0x92f2('0x3'));var Mustache=require(_0x92f2('0x4'));var util=require(_0x92f2('0x5'));var path=require(_0x92f2('0x6'));var sox=require(_0x92f2('0x7'));var csv=require(_0x92f2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92f2('0x9'));var _=require(_0x92f2('0xa'));var squel=require(_0x92f2('0xb'));var crypto=require(_0x92f2('0xc'));var jsforce=require(_0x92f2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x92f2('0xe'));var Papa=require(_0x92f2('0xf'));var Redis=require('ioredis');var authService=require(_0x92f2('0x10'));var qs=require(_0x92f2('0x11'));var as=require(_0x92f2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92f2('0x13'))(_0x92f2('0x14'));var utils=require('../../config/utils');var config=require(_0x92f2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x92f2('0x16'))['db'];var integrations=require(_0x92f2('0x17'));function respondWithStatusCode(_0x5a6064,_0x3e0135){_0x3e0135=_0x3e0135||0xcc;return function(_0x3b704c){if(_0x3b704c){return _0x5a6064[_0x92f2('0x18')](_0x3e0135);}return _0x5a6064['status'](_0x3e0135)['end']();};}function respondWithResult(_0x3d736e,_0x33e50c){_0x33e50c=_0x33e50c||0xc8;return function(_0x2fa648){if(_0x2fa648){return _0x3d736e[_0x92f2('0x19')](_0x33e50c)['json'](_0x2fa648);}};}function respondWithFilteredResult(_0x36fe11,_0x4a1a49){return function(_0x186e95){if(_0x186e95){var _0x1f20aa=typeof _0x4a1a49['offset']===_0x92f2('0x1a')&&typeof _0x4a1a49[_0x92f2('0x1b')]==='undefined';var _0x4804a7=_0x186e95[_0x92f2('0x1c')];var _0xe7deca=_0x1f20aa?0x0:_0x4a1a49[_0x92f2('0x1d')];var _0x107960=_0x1f20aa?_0x186e95[_0x92f2('0x1c')]:_0x4a1a49[_0x92f2('0x1d')]+_0x4a1a49[_0x92f2('0x1b')];var _0x4c0fe9;if(_0x107960>=_0x4804a7){_0x107960=_0x4804a7;_0x4c0fe9=0xc8;}else{_0x4c0fe9=0xce;}_0x36fe11[_0x92f2('0x19')](_0x4c0fe9);return _0x36fe11['set'](_0x92f2('0x1e'),_0xe7deca+'-'+_0x107960+'/'+_0x4804a7)[_0x92f2('0x1f')](_0x186e95);}return null;};}function patchUpdates(_0x4a3c4a){return function(_0x1e93ab){try{jsonpatch[_0x92f2('0x20')](_0x1e93ab,_0x4a3c4a,!![]);}catch(_0x407751){return BPromise[_0x92f2('0x21')](_0x407751);}return _0x1e93ab[_0x92f2('0x22')]();};}function saveUpdates(_0x494fdc,_0x4c7c32){return function(_0x410fe2){if(_0x410fe2){return _0x410fe2[_0x92f2('0x23')](_0x494fdc)[_0x92f2('0x24')](function(_0x1840a8){return _0x1840a8;});}return null;};}function removeEntity(_0xd53a69,_0x380fe9){return function(_0x15f621){if(_0x15f621){return _0x15f621['destroy']()[_0x92f2('0x24')](function(){_0xd53a69['status'](0xcc)[_0x92f2('0x25')]();});}};}function handleEntityNotFound(_0x73608d,_0x8ac543){return function(_0x20db05){if(!_0x20db05){_0x73608d[_0x92f2('0x18')](0x194);}return _0x20db05;};}function handleError(_0x14f512,_0x2c356a){_0x2c356a=_0x2c356a||0x1f4;return function(_0x36c765){logger[_0x92f2('0x26')](_0x36c765[_0x92f2('0x27')]);if(_0x36c765[_0x92f2('0x28')]){delete _0x36c765['name'];}_0x14f512['status'](_0x2c356a)[_0x92f2('0x29')](_0x36c765);};}exports[_0x92f2('0x2a')]=function(_0x395156,_0x32aa8f){var _0x108b55={},_0x1e2e08={},_0x5dbb99={'count':0x0,'rows':[]};var _0x32dea3=_['map'](db[_0x92f2('0x2b')][_0x92f2('0x2c')],function(_0x20dcfc){return{'name':_0x20dcfc[_0x92f2('0x2d')],'type':_0x20dcfc[_0x92f2('0x2e')][_0x92f2('0x2f')]};});_0x1e2e08['model']=_[_0x92f2('0x30')](_0x32dea3,_0x92f2('0x28'));_0x1e2e08[_0x92f2('0x31')]=_[_0x92f2('0x32')](_0x395156[_0x92f2('0x31')]);_0x1e2e08['filters']=_[_0x92f2('0x33')](_0x1e2e08[_0x92f2('0x34')],_0x1e2e08[_0x92f2('0x31')]);_0x108b55[_0x92f2('0x35')]=_['intersection'](_0x1e2e08[_0x92f2('0x34')],qs['fields'](_0x395156[_0x92f2('0x31')]['fields']));_0x108b55[_0x92f2('0x35')]=_0x108b55['attributes'][_0x92f2('0x36')]?_0x108b55[_0x92f2('0x35')]:_0x1e2e08[_0x92f2('0x34')];if(!_0x395156[_0x92f2('0x31')][_0x92f2('0x37')](_0x92f2('0x38'))){_0x108b55[_0x92f2('0x1b')]=qs[_0x92f2('0x1b')](_0x395156[_0x92f2('0x31')]['limit']);_0x108b55['offset']=qs[_0x92f2('0x1d')](_0x395156[_0x92f2('0x31')][_0x92f2('0x1d')]);}_0x108b55['order']=qs[_0x92f2('0x39')](_0x395156[_0x92f2('0x31')]['sort']);_0x108b55[_0x92f2('0x3a')]=qs[_0x92f2('0x3b')](_['pick'](_0x395156[_0x92f2('0x31')],_0x1e2e08['filters']),_0x32dea3);if(_0x395156[_0x92f2('0x31')][_0x92f2('0x3c')]){_0x108b55[_0x92f2('0x3a')]=_[_0x92f2('0x3d')](_0x108b55['where'],{'$or':_[_0x92f2('0x30')](_0x32dea3,function(_0x352ba3){if(_0x352ba3[_0x92f2('0x2e')]!==_0x92f2('0x3e')){var _0x10bef7={};_0x10bef7[_0x352ba3[_0x92f2('0x28')]]={'$like':'%'+_0x395156[_0x92f2('0x31')][_0x92f2('0x3c')]+'%'};return _0x10bef7;}})});}_0x108b55=_[_0x92f2('0x3d')]({},_0x108b55,_0x395156['options']);var _0x187380={'where':_0x108b55[_0x92f2('0x3a')]};return db[_0x92f2('0x2b')]['count'](_0x187380)[_0x92f2('0x24')](function(_0x47f36d){_0x5dbb99['count']=_0x47f36d;if(_0x395156['query']['includeAll']){_0x108b55['include']=[{'all':!![]}];}return db[_0x92f2('0x2b')][_0x92f2('0x3f')](_0x108b55);})[_0x92f2('0x24')](function(_0xac213a){_0x5dbb99[_0x92f2('0x40')]=_0xac213a;return _0x5dbb99;})[_0x92f2('0x24')](respondWithFilteredResult(_0x32aa8f,_0x108b55))[_0x92f2('0x41')](handleError(_0x32aa8f,null));};exports['show']=function(_0x31caa5,_0x519747){var _0x2ffea7={'raw':![],'where':{'id':_0x31caa5[_0x92f2('0x42')]['id']}},_0x57da5f={};_0x57da5f[_0x92f2('0x34')]=_[_0x92f2('0x32')](db[_0x92f2('0x2b')][_0x92f2('0x2c')]);_0x57da5f[_0x92f2('0x31')]=_['keys'](_0x31caa5[_0x92f2('0x31')]);_0x57da5f[_0x92f2('0x3b')]=_['intersection'](_0x57da5f['model'],_0x57da5f['query']);_0x2ffea7[_0x92f2('0x35')]=_[_0x92f2('0x33')](_0x57da5f[_0x92f2('0x34')],qs[_0x92f2('0x43')](_0x31caa5[_0x92f2('0x31')][_0x92f2('0x43')]));_0x2ffea7[_0x92f2('0x35')]=_0x2ffea7[_0x92f2('0x35')][_0x92f2('0x36')]?_0x2ffea7['attributes']:_0x57da5f[_0x92f2('0x34')];if(_0x31caa5[_0x92f2('0x31')][_0x92f2('0x44')]){_0x2ffea7[_0x92f2('0x45')]=[{'all':!![]}];}_0x2ffea7=_[_0x92f2('0x3d')]({},_0x2ffea7,_0x31caa5[_0x92f2('0x46')]);return db[_0x92f2('0x2b')][_0x92f2('0x47')](_0x2ffea7)[_0x92f2('0x24')](handleEntityNotFound(_0x519747,null))[_0x92f2('0x24')](respondWithResult(_0x519747,null))[_0x92f2('0x41')](handleError(_0x519747,null));};exports[_0x92f2('0x48')]=function(_0x542d5a,_0x3eff1c){return db[_0x92f2('0x2b')][_0x92f2('0x48')](_0x542d5a[_0x92f2('0x49')],{})[_0x92f2('0x24')](respondWithResult(_0x3eff1c,0xc9))[_0x92f2('0x41')](handleError(_0x3eff1c,null));};exports[_0x92f2('0x23')]=function(_0x1c597d,_0x981c77){if(_0x1c597d[_0x92f2('0x49')]['id']){delete _0x1c597d['body']['id'];}return db[_0x92f2('0x2b')][_0x92f2('0x47')]({'where':{'id':_0x1c597d[_0x92f2('0x42')]['id']}})[_0x92f2('0x24')](handleEntityNotFound(_0x981c77,null))[_0x92f2('0x24')](saveUpdates(_0x1c597d[_0x92f2('0x49')],null))[_0x92f2('0x24')](respondWithResult(_0x981c77,null))['catch'](handleError(_0x981c77,null));};exports[_0x92f2('0x4a')]=function(_0x2a3c24,_0x21bba7){return db['FreshsalesAccount']['find']({'where':{'id':_0x2a3c24[_0x92f2('0x42')]['id']}})[_0x92f2('0x24')](handleEntityNotFound(_0x21bba7,null))[_0x92f2('0x24')](removeEntity(_0x21bba7,null))[_0x92f2('0x41')](handleError(_0x21bba7,null));};exports[_0x92f2('0x4b')]=function(_0x1ffaa5,_0x414431,_0x549245){var _0xf4cc2f={};var _0x3a3c7d={};var _0x420eac;var _0x4cd57f;return db[_0x92f2('0x2b')][_0x92f2('0x4c')]({'where':{'id':_0x1ffaa5['params']['id']}})[_0x92f2('0x24')](handleEntityNotFound(_0x414431,null))[_0x92f2('0x24')](function(_0x288529){if(_0x288529){_0x420eac=_0x288529;_0x3a3c7d[_0x92f2('0x34')]=_[_0x92f2('0x32')](db[_0x92f2('0x4d')][_0x92f2('0x2c')]);_0x3a3c7d['query']=_[_0x92f2('0x32')](_0x1ffaa5['query']);_0x3a3c7d[_0x92f2('0x3b')]=_[_0x92f2('0x33')](_0x3a3c7d[_0x92f2('0x34')],_0x3a3c7d[_0x92f2('0x31')]);_0xf4cc2f[_0x92f2('0x35')]=_[_0x92f2('0x33')](_0x3a3c7d[_0x92f2('0x34')],qs[_0x92f2('0x43')](_0x1ffaa5[_0x92f2('0x31')][_0x92f2('0x43')]));_0xf4cc2f['attributes']=_0xf4cc2f['attributes'][_0x92f2('0x36')]?_0xf4cc2f[_0x92f2('0x35')]:_0x3a3c7d[_0x92f2('0x34')];_0xf4cc2f['order']=qs[_0x92f2('0x39')](_0x1ffaa5[_0x92f2('0x31')][_0x92f2('0x39')]);_0xf4cc2f['where']=qs[_0x92f2('0x3b')](_[_0x92f2('0x4e')](_0x1ffaa5[_0x92f2('0x31')],_0x3a3c7d[_0x92f2('0x3b')]));if(_0x1ffaa5[_0x92f2('0x31')]['filter']){_0xf4cc2f[_0x92f2('0x3a')]=_['merge'](_0xf4cc2f['where'],{'$or':_['map'](_0xf4cc2f['attributes'],function(_0x3c3099){var _0x48721c={};_0x48721c[_0x3c3099]={'$like':'%'+_0x1ffaa5[_0x92f2('0x31')]['filter']+'%'};return _0x48721c;})});}_0xf4cc2f=_[_0x92f2('0x3d')]({},_0xf4cc2f,_0x1ffaa5[_0x92f2('0x46')]);return _0x420eac[_0x92f2('0x4b')](_0xf4cc2f);}})[_0x92f2('0x24')](function(_0x369094){if(_0x369094){_0x4cd57f=_0x369094[_0x92f2('0x36')];if(!_0x1ffaa5[_0x92f2('0x31')][_0x92f2('0x37')](_0x92f2('0x38'))){_0xf4cc2f[_0x92f2('0x1b')]=qs['limit'](_0x1ffaa5[_0x92f2('0x31')]['limit']);_0xf4cc2f[_0x92f2('0x1d')]=qs[_0x92f2('0x1d')](_0x1ffaa5[_0x92f2('0x31')]['offset']);}return _0x420eac[_0x92f2('0x4b')](_0xf4cc2f);}})[_0x92f2('0x24')](function(_0x264a1b){if(_0x264a1b){return _0x264a1b?{'count':_0x4cd57f,'rows':_0x264a1b}:null;}})[_0x92f2('0x24')](respondWithResult(_0x414431,null))[_0x92f2('0x41')](handleError(_0x414431,null));};exports[_0x92f2('0x4f')]=function(_0x12db47,_0x355e56,_0x4a92c9){if(_0x12db47[_0x92f2('0x49')]['id']){delete _0x12db47[_0x92f2('0x49')]['id'];}return db['FreshsalesAccount'][_0x92f2('0x4c')]({'where':{'id':_0x12db47[_0x92f2('0x42')]['id']}})[_0x92f2('0x24')](handleEntityNotFound(_0x355e56,null))[_0x92f2('0x24')](function(_0x241aac){if(_0x241aac){_0x12db47['body'][_0x92f2('0x50')]=_0x241aac['id'];_0x12db47[_0x92f2('0x49')][_0x92f2('0x51')]=integrations['getSubjects'](_0x12db47['body'][_0x92f2('0x52')],_0x12db47[_0x92f2('0x49')]['type']);_0x12db47[_0x92f2('0x49')][_0x92f2('0x53')]=integrations['getDescriptions'](_0x12db47[_0x92f2('0x49')][_0x92f2('0x52')],_0x12db47[_0x92f2('0x49')][_0x92f2('0x2e')]);return db[_0x92f2('0x4d')][_0x92f2('0x48')](_0x12db47[_0x92f2('0x49')],{'include':[{'model':db[_0x92f2('0x54')],'as':_0x92f2('0x51')},{'model':db[_0x92f2('0x54')],'as':_0x92f2('0x53')}]});}return null;})['then'](respondWithResult(_0x355e56,null))[_0x92f2('0x41')](handleError(_0x355e56,null));};exports[_0x92f2('0x55')]=function(_0x4a7a3a,_0x2917e7,_0x48b08d){var _0x811f9f='';var _0x20ef9c='';return db[_0x92f2('0x2b')]['findOne']({'where':{'id':_0x4a7a3a[_0x92f2('0x42')]['id']},'attributes':['id',_0x92f2('0x56'),_0x92f2('0x57'),_0x92f2('0x58')]})[_0x92f2('0x24')](handleEntityNotFound(_0x2917e7,null))[_0x92f2('0x24')](function(_0x4e37bf){if(_0x4e37bf){_0x20ef9c=_0x4e37bf['username'];_0x811f9f=_0x4e37bf[_0x92f2('0x57')];var _0x580261=_0x4e37bf['remoteUri'][_0x92f2('0x59')](-0x1);if(_0x580261==='/'){_0x811f9f=_0x811f9f[_0x92f2('0x5a')](0x0,_0x811f9f[_0x92f2('0x5b')](_0x580261));}return rp({'method':_0x92f2('0x5c'),'uri':util[_0x92f2('0x5d')]('%s%s',_0x811f9f,'/api/selector/owners'),'headers':{'Authorization':_0x92f2('0x5e')+_0x4e37bf[_0x92f2('0x58')]},'json':!![]});}})[_0x92f2('0x24')](function(_0x31e8a4){if(_0x31e8a4){var _0x20b9ce=_0x31e8a4['users'];var _0x48daab=![];var _0x5524a6=null;for(_0x5524a6=0x0;_0x5524a6<_0x20b9ce[_0x92f2('0x36')];_0x5524a6++){if(_0x20b9ce[_0x5524a6][_0x92f2('0x5f')]===_0x20ef9c){_0x48daab=!![];}}if(_0x48daab){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x92f2('0x60')});}}})['then'](respondWithResult(_0x2917e7,null))[_0x92f2('0x41')](function(_0x229556){var _0x322ce8=_0x4a7a3a[_0x92f2('0x31')][_0x92f2('0x61')]?0x1f4:_0x229556['statusCode']||0x1f4;logger[_0x92f2('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x92f2('0x55'),_0x322ce8,JSON[_0x92f2('0x62')](_0x229556));delete _0x229556['name'];if(_0x322ce8===0x191){_0x322ce8=0x190;}_0x2917e7[_0x92f2('0x19')](_0x322ce8)[_0x92f2('0x29')](_0x4a7a3a[_0x92f2('0x31')][_0x92f2('0x61')]?{'message':_0x92f2('0x63'),'statusCode':_0x229556['statusCode']}:_0x229556);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 7e45aef..5bc7cc8 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 _0x5430=['../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x43444b,_0x8cf95b){var _0x392fe5=function(_0x7a1a82){while(--_0x7a1a82){_0x43444b['push'](_0x43444b['shift']());}};_0x392fe5(++_0x8cf95b);}(_0x5430,0x10c));var _0x0543=function(_0x1d32be,_0x357aae){_0x1d32be=_0x1d32be-0x0;var _0x18c7ea=_0x5430[_0x1d32be];return _0x18c7ea;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x0543('0x7'));module[_0x0543('0x8')]=function(_0x9754ba,_0x319568){return _0x9754ba[_0x0543('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x0543('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25e7=['request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x132710,_0x1b980b){var _0x26923c=function(_0x526e39){while(--_0x526e39){_0x132710['push'](_0x132710['shift']());}};_0x26923c(++_0x1b980b);}(_0x25e7,0x1d6));var _0x725e=function(_0x3517e5,_0x2c3608){_0x3517e5=_0x3517e5-0x0;var _0x15ba05=_0x25e7[_0x3517e5];return _0x15ba05;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x725e('0xa')]=function(_0x480945,_0x481316){return _0x480945[_0x725e('0xb')](_0x725e('0xc'),attributes,{'tableName':_0x725e('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 b04247a..b51bbdb 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 _0xafb9=['ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','limit','map','attributes','include','model','debug'];(function(_0x1d9536,_0x38415e){var _0x534207=function(_0x4fcde2){while(--_0x4fcde2){_0x1d9536['push'](_0x1d9536['shift']());}};_0x534207(++_0x38415e);}(_0xafb9,0x68));var _0x9afb=function(_0x4758ee,_0x229746){_0x4758ee=_0x4758ee-0x0;var _0x13c007=_0xafb9[_0x4758ee];return _0x13c007;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var moment=require(_0x9afb('0x2'));var BPromise=require(_0x9afb('0x3'));var rs=require(_0x9afb('0x4'));var fs=require('fs');var Redis=require(_0x9afb('0x5'));var db=require(_0x9afb('0x6'))['db'];var utils=require(_0x9afb('0x7'));var logger=require(_0x9afb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9afb('0x9'));var client=jayson['client'][_0x9afb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548b24,_0x556880,_0x4c0e9d){return new BPromise(function(_0x1edf77,_0x20b8c1){return client['request'](_0x548b24,_0x4c0e9d)[_0x9afb('0xb')](function(_0x3e0264){logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x556880,_0x9afb('0xe'),JSON[_0x9afb('0xf')](_0x3e0264));if(_0x3e0264[_0x9afb('0x10')]){if(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x11')]===0x1f4){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);return _0x20b8c1(_0x3e0264[_0x9afb('0x10')]['message']);}logger[_0x9afb('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x556880,_0x3e0264['error'][_0x9afb('0x12')]);return _0x1edf77(_0x3e0264[_0x9afb('0x10')][_0x9afb('0x12')]);}else{logger[_0x9afb('0xc')](_0x9afb('0xd'),_0x556880,_0x9afb('0xe'));_0x1edf77(_0x3e0264[_0x9afb('0x13')]['message']);}})[_0x9afb('0x14')](function(_0x2145c2){logger[_0x9afb('0x10')](_0x9afb('0xd'),_0x556880,_0x2145c2);_0x20b8c1(_0x2145c2);});});}exports[_0x9afb('0x15')]=function(_0x508433){var _0x201ff4=this;return new Promise(function(_0x50a7e4,_0x3fdb34){return db[_0x9afb('0x16')]['findAll']({'raw':_0x508433['options']?_0x508433[_0x9afb('0x17')][_0x9afb('0x18')]===undefined?!![]:![]:!![],'where':_0x508433[_0x9afb('0x17')]?_0x508433[_0x9afb('0x17')][_0x9afb('0x19')]||null:null,'attributes':_0x508433['options']?_0x508433[_0x9afb('0x17')]['attributes']||null:null,'limit':_0x508433['options']?_0x508433[_0x9afb('0x17')][_0x9afb('0x1a')]||null:null,'include':_0x508433[_0x9afb('0x17')]?_0x508433[_0x9afb('0x17')]['include']?_[_0x9afb('0x1b')](_0x508433[_0x9afb('0x17')]['include'],function(_0x571bd9){return{'model':db[_0x571bd9['model']],'as':_0x571bd9['as'],'attributes':_0x571bd9[_0x9afb('0x1c')],'include':_0x571bd9['include']?_[_0x9afb('0x1b')](_0x571bd9[_0x9afb('0x1d')],function(_0x50a919){return{'model':db[_0x50a919[_0x9afb('0x1e')]],'as':_0x50a919['as'],'attributes':_0x50a919[_0x9afb('0x1c')],'include':_0x50a919[_0x9afb('0x1d')]?_[_0x9afb('0x1b')](_0x50a919['include'],function(_0x348255){return{'model':db[_0x348255['model']],'as':_0x348255['as'],'attributes':_0x348255[_0x9afb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5692fa){logger[_0x9afb('0xc')](_0x9afb('0x15'),_0x508433);logger[_0x9afb('0x1f')](_0x9afb('0x15'),_0x508433,JSON[_0x9afb('0xf')](_0x5692fa));_0x50a7e4(_0x5692fa);})[_0x9afb('0x14')](function(_0x46673d){logger['error']('GetFreshsalesAccount',_0x46673d[_0x9afb('0x12')],_0x508433);_0x3fdb34(_0x201ff4[_0x9afb('0x10')](0x1f4,_0x46673d['message']));});});};exports[_0x9afb('0x20')]=function(_0x2f388c){var _0x5560bd=this;return new Promise(function(_0x1b9f18,_0xc220e9){return db[_0x9afb('0x16')][_0x9afb('0x21')]({'raw':_0x2f388c[_0x9afb('0x17')]?_0x2f388c[_0x9afb('0x17')][_0x9afb('0x18')]===undefined?!![]:![]:!![],'where':_0x2f388c[_0x9afb('0x17')]?_0x2f388c['options']['where']||null:null,'attributes':_0x2f388c[_0x9afb('0x17')]?_0x2f388c[_0x9afb('0x17')][_0x9afb('0x1c')]||null:null,'include':_0x2f388c[_0x9afb('0x17')]?_0x2f388c[_0x9afb('0x17')][_0x9afb('0x1d')]?_[_0x9afb('0x1b')](_0x2f388c['options']['include'],function(_0x67d63a){return{'model':db[_0x67d63a[_0x9afb('0x1e')]],'as':_0x67d63a['as'],'attributes':_0x67d63a['attributes'],'include':_0x67d63a[_0x9afb('0x1d')]?_['map'](_0x67d63a[_0x9afb('0x1d')],function(_0xc59d55){return{'model':db[_0xc59d55['model']],'as':_0xc59d55['as'],'attributes':_0xc59d55[_0x9afb('0x1c')],'include':_0xc59d55['include']?_[_0x9afb('0x1b')](_0xc59d55[_0x9afb('0x1d')],function(_0x45c57f){return{'model':db[_0x45c57f[_0x9afb('0x1e')]],'as':_0x45c57f['as'],'attributes':_0x45c57f[_0x9afb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9afb('0xb')](function(_0x19227f){logger[_0x9afb('0xc')]('ShowFreshsalesAccount',_0x2f388c);logger[_0x9afb('0x1f')]('ShowFreshsalesAccount',_0x2f388c,JSON[_0x9afb('0xf')](_0x19227f));_0x1b9f18(_0x19227f);})[_0x9afb('0x14')](function(_0x3c5231){logger[_0x9afb('0x10')](_0x9afb('0x20'),_0x3c5231[_0x9afb('0x12')],_0x2f388c);_0xc220e9(_0x5560bd[_0x9afb('0x10')](0x1f4,_0x3c5231[_0x9afb('0x12')]));});});}; \ No newline at end of file +var _0xc2c7=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','catch','find','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2d2d8d,_0x47d40e){var _0x36ff00=function(_0x35cb55){while(--_0x35cb55){_0x2d2d8d['push'](_0x2d2d8d['shift']());}};_0x36ff00(++_0x47d40e);}(_0xc2c7,0x134));var _0x7c2c=function(_0x295fa0,_0xf95931){_0x295fa0=_0x295fa0-0x0;var _0x3615af=_0xc2c7[_0x295fa0];return _0x3615af;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});}exports[_0x7c2c('0x15')]=function(_0x14453f){var _0x2a9539=this;return new Promise(function(_0x17df4a,_0x26be0f){return db[_0x7c2c('0x16')][_0x7c2c('0x17')]({'raw':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x19')]===undefined?!![]:![]:!![],'where':_0x14453f[_0x7c2c('0x18')]?_0x14453f['options'][_0x7c2c('0x1a')]||null:null,'attributes':_0x14453f['options']?_0x14453f['options'][_0x7c2c('0x1b')]||null:null,'limit':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x1c')]||null:null,'include':_0x14453f[_0x7c2c('0x18')]?_0x14453f[_0x7c2c('0x18')][_0x7c2c('0x1d')]?_['map'](_0x14453f[_0x7c2c('0x18')]['include'],function(_0x302c93){return{'model':db[_0x302c93['model']],'as':_0x302c93['as'],'attributes':_0x302c93[_0x7c2c('0x1b')],'include':_0x302c93[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x302c93['include'],function(_0x4d6ec7){return{'model':db[_0x4d6ec7[_0x7c2c('0x1f')]],'as':_0x4d6ec7['as'],'attributes':_0x4d6ec7[_0x7c2c('0x1b')],'include':_0x4d6ec7[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x4d6ec7[_0x7c2c('0x1d')],function(_0xa8e145){return{'model':db[_0xa8e145[_0x7c2c('0x1f')]],'as':_0xa8e145['as'],'attributes':_0xa8e145['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xc')](function(_0xf39941){logger[_0x7c2c('0x20')](_0x7c2c('0x15'),_0x14453f);logger[_0x7c2c('0xf')](_0x7c2c('0x15'),_0x14453f,JSON[_0x7c2c('0x11')](_0xf39941));_0x17df4a(_0xf39941);})[_0x7c2c('0x21')](function(_0xa040ff){logger['error'](_0x7c2c('0x15'),_0xa040ff[_0x7c2c('0x14')],_0x14453f);_0x26be0f(_0x2a9539[_0x7c2c('0x12')](0x1f4,_0xa040ff[_0x7c2c('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0xcb98ba){var _0x30dd1c=this;return new Promise(function(_0x4192c8,_0x1ef88b){return db[_0x7c2c('0x16')][_0x7c2c('0x22')]({'raw':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options'][_0x7c2c('0x19')]===undefined?!![]:![]:!![],'where':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba[_0x7c2c('0x18')][_0x7c2c('0x1a')]||null:null,'attributes':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options']['attributes']||null:null,'include':_0xcb98ba[_0x7c2c('0x18')]?_0xcb98ba['options']['include']?_[_0x7c2c('0x1e')](_0xcb98ba[_0x7c2c('0x18')][_0x7c2c('0x1d')],function(_0x156c03){return{'model':db[_0x156c03['model']],'as':_0x156c03['as'],'attributes':_0x156c03[_0x7c2c('0x1b')],'include':_0x156c03[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x156c03[_0x7c2c('0x1d')],function(_0x204968){return{'model':db[_0x204968[_0x7c2c('0x1f')]],'as':_0x204968['as'],'attributes':_0x204968[_0x7c2c('0x1b')],'include':_0x204968[_0x7c2c('0x1d')]?_[_0x7c2c('0x1e')](_0x204968[_0x7c2c('0x1d')],function(_0x3230a1){return{'model':db[_0x3230a1[_0x7c2c('0x1f')]],'as':_0x3230a1['as'],'attributes':_0x3230a1[_0x7c2c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54cbb7){logger[_0x7c2c('0x20')]('ShowFreshsalesAccount',_0xcb98ba);logger['debug']('ShowFreshsalesAccount',_0xcb98ba,JSON[_0x7c2c('0x11')](_0x54cbb7));_0x4192c8(_0x54cbb7);})[_0x7c2c('0x21')](function(_0x129bf0){logger[_0x7c2c('0x12')](_0x7c2c('0x23'),_0x129bf0[_0x7c2c('0x14')],_0xcb98ba);_0x1ef88b(_0x30dd1c[_0x7c2c('0x12')](0x1f4,_0x129bf0[_0x7c2c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index f5aff94..93b8b53 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 _0xad00=['exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','getDescriptions','/:id/fields','getFields','post','create','/:id','update','delete'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xad00,0x177));var _0x0ad0=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xad00[_0x43776a];return _0x18eb8f;};'use strict';var multer=require('multer');var util=require(_0x0ad0('0x0'));var path=require(_0x0ad0('0x1'));var timeout=require(_0x0ad0('0x2'));var express=require(_0x0ad0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0ad0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0ad0('0x5'));var controller=require(_0x0ad0('0x6'));router[_0x0ad0('0x7')]('/',auth[_0x0ad0('0x8')](),controller[_0x0ad0('0x9')]);router[_0x0ad0('0x7')]('/:id',auth[_0x0ad0('0x8')](),controller[_0x0ad0('0xa')]);router[_0x0ad0('0x7')](_0x0ad0('0xb'),auth[_0x0ad0('0x8')](),controller[_0x0ad0('0xc')]);router[_0x0ad0('0x7')]('/:id/descriptions',auth[_0x0ad0('0x8')](),controller[_0x0ad0('0xd')]);router[_0x0ad0('0x7')](_0x0ad0('0xe'),auth[_0x0ad0('0x8')](),controller[_0x0ad0('0xf')]);router[_0x0ad0('0x10')]('/',auth[_0x0ad0('0x8')](),controller[_0x0ad0('0x11')]);router['put'](_0x0ad0('0x12'),auth[_0x0ad0('0x8')](),controller[_0x0ad0('0x13')]);router[_0x0ad0('0x14')](_0x0ad0('0x12'),auth[_0x0ad0('0x8')](),controller['destroy']);module[_0x0ad0('0x15')]=router; \ No newline at end of file +var _0xd0eb=['create','put','update','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','show','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x7b5ee0,_0x32bbcc){var _0x3c995a=function(_0x1b3f9e){while(--_0x1b3f9e){_0x7b5ee0['push'](_0x7b5ee0['shift']());}};_0x3c995a(++_0x32bbcc);}(_0xd0eb,0x1d4));var _0xbd0e=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0xd0eb[_0x387dc1];return _0x17567c;};'use strict';var multer=require(_0xbd0e('0x0'));var util=require(_0xbd0e('0x1'));var path=require('path');var timeout=require(_0xbd0e('0x2'));var express=require('express');var router=express[_0xbd0e('0x3')]();var fs_extra=require(_0xbd0e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbd0e('0x5'));var config=require(_0xbd0e('0x6'));var controller=require(_0xbd0e('0x7'));router['get']('/',auth[_0xbd0e('0x8')](),controller[_0xbd0e('0x9')]);router[_0xbd0e('0xa')]('/:id',auth[_0xbd0e('0x8')](),controller[_0xbd0e('0xb')]);router[_0xbd0e('0xa')]('/:id/subjects',auth[_0xbd0e('0x8')](),controller[_0xbd0e('0xc')]);router[_0xbd0e('0xa')](_0xbd0e('0xd'),auth[_0xbd0e('0x8')](),controller[_0xbd0e('0xe')]);router[_0xbd0e('0xa')]('/:id/fields',auth[_0xbd0e('0x8')](),controller['getFields']);router['post']('/',auth[_0xbd0e('0x8')](),controller[_0xbd0e('0xf')]);router[_0xbd0e('0x10')]('/:id',auth[_0xbd0e('0x8')](),controller[_0xbd0e('0x11')]);router['delete'](_0xbd0e('0x12'),auth[_0xbd0e('0x8')](),controller[_0xbd0e('0x13')]);module[_0xbd0e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index a4a657f..a0f325d 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 _0x716b=['STRING'];(function(_0x15ce26,_0x44893d){var _0x51588f=function(_0x115e5c){while(--_0x115e5c){_0x15ce26['push'](_0x15ce26['shift']());}};_0x51588f(++_0x44893d);}(_0x716b,0xda));var _0xb716=function(_0x58f401,_0x1136c9){_0x58f401=_0x58f401-0x0;var _0x146e3d=_0x716b[_0x58f401];return _0x146e3d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb716('0x0')]},'description':{'type':Sequelize[_0xb716('0x0')]}}; \ No newline at end of file +var _0xcfe0=['sequelize','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcfe0,0xcc));var _0x0cfe=function(_0x177b36,_0x15536b){_0x177b36=_0x177b36-0x0;var _0x50a20c=_0xcfe0[_0x177b36];return _0x50a20c;};'use strict';var Sequelize=require(_0x0cfe('0x0'));module[_0x0cfe('0x1')]={'name':{'type':Sequelize[_0x0cfe('0x2')]},'description':{'type':Sequelize[_0x0cfe('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 5d7679c..1dcdc81 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 _0xcb8f=['moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','filter','includeAll','include','rows','catch','params','keys','find','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','rawAttributes','options','getFields','eml-format','zip-dir','fast-json-patch'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xcb8f,0xdb));var _0xfcb8=function(_0x52446c,_0x2f5a0d){_0x52446c=_0x52446c-0x0;var _0x32cd29=_0xcb8f[_0x52446c];return _0x32cd29;};'use strict';var emlformat=require(_0xfcb8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcb8('0x1'));var jsonpatch=require(_0xfcb8('0x2'));var rp=require('request-promise');var moment=require(_0xfcb8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfcb8('0x4'));var util=require(_0xfcb8('0x5'));var path=require('path');var sox=require(_0xfcb8('0x6'));var csv=require('to-csv');var ejs=require(_0xfcb8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcb8('0x8'));var squel=require(_0xfcb8('0x9'));var crypto=require(_0xfcb8('0xa'));var jsforce=require(_0xfcb8('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfcb8('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfcb8('0xd'));var qs=require(_0xfcb8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcb8('0xf'))('api');var utils=require(_0xfcb8('0x10'));var config=require(_0xfcb8('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xfcb8('0x12'))['db'];function respondWithStatusCode(_0x4c3897,_0x3d8b5c){_0x3d8b5c=_0x3d8b5c||0xcc;return function(_0x41bfbe){if(_0x41bfbe){return _0x4c3897['sendStatus'](_0x3d8b5c);}return _0x4c3897[_0xfcb8('0x13')](_0x3d8b5c)[_0xfcb8('0x14')]();};}function respondWithResult(_0x1d6baf,_0x34de87){_0x34de87=_0x34de87||0xc8;return function(_0x4f9e29){if(_0x4f9e29){return _0x1d6baf[_0xfcb8('0x13')](_0x34de87)['json'](_0x4f9e29);}};}function respondWithFilteredResult(_0x39c0a2,_0x233b37){return function(_0x8a1532){if(_0x8a1532){var _0x2a2b85=typeof _0x233b37[_0xfcb8('0x15')]==='undefined'&&typeof _0x233b37['limit']===_0xfcb8('0x16');var _0x499dc2=_0x8a1532['count'];var _0x3a0278=_0x2a2b85?0x0:_0x233b37[_0xfcb8('0x15')];var _0x16b9c4=_0x2a2b85?_0x8a1532[_0xfcb8('0x17')]:_0x233b37[_0xfcb8('0x15')]+_0x233b37['limit'];var _0x5640b4;if(_0x16b9c4>=_0x499dc2){_0x16b9c4=_0x499dc2;_0x5640b4=0xc8;}else{_0x5640b4=0xce;}_0x39c0a2[_0xfcb8('0x13')](_0x5640b4);return _0x39c0a2[_0xfcb8('0x18')](_0xfcb8('0x19'),_0x3a0278+'-'+_0x16b9c4+'/'+_0x499dc2)[_0xfcb8('0x1a')](_0x8a1532);}return null;};}function patchUpdates(_0xa32303){return function(_0x375c28){try{jsonpatch[_0xfcb8('0x1b')](_0x375c28,_0xa32303,!![]);}catch(_0x184d41){return BPromise[_0xfcb8('0x1c')](_0x184d41);}return _0x375c28[_0xfcb8('0x1d')]();};}function saveUpdates(_0x3a66f9,_0x4a3745){return function(_0x41a2f6){if(_0x41a2f6){return _0x41a2f6[_0xfcb8('0x1e')](_0x3a66f9)[_0xfcb8('0x1f')](function(_0xa545fd){return _0xa545fd;});}return null;};}function removeEntity(_0xf7dda9,_0x4ba8b7){return function(_0x3eabe6){if(_0x3eabe6){return _0x3eabe6[_0xfcb8('0x20')]()['then'](function(){_0xf7dda9[_0xfcb8('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x159b95,_0x28eb81){return function(_0x526880){if(!_0x526880){_0x159b95['sendStatus'](0x194);}return _0x526880;};}function handleError(_0x3ecc04,_0x511703){_0x511703=_0x511703||0x1f4;return function(_0x30fbe5){logger[_0xfcb8('0x21')](_0x30fbe5[_0xfcb8('0x22')]);if(_0x30fbe5[_0xfcb8('0x23')]){delete _0x30fbe5[_0xfcb8('0x23')];}_0x3ecc04[_0xfcb8('0x13')](_0x511703)[_0xfcb8('0x24')](_0x30fbe5);};}exports[_0xfcb8('0x25')]=function(_0x1b4ff9,_0x4c8fc){var _0xfb9e36={},_0x5527db={},_0x5ddecc={'count':0x0,'rows':[]};var _0x170804=_[_0xfcb8('0x26')](db[_0xfcb8('0x27')]['rawAttributes'],function(_0xbb8822){return{'name':_0xbb8822['fieldName'],'type':_0xbb8822[_0xfcb8('0x28')][_0xfcb8('0x29')]};});_0x5527db[_0xfcb8('0x2a')]=_[_0xfcb8('0x26')](_0x170804,_0xfcb8('0x23'));_0x5527db[_0xfcb8('0x2b')]=_['keys'](_0x1b4ff9[_0xfcb8('0x2b')]);_0x5527db[_0xfcb8('0x2c')]=_[_0xfcb8('0x2d')](_0x5527db[_0xfcb8('0x2a')],_0x5527db[_0xfcb8('0x2b')]);_0xfb9e36[_0xfcb8('0x2e')]=_[_0xfcb8('0x2d')](_0x5527db[_0xfcb8('0x2a')],qs[_0xfcb8('0x2f')](_0x1b4ff9['query'][_0xfcb8('0x2f')]));_0xfb9e36[_0xfcb8('0x2e')]=_0xfb9e36['attributes'][_0xfcb8('0x30')]?_0xfb9e36['attributes']:_0x5527db[_0xfcb8('0x2a')];if(!_0x1b4ff9[_0xfcb8('0x2b')]['hasOwnProperty'](_0xfcb8('0x31'))){_0xfb9e36[_0xfcb8('0x32')]=qs[_0xfcb8('0x32')](_0x1b4ff9['query']['limit']);_0xfb9e36[_0xfcb8('0x15')]=qs[_0xfcb8('0x15')](_0x1b4ff9[_0xfcb8('0x2b')]['offset']);}_0xfb9e36[_0xfcb8('0x33')]=qs['sort'](_0x1b4ff9[_0xfcb8('0x2b')][_0xfcb8('0x34')]);_0xfb9e36[_0xfcb8('0x35')]=qs['filters'](_[_0xfcb8('0x36')](_0x1b4ff9['query'],_0x5527db[_0xfcb8('0x2c')]),_0x170804);if(_0x1b4ff9[_0xfcb8('0x2b')]['filter']){_0xfb9e36['where']=_[_0xfcb8('0x37')](_0xfb9e36[_0xfcb8('0x35')],{'$or':_[_0xfcb8('0x26')](_0x170804,function(_0x11e13d){if(_0x11e13d['type']!=='VIRTUAL'){var _0x51cadf={};_0x51cadf[_0x11e13d[_0xfcb8('0x23')]]={'$like':'%'+_0x1b4ff9[_0xfcb8('0x2b')][_0xfcb8('0x38')]+'%'};return _0x51cadf;}})});}_0xfb9e36=_[_0xfcb8('0x37')]({},_0xfb9e36,_0x1b4ff9['options']);var _0x291adc={'where':_0xfb9e36['where']};return db[_0xfcb8('0x27')]['count'](_0x291adc)['then'](function(_0x15b967){_0x5ddecc[_0xfcb8('0x17')]=_0x15b967;if(_0x1b4ff9['query'][_0xfcb8('0x39')]){_0xfb9e36[_0xfcb8('0x3a')]=[{'all':!![]}];}return db[_0xfcb8('0x27')]['findAll'](_0xfb9e36);})[_0xfcb8('0x1f')](function(_0x71db91){_0x5ddecc[_0xfcb8('0x3b')]=_0x71db91;return _0x5ddecc;})[_0xfcb8('0x1f')](respondWithFilteredResult(_0x4c8fc,_0xfb9e36))[_0xfcb8('0x3c')](handleError(_0x4c8fc,null));};exports['show']=function(_0x262756,_0xd1238b){var _0x1836e9={'raw':![],'where':{'id':_0x262756[_0xfcb8('0x3d')]['id']}},_0xbff04c={};_0xbff04c['model']=_['keys'](db[_0xfcb8('0x27')]['rawAttributes']);_0xbff04c[_0xfcb8('0x2b')]=_[_0xfcb8('0x3e')](_0x262756[_0xfcb8('0x2b')]);_0xbff04c[_0xfcb8('0x2c')]=_['intersection'](_0xbff04c[_0xfcb8('0x2a')],_0xbff04c[_0xfcb8('0x2b')]);_0x1836e9[_0xfcb8('0x2e')]=_[_0xfcb8('0x2d')](_0xbff04c[_0xfcb8('0x2a')],qs['fields'](_0x262756[_0xfcb8('0x2b')][_0xfcb8('0x2f')]));_0x1836e9[_0xfcb8('0x2e')]=_0x1836e9[_0xfcb8('0x2e')]['length']?_0x1836e9[_0xfcb8('0x2e')]:_0xbff04c['model'];if(_0x262756[_0xfcb8('0x2b')][_0xfcb8('0x39')]){_0x1836e9[_0xfcb8('0x3a')]=[{'all':!![]}];}_0x1836e9=_[_0xfcb8('0x37')]({},_0x1836e9,_0x262756['options']);return db[_0xfcb8('0x27')][_0xfcb8('0x3f')](_0x1836e9)[_0xfcb8('0x1f')](handleEntityNotFound(_0xd1238b,null))[_0xfcb8('0x1f')](respondWithResult(_0xd1238b,null))[_0xfcb8('0x3c')](handleError(_0xd1238b,null));};exports[_0xfcb8('0x40')]=function(_0x5e0086,_0x5ecb57){return db['FreshsalesConfiguration'][_0xfcb8('0x40')](_0x5e0086[_0xfcb8('0x41')],{})[_0xfcb8('0x1f')](respondWithResult(_0x5ecb57,0xc9))[_0xfcb8('0x3c')](handleError(_0x5ecb57,null));};exports[_0xfcb8('0x1e')]=function(_0x4c40e3,_0xbdf103){if(_0x4c40e3['body']['id']){delete _0x4c40e3['body']['id'];}return db['FreshsalesConfiguration'][_0xfcb8('0x3f')]({'where':{'id':_0x4c40e3[_0xfcb8('0x3d')]['id']}})[_0xfcb8('0x1f')](handleEntityNotFound(_0xbdf103,null))[_0xfcb8('0x1f')](saveUpdates(_0x4c40e3[_0xfcb8('0x41')],null))[_0xfcb8('0x1f')](respondWithResult(_0xbdf103,null))['catch'](handleError(_0xbdf103,null));};exports['destroy']=function(_0x286bbe,_0x5d1393){return db[_0xfcb8('0x27')][_0xfcb8('0x3f')]({'where':{'id':_0x286bbe[_0xfcb8('0x3d')]['id']}})[_0xfcb8('0x1f')](handleEntityNotFound(_0x5d1393,null))[_0xfcb8('0x1f')](removeEntity(_0x5d1393,null))[_0xfcb8('0x3c')](handleError(_0x5d1393,null));};exports[_0xfcb8('0x42')]=function(_0x117449,_0x511a1e,_0x57b805){var _0x264d28={};var _0x1955d7={};var _0x388949;var _0x3980d1;return db[_0xfcb8('0x27')][_0xfcb8('0x43')]({'where':{'id':_0x117449[_0xfcb8('0x3d')]['id']}})[_0xfcb8('0x1f')](handleEntityNotFound(_0x511a1e,null))[_0xfcb8('0x1f')](function(_0x3f0bfa){if(_0x3f0bfa){_0x388949=_0x3f0bfa;_0x1955d7['model']=_['keys'](db[_0xfcb8('0x44')]['rawAttributes']);_0x1955d7[_0xfcb8('0x2b')]=_[_0xfcb8('0x3e')](_0x117449[_0xfcb8('0x2b')]);_0x1955d7['filters']=_['intersection'](_0x1955d7[_0xfcb8('0x2a')],_0x1955d7['query']);_0x264d28['attributes']=_[_0xfcb8('0x2d')](_0x1955d7[_0xfcb8('0x2a')],qs[_0xfcb8('0x2f')](_0x117449[_0xfcb8('0x2b')][_0xfcb8('0x2f')]));_0x264d28['attributes']=_0x264d28[_0xfcb8('0x2e')][_0xfcb8('0x30')]?_0x264d28[_0xfcb8('0x2e')]:_0x1955d7[_0xfcb8('0x2a')];_0x264d28['order']=qs[_0xfcb8('0x34')](_0x117449[_0xfcb8('0x2b')]['sort']);_0x264d28[_0xfcb8('0x35')]=qs['filters'](_['pick'](_0x117449[_0xfcb8('0x2b')],_0x1955d7[_0xfcb8('0x2c')]));if(_0x117449[_0xfcb8('0x2b')][_0xfcb8('0x38')]){_0x264d28[_0xfcb8('0x35')]=_[_0xfcb8('0x37')](_0x264d28['where'],{'$or':_[_0xfcb8('0x26')](_0x264d28[_0xfcb8('0x2e')],function(_0x456183){var _0x734b3b={};_0x734b3b[_0x456183]={'$like':'%'+_0x117449['query'][_0xfcb8('0x38')]+'%'};return _0x734b3b;})});}_0x264d28=_[_0xfcb8('0x37')]({},_0x264d28,_0x117449['options']);return _0x388949[_0xfcb8('0x42')](_0x264d28);}})[_0xfcb8('0x1f')](function(_0x386bb0){if(_0x386bb0){_0x3980d1=_0x386bb0['length'];if(!_0x117449[_0xfcb8('0x2b')][_0xfcb8('0x45')]('nolimit')){_0x264d28[_0xfcb8('0x32')]=qs['limit'](_0x117449['query'][_0xfcb8('0x32')]);_0x264d28['offset']=qs[_0xfcb8('0x15')](_0x117449['query'][_0xfcb8('0x15')]);}return _0x388949[_0xfcb8('0x42')](_0x264d28);}})[_0xfcb8('0x1f')](function(_0x5abb2c){if(_0x5abb2c){return _0x5abb2c?{'count':_0x3980d1,'rows':_0x5abb2c}:null;}})['then'](respondWithResult(_0x511a1e,null))[_0xfcb8('0x3c')](handleError(_0x511a1e,null));};exports[_0xfcb8('0x46')]=function(_0x327bba,_0x4aa389,_0x17f3cc){var _0x155e47={};var _0x18576e={};var _0x480597;var _0x2916b5;return db[_0xfcb8('0x27')]['findOne']({'where':{'id':_0x327bba[_0xfcb8('0x3d')]['id']}})[_0xfcb8('0x1f')](handleEntityNotFound(_0x4aa389,null))['then'](function(_0x296eee){if(_0x296eee){_0x480597=_0x296eee;_0x18576e['model']=_['keys'](db[_0xfcb8('0x44')][_0xfcb8('0x47')]);_0x18576e['query']=_[_0xfcb8('0x3e')](_0x327bba[_0xfcb8('0x2b')]);_0x18576e[_0xfcb8('0x2c')]=_[_0xfcb8('0x2d')](_0x18576e[_0xfcb8('0x2a')],_0x18576e['query']);_0x155e47['attributes']=_[_0xfcb8('0x2d')](_0x18576e[_0xfcb8('0x2a')],qs['fields'](_0x327bba[_0xfcb8('0x2b')]['fields']));_0x155e47['attributes']=_0x155e47[_0xfcb8('0x2e')][_0xfcb8('0x30')]?_0x155e47['attributes']:_0x18576e['model'];_0x155e47[_0xfcb8('0x33')]=qs[_0xfcb8('0x34')](_0x327bba[_0xfcb8('0x2b')][_0xfcb8('0x34')]);_0x155e47['where']=qs['filters'](_[_0xfcb8('0x36')](_0x327bba[_0xfcb8('0x2b')],_0x18576e[_0xfcb8('0x2c')]));if(_0x327bba['query'][_0xfcb8('0x38')]){_0x155e47[_0xfcb8('0x35')]=_[_0xfcb8('0x37')](_0x155e47[_0xfcb8('0x35')],{'$or':_[_0xfcb8('0x26')](_0x155e47[_0xfcb8('0x2e')],function(_0x48d6a4){var _0x53b7b0={};_0x53b7b0[_0x48d6a4]={'$like':'%'+_0x327bba[_0xfcb8('0x2b')][_0xfcb8('0x38')]+'%'};return _0x53b7b0;})});}_0x155e47=_[_0xfcb8('0x37')]({},_0x155e47,_0x327bba[_0xfcb8('0x48')]);return _0x480597[_0xfcb8('0x46')](_0x155e47);}})[_0xfcb8('0x1f')](function(_0x1c8e60){if(_0x1c8e60){_0x2916b5=_0x1c8e60[_0xfcb8('0x30')];if(!_0x327bba[_0xfcb8('0x2b')][_0xfcb8('0x45')]('nolimit')){_0x155e47['limit']=qs[_0xfcb8('0x32')](_0x327bba[_0xfcb8('0x2b')][_0xfcb8('0x32')]);_0x155e47[_0xfcb8('0x15')]=qs[_0xfcb8('0x15')](_0x327bba['query'][_0xfcb8('0x15')]);}return _0x480597[_0xfcb8('0x46')](_0x155e47);}})[_0xfcb8('0x1f')](function(_0x1f3b49){if(_0x1f3b49){return _0x1f3b49?{'count':_0x2916b5,'rows':_0x1f3b49}:null;}})['then'](respondWithResult(_0x4aa389,null))[_0xfcb8('0x3c')](handleError(_0x4aa389,null));};exports[_0xfcb8('0x49')]=function(_0x476d59,_0x47f84f,_0x1e5f64){var _0x25ed38={};var _0x5ba630={};var _0x3b6ac4;var _0x5df063;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x476d59[_0xfcb8('0x3d')]['id']}})[_0xfcb8('0x1f')](handleEntityNotFound(_0x47f84f,null))[_0xfcb8('0x1f')](function(_0xa4c20b){if(_0xa4c20b){_0x3b6ac4=_0xa4c20b;_0x5ba630[_0xfcb8('0x2a')]=_['keys'](db[_0xfcb8('0x44')]['rawAttributes']);_0x5ba630[_0xfcb8('0x2b')]=_['keys'](_0x476d59[_0xfcb8('0x2b')]);_0x5ba630[_0xfcb8('0x2c')]=_['intersection'](_0x5ba630['model'],_0x5ba630['query']);_0x25ed38[_0xfcb8('0x2e')]=_[_0xfcb8('0x2d')](_0x5ba630['model'],qs[_0xfcb8('0x2f')](_0x476d59[_0xfcb8('0x2b')][_0xfcb8('0x2f')]));_0x25ed38['attributes']=_0x25ed38[_0xfcb8('0x2e')][_0xfcb8('0x30')]?_0x25ed38[_0xfcb8('0x2e')]:_0x5ba630[_0xfcb8('0x2a')];_0x25ed38[_0xfcb8('0x33')]=qs['sort'](_0x476d59[_0xfcb8('0x2b')]['sort']);_0x25ed38['where']=qs[_0xfcb8('0x2c')](_[_0xfcb8('0x36')](_0x476d59[_0xfcb8('0x2b')],_0x5ba630[_0xfcb8('0x2c')]));if(_0x476d59[_0xfcb8('0x2b')]['filter']){_0x25ed38[_0xfcb8('0x35')]=_[_0xfcb8('0x37')](_0x25ed38[_0xfcb8('0x35')],{'$or':_[_0xfcb8('0x26')](_0x25ed38['attributes'],function(_0x24b287){var _0x4f8a59={};_0x4f8a59[_0x24b287]={'$like':'%'+_0x476d59[_0xfcb8('0x2b')][_0xfcb8('0x38')]+'%'};return _0x4f8a59;})});}_0x25ed38=_[_0xfcb8('0x37')]({},_0x25ed38,_0x476d59[_0xfcb8('0x48')]);return _0x3b6ac4[_0xfcb8('0x49')](_0x25ed38);}})[_0xfcb8('0x1f')](function(_0x4262b7){if(_0x4262b7){_0x5df063=_0x4262b7['length'];if(!_0x476d59[_0xfcb8('0x2b')][_0xfcb8('0x45')](_0xfcb8('0x31'))){_0x25ed38[_0xfcb8('0x32')]=qs[_0xfcb8('0x32')](_0x476d59[_0xfcb8('0x2b')]['limit']);_0x25ed38[_0xfcb8('0x15')]=qs[_0xfcb8('0x15')](_0x476d59[_0xfcb8('0x2b')][_0xfcb8('0x15')]);}return _0x3b6ac4['getFields'](_0x25ed38);}})[_0xfcb8('0x1f')](function(_0x1b6d76){if(_0x1b6d76){return _0x1b6d76?{'count':_0x5df063,'rows':_0x1b6d76}:null;}})[_0xfcb8('0x1f')](respondWithResult(_0x47f84f,null))[_0xfcb8('0x3c')](handleError(_0x47f84f,null));}; \ No newline at end of file +var _0xee1d=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','json','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','update','body','getSubjects','findOne','FreshsalesField','getDescriptions','pick','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xee1d,0xd2));var _0xdee1=function(_0x778b72,_0x19857f){_0x778b72=_0x778b72-0x0;var _0x4528ab=_0xee1d[_0x778b72];return _0x4528ab;};'use strict';var emlformat=require(_0xdee1('0x0'));var rimraf=require(_0xdee1('0x1'));var zipdir=require(_0xdee1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdee1('0x3'));var moment=require(_0xdee1('0x4'));var BPromise=require(_0xdee1('0x5'));var Mustache=require(_0xdee1('0x6'));var util=require(_0xdee1('0x7'));var path=require(_0xdee1('0x8'));var sox=require(_0xdee1('0x9'));var csv=require(_0xdee1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdee1('0xb'));var _=require(_0xdee1('0xc'));var squel=require('squel');var crypto=require(_0xdee1('0xd'));var jsforce=require(_0xdee1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdee1('0xf'));var Papa=require('papaparse');var Redis=require(_0xdee1('0x10'));var authService=require(_0xdee1('0x11'));var qs=require(_0xdee1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdee1('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdee1('0x14'))['db'];function respondWithStatusCode(_0x4452af,_0x2efc72){_0x2efc72=_0x2efc72||0xcc;return function(_0x36743e){if(_0x36743e){return _0x4452af[_0xdee1('0x15')](_0x2efc72);}return _0x4452af[_0xdee1('0x16')](_0x2efc72)[_0xdee1('0x17')]();};}function respondWithResult(_0xadb16d,_0x2508fa){_0x2508fa=_0x2508fa||0xc8;return function(_0x32cb9f){if(_0x32cb9f){return _0xadb16d[_0xdee1('0x16')](_0x2508fa)['json'](_0x32cb9f);}};}function respondWithFilteredResult(_0x32e259,_0x6bbe3e){return function(_0x1d23ed){if(_0x1d23ed){var _0x3bf978=typeof _0x6bbe3e[_0xdee1('0x18')]==='undefined'&&typeof _0x6bbe3e[_0xdee1('0x19')]===_0xdee1('0x1a');var _0x33bada=_0x1d23ed[_0xdee1('0x1b')];var _0x4aa35a=_0x3bf978?0x0:_0x6bbe3e[_0xdee1('0x18')];var _0xbf12d0=_0x3bf978?_0x1d23ed['count']:_0x6bbe3e['offset']+_0x6bbe3e[_0xdee1('0x19')];var _0x16c19c;if(_0xbf12d0>=_0x33bada){_0xbf12d0=_0x33bada;_0x16c19c=0xc8;}else{_0x16c19c=0xce;}_0x32e259[_0xdee1('0x16')](_0x16c19c);return _0x32e259['set']('Content-Range',_0x4aa35a+'-'+_0xbf12d0+'/'+_0x33bada)[_0xdee1('0x1c')](_0x1d23ed);}return null;};}function patchUpdates(_0x59a4ac){return function(_0x2a701d){try{jsonpatch['apply'](_0x2a701d,_0x59a4ac,!![]);}catch(_0x548216){return BPromise[_0xdee1('0x1d')](_0x548216);}return _0x2a701d[_0xdee1('0x1e')]();};}function saveUpdates(_0x23d459,_0x43a4ff){return function(_0x5654af){if(_0x5654af){return _0x5654af['update'](_0x23d459)[_0xdee1('0x1f')](function(_0x41b68c){return _0x41b68c;});}return null;};}function removeEntity(_0x2b473d,_0x116852){return function(_0x1e5f68){if(_0x1e5f68){return _0x1e5f68[_0xdee1('0x20')]()[_0xdee1('0x1f')](function(){_0x2b473d[_0xdee1('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df5f2,_0x5bc23b){return function(_0x2a694d){if(!_0x2a694d){_0x1df5f2[_0xdee1('0x15')](0x194);}return _0x2a694d;};}function handleError(_0x4b76f6,_0x23f961){_0x23f961=_0x23f961||0x1f4;return function(_0x371cee){logger[_0xdee1('0x21')](_0x371cee[_0xdee1('0x22')]);if(_0x371cee[_0xdee1('0x23')]){delete _0x371cee[_0xdee1('0x23')];}_0x4b76f6[_0xdee1('0x16')](_0x23f961)[_0xdee1('0x24')](_0x371cee);};}exports[_0xdee1('0x25')]=function(_0x1e49ab,_0x23bbd2){var _0x2c0aec={},_0x301caa={},_0x4cca10={'count':0x0,'rows':[]};var _0x388b8f=_[_0xdee1('0x26')](db[_0xdee1('0x27')][_0xdee1('0x28')],function(_0x49fd8a){return{'name':_0x49fd8a['fieldName'],'type':_0x49fd8a[_0xdee1('0x29')]['key']};});_0x301caa[_0xdee1('0x2a')]=_['map'](_0x388b8f,_0xdee1('0x23'));_0x301caa['query']=_[_0xdee1('0x2b')](_0x1e49ab['query']);_0x301caa[_0xdee1('0x2c')]=_[_0xdee1('0x2d')](_0x301caa[_0xdee1('0x2a')],_0x301caa['query']);_0x2c0aec[_0xdee1('0x2e')]=_[_0xdee1('0x2d')](_0x301caa['model'],qs[_0xdee1('0x2f')](_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x2f')]));_0x2c0aec['attributes']=_0x2c0aec[_0xdee1('0x2e')][_0xdee1('0x31')]?_0x2c0aec[_0xdee1('0x2e')]:_0x301caa[_0xdee1('0x2a')];if(!_0x1e49ab['query'][_0xdee1('0x32')](_0xdee1('0x33'))){_0x2c0aec['limit']=qs[_0xdee1('0x19')](_0x1e49ab[_0xdee1('0x30')]['limit']);_0x2c0aec[_0xdee1('0x18')]=qs['offset'](_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x18')]);}_0x2c0aec[_0xdee1('0x34')]=qs[_0xdee1('0x35')](_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x35')]);_0x2c0aec[_0xdee1('0x36')]=qs[_0xdee1('0x2c')](_['pick'](_0x1e49ab[_0xdee1('0x30')],_0x301caa[_0xdee1('0x2c')]),_0x388b8f);if(_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x37')]){_0x2c0aec[_0xdee1('0x36')]=_[_0xdee1('0x38')](_0x2c0aec[_0xdee1('0x36')],{'$or':_[_0xdee1('0x26')](_0x388b8f,function(_0x2cea6e){if(_0x2cea6e[_0xdee1('0x29')]!==_0xdee1('0x39')){var _0x205dc5={};_0x205dc5[_0x2cea6e[_0xdee1('0x23')]]={'$like':'%'+_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x37')]+'%'};return _0x205dc5;}})});}_0x2c0aec=_[_0xdee1('0x38')]({},_0x2c0aec,_0x1e49ab[_0xdee1('0x3a')]);var _0x2f2d60={'where':_0x2c0aec[_0xdee1('0x36')]};return db[_0xdee1('0x27')][_0xdee1('0x1b')](_0x2f2d60)[_0xdee1('0x1f')](function(_0x249d01){_0x4cca10[_0xdee1('0x1b')]=_0x249d01;if(_0x1e49ab[_0xdee1('0x30')][_0xdee1('0x3b')]){_0x2c0aec[_0xdee1('0x3c')]=[{'all':!![]}];}return db[_0xdee1('0x27')][_0xdee1('0x3d')](_0x2c0aec);})[_0xdee1('0x1f')](function(_0x1d7e3d){_0x4cca10[_0xdee1('0x3e')]=_0x1d7e3d;return _0x4cca10;})[_0xdee1('0x1f')](respondWithFilteredResult(_0x23bbd2,_0x2c0aec))['catch'](handleError(_0x23bbd2,null));};exports['show']=function(_0x47bd93,_0x299754){var _0x164bbc={'raw':![],'where':{'id':_0x47bd93[_0xdee1('0x3f')]['id']}},_0x4cece6={};_0x4cece6['model']=_[_0xdee1('0x2b')](db[_0xdee1('0x27')][_0xdee1('0x28')]);_0x4cece6[_0xdee1('0x30')]=_['keys'](_0x47bd93[_0xdee1('0x30')]);_0x4cece6[_0xdee1('0x2c')]=_[_0xdee1('0x2d')](_0x4cece6[_0xdee1('0x2a')],_0x4cece6[_0xdee1('0x30')]);_0x164bbc[_0xdee1('0x2e')]=_['intersection'](_0x4cece6[_0xdee1('0x2a')],qs[_0xdee1('0x2f')](_0x47bd93[_0xdee1('0x30')]['fields']));_0x164bbc[_0xdee1('0x2e')]=_0x164bbc[_0xdee1('0x2e')][_0xdee1('0x31')]?_0x164bbc['attributes']:_0x4cece6[_0xdee1('0x2a')];if(_0x47bd93['query']['includeAll']){_0x164bbc[_0xdee1('0x3c')]=[{'all':!![]}];}_0x164bbc=_[_0xdee1('0x38')]({},_0x164bbc,_0x47bd93[_0xdee1('0x3a')]);return db[_0xdee1('0x27')][_0xdee1('0x40')](_0x164bbc)[_0xdee1('0x1f')](handleEntityNotFound(_0x299754,null))[_0xdee1('0x1f')](respondWithResult(_0x299754,null))[_0xdee1('0x41')](handleError(_0x299754,null));};exports[_0xdee1('0x42')]=function(_0x576b16,_0x587c0a){return db[_0xdee1('0x27')]['create'](_0x576b16['body'],{})[_0xdee1('0x1f')](respondWithResult(_0x587c0a,0xc9))['catch'](handleError(_0x587c0a,null));};exports[_0xdee1('0x43')]=function(_0x7dc9ad,_0x3c8500){if(_0x7dc9ad[_0xdee1('0x44')]['id']){delete _0x7dc9ad[_0xdee1('0x44')]['id'];}return db[_0xdee1('0x27')]['find']({'where':{'id':_0x7dc9ad[_0xdee1('0x3f')]['id']}})[_0xdee1('0x1f')](handleEntityNotFound(_0x3c8500,null))[_0xdee1('0x1f')](saveUpdates(_0x7dc9ad[_0xdee1('0x44')],null))['then'](respondWithResult(_0x3c8500,null))['catch'](handleError(_0x3c8500,null));};exports[_0xdee1('0x20')]=function(_0x3ddd8c,_0x437b2a){return db['FreshsalesConfiguration'][_0xdee1('0x40')]({'where':{'id':_0x3ddd8c[_0xdee1('0x3f')]['id']}})[_0xdee1('0x1f')](handleEntityNotFound(_0x437b2a,null))[_0xdee1('0x1f')](removeEntity(_0x437b2a,null))[_0xdee1('0x41')](handleError(_0x437b2a,null));};exports[_0xdee1('0x45')]=function(_0x3c2792,_0x249356,_0x2d6f7a){var _0x1398e3={};var _0x205da2={};var _0x59c6b8;var _0x3f7de3;return db['FreshsalesConfiguration'][_0xdee1('0x46')]({'where':{'id':_0x3c2792[_0xdee1('0x3f')]['id']}})[_0xdee1('0x1f')](handleEntityNotFound(_0x249356,null))[_0xdee1('0x1f')](function(_0x3d85f4){if(_0x3d85f4){_0x59c6b8=_0x3d85f4;_0x205da2[_0xdee1('0x2a')]=_[_0xdee1('0x2b')](db[_0xdee1('0x47')][_0xdee1('0x28')]);_0x205da2[_0xdee1('0x30')]=_[_0xdee1('0x2b')](_0x3c2792[_0xdee1('0x30')]);_0x205da2['filters']=_[_0xdee1('0x2d')](_0x205da2[_0xdee1('0x2a')],_0x205da2[_0xdee1('0x30')]);_0x1398e3[_0xdee1('0x2e')]=_[_0xdee1('0x2d')](_0x205da2[_0xdee1('0x2a')],qs['fields'](_0x3c2792['query'][_0xdee1('0x2f')]));_0x1398e3[_0xdee1('0x2e')]=_0x1398e3[_0xdee1('0x2e')][_0xdee1('0x31')]?_0x1398e3[_0xdee1('0x2e')]:_0x205da2[_0xdee1('0x2a')];_0x1398e3[_0xdee1('0x34')]=qs[_0xdee1('0x35')](_0x3c2792['query'][_0xdee1('0x35')]);_0x1398e3[_0xdee1('0x36')]=qs[_0xdee1('0x2c')](_['pick'](_0x3c2792[_0xdee1('0x30')],_0x205da2[_0xdee1('0x2c')]));if(_0x3c2792[_0xdee1('0x30')][_0xdee1('0x37')]){_0x1398e3['where']=_['merge'](_0x1398e3[_0xdee1('0x36')],{'$or':_['map'](_0x1398e3[_0xdee1('0x2e')],function(_0x2956d4){var _0x458914={};_0x458914[_0x2956d4]={'$like':'%'+_0x3c2792['query'][_0xdee1('0x37')]+'%'};return _0x458914;})});}_0x1398e3=_[_0xdee1('0x38')]({},_0x1398e3,_0x3c2792['options']);return _0x59c6b8['getSubjects'](_0x1398e3);}})['then'](function(_0xa30a05){if(_0xa30a05){_0x3f7de3=_0xa30a05[_0xdee1('0x31')];if(!_0x3c2792[_0xdee1('0x30')][_0xdee1('0x32')](_0xdee1('0x33'))){_0x1398e3[_0xdee1('0x19')]=qs[_0xdee1('0x19')](_0x3c2792[_0xdee1('0x30')][_0xdee1('0x19')]);_0x1398e3[_0xdee1('0x18')]=qs['offset'](_0x3c2792[_0xdee1('0x30')]['offset']);}return _0x59c6b8[_0xdee1('0x45')](_0x1398e3);}})[_0xdee1('0x1f')](function(_0x57c4d){if(_0x57c4d){return _0x57c4d?{'count':_0x3f7de3,'rows':_0x57c4d}:null;}})['then'](respondWithResult(_0x249356,null))['catch'](handleError(_0x249356,null));};exports[_0xdee1('0x48')]=function(_0x2bdf17,_0x5abe12,_0x2749fd){var _0xa45bda={};var _0x4e0825={};var _0x4079b7;var _0x51ec91;return db[_0xdee1('0x27')][_0xdee1('0x46')]({'where':{'id':_0x2bdf17[_0xdee1('0x3f')]['id']}})[_0xdee1('0x1f')](handleEntityNotFound(_0x5abe12,null))[_0xdee1('0x1f')](function(_0xbd2d01){if(_0xbd2d01){_0x4079b7=_0xbd2d01;_0x4e0825[_0xdee1('0x2a')]=_['keys'](db[_0xdee1('0x47')][_0xdee1('0x28')]);_0x4e0825[_0xdee1('0x30')]=_[_0xdee1('0x2b')](_0x2bdf17[_0xdee1('0x30')]);_0x4e0825[_0xdee1('0x2c')]=_[_0xdee1('0x2d')](_0x4e0825['model'],_0x4e0825[_0xdee1('0x30')]);_0xa45bda[_0xdee1('0x2e')]=_[_0xdee1('0x2d')](_0x4e0825[_0xdee1('0x2a')],qs['fields'](_0x2bdf17['query'][_0xdee1('0x2f')]));_0xa45bda[_0xdee1('0x2e')]=_0xa45bda[_0xdee1('0x2e')][_0xdee1('0x31')]?_0xa45bda[_0xdee1('0x2e')]:_0x4e0825[_0xdee1('0x2a')];_0xa45bda['order']=qs[_0xdee1('0x35')](_0x2bdf17[_0xdee1('0x30')][_0xdee1('0x35')]);_0xa45bda['where']=qs['filters'](_[_0xdee1('0x49')](_0x2bdf17[_0xdee1('0x30')],_0x4e0825['filters']));if(_0x2bdf17[_0xdee1('0x30')][_0xdee1('0x37')]){_0xa45bda['where']=_[_0xdee1('0x38')](_0xa45bda[_0xdee1('0x36')],{'$or':_[_0xdee1('0x26')](_0xa45bda[_0xdee1('0x2e')],function(_0xc9474e){var _0xdf9508={};_0xdf9508[_0xc9474e]={'$like':'%'+_0x2bdf17[_0xdee1('0x30')][_0xdee1('0x37')]+'%'};return _0xdf9508;})});}_0xa45bda=_[_0xdee1('0x38')]({},_0xa45bda,_0x2bdf17[_0xdee1('0x3a')]);return _0x4079b7['getDescriptions'](_0xa45bda);}})['then'](function(_0x2452a0){if(_0x2452a0){_0x51ec91=_0x2452a0['length'];if(!_0x2bdf17[_0xdee1('0x30')][_0xdee1('0x32')](_0xdee1('0x33'))){_0xa45bda[_0xdee1('0x19')]=qs['limit'](_0x2bdf17[_0xdee1('0x30')]['limit']);_0xa45bda[_0xdee1('0x18')]=qs[_0xdee1('0x18')](_0x2bdf17[_0xdee1('0x30')][_0xdee1('0x18')]);}return _0x4079b7['getDescriptions'](_0xa45bda);}})[_0xdee1('0x1f')](function(_0xba420a){if(_0xba420a){return _0xba420a?{'count':_0x51ec91,'rows':_0xba420a}:null;}})[_0xdee1('0x1f')](respondWithResult(_0x5abe12,null))[_0xdee1('0x41')](handleError(_0x5abe12,null));};exports['getFields']=function(_0x1c8202,_0x1853f9,_0x18654f){var _0x33572c={};var _0x143ed7={};var _0x927838;var _0x451ee6;return db[_0xdee1('0x27')]['findOne']({'where':{'id':_0x1c8202[_0xdee1('0x3f')]['id']}})[_0xdee1('0x1f')](handleEntityNotFound(_0x1853f9,null))[_0xdee1('0x1f')](function(_0x1b26f5){if(_0x1b26f5){_0x927838=_0x1b26f5;_0x143ed7[_0xdee1('0x2a')]=_[_0xdee1('0x2b')](db[_0xdee1('0x47')][_0xdee1('0x28')]);_0x143ed7[_0xdee1('0x30')]=_[_0xdee1('0x2b')](_0x1c8202[_0xdee1('0x30')]);_0x143ed7[_0xdee1('0x2c')]=_['intersection'](_0x143ed7[_0xdee1('0x2a')],_0x143ed7['query']);_0x33572c[_0xdee1('0x2e')]=_[_0xdee1('0x2d')](_0x143ed7[_0xdee1('0x2a')],qs[_0xdee1('0x2f')](_0x1c8202[_0xdee1('0x30')][_0xdee1('0x2f')]));_0x33572c['attributes']=_0x33572c[_0xdee1('0x2e')][_0xdee1('0x31')]?_0x33572c[_0xdee1('0x2e')]:_0x143ed7[_0xdee1('0x2a')];_0x33572c[_0xdee1('0x34')]=qs[_0xdee1('0x35')](_0x1c8202[_0xdee1('0x30')]['sort']);_0x33572c['where']=qs[_0xdee1('0x2c')](_[_0xdee1('0x49')](_0x1c8202[_0xdee1('0x30')],_0x143ed7[_0xdee1('0x2c')]));if(_0x1c8202[_0xdee1('0x30')]['filter']){_0x33572c[_0xdee1('0x36')]=_[_0xdee1('0x38')](_0x33572c[_0xdee1('0x36')],{'$or':_[_0xdee1('0x26')](_0x33572c['attributes'],function(_0x3e376c){var _0x1bc6f4={};_0x1bc6f4[_0x3e376c]={'$like':'%'+_0x1c8202[_0xdee1('0x30')][_0xdee1('0x37')]+'%'};return _0x1bc6f4;})});}_0x33572c=_[_0xdee1('0x38')]({},_0x33572c,_0x1c8202[_0xdee1('0x3a')]);return _0x927838[_0xdee1('0x4a')](_0x33572c);}})[_0xdee1('0x1f')](function(_0x2e18fb){if(_0x2e18fb){_0x451ee6=_0x2e18fb[_0xdee1('0x31')];if(!_0x1c8202[_0xdee1('0x30')]['hasOwnProperty'](_0xdee1('0x33'))){_0x33572c['limit']=qs[_0xdee1('0x19')](_0x1c8202[_0xdee1('0x30')][_0xdee1('0x19')]);_0x33572c[_0xdee1('0x18')]=qs[_0xdee1('0x18')](_0x1c8202[_0xdee1('0x30')][_0xdee1('0x18')]);}return _0x927838[_0xdee1('0x4a')](_0x33572c);}})[_0xdee1('0x1f')](function(_0x5900a0){if(_0x5900a0){return _0x5900a0?{'count':_0x451ee6,'rows':_0x5900a0}:null;}})['then'](respondWithResult(_0x1853f9,null))['catch'](handleError(_0x1853f9,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 831c1b3..ef1f1d5 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 _0xac68=['path','../../config/environment','./intFreshsalesConfiguration.attributes','define','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5acd67,_0x526bd7){var _0x255885=function(_0x1bdace){while(--_0x1bdace){_0x5acd67['push'](_0x5acd67['shift']());}};_0x255885(++_0x526bd7);}(_0xac68,0x144));var _0x8ac6=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xac68[_0x4bb581];return _0x316bf5;};'use strict';var _=require(_0x8ac6('0x0'));var util=require(_0x8ac6('0x1'));var logger=require(_0x8ac6('0x2'))('api');var moment=require(_0x8ac6('0x3'));var BPromise=require(_0x8ac6('0x4'));var rp=require(_0x8ac6('0x5'));var fs=require('fs');var path=require(_0x8ac6('0x6'));var rimraf=require('rimraf');var config=require(_0x8ac6('0x7'));var attributes=require(_0x8ac6('0x8'));module['exports']=function(_0x21c6a3,_0x4f8c99){return _0x21c6a3[_0x8ac6('0x9')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd485=['../../config/environment','exports','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xd485,0x67));var _0x5d48=function(_0x334769,_0x18f042){_0x334769=_0x334769-0x0;var _0x2234ba=_0xd485[_0x334769];return _0x2234ba;};'use strict';var _=require(_0x5d48('0x0'));var util=require(_0x5d48('0x1'));var logger=require(_0x5d48('0x2'))(_0x5d48('0x3'));var moment=require(_0x5d48('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d48('0x5'));var rimraf=require(_0x5d48('0x6'));var config=require(_0x5d48('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x5d48('0x8')]=function(_0x49e307,_0x4e46a0){return _0x49e307['define']('FreshsalesConfiguration',attributes,{'tableName':_0x5d48('0x9'),'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 206ebff..ac58193 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 _0xa683=['FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1a6712,_0x239059){var _0xd99104=function(_0x4391b6){while(--_0x4391b6){_0x1a6712['push'](_0x1a6712['shift']());}};_0xd99104(++_0x239059);}(_0xa683,0x124));var _0x3a68=function(_0x506278,_0x23a40d){_0x506278=_0x506278-0x0;var _0x2da6a4=_0xa683[_0x506278];return _0x2da6a4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3a68('0x0'));var BPromise=require(_0x3a68('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a68('0x2'));var db=require(_0x3a68('0x3'))['db'];var utils=require(_0x3a68('0x4'));var logger=require('../../config/logger')(_0x3a68('0x5'));var config=require(_0x3a68('0x6'));var jayson=require(_0x3a68('0x7'));var client=jayson[_0x3a68('0x8')][_0x3a68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x583358,_0x3c6be8,_0x3e5393){return new BPromise(function(_0x111995,_0x5bd63f){return client[_0x3a68('0xa')](_0x583358,_0x3e5393)[_0x3a68('0xb')](function(_0x1f0196){logger['info'](_0x3a68('0xc'),_0x3c6be8,'request\x20sent');logger[_0x3a68('0xd')](_0x3a68('0xe'),_0x3c6be8,_0x3a68('0xf'),JSON['stringify'](_0x1f0196));if(_0x1f0196['error']){if(_0x1f0196[_0x3a68('0x10')][_0x3a68('0x11')]===0x1f4){logger[_0x3a68('0x10')](_0x3a68('0xc'),_0x3c6be8,_0x1f0196['error']['message']);return _0x5bd63f(_0x1f0196[_0x3a68('0x10')][_0x3a68('0x12')]);}logger[_0x3a68('0x10')](_0x3a68('0xc'),_0x3c6be8,_0x1f0196[_0x3a68('0x10')][_0x3a68('0x12')]);return _0x111995(_0x1f0196['error'][_0x3a68('0x12')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x3c6be8,'request\x20sent');_0x111995(_0x1f0196['result'][_0x3a68('0x12')]);}})['catch'](function(_0x44bdf6){logger[_0x3a68('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3c6be8,_0x44bdf6);_0x5bd63f(_0x44bdf6);});});} \ No newline at end of file +var _0x182a=['../../config/environment','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x182a,0x10c));var _0xa182=function(_0x1842a4,_0x11e06f){_0x1842a4=_0x1842a4-0x0;var _0x2fdb8f=_0x182a[_0x1842a4];return _0x2fdb8f;};'use strict';var _=require(_0xa182('0x0'));var util=require(_0xa182('0x1'));var moment=require(_0xa182('0x2'));var BPromise=require(_0xa182('0x3'));var rs=require(_0xa182('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa182('0x5'))['db'];var utils=require(_0xa182('0x6'));var logger=require('../../config/logger')(_0xa182('0x7'));var config=require(_0xa182('0x8'));var jayson=require(_0xa182('0x9'));var client=jayson[_0xa182('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5160e3,_0x520bfe,_0xa1d20b){return new BPromise(function(_0x517e17,_0x3bd659){return client[_0xa182('0xb')](_0x5160e3,_0xa1d20b)[_0xa182('0xc')](function(_0xeff1ca){logger[_0xa182('0xd')](_0xa182('0xe'),_0x520bfe,'request\x20sent');logger[_0xa182('0xf')](_0xa182('0x10'),_0x520bfe,_0xa182('0x11'),JSON[_0xa182('0x12')](_0xeff1ca));if(_0xeff1ca[_0xa182('0x13')]){if(_0xeff1ca['error'][_0xa182('0x14')]===0x1f4){logger[_0xa182('0x13')](_0xa182('0xe'),_0x520bfe,_0xeff1ca[_0xa182('0x13')]['message']);return _0x3bd659(_0xeff1ca['error'][_0xa182('0x15')]);}logger[_0xa182('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x520bfe,_0xeff1ca[_0xa182('0x13')]['message']);return _0x517e17(_0xeff1ca[_0xa182('0x13')][_0xa182('0x15')]);}else{logger[_0xa182('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x520bfe,_0xa182('0x11'));_0x517e17(_0xeff1ca['result'][_0xa182('0x15')]);}})[_0xa182('0x16')](function(_0x32bc08){logger[_0xa182('0x13')](_0xa182('0xe'),_0x520bfe,_0x32bc08);_0x3bd659(_0x32bc08);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 6b5b77c..e94bebd 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 _0x38a5=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x40d4a7,_0x52cfe1){var _0x27ecc2=function(_0x4d0b9d){while(--_0x4d0b9d){_0x40d4a7['push'](_0x40d4a7['shift']());}};_0x27ecc2(++_0x52cfe1);}(_0x38a5,0x69));var _0x538a=function(_0x37c9fb,_0x110411){_0x37c9fb=_0x37c9fb-0x0;var _0x13196a=_0x38a5[_0x37c9fb];return _0x13196a;};'use strict';var multer=require(_0x538a('0x0'));var util=require(_0x538a('0x1'));var path=require(_0x538a('0x2'));var timeout=require(_0x538a('0x3'));var express=require('express');var router=express[_0x538a('0x4')]();var fs_extra=require(_0x538a('0x5'));var auth=require(_0x538a('0x6'));var interaction=require(_0x538a('0x7'));var config=require(_0x538a('0x8'));var controller=require(_0x538a('0x9'));router[_0x538a('0xa')]('/',auth[_0x538a('0xb')](),controller[_0x538a('0xc')]);router[_0x538a('0xa')](_0x538a('0xd'),auth[_0x538a('0xb')](),controller[_0x538a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x538a('0xf')]);router[_0x538a('0x10')](_0x538a('0xd'),auth['isAuthenticated'](),controller[_0x538a('0x11')]);router[_0x538a('0x12')](_0x538a('0xd'),auth[_0x538a('0xb')](),controller[_0x538a('0x13')]);module[_0x538a('0x14')]=router; \ No newline at end of file +var _0x946e=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','show','isAuthenticated','create','update','destroy','multer'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x946e,0x1d0));var _0xe946=function(_0x44cbef,_0x533a1a){_0x44cbef=_0x44cbef-0x0;var _0x196610=_0x946e[_0x44cbef];return _0x196610;};'use strict';var multer=require(_0xe946('0x0'));var util=require('util');var path=require(_0xe946('0x1'));var timeout=require('connect-timeout');var express=require(_0xe946('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe946('0x3'));var interaction=require(_0xe946('0x4'));var config=require(_0xe946('0x5'));var controller=require(_0xe946('0x6'));router[_0xe946('0x7')]('/',auth['isAuthenticated'](),controller[_0xe946('0x8')]);router[_0xe946('0x7')](_0xe946('0x9'),auth['isAuthenticated'](),controller[_0xe946('0xa')]);router['post']('/',auth[_0xe946('0xb')](),controller[_0xe946('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe946('0xd')]);router['delete']('/:id',auth[_0xe946('0xb')](),controller[_0xe946('0xe')]);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 5cbe336..b181eef 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 _0x222e=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','variable','STRING'];(function(_0x3d4da9,_0x3d1ca6){var _0x3afc58=function(_0x4da753){while(--_0x4da753){_0x3d4da9['push'](_0x3d4da9['shift']());}};_0x3afc58(++_0x3d1ca6);}(_0x222e,0x97));var _0xe222=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x222e[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xe222('0x0'));module[_0xe222('0x1')]={'type':{'type':Sequelize[_0xe222('0x2')](_0xe222('0x3'),'variable',_0xe222('0x4'),_0xe222('0x5'),_0xe222('0x6')),'defaultValue':_0xe222('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xe222('0x3'),_0xe222('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xe222('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe222('0x8')]},'customField':{'type':Sequelize[_0xe222('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x29bd=['exports','ENUM','string','variable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x48d50f,_0x40be69){var _0x2ea859=function(_0x1e01b2){while(--_0x1e01b2){_0x48d50f['push'](_0x48d50f['shift']());}};_0x2ea859(++_0x40be69);}(_0x29bd,0x1c0));var _0xd29b=function(_0x5d286a,_0x306ac0){_0x5d286a=_0x5d286a-0x0;var _0x303e0d=_0x29bd[_0x5d286a];return _0x303e0d;};'use strict';var Sequelize=require('sequelize');module[_0xd29b('0x0')]={'type':{'type':Sequelize[_0xd29b('0x1')](_0xd29b('0x2'),_0xd29b('0x3'),'customVariable',_0xd29b('0x4'),_0xd29b('0x5')),'defaultValue':_0xd29b('0x2')},'content':{'type':Sequelize[_0xd29b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd29b('0x1')]('string',_0xd29b('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd29b('0x6')]},'idField':{'type':Sequelize[_0xd29b('0x6')]},'nameField':{'type':Sequelize[_0xd29b('0x6')]},'customField':{'type':Sequelize[_0xd29b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd29b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 7da33e4..11cb41d 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 _0x4fed=['body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','apply','reject','update','then','end','sendStatus','name','send','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','FreshsalesField','includeAll','include','findAll','catch','params','keys','length','find','create'];(function(_0x1e6eea,_0x580ea8){var _0x2df11b=function(_0x588ac1){while(--_0x588ac1){_0x1e6eea['push'](_0x1e6eea['shift']());}};_0x2df11b(++_0x580ea8);}(_0x4fed,0xda));var _0xd4fe=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0x4fed[_0x421eeb];return _0x2c7371;};'use strict';var emlformat=require(_0xd4fe('0x0'));var rimraf=require(_0xd4fe('0x1'));var zipdir=require(_0xd4fe('0x2'));var jsonpatch=require(_0xd4fe('0x3'));var rp=require(_0xd4fe('0x4'));var moment=require(_0xd4fe('0x5'));var BPromise=require(_0xd4fe('0x6'));var Mustache=require('mustache');var util=require(_0xd4fe('0x7'));var path=require(_0xd4fe('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4fe('0x9'));var fs=require('fs');var fs_extra=require(_0xd4fe('0xa'));var _=require(_0xd4fe('0xb'));var squel=require(_0xd4fe('0xc'));var crypto=require(_0xd4fe('0xd'));var jsforce=require(_0xd4fe('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd4fe('0xf'));var querystring=require(_0xd4fe('0x10'));var Papa=require(_0xd4fe('0x11'));var Redis=require(_0xd4fe('0x12'));var authService=require(_0xd4fe('0x13'));var qs=require(_0xd4fe('0x14'));var as=require(_0xd4fe('0x15'));var hardwareService=require(_0xd4fe('0x16'));var logger=require(_0xd4fe('0x17'))(_0xd4fe('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd4fe('0x19'));var db=require(_0xd4fe('0x1a'))['db'];function respondWithStatusCode(_0x4d1210,_0x804fcb){_0x804fcb=_0x804fcb||0xcc;return function(_0x4c82a9){if(_0x4c82a9){return _0x4d1210['sendStatus'](_0x804fcb);}return _0x4d1210['status'](_0x804fcb)['end']();};}function respondWithResult(_0x3a5e43,_0x221018){_0x221018=_0x221018||0xc8;return function(_0x2afb4d){if(_0x2afb4d){return _0x3a5e43[_0xd4fe('0x1b')](_0x221018)[_0xd4fe('0x1c')](_0x2afb4d);}};}function respondWithFilteredResult(_0x225dd7,_0x38c37f){return function(_0x23c807){if(_0x23c807){var _0x305046=typeof _0x38c37f[_0xd4fe('0x1d')]==='undefined'&&typeof _0x38c37f[_0xd4fe('0x1e')]===_0xd4fe('0x1f');var _0x29ddea=_0x23c807[_0xd4fe('0x20')];var _0x3927d0=_0x305046?0x0:_0x38c37f[_0xd4fe('0x1d')];var _0x48733e=_0x305046?_0x23c807['count']:_0x38c37f[_0xd4fe('0x1d')]+_0x38c37f[_0xd4fe('0x1e')];var _0x24a322;if(_0x48733e>=_0x29ddea){_0x48733e=_0x29ddea;_0x24a322=0xc8;}else{_0x24a322=0xce;}_0x225dd7['status'](_0x24a322);return _0x225dd7[_0xd4fe('0x21')]('Content-Range',_0x3927d0+'-'+_0x48733e+'/'+_0x29ddea)[_0xd4fe('0x1c')](_0x23c807);}return null;};}function patchUpdates(_0x1a549a){return function(_0x5cc8a7){try{jsonpatch[_0xd4fe('0x22')](_0x5cc8a7,_0x1a549a,!![]);}catch(_0x205b9e){return BPromise[_0xd4fe('0x23')](_0x205b9e);}return _0x5cc8a7['save']();};}function saveUpdates(_0xcf3041,_0x13748f){return function(_0x58ac52){if(_0x58ac52){return _0x58ac52[_0xd4fe('0x24')](_0xcf3041)[_0xd4fe('0x25')](function(_0x3735f8){return _0x3735f8;});}return null;};}function removeEntity(_0x5956d9,_0x1a287c){return function(_0x28db9a){if(_0x28db9a){return _0x28db9a['destroy']()[_0xd4fe('0x25')](function(){_0x5956d9['status'](0xcc)[_0xd4fe('0x26')]();});}};}function handleEntityNotFound(_0x462c26,_0x66042d){return function(_0x1b97fb){if(!_0x1b97fb){_0x462c26[_0xd4fe('0x27')](0x194);}return _0x1b97fb;};}function handleError(_0x13033c,_0x2c7eb5){_0x2c7eb5=_0x2c7eb5||0x1f4;return function(_0x280bed){logger['error'](_0x280bed['stack']);if(_0x280bed[_0xd4fe('0x28')]){delete _0x280bed[_0xd4fe('0x28')];}_0x13033c[_0xd4fe('0x1b')](_0x2c7eb5)[_0xd4fe('0x29')](_0x280bed);};}exports['index']=function(_0x4816a7,_0x184f93){var _0x591f69={},_0x4841aa={},_0x67f26={'count':0x0,'rows':[]};var _0x22d10d=_[_0xd4fe('0x2a')](db['FreshsalesField'][_0xd4fe('0x2b')],function(_0x5e9661){return{'name':_0x5e9661[_0xd4fe('0x2c')],'type':_0x5e9661[_0xd4fe('0x2d')]['key']};});_0x4841aa[_0xd4fe('0x2e')]=_['map'](_0x22d10d,_0xd4fe('0x28'));_0x4841aa['query']=_['keys'](_0x4816a7[_0xd4fe('0x2f')]);_0x4841aa['filters']=_[_0xd4fe('0x30')](_0x4841aa['model'],_0x4841aa[_0xd4fe('0x2f')]);_0x591f69[_0xd4fe('0x31')]=_[_0xd4fe('0x30')](_0x4841aa[_0xd4fe('0x2e')],qs[_0xd4fe('0x32')](_0x4816a7[_0xd4fe('0x2f')][_0xd4fe('0x32')]));_0x591f69[_0xd4fe('0x31')]=_0x591f69[_0xd4fe('0x31')]['length']?_0x591f69[_0xd4fe('0x31')]:_0x4841aa['model'];if(!_0x4816a7[_0xd4fe('0x2f')][_0xd4fe('0x33')](_0xd4fe('0x34'))){_0x591f69[_0xd4fe('0x1e')]=qs[_0xd4fe('0x1e')](_0x4816a7['query']['limit']);_0x591f69[_0xd4fe('0x1d')]=qs['offset'](_0x4816a7[_0xd4fe('0x2f')]['offset']);}_0x591f69[_0xd4fe('0x35')]=qs[_0xd4fe('0x36')](_0x4816a7[_0xd4fe('0x2f')][_0xd4fe('0x36')]);_0x591f69['where']=qs[_0xd4fe('0x37')](_['pick'](_0x4816a7['query'],_0x4841aa[_0xd4fe('0x37')]),_0x22d10d);if(_0x4816a7[_0xd4fe('0x2f')][_0xd4fe('0x38')]){_0x591f69[_0xd4fe('0x39')]=_[_0xd4fe('0x3a')](_0x591f69[_0xd4fe('0x39')],{'$or':_[_0xd4fe('0x2a')](_0x22d10d,function(_0x3b2a13){if(_0x3b2a13['type']!=='VIRTUAL'){var _0x151ce5={};_0x151ce5[_0x3b2a13['name']]={'$like':'%'+_0x4816a7[_0xd4fe('0x2f')][_0xd4fe('0x38')]+'%'};return _0x151ce5;}})});}_0x591f69=_[_0xd4fe('0x3a')]({},_0x591f69,_0x4816a7[_0xd4fe('0x3b')]);var _0x1c0a21={'where':_0x591f69['where']};return db[_0xd4fe('0x3c')][_0xd4fe('0x20')](_0x1c0a21)[_0xd4fe('0x25')](function(_0x34a401){_0x67f26[_0xd4fe('0x20')]=_0x34a401;if(_0x4816a7['query'][_0xd4fe('0x3d')]){_0x591f69[_0xd4fe('0x3e')]=[{'all':!![]}];}return db[_0xd4fe('0x3c')][_0xd4fe('0x3f')](_0x591f69);})[_0xd4fe('0x25')](function(_0xa9e330){_0x67f26['rows']=_0xa9e330;return _0x67f26;})[_0xd4fe('0x25')](respondWithFilteredResult(_0x184f93,_0x591f69))[_0xd4fe('0x40')](handleError(_0x184f93,null));};exports['show']=function(_0x4cafce,_0x3be306){var _0xa655a8={'raw':!![],'where':{'id':_0x4cafce[_0xd4fe('0x41')]['id']}},_0xd044c2={};_0xd044c2[_0xd4fe('0x2e')]=_['keys'](db[_0xd4fe('0x3c')][_0xd4fe('0x2b')]);_0xd044c2[_0xd4fe('0x2f')]=_[_0xd4fe('0x42')](_0x4cafce[_0xd4fe('0x2f')]);_0xd044c2[_0xd4fe('0x37')]=_['intersection'](_0xd044c2[_0xd4fe('0x2e')],_0xd044c2[_0xd4fe('0x2f')]);_0xa655a8[_0xd4fe('0x31')]=_[_0xd4fe('0x30')](_0xd044c2[_0xd4fe('0x2e')],qs[_0xd4fe('0x32')](_0x4cafce['query']['fields']));_0xa655a8['attributes']=_0xa655a8[_0xd4fe('0x31')][_0xd4fe('0x43')]?_0xa655a8[_0xd4fe('0x31')]:_0xd044c2[_0xd4fe('0x2e')];if(_0x4cafce[_0xd4fe('0x2f')][_0xd4fe('0x3d')]){_0xa655a8[_0xd4fe('0x3e')]=[{'all':!![]}];}_0xa655a8=_[_0xd4fe('0x3a')]({},_0xa655a8,_0x4cafce[_0xd4fe('0x3b')]);return db[_0xd4fe('0x3c')][_0xd4fe('0x44')](_0xa655a8)['then'](handleEntityNotFound(_0x3be306,null))[_0xd4fe('0x25')](respondWithResult(_0x3be306,null))[_0xd4fe('0x40')](handleError(_0x3be306,null));};exports[_0xd4fe('0x45')]=function(_0x4e06a1,_0x16cb5){return db[_0xd4fe('0x3c')][_0xd4fe('0x45')](_0x4e06a1['body'],{})[_0xd4fe('0x25')](respondWithResult(_0x16cb5,0xc9))[_0xd4fe('0x40')](handleError(_0x16cb5,null));};exports[_0xd4fe('0x24')]=function(_0x30238c,_0x3a7283){if(_0x30238c['body']['id']){delete _0x30238c[_0xd4fe('0x46')]['id'];}return db[_0xd4fe('0x3c')]['find']({'where':{'id':_0x30238c[_0xd4fe('0x41')]['id']}})[_0xd4fe('0x25')](handleEntityNotFound(_0x3a7283,null))['then'](saveUpdates(_0x30238c[_0xd4fe('0x46')],null))[_0xd4fe('0x25')](respondWithResult(_0x3a7283,null))[_0xd4fe('0x40')](handleError(_0x3a7283,null));};exports[_0xd4fe('0x47')]=function(_0xd45589,_0x2d70f8){return db['FreshsalesField'][_0xd4fe('0x44')]({'where':{'id':_0xd45589[_0xd4fe('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d70f8,null))[_0xd4fe('0x25')](removeEntity(_0x2d70f8,null))['catch'](handleError(_0x2d70f8,null));}; \ No newline at end of file +var _0x737b=['bluebird','util','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','show','find','create','body','params','zip-dir'];(function(_0x14f495,_0x231ef3){var _0x42ecc7=function(_0x50becd){while(--_0x50becd){_0x14f495['push'](_0x14f495['shift']());}};_0x42ecc7(++_0x231ef3);}(_0x737b,0x197));var _0xb737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x737b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb737('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb737('0x1'));var Mustache=require('mustache');var util=require(_0xb737('0x2'));var path=require(_0xb737('0x3'));var sox=require(_0xb737('0x4'));var csv=require(_0xb737('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb737('0x6'));var crypto=require(_0xb737('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xb737('0x8'));var toCsv=require('to-csv');var querystring=require(_0xb737('0x9'));var Papa=require('papaparse');var Redis=require(_0xb737('0xa'));var authService=require(_0xb737('0xb'));var qs=require(_0xb737('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb737('0xd'))(_0xb737('0xe'));var utils=require(_0xb737('0xf'));var config=require(_0xb737('0x10'));var licenseUtil=require(_0xb737('0x11'));var db=require(_0xb737('0x12'))['db'];function respondWithStatusCode(_0x542d47,_0x30bfe3){_0x30bfe3=_0x30bfe3||0xcc;return function(_0x536fc7){if(_0x536fc7){return _0x542d47[_0xb737('0x13')](_0x30bfe3);}return _0x542d47[_0xb737('0x14')](_0x30bfe3)[_0xb737('0x15')]();};}function respondWithResult(_0x17350f,_0x1d1c78){_0x1d1c78=_0x1d1c78||0xc8;return function(_0x1cbbc4){if(_0x1cbbc4){return _0x17350f['status'](_0x1d1c78)[_0xb737('0x16')](_0x1cbbc4);}};}function respondWithFilteredResult(_0x24d42b,_0x5ec6da){return function(_0x380d7d){if(_0x380d7d){var _0x335509=typeof _0x5ec6da[_0xb737('0x17')]===_0xb737('0x18')&&typeof _0x5ec6da[_0xb737('0x19')]===_0xb737('0x18');var _0x43f203=_0x380d7d[_0xb737('0x1a')];var _0x599bc4=_0x335509?0x0:_0x5ec6da['offset'];var _0x58659d=_0x335509?_0x380d7d[_0xb737('0x1a')]:_0x5ec6da[_0xb737('0x17')]+_0x5ec6da[_0xb737('0x19')];var _0x52e35f;if(_0x58659d>=_0x43f203){_0x58659d=_0x43f203;_0x52e35f=0xc8;}else{_0x52e35f=0xce;}_0x24d42b['status'](_0x52e35f);return _0x24d42b['set']('Content-Range',_0x599bc4+'-'+_0x58659d+'/'+_0x43f203)[_0xb737('0x16')](_0x380d7d);}return null;};}function patchUpdates(_0x582e08){return function(_0x1cb3da){try{jsonpatch[_0xb737('0x1b')](_0x1cb3da,_0x582e08,!![]);}catch(_0x4b75d8){return BPromise[_0xb737('0x1c')](_0x4b75d8);}return _0x1cb3da[_0xb737('0x1d')]();};}function saveUpdates(_0x26896a,_0x4c3e3f){return function(_0x41a5a4){if(_0x41a5a4){return _0x41a5a4[_0xb737('0x1e')](_0x26896a)[_0xb737('0x1f')](function(_0x1dbc8e){return _0x1dbc8e;});}return null;};}function removeEntity(_0x93fbcc,_0x226d31){return function(_0x3a8ad3){if(_0x3a8ad3){return _0x3a8ad3[_0xb737('0x20')]()[_0xb737('0x1f')](function(){_0x93fbcc[_0xb737('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19bf64,_0x17a4fa){return function(_0x2d09a9){if(!_0x2d09a9){_0x19bf64[_0xb737('0x13')](0x194);}return _0x2d09a9;};}function handleError(_0x2630a0,_0x59ad64){_0x59ad64=_0x59ad64||0x1f4;return function(_0x3aa8f0){logger['error'](_0x3aa8f0[_0xb737('0x21')]);if(_0x3aa8f0[_0xb737('0x22')]){delete _0x3aa8f0[_0xb737('0x22')];}_0x2630a0[_0xb737('0x14')](_0x59ad64)[_0xb737('0x23')](_0x3aa8f0);};}exports[_0xb737('0x24')]=function(_0x203f81,_0x109494){var _0x499345={},_0x1a3de6={},_0x1b0a60={'count':0x0,'rows':[]};var _0x232612=_[_0xb737('0x25')](db[_0xb737('0x26')][_0xb737('0x27')],function(_0x44f5f6){return{'name':_0x44f5f6[_0xb737('0x28')],'type':_0x44f5f6['type'][_0xb737('0x29')]};});_0x1a3de6[_0xb737('0x2a')]=_[_0xb737('0x25')](_0x232612,_0xb737('0x22'));_0x1a3de6['query']=_[_0xb737('0x2b')](_0x203f81[_0xb737('0x2c')]);_0x1a3de6[_0xb737('0x2d')]=_[_0xb737('0x2e')](_0x1a3de6[_0xb737('0x2a')],_0x1a3de6[_0xb737('0x2c')]);_0x499345[_0xb737('0x2f')]=_[_0xb737('0x2e')](_0x1a3de6[_0xb737('0x2a')],qs[_0xb737('0x30')](_0x203f81[_0xb737('0x2c')]['fields']));_0x499345[_0xb737('0x2f')]=_0x499345[_0xb737('0x2f')][_0xb737('0x31')]?_0x499345['attributes']:_0x1a3de6[_0xb737('0x2a')];if(!_0x203f81[_0xb737('0x2c')][_0xb737('0x32')](_0xb737('0x33'))){_0x499345[_0xb737('0x19')]=qs[_0xb737('0x19')](_0x203f81['query'][_0xb737('0x19')]);_0x499345['offset']=qs[_0xb737('0x17')](_0x203f81[_0xb737('0x2c')][_0xb737('0x17')]);}_0x499345['order']=qs[_0xb737('0x34')](_0x203f81[_0xb737('0x2c')][_0xb737('0x34')]);_0x499345[_0xb737('0x35')]=qs[_0xb737('0x2d')](_[_0xb737('0x36')](_0x203f81[_0xb737('0x2c')],_0x1a3de6[_0xb737('0x2d')]),_0x232612);if(_0x203f81['query'][_0xb737('0x37')]){_0x499345[_0xb737('0x35')]=_[_0xb737('0x38')](_0x499345[_0xb737('0x35')],{'$or':_['map'](_0x232612,function(_0x2d1c02){if(_0x2d1c02[_0xb737('0x39')]!=='VIRTUAL'){var _0x3ec791={};_0x3ec791[_0x2d1c02['name']]={'$like':'%'+_0x203f81[_0xb737('0x2c')][_0xb737('0x37')]+'%'};return _0x3ec791;}})});}_0x499345=_[_0xb737('0x38')]({},_0x499345,_0x203f81[_0xb737('0x3a')]);var _0x37752f={'where':_0x499345['where']};return db['FreshsalesField'][_0xb737('0x1a')](_0x37752f)[_0xb737('0x1f')](function(_0x344d2b){_0x1b0a60[_0xb737('0x1a')]=_0x344d2b;if(_0x203f81[_0xb737('0x2c')]['includeAll']){_0x499345[_0xb737('0x3b')]=[{'all':!![]}];}return db['FreshsalesField'][_0xb737('0x3c')](_0x499345);})['then'](function(_0x4f6b41){_0x1b0a60[_0xb737('0x3d')]=_0x4f6b41;return _0x1b0a60;})[_0xb737('0x1f')](respondWithFilteredResult(_0x109494,_0x499345))[_0xb737('0x3e')](handleError(_0x109494,null));};exports[_0xb737('0x3f')]=function(_0x18d1c1,_0x5d30ee){var _0x233ba9={'raw':!![],'where':{'id':_0x18d1c1['params']['id']}},_0x4b098c={};_0x4b098c[_0xb737('0x2a')]=_['keys'](db[_0xb737('0x26')][_0xb737('0x27')]);_0x4b098c[_0xb737('0x2c')]=_[_0xb737('0x2b')](_0x18d1c1[_0xb737('0x2c')]);_0x4b098c[_0xb737('0x2d')]=_[_0xb737('0x2e')](_0x4b098c[_0xb737('0x2a')],_0x4b098c[_0xb737('0x2c')]);_0x233ba9[_0xb737('0x2f')]=_[_0xb737('0x2e')](_0x4b098c[_0xb737('0x2a')],qs[_0xb737('0x30')](_0x18d1c1[_0xb737('0x2c')][_0xb737('0x30')]));_0x233ba9[_0xb737('0x2f')]=_0x233ba9[_0xb737('0x2f')][_0xb737('0x31')]?_0x233ba9['attributes']:_0x4b098c[_0xb737('0x2a')];if(_0x18d1c1[_0xb737('0x2c')]['includeAll']){_0x233ba9[_0xb737('0x3b')]=[{'all':!![]}];}_0x233ba9=_['merge']({},_0x233ba9,_0x18d1c1[_0xb737('0x3a')]);return db[_0xb737('0x26')][_0xb737('0x40')](_0x233ba9)[_0xb737('0x1f')](handleEntityNotFound(_0x5d30ee,null))['then'](respondWithResult(_0x5d30ee,null))['catch'](handleError(_0x5d30ee,null));};exports[_0xb737('0x41')]=function(_0x3fce76,_0x256f7b){return db[_0xb737('0x26')][_0xb737('0x41')](_0x3fce76[_0xb737('0x42')],{})[_0xb737('0x1f')](respondWithResult(_0x256f7b,0xc9))['catch'](handleError(_0x256f7b,null));};exports[_0xb737('0x1e')]=function(_0x298e6f,_0x1bcd5c){if(_0x298e6f[_0xb737('0x42')]['id']){delete _0x298e6f['body']['id'];}return db[_0xb737('0x26')][_0xb737('0x40')]({'where':{'id':_0x298e6f[_0xb737('0x43')]['id']}})[_0xb737('0x1f')](handleEntityNotFound(_0x1bcd5c,null))[_0xb737('0x1f')](saveUpdates(_0x298e6f['body'],null))[_0xb737('0x1f')](respondWithResult(_0x1bcd5c,null))[_0xb737('0x3e')](handleError(_0x1bcd5c,null));};exports[_0xb737('0x20')]=function(_0x7bfb29,_0x310bd9){return db[_0xb737('0x26')]['find']({'where':{'id':_0x7bfb29[_0xb737('0x43')]['id']}})[_0xb737('0x1f')](handleEntityNotFound(_0x310bd9,null))['then'](removeEntity(_0x310bd9,null))['catch'](handleError(_0x310bd9,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 38a4403..c26aad8 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 _0x3423=['./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3342('0x0'))(_0x3342('0x1'));var moment=require(_0x3342('0x2'));var BPromise=require(_0x3342('0x3'));var rp=require(_0x3342('0x4'));var fs=require('fs');var path=require(_0x3342('0x5'));var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require(_0x3342('0x8'));module[_0x3342('0x9')]=function(_0x467453,_0x2ccbe0){return _0x467453[_0x3342('0xa')](_0x3342('0xb'),attributes,{'tableName':_0x3342('0xc'),'paranoid':![],'indexes':[{'name':_0x3342('0xd'),'fields':[_0x3342('0xe'),_0x3342('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e3=['request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xf2e3[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[{'name':_0x3f2e('0xd'),'fields':[_0x3f2e('0xe'),_0x3f2e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index d44e643..136def8 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 _0x2eb2=['request','then','info','request\x20sent','error','FreshsalesField,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x4a0781,_0x5f0de0){var _0x1d0b45=function(_0x5b716a){while(--_0x5b716a){_0x4a0781['push'](_0x4a0781['shift']());}};_0x1d0b45(++_0x5f0de0);}(_0x2eb2,0x19f));var _0x22eb=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x2eb2[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x687b,0x14a));var _0xb687=function(_0x3509d8,_0x5074b5){_0x3509d8=_0x3509d8-0x0;var _0x4dcedb=_0x687b[_0x3509d8];return _0x4dcedb;};'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 diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 84722c6..6463bf5 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5c027e,_0x49b1e7){var _0x1bcefe=function(_0x263fe5){while(--_0x263fe5){_0x5c027e['push'](_0x5c027e['shift']());}};_0x1bcefe(++_0x49b1e7);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x4cb938,_0x550432){var _0x304870=function(_0x595998){while(--_0x595998){_0x4cb938['push'](_0x4cb938['shift']());}};_0x304870(++_0x550432);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 bd8a7a7..9d9d0f9 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 _0x2517=['newTab','integrationTab','sequelize','exports','STRING','username','ENUM'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0x2517,0xfe));var _0x7251=function(_0x5b8676,_0x1ee6b4){_0x5b8676=_0x5b8676-0x0;var _0x4f9ae8=_0x2517[_0x5b8676];return _0x4f9ae8;};'use strict';var Sequelize=require(_0x7251('0x0'));module[_0x7251('0x1')]={'name':{'type':Sequelize[_0x7251('0x2')]},'description':{'type':Sequelize[_0x7251('0x2')]},'username':{'type':Sequelize[_0x7251('0x2')],'unique':_0x7251('0x3')},'remoteUri':{'type':Sequelize[_0x7251('0x2')]},'password':{'type':Sequelize[_0x7251('0x2')]},'clientId':{'type':Sequelize[_0x7251('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x7251('0x2')]},'serverUrl':{'type':Sequelize[_0x7251('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7251('0x4')]('integrationTab',_0x7251('0x5')),'defaultValue':_0x7251('0x6')}}; \ No newline at end of file +var _0x1c77=['ENUM','integrationTab','exports','STRING','username'];(function(_0x2ee26b,_0x2d74e){var _0x4d6ef2=function(_0x43a682){while(--_0x43a682){_0x2ee26b['push'](_0x2ee26b['shift']());}};_0x4d6ef2(++_0x2d74e);}(_0x1c77,0xed));var _0x71c7=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0x1c77[_0x2e53e1];return _0x3a23de;};'use strict';var Sequelize=require('sequelize');module[_0x71c7('0x0')]={'name':{'type':Sequelize[_0x71c7('0x1')]},'description':{'type':Sequelize[_0x71c7('0x1')]},'username':{'type':Sequelize[_0x71c7('0x1')],'unique':_0x71c7('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x71c7('0x1')]},'clientId':{'type':Sequelize[_0x71c7('0x1')]},'clientSecret':{'type':Sequelize[_0x71c7('0x1')]},'securityToken':{'type':Sequelize[_0x71c7('0x1')]},'serverUrl':{'type':Sequelize[_0x71c7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x71c7('0x3')](_0x71c7('0x4'),'newTab'),'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 6d26879..c8e87cd 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 _0xed58=['Subject','Description','string','int','email','textarea','phone','includes','label','boolean','True','true','false','test','error','stringify','Wrong\x20credentials','statusCode','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','findOne','order','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','SalesforceConfiguration','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','OwnerId','IsReminderSet','IsRecurrence'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed58,0x186));var _0x8ed5=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xed58[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ed5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8ed5('0x1'));var BPromise=require(_0x8ed5('0x2'));var Mustache=require(_0x8ed5('0x3'));var util=require(_0x8ed5('0x4'));var path=require('path');var sox=require(_0x8ed5('0x5'));var csv=require(_0x8ed5('0x6'));var ejs=require(_0x8ed5('0x7'));var fs=require('fs');var fs_extra=require(_0x8ed5('0x8'));var _=require(_0x8ed5('0x9'));var squel=require(_0x8ed5('0xa'));var crypto=require(_0x8ed5('0xb'));var jsforce=require(_0x8ed5('0xc'));var deskjs=require(_0x8ed5('0xd'));var toCsv=require(_0x8ed5('0x6'));var querystring=require('querystring');var Papa=require(_0x8ed5('0xe'));var Redis=require('ioredis');var authService=require(_0x8ed5('0xf'));var qs=require(_0x8ed5('0x10'));var as=require(_0x8ed5('0x11'));var hardwareService=require(_0x8ed5('0x12'));var logger=require(_0x8ed5('0x13'))(_0x8ed5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8ed5('0x15'));var db=require(_0x8ed5('0x16'))['db'];var integrations=require(_0x8ed5('0x17'));function respondWithStatusCode(_0x5a000d,_0x7117b4){_0x7117b4=_0x7117b4||0xcc;return function(_0x459b8b){if(_0x459b8b){return _0x5a000d[_0x8ed5('0x18')](_0x7117b4);}return _0x5a000d[_0x8ed5('0x19')](_0x7117b4)['end']();};}function respondWithResult(_0x667685,_0x413a0b){_0x413a0b=_0x413a0b||0xc8;return function(_0x29f0a3){if(_0x29f0a3){return _0x667685[_0x8ed5('0x19')](_0x413a0b)[_0x8ed5('0x1a')](_0x29f0a3);}};}function respondWithFilteredResult(_0xb36c33,_0x186b72){return function(_0x4f1543){if(_0x4f1543){var _0x47181b=typeof _0x186b72[_0x8ed5('0x1b')]==='undefined'&&typeof _0x186b72[_0x8ed5('0x1c')]===_0x8ed5('0x1d');var _0x2f4bcc=_0x4f1543[_0x8ed5('0x1e')];var _0x3733f8=_0x47181b?0x0:_0x186b72[_0x8ed5('0x1b')];var _0x5e994c=_0x47181b?_0x4f1543[_0x8ed5('0x1e')]:_0x186b72['offset']+_0x186b72[_0x8ed5('0x1c')];var _0x112c11;if(_0x5e994c>=_0x2f4bcc){_0x5e994c=_0x2f4bcc;_0x112c11=0xc8;}else{_0x112c11=0xce;}_0xb36c33[_0x8ed5('0x19')](_0x112c11);return _0xb36c33['set'](_0x8ed5('0x1f'),_0x3733f8+'-'+_0x5e994c+'/'+_0x2f4bcc)[_0x8ed5('0x1a')](_0x4f1543);}return null;};}function patchUpdates(_0x147a4a){return function(_0x2c0c27){try{jsonpatch[_0x8ed5('0x20')](_0x2c0c27,_0x147a4a,!![]);}catch(_0x269e8d){return BPromise[_0x8ed5('0x21')](_0x269e8d);}return _0x2c0c27[_0x8ed5('0x22')]();};}function saveUpdates(_0x40e659,_0x14868b){return function(_0x22d6fb){if(_0x22d6fb){return _0x22d6fb[_0x8ed5('0x23')](_0x40e659)[_0x8ed5('0x24')](function(_0x44a56d){return _0x44a56d;});}return null;};}function removeEntity(_0x37bea6,_0x33b431){return function(_0xa1fbb2){if(_0xa1fbb2){return _0xa1fbb2[_0x8ed5('0x25')]()[_0x8ed5('0x24')](function(){_0x37bea6[_0x8ed5('0x19')](0xcc)[_0x8ed5('0x26')]();});}};}function handleEntityNotFound(_0x5df1c5,_0x4df5bd){return function(_0x6c0cdf){if(!_0x6c0cdf){_0x5df1c5[_0x8ed5('0x18')](0x194);}return _0x6c0cdf;};}function handleError(_0x1a4370,_0x3cbb78){_0x3cbb78=_0x3cbb78||0x1f4;return function(_0x393be1){logger['error'](_0x393be1['stack']);if(_0x393be1[_0x8ed5('0x27')]){delete _0x393be1[_0x8ed5('0x27')];}_0x1a4370[_0x8ed5('0x19')](_0x3cbb78)[_0x8ed5('0x28')](_0x393be1);};}exports[_0x8ed5('0x29')]=function(_0x7e9c5e,_0x7d9cf3){var _0x2f3470={},_0x23c654={},_0x49d400={'count':0x0,'rows':[]};var _0x4dbf5f=_[_0x8ed5('0x2a')](db[_0x8ed5('0x2b')][_0x8ed5('0x2c')],function(_0x508cf7){return{'name':_0x508cf7[_0x8ed5('0x2d')],'type':_0x508cf7[_0x8ed5('0x2e')][_0x8ed5('0x2f')]};});_0x23c654['model']=_[_0x8ed5('0x2a')](_0x4dbf5f,_0x8ed5('0x27'));_0x23c654['query']=_[_0x8ed5('0x30')](_0x7e9c5e[_0x8ed5('0x31')]);_0x23c654[_0x8ed5('0x32')]=_[_0x8ed5('0x33')](_0x23c654[_0x8ed5('0x34')],_0x23c654[_0x8ed5('0x31')]);_0x2f3470[_0x8ed5('0x35')]=_['intersection'](_0x23c654[_0x8ed5('0x34')],qs['fields'](_0x7e9c5e[_0x8ed5('0x31')]['fields']));_0x2f3470[_0x8ed5('0x35')]=_0x2f3470[_0x8ed5('0x35')][_0x8ed5('0x36')]?_0x2f3470[_0x8ed5('0x35')]:_0x23c654[_0x8ed5('0x34')];if(!_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x37')](_0x8ed5('0x38'))){_0x2f3470[_0x8ed5('0x1c')]=qs[_0x8ed5('0x1c')](_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x1c')]);_0x2f3470['offset']=qs[_0x8ed5('0x1b')](_0x7e9c5e['query'][_0x8ed5('0x1b')]);}_0x2f3470['order']=qs['sort'](_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x39')]);_0x2f3470[_0x8ed5('0x3a')]=qs[_0x8ed5('0x32')](_[_0x8ed5('0x3b')](_0x7e9c5e[_0x8ed5('0x31')],_0x23c654['filters']),_0x4dbf5f);if(_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x3c')]){_0x2f3470[_0x8ed5('0x3a')]=_[_0x8ed5('0x3d')](_0x2f3470[_0x8ed5('0x3a')],{'$or':_[_0x8ed5('0x2a')](_0x4dbf5f,function(_0x503b4b){if(_0x503b4b[_0x8ed5('0x2e')]!==_0x8ed5('0x3e')){var _0x16e85c={};_0x16e85c[_0x503b4b[_0x8ed5('0x27')]]={'$like':'%'+_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x3c')]+'%'};return _0x16e85c;}})});}_0x2f3470=_['merge']({},_0x2f3470,_0x7e9c5e[_0x8ed5('0x3f')]);var _0x438639={'where':_0x2f3470[_0x8ed5('0x3a')]};return db[_0x8ed5('0x2b')][_0x8ed5('0x1e')](_0x438639)[_0x8ed5('0x24')](function(_0x3ec545){_0x49d400['count']=_0x3ec545;if(_0x7e9c5e[_0x8ed5('0x31')][_0x8ed5('0x40')]){_0x2f3470[_0x8ed5('0x41')]=[{'all':!![]}];}return db[_0x8ed5('0x2b')][_0x8ed5('0x42')](_0x2f3470);})['then'](function(_0x27b36a){_0x49d400[_0x8ed5('0x43')]=_0x27b36a;return _0x49d400;})[_0x8ed5('0x24')](respondWithFilteredResult(_0x7d9cf3,_0x2f3470))[_0x8ed5('0x44')](handleError(_0x7d9cf3,null));};exports['show']=function(_0x2825f6,_0xa26909){var _0xe0f4f1={'raw':![],'where':{'id':_0x2825f6[_0x8ed5('0x45')]['id']}},_0x10d7f9={};_0x10d7f9[_0x8ed5('0x34')]=_[_0x8ed5('0x30')](db['SalesforceAccount'][_0x8ed5('0x2c')]);_0x10d7f9[_0x8ed5('0x31')]=_[_0x8ed5('0x30')](_0x2825f6[_0x8ed5('0x31')]);_0x10d7f9['filters']=_[_0x8ed5('0x33')](_0x10d7f9[_0x8ed5('0x34')],_0x10d7f9[_0x8ed5('0x31')]);_0xe0f4f1[_0x8ed5('0x35')]=_[_0x8ed5('0x33')](_0x10d7f9['model'],qs[_0x8ed5('0x46')](_0x2825f6[_0x8ed5('0x31')][_0x8ed5('0x46')]));_0xe0f4f1[_0x8ed5('0x35')]=_0xe0f4f1['attributes'][_0x8ed5('0x36')]?_0xe0f4f1['attributes']:_0x10d7f9['model'];if(_0x2825f6['query'][_0x8ed5('0x40')]){_0xe0f4f1['include']=[{'all':!![]}];}_0xe0f4f1=_[_0x8ed5('0x3d')]({},_0xe0f4f1,_0x2825f6[_0x8ed5('0x3f')]);return db['SalesforceAccount'][_0x8ed5('0x47')](_0xe0f4f1)['then'](handleEntityNotFound(_0xa26909,null))[_0x8ed5('0x24')](respondWithResult(_0xa26909,null))[_0x8ed5('0x44')](handleError(_0xa26909,null));};exports[_0x8ed5('0x48')]=function(_0xf8034,_0x25e8a1){return db[_0x8ed5('0x2b')][_0x8ed5('0x48')](_0xf8034['body'],{})[_0x8ed5('0x24')](respondWithResult(_0x25e8a1,0xc9))[_0x8ed5('0x44')](handleError(_0x25e8a1,null));};exports['update']=function(_0xcb590b,_0x3e4bfd){if(_0xcb590b['body']['id']){delete _0xcb590b[_0x8ed5('0x49')]['id'];}return db[_0x8ed5('0x2b')]['find']({'where':{'id':_0xcb590b['params']['id']}})[_0x8ed5('0x24')](handleEntityNotFound(_0x3e4bfd,null))[_0x8ed5('0x24')](saveUpdates(_0xcb590b[_0x8ed5('0x49')],null))[_0x8ed5('0x24')](respondWithResult(_0x3e4bfd,null))[_0x8ed5('0x44')](handleError(_0x3e4bfd,null));};exports['destroy']=function(_0x27a993,_0x595d96){return db['SalesforceAccount'][_0x8ed5('0x47')]({'where':{'id':_0x27a993['params']['id']}})['then'](handleEntityNotFound(_0x595d96,null))['then'](removeEntity(_0x595d96,null))[_0x8ed5('0x44')](handleError(_0x595d96,null));};exports['getConfigurations']=function(_0x140b2a,_0x4fe77c,_0x3fa7c6){var _0x4a3c48={};var _0xbafada={};var _0x2ef590;var _0x489901;return db[_0x8ed5('0x2b')][_0x8ed5('0x4a')]({'where':{'id':_0x140b2a['params']['id']}})[_0x8ed5('0x24')](handleEntityNotFound(_0x4fe77c,null))[_0x8ed5('0x24')](function(_0x2934a3){if(_0x2934a3){_0x2ef590=_0x2934a3;_0xbafada[_0x8ed5('0x34')]=_[_0x8ed5('0x30')](db['SalesforceConfiguration'][_0x8ed5('0x2c')]);_0xbafada[_0x8ed5('0x31')]=_[_0x8ed5('0x30')](_0x140b2a[_0x8ed5('0x31')]);_0xbafada[_0x8ed5('0x32')]=_[_0x8ed5('0x33')](_0xbafada['model'],_0xbafada[_0x8ed5('0x31')]);_0x4a3c48['attributes']=_['intersection'](_0xbafada['model'],qs['fields'](_0x140b2a[_0x8ed5('0x31')][_0x8ed5('0x46')]));_0x4a3c48[_0x8ed5('0x35')]=_0x4a3c48[_0x8ed5('0x35')][_0x8ed5('0x36')]?_0x4a3c48['attributes']:_0xbafada['model'];_0x4a3c48[_0x8ed5('0x4b')]=qs[_0x8ed5('0x39')](_0x140b2a[_0x8ed5('0x31')][_0x8ed5('0x39')]);_0x4a3c48[_0x8ed5('0x3a')]=qs['filters'](_[_0x8ed5('0x3b')](_0x140b2a[_0x8ed5('0x31')],_0xbafada[_0x8ed5('0x32')]));if(_0x140b2a[_0x8ed5('0x31')][_0x8ed5('0x3c')]){_0x4a3c48['where']=_['merge'](_0x4a3c48[_0x8ed5('0x3a')],{'$or':_[_0x8ed5('0x2a')](_0x4a3c48[_0x8ed5('0x35')],function(_0xfd9d08){var _0x2e1248={};_0x2e1248[_0xfd9d08]={'$like':'%'+_0x140b2a[_0x8ed5('0x31')]['filter']+'%'};return _0x2e1248;})});}_0x4a3c48=_[_0x8ed5('0x3d')]({},_0x4a3c48,_0x140b2a['options']);return _0x2ef590[_0x8ed5('0x4c')](_0x4a3c48);}})[_0x8ed5('0x24')](function(_0x201aa2){if(_0x201aa2){_0x489901=_0x201aa2[_0x8ed5('0x36')];if(!_0x140b2a[_0x8ed5('0x31')][_0x8ed5('0x37')]('nolimit')){_0x4a3c48[_0x8ed5('0x1c')]=qs[_0x8ed5('0x1c')](_0x140b2a[_0x8ed5('0x31')][_0x8ed5('0x1c')]);_0x4a3c48[_0x8ed5('0x1b')]=qs['offset'](_0x140b2a['query'][_0x8ed5('0x1b')]);}return _0x2ef590[_0x8ed5('0x4c')](_0x4a3c48);}})[_0x8ed5('0x24')](function(_0x32e5ac){if(_0x32e5ac){return _0x32e5ac?{'count':_0x489901,'rows':_0x32e5ac}:null;}})[_0x8ed5('0x24')](respondWithResult(_0x4fe77c,null))['catch'](handleError(_0x4fe77c,null));};exports[_0x8ed5('0x4d')]=function(_0x111f24,_0x50d66a,_0xd7dcd7){if(_0x111f24[_0x8ed5('0x49')]['id']){delete _0x111f24[_0x8ed5('0x49')]['id'];}return db[_0x8ed5('0x2b')][_0x8ed5('0x4a')]({'where':{'id':_0x111f24[_0x8ed5('0x45')]['id']}})[_0x8ed5('0x24')](handleEntityNotFound(_0x50d66a,null))['then'](function(_0x1f436f){if(_0x1f436f){_0x111f24[_0x8ed5('0x49')][_0x8ed5('0x4e')]=_0x1f436f['id'];_0x111f24[_0x8ed5('0x49')]['Subjects']=integrations[_0x8ed5('0x4f')](_0x111f24[_0x8ed5('0x49')]['channel'],_0x111f24[_0x8ed5('0x49')][_0x8ed5('0x2e')]);_0x111f24[_0x8ed5('0x49')][_0x8ed5('0x50')]=integrations[_0x8ed5('0x51')](_0x111f24[_0x8ed5('0x49')][_0x8ed5('0x52')],_0x111f24[_0x8ed5('0x49')][_0x8ed5('0x2e')]);return db[_0x8ed5('0x53')][_0x8ed5('0x48')](_0x111f24[_0x8ed5('0x49')],{'include':[{'model':db[_0x8ed5('0x54')],'as':_0x8ed5('0x55')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x50d66a,null))[_0x8ed5('0x44')](handleError(_0x50d66a,null));};exports[_0x8ed5('0x56')]=function(_0x156fe7,_0x29a4e3,_0x61dce1){var _0x2eb41a;var _0x26349b='';var _0x5901bf=_0x8ed5('0x57');return db[_0x8ed5('0x2b')][_0x8ed5('0x4a')]({'where':{'id':_0x156fe7[_0x8ed5('0x45')]['id']},'attributes':['id',_0x8ed5('0x58'),_0x8ed5('0x59'),_0x8ed5('0x5a'),_0x8ed5('0x5b'),_0x8ed5('0x5c'),_0x8ed5('0x5d')]})[_0x8ed5('0x24')](handleEntityNotFound(_0x29a4e3,null))[_0x8ed5('0x24')](function(_0x163f50){if(_0x163f50){_0x26349b=_0x163f50[_0x8ed5('0x58')];var _0x4cc7d7=_0x26349b[_0x8ed5('0x5e')](-0x1);if(_0x4cc7d7==='/'){_0x26349b=_0x26349b[_0x8ed5('0x5f')](0x0,_0x26349b[_0x8ed5('0x60')](_0x4cc7d7));}_0x2eb41a=new jsforce[(_0x8ed5('0x61'))]({'oauth2':{'loginUrl':_0x26349b,'clientId':_0x163f50[_0x8ed5('0x59')],'clientSecret':_0x163f50[_0x8ed5('0x5a')]}});return _0x2eb41a[_0x8ed5('0x62')](_0x163f50[_0x8ed5('0x5b')],_0x163f50[_0x8ed5('0x5c')][_0x8ed5('0x63')](_0x163f50[_0x8ed5('0x5d')]));}})[_0x8ed5('0x24')](function(_0x500978){if(_0x500978){if(!_[_0x8ed5('0x64')](_0x156fe7[_0x8ed5('0x31')][_0x8ed5('0x65')])){_0x5901bf=_0x156fe7[_0x8ed5('0x31')]['ticketType'];}return _0x2eb41a[_0x8ed5('0x66')](_0x5901bf)['describe']();}})[_0x8ed5('0x24')](function(_0x4b8037){var _0x3f65d2=[_0x8ed5('0x67'),'ActivityDate',_0x8ed5('0x68'),_0x8ed5('0x69'),_0x8ed5('0x6a'),_0x8ed5('0x6b')];var _0x5dff76=[_0x8ed5('0x6c'),_0x8ed5('0x6d'),'picklist','boolean',_0x8ed5('0x6e'),_0x8ed5('0x6f'),_0x8ed5('0x70')];if(_0x4b8037){_['remove'](_0x4b8037['fields'],function(_0x143e00){return _0x3f65d2['includes'](_0x143e00[_0x8ed5('0x27')])||!_0x5dff76[_0x8ed5('0x71')](_0x143e00[_0x8ed5('0x2e')]);});return{'count':_0x4b8037[_0x8ed5('0x46')][_0x8ed5('0x36')],'rows':_['map'](_0x4b8037['fields'],function(_0x55a8ae){return{'id':_0x55a8ae[_0x8ed5('0x27')],'name':_0x55a8ae[_0x8ed5('0x72')],'custom':_0x55a8ae['custom'],'options':_0x55a8ae['picklistValues'][_0x8ed5('0x36')]>0x0?_[_0x8ed5('0x2a')](_0x55a8ae['picklistValues'],function(_0x33dbd0){return{'name':_0x33dbd0['label'],'value':_0x33dbd0['value']};}):_0x55a8ae[_0x8ed5('0x2e')]==_0x8ed5('0x73')?[{'name':_0x8ed5('0x74'),'value':_0x8ed5('0x75')},{'name':'False','value':_0x8ed5('0x76')}]:[]};})};}})[_0x8ed5('0x24')](respondWithResult(_0x29a4e3,null))[_0x8ed5('0x44')](function(_0x4c753e){var _0x5a8e33=_0x156fe7['query'][_0x8ed5('0x77')]?0x1f4:_0x4c753e['statusCode']||0x1f4;logger[_0x8ed5('0x78')]('getFields,\x20%s,\x20%s,\x20%s',_0x8ed5('0x56'),_0x5a8e33,JSON[_0x8ed5('0x79')](_0x4c753e));delete _0x4c753e[_0x8ed5('0x27')];if(_0x5a8e33===0x191){_0x5a8e33=0x190;}_0x29a4e3[_0x8ed5('0x19')](_0x5a8e33)[_0x8ed5('0x28')](_0x156fe7[_0x8ed5('0x31')][_0x8ed5('0x77')]?{'message':_0x8ed5('0x7a'),'statusCode':_0x4c753e[_0x8ed5('0x7b')]}:_0x4c753e);});}; \ No newline at end of file +var _0xfdf9=['password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','phone','remove','includes','label','custom','picklistValues','value','true','False','false','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','save','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','SalesforceAccount','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientSecret','username'];(function(_0x9f021c,_0x59b485){var _0x3f6ca8=function(_0x2d9b17){while(--_0x2d9b17){_0x9f021c['push'](_0x9f021c['shift']());}};_0x3f6ca8(++_0x59b485);}(_0xfdf9,0x124));var _0x9fdf=function(_0x310781,_0x5bfe0b){_0x310781=_0x310781-0x0;var _0x23a7a6=_0xfdf9[_0x310781];return _0x23a7a6;};'use strict';var emlformat=require(_0x9fdf('0x0'));var rimraf=require(_0x9fdf('0x1'));var zipdir=require(_0x9fdf('0x2'));var jsonpatch=require(_0x9fdf('0x3'));var rp=require(_0x9fdf('0x4'));var moment=require(_0x9fdf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9fdf('0x6'));var util=require(_0x9fdf('0x7'));var path=require(_0x9fdf('0x8'));var sox=require('sox');var csv=require(_0x9fdf('0x9'));var ejs=require(_0x9fdf('0xa'));var fs=require('fs');var fs_extra=require(_0x9fdf('0xb'));var _=require(_0x9fdf('0xc'));var squel=require(_0x9fdf('0xd'));var crypto=require(_0x9fdf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9fdf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9fdf('0x10'));var Papa=require(_0x9fdf('0x11'));var Redis=require(_0x9fdf('0x12'));var authService=require(_0x9fdf('0x13'));var qs=require(_0x9fdf('0x14'));var as=require(_0x9fdf('0x15'));var hardwareService=require(_0x9fdf('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x9fdf('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9fdf('0x18'));var db=require(_0x9fdf('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56278d,_0x3c5d21){_0x3c5d21=_0x3c5d21||0xcc;return function(_0x5649b2){if(_0x5649b2){return _0x56278d[_0x9fdf('0x1a')](_0x3c5d21);}return _0x56278d['status'](_0x3c5d21)[_0x9fdf('0x1b')]();};}function respondWithResult(_0x28f680,_0x3d85e7){_0x3d85e7=_0x3d85e7||0xc8;return function(_0x1ad4ba){if(_0x1ad4ba){return _0x28f680['status'](_0x3d85e7)[_0x9fdf('0x1c')](_0x1ad4ba);}};}function respondWithFilteredResult(_0x40a321,_0x4b5c82){return function(_0x5c06ec){if(_0x5c06ec){var _0x450db0=typeof _0x4b5c82[_0x9fdf('0x1d')]==='undefined'&&typeof _0x4b5c82[_0x9fdf('0x1e')]===_0x9fdf('0x1f');var _0x296bdb=_0x5c06ec['count'];var _0x2bd21a=_0x450db0?0x0:_0x4b5c82['offset'];var _0x3a2a75=_0x450db0?_0x5c06ec[_0x9fdf('0x20')]:_0x4b5c82[_0x9fdf('0x1d')]+_0x4b5c82[_0x9fdf('0x1e')];var _0x57f7d9;if(_0x3a2a75>=_0x296bdb){_0x3a2a75=_0x296bdb;_0x57f7d9=0xc8;}else{_0x57f7d9=0xce;}_0x40a321[_0x9fdf('0x21')](_0x57f7d9);return _0x40a321[_0x9fdf('0x22')]('Content-Range',_0x2bd21a+'-'+_0x3a2a75+'/'+_0x296bdb)[_0x9fdf('0x1c')](_0x5c06ec);}return null;};}function patchUpdates(_0x31339c){return function(_0x4fbe7d){try{jsonpatch[_0x9fdf('0x23')](_0x4fbe7d,_0x31339c,!![]);}catch(_0x2e1828){return BPromise[_0x9fdf('0x24')](_0x2e1828);}return _0x4fbe7d[_0x9fdf('0x25')]();};}function saveUpdates(_0x13671d,_0x1b6be0){return function(_0x56b04b){if(_0x56b04b){return _0x56b04b['update'](_0x13671d)[_0x9fdf('0x26')](function(_0x4dff48){return _0x4dff48;});}return null;};}function removeEntity(_0x30d91c,_0x3d99aa){return function(_0x69d1d3){if(_0x69d1d3){return _0x69d1d3[_0x9fdf('0x27')]()[_0x9fdf('0x26')](function(){_0x30d91c[_0x9fdf('0x21')](0xcc)[_0x9fdf('0x1b')]();});}};}function handleEntityNotFound(_0x451125,_0x56972a){return function(_0x3a4602){if(!_0x3a4602){_0x451125[_0x9fdf('0x1a')](0x194);}return _0x3a4602;};}function handleError(_0x42e9ac,_0x3179a5){_0x3179a5=_0x3179a5||0x1f4;return function(_0x15193a){logger['error'](_0x15193a[_0x9fdf('0x28')]);if(_0x15193a[_0x9fdf('0x29')]){delete _0x15193a[_0x9fdf('0x29')];}_0x42e9ac[_0x9fdf('0x21')](_0x3179a5)['send'](_0x15193a);};}exports[_0x9fdf('0x2a')]=function(_0x751f3e,_0x31df16){var _0x34fe22={},_0x541bb5={},_0x50aa3a={'count':0x0,'rows':[]};var _0x264da7=_[_0x9fdf('0x2b')](db['SalesforceAccount'][_0x9fdf('0x2c')],function(_0x565b0e){return{'name':_0x565b0e[_0x9fdf('0x2d')],'type':_0x565b0e[_0x9fdf('0x2e')][_0x9fdf('0x2f')]};});_0x541bb5[_0x9fdf('0x30')]=_[_0x9fdf('0x2b')](_0x264da7,_0x9fdf('0x29'));_0x541bb5[_0x9fdf('0x31')]=_[_0x9fdf('0x32')](_0x751f3e[_0x9fdf('0x31')]);_0x541bb5[_0x9fdf('0x33')]=_[_0x9fdf('0x34')](_0x541bb5[_0x9fdf('0x30')],_0x541bb5['query']);_0x34fe22[_0x9fdf('0x35')]=_['intersection'](_0x541bb5[_0x9fdf('0x30')],qs['fields'](_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x36')]));_0x34fe22[_0x9fdf('0x35')]=_0x34fe22[_0x9fdf('0x35')][_0x9fdf('0x37')]?_0x34fe22['attributes']:_0x541bb5[_0x9fdf('0x30')];if(!_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x38')](_0x9fdf('0x39'))){_0x34fe22[_0x9fdf('0x1e')]=qs[_0x9fdf('0x1e')](_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x1e')]);_0x34fe22['offset']=qs[_0x9fdf('0x1d')](_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x1d')]);}_0x34fe22[_0x9fdf('0x3a')]=qs[_0x9fdf('0x3b')](_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x3b')]);_0x34fe22[_0x9fdf('0x3c')]=qs[_0x9fdf('0x33')](_[_0x9fdf('0x3d')](_0x751f3e[_0x9fdf('0x31')],_0x541bb5[_0x9fdf('0x33')]),_0x264da7);if(_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x3e')]){_0x34fe22[_0x9fdf('0x3c')]=_[_0x9fdf('0x3f')](_0x34fe22[_0x9fdf('0x3c')],{'$or':_[_0x9fdf('0x2b')](_0x264da7,function(_0x14464b){if(_0x14464b['type']!=='VIRTUAL'){var _0x1e38ea={};_0x1e38ea[_0x14464b[_0x9fdf('0x29')]]={'$like':'%'+_0x751f3e['query']['filter']+'%'};return _0x1e38ea;}})});}_0x34fe22=_[_0x9fdf('0x3f')]({},_0x34fe22,_0x751f3e['options']);var _0xb5cd1b={'where':_0x34fe22['where']};return db[_0x9fdf('0x40')][_0x9fdf('0x20')](_0xb5cd1b)[_0x9fdf('0x26')](function(_0x1732cc){_0x50aa3a['count']=_0x1732cc;if(_0x751f3e[_0x9fdf('0x31')][_0x9fdf('0x41')]){_0x34fe22['include']=[{'all':!![]}];}return db[_0x9fdf('0x40')][_0x9fdf('0x42')](_0x34fe22);})[_0x9fdf('0x26')](function(_0x3d9a30){_0x50aa3a[_0x9fdf('0x43')]=_0x3d9a30;return _0x50aa3a;})[_0x9fdf('0x26')](respondWithFilteredResult(_0x31df16,_0x34fe22))[_0x9fdf('0x44')](handleError(_0x31df16,null));};exports[_0x9fdf('0x45')]=function(_0x2f1238,_0x4ed267){var _0x375238={'raw':![],'where':{'id':_0x2f1238[_0x9fdf('0x46')]['id']}},_0x2eb0a7={};_0x2eb0a7['model']=_[_0x9fdf('0x32')](db[_0x9fdf('0x40')][_0x9fdf('0x2c')]);_0x2eb0a7[_0x9fdf('0x31')]=_[_0x9fdf('0x32')](_0x2f1238[_0x9fdf('0x31')]);_0x2eb0a7[_0x9fdf('0x33')]=_[_0x9fdf('0x34')](_0x2eb0a7[_0x9fdf('0x30')],_0x2eb0a7[_0x9fdf('0x31')]);_0x375238[_0x9fdf('0x35')]=_[_0x9fdf('0x34')](_0x2eb0a7[_0x9fdf('0x30')],qs[_0x9fdf('0x36')](_0x2f1238[_0x9fdf('0x31')][_0x9fdf('0x36')]));_0x375238[_0x9fdf('0x35')]=_0x375238[_0x9fdf('0x35')][_0x9fdf('0x37')]?_0x375238['attributes']:_0x2eb0a7[_0x9fdf('0x30')];if(_0x2f1238[_0x9fdf('0x31')]['includeAll']){_0x375238[_0x9fdf('0x47')]=[{'all':!![]}];}_0x375238=_[_0x9fdf('0x3f')]({},_0x375238,_0x2f1238[_0x9fdf('0x48')]);return db[_0x9fdf('0x40')][_0x9fdf('0x49')](_0x375238)['then'](handleEntityNotFound(_0x4ed267,null))[_0x9fdf('0x26')](respondWithResult(_0x4ed267,null))[_0x9fdf('0x44')](handleError(_0x4ed267,null));};exports[_0x9fdf('0x4a')]=function(_0x490065,_0x3abafb){return db[_0x9fdf('0x40')]['create'](_0x490065[_0x9fdf('0x4b')],{})['then'](respondWithResult(_0x3abafb,0xc9))[_0x9fdf('0x44')](handleError(_0x3abafb,null));};exports[_0x9fdf('0x4c')]=function(_0x54c83a,_0x51e509){if(_0x54c83a[_0x9fdf('0x4b')]['id']){delete _0x54c83a['body']['id'];}return db[_0x9fdf('0x40')][_0x9fdf('0x49')]({'where':{'id':_0x54c83a[_0x9fdf('0x46')]['id']}})[_0x9fdf('0x26')](handleEntityNotFound(_0x51e509,null))[_0x9fdf('0x26')](saveUpdates(_0x54c83a[_0x9fdf('0x4b')],null))[_0x9fdf('0x26')](respondWithResult(_0x51e509,null))[_0x9fdf('0x44')](handleError(_0x51e509,null));};exports[_0x9fdf('0x27')]=function(_0x5c4ac2,_0x333a7a){return db[_0x9fdf('0x40')][_0x9fdf('0x49')]({'where':{'id':_0x5c4ac2[_0x9fdf('0x46')]['id']}})[_0x9fdf('0x26')](handleEntityNotFound(_0x333a7a,null))['then'](removeEntity(_0x333a7a,null))[_0x9fdf('0x44')](handleError(_0x333a7a,null));};exports[_0x9fdf('0x4d')]=function(_0x2c673e,_0x42cdf8,_0x792f93){var _0x3698aa={};var _0x2e56b8={};var _0x138e13;var _0x495740;return db[_0x9fdf('0x40')][_0x9fdf('0x4e')]({'where':{'id':_0x2c673e[_0x9fdf('0x46')]['id']}})[_0x9fdf('0x26')](handleEntityNotFound(_0x42cdf8,null))['then'](function(_0x212932){if(_0x212932){_0x138e13=_0x212932;_0x2e56b8[_0x9fdf('0x30')]=_[_0x9fdf('0x32')](db[_0x9fdf('0x4f')][_0x9fdf('0x2c')]);_0x2e56b8[_0x9fdf('0x31')]=_[_0x9fdf('0x32')](_0x2c673e['query']);_0x2e56b8[_0x9fdf('0x33')]=_[_0x9fdf('0x34')](_0x2e56b8[_0x9fdf('0x30')],_0x2e56b8['query']);_0x3698aa[_0x9fdf('0x35')]=_[_0x9fdf('0x34')](_0x2e56b8[_0x9fdf('0x30')],qs[_0x9fdf('0x36')](_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x36')]));_0x3698aa[_0x9fdf('0x35')]=_0x3698aa[_0x9fdf('0x35')]['length']?_0x3698aa[_0x9fdf('0x35')]:_0x2e56b8[_0x9fdf('0x30')];_0x3698aa[_0x9fdf('0x3a')]=qs[_0x9fdf('0x3b')](_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x3b')]);_0x3698aa[_0x9fdf('0x3c')]=qs[_0x9fdf('0x33')](_[_0x9fdf('0x3d')](_0x2c673e[_0x9fdf('0x31')],_0x2e56b8[_0x9fdf('0x33')]));if(_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x3e')]){_0x3698aa[_0x9fdf('0x3c')]=_[_0x9fdf('0x3f')](_0x3698aa[_0x9fdf('0x3c')],{'$or':_[_0x9fdf('0x2b')](_0x3698aa[_0x9fdf('0x35')],function(_0x2c86b4){var _0xb755d3={};_0xb755d3[_0x2c86b4]={'$like':'%'+_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x3e')]+'%'};return _0xb755d3;})});}_0x3698aa=_[_0x9fdf('0x3f')]({},_0x3698aa,_0x2c673e['options']);return _0x138e13['getConfigurations'](_0x3698aa);}})[_0x9fdf('0x26')](function(_0x2eae36){if(_0x2eae36){_0x495740=_0x2eae36[_0x9fdf('0x37')];if(!_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x38')](_0x9fdf('0x39'))){_0x3698aa[_0x9fdf('0x1e')]=qs[_0x9fdf('0x1e')](_0x2c673e[_0x9fdf('0x31')]['limit']);_0x3698aa['offset']=qs[_0x9fdf('0x1d')](_0x2c673e[_0x9fdf('0x31')][_0x9fdf('0x1d')]);}return _0x138e13['getConfigurations'](_0x3698aa);}})['then'](function(_0x43022a){if(_0x43022a){return _0x43022a?{'count':_0x495740,'rows':_0x43022a}:null;}})[_0x9fdf('0x26')](respondWithResult(_0x42cdf8,null))[_0x9fdf('0x44')](handleError(_0x42cdf8,null));};exports[_0x9fdf('0x50')]=function(_0x30f3de,_0x25b071,_0x515d2d){if(_0x30f3de['body']['id']){delete _0x30f3de[_0x9fdf('0x4b')]['id'];}return db[_0x9fdf('0x40')][_0x9fdf('0x4e')]({'where':{'id':_0x30f3de[_0x9fdf('0x46')]['id']}})['then'](handleEntityNotFound(_0x25b071,null))[_0x9fdf('0x26')](function(_0xb8cac3){if(_0xb8cac3){_0x30f3de[_0x9fdf('0x4b')]['AccountId']=_0xb8cac3['id'];_0x30f3de[_0x9fdf('0x4b')]['Subjects']=integrations['getSubjects'](_0x30f3de[_0x9fdf('0x4b')][_0x9fdf('0x51')],_0x30f3de[_0x9fdf('0x4b')][_0x9fdf('0x2e')]);_0x30f3de[_0x9fdf('0x4b')][_0x9fdf('0x52')]=integrations[_0x9fdf('0x53')](_0x30f3de[_0x9fdf('0x4b')][_0x9fdf('0x51')],_0x30f3de[_0x9fdf('0x4b')][_0x9fdf('0x2e')]);return db['SalesforceConfiguration'][_0x9fdf('0x4a')](_0x30f3de['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x9fdf('0x54')],'as':_0x9fdf('0x52')}]});}return null;})[_0x9fdf('0x26')](respondWithResult(_0x25b071,null))[_0x9fdf('0x44')](handleError(_0x25b071,null));};exports[_0x9fdf('0x55')]=function(_0x11a946,_0x28905f,_0xa900fe){var _0x5acb3f;var _0x373436='';var _0x2e4e13=_0x9fdf('0x56');return db[_0x9fdf('0x40')][_0x9fdf('0x4e')]({'where':{'id':_0x11a946[_0x9fdf('0x46')]['id']},'attributes':['id','remoteUri','clientId',_0x9fdf('0x57'),_0x9fdf('0x58'),_0x9fdf('0x59'),_0x9fdf('0x5a')]})[_0x9fdf('0x26')](handleEntityNotFound(_0x28905f,null))['then'](function(_0x710189){if(_0x710189){_0x373436=_0x710189['remoteUri'];var _0x84f11=_0x373436[_0x9fdf('0x5b')](-0x1);if(_0x84f11==='/'){_0x373436=_0x373436[_0x9fdf('0x5c')](0x0,_0x373436[_0x9fdf('0x5d')](_0x84f11));}_0x5acb3f=new jsforce[(_0x9fdf('0x5e'))]({'oauth2':{'loginUrl':_0x373436,'clientId':_0x710189['clientId'],'clientSecret':_0x710189[_0x9fdf('0x57')]}});return _0x5acb3f[_0x9fdf('0x5f')](_0x710189[_0x9fdf('0x58')],_0x710189[_0x9fdf('0x59')][_0x9fdf('0x60')](_0x710189[_0x9fdf('0x5a')]));}})['then'](function(_0x41fb1a){if(_0x41fb1a){if(!_[_0x9fdf('0x61')](_0x11a946[_0x9fdf('0x31')][_0x9fdf('0x62')])){_0x2e4e13=_0x11a946[_0x9fdf('0x31')]['ticketType'];}return _0x5acb3f[_0x9fdf('0x63')](_0x2e4e13)[_0x9fdf('0x64')]();}})[_0x9fdf('0x26')](function(_0x19c17c){var _0x2bd62c=[_0x9fdf('0x65'),_0x9fdf('0x66'),_0x9fdf('0x67'),_0x9fdf('0x68'),_0x9fdf('0x69'),_0x9fdf('0x6a')];var _0x37ab4f=[_0x9fdf('0x6b'),'int',_0x9fdf('0x6c'),_0x9fdf('0x6d'),'email','textarea',_0x9fdf('0x6e')];if(_0x19c17c){_[_0x9fdf('0x6f')](_0x19c17c[_0x9fdf('0x36')],function(_0x32957e){return _0x2bd62c[_0x9fdf('0x70')](_0x32957e[_0x9fdf('0x29')])||!_0x37ab4f[_0x9fdf('0x70')](_0x32957e[_0x9fdf('0x2e')]);});return{'count':_0x19c17c[_0x9fdf('0x36')]['length'],'rows':_[_0x9fdf('0x2b')](_0x19c17c[_0x9fdf('0x36')],function(_0x10743a){return{'id':_0x10743a['name'],'name':_0x10743a[_0x9fdf('0x71')],'custom':_0x10743a[_0x9fdf('0x72')],'options':_0x10743a[_0x9fdf('0x73')][_0x9fdf('0x37')]>0x0?_['map'](_0x10743a['picklistValues'],function(_0x1712c8){return{'name':_0x1712c8[_0x9fdf('0x71')],'value':_0x1712c8[_0x9fdf('0x74')]};}):_0x10743a[_0x9fdf('0x2e')]==_0x9fdf('0x6d')?[{'name':'True','value':_0x9fdf('0x75')},{'name':_0x9fdf('0x76'),'value':_0x9fdf('0x77')}]:[]};})};}})[_0x9fdf('0x26')](respondWithResult(_0x28905f,null))[_0x9fdf('0x44')](function(_0x50295a){var _0xecc174=_0x11a946['query'][_0x9fdf('0x78')]?0x1f4:_0x50295a['statusCode']||0x1f4;logger[_0x9fdf('0x79')](_0x9fdf('0x7a'),_0x9fdf('0x55'),_0xecc174,JSON[_0x9fdf('0x7b')](_0x50295a));delete _0x50295a[_0x9fdf('0x29')];if(_0xecc174===0x191){_0xecc174=0x190;}_0x28905f[_0x9fdf('0x21')](_0xecc174)[_0x9fdf('0x7c')](_0x11a946[_0x9fdf('0x31')]['test']?{'message':_0x9fdf('0x7d'),'statusCode':_0x50295a[_0x9fdf('0x7e')]}:_0x50295a);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ecb969b..4323f8b 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 _0xa0e5=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','request-promise'];(function(_0x4dd7d,_0x15ba43){var _0x47eb48=function(_0x3e9819){while(--_0x3e9819){_0x4dd7d['push'](_0x4dd7d['shift']());}};_0x47eb48(++_0x15ba43);}(_0xa0e5,0x175));var _0x5a0e=function(_0x4e71a1,_0xba979c){_0x4e71a1=_0x4e71a1-0x0;var _0x580a10=_0xa0e5[_0x4e71a1];return _0x580a10;};'use strict';var _=require(_0x5a0e('0x0'));var util=require(_0x5a0e('0x1'));var logger=require('../../config/logger')(_0x5a0e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a0e('0x3'));var fs=require('fs');var path=require(_0x5a0e('0x4'));var rimraf=require(_0x5a0e('0x5'));var config=require(_0x5a0e('0x6'));var attributes=require(_0x5a0e('0x7'));var integrations=require(_0x5a0e('0x8'));module[_0x5a0e('0x9')]=function(_0x3054a4,_0x5751b6){return _0x3054a4[_0x5a0e('0xa')](_0x5a0e('0xb'),attributes,{'tableName':_0x5a0e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3caa=['exports','define','SalesforceAccount','lodash','util','api','moment','bluebird','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x3caa,0x99));var _0xa3ca=function(_0x498f14,_0x40798b){_0x498f14=_0x498f14-0x0;var _0x194d4d=_0x3caa[_0x498f14];return _0x194d4d;};'use strict';var _=require(_0xa3ca('0x0'));var util=require(_0xa3ca('0x1'));var logger=require('../../config/logger')(_0xa3ca('0x2'));var moment=require(_0xa3ca('0x3'));var BPromise=require(_0xa3ca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa3ca('0x5'));var integrations=require(_0xa3ca('0x6'));module[_0xa3ca('0x7')]=function(_0x55d4b1,_0xcc654a){return _0x55d4b1[_0xa3ca('0x8')](_0xa3ca('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index d34d25e..7525ca9 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 _0x38a8=['../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','find','raw','ShowSalesforceAccount','lodash','moment','bluebird','randomstring'];(function(_0x3e3221,_0x392851){var _0x190da4=function(_0x13d601){while(--_0x13d601){_0x3e3221['push'](_0x3e3221['shift']());}};_0x190da4(++_0x392851);}(_0x38a8,0x10c));var _0x838a=function(_0x253bd2,_0x4e88ff){_0x253bd2=_0x253bd2-0x0;var _0x457ff9=_0x38a8[_0x253bd2];return _0x457ff9;};'use strict';var _=require(_0x838a('0x0'));var util=require('util');var moment=require(_0x838a('0x1'));var BPromise=require(_0x838a('0x2'));var rs=require(_0x838a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x838a('0x4'))['db'];var utils=require(_0x838a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x838a('0x6'));var client=jayson[_0x838a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b3dfc,_0x4bed2f,_0x49236f){return new BPromise(function(_0x3abd44,_0x304a0e){return client[_0x838a('0x8')](_0x5b3dfc,_0x49236f)[_0x838a('0x9')](function(_0x330267){logger[_0x838a('0xa')](_0x838a('0xb'),_0x4bed2f,_0x838a('0xc'));logger[_0x838a('0xd')](_0x838a('0xe'),_0x4bed2f,'request\x20sent',JSON[_0x838a('0xf')](_0x330267));if(_0x330267[_0x838a('0x10')]){if(_0x330267[_0x838a('0x10')][_0x838a('0x11')]===0x1f4){logger['error'](_0x838a('0xb'),_0x4bed2f,_0x330267['error'][_0x838a('0x12')]);return _0x304a0e(_0x330267[_0x838a('0x10')][_0x838a('0x12')]);}logger[_0x838a('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4bed2f,_0x330267[_0x838a('0x10')]['message']);return _0x3abd44(_0x330267[_0x838a('0x10')][_0x838a('0x12')]);}else{logger[_0x838a('0xa')](_0x838a('0xb'),_0x4bed2f,_0x838a('0xc'));_0x3abd44(_0x330267[_0x838a('0x13')][_0x838a('0x12')]);}})[_0x838a('0x14')](function(_0x5d3467){logger[_0x838a('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x4bed2f,_0x5d3467);_0x304a0e(_0x5d3467);});});}exports[_0x838a('0x15')]=function(_0x247ba3){var _0x29b3d9=this;return new Promise(function(_0x394a90,_0xa76fa5){return db[_0x838a('0x16')][_0x838a('0x17')]({'raw':_0x247ba3[_0x838a('0x18')]?_0x247ba3[_0x838a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x247ba3[_0x838a('0x18')]?_0x247ba3[_0x838a('0x18')][_0x838a('0x19')]||null:null,'attributes':_0x247ba3[_0x838a('0x18')]?_0x247ba3[_0x838a('0x18')][_0x838a('0x1a')]||null:null,'limit':_0x247ba3[_0x838a('0x18')]?_0x247ba3['options'][_0x838a('0x1b')]||null:null,'include':_0x247ba3[_0x838a('0x18')]?_0x247ba3['options'][_0x838a('0x1c')]?_[_0x838a('0x1d')](_0x247ba3['options'][_0x838a('0x1c')],function(_0x175a30){return{'model':db[_0x175a30['model']],'as':_0x175a30['as'],'attributes':_0x175a30[_0x838a('0x1a')],'include':_0x175a30['include']?_[_0x838a('0x1d')](_0x175a30[_0x838a('0x1c')],function(_0x12b65d){return{'model':db[_0x12b65d[_0x838a('0x1e')]],'as':_0x12b65d['as'],'attributes':_0x12b65d['attributes'],'include':_0x12b65d[_0x838a('0x1c')]?_[_0x838a('0x1d')](_0x12b65d[_0x838a('0x1c')],function(_0x41f955){return{'model':db[_0x41f955['model']],'as':_0x41f955['as'],'attributes':_0x41f955['attributes']};}):[]};}):[]};}):[]:[]})[_0x838a('0x9')](function(_0x3134c9){logger[_0x838a('0xa')]('GetSalesforceAccount',_0x247ba3);logger[_0x838a('0xd')](_0x838a('0x15'),_0x247ba3,JSON[_0x838a('0xf')](_0x3134c9));_0x394a90(_0x3134c9);})[_0x838a('0x14')](function(_0x593998){logger[_0x838a('0x10')](_0x838a('0x15'),_0x593998['message'],_0x247ba3);_0xa76fa5(_0x29b3d9['error'](0x1f4,_0x593998['message']));});});};exports['ShowSalesforceAccount']=function(_0x1d2c55){var _0x84b00f=this;return new Promise(function(_0x259c95,_0x515af5){return db[_0x838a('0x16')][_0x838a('0x1f')]({'raw':_0x1d2c55[_0x838a('0x18')]?_0x1d2c55[_0x838a('0x18')][_0x838a('0x20')]===undefined?!![]:![]:!![],'where':_0x1d2c55[_0x838a('0x18')]?_0x1d2c55[_0x838a('0x18')]['where']||null:null,'attributes':_0x1d2c55[_0x838a('0x18')]?_0x1d2c55[_0x838a('0x18')]['attributes']||null:null,'include':_0x1d2c55[_0x838a('0x18')]?_0x1d2c55[_0x838a('0x18')][_0x838a('0x1c')]?_[_0x838a('0x1d')](_0x1d2c55[_0x838a('0x18')][_0x838a('0x1c')],function(_0xc9b31f){return{'model':db[_0xc9b31f[_0x838a('0x1e')]],'as':_0xc9b31f['as'],'attributes':_0xc9b31f[_0x838a('0x1a')],'include':_0xc9b31f[_0x838a('0x1c')]?_[_0x838a('0x1d')](_0xc9b31f[_0x838a('0x1c')],function(_0x60c64a){return{'model':db[_0x60c64a['model']],'as':_0x60c64a['as'],'attributes':_0x60c64a[_0x838a('0x1a')],'include':_0x60c64a['include']?_['map'](_0x60c64a['include'],function(_0x55294b){return{'model':db[_0x55294b[_0x838a('0x1e')]],'as':_0x55294b['as'],'attributes':_0x55294b[_0x838a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x139d5d){logger['info']('ShowSalesforceAccount',_0x1d2c55);logger[_0x838a('0xd')](_0x838a('0x21'),_0x1d2c55,JSON[_0x838a('0xf')](_0x139d5d));_0x259c95(_0x139d5d);})[_0x838a('0x14')](function(_0x44515e){logger[_0x838a('0x10')](_0x838a('0x21'),_0x44515e[_0x838a('0x12')],_0x1d2c55);_0x515af5(_0x84b00f[_0x838a('0x10')](0x1f4,_0x44515e[_0x838a('0x12')]));});});}; \ No newline at end of file +var _0xa836=['http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','map','model','include','ShowSalesforceAccount','find','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x29e189,_0x499077){var _0x380cc9=function(_0x52ffba){while(--_0x52ffba){_0x29e189['push'](_0x29e189['shift']());}};_0x380cc9(++_0x499077);}(_0xa836,0x162));var _0x6a83=function(_0x4ec922,_0x53bda6){_0x4ec922=_0x4ec922-0x0;var _0x53757f=_0xa836[_0x4ec922];return _0x53757f;};'use strict';var _=require(_0x6a83('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6a83('0x1'));var fs=require('fs');var Redis=require(_0x6a83('0x2'));var db=require(_0x6a83('0x3'))['db'];var utils=require(_0x6a83('0x4'));var logger=require(_0x6a83('0x5'))(_0x6a83('0x6'));var config=require('../../config/environment');var jayson=require(_0x6a83('0x7'));var client=jayson[_0x6a83('0x8')][_0x6a83('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a83b7,_0x4ffb1a,_0x407d24){return new BPromise(function(_0x3b40bc,_0x4eb6b8){return client[_0x6a83('0xa')](_0x2a83b7,_0x407d24)[_0x6a83('0xb')](function(_0x515801){logger[_0x6a83('0xc')](_0x6a83('0xd'),_0x4ffb1a,_0x6a83('0xe'));logger[_0x6a83('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4ffb1a,'request\x20sent',JSON[_0x6a83('0x10')](_0x515801));if(_0x515801[_0x6a83('0x11')]){if(_0x515801[_0x6a83('0x11')][_0x6a83('0x12')]===0x1f4){logger[_0x6a83('0x11')](_0x6a83('0xd'),_0x4ffb1a,_0x515801[_0x6a83('0x11')][_0x6a83('0x13')]);return _0x4eb6b8(_0x515801['error'][_0x6a83('0x13')]);}logger['error'](_0x6a83('0xd'),_0x4ffb1a,_0x515801[_0x6a83('0x11')][_0x6a83('0x13')]);return _0x3b40bc(_0x515801['error'][_0x6a83('0x13')]);}else{logger[_0x6a83('0xc')](_0x6a83('0xd'),_0x4ffb1a,'request\x20sent');_0x3b40bc(_0x515801['result'][_0x6a83('0x13')]);}})[_0x6a83('0x14')](function(_0x146ff2){logger[_0x6a83('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x4ffb1a,_0x146ff2);_0x4eb6b8(_0x146ff2);});});}exports[_0x6a83('0x15')]=function(_0x2b1220){var _0x260072=this;return new Promise(function(_0x33f30a,_0x3d730d){return db[_0x6a83('0x16')]['findAll']({'raw':_0x2b1220[_0x6a83('0x17')]?_0x2b1220[_0x6a83('0x17')][_0x6a83('0x18')]===undefined?!![]:![]:!![],'where':_0x2b1220[_0x6a83('0x17')]?_0x2b1220[_0x6a83('0x17')][_0x6a83('0x19')]||null:null,'attributes':_0x2b1220[_0x6a83('0x17')]?_0x2b1220[_0x6a83('0x17')][_0x6a83('0x1a')]||null:null,'limit':_0x2b1220[_0x6a83('0x17')]?_0x2b1220['options'][_0x6a83('0x1b')]||null:null,'include':_0x2b1220['options']?_0x2b1220[_0x6a83('0x17')]['include']?_[_0x6a83('0x1c')](_0x2b1220[_0x6a83('0x17')]['include'],function(_0x1f9c0b){return{'model':db[_0x1f9c0b[_0x6a83('0x1d')]],'as':_0x1f9c0b['as'],'attributes':_0x1f9c0b[_0x6a83('0x1a')],'include':_0x1f9c0b['include']?_[_0x6a83('0x1c')](_0x1f9c0b[_0x6a83('0x1e')],function(_0x1738e7){return{'model':db[_0x1738e7['model']],'as':_0x1738e7['as'],'attributes':_0x1738e7[_0x6a83('0x1a')],'include':_0x1738e7[_0x6a83('0x1e')]?_['map'](_0x1738e7[_0x6a83('0x1e')],function(_0x3d9b0a){return{'model':db[_0x3d9b0a[_0x6a83('0x1d')]],'as':_0x3d9b0a['as'],'attributes':_0x3d9b0a[_0x6a83('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6a83('0xb')](function(_0xa7dafe){logger[_0x6a83('0xc')](_0x6a83('0x15'),_0x2b1220);logger[_0x6a83('0xf')](_0x6a83('0x15'),_0x2b1220,JSON[_0x6a83('0x10')](_0xa7dafe));_0x33f30a(_0xa7dafe);})['catch'](function(_0xab9417){logger[_0x6a83('0x11')](_0x6a83('0x15'),_0xab9417[_0x6a83('0x13')],_0x2b1220);_0x3d730d(_0x260072[_0x6a83('0x11')](0x1f4,_0xab9417[_0x6a83('0x13')]));});});};exports[_0x6a83('0x1f')]=function(_0x4813dc){var _0x5ce329=this;return new Promise(function(_0x4e7cac,_0x2cdc81){return db[_0x6a83('0x16')][_0x6a83('0x20')]({'raw':_0x4813dc[_0x6a83('0x17')]?_0x4813dc['options'][_0x6a83('0x18')]===undefined?!![]:![]:!![],'where':_0x4813dc[_0x6a83('0x17')]?_0x4813dc[_0x6a83('0x17')][_0x6a83('0x19')]||null:null,'attributes':_0x4813dc['options']?_0x4813dc[_0x6a83('0x17')][_0x6a83('0x1a')]||null:null,'include':_0x4813dc['options']?_0x4813dc[_0x6a83('0x17')][_0x6a83('0x1e')]?_[_0x6a83('0x1c')](_0x4813dc[_0x6a83('0x17')][_0x6a83('0x1e')],function(_0x56a157){return{'model':db[_0x56a157['model']],'as':_0x56a157['as'],'attributes':_0x56a157[_0x6a83('0x1a')],'include':_0x56a157[_0x6a83('0x1e')]?_[_0x6a83('0x1c')](_0x56a157[_0x6a83('0x1e')],function(_0x40273e){return{'model':db[_0x40273e[_0x6a83('0x1d')]],'as':_0x40273e['as'],'attributes':_0x40273e[_0x6a83('0x1a')],'include':_0x40273e['include']?_[_0x6a83('0x1c')](_0x40273e[_0x6a83('0x1e')],function(_0x7e5697){return{'model':db[_0x7e5697[_0x6a83('0x1d')]],'as':_0x7e5697['as'],'attributes':_0x7e5697[_0x6a83('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6a83('0xb')](function(_0x262fde){logger[_0x6a83('0xc')]('ShowSalesforceAccount',_0x4813dc);logger[_0x6a83('0xf')](_0x6a83('0x1f'),_0x4813dc,JSON[_0x6a83('0x10')](_0x262fde));_0x4e7cac(_0x262fde);})[_0x6a83('0x14')](function(_0x17c375){logger[_0x6a83('0x11')](_0x6a83('0x1f'),_0x17c375[_0x6a83('0x13')],_0x4813dc);_0x2cdc81(_0x5ce329[_0x6a83('0x11')](0x1f4,_0x17c375[_0x6a83('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 10d5255..8726940 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x5dc041,_0x3b8c07){var _0x53cfb6=function(_0x1093c2){while(--_0x1093c2){_0x5dc041['push'](_0x5dc041['shift']());}};_0x53cfb6(++_0x3b8c07);}(_0x2ef3,0xba));var _0x32ef=function(_0x34f915,_0x238fba){_0x34f915=_0x34f915-0x0;var _0x542afe=_0x2ef3[_0x34f915];return _0x542afe;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xdb28,0x106));var _0x8db2=function(_0x223469,_0x2e0d09){_0x223469=_0x223469-0x0;var _0x4b992f=_0xdb28[_0x223469];return _0x4b992f;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('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 86da6b6..7af967c 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 _0xf506=['account','exports','STRING','Case','Task','ENUM','contact_lead','contact','lead','account_contact_lead'];(function(_0x3d4c3d,_0x911eac){var _0x19b294=function(_0x3d73f5){while(--_0x3d73f5){_0x3d4c3d['push'](_0x3d4c3d['shift']());}};_0x19b294(++_0x911eac);}(_0xf506,0x12d));var _0x6f50=function(_0x347b34,_0x2c92b9){_0x347b34=_0x347b34-0x0;var _0x3a93ae=_0xf506[_0x347b34];return _0x3a93ae;};'use strict';var Sequelize=require('sequelize');module[_0x6f50('0x0')]={'name':{'type':Sequelize[_0x6f50('0x1')]},'description':{'type':Sequelize[_0x6f50('0x1')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x6f50('0x2')),'defaultValue':_0x6f50('0x3')},'moduleSearch':{'type':Sequelize[_0x6f50('0x4')](_0x6f50('0x5'),_0x6f50('0x6'),_0x6f50('0x7'),_0x6f50('0x8'),_0x6f50('0x9')),'defaultValue':_0x6f50('0x5')},'moduleCreate':{'type':Sequelize[_0x6f50('0x4')]('nothing',_0x6f50('0x6'),_0x6f50('0x7'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x6f50('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x6f50('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x6f50('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x6f50('0x1')]}}; \ No newline at end of file +var _0xcd6a=['STRING','ENUM','Task','Case','contact_lead','account_contact_lead','account','nothing','contact','lead'];(function(_0x40566d,_0x3775ef){var _0x5be48c=function(_0x5a7e5a){while(--_0x5a7e5a){_0x40566d['push'](_0x40566d['shift']());}};_0x5be48c(++_0x3775ef);}(_0xcd6a,0xbe));var _0xacd6=function(_0x358c85,_0x555eca){_0x358c85=_0x358c85-0x0;var _0x309fa=_0xcd6a[_0x358c85];return _0x309fa;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xacd6('0x0')]},'description':{'type':Sequelize[_0xacd6('0x0')]},'ticketType':{'type':Sequelize[_0xacd6('0x1')](_0xacd6('0x2'),_0xacd6('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xacd6('0x1')](_0xacd6('0x4'),'contact','lead',_0xacd6('0x5'),_0xacd6('0x6')),'defaultValue':_0xacd6('0x4')},'moduleCreate':{'type':Sequelize[_0xacd6('0x1')](_0xacd6('0x7'),_0xacd6('0x8'),_0xacd6('0x9'),'account'),'defaultValue':_0xacd6('0x9')},'leadId':{'type':Sequelize[_0xacd6('0x0')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xacd6('0x0')]},'additionalSearchLead':{'type':Sequelize[_0xacd6('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index f8d2d9c..e964527 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 _0x5450=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','destroy','then','sendStatus','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','model','include','find','catch','create','body','update','getFields','findOne','order','pick','nolimit','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','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'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x5450,0x133));var _0x0545=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5450[_0x2e4aa2];return _0x5e6092;};'use strict';var emlformat=require(_0x0545('0x0'));var rimraf=require(_0x0545('0x1'));var zipdir=require(_0x0545('0x2'));var jsonpatch=require(_0x0545('0x3'));var rp=require(_0x0545('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0545('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0545('0x6'));var csv=require(_0x0545('0x7'));var ejs=require(_0x0545('0x8'));var fs=require('fs');var fs_extra=require(_0x0545('0x9'));var _=require('lodash');var squel=require(_0x0545('0xa'));var crypto=require('crypto');var jsforce=require(_0x0545('0xb'));var deskjs=require(_0x0545('0xc'));var toCsv=require(_0x0545('0x7'));var querystring=require(_0x0545('0xd'));var Papa=require('papaparse');var Redis=require(_0x0545('0xe'));var authService=require(_0x0545('0xf'));var qs=require(_0x0545('0x10'));var as=require(_0x0545('0x11'));var hardwareService=require(_0x0545('0x12'));var logger=require(_0x0545('0x13'))(_0x0545('0x14'));var utils=require(_0x0545('0x15'));var config=require(_0x0545('0x16'));var licenseUtil=require(_0x0545('0x17'));var db=require(_0x0545('0x18'))['db'];function respondWithStatusCode(_0x49c5eb,_0x37f4ea){_0x37f4ea=_0x37f4ea||0xcc;return function(_0x26e9e8){if(_0x26e9e8){return _0x49c5eb['sendStatus'](_0x37f4ea);}return _0x49c5eb[_0x0545('0x19')](_0x37f4ea)[_0x0545('0x1a')]();};}function respondWithResult(_0x3c573f,_0x532bc7){_0x532bc7=_0x532bc7||0xc8;return function(_0x3d0e18){if(_0x3d0e18){return _0x3c573f[_0x0545('0x19')](_0x532bc7)[_0x0545('0x1b')](_0x3d0e18);}};}function respondWithFilteredResult(_0x57b9ea,_0x3092ca){return function(_0x4f650d){if(_0x4f650d){var _0x51c6bc=typeof _0x3092ca['offset']==='undefined'&&typeof _0x3092ca[_0x0545('0x1c')]===_0x0545('0x1d');var _0x4492c0=_0x4f650d[_0x0545('0x1e')];var _0x5bf173=_0x51c6bc?0x0:_0x3092ca[_0x0545('0x1f')];var _0x1f47ca=_0x51c6bc?_0x4f650d[_0x0545('0x1e')]:_0x3092ca['offset']+_0x3092ca[_0x0545('0x1c')];var _0x33e04f;if(_0x1f47ca>=_0x4492c0){_0x1f47ca=_0x4492c0;_0x33e04f=0xc8;}else{_0x33e04f=0xce;}_0x57b9ea[_0x0545('0x19')](_0x33e04f);return _0x57b9ea['set'](_0x0545('0x20'),_0x5bf173+'-'+_0x1f47ca+'/'+_0x4492c0)[_0x0545('0x1b')](_0x4f650d);}return null;};}function patchUpdates(_0x5d9bd4){return function(_0x2ffd51){try{jsonpatch[_0x0545('0x21')](_0x2ffd51,_0x5d9bd4,!![]);}catch(_0x1eb318){return BPromise['reject'](_0x1eb318);}return _0x2ffd51[_0x0545('0x22')]();};}function saveUpdates(_0x267d4e,_0x16a509){return function(_0x5a906c){if(_0x5a906c){return _0x5a906c['update'](_0x267d4e)['then'](function(_0xe13de3){return _0xe13de3;});}return null;};}function removeEntity(_0x432320,_0x33da86){return function(_0x26f614){if(_0x26f614){return _0x26f614[_0x0545('0x23')]()[_0x0545('0x24')](function(){_0x432320[_0x0545('0x19')](0xcc)[_0x0545('0x1a')]();});}};}function handleEntityNotFound(_0x435d2d,_0x3f2580){return function(_0x58bfc4){if(!_0x58bfc4){_0x435d2d[_0x0545('0x25')](0x194);}return _0x58bfc4;};}function handleError(_0x5232ff,_0x4ed050){_0x4ed050=_0x4ed050||0x1f4;return function(_0x4d2b8b){logger[_0x0545('0x26')](_0x4d2b8b[_0x0545('0x27')]);if(_0x4d2b8b[_0x0545('0x28')]){delete _0x4d2b8b[_0x0545('0x28')];}_0x5232ff[_0x0545('0x19')](_0x4ed050)[_0x0545('0x29')](_0x4d2b8b);};}exports[_0x0545('0x2a')]=function(_0xeaa46a,_0x384c63){var _0x1f0e0a={},_0x29f0f8={},_0xf90711={'count':0x0,'rows':[]};var _0x425829=_[_0x0545('0x2b')](db[_0x0545('0x2c')][_0x0545('0x2d')],function(_0x2b98cb){return{'name':_0x2b98cb['fieldName'],'type':_0x2b98cb['type'][_0x0545('0x2e')]};});_0x29f0f8['model']=_['map'](_0x425829,_0x0545('0x28'));_0x29f0f8[_0x0545('0x2f')]=_[_0x0545('0x30')](_0xeaa46a[_0x0545('0x2f')]);_0x29f0f8['filters']=_[_0x0545('0x31')](_0x29f0f8['model'],_0x29f0f8[_0x0545('0x2f')]);_0x1f0e0a[_0x0545('0x32')]=_[_0x0545('0x31')](_0x29f0f8['model'],qs[_0x0545('0x33')](_0xeaa46a[_0x0545('0x2f')]['fields']));_0x1f0e0a[_0x0545('0x32')]=_0x1f0e0a['attributes'][_0x0545('0x34')]?_0x1f0e0a['attributes']:_0x29f0f8['model'];if(!_0xeaa46a[_0x0545('0x2f')][_0x0545('0x35')]('nolimit')){_0x1f0e0a[_0x0545('0x1c')]=qs[_0x0545('0x1c')](_0xeaa46a[_0x0545('0x2f')][_0x0545('0x1c')]);_0x1f0e0a[_0x0545('0x1f')]=qs[_0x0545('0x1f')](_0xeaa46a[_0x0545('0x2f')]['offset']);}_0x1f0e0a['order']=qs[_0x0545('0x36')](_0xeaa46a['query']['sort']);_0x1f0e0a[_0x0545('0x37')]=qs[_0x0545('0x38')](_['pick'](_0xeaa46a['query'],_0x29f0f8[_0x0545('0x38')]),_0x425829);if(_0xeaa46a[_0x0545('0x2f')][_0x0545('0x39')]){_0x1f0e0a[_0x0545('0x37')]=_['merge'](_0x1f0e0a[_0x0545('0x37')],{'$or':_[_0x0545('0x2b')](_0x425829,function(_0x1e03c5){if(_0x1e03c5[_0x0545('0x3a')]!==_0x0545('0x3b')){var _0x25ed74={};_0x25ed74[_0x1e03c5[_0x0545('0x28')]]={'$like':'%'+_0xeaa46a[_0x0545('0x2f')][_0x0545('0x39')]+'%'};return _0x25ed74;}})});}_0x1f0e0a=_[_0x0545('0x3c')]({},_0x1f0e0a,_0xeaa46a[_0x0545('0x3d')]);var _0x57144c={'where':_0x1f0e0a[_0x0545('0x37')]};return db['SalesforceConfiguration']['count'](_0x57144c)['then'](function(_0x5e3092){_0xf90711[_0x0545('0x1e')]=_0x5e3092;if(_0xeaa46a[_0x0545('0x2f')][_0x0545('0x3e')]){_0x1f0e0a['include']=[{'all':!![]}];}return db[_0x0545('0x2c')][_0x0545('0x3f')](_0x1f0e0a);})[_0x0545('0x24')](function(_0x5ec51b){_0xf90711[_0x0545('0x40')]=_0x5ec51b;return _0xf90711;})['then'](respondWithFilteredResult(_0x384c63,_0x1f0e0a))['catch'](handleError(_0x384c63,null));};exports[_0x0545('0x41')]=function(_0x341789,_0x199617){var _0x337cf9={'raw':![],'where':{'id':_0x341789[_0x0545('0x42')]['id']}},_0x2992ab={};_0x2992ab[_0x0545('0x43')]=_[_0x0545('0x30')](db[_0x0545('0x2c')][_0x0545('0x2d')]);_0x2992ab[_0x0545('0x2f')]=_[_0x0545('0x30')](_0x341789[_0x0545('0x2f')]);_0x2992ab['filters']=_['intersection'](_0x2992ab[_0x0545('0x43')],_0x2992ab[_0x0545('0x2f')]);_0x337cf9['attributes']=_[_0x0545('0x31')](_0x2992ab[_0x0545('0x43')],qs[_0x0545('0x33')](_0x341789[_0x0545('0x2f')][_0x0545('0x33')]));_0x337cf9[_0x0545('0x32')]=_0x337cf9[_0x0545('0x32')]['length']?_0x337cf9['attributes']:_0x2992ab[_0x0545('0x43')];if(_0x341789[_0x0545('0x2f')][_0x0545('0x3e')]){_0x337cf9[_0x0545('0x44')]=[{'all':!![]}];}_0x337cf9=_[_0x0545('0x3c')]({},_0x337cf9,_0x341789['options']);return db['SalesforceConfiguration'][_0x0545('0x45')](_0x337cf9)['then'](handleEntityNotFound(_0x199617,null))[_0x0545('0x24')](respondWithResult(_0x199617,null))[_0x0545('0x46')](handleError(_0x199617,null));};exports['create']=function(_0x4a5efe,_0x40011d){return db[_0x0545('0x2c')][_0x0545('0x47')](_0x4a5efe[_0x0545('0x48')],{})[_0x0545('0x24')](respondWithResult(_0x40011d,0xc9))['catch'](handleError(_0x40011d,null));};exports[_0x0545('0x49')]=function(_0x5bf593,_0x3fc36f){if(_0x5bf593[_0x0545('0x48')]['id']){delete _0x5bf593[_0x0545('0x48')]['id'];}return db['SalesforceConfiguration'][_0x0545('0x45')]({'where':{'id':_0x5bf593[_0x0545('0x42')]['id']}})[_0x0545('0x24')](handleEntityNotFound(_0x3fc36f,null))[_0x0545('0x24')](saveUpdates(_0x5bf593['body'],null))[_0x0545('0x24')](respondWithResult(_0x3fc36f,null))[_0x0545('0x46')](handleError(_0x3fc36f,null));};exports['destroy']=function(_0x2186bb,_0x5d6c9e){return db['SalesforceConfiguration'][_0x0545('0x45')]({'where':{'id':_0x2186bb[_0x0545('0x42')]['id']}})[_0x0545('0x24')](handleEntityNotFound(_0x5d6c9e,null))[_0x0545('0x24')](removeEntity(_0x5d6c9e,null))['catch'](handleError(_0x5d6c9e,null));};exports[_0x0545('0x4a')]=function(_0x3ba711,_0x4f9a65,_0x4653ed){var _0x3de748={};var _0x52ab97={};var _0x538419;var _0x101739;return db[_0x0545('0x2c')][_0x0545('0x4b')]({'where':{'id':_0x3ba711['params']['id']}})[_0x0545('0x24')](handleEntityNotFound(_0x4f9a65,null))[_0x0545('0x24')](function(_0xcc7627){if(_0xcc7627){_0x538419=_0xcc7627;_0x52ab97['model']=_[_0x0545('0x30')](db['SalesforceField'][_0x0545('0x2d')]);_0x52ab97['query']=_[_0x0545('0x30')](_0x3ba711[_0x0545('0x2f')]);_0x52ab97[_0x0545('0x38')]=_[_0x0545('0x31')](_0x52ab97['model'],_0x52ab97['query']);_0x3de748['attributes']=_[_0x0545('0x31')](_0x52ab97[_0x0545('0x43')],qs[_0x0545('0x33')](_0x3ba711[_0x0545('0x2f')][_0x0545('0x33')]));_0x3de748[_0x0545('0x32')]=_0x3de748['attributes'][_0x0545('0x34')]?_0x3de748[_0x0545('0x32')]:_0x52ab97[_0x0545('0x43')];_0x3de748[_0x0545('0x4c')]=qs[_0x0545('0x36')](_0x3ba711[_0x0545('0x2f')]['sort']);_0x3de748[_0x0545('0x37')]=qs[_0x0545('0x38')](_[_0x0545('0x4d')](_0x3ba711[_0x0545('0x2f')],_0x52ab97[_0x0545('0x38')]));if(_0x3ba711['query'][_0x0545('0x39')]){_0x3de748[_0x0545('0x37')]=_[_0x0545('0x3c')](_0x3de748[_0x0545('0x37')],{'$or':_[_0x0545('0x2b')](_0x3de748[_0x0545('0x32')],function(_0x4f32e7){var _0x1971de={};_0x1971de[_0x4f32e7]={'$like':'%'+_0x3ba711[_0x0545('0x2f')][_0x0545('0x39')]+'%'};return _0x1971de;})});}_0x3de748=_['merge']({},_0x3de748,_0x3ba711[_0x0545('0x3d')]);return _0x538419[_0x0545('0x4a')](_0x3de748);}})['then'](function(_0x19627b){if(_0x19627b){_0x101739=_0x19627b[_0x0545('0x34')];if(!_0x3ba711[_0x0545('0x2f')][_0x0545('0x35')](_0x0545('0x4e'))){_0x3de748[_0x0545('0x1c')]=qs[_0x0545('0x1c')](_0x3ba711[_0x0545('0x2f')][_0x0545('0x1c')]);_0x3de748[_0x0545('0x1f')]=qs[_0x0545('0x1f')](_0x3ba711[_0x0545('0x2f')][_0x0545('0x1f')]);}return _0x538419[_0x0545('0x4a')](_0x3de748);}})[_0x0545('0x24')](function(_0x3e0c1c){if(_0x3e0c1c){return _0x3e0c1c?{'count':_0x101739,'rows':_0x3e0c1c}:null;}})[_0x0545('0x24')](respondWithResult(_0x4f9a65,null))['catch'](handleError(_0x4f9a65,null));};exports[_0x0545('0x4f')]=function(_0x4be5cf,_0x67316a,_0x37ac44){var _0x54e129={};var _0x588ea8={};var _0x15028d;var _0x5b5e5f;return db[_0x0545('0x2c')][_0x0545('0x4b')]({'where':{'id':_0x4be5cf[_0x0545('0x42')]['id']}})['then'](handleEntityNotFound(_0x67316a,null))[_0x0545('0x24')](function(_0x2c9969){if(_0x2c9969){_0x15028d=_0x2c9969;_0x588ea8[_0x0545('0x43')]=_[_0x0545('0x30')](db['SalesforceField'][_0x0545('0x2d')]);_0x588ea8[_0x0545('0x2f')]=_['keys'](_0x4be5cf[_0x0545('0x2f')]);_0x588ea8[_0x0545('0x38')]=_[_0x0545('0x31')](_0x588ea8['model'],_0x588ea8[_0x0545('0x2f')]);_0x54e129[_0x0545('0x32')]=_[_0x0545('0x31')](_0x588ea8['model'],qs[_0x0545('0x33')](_0x4be5cf[_0x0545('0x2f')][_0x0545('0x33')]));_0x54e129['attributes']=_0x54e129[_0x0545('0x32')][_0x0545('0x34')]?_0x54e129[_0x0545('0x32')]:_0x588ea8[_0x0545('0x43')];_0x54e129[_0x0545('0x4c')]=qs['sort'](_0x4be5cf[_0x0545('0x2f')][_0x0545('0x36')]);_0x54e129[_0x0545('0x37')]=qs[_0x0545('0x38')](_[_0x0545('0x4d')](_0x4be5cf[_0x0545('0x2f')],_0x588ea8[_0x0545('0x38')]));if(_0x4be5cf[_0x0545('0x2f')][_0x0545('0x39')]){_0x54e129['where']=_[_0x0545('0x3c')](_0x54e129['where'],{'$or':_[_0x0545('0x2b')](_0x54e129['attributes'],function(_0x1a8bc9){var _0x5d1f8a={};_0x5d1f8a[_0x1a8bc9]={'$like':'%'+_0x4be5cf['query'][_0x0545('0x39')]+'%'};return _0x5d1f8a;})});}_0x54e129=_[_0x0545('0x3c')]({},_0x54e129,_0x4be5cf[_0x0545('0x3d')]);return _0x15028d[_0x0545('0x4f')](_0x54e129);}})[_0x0545('0x24')](function(_0x5641c0){if(_0x5641c0){_0x5b5e5f=_0x5641c0[_0x0545('0x34')];if(!_0x4be5cf[_0x0545('0x2f')][_0x0545('0x35')](_0x0545('0x4e'))){_0x54e129[_0x0545('0x1c')]=qs[_0x0545('0x1c')](_0x4be5cf[_0x0545('0x2f')]['limit']);_0x54e129[_0x0545('0x1f')]=qs[_0x0545('0x1f')](_0x4be5cf[_0x0545('0x2f')][_0x0545('0x1f')]);}return _0x15028d[_0x0545('0x4f')](_0x54e129);}})['then'](function(_0x302187){if(_0x302187){return _0x302187?{'count':_0x5b5e5f,'rows':_0x302187}:null;}})[_0x0545('0x24')](respondWithResult(_0x67316a,null))[_0x0545('0x46')](handleError(_0x67316a,null));};exports['getDescriptions']=function(_0x272ee2,_0x777816,_0x9f5787){var _0x520fb8={};var _0x291aac={};var _0x581514;var _0x430837;return db[_0x0545('0x2c')][_0x0545('0x4b')]({'where':{'id':_0x272ee2[_0x0545('0x42')]['id']}})['then'](handleEntityNotFound(_0x777816,null))[_0x0545('0x24')](function(_0x4a61bf){if(_0x4a61bf){_0x581514=_0x4a61bf;_0x291aac[_0x0545('0x43')]=_[_0x0545('0x30')](db[_0x0545('0x50')][_0x0545('0x2d')]);_0x291aac['query']=_[_0x0545('0x30')](_0x272ee2[_0x0545('0x2f')]);_0x291aac[_0x0545('0x38')]=_['intersection'](_0x291aac[_0x0545('0x43')],_0x291aac[_0x0545('0x2f')]);_0x520fb8[_0x0545('0x32')]=_[_0x0545('0x31')](_0x291aac['model'],qs[_0x0545('0x33')](_0x272ee2[_0x0545('0x2f')][_0x0545('0x33')]));_0x520fb8['attributes']=_0x520fb8[_0x0545('0x32')][_0x0545('0x34')]?_0x520fb8['attributes']:_0x291aac['model'];_0x520fb8[_0x0545('0x4c')]=qs[_0x0545('0x36')](_0x272ee2[_0x0545('0x2f')][_0x0545('0x36')]);_0x520fb8[_0x0545('0x37')]=qs[_0x0545('0x38')](_[_0x0545('0x4d')](_0x272ee2['query'],_0x291aac['filters']));if(_0x272ee2['query']['filter']){_0x520fb8[_0x0545('0x37')]=_['merge'](_0x520fb8[_0x0545('0x37')],{'$or':_[_0x0545('0x2b')](_0x520fb8[_0x0545('0x32')],function(_0x104e75){var _0x427519={};_0x427519[_0x104e75]={'$like':'%'+_0x272ee2[_0x0545('0x2f')][_0x0545('0x39')]+'%'};return _0x427519;})});}_0x520fb8=_[_0x0545('0x3c')]({},_0x520fb8,_0x272ee2[_0x0545('0x3d')]);return _0x581514[_0x0545('0x51')](_0x520fb8);}})[_0x0545('0x24')](function(_0x8c90a9){if(_0x8c90a9){_0x430837=_0x8c90a9[_0x0545('0x34')];if(!_0x272ee2[_0x0545('0x2f')][_0x0545('0x35')]('nolimit')){_0x520fb8['limit']=qs[_0x0545('0x1c')](_0x272ee2[_0x0545('0x2f')][_0x0545('0x1c')]);_0x520fb8[_0x0545('0x1f')]=qs[_0x0545('0x1f')](_0x272ee2[_0x0545('0x2f')][_0x0545('0x1f')]);}return _0x581514['getDescriptions'](_0x520fb8);}})[_0x0545('0x24')](function(_0x5d075c){if(_0x5d075c){return _0x5d075c?{'count':_0x430837,'rows':_0x5d075c}:null;}})['then'](respondWithResult(_0x777816,null))['catch'](handleError(_0x777816,null));}; \ No newline at end of file +var _0x80ab=['body','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create'];(function(_0x5d1594,_0x55fd12){var _0x56a18f=function(_0x3eff73){while(--_0x3eff73){_0x5d1594['push'](_0x5d1594['shift']());}};_0x56a18f(++_0x55fd12);}(_0x80ab,0x143));var _0xb80a=function(_0x3e0040,_0x2c81a0){_0x3e0040=_0x3e0040-0x0;var _0x29a07c=_0x80ab[_0x3e0040];return _0x29a07c;};'use strict';var emlformat=require(_0xb80a('0x0'));var rimraf=require(_0xb80a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb80a('0x2'));var rp=require(_0xb80a('0x3'));var moment=require(_0xb80a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb80a('0x5'));var util=require(_0xb80a('0x6'));var path=require('path');var sox=require(_0xb80a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb80a('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb80a('0x9'));var jsforce=require(_0xb80a('0xa'));var deskjs=require(_0xb80a('0xb'));var toCsv=require(_0xb80a('0xc'));var querystring=require('querystring');var Papa=require(_0xb80a('0xd'));var Redis=require(_0xb80a('0xe'));var authService=require(_0xb80a('0xf'));var qs=require(_0xb80a('0x10'));var as=require(_0xb80a('0x11'));var hardwareService=require(_0xb80a('0x12'));var logger=require(_0xb80a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb80a('0x14'));var licenseUtil=require(_0xb80a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x349b98,_0x454dde){_0x454dde=_0x454dde||0xcc;return function(_0x571ae9){if(_0x571ae9){return _0x349b98[_0xb80a('0x16')](_0x454dde);}return _0x349b98[_0xb80a('0x17')](_0x454dde)[_0xb80a('0x18')]();};}function respondWithResult(_0x5e461f,_0x1fbba1){_0x1fbba1=_0x1fbba1||0xc8;return function(_0x5fe140){if(_0x5fe140){return _0x5e461f[_0xb80a('0x17')](_0x1fbba1)[_0xb80a('0x19')](_0x5fe140);}};}function respondWithFilteredResult(_0x2bac3a,_0x5e51ac){return function(_0x429ec7){if(_0x429ec7){var _0x907821=typeof _0x5e51ac[_0xb80a('0x1a')]==='undefined'&&typeof _0x5e51ac[_0xb80a('0x1b')]===_0xb80a('0x1c');var _0x2e10ce=_0x429ec7[_0xb80a('0x1d')];var _0x2007ea=_0x907821?0x0:_0x5e51ac[_0xb80a('0x1a')];var _0x198808=_0x907821?_0x429ec7[_0xb80a('0x1d')]:_0x5e51ac[_0xb80a('0x1a')]+_0x5e51ac['limit'];var _0x4b83a0;if(_0x198808>=_0x2e10ce){_0x198808=_0x2e10ce;_0x4b83a0=0xc8;}else{_0x4b83a0=0xce;}_0x2bac3a[_0xb80a('0x17')](_0x4b83a0);return _0x2bac3a[_0xb80a('0x1e')](_0xb80a('0x1f'),_0x2007ea+'-'+_0x198808+'/'+_0x2e10ce)['json'](_0x429ec7);}return null;};}function patchUpdates(_0x9e7529){return function(_0x449d5e){try{jsonpatch[_0xb80a('0x20')](_0x449d5e,_0x9e7529,!![]);}catch(_0x5a5165){return BPromise[_0xb80a('0x21')](_0x5a5165);}return _0x449d5e[_0xb80a('0x22')]();};}function saveUpdates(_0x18f3ef,_0x338350){return function(_0xfe1d5c){if(_0xfe1d5c){return _0xfe1d5c[_0xb80a('0x23')](_0x18f3ef)[_0xb80a('0x24')](function(_0x5973b0){return _0x5973b0;});}return null;};}function removeEntity(_0x4ba212,_0x19565e){return function(_0x1b00a0){if(_0x1b00a0){return _0x1b00a0[_0xb80a('0x25')]()[_0xb80a('0x24')](function(){_0x4ba212[_0xb80a('0x17')](0xcc)[_0xb80a('0x18')]();});}};}function handleEntityNotFound(_0x776b44,_0x30cd3b){return function(_0x375b2b){if(!_0x375b2b){_0x776b44[_0xb80a('0x16')](0x194);}return _0x375b2b;};}function handleError(_0x3f967d,_0x2fdf8c){_0x2fdf8c=_0x2fdf8c||0x1f4;return function(_0x1b83b4){logger[_0xb80a('0x26')](_0x1b83b4['stack']);if(_0x1b83b4[_0xb80a('0x27')]){delete _0x1b83b4[_0xb80a('0x27')];}_0x3f967d['status'](_0x2fdf8c)[_0xb80a('0x28')](_0x1b83b4);};}exports[_0xb80a('0x29')]=function(_0x36fa59,_0x363716){var _0x2927af={},_0x15e56a={},_0x4796de={'count':0x0,'rows':[]};var _0x3e8ffa=_[_0xb80a('0x2a')](db[_0xb80a('0x2b')][_0xb80a('0x2c')],function(_0x596a18){return{'name':_0x596a18[_0xb80a('0x2d')],'type':_0x596a18[_0xb80a('0x2e')][_0xb80a('0x2f')]};});_0x15e56a['model']=_[_0xb80a('0x2a')](_0x3e8ffa,_0xb80a('0x27'));_0x15e56a[_0xb80a('0x30')]=_[_0xb80a('0x31')](_0x36fa59['query']);_0x15e56a[_0xb80a('0x32')]=_[_0xb80a('0x33')](_0x15e56a['model'],_0x15e56a[_0xb80a('0x30')]);_0x2927af[_0xb80a('0x34')]=_['intersection'](_0x15e56a[_0xb80a('0x35')],qs[_0xb80a('0x36')](_0x36fa59[_0xb80a('0x30')][_0xb80a('0x36')]));_0x2927af[_0xb80a('0x34')]=_0x2927af['attributes'][_0xb80a('0x37')]?_0x2927af[_0xb80a('0x34')]:_0x15e56a['model'];if(!_0x36fa59[_0xb80a('0x30')][_0xb80a('0x38')](_0xb80a('0x39'))){_0x2927af['limit']=qs[_0xb80a('0x1b')](_0x36fa59[_0xb80a('0x30')][_0xb80a('0x1b')]);_0x2927af[_0xb80a('0x1a')]=qs[_0xb80a('0x1a')](_0x36fa59['query'][_0xb80a('0x1a')]);}_0x2927af[_0xb80a('0x3a')]=qs[_0xb80a('0x3b')](_0x36fa59[_0xb80a('0x30')][_0xb80a('0x3b')]);_0x2927af[_0xb80a('0x3c')]=qs['filters'](_['pick'](_0x36fa59[_0xb80a('0x30')],_0x15e56a[_0xb80a('0x32')]),_0x3e8ffa);if(_0x36fa59[_0xb80a('0x30')][_0xb80a('0x3d')]){_0x2927af['where']=_['merge'](_0x2927af[_0xb80a('0x3c')],{'$or':_[_0xb80a('0x2a')](_0x3e8ffa,function(_0x39bdbb){if(_0x39bdbb['type']!=='VIRTUAL'){var _0x10529c={};_0x10529c[_0x39bdbb[_0xb80a('0x27')]]={'$like':'%'+_0x36fa59[_0xb80a('0x30')]['filter']+'%'};return _0x10529c;}})});}_0x2927af=_[_0xb80a('0x3e')]({},_0x2927af,_0x36fa59[_0xb80a('0x3f')]);var _0x379860={'where':_0x2927af[_0xb80a('0x3c')]};return db[_0xb80a('0x2b')][_0xb80a('0x1d')](_0x379860)[_0xb80a('0x24')](function(_0x5bcbcd){_0x4796de[_0xb80a('0x1d')]=_0x5bcbcd;if(_0x36fa59['query'][_0xb80a('0x40')]){_0x2927af[_0xb80a('0x41')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xb80a('0x42')](_0x2927af);})[_0xb80a('0x24')](function(_0x4a3e2a){_0x4796de[_0xb80a('0x43')]=_0x4a3e2a;return _0x4796de;})[_0xb80a('0x24')](respondWithFilteredResult(_0x363716,_0x2927af))[_0xb80a('0x44')](handleError(_0x363716,null));};exports['show']=function(_0xdede8a,_0x22036e){var _0x1cd88={'raw':![],'where':{'id':_0xdede8a[_0xb80a('0x45')]['id']}},_0x160a59={};_0x160a59[_0xb80a('0x35')]=_[_0xb80a('0x31')](db['SalesforceConfiguration'][_0xb80a('0x2c')]);_0x160a59[_0xb80a('0x30')]=_[_0xb80a('0x31')](_0xdede8a[_0xb80a('0x30')]);_0x160a59['filters']=_['intersection'](_0x160a59[_0xb80a('0x35')],_0x160a59[_0xb80a('0x30')]);_0x1cd88[_0xb80a('0x34')]=_['intersection'](_0x160a59[_0xb80a('0x35')],qs[_0xb80a('0x36')](_0xdede8a[_0xb80a('0x30')]['fields']));_0x1cd88[_0xb80a('0x34')]=_0x1cd88[_0xb80a('0x34')][_0xb80a('0x37')]?_0x1cd88[_0xb80a('0x34')]:_0x160a59[_0xb80a('0x35')];if(_0xdede8a[_0xb80a('0x30')][_0xb80a('0x40')]){_0x1cd88[_0xb80a('0x41')]=[{'all':!![]}];}_0x1cd88=_[_0xb80a('0x3e')]({},_0x1cd88,_0xdede8a[_0xb80a('0x3f')]);return db['SalesforceConfiguration'][_0xb80a('0x46')](_0x1cd88)[_0xb80a('0x24')](handleEntityNotFound(_0x22036e,null))[_0xb80a('0x24')](respondWithResult(_0x22036e,null))[_0xb80a('0x44')](handleError(_0x22036e,null));};exports[_0xb80a('0x47')]=function(_0x52751f,_0x5aaa23){return db[_0xb80a('0x2b')]['create'](_0x52751f[_0xb80a('0x48')],{})[_0xb80a('0x24')](respondWithResult(_0x5aaa23,0xc9))[_0xb80a('0x44')](handleError(_0x5aaa23,null));};exports[_0xb80a('0x23')]=function(_0xd91fe5,_0x434082){if(_0xd91fe5[_0xb80a('0x48')]['id']){delete _0xd91fe5[_0xb80a('0x48')]['id'];}return db[_0xb80a('0x2b')][_0xb80a('0x46')]({'where':{'id':_0xd91fe5['params']['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x434082,null))[_0xb80a('0x24')](saveUpdates(_0xd91fe5[_0xb80a('0x48')],null))[_0xb80a('0x24')](respondWithResult(_0x434082,null))[_0xb80a('0x44')](handleError(_0x434082,null));};exports[_0xb80a('0x25')]=function(_0x48b02e,_0x3a0a70){return db['SalesforceConfiguration'][_0xb80a('0x46')]({'where':{'id':_0x48b02e[_0xb80a('0x45')]['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x3a0a70,null))[_0xb80a('0x24')](removeEntity(_0x3a0a70,null))[_0xb80a('0x44')](handleError(_0x3a0a70,null));};exports[_0xb80a('0x49')]=function(_0x1bef2e,_0x43d48e,_0x209274){var _0x296bee={};var _0x42558a={};var _0x1a6f86;var _0x59a490;return db[_0xb80a('0x2b')][_0xb80a('0x4a')]({'where':{'id':_0x1bef2e[_0xb80a('0x45')]['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x43d48e,null))['then'](function(_0xc05311){if(_0xc05311){_0x1a6f86=_0xc05311;_0x42558a[_0xb80a('0x35')]=_[_0xb80a('0x31')](db[_0xb80a('0x4b')][_0xb80a('0x2c')]);_0x42558a['query']=_[_0xb80a('0x31')](_0x1bef2e['query']);_0x42558a[_0xb80a('0x32')]=_[_0xb80a('0x33')](_0x42558a[_0xb80a('0x35')],_0x42558a[_0xb80a('0x30')]);_0x296bee['attributes']=_['intersection'](_0x42558a['model'],qs[_0xb80a('0x36')](_0x1bef2e[_0xb80a('0x30')][_0xb80a('0x36')]));_0x296bee[_0xb80a('0x34')]=_0x296bee[_0xb80a('0x34')][_0xb80a('0x37')]?_0x296bee[_0xb80a('0x34')]:_0x42558a['model'];_0x296bee[_0xb80a('0x3a')]=qs[_0xb80a('0x3b')](_0x1bef2e[_0xb80a('0x30')][_0xb80a('0x3b')]);_0x296bee[_0xb80a('0x3c')]=qs[_0xb80a('0x32')](_[_0xb80a('0x4c')](_0x1bef2e['query'],_0x42558a[_0xb80a('0x32')]));if(_0x1bef2e[_0xb80a('0x30')]['filter']){_0x296bee[_0xb80a('0x3c')]=_[_0xb80a('0x3e')](_0x296bee['where'],{'$or':_[_0xb80a('0x2a')](_0x296bee[_0xb80a('0x34')],function(_0x222189){var _0x1012a0={};_0x1012a0[_0x222189]={'$like':'%'+_0x1bef2e[_0xb80a('0x30')]['filter']+'%'};return _0x1012a0;})});}_0x296bee=_['merge']({},_0x296bee,_0x1bef2e[_0xb80a('0x3f')]);return _0x1a6f86[_0xb80a('0x49')](_0x296bee);}})[_0xb80a('0x24')](function(_0x115396){if(_0x115396){_0x59a490=_0x115396[_0xb80a('0x37')];if(!_0x1bef2e[_0xb80a('0x30')][_0xb80a('0x38')](_0xb80a('0x39'))){_0x296bee[_0xb80a('0x1b')]=qs[_0xb80a('0x1b')](_0x1bef2e['query']['limit']);_0x296bee[_0xb80a('0x1a')]=qs[_0xb80a('0x1a')](_0x1bef2e[_0xb80a('0x30')][_0xb80a('0x1a')]);}return _0x1a6f86['getFields'](_0x296bee);}})[_0xb80a('0x24')](function(_0x45477a){if(_0x45477a){return _0x45477a?{'count':_0x59a490,'rows':_0x45477a}:null;}})[_0xb80a('0x24')](respondWithResult(_0x43d48e,null))['catch'](handleError(_0x43d48e,null));};exports[_0xb80a('0x4d')]=function(_0xff8489,_0x2b50de,_0x138623){var _0x3e8b81={};var _0x54fcf5={};var _0x1c3416;var _0x9a656;return db[_0xb80a('0x2b')]['findOne']({'where':{'id':_0xff8489[_0xb80a('0x45')]['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x2b50de,null))['then'](function(_0x1cf5c9){if(_0x1cf5c9){_0x1c3416=_0x1cf5c9;_0x54fcf5[_0xb80a('0x35')]=_[_0xb80a('0x31')](db[_0xb80a('0x4b')][_0xb80a('0x2c')]);_0x54fcf5[_0xb80a('0x30')]=_[_0xb80a('0x31')](_0xff8489[_0xb80a('0x30')]);_0x54fcf5['filters']=_[_0xb80a('0x33')](_0x54fcf5[_0xb80a('0x35')],_0x54fcf5[_0xb80a('0x30')]);_0x3e8b81['attributes']=_[_0xb80a('0x33')](_0x54fcf5[_0xb80a('0x35')],qs['fields'](_0xff8489[_0xb80a('0x30')][_0xb80a('0x36')]));_0x3e8b81[_0xb80a('0x34')]=_0x3e8b81['attributes'][_0xb80a('0x37')]?_0x3e8b81[_0xb80a('0x34')]:_0x54fcf5['model'];_0x3e8b81['order']=qs[_0xb80a('0x3b')](_0xff8489[_0xb80a('0x30')][_0xb80a('0x3b')]);_0x3e8b81[_0xb80a('0x3c')]=qs['filters'](_[_0xb80a('0x4c')](_0xff8489[_0xb80a('0x30')],_0x54fcf5[_0xb80a('0x32')]));if(_0xff8489[_0xb80a('0x30')][_0xb80a('0x3d')]){_0x3e8b81[_0xb80a('0x3c')]=_['merge'](_0x3e8b81['where'],{'$or':_[_0xb80a('0x2a')](_0x3e8b81['attributes'],function(_0x5a6529){var _0x451d49={};_0x451d49[_0x5a6529]={'$like':'%'+_0xff8489[_0xb80a('0x30')][_0xb80a('0x3d')]+'%'};return _0x451d49;})});}_0x3e8b81=_[_0xb80a('0x3e')]({},_0x3e8b81,_0xff8489['options']);return _0x1c3416[_0xb80a('0x4d')](_0x3e8b81);}})[_0xb80a('0x24')](function(_0x1a55f9){if(_0x1a55f9){_0x9a656=_0x1a55f9[_0xb80a('0x37')];if(!_0xff8489[_0xb80a('0x30')][_0xb80a('0x38')](_0xb80a('0x39'))){_0x3e8b81['limit']=qs['limit'](_0xff8489[_0xb80a('0x30')][_0xb80a('0x1b')]);_0x3e8b81[_0xb80a('0x1a')]=qs[_0xb80a('0x1a')](_0xff8489[_0xb80a('0x30')][_0xb80a('0x1a')]);}return _0x1c3416[_0xb80a('0x4d')](_0x3e8b81);}})[_0xb80a('0x24')](function(_0x337d3f){if(_0x337d3f){return _0x337d3f?{'count':_0x9a656,'rows':_0x337d3f}:null;}})['then'](respondWithResult(_0x2b50de,null))[_0xb80a('0x44')](handleError(_0x2b50de,null));};exports[_0xb80a('0x4e')]=function(_0x1e334,_0x331b13,_0x395009){var _0x2b718f={};var _0x21cf2e={};var _0x2dcf19;var _0x5d8040;return db['SalesforceConfiguration'][_0xb80a('0x4a')]({'where':{'id':_0x1e334[_0xb80a('0x45')]['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x331b13,null))[_0xb80a('0x24')](function(_0x547816){if(_0x547816){_0x2dcf19=_0x547816;_0x21cf2e[_0xb80a('0x35')]=_[_0xb80a('0x31')](db['SalesforceField'][_0xb80a('0x2c')]);_0x21cf2e[_0xb80a('0x30')]=_['keys'](_0x1e334[_0xb80a('0x30')]);_0x21cf2e[_0xb80a('0x32')]=_[_0xb80a('0x33')](_0x21cf2e[_0xb80a('0x35')],_0x21cf2e['query']);_0x2b718f[_0xb80a('0x34')]=_[_0xb80a('0x33')](_0x21cf2e['model'],qs['fields'](_0x1e334['query'][_0xb80a('0x36')]));_0x2b718f[_0xb80a('0x34')]=_0x2b718f[_0xb80a('0x34')][_0xb80a('0x37')]?_0x2b718f['attributes']:_0x21cf2e['model'];_0x2b718f[_0xb80a('0x3a')]=qs[_0xb80a('0x3b')](_0x1e334[_0xb80a('0x30')]['sort']);_0x2b718f[_0xb80a('0x3c')]=qs['filters'](_['pick'](_0x1e334[_0xb80a('0x30')],_0x21cf2e[_0xb80a('0x32')]));if(_0x1e334[_0xb80a('0x30')]['filter']){_0x2b718f[_0xb80a('0x3c')]=_[_0xb80a('0x3e')](_0x2b718f[_0xb80a('0x3c')],{'$or':_['map'](_0x2b718f[_0xb80a('0x34')],function(_0x2fef40){var _0x2283ba={};_0x2283ba[_0x2fef40]={'$like':'%'+_0x1e334[_0xb80a('0x30')][_0xb80a('0x3d')]+'%'};return _0x2283ba;})});}_0x2b718f=_['merge']({},_0x2b718f,_0x1e334['options']);return _0x2dcf19[_0xb80a('0x4e')](_0x2b718f);}})[_0xb80a('0x24')](function(_0x3110f6){if(_0x3110f6){_0x5d8040=_0x3110f6[_0xb80a('0x37')];if(!_0x1e334[_0xb80a('0x30')][_0xb80a('0x38')]('nolimit')){_0x2b718f['limit']=qs[_0xb80a('0x1b')](_0x1e334[_0xb80a('0x30')][_0xb80a('0x1b')]);_0x2b718f[_0xb80a('0x1a')]=qs[_0xb80a('0x1a')](_0x1e334[_0xb80a('0x30')]['offset']);}return _0x2dcf19[_0xb80a('0x4e')](_0x2b718f);}})['then'](function(_0x177c04){if(_0x177c04){return _0x177c04?{'count':_0x5d8040,'rows':_0x177c04}:null;}})[_0xb80a('0x24')](respondWithResult(_0x331b13,null))[_0xb80a('0x44')](handleError(_0x331b13,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 65f1333..19c747e 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 _0xd33a=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd33a,0x1df));var _0xad33=function(_0x5103ed,_0x1ed66d){_0x5103ed=_0x5103ed-0x0;var _0xf61316=_0xd33a[_0x5103ed];return _0xf61316;};'use strict';var _=require(_0xad33('0x0'));var util=require(_0xad33('0x1'));var logger=require(_0xad33('0x2'))('api');var moment=require(_0xad33('0x3'));var BPromise=require(_0xad33('0x4'));var rp=require(_0xad33('0x5'));var fs=require('fs');var path=require(_0xad33('0x6'));var rimraf=require(_0xad33('0x7'));var config=require(_0xad33('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xad33('0x9')]=function(_0x240315,_0x1bb216){return _0x240315[_0xad33('0xa')](_0xad33('0xb'),attributes,{'tableName':_0xad33('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9044=['define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','exports'];(function(_0x308a9c,_0x1caa8a){var _0x1b2728=function(_0x1bd9ec){while(--_0x1bd9ec){_0x308a9c['push'](_0x308a9c['shift']());}};_0x1b2728(++_0x1caa8a);}(_0x9044,0x87));var _0x4904=function(_0x995239,_0x5d4841){_0x995239=_0x995239-0x0;var _0xa968b5=_0x9044[_0x995239];return _0xa968b5;};'use strict';var _=require(_0x4904('0x0'));var util=require(_0x4904('0x1'));var logger=require(_0x4904('0x2'))(_0x4904('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4904('0x4'));var fs=require('fs');var path=require(_0x4904('0x5'));var rimraf=require(_0x4904('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0x4904('0x7')]=function(_0x52fbad,_0x18b78f){return _0x52fbad[_0x4904('0x8')](_0x4904('0x9'),attributes,{'tableName':_0x4904('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index a96d0de..f010646 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 _0xb394=['debug','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','request','then','info','request\x20sent'];(function(_0x3adb1c,_0x562fb9){var _0x19e758=function(_0x28de35){while(--_0x28de35){_0x3adb1c['push'](_0x3adb1c['shift']());}};_0x19e758(++_0x562fb9);}(_0xb394,0x6c));var _0x4b39=function(_0xeb91aa,_0x11e3f6){_0xeb91aa=_0xeb91aa-0x0;var _0x42ecc7=_0xb394[_0xeb91aa];return _0x42ecc7;};'use strict';var _=require(_0x4b39('0x0'));var util=require(_0x4b39('0x1'));var moment=require(_0x4b39('0x2'));var BPromise=require(_0x4b39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b39('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4b39('0x5'))('rpc');var config=require(_0x4b39('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5638ce,_0x2ff08d,_0x3c6e65){return new BPromise(function(_0x128827,_0x22b963){return client[_0x4b39('0x7')](_0x5638ce,_0x3c6e65)[_0x4b39('0x8')](function(_0x301195){logger[_0x4b39('0x9')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2ff08d,_0x4b39('0xa'));logger[_0x4b39('0xb')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x2ff08d,'request\x20sent',JSON['stringify'](_0x301195));if(_0x301195[_0x4b39('0xc')]){if(_0x301195['error']['code']===0x1f4){logger[_0x4b39('0xc')](_0x4b39('0xd'),_0x2ff08d,_0x301195['error'][_0x4b39('0xe')]);return _0x22b963(_0x301195[_0x4b39('0xc')]['message']);}logger[_0x4b39('0xc')](_0x4b39('0xd'),_0x2ff08d,_0x301195[_0x4b39('0xc')][_0x4b39('0xe')]);return _0x128827(_0x301195[_0x4b39('0xc')][_0x4b39('0xe')]);}else{logger[_0x4b39('0x9')](_0x4b39('0xd'),_0x2ff08d,_0x4b39('0xa'));_0x128827(_0x301195[_0x4b39('0xf')][_0x4b39('0xe')]);}})[_0x4b39('0x10')](function(_0x214c8e){logger[_0x4b39('0xc')](_0x4b39('0xd'),_0x2ff08d,_0x214c8e);_0x22b963(_0x214c8e);});});} \ No newline at end of file +var _0x3694=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x436edf,_0x50ba4a){var _0x5087fb=function(_0x49fdd2){while(--_0x49fdd2){_0x436edf['push'](_0x436edf['shift']());}};_0x5087fb(++_0x50ba4a);}(_0x3694,0x17a));var _0x4369=function(_0x9ce343,_0x3f5bb9){_0x9ce343=_0x9ce343-0x0;var _0x4ddff0=_0x3694[_0x9ce343];return _0x4ddff0;};'use strict';var _=require('lodash');var util=require(_0x4369('0x0'));var moment=require(_0x4369('0x1'));var BPromise=require(_0x4369('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4369('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4369('0x4'));var logger=require(_0x4369('0x5'))(_0x4369('0x6'));var config=require(_0x4369('0x7'));var jayson=require(_0x4369('0x8'));var client=jayson['client'][_0x4369('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd040,_0x344915,_0x51db26){return new BPromise(function(_0x2a5e75,_0x652c03){return client[_0x4369('0xa')](_0x2fd040,_0x51db26)[_0x4369('0xb')](function(_0x1a1a98){logger[_0x4369('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x344915,_0x4369('0xd'));logger[_0x4369('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x344915,_0x4369('0xd'),JSON[_0x4369('0xf')](_0x1a1a98));if(_0x1a1a98[_0x4369('0x10')]){if(_0x1a1a98[_0x4369('0x10')]['code']===0x1f4){logger[_0x4369('0x10')](_0x4369('0x11'),_0x344915,_0x1a1a98[_0x4369('0x10')][_0x4369('0x12')]);return _0x652c03(_0x1a1a98[_0x4369('0x10')]['message']);}logger[_0x4369('0x10')](_0x4369('0x11'),_0x344915,_0x1a1a98[_0x4369('0x10')][_0x4369('0x12')]);return _0x2a5e75(_0x1a1a98[_0x4369('0x10')][_0x4369('0x12')]);}else{logger[_0x4369('0xc')](_0x4369('0x11'),_0x344915,'request\x20sent');_0x2a5e75(_0x1a1a98[_0x4369('0x13')][_0x4369('0x12')]);}})[_0x4369('0x14')](function(_0x105af1){logger['error'](_0x4369('0x11'),_0x344915,_0x105af1);_0x652c03(_0x105af1);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index fd6dd35..371c857 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 _0xc141=['create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post'];(function(_0x2f55f0,_0xbd116b){var _0x3ef3df=function(_0x4b02a9){while(--_0x4b02a9){_0x2f55f0['push'](_0x2f55f0['shift']());}};_0x3ef3df(++_0xbd116b);}(_0xc141,0x9e));var _0x1c14=function(_0x121328,_0x2c3815){_0x121328=_0x121328-0x0;var _0x28548a=_0xc141[_0x121328];return _0x28548a;};'use strict';var multer=require(_0x1c14('0x0'));var util=require(_0x1c14('0x1'));var path=require('path');var timeout=require(_0x1c14('0x2'));var express=require(_0x1c14('0x3'));var router=express[_0x1c14('0x4')]();var fs_extra=require(_0x1c14('0x5'));var auth=require(_0x1c14('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1c14('0x7'));var controller=require('./intSalesforceField.controller');router[_0x1c14('0x8')]('/',auth[_0x1c14('0x9')](),controller[_0x1c14('0xa')]);router[_0x1c14('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1c14('0xb')]);router[_0x1c14('0xc')]('/',auth[_0x1c14('0x9')](),controller[_0x1c14('0xd')]);router[_0x1c14('0xe')](_0x1c14('0xf'),auth[_0x1c14('0x9')](),controller[_0x1c14('0x10')]);router[_0x1c14('0x11')](_0x1c14('0xf'),auth[_0x1c14('0x9')](),controller['destroy']);module[_0x1c14('0x12')]=router; \ No newline at end of file +var _0xd0d0=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','create','update','delete','destroy','multer','util','path'];(function(_0x4687e4,_0x2d12f1){var _0x927c22=function(_0x2a87cb){while(--_0x2a87cb){_0x4687e4['push'](_0x4687e4['shift']());}};_0x927c22(++_0x2d12f1);}(_0xd0d0,0x1d1));var _0x0d0d=function(_0x53fb06,_0x523c8b){_0x53fb06=_0x53fb06-0x0;var _0x4a8bad=_0xd0d0[_0x53fb06];return _0x4a8bad;};'use strict';var multer=require(_0x0d0d('0x0'));var util=require(_0x0d0d('0x1'));var path=require(_0x0d0d('0x2'));var timeout=require(_0x0d0d('0x3'));var express=require(_0x0d0d('0x4'));var router=express[_0x0d0d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0d0d('0x6'));var interaction=require(_0x0d0d('0x7'));var config=require(_0x0d0d('0x8'));var controller=require(_0x0d0d('0x9'));router[_0x0d0d('0xa')]('/',auth['isAuthenticated'](),controller[_0x0d0d('0xb')]);router[_0x0d0d('0xa')](_0x0d0d('0xc'),auth[_0x0d0d('0xd')](),controller['show']);router['post']('/',auth[_0x0d0d('0xd')](),controller[_0x0d0d('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0d0d('0xf')]);router[_0x0d0d('0x10')](_0x0d0d('0xc'),auth['isAuthenticated'](),controller[_0x0d0d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index e8f2e9b..c1baf2a 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 _0xef85=['variable','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x428fd1,_0x22d64f){var _0x17883b=function(_0x1d5f06){while(--_0x1d5f06){_0x428fd1['push'](_0x428fd1['shift']());}};_0x17883b(++_0x22d64f);}(_0xef85,0x13c));var _0x5ef8=function(_0x4b7b79,_0x11ed7d){_0x4b7b79=_0x4b7b79-0x0;var _0x93a80c=_0xef85[_0x4b7b79];return _0x93a80c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5ef8('0x0')](_0x5ef8('0x1'),'variable',_0x5ef8('0x2'),_0x5ef8('0x3'),_0x5ef8('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5ef8('0x5')]},'keyType':{'type':Sequelize[_0x5ef8('0x0')]('string',_0x5ef8('0x6'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5ef8('0x5')]},'variableName':{'type':Sequelize[_0x5ef8('0x5')]}}; \ No newline at end of file +var _0x8a0c=['variable','keyValue','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x1230f6,_0x334699){var _0x964bc=function(_0x553c6b){while(--_0x553c6b){_0x1230f6['push'](_0x1230f6['shift']());}};_0x964bc(++_0x334699);}(_0x8a0c,0x1ac));var _0xc8a0=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x8a0c[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0xc8a0('0x0'));module[_0xc8a0('0x1')]={'type':{'type':Sequelize[_0xc8a0('0x2')](_0xc8a0('0x3'),_0xc8a0('0x4'),'customVariable',_0xc8a0('0x5'),'picklist'),'defaultValue':_0xc8a0('0x3')},'content':{'type':Sequelize[_0xc8a0('0x6')]},'key':{'type':Sequelize[_0xc8a0('0x6')]},'keyType':{'type':Sequelize[_0xc8a0('0x2')]('string',_0xc8a0('0x4'),_0xc8a0('0x7'))},'keyContent':{'type':Sequelize[_0xc8a0('0x6')]},'idField':{'type':Sequelize[_0xc8a0('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index fbcf0e1..22d7117 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 _0x1db8=['show','length','includeAll','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','catch'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x1db8,0xee));var _0x81db=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x1db8[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require(_0x81db('0x0'));var rimraf=require(_0x81db('0x1'));var zipdir=require('zip-dir');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('desk.js');var toCsv=require(_0x81db('0xa'));var querystring=require(_0x81db('0x10'));var Papa=require('papaparse');var Redis=require(_0x81db('0x11'));var authService=require(_0x81db('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x81db('0x13'));var hardwareService=require(_0x81db('0x14'));var logger=require(_0x81db('0x15'))(_0x81db('0x16'));var utils=require(_0x81db('0x17'));var config=require(_0x81db('0x18'));var licenseUtil=require(_0x81db('0x19'));var db=require(_0x81db('0x1a'))['db'];function respondWithStatusCode(_0x119fd8,_0x30ac4b){_0x30ac4b=_0x30ac4b||0xcc;return function(_0x6ae07a){if(_0x6ae07a){return _0x119fd8['sendStatus'](_0x30ac4b);}return _0x119fd8['status'](_0x30ac4b)[_0x81db('0x1b')]();};}function respondWithResult(_0xe59850,_0xc018af){_0xc018af=_0xc018af||0xc8;return function(_0x23d36e){if(_0x23d36e){return _0xe59850[_0x81db('0x1c')](_0xc018af)[_0x81db('0x1d')](_0x23d36e);}};}function respondWithFilteredResult(_0x593861,_0x4dd0cf){return function(_0xbc1b2b){if(_0xbc1b2b){var _0xb3f15e=typeof _0x4dd0cf[_0x81db('0x1e')]===_0x81db('0x1f')&&typeof _0x4dd0cf[_0x81db('0x20')]===_0x81db('0x1f');var _0x53dab7=_0xbc1b2b[_0x81db('0x21')];var _0x1b5600=_0xb3f15e?0x0:_0x4dd0cf['offset'];var _0x23eb98=_0xb3f15e?_0xbc1b2b[_0x81db('0x21')]:_0x4dd0cf[_0x81db('0x1e')]+_0x4dd0cf[_0x81db('0x20')];var _0x1c0d46;if(_0x23eb98>=_0x53dab7){_0x23eb98=_0x53dab7;_0x1c0d46=0xc8;}else{_0x1c0d46=0xce;}_0x593861['status'](_0x1c0d46);return _0x593861[_0x81db('0x22')](_0x81db('0x23'),_0x1b5600+'-'+_0x23eb98+'/'+_0x53dab7)[_0x81db('0x1d')](_0xbc1b2b);}return null;};}function patchUpdates(_0xf1375c){return function(_0x4d049e){try{jsonpatch['apply'](_0x4d049e,_0xf1375c,!![]);}catch(_0x456728){return BPromise[_0x81db('0x24')](_0x456728);}return _0x4d049e[_0x81db('0x25')]();};}function saveUpdates(_0x404ba5,_0x28ca03){return function(_0x4aeb6b){if(_0x4aeb6b){return _0x4aeb6b[_0x81db('0x26')](_0x404ba5)[_0x81db('0x27')](function(_0x5ba142){return _0x5ba142;});}return null;};}function removeEntity(_0x51d8bb,_0x40c99e){return function(_0x4f28d4){if(_0x4f28d4){return _0x4f28d4[_0x81db('0x28')]()['then'](function(){_0x51d8bb[_0x81db('0x1c')](0xcc)[_0x81db('0x1b')]();});}};}function handleEntityNotFound(_0x5b040f,_0x8c8312){return function(_0x470c2b){if(!_0x470c2b){_0x5b040f[_0x81db('0x29')](0x194);}return _0x470c2b;};}function handleError(_0x1bf78f,_0x42e7ca){_0x42e7ca=_0x42e7ca||0x1f4;return function(_0x2c8b94){logger[_0x81db('0x2a')](_0x2c8b94[_0x81db('0x2b')]);if(_0x2c8b94[_0x81db('0x2c')]){delete _0x2c8b94['name'];}_0x1bf78f[_0x81db('0x1c')](_0x42e7ca)[_0x81db('0x2d')](_0x2c8b94);};}exports[_0x81db('0x2e')]=function(_0x5ce46d,_0x5df8dc){var _0x561a2b={},_0x47b18d={},_0x5347b1={'count':0x0,'rows':[]};var _0x589230=_[_0x81db('0x2f')](db[_0x81db('0x30')][_0x81db('0x31')],function(_0x5bf881){return{'name':_0x5bf881[_0x81db('0x32')],'type':_0x5bf881[_0x81db('0x33')]['key']};});_0x47b18d[_0x81db('0x34')]=_['map'](_0x589230,_0x81db('0x2c'));_0x47b18d[_0x81db('0x35')]=_[_0x81db('0x36')](_0x5ce46d[_0x81db('0x35')]);_0x47b18d['filters']=_[_0x81db('0x37')](_0x47b18d[_0x81db('0x34')],_0x47b18d[_0x81db('0x35')]);_0x561a2b[_0x81db('0x38')]=_[_0x81db('0x37')](_0x47b18d[_0x81db('0x34')],qs[_0x81db('0x39')](_0x5ce46d[_0x81db('0x35')]['fields']));_0x561a2b['attributes']=_0x561a2b[_0x81db('0x38')]['length']?_0x561a2b[_0x81db('0x38')]:_0x47b18d['model'];if(!_0x5ce46d[_0x81db('0x35')]['hasOwnProperty']('nolimit')){_0x561a2b[_0x81db('0x20')]=qs[_0x81db('0x20')](_0x5ce46d[_0x81db('0x35')][_0x81db('0x20')]);_0x561a2b['offset']=qs[_0x81db('0x1e')](_0x5ce46d[_0x81db('0x35')][_0x81db('0x1e')]);}_0x561a2b[_0x81db('0x3a')]=qs[_0x81db('0x3b')](_0x5ce46d[_0x81db('0x35')][_0x81db('0x3b')]);_0x561a2b[_0x81db('0x3c')]=qs[_0x81db('0x3d')](_[_0x81db('0x3e')](_0x5ce46d['query'],_0x47b18d[_0x81db('0x3d')]),_0x589230);if(_0x5ce46d[_0x81db('0x35')][_0x81db('0x3f')]){_0x561a2b[_0x81db('0x3c')]=_[_0x81db('0x40')](_0x561a2b['where'],{'$or':_[_0x81db('0x2f')](_0x589230,function(_0x101bb7){if(_0x101bb7[_0x81db('0x33')]!==_0x81db('0x41')){var _0xa06c68={};_0xa06c68[_0x101bb7['name']]={'$like':'%'+_0x5ce46d[_0x81db('0x35')]['filter']+'%'};return _0xa06c68;}})});}_0x561a2b=_[_0x81db('0x40')]({},_0x561a2b,_0x5ce46d[_0x81db('0x42')]);var _0x5cc989={'where':_0x561a2b[_0x81db('0x3c')]};return db['SalesforceField'][_0x81db('0x21')](_0x5cc989)[_0x81db('0x27')](function(_0x33578d){_0x5347b1[_0x81db('0x21')]=_0x33578d;if(_0x5ce46d[_0x81db('0x35')]['includeAll']){_0x561a2b['include']=[{'all':!![]}];}return db[_0x81db('0x30')][_0x81db('0x43')](_0x561a2b);})[_0x81db('0x27')](function(_0x359d40){_0x5347b1[_0x81db('0x44')]=_0x359d40;return _0x5347b1;})['then'](respondWithFilteredResult(_0x5df8dc,_0x561a2b))[_0x81db('0x45')](handleError(_0x5df8dc,null));};exports[_0x81db('0x46')]=function(_0x5897af,_0x3eb708){var _0x568cbf={'raw':!![],'where':{'id':_0x5897af['params']['id']}},_0x3769a4={};_0x3769a4[_0x81db('0x34')]=_['keys'](db[_0x81db('0x30')][_0x81db('0x31')]);_0x3769a4[_0x81db('0x35')]=_['keys'](_0x5897af[_0x81db('0x35')]);_0x3769a4['filters']=_['intersection'](_0x3769a4[_0x81db('0x34')],_0x3769a4['query']);_0x568cbf['attributes']=_[_0x81db('0x37')](_0x3769a4['model'],qs[_0x81db('0x39')](_0x5897af[_0x81db('0x35')]['fields']));_0x568cbf[_0x81db('0x38')]=_0x568cbf[_0x81db('0x38')][_0x81db('0x47')]?_0x568cbf[_0x81db('0x38')]:_0x3769a4[_0x81db('0x34')];if(_0x5897af[_0x81db('0x35')][_0x81db('0x48')]){_0x568cbf['include']=[{'all':!![]}];}_0x568cbf=_[_0x81db('0x40')]({},_0x568cbf,_0x5897af[_0x81db('0x42')]);return db[_0x81db('0x30')]['find'](_0x568cbf)[_0x81db('0x27')](handleEntityNotFound(_0x3eb708,null))['then'](respondWithResult(_0x3eb708,null))[_0x81db('0x45')](handleError(_0x3eb708,null));};exports[_0x81db('0x49')]=function(_0x420dd0,_0x24f428){return db['SalesforceField']['create'](_0x420dd0['body'],{})[_0x81db('0x27')](respondWithResult(_0x24f428,0xc9))[_0x81db('0x45')](handleError(_0x24f428,null));};exports[_0x81db('0x26')]=function(_0x4da858,_0x5c2f10){if(_0x4da858[_0x81db('0x4a')]['id']){delete _0x4da858[_0x81db('0x4a')]['id'];}return db[_0x81db('0x30')][_0x81db('0x4b')]({'where':{'id':_0x4da858['params']['id']}})[_0x81db('0x27')](handleEntityNotFound(_0x5c2f10,null))[_0x81db('0x27')](saveUpdates(_0x4da858['body'],null))['then'](respondWithResult(_0x5c2f10,null))[_0x81db('0x45')](handleError(_0x5c2f10,null));};exports[_0x81db('0x28')]=function(_0x33ec0d,_0x4bc025){return db[_0x81db('0x30')][_0x81db('0x4b')]({'where':{'id':_0x33ec0d[_0x81db('0x4c')]['id']}})[_0x81db('0x27')](handleEntityNotFound(_0x4bc025,null))[_0x81db('0x27')](removeEntity(_0x4bc025,null))[_0x81db('0x45')](handleError(_0x4bc025,null));}; \ No newline at end of file +var _0x6465=['path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','rows','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x1e44ac,_0x1d99ab){var _0x19d8cd=function(_0x37ce84){while(--_0x37ce84){_0x1e44ac['push'](_0x1e44ac['shift']());}};_0x19d8cd(++_0x1d99ab);}(_0x6465,0x16f));var _0x5646=function(_0x236f5a,_0xe33e5c){_0x236f5a=_0x236f5a-0x0;var _0xb19e4b=_0x6465[_0x236f5a];return _0xb19e4b;};'use strict';var emlformat=require(_0x5646('0x0'));var rimraf=require(_0x5646('0x1'));var zipdir=require(_0x5646('0x2'));var jsonpatch=require(_0x5646('0x3'));var rp=require(_0x5646('0x4'));var moment=require('moment');var BPromise=require(_0x5646('0x5'));var Mustache=require(_0x5646('0x6'));var util=require(_0x5646('0x7'));var path=require(_0x5646('0x8'));var sox=require(_0x5646('0x9'));var csv=require(_0x5646('0xa'));var ejs=require(_0x5646('0xb'));var fs=require('fs');var fs_extra=require(_0x5646('0xc'));var _=require('lodash');var squel=require(_0x5646('0xd'));var crypto=require(_0x5646('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5646('0xf'));var toCsv=require(_0x5646('0xa'));var querystring=require(_0x5646('0x10'));var Papa=require('papaparse');var Redis=require(_0x5646('0x11'));var authService=require(_0x5646('0x12'));var qs=require(_0x5646('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5646('0x14'));var logger=require(_0x5646('0x15'))(_0x5646('0x16'));var utils=require('../../config/utils');var config=require(_0x5646('0x17'));var licenseUtil=require(_0x5646('0x18'));var db=require(_0x5646('0x19'))['db'];function respondWithStatusCode(_0x4f4326,_0x24024f){_0x24024f=_0x24024f||0xcc;return function(_0x5b9be6){if(_0x5b9be6){return _0x4f4326[_0x5646('0x1a')](_0x24024f);}return _0x4f4326[_0x5646('0x1b')](_0x24024f)[_0x5646('0x1c')]();};}function respondWithResult(_0x1c3b8c,_0x42f8aa){_0x42f8aa=_0x42f8aa||0xc8;return function(_0x1c775c){if(_0x1c775c){return _0x1c3b8c[_0x5646('0x1b')](_0x42f8aa)[_0x5646('0x1d')](_0x1c775c);}};}function respondWithFilteredResult(_0x1e960a,_0x578a04){return function(_0x4d82d6){if(_0x4d82d6){var _0x5cafc4=typeof _0x578a04[_0x5646('0x1e')]==='undefined'&&typeof _0x578a04['limit']===_0x5646('0x1f');var _0x10db02=_0x4d82d6[_0x5646('0x20')];var _0x25bf89=_0x5cafc4?0x0:_0x578a04[_0x5646('0x1e')];var _0x2a1834=_0x5cafc4?_0x4d82d6['count']:_0x578a04[_0x5646('0x1e')]+_0x578a04[_0x5646('0x21')];var _0x38584b;if(_0x2a1834>=_0x10db02){_0x2a1834=_0x10db02;_0x38584b=0xc8;}else{_0x38584b=0xce;}_0x1e960a[_0x5646('0x1b')](_0x38584b);return _0x1e960a[_0x5646('0x22')](_0x5646('0x23'),_0x25bf89+'-'+_0x2a1834+'/'+_0x10db02)['json'](_0x4d82d6);}return null;};}function patchUpdates(_0x405f25){return function(_0x50faf7){try{jsonpatch[_0x5646('0x24')](_0x50faf7,_0x405f25,!![]);}catch(_0x5844a0){return BPromise[_0x5646('0x25')](_0x5844a0);}return _0x50faf7[_0x5646('0x26')]();};}function saveUpdates(_0x204b6d,_0x328c8a){return function(_0x237f7a){if(_0x237f7a){return _0x237f7a[_0x5646('0x27')](_0x204b6d)[_0x5646('0x28')](function(_0x222406){return _0x222406;});}return null;};}function removeEntity(_0x579ab4,_0x5464bc){return function(_0x47f632){if(_0x47f632){return _0x47f632[_0x5646('0x29')]()[_0x5646('0x28')](function(){_0x579ab4[_0x5646('0x1b')](0xcc)[_0x5646('0x1c')]();});}};}function handleEntityNotFound(_0x458736,_0x5dbd06){return function(_0x2868df){if(!_0x2868df){_0x458736['sendStatus'](0x194);}return _0x2868df;};}function handleError(_0xda5294,_0x32b3e7){_0x32b3e7=_0x32b3e7||0x1f4;return function(_0x5f118a){logger[_0x5646('0x2a')](_0x5f118a[_0x5646('0x2b')]);if(_0x5f118a[_0x5646('0x2c')]){delete _0x5f118a[_0x5646('0x2c')];}_0xda5294['status'](_0x32b3e7)[_0x5646('0x2d')](_0x5f118a);};}exports['index']=function(_0x2ea13d,_0x303f64){var _0x399ede={},_0x588938={},_0x2a55f4={'count':0x0,'rows':[]};var _0x53fdd9=_[_0x5646('0x2e')](db[_0x5646('0x2f')][_0x5646('0x30')],function(_0xd80614){return{'name':_0xd80614[_0x5646('0x31')],'type':_0xd80614[_0x5646('0x32')]['key']};});_0x588938[_0x5646('0x33')]=_['map'](_0x53fdd9,'name');_0x588938[_0x5646('0x34')]=_[_0x5646('0x35')](_0x2ea13d[_0x5646('0x34')]);_0x588938[_0x5646('0x36')]=_['intersection'](_0x588938[_0x5646('0x33')],_0x588938[_0x5646('0x34')]);_0x399ede[_0x5646('0x37')]=_[_0x5646('0x38')](_0x588938[_0x5646('0x33')],qs[_0x5646('0x39')](_0x2ea13d[_0x5646('0x34')]['fields']));_0x399ede[_0x5646('0x37')]=_0x399ede[_0x5646('0x37')][_0x5646('0x3a')]?_0x399ede[_0x5646('0x37')]:_0x588938[_0x5646('0x33')];if(!_0x2ea13d[_0x5646('0x34')][_0x5646('0x3b')](_0x5646('0x3c'))){_0x399ede['limit']=qs['limit'](_0x2ea13d['query']['limit']);_0x399ede[_0x5646('0x1e')]=qs[_0x5646('0x1e')](_0x2ea13d[_0x5646('0x34')][_0x5646('0x1e')]);}_0x399ede['order']=qs[_0x5646('0x3d')](_0x2ea13d[_0x5646('0x34')][_0x5646('0x3d')]);_0x399ede[_0x5646('0x3e')]=qs['filters'](_[_0x5646('0x3f')](_0x2ea13d[_0x5646('0x34')],_0x588938['filters']),_0x53fdd9);if(_0x2ea13d[_0x5646('0x34')][_0x5646('0x40')]){_0x399ede[_0x5646('0x3e')]=_[_0x5646('0x41')](_0x399ede[_0x5646('0x3e')],{'$or':_['map'](_0x53fdd9,function(_0x2a79b5){if(_0x2a79b5[_0x5646('0x32')]!==_0x5646('0x42')){var _0x4af367={};_0x4af367[_0x2a79b5[_0x5646('0x2c')]]={'$like':'%'+_0x2ea13d['query'][_0x5646('0x40')]+'%'};return _0x4af367;}})});}_0x399ede=_[_0x5646('0x41')]({},_0x399ede,_0x2ea13d[_0x5646('0x43')]);var _0x295ec7={'where':_0x399ede['where']};return db[_0x5646('0x2f')][_0x5646('0x20')](_0x295ec7)[_0x5646('0x28')](function(_0x4d3f34){_0x2a55f4['count']=_0x4d3f34;if(_0x2ea13d[_0x5646('0x34')]['includeAll']){_0x399ede['include']=[{'all':!![]}];}return db[_0x5646('0x2f')]['findAll'](_0x399ede);})[_0x5646('0x28')](function(_0x325394){_0x2a55f4[_0x5646('0x44')]=_0x325394;return _0x2a55f4;})['then'](respondWithFilteredResult(_0x303f64,_0x399ede))['catch'](handleError(_0x303f64,null));};exports['show']=function(_0x3fc053,_0x3559f3){var _0x8f4c06={'raw':!![],'where':{'id':_0x3fc053[_0x5646('0x45')]['id']}},_0x31ae00={};_0x31ae00[_0x5646('0x33')]=_[_0x5646('0x35')](db['SalesforceField'][_0x5646('0x30')]);_0x31ae00[_0x5646('0x34')]=_[_0x5646('0x35')](_0x3fc053[_0x5646('0x34')]);_0x31ae00[_0x5646('0x36')]=_['intersection'](_0x31ae00['model'],_0x31ae00[_0x5646('0x34')]);_0x8f4c06['attributes']=_[_0x5646('0x38')](_0x31ae00[_0x5646('0x33')],qs['fields'](_0x3fc053[_0x5646('0x34')][_0x5646('0x39')]));_0x8f4c06['attributes']=_0x8f4c06[_0x5646('0x37')][_0x5646('0x3a')]?_0x8f4c06[_0x5646('0x37')]:_0x31ae00['model'];if(_0x3fc053[_0x5646('0x34')][_0x5646('0x46')]){_0x8f4c06['include']=[{'all':!![]}];}_0x8f4c06=_[_0x5646('0x41')]({},_0x8f4c06,_0x3fc053[_0x5646('0x43')]);return db['SalesforceField'][_0x5646('0x47')](_0x8f4c06)[_0x5646('0x28')](handleEntityNotFound(_0x3559f3,null))['then'](respondWithResult(_0x3559f3,null))[_0x5646('0x48')](handleError(_0x3559f3,null));};exports[_0x5646('0x49')]=function(_0x3d7852,_0x3e20aa){return db[_0x5646('0x2f')][_0x5646('0x49')](_0x3d7852[_0x5646('0x4a')],{})[_0x5646('0x28')](respondWithResult(_0x3e20aa,0xc9))['catch'](handleError(_0x3e20aa,null));};exports[_0x5646('0x27')]=function(_0x38967d,_0x131ae9){if(_0x38967d['body']['id']){delete _0x38967d['body']['id'];}return db[_0x5646('0x2f')][_0x5646('0x47')]({'where':{'id':_0x38967d['params']['id']}})['then'](handleEntityNotFound(_0x131ae9,null))[_0x5646('0x28')](saveUpdates(_0x38967d[_0x5646('0x4a')],null))[_0x5646('0x28')](respondWithResult(_0x131ae9,null))[_0x5646('0x48')](handleError(_0x131ae9,null));};exports['destroy']=function(_0x334bca,_0x269552){return db['SalesforceField']['find']({'where':{'id':_0x334bca[_0x5646('0x45')]['id']}})[_0x5646('0x28')](handleEntityNotFound(_0x269552,null))['then'](removeEntity(_0x269552,null))[_0x5646('0x48')](handleError(_0x269552,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 592b88f..5a239eb 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 _0xe844=['../../config/logger','api','moment','request-promise','rimraf','./intSalesforceField.attributes','define','int_salesforce_fields','salesforce_unique_index','lodash'];(function(_0x2b55f5,_0x4e9ac4){var _0x145169=function(_0x317d22){while(--_0x317d22){_0x2b55f5['push'](_0x2b55f5['shift']());}};_0x145169(++_0x4e9ac4);}(_0xe844,0x199));var _0x4e84=function(_0x11bfe2,_0x47149a){_0x11bfe2=_0x11bfe2-0x0;var _0x57c253=_0xe844[_0x11bfe2];return _0x57c253;};'use strict';var _=require(_0x4e84('0x0'));var util=require('util');var logger=require(_0x4e84('0x1'))(_0x4e84('0x2'));var moment=require(_0x4e84('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e84('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e84('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e84('0x6'));module['exports']=function(_0x52b38e,_0x231b78){return _0x52b38e[_0x4e84('0x7')]('SalesforceField',attributes,{'tableName':_0x4e84('0x8'),'paranoid':![],'indexes':[{'name':_0x4e84('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x985a=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x267614,_0x3546b9){var _0x3ad2f1=function(_0x291eac){while(--_0x291eac){_0x267614['push'](_0x267614['shift']());}};_0x3ad2f1(++_0x3546b9);}(_0x985a,0xc3));var _0xa985=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x985a[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xa985('0x0'));var util=require(_0xa985('0x1'));var logger=require(_0xa985('0x2'))(_0xa985('0x3'));var moment=require(_0xa985('0x4'));var BPromise=require(_0xa985('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa985('0x6'));var rimraf=require(_0xa985('0x7'));var config=require(_0xa985('0x8'));var attributes=require(_0xa985('0x9'));module[_0xa985('0xa')]=function(_0x117d4e,_0x54fc0f){return _0x117d4e[_0xa985('0xb')](_0xa985('0xc'),attributes,{'tableName':_0xa985('0xd'),'paranoid':![],'indexes':[{'name':_0xa985('0xe'),'fields':[_0xa985('0xf'),_0xa985('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 4ae0e1a..7b2ed9e 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 _0xf5c7=['info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','ioredis','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x401c88,_0x5c9ef9){var _0x3126a0=function(_0x56f75c){while(--_0x56f75c){_0x401c88['push'](_0x401c88['shift']());}};_0x3126a0(++_0x5c9ef9);}(_0xf5c7,0x15f));var _0x7f5c=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0xf5c7[_0x1c4409];return _0x356d8f;};'use strict';var _=require(_0x7f5c('0x0'));var util=require(_0x7f5c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f5c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7f5c('0x3'));var config=require(_0x7f5c('0x4'));var jayson=require(_0x7f5c('0x5'));var client=jayson['client'][_0x7f5c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x143f37,_0x25b4af,_0x333262){return new BPromise(function(_0x9b75c6,_0x5da62a){return client[_0x7f5c('0x7')](_0x143f37,_0x333262)[_0x7f5c('0x8')](function(_0x27e31b){logger[_0x7f5c('0x9')](_0x7f5c('0xa'),_0x25b4af,_0x7f5c('0xb'));logger['debug'](_0x7f5c('0xc'),_0x25b4af,_0x7f5c('0xb'),JSON[_0x7f5c('0xd')](_0x27e31b));if(_0x27e31b[_0x7f5c('0xe')]){if(_0x27e31b[_0x7f5c('0xe')][_0x7f5c('0xf')]===0x1f4){logger[_0x7f5c('0xe')](_0x7f5c('0xa'),_0x25b4af,_0x27e31b[_0x7f5c('0xe')][_0x7f5c('0x10')]);return _0x5da62a(_0x27e31b[_0x7f5c('0xe')][_0x7f5c('0x10')]);}logger[_0x7f5c('0xe')]('SalesforceField,\x20%s,\x20%s',_0x25b4af,_0x27e31b['error']['message']);return _0x9b75c6(_0x27e31b[_0x7f5c('0xe')][_0x7f5c('0x10')]);}else{logger['info'](_0x7f5c('0xa'),_0x25b4af,'request\x20sent');_0x9b75c6(_0x27e31b[_0x7f5c('0x11')][_0x7f5c('0x10')]);}})['catch'](function(_0x3cd84d){logger[_0x7f5c('0xe')](_0x7f5c('0xa'),_0x25b4af,_0x3cd84d);_0x5da62a(_0x3cd84d);});});} \ No newline at end of file +var _0xd2b6=['../../config/environment','jayson/promise','client','http','info','SalesforceField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xd2b6,0x72));var _0x6d2b=function(_0x58591c,_0x3dbb23){_0x58591c=_0x58591c-0x0;var _0x46585c=_0xd2b6[_0x58591c];return _0x46585c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x6d2b('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d2b('0x1'));var db=require(_0x6d2b('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d2b('0x3'))(_0x6d2b('0x4'));var config=require(_0x6d2b('0x5'));var jayson=require(_0x6d2b('0x6'));var client=jayson[_0x6d2b('0x7')][_0x6d2b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e9368,_0x3de29a,_0x2ea88d){return new BPromise(function(_0x44bb1f,_0x23c7c1){return client['request'](_0x2e9368,_0x2ea88d)['then'](function(_0x2c774c){logger[_0x6d2b('0x9')](_0x6d2b('0xa'),_0x3de29a,_0x6d2b('0xb'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x3de29a,_0x6d2b('0xb'),JSON[_0x6d2b('0xc')](_0x2c774c));if(_0x2c774c[_0x6d2b('0xd')]){if(_0x2c774c['error'][_0x6d2b('0xe')]===0x1f4){logger[_0x6d2b('0xd')](_0x6d2b('0xa'),_0x3de29a,_0x2c774c[_0x6d2b('0xd')][_0x6d2b('0xf')]);return _0x23c7c1(_0x2c774c[_0x6d2b('0xd')][_0x6d2b('0xf')]);}logger[_0x6d2b('0xd')](_0x6d2b('0xa'),_0x3de29a,_0x2c774c[_0x6d2b('0xd')][_0x6d2b('0xf')]);return _0x44bb1f(_0x2c774c[_0x6d2b('0xd')][_0x6d2b('0xf')]);}else{logger[_0x6d2b('0x9')](_0x6d2b('0xa'),_0x3de29a,'request\x20sent');_0x44bb1f(_0x2c774c['result'][_0x6d2b('0xf')]);}})[_0x6d2b('0x10')](function(_0x2221b1){logger['error'](_0x6d2b('0xa'),_0x3de29a,_0x2221b1);_0x23c7c1(_0x2221b1);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 95f6ae9..e1fc1f7 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 _0x2831=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','exports','multer','util','path'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x2831,0x189));var _0x1283=function(_0x2fecbc,_0x5e8b04){_0x2fecbc=_0x2fecbc-0x0;var _0x2bab10=_0x2831[_0x2fecbc];return _0x2bab10;};'use strict';var multer=require(_0x1283('0x0'));var util=require(_0x1283('0x1'));var path=require(_0x1283('0x2'));var timeout=require('connect-timeout');var express=require(_0x1283('0x3'));var router=express[_0x1283('0x4')]();var fs_extra=require(_0x1283('0x5'));var auth=require(_0x1283('0x6'));var interaction=require(_0x1283('0x7'));var config=require(_0x1283('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x1283('0x9')]('/',auth[_0x1283('0xa')](),controller[_0x1283('0xb')]);router[_0x1283('0x9')](_0x1283('0xc'),auth[_0x1283('0xa')](),controller[_0x1283('0xd')]);router[_0x1283('0x9')](_0x1283('0xe'),auth[_0x1283('0xa')](),controller[_0x1283('0xf')]);router['get'](_0x1283('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x1283('0x11')]('/',auth[_0x1283('0xa')](),controller[_0x1283('0x12')]);router['post'](_0x1283('0xe'),auth['isAuthenticated'](),controller[_0x1283('0x13')]);router[_0x1283('0x14')]('/:id',auth[_0x1283('0xa')](),controller['update']);router['delete'](_0x1283('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1283('0x15')]=router; \ No newline at end of file +var _0xe833=['./intServicenowAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1c3138,_0xeddefd){var _0x3fa2f9=function(_0x2b734a){while(--_0x2b734a){_0x1c3138['push'](_0x1c3138['shift']());}};_0x3fa2f9(++_0xeddefd);}(_0xe833,0x1c6));var _0x3e83=function(_0x5660d8,_0x114965){_0x5660d8=_0x5660d8-0x0;var _0x1f3342=_0xe833[_0x5660d8];return _0x1f3342;};'use strict';var multer=require(_0x3e83('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e83('0x1'));var express=require(_0x3e83('0x2'));var router=express['Router']();var fs_extra=require(_0x3e83('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3e83('0x4'));var config=require(_0x3e83('0x5'));var controller=require(_0x3e83('0x6'));router[_0x3e83('0x7')]('/',auth['isAuthenticated'](),controller[_0x3e83('0x8')]);router[_0x3e83('0x7')](_0x3e83('0x9'),auth[_0x3e83('0xa')](),controller['show']);router[_0x3e83('0x7')](_0x3e83('0xb'),auth[_0x3e83('0xa')](),controller[_0x3e83('0xc')]);router['get'](_0x3e83('0xd'),auth[_0x3e83('0xa')](),controller['getFields']);router[_0x3e83('0xe')]('/',auth[_0x3e83('0xa')](),controller[_0x3e83('0xf')]);router[_0x3e83('0xe')](_0x3e83('0xb'),auth[_0x3e83('0xa')](),controller[_0x3e83('0x10')]);router[_0x3e83('0x11')](_0x3e83('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3e83('0x12')](_0x3e83('0x9'),auth[_0x3e83('0xa')](),controller[_0x3e83('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 75a73be..cffae8c 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 _0x010a=['username','remoteUri','exports','STRING'];(function(_0x2ff1f6,_0x1bc588){var _0xbae96d=function(_0x505c67){while(--_0x505c67){_0x2ff1f6['push'](_0x2ff1f6['shift']());}};_0xbae96d(++_0x1bc588);}(_0x010a,0x17e));var _0xa010=function(_0x3ef7a3,_0x39dd6a){_0x3ef7a3=_0x3ef7a3-0x0;var _0x369b63=_0x010a[_0x3ef7a3];return _0x369b63;};'use strict';var Sequelize=require('sequelize');module[_0xa010('0x0')]={'name':{'type':Sequelize[_0xa010('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa010('0x1')],'unique':_0xa010('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa010('0x1')]},'remoteUri':{'type':Sequelize[_0xa010('0x1')],'unique':_0xa010('0x3')},'serverUrl':{'type':Sequelize[_0xa010('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x6d28=['remoteUri','sequelize','STRING'];(function(_0x53a8bf,_0x59b79f){var _0x1cee30=function(_0xbeb8e){while(--_0xbeb8e){_0x53a8bf['push'](_0x53a8bf['shift']());}};_0x1cee30(++_0x59b79f);}(_0x6d28,0x121));var _0x86d2=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x6d28[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0x86d2('0x0'));module['exports']={'name':{'type':Sequelize[_0x86d2('0x1')]},'description':{'type':Sequelize[_0x86d2('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x86d2('0x1')]},'email':{'type':Sequelize[_0x86d2('0x1')]},'remoteUri':{'type':Sequelize[_0x86d2('0x1')],'unique':_0x86d2('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 0b229c0..f368e46 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 _0xf079=['Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','close_code','notify','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','username','password','email','remoteUri','serverUrl','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','request-promise','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','ServicenowAccount','findAll','catch','show','keys','include','options','find','create','body','params','getConfigurations','findOne','filter','nolimit','Subjects','channel'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf079,0x120));var _0x9f07=function(_0x465f0b,_0x5cd467){_0x465f0b=_0x465f0b-0x0;var _0x1f4944=_0xf079[_0x465f0b];return _0x1f4944;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f07('0x0'));var zipdir=require(_0x9f07('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f07('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9f07('0x3'));var util=require('util');var path=require(_0x9f07('0x4'));var sox=require(_0x9f07('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f07('0x6'));var _=require(_0x9f07('0x7'));var squel=require(_0x9f07('0x8'));var crypto=require('crypto');var jsforce=require(_0x9f07('0x9'));var deskjs=require(_0x9f07('0xa'));var toCsv=require(_0x9f07('0xb'));var querystring=require(_0x9f07('0xc'));var Papa=require(_0x9f07('0xd'));var Redis=require(_0x9f07('0xe'));var authService=require(_0x9f07('0xf'));var qs=require(_0x9f07('0x10'));var as=require(_0x9f07('0x11'));var hardwareService=require(_0x9f07('0x12'));var logger=require('../../config/logger')(_0x9f07('0x13'));var utils=require(_0x9f07('0x14'));var config=require(_0x9f07('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f07('0x16'))['db'];var integrations=require(_0x9f07('0x17'));function respondWithStatusCode(_0x10eae4,_0x5a0499){_0x5a0499=_0x5a0499||0xcc;return function(_0x3386ea){if(_0x3386ea){return _0x10eae4['sendStatus'](_0x5a0499);}return _0x10eae4[_0x9f07('0x18')](_0x5a0499)[_0x9f07('0x19')]();};}function respondWithResult(_0x1234a9,_0x1416cb){_0x1416cb=_0x1416cb||0xc8;return function(_0x10b35b){if(_0x10b35b){return _0x1234a9[_0x9f07('0x18')](_0x1416cb)['json'](_0x10b35b);}};}function respondWithFilteredResult(_0x4d40a7,_0x20aae8){return function(_0x4d60ab){if(_0x4d60ab){var _0x4f6826=typeof _0x20aae8[_0x9f07('0x1a')]===_0x9f07('0x1b')&&typeof _0x20aae8[_0x9f07('0x1c')]===_0x9f07('0x1b');var _0x402cf0=_0x4d60ab[_0x9f07('0x1d')];var _0x210f45=_0x4f6826?0x0:_0x20aae8[_0x9f07('0x1a')];var _0x3b32fd=_0x4f6826?_0x4d60ab['count']:_0x20aae8[_0x9f07('0x1a')]+_0x20aae8[_0x9f07('0x1c')];var _0x26d26c;if(_0x3b32fd>=_0x402cf0){_0x3b32fd=_0x402cf0;_0x26d26c=0xc8;}else{_0x26d26c=0xce;}_0x4d40a7['status'](_0x26d26c);return _0x4d40a7[_0x9f07('0x1e')](_0x9f07('0x1f'),_0x210f45+'-'+_0x3b32fd+'/'+_0x402cf0)['json'](_0x4d60ab);}return null;};}function patchUpdates(_0x274ad5){return function(_0x4389ba){try{jsonpatch['apply'](_0x4389ba,_0x274ad5,!![]);}catch(_0x3064d3){return BPromise[_0x9f07('0x20')](_0x3064d3);}return _0x4389ba['save']();};}function saveUpdates(_0x8c728b,_0x2a3979){return function(_0x65035d){if(_0x65035d){return _0x65035d[_0x9f07('0x21')](_0x8c728b)[_0x9f07('0x22')](function(_0x12b9b3){return _0x12b9b3;});}return null;};}function removeEntity(_0x107347,_0x479445){return function(_0x1c7e1a){if(_0x1c7e1a){return _0x1c7e1a[_0x9f07('0x23')]()['then'](function(){_0x107347['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f9585,_0x14dc74){return function(_0x58967b){if(!_0x58967b){_0x2f9585[_0x9f07('0x24')](0x194);}return _0x58967b;};}function handleError(_0x50b561,_0x5ef17f){_0x5ef17f=_0x5ef17f||0x1f4;return function(_0x57a83d){logger[_0x9f07('0x25')](_0x57a83d[_0x9f07('0x26')]);if(_0x57a83d[_0x9f07('0x27')]){delete _0x57a83d[_0x9f07('0x27')];}_0x50b561['status'](_0x5ef17f)[_0x9f07('0x28')](_0x57a83d);};}exports[_0x9f07('0x29')]=function(_0x2be010,_0x5a4655){var _0x54807c={},_0x432e40={},_0x3ab825={'count':0x0,'rows':[]};var _0xad66cc=_[_0x9f07('0x2a')](db['ServicenowAccount'][_0x9f07('0x2b')],function(_0xd13fe5){return{'name':_0xd13fe5['fieldName'],'type':_0xd13fe5[_0x9f07('0x2c')][_0x9f07('0x2d')]};});_0x432e40['model']=_[_0x9f07('0x2a')](_0xad66cc,_0x9f07('0x27'));_0x432e40[_0x9f07('0x2e')]=_['keys'](_0x2be010[_0x9f07('0x2e')]);_0x432e40[_0x9f07('0x2f')]=_[_0x9f07('0x30')](_0x432e40[_0x9f07('0x31')],_0x432e40[_0x9f07('0x2e')]);_0x54807c[_0x9f07('0x32')]=_[_0x9f07('0x30')](_0x432e40[_0x9f07('0x31')],qs[_0x9f07('0x33')](_0x2be010[_0x9f07('0x2e')]['fields']));_0x54807c['attributes']=_0x54807c[_0x9f07('0x32')][_0x9f07('0x34')]?_0x54807c[_0x9f07('0x32')]:_0x432e40[_0x9f07('0x31')];if(!_0x2be010[_0x9f07('0x2e')][_0x9f07('0x35')]('nolimit')){_0x54807c[_0x9f07('0x1c')]=qs[_0x9f07('0x1c')](_0x2be010[_0x9f07('0x2e')][_0x9f07('0x1c')]);_0x54807c['offset']=qs['offset'](_0x2be010[_0x9f07('0x2e')][_0x9f07('0x1a')]);}_0x54807c[_0x9f07('0x36')]=qs[_0x9f07('0x37')](_0x2be010['query'][_0x9f07('0x37')]);_0x54807c[_0x9f07('0x38')]=qs[_0x9f07('0x2f')](_[_0x9f07('0x39')](_0x2be010[_0x9f07('0x2e')],_0x432e40[_0x9f07('0x2f')]),_0xad66cc);if(_0x2be010[_0x9f07('0x2e')]['filter']){_0x54807c[_0x9f07('0x38')]=_[_0x9f07('0x3a')](_0x54807c['where'],{'$or':_[_0x9f07('0x2a')](_0xad66cc,function(_0x25e614){if(_0x25e614['type']!==_0x9f07('0x3b')){var _0x5f00fd={};_0x5f00fd[_0x25e614[_0x9f07('0x27')]]={'$like':'%'+_0x2be010[_0x9f07('0x2e')]['filter']+'%'};return _0x5f00fd;}})});}_0x54807c=_[_0x9f07('0x3a')]({},_0x54807c,_0x2be010['options']);var _0x2ee95a={'where':_0x54807c[_0x9f07('0x38')]};return db['ServicenowAccount'][_0x9f07('0x1d')](_0x2ee95a)[_0x9f07('0x22')](function(_0x189b41){_0x3ab825[_0x9f07('0x1d')]=_0x189b41;if(_0x2be010[_0x9f07('0x2e')][_0x9f07('0x3c')]){_0x54807c['include']=[{'all':!![]}];}return db[_0x9f07('0x3d')][_0x9f07('0x3e')](_0x54807c);})[_0x9f07('0x22')](function(_0x5eed0b){_0x3ab825['rows']=_0x5eed0b;return _0x3ab825;})[_0x9f07('0x22')](respondWithFilteredResult(_0x5a4655,_0x54807c))[_0x9f07('0x3f')](handleError(_0x5a4655,null));};exports[_0x9f07('0x40')]=function(_0x1217ff,_0x43c2ff){var _0x37d6d6={'raw':![],'where':{'id':_0x1217ff['params']['id']}},_0x22d585={};_0x22d585['model']=_[_0x9f07('0x41')](db['ServicenowAccount'][_0x9f07('0x2b')]);_0x22d585[_0x9f07('0x2e')]=_[_0x9f07('0x41')](_0x1217ff[_0x9f07('0x2e')]);_0x22d585['filters']=_[_0x9f07('0x30')](_0x22d585['model'],_0x22d585['query']);_0x37d6d6[_0x9f07('0x32')]=_[_0x9f07('0x30')](_0x22d585['model'],qs['fields'](_0x1217ff[_0x9f07('0x2e')][_0x9f07('0x33')]));_0x37d6d6[_0x9f07('0x32')]=_0x37d6d6[_0x9f07('0x32')][_0x9f07('0x34')]?_0x37d6d6[_0x9f07('0x32')]:_0x22d585[_0x9f07('0x31')];if(_0x1217ff[_0x9f07('0x2e')]['includeAll']){_0x37d6d6[_0x9f07('0x42')]=[{'all':!![]}];}_0x37d6d6=_[_0x9f07('0x3a')]({},_0x37d6d6,_0x1217ff[_0x9f07('0x43')]);return db['ServicenowAccount'][_0x9f07('0x44')](_0x37d6d6)['then'](handleEntityNotFound(_0x43c2ff,null))[_0x9f07('0x22')](respondWithResult(_0x43c2ff,null))[_0x9f07('0x3f')](handleError(_0x43c2ff,null));};exports[_0x9f07('0x45')]=function(_0x12d533,_0x5031cf){return db[_0x9f07('0x3d')]['create'](_0x12d533[_0x9f07('0x46')],{})[_0x9f07('0x22')](respondWithResult(_0x5031cf,0xc9))[_0x9f07('0x3f')](handleError(_0x5031cf,null));};exports[_0x9f07('0x21')]=function(_0x33a7c2,_0x3c029d){if(_0x33a7c2[_0x9f07('0x46')]['id']){delete _0x33a7c2[_0x9f07('0x46')]['id'];}return db[_0x9f07('0x3d')]['find']({'where':{'id':_0x33a7c2['params']['id']}})[_0x9f07('0x22')](handleEntityNotFound(_0x3c029d,null))['then'](saveUpdates(_0x33a7c2['body'],null))[_0x9f07('0x22')](respondWithResult(_0x3c029d,null))[_0x9f07('0x3f')](handleError(_0x3c029d,null));};exports['destroy']=function(_0x2ffea0,_0x336273){return db[_0x9f07('0x3d')][_0x9f07('0x44')]({'where':{'id':_0x2ffea0[_0x9f07('0x47')]['id']}})[_0x9f07('0x22')](handleEntityNotFound(_0x336273,null))[_0x9f07('0x22')](removeEntity(_0x336273,null))[_0x9f07('0x3f')](handleError(_0x336273,null));};exports[_0x9f07('0x48')]=function(_0x29a72c,_0x3e8eb9,_0x1077db){var _0x559430={};var _0x255a3b={};var _0x4f0eb0;var _0x2d2e00;return db[_0x9f07('0x3d')][_0x9f07('0x49')]({'where':{'id':_0x29a72c[_0x9f07('0x47')]['id']}})[_0x9f07('0x22')](handleEntityNotFound(_0x3e8eb9,null))[_0x9f07('0x22')](function(_0x13cba1){if(_0x13cba1){_0x4f0eb0=_0x13cba1;_0x255a3b['model']=_[_0x9f07('0x41')](db['ServicenowConfiguration'][_0x9f07('0x2b')]);_0x255a3b[_0x9f07('0x2e')]=_['keys'](_0x29a72c[_0x9f07('0x2e')]);_0x255a3b[_0x9f07('0x2f')]=_['intersection'](_0x255a3b[_0x9f07('0x31')],_0x255a3b[_0x9f07('0x2e')]);_0x559430[_0x9f07('0x32')]=_[_0x9f07('0x30')](_0x255a3b[_0x9f07('0x31')],qs[_0x9f07('0x33')](_0x29a72c['query']['fields']));_0x559430[_0x9f07('0x32')]=_0x559430[_0x9f07('0x32')][_0x9f07('0x34')]?_0x559430[_0x9f07('0x32')]:_0x255a3b['model'];_0x559430[_0x9f07('0x36')]=qs[_0x9f07('0x37')](_0x29a72c[_0x9f07('0x2e')]['sort']);_0x559430[_0x9f07('0x38')]=qs[_0x9f07('0x2f')](_[_0x9f07('0x39')](_0x29a72c[_0x9f07('0x2e')],_0x255a3b['filters']));if(_0x29a72c[_0x9f07('0x2e')][_0x9f07('0x4a')]){_0x559430['where']=_[_0x9f07('0x3a')](_0x559430['where'],{'$or':_[_0x9f07('0x2a')](_0x559430[_0x9f07('0x32')],function(_0xfaf1c3){var _0x55fc79={};_0x55fc79[_0xfaf1c3]={'$like':'%'+_0x29a72c[_0x9f07('0x2e')][_0x9f07('0x4a')]+'%'};return _0x55fc79;})});}_0x559430=_[_0x9f07('0x3a')]({},_0x559430,_0x29a72c[_0x9f07('0x43')]);return _0x4f0eb0[_0x9f07('0x48')](_0x559430);}})[_0x9f07('0x22')](function(_0x4bcc77){if(_0x4bcc77){_0x2d2e00=_0x4bcc77['length'];if(!_0x29a72c['query'][_0x9f07('0x35')](_0x9f07('0x4b'))){_0x559430['limit']=qs[_0x9f07('0x1c')](_0x29a72c[_0x9f07('0x2e')][_0x9f07('0x1c')]);_0x559430[_0x9f07('0x1a')]=qs['offset'](_0x29a72c['query'][_0x9f07('0x1a')]);}return _0x4f0eb0[_0x9f07('0x48')](_0x559430);}})['then'](function(_0x5ee4cb){if(_0x5ee4cb){return _0x5ee4cb?{'count':_0x2d2e00,'rows':_0x5ee4cb}:null;}})[_0x9f07('0x22')](respondWithResult(_0x3e8eb9,null))['catch'](handleError(_0x3e8eb9,null));};exports['addConfiguration']=function(_0x907916,_0x2eb687,_0x11aa89){if(_0x907916[_0x9f07('0x46')]['id']){delete _0x907916[_0x9f07('0x46')]['id'];}return db['ServicenowAccount'][_0x9f07('0x49')]({'where':{'id':_0x907916[_0x9f07('0x47')]['id']}})[_0x9f07('0x22')](handleEntityNotFound(_0x2eb687,null))['then'](function(_0x185aa8){if(_0x185aa8){_0x907916[_0x9f07('0x46')]['AccountId']=_0x185aa8['id'];_0x907916[_0x9f07('0x46')][_0x9f07('0x4c')]=integrations['getSubjects'](_0x907916[_0x9f07('0x46')][_0x9f07('0x4d')],_0x907916['body'][_0x9f07('0x2c')]);_0x907916[_0x9f07('0x46')][_0x9f07('0x4e')]=integrations[_0x9f07('0x4f')](_0x907916['body'][_0x9f07('0x4d')],_0x907916[_0x9f07('0x46')][_0x9f07('0x2c')]);return db['ServicenowConfiguration']['create'](_0x907916[_0x9f07('0x46')],{'include':[{'model':db[_0x9f07('0x50')],'as':_0x9f07('0x4c')},{'model':db[_0x9f07('0x50')],'as':_0x9f07('0x4e')}]});}return null;})['then'](respondWithResult(_0x2eb687,null))[_0x9f07('0x3f')](handleError(_0x2eb687,null));};exports['getFields']=function(_0x374024,_0x56bf4f,_0x1cb3a3){var _0x548e94=[_0x9f07('0x51'),_0x9f07('0x52'),'knowledge','subcategory',_0x9f07('0x53'),_0x9f07('0x54'),'incident_state','severity',_0x9f07('0x55')];var _0x3dd968=[_0x9f07('0x56'),_0x9f07('0x51'),_0x9f07('0x57'),_0x9f07('0x58'),'upon_reject',_0x9f07('0x59'),_0x9f07('0x5a'),_0x9f07('0x52'),_0x9f07('0x5b'),_0x9f07('0x5c'),_0x9f07('0x5d'),'sys_updated_by','opened_by',_0x9f07('0x5e'),_0x9f07('0x5f'),_0x9f07('0x60'),_0x9f07('0x61'),_0x9f07('0x62'),_0x9f07('0x63'),_0x9f07('0x36'),_0x9f07('0x64'),_0x9f07('0x65'),_0x9f07('0x66'),'delivery_plan',_0x9f07('0x67'),_0x9f07('0x68'),'work_notes_list',_0x9f07('0x69'),_0x9f07('0x6a'),_0x9f07('0x6b'),_0x9f07('0x6c'),_0x9f07('0x6d'),_0x9f07('0x6e'),_0x9f07('0x6f'),'business_duration',_0x9f07('0x70'),'work_end',_0x9f07('0x71'),_0x9f07('0x72'),_0x9f07('0x73'),_0x9f07('0x74'),_0x9f07('0x75'),_0x9f07('0x76'),_0x9f07('0x77'),_0x9f07('0x53'),_0x9f07('0x78'),_0x9f07('0x79'),_0x9f07('0x7a'),'assignment_group',_0x9f07('0x7b'),_0x9f07('0x7c'),'description',_0x9f07('0x7d'),'notify',_0x9f07('0x7e'),_0x9f07('0x7f'),_0x9f07('0x80'),_0x9f07('0x81'),_0x9f07('0x82'),'sys_id',_0x9f07('0x83'),_0x9f07('0x84'),_0x9f07('0x85'),_0x9f07('0x86'),_0x9f07('0x87'),_0x9f07('0x88'),_0x9f07('0x89'),_0x9f07('0x8a'),_0x9f07('0x8b'),_0x9f07('0x8c'),_0x9f07('0x8d'),'sla_due',_0x9f07('0x8e'),_0x9f07('0x8f'),_0x9f07('0x90'),_0x9f07('0x91'),_0x9f07('0x92'),_0x9f07('0x93'),_0x9f07('0x94'),_0x9f07('0x95'),'correlation_id','location',_0x9f07('0x55')];var _0x2e1ba7='';var _0x26fad7='';var _0x2e3363=[];var _0x4315e1='';var _0x1bdbc3='';var _0x2321b8=[];var _0x4994ba='';var _0x451ad6='';var _0x265f74={};var _0xa2bb91='';return db['ServicenowAccount'][_0x9f07('0x49')]({'where':{'id':_0x374024[_0x9f07('0x47')]['id']},'attributes':['id',_0x9f07('0x96'),_0x9f07('0x97'),_0x9f07('0x98'),_0x9f07('0x99'),_0x9f07('0x9a')]})[_0x9f07('0x22')](handleEntityNotFound(_0x56bf4f,null))[_0x9f07('0x22')](function(_0x352810){if(_0x352810){_0xa2bb91=_0x352810[_0x9f07('0x99')];var _0x5cb442=_0xa2bb91['slice'](-0x1);if(_0x5cb442==='/'){_0xa2bb91=_0xa2bb91['substring'](0x0,_0xa2bb91[_0x9f07('0x9b')](_0x5cb442));}_0x451ad6=util[_0x9f07('0x9c')](_0x9f07('0x9d'),_0xa2bb91);_0x4994ba=util[_0x9f07('0x9c')]('%s/api/now/table/',_0xa2bb91);_0x265f74={'user':_0x352810[_0x9f07('0x96')],'pass':_0x352810[_0x9f07('0x97')]};var _0x274990={'method':_0x9f07('0x9e'),'uri':_0x451ad6+_0x9f07('0x9f'),'auth':_0x265f74,'json':!![]};return rp(_0x274990);}})['then'](function(_0x4379c5){if(_0x4379c5['result']['length']>0x0){_0x2e1ba7=_0x4379c5[_0x9f07('0xa0')];}console[_0x9f07('0xa1')](_0x9f07('0xa2'),_0x2e1ba7);_0x2321b8=[];_0x26fad7=Object[_0x9f07('0xa3')]([],_0x2e1ba7);_[_0x9f07('0xa4')](_0x26fad7,function(_0x2fc190){return!_0x548e94['includes'](_0x2fc190[_0x9f07('0x27')]);});_0x26fad7['forEach'](function(_0x12cbb3){var _0x3bca74=createFieldObject(_0x4994ba,_0x265f74,_0x12cbb3['internalType'],_0x12cbb3[_0x9f07('0x27')],_0x12cbb3[_0x9f07('0xa5')],![]);_0x2321b8[_0x9f07('0xa6')](_0x3bca74);});return Promise[_0x9f07('0xa7')](_0x2321b8);})['then'](function(_0x5ac849){_0x2e3363=_0x5ac849;_0x4315e1=Object[_0x9f07('0xa3')]([],_0x2e1ba7);console[_0x9f07('0xa1')](_0x9f07('0xa8'),_0x2e1ba7);_['remove'](_0x4315e1,function(_0x3bdac2){return _0x3dd968[_0x9f07('0xa9')](_0x3bdac2[_0x9f07('0x27')]);});console['log'](_0x9f07('0xaa'),_0x4315e1);_0x2321b8=[];_0x4315e1[_0x9f07('0xab')](function(_0x12058e){var _0x1b275e=createFieldObject(_0x4994ba,_0x265f74,_0x12058e[_0x9f07('0xac')],_0x12058e['name'],_0x12058e[_0x9f07('0xa5')],!![]);_0x2321b8[_0x9f07('0xa6')](_0x1b275e);});return Promise[_0x9f07('0xa7')](_0x2321b8);})['then'](function(_0x195b76){_0x1bdbc3=_0x195b76;var _0x37beaf=_0x2e3363[_0x9f07('0xad')](_0x1bdbc3);return{'count':_0x37beaf['length'],'rows':_0x37beaf};})[_0x9f07('0x22')](respondWithResult(_0x56bf4f,null))[_0x9f07('0x3f')](function(_0x1d515b){console['log'](_0x9f07('0xae')+_0x1d515b);var _0x4d6878=_0x374024[_0x9f07('0x2e')][_0x9f07('0xaf')]?0x1f4:_0x1d515b['statusCode']||0x1f4;logger[_0x9f07('0x25')](_0x1d515b[_0x9f07('0x26')]);delete _0x1d515b['name'];if(_0x4d6878===0x191){_0x4d6878=0x190;}_0x56bf4f[_0x9f07('0x18')](_0x4d6878)['send'](_0x374024[_0x9f07('0x2e')][_0x9f07('0xaf')]?{'message':_0x9f07('0xb0'),'statusCode':_0x1d515b[_0x9f07('0xb1')]}:_0x1d515b);});};function createFieldObject(_0x30949a,_0x589ab2,_0xa18445,_0x3789cf,_0xeb5869,_0x3e0894){return new Promise(function(_0x5775d2,_0x546a37){var _0x384ef4={'id':_0x3789cf,'name':_0xeb5869,'custom':_0x3e0894};if(_0xa18445===_0x9f07('0xb2')){_0x384ef4[_0x9f07('0x43')]=[{'name':'True','value':'true'},{'name':_0x9f07('0xb3'),'value':'false'}];_0x5775d2(_0x384ef4);}else{var _0x531a07={'method':_0x9f07('0x9e'),'uri':_0x30949a+_0x9f07('0xb4')+_0x3789cf,'auth':_0x589ab2,'json':!![]};return rp(_0x531a07)[_0x9f07('0x22')](function(_0x379b8f){var _0x20ea7d=[];if(_0x379b8f[_0x9f07('0xa0')][_0x9f07('0x34')]>0x0){_0x379b8f[_0x9f07('0xa0')][_0x9f07('0xab')](function(_0x1d182b){if(_0x1d182b[_0x9f07('0xb5')]==='false'){var _0x24818f={'name':_0x1d182b[_0x9f07('0xa5')],'value':_0x1d182b[_0x9f07('0xb6')]};_0x20ea7d[_0x9f07('0xa6')](_0x24818f);}});}_0x384ef4[_0x9f07('0x43')]=_0x20ea7d;if(_0x384ef4[_0x9f07('0x43')][_0x9f07('0x34')]>0x0){_0x5775d2(_0x384ef4);}else{if(_0x3e0894==![]){_0x5775d2();}else{_0x5775d2(_0x384ef4);}}});}});} \ No newline at end of file +var _0xe0a9=['find','getConfigurations','findOne','ServicenowConfiguration','pick','addConfiguration','Subjects','getSubjects','getDescriptions','channel','ServicenowField','Descriptions','made_sla','hold_reason','subcategory','close_code','notify','incident_state','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','knowledge','calendar_stc','delivery_plan','impact','active','business_service','sys_domain_path','rfc','time_worked','expected_start','business_duration','reopened_time','resolved_at','caller_id','approval_set','work_notes','delivery_task','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','urgency','company','reassignment_count','activity_due','assigned_to','severity','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','upon_approval','correlation_id','location','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','assign','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','include','findAll','rows','catch','params','includeAll','create','body'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe0a9,0x11d));var _0x9e0a=function(_0x4c5597,_0x3bfb10){_0x4c5597=_0x4c5597-0x0;var _0x1fa053=_0xe0a9[_0x4c5597];return _0x1fa053;};'use strict';var emlformat=require(_0x9e0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e0a('0x1'));var jsonpatch=require(_0x9e0a('0x2'));var rp=require(_0x9e0a('0x3'));var moment=require(_0x9e0a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9e0a('0x5'));var util=require(_0x9e0a('0x6'));var path=require(_0x9e0a('0x7'));var sox=require(_0x9e0a('0x8'));var csv=require(_0x9e0a('0x9'));var ejs=require(_0x9e0a('0xa'));var fs=require('fs');var fs_extra=require(_0x9e0a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e0a('0xc'));var toCsv=require(_0x9e0a('0x9'));var querystring=require(_0x9e0a('0xd'));var Papa=require(_0x9e0a('0xe'));var Redis=require(_0x9e0a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9e0a('0x10'));var hardwareService=require(_0x9e0a('0x11'));var logger=require(_0x9e0a('0x12'))(_0x9e0a('0x13'));var utils=require(_0x9e0a('0x14'));var config=require(_0x9e0a('0x15'));var licenseUtil=require(_0x9e0a('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9e0a('0x17'));function respondWithStatusCode(_0x53a14b,_0x3b924c){_0x3b924c=_0x3b924c||0xcc;return function(_0x329fdc){if(_0x329fdc){return _0x53a14b[_0x9e0a('0x18')](_0x3b924c);}return _0x53a14b[_0x9e0a('0x19')](_0x3b924c)['end']();};}function respondWithResult(_0x415f93,_0x4028d2){_0x4028d2=_0x4028d2||0xc8;return function(_0x360846){if(_0x360846){return _0x415f93[_0x9e0a('0x19')](_0x4028d2)['json'](_0x360846);}};}function respondWithFilteredResult(_0x59fef2,_0xb60217){return function(_0x22c4fc){if(_0x22c4fc){var _0x51b0d9=typeof _0xb60217['offset']==='undefined'&&typeof _0xb60217[_0x9e0a('0x1a')]===_0x9e0a('0x1b');var _0x22a241=_0x22c4fc[_0x9e0a('0x1c')];var _0x174593=_0x51b0d9?0x0:_0xb60217[_0x9e0a('0x1d')];var _0x3f2b97=_0x51b0d9?_0x22c4fc['count']:_0xb60217[_0x9e0a('0x1d')]+_0xb60217[_0x9e0a('0x1a')];var _0x580bed;if(_0x3f2b97>=_0x22a241){_0x3f2b97=_0x22a241;_0x580bed=0xc8;}else{_0x580bed=0xce;}_0x59fef2['status'](_0x580bed);return _0x59fef2[_0x9e0a('0x1e')](_0x9e0a('0x1f'),_0x174593+'-'+_0x3f2b97+'/'+_0x22a241)[_0x9e0a('0x20')](_0x22c4fc);}return null;};}function patchUpdates(_0xb3aac0){return function(_0x2917bb){try{jsonpatch[_0x9e0a('0x21')](_0x2917bb,_0xb3aac0,!![]);}catch(_0x345df2){return BPromise[_0x9e0a('0x22')](_0x345df2);}return _0x2917bb['save']();};}function saveUpdates(_0x2a452c,_0x1724c1){return function(_0x54a4e9){if(_0x54a4e9){return _0x54a4e9[_0x9e0a('0x23')](_0x2a452c)[_0x9e0a('0x24')](function(_0x88f7b4){return _0x88f7b4;});}return null;};}function removeEntity(_0xb8b008,_0x3c3cdc){return function(_0x4c2d23){if(_0x4c2d23){return _0x4c2d23[_0x9e0a('0x25')]()['then'](function(){_0xb8b008[_0x9e0a('0x19')](0xcc)[_0x9e0a('0x26')]();});}};}function handleEntityNotFound(_0x18789e,_0x5ac5a2){return function(_0x5e7403){if(!_0x5e7403){_0x18789e[_0x9e0a('0x18')](0x194);}return _0x5e7403;};}function handleError(_0x4e09bf,_0x59d27b){_0x59d27b=_0x59d27b||0x1f4;return function(_0x147035){logger[_0x9e0a('0x27')](_0x147035[_0x9e0a('0x28')]);if(_0x147035[_0x9e0a('0x29')]){delete _0x147035[_0x9e0a('0x29')];}_0x4e09bf[_0x9e0a('0x19')](_0x59d27b)[_0x9e0a('0x2a')](_0x147035);};}exports[_0x9e0a('0x2b')]=function(_0x160b97,_0x4f4e2d){var _0x1b8543={},_0x5d9dd7={},_0x1b5da0={'count':0x0,'rows':[]};var _0x4c649d=_[_0x9e0a('0x2c')](db[_0x9e0a('0x2d')][_0x9e0a('0x2e')],function(_0x328bf1){return{'name':_0x328bf1[_0x9e0a('0x2f')],'type':_0x328bf1['type']['key']};});_0x5d9dd7['model']=_[_0x9e0a('0x2c')](_0x4c649d,_0x9e0a('0x29'));_0x5d9dd7['query']=_[_0x9e0a('0x30')](_0x160b97['query']);_0x5d9dd7[_0x9e0a('0x31')]=_['intersection'](_0x5d9dd7[_0x9e0a('0x32')],_0x5d9dd7[_0x9e0a('0x33')]);_0x1b8543[_0x9e0a('0x34')]=_[_0x9e0a('0x35')](_0x5d9dd7['model'],qs['fields'](_0x160b97[_0x9e0a('0x33')][_0x9e0a('0x36')]));_0x1b8543[_0x9e0a('0x34')]=_0x1b8543['attributes'][_0x9e0a('0x37')]?_0x1b8543[_0x9e0a('0x34')]:_0x5d9dd7[_0x9e0a('0x32')];if(!_0x160b97['query'][_0x9e0a('0x38')](_0x9e0a('0x39'))){_0x1b8543['limit']=qs['limit'](_0x160b97[_0x9e0a('0x33')]['limit']);_0x1b8543['offset']=qs[_0x9e0a('0x1d')](_0x160b97[_0x9e0a('0x33')]['offset']);}_0x1b8543[_0x9e0a('0x3a')]=qs[_0x9e0a('0x3b')](_0x160b97[_0x9e0a('0x33')][_0x9e0a('0x3b')]);_0x1b8543[_0x9e0a('0x3c')]=qs['filters'](_['pick'](_0x160b97[_0x9e0a('0x33')],_0x5d9dd7[_0x9e0a('0x31')]),_0x4c649d);if(_0x160b97[_0x9e0a('0x33')][_0x9e0a('0x3d')]){_0x1b8543[_0x9e0a('0x3c')]=_['merge'](_0x1b8543[_0x9e0a('0x3c')],{'$or':_['map'](_0x4c649d,function(_0x5a1650){if(_0x5a1650[_0x9e0a('0x3e')]!=='VIRTUAL'){var _0x216fec={};_0x216fec[_0x5a1650[_0x9e0a('0x29')]]={'$like':'%'+_0x160b97[_0x9e0a('0x33')][_0x9e0a('0x3d')]+'%'};return _0x216fec;}})});}_0x1b8543=_[_0x9e0a('0x3f')]({},_0x1b8543,_0x160b97[_0x9e0a('0x40')]);var _0x5d5346={'where':_0x1b8543[_0x9e0a('0x3c')]};return db[_0x9e0a('0x2d')][_0x9e0a('0x1c')](_0x5d5346)[_0x9e0a('0x24')](function(_0x3109d5){_0x1b5da0[_0x9e0a('0x1c')]=_0x3109d5;if(_0x160b97[_0x9e0a('0x33')]['includeAll']){_0x1b8543[_0x9e0a('0x41')]=[{'all':!![]}];}return db[_0x9e0a('0x2d')][_0x9e0a('0x42')](_0x1b8543);})[_0x9e0a('0x24')](function(_0x431021){_0x1b5da0[_0x9e0a('0x43')]=_0x431021;return _0x1b5da0;})[_0x9e0a('0x24')](respondWithFilteredResult(_0x4f4e2d,_0x1b8543))[_0x9e0a('0x44')](handleError(_0x4f4e2d,null));};exports['show']=function(_0x3048a7,_0x40b196){var _0x44f21f={'raw':![],'where':{'id':_0x3048a7[_0x9e0a('0x45')]['id']}},_0x209025={};_0x209025[_0x9e0a('0x32')]=_['keys'](db[_0x9e0a('0x2d')][_0x9e0a('0x2e')]);_0x209025[_0x9e0a('0x33')]=_[_0x9e0a('0x30')](_0x3048a7[_0x9e0a('0x33')]);_0x209025[_0x9e0a('0x31')]=_[_0x9e0a('0x35')](_0x209025[_0x9e0a('0x32')],_0x209025[_0x9e0a('0x33')]);_0x44f21f[_0x9e0a('0x34')]=_[_0x9e0a('0x35')](_0x209025[_0x9e0a('0x32')],qs[_0x9e0a('0x36')](_0x3048a7[_0x9e0a('0x33')]['fields']));_0x44f21f[_0x9e0a('0x34')]=_0x44f21f[_0x9e0a('0x34')][_0x9e0a('0x37')]?_0x44f21f[_0x9e0a('0x34')]:_0x209025[_0x9e0a('0x32')];if(_0x3048a7[_0x9e0a('0x33')][_0x9e0a('0x46')]){_0x44f21f[_0x9e0a('0x41')]=[{'all':!![]}];}_0x44f21f=_[_0x9e0a('0x3f')]({},_0x44f21f,_0x3048a7[_0x9e0a('0x40')]);return db[_0x9e0a('0x2d')]['find'](_0x44f21f)[_0x9e0a('0x24')](handleEntityNotFound(_0x40b196,null))[_0x9e0a('0x24')](respondWithResult(_0x40b196,null))[_0x9e0a('0x44')](handleError(_0x40b196,null));};exports[_0x9e0a('0x47')]=function(_0x5c74e4,_0x3f0f5f){return db[_0x9e0a('0x2d')]['create'](_0x5c74e4['body'],{})[_0x9e0a('0x24')](respondWithResult(_0x3f0f5f,0xc9))['catch'](handleError(_0x3f0f5f,null));};exports[_0x9e0a('0x23')]=function(_0x4b8fb4,_0x34635d){if(_0x4b8fb4[_0x9e0a('0x48')]['id']){delete _0x4b8fb4[_0x9e0a('0x48')]['id'];}return db['ServicenowAccount'][_0x9e0a('0x49')]({'where':{'id':_0x4b8fb4[_0x9e0a('0x45')]['id']}})[_0x9e0a('0x24')](handleEntityNotFound(_0x34635d,null))['then'](saveUpdates(_0x4b8fb4[_0x9e0a('0x48')],null))[_0x9e0a('0x24')](respondWithResult(_0x34635d,null))[_0x9e0a('0x44')](handleError(_0x34635d,null));};exports[_0x9e0a('0x25')]=function(_0x4e8f68,_0x2ffe31){return db[_0x9e0a('0x2d')][_0x9e0a('0x49')]({'where':{'id':_0x4e8f68[_0x9e0a('0x45')]['id']}})[_0x9e0a('0x24')](handleEntityNotFound(_0x2ffe31,null))[_0x9e0a('0x24')](removeEntity(_0x2ffe31,null))['catch'](handleError(_0x2ffe31,null));};exports[_0x9e0a('0x4a')]=function(_0x4d837a,_0x341080,_0x5a5f96){var _0x21a7d2={};var _0x50c35b={};var _0x17b999;var _0x266f63;return db[_0x9e0a('0x2d')][_0x9e0a('0x4b')]({'where':{'id':_0x4d837a[_0x9e0a('0x45')]['id']}})['then'](handleEntityNotFound(_0x341080,null))['then'](function(_0x401284){if(_0x401284){_0x17b999=_0x401284;_0x50c35b['model']=_[_0x9e0a('0x30')](db[_0x9e0a('0x4c')][_0x9e0a('0x2e')]);_0x50c35b[_0x9e0a('0x33')]=_[_0x9e0a('0x30')](_0x4d837a['query']);_0x50c35b[_0x9e0a('0x31')]=_[_0x9e0a('0x35')](_0x50c35b[_0x9e0a('0x32')],_0x50c35b[_0x9e0a('0x33')]);_0x21a7d2[_0x9e0a('0x34')]=_[_0x9e0a('0x35')](_0x50c35b['model'],qs['fields'](_0x4d837a[_0x9e0a('0x33')]['fields']));_0x21a7d2[_0x9e0a('0x34')]=_0x21a7d2[_0x9e0a('0x34')][_0x9e0a('0x37')]?_0x21a7d2['attributes']:_0x50c35b[_0x9e0a('0x32')];_0x21a7d2[_0x9e0a('0x3a')]=qs['sort'](_0x4d837a['query']['sort']);_0x21a7d2[_0x9e0a('0x3c')]=qs[_0x9e0a('0x31')](_[_0x9e0a('0x4d')](_0x4d837a[_0x9e0a('0x33')],_0x50c35b[_0x9e0a('0x31')]));if(_0x4d837a[_0x9e0a('0x33')][_0x9e0a('0x3d')]){_0x21a7d2['where']=_[_0x9e0a('0x3f')](_0x21a7d2[_0x9e0a('0x3c')],{'$or':_['map'](_0x21a7d2[_0x9e0a('0x34')],function(_0x384212){var _0x42b423={};_0x42b423[_0x384212]={'$like':'%'+_0x4d837a[_0x9e0a('0x33')]['filter']+'%'};return _0x42b423;})});}_0x21a7d2=_[_0x9e0a('0x3f')]({},_0x21a7d2,_0x4d837a['options']);return _0x17b999['getConfigurations'](_0x21a7d2);}})[_0x9e0a('0x24')](function(_0x32c235){if(_0x32c235){_0x266f63=_0x32c235['length'];if(!_0x4d837a[_0x9e0a('0x33')][_0x9e0a('0x38')]('nolimit')){_0x21a7d2[_0x9e0a('0x1a')]=qs['limit'](_0x4d837a[_0x9e0a('0x33')][_0x9e0a('0x1a')]);_0x21a7d2['offset']=qs[_0x9e0a('0x1d')](_0x4d837a[_0x9e0a('0x33')]['offset']);}return _0x17b999[_0x9e0a('0x4a')](_0x21a7d2);}})['then'](function(_0x5452d4){if(_0x5452d4){return _0x5452d4?{'count':_0x266f63,'rows':_0x5452d4}:null;}})[_0x9e0a('0x24')](respondWithResult(_0x341080,null))[_0x9e0a('0x44')](handleError(_0x341080,null));};exports[_0x9e0a('0x4e')]=function(_0x59734d,_0x481bc1,_0x3e5457){if(_0x59734d[_0x9e0a('0x48')]['id']){delete _0x59734d['body']['id'];}return db['ServicenowAccount'][_0x9e0a('0x4b')]({'where':{'id':_0x59734d[_0x9e0a('0x45')]['id']}})[_0x9e0a('0x24')](handleEntityNotFound(_0x481bc1,null))[_0x9e0a('0x24')](function(_0x26122e){if(_0x26122e){_0x59734d[_0x9e0a('0x48')]['AccountId']=_0x26122e['id'];_0x59734d[_0x9e0a('0x48')][_0x9e0a('0x4f')]=integrations[_0x9e0a('0x50')](_0x59734d['body']['channel'],_0x59734d[_0x9e0a('0x48')]['type']);_0x59734d[_0x9e0a('0x48')]['Descriptions']=integrations[_0x9e0a('0x51')](_0x59734d['body'][_0x9e0a('0x52')],_0x59734d[_0x9e0a('0x48')][_0x9e0a('0x3e')]);return db['ServicenowConfiguration'][_0x9e0a('0x47')](_0x59734d[_0x9e0a('0x48')],{'include':[{'model':db[_0x9e0a('0x53')],'as':_0x9e0a('0x4f')},{'model':db[_0x9e0a('0x53')],'as':_0x9e0a('0x54')}]});}return null;})['then'](respondWithResult(_0x481bc1,null))[_0x9e0a('0x44')](handleError(_0x481bc1,null));};exports['getFields']=function(_0x1eae2b,_0x2f18e1,_0x7eb13b){var _0xc4c77e=[_0x9e0a('0x55'),_0x9e0a('0x56'),'knowledge',_0x9e0a('0x57'),_0x9e0a('0x58'),_0x9e0a('0x59'),_0x9e0a('0x5a'),'severity',_0x9e0a('0x5b')];var _0x8510af=[_0x9e0a('0x5c'),_0x9e0a('0x55'),_0x9e0a('0x5d'),'watch_list',_0x9e0a('0x5e'),_0x9e0a('0x5f'),_0x9e0a('0x60'),_0x9e0a('0x56'),_0x9e0a('0x61'),_0x9e0a('0x62'),_0x9e0a('0x63'),_0x9e0a('0x64'),_0x9e0a('0x65'),_0x9e0a('0x66'),'sys_created_on','sys_domain','state','sys_created_by',_0x9e0a('0x67'),_0x9e0a('0x3a'),_0x9e0a('0x68'),'closed_at','cmdb_ci',_0x9e0a('0x69'),_0x9e0a('0x6a'),_0x9e0a('0x6b'),'work_notes_list',_0x9e0a('0x6c'),'priority',_0x9e0a('0x6d'),_0x9e0a('0x6e'),_0x9e0a('0x6f'),_0x9e0a('0x70'),'opened_at',_0x9e0a('0x71'),'group_list','work_end',_0x9e0a('0x72'),_0x9e0a('0x73'),_0x9e0a('0x74'),_0x9e0a('0x75'),_0x9e0a('0x57'),_0x9e0a('0x76'),'short_description',_0x9e0a('0x58'),'correlation_display',_0x9e0a('0x77'),'work_start',_0x9e0a('0x78'),_0x9e0a('0x79'),'additional_assignee_list',_0x9e0a('0x7a'),_0x9e0a('0x7b'),_0x9e0a('0x59'),_0x9e0a('0x7c'),_0x9e0a('0x7d'),_0x9e0a('0x7e'),_0x9e0a('0x7f'),'parent_incident',_0x9e0a('0x80'),_0x9e0a('0x81'),'reopened_by',_0x9e0a('0x5a'),_0x9e0a('0x82'),'problem_id',_0x9e0a('0x83'),_0x9e0a('0x84'),_0x9e0a('0x85'),_0x9e0a('0x86'),_0x9e0a('0x87'),'comments',_0x9e0a('0x88'),_0x9e0a('0x89'),_0x9e0a('0x8a'),_0x9e0a('0x8b'),_0x9e0a('0x8c'),_0x9e0a('0x8d'),'sys_tags','escalation',_0x9e0a('0x8e'),_0x9e0a('0x8f'),_0x9e0a('0x90'),_0x9e0a('0x5b')];var _0x10b17e='';var _0x28f04c='';var _0x13ef46=[];var _0x43fca4='';var _0x3f3a31='';var _0x401a15=[];var _0xedefb0='';var _0x3557d9='';var _0xb6d58c={};var _0x3a3a95='';return db[_0x9e0a('0x2d')][_0x9e0a('0x4b')]({'where':{'id':_0x1eae2b[_0x9e0a('0x45')]['id']},'attributes':['id',_0x9e0a('0x91'),_0x9e0a('0x92'),'email',_0x9e0a('0x93'),'serverUrl']})[_0x9e0a('0x24')](handleEntityNotFound(_0x2f18e1,null))['then'](function(_0x56c4ad){if(_0x56c4ad){_0x3a3a95=_0x56c4ad[_0x9e0a('0x93')];var _0x3d32f1=_0x3a3a95[_0x9e0a('0x94')](-0x1);if(_0x3d32f1==='/'){_0x3a3a95=_0x3a3a95[_0x9e0a('0x95')](0x0,_0x3a3a95[_0x9e0a('0x96')](_0x3d32f1));}_0x3557d9=util[_0x9e0a('0x97')](_0x9e0a('0x98'),_0x3a3a95);_0xedefb0=util[_0x9e0a('0x97')]('%s/api/now/table/',_0x3a3a95);_0xb6d58c={'user':_0x56c4ad[_0x9e0a('0x91')],'pass':_0x56c4ad[_0x9e0a('0x92')]};var _0x27ef2e={'method':_0x9e0a('0x99'),'uri':_0x3557d9+_0x9e0a('0x9a'),'auth':_0xb6d58c,'json':!![]};return rp(_0x27ef2e);}})['then'](function(_0x496fac){if(_0x496fac['result'][_0x9e0a('0x37')]>0x0){_0x10b17e=_0x496fac[_0x9e0a('0x9b')];}console['log'](_0x9e0a('0x9c'),_0x10b17e);_0x401a15=[];_0x28f04c=Object['assign']([],_0x10b17e);_[_0x9e0a('0x9d')](_0x28f04c,function(_0x3db73c){return!_0xc4c77e[_0x9e0a('0x9e')](_0x3db73c[_0x9e0a('0x29')]);});_0x28f04c[_0x9e0a('0x9f')](function(_0x570d64){var _0x48cb37=createFieldObject(_0xedefb0,_0xb6d58c,_0x570d64[_0x9e0a('0xa0')],_0x570d64['name'],_0x570d64[_0x9e0a('0xa1')],![]);_0x401a15[_0x9e0a('0xa2')](_0x48cb37);});return Promise[_0x9e0a('0xa3')](_0x401a15);})['then'](function(_0x41e63f){_0x13ef46=_0x41e63f;_0x43fca4=Object[_0x9e0a('0xa4')]([],_0x10b17e);console['log']('TCL:\x20_object',_0x10b17e);_['remove'](_0x43fca4,function(_0x4921db){return _0x8510af['includes'](_0x4921db[_0x9e0a('0x29')]);});console[_0x9e0a('0xa5')](_0x9e0a('0xa6'),_0x43fca4);_0x401a15=[];_0x43fca4[_0x9e0a('0x9f')](function(_0x1e41c5){var _0x4dc5bb=createFieldObject(_0xedefb0,_0xb6d58c,_0x1e41c5[_0x9e0a('0xa0')],_0x1e41c5['name'],_0x1e41c5['label'],!![]);_0x401a15[_0x9e0a('0xa2')](_0x4dc5bb);});return Promise[_0x9e0a('0xa3')](_0x401a15);})[_0x9e0a('0x24')](function(_0x3aac1b){_0x3f3a31=_0x3aac1b;var _0x3ede5a=_0x13ef46[_0x9e0a('0xa7')](_0x3f3a31);return{'count':_0x3ede5a[_0x9e0a('0x37')],'rows':_0x3ede5a};})[_0x9e0a('0x24')](respondWithResult(_0x2f18e1,null))['catch'](function(_0x375b00){console['log'](_0x9e0a('0xa8')+_0x375b00);var _0x45e66a=_0x1eae2b['query']['test']?0x1f4:_0x375b00[_0x9e0a('0xa9')]||0x1f4;logger['error'](_0x375b00[_0x9e0a('0x28')]);delete _0x375b00['name'];if(_0x45e66a===0x191){_0x45e66a=0x190;}_0x2f18e1['status'](_0x45e66a)[_0x9e0a('0x2a')](_0x1eae2b[_0x9e0a('0x33')][_0x9e0a('0xaa')]?{'message':_0x9e0a('0xab'),'statusCode':_0x375b00[_0x9e0a('0xa9')]}:_0x375b00);});};function createFieldObject(_0xff3b32,_0x2b07a9,_0x4b7c1e,_0x62840d,_0xe15b2f,_0x5e9fd4){return new Promise(function(_0x13716e,_0x172368){var _0x5737d5={'id':_0x62840d,'name':_0xe15b2f,'custom':_0x5e9fd4};if(_0x4b7c1e===_0x9e0a('0xac')){_0x5737d5[_0x9e0a('0x40')]=[{'name':_0x9e0a('0xad'),'value':'true'},{'name':_0x9e0a('0xae'),'value':_0x9e0a('0xaf')}];_0x13716e(_0x5737d5);}else{var _0xd122f6={'method':_0x9e0a('0x99'),'uri':_0xff3b32+_0x9e0a('0xb0')+_0x62840d,'auth':_0x2b07a9,'json':!![]};return rp(_0xd122f6)['then'](function(_0x542df5){var _0x21ea04=[];if(_0x542df5[_0x9e0a('0x9b')][_0x9e0a('0x37')]>0x0){_0x542df5[_0x9e0a('0x9b')][_0x9e0a('0x9f')](function(_0x1481e3){if(_0x1481e3[_0x9e0a('0xb1')]===_0x9e0a('0xaf')){var _0x31d966={'name':_0x1481e3['label'],'value':_0x1481e3[_0x9e0a('0xb2')]};_0x21ea04[_0x9e0a('0xa2')](_0x31d966);}});}_0x5737d5[_0x9e0a('0x40')]=_0x21ea04;if(_0x5737d5[_0x9e0a('0x40')][_0x9e0a('0x37')]>0x0){_0x13716e(_0x5737d5);}else{if(_0x5e9fd4==![]){_0x13716e();}else{_0x13716e(_0x5737d5);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index b577ddf..1df5f0b 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 _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x4d89d7,_0x56a2e0){var _0x51b321=function(_0x224582){while(--_0x224582){_0x4d89d7['push'](_0x4d89d7['shift']());}};_0x51b321(++_0x56a2e0);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2173b8,_0x612cbb){_0x2173b8=_0x2173b8-0x0;var _0x14f729=_0xdbf5[_0x2173b8];return _0x14f729;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));var integrations=require(_0x5dbf('0x8'));module[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return _0x3f8222[_0x5dbf('0xa')](_0x5dbf('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x5496,0x175));var _0x6549=function(_0xfa92ef,_0x1b3bf9){_0xfa92ef=_0xfa92ef-0x0;var _0x20d776=_0x5496[_0xfa92ef];return _0x20d776;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('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 fe63bcc..28a048e 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 _0xf1df=['model','attributes','map','stringify','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowAccount,\x20%s,\x20%s','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','limit','include'];(function(_0x2f52d0,_0x407519){var _0x305b10=function(_0x396273){while(--_0x396273){_0x2f52d0['push'](_0x2f52d0['shift']());}};_0x305b10(++_0x407519);}(_0xf1df,0x165));var _0xff1d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf1df[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xff1d('0x0'));var util=require(_0xff1d('0x1'));var moment=require(_0xff1d('0x2'));var BPromise=require(_0xff1d('0x3'));var rs=require(_0xff1d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xff1d('0x6'))(_0xff1d('0x7'));var config=require(_0xff1d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xff1d('0x9')][_0xff1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20f4bf,_0x4ccbdb,_0x3e0230){return new BPromise(function(_0x4c15a1,_0x3a1cb5){return client['request'](_0x20f4bf,_0x3e0230)[_0xff1d('0xb')](function(_0x478843){logger[_0xff1d('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x4ccbdb,_0xff1d('0xd'));logger[_0xff1d('0xe')](_0xff1d('0xf'),_0x4ccbdb,_0xff1d('0xd'),JSON['stringify'](_0x478843));if(_0x478843[_0xff1d('0x10')]){if(_0x478843['error'][_0xff1d('0x11')]===0x1f4){logger[_0xff1d('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x4ccbdb,_0x478843['error'][_0xff1d('0x12')]);return _0x3a1cb5(_0x478843[_0xff1d('0x10')][_0xff1d('0x12')]);}logger['error'](_0xff1d('0x13'),_0x4ccbdb,_0x478843[_0xff1d('0x10')]['message']);return _0x4c15a1(_0x478843[_0xff1d('0x10')][_0xff1d('0x12')]);}else{logger[_0xff1d('0xc')](_0xff1d('0x13'),_0x4ccbdb,_0xff1d('0xd'));_0x4c15a1(_0x478843['result'][_0xff1d('0x12')]);}})[_0xff1d('0x14')](function(_0x205e18){logger[_0xff1d('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x4ccbdb,_0x205e18);_0x3a1cb5(_0x205e18);});});}exports[_0xff1d('0x15')]=function(_0x27dcd8){var _0x30e578=this;return new Promise(function(_0xb98f81,_0x3a3256){return db[_0xff1d('0x16')][_0xff1d('0x17')]({'raw':_0x27dcd8[_0xff1d('0x18')]?_0x27dcd8[_0xff1d('0x18')][_0xff1d('0x19')]===undefined?!![]:![]:!![],'where':_0x27dcd8[_0xff1d('0x18')]?_0x27dcd8[_0xff1d('0x18')]['where']||null:null,'attributes':_0x27dcd8[_0xff1d('0x18')]?_0x27dcd8[_0xff1d('0x18')]['attributes']||null:null,'limit':_0x27dcd8['options']?_0x27dcd8[_0xff1d('0x18')][_0xff1d('0x1a')]||null:null,'include':_0x27dcd8['options']?_0x27dcd8[_0xff1d('0x18')][_0xff1d('0x1b')]?_['map'](_0x27dcd8[_0xff1d('0x18')][_0xff1d('0x1b')],function(_0x3c0be1){return{'model':db[_0x3c0be1[_0xff1d('0x1c')]],'as':_0x3c0be1['as'],'attributes':_0x3c0be1[_0xff1d('0x1d')],'include':_0x3c0be1[_0xff1d('0x1b')]?_[_0xff1d('0x1e')](_0x3c0be1[_0xff1d('0x1b')],function(_0x1c8e1b){return{'model':db[_0x1c8e1b['model']],'as':_0x1c8e1b['as'],'attributes':_0x1c8e1b[_0xff1d('0x1d')],'include':_0x1c8e1b[_0xff1d('0x1b')]?_[_0xff1d('0x1e')](_0x1c8e1b[_0xff1d('0x1b')],function(_0x63e302){return{'model':db[_0x63e302[_0xff1d('0x1c')]],'as':_0x63e302['as'],'attributes':_0x63e302[_0xff1d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xff1d('0xb')](function(_0xe297b8){logger[_0xff1d('0xc')](_0xff1d('0x15'),_0x27dcd8);logger[_0xff1d('0xe')](_0xff1d('0x15'),_0x27dcd8,JSON[_0xff1d('0x1f')](_0xe297b8));_0xb98f81(_0xe297b8);})[_0xff1d('0x14')](function(_0x209955){logger[_0xff1d('0x10')]('GetServicenowAccount',_0x209955[_0xff1d('0x12')],_0x27dcd8);_0x3a3256(_0x30e578[_0xff1d('0x10')](0x1f4,_0x209955[_0xff1d('0x12')]));});});};exports[_0xff1d('0x20')]=function(_0x2524dc){var _0x3a980b=this;return new Promise(function(_0x1b66af,_0x5ab79a){return db[_0xff1d('0x16')][_0xff1d('0x21')]({'raw':_0x2524dc['options']?_0x2524dc[_0xff1d('0x18')][_0xff1d('0x19')]===undefined?!![]:![]:!![],'where':_0x2524dc['options']?_0x2524dc[_0xff1d('0x18')][_0xff1d('0x22')]||null:null,'attributes':_0x2524dc[_0xff1d('0x18')]?_0x2524dc[_0xff1d('0x18')][_0xff1d('0x1d')]||null:null,'include':_0x2524dc[_0xff1d('0x18')]?_0x2524dc[_0xff1d('0x18')][_0xff1d('0x1b')]?_['map'](_0x2524dc[_0xff1d('0x18')][_0xff1d('0x1b')],function(_0x3808c3){return{'model':db[_0x3808c3[_0xff1d('0x1c')]],'as':_0x3808c3['as'],'attributes':_0x3808c3[_0xff1d('0x1d')],'include':_0x3808c3[_0xff1d('0x1b')]?_[_0xff1d('0x1e')](_0x3808c3[_0xff1d('0x1b')],function(_0x1d593a){return{'model':db[_0x1d593a[_0xff1d('0x1c')]],'as':_0x1d593a['as'],'attributes':_0x1d593a[_0xff1d('0x1d')],'include':_0x1d593a[_0xff1d('0x1b')]?_[_0xff1d('0x1e')](_0x1d593a[_0xff1d('0x1b')],function(_0xf953dd){return{'model':db[_0xf953dd[_0xff1d('0x1c')]],'as':_0xf953dd['as'],'attributes':_0xf953dd['attributes']};}):[]};}):[]};}):[]:[]})[_0xff1d('0xb')](function(_0x260abe){logger['info'](_0xff1d('0x20'),_0x2524dc);logger[_0xff1d('0xe')](_0xff1d('0x20'),_0x2524dc,JSON[_0xff1d('0x1f')](_0x260abe));_0x1b66af(_0x260abe);})[_0xff1d('0x14')](function(_0x2a72a7){logger[_0xff1d('0x10')](_0xff1d('0x20'),_0x2a72a7[_0xff1d('0x12')],_0x2524dc);_0x5ab79a(_0x3a980b[_0xff1d('0x10')](0x1f4,_0x2a72a7[_0xff1d('0x12')]));});});}; \ No newline at end of file +var _0xd17f=['info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','limit','include','map','model','attributes','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0xd17f,0x1f2));var _0xfd17=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd17f[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xfd17('0x0'));var util=require(_0xfd17('0x1'));var moment=require(_0xfd17('0x2'));var BPromise=require(_0xfd17('0x3'));var rs=require(_0xfd17('0x4'));var fs=require('fs');var Redis=require(_0xfd17('0x5'));var db=require(_0xfd17('0x6'))['db'];var utils=require(_0xfd17('0x7'));var logger=require(_0xfd17('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd17('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29f250,_0x5688f8,_0x2ba4e6){return new BPromise(function(_0x240857,_0x22b0d7){return client[_0xfd17('0xa')](_0x29f250,_0x2ba4e6)[_0xfd17('0xb')](function(_0x28c1a3){logger[_0xfd17('0xc')](_0xfd17('0xd'),_0x5688f8,_0xfd17('0xe'));logger[_0xfd17('0xf')](_0xfd17('0x10'),_0x5688f8,'request\x20sent',JSON[_0xfd17('0x11')](_0x28c1a3));if(_0x28c1a3['error']){if(_0x28c1a3[_0xfd17('0x12')]['code']===0x1f4){logger[_0xfd17('0x12')](_0xfd17('0xd'),_0x5688f8,_0x28c1a3[_0xfd17('0x12')]['message']);return _0x22b0d7(_0x28c1a3[_0xfd17('0x12')]['message']);}logger[_0xfd17('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5688f8,_0x28c1a3['error'][_0xfd17('0x13')]);return _0x240857(_0x28c1a3['error'][_0xfd17('0x13')]);}else{logger[_0xfd17('0xc')](_0xfd17('0xd'),_0x5688f8,_0xfd17('0xe'));_0x240857(_0x28c1a3[_0xfd17('0x14')][_0xfd17('0x13')]);}})[_0xfd17('0x15')](function(_0x4fa109){logger[_0xfd17('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5688f8,_0x4fa109);_0x22b0d7(_0x4fa109);});});}exports[_0xfd17('0x16')]=function(_0x171d3){var _0x1a3b95=this;return new Promise(function(_0x5e9198,_0x4b2d6e){return db[_0xfd17('0x17')]['findAll']({'raw':_0x171d3[_0xfd17('0x18')]?_0x171d3[_0xfd17('0x18')][_0xfd17('0x19')]===undefined?!![]:![]:!![],'where':_0x171d3[_0xfd17('0x18')]?_0x171d3[_0xfd17('0x18')]['where']||null:null,'attributes':_0x171d3['options']?_0x171d3['options']['attributes']||null:null,'limit':_0x171d3[_0xfd17('0x18')]?_0x171d3[_0xfd17('0x18')][_0xfd17('0x1a')]||null:null,'include':_0x171d3[_0xfd17('0x18')]?_0x171d3[_0xfd17('0x18')][_0xfd17('0x1b')]?_[_0xfd17('0x1c')](_0x171d3[_0xfd17('0x18')][_0xfd17('0x1b')],function(_0x2d17f0){return{'model':db[_0x2d17f0[_0xfd17('0x1d')]],'as':_0x2d17f0['as'],'attributes':_0x2d17f0[_0xfd17('0x1e')],'include':_0x2d17f0['include']?_[_0xfd17('0x1c')](_0x2d17f0[_0xfd17('0x1b')],function(_0x32bc22){return{'model':db[_0x32bc22[_0xfd17('0x1d')]],'as':_0x32bc22['as'],'attributes':_0x32bc22[_0xfd17('0x1e')],'include':_0x32bc22[_0xfd17('0x1b')]?_[_0xfd17('0x1c')](_0x32bc22[_0xfd17('0x1b')],function(_0x3b9483){return{'model':db[_0x3b9483[_0xfd17('0x1d')]],'as':_0x3b9483['as'],'attributes':_0x3b9483['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd17('0xb')](function(_0x1a8f73){logger[_0xfd17('0xc')](_0xfd17('0x16'),_0x171d3);logger[_0xfd17('0xf')](_0xfd17('0x16'),_0x171d3,JSON['stringify'](_0x1a8f73));_0x5e9198(_0x1a8f73);})['catch'](function(_0x36537b){logger[_0xfd17('0x12')]('GetServicenowAccount',_0x36537b[_0xfd17('0x13')],_0x171d3);_0x4b2d6e(_0x1a3b95['error'](0x1f4,_0x36537b['message']));});});};exports[_0xfd17('0x1f')]=function(_0x27824e){var _0x7524fd=this;return new Promise(function(_0xb31dfb,_0x3f24f1){return db[_0xfd17('0x17')][_0xfd17('0x20')]({'raw':_0x27824e[_0xfd17('0x18')]?_0x27824e[_0xfd17('0x18')][_0xfd17('0x19')]===undefined?!![]:![]:!![],'where':_0x27824e[_0xfd17('0x18')]?_0x27824e['options'][_0xfd17('0x21')]||null:null,'attributes':_0x27824e[_0xfd17('0x18')]?_0x27824e[_0xfd17('0x18')][_0xfd17('0x1e')]||null:null,'include':_0x27824e[_0xfd17('0x18')]?_0x27824e[_0xfd17('0x18')][_0xfd17('0x1b')]?_['map'](_0x27824e[_0xfd17('0x18')][_0xfd17('0x1b')],function(_0x5952ae){return{'model':db[_0x5952ae[_0xfd17('0x1d')]],'as':_0x5952ae['as'],'attributes':_0x5952ae[_0xfd17('0x1e')],'include':_0x5952ae[_0xfd17('0x1b')]?_[_0xfd17('0x1c')](_0x5952ae['include'],function(_0x120d28){return{'model':db[_0x120d28[_0xfd17('0x1d')]],'as':_0x120d28['as'],'attributes':_0x120d28['attributes'],'include':_0x120d28[_0xfd17('0x1b')]?_[_0xfd17('0x1c')](_0x120d28[_0xfd17('0x1b')],function(_0x407a78){return{'model':db[_0x407a78[_0xfd17('0x1d')]],'as':_0x407a78['as'],'attributes':_0x407a78[_0xfd17('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfd17('0xb')](function(_0x505cdd){logger['info'](_0xfd17('0x1f'),_0x27824e);logger[_0xfd17('0xf')](_0xfd17('0x1f'),_0x27824e,JSON[_0xfd17('0x11')](_0x505cdd));_0xb31dfb(_0x505cdd);})[_0xfd17('0x15')](function(_0x530d9a){logger[_0xfd17('0x12')](_0xfd17('0x1f'),_0x530d9a[_0xfd17('0x13')],_0x27824e);_0x3f24f1(_0x7524fd['error'](0x1f4,_0x530d9a[_0xfd17('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 13fc62c..9d4d2ea 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 _0xec30=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xec30,0x70));var _0x0ec3=function(_0x16b55f,_0x301c6c){_0x16b55f=_0x16b55f-0x0;var _0x391c2f=_0xec30[_0x16b55f];return _0x391c2f;};'use strict';var multer=require(_0x0ec3('0x0'));var util=require(_0x0ec3('0x1'));var path=require(_0x0ec3('0x2'));var timeout=require(_0x0ec3('0x3'));var express=require(_0x0ec3('0x4'));var router=express[_0x0ec3('0x5')]();var fs_extra=require(_0x0ec3('0x6'));var auth=require(_0x0ec3('0x7'));var interaction=require(_0x0ec3('0x8'));var config=require('../../config/environment');var controller=require(_0x0ec3('0x9'));router[_0x0ec3('0xa')]('/',auth[_0x0ec3('0xb')](),controller[_0x0ec3('0xc')]);router[_0x0ec3('0xa')](_0x0ec3('0xd'),auth[_0x0ec3('0xb')](),controller[_0x0ec3('0xe')]);router[_0x0ec3('0xa')](_0x0ec3('0xf'),auth['isAuthenticated'](),controller[_0x0ec3('0x10')]);router['get'](_0x0ec3('0x11'),auth[_0x0ec3('0xb')](),controller[_0x0ec3('0x12')]);router[_0x0ec3('0xa')]('/:id/descriptions',auth[_0x0ec3('0xb')](),controller[_0x0ec3('0x13')]);router[_0x0ec3('0x14')]('/',auth[_0x0ec3('0xb')](),controller[_0x0ec3('0x15')]);router[_0x0ec3('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0ec3('0x17')]);router[_0x0ec3('0x18')](_0x0ec3('0xd'),auth[_0x0ec3('0xb')](),controller[_0x0ec3('0x19')]);module[_0x0ec3('0x1a')]=router; \ No newline at end of file +var _0xe555=['/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','delete','destroy','exports','multer','path','connect-timeout','Router','../../config/environment','./intServicenowConfiguration.controller','get','index'];(function(_0x53998a,_0x169537){var _0x329629=function(_0x1091fd){while(--_0x1091fd){_0x53998a['push'](_0x53998a['shift']());}};_0x329629(++_0x169537);}(_0xe555,0x98));var _0x5e55=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0xe555[_0x134827];return _0x366671;};'use strict';var multer=require(_0x5e55('0x0'));var util=require('util');var path=require(_0x5e55('0x1'));var timeout=require(_0x5e55('0x2'));var express=require('express');var router=express[_0x5e55('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5e55('0x4'));var controller=require(_0x5e55('0x5'));router[_0x5e55('0x6')]('/',auth['isAuthenticated'](),controller[_0x5e55('0x7')]);router[_0x5e55('0x6')](_0x5e55('0x8'),auth[_0x5e55('0x9')](),controller[_0x5e55('0xa')]);router[_0x5e55('0x6')](_0x5e55('0xb'),auth[_0x5e55('0x9')](),controller[_0x5e55('0xc')]);router['get'](_0x5e55('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x5e55('0xe'),auth[_0x5e55('0x9')](),controller[_0x5e55('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5e55('0x10')](_0x5e55('0x8'),auth[_0x5e55('0x9')](),controller['update']);router[_0x5e55('0x11')](_0x5e55('0x8'),auth[_0x5e55('0x9')](),controller[_0x5e55('0x12')]);module[_0x5e55('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index e582ea0..e2b92dc 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 _0x6597=['exports','STRING','sequelize'];(function(_0x14561d,_0x3f2ccd){var _0x57347d=function(_0x4273c1){while(--_0x4273c1){_0x14561d['push'](_0x14561d['shift']());}};_0x57347d(++_0x3f2ccd);}(_0x6597,0x116));var _0x7659=function(_0x11b17e,_0x12a7b2){_0x11b17e=_0x11b17e-0x0;var _0x135300=_0x6597[_0x11b17e];return _0x135300;};'use strict';var Sequelize=require(_0x7659('0x0'));module[_0x7659('0x1')]={'name':{'type':Sequelize[_0x7659('0x2')]},'description':{'type':Sequelize[_0x7659('0x2')]}}; \ No newline at end of file +var _0x3b45=['STRING','sequelize'];(function(_0x3a6eba,_0x7db8ac){var _0x531c0a=function(_0x349132){while(--_0x349132){_0x3a6eba['push'](_0x3a6eba['shift']());}};_0x531c0a(++_0x7db8ac);}(_0x3b45,0xcd));var _0x53b4=function(_0x364096,_0x1d08c6){_0x364096=_0x364096-0x0;var _0x34fc2e=_0x3b45[_0x364096];return _0x34fc2e;};'use strict';var Sequelize=require(_0x53b4('0x0'));module['exports']={'name':{'type':Sequelize[_0x53b4('0x1')]},'description':{'type':Sequelize[_0x53b4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 039a3f2..fbc4b35 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 _0xa6db=['lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create','body','params','getFields','ServicenowField','findOne','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6db,0x135));var _0xba6d=function(_0x241d9b,_0x45d294){_0x241d9b=_0x241d9b-0x0;var _0x4e5a52=_0xa6db[_0x241d9b];return _0x4e5a52;};'use strict';var emlformat=require(_0xba6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba6d('0x1'));var jsonpatch=require(_0xba6d('0x2'));var rp=require(_0xba6d('0x3'));var moment=require('moment');var BPromise=require(_0xba6d('0x4'));var Mustache=require(_0xba6d('0x5'));var util=require(_0xba6d('0x6'));var path=require(_0xba6d('0x7'));var sox=require(_0xba6d('0x8'));var csv=require('to-csv');var ejs=require(_0xba6d('0x9'));var fs=require('fs');var fs_extra=require(_0xba6d('0xa'));var _=require(_0xba6d('0xb'));var squel=require(_0xba6d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba6d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba6d('0xe'));var Redis=require(_0xba6d('0xf'));var authService=require(_0xba6d('0x10'));var qs=require(_0xba6d('0x11'));var as=require(_0xba6d('0x12'));var hardwareService=require(_0xba6d('0x13'));var logger=require(_0xba6d('0x14'))(_0xba6d('0x15'));var utils=require(_0xba6d('0x16'));var config=require(_0xba6d('0x17'));var licenseUtil=require(_0xba6d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c63cf,_0x5ca7a4){_0x5ca7a4=_0x5ca7a4||0xcc;return function(_0x8cd5cd){if(_0x8cd5cd){return _0x1c63cf['sendStatus'](_0x5ca7a4);}return _0x1c63cf[_0xba6d('0x19')](_0x5ca7a4)[_0xba6d('0x1a')]();};}function respondWithResult(_0x19e53d,_0x433ff0){_0x433ff0=_0x433ff0||0xc8;return function(_0x16f025){if(_0x16f025){return _0x19e53d[_0xba6d('0x19')](_0x433ff0)[_0xba6d('0x1b')](_0x16f025);}};}function respondWithFilteredResult(_0x205cda,_0x2b55d8){return function(_0x20a1aa){if(_0x20a1aa){var _0x22c76d=typeof _0x2b55d8['offset']===_0xba6d('0x1c')&&typeof _0x2b55d8[_0xba6d('0x1d')]==='undefined';var _0x218293=_0x20a1aa['count'];var _0x54df56=_0x22c76d?0x0:_0x2b55d8['offset'];var _0x4824ba=_0x22c76d?_0x20a1aa[_0xba6d('0x1e')]:_0x2b55d8['offset']+_0x2b55d8[_0xba6d('0x1d')];var _0x3d65b4;if(_0x4824ba>=_0x218293){_0x4824ba=_0x218293;_0x3d65b4=0xc8;}else{_0x3d65b4=0xce;}_0x205cda[_0xba6d('0x19')](_0x3d65b4);return _0x205cda[_0xba6d('0x1f')](_0xba6d('0x20'),_0x54df56+'-'+_0x4824ba+'/'+_0x218293)[_0xba6d('0x1b')](_0x20a1aa);}return null;};}function patchUpdates(_0xe6b1e1){return function(_0xc90f30){try{jsonpatch[_0xba6d('0x21')](_0xc90f30,_0xe6b1e1,!![]);}catch(_0x430c34){return BPromise[_0xba6d('0x22')](_0x430c34);}return _0xc90f30['save']();};}function saveUpdates(_0x41482a,_0x5815f3){return function(_0x23ce58){if(_0x23ce58){return _0x23ce58[_0xba6d('0x23')](_0x41482a)[_0xba6d('0x24')](function(_0x54a757){return _0x54a757;});}return null;};}function removeEntity(_0x22c893,_0x47ca96){return function(_0x17d569){if(_0x17d569){return _0x17d569['destroy']()[_0xba6d('0x24')](function(){_0x22c893[_0xba6d('0x19')](0xcc)[_0xba6d('0x1a')]();});}};}function handleEntityNotFound(_0x468361,_0x5906ac){return function(_0x4c453a){if(!_0x4c453a){_0x468361['sendStatus'](0x194);}return _0x4c453a;};}function handleError(_0x2f7cc8,_0x4d45dc){_0x4d45dc=_0x4d45dc||0x1f4;return function(_0x22848e){logger[_0xba6d('0x25')](_0x22848e[_0xba6d('0x26')]);if(_0x22848e[_0xba6d('0x27')]){delete _0x22848e[_0xba6d('0x27')];}_0x2f7cc8[_0xba6d('0x19')](_0x4d45dc)[_0xba6d('0x28')](_0x22848e);};}exports[_0xba6d('0x29')]=function(_0x4043ec,_0x22f4f3){var _0x38faa8={},_0x4a0693={},_0x20d93c={'count':0x0,'rows':[]};var _0x1d088f=_[_0xba6d('0x2a')](db[_0xba6d('0x2b')][_0xba6d('0x2c')],function(_0x1d7d07){return{'name':_0x1d7d07[_0xba6d('0x2d')],'type':_0x1d7d07[_0xba6d('0x2e')]['key']};});_0x4a0693[_0xba6d('0x2f')]=_[_0xba6d('0x2a')](_0x1d088f,'name');_0x4a0693[_0xba6d('0x30')]=_[_0xba6d('0x31')](_0x4043ec[_0xba6d('0x30')]);_0x4a0693[_0xba6d('0x32')]=_[_0xba6d('0x33')](_0x4a0693[_0xba6d('0x2f')],_0x4a0693['query']);_0x38faa8['attributes']=_[_0xba6d('0x33')](_0x4a0693[_0xba6d('0x2f')],qs[_0xba6d('0x34')](_0x4043ec[_0xba6d('0x30')][_0xba6d('0x34')]));_0x38faa8[_0xba6d('0x35')]=_0x38faa8[_0xba6d('0x35')]['length']?_0x38faa8[_0xba6d('0x35')]:_0x4a0693[_0xba6d('0x2f')];if(!_0x4043ec[_0xba6d('0x30')][_0xba6d('0x36')](_0xba6d('0x37'))){_0x38faa8[_0xba6d('0x1d')]=qs[_0xba6d('0x1d')](_0x4043ec[_0xba6d('0x30')]['limit']);_0x38faa8[_0xba6d('0x38')]=qs[_0xba6d('0x38')](_0x4043ec[_0xba6d('0x30')]['offset']);}_0x38faa8[_0xba6d('0x39')]=qs['sort'](_0x4043ec[_0xba6d('0x30')][_0xba6d('0x3a')]);_0x38faa8[_0xba6d('0x3b')]=qs[_0xba6d('0x32')](_[_0xba6d('0x3c')](_0x4043ec[_0xba6d('0x30')],_0x4a0693[_0xba6d('0x32')]),_0x1d088f);if(_0x4043ec['query'][_0xba6d('0x3d')]){_0x38faa8[_0xba6d('0x3b')]=_[_0xba6d('0x3e')](_0x38faa8['where'],{'$or':_[_0xba6d('0x2a')](_0x1d088f,function(_0x1ad88f){if(_0x1ad88f[_0xba6d('0x2e')]!==_0xba6d('0x3f')){var _0x3e42d5={};_0x3e42d5[_0x1ad88f['name']]={'$like':'%'+_0x4043ec[_0xba6d('0x30')]['filter']+'%'};return _0x3e42d5;}})});}_0x38faa8=_[_0xba6d('0x3e')]({},_0x38faa8,_0x4043ec[_0xba6d('0x40')]);var _0x71cbc4={'where':_0x38faa8['where']};return db[_0xba6d('0x2b')]['count'](_0x71cbc4)[_0xba6d('0x24')](function(_0x3fd9ca){_0x20d93c[_0xba6d('0x1e')]=_0x3fd9ca;if(_0x4043ec[_0xba6d('0x30')][_0xba6d('0x41')]){_0x38faa8[_0xba6d('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xba6d('0x43')](_0x38faa8);})[_0xba6d('0x24')](function(_0x1defac){_0x20d93c['rows']=_0x1defac;return _0x20d93c;})[_0xba6d('0x24')](respondWithFilteredResult(_0x22f4f3,_0x38faa8))[_0xba6d('0x44')](handleError(_0x22f4f3,null));};exports[_0xba6d('0x45')]=function(_0x2e40b4,_0x38b8b){var _0x3f1456={'raw':![],'where':{'id':_0x2e40b4['params']['id']}},_0x516b68={};_0x516b68[_0xba6d('0x2f')]=_[_0xba6d('0x31')](db[_0xba6d('0x2b')][_0xba6d('0x2c')]);_0x516b68['query']=_['keys'](_0x2e40b4[_0xba6d('0x30')]);_0x516b68[_0xba6d('0x32')]=_[_0xba6d('0x33')](_0x516b68[_0xba6d('0x2f')],_0x516b68['query']);_0x3f1456['attributes']=_[_0xba6d('0x33')](_0x516b68['model'],qs[_0xba6d('0x34')](_0x2e40b4[_0xba6d('0x30')][_0xba6d('0x34')]));_0x3f1456[_0xba6d('0x35')]=_0x3f1456[_0xba6d('0x35')][_0xba6d('0x46')]?_0x3f1456['attributes']:_0x516b68[_0xba6d('0x2f')];if(_0x2e40b4[_0xba6d('0x30')][_0xba6d('0x41')]){_0x3f1456['include']=[{'all':!![]}];}_0x3f1456=_[_0xba6d('0x3e')]({},_0x3f1456,_0x2e40b4['options']);return db['ServicenowConfiguration'][_0xba6d('0x47')](_0x3f1456)[_0xba6d('0x24')](handleEntityNotFound(_0x38b8b,null))[_0xba6d('0x24')](respondWithResult(_0x38b8b,null))[_0xba6d('0x44')](handleError(_0x38b8b,null));};exports[_0xba6d('0x48')]=function(_0x152bc0,_0x39df76){return db[_0xba6d('0x2b')][_0xba6d('0x48')](_0x152bc0['body'],{})['then'](respondWithResult(_0x39df76,0xc9))[_0xba6d('0x44')](handleError(_0x39df76,null));};exports['update']=function(_0x12ba3c,_0x42a17d){if(_0x12ba3c[_0xba6d('0x49')]['id']){delete _0x12ba3c['body']['id'];}return db[_0xba6d('0x2b')][_0xba6d('0x47')]({'where':{'id':_0x12ba3c['params']['id']}})[_0xba6d('0x24')](handleEntityNotFound(_0x42a17d,null))[_0xba6d('0x24')](saveUpdates(_0x12ba3c['body'],null))[_0xba6d('0x24')](respondWithResult(_0x42a17d,null))[_0xba6d('0x44')](handleError(_0x42a17d,null));};exports['destroy']=function(_0x7a7a41,_0x27257c){return db[_0xba6d('0x2b')][_0xba6d('0x47')]({'where':{'id':_0x7a7a41[_0xba6d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x27257c,null))['then'](removeEntity(_0x27257c,null))[_0xba6d('0x44')](handleError(_0x27257c,null));};exports[_0xba6d('0x4b')]=function(_0x5d7a7c,_0x32d90b,_0x56622e){var _0x57c73a={};var _0x188c7f={};var _0x2b8576;var _0x546c49;return db[_0xba6d('0x2b')]['findOne']({'where':{'id':_0x5d7a7c[_0xba6d('0x4a')]['id']}})[_0xba6d('0x24')](handleEntityNotFound(_0x32d90b,null))['then'](function(_0xb9ca54){if(_0xb9ca54){_0x2b8576=_0xb9ca54;_0x188c7f[_0xba6d('0x2f')]=_[_0xba6d('0x31')](db[_0xba6d('0x4c')][_0xba6d('0x2c')]);_0x188c7f[_0xba6d('0x30')]=_[_0xba6d('0x31')](_0x5d7a7c['query']);_0x188c7f['filters']=_[_0xba6d('0x33')](_0x188c7f['model'],_0x188c7f[_0xba6d('0x30')]);_0x57c73a[_0xba6d('0x35')]=_[_0xba6d('0x33')](_0x188c7f[_0xba6d('0x2f')],qs[_0xba6d('0x34')](_0x5d7a7c['query'][_0xba6d('0x34')]));_0x57c73a[_0xba6d('0x35')]=_0x57c73a[_0xba6d('0x35')][_0xba6d('0x46')]?_0x57c73a[_0xba6d('0x35')]:_0x188c7f[_0xba6d('0x2f')];_0x57c73a[_0xba6d('0x39')]=qs[_0xba6d('0x3a')](_0x5d7a7c['query'][_0xba6d('0x3a')]);_0x57c73a['where']=qs[_0xba6d('0x32')](_[_0xba6d('0x3c')](_0x5d7a7c[_0xba6d('0x30')],_0x188c7f['filters']));if(_0x5d7a7c[_0xba6d('0x30')][_0xba6d('0x3d')]){_0x57c73a[_0xba6d('0x3b')]=_[_0xba6d('0x3e')](_0x57c73a['where'],{'$or':_['map'](_0x57c73a[_0xba6d('0x35')],function(_0x12bb8c){var _0x47b6c2={};_0x47b6c2[_0x12bb8c]={'$like':'%'+_0x5d7a7c[_0xba6d('0x30')]['filter']+'%'};return _0x47b6c2;})});}_0x57c73a=_[_0xba6d('0x3e')]({},_0x57c73a,_0x5d7a7c[_0xba6d('0x40')]);return _0x2b8576[_0xba6d('0x4b')](_0x57c73a);}})[_0xba6d('0x24')](function(_0x497172){if(_0x497172){_0x546c49=_0x497172[_0xba6d('0x46')];if(!_0x5d7a7c[_0xba6d('0x30')][_0xba6d('0x36')](_0xba6d('0x37'))){_0x57c73a[_0xba6d('0x1d')]=qs[_0xba6d('0x1d')](_0x5d7a7c[_0xba6d('0x30')][_0xba6d('0x1d')]);_0x57c73a[_0xba6d('0x38')]=qs['offset'](_0x5d7a7c[_0xba6d('0x30')]['offset']);}return _0x2b8576[_0xba6d('0x4b')](_0x57c73a);}})[_0xba6d('0x24')](function(_0x2f5be5){if(_0x2f5be5){return _0x2f5be5?{'count':_0x546c49,'rows':_0x2f5be5}:null;}})['then'](respondWithResult(_0x32d90b,null))[_0xba6d('0x44')](handleError(_0x32d90b,null));};exports['getSubjects']=function(_0x261c60,_0x8d0f97,_0x582c1f){var _0x4008e5={};var _0xe2a8d8={};var _0x1f4283;var _0x1523bc;return db[_0xba6d('0x2b')][_0xba6d('0x4d')]({'where':{'id':_0x261c60[_0xba6d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x8d0f97,null))[_0xba6d('0x24')](function(_0xa16257){if(_0xa16257){_0x1f4283=_0xa16257;_0xe2a8d8[_0xba6d('0x2f')]=_[_0xba6d('0x31')](db[_0xba6d('0x4c')][_0xba6d('0x2c')]);_0xe2a8d8[_0xba6d('0x30')]=_[_0xba6d('0x31')](_0x261c60[_0xba6d('0x30')]);_0xe2a8d8['filters']=_['intersection'](_0xe2a8d8[_0xba6d('0x2f')],_0xe2a8d8['query']);_0x4008e5[_0xba6d('0x35')]=_[_0xba6d('0x33')](_0xe2a8d8['model'],qs[_0xba6d('0x34')](_0x261c60[_0xba6d('0x30')][_0xba6d('0x34')]));_0x4008e5[_0xba6d('0x35')]=_0x4008e5[_0xba6d('0x35')][_0xba6d('0x46')]?_0x4008e5['attributes']:_0xe2a8d8[_0xba6d('0x2f')];_0x4008e5[_0xba6d('0x39')]=qs[_0xba6d('0x3a')](_0x261c60[_0xba6d('0x30')][_0xba6d('0x3a')]);_0x4008e5[_0xba6d('0x3b')]=qs[_0xba6d('0x32')](_[_0xba6d('0x3c')](_0x261c60[_0xba6d('0x30')],_0xe2a8d8[_0xba6d('0x32')]));if(_0x261c60[_0xba6d('0x30')][_0xba6d('0x3d')]){_0x4008e5['where']=_[_0xba6d('0x3e')](_0x4008e5[_0xba6d('0x3b')],{'$or':_[_0xba6d('0x2a')](_0x4008e5[_0xba6d('0x35')],function(_0x5683b7){var _0x2b6f79={};_0x2b6f79[_0x5683b7]={'$like':'%'+_0x261c60[_0xba6d('0x30')][_0xba6d('0x3d')]+'%'};return _0x2b6f79;})});}_0x4008e5=_[_0xba6d('0x3e')]({},_0x4008e5,_0x261c60[_0xba6d('0x40')]);return _0x1f4283[_0xba6d('0x4e')](_0x4008e5);}})[_0xba6d('0x24')](function(_0x5cec56){if(_0x5cec56){_0x1523bc=_0x5cec56[_0xba6d('0x46')];if(!_0x261c60['query'][_0xba6d('0x36')](_0xba6d('0x37'))){_0x4008e5['limit']=qs[_0xba6d('0x1d')](_0x261c60[_0xba6d('0x30')][_0xba6d('0x1d')]);_0x4008e5[_0xba6d('0x38')]=qs[_0xba6d('0x38')](_0x261c60['query']['offset']);}return _0x1f4283['getSubjects'](_0x4008e5);}})[_0xba6d('0x24')](function(_0x452821){if(_0x452821){return _0x452821?{'count':_0x1523bc,'rows':_0x452821}:null;}})[_0xba6d('0x24')](respondWithResult(_0x8d0f97,null))[_0xba6d('0x44')](handleError(_0x8d0f97,null));};exports['getDescriptions']=function(_0xf233f8,_0x11cc4d,_0x121426){var _0x4c92f5={};var _0x8a713b={};var _0x4a7993;var _0x3e3bbd;return db[_0xba6d('0x2b')][_0xba6d('0x4d')]({'where':{'id':_0xf233f8[_0xba6d('0x4a')]['id']}})[_0xba6d('0x24')](handleEntityNotFound(_0x11cc4d,null))[_0xba6d('0x24')](function(_0xcbf444){if(_0xcbf444){_0x4a7993=_0xcbf444;_0x8a713b['model']=_[_0xba6d('0x31')](db[_0xba6d('0x4c')][_0xba6d('0x2c')]);_0x8a713b[_0xba6d('0x30')]=_[_0xba6d('0x31')](_0xf233f8[_0xba6d('0x30')]);_0x8a713b[_0xba6d('0x32')]=_[_0xba6d('0x33')](_0x8a713b['model'],_0x8a713b['query']);_0x4c92f5['attributes']=_[_0xba6d('0x33')](_0x8a713b[_0xba6d('0x2f')],qs[_0xba6d('0x34')](_0xf233f8[_0xba6d('0x30')][_0xba6d('0x34')]));_0x4c92f5[_0xba6d('0x35')]=_0x4c92f5[_0xba6d('0x35')][_0xba6d('0x46')]?_0x4c92f5[_0xba6d('0x35')]:_0x8a713b['model'];_0x4c92f5[_0xba6d('0x39')]=qs['sort'](_0xf233f8[_0xba6d('0x30')][_0xba6d('0x3a')]);_0x4c92f5['where']=qs[_0xba6d('0x32')](_['pick'](_0xf233f8[_0xba6d('0x30')],_0x8a713b[_0xba6d('0x32')]));if(_0xf233f8[_0xba6d('0x30')][_0xba6d('0x3d')]){_0x4c92f5[_0xba6d('0x3b')]=_['merge'](_0x4c92f5['where'],{'$or':_[_0xba6d('0x2a')](_0x4c92f5[_0xba6d('0x35')],function(_0x3743e6){var _0x3922c4={};_0x3922c4[_0x3743e6]={'$like':'%'+_0xf233f8[_0xba6d('0x30')]['filter']+'%'};return _0x3922c4;})});}_0x4c92f5=_['merge']({},_0x4c92f5,_0xf233f8[_0xba6d('0x40')]);return _0x4a7993[_0xba6d('0x4f')](_0x4c92f5);}})[_0xba6d('0x24')](function(_0x5a882b){if(_0x5a882b){_0x3e3bbd=_0x5a882b[_0xba6d('0x46')];if(!_0xf233f8['query'][_0xba6d('0x36')](_0xba6d('0x37'))){_0x4c92f5['limit']=qs['limit'](_0xf233f8['query'][_0xba6d('0x1d')]);_0x4c92f5[_0xba6d('0x38')]=qs['offset'](_0xf233f8[_0xba6d('0x30')][_0xba6d('0x38')]);}return _0x4a7993[_0xba6d('0x4f')](_0x4c92f5);}})['then'](function(_0xfc32f1){if(_0xfc32f1){return _0xfc32f1?{'count':_0x3e3bbd,'rows':_0xfc32f1}:null;}})[_0xba6d('0x24')](respondWithResult(_0x11cc4d,null))[_0xba6d('0x44')](handleError(_0x11cc4d,null));}; \ No newline at end of file +var _0x25ea=['ServicenowField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','filter','getSubjects'];(function(_0x35050b,_0x1470b8){var _0x37d62e=function(_0x80b4b0){while(--_0x80b4b0){_0x35050b['push'](_0x35050b['shift']());}};_0x37d62e(++_0x1470b8);}(_0x25ea,0x1ab));var _0xa25e=function(_0x46111d,_0x5d286b){_0x46111d=_0x46111d-0x0;var _0xe82586=_0x25ea[_0x46111d];return _0xe82586;};'use strict';var emlformat=require(_0xa25e('0x0'));var rimraf=require(_0xa25e('0x1'));var zipdir=require(_0xa25e('0x2'));var jsonpatch=require(_0xa25e('0x3'));var rp=require(_0xa25e('0x4'));var moment=require(_0xa25e('0x5'));var BPromise=require(_0xa25e('0x6'));var Mustache=require('mustache');var util=require(_0xa25e('0x7'));var path=require(_0xa25e('0x8'));var sox=require(_0xa25e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa25e('0xa'));var _=require(_0xa25e('0xb'));var squel=require(_0xa25e('0xc'));var crypto=require(_0xa25e('0xd'));var jsforce=require(_0xa25e('0xe'));var deskjs=require(_0xa25e('0xf'));var toCsv=require(_0xa25e('0x10'));var querystring=require('querystring');var Papa=require(_0xa25e('0x11'));var Redis=require('ioredis');var authService=require(_0xa25e('0x12'));var qs=require(_0xa25e('0x13'));var as=require(_0xa25e('0x14'));var hardwareService=require(_0xa25e('0x15'));var logger=require(_0xa25e('0x16'))(_0xa25e('0x17'));var utils=require(_0xa25e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa25e('0x19'));var db=require(_0xa25e('0x1a'))['db'];function respondWithStatusCode(_0x54778d,_0x267548){_0x267548=_0x267548||0xcc;return function(_0x9da06d){if(_0x9da06d){return _0x54778d[_0xa25e('0x1b')](_0x267548);}return _0x54778d[_0xa25e('0x1c')](_0x267548)[_0xa25e('0x1d')]();};}function respondWithResult(_0x181020,_0x9e14a8){_0x9e14a8=_0x9e14a8||0xc8;return function(_0x536b41){if(_0x536b41){return _0x181020[_0xa25e('0x1c')](_0x9e14a8)[_0xa25e('0x1e')](_0x536b41);}};}function respondWithFilteredResult(_0x290321,_0x3cde13){return function(_0x49f779){if(_0x49f779){var _0x3a1530=typeof _0x3cde13[_0xa25e('0x1f')]===_0xa25e('0x20')&&typeof _0x3cde13['limit']===_0xa25e('0x20');var _0x1be02c=_0x49f779[_0xa25e('0x21')];var _0xcece9a=_0x3a1530?0x0:_0x3cde13[_0xa25e('0x1f')];var _0x5bcef7=_0x3a1530?_0x49f779['count']:_0x3cde13['offset']+_0x3cde13['limit'];var _0x1da682;if(_0x5bcef7>=_0x1be02c){_0x5bcef7=_0x1be02c;_0x1da682=0xc8;}else{_0x1da682=0xce;}_0x290321[_0xa25e('0x1c')](_0x1da682);return _0x290321[_0xa25e('0x22')](_0xa25e('0x23'),_0xcece9a+'-'+_0x5bcef7+'/'+_0x1be02c)[_0xa25e('0x1e')](_0x49f779);}return null;};}function patchUpdates(_0x530a47){return function(_0x3084b4){try{jsonpatch[_0xa25e('0x24')](_0x3084b4,_0x530a47,!![]);}catch(_0x50efbb){return BPromise[_0xa25e('0x25')](_0x50efbb);}return _0x3084b4[_0xa25e('0x26')]();};}function saveUpdates(_0x56da50,_0x20f485){return function(_0x55c8ef){if(_0x55c8ef){return _0x55c8ef[_0xa25e('0x27')](_0x56da50)[_0xa25e('0x28')](function(_0x1ae352){return _0x1ae352;});}return null;};}function removeEntity(_0x398947,_0x16a24d){return function(_0xbff8fd){if(_0xbff8fd){return _0xbff8fd[_0xa25e('0x29')]()[_0xa25e('0x28')](function(){_0x398947[_0xa25e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x587060,_0x2b4bd8){return function(_0x68d6b7){if(!_0x68d6b7){_0x587060['sendStatus'](0x194);}return _0x68d6b7;};}function handleError(_0x5c81c7,_0x3fb7c6){_0x3fb7c6=_0x3fb7c6||0x1f4;return function(_0x4cbf1a){logger[_0xa25e('0x2a')](_0x4cbf1a[_0xa25e('0x2b')]);if(_0x4cbf1a[_0xa25e('0x2c')]){delete _0x4cbf1a[_0xa25e('0x2c')];}_0x5c81c7[_0xa25e('0x1c')](_0x3fb7c6)[_0xa25e('0x2d')](_0x4cbf1a);};}exports[_0xa25e('0x2e')]=function(_0x5ae1a9,_0x1f81d9){var _0x4ff94a={},_0x223aa3={},_0xd76367={'count':0x0,'rows':[]};var _0x1d84e8=_[_0xa25e('0x2f')](db[_0xa25e('0x30')][_0xa25e('0x31')],function(_0x7124c){return{'name':_0x7124c['fieldName'],'type':_0x7124c[_0xa25e('0x32')][_0xa25e('0x33')]};});_0x223aa3[_0xa25e('0x34')]=_[_0xa25e('0x2f')](_0x1d84e8,_0xa25e('0x2c'));_0x223aa3[_0xa25e('0x35')]=_[_0xa25e('0x36')](_0x5ae1a9[_0xa25e('0x35')]);_0x223aa3['filters']=_['intersection'](_0x223aa3[_0xa25e('0x34')],_0x223aa3[_0xa25e('0x35')]);_0x4ff94a[_0xa25e('0x37')]=_[_0xa25e('0x38')](_0x223aa3[_0xa25e('0x34')],qs[_0xa25e('0x39')](_0x5ae1a9[_0xa25e('0x35')][_0xa25e('0x39')]));_0x4ff94a[_0xa25e('0x37')]=_0x4ff94a['attributes']['length']?_0x4ff94a['attributes']:_0x223aa3['model'];if(!_0x5ae1a9[_0xa25e('0x35')][_0xa25e('0x3a')](_0xa25e('0x3b'))){_0x4ff94a[_0xa25e('0x3c')]=qs[_0xa25e('0x3c')](_0x5ae1a9[_0xa25e('0x35')]['limit']);_0x4ff94a[_0xa25e('0x1f')]=qs[_0xa25e('0x1f')](_0x5ae1a9[_0xa25e('0x35')][_0xa25e('0x1f')]);}_0x4ff94a[_0xa25e('0x3d')]=qs[_0xa25e('0x3e')](_0x5ae1a9['query']['sort']);_0x4ff94a[_0xa25e('0x3f')]=qs['filters'](_[_0xa25e('0x40')](_0x5ae1a9[_0xa25e('0x35')],_0x223aa3[_0xa25e('0x41')]),_0x1d84e8);if(_0x5ae1a9[_0xa25e('0x35')]['filter']){_0x4ff94a['where']=_[_0xa25e('0x42')](_0x4ff94a['where'],{'$or':_[_0xa25e('0x2f')](_0x1d84e8,function(_0xafdb3f){if(_0xafdb3f['type']!==_0xa25e('0x43')){var _0x12cc22={};_0x12cc22[_0xafdb3f['name']]={'$like':'%'+_0x5ae1a9['query']['filter']+'%'};return _0x12cc22;}})});}_0x4ff94a=_[_0xa25e('0x42')]({},_0x4ff94a,_0x5ae1a9[_0xa25e('0x44')]);var _0x1a0c7c={'where':_0x4ff94a['where']};return db[_0xa25e('0x30')][_0xa25e('0x21')](_0x1a0c7c)[_0xa25e('0x28')](function(_0x873722){_0xd76367[_0xa25e('0x21')]=_0x873722;if(_0x5ae1a9[_0xa25e('0x35')][_0xa25e('0x45')]){_0x4ff94a['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xa25e('0x46')](_0x4ff94a);})[_0xa25e('0x28')](function(_0x38e0e8){_0xd76367[_0xa25e('0x47')]=_0x38e0e8;return _0xd76367;})['then'](respondWithFilteredResult(_0x1f81d9,_0x4ff94a))[_0xa25e('0x48')](handleError(_0x1f81d9,null));};exports[_0xa25e('0x49')]=function(_0x4b97df,_0x1da74c){var _0x30334f={'raw':![],'where':{'id':_0x4b97df[_0xa25e('0x4a')]['id']}},_0x5b03f1={};_0x5b03f1[_0xa25e('0x34')]=_['keys'](db[_0xa25e('0x30')][_0xa25e('0x31')]);_0x5b03f1[_0xa25e('0x35')]=_[_0xa25e('0x36')](_0x4b97df[_0xa25e('0x35')]);_0x5b03f1['filters']=_[_0xa25e('0x38')](_0x5b03f1[_0xa25e('0x34')],_0x5b03f1[_0xa25e('0x35')]);_0x30334f['attributes']=_['intersection'](_0x5b03f1[_0xa25e('0x34')],qs[_0xa25e('0x39')](_0x4b97df[_0xa25e('0x35')][_0xa25e('0x39')]));_0x30334f[_0xa25e('0x37')]=_0x30334f['attributes'][_0xa25e('0x4b')]?_0x30334f[_0xa25e('0x37')]:_0x5b03f1[_0xa25e('0x34')];if(_0x4b97df[_0xa25e('0x35')][_0xa25e('0x45')]){_0x30334f['include']=[{'all':!![]}];}_0x30334f=_[_0xa25e('0x42')]({},_0x30334f,_0x4b97df[_0xa25e('0x44')]);return db[_0xa25e('0x30')][_0xa25e('0x4c')](_0x30334f)[_0xa25e('0x28')](handleEntityNotFound(_0x1da74c,null))[_0xa25e('0x28')](respondWithResult(_0x1da74c,null))['catch'](handleError(_0x1da74c,null));};exports['create']=function(_0x662aa5,_0xd0aa45){return db[_0xa25e('0x30')][_0xa25e('0x4d')](_0x662aa5[_0xa25e('0x4e')],{})['then'](respondWithResult(_0xd0aa45,0xc9))[_0xa25e('0x48')](handleError(_0xd0aa45,null));};exports[_0xa25e('0x27')]=function(_0x25ec66,_0x3f65bc){if(_0x25ec66[_0xa25e('0x4e')]['id']){delete _0x25ec66[_0xa25e('0x4e')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x25ec66['params']['id']}})[_0xa25e('0x28')](handleEntityNotFound(_0x3f65bc,null))[_0xa25e('0x28')](saveUpdates(_0x25ec66[_0xa25e('0x4e')],null))[_0xa25e('0x28')](respondWithResult(_0x3f65bc,null))[_0xa25e('0x48')](handleError(_0x3f65bc,null));};exports[_0xa25e('0x29')]=function(_0x2a02d7,_0x35fc3f){return db[_0xa25e('0x30')][_0xa25e('0x4c')]({'where':{'id':_0x2a02d7[_0xa25e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35fc3f,null))[_0xa25e('0x28')](removeEntity(_0x35fc3f,null))[_0xa25e('0x48')](handleError(_0x35fc3f,null));};exports[_0xa25e('0x4f')]=function(_0x40499a,_0x21c799,_0x577954){var _0x2153ec={};var _0x3d37e2={};var _0x53d3ec;var _0xe53eac;return db[_0xa25e('0x30')][_0xa25e('0x50')]({'where':{'id':_0x40499a['params']['id']}})[_0xa25e('0x28')](handleEntityNotFound(_0x21c799,null))[_0xa25e('0x28')](function(_0x217018){if(_0x217018){_0x53d3ec=_0x217018;_0x3d37e2[_0xa25e('0x34')]=_['keys'](db['ServicenowField'][_0xa25e('0x31')]);_0x3d37e2['query']=_['keys'](_0x40499a[_0xa25e('0x35')]);_0x3d37e2['filters']=_[_0xa25e('0x38')](_0x3d37e2['model'],_0x3d37e2[_0xa25e('0x35')]);_0x2153ec['attributes']=_[_0xa25e('0x38')](_0x3d37e2['model'],qs[_0xa25e('0x39')](_0x40499a[_0xa25e('0x35')][_0xa25e('0x39')]));_0x2153ec[_0xa25e('0x37')]=_0x2153ec['attributes'][_0xa25e('0x4b')]?_0x2153ec['attributes']:_0x3d37e2['model'];_0x2153ec[_0xa25e('0x3d')]=qs[_0xa25e('0x3e')](_0x40499a[_0xa25e('0x35')]['sort']);_0x2153ec['where']=qs['filters'](_['pick'](_0x40499a['query'],_0x3d37e2[_0xa25e('0x41')]));if(_0x40499a[_0xa25e('0x35')][_0xa25e('0x51')]){_0x2153ec[_0xa25e('0x3f')]=_[_0xa25e('0x42')](_0x2153ec[_0xa25e('0x3f')],{'$or':_[_0xa25e('0x2f')](_0x2153ec[_0xa25e('0x37')],function(_0x1dd905){var _0x41fc2c={};_0x41fc2c[_0x1dd905]={'$like':'%'+_0x40499a[_0xa25e('0x35')][_0xa25e('0x51')]+'%'};return _0x41fc2c;})});}_0x2153ec=_[_0xa25e('0x42')]({},_0x2153ec,_0x40499a[_0xa25e('0x44')]);return _0x53d3ec[_0xa25e('0x4f')](_0x2153ec);}})[_0xa25e('0x28')](function(_0x5f3e27){if(_0x5f3e27){_0xe53eac=_0x5f3e27[_0xa25e('0x4b')];if(!_0x40499a['query'][_0xa25e('0x3a')](_0xa25e('0x3b'))){_0x2153ec['limit']=qs['limit'](_0x40499a[_0xa25e('0x35')][_0xa25e('0x3c')]);_0x2153ec['offset']=qs[_0xa25e('0x1f')](_0x40499a[_0xa25e('0x35')]['offset']);}return _0x53d3ec['getFields'](_0x2153ec);}})[_0xa25e('0x28')](function(_0x4b7192){if(_0x4b7192){return _0x4b7192?{'count':_0xe53eac,'rows':_0x4b7192}:null;}})[_0xa25e('0x28')](respondWithResult(_0x21c799,null))[_0xa25e('0x48')](handleError(_0x21c799,null));};exports[_0xa25e('0x52')]=function(_0x33c2cb,_0x50f533,_0x5871d4){var _0x3f2ee9={};var _0x3a9e68={};var _0x2a7053;var _0x3bdb7d;return db[_0xa25e('0x30')][_0xa25e('0x50')]({'where':{'id':_0x33c2cb[_0xa25e('0x4a')]['id']}})[_0xa25e('0x28')](handleEntityNotFound(_0x50f533,null))['then'](function(_0x2d57fa){if(_0x2d57fa){_0x2a7053=_0x2d57fa;_0x3a9e68[_0xa25e('0x34')]=_[_0xa25e('0x36')](db[_0xa25e('0x53')][_0xa25e('0x31')]);_0x3a9e68[_0xa25e('0x35')]=_['keys'](_0x33c2cb[_0xa25e('0x35')]);_0x3a9e68[_0xa25e('0x41')]=_['intersection'](_0x3a9e68[_0xa25e('0x34')],_0x3a9e68[_0xa25e('0x35')]);_0x3f2ee9['attributes']=_[_0xa25e('0x38')](_0x3a9e68['model'],qs[_0xa25e('0x39')](_0x33c2cb[_0xa25e('0x35')][_0xa25e('0x39')]));_0x3f2ee9[_0xa25e('0x37')]=_0x3f2ee9[_0xa25e('0x37')][_0xa25e('0x4b')]?_0x3f2ee9[_0xa25e('0x37')]:_0x3a9e68['model'];_0x3f2ee9['order']=qs[_0xa25e('0x3e')](_0x33c2cb['query']['sort']);_0x3f2ee9[_0xa25e('0x3f')]=qs['filters'](_[_0xa25e('0x40')](_0x33c2cb[_0xa25e('0x35')],_0x3a9e68[_0xa25e('0x41')]));if(_0x33c2cb['query']['filter']){_0x3f2ee9[_0xa25e('0x3f')]=_[_0xa25e('0x42')](_0x3f2ee9[_0xa25e('0x3f')],{'$or':_['map'](_0x3f2ee9['attributes'],function(_0x5ca0f5){var _0x31732e={};_0x31732e[_0x5ca0f5]={'$like':'%'+_0x33c2cb['query'][_0xa25e('0x51')]+'%'};return _0x31732e;})});}_0x3f2ee9=_[_0xa25e('0x42')]({},_0x3f2ee9,_0x33c2cb[_0xa25e('0x44')]);return _0x2a7053[_0xa25e('0x52')](_0x3f2ee9);}})['then'](function(_0x2c34a0){if(_0x2c34a0){_0x3bdb7d=_0x2c34a0['length'];if(!_0x33c2cb[_0xa25e('0x35')][_0xa25e('0x3a')](_0xa25e('0x3b'))){_0x3f2ee9[_0xa25e('0x3c')]=qs['limit'](_0x33c2cb[_0xa25e('0x35')][_0xa25e('0x3c')]);_0x3f2ee9[_0xa25e('0x1f')]=qs['offset'](_0x33c2cb['query'][_0xa25e('0x1f')]);}return _0x2a7053[_0xa25e('0x52')](_0x3f2ee9);}})[_0xa25e('0x28')](function(_0x57a5a4){if(_0x57a5a4){return _0x57a5a4?{'count':_0x3bdb7d,'rows':_0x57a5a4}:null;}})[_0xa25e('0x28')](respondWithResult(_0x50f533,null))[_0xa25e('0x48')](handleError(_0x50f533,null));};exports[_0xa25e('0x54')]=function(_0x5eaa07,_0x48e369,_0x56bacc){var _0xfd1150={};var _0x51763b={};var _0x23f8ae;var _0x58d09b;return db[_0xa25e('0x30')][_0xa25e('0x50')]({'where':{'id':_0x5eaa07[_0xa25e('0x4a')]['id']}})[_0xa25e('0x28')](handleEntityNotFound(_0x48e369,null))['then'](function(_0x29b981){if(_0x29b981){_0x23f8ae=_0x29b981;_0x51763b['model']=_['keys'](db[_0xa25e('0x53')][_0xa25e('0x31')]);_0x51763b['query']=_['keys'](_0x5eaa07[_0xa25e('0x35')]);_0x51763b['filters']=_['intersection'](_0x51763b['model'],_0x51763b[_0xa25e('0x35')]);_0xfd1150['attributes']=_[_0xa25e('0x38')](_0x51763b[_0xa25e('0x34')],qs['fields'](_0x5eaa07[_0xa25e('0x35')][_0xa25e('0x39')]));_0xfd1150[_0xa25e('0x37')]=_0xfd1150[_0xa25e('0x37')][_0xa25e('0x4b')]?_0xfd1150[_0xa25e('0x37')]:_0x51763b[_0xa25e('0x34')];_0xfd1150[_0xa25e('0x3d')]=qs['sort'](_0x5eaa07[_0xa25e('0x35')][_0xa25e('0x3e')]);_0xfd1150['where']=qs[_0xa25e('0x41')](_[_0xa25e('0x40')](_0x5eaa07['query'],_0x51763b[_0xa25e('0x41')]));if(_0x5eaa07[_0xa25e('0x35')][_0xa25e('0x51')]){_0xfd1150[_0xa25e('0x3f')]=_['merge'](_0xfd1150[_0xa25e('0x3f')],{'$or':_[_0xa25e('0x2f')](_0xfd1150[_0xa25e('0x37')],function(_0xdbcfeb){var _0xb4356c={};_0xb4356c[_0xdbcfeb]={'$like':'%'+_0x5eaa07['query']['filter']+'%'};return _0xb4356c;})});}_0xfd1150=_['merge']({},_0xfd1150,_0x5eaa07[_0xa25e('0x44')]);return _0x23f8ae[_0xa25e('0x54')](_0xfd1150);}})['then'](function(_0x1948a2){if(_0x1948a2){_0x58d09b=_0x1948a2[_0xa25e('0x4b')];if(!_0x5eaa07[_0xa25e('0x35')][_0xa25e('0x3a')](_0xa25e('0x3b'))){_0xfd1150['limit']=qs[_0xa25e('0x3c')](_0x5eaa07[_0xa25e('0x35')]['limit']);_0xfd1150['offset']=qs[_0xa25e('0x1f')](_0x5eaa07['query'][_0xa25e('0x1f')]);}return _0x23f8ae['getDescriptions'](_0xfd1150);}})[_0xa25e('0x28')](function(_0x130070){if(_0x130070){return _0x130070?{'count':_0x58d09b,'rows':_0x130070}:null;}})[_0xa25e('0x28')](respondWithResult(_0x48e369,null))[_0xa25e('0x48')](handleError(_0x48e369,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 82d4ae6..ff01581 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 _0x68a5=['define','ServicenowConfiguration','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x68a5,0xfc));var _0x568a=function(_0x33a489,_0x3616f3){_0x33a489=_0x33a489-0x0;var _0x40d215=_0x68a5[_0x33a489];return _0x40d215;};'use strict';var _=require(_0x568a('0x0'));var util=require('util');var logger=require(_0x568a('0x1'))(_0x568a('0x2'));var moment=require('moment');var BPromise=require(_0x568a('0x3'));var rp=require(_0x568a('0x4'));var fs=require('fs');var path=require(_0x568a('0x5'));var rimraf=require(_0x568a('0x6'));var config=require('../../config/environment');var attributes=require(_0x568a('0x7'));module['exports']=function(_0x26db0e,_0x467a4f){return _0x26db0e[_0x568a('0x8')](_0x568a('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2be0=['moment','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x2be0,0x128));var _0x02be=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x2be0[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x02be('0x0'));var util=require(_0x02be('0x1'));var logger=require(_0x02be('0x2'))(_0x02be('0x3'));var moment=require(_0x02be('0x4'));var BPromise=require('bluebird');var rp=require(_0x02be('0x5'));var fs=require('fs');var path=require(_0x02be('0x6'));var rimraf=require(_0x02be('0x7'));var config=require('../../config/environment');var attributes=require(_0x02be('0x8'));module[_0x02be('0x9')]=function(_0x46392d,_0x184bf6){return _0x46392d['define'](_0x02be('0xa'),attributes,{'tableName':_0x02be('0xb'),'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 5663afb..87962a8 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 _0x46bc=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x6cb4dd,_0x23b89c){var _0x461fa6=function(_0x10b593){while(--_0x10b593){_0x6cb4dd['push'](_0x6cb4dd['shift']());}};_0x461fa6(++_0x23b89c);}(_0x46bc,0xca));var _0xc46b=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x46bc[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0xc46b('0x0'));var util=require(_0xc46b('0x1'));var moment=require(_0xc46b('0x2'));var BPromise=require(_0xc46b('0x3'));var rs=require(_0xc46b('0x4'));var fs=require('fs');var Redis=require(_0xc46b('0x5'));var db=require(_0xc46b('0x6'))['db'];var utils=require(_0xc46b('0x7'));var logger=require(_0xc46b('0x8'))(_0xc46b('0x9'));var config=require(_0xc46b('0xa'));var jayson=require(_0xc46b('0xb'));var client=jayson['client'][_0xc46b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2da494,_0x99f390,_0x3ee460){return new BPromise(function(_0x30cb18,_0x51b8da){return client[_0xc46b('0xd')](_0x2da494,_0x3ee460)[_0xc46b('0xe')](function(_0x2def43){logger[_0xc46b('0xf')](_0xc46b('0x10'),_0x99f390,'request\x20sent');logger[_0xc46b('0x11')](_0xc46b('0x12'),_0x99f390,_0xc46b('0x13'),JSON[_0xc46b('0x14')](_0x2def43));if(_0x2def43[_0xc46b('0x15')]){if(_0x2def43[_0xc46b('0x15')]['code']===0x1f4){logger[_0xc46b('0x15')](_0xc46b('0x10'),_0x99f390,_0x2def43[_0xc46b('0x15')][_0xc46b('0x16')]);return _0x51b8da(_0x2def43[_0xc46b('0x15')][_0xc46b('0x16')]);}logger[_0xc46b('0x15')](_0xc46b('0x10'),_0x99f390,_0x2def43[_0xc46b('0x15')][_0xc46b('0x16')]);return _0x30cb18(_0x2def43[_0xc46b('0x15')][_0xc46b('0x16')]);}else{logger[_0xc46b('0xf')](_0xc46b('0x10'),_0x99f390,_0xc46b('0x13'));_0x30cb18(_0x2def43[_0xc46b('0x17')][_0xc46b('0x16')]);}})[_0xc46b('0x18')](function(_0x34f0c5){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x99f390,_0x34f0c5);_0x51b8da(_0x34f0c5);});});} \ No newline at end of file +var _0x33ac=['jayson/promise','client','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x37ba84,_0x449c8c){var _0x43dc4f=function(_0x2eee47){while(--_0x2eee47){_0x37ba84['push'](_0x37ba84['shift']());}};_0x43dc4f(++_0x449c8c);}(_0x33ac,0x1f2));var _0xc33a=function(_0x32c557,_0x4b54b1){_0x32c557=_0x32c557-0x0;var _0x50b686=_0x33ac[_0x32c557];return _0x50b686;};'use strict';var _=require('lodash');var util=require(_0xc33a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc33a('0x1'));var fs=require('fs');var Redis=require(_0xc33a('0x2'));var db=require(_0xc33a('0x3'))['db'];var utils=require(_0xc33a('0x4'));var logger=require(_0xc33a('0x5'))(_0xc33a('0x6'));var config=require(_0xc33a('0x7'));var jayson=require(_0xc33a('0x8'));var client=jayson[_0xc33a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aa2fc,_0xceaf87,_0xf2e092){return new BPromise(function(_0x5bdf4a,_0x40c40d){return client['request'](_0x5aa2fc,_0xf2e092)[_0xc33a('0xa')](function(_0x2dc672){logger[_0xc33a('0xb')](_0xc33a('0xc'),_0xceaf87,_0xc33a('0xd'));logger[_0xc33a('0xe')](_0xc33a('0xf'),_0xceaf87,_0xc33a('0xd'),JSON[_0xc33a('0x10')](_0x2dc672));if(_0x2dc672['error']){if(_0x2dc672['error'][_0xc33a('0x11')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0xceaf87,_0x2dc672[_0xc33a('0x12')][_0xc33a('0x13')]);return _0x40c40d(_0x2dc672[_0xc33a('0x12')][_0xc33a('0x13')]);}logger[_0xc33a('0x12')](_0xc33a('0xc'),_0xceaf87,_0x2dc672['error'][_0xc33a('0x13')]);return _0x5bdf4a(_0x2dc672[_0xc33a('0x12')][_0xc33a('0x13')]);}else{logger['info'](_0xc33a('0xc'),_0xceaf87,'request\x20sent');_0x5bdf4a(_0x2dc672[_0xc33a('0x14')][_0xc33a('0x13')]);}})[_0xc33a('0x15')](function(_0xbedbf3){logger[_0xc33a('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0xceaf87,_0xbedbf3);_0x40c40d(_0xbedbf3);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 44c6461..4d62f5d 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 _0x3bf7=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','update','delete','destroy'];(function(_0x23f4ad,_0xb1c02f){var _0x42e2ec=function(_0x4f39e0){while(--_0x4f39e0){_0x23f4ad['push'](_0x23f4ad['shift']());}};_0x42e2ec(++_0xb1c02f);}(_0x3bf7,0xde));var _0x73bf=function(_0x255af7,_0x5abcb3){_0x255af7=_0x255af7-0x0;var _0x7f2e1d=_0x3bf7[_0x255af7];return _0x7f2e1d;};'use strict';var multer=require('multer');var util=require(_0x73bf('0x0'));var path=require(_0x73bf('0x1'));var timeout=require(_0x73bf('0x2'));var express=require(_0x73bf('0x3'));var router=express[_0x73bf('0x4')]();var fs_extra=require(_0x73bf('0x5'));var auth=require(_0x73bf('0x6'));var interaction=require(_0x73bf('0x7'));var config=require(_0x73bf('0x8'));var controller=require('./intServicenowField.controller');router[_0x73bf('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x73bf('0x9')](_0x73bf('0xa'),auth[_0x73bf('0xb')](),controller[_0x73bf('0xc')]);router['post']('/',auth[_0x73bf('0xb')](),controller['create']);router['put'](_0x73bf('0xa'),auth[_0x73bf('0xb')](),controller[_0x73bf('0xd')]);router[_0x73bf('0xe')](_0x73bf('0xa'),auth[_0x73bf('0xb')](),controller[_0x73bf('0xf')]);module[_0x73bf('0x10')]=router; \ No newline at end of file +var _0x6a0d=['post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','index','/:id','isAuthenticated'];(function(_0x17b980,_0x3f8599){var _0x2e1f08=function(_0x2f6bde){while(--_0x2f6bde){_0x17b980['push'](_0x17b980['shift']());}};_0x2e1f08(++_0x3f8599);}(_0x6a0d,0x149));var _0xd6a0=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x6a0d[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0xd6a0('0x0'));var util=require(_0xd6a0('0x1'));var path=require('path');var timeout=require(_0xd6a0('0x2'));var express=require(_0xd6a0('0x3'));var router=express[_0xd6a0('0x4')]();var fs_extra=require(_0xd6a0('0x5'));var auth=require(_0xd6a0('0x6'));var interaction=require(_0xd6a0('0x7'));var config=require(_0xd6a0('0x8'));var controller=require(_0xd6a0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd6a0('0xa')]);router['get'](_0xd6a0('0xb'),auth[_0xd6a0('0xc')](),controller['show']);router[_0xd6a0('0xd')]('/',auth[_0xd6a0('0xc')](),controller['create']);router[_0xd6a0('0xe')](_0xd6a0('0xb'),auth[_0xd6a0('0xc')](),controller[_0xd6a0('0xf')]);router['delete'](_0xd6a0('0xb'),auth[_0xd6a0('0xc')](),controller[_0xd6a0('0x10')]);module[_0xd6a0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index fb6e462..4476f32 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 _0x4c7e=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x156ee8,_0x53bb36){var _0x18db8a=function(_0x6e41f0){while(--_0x6e41f0){_0x156ee8['push'](_0x156ee8['shift']());}};_0x18db8a(++_0x53bb36);}(_0x4c7e,0xac));var _0xe4c7=function(_0x2ccf68,_0x1d41df){_0x2ccf68=_0x2ccf68-0x0;var _0x2793f7=_0x4c7e[_0x2ccf68];return _0x2793f7;};'use strict';var Sequelize=require(_0xe4c7('0x0'));module[_0xe4c7('0x1')]={'type':{'type':Sequelize[_0xe4c7('0x2')](_0xe4c7('0x3'),_0xe4c7('0x4'),_0xe4c7('0x5'),'keyValue',_0xe4c7('0x6')),'defaultValue':_0xe4c7('0x3')},'content':{'type':Sequelize[_0xe4c7('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe4c7('0x2')]('string',_0xe4c7('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe4c7('0x7')]},'nameField':{'type':Sequelize[_0xe4c7('0x7')]},'customField':{'type':Sequelize[_0xe4c7('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4c7('0x7')]}}; \ No newline at end of file +var _0x5016=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x2cdf10,_0x619ba9){var _0x13730b=function(_0x43841f){while(--_0x43841f){_0x2cdf10['push'](_0x2cdf10['shift']());}};_0x13730b(++_0x619ba9);}(_0x5016,0x82));var _0x6501=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0x5016[_0x11e05d];return _0x335588;};'use strict';var Sequelize=require(_0x6501('0x0'));module[_0x6501('0x1')]={'type':{'type':Sequelize[_0x6501('0x2')](_0x6501('0x3'),_0x6501('0x4'),_0x6501('0x5'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x6501('0x6')]},'key':{'type':Sequelize[_0x6501('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6501('0x4'),_0x6501('0x5'))},'keyContent':{'type':Sequelize[_0x6501('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6501('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6501('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 589a621..626c4e9 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 _0x7b0c=['keys','find','create','body','catch','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x5c8097,_0x4a26c2){var _0x590a3a=function(_0x387fff){while(--_0x387fff){_0x5c8097['push'](_0x5c8097['shift']());}};_0x590a3a(++_0x4a26c2);}(_0x7b0c,0x11e));var _0xc7b0=function(_0xd04329,_0x25bfba){_0xd04329=_0xd04329-0x0;var _0xbcc9c0=_0x7b0c[_0xd04329];return _0xbcc9c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc7b0('0x0'));var zipdir=require(_0xc7b0('0x1'));var jsonpatch=require(_0xc7b0('0x2'));var rp=require(_0xc7b0('0x3'));var moment=require(_0xc7b0('0x4'));var BPromise=require(_0xc7b0('0x5'));var Mustache=require(_0xc7b0('0x6'));var util=require(_0xc7b0('0x7'));var path=require(_0xc7b0('0x8'));var sox=require(_0xc7b0('0x9'));var csv=require(_0xc7b0('0xa'));var ejs=require(_0xc7b0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc7b0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc7b0('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc7b0('0xd'));var qs=require(_0xc7b0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7b0('0xf'));var logger=require(_0xc7b0('0x10'))('api');var utils=require(_0xc7b0('0x11'));var config=require(_0xc7b0('0x12'));var licenseUtil=require(_0xc7b0('0x13'));var db=require(_0xc7b0('0x14'))['db'];function respondWithStatusCode(_0x1ac24c,_0x1acc94){_0x1acc94=_0x1acc94||0xcc;return function(_0x17a493){if(_0x17a493){return _0x1ac24c[_0xc7b0('0x15')](_0x1acc94);}return _0x1ac24c[_0xc7b0('0x16')](_0x1acc94)[_0xc7b0('0x17')]();};}function respondWithResult(_0x1c86b4,_0x390b6c){_0x390b6c=_0x390b6c||0xc8;return function(_0x519d5b){if(_0x519d5b){return _0x1c86b4[_0xc7b0('0x16')](_0x390b6c)['json'](_0x519d5b);}};}function respondWithFilteredResult(_0xa9da6,_0x3911f1){return function(_0x1f57c4){if(_0x1f57c4){var _0x2220f5=typeof _0x3911f1[_0xc7b0('0x18')]===_0xc7b0('0x19')&&typeof _0x3911f1[_0xc7b0('0x1a')]==='undefined';var _0x242b48=_0x1f57c4[_0xc7b0('0x1b')];var _0x4e78c3=_0x2220f5?0x0:_0x3911f1[_0xc7b0('0x18')];var _0x2e6376=_0x2220f5?_0x1f57c4[_0xc7b0('0x1b')]:_0x3911f1[_0xc7b0('0x18')]+_0x3911f1[_0xc7b0('0x1a')];var _0x31d062;if(_0x2e6376>=_0x242b48){_0x2e6376=_0x242b48;_0x31d062=0xc8;}else{_0x31d062=0xce;}_0xa9da6[_0xc7b0('0x16')](_0x31d062);return _0xa9da6['set']('Content-Range',_0x4e78c3+'-'+_0x2e6376+'/'+_0x242b48)['json'](_0x1f57c4);}return null;};}function patchUpdates(_0x22cb1a){return function(_0x3fdfd5){try{jsonpatch[_0xc7b0('0x1c')](_0x3fdfd5,_0x22cb1a,!![]);}catch(_0x13e3ad){return BPromise['reject'](_0x13e3ad);}return _0x3fdfd5[_0xc7b0('0x1d')]();};}function saveUpdates(_0x459806,_0x4d15e1){return function(_0x1dd523){if(_0x1dd523){return _0x1dd523[_0xc7b0('0x1e')](_0x459806)[_0xc7b0('0x1f')](function(_0x383045){return _0x383045;});}return null;};}function removeEntity(_0x4744dd,_0x1e0153){return function(_0x4cc83a){if(_0x4cc83a){return _0x4cc83a[_0xc7b0('0x20')]()[_0xc7b0('0x1f')](function(){_0x4744dd[_0xc7b0('0x16')](0xcc)[_0xc7b0('0x17')]();});}};}function handleEntityNotFound(_0x1fb9df,_0x3ebb54){return function(_0x5a664f){if(!_0x5a664f){_0x1fb9df['sendStatus'](0x194);}return _0x5a664f;};}function handleError(_0x3dab2a,_0x5391ac){_0x5391ac=_0x5391ac||0x1f4;return function(_0x5d76d8){logger[_0xc7b0('0x21')](_0x5d76d8[_0xc7b0('0x22')]);if(_0x5d76d8[_0xc7b0('0x23')]){delete _0x5d76d8['name'];}_0x3dab2a[_0xc7b0('0x16')](_0x5391ac)[_0xc7b0('0x24')](_0x5d76d8);};}exports[_0xc7b0('0x25')]=function(_0x42267e,_0xe28f58){var _0x81f55d={},_0x4661bd={},_0x2554af={'count':0x0,'rows':[]};var _0xe2192b=_[_0xc7b0('0x26')](db[_0xc7b0('0x27')][_0xc7b0('0x28')],function(_0xe65017){return{'name':_0xe65017[_0xc7b0('0x29')],'type':_0xe65017['type'][_0xc7b0('0x2a')]};});_0x4661bd[_0xc7b0('0x2b')]=_[_0xc7b0('0x26')](_0xe2192b,_0xc7b0('0x23'));_0x4661bd[_0xc7b0('0x2c')]=_['keys'](_0x42267e['query']);_0x4661bd[_0xc7b0('0x2d')]=_[_0xc7b0('0x2e')](_0x4661bd['model'],_0x4661bd['query']);_0x81f55d[_0xc7b0('0x2f')]=_['intersection'](_0x4661bd[_0xc7b0('0x2b')],qs[_0xc7b0('0x30')](_0x42267e[_0xc7b0('0x2c')][_0xc7b0('0x30')]));_0x81f55d[_0xc7b0('0x2f')]=_0x81f55d[_0xc7b0('0x2f')][_0xc7b0('0x31')]?_0x81f55d[_0xc7b0('0x2f')]:_0x4661bd[_0xc7b0('0x2b')];if(!_0x42267e[_0xc7b0('0x2c')]['hasOwnProperty'](_0xc7b0('0x32'))){_0x81f55d['limit']=qs[_0xc7b0('0x1a')](_0x42267e[_0xc7b0('0x2c')]['limit']);_0x81f55d[_0xc7b0('0x18')]=qs[_0xc7b0('0x18')](_0x42267e['query'][_0xc7b0('0x18')]);}_0x81f55d['order']=qs[_0xc7b0('0x33')](_0x42267e[_0xc7b0('0x2c')][_0xc7b0('0x33')]);_0x81f55d['where']=qs[_0xc7b0('0x2d')](_[_0xc7b0('0x34')](_0x42267e[_0xc7b0('0x2c')],_0x4661bd[_0xc7b0('0x2d')]),_0xe2192b);if(_0x42267e[_0xc7b0('0x2c')][_0xc7b0('0x35')]){_0x81f55d[_0xc7b0('0x36')]=_[_0xc7b0('0x37')](_0x81f55d[_0xc7b0('0x36')],{'$or':_[_0xc7b0('0x26')](_0xe2192b,function(_0x268274){if(_0x268274[_0xc7b0('0x38')]!==_0xc7b0('0x39')){var _0x4a5aa1={};_0x4a5aa1[_0x268274['name']]={'$like':'%'+_0x42267e['query'][_0xc7b0('0x35')]+'%'};return _0x4a5aa1;}})});}_0x81f55d=_[_0xc7b0('0x37')]({},_0x81f55d,_0x42267e[_0xc7b0('0x3a')]);var _0x33daf6={'where':_0x81f55d['where']};return db[_0xc7b0('0x27')][_0xc7b0('0x1b')](_0x33daf6)['then'](function(_0xa05e65){_0x2554af[_0xc7b0('0x1b')]=_0xa05e65;if(_0x42267e[_0xc7b0('0x2c')][_0xc7b0('0x3b')]){_0x81f55d[_0xc7b0('0x3c')]=[{'all':!![]}];}return db[_0xc7b0('0x27')][_0xc7b0('0x3d')](_0x81f55d);})['then'](function(_0x362df2){_0x2554af[_0xc7b0('0x3e')]=_0x362df2;return _0x2554af;})[_0xc7b0('0x1f')](respondWithFilteredResult(_0xe28f58,_0x81f55d))['catch'](handleError(_0xe28f58,null));};exports[_0xc7b0('0x3f')]=function(_0x5007ee,_0x331960){var _0x4e22e3={'raw':!![],'where':{'id':_0x5007ee['params']['id']}},_0x1aaa05={};_0x1aaa05['model']=_[_0xc7b0('0x40')](db['ServicenowField'][_0xc7b0('0x28')]);_0x1aaa05['query']=_[_0xc7b0('0x40')](_0x5007ee[_0xc7b0('0x2c')]);_0x1aaa05[_0xc7b0('0x2d')]=_[_0xc7b0('0x2e')](_0x1aaa05['model'],_0x1aaa05['query']);_0x4e22e3[_0xc7b0('0x2f')]=_[_0xc7b0('0x2e')](_0x1aaa05[_0xc7b0('0x2b')],qs[_0xc7b0('0x30')](_0x5007ee['query'][_0xc7b0('0x30')]));_0x4e22e3[_0xc7b0('0x2f')]=_0x4e22e3[_0xc7b0('0x2f')][_0xc7b0('0x31')]?_0x4e22e3[_0xc7b0('0x2f')]:_0x1aaa05['model'];if(_0x5007ee[_0xc7b0('0x2c')][_0xc7b0('0x3b')]){_0x4e22e3[_0xc7b0('0x3c')]=[{'all':!![]}];}_0x4e22e3=_[_0xc7b0('0x37')]({},_0x4e22e3,_0x5007ee[_0xc7b0('0x3a')]);return db['ServicenowField'][_0xc7b0('0x41')](_0x4e22e3)[_0xc7b0('0x1f')](handleEntityNotFound(_0x331960,null))[_0xc7b0('0x1f')](respondWithResult(_0x331960,null))['catch'](handleError(_0x331960,null));};exports[_0xc7b0('0x42')]=function(_0x40b55a,_0x1ffc33){return db[_0xc7b0('0x27')][_0xc7b0('0x42')](_0x40b55a[_0xc7b0('0x43')],{})[_0xc7b0('0x1f')](respondWithResult(_0x1ffc33,0xc9))[_0xc7b0('0x44')](handleError(_0x1ffc33,null));};exports[_0xc7b0('0x1e')]=function(_0x1bed3a,_0x274e49){if(_0x1bed3a[_0xc7b0('0x43')]['id']){delete _0x1bed3a[_0xc7b0('0x43')]['id'];}return db['ServicenowField'][_0xc7b0('0x41')]({'where':{'id':_0x1bed3a[_0xc7b0('0x45')]['id']}})[_0xc7b0('0x1f')](handleEntityNotFound(_0x274e49,null))[_0xc7b0('0x1f')](saveUpdates(_0x1bed3a[_0xc7b0('0x43')],null))[_0xc7b0('0x1f')](respondWithResult(_0x274e49,null))[_0xc7b0('0x44')](handleError(_0x274e49,null));};exports[_0xc7b0('0x20')]=function(_0x53b420,_0x3b8093){return db[_0xc7b0('0x27')]['find']({'where':{'id':_0x53b420[_0xc7b0('0x45')]['id']}})[_0xc7b0('0x1f')](handleEntityNotFound(_0x3b8093,null))[_0xc7b0('0x1f')](removeEntity(_0x3b8093,null))[_0xc7b0('0x44')](handleError(_0x3b8093,null));}; \ No newline at end of file +var _0xd10c=['json','offset','undefined','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','ServicenowField','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x2d1c6d,_0x27c29b){var _0x208a5a=function(_0x34312f){while(--_0x34312f){_0x2d1c6d['push'](_0x2d1c6d['shift']());}};_0x208a5a(++_0x27c29b);}(_0xd10c,0xbb));var _0xcd10=function(_0x283f2e,_0x2af6da){_0x283f2e=_0x283f2e-0x0;var _0x1cffb6=_0xd10c[_0x283f2e];return _0x1cffb6;};'use strict';var emlformat=require(_0xcd10('0x0'));var rimraf=require(_0xcd10('0x1'));var zipdir=require(_0xcd10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd10('0x3'));var moment=require(_0xcd10('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd10('0x5'));var util=require('util');var path=require(_0xcd10('0x6'));var sox=require(_0xcd10('0x7'));var csv=require(_0xcd10('0x8'));var ejs=require(_0xcd10('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcd10('0xa'));var crypto=require(_0xcd10('0xb'));var jsforce=require(_0xcd10('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcd10('0x8'));var querystring=require(_0xcd10('0xd'));var Papa=require(_0xcd10('0xe'));var Redis=require(_0xcd10('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd10('0x10'));var hardwareService=require(_0xcd10('0x11'));var logger=require('../../config/logger')(_0xcd10('0x12'));var utils=require(_0xcd10('0x13'));var config=require(_0xcd10('0x14'));var licenseUtil=require(_0xcd10('0x15'));var db=require(_0xcd10('0x16'))['db'];function respondWithStatusCode(_0x525722,_0xf45675){_0xf45675=_0xf45675||0xcc;return function(_0x5e0e95){if(_0x5e0e95){return _0x525722[_0xcd10('0x17')](_0xf45675);}return _0x525722[_0xcd10('0x18')](_0xf45675)[_0xcd10('0x19')]();};}function respondWithResult(_0x190cbe,_0x21a7ad){_0x21a7ad=_0x21a7ad||0xc8;return function(_0x51e51f){if(_0x51e51f){return _0x190cbe[_0xcd10('0x18')](_0x21a7ad)[_0xcd10('0x1a')](_0x51e51f);}};}function respondWithFilteredResult(_0x2af3eb,_0x40f22a){return function(_0x5b2a4b){if(_0x5b2a4b){var _0x26615f=typeof _0x40f22a[_0xcd10('0x1b')]===_0xcd10('0x1c')&&typeof _0x40f22a['limit']==='undefined';var _0x49f695=_0x5b2a4b[_0xcd10('0x1d')];var _0xaa07a1=_0x26615f?0x0:_0x40f22a[_0xcd10('0x1b')];var _0x48d260=_0x26615f?_0x5b2a4b[_0xcd10('0x1d')]:_0x40f22a[_0xcd10('0x1b')]+_0x40f22a['limit'];var _0x111db0;if(_0x48d260>=_0x49f695){_0x48d260=_0x49f695;_0x111db0=0xc8;}else{_0x111db0=0xce;}_0x2af3eb[_0xcd10('0x18')](_0x111db0);return _0x2af3eb['set']('Content-Range',_0xaa07a1+'-'+_0x48d260+'/'+_0x49f695)[_0xcd10('0x1a')](_0x5b2a4b);}return null;};}function patchUpdates(_0x1b4232){return function(_0xc26bc9){try{jsonpatch[_0xcd10('0x1e')](_0xc26bc9,_0x1b4232,!![]);}catch(_0x53fa83){return BPromise[_0xcd10('0x1f')](_0x53fa83);}return _0xc26bc9[_0xcd10('0x20')]();};}function saveUpdates(_0x3d9011,_0x1d00a6){return function(_0x5b6830){if(_0x5b6830){return _0x5b6830[_0xcd10('0x21')](_0x3d9011)[_0xcd10('0x22')](function(_0x21a2b6){return _0x21a2b6;});}return null;};}function removeEntity(_0xd05e68,_0x340adc){return function(_0x1b5777){if(_0x1b5777){return _0x1b5777[_0xcd10('0x23')]()[_0xcd10('0x22')](function(){_0xd05e68['status'](0xcc)[_0xcd10('0x19')]();});}};}function handleEntityNotFound(_0x1d64e2,_0xe150a9){return function(_0x2183f0){if(!_0x2183f0){_0x1d64e2['sendStatus'](0x194);}return _0x2183f0;};}function handleError(_0x42fbeb,_0x1258fc){_0x1258fc=_0x1258fc||0x1f4;return function(_0x1acc0a){logger[_0xcd10('0x24')](_0x1acc0a[_0xcd10('0x25')]);if(_0x1acc0a[_0xcd10('0x26')]){delete _0x1acc0a['name'];}_0x42fbeb[_0xcd10('0x18')](_0x1258fc)[_0xcd10('0x27')](_0x1acc0a);};}exports[_0xcd10('0x28')]=function(_0x31bbba,_0x46bda7){var _0x1d6090={},_0x9c9053={},_0x368204={'count':0x0,'rows':[]};var _0x2b522d=_['map'](db['ServicenowField'][_0xcd10('0x29')],function(_0x29dc74){return{'name':_0x29dc74[_0xcd10('0x2a')],'type':_0x29dc74[_0xcd10('0x2b')][_0xcd10('0x2c')]};});_0x9c9053[_0xcd10('0x2d')]=_[_0xcd10('0x2e')](_0x2b522d,_0xcd10('0x26'));_0x9c9053[_0xcd10('0x2f')]=_[_0xcd10('0x30')](_0x31bbba['query']);_0x9c9053[_0xcd10('0x31')]=_[_0xcd10('0x32')](_0x9c9053[_0xcd10('0x2d')],_0x9c9053[_0xcd10('0x2f')]);_0x1d6090[_0xcd10('0x33')]=_[_0xcd10('0x32')](_0x9c9053[_0xcd10('0x2d')],qs[_0xcd10('0x34')](_0x31bbba['query'][_0xcd10('0x34')]));_0x1d6090['attributes']=_0x1d6090[_0xcd10('0x33')][_0xcd10('0x35')]?_0x1d6090[_0xcd10('0x33')]:_0x9c9053[_0xcd10('0x2d')];if(!_0x31bbba[_0xcd10('0x2f')][_0xcd10('0x36')]('nolimit')){_0x1d6090[_0xcd10('0x37')]=qs[_0xcd10('0x37')](_0x31bbba[_0xcd10('0x2f')][_0xcd10('0x37')]);_0x1d6090[_0xcd10('0x1b')]=qs[_0xcd10('0x1b')](_0x31bbba[_0xcd10('0x2f')]['offset']);}_0x1d6090['order']=qs[_0xcd10('0x38')](_0x31bbba['query'][_0xcd10('0x38')]);_0x1d6090[_0xcd10('0x39')]=qs['filters'](_['pick'](_0x31bbba['query'],_0x9c9053[_0xcd10('0x31')]),_0x2b522d);if(_0x31bbba['query'][_0xcd10('0x3a')]){_0x1d6090[_0xcd10('0x39')]=_[_0xcd10('0x3b')](_0x1d6090[_0xcd10('0x39')],{'$or':_['map'](_0x2b522d,function(_0x43519d){if(_0x43519d[_0xcd10('0x2b')]!==_0xcd10('0x3c')){var _0x100c92={};_0x100c92[_0x43519d[_0xcd10('0x26')]]={'$like':'%'+_0x31bbba['query'][_0xcd10('0x3a')]+'%'};return _0x100c92;}})});}_0x1d6090=_[_0xcd10('0x3b')]({},_0x1d6090,_0x31bbba[_0xcd10('0x3d')]);var _0x6fe6fa={'where':_0x1d6090[_0xcd10('0x39')]};return db['ServicenowField'][_0xcd10('0x1d')](_0x6fe6fa)[_0xcd10('0x22')](function(_0x3ae8b1){_0x368204[_0xcd10('0x1d')]=_0x3ae8b1;if(_0x31bbba[_0xcd10('0x2f')][_0xcd10('0x3e')]){_0x1d6090[_0xcd10('0x3f')]=[{'all':!![]}];}return db[_0xcd10('0x40')]['findAll'](_0x1d6090);})[_0xcd10('0x22')](function(_0x85c3c4){_0x368204['rows']=_0x85c3c4;return _0x368204;})[_0xcd10('0x22')](respondWithFilteredResult(_0x46bda7,_0x1d6090))[_0xcd10('0x41')](handleError(_0x46bda7,null));};exports[_0xcd10('0x42')]=function(_0x50f30a,_0x4bab9d){var _0x7201e6={'raw':!![],'where':{'id':_0x50f30a[_0xcd10('0x43')]['id']}},_0x418d7d={};_0x418d7d[_0xcd10('0x2d')]=_['keys'](db['ServicenowField'][_0xcd10('0x29')]);_0x418d7d[_0xcd10('0x2f')]=_['keys'](_0x50f30a[_0xcd10('0x2f')]);_0x418d7d[_0xcd10('0x31')]=_[_0xcd10('0x32')](_0x418d7d[_0xcd10('0x2d')],_0x418d7d[_0xcd10('0x2f')]);_0x7201e6[_0xcd10('0x33')]=_['intersection'](_0x418d7d[_0xcd10('0x2d')],qs[_0xcd10('0x34')](_0x50f30a['query']['fields']));_0x7201e6[_0xcd10('0x33')]=_0x7201e6[_0xcd10('0x33')][_0xcd10('0x35')]?_0x7201e6[_0xcd10('0x33')]:_0x418d7d[_0xcd10('0x2d')];if(_0x50f30a['query']['includeAll']){_0x7201e6[_0xcd10('0x3f')]=[{'all':!![]}];}_0x7201e6=_[_0xcd10('0x3b')]({},_0x7201e6,_0x50f30a[_0xcd10('0x3d')]);return db[_0xcd10('0x40')][_0xcd10('0x44')](_0x7201e6)[_0xcd10('0x22')](handleEntityNotFound(_0x4bab9d,null))[_0xcd10('0x22')](respondWithResult(_0x4bab9d,null))[_0xcd10('0x41')](handleError(_0x4bab9d,null));};exports[_0xcd10('0x45')]=function(_0x32ecb8,_0x114c67){return db[_0xcd10('0x40')][_0xcd10('0x45')](_0x32ecb8['body'],{})['then'](respondWithResult(_0x114c67,0xc9))[_0xcd10('0x41')](handleError(_0x114c67,null));};exports['update']=function(_0x2e2816,_0x4f5cc2){if(_0x2e2816[_0xcd10('0x46')]['id']){delete _0x2e2816[_0xcd10('0x46')]['id'];}return db[_0xcd10('0x40')]['find']({'where':{'id':_0x2e2816[_0xcd10('0x43')]['id']}})[_0xcd10('0x22')](handleEntityNotFound(_0x4f5cc2,null))[_0xcd10('0x22')](saveUpdates(_0x2e2816['body'],null))[_0xcd10('0x22')](respondWithResult(_0x4f5cc2,null))[_0xcd10('0x41')](handleError(_0x4f5cc2,null));};exports[_0xcd10('0x23')]=function(_0x2a6c4a,_0x2c6d3a){return db[_0xcd10('0x40')]['find']({'where':{'id':_0x2a6c4a[_0xcd10('0x43')]['id']}})[_0xcd10('0x22')](handleEntityNotFound(_0x2c6d3a,null))[_0xcd10('0x22')](removeEntity(_0x2c6d3a,null))[_0xcd10('0x41')](handleError(_0x2c6d3a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 453c3fb..b48da56 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 _0xceb9=['define','servicenow_unique_index','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x220c7e,_0x41de2b){var _0xb56e6a=function(_0xcf9303){while(--_0xcf9303){_0x220c7e['push'](_0x220c7e['shift']());}};_0xb56e6a(++_0x41de2b);}(_0xceb9,0x144));var _0x9ceb=function(_0x5c0211,_0x373f42){_0x5c0211=_0x5c0211-0x0;var _0x70d7a6=_0xceb9[_0x5c0211];return _0x70d7a6;};'use strict';var _=require(_0x9ceb('0x0'));var util=require(_0x9ceb('0x1'));var logger=require(_0x9ceb('0x2'))(_0x9ceb('0x3'));var moment=require(_0x9ceb('0x4'));var BPromise=require(_0x9ceb('0x5'));var rp=require(_0x9ceb('0x6'));var fs=require('fs');var path=require(_0x9ceb('0x7'));var rimraf=require(_0x9ceb('0x8'));var config=require(_0x9ceb('0x9'));var attributes=require(_0x9ceb('0xa'));module[_0x9ceb('0xb')]=function(_0x2c5fa4,_0x3ff258){return _0x2c5fa4[_0x9ceb('0xc')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x9ceb('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc64b=['moment','bluebird','request-promise','../../config/environment','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x538d43,_0x25d8b7){var _0x3bd30d=function(_0x147b70){while(--_0x147b70){_0x538d43['push'](_0x538d43['shift']());}};_0x3bd30d(++_0x25d8b7);}(_0xc64b,0x7e));var _0xbc64=function(_0x1475dc,_0x9fb023){_0x1475dc=_0x1475dc-0x0;var _0x19c5a9=_0xc64b[_0x1475dc];return _0x19c5a9;};'use strict';var _=require(_0xbc64('0x0'));var util=require(_0xbc64('0x1'));var logger=require(_0xbc64('0x2'))(_0xbc64('0x3'));var moment=require(_0xbc64('0x4'));var BPromise=require(_0xbc64('0x5'));var rp=require(_0xbc64('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbc64('0x7'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x2cd192,_0xb9494d){return _0x2cd192[_0xbc64('0x8')]('ServicenowField',attributes,{'tableName':_0xbc64('0x9'),'paranoid':![],'indexes':[{'name':_0xbc64('0xa'),'fields':[_0xbc64('0xb'),_0xbc64('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 3a4d5bc..aa22757 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2e3dd1,_0x49e26a){var _0x53c44a=function(_0x1c29a7){while(--_0x1c29a7){_0x2e3dd1['push'](_0x2e3dd1['shift']());}};_0x53c44a(++_0x49e26a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3cd31f,_0x524bd2){_0x3cd31f=_0x3cd31f-0x0;var _0x3649e5=_0xb43b[_0x3cd31f];return _0x3649e5;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x342108,_0x26eb56){var _0x3c8ad1=function(_0x8fbac1){while(--_0x8fbac1){_0x342108['push'](_0x342108['shift']());}};_0x3c8ad1(++_0x26eb56);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1c625f,_0x1357a8){_0x1c625f=_0x1c625f-0x0;var _0x5f4516=_0xb43b[_0x1c625f];return _0x5f4516;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 79bc9d1..6d5cb1a 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5a51c1,_0x394c67){var _0x38f5fb=function(_0xa5d3d0){while(--_0xa5d3d0){_0x5a51c1['push'](_0x5a51c1['shift']());}};_0x38f5fb(++_0x394c67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5dfaf0,_0x1343f8){var _0x882be6=function(_0x53f538){while(--_0x53f538){_0x5dfaf0['push'](_0x5dfaf0['shift']());}};_0x882be6(++_0x1343f8);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 b624de6..3eb3790 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(_0x4c1174,_0x57eecf){var _0x3a67d0=function(_0x3d3721){while(--_0x3d3721){_0x4c1174['push'](_0x4c1174['shift']());}};_0x3a67d0(++_0x57eecf);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x5617b6,_0x90f6f8){var _0x28ebc2=function(_0x522b09){while(--_0x522b09){_0x5617b6['push'](_0x5617b6['shift']());}};_0x28ebc2(++_0x90f6f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 0b8693e..25bcb1d 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 _0x758f=['lastIndexOf','POST','format','%s%s','login','JSON','stringify','username','password','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','includes','label','endsWith','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','name','index','map','SugarcrmAccount','fieldName','type','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','intersection','find','create','body','params','getConfigurations','SugarcrmConfiguration','filter','findOne','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','duration_hours','parent_type','parent_name','direction','remoteUri','slice','substring'];(function(_0x3459ac,_0x355b64){var _0x302dbd=function(_0x2269aa){while(--_0x2269aa){_0x3459ac['push'](_0x3459ac['shift']());}};_0x302dbd(++_0x355b64);}(_0x758f,0x178));var _0xf758=function(_0x1e182d,_0x4f35c2){_0x1e182d=_0x1e182d-0x0;var _0x5627c6=_0x758f[_0x1e182d];return _0x5627c6;};'use strict';var emlformat=require(_0xf758('0x0'));var rimraf=require(_0xf758('0x1'));var zipdir=require(_0xf758('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf758('0x3'));var moment=require(_0xf758('0x4'));var BPromise=require(_0xf758('0x5'));var Mustache=require(_0xf758('0x6'));var util=require(_0xf758('0x7'));var path=require('path');var sox=require(_0xf758('0x8'));var csv=require(_0xf758('0x9'));var ejs=require(_0xf758('0xa'));var fs=require('fs');var fs_extra=require(_0xf758('0xb'));var _=require('lodash');var squel=require(_0xf758('0xc'));var crypto=require(_0xf758('0xd'));var jsforce=require(_0xf758('0xe'));var deskjs=require(_0xf758('0xf'));var toCsv=require(_0xf758('0x9'));var querystring=require(_0xf758('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf758('0x11'));var qs=require(_0xf758('0x12'));var as=require(_0xf758('0x13'));var hardwareService=require(_0xf758('0x14'));var logger=require('../../config/logger')(_0xf758('0x15'));var utils=require(_0xf758('0x16'));var config=require(_0xf758('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf758('0x18'))['db'];var integrations=require(_0xf758('0x19'));function respondWithStatusCode(_0x48f39f,_0x7d81ef){_0x7d81ef=_0x7d81ef||0xcc;return function(_0x229654){if(_0x229654){return _0x48f39f[_0xf758('0x1a')](_0x7d81ef);}return _0x48f39f[_0xf758('0x1b')](_0x7d81ef)[_0xf758('0x1c')]();};}function respondWithResult(_0xa3b1f9,_0xa8838){_0xa8838=_0xa8838||0xc8;return function(_0x2b0ab1){if(_0x2b0ab1){return _0xa3b1f9[_0xf758('0x1b')](_0xa8838)[_0xf758('0x1d')](_0x2b0ab1);}};}function respondWithFilteredResult(_0x40f07a,_0x253a68){return function(_0x329dd4){if(_0x329dd4){var _0x1f9114=typeof _0x253a68[_0xf758('0x1e')]===_0xf758('0x1f')&&typeof _0x253a68[_0xf758('0x20')]==='undefined';var _0x14251f=_0x329dd4[_0xf758('0x21')];var _0x57b3dc=_0x1f9114?0x0:_0x253a68[_0xf758('0x1e')];var _0x2eeef3=_0x1f9114?_0x329dd4[_0xf758('0x21')]:_0x253a68[_0xf758('0x1e')]+_0x253a68['limit'];var _0x1b3d86;if(_0x2eeef3>=_0x14251f){_0x2eeef3=_0x14251f;_0x1b3d86=0xc8;}else{_0x1b3d86=0xce;}_0x40f07a['status'](_0x1b3d86);return _0x40f07a['set']('Content-Range',_0x57b3dc+'-'+_0x2eeef3+'/'+_0x14251f)[_0xf758('0x1d')](_0x329dd4);}return null;};}function patchUpdates(_0x11ee8b){return function(_0xaded8d){try{jsonpatch[_0xf758('0x22')](_0xaded8d,_0x11ee8b,!![]);}catch(_0x6a1b12){return BPromise[_0xf758('0x23')](_0x6a1b12);}return _0xaded8d[_0xf758('0x24')]();};}function saveUpdates(_0x1d98cd,_0x83c403){return function(_0x1798e3){if(_0x1798e3){return _0x1798e3[_0xf758('0x25')](_0x1d98cd)['then'](function(_0x589a28){return _0x589a28;});}return null;};}function removeEntity(_0x2e66d3,_0x331981){return function(_0x318a5b){if(_0x318a5b){return _0x318a5b[_0xf758('0x26')]()[_0xf758('0x27')](function(){_0x2e66d3[_0xf758('0x1b')](0xcc)[_0xf758('0x1c')]();});}};}function handleEntityNotFound(_0x3b49f1,_0x2596a1){return function(_0x39ebe1){if(!_0x39ebe1){_0x3b49f1[_0xf758('0x1a')](0x194);}return _0x39ebe1;};}function handleError(_0x3c7278,_0x2fe9fa){_0x2fe9fa=_0x2fe9fa||0x1f4;return function(_0x2f79c6){logger['error'](_0x2f79c6['stack']);if(_0x2f79c6['name']){delete _0x2f79c6[_0xf758('0x28')];}_0x3c7278[_0xf758('0x1b')](_0x2fe9fa)['send'](_0x2f79c6);};}exports[_0xf758('0x29')]=function(_0x2df8b9,_0x14cbd4){var _0x577b82={},_0x19e96a={},_0x38b9c3={'count':0x0,'rows':[]};var _0x42596b=_[_0xf758('0x2a')](db[_0xf758('0x2b')]['rawAttributes'],function(_0x366165){return{'name':_0x366165[_0xf758('0x2c')],'type':_0x366165[_0xf758('0x2d')]['key']};});_0x19e96a[_0xf758('0x2e')]=_[_0xf758('0x2a')](_0x42596b,'name');_0x19e96a[_0xf758('0x2f')]=_[_0xf758('0x30')](_0x2df8b9[_0xf758('0x2f')]);_0x19e96a['filters']=_['intersection'](_0x19e96a[_0xf758('0x2e')],_0x19e96a[_0xf758('0x2f')]);_0x577b82['attributes']=_['intersection'](_0x19e96a[_0xf758('0x2e')],qs['fields'](_0x2df8b9[_0xf758('0x2f')][_0xf758('0x31')]));_0x577b82['attributes']=_0x577b82[_0xf758('0x32')][_0xf758('0x33')]?_0x577b82['attributes']:_0x19e96a['model'];if(!_0x2df8b9[_0xf758('0x2f')][_0xf758('0x34')](_0xf758('0x35'))){_0x577b82['limit']=qs['limit'](_0x2df8b9[_0xf758('0x2f')]['limit']);_0x577b82[_0xf758('0x1e')]=qs[_0xf758('0x1e')](_0x2df8b9[_0xf758('0x2f')][_0xf758('0x1e')]);}_0x577b82[_0xf758('0x36')]=qs['sort'](_0x2df8b9['query'][_0xf758('0x37')]);_0x577b82[_0xf758('0x38')]=qs[_0xf758('0x39')](_[_0xf758('0x3a')](_0x2df8b9[_0xf758('0x2f')],_0x19e96a[_0xf758('0x39')]),_0x42596b);if(_0x2df8b9[_0xf758('0x2f')]['filter']){_0x577b82['where']=_[_0xf758('0x3b')](_0x577b82[_0xf758('0x38')],{'$or':_[_0xf758('0x2a')](_0x42596b,function(_0x490be9){if(_0x490be9[_0xf758('0x2d')]!==_0xf758('0x3c')){var _0x488793={};_0x488793[_0x490be9[_0xf758('0x28')]]={'$like':'%'+_0x2df8b9['query']['filter']+'%'};return _0x488793;}})});}_0x577b82=_[_0xf758('0x3b')]({},_0x577b82,_0x2df8b9[_0xf758('0x3d')]);var _0x3b41a3={'where':_0x577b82[_0xf758('0x38')]};return db[_0xf758('0x2b')][_0xf758('0x21')](_0x3b41a3)[_0xf758('0x27')](function(_0xe66ed1){_0x38b9c3['count']=_0xe66ed1;if(_0x2df8b9[_0xf758('0x2f')][_0xf758('0x3e')]){_0x577b82[_0xf758('0x3f')]=[{'all':!![]}];}return db[_0xf758('0x2b')]['findAll'](_0x577b82);})[_0xf758('0x27')](function(_0x4df8bc){_0x38b9c3[_0xf758('0x40')]=_0x4df8bc;return _0x38b9c3;})[_0xf758('0x27')](respondWithFilteredResult(_0x14cbd4,_0x577b82))[_0xf758('0x41')](handleError(_0x14cbd4,null));};exports[_0xf758('0x42')]=function(_0x7c580a,_0x3c50b7){var _0x3737dc={'raw':![],'where':{'id':_0x7c580a['params']['id']}},_0x4af666={};_0x4af666['model']=_[_0xf758('0x30')](db['SugarcrmAccount'][_0xf758('0x43')]);_0x4af666['query']=_[_0xf758('0x30')](_0x7c580a['query']);_0x4af666[_0xf758('0x39')]=_[_0xf758('0x44')](_0x4af666[_0xf758('0x2e')],_0x4af666[_0xf758('0x2f')]);_0x3737dc[_0xf758('0x32')]=_[_0xf758('0x44')](_0x4af666[_0xf758('0x2e')],qs[_0xf758('0x31')](_0x7c580a[_0xf758('0x2f')]['fields']));_0x3737dc[_0xf758('0x32')]=_0x3737dc[_0xf758('0x32')][_0xf758('0x33')]?_0x3737dc['attributes']:_0x4af666[_0xf758('0x2e')];if(_0x7c580a[_0xf758('0x2f')][_0xf758('0x3e')]){_0x3737dc[_0xf758('0x3f')]=[{'all':!![]}];}_0x3737dc=_[_0xf758('0x3b')]({},_0x3737dc,_0x7c580a[_0xf758('0x3d')]);return db[_0xf758('0x2b')][_0xf758('0x45')](_0x3737dc)[_0xf758('0x27')](handleEntityNotFound(_0x3c50b7,null))[_0xf758('0x27')](respondWithResult(_0x3c50b7,null))[_0xf758('0x41')](handleError(_0x3c50b7,null));};exports[_0xf758('0x46')]=function(_0x576fce,_0x5bdb80){return db[_0xf758('0x2b')][_0xf758('0x46')](_0x576fce[_0xf758('0x47')],{})['then'](respondWithResult(_0x5bdb80,0xc9))[_0xf758('0x41')](handleError(_0x5bdb80,null));};exports[_0xf758('0x25')]=function(_0x3de3e9,_0x59105e){if(_0x3de3e9['body']['id']){delete _0x3de3e9[_0xf758('0x47')]['id'];}return db['SugarcrmAccount'][_0xf758('0x45')]({'where':{'id':_0x3de3e9[_0xf758('0x48')]['id']}})[_0xf758('0x27')](handleEntityNotFound(_0x59105e,null))[_0xf758('0x27')](saveUpdates(_0x3de3e9[_0xf758('0x47')],null))[_0xf758('0x27')](respondWithResult(_0x59105e,null))[_0xf758('0x41')](handleError(_0x59105e,null));};exports[_0xf758('0x26')]=function(_0x190e42,_0x5a9490){return db[_0xf758('0x2b')][_0xf758('0x45')]({'where':{'id':_0x190e42['params']['id']}})[_0xf758('0x27')](handleEntityNotFound(_0x5a9490,null))[_0xf758('0x27')](removeEntity(_0x5a9490,null))[_0xf758('0x41')](handleError(_0x5a9490,null));};exports[_0xf758('0x49')]=function(_0x5e5ba2,_0x347227,_0x3cdc91){var _0x10c949={};var _0x57d68c={};var _0x6d5f5f;var _0x187b78;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x5e5ba2[_0xf758('0x48')]['id']}})[_0xf758('0x27')](handleEntityNotFound(_0x347227,null))[_0xf758('0x27')](function(_0x3e1716){if(_0x3e1716){_0x6d5f5f=_0x3e1716;_0x57d68c[_0xf758('0x2e')]=_['keys'](db[_0xf758('0x4a')][_0xf758('0x43')]);_0x57d68c['query']=_[_0xf758('0x30')](_0x5e5ba2[_0xf758('0x2f')]);_0x57d68c[_0xf758('0x39')]=_[_0xf758('0x44')](_0x57d68c[_0xf758('0x2e')],_0x57d68c[_0xf758('0x2f')]);_0x10c949[_0xf758('0x32')]=_[_0xf758('0x44')](_0x57d68c[_0xf758('0x2e')],qs[_0xf758('0x31')](_0x5e5ba2[_0xf758('0x2f')][_0xf758('0x31')]));_0x10c949[_0xf758('0x32')]=_0x10c949[_0xf758('0x32')][_0xf758('0x33')]?_0x10c949[_0xf758('0x32')]:_0x57d68c[_0xf758('0x2e')];_0x10c949[_0xf758('0x36')]=qs[_0xf758('0x37')](_0x5e5ba2[_0xf758('0x2f')]['sort']);_0x10c949[_0xf758('0x38')]=qs[_0xf758('0x39')](_[_0xf758('0x3a')](_0x5e5ba2[_0xf758('0x2f')],_0x57d68c[_0xf758('0x39')]));if(_0x5e5ba2[_0xf758('0x2f')]['filter']){_0x10c949['where']=_['merge'](_0x10c949[_0xf758('0x38')],{'$or':_[_0xf758('0x2a')](_0x10c949[_0xf758('0x32')],function(_0x2909c3){var _0x327983={};_0x327983[_0x2909c3]={'$like':'%'+_0x5e5ba2[_0xf758('0x2f')][_0xf758('0x4b')]+'%'};return _0x327983;})});}_0x10c949=_['merge']({},_0x10c949,_0x5e5ba2[_0xf758('0x3d')]);return _0x6d5f5f[_0xf758('0x49')](_0x10c949);}})['then'](function(_0x2ef777){if(_0x2ef777){_0x187b78=_0x2ef777['length'];if(!_0x5e5ba2[_0xf758('0x2f')][_0xf758('0x34')](_0xf758('0x35'))){_0x10c949[_0xf758('0x20')]=qs['limit'](_0x5e5ba2[_0xf758('0x2f')][_0xf758('0x20')]);_0x10c949[_0xf758('0x1e')]=qs[_0xf758('0x1e')](_0x5e5ba2['query']['offset']);}return _0x6d5f5f[_0xf758('0x49')](_0x10c949);}})[_0xf758('0x27')](function(_0x2f1578){if(_0x2f1578){return _0x2f1578?{'count':_0x187b78,'rows':_0x2f1578}:null;}})['then'](respondWithResult(_0x347227,null))[_0xf758('0x41')](handleError(_0x347227,null));};exports['addConfiguration']=function(_0x1d2ebe,_0x23b589,_0x10b241){if(_0x1d2ebe[_0xf758('0x47')]['id']){delete _0x1d2ebe[_0xf758('0x47')]['id'];}return db[_0xf758('0x2b')][_0xf758('0x4c')]({'where':{'id':_0x1d2ebe['params']['id']}})[_0xf758('0x27')](handleEntityNotFound(_0x23b589,null))['then'](function(_0x2b9548){if(_0x2b9548){_0x1d2ebe[_0xf758('0x47')]['AccountId']=_0x2b9548['id'];_0x1d2ebe[_0xf758('0x47')][_0xf758('0x4d')]=integrations['getSubjects'](_0x1d2ebe['body'][_0xf758('0x4e')],_0x1d2ebe[_0xf758('0x47')]['type']);_0x1d2ebe[_0xf758('0x47')][_0xf758('0x4f')]=integrations[_0xf758('0x50')](_0x1d2ebe[_0xf758('0x47')][_0xf758('0x4e')],_0x1d2ebe[_0xf758('0x47')][_0xf758('0x2d')]);return db[_0xf758('0x4a')][_0xf758('0x46')](_0x1d2ebe[_0xf758('0x47')],{'include':[{'model':db['SugarcrmField'],'as':_0xf758('0x4d')},{'model':db[_0xf758('0x51')],'as':_0xf758('0x4f')}]});}return null;})['then'](respondWithResult(_0x23b589,null))['catch'](handleError(_0x23b589,null));};exports['getFields']=function(_0x140837,_0x4dffb2,_0x3a6ce7){var _0x11fa9d='';var _0x3466d4=['id',_0xf758('0x28'),_0xf758('0x52'),_0xf758('0x53'),_0xf758('0x54'),'date_start',_0xf758('0x55'),'duration_minutes','parent_id',_0xf758('0x56'),_0xf758('0x57'),_0xf758('0x58')];return db[_0xf758('0x2b')]['findOne']({'where':{'id':_0x140837[_0xf758('0x48')]['id']},'attributes':['id','username','password','remoteUri']})[_0xf758('0x27')](handleEntityNotFound(_0x4dffb2,null))[_0xf758('0x27')](function(_0x20e1f3){if(_0x20e1f3){_0x11fa9d=_0x20e1f3[_0xf758('0x59')];var _0x2b80df=_0x11fa9d[_0xf758('0x5a')](-0x1);if(_0x2b80df==='/'){_0x11fa9d=_0x11fa9d[_0xf758('0x5b')](0x0,_0x11fa9d[_0xf758('0x5c')](_0x2b80df));}return rp({'method':_0xf758('0x5d'),'uri':util[_0xf758('0x5e')](_0xf758('0x5f'),_0x11fa9d,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xf758('0x60'),'input_type':_0xf758('0x61'),'response_type':_0xf758('0x61'),'rest_data':JSON[_0xf758('0x62')]({'user_auth':{'user_name':_0x20e1f3[_0xf758('0x63')],'password':_0x20e1f3[_0xf758('0x64')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xf758('0x27')](function(_0x4834ba){if(_0x4834ba&&_0x4834ba[_0xf758('0x28')]!==_0xf758('0x65')&&_0x4834ba[_0xf758('0x28')]!==_0xf758('0x66')){return rp({'method':_0xf758('0x5d'),'uri':util[_0xf758('0x5e')](_0xf758('0x5f'),_0x11fa9d,_0xf758('0x67')),'json':!![],'form':{'method':_0xf758('0x68'),'input_type':_0xf758('0x61'),'response_type':_0xf758('0x61'),'rest_data':JSON[_0xf758('0x62')]({'session':_0x4834ba['id'],'module_name':'Calls'})}})[_0xf758('0x27')](function(_0x1a36b8){if(_0x1a36b8){var _0x55fd81=_[_0xf758('0x69')](_0x1a36b8[_0xf758('0x6a')]);_[_0xf758('0x6b')](_0x55fd81,function(_0x500fdc){return _0x3466d4[_0xf758('0x6c')](_0x500fdc['name']);});return{'count':_0x55fd81[_0xf758('0x33')],'rows':_[_0xf758('0x2a')](_0x55fd81,function(_0x2def3b){return{'id':_0x2def3b[_0xf758('0x28')],'name':_0x2def3b[_0xf758('0x6d')],'custom':_[_0xf758('0x6e')](_0x2def3b[_0xf758('0x28')],'_c')?!![]:![],'options':_0x2def3b[_0xf758('0x3d')]?_[_0xf758('0x2a')](_[_0xf758('0x69')](_0x2def3b[_0xf758('0x3d')]),function(_0x49283e){return{'name':_0x49283e['value'],'value':_0x49283e['name']};}):[]};})};}})[_0xf758('0x27')](respondWithResult(_0x4dffb2,null))[_0xf758('0x41')](function(_0x5bf4f2){var _0x68c6a=_0x140837[_0xf758('0x2f')]['test']?0x1f4:_0x5bf4f2[_0xf758('0x6f')]||0x1f4;logger['error'](_0xf758('0x70'),_0xf758('0x71'),_0x68c6a,JSON[_0xf758('0x62')](_0x5bf4f2));delete _0x5bf4f2[_0xf758('0x28')];if(_0x68c6a===0x191){_0x68c6a=0x190;}_0x4dffb2[_0xf758('0x1b')](_0x68c6a)[_0xf758('0x72')](_0x140837[_0xf758('0x2f')][_0xf758('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x5bf4f2[_0xf758('0x6f')]}:_0x5bf4f2);});}else{var _0x7017e0=0x1f4;_0x4dffb2[_0xf758('0x1b')](_0x7017e0)[_0xf758('0x72')]({'message':_0xf758('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x4bd0=['fieldName','key','keys','intersection','query','attributes','model','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','length','include','find','create','body','getConfigurations','order','options','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','POST','stringify','values','module_fields','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes'];(function(_0x24e64a,_0x22af59){var _0x3827d2=function(_0x50f599){while(--_0x50f599){_0x24e64a['push'](_0x24e64a['shift']());}};_0x3827d2(++_0x22af59);}(_0x4bd0,0x12a));var _0x04bd=function(_0x54bb5e,_0xc9513a){_0x54bb5e=_0x54bb5e-0x0;var _0x2cfe75=_0x4bd0[_0x54bb5e];return _0x2cfe75;};'use strict';var emlformat=require(_0x04bd('0x0'));var rimraf=require(_0x04bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04bd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x04bd('0x3'));var Mustache=require(_0x04bd('0x4'));var util=require(_0x04bd('0x5'));var path=require(_0x04bd('0x6'));var sox=require(_0x04bd('0x7'));var csv=require(_0x04bd('0x8'));var ejs=require(_0x04bd('0x9'));var fs=require('fs');var fs_extra=require(_0x04bd('0xa'));var _=require(_0x04bd('0xb'));var squel=require(_0x04bd('0xc'));var crypto=require(_0x04bd('0xd'));var jsforce=require(_0x04bd('0xe'));var deskjs=require(_0x04bd('0xf'));var toCsv=require(_0x04bd('0x8'));var querystring=require('querystring');var Papa=require(_0x04bd('0x10'));var Redis=require(_0x04bd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x04bd('0x12'));var as=require(_0x04bd('0x13'));var hardwareService=require(_0x04bd('0x14'));var logger=require('../../config/logger')(_0x04bd('0x15'));var utils=require(_0x04bd('0x16'));var config=require(_0x04bd('0x17'));var licenseUtil=require(_0x04bd('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x04bd('0x19'));function respondWithStatusCode(_0x29b6f1,_0x1f7700){_0x1f7700=_0x1f7700||0xcc;return function(_0x1dae4d){if(_0x1dae4d){return _0x29b6f1[_0x04bd('0x1a')](_0x1f7700);}return _0x29b6f1['status'](_0x1f7700)[_0x04bd('0x1b')]();};}function respondWithResult(_0x5e84b6,_0x3b71cf){_0x3b71cf=_0x3b71cf||0xc8;return function(_0x383fe9){if(_0x383fe9){return _0x5e84b6[_0x04bd('0x1c')](_0x3b71cf)[_0x04bd('0x1d')](_0x383fe9);}};}function respondWithFilteredResult(_0x4e3082,_0x29c428){return function(_0x55a36a){if(_0x55a36a){var _0x372455=typeof _0x29c428['offset']===_0x04bd('0x1e')&&typeof _0x29c428['limit']===_0x04bd('0x1e');var _0xbb0191=_0x55a36a[_0x04bd('0x1f')];var _0x171803=_0x372455?0x0:_0x29c428[_0x04bd('0x20')];var _0x2c18e9=_0x372455?_0x55a36a[_0x04bd('0x1f')]:_0x29c428[_0x04bd('0x20')]+_0x29c428[_0x04bd('0x21')];var _0x254d69;if(_0x2c18e9>=_0xbb0191){_0x2c18e9=_0xbb0191;_0x254d69=0xc8;}else{_0x254d69=0xce;}_0x4e3082['status'](_0x254d69);return _0x4e3082[_0x04bd('0x22')](_0x04bd('0x23'),_0x171803+'-'+_0x2c18e9+'/'+_0xbb0191)[_0x04bd('0x1d')](_0x55a36a);}return null;};}function patchUpdates(_0x59fe7e){return function(_0x2a7eff){try{jsonpatch[_0x04bd('0x24')](_0x2a7eff,_0x59fe7e,!![]);}catch(_0x5c30dc){return BPromise[_0x04bd('0x25')](_0x5c30dc);}return _0x2a7eff[_0x04bd('0x26')]();};}function saveUpdates(_0x4b5397,_0x20fe9a){return function(_0x173e39){if(_0x173e39){return _0x173e39[_0x04bd('0x27')](_0x4b5397)[_0x04bd('0x28')](function(_0x352040){return _0x352040;});}return null;};}function removeEntity(_0x1a0c00,_0x1865c8){return function(_0x5e381e){if(_0x5e381e){return _0x5e381e[_0x04bd('0x29')]()['then'](function(){_0x1a0c00[_0x04bd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2207f0,_0x4b2b05){return function(_0x47536b){if(!_0x47536b){_0x2207f0['sendStatus'](0x194);}return _0x47536b;};}function handleError(_0x84cce0,_0x2cb637){_0x2cb637=_0x2cb637||0x1f4;return function(_0xc96236){logger[_0x04bd('0x2a')](_0xc96236[_0x04bd('0x2b')]);if(_0xc96236['name']){delete _0xc96236[_0x04bd('0x2c')];}_0x84cce0['status'](_0x2cb637)[_0x04bd('0x2d')](_0xc96236);};}exports[_0x04bd('0x2e')]=function(_0x1927a8,_0xcd7aec){var _0x1f2134={},_0x437c16={},_0x4a0f1f={'count':0x0,'rows':[]};var _0x325581=_[_0x04bd('0x2f')](db[_0x04bd('0x30')][_0x04bd('0x31')],function(_0x5aaac1){return{'name':_0x5aaac1[_0x04bd('0x32')],'type':_0x5aaac1['type'][_0x04bd('0x33')]};});_0x437c16['model']=_[_0x04bd('0x2f')](_0x325581,_0x04bd('0x2c'));_0x437c16['query']=_[_0x04bd('0x34')](_0x1927a8['query']);_0x437c16['filters']=_[_0x04bd('0x35')](_0x437c16['model'],_0x437c16[_0x04bd('0x36')]);_0x1f2134[_0x04bd('0x37')]=_['intersection'](_0x437c16[_0x04bd('0x38')],qs[_0x04bd('0x39')](_0x1927a8[_0x04bd('0x36')]['fields']));_0x1f2134[_0x04bd('0x37')]=_0x1f2134[_0x04bd('0x37')]['length']?_0x1f2134[_0x04bd('0x37')]:_0x437c16['model'];if(!_0x1927a8[_0x04bd('0x36')][_0x04bd('0x3a')]('nolimit')){_0x1f2134['limit']=qs[_0x04bd('0x21')](_0x1927a8[_0x04bd('0x36')]['limit']);_0x1f2134[_0x04bd('0x20')]=qs[_0x04bd('0x20')](_0x1927a8['query'][_0x04bd('0x20')]);}_0x1f2134['order']=qs[_0x04bd('0x3b')](_0x1927a8[_0x04bd('0x36')][_0x04bd('0x3b')]);_0x1f2134[_0x04bd('0x3c')]=qs[_0x04bd('0x3d')](_[_0x04bd('0x3e')](_0x1927a8[_0x04bd('0x36')],_0x437c16[_0x04bd('0x3d')]),_0x325581);if(_0x1927a8['query'][_0x04bd('0x3f')]){_0x1f2134[_0x04bd('0x3c')]=_[_0x04bd('0x40')](_0x1f2134[_0x04bd('0x3c')],{'$or':_[_0x04bd('0x2f')](_0x325581,function(_0x3c3448){if(_0x3c3448[_0x04bd('0x41')]!==_0x04bd('0x42')){var _0x284b61={};_0x284b61[_0x3c3448[_0x04bd('0x2c')]]={'$like':'%'+_0x1927a8[_0x04bd('0x36')][_0x04bd('0x3f')]+'%'};return _0x284b61;}})});}_0x1f2134=_[_0x04bd('0x40')]({},_0x1f2134,_0x1927a8['options']);var _0x2d88e1={'where':_0x1f2134[_0x04bd('0x3c')]};return db[_0x04bd('0x30')][_0x04bd('0x1f')](_0x2d88e1)[_0x04bd('0x28')](function(_0x12332f){_0x4a0f1f[_0x04bd('0x1f')]=_0x12332f;if(_0x1927a8[_0x04bd('0x36')][_0x04bd('0x43')]){_0x1f2134['include']=[{'all':!![]}];}return db[_0x04bd('0x30')][_0x04bd('0x44')](_0x1f2134);})[_0x04bd('0x28')](function(_0x27877a){_0x4a0f1f['rows']=_0x27877a;return _0x4a0f1f;})[_0x04bd('0x28')](respondWithFilteredResult(_0xcd7aec,_0x1f2134))[_0x04bd('0x45')](handleError(_0xcd7aec,null));};exports[_0x04bd('0x46')]=function(_0x410629,_0x5dc565){var _0x2603a0={'raw':![],'where':{'id':_0x410629[_0x04bd('0x47')]['id']}},_0x4559de={};_0x4559de['model']=_['keys'](db[_0x04bd('0x30')][_0x04bd('0x31')]);_0x4559de[_0x04bd('0x36')]=_[_0x04bd('0x34')](_0x410629[_0x04bd('0x36')]);_0x4559de[_0x04bd('0x3d')]=_[_0x04bd('0x35')](_0x4559de['model'],_0x4559de[_0x04bd('0x36')]);_0x2603a0['attributes']=_[_0x04bd('0x35')](_0x4559de[_0x04bd('0x38')],qs[_0x04bd('0x39')](_0x410629['query']['fields']));_0x2603a0[_0x04bd('0x37')]=_0x2603a0['attributes'][_0x04bd('0x48')]?_0x2603a0[_0x04bd('0x37')]:_0x4559de['model'];if(_0x410629[_0x04bd('0x36')]['includeAll']){_0x2603a0[_0x04bd('0x49')]=[{'all':!![]}];}_0x2603a0=_[_0x04bd('0x40')]({},_0x2603a0,_0x410629['options']);return db[_0x04bd('0x30')][_0x04bd('0x4a')](_0x2603a0)['then'](handleEntityNotFound(_0x5dc565,null))[_0x04bd('0x28')](respondWithResult(_0x5dc565,null))[_0x04bd('0x45')](handleError(_0x5dc565,null));};exports[_0x04bd('0x4b')]=function(_0x5d1912,_0x184138){return db[_0x04bd('0x30')][_0x04bd('0x4b')](_0x5d1912[_0x04bd('0x4c')],{})[_0x04bd('0x28')](respondWithResult(_0x184138,0xc9))[_0x04bd('0x45')](handleError(_0x184138,null));};exports['update']=function(_0x5e29c3,_0x7e13c3){if(_0x5e29c3['body']['id']){delete _0x5e29c3[_0x04bd('0x4c')]['id'];}return db[_0x04bd('0x30')][_0x04bd('0x4a')]({'where':{'id':_0x5e29c3[_0x04bd('0x47')]['id']}})[_0x04bd('0x28')](handleEntityNotFound(_0x7e13c3,null))['then'](saveUpdates(_0x5e29c3['body'],null))[_0x04bd('0x28')](respondWithResult(_0x7e13c3,null))[_0x04bd('0x45')](handleError(_0x7e13c3,null));};exports[_0x04bd('0x29')]=function(_0x2bb082,_0x5e2eec){return db[_0x04bd('0x30')]['find']({'where':{'id':_0x2bb082[_0x04bd('0x47')]['id']}})[_0x04bd('0x28')](handleEntityNotFound(_0x5e2eec,null))['then'](removeEntity(_0x5e2eec,null))[_0x04bd('0x45')](handleError(_0x5e2eec,null));};exports[_0x04bd('0x4d')]=function(_0x472d89,_0x1d0c8a,_0x557c72){var _0x1b43ea={};var _0x4c9015={};var _0x312fa5;var _0x4a73cf;return db[_0x04bd('0x30')]['findOne']({'where':{'id':_0x472d89[_0x04bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d0c8a,null))[_0x04bd('0x28')](function(_0x13d612){if(_0x13d612){_0x312fa5=_0x13d612;_0x4c9015[_0x04bd('0x38')]=_['keys'](db['SugarcrmConfiguration'][_0x04bd('0x31')]);_0x4c9015[_0x04bd('0x36')]=_['keys'](_0x472d89[_0x04bd('0x36')]);_0x4c9015[_0x04bd('0x3d')]=_[_0x04bd('0x35')](_0x4c9015['model'],_0x4c9015[_0x04bd('0x36')]);_0x1b43ea[_0x04bd('0x37')]=_[_0x04bd('0x35')](_0x4c9015[_0x04bd('0x38')],qs[_0x04bd('0x39')](_0x472d89['query'][_0x04bd('0x39')]));_0x1b43ea['attributes']=_0x1b43ea['attributes'][_0x04bd('0x48')]?_0x1b43ea[_0x04bd('0x37')]:_0x4c9015[_0x04bd('0x38')];_0x1b43ea[_0x04bd('0x4e')]=qs['sort'](_0x472d89[_0x04bd('0x36')][_0x04bd('0x3b')]);_0x1b43ea[_0x04bd('0x3c')]=qs['filters'](_[_0x04bd('0x3e')](_0x472d89[_0x04bd('0x36')],_0x4c9015[_0x04bd('0x3d')]));if(_0x472d89[_0x04bd('0x36')][_0x04bd('0x3f')]){_0x1b43ea['where']=_[_0x04bd('0x40')](_0x1b43ea[_0x04bd('0x3c')],{'$or':_[_0x04bd('0x2f')](_0x1b43ea['attributes'],function(_0x4abaab){var _0x4d9891={};_0x4d9891[_0x4abaab]={'$like':'%'+_0x472d89[_0x04bd('0x36')][_0x04bd('0x3f')]+'%'};return _0x4d9891;})});}_0x1b43ea=_[_0x04bd('0x40')]({},_0x1b43ea,_0x472d89[_0x04bd('0x4f')]);return _0x312fa5[_0x04bd('0x4d')](_0x1b43ea);}})[_0x04bd('0x28')](function(_0xe21147){if(_0xe21147){_0x4a73cf=_0xe21147[_0x04bd('0x48')];if(!_0x472d89[_0x04bd('0x36')][_0x04bd('0x3a')](_0x04bd('0x50'))){_0x1b43ea[_0x04bd('0x21')]=qs['limit'](_0x472d89[_0x04bd('0x36')][_0x04bd('0x21')]);_0x1b43ea[_0x04bd('0x20')]=qs[_0x04bd('0x20')](_0x472d89['query'][_0x04bd('0x20')]);}return _0x312fa5[_0x04bd('0x4d')](_0x1b43ea);}})[_0x04bd('0x28')](function(_0x221a99){if(_0x221a99){return _0x221a99?{'count':_0x4a73cf,'rows':_0x221a99}:null;}})['then'](respondWithResult(_0x1d0c8a,null))[_0x04bd('0x45')](handleError(_0x1d0c8a,null));};exports[_0x04bd('0x51')]=function(_0x1236f8,_0x31b1ad,_0x2cd824){if(_0x1236f8[_0x04bd('0x4c')]['id']){delete _0x1236f8[_0x04bd('0x4c')]['id'];}return db[_0x04bd('0x30')][_0x04bd('0x52')]({'where':{'id':_0x1236f8[_0x04bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x31b1ad,null))['then'](function(_0x3c8006){if(_0x3c8006){_0x1236f8['body'][_0x04bd('0x53')]=_0x3c8006['id'];_0x1236f8[_0x04bd('0x4c')][_0x04bd('0x54')]=integrations['getSubjects'](_0x1236f8[_0x04bd('0x4c')][_0x04bd('0x55')],_0x1236f8['body']['type']);_0x1236f8[_0x04bd('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x1236f8[_0x04bd('0x4c')]['channel'],_0x1236f8[_0x04bd('0x4c')][_0x04bd('0x41')]);return db['SugarcrmConfiguration'][_0x04bd('0x4b')](_0x1236f8[_0x04bd('0x4c')],{'include':[{'model':db[_0x04bd('0x56')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x04bd('0x57')}]});}return null;})[_0x04bd('0x28')](respondWithResult(_0x31b1ad,null))[_0x04bd('0x45')](handleError(_0x31b1ad,null));};exports[_0x04bd('0x58')]=function(_0x39bb7a,_0x163a2d,_0x171a60){var _0xdba90='';var _0x1e3abc=['id',_0x04bd('0x2c'),_0x04bd('0x59'),'created_by',_0x04bd('0x5a'),_0x04bd('0x5b'),_0x04bd('0x5c'),'duration_minutes',_0x04bd('0x5d'),'parent_type','parent_name',_0x04bd('0x5e')];return db[_0x04bd('0x30')][_0x04bd('0x52')]({'where':{'id':_0x39bb7a['params']['id']},'attributes':['id',_0x04bd('0x5f'),_0x04bd('0x60'),_0x04bd('0x61')]})[_0x04bd('0x28')](handleEntityNotFound(_0x163a2d,null))[_0x04bd('0x28')](function(_0x5ee7dd){if(_0x5ee7dd){_0xdba90=_0x5ee7dd[_0x04bd('0x61')];var _0x227321=_0xdba90[_0x04bd('0x62')](-0x1);if(_0x227321==='/'){_0xdba90=_0xdba90[_0x04bd('0x63')](0x0,_0xdba90[_0x04bd('0x64')](_0x227321));}return rp({'method':'POST','uri':util[_0x04bd('0x65')](_0x04bd('0x66'),_0xdba90,_0x04bd('0x67')),'json':!![],'form':{'method':_0x04bd('0x68'),'input_type':'JSON','response_type':_0x04bd('0x69'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5ee7dd['username'],'password':_0x5ee7dd[_0x04bd('0x60')],'encryption':_0x04bd('0x6a')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x533a66){if(_0x533a66&&_0x533a66[_0x04bd('0x2c')]!=='Invalid\x20Login'&&_0x533a66['name']!=='Password\x20Expired'){return rp({'method':_0x04bd('0x6b'),'uri':util[_0x04bd('0x65')]('%s%s',_0xdba90,_0x04bd('0x67')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x04bd('0x69'),'response_type':'JSON','rest_data':JSON[_0x04bd('0x6c')]({'session':_0x533a66['id'],'module_name':'Calls'})}})[_0x04bd('0x28')](function(_0x5d532f){if(_0x5d532f){var _0x6fb34b=_[_0x04bd('0x6d')](_0x5d532f[_0x04bd('0x6e')]);_['remove'](_0x6fb34b,function(_0x40a38a){return _0x1e3abc['includes'](_0x40a38a[_0x04bd('0x2c')]);});return{'count':_0x6fb34b[_0x04bd('0x48')],'rows':_[_0x04bd('0x2f')](_0x6fb34b,function(_0x45c1ff){return{'id':_0x45c1ff[_0x04bd('0x2c')],'name':_0x45c1ff['label'],'custom':_[_0x04bd('0x6f')](_0x45c1ff[_0x04bd('0x2c')],'_c')?!![]:![],'options':_0x45c1ff[_0x04bd('0x4f')]?_[_0x04bd('0x2f')](_[_0x04bd('0x6d')](_0x45c1ff[_0x04bd('0x4f')]),function(_0x34fc44){return{'name':_0x34fc44['value'],'value':_0x34fc44[_0x04bd('0x2c')]};}):[]};})};}})[_0x04bd('0x28')](respondWithResult(_0x163a2d,null))['catch'](function(_0x3e98b0){var _0x357b35=_0x39bb7a[_0x04bd('0x36')][_0x04bd('0x70')]?0x1f4:_0x3e98b0['statusCode']||0x1f4;logger[_0x04bd('0x2a')](_0x04bd('0x71'),_0x04bd('0x58'),_0x357b35,JSON['stringify'](_0x3e98b0));delete _0x3e98b0[_0x04bd('0x2c')];if(_0x357b35===0x191){_0x357b35=0x190;}_0x163a2d['status'](_0x357b35)[_0x04bd('0x2d')](_0x39bb7a[_0x04bd('0x36')]['test']?{'message':_0x04bd('0x72'),'statusCode':_0x3e98b0[_0x04bd('0x73')]}:_0x3e98b0);});}else{var _0x96fd2=0x1f4;_0x163a2d[_0x04bd('0x1c')](_0x96fd2)['send']({'message':_0x04bd('0x72'),'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 357d8a3..20788da 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 _0x296e=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x296e,0x9e));var _0xe296=function(_0x42c303,_0x4cee17){_0x42c303=_0x42c303-0x0;var _0x1a28bf=_0x296e[_0x42c303];return _0x1a28bf;};'use strict';var _=require(_0xe296('0x0'));var util=require(_0xe296('0x1'));var logger=require(_0xe296('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe296('0x3'));var rp=require(_0xe296('0x4'));var fs=require('fs');var path=require(_0xe296('0x5'));var rimraf=require(_0xe296('0x6'));var config=require(_0xe296('0x7'));var attributes=require(_0xe296('0x8'));var integrations=require(_0xe296('0x9'));module[_0xe296('0xa')]=function(_0x52628f,_0x3dbf02){return _0x52628f['define'](_0xe296('0xb'),attributes,{'tableName':_0xe296('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0dff=['bluebird','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','moment'];(function(_0x3d27a,_0x31311d){var _0x314fd7=function(_0x20ac55){while(--_0x20ac55){_0x3d27a['push'](_0x3d27a['shift']());}};_0x314fd7(++_0x31311d);}(_0x0dff,0x168));var _0xf0df=function(_0x5023a1,_0x23d798){_0x5023a1=_0x5023a1-0x0;var _0x22dbaf=_0x0dff[_0x5023a1];return _0x22dbaf;};'use strict';var _=require(_0xf0df('0x0'));var util=require('util');var logger=require(_0xf0df('0x1'))('api');var moment=require(_0xf0df('0x2'));var BPromise=require(_0xf0df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf0df('0x4'));var config=require('../../config/environment');var attributes=require(_0xf0df('0x5'));var integrations=require(_0xf0df('0x6'));module[_0xf0df('0x7')]=function(_0x51f768,_0x1113d6){return _0x51f768[_0xf0df('0x8')](_0xf0df('0x9'),attributes,{'tableName':_0xf0df('0xa'),'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 851494b..f0d2f6f 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 _0xe322=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SugarcrmAccount','findAll','raw','options','where','attributes','map','include','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40df4b,_0x2267b4){var _0x1f6c38=function(_0xbe6b13){while(--_0xbe6b13){_0x40df4b['push'](_0x40df4b['shift']());}};_0x1f6c38(++_0x2267b4);}(_0xe322,0x166));var _0x2e32=function(_0xfc223a,_0x26a0c9){_0xfc223a=_0xfc223a-0x0;var _0x1fd2e3=_0xe322[_0xfc223a];return _0x1fd2e3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2e32('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e32('0x1'))['db'];var utils=require(_0x2e32('0x2'));var logger=require('../../config/logger')(_0x2e32('0x3'));var config=require(_0x2e32('0x4'));var jayson=require(_0x2e32('0x5'));var client=jayson[_0x2e32('0x6')][_0x2e32('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x60dbfe,_0x25d859,_0x56fa92){return new BPromise(function(_0x2261e6,_0x5d693e){return client[_0x2e32('0x8')](_0x60dbfe,_0x56fa92)[_0x2e32('0x9')](function(_0x3c6fb5){logger[_0x2e32('0xa')](_0x2e32('0xb'),_0x25d859,_0x2e32('0xc'));logger[_0x2e32('0xd')](_0x2e32('0xe'),_0x25d859,_0x2e32('0xc'),JSON[_0x2e32('0xf')](_0x3c6fb5));if(_0x3c6fb5['error']){if(_0x3c6fb5[_0x2e32('0x10')]['code']===0x1f4){logger[_0x2e32('0x10')](_0x2e32('0xb'),_0x25d859,_0x3c6fb5[_0x2e32('0x10')][_0x2e32('0x11')]);return _0x5d693e(_0x3c6fb5['error'][_0x2e32('0x11')]);}logger[_0x2e32('0x10')](_0x2e32('0xb'),_0x25d859,_0x3c6fb5[_0x2e32('0x10')][_0x2e32('0x11')]);return _0x2261e6(_0x3c6fb5[_0x2e32('0x10')][_0x2e32('0x11')]);}else{logger[_0x2e32('0xa')](_0x2e32('0xb'),_0x25d859,_0x2e32('0xc'));_0x2261e6(_0x3c6fb5['result']['message']);}})[_0x2e32('0x12')](function(_0x5c5556){logger[_0x2e32('0x10')](_0x2e32('0xb'),_0x25d859,_0x5c5556);_0x5d693e(_0x5c5556);});});}exports['GetSugarcrmAccount']=function(_0x1c8984){var _0x18bf33=this;return new Promise(function(_0x4cbe80,_0x18d50d){return db[_0x2e32('0x13')][_0x2e32('0x14')]({'raw':_0x1c8984['options']?_0x1c8984['options'][_0x2e32('0x15')]===undefined?!![]:![]:!![],'where':_0x1c8984[_0x2e32('0x16')]?_0x1c8984[_0x2e32('0x16')][_0x2e32('0x17')]||null:null,'attributes':_0x1c8984[_0x2e32('0x16')]?_0x1c8984['options'][_0x2e32('0x18')]||null:null,'limit':_0x1c8984['options']?_0x1c8984[_0x2e32('0x16')]['limit']||null:null,'include':_0x1c8984[_0x2e32('0x16')]?_0x1c8984[_0x2e32('0x16')]['include']?_[_0x2e32('0x19')](_0x1c8984[_0x2e32('0x16')][_0x2e32('0x1a')],function(_0x4ce185){return{'model':db[_0x4ce185[_0x2e32('0x1b')]],'as':_0x4ce185['as'],'attributes':_0x4ce185[_0x2e32('0x18')],'include':_0x4ce185[_0x2e32('0x1a')]?_[_0x2e32('0x19')](_0x4ce185[_0x2e32('0x1a')],function(_0x140f62){return{'model':db[_0x140f62[_0x2e32('0x1b')]],'as':_0x140f62['as'],'attributes':_0x140f62['attributes'],'include':_0x140f62['include']?_[_0x2e32('0x19')](_0x140f62[_0x2e32('0x1a')],function(_0x3a6a39){return{'model':db[_0x3a6a39[_0x2e32('0x1b')]],'as':_0x3a6a39['as'],'attributes':_0x3a6a39[_0x2e32('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c8a01){logger[_0x2e32('0xa')]('GetSugarcrmAccount',_0x1c8984);logger[_0x2e32('0xd')]('GetSugarcrmAccount',_0x1c8984,JSON[_0x2e32('0xf')](_0x3c8a01));_0x4cbe80(_0x3c8a01);})[_0x2e32('0x12')](function(_0x593d11){logger[_0x2e32('0x10')](_0x2e32('0x1c'),_0x593d11['message'],_0x1c8984);_0x18d50d(_0x18bf33[_0x2e32('0x10')](0x1f4,_0x593d11[_0x2e32('0x11')]));});});};exports[_0x2e32('0x1d')]=function(_0x1b24a4){var _0x54756f=this;return new Promise(function(_0x235a07,_0x1ef478){return db[_0x2e32('0x13')][_0x2e32('0x1e')]({'raw':_0x1b24a4[_0x2e32('0x16')]?_0x1b24a4[_0x2e32('0x16')][_0x2e32('0x15')]===undefined?!![]:![]:!![],'where':_0x1b24a4[_0x2e32('0x16')]?_0x1b24a4[_0x2e32('0x16')][_0x2e32('0x17')]||null:null,'attributes':_0x1b24a4[_0x2e32('0x16')]?_0x1b24a4[_0x2e32('0x16')][_0x2e32('0x18')]||null:null,'include':_0x1b24a4['options']?_0x1b24a4[_0x2e32('0x16')]['include']?_[_0x2e32('0x19')](_0x1b24a4[_0x2e32('0x16')][_0x2e32('0x1a')],function(_0x2acf44){return{'model':db[_0x2acf44[_0x2e32('0x1b')]],'as':_0x2acf44['as'],'attributes':_0x2acf44['attributes'],'include':_0x2acf44[_0x2e32('0x1a')]?_[_0x2e32('0x19')](_0x2acf44[_0x2e32('0x1a')],function(_0x5e402d){return{'model':db[_0x5e402d['model']],'as':_0x5e402d['as'],'attributes':_0x5e402d[_0x2e32('0x18')],'include':_0x5e402d['include']?_['map'](_0x5e402d['include'],function(_0x237eb2){return{'model':db[_0x237eb2[_0x2e32('0x1b')]],'as':_0x237eb2['as'],'attributes':_0x237eb2[_0x2e32('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31c162){logger[_0x2e32('0xa')]('ShowSugarcrmAccount',_0x1b24a4);logger[_0x2e32('0xd')](_0x2e32('0x1d'),_0x1b24a4,JSON[_0x2e32('0xf')](_0x31c162));_0x235a07(_0x31c162);})['catch'](function(_0x23817b){logger[_0x2e32('0x10')](_0x2e32('0x1d'),_0x23817b[_0x2e32('0x11')],_0x1b24a4);_0x1ef478(_0x54756f['error'](0x1f4,_0x23817b[_0x2e32('0x11')]));});});}; \ No newline at end of file +var _0x84c5=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','attributes','limit','map','include','model','stringify','find','ShowSugarcrmAccount','lodash','moment','ioredis','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug'];(function(_0x1f23b1,_0x57c83f){var _0x3c9197=function(_0x2f6e4a){while(--_0x2f6e4a){_0x1f23b1['push'](_0x1f23b1['shift']());}};_0x3c9197(++_0x57c83f);}(_0x84c5,0x1b7));var _0x584c=function(_0x2ad9f8,_0x4a7d81){_0x2ad9f8=_0x2ad9f8-0x0;var _0x476cbc=_0x84c5[_0x2ad9f8];return _0x476cbc;};'use strict';var _=require(_0x584c('0x0'));var util=require('util');var moment=require(_0x584c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x584c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x584c('0x3'));var client=jayson[_0x584c('0x4')][_0x584c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1d6d5f,_0x4472dd,_0x55babb){return new BPromise(function(_0x381b0d,_0x5bfc04){return client[_0x584c('0x6')](_0x1d6d5f,_0x55babb)[_0x584c('0x7')](function(_0x301a63){logger[_0x584c('0x8')](_0x584c('0x9'),_0x4472dd,'request\x20sent');logger[_0x584c('0xa')](_0x584c('0xb'),_0x4472dd,'request\x20sent',JSON['stringify'](_0x301a63));if(_0x301a63['error']){if(_0x301a63[_0x584c('0xc')][_0x584c('0xd')]===0x1f4){logger[_0x584c('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x4472dd,_0x301a63[_0x584c('0xc')]['message']);return _0x5bfc04(_0x301a63[_0x584c('0xc')][_0x584c('0xe')]);}logger[_0x584c('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x4472dd,_0x301a63[_0x584c('0xc')][_0x584c('0xe')]);return _0x381b0d(_0x301a63[_0x584c('0xc')][_0x584c('0xe')]);}else{logger['info'](_0x584c('0x9'),_0x4472dd,_0x584c('0xf'));_0x381b0d(_0x301a63[_0x584c('0x10')]['message']);}})[_0x584c('0x11')](function(_0x1643dc){logger[_0x584c('0xc')](_0x584c('0x9'),_0x4472dd,_0x1643dc);_0x5bfc04(_0x1643dc);});});}exports[_0x584c('0x12')]=function(_0x16cafa){var _0x42280f=this;return new Promise(function(_0x4836db,_0x511f1a){return db[_0x584c('0x13')]['findAll']({'raw':_0x16cafa[_0x584c('0x14')]?_0x16cafa['options'][_0x584c('0x15')]===undefined?!![]:![]:!![],'where':_0x16cafa[_0x584c('0x14')]?_0x16cafa[_0x584c('0x14')]['where']||null:null,'attributes':_0x16cafa[_0x584c('0x14')]?_0x16cafa['options'][_0x584c('0x16')]||null:null,'limit':_0x16cafa[_0x584c('0x14')]?_0x16cafa['options'][_0x584c('0x17')]||null:null,'include':_0x16cafa['options']?_0x16cafa[_0x584c('0x14')]['include']?_[_0x584c('0x18')](_0x16cafa[_0x584c('0x14')][_0x584c('0x19')],function(_0x11bf9e){return{'model':db[_0x11bf9e[_0x584c('0x1a')]],'as':_0x11bf9e['as'],'attributes':_0x11bf9e[_0x584c('0x16')],'include':_0x11bf9e[_0x584c('0x19')]?_[_0x584c('0x18')](_0x11bf9e['include'],function(_0x5de9fe){return{'model':db[_0x5de9fe['model']],'as':_0x5de9fe['as'],'attributes':_0x5de9fe['attributes'],'include':_0x5de9fe[_0x584c('0x19')]?_[_0x584c('0x18')](_0x5de9fe['include'],function(_0x2b7955){return{'model':db[_0x2b7955[_0x584c('0x1a')]],'as':_0x2b7955['as'],'attributes':_0x2b7955[_0x584c('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1734b0){logger[_0x584c('0x8')](_0x584c('0x12'),_0x16cafa);logger[_0x584c('0xa')](_0x584c('0x12'),_0x16cafa,JSON[_0x584c('0x1b')](_0x1734b0));_0x4836db(_0x1734b0);})[_0x584c('0x11')](function(_0xce1f18){logger[_0x584c('0xc')](_0x584c('0x12'),_0xce1f18[_0x584c('0xe')],_0x16cafa);_0x511f1a(_0x42280f['error'](0x1f4,_0xce1f18['message']));});});};exports['ShowSugarcrmAccount']=function(_0x203aa1){var _0xeb965f=this;return new Promise(function(_0x46cf98,_0x50d081){return db[_0x584c('0x13')][_0x584c('0x1c')]({'raw':_0x203aa1['options']?_0x203aa1[_0x584c('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x203aa1[_0x584c('0x14')]?_0x203aa1[_0x584c('0x14')]['where']||null:null,'attributes':_0x203aa1['options']?_0x203aa1[_0x584c('0x14')][_0x584c('0x16')]||null:null,'include':_0x203aa1['options']?_0x203aa1['options'][_0x584c('0x19')]?_[_0x584c('0x18')](_0x203aa1[_0x584c('0x14')][_0x584c('0x19')],function(_0x29e843){return{'model':db[_0x29e843[_0x584c('0x1a')]],'as':_0x29e843['as'],'attributes':_0x29e843[_0x584c('0x16')],'include':_0x29e843[_0x584c('0x19')]?_[_0x584c('0x18')](_0x29e843[_0x584c('0x19')],function(_0x54113e){return{'model':db[_0x54113e[_0x584c('0x1a')]],'as':_0x54113e['as'],'attributes':_0x54113e['attributes'],'include':_0x54113e[_0x584c('0x19')]?_[_0x584c('0x18')](_0x54113e['include'],function(_0x287330){return{'model':db[_0x287330[_0x584c('0x1a')]],'as':_0x287330['as'],'attributes':_0x287330['attributes']};}):[]};}):[]};}):[]:[]})[_0x584c('0x7')](function(_0x5bb40f){logger[_0x584c('0x8')]('ShowSugarcrmAccount',_0x203aa1);logger[_0x584c('0xa')](_0x584c('0x1d'),_0x203aa1,JSON[_0x584c('0x1b')](_0x5bb40f));_0x46cf98(_0x5bb40f);})[_0x584c('0x11')](function(_0x3b52a4){logger[_0x584c('0xc')](_0x584c('0x1d'),_0x3b52a4[_0x584c('0xe')],_0x203aa1);_0x50d081(_0xeb965f[_0x584c('0xc')](0x1f4,_0x3b52a4[_0x584c('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 2778a35..06e2931 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 _0xa3ec=['show','/:id/fields','getSubjects','/:id/descriptions','create','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x27841e,_0x45435f){var _0x30d008=function(_0x2d2a60){while(--_0x2d2a60){_0x27841e['push'](_0x27841e['shift']());}};_0x30d008(++_0x45435f);}(_0xa3ec,0xfe));var _0xca3e=function(_0x17d41f,_0x28d30a){_0x17d41f=_0x17d41f-0x0;var _0x41b90f=_0xa3ec[_0x17d41f];return _0x41b90f;};'use strict';var multer=require(_0xca3e('0x0'));var util=require(_0xca3e('0x1'));var path=require(_0xca3e('0x2'));var timeout=require(_0xca3e('0x3'));var express=require(_0xca3e('0x4'));var router=express[_0xca3e('0x5')]();var fs_extra=require(_0xca3e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xca3e('0x7'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xca3e('0x8')]('/',auth[_0xca3e('0x9')](),controller[_0xca3e('0xa')]);router['get'](_0xca3e('0xb'),auth[_0xca3e('0x9')](),controller[_0xca3e('0xc')]);router[_0xca3e('0x8')](_0xca3e('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xca3e('0x8')]('/:id/subjects',auth[_0xca3e('0x9')](),controller[_0xca3e('0xe')]);router[_0xca3e('0x8')](_0xca3e('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xca3e('0x9')](),controller[_0xca3e('0x10')]);router[_0xca3e('0x11')](_0xca3e('0xb'),auth[_0xca3e('0x9')](),controller['update']);router[_0xca3e('0x12')](_0xca3e('0xb'),auth[_0xca3e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xda7d=['../../components/interaction/service','get','/:id','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xda7d,0x134));var _0xdda7=function(_0x594d91,_0x589ecb){_0x594d91=_0x594d91-0x0;var _0x30f528=_0xda7d[_0x594d91];return _0x30f528;};'use strict';var multer=require(_0xdda7('0x0'));var util=require(_0xdda7('0x1'));var path=require(_0xdda7('0x2'));var timeout=require(_0xdda7('0x3'));var express=require(_0xdda7('0x4'));var router=express['Router']();var fs_extra=require(_0xdda7('0x5'));var auth=require(_0xdda7('0x6'));var interaction=require(_0xdda7('0x7'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xdda7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdda7('0x8')](_0xdda7('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xdda7('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xdda7('0xa')]);router[_0xdda7('0x8')](_0xdda7('0xb'),auth[_0xdda7('0xc')](),controller[_0xdda7('0xd')]);router[_0xdda7('0x8')](_0xdda7('0xe'),auth['isAuthenticated'](),controller[_0xdda7('0xf')]);router[_0xdda7('0x10')]('/',auth[_0xdda7('0xc')](),controller[_0xdda7('0x11')]);router['put']('/:id',auth[_0xdda7('0xc')](),controller['update']);router[_0xdda7('0x12')](_0xdda7('0x9'),auth[_0xdda7('0xc')](),controller[_0xdda7('0x13')]);module[_0xdda7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c821885..803a87d 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 _0xc7d1=['STRING','sequelize','exports'];(function(_0x549501,_0x541ac6){var _0x229640=function(_0x5d08d7){while(--_0x5d08d7){_0x549501['push'](_0x549501['shift']());}};_0x229640(++_0x541ac6);}(_0xc7d1,0x10f));var _0x1c7d=function(_0x1d5098,_0xab456f){_0x1d5098=_0x1d5098-0x0;var _0x3463c5=_0xc7d1[_0x1d5098];return _0x3463c5;};'use strict';var Sequelize=require(_0x1c7d('0x0'));module[_0x1c7d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1c7d('0x2')]}}; \ No newline at end of file +var _0xccd9=['sequelize','STRING'];(function(_0x5d9a85,_0x55221e){var _0x1ef8aa=function(_0x5241be){while(--_0x5241be){_0x5d9a85['push'](_0x5d9a85['shift']());}};_0x1ef8aa(++_0x55221e);}(_0xccd9,0x10e));var _0x9ccd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xccd9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9ccd('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ccd('0x1')]},'description':{'type':Sequelize[_0x9ccd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5cd4ff1..5a45840 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 _0xa02f=['count','set','Content-Range','apply','save','update','destroy','then','end','stack','name','send','index','SugarcrmConfiguration','rawAttributes','type','key','map','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','length','find','create','body','catch','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xa02f,0xcf));var _0xfa02=function(_0x4a17e0,_0x14cc14){_0x4a17e0=_0x4a17e0-0x0;var _0x56f015=_0xa02f[_0x4a17e0];return _0x56f015;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa02('0x0'));var zipdir=require(_0xfa02('0x1'));var jsonpatch=require(_0xfa02('0x2'));var rp=require(_0xfa02('0x3'));var moment=require(_0xfa02('0x4'));var BPromise=require(_0xfa02('0x5'));var Mustache=require('mustache');var util=require(_0xfa02('0x6'));var path=require(_0xfa02('0x7'));var sox=require(_0xfa02('0x8'));var csv=require(_0xfa02('0x9'));var ejs=require(_0xfa02('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa02('0xb'));var squel=require('squel');var crypto=require(_0xfa02('0xc'));var jsforce=require(_0xfa02('0xd'));var deskjs=require(_0xfa02('0xe'));var toCsv=require(_0xfa02('0x9'));var querystring=require(_0xfa02('0xf'));var Papa=require('papaparse');var Redis=require(_0xfa02('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfa02('0x11'));var as=require(_0xfa02('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa02('0x13'))('api');var utils=require(_0xfa02('0x14'));var config=require(_0xfa02('0x15'));var licenseUtil=require(_0xfa02('0x16'));var db=require(_0xfa02('0x17'))['db'];function respondWithStatusCode(_0x270e9e,_0x51e63d){_0x51e63d=_0x51e63d||0xcc;return function(_0x2cfecf){if(_0x2cfecf){return _0x270e9e[_0xfa02('0x18')](_0x51e63d);}return _0x270e9e[_0xfa02('0x19')](_0x51e63d)['end']();};}function respondWithResult(_0x2b86e0,_0x17839e){_0x17839e=_0x17839e||0xc8;return function(_0x512966){if(_0x512966){return _0x2b86e0[_0xfa02('0x19')](_0x17839e)[_0xfa02('0x1a')](_0x512966);}};}function respondWithFilteredResult(_0x3774d1,_0x2f8e41){return function(_0xf4362){if(_0xf4362){var _0x54b5c3=typeof _0x2f8e41['offset']===_0xfa02('0x1b')&&typeof _0x2f8e41[_0xfa02('0x1c')]===_0xfa02('0x1b');var _0x248162=_0xf4362['count'];var _0x4f5a7d=_0x54b5c3?0x0:_0x2f8e41[_0xfa02('0x1d')];var _0x4de88c=_0x54b5c3?_0xf4362[_0xfa02('0x1e')]:_0x2f8e41['offset']+_0x2f8e41['limit'];var _0x1e9c3a;if(_0x4de88c>=_0x248162){_0x4de88c=_0x248162;_0x1e9c3a=0xc8;}else{_0x1e9c3a=0xce;}_0x3774d1[_0xfa02('0x19')](_0x1e9c3a);return _0x3774d1[_0xfa02('0x1f')](_0xfa02('0x20'),_0x4f5a7d+'-'+_0x4de88c+'/'+_0x248162)[_0xfa02('0x1a')](_0xf4362);}return null;};}function patchUpdates(_0x5255e1){return function(_0x4e3210){try{jsonpatch[_0xfa02('0x21')](_0x4e3210,_0x5255e1,!![]);}catch(_0x4f495d){return BPromise['reject'](_0x4f495d);}return _0x4e3210[_0xfa02('0x22')]();};}function saveUpdates(_0x4fe5ae,_0x31f575){return function(_0xcaf39e){if(_0xcaf39e){return _0xcaf39e[_0xfa02('0x23')](_0x4fe5ae)['then'](function(_0x3a6626){return _0x3a6626;});}return null;};}function removeEntity(_0x373aeb,_0x255914){return function(_0x2755d3){if(_0x2755d3){return _0x2755d3[_0xfa02('0x24')]()[_0xfa02('0x25')](function(){_0x373aeb[_0xfa02('0x19')](0xcc)[_0xfa02('0x26')]();});}};}function handleEntityNotFound(_0x406ac3,_0x184ee1){return function(_0x33a86c){if(!_0x33a86c){_0x406ac3[_0xfa02('0x18')](0x194);}return _0x33a86c;};}function handleError(_0x54a96e,_0x49053c){_0x49053c=_0x49053c||0x1f4;return function(_0x44af4b){logger['error'](_0x44af4b[_0xfa02('0x27')]);if(_0x44af4b[_0xfa02('0x28')]){delete _0x44af4b['name'];}_0x54a96e['status'](_0x49053c)[_0xfa02('0x29')](_0x44af4b);};}exports[_0xfa02('0x2a')]=function(_0x23bd39,_0x41d4a4){var _0x40d472={},_0x253b5a={},_0x461466={'count':0x0,'rows':[]};var _0x2fa9e9=_['map'](db[_0xfa02('0x2b')][_0xfa02('0x2c')],function(_0x467d3a){return{'name':_0x467d3a['fieldName'],'type':_0x467d3a[_0xfa02('0x2d')][_0xfa02('0x2e')]};});_0x253b5a['model']=_[_0xfa02('0x2f')](_0x2fa9e9,_0xfa02('0x28'));_0x253b5a['query']=_[_0xfa02('0x30')](_0x23bd39['query']);_0x253b5a[_0xfa02('0x31')]=_[_0xfa02('0x32')](_0x253b5a[_0xfa02('0x33')],_0x253b5a[_0xfa02('0x34')]);_0x40d472[_0xfa02('0x35')]=_[_0xfa02('0x32')](_0x253b5a['model'],qs[_0xfa02('0x36')](_0x23bd39[_0xfa02('0x34')][_0xfa02('0x36')]));_0x40d472[_0xfa02('0x35')]=_0x40d472[_0xfa02('0x35')]['length']?_0x40d472[_0xfa02('0x35')]:_0x253b5a[_0xfa02('0x33')];if(!_0x23bd39['query'][_0xfa02('0x37')](_0xfa02('0x38'))){_0x40d472['limit']=qs[_0xfa02('0x1c')](_0x23bd39[_0xfa02('0x34')][_0xfa02('0x1c')]);_0x40d472['offset']=qs[_0xfa02('0x1d')](_0x23bd39[_0xfa02('0x34')][_0xfa02('0x1d')]);}_0x40d472[_0xfa02('0x39')]=qs[_0xfa02('0x3a')](_0x23bd39['query'][_0xfa02('0x3a')]);_0x40d472[_0xfa02('0x3b')]=qs[_0xfa02('0x31')](_[_0xfa02('0x3c')](_0x23bd39[_0xfa02('0x34')],_0x253b5a['filters']),_0x2fa9e9);if(_0x23bd39[_0xfa02('0x34')][_0xfa02('0x3d')]){_0x40d472[_0xfa02('0x3b')]=_[_0xfa02('0x3e')](_0x40d472[_0xfa02('0x3b')],{'$or':_['map'](_0x2fa9e9,function(_0x5d9502){if(_0x5d9502['type']!==_0xfa02('0x3f')){var _0x5ca535={};_0x5ca535[_0x5d9502[_0xfa02('0x28')]]={'$like':'%'+_0x23bd39[_0xfa02('0x34')][_0xfa02('0x3d')]+'%'};return _0x5ca535;}})});}_0x40d472=_[_0xfa02('0x3e')]({},_0x40d472,_0x23bd39[_0xfa02('0x40')]);var _0x49ed66={'where':_0x40d472[_0xfa02('0x3b')]};return db[_0xfa02('0x2b')][_0xfa02('0x1e')](_0x49ed66)[_0xfa02('0x25')](function(_0x3c6dfa){_0x461466[_0xfa02('0x1e')]=_0x3c6dfa;if(_0x23bd39[_0xfa02('0x34')][_0xfa02('0x41')]){_0x40d472[_0xfa02('0x42')]=[{'all':!![]}];}return db[_0xfa02('0x2b')]['findAll'](_0x40d472);})[_0xfa02('0x25')](function(_0x15c488){_0x461466['rows']=_0x15c488;return _0x461466;})[_0xfa02('0x25')](respondWithFilteredResult(_0x41d4a4,_0x40d472))['catch'](handleError(_0x41d4a4,null));};exports[_0xfa02('0x43')]=function(_0x34d3f9,_0x5a4a67){var _0x2797d0={'raw':![],'where':{'id':_0x34d3f9[_0xfa02('0x44')]['id']}},_0x214107={};_0x214107[_0xfa02('0x33')]=_['keys'](db[_0xfa02('0x2b')][_0xfa02('0x2c')]);_0x214107[_0xfa02('0x34')]=_[_0xfa02('0x30')](_0x34d3f9[_0xfa02('0x34')]);_0x214107[_0xfa02('0x31')]=_[_0xfa02('0x32')](_0x214107[_0xfa02('0x33')],_0x214107[_0xfa02('0x34')]);_0x2797d0[_0xfa02('0x35')]=_[_0xfa02('0x32')](_0x214107['model'],qs['fields'](_0x34d3f9['query'][_0xfa02('0x36')]));_0x2797d0[_0xfa02('0x35')]=_0x2797d0['attributes'][_0xfa02('0x45')]?_0x2797d0[_0xfa02('0x35')]:_0x214107[_0xfa02('0x33')];if(_0x34d3f9[_0xfa02('0x34')][_0xfa02('0x41')]){_0x2797d0[_0xfa02('0x42')]=[{'all':!![]}];}_0x2797d0=_[_0xfa02('0x3e')]({},_0x2797d0,_0x34d3f9['options']);return db[_0xfa02('0x2b')][_0xfa02('0x46')](_0x2797d0)[_0xfa02('0x25')](handleEntityNotFound(_0x5a4a67,null))[_0xfa02('0x25')](respondWithResult(_0x5a4a67,null))['catch'](handleError(_0x5a4a67,null));};exports[_0xfa02('0x47')]=function(_0x7b49a1,_0x416793){return db[_0xfa02('0x2b')][_0xfa02('0x47')](_0x7b49a1[_0xfa02('0x48')],{})['then'](respondWithResult(_0x416793,0xc9))['catch'](handleError(_0x416793,null));};exports[_0xfa02('0x23')]=function(_0x59a724,_0x501c77){if(_0x59a724[_0xfa02('0x48')]['id']){delete _0x59a724[_0xfa02('0x48')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x59a724[_0xfa02('0x44')]['id']}})[_0xfa02('0x25')](handleEntityNotFound(_0x501c77,null))['then'](saveUpdates(_0x59a724[_0xfa02('0x48')],null))[_0xfa02('0x25')](respondWithResult(_0x501c77,null))[_0xfa02('0x49')](handleError(_0x501c77,null));};exports['destroy']=function(_0x578269,_0x8bee42){return db['SugarcrmConfiguration'][_0xfa02('0x46')]({'where':{'id':_0x578269[_0xfa02('0x44')]['id']}})[_0xfa02('0x25')](handleEntityNotFound(_0x8bee42,null))[_0xfa02('0x25')](removeEntity(_0x8bee42,null))[_0xfa02('0x49')](handleError(_0x8bee42,null));};exports[_0xfa02('0x4a')]=function(_0x151b07,_0x4cc70a,_0x891e43){var _0x516fde={};var _0x929b2e={};var _0x48ecb2;var _0x4791e7;return db[_0xfa02('0x2b')][_0xfa02('0x4b')]({'where':{'id':_0x151b07[_0xfa02('0x44')]['id']}})['then'](handleEntityNotFound(_0x4cc70a,null))['then'](function(_0x1d3ab1){if(_0x1d3ab1){_0x48ecb2=_0x1d3ab1;_0x929b2e['model']=_['keys'](db['SugarcrmField'][_0xfa02('0x2c')]);_0x929b2e[_0xfa02('0x34')]=_[_0xfa02('0x30')](_0x151b07[_0xfa02('0x34')]);_0x929b2e[_0xfa02('0x31')]=_[_0xfa02('0x32')](_0x929b2e[_0xfa02('0x33')],_0x929b2e['query']);_0x516fde['attributes']=_[_0xfa02('0x32')](_0x929b2e[_0xfa02('0x33')],qs[_0xfa02('0x36')](_0x151b07[_0xfa02('0x34')][_0xfa02('0x36')]));_0x516fde['attributes']=_0x516fde[_0xfa02('0x35')][_0xfa02('0x45')]?_0x516fde[_0xfa02('0x35')]:_0x929b2e['model'];_0x516fde[_0xfa02('0x39')]=qs['sort'](_0x151b07[_0xfa02('0x34')][_0xfa02('0x3a')]);_0x516fde['where']=qs[_0xfa02('0x31')](_[_0xfa02('0x3c')](_0x151b07[_0xfa02('0x34')],_0x929b2e[_0xfa02('0x31')]));if(_0x151b07[_0xfa02('0x34')][_0xfa02('0x3d')]){_0x516fde[_0xfa02('0x3b')]=_[_0xfa02('0x3e')](_0x516fde['where'],{'$or':_['map'](_0x516fde['attributes'],function(_0x23aed8){var _0x15b53f={};_0x15b53f[_0x23aed8]={'$like':'%'+_0x151b07[_0xfa02('0x34')][_0xfa02('0x3d')]+'%'};return _0x15b53f;})});}_0x516fde=_[_0xfa02('0x3e')]({},_0x516fde,_0x151b07[_0xfa02('0x40')]);return _0x48ecb2[_0xfa02('0x4a')](_0x516fde);}})[_0xfa02('0x25')](function(_0x3f4a4c){if(_0x3f4a4c){_0x4791e7=_0x3f4a4c[_0xfa02('0x45')];if(!_0x151b07[_0xfa02('0x34')][_0xfa02('0x37')](_0xfa02('0x38'))){_0x516fde[_0xfa02('0x1c')]=qs['limit'](_0x151b07[_0xfa02('0x34')]['limit']);_0x516fde[_0xfa02('0x1d')]=qs['offset'](_0x151b07[_0xfa02('0x34')][_0xfa02('0x1d')]);}return _0x48ecb2[_0xfa02('0x4a')](_0x516fde);}})['then'](function(_0x5d8ae1){if(_0x5d8ae1){return _0x5d8ae1?{'count':_0x4791e7,'rows':_0x5d8ae1}:null;}})['then'](respondWithResult(_0x4cc70a,null))[_0xfa02('0x49')](handleError(_0x4cc70a,null));};exports['getSubjects']=function(_0x100ef2,_0x24b2fe,_0x275c3e){var _0x48fd0c={};var _0x20d9ca={};var _0x3c8d0d;var _0x111966;return db[_0xfa02('0x2b')][_0xfa02('0x4b')]({'where':{'id':_0x100ef2[_0xfa02('0x44')]['id']}})[_0xfa02('0x25')](handleEntityNotFound(_0x24b2fe,null))[_0xfa02('0x25')](function(_0x298619){if(_0x298619){_0x3c8d0d=_0x298619;_0x20d9ca['model']=_['keys'](db[_0xfa02('0x4c')][_0xfa02('0x2c')]);_0x20d9ca[_0xfa02('0x34')]=_[_0xfa02('0x30')](_0x100ef2[_0xfa02('0x34')]);_0x20d9ca[_0xfa02('0x31')]=_[_0xfa02('0x32')](_0x20d9ca[_0xfa02('0x33')],_0x20d9ca[_0xfa02('0x34')]);_0x48fd0c['attributes']=_['intersection'](_0x20d9ca['model'],qs[_0xfa02('0x36')](_0x100ef2[_0xfa02('0x34')][_0xfa02('0x36')]));_0x48fd0c['attributes']=_0x48fd0c[_0xfa02('0x35')][_0xfa02('0x45')]?_0x48fd0c[_0xfa02('0x35')]:_0x20d9ca[_0xfa02('0x33')];_0x48fd0c[_0xfa02('0x39')]=qs[_0xfa02('0x3a')](_0x100ef2['query'][_0xfa02('0x3a')]);_0x48fd0c[_0xfa02('0x3b')]=qs['filters'](_['pick'](_0x100ef2[_0xfa02('0x34')],_0x20d9ca[_0xfa02('0x31')]));if(_0x100ef2[_0xfa02('0x34')]['filter']){_0x48fd0c[_0xfa02('0x3b')]=_[_0xfa02('0x3e')](_0x48fd0c[_0xfa02('0x3b')],{'$or':_[_0xfa02('0x2f')](_0x48fd0c[_0xfa02('0x35')],function(_0x326c4f){var _0x776627={};_0x776627[_0x326c4f]={'$like':'%'+_0x100ef2[_0xfa02('0x34')][_0xfa02('0x3d')]+'%'};return _0x776627;})});}_0x48fd0c=_['merge']({},_0x48fd0c,_0x100ef2[_0xfa02('0x40')]);return _0x3c8d0d[_0xfa02('0x4d')](_0x48fd0c);}})[_0xfa02('0x25')](function(_0x30b653){if(_0x30b653){_0x111966=_0x30b653['length'];if(!_0x100ef2[_0xfa02('0x34')][_0xfa02('0x37')](_0xfa02('0x38'))){_0x48fd0c[_0xfa02('0x1c')]=qs['limit'](_0x100ef2['query']['limit']);_0x48fd0c['offset']=qs[_0xfa02('0x1d')](_0x100ef2[_0xfa02('0x34')][_0xfa02('0x1d')]);}return _0x3c8d0d['getSubjects'](_0x48fd0c);}})['then'](function(_0x133ba6){if(_0x133ba6){return _0x133ba6?{'count':_0x111966,'rows':_0x133ba6}:null;}})['then'](respondWithResult(_0x24b2fe,null))['catch'](handleError(_0x24b2fe,null));};exports[_0xfa02('0x4e')]=function(_0x14f319,_0x40e125,_0x209e41){var _0x53d831={};var _0x540366={};var _0x3db1be;var _0x36edc6;return db[_0xfa02('0x2b')][_0xfa02('0x4b')]({'where':{'id':_0x14f319['params']['id']}})[_0xfa02('0x25')](handleEntityNotFound(_0x40e125,null))['then'](function(_0x18bdf3){if(_0x18bdf3){_0x3db1be=_0x18bdf3;_0x540366[_0xfa02('0x33')]=_['keys'](db[_0xfa02('0x4c')][_0xfa02('0x2c')]);_0x540366['query']=_['keys'](_0x14f319['query']);_0x540366[_0xfa02('0x31')]=_[_0xfa02('0x32')](_0x540366[_0xfa02('0x33')],_0x540366[_0xfa02('0x34')]);_0x53d831[_0xfa02('0x35')]=_['intersection'](_0x540366['model'],qs['fields'](_0x14f319['query'][_0xfa02('0x36')]));_0x53d831['attributes']=_0x53d831[_0xfa02('0x35')][_0xfa02('0x45')]?_0x53d831['attributes']:_0x540366[_0xfa02('0x33')];_0x53d831[_0xfa02('0x39')]=qs['sort'](_0x14f319['query'][_0xfa02('0x3a')]);_0x53d831[_0xfa02('0x3b')]=qs[_0xfa02('0x31')](_[_0xfa02('0x3c')](_0x14f319[_0xfa02('0x34')],_0x540366[_0xfa02('0x31')]));if(_0x14f319['query'][_0xfa02('0x3d')]){_0x53d831[_0xfa02('0x3b')]=_[_0xfa02('0x3e')](_0x53d831[_0xfa02('0x3b')],{'$or':_[_0xfa02('0x2f')](_0x53d831['attributes'],function(_0x3807b4){var _0x6c9a63={};_0x6c9a63[_0x3807b4]={'$like':'%'+_0x14f319[_0xfa02('0x34')][_0xfa02('0x3d')]+'%'};return _0x6c9a63;})});}_0x53d831=_[_0xfa02('0x3e')]({},_0x53d831,_0x14f319[_0xfa02('0x40')]);return _0x3db1be['getDescriptions'](_0x53d831);}})[_0xfa02('0x25')](function(_0x345f69){if(_0x345f69){_0x36edc6=_0x345f69[_0xfa02('0x45')];if(!_0x14f319[_0xfa02('0x34')][_0xfa02('0x37')](_0xfa02('0x38'))){_0x53d831[_0xfa02('0x1c')]=qs[_0xfa02('0x1c')](_0x14f319[_0xfa02('0x34')][_0xfa02('0x1c')]);_0x53d831[_0xfa02('0x1d')]=qs[_0xfa02('0x1d')](_0x14f319['query'][_0xfa02('0x1d')]);}return _0x3db1be[_0xfa02('0x4e')](_0x53d831);}})['then'](function(_0x19a497){if(_0x19a497){return _0x19a497?{'count':_0x36edc6,'rows':_0x19a497}:null;}})['then'](respondWithResult(_0x40e125,null))[_0xfa02('0x49')](handleError(_0x40e125,null));}; \ No newline at end of file +var _0xd49c=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','key','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','type','options','includeAll','findAll','catch','params','find','create','body','SugarcrmField','order','pick','filter','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x3ad73e,_0x2769f5){var _0x61f0cb=function(_0x40057a){while(--_0x40057a){_0x3ad73e['push'](_0x3ad73e['shift']());}};_0x61f0cb(++_0x2769f5);}(_0xd49c,0xe9));var _0xcd49=function(_0x36cd01,_0x1c95ae){_0x36cd01=_0x36cd01-0x0;var _0x3c6323=_0xd49c[_0x36cd01];return _0x3c6323;};'use strict';var emlformat=require(_0xcd49('0x0'));var rimraf=require(_0xcd49('0x1'));var zipdir=require(_0xcd49('0x2'));var jsonpatch=require(_0xcd49('0x3'));var rp=require(_0xcd49('0x4'));var moment=require(_0xcd49('0x5'));var BPromise=require(_0xcd49('0x6'));var Mustache=require(_0xcd49('0x7'));var util=require('util');var path=require(_0xcd49('0x8'));var sox=require(_0xcd49('0x9'));var csv=require(_0xcd49('0xa'));var ejs=require(_0xcd49('0xb'));var fs=require('fs');var fs_extra=require(_0xcd49('0xc'));var _=require('lodash');var squel=require(_0xcd49('0xd'));var crypto=require(_0xcd49('0xe'));var jsforce=require(_0xcd49('0xf'));var deskjs=require(_0xcd49('0x10'));var toCsv=require(_0xcd49('0xa'));var querystring=require(_0xcd49('0x11'));var Papa=require(_0xcd49('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd49('0x13'));var as=require(_0xcd49('0x14'));var hardwareService=require(_0xcd49('0x15'));var logger=require(_0xcd49('0x16'))(_0xcd49('0x17'));var utils=require(_0xcd49('0x18'));var config=require(_0xcd49('0x19'));var licenseUtil=require(_0xcd49('0x1a'));var db=require(_0xcd49('0x1b'))['db'];function respondWithStatusCode(_0x443f8e,_0x418e4b){_0x418e4b=_0x418e4b||0xcc;return function(_0x42f5ba){if(_0x42f5ba){return _0x443f8e[_0xcd49('0x1c')](_0x418e4b);}return _0x443f8e[_0xcd49('0x1d')](_0x418e4b)[_0xcd49('0x1e')]();};}function respondWithResult(_0x5bd7cd,_0x16efe5){_0x16efe5=_0x16efe5||0xc8;return function(_0x249716){if(_0x249716){return _0x5bd7cd['status'](_0x16efe5)[_0xcd49('0x1f')](_0x249716);}};}function respondWithFilteredResult(_0x1a0c8f,_0x3b2c4a){return function(_0xf5f343){if(_0xf5f343){var _0x2a4f8a=typeof _0x3b2c4a['offset']===_0xcd49('0x20')&&typeof _0x3b2c4a['limit']===_0xcd49('0x20');var _0x3394cd=_0xf5f343[_0xcd49('0x21')];var _0x2dca11=_0x2a4f8a?0x0:_0x3b2c4a['offset'];var _0x46c7c3=_0x2a4f8a?_0xf5f343[_0xcd49('0x21')]:_0x3b2c4a[_0xcd49('0x22')]+_0x3b2c4a[_0xcd49('0x23')];var _0x39fbe6;if(_0x46c7c3>=_0x3394cd){_0x46c7c3=_0x3394cd;_0x39fbe6=0xc8;}else{_0x39fbe6=0xce;}_0x1a0c8f[_0xcd49('0x1d')](_0x39fbe6);return _0x1a0c8f['set'](_0xcd49('0x24'),_0x2dca11+'-'+_0x46c7c3+'/'+_0x3394cd)['json'](_0xf5f343);}return null;};}function patchUpdates(_0x3674bb){return function(_0x345c03){try{jsonpatch[_0xcd49('0x25')](_0x345c03,_0x3674bb,!![]);}catch(_0x64be06){return BPromise[_0xcd49('0x26')](_0x64be06);}return _0x345c03['save']();};}function saveUpdates(_0x51e7ad,_0x3ff4fd){return function(_0x2b6332){if(_0x2b6332){return _0x2b6332[_0xcd49('0x27')](_0x51e7ad)['then'](function(_0x229e70){return _0x229e70;});}return null;};}function removeEntity(_0xf09fc2,_0x5e7b65){return function(_0x472201){if(_0x472201){return _0x472201[_0xcd49('0x28')]()[_0xcd49('0x29')](function(){_0xf09fc2[_0xcd49('0x1d')](0xcc)[_0xcd49('0x1e')]();});}};}function handleEntityNotFound(_0xe0a445,_0x109ae2){return function(_0x1baf44){if(!_0x1baf44){_0xe0a445[_0xcd49('0x1c')](0x194);}return _0x1baf44;};}function handleError(_0xcc4977,_0x32b28b){_0x32b28b=_0x32b28b||0x1f4;return function(_0x431768){logger[_0xcd49('0x2a')](_0x431768[_0xcd49('0x2b')]);if(_0x431768[_0xcd49('0x2c')]){delete _0x431768[_0xcd49('0x2c')];}_0xcc4977[_0xcd49('0x1d')](_0x32b28b)[_0xcd49('0x2d')](_0x431768);};}exports[_0xcd49('0x2e')]=function(_0x339127,_0x2ba0b7){var _0x56a679={},_0x1f0f45={},_0x1a59dd={'count':0x0,'rows':[]};var _0x33c889=_['map'](db[_0xcd49('0x2f')][_0xcd49('0x30')],function(_0x1f5f59){return{'name':_0x1f5f59['fieldName'],'type':_0x1f5f59['type'][_0xcd49('0x31')]};});_0x1f0f45['model']=_[_0xcd49('0x32')](_0x33c889,_0xcd49('0x2c'));_0x1f0f45[_0xcd49('0x33')]=_[_0xcd49('0x34')](_0x339127[_0xcd49('0x33')]);_0x1f0f45[_0xcd49('0x35')]=_['intersection'](_0x1f0f45[_0xcd49('0x36')],_0x1f0f45['query']);_0x56a679['attributes']=_[_0xcd49('0x37')](_0x1f0f45['model'],qs[_0xcd49('0x38')](_0x339127[_0xcd49('0x33')][_0xcd49('0x38')]));_0x56a679[_0xcd49('0x39')]=_0x56a679[_0xcd49('0x39')][_0xcd49('0x3a')]?_0x56a679['attributes']:_0x1f0f45[_0xcd49('0x36')];if(!_0x339127[_0xcd49('0x33')][_0xcd49('0x3b')](_0xcd49('0x3c'))){_0x56a679[_0xcd49('0x23')]=qs[_0xcd49('0x23')](_0x339127[_0xcd49('0x33')]['limit']);_0x56a679[_0xcd49('0x22')]=qs[_0xcd49('0x22')](_0x339127[_0xcd49('0x33')][_0xcd49('0x22')]);}_0x56a679['order']=qs['sort'](_0x339127['query'][_0xcd49('0x3d')]);_0x56a679[_0xcd49('0x3e')]=qs['filters'](_['pick'](_0x339127[_0xcd49('0x33')],_0x1f0f45[_0xcd49('0x35')]),_0x33c889);if(_0x339127[_0xcd49('0x33')]['filter']){_0x56a679[_0xcd49('0x3e')]=_[_0xcd49('0x3f')](_0x56a679['where'],{'$or':_[_0xcd49('0x32')](_0x33c889,function(_0x4505b9){if(_0x4505b9[_0xcd49('0x40')]!=='VIRTUAL'){var _0x2b927b={};_0x2b927b[_0x4505b9[_0xcd49('0x2c')]]={'$like':'%'+_0x339127[_0xcd49('0x33')]['filter']+'%'};return _0x2b927b;}})});}_0x56a679=_[_0xcd49('0x3f')]({},_0x56a679,_0x339127[_0xcd49('0x41')]);var _0x482299={'where':_0x56a679[_0xcd49('0x3e')]};return db[_0xcd49('0x2f')]['count'](_0x482299)[_0xcd49('0x29')](function(_0x1220c2){_0x1a59dd[_0xcd49('0x21')]=_0x1220c2;if(_0x339127[_0xcd49('0x33')][_0xcd49('0x42')]){_0x56a679['include']=[{'all':!![]}];}return db[_0xcd49('0x2f')][_0xcd49('0x43')](_0x56a679);})[_0xcd49('0x29')](function(_0x4fb76f){_0x1a59dd['rows']=_0x4fb76f;return _0x1a59dd;})[_0xcd49('0x29')](respondWithFilteredResult(_0x2ba0b7,_0x56a679))[_0xcd49('0x44')](handleError(_0x2ba0b7,null));};exports['show']=function(_0x577d19,_0xb1e4c1){var _0x2d20d9={'raw':![],'where':{'id':_0x577d19[_0xcd49('0x45')]['id']}},_0x3069b2={};_0x3069b2[_0xcd49('0x36')]=_['keys'](db[_0xcd49('0x2f')][_0xcd49('0x30')]);_0x3069b2['query']=_['keys'](_0x577d19[_0xcd49('0x33')]);_0x3069b2['filters']=_['intersection'](_0x3069b2[_0xcd49('0x36')],_0x3069b2[_0xcd49('0x33')]);_0x2d20d9[_0xcd49('0x39')]=_[_0xcd49('0x37')](_0x3069b2[_0xcd49('0x36')],qs[_0xcd49('0x38')](_0x577d19[_0xcd49('0x33')][_0xcd49('0x38')]));_0x2d20d9['attributes']=_0x2d20d9[_0xcd49('0x39')][_0xcd49('0x3a')]?_0x2d20d9[_0xcd49('0x39')]:_0x3069b2['model'];if(_0x577d19[_0xcd49('0x33')][_0xcd49('0x42')]){_0x2d20d9['include']=[{'all':!![]}];}_0x2d20d9=_['merge']({},_0x2d20d9,_0x577d19[_0xcd49('0x41')]);return db['SugarcrmConfiguration'][_0xcd49('0x46')](_0x2d20d9)['then'](handleEntityNotFound(_0xb1e4c1,null))[_0xcd49('0x29')](respondWithResult(_0xb1e4c1,null))['catch'](handleError(_0xb1e4c1,null));};exports[_0xcd49('0x47')]=function(_0x479646,_0x213e72){return db['SugarcrmConfiguration'][_0xcd49('0x47')](_0x479646[_0xcd49('0x48')],{})['then'](respondWithResult(_0x213e72,0xc9))[_0xcd49('0x44')](handleError(_0x213e72,null));};exports[_0xcd49('0x27')]=function(_0xaeca1,_0x3a3208){if(_0xaeca1[_0xcd49('0x48')]['id']){delete _0xaeca1[_0xcd49('0x48')]['id'];}return db[_0xcd49('0x2f')][_0xcd49('0x46')]({'where':{'id':_0xaeca1[_0xcd49('0x45')]['id']}})[_0xcd49('0x29')](handleEntityNotFound(_0x3a3208,null))['then'](saveUpdates(_0xaeca1[_0xcd49('0x48')],null))[_0xcd49('0x29')](respondWithResult(_0x3a3208,null))[_0xcd49('0x44')](handleError(_0x3a3208,null));};exports[_0xcd49('0x28')]=function(_0x4fb163,_0x4f82cf){return db[_0xcd49('0x2f')]['find']({'where':{'id':_0x4fb163['params']['id']}})[_0xcd49('0x29')](handleEntityNotFound(_0x4f82cf,null))['then'](removeEntity(_0x4f82cf,null))['catch'](handleError(_0x4f82cf,null));};exports['getFields']=function(_0xdae541,_0x13a5fb,_0x24a59c){var _0x5ede8e={};var _0x35b2ff={};var _0x142d70;var _0x3e2e8a;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0xdae541[_0xcd49('0x45')]['id']}})[_0xcd49('0x29')](handleEntityNotFound(_0x13a5fb,null))['then'](function(_0x79efe4){if(_0x79efe4){_0x142d70=_0x79efe4;_0x35b2ff[_0xcd49('0x36')]=_['keys'](db[_0xcd49('0x49')]['rawAttributes']);_0x35b2ff['query']=_[_0xcd49('0x34')](_0xdae541[_0xcd49('0x33')]);_0x35b2ff[_0xcd49('0x35')]=_['intersection'](_0x35b2ff[_0xcd49('0x36')],_0x35b2ff['query']);_0x5ede8e[_0xcd49('0x39')]=_[_0xcd49('0x37')](_0x35b2ff[_0xcd49('0x36')],qs['fields'](_0xdae541[_0xcd49('0x33')][_0xcd49('0x38')]));_0x5ede8e[_0xcd49('0x39')]=_0x5ede8e[_0xcd49('0x39')]['length']?_0x5ede8e[_0xcd49('0x39')]:_0x35b2ff[_0xcd49('0x36')];_0x5ede8e[_0xcd49('0x4a')]=qs['sort'](_0xdae541['query'][_0xcd49('0x3d')]);_0x5ede8e[_0xcd49('0x3e')]=qs[_0xcd49('0x35')](_[_0xcd49('0x4b')](_0xdae541['query'],_0x35b2ff[_0xcd49('0x35')]));if(_0xdae541[_0xcd49('0x33')]['filter']){_0x5ede8e[_0xcd49('0x3e')]=_['merge'](_0x5ede8e[_0xcd49('0x3e')],{'$or':_[_0xcd49('0x32')](_0x5ede8e[_0xcd49('0x39')],function(_0x59254f){var _0x544e81={};_0x544e81[_0x59254f]={'$like':'%'+_0xdae541['query'][_0xcd49('0x4c')]+'%'};return _0x544e81;})});}_0x5ede8e=_[_0xcd49('0x3f')]({},_0x5ede8e,_0xdae541['options']);return _0x142d70[_0xcd49('0x4d')](_0x5ede8e);}})[_0xcd49('0x29')](function(_0x4f958f){if(_0x4f958f){_0x3e2e8a=_0x4f958f[_0xcd49('0x3a')];if(!_0xdae541[_0xcd49('0x33')][_0xcd49('0x3b')](_0xcd49('0x3c'))){_0x5ede8e['limit']=qs[_0xcd49('0x23')](_0xdae541[_0xcd49('0x33')]['limit']);_0x5ede8e[_0xcd49('0x22')]=qs[_0xcd49('0x22')](_0xdae541[_0xcd49('0x33')]['offset']);}return _0x142d70['getFields'](_0x5ede8e);}})[_0xcd49('0x29')](function(_0x430a2e){if(_0x430a2e){return _0x430a2e?{'count':_0x3e2e8a,'rows':_0x430a2e}:null;}})['then'](respondWithResult(_0x13a5fb,null))[_0xcd49('0x44')](handleError(_0x13a5fb,null));};exports[_0xcd49('0x4e')]=function(_0x25d68f,_0x1b0ac3,_0x3fa1fc){var _0x1194d6={};var _0x1ef31e={};var _0x43fb94;var _0x33616f;return db[_0xcd49('0x2f')][_0xcd49('0x4f')]({'where':{'id':_0x25d68f[_0xcd49('0x45')]['id']}})[_0xcd49('0x29')](handleEntityNotFound(_0x1b0ac3,null))[_0xcd49('0x29')](function(_0xfd5754){if(_0xfd5754){_0x43fb94=_0xfd5754;_0x1ef31e[_0xcd49('0x36')]=_['keys'](db[_0xcd49('0x49')][_0xcd49('0x30')]);_0x1ef31e[_0xcd49('0x33')]=_[_0xcd49('0x34')](_0x25d68f[_0xcd49('0x33')]);_0x1ef31e[_0xcd49('0x35')]=_['intersection'](_0x1ef31e['model'],_0x1ef31e[_0xcd49('0x33')]);_0x1194d6[_0xcd49('0x39')]=_[_0xcd49('0x37')](_0x1ef31e[_0xcd49('0x36')],qs[_0xcd49('0x38')](_0x25d68f[_0xcd49('0x33')][_0xcd49('0x38')]));_0x1194d6['attributes']=_0x1194d6['attributes'][_0xcd49('0x3a')]?_0x1194d6[_0xcd49('0x39')]:_0x1ef31e[_0xcd49('0x36')];_0x1194d6[_0xcd49('0x4a')]=qs['sort'](_0x25d68f[_0xcd49('0x33')][_0xcd49('0x3d')]);_0x1194d6[_0xcd49('0x3e')]=qs[_0xcd49('0x35')](_[_0xcd49('0x4b')](_0x25d68f['query'],_0x1ef31e[_0xcd49('0x35')]));if(_0x25d68f[_0xcd49('0x33')][_0xcd49('0x4c')]){_0x1194d6[_0xcd49('0x3e')]=_[_0xcd49('0x3f')](_0x1194d6[_0xcd49('0x3e')],{'$or':_[_0xcd49('0x32')](_0x1194d6['attributes'],function(_0xbec1ff){var _0x3fd165={};_0x3fd165[_0xbec1ff]={'$like':'%'+_0x25d68f[_0xcd49('0x33')][_0xcd49('0x4c')]+'%'};return _0x3fd165;})});}_0x1194d6=_[_0xcd49('0x3f')]({},_0x1194d6,_0x25d68f[_0xcd49('0x41')]);return _0x43fb94[_0xcd49('0x4e')](_0x1194d6);}})['then'](function(_0x42832c){if(_0x42832c){_0x33616f=_0x42832c[_0xcd49('0x3a')];if(!_0x25d68f[_0xcd49('0x33')][_0xcd49('0x3b')](_0xcd49('0x3c'))){_0x1194d6[_0xcd49('0x23')]=qs[_0xcd49('0x23')](_0x25d68f[_0xcd49('0x33')]['limit']);_0x1194d6[_0xcd49('0x22')]=qs[_0xcd49('0x22')](_0x25d68f[_0xcd49('0x33')][_0xcd49('0x22')]);}return _0x43fb94[_0xcd49('0x4e')](_0x1194d6);}})[_0xcd49('0x29')](function(_0x541bce){if(_0x541bce){return _0x541bce?{'count':_0x33616f,'rows':_0x541bce}:null;}})[_0xcd49('0x29')](respondWithResult(_0x1b0ac3,null))[_0xcd49('0x44')](handleError(_0x1b0ac3,null));};exports[_0xcd49('0x50')]=function(_0x99e76d,_0x52c060,_0x5765ba){var _0x54d07a={};var _0x13a6e2={};var _0x1b6146;var _0x230f9;return db['SugarcrmConfiguration'][_0xcd49('0x4f')]({'where':{'id':_0x99e76d['params']['id']}})[_0xcd49('0x29')](handleEntityNotFound(_0x52c060,null))[_0xcd49('0x29')](function(_0xa51bdb){if(_0xa51bdb){_0x1b6146=_0xa51bdb;_0x13a6e2[_0xcd49('0x36')]=_[_0xcd49('0x34')](db[_0xcd49('0x49')][_0xcd49('0x30')]);_0x13a6e2[_0xcd49('0x33')]=_['keys'](_0x99e76d[_0xcd49('0x33')]);_0x13a6e2[_0xcd49('0x35')]=_['intersection'](_0x13a6e2[_0xcd49('0x36')],_0x13a6e2[_0xcd49('0x33')]);_0x54d07a[_0xcd49('0x39')]=_[_0xcd49('0x37')](_0x13a6e2[_0xcd49('0x36')],qs['fields'](_0x99e76d[_0xcd49('0x33')][_0xcd49('0x38')]));_0x54d07a[_0xcd49('0x39')]=_0x54d07a[_0xcd49('0x39')][_0xcd49('0x3a')]?_0x54d07a[_0xcd49('0x39')]:_0x13a6e2[_0xcd49('0x36')];_0x54d07a[_0xcd49('0x4a')]=qs['sort'](_0x99e76d[_0xcd49('0x33')][_0xcd49('0x3d')]);_0x54d07a['where']=qs[_0xcd49('0x35')](_[_0xcd49('0x4b')](_0x99e76d[_0xcd49('0x33')],_0x13a6e2[_0xcd49('0x35')]));if(_0x99e76d[_0xcd49('0x33')][_0xcd49('0x4c')]){_0x54d07a[_0xcd49('0x3e')]=_['merge'](_0x54d07a[_0xcd49('0x3e')],{'$or':_[_0xcd49('0x32')](_0x54d07a[_0xcd49('0x39')],function(_0x4d4c7d){var _0x27933e={};_0x27933e[_0x4d4c7d]={'$like':'%'+_0x99e76d[_0xcd49('0x33')]['filter']+'%'};return _0x27933e;})});}_0x54d07a=_[_0xcd49('0x3f')]({},_0x54d07a,_0x99e76d[_0xcd49('0x41')]);return _0x1b6146[_0xcd49('0x50')](_0x54d07a);}})[_0xcd49('0x29')](function(_0x246c25){if(_0x246c25){_0x230f9=_0x246c25[_0xcd49('0x3a')];if(!_0x99e76d[_0xcd49('0x33')]['hasOwnProperty'](_0xcd49('0x3c'))){_0x54d07a[_0xcd49('0x23')]=qs['limit'](_0x99e76d[_0xcd49('0x33')][_0xcd49('0x23')]);_0x54d07a[_0xcd49('0x22')]=qs[_0xcd49('0x22')](_0x99e76d[_0xcd49('0x33')][_0xcd49('0x22')]);}return _0x1b6146[_0xcd49('0x50')](_0x54d07a);}})[_0xcd49('0x29')](function(_0x5084d7){if(_0x5084d7){return _0x5084d7?{'count':_0x230f9,'rows':_0x5084d7}:null;}})['then'](respondWithResult(_0x52c060,null))['catch'](handleError(_0x52c060,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 4fee6f2..beb84fb 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 _0xa2a2=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','moment','bluebird','path'];(function(_0x55f3c6,_0x516900){var _0x25d0c2=function(_0x3741c0){while(--_0x3741c0){_0x55f3c6['push'](_0x55f3c6['shift']());}};_0x25d0c2(++_0x516900);}(_0xa2a2,0x71));var _0x2a2a=function(_0x5784f1,_0x7520ff){_0x5784f1=_0x5784f1-0x0;var _0x173e6b=_0xa2a2[_0x5784f1];return _0x173e6b;};'use strict';var _=require(_0x2a2a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2a2a('0x1'));var BPromise=require(_0x2a2a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a2a('0x3'));var rimraf=require('rimraf');var config=require(_0x2a2a('0x4'));var attributes=require(_0x2a2a('0x5'));module[_0x2a2a('0x6')]=function(_0x172ead,_0x5dc64f){return _0x172ead['define'](_0x2a2a('0x7'),attributes,{'tableName':_0x2a2a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39fa=['int_sugarcrm_configurations','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x39fa,0x198));var _0xa39f=function(_0x4d8d78,_0x37d78b){_0x4d8d78=_0x4d8d78-0x0;var _0x4c69bb=_0x39fa[_0x4d8d78];return _0x4c69bb;};'use strict';var _=require(_0xa39f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa39f('0x1'));var BPromise=require(_0xa39f('0x2'));var rp=require(_0xa39f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa39f('0x4'));var config=require(_0xa39f('0x5'));var attributes=require(_0xa39f('0x6'));module[_0xa39f('0x7')]=function(_0x10c8b6,_0x169e1f){return _0x10c8b6[_0xa39f('0x8')](_0xa39f('0x9'),attributes,{'tableName':_0xa39f('0xa'),'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 a0907fd..756e819 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 _0xf2b6=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xf2b6,0x95));var _0x6f2b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf2b6[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x6f2b('0x0'));var util=require(_0x6f2b('0x1'));var moment=require(_0x6f2b('0x2'));var BPromise=require(_0x6f2b('0x3'));var rs=require(_0x6f2b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f2b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f2b('0x6'))(_0x6f2b('0x7'));var config=require(_0x6f2b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6f2b('0x9')][_0x6f2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e3ec,_0xc2b612,_0xacac62){return new BPromise(function(_0x111ebd,_0x54dfc5){return client['request'](_0x19e3ec,_0xacac62)[_0x6f2b('0xb')](function(_0x5b160c){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0xc2b612,'request\x20sent');logger[_0x6f2b('0xc')](_0x6f2b('0xd'),_0xc2b612,_0x6f2b('0xe'),JSON[_0x6f2b('0xf')](_0x5b160c));if(_0x5b160c[_0x6f2b('0x10')]){if(_0x5b160c[_0x6f2b('0x10')][_0x6f2b('0x11')]===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0xc2b612,_0x5b160c['error'][_0x6f2b('0x12')]);return _0x54dfc5(_0x5b160c['error'][_0x6f2b('0x12')]);}logger[_0x6f2b('0x10')](_0x6f2b('0x13'),_0xc2b612,_0x5b160c['error']['message']);return _0x111ebd(_0x5b160c['error'][_0x6f2b('0x12')]);}else{logger[_0x6f2b('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xc2b612,_0x6f2b('0xe'));_0x111ebd(_0x5b160c['result'][_0x6f2b('0x12')]);}})[_0x6f2b('0x15')](function(_0x20eae8){logger[_0x6f2b('0x10')](_0x6f2b('0x13'),_0xc2b612,_0x20eae8);_0x54dfc5(_0x20eae8);});});} \ No newline at end of file +var _0x950f=['message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x19e366,_0x165905){var _0x45d885=function(_0x1c8686){while(--_0x1c8686){_0x19e366['push'](_0x19e366['shift']());}};_0x45d885(++_0x165905);}(_0x950f,0x7f));var _0xf950=function(_0x1d3046,_0x8b14e1){_0x1d3046=_0x1d3046-0x0;var _0x3b9b62=_0x950f[_0x1d3046];return _0x3b9b62;};'use strict';var _=require(_0xf950('0x0'));var util=require('util');var moment=require(_0xf950('0x1'));var BPromise=require(_0xf950('0x2'));var rs=require(_0xf950('0x3'));var fs=require('fs');var Redis=require(_0xf950('0x4'));var db=require(_0xf950('0x5'))['db'];var utils=require(_0xf950('0x6'));var logger=require(_0xf950('0x7'))(_0xf950('0x8'));var config=require(_0xf950('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf950('0xa')][_0xf950('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d4367,_0x43eff8,_0x4cc25d){return new BPromise(function(_0x5322e7,_0xcc7bc6){return client[_0xf950('0xc')](_0x5d4367,_0x4cc25d)[_0xf950('0xd')](function(_0x1a20eb){logger[_0xf950('0xe')](_0xf950('0xf'),_0x43eff8,_0xf950('0x10'));logger[_0xf950('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x43eff8,_0xf950('0x10'),JSON['stringify'](_0x1a20eb));if(_0x1a20eb[_0xf950('0x12')]){if(_0x1a20eb[_0xf950('0x12')][_0xf950('0x13')]===0x1f4){logger[_0xf950('0x12')](_0xf950('0xf'),_0x43eff8,_0x1a20eb[_0xf950('0x12')][_0xf950('0x14')]);return _0xcc7bc6(_0x1a20eb[_0xf950('0x12')]['message']);}logger[_0xf950('0x12')](_0xf950('0xf'),_0x43eff8,_0x1a20eb[_0xf950('0x12')][_0xf950('0x14')]);return _0x5322e7(_0x1a20eb['error'][_0xf950('0x14')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x43eff8,'request\x20sent');_0x5322e7(_0x1a20eb['result'][_0xf950('0x14')]);}})['catch'](function(_0x4557c7){logger[_0xf950('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x43eff8,_0x4557c7);_0xcc7bc6(_0x4557c7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 9c92a04..5d44e19 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 _0xeaee=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports'];(function(_0x16252d,_0xaad177){var _0xeb5dd5=function(_0x4852fd){while(--_0x4852fd){_0x16252d['push'](_0x16252d['shift']());}};_0xeb5dd5(++_0xaad177);}(_0xeaee,0x168));var _0xeeae=function(_0xdab5cb,_0x20eb4b){_0xdab5cb=_0xdab5cb-0x0;var _0x2c14a0=_0xeaee[_0xdab5cb];return _0x2c14a0;};'use strict';var multer=require(_0xeeae('0x0'));var util=require(_0xeeae('0x1'));var path=require('path');var timeout=require(_0xeeae('0x2'));var express=require(_0xeeae('0x3'));var router=express[_0xeeae('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xeeae('0x5'));var interaction=require(_0xeeae('0x6'));var config=require('../../config/environment');var controller=require(_0xeeae('0x7'));router[_0xeeae('0x8')]('/',auth[_0xeeae('0x9')](),controller[_0xeeae('0xa')]);router[_0xeeae('0x8')](_0xeeae('0xb'),auth[_0xeeae('0x9')](),controller['show']);router['post']('/',auth[_0xeeae('0x9')](),controller[_0xeeae('0xc')]);router[_0xeeae('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xeeae('0xe')]);router[_0xeeae('0xf')](_0xeeae('0xb'),auth[_0xeeae('0x9')](),controller[_0xeeae('0x10')]);module[_0xeeae('0x11')]=router; \ No newline at end of file +var _0x34cb=['multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','show','post','create','/:id','delete','destroy','exports'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0x34cb,0xd0));var _0xb34c=function(_0x3e33f5,_0x8e014b){_0x3e33f5=_0x3e33f5-0x0;var _0x148421=_0x34cb[_0x3e33f5];return _0x148421;};'use strict';var multer=require(_0xb34c('0x0'));var util=require(_0xb34c('0x1'));var path=require('path');var timeout=require(_0xb34c('0x2'));var express=require(_0xb34c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb34c('0x4'));var config=require(_0xb34c('0x5'));var controller=require(_0xb34c('0x6'));router[_0xb34c('0x7')]('/',auth[_0xb34c('0x8')](),controller['index']);router[_0xb34c('0x7')]('/:id',auth[_0xb34c('0x8')](),controller[_0xb34c('0x9')]);router[_0xb34c('0xa')]('/',auth[_0xb34c('0x8')](),controller[_0xb34c('0xb')]);router['put'](_0xb34c('0xc'),auth[_0xb34c('0x8')](),controller['update']);router[_0xb34c('0xd')](_0xb34c('0xc'),auth[_0xb34c('0x8')](),controller[_0xb34c('0xe')]);module[_0xb34c('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index eb74f3b..d83d52f 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 _0x3b3b=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x2f3738,_0x115a52){var _0x3dfa2c=function(_0x91434d){while(--_0x91434d){_0x2f3738['push'](_0x2f3738['shift']());}};_0x3dfa2c(++_0x115a52);}(_0x3b3b,0x10f));var _0xb3b3=function(_0x1e8482,_0x4fadfc){_0x1e8482=_0x1e8482-0x0;var _0x1355b2=_0x3b3b[_0x1e8482];return _0x1355b2;};'use strict';var Sequelize=require(_0xb3b3('0x0'));module[_0xb3b3('0x1')]={'type':{'type':Sequelize[_0xb3b3('0x2')](_0xb3b3('0x3'),_0xb3b3('0x4'),_0xb3b3('0x5'),'keyValue',_0xb3b3('0x6')),'defaultValue':_0xb3b3('0x3')},'content':{'type':Sequelize[_0xb3b3('0x7')]},'key':{'type':Sequelize[_0xb3b3('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb3b3('0x3'),_0xb3b3('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xb3b3('0x7')]},'idField':{'type':Sequelize[_0xb3b3('0x7')]},'nameField':{'type':Sequelize[_0xb3b3('0x7')]},'customField':{'type':Sequelize[_0xb3b3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xafd3=['string','STRING','variable','BOOLEAN','exports','ENUM','customVariable','keyValue','picklist'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0xafd3,0xee));var _0x3afd=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0xafd3[_0x12d6c2];return _0x1c9825;};'use strict';var Sequelize=require('sequelize');module[_0x3afd('0x0')]={'type':{'type':Sequelize[_0x3afd('0x1')]('string','variable',_0x3afd('0x2'),_0x3afd('0x3'),_0x3afd('0x4')),'defaultValue':_0x3afd('0x5')},'content':{'type':Sequelize[_0x3afd('0x6')]},'key':{'type':Sequelize[_0x3afd('0x6')]},'keyType':{'type':Sequelize[_0x3afd('0x1')](_0x3afd('0x5'),_0x3afd('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3afd('0x6')]},'nameField':{'type':Sequelize[_0x3afd('0x6')]},'customField':{'type':Sequelize[_0x3afd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d635c33..5222e53 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 _0x29d6=['update','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','filters','pick','merge','where','type','VIRTUAL','filter','options','includeAll','include','catch','show','params','create','body','destroy','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../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','apply','save'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x29d6,0x70));var _0x629d=function(_0x57234a,_0x54e907){_0x57234a=_0x57234a-0x0;var _0x4b3d5f=_0x29d6[_0x57234a];return _0x4b3d5f;};'use strict';var emlformat=require(_0x629d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x629d('0x1'));var jsonpatch=require(_0x629d('0x2'));var rp=require(_0x629d('0x3'));var moment=require(_0x629d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x629d('0x5'));var util=require(_0x629d('0x6'));var path=require('path');var sox=require(_0x629d('0x7'));var csv=require(_0x629d('0x8'));var ejs=require(_0x629d('0x9'));var fs=require('fs');var fs_extra=require(_0x629d('0xa'));var _=require(_0x629d('0xb'));var squel=require(_0x629d('0xc'));var crypto=require(_0x629d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x629d('0xe'));var Papa=require(_0x629d('0xf'));var Redis=require(_0x629d('0x10'));var authService=require(_0x629d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x629d('0x12'));var hardwareService=require(_0x629d('0x13'));var logger=require(_0x629d('0x14'))('api');var utils=require(_0x629d('0x15'));var config=require(_0x629d('0x16'));var licenseUtil=require(_0x629d('0x17'));var db=require(_0x629d('0x18'))['db'];function respondWithStatusCode(_0x29dd24,_0x3ec257){_0x3ec257=_0x3ec257||0xcc;return function(_0x3a9eef){if(_0x3a9eef){return _0x29dd24[_0x629d('0x19')](_0x3ec257);}return _0x29dd24[_0x629d('0x1a')](_0x3ec257)[_0x629d('0x1b')]();};}function respondWithResult(_0x17c52f,_0x191a81){_0x191a81=_0x191a81||0xc8;return function(_0x25f29b){if(_0x25f29b){return _0x17c52f[_0x629d('0x1a')](_0x191a81)[_0x629d('0x1c')](_0x25f29b);}};}function respondWithFilteredResult(_0x22fef0,_0x14d1c8){return function(_0x1cf610){if(_0x1cf610){var _0x31ebaa=typeof _0x14d1c8[_0x629d('0x1d')]===_0x629d('0x1e')&&typeof _0x14d1c8[_0x629d('0x1f')]===_0x629d('0x1e');var _0x58c679=_0x1cf610['count'];var _0x1e9782=_0x31ebaa?0x0:_0x14d1c8[_0x629d('0x1d')];var _0x58811a=_0x31ebaa?_0x1cf610[_0x629d('0x20')]:_0x14d1c8['offset']+_0x14d1c8[_0x629d('0x1f')];var _0x3022e1;if(_0x58811a>=_0x58c679){_0x58811a=_0x58c679;_0x3022e1=0xc8;}else{_0x3022e1=0xce;}_0x22fef0['status'](_0x3022e1);return _0x22fef0[_0x629d('0x21')]('Content-Range',_0x1e9782+'-'+_0x58811a+'/'+_0x58c679)[_0x629d('0x1c')](_0x1cf610);}return null;};}function patchUpdates(_0x1fa233){return function(_0x1f6bf1){try{jsonpatch[_0x629d('0x22')](_0x1f6bf1,_0x1fa233,!![]);}catch(_0x540d70){return BPromise['reject'](_0x540d70);}return _0x1f6bf1[_0x629d('0x23')]();};}function saveUpdates(_0x2d9433,_0x1cfbd7){return function(_0x4ab5a5){if(_0x4ab5a5){return _0x4ab5a5[_0x629d('0x24')](_0x2d9433)[_0x629d('0x25')](function(_0x57e771){return _0x57e771;});}return null;};}function removeEntity(_0xbe198d,_0x448104){return function(_0x1fe0b0){if(_0x1fe0b0){return _0x1fe0b0['destroy']()[_0x629d('0x25')](function(){_0xbe198d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ba1f9,_0x3558b3){return function(_0x42ac27){if(!_0x42ac27){_0x1ba1f9['sendStatus'](0x194);}return _0x42ac27;};}function handleError(_0x19294a,_0x255315){_0x255315=_0x255315||0x1f4;return function(_0x4bb998){logger[_0x629d('0x26')](_0x4bb998[_0x629d('0x27')]);if(_0x4bb998[_0x629d('0x28')]){delete _0x4bb998['name'];}_0x19294a[_0x629d('0x1a')](_0x255315)[_0x629d('0x29')](_0x4bb998);};}exports[_0x629d('0x2a')]=function(_0x17b949,_0x434aba){var _0x31520b={},_0x1b452e={},_0x185833={'count':0x0,'rows':[]};var _0x5ac8ed=_[_0x629d('0x2b')](db[_0x629d('0x2c')][_0x629d('0x2d')],function(_0x2c0168){return{'name':_0x2c0168[_0x629d('0x2e')],'type':_0x2c0168['type']['key']};});_0x1b452e[_0x629d('0x2f')]=_[_0x629d('0x2b')](_0x5ac8ed,_0x629d('0x28'));_0x1b452e[_0x629d('0x30')]=_[_0x629d('0x31')](_0x17b949[_0x629d('0x30')]);_0x1b452e['filters']=_[_0x629d('0x32')](_0x1b452e[_0x629d('0x2f')],_0x1b452e[_0x629d('0x30')]);_0x31520b['attributes']=_[_0x629d('0x32')](_0x1b452e[_0x629d('0x2f')],qs[_0x629d('0x33')](_0x17b949['query'][_0x629d('0x33')]));_0x31520b['attributes']=_0x31520b['attributes'][_0x629d('0x34')]?_0x31520b[_0x629d('0x35')]:_0x1b452e['model'];if(!_0x17b949[_0x629d('0x30')][_0x629d('0x36')](_0x629d('0x37'))){_0x31520b['limit']=qs[_0x629d('0x1f')](_0x17b949['query'][_0x629d('0x1f')]);_0x31520b[_0x629d('0x1d')]=qs[_0x629d('0x1d')](_0x17b949[_0x629d('0x30')][_0x629d('0x1d')]);}_0x31520b['order']=qs[_0x629d('0x38')](_0x17b949[_0x629d('0x30')][_0x629d('0x38')]);_0x31520b['where']=qs[_0x629d('0x39')](_[_0x629d('0x3a')](_0x17b949[_0x629d('0x30')],_0x1b452e[_0x629d('0x39')]),_0x5ac8ed);if(_0x17b949[_0x629d('0x30')]['filter']){_0x31520b['where']=_[_0x629d('0x3b')](_0x31520b[_0x629d('0x3c')],{'$or':_['map'](_0x5ac8ed,function(_0x229968){if(_0x229968[_0x629d('0x3d')]!==_0x629d('0x3e')){var _0x42fbaf={};_0x42fbaf[_0x229968[_0x629d('0x28')]]={'$like':'%'+_0x17b949['query'][_0x629d('0x3f')]+'%'};return _0x42fbaf;}})});}_0x31520b=_[_0x629d('0x3b')]({},_0x31520b,_0x17b949[_0x629d('0x40')]);var _0x15feeb={'where':_0x31520b[_0x629d('0x3c')]};return db[_0x629d('0x2c')][_0x629d('0x20')](_0x15feeb)[_0x629d('0x25')](function(_0x357fe0){_0x185833[_0x629d('0x20')]=_0x357fe0;if(_0x17b949['query'][_0x629d('0x41')]){_0x31520b[_0x629d('0x42')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x31520b);})[_0x629d('0x25')](function(_0x334955){_0x185833['rows']=_0x334955;return _0x185833;})[_0x629d('0x25')](respondWithFilteredResult(_0x434aba,_0x31520b))[_0x629d('0x43')](handleError(_0x434aba,null));};exports[_0x629d('0x44')]=function(_0xfa5792,_0x16cc0a){var _0x2bba1b={'raw':!![],'where':{'id':_0xfa5792[_0x629d('0x45')]['id']}},_0x35b99c={};_0x35b99c[_0x629d('0x2f')]=_['keys'](db[_0x629d('0x2c')][_0x629d('0x2d')]);_0x35b99c[_0x629d('0x30')]=_[_0x629d('0x31')](_0xfa5792[_0x629d('0x30')]);_0x35b99c[_0x629d('0x39')]=_[_0x629d('0x32')](_0x35b99c[_0x629d('0x2f')],_0x35b99c['query']);_0x2bba1b[_0x629d('0x35')]=_[_0x629d('0x32')](_0x35b99c[_0x629d('0x2f')],qs['fields'](_0xfa5792[_0x629d('0x30')]['fields']));_0x2bba1b['attributes']=_0x2bba1b[_0x629d('0x35')][_0x629d('0x34')]?_0x2bba1b[_0x629d('0x35')]:_0x35b99c[_0x629d('0x2f')];if(_0xfa5792[_0x629d('0x30')][_0x629d('0x41')]){_0x2bba1b[_0x629d('0x42')]=[{'all':!![]}];}_0x2bba1b=_[_0x629d('0x3b')]({},_0x2bba1b,_0xfa5792[_0x629d('0x40')]);return db[_0x629d('0x2c')]['find'](_0x2bba1b)[_0x629d('0x25')](handleEntityNotFound(_0x16cc0a,null))[_0x629d('0x25')](respondWithResult(_0x16cc0a,null))[_0x629d('0x43')](handleError(_0x16cc0a,null));};exports[_0x629d('0x46')]=function(_0x1f931e,_0x4f2c2a){return db['SugarcrmField'][_0x629d('0x46')](_0x1f931e[_0x629d('0x47')],{})[_0x629d('0x25')](respondWithResult(_0x4f2c2a,0xc9))[_0x629d('0x43')](handleError(_0x4f2c2a,null));};exports['update']=function(_0x4cbb96,_0x8a824d){if(_0x4cbb96['body']['id']){delete _0x4cbb96[_0x629d('0x47')]['id'];}return db[_0x629d('0x2c')]['find']({'where':{'id':_0x4cbb96[_0x629d('0x45')]['id']}})['then'](handleEntityNotFound(_0x8a824d,null))[_0x629d('0x25')](saveUpdates(_0x4cbb96[_0x629d('0x47')],null))[_0x629d('0x25')](respondWithResult(_0x8a824d,null))[_0x629d('0x43')](handleError(_0x8a824d,null));};exports[_0x629d('0x48')]=function(_0x100f4b,_0x3b24ad){return db[_0x629d('0x2c')][_0x629d('0x49')]({'where':{'id':_0x100f4b['params']['id']}})['then'](handleEntityNotFound(_0x3b24ad,null))[_0x629d('0x25')](removeEntity(_0x3b24ad,null))[_0x629d('0x43')](handleError(_0x3b24ad,null));}; \ No newline at end of file +var _0x9f76=['crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3a1431,_0x341f69){var _0x48a55e=function(_0x584d21){while(--_0x584d21){_0x3a1431['push'](_0x3a1431['shift']());}};_0x48a55e(++_0x341f69);}(_0x9f76,0xcc));var _0x69f7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9f76[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x69f7('0x0'));var zipdir=require(_0x69f7('0x1'));var jsonpatch=require(_0x69f7('0x2'));var rp=require(_0x69f7('0x3'));var moment=require(_0x69f7('0x4'));var BPromise=require(_0x69f7('0x5'));var Mustache=require(_0x69f7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x69f7('0x7'));var csv=require(_0x69f7('0x8'));var ejs=require(_0x69f7('0x9'));var fs=require('fs');var fs_extra=require(_0x69f7('0xa'));var _=require(_0x69f7('0xb'));var squel=require('squel');var crypto=require(_0x69f7('0xc'));var jsforce=require(_0x69f7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x69f7('0x8'));var querystring=require(_0x69f7('0xe'));var Papa=require(_0x69f7('0xf'));var Redis=require('ioredis');var authService=require(_0x69f7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x69f7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x69f7('0x12'))(_0x69f7('0x13'));var utils=require(_0x69f7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x69f7('0x15'));var db=require(_0x69f7('0x16'))['db'];function respondWithStatusCode(_0x2daf0a,_0x4d5c0b){_0x4d5c0b=_0x4d5c0b||0xcc;return function(_0xe1d108){if(_0xe1d108){return _0x2daf0a[_0x69f7('0x17')](_0x4d5c0b);}return _0x2daf0a['status'](_0x4d5c0b)[_0x69f7('0x18')]();};}function respondWithResult(_0x7bf861,_0x2f1178){_0x2f1178=_0x2f1178||0xc8;return function(_0x10c382){if(_0x10c382){return _0x7bf861[_0x69f7('0x19')](_0x2f1178)[_0x69f7('0x1a')](_0x10c382);}};}function respondWithFilteredResult(_0x3c1a0a,_0x4dd3ed){return function(_0x3d2171){if(_0x3d2171){var _0x5acd9b=typeof _0x4dd3ed[_0x69f7('0x1b')]===_0x69f7('0x1c')&&typeof _0x4dd3ed['limit']===_0x69f7('0x1c');var _0x340905=_0x3d2171[_0x69f7('0x1d')];var _0x126d80=_0x5acd9b?0x0:_0x4dd3ed['offset'];var _0x68c0a5=_0x5acd9b?_0x3d2171[_0x69f7('0x1d')]:_0x4dd3ed[_0x69f7('0x1b')]+_0x4dd3ed[_0x69f7('0x1e')];var _0x4b92e7;if(_0x68c0a5>=_0x340905){_0x68c0a5=_0x340905;_0x4b92e7=0xc8;}else{_0x4b92e7=0xce;}_0x3c1a0a['status'](_0x4b92e7);return _0x3c1a0a['set'](_0x69f7('0x1f'),_0x126d80+'-'+_0x68c0a5+'/'+_0x340905)[_0x69f7('0x1a')](_0x3d2171);}return null;};}function patchUpdates(_0x19a194){return function(_0x1a7c10){try{jsonpatch['apply'](_0x1a7c10,_0x19a194,!![]);}catch(_0x43b3c3){return BPromise[_0x69f7('0x20')](_0x43b3c3);}return _0x1a7c10[_0x69f7('0x21')]();};}function saveUpdates(_0x495ea3,_0x57dfe5){return function(_0x4e0991){if(_0x4e0991){return _0x4e0991[_0x69f7('0x22')](_0x495ea3)[_0x69f7('0x23')](function(_0x4b754b){return _0x4b754b;});}return null;};}function removeEntity(_0x2861cb,_0x20d682){return function(_0x33237b){if(_0x33237b){return _0x33237b[_0x69f7('0x24')]()[_0x69f7('0x23')](function(){_0x2861cb[_0x69f7('0x19')](0xcc)[_0x69f7('0x18')]();});}};}function handleEntityNotFound(_0x6cb712,_0x49f58d){return function(_0x58b8d0){if(!_0x58b8d0){_0x6cb712[_0x69f7('0x17')](0x194);}return _0x58b8d0;};}function handleError(_0x5310c4,_0x2645ab){_0x2645ab=_0x2645ab||0x1f4;return function(_0x463b82){logger[_0x69f7('0x25')](_0x463b82[_0x69f7('0x26')]);if(_0x463b82[_0x69f7('0x27')]){delete _0x463b82[_0x69f7('0x27')];}_0x5310c4[_0x69f7('0x19')](_0x2645ab)['send'](_0x463b82);};}exports['index']=function(_0x230705,_0x27b8de){var _0x255a25={},_0x1737e1={},_0x21ffb7={'count':0x0,'rows':[]};var _0x1c6d47=_[_0x69f7('0x28')](db[_0x69f7('0x29')][_0x69f7('0x2a')],function(_0x1b2bc8){return{'name':_0x1b2bc8[_0x69f7('0x2b')],'type':_0x1b2bc8[_0x69f7('0x2c')][_0x69f7('0x2d')]};});_0x1737e1[_0x69f7('0x2e')]=_['map'](_0x1c6d47,_0x69f7('0x27'));_0x1737e1[_0x69f7('0x2f')]=_[_0x69f7('0x30')](_0x230705['query']);_0x1737e1[_0x69f7('0x31')]=_[_0x69f7('0x32')](_0x1737e1[_0x69f7('0x2e')],_0x1737e1[_0x69f7('0x2f')]);_0x255a25[_0x69f7('0x33')]=_['intersection'](_0x1737e1[_0x69f7('0x2e')],qs[_0x69f7('0x34')](_0x230705[_0x69f7('0x2f')][_0x69f7('0x34')]));_0x255a25['attributes']=_0x255a25[_0x69f7('0x33')]['length']?_0x255a25[_0x69f7('0x33')]:_0x1737e1[_0x69f7('0x2e')];if(!_0x230705[_0x69f7('0x2f')][_0x69f7('0x35')](_0x69f7('0x36'))){_0x255a25[_0x69f7('0x1e')]=qs['limit'](_0x230705[_0x69f7('0x2f')][_0x69f7('0x1e')]);_0x255a25[_0x69f7('0x1b')]=qs[_0x69f7('0x1b')](_0x230705['query'][_0x69f7('0x1b')]);}_0x255a25[_0x69f7('0x37')]=qs['sort'](_0x230705[_0x69f7('0x2f')][_0x69f7('0x38')]);_0x255a25[_0x69f7('0x39')]=qs[_0x69f7('0x31')](_[_0x69f7('0x3a')](_0x230705[_0x69f7('0x2f')],_0x1737e1['filters']),_0x1c6d47);if(_0x230705[_0x69f7('0x2f')][_0x69f7('0x3b')]){_0x255a25[_0x69f7('0x39')]=_[_0x69f7('0x3c')](_0x255a25[_0x69f7('0x39')],{'$or':_[_0x69f7('0x28')](_0x1c6d47,function(_0x592e69){if(_0x592e69[_0x69f7('0x2c')]!==_0x69f7('0x3d')){var _0x584752={};_0x584752[_0x592e69['name']]={'$like':'%'+_0x230705[_0x69f7('0x2f')][_0x69f7('0x3b')]+'%'};return _0x584752;}})});}_0x255a25=_['merge']({},_0x255a25,_0x230705['options']);var _0xbbdf2a={'where':_0x255a25['where']};return db[_0x69f7('0x29')][_0x69f7('0x1d')](_0xbbdf2a)['then'](function(_0x3e30f3){_0x21ffb7[_0x69f7('0x1d')]=_0x3e30f3;if(_0x230705[_0x69f7('0x2f')][_0x69f7('0x3e')]){_0x255a25[_0x69f7('0x3f')]=[{'all':!![]}];}return db[_0x69f7('0x29')][_0x69f7('0x40')](_0x255a25);})[_0x69f7('0x23')](function(_0x17dfd3){_0x21ffb7['rows']=_0x17dfd3;return _0x21ffb7;})[_0x69f7('0x23')](respondWithFilteredResult(_0x27b8de,_0x255a25))[_0x69f7('0x41')](handleError(_0x27b8de,null));};exports[_0x69f7('0x42')]=function(_0x38b184,_0x7b60df){var _0x1ccab0={'raw':!![],'where':{'id':_0x38b184[_0x69f7('0x43')]['id']}},_0x4ab039={};_0x4ab039[_0x69f7('0x2e')]=_[_0x69f7('0x30')](db[_0x69f7('0x29')]['rawAttributes']);_0x4ab039[_0x69f7('0x2f')]=_[_0x69f7('0x30')](_0x38b184[_0x69f7('0x2f')]);_0x4ab039[_0x69f7('0x31')]=_[_0x69f7('0x32')](_0x4ab039[_0x69f7('0x2e')],_0x4ab039[_0x69f7('0x2f')]);_0x1ccab0[_0x69f7('0x33')]=_[_0x69f7('0x32')](_0x4ab039[_0x69f7('0x2e')],qs[_0x69f7('0x34')](_0x38b184[_0x69f7('0x2f')][_0x69f7('0x34')]));_0x1ccab0[_0x69f7('0x33')]=_0x1ccab0[_0x69f7('0x33')]['length']?_0x1ccab0['attributes']:_0x4ab039[_0x69f7('0x2e')];if(_0x38b184[_0x69f7('0x2f')][_0x69f7('0x3e')]){_0x1ccab0[_0x69f7('0x3f')]=[{'all':!![]}];}_0x1ccab0=_[_0x69f7('0x3c')]({},_0x1ccab0,_0x38b184[_0x69f7('0x44')]);return db['SugarcrmField'][_0x69f7('0x45')](_0x1ccab0)[_0x69f7('0x23')](handleEntityNotFound(_0x7b60df,null))[_0x69f7('0x23')](respondWithResult(_0x7b60df,null))[_0x69f7('0x41')](handleError(_0x7b60df,null));};exports[_0x69f7('0x46')]=function(_0x3956a8,_0x23636b){return db[_0x69f7('0x29')][_0x69f7('0x46')](_0x3956a8[_0x69f7('0x47')],{})[_0x69f7('0x23')](respondWithResult(_0x23636b,0xc9))[_0x69f7('0x41')](handleError(_0x23636b,null));};exports[_0x69f7('0x22')]=function(_0x509e39,_0x55359e){if(_0x509e39[_0x69f7('0x47')]['id']){delete _0x509e39[_0x69f7('0x47')]['id'];}return db[_0x69f7('0x29')]['find']({'where':{'id':_0x509e39[_0x69f7('0x43')]['id']}})[_0x69f7('0x23')](handleEntityNotFound(_0x55359e,null))[_0x69f7('0x23')](saveUpdates(_0x509e39['body'],null))[_0x69f7('0x23')](respondWithResult(_0x55359e,null))[_0x69f7('0x41')](handleError(_0x55359e,null));};exports[_0x69f7('0x24')]=function(_0x54fb74,_0x250b1a){return db['SugarcrmField'][_0x69f7('0x45')]({'where':{'id':_0x54fb74[_0x69f7('0x43')]['id']}})[_0x69f7('0x23')](handleEntityNotFound(_0x250b1a,null))[_0x69f7('0x23')](removeEntity(_0x250b1a,null))[_0x69f7('0x41')](handleError(_0x250b1a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 0d8ce98..6a0f301 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 _0x40b2=['int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x274203,_0x4b64d3){var _0xd52b29=function(_0x1d067c){while(--_0x1d067c){_0x274203['push'](_0x274203['shift']());}};_0xd52b29(++_0x4b64d3);}(_0x40b2,0x1b6));var _0x240b=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x40b2[_0x6cf19c];return _0xce14f3;};'use strict';var _=require(_0x240b('0x0'));var util=require('util');var logger=require(_0x240b('0x1'))('api');var moment=require(_0x240b('0x2'));var BPromise=require(_0x240b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x240b('0x4'));var rimraf=require('rimraf');var config=require(_0x240b('0x5'));var attributes=require(_0x240b('0x6'));module[_0x240b('0x7')]=function(_0x18bdc2,_0x3d838){return _0x18bdc2[_0x240b('0x8')](_0x240b('0x9'),attributes,{'tableName':_0x240b('0xa'),'paranoid':![],'indexes':[{'name':_0x240b('0xb'),'fields':[_0x240b('0xc'),_0x240b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde6f=['../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','sugarcrm_unique_index','lodash','util','api','moment','request-promise','path'];(function(_0x5670cb,_0xe6e20d){var _0x11dc29=function(_0x42305b){while(--_0x42305b){_0x5670cb['push'](_0x5670cb['shift']());}};_0x11dc29(++_0xe6e20d);}(_0xde6f,0x17b));var _0xfde6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde6f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfde6('0x0'));var util=require(_0xfde6('0x1'));var logger=require('../../config/logger')(_0xfde6('0x2'));var moment=require(_0xfde6('0x3'));var BPromise=require('bluebird');var rp=require(_0xfde6('0x4'));var fs=require('fs');var path=require(_0xfde6('0x5'));var rimraf=require('rimraf');var config=require(_0xfde6('0x6'));var attributes=require(_0xfde6('0x7'));module['exports']=function(_0x5cdc54,_0x533e8f){return _0x5cdc54[_0xfde6('0x8')](_0xfde6('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xfde6('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 2dcadc1..2f37aca 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 _0x48aa=['../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0x48aa,0x6c));var _0xa48a=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x48aa[_0x4fe19c];return _0x952ac7;};'use strict';var _=require(_0xa48a('0x0'));var util=require(_0xa48a('0x1'));var moment=require(_0xa48a('0x2'));var BPromise=require(_0xa48a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa48a('0x4'));var db=require(_0xa48a('0x5'))['db'];var utils=require(_0xa48a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa48a('0x7'));var jayson=require(_0xa48a('0x8'));var client=jayson[_0xa48a('0x9')][_0xa48a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ae2d2,_0x4ddbfd,_0xfde729){return new BPromise(function(_0x3f692c,_0x2346f1){return client[_0xa48a('0xb')](_0x3ae2d2,_0xfde729)[_0xa48a('0xc')](function(_0x2f6474){logger[_0xa48a('0xd')](_0xa48a('0xe'),_0x4ddbfd,_0xa48a('0xf'));logger[_0xa48a('0x10')](_0xa48a('0x11'),_0x4ddbfd,'request\x20sent',JSON[_0xa48a('0x12')](_0x2f6474));if(_0x2f6474[_0xa48a('0x13')]){if(_0x2f6474[_0xa48a('0x13')][_0xa48a('0x14')]===0x1f4){logger[_0xa48a('0x13')](_0xa48a('0xe'),_0x4ddbfd,_0x2f6474[_0xa48a('0x13')]['message']);return _0x2346f1(_0x2f6474[_0xa48a('0x13')]['message']);}logger[_0xa48a('0x13')](_0xa48a('0xe'),_0x4ddbfd,_0x2f6474[_0xa48a('0x13')][_0xa48a('0x15')]);return _0x3f692c(_0x2f6474[_0xa48a('0x13')][_0xa48a('0x15')]);}else{logger['info'](_0xa48a('0xe'),_0x4ddbfd,_0xa48a('0xf'));_0x3f692c(_0x2f6474[_0xa48a('0x16')][_0xa48a('0x15')]);}})['catch'](function(_0x2a683a){logger[_0xa48a('0x13')](_0xa48a('0xe'),_0x4ddbfd,_0x2a683a);_0x2346f1(_0x2a683a);});});} \ No newline at end of file +var _0xd52e=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x56c537,_0x462fba){var _0x4a4a1e=function(_0x12e2c1){while(--_0x12e2c1){_0x56c537['push'](_0x56c537['shift']());}};_0x4a4a1e(++_0x462fba);}(_0xd52e,0x195));var _0xed52=function(_0x3667e1,_0x44ac8d){_0x3667e1=_0x3667e1-0x0;var _0x22bfe3=_0xd52e[_0x3667e1];return _0x22bfe3;};'use strict';var _=require(_0xed52('0x0'));var util=require(_0xed52('0x1'));var moment=require(_0xed52('0x2'));var BPromise=require(_0xed52('0x3'));var rs=require(_0xed52('0x4'));var fs=require('fs');var Redis=require(_0xed52('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xed52('0x6'));var logger=require('../../config/logger')(_0xed52('0x7'));var config=require(_0xed52('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50cc77,_0x25f1fc,_0xbab94){return new BPromise(function(_0x563b1f,_0x30cd8e){return client[_0xed52('0x9')](_0x50cc77,_0xbab94)['then'](function(_0xadf161){logger[_0xed52('0xa')](_0xed52('0xb'),_0x25f1fc,_0xed52('0xc'));logger[_0xed52('0xd')](_0xed52('0xe'),_0x25f1fc,_0xed52('0xc'),JSON[_0xed52('0xf')](_0xadf161));if(_0xadf161[_0xed52('0x10')]){if(_0xadf161['error']['code']===0x1f4){logger[_0xed52('0x10')](_0xed52('0xb'),_0x25f1fc,_0xadf161[_0xed52('0x10')][_0xed52('0x11')]);return _0x30cd8e(_0xadf161['error']['message']);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x25f1fc,_0xadf161[_0xed52('0x10')]['message']);return _0x563b1f(_0xadf161[_0xed52('0x10')][_0xed52('0x11')]);}else{logger[_0xed52('0xa')]('SugarcrmField,\x20%s,\x20%s',_0x25f1fc,_0xed52('0xc'));_0x563b1f(_0xadf161[_0xed52('0x12')]['message']);}})[_0xed52('0x13')](function(_0x58bac0){logger[_0xed52('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x25f1fc,_0x58bac0);_0x30cd8e(_0x58bac0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 5efbb86..1552046 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 _0x2783=['isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x46822d,_0x42b8b5){var _0x365a6c=function(_0x38e8be){while(--_0x38e8be){_0x46822d['push'](_0x46822d['shift']());}};_0x365a6c(++_0x42b8b5);}(_0x2783,0x1f2));var _0x3278=function(_0x591b38,_0x56a98f){_0x591b38=_0x591b38-0x0;var _0xf4b640=_0x2783[_0x591b38];return _0xf4b640;};'use strict';var multer=require(_0x3278('0x0'));var util=require('util');var path=require(_0x3278('0x1'));var timeout=require(_0x3278('0x2'));var express=require(_0x3278('0x3'));var router=express['Router']();var fs_extra=require(_0x3278('0x4'));var auth=require(_0x3278('0x5'));var interaction=require(_0x3278('0x6'));var config=require(_0x3278('0x7'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x3278('0x8')](),controller[_0x3278('0x9')]);router[_0x3278('0xa')](_0x3278('0xb'),auth['isAuthenticated'](),controller[_0x3278('0xc')]);router[_0x3278('0xa')](_0x3278('0xd'),auth[_0x3278('0x8')](),controller[_0x3278('0xe')]);router[_0x3278('0xa')](_0x3278('0xf'),auth['isAuthenticated'](),controller[_0x3278('0x10')]);router[_0x3278('0x11')]('/',auth[_0x3278('0x8')](),controller[_0x3278('0x12')]);router[_0x3278('0x11')](_0x3278('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x3278('0x13')](_0x3278('0xb'),auth[_0x3278('0x8')](),controller[_0x3278('0x14')]);router[_0x3278('0x15')](_0x3278('0xb'),auth[_0x3278('0x8')](),controller['destroy']);module[_0x3278('0x16')]=router; \ No newline at end of file +var _0xf681=['../../config/environment','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x15a833,_0x5092d6){var _0x371593=function(_0x53b66b){while(--_0x53b66b){_0x15a833['push'](_0x15a833['shift']());}};_0x371593(++_0x5092d6);}(_0xf681,0xc9));var _0x1f68=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf681[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x1f68('0x0'));var path=require(_0x1f68('0x1'));var timeout=require(_0x1f68('0x2'));var express=require(_0x1f68('0x3'));var router=express['Router']();var fs_extra=require(_0x1f68('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1f68('0x5'));var config=require(_0x1f68('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x1f68('0x7')]('/',auth[_0x1f68('0x8')](),controller[_0x1f68('0x9')]);router['get']('/:id',auth[_0x1f68('0x8')](),controller[_0x1f68('0xa')]);router[_0x1f68('0x7')]('/:id/configurations',auth[_0x1f68('0x8')](),controller[_0x1f68('0xb')]);router[_0x1f68('0x7')](_0x1f68('0xc'),auth[_0x1f68('0x8')](),controller[_0x1f68('0xd')]);router[_0x1f68('0xe')]('/',auth[_0x1f68('0x8')](),controller['create']);router[_0x1f68('0xe')](_0x1f68('0xf'),auth[_0x1f68('0x8')](),controller[_0x1f68('0x10')]);router[_0x1f68('0x11')]('/:id',auth[_0x1f68('0x8')](),controller[_0x1f68('0x12')]);router[_0x1f68('0x13')](_0x1f68('0x14'),auth[_0x1f68('0x8')](),controller[_0x1f68('0x15')]);module[_0x1f68('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 9eff2a3..4da9cce 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 _0x7332=['exports','STRING','sequelize'];(function(_0x3359ad,_0x55332b){var _0x4a4fa3=function(_0x5eefcf){while(--_0x5eefcf){_0x3359ad['push'](_0x3359ad['shift']());}};_0x4a4fa3(++_0x55332b);}(_0x7332,0xb0));var _0x2733=function(_0x102e87,_0x14a9ab){_0x102e87=_0x102e87-0x0;var _0x342af0=_0x7332[_0x102e87];return _0x342af0;};'use strict';var Sequelize=require(_0x2733('0x0'));module[_0x2733('0x1')]={'name':{'type':Sequelize[_0x2733('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2733('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x2733('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2733('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2733('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc1a4=['HelpDesk','sequelize','exports','STRING'];(function(_0x5138e0,_0x24fbbc){var _0x18e57b=function(_0x5eda17){while(--_0x5eda17){_0x5138e0['push'](_0x5138e0['shift']());}};_0x18e57b(++_0x24fbbc);}(_0xc1a4,0x1e9));var _0x4c1a=function(_0x23527e,_0x54ca2e){_0x23527e=_0x23527e-0x0;var _0x3df4b0=_0xc1a4[_0x23527e];return _0x3df4b0;};'use strict';var Sequelize=require(_0x4c1a('0x0'));module[_0x4c1a('0x1')]={'name':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4c1a('0x2')]},'username':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![],'defaultValue':_0x4c1a('0x3')},'remoteUri':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4c1a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index c8eb2dd..b61bb7e 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 _0x7454=['%s/webservice.php','GET','getchallenge','POST','login','result','token','success','describe','sessionName','autogenerated','reference','owner','remove','editable','startsWith','cf_','picklist','picklistValues','label','value','log','test','statusCode','stringify','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','VtigerAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','substring','lastIndexOf','format'];(function(_0x1050ba,_0x5ad911){var _0x5a99a5=function(_0x30e240){while(--_0x30e240){_0x1050ba['push'](_0x1050ba['shift']());}};_0x5a99a5(++_0x5ad911);}(_0x7454,0x101));var _0x4745=function(_0x3e5147,_0x33eef9){_0x3e5147=_0x3e5147-0x0;var _0x18c779=_0x7454[_0x3e5147];return _0x18c779;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4745('0x0'));var zipdir=require(_0x4745('0x1'));var jsonpatch=require(_0x4745('0x2'));var rp=require(_0x4745('0x3'));var moment=require('moment');var BPromise=require(_0x4745('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4745('0x5'));var sox=require(_0x4745('0x6'));var csv=require(_0x4745('0x7'));var ejs=require(_0x4745('0x8'));var fs=require('fs');var fs_extra=require(_0x4745('0x9'));var _=require('lodash');var squel=require(_0x4745('0xa'));var crypto=require(_0x4745('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4745('0x7'));var querystring=require(_0x4745('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4745('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4745('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4745('0xf'));var utils=require(_0x4745('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4745('0x11'));var db=require(_0x4745('0x12'))['db'];var integrations=require(_0x4745('0x13'));function respondWithStatusCode(_0x501590,_0x2d661f){_0x2d661f=_0x2d661f||0xcc;return function(_0x599363){if(_0x599363){return _0x501590[_0x4745('0x14')](_0x2d661f);}return _0x501590[_0x4745('0x15')](_0x2d661f)[_0x4745('0x16')]();};}function respondWithResult(_0x317687,_0x55d3f7){_0x55d3f7=_0x55d3f7||0xc8;return function(_0x488856){if(_0x488856){return _0x317687['status'](_0x55d3f7)[_0x4745('0x17')](_0x488856);}};}function respondWithFilteredResult(_0x297c55,_0x16162f){return function(_0x229f25){if(_0x229f25){var _0x4a503f=typeof _0x16162f[_0x4745('0x18')]===_0x4745('0x19')&&typeof _0x16162f[_0x4745('0x1a')]===_0x4745('0x19');var _0x238aad=_0x229f25[_0x4745('0x1b')];var _0x25e5a8=_0x4a503f?0x0:_0x16162f[_0x4745('0x18')];var _0x2c8db4=_0x4a503f?_0x229f25[_0x4745('0x1b')]:_0x16162f['offset']+_0x16162f[_0x4745('0x1a')];var _0x396e32;if(_0x2c8db4>=_0x238aad){_0x2c8db4=_0x238aad;_0x396e32=0xc8;}else{_0x396e32=0xce;}_0x297c55['status'](_0x396e32);return _0x297c55[_0x4745('0x1c')](_0x4745('0x1d'),_0x25e5a8+'-'+_0x2c8db4+'/'+_0x238aad)[_0x4745('0x17')](_0x229f25);}return null;};}function patchUpdates(_0x1dde34){return function(_0xb86b72){try{jsonpatch['apply'](_0xb86b72,_0x1dde34,!![]);}catch(_0x139bfb){return BPromise[_0x4745('0x1e')](_0x139bfb);}return _0xb86b72[_0x4745('0x1f')]();};}function saveUpdates(_0x60715c,_0x31e2e7){return function(_0x4f4ec4){if(_0x4f4ec4){return _0x4f4ec4[_0x4745('0x20')](_0x60715c)[_0x4745('0x21')](function(_0x42f330){return _0x42f330;});}return null;};}function removeEntity(_0x3e0b04,_0x5ce4c7){return function(_0x19f685){if(_0x19f685){return _0x19f685[_0x4745('0x22')]()[_0x4745('0x21')](function(){_0x3e0b04[_0x4745('0x15')](0xcc)[_0x4745('0x16')]();});}};}function handleEntityNotFound(_0x455637,_0x4ff8ef){return function(_0x162ff7){if(!_0x162ff7){_0x455637[_0x4745('0x14')](0x194);}return _0x162ff7;};}function handleError(_0x4db253,_0x22edd9){_0x22edd9=_0x22edd9||0x1f4;return function(_0x57cbbe){logger[_0x4745('0x23')](_0x57cbbe[_0x4745('0x24')]);if(_0x57cbbe['name']){delete _0x57cbbe[_0x4745('0x25')];}_0x4db253[_0x4745('0x15')](_0x22edd9)[_0x4745('0x26')](_0x57cbbe);};}exports['index']=function(_0xbaec95,_0x3aa3e7){var _0x103641={},_0x3dea66={},_0x5018d1={'count':0x0,'rows':[]};var _0x4f88f0=_['map'](db[_0x4745('0x27')][_0x4745('0x28')],function(_0x5d3ff7){return{'name':_0x5d3ff7['fieldName'],'type':_0x5d3ff7[_0x4745('0x29')][_0x4745('0x2a')]};});_0x3dea66[_0x4745('0x2b')]=_['map'](_0x4f88f0,'name');_0x3dea66[_0x4745('0x2c')]=_[_0x4745('0x2d')](_0xbaec95[_0x4745('0x2c')]);_0x3dea66[_0x4745('0x2e')]=_[_0x4745('0x2f')](_0x3dea66[_0x4745('0x2b')],_0x3dea66[_0x4745('0x2c')]);_0x103641[_0x4745('0x30')]=_[_0x4745('0x2f')](_0x3dea66[_0x4745('0x2b')],qs[_0x4745('0x31')](_0xbaec95[_0x4745('0x2c')]['fields']));_0x103641[_0x4745('0x30')]=_0x103641[_0x4745('0x30')][_0x4745('0x32')]?_0x103641[_0x4745('0x30')]:_0x3dea66[_0x4745('0x2b')];if(!_0xbaec95[_0x4745('0x2c')][_0x4745('0x33')](_0x4745('0x34'))){_0x103641[_0x4745('0x1a')]=qs[_0x4745('0x1a')](_0xbaec95[_0x4745('0x2c')][_0x4745('0x1a')]);_0x103641[_0x4745('0x18')]=qs[_0x4745('0x18')](_0xbaec95[_0x4745('0x2c')][_0x4745('0x18')]);}_0x103641[_0x4745('0x35')]=qs[_0x4745('0x36')](_0xbaec95['query']['sort']);_0x103641[_0x4745('0x37')]=qs[_0x4745('0x2e')](_['pick'](_0xbaec95[_0x4745('0x2c')],_0x3dea66[_0x4745('0x2e')]),_0x4f88f0);if(_0xbaec95[_0x4745('0x2c')][_0x4745('0x38')]){_0x103641[_0x4745('0x37')]=_['merge'](_0x103641[_0x4745('0x37')],{'$or':_[_0x4745('0x39')](_0x4f88f0,function(_0x494ec7){if(_0x494ec7[_0x4745('0x29')]!==_0x4745('0x3a')){var _0x1a6cb8={};_0x1a6cb8[_0x494ec7[_0x4745('0x25')]]={'$like':'%'+_0xbaec95['query'][_0x4745('0x38')]+'%'};return _0x1a6cb8;}})});}_0x103641=_[_0x4745('0x3b')]({},_0x103641,_0xbaec95['options']);var _0x2cd31d={'where':_0x103641[_0x4745('0x37')]};return db['VtigerAccount'][_0x4745('0x1b')](_0x2cd31d)[_0x4745('0x21')](function(_0x76df6){_0x5018d1['count']=_0x76df6;if(_0xbaec95[_0x4745('0x2c')][_0x4745('0x3c')]){_0x103641[_0x4745('0x3d')]=[{'all':!![]}];}return db[_0x4745('0x27')][_0x4745('0x3e')](_0x103641);})[_0x4745('0x21')](function(_0x1e3483){_0x5018d1['rows']=_0x1e3483;return _0x5018d1;})[_0x4745('0x21')](respondWithFilteredResult(_0x3aa3e7,_0x103641))[_0x4745('0x3f')](handleError(_0x3aa3e7,null));};exports[_0x4745('0x40')]=function(_0x12a505,_0x49bdc8){var _0x40b1b3={'raw':![],'where':{'id':_0x12a505['params']['id']}},_0x198cf6={};_0x198cf6[_0x4745('0x2b')]=_[_0x4745('0x2d')](db[_0x4745('0x27')][_0x4745('0x28')]);_0x198cf6[_0x4745('0x2c')]=_[_0x4745('0x2d')](_0x12a505[_0x4745('0x2c')]);_0x198cf6[_0x4745('0x2e')]=_['intersection'](_0x198cf6['model'],_0x198cf6[_0x4745('0x2c')]);_0x40b1b3[_0x4745('0x30')]=_[_0x4745('0x2f')](_0x198cf6[_0x4745('0x2b')],qs[_0x4745('0x31')](_0x12a505[_0x4745('0x2c')][_0x4745('0x31')]));_0x40b1b3[_0x4745('0x30')]=_0x40b1b3[_0x4745('0x30')][_0x4745('0x32')]?_0x40b1b3[_0x4745('0x30')]:_0x198cf6[_0x4745('0x2b')];if(_0x12a505[_0x4745('0x2c')][_0x4745('0x3c')]){_0x40b1b3[_0x4745('0x3d')]=[{'all':!![]}];}_0x40b1b3=_[_0x4745('0x3b')]({},_0x40b1b3,_0x12a505[_0x4745('0x41')]);return db[_0x4745('0x27')][_0x4745('0x42')](_0x40b1b3)[_0x4745('0x21')](handleEntityNotFound(_0x49bdc8,null))[_0x4745('0x21')](respondWithResult(_0x49bdc8,null))[_0x4745('0x3f')](handleError(_0x49bdc8,null));};exports[_0x4745('0x43')]=function(_0x581ef8,_0xc25a0d){return db[_0x4745('0x27')][_0x4745('0x43')](_0x581ef8['body'],{})['then'](respondWithResult(_0xc25a0d,0xc9))['catch'](handleError(_0xc25a0d,null));};exports[_0x4745('0x20')]=function(_0x25c8c7,_0x6ed06f){if(_0x25c8c7['body']['id']){delete _0x25c8c7[_0x4745('0x44')]['id'];}return db[_0x4745('0x27')][_0x4745('0x42')]({'where':{'id':_0x25c8c7[_0x4745('0x45')]['id']}})[_0x4745('0x21')](handleEntityNotFound(_0x6ed06f,null))['then'](saveUpdates(_0x25c8c7[_0x4745('0x44')],null))['then'](respondWithResult(_0x6ed06f,null))[_0x4745('0x3f')](handleError(_0x6ed06f,null));};exports['destroy']=function(_0x9a82b8,_0x44d4ce){return db[_0x4745('0x27')][_0x4745('0x42')]({'where':{'id':_0x9a82b8['params']['id']}})['then'](handleEntityNotFound(_0x44d4ce,null))['then'](removeEntity(_0x44d4ce,null))[_0x4745('0x3f')](handleError(_0x44d4ce,null));};exports['getConfigurations']=function(_0x3ea8f2,_0xc99fc3,_0x5ca5e5){var _0x27e6d1={};var _0x572684={};var _0x11a6fb;var _0x26913e;return db['VtigerAccount'][_0x4745('0x46')]({'where':{'id':_0x3ea8f2[_0x4745('0x45')]['id']}})[_0x4745('0x21')](handleEntityNotFound(_0xc99fc3,null))['then'](function(_0x260f00){if(_0x260f00){_0x11a6fb=_0x260f00;_0x572684[_0x4745('0x2b')]=_['keys'](db[_0x4745('0x47')]['rawAttributes']);_0x572684['query']=_['keys'](_0x3ea8f2[_0x4745('0x2c')]);_0x572684[_0x4745('0x2e')]=_[_0x4745('0x2f')](_0x572684['model'],_0x572684[_0x4745('0x2c')]);_0x27e6d1['attributes']=_[_0x4745('0x2f')](_0x572684[_0x4745('0x2b')],qs[_0x4745('0x31')](_0x3ea8f2[_0x4745('0x2c')][_0x4745('0x31')]));_0x27e6d1[_0x4745('0x30')]=_0x27e6d1[_0x4745('0x30')][_0x4745('0x32')]?_0x27e6d1[_0x4745('0x30')]:_0x572684[_0x4745('0x2b')];_0x27e6d1[_0x4745('0x35')]=qs[_0x4745('0x36')](_0x3ea8f2['query']['sort']);_0x27e6d1[_0x4745('0x37')]=qs[_0x4745('0x2e')](_['pick'](_0x3ea8f2[_0x4745('0x2c')],_0x572684['filters']));if(_0x3ea8f2[_0x4745('0x2c')]['filter']){_0x27e6d1[_0x4745('0x37')]=_['merge'](_0x27e6d1[_0x4745('0x37')],{'$or':_['map'](_0x27e6d1[_0x4745('0x30')],function(_0x534e74){var _0x53839d={};_0x53839d[_0x534e74]={'$like':'%'+_0x3ea8f2[_0x4745('0x2c')][_0x4745('0x38')]+'%'};return _0x53839d;})});}_0x27e6d1=_[_0x4745('0x3b')]({},_0x27e6d1,_0x3ea8f2[_0x4745('0x41')]);return _0x11a6fb[_0x4745('0x48')](_0x27e6d1);}})[_0x4745('0x21')](function(_0x15076c){if(_0x15076c){_0x26913e=_0x15076c[_0x4745('0x32')];if(!_0x3ea8f2[_0x4745('0x2c')][_0x4745('0x33')](_0x4745('0x34'))){_0x27e6d1[_0x4745('0x1a')]=qs[_0x4745('0x1a')](_0x3ea8f2[_0x4745('0x2c')][_0x4745('0x1a')]);_0x27e6d1[_0x4745('0x18')]=qs[_0x4745('0x18')](_0x3ea8f2[_0x4745('0x2c')][_0x4745('0x18')]);}return _0x11a6fb[_0x4745('0x48')](_0x27e6d1);}})[_0x4745('0x21')](function(_0x43025f){if(_0x43025f){return _0x43025f?{'count':_0x26913e,'rows':_0x43025f}:null;}})['then'](respondWithResult(_0xc99fc3,null))[_0x4745('0x3f')](handleError(_0xc99fc3,null));};exports[_0x4745('0x49')]=function(_0xc5d7a4,_0x11b68b,_0xa2a145){if(_0xc5d7a4[_0x4745('0x44')]['id']){delete _0xc5d7a4['body']['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0xc5d7a4[_0x4745('0x45')]['id']}})[_0x4745('0x21')](handleEntityNotFound(_0x11b68b,null))[_0x4745('0x21')](function(_0x386a43){if(_0x386a43){_0xc5d7a4[_0x4745('0x44')][_0x4745('0x4a')]=_0x386a43['id'];_0xc5d7a4['body'][_0x4745('0x4b')]=integrations[_0x4745('0x4c')](_0xc5d7a4[_0x4745('0x44')][_0x4745('0x4d')],_0xc5d7a4[_0x4745('0x44')]['type']);_0xc5d7a4[_0x4745('0x44')]['Descriptions']=integrations[_0x4745('0x4e')](_0xc5d7a4[_0x4745('0x44')][_0x4745('0x4d')],_0xc5d7a4['body'][_0x4745('0x29')]);return db[_0x4745('0x47')]['create'](_0xc5d7a4[_0x4745('0x44')],{'include':[{'model':db[_0x4745('0x4f')],'as':_0x4745('0x4b')},{'model':db[_0x4745('0x4f')],'as':'Descriptions'}]});}return null;})[_0x4745('0x21')](respondWithResult(_0x11b68b,null))['catch'](handleError(_0x11b68b,null));};var md5=require('md5');exports[_0x4745('0x50')]=function(_0x96563f,_0x3fe3fa,_0x4b7f3a){var _0x4cfe78=null;var _0x1f54ca=null;var _0x11e3ed=null;var _0x13f89c=null;var _0x3ebed2='';return db[_0x4745('0x27')][_0x4745('0x46')]({'where':{'id':_0x96563f[_0x4745('0x45')]['id']},'attributes':['id',_0x4745('0x25'),_0x4745('0x51'),_0x4745('0x52'),'moduleName',_0x4745('0x53'),_0x4745('0x54'),_0x4745('0x55')]})[_0x4745('0x21')](handleEntityNotFound(_0x3fe3fa,null))[_0x4745('0x21')](function(_0xc6613b){if(_0xc6613b){_0x4cfe78=_0xc6613b[_0x4745('0x51')];_0x1f54ca=_0xc6613b[_0x4745('0x55')];_0x11e3ed=_0xc6613b[_0x4745('0x56')];_0x3ebed2=_0xc6613b[_0x4745('0x53')];var _0x3fd7c9=_0x3ebed2[_0x4745('0x57')](-0x1);if(_0x3fd7c9==='/'){_0x3ebed2=_0x3ebed2[_0x4745('0x58')](0x0,_0x3ebed2[_0x4745('0x59')](_0x3fd7c9));}_0x13f89c=util[_0x4745('0x5a')](_0x4745('0x5b'),_0x3ebed2);var _0x12aa74={'method':_0x4745('0x5c'),'uri':_0x13f89c,'qs':{'operation':_0x4745('0x5d'),'username':_0xc6613b[_0x4745('0x51')]},'json':!![]};return rp(_0x12aa74);}})[_0x4745('0x21')](function(_0x104a9c){if(_0x104a9c['success']){var _0x116b5c={'method':_0x4745('0x5e'),'uri':_0x13f89c,'form':{'operation':_0x4745('0x5f'),'username':_0x4cfe78,'accessKey':md5(_0x104a9c[_0x4745('0x60')][_0x4745('0x61')]+_0x1f54ca)},'json':!![]};return rp(_0x116b5c);}})[_0x4745('0x21')](function(_0x3d9e4c){if(_0x3d9e4c[_0x4745('0x62')]){var _0xbfbca6={'method':'GET','uri':_0x13f89c,'qs':{'operation':_0x4745('0x63'),'username':_0x4cfe78,'sessionName':_0x3d9e4c[_0x4745('0x60')][_0x4745('0x64')],'elementType':_0x11e3ed},'json':!![]};return rp(_0xbfbca6);}})['then'](function(_0x17a5cb){if(_0x17a5cb[_0x4745('0x62')]){var _0x3c8112=[_0x4745('0x65'),_0x4745('0x66'),_0x4745('0x67')];_[_0x4745('0x68')](_0x17a5cb[_0x4745('0x60')][_0x4745('0x31')],function(_0x400416){return _0x3c8112['includes'](_0x400416[_0x4745('0x29')]['name']);});_['remove'](_0x17a5cb['result'][_0x4745('0x31')],function(_0x2a01b9){return _0x2a01b9[_0x4745('0x69')]==='false';});return{'count':_0x17a5cb['result'][_0x4745('0x31')]['length'],'rows':_['map'](_0x17a5cb[_0x4745('0x60')]['fields'],function(_0x15451a){return{'id':_0x15451a[_0x4745('0x25')],'name':_0x15451a['label'],'custom':_[_0x4745('0x6a')](_0x15451a[_0x4745('0x25')],_0x4745('0x6b'))?!![]:![],'options':_0x15451a['type'][_0x4745('0x25')]===_0x4745('0x6c')&&_0x15451a[_0x4745('0x29')]['picklistValues']['length']>0x0?_[_0x4745('0x39')](_0x15451a['type'][_0x4745('0x6d')],function(_0x5ec505){return{'name':_0x5ec505[_0x4745('0x6e')],'value':_0x5ec505[_0x4745('0x6f')]};}):[]};})};}})[_0x4745('0x21')](respondWithResult(_0x3fe3fa,null))[_0x4745('0x3f')](function(_0x5b8b14){console[_0x4745('0x70')]('vTiger\x20error:\x20'+_0x5b8b14);var _0x432b14=_0x96563f[_0x4745('0x2c')][_0x4745('0x71')]?0x1f4:_0x5b8b14[_0x4745('0x72')]||0x1f4;logger[_0x4745('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x4745('0x50'),_0x432b14,JSON[_0x4745('0x73')](_0x5b8b14));delete _0x5b8b14[_0x4745('0x25')];if(_0x432b14===0x191){_0x432b14=0x190;}_0x3fe3fa[_0x4745('0x15')](_0x432b14)[_0x4745('0x26')](_0x96563f[_0x4745('0x2c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x5b8b14[_0x4745('0x72')]}:_0x5b8b14);});}; \ No newline at end of file +var _0x792d=['startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','save','update','destroy','then','error','stack','name','send','index','VtigerAccount','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','GET','getchallenge','success','POST','login','token','result','sessionName','autogenerated','remove','editable','label'];(function(_0x5019e4,_0x1d8ba3){var _0x408f4f=function(_0x3b89ec){while(--_0x3b89ec){_0x5019e4['push'](_0x5019e4['shift']());}};_0x408f4f(++_0x1d8ba3);}(_0x792d,0x1da));var _0xd792=function(_0xa3b5b,_0x350d8a){_0xa3b5b=_0xa3b5b-0x0;var _0x32852a=_0x792d[_0xa3b5b];return _0x32852a;};'use strict';var emlformat=require(_0xd792('0x0'));var rimraf=require(_0xd792('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd792('0x2'));var rp=require('request-promise');var moment=require(_0xd792('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd792('0x4'));var util=require(_0xd792('0x5'));var path=require(_0xd792('0x6'));var sox=require('sox');var csv=require(_0xd792('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd792('0x8'));var squel=require(_0xd792('0x9'));var crypto=require(_0xd792('0xa'));var jsforce=require(_0xd792('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd792('0x7'));var querystring=require(_0xd792('0xc'));var Papa=require(_0xd792('0xd'));var Redis=require('ioredis');var authService=require(_0xd792('0xe'));var qs=require(_0xd792('0xf'));var as=require(_0xd792('0x10'));var hardwareService=require(_0xd792('0x11'));var logger=require(_0xd792('0x12'))(_0xd792('0x13'));var utils=require(_0xd792('0x14'));var config=require(_0xd792('0x15'));var licenseUtil=require(_0xd792('0x16'));var db=require(_0xd792('0x17'))['db'];var integrations=require(_0xd792('0x18'));function respondWithStatusCode(_0x3e125d,_0xe621cf){_0xe621cf=_0xe621cf||0xcc;return function(_0x54765b){if(_0x54765b){return _0x3e125d[_0xd792('0x19')](_0xe621cf);}return _0x3e125d[_0xd792('0x1a')](_0xe621cf)[_0xd792('0x1b')]();};}function respondWithResult(_0x2cdace,_0x1e7745){_0x1e7745=_0x1e7745||0xc8;return function(_0x564242){if(_0x564242){return _0x2cdace[_0xd792('0x1a')](_0x1e7745)[_0xd792('0x1c')](_0x564242);}};}function respondWithFilteredResult(_0x190eb4,_0x3ea514){return function(_0x5a9ad6){if(_0x5a9ad6){var _0x571182=typeof _0x3ea514['offset']===_0xd792('0x1d')&&typeof _0x3ea514[_0xd792('0x1e')]===_0xd792('0x1d');var _0x113532=_0x5a9ad6['count'];var _0x7469f0=_0x571182?0x0:_0x3ea514[_0xd792('0x1f')];var _0x4c97c2=_0x571182?_0x5a9ad6[_0xd792('0x20')]:_0x3ea514['offset']+_0x3ea514['limit'];var _0x45ffeb;if(_0x4c97c2>=_0x113532){_0x4c97c2=_0x113532;_0x45ffeb=0xc8;}else{_0x45ffeb=0xce;}_0x190eb4[_0xd792('0x1a')](_0x45ffeb);return _0x190eb4[_0xd792('0x21')]('Content-Range',_0x7469f0+'-'+_0x4c97c2+'/'+_0x113532)[_0xd792('0x1c')](_0x5a9ad6);}return null;};}function patchUpdates(_0x461134){return function(_0x28fed7){try{jsonpatch[_0xd792('0x22')](_0x28fed7,_0x461134,!![]);}catch(_0x2e3260){return BPromise['reject'](_0x2e3260);}return _0x28fed7[_0xd792('0x23')]();};}function saveUpdates(_0xe9666d,_0x26f22b){return function(_0x4241d3){if(_0x4241d3){return _0x4241d3[_0xd792('0x24')](_0xe9666d)['then'](function(_0x21a93f){return _0x21a93f;});}return null;};}function removeEntity(_0x57422f,_0x825e78){return function(_0xccfeab){if(_0xccfeab){return _0xccfeab[_0xd792('0x25')]()[_0xd792('0x26')](function(){_0x57422f[_0xd792('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54d065,_0x370421){return function(_0x16ef67){if(!_0x16ef67){_0x54d065['sendStatus'](0x194);}return _0x16ef67;};}function handleError(_0x321f8c,_0x45127c){_0x45127c=_0x45127c||0x1f4;return function(_0x46f4d2){logger[_0xd792('0x27')](_0x46f4d2[_0xd792('0x28')]);if(_0x46f4d2[_0xd792('0x29')]){delete _0x46f4d2['name'];}_0x321f8c[_0xd792('0x1a')](_0x45127c)[_0xd792('0x2a')](_0x46f4d2);};}exports[_0xd792('0x2b')]=function(_0x2c12e0,_0x528781){var _0x1efa64={},_0x60a434={},_0x6be231={'count':0x0,'rows':[]};var _0x37e06a=_['map'](db[_0xd792('0x2c')][_0xd792('0x2d')],function(_0xb6b14){return{'name':_0xb6b14['fieldName'],'type':_0xb6b14[_0xd792('0x2e')][_0xd792('0x2f')]};});_0x60a434[_0xd792('0x30')]=_[_0xd792('0x31')](_0x37e06a,'name');_0x60a434[_0xd792('0x32')]=_[_0xd792('0x33')](_0x2c12e0['query']);_0x60a434['filters']=_[_0xd792('0x34')](_0x60a434[_0xd792('0x30')],_0x60a434[_0xd792('0x32')]);_0x1efa64[_0xd792('0x35')]=_[_0xd792('0x34')](_0x60a434[_0xd792('0x30')],qs['fields'](_0x2c12e0[_0xd792('0x32')][_0xd792('0x36')]));_0x1efa64['attributes']=_0x1efa64[_0xd792('0x35')][_0xd792('0x37')]?_0x1efa64['attributes']:_0x60a434[_0xd792('0x30')];if(!_0x2c12e0[_0xd792('0x32')]['hasOwnProperty'](_0xd792('0x38'))){_0x1efa64['limit']=qs[_0xd792('0x1e')](_0x2c12e0[_0xd792('0x32')]['limit']);_0x1efa64[_0xd792('0x1f')]=qs['offset'](_0x2c12e0[_0xd792('0x32')][_0xd792('0x1f')]);}_0x1efa64[_0xd792('0x39')]=qs['sort'](_0x2c12e0['query'][_0xd792('0x3a')]);_0x1efa64[_0xd792('0x3b')]=qs[_0xd792('0x3c')](_['pick'](_0x2c12e0['query'],_0x60a434['filters']),_0x37e06a);if(_0x2c12e0[_0xd792('0x32')]['filter']){_0x1efa64['where']=_[_0xd792('0x3d')](_0x1efa64[_0xd792('0x3b')],{'$or':_[_0xd792('0x31')](_0x37e06a,function(_0x9bf228){if(_0x9bf228[_0xd792('0x2e')]!==_0xd792('0x3e')){var _0x1b0793={};_0x1b0793[_0x9bf228['name']]={'$like':'%'+_0x2c12e0[_0xd792('0x32')][_0xd792('0x3f')]+'%'};return _0x1b0793;}})});}_0x1efa64=_['merge']({},_0x1efa64,_0x2c12e0['options']);var _0x56551f={'where':_0x1efa64[_0xd792('0x3b')]};return db[_0xd792('0x2c')][_0xd792('0x20')](_0x56551f)[_0xd792('0x26')](function(_0x50aa46){_0x6be231[_0xd792('0x20')]=_0x50aa46;if(_0x2c12e0[_0xd792('0x32')][_0xd792('0x40')]){_0x1efa64[_0xd792('0x41')]=[{'all':!![]}];}return db['VtigerAccount'][_0xd792('0x42')](_0x1efa64);})['then'](function(_0x446984){_0x6be231[_0xd792('0x43')]=_0x446984;return _0x6be231;})[_0xd792('0x26')](respondWithFilteredResult(_0x528781,_0x1efa64))[_0xd792('0x44')](handleError(_0x528781,null));};exports[_0xd792('0x45')]=function(_0x1916a7,_0x19cb40){var _0x141b85={'raw':![],'where':{'id':_0x1916a7[_0xd792('0x46')]['id']}},_0x270a90={};_0x270a90[_0xd792('0x30')]=_['keys'](db[_0xd792('0x2c')][_0xd792('0x2d')]);_0x270a90[_0xd792('0x32')]=_[_0xd792('0x33')](_0x1916a7[_0xd792('0x32')]);_0x270a90[_0xd792('0x3c')]=_['intersection'](_0x270a90[_0xd792('0x30')],_0x270a90[_0xd792('0x32')]);_0x141b85[_0xd792('0x35')]=_[_0xd792('0x34')](_0x270a90[_0xd792('0x30')],qs[_0xd792('0x36')](_0x1916a7['query'][_0xd792('0x36')]));_0x141b85[_0xd792('0x35')]=_0x141b85[_0xd792('0x35')][_0xd792('0x37')]?_0x141b85[_0xd792('0x35')]:_0x270a90['model'];if(_0x1916a7[_0xd792('0x32')]['includeAll']){_0x141b85['include']=[{'all':!![]}];}_0x141b85=_[_0xd792('0x3d')]({},_0x141b85,_0x1916a7[_0xd792('0x47')]);return db['VtigerAccount']['find'](_0x141b85)[_0xd792('0x26')](handleEntityNotFound(_0x19cb40,null))[_0xd792('0x26')](respondWithResult(_0x19cb40,null))['catch'](handleError(_0x19cb40,null));};exports['create']=function(_0x40289b,_0x3d4c85){return db[_0xd792('0x2c')][_0xd792('0x48')](_0x40289b[_0xd792('0x49')],{})[_0xd792('0x26')](respondWithResult(_0x3d4c85,0xc9))['catch'](handleError(_0x3d4c85,null));};exports[_0xd792('0x24')]=function(_0x501fb6,_0x22315b){if(_0x501fb6[_0xd792('0x49')]['id']){delete _0x501fb6[_0xd792('0x49')]['id'];}return db[_0xd792('0x2c')][_0xd792('0x4a')]({'where':{'id':_0x501fb6['params']['id']}})['then'](handleEntityNotFound(_0x22315b,null))[_0xd792('0x26')](saveUpdates(_0x501fb6[_0xd792('0x49')],null))['then'](respondWithResult(_0x22315b,null))[_0xd792('0x44')](handleError(_0x22315b,null));};exports[_0xd792('0x25')]=function(_0x4eea07,_0x422448){return db[_0xd792('0x2c')][_0xd792('0x4a')]({'where':{'id':_0x4eea07[_0xd792('0x46')]['id']}})['then'](handleEntityNotFound(_0x422448,null))[_0xd792('0x26')](removeEntity(_0x422448,null))[_0xd792('0x44')](handleError(_0x422448,null));};exports[_0xd792('0x4b')]=function(_0x394717,_0x293c8b,_0x36a555){var _0x1e4366={};var _0x6c345={};var _0x463707;var _0x5ba643;return db[_0xd792('0x2c')][_0xd792('0x4c')]({'where':{'id':_0x394717[_0xd792('0x46')]['id']}})[_0xd792('0x26')](handleEntityNotFound(_0x293c8b,null))['then'](function(_0x466ede){if(_0x466ede){_0x463707=_0x466ede;_0x6c345[_0xd792('0x30')]=_[_0xd792('0x33')](db[_0xd792('0x4d')]['rawAttributes']);_0x6c345[_0xd792('0x32')]=_[_0xd792('0x33')](_0x394717[_0xd792('0x32')]);_0x6c345['filters']=_[_0xd792('0x34')](_0x6c345[_0xd792('0x30')],_0x6c345[_0xd792('0x32')]);_0x1e4366[_0xd792('0x35')]=_[_0xd792('0x34')](_0x6c345[_0xd792('0x30')],qs[_0xd792('0x36')](_0x394717[_0xd792('0x32')][_0xd792('0x36')]));_0x1e4366[_0xd792('0x35')]=_0x1e4366['attributes']['length']?_0x1e4366[_0xd792('0x35')]:_0x6c345[_0xd792('0x30')];_0x1e4366['order']=qs[_0xd792('0x3a')](_0x394717[_0xd792('0x32')][_0xd792('0x3a')]);_0x1e4366[_0xd792('0x3b')]=qs['filters'](_['pick'](_0x394717[_0xd792('0x32')],_0x6c345[_0xd792('0x3c')]));if(_0x394717['query'][_0xd792('0x3f')]){_0x1e4366['where']=_[_0xd792('0x3d')](_0x1e4366[_0xd792('0x3b')],{'$or':_[_0xd792('0x31')](_0x1e4366[_0xd792('0x35')],function(_0x1d831b){var _0x66ead1={};_0x66ead1[_0x1d831b]={'$like':'%'+_0x394717[_0xd792('0x32')][_0xd792('0x3f')]+'%'};return _0x66ead1;})});}_0x1e4366=_[_0xd792('0x3d')]({},_0x1e4366,_0x394717['options']);return _0x463707[_0xd792('0x4b')](_0x1e4366);}})[_0xd792('0x26')](function(_0x72c676){if(_0x72c676){_0x5ba643=_0x72c676['length'];if(!_0x394717[_0xd792('0x32')][_0xd792('0x4e')]('nolimit')){_0x1e4366[_0xd792('0x1e')]=qs[_0xd792('0x1e')](_0x394717['query']['limit']);_0x1e4366[_0xd792('0x1f')]=qs[_0xd792('0x1f')](_0x394717['query'][_0xd792('0x1f')]);}return _0x463707[_0xd792('0x4b')](_0x1e4366);}})[_0xd792('0x26')](function(_0x2442e6){if(_0x2442e6){return _0x2442e6?{'count':_0x5ba643,'rows':_0x2442e6}:null;}})['then'](respondWithResult(_0x293c8b,null))['catch'](handleError(_0x293c8b,null));};exports[_0xd792('0x4f')]=function(_0x287639,_0x5c62fb,_0x3c2f9a){if(_0x287639[_0xd792('0x49')]['id']){delete _0x287639['body']['id'];}return db[_0xd792('0x2c')][_0xd792('0x4c')]({'where':{'id':_0x287639[_0xd792('0x46')]['id']}})[_0xd792('0x26')](handleEntityNotFound(_0x5c62fb,null))[_0xd792('0x26')](function(_0x251ecd){if(_0x251ecd){_0x287639['body']['AccountId']=_0x251ecd['id'];_0x287639[_0xd792('0x49')]['Subjects']=integrations['getSubjects'](_0x287639['body'][_0xd792('0x50')],_0x287639[_0xd792('0x49')][_0xd792('0x2e')]);_0x287639['body'][_0xd792('0x51')]=integrations[_0xd792('0x52')](_0x287639[_0xd792('0x49')]['channel'],_0x287639[_0xd792('0x49')][_0xd792('0x2e')]);return db[_0xd792('0x4d')][_0xd792('0x48')](_0x287639[_0xd792('0x49')],{'include':[{'model':db[_0xd792('0x53')],'as':'Subjects'},{'model':db[_0xd792('0x53')],'as':_0xd792('0x51')}]});}return null;})['then'](respondWithResult(_0x5c62fb,null))[_0xd792('0x44')](handleError(_0x5c62fb,null));};var md5=require('md5');exports[_0xd792('0x54')]=function(_0x1b1cf1,_0x57e14c,_0x1d5cb7){var _0x5876b9=null;var _0x288d2d=null;var _0xa0a375=null;var _0x1ceb99=null;var _0x2d0efe='';return db[_0xd792('0x2c')][_0xd792('0x4c')]({'where':{'id':_0x1b1cf1[_0xd792('0x46')]['id']},'attributes':['id',_0xd792('0x29'),_0xd792('0x55'),_0xd792('0x56'),_0xd792('0x57'),_0xd792('0x58'),_0xd792('0x59'),'accessKey']})[_0xd792('0x26')](handleEntityNotFound(_0x57e14c,null))['then'](function(_0x16c505){if(_0x16c505){_0x5876b9=_0x16c505[_0xd792('0x55')];_0x288d2d=_0x16c505[_0xd792('0x5a')];_0xa0a375=_0x16c505[_0xd792('0x57')];_0x2d0efe=_0x16c505[_0xd792('0x58')];var _0x5cb683=_0x2d0efe[_0xd792('0x5b')](-0x1);if(_0x5cb683==='/'){_0x2d0efe=_0x2d0efe['substring'](0x0,_0x2d0efe[_0xd792('0x5c')](_0x5cb683));}_0x1ceb99=util[_0xd792('0x5d')]('%s/webservice.php',_0x2d0efe);var _0x25b974={'method':_0xd792('0x5e'),'uri':_0x1ceb99,'qs':{'operation':_0xd792('0x5f'),'username':_0x16c505[_0xd792('0x55')]},'json':!![]};return rp(_0x25b974);}})['then'](function(_0x3c9fd6){if(_0x3c9fd6[_0xd792('0x60')]){var _0x5aee69={'method':_0xd792('0x61'),'uri':_0x1ceb99,'form':{'operation':_0xd792('0x62'),'username':_0x5876b9,'accessKey':md5(_0x3c9fd6['result'][_0xd792('0x63')]+_0x288d2d)},'json':!![]};return rp(_0x5aee69);}})[_0xd792('0x26')](function(_0xa24297){if(_0xa24297[_0xd792('0x60')]){var _0x24b979={'method':_0xd792('0x5e'),'uri':_0x1ceb99,'qs':{'operation':'describe','username':_0x5876b9,'sessionName':_0xa24297[_0xd792('0x64')][_0xd792('0x65')],'elementType':_0xa0a375},'json':!![]};return rp(_0x24b979);}})[_0xd792('0x26')](function(_0x405a9){if(_0x405a9[_0xd792('0x60')]){var _0x345e33=[_0xd792('0x66'),'reference','owner'];_[_0xd792('0x67')](_0x405a9[_0xd792('0x64')][_0xd792('0x36')],function(_0x54223e){return _0x345e33['includes'](_0x54223e[_0xd792('0x2e')][_0xd792('0x29')]);});_['remove'](_0x405a9['result']['fields'],function(_0x3ebabf){return _0x3ebabf[_0xd792('0x68')]==='false';});return{'count':_0x405a9['result'][_0xd792('0x36')][_0xd792('0x37')],'rows':_[_0xd792('0x31')](_0x405a9[_0xd792('0x64')]['fields'],function(_0x279c0d){return{'id':_0x279c0d[_0xd792('0x29')],'name':_0x279c0d[_0xd792('0x69')],'custom':_[_0xd792('0x6a')](_0x279c0d['name'],_0xd792('0x6b'))?!![]:![],'options':_0x279c0d['type'][_0xd792('0x29')]===_0xd792('0x6c')&&_0x279c0d['type'][_0xd792('0x6d')][_0xd792('0x37')]>0x0?_[_0xd792('0x31')](_0x279c0d[_0xd792('0x2e')][_0xd792('0x6d')],function(_0x495bc6){return{'name':_0x495bc6[_0xd792('0x69')],'value':_0x495bc6['value']};}):[]};})};}})[_0xd792('0x26')](respondWithResult(_0x57e14c,null))[_0xd792('0x44')](function(_0x78a6db){console[_0xd792('0x6e')](_0xd792('0x6f')+_0x78a6db);var _0xaacd5b=_0x1b1cf1['query'][_0xd792('0x70')]?0x1f4:_0x78a6db['statusCode']||0x1f4;logger['error'](_0xd792('0x71'),_0xd792('0x54'),_0xaacd5b,JSON['stringify'](_0x78a6db));delete _0x78a6db['name'];if(_0xaacd5b===0x191){_0xaacd5b=0x190;}_0x57e14c[_0xd792('0x1a')](_0xaacd5b)[_0xd792('0x2a')](_0x1b1cf1['query']['test']?{'message':_0xd792('0x72'),'statusCode':_0x78a6db[_0xd792('0x73')]}:_0x78a6db);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 02c697b..f466796 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 _0xb6f7=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util'];(function(_0x313756,_0x2c6c29){var _0x324e4e=function(_0x37e2ce){while(--_0x37e2ce){_0x313756['push'](_0x313756['shift']());}};_0x324e4e(++_0x2c6c29);}(_0xb6f7,0x1d3));var _0x7b6f=function(_0x4511f5,_0x39164e){_0x4511f5=_0x4511f5-0x0;var _0x32c890=_0xb6f7[_0x4511f5];return _0x32c890;};'use strict';var _=require('lodash');var util=require(_0x7b6f('0x0'));var logger=require(_0x7b6f('0x1'))(_0x7b6f('0x2'));var moment=require(_0x7b6f('0x3'));var BPromise=require(_0x7b6f('0x4'));var rp=require(_0x7b6f('0x5'));var fs=require('fs');var path=require(_0x7b6f('0x6'));var rimraf=require('rimraf');var config=require(_0x7b6f('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x7b6f('0x8'));module[_0x7b6f('0x9')]=function(_0x2b5e85,_0x5020ea){return _0x2b5e85[_0x7b6f('0xa')](_0x7b6f('0xb'),attributes,{'tableName':_0x7b6f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbb4=['../../components/integrations/configuration','exports','define','VtigerAccount','util','api','moment','path','rimraf','../../config/environment'];(function(_0x3c8af6,_0x43128b){var _0x31bf95=function(_0x2e2449){while(--_0x2e2449){_0x3c8af6['push'](_0x3c8af6['shift']());}};_0x31bf95(++_0x43128b);}(_0xbbb4,0xe0));var _0x4bbb=function(_0x486406,_0x37be14){_0x486406=_0x486406-0x0;var _0x26d325=_0xbbb4[_0x486406];return _0x26d325;};'use strict';var _=require('lodash');var util=require(_0x4bbb('0x0'));var logger=require('../../config/logger')(_0x4bbb('0x1'));var moment=require(_0x4bbb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bbb('0x3'));var rimraf=require(_0x4bbb('0x4'));var config=require(_0x4bbb('0x5'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x4bbb('0x6'));module[_0x4bbb('0x7')]=function(_0x25d42a,_0x5671b2){return _0x25d42a[_0x4bbb('0x8')](_0x4bbb('0x9'),attributes,{'tableName':'int_vtiger_accounts','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 3939638..c9c4df1 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 _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(_0x5cfd35,_0x245a8f){var _0x1e8ab9=function(_0x461520){while(--_0x461520){_0x5cfd35['push'](_0x5cfd35['shift']());}};_0x1e8ab9(++_0x245a8f);}(_0x2e54,0x1dd));var _0x42e5=function(_0x75c665,_0x9ecc65){_0x75c665=_0x75c665-0x0;var _0xbf13c6=_0x2e54[_0x75c665];return _0xbf13c6;};'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 +var _0x236c=['jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','options','raw','where','attributes','include','map','model','VtigerAccount','find','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x5db720,_0x1d6bdd){var _0x2ab3e2=function(_0x4f3692){while(--_0x4f3692){_0x5db720['push'](_0x5db720['shift']());}};_0x2ab3e2(++_0x1d6bdd);}(_0x236c,0x155));var _0xc236=function(_0x4a5a86,_0xfe8f43){_0x4a5a86=_0x4a5a86-0x0;var _0x4aa2a2=_0x236c[_0x4a5a86];return _0x4aa2a2;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5abd65,_0xd612c6,_0x4d349b){return new BPromise(function(_0x51a13b,_0x5bc6a2){return client['request'](_0x5abd65,_0x4d349b)[_0xc236('0xc')](function(_0x4b8dc6){logger[_0xc236('0xd')](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));logger[_0xc236('0x10')](_0xc236('0x11'),_0xd612c6,'request\x20sent',JSON[_0xc236('0x12')](_0x4b8dc6));if(_0x4b8dc6[_0xc236('0x13')]){if(_0x4b8dc6['error'][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('VtigerAccount,\x20%s,\x20%s',_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x5bc6a2(_0x4b8dc6['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0xe'),_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x51a13b(_0x4b8dc6[_0xc236('0x13')]['message']);}else{logger['info'](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));_0x51a13b(_0x4b8dc6[_0xc236('0x16')][_0xc236('0x15')]);}})[_0xc236('0x17')](function(_0x5ac3ed){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xd612c6,_0x5ac3ed);_0x5bc6a2(_0x5ac3ed);});});}exports[_0xc236('0x18')]=function(_0x76f45){var _0x11ec65=this;return new Promise(function(_0x541a20,_0x13b432){return db['VtigerAccount']['findAll']({'raw':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1a')]===undefined?!![]:![]:!![],'where':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1b')]||null:null,'attributes':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1c')]||null:null,'limit':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')]['limit']||null:null,'include':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1d')]?_[_0xc236('0x1e')](_0x76f45[_0xc236('0x19')][_0xc236('0x1d')],function(_0x3a315b){return{'model':db[_0x3a315b[_0xc236('0x1f')]],'as':_0x3a315b['as'],'attributes':_0x3a315b[_0xc236('0x1c')],'include':_0x3a315b[_0xc236('0x1d')]?_[_0xc236('0x1e')](_0x3a315b['include'],function(_0x308cd6){return{'model':db[_0x308cd6[_0xc236('0x1f')]],'as':_0x308cd6['as'],'attributes':_0x308cd6[_0xc236('0x1c')],'include':_0x308cd6[_0xc236('0x1d')]?_['map'](_0x308cd6[_0xc236('0x1d')],function(_0x5da4b2){return{'model':db[_0x5da4b2['model']],'as':_0x5da4b2['as'],'attributes':_0x5da4b2[_0xc236('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36e578){logger['info'](_0xc236('0x18'),_0x76f45);logger['debug'](_0xc236('0x18'),_0x76f45,JSON[_0xc236('0x12')](_0x36e578));_0x541a20(_0x36e578);})['catch'](function(_0x5a61b5){logger[_0xc236('0x13')](_0xc236('0x18'),_0x5a61b5[_0xc236('0x15')],_0x76f45);_0x13b432(_0x11ec65[_0xc236('0x13')](0x1f4,_0x5a61b5['message']));});});};exports['ShowVtigerAccount']=function(_0x28ffa5){var _0x53b767=this;return new Promise(function(_0x2c756f,_0x4ddc87){return db[_0xc236('0x20')][_0xc236('0x21')]({'raw':_0x28ffa5['options']?_0x28ffa5['options'][_0xc236('0x1a')]===undefined?!![]:![]:!![],'where':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')][_0xc236('0x1b')]||null:null,'attributes':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')][_0xc236('0x1c')]||null:null,'include':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')]['include']?_['map'](_0x28ffa5['options'][_0xc236('0x1d')],function(_0xfda1f9){return{'model':db[_0xfda1f9[_0xc236('0x1f')]],'as':_0xfda1f9['as'],'attributes':_0xfda1f9[_0xc236('0x1c')],'include':_0xfda1f9[_0xc236('0x1d')]?_[_0xc236('0x1e')](_0xfda1f9[_0xc236('0x1d')],function(_0x5761de){return{'model':db[_0x5761de[_0xc236('0x1f')]],'as':_0x5761de['as'],'attributes':_0x5761de[_0xc236('0x1c')],'include':_0x5761de[_0xc236('0x1d')]?_['map'](_0x5761de[_0xc236('0x1d')],function(_0x2a8f33){return{'model':db[_0x2a8f33[_0xc236('0x1f')]],'as':_0x2a8f33['as'],'attributes':_0x2a8f33[_0xc236('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12348b){logger[_0xc236('0xd')](_0xc236('0x22'),_0x28ffa5);logger[_0xc236('0x10')](_0xc236('0x22'),_0x28ffa5,JSON[_0xc236('0x12')](_0x12348b));_0x2c756f(_0x12348b);})[_0xc236('0x17')](function(_0x11ca1c){logger[_0xc236('0x13')](_0xc236('0x22'),_0x11ca1c[_0xc236('0x15')],_0x28ffa5);_0x4ddc87(_0x53b767[_0xc236('0x13')](0x1f4,_0x11ca1c[_0xc236('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ed54f6a..8c3eb7d 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 _0xbe01=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','/:id','update','exports','multer'];(function(_0x1f38c6,_0x428650){var _0x259367=function(_0x22bad0){while(--_0x22bad0){_0x1f38c6['push'](_0x1f38c6['shift']());}};_0x259367(++_0x428650);}(_0xbe01,0xaf));var _0x1be0=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xbe01[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x1be0('0x0'));var util=require('util');var path=require(_0x1be0('0x1'));var timeout=require('connect-timeout');var express=require(_0x1be0('0x2'));var router=express[_0x1be0('0x3')]();var fs_extra=require(_0x1be0('0x4'));var auth=require(_0x1be0('0x5'));var interaction=require(_0x1be0('0x6'));var config=require(_0x1be0('0x7'));var controller=require(_0x1be0('0x8'));router[_0x1be0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1be0('0x9')]('/:id',auth[_0x1be0('0xa')](),controller[_0x1be0('0xb')]);router[_0x1be0('0x9')](_0x1be0('0xc'),auth['isAuthenticated'](),controller[_0x1be0('0xd')]);router[_0x1be0('0x9')](_0x1be0('0xe'),auth['isAuthenticated'](),controller[_0x1be0('0xf')]);router[_0x1be0('0x9')](_0x1be0('0x10'),auth[_0x1be0('0xa')](),controller[_0x1be0('0x11')]);router['post']('/',auth[_0x1be0('0xa')](),controller['create']);router[_0x1be0('0x12')](_0x1be0('0x13'),auth[_0x1be0('0xa')](),controller[_0x1be0('0x14')]);router['delete'](_0x1be0('0x13'),auth[_0x1be0('0xa')](),controller['destroy']);module[_0x1be0('0x15')]=router; \ No newline at end of file +var _0x839a=['create','put','update','delete','destroy','util','path','express','Router','fs-extra','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x8b416e,_0x1d8311){var _0x4b6d6a=function(_0x323480){while(--_0x323480){_0x8b416e['push'](_0x8b416e['shift']());}};_0x4b6d6a(++_0x1d8311);}(_0x839a,0x195));var _0xa839=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x839a[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0xa839('0x0'));var path=require(_0xa839('0x1'));var timeout=require('connect-timeout');var express=require(_0xa839('0x2'));var router=express[_0xa839('0x3')]();var fs_extra=require(_0xa839('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xa839('0x5')]('/',auth[_0xa839('0x6')](),controller[_0xa839('0x7')]);router['get'](_0xa839('0x8'),auth[_0xa839('0x6')](),controller[_0xa839('0x9')]);router[_0xa839('0x5')](_0xa839('0xa'),auth[_0xa839('0x6')](),controller['getFields']);router['get'](_0xa839('0xb'),auth[_0xa839('0x6')](),controller[_0xa839('0xc')]);router[_0xa839('0x5')](_0xa839('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xa839('0xe')]('/',auth['isAuthenticated'](),controller[_0xa839('0xf')]);router[_0xa839('0x10')](_0xa839('0x8'),auth[_0xa839('0x6')](),controller[_0xa839('0x11')]);router[_0xa839('0x12')](_0xa839('0x8'),auth[_0xa839('0x6')](),controller[_0xa839('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 4d8eacb..49eb18b 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 _0x1e4e=['STRING','exports'];(function(_0x1b4a60,_0x267dc5){var _0x52412c=function(_0x13e5a4){while(--_0x13e5a4){_0x1b4a60['push'](_0x1b4a60['shift']());}};_0x52412c(++_0x267dc5);}(_0x1e4e,0x1bf));var _0xe1e4=function(_0x57ff54,_0x2056d5){_0x57ff54=_0x57ff54-0x0;var _0x3ae8ca=_0x1e4e[_0x57ff54];return _0x3ae8ca;};'use strict';var Sequelize=require('sequelize');module[_0xe1e4('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe1e4('0x1')]}}; \ No newline at end of file +var _0x53db=['exports','STRING'];(function(_0x5df900,_0x31dec5){var _0x3868fa=function(_0x31f45c){while(--_0x31f45c){_0x5df900['push'](_0x5df900['shift']());}};_0x3868fa(++_0x31dec5);}(_0x53db,0x104));var _0xb53d=function(_0x1030ad,_0x326fcf){_0x1030ad=_0x1030ad-0x0;var _0x209705=_0x53db[_0x1030ad];return _0x209705;};'use strict';var Sequelize=require('sequelize');module[_0xb53d('0x0')]={'name':{'type':Sequelize[_0xb53d('0x1')]},'description':{'type':Sequelize[_0xb53d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a879dc8..07fffb8 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 _0x6f58=['ejs','lodash','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','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','save','update','then','error','stack','name','send','index','VtigerConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','merge','options','find','create','body','getFields','findOne','VtigerField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox'];(function(_0x122ebd,_0x509b2a){var _0x5a9809=function(_0x53dba3){while(--_0x53dba3){_0x122ebd['push'](_0x122ebd['shift']());}};_0x5a9809(++_0x509b2a);}(_0x6f58,0xe9));var _0x86f5=function(_0x15b426,_0x282d23){_0x15b426=_0x15b426-0x0;var _0x4a60e7=_0x6f58[_0x15b426];return _0x4a60e7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x86f5('0x0'));var jsonpatch=require(_0x86f5('0x1'));var rp=require(_0x86f5('0x2'));var moment=require('moment');var BPromise=require(_0x86f5('0x3'));var Mustache=require(_0x86f5('0x4'));var util=require('util');var path=require(_0x86f5('0x5'));var sox=require(_0x86f5('0x6'));var csv=require('to-csv');var ejs=require(_0x86f5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x86f5('0x8'));var squel=require('squel');var crypto=require(_0x86f5('0x9'));var jsforce=require(_0x86f5('0xa'));var deskjs=require(_0x86f5('0xb'));var toCsv=require(_0x86f5('0xc'));var querystring=require(_0x86f5('0xd'));var Papa=require(_0x86f5('0xe'));var Redis=require('ioredis');var authService=require(_0x86f5('0xf'));var qs=require(_0x86f5('0x10'));var as=require(_0x86f5('0x11'));var hardwareService=require(_0x86f5('0x12'));var logger=require(_0x86f5('0x13'))(_0x86f5('0x14'));var utils=require(_0x86f5('0x15'));var config=require(_0x86f5('0x16'));var licenseUtil=require(_0x86f5('0x17'));var db=require(_0x86f5('0x18'))['db'];function respondWithStatusCode(_0x264cbe,_0x4e2029){_0x4e2029=_0x4e2029||0xcc;return function(_0x3d083d){if(_0x3d083d){return _0x264cbe[_0x86f5('0x19')](_0x4e2029);}return _0x264cbe[_0x86f5('0x1a')](_0x4e2029)[_0x86f5('0x1b')]();};}function respondWithResult(_0x9dafd,_0x5df6ad){_0x5df6ad=_0x5df6ad||0xc8;return function(_0x216e66){if(_0x216e66){return _0x9dafd[_0x86f5('0x1a')](_0x5df6ad)['json'](_0x216e66);}};}function respondWithFilteredResult(_0x9b5f10,_0x438619){return function(_0x27c5a5){if(_0x27c5a5){var _0x8a4c28=typeof _0x438619[_0x86f5('0x1c')]==='undefined'&&typeof _0x438619[_0x86f5('0x1d')]===_0x86f5('0x1e');var _0x2a3aac=_0x27c5a5[_0x86f5('0x1f')];var _0x4a1835=_0x8a4c28?0x0:_0x438619[_0x86f5('0x1c')];var _0x1f3474=_0x8a4c28?_0x27c5a5[_0x86f5('0x1f')]:_0x438619['offset']+_0x438619[_0x86f5('0x1d')];var _0x335105;if(_0x1f3474>=_0x2a3aac){_0x1f3474=_0x2a3aac;_0x335105=0xc8;}else{_0x335105=0xce;}_0x9b5f10[_0x86f5('0x1a')](_0x335105);return _0x9b5f10[_0x86f5('0x20')](_0x86f5('0x21'),_0x4a1835+'-'+_0x1f3474+'/'+_0x2a3aac)[_0x86f5('0x22')](_0x27c5a5);}return null;};}function patchUpdates(_0x2ae4db){return function(_0x27e93f){try{jsonpatch['apply'](_0x27e93f,_0x2ae4db,!![]);}catch(_0xb53eeb){return BPromise['reject'](_0xb53eeb);}return _0x27e93f[_0x86f5('0x23')]();};}function saveUpdates(_0xc77f9b,_0x25887e){return function(_0x5e1039){if(_0x5e1039){return _0x5e1039[_0x86f5('0x24')](_0xc77f9b)[_0x86f5('0x25')](function(_0x2194bf){return _0x2194bf;});}return null;};}function removeEntity(_0x2e0647,_0x4c4b8b){return function(_0x3fe9e7){if(_0x3fe9e7){return _0x3fe9e7['destroy']()[_0x86f5('0x25')](function(){_0x2e0647['status'](0xcc)[_0x86f5('0x1b')]();});}};}function handleEntityNotFound(_0x592671,_0x442354){return function(_0x543cf5){if(!_0x543cf5){_0x592671[_0x86f5('0x19')](0x194);}return _0x543cf5;};}function handleError(_0x3ecba8,_0x3a96e5){_0x3a96e5=_0x3a96e5||0x1f4;return function(_0xda49fc){logger[_0x86f5('0x26')](_0xda49fc[_0x86f5('0x27')]);if(_0xda49fc[_0x86f5('0x28')]){delete _0xda49fc['name'];}_0x3ecba8[_0x86f5('0x1a')](_0x3a96e5)[_0x86f5('0x29')](_0xda49fc);};}exports[_0x86f5('0x2a')]=function(_0x4a0b21,_0x3321a7){var _0x54b8e6={},_0x406aac={},_0x28432c={'count':0x0,'rows':[]};var _0x3de324=_['map'](db[_0x86f5('0x2b')][_0x86f5('0x2c')],function(_0x2745e2){return{'name':_0x2745e2['fieldName'],'type':_0x2745e2[_0x86f5('0x2d')][_0x86f5('0x2e')]};});_0x406aac[_0x86f5('0x2f')]=_[_0x86f5('0x30')](_0x3de324,_0x86f5('0x28'));_0x406aac[_0x86f5('0x31')]=_[_0x86f5('0x32')](_0x4a0b21[_0x86f5('0x31')]);_0x406aac[_0x86f5('0x33')]=_[_0x86f5('0x34')](_0x406aac[_0x86f5('0x2f')],_0x406aac[_0x86f5('0x31')]);_0x54b8e6[_0x86f5('0x35')]=_[_0x86f5('0x34')](_0x406aac[_0x86f5('0x2f')],qs[_0x86f5('0x36')](_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x36')]));_0x54b8e6['attributes']=_0x54b8e6['attributes'][_0x86f5('0x37')]?_0x54b8e6[_0x86f5('0x35')]:_0x406aac[_0x86f5('0x2f')];if(!_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x38')](_0x86f5('0x39'))){_0x54b8e6[_0x86f5('0x1d')]=qs[_0x86f5('0x1d')](_0x4a0b21['query'][_0x86f5('0x1d')]);_0x54b8e6[_0x86f5('0x1c')]=qs[_0x86f5('0x1c')](_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x1c')]);}_0x54b8e6[_0x86f5('0x3a')]=qs[_0x86f5('0x3b')](_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x3b')]);_0x54b8e6['where']=qs[_0x86f5('0x33')](_['pick'](_0x4a0b21[_0x86f5('0x31')],_0x406aac[_0x86f5('0x33')]),_0x3de324);if(_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x3c')]){_0x54b8e6[_0x86f5('0x3d')]=_['merge'](_0x54b8e6[_0x86f5('0x3d')],{'$or':_['map'](_0x3de324,function(_0xebaa04){if(_0xebaa04[_0x86f5('0x2d')]!==_0x86f5('0x3e')){var _0x1b73a3={};_0x1b73a3[_0xebaa04[_0x86f5('0x28')]]={'$like':'%'+_0x4a0b21[_0x86f5('0x31')][_0x86f5('0x3c')]+'%'};return _0x1b73a3;}})});}_0x54b8e6=_['merge']({},_0x54b8e6,_0x4a0b21['options']);var _0x5729ff={'where':_0x54b8e6[_0x86f5('0x3d')]};return db[_0x86f5('0x2b')][_0x86f5('0x1f')](_0x5729ff)[_0x86f5('0x25')](function(_0x5d24e3){_0x28432c[_0x86f5('0x1f')]=_0x5d24e3;if(_0x4a0b21['query'][_0x86f5('0x3f')]){_0x54b8e6['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0x86f5('0x40')](_0x54b8e6);})['then'](function(_0x2db0c1){_0x28432c[_0x86f5('0x41')]=_0x2db0c1;return _0x28432c;})[_0x86f5('0x25')](respondWithFilteredResult(_0x3321a7,_0x54b8e6))[_0x86f5('0x42')](handleError(_0x3321a7,null));};exports[_0x86f5('0x43')]=function(_0x48db04,_0x399720){var _0x4e253e={'raw':![],'where':{'id':_0x48db04[_0x86f5('0x44')]['id']}},_0x3bb1b7={};_0x3bb1b7[_0x86f5('0x2f')]=_[_0x86f5('0x32')](db[_0x86f5('0x2b')][_0x86f5('0x2c')]);_0x3bb1b7[_0x86f5('0x31')]=_[_0x86f5('0x32')](_0x48db04[_0x86f5('0x31')]);_0x3bb1b7[_0x86f5('0x33')]=_[_0x86f5('0x34')](_0x3bb1b7[_0x86f5('0x2f')],_0x3bb1b7[_0x86f5('0x31')]);_0x4e253e['attributes']=_['intersection'](_0x3bb1b7[_0x86f5('0x2f')],qs[_0x86f5('0x36')](_0x48db04['query'][_0x86f5('0x36')]));_0x4e253e[_0x86f5('0x35')]=_0x4e253e[_0x86f5('0x35')][_0x86f5('0x37')]?_0x4e253e[_0x86f5('0x35')]:_0x3bb1b7[_0x86f5('0x2f')];if(_0x48db04['query'][_0x86f5('0x3f')]){_0x4e253e[_0x86f5('0x45')]=[{'all':!![]}];}_0x4e253e=_[_0x86f5('0x46')]({},_0x4e253e,_0x48db04[_0x86f5('0x47')]);return db[_0x86f5('0x2b')][_0x86f5('0x48')](_0x4e253e)[_0x86f5('0x25')](handleEntityNotFound(_0x399720,null))['then'](respondWithResult(_0x399720,null))['catch'](handleError(_0x399720,null));};exports[_0x86f5('0x49')]=function(_0x4961a6,_0x380184){return db[_0x86f5('0x2b')][_0x86f5('0x49')](_0x4961a6[_0x86f5('0x4a')],{})['then'](respondWithResult(_0x380184,0xc9))['catch'](handleError(_0x380184,null));};exports[_0x86f5('0x24')]=function(_0xb2302,_0x17e854){if(_0xb2302[_0x86f5('0x4a')]['id']){delete _0xb2302['body']['id'];}return db[_0x86f5('0x2b')]['find']({'where':{'id':_0xb2302[_0x86f5('0x44')]['id']}})[_0x86f5('0x25')](handleEntityNotFound(_0x17e854,null))[_0x86f5('0x25')](saveUpdates(_0xb2302['body'],null))['then'](respondWithResult(_0x17e854,null))[_0x86f5('0x42')](handleError(_0x17e854,null));};exports['destroy']=function(_0xfcb50b,_0x4f9793){return db[_0x86f5('0x2b')]['find']({'where':{'id':_0xfcb50b['params']['id']}})[_0x86f5('0x25')](handleEntityNotFound(_0x4f9793,null))[_0x86f5('0x25')](removeEntity(_0x4f9793,null))[_0x86f5('0x42')](handleError(_0x4f9793,null));};exports[_0x86f5('0x4b')]=function(_0x24b724,_0x417ca6,_0x54506a){var _0x2be83b={};var _0x566de0={};var _0x4e0194;var _0x24c66f;return db['VtigerConfiguration'][_0x86f5('0x4c')]({'where':{'id':_0x24b724[_0x86f5('0x44')]['id']}})[_0x86f5('0x25')](handleEntityNotFound(_0x417ca6,null))[_0x86f5('0x25')](function(_0x5eadab){if(_0x5eadab){_0x4e0194=_0x5eadab;_0x566de0[_0x86f5('0x2f')]=_['keys'](db[_0x86f5('0x4d')][_0x86f5('0x2c')]);_0x566de0['query']=_[_0x86f5('0x32')](_0x24b724[_0x86f5('0x31')]);_0x566de0[_0x86f5('0x33')]=_[_0x86f5('0x34')](_0x566de0[_0x86f5('0x2f')],_0x566de0[_0x86f5('0x31')]);_0x2be83b[_0x86f5('0x35')]=_['intersection'](_0x566de0[_0x86f5('0x2f')],qs[_0x86f5('0x36')](_0x24b724[_0x86f5('0x31')][_0x86f5('0x36')]));_0x2be83b[_0x86f5('0x35')]=_0x2be83b['attributes']['length']?_0x2be83b['attributes']:_0x566de0[_0x86f5('0x2f')];_0x2be83b[_0x86f5('0x3a')]=qs[_0x86f5('0x3b')](_0x24b724[_0x86f5('0x31')][_0x86f5('0x3b')]);_0x2be83b['where']=qs[_0x86f5('0x33')](_['pick'](_0x24b724[_0x86f5('0x31')],_0x566de0[_0x86f5('0x33')]));if(_0x24b724['query']['filter']){_0x2be83b[_0x86f5('0x3d')]=_[_0x86f5('0x46')](_0x2be83b[_0x86f5('0x3d')],{'$or':_[_0x86f5('0x30')](_0x2be83b[_0x86f5('0x35')],function(_0x530a74){var _0x1d7a0b={};_0x1d7a0b[_0x530a74]={'$like':'%'+_0x24b724[_0x86f5('0x31')][_0x86f5('0x3c')]+'%'};return _0x1d7a0b;})});}_0x2be83b=_[_0x86f5('0x46')]({},_0x2be83b,_0x24b724['options']);return _0x4e0194[_0x86f5('0x4b')](_0x2be83b);}})['then'](function(_0x11f459){if(_0x11f459){_0x24c66f=_0x11f459[_0x86f5('0x37')];if(!_0x24b724[_0x86f5('0x31')][_0x86f5('0x38')]('nolimit')){_0x2be83b[_0x86f5('0x1d')]=qs[_0x86f5('0x1d')](_0x24b724[_0x86f5('0x31')][_0x86f5('0x1d')]);_0x2be83b[_0x86f5('0x1c')]=qs['offset'](_0x24b724[_0x86f5('0x31')][_0x86f5('0x1c')]);}return _0x4e0194[_0x86f5('0x4b')](_0x2be83b);}})['then'](function(_0x3cf0b3){if(_0x3cf0b3){return _0x3cf0b3?{'count':_0x24c66f,'rows':_0x3cf0b3}:null;}})[_0x86f5('0x25')](respondWithResult(_0x417ca6,null))[_0x86f5('0x42')](handleError(_0x417ca6,null));};exports['getSubjects']=function(_0x777b54,_0xacbd99,_0x3bcb90){var _0x55a4eb={};var _0x39294e={};var _0x25e373;var _0x299d07;return db[_0x86f5('0x2b')][_0x86f5('0x4c')]({'where':{'id':_0x777b54[_0x86f5('0x44')]['id']}})[_0x86f5('0x25')](handleEntityNotFound(_0xacbd99,null))[_0x86f5('0x25')](function(_0xc7ff0b){if(_0xc7ff0b){_0x25e373=_0xc7ff0b;_0x39294e[_0x86f5('0x2f')]=_[_0x86f5('0x32')](db['VtigerField']['rawAttributes']);_0x39294e[_0x86f5('0x31')]=_['keys'](_0x777b54[_0x86f5('0x31')]);_0x39294e['filters']=_[_0x86f5('0x34')](_0x39294e[_0x86f5('0x2f')],_0x39294e['query']);_0x55a4eb['attributes']=_[_0x86f5('0x34')](_0x39294e[_0x86f5('0x2f')],qs[_0x86f5('0x36')](_0x777b54[_0x86f5('0x31')][_0x86f5('0x36')]));_0x55a4eb[_0x86f5('0x35')]=_0x55a4eb[_0x86f5('0x35')][_0x86f5('0x37')]?_0x55a4eb[_0x86f5('0x35')]:_0x39294e['model'];_0x55a4eb[_0x86f5('0x3a')]=qs[_0x86f5('0x3b')](_0x777b54[_0x86f5('0x31')][_0x86f5('0x3b')]);_0x55a4eb['where']=qs[_0x86f5('0x33')](_['pick'](_0x777b54[_0x86f5('0x31')],_0x39294e[_0x86f5('0x33')]));if(_0x777b54[_0x86f5('0x31')][_0x86f5('0x3c')]){_0x55a4eb[_0x86f5('0x3d')]=_[_0x86f5('0x46')](_0x55a4eb[_0x86f5('0x3d')],{'$or':_[_0x86f5('0x30')](_0x55a4eb[_0x86f5('0x35')],function(_0x11d97f){var _0x556c0f={};_0x556c0f[_0x11d97f]={'$like':'%'+_0x777b54[_0x86f5('0x31')][_0x86f5('0x3c')]+'%'};return _0x556c0f;})});}_0x55a4eb=_[_0x86f5('0x46')]({},_0x55a4eb,_0x777b54['options']);return _0x25e373[_0x86f5('0x4e')](_0x55a4eb);}})[_0x86f5('0x25')](function(_0x592853){if(_0x592853){_0x299d07=_0x592853[_0x86f5('0x37')];if(!_0x777b54[_0x86f5('0x31')][_0x86f5('0x38')]('nolimit')){_0x55a4eb[_0x86f5('0x1d')]=qs['limit'](_0x777b54[_0x86f5('0x31')]['limit']);_0x55a4eb[_0x86f5('0x1c')]=qs[_0x86f5('0x1c')](_0x777b54[_0x86f5('0x31')]['offset']);}return _0x25e373[_0x86f5('0x4e')](_0x55a4eb);}})[_0x86f5('0x25')](function(_0x2a8a7d){if(_0x2a8a7d){return _0x2a8a7d?{'count':_0x299d07,'rows':_0x2a8a7d}:null;}})[_0x86f5('0x25')](respondWithResult(_0xacbd99,null))[_0x86f5('0x42')](handleError(_0xacbd99,null));};exports[_0x86f5('0x4f')]=function(_0x472f07,_0x7f36c,_0x18330f){var _0x90f095={};var _0x34612a={};var _0x14affa;var _0x45d484;return db[_0x86f5('0x2b')][_0x86f5('0x4c')]({'where':{'id':_0x472f07[_0x86f5('0x44')]['id']}})[_0x86f5('0x25')](handleEntityNotFound(_0x7f36c,null))[_0x86f5('0x25')](function(_0x25c6bb){if(_0x25c6bb){_0x14affa=_0x25c6bb;_0x34612a['model']=_[_0x86f5('0x32')](db[_0x86f5('0x4d')][_0x86f5('0x2c')]);_0x34612a[_0x86f5('0x31')]=_['keys'](_0x472f07[_0x86f5('0x31')]);_0x34612a[_0x86f5('0x33')]=_[_0x86f5('0x34')](_0x34612a[_0x86f5('0x2f')],_0x34612a[_0x86f5('0x31')]);_0x90f095[_0x86f5('0x35')]=_[_0x86f5('0x34')](_0x34612a[_0x86f5('0x2f')],qs[_0x86f5('0x36')](_0x472f07['query'][_0x86f5('0x36')]));_0x90f095[_0x86f5('0x35')]=_0x90f095[_0x86f5('0x35')][_0x86f5('0x37')]?_0x90f095[_0x86f5('0x35')]:_0x34612a[_0x86f5('0x2f')];_0x90f095[_0x86f5('0x3a')]=qs[_0x86f5('0x3b')](_0x472f07[_0x86f5('0x31')]['sort']);_0x90f095[_0x86f5('0x3d')]=qs[_0x86f5('0x33')](_['pick'](_0x472f07['query'],_0x34612a[_0x86f5('0x33')]));if(_0x472f07[_0x86f5('0x31')][_0x86f5('0x3c')]){_0x90f095[_0x86f5('0x3d')]=_[_0x86f5('0x46')](_0x90f095[_0x86f5('0x3d')],{'$or':_['map'](_0x90f095[_0x86f5('0x35')],function(_0x417cb6){var _0x9ed9f2={};_0x9ed9f2[_0x417cb6]={'$like':'%'+_0x472f07[_0x86f5('0x31')][_0x86f5('0x3c')]+'%'};return _0x9ed9f2;})});}_0x90f095=_['merge']({},_0x90f095,_0x472f07['options']);return _0x14affa[_0x86f5('0x4f')](_0x90f095);}})[_0x86f5('0x25')](function(_0x1a2d9c){if(_0x1a2d9c){_0x45d484=_0x1a2d9c[_0x86f5('0x37')];if(!_0x472f07['query'][_0x86f5('0x38')](_0x86f5('0x39'))){_0x90f095[_0x86f5('0x1d')]=qs[_0x86f5('0x1d')](_0x472f07['query'][_0x86f5('0x1d')]);_0x90f095[_0x86f5('0x1c')]=qs['offset'](_0x472f07[_0x86f5('0x31')]['offset']);}return _0x14affa[_0x86f5('0x4f')](_0x90f095);}})[_0x86f5('0x25')](function(_0xba95ae){if(_0xba95ae){return _0xba95ae?{'count':_0x45d484,'rows':_0xba95ae}:null;}})[_0x86f5('0x25')](respondWithResult(_0x7f36c,null))[_0x86f5('0x42')](handleError(_0x7f36c,null));}; \ No newline at end of file +var _0x319c=['set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','VtigerConfiguration','includeAll','include','catch','show','params','find','create','body','getFields','VtigerField','nolimit','getSubjects','getDescriptions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count'];(function(_0x4e0918,_0x18df35){var _0x55f850=function(_0x2d764a){while(--_0x2d764a){_0x4e0918['push'](_0x4e0918['shift']());}};_0x55f850(++_0x18df35);}(_0x319c,0x1d9));var _0xc319=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x319c[_0x3ea913];return _0x2b4f28;};'use strict';var emlformat=require(_0xc319('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc319('0x1'));var jsonpatch=require(_0xc319('0x2'));var rp=require(_0xc319('0x3'));var moment=require('moment');var BPromise=require(_0xc319('0x4'));var Mustache=require(_0xc319('0x5'));var util=require(_0xc319('0x6'));var path=require(_0xc319('0x7'));var sox=require(_0xc319('0x8'));var csv=require(_0xc319('0x9'));var ejs=require(_0xc319('0xa'));var fs=require('fs');var fs_extra=require(_0xc319('0xb'));var _=require(_0xc319('0xc'));var squel=require(_0xc319('0xd'));var crypto=require(_0xc319('0xe'));var jsforce=require(_0xc319('0xf'));var deskjs=require(_0xc319('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc319('0x11'));var Papa=require(_0xc319('0x12'));var Redis=require(_0xc319('0x13'));var authService=require(_0xc319('0x14'));var qs=require(_0xc319('0x15'));var as=require(_0xc319('0x16'));var hardwareService=require(_0xc319('0x17'));var logger=require(_0xc319('0x18'))(_0xc319('0x19'));var utils=require(_0xc319('0x1a'));var config=require(_0xc319('0x1b'));var licenseUtil=require(_0xc319('0x1c'));var db=require(_0xc319('0x1d'))['db'];function respondWithStatusCode(_0x1c1b8a,_0xa2a16b){_0xa2a16b=_0xa2a16b||0xcc;return function(_0x277741){if(_0x277741){return _0x1c1b8a['sendStatus'](_0xa2a16b);}return _0x1c1b8a[_0xc319('0x1e')](_0xa2a16b)[_0xc319('0x1f')]();};}function respondWithResult(_0x3a2833,_0x1615b2){_0x1615b2=_0x1615b2||0xc8;return function(_0x3ea965){if(_0x3ea965){return _0x3a2833[_0xc319('0x1e')](_0x1615b2)[_0xc319('0x20')](_0x3ea965);}};}function respondWithFilteredResult(_0x5183c7,_0x4ff6cd){return function(_0x431c63){if(_0x431c63){var _0x5451dc=typeof _0x4ff6cd['offset']===_0xc319('0x21')&&typeof _0x4ff6cd[_0xc319('0x22')]===_0xc319('0x21');var _0x13242b=_0x431c63['count'];var _0x43cb3b=_0x5451dc?0x0:_0x4ff6cd[_0xc319('0x23')];var _0x3c0dda=_0x5451dc?_0x431c63[_0xc319('0x24')]:_0x4ff6cd[_0xc319('0x23')]+_0x4ff6cd[_0xc319('0x22')];var _0x4d8b11;if(_0x3c0dda>=_0x13242b){_0x3c0dda=_0x13242b;_0x4d8b11=0xc8;}else{_0x4d8b11=0xce;}_0x5183c7[_0xc319('0x1e')](_0x4d8b11);return _0x5183c7[_0xc319('0x25')](_0xc319('0x26'),_0x43cb3b+'-'+_0x3c0dda+'/'+_0x13242b)[_0xc319('0x20')](_0x431c63);}return null;};}function patchUpdates(_0x426618){return function(_0x378963){try{jsonpatch[_0xc319('0x27')](_0x378963,_0x426618,!![]);}catch(_0xbbc1b9){return BPromise[_0xc319('0x28')](_0xbbc1b9);}return _0x378963[_0xc319('0x29')]();};}function saveUpdates(_0x3cb3ac,_0x59315c){return function(_0x587adc){if(_0x587adc){return _0x587adc[_0xc319('0x2a')](_0x3cb3ac)[_0xc319('0x2b')](function(_0x38eb0e){return _0x38eb0e;});}return null;};}function removeEntity(_0x35d5d3,_0xc13131){return function(_0x1ae0b8){if(_0x1ae0b8){return _0x1ae0b8[_0xc319('0x2c')]()[_0xc319('0x2b')](function(){_0x35d5d3[_0xc319('0x1e')](0xcc)[_0xc319('0x1f')]();});}};}function handleEntityNotFound(_0x1c9d84,_0x570104){return function(_0x1aa2e9){if(!_0x1aa2e9){_0x1c9d84['sendStatus'](0x194);}return _0x1aa2e9;};}function handleError(_0x10eee8,_0x5f2fcc){_0x5f2fcc=_0x5f2fcc||0x1f4;return function(_0x303e80){logger['error'](_0x303e80[_0xc319('0x2d')]);if(_0x303e80['name']){delete _0x303e80[_0xc319('0x2e')];}_0x10eee8[_0xc319('0x1e')](_0x5f2fcc)['send'](_0x303e80);};}exports[_0xc319('0x2f')]=function(_0x387caf,_0x310485){var _0x2f5ea5={},_0x5b4f71={},_0x4337d5={'count':0x0,'rows':[]};var _0x3e5082=_[_0xc319('0x30')](db['VtigerConfiguration'][_0xc319('0x31')],function(_0x2b3f60){return{'name':_0x2b3f60[_0xc319('0x32')],'type':_0x2b3f60[_0xc319('0x33')][_0xc319('0x34')]};});_0x5b4f71[_0xc319('0x35')]=_[_0xc319('0x30')](_0x3e5082,_0xc319('0x2e'));_0x5b4f71[_0xc319('0x36')]=_[_0xc319('0x37')](_0x387caf[_0xc319('0x36')]);_0x5b4f71['filters']=_[_0xc319('0x38')](_0x5b4f71[_0xc319('0x35')],_0x5b4f71[_0xc319('0x36')]);_0x2f5ea5[_0xc319('0x39')]=_[_0xc319('0x38')](_0x5b4f71['model'],qs[_0xc319('0x3a')](_0x387caf[_0xc319('0x36')][_0xc319('0x3a')]));_0x2f5ea5['attributes']=_0x2f5ea5[_0xc319('0x39')][_0xc319('0x3b')]?_0x2f5ea5['attributes']:_0x5b4f71[_0xc319('0x35')];if(!_0x387caf[_0xc319('0x36')][_0xc319('0x3c')]('nolimit')){_0x2f5ea5[_0xc319('0x22')]=qs[_0xc319('0x22')](_0x387caf[_0xc319('0x36')]['limit']);_0x2f5ea5[_0xc319('0x23')]=qs[_0xc319('0x23')](_0x387caf[_0xc319('0x36')][_0xc319('0x23')]);}_0x2f5ea5[_0xc319('0x3d')]=qs[_0xc319('0x3e')](_0x387caf['query'][_0xc319('0x3e')]);_0x2f5ea5['where']=qs[_0xc319('0x3f')](_[_0xc319('0x40')](_0x387caf['query'],_0x5b4f71[_0xc319('0x3f')]),_0x3e5082);if(_0x387caf[_0xc319('0x36')]['filter']){_0x2f5ea5[_0xc319('0x41')]=_['merge'](_0x2f5ea5[_0xc319('0x41')],{'$or':_[_0xc319('0x30')](_0x3e5082,function(_0x50105f){if(_0x50105f[_0xc319('0x33')]!==_0xc319('0x42')){var _0x32e1a6={};_0x32e1a6[_0x50105f['name']]={'$like':'%'+_0x387caf[_0xc319('0x36')][_0xc319('0x43')]+'%'};return _0x32e1a6;}})});}_0x2f5ea5=_[_0xc319('0x44')]({},_0x2f5ea5,_0x387caf[_0xc319('0x45')]);var _0x3f58f0={'where':_0x2f5ea5['where']};return db[_0xc319('0x46')][_0xc319('0x24')](_0x3f58f0)['then'](function(_0x450934){_0x4337d5['count']=_0x450934;if(_0x387caf[_0xc319('0x36')][_0xc319('0x47')]){_0x2f5ea5[_0xc319('0x48')]=[{'all':!![]}];}return db[_0xc319('0x46')]['findAll'](_0x2f5ea5);})[_0xc319('0x2b')](function(_0x53dbb3){_0x4337d5['rows']=_0x53dbb3;return _0x4337d5;})['then'](respondWithFilteredResult(_0x310485,_0x2f5ea5))[_0xc319('0x49')](handleError(_0x310485,null));};exports[_0xc319('0x4a')]=function(_0x55b25d,_0x1a26eb){var _0x34c537={'raw':![],'where':{'id':_0x55b25d[_0xc319('0x4b')]['id']}},_0x2373c7={};_0x2373c7[_0xc319('0x35')]=_[_0xc319('0x37')](db[_0xc319('0x46')][_0xc319('0x31')]);_0x2373c7[_0xc319('0x36')]=_[_0xc319('0x37')](_0x55b25d['query']);_0x2373c7[_0xc319('0x3f')]=_[_0xc319('0x38')](_0x2373c7[_0xc319('0x35')],_0x2373c7[_0xc319('0x36')]);_0x34c537[_0xc319('0x39')]=_[_0xc319('0x38')](_0x2373c7[_0xc319('0x35')],qs['fields'](_0x55b25d[_0xc319('0x36')][_0xc319('0x3a')]));_0x34c537['attributes']=_0x34c537['attributes'][_0xc319('0x3b')]?_0x34c537[_0xc319('0x39')]:_0x2373c7[_0xc319('0x35')];if(_0x55b25d['query'][_0xc319('0x47')]){_0x34c537['include']=[{'all':!![]}];}_0x34c537=_['merge']({},_0x34c537,_0x55b25d[_0xc319('0x45')]);return db[_0xc319('0x46')][_0xc319('0x4c')](_0x34c537)['then'](handleEntityNotFound(_0x1a26eb,null))[_0xc319('0x2b')](respondWithResult(_0x1a26eb,null))[_0xc319('0x49')](handleError(_0x1a26eb,null));};exports['create']=function(_0x27ab06,_0x23467f){return db['VtigerConfiguration'][_0xc319('0x4d')](_0x27ab06[_0xc319('0x4e')],{})[_0xc319('0x2b')](respondWithResult(_0x23467f,0xc9))[_0xc319('0x49')](handleError(_0x23467f,null));};exports[_0xc319('0x2a')]=function(_0x3a3b70,_0x606308){if(_0x3a3b70[_0xc319('0x4e')]['id']){delete _0x3a3b70[_0xc319('0x4e')]['id'];}return db[_0xc319('0x46')][_0xc319('0x4c')]({'where':{'id':_0x3a3b70[_0xc319('0x4b')]['id']}})[_0xc319('0x2b')](handleEntityNotFound(_0x606308,null))[_0xc319('0x2b')](saveUpdates(_0x3a3b70[_0xc319('0x4e')],null))['then'](respondWithResult(_0x606308,null))[_0xc319('0x49')](handleError(_0x606308,null));};exports['destroy']=function(_0x17dea8,_0x23fc3b){return db[_0xc319('0x46')]['find']({'where':{'id':_0x17dea8['params']['id']}})[_0xc319('0x2b')](handleEntityNotFound(_0x23fc3b,null))[_0xc319('0x2b')](removeEntity(_0x23fc3b,null))['catch'](handleError(_0x23fc3b,null));};exports[_0xc319('0x4f')]=function(_0x2f0004,_0x34ea90,_0xaebe1e){var _0x5f2fe7={};var _0x119df7={};var _0x1e26f0;var _0x35711b;return db[_0xc319('0x46')]['findOne']({'where':{'id':_0x2f0004[_0xc319('0x4b')]['id']}})[_0xc319('0x2b')](handleEntityNotFound(_0x34ea90,null))['then'](function(_0x3ed985){if(_0x3ed985){_0x1e26f0=_0x3ed985;_0x119df7[_0xc319('0x35')]=_[_0xc319('0x37')](db[_0xc319('0x50')][_0xc319('0x31')]);_0x119df7[_0xc319('0x36')]=_[_0xc319('0x37')](_0x2f0004[_0xc319('0x36')]);_0x119df7['filters']=_[_0xc319('0x38')](_0x119df7['model'],_0x119df7['query']);_0x5f2fe7[_0xc319('0x39')]=_[_0xc319('0x38')](_0x119df7['model'],qs[_0xc319('0x3a')](_0x2f0004['query'][_0xc319('0x3a')]));_0x5f2fe7[_0xc319('0x39')]=_0x5f2fe7[_0xc319('0x39')][_0xc319('0x3b')]?_0x5f2fe7[_0xc319('0x39')]:_0x119df7[_0xc319('0x35')];_0x5f2fe7['order']=qs[_0xc319('0x3e')](_0x2f0004[_0xc319('0x36')][_0xc319('0x3e')]);_0x5f2fe7[_0xc319('0x41')]=qs[_0xc319('0x3f')](_[_0xc319('0x40')](_0x2f0004[_0xc319('0x36')],_0x119df7[_0xc319('0x3f')]));if(_0x2f0004[_0xc319('0x36')][_0xc319('0x43')]){_0x5f2fe7['where']=_[_0xc319('0x44')](_0x5f2fe7[_0xc319('0x41')],{'$or':_[_0xc319('0x30')](_0x5f2fe7[_0xc319('0x39')],function(_0x11bcb4){var _0x4172b0={};_0x4172b0[_0x11bcb4]={'$like':'%'+_0x2f0004[_0xc319('0x36')][_0xc319('0x43')]+'%'};return _0x4172b0;})});}_0x5f2fe7=_[_0xc319('0x44')]({},_0x5f2fe7,_0x2f0004[_0xc319('0x45')]);return _0x1e26f0[_0xc319('0x4f')](_0x5f2fe7);}})[_0xc319('0x2b')](function(_0xbebefa){if(_0xbebefa){_0x35711b=_0xbebefa[_0xc319('0x3b')];if(!_0x2f0004['query']['hasOwnProperty'](_0xc319('0x51'))){_0x5f2fe7[_0xc319('0x22')]=qs[_0xc319('0x22')](_0x2f0004[_0xc319('0x36')][_0xc319('0x22')]);_0x5f2fe7[_0xc319('0x23')]=qs[_0xc319('0x23')](_0x2f0004[_0xc319('0x36')][_0xc319('0x23')]);}return _0x1e26f0[_0xc319('0x4f')](_0x5f2fe7);}})[_0xc319('0x2b')](function(_0x505e48){if(_0x505e48){return _0x505e48?{'count':_0x35711b,'rows':_0x505e48}:null;}})['then'](respondWithResult(_0x34ea90,null))[_0xc319('0x49')](handleError(_0x34ea90,null));};exports['getSubjects']=function(_0x4a5777,_0x3d2ceb,_0x50f4af){var _0x50c298={};var _0x4786b1={};var _0x51162f;var _0x108230;return db[_0xc319('0x46')]['findOne']({'where':{'id':_0x4a5777['params']['id']}})[_0xc319('0x2b')](handleEntityNotFound(_0x3d2ceb,null))[_0xc319('0x2b')](function(_0x2f5225){if(_0x2f5225){_0x51162f=_0x2f5225;_0x4786b1[_0xc319('0x35')]=_[_0xc319('0x37')](db['VtigerField'][_0xc319('0x31')]);_0x4786b1[_0xc319('0x36')]=_[_0xc319('0x37')](_0x4a5777[_0xc319('0x36')]);_0x4786b1[_0xc319('0x3f')]=_[_0xc319('0x38')](_0x4786b1['model'],_0x4786b1[_0xc319('0x36')]);_0x50c298[_0xc319('0x39')]=_[_0xc319('0x38')](_0x4786b1[_0xc319('0x35')],qs['fields'](_0x4a5777[_0xc319('0x36')][_0xc319('0x3a')]));_0x50c298['attributes']=_0x50c298[_0xc319('0x39')][_0xc319('0x3b')]?_0x50c298[_0xc319('0x39')]:_0x4786b1[_0xc319('0x35')];_0x50c298['order']=qs[_0xc319('0x3e')](_0x4a5777['query'][_0xc319('0x3e')]);_0x50c298[_0xc319('0x41')]=qs[_0xc319('0x3f')](_[_0xc319('0x40')](_0x4a5777['query'],_0x4786b1[_0xc319('0x3f')]));if(_0x4a5777[_0xc319('0x36')][_0xc319('0x43')]){_0x50c298[_0xc319('0x41')]=_[_0xc319('0x44')](_0x50c298[_0xc319('0x41')],{'$or':_[_0xc319('0x30')](_0x50c298[_0xc319('0x39')],function(_0x57003a){var _0x320df2={};_0x320df2[_0x57003a]={'$like':'%'+_0x4a5777[_0xc319('0x36')]['filter']+'%'};return _0x320df2;})});}_0x50c298=_[_0xc319('0x44')]({},_0x50c298,_0x4a5777[_0xc319('0x45')]);return _0x51162f[_0xc319('0x52')](_0x50c298);}})[_0xc319('0x2b')](function(_0x19a652){if(_0x19a652){_0x108230=_0x19a652[_0xc319('0x3b')];if(!_0x4a5777[_0xc319('0x36')]['hasOwnProperty'](_0xc319('0x51'))){_0x50c298[_0xc319('0x22')]=qs[_0xc319('0x22')](_0x4a5777[_0xc319('0x36')]['limit']);_0x50c298[_0xc319('0x23')]=qs[_0xc319('0x23')](_0x4a5777[_0xc319('0x36')][_0xc319('0x23')]);}return _0x51162f['getSubjects'](_0x50c298);}})[_0xc319('0x2b')](function(_0x28b5d8){if(_0x28b5d8){return _0x28b5d8?{'count':_0x108230,'rows':_0x28b5d8}:null;}})[_0xc319('0x2b')](respondWithResult(_0x3d2ceb,null))[_0xc319('0x49')](handleError(_0x3d2ceb,null));};exports[_0xc319('0x53')]=function(_0x278278,_0x40b586,_0x1bc251){var _0x371e8f={};var _0x342fa5={};var _0x5be577;var _0x465cda;return db[_0xc319('0x46')][_0xc319('0x54')]({'where':{'id':_0x278278['params']['id']}})['then'](handleEntityNotFound(_0x40b586,null))[_0xc319('0x2b')](function(_0x43b7ea){if(_0x43b7ea){_0x5be577=_0x43b7ea;_0x342fa5['model']=_['keys'](db['VtigerField'][_0xc319('0x31')]);_0x342fa5['query']=_[_0xc319('0x37')](_0x278278[_0xc319('0x36')]);_0x342fa5['filters']=_[_0xc319('0x38')](_0x342fa5[_0xc319('0x35')],_0x342fa5[_0xc319('0x36')]);_0x371e8f[_0xc319('0x39')]=_[_0xc319('0x38')](_0x342fa5[_0xc319('0x35')],qs[_0xc319('0x3a')](_0x278278[_0xc319('0x36')][_0xc319('0x3a')]));_0x371e8f[_0xc319('0x39')]=_0x371e8f[_0xc319('0x39')][_0xc319('0x3b')]?_0x371e8f[_0xc319('0x39')]:_0x342fa5[_0xc319('0x35')];_0x371e8f[_0xc319('0x3d')]=qs['sort'](_0x278278[_0xc319('0x36')][_0xc319('0x3e')]);_0x371e8f[_0xc319('0x41')]=qs[_0xc319('0x3f')](_[_0xc319('0x40')](_0x278278[_0xc319('0x36')],_0x342fa5['filters']));if(_0x278278[_0xc319('0x36')][_0xc319('0x43')]){_0x371e8f[_0xc319('0x41')]=_['merge'](_0x371e8f[_0xc319('0x41')],{'$or':_['map'](_0x371e8f['attributes'],function(_0x5d559f){var _0x53144b={};_0x53144b[_0x5d559f]={'$like':'%'+_0x278278[_0xc319('0x36')]['filter']+'%'};return _0x53144b;})});}_0x371e8f=_[_0xc319('0x44')]({},_0x371e8f,_0x278278[_0xc319('0x45')]);return _0x5be577[_0xc319('0x53')](_0x371e8f);}})[_0xc319('0x2b')](function(_0x3ec55d){if(_0x3ec55d){_0x465cda=_0x3ec55d[_0xc319('0x3b')];if(!_0x278278[_0xc319('0x36')][_0xc319('0x3c')]('nolimit')){_0x371e8f[_0xc319('0x22')]=qs[_0xc319('0x22')](_0x278278[_0xc319('0x36')]['limit']);_0x371e8f[_0xc319('0x23')]=qs['offset'](_0x278278[_0xc319('0x36')]['offset']);}return _0x5be577[_0xc319('0x53')](_0x371e8f);}})[_0xc319('0x2b')](function(_0x1a60ce){if(_0x1a60ce){return _0x1a60ce?{'count':_0x465cda,'rows':_0x1a60ce}:null;}})[_0xc319('0x2b')](respondWithResult(_0x40b586,null))['catch'](handleError(_0x40b586,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 6e36b50..5bece2e 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 _0xec7a=['request-promise','path','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x490e5c,_0x3a3458){var _0x15fa05=function(_0x29b2c0){while(--_0x29b2c0){_0x490e5c['push'](_0x490e5c['shift']());}};_0x15fa05(++_0x3a3458);}(_0xec7a,0x1d3));var _0xaec7=function(_0x1eb82d,_0x1e23cb){_0x1eb82d=_0x1eb82d-0x0;var _0x2c9502=_0xec7a[_0x1eb82d];return _0x2c9502;};'use strict';var _=require(_0xaec7('0x0'));var util=require(_0xaec7('0x1'));var logger=require(_0xaec7('0x2'))(_0xaec7('0x3'));var moment=require(_0xaec7('0x4'));var BPromise=require(_0xaec7('0x5'));var rp=require(_0xaec7('0x6'));var fs=require('fs');var path=require(_0xaec7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaec7('0x8'));module[_0xaec7('0x9')]=function(_0x264d7e,_0x4e7eb2){return _0x264d7e['define'](_0xaec7('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7197=['path','./intVtigerConfiguration.attributes','VtigerConfiguration','../../config/logger','api','moment','bluebird'];(function(_0x2dcf7b,_0x2226df){var _0x38ff10=function(_0x3b3b02){while(--_0x3b3b02){_0x2dcf7b['push'](_0x2dcf7b['shift']());}};_0x38ff10(++_0x2226df);}(_0x7197,0xab));var _0x7719=function(_0xe88de0,_0x2e988a){_0xe88de0=_0xe88de0-0x0;var _0x1974b7=_0x7197[_0xe88de0];return _0x1974b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7719('0x0'))(_0x7719('0x1'));var moment=require(_0x7719('0x2'));var BPromise=require(_0x7719('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7719('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7719('0x5'));module['exports']=function(_0x49fab1,_0x58648f){return _0x49fab1['define'](_0x7719('0x6'),attributes,{'tableName':'int_vtiger_configurations','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 853300c..7163883 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 _0x848a=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x848a,0x180));var _0xa848=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x848a[_0x484c03];return _0x294127;};'use strict';var _=require(_0xa848('0x0'));var util=require('util');var moment=require(_0xa848('0x1'));var BPromise=require('bluebird');var rs=require(_0xa848('0x2'));var fs=require('fs');var Redis=require(_0xa848('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa848('0x4'));var logger=require(_0xa848('0x5'))(_0xa848('0x6'));var config=require(_0xa848('0x7'));var jayson=require(_0xa848('0x8'));var client=jayson[_0xa848('0x9')][_0xa848('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x379fea,_0x3b7621,_0x36c5ed){return new BPromise(function(_0x394f94,_0x5756ce){return client[_0xa848('0xb')](_0x379fea,_0x36c5ed)[_0xa848('0xc')](function(_0x2878e9){logger['info'](_0xa848('0xd'),_0x3b7621,_0xa848('0xe'));logger[_0xa848('0xf')](_0xa848('0x10'),_0x3b7621,_0xa848('0xe'),JSON['stringify'](_0x2878e9));if(_0x2878e9[_0xa848('0x11')]){if(_0x2878e9[_0xa848('0x11')][_0xa848('0x12')]===0x1f4){logger[_0xa848('0x11')](_0xa848('0xd'),_0x3b7621,_0x2878e9['error'][_0xa848('0x13')]);return _0x5756ce(_0x2878e9[_0xa848('0x11')][_0xa848('0x13')]);}logger['error'](_0xa848('0xd'),_0x3b7621,_0x2878e9[_0xa848('0x11')][_0xa848('0x13')]);return _0x394f94(_0x2878e9[_0xa848('0x11')]['message']);}else{logger['info'](_0xa848('0xd'),_0x3b7621,_0xa848('0xe'));_0x394f94(_0x2878e9[_0xa848('0x14')][_0xa848('0x13')]);}})['catch'](function(_0x13212a){logger[_0xa848('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x3b7621,_0x13212a);_0x5756ce(_0x13212a);});});} \ No newline at end of file +var _0x3ed7=['rpc','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x41aa44,_0x978bc3){var _0x576f08=function(_0x550249){while(--_0x550249){_0x41aa44['push'](_0x41aa44['shift']());}};_0x576f08(++_0x978bc3);}(_0x3ed7,0xb0));var _0x73ed=function(_0x51d4cd,_0x257ef9){_0x51d4cd=_0x51d4cd-0x0;var _0x3371db=_0x3ed7[_0x51d4cd];return _0x3371db;};'use strict';var _=require(_0x73ed('0x0'));var util=require(_0x73ed('0x1'));var moment=require(_0x73ed('0x2'));var BPromise=require(_0x73ed('0x3'));var rs=require(_0x73ed('0x4'));var fs=require('fs');var Redis=require(_0x73ed('0x5'));var db=require(_0x73ed('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x73ed('0x7'))(_0x73ed('0x8'));var config=require(_0x73ed('0x9'));var jayson=require(_0x73ed('0xa'));var client=jayson[_0x73ed('0xb')][_0x73ed('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30b177,_0x3e033a,_0x235285){return new BPromise(function(_0x14dccc,_0x2e07b1){return client['request'](_0x30b177,_0x235285)['then'](function(_0x55608f){logger[_0x73ed('0xd')](_0x73ed('0xe'),_0x3e033a,'request\x20sent');logger[_0x73ed('0xf')](_0x73ed('0x10'),_0x3e033a,'request\x20sent',JSON[_0x73ed('0x11')](_0x55608f));if(_0x55608f[_0x73ed('0x12')]){if(_0x55608f[_0x73ed('0x12')][_0x73ed('0x13')]===0x1f4){logger[_0x73ed('0x12')](_0x73ed('0xe'),_0x3e033a,_0x55608f[_0x73ed('0x12')][_0x73ed('0x14')]);return _0x2e07b1(_0x55608f[_0x73ed('0x12')][_0x73ed('0x14')]);}logger[_0x73ed('0x12')](_0x73ed('0xe'),_0x3e033a,_0x55608f[_0x73ed('0x12')]['message']);return _0x14dccc(_0x55608f[_0x73ed('0x12')][_0x73ed('0x14')]);}else{logger[_0x73ed('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e033a,_0x73ed('0x15'));_0x14dccc(_0x55608f['result'][_0x73ed('0x14')]);}})[_0x73ed('0x16')](function(_0x356860){logger['error'](_0x73ed('0xe'),_0x3e033a,_0x356860);_0x2e07b1(_0x356860);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 9f38017..e5d33f6 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 _0x5e99=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','delete'];(function(_0x5f4d27,_0x5aed51){var _0x358041=function(_0x936cad){while(--_0x936cad){_0x5f4d27['push'](_0x5f4d27['shift']());}};_0x358041(++_0x5aed51);}(_0x5e99,0x1ef));var _0x95e9=function(_0x5c6927,_0x28ffe0){_0x5c6927=_0x5c6927-0x0;var _0x5ef7f1=_0x5e99[_0x5c6927];return _0x5ef7f1;};'use strict';var multer=require(_0x95e9('0x0'));var util=require(_0x95e9('0x1'));var path=require('path');var timeout=require(_0x95e9('0x2'));var express=require(_0x95e9('0x3'));var router=express[_0x95e9('0x4')]();var fs_extra=require(_0x95e9('0x5'));var auth=require(_0x95e9('0x6'));var interaction=require(_0x95e9('0x7'));var config=require(_0x95e9('0x8'));var controller=require('./intVtigerField.controller');router[_0x95e9('0x9')]('/',auth[_0x95e9('0xa')](),controller[_0x95e9('0xb')]);router[_0x95e9('0x9')](_0x95e9('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x95e9('0xa')](),controller[_0x95e9('0xd')]);router['put']('/:id',auth[_0x95e9('0xa')](),controller['update']);router[_0x95e9('0xe')](_0x95e9('0xc'),auth[_0x95e9('0xa')](),controller[_0x95e9('0xf')]);module[_0x95e9('0x10')]=router; \ No newline at end of file +var _0xbe9d=['post','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x530455,_0x41da2d){var _0x128a27=function(_0x3152af){while(--_0x3152af){_0x530455['push'](_0x530455['shift']());}};_0x128a27(++_0x41da2d);}(_0xbe9d,0x166));var _0xdbe9=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xbe9d[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require(_0xdbe9('0x0'));var path=require(_0xdbe9('0x1'));var timeout=require('connect-timeout');var express=require(_0xdbe9('0x2'));var router=express[_0xdbe9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdbe9('0x4'));var interaction=require(_0xdbe9('0x5'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router['get']('/',auth[_0xdbe9('0x6')](),controller[_0xdbe9('0x7')]);router[_0xdbe9('0x8')](_0xdbe9('0x9'),auth[_0xdbe9('0x6')](),controller['show']);router[_0xdbe9('0xa')]('/',auth[_0xdbe9('0x6')](),controller['create']);router[_0xdbe9('0xb')]('/:id',auth[_0xdbe9('0x6')](),controller[_0xdbe9('0xc')]);router[_0xdbe9('0xd')](_0xdbe9('0x9'),auth[_0xdbe9('0x6')](),controller[_0xdbe9('0xe')]);module[_0xdbe9('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 9143d07..fe7c6e8 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 _0x2523=['BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string','STRING'];(function(_0x3839ec,_0x368f64){var _0x554872=function(_0x380df9){while(--_0x380df9){_0x3839ec['push'](_0x3839ec['shift']());}};_0x554872(++_0x368f64);}(_0x2523,0x1cc));var _0x3252=function(_0x460264,_0x51ddff){_0x460264=_0x460264-0x0;var _0x2d75a1=_0x2523[_0x460264];return _0x2d75a1;};'use strict';var Sequelize=require(_0x3252('0x0'));module[_0x3252('0x1')]={'type':{'type':Sequelize[_0x3252('0x2')]('string',_0x3252('0x3'),'customVariable',_0x3252('0x4'),_0x3252('0x5')),'defaultValue':_0x3252('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3252('0x7')]},'keyType':{'type':Sequelize[_0x3252('0x2')](_0x3252('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x3252('0x7')]},'idField':{'type':Sequelize[_0x3252('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3252('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3252('0x7')]}}; \ No newline at end of file +var _0x3657=['ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3657,0x1b7));var _0x7365=function(_0x312ff8,_0x5d7167){_0x312ff8=_0x312ff8-0x0;var _0x4e144b=_0x3657[_0x312ff8];return _0x4e144b;};'use strict';var Sequelize=require(_0x7365('0x0'));module['exports']={'type':{'type':Sequelize[_0x7365('0x1')](_0x7365('0x2'),'variable',_0x7365('0x3'),'keyValue',_0x7365('0x4')),'defaultValue':_0x7365('0x2')},'content':{'type':Sequelize[_0x7365('0x5')]},'key':{'type':Sequelize[_0x7365('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x7365('0x2'),_0x7365('0x6'),_0x7365('0x3'))},'keyContent':{'type':Sequelize[_0x7365('0x5')]},'idField':{'type':Sequelize[_0x7365('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7365('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7365('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index c88abaa..38ced7b 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 _0xeedb=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','then','stack','name','index','map','VtigerField','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','length','nolimit','order','sort','pick','filters','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','update','body'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xeedb,0xd2));var _0xbeed=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xeedb[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0xbeed('0x0'));var rimraf=require(_0xbeed('0x1'));var zipdir=require(_0xbeed('0x2'));var jsonpatch=require(_0xbeed('0x3'));var rp=require('request-promise');var moment=require(_0xbeed('0x4'));var BPromise=require(_0xbeed('0x5'));var Mustache=require('mustache');var util=require(_0xbeed('0x6'));var path=require(_0xbeed('0x7'));var sox=require('sox');var csv=require(_0xbeed('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbeed('0x9'));var crypto=require(_0xbeed('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbeed('0xb'));var toCsv=require(_0xbeed('0x8'));var querystring=require('querystring');var Papa=require(_0xbeed('0xc'));var Redis=require(_0xbeed('0xd'));var authService=require(_0xbeed('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbeed('0xf'));var hardwareService=require(_0xbeed('0x10'));var logger=require(_0xbeed('0x11'))(_0xbeed('0x12'));var utils=require(_0xbeed('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbeed('0x14'))['db'];function respondWithStatusCode(_0xf834c,_0x552a3a){_0x552a3a=_0x552a3a||0xcc;return function(_0xf5b5c5){if(_0xf5b5c5){return _0xf834c[_0xbeed('0x15')](_0x552a3a);}return _0xf834c[_0xbeed('0x16')](_0x552a3a)[_0xbeed('0x17')]();};}function respondWithResult(_0x5c1ce1,_0x39fe06){_0x39fe06=_0x39fe06||0xc8;return function(_0x266cb0){if(_0x266cb0){return _0x5c1ce1[_0xbeed('0x16')](_0x39fe06)[_0xbeed('0x18')](_0x266cb0);}};}function respondWithFilteredResult(_0x44126f,_0xe73d98){return function(_0x5f5345){if(_0x5f5345){var _0x257edf=typeof _0xe73d98[_0xbeed('0x19')]==='undefined'&&typeof _0xe73d98[_0xbeed('0x1a')]===_0xbeed('0x1b');var _0x4289b6=_0x5f5345[_0xbeed('0x1c')];var _0x38de7a=_0x257edf?0x0:_0xe73d98[_0xbeed('0x19')];var _0x137d2f=_0x257edf?_0x5f5345[_0xbeed('0x1c')]:_0xe73d98[_0xbeed('0x19')]+_0xe73d98['limit'];var _0x3fcd7c;if(_0x137d2f>=_0x4289b6){_0x137d2f=_0x4289b6;_0x3fcd7c=0xc8;}else{_0x3fcd7c=0xce;}_0x44126f['status'](_0x3fcd7c);return _0x44126f[_0xbeed('0x1d')](_0xbeed('0x1e'),_0x38de7a+'-'+_0x137d2f+'/'+_0x4289b6)[_0xbeed('0x18')](_0x5f5345);}return null;};}function patchUpdates(_0xe799b9){return function(_0x5b9aad){try{jsonpatch[_0xbeed('0x1f')](_0x5b9aad,_0xe799b9,!![]);}catch(_0xe84a8d){return BPromise[_0xbeed('0x20')](_0xe84a8d);}return _0x5b9aad['save']();};}function saveUpdates(_0x195b1c,_0x5f1188){return function(_0x25011e){if(_0x25011e){return _0x25011e['update'](_0x195b1c)['then'](function(_0x2d4332){return _0x2d4332;});}return null;};}function removeEntity(_0x508b28,_0x3c413a){return function(_0x10c1d0){if(_0x10c1d0){return _0x10c1d0[_0xbeed('0x21')]()[_0xbeed('0x22')](function(){_0x508b28[_0xbeed('0x16')](0xcc)[_0xbeed('0x17')]();});}};}function handleEntityNotFound(_0x371e62,_0xa41424){return function(_0x4ab6c0){if(!_0x4ab6c0){_0x371e62[_0xbeed('0x15')](0x194);}return _0x4ab6c0;};}function handleError(_0x4c6242,_0x544039){_0x544039=_0x544039||0x1f4;return function(_0x4ae1f3){logger['error'](_0x4ae1f3[_0xbeed('0x23')]);if(_0x4ae1f3[_0xbeed('0x24')]){delete _0x4ae1f3['name'];}_0x4c6242[_0xbeed('0x16')](_0x544039)['send'](_0x4ae1f3);};}exports[_0xbeed('0x25')]=function(_0x575c63,_0x3e275a){var _0x53a7dd={},_0x798b94={},_0xa422d6={'count':0x0,'rows':[]};var _0xedaf1d=_[_0xbeed('0x26')](db[_0xbeed('0x27')][_0xbeed('0x28')],function(_0x3fff21){return{'name':_0x3fff21[_0xbeed('0x29')],'type':_0x3fff21['type'][_0xbeed('0x2a')]};});_0x798b94['model']=_[_0xbeed('0x26')](_0xedaf1d,'name');_0x798b94[_0xbeed('0x2b')]=_[_0xbeed('0x2c')](_0x575c63[_0xbeed('0x2b')]);_0x798b94['filters']=_[_0xbeed('0x2d')](_0x798b94['model'],_0x798b94['query']);_0x53a7dd[_0xbeed('0x2e')]=_['intersection'](_0x798b94[_0xbeed('0x2f')],qs['fields'](_0x575c63[_0xbeed('0x2b')]['fields']));_0x53a7dd['attributes']=_0x53a7dd['attributes'][_0xbeed('0x30')]?_0x53a7dd['attributes']:_0x798b94[_0xbeed('0x2f')];if(!_0x575c63['query']['hasOwnProperty'](_0xbeed('0x31'))){_0x53a7dd[_0xbeed('0x1a')]=qs[_0xbeed('0x1a')](_0x575c63[_0xbeed('0x2b')][_0xbeed('0x1a')]);_0x53a7dd[_0xbeed('0x19')]=qs[_0xbeed('0x19')](_0x575c63[_0xbeed('0x2b')][_0xbeed('0x19')]);}_0x53a7dd[_0xbeed('0x32')]=qs[_0xbeed('0x33')](_0x575c63[_0xbeed('0x2b')][_0xbeed('0x33')]);_0x53a7dd['where']=qs['filters'](_[_0xbeed('0x34')](_0x575c63[_0xbeed('0x2b')],_0x798b94[_0xbeed('0x35')]),_0xedaf1d);if(_0x575c63[_0xbeed('0x2b')]['filter']){_0x53a7dd[_0xbeed('0x36')]=_[_0xbeed('0x37')](_0x53a7dd[_0xbeed('0x36')],{'$or':_[_0xbeed('0x26')](_0xedaf1d,function(_0x3e4c71){if(_0x3e4c71[_0xbeed('0x38')]!==_0xbeed('0x39')){var _0x527556={};_0x527556[_0x3e4c71[_0xbeed('0x24')]]={'$like':'%'+_0x575c63[_0xbeed('0x2b')]['filter']+'%'};return _0x527556;}})});}_0x53a7dd=_[_0xbeed('0x37')]({},_0x53a7dd,_0x575c63[_0xbeed('0x3a')]);var _0xc96a93={'where':_0x53a7dd['where']};return db[_0xbeed('0x27')][_0xbeed('0x1c')](_0xc96a93)[_0xbeed('0x22')](function(_0x26eb5b){_0xa422d6[_0xbeed('0x1c')]=_0x26eb5b;if(_0x575c63['query'][_0xbeed('0x3b')]){_0x53a7dd[_0xbeed('0x3c')]=[{'all':!![]}];}return db[_0xbeed('0x27')][_0xbeed('0x3d')](_0x53a7dd);})[_0xbeed('0x22')](function(_0xa07c7b){_0xa422d6[_0xbeed('0x3e')]=_0xa07c7b;return _0xa422d6;})['then'](respondWithFilteredResult(_0x3e275a,_0x53a7dd))[_0xbeed('0x3f')](handleError(_0x3e275a,null));};exports['show']=function(_0x171a44,_0x2712dd){var _0x13b60c={'raw':!![],'where':{'id':_0x171a44[_0xbeed('0x40')]['id']}},_0x4515dd={};_0x4515dd[_0xbeed('0x2f')]=_[_0xbeed('0x2c')](db[_0xbeed('0x27')][_0xbeed('0x28')]);_0x4515dd[_0xbeed('0x2b')]=_[_0xbeed('0x2c')](_0x171a44[_0xbeed('0x2b')]);_0x4515dd[_0xbeed('0x35')]=_['intersection'](_0x4515dd['model'],_0x4515dd[_0xbeed('0x2b')]);_0x13b60c[_0xbeed('0x2e')]=_[_0xbeed('0x2d')](_0x4515dd['model'],qs[_0xbeed('0x41')](_0x171a44[_0xbeed('0x2b')][_0xbeed('0x41')]));_0x13b60c[_0xbeed('0x2e')]=_0x13b60c[_0xbeed('0x2e')][_0xbeed('0x30')]?_0x13b60c['attributes']:_0x4515dd[_0xbeed('0x2f')];if(_0x171a44[_0xbeed('0x2b')][_0xbeed('0x3b')]){_0x13b60c[_0xbeed('0x3c')]=[{'all':!![]}];}_0x13b60c=_['merge']({},_0x13b60c,_0x171a44['options']);return db['VtigerField'][_0xbeed('0x42')](_0x13b60c)[_0xbeed('0x22')](handleEntityNotFound(_0x2712dd,null))[_0xbeed('0x22')](respondWithResult(_0x2712dd,null))[_0xbeed('0x3f')](handleError(_0x2712dd,null));};exports[_0xbeed('0x43')]=function(_0xfbf819,_0x431d2d){return db[_0xbeed('0x27')][_0xbeed('0x43')](_0xfbf819['body'],{})[_0xbeed('0x22')](respondWithResult(_0x431d2d,0xc9))['catch'](handleError(_0x431d2d,null));};exports[_0xbeed('0x44')]=function(_0x4bc8af,_0x52e5c2){if(_0x4bc8af[_0xbeed('0x45')]['id']){delete _0x4bc8af['body']['id'];}return db[_0xbeed('0x27')]['find']({'where':{'id':_0x4bc8af[_0xbeed('0x40')]['id']}})[_0xbeed('0x22')](handleEntityNotFound(_0x52e5c2,null))['then'](saveUpdates(_0x4bc8af[_0xbeed('0x45')],null))[_0xbeed('0x22')](respondWithResult(_0x52e5c2,null))[_0xbeed('0x3f')](handleError(_0x52e5c2,null));};exports['destroy']=function(_0x9bc2cb,_0x5e56ae){return db[_0xbeed('0x27')]['find']({'where':{'id':_0x9bc2cb['params']['id']}})[_0xbeed('0x22')](handleEntityNotFound(_0x5e56ae,null))['then'](removeEntity(_0x5e56ae,null))['catch'](handleError(_0x5e56ae,null));}; \ No newline at end of file +var _0xea20=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch'];(function(_0x3237ef,_0x5a7dc0){var _0x3c9576=function(_0x5362eb){while(--_0x5362eb){_0x3237ef['push'](_0x3237ef['shift']());}};_0x3c9576(++_0x5a7dc0);}(_0xea20,0x129));var _0x0ea2=function(_0x2532cd,_0x36cbaa){_0x2532cd=_0x2532cd-0x0;var _0x1ad033=_0xea20[_0x2532cd];return _0x1ad033;};'use strict';var emlformat=require(_0x0ea2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ea2('0x1'));var jsonpatch=require(_0x0ea2('0x2'));var rp=require(_0x0ea2('0x3'));var moment=require(_0x0ea2('0x4'));var BPromise=require(_0x0ea2('0x5'));var Mustache=require(_0x0ea2('0x6'));var util=require(_0x0ea2('0x7'));var path=require(_0x0ea2('0x8'));var sox=require(_0x0ea2('0x9'));var csv=require(_0x0ea2('0xa'));var ejs=require(_0x0ea2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0ea2('0xc'));var crypto=require(_0x0ea2('0xd'));var jsforce=require(_0x0ea2('0xe'));var deskjs=require(_0x0ea2('0xf'));var toCsv=require(_0x0ea2('0xa'));var querystring=require(_0x0ea2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0ea2('0x11'));var as=require(_0x0ea2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ea2('0x13'));var utils=require(_0x0ea2('0x14'));var config=require(_0x0ea2('0x15'));var licenseUtil=require(_0x0ea2('0x16'));var db=require(_0x0ea2('0x17'))['db'];function respondWithStatusCode(_0x44c480,_0x3a2769){_0x3a2769=_0x3a2769||0xcc;return function(_0x5e7391){if(_0x5e7391){return _0x44c480[_0x0ea2('0x18')](_0x3a2769);}return _0x44c480[_0x0ea2('0x19')](_0x3a2769)[_0x0ea2('0x1a')]();};}function respondWithResult(_0x245700,_0x1a2eac){_0x1a2eac=_0x1a2eac||0xc8;return function(_0x21a1cf){if(_0x21a1cf){return _0x245700['status'](_0x1a2eac)[_0x0ea2('0x1b')](_0x21a1cf);}};}function respondWithFilteredResult(_0x36c9ad,_0x4ee096){return function(_0x2fd5f8){if(_0x2fd5f8){var _0x65c5ff=typeof _0x4ee096['offset']===_0x0ea2('0x1c')&&typeof _0x4ee096[_0x0ea2('0x1d')]==='undefined';var _0x5e565d=_0x2fd5f8[_0x0ea2('0x1e')];var _0x2a5370=_0x65c5ff?0x0:_0x4ee096[_0x0ea2('0x1f')];var _0x4dde82=_0x65c5ff?_0x2fd5f8[_0x0ea2('0x1e')]:_0x4ee096[_0x0ea2('0x1f')]+_0x4ee096[_0x0ea2('0x1d')];var _0x4f9fb0;if(_0x4dde82>=_0x5e565d){_0x4dde82=_0x5e565d;_0x4f9fb0=0xc8;}else{_0x4f9fb0=0xce;}_0x36c9ad[_0x0ea2('0x19')](_0x4f9fb0);return _0x36c9ad['set']('Content-Range',_0x2a5370+'-'+_0x4dde82+'/'+_0x5e565d)[_0x0ea2('0x1b')](_0x2fd5f8);}return null;};}function patchUpdates(_0x2c9299){return function(_0x5aa5c8){try{jsonpatch[_0x0ea2('0x20')](_0x5aa5c8,_0x2c9299,!![]);}catch(_0x3a7bac){return BPromise[_0x0ea2('0x21')](_0x3a7bac);}return _0x5aa5c8[_0x0ea2('0x22')]();};}function saveUpdates(_0xb74828,_0x3d78ef){return function(_0x555e35){if(_0x555e35){return _0x555e35[_0x0ea2('0x23')](_0xb74828)[_0x0ea2('0x24')](function(_0x262f07){return _0x262f07;});}return null;};}function removeEntity(_0x23b286,_0x31de65){return function(_0x5d8a35){if(_0x5d8a35){return _0x5d8a35[_0x0ea2('0x25')]()[_0x0ea2('0x24')](function(){_0x23b286[_0x0ea2('0x19')](0xcc)[_0x0ea2('0x1a')]();});}};}function handleEntityNotFound(_0x56f9eb,_0x5b844d){return function(_0x200fe2){if(!_0x200fe2){_0x56f9eb[_0x0ea2('0x18')](0x194);}return _0x200fe2;};}function handleError(_0x2dcf62,_0x3e5c40){_0x3e5c40=_0x3e5c40||0x1f4;return function(_0x41b103){logger[_0x0ea2('0x26')](_0x41b103[_0x0ea2('0x27')]);if(_0x41b103[_0x0ea2('0x28')]){delete _0x41b103[_0x0ea2('0x28')];}_0x2dcf62[_0x0ea2('0x19')](_0x3e5c40)[_0x0ea2('0x29')](_0x41b103);};}exports['index']=function(_0x5b8a31,_0x1aa212){var _0x1f289d={},_0x514ea2={},_0x4ff075={'count':0x0,'rows':[]};var _0x15fe49=_[_0x0ea2('0x2a')](db[_0x0ea2('0x2b')][_0x0ea2('0x2c')],function(_0x42f4ea){return{'name':_0x42f4ea[_0x0ea2('0x2d')],'type':_0x42f4ea['type'][_0x0ea2('0x2e')]};});_0x514ea2[_0x0ea2('0x2f')]=_[_0x0ea2('0x2a')](_0x15fe49,_0x0ea2('0x28'));_0x514ea2['query']=_[_0x0ea2('0x30')](_0x5b8a31[_0x0ea2('0x31')]);_0x514ea2[_0x0ea2('0x32')]=_[_0x0ea2('0x33')](_0x514ea2['model'],_0x514ea2[_0x0ea2('0x31')]);_0x1f289d[_0x0ea2('0x34')]=_['intersection'](_0x514ea2[_0x0ea2('0x2f')],qs[_0x0ea2('0x35')](_0x5b8a31[_0x0ea2('0x31')]['fields']));_0x1f289d[_0x0ea2('0x34')]=_0x1f289d['attributes'][_0x0ea2('0x36')]?_0x1f289d[_0x0ea2('0x34')]:_0x514ea2['model'];if(!_0x5b8a31[_0x0ea2('0x31')][_0x0ea2('0x37')](_0x0ea2('0x38'))){_0x1f289d[_0x0ea2('0x1d')]=qs[_0x0ea2('0x1d')](_0x5b8a31[_0x0ea2('0x31')][_0x0ea2('0x1d')]);_0x1f289d[_0x0ea2('0x1f')]=qs[_0x0ea2('0x1f')](_0x5b8a31['query'][_0x0ea2('0x1f')]);}_0x1f289d[_0x0ea2('0x39')]=qs['sort'](_0x5b8a31[_0x0ea2('0x31')][_0x0ea2('0x3a')]);_0x1f289d[_0x0ea2('0x3b')]=qs['filters'](_[_0x0ea2('0x3c')](_0x5b8a31['query'],_0x514ea2[_0x0ea2('0x32')]),_0x15fe49);if(_0x5b8a31['query'][_0x0ea2('0x3d')]){_0x1f289d[_0x0ea2('0x3b')]=_[_0x0ea2('0x3e')](_0x1f289d[_0x0ea2('0x3b')],{'$or':_[_0x0ea2('0x2a')](_0x15fe49,function(_0x49d94d){if(_0x49d94d[_0x0ea2('0x3f')]!==_0x0ea2('0x40')){var _0xe7158c={};_0xe7158c[_0x49d94d[_0x0ea2('0x28')]]={'$like':'%'+_0x5b8a31[_0x0ea2('0x31')][_0x0ea2('0x3d')]+'%'};return _0xe7158c;}})});}_0x1f289d=_['merge']({},_0x1f289d,_0x5b8a31[_0x0ea2('0x41')]);var _0x316aef={'where':_0x1f289d['where']};return db[_0x0ea2('0x2b')][_0x0ea2('0x1e')](_0x316aef)[_0x0ea2('0x24')](function(_0x57c298){_0x4ff075[_0x0ea2('0x1e')]=_0x57c298;if(_0x5b8a31[_0x0ea2('0x31')][_0x0ea2('0x42')]){_0x1f289d[_0x0ea2('0x43')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x1f289d);})[_0x0ea2('0x24')](function(_0x4b32c2){_0x4ff075[_0x0ea2('0x44')]=_0x4b32c2;return _0x4ff075;})['then'](respondWithFilteredResult(_0x1aa212,_0x1f289d))[_0x0ea2('0x45')](handleError(_0x1aa212,null));};exports[_0x0ea2('0x46')]=function(_0x57d2db,_0x4d4b2c){var _0x469ba7={'raw':!![],'where':{'id':_0x57d2db[_0x0ea2('0x47')]['id']}},_0x4127ba={};_0x4127ba[_0x0ea2('0x2f')]=_[_0x0ea2('0x30')](db[_0x0ea2('0x2b')][_0x0ea2('0x2c')]);_0x4127ba[_0x0ea2('0x31')]=_[_0x0ea2('0x30')](_0x57d2db[_0x0ea2('0x31')]);_0x4127ba[_0x0ea2('0x32')]=_[_0x0ea2('0x33')](_0x4127ba['model'],_0x4127ba['query']);_0x469ba7[_0x0ea2('0x34')]=_[_0x0ea2('0x33')](_0x4127ba[_0x0ea2('0x2f')],qs[_0x0ea2('0x35')](_0x57d2db['query']['fields']));_0x469ba7['attributes']=_0x469ba7[_0x0ea2('0x34')][_0x0ea2('0x36')]?_0x469ba7[_0x0ea2('0x34')]:_0x4127ba[_0x0ea2('0x2f')];if(_0x57d2db['query'][_0x0ea2('0x42')]){_0x469ba7[_0x0ea2('0x43')]=[{'all':!![]}];}_0x469ba7=_[_0x0ea2('0x3e')]({},_0x469ba7,_0x57d2db['options']);return db[_0x0ea2('0x2b')][_0x0ea2('0x48')](_0x469ba7)['then'](handleEntityNotFound(_0x4d4b2c,null))[_0x0ea2('0x24')](respondWithResult(_0x4d4b2c,null))['catch'](handleError(_0x4d4b2c,null));};exports[_0x0ea2('0x49')]=function(_0x18cde1,_0x2a3ee3){return db[_0x0ea2('0x2b')][_0x0ea2('0x49')](_0x18cde1[_0x0ea2('0x4a')],{})[_0x0ea2('0x24')](respondWithResult(_0x2a3ee3,0xc9))['catch'](handleError(_0x2a3ee3,null));};exports['update']=function(_0x3ca891,_0x490137){if(_0x3ca891[_0x0ea2('0x4a')]['id']){delete _0x3ca891[_0x0ea2('0x4a')]['id'];}return db[_0x0ea2('0x2b')]['find']({'where':{'id':_0x3ca891[_0x0ea2('0x47')]['id']}})[_0x0ea2('0x24')](handleEntityNotFound(_0x490137,null))['then'](saveUpdates(_0x3ca891[_0x0ea2('0x4a')],null))[_0x0ea2('0x24')](respondWithResult(_0x490137,null))['catch'](handleError(_0x490137,null));};exports[_0x0ea2('0x25')]=function(_0x52762a,_0x17f335){return db[_0x0ea2('0x2b')]['find']({'where':{'id':_0x52762a[_0x0ea2('0x47')]['id']}})[_0x0ea2('0x24')](handleEntityNotFound(_0x17f335,null))[_0x0ea2('0x24')](removeEntity(_0x17f335,null))[_0x0ea2('0x45')](handleError(_0x17f335,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 1d9c69a..fa1f8b9 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 _0xeada=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x8c6162,_0x25acaf){var _0x36caa9=function(_0x568282){while(--_0x568282){_0x8c6162['push'](_0x8c6162['shift']());}};_0x36caa9(++_0x25acaf);}(_0xeada,0xa4));var _0xaead=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeada[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xaead('0x0'));var util=require(_0xaead('0x1'));var logger=require(_0xaead('0x2'))(_0xaead('0x3'));var moment=require(_0xaead('0x4'));var BPromise=require('bluebird');var rp=require(_0xaead('0x5'));var fs=require('fs');var path=require(_0xaead('0x6'));var rimraf=require(_0xaead('0x7'));var config=require(_0xaead('0x8'));var attributes=require(_0xaead('0x9'));module[_0xaead('0xa')]=function(_0x3366a7,_0xbcb160){return _0x3366a7['define'](_0xaead('0xb'),attributes,{'tableName':_0xaead('0xc'),'paranoid':![],'indexes':[{'name':_0xaead('0xd'),'fields':[_0xaead('0xe'),_0xaead('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0808=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x4328d0,_0x57d351){var _0x175925=function(_0x49cd82){while(--_0x49cd82){_0x4328d0['push'](_0x4328d0['shift']());}};_0x175925(++_0x57d351);}(_0x0808,0x7e));var _0x8080=function(_0x11b9b2,_0x29feed){_0x11b9b2=_0x11b9b2-0x0;var _0x30674e=_0x0808[_0x11b9b2];return _0x30674e;};'use strict';var _=require('lodash');var util=require(_0x8080('0x0'));var logger=require(_0x8080('0x1'))(_0x8080('0x2'));var moment=require('moment');var BPromise=require(_0x8080('0x3'));var rp=require(_0x8080('0x4'));var fs=require('fs');var path=require(_0x8080('0x5'));var rimraf=require(_0x8080('0x6'));var config=require(_0x8080('0x7'));var attributes=require(_0x8080('0x8'));module[_0x8080('0x9')]=function(_0x10605e,_0x1d476d){return _0x10605e['define'](_0x8080('0xa'),attributes,{'tableName':_0x8080('0xb'),'paranoid':![],'indexes':[{'name':_0x8080('0xc'),'fields':[_0x8080('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 0929412..13158fc 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 _0x6206=['request','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6206,0x193));var _0x6620=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6206[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6620('0x0'));var util=require(_0x6620('0x1'));var moment=require(_0x6620('0x2'));var BPromise=require(_0x6620('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6620('0x4'));var logger=require(_0x6620('0x5'))(_0x6620('0x6'));var config=require(_0x6620('0x7'));var jayson=require(_0x6620('0x8'));var client=jayson[_0x6620('0x9')][_0x6620('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x248b1d,_0x46d743,_0x3c1960){return new BPromise(function(_0x152499,_0x4dba13){return client[_0x6620('0xb')](_0x248b1d,_0x3c1960)[_0x6620('0xc')](function(_0x47745b){logger[_0x6620('0xd')]('VtigerField,\x20%s,\x20%s',_0x46d743,'request\x20sent');logger[_0x6620('0xe')](_0x6620('0xf'),_0x46d743,_0x6620('0x10'),JSON[_0x6620('0x11')](_0x47745b));if(_0x47745b[_0x6620('0x12')]){if(_0x47745b['error'][_0x6620('0x13')]===0x1f4){logger[_0x6620('0x12')](_0x6620('0x14'),_0x46d743,_0x47745b[_0x6620('0x12')]['message']);return _0x4dba13(_0x47745b['error'][_0x6620('0x15')]);}logger[_0x6620('0x12')](_0x6620('0x14'),_0x46d743,_0x47745b[_0x6620('0x12')][_0x6620('0x15')]);return _0x152499(_0x47745b[_0x6620('0x12')][_0x6620('0x15')]);}else{logger[_0x6620('0xd')](_0x6620('0x14'),_0x46d743,_0x6620('0x10'));_0x152499(_0x47745b['result'][_0x6620('0x15')]);}})[_0x6620('0x16')](function(_0x23a698){logger[_0x6620('0x12')]('VtigerField,\x20%s,\x20%s',_0x46d743,_0x23a698);_0x4dba13(_0x23a698);});});} \ No newline at end of file +var _0x16d9=['client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x22c271,_0x314f5b){var _0x48727d=function(_0x5659ea){while(--_0x5659ea){_0x22c271['push'](_0x22c271['shift']());}};_0x48727d(++_0x314f5b);}(_0x16d9,0x1f0));var _0x916d=function(_0x1e22d6,_0x25605f){_0x1e22d6=_0x1e22d6-0x0;var _0x397cc4=_0x16d9[_0x1e22d6];return _0x397cc4;};'use strict';var _=require(_0x916d('0x0'));var util=require(_0x916d('0x1'));var moment=require(_0x916d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x916d('0x3'));var db=require(_0x916d('0x4'))['db'];var utils=require(_0x916d('0x5'));var logger=require(_0x916d('0x6'))(_0x916d('0x7'));var config=require(_0x916d('0x8'));var jayson=require(_0x916d('0x9'));var client=jayson[_0x916d('0xa')][_0x916d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16a59b,_0x20c59b,_0x2889bf){return new BPromise(function(_0x462cb8,_0x581a35){return client[_0x916d('0xc')](_0x16a59b,_0x2889bf)[_0x916d('0xd')](function(_0x4a9540){logger[_0x916d('0xe')](_0x916d('0xf'),_0x20c59b,'request\x20sent');logger[_0x916d('0x10')](_0x916d('0x11'),_0x20c59b,'request\x20sent',JSON['stringify'](_0x4a9540));if(_0x4a9540[_0x916d('0x12')]){if(_0x4a9540[_0x916d('0x12')][_0x916d('0x13')]===0x1f4){logger[_0x916d('0x12')](_0x916d('0xf'),_0x20c59b,_0x4a9540[_0x916d('0x12')][_0x916d('0x14')]);return _0x581a35(_0x4a9540['error'][_0x916d('0x14')]);}logger[_0x916d('0x12')]('VtigerField,\x20%s,\x20%s',_0x20c59b,_0x4a9540[_0x916d('0x12')]['message']);return _0x462cb8(_0x4a9540[_0x916d('0x12')][_0x916d('0x14')]);}else{logger[_0x916d('0xe')](_0x916d('0xf'),_0x20c59b,_0x916d('0x15'));_0x462cb8(_0x4a9540[_0x916d('0x16')]['message']);}})['catch'](function(_0xb204e9){logger[_0x916d('0x12')](_0x916d('0xf'),_0x20c59b,_0xb204e9);_0x581a35(_0xb204e9);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 6beade7..01c70ea 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 _0x609a=['express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','delete','multer','path','connect-timeout'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x609a,0x11d));var _0xa609=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x609a[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xa609('0x0'));var util=require('util');var path=require(_0xa609('0x1'));var timeout=require(_0xa609('0x2'));var express=require(_0xa609('0x3'));var router=express[_0xa609('0x4')]();var fs_extra=require(_0xa609('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa609('0x6'));var controller=require('./intZendeskAccount.controller');router[_0xa609('0x7')]('/',auth[_0xa609('0x8')](),controller[_0xa609('0x9')]);router[_0xa609('0x7')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller[_0xa609('0xb')]);router[_0xa609('0x7')](_0xa609('0xc'),auth[_0xa609('0x8')](),controller['getConfigurations']);router[_0xa609('0x7')](_0xa609('0xd'),auth[_0xa609('0x8')](),controller['getFields']);router[_0xa609('0xe')]('/',auth['isAuthenticated'](),controller[_0xa609('0xf')]);router[_0xa609('0xe')](_0xa609('0xc'),auth[_0xa609('0x8')](),controller[_0xa609('0x10')]);router['put']('/:id',auth[_0xa609('0x8')](),controller['update']);router[_0xa609('0x11')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6877=['show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index'];(function(_0x28cddc,_0x1be16d){var _0x5ce855=function(_0x1fe396){while(--_0x1fe396){_0x28cddc['push'](_0x28cddc['shift']());}};_0x5ce855(++_0x1be16d);}(_0x6877,0xa4));var _0x7687=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x6877[_0x20a558];return _0x53d3f7;};'use strict';var multer=require(_0x7687('0x0'));var util=require(_0x7687('0x1'));var path=require(_0x7687('0x2'));var timeout=require('connect-timeout');var express=require(_0x7687('0x3'));var router=express['Router']();var fs_extra=require(_0x7687('0x4'));var auth=require(_0x7687('0x5'));var interaction=require(_0x7687('0x6'));var config=require(_0x7687('0x7'));var controller=require(_0x7687('0x8'));router['get']('/',auth[_0x7687('0x9')](),controller[_0x7687('0xa')]);router['get']('/:id',auth[_0x7687('0x9')](),controller[_0x7687('0xb')]);router[_0x7687('0xc')](_0x7687('0xd'),auth[_0x7687('0x9')](),controller[_0x7687('0xe')]);router[_0x7687('0xc')](_0x7687('0xf'),auth['isAuthenticated'](),controller[_0x7687('0x10')]);router[_0x7687('0x11')]('/',auth['isAuthenticated'](),controller[_0x7687('0x12')]);router[_0x7687('0x11')](_0x7687('0xd'),auth[_0x7687('0x9')](),controller[_0x7687('0x13')]);router[_0x7687('0x14')](_0x7687('0x15'),auth['isAuthenticated'](),controller['update']);router[_0x7687('0x16')]('/:id',auth[_0x7687('0x9')](),controller[_0x7687('0x17')]);module[_0x7687('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 913c960..4ef2463 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 _0x90b1=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username','password'];(function(_0x30ef20,_0x20c103){var _0x57ba86=function(_0x33a588){while(--_0x33a588){_0x30ef20['push'](_0x30ef20['shift']());}};_0x57ba86(++_0x20c103);}(_0x90b1,0x1bb));var _0x190b=function(_0x1db72a,_0x22f6bc){_0x1db72a=_0x1db72a-0x0;var _0x1c7ee7=_0x90b1[_0x1db72a];return _0x1c7ee7;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'name':{'type':Sequelize[_0x190b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x190b('0x3')},'password':{'type':Sequelize[_0x190b('0x2')]},'token':{'type':Sequelize[_0x190b('0x2')]},'remoteUri':{'type':Sequelize[_0x190b('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password','token'),'defaultValue':_0x190b('0x4')},'serverUrl':{'type':Sequelize[_0x190b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x190b('0x5')](_0x190b('0x6'),_0x190b('0x7')),'defaultValue':_0x190b('0x6')}}; \ No newline at end of file +var _0x853e=['integrationTab','newTab','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x246eb0,_0x120a06){var _0xd5b9d4=function(_0x2e2f06){while(--_0x2e2f06){_0x246eb0['push'](_0x246eb0['shift']());}};_0xd5b9d4(++_0x120a06);}(_0x853e,0x1ea));var _0xe853=function(_0xbe9e44,_0x509ecd){_0xbe9e44=_0xbe9e44-0x0;var _0x22f58b=_0x853e[_0xbe9e44];return _0x22f58b;};'use strict';var Sequelize=require('sequelize');module[_0xe853('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe853('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xe853('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe853('0x1')]},'remoteUri':{'type':Sequelize[_0xe853('0x1')],'unique':_0xe853('0x3')},'authType':{'type':Sequelize[_0xe853('0x4')](_0xe853('0x5'),'token'),'defaultValue':_0xe853('0x5')},'serverUrl':{'type':Sequelize[_0xe853('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe853('0x4')](_0xe853('0x6'),_0xe853('0x7')),'defaultValue':_0xe853('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 75923b7..a605a3e 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 _0xd87e=['undefined','count','limit','set','Content-Range','reject','update','destroy','error','stack','name','index','ZendeskAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','order','pick','filter','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','headers','format','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x23200d,_0x15fb6e){var _0x3f8381=function(_0x3318d6){while(--_0x3318d6){_0x23200d['push'](_0x23200d['shift']());}};_0x3f8381(++_0x15fb6e);}(_0xd87e,0x1bf));var _0xed87=function(_0x364040,_0x2661d5){_0x364040=_0x364040-0x0;var _0x4328dc=_0xd87e[_0x364040];return _0x4328dc;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4ffc2d,_0x466f35){_0x466f35=_0x466f35||0xcc;return function(_0x32276e){if(_0x32276e){return _0x4ffc2d[_0xed87('0x18')](_0x466f35);}return _0x4ffc2d[_0xed87('0x19')](_0x466f35)[_0xed87('0x1a')]();};}function respondWithResult(_0x3865c5,_0x52dfe8){_0x52dfe8=_0x52dfe8||0xc8;return function(_0x4494da){if(_0x4494da){return _0x3865c5[_0xed87('0x19')](_0x52dfe8)[_0xed87('0x1b')](_0x4494da);}};}function respondWithFilteredResult(_0x1e9a3d,_0x2f2fd3){return function(_0xd34e0e){if(_0xd34e0e){var _0x173413=typeof _0x2f2fd3[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x2f2fd3['limit']===_0xed87('0x1d');var _0x18ab7d=_0xd34e0e[_0xed87('0x1e')];var _0xfb8a44=_0x173413?0x0:_0x2f2fd3['offset'];var _0x211085=_0x173413?_0xd34e0e[_0xed87('0x1e')]:_0x2f2fd3[_0xed87('0x1c')]+_0x2f2fd3[_0xed87('0x1f')];var _0x98a2ca;if(_0x211085>=_0x18ab7d){_0x211085=_0x18ab7d;_0x98a2ca=0xc8;}else{_0x98a2ca=0xce;}_0x1e9a3d[_0xed87('0x19')](_0x98a2ca);return _0x1e9a3d[_0xed87('0x20')](_0xed87('0x21'),_0xfb8a44+'-'+_0x211085+'/'+_0x18ab7d)[_0xed87('0x1b')](_0xd34e0e);}return null;};}function patchUpdates(_0x52e81c){return function(_0x5a7329){try{jsonpatch['apply'](_0x5a7329,_0x52e81c,!![]);}catch(_0x47c121){return BPromise[_0xed87('0x22')](_0x47c121);}return _0x5a7329['save']();};}function saveUpdates(_0x4191a7,_0x2b0b98){return function(_0x5b1659){if(_0x5b1659){return _0x5b1659[_0xed87('0x23')](_0x4191a7)['then'](function(_0x3d1641){return _0x3d1641;});}return null;};}function removeEntity(_0x24962e,_0x27799a){return function(_0x2a8733){if(_0x2a8733){return _0x2a8733[_0xed87('0x24')]()['then'](function(){_0x24962e[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x41e0d4,_0x320bcc){return function(_0x31c600){if(!_0x31c600){_0x41e0d4[_0xed87('0x18')](0x194);}return _0x31c600;};}function handleError(_0x25a6f7,_0x4735b3){_0x4735b3=_0x4735b3||0x1f4;return function(_0x40b2fa){logger[_0xed87('0x25')](_0x40b2fa[_0xed87('0x26')]);if(_0x40b2fa[_0xed87('0x27')]){delete _0x40b2fa[_0xed87('0x27')];}_0x25a6f7[_0xed87('0x19')](_0x4735b3)['send'](_0x40b2fa);};}exports[_0xed87('0x28')]=function(_0x1c4a65,_0x4eaa44){var _0x3dff74={},_0x33c367={},_0x21c93b={'count':0x0,'rows':[]};var _0x4b259e=_['map'](db[_0xed87('0x29')][_0xed87('0x2a')],function(_0x21ab8a){return{'name':_0x21ab8a['fieldName'],'type':_0x21ab8a[_0xed87('0x2b')][_0xed87('0x2c')]};});_0x33c367[_0xed87('0x2d')]=_[_0xed87('0x2e')](_0x4b259e,_0xed87('0x27'));_0x33c367[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x1c4a65[_0xed87('0x2f')]);_0x33c367[_0xed87('0x31')]=_['intersection'](_0x33c367[_0xed87('0x2d')],_0x33c367[_0xed87('0x2f')]);_0x3dff74['attributes']=_[_0xed87('0x32')](_0x33c367['model'],qs[_0xed87('0x33')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x33')]));_0x3dff74[_0xed87('0x34')]=_0x3dff74[_0xed87('0x34')][_0xed87('0x35')]?_0x3dff74[_0xed87('0x34')]:_0x33c367[_0xed87('0x2d')];if(!_0x1c4a65[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x3dff74['limit']=qs[_0xed87('0x1f')](_0x1c4a65[_0xed87('0x2f')]['limit']);_0x3dff74[_0xed87('0x1c')]=qs['offset'](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x1c')]);}_0x3dff74['order']=qs[_0xed87('0x38')](_0x1c4a65[_0xed87('0x2f')][_0xed87('0x38')]);_0x3dff74[_0xed87('0x39')]=qs[_0xed87('0x31')](_['pick'](_0x1c4a65[_0xed87('0x2f')],_0x33c367['filters']),_0x4b259e);if(_0x1c4a65[_0xed87('0x2f')]['filter']){_0x3dff74[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x3dff74[_0xed87('0x39')],{'$or':_[_0xed87('0x2e')](_0x4b259e,function(_0x319f69){if(_0x319f69[_0xed87('0x2b')]!==_0xed87('0x3b')){var _0x161491={};_0x161491[_0x319f69[_0xed87('0x27')]]={'$like':'%'+_0x1c4a65['query']['filter']+'%'};return _0x161491;}})});}_0x3dff74=_[_0xed87('0x3a')]({},_0x3dff74,_0x1c4a65[_0xed87('0x3c')]);var _0x1f16a8={'where':_0x3dff74[_0xed87('0x39')]};return db[_0xed87('0x29')][_0xed87('0x1e')](_0x1f16a8)['then'](function(_0x4398a0){_0x21c93b[_0xed87('0x1e')]=_0x4398a0;if(_0x1c4a65[_0xed87('0x2f')]['includeAll']){_0x3dff74[_0xed87('0x3d')]=[{'all':!![]}];}return db[_0xed87('0x29')][_0xed87('0x3e')](_0x3dff74);})[_0xed87('0x3f')](function(_0x1d1e99){_0x21c93b[_0xed87('0x40')]=_0x1d1e99;return _0x21c93b;})[_0xed87('0x3f')](respondWithFilteredResult(_0x4eaa44,_0x3dff74))[_0xed87('0x41')](handleError(_0x4eaa44,null));};exports[_0xed87('0x42')]=function(_0x406b73,_0x5c6925){var _0x7e6cbb={'raw':![],'where':{'id':_0x406b73[_0xed87('0x43')]['id']}},_0x3c7fcc={};_0x3c7fcc['model']=_['keys'](db[_0xed87('0x29')][_0xed87('0x2a')]);_0x3c7fcc[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x406b73['query']);_0x3c7fcc[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3c7fcc['model'],_0x3c7fcc[_0xed87('0x2f')]);_0x7e6cbb[_0xed87('0x34')]=_[_0xed87('0x32')](_0x3c7fcc[_0xed87('0x2d')],qs[_0xed87('0x33')](_0x406b73[_0xed87('0x2f')][_0xed87('0x33')]));_0x7e6cbb[_0xed87('0x34')]=_0x7e6cbb[_0xed87('0x34')][_0xed87('0x35')]?_0x7e6cbb[_0xed87('0x34')]:_0x3c7fcc['model'];if(_0x406b73[_0xed87('0x2f')][_0xed87('0x44')]){_0x7e6cbb[_0xed87('0x3d')]=[{'all':!![]}];}_0x7e6cbb=_[_0xed87('0x3a')]({},_0x7e6cbb,_0x406b73[_0xed87('0x3c')]);return db[_0xed87('0x29')][_0xed87('0x45')](_0x7e6cbb)[_0xed87('0x3f')](handleEntityNotFound(_0x5c6925,null))[_0xed87('0x3f')](respondWithResult(_0x5c6925,null))[_0xed87('0x41')](handleError(_0x5c6925,null));};exports[_0xed87('0x46')]=function(_0x26c8f4,_0x27ed22){return db[_0xed87('0x29')][_0xed87('0x46')](_0x26c8f4[_0xed87('0x47')],{})[_0xed87('0x3f')](respondWithResult(_0x27ed22,0xc9))['catch'](handleError(_0x27ed22,null));};exports[_0xed87('0x23')]=function(_0x1a68a7,_0x3a91c5){if(_0x1a68a7['body']['id']){delete _0x1a68a7[_0xed87('0x47')]['id'];}return db[_0xed87('0x29')]['find']({'where':{'id':_0x1a68a7[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3a91c5,null))[_0xed87('0x3f')](saveUpdates(_0x1a68a7[_0xed87('0x47')],null))['then'](respondWithResult(_0x3a91c5,null))[_0xed87('0x41')](handleError(_0x3a91c5,null));};exports[_0xed87('0x24')]=function(_0x3ca34c,_0x272a07){return db[_0xed87('0x29')][_0xed87('0x45')]({'where':{'id':_0x3ca34c[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x272a07,null))[_0xed87('0x3f')](removeEntity(_0x272a07,null))[_0xed87('0x41')](handleError(_0x272a07,null));};exports[_0xed87('0x48')]=function(_0x18846f,_0x2e5a9f,_0x4df105){var _0x43ffa4={};var _0x4ea4e3={};var _0x17cad7;var _0x329973;return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x18846f[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x2e5a9f,null))[_0xed87('0x3f')](function(_0xccdbb6){if(_0xccdbb6){_0x17cad7=_0xccdbb6;_0x4ea4e3[_0xed87('0x2d')]=_[_0xed87('0x30')](db['ZendeskConfiguration'][_0xed87('0x2a')]);_0x4ea4e3[_0xed87('0x2f')]=_[_0xed87('0x30')](_0x18846f[_0xed87('0x2f')]);_0x4ea4e3[_0xed87('0x31')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],_0x4ea4e3[_0xed87('0x2f')]);_0x43ffa4[_0xed87('0x34')]=_[_0xed87('0x32')](_0x4ea4e3[_0xed87('0x2d')],qs['fields'](_0x18846f['query'][_0xed87('0x33')]));_0x43ffa4[_0xed87('0x34')]=_0x43ffa4[_0xed87('0x34')][_0xed87('0x35')]?_0x43ffa4[_0xed87('0x34')]:_0x4ea4e3['model'];_0x43ffa4[_0xed87('0x4a')]=qs[_0xed87('0x38')](_0x18846f[_0xed87('0x2f')][_0xed87('0x38')]);_0x43ffa4[_0xed87('0x39')]=qs[_0xed87('0x31')](_[_0xed87('0x4b')](_0x18846f[_0xed87('0x2f')],_0x4ea4e3[_0xed87('0x31')]));if(_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]){_0x43ffa4[_0xed87('0x39')]=_[_0xed87('0x3a')](_0x43ffa4[_0xed87('0x39')],{'$or':_['map'](_0x43ffa4[_0xed87('0x34')],function(_0x10a19c){var _0x2f03d4={};_0x2f03d4[_0x10a19c]={'$like':'%'+_0x18846f[_0xed87('0x2f')][_0xed87('0x4c')]+'%'};return _0x2f03d4;})});}_0x43ffa4=_[_0xed87('0x3a')]({},_0x43ffa4,_0x18846f[_0xed87('0x3c')]);return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})['then'](function(_0x4367c3){if(_0x4367c3){_0x329973=_0x4367c3[_0xed87('0x35')];if(!_0x18846f[_0xed87('0x2f')][_0xed87('0x36')](_0xed87('0x37'))){_0x43ffa4[_0xed87('0x1f')]=qs['limit'](_0x18846f['query'][_0xed87('0x1f')]);_0x43ffa4[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0x18846f[_0xed87('0x2f')][_0xed87('0x1c')]);}return _0x17cad7[_0xed87('0x48')](_0x43ffa4);}})[_0xed87('0x3f')](function(_0x3bdf7c){if(_0x3bdf7c){return _0x3bdf7c?{'count':_0x329973,'rows':_0x3bdf7c}:null;}})['then'](respondWithResult(_0x2e5a9f,null))[_0xed87('0x41')](handleError(_0x2e5a9f,null));};exports['addConfiguration']=function(_0xd3b300,_0x3c82de,_0x4e5055){if(_0xd3b300[_0xed87('0x47')]['id']){delete _0xd3b300[_0xed87('0x47')]['id'];}return db['ZendeskAccount'][_0xed87('0x49')]({'where':{'id':_0xd3b300[_0xed87('0x43')]['id']}})[_0xed87('0x3f')](handleEntityNotFound(_0x3c82de,null))[_0xed87('0x3f')](function(_0x112685){if(_0x112685){_0xd3b300['body'][_0xed87('0x4d')]=_0x112685['id'];_0xd3b300[_0xed87('0x47')][_0xed87('0x4e')]=integrations[_0xed87('0x4f')](_0xd3b300['body']['channel'],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);_0xd3b300['body'][_0xed87('0x50')]=integrations[_0xed87('0x51')](_0xd3b300[_0xed87('0x47')][_0xed87('0x52')],_0xd3b300[_0xed87('0x47')][_0xed87('0x2b')]);return db[_0xed87('0x53')][_0xed87('0x46')](_0xd3b300[_0xed87('0x47')],{'include':[{'model':db[_0xed87('0x54')],'as':_0xed87('0x4e')},{'model':db[_0xed87('0x54')],'as':_0xed87('0x50')}]});}return null;})[_0xed87('0x3f')](respondWithResult(_0x3c82de,null))['catch'](handleError(_0x3c82de,null));};exports[_0xed87('0x55')]=function(_0x2686cd,_0x566ace,_0x4f7b92){var _0x5136c9='';return db[_0xed87('0x29')][_0xed87('0x49')]({'where':{'id':_0x2686cd[_0xed87('0x43')]['id']},'attributes':['id',_0xed87('0x56'),_0xed87('0x57'),_0xed87('0x58'),_0xed87('0x59'),'remoteUri']})[_0xed87('0x3f')](handleEntityNotFound(_0x566ace,null))[_0xed87('0x3f')](function(_0x3b6a9b){if(_0x3b6a9b){_0x5136c9=_0x3b6a9b[_0xed87('0x5a')];var _0xc35cab=_0x5136c9[_0xed87('0x5b')](-0x1);if(_0xc35cab==='/'){_0x5136c9=_0x5136c9[_0xed87('0x5c')](0x0,_0x5136c9[_0xed87('0x5d')](_0xc35cab));}var _0x116198={'method':_0xed87('0x5e'),'uri':util['format']('%s/%s',_0x5136c9,'ticket_fields'),'json':!![]};switch(_0x3b6a9b[_0xed87('0x59')]){case _0xed87('0x57'):_0x116198[_0xed87('0x5f')]={'Authorization':util[_0xed87('0x60')](_0xed87('0x61'),new Buffer(util['format'](_0xed87('0x62'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x57')]))[_0xed87('0x63')](_0xed87('0x64')))};break;case _0xed87('0x58'):_0x116198['headers']={'Authorization':util['format'](_0xed87('0x61'),new Buffer(util[_0xed87('0x60')](_0xed87('0x65'),_0x3b6a9b[_0xed87('0x56')],_0x3b6a9b[_0xed87('0x58')]))[_0xed87('0x63')](_0xed87('0x64')))};break;default:throw new db[(_0xed87('0x66'))][(_0xed87('0x67'))](_0xed87('0x68'));}return rp(_0x116198);}})[_0xed87('0x3f')](function(_0x1a1f95){if(_0x1a1f95){var _0x52af5c=[_0xed87('0x69'),_0xed87('0x6a'),_0xed87('0x6b'),_0xed87('0x6c')];_[_0xed87('0x6d')](_0x1a1f95[_0xed87('0x6e')],function(_0x4ae84c){return _0x52af5c[_0xed87('0x6f')](_0x4ae84c[_0xed87('0x2b')]);});return{'count':_0x1a1f95[_0xed87('0x6e')][_0xed87('0x35')],'rows':_['map'](_0x1a1f95['ticket_fields'],function(_0x4bfca0){return{'id':_0x4bfca0['id'],'name':_0x4bfca0['position']>0x7?_0x4bfca0['title']:_0x4bfca0[_0xed87('0x2b')],'custom':_0x4bfca0[_0xed87('0x70')]>0x7?!![]:![],'options':_0x4bfca0[_0xed87('0x71')]?_0x4bfca0[_0xed87('0x71')]:_0x4bfca0[_0xed87('0x72')]?_0x4bfca0[_0xed87('0x72')]:[]};})};}})[_0xed87('0x3f')](respondWithResult(_0x566ace,null))[_0xed87('0x41')](function(_0x1b223b){var _0x510066=_0x2686cd['query'][_0xed87('0x73')]?0x1f4:_0x1b223b[_0xed87('0x74')]||0x1f4;logger[_0xed87('0x25')](_0xed87('0x75'),_0xed87('0x55'),_0x510066,JSON['stringify'](_0x1b223b));delete _0x1b223b['name'];if(_0x510066===0x191){_0x510066=0x190;}_0x566ace[_0xed87('0x19')](_0x510066)[_0xed87('0x76')](_0x2686cd['query'][_0xed87('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1b223b[_0xed87('0x74')]}:_0x1b223b);});}; \ No newline at end of file +var _0xa902=['%s:%s','base64','%s/token:%s','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','ZendeskAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','sort','map','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','findOne','username','password','remoteUri','slice','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s'];(function(_0x3f86c3,_0x109a0f){var _0x1de1da=function(_0x17096f){while(--_0x17096f){_0x3f86c3['push'](_0x3f86c3['shift']());}};_0x1de1da(++_0x109a0f);}(_0xa902,0x8d));var _0x2a90=function(_0x3a784a,_0x568baf){_0x3a784a=_0x3a784a-0x0;var _0x36abd4=_0xa902[_0x3a784a];return _0x36abd4;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1f6953,_0x57aee3){_0x57aee3=_0x57aee3||0xcc;return function(_0x407ce5){if(_0x407ce5){return _0x1f6953[_0x2a90('0x17')](_0x57aee3);}return _0x1f6953[_0x2a90('0x18')](_0x57aee3)['end']();};}function respondWithResult(_0x56d1b8,_0x57227c){_0x57227c=_0x57227c||0xc8;return function(_0x46cb32){if(_0x46cb32){return _0x56d1b8[_0x2a90('0x18')](_0x57227c)['json'](_0x46cb32);}};}function respondWithFilteredResult(_0x1ff63d,_0x21c648){return function(_0x312782){if(_0x312782){var _0x25bd0e=typeof _0x21c648[_0x2a90('0x19')]===_0x2a90('0x1a')&&typeof _0x21c648[_0x2a90('0x1b')]===_0x2a90('0x1a');var _0x43eea5=_0x312782['count'];var _0x162f0b=_0x25bd0e?0x0:_0x21c648[_0x2a90('0x19')];var _0x4190ff=_0x25bd0e?_0x312782['count']:_0x21c648[_0x2a90('0x19')]+_0x21c648[_0x2a90('0x1b')];var _0x148d18;if(_0x4190ff>=_0x43eea5){_0x4190ff=_0x43eea5;_0x148d18=0xc8;}else{_0x148d18=0xce;}_0x1ff63d[_0x2a90('0x18')](_0x148d18);return _0x1ff63d[_0x2a90('0x1c')](_0x2a90('0x1d'),_0x162f0b+'-'+_0x4190ff+'/'+_0x43eea5)[_0x2a90('0x1e')](_0x312782);}return null;};}function patchUpdates(_0x114d42){return function(_0xf97adb){try{jsonpatch[_0x2a90('0x1f')](_0xf97adb,_0x114d42,!![]);}catch(_0x1340b9){return BPromise[_0x2a90('0x20')](_0x1340b9);}return _0xf97adb['save']();};}function saveUpdates(_0x3da7d0,_0x217873){return function(_0x2955a9){if(_0x2955a9){return _0x2955a9[_0x2a90('0x21')](_0x3da7d0)['then'](function(_0x180485){return _0x180485;});}return null;};}function removeEntity(_0xd033d,_0x4ed9e6){return function(_0x1bcfd7){if(_0x1bcfd7){return _0x1bcfd7[_0x2a90('0x22')]()[_0x2a90('0x23')](function(){_0xd033d[_0x2a90('0x18')](0xcc)[_0x2a90('0x24')]();});}};}function handleEntityNotFound(_0x1303d9,_0x29ed73){return function(_0x24a6d3){if(!_0x24a6d3){_0x1303d9['sendStatus'](0x194);}return _0x24a6d3;};}function handleError(_0x27f883,_0x17f978){_0x17f978=_0x17f978||0x1f4;return function(_0x3934d4){logger[_0x2a90('0x25')](_0x3934d4[_0x2a90('0x26')]);if(_0x3934d4['name']){delete _0x3934d4['name'];}_0x27f883[_0x2a90('0x18')](_0x17f978)['send'](_0x3934d4);};}exports['index']=function(_0x4969c3,_0x2d83b3){var _0x3c78f5={},_0x595638={},_0x5bd700={'count':0x0,'rows':[]};var _0x1add9a=_['map'](db[_0x2a90('0x27')][_0x2a90('0x28')],function(_0x3b580f){return{'name':_0x3b580f[_0x2a90('0x29')],'type':_0x3b580f[_0x2a90('0x2a')][_0x2a90('0x2b')]};});_0x595638[_0x2a90('0x2c')]=_['map'](_0x1add9a,_0x2a90('0x2d'));_0x595638[_0x2a90('0x2e')]=_[_0x2a90('0x2f')](_0x4969c3['query']);_0x595638[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0x595638[_0x2a90('0x2c')],_0x595638[_0x2a90('0x2e')]);_0x3c78f5['attributes']=_[_0x2a90('0x31')](_0x595638[_0x2a90('0x2c')],qs[_0x2a90('0x32')](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x32')]));_0x3c78f5[_0x2a90('0x33')]=_0x3c78f5['attributes'][_0x2a90('0x34')]?_0x3c78f5[_0x2a90('0x33')]:_0x595638[_0x2a90('0x2c')];if(!_0x4969c3[_0x2a90('0x2e')]['hasOwnProperty'](_0x2a90('0x35'))){_0x3c78f5[_0x2a90('0x1b')]=qs['limit'](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x1b')]);_0x3c78f5['offset']=qs['offset'](_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x19')]);}_0x3c78f5[_0x2a90('0x36')]=qs['sort'](_0x4969c3[_0x2a90('0x2e')]['sort']);_0x3c78f5[_0x2a90('0x37')]=qs['filters'](_[_0x2a90('0x38')](_0x4969c3['query'],_0x595638['filters']),_0x1add9a);if(_0x4969c3[_0x2a90('0x2e')]['filter']){_0x3c78f5[_0x2a90('0x37')]=_[_0x2a90('0x39')](_0x3c78f5[_0x2a90('0x37')],{'$or':_['map'](_0x1add9a,function(_0x57a2a5){if(_0x57a2a5[_0x2a90('0x2a')]!==_0x2a90('0x3a')){var _0x4eb7d9={};_0x4eb7d9[_0x57a2a5[_0x2a90('0x2d')]]={'$like':'%'+_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x3b')]+'%'};return _0x4eb7d9;}})});}_0x3c78f5=_['merge']({},_0x3c78f5,_0x4969c3[_0x2a90('0x3c')]);var _0x1db9d8={'where':_0x3c78f5['where']};return db[_0x2a90('0x27')][_0x2a90('0x3d')](_0x1db9d8)[_0x2a90('0x23')](function(_0x28f289){_0x5bd700[_0x2a90('0x3d')]=_0x28f289;if(_0x4969c3[_0x2a90('0x2e')][_0x2a90('0x3e')]){_0x3c78f5[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x27')][_0x2a90('0x40')](_0x3c78f5);})[_0x2a90('0x23')](function(_0x3dba8a){_0x5bd700[_0x2a90('0x41')]=_0x3dba8a;return _0x5bd700;})[_0x2a90('0x23')](respondWithFilteredResult(_0x2d83b3,_0x3c78f5))['catch'](handleError(_0x2d83b3,null));};exports[_0x2a90('0x42')]=function(_0x3a70fe,_0x528b41){var _0x1045bb={'raw':![],'where':{'id':_0x3a70fe[_0x2a90('0x43')]['id']}},_0x1e971c={};_0x1e971c[_0x2a90('0x2c')]=_[_0x2a90('0x2f')](db['ZendeskAccount'][_0x2a90('0x28')]);_0x1e971c['query']=_[_0x2a90('0x2f')](_0x3a70fe['query']);_0x1e971c[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0x1e971c[_0x2a90('0x2c')],_0x1e971c[_0x2a90('0x2e')]);_0x1045bb[_0x2a90('0x33')]=_[_0x2a90('0x31')](_0x1e971c[_0x2a90('0x2c')],qs['fields'](_0x3a70fe['query'][_0x2a90('0x32')]));_0x1045bb[_0x2a90('0x33')]=_0x1045bb[_0x2a90('0x33')][_0x2a90('0x34')]?_0x1045bb[_0x2a90('0x33')]:_0x1e971c[_0x2a90('0x2c')];if(_0x3a70fe[_0x2a90('0x2e')][_0x2a90('0x3e')]){_0x1045bb['include']=[{'all':!![]}];}_0x1045bb=_[_0x2a90('0x39')]({},_0x1045bb,_0x3a70fe['options']);return db[_0x2a90('0x27')][_0x2a90('0x44')](_0x1045bb)['then'](handleEntityNotFound(_0x528b41,null))[_0x2a90('0x23')](respondWithResult(_0x528b41,null))[_0x2a90('0x45')](handleError(_0x528b41,null));};exports[_0x2a90('0x46')]=function(_0x1d55db,_0x175d59){return db[_0x2a90('0x27')][_0x2a90('0x46')](_0x1d55db['body'],{})['then'](respondWithResult(_0x175d59,0xc9))[_0x2a90('0x45')](handleError(_0x175d59,null));};exports[_0x2a90('0x21')]=function(_0x42c890,_0x43266a){if(_0x42c890[_0x2a90('0x47')]['id']){delete _0x42c890['body']['id'];}return db['ZendeskAccount'][_0x2a90('0x44')]({'where':{'id':_0x42c890[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x43266a,null))['then'](saveUpdates(_0x42c890['body'],null))[_0x2a90('0x23')](respondWithResult(_0x43266a,null))['catch'](handleError(_0x43266a,null));};exports[_0x2a90('0x22')]=function(_0x3dfe72,_0x272d07){return db[_0x2a90('0x27')][_0x2a90('0x44')]({'where':{'id':_0x3dfe72[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x272d07,null))[_0x2a90('0x23')](removeEntity(_0x272d07,null))[_0x2a90('0x45')](handleError(_0x272d07,null));};exports['getConfigurations']=function(_0x265769,_0x4d1303,_0x4c8bae){var _0x46f687={};var _0xe47c6b={};var _0x5819ab;var _0x4c0cb2;return db[_0x2a90('0x27')]['findOne']({'where':{'id':_0x265769[_0x2a90('0x43')]['id']}})[_0x2a90('0x23')](handleEntityNotFound(_0x4d1303,null))['then'](function(_0x366429){if(_0x366429){_0x5819ab=_0x366429;_0xe47c6b[_0x2a90('0x2c')]=_[_0x2a90('0x2f')](db['ZendeskConfiguration'][_0x2a90('0x28')]);_0xe47c6b[_0x2a90('0x2e')]=_['keys'](_0x265769['query']);_0xe47c6b[_0x2a90('0x30')]=_[_0x2a90('0x31')](_0xe47c6b['model'],_0xe47c6b[_0x2a90('0x2e')]);_0x46f687['attributes']=_[_0x2a90('0x31')](_0xe47c6b['model'],qs[_0x2a90('0x32')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x32')]));_0x46f687['attributes']=_0x46f687['attributes']['length']?_0x46f687[_0x2a90('0x33')]:_0xe47c6b[_0x2a90('0x2c')];_0x46f687[_0x2a90('0x36')]=qs[_0x2a90('0x48')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x48')]);_0x46f687[_0x2a90('0x37')]=qs[_0x2a90('0x30')](_[_0x2a90('0x38')](_0x265769[_0x2a90('0x2e')],_0xe47c6b[_0x2a90('0x30')]));if(_0x265769[_0x2a90('0x2e')][_0x2a90('0x3b')]){_0x46f687['where']=_['merge'](_0x46f687['where'],{'$or':_[_0x2a90('0x49')](_0x46f687[_0x2a90('0x33')],function(_0x13270d){var _0x400aca={};_0x400aca[_0x13270d]={'$like':'%'+_0x265769[_0x2a90('0x2e')][_0x2a90('0x3b')]+'%'};return _0x400aca;})});}_0x46f687=_[_0x2a90('0x39')]({},_0x46f687,_0x265769[_0x2a90('0x3c')]);return _0x5819ab[_0x2a90('0x4a')](_0x46f687);}})[_0x2a90('0x23')](function(_0x50973b){if(_0x50973b){_0x4c0cb2=_0x50973b[_0x2a90('0x34')];if(!_0x265769[_0x2a90('0x2e')][_0x2a90('0x4b')](_0x2a90('0x35'))){_0x46f687[_0x2a90('0x1b')]=qs['limit'](_0x265769[_0x2a90('0x2e')]['limit']);_0x46f687[_0x2a90('0x19')]=qs[_0x2a90('0x19')](_0x265769[_0x2a90('0x2e')][_0x2a90('0x19')]);}return _0x5819ab[_0x2a90('0x4a')](_0x46f687);}})[_0x2a90('0x23')](function(_0x44b211){if(_0x44b211){return _0x44b211?{'count':_0x4c0cb2,'rows':_0x44b211}:null;}})['then'](respondWithResult(_0x4d1303,null))[_0x2a90('0x45')](handleError(_0x4d1303,null));};exports[_0x2a90('0x4c')]=function(_0xf88bbb,_0x48f9fa,_0xa1234a){if(_0xf88bbb[_0x2a90('0x47')]['id']){delete _0xf88bbb[_0x2a90('0x47')]['id'];}return db[_0x2a90('0x27')]['findOne']({'where':{'id':_0xf88bbb[_0x2a90('0x43')]['id']}})['then'](handleEntityNotFound(_0x48f9fa,null))[_0x2a90('0x23')](function(_0x94e9fb){if(_0x94e9fb){_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4d')]=_0x94e9fb['id'];_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4e')]=integrations['getSubjects'](_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4f')],_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x2a')]);_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x50')]=integrations[_0x2a90('0x51')](_0xf88bbb[_0x2a90('0x47')][_0x2a90('0x4f')],_0xf88bbb['body'][_0x2a90('0x2a')]);return db[_0x2a90('0x52')][_0x2a90('0x46')](_0xf88bbb['body'],{'include':[{'model':db[_0x2a90('0x53')],'as':_0x2a90('0x4e')},{'model':db[_0x2a90('0x53')],'as':_0x2a90('0x50')}]});}return null;})[_0x2a90('0x23')](respondWithResult(_0x48f9fa,null))['catch'](handleError(_0x48f9fa,null));};exports[_0x2a90('0x54')]=function(_0x5e0bf2,_0x5a770b,_0x9fafd){var _0x4e1dcd='';return db['ZendeskAccount'][_0x2a90('0x55')]({'where':{'id':_0x5e0bf2['params']['id']},'attributes':['id',_0x2a90('0x56'),_0x2a90('0x57'),'token','authType',_0x2a90('0x58')]})['then'](handleEntityNotFound(_0x5a770b,null))['then'](function(_0xd52ae2){if(_0xd52ae2){_0x4e1dcd=_0xd52ae2[_0x2a90('0x58')];var _0x1db063=_0x4e1dcd[_0x2a90('0x59')](-0x1);if(_0x1db063==='/'){_0x4e1dcd=_0x4e1dcd['substring'](0x0,_0x4e1dcd['lastIndexOf'](_0x1db063));}var _0x370144={'method':_0x2a90('0x5a'),'uri':util[_0x2a90('0x5b')](_0x2a90('0x5c'),_0x4e1dcd,_0x2a90('0x5d')),'json':!![]};switch(_0xd52ae2[_0x2a90('0x5e')]){case _0x2a90('0x57'):_0x370144[_0x2a90('0x5f')]={'Authorization':util[_0x2a90('0x5b')](_0x2a90('0x60'),new Buffer(util[_0x2a90('0x5b')](_0x2a90('0x61'),_0xd52ae2['username'],_0xd52ae2[_0x2a90('0x57')]))['toString'](_0x2a90('0x62')))};break;case'token':_0x370144[_0x2a90('0x5f')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x2a90('0x5b')](_0x2a90('0x63'),_0xd52ae2[_0x2a90('0x56')],_0xd52ae2[_0x2a90('0x64')]))['toString']('base64'))};break;default:throw new db[(_0x2a90('0x65'))][(_0x2a90('0x66'))](_0x2a90('0x67'));}return rp(_0x370144);}})[_0x2a90('0x23')](function(_0x59b9e6){if(_0x59b9e6){var _0x3b0d5e=[_0x2a90('0x68'),_0x2a90('0x69'),_0x2a90('0x6a'),_0x2a90('0x6b')];_[_0x2a90('0x6c')](_0x59b9e6[_0x2a90('0x5d')],function(_0x4d46f5){return _0x3b0d5e[_0x2a90('0x6d')](_0x4d46f5[_0x2a90('0x2a')]);});return{'count':_0x59b9e6[_0x2a90('0x5d')][_0x2a90('0x34')],'rows':_[_0x2a90('0x49')](_0x59b9e6[_0x2a90('0x5d')],function(_0x1bbadd){return{'id':_0x1bbadd['id'],'name':_0x1bbadd[_0x2a90('0x6e')]>0x7?_0x1bbadd['title']:_0x1bbadd[_0x2a90('0x2a')],'custom':_0x1bbadd[_0x2a90('0x6e')]>0x7?!![]:![],'options':_0x1bbadd['system_field_options']?_0x1bbadd[_0x2a90('0x6f')]:_0x1bbadd[_0x2a90('0x70')]?_0x1bbadd[_0x2a90('0x70')]:[]};})};}})[_0x2a90('0x23')](respondWithResult(_0x5a770b,null))[_0x2a90('0x45')](function(_0x16e9e7){var _0x4b4a47=_0x5e0bf2[_0x2a90('0x2e')][_0x2a90('0x71')]?0x1f4:_0x16e9e7[_0x2a90('0x72')]||0x1f4;logger[_0x2a90('0x25')](_0x2a90('0x73'),_0x2a90('0x54'),_0x4b4a47,JSON[_0x2a90('0x74')](_0x16e9e7));delete _0x16e9e7[_0x2a90('0x2d')];if(_0x4b4a47===0x191){_0x4b4a47=0x190;}_0x5a770b['status'](_0x4b4a47)[_0x2a90('0x75')](_0x5e0bf2[_0x2a90('0x2e')][_0x2a90('0x71')]?{'message':_0x2a90('0x76'),'statusCode':_0x16e9e7[_0x2a90('0x72')]}:_0x16e9e7);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e7910b1..d7ce3dc 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 _0x38d4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','int_zendesk_accounts','lodash','util'];(function(_0x59ed7b,_0x47eb63){var _0x1ada9a=function(_0x377af3){while(--_0x377af3){_0x59ed7b['push'](_0x59ed7b['shift']());}};_0x1ada9a(++_0x47eb63);}(_0x38d4,0x178));var _0x438d=function(_0x245006,_0x332c26){_0x245006=_0x245006-0x0;var _0x278334=_0x38d4[_0x245006];return _0x278334;};'use strict';var _=require(_0x438d('0x0'));var util=require(_0x438d('0x1'));var logger=require(_0x438d('0x2'))(_0x438d('0x3'));var moment=require(_0x438d('0x4'));var BPromise=require(_0x438d('0x5'));var rp=require(_0x438d('0x6'));var fs=require('fs');var path=require(_0x438d('0x7'));var rimraf=require(_0x438d('0x8'));var config=require(_0x438d('0x9'));var attributes=require(_0x438d('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x438d('0xb')]=function(_0x2eedc7,_0x385bda){return _0x2eedc7[_0x438d('0xc')]('ZendeskAccount',attributes,{'tableName':_0x438d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe39=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','lodash'];(function(_0x2e260a,_0x7dc012){var _0x1edb06=function(_0x4be59f){while(--_0x4be59f){_0x2e260a['push'](_0x2e260a['shift']());}};_0x1edb06(++_0x7dc012);}(_0xfe39,0xa7));var _0x9fe3=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xfe39[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x9fe3('0x0'));var util=require(_0x9fe3('0x1'));var logger=require(_0x9fe3('0x2'))(_0x9fe3('0x3'));var moment=require(_0x9fe3('0x4'));var BPromise=require('bluebird');var rp=require(_0x9fe3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fe3('0x6'));var config=require(_0x9fe3('0x7'));var attributes=require(_0x9fe3('0x8'));var integrations=require(_0x9fe3('0x9'));module[_0x9fe3('0xa')]=function(_0x1c5618,_0x41fb1e){return _0x1c5618['define'](_0x9fe3('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index b50aee1..f1eca6f 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 _0xca66=['map','model','catch','ShowZendeskAccount','ZendeskAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','info','result','GetZendeskAccount','options','raw','where','attributes','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca66,0x141));var _0x6ca6=function(_0x288064,_0x3ba1f8){_0x288064=_0x288064-0x0;var _0x1581fa=_0xca66[_0x288064];return _0x1581fa;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require(_0x6ca6('0x1'));var BPromise=require(_0x6ca6('0x2'));var rs=require(_0x6ca6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ca6('0x4'))['db'];var utils=require(_0x6ca6('0x5'));var logger=require(_0x6ca6('0x6'))(_0x6ca6('0x7'));var config=require(_0x6ca6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6ca6('0x9')][_0x6ca6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e8e30,_0x312580,_0x981bb7){return new BPromise(function(_0x435572,_0x2640b2){return client[_0x6ca6('0xb')](_0x1e8e30,_0x981bb7)[_0x6ca6('0xc')](function(_0x303df6){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x312580,_0x6ca6('0xd'));logger[_0x6ca6('0xe')](_0x6ca6('0xf'),_0x312580,_0x6ca6('0xd'),JSON[_0x6ca6('0x10')](_0x303df6));if(_0x303df6['error']){if(_0x303df6[_0x6ca6('0x11')][_0x6ca6('0x12')]===0x1f4){logger[_0x6ca6('0x11')](_0x6ca6('0x13'),_0x312580,_0x303df6[_0x6ca6('0x11')][_0x6ca6('0x14')]);return _0x2640b2(_0x303df6[_0x6ca6('0x11')][_0x6ca6('0x14')]);}logger['error'](_0x6ca6('0x13'),_0x312580,_0x303df6[_0x6ca6('0x11')]['message']);return _0x435572(_0x303df6[_0x6ca6('0x11')][_0x6ca6('0x14')]);}else{logger[_0x6ca6('0x15')](_0x6ca6('0x13'),_0x312580,_0x6ca6('0xd'));_0x435572(_0x303df6[_0x6ca6('0x16')][_0x6ca6('0x14')]);}})['catch'](function(_0x5200e5){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x312580,_0x5200e5);_0x2640b2(_0x5200e5);});});}exports[_0x6ca6('0x17')]=function(_0x30ebf2){var _0x27be27=this;return new Promise(function(_0x18547d,_0x76c5fc){return db['ZendeskAccount']['findAll']({'raw':_0x30ebf2[_0x6ca6('0x18')]?_0x30ebf2[_0x6ca6('0x18')][_0x6ca6('0x19')]===undefined?!![]:![]:!![],'where':_0x30ebf2['options']?_0x30ebf2['options'][_0x6ca6('0x1a')]||null:null,'attributes':_0x30ebf2[_0x6ca6('0x18')]?_0x30ebf2[_0x6ca6('0x18')][_0x6ca6('0x1b')]||null:null,'limit':_0x30ebf2[_0x6ca6('0x18')]?_0x30ebf2[_0x6ca6('0x18')]['limit']||null:null,'include':_0x30ebf2[_0x6ca6('0x18')]?_0x30ebf2['options'][_0x6ca6('0x1c')]?_[_0x6ca6('0x1d')](_0x30ebf2[_0x6ca6('0x18')][_0x6ca6('0x1c')],function(_0x51ddf5){return{'model':db[_0x51ddf5[_0x6ca6('0x1e')]],'as':_0x51ddf5['as'],'attributes':_0x51ddf5[_0x6ca6('0x1b')],'include':_0x51ddf5['include']?_[_0x6ca6('0x1d')](_0x51ddf5[_0x6ca6('0x1c')],function(_0x3b7d39){return{'model':db[_0x3b7d39[_0x6ca6('0x1e')]],'as':_0x3b7d39['as'],'attributes':_0x3b7d39[_0x6ca6('0x1b')],'include':_0x3b7d39[_0x6ca6('0x1c')]?_['map'](_0x3b7d39[_0x6ca6('0x1c')],function(_0x1aab37){return{'model':db[_0x1aab37[_0x6ca6('0x1e')]],'as':_0x1aab37['as'],'attributes':_0x1aab37[_0x6ca6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ca6('0xc')](function(_0x123d1f){logger[_0x6ca6('0x15')](_0x6ca6('0x17'),_0x30ebf2);logger[_0x6ca6('0xe')](_0x6ca6('0x17'),_0x30ebf2,JSON[_0x6ca6('0x10')](_0x123d1f));_0x18547d(_0x123d1f);})[_0x6ca6('0x1f')](function(_0x1d7705){logger[_0x6ca6('0x11')](_0x6ca6('0x17'),_0x1d7705[_0x6ca6('0x14')],_0x30ebf2);_0x76c5fc(_0x27be27[_0x6ca6('0x11')](0x1f4,_0x1d7705[_0x6ca6('0x14')]));});});};exports[_0x6ca6('0x20')]=function(_0x268112){var _0x49d8b2=this;return new Promise(function(_0x28f7cd,_0x11227c){return db[_0x6ca6('0x21')][_0x6ca6('0x22')]({'raw':_0x268112[_0x6ca6('0x18')]?_0x268112[_0x6ca6('0x18')][_0x6ca6('0x19')]===undefined?!![]:![]:!![],'where':_0x268112[_0x6ca6('0x18')]?_0x268112[_0x6ca6('0x18')]['where']||null:null,'attributes':_0x268112[_0x6ca6('0x18')]?_0x268112[_0x6ca6('0x18')][_0x6ca6('0x1b')]||null:null,'include':_0x268112[_0x6ca6('0x18')]?_0x268112[_0x6ca6('0x18')][_0x6ca6('0x1c')]?_[_0x6ca6('0x1d')](_0x268112[_0x6ca6('0x18')][_0x6ca6('0x1c')],function(_0x14ed22){return{'model':db[_0x14ed22[_0x6ca6('0x1e')]],'as':_0x14ed22['as'],'attributes':_0x14ed22['attributes'],'include':_0x14ed22[_0x6ca6('0x1c')]?_[_0x6ca6('0x1d')](_0x14ed22[_0x6ca6('0x1c')],function(_0xe0081f){return{'model':db[_0xe0081f[_0x6ca6('0x1e')]],'as':_0xe0081f['as'],'attributes':_0xe0081f['attributes'],'include':_0xe0081f[_0x6ca6('0x1c')]?_[_0x6ca6('0x1d')](_0xe0081f['include'],function(_0x1e764c){return{'model':db[_0x1e764c['model']],'as':_0x1e764c['as'],'attributes':_0x1e764c[_0x6ca6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ca6('0xc')](function(_0x3501c5){logger[_0x6ca6('0x15')](_0x6ca6('0x20'),_0x268112);logger[_0x6ca6('0xe')]('ShowZendeskAccount',_0x268112,JSON['stringify'](_0x3501c5));_0x28f7cd(_0x3501c5);})['catch'](function(_0x48f348){logger[_0x6ca6('0x11')](_0x6ca6('0x20'),_0x48f348[_0x6ca6('0x14')],_0x268112);_0x11227c(_0x49d8b2[_0x6ca6('0x11')](0x1f4,_0x48f348['message']));});});}; \ No newline at end of file +var _0xd7c0=['debug','find','ShowZendeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x391802,_0xde0fd){var _0x3aa73b=function(_0x31d199){while(--_0x31d199){_0x391802['push'](_0x391802['shift']());}};_0x3aa73b(++_0xde0fd);}(_0xd7c0,0x13e));var _0x0d7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd7c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d7c('0x0'));var util=require(_0x0d7c('0x1'));var moment=require(_0x0d7c('0x2'));var BPromise=require(_0x0d7c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d7c('0x4'))['db'];var utils=require(_0x0d7c('0x5'));var logger=require(_0x0d7c('0x6'))('rpc');var config=require(_0x0d7c('0x7'));var jayson=require(_0x0d7c('0x8'));var client=jayson[_0x0d7c('0x9')][_0x0d7c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x405e31,_0x1d0a49,_0x17e42d){return new BPromise(function(_0x17b7a9,_0x57a0ae){return client[_0x0d7c('0xb')](_0x405e31,_0x17e42d)['then'](function(_0x5a9cfe){logger[_0x0d7c('0xc')](_0x0d7c('0xd'),_0x1d0a49,'request\x20sent');logger['debug'](_0x0d7c('0xe'),_0x1d0a49,_0x0d7c('0xf'),JSON[_0x0d7c('0x10')](_0x5a9cfe));if(_0x5a9cfe[_0x0d7c('0x11')]){if(_0x5a9cfe['error']['code']===0x1f4){logger['error'](_0x0d7c('0xd'),_0x1d0a49,_0x5a9cfe['error']['message']);return _0x57a0ae(_0x5a9cfe[_0x0d7c('0x11')]['message']);}logger[_0x0d7c('0x11')](_0x0d7c('0xd'),_0x1d0a49,_0x5a9cfe[_0x0d7c('0x11')][_0x0d7c('0x12')]);return _0x17b7a9(_0x5a9cfe['error'][_0x0d7c('0x12')]);}else{logger[_0x0d7c('0xc')](_0x0d7c('0xd'),_0x1d0a49,'request\x20sent');_0x17b7a9(_0x5a9cfe[_0x0d7c('0x13')]['message']);}})[_0x0d7c('0x14')](function(_0x55c983){logger['error'](_0x0d7c('0xd'),_0x1d0a49,_0x55c983);_0x57a0ae(_0x55c983);});});}exports[_0x0d7c('0x15')]=function(_0x445843){var _0x36f070=this;return new Promise(function(_0x502e89,_0x19fc50){return db[_0x0d7c('0x16')]['findAll']({'raw':_0x445843[_0x0d7c('0x17')]?_0x445843[_0x0d7c('0x17')][_0x0d7c('0x18')]===undefined?!![]:![]:!![],'where':_0x445843[_0x0d7c('0x17')]?_0x445843[_0x0d7c('0x17')][_0x0d7c('0x19')]||null:null,'attributes':_0x445843['options']?_0x445843[_0x0d7c('0x17')][_0x0d7c('0x1a')]||null:null,'limit':_0x445843[_0x0d7c('0x17')]?_0x445843['options'][_0x0d7c('0x1b')]||null:null,'include':_0x445843[_0x0d7c('0x17')]?_0x445843['options'][_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x445843['options'][_0x0d7c('0x1c')],function(_0x1bb903){return{'model':db[_0x1bb903[_0x0d7c('0x1e')]],'as':_0x1bb903['as'],'attributes':_0x1bb903[_0x0d7c('0x1a')],'include':_0x1bb903[_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x1bb903[_0x0d7c('0x1c')],function(_0x40ccd8){return{'model':db[_0x40ccd8[_0x0d7c('0x1e')]],'as':_0x40ccd8['as'],'attributes':_0x40ccd8['attributes'],'include':_0x40ccd8[_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x40ccd8[_0x0d7c('0x1c')],function(_0x558951){return{'model':db[_0x558951[_0x0d7c('0x1e')]],'as':_0x558951['as'],'attributes':_0x558951['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d7c('0x1f')](function(_0x2898e1){logger[_0x0d7c('0xc')]('GetZendeskAccount',_0x445843);logger[_0x0d7c('0x20')](_0x0d7c('0x15'),_0x445843,JSON['stringify'](_0x2898e1));_0x502e89(_0x2898e1);})['catch'](function(_0x301d65){logger[_0x0d7c('0x11')](_0x0d7c('0x15'),_0x301d65[_0x0d7c('0x12')],_0x445843);_0x19fc50(_0x36f070[_0x0d7c('0x11')](0x1f4,_0x301d65['message']));});});};exports['ShowZendeskAccount']=function(_0x399fe3){var _0x73bd6d=this;return new Promise(function(_0x33ddbd,_0x32ae2e){return db[_0x0d7c('0x16')][_0x0d7c('0x21')]({'raw':_0x399fe3['options']?_0x399fe3['options']['raw']===undefined?!![]:![]:!![],'where':_0x399fe3[_0x0d7c('0x17')]?_0x399fe3['options'][_0x0d7c('0x19')]||null:null,'attributes':_0x399fe3['options']?_0x399fe3[_0x0d7c('0x17')][_0x0d7c('0x1a')]||null:null,'include':_0x399fe3[_0x0d7c('0x17')]?_0x399fe3[_0x0d7c('0x17')][_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x399fe3[_0x0d7c('0x17')][_0x0d7c('0x1c')],function(_0x1cc2f9){return{'model':db[_0x1cc2f9['model']],'as':_0x1cc2f9['as'],'attributes':_0x1cc2f9[_0x0d7c('0x1a')],'include':_0x1cc2f9[_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x1cc2f9[_0x0d7c('0x1c')],function(_0x395e1f){return{'model':db[_0x395e1f['model']],'as':_0x395e1f['as'],'attributes':_0x395e1f[_0x0d7c('0x1a')],'include':_0x395e1f[_0x0d7c('0x1c')]?_[_0x0d7c('0x1d')](_0x395e1f['include'],function(_0x327797){return{'model':db[_0x327797[_0x0d7c('0x1e')]],'as':_0x327797['as'],'attributes':_0x327797[_0x0d7c('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x140544){logger[_0x0d7c('0xc')]('ShowZendeskAccount',_0x399fe3);logger[_0x0d7c('0x20')]('ShowZendeskAccount',_0x399fe3,JSON[_0x0d7c('0x10')](_0x140544));_0x33ddbd(_0x140544);})[_0x0d7c('0x14')](function(_0x1a9214){logger['error'](_0x0d7c('0x22'),_0x1a9214[_0x0d7c('0x12')],_0x399fe3);_0x32ae2e(_0x73bd6d[_0x0d7c('0x11')](0x1f4,_0x1a9214[_0x0d7c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 0b3b43f..d5463d3 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(_0x2fb8b2,_0x515c57){var _0xd412b1=function(_0x3b51ea){while(--_0x3b51ea){_0x2fb8b2['push'](_0x2fb8b2['shift']());}};_0xd412b1(++_0x515c57);}(_0x757a,0xde));var _0xa757=function(_0x26aaa9,_0x5df5c7){_0x26aaa9=_0x26aaa9-0x0;var _0x195fed=_0x757a[_0x26aaa9];return _0x195fed;};'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 _0x4024=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x4024,0x89));var _0x4402=function(_0x37e2a6,_0xc52f3d){_0x37e2a6=_0x37e2a6-0x0;var _0x3c4754=_0x4024[_0x37e2a6];return _0x3c4754;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x4402('0x9')]('/:id/subjects',auth[_0x4402('0x7')](),controller['getSubjects']);router[_0x4402('0x9')]('/:id/descriptions',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['get'](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0xd')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xf')](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0x10')]);router[_0x4402('0x11')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x15')]);module[_0x4402('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 07886cc..0278583 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 _0xeb82=['STRING','sequelize','exports'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0xeb82,0xa3));var _0x2eb8=function(_0x377545,_0x2b2cdc){_0x377545=_0x377545-0x0;var _0x3558cc=_0xeb82[_0x377545];return _0x3558cc;};'use strict';var Sequelize=require(_0x2eb8('0x0'));module[_0x2eb8('0x1')]={'name':{'type':Sequelize[_0x2eb8('0x2')]},'description':{'type':Sequelize[_0x2eb8('0x2')]}}; \ No newline at end of file +var _0x4319=['exports','STRING','sequelize'];(function(_0x2cd678,_0x43ec9e){var _0x2cf8fe=function(_0x416519){while(--_0x416519){_0x2cd678['push'](_0x2cd678['shift']());}};_0x2cf8fe(++_0x43ec9e);}(_0x4319,0x113));var _0x9431=function(_0x2726ad,_0x5073b1){_0x2726ad=_0x2726ad-0x0;var _0xd87993=_0x4319[_0x2726ad];return _0xd87993;};'use strict';var Sequelize=require(_0x9431('0x0'));module[_0x9431('0x1')]={'name':{'type':Sequelize[_0x9431('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index cc332f5..40719b8 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 _0x3344=['type','filter','ZendeskConfiguration','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','getDescriptions','Tag','getTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge'];(function(_0x1555fd,_0x4bfe1e){var _0x5069de=function(_0x42012c){while(--_0x42012c){_0x1555fd['push'](_0x1555fd['shift']());}};_0x5069de(++_0x4bfe1e);}(_0x3344,0x68));var _0x4334=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3344[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4334('0x0'));var zipdir=require(_0x4334('0x1'));var jsonpatch=require(_0x4334('0x2'));var rp=require('request-promise');var moment=require(_0x4334('0x3'));var BPromise=require(_0x4334('0x4'));var Mustache=require(_0x4334('0x5'));var util=require(_0x4334('0x6'));var path=require(_0x4334('0x7'));var sox=require(_0x4334('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4334('0x9'));var squel=require(_0x4334('0xa'));var crypto=require(_0x4334('0xb'));var jsforce=require(_0x4334('0xc'));var deskjs=require(_0x4334('0xd'));var toCsv=require(_0x4334('0xe'));var querystring=require(_0x4334('0xf'));var Papa=require(_0x4334('0x10'));var Redis=require(_0x4334('0x11'));var authService=require(_0x4334('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4334('0x13'));var hardwareService=require(_0x4334('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4334('0x15'));var config=require(_0x4334('0x16'));var licenseUtil=require(_0x4334('0x17'));var db=require(_0x4334('0x18'))['db'];function respondWithStatusCode(_0x4c7c4e,_0xcda6f7){_0xcda6f7=_0xcda6f7||0xcc;return function(_0x2d5f6a){if(_0x2d5f6a){return _0x4c7c4e[_0x4334('0x19')](_0xcda6f7);}return _0x4c7c4e[_0x4334('0x1a')](_0xcda6f7)[_0x4334('0x1b')]();};}function respondWithResult(_0x4870d1,_0x1a7ab3){_0x1a7ab3=_0x1a7ab3||0xc8;return function(_0x5dde5d){if(_0x5dde5d){return _0x4870d1[_0x4334('0x1a')](_0x1a7ab3)[_0x4334('0x1c')](_0x5dde5d);}};}function respondWithFilteredResult(_0x16d07b,_0x13dc9f){return function(_0x5c3097){if(_0x5c3097){var _0x20f527=typeof _0x13dc9f[_0x4334('0x1d')]==='undefined'&&typeof _0x13dc9f[_0x4334('0x1e')]===_0x4334('0x1f');var _0x5b9229=_0x5c3097[_0x4334('0x20')];var _0x5716b7=_0x20f527?0x0:_0x13dc9f[_0x4334('0x1d')];var _0x5bf56c=_0x20f527?_0x5c3097['count']:_0x13dc9f['offset']+_0x13dc9f[_0x4334('0x1e')];var _0x16bdd9;if(_0x5bf56c>=_0x5b9229){_0x5bf56c=_0x5b9229;_0x16bdd9=0xc8;}else{_0x16bdd9=0xce;}_0x16d07b[_0x4334('0x1a')](_0x16bdd9);return _0x16d07b[_0x4334('0x21')](_0x4334('0x22'),_0x5716b7+'-'+_0x5bf56c+'/'+_0x5b9229)['json'](_0x5c3097);}return null;};}function patchUpdates(_0x2fc523){return function(_0x5eefa3){try{jsonpatch[_0x4334('0x23')](_0x5eefa3,_0x2fc523,!![]);}catch(_0xd086c9){return BPromise['reject'](_0xd086c9);}return _0x5eefa3['save']();};}function saveUpdates(_0x1a784d,_0x5dc7cc){return function(_0x62edf1){if(_0x62edf1){return _0x62edf1[_0x4334('0x24')](_0x1a784d)[_0x4334('0x25')](function(_0x1f241a){return _0x1f241a;});}return null;};}function removeEntity(_0x474a4d,_0x40320d){return function(_0x1c3006){if(_0x1c3006){return _0x1c3006['destroy']()[_0x4334('0x25')](function(){_0x474a4d[_0x4334('0x1a')](0xcc)[_0x4334('0x1b')]();});}};}function handleEntityNotFound(_0x451c8c,_0x2dbfce){return function(_0x2f3c8c){if(!_0x2f3c8c){_0x451c8c[_0x4334('0x19')](0x194);}return _0x2f3c8c;};}function handleError(_0xceca80,_0x5e4b3b){_0x5e4b3b=_0x5e4b3b||0x1f4;return function(_0xc9ff23){logger['error'](_0xc9ff23[_0x4334('0x26')]);if(_0xc9ff23[_0x4334('0x27')]){delete _0xc9ff23['name'];}_0xceca80[_0x4334('0x1a')](_0x5e4b3b)[_0x4334('0x28')](_0xc9ff23);};}exports['index']=function(_0x3e30bd,_0x546468){var _0x4e8d72={},_0x29453b={},_0x838fe7={'count':0x0,'rows':[]};var _0x513b1c=_['map'](db['ZendeskConfiguration'][_0x4334('0x29')],function(_0x25ff7f){return{'name':_0x25ff7f[_0x4334('0x2a')],'type':_0x25ff7f['type'][_0x4334('0x2b')]};});_0x29453b[_0x4334('0x2c')]=_[_0x4334('0x2d')](_0x513b1c,_0x4334('0x27'));_0x29453b[_0x4334('0x2e')]=_[_0x4334('0x2f')](_0x3e30bd['query']);_0x29453b['filters']=_['intersection'](_0x29453b[_0x4334('0x2c')],_0x29453b['query']);_0x4e8d72['attributes']=_[_0x4334('0x30')](_0x29453b['model'],qs[_0x4334('0x31')](_0x3e30bd[_0x4334('0x2e')][_0x4334('0x31')]));_0x4e8d72['attributes']=_0x4e8d72[_0x4334('0x32')][_0x4334('0x33')]?_0x4e8d72['attributes']:_0x29453b[_0x4334('0x2c')];if(!_0x3e30bd[_0x4334('0x2e')][_0x4334('0x34')](_0x4334('0x35'))){_0x4e8d72[_0x4334('0x1e')]=qs[_0x4334('0x1e')](_0x3e30bd[_0x4334('0x2e')][_0x4334('0x1e')]);_0x4e8d72[_0x4334('0x1d')]=qs[_0x4334('0x1d')](_0x3e30bd[_0x4334('0x2e')]['offset']);}_0x4e8d72[_0x4334('0x36')]=qs[_0x4334('0x37')](_0x3e30bd[_0x4334('0x2e')][_0x4334('0x37')]);_0x4e8d72[_0x4334('0x38')]=qs[_0x4334('0x39')](_[_0x4334('0x3a')](_0x3e30bd['query'],_0x29453b['filters']),_0x513b1c);if(_0x3e30bd[_0x4334('0x2e')]['filter']){_0x4e8d72[_0x4334('0x38')]=_[_0x4334('0x3b')](_0x4e8d72[_0x4334('0x38')],{'$or':_['map'](_0x513b1c,function(_0x4d1a14){if(_0x4d1a14[_0x4334('0x3c')]!=='VIRTUAL'){var _0x41a3a8={};_0x41a3a8[_0x4d1a14['name']]={'$like':'%'+_0x3e30bd[_0x4334('0x2e')][_0x4334('0x3d')]+'%'};return _0x41a3a8;}})});}_0x4e8d72=_[_0x4334('0x3b')]({},_0x4e8d72,_0x3e30bd['options']);var _0x399b46={'where':_0x4e8d72[_0x4334('0x38')]};return db[_0x4334('0x3e')][_0x4334('0x20')](_0x399b46)[_0x4334('0x25')](function(_0x24d229){_0x838fe7[_0x4334('0x20')]=_0x24d229;if(_0x3e30bd[_0x4334('0x2e')]['includeAll']){_0x4e8d72[_0x4334('0x3f')]=[{'all':!![]}];}return db[_0x4334('0x3e')][_0x4334('0x40')](_0x4e8d72);})['then'](function(_0x107c26){_0x838fe7[_0x4334('0x41')]=_0x107c26;return _0x838fe7;})['then'](respondWithFilteredResult(_0x546468,_0x4e8d72))[_0x4334('0x42')](handleError(_0x546468,null));};exports[_0x4334('0x43')]=function(_0x48bdcd,_0x42fc46){var _0x265cde={'raw':![],'where':{'id':_0x48bdcd[_0x4334('0x44')]['id']}},_0xc10a3c={};_0xc10a3c[_0x4334('0x2c')]=_[_0x4334('0x2f')](db['ZendeskConfiguration'][_0x4334('0x29')]);_0xc10a3c[_0x4334('0x2e')]=_[_0x4334('0x2f')](_0x48bdcd[_0x4334('0x2e')]);_0xc10a3c[_0x4334('0x39')]=_[_0x4334('0x30')](_0xc10a3c[_0x4334('0x2c')],_0xc10a3c[_0x4334('0x2e')]);_0x265cde['attributes']=_[_0x4334('0x30')](_0xc10a3c[_0x4334('0x2c')],qs[_0x4334('0x31')](_0x48bdcd['query'][_0x4334('0x31')]));_0x265cde[_0x4334('0x32')]=_0x265cde[_0x4334('0x32')][_0x4334('0x33')]?_0x265cde['attributes']:_0xc10a3c['model'];if(_0x48bdcd[_0x4334('0x2e')]['includeAll']){_0x265cde[_0x4334('0x3f')]=[{'all':!![]}];}_0x265cde=_[_0x4334('0x3b')]({},_0x265cde,_0x48bdcd[_0x4334('0x45')]);return db[_0x4334('0x3e')][_0x4334('0x46')](_0x265cde)[_0x4334('0x25')](handleEntityNotFound(_0x42fc46,null))[_0x4334('0x25')](respondWithResult(_0x42fc46,null))[_0x4334('0x42')](handleError(_0x42fc46,null));};exports[_0x4334('0x47')]=function(_0x3d538f,_0x2a9eec){return db[_0x4334('0x3e')][_0x4334('0x47')](_0x3d538f[_0x4334('0x48')],{})[_0x4334('0x25')](respondWithResult(_0x2a9eec,0xc9))['catch'](handleError(_0x2a9eec,null));};exports[_0x4334('0x24')]=function(_0x26b464,_0x25889d){if(_0x26b464[_0x4334('0x48')]['id']){delete _0x26b464[_0x4334('0x48')]['id'];}return db[_0x4334('0x3e')]['find']({'where':{'id':_0x26b464[_0x4334('0x44')]['id']}})['then'](handleEntityNotFound(_0x25889d,null))['then'](saveUpdates(_0x26b464['body'],null))[_0x4334('0x25')](respondWithResult(_0x25889d,null))['catch'](handleError(_0x25889d,null));};exports[_0x4334('0x49')]=function(_0x426473,_0x138415){return db[_0x4334('0x3e')][_0x4334('0x46')]({'where':{'id':_0x426473[_0x4334('0x44')]['id']}})[_0x4334('0x25')](handleEntityNotFound(_0x138415,null))[_0x4334('0x25')](removeEntity(_0x138415,null))[_0x4334('0x42')](handleError(_0x138415,null));};exports[_0x4334('0x4a')]=function(_0x99a943,_0x43958f,_0x5814dd){var _0x1c686a={};var _0x52c303={};var _0x22ed3f;var _0x44d9fe;return db[_0x4334('0x3e')][_0x4334('0x4b')]({'where':{'id':_0x99a943[_0x4334('0x44')]['id']}})[_0x4334('0x25')](handleEntityNotFound(_0x43958f,null))['then'](function(_0xb0f251){if(_0xb0f251){_0x22ed3f=_0xb0f251;_0x52c303[_0x4334('0x2c')]=_['keys'](db[_0x4334('0x4c')]['rawAttributes']);_0x52c303[_0x4334('0x2e')]=_[_0x4334('0x2f')](_0x99a943[_0x4334('0x2e')]);_0x52c303[_0x4334('0x39')]=_['intersection'](_0x52c303[_0x4334('0x2c')],_0x52c303[_0x4334('0x2e')]);_0x1c686a[_0x4334('0x32')]=_['intersection'](_0x52c303[_0x4334('0x2c')],qs[_0x4334('0x31')](_0x99a943[_0x4334('0x2e')][_0x4334('0x31')]));_0x1c686a[_0x4334('0x32')]=_0x1c686a[_0x4334('0x32')][_0x4334('0x33')]?_0x1c686a[_0x4334('0x32')]:_0x52c303['model'];_0x1c686a[_0x4334('0x36')]=qs[_0x4334('0x37')](_0x99a943[_0x4334('0x2e')][_0x4334('0x37')]);_0x1c686a['where']=qs[_0x4334('0x39')](_[_0x4334('0x3a')](_0x99a943[_0x4334('0x2e')],_0x52c303[_0x4334('0x39')]));if(_0x99a943[_0x4334('0x2e')][_0x4334('0x3d')]){_0x1c686a[_0x4334('0x38')]=_['merge'](_0x1c686a['where'],{'$or':_['map'](_0x1c686a['attributes'],function(_0x3a31ba){var _0x249966={};_0x249966[_0x3a31ba]={'$like':'%'+_0x99a943['query'][_0x4334('0x3d')]+'%'};return _0x249966;})});}_0x1c686a=_[_0x4334('0x3b')]({},_0x1c686a,_0x99a943[_0x4334('0x45')]);return _0x22ed3f[_0x4334('0x4a')](_0x1c686a);}})[_0x4334('0x25')](function(_0x2d3670){if(_0x2d3670){_0x44d9fe=_0x2d3670[_0x4334('0x33')];if(!_0x99a943['query'][_0x4334('0x34')](_0x4334('0x35'))){_0x1c686a['limit']=qs[_0x4334('0x1e')](_0x99a943['query']['limit']);_0x1c686a[_0x4334('0x1d')]=qs[_0x4334('0x1d')](_0x99a943[_0x4334('0x2e')]['offset']);}return _0x22ed3f[_0x4334('0x4a')](_0x1c686a);}})['then'](function(_0x2bd509){if(_0x2bd509){return _0x2bd509?{'count':_0x44d9fe,'rows':_0x2bd509}:null;}})[_0x4334('0x25')](respondWithResult(_0x43958f,null))['catch'](handleError(_0x43958f,null));};exports[_0x4334('0x4d')]=function(_0x4993db,_0x2f9d2d,_0x697c80){var _0x242b12={};var _0x1287d3={};var _0x541cc9;var _0x21cdf5;return db[_0x4334('0x3e')][_0x4334('0x4b')]({'where':{'id':_0x4993db[_0x4334('0x44')]['id']}})[_0x4334('0x25')](handleEntityNotFound(_0x2f9d2d,null))[_0x4334('0x25')](function(_0x205fa3){if(_0x205fa3){_0x541cc9=_0x205fa3;_0x1287d3[_0x4334('0x2c')]=_[_0x4334('0x2f')](db[_0x4334('0x4c')][_0x4334('0x29')]);_0x1287d3[_0x4334('0x2e')]=_['keys'](_0x4993db['query']);_0x1287d3[_0x4334('0x39')]=_['intersection'](_0x1287d3[_0x4334('0x2c')],_0x1287d3[_0x4334('0x2e')]);_0x242b12[_0x4334('0x32')]=_[_0x4334('0x30')](_0x1287d3[_0x4334('0x2c')],qs[_0x4334('0x31')](_0x4993db['query'][_0x4334('0x31')]));_0x242b12[_0x4334('0x32')]=_0x242b12[_0x4334('0x32')]['length']?_0x242b12[_0x4334('0x32')]:_0x1287d3[_0x4334('0x2c')];_0x242b12[_0x4334('0x36')]=qs[_0x4334('0x37')](_0x4993db[_0x4334('0x2e')][_0x4334('0x37')]);_0x242b12[_0x4334('0x38')]=qs[_0x4334('0x39')](_[_0x4334('0x3a')](_0x4993db[_0x4334('0x2e')],_0x1287d3[_0x4334('0x39')]));if(_0x4993db[_0x4334('0x2e')][_0x4334('0x3d')]){_0x242b12[_0x4334('0x38')]=_['merge'](_0x242b12[_0x4334('0x38')],{'$or':_[_0x4334('0x2d')](_0x242b12['attributes'],function(_0x28de34){var _0x56d368={};_0x56d368[_0x28de34]={'$like':'%'+_0x4993db[_0x4334('0x2e')][_0x4334('0x3d')]+'%'};return _0x56d368;})});}_0x242b12=_[_0x4334('0x3b')]({},_0x242b12,_0x4993db[_0x4334('0x45')]);return _0x541cc9[_0x4334('0x4d')](_0x242b12);}})['then'](function(_0x3218bd){if(_0x3218bd){_0x21cdf5=_0x3218bd[_0x4334('0x33')];if(!_0x4993db[_0x4334('0x2e')][_0x4334('0x34')](_0x4334('0x35'))){_0x242b12[_0x4334('0x1e')]=qs[_0x4334('0x1e')](_0x4993db[_0x4334('0x2e')][_0x4334('0x1e')]);_0x242b12[_0x4334('0x1d')]=qs[_0x4334('0x1d')](_0x4993db[_0x4334('0x2e')][_0x4334('0x1d')]);}return _0x541cc9[_0x4334('0x4d')](_0x242b12);}})['then'](function(_0x42fb59){if(_0x42fb59){return _0x42fb59?{'count':_0x21cdf5,'rows':_0x42fb59}:null;}})[_0x4334('0x25')](respondWithResult(_0x2f9d2d,null))['catch'](handleError(_0x2f9d2d,null));};exports[_0x4334('0x4e')]=function(_0x25a473,_0x3bdc48,_0x26709d){var _0x2d995f={};var _0x42c3e9={};var _0x3b4b2a;var _0x268b63;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x25a473['params']['id']}})[_0x4334('0x25')](handleEntityNotFound(_0x3bdc48,null))[_0x4334('0x25')](function(_0x5be2cd){if(_0x5be2cd){_0x3b4b2a=_0x5be2cd;_0x42c3e9[_0x4334('0x2c')]=_[_0x4334('0x2f')](db['ZendeskField'][_0x4334('0x29')]);_0x42c3e9['query']=_[_0x4334('0x2f')](_0x25a473[_0x4334('0x2e')]);_0x42c3e9[_0x4334('0x39')]=_[_0x4334('0x30')](_0x42c3e9['model'],_0x42c3e9['query']);_0x2d995f[_0x4334('0x32')]=_['intersection'](_0x42c3e9[_0x4334('0x2c')],qs['fields'](_0x25a473[_0x4334('0x2e')][_0x4334('0x31')]));_0x2d995f['attributes']=_0x2d995f[_0x4334('0x32')][_0x4334('0x33')]?_0x2d995f[_0x4334('0x32')]:_0x42c3e9[_0x4334('0x2c')];_0x2d995f[_0x4334('0x36')]=qs['sort'](_0x25a473[_0x4334('0x2e')][_0x4334('0x37')]);_0x2d995f[_0x4334('0x38')]=qs['filters'](_[_0x4334('0x3a')](_0x25a473[_0x4334('0x2e')],_0x42c3e9[_0x4334('0x39')]));if(_0x25a473[_0x4334('0x2e')]['filter']){_0x2d995f[_0x4334('0x38')]=_[_0x4334('0x3b')](_0x2d995f['where'],{'$or':_[_0x4334('0x2d')](_0x2d995f[_0x4334('0x32')],function(_0x332254){var _0x1d8ccb={};_0x1d8ccb[_0x332254]={'$like':'%'+_0x25a473[_0x4334('0x2e')][_0x4334('0x3d')]+'%'};return _0x1d8ccb;})});}_0x2d995f=_[_0x4334('0x3b')]({},_0x2d995f,_0x25a473[_0x4334('0x45')]);return _0x3b4b2a[_0x4334('0x4e')](_0x2d995f);}})[_0x4334('0x25')](function(_0x1b14c7){if(_0x1b14c7){_0x268b63=_0x1b14c7['length'];if(!_0x25a473['query'][_0x4334('0x34')](_0x4334('0x35'))){_0x2d995f['limit']=qs[_0x4334('0x1e')](_0x25a473['query'][_0x4334('0x1e')]);_0x2d995f[_0x4334('0x1d')]=qs[_0x4334('0x1d')](_0x25a473['query'][_0x4334('0x1d')]);}return _0x3b4b2a[_0x4334('0x4e')](_0x2d995f);}})[_0x4334('0x25')](function(_0x263e82){if(_0x263e82){return _0x263e82?{'count':_0x268b63,'rows':_0x263e82}:null;}})[_0x4334('0x25')](respondWithResult(_0x3bdc48,null))[_0x4334('0x42')](handleError(_0x3bdc48,null));};exports['getTags']=function(_0x3c680f,_0x4fcc12,_0x596643){var _0x5a6a10={};var _0x4e10ee={};var _0x1bd8ac;var _0xa73580;return db[_0x4334('0x3e')][_0x4334('0x4b')]({'where':{'id':_0x3c680f['params']['id']}})[_0x4334('0x25')](handleEntityNotFound(_0x4fcc12,null))[_0x4334('0x25')](function(_0x38be57){if(_0x38be57){_0x1bd8ac=_0x38be57;_0x4e10ee[_0x4334('0x2c')]=_['keys'](db[_0x4334('0x4f')][_0x4334('0x29')]);_0x4e10ee[_0x4334('0x2e')]=_['keys'](_0x3c680f[_0x4334('0x2e')]);_0x4e10ee[_0x4334('0x39')]=_[_0x4334('0x30')](_0x4e10ee[_0x4334('0x2c')],_0x4e10ee[_0x4334('0x2e')]);_0x5a6a10[_0x4334('0x32')]=_['intersection'](_0x4e10ee['model'],qs['fields'](_0x3c680f['query']['fields']));_0x5a6a10[_0x4334('0x32')]=_0x5a6a10[_0x4334('0x32')][_0x4334('0x33')]?_0x5a6a10['attributes']:_0x4e10ee[_0x4334('0x2c')];_0x5a6a10[_0x4334('0x36')]=qs[_0x4334('0x37')](_0x3c680f['query'][_0x4334('0x37')]);_0x5a6a10[_0x4334('0x38')]=qs[_0x4334('0x39')](_[_0x4334('0x3a')](_0x3c680f[_0x4334('0x2e')],_0x4e10ee[_0x4334('0x39')]));if(_0x3c680f['query'][_0x4334('0x3d')]){_0x5a6a10[_0x4334('0x38')]=_[_0x4334('0x3b')](_0x5a6a10[_0x4334('0x38')],{'$or':_[_0x4334('0x2d')](_0x5a6a10[_0x4334('0x32')],function(_0xd8e3dd){var _0x1674b6={};_0x1674b6[_0xd8e3dd]={'$like':'%'+_0x3c680f[_0x4334('0x2e')][_0x4334('0x3d')]+'%'};return _0x1674b6;})});}_0x5a6a10=_['merge']({},_0x5a6a10,_0x3c680f[_0x4334('0x45')]);return _0x1bd8ac[_0x4334('0x50')](_0x5a6a10);}})['then'](function(_0x3134ed){if(_0x3134ed){_0xa73580=_0x3134ed[_0x4334('0x33')];if(!_0x3c680f[_0x4334('0x2e')][_0x4334('0x34')](_0x4334('0x35'))){_0x5a6a10['limit']=qs['limit'](_0x3c680f[_0x4334('0x2e')]['limit']);_0x5a6a10[_0x4334('0x1d')]=qs[_0x4334('0x1d')](_0x3c680f[_0x4334('0x2e')][_0x4334('0x1d')]);}return _0x1bd8ac[_0x4334('0x50')](_0x5a6a10);}})[_0x4334('0x25')](function(_0x41b408){if(_0x41b408){return _0x41b408?{'count':_0xa73580,'rows':_0x41b408}:null;}})[_0x4334('0x25')](respondWithResult(_0x4fcc12,null))[_0x4334('0x42')](handleError(_0x4fcc12,null));};exports['setTags']=function(_0x43f3c6,_0x5040a1,_0x54dbf5){if(_0x43f3c6[_0x4334('0x48')]['id']){delete _0x43f3c6['body']['id'];}return db[_0x4334('0x3e')][_0x4334('0x4b')]({'where':{'id':_0x43f3c6[_0x4334('0x44')]['id']}})['then'](handleEntityNotFound(_0x5040a1,null))[_0x4334('0x25')](function(_0x1ad75d){if(_0x1ad75d){return _0x1ad75d['setTags'](_0x43f3c6['body'][_0x4334('0x51')]||[]);}return null;})['then'](respondWithResult(_0x5040a1,null))['catch'](handleError(_0x5040a1,null));}; \ No newline at end of file +var _0x0431=['mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','then','name','index','map','ZendeskConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','update','find','getFields','params','pick','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x3ecf95,_0x559a2c){var _0x3f1e72=function(_0x4160c0){while(--_0x4160c0){_0x3ecf95['push'](_0x3ecf95['shift']());}};_0x3f1e72(++_0x559a2c);}(_0x0431,0xa7));var _0x1043=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0x0431[_0x368bba];return _0x409f8f;};'use strict';var emlformat=require(_0x1043('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1043('0x1'));var jsonpatch=require(_0x1043('0x2'));var rp=require('request-promise');var moment=require(_0x1043('0x3'));var BPromise=require(_0x1043('0x4'));var Mustache=require(_0x1043('0x5'));var util=require(_0x1043('0x6'));var path=require('path');var sox=require(_0x1043('0x7'));var csv=require(_0x1043('0x8'));var ejs=require(_0x1043('0x9'));var fs=require('fs');var fs_extra=require(_0x1043('0xa'));var _=require(_0x1043('0xb'));var squel=require(_0x1043('0xc'));var crypto=require(_0x1043('0xd'));var jsforce=require(_0x1043('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1043('0x8'));var querystring=require(_0x1043('0xf'));var Papa=require(_0x1043('0x10'));var Redis=require(_0x1043('0x11'));var authService=require(_0x1043('0x12'));var qs=require(_0x1043('0x13'));var as=require(_0x1043('0x14'));var hardwareService=require(_0x1043('0x15'));var logger=require(_0x1043('0x16'))(_0x1043('0x17'));var utils=require(_0x1043('0x18'));var config=require(_0x1043('0x19'));var licenseUtil=require(_0x1043('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e831e,_0x2f7b2c){_0x2f7b2c=_0x2f7b2c||0xcc;return function(_0x4f5bdf){if(_0x4f5bdf){return _0x2e831e[_0x1043('0x1b')](_0x2f7b2c);}return _0x2e831e[_0x1043('0x1c')](_0x2f7b2c)[_0x1043('0x1d')]();};}function respondWithResult(_0x135b68,_0xc484b8){_0xc484b8=_0xc484b8||0xc8;return function(_0x21b2f0){if(_0x21b2f0){return _0x135b68[_0x1043('0x1c')](_0xc484b8)[_0x1043('0x1e')](_0x21b2f0);}};}function respondWithFilteredResult(_0x2d01ac,_0x5652e1){return function(_0x5849bf){if(_0x5849bf){var _0x5a8ebc=typeof _0x5652e1[_0x1043('0x1f')]===_0x1043('0x20')&&typeof _0x5652e1[_0x1043('0x21')]===_0x1043('0x20');var _0x31cb87=_0x5849bf['count'];var _0x28a8da=_0x5a8ebc?0x0:_0x5652e1[_0x1043('0x1f')];var _0x11031c=_0x5a8ebc?_0x5849bf['count']:_0x5652e1['offset']+_0x5652e1[_0x1043('0x21')];var _0x3b9116;if(_0x11031c>=_0x31cb87){_0x11031c=_0x31cb87;_0x3b9116=0xc8;}else{_0x3b9116=0xce;}_0x2d01ac[_0x1043('0x1c')](_0x3b9116);return _0x2d01ac['set'](_0x1043('0x22'),_0x28a8da+'-'+_0x11031c+'/'+_0x31cb87)[_0x1043('0x1e')](_0x5849bf);}return null;};}function patchUpdates(_0x4892cd){return function(_0x48f76d){try{jsonpatch[_0x1043('0x23')](_0x48f76d,_0x4892cd,!![]);}catch(_0x5781e1){return BPromise[_0x1043('0x24')](_0x5781e1);}return _0x48f76d[_0x1043('0x25')]();};}function saveUpdates(_0x46d6be,_0x276e8e){return function(_0x2e2744){if(_0x2e2744){return _0x2e2744['update'](_0x46d6be)['then'](function(_0x5ca12e){return _0x5ca12e;});}return null;};}function removeEntity(_0x4efbec,_0x1c831a){return function(_0x239a77){if(_0x239a77){return _0x239a77[_0x1043('0x26')]()[_0x1043('0x27')](function(){_0x4efbec[_0x1043('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28c330,_0x5b3de5){return function(_0xa21bcd){if(!_0xa21bcd){_0x28c330[_0x1043('0x1b')](0x194);}return _0xa21bcd;};}function handleError(_0x83bb47,_0x3d22bf){_0x3d22bf=_0x3d22bf||0x1f4;return function(_0x3c1096){logger['error'](_0x3c1096['stack']);if(_0x3c1096[_0x1043('0x28')]){delete _0x3c1096[_0x1043('0x28')];}_0x83bb47[_0x1043('0x1c')](_0x3d22bf)['send'](_0x3c1096);};}exports[_0x1043('0x29')]=function(_0x204efa,_0x4609b4){var _0x3ea92f={},_0x359edf={},_0x45e3d6={'count':0x0,'rows':[]};var _0x914c97=_[_0x1043('0x2a')](db[_0x1043('0x2b')]['rawAttributes'],function(_0x4b41e7){return{'name':_0x4b41e7[_0x1043('0x2c')],'type':_0x4b41e7[_0x1043('0x2d')][_0x1043('0x2e')]};});_0x359edf[_0x1043('0x2f')]=_[_0x1043('0x2a')](_0x914c97,_0x1043('0x28'));_0x359edf[_0x1043('0x30')]=_[_0x1043('0x31')](_0x204efa[_0x1043('0x30')]);_0x359edf[_0x1043('0x32')]=_[_0x1043('0x33')](_0x359edf['model'],_0x359edf[_0x1043('0x30')]);_0x3ea92f[_0x1043('0x34')]=_[_0x1043('0x33')](_0x359edf[_0x1043('0x2f')],qs['fields'](_0x204efa['query'][_0x1043('0x35')]));_0x3ea92f[_0x1043('0x34')]=_0x3ea92f[_0x1043('0x34')][_0x1043('0x36')]?_0x3ea92f[_0x1043('0x34')]:_0x359edf[_0x1043('0x2f')];if(!_0x204efa[_0x1043('0x30')][_0x1043('0x37')](_0x1043('0x38'))){_0x3ea92f[_0x1043('0x21')]=qs[_0x1043('0x21')](_0x204efa[_0x1043('0x30')][_0x1043('0x21')]);_0x3ea92f[_0x1043('0x1f')]=qs[_0x1043('0x1f')](_0x204efa[_0x1043('0x30')][_0x1043('0x1f')]);}_0x3ea92f[_0x1043('0x39')]=qs[_0x1043('0x3a')](_0x204efa[_0x1043('0x30')][_0x1043('0x3a')]);_0x3ea92f[_0x1043('0x3b')]=qs[_0x1043('0x32')](_['pick'](_0x204efa[_0x1043('0x30')],_0x359edf['filters']),_0x914c97);if(_0x204efa[_0x1043('0x30')][_0x1043('0x3c')]){_0x3ea92f[_0x1043('0x3b')]=_[_0x1043('0x3d')](_0x3ea92f['where'],{'$or':_['map'](_0x914c97,function(_0x480b1c){if(_0x480b1c[_0x1043('0x2d')]!=='VIRTUAL'){var _0x25b92d={};_0x25b92d[_0x480b1c['name']]={'$like':'%'+_0x204efa[_0x1043('0x30')][_0x1043('0x3c')]+'%'};return _0x25b92d;}})});}_0x3ea92f=_[_0x1043('0x3d')]({},_0x3ea92f,_0x204efa[_0x1043('0x3e')]);var _0x3d0717={'where':_0x3ea92f[_0x1043('0x3b')]};return db[_0x1043('0x2b')][_0x1043('0x3f')](_0x3d0717)['then'](function(_0x4197f2){_0x45e3d6[_0x1043('0x3f')]=_0x4197f2;if(_0x204efa[_0x1043('0x30')][_0x1043('0x40')]){_0x3ea92f[_0x1043('0x41')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x1043('0x42')](_0x3ea92f);})[_0x1043('0x27')](function(_0x5f2083){_0x45e3d6[_0x1043('0x43')]=_0x5f2083;return _0x45e3d6;})[_0x1043('0x27')](respondWithFilteredResult(_0x4609b4,_0x3ea92f))[_0x1043('0x44')](handleError(_0x4609b4,null));};exports[_0x1043('0x45')]=function(_0xbfbf32,_0x1cdcc0){var _0x177db9={'raw':![],'where':{'id':_0xbfbf32['params']['id']}},_0x531978={};_0x531978[_0x1043('0x2f')]=_[_0x1043('0x31')](db['ZendeskConfiguration'][_0x1043('0x46')]);_0x531978[_0x1043('0x30')]=_[_0x1043('0x31')](_0xbfbf32[_0x1043('0x30')]);_0x531978[_0x1043('0x32')]=_['intersection'](_0x531978[_0x1043('0x2f')],_0x531978[_0x1043('0x30')]);_0x177db9[_0x1043('0x34')]=_[_0x1043('0x33')](_0x531978[_0x1043('0x2f')],qs['fields'](_0xbfbf32[_0x1043('0x30')][_0x1043('0x35')]));_0x177db9['attributes']=_0x177db9[_0x1043('0x34')][_0x1043('0x36')]?_0x177db9[_0x1043('0x34')]:_0x531978[_0x1043('0x2f')];if(_0xbfbf32[_0x1043('0x30')][_0x1043('0x40')]){_0x177db9[_0x1043('0x41')]=[{'all':!![]}];}_0x177db9=_[_0x1043('0x3d')]({},_0x177db9,_0xbfbf32[_0x1043('0x3e')]);return db[_0x1043('0x2b')]['find'](_0x177db9)['then'](handleEntityNotFound(_0x1cdcc0,null))[_0x1043('0x27')](respondWithResult(_0x1cdcc0,null))[_0x1043('0x44')](handleError(_0x1cdcc0,null));};exports['create']=function(_0x3ab095,_0x4c41d2){return db[_0x1043('0x2b')][_0x1043('0x47')](_0x3ab095[_0x1043('0x48')],{})[_0x1043('0x27')](respondWithResult(_0x4c41d2,0xc9))[_0x1043('0x44')](handleError(_0x4c41d2,null));};exports[_0x1043('0x49')]=function(_0x39ddc1,_0x4de370){if(_0x39ddc1['body']['id']){delete _0x39ddc1['body']['id'];}return db[_0x1043('0x2b')]['find']({'where':{'id':_0x39ddc1['params']['id']}})[_0x1043('0x27')](handleEntityNotFound(_0x4de370,null))[_0x1043('0x27')](saveUpdates(_0x39ddc1[_0x1043('0x48')],null))[_0x1043('0x27')](respondWithResult(_0x4de370,null))['catch'](handleError(_0x4de370,null));};exports['destroy']=function(_0x2283dc,_0x512218){return db[_0x1043('0x2b')][_0x1043('0x4a')]({'where':{'id':_0x2283dc['params']['id']}})[_0x1043('0x27')](handleEntityNotFound(_0x512218,null))[_0x1043('0x27')](removeEntity(_0x512218,null))[_0x1043('0x44')](handleError(_0x512218,null));};exports[_0x1043('0x4b')]=function(_0x5efe74,_0x2e170f,_0x562025){var _0x51a420={};var _0x3fa06d={};var _0xc14945;var _0x5468b5;return db[_0x1043('0x2b')]['findOne']({'where':{'id':_0x5efe74[_0x1043('0x4c')]['id']}})[_0x1043('0x27')](handleEntityNotFound(_0x2e170f,null))[_0x1043('0x27')](function(_0xaaa95d){if(_0xaaa95d){_0xc14945=_0xaaa95d;_0x3fa06d[_0x1043('0x2f')]=_[_0x1043('0x31')](db['ZendeskField']['rawAttributes']);_0x3fa06d[_0x1043('0x30')]=_[_0x1043('0x31')](_0x5efe74[_0x1043('0x30')]);_0x3fa06d['filters']=_['intersection'](_0x3fa06d[_0x1043('0x2f')],_0x3fa06d[_0x1043('0x30')]);_0x51a420['attributes']=_['intersection'](_0x3fa06d[_0x1043('0x2f')],qs['fields'](_0x5efe74[_0x1043('0x30')][_0x1043('0x35')]));_0x51a420['attributes']=_0x51a420['attributes'][_0x1043('0x36')]?_0x51a420['attributes']:_0x3fa06d['model'];_0x51a420[_0x1043('0x39')]=qs[_0x1043('0x3a')](_0x5efe74[_0x1043('0x30')][_0x1043('0x3a')]);_0x51a420['where']=qs[_0x1043('0x32')](_[_0x1043('0x4d')](_0x5efe74[_0x1043('0x30')],_0x3fa06d[_0x1043('0x32')]));if(_0x5efe74[_0x1043('0x30')][_0x1043('0x3c')]){_0x51a420['where']=_[_0x1043('0x3d')](_0x51a420[_0x1043('0x3b')],{'$or':_['map'](_0x51a420[_0x1043('0x34')],function(_0x26a6df){var _0x4105d9={};_0x4105d9[_0x26a6df]={'$like':'%'+_0x5efe74[_0x1043('0x30')][_0x1043('0x3c')]+'%'};return _0x4105d9;})});}_0x51a420=_[_0x1043('0x3d')]({},_0x51a420,_0x5efe74[_0x1043('0x3e')]);return _0xc14945[_0x1043('0x4b')](_0x51a420);}})[_0x1043('0x27')](function(_0x64c43){if(_0x64c43){_0x5468b5=_0x64c43['length'];if(!_0x5efe74[_0x1043('0x30')][_0x1043('0x37')](_0x1043('0x38'))){_0x51a420[_0x1043('0x21')]=qs['limit'](_0x5efe74[_0x1043('0x30')][_0x1043('0x21')]);_0x51a420[_0x1043('0x1f')]=qs[_0x1043('0x1f')](_0x5efe74['query'][_0x1043('0x1f')]);}return _0xc14945[_0x1043('0x4b')](_0x51a420);}})[_0x1043('0x27')](function(_0x31f2f7){if(_0x31f2f7){return _0x31f2f7?{'count':_0x5468b5,'rows':_0x31f2f7}:null;}})[_0x1043('0x27')](respondWithResult(_0x2e170f,null))[_0x1043('0x44')](handleError(_0x2e170f,null));};exports['getSubjects']=function(_0x1a3776,_0x56ed35,_0x7dfed){var _0x44e067={};var _0x395807={};var _0x3684fc;var _0x197a88;return db[_0x1043('0x2b')][_0x1043('0x4e')]({'where':{'id':_0x1a3776[_0x1043('0x4c')]['id']}})['then'](handleEntityNotFound(_0x56ed35,null))[_0x1043('0x27')](function(_0x1f1576){if(_0x1f1576){_0x3684fc=_0x1f1576;_0x395807[_0x1043('0x2f')]=_[_0x1043('0x31')](db[_0x1043('0x4f')][_0x1043('0x46')]);_0x395807[_0x1043('0x30')]=_[_0x1043('0x31')](_0x1a3776['query']);_0x395807['filters']=_[_0x1043('0x33')](_0x395807[_0x1043('0x2f')],_0x395807['query']);_0x44e067['attributes']=_[_0x1043('0x33')](_0x395807[_0x1043('0x2f')],qs['fields'](_0x1a3776['query'][_0x1043('0x35')]));_0x44e067['attributes']=_0x44e067[_0x1043('0x34')]['length']?_0x44e067[_0x1043('0x34')]:_0x395807[_0x1043('0x2f')];_0x44e067[_0x1043('0x39')]=qs[_0x1043('0x3a')](_0x1a3776[_0x1043('0x30')][_0x1043('0x3a')]);_0x44e067[_0x1043('0x3b')]=qs[_0x1043('0x32')](_[_0x1043('0x4d')](_0x1a3776[_0x1043('0x30')],_0x395807[_0x1043('0x32')]));if(_0x1a3776[_0x1043('0x30')][_0x1043('0x3c')]){_0x44e067[_0x1043('0x3b')]=_['merge'](_0x44e067[_0x1043('0x3b')],{'$or':_['map'](_0x44e067[_0x1043('0x34')],function(_0x21e1d3){var _0x176808={};_0x176808[_0x21e1d3]={'$like':'%'+_0x1a3776['query'][_0x1043('0x3c')]+'%'};return _0x176808;})});}_0x44e067=_['merge']({},_0x44e067,_0x1a3776[_0x1043('0x3e')]);return _0x3684fc[_0x1043('0x50')](_0x44e067);}})[_0x1043('0x27')](function(_0x43ac68){if(_0x43ac68){_0x197a88=_0x43ac68[_0x1043('0x36')];if(!_0x1a3776[_0x1043('0x30')]['hasOwnProperty'](_0x1043('0x38'))){_0x44e067[_0x1043('0x21')]=qs[_0x1043('0x21')](_0x1a3776[_0x1043('0x30')]['limit']);_0x44e067[_0x1043('0x1f')]=qs['offset'](_0x1a3776[_0x1043('0x30')][_0x1043('0x1f')]);}return _0x3684fc[_0x1043('0x50')](_0x44e067);}})[_0x1043('0x27')](function(_0x5252e8){if(_0x5252e8){return _0x5252e8?{'count':_0x197a88,'rows':_0x5252e8}:null;}})[_0x1043('0x27')](respondWithResult(_0x56ed35,null))[_0x1043('0x44')](handleError(_0x56ed35,null));};exports['getDescriptions']=function(_0x30545c,_0x38c468,_0x16405c){var _0x3699af={};var _0x4ab3d9={};var _0x18f602;var _0x36cb04;return db[_0x1043('0x2b')][_0x1043('0x4e')]({'where':{'id':_0x30545c[_0x1043('0x4c')]['id']}})[_0x1043('0x27')](handleEntityNotFound(_0x38c468,null))['then'](function(_0x11e5ad){if(_0x11e5ad){_0x18f602=_0x11e5ad;_0x4ab3d9[_0x1043('0x2f')]=_[_0x1043('0x31')](db[_0x1043('0x4f')]['rawAttributes']);_0x4ab3d9[_0x1043('0x30')]=_['keys'](_0x30545c[_0x1043('0x30')]);_0x4ab3d9[_0x1043('0x32')]=_[_0x1043('0x33')](_0x4ab3d9[_0x1043('0x2f')],_0x4ab3d9[_0x1043('0x30')]);_0x3699af[_0x1043('0x34')]=_[_0x1043('0x33')](_0x4ab3d9[_0x1043('0x2f')],qs['fields'](_0x30545c[_0x1043('0x30')]['fields']));_0x3699af['attributes']=_0x3699af[_0x1043('0x34')][_0x1043('0x36')]?_0x3699af['attributes']:_0x4ab3d9[_0x1043('0x2f')];_0x3699af[_0x1043('0x39')]=qs[_0x1043('0x3a')](_0x30545c[_0x1043('0x30')][_0x1043('0x3a')]);_0x3699af[_0x1043('0x3b')]=qs['filters'](_[_0x1043('0x4d')](_0x30545c[_0x1043('0x30')],_0x4ab3d9[_0x1043('0x32')]));if(_0x30545c[_0x1043('0x30')][_0x1043('0x3c')]){_0x3699af['where']=_['merge'](_0x3699af[_0x1043('0x3b')],{'$or':_['map'](_0x3699af[_0x1043('0x34')],function(_0x591d9f){var _0x26bb60={};_0x26bb60[_0x591d9f]={'$like':'%'+_0x30545c[_0x1043('0x30')][_0x1043('0x3c')]+'%'};return _0x26bb60;})});}_0x3699af=_[_0x1043('0x3d')]({},_0x3699af,_0x30545c[_0x1043('0x3e')]);return _0x18f602[_0x1043('0x51')](_0x3699af);}})[_0x1043('0x27')](function(_0x20ed0d){if(_0x20ed0d){_0x36cb04=_0x20ed0d['length'];if(!_0x30545c[_0x1043('0x30')]['hasOwnProperty'](_0x1043('0x38'))){_0x3699af[_0x1043('0x21')]=qs['limit'](_0x30545c[_0x1043('0x30')][_0x1043('0x21')]);_0x3699af[_0x1043('0x1f')]=qs[_0x1043('0x1f')](_0x30545c[_0x1043('0x30')][_0x1043('0x1f')]);}return _0x18f602[_0x1043('0x51')](_0x3699af);}})[_0x1043('0x27')](function(_0x4d7782){if(_0x4d7782){return _0x4d7782?{'count':_0x36cb04,'rows':_0x4d7782}:null;}})['then'](respondWithResult(_0x38c468,null))['catch'](handleError(_0x38c468,null));};exports[_0x1043('0x52')]=function(_0x4cb4ad,_0xb1a655,_0x354993){var _0x4399a3={};var _0x3b76e7={};var _0x3a157c;var _0x15b27c;return db[_0x1043('0x2b')][_0x1043('0x4e')]({'where':{'id':_0x4cb4ad[_0x1043('0x4c')]['id']}})[_0x1043('0x27')](handleEntityNotFound(_0xb1a655,null))['then'](function(_0xb39f2c){if(_0xb39f2c){_0x3a157c=_0xb39f2c;_0x3b76e7[_0x1043('0x2f')]=_['keys'](db[_0x1043('0x53')][_0x1043('0x46')]);_0x3b76e7[_0x1043('0x30')]=_[_0x1043('0x31')](_0x4cb4ad[_0x1043('0x30')]);_0x3b76e7[_0x1043('0x32')]=_['intersection'](_0x3b76e7[_0x1043('0x2f')],_0x3b76e7['query']);_0x4399a3[_0x1043('0x34')]=_[_0x1043('0x33')](_0x3b76e7[_0x1043('0x2f')],qs[_0x1043('0x35')](_0x4cb4ad[_0x1043('0x30')][_0x1043('0x35')]));_0x4399a3['attributes']=_0x4399a3[_0x1043('0x34')]['length']?_0x4399a3[_0x1043('0x34')]:_0x3b76e7['model'];_0x4399a3[_0x1043('0x39')]=qs['sort'](_0x4cb4ad['query'][_0x1043('0x3a')]);_0x4399a3[_0x1043('0x3b')]=qs[_0x1043('0x32')](_[_0x1043('0x4d')](_0x4cb4ad['query'],_0x3b76e7[_0x1043('0x32')]));if(_0x4cb4ad[_0x1043('0x30')]['filter']){_0x4399a3[_0x1043('0x3b')]=_[_0x1043('0x3d')](_0x4399a3[_0x1043('0x3b')],{'$or':_[_0x1043('0x2a')](_0x4399a3[_0x1043('0x34')],function(_0x61349f){var _0x54af77={};_0x54af77[_0x61349f]={'$like':'%'+_0x4cb4ad['query'][_0x1043('0x3c')]+'%'};return _0x54af77;})});}_0x4399a3=_[_0x1043('0x3d')]({},_0x4399a3,_0x4cb4ad[_0x1043('0x3e')]);return _0x3a157c[_0x1043('0x52')](_0x4399a3);}})[_0x1043('0x27')](function(_0x1a147b){if(_0x1a147b){_0x15b27c=_0x1a147b[_0x1043('0x36')];if(!_0x4cb4ad['query'][_0x1043('0x37')]('nolimit')){_0x4399a3['limit']=qs['limit'](_0x4cb4ad['query'][_0x1043('0x21')]);_0x4399a3[_0x1043('0x1f')]=qs['offset'](_0x4cb4ad['query'][_0x1043('0x1f')]);}return _0x3a157c[_0x1043('0x52')](_0x4399a3);}})[_0x1043('0x27')](function(_0xea5602){if(_0xea5602){return _0xea5602?{'count':_0x15b27c,'rows':_0xea5602}:null;}})['then'](respondWithResult(_0xb1a655,null))[_0x1043('0x44')](handleError(_0xb1a655,null));};exports[_0x1043('0x54')]=function(_0xed8aa7,_0x1d46d8,_0x838c72){if(_0xed8aa7[_0x1043('0x48')]['id']){delete _0xed8aa7[_0x1043('0x48')]['id'];}return db[_0x1043('0x2b')]['findOne']({'where':{'id':_0xed8aa7[_0x1043('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d46d8,null))[_0x1043('0x27')](function(_0x140f17){if(_0x140f17){return _0x140f17['setTags'](_0xed8aa7['body'][_0x1043('0x55')]||[]);}return null;})['then'](respondWithResult(_0x1d46d8,null))[_0x1043('0x44')](handleError(_0x1d46d8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index e7ba5d0..c2849c2 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0xa22583,_0x564cdd){var _0x3e2d07=function(_0x56520a){while(--_0x56520a){_0xa22583['push'](_0xa22583['shift']());}};_0x3e2d07(++_0x564cdd);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x38fbc2,_0x54f822){_0x38fbc2=_0x38fbc2-0x0;var _0x2ae767=_0xe1e3[_0x38fbc2];return _0x2ae767;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb3b=['moment','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api'];(function(_0xde2c8,_0x6a6d9b){var _0x52e8d7=function(_0x14c585){while(--_0x14c585){_0xde2c8['push'](_0xde2c8['shift']());}};_0x52e8d7(++_0x6a6d9b);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0xeb3b[_0x1c34e7];return _0x378cb1;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var logger=require(_0xbeb3('0x2'))(_0xbeb3('0x3'));var moment=require(_0xbeb3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbeb3('0x5'));var rimraf=require('rimraf');var config=require(_0xbeb3('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xbeb3('0x7')]=function(_0x5ae6f9,_0x8d8cce){return _0x5ae6f9[_0xbeb3('0x8')](_0xbeb3('0x9'),attributes,{'tableName':_0xbeb3('0xa'),'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 92cbed1..360421a 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 _0x0c72=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash'];(function(_0x498d7b,_0x2907d7){var _0x3b78c9=function(_0x502ba6){while(--_0x502ba6){_0x498d7b['push'](_0x498d7b['shift']());}};_0x3b78c9(++_0x2907d7);}(_0x0c72,0x175));var _0x20c7=function(_0xb0cd95,_0x2f625){_0xb0cd95=_0xb0cd95-0x0;var _0x152784=_0x0c72[_0xb0cd95];return _0x152784;};'use strict';var _=require(_0x20c7('0x0'));var util=require(_0x20c7('0x1'));var moment=require(_0x20c7('0x2'));var BPromise=require(_0x20c7('0x3'));var rs=require(_0x20c7('0x4'));var fs=require('fs');var Redis=require(_0x20c7('0x5'));var db=require(_0x20c7('0x6'))['db'];var utils=require(_0x20c7('0x7'));var logger=require(_0x20c7('0x8'))(_0x20c7('0x9'));var config=require(_0x20c7('0xa'));var jayson=require(_0x20c7('0xb'));var client=jayson['client'][_0x20c7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335783,_0x3f8149,_0x4007dd){return new BPromise(function(_0x3038f3,_0xb6468e){return client[_0x20c7('0xd')](_0x335783,_0x4007dd)['then'](function(_0x5d2591){logger[_0x20c7('0xe')](_0x20c7('0xf'),_0x3f8149,'request\x20sent');logger[_0x20c7('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3f8149,_0x20c7('0x11'),JSON[_0x20c7('0x12')](_0x5d2591));if(_0x5d2591[_0x20c7('0x13')]){if(_0x5d2591['error'][_0x20c7('0x14')]===0x1f4){logger[_0x20c7('0x13')](_0x20c7('0xf'),_0x3f8149,_0x5d2591[_0x20c7('0x13')]['message']);return _0xb6468e(_0x5d2591[_0x20c7('0x13')][_0x20c7('0x15')]);}logger[_0x20c7('0x13')](_0x20c7('0xf'),_0x3f8149,_0x5d2591[_0x20c7('0x13')][_0x20c7('0x15')]);return _0x3038f3(_0x5d2591[_0x20c7('0x13')]['message']);}else{logger[_0x20c7('0xe')](_0x20c7('0xf'),_0x3f8149,'request\x20sent');_0x3038f3(_0x5d2591['result'][_0x20c7('0x15')]);}})['catch'](function(_0x268791){logger['error'](_0x20c7('0xf'),_0x3f8149,_0x268791);_0xb6468e(_0x268791);});});} \ No newline at end of file +var _0x7ef5=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../config/utils'];(function(_0x389d27,_0x582c28){var _0x3dc073=function(_0x22c593){while(--_0x22c593){_0x389d27['push'](_0x389d27['shift']());}};_0x3dc073(++_0x582c28);}(_0x7ef5,0xee));var _0x57ef=function(_0x58c129,_0x47aee8){_0x58c129=_0x58c129-0x0;var _0x386fd2=_0x7ef5[_0x58c129];return _0x386fd2;};'use strict';var _=require('lodash');var util=require(_0x57ef('0x0'));var moment=require('moment');var BPromise=require(_0x57ef('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57ef('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x57ef('0x3'));var logger=require(_0x57ef('0x4'))(_0x57ef('0x5'));var config=require(_0x57ef('0x6'));var jayson=require(_0x57ef('0x7'));var client=jayson[_0x57ef('0x8')][_0x57ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a5749,_0x585eae,_0x3a6fb7){return new BPromise(function(_0x4e7c31,_0x3a454e){return client['request'](_0x2a5749,_0x3a6fb7)[_0x57ef('0xa')](function(_0x1bacd3){logger[_0x57ef('0xb')](_0x57ef('0xc'),_0x585eae,_0x57ef('0xd'));logger[_0x57ef('0xe')](_0x57ef('0xf'),_0x585eae,_0x57ef('0xd'),JSON[_0x57ef('0x10')](_0x1bacd3));if(_0x1bacd3[_0x57ef('0x11')]){if(_0x1bacd3[_0x57ef('0x11')][_0x57ef('0x12')]===0x1f4){logger[_0x57ef('0x11')](_0x57ef('0xc'),_0x585eae,_0x1bacd3['error'][_0x57ef('0x13')]);return _0x3a454e(_0x1bacd3[_0x57ef('0x11')][_0x57ef('0x13')]);}logger[_0x57ef('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x585eae,_0x1bacd3['error']['message']);return _0x4e7c31(_0x1bacd3['error'][_0x57ef('0x13')]);}else{logger['info'](_0x57ef('0xc'),_0x585eae,_0x57ef('0xd'));_0x4e7c31(_0x1bacd3[_0x57ef('0x14')][_0x57ef('0x13')]);}})[_0x57ef('0x15')](function(_0xab4023){logger[_0x57ef('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x585eae,_0xab4023);_0x3a454e(_0xab4023);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5d3109a..888ba13 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 _0xa96f=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','create','put','update','destroy','exports','util'];(function(_0x8ccfb8,_0x31261f){var _0x5193d6=function(_0x496c5d){while(--_0x496c5d){_0x8ccfb8['push'](_0x8ccfb8['shift']());}};_0x5193d6(++_0x31261f);}(_0xa96f,0x179));var _0xfa96=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0xa96f[_0x3042c5];return _0x7cd140;};'use strict';var multer=require('multer');var util=require(_0xfa96('0x0'));var path=require(_0xfa96('0x1'));var timeout=require(_0xfa96('0x2'));var express=require('express');var router=express[_0xfa96('0x3')]();var fs_extra=require(_0xfa96('0x4'));var auth=require(_0xfa96('0x5'));var interaction=require(_0xfa96('0x6'));var config=require('../../config/environment');var controller=require(_0xfa96('0x7'));router['get']('/',auth[_0xfa96('0x8')](),controller[_0xfa96('0x9')]);router[_0xfa96('0xa')](_0xfa96('0xb'),auth['isAuthenticated'](),controller[_0xfa96('0xc')]);router['post']('/',auth[_0xfa96('0x8')](),controller[_0xfa96('0xd')]);router[_0xfa96('0xe')](_0xfa96('0xb'),auth['isAuthenticated'](),controller[_0xfa96('0xf')]);router['delete'](_0xfa96('0xb'),auth['isAuthenticated'](),controller[_0xfa96('0x10')]);module[_0xfa96('0x11')]=router; \ No newline at end of file +var _0x473a=['isAuthenticated','index','/:id','post','create','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x473a,0x17e));var _0xa473=function(_0x8e0ced,_0x24e421){_0x8e0ced=_0x8e0ced-0x0;var _0x30b339=_0x473a[_0x8e0ced];return _0x30b339;};'use strict';var multer=require('multer');var util=require(_0xa473('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa473('0x1'));var router=express[_0xa473('0x2')]();var fs_extra=require(_0xa473('0x3'));var auth=require(_0xa473('0x4'));var interaction=require(_0xa473('0x5'));var config=require(_0xa473('0x6'));var controller=require(_0xa473('0x7'));router[_0xa473('0x8')]('/',auth[_0xa473('0x9')](),controller[_0xa473('0xa')]);router[_0xa473('0x8')](_0xa473('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa473('0xc')]('/',auth[_0xa473('0x9')](),controller[_0xa473('0xd')]);router['put'](_0xa473('0xb'),auth[_0xa473('0x9')](),controller[_0xa473('0xe')]);router[_0xa473('0xf')](_0xa473('0xb'),auth[_0xa473('0x9')](),controller['destroy']);module[_0xa473('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 4c249b5..c6add7f 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 _0x94d8=['exports','ENUM','string','customVariable','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x47a66e,_0x21ce39){var _0x4e2bc6=function(_0x13aa8a){while(--_0x13aa8a){_0x47a66e['push'](_0x47a66e['shift']());}};_0x4e2bc6(++_0x21ce39);}(_0x94d8,0x10d));var _0x894d=function(_0xd39da4,_0x36bc6f){_0xd39da4=_0xd39da4-0x0;var _0x2900d6=_0x94d8[_0xd39da4];return _0x2900d6;};'use strict';var Sequelize=require(_0x894d('0x0'));module[_0x894d('0x1')]={'type':{'type':Sequelize[_0x894d('0x2')](_0x894d('0x3'),'variable',_0x894d('0x4'),'keyValue',_0x894d('0x5')),'defaultValue':_0x894d('0x3')},'content':{'type':Sequelize[_0x894d('0x6')]},'key':{'type':Sequelize[_0x894d('0x6')]},'keyType':{'type':Sequelize[_0x894d('0x2')](_0x894d('0x3'),_0x894d('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x894d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x894d('0x6')]},'customField':{'type':Sequelize[_0x894d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6136=['STRING','ENUM','string','variable','customVariable','keyValue'];(function(_0x4b6c5d,_0x40290c){var _0x49b996=function(_0xf69f5c){while(--_0xf69f5c){_0x4b6c5d['push'](_0x4b6c5d['shift']());}};_0x49b996(++_0x40290c);}(_0x6136,0x145));var _0x6613=function(_0x5a0f8b,_0x2df0dd){_0x5a0f8b=_0x5a0f8b-0x0;var _0x5ab08c=_0x6136[_0x5a0f8b];return _0x5ab08c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6613('0x0')](_0x6613('0x1'),_0x6613('0x2'),_0x6613('0x3'),_0x6613('0x4'),'picklist'),'defaultValue':_0x6613('0x1')},'content':{'type':Sequelize[_0x6613('0x5')]},'key':{'type':Sequelize[_0x6613('0x5')]},'keyType':{'type':Sequelize[_0x6613('0x0')](_0x6613('0x1'),'variable',_0x6613('0x3'))},'keyContent':{'type':Sequelize[_0x6613('0x5')]},'idField':{'type':Sequelize[_0x6613('0x5')]},'nameField':{'type':Sequelize[_0x6613('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6613('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index a64e291..584b947 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 _0xa1ab=['options','includeAll','include','rows','length','create','body','catch','find','params','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter'];(function(_0x434eb0,_0xcf2586){var _0x118459=function(_0x378240){while(--_0x378240){_0x434eb0['push'](_0x434eb0['shift']());}};_0x118459(++_0xcf2586);}(_0xa1ab,0x1ae));var _0xba1a=function(_0x5aa5cb,_0x5d785f){_0x5aa5cb=_0x5aa5cb-0x0;var _0xf6d1ef=_0xa1ab[_0x5aa5cb];return _0xf6d1ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba1a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba1a('0x1'));var moment=require(_0xba1a('0x2'));var BPromise=require(_0xba1a('0x3'));var Mustache=require('mustache');var util=require(_0xba1a('0x4'));var path=require(_0xba1a('0x5'));var sox=require('sox');var csv=require(_0xba1a('0x6'));var ejs=require(_0xba1a('0x7'));var fs=require('fs');var fs_extra=require(_0xba1a('0x8'));var _=require(_0xba1a('0x9'));var squel=require(_0xba1a('0xa'));var crypto=require(_0xba1a('0xb'));var jsforce=require(_0xba1a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba1a('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xba1a('0xe'));var hardwareService=require(_0xba1a('0xf'));var logger=require(_0xba1a('0x10'))(_0xba1a('0x11'));var utils=require('../../config/utils');var config=require(_0xba1a('0x12'));var licenseUtil=require(_0xba1a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42a0e0,_0x2770c5){_0x2770c5=_0x2770c5||0xcc;return function(_0x466cde){if(_0x466cde){return _0x42a0e0[_0xba1a('0x14')](_0x2770c5);}return _0x42a0e0['status'](_0x2770c5)[_0xba1a('0x15')]();};}function respondWithResult(_0x58666f,_0x1f0ffc){_0x1f0ffc=_0x1f0ffc||0xc8;return function(_0x5bc1b4){if(_0x5bc1b4){return _0x58666f[_0xba1a('0x16')](_0x1f0ffc)[_0xba1a('0x17')](_0x5bc1b4);}};}function respondWithFilteredResult(_0x5c4950,_0x16d7bf){return function(_0x4024c4){if(_0x4024c4){var _0x28a818=typeof _0x16d7bf[_0xba1a('0x18')]==='undefined'&&typeof _0x16d7bf['limit']===_0xba1a('0x19');var _0x27133c=_0x4024c4[_0xba1a('0x1a')];var _0x3434ed=_0x28a818?0x0:_0x16d7bf[_0xba1a('0x18')];var _0x5ea513=_0x28a818?_0x4024c4[_0xba1a('0x1a')]:_0x16d7bf[_0xba1a('0x18')]+_0x16d7bf[_0xba1a('0x1b')];var _0x15a068;if(_0x5ea513>=_0x27133c){_0x5ea513=_0x27133c;_0x15a068=0xc8;}else{_0x15a068=0xce;}_0x5c4950[_0xba1a('0x16')](_0x15a068);return _0x5c4950[_0xba1a('0x1c')]('Content-Range',_0x3434ed+'-'+_0x5ea513+'/'+_0x27133c)[_0xba1a('0x17')](_0x4024c4);}return null;};}function patchUpdates(_0x59b48d){return function(_0x19b17d){try{jsonpatch[_0xba1a('0x1d')](_0x19b17d,_0x59b48d,!![]);}catch(_0x3f37f7){return BPromise[_0xba1a('0x1e')](_0x3f37f7);}return _0x19b17d[_0xba1a('0x1f')]();};}function saveUpdates(_0x24d5c2,_0x4d77e2){return function(_0x11a6f2){if(_0x11a6f2){return _0x11a6f2[_0xba1a('0x20')](_0x24d5c2)[_0xba1a('0x21')](function(_0x20ff2e){return _0x20ff2e;});}return null;};}function removeEntity(_0x5a26a4,_0x5e8490){return function(_0x5ee9de){if(_0x5ee9de){return _0x5ee9de[_0xba1a('0x22')]()['then'](function(){_0x5a26a4['status'](0xcc)[_0xba1a('0x15')]();});}};}function handleEntityNotFound(_0xc8aa6b,_0x331224){return function(_0x4207cc){if(!_0x4207cc){_0xc8aa6b[_0xba1a('0x14')](0x194);}return _0x4207cc;};}function handleError(_0x545633,_0x2426d1){_0x2426d1=_0x2426d1||0x1f4;return function(_0x50069a){logger['error'](_0x50069a[_0xba1a('0x23')]);if(_0x50069a[_0xba1a('0x24')]){delete _0x50069a[_0xba1a('0x24')];}_0x545633[_0xba1a('0x16')](_0x2426d1)[_0xba1a('0x25')](_0x50069a);};}exports[_0xba1a('0x26')]=function(_0x23c8e7,_0x5bce4d){var _0x49ba65={},_0x3ddb47={},_0x297953={'count':0x0,'rows':[]};var _0x5e14ef=_[_0xba1a('0x27')](db[_0xba1a('0x28')][_0xba1a('0x29')],function(_0x1d3457){return{'name':_0x1d3457[_0xba1a('0x2a')],'type':_0x1d3457['type'][_0xba1a('0x2b')]};});_0x3ddb47[_0xba1a('0x2c')]=_[_0xba1a('0x27')](_0x5e14ef,_0xba1a('0x24'));_0x3ddb47[_0xba1a('0x2d')]=_[_0xba1a('0x2e')](_0x23c8e7[_0xba1a('0x2d')]);_0x3ddb47['filters']=_[_0xba1a('0x2f')](_0x3ddb47[_0xba1a('0x2c')],_0x3ddb47['query']);_0x49ba65[_0xba1a('0x30')]=_[_0xba1a('0x2f')](_0x3ddb47[_0xba1a('0x2c')],qs[_0xba1a('0x31')](_0x23c8e7[_0xba1a('0x2d')]['fields']));_0x49ba65[_0xba1a('0x30')]=_0x49ba65[_0xba1a('0x30')]['length']?_0x49ba65[_0xba1a('0x30')]:_0x3ddb47[_0xba1a('0x2c')];if(!_0x23c8e7[_0xba1a('0x2d')]['hasOwnProperty'](_0xba1a('0x32'))){_0x49ba65[_0xba1a('0x1b')]=qs[_0xba1a('0x1b')](_0x23c8e7[_0xba1a('0x2d')]['limit']);_0x49ba65['offset']=qs[_0xba1a('0x18')](_0x23c8e7[_0xba1a('0x2d')][_0xba1a('0x18')]);}_0x49ba65[_0xba1a('0x33')]=qs['sort'](_0x23c8e7[_0xba1a('0x2d')][_0xba1a('0x34')]);_0x49ba65[_0xba1a('0x35')]=qs[_0xba1a('0x36')](_[_0xba1a('0x37')](_0x23c8e7[_0xba1a('0x2d')],_0x3ddb47[_0xba1a('0x36')]),_0x5e14ef);if(_0x23c8e7['query']['filter']){_0x49ba65[_0xba1a('0x35')]=_[_0xba1a('0x38')](_0x49ba65[_0xba1a('0x35')],{'$or':_[_0xba1a('0x27')](_0x5e14ef,function(_0x2c0d7c){if(_0x2c0d7c[_0xba1a('0x39')]!==_0xba1a('0x3a')){var _0x1ad68f={};_0x1ad68f[_0x2c0d7c[_0xba1a('0x24')]]={'$like':'%'+_0x23c8e7[_0xba1a('0x2d')][_0xba1a('0x3b')]+'%'};return _0x1ad68f;}})});}_0x49ba65=_[_0xba1a('0x38')]({},_0x49ba65,_0x23c8e7[_0xba1a('0x3c')]);var _0x213284={'where':_0x49ba65[_0xba1a('0x35')]};return db[_0xba1a('0x28')][_0xba1a('0x1a')](_0x213284)[_0xba1a('0x21')](function(_0x4614f9){_0x297953['count']=_0x4614f9;if(_0x23c8e7[_0xba1a('0x2d')][_0xba1a('0x3d')]){_0x49ba65[_0xba1a('0x3e')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x49ba65);})[_0xba1a('0x21')](function(_0x1cf43b){_0x297953[_0xba1a('0x3f')]=_0x1cf43b;return _0x297953;})[_0xba1a('0x21')](respondWithFilteredResult(_0x5bce4d,_0x49ba65))['catch'](handleError(_0x5bce4d,null));};exports['show']=function(_0x3a7062,_0x5216de){var _0x595b45={'raw':!![],'where':{'id':_0x3a7062['params']['id']}},_0x372675={};_0x372675[_0xba1a('0x2c')]=_[_0xba1a('0x2e')](db['ZendeskField'][_0xba1a('0x29')]);_0x372675[_0xba1a('0x2d')]=_['keys'](_0x3a7062[_0xba1a('0x2d')]);_0x372675[_0xba1a('0x36')]=_[_0xba1a('0x2f')](_0x372675['model'],_0x372675[_0xba1a('0x2d')]);_0x595b45['attributes']=_[_0xba1a('0x2f')](_0x372675[_0xba1a('0x2c')],qs[_0xba1a('0x31')](_0x3a7062[_0xba1a('0x2d')]['fields']));_0x595b45[_0xba1a('0x30')]=_0x595b45[_0xba1a('0x30')][_0xba1a('0x40')]?_0x595b45[_0xba1a('0x30')]:_0x372675[_0xba1a('0x2c')];if(_0x3a7062[_0xba1a('0x2d')]['includeAll']){_0x595b45[_0xba1a('0x3e')]=[{'all':!![]}];}_0x595b45=_[_0xba1a('0x38')]({},_0x595b45,_0x3a7062[_0xba1a('0x3c')]);return db['ZendeskField']['find'](_0x595b45)[_0xba1a('0x21')](handleEntityNotFound(_0x5216de,null))[_0xba1a('0x21')](respondWithResult(_0x5216de,null))['catch'](handleError(_0x5216de,null));};exports['create']=function(_0x16a258,_0x20e925){return db['ZendeskField'][_0xba1a('0x41')](_0x16a258[_0xba1a('0x42')],{})[_0xba1a('0x21')](respondWithResult(_0x20e925,0xc9))[_0xba1a('0x43')](handleError(_0x20e925,null));};exports[_0xba1a('0x20')]=function(_0x195a64,_0x243586){if(_0x195a64[_0xba1a('0x42')]['id']){delete _0x195a64[_0xba1a('0x42')]['id'];}return db['ZendeskField'][_0xba1a('0x44')]({'where':{'id':_0x195a64[_0xba1a('0x45')]['id']}})[_0xba1a('0x21')](handleEntityNotFound(_0x243586,null))[_0xba1a('0x21')](saveUpdates(_0x195a64['body'],null))[_0xba1a('0x21')](respondWithResult(_0x243586,null))['catch'](handleError(_0x243586,null));};exports['destroy']=function(_0x4b2f24,_0x4da00d){return db['ZendeskField'][_0xba1a('0x44')]({'where':{'id':_0x4b2f24['params']['id']}})[_0xba1a('0x21')](handleEntityNotFound(_0x4da00d,null))[_0xba1a('0x21')](removeEntity(_0x4da00d,null))['catch'](handleError(_0x4da00d,null));}; \ No newline at end of file +var _0x582f=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x582f,0x7f));var _0xf582=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0x582f[_0x3fa7d3];return _0x4c51bd;};'use strict';var emlformat=require(_0xf582('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf582('0x1'));var jsonpatch=require(_0xf582('0x2'));var rp=require(_0xf582('0x3'));var moment=require(_0xf582('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf582('0x5'));var util=require(_0xf582('0x6'));var path=require(_0xf582('0x7'));var sox=require('sox');var csv=require(_0xf582('0x8'));var ejs=require(_0xf582('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf582('0xa'));var squel=require(_0xf582('0xb'));var crypto=require(_0xf582('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf582('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf582('0xe'));var Redis=require(_0xf582('0xf'));var authService=require(_0xf582('0x10'));var qs=require(_0xf582('0x11'));var as=require(_0xf582('0x12'));var hardwareService=require(_0xf582('0x13'));var logger=require(_0xf582('0x14'))(_0xf582('0x15'));var utils=require(_0xf582('0x16'));var config=require(_0xf582('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf582('0x18'))['db'];function respondWithStatusCode(_0x23acec,_0x1395ba){_0x1395ba=_0x1395ba||0xcc;return function(_0x5549be){if(_0x5549be){return _0x23acec[_0xf582('0x19')](_0x1395ba);}return _0x23acec[_0xf582('0x1a')](_0x1395ba)[_0xf582('0x1b')]();};}function respondWithResult(_0x3ce6ec,_0x25a530){_0x25a530=_0x25a530||0xc8;return function(_0x7dc620){if(_0x7dc620){return _0x3ce6ec[_0xf582('0x1a')](_0x25a530)[_0xf582('0x1c')](_0x7dc620);}};}function respondWithFilteredResult(_0x17ef4e,_0x47ebb3){return function(_0x425bf2){if(_0x425bf2){var _0x3a266e=typeof _0x47ebb3[_0xf582('0x1d')]===_0xf582('0x1e')&&typeof _0x47ebb3[_0xf582('0x1f')]===_0xf582('0x1e');var _0x3b6f98=_0x425bf2[_0xf582('0x20')];var _0x5270a2=_0x3a266e?0x0:_0x47ebb3[_0xf582('0x1d')];var _0x1cc458=_0x3a266e?_0x425bf2[_0xf582('0x20')]:_0x47ebb3[_0xf582('0x1d')]+_0x47ebb3[_0xf582('0x1f')];var _0x5e1442;if(_0x1cc458>=_0x3b6f98){_0x1cc458=_0x3b6f98;_0x5e1442=0xc8;}else{_0x5e1442=0xce;}_0x17ef4e[_0xf582('0x1a')](_0x5e1442);return _0x17ef4e[_0xf582('0x21')](_0xf582('0x22'),_0x5270a2+'-'+_0x1cc458+'/'+_0x3b6f98)[_0xf582('0x1c')](_0x425bf2);}return null;};}function patchUpdates(_0x53a2ad){return function(_0x3d89b9){try{jsonpatch[_0xf582('0x23')](_0x3d89b9,_0x53a2ad,!![]);}catch(_0x2bc40a){return BPromise[_0xf582('0x24')](_0x2bc40a);}return _0x3d89b9[_0xf582('0x25')]();};}function saveUpdates(_0x431b66,_0x1b06ff){return function(_0x4b9098){if(_0x4b9098){return _0x4b9098[_0xf582('0x26')](_0x431b66)[_0xf582('0x27')](function(_0x1f7a57){return _0x1f7a57;});}return null;};}function removeEntity(_0x3425ef,_0x2b7623){return function(_0x27dda1){if(_0x27dda1){return _0x27dda1[_0xf582('0x28')]()[_0xf582('0x27')](function(){_0x3425ef[_0xf582('0x1a')](0xcc)[_0xf582('0x1b')]();});}};}function handleEntityNotFound(_0x2e379f,_0x41be3b){return function(_0x265f95){if(!_0x265f95){_0x2e379f[_0xf582('0x19')](0x194);}return _0x265f95;};}function handleError(_0x27f920,_0xea9288){_0xea9288=_0xea9288||0x1f4;return function(_0x304dbd){logger[_0xf582('0x29')](_0x304dbd['stack']);if(_0x304dbd[_0xf582('0x2a')]){delete _0x304dbd['name'];}_0x27f920[_0xf582('0x1a')](_0xea9288)[_0xf582('0x2b')](_0x304dbd);};}exports['index']=function(_0x3a38ab,_0x5b720b){var _0x13a146={},_0x254d3b={},_0x12d359={'count':0x0,'rows':[]};var _0xf5bf24=_[_0xf582('0x2c')](db[_0xf582('0x2d')][_0xf582('0x2e')],function(_0x525532){return{'name':_0x525532[_0xf582('0x2f')],'type':_0x525532['type'][_0xf582('0x30')]};});_0x254d3b[_0xf582('0x31')]=_['map'](_0xf5bf24,_0xf582('0x2a'));_0x254d3b[_0xf582('0x32')]=_[_0xf582('0x33')](_0x3a38ab[_0xf582('0x32')]);_0x254d3b['filters']=_[_0xf582('0x34')](_0x254d3b[_0xf582('0x31')],_0x254d3b[_0xf582('0x32')]);_0x13a146['attributes']=_[_0xf582('0x34')](_0x254d3b[_0xf582('0x31')],qs[_0xf582('0x35')](_0x3a38ab[_0xf582('0x32')][_0xf582('0x35')]));_0x13a146[_0xf582('0x36')]=_0x13a146[_0xf582('0x36')][_0xf582('0x37')]?_0x13a146[_0xf582('0x36')]:_0x254d3b[_0xf582('0x31')];if(!_0x3a38ab[_0xf582('0x32')][_0xf582('0x38')]('nolimit')){_0x13a146[_0xf582('0x1f')]=qs[_0xf582('0x1f')](_0x3a38ab['query'][_0xf582('0x1f')]);_0x13a146[_0xf582('0x1d')]=qs[_0xf582('0x1d')](_0x3a38ab[_0xf582('0x32')]['offset']);}_0x13a146[_0xf582('0x39')]=qs[_0xf582('0x3a')](_0x3a38ab[_0xf582('0x32')][_0xf582('0x3a')]);_0x13a146[_0xf582('0x3b')]=qs[_0xf582('0x3c')](_[_0xf582('0x3d')](_0x3a38ab['query'],_0x254d3b['filters']),_0xf5bf24);if(_0x3a38ab['query'][_0xf582('0x3e')]){_0x13a146[_0xf582('0x3b')]=_[_0xf582('0x3f')](_0x13a146['where'],{'$or':_['map'](_0xf5bf24,function(_0x2ccaf4){if(_0x2ccaf4[_0xf582('0x40')]!=='VIRTUAL'){var _0x470b88={};_0x470b88[_0x2ccaf4[_0xf582('0x2a')]]={'$like':'%'+_0x3a38ab[_0xf582('0x32')]['filter']+'%'};return _0x470b88;}})});}_0x13a146=_[_0xf582('0x3f')]({},_0x13a146,_0x3a38ab[_0xf582('0x41')]);var _0x5dbb85={'where':_0x13a146[_0xf582('0x3b')]};return db[_0xf582('0x2d')][_0xf582('0x20')](_0x5dbb85)[_0xf582('0x27')](function(_0x3959b2){_0x12d359['count']=_0x3959b2;if(_0x3a38ab[_0xf582('0x32')][_0xf582('0x42')]){_0x13a146[_0xf582('0x43')]=[{'all':!![]}];}return db[_0xf582('0x2d')]['findAll'](_0x13a146);})['then'](function(_0x38225c){_0x12d359[_0xf582('0x44')]=_0x38225c;return _0x12d359;})[_0xf582('0x27')](respondWithFilteredResult(_0x5b720b,_0x13a146))[_0xf582('0x45')](handleError(_0x5b720b,null));};exports[_0xf582('0x46')]=function(_0x28f943,_0x2d81d5){var _0x3af192={'raw':!![],'where':{'id':_0x28f943[_0xf582('0x47')]['id']}},_0x4c56fa={};_0x4c56fa[_0xf582('0x31')]=_['keys'](db[_0xf582('0x2d')][_0xf582('0x2e')]);_0x4c56fa['query']=_[_0xf582('0x33')](_0x28f943[_0xf582('0x32')]);_0x4c56fa[_0xf582('0x3c')]=_[_0xf582('0x34')](_0x4c56fa[_0xf582('0x31')],_0x4c56fa['query']);_0x3af192[_0xf582('0x36')]=_[_0xf582('0x34')](_0x4c56fa['model'],qs['fields'](_0x28f943[_0xf582('0x32')][_0xf582('0x35')]));_0x3af192['attributes']=_0x3af192[_0xf582('0x36')][_0xf582('0x37')]?_0x3af192[_0xf582('0x36')]:_0x4c56fa[_0xf582('0x31')];if(_0x28f943['query'][_0xf582('0x42')]){_0x3af192[_0xf582('0x43')]=[{'all':!![]}];}_0x3af192=_[_0xf582('0x3f')]({},_0x3af192,_0x28f943[_0xf582('0x41')]);return db[_0xf582('0x2d')][_0xf582('0x48')](_0x3af192)[_0xf582('0x27')](handleEntityNotFound(_0x2d81d5,null))[_0xf582('0x27')](respondWithResult(_0x2d81d5,null))['catch'](handleError(_0x2d81d5,null));};exports[_0xf582('0x49')]=function(_0x69cb18,_0x243aab){return db[_0xf582('0x2d')][_0xf582('0x49')](_0x69cb18['body'],{})[_0xf582('0x27')](respondWithResult(_0x243aab,0xc9))['catch'](handleError(_0x243aab,null));};exports[_0xf582('0x26')]=function(_0x2c3bfd,_0x180190){if(_0x2c3bfd[_0xf582('0x4a')]['id']){delete _0x2c3bfd[_0xf582('0x4a')]['id'];}return db[_0xf582('0x2d')][_0xf582('0x48')]({'where':{'id':_0x2c3bfd['params']['id']}})['then'](handleEntityNotFound(_0x180190,null))[_0xf582('0x27')](saveUpdates(_0x2c3bfd[_0xf582('0x4a')],null))[_0xf582('0x27')](respondWithResult(_0x180190,null))[_0xf582('0x45')](handleError(_0x180190,null));};exports[_0xf582('0x28')]=function(_0x430163,_0x473e93){return db[_0xf582('0x2d')]['find']({'where':{'id':_0x430163[_0xf582('0x47')]['id']}})[_0xf582('0x27')](handleEntityNotFound(_0x473e93,null))[_0xf582('0x27')](removeEntity(_0x473e93,null))[_0xf582('0x45')](handleError(_0x473e93,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index aefb38d..e9bab29 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 _0x8269=['zendesk_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields'];(function(_0x7fa96,_0x2546be){var _0x4fea46=function(_0x208cbf){while(--_0x208cbf){_0x7fa96['push'](_0x7fa96['shift']());}};_0x4fea46(++_0x2546be);}(_0x8269,0x1d0));var _0x9826=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x8269[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x9826('0x0'));var util=require('util');var logger=require(_0x9826('0x1'))(_0x9826('0x2'));var moment=require(_0x9826('0x3'));var BPromise=require(_0x9826('0x4'));var rp=require(_0x9826('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9826('0x6'));var attributes=require(_0x9826('0x7'));module[_0x9826('0x8')]=function(_0x35871d,_0x293e72){return _0x35871d[_0x9826('0x9')](_0x9826('0xa'),attributes,{'tableName':_0x9826('0xb'),'paranoid':![],'indexes':[{'name':_0x9826('0xc'),'fields':['idField',_0x9826('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce6f=['../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','idField','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xce6f,0x14b));var _0xfce6=function(_0x19b1fa,_0x319e3f){_0x19b1fa=_0x19b1fa-0x0;var _0x5f224e=_0xce6f[_0x19b1fa];return _0x5f224e;};'use strict';var _=require('lodash');var util=require(_0xfce6('0x0'));var logger=require(_0xfce6('0x1'))(_0xfce6('0x2'));var moment=require(_0xfce6('0x3'));var BPromise=require('bluebird');var rp=require(_0xfce6('0x4'));var fs=require('fs');var path=require(_0xfce6('0x5'));var rimraf=require(_0xfce6('0x6'));var config=require(_0xfce6('0x7'));var attributes=require(_0xfce6('0x8'));module[_0xfce6('0x9')]=function(_0x4cd0aa,_0x1345fa){return _0x4cd0aa['define']('ZendeskField',attributes,{'tableName':_0xfce6('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xfce6('0xb'),_0xfce6('0xc')],'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 dd30d75..a87a791 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 _0x3495=['jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x578b8d,_0x373450){var _0x5a53ee=function(_0x5dff31){while(--_0x5dff31){_0x578b8d['push'](_0x578b8d['shift']());}};_0x5a53ee(++_0x373450);}(_0x3495,0x147));var _0x5349=function(_0x21bdba,_0x21e1fc){_0x21bdba=_0x21bdba-0x0;var _0x40daff=_0x3495[_0x21bdba];return _0x40daff;};'use strict';var _=require('lodash');var util=require(_0x5349('0x0'));var moment=require(_0x5349('0x1'));var BPromise=require('bluebird');var rs=require(_0x5349('0x2'));var fs=require('fs');var Redis=require(_0x5349('0x3'));var db=require(_0x5349('0x4'))['db'];var utils=require(_0x5349('0x5'));var logger=require(_0x5349('0x6'))(_0x5349('0x7'));var config=require(_0x5349('0x8'));var jayson=require(_0x5349('0x9'));var client=jayson[_0x5349('0xa')][_0x5349('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14e517,_0x5b5b69,_0x59a7b5){return new BPromise(function(_0xd95307,_0x1a37b4){return client[_0x5349('0xc')](_0x14e517,_0x59a7b5)[_0x5349('0xd')](function(_0x58eb18){logger[_0x5349('0xe')](_0x5349('0xf'),_0x5b5b69,'request\x20sent');logger['debug'](_0x5349('0x10'),_0x5b5b69,_0x5349('0x11'),JSON[_0x5349('0x12')](_0x58eb18));if(_0x58eb18[_0x5349('0x13')]){if(_0x58eb18['error'][_0x5349('0x14')]===0x1f4){logger['error'](_0x5349('0xf'),_0x5b5b69,_0x58eb18[_0x5349('0x13')][_0x5349('0x15')]);return _0x1a37b4(_0x58eb18[_0x5349('0x13')]['message']);}logger[_0x5349('0x13')](_0x5349('0xf'),_0x5b5b69,_0x58eb18[_0x5349('0x13')][_0x5349('0x15')]);return _0xd95307(_0x58eb18['error'][_0x5349('0x15')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x5b5b69,_0x5349('0x11'));_0xd95307(_0x58eb18[_0x5349('0x16')][_0x5349('0x15')]);}})[_0x5349('0x17')](function(_0x4d7099){logger['error'](_0x5349('0xf'),_0x5b5b69,_0x4d7099);_0x1a37b4(_0x4d7099);});});} \ No newline at end of file +var _0x6dbc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash'];(function(_0x4752aa,_0x204c2f){var _0x230988=function(_0x53825f){while(--_0x53825f){_0x4752aa['push'](_0x4752aa['shift']());}};_0x230988(++_0x204c2f);}(_0x6dbc,0x18f));var _0xc6db=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x6dbc[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0xc6db('0x0'));var util=require(_0xc6db('0x1'));var moment=require(_0xc6db('0x2'));var BPromise=require(_0xc6db('0x3'));var rs=require(_0xc6db('0x4'));var fs=require('fs');var Redis=require(_0xc6db('0x5'));var db=require(_0xc6db('0x6'))['db'];var utils=require(_0xc6db('0x7'));var logger=require(_0xc6db('0x8'))(_0xc6db('0x9'));var config=require(_0xc6db('0xa'));var jayson=require(_0xc6db('0xb'));var client=jayson[_0xc6db('0xc')][_0xc6db('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x29721e,_0x72d73d,_0xae5793){return new BPromise(function(_0x5cd17d,_0x554080){return client[_0xc6db('0xe')](_0x29721e,_0xae5793)[_0xc6db('0xf')](function(_0xd83bd1){logger[_0xc6db('0x10')](_0xc6db('0x11'),_0x72d73d,'request\x20sent');logger['debug'](_0xc6db('0x12'),_0x72d73d,'request\x20sent',JSON[_0xc6db('0x13')](_0xd83bd1));if(_0xd83bd1[_0xc6db('0x14')]){if(_0xd83bd1[_0xc6db('0x14')]['code']===0x1f4){logger[_0xc6db('0x14')](_0xc6db('0x11'),_0x72d73d,_0xd83bd1[_0xc6db('0x14')][_0xc6db('0x15')]);return _0x554080(_0xd83bd1[_0xc6db('0x14')][_0xc6db('0x15')]);}logger[_0xc6db('0x14')](_0xc6db('0x11'),_0x72d73d,_0xd83bd1[_0xc6db('0x14')][_0xc6db('0x15')]);return _0x5cd17d(_0xd83bd1[_0xc6db('0x14')][_0xc6db('0x15')]);}else{logger[_0xc6db('0x10')](_0xc6db('0x11'),_0x72d73d,_0xc6db('0x16'));_0x5cd17d(_0xd83bd1[_0xc6db('0x17')][_0xc6db('0x15')]);}})[_0xc6db('0x18')](function(_0x4d04a9){logger[_0xc6db('0x14')]('ZendeskField,\x20%s,\x20%s',_0x72d73d,_0x4d04a9);_0x554080(_0x4d04a9);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index b4849b1..2dcf6dc 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 _0xaf97=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf97,0x1a7));var _0x7af9=function(_0x5b0456,_0x39bd8d){_0x5b0456=_0x5b0456-0x0;var _0x591a22=_0xaf97[_0x5b0456];return _0x591a22;};'use strict';var multer=require(_0x7af9('0x0'));var util=require(_0x7af9('0x1'));var path=require(_0x7af9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7af9('0x3'));var router=express[_0x7af9('0x4')]();var fs_extra=require(_0x7af9('0x5'));var auth=require(_0x7af9('0x6'));var interaction=require(_0x7af9('0x7'));var config=require(_0x7af9('0x8'));var controller=require(_0x7af9('0x9'));router[_0x7af9('0xa')]('/',auth['isAuthenticated'](),controller[_0x7af9('0xb')]);router[_0x7af9('0xa')](_0x7af9('0xc'),auth[_0x7af9('0xd')](),controller[_0x7af9('0xe')]);router[_0x7af9('0xa')](_0x7af9('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x7af9('0xa')](_0x7af9('0x10'),auth[_0x7af9('0xd')](),controller[_0x7af9('0x11')]);router[_0x7af9('0x12')]('/',auth[_0x7af9('0xd')](),controller['create']);router[_0x7af9('0x12')]('/:id/configurations',auth[_0x7af9('0xd')](),controller[_0x7af9('0x13')]);router[_0x7af9('0x14')](_0x7af9('0xc'),auth['isAuthenticated'](),controller[_0x7af9('0x15')]);router[_0x7af9('0x16')](_0x7af9('0xc'),auth[_0x7af9('0xd')](),controller[_0x7af9('0x17')]);module[_0x7af9('0x18')]=router; \ No newline at end of file +var _0xb9b5=['exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','create','put','delete'];(function(_0x129afe,_0x2b5295){var _0x39b1a4=function(_0x41ad0f){while(--_0x41ad0f){_0x129afe['push'](_0x129afe['shift']());}};_0x39b1a4(++_0x2b5295);}(_0xb9b5,0x169));var _0x5b9b=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xb9b5[_0x2cf2e9];return _0xd3670d;};'use strict';var multer=require('multer');var util=require(_0x5b9b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5b9b('0x1'));var router=express[_0x5b9b('0x2')]();var fs_extra=require(_0x5b9b('0x3'));var auth=require(_0x5b9b('0x4'));var interaction=require(_0x5b9b('0x5'));var config=require(_0x5b9b('0x6'));var controller=require(_0x5b9b('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5b9b('0x8')](_0x5b9b('0x9'),auth[_0x5b9b('0xa')](),controller[_0x5b9b('0xb')]);router[_0x5b9b('0x8')](_0x5b9b('0xc'),auth[_0x5b9b('0xa')](),controller[_0x5b9b('0xd')]);router[_0x5b9b('0x8')]('/:id/fields',auth[_0x5b9b('0xa')](),controller[_0x5b9b('0xe')]);router[_0x5b9b('0xf')]('/',auth[_0x5b9b('0xa')](),controller[_0x5b9b('0x10')]);router['post'](_0x5b9b('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x5b9b('0x11')]('/:id',auth[_0x5b9b('0xa')](),controller['update']);router[_0x5b9b('0x12')](_0x5b9b('0x9'),auth[_0x5b9b('0xa')](),controller['destroy']);module[_0x5b9b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 5d98572..b368820 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(_0x466aeb,_0x3a35bf){var _0x57818e=function(_0x28ac49){while(--_0x28ac49){_0x466aeb['push'](_0x466aeb['shift']());}};_0x57818e(++_0x3a35bf);}(_0x34e8,0x12c));var _0x834e=function(_0x3c8370,_0x23f6c4){_0x3c8370=_0x3c8370-0x0;var _0x5bc64e=_0x34e8[_0x3c8370];return _0x5bc64e;};'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 _0x00bb=['STRING','sequelize','exports'];(function(_0x45145d,_0x5aaea3){var _0x131ab1=function(_0x6fa534){while(--_0x6fa534){_0x45145d['push'](_0x45145d['shift']());}};_0x131ab1(++_0x5aaea3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x00bb[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c9c3352..99acb15 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 _0x576b=['find','create','body','getConfigurations','findOne','ZohoConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','serverUrl','code','refreshToken','com','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','response','message','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','ZohoAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','params','options'];(function(_0x144fd2,_0x1b9368){var _0x3453bc=function(_0x1c2c8f){while(--_0x1c2c8f){_0x144fd2['push'](_0x144fd2['shift']());}};_0x3453bc(++_0x1b9368);}(_0x576b,0x1b0));var _0xb576=function(_0x4ff36d,_0xf34292){_0x4ff36d=_0x4ff36d-0x0;var _0xec825=_0x576b[_0x4ff36d];return _0xec825;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb576('0x0'));var zipdir=require(_0xb576('0x1'));var jsonpatch=require(_0xb576('0x2'));var rp=require(_0xb576('0x3'));var moment=require(_0xb576('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb576('0x5'));var util=require('util');var path=require(_0xb576('0x6'));var sox=require(_0xb576('0x7'));var csv=require('to-csv');var ejs=require(_0xb576('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb576('0x9'));var squel=require(_0xb576('0xa'));var crypto=require(_0xb576('0xb'));var jsforce=require(_0xb576('0xc'));var deskjs=require(_0xb576('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb576('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb576('0xf'));var as=require(_0xb576('0x10'));var hardwareService=require(_0xb576('0x11'));var logger=require('../../config/logger')(_0xb576('0x12'));var utils=require('../../config/utils');var config=require(_0xb576('0x13'));var licenseUtil=require(_0xb576('0x14'));var db=require(_0xb576('0x15'))['db'];var integrations=require(_0xb576('0x16'));function respondWithStatusCode(_0x176264,_0x3b439f){_0x3b439f=_0x3b439f||0xcc;return function(_0x2cd96f){if(_0x2cd96f){return _0x176264[_0xb576('0x17')](_0x3b439f);}return _0x176264['status'](_0x3b439f)['end']();};}function respondWithResult(_0x5e5757,_0x530e24){_0x530e24=_0x530e24||0xc8;return function(_0x427ec9){if(_0x427ec9){return _0x5e5757[_0xb576('0x18')](_0x530e24)[_0xb576('0x19')](_0x427ec9);}};}function respondWithFilteredResult(_0x1fe638,_0x538622){return function(_0x27701c){if(_0x27701c){var _0x48b3d7=typeof _0x538622[_0xb576('0x1a')]==='undefined'&&typeof _0x538622[_0xb576('0x1b')]===_0xb576('0x1c');var _0x40bed8=_0x27701c[_0xb576('0x1d')];var _0x88a705=_0x48b3d7?0x0:_0x538622[_0xb576('0x1a')];var _0x7222da=_0x48b3d7?_0x27701c[_0xb576('0x1d')]:_0x538622[_0xb576('0x1a')]+_0x538622[_0xb576('0x1b')];var _0x854066;if(_0x7222da>=_0x40bed8){_0x7222da=_0x40bed8;_0x854066=0xc8;}else{_0x854066=0xce;}_0x1fe638[_0xb576('0x18')](_0x854066);return _0x1fe638[_0xb576('0x1e')](_0xb576('0x1f'),_0x88a705+'-'+_0x7222da+'/'+_0x40bed8)[_0xb576('0x19')](_0x27701c);}return null;};}function patchUpdates(_0x4c8516){return function(_0x47bb6a){try{jsonpatch[_0xb576('0x20')](_0x47bb6a,_0x4c8516,!![]);}catch(_0x445903){return BPromise[_0xb576('0x21')](_0x445903);}return _0x47bb6a[_0xb576('0x22')]();};}function saveUpdates(_0x317461,_0x1cdd41){return function(_0x173d30){if(_0x173d30){return _0x173d30[_0xb576('0x23')](_0x317461)[_0xb576('0x24')](function(_0x223c32){return _0x223c32;});}return null;};}function removeEntity(_0x48b9d3,_0x583ed8){return function(_0x5d51bf){if(_0x5d51bf){return _0x5d51bf[_0xb576('0x25')]()['then'](function(){_0x48b9d3['status'](0xcc)[_0xb576('0x26')]();});}};}function handleEntityNotFound(_0xcf0dc,_0x30e3ff){return function(_0x179848){if(!_0x179848){_0xcf0dc[_0xb576('0x17')](0x194);}return _0x179848;};}function handleError(_0x32ea0c,_0x6e8830){_0x6e8830=_0x6e8830||0x1f4;return function(_0x18c2ac){logger[_0xb576('0x27')](_0x18c2ac['stack']);if(_0x18c2ac[_0xb576('0x28')]){delete _0x18c2ac[_0xb576('0x28')];}_0x32ea0c[_0xb576('0x18')](_0x6e8830)['send'](_0x18c2ac);};}exports[_0xb576('0x29')]=function(_0x54ad79,_0x33bd17){var _0x34b618={},_0x2d39bc={},_0x5f4ad8={'count':0x0,'rows':[]};var _0x3d6972=_[_0xb576('0x2a')](db[_0xb576('0x2b')][_0xb576('0x2c')],function(_0x82013d){return{'name':_0x82013d['fieldName'],'type':_0x82013d[_0xb576('0x2d')]['key']};});_0x2d39bc[_0xb576('0x2e')]=_[_0xb576('0x2a')](_0x3d6972,_0xb576('0x28'));_0x2d39bc[_0xb576('0x2f')]=_[_0xb576('0x30')](_0x54ad79[_0xb576('0x2f')]);_0x2d39bc[_0xb576('0x31')]=_[_0xb576('0x32')](_0x2d39bc['model'],_0x2d39bc[_0xb576('0x2f')]);_0x34b618[_0xb576('0x33')]=_[_0xb576('0x32')](_0x2d39bc[_0xb576('0x2e')],qs[_0xb576('0x34')](_0x54ad79[_0xb576('0x2f')][_0xb576('0x34')]));_0x34b618[_0xb576('0x33')]=_0x34b618[_0xb576('0x33')][_0xb576('0x35')]?_0x34b618['attributes']:_0x2d39bc[_0xb576('0x2e')];if(!_0x54ad79[_0xb576('0x2f')][_0xb576('0x36')]('nolimit')){_0x34b618[_0xb576('0x1b')]=qs['limit'](_0x54ad79[_0xb576('0x2f')][_0xb576('0x1b')]);_0x34b618[_0xb576('0x1a')]=qs[_0xb576('0x1a')](_0x54ad79['query'][_0xb576('0x1a')]);}_0x34b618[_0xb576('0x37')]=qs[_0xb576('0x38')](_0x54ad79[_0xb576('0x2f')]['sort']);_0x34b618[_0xb576('0x39')]=qs['filters'](_[_0xb576('0x3a')](_0x54ad79['query'],_0x2d39bc[_0xb576('0x31')]),_0x3d6972);if(_0x54ad79[_0xb576('0x2f')][_0xb576('0x3b')]){_0x34b618['where']=_['merge'](_0x34b618[_0xb576('0x39')],{'$or':_[_0xb576('0x2a')](_0x3d6972,function(_0x14b846){if(_0x14b846[_0xb576('0x2d')]!==_0xb576('0x3c')){var _0xbf70b2={};_0xbf70b2[_0x14b846[_0xb576('0x28')]]={'$like':'%'+_0x54ad79[_0xb576('0x2f')][_0xb576('0x3b')]+'%'};return _0xbf70b2;}})});}_0x34b618=_[_0xb576('0x3d')]({},_0x34b618,_0x54ad79['options']);var _0x2f1c26={'where':_0x34b618[_0xb576('0x39')]};return db[_0xb576('0x2b')][_0xb576('0x1d')](_0x2f1c26)[_0xb576('0x24')](function(_0x36a730){_0x5f4ad8['count']=_0x36a730;if(_0x54ad79[_0xb576('0x2f')][_0xb576('0x3e')]){_0x34b618[_0xb576('0x3f')]=[{'all':!![]}];}return db[_0xb576('0x2b')][_0xb576('0x40')](_0x34b618);})[_0xb576('0x24')](function(_0x4da75b){_0x5f4ad8['rows']=_0x4da75b;return _0x5f4ad8;})[_0xb576('0x24')](respondWithFilteredResult(_0x33bd17,_0x34b618))[_0xb576('0x41')](handleError(_0x33bd17,null));};exports['show']=function(_0x13c74c,_0x4eb566){var _0x1ed7f4={'raw':![],'where':{'id':_0x13c74c[_0xb576('0x42')]['id']}},_0x5b1d7d={};_0x5b1d7d[_0xb576('0x2e')]=_['keys'](db[_0xb576('0x2b')][_0xb576('0x2c')]);_0x5b1d7d[_0xb576('0x2f')]=_['keys'](_0x13c74c[_0xb576('0x2f')]);_0x5b1d7d[_0xb576('0x31')]=_[_0xb576('0x32')](_0x5b1d7d[_0xb576('0x2e')],_0x5b1d7d[_0xb576('0x2f')]);_0x1ed7f4[_0xb576('0x33')]=_[_0xb576('0x32')](_0x5b1d7d[_0xb576('0x2e')],qs[_0xb576('0x34')](_0x13c74c[_0xb576('0x2f')][_0xb576('0x34')]));_0x1ed7f4[_0xb576('0x33')]=_0x1ed7f4['attributes']['length']?_0x1ed7f4['attributes']:_0x5b1d7d[_0xb576('0x2e')];if(_0x13c74c['query'][_0xb576('0x3e')]){_0x1ed7f4[_0xb576('0x3f')]=[{'all':!![]}];}_0x1ed7f4=_[_0xb576('0x3d')]({},_0x1ed7f4,_0x13c74c[_0xb576('0x43')]);return db[_0xb576('0x2b')][_0xb576('0x44')](_0x1ed7f4)[_0xb576('0x24')](handleEntityNotFound(_0x4eb566,null))[_0xb576('0x24')](respondWithResult(_0x4eb566,null))[_0xb576('0x41')](handleError(_0x4eb566,null));};exports[_0xb576('0x45')]=function(_0x38e1f4,_0x1072dc){return db[_0xb576('0x2b')][_0xb576('0x45')](_0x38e1f4[_0xb576('0x46')],{})['then'](respondWithResult(_0x1072dc,0xc9))['catch'](handleError(_0x1072dc,null));};exports['update']=function(_0x5a1996,_0x43095a){if(_0x5a1996[_0xb576('0x46')]['id']){delete _0x5a1996[_0xb576('0x46')]['id'];}return db['ZohoAccount'][_0xb576('0x44')]({'where':{'id':_0x5a1996[_0xb576('0x42')]['id']}})[_0xb576('0x24')](handleEntityNotFound(_0x43095a,null))['then'](saveUpdates(_0x5a1996[_0xb576('0x46')],null))[_0xb576('0x24')](respondWithResult(_0x43095a,null))[_0xb576('0x41')](handleError(_0x43095a,null));};exports[_0xb576('0x25')]=function(_0x6f75e3,_0x6754ab){return db[_0xb576('0x2b')][_0xb576('0x44')]({'where':{'id':_0x6f75e3[_0xb576('0x42')]['id']}})[_0xb576('0x24')](handleEntityNotFound(_0x6754ab,null))['then'](removeEntity(_0x6754ab,null))[_0xb576('0x41')](handleError(_0x6754ab,null));};exports[_0xb576('0x47')]=function(_0xb67484,_0x57477f,_0x160166){var _0x56be0e={};var _0x5f483b={};var _0x45e5d3;var _0x46c5bc;return db['ZohoAccount'][_0xb576('0x48')]({'where':{'id':_0xb67484[_0xb576('0x42')]['id']}})[_0xb576('0x24')](handleEntityNotFound(_0x57477f,null))[_0xb576('0x24')](function(_0xe67afa){if(_0xe67afa){_0x45e5d3=_0xe67afa;_0x5f483b['model']=_[_0xb576('0x30')](db[_0xb576('0x49')][_0xb576('0x2c')]);_0x5f483b[_0xb576('0x2f')]=_[_0xb576('0x30')](_0xb67484[_0xb576('0x2f')]);_0x5f483b[_0xb576('0x31')]=_[_0xb576('0x32')](_0x5f483b[_0xb576('0x2e')],_0x5f483b[_0xb576('0x2f')]);_0x56be0e[_0xb576('0x33')]=_['intersection'](_0x5f483b[_0xb576('0x2e')],qs[_0xb576('0x34')](_0xb67484[_0xb576('0x2f')][_0xb576('0x34')]));_0x56be0e[_0xb576('0x33')]=_0x56be0e['attributes']['length']?_0x56be0e[_0xb576('0x33')]:_0x5f483b[_0xb576('0x2e')];_0x56be0e[_0xb576('0x37')]=qs[_0xb576('0x38')](_0xb67484[_0xb576('0x2f')]['sort']);_0x56be0e[_0xb576('0x39')]=qs[_0xb576('0x31')](_[_0xb576('0x3a')](_0xb67484[_0xb576('0x2f')],_0x5f483b[_0xb576('0x31')]));if(_0xb67484[_0xb576('0x2f')][_0xb576('0x3b')]){_0x56be0e[_0xb576('0x39')]=_[_0xb576('0x3d')](_0x56be0e[_0xb576('0x39')],{'$or':_[_0xb576('0x2a')](_0x56be0e['attributes'],function(_0x1236f3){var _0x5e223b={};_0x5e223b[_0x1236f3]={'$like':'%'+_0xb67484['query']['filter']+'%'};return _0x5e223b;})});}_0x56be0e=_[_0xb576('0x3d')]({},_0x56be0e,_0xb67484[_0xb576('0x43')]);return _0x45e5d3[_0xb576('0x47')](_0x56be0e);}})[_0xb576('0x24')](function(_0x372f1b){if(_0x372f1b){_0x46c5bc=_0x372f1b[_0xb576('0x35')];if(!_0xb67484['query'][_0xb576('0x36')](_0xb576('0x4a'))){_0x56be0e[_0xb576('0x1b')]=qs['limit'](_0xb67484[_0xb576('0x2f')][_0xb576('0x1b')]);_0x56be0e[_0xb576('0x1a')]=qs[_0xb576('0x1a')](_0xb67484[_0xb576('0x2f')][_0xb576('0x1a')]);}return _0x45e5d3[_0xb576('0x47')](_0x56be0e);}})[_0xb576('0x24')](function(_0x5016ff){if(_0x5016ff){return _0x5016ff?{'count':_0x46c5bc,'rows':_0x5016ff}:null;}})['then'](respondWithResult(_0x57477f,null))[_0xb576('0x41')](handleError(_0x57477f,null));};exports[_0xb576('0x4b')]=function(_0x152f21,_0x49fe54,_0x2ee006){if(_0x152f21['body']['id']){delete _0x152f21['body']['id'];}return db[_0xb576('0x2b')][_0xb576('0x48')]({'where':{'id':_0x152f21[_0xb576('0x42')]['id']}})[_0xb576('0x24')](handleEntityNotFound(_0x49fe54,null))[_0xb576('0x24')](function(_0x23d273){if(_0x23d273){_0x152f21[_0xb576('0x46')][_0xb576('0x4c')]=_0x23d273['id'];_0x152f21['body'][_0xb576('0x4d')]=integrations[_0xb576('0x4e')](_0x152f21[_0xb576('0x46')][_0xb576('0x4f')],_0x152f21[_0xb576('0x46')][_0xb576('0x2d')]);_0x152f21[_0xb576('0x46')][_0xb576('0x50')]=integrations[_0xb576('0x51')](_0x152f21[_0xb576('0x46')][_0xb576('0x4f')],_0x152f21[_0xb576('0x46')][_0xb576('0x2d')]);return db[_0xb576('0x49')][_0xb576('0x45')](_0x152f21['body'],{'include':[{'model':db[_0xb576('0x52')],'as':_0xb576('0x4d')},{'model':db[_0xb576('0x52')],'as':_0xb576('0x50')}]});}return null;})['then'](respondWithResult(_0x49fe54,null))['catch'](handleError(_0x49fe54,null));};function getAccessToken(_0x25cd2a){return new Promise(function(_0x3b3df0,_0x105528){var _0x2b7cbe;switch(_0x25cd2a['zone']){case'US':_0x2b7cbe='https://accounts.zoho.com';break;case'AU':_0x2b7cbe=_0xb576('0x53');break;case'EU':_0x2b7cbe=_0xb576('0x54');break;case'IN':_0x2b7cbe=_0xb576('0x55');break;case'CN':_0x2b7cbe=_0xb576('0x56');break;default:_0x2b7cbe=_0xb576('0x54');break;}var _0x493bd0={'method':_0xb576('0x57'),'uri':_0x2b7cbe+_0xb576('0x58'),'qs':{'refresh_token':_0x25cd2a['refreshToken'],'client_id':_0x25cd2a[_0xb576('0x59')],'client_secret':_0x25cd2a[_0xb576('0x5a')],'grant_type':_0xb576('0x5b')},'json':!![]};return rp(_0x493bd0)[_0xb576('0x24')](function(_0x90fff8){if(_0x90fff8[_0xb576('0x5c')]){_0x3b3df0(_0x90fff8[_0xb576('0x5c')]);}else{_0x105528(_0xb576('0x5d'));}})[_0xb576('0x41')](function(_0x1a296c){_0x105528(_0x1a296c);});});}exports['getFields']=function(_0x451421,_0x241d3c,_0xa78255){var _0x116748,_0x57fc2f,_0x4f192b,_0x3a5c5d,_0x5e0028;return db['ZohoAccount'][_0xb576('0x48')]({'where':{'id':_0x451421[_0xb576('0x42')]['id']},'attributes':['id',_0xb576('0x5e'),_0xb576('0x5f'),_0xb576('0x59'),'clientSecret',_0xb576('0x60'),_0xb576('0x61'),_0xb576('0x62')]})[_0xb576('0x24')](handleEntityNotFound(_0x241d3c,null))[_0xb576('0x24')](function(_0x208fea){_0x5e0028=_0x208fea;_0x116748=_0x5e0028[_0xb576('0x5e')];_0x57fc2f=_0x116748==='zoho.eu'?'eu':_0xb576('0x63');_0x4f192b=_0x5e0028[_0xb576('0x60')];var _0x41c845=_0x4f192b['slice'](-0x1);if(_0x41c845==='/'||_0x41c845==='\x5c'||_0x41c845===':'){_0x4f192b=_0x4f192b['substring'](0x0,_0x4f192b[_0xb576('0x64')](_0x41c845));}if(!_0x5e0028[_0xb576('0x62')]){throw new Error(_0xb576('0x65'));}return getAccessToken(_0x5e0028);})[_0xb576('0x24')](function(_0x13fe54){if(_0x13fe54){return rp({'method':_0xb576('0x66'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x57fc2f),'qs':{'module':_0xb576('0x67')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x13fe54},'json':!![]});}})[_0xb576('0x24')](function(_0x25d33e){if(_0x25d33e){if(_0x25d33e[_0xb576('0x68')]&&_0x25d33e[_0xb576('0x68')][_0xb576('0x27')]){throw new Error(_0x25d33e[_0xb576('0x68')][_0xb576('0x27')][_0xb576('0x69')]);}var _0x3a03ba=[];var _0x58e1c7=[];var _0xf9f63f=[_0xb576('0x6a'),_0xb576('0x6b'),'Description',_0xb576('0x6c'),_0xb576('0x6d'),_0xb576('0x6e'),_0xb576('0x6f'),'Call_Type'];_0x58e1c7=_['remove'](_0x25d33e[_0xb576('0x34')],function(_0x558025){return _0xf9f63f[_0xb576('0x70')](_0x558025[_0xb576('0x71')]);});for(var _0x3d653a=0x0;_0x3d653a<_0x58e1c7['length'];_0x3d653a++){if(_0x58e1c7[_0x3d653a][_0xb576('0x72')]===![]){_0x3a03ba[_0xb576('0x73')]({'id':_0x58e1c7[_0x3d653a]['id'],'name':_0x58e1c7[_0x3d653a][_0xb576('0x74')],'custom':_0x58e1c7[_0x3d653a][_0xb576('0x75')],'options':_0x58e1c7[_0x3d653a][_0xb576('0x76')]==='picklist'&&_0x58e1c7[_0x3d653a]['pick_list_values'][_0xb576('0x35')]>-0x1?_[_0xb576('0x2a')](_0x58e1c7[_0x3d653a]['pick_list_values'],function(_0x5e7c49){return{'name':_0x5e7c49,'value':_0x5e7c49};}):[]});}}return{'count':_0x3a03ba[_0xb576('0x35')],'rows':_0x3a03ba};}else{return{'count':0x0,'rows':[]};}})[_0xb576('0x24')](respondWithResult(_0x241d3c,null))[_0xb576('0x41')](function(_0x3f1c57){var _0x2b00d5=_0x451421[_0xb576('0x2f')][_0xb576('0x77')]?0x1f4:_0x3f1c57[_0xb576('0x78')]||0x1f4;logger[_0xb576('0x27')](_0xb576('0x79'),_0xb576('0x7a'),_0x2b00d5,JSON[_0xb576('0x7b')](_0x3f1c57));delete _0x3f1c57['name'];if(_0x2b00d5===0x191){_0x2b00d5=0x190;}_0x241d3c[_0xb576('0x18')](_0x2b00d5)[_0xb576('0x7c')](_0x451421[_0xb576('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3f1c57[_0xb576('0x78')]}:_0x3f1c57);});}; \ No newline at end of file +var _0x01cf=['Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','ZohoAccount','rawAttributes','key','map','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoConfiguration','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','WhoId','Call_Duration','Call_Result','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test'];(function(_0x3929b2,_0xa46a51){var _0x20b0bc=function(_0x2fd8c0){while(--_0x2fd8c0){_0x3929b2['push'](_0x3929b2['shift']());}};_0x20b0bc(++_0xa46a51);}(_0x01cf,0x87));var _0xf01c=function(_0x95f3ba,_0xcc8cbf){_0x95f3ba=_0x95f3ba-0x0;var _0x221d6f=_0x01cf[_0x95f3ba];return _0x221d6f;};'use strict';var emlformat=require(_0xf01c('0x0'));var rimraf=require(_0xf01c('0x1'));var zipdir=require(_0xf01c('0x2'));var jsonpatch=require(_0xf01c('0x3'));var rp=require('request-promise');var moment=require(_0xf01c('0x4'));var BPromise=require(_0xf01c('0x5'));var Mustache=require(_0xf01c('0x6'));var util=require(_0xf01c('0x7'));var path=require(_0xf01c('0x8'));var sox=require(_0xf01c('0x9'));var csv=require(_0xf01c('0xa'));var ejs=require(_0xf01c('0xb'));var fs=require('fs');var fs_extra=require(_0xf01c('0xc'));var _=require(_0xf01c('0xd'));var squel=require(_0xf01c('0xe'));var crypto=require(_0xf01c('0xf'));var jsforce=require(_0xf01c('0x10'));var deskjs=require(_0xf01c('0x11'));var toCsv=require(_0xf01c('0xa'));var querystring=require(_0xf01c('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf01c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf01c('0x14'));var logger=require(_0xf01c('0x15'))(_0xf01c('0x16'));var utils=require(_0xf01c('0x17'));var config=require(_0xf01c('0x18'));var licenseUtil=require(_0xf01c('0x19'));var db=require(_0xf01c('0x1a'))['db'];var integrations=require(_0xf01c('0x1b'));function respondWithStatusCode(_0x1e67e5,_0x463b94){_0x463b94=_0x463b94||0xcc;return function(_0x308535){if(_0x308535){return _0x1e67e5[_0xf01c('0x1c')](_0x463b94);}return _0x1e67e5[_0xf01c('0x1d')](_0x463b94)[_0xf01c('0x1e')]();};}function respondWithResult(_0x2dcebd,_0x4e455b){_0x4e455b=_0x4e455b||0xc8;return function(_0xe1c601){if(_0xe1c601){return _0x2dcebd[_0xf01c('0x1d')](_0x4e455b)['json'](_0xe1c601);}};}function respondWithFilteredResult(_0x5b2b71,_0x3d907c){return function(_0x173b33){if(_0x173b33){var _0x38faf1=typeof _0x3d907c[_0xf01c('0x1f')]===_0xf01c('0x20')&&typeof _0x3d907c[_0xf01c('0x21')]===_0xf01c('0x20');var _0x91180d=_0x173b33[_0xf01c('0x22')];var _0x44286e=_0x38faf1?0x0:_0x3d907c['offset'];var _0x4a5e00=_0x38faf1?_0x173b33[_0xf01c('0x22')]:_0x3d907c[_0xf01c('0x1f')]+_0x3d907c['limit'];var _0x40c654;if(_0x4a5e00>=_0x91180d){_0x4a5e00=_0x91180d;_0x40c654=0xc8;}else{_0x40c654=0xce;}_0x5b2b71[_0xf01c('0x1d')](_0x40c654);return _0x5b2b71[_0xf01c('0x23')](_0xf01c('0x24'),_0x44286e+'-'+_0x4a5e00+'/'+_0x91180d)[_0xf01c('0x25')](_0x173b33);}return null;};}function patchUpdates(_0x591a56){return function(_0x23491f){try{jsonpatch['apply'](_0x23491f,_0x591a56,!![]);}catch(_0x4aefdb){return BPromise[_0xf01c('0x26')](_0x4aefdb);}return _0x23491f[_0xf01c('0x27')]();};}function saveUpdates(_0x1e210d,_0x11b30c){return function(_0x213fd4){if(_0x213fd4){return _0x213fd4[_0xf01c('0x28')](_0x1e210d)[_0xf01c('0x29')](function(_0x43fbeb){return _0x43fbeb;});}return null;};}function removeEntity(_0x12b943,_0x1c2513){return function(_0x47055d){if(_0x47055d){return _0x47055d[_0xf01c('0x2a')]()[_0xf01c('0x29')](function(){_0x12b943[_0xf01c('0x1d')](0xcc)[_0xf01c('0x1e')]();});}};}function handleEntityNotFound(_0x28c71a,_0x38875b){return function(_0x2e528d){if(!_0x2e528d){_0x28c71a['sendStatus'](0x194);}return _0x2e528d;};}function handleError(_0x3cdf13,_0x24242b){_0x24242b=_0x24242b||0x1f4;return function(_0x25e1a7){logger[_0xf01c('0x2b')](_0x25e1a7[_0xf01c('0x2c')]);if(_0x25e1a7[_0xf01c('0x2d')]){delete _0x25e1a7['name'];}_0x3cdf13[_0xf01c('0x1d')](_0x24242b)[_0xf01c('0x2e')](_0x25e1a7);};}exports['index']=function(_0x5b94b0,_0x1cb3b7){var _0x139ed2={},_0x10cde8={},_0x938c08={'count':0x0,'rows':[]};var _0x5646eb=_['map'](db[_0xf01c('0x2f')][_0xf01c('0x30')],function(_0x1a780c){return{'name':_0x1a780c['fieldName'],'type':_0x1a780c['type'][_0xf01c('0x31')]};});_0x10cde8['model']=_[_0xf01c('0x32')](_0x5646eb,_0xf01c('0x2d'));_0x10cde8['query']=_[_0xf01c('0x33')](_0x5b94b0[_0xf01c('0x34')]);_0x10cde8[_0xf01c('0x35')]=_['intersection'](_0x10cde8[_0xf01c('0x36')],_0x10cde8[_0xf01c('0x34')]);_0x139ed2[_0xf01c('0x37')]=_[_0xf01c('0x38')](_0x10cde8[_0xf01c('0x36')],qs[_0xf01c('0x39')](_0x5b94b0['query'][_0xf01c('0x39')]));_0x139ed2[_0xf01c('0x37')]=_0x139ed2[_0xf01c('0x37')][_0xf01c('0x3a')]?_0x139ed2[_0xf01c('0x37')]:_0x10cde8[_0xf01c('0x36')];if(!_0x5b94b0[_0xf01c('0x34')]['hasOwnProperty'](_0xf01c('0x3b'))){_0x139ed2[_0xf01c('0x21')]=qs[_0xf01c('0x21')](_0x5b94b0[_0xf01c('0x34')][_0xf01c('0x21')]);_0x139ed2[_0xf01c('0x1f')]=qs[_0xf01c('0x1f')](_0x5b94b0[_0xf01c('0x34')][_0xf01c('0x1f')]);}_0x139ed2[_0xf01c('0x3c')]=qs[_0xf01c('0x3d')](_0x5b94b0['query'][_0xf01c('0x3d')]);_0x139ed2[_0xf01c('0x3e')]=qs[_0xf01c('0x35')](_[_0xf01c('0x3f')](_0x5b94b0[_0xf01c('0x34')],_0x10cde8[_0xf01c('0x35')]),_0x5646eb);if(_0x5b94b0['query'][_0xf01c('0x40')]){_0x139ed2[_0xf01c('0x3e')]=_[_0xf01c('0x41')](_0x139ed2[_0xf01c('0x3e')],{'$or':_[_0xf01c('0x32')](_0x5646eb,function(_0x3d1b2f){if(_0x3d1b2f[_0xf01c('0x42')]!==_0xf01c('0x43')){var _0x10b09d={};_0x10b09d[_0x3d1b2f['name']]={'$like':'%'+_0x5b94b0[_0xf01c('0x34')][_0xf01c('0x40')]+'%'};return _0x10b09d;}})});}_0x139ed2=_[_0xf01c('0x41')]({},_0x139ed2,_0x5b94b0[_0xf01c('0x44')]);var _0x3dfa55={'where':_0x139ed2[_0xf01c('0x3e')]};return db['ZohoAccount']['count'](_0x3dfa55)['then'](function(_0x1c139a){_0x938c08[_0xf01c('0x22')]=_0x1c139a;if(_0x5b94b0['query']['includeAll']){_0x139ed2[_0xf01c('0x45')]=[{'all':!![]}];}return db['ZohoAccount'][_0xf01c('0x46')](_0x139ed2);})[_0xf01c('0x29')](function(_0x393a03){_0x938c08[_0xf01c('0x47')]=_0x393a03;return _0x938c08;})[_0xf01c('0x29')](respondWithFilteredResult(_0x1cb3b7,_0x139ed2))[_0xf01c('0x48')](handleError(_0x1cb3b7,null));};exports[_0xf01c('0x49')]=function(_0x1cc94d,_0xc82046){var _0x1f72f6={'raw':![],'where':{'id':_0x1cc94d[_0xf01c('0x4a')]['id']}},_0x11550d={};_0x11550d['model']=_['keys'](db['ZohoAccount'][_0xf01c('0x30')]);_0x11550d[_0xf01c('0x34')]=_[_0xf01c('0x33')](_0x1cc94d[_0xf01c('0x34')]);_0x11550d[_0xf01c('0x35')]=_[_0xf01c('0x38')](_0x11550d[_0xf01c('0x36')],_0x11550d[_0xf01c('0x34')]);_0x1f72f6[_0xf01c('0x37')]=_[_0xf01c('0x38')](_0x11550d[_0xf01c('0x36')],qs[_0xf01c('0x39')](_0x1cc94d[_0xf01c('0x34')]['fields']));_0x1f72f6['attributes']=_0x1f72f6['attributes'][_0xf01c('0x3a')]?_0x1f72f6[_0xf01c('0x37')]:_0x11550d[_0xf01c('0x36')];if(_0x1cc94d[_0xf01c('0x34')][_0xf01c('0x4b')]){_0x1f72f6[_0xf01c('0x45')]=[{'all':!![]}];}_0x1f72f6=_[_0xf01c('0x41')]({},_0x1f72f6,_0x1cc94d[_0xf01c('0x44')]);return db[_0xf01c('0x2f')][_0xf01c('0x4c')](_0x1f72f6)[_0xf01c('0x29')](handleEntityNotFound(_0xc82046,null))[_0xf01c('0x29')](respondWithResult(_0xc82046,null))['catch'](handleError(_0xc82046,null));};exports[_0xf01c('0x4d')]=function(_0x37a0d6,_0x583729){return db[_0xf01c('0x2f')][_0xf01c('0x4d')](_0x37a0d6[_0xf01c('0x4e')],{})[_0xf01c('0x29')](respondWithResult(_0x583729,0xc9))[_0xf01c('0x48')](handleError(_0x583729,null));};exports[_0xf01c('0x28')]=function(_0x12bba3,_0x74d412){if(_0x12bba3['body']['id']){delete _0x12bba3['body']['id'];}return db[_0xf01c('0x2f')][_0xf01c('0x4c')]({'where':{'id':_0x12bba3[_0xf01c('0x4a')]['id']}})[_0xf01c('0x29')](handleEntityNotFound(_0x74d412,null))[_0xf01c('0x29')](saveUpdates(_0x12bba3[_0xf01c('0x4e')],null))['then'](respondWithResult(_0x74d412,null))[_0xf01c('0x48')](handleError(_0x74d412,null));};exports[_0xf01c('0x2a')]=function(_0x4bd6a9,_0x247781){return db['ZohoAccount'][_0xf01c('0x4c')]({'where':{'id':_0x4bd6a9[_0xf01c('0x4a')]['id']}})[_0xf01c('0x29')](handleEntityNotFound(_0x247781,null))[_0xf01c('0x29')](removeEntity(_0x247781,null))[_0xf01c('0x48')](handleError(_0x247781,null));};exports['getConfigurations']=function(_0x31ecc7,_0x3dab02,_0x4b1253){var _0x1a43d6={};var _0x377c31={};var _0x1f71f9;var _0x4a6c68;return db[_0xf01c('0x2f')]['findOne']({'where':{'id':_0x31ecc7[_0xf01c('0x4a')]['id']}})[_0xf01c('0x29')](handleEntityNotFound(_0x3dab02,null))['then'](function(_0x1517e2){if(_0x1517e2){_0x1f71f9=_0x1517e2;_0x377c31[_0xf01c('0x36')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x377c31['query']=_[_0xf01c('0x33')](_0x31ecc7[_0xf01c('0x34')]);_0x377c31[_0xf01c('0x35')]=_['intersection'](_0x377c31['model'],_0x377c31['query']);_0x1a43d6[_0xf01c('0x37')]=_[_0xf01c('0x38')](_0x377c31['model'],qs[_0xf01c('0x39')](_0x31ecc7[_0xf01c('0x34')][_0xf01c('0x39')]));_0x1a43d6[_0xf01c('0x37')]=_0x1a43d6[_0xf01c('0x37')][_0xf01c('0x3a')]?_0x1a43d6[_0xf01c('0x37')]:_0x377c31[_0xf01c('0x36')];_0x1a43d6[_0xf01c('0x3c')]=qs[_0xf01c('0x3d')](_0x31ecc7[_0xf01c('0x34')][_0xf01c('0x3d')]);_0x1a43d6[_0xf01c('0x3e')]=qs['filters'](_['pick'](_0x31ecc7[_0xf01c('0x34')],_0x377c31['filters']));if(_0x31ecc7['query'][_0xf01c('0x40')]){_0x1a43d6['where']=_[_0xf01c('0x41')](_0x1a43d6[_0xf01c('0x3e')],{'$or':_['map'](_0x1a43d6[_0xf01c('0x37')],function(_0x2e3324){var _0x3f9cc9={};_0x3f9cc9[_0x2e3324]={'$like':'%'+_0x31ecc7[_0xf01c('0x34')]['filter']+'%'};return _0x3f9cc9;})});}_0x1a43d6=_[_0xf01c('0x41')]({},_0x1a43d6,_0x31ecc7[_0xf01c('0x44')]);return _0x1f71f9['getConfigurations'](_0x1a43d6);}})[_0xf01c('0x29')](function(_0x176f39){if(_0x176f39){_0x4a6c68=_0x176f39['length'];if(!_0x31ecc7[_0xf01c('0x34')]['hasOwnProperty'](_0xf01c('0x3b'))){_0x1a43d6[_0xf01c('0x21')]=qs[_0xf01c('0x21')](_0x31ecc7[_0xf01c('0x34')][_0xf01c('0x21')]);_0x1a43d6[_0xf01c('0x1f')]=qs[_0xf01c('0x1f')](_0x31ecc7[_0xf01c('0x34')][_0xf01c('0x1f')]);}return _0x1f71f9['getConfigurations'](_0x1a43d6);}})['then'](function(_0x591710){if(_0x591710){return _0x591710?{'count':_0x4a6c68,'rows':_0x591710}:null;}})[_0xf01c('0x29')](respondWithResult(_0x3dab02,null))['catch'](handleError(_0x3dab02,null));};exports[_0xf01c('0x4f')]=function(_0x2e1e23,_0x4608b0,_0x142a0f){if(_0x2e1e23['body']['id']){delete _0x2e1e23['body']['id'];}return db[_0xf01c('0x2f')][_0xf01c('0x50')]({'where':{'id':_0x2e1e23[_0xf01c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4608b0,null))[_0xf01c('0x29')](function(_0x543656){if(_0x543656){_0x2e1e23[_0xf01c('0x4e')][_0xf01c('0x51')]=_0x543656['id'];_0x2e1e23[_0xf01c('0x4e')][_0xf01c('0x52')]=integrations[_0xf01c('0x53')](_0x2e1e23[_0xf01c('0x4e')][_0xf01c('0x54')],_0x2e1e23[_0xf01c('0x4e')]['type']);_0x2e1e23['body']['Descriptions']=integrations[_0xf01c('0x55')](_0x2e1e23[_0xf01c('0x4e')][_0xf01c('0x54')],_0x2e1e23[_0xf01c('0x4e')][_0xf01c('0x42')]);return db[_0xf01c('0x56')][_0xf01c('0x4d')](_0x2e1e23[_0xf01c('0x4e')],{'include':[{'model':db['ZohoField'],'as':_0xf01c('0x52')},{'model':db['ZohoField'],'as':_0xf01c('0x57')}]});}return null;})[_0xf01c('0x29')](respondWithResult(_0x4608b0,null))[_0xf01c('0x48')](handleError(_0x4608b0,null));};function getAccessToken(_0xeba74e){return new Promise(function(_0x4e5572,_0x37cd4d){var _0x4fb6b2;switch(_0xeba74e[_0xf01c('0x58')]){case'US':_0x4fb6b2='https://accounts.zoho.com';break;case'AU':_0x4fb6b2=_0xf01c('0x59');break;case'EU':_0x4fb6b2=_0xf01c('0x5a');break;case'IN':_0x4fb6b2=_0xf01c('0x5b');break;case'CN':_0x4fb6b2=_0xf01c('0x5c');break;default:_0x4fb6b2=_0xf01c('0x5a');break;}var _0x2df315={'method':'POST','uri':_0x4fb6b2+_0xf01c('0x5d'),'qs':{'refresh_token':_0xeba74e[_0xf01c('0x5e')],'client_id':_0xeba74e[_0xf01c('0x5f')],'client_secret':_0xeba74e[_0xf01c('0x60')],'grant_type':_0xf01c('0x61')},'json':!![]};return rp(_0x2df315)[_0xf01c('0x29')](function(_0x5c8dcf){if(_0x5c8dcf[_0xf01c('0x62')]){_0x4e5572(_0x5c8dcf[_0xf01c('0x62')]);}else{_0x37cd4d(_0xf01c('0x63'));}})[_0xf01c('0x48')](function(_0x32911f){_0x37cd4d(_0x32911f);});});}exports[_0xf01c('0x64')]=function(_0x31bf25,_0x33d78a,_0x1bd3a4){var _0x6a6d7c,_0x183f66,_0x3e87cc,_0xd67b4b,_0x266fd9;return db[_0xf01c('0x2f')][_0xf01c('0x50')]({'where':{'id':_0x31bf25[_0xf01c('0x4a')]['id']},'attributes':['id',_0xf01c('0x65'),'zone',_0xf01c('0x5f'),'clientSecret',_0xf01c('0x66'),'code','refreshToken']})[_0xf01c('0x29')](handleEntityNotFound(_0x33d78a,null))[_0xf01c('0x29')](function(_0x5a7c6f){_0x266fd9=_0x5a7c6f;_0x6a6d7c=_0x266fd9['host'];_0x183f66=_0x6a6d7c===_0xf01c('0x67')?'eu':_0xf01c('0x68');_0x3e87cc=_0x266fd9[_0xf01c('0x66')];var _0xbaf17e=_0x3e87cc[_0xf01c('0x69')](-0x1);if(_0xbaf17e==='/'||_0xbaf17e==='\x5c'||_0xbaf17e===':'){_0x3e87cc=_0x3e87cc[_0xf01c('0x6a')](0x0,_0x3e87cc[_0xf01c('0x6b')](_0xbaf17e));}if(!_0x266fd9[_0xf01c('0x5e')]){throw new Error(_0xf01c('0x6c'));}return getAccessToken(_0x266fd9);})[_0xf01c('0x29')](function(_0x4b94e0){if(_0x4b94e0){return rp({'method':'GET','uri':util[_0xf01c('0x6d')](_0xf01c('0x6e'),_0x183f66),'qs':{'module':_0xf01c('0x6f')},'headers':{'Authorization':_0xf01c('0x70')+_0x4b94e0},'json':!![]});}})[_0xf01c('0x29')](function(_0x1bec5c){if(_0x1bec5c){if(_0x1bec5c[_0xf01c('0x71')]&&_0x1bec5c[_0xf01c('0x71')][_0xf01c('0x2b')]){throw new Error(_0x1bec5c[_0xf01c('0x71')][_0xf01c('0x2b')][_0xf01c('0x72')]);}var _0x2d565a=[];var _0x4c8a6a=[];var _0x33414a=[_0xf01c('0x73'),'Subject','Description',_0xf01c('0x74'),_0xf01c('0x75'),_0xf01c('0x76'),'Call_Start_Time','Call_Type'];_0x4c8a6a=_[_0xf01c('0x77')](_0x1bec5c[_0xf01c('0x39')],function(_0x35351b){return _0x33414a[_0xf01c('0x78')](_0x35351b[_0xf01c('0x79')]);});for(var _0x41deda=0x0;_0x41deda<_0x4c8a6a[_0xf01c('0x3a')];_0x41deda++){if(_0x4c8a6a[_0x41deda][_0xf01c('0x7a')]===![]){_0x2d565a[_0xf01c('0x7b')]({'id':_0x4c8a6a[_0x41deda]['id'],'name':_0x4c8a6a[_0x41deda][_0xf01c('0x7c')],'custom':_0x4c8a6a[_0x41deda][_0xf01c('0x7d')],'options':_0x4c8a6a[_0x41deda][_0xf01c('0x7e')]===_0xf01c('0x7f')&&_0x4c8a6a[_0x41deda][_0xf01c('0x80')]['length']>-0x1?_['map'](_0x4c8a6a[_0x41deda][_0xf01c('0x80')],function(_0x5b51bc){return{'name':_0x5b51bc,'value':_0x5b51bc};}):[]});}}return{'count':_0x2d565a['length'],'rows':_0x2d565a};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x33d78a,null))[_0xf01c('0x48')](function(_0x1beaf2){var _0x241309=_0x31bf25[_0xf01c('0x34')]['test']?0x1f4:_0x1beaf2[_0xf01c('0x81')]||0x1f4;logger[_0xf01c('0x2b')](_0xf01c('0x82'),'getFields',_0x241309,JSON[_0xf01c('0x83')](_0x1beaf2));delete _0x1beaf2[_0xf01c('0x2d')];if(_0x241309===0x191){_0x241309=0x190;}_0x33d78a[_0xf01c('0x1d')](_0x241309)['send'](_0x31bf25['query'][_0xf01c('0x84')]?{'message':_0xf01c('0x85'),'statusCode':_0x1beaf2[_0xf01c('0x81')]}:_0x1beaf2);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f4476b2..441b86b 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 _0x8463=['../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','serverUrl','changed','clientId','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','clientSecret','code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com.cn','https://accounts.zoho.eu','parse','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3e4509,_0x50f241){var _0x428ac5=function(_0x1204c8){while(--_0x1204c8){_0x3e4509['push'](_0x3e4509['shift']());}};_0x428ac5(++_0x50f241);}(_0x8463,0x15f));var _0x3846=function(_0x3ef03a,_0x5e71ba){_0x3ef03a=_0x3ef03a-0x0;var _0xac5bf3=_0x8463[_0x3ef03a];return _0xac5bf3;};'use strict';var _=require(_0x3846('0x0'));var util=require(_0x3846('0x1'));var logger=require(_0x3846('0x2'))(_0x3846('0x3'));var moment=require(_0x3846('0x4'));var BPromise=require(_0x3846('0x5'));var rp=require(_0x3846('0x6'));var fs=require('fs');var path=require(_0x3846('0x7'));var rimraf=require(_0x3846('0x8'));var config=require(_0x3846('0x9'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x3846('0xa'));module[_0x3846('0xb')]=function(_0x5413b2,_0x1597c0){return _0x5413b2[_0x3846('0xc')](_0x3846('0xd'),attributes,{'tableName':_0x3846('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x963c,_0x5befe5,_0x5542e9){if(_0x963c['changed'](_0x3846('0xf'))||_0x963c['changed'](_0x3846('0x10'))||_0x963c[_0x3846('0x11')](_0x3846('0x12'))||_0x963c['changed']('clientSecret')||_0x963c['changed']('code')||_0x963c[_0x3846('0x11')](_0x3846('0x13'))){var _0x298869,_0x1dec83;_0x298869=_0x963c['serverUrl'];var _0x47f508=_0x298869[_0x3846('0x14')](-0x1);if(_0x47f508==='/'||_0x47f508==='\x5c'||_0x47f508===':'){_0x298869=_0x298869['substring'](0x0,_0x298869[_0x3846('0x15')](_0x47f508));}switch(_0x963c[_0x3846('0xf')]){case'US':_0x1dec83=_0x3846('0x16');break;case'AU':_0x1dec83=_0x3846('0x17');break;case'IN':_0x1dec83=_0x3846('0x18');break;case'CN':_0x1dec83='https://accounts.zoho.com.cn';break;default:_0x1dec83='https://accounts.zoho.eu';break;}var _0x8879da={'method':_0x3846('0x19'),'uri':_0x1dec83+_0x3846('0x1a'),'form':{'grant_type':_0x3846('0x1b'),'client_id':_0x963c[_0x3846('0x12')],'client_secret':_0x963c[_0x3846('0x1c')],'redirect_uri':_0x963c[_0x3846('0x10')],'code':_0x963c[_0x3846('0x1d')]},'headers':{'Content-Type':_0x3846('0x1e')}};return rp(_0x8879da)[_0x3846('0x1f')](function(_0x4794b2){var _0x54cb0e=JSON['parse'](_0x4794b2);if(_0x54cb0e[_0x3846('0x20')]){_0x963c[_0x3846('0x21')]=_0x54cb0e[_0x3846('0x20')];logger[_0x3846('0x22')](util[_0x3846('0x23')](_0x3846('0x24'),_0x963c[_0x3846('0x25')],_0x963c['id']));}else{logger[_0x3846('0x26')](util[_0x3846('0x23')](_0x3846('0x27'),_0x963c[_0x3846('0x25')],_0x963c['id']),util[_0x3846('0x28')](_0x54cb0e,{'showHidden':![],'depth':null}));}return _0x5542e9(null,_0x5befe5);})[_0x3846('0x29')](function(_0x5335bc){logger['error'](util['format'](_0x3846('0x27'),_0x963c[_0x3846('0x25')],_0x963c['id']),util[_0x3846('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x5542e9(_0x5335bc);});}else{return _0x5542e9(null,_0x5befe5);}},'beforeUpdate':function(_0x3c836a,_0xc899e0,_0x177dcc){if(_0x3c836a[_0x3846('0x11')](_0x3846('0xf'))||_0x3c836a[_0x3846('0x11')](_0x3846('0x10'))||_0x3c836a[_0x3846('0x11')](_0x3846('0x12'))||_0x3c836a[_0x3846('0x11')](_0x3846('0x1c'))||_0x3c836a[_0x3846('0x11')](_0x3846('0x1d'))||_0x3c836a['changed'](_0x3846('0x13'))){var _0x37b7fb,_0x13eee0;_0x37b7fb=_0x3c836a['serverUrl'];var _0x183f59=_0x37b7fb[_0x3846('0x14')](-0x1);if(_0x183f59==='/'||_0x183f59==='\x5c'||_0x183f59===':'){_0x37b7fb=_0x37b7fb['substring'](0x0,_0x37b7fb[_0x3846('0x15')](_0x183f59));}switch(_0x3c836a['zone']){case'US':_0x13eee0=_0x3846('0x16');break;case'AU':_0x13eee0='https://accounts.zoho.com.au';break;case'IN':_0x13eee0=_0x3846('0x18');break;case'CN':_0x13eee0=_0x3846('0x2a');break;default:_0x13eee0=_0x3846('0x2b');break;}var _0x189e9f={'method':_0x3846('0x19'),'uri':_0x13eee0+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3c836a['clientId'],'client_secret':_0x3c836a['clientSecret'],'redirect_uri':_0x3c836a[_0x3846('0x10')],'code':_0x3c836a[_0x3846('0x1d')]},'headers':{'Content-Type':_0x3846('0x1e')}};return rp(_0x189e9f)[_0x3846('0x1f')](function(_0x58d372){var _0x525c26=JSON[_0x3846('0x2c')](_0x58d372);if(_0x525c26['refresh_token']){_0x3c836a[_0x3846('0x21')]=_0x525c26['refresh_token'];logger['info'](util[_0x3846('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3c836a[_0x3846('0x25')],_0x3c836a['id']));}else{logger[_0x3846('0x26')](util[_0x3846('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3c836a[_0x3846('0x25')],_0x3c836a['id']),util[_0x3846('0x28')](_0x525c26,{'showHidden':![],'depth':null}));}return _0x177dcc(null,_0xc899e0);})[_0x3846('0x29')](function(_0x542add){logger['error'](util[_0x3846('0x23')](_0x3846('0x27'),_0x3c836a[_0x3846('0x25')],_0x3c836a['id']),util[_0x3846('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x177dcc(_0x542add);});}else{return _0x177dcc(null,_0xc899e0);}}}});}; \ No newline at end of file +var _0x11f3=['path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','code','application/x-www-form-urlencoded','then','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','POST','parse','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','bluebird'];(function(_0x470588,_0x5bba4e){var _0x392a26=function(_0x1de3dd){while(--_0x1de3dd){_0x470588['push'](_0x470588['shift']());}};_0x392a26(++_0x5bba4e);}(_0x11f3,0xf7));var _0x311f=function(_0x325dee,_0xb67e1f){_0x325dee=_0x325dee-0x0;var _0xc05924=_0x11f3[_0x325dee];return _0xc05924;};'use strict';var _=require(_0x311f('0x0'));var util=require(_0x311f('0x1'));var logger=require(_0x311f('0x2'))(_0x311f('0x3'));var moment=require('moment');var BPromise=require(_0x311f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x311f('0x5'));var rimraf=require(_0x311f('0x6'));var config=require(_0x311f('0x7'));var attributes=require(_0x311f('0x8'));var integrations=require(_0x311f('0x9'));module[_0x311f('0xa')]=function(_0x3aa651,_0x22e80e){return _0x3aa651[_0x311f('0xb')](_0x311f('0xc'),attributes,{'tableName':_0x311f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x26332a,_0x5c8fd7,_0x19e36c){if(_0x26332a[_0x311f('0xe')](_0x311f('0xf'))||_0x26332a[_0x311f('0xe')](_0x311f('0x10'))||_0x26332a['changed'](_0x311f('0x11'))||_0x26332a[_0x311f('0xe')](_0x311f('0x12'))||_0x26332a[_0x311f('0xe')]('code')||_0x26332a[_0x311f('0xe')](_0x311f('0x13'))){var _0x5a82eb,_0x361777;_0x5a82eb=_0x26332a['serverUrl'];var _0x50d414=_0x5a82eb[_0x311f('0x14')](-0x1);if(_0x50d414==='/'||_0x50d414==='\x5c'||_0x50d414===':'){_0x5a82eb=_0x5a82eb['substring'](0x0,_0x5a82eb[_0x311f('0x15')](_0x50d414));}switch(_0x26332a[_0x311f('0xf')]){case'US':_0x361777=_0x311f('0x16');break;case'AU':_0x361777='https://accounts.zoho.com.au';break;case'IN':_0x361777=_0x311f('0x17');break;case'CN':_0x361777=_0x311f('0x18');break;default:_0x361777=_0x311f('0x19');break;}var _0x398321={'method':'POST','uri':_0x361777+_0x311f('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x26332a[_0x311f('0x11')],'client_secret':_0x26332a['clientSecret'],'redirect_uri':_0x26332a[_0x311f('0x10')],'code':_0x26332a[_0x311f('0x1b')]},'headers':{'Content-Type':_0x311f('0x1c')}};return rp(_0x398321)[_0x311f('0x1d')](function(_0x539542){var _0x549e7e=JSON['parse'](_0x539542);if(_0x549e7e['refresh_token']){_0x26332a[_0x311f('0x1e')]=_0x549e7e[_0x311f('0x1f')];logger[_0x311f('0x20')](util[_0x311f('0x21')](_0x311f('0x22'),_0x26332a[_0x311f('0x23')],_0x26332a['id']));}else{logger[_0x311f('0x24')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x26332a[_0x311f('0x23')],_0x26332a['id']),util[_0x311f('0x25')](_0x549e7e,{'showHidden':![],'depth':null}));}return _0x19e36c(null,_0x5c8fd7);})[_0x311f('0x26')](function(_0x5eacf7){logger[_0x311f('0x24')](util[_0x311f('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x26332a['name'],_0x26332a['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x19e36c(_0x5eacf7);});}else{return _0x19e36c(null,_0x5c8fd7);}},'beforeUpdate':function(_0x1d8383,_0xcb1ff5,_0x4da15){if(_0x1d8383[_0x311f('0xe')](_0x311f('0xf'))||_0x1d8383['changed'](_0x311f('0x10'))||_0x1d8383[_0x311f('0xe')](_0x311f('0x11'))||_0x1d8383['changed'](_0x311f('0x12'))||_0x1d8383[_0x311f('0xe')]('code')||_0x1d8383[_0x311f('0xe')](_0x311f('0x13'))){var _0x4d4dd8,_0x1b9e94;_0x4d4dd8=_0x1d8383['serverUrl'];var _0x11047e=_0x4d4dd8[_0x311f('0x14')](-0x1);if(_0x11047e==='/'||_0x11047e==='\x5c'||_0x11047e===':'){_0x4d4dd8=_0x4d4dd8['substring'](0x0,_0x4d4dd8[_0x311f('0x15')](_0x11047e));}switch(_0x1d8383[_0x311f('0xf')]){case'US':_0x1b9e94=_0x311f('0x16');break;case'AU':_0x1b9e94='https://accounts.zoho.com.au';break;case'IN':_0x1b9e94=_0x311f('0x17');break;case'CN':_0x1b9e94=_0x311f('0x18');break;default:_0x1b9e94=_0x311f('0x19');break;}var _0x2d3a9c={'method':_0x311f('0x27'),'uri':_0x1b9e94+_0x311f('0x1a'),'form':{'grant_type':'authorization_code','client_id':_0x1d8383[_0x311f('0x11')],'client_secret':_0x1d8383['clientSecret'],'redirect_uri':_0x1d8383[_0x311f('0x10')],'code':_0x1d8383[_0x311f('0x1b')]},'headers':{'Content-Type':_0x311f('0x1c')}};return rp(_0x2d3a9c)[_0x311f('0x1d')](function(_0x1adec3){var _0x3740dc=JSON[_0x311f('0x28')](_0x1adec3);if(_0x3740dc[_0x311f('0x1f')]){_0x1d8383['refreshToken']=_0x3740dc[_0x311f('0x1f')];logger[_0x311f('0x20')](util[_0x311f('0x21')](_0x311f('0x22'),_0x1d8383[_0x311f('0x23')],_0x1d8383['id']));}else{logger['error'](util[_0x311f('0x21')](_0x311f('0x29'),_0x1d8383['name'],_0x1d8383['id']),util['inspect'](_0x3740dc,{'showHidden':![],'depth':null}));}return _0x4da15(null,_0xcb1ff5);})['catch'](function(_0x7ccd7f){logger[_0x311f('0x24')](util[_0x311f('0x21')](_0x311f('0x29'),_0x1d8383[_0x311f('0x23')],_0x1d8383['id']),util[_0x311f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x4da15(_0x7ccd7f);});}else{return _0x4da15(null,_0xcb1ff5);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index e74ac4c..230ec18 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 _0xf08c=['model','map','then','debug','ShowZohoAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include'];(function(_0x196ef6,_0x4ee3bd){var _0x54b1b6=function(_0x3ebdf7){while(--_0x3ebdf7){_0x196ef6['push'](_0x196ef6['shift']());}};_0x54b1b6(++_0x4ee3bd);}(_0xf08c,0xb5));var _0xcf08=function(_0x1e02c2,_0x58e891){_0x1e02c2=_0x1e02c2-0x0;var _0x2c803a=_0xf08c[_0x1e02c2];return _0x2c803a;};'use strict';var _=require(_0xcf08('0x0'));var util=require(_0xcf08('0x1'));var moment=require(_0xcf08('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf08('0x3'));var fs=require('fs');var Redis=require(_0xcf08('0x4'));var db=require(_0xcf08('0x5'))['db'];var utils=require(_0xcf08('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xcf08('0x7'));var jayson=require(_0xcf08('0x8'));var client=jayson['client'][_0xcf08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37efab,_0x13b89c,_0x42c7b0){return new BPromise(function(_0x59d6d6,_0x5044bb){return client[_0xcf08('0xa')](_0x37efab,_0x42c7b0)['then'](function(_0x1ab45d){logger[_0xcf08('0xb')](_0xcf08('0xc'),_0x13b89c,_0xcf08('0xd'));logger['debug'](_0xcf08('0xe'),_0x13b89c,_0xcf08('0xd'),JSON[_0xcf08('0xf')](_0x1ab45d));if(_0x1ab45d[_0xcf08('0x10')]){if(_0x1ab45d[_0xcf08('0x10')][_0xcf08('0x11')]===0x1f4){logger[_0xcf08('0x10')](_0xcf08('0xc'),_0x13b89c,_0x1ab45d[_0xcf08('0x10')][_0xcf08('0x12')]);return _0x5044bb(_0x1ab45d[_0xcf08('0x10')]['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x13b89c,_0x1ab45d[_0xcf08('0x10')][_0xcf08('0x12')]);return _0x59d6d6(_0x1ab45d['error'][_0xcf08('0x12')]);}else{logger[_0xcf08('0xb')](_0xcf08('0xc'),_0x13b89c,_0xcf08('0xd'));_0x59d6d6(_0x1ab45d[_0xcf08('0x13')]['message']);}})[_0xcf08('0x14')](function(_0x5d89a7){logger['error'](_0xcf08('0xc'),_0x13b89c,_0x5d89a7);_0x5044bb(_0x5d89a7);});});}exports[_0xcf08('0x15')]=function(_0x4c4970){var _0x2e5027=this;return new Promise(function(_0x47060d,_0x2947e5){return db[_0xcf08('0x16')][_0xcf08('0x17')]({'raw':_0x4c4970[_0xcf08('0x18')]?_0x4c4970['options'][_0xcf08('0x19')]===undefined?!![]:![]:!![],'where':_0x4c4970[_0xcf08('0x18')]?_0x4c4970[_0xcf08('0x18')]['where']||null:null,'attributes':_0x4c4970[_0xcf08('0x18')]?_0x4c4970['options'][_0xcf08('0x1a')]||null:null,'limit':_0x4c4970[_0xcf08('0x18')]?_0x4c4970['options'][_0xcf08('0x1b')]||null:null,'include':_0x4c4970[_0xcf08('0x18')]?_0x4c4970[_0xcf08('0x18')][_0xcf08('0x1c')]?_['map'](_0x4c4970[_0xcf08('0x18')][_0xcf08('0x1c')],function(_0x52968a){return{'model':db[_0x52968a[_0xcf08('0x1d')]],'as':_0x52968a['as'],'attributes':_0x52968a['attributes'],'include':_0x52968a[_0xcf08('0x1c')]?_[_0xcf08('0x1e')](_0x52968a['include'],function(_0x2a4b96){return{'model':db[_0x2a4b96[_0xcf08('0x1d')]],'as':_0x2a4b96['as'],'attributes':_0x2a4b96[_0xcf08('0x1a')],'include':_0x2a4b96[_0xcf08('0x1c')]?_[_0xcf08('0x1e')](_0x2a4b96[_0xcf08('0x1c')],function(_0x4137ae){return{'model':db[_0x4137ae[_0xcf08('0x1d')]],'as':_0x4137ae['as'],'attributes':_0x4137ae[_0xcf08('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcf08('0x1f')](function(_0x4bfaad){logger['info'](_0xcf08('0x15'),_0x4c4970);logger[_0xcf08('0x20')]('GetZohoAccount',_0x4c4970,JSON[_0xcf08('0xf')](_0x4bfaad));_0x47060d(_0x4bfaad);})[_0xcf08('0x14')](function(_0x347835){logger[_0xcf08('0x10')](_0xcf08('0x15'),_0x347835[_0xcf08('0x12')],_0x4c4970);_0x2947e5(_0x2e5027[_0xcf08('0x10')](0x1f4,_0x347835[_0xcf08('0x12')]));});});};exports[_0xcf08('0x21')]=function(_0x315b96){var _0x28636b=this;return new Promise(function(_0x242edd,_0x2e6543){return db[_0xcf08('0x16')][_0xcf08('0x22')]({'raw':_0x315b96['options']?_0x315b96[_0xcf08('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x315b96['options']?_0x315b96[_0xcf08('0x18')]['where']||null:null,'attributes':_0x315b96['options']?_0x315b96['options'][_0xcf08('0x1a')]||null:null,'include':_0x315b96[_0xcf08('0x18')]?_0x315b96[_0xcf08('0x18')]['include']?_['map'](_0x315b96[_0xcf08('0x18')][_0xcf08('0x1c')],function(_0x3b9af1){return{'model':db[_0x3b9af1[_0xcf08('0x1d')]],'as':_0x3b9af1['as'],'attributes':_0x3b9af1[_0xcf08('0x1a')],'include':_0x3b9af1[_0xcf08('0x1c')]?_[_0xcf08('0x1e')](_0x3b9af1['include'],function(_0x1d680f){return{'model':db[_0x1d680f['model']],'as':_0x1d680f['as'],'attributes':_0x1d680f[_0xcf08('0x1a')],'include':_0x1d680f[_0xcf08('0x1c')]?_['map'](_0x1d680f[_0xcf08('0x1c')],function(_0x3eb970){return{'model':db[_0x3eb970[_0xcf08('0x1d')]],'as':_0x3eb970['as'],'attributes':_0x3eb970['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1aae14){logger[_0xcf08('0xb')](_0xcf08('0x21'),_0x315b96);logger[_0xcf08('0x20')](_0xcf08('0x21'),_0x315b96,JSON[_0xcf08('0xf')](_0x1aae14));_0x242edd(_0x1aae14);})[_0xcf08('0x14')](function(_0x226b89){logger[_0xcf08('0x10')](_0xcf08('0x21'),_0x226b89['message'],_0x315b96);_0x2e6543(_0x28636b['error'](0x1f4,_0x226b89[_0xcf08('0x12')]));});});}; \ No newline at end of file +var _0xf4c9=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','model','map','info','ShowZohoAccount','raw','lodash','util','moment'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xf4c9[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x9f4c('0x0'));var util=require(_0x9f4c('0x1'));var moment=require(_0x9f4c('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f4c('0x4'))['db'];var utils=require(_0x9f4c('0x5'));var logger=require(_0x9f4c('0x6'))('rpc');var config=require(_0x9f4c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9f4c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf322,_0x498795,_0x12aeb7){return new BPromise(function(_0x398b30,_0x72c8ea){return client[_0x9f4c('0x9')](_0x5cf322,_0x12aeb7)[_0x9f4c('0xa')](function(_0x37b693){logger['info'](_0x9f4c('0xb'),_0x498795,_0x9f4c('0xc'));logger[_0x9f4c('0xd')](_0x9f4c('0xe'),_0x498795,_0x9f4c('0xc'),JSON[_0x9f4c('0xf')](_0x37b693));if(_0x37b693[_0x9f4c('0x10')]){if(_0x37b693[_0x9f4c('0x10')]['code']===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x498795,_0x37b693[_0x9f4c('0x10')]['message']);return _0x72c8ea(_0x37b693['error'][_0x9f4c('0x11')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x498795,_0x37b693[_0x9f4c('0x10')]['message']);return _0x398b30(_0x37b693['error'][_0x9f4c('0x11')]);}else{logger['info'](_0x9f4c('0xb'),_0x498795,_0x9f4c('0xc'));_0x398b30(_0x37b693[_0x9f4c('0x12')][_0x9f4c('0x11')]);}})[_0x9f4c('0x13')](function(_0xb61bdf){logger['error'](_0x9f4c('0xb'),_0x498795,_0xb61bdf);_0x72c8ea(_0xb61bdf);});});}exports[_0x9f4c('0x14')]=function(_0x143335){var _0x30da19=this;return new Promise(function(_0x3f862c,_0x4fe832){return db[_0x9f4c('0x15')][_0x9f4c('0x16')]({'raw':_0x143335[_0x9f4c('0x17')]?_0x143335['options']['raw']===undefined?!![]:![]:!![],'where':_0x143335['options']?_0x143335['options'][_0x9f4c('0x18')]||null:null,'attributes':_0x143335['options']?_0x143335['options'][_0x9f4c('0x19')]||null:null,'limit':_0x143335[_0x9f4c('0x17')]?_0x143335['options'][_0x9f4c('0x1a')]||null:null,'include':_0x143335[_0x9f4c('0x17')]?_0x143335['options'][_0x9f4c('0x1b')]?_['map'](_0x143335['options'][_0x9f4c('0x1b')],function(_0x49d6d6){return{'model':db[_0x49d6d6[_0x9f4c('0x1c')]],'as':_0x49d6d6['as'],'attributes':_0x49d6d6[_0x9f4c('0x19')],'include':_0x49d6d6[_0x9f4c('0x1b')]?_[_0x9f4c('0x1d')](_0x49d6d6[_0x9f4c('0x1b')],function(_0x10c9a9){return{'model':db[_0x10c9a9['model']],'as':_0x10c9a9['as'],'attributes':_0x10c9a9[_0x9f4c('0x19')],'include':_0x10c9a9[_0x9f4c('0x1b')]?_[_0x9f4c('0x1d')](_0x10c9a9[_0x9f4c('0x1b')],function(_0x2c7b7e){return{'model':db[_0x2c7b7e[_0x9f4c('0x1c')]],'as':_0x2c7b7e['as'],'attributes':_0x2c7b7e[_0x9f4c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9f4c('0xa')](function(_0x3bcc3f){logger[_0x9f4c('0x1e')](_0x9f4c('0x14'),_0x143335);logger[_0x9f4c('0xd')](_0x9f4c('0x14'),_0x143335,JSON[_0x9f4c('0xf')](_0x3bcc3f));_0x3f862c(_0x3bcc3f);})[_0x9f4c('0x13')](function(_0x246599){logger[_0x9f4c('0x10')](_0x9f4c('0x14'),_0x246599[_0x9f4c('0x11')],_0x143335);_0x4fe832(_0x30da19[_0x9f4c('0x10')](0x1f4,_0x246599[_0x9f4c('0x11')]));});});};exports[_0x9f4c('0x1f')]=function(_0x4e9b77){var _0x4b6d91=this;return new Promise(function(_0x52ef31,_0x101c13){return db[_0x9f4c('0x15')]['find']({'raw':_0x4e9b77[_0x9f4c('0x17')]?_0x4e9b77[_0x9f4c('0x17')][_0x9f4c('0x20')]===undefined?!![]:![]:!![],'where':_0x4e9b77['options']?_0x4e9b77['options'][_0x9f4c('0x18')]||null:null,'attributes':_0x4e9b77[_0x9f4c('0x17')]?_0x4e9b77['options'][_0x9f4c('0x19')]||null:null,'include':_0x4e9b77['options']?_0x4e9b77['options'][_0x9f4c('0x1b')]?_[_0x9f4c('0x1d')](_0x4e9b77[_0x9f4c('0x17')][_0x9f4c('0x1b')],function(_0x3bb4c4){return{'model':db[_0x3bb4c4[_0x9f4c('0x1c')]],'as':_0x3bb4c4['as'],'attributes':_0x3bb4c4['attributes'],'include':_0x3bb4c4[_0x9f4c('0x1b')]?_[_0x9f4c('0x1d')](_0x3bb4c4[_0x9f4c('0x1b')],function(_0x16c7da){return{'model':db[_0x16c7da[_0x9f4c('0x1c')]],'as':_0x16c7da['as'],'attributes':_0x16c7da[_0x9f4c('0x19')],'include':_0x16c7da[_0x9f4c('0x1b')]?_[_0x9f4c('0x1d')](_0x16c7da[_0x9f4c('0x1b')],function(_0x3b7d8e){return{'model':db[_0x3b7d8e[_0x9f4c('0x1c')]],'as':_0x3b7d8e['as'],'attributes':_0x3b7d8e[_0x9f4c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9f4c('0xa')](function(_0x54309a){logger[_0x9f4c('0x1e')]('ShowZohoAccount',_0x4e9b77);logger[_0x9f4c('0xd')](_0x9f4c('0x1f'),_0x4e9b77,JSON[_0x9f4c('0xf')](_0x54309a));_0x52ef31(_0x54309a);})[_0x9f4c('0x13')](function(_0x33639a){logger[_0x9f4c('0x10')](_0x9f4c('0x1f'),_0x33639a[_0x9f4c('0x11')],_0x4e9b77);_0x101c13(_0x4b6d91[_0x9f4c('0x10')](0x1f4,_0x33639a[_0x9f4c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 99df58e..c09f629 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 _0xd3a2=['post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','index','/:id','show','/:id/fields','isAuthenticated','get','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x3996d2,_0x5b4f6d){var _0x20b13f=function(_0x30ba4b){while(--_0x30ba4b){_0x3996d2['push'](_0x3996d2['shift']());}};_0x20b13f(++_0x5b4f6d);}(_0xd3a2,0xc5));var _0x2d3a=function(_0x100e6f,_0x1f1a14){_0x100e6f=_0x100e6f-0x0;var _0xf8dfa2=_0xd3a2[_0x100e6f];return _0xf8dfa2;};'use strict';var multer=require(_0x2d3a('0x0'));var util=require(_0x2d3a('0x1'));var path=require(_0x2d3a('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d3a('0x3'));var router=express[_0x2d3a('0x4')]();var fs_extra=require(_0x2d3a('0x5'));var auth=require(_0x2d3a('0x6'));var interaction=require(_0x2d3a('0x7'));var config=require(_0x2d3a('0x8'));var controller=require(_0x2d3a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2d3a('0xa')]);router['get'](_0x2d3a('0xb'),auth['isAuthenticated'](),controller[_0x2d3a('0xc')]);router['get'](_0x2d3a('0xd'),auth[_0x2d3a('0xe')](),controller['getFields']);router[_0x2d3a('0xf')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x2d3a('0x10')]);router[_0x2d3a('0xf')](_0x2d3a('0x11'),auth[_0x2d3a('0xe')](),controller[_0x2d3a('0x12')]);router[_0x2d3a('0x13')]('/',auth[_0x2d3a('0xe')](),controller['create']);router[_0x2d3a('0x14')](_0x2d3a('0xb'),auth[_0x2d3a('0xe')](),controller[_0x2d3a('0x15')]);router['delete'](_0x2d3a('0xb'),auth[_0x2d3a('0xe')](),controller[_0x2d3a('0x16')]);module[_0x2d3a('0x17')]=router; \ No newline at end of file +var _0x6a2d=['isAuthenticated','index','/:id','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x6a2d,0x1ef));var _0xd6a2=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6a2d[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xd6a2('0x0'));var util=require(_0xd6a2('0x1'));var path=require(_0xd6a2('0x2'));var timeout=require(_0xd6a2('0x3'));var express=require(_0xd6a2('0x4'));var router=express[_0xd6a2('0x5')]();var fs_extra=require(_0xd6a2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd6a2('0x7'));var config=require(_0xd6a2('0x8'));var controller=require(_0xd6a2('0x9'));router[_0xd6a2('0xa')]('/',auth[_0xd6a2('0xb')](),controller[_0xd6a2('0xc')]);router[_0xd6a2('0xa')](_0xd6a2('0xd'),auth[_0xd6a2('0xb')](),controller['show']);router[_0xd6a2('0xa')](_0xd6a2('0xe'),auth[_0xd6a2('0xb')](),controller['getFields']);router[_0xd6a2('0xa')](_0xd6a2('0xf'),auth[_0xd6a2('0xb')](),controller['getSubjects']);router[_0xd6a2('0xa')](_0xd6a2('0x10'),auth[_0xd6a2('0xb')](),controller[_0xd6a2('0x11')]);router[_0xd6a2('0x12')]('/',auth[_0xd6a2('0xb')](),controller[_0xd6a2('0x13')]);router['put'](_0xd6a2('0xd'),auth[_0xd6a2('0xb')](),controller['update']);router[_0xd6a2('0x14')](_0xd6a2('0xd'),auth['isAuthenticated'](),controller[_0xd6a2('0x15')]);module[_0xd6a2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 1ecf7a4..2d99426 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 _0x1d9d=['lead','contact','nothing','ENUM','contact_lead','sequelize','exports','STRING'];(function(_0x55121f,_0x521213){var _0x4f6823=function(_0x890b18){while(--_0x890b18){_0x55121f['push'](_0x55121f['shift']());}};_0x4f6823(++_0x521213);}(_0x1d9d,0x6d));var _0xd1d9=function(_0x2b02f0,_0x1542cb){_0x2b02f0=_0x2b02f0-0x0;var _0xae447e=_0x1d9d[_0x2b02f0];return _0xae447e;};'use strict';var Sequelize=require(_0xd1d9('0x0'));module[_0xd1d9('0x1')]={'name':{'type':Sequelize[_0xd1d9('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xd1d9('0x3'),_0xd1d9('0x4'),_0xd1d9('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xd1d9('0x6')](_0xd1d9('0x7'),_0xd1d9('0x4'),_0xd1d9('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xd1d9('0x2')]}}; \ No newline at end of file +var _0x5533=['contact_lead','sequelize','exports','STRING','lead','contact','nothing','ENUM'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5533,0xf9));var _0x3553=function(_0x1375fb,_0x49032d){_0x1375fb=_0x1375fb-0x0;var _0x3e9855=_0x5533[_0x1375fb];return _0x3e9855;};'use strict';var Sequelize=require(_0x3553('0x0'));module[_0x3553('0x1')]={'name':{'type':Sequelize[_0x3553('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x3553('0x3'),_0x3553('0x4'),_0x3553('0x5')),'defaultValue':_0x3553('0x3')},'moduleSearch':{'type':Sequelize[_0x3553('0x6')](_0x3553('0x7'),_0x3553('0x4'),'lead'),'defaultValue':_0x3553('0x7')},'description':{'type':Sequelize[_0x3553('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 555d4a0..0ae80d8 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 _0x5f10=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','getFields','ZohoField','sort','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','util','path','to-csv','fs-extra','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','Content-Range','json','reject','update','then','end','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick'];(function(_0x258cff,_0x294e15){var _0x4cb7be=function(_0x10d4a0){while(--_0x10d4a0){_0x258cff['push'](_0x258cff['shift']());}};_0x4cb7be(++_0x294e15);}(_0x5f10,0x1d8));var _0x05f1=function(_0x272d97,_0x3cb745){_0x272d97=_0x272d97-0x0;var _0x40fc01=_0x5f10[_0x272d97];return _0x40fc01;};'use strict';var emlformat=require(_0x05f1('0x0'));var rimraf=require(_0x05f1('0x1'));var zipdir=require(_0x05f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05f1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x05f1('0x4'));var path=require(_0x05f1('0x5'));var sox=require('sox');var csv=require(_0x05f1('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x05f1('0x7'));var _=require(_0x05f1('0x8'));var squel=require(_0x05f1('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x05f1('0x6'));var querystring=require(_0x05f1('0xa'));var Papa=require('papaparse');var Redis=require(_0x05f1('0xb'));var authService=require(_0x05f1('0xc'));var qs=require(_0x05f1('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05f1('0xe'));var logger=require(_0x05f1('0xf'))(_0x05f1('0x10'));var utils=require(_0x05f1('0x11'));var config=require(_0x05f1('0x12'));var licenseUtil=require(_0x05f1('0x13'));var db=require(_0x05f1('0x14'))['db'];function respondWithStatusCode(_0x5c81ba,_0x275d94){_0x275d94=_0x275d94||0xcc;return function(_0x232af0){if(_0x232af0){return _0x5c81ba['sendStatus'](_0x275d94);}return _0x5c81ba[_0x05f1('0x15')](_0x275d94)['end']();};}function respondWithResult(_0x13fa52,_0x43680b){_0x43680b=_0x43680b||0xc8;return function(_0x3d4c48){if(_0x3d4c48){return _0x13fa52[_0x05f1('0x15')](_0x43680b)['json'](_0x3d4c48);}};}function respondWithFilteredResult(_0x1757e6,_0x57a9c8){return function(_0xaa6457){if(_0xaa6457){var _0xbea03f=typeof _0x57a9c8[_0x05f1('0x16')]===_0x05f1('0x17')&&typeof _0x57a9c8['limit']==='undefined';var _0x187054=_0xaa6457[_0x05f1('0x18')];var _0x30cda6=_0xbea03f?0x0:_0x57a9c8[_0x05f1('0x16')];var _0x2a822e=_0xbea03f?_0xaa6457['count']:_0x57a9c8[_0x05f1('0x16')]+_0x57a9c8[_0x05f1('0x19')];var _0x2e0c92;if(_0x2a822e>=_0x187054){_0x2a822e=_0x187054;_0x2e0c92=0xc8;}else{_0x2e0c92=0xce;}_0x1757e6[_0x05f1('0x15')](_0x2e0c92);return _0x1757e6['set'](_0x05f1('0x1a'),_0x30cda6+'-'+_0x2a822e+'/'+_0x187054)[_0x05f1('0x1b')](_0xaa6457);}return null;};}function patchUpdates(_0x4c4232){return function(_0xef8310){try{jsonpatch['apply'](_0xef8310,_0x4c4232,!![]);}catch(_0x1f05ae){return BPromise[_0x05f1('0x1c')](_0x1f05ae);}return _0xef8310['save']();};}function saveUpdates(_0x40b8a4,_0x1a2a54){return function(_0x324d3a){if(_0x324d3a){return _0x324d3a[_0x05f1('0x1d')](_0x40b8a4)[_0x05f1('0x1e')](function(_0x492a07){return _0x492a07;});}return null;};}function removeEntity(_0x51cae4,_0x49ff6d){return function(_0x4af95a){if(_0x4af95a){return _0x4af95a['destroy']()['then'](function(){_0x51cae4[_0x05f1('0x15')](0xcc)[_0x05f1('0x1f')]();});}};}function handleEntityNotFound(_0x5109c6,_0x4b79c1){return function(_0x737a6c){if(!_0x737a6c){_0x5109c6['sendStatus'](0x194);}return _0x737a6c;};}function handleError(_0x72714b,_0x55eec5){_0x55eec5=_0x55eec5||0x1f4;return function(_0x18cdab){logger[_0x05f1('0x20')](_0x18cdab[_0x05f1('0x21')]);if(_0x18cdab[_0x05f1('0x22')]){delete _0x18cdab[_0x05f1('0x22')];}_0x72714b['status'](_0x55eec5)[_0x05f1('0x23')](_0x18cdab);};}exports[_0x05f1('0x24')]=function(_0x546df0,_0x567e14){var _0x4ac51c={},_0x53fb66={},_0x318142={'count':0x0,'rows':[]};var _0x152931=_[_0x05f1('0x25')](db[_0x05f1('0x26')][_0x05f1('0x27')],function(_0x546722){return{'name':_0x546722['fieldName'],'type':_0x546722['type'][_0x05f1('0x28')]};});_0x53fb66[_0x05f1('0x29')]=_[_0x05f1('0x25')](_0x152931,_0x05f1('0x22'));_0x53fb66['query']=_[_0x05f1('0x2a')](_0x546df0[_0x05f1('0x2b')]);_0x53fb66[_0x05f1('0x2c')]=_[_0x05f1('0x2d')](_0x53fb66[_0x05f1('0x29')],_0x53fb66[_0x05f1('0x2b')]);_0x4ac51c[_0x05f1('0x2e')]=_[_0x05f1('0x2d')](_0x53fb66['model'],qs[_0x05f1('0x2f')](_0x546df0[_0x05f1('0x2b')]['fields']));_0x4ac51c[_0x05f1('0x2e')]=_0x4ac51c[_0x05f1('0x2e')][_0x05f1('0x30')]?_0x4ac51c['attributes']:_0x53fb66[_0x05f1('0x29')];if(!_0x546df0[_0x05f1('0x2b')]['hasOwnProperty'](_0x05f1('0x31'))){_0x4ac51c['limit']=qs[_0x05f1('0x19')](_0x546df0[_0x05f1('0x2b')][_0x05f1('0x19')]);_0x4ac51c['offset']=qs[_0x05f1('0x16')](_0x546df0[_0x05f1('0x2b')][_0x05f1('0x16')]);}_0x4ac51c[_0x05f1('0x32')]=qs['sort'](_0x546df0['query']['sort']);_0x4ac51c[_0x05f1('0x33')]=qs['filters'](_[_0x05f1('0x34')](_0x546df0[_0x05f1('0x2b')],_0x53fb66[_0x05f1('0x2c')]),_0x152931);if(_0x546df0['query'][_0x05f1('0x35')]){_0x4ac51c[_0x05f1('0x33')]=_[_0x05f1('0x36')](_0x4ac51c['where'],{'$or':_[_0x05f1('0x25')](_0x152931,function(_0x5e4cb1){if(_0x5e4cb1[_0x05f1('0x37')]!==_0x05f1('0x38')){var _0x340efb={};_0x340efb[_0x5e4cb1[_0x05f1('0x22')]]={'$like':'%'+_0x546df0[_0x05f1('0x2b')][_0x05f1('0x35')]+'%'};return _0x340efb;}})});}_0x4ac51c=_[_0x05f1('0x36')]({},_0x4ac51c,_0x546df0[_0x05f1('0x39')]);var _0x19d7eb={'where':_0x4ac51c[_0x05f1('0x33')]};return db[_0x05f1('0x26')][_0x05f1('0x18')](_0x19d7eb)[_0x05f1('0x1e')](function(_0x3f184d){_0x318142[_0x05f1('0x18')]=_0x3f184d;if(_0x546df0[_0x05f1('0x2b')][_0x05f1('0x3a')]){_0x4ac51c[_0x05f1('0x3b')]=[{'all':!![]}];}return db[_0x05f1('0x26')][_0x05f1('0x3c')](_0x4ac51c);})['then'](function(_0x1f90d1){_0x318142[_0x05f1('0x3d')]=_0x1f90d1;return _0x318142;})['then'](respondWithFilteredResult(_0x567e14,_0x4ac51c))[_0x05f1('0x3e')](handleError(_0x567e14,null));};exports['show']=function(_0x176938,_0x9ea9c9){var _0x534ad9={'raw':![],'where':{'id':_0x176938[_0x05f1('0x3f')]['id']}},_0x15a5cc={};_0x15a5cc[_0x05f1('0x29')]=_['keys'](db[_0x05f1('0x26')][_0x05f1('0x27')]);_0x15a5cc[_0x05f1('0x2b')]=_[_0x05f1('0x2a')](_0x176938['query']);_0x15a5cc[_0x05f1('0x2c')]=_[_0x05f1('0x2d')](_0x15a5cc[_0x05f1('0x29')],_0x15a5cc[_0x05f1('0x2b')]);_0x534ad9[_0x05f1('0x2e')]=_[_0x05f1('0x2d')](_0x15a5cc['model'],qs[_0x05f1('0x2f')](_0x176938[_0x05f1('0x2b')][_0x05f1('0x2f')]));_0x534ad9['attributes']=_0x534ad9['attributes'][_0x05f1('0x30')]?_0x534ad9['attributes']:_0x15a5cc['model'];if(_0x176938[_0x05f1('0x2b')][_0x05f1('0x3a')]){_0x534ad9[_0x05f1('0x3b')]=[{'all':!![]}];}_0x534ad9=_[_0x05f1('0x36')]({},_0x534ad9,_0x176938[_0x05f1('0x39')]);return db['ZohoConfiguration'][_0x05f1('0x40')](_0x534ad9)[_0x05f1('0x1e')](handleEntityNotFound(_0x9ea9c9,null))[_0x05f1('0x1e')](respondWithResult(_0x9ea9c9,null))[_0x05f1('0x3e')](handleError(_0x9ea9c9,null));};exports[_0x05f1('0x41')]=function(_0x275b10,_0x568085){return db[_0x05f1('0x26')][_0x05f1('0x41')](_0x275b10[_0x05f1('0x42')],{})['then'](respondWithResult(_0x568085,0xc9))[_0x05f1('0x3e')](handleError(_0x568085,null));};exports[_0x05f1('0x1d')]=function(_0x59163c,_0x52a893){if(_0x59163c[_0x05f1('0x42')]['id']){delete _0x59163c[_0x05f1('0x42')]['id'];}return db[_0x05f1('0x26')][_0x05f1('0x40')]({'where':{'id':_0x59163c[_0x05f1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x52a893,null))[_0x05f1('0x1e')](saveUpdates(_0x59163c[_0x05f1('0x42')],null))[_0x05f1('0x1e')](respondWithResult(_0x52a893,null))[_0x05f1('0x3e')](handleError(_0x52a893,null));};exports[_0x05f1('0x43')]=function(_0x5a4d3c,_0x4e8e22){return db['ZohoConfiguration'][_0x05f1('0x40')]({'where':{'id':_0x5a4d3c[_0x05f1('0x3f')]['id']}})[_0x05f1('0x1e')](handleEntityNotFound(_0x4e8e22,null))[_0x05f1('0x1e')](removeEntity(_0x4e8e22,null))[_0x05f1('0x3e')](handleError(_0x4e8e22,null));};exports[_0x05f1('0x44')]=function(_0x36afed,_0xcc37b4,_0x463215){var _0x5bfff7={};var _0x43c34e={};var _0x67630;var _0x50bf5f;return db[_0x05f1('0x26')]['findOne']({'where':{'id':_0x36afed[_0x05f1('0x3f')]['id']}})[_0x05f1('0x1e')](handleEntityNotFound(_0xcc37b4,null))['then'](function(_0x180c08){if(_0x180c08){_0x67630=_0x180c08;_0x43c34e['model']=_[_0x05f1('0x2a')](db[_0x05f1('0x45')][_0x05f1('0x27')]);_0x43c34e['query']=_[_0x05f1('0x2a')](_0x36afed[_0x05f1('0x2b')]);_0x43c34e['filters']=_[_0x05f1('0x2d')](_0x43c34e[_0x05f1('0x29')],_0x43c34e[_0x05f1('0x2b')]);_0x5bfff7[_0x05f1('0x2e')]=_[_0x05f1('0x2d')](_0x43c34e[_0x05f1('0x29')],qs[_0x05f1('0x2f')](_0x36afed[_0x05f1('0x2b')][_0x05f1('0x2f')]));_0x5bfff7[_0x05f1('0x2e')]=_0x5bfff7[_0x05f1('0x2e')][_0x05f1('0x30')]?_0x5bfff7['attributes']:_0x43c34e['model'];_0x5bfff7[_0x05f1('0x32')]=qs[_0x05f1('0x46')](_0x36afed['query'][_0x05f1('0x46')]);_0x5bfff7[_0x05f1('0x33')]=qs[_0x05f1('0x2c')](_[_0x05f1('0x34')](_0x36afed[_0x05f1('0x2b')],_0x43c34e[_0x05f1('0x2c')]));if(_0x36afed[_0x05f1('0x2b')][_0x05f1('0x35')]){_0x5bfff7[_0x05f1('0x33')]=_[_0x05f1('0x36')](_0x5bfff7['where'],{'$or':_[_0x05f1('0x25')](_0x5bfff7['attributes'],function(_0x438ade){var _0x3eaf94={};_0x3eaf94[_0x438ade]={'$like':'%'+_0x36afed[_0x05f1('0x2b')][_0x05f1('0x35')]+'%'};return _0x3eaf94;})});}_0x5bfff7=_[_0x05f1('0x36')]({},_0x5bfff7,_0x36afed[_0x05f1('0x39')]);return _0x67630[_0x05f1('0x44')](_0x5bfff7);}})['then'](function(_0x295d6f){if(_0x295d6f){_0x50bf5f=_0x295d6f[_0x05f1('0x30')];if(!_0x36afed[_0x05f1('0x2b')][_0x05f1('0x47')]('nolimit')){_0x5bfff7[_0x05f1('0x19')]=qs[_0x05f1('0x19')](_0x36afed[_0x05f1('0x2b')][_0x05f1('0x19')]);_0x5bfff7[_0x05f1('0x16')]=qs['offset'](_0x36afed[_0x05f1('0x2b')][_0x05f1('0x16')]);}return _0x67630['getFields'](_0x5bfff7);}})[_0x05f1('0x1e')](function(_0x9bdc13){if(_0x9bdc13){return _0x9bdc13?{'count':_0x50bf5f,'rows':_0x9bdc13}:null;}})['then'](respondWithResult(_0xcc37b4,null))['catch'](handleError(_0xcc37b4,null));};exports[_0x05f1('0x48')]=function(_0x3ec4ec,_0x40208b,_0x17a5d9){var _0xb3f5cc={};var _0x23aeab={};var _0x233edc;var _0x319660;return db[_0x05f1('0x26')][_0x05f1('0x49')]({'where':{'id':_0x3ec4ec[_0x05f1('0x3f')]['id']}})[_0x05f1('0x1e')](handleEntityNotFound(_0x40208b,null))[_0x05f1('0x1e')](function(_0x2da33c){if(_0x2da33c){_0x233edc=_0x2da33c;_0x23aeab[_0x05f1('0x29')]=_[_0x05f1('0x2a')](db[_0x05f1('0x45')][_0x05f1('0x27')]);_0x23aeab[_0x05f1('0x2b')]=_[_0x05f1('0x2a')](_0x3ec4ec[_0x05f1('0x2b')]);_0x23aeab[_0x05f1('0x2c')]=_[_0x05f1('0x2d')](_0x23aeab[_0x05f1('0x29')],_0x23aeab[_0x05f1('0x2b')]);_0xb3f5cc[_0x05f1('0x2e')]=_[_0x05f1('0x2d')](_0x23aeab[_0x05f1('0x29')],qs['fields'](_0x3ec4ec[_0x05f1('0x2b')]['fields']));_0xb3f5cc[_0x05f1('0x2e')]=_0xb3f5cc[_0x05f1('0x2e')][_0x05f1('0x30')]?_0xb3f5cc[_0x05f1('0x2e')]:_0x23aeab[_0x05f1('0x29')];_0xb3f5cc[_0x05f1('0x32')]=qs['sort'](_0x3ec4ec[_0x05f1('0x2b')][_0x05f1('0x46')]);_0xb3f5cc[_0x05f1('0x33')]=qs[_0x05f1('0x2c')](_[_0x05f1('0x34')](_0x3ec4ec[_0x05f1('0x2b')],_0x23aeab[_0x05f1('0x2c')]));if(_0x3ec4ec[_0x05f1('0x2b')]['filter']){_0xb3f5cc[_0x05f1('0x33')]=_[_0x05f1('0x36')](_0xb3f5cc[_0x05f1('0x33')],{'$or':_[_0x05f1('0x25')](_0xb3f5cc[_0x05f1('0x2e')],function(_0x30f4b9){var _0x3bbd25={};_0x3bbd25[_0x30f4b9]={'$like':'%'+_0x3ec4ec[_0x05f1('0x2b')][_0x05f1('0x35')]+'%'};return _0x3bbd25;})});}_0xb3f5cc=_[_0x05f1('0x36')]({},_0xb3f5cc,_0x3ec4ec[_0x05f1('0x39')]);return _0x233edc['getSubjects'](_0xb3f5cc);}})['then'](function(_0x1447fc){if(_0x1447fc){_0x319660=_0x1447fc[_0x05f1('0x30')];if(!_0x3ec4ec[_0x05f1('0x2b')]['hasOwnProperty'](_0x05f1('0x31'))){_0xb3f5cc['limit']=qs[_0x05f1('0x19')](_0x3ec4ec[_0x05f1('0x2b')][_0x05f1('0x19')]);_0xb3f5cc['offset']=qs[_0x05f1('0x16')](_0x3ec4ec[_0x05f1('0x2b')][_0x05f1('0x16')]);}return _0x233edc[_0x05f1('0x48')](_0xb3f5cc);}})[_0x05f1('0x1e')](function(_0x778e6f){if(_0x778e6f){return _0x778e6f?{'count':_0x319660,'rows':_0x778e6f}:null;}})['then'](respondWithResult(_0x40208b,null))[_0x05f1('0x3e')](handleError(_0x40208b,null));};exports[_0x05f1('0x4a')]=function(_0x4ff7b8,_0x539202,_0x23f44a){var _0x7edb39={};var _0x166834={};var _0x4d1229;var _0x1b58e9;return db[_0x05f1('0x26')][_0x05f1('0x49')]({'where':{'id':_0x4ff7b8[_0x05f1('0x3f')]['id']}})[_0x05f1('0x1e')](handleEntityNotFound(_0x539202,null))[_0x05f1('0x1e')](function(_0x4e1fa7){if(_0x4e1fa7){_0x4d1229=_0x4e1fa7;_0x166834[_0x05f1('0x29')]=_['keys'](db[_0x05f1('0x45')][_0x05f1('0x27')]);_0x166834['query']=_[_0x05f1('0x2a')](_0x4ff7b8['query']);_0x166834[_0x05f1('0x2c')]=_[_0x05f1('0x2d')](_0x166834[_0x05f1('0x29')],_0x166834[_0x05f1('0x2b')]);_0x7edb39[_0x05f1('0x2e')]=_[_0x05f1('0x2d')](_0x166834['model'],qs[_0x05f1('0x2f')](_0x4ff7b8[_0x05f1('0x2b')][_0x05f1('0x2f')]));_0x7edb39[_0x05f1('0x2e')]=_0x7edb39[_0x05f1('0x2e')][_0x05f1('0x30')]?_0x7edb39['attributes']:_0x166834[_0x05f1('0x29')];_0x7edb39[_0x05f1('0x32')]=qs[_0x05f1('0x46')](_0x4ff7b8['query'][_0x05f1('0x46')]);_0x7edb39[_0x05f1('0x33')]=qs[_0x05f1('0x2c')](_[_0x05f1('0x34')](_0x4ff7b8[_0x05f1('0x2b')],_0x166834['filters']));if(_0x4ff7b8[_0x05f1('0x2b')]['filter']){_0x7edb39[_0x05f1('0x33')]=_[_0x05f1('0x36')](_0x7edb39[_0x05f1('0x33')],{'$or':_[_0x05f1('0x25')](_0x7edb39['attributes'],function(_0x2cb0e3){var _0x54a0f9={};_0x54a0f9[_0x2cb0e3]={'$like':'%'+_0x4ff7b8[_0x05f1('0x2b')][_0x05f1('0x35')]+'%'};return _0x54a0f9;})});}_0x7edb39=_[_0x05f1('0x36')]({},_0x7edb39,_0x4ff7b8[_0x05f1('0x39')]);return _0x4d1229[_0x05f1('0x4a')](_0x7edb39);}})[_0x05f1('0x1e')](function(_0x2d0484){if(_0x2d0484){_0x1b58e9=_0x2d0484['length'];if(!_0x4ff7b8[_0x05f1('0x2b')][_0x05f1('0x47')](_0x05f1('0x31'))){_0x7edb39[_0x05f1('0x19')]=qs[_0x05f1('0x19')](_0x4ff7b8[_0x05f1('0x2b')][_0x05f1('0x19')]);_0x7edb39[_0x05f1('0x16')]=qs[_0x05f1('0x16')](_0x4ff7b8[_0x05f1('0x2b')]['offset']);}return _0x4d1229[_0x05f1('0x4a')](_0x7edb39);}})[_0x05f1('0x1e')](function(_0x315e39){if(_0x315e39){return _0x315e39?{'count':_0x1b58e9,'rows':_0x315e39}:null;}})['then'](respondWithResult(_0x539202,null))[_0x05f1('0x3e')](handleError(_0x539202,null));}; \ No newline at end of file +var _0xea19=['type','key','keys','filters','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','getSubjects','ZohoField','order','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','save','update','destroy','stack','name','send','map','ZohoConfiguration','fieldName'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xea19,0x160));var _0x9ea1=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0xea19[_0x2f9467];return _0x39894c;};'use strict';var emlformat=require(_0x9ea1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ea1('0x1'));var jsonpatch=require(_0x9ea1('0x2'));var rp=require(_0x9ea1('0x3'));var moment=require(_0x9ea1('0x4'));var BPromise=require(_0x9ea1('0x5'));var Mustache=require(_0x9ea1('0x6'));var util=require(_0x9ea1('0x7'));var path=require('path');var sox=require(_0x9ea1('0x8'));var csv=require(_0x9ea1('0x9'));var ejs=require(_0x9ea1('0xa'));var fs=require('fs');var fs_extra=require(_0x9ea1('0xb'));var _=require(_0x9ea1('0xc'));var squel=require(_0x9ea1('0xd'));var crypto=require(_0x9ea1('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9ea1('0x9'));var querystring=require(_0x9ea1('0xf'));var Papa=require('papaparse');var Redis=require(_0x9ea1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9ea1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ea1('0x12'))(_0x9ea1('0x13'));var utils=require(_0x9ea1('0x14'));var config=require(_0x9ea1('0x15'));var licenseUtil=require(_0x9ea1('0x16'));var db=require(_0x9ea1('0x17'))['db'];function respondWithStatusCode(_0x3b24ce,_0x571cc8){_0x571cc8=_0x571cc8||0xcc;return function(_0x429af2){if(_0x429af2){return _0x3b24ce[_0x9ea1('0x18')](_0x571cc8);}return _0x3b24ce['status'](_0x571cc8)[_0x9ea1('0x19')]();};}function respondWithResult(_0x3f20c3,_0x1d137e){_0x1d137e=_0x1d137e||0xc8;return function(_0x479510){if(_0x479510){return _0x3f20c3['status'](_0x1d137e)[_0x9ea1('0x1a')](_0x479510);}};}function respondWithFilteredResult(_0x178ab1,_0x3644f6){return function(_0x101225){if(_0x101225){var _0x20dd14=typeof _0x3644f6[_0x9ea1('0x1b')]===_0x9ea1('0x1c')&&typeof _0x3644f6[_0x9ea1('0x1d')]===_0x9ea1('0x1c');var _0x1e201a=_0x101225[_0x9ea1('0x1e')];var _0x340b85=_0x20dd14?0x0:_0x3644f6[_0x9ea1('0x1b')];var _0x5c1591=_0x20dd14?_0x101225[_0x9ea1('0x1e')]:_0x3644f6[_0x9ea1('0x1b')]+_0x3644f6[_0x9ea1('0x1d')];var _0x2a9193;if(_0x5c1591>=_0x1e201a){_0x5c1591=_0x1e201a;_0x2a9193=0xc8;}else{_0x2a9193=0xce;}_0x178ab1[_0x9ea1('0x1f')](_0x2a9193);return _0x178ab1[_0x9ea1('0x20')](_0x9ea1('0x21'),_0x340b85+'-'+_0x5c1591+'/'+_0x1e201a)[_0x9ea1('0x1a')](_0x101225);}return null;};}function patchUpdates(_0x169ad5){return function(_0x315998){try{jsonpatch['apply'](_0x315998,_0x169ad5,!![]);}catch(_0x2980da){return BPromise['reject'](_0x2980da);}return _0x315998[_0x9ea1('0x22')]();};}function saveUpdates(_0x15d77f,_0x2d7e22){return function(_0x14bea1){if(_0x14bea1){return _0x14bea1[_0x9ea1('0x23')](_0x15d77f)['then'](function(_0x4e0f79){return _0x4e0f79;});}return null;};}function removeEntity(_0x10ba5c,_0x94c72a){return function(_0x1831ca){if(_0x1831ca){return _0x1831ca[_0x9ea1('0x24')]()['then'](function(){_0x10ba5c[_0x9ea1('0x1f')](0xcc)[_0x9ea1('0x19')]();});}};}function handleEntityNotFound(_0x234639,_0x379095){return function(_0x24c015){if(!_0x24c015){_0x234639[_0x9ea1('0x18')](0x194);}return _0x24c015;};}function handleError(_0x1fc0d4,_0x474b7e){_0x474b7e=_0x474b7e||0x1f4;return function(_0x8272d9){logger['error'](_0x8272d9[_0x9ea1('0x25')]);if(_0x8272d9['name']){delete _0x8272d9[_0x9ea1('0x26')];}_0x1fc0d4['status'](_0x474b7e)[_0x9ea1('0x27')](_0x8272d9);};}exports['index']=function(_0x525822,_0x291213){var _0x589246={},_0x47f197={},_0x5620ab={'count':0x0,'rows':[]};var _0x465483=_[_0x9ea1('0x28')](db[_0x9ea1('0x29')]['rawAttributes'],function(_0x4727ca){return{'name':_0x4727ca[_0x9ea1('0x2a')],'type':_0x4727ca[_0x9ea1('0x2b')][_0x9ea1('0x2c')]};});_0x47f197['model']=_[_0x9ea1('0x28')](_0x465483,_0x9ea1('0x26'));_0x47f197['query']=_[_0x9ea1('0x2d')](_0x525822['query']);_0x47f197[_0x9ea1('0x2e')]=_['intersection'](_0x47f197[_0x9ea1('0x2f')],_0x47f197[_0x9ea1('0x30')]);_0x589246['attributes']=_[_0x9ea1('0x31')](_0x47f197[_0x9ea1('0x2f')],qs[_0x9ea1('0x32')](_0x525822[_0x9ea1('0x30')][_0x9ea1('0x32')]));_0x589246[_0x9ea1('0x33')]=_0x589246['attributes'][_0x9ea1('0x34')]?_0x589246['attributes']:_0x47f197[_0x9ea1('0x2f')];if(!_0x525822[_0x9ea1('0x30')][_0x9ea1('0x35')](_0x9ea1('0x36'))){_0x589246['limit']=qs['limit'](_0x525822[_0x9ea1('0x30')][_0x9ea1('0x1d')]);_0x589246['offset']=qs[_0x9ea1('0x1b')](_0x525822[_0x9ea1('0x30')]['offset']);}_0x589246['order']=qs['sort'](_0x525822[_0x9ea1('0x30')][_0x9ea1('0x37')]);_0x589246[_0x9ea1('0x38')]=qs[_0x9ea1('0x2e')](_[_0x9ea1('0x39')](_0x525822['query'],_0x47f197[_0x9ea1('0x2e')]),_0x465483);if(_0x525822['query'][_0x9ea1('0x3a')]){_0x589246[_0x9ea1('0x38')]=_[_0x9ea1('0x3b')](_0x589246[_0x9ea1('0x38')],{'$or':_['map'](_0x465483,function(_0x1d6a29){if(_0x1d6a29[_0x9ea1('0x2b')]!=='VIRTUAL'){var _0x3bf6d6={};_0x3bf6d6[_0x1d6a29[_0x9ea1('0x26')]]={'$like':'%'+_0x525822['query']['filter']+'%'};return _0x3bf6d6;}})});}_0x589246=_[_0x9ea1('0x3b')]({},_0x589246,_0x525822[_0x9ea1('0x3c')]);var _0x2e7204={'where':_0x589246[_0x9ea1('0x38')]};return db['ZohoConfiguration'][_0x9ea1('0x1e')](_0x2e7204)[_0x9ea1('0x3d')](function(_0x4ceb01){_0x5620ab['count']=_0x4ceb01;if(_0x525822[_0x9ea1('0x30')][_0x9ea1('0x3e')]){_0x589246[_0x9ea1('0x3f')]=[{'all':!![]}];}return db[_0x9ea1('0x29')][_0x9ea1('0x40')](_0x589246);})[_0x9ea1('0x3d')](function(_0x1332a8){_0x5620ab[_0x9ea1('0x41')]=_0x1332a8;return _0x5620ab;})[_0x9ea1('0x3d')](respondWithFilteredResult(_0x291213,_0x589246))[_0x9ea1('0x42')](handleError(_0x291213,null));};exports[_0x9ea1('0x43')]=function(_0x575019,_0x227d80){var _0x19670e={'raw':![],'where':{'id':_0x575019[_0x9ea1('0x44')]['id']}},_0x5db11e={};_0x5db11e[_0x9ea1('0x2f')]=_[_0x9ea1('0x2d')](db['ZohoConfiguration'][_0x9ea1('0x45')]);_0x5db11e[_0x9ea1('0x30')]=_[_0x9ea1('0x2d')](_0x575019[_0x9ea1('0x30')]);_0x5db11e[_0x9ea1('0x2e')]=_['intersection'](_0x5db11e['model'],_0x5db11e[_0x9ea1('0x30')]);_0x19670e['attributes']=_[_0x9ea1('0x31')](_0x5db11e[_0x9ea1('0x2f')],qs['fields'](_0x575019[_0x9ea1('0x30')]['fields']));_0x19670e[_0x9ea1('0x33')]=_0x19670e[_0x9ea1('0x33')][_0x9ea1('0x34')]?_0x19670e['attributes']:_0x5db11e['model'];if(_0x575019[_0x9ea1('0x30')][_0x9ea1('0x3e')]){_0x19670e[_0x9ea1('0x3f')]=[{'all':!![]}];}_0x19670e=_[_0x9ea1('0x3b')]({},_0x19670e,_0x575019['options']);return db['ZohoConfiguration'][_0x9ea1('0x46')](_0x19670e)[_0x9ea1('0x3d')](handleEntityNotFound(_0x227d80,null))[_0x9ea1('0x3d')](respondWithResult(_0x227d80,null))['catch'](handleError(_0x227d80,null));};exports[_0x9ea1('0x47')]=function(_0x3616f9,_0x18cc93){return db[_0x9ea1('0x29')][_0x9ea1('0x47')](_0x3616f9[_0x9ea1('0x48')],{})[_0x9ea1('0x3d')](respondWithResult(_0x18cc93,0xc9))[_0x9ea1('0x42')](handleError(_0x18cc93,null));};exports[_0x9ea1('0x23')]=function(_0xbe7cc1,_0x17a9a7){if(_0xbe7cc1['body']['id']){delete _0xbe7cc1[_0x9ea1('0x48')]['id'];}return db[_0x9ea1('0x29')]['find']({'where':{'id':_0xbe7cc1[_0x9ea1('0x44')]['id']}})['then'](handleEntityNotFound(_0x17a9a7,null))[_0x9ea1('0x3d')](saveUpdates(_0xbe7cc1[_0x9ea1('0x48')],null))['then'](respondWithResult(_0x17a9a7,null))[_0x9ea1('0x42')](handleError(_0x17a9a7,null));};exports[_0x9ea1('0x24')]=function(_0x23332f,_0x51b9bb){return db[_0x9ea1('0x29')]['find']({'where':{'id':_0x23332f[_0x9ea1('0x44')]['id']}})[_0x9ea1('0x3d')](handleEntityNotFound(_0x51b9bb,null))[_0x9ea1('0x3d')](removeEntity(_0x51b9bb,null))[_0x9ea1('0x42')](handleError(_0x51b9bb,null));};exports[_0x9ea1('0x49')]=function(_0x4dcf54,_0x56299f,_0xa1eee6){var _0x42435c={};var _0x3d1161={};var _0x16aed4;var _0x90d10e;return db[_0x9ea1('0x29')][_0x9ea1('0x4a')]({'where':{'id':_0x4dcf54[_0x9ea1('0x44')]['id']}})[_0x9ea1('0x3d')](handleEntityNotFound(_0x56299f,null))['then'](function(_0x4f47b6){if(_0x4f47b6){_0x16aed4=_0x4f47b6;_0x3d1161[_0x9ea1('0x2f')]=_[_0x9ea1('0x2d')](db['ZohoField']['rawAttributes']);_0x3d1161[_0x9ea1('0x30')]=_[_0x9ea1('0x2d')](_0x4dcf54[_0x9ea1('0x30')]);_0x3d1161[_0x9ea1('0x2e')]=_[_0x9ea1('0x31')](_0x3d1161[_0x9ea1('0x2f')],_0x3d1161[_0x9ea1('0x30')]);_0x42435c[_0x9ea1('0x33')]=_[_0x9ea1('0x31')](_0x3d1161[_0x9ea1('0x2f')],qs[_0x9ea1('0x32')](_0x4dcf54[_0x9ea1('0x30')]['fields']));_0x42435c[_0x9ea1('0x33')]=_0x42435c[_0x9ea1('0x33')][_0x9ea1('0x34')]?_0x42435c[_0x9ea1('0x33')]:_0x3d1161[_0x9ea1('0x2f')];_0x42435c['order']=qs[_0x9ea1('0x37')](_0x4dcf54[_0x9ea1('0x30')][_0x9ea1('0x37')]);_0x42435c[_0x9ea1('0x38')]=qs['filters'](_[_0x9ea1('0x39')](_0x4dcf54['query'],_0x3d1161[_0x9ea1('0x2e')]));if(_0x4dcf54[_0x9ea1('0x30')][_0x9ea1('0x3a')]){_0x42435c[_0x9ea1('0x38')]=_[_0x9ea1('0x3b')](_0x42435c[_0x9ea1('0x38')],{'$or':_[_0x9ea1('0x28')](_0x42435c['attributes'],function(_0x22ad2d){var _0x55ac68={};_0x55ac68[_0x22ad2d]={'$like':'%'+_0x4dcf54[_0x9ea1('0x30')]['filter']+'%'};return _0x55ac68;})});}_0x42435c=_[_0x9ea1('0x3b')]({},_0x42435c,_0x4dcf54[_0x9ea1('0x3c')]);return _0x16aed4['getFields'](_0x42435c);}})[_0x9ea1('0x3d')](function(_0x33bcb7){if(_0x33bcb7){_0x90d10e=_0x33bcb7[_0x9ea1('0x34')];if(!_0x4dcf54[_0x9ea1('0x30')]['hasOwnProperty'](_0x9ea1('0x36'))){_0x42435c['limit']=qs['limit'](_0x4dcf54[_0x9ea1('0x30')][_0x9ea1('0x1d')]);_0x42435c[_0x9ea1('0x1b')]=qs[_0x9ea1('0x1b')](_0x4dcf54[_0x9ea1('0x30')][_0x9ea1('0x1b')]);}return _0x16aed4[_0x9ea1('0x49')](_0x42435c);}})[_0x9ea1('0x3d')](function(_0x2da617){if(_0x2da617){return _0x2da617?{'count':_0x90d10e,'rows':_0x2da617}:null;}})[_0x9ea1('0x3d')](respondWithResult(_0x56299f,null))[_0x9ea1('0x42')](handleError(_0x56299f,null));};exports[_0x9ea1('0x4b')]=function(_0x5292bc,_0x1c30d2,_0x4cae60){var _0x284e30={};var _0x57dd48={};var _0x4b5c1b;var _0x5e4722;return db[_0x9ea1('0x29')][_0x9ea1('0x4a')]({'where':{'id':_0x5292bc['params']['id']}})[_0x9ea1('0x3d')](handleEntityNotFound(_0x1c30d2,null))['then'](function(_0x56fc40){if(_0x56fc40){_0x4b5c1b=_0x56fc40;_0x57dd48[_0x9ea1('0x2f')]=_[_0x9ea1('0x2d')](db[_0x9ea1('0x4c')][_0x9ea1('0x45')]);_0x57dd48[_0x9ea1('0x30')]=_[_0x9ea1('0x2d')](_0x5292bc[_0x9ea1('0x30')]);_0x57dd48[_0x9ea1('0x2e')]=_[_0x9ea1('0x31')](_0x57dd48[_0x9ea1('0x2f')],_0x57dd48[_0x9ea1('0x30')]);_0x284e30[_0x9ea1('0x33')]=_['intersection'](_0x57dd48[_0x9ea1('0x2f')],qs['fields'](_0x5292bc['query'][_0x9ea1('0x32')]));_0x284e30[_0x9ea1('0x33')]=_0x284e30['attributes'][_0x9ea1('0x34')]?_0x284e30['attributes']:_0x57dd48[_0x9ea1('0x2f')];_0x284e30[_0x9ea1('0x4d')]=qs[_0x9ea1('0x37')](_0x5292bc[_0x9ea1('0x30')][_0x9ea1('0x37')]);_0x284e30[_0x9ea1('0x38')]=qs['filters'](_[_0x9ea1('0x39')](_0x5292bc[_0x9ea1('0x30')],_0x57dd48[_0x9ea1('0x2e')]));if(_0x5292bc['query']['filter']){_0x284e30[_0x9ea1('0x38')]=_[_0x9ea1('0x3b')](_0x284e30[_0x9ea1('0x38')],{'$or':_[_0x9ea1('0x28')](_0x284e30[_0x9ea1('0x33')],function(_0x465f2e){var _0x824e45={};_0x824e45[_0x465f2e]={'$like':'%'+_0x5292bc[_0x9ea1('0x30')]['filter']+'%'};return _0x824e45;})});}_0x284e30=_[_0x9ea1('0x3b')]({},_0x284e30,_0x5292bc[_0x9ea1('0x3c')]);return _0x4b5c1b[_0x9ea1('0x4b')](_0x284e30);}})[_0x9ea1('0x3d')](function(_0x526a67){if(_0x526a67){_0x5e4722=_0x526a67['length'];if(!_0x5292bc[_0x9ea1('0x30')][_0x9ea1('0x35')](_0x9ea1('0x36'))){_0x284e30[_0x9ea1('0x1d')]=qs[_0x9ea1('0x1d')](_0x5292bc[_0x9ea1('0x30')]['limit']);_0x284e30[_0x9ea1('0x1b')]=qs['offset'](_0x5292bc[_0x9ea1('0x30')][_0x9ea1('0x1b')]);}return _0x4b5c1b[_0x9ea1('0x4b')](_0x284e30);}})[_0x9ea1('0x3d')](function(_0x5eff54){if(_0x5eff54){return _0x5eff54?{'count':_0x5e4722,'rows':_0x5eff54}:null;}})['then'](respondWithResult(_0x1c30d2,null))[_0x9ea1('0x42')](handleError(_0x1c30d2,null));};exports[_0x9ea1('0x4e')]=function(_0x3a086c,_0x4c9d4c,_0x2df3f5){var _0x33cd44={};var _0x29fb0b={};var _0x273de4;var _0x229ba2;return db[_0x9ea1('0x29')][_0x9ea1('0x4a')]({'where':{'id':_0x3a086c[_0x9ea1('0x44')]['id']}})[_0x9ea1('0x3d')](handleEntityNotFound(_0x4c9d4c,null))[_0x9ea1('0x3d')](function(_0x545580){if(_0x545580){_0x273de4=_0x545580;_0x29fb0b['model']=_[_0x9ea1('0x2d')](db[_0x9ea1('0x4c')]['rawAttributes']);_0x29fb0b[_0x9ea1('0x30')]=_[_0x9ea1('0x2d')](_0x3a086c[_0x9ea1('0x30')]);_0x29fb0b[_0x9ea1('0x2e')]=_['intersection'](_0x29fb0b[_0x9ea1('0x2f')],_0x29fb0b[_0x9ea1('0x30')]);_0x33cd44['attributes']=_['intersection'](_0x29fb0b['model'],qs['fields'](_0x3a086c['query'][_0x9ea1('0x32')]));_0x33cd44['attributes']=_0x33cd44[_0x9ea1('0x33')][_0x9ea1('0x34')]?_0x33cd44[_0x9ea1('0x33')]:_0x29fb0b[_0x9ea1('0x2f')];_0x33cd44[_0x9ea1('0x4d')]=qs[_0x9ea1('0x37')](_0x3a086c[_0x9ea1('0x30')][_0x9ea1('0x37')]);_0x33cd44[_0x9ea1('0x38')]=qs['filters'](_[_0x9ea1('0x39')](_0x3a086c[_0x9ea1('0x30')],_0x29fb0b['filters']));if(_0x3a086c[_0x9ea1('0x30')][_0x9ea1('0x3a')]){_0x33cd44[_0x9ea1('0x38')]=_[_0x9ea1('0x3b')](_0x33cd44[_0x9ea1('0x38')],{'$or':_[_0x9ea1('0x28')](_0x33cd44[_0x9ea1('0x33')],function(_0x34a53b){var _0x2d7b45={};_0x2d7b45[_0x34a53b]={'$like':'%'+_0x3a086c[_0x9ea1('0x30')][_0x9ea1('0x3a')]+'%'};return _0x2d7b45;})});}_0x33cd44=_[_0x9ea1('0x3b')]({},_0x33cd44,_0x3a086c['options']);return _0x273de4['getDescriptions'](_0x33cd44);}})[_0x9ea1('0x3d')](function(_0x5d871f){if(_0x5d871f){_0x229ba2=_0x5d871f[_0x9ea1('0x34')];if(!_0x3a086c['query']['hasOwnProperty']('nolimit')){_0x33cd44['limit']=qs[_0x9ea1('0x1d')](_0x3a086c[_0x9ea1('0x30')]['limit']);_0x33cd44[_0x9ea1('0x1b')]=qs[_0x9ea1('0x1b')](_0x3a086c[_0x9ea1('0x30')][_0x9ea1('0x1b')]);}return _0x273de4['getDescriptions'](_0x33cd44);}})[_0x9ea1('0x3d')](function(_0xf90cb9){if(_0xf90cb9){return _0xf90cb9?{'count':_0x229ba2,'rows':_0xf90cb9}:null;}})[_0x9ea1('0x3d')](respondWithResult(_0x4c9d4c,null))[_0x9ea1('0x42')](handleError(_0x4c9d4c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 73fba5d..6119a32 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 _0x3106=['exports','define','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes'];(function(_0x5543ea,_0x505218){var _0x3f47ee=function(_0x5597f4){while(--_0x5597f4){_0x5543ea['push'](_0x5543ea['shift']());}};_0x3f47ee(++_0x505218);}(_0x3106,0x84));var _0x6310=function(_0x545ed9,_0x38eac9){_0x545ed9=_0x545ed9-0x0;var _0x4c4107=_0x3106[_0x545ed9];return _0x4c4107;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6310('0x0'))(_0x6310('0x1'));var moment=require(_0x6310('0x2'));var BPromise=require(_0x6310('0x3'));var rp=require(_0x6310('0x4'));var fs=require('fs');var path=require(_0x6310('0x5'));var rimraf=require(_0x6310('0x6'));var config=require('../../config/environment');var attributes=require(_0x6310('0x7'));module[_0x6310('0x8')]=function(_0x1cd8a3,_0x382996){return _0x1cd8a3[_0x6310('0x9')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f14=['moment','bluebird','request-promise','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','api'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9f14,0x10b));var _0x49f1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9f14[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x49f1('0x0'));var util=require(_0x49f1('0x1'));var logger=require('../../config/logger')(_0x49f1('0x2'));var moment=require(_0x49f1('0x3'));var BPromise=require(_0x49f1('0x4'));var rp=require(_0x49f1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49f1('0x6'));module[_0x49f1('0x7')]=function(_0x19d89b,_0x334078){return _0x19d89b['define'](_0x49f1('0x8'),attributes,{'tableName':_0x49f1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index d9ff475..97f97c9 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 _0x3aee=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x110230,_0x9327b4){var _0xef860f=function(_0x146037){while(--_0x146037){_0x110230['push'](_0x110230['shift']());}};_0xef860f(++_0x9327b4);}(_0x3aee,0x1c8));var _0xe3ae=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x3aee[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0xe3ae('0x0'));var util=require(_0xe3ae('0x1'));var moment=require(_0xe3ae('0x2'));var BPromise=require(_0xe3ae('0x3'));var rs=require(_0xe3ae('0x4'));var fs=require('fs');var Redis=require(_0xe3ae('0x5'));var db=require(_0xe3ae('0x6'))['db'];var utils=require(_0xe3ae('0x7'));var logger=require(_0xe3ae('0x8'))(_0xe3ae('0x9'));var config=require(_0xe3ae('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe3ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31bc7b,_0xf7c24,_0x20207){return new BPromise(function(_0x557932,_0x33d202){return client[_0xe3ae('0xc')](_0x31bc7b,_0x20207)[_0xe3ae('0xd')](function(_0x52b02e){logger['info'](_0xe3ae('0xe'),_0xf7c24,_0xe3ae('0xf'));logger[_0xe3ae('0x10')](_0xe3ae('0x11'),_0xf7c24,_0xe3ae('0xf'),JSON['stringify'](_0x52b02e));if(_0x52b02e['error']){if(_0x52b02e[_0xe3ae('0x12')][_0xe3ae('0x13')]===0x1f4){logger[_0xe3ae('0x12')](_0xe3ae('0xe'),_0xf7c24,_0x52b02e['error'][_0xe3ae('0x14')]);return _0x33d202(_0x52b02e['error'][_0xe3ae('0x14')]);}logger[_0xe3ae('0x12')](_0xe3ae('0xe'),_0xf7c24,_0x52b02e[_0xe3ae('0x12')][_0xe3ae('0x14')]);return _0x557932(_0x52b02e[_0xe3ae('0x12')][_0xe3ae('0x14')]);}else{logger[_0xe3ae('0x15')](_0xe3ae('0xe'),_0xf7c24,_0xe3ae('0xf'));_0x557932(_0x52b02e[_0xe3ae('0x16')]['message']);}})[_0xe3ae('0x17')](function(_0x3b6bdc){logger[_0xe3ae('0x12')](_0xe3ae('0xe'),_0xf7c24,_0x3b6bdc);_0x33d202(_0x3b6bdc);});});} \ No newline at end of file +var _0xd2e2=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x573fb3,_0x23e41f){var _0x4f5af4=function(_0x646462){while(--_0x646462){_0x573fb3['push'](_0x573fb3['shift']());}};_0x4f5af4(++_0x23e41f);}(_0xd2e2,0x7d));var _0x2d2e=function(_0x46ab70,_0x1c06e9){_0x46ab70=_0x46ab70-0x0;var _0x3d0dca=_0xd2e2[_0x46ab70];return _0x3d0dca;};'use strict';var _=require(_0x2d2e('0x0'));var util=require('util');var moment=require(_0x2d2e('0x1'));var BPromise=require(_0x2d2e('0x2'));var rs=require(_0x2d2e('0x3'));var fs=require('fs');var Redis=require(_0x2d2e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d2e('0x5'));var logger=require(_0x2d2e('0x6'))(_0x2d2e('0x7'));var config=require(_0x2d2e('0x8'));var jayson=require(_0x2d2e('0x9'));var client=jayson[_0x2d2e('0xa')][_0x2d2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x488ceb,_0xea12e5,_0x474ce9){return new BPromise(function(_0x51bc1f,_0x49941c){return client[_0x2d2e('0xc')](_0x488ceb,_0x474ce9)[_0x2d2e('0xd')](function(_0xa7a353){logger[_0x2d2e('0xe')](_0x2d2e('0xf'),_0xea12e5,_0x2d2e('0x10'));logger[_0x2d2e('0x11')](_0x2d2e('0x12'),_0xea12e5,_0x2d2e('0x10'),JSON['stringify'](_0xa7a353));if(_0xa7a353[_0x2d2e('0x13')]){if(_0xa7a353['error'][_0x2d2e('0x14')]===0x1f4){logger[_0x2d2e('0x13')](_0x2d2e('0xf'),_0xea12e5,_0xa7a353[_0x2d2e('0x13')][_0x2d2e('0x15')]);return _0x49941c(_0xa7a353[_0x2d2e('0x13')][_0x2d2e('0x15')]);}logger[_0x2d2e('0x13')](_0x2d2e('0xf'),_0xea12e5,_0xa7a353[_0x2d2e('0x13')][_0x2d2e('0x15')]);return _0x51bc1f(_0xa7a353['error'][_0x2d2e('0x15')]);}else{logger[_0x2d2e('0xe')](_0x2d2e('0xf'),_0xea12e5,'request\x20sent');_0x51bc1f(_0xa7a353[_0x2d2e('0x16')][_0x2d2e('0x15')]);}})[_0x2d2e('0x17')](function(_0x26d478){logger[_0x2d2e('0x13')](_0x2d2e('0xf'),_0xea12e5,_0x26d478);_0x49941c(_0x26d478);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 68bb52f..e231530 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 _0x6463=['../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x2284bf,_0x3c614c){var _0x597431=function(_0xb7957d){while(--_0xb7957d){_0x2284bf['push'](_0x2284bf['shift']());}};_0x597431(++_0x3c614c);}(_0x6463,0xf6));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3646('0x0'));var util=require(_0x3646('0x1'));var path=require(_0x3646('0x2'));var timeout=require(_0x3646('0x3'));var express=require('express');var router=express[_0x3646('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3646('0x5'));var interaction=require(_0x3646('0x6'));var config=require(_0x3646('0x7'));var controller=require(_0x3646('0x8'));router[_0x3646('0x9')]('/',auth[_0x3646('0xa')](),controller[_0x3646('0xb')]);router[_0x3646('0x9')](_0x3646('0xc'),auth['isAuthenticated'](),controller[_0x3646('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3646('0xe')](_0x3646('0xc'),auth[_0x3646('0xa')](),controller['update']);router[_0x3646('0xf')](_0x3646('0xc'),auth[_0x3646('0xa')](),controller[_0x3646('0x10')]);module[_0x3646('0x11')]=router; \ No newline at end of file +var _0x98ea=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x98ea,0x1f0));var _0xa98e=function(_0x4d119f,_0x31f933){_0x4d119f=_0x4d119f-0x0;var _0x1f60b4=_0x98ea[_0x4d119f];return _0x1f60b4;};'use strict';var multer=require(_0xa98e('0x0'));var util=require(_0xa98e('0x1'));var path=require(_0xa98e('0x2'));var timeout=require('connect-timeout');var express=require(_0xa98e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa98e('0x4'));var interaction=require(_0xa98e('0x5'));var config=require(_0xa98e('0x6'));var controller=require(_0xa98e('0x7'));router['get']('/',auth[_0xa98e('0x8')](),controller[_0xa98e('0x9')]);router['get']('/:id',auth[_0xa98e('0x8')](),controller['show']);router[_0xa98e('0xa')]('/',auth[_0xa98e('0x8')](),controller[_0xa98e('0xb')]);router[_0xa98e('0xc')](_0xa98e('0xd'),auth['isAuthenticated'](),controller[_0xa98e('0xe')]);router[_0xa98e('0xf')]('/:id',auth[_0xa98e('0x8')](),controller[_0xa98e('0x10')]);module[_0xa98e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 1dbdd0d..ce129e0 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 _0xbdb2=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x25076d,_0x1d442a){var _0x4486a0=function(_0x5d4ba0){while(--_0x5d4ba0){_0x25076d['push'](_0x25076d['shift']());}};_0x4486a0(++_0x1d442a);}(_0xbdb2,0xf5));var _0x2bdb=function(_0x3942e2,_0x341872){_0x3942e2=_0x3942e2-0x0;var _0x47bdc4=_0xbdb2[_0x3942e2];return _0x47bdc4;};'use strict';var Sequelize=require(_0x2bdb('0x0'));module[_0x2bdb('0x1')]={'type':{'type':Sequelize[_0x2bdb('0x2')](_0x2bdb('0x3'),_0x2bdb('0x4'),_0x2bdb('0x5'),_0x2bdb('0x6'),_0x2bdb('0x7')),'defaultValue':_0x2bdb('0x3')},'content':{'type':Sequelize[_0x2bdb('0x8')]},'key':{'type':Sequelize[_0x2bdb('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x2bdb('0x4'),_0x2bdb('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2bdb('0x8')]},'nameField':{'type':Sequelize[_0x2bdb('0x8')]},'customField':{'type':Sequelize[_0x2bdb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2bdb('0x8')]}}; \ No newline at end of file +var _0x131f=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x227cf9,_0x3399ce){var _0xc9b970=function(_0x15bfda){while(--_0x15bfda){_0x227cf9['push'](_0x227cf9['shift']());}};_0xc9b970(++_0x3399ce);}(_0x131f,0x179));var _0xf131=function(_0x36dca0,_0x4072ca){_0x36dca0=_0x36dca0-0x0;var _0x2ac018=_0x131f[_0x36dca0];return _0x2ac018;};'use strict';var Sequelize=require(_0xf131('0x0'));module['exports']={'type':{'type':Sequelize[_0xf131('0x1')](_0xf131('0x2'),_0xf131('0x3'),_0xf131('0x4'),'keyValue',_0xf131('0x5')),'defaultValue':_0xf131('0x2')},'content':{'type':Sequelize[_0xf131('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf131('0x1')](_0xf131('0x2'),_0xf131('0x3'),_0xf131('0x4'))},'keyContent':{'type':Sequelize[_0xf131('0x6')]},'idField':{'type':Sequelize[_0xf131('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf131('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf131('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index aa83b73..8c180ee 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 _0xc926=['jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZohoField','rawAttributes','fieldName','type','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','keys','intersection','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3e287e,_0x34d4ee){var _0x56947b=function(_0x331047){while(--_0x331047){_0x3e287e['push'](_0x3e287e['shift']());}};_0x56947b(++_0x34d4ee);}(_0xc926,0x15e));var _0x6c92=function(_0x248ea4,_0x584670){_0x248ea4=_0x248ea4-0x0;var _0x103529=_0xc926[_0x248ea4];return _0x103529;};'use strict';var emlformat=require(_0x6c92('0x0'));var rimraf=require(_0x6c92('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c92('0x2'));var rp=require(_0x6c92('0x3'));var moment=require(_0x6c92('0x4'));var BPromise=require(_0x6c92('0x5'));var Mustache=require('mustache');var util=require(_0x6c92('0x6'));var path=require(_0x6c92('0x7'));var sox=require(_0x6c92('0x8'));var csv=require(_0x6c92('0x9'));var ejs=require(_0x6c92('0xa'));var fs=require('fs');var fs_extra=require(_0x6c92('0xb'));var _=require(_0x6c92('0xc'));var squel=require(_0x6c92('0xd'));var crypto=require(_0x6c92('0xe'));var jsforce=require(_0x6c92('0xf'));var deskjs=require(_0x6c92('0x10'));var toCsv=require(_0x6c92('0x9'));var querystring=require(_0x6c92('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c92('0x12'));var qs=require(_0x6c92('0x13'));var as=require(_0x6c92('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6c92('0x15'));var utils=require(_0x6c92('0x16'));var config=require(_0x6c92('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c92('0x18'))['db'];function respondWithStatusCode(_0x5d2977,_0x30ce8f){_0x30ce8f=_0x30ce8f||0xcc;return function(_0x113a2b){if(_0x113a2b){return _0x5d2977['sendStatus'](_0x30ce8f);}return _0x5d2977['status'](_0x30ce8f)['end']();};}function respondWithResult(_0x3a8803,_0x2b3dc8){_0x2b3dc8=_0x2b3dc8||0xc8;return function(_0x2a35b3){if(_0x2a35b3){return _0x3a8803['status'](_0x2b3dc8)[_0x6c92('0x19')](_0x2a35b3);}};}function respondWithFilteredResult(_0x3ad6df,_0x212f33){return function(_0x1c9c42){if(_0x1c9c42){var _0x834515=typeof _0x212f33['offset']===_0x6c92('0x1a')&&typeof _0x212f33[_0x6c92('0x1b')]===_0x6c92('0x1a');var _0x3d1bd3=_0x1c9c42[_0x6c92('0x1c')];var _0xae1b67=_0x834515?0x0:_0x212f33[_0x6c92('0x1d')];var _0x1e6566=_0x834515?_0x1c9c42[_0x6c92('0x1c')]:_0x212f33[_0x6c92('0x1d')]+_0x212f33[_0x6c92('0x1b')];var _0x12f1fe;if(_0x1e6566>=_0x3d1bd3){_0x1e6566=_0x3d1bd3;_0x12f1fe=0xc8;}else{_0x12f1fe=0xce;}_0x3ad6df[_0x6c92('0x1e')](_0x12f1fe);return _0x3ad6df['set'](_0x6c92('0x1f'),_0xae1b67+'-'+_0x1e6566+'/'+_0x3d1bd3)['json'](_0x1c9c42);}return null;};}function patchUpdates(_0x2fc8ee){return function(_0x316407){try{jsonpatch[_0x6c92('0x20')](_0x316407,_0x2fc8ee,!![]);}catch(_0x3906a9){return BPromise['reject'](_0x3906a9);}return _0x316407[_0x6c92('0x21')]();};}function saveUpdates(_0x5da74e,_0x539700){return function(_0x15edea){if(_0x15edea){return _0x15edea[_0x6c92('0x22')](_0x5da74e)[_0x6c92('0x23')](function(_0x434590){return _0x434590;});}return null;};}function removeEntity(_0x16060e,_0x27e349){return function(_0x28905f){if(_0x28905f){return _0x28905f[_0x6c92('0x24')]()[_0x6c92('0x23')](function(){_0x16060e[_0x6c92('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1483f9,_0x279260){return function(_0x197253){if(!_0x197253){_0x1483f9[_0x6c92('0x25')](0x194);}return _0x197253;};}function handleError(_0x3711eb,_0x2ccfd2){_0x2ccfd2=_0x2ccfd2||0x1f4;return function(_0xa71905){logger[_0x6c92('0x26')](_0xa71905[_0x6c92('0x27')]);if(_0xa71905[_0x6c92('0x28')]){delete _0xa71905[_0x6c92('0x28')];}_0x3711eb[_0x6c92('0x1e')](_0x2ccfd2)[_0x6c92('0x29')](_0xa71905);};}exports[_0x6c92('0x2a')]=function(_0x3a2817,_0x4abb82){var _0x35d6cb={},_0x5d9e8e={},_0x3ba53a={'count':0x0,'rows':[]};var _0x3a7119=_['map'](db[_0x6c92('0x2b')][_0x6c92('0x2c')],function(_0x1cd16b){return{'name':_0x1cd16b[_0x6c92('0x2d')],'type':_0x1cd16b[_0x6c92('0x2e')]['key']};});_0x5d9e8e['model']=_['map'](_0x3a7119,_0x6c92('0x28'));_0x5d9e8e[_0x6c92('0x2f')]=_['keys'](_0x3a2817[_0x6c92('0x2f')]);_0x5d9e8e[_0x6c92('0x30')]=_['intersection'](_0x5d9e8e[_0x6c92('0x31')],_0x5d9e8e[_0x6c92('0x2f')]);_0x35d6cb[_0x6c92('0x32')]=_['intersection'](_0x5d9e8e[_0x6c92('0x31')],qs['fields'](_0x3a2817[_0x6c92('0x2f')][_0x6c92('0x33')]));_0x35d6cb['attributes']=_0x35d6cb[_0x6c92('0x32')]['length']?_0x35d6cb[_0x6c92('0x32')]:_0x5d9e8e['model'];if(!_0x3a2817['query'][_0x6c92('0x34')](_0x6c92('0x35'))){_0x35d6cb[_0x6c92('0x1b')]=qs['limit'](_0x3a2817[_0x6c92('0x2f')][_0x6c92('0x1b')]);_0x35d6cb['offset']=qs['offset'](_0x3a2817[_0x6c92('0x2f')]['offset']);}_0x35d6cb[_0x6c92('0x36')]=qs[_0x6c92('0x37')](_0x3a2817['query'][_0x6c92('0x37')]);_0x35d6cb[_0x6c92('0x38')]=qs[_0x6c92('0x30')](_[_0x6c92('0x39')](_0x3a2817[_0x6c92('0x2f')],_0x5d9e8e['filters']),_0x3a7119);if(_0x3a2817['query']['filter']){_0x35d6cb[_0x6c92('0x38')]=_[_0x6c92('0x3a')](_0x35d6cb[_0x6c92('0x38')],{'$or':_['map'](_0x3a7119,function(_0x51455d){if(_0x51455d[_0x6c92('0x2e')]!=='VIRTUAL'){var _0x120cba={};_0x120cba[_0x51455d['name']]={'$like':'%'+_0x3a2817[_0x6c92('0x2f')][_0x6c92('0x3b')]+'%'};return _0x120cba;}})});}_0x35d6cb=_[_0x6c92('0x3a')]({},_0x35d6cb,_0x3a2817[_0x6c92('0x3c')]);var _0xa324bc={'where':_0x35d6cb['where']};return db[_0x6c92('0x2b')][_0x6c92('0x1c')](_0xa324bc)[_0x6c92('0x23')](function(_0x20ce53){_0x3ba53a[_0x6c92('0x1c')]=_0x20ce53;if(_0x3a2817[_0x6c92('0x2f')][_0x6c92('0x3d')]){_0x35d6cb[_0x6c92('0x3e')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x35d6cb);})[_0x6c92('0x23')](function(_0x4c7e63){_0x3ba53a[_0x6c92('0x3f')]=_0x4c7e63;return _0x3ba53a;})['then'](respondWithFilteredResult(_0x4abb82,_0x35d6cb))[_0x6c92('0x40')](handleError(_0x4abb82,null));};exports[_0x6c92('0x41')]=function(_0x4fa7d9,_0x3340a4){var _0x4fc561={'raw':!![],'where':{'id':_0x4fa7d9[_0x6c92('0x42')]['id']}},_0x5d030e={};_0x5d030e['model']=_[_0x6c92('0x43')](db[_0x6c92('0x2b')][_0x6c92('0x2c')]);_0x5d030e[_0x6c92('0x2f')]=_[_0x6c92('0x43')](_0x4fa7d9[_0x6c92('0x2f')]);_0x5d030e[_0x6c92('0x30')]=_[_0x6c92('0x44')](_0x5d030e[_0x6c92('0x31')],_0x5d030e[_0x6c92('0x2f')]);_0x4fc561[_0x6c92('0x32')]=_[_0x6c92('0x44')](_0x5d030e[_0x6c92('0x31')],qs[_0x6c92('0x33')](_0x4fa7d9[_0x6c92('0x2f')]['fields']));_0x4fc561[_0x6c92('0x32')]=_0x4fc561['attributes'][_0x6c92('0x45')]?_0x4fc561['attributes']:_0x5d030e[_0x6c92('0x31')];if(_0x4fa7d9['query'][_0x6c92('0x3d')]){_0x4fc561[_0x6c92('0x3e')]=[{'all':!![]}];}_0x4fc561=_[_0x6c92('0x3a')]({},_0x4fc561,_0x4fa7d9[_0x6c92('0x3c')]);return db[_0x6c92('0x2b')][_0x6c92('0x46')](_0x4fc561)['then'](handleEntityNotFound(_0x3340a4,null))[_0x6c92('0x23')](respondWithResult(_0x3340a4,null))[_0x6c92('0x40')](handleError(_0x3340a4,null));};exports[_0x6c92('0x47')]=function(_0xdacb59,_0x43f2e5){return db[_0x6c92('0x2b')][_0x6c92('0x47')](_0xdacb59[_0x6c92('0x48')],{})[_0x6c92('0x23')](respondWithResult(_0x43f2e5,0xc9))['catch'](handleError(_0x43f2e5,null));};exports[_0x6c92('0x22')]=function(_0x5d414c,_0x8b18d0){if(_0x5d414c[_0x6c92('0x48')]['id']){delete _0x5d414c['body']['id'];}return db['ZohoField'][_0x6c92('0x46')]({'where':{'id':_0x5d414c['params']['id']}})[_0x6c92('0x23')](handleEntityNotFound(_0x8b18d0,null))['then'](saveUpdates(_0x5d414c[_0x6c92('0x48')],null))['then'](respondWithResult(_0x8b18d0,null))[_0x6c92('0x40')](handleError(_0x8b18d0,null));};exports['destroy']=function(_0xd633d,_0x1d9690){return db[_0x6c92('0x2b')][_0x6c92('0x46')]({'where':{'id':_0xd633d[_0x6c92('0x42')]['id']}})[_0x6c92('0x23')](handleEntityNotFound(_0x1d9690,null))[_0x6c92('0x23')](removeEntity(_0x1d9690,null))[_0x6c92('0x40')](handleError(_0x1d9690,null));}; \ No newline at end of file +var _0x4854=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','ZohoField','findAll','rows','catch','show','params','create','body','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x4854,0x10d));var _0x4485=function(_0x74115b,_0x31f752){_0x74115b=_0x74115b-0x0;var _0x57ebbd=_0x4854[_0x74115b];return _0x57ebbd;};'use strict';var emlformat=require(_0x4485('0x0'));var rimraf=require(_0x4485('0x1'));var zipdir=require(_0x4485('0x2'));var jsonpatch=require(_0x4485('0x3'));var rp=require(_0x4485('0x4'));var moment=require(_0x4485('0x5'));var BPromise=require(_0x4485('0x6'));var Mustache=require(_0x4485('0x7'));var util=require(_0x4485('0x8'));var path=require(_0x4485('0x9'));var sox=require(_0x4485('0xa'));var csv=require('to-csv');var ejs=require(_0x4485('0xb'));var fs=require('fs');var fs_extra=require(_0x4485('0xc'));var _=require(_0x4485('0xd'));var squel=require(_0x4485('0xe'));var crypto=require(_0x4485('0xf'));var jsforce=require(_0x4485('0x10'));var deskjs=require(_0x4485('0x11'));var toCsv=require(_0x4485('0x12'));var querystring=require(_0x4485('0x13'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4485('0x14'));var qs=require(_0x4485('0x15'));var as=require(_0x4485('0x16'));var hardwareService=require(_0x4485('0x17'));var logger=require(_0x4485('0x18'))(_0x4485('0x19'));var utils=require('../../config/utils');var config=require(_0x4485('0x1a'));var licenseUtil=require(_0x4485('0x1b'));var db=require(_0x4485('0x1c'))['db'];function respondWithStatusCode(_0x53b137,_0x3217b6){_0x3217b6=_0x3217b6||0xcc;return function(_0x34c89f){if(_0x34c89f){return _0x53b137[_0x4485('0x1d')](_0x3217b6);}return _0x53b137[_0x4485('0x1e')](_0x3217b6)['end']();};}function respondWithResult(_0x4ef51b,_0x3c30ce){_0x3c30ce=_0x3c30ce||0xc8;return function(_0x195d56){if(_0x195d56){return _0x4ef51b['status'](_0x3c30ce)[_0x4485('0x1f')](_0x195d56);}};}function respondWithFilteredResult(_0xb326d3,_0x5c2dee){return function(_0x18e70a){if(_0x18e70a){var _0x19d8c9=typeof _0x5c2dee[_0x4485('0x20')]===_0x4485('0x21')&&typeof _0x5c2dee[_0x4485('0x22')]===_0x4485('0x21');var _0x2b7d41=_0x18e70a[_0x4485('0x23')];var _0x4e0859=_0x19d8c9?0x0:_0x5c2dee[_0x4485('0x20')];var _0x3b3b34=_0x19d8c9?_0x18e70a[_0x4485('0x23')]:_0x5c2dee[_0x4485('0x20')]+_0x5c2dee[_0x4485('0x22')];var _0x3bab88;if(_0x3b3b34>=_0x2b7d41){_0x3b3b34=_0x2b7d41;_0x3bab88=0xc8;}else{_0x3bab88=0xce;}_0xb326d3[_0x4485('0x1e')](_0x3bab88);return _0xb326d3[_0x4485('0x24')](_0x4485('0x25'),_0x4e0859+'-'+_0x3b3b34+'/'+_0x2b7d41)[_0x4485('0x1f')](_0x18e70a);}return null;};}function patchUpdates(_0x190ac4){return function(_0x164644){try{jsonpatch[_0x4485('0x26')](_0x164644,_0x190ac4,!![]);}catch(_0x20959c){return BPromise[_0x4485('0x27')](_0x20959c);}return _0x164644['save']();};}function saveUpdates(_0x5c60ad,_0x380ba2){return function(_0x5811ad){if(_0x5811ad){return _0x5811ad[_0x4485('0x28')](_0x5c60ad)[_0x4485('0x29')](function(_0x17a9b9){return _0x17a9b9;});}return null;};}function removeEntity(_0x560d61,_0x5b24e9){return function(_0x2c487d){if(_0x2c487d){return _0x2c487d[_0x4485('0x2a')]()['then'](function(){_0x560d61[_0x4485('0x1e')](0xcc)[_0x4485('0x2b')]();});}};}function handleEntityNotFound(_0x6f9cfb,_0x5e198e){return function(_0x25c2b1){if(!_0x25c2b1){_0x6f9cfb[_0x4485('0x1d')](0x194);}return _0x25c2b1;};}function handleError(_0x367d1d,_0x4fc0c4){_0x4fc0c4=_0x4fc0c4||0x1f4;return function(_0x177dbd){logger[_0x4485('0x2c')](_0x177dbd[_0x4485('0x2d')]);if(_0x177dbd[_0x4485('0x2e')]){delete _0x177dbd[_0x4485('0x2e')];}_0x367d1d[_0x4485('0x1e')](_0x4fc0c4)['send'](_0x177dbd);};}exports[_0x4485('0x2f')]=function(_0xd43966,_0x1d74fd){var _0x216209={},_0x7a63d5={},_0x2a9ba={'count':0x0,'rows':[]};var _0x4f8912=_['map'](db['ZohoField'][_0x4485('0x30')],function(_0x543798){return{'name':_0x543798[_0x4485('0x31')],'type':_0x543798[_0x4485('0x32')][_0x4485('0x33')]};});_0x7a63d5[_0x4485('0x34')]=_[_0x4485('0x35')](_0x4f8912,_0x4485('0x2e'));_0x7a63d5[_0x4485('0x36')]=_[_0x4485('0x37')](_0xd43966['query']);_0x7a63d5[_0x4485('0x38')]=_[_0x4485('0x39')](_0x7a63d5[_0x4485('0x34')],_0x7a63d5[_0x4485('0x36')]);_0x216209[_0x4485('0x3a')]=_['intersection'](_0x7a63d5[_0x4485('0x34')],qs['fields'](_0xd43966[_0x4485('0x36')][_0x4485('0x3b')]));_0x216209[_0x4485('0x3a')]=_0x216209[_0x4485('0x3a')][_0x4485('0x3c')]?_0x216209[_0x4485('0x3a')]:_0x7a63d5['model'];if(!_0xd43966[_0x4485('0x36')][_0x4485('0x3d')](_0x4485('0x3e'))){_0x216209['limit']=qs[_0x4485('0x22')](_0xd43966[_0x4485('0x36')][_0x4485('0x22')]);_0x216209['offset']=qs['offset'](_0xd43966[_0x4485('0x36')][_0x4485('0x20')]);}_0x216209[_0x4485('0x3f')]=qs['sort'](_0xd43966[_0x4485('0x36')][_0x4485('0x40')]);_0x216209[_0x4485('0x41')]=qs[_0x4485('0x38')](_[_0x4485('0x42')](_0xd43966[_0x4485('0x36')],_0x7a63d5[_0x4485('0x38')]),_0x4f8912);if(_0xd43966[_0x4485('0x36')]['filter']){_0x216209[_0x4485('0x41')]=_[_0x4485('0x43')](_0x216209[_0x4485('0x41')],{'$or':_[_0x4485('0x35')](_0x4f8912,function(_0x128ef0){if(_0x128ef0[_0x4485('0x32')]!==_0x4485('0x44')){var _0x3e4742={};_0x3e4742[_0x128ef0[_0x4485('0x2e')]]={'$like':'%'+_0xd43966[_0x4485('0x36')][_0x4485('0x45')]+'%'};return _0x3e4742;}})});}_0x216209=_[_0x4485('0x43')]({},_0x216209,_0xd43966[_0x4485('0x46')]);var _0x47089f={'where':_0x216209['where']};return db['ZohoField'][_0x4485('0x23')](_0x47089f)['then'](function(_0x560ab9){_0x2a9ba[_0x4485('0x23')]=_0x560ab9;if(_0xd43966['query'][_0x4485('0x47')]){_0x216209[_0x4485('0x48')]=[{'all':!![]}];}return db[_0x4485('0x49')][_0x4485('0x4a')](_0x216209);})[_0x4485('0x29')](function(_0x5f9e00){_0x2a9ba[_0x4485('0x4b')]=_0x5f9e00;return _0x2a9ba;})[_0x4485('0x29')](respondWithFilteredResult(_0x1d74fd,_0x216209))[_0x4485('0x4c')](handleError(_0x1d74fd,null));};exports[_0x4485('0x4d')]=function(_0x121bcc,_0x446e4b){var _0x3234e5={'raw':!![],'where':{'id':_0x121bcc[_0x4485('0x4e')]['id']}},_0x447245={};_0x447245[_0x4485('0x34')]=_['keys'](db[_0x4485('0x49')][_0x4485('0x30')]);_0x447245[_0x4485('0x36')]=_['keys'](_0x121bcc['query']);_0x447245['filters']=_[_0x4485('0x39')](_0x447245[_0x4485('0x34')],_0x447245[_0x4485('0x36')]);_0x3234e5[_0x4485('0x3a')]=_[_0x4485('0x39')](_0x447245[_0x4485('0x34')],qs[_0x4485('0x3b')](_0x121bcc[_0x4485('0x36')][_0x4485('0x3b')]));_0x3234e5['attributes']=_0x3234e5[_0x4485('0x3a')][_0x4485('0x3c')]?_0x3234e5[_0x4485('0x3a')]:_0x447245[_0x4485('0x34')];if(_0x121bcc[_0x4485('0x36')]['includeAll']){_0x3234e5[_0x4485('0x48')]=[{'all':!![]}];}_0x3234e5=_[_0x4485('0x43')]({},_0x3234e5,_0x121bcc[_0x4485('0x46')]);return db[_0x4485('0x49')]['find'](_0x3234e5)[_0x4485('0x29')](handleEntityNotFound(_0x446e4b,null))['then'](respondWithResult(_0x446e4b,null))[_0x4485('0x4c')](handleError(_0x446e4b,null));};exports['create']=function(_0x383a15,_0x2b36f4){return db[_0x4485('0x49')][_0x4485('0x4f')](_0x383a15['body'],{})[_0x4485('0x29')](respondWithResult(_0x2b36f4,0xc9))[_0x4485('0x4c')](handleError(_0x2b36f4,null));};exports['update']=function(_0x4d54b2,_0x5e3b00){if(_0x4d54b2[_0x4485('0x50')]['id']){delete _0x4d54b2[_0x4485('0x50')]['id'];}return db['ZohoField']['find']({'where':{'id':_0x4d54b2[_0x4485('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5e3b00,null))[_0x4485('0x29')](saveUpdates(_0x4d54b2[_0x4485('0x50')],null))[_0x4485('0x29')](respondWithResult(_0x5e3b00,null))[_0x4485('0x4c')](handleError(_0x5e3b00,null));};exports[_0x4485('0x2a')]=function(_0x3dca00,_0x7deb45){return db[_0x4485('0x49')][_0x4485('0x51')]({'where':{'id':_0x3dca00[_0x4485('0x4e')]['id']}})[_0x4485('0x29')](handleEntityNotFound(_0x7deb45,null))['then'](removeEntity(_0x7deb45,null))['catch'](handleError(_0x7deb45,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b7988cc..9420868 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 _0x7046=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','ZohoField','idField'];(function(_0x45d345,_0x505306){var _0x18991f=function(_0x5a1392){while(--_0x5a1392){_0x45d345['push'](_0x45d345['shift']());}};_0x18991f(++_0x505306);}(_0x7046,0x144));var _0x6704=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7046[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x6704('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb44a=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','../../config/logger','moment','path','../../config/environment','./intZohoField.attributes','exports'];(function(_0x1fcee9,_0xe4b6a3){var _0x190dfc=function(_0x267aa8){while(--_0x267aa8){_0x1fcee9['push'](_0x1fcee9['shift']());}};_0x190dfc(++_0xe4b6a3);}(_0xb44a,0x1c2));var _0xab44=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0xb44a[_0x4c06a3];return _0x7ff53c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));module[_0xab44('0x5')]=function(_0x28681a,_0x2f3948){return _0x28681a[_0xab44('0x6')](_0xab44('0x7'),attributes,{'tableName':_0xab44('0x8'),'paranoid':![],'indexes':[{'name':_0xab44('0x9'),'fields':[_0xab44('0xa'),_0xab44('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 4f37f2c..270da3c 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 _0x0ae2=['client','request','then','info','request\x20sent','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b7a40,_0x3e178a){var _0x2b117c=function(_0x2f82a4){while(--_0x2f82a4){_0x4b7a40['push'](_0x4b7a40['shift']());}};_0x2b117c(++_0x3e178a);}(_0x0ae2,0x1ad));var _0x20ae=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0x0ae2[_0x5c18ef];return _0x33789d;};'use strict';var _=require(_0x20ae('0x0'));var util=require(_0x20ae('0x1'));var moment=require(_0x20ae('0x2'));var BPromise=require(_0x20ae('0x3'));var rs=require(_0x20ae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20ae('0x5'))['db'];var utils=require(_0x20ae('0x6'));var logger=require(_0x20ae('0x7'))(_0x20ae('0x8'));var config=require(_0x20ae('0x9'));var jayson=require(_0x20ae('0xa'));var client=jayson[_0x20ae('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x542082,_0x2ac133,_0x427c96){return new BPromise(function(_0x30b985,_0x209afe){return client[_0x20ae('0xc')](_0x542082,_0x427c96)[_0x20ae('0xd')](function(_0x19d29e){logger[_0x20ae('0xe')]('ZohoField,\x20%s,\x20%s',_0x2ac133,_0x20ae('0xf'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x2ac133,_0x20ae('0xf'),JSON[_0x20ae('0x10')](_0x19d29e));if(_0x19d29e[_0x20ae('0x11')]){if(_0x19d29e[_0x20ae('0x11')][_0x20ae('0x12')]===0x1f4){logger[_0x20ae('0x11')](_0x20ae('0x13'),_0x2ac133,_0x19d29e[_0x20ae('0x11')]['message']);return _0x209afe(_0x19d29e[_0x20ae('0x11')][_0x20ae('0x14')]);}logger['error'](_0x20ae('0x13'),_0x2ac133,_0x19d29e['error'][_0x20ae('0x14')]);return _0x30b985(_0x19d29e[_0x20ae('0x11')][_0x20ae('0x14')]);}else{logger[_0x20ae('0xe')]('ZohoField,\x20%s,\x20%s',_0x2ac133,_0x20ae('0xf'));_0x30b985(_0x19d29e[_0x20ae('0x15')][_0x20ae('0x14')]);}})['catch'](function(_0x228fbb){logger['error'](_0x20ae('0x13'),_0x2ac133,_0x228fbb);_0x209afe(_0x228fbb);});});} \ No newline at end of file +var _0x056a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3e7a20,_0x56763c){var _0xce3326=function(_0x55f08d){while(--_0x55f08d){_0x3e7a20['push'](_0x3e7a20['shift']());}};_0xce3326(++_0x56763c);}(_0x056a,0xdb));var _0xa056=function(_0x49ce1a,_0x84e3ca){_0x49ce1a=_0x49ce1a-0x0;var _0x3fa24f=_0x056a[_0x49ce1a];return _0x3fa24f;};'use strict';var _=require(_0xa056('0x0'));var util=require(_0xa056('0x1'));var moment=require(_0xa056('0x2'));var BPromise=require(_0xa056('0x3'));var rs=require(_0xa056('0x4'));var fs=require('fs');var Redis=require(_0xa056('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa056('0x6'));var logger=require(_0xa056('0x7'))(_0xa056('0x8'));var config=require(_0xa056('0x9'));var jayson=require(_0xa056('0xa'));var client=jayson[_0xa056('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5856e0,_0x2622c1,_0x32aa8f){return new BPromise(function(_0x56fd9e,_0x5cc8da){return client[_0xa056('0xc')](_0x5856e0,_0x32aa8f)[_0xa056('0xd')](function(_0x38b35f){logger[_0xa056('0xe')]('ZohoField,\x20%s,\x20%s',_0x2622c1,_0xa056('0xf'));logger[_0xa056('0x10')](_0xa056('0x11'),_0x2622c1,_0xa056('0xf'),JSON[_0xa056('0x12')](_0x38b35f));if(_0x38b35f[_0xa056('0x13')]){if(_0x38b35f[_0xa056('0x13')][_0xa056('0x14')]===0x1f4){logger[_0xa056('0x13')](_0xa056('0x15'),_0x2622c1,_0x38b35f[_0xa056('0x13')][_0xa056('0x16')]);return _0x5cc8da(_0x38b35f[_0xa056('0x13')][_0xa056('0x16')]);}logger[_0xa056('0x13')](_0xa056('0x15'),_0x2622c1,_0x38b35f[_0xa056('0x13')]['message']);return _0x56fd9e(_0x38b35f[_0xa056('0x13')][_0xa056('0x16')]);}else{logger[_0xa056('0xe')]('ZohoField,\x20%s,\x20%s',_0x2622c1,_0xa056('0xf'));_0x56fd9e(_0x38b35f[_0xa056('0x17')]['message']);}})[_0xa056('0x18')](function(_0x1993a6){logger[_0xa056('0x13')](_0xa056('0x15'),_0x2622c1,_0x1993a6);_0x5cc8da(_0x1993a6);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d1cabb4..d6f91e8 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3a2552,_0x1059a4){var _0x103f9b=function(_0x41f0fe){while(--_0x41f0fe){_0x3a2552['push'](_0x3a2552['shift']());}};_0x103f9b(++_0x1059a4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xcb91[_0x35007a];return _0x574f68;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1c85db,_0x5b12ad){var _0x46bef9=function(_0x4548f5){while(--_0x4548f5){_0x1c85db['push'](_0x1c85db['shift']());}};_0x46bef9(++_0x5b12ad);}(_0x70e0,0x17b));var _0x070e=function(_0xe76ec6,_0x41ae88){_0xe76ec6=_0xe76ec6-0x0;var _0x58ecbe=_0x70e0[_0xe76ec6];return _0x58ecbe;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 8f186ed..ace7f41 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 _0xd1c5=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x1c0086,_0x51e371){var _0x3838ff=function(_0x534b22){while(--_0x534b22){_0x1c0086['push'](_0x1c0086['shift']());}};_0x3838ff(++_0x51e371);}(_0xd1c5,0xf2));var _0x5d1c=function(_0x3201f7,_0x14ff9d){_0x3201f7=_0x3201f7-0x0;var _0x20fe3d=_0xd1c5[_0x3201f7];return _0x20fe3d;};'use strict';var Sequelize=require(_0x5d1c('0x0'));module[_0x5d1c('0x1')]={'name':{'type':Sequelize[_0x5d1c('0x2')],'allowNull':![],'unique':_0x5d1c('0x3')},'version':{'type':Sequelize[_0x5d1c('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x5d1c('0x2')],'defaultValue':_0x5d1c('0x4')},'filename':{'type':Sequelize[_0x5d1c('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5d1c('0x2')]},'size':{'type':Sequelize[_0x5d1c('0x5')]},'active':{'type':Sequelize[_0x5d1c('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x5d1c('0x2')]},'logo':{'type':Sequelize[_0x5d1c('0x2')]},'state':{'type':Sequelize[_0x5d1c('0x2')],'unique':_0x5d1c('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x5d1c('0x2')]},'remoteUri':{'type':Sequelize[_0x5d1c('0x2')]},'link':{'type':Sequelize[_0x5d1c('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xe605=['BOOLEAN','state','sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER'];(function(_0x36ed80,_0x102296){var _0x418c68=function(_0x2a91fc){while(--_0x2a91fc){_0x36ed80['push'](_0x36ed80['shift']());}};_0x418c68(++_0x102296);}(_0xe605,0x92));var _0x5e60=function(_0x205399,_0x4b979e){_0x205399=_0x205399-0x0;var _0x2782a0=_0xe605[_0x205399];return _0x2782a0;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5e60('0x2')},'version':{'type':Sequelize[_0x5e60('0x3')],'allowNull':![],'unique':_0x5e60('0x2')},'main':{'type':Sequelize[_0x5e60('0x3')],'defaultValue':_0x5e60('0x4')},'filename':{'type':Sequelize[_0x5e60('0x3')]},'path':{'type':Sequelize[_0x5e60('0x3')]},'type':{'type':Sequelize[_0x5e60('0x3')]},'size':{'type':Sequelize[_0x5e60('0x5')]},'active':{'type':Sequelize[_0x5e60('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x5e60('0x3')]},'logo':{'type':Sequelize[_0x5e60('0x3')]},'state':{'type':Sequelize['STRING'],'unique':_0x5e60('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x5e60('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 275bd87..45e85fe 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 _0xe3da=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x4da8ba,_0x3364d0){var _0x143cb7=function(_0x1bdc36){while(--_0x1bdc36){_0x4da8ba['push'](_0x4da8ba['shift']());}};_0x143cb7(++_0x3364d0);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));}; \ No newline at end of file +var _0x1967=['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','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Integration','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x1967,0x173));var _0x7196=function(_0x468769,_0x5123e9){_0x468769=_0x468769-0x0;var _0x2adfe8=_0x1967[_0x468769];return _0x2adfe8;};'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'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['Integration'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['Integration'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['Integration'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c16a1a1..0060140 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 _0xec33=['lodash','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration'];(function(_0x50852c,_0x5bfe1a){var _0x4a0d4e=function(_0x16651f){while(--_0x16651f){_0x50852c['push'](_0x50852c['shift']());}};_0x4a0d4e(++_0x5bfe1a);}(_0xec33,0x15f));var _0x3ec3=function(_0x5e68ee,_0x5ae015){_0x5e68ee=_0x5e68ee-0x0;var _0x4e216d=_0xec33[_0x5e68ee];return _0x4e216d;};'use strict';var _=require(_0x3ec3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3ec3('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ec3('0x2'));var rimraf=require(_0x3ec3('0x3'));var config=require(_0x3ec3('0x4'));var attributes=require(_0x3ec3('0x5'));module[_0x3ec3('0x6')]=function(_0x57e78c,_0x44057d){return _0x57e78c[_0x3ec3('0x7')](_0x3ec3('0x8'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b62=['path','rimraf','../../config/environment','./integration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b6a94,_0x532c07){var _0x1fdc7f=function(_0x3925f6){while(--_0x3925f6){_0x1b6a94['push'](_0x1b6a94['shift']());}};_0x1fdc7f(++_0x532c07);}(_0x6b62,0x1ce));var _0x26b6=function(_0x128966,_0x1f870d){_0x128966=_0x128966-0x0;var _0x1ca5db=_0x6b62[_0x128966];return _0x1ca5db;};'use strict';var _=require(_0x26b6('0x0'));var util=require('util');var logger=require(_0x26b6('0x1'))(_0x26b6('0x2'));var moment=require(_0x26b6('0x3'));var BPromise=require(_0x26b6('0x4'));var rp=require(_0x26b6('0x5'));var fs=require('fs');var path=require(_0x26b6('0x6'));var rimraf=require(_0x26b6('0x7'));var config=require(_0x26b6('0x8'));var attributes=require(_0x26b6('0x9'));module[_0x26b6('0xa')]=function(_0x4b70cb,_0x8c0ebe){return _0x4b70cb[_0x26b6('0xb')]('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 7624750..20aea92 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 _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x55f279,_0x300841){var _0x10899d=function(_0x5e292f){while(--_0x5e292f){_0x55f279['push'](_0x55f279['shift']());}};_0x10899d(++_0x300841);}(_0x2542,0x169));var _0x2254=function(_0x5b1668,_0x20e470){_0x5b1668=_0x5b1668-0x0;var _0x298aa1=_0x2542[_0x5b1668];return _0x298aa1;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x9117ad,_0x386be4){var _0x540f0c=function(_0x4e117a){while(--_0x4e117a){_0x9117ad['push'](_0x9117ad['shift']());}};_0x540f0c(++_0x386be4);}(_0xda2d,0x102));var _0xdda2=function(_0xde91db,_0x3c331f){_0xde91db=_0xde91db-0x0;var _0x36528d=_0xda2d[_0xde91db];return _0x36528d;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Integration,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index e2af250..0024567 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./integrationReport.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./integrationReport.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 2389a1c..41319b1 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 _0x1109=['SENT','SENDING','RECEIVED','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0xe84805,_0x2702d9){var _0x398efd=function(_0x37cfad){while(--_0x37cfad){_0xe84805['push'](_0xe84805['shift']());}};_0x398efd(++_0x2702d9);}(_0x1109,0x17d));var _0x9110=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0x1109[_0x3438cf];return _0x278698;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x9110('0x0')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x9110('0x0')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x9110('0x1')]},'contacts':{'type':Sequelize[_0x9110('0x0')]},'uniqueid':{'type':Sequelize[_0x9110('0x0')]},'calleridnum':{'type':Sequelize[_0x9110('0x0')]},'calleridname':{'type':Sequelize[_0x9110('0x0')]},'queue':{'type':Sequelize[_0x9110('0x0')]},'interface':{'type':Sequelize[_0x9110('0x0')]},'membername':{'type':Sequelize[_0x9110('0x0')]},'agentcalledAt':{'type':Sequelize[_0x9110('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x9110('0x2')]},'talktime':{'type':Sequelize[_0x9110('0x1')]},'agentacw':{'type':Sequelize[_0x9110('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x9110('0x0')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x9110('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9110('0x2')]},'lastevent':{'type':Sequelize[_0x9110('0x0')]},'channel':{'type':Sequelize[_0x9110('0x0')]},'channelstate':{'type':Sequelize[_0x9110('0x1')]},'channelstatedesc':{'type':Sequelize[_0x9110('0x0')]},'connectedlinenum':{'type':Sequelize[_0x9110('0x0')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9110('0x0')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9110('0x0')]},'destchannel':{'type':Sequelize[_0x9110('0x0')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x9110('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9110('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x9110('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x9110('0x0')]},'destlanguage':{'type':Sequelize[_0x9110('0x0')]},'destaccountcode':{'type':Sequelize[_0x9110('0x0')]},'destcontext':{'type':Sequelize[_0x9110('0x0')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x9110('0x0')]},'messageId':{'type':Sequelize[_0x9110('0x0')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x9110('0x0')]},'from':{'type':Sequelize[_0x9110('0x0')]},'to':{'type':Sequelize[_0x9110('0x0')]},'cc':{'type':Sequelize[_0x9110('0x0')]},'attachment':{'type':Sequelize[_0x9110('0x4')]},'html':{'type':Sequelize[_0x9110('0x4')]},'text':{'type':Sequelize[_0x9110('0x4')]},'status':{'type':Sequelize[_0x9110('0x5')](_0x9110('0x6'),_0x9110('0x7'),_0x9110('0x8'),'FAILED')},'url':{'type':Sequelize[_0x9110('0x0')]},'app':{'type':Sequelize[_0x9110('0x0')]},'appdata':{'type':Sequelize[_0x9110('0x0')]},'projectId':{'type':Sequelize[_0x9110('0x1')]}}; \ No newline at end of file +var _0xc1fe=['sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED'];(function(_0x4ef1a9,_0x59a5fa){var _0x23f201=function(_0x229355){while(--_0x229355){_0x4ef1a9['push'](_0x4ef1a9['shift']());}};_0x23f201(++_0x59a5fa);}(_0xc1fe,0x1c3));var _0xec1f=function(_0xb77d4e,_0x35486b){_0xb77d4e=_0xb77d4e-0x0;var _0x5e702b=_0xc1fe[_0xb77d4e];return _0x5e702b;};'use strict';var Sequelize=require(_0xec1f('0x0'));module[_0xec1f('0x1')]={'integration':{'type':Sequelize[_0xec1f('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xec1f('0x2')]},'ticketId':{'type':Sequelize[_0xec1f('0x2')]},'integrationId':{'type':Sequelize[_0xec1f('0x3')]},'contacts':{'type':Sequelize[_0xec1f('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xec1f('0x2')]},'calleridname':{'type':Sequelize[_0xec1f('0x2')]},'queue':{'type':Sequelize[_0xec1f('0x2')]},'interface':{'type':Sequelize[_0xec1f('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xec1f('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xec1f('0x3')]},'agentcomplete':{'type':Sequelize[_0xec1f('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xec1f('0x4')]},'talktime':{'type':Sequelize[_0xec1f('0x3')]},'agentacw':{'type':Sequelize[_0xec1f('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xec1f('0x3')]},'reason':{'type':Sequelize[_0xec1f('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xec1f('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xec1f('0x4')]},'agentdump':{'type':Sequelize[_0xec1f('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xec1f('0x4')]},'lastevent':{'type':Sequelize[_0xec1f('0x2')]},'channel':{'type':Sequelize[_0xec1f('0x2')]},'channelstate':{'type':Sequelize[_0xec1f('0x3')]},'channelstatedesc':{'type':Sequelize[_0xec1f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xec1f('0x2')]},'connectedlinename':{'type':Sequelize[_0xec1f('0x2')]},'language':{'type':Sequelize[_0xec1f('0x2')]},'accountcode':{'type':Sequelize[_0xec1f('0x2')]},'context':{'type':Sequelize[_0xec1f('0x2')]},'exten':{'type':Sequelize[_0xec1f('0x2')]},'priority':{'type':Sequelize[_0xec1f('0x2')]},'destchannel':{'type':Sequelize[_0xec1f('0x2')]},'destchannelstate':{'type':Sequelize[_0xec1f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xec1f('0x2')]},'destcalleridnum':{'type':Sequelize[_0xec1f('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xec1f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xec1f('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xec1f('0x2')]},'destcontext':{'type':Sequelize[_0xec1f('0x2')]},'destexten':{'type':Sequelize[_0xec1f('0x2')]},'destpriority':{'type':Sequelize[_0xec1f('0x2')]},'destuniqueid':{'type':Sequelize[_0xec1f('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xec1f('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xec1f('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xec1f('0x2')]},'attachment':{'type':Sequelize[_0xec1f('0x6')]},'html':{'type':Sequelize[_0xec1f('0x6')]},'text':{'type':Sequelize[_0xec1f('0x6')]},'status':{'type':Sequelize['ENUM'](_0xec1f('0x7'),_0xec1f('0x8'),_0xec1f('0x9'),_0xec1f('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xec1f('0x2')]},'projectId':{'type':Sequelize[_0xec1f('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 0d3013e..2920eab 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 _0x68fd=['destroy','describe','eml-format','rimraf','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','Content-Range','json','reject','save','update','then','name','send','index','map','IntegrationReport','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','show','create','catch','body','find','params'];(function(_0x398c93,_0x53cc62){var _0x3c31c8=function(_0x5113f8){while(--_0x5113f8){_0x398c93['push'](_0x398c93['shift']());}};_0x3c31c8(++_0x53cc62);}(_0x68fd,0x1e5));var _0xd68f=function(_0x102b3d,_0x223627){_0x102b3d=_0x102b3d-0x0;var _0x18d02d=_0x68fd[_0x102b3d];return _0x18d02d;};'use strict';var emlformat=require(_0xd68f('0x0'));var rimraf=require(_0xd68f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd68f('0x2'));var rp=require('request-promise');var moment=require(_0xd68f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd68f('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd68f('0x5'));var csv=require(_0xd68f('0x6'));var ejs=require(_0xd68f('0x7'));var fs=require('fs');var fs_extra=require(_0xd68f('0x8'));var _=require(_0xd68f('0x9'));var squel=require(_0xd68f('0xa'));var crypto=require(_0xd68f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd68f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd68f('0xd'));var Papa=require(_0xd68f('0xe'));var Redis=require('ioredis');var authService=require(_0xd68f('0xf'));var qs=require(_0xd68f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd68f('0x11'))(_0xd68f('0x12'));var utils=require(_0xd68f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd68f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51843f,_0x88e935){_0x88e935=_0x88e935||0xcc;return function(_0xc6971d){if(_0xc6971d){return _0x51843f[_0xd68f('0x15')](_0x88e935);}return _0x51843f[_0xd68f('0x16')](_0x88e935)['end']();};}function respondWithResult(_0x31a48e,_0x56eb41){_0x56eb41=_0x56eb41||0xc8;return function(_0x41e8ac){if(_0x41e8ac){return _0x31a48e[_0xd68f('0x16')](_0x56eb41)['json'](_0x41e8ac);}};}function respondWithFilteredResult(_0x3bfd17,_0x1a1edc){return function(_0x548769){if(_0x548769){var _0x3d5419=typeof _0x1a1edc[_0xd68f('0x17')]===_0xd68f('0x18')&&typeof _0x1a1edc['limit']===_0xd68f('0x18');var _0x5d6995=_0x548769['count'];var _0x18c0bd=_0x3d5419?0x0:_0x1a1edc[_0xd68f('0x17')];var _0x4aa979=_0x3d5419?_0x548769['count']:_0x1a1edc[_0xd68f('0x17')]+_0x1a1edc['limit'];var _0x47f6e1;if(_0x4aa979>=_0x5d6995){_0x4aa979=_0x5d6995;_0x47f6e1=0xc8;}else{_0x47f6e1=0xce;}_0x3bfd17['status'](_0x47f6e1);return _0x3bfd17['set'](_0xd68f('0x19'),_0x18c0bd+'-'+_0x4aa979+'/'+_0x5d6995)[_0xd68f('0x1a')](_0x548769);}return null;};}function patchUpdates(_0x55929a){return function(_0x2f3b33){try{jsonpatch['apply'](_0x2f3b33,_0x55929a,!![]);}catch(_0x7e4763){return BPromise[_0xd68f('0x1b')](_0x7e4763);}return _0x2f3b33[_0xd68f('0x1c')]();};}function saveUpdates(_0x2a4c89,_0x58b907){return function(_0x474f00){if(_0x474f00){return _0x474f00[_0xd68f('0x1d')](_0x2a4c89)['then'](function(_0x598dbb){return _0x598dbb;});}return null;};}function removeEntity(_0x57d388,_0x2dc1de){return function(_0x135f4e){if(_0x135f4e){return _0x135f4e['destroy']()[_0xd68f('0x1e')](function(){_0x57d388['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa9a77,_0x5c7cef){return function(_0x5ba793){if(!_0x5ba793){_0xa9a77['sendStatus'](0x194);}return _0x5ba793;};}function handleError(_0x56b6f1,_0x1867af){_0x1867af=_0x1867af||0x1f4;return function(_0x1b11df){logger['error'](_0x1b11df['stack']);if(_0x1b11df[_0xd68f('0x1f')]){delete _0x1b11df[_0xd68f('0x1f')];}_0x56b6f1['status'](_0x1867af)[_0xd68f('0x20')](_0x1b11df);};}exports[_0xd68f('0x21')]=function(_0x37a757,_0x2178e0){var _0x5995a1={},_0x91f1d6={},_0x5d275d={'count':0x0,'rows':[]};var _0x599bff=_[_0xd68f('0x22')](db[_0xd68f('0x23')][_0xd68f('0x24')],function(_0x33d1c5){return{'name':_0x33d1c5['fieldName'],'type':_0x33d1c5[_0xd68f('0x25')][_0xd68f('0x26')]};});_0x91f1d6['model']=_[_0xd68f('0x22')](_0x599bff,_0xd68f('0x1f'));_0x91f1d6[_0xd68f('0x27')]=_[_0xd68f('0x28')](_0x37a757[_0xd68f('0x27')]);_0x91f1d6[_0xd68f('0x29')]=_['intersection'](_0x91f1d6[_0xd68f('0x2a')],_0x91f1d6[_0xd68f('0x27')]);_0x5995a1[_0xd68f('0x2b')]=_[_0xd68f('0x2c')](_0x91f1d6[_0xd68f('0x2a')],qs[_0xd68f('0x2d')](_0x37a757['query'][_0xd68f('0x2d')]));_0x5995a1[_0xd68f('0x2b')]=_0x5995a1[_0xd68f('0x2b')][_0xd68f('0x2e')]?_0x5995a1['attributes']:_0x91f1d6[_0xd68f('0x2a')];if(!_0x37a757['query'][_0xd68f('0x2f')]('nolimit')){_0x5995a1[_0xd68f('0x30')]=qs[_0xd68f('0x30')](_0x37a757[_0xd68f('0x27')]['limit']);_0x5995a1[_0xd68f('0x17')]=qs[_0xd68f('0x17')](_0x37a757[_0xd68f('0x27')][_0xd68f('0x17')]);}_0x5995a1['order']=qs[_0xd68f('0x31')](_0x37a757['query']['sort']);_0x5995a1['where']=qs[_0xd68f('0x29')](_[_0xd68f('0x32')](_0x37a757[_0xd68f('0x27')],_0x91f1d6[_0xd68f('0x29')]),_0x599bff);if(_0x37a757['query'][_0xd68f('0x33')]){_0x5995a1['where']=_[_0xd68f('0x34')](_0x5995a1[_0xd68f('0x35')],{'$or':_[_0xd68f('0x22')](_0x599bff,function(_0x95be7){if(_0x95be7[_0xd68f('0x25')]!==_0xd68f('0x36')){var _0xf175bb={};_0xf175bb[_0x95be7[_0xd68f('0x1f')]]={'$like':'%'+_0x37a757['query'][_0xd68f('0x33')]+'%'};return _0xf175bb;}})});}_0x5995a1=_[_0xd68f('0x34')]({},_0x5995a1,_0x37a757[_0xd68f('0x37')]);var _0x56a228={'where':_0x5995a1[_0xd68f('0x35')]};return db['IntegrationReport'][_0xd68f('0x38')](_0x56a228)['then'](function(_0x519bc2){_0x5d275d[_0xd68f('0x38')]=_0x519bc2;if(_0x37a757['query'][_0xd68f('0x39')]){_0x5995a1[_0xd68f('0x3a')]=[{'all':!![]}];}return db[_0xd68f('0x23')][_0xd68f('0x3b')](_0x5995a1);})['then'](function(_0x26c788){_0x5d275d[_0xd68f('0x3c')]=_0x26c788;return _0x5d275d;})[_0xd68f('0x1e')](respondWithFilteredResult(_0x2178e0,_0x5995a1))['catch'](handleError(_0x2178e0,null));};exports[_0xd68f('0x3d')]=function(_0x5919fa,_0x21de98){var _0x4df3c5={'raw':![],'where':{'id':_0x5919fa['params']['id']}},_0x33966d={};_0x33966d[_0xd68f('0x2a')]=_['keys'](db['IntegrationReport']['rawAttributes']);_0x33966d[_0xd68f('0x27')]=_[_0xd68f('0x28')](_0x5919fa['query']);_0x33966d[_0xd68f('0x29')]=_[_0xd68f('0x2c')](_0x33966d[_0xd68f('0x2a')],_0x33966d['query']);_0x4df3c5[_0xd68f('0x2b')]=_[_0xd68f('0x2c')](_0x33966d[_0xd68f('0x2a')],qs[_0xd68f('0x2d')](_0x5919fa[_0xd68f('0x27')][_0xd68f('0x2d')]));_0x4df3c5[_0xd68f('0x2b')]=_0x4df3c5['attributes'][_0xd68f('0x2e')]?_0x4df3c5[_0xd68f('0x2b')]:_0x33966d[_0xd68f('0x2a')];if(_0x5919fa['query'][_0xd68f('0x39')]){_0x4df3c5[_0xd68f('0x3a')]=[{'all':!![]}];}_0x4df3c5=_[_0xd68f('0x34')]({},_0x4df3c5,_0x5919fa[_0xd68f('0x37')]);return db['IntegrationReport']['find'](_0x4df3c5)[_0xd68f('0x1e')](handleEntityNotFound(_0x21de98,null))['then'](respondWithResult(_0x21de98,null))['catch'](handleError(_0x21de98,null));};exports[_0xd68f('0x3e')]=function(_0x35ca04,_0x4b3ad1){return db[_0xd68f('0x23')][_0xd68f('0x3e')](_0x35ca04['body'],{})['then'](respondWithResult(_0x4b3ad1,0xc9))[_0xd68f('0x3f')](handleError(_0x4b3ad1,null));};exports[_0xd68f('0x1d')]=function(_0x697cd8,_0x4bd707){if(_0x697cd8[_0xd68f('0x40')]['id']){delete _0x697cd8[_0xd68f('0x40')]['id'];}return db[_0xd68f('0x23')][_0xd68f('0x41')]({'where':{'id':_0x697cd8[_0xd68f('0x42')]['id']}})[_0xd68f('0x1e')](handleEntityNotFound(_0x4bd707,null))['then'](saveUpdates(_0x697cd8['body'],null))[_0xd68f('0x1e')](respondWithResult(_0x4bd707,null))[_0xd68f('0x3f')](handleError(_0x4bd707,null));};exports[_0xd68f('0x43')]=function(_0x3785f6,_0x34b4b1){return db[_0xd68f('0x23')][_0xd68f('0x41')]({'where':{'id':_0x3785f6[_0xd68f('0x42')]['id']}})[_0xd68f('0x1e')](handleEntityNotFound(_0x34b4b1,null))[_0xd68f('0x1e')](removeEntity(_0x34b4b1,null))[_0xd68f('0x3f')](handleError(_0x34b4b1,null));};exports[_0xd68f('0x44')]=function(_0x4fbce0,_0x1aff31){return db[_0xd68f('0x23')][_0xd68f('0x44')]()[_0xd68f('0x1e')](respondWithResult(_0x1aff31,null))[_0xd68f('0x3f')](handleError(_0x1aff31,null));}; \ No newline at end of file +var _0x3306=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x3306,0x180));var _0x6330=function(_0x4cd106,_0xb61855){_0x4cd106=_0x4cd106-0x0;var _0xe8e3b5=_0x3306[_0x4cd106];return _0xe8e3b5;};'use strict';var emlformat=require(_0x6330('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6330('0x1'));var jsonpatch=require(_0x6330('0x2'));var rp=require(_0x6330('0x3'));var moment=require(_0x6330('0x4'));var BPromise=require(_0x6330('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6330('0x6'));var sox=require(_0x6330('0x7'));var csv=require(_0x6330('0x8'));var ejs=require(_0x6330('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6330('0xa'));var squel=require(_0x6330('0xb'));var crypto=require(_0x6330('0xc'));var jsforce=require(_0x6330('0xd'));var deskjs=require(_0x6330('0xe'));var toCsv=require(_0x6330('0x8'));var querystring=require(_0x6330('0xf'));var Papa=require(_0x6330('0x10'));var Redis=require(_0x6330('0x11'));var authService=require(_0x6330('0x12'));var qs=require(_0x6330('0x13'));var as=require(_0x6330('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6330('0x15'));var utils=require(_0x6330('0x16'));var config=require(_0x6330('0x17'));var licenseUtil=require(_0x6330('0x18'));var db=require(_0x6330('0x19'))['db'];function respondWithStatusCode(_0x235b0e,_0x38d75c){_0x38d75c=_0x38d75c||0xcc;return function(_0x36d26d){if(_0x36d26d){return _0x235b0e['sendStatus'](_0x38d75c);}return _0x235b0e[_0x6330('0x1a')](_0x38d75c)[_0x6330('0x1b')]();};}function respondWithResult(_0x3fa945,_0x22ebba){_0x22ebba=_0x22ebba||0xc8;return function(_0x59719e){if(_0x59719e){return _0x3fa945[_0x6330('0x1a')](_0x22ebba)[_0x6330('0x1c')](_0x59719e);}};}function respondWithFilteredResult(_0x57151d,_0x19c665){return function(_0x2dc54d){if(_0x2dc54d){var _0x2f61d8=typeof _0x19c665[_0x6330('0x1d')]===_0x6330('0x1e')&&typeof _0x19c665[_0x6330('0x1f')]==='undefined';var _0x28cd30=_0x2dc54d[_0x6330('0x20')];var _0x536068=_0x2f61d8?0x0:_0x19c665[_0x6330('0x1d')];var _0x426c82=_0x2f61d8?_0x2dc54d['count']:_0x19c665[_0x6330('0x1d')]+_0x19c665[_0x6330('0x1f')];var _0x1b2c7a;if(_0x426c82>=_0x28cd30){_0x426c82=_0x28cd30;_0x1b2c7a=0xc8;}else{_0x1b2c7a=0xce;}_0x57151d['status'](_0x1b2c7a);return _0x57151d['set'](_0x6330('0x21'),_0x536068+'-'+_0x426c82+'/'+_0x28cd30)[_0x6330('0x1c')](_0x2dc54d);}return null;};}function patchUpdates(_0x141204){return function(_0xe049ec){try{jsonpatch[_0x6330('0x22')](_0xe049ec,_0x141204,!![]);}catch(_0xb66400){return BPromise[_0x6330('0x23')](_0xb66400);}return _0xe049ec[_0x6330('0x24')]();};}function saveUpdates(_0x4db8f6,_0x22a88a){return function(_0xb7643f){if(_0xb7643f){return _0xb7643f[_0x6330('0x25')](_0x4db8f6)[_0x6330('0x26')](function(_0x24ec22){return _0x24ec22;});}return null;};}function removeEntity(_0x2b96f2,_0x393174){return function(_0x7a9013){if(_0x7a9013){return _0x7a9013[_0x6330('0x27')]()[_0x6330('0x26')](function(){_0x2b96f2['status'](0xcc)[_0x6330('0x1b')]();});}};}function handleEntityNotFound(_0x566d2e,_0x33da3f){return function(_0x1a5074){if(!_0x1a5074){_0x566d2e[_0x6330('0x28')](0x194);}return _0x1a5074;};}function handleError(_0xdf1be,_0xec4264){_0xec4264=_0xec4264||0x1f4;return function(_0x1bd297){logger[_0x6330('0x29')](_0x1bd297[_0x6330('0x2a')]);if(_0x1bd297[_0x6330('0x2b')]){delete _0x1bd297[_0x6330('0x2b')];}_0xdf1be[_0x6330('0x1a')](_0xec4264)['send'](_0x1bd297);};}exports[_0x6330('0x2c')]=function(_0x2a067a,_0x22a3c6){var _0x573896={},_0x51d88b={},_0x26e5e3={'count':0x0,'rows':[]};var _0x42165e=_[_0x6330('0x2d')](db[_0x6330('0x2e')][_0x6330('0x2f')],function(_0x4f31be){return{'name':_0x4f31be[_0x6330('0x30')],'type':_0x4f31be[_0x6330('0x31')][_0x6330('0x32')]};});_0x51d88b[_0x6330('0x33')]=_[_0x6330('0x2d')](_0x42165e,_0x6330('0x2b'));_0x51d88b['query']=_[_0x6330('0x34')](_0x2a067a[_0x6330('0x35')]);_0x51d88b[_0x6330('0x36')]=_['intersection'](_0x51d88b[_0x6330('0x33')],_0x51d88b['query']);_0x573896[_0x6330('0x37')]=_[_0x6330('0x38')](_0x51d88b['model'],qs[_0x6330('0x39')](_0x2a067a['query'][_0x6330('0x39')]));_0x573896[_0x6330('0x37')]=_0x573896[_0x6330('0x37')][_0x6330('0x3a')]?_0x573896[_0x6330('0x37')]:_0x51d88b[_0x6330('0x33')];if(!_0x2a067a['query'][_0x6330('0x3b')](_0x6330('0x3c'))){_0x573896['limit']=qs['limit'](_0x2a067a[_0x6330('0x35')][_0x6330('0x1f')]);_0x573896['offset']=qs[_0x6330('0x1d')](_0x2a067a['query'][_0x6330('0x1d')]);}_0x573896[_0x6330('0x3d')]=qs[_0x6330('0x3e')](_0x2a067a['query'][_0x6330('0x3e')]);_0x573896['where']=qs[_0x6330('0x36')](_[_0x6330('0x3f')](_0x2a067a[_0x6330('0x35')],_0x51d88b[_0x6330('0x36')]),_0x42165e);if(_0x2a067a['query'][_0x6330('0x40')]){_0x573896[_0x6330('0x41')]=_[_0x6330('0x42')](_0x573896[_0x6330('0x41')],{'$or':_[_0x6330('0x2d')](_0x42165e,function(_0x56c502){if(_0x56c502['type']!==_0x6330('0x43')){var _0x3ec6a4={};_0x3ec6a4[_0x56c502[_0x6330('0x2b')]]={'$like':'%'+_0x2a067a[_0x6330('0x35')][_0x6330('0x40')]+'%'};return _0x3ec6a4;}})});}_0x573896=_[_0x6330('0x42')]({},_0x573896,_0x2a067a['options']);var _0x57ad47={'where':_0x573896['where']};return db[_0x6330('0x2e')][_0x6330('0x20')](_0x57ad47)[_0x6330('0x26')](function(_0xf8e5a){_0x26e5e3[_0x6330('0x20')]=_0xf8e5a;if(_0x2a067a[_0x6330('0x35')][_0x6330('0x44')]){_0x573896[_0x6330('0x45')]=[{'all':!![]}];}return db[_0x6330('0x2e')][_0x6330('0x46')](_0x573896);})[_0x6330('0x26')](function(_0x2312c){_0x26e5e3[_0x6330('0x47')]=_0x2312c;return _0x26e5e3;})[_0x6330('0x26')](respondWithFilteredResult(_0x22a3c6,_0x573896))['catch'](handleError(_0x22a3c6,null));};exports['show']=function(_0x592abf,_0x30e6c9){var _0x4dd437={'raw':![],'where':{'id':_0x592abf[_0x6330('0x48')]['id']}},_0x2e4368={};_0x2e4368[_0x6330('0x33')]=_[_0x6330('0x34')](db['IntegrationReport'][_0x6330('0x2f')]);_0x2e4368['query']=_[_0x6330('0x34')](_0x592abf[_0x6330('0x35')]);_0x2e4368[_0x6330('0x36')]=_[_0x6330('0x38')](_0x2e4368[_0x6330('0x33')],_0x2e4368['query']);_0x4dd437[_0x6330('0x37')]=_[_0x6330('0x38')](_0x2e4368[_0x6330('0x33')],qs[_0x6330('0x39')](_0x592abf['query'][_0x6330('0x39')]));_0x4dd437['attributes']=_0x4dd437[_0x6330('0x37')][_0x6330('0x3a')]?_0x4dd437[_0x6330('0x37')]:_0x2e4368[_0x6330('0x33')];if(_0x592abf[_0x6330('0x35')]['includeAll']){_0x4dd437[_0x6330('0x45')]=[{'all':!![]}];}_0x4dd437=_[_0x6330('0x42')]({},_0x4dd437,_0x592abf[_0x6330('0x49')]);return db[_0x6330('0x2e')][_0x6330('0x4a')](_0x4dd437)['then'](handleEntityNotFound(_0x30e6c9,null))[_0x6330('0x26')](respondWithResult(_0x30e6c9,null))[_0x6330('0x4b')](handleError(_0x30e6c9,null));};exports[_0x6330('0x4c')]=function(_0x45e198,_0x240bb9){return db[_0x6330('0x2e')][_0x6330('0x4c')](_0x45e198[_0x6330('0x4d')],{})[_0x6330('0x26')](respondWithResult(_0x240bb9,0xc9))[_0x6330('0x4b')](handleError(_0x240bb9,null));};exports[_0x6330('0x25')]=function(_0x14e886,_0x45908d){if(_0x14e886['body']['id']){delete _0x14e886[_0x6330('0x4d')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x14e886['params']['id']}})[_0x6330('0x26')](handleEntityNotFound(_0x45908d,null))[_0x6330('0x26')](saveUpdates(_0x14e886[_0x6330('0x4d')],null))['then'](respondWithResult(_0x45908d,null))[_0x6330('0x4b')](handleError(_0x45908d,null));};exports['destroy']=function(_0x203ae4,_0x38e4af){return db[_0x6330('0x2e')][_0x6330('0x4a')]({'where':{'id':_0x203ae4['params']['id']}})[_0x6330('0x26')](handleEntityNotFound(_0x38e4af,null))[_0x6330('0x26')](removeEntity(_0x38e4af,null))[_0x6330('0x4b')](handleError(_0x38e4af,null));};exports[_0x6330('0x4e')]=function(_0x24543d,_0x2da9f1){return db[_0x6330('0x2e')][_0x6330('0x4e')]()[_0x6330('0x26')](respondWithResult(_0x2da9f1,null))['catch'](handleError(_0x2da9f1,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index c5bfa80..c5edb44 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 _0xd98d=['../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','util','../../config/logger','api','rimraf'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xd98d,0x14f));var _0xdd98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd98d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdd98('0x0'));var util=require(_0xdd98('0x1'));var logger=require(_0xdd98('0x2'))(_0xdd98('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdd98('0x4'));var config=require(_0xdd98('0x5'));var attributes=require(_0xdd98('0x6'));module[_0xdd98('0x7')]=function(_0x4f010e,_0xa88182){return _0x4f010e['define'](_0xdd98('0x8'),attributes,{'tableName':_0xdd98('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc002=['rimraf','./integrationReport.attributes','define','report_integration','lodash','util','api','moment','bluebird','request-promise'];(function(_0x55b856,_0x5b04c5){var _0x4f230d=function(_0x58e881){while(--_0x58e881){_0x55b856['push'](_0x55b856['shift']());}};_0x4f230d(++_0x5b04c5);}(_0xc002,0xae));var _0x2c00=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc002[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x2c00('0x0'));var util=require(_0x2c00('0x1'));var logger=require('../../config/logger')(_0x2c00('0x2'));var moment=require(_0x2c00('0x3'));var BPromise=require(_0x2c00('0x4'));var rp=require(_0x2c00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c00('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c00('0x7'));module['exports']=function(_0xa60365,_0x479d34){return _0xa60365[_0x2c00('0x8')]('IntegrationReport',attributes,{'tableName':_0x2c00('0x9'),'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 d527254..ac8b014 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 _0x6d38=['request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x43a3e3,_0xa5ab5e){var _0x5a35e2=function(_0x57c24c){while(--_0x57c24c){_0x43a3e3['push'](_0x43a3e3['shift']());}};_0x5a35e2(++_0xa5ab5e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x6d38[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 5bcd107..5385258 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 _0x3989=['./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','create','addInterval','post','addIntervals','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c05fe,_0x522b60){var _0x5a5764=function(_0x39428b){while(--_0x39428b){_0x1c05fe['push'](_0x1c05fe['shift']());}};_0x5a5764(++_0x522b60);}(_0x3989,0x12f));var _0x9398=function(_0x2a54dc,_0x214c65){_0x2a54dc=_0x2a54dc-0x0;var _0x141d1b=_0x3989[_0x2a54dc];return _0x141d1b;};'use strict';var multer=require(_0x9398('0x0'));var util=require('util');var path=require(_0x9398('0x1'));var timeout=require(_0x9398('0x2'));var express=require(_0x9398('0x3'));var router=express[_0x9398('0x4')]();var fs_extra=require(_0x9398('0x5'));var auth=require(_0x9398('0x6'));var interaction=require(_0x9398('0x7'));var config=require(_0x9398('0x8'));var controller=require(_0x9398('0x9'));router[_0x9398('0xa')]('/',auth[_0x9398('0xb')](),controller[_0x9398('0xc')]);router['get']('/:id',auth[_0x9398('0xb')](),controller[_0x9398('0xd')]);router[_0x9398('0xa')](_0x9398('0xe'),auth[_0x9398('0xb')](),controller['getIntervals']);router['post']('/',auth[_0x9398('0xb')](),controller[_0x9398('0xf')]);router['post'](_0x9398('0xe'),auth[_0x9398('0xb')](),controller[_0x9398('0x10')]);router[_0x9398('0x11')]('/:id/sub_intervals/create_many',auth[_0x9398('0xb')](),controller[_0x9398('0x12')]);router[_0x9398('0x13')](_0x9398('0x14'),auth[_0x9398('0xb')](),controller['update']);router[_0x9398('0x15')]('/:id',auth[_0x9398('0xb')](),controller[_0x9398('0x16')]);module[_0x9398('0x17')]=router; \ No newline at end of file +var _0xa6c6=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','show','/:id/sub_intervals','getIntervals','post','isAuthenticated','create','addInterval','addIntervals'];(function(_0x9e34b8,_0x520030){var _0x54f000=function(_0x2bdc06){while(--_0x2bdc06){_0x9e34b8['push'](_0x9e34b8['shift']());}};_0x54f000(++_0x520030);}(_0xa6c6,0x12e));var _0x6a6c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa6c6[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x6a6c('0x0'));var util=require(_0x6a6c('0x1'));var path=require(_0x6a6c('0x2'));var timeout=require(_0x6a6c('0x3'));var express=require(_0x6a6c('0x4'));var router=express[_0x6a6c('0x5')]();var fs_extra=require(_0x6a6c('0x6'));var auth=require(_0x6a6c('0x7'));var interaction=require(_0x6a6c('0x8'));var config=require(_0x6a6c('0x9'));var controller=require(_0x6a6c('0xa'));router[_0x6a6c('0xb')]('/',auth['isAuthenticated'](),controller[_0x6a6c('0xc')]);router[_0x6a6c('0xb')](_0x6a6c('0xd'),auth['isAuthenticated'](),controller[_0x6a6c('0xe')]);router[_0x6a6c('0xb')](_0x6a6c('0xf'),auth['isAuthenticated'](),controller[_0x6a6c('0x10')]);router[_0x6a6c('0x11')]('/',auth[_0x6a6c('0x12')](),controller[_0x6a6c('0x13')]);router['post']('/:id/sub_intervals',auth[_0x6a6c('0x12')](),controller[_0x6a6c('0x14')]);router['post']('/:id/sub_intervals/create_many',auth[_0x6a6c('0x12')](),controller[_0x6a6c('0x15')]);router[_0x6a6c('0x16')](_0x6a6c('0xd'),auth[_0x6a6c('0x12')](),controller[_0x6a6c('0x17')]);router[_0x6a6c('0x18')](_0x6a6c('0xd'),auth[_0x6a6c('0x12')](),controller[_0x6a6c('0x19')]);module[_0x6a6c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e2b0533..0674b90 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 _0xfbdd=['exports','STRING','sequelize'];(function(_0x1c6569,_0x4a5a27){var _0x39e6f8=function(_0x117373){while(--_0x117373){_0x1c6569['push'](_0x1c6569['shift']());}};_0x39e6f8(++_0x4a5a27);}(_0xfbdd,0x18e));var _0xdfbd=function(_0x52ae30,_0x2364fc){_0x52ae30=_0x52ae30-0x0;var _0x1a05d4=_0xfbdd[_0x52ae30];return _0x1a05d4;};'use strict';var Sequelize=require(_0xdfbd('0x0'));module[_0xdfbd('0x1')]={'name':{'type':Sequelize[_0xdfbd('0x2')]},'description':{'type':Sequelize[_0xdfbd('0x2')]},'interval':{'type':Sequelize[_0xdfbd('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x1553=['exports','STRING'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x1553,0x176));var _0x3155=function(_0x5a9d15,_0x23d58f){_0x5a9d15=_0x5a9d15-0x0;var _0x15cb4d=_0x1553[_0x5a9d15];return _0x15cb4d;};'use strict';var Sequelize=require('sequelize');module[_0x3155('0x0')]={'name':{'type':Sequelize[_0x3155('0x1')]},'description':{'type':Sequelize[_0x3155('0x1')]},'interval':{'type':Sequelize[_0x3155('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 583fff8..f429791 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 _0xeb37=['Intervals','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','hasOwnProperty','nolimit','findOne','bulkCreate','eml-format','rimraf','fast-json-patch','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy'];(function(_0xecd7c9,_0x3260b2){var _0x398372=function(_0x2e42eb){while(--_0x2e42eb){_0xecd7c9['push'](_0xecd7c9['shift']());}};_0x398372(++_0x3260b2);}(_0xeb37,0x136));var _0x7eb3=function(_0x6d0083,_0x567625){_0x6d0083=_0x6d0083-0x0;var _0xe0cf01=_0xeb37[_0x6d0083];return _0xe0cf01;};'use strict';var emlformat=require(_0x7eb3('0x0'));var rimraf=require(_0x7eb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7eb3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7eb3('0x3'));var util=require(_0x7eb3('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x7eb3('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7eb3('0x6'));var _=require(_0x7eb3('0x7'));var squel=require(_0x7eb3('0x8'));var crypto=require(_0x7eb3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7eb3('0xa'));var toCsv=require(_0x7eb3('0x5'));var querystring=require(_0x7eb3('0xb'));var Papa=require(_0x7eb3('0xc'));var Redis=require('ioredis');var authService=require(_0x7eb3('0xd'));var qs=require(_0x7eb3('0xe'));var as=require(_0x7eb3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7eb3('0x10'))(_0x7eb3('0x11'));var utils=require('../../config/utils');var config=require(_0x7eb3('0x12'));var licenseUtil=require(_0x7eb3('0x13'));var db=require(_0x7eb3('0x14'))['db'];var extensions=require(_0x7eb3('0x15'));function respondWithStatusCode(_0x37e9f6,_0xc5781e){_0xc5781e=_0xc5781e||0xcc;return function(_0x36c7a3){if(_0x36c7a3){return _0x37e9f6['sendStatus'](_0xc5781e);}return _0x37e9f6[_0x7eb3('0x16')](_0xc5781e)[_0x7eb3('0x17')]();};}function respondWithResult(_0x3f136c,_0x23a148){_0x23a148=_0x23a148||0xc8;return function(_0x385fab){if(_0x385fab){return _0x3f136c[_0x7eb3('0x16')](_0x23a148)[_0x7eb3('0x18')](_0x385fab);}};}function respondWithFilteredResult(_0x106d85,_0x174cd5){return function(_0x588d5f){if(_0x588d5f){var _0x564875=typeof _0x174cd5[_0x7eb3('0x19')]===_0x7eb3('0x1a')&&typeof _0x174cd5['limit']===_0x7eb3('0x1a');var _0x460092=_0x588d5f[_0x7eb3('0x1b')];var _0xdc60fa=_0x564875?0x0:_0x174cd5[_0x7eb3('0x19')];var _0x5dd95a=_0x564875?_0x588d5f[_0x7eb3('0x1b')]:_0x174cd5['offset']+_0x174cd5[_0x7eb3('0x1c')];var _0x458f44;if(_0x5dd95a>=_0x460092){_0x5dd95a=_0x460092;_0x458f44=0xc8;}else{_0x458f44=0xce;}_0x106d85[_0x7eb3('0x16')](_0x458f44);return _0x106d85[_0x7eb3('0x1d')](_0x7eb3('0x1e'),_0xdc60fa+'-'+_0x5dd95a+'/'+_0x460092)[_0x7eb3('0x18')](_0x588d5f);}return null;};}function patchUpdates(_0x4b2705){return function(_0x17a797){try{jsonpatch[_0x7eb3('0x1f')](_0x17a797,_0x4b2705,!![]);}catch(_0x435d86){return BPromise['reject'](_0x435d86);}return _0x17a797['save']();};}function saveUpdates(_0x391cca,_0x5458a3){return function(_0x3d964f){if(_0x3d964f){return _0x3d964f['update'](_0x391cca)[_0x7eb3('0x20')](function(_0x1d887f){return _0x1d887f;});}return null;};}function removeEntity(_0x4c1d35,_0x2a4285){return function(_0xda44aa){if(_0xda44aa){return _0xda44aa[_0x7eb3('0x21')]()[_0x7eb3('0x20')](function(){var _0x489153=_0xda44aa['get']({'plain':!![]});var _0x522151=_0x7eb3('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x522151,'resourceId':_0x489153['id']}})[_0x7eb3('0x20')](function(){return _0xda44aa;});})[_0x7eb3('0x20')](function(){_0x4c1d35[_0x7eb3('0x16')](0xcc)[_0x7eb3('0x17')]();});}};}function handleEntityNotFound(_0x35284f,_0x4906ad){return function(_0x413a52){if(!_0x413a52){_0x35284f['sendStatus'](0x194);}return _0x413a52;};}function handleError(_0x1b2b6a,_0x515312){_0x515312=_0x515312||0x1f4;return function(_0x537ec5){logger[_0x7eb3('0x23')](_0x537ec5[_0x7eb3('0x24')]);if(_0x537ec5['name']){delete _0x537ec5[_0x7eb3('0x25')];}_0x1b2b6a[_0x7eb3('0x16')](_0x515312)[_0x7eb3('0x26')](_0x537ec5);};}exports[_0x7eb3('0x27')]=function(_0x17bb2c,_0x4bccc2){var _0x4bbace={},_0x2fdd35={},_0x2a9e3a={'count':0x0,'rows':[]};var _0x53b535=_[_0x7eb3('0x28')](db[_0x7eb3('0x29')][_0x7eb3('0x2a')],function(_0x214f66){return{'name':_0x214f66[_0x7eb3('0x2b')],'type':_0x214f66[_0x7eb3('0x2c')]['key']};});_0x2fdd35[_0x7eb3('0x2d')]=_[_0x7eb3('0x28')](_0x53b535,_0x7eb3('0x25'));_0x2fdd35[_0x7eb3('0x2e')]=_['keys'](_0x17bb2c['query']);_0x2fdd35[_0x7eb3('0x2f')]=_[_0x7eb3('0x30')](_0x2fdd35[_0x7eb3('0x2d')],_0x2fdd35[_0x7eb3('0x2e')]);_0x4bbace['attributes']=_[_0x7eb3('0x30')](_0x2fdd35[_0x7eb3('0x2d')],qs['fields'](_0x17bb2c[_0x7eb3('0x2e')][_0x7eb3('0x31')]));_0x4bbace[_0x7eb3('0x32')]=_0x4bbace[_0x7eb3('0x32')]['length']?_0x4bbace[_0x7eb3('0x32')]:_0x2fdd35[_0x7eb3('0x2d')];if(!_0x17bb2c['query']['hasOwnProperty']('nolimit')){_0x4bbace['limit']=qs[_0x7eb3('0x1c')](_0x17bb2c['query']['limit']);_0x4bbace[_0x7eb3('0x19')]=qs[_0x7eb3('0x19')](_0x17bb2c[_0x7eb3('0x2e')]['offset']);}_0x4bbace[_0x7eb3('0x33')]=qs[_0x7eb3('0x34')](_0x17bb2c['query'][_0x7eb3('0x34')]);_0x4bbace['where']=qs['filters'](_[_0x7eb3('0x35')](_0x17bb2c[_0x7eb3('0x2e')],_0x2fdd35[_0x7eb3('0x2f')]),_0x53b535);if(_0x17bb2c[_0x7eb3('0x2e')][_0x7eb3('0x36')]){_0x4bbace[_0x7eb3('0x37')]=_[_0x7eb3('0x38')](_0x4bbace['where'],{'$or':_[_0x7eb3('0x28')](_0x53b535,function(_0x497fdf){if(_0x497fdf[_0x7eb3('0x2c')]!=='VIRTUAL'){var _0x1c8df2={};_0x1c8df2[_0x497fdf[_0x7eb3('0x25')]]={'$like':'%'+_0x17bb2c[_0x7eb3('0x2e')][_0x7eb3('0x36')]+'%'};return _0x1c8df2;}})});}_0x4bbace=_[_0x7eb3('0x38')]({},_0x4bbace,_0x17bb2c[_0x7eb3('0x39')]);var _0x5289bb={'where':_0x4bbace['where']};return db[_0x7eb3('0x29')][_0x7eb3('0x1b')](_0x5289bb)[_0x7eb3('0x20')](function(_0x68c239){_0x2a9e3a[_0x7eb3('0x1b')]=_0x68c239;if(_0x17bb2c[_0x7eb3('0x2e')][_0x7eb3('0x3a')]){_0x4bbace[_0x7eb3('0x3b')]=[{'all':!![]}];}return db[_0x7eb3('0x29')]['findAll'](_0x4bbace);})[_0x7eb3('0x20')](function(_0x4e87f6){_0x2a9e3a[_0x7eb3('0x3c')]=_0x4e87f6;return _0x2a9e3a;})['then'](respondWithFilteredResult(_0x4bccc2,_0x4bbace))[_0x7eb3('0x3d')](handleError(_0x4bccc2,null));};exports[_0x7eb3('0x3e')]=function(_0x204672,_0x4502c4){var _0x31c673={'raw':!![],'where':{'id':_0x204672[_0x7eb3('0x3f')]['id']}},_0x17b672={};_0x17b672[_0x7eb3('0x2d')]=_[_0x7eb3('0x40')](db[_0x7eb3('0x29')]['rawAttributes']);_0x17b672[_0x7eb3('0x2e')]=_[_0x7eb3('0x40')](_0x204672[_0x7eb3('0x2e')]);_0x17b672['filters']=_[_0x7eb3('0x30')](_0x17b672[_0x7eb3('0x2d')],_0x17b672[_0x7eb3('0x2e')]);_0x31c673[_0x7eb3('0x32')]=_[_0x7eb3('0x30')](_0x17b672[_0x7eb3('0x2d')],qs[_0x7eb3('0x31')](_0x204672['query'][_0x7eb3('0x31')]));_0x31c673[_0x7eb3('0x32')]=_0x31c673[_0x7eb3('0x32')][_0x7eb3('0x41')]?_0x31c673[_0x7eb3('0x32')]:_0x17b672['model'];if(_0x204672['query'][_0x7eb3('0x3a')]){_0x31c673['include']=[{'all':!![]}];}_0x31c673=_[_0x7eb3('0x38')]({},_0x31c673,_0x204672['options']);return db['Interval'][_0x7eb3('0x42')](_0x31c673)[_0x7eb3('0x20')](handleEntityNotFound(_0x4502c4,null))[_0x7eb3('0x20')](respondWithResult(_0x4502c4,null))['catch'](handleError(_0x4502c4,null));};exports[_0x7eb3('0x43')]=function(_0x5841bc,_0x3aefdd){return db[_0x7eb3('0x29')]['create'](_0x5841bc[_0x7eb3('0x44')],{})[_0x7eb3('0x20')](function(_0x3ae97e){var _0x426310=_0x5841bc[_0x7eb3('0x45')][_0x7eb3('0x46')]({'plain':!![]});if(!_0x426310)throw new Error(_0x7eb3('0x47'));if(_0x426310[_0x7eb3('0x48')]===_0x7eb3('0x45')){var _0x110be1=_0x3ae97e[_0x7eb3('0x46')]({'plain':!![]});var _0x56a0e9=_0x7eb3('0x22');return db[_0x7eb3('0x49')][_0x7eb3('0x42')]({'where':{'name':_0x56a0e9,'userProfileId':_0x426310[_0x7eb3('0x4a')]},'raw':!![]})[_0x7eb3('0x20')](function(_0x15dcaf){if(_0x15dcaf&&_0x15dcaf[_0x7eb3('0x4b')]===0x0){return db[_0x7eb3('0x4c')][_0x7eb3('0x43')]({'name':_0x110be1[_0x7eb3('0x25')],'resourceId':_0x110be1['id'],'type':_0x15dcaf[_0x7eb3('0x25')],'sectionId':_0x15dcaf['id']},{})[_0x7eb3('0x20')](function(){return _0x3ae97e;});}else{return _0x3ae97e;}})['catch'](function(_0x4c5a2c){logger[_0x7eb3('0x23')](_0x7eb3('0x4d'),_0x4c5a2c);throw _0x4c5a2c;});}return _0x3ae97e;})[_0x7eb3('0x20')](respondWithResult(_0x3aefdd,0xc9))[_0x7eb3('0x3d')](handleError(_0x3aefdd,null));};exports[_0x7eb3('0x4e')]=function(_0x66d2e5,_0x260a86){if(_0x66d2e5[_0x7eb3('0x44')]['id']){delete _0x66d2e5[_0x7eb3('0x44')]['id'];}return db[_0x7eb3('0x29')][_0x7eb3('0x42')]({'where':{'id':_0x66d2e5['params']['id']}})[_0x7eb3('0x20')](handleEntityNotFound(_0x260a86,null))[_0x7eb3('0x20')](saveUpdates(_0x66d2e5['body'],null))[_0x7eb3('0x20')](respondWithResult(_0x260a86,null))['catch'](handleError(_0x260a86,null));};exports[_0x7eb3('0x21')]=function(_0x117f3d,_0x11745b){return db['Interval']['find']({'where':{'id':_0x117f3d[_0x7eb3('0x3f')]['id']}})[_0x7eb3('0x20')](handleEntityNotFound(_0x11745b,null))[_0x7eb3('0x20')](removeEntity(_0x11745b,null))[_0x7eb3('0x3d')](handleError(_0x11745b,null));};exports[_0x7eb3('0x4f')]=function(_0xf6473d,_0x2fa035,_0x51e839){if(_0xf6473d[_0x7eb3('0x44')]['id']){delete _0xf6473d[_0x7eb3('0x44')]['id'];}return db[_0x7eb3('0x29')][_0x7eb3('0x42')]({'where':{'id':_0xf6473d[_0x7eb3('0x3f')]['id']}})[_0x7eb3('0x20')](handleEntityNotFound(_0x2fa035,null))[_0x7eb3('0x20')](function(_0x44d25a){if(_0x44d25a){_0xf6473d[_0x7eb3('0x44')][_0x7eb3('0x50')]=_0x44d25a['id'];return db[_0x7eb3('0x29')][_0x7eb3('0x43')](_0xf6473d[_0x7eb3('0x44')]);}})[_0x7eb3('0x20')](respondWithResult(_0x2fa035,null))[_0x7eb3('0x3d')](handleError(_0x2fa035,null));};exports[_0x7eb3('0x51')]=function(_0x54c870,_0x2d2b37,_0x2caf67){var _0x527c33={};var _0xc0e022={};var _0x1dcf86;var _0x28893d;return db['Interval']['findOne']({'where':{'id':_0x54c870[_0x7eb3('0x3f')]['id']}})[_0x7eb3('0x20')](handleEntityNotFound(_0x2d2b37,null))[_0x7eb3('0x20')](function(_0x4d894e){if(_0x4d894e){_0x1dcf86=_0x4d894e;_0xc0e022['model']=_[_0x7eb3('0x40')](db[_0x7eb3('0x29')][_0x7eb3('0x2a')]);_0xc0e022[_0x7eb3('0x2e')]=_[_0x7eb3('0x40')](_0x54c870[_0x7eb3('0x2e')]);_0xc0e022[_0x7eb3('0x2f')]=_[_0x7eb3('0x30')](_0xc0e022[_0x7eb3('0x2d')],_0xc0e022[_0x7eb3('0x2e')]);_0x527c33[_0x7eb3('0x32')]=_[_0x7eb3('0x30')](_0xc0e022[_0x7eb3('0x2d')],qs[_0x7eb3('0x31')](_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x31')]));_0x527c33[_0x7eb3('0x32')]=_0x527c33[_0x7eb3('0x32')]['length']?_0x527c33[_0x7eb3('0x32')]:_0xc0e022['model'];_0x527c33[_0x7eb3('0x33')]=qs[_0x7eb3('0x34')](_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x34')]);_0x527c33[_0x7eb3('0x37')]=qs[_0x7eb3('0x2f')](_[_0x7eb3('0x35')](_0x54c870[_0x7eb3('0x2e')],_0xc0e022[_0x7eb3('0x2f')]));if(_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x36')]){_0x527c33[_0x7eb3('0x37')]=_['merge'](_0x527c33[_0x7eb3('0x37')],{'$or':_['map'](_0x527c33['attributes'],function(_0x327962){var _0x2a0c49={};_0x2a0c49[_0x327962]={'$like':'%'+_0x54c870['query'][_0x7eb3('0x36')]+'%'};return _0x2a0c49;})});}_0x527c33=_[_0x7eb3('0x38')]({},_0x527c33,_0x54c870[_0x7eb3('0x39')]);return _0x1dcf86[_0x7eb3('0x51')](_0x527c33);}})[_0x7eb3('0x20')](function(_0x16579b){if(_0x16579b){_0x28893d=_0x16579b[_0x7eb3('0x41')];if(!_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x52')](_0x7eb3('0x53'))){_0x527c33[_0x7eb3('0x1c')]=qs[_0x7eb3('0x1c')](_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x1c')]);_0x527c33[_0x7eb3('0x19')]=qs[_0x7eb3('0x19')](_0x54c870[_0x7eb3('0x2e')][_0x7eb3('0x19')]);}return _0x1dcf86[_0x7eb3('0x51')](_0x527c33);}})[_0x7eb3('0x20')](function(_0x502174){if(_0x502174){return _0x502174?{'count':_0x28893d,'rows':_0x502174}:null;}})[_0x7eb3('0x20')](respondWithResult(_0x2d2b37,null))['catch'](handleError(_0x2d2b37,null));};exports['addIntervals']=function(_0xd16bb3,_0x488843,_0x406f06){return db[_0x7eb3('0x29')][_0x7eb3('0x54')]({'where':{'id':_0xd16bb3[_0x7eb3('0x3f')]['id']}})[_0x7eb3('0x20')](handleEntityNotFound(_0x488843,null))[_0x7eb3('0x20')](function(_0x49dd49){if(_0x49dd49){return db['sequelize']['transaction'](function(_0x33194f){return db['Interval'][_0x7eb3('0x21')]({'where':{'IntervalId':_0xd16bb3['params']['id']},'transaction':_0x33194f})[_0x7eb3('0x20')](function(_0x1101d3){var _0x1f53b3=_[_0x7eb3('0x28')](_0xd16bb3[_0x7eb3('0x44')],function(_0x4aaf20){delete _0x4aaf20['id'];_0x4aaf20[_0x7eb3('0x50')]=_0xd16bb3[_0x7eb3('0x3f')]['id'];return _0x4aaf20;});return db[_0x7eb3('0x29')][_0x7eb3('0x55')](_0x1f53b3,{'transaction':_0x33194f});});})[_0x7eb3('0x20')](function(){return db[_0x7eb3('0x29')]['findAll']({'where':{'IntervalId':_0xd16bb3[_0x7eb3('0x3f')]['id']}});});}})[_0x7eb3('0x20')](respondWithResult(_0x488843,null))[_0x7eb3('0x3d')](handleError(_0x488843,null));}; \ No newline at end of file +var _0x6c35=['include','Interval','findAll','show','params','length','find','catch','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Intervals','sendStatus','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options'];(function(_0x24131f,_0x1e82b1){var _0x383ab4=function(_0x69d62){while(--_0x69d62){_0x24131f['push'](_0x24131f['shift']());}};_0x383ab4(++_0x1e82b1);}(_0x6c35,0x1cb));var _0x56c3=function(_0x1a01f8,_0x125e38){_0x1a01f8=_0x1a01f8-0x0;var _0x7868d3=_0x6c35[_0x1a01f8];return _0x7868d3;};'use strict';var emlformat=require(_0x56c3('0x0'));var rimraf=require(_0x56c3('0x1'));var zipdir=require(_0x56c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x56c3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x56c3('0x4'));var util=require(_0x56c3('0x5'));var path=require(_0x56c3('0x6'));var sox=require(_0x56c3('0x7'));var csv=require(_0x56c3('0x8'));var ejs=require(_0x56c3('0x9'));var fs=require('fs');var fs_extra=require(_0x56c3('0xa'));var _=require(_0x56c3('0xb'));var squel=require(_0x56c3('0xc'));var crypto=require(_0x56c3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x56c3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56c3('0xf'));var Redis=require(_0x56c3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x56c3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56c3('0x12'));var logger=require(_0x56c3('0x13'))(_0x56c3('0x14'));var utils=require('../../config/utils');var config=require(_0x56c3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x56c3('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x312705,_0x156222){_0x156222=_0x156222||0xcc;return function(_0x5d1cd8){if(_0x5d1cd8){return _0x312705['sendStatus'](_0x156222);}return _0x312705[_0x56c3('0x17')](_0x156222)[_0x56c3('0x18')]();};}function respondWithResult(_0x475fec,_0x25319b){_0x25319b=_0x25319b||0xc8;return function(_0x40c71f){if(_0x40c71f){return _0x475fec[_0x56c3('0x17')](_0x25319b)[_0x56c3('0x19')](_0x40c71f);}};}function respondWithFilteredResult(_0x38e3b0,_0x11e53b){return function(_0x245a22){if(_0x245a22){var _0x3078b0=typeof _0x11e53b['offset']==='undefined'&&typeof _0x11e53b['limit']===_0x56c3('0x1a');var _0x1244c6=_0x245a22[_0x56c3('0x1b')];var _0xb683a9=_0x3078b0?0x0:_0x11e53b[_0x56c3('0x1c')];var _0x3b599d=_0x3078b0?_0x245a22[_0x56c3('0x1b')]:_0x11e53b[_0x56c3('0x1c')]+_0x11e53b[_0x56c3('0x1d')];var _0x21d442;if(_0x3b599d>=_0x1244c6){_0x3b599d=_0x1244c6;_0x21d442=0xc8;}else{_0x21d442=0xce;}_0x38e3b0[_0x56c3('0x17')](_0x21d442);return _0x38e3b0[_0x56c3('0x1e')](_0x56c3('0x1f'),_0xb683a9+'-'+_0x3b599d+'/'+_0x1244c6)[_0x56c3('0x19')](_0x245a22);}return null;};}function patchUpdates(_0x9a2742){return function(_0x1019e2){try{jsonpatch['apply'](_0x1019e2,_0x9a2742,!![]);}catch(_0x240fa6){return BPromise[_0x56c3('0x20')](_0x240fa6);}return _0x1019e2[_0x56c3('0x21')]();};}function saveUpdates(_0xb696b4,_0x1d81c8){return function(_0x80ad04){if(_0x80ad04){return _0x80ad04[_0x56c3('0x22')](_0xb696b4)[_0x56c3('0x23')](function(_0x402cdd){return _0x402cdd;});}return null;};}function removeEntity(_0x5ca4f7,_0x415727){return function(_0x1340a8){if(_0x1340a8){return _0x1340a8[_0x56c3('0x24')]()[_0x56c3('0x23')](function(){var _0x260c0f=_0x1340a8[_0x56c3('0x25')]({'plain':!![]});var _0x4f08c6=_0x56c3('0x26');return db['UserProfileResource'][_0x56c3('0x24')]({'where':{'type':_0x4f08c6,'resourceId':_0x260c0f['id']}})[_0x56c3('0x23')](function(){return _0x1340a8;});})[_0x56c3('0x23')](function(){_0x5ca4f7[_0x56c3('0x17')](0xcc)[_0x56c3('0x18')]();});}};}function handleEntityNotFound(_0x1aae25,_0x30b278){return function(_0x36496c){if(!_0x36496c){_0x1aae25[_0x56c3('0x27')](0x194);}return _0x36496c;};}function handleError(_0x3160c0,_0x407293){_0x407293=_0x407293||0x1f4;return function(_0x2e9429){logger['error'](_0x2e9429[_0x56c3('0x28')]);if(_0x2e9429[_0x56c3('0x29')]){delete _0x2e9429['name'];}_0x3160c0['status'](_0x407293)['send'](_0x2e9429);};}exports[_0x56c3('0x2a')]=function(_0x5b1d42,_0x334a5c){var _0x573e72={},_0x2dd9af={},_0x45c632={'count':0x0,'rows':[]};var _0x1364cd=_[_0x56c3('0x2b')](db['Interval'][_0x56c3('0x2c')],function(_0x1a86dd){return{'name':_0x1a86dd['fieldName'],'type':_0x1a86dd[_0x56c3('0x2d')][_0x56c3('0x2e')]};});_0x2dd9af[_0x56c3('0x2f')]=_['map'](_0x1364cd,_0x56c3('0x29'));_0x2dd9af[_0x56c3('0x30')]=_[_0x56c3('0x31')](_0x5b1d42[_0x56c3('0x30')]);_0x2dd9af['filters']=_[_0x56c3('0x32')](_0x2dd9af[_0x56c3('0x2f')],_0x2dd9af[_0x56c3('0x30')]);_0x573e72[_0x56c3('0x33')]=_[_0x56c3('0x32')](_0x2dd9af[_0x56c3('0x2f')],qs['fields'](_0x5b1d42[_0x56c3('0x30')][_0x56c3('0x34')]));_0x573e72[_0x56c3('0x33')]=_0x573e72[_0x56c3('0x33')]['length']?_0x573e72['attributes']:_0x2dd9af['model'];if(!_0x5b1d42[_0x56c3('0x30')][_0x56c3('0x35')](_0x56c3('0x36'))){_0x573e72['limit']=qs[_0x56c3('0x1d')](_0x5b1d42[_0x56c3('0x30')]['limit']);_0x573e72[_0x56c3('0x1c')]=qs['offset'](_0x5b1d42['query']['offset']);}_0x573e72[_0x56c3('0x37')]=qs[_0x56c3('0x38')](_0x5b1d42[_0x56c3('0x30')][_0x56c3('0x38')]);_0x573e72[_0x56c3('0x39')]=qs['filters'](_[_0x56c3('0x3a')](_0x5b1d42[_0x56c3('0x30')],_0x2dd9af[_0x56c3('0x3b')]),_0x1364cd);if(_0x5b1d42[_0x56c3('0x30')][_0x56c3('0x3c')]){_0x573e72['where']=_[_0x56c3('0x3d')](_0x573e72[_0x56c3('0x39')],{'$or':_[_0x56c3('0x2b')](_0x1364cd,function(_0xe29bdd){if(_0xe29bdd[_0x56c3('0x2d')]!=='VIRTUAL'){var _0x3acf42={};_0x3acf42[_0xe29bdd[_0x56c3('0x29')]]={'$like':'%'+_0x5b1d42[_0x56c3('0x30')][_0x56c3('0x3c')]+'%'};return _0x3acf42;}})});}_0x573e72=_[_0x56c3('0x3d')]({},_0x573e72,_0x5b1d42[_0x56c3('0x3e')]);var _0x581b45={'where':_0x573e72[_0x56c3('0x39')]};return db['Interval'][_0x56c3('0x1b')](_0x581b45)['then'](function(_0x4cab78){_0x45c632[_0x56c3('0x1b')]=_0x4cab78;if(_0x5b1d42[_0x56c3('0x30')]['includeAll']){_0x573e72[_0x56c3('0x3f')]=[{'all':!![]}];}return db[_0x56c3('0x40')][_0x56c3('0x41')](_0x573e72);})[_0x56c3('0x23')](function(_0x1ae0aa){_0x45c632['rows']=_0x1ae0aa;return _0x45c632;})[_0x56c3('0x23')](respondWithFilteredResult(_0x334a5c,_0x573e72))['catch'](handleError(_0x334a5c,null));};exports[_0x56c3('0x42')]=function(_0x12e83e,_0xa762fc){var _0x52abe6={'raw':!![],'where':{'id':_0x12e83e[_0x56c3('0x43')]['id']}},_0x453248={};_0x453248[_0x56c3('0x2f')]=_[_0x56c3('0x31')](db['Interval'][_0x56c3('0x2c')]);_0x453248[_0x56c3('0x30')]=_[_0x56c3('0x31')](_0x12e83e[_0x56c3('0x30')]);_0x453248[_0x56c3('0x3b')]=_[_0x56c3('0x32')](_0x453248[_0x56c3('0x2f')],_0x453248['query']);_0x52abe6[_0x56c3('0x33')]=_['intersection'](_0x453248[_0x56c3('0x2f')],qs[_0x56c3('0x34')](_0x12e83e['query'][_0x56c3('0x34')]));_0x52abe6[_0x56c3('0x33')]=_0x52abe6['attributes'][_0x56c3('0x44')]?_0x52abe6[_0x56c3('0x33')]:_0x453248[_0x56c3('0x2f')];if(_0x12e83e['query']['includeAll']){_0x52abe6[_0x56c3('0x3f')]=[{'all':!![]}];}_0x52abe6=_[_0x56c3('0x3d')]({},_0x52abe6,_0x12e83e[_0x56c3('0x3e')]);return db[_0x56c3('0x40')][_0x56c3('0x45')](_0x52abe6)[_0x56c3('0x23')](handleEntityNotFound(_0xa762fc,null))[_0x56c3('0x23')](respondWithResult(_0xa762fc,null))[_0x56c3('0x46')](handleError(_0xa762fc,null));};exports[_0x56c3('0x47')]=function(_0x2be07b,_0x26aa29){return db[_0x56c3('0x40')][_0x56c3('0x47')](_0x2be07b[_0x56c3('0x48')],{})[_0x56c3('0x23')](function(_0x23c6b6){var _0x25932d=_0x2be07b['user']['get']({'plain':!![]});if(!_0x25932d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25932d[_0x56c3('0x49')]===_0x56c3('0x4a')){var _0x26760a=_0x23c6b6[_0x56c3('0x25')]({'plain':!![]});var _0x4cd612=_0x56c3('0x26');return db[_0x56c3('0x4b')]['find']({'where':{'name':_0x4cd612,'userProfileId':_0x25932d[_0x56c3('0x4c')]},'raw':!![]})['then'](function(_0x328eec){if(_0x328eec&&_0x328eec['autoAssociation']===0x0){return db[_0x56c3('0x4d')]['create']({'name':_0x26760a[_0x56c3('0x29')],'resourceId':_0x26760a['id'],'type':_0x328eec[_0x56c3('0x29')],'sectionId':_0x328eec['id']},{})[_0x56c3('0x23')](function(){return _0x23c6b6;});}else{return _0x23c6b6;}})[_0x56c3('0x46')](function(_0x411c57){logger[_0x56c3('0x4e')](_0x56c3('0x4f'),_0x411c57);throw _0x411c57;});}return _0x23c6b6;})[_0x56c3('0x23')](respondWithResult(_0x26aa29,0xc9))[_0x56c3('0x46')](handleError(_0x26aa29,null));};exports[_0x56c3('0x22')]=function(_0x3fd30b,_0x4fcd3b){if(_0x3fd30b[_0x56c3('0x48')]['id']){delete _0x3fd30b[_0x56c3('0x48')]['id'];}return db['Interval'][_0x56c3('0x45')]({'where':{'id':_0x3fd30b[_0x56c3('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fcd3b,null))[_0x56c3('0x23')](saveUpdates(_0x3fd30b[_0x56c3('0x48')],null))[_0x56c3('0x23')](respondWithResult(_0x4fcd3b,null))[_0x56c3('0x46')](handleError(_0x4fcd3b,null));};exports[_0x56c3('0x24')]=function(_0x16d537,_0x1e3b65){return db[_0x56c3('0x40')][_0x56c3('0x45')]({'where':{'id':_0x16d537[_0x56c3('0x43')]['id']}})[_0x56c3('0x23')](handleEntityNotFound(_0x1e3b65,null))['then'](removeEntity(_0x1e3b65,null))['catch'](handleError(_0x1e3b65,null));};exports[_0x56c3('0x50')]=function(_0x2a74c6,_0x16946c,_0x3651e2){if(_0x2a74c6[_0x56c3('0x48')]['id']){delete _0x2a74c6[_0x56c3('0x48')]['id'];}return db[_0x56c3('0x40')][_0x56c3('0x45')]({'where':{'id':_0x2a74c6[_0x56c3('0x43')]['id']}})[_0x56c3('0x23')](handleEntityNotFound(_0x16946c,null))[_0x56c3('0x23')](function(_0x3ebc96){if(_0x3ebc96){_0x2a74c6[_0x56c3('0x48')][_0x56c3('0x51')]=_0x3ebc96['id'];return db[_0x56c3('0x40')][_0x56c3('0x47')](_0x2a74c6[_0x56c3('0x48')]);}})['then'](respondWithResult(_0x16946c,null))[_0x56c3('0x46')](handleError(_0x16946c,null));};exports[_0x56c3('0x52')]=function(_0x1f9236,_0x4f2204,_0x36368f){var _0x19d4ad={};var _0x4310ec={};var _0x508d0f;var _0x168820;return db[_0x56c3('0x40')][_0x56c3('0x53')]({'where':{'id':_0x1f9236[_0x56c3('0x43')]['id']}})[_0x56c3('0x23')](handleEntityNotFound(_0x4f2204,null))['then'](function(_0x535a37){if(_0x535a37){_0x508d0f=_0x535a37;_0x4310ec[_0x56c3('0x2f')]=_[_0x56c3('0x31')](db[_0x56c3('0x40')][_0x56c3('0x2c')]);_0x4310ec['query']=_[_0x56c3('0x31')](_0x1f9236[_0x56c3('0x30')]);_0x4310ec[_0x56c3('0x3b')]=_[_0x56c3('0x32')](_0x4310ec['model'],_0x4310ec[_0x56c3('0x30')]);_0x19d4ad['attributes']=_['intersection'](_0x4310ec['model'],qs[_0x56c3('0x34')](_0x1f9236[_0x56c3('0x30')][_0x56c3('0x34')]));_0x19d4ad['attributes']=_0x19d4ad['attributes'][_0x56c3('0x44')]?_0x19d4ad['attributes']:_0x4310ec[_0x56c3('0x2f')];_0x19d4ad[_0x56c3('0x37')]=qs[_0x56c3('0x38')](_0x1f9236[_0x56c3('0x30')][_0x56c3('0x38')]);_0x19d4ad[_0x56c3('0x39')]=qs['filters'](_[_0x56c3('0x3a')](_0x1f9236[_0x56c3('0x30')],_0x4310ec['filters']));if(_0x1f9236[_0x56c3('0x30')]['filter']){_0x19d4ad[_0x56c3('0x39')]=_[_0x56c3('0x3d')](_0x19d4ad['where'],{'$or':_[_0x56c3('0x2b')](_0x19d4ad[_0x56c3('0x33')],function(_0x4c187c){var _0x57f5e2={};_0x57f5e2[_0x4c187c]={'$like':'%'+_0x1f9236[_0x56c3('0x30')][_0x56c3('0x3c')]+'%'};return _0x57f5e2;})});}_0x19d4ad=_['merge']({},_0x19d4ad,_0x1f9236['options']);return _0x508d0f[_0x56c3('0x52')](_0x19d4ad);}})[_0x56c3('0x23')](function(_0x1970c2){if(_0x1970c2){_0x168820=_0x1970c2['length'];if(!_0x1f9236['query']['hasOwnProperty']('nolimit')){_0x19d4ad[_0x56c3('0x1d')]=qs[_0x56c3('0x1d')](_0x1f9236[_0x56c3('0x30')][_0x56c3('0x1d')]);_0x19d4ad[_0x56c3('0x1c')]=qs[_0x56c3('0x1c')](_0x1f9236[_0x56c3('0x30')][_0x56c3('0x1c')]);}return _0x508d0f[_0x56c3('0x52')](_0x19d4ad);}})[_0x56c3('0x23')](function(_0x309f91){if(_0x309f91){return _0x309f91?{'count':_0x168820,'rows':_0x309f91}:null;}})['then'](respondWithResult(_0x4f2204,null))[_0x56c3('0x46')](handleError(_0x4f2204,null));};exports[_0x56c3('0x54')]=function(_0x321508,_0x545045,_0x3caa2d){return db[_0x56c3('0x40')][_0x56c3('0x53')]({'where':{'id':_0x321508[_0x56c3('0x43')]['id']}})['then'](handleEntityNotFound(_0x545045,null))[_0x56c3('0x23')](function(_0x19bda8){if(_0x19bda8){return db[_0x56c3('0x55')]['transaction'](function(_0x56baff){return db[_0x56c3('0x40')][_0x56c3('0x24')]({'where':{'IntervalId':_0x321508[_0x56c3('0x43')]['id']},'transaction':_0x56baff})[_0x56c3('0x23')](function(_0x2c385a){var _0x16336b=_[_0x56c3('0x2b')](_0x321508['body'],function(_0x2f9671){delete _0x2f9671['id'];_0x2f9671[_0x56c3('0x51')]=_0x321508[_0x56c3('0x43')]['id'];return _0x2f9671;});return db[_0x56c3('0x40')][_0x56c3('0x56')](_0x16336b,{'transaction':_0x56baff});});})['then'](function(){return db[_0x56c3('0x40')]['findAll']({'where':{'IntervalId':_0x321508['params']['id']}});});}})[_0x56c3('0x23')](respondWithResult(_0x545045,null))[_0x56c3('0x46')](handleError(_0x545045,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0d352e7..ac90a23 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 _0xaa28=['reduce','../../utils/iftime','define','rewrite','interval','string','getIntervals','all','map','ifTime','then'];(function(_0x583f54,_0x48f3d7){var _0x408356=function(_0x571936){while(--_0x571936){_0x583f54['push'](_0x583f54['shift']());}};_0x408356(++_0x48f3d7);}(_0xaa28,0xc7));var _0x8aa2=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0xaa28[_0x15942a];return _0x36a9fb;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x8aa2('0x0'))['iftime'];module['exports']=function(_0x8c2520){return _0x8c2520[_0x8aa2('0x1')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x54a2f9){extensions[_0x8aa2('0x2')](_0x8c2520,_0x54a2f9);},'afterBulkCreate':function(_0x5033f5,_0x331cfb,_0x10baf1){_0x10baf1();extensions['rewrite'](_0x8c2520,_0x5033f5[0x0]);},'afterUpdate':function(_0x30f2d7){extensions[_0x8aa2('0x2')](_0x8c2520,_0x30f2d7);},'afterDestroy':function(_0x56595d){extensions[_0x8aa2('0x2')](_0x8c2520,_0x56595d);}},'instanceMethods':{'ifTime':function(_0x49b571=undefined,_0x485e2f=new Date()){if(typeof this[_0x8aa2('0x3')]===_0x8aa2('0x4')){return iftime(this['interval'],_0x49b571,_0x485e2f);}else{return this[_0x8aa2('0x5')]()['then'](function(_0x5c7ff3){return Promise[_0x8aa2('0x6')](_0x5c7ff3[_0x8aa2('0x7')](function(_0x2ac184){return _0x2ac184[_0x8aa2('0x8')](_0x49b571,_0x485e2f);}));})[_0x8aa2('0x9')](function(_0x1b87e1){return _0x1b87e1[_0x8aa2('0xa')](function(_0x20ed47,_0x3729e7){return _0x20ed47||_0x3729e7;},![]);});}}}});}; \ No newline at end of file +var _0x5669=['../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','interval','getIntervals','then','all','map','./interval.attributes','../../components/extensions/rewrite'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x5669,0x191));var _0x9566=function(_0x7978a5,_0x5a4e10){_0x7978a5=_0x7978a5-0x0;var _0x5a7ad3=_0x5669[_0x7978a5];return _0x5a7ad3;};'use strict';var attributes=require(_0x9566('0x0'));var extensions=require(_0x9566('0x1'));var iftime=require(_0x9566('0x2'))[_0x9566('0x3')];module[_0x9566('0x4')]=function(_0x4d0462){return _0x4d0462[_0x9566('0x5')]('Interval',attributes,{'tableName':_0x9566('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f9018){extensions[_0x9566('0x7')](_0x4d0462,_0x4f9018);},'afterBulkCreate':function(_0x56e547,_0x361e89,_0x20a338){_0x20a338();extensions[_0x9566('0x7')](_0x4d0462,_0x56e547[0x0]);},'afterUpdate':function(_0x3a126f){extensions['rewrite'](_0x4d0462,_0x3a126f);},'afterDestroy':function(_0xcaaf92){extensions[_0x9566('0x7')](_0x4d0462,_0xcaaf92);}},'instanceMethods':{'ifTime':function(_0x3ecf21=undefined,_0x449941=new Date()){if(typeof this[_0x9566('0x8')]==='string'){return iftime(this[_0x9566('0x8')],_0x3ecf21,_0x449941);}else{return this[_0x9566('0x9')]()[_0x9566('0xa')](function(_0x41d5bf){return Promise[_0x9566('0xb')](_0x41d5bf[_0x9566('0xc')](function(_0x5c86bf){return _0x5c86bf['ifTime'](_0x3ecf21,_0x449941);}));})[_0x9566('0xa')](function(_0x203a57){return _0x203a57['reduce'](function(_0x548083,_0x23e522){return _0x548083||_0x23e522;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 69c15e1..06efaf7 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 _0xb6f7=['../../config/logger','GetInterval','options','raw','limit','include','model','attributes','map','then','info','debug','stringify','catch','error','message','Interval','where','ShowInterval','all','reduce','format','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','Iftime','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xb6f7,0x143));var _0x7b6f=function(_0x4bf772,_0x420f76){_0x4bf772=_0x4bf772-0x0;var _0x8cd87b=_0xb6f7[_0x4bf772];return _0x8cd87b;};'use strict';var _=require(_0x7b6f('0x0'));var util=require(_0x7b6f('0x1'));var db=require(_0x7b6f('0x2'))['db'];var iftime=require(_0x7b6f('0x3'))[_0x7b6f('0x4')];var logger=require(_0x7b6f('0x5'))('rpc');exports[_0x7b6f('0x6')]=function(_0x3be43d){var _0xdf4d35=this;return new Promise(function(_0xb7a0c8,_0x36efc1){return db['Interval']['findAll']({'raw':_0x3be43d['options']?_0x3be43d[_0x7b6f('0x7')][_0x7b6f('0x8')]===undefined?!![]:![]:!![],'where':_0x3be43d[_0x7b6f('0x7')]?_0x3be43d[_0x7b6f('0x7')]['where']||null:null,'attributes':_0x3be43d[_0x7b6f('0x7')]?_0x3be43d[_0x7b6f('0x7')]['attributes']||null:null,'limit':_0x3be43d[_0x7b6f('0x7')]?_0x3be43d[_0x7b6f('0x7')][_0x7b6f('0x9')]||null:null,'include':_0x3be43d[_0x7b6f('0x7')]?_0x3be43d[_0x7b6f('0x7')][_0x7b6f('0xa')]?_['map'](_0x3be43d[_0x7b6f('0x7')][_0x7b6f('0xa')],function(_0x1826bf){return{'model':db[_0x1826bf[_0x7b6f('0xb')]],'as':_0x1826bf['as'],'attributes':_0x1826bf[_0x7b6f('0xc')],'include':_0x1826bf[_0x7b6f('0xa')]?_[_0x7b6f('0xd')](_0x1826bf['include'],function(_0x5f876){return{'model':db[_0x5f876[_0x7b6f('0xb')]],'as':_0x5f876['as'],'attributes':_0x5f876[_0x7b6f('0xc')],'include':_0x5f876[_0x7b6f('0xa')]?_[_0x7b6f('0xd')](_0x5f876[_0x7b6f('0xa')],function(_0x4a159e){return{'model':db[_0x4a159e[_0x7b6f('0xb')]],'as':_0x4a159e['as'],'attributes':_0x4a159e[_0x7b6f('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7b6f('0xe')](function(_0x3f0d2a){logger[_0x7b6f('0xf')](_0x7b6f('0x6'),_0x3be43d);logger[_0x7b6f('0x10')]('GetInterval',_0x3be43d,JSON[_0x7b6f('0x11')](_0x3f0d2a));_0xb7a0c8(_0x3f0d2a);})[_0x7b6f('0x12')](function(_0x413745){logger[_0x7b6f('0x13')](_0x7b6f('0x6'),_0x413745[_0x7b6f('0x14')],_0x3be43d);_0x36efc1(_0xdf4d35['error'](0x1f4,_0x413745[_0x7b6f('0x14')]));});});};exports['ShowInterval']=function(_0x5eeeab){var _0x5c17ce=this;return new Promise(function(_0x379044,_0x28d40f){return db[_0x7b6f('0x15')]['find']({'raw':_0x5eeeab[_0x7b6f('0x7')]?_0x5eeeab[_0x7b6f('0x7')][_0x7b6f('0x8')]===undefined?!![]:![]:!![],'where':_0x5eeeab[_0x7b6f('0x7')]?_0x5eeeab[_0x7b6f('0x7')][_0x7b6f('0x16')]||null:null,'attributes':_0x5eeeab['options']?_0x5eeeab['options'][_0x7b6f('0xc')]||null:null,'include':_0x5eeeab[_0x7b6f('0x7')]?_0x5eeeab['options'][_0x7b6f('0xa')]?_[_0x7b6f('0xd')](_0x5eeeab[_0x7b6f('0x7')][_0x7b6f('0xa')],function(_0x3a7a30){return{'model':db[_0x3a7a30[_0x7b6f('0xb')]],'as':_0x3a7a30['as'],'attributes':_0x3a7a30[_0x7b6f('0xc')],'include':_0x3a7a30['include']?_['map'](_0x3a7a30['include'],function(_0x4514da){return{'model':db[_0x4514da[_0x7b6f('0xb')]],'as':_0x4514da['as'],'attributes':_0x4514da[_0x7b6f('0xc')],'include':_0x4514da[_0x7b6f('0xa')]?_[_0x7b6f('0xd')](_0x4514da[_0x7b6f('0xa')],function(_0x14d008){return{'model':db[_0x14d008[_0x7b6f('0xb')]],'as':_0x14d008['as'],'attributes':_0x14d008[_0x7b6f('0xc')]};}):[]};}):[]};}):[]:[]})[_0x7b6f('0xe')](function(_0x5bdb1f){logger[_0x7b6f('0xf')](_0x7b6f('0x17'),_0x5eeeab);logger['debug'](_0x7b6f('0x17'),_0x5eeeab,JSON[_0x7b6f('0x11')](_0x5bdb1f));_0x379044(_0x5bdb1f);})[_0x7b6f('0x12')](function(_0x2203d0){logger[_0x7b6f('0x13')](_0x7b6f('0x17'),_0x2203d0[_0x7b6f('0x14')],_0x5eeeab);_0x28d40f(_0x5c17ce[_0x7b6f('0x13')](0x1f4,_0x2203d0['message']));});});};function checkArrayOfIntervals(_0x1c5afe,_0x4f065a){var _0xd36398=[];return db['Interval']['findAll']({'where':{'id':_0x1c5afe}})[_0x7b6f('0xe')](function(_0x50b172){_0xd36398=_0x50b172;return Promise[_0x7b6f('0x18')](_0xd36398[_0x7b6f('0xd')](function(_0x318064){return _0x318064['ifTime'](_0x4f065a);}));})[_0x7b6f('0xe')](function(_0x117fd3){var _0x3de5bb=_0x117fd3[_0x7b6f('0x19')](function(_0x321087,_0x37d7c7){return _0x321087||_0x37d7c7;},![]);logger[_0x7b6f('0xf')](util[_0x7b6f('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0xd36398[_0x7b6f('0xd')](function(_0x2563b7){return _0x2563b7['name'];})[_0x7b6f('0x1b')](',\x20'),_0xd36398['map'](function(_0x3a8b91){return _0x3a8b91['id'];})[_0x7b6f('0x1b')](',\x20')));return _0x3de5bb;});}function checkSingleInterval(_0x159db3,_0x1c9caa){return db[_0x7b6f('0x15')][_0x7b6f('0x1c')](_0x159db3)[_0x7b6f('0xe')](function(_0x548272){if(_0x548272){logger[_0x7b6f('0xf')](util[_0x7b6f('0x1a')](_0x7b6f('0x1d'),_0x548272[_0x7b6f('0x1e')],_0x548272['id']));return _0x548272['ifTime'](_0x1c9caa);}});}exports[_0x7b6f('0x1f')]=function(_0x1a1966){var _0x53e38b=_0x1a1966[_0x7b6f('0x20')];var _0x36460c=Array[_0x7b6f('0x21')](_0x1a1966[_0x7b6f('0x22')])?_0x1a1966['intervals']:typeof _0x1a1966[_0x7b6f('0x22')]===_0x7b6f('0x23')?[_0x1a1966[_0x7b6f('0x22')]]:[];var _0x429623=_0x1a1966[_0x7b6f('0x24')]||undefined;var _0x59fd67=![];if(_0x36460c[_0x7b6f('0x25')]){logger[_0x7b6f('0xf')](util['format']('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x36460c['join'](';\x20')));}if(_0x429623){logger[_0x7b6f('0xf')](util[_0x7b6f('0x1a')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x429623));}logger[_0x7b6f('0x10')](_0x7b6f('0x26'),_0x59fd67);logger[_0x7b6f('0x27')](_0x7b6f('0x1f'),_0x1a1966);return Promise[_0x7b6f('0x28')]()[_0x7b6f('0xe')](function(){if(Array[_0x7b6f('0x21')](_0x53e38b)){return checkArrayOfIntervals(_0x53e38b,_0x429623);}else if(_0x53e38b){return checkSingleInterval(_0x53e38b,_0x429623);}})[_0x7b6f('0xe')](function(_0x1a73a6){var _0x33050d=_0x36460c[_0x7b6f('0x19')](function(_0x46b01f,_0x49e78a){return _0x46b01f||iftime(_0x49e78a,_0x429623);},![]);_0x59fd67=_0x1a73a6||_0x33050d;return _0x59fd67;})['catch'](function(_0x6ddbb1){logger[_0x7b6f('0x13')]('IntervalIftime',_0x1a1966,_0x6ddbb1);throw this['error'](0x1f4,_0x6ddbb1['message']);});}; \ No newline at end of file +var _0x02b7=['debug','stringify','catch','error','message','ShowInterval','Interval','findAll','then','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','options','raw','where','attributes','limit','include','map','model','info'];(function(_0x281fd7,_0x5aba9a){var _0x4a6ca9=function(_0x361f07){while(--_0x361f07){_0x281fd7['push'](_0x281fd7['shift']());}};_0x4a6ca9(++_0x5aba9a);}(_0x02b7,0x1e9));var _0x702b=function(_0x524e1b,_0x39e1dc){_0x524e1b=_0x524e1b-0x0;var _0x274648=_0x02b7[_0x524e1b];return _0x274648;};'use strict';var _=require(_0x702b('0x0'));var util=require(_0x702b('0x1'));var db=require(_0x702b('0x2'))['db'];var iftime=require(_0x702b('0x3'))[_0x702b('0x4')];var logger=require(_0x702b('0x5'))(_0x702b('0x6'));exports[_0x702b('0x7')]=function(_0xb63917){var _0x21d93b=this;return new Promise(function(_0x110a01,_0xc217ee){return db['Interval']['findAll']({'raw':_0xb63917[_0x702b('0x8')]?_0xb63917['options'][_0x702b('0x9')]===undefined?!![]:![]:!![],'where':_0xb63917[_0x702b('0x8')]?_0xb63917[_0x702b('0x8')][_0x702b('0xa')]||null:null,'attributes':_0xb63917[_0x702b('0x8')]?_0xb63917[_0x702b('0x8')][_0x702b('0xb')]||null:null,'limit':_0xb63917[_0x702b('0x8')]?_0xb63917[_0x702b('0x8')][_0x702b('0xc')]||null:null,'include':_0xb63917[_0x702b('0x8')]?_0xb63917[_0x702b('0x8')][_0x702b('0xd')]?_['map'](_0xb63917['options'][_0x702b('0xd')],function(_0x49a4fa){return{'model':db[_0x49a4fa['model']],'as':_0x49a4fa['as'],'attributes':_0x49a4fa[_0x702b('0xb')],'include':_0x49a4fa[_0x702b('0xd')]?_['map'](_0x49a4fa[_0x702b('0xd')],function(_0x431975){return{'model':db[_0x431975['model']],'as':_0x431975['as'],'attributes':_0x431975[_0x702b('0xb')],'include':_0x431975['include']?_[_0x702b('0xe')](_0x431975['include'],function(_0x3f11d6){return{'model':db[_0x3f11d6[_0x702b('0xf')]],'as':_0x3f11d6['as'],'attributes':_0x3f11d6[_0x702b('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44e377){logger[_0x702b('0x10')]('GetInterval',_0xb63917);logger[_0x702b('0x11')](_0x702b('0x7'),_0xb63917,JSON[_0x702b('0x12')](_0x44e377));_0x110a01(_0x44e377);})[_0x702b('0x13')](function(_0x59b82){logger[_0x702b('0x14')](_0x702b('0x7'),_0x59b82[_0x702b('0x15')],_0xb63917);_0xc217ee(_0x21d93b[_0x702b('0x14')](0x1f4,_0x59b82['message']));});});};exports[_0x702b('0x16')]=function(_0xd02670){var _0x1ceb6d=this;return new Promise(function(_0x1223cb,_0xdd91f6){return db['Interval']['find']({'raw':_0xd02670[_0x702b('0x8')]?_0xd02670[_0x702b('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0xd02670[_0x702b('0x8')]?_0xd02670[_0x702b('0x8')]['where']||null:null,'attributes':_0xd02670[_0x702b('0x8')]?_0xd02670[_0x702b('0x8')][_0x702b('0xb')]||null:null,'include':_0xd02670[_0x702b('0x8')]?_0xd02670[_0x702b('0x8')][_0x702b('0xd')]?_[_0x702b('0xe')](_0xd02670[_0x702b('0x8')][_0x702b('0xd')],function(_0x5e8992){return{'model':db[_0x5e8992['model']],'as':_0x5e8992['as'],'attributes':_0x5e8992['attributes'],'include':_0x5e8992['include']?_[_0x702b('0xe')](_0x5e8992['include'],function(_0x27d9c4){return{'model':db[_0x27d9c4[_0x702b('0xf')]],'as':_0x27d9c4['as'],'attributes':_0x27d9c4[_0x702b('0xb')],'include':_0x27d9c4['include']?_[_0x702b('0xe')](_0x27d9c4[_0x702b('0xd')],function(_0x39c9e3){return{'model':db[_0x39c9e3[_0x702b('0xf')]],'as':_0x39c9e3['as'],'attributes':_0x39c9e3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x30b520){logger[_0x702b('0x10')]('ShowInterval',_0xd02670);logger['debug'](_0x702b('0x16'),_0xd02670,JSON[_0x702b('0x12')](_0x30b520));_0x1223cb(_0x30b520);})['catch'](function(_0x299f79){logger['error'](_0x702b('0x16'),_0x299f79['message'],_0xd02670);_0xdd91f6(_0x1ceb6d[_0x702b('0x14')](0x1f4,_0x299f79['message']));});});};function checkArrayOfIntervals(_0x398ded,_0x55e36c){var _0x204501=[];return db[_0x702b('0x17')][_0x702b('0x18')]({'where':{'id':_0x398ded}})[_0x702b('0x19')](function(_0x3c236c){_0x204501=_0x3c236c;return Promise[_0x702b('0x1a')](_0x204501['map'](function(_0x262646){return _0x262646[_0x702b('0x1b')](_0x55e36c);}));})[_0x702b('0x19')](function(_0x23b3c3){var _0x181a79=_0x23b3c3[_0x702b('0x1c')](function(_0xedbc9,_0x590daf){return _0xedbc9||_0x590daf;},![]);logger[_0x702b('0x10')](util[_0x702b('0x1d')](_0x702b('0x1e'),_0x204501['map'](function(_0x234499){return _0x234499[_0x702b('0x1f')];})[_0x702b('0x20')](',\x20'),_0x204501[_0x702b('0xe')](function(_0x204761){return _0x204761['id'];})['join'](',\x20')));return _0x181a79;});}function checkSingleInterval(_0x426f59,_0x117140){return db[_0x702b('0x17')][_0x702b('0x21')](_0x426f59)['then'](function(_0x5e49d0){if(_0x5e49d0){logger[_0x702b('0x10')](util[_0x702b('0x1d')](_0x702b('0x22'),_0x5e49d0[_0x702b('0x1f')],_0x5e49d0['id']));return _0x5e49d0[_0x702b('0x1b')](_0x117140);}});}exports[_0x702b('0x23')]=function(_0x5d4bd2){var _0x560fbe=_0x5d4bd2[_0x702b('0x24')];var _0x2c2934=Array[_0x702b('0x25')](_0x5d4bd2[_0x702b('0x26')])?_0x5d4bd2['intervals']:typeof _0x5d4bd2[_0x702b('0x26')]==='string'?[_0x5d4bd2[_0x702b('0x26')]]:[];var _0xd6f4a3=_0x5d4bd2[_0x702b('0x27')]||undefined;var _0x40e950=![];if(_0x2c2934[_0x702b('0x28')]){logger['info'](util[_0x702b('0x1d')](_0x702b('0x29'),_0x2c2934[_0x702b('0x20')](';\x20')));}if(_0xd6f4a3){logger['info'](util['format'](_0x702b('0x2a'),_0xd6f4a3));}logger[_0x702b('0x11')](_0x702b('0x2b'),_0x40e950);logger[_0x702b('0x2c')](_0x702b('0x23'),_0x5d4bd2);return Promise[_0x702b('0x2d')]()[_0x702b('0x19')](function(){if(Array['isArray'](_0x560fbe)){return checkArrayOfIntervals(_0x560fbe,_0xd6f4a3);}else if(_0x560fbe){return checkSingleInterval(_0x560fbe,_0xd6f4a3);}})['then'](function(_0x58db65){var _0x5598e6=_0x2c2934[_0x702b('0x1c')](function(_0x421240,_0x3a4589){return _0x421240||iftime(_0x3a4589,_0xd6f4a3);},![]);_0x40e950=_0x58db65||_0x5598e6;return _0x40e950;})['catch'](function(_0x21cffc){logger[_0x702b('0x14')](_0x702b('0x23'),_0x5d4bd2,_0x21cffc);throw this[_0x702b('0x14')](0x1f4,_0x21cffc['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 948704b..b58aa51 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(_0x5b3212,_0x550406){var _0x58e775=function(_0x54193c){while(--_0x54193c){_0x5b3212['push'](_0x5b3212['shift']());}};_0x58e775(++_0x550406);}(_0xdb28,0x106));var _0x8db2=function(_0xab2553,_0x2a772a){_0xab2553=_0xab2553-0x0;var _0x535e43=_0xdb28[_0xab2553];return _0x535e43;};'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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x4224f4,_0x210a9c){var _0x362e4b=function(_0x4a5b86){while(--_0x4a5b86){_0x4224f4['push'](_0x4224f4['shift']());}};_0x362e4b(++_0x210a9c);}(_0xadb5,0xad));var _0x5adb=function(_0x58a714,_0x5cb1d1){_0x58a714=_0x58a714-0x0;var _0x1f4938=_0xadb5[_0x58a714];return _0x1f4938;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 7af4292..6dd6f73 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 _0x105b=['status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','oldToken','customfield_11502','name','customfield_11504','customfield_10102','/rest/api/2/issue','Basic\x20','toString','setEncoding','utf8','data','end'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0x105b,0xb6));var _0xb105=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x105b[_0x110c3d];return _0x226d67;};'use strict';var BPromise=require(_0xb105('0x0'));var https=require(_0xb105('0x1'));var logger=require(_0xb105('0x2'))(_0xb105('0x3'));var USERNAME='support';var PASSWORD=_0xb105('0x4');function openIssue(_0x4741d8,_0x188117){var _0x2340b4={'fields':{'project':{'key':_0x4741d8[_0xb105('0x5')]||_0xb105('0x6')},'summary':(_0x4741d8[_0xb105('0x7')]||_0xb105('0x8'))+'\x20from\x20'+_0x4741d8['ip'],'description':_0x4741d8[_0xb105('0x9')]||JSON[_0xb105('0xa')](_0x4741d8),'issuetype':{'name':_0x4741d8[_0xb105('0xb')]||_0xb105('0xc')}}};_0x2340b4[_0xb105('0xd')][_0xb105('0xe')]=_0x4741d8[_0xb105('0xf')];_0x2340b4[_0xb105('0xd')]['customfield_11501']=_0x4741d8[_0xb105('0x10')];_0x2340b4[_0xb105('0xd')][_0xb105('0x11')]=_0x4741d8['newToken'];_0x2340b4[_0xb105('0xd')]['customfield_11503']=_0x4741d8[_0xb105('0x12')];_0x2340b4['fields'][_0xb105('0x13')]=_0x4741d8['reason'];_0x2340b4['fields'][_0xb105('0x14')]=_0x4741d8['ip'];var _0x131559={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xb105('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xb105('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xb105('0x17')]('base64')}};var _0x3bfd5b=JSON[_0xb105('0xa')](_0x2340b4);var _0x2525b7=https['request'](_0x131559,function(_0x421729){_0x421729[_0xb105('0x18')](_0xb105('0x19'));var _0x1032ed='';_0x421729['on'](_0xb105('0x1a'),function(_0x2cc9b9){_0x1032ed+=_0x2cc9b9;});_0x421729['on'](_0xb105('0x1b'),function(){if(_0x188117){return _0x188117[_0xb105('0x1c')](_0x421729[_0xb105('0x1d')])[_0xb105('0x1e')](JSON[_0xb105('0x1f')](_0x1032ed));}});});_0x2525b7['on'](_0xb105('0x20'),function(_0x49d709){if(_0x188117){return _0x188117[_0xb105('0x1c')](0x1f4)[_0xb105('0x1e')]({'errors':[{'message':_0xb105('0x21'),'type':_0xb105('0x22')}]});}});_0x2525b7[_0xb105('0x23')](_0x3bfd5b);_0x2525b7[_0xb105('0x1b')]();}exports[_0xb105('0x24')]=openIssue;exports['send']=function(_0x4f7458,_0x407d46){_0x4f7458[_0xb105('0x25')]['ip']=_0x4f7458['headers'][_0xb105('0x26')]||_0x4f7458[_0xb105('0x27')][_0xb105('0x28')]||_0x4f7458[_0xb105('0x29')][_0xb105('0x28')]||_0x4f7458['connection']['socket'][_0xb105('0x28')];return openIssue(_0x4f7458[_0xb105('0x25')],_0x407d46);}; \ No newline at end of file +var _0xa36f=['x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','fields','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','request','end','statusCode','json','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','body'];(function(_0x4642c2,_0x4f3b8a){var _0x3de5c7=function(_0x43bde1){while(--_0x43bde1){_0x4642c2['push'](_0x4642c2['shift']());}};_0x3de5c7(++_0x4f3b8a);}(_0xa36f,0xdc));var _0xfa36=function(_0x54dda7,_0x6d79af){_0x54dda7=_0x54dda7-0x0;var _0x3e66b7=_0xa36f[_0x54dda7];return _0x3e66b7;};'use strict';var BPromise=require(_0xfa36('0x0'));var https=require('https');var logger=require(_0xfa36('0x1'))(_0xfa36('0x2'));var USERNAME='support';var PASSWORD=_0xfa36('0x3');function openIssue(_0x54ff83,_0x375abb){var _0x4e4417={'fields':{'project':{'key':_0x54ff83[_0xfa36('0x4')]||_0xfa36('0x5')},'summary':(_0x54ff83[_0xfa36('0x6')]||_0xfa36('0x7'))+_0xfa36('0x8')+_0x54ff83['ip'],'description':_0x54ff83[_0xfa36('0x9')]||JSON['stringify'](_0x54ff83),'issuetype':{'name':_0x54ff83['issuetype']||'Bug'}}};_0x4e4417[_0xfa36('0xa')]['customfield_11500']=_0x54ff83['email'];_0x4e4417[_0xfa36('0xa')][_0xfa36('0xb')]=_0x54ff83['oldToken'];_0x4e4417[_0xfa36('0xa')][_0xfa36('0xc')]=_0x54ff83[_0xfa36('0xd')];_0x4e4417[_0xfa36('0xa')][_0xfa36('0xe')]=_0x54ff83[_0xfa36('0xf')];_0x4e4417[_0xfa36('0xa')][_0xfa36('0x10')]=_0x54ff83[_0xfa36('0x11')];_0x4e4417['fields'][_0xfa36('0x12')]=_0x54ff83['ip'];var _0x365b43={'host':_0xfa36('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xfa36('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xfa36('0x15'),'Authorization':_0xfa36('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xfa36('0x17'))}};var _0x13baa0=JSON['stringify'](_0x4e4417);var _0x4feada=https[_0xfa36('0x18')](_0x365b43,function(_0x1bdfc5){_0x1bdfc5['setEncoding']('utf8');var _0x1c7936='';_0x1bdfc5['on']('data',function(_0x558d6d){_0x1c7936+=_0x558d6d;});_0x1bdfc5['on'](_0xfa36('0x19'),function(){if(_0x375abb){return _0x375abb['status'](_0x1bdfc5[_0xfa36('0x1a')])[_0xfa36('0x1b')](JSON['parse'](_0x1c7936));}});});_0x4feada['on']('error',function(_0x5b2e4e){if(_0x375abb){return _0x375abb[_0xfa36('0x1c')](0x1f4)[_0xfa36('0x1b')]({'errors':[{'message':_0xfa36('0x1d'),'type':_0xfa36('0x1e')}]});}});_0x4feada['write'](_0x13baa0);_0x4feada[_0xfa36('0x19')]();}exports['openIssue']=openIssue;exports['send']=function(_0x3acf40,_0x3ef934){_0x3acf40[_0xfa36('0x1f')]['ip']=_0x3acf40['headers'][_0xfa36('0x20')]||_0x3acf40[_0xfa36('0x21')][_0xfa36('0x22')]||_0x3acf40[_0xfa36('0x23')][_0xfa36('0x22')]||_0x3acf40['connection'][_0xfa36('0x23')][_0xfa36('0x22')];return openIssue(_0x3acf40['body'],_0x3ef934);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 09b1c6c..7e859eb 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 _0x1be1=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','put','update','destroy','path','connect-timeout','Router'];(function(_0x444cac,_0x1c0296){var _0x10eaec=function(_0x1efe6d){while(--_0x1efe6d){_0x444cac['push'](_0x444cac['shift']());}};_0x10eaec(++_0x1c0296);}(_0x1be1,0x192));var _0x11be=function(_0xd78606,_0x1b86ae){_0xd78606=_0xd78606-0x0;var _0x161fc6=_0x1be1[_0xd78606];return _0x161fc6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0xb')]('/',auth[_0x11be('0x8')](),controller['create']);router[_0x11be('0xc')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xd')]);router['delete'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);module['exports']=router; \ No newline at end of file +var _0xaa88=['/describe','isAuthenticated','describe','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xaa88,0x137));var _0x8aa8=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xaa88[_0x2e2681];return _0x368a64;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa8('0x11')]);router[_0x8aa8('0x12')](_0x8aa8('0x13'),auth[_0x8aa8('0xc')](),controller['update']);router[_0x8aa8('0x14')](_0x8aa8('0x13'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);module[_0x8aa8('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 2f23e32..1518979 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x503617,_0x5b7aa0){_0x503617=_0x503617-0x0;var _0x9935fa=_0x7a54[_0x503617];return _0x9935fa;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x4c8d03,_0x469ca9){_0x4c8d03=_0x4c8d03-0x0;var _0x3fa3b8=_0x7a54[_0x4c8d03];return _0x3fa3b8;};'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 20592f4..1c6024d 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 _0x14f5=['limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','update','destroy','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty'];(function(_0xb324da,_0x1feac2){var _0x4f5300=function(_0x538252){while(--_0x538252){_0xb324da['push'](_0xb324da['shift']());}};_0x4f5300(++_0x1feac2);}(_0x14f5,0xae));var _0x514f=function(_0x455913,_0x2b7a92){_0x455913=_0x455913-0x0;var _0x3025b8=_0x14f5[_0x455913];return _0x3025b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x514f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x514f('0x1'));var rp=require(_0x514f('0x2'));var moment=require(_0x514f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x514f('0x4'));var util=require(_0x514f('0x5'));var path=require('path');var sox=require(_0x514f('0x6'));var csv=require(_0x514f('0x7'));var ejs=require(_0x514f('0x8'));var fs=require('fs');var fs_extra=require(_0x514f('0x9'));var _=require(_0x514f('0xa'));var squel=require(_0x514f('0xb'));var crypto=require(_0x514f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x514f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x514f('0xe'));var Papa=require(_0x514f('0xf'));var Redis=require(_0x514f('0x10'));var authService=require(_0x514f('0x11'));var qs=require(_0x514f('0x12'));var as=require(_0x514f('0x13'));var hardwareService=require(_0x514f('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x514f('0x15'));var licenseUtil=require(_0x514f('0x16'));var db=require(_0x514f('0x17'))['db'];function respondWithStatusCode(_0x321914,_0x3eed49){_0x3eed49=_0x3eed49||0xcc;return function(_0x2ed1b7){if(_0x2ed1b7){return _0x321914[_0x514f('0x18')](_0x3eed49);}return _0x321914[_0x514f('0x19')](_0x3eed49)[_0x514f('0x1a')]();};}function respondWithResult(_0x4124bf,_0x46e552){_0x46e552=_0x46e552||0xc8;return function(_0x3fc905){if(_0x3fc905){return _0x4124bf[_0x514f('0x19')](_0x46e552)[_0x514f('0x1b')](_0x3fc905);}};}function respondWithFilteredResult(_0x1694b3,_0x5865d1){return function(_0x70d2b4){if(_0x70d2b4){var _0x1f0cbe=typeof _0x5865d1['offset']===_0x514f('0x1c')&&typeof _0x5865d1['limit']===_0x514f('0x1c');var _0x309ce0=_0x70d2b4[_0x514f('0x1d')];var _0x5a5641=_0x1f0cbe?0x0:_0x5865d1[_0x514f('0x1e')];var _0x3673a4=_0x1f0cbe?_0x70d2b4[_0x514f('0x1d')]:_0x5865d1[_0x514f('0x1e')]+_0x5865d1['limit'];var _0x4f9193;if(_0x3673a4>=_0x309ce0){_0x3673a4=_0x309ce0;_0x4f9193=0xc8;}else{_0x4f9193=0xce;}_0x1694b3[_0x514f('0x19')](_0x4f9193);return _0x1694b3[_0x514f('0x1f')](_0x514f('0x20'),_0x5a5641+'-'+_0x3673a4+'/'+_0x309ce0)['json'](_0x70d2b4);}return null;};}function patchUpdates(_0x43fcf9){return function(_0x7248e8){try{jsonpatch['apply'](_0x7248e8,_0x43fcf9,!![]);}catch(_0x186417){return BPromise[_0x514f('0x21')](_0x186417);}return _0x7248e8['save']();};}function saveUpdates(_0xd093a1,_0x18a430){return function(_0xd89aa2){if(_0xd89aa2){return _0xd89aa2[_0x514f('0x22')](_0xd093a1)['then'](function(_0x58861e){return _0x58861e;});}return null;};}function removeEntity(_0x4b0245,_0x5d80cb){return function(_0x1c16f9){if(_0x1c16f9){return _0x1c16f9[_0x514f('0x23')]()[_0x514f('0x24')](function(){_0x4b0245[_0x514f('0x19')](0xcc)[_0x514f('0x1a')]();});}};}function handleEntityNotFound(_0x26df04,_0x2c6bb1){return function(_0x101742){if(!_0x101742){_0x26df04[_0x514f('0x18')](0x194);}return _0x101742;};}function handleError(_0x5f2da2,_0x8c8bdf){_0x8c8bdf=_0x8c8bdf||0x1f4;return function(_0x37b3db){logger[_0x514f('0x25')](_0x37b3db[_0x514f('0x26')]);if(_0x37b3db[_0x514f('0x27')]){delete _0x37b3db[_0x514f('0x27')];}_0x5f2da2[_0x514f('0x19')](_0x8c8bdf)[_0x514f('0x28')](_0x37b3db);};}exports[_0x514f('0x29')]=function(_0x594a50,_0x2c4c4b){var _0x488c17={},_0x2b43e0={},_0x51beda={'count':0x0,'rows':[]};var _0x40ac5e=_[_0x514f('0x2a')](db[_0x514f('0x2b')][_0x514f('0x2c')],function(_0xdc0bcc){return{'name':_0xdc0bcc['fieldName'],'type':_0xdc0bcc['type'][_0x514f('0x2d')]};});_0x2b43e0['model']=_[_0x514f('0x2a')](_0x40ac5e,_0x514f('0x27'));_0x2b43e0[_0x514f('0x2e')]=_[_0x514f('0x2f')](_0x594a50[_0x514f('0x2e')]);_0x2b43e0['filters']=_['intersection'](_0x2b43e0['model'],_0x2b43e0[_0x514f('0x2e')]);_0x488c17[_0x514f('0x30')]=_[_0x514f('0x31')](_0x2b43e0[_0x514f('0x32')],qs[_0x514f('0x33')](_0x594a50[_0x514f('0x2e')][_0x514f('0x33')]));_0x488c17[_0x514f('0x30')]=_0x488c17[_0x514f('0x30')][_0x514f('0x34')]?_0x488c17['attributes']:_0x2b43e0['model'];if(!_0x594a50['query'][_0x514f('0x35')]('nolimit')){_0x488c17[_0x514f('0x36')]=qs['limit'](_0x594a50[_0x514f('0x2e')]['limit']);_0x488c17['offset']=qs[_0x514f('0x1e')](_0x594a50['query'][_0x514f('0x1e')]);}_0x488c17[_0x514f('0x37')]=qs[_0x514f('0x38')](_0x594a50[_0x514f('0x2e')][_0x514f('0x38')]);_0x488c17['where']=qs[_0x514f('0x39')](_[_0x514f('0x3a')](_0x594a50[_0x514f('0x2e')],_0x2b43e0[_0x514f('0x39')]),_0x40ac5e);if(_0x594a50['query'][_0x514f('0x3b')]){_0x488c17[_0x514f('0x3c')]=_[_0x514f('0x3d')](_0x488c17[_0x514f('0x3c')],{'$or':_['map'](_0x40ac5e,function(_0x1c1a24){if(_0x1c1a24[_0x514f('0x3e')]!==_0x514f('0x3f')){var _0x281d39={};_0x281d39[_0x1c1a24['name']]={'$like':'%'+_0x594a50[_0x514f('0x2e')]['filter']+'%'};return _0x281d39;}})});}_0x488c17=_[_0x514f('0x3d')]({},_0x488c17,_0x594a50[_0x514f('0x40')]);var _0x18969b={'where':_0x488c17['where']};return db['JscriptyAnswerReport'][_0x514f('0x1d')](_0x18969b)['then'](function(_0x10259a){_0x51beda[_0x514f('0x1d')]=_0x10259a;if(_0x594a50[_0x514f('0x2e')][_0x514f('0x41')]){_0x488c17[_0x514f('0x42')]=[{'all':!![]}];}return db[_0x514f('0x2b')][_0x514f('0x43')](_0x488c17);})['then'](function(_0x48914e){_0x51beda[_0x514f('0x44')]=_0x48914e;return _0x51beda;})['then'](respondWithFilteredResult(_0x2c4c4b,_0x488c17))[_0x514f('0x45')](handleError(_0x2c4c4b,null));};exports[_0x514f('0x46')]=function(_0x48d82a,_0x203af2){var _0x326ea6={'raw':!![],'where':{'id':_0x48d82a[_0x514f('0x47')]['id']}},_0x51e50b={};_0x51e50b['model']=_['keys'](db[_0x514f('0x2b')][_0x514f('0x2c')]);_0x51e50b[_0x514f('0x2e')]=_[_0x514f('0x2f')](_0x48d82a[_0x514f('0x2e')]);_0x51e50b['filters']=_['intersection'](_0x51e50b[_0x514f('0x32')],_0x51e50b[_0x514f('0x2e')]);_0x326ea6[_0x514f('0x30')]=_[_0x514f('0x31')](_0x51e50b[_0x514f('0x32')],qs['fields'](_0x48d82a[_0x514f('0x2e')]['fields']));_0x326ea6['attributes']=_0x326ea6[_0x514f('0x30')]['length']?_0x326ea6[_0x514f('0x30')]:_0x51e50b['model'];if(_0x48d82a['query'][_0x514f('0x41')]){_0x326ea6[_0x514f('0x42')]=[{'all':!![]}];}_0x326ea6=_['merge']({},_0x326ea6,_0x48d82a['options']);return db[_0x514f('0x2b')][_0x514f('0x48')](_0x326ea6)[_0x514f('0x24')](handleEntityNotFound(_0x203af2,null))[_0x514f('0x24')](respondWithResult(_0x203af2,null))[_0x514f('0x45')](handleError(_0x203af2,null));};exports[_0x514f('0x49')]=function(_0xa5259e,_0x1b33b2){return db[_0x514f('0x2b')]['create'](_0xa5259e[_0x514f('0x4a')],{})[_0x514f('0x24')](respondWithResult(_0x1b33b2,0xc9))[_0x514f('0x45')](handleError(_0x1b33b2,null));};exports[_0x514f('0x22')]=function(_0x33b658,_0x2e6971){if(_0x33b658[_0x514f('0x4a')]['id']){delete _0x33b658['body']['id'];}return db[_0x514f('0x2b')]['find']({'where':{'id':_0x33b658[_0x514f('0x47')]['id']}})[_0x514f('0x24')](handleEntityNotFound(_0x2e6971,null))[_0x514f('0x24')](saveUpdates(_0x33b658[_0x514f('0x4a')],null))[_0x514f('0x24')](respondWithResult(_0x2e6971,null))['catch'](handleError(_0x2e6971,null));};exports['destroy']=function(_0x38e237,_0x5e6e97){return db[_0x514f('0x2b')]['find']({'where':{'id':_0x38e237[_0x514f('0x47')]['id']}})[_0x514f('0x24')](handleEntityNotFound(_0x5e6e97,null))[_0x514f('0x24')](removeEntity(_0x5e6e97,null))['catch'](handleError(_0x5e6e97,null));};exports[_0x514f('0x4b')]=function(_0x41cb02,_0x2171e9){return db['JscriptyAnswerReport'][_0x514f('0x4b')]()[_0x514f('0x24')](respondWithResult(_0x2171e9,null))['catch'](handleError(_0x2171e9,null));}; \ No newline at end of file +var _0x5d17=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','update','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox'];(function(_0x25960d,_0x2d5f0e){var _0x2a9db6=function(_0xefdaa3){while(--_0xefdaa3){_0x25960d['push'](_0x25960d['shift']());}};_0x2a9db6(++_0x2d5f0e);}(_0x5d17,0x114));var _0x75d1=function(_0x250b8b,_0x1d3b34){_0x250b8b=_0x250b8b-0x0;var _0x458585=_0x5d17[_0x250b8b];return _0x458585;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['JscriptyAnswerReport'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')](_0x12bd67['body'],{})['then'](respondWithResult(_0x16f744,0xc9))[_0x75d1('0x3e')](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x50def3,_0x2d380d){if(_0x50def3[_0x75d1('0x44')]['id']){delete _0x50def3[_0x75d1('0x44')]['id'];}return db['JscriptyAnswerReport'][_0x75d1('0x45')]({'where':{'id':_0x50def3[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x2d380d,null))[_0x75d1('0x24')](saveUpdates(_0x50def3[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x2d380d,null))[_0x75d1('0x3e')](handleError(_0x2d380d,null));};exports['destroy']=function(_0x1eaa66,_0x382195){return db[_0x75d1('0x28')][_0x75d1('0x45')]({'where':{'id':_0x1eaa66[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x382195,null))[_0x75d1('0x24')](removeEntity(_0x382195,null))['catch'](handleError(_0x382195,null));};exports[_0x75d1('0x46')]=function(_0x3af9c5,_0x42d587){return db['JscriptyAnswerReport'][_0x75d1('0x46')]()[_0x75d1('0x24')](respondWithResult(_0x42d587,null))[_0x75d1('0x3e')](handleError(_0x42d587,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0835952..9f7637a 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 _0xa7d7=['util','../../config/logger','api','moment','request-promise','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x156103,_0x2751ec){var _0x332051=function(_0x41c148){while(--_0x41c148){_0x156103['push'](_0x156103['shift']());}};_0x332051(++_0x2751ec);}(_0xa7d7,0x1a1));var _0x7a7d=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xa7d7[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x7a7d('0x0'));var util=require(_0x7a7d('0x1'));var logger=require(_0x7a7d('0x2'))(_0x7a7d('0x3'));var moment=require(_0x7a7d('0x4'));var BPromise=require('bluebird');var rp=require(_0x7a7d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a7d('0x6'));var config=require('../../config/environment');var attributes=require(_0x7a7d('0x7'));module[_0x7a7d('0x8')]=function(_0x1a9e2d,_0x39e134){return _0x1a9e2d['define'](_0x7a7d('0x9'),attributes,{'tableName':_0x7a7d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30f5=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','define','JscriptyAnswerReport','lodash'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x30f5,0x155));var _0x530f=function(_0x86ba06,_0x2e50d9){_0x86ba06=_0x86ba06-0x0;var _0xafb44a=_0x30f5[_0x86ba06];return _0xafb44a;};'use strict';var _=require(_0x530f('0x0'));var util=require(_0x530f('0x1'));var logger=require(_0x530f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x530f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x530f('0x4'));var rimraf=require(_0x530f('0x5'));var config=require(_0x530f('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x12a711,_0x437bd7){return _0x12a711[_0x530f('0x7')](_0x530f('0x8'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index e116961..0094bae 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 _0x376d=['error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x20b919,_0x6d22be){var _0x529fda=function(_0x325481){while(--_0x325481){_0x20b919['push'](_0x20b919['shift']());}};_0x529fda(++_0x6d22be);}(_0x376d,0x1a9));var _0xd376=function(_0x30fb69,_0xeb0943){_0x30fb69=_0x30fb69-0x0;var _0x4edbd1=_0x376d[_0x30fb69];return _0x4edbd1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd376('0x0'));var BPromise=require(_0xd376('0x1'));var rs=require(_0xd376('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd376('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd376('0x4'));var config=require(_0xd376('0x5'));var jayson=require(_0xd376('0x6'));var client=jayson[_0xd376('0x7')][_0xd376('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43a8da,_0x4477a8,_0x312cd3){return new BPromise(function(_0x3271d6,_0x5cd6e0){return client[_0xd376('0x9')](_0x43a8da,_0x312cd3)[_0xd376('0xa')](function(_0x1aee94){logger[_0xd376('0xb')](_0xd376('0xc'),_0x4477a8,_0xd376('0xd'));logger['debug'](_0xd376('0xe'),_0x4477a8,_0xd376('0xd'),JSON['stringify'](_0x1aee94));if(_0x1aee94[_0xd376('0xf')]){if(_0x1aee94[_0xd376('0xf')][_0xd376('0x10')]===0x1f4){logger['error'](_0xd376('0xc'),_0x4477a8,_0x1aee94[_0xd376('0xf')][_0xd376('0x11')]);return _0x5cd6e0(_0x1aee94[_0xd376('0xf')][_0xd376('0x11')]);}logger[_0xd376('0xf')](_0xd376('0xc'),_0x4477a8,_0x1aee94['error'][_0xd376('0x11')]);return _0x3271d6(_0x1aee94[_0xd376('0xf')]['message']);}else{logger[_0xd376('0xb')](_0xd376('0xc'),_0x4477a8,'request\x20sent');_0x3271d6(_0x1aee94[_0xd376('0x12')][_0xd376('0x11')]);}})[_0xd376('0x13')](function(_0x578590){logger[_0xd376('0xf')](_0xd376('0xc'),_0x4477a8,_0x578590);_0x5cd6e0(_0x578590);});});} \ No newline at end of file +var _0xefb5=['debug','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xefb5,0x14b));var _0x5efb=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0xefb5[_0x4fc421];return _0x8c6d63;};'use strict';var _=require('lodash');var util=require(_0x5efb('0x0'));var moment=require(_0x5efb('0x1'));var BPromise=require(_0x5efb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5efb('0x3'));var db=require(_0x5efb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5efb('0x5'))(_0x5efb('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5efb('0x7')][_0x5efb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33f13e,_0x5c914f,_0x6a4cc8){return new BPromise(function(_0x4ba14e,_0x341078){return client['request'](_0x33f13e,_0x6a4cc8)['then'](function(_0x32f616){logger['info'](_0x5efb('0x9'),_0x5c914f,_0x5efb('0xa'));logger[_0x5efb('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5c914f,_0x5efb('0xa'),JSON[_0x5efb('0xc')](_0x32f616));if(_0x32f616[_0x5efb('0xd')]){if(_0x32f616[_0x5efb('0xd')][_0x5efb('0xe')]===0x1f4){logger[_0x5efb('0xd')](_0x5efb('0x9'),_0x5c914f,_0x32f616[_0x5efb('0xd')][_0x5efb('0xf')]);return _0x341078(_0x32f616[_0x5efb('0xd')][_0x5efb('0xf')]);}logger['error'](_0x5efb('0x9'),_0x5c914f,_0x32f616[_0x5efb('0xd')][_0x5efb('0xf')]);return _0x4ba14e(_0x32f616[_0x5efb('0xd')]['message']);}else{logger['info'](_0x5efb('0x9'),_0x5c914f,_0x5efb('0xa'));_0x4ba14e(_0x32f616[_0x5efb('0x10')][_0x5efb('0xf')]);}})[_0x5efb('0x11')](function(_0xb07697){logger[_0x5efb('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5c914f,_0xb07697);_0x341078(_0xb07697);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 175a293..09995de 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 _0x558e=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/answers','/:id/summary','getSummary','post','create','/:id/clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x439418,_0x245d0f){var _0x5a128f=function(_0x4a43a2){while(--_0x4a43a2){_0x439418['push'](_0x439418['shift']());}};_0x5a128f(++_0x245d0f);}(_0x558e,0x179));var _0xe558=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x558e[_0x4b7b69];return _0x173b4c;};'use strict';var multer=require(_0xe558('0x0'));var util=require(_0xe558('0x1'));var path=require(_0xe558('0x2'));var timeout=require(_0xe558('0x3'));var express=require(_0xe558('0x4'));var router=express['Router']();var fs_extra=require(_0xe558('0x5'));var auth=require(_0xe558('0x6'));var interaction=require(_0xe558('0x7'));var config=require(_0xe558('0x8'));var controller=require('./jscriptyProject.controller');router[_0xe558('0x9')]('/',auth[_0xe558('0xa')](),controller[_0xe558('0xb')]);router[_0xe558('0x9')](_0xe558('0xc'),auth[_0xe558('0xa')](),controller['show']);router[_0xe558('0x9')]('/:id/sessions',auth[_0xe558('0xa')](),controller['getSessions']);router[_0xe558('0x9')](_0xe558('0xd'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xe558('0xe'),auth['isAuthenticated'](),timeout('30s'),controller[_0xe558('0xf')]);router[_0xe558('0x10')]('/',auth[_0xe558('0xa')](),controller[_0xe558('0x11')]);router['post'](_0xe558('0x12'),auth['isAuthenticated'](),controller['clone']);router[_0xe558('0x13')]('/:id',auth[_0xe558('0xa')](),controller[_0xe558('0x14')]);router[_0xe558('0x15')](_0xe558('0xc'),auth[_0xe558('0xa')](),controller[_0xe558('0x16')]);module[_0xe558('0x17')]=router; \ No newline at end of file +var _0x5f22=['delete','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions','getAnswers','/:id/summary','create','post','/:id/clone','clone','put','update'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0x5f22,0x13c));var _0x25f2=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x5f22[_0x3b3cc6];return _0x1161e4;};'use strict';var multer=require(_0x25f2('0x0'));var util=require(_0x25f2('0x1'));var path=require('path');var timeout=require(_0x25f2('0x2'));var express=require(_0x25f2('0x3'));var router=express['Router']();var fs_extra=require(_0x25f2('0x4'));var auth=require(_0x25f2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x25f2('0x6'));router[_0x25f2('0x7')]('/',auth[_0x25f2('0x8')](),controller['index']);router['get'](_0x25f2('0x9'),auth[_0x25f2('0x8')](),controller[_0x25f2('0xa')]);router[_0x25f2('0x7')](_0x25f2('0xb'),auth[_0x25f2('0x8')](),controller['getSessions']);router[_0x25f2('0x7')]('/:id/answers',auth[_0x25f2('0x8')](),controller[_0x25f2('0xc')]);router[_0x25f2('0x7')](_0x25f2('0xd'),auth['isAuthenticated'](),timeout('30s'),controller['getSummary']);router['post']('/',auth[_0x25f2('0x8')](),controller[_0x25f2('0xe')]);router[_0x25f2('0xf')](_0x25f2('0x10'),auth[_0x25f2('0x8')](),controller[_0x25f2('0x11')]);router[_0x25f2('0x12')](_0x25f2('0x9'),auth['isAuthenticated'](),controller[_0x25f2('0x13')]);router[_0x25f2('0x14')](_0x25f2('0x9'),auth[_0x25f2('0x8')](),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 090fd9d..ae43f84 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 _0xd11c=['name','TEXT','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','exports','STRING'];(function(_0xaec629,_0x17f8d4){var _0x13cd91=function(_0xc16073){while(--_0xc16073){_0xaec629['push'](_0xaec629['shift']());}};_0x13cd91(++_0x17f8d4);}(_0xd11c,0x128));var _0xcd11=function(_0x214234,_0x3e01a2){_0x214234=_0x214234-0x0;var _0x3d6f15=_0xd11c[_0x214234];return _0x3d6f15;};'use strict';var Sequelize=require(_0xcd11('0x0'));var _=require(_0xcd11('0x1'));var util=require('util');module[_0xcd11('0x2')]={'name':{'type':Sequelize[_0xcd11('0x3')],'unique':_0xcd11('0x4')},'description':{'type':Sequelize[_0xcd11('0x3')]},'formData':{'type':Sequelize[_0xcd11('0x5')]('long'),'set':function(_0xd55ebb){if(_[_0xcd11('0x6')](_0xd55ebb)){this['setDataValue'](_0xcd11('0x7'),JSON[_0xcd11('0x8')](_0xd55ebb));}else if(_[_0xcd11('0x9')](_0xd55ebb)){this[_0xcd11('0xa')](_0xcd11('0x7'),_0xd55ebb);}else{this[_0xcd11('0xa')]('formData',util[_0xcd11('0xb')](_0xcd11('0xc'),this[_0xcd11('0xd')](_0xcd11('0x4'))||'',this[_0xcd11('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xcd11('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x44e4=['BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description'];(function(_0x4309b9,_0x5f0989){var _0x10a2d5=function(_0x517d45){while(--_0x517d45){_0x4309b9['push'](_0x4309b9['shift']());}};_0x10a2d5(++_0x5f0989);}(_0x44e4,0x1b1));var _0x444e=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0x44e4[_0x3c2166];return _0x30ccc3;};'use strict';var Sequelize=require(_0x444e('0x0'));var _=require(_0x444e('0x1'));var util=require(_0x444e('0x2'));module[_0x444e('0x3')]={'name':{'type':Sequelize[_0x444e('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x444e('0x4')]},'formData':{'type':Sequelize[_0x444e('0x5')](_0x444e('0x6')),'set':function(_0x267dd4){if(_[_0x444e('0x7')](_0x267dd4)){this[_0x444e('0x8')](_0x444e('0x9'),JSON[_0x444e('0xa')](_0x267dd4));}else if(_[_0x444e('0xb')](_0x267dd4)){this[_0x444e('0x8')](_0x444e('0x9'),_0x267dd4);}else{this['setDataValue'](_0x444e('0x9'),util[_0x444e('0xc')](_0x444e('0xd'),this[_0x444e('0xe')](_0x444e('0xf'))||'',this[_0x444e('0xe')](_0x444e('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x444e('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x444e('0x11')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index df6afde..5255f07 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 _0x8ba6=['catch','show','params','rawAttributes','length','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','update','destroy','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','nolimit','ProjectId','number','fromCharCode','apply','toString','indexOf','replace','startTime','starttime','parse','hasOwnProperty','questionId','question','format','SessionId','push','now','writeFileSync','Content-disposition','attachment;\x20filename=','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','zip-dir','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','get','UserProfileResource','then','error','stack','name','index','map','JscriptyProject','key','model','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows'];(function(_0x1d6c73,_0x29b113){var _0x66acc0=function(_0x34a6a1){while(--_0x34a6a1){_0x1d6c73['push'](_0x1d6c73['shift']());}};_0x66acc0(++_0x29b113);}(_0x8ba6,0x11b));var _0x68ba=function(_0x5773c9,_0x4c8665){_0x5773c9=_0x5773c9-0x0;var _0x28c202=_0x8ba6[_0x5773c9];return _0x28c202;};'use strict';var emlformat=require(_0x68ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x68ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68ba('0x2'));var moment=require(_0x68ba('0x3'));var BPromise=require(_0x68ba('0x4'));var Mustache=require(_0x68ba('0x5'));var util=require('util');var path=require('path');var sox=require(_0x68ba('0x6'));var csv=require(_0x68ba('0x7'));var ejs=require(_0x68ba('0x8'));var fs=require('fs');var fs_extra=require(_0x68ba('0x9'));var _=require(_0x68ba('0xa'));var squel=require(_0x68ba('0xb'));var crypto=require(_0x68ba('0xc'));var jsforce=require(_0x68ba('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x68ba('0x7'));var querystring=require(_0x68ba('0xe'));var Papa=require(_0x68ba('0xf'));var Redis=require(_0x68ba('0x10'));var authService=require(_0x68ba('0x11'));var qs=require(_0x68ba('0x12'));var as=require(_0x68ba('0x13'));var hardwareService=require(_0x68ba('0x14'));var logger=require(_0x68ba('0x15'))(_0x68ba('0x16'));var utils=require('../../config/utils');var config=require(_0x68ba('0x17'));var licenseUtil=require(_0x68ba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57ba2c,_0x1ae736){_0x1ae736=_0x1ae736||0xcc;return function(_0x577fe8){if(_0x577fe8){return _0x57ba2c[_0x68ba('0x19')](_0x1ae736);}return _0x57ba2c[_0x68ba('0x1a')](_0x1ae736)[_0x68ba('0x1b')]();};}function respondWithResult(_0x382b39,_0x96c10c){_0x96c10c=_0x96c10c||0xc8;return function(_0x29ee7a){if(_0x29ee7a){return _0x382b39[_0x68ba('0x1a')](_0x96c10c)['json'](_0x29ee7a);}};}function respondWithFilteredResult(_0x300a41,_0x1a17c2){return function(_0x1ce168){if(_0x1ce168){var _0x438dcc=typeof _0x1a17c2[_0x68ba('0x1c')]==='undefined'&&typeof _0x1a17c2[_0x68ba('0x1d')]===_0x68ba('0x1e');var _0x48d8e2=_0x1ce168['count'];var _0x33a324=_0x438dcc?0x0:_0x1a17c2[_0x68ba('0x1c')];var _0x219b7f=_0x438dcc?_0x1ce168[_0x68ba('0x1f')]:_0x1a17c2[_0x68ba('0x1c')]+_0x1a17c2[_0x68ba('0x1d')];var _0xb58385;if(_0x219b7f>=_0x48d8e2){_0x219b7f=_0x48d8e2;_0xb58385=0xc8;}else{_0xb58385=0xce;}_0x300a41[_0x68ba('0x1a')](_0xb58385);return _0x300a41[_0x68ba('0x20')](_0x68ba('0x21'),_0x33a324+'-'+_0x219b7f+'/'+_0x48d8e2)[_0x68ba('0x22')](_0x1ce168);}return null;};}function patchUpdates(_0x3bb47f){return function(_0x39862e){try{jsonpatch['apply'](_0x39862e,_0x3bb47f,!![]);}catch(_0x5b09ee){return BPromise[_0x68ba('0x23')](_0x5b09ee);}return _0x39862e['save']();};}function saveUpdates(_0x27ed6a,_0x1299e0){return function(_0xacd6b6){if(_0xacd6b6){return _0xacd6b6['update'](_0x27ed6a)['then'](function(_0x414090){return _0x414090;});}return null;};}function removeEntity(_0x3d8932,_0x4f5f5f){return function(_0x434d7a){if(_0x434d7a){return _0x434d7a['destroy']()['then'](function(){var _0x10d265=_0x434d7a[_0x68ba('0x24')]({'plain':!![]});var _0x27e4fc='Projects';return db[_0x68ba('0x25')]['destroy']({'where':{'type':_0x27e4fc,'resourceId':_0x10d265['id']}})[_0x68ba('0x26')](function(){return _0x434d7a;});})[_0x68ba('0x26')](function(){_0x3d8932[_0x68ba('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41d038,_0x4fcd25){return function(_0x4da416){if(!_0x4da416){_0x41d038[_0x68ba('0x19')](0x194);}return _0x4da416;};}function handleError(_0x58c6d6,_0x96f588){_0x96f588=_0x96f588||0x1f4;return function(_0x5f3775){logger[_0x68ba('0x27')](_0x5f3775[_0x68ba('0x28')]);if(_0x5f3775['name']){delete _0x5f3775[_0x68ba('0x29')];}_0x58c6d6['status'](_0x96f588)['send'](_0x5f3775);};}exports[_0x68ba('0x2a')]=function(_0x1fe628,_0x2c21cc){var _0x3be7fe={},_0x52f085={},_0x4bad63={'count':0x0,'rows':[]};var _0x4e47bd=_[_0x68ba('0x2b')](db[_0x68ba('0x2c')]['rawAttributes'],function(_0x4cf34c){return{'name':_0x4cf34c['fieldName'],'type':_0x4cf34c['type'][_0x68ba('0x2d')]};});_0x52f085[_0x68ba('0x2e')]=_[_0x68ba('0x2b')](_0x4e47bd,_0x68ba('0x29'));_0x52f085[_0x68ba('0x2f')]=_[_0x68ba('0x30')](_0x1fe628['query']);_0x52f085['filters']=_[_0x68ba('0x31')](_0x52f085[_0x68ba('0x2e')],_0x52f085[_0x68ba('0x2f')]);_0x3be7fe[_0x68ba('0x32')]=_[_0x68ba('0x31')](_0x52f085[_0x68ba('0x2e')],qs['fields'](_0x1fe628[_0x68ba('0x2f')][_0x68ba('0x33')]));_0x3be7fe[_0x68ba('0x32')]=_0x3be7fe[_0x68ba('0x32')]['length']?_0x3be7fe[_0x68ba('0x32')]:_0x52f085[_0x68ba('0x2e')];if(!_0x1fe628[_0x68ba('0x2f')]['hasOwnProperty']('nolimit')){_0x3be7fe['limit']=qs[_0x68ba('0x1d')](_0x1fe628[_0x68ba('0x2f')][_0x68ba('0x1d')]);_0x3be7fe['offset']=qs[_0x68ba('0x1c')](_0x1fe628[_0x68ba('0x2f')]['offset']);}_0x3be7fe[_0x68ba('0x34')]=qs[_0x68ba('0x35')](_0x1fe628[_0x68ba('0x2f')][_0x68ba('0x35')]);_0x3be7fe[_0x68ba('0x36')]=qs[_0x68ba('0x37')](_[_0x68ba('0x38')](_0x1fe628[_0x68ba('0x2f')],_0x52f085[_0x68ba('0x37')]),_0x4e47bd);if(_0x1fe628[_0x68ba('0x2f')]['filter']){_0x3be7fe['where']=_[_0x68ba('0x39')](_0x3be7fe[_0x68ba('0x36')],{'$or':_[_0x68ba('0x2b')](_0x4e47bd,function(_0x247c13){if(_0x247c13[_0x68ba('0x3a')]!==_0x68ba('0x3b')){var _0x2562dd={};_0x2562dd[_0x247c13[_0x68ba('0x29')]]={'$like':'%'+_0x1fe628[_0x68ba('0x2f')][_0x68ba('0x3c')]+'%'};return _0x2562dd;}})});}_0x3be7fe=_['merge']({},_0x3be7fe,_0x1fe628['options']);var _0x3f2e44={'where':_0x3be7fe[_0x68ba('0x36')]};return db[_0x68ba('0x2c')]['count'](_0x3f2e44)[_0x68ba('0x26')](function(_0x5cda75){_0x4bad63[_0x68ba('0x1f')]=_0x5cda75;if(_0x1fe628[_0x68ba('0x2f')][_0x68ba('0x3d')]){_0x3be7fe[_0x68ba('0x3e')]=[{'all':!![]}];}return db[_0x68ba('0x2c')][_0x68ba('0x3f')](_0x3be7fe);})[_0x68ba('0x26')](function(_0x203246){_0x4bad63[_0x68ba('0x40')]=_0x203246;return _0x4bad63;})['then'](respondWithFilteredResult(_0x2c21cc,_0x3be7fe))[_0x68ba('0x41')](handleError(_0x2c21cc,null));};exports[_0x68ba('0x42')]=function(_0x1d769d,_0x5acabb){var _0x13c0b1={'raw':![],'where':{'id':_0x1d769d[_0x68ba('0x43')]['id']}},_0x196809={};_0x196809[_0x68ba('0x2e')]=_[_0x68ba('0x30')](db['JscriptyProject'][_0x68ba('0x44')]);_0x196809[_0x68ba('0x2f')]=_[_0x68ba('0x30')](_0x1d769d[_0x68ba('0x2f')]);_0x196809[_0x68ba('0x37')]=_[_0x68ba('0x31')](_0x196809[_0x68ba('0x2e')],_0x196809[_0x68ba('0x2f')]);_0x13c0b1['attributes']=_[_0x68ba('0x31')](_0x196809['model'],qs[_0x68ba('0x33')](_0x1d769d[_0x68ba('0x2f')][_0x68ba('0x33')]));_0x13c0b1['attributes']=_0x13c0b1[_0x68ba('0x32')][_0x68ba('0x45')]?_0x13c0b1[_0x68ba('0x32')]:_0x196809[_0x68ba('0x2e')];if(_0x1d769d['query']['includeAll']){_0x13c0b1[_0x68ba('0x3e')]=[{'all':!![]}];}_0x13c0b1=_[_0x68ba('0x39')]({},_0x13c0b1,_0x1d769d[_0x68ba('0x46')]);return db[_0x68ba('0x2c')]['find'](_0x13c0b1)[_0x68ba('0x26')](handleEntityNotFound(_0x5acabb,null))[_0x68ba('0x26')](respondWithResult(_0x5acabb,null))[_0x68ba('0x41')](handleError(_0x5acabb,null));};exports[_0x68ba('0x47')]=function(_0x388ff2,_0x223f53){return db[_0x68ba('0x2c')][_0x68ba('0x47')](_0x388ff2[_0x68ba('0x48')],{})[_0x68ba('0x26')](function(_0x4657ce){var _0x113fb9=_0x388ff2['user'][_0x68ba('0x24')]({'plain':!![]});if(!_0x113fb9)throw new Error(_0x68ba('0x49'));if(_0x113fb9[_0x68ba('0x4a')]===_0x68ba('0x4b')){var _0x158732=_0x4657ce[_0x68ba('0x24')]({'plain':!![]});var _0x551bb1=_0x68ba('0x4c');return db['UserProfileSection'][_0x68ba('0x4d')]({'where':{'name':_0x551bb1,'userProfileId':_0x113fb9[_0x68ba('0x4e')]},'raw':!![]})[_0x68ba('0x26')](function(_0x296f76){if(_0x296f76&&_0x296f76[_0x68ba('0x4f')]===0x0){return db[_0x68ba('0x25')]['create']({'name':_0x158732[_0x68ba('0x29')],'resourceId':_0x158732['id'],'type':_0x296f76[_0x68ba('0x29')],'sectionId':_0x296f76['id']},{})['then'](function(){return _0x4657ce;});}else{return _0x4657ce;}})['catch'](function(_0x375f98){logger[_0x68ba('0x27')](_0x68ba('0x50'),_0x375f98);throw _0x375f98;});}return _0x4657ce;})['then'](respondWithResult(_0x223f53,0xc9))['catch'](handleError(_0x223f53,null));};exports[_0x68ba('0x51')]=function(_0x16672a,_0x77a44){var _0x407305={'where':{'id':_0x16672a[_0x68ba('0x43')]['id']}},_0x46b6ba={};_0x46b6ba['model']=_['keys'](db[_0x68ba('0x2c')][_0x68ba('0x44')]);_0x407305['attributes']=_[_0x68ba('0x31')](_0x46b6ba[_0x68ba('0x2e')],qs[_0x68ba('0x33')](_0x16672a['query'][_0x68ba('0x33')]));_0x407305['attributes']=_0x407305[_0x68ba('0x32')][_0x68ba('0x45')]?_0x407305[_0x68ba('0x32')]:_0x46b6ba['model'];if(_0x16672a[_0x68ba('0x2f')][_0x68ba('0x3d')]){_0x407305[_0x68ba('0x3e')]=[{'all':!![]}];}_0x407305=_[_0x68ba('0x39')]({},_0x407305,_0x16672a['options']);return db[_0x68ba('0x2c')][_0x68ba('0x4d')](_0x407305)[_0x68ba('0x26')](handleEntityNotFound(_0x77a44,null))[_0x68ba('0x26')](function(_0x2d47a7){if(_0x2d47a7){var _0x463152=_0x2d47a7[_0x68ba('0x24')]({'plain':!![]});_0x463152=qs[_0x68ba('0x52')](_0x463152,['id',_0x68ba('0x53'),'updatedAt']);_0x16672a[_0x68ba('0x48')]=_[_0x68ba('0x52')](_0x16672a[_0x68ba('0x48')],['id',_0x68ba('0x53'),_0x68ba('0x54')]);return db[_0x68ba('0x2c')][_0x68ba('0x47')](_[_0x68ba('0x39')](_0x463152,_0x16672a[_0x68ba('0x48')]),{'include':_0x16672a[_0x68ba('0x2f')][_0x68ba('0x3d')]?[{'all':!![]}]:undefined})[_0x68ba('0x26')](function(_0x4367d1){var _0x192551=_0x16672a[_0x68ba('0x4b')][_0x68ba('0x24')]({'plain':!![]});if(!_0x192551)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x192551[_0x68ba('0x4a')]==='user'){var _0x573a76=_0x4367d1[_0x68ba('0x24')]({'plain':!![]});var _0x5c2c5b=_0x68ba('0x4c');return db[_0x68ba('0x55')][_0x68ba('0x4d')]({'where':{'name':_0x5c2c5b,'userProfileId':_0x192551[_0x68ba('0x4e')]},'raw':!![]})['then'](function(_0x2dfaaf){if(_0x2dfaaf&&_0x2dfaaf[_0x68ba('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x573a76['name'],'resourceId':_0x573a76['id'],'type':_0x2dfaaf[_0x68ba('0x29')],'sectionId':_0x2dfaaf['id']},{})[_0x68ba('0x26')](function(){return _0x4367d1;});}else{return _0x4367d1;}})[_0x68ba('0x41')](function(_0x29f774){logger[_0x68ba('0x27')](_0x68ba('0x50'),_0x29f774);throw _0x29f774;});}return _0x4367d1;});}})[_0x68ba('0x26')](respondWithResult(_0x77a44,0xc9))[_0x68ba('0x41')](handleError(_0x77a44,null));};exports[_0x68ba('0x56')]=function(_0x1ddf6e,_0x56fa08){if(_0x1ddf6e[_0x68ba('0x48')]['id']){delete _0x1ddf6e[_0x68ba('0x48')]['id'];}return db[_0x68ba('0x2c')]['find']({'where':{'id':_0x1ddf6e[_0x68ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x56fa08,null))[_0x68ba('0x26')](saveUpdates(_0x1ddf6e[_0x68ba('0x48')],null))[_0x68ba('0x26')](respondWithResult(_0x56fa08,null))['catch'](handleError(_0x56fa08,null));};exports[_0x68ba('0x57')]=function(_0x4b68fe,_0x35cd5c){return db['JscriptyProject']['find']({'where':{'id':_0x4b68fe[_0x68ba('0x43')]['id']}})[_0x68ba('0x26')](handleEntityNotFound(_0x35cd5c,null))[_0x68ba('0x26')](removeEntity(_0x35cd5c,null))[_0x68ba('0x41')](handleError(_0x35cd5c,null));};exports['getSessions']=function(_0x59356d,_0x31b09d,_0x181d58){var _0x1b4fb2={'raw':!![],'where':{}};var _0x37c8cd={};var _0x5d6330={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x68ba('0x58')]({'where':{'id':_0x59356d[_0x68ba('0x43')]['id']}})[_0x68ba('0x26')](handleEntityNotFound(_0x31b09d,null))[_0x68ba('0x26')](function(_0x5d2443){if(_0x5d2443){_0x37c8cd[_0x68ba('0x2e')]=_[_0x68ba('0x30')](db[_0x68ba('0x59')][_0x68ba('0x44')]);_0x37c8cd[_0x68ba('0x2f')]=_['keys'](_0x59356d['query']);_0x37c8cd[_0x68ba('0x37')]=_[_0x68ba('0x31')](_0x37c8cd[_0x68ba('0x2e')],_0x37c8cd[_0x68ba('0x2f')]);_0x1b4fb2['attributes']=_[_0x68ba('0x31')](_0x37c8cd['model'],qs[_0x68ba('0x33')](_0x59356d['query'][_0x68ba('0x33')]));_0x1b4fb2[_0x68ba('0x32')]=_0x1b4fb2['attributes'][_0x68ba('0x45')]?_0x1b4fb2[_0x68ba('0x32')]:_0x37c8cd['model'];if(!_0x59356d[_0x68ba('0x2f')]['hasOwnProperty']('nolimit')){_0x1b4fb2[_0x68ba('0x1d')]=qs['limit'](_0x59356d[_0x68ba('0x2f')][_0x68ba('0x1d')]);_0x1b4fb2[_0x68ba('0x1c')]=qs[_0x68ba('0x1c')](_0x59356d[_0x68ba('0x2f')]['offset']);}_0x1b4fb2[_0x68ba('0x34')]=qs['sort'](_0x59356d[_0x68ba('0x2f')][_0x68ba('0x35')]);_0x1b4fb2[_0x68ba('0x36')]=qs[_0x68ba('0x37')](_[_0x68ba('0x38')](_0x59356d['query'],_0x37c8cd[_0x68ba('0x37')]));_0x1b4fb2[_0x68ba('0x36')]['ProjectId']=_0x5d2443['id'];if(_0x59356d[_0x68ba('0x2f')][_0x68ba('0x3c')]){_0x1b4fb2[_0x68ba('0x36')]=_[_0x68ba('0x39')](_0x1b4fb2['where'],{'$or':_[_0x68ba('0x2b')](_0x1b4fb2[_0x68ba('0x32')],function(_0x2c9907){var _0x4779b2={};_0x4779b2[_0x2c9907]={'$like':'%'+_0x59356d[_0x68ba('0x2f')]['filter']+'%'};return _0x4779b2;})});}_0x1b4fb2=_[_0x68ba('0x39')]({},_0x1b4fb2,_0x59356d[_0x68ba('0x46')]);return db[_0x68ba('0x59')][_0x68ba('0x1f')]({'where':_0x1b4fb2[_0x68ba('0x36')]})['then'](function(_0x4df5c3){_0x5d6330[_0x68ba('0x1f')]=_0x4df5c3;if(_0x59356d[_0x68ba('0x2f')][_0x68ba('0x3d')]){_0x1b4fb2['include']=[{'all':!![]}];}return db[_0x68ba('0x59')]['findAll'](_0x1b4fb2);})[_0x68ba('0x26')](function(_0x355be6){_0x5d6330['rows']=_0x355be6;return _0x5d6330;});}})['then'](respondWithFilteredResult(_0x31b09d,_0x1b4fb2))[_0x68ba('0x41')](handleError(_0x31b09d,null));};exports[_0x68ba('0x5a')]=function(_0x52995a,_0x1e62c7,_0x3727ed){var _0x516a00={'raw':!![],'where':{}};var _0x38082f={};var _0x56dfd={'count':0x0,'rows':[]};return db[_0x68ba('0x2c')][_0x68ba('0x58')]({'where':{'id':_0x52995a[_0x68ba('0x43')]['id']}})[_0x68ba('0x26')](handleEntityNotFound(_0x1e62c7,null))[_0x68ba('0x26')](function(_0x4c467b){if(_0x4c467b){_0x38082f[_0x68ba('0x2e')]=_['keys'](db[_0x68ba('0x5b')][_0x68ba('0x44')]);_0x38082f[_0x68ba('0x2f')]=_[_0x68ba('0x30')](_0x52995a[_0x68ba('0x2f')]);_0x38082f[_0x68ba('0x37')]=_['intersection'](_0x38082f[_0x68ba('0x2e')],_0x38082f[_0x68ba('0x2f')]);_0x516a00['attributes']=_['intersection'](_0x38082f[_0x68ba('0x2e')],qs[_0x68ba('0x33')](_0x52995a[_0x68ba('0x2f')]['fields']));_0x516a00[_0x68ba('0x32')]=_0x516a00['attributes']['length']?_0x516a00[_0x68ba('0x32')]:_0x38082f[_0x68ba('0x2e')];if(!_0x52995a[_0x68ba('0x2f')]['hasOwnProperty'](_0x68ba('0x5c'))){_0x516a00[_0x68ba('0x1d')]=qs[_0x68ba('0x1d')](_0x52995a[_0x68ba('0x2f')]['limit']);_0x516a00[_0x68ba('0x1c')]=qs[_0x68ba('0x1c')](_0x52995a['query'][_0x68ba('0x1c')]);}_0x516a00[_0x68ba('0x34')]=qs[_0x68ba('0x35')](_0x52995a[_0x68ba('0x2f')][_0x68ba('0x35')]);_0x516a00[_0x68ba('0x36')]=qs[_0x68ba('0x37')](_[_0x68ba('0x38')](_0x52995a[_0x68ba('0x2f')],_0x38082f[_0x68ba('0x37')]));_0x516a00['where'][_0x68ba('0x5d')]=_0x4c467b['id'];if(_0x52995a[_0x68ba('0x2f')][_0x68ba('0x3c')]){_0x516a00['where']=_[_0x68ba('0x39')](_0x516a00[_0x68ba('0x36')],{'$or':_[_0x68ba('0x2b')](_0x516a00[_0x68ba('0x32')],function(_0x38ea80){var _0x11d397={};_0x11d397[_0x38ea80]={'$like':'%'+_0x52995a[_0x68ba('0x2f')][_0x68ba('0x3c')]+'%'};return _0x11d397;})});}_0x516a00=_[_0x68ba('0x39')]({},_0x516a00,_0x52995a[_0x68ba('0x46')]);return db[_0x68ba('0x5b')][_0x68ba('0x1f')]({'where':_0x516a00[_0x68ba('0x36')]})[_0x68ba('0x26')](function(_0x549e38){_0x56dfd[_0x68ba('0x1f')]=_0x549e38;if(_0x52995a['query']['includeAll']){_0x516a00['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x68ba('0x3f')](_0x516a00);})[_0x68ba('0x26')](function(_0x40faea){_0x56dfd[_0x68ba('0x40')]=_0x40faea;return _0x56dfd;});}})['then'](respondWithFilteredResult(_0x1e62c7,_0x516a00))[_0x68ba('0x41')](handleError(_0x1e62c7,null));};function char(_0x52c872){return _0x68ba('0x5e')===typeof _0x52c872?String[_0x68ba('0x5f')][_0x68ba('0x60')](null,arguments):_0x52c872;}function needsEncapsulation(_0x50981d){return!!_0x50981d&&(_0x50981d[_0x68ba('0x61')]()[_0x68ba('0x62')](char(0xd))>=0x0||_0x50981d[_0x68ba('0x61')]()[_0x68ba('0x62')](char(0xa))>=0x0||_0x50981d[_0x68ba('0x61')]()[_0x68ba('0x62')](char(0x2c))>=0x0||_0x50981d[_0x68ba('0x61')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x521e0a){var _0x677967=char(0x22),_0x2a02f5='\x5c'+char(0x22),_0x24a4ac=_0x521e0a[_0x68ba('0x61')]()[_0x68ba('0x63')](new RegExp(_0x677967,'g'),_0x2a02f5);return _0x677967+_0x24a4ac+_0x677967;}exports['getSummary']=function(_0x4e101f,_0x23d442,_0x5cbb8c){var _0x1f6aa8,_0x1a69a2;var _0x47ea47={'where':{'ProjectId':_0x4e101f[_0x68ba('0x43')]['id']}};if(_0x4e101f[_0x68ba('0x2f')][_0x68ba('0x64')]){_0x47ea47[_0x68ba('0x36')][_0x68ba('0x65')]=JSON[_0x68ba('0x66')](_0x4e101f[_0x68ba('0x2f')][_0x68ba('0x64')]);}return db['JscriptySessionReport'][_0x68ba('0x3f')](_0x47ea47)['then'](handleEntityNotFound(_0x23d442,null))[_0x68ba('0x26')](function(_0x5b4981){if(_0x5b4981){_0x1f6aa8=_0x5b4981;return db['JscriptyQuestionReport'][_0x68ba('0x3f')]({'where':{'SessionId':{'$in':_[_0x68ba('0x2b')](_0x1f6aa8,'id')},'ProjectId':_0x4e101f[_0x68ba('0x43')]['id']},'order':'-createdAt'});}})[_0x68ba('0x26')](handleEntityNotFound(_0x23d442,null))[_0x68ba('0x26')](function(_0x1d7413){if(_0x1d7413){_0x1a69a2=_0x1d7413;var _0x556349={};for(var _0xe549b1=0x0,_0x8072=_0x1a69a2['length'];_0xe549b1<_0x8072;_0xe549b1++){if(!_0x556349[_0x68ba('0x67')](_0x1a69a2[_0xe549b1][_0x68ba('0x68')])){_0x556349[_0x1a69a2[_0xe549b1][_0x68ba('0x68')]]=needsEncapsulation(_0x1a69a2[_0xe549b1]['question'])?encapsulate(_0x1a69a2[_0xe549b1][_0x68ba('0x69')]):_0x1a69a2[_0xe549b1]['question'];}}var _0x74bb6d=[],_0x41f316={};for(var _0x43d01b=0x0,_0x12351b=_0x1f6aa8['length'];_0x43d01b<_0x12351b;_0x43d01b++){_0x41f316={'ProjectId':_0x4e101f['params']['id'],'SessionId':_0x1f6aa8[_0x43d01b]['id'],'StartTime':moment(_0x1f6aa8[_0x43d01b][_0x68ba('0x65')])[_0x68ba('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x176cb9=0x0,_0x519d84=_0x1a69a2[_0x68ba('0x45')];_0x176cb9<_0x519d84;_0x176cb9++){if(_0x1a69a2[_0x176cb9][_0x68ba('0x6b')]==_0x1f6aa8[_0x43d01b]['id']&&_0x556349[_0x68ba('0x67')](_0x1a69a2[_0x176cb9][_0x68ba('0x68')])){_0x41f316[_0x556349[_0x1a69a2[_0x176cb9][_0x68ba('0x68')]]]=_0x1a69a2[_0x176cb9]['answer'];}}for(var _0x2f33d6 in _0x556349){if(!_0x41f316[_0x68ba('0x67')](_0x556349[_0x2f33d6])){_0x41f316[_0x556349[_0x2f33d6]]=null;}}_0x74bb6d[_0x68ba('0x6c')](_0x41f316);}return _0x74bb6d;}})['then'](function(_0x3725b3){if(!_['isEmpty'](_0x3725b3)){var _0x24c995=toCsv(_0x3725b3);var _0x405f63=Date[_0x68ba('0x6d')]();fs[_0x68ba('0x6e')](util[_0x68ba('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4e101f['params']['id'],_0x405f63),_0x24c995);_0x23d442['setHeader'](_0x68ba('0x6f'),_0x68ba('0x70')+util[_0x68ba('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x4e101f[_0x68ba('0x43')]['id'],_0x405f63));_0x23d442['setHeader'](_0x68ba('0x71'),'text/csv');return _0x23d442[_0x68ba('0x72')](util[_0x68ba('0x6a')](_0x68ba('0x73'),_0x4e101f['params']['id'],_0x405f63));}else{return _0x23d442[_0x68ba('0x19')](0xcc);}})['catch'](handleError(_0x23d442,null));}; \ No newline at end of file +var _0xfbe6=['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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','end','error','name','send','index','map','JscriptyProject','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','getSessions','hasOwnProperty','nolimit','pick','ProjectId','JscriptySessionReport','findAll','getAnswers','findOne','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','answer','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xfbe6,0x6d));var _0x6fbe=function(_0x29ccaf,_0x2f2df3){_0x29ccaf=_0x29ccaf-0x0;var _0x2b0431=_0xfbe6[_0x29ccaf];return _0x2b0431;};'use strict';var emlformat=require(_0x6fbe('0x0'));var rimraf=require(_0x6fbe('0x1'));var zipdir=require(_0x6fbe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fbe('0x3'));var moment=require(_0x6fbe('0x4'));var BPromise=require(_0x6fbe('0x5'));var Mustache=require(_0x6fbe('0x6'));var util=require(_0x6fbe('0x7'));var path=require(_0x6fbe('0x8'));var sox=require(_0x6fbe('0x9'));var csv=require(_0x6fbe('0xa'));var ejs=require(_0x6fbe('0xb'));var fs=require('fs');var fs_extra=require(_0x6fbe('0xc'));var _=require('lodash');var squel=require(_0x6fbe('0xd'));var crypto=require(_0x6fbe('0xe'));var jsforce=require(_0x6fbe('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6fbe('0xa'));var querystring=require(_0x6fbe('0x10'));var Papa=require(_0x6fbe('0x11'));var Redis=require(_0x6fbe('0x12'));var authService=require(_0x6fbe('0x13'));var qs=require(_0x6fbe('0x14'));var as=require(_0x6fbe('0x15'));var hardwareService=require(_0x6fbe('0x16'));var logger=require(_0x6fbe('0x17'))(_0x6fbe('0x18'));var utils=require('../../config/utils');var config=require(_0x6fbe('0x19'));var licenseUtil=require(_0x6fbe('0x1a'));var db=require(_0x6fbe('0x1b'))['db'];function respondWithStatusCode(_0x39f554,_0x35bf5a){_0x35bf5a=_0x35bf5a||0xcc;return function(_0xf5fb06){if(_0xf5fb06){return _0x39f554[_0x6fbe('0x1c')](_0x35bf5a);}return _0x39f554[_0x6fbe('0x1d')](_0x35bf5a)['end']();};}function respondWithResult(_0x505b89,_0xf2faf5){_0xf2faf5=_0xf2faf5||0xc8;return function(_0x1903b8){if(_0x1903b8){return _0x505b89[_0x6fbe('0x1d')](_0xf2faf5)['json'](_0x1903b8);}};}function respondWithFilteredResult(_0x1e9602,_0xb5bec3){return function(_0x40340e){if(_0x40340e){var _0x182481=typeof _0xb5bec3[_0x6fbe('0x1e')]===_0x6fbe('0x1f')&&typeof _0xb5bec3[_0x6fbe('0x20')]===_0x6fbe('0x1f');var _0x5d9b0d=_0x40340e[_0x6fbe('0x21')];var _0x10c435=_0x182481?0x0:_0xb5bec3[_0x6fbe('0x1e')];var _0x19ff83=_0x182481?_0x40340e[_0x6fbe('0x21')]:_0xb5bec3[_0x6fbe('0x1e')]+_0xb5bec3['limit'];var _0x13e3de;if(_0x19ff83>=_0x5d9b0d){_0x19ff83=_0x5d9b0d;_0x13e3de=0xc8;}else{_0x13e3de=0xce;}_0x1e9602[_0x6fbe('0x1d')](_0x13e3de);return _0x1e9602[_0x6fbe('0x22')](_0x6fbe('0x23'),_0x10c435+'-'+_0x19ff83+'/'+_0x5d9b0d)[_0x6fbe('0x24')](_0x40340e);}return null;};}function patchUpdates(_0x4155f4){return function(_0x4d7997){try{jsonpatch[_0x6fbe('0x25')](_0x4d7997,_0x4155f4,!![]);}catch(_0x4040c0){return BPromise[_0x6fbe('0x26')](_0x4040c0);}return _0x4d7997[_0x6fbe('0x27')]();};}function saveUpdates(_0x26999c,_0x34b675){return function(_0x1e144e){if(_0x1e144e){return _0x1e144e[_0x6fbe('0x28')](_0x26999c)[_0x6fbe('0x29')](function(_0x1e38df){return _0x1e38df;});}return null;};}function removeEntity(_0x591549,_0xc4ef33){return function(_0x2038b2){if(_0x2038b2){return _0x2038b2[_0x6fbe('0x2a')]()[_0x6fbe('0x29')](function(){var _0x48530d=_0x2038b2[_0x6fbe('0x2b')]({'plain':!![]});var _0x137cc4=_0x6fbe('0x2c');return db[_0x6fbe('0x2d')]['destroy']({'where':{'type':_0x137cc4,'resourceId':_0x48530d['id']}})[_0x6fbe('0x29')](function(){return _0x2038b2;});})['then'](function(){_0x591549[_0x6fbe('0x1d')](0xcc)[_0x6fbe('0x2e')]();});}};}function handleEntityNotFound(_0x171b76,_0x34df8e){return function(_0x1d6c7b){if(!_0x1d6c7b){_0x171b76['sendStatus'](0x194);}return _0x1d6c7b;};}function handleError(_0x198ddb,_0x51409c){_0x51409c=_0x51409c||0x1f4;return function(_0x102555){logger[_0x6fbe('0x2f')](_0x102555['stack']);if(_0x102555[_0x6fbe('0x30')]){delete _0x102555[_0x6fbe('0x30')];}_0x198ddb[_0x6fbe('0x1d')](_0x51409c)[_0x6fbe('0x31')](_0x102555);};}exports[_0x6fbe('0x32')]=function(_0x4399ab,_0x292573){var _0xad7051={},_0x191e46={},_0x3675ec={'count':0x0,'rows':[]};var _0x429913=_[_0x6fbe('0x33')](db[_0x6fbe('0x34')]['rawAttributes'],function(_0x31bbfa){return{'name':_0x31bbfa[_0x6fbe('0x35')],'type':_0x31bbfa[_0x6fbe('0x36')][_0x6fbe('0x37')]};});_0x191e46[_0x6fbe('0x38')]=_['map'](_0x429913,_0x6fbe('0x30'));_0x191e46[_0x6fbe('0x39')]=_[_0x6fbe('0x3a')](_0x4399ab[_0x6fbe('0x39')]);_0x191e46[_0x6fbe('0x3b')]=_[_0x6fbe('0x3c')](_0x191e46[_0x6fbe('0x38')],_0x191e46['query']);_0xad7051[_0x6fbe('0x3d')]=_[_0x6fbe('0x3c')](_0x191e46[_0x6fbe('0x38')],qs[_0x6fbe('0x3e')](_0x4399ab[_0x6fbe('0x39')][_0x6fbe('0x3e')]));_0xad7051[_0x6fbe('0x3d')]=_0xad7051[_0x6fbe('0x3d')][_0x6fbe('0x3f')]?_0xad7051[_0x6fbe('0x3d')]:_0x191e46[_0x6fbe('0x38')];if(!_0x4399ab[_0x6fbe('0x39')]['hasOwnProperty']('nolimit')){_0xad7051['limit']=qs[_0x6fbe('0x20')](_0x4399ab['query']['limit']);_0xad7051[_0x6fbe('0x1e')]=qs[_0x6fbe('0x1e')](_0x4399ab[_0x6fbe('0x39')]['offset']);}_0xad7051[_0x6fbe('0x40')]=qs['sort'](_0x4399ab['query'][_0x6fbe('0x41')]);_0xad7051[_0x6fbe('0x42')]=qs[_0x6fbe('0x3b')](_['pick'](_0x4399ab[_0x6fbe('0x39')],_0x191e46[_0x6fbe('0x3b')]),_0x429913);if(_0x4399ab[_0x6fbe('0x39')]['filter']){_0xad7051[_0x6fbe('0x42')]=_[_0x6fbe('0x43')](_0xad7051[_0x6fbe('0x42')],{'$or':_['map'](_0x429913,function(_0x595f84){if(_0x595f84[_0x6fbe('0x36')]!==_0x6fbe('0x44')){var _0x4577fa={};_0x4577fa[_0x595f84[_0x6fbe('0x30')]]={'$like':'%'+_0x4399ab['query'][_0x6fbe('0x45')]+'%'};return _0x4577fa;}})});}_0xad7051=_[_0x6fbe('0x43')]({},_0xad7051,_0x4399ab[_0x6fbe('0x46')]);var _0x35858e={'where':_0xad7051[_0x6fbe('0x42')]};return db['JscriptyProject'][_0x6fbe('0x21')](_0x35858e)[_0x6fbe('0x29')](function(_0x3f1b5b){_0x3675ec[_0x6fbe('0x21')]=_0x3f1b5b;if(_0x4399ab[_0x6fbe('0x39')][_0x6fbe('0x47')]){_0xad7051[_0x6fbe('0x48')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0xad7051);})['then'](function(_0x37e5c1){_0x3675ec[_0x6fbe('0x49')]=_0x37e5c1;return _0x3675ec;})[_0x6fbe('0x29')](respondWithFilteredResult(_0x292573,_0xad7051))[_0x6fbe('0x4a')](handleError(_0x292573,null));};exports[_0x6fbe('0x4b')]=function(_0x2d087f,_0x2c39e2){var _0x490e97={'raw':![],'where':{'id':_0x2d087f[_0x6fbe('0x4c')]['id']}},_0x9206e5={};_0x9206e5[_0x6fbe('0x38')]=_[_0x6fbe('0x3a')](db[_0x6fbe('0x34')][_0x6fbe('0x4d')]);_0x9206e5[_0x6fbe('0x39')]=_['keys'](_0x2d087f[_0x6fbe('0x39')]);_0x9206e5[_0x6fbe('0x3b')]=_[_0x6fbe('0x3c')](_0x9206e5[_0x6fbe('0x38')],_0x9206e5[_0x6fbe('0x39')]);_0x490e97[_0x6fbe('0x3d')]=_[_0x6fbe('0x3c')](_0x9206e5[_0x6fbe('0x38')],qs['fields'](_0x2d087f['query'][_0x6fbe('0x3e')]));_0x490e97['attributes']=_0x490e97[_0x6fbe('0x3d')][_0x6fbe('0x3f')]?_0x490e97[_0x6fbe('0x3d')]:_0x9206e5[_0x6fbe('0x38')];if(_0x2d087f[_0x6fbe('0x39')][_0x6fbe('0x47')]){_0x490e97['include']=[{'all':!![]}];}_0x490e97=_[_0x6fbe('0x43')]({},_0x490e97,_0x2d087f[_0x6fbe('0x46')]);return db[_0x6fbe('0x34')][_0x6fbe('0x4e')](_0x490e97)['then'](handleEntityNotFound(_0x2c39e2,null))[_0x6fbe('0x29')](respondWithResult(_0x2c39e2,null))['catch'](handleError(_0x2c39e2,null));};exports[_0x6fbe('0x4f')]=function(_0x30687d,_0x24772){return db[_0x6fbe('0x34')][_0x6fbe('0x4f')](_0x30687d[_0x6fbe('0x50')],{})['then'](function(_0x46058c){var _0x37190a=_0x30687d[_0x6fbe('0x51')]['get']({'plain':!![]});if(!_0x37190a)throw new Error(_0x6fbe('0x52'));if(_0x37190a[_0x6fbe('0x53')]===_0x6fbe('0x51')){var _0x4efa54=_0x46058c[_0x6fbe('0x2b')]({'plain':!![]});var _0x3c9f98=_0x6fbe('0x2c');return db[_0x6fbe('0x54')][_0x6fbe('0x4e')]({'where':{'name':_0x3c9f98,'userProfileId':_0x37190a['userProfileId']},'raw':!![]})[_0x6fbe('0x29')](function(_0x2f4951){if(_0x2f4951&&_0x2f4951[_0x6fbe('0x55')]===0x0){return db[_0x6fbe('0x2d')][_0x6fbe('0x4f')]({'name':_0x4efa54[_0x6fbe('0x30')],'resourceId':_0x4efa54['id'],'type':_0x2f4951['name'],'sectionId':_0x2f4951['id']},{})[_0x6fbe('0x29')](function(){return _0x46058c;});}else{return _0x46058c;}})[_0x6fbe('0x4a')](function(_0x591e34){logger[_0x6fbe('0x2f')](_0x6fbe('0x56'),_0x591e34);throw _0x591e34;});}return _0x46058c;})[_0x6fbe('0x29')](respondWithResult(_0x24772,0xc9))['catch'](handleError(_0x24772,null));};exports[_0x6fbe('0x57')]=function(_0x3e7e7d,_0x356d22){var _0x5b69a5={'where':{'id':_0x3e7e7d['params']['id']}},_0x2a2aa1={};_0x2a2aa1[_0x6fbe('0x38')]=_[_0x6fbe('0x3a')](db[_0x6fbe('0x34')]['rawAttributes']);_0x5b69a5[_0x6fbe('0x3d')]=_['intersection'](_0x2a2aa1[_0x6fbe('0x38')],qs[_0x6fbe('0x3e')](_0x3e7e7d[_0x6fbe('0x39')][_0x6fbe('0x3e')]));_0x5b69a5[_0x6fbe('0x3d')]=_0x5b69a5[_0x6fbe('0x3d')]['length']?_0x5b69a5[_0x6fbe('0x3d')]:_0x2a2aa1[_0x6fbe('0x38')];if(_0x3e7e7d['query'][_0x6fbe('0x47')]){_0x5b69a5[_0x6fbe('0x48')]=[{'all':!![]}];}_0x5b69a5=_[_0x6fbe('0x43')]({},_0x5b69a5,_0x3e7e7d['options']);return db[_0x6fbe('0x34')]['find'](_0x5b69a5)[_0x6fbe('0x29')](handleEntityNotFound(_0x356d22,null))['then'](function(_0x58fc47){if(_0x58fc47){var _0x30c349=_0x58fc47[_0x6fbe('0x2b')]({'plain':!![]});_0x30c349=qs[_0x6fbe('0x58')](_0x30c349,['id',_0x6fbe('0x59'),_0x6fbe('0x5a')]);_0x3e7e7d['body']=_[_0x6fbe('0x58')](_0x3e7e7d[_0x6fbe('0x50')],['id',_0x6fbe('0x59'),_0x6fbe('0x5a')]);return db[_0x6fbe('0x34')][_0x6fbe('0x4f')](_[_0x6fbe('0x43')](_0x30c349,_0x3e7e7d[_0x6fbe('0x50')]),{'include':_0x3e7e7d[_0x6fbe('0x39')][_0x6fbe('0x47')]?[{'all':!![]}]:undefined})[_0x6fbe('0x29')](function(_0x4d95ca){var _0x5302ca=_0x3e7e7d[_0x6fbe('0x51')][_0x6fbe('0x2b')]({'plain':!![]});if(!_0x5302ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5302ca[_0x6fbe('0x53')]===_0x6fbe('0x51')){var _0x4ab0c7=_0x4d95ca['get']({'plain':!![]});var _0x153ebe='Projects';return db[_0x6fbe('0x54')][_0x6fbe('0x4e')]({'where':{'name':_0x153ebe,'userProfileId':_0x5302ca[_0x6fbe('0x5b')]},'raw':!![]})[_0x6fbe('0x29')](function(_0xd5a1e6){if(_0xd5a1e6&&_0xd5a1e6['autoAssociation']===0x0){return db[_0x6fbe('0x2d')][_0x6fbe('0x4f')]({'name':_0x4ab0c7[_0x6fbe('0x30')],'resourceId':_0x4ab0c7['id'],'type':_0xd5a1e6['name'],'sectionId':_0xd5a1e6['id']},{})[_0x6fbe('0x29')](function(){return _0x4d95ca;});}else{return _0x4d95ca;}})[_0x6fbe('0x4a')](function(_0x578a5f){logger[_0x6fbe('0x2f')](_0x6fbe('0x56'),_0x578a5f);throw _0x578a5f;});}return _0x4d95ca;});}})[_0x6fbe('0x29')](respondWithResult(_0x356d22,0xc9))[_0x6fbe('0x4a')](handleError(_0x356d22,null));};exports[_0x6fbe('0x28')]=function(_0x1d7e4d,_0x1a627a){if(_0x1d7e4d[_0x6fbe('0x50')]['id']){delete _0x1d7e4d['body']['id'];}return db[_0x6fbe('0x34')][_0x6fbe('0x4e')]({'where':{'id':_0x1d7e4d['params']['id']}})['then'](handleEntityNotFound(_0x1a627a,null))[_0x6fbe('0x29')](saveUpdates(_0x1d7e4d[_0x6fbe('0x50')],null))[_0x6fbe('0x29')](respondWithResult(_0x1a627a,null))[_0x6fbe('0x4a')](handleError(_0x1a627a,null));};exports[_0x6fbe('0x2a')]=function(_0x30cd7f,_0x2e5a40){return db[_0x6fbe('0x34')][_0x6fbe('0x4e')]({'where':{'id':_0x30cd7f[_0x6fbe('0x4c')]['id']}})[_0x6fbe('0x29')](handleEntityNotFound(_0x2e5a40,null))['then'](removeEntity(_0x2e5a40,null))[_0x6fbe('0x4a')](handleError(_0x2e5a40,null));};exports[_0x6fbe('0x5c')]=function(_0x5ad533,_0x4a85d5,_0x3391fd){var _0x5d6345={'raw':!![],'where':{}};var _0x421026={};var _0x2737f9={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x5ad533['params']['id']}})[_0x6fbe('0x29')](handleEntityNotFound(_0x4a85d5,null))[_0x6fbe('0x29')](function(_0x232ffe){if(_0x232ffe){_0x421026[_0x6fbe('0x38')]=_['keys'](db['JscriptySessionReport'][_0x6fbe('0x4d')]);_0x421026[_0x6fbe('0x39')]=_[_0x6fbe('0x3a')](_0x5ad533[_0x6fbe('0x39')]);_0x421026[_0x6fbe('0x3b')]=_[_0x6fbe('0x3c')](_0x421026[_0x6fbe('0x38')],_0x421026[_0x6fbe('0x39')]);_0x5d6345[_0x6fbe('0x3d')]=_[_0x6fbe('0x3c')](_0x421026[_0x6fbe('0x38')],qs[_0x6fbe('0x3e')](_0x5ad533['query'][_0x6fbe('0x3e')]));_0x5d6345[_0x6fbe('0x3d')]=_0x5d6345['attributes']['length']?_0x5d6345[_0x6fbe('0x3d')]:_0x421026[_0x6fbe('0x38')];if(!_0x5ad533[_0x6fbe('0x39')][_0x6fbe('0x5d')](_0x6fbe('0x5e'))){_0x5d6345[_0x6fbe('0x20')]=qs['limit'](_0x5ad533[_0x6fbe('0x39')]['limit']);_0x5d6345[_0x6fbe('0x1e')]=qs[_0x6fbe('0x1e')](_0x5ad533[_0x6fbe('0x39')][_0x6fbe('0x1e')]);}_0x5d6345[_0x6fbe('0x40')]=qs['sort'](_0x5ad533[_0x6fbe('0x39')][_0x6fbe('0x41')]);_0x5d6345[_0x6fbe('0x42')]=qs[_0x6fbe('0x3b')](_[_0x6fbe('0x5f')](_0x5ad533[_0x6fbe('0x39')],_0x421026[_0x6fbe('0x3b')]));_0x5d6345[_0x6fbe('0x42')][_0x6fbe('0x60')]=_0x232ffe['id'];if(_0x5ad533['query'][_0x6fbe('0x45')]){_0x5d6345[_0x6fbe('0x42')]=_[_0x6fbe('0x43')](_0x5d6345[_0x6fbe('0x42')],{'$or':_[_0x6fbe('0x33')](_0x5d6345[_0x6fbe('0x3d')],function(_0x55f5f3){var _0x4af884={};_0x4af884[_0x55f5f3]={'$like':'%'+_0x5ad533[_0x6fbe('0x39')][_0x6fbe('0x45')]+'%'};return _0x4af884;})});}_0x5d6345=_[_0x6fbe('0x43')]({},_0x5d6345,_0x5ad533['options']);return db[_0x6fbe('0x61')]['count']({'where':_0x5d6345[_0x6fbe('0x42')]})[_0x6fbe('0x29')](function(_0x1ab017){_0x2737f9['count']=_0x1ab017;if(_0x5ad533[_0x6fbe('0x39')][_0x6fbe('0x47')]){_0x5d6345[_0x6fbe('0x48')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x6fbe('0x62')](_0x5d6345);})['then'](function(_0x19cdd0){_0x2737f9[_0x6fbe('0x49')]=_0x19cdd0;return _0x2737f9;});}})[_0x6fbe('0x29')](respondWithFilteredResult(_0x4a85d5,_0x5d6345))[_0x6fbe('0x4a')](handleError(_0x4a85d5,null));};exports[_0x6fbe('0x63')]=function(_0x2dd1d7,_0xcd8ed2,_0x4511d5){var _0x44c5f6={'raw':!![],'where':{}};var _0x288808={};var _0x1603dc={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x6fbe('0x64')]({'where':{'id':_0x2dd1d7[_0x6fbe('0x4c')]['id']}})[_0x6fbe('0x29')](handleEntityNotFound(_0xcd8ed2,null))[_0x6fbe('0x29')](function(_0x42b20a){if(_0x42b20a){_0x288808['model']=_['keys'](db[_0x6fbe('0x65')][_0x6fbe('0x4d')]);_0x288808[_0x6fbe('0x39')]=_[_0x6fbe('0x3a')](_0x2dd1d7[_0x6fbe('0x39')]);_0x288808[_0x6fbe('0x3b')]=_[_0x6fbe('0x3c')](_0x288808[_0x6fbe('0x38')],_0x288808[_0x6fbe('0x39')]);_0x44c5f6[_0x6fbe('0x3d')]=_[_0x6fbe('0x3c')](_0x288808[_0x6fbe('0x38')],qs[_0x6fbe('0x3e')](_0x2dd1d7[_0x6fbe('0x39')][_0x6fbe('0x3e')]));_0x44c5f6[_0x6fbe('0x3d')]=_0x44c5f6['attributes']['length']?_0x44c5f6[_0x6fbe('0x3d')]:_0x288808[_0x6fbe('0x38')];if(!_0x2dd1d7['query'][_0x6fbe('0x5d')](_0x6fbe('0x5e'))){_0x44c5f6[_0x6fbe('0x20')]=qs[_0x6fbe('0x20')](_0x2dd1d7['query'][_0x6fbe('0x20')]);_0x44c5f6[_0x6fbe('0x1e')]=qs[_0x6fbe('0x1e')](_0x2dd1d7[_0x6fbe('0x39')][_0x6fbe('0x1e')]);}_0x44c5f6[_0x6fbe('0x40')]=qs[_0x6fbe('0x41')](_0x2dd1d7[_0x6fbe('0x39')][_0x6fbe('0x41')]);_0x44c5f6[_0x6fbe('0x42')]=qs[_0x6fbe('0x3b')](_[_0x6fbe('0x5f')](_0x2dd1d7[_0x6fbe('0x39')],_0x288808[_0x6fbe('0x3b')]));_0x44c5f6['where']['ProjectId']=_0x42b20a['id'];if(_0x2dd1d7[_0x6fbe('0x39')]['filter']){_0x44c5f6[_0x6fbe('0x42')]=_['merge'](_0x44c5f6[_0x6fbe('0x42')],{'$or':_[_0x6fbe('0x33')](_0x44c5f6['attributes'],function(_0x302134){var _0x33d1ef={};_0x33d1ef[_0x302134]={'$like':'%'+_0x2dd1d7[_0x6fbe('0x39')][_0x6fbe('0x45')]+'%'};return _0x33d1ef;})});}_0x44c5f6=_[_0x6fbe('0x43')]({},_0x44c5f6,_0x2dd1d7['options']);return db[_0x6fbe('0x65')]['count']({'where':_0x44c5f6[_0x6fbe('0x42')]})[_0x6fbe('0x29')](function(_0x18dfa1){_0x1603dc[_0x6fbe('0x21')]=_0x18dfa1;if(_0x2dd1d7[_0x6fbe('0x39')][_0x6fbe('0x47')]){_0x44c5f6[_0x6fbe('0x48')]=[{'all':!![]}];}return db[_0x6fbe('0x65')][_0x6fbe('0x62')](_0x44c5f6);})[_0x6fbe('0x29')](function(_0x2882de){_0x1603dc[_0x6fbe('0x49')]=_0x2882de;return _0x1603dc;});}})[_0x6fbe('0x29')](respondWithFilteredResult(_0xcd8ed2,_0x44c5f6))['catch'](handleError(_0xcd8ed2,null));};function char(_0x1f6802){return _0x6fbe('0x66')===typeof _0x1f6802?String['fromCharCode'][_0x6fbe('0x25')](null,arguments):_0x1f6802;}function needsEncapsulation(_0x47fbfe){return!!_0x47fbfe&&(_0x47fbfe[_0x6fbe('0x67')]()['indexOf'](char(0xd))>=0x0||_0x47fbfe[_0x6fbe('0x67')]()[_0x6fbe('0x68')](char(0xa))>=0x0||_0x47fbfe['toString']()[_0x6fbe('0x68')](char(0x2c))>=0x0||_0x47fbfe[_0x6fbe('0x67')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x6cb79f){var _0x163730=char(0x22),_0x35fbdf='\x5c'+char(0x22),_0xcb5df9=_0x6cb79f[_0x6fbe('0x67')]()[_0x6fbe('0x69')](new RegExp(_0x163730,'g'),_0x35fbdf);return _0x163730+_0xcb5df9+_0x163730;}exports[_0x6fbe('0x6a')]=function(_0x17d849,_0x33b53e,_0x3435b0){var _0x45195b,_0x10053f;var _0x5da04c={'where':{'ProjectId':_0x17d849[_0x6fbe('0x4c')]['id']}};if(_0x17d849[_0x6fbe('0x39')][_0x6fbe('0x6b')]){_0x5da04c[_0x6fbe('0x42')][_0x6fbe('0x6c')]=JSON[_0x6fbe('0x6d')](_0x17d849[_0x6fbe('0x39')]['startTime']);}return db[_0x6fbe('0x61')][_0x6fbe('0x62')](_0x5da04c)['then'](handleEntityNotFound(_0x33b53e,null))[_0x6fbe('0x29')](function(_0x4f5320){if(_0x4f5320){_0x45195b=_0x4f5320;return db[_0x6fbe('0x6e')][_0x6fbe('0x62')]({'where':{'SessionId':{'$in':_['map'](_0x45195b,'id')},'ProjectId':_0x17d849[_0x6fbe('0x4c')]['id']},'order':_0x6fbe('0x6f')});}})[_0x6fbe('0x29')](handleEntityNotFound(_0x33b53e,null))[_0x6fbe('0x29')](function(_0x4949b1){if(_0x4949b1){_0x10053f=_0x4949b1;var _0x11b49b={};for(var _0x5a1fcd=0x0,_0x1a0cd7=_0x10053f[_0x6fbe('0x3f')];_0x5a1fcd<_0x1a0cd7;_0x5a1fcd++){if(!_0x11b49b[_0x6fbe('0x5d')](_0x10053f[_0x5a1fcd]['questionId'])){_0x11b49b[_0x10053f[_0x5a1fcd]['questionId']]=needsEncapsulation(_0x10053f[_0x5a1fcd][_0x6fbe('0x70')])?encapsulate(_0x10053f[_0x5a1fcd]['question']):_0x10053f[_0x5a1fcd][_0x6fbe('0x70')];}}var _0x1df70c=[],_0x25e369={};for(var _0x96425e=0x0,_0x1c9c9c=_0x45195b[_0x6fbe('0x3f')];_0x96425e<_0x1c9c9c;_0x96425e++){_0x25e369={'ProjectId':_0x17d849[_0x6fbe('0x4c')]['id'],'SessionId':_0x45195b[_0x96425e]['id'],'StartTime':moment(_0x45195b[_0x96425e][_0x6fbe('0x6c')])[_0x6fbe('0x71')](_0x6fbe('0x72'))};for(var _0x41409c=0x0,_0x4fc0c3=_0x10053f[_0x6fbe('0x3f')];_0x41409c<_0x4fc0c3;_0x41409c++){if(_0x10053f[_0x41409c][_0x6fbe('0x73')]==_0x45195b[_0x96425e]['id']&&_0x11b49b['hasOwnProperty'](_0x10053f[_0x41409c][_0x6fbe('0x74')])){_0x25e369[_0x11b49b[_0x10053f[_0x41409c]['questionId']]]=_0x10053f[_0x41409c][_0x6fbe('0x75')];}}for(var _0x2c53de in _0x11b49b){if(!_0x25e369[_0x6fbe('0x5d')](_0x11b49b[_0x2c53de])){_0x25e369[_0x11b49b[_0x2c53de]]=null;}}_0x1df70c['push'](_0x25e369);}return _0x1df70c;}})[_0x6fbe('0x29')](function(_0x335b60){if(!_[_0x6fbe('0x76')](_0x335b60)){var _0x32f0ba=toCsv(_0x335b60);var _0x3c72b1=Date['now']();fs[_0x6fbe('0x77')](util['format'](_0x6fbe('0x78'),_0x17d849['params']['id'],_0x3c72b1),_0x32f0ba);_0x33b53e['setHeader'](_0x6fbe('0x79'),'attachment;\x20filename='+util[_0x6fbe('0x71')](_0x6fbe('0x7a'),_0x17d849[_0x6fbe('0x4c')]['id'],_0x3c72b1));_0x33b53e[_0x6fbe('0x7b')](_0x6fbe('0x7c'),_0x6fbe('0x7d'));return _0x33b53e['download'](util[_0x6fbe('0x71')](_0x6fbe('0x78'),_0x17d849[_0x6fbe('0x4c')]['id'],_0x3c72b1));}else{return _0x33b53e['sendStatus'](0xcc);}})['catch'](handleError(_0x33b53e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index a25c9ab..2ccd08b 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 _0x12e9=['exports','JscriptyProject','jscripty_projects','../../config/logger','moment','bluebird','path','rimraf','./jscriptyProject.attributes'];(function(_0x37d00a,_0x1d9605){var _0x1b2d9e=function(_0x52e66d){while(--_0x52e66d){_0x37d00a['push'](_0x37d00a['shift']());}};_0x1b2d9e(++_0x1d9605);}(_0x12e9,0x66));var _0x912e=function(_0x41d19d,_0x3b520d){_0x41d19d=_0x41d19d-0x0;var _0x41cb8d=_0x12e9[_0x41d19d];return _0x41cb8d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x912e('0x0'))('api');var moment=require(_0x912e('0x1'));var BPromise=require(_0x912e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x912e('0x3'));var rimraf=require(_0x912e('0x4'));var config=require('../../config/environment');var attributes=require(_0x912e('0x5'));module[_0x912e('0x6')]=function(_0x2a15be,_0x31622c){return _0x2a15be['define'](_0x912e('0x7'),attributes,{'tableName':_0x912e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5447=['jscripty_projects','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x5e230d,_0x57d428){var _0x55429a=function(_0x4c9f1e){while(--_0x4c9f1e){_0x5e230d['push'](_0x5e230d['shift']());}};_0x55429a(++_0x57d428);}(_0x5447,0xf1));var _0x7544=function(_0x146648,_0x5301e1){_0x146648=_0x146648-0x0;var _0x342eea=_0x5447[_0x146648];return _0x342eea;};'use strict';var _=require(_0x7544('0x0'));var util=require('util');var logger=require(_0x7544('0x1'))(_0x7544('0x2'));var moment=require('moment');var BPromise=require(_0x7544('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7544('0x4'));var rimraf=require(_0x7544('0x5'));var config=require(_0x7544('0x6'));var attributes=require(_0x7544('0x7'));module[_0x7544('0x8')]=function(_0x7e80,_0x3feef7){return _0x7e80[_0x7544('0x9')](_0x7544('0xa'),attributes,{'tableName':_0x7544('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index fc31b42..259fb78 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x41e0b2,_0x43fd3b){var _0x3209fe=function(_0x4823e6){while(--_0x4823e6){_0x41e0b2['push'](_0x41e0b2['shift']());}};_0x3209fe(++_0x43fd3b);}(_0x54ef,0x112));var _0xf54e=function(_0x2f3bc7,_0x51201c){_0x2f3bc7=_0x2f3bc7-0x0;var _0x10e94f=_0x54ef[_0x2f3bc7];return _0x10e94f;};'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});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ 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','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x2a0601,_0x23d9ef){var _0x53faec=function(_0x1c9e26){while(--_0x1c9e26){_0x2a0601['push'](_0x2a0601['shift']());}};_0x53faec(++_0x23d9ef);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'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']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\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')]('JscriptyProject,\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')]('JscriptyProject,\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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 034b829..e595abd 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 _0x2aa9=['get','index','/describe','isAuthenticated','/:id','post','put','update','delete','exports','util','path','connect-timeout','express','Router','../../config/environment','./jscriptyQuestionReport.controller'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x2aa9,0x109));var _0x92aa=function(_0x59dfb3,_0x52e38d){_0x59dfb3=_0x59dfb3-0x0;var _0x1bf4c1=_0x2aa9[_0x59dfb3];return _0x1bf4c1;};'use strict';var multer=require('multer');var util=require(_0x92aa('0x0'));var path=require(_0x92aa('0x1'));var timeout=require(_0x92aa('0x2'));var express=require(_0x92aa('0x3'));var router=express[_0x92aa('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x92aa('0x5'));var controller=require(_0x92aa('0x6'));router[_0x92aa('0x7')]('/',auth['isAuthenticated'](),controller[_0x92aa('0x8')]);router[_0x92aa('0x7')](_0x92aa('0x9'),auth[_0x92aa('0xa')](),controller['describe']);router[_0x92aa('0x7')](_0x92aa('0xb'),auth[_0x92aa('0xa')](),controller['show']);router[_0x92aa('0xc')]('/',auth[_0x92aa('0xa')](),controller['create']);router[_0x92aa('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x92aa('0xe')]);router[_0x92aa('0xf')](_0x92aa('0xb'),auth[_0x92aa('0xa')](),controller['destroy']);module[_0x92aa('0x10')]=router; \ No newline at end of file +var _0xcf79=['/describe','describe','/:id','show','post','create','put','update','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x28be0e,_0x448730){var _0x594e57=function(_0x56f890){while(--_0x56f890){_0x28be0e['push'](_0x28be0e['shift']());}};_0x594e57(++_0x448730);}(_0xcf79,0x1cc));var _0x9cf7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xcf79[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9cf7('0x0'));var timeout=require('connect-timeout');var express=require(_0x9cf7('0x1'));var router=express[_0x9cf7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9cf7('0x3'));var interaction=require(_0x9cf7('0x4'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x9cf7('0x5')](),controller[_0x9cf7('0x6')]);router[_0x9cf7('0x7')](_0x9cf7('0x8'),auth[_0x9cf7('0x5')](),controller[_0x9cf7('0x9')]);router[_0x9cf7('0x7')](_0x9cf7('0xa'),auth['isAuthenticated'](),controller[_0x9cf7('0xb')]);router[_0x9cf7('0xc')]('/',auth[_0x9cf7('0x5')](),controller[_0x9cf7('0xd')]);router[_0x9cf7('0xe')](_0x9cf7('0xa'),auth[_0x9cf7('0x5')](),controller[_0x9cf7('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9cf7('0x10')]);module[_0x9cf7('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index dd67edb..dfcda53 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x1a2b52,_0x156874){_0x1a2b52=_0x1a2b52-0x0;var _0x577f5f=_0x7a54[_0x1a2b52];return _0x577f5f;};'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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0x34b806,_0x521de9){_0x34b806=_0x34b806-0x0;var _0x511e8e=_0x7a54[_0x34b806];return _0x511e8e;};'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 27451ad..69fd6da 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 _0x653c=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','rows','catch','show','keys','includeAll','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x653c,0x1f4));var _0xc653=function(_0x1a4bcf,_0x447e0d){_0x1a4bcf=_0x1a4bcf-0x0;var _0x389476=_0x653c[_0x1a4bcf];return _0x389476;};'use strict';var emlformat=require(_0xc653('0x0'));var rimraf=require(_0xc653('0x1'));var zipdir=require(_0xc653('0x2'));var jsonpatch=require(_0xc653('0x3'));var rp=require(_0xc653('0x4'));var moment=require('moment');var BPromise=require(_0xc653('0x5'));var Mustache=require('mustache');var util=require(_0xc653('0x6'));var path=require(_0xc653('0x7'));var sox=require('sox');var csv=require(_0xc653('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc653('0x9'));var _=require(_0xc653('0xa'));var squel=require(_0xc653('0xb'));var crypto=require('crypto');var jsforce=require(_0xc653('0xc'));var deskjs=require(_0xc653('0xd'));var toCsv=require(_0xc653('0x8'));var querystring=require('querystring');var Papa=require(_0xc653('0xe'));var Redis=require(_0xc653('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc653('0x10'));var hardwareService=require(_0xc653('0x11'));var logger=require(_0xc653('0x12'))(_0xc653('0x13'));var utils=require(_0xc653('0x14'));var config=require(_0xc653('0x15'));var licenseUtil=require(_0xc653('0x16'));var db=require(_0xc653('0x17'))['db'];function respondWithStatusCode(_0x3ea0c7,_0x4db1ff){_0x4db1ff=_0x4db1ff||0xcc;return function(_0x501eba){if(_0x501eba){return _0x3ea0c7[_0xc653('0x18')](_0x4db1ff);}return _0x3ea0c7['status'](_0x4db1ff)[_0xc653('0x19')]();};}function respondWithResult(_0x484e7f,_0x354da1){_0x354da1=_0x354da1||0xc8;return function(_0x170da0){if(_0x170da0){return _0x484e7f[_0xc653('0x1a')](_0x354da1)['json'](_0x170da0);}};}function respondWithFilteredResult(_0x35a1ca,_0x40c54f){return function(_0xda584){if(_0xda584){var _0x5aac4a=typeof _0x40c54f[_0xc653('0x1b')]===_0xc653('0x1c')&&typeof _0x40c54f[_0xc653('0x1d')]===_0xc653('0x1c');var _0x153ebe=_0xda584[_0xc653('0x1e')];var _0x16ae25=_0x5aac4a?0x0:_0x40c54f[_0xc653('0x1b')];var _0x2ab893=_0x5aac4a?_0xda584[_0xc653('0x1e')]:_0x40c54f[_0xc653('0x1b')]+_0x40c54f['limit'];var _0x191c50;if(_0x2ab893>=_0x153ebe){_0x2ab893=_0x153ebe;_0x191c50=0xc8;}else{_0x191c50=0xce;}_0x35a1ca[_0xc653('0x1a')](_0x191c50);return _0x35a1ca[_0xc653('0x1f')](_0xc653('0x20'),_0x16ae25+'-'+_0x2ab893+'/'+_0x153ebe)['json'](_0xda584);}return null;};}function patchUpdates(_0x42c6e0){return function(_0x9eced7){try{jsonpatch[_0xc653('0x21')](_0x9eced7,_0x42c6e0,!![]);}catch(_0x5af6f8){return BPromise[_0xc653('0x22')](_0x5af6f8);}return _0x9eced7[_0xc653('0x23')]();};}function saveUpdates(_0x51df19,_0x30e50c){return function(_0x12e7e8){if(_0x12e7e8){return _0x12e7e8[_0xc653('0x24')](_0x51df19)[_0xc653('0x25')](function(_0x4a7753){return _0x4a7753;});}return null;};}function removeEntity(_0x79651c,_0x507188){return function(_0xc2fee8){if(_0xc2fee8){return _0xc2fee8[_0xc653('0x26')]()['then'](function(){_0x79651c[_0xc653('0x1a')](0xcc)[_0xc653('0x19')]();});}};}function handleEntityNotFound(_0x31a754,_0x29941f){return function(_0x352abe){if(!_0x352abe){_0x31a754[_0xc653('0x18')](0x194);}return _0x352abe;};}function handleError(_0x17569a,_0xeb4c1a){_0xeb4c1a=_0xeb4c1a||0x1f4;return function(_0x2a7583){logger[_0xc653('0x27')](_0x2a7583['stack']);if(_0x2a7583['name']){delete _0x2a7583[_0xc653('0x28')];}_0x17569a['status'](_0xeb4c1a)['send'](_0x2a7583);};}exports[_0xc653('0x29')]=function(_0x3e62b5,_0x10bea7){var _0x33bcd8={},_0x5d7ccc={},_0xf69c45={'count':0x0,'rows':[]};var _0x20372d=_['map'](db[_0xc653('0x2a')][_0xc653('0x2b')],function(_0x1b21bb){return{'name':_0x1b21bb[_0xc653('0x2c')],'type':_0x1b21bb[_0xc653('0x2d')][_0xc653('0x2e')]};});_0x5d7ccc[_0xc653('0x2f')]=_[_0xc653('0x30')](_0x20372d,'name');_0x5d7ccc[_0xc653('0x31')]=_['keys'](_0x3e62b5[_0xc653('0x31')]);_0x5d7ccc['filters']=_[_0xc653('0x32')](_0x5d7ccc[_0xc653('0x2f')],_0x5d7ccc[_0xc653('0x31')]);_0x33bcd8[_0xc653('0x33')]=_[_0xc653('0x32')](_0x5d7ccc[_0xc653('0x2f')],qs[_0xc653('0x34')](_0x3e62b5[_0xc653('0x31')][_0xc653('0x34')]));_0x33bcd8['attributes']=_0x33bcd8[_0xc653('0x33')][_0xc653('0x35')]?_0x33bcd8[_0xc653('0x33')]:_0x5d7ccc[_0xc653('0x2f')];if(!_0x3e62b5[_0xc653('0x31')][_0xc653('0x36')](_0xc653('0x37'))){_0x33bcd8[_0xc653('0x1d')]=qs[_0xc653('0x1d')](_0x3e62b5[_0xc653('0x31')][_0xc653('0x1d')]);_0x33bcd8[_0xc653('0x1b')]=qs['offset'](_0x3e62b5[_0xc653('0x31')][_0xc653('0x1b')]);}_0x33bcd8[_0xc653('0x38')]=qs['sort'](_0x3e62b5[_0xc653('0x31')][_0xc653('0x39')]);_0x33bcd8[_0xc653('0x3a')]=qs['filters'](_[_0xc653('0x3b')](_0x3e62b5[_0xc653('0x31')],_0x5d7ccc[_0xc653('0x3c')]),_0x20372d);if(_0x3e62b5['query'][_0xc653('0x3d')]){_0x33bcd8[_0xc653('0x3a')]=_['merge'](_0x33bcd8['where'],{'$or':_[_0xc653('0x30')](_0x20372d,function(_0xcb7f45){if(_0xcb7f45[_0xc653('0x2d')]!=='VIRTUAL'){var _0x2bda60={};_0x2bda60[_0xcb7f45[_0xc653('0x28')]]={'$like':'%'+_0x3e62b5[_0xc653('0x31')][_0xc653('0x3d')]+'%'};return _0x2bda60;}})});}_0x33bcd8=_[_0xc653('0x3e')]({},_0x33bcd8,_0x3e62b5[_0xc653('0x3f')]);var _0x44a053={'where':_0x33bcd8[_0xc653('0x3a')]};return db['JscriptyQuestionReport'][_0xc653('0x1e')](_0x44a053)[_0xc653('0x25')](function(_0x5a0f8a){_0xf69c45[_0xc653('0x1e')]=_0x5a0f8a;if(_0x3e62b5[_0xc653('0x31')]['includeAll']){_0x33bcd8['include']=[{'all':!![]}];}return db[_0xc653('0x2a')]['findAll'](_0x33bcd8);})[_0xc653('0x25')](function(_0x996909){_0xf69c45[_0xc653('0x40')]=_0x996909;return _0xf69c45;})['then'](respondWithFilteredResult(_0x10bea7,_0x33bcd8))[_0xc653('0x41')](handleError(_0x10bea7,null));};exports[_0xc653('0x42')]=function(_0x4068a5,_0x2c4b6c){var _0x3c221c={'raw':!![],'where':{'id':_0x4068a5['params']['id']}},_0x2cc461={};_0x2cc461['model']=_[_0xc653('0x43')](db[_0xc653('0x2a')]['rawAttributes']);_0x2cc461[_0xc653('0x31')]=_[_0xc653('0x43')](_0x4068a5[_0xc653('0x31')]);_0x2cc461[_0xc653('0x3c')]=_[_0xc653('0x32')](_0x2cc461['model'],_0x2cc461[_0xc653('0x31')]);_0x3c221c[_0xc653('0x33')]=_[_0xc653('0x32')](_0x2cc461[_0xc653('0x2f')],qs[_0xc653('0x34')](_0x4068a5[_0xc653('0x31')][_0xc653('0x34')]));_0x3c221c[_0xc653('0x33')]=_0x3c221c[_0xc653('0x33')][_0xc653('0x35')]?_0x3c221c[_0xc653('0x33')]:_0x2cc461[_0xc653('0x2f')];if(_0x4068a5['query'][_0xc653('0x44')]){_0x3c221c[_0xc653('0x45')]=[{'all':!![]}];}_0x3c221c=_[_0xc653('0x3e')]({},_0x3c221c,_0x4068a5[_0xc653('0x3f')]);return db[_0xc653('0x2a')][_0xc653('0x46')](_0x3c221c)[_0xc653('0x25')](handleEntityNotFound(_0x2c4b6c,null))[_0xc653('0x25')](respondWithResult(_0x2c4b6c,null))[_0xc653('0x41')](handleError(_0x2c4b6c,null));};exports[_0xc653('0x47')]=function(_0x40d4ee,_0xda6b26){return db['JscriptyQuestionReport'][_0xc653('0x47')](_0x40d4ee[_0xc653('0x48')],{})[_0xc653('0x25')](respondWithResult(_0xda6b26,0xc9))[_0xc653('0x41')](handleError(_0xda6b26,null));};exports[_0xc653('0x24')]=function(_0x4fcc4d,_0x195f70){if(_0x4fcc4d['body']['id']){delete _0x4fcc4d[_0xc653('0x48')]['id'];}return db['JscriptyQuestionReport'][_0xc653('0x46')]({'where':{'id':_0x4fcc4d[_0xc653('0x49')]['id']}})[_0xc653('0x25')](handleEntityNotFound(_0x195f70,null))[_0xc653('0x25')](saveUpdates(_0x4fcc4d['body'],null))[_0xc653('0x25')](respondWithResult(_0x195f70,null))[_0xc653('0x41')](handleError(_0x195f70,null));};exports[_0xc653('0x26')]=function(_0x188b62,_0x57a595){return db['JscriptyQuestionReport'][_0xc653('0x46')]({'where':{'id':_0x188b62[_0xc653('0x49')]['id']}})[_0xc653('0x25')](handleEntityNotFound(_0x57a595,null))[_0xc653('0x25')](removeEntity(_0x57a595,null))[_0xc653('0x41')](handleError(_0x57a595,null));};exports[_0xc653('0x4a')]=function(_0x9c4aa3,_0x306f58){return db[_0xc653('0x2a')][_0xc653('0x4a')]()[_0xc653('0x25')](respondWithResult(_0x306f58,null))[_0xc653('0x41')](handleError(_0x306f58,null));}; \ No newline at end of file +var _0x8c6f=['send','index','map','JscriptyQuestionReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','save','then','destroy','error','name'];(function(_0x3d48ae,_0x4f8b74){var _0x581049=function(_0x8ee472){while(--_0x8ee472){_0x3d48ae['push'](_0x3d48ae['shift']());}};_0x581049(++_0x4f8b74);}(_0x8c6f,0x1a6));var _0xf8c6=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x8c6f[_0x42bdad];return _0x122626;};'use strict';var emlformat=require(_0xf8c6('0x0'));var rimraf=require(_0xf8c6('0x1'));var zipdir=require(_0xf8c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8c6('0x3'));var moment=require(_0xf8c6('0x4'));var BPromise=require(_0xf8c6('0x5'));var Mustache=require(_0xf8c6('0x6'));var util=require('util');var path=require(_0xf8c6('0x7'));var sox=require(_0xf8c6('0x8'));var csv=require(_0xf8c6('0x9'));var ejs=require(_0xf8c6('0xa'));var fs=require('fs');var fs_extra=require(_0xf8c6('0xb'));var _=require(_0xf8c6('0xc'));var squel=require(_0xf8c6('0xd'));var crypto=require(_0xf8c6('0xe'));var jsforce=require(_0xf8c6('0xf'));var deskjs=require(_0xf8c6('0x10'));var toCsv=require(_0xf8c6('0x9'));var querystring=require(_0xf8c6('0x11'));var Papa=require(_0xf8c6('0x12'));var Redis=require(_0xf8c6('0x13'));var authService=require(_0xf8c6('0x14'));var qs=require(_0xf8c6('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf8c6('0x16'));var logger=require(_0xf8c6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf8c6('0x18'));var licenseUtil=require(_0xf8c6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1696b4,_0x328e6b){_0x328e6b=_0x328e6b||0xcc;return function(_0x13f0db){if(_0x13f0db){return _0x1696b4[_0xf8c6('0x1a')](_0x328e6b);}return _0x1696b4[_0xf8c6('0x1b')](_0x328e6b)[_0xf8c6('0x1c')]();};}function respondWithResult(_0xab3c2f,_0x456ce7){_0x456ce7=_0x456ce7||0xc8;return function(_0x2af1cd){if(_0x2af1cd){return _0xab3c2f[_0xf8c6('0x1b')](_0x456ce7)['json'](_0x2af1cd);}};}function respondWithFilteredResult(_0xb9d8ee,_0x3b6858){return function(_0x15286e){if(_0x15286e){var _0x42376f=typeof _0x3b6858[_0xf8c6('0x1d')]===_0xf8c6('0x1e')&&typeof _0x3b6858['limit']==='undefined';var _0x5835ca=_0x15286e['count'];var _0xdafb3a=_0x42376f?0x0:_0x3b6858['offset'];var _0x547740=_0x42376f?_0x15286e['count']:_0x3b6858['offset']+_0x3b6858[_0xf8c6('0x1f')];var _0x146c9d;if(_0x547740>=_0x5835ca){_0x547740=_0x5835ca;_0x146c9d=0xc8;}else{_0x146c9d=0xce;}_0xb9d8ee[_0xf8c6('0x1b')](_0x146c9d);return _0xb9d8ee[_0xf8c6('0x20')](_0xf8c6('0x21'),_0xdafb3a+'-'+_0x547740+'/'+_0x5835ca)[_0xf8c6('0x22')](_0x15286e);}return null;};}function patchUpdates(_0x3b40c4){return function(_0x505c24){try{jsonpatch['apply'](_0x505c24,_0x3b40c4,!![]);}catch(_0x171405){return BPromise['reject'](_0x171405);}return _0x505c24[_0xf8c6('0x23')]();};}function saveUpdates(_0x3dc00b,_0x4e758c){return function(_0x87db75){if(_0x87db75){return _0x87db75['update'](_0x3dc00b)[_0xf8c6('0x24')](function(_0x2c9ef9){return _0x2c9ef9;});}return null;};}function removeEntity(_0x3bbc08,_0x42ca0b){return function(_0x40e2e8){if(_0x40e2e8){return _0x40e2e8[_0xf8c6('0x25')]()[_0xf8c6('0x24')](function(){_0x3bbc08['status'](0xcc)[_0xf8c6('0x1c')]();});}};}function handleEntityNotFound(_0x1b6852,_0x36abff){return function(_0x521a5f){if(!_0x521a5f){_0x1b6852['sendStatus'](0x194);}return _0x521a5f;};}function handleError(_0x4edc9d,_0x2feb7b){_0x2feb7b=_0x2feb7b||0x1f4;return function(_0x1ebad6){logger[_0xf8c6('0x26')](_0x1ebad6['stack']);if(_0x1ebad6['name']){delete _0x1ebad6[_0xf8c6('0x27')];}_0x4edc9d['status'](_0x2feb7b)[_0xf8c6('0x28')](_0x1ebad6);};}exports[_0xf8c6('0x29')]=function(_0x582fbc,_0x3f993b){var _0x3a07f6={},_0x4d0ce0={},_0x54d75a={'count':0x0,'rows':[]};var _0x41fe7c=_[_0xf8c6('0x2a')](db[_0xf8c6('0x2b')][_0xf8c6('0x2c')],function(_0x3dbc30){return{'name':_0x3dbc30['fieldName'],'type':_0x3dbc30[_0xf8c6('0x2d')]['key']};});_0x4d0ce0[_0xf8c6('0x2e')]=_[_0xf8c6('0x2a')](_0x41fe7c,_0xf8c6('0x27'));_0x4d0ce0[_0xf8c6('0x2f')]=_[_0xf8c6('0x30')](_0x582fbc[_0xf8c6('0x2f')]);_0x4d0ce0[_0xf8c6('0x31')]=_[_0xf8c6('0x32')](_0x4d0ce0[_0xf8c6('0x2e')],_0x4d0ce0['query']);_0x3a07f6['attributes']=_[_0xf8c6('0x32')](_0x4d0ce0['model'],qs[_0xf8c6('0x33')](_0x582fbc[_0xf8c6('0x2f')]['fields']));_0x3a07f6[_0xf8c6('0x34')]=_0x3a07f6[_0xf8c6('0x34')][_0xf8c6('0x35')]?_0x3a07f6[_0xf8c6('0x34')]:_0x4d0ce0[_0xf8c6('0x2e')];if(!_0x582fbc[_0xf8c6('0x2f')][_0xf8c6('0x36')](_0xf8c6('0x37'))){_0x3a07f6[_0xf8c6('0x1f')]=qs[_0xf8c6('0x1f')](_0x582fbc[_0xf8c6('0x2f')]['limit']);_0x3a07f6['offset']=qs[_0xf8c6('0x1d')](_0x582fbc[_0xf8c6('0x2f')]['offset']);}_0x3a07f6[_0xf8c6('0x38')]=qs[_0xf8c6('0x39')](_0x582fbc[_0xf8c6('0x2f')][_0xf8c6('0x39')]);_0x3a07f6[_0xf8c6('0x3a')]=qs[_0xf8c6('0x31')](_[_0xf8c6('0x3b')](_0x582fbc[_0xf8c6('0x2f')],_0x4d0ce0[_0xf8c6('0x31')]),_0x41fe7c);if(_0x582fbc[_0xf8c6('0x2f')][_0xf8c6('0x3c')]){_0x3a07f6['where']=_[_0xf8c6('0x3d')](_0x3a07f6[_0xf8c6('0x3a')],{'$or':_[_0xf8c6('0x2a')](_0x41fe7c,function(_0x157a1c){if(_0x157a1c[_0xf8c6('0x2d')]!==_0xf8c6('0x3e')){var _0x562177={};_0x562177[_0x157a1c['name']]={'$like':'%'+_0x582fbc[_0xf8c6('0x2f')]['filter']+'%'};return _0x562177;}})});}_0x3a07f6=_[_0xf8c6('0x3d')]({},_0x3a07f6,_0x582fbc[_0xf8c6('0x3f')]);var _0x4b58b4={'where':_0x3a07f6[_0xf8c6('0x3a')]};return db[_0xf8c6('0x2b')][_0xf8c6('0x40')](_0x4b58b4)[_0xf8c6('0x24')](function(_0x313a0a){_0x54d75a[_0xf8c6('0x40')]=_0x313a0a;if(_0x582fbc[_0xf8c6('0x2f')][_0xf8c6('0x41')]){_0x3a07f6[_0xf8c6('0x42')]=[{'all':!![]}];}return db[_0xf8c6('0x2b')][_0xf8c6('0x43')](_0x3a07f6);})[_0xf8c6('0x24')](function(_0x409a9c){_0x54d75a[_0xf8c6('0x44')]=_0x409a9c;return _0x54d75a;})['then'](respondWithFilteredResult(_0x3f993b,_0x3a07f6))[_0xf8c6('0x45')](handleError(_0x3f993b,null));};exports[_0xf8c6('0x46')]=function(_0x4b6489,_0x1b2464){var _0x2f4502={'raw':!![],'where':{'id':_0x4b6489[_0xf8c6('0x47')]['id']}},_0x7500bd={};_0x7500bd[_0xf8c6('0x2e')]=_['keys'](db[_0xf8c6('0x2b')][_0xf8c6('0x2c')]);_0x7500bd[_0xf8c6('0x2f')]=_['keys'](_0x4b6489[_0xf8c6('0x2f')]);_0x7500bd['filters']=_[_0xf8c6('0x32')](_0x7500bd[_0xf8c6('0x2e')],_0x7500bd[_0xf8c6('0x2f')]);_0x2f4502['attributes']=_[_0xf8c6('0x32')](_0x7500bd[_0xf8c6('0x2e')],qs['fields'](_0x4b6489[_0xf8c6('0x2f')][_0xf8c6('0x33')]));_0x2f4502['attributes']=_0x2f4502[_0xf8c6('0x34')][_0xf8c6('0x35')]?_0x2f4502[_0xf8c6('0x34')]:_0x7500bd[_0xf8c6('0x2e')];if(_0x4b6489[_0xf8c6('0x2f')][_0xf8c6('0x41')]){_0x2f4502['include']=[{'all':!![]}];}_0x2f4502=_[_0xf8c6('0x3d')]({},_0x2f4502,_0x4b6489[_0xf8c6('0x3f')]);return db[_0xf8c6('0x2b')][_0xf8c6('0x48')](_0x2f4502)['then'](handleEntityNotFound(_0x1b2464,null))[_0xf8c6('0x24')](respondWithResult(_0x1b2464,null))[_0xf8c6('0x45')](handleError(_0x1b2464,null));};exports['create']=function(_0x558a90,_0x15b36c){return db['JscriptyQuestionReport'][_0xf8c6('0x49')](_0x558a90['body'],{})[_0xf8c6('0x24')](respondWithResult(_0x15b36c,0xc9))[_0xf8c6('0x45')](handleError(_0x15b36c,null));};exports[_0xf8c6('0x4a')]=function(_0x2beeb6,_0x331cb1){if(_0x2beeb6['body']['id']){delete _0x2beeb6[_0xf8c6('0x4b')]['id'];}return db[_0xf8c6('0x2b')][_0xf8c6('0x48')]({'where':{'id':_0x2beeb6[_0xf8c6('0x47')]['id']}})[_0xf8c6('0x24')](handleEntityNotFound(_0x331cb1,null))[_0xf8c6('0x24')](saveUpdates(_0x2beeb6['body'],null))[_0xf8c6('0x24')](respondWithResult(_0x331cb1,null))[_0xf8c6('0x45')](handleError(_0x331cb1,null));};exports[_0xf8c6('0x25')]=function(_0x34bf1b,_0x4dcb66){return db[_0xf8c6('0x2b')]['find']({'where':{'id':_0x34bf1b['params']['id']}})[_0xf8c6('0x24')](handleEntityNotFound(_0x4dcb66,null))['then'](removeEntity(_0x4dcb66,null))[_0xf8c6('0x45')](handleError(_0x4dcb66,null));};exports[_0xf8c6('0x4c')]=function(_0x3d7c90,_0x23f411){return db['JscriptyQuestionReport']['describe']()[_0xf8c6('0x24')](respondWithResult(_0x23f411,null))['catch'](handleError(_0x23f411,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 881b12a..456607c 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 _0x9132=['lodash','util','../../config/logger','moment','bluebird','request-promise','exports','define','JscriptyQuestionReport'];(function(_0x16d634,_0x5113cc){var _0x2bf99e=function(_0x385405){while(--_0x385405){_0x16d634['push'](_0x16d634['shift']());}};_0x2bf99e(++_0x5113cc);}(_0x9132,0x1b9));var _0x2913=function(_0x537cde,_0x2594d6){_0x537cde=_0x537cde-0x0;var _0x5558ae=_0x9132[_0x537cde];return _0x5558ae;};'use strict';var _=require(_0x2913('0x0'));var util=require(_0x2913('0x1'));var logger=require(_0x2913('0x2'))('api');var moment=require(_0x2913('0x3'));var BPromise=require(_0x2913('0x4'));var rp=require(_0x2913('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0x2913('0x6')]=function(_0x3f0e61,_0xe936b9){return _0x3f0e61[_0x2913('0x7')](_0x2913('0x8'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0a2=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xc0a2,0x1d8));var _0x2c0a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc0a2[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2c0a('0x0'));var util=require(_0x2c0a('0x1'));var logger=require(_0x2c0a('0x2'))('api');var moment=require(_0x2c0a('0x3'));var BPromise=require(_0x2c0a('0x4'));var rp=require(_0x2c0a('0x5'));var fs=require('fs');var path=require(_0x2c0a('0x6'));var rimraf=require(_0x2c0a('0x7'));var config=require(_0x2c0a('0x8'));var attributes=require(_0x2c0a('0x9'));module[_0x2c0a('0xa')]=function(_0x25b3ac,_0x27931d){return _0x25b3ac[_0x2c0a('0xb')](_0x2c0a('0xc'),attributes,{'tableName':_0x2c0a('0xd'),'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 7704c0a..ed71b46 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 _0x9a24=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','moment'];(function(_0x4a161f,_0x416f0a){var _0x5c857e=function(_0x4f1a2a){while(--_0x4f1a2a){_0x4a161f['push'](_0x4a161f['shift']());}};_0x5c857e(++_0x416f0a);}(_0x9a24,0x102));var _0x49a2=function(_0x584d24,_0x1ff65c){_0x584d24=_0x584d24-0x0;var _0x18b271=_0x9a24[_0x584d24];return _0x18b271;};'use strict';var _=require(_0x49a2('0x0'));var util=require('util');var moment=require(_0x49a2('0x1'));var BPromise=require(_0x49a2('0x2'));var rs=require(_0x49a2('0x3'));var fs=require('fs');var Redis=require(_0x49a2('0x4'));var db=require(_0x49a2('0x5'))['db'];var utils=require(_0x49a2('0x6'));var logger=require(_0x49a2('0x7'))('rpc');var config=require(_0x49a2('0x8'));var jayson=require(_0x49a2('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e4faf,_0x4d1ce3,_0xb4fdd7){return new BPromise(function(_0x422ab3,_0x500214){return client[_0x49a2('0xa')](_0x2e4faf,_0xb4fdd7)['then'](function(_0x5b42ef){logger[_0x49a2('0xb')](_0x49a2('0xc'),_0x4d1ce3,_0x49a2('0xd'));logger[_0x49a2('0xe')](_0x49a2('0xf'),_0x4d1ce3,_0x49a2('0xd'),JSON['stringify'](_0x5b42ef));if(_0x5b42ef['error']){if(_0x5b42ef['error'][_0x49a2('0x10')]===0x1f4){logger['error'](_0x49a2('0xc'),_0x4d1ce3,_0x5b42ef[_0x49a2('0x11')][_0x49a2('0x12')]);return _0x500214(_0x5b42ef['error'][_0x49a2('0x12')]);}logger[_0x49a2('0x11')](_0x49a2('0xc'),_0x4d1ce3,_0x5b42ef[_0x49a2('0x11')]['message']);return _0x422ab3(_0x5b42ef[_0x49a2('0x11')][_0x49a2('0x12')]);}else{logger[_0x49a2('0xb')](_0x49a2('0xc'),_0x4d1ce3,_0x49a2('0xd'));_0x422ab3(_0x5b42ef[_0x49a2('0x13')][_0x49a2('0x12')]);}})['catch'](function(_0x37881d){logger[_0x49a2('0x11')](_0x49a2('0xc'),_0x4d1ce3,_0x37881d);_0x500214(_0x37881d);});});} \ No newline at end of file +var _0xe44b=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xe44b,0xa3));var _0xbe44=function(_0x57f73c,_0x6ec5c4){_0x57f73c=_0x57f73c-0x0;var _0x47f266=_0xe44b[_0x57f73c];return _0x47f266;};'use strict';var _=require(_0xbe44('0x0'));var util=require(_0xbe44('0x1'));var moment=require(_0xbe44('0x2'));var BPromise=require(_0xbe44('0x3'));var rs=require(_0xbe44('0x4'));var fs=require('fs');var Redis=require(_0xbe44('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe44('0x6'));var logger=require(_0xbe44('0x7'))(_0xbe44('0x8'));var config=require(_0xbe44('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbe44('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff5d9,_0x55742b,_0x5af7a9){return new BPromise(function(_0x71d95d,_0x54ddf9){return client[_0xbe44('0xb')](_0x1ff5d9,_0x5af7a9)[_0xbe44('0xc')](function(_0x4b9edf){logger[_0xbe44('0xd')](_0xbe44('0xe'),_0x55742b,_0xbe44('0xf'));logger['debug'](_0xbe44('0x10'),_0x55742b,'request\x20sent',JSON[_0xbe44('0x11')](_0x4b9edf));if(_0x4b9edf[_0xbe44('0x12')]){if(_0x4b9edf[_0xbe44('0x12')][_0xbe44('0x13')]===0x1f4){logger['error'](_0xbe44('0xe'),_0x55742b,_0x4b9edf[_0xbe44('0x12')]['message']);return _0x54ddf9(_0x4b9edf[_0xbe44('0x12')]['message']);}logger[_0xbe44('0x12')](_0xbe44('0xe'),_0x55742b,_0x4b9edf['error']['message']);return _0x71d95d(_0x4b9edf['error'][_0xbe44('0x14')]);}else{logger[_0xbe44('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x55742b,'request\x20sent');_0x71d95d(_0x4b9edf['result'][_0xbe44('0x14')]);}})['catch'](function(_0x31f599){logger[_0xbe44('0x12')](_0xbe44('0xe'),_0x55742b,_0x31f599);_0x54ddf9(_0x31f599);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index b640a79..d71034b 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 _0x5319=['fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','describe','/:id','show','getQuestions','post','create','put','delete','destroy','util','connect-timeout','express','Router'];(function(_0x3559c4,_0x47580b){var _0x124053=function(_0x2edf1){while(--_0x2edf1){_0x3559c4['push'](_0x3559c4['shift']());}};_0x124053(++_0x47580b);}(_0x5319,0x12c));var _0x9531=function(_0x52666e,_0x5b3776){_0x52666e=_0x52666e-0x0;var _0x515330=_0x5319[_0x52666e];return _0x515330;};'use strict';var multer=require('multer');var util=require(_0x9531('0x0'));var path=require('path');var timeout=require(_0x9531('0x1'));var express=require(_0x9531('0x2'));var router=express[_0x9531('0x3')]();var fs_extra=require(_0x9531('0x4'));var auth=require(_0x9531('0x5'));var interaction=require(_0x9531('0x6'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x9531('0x7')](),controller[_0x9531('0x8')]);router[_0x9531('0x9')]('/describe',auth[_0x9531('0x7')](),controller[_0x9531('0xa')]);router['get'](_0x9531('0xb'),auth[_0x9531('0x7')](),controller[_0x9531('0xc')]);router['get']('/:id/questions',auth['isAuthenticated'](),controller[_0x9531('0xd')]);router[_0x9531('0xe')]('/',auth[_0x9531('0x7')](),controller[_0x9531('0xf')]);router[_0x9531('0x10')]('/:id',auth[_0x9531('0x7')](),controller['update']);router[_0x9531('0x11')](_0x9531('0xb'),auth[_0x9531('0x7')](),controller[_0x9531('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5122=['/:id/questions','getQuestions','post','put','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x28c906,_0xb83ea4){var _0x1320b0=function(_0x4cf150){while(--_0x4cf150){_0x28c906['push'](_0x28c906['shift']());}};_0x1320b0(++_0xb83ea4);}(_0x5122,0xa7));var _0x2512=function(_0x112c23,_0x1d8eb2){_0x112c23=_0x112c23-0x0;var _0xd1ddeb=_0x5122[_0x112c23];return _0xd1ddeb;};'use strict';var multer=require(_0x2512('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2512('0x1'));var express=require('express');var router=express[_0x2512('0x2')]();var fs_extra=require(_0x2512('0x3'));var auth=require(_0x2512('0x4'));var interaction=require(_0x2512('0x5'));var config=require(_0x2512('0x6'));var controller=require(_0x2512('0x7'));router[_0x2512('0x8')]('/',auth[_0x2512('0x9')](),controller['index']);router[_0x2512('0x8')](_0x2512('0xa'),auth[_0x2512('0x9')](),controller['describe']);router['get'](_0x2512('0xb'),auth['isAuthenticated'](),controller[_0x2512('0xc')]);router[_0x2512('0x8')](_0x2512('0xd'),auth['isAuthenticated'](),controller[_0x2512('0xe')]);router[_0x2512('0xf')]('/',auth[_0x2512('0x9')](),controller['create']);router[_0x2512('0x10')](_0x2512('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2512('0x11')](_0x2512('0xb'),auth['isAuthenticated'](),controller[_0x2512('0x12')]);module[_0x2512('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 276a069..be5d59e 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 _0xdde1=['STRING','BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5824f4,_0x511783){var _0x11d149=function(_0x4a588a){while(--_0x4a588a){_0x5824f4['push'](_0x5824f4['shift']());}};_0x11d149(++_0x511783);}(_0xdde1,0xf5));var _0x1dde=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xdde1[_0x24f31b];return _0x488401;};'use strict';var moment=require(_0x1dde('0x0'));var Sequelize=require(_0x1dde('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x1dde('0x2')],'set':function(_0x457478){this[_0x1dde('0x3')](_0x1dde('0x4'),_0x457478);this[_0x1dde('0x3')](_0x1dde('0x5'),moment()['format'](_0x1dde('0x6')));}},'endtime':{'type':Sequelize[_0x1dde('0x2')]},'membername':{'type':Sequelize[_0x1dde('0x7')]},'projectname':{'type':Sequelize[_0x1dde('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1dde('0x7')]},'calleridnum':{'type':Sequelize[_0x1dde('0x7')]},'completed':{'type':Sequelize[_0x1dde('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x9a78=['STRING','BOOLEAN','moment','sequelize','exports','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2eee99,_0x102d54){var _0x2689b0=function(_0x560c81){while(--_0x560c81){_0x2eee99['push'](_0x2eee99['shift']());}};_0x2689b0(++_0x102d54);}(_0x9a78,0x84));var _0x89a7=function(_0x5a594d,_0x5cd018){_0x5a594d=_0x5a594d-0x0;var _0x45a07e=_0x9a78[_0x5a594d];return _0x45a07e;};'use strict';var moment=require(_0x89a7('0x0'));var Sequelize=require(_0x89a7('0x1'));module[_0x89a7('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1b07ae){this[_0x89a7('0x3')](_0x89a7('0x4'),_0x1b07ae);this[_0x89a7('0x3')](_0x89a7('0x5'),moment()[_0x89a7('0x6')](_0x89a7('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x89a7('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x89a7('0x8')]},'uniqueid':{'type':Sequelize[_0x89a7('0x8')]},'calleridname':{'type':Sequelize[_0x89a7('0x8')]},'calleridnum':{'type':Sequelize[_0x89a7('0x8')]},'completed':{'type':Sequelize[_0x89a7('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index bbd1b36..f459d77 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 _0xdd57=['api','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','JscriptyQuestionReport','SessionId','eml-format','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x493496,_0x1ed53b){var _0x2925eb=function(_0x33752f){while(--_0x33752f){_0x493496['push'](_0x493496['shift']());}};_0x2925eb(++_0x1ed53b);}(_0xdd57,0x1ee));var _0x7dd5=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0xdd57[_0x9d1e6b];return _0x2b3070;};'use strict';var emlformat=require(_0x7dd5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7dd5('0x1'));var jsonpatch=require(_0x7dd5('0x2'));var rp=require('request-promise');var moment=require(_0x7dd5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7dd5('0x4'));var csv=require(_0x7dd5('0x5'));var ejs=require(_0x7dd5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dd5('0x7'));var squel=require(_0x7dd5('0x8'));var crypto=require(_0x7dd5('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7dd5('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7dd5('0xb'));var Papa=require(_0x7dd5('0xc'));var Redis=require(_0x7dd5('0xd'));var authService=require(_0x7dd5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7dd5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7dd5('0x10'))(_0x7dd5('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7dd5('0x12'));var db=require(_0x7dd5('0x13'))['db'];function respondWithStatusCode(_0x2fd512,_0xdaaba2){_0xdaaba2=_0xdaaba2||0xcc;return function(_0x48abcf){if(_0x48abcf){return _0x2fd512['sendStatus'](_0xdaaba2);}return _0x2fd512['status'](_0xdaaba2)['end']();};}function respondWithResult(_0x4c4dfc,_0x3b4c65){_0x3b4c65=_0x3b4c65||0xc8;return function(_0xc09303){if(_0xc09303){return _0x4c4dfc[_0x7dd5('0x14')](_0x3b4c65)['json'](_0xc09303);}};}function respondWithFilteredResult(_0x435832,_0x2b41d9){return function(_0x268e94){if(_0x268e94){var _0x4f2857=typeof _0x2b41d9['offset']==='undefined'&&typeof _0x2b41d9['limit']===_0x7dd5('0x15');var _0x466b44=_0x268e94[_0x7dd5('0x16')];var _0x196405=_0x4f2857?0x0:_0x2b41d9[_0x7dd5('0x17')];var _0x261eb2=_0x4f2857?_0x268e94[_0x7dd5('0x16')]:_0x2b41d9['offset']+_0x2b41d9[_0x7dd5('0x18')];var _0x4e6762;if(_0x261eb2>=_0x466b44){_0x261eb2=_0x466b44;_0x4e6762=0xc8;}else{_0x4e6762=0xce;}_0x435832[_0x7dd5('0x14')](_0x4e6762);return _0x435832[_0x7dd5('0x19')](_0x7dd5('0x1a'),_0x196405+'-'+_0x261eb2+'/'+_0x466b44)['json'](_0x268e94);}return null;};}function patchUpdates(_0x40bbc0){return function(_0x42e20e){try{jsonpatch[_0x7dd5('0x1b')](_0x42e20e,_0x40bbc0,!![]);}catch(_0x39f199){return BPromise[_0x7dd5('0x1c')](_0x39f199);}return _0x42e20e[_0x7dd5('0x1d')]();};}function saveUpdates(_0x5611f6,_0x393876){return function(_0xf22b34){if(_0xf22b34){return _0xf22b34[_0x7dd5('0x1e')](_0x5611f6)[_0x7dd5('0x1f')](function(_0x39e6e0){return _0x39e6e0;});}return null;};}function removeEntity(_0x64f020,_0x3f6548){return function(_0x1ca653){if(_0x1ca653){return _0x1ca653[_0x7dd5('0x20')]()['then'](function(){_0x64f020['status'](0xcc)[_0x7dd5('0x21')]();});}};}function handleEntityNotFound(_0x30f976,_0x776c25){return function(_0x590769){if(!_0x590769){_0x30f976[_0x7dd5('0x22')](0x194);}return _0x590769;};}function handleError(_0x59d623,_0x4d1ea0){_0x4d1ea0=_0x4d1ea0||0x1f4;return function(_0x11eeda){logger[_0x7dd5('0x23')](_0x11eeda['stack']);if(_0x11eeda[_0x7dd5('0x24')]){delete _0x11eeda[_0x7dd5('0x24')];}_0x59d623['status'](_0x4d1ea0)[_0x7dd5('0x25')](_0x11eeda);};}exports[_0x7dd5('0x26')]=function(_0x21a4ad,_0x3a2749){var _0xbbc907={},_0xea6a9b={},_0x51f06c={'count':0x0,'rows':[]};var _0x4040fc=_[_0x7dd5('0x27')](db[_0x7dd5('0x28')][_0x7dd5('0x29')],function(_0x27165e){return{'name':_0x27165e[_0x7dd5('0x2a')],'type':_0x27165e['type'][_0x7dd5('0x2b')]};});_0xea6a9b[_0x7dd5('0x2c')]=_[_0x7dd5('0x27')](_0x4040fc,'name');_0xea6a9b[_0x7dd5('0x2d')]=_[_0x7dd5('0x2e')](_0x21a4ad['query']);_0xea6a9b[_0x7dd5('0x2f')]=_['intersection'](_0xea6a9b[_0x7dd5('0x2c')],_0xea6a9b[_0x7dd5('0x2d')]);_0xbbc907[_0x7dd5('0x30')]=_[_0x7dd5('0x31')](_0xea6a9b['model'],qs['fields'](_0x21a4ad['query'][_0x7dd5('0x32')]));_0xbbc907['attributes']=_0xbbc907[_0x7dd5('0x30')][_0x7dd5('0x33')]?_0xbbc907[_0x7dd5('0x30')]:_0xea6a9b[_0x7dd5('0x2c')];if(!_0x21a4ad['query']['hasOwnProperty'](_0x7dd5('0x34'))){_0xbbc907[_0x7dd5('0x18')]=qs[_0x7dd5('0x18')](_0x21a4ad[_0x7dd5('0x2d')][_0x7dd5('0x18')]);_0xbbc907[_0x7dd5('0x17')]=qs[_0x7dd5('0x17')](_0x21a4ad['query'][_0x7dd5('0x17')]);}_0xbbc907[_0x7dd5('0x35')]=qs[_0x7dd5('0x36')](_0x21a4ad[_0x7dd5('0x2d')][_0x7dd5('0x36')]);_0xbbc907[_0x7dd5('0x37')]=qs[_0x7dd5('0x2f')](_['pick'](_0x21a4ad[_0x7dd5('0x2d')],_0xea6a9b[_0x7dd5('0x2f')]),_0x4040fc);if(_0x21a4ad['query'][_0x7dd5('0x38')]){_0xbbc907[_0x7dd5('0x37')]=_['merge'](_0xbbc907[_0x7dd5('0x37')],{'$or':_['map'](_0x4040fc,function(_0x83d111){if(_0x83d111['type']!==_0x7dd5('0x39')){var _0x2c9c83={};_0x2c9c83[_0x83d111['name']]={'$like':'%'+_0x21a4ad[_0x7dd5('0x2d')][_0x7dd5('0x38')]+'%'};return _0x2c9c83;}})});}_0xbbc907=_[_0x7dd5('0x3a')]({},_0xbbc907,_0x21a4ad[_0x7dd5('0x3b')]);var _0x195cb7={'where':_0xbbc907[_0x7dd5('0x37')]};return db['JscriptySessionReport'][_0x7dd5('0x16')](_0x195cb7)[_0x7dd5('0x1f')](function(_0x11ece6){_0x51f06c[_0x7dd5('0x16')]=_0x11ece6;if(_0x21a4ad[_0x7dd5('0x2d')][_0x7dd5('0x3c')]){_0xbbc907[_0x7dd5('0x3d')]=[{'all':!![]}];}return db[_0x7dd5('0x28')][_0x7dd5('0x3e')](_0xbbc907);})['then'](function(_0x485bec){_0x51f06c[_0x7dd5('0x3f')]=_0x485bec;return _0x51f06c;})[_0x7dd5('0x1f')](respondWithFilteredResult(_0x3a2749,_0xbbc907))['catch'](handleError(_0x3a2749,null));};exports[_0x7dd5('0x40')]=function(_0x48a946,_0x566823){var _0x1e3139={'raw':!![],'where':{'id':_0x48a946[_0x7dd5('0x41')]['id']}},_0x329f9c={};_0x329f9c['model']=_['keys'](db[_0x7dd5('0x28')][_0x7dd5('0x29')]);_0x329f9c['query']=_[_0x7dd5('0x2e')](_0x48a946[_0x7dd5('0x2d')]);_0x329f9c[_0x7dd5('0x2f')]=_[_0x7dd5('0x31')](_0x329f9c[_0x7dd5('0x2c')],_0x329f9c[_0x7dd5('0x2d')]);_0x1e3139['attributes']=_[_0x7dd5('0x31')](_0x329f9c[_0x7dd5('0x2c')],qs['fields'](_0x48a946[_0x7dd5('0x2d')][_0x7dd5('0x32')]));_0x1e3139['attributes']=_0x1e3139['attributes'][_0x7dd5('0x33')]?_0x1e3139[_0x7dd5('0x30')]:_0x329f9c[_0x7dd5('0x2c')];if(_0x48a946[_0x7dd5('0x2d')][_0x7dd5('0x3c')]){_0x1e3139[_0x7dd5('0x3d')]=[{'all':!![]}];}_0x1e3139=_[_0x7dd5('0x3a')]({},_0x1e3139,_0x48a946[_0x7dd5('0x3b')]);return db[_0x7dd5('0x28')][_0x7dd5('0x42')](_0x1e3139)[_0x7dd5('0x1f')](handleEntityNotFound(_0x566823,null))[_0x7dd5('0x1f')](respondWithResult(_0x566823,null))['catch'](handleError(_0x566823,null));};exports['create']=function(_0x26143f,_0x294ea1){return db[_0x7dd5('0x28')][_0x7dd5('0x43')](_0x26143f[_0x7dd5('0x44')],{})[_0x7dd5('0x1f')](respondWithResult(_0x294ea1,0xc9))[_0x7dd5('0x45')](handleError(_0x294ea1,null));};exports[_0x7dd5('0x1e')]=function(_0x134866,_0x2c18e9){if(_0x134866[_0x7dd5('0x44')]['id']){delete _0x134866[_0x7dd5('0x44')]['id'];}return db['JscriptySessionReport'][_0x7dd5('0x42')]({'where':{'id':_0x134866[_0x7dd5('0x41')]['id']}})[_0x7dd5('0x1f')](handleEntityNotFound(_0x2c18e9,null))[_0x7dd5('0x1f')](saveUpdates(_0x134866[_0x7dd5('0x44')],null))[_0x7dd5('0x1f')](respondWithResult(_0x2c18e9,null))[_0x7dd5('0x45')](handleError(_0x2c18e9,null));};exports[_0x7dd5('0x20')]=function(_0x3cdc1d,_0x3ec033){return db[_0x7dd5('0x28')]['find']({'where':{'id':_0x3cdc1d[_0x7dd5('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ec033,null))[_0x7dd5('0x1f')](removeEntity(_0x3ec033,null))[_0x7dd5('0x45')](handleError(_0x3ec033,null));};exports[_0x7dd5('0x46')]=function(_0x6c90d7,_0x45fdde){return db[_0x7dd5('0x28')]['describe']()['then'](respondWithResult(_0x45fdde,null))[_0x7dd5('0x45')](handleError(_0x45fdde,null));};exports['getQuestions']=function(_0x1605f4,_0x2f0cf,_0x248386){var _0x400388={'raw':!![],'where':{}};var _0x36feba={};var _0x5d41a0={'count':0x0,'rows':[]};return db[_0x7dd5('0x28')]['findOne']({'where':{'id':_0x1605f4[_0x7dd5('0x41')]['id']}})[_0x7dd5('0x1f')](handleEntityNotFound(_0x2f0cf,null))[_0x7dd5('0x1f')](function(_0x365e61){if(_0x365e61){_0x36feba[_0x7dd5('0x2c')]=_['keys'](db[_0x7dd5('0x47')][_0x7dd5('0x29')]);_0x36feba[_0x7dd5('0x2d')]=_[_0x7dd5('0x2e')](_0x1605f4['query']);_0x36feba[_0x7dd5('0x2f')]=_['intersection'](_0x36feba[_0x7dd5('0x2c')],_0x36feba[_0x7dd5('0x2d')]);_0x400388[_0x7dd5('0x30')]=_[_0x7dd5('0x31')](_0x36feba[_0x7dd5('0x2c')],qs[_0x7dd5('0x32')](_0x1605f4[_0x7dd5('0x2d')][_0x7dd5('0x32')]));_0x400388[_0x7dd5('0x30')]=_0x400388['attributes'][_0x7dd5('0x33')]?_0x400388[_0x7dd5('0x30')]:_0x36feba[_0x7dd5('0x2c')];if(!_0x1605f4[_0x7dd5('0x2d')]['hasOwnProperty'](_0x7dd5('0x34'))){_0x400388['limit']=qs[_0x7dd5('0x18')](_0x1605f4[_0x7dd5('0x2d')]['limit']);_0x400388[_0x7dd5('0x17')]=qs[_0x7dd5('0x17')](_0x1605f4['query'][_0x7dd5('0x17')]);}_0x400388[_0x7dd5('0x35')]=qs[_0x7dd5('0x36')](_0x1605f4[_0x7dd5('0x2d')][_0x7dd5('0x36')]);_0x400388[_0x7dd5('0x37')]=qs[_0x7dd5('0x2f')](_['pick'](_0x1605f4['query'],_0x36feba[_0x7dd5('0x2f')]));_0x400388[_0x7dd5('0x37')][_0x7dd5('0x48')]=_0x365e61['id'];if(_0x1605f4['query']['filter']){_0x400388[_0x7dd5('0x37')]=_['merge'](_0x400388[_0x7dd5('0x37')],{'$or':_[_0x7dd5('0x27')](_0x400388[_0x7dd5('0x30')],function(_0x181252){var _0x393611={};_0x393611[_0x181252]={'$like':'%'+_0x1605f4['query'][_0x7dd5('0x38')]+'%'};return _0x393611;})});}_0x400388=_[_0x7dd5('0x3a')]({},_0x400388,_0x1605f4[_0x7dd5('0x3b')]);return db['JscriptyQuestionReport'][_0x7dd5('0x16')]({'where':_0x400388['where']})[_0x7dd5('0x1f')](function(_0x92e836){_0x5d41a0[_0x7dd5('0x16')]=_0x92e836;if(_0x1605f4[_0x7dd5('0x2d')][_0x7dd5('0x3c')]){_0x400388['include']=[{'all':!![]}];}return db[_0x7dd5('0x47')][_0x7dd5('0x3e')](_0x400388);})[_0x7dd5('0x1f')](function(_0x48e633){_0x5d41a0[_0x7dd5('0x3f')]=_0x48e633;return _0x5d41a0;});}})[_0x7dd5('0x1f')](respondWithFilteredResult(_0x2f0cf,_0x400388))[_0x7dd5('0x45')](handleError(_0x2f0cf,null));}; \ No newline at end of file +var _0x4d57=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','getQuestions','findOne','hasOwnProperty','JscriptyQuestionReport','rows','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','name','index','map','JscriptySessionReport','fieldName','key'];(function(_0x3a852a,_0xf3f1d3){var _0x48c902=function(_0x22cdd1){while(--_0x22cdd1){_0x3a852a['push'](_0x3a852a['shift']());}};_0x48c902(++_0xf3f1d3);}(_0x4d57,0x14d));var _0x74d5=function(_0x13392c,_0x57d768){_0x13392c=_0x13392c-0x0;var _0x35f9c9=_0x4d57[_0x13392c];return _0x35f9c9;};'use strict';var emlformat=require(_0x74d5('0x0'));var rimraf=require(_0x74d5('0x1'));var zipdir=require(_0x74d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x74d5('0x3'));var BPromise=require(_0x74d5('0x4'));var Mustache=require(_0x74d5('0x5'));var util=require('util');var path=require('path');var sox=require(_0x74d5('0x6'));var csv=require('to-csv');var ejs=require(_0x74d5('0x7'));var fs=require('fs');var fs_extra=require(_0x74d5('0x8'));var _=require(_0x74d5('0x9'));var squel=require(_0x74d5('0xa'));var crypto=require('crypto');var jsforce=require(_0x74d5('0xb'));var deskjs=require(_0x74d5('0xc'));var toCsv=require(_0x74d5('0xd'));var querystring=require(_0x74d5('0xe'));var Papa=require(_0x74d5('0xf'));var Redis=require(_0x74d5('0x10'));var authService=require(_0x74d5('0x11'));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('../../config/utils');var config=require(_0x74d5('0x12'));var licenseUtil=require(_0x74d5('0x13'));var db=require(_0x74d5('0x14'))['db'];function respondWithStatusCode(_0x2bb106,_0x14e1d2){_0x14e1d2=_0x14e1d2||0xcc;return function(_0x477d38){if(_0x477d38){return _0x2bb106[_0x74d5('0x15')](_0x14e1d2);}return _0x2bb106[_0x74d5('0x16')](_0x14e1d2)[_0x74d5('0x17')]();};}function respondWithResult(_0x3b8f67,_0x6c522d){_0x6c522d=_0x6c522d||0xc8;return function(_0xddbea1){if(_0xddbea1){return _0x3b8f67[_0x74d5('0x16')](_0x6c522d)[_0x74d5('0x18')](_0xddbea1);}};}function respondWithFilteredResult(_0x4cf75d,_0x21c0af){return function(_0x491f1f){if(_0x491f1f){var _0x1aaf24=typeof _0x21c0af[_0x74d5('0x19')]===_0x74d5('0x1a')&&typeof _0x21c0af[_0x74d5('0x1b')]===_0x74d5('0x1a');var _0x42e1c6=_0x491f1f['count'];var _0xd5ce69=_0x1aaf24?0x0:_0x21c0af[_0x74d5('0x19')];var _0x3acc86=_0x1aaf24?_0x491f1f[_0x74d5('0x1c')]:_0x21c0af[_0x74d5('0x19')]+_0x21c0af['limit'];var _0x57b0fc;if(_0x3acc86>=_0x42e1c6){_0x3acc86=_0x42e1c6;_0x57b0fc=0xc8;}else{_0x57b0fc=0xce;}_0x4cf75d[_0x74d5('0x16')](_0x57b0fc);return _0x4cf75d['set']('Content-Range',_0xd5ce69+'-'+_0x3acc86+'/'+_0x42e1c6)[_0x74d5('0x18')](_0x491f1f);}return null;};}function patchUpdates(_0x4beaca){return function(_0x25603e){try{jsonpatch[_0x74d5('0x1d')](_0x25603e,_0x4beaca,!![]);}catch(_0x12a6c6){return BPromise[_0x74d5('0x1e')](_0x12a6c6);}return _0x25603e[_0x74d5('0x1f')]();};}function saveUpdates(_0x2d4e00,_0x331b67){return function(_0x5a21a5){if(_0x5a21a5){return _0x5a21a5[_0x74d5('0x20')](_0x2d4e00)[_0x74d5('0x21')](function(_0x2c7683){return _0x2c7683;});}return null;};}function removeEntity(_0xcdbf9d,_0xa8d82e){return function(_0x1a21d9){if(_0x1a21d9){return _0x1a21d9[_0x74d5('0x22')]()[_0x74d5('0x21')](function(){_0xcdbf9d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xffaf1,_0x3657e3){return function(_0x44d99e){if(!_0x44d99e){_0xffaf1[_0x74d5('0x15')](0x194);}return _0x44d99e;};}function handleError(_0x29c051,_0x203f9e){_0x203f9e=_0x203f9e||0x1f4;return function(_0xf19c41){logger[_0x74d5('0x23')](_0xf19c41['stack']);if(_0xf19c41['name']){delete _0xf19c41[_0x74d5('0x24')];}_0x29c051[_0x74d5('0x16')](_0x203f9e)['send'](_0xf19c41);};}exports[_0x74d5('0x25')]=function(_0x582a63,_0x1e7216){var _0x38cff5={},_0x4b9074={},_0x162bdc={'count':0x0,'rows':[]};var _0x5d337c=_[_0x74d5('0x26')](db[_0x74d5('0x27')]['rawAttributes'],function(_0x1d2691){return{'name':_0x1d2691[_0x74d5('0x28')],'type':_0x1d2691['type'][_0x74d5('0x29')]};});_0x4b9074[_0x74d5('0x2a')]=_[_0x74d5('0x26')](_0x5d337c,_0x74d5('0x24'));_0x4b9074[_0x74d5('0x2b')]=_[_0x74d5('0x2c')](_0x582a63[_0x74d5('0x2b')]);_0x4b9074[_0x74d5('0x2d')]=_[_0x74d5('0x2e')](_0x4b9074[_0x74d5('0x2a')],_0x4b9074['query']);_0x38cff5[_0x74d5('0x2f')]=_[_0x74d5('0x2e')](_0x4b9074[_0x74d5('0x2a')],qs[_0x74d5('0x30')](_0x582a63[_0x74d5('0x2b')][_0x74d5('0x30')]));_0x38cff5[_0x74d5('0x2f')]=_0x38cff5[_0x74d5('0x2f')][_0x74d5('0x31')]?_0x38cff5[_0x74d5('0x2f')]:_0x4b9074[_0x74d5('0x2a')];if(!_0x582a63[_0x74d5('0x2b')]['hasOwnProperty'](_0x74d5('0x32'))){_0x38cff5[_0x74d5('0x1b')]=qs[_0x74d5('0x1b')](_0x582a63['query'][_0x74d5('0x1b')]);_0x38cff5[_0x74d5('0x19')]=qs[_0x74d5('0x19')](_0x582a63[_0x74d5('0x2b')][_0x74d5('0x19')]);}_0x38cff5[_0x74d5('0x33')]=qs[_0x74d5('0x34')](_0x582a63[_0x74d5('0x2b')][_0x74d5('0x34')]);_0x38cff5['where']=qs[_0x74d5('0x2d')](_[_0x74d5('0x35')](_0x582a63['query'],_0x4b9074['filters']),_0x5d337c);if(_0x582a63[_0x74d5('0x2b')][_0x74d5('0x36')]){_0x38cff5[_0x74d5('0x37')]=_[_0x74d5('0x38')](_0x38cff5[_0x74d5('0x37')],{'$or':_['map'](_0x5d337c,function(_0x2e4e12){if(_0x2e4e12[_0x74d5('0x39')]!==_0x74d5('0x3a')){var _0x48c866={};_0x48c866[_0x2e4e12[_0x74d5('0x24')]]={'$like':'%'+_0x582a63[_0x74d5('0x2b')][_0x74d5('0x36')]+'%'};return _0x48c866;}})});}_0x38cff5=_['merge']({},_0x38cff5,_0x582a63[_0x74d5('0x3b')]);var _0x4ae2b0={'where':_0x38cff5[_0x74d5('0x37')]};return db[_0x74d5('0x27')][_0x74d5('0x1c')](_0x4ae2b0)[_0x74d5('0x21')](function(_0x4dfefb){_0x162bdc[_0x74d5('0x1c')]=_0x4dfefb;if(_0x582a63[_0x74d5('0x2b')][_0x74d5('0x3c')]){_0x38cff5[_0x74d5('0x3d')]=[{'all':!![]}];}return db[_0x74d5('0x27')][_0x74d5('0x3e')](_0x38cff5);})['then'](function(_0x2037e1){_0x162bdc['rows']=_0x2037e1;return _0x162bdc;})['then'](respondWithFilteredResult(_0x1e7216,_0x38cff5))[_0x74d5('0x3f')](handleError(_0x1e7216,null));};exports[_0x74d5('0x40')]=function(_0x1414ca,_0x3dee29){var _0x2a235f={'raw':!![],'where':{'id':_0x1414ca['params']['id']}},_0x21ea84={};_0x21ea84[_0x74d5('0x2a')]=_[_0x74d5('0x2c')](db['JscriptySessionReport'][_0x74d5('0x41')]);_0x21ea84['query']=_[_0x74d5('0x2c')](_0x1414ca[_0x74d5('0x2b')]);_0x21ea84[_0x74d5('0x2d')]=_['intersection'](_0x21ea84[_0x74d5('0x2a')],_0x21ea84[_0x74d5('0x2b')]);_0x2a235f[_0x74d5('0x2f')]=_[_0x74d5('0x2e')](_0x21ea84[_0x74d5('0x2a')],qs[_0x74d5('0x30')](_0x1414ca[_0x74d5('0x2b')][_0x74d5('0x30')]));_0x2a235f['attributes']=_0x2a235f[_0x74d5('0x2f')][_0x74d5('0x31')]?_0x2a235f['attributes']:_0x21ea84[_0x74d5('0x2a')];if(_0x1414ca[_0x74d5('0x2b')][_0x74d5('0x3c')]){_0x2a235f['include']=[{'all':!![]}];}_0x2a235f=_['merge']({},_0x2a235f,_0x1414ca['options']);return db[_0x74d5('0x27')][_0x74d5('0x42')](_0x2a235f)[_0x74d5('0x21')](handleEntityNotFound(_0x3dee29,null))[_0x74d5('0x21')](respondWithResult(_0x3dee29,null))[_0x74d5('0x3f')](handleError(_0x3dee29,null));};exports[_0x74d5('0x43')]=function(_0x30f95a,_0x3395ba){return db[_0x74d5('0x27')][_0x74d5('0x43')](_0x30f95a['body'],{})[_0x74d5('0x21')](respondWithResult(_0x3395ba,0xc9))['catch'](handleError(_0x3395ba,null));};exports[_0x74d5('0x20')]=function(_0x3aff93,_0xf9e85a){if(_0x3aff93[_0x74d5('0x44')]['id']){delete _0x3aff93['body']['id'];}return db['JscriptySessionReport'][_0x74d5('0x42')]({'where':{'id':_0x3aff93[_0x74d5('0x45')]['id']}})[_0x74d5('0x21')](handleEntityNotFound(_0xf9e85a,null))[_0x74d5('0x21')](saveUpdates(_0x3aff93[_0x74d5('0x44')],null))['then'](respondWithResult(_0xf9e85a,null))[_0x74d5('0x3f')](handleError(_0xf9e85a,null));};exports[_0x74d5('0x22')]=function(_0x48e99a,_0x27004b){return db['JscriptySessionReport']['find']({'where':{'id':_0x48e99a[_0x74d5('0x45')]['id']}})[_0x74d5('0x21')](handleEntityNotFound(_0x27004b,null))[_0x74d5('0x21')](removeEntity(_0x27004b,null))[_0x74d5('0x3f')](handleError(_0x27004b,null));};exports['describe']=function(_0x430db8,_0x1bf9d2){return db[_0x74d5('0x27')]['describe']()[_0x74d5('0x21')](respondWithResult(_0x1bf9d2,null))[_0x74d5('0x3f')](handleError(_0x1bf9d2,null));};exports[_0x74d5('0x46')]=function(_0x5a3bf4,_0x304023,_0x46850b){var _0x1ef678={'raw':!![],'where':{}};var _0x591783={};var _0x2b6b4e={'count':0x0,'rows':[]};return db[_0x74d5('0x27')][_0x74d5('0x47')]({'where':{'id':_0x5a3bf4[_0x74d5('0x45')]['id']}})[_0x74d5('0x21')](handleEntityNotFound(_0x304023,null))['then'](function(_0x5b92b5){if(_0x5b92b5){_0x591783[_0x74d5('0x2a')]=_[_0x74d5('0x2c')](db['JscriptyQuestionReport'][_0x74d5('0x41')]);_0x591783[_0x74d5('0x2b')]=_[_0x74d5('0x2c')](_0x5a3bf4[_0x74d5('0x2b')]);_0x591783['filters']=_[_0x74d5('0x2e')](_0x591783[_0x74d5('0x2a')],_0x591783[_0x74d5('0x2b')]);_0x1ef678[_0x74d5('0x2f')]=_['intersection'](_0x591783[_0x74d5('0x2a')],qs['fields'](_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x30')]));_0x1ef678[_0x74d5('0x2f')]=_0x1ef678[_0x74d5('0x2f')]['length']?_0x1ef678[_0x74d5('0x2f')]:_0x591783[_0x74d5('0x2a')];if(!_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x48')]('nolimit')){_0x1ef678['limit']=qs['limit'](_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x1b')]);_0x1ef678[_0x74d5('0x19')]=qs[_0x74d5('0x19')](_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x19')]);}_0x1ef678[_0x74d5('0x33')]=qs[_0x74d5('0x34')](_0x5a3bf4['query'][_0x74d5('0x34')]);_0x1ef678['where']=qs[_0x74d5('0x2d')](_['pick'](_0x5a3bf4[_0x74d5('0x2b')],_0x591783[_0x74d5('0x2d')]));_0x1ef678['where']['SessionId']=_0x5b92b5['id'];if(_0x5a3bf4['query'][_0x74d5('0x36')]){_0x1ef678['where']=_[_0x74d5('0x38')](_0x1ef678[_0x74d5('0x37')],{'$or':_[_0x74d5('0x26')](_0x1ef678[_0x74d5('0x2f')],function(_0x918f45){var _0x720b12={};_0x720b12[_0x918f45]={'$like':'%'+_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x36')]+'%'};return _0x720b12;})});}_0x1ef678=_[_0x74d5('0x38')]({},_0x1ef678,_0x5a3bf4[_0x74d5('0x3b')]);return db[_0x74d5('0x49')]['count']({'where':_0x1ef678[_0x74d5('0x37')]})[_0x74d5('0x21')](function(_0xf423a5){_0x2b6b4e['count']=_0xf423a5;if(_0x5a3bf4[_0x74d5('0x2b')][_0x74d5('0x3c')]){_0x1ef678[_0x74d5('0x3d')]=[{'all':!![]}];}return db[_0x74d5('0x49')][_0x74d5('0x3e')](_0x1ef678);})[_0x74d5('0x21')](function(_0x263683){_0x2b6b4e[_0x74d5('0x4a')]=_0x263683;return _0x2b6b4e;});}})['then'](respondWithFilteredResult(_0x304023,_0x1ef678))[_0x74d5('0x3f')](handleError(_0x304023,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 56361ca..7e5d492 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 _0x0f4d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x17ede1,_0x2bc5cf){_0x17ede1=_0x17ede1-0x0;var _0x4c45e9=_0x0f4d[_0x17ede1];return _0x4c45e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x409a18,_0x312d95){var _0x1f2486=function(_0x4e672){while(--_0x4e672){_0x409a18['push'](_0x409a18['shift']());}};_0x1f2486(++_0x312d95);}(_0x31f0,0xb7));var _0x031f=function(_0x2b6dac,_0x23f6ed){_0x2b6dac=_0x2b6dac-0x0;var _0x3cb636=_0x31f0[_0x2b6dac];return _0x3cb636;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 2fa9b74..7488545 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 _0x0295=['client','http','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1e9470,_0x41f5d8){var _0x3beff1=function(_0x162614){while(--_0x162614){_0x1e9470['push'](_0x1e9470['shift']());}};_0x3beff1(++_0x41f5d8);}(_0x0295,0x1f0));var _0x5029=function(_0x5d7747,_0x55c074){_0x5d7747=_0x5d7747-0x0;var _0x291142=_0x0295[_0x5d7747];return _0x291142;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0xed1c=['request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed1c,0xe4));var _0xced1=function(_0x4b0449,_0x5bd318){_0x4b0449=_0x4b0449-0x0;var _0x35bb92=_0xed1c[_0x4b0449];return _0x35bb92;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced1('0x2'))['db'];var utils=require(_0xced1('0x3'));var logger=require(_0xced1('0x4'))('rpc');var config=require(_0xced1('0x5'));var jayson=require(_0xced1('0x6'));var client=jayson[_0xced1('0x7')][_0xced1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59399e,_0x2bcf42,_0x38bca8){return new BPromise(function(_0x39d5df,_0x1fb40b){return client[_0xced1('0x9')](_0x59399e,_0x38bca8)[_0xced1('0xa')](function(_0x325dd2){logger[_0xced1('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x2bcf42,_0xced1('0xc'));logger['debug'](_0xced1('0xd'),_0x2bcf42,_0xced1('0xc'),JSON[_0xced1('0xe')](_0x325dd2));if(_0x325dd2[_0xced1('0xf')]){if(_0x325dd2[_0xced1('0xf')][_0xced1('0x10')]===0x1f4){logger[_0xced1('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x2bcf42,_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);return _0x1fb40b(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}logger['error'](_0xced1('0x12'),_0x2bcf42,_0x325dd2[_0xced1('0xf')]['message']);return _0x39d5df(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}else{logger[_0xced1('0xb')](_0xced1('0x12'),_0x2bcf42,'request\x20sent');_0x39d5df(_0x325dd2['result'][_0xced1('0x11')]);}})[_0xced1('0x13')](function(_0x236473){logger[_0xced1('0xf')](_0xced1('0x12'),_0x2bcf42,_0x236473);_0x1fb40b(_0x236473);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index a2f4fb1..ff4a683 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 _0xb751=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','/:id','update','get','/download_log_file','exports','multer','util','path','connect-timeout'];(function(_0x18ac3f,_0x386630){var _0x4c6563=function(_0xcc161f){while(--_0xcc161f){_0x18ac3f['push'](_0x18ac3f['shift']());}};_0x4c6563(++_0x386630);}(_0xb751,0x9c));var _0x1b75=function(_0x322dc5,_0x49846c){_0x322dc5=_0x322dc5-0x0;var _0x2921f4=_0xb751[_0x322dc5];return _0x2921f4;};'use strict';var multer=require(_0x1b75('0x0'));var util=require(_0x1b75('0x1'));var path=require(_0x1b75('0x2'));var timeout=require(_0x1b75('0x3'));var express=require(_0x1b75('0x4'));var router=express['Router']();var fs_extra=require(_0x1b75('0x5'));var auth=require(_0x1b75('0x6'));var interaction=require(_0x1b75('0x7'));var config=require(_0x1b75('0x8'));var controller=require(_0x1b75('0x9'));router['get']('/',controller[_0x1b75('0xa')]);router['put'](_0x1b75('0xb'),auth['isAuthenticated'](),controller[_0x1b75('0xc')]);router[_0x1b75('0xd')](_0x1b75('0xe'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0x1b75('0xf')]=router; \ No newline at end of file +var _0xdc03=['../../components/auth/service','../../components/interaction/service','./license.controller','get','put','/:id','/download_log_file','isAuthenticated','downloadLogFile','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xf44acf,_0x239092){var _0x1ee5fc=function(_0x41184f){while(--_0x41184f){_0xf44acf['push'](_0xf44acf['shift']());}};_0x1ee5fc(++_0x239092);}(_0xdc03,0x19e));var _0x3dc0=function(_0x24f27f,_0x503a09){_0x24f27f=_0x24f27f-0x0;var _0xc7eea3=_0xdc03[_0x24f27f];return _0xc7eea3;};'use strict';var multer=require(_0x3dc0('0x0'));var util=require(_0x3dc0('0x1'));var path=require(_0x3dc0('0x2'));var timeout=require(_0x3dc0('0x3'));var express=require('express');var router=express[_0x3dc0('0x4')]();var fs_extra=require(_0x3dc0('0x5'));var auth=require(_0x3dc0('0x6'));var interaction=require(_0x3dc0('0x7'));var config=require('../../config/environment');var controller=require(_0x3dc0('0x8'));router[_0x3dc0('0x9')]('/',controller['index']);router[_0x3dc0('0xa')](_0x3dc0('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x3dc0('0x9')](_0x3dc0('0xc'),auth[_0x3dc0('0xd')](),controller[_0x3dc0('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 65c942b..a8303e1 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 _0x619e=['TEXT','STRING','INTEGER','exports'];(function(_0x39eee7,_0x1f4cb7){var _0xfabfed=function(_0x3fee30){while(--_0x3fee30){_0x39eee7['push'](_0x39eee7['shift']());}};_0xfabfed(++_0x1f4cb7);}(_0x619e,0x163));var _0xe619=function(_0x17dab8,_0x19d0ec){_0x17dab8=_0x17dab8-0x0;var _0x336fb5=_0x619e[_0x17dab8];return _0x336fb5;};'use strict';var Sequelize=require('sequelize');module[_0xe619('0x0')]={'license':{'type':Sequelize[_0xe619('0x1')]},'data1':{'type':Sequelize[_0xe619('0x2')]},'data2':{'type':Sequelize[_0xe619('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xe619('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0cba=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x465d21,_0x1feb87){var _0x5c8961=function(_0xf97e62){while(--_0xf97e62){_0x465d21['push'](_0x465d21['shift']());}};_0x5c8961(++_0x1feb87);}(_0x0cba,0xed));var _0xa0cb=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0x0cba[_0x14477e];return _0x5d4a05;};'use strict';var Sequelize=require(_0xa0cb('0x0'));module[_0xa0cb('0x1')]={'license':{'type':Sequelize[_0xa0cb('0x2')]},'data1':{'type':Sequelize[_0xa0cb('0x3')]},'data2':{'type':Sequelize[_0xa0cb('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xa0cb('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index ee7efb8..e13cfa6 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 _0x8682=['name','send','index','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','merge','options','catch','body','find','params','get','checkLicense','key','demo','log','xcally','attachment;\x20filename=','Content-Type','text/plain','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','sendStatus','error','stack'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x8682,0x1dc));var _0x2868=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8682[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2868('0x0'));var jsonpatch=require(_0x2868('0x1'));var rp=require(_0x2868('0x2'));var moment=require(_0x2868('0x3'));var BPromise=require(_0x2868('0x4'));var Mustache=require('mustache');var util=require(_0x2868('0x5'));var path=require(_0x2868('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2868('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2868('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2868('0x9'));var deskjs=require(_0x2868('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2868('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2868('0xc'));var qs=require(_0x2868('0xd'));var as=require(_0x2868('0xe'));var hardwareService=require(_0x2868('0xf'));var logger=require(_0x2868('0x10'))('api');var utils=require(_0x2868('0x11'));var config=require(_0x2868('0x12'));var licenseUtil=require(_0x2868('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29c69d,_0x59c8a5){_0x59c8a5=_0x59c8a5||0xcc;return function(_0x7c2fd0){if(_0x7c2fd0){return _0x29c69d['sendStatus'](_0x59c8a5);}return _0x29c69d[_0x2868('0x14')](_0x59c8a5)[_0x2868('0x15')]();};}function respondWithResult(_0x169411,_0x2b0d99){_0x2b0d99=_0x2b0d99||0xc8;return function(_0x2142f7){if(_0x2142f7){return _0x169411['status'](_0x2b0d99)[_0x2868('0x16')](_0x2142f7);}};}function respondWithFilteredResult(_0x13d58c,_0x378623){return function(_0x2b8424){if(_0x2b8424){var _0x4944d3=typeof _0x378623[_0x2868('0x17')]===_0x2868('0x18')&&typeof _0x378623['limit']===_0x2868('0x18');var _0x25d5f1=_0x2b8424['count'];var _0xe1bb6f=_0x4944d3?0x0:_0x378623[_0x2868('0x17')];var _0x26104a=_0x4944d3?_0x2b8424[_0x2868('0x19')]:_0x378623[_0x2868('0x17')]+_0x378623[_0x2868('0x1a')];var _0x5a9e95;if(_0x26104a>=_0x25d5f1){_0x26104a=_0x25d5f1;_0x5a9e95=0xc8;}else{_0x5a9e95=0xce;}_0x13d58c[_0x2868('0x14')](_0x5a9e95);return _0x13d58c[_0x2868('0x1b')]('Content-Range',_0xe1bb6f+'-'+_0x26104a+'/'+_0x25d5f1)['json'](_0x2b8424);}return null;};}function patchUpdates(_0x50bde7){return function(_0x1dbed9){try{jsonpatch[_0x2868('0x1c')](_0x1dbed9,_0x50bde7,!![]);}catch(_0x4ec44a){return BPromise[_0x2868('0x1d')](_0x4ec44a);}return _0x1dbed9['save']();};}function saveUpdates(_0x3dad87,_0x19ac95){return function(_0x1dc636){if(_0x1dc636){return _0x1dc636[_0x2868('0x1e')](_0x3dad87)[_0x2868('0x1f')](function(_0x2c5176){return _0x2c5176;});}return null;};}function removeEntity(_0x1a1069,_0x4d2991){return function(_0x279363){if(_0x279363){return _0x279363[_0x2868('0x20')]()[_0x2868('0x1f')](function(){_0x1a1069[_0x2868('0x14')](0xcc)[_0x2868('0x15')]();});}};}function handleEntityNotFound(_0x1daad7,_0x3d3aa3){return function(_0x41ea90){if(!_0x41ea90){_0x1daad7[_0x2868('0x21')](0x194);}return _0x41ea90;};}function handleError(_0x53d291,_0x286552){_0x286552=_0x286552||0x1f4;return function(_0x57aa56){logger[_0x2868('0x22')](_0x57aa56[_0x2868('0x23')]);if(_0x57aa56[_0x2868('0x24')]){delete _0x57aa56[_0x2868('0x24')];}_0x53d291[_0x2868('0x14')](_0x286552)[_0x2868('0x25')](_0x57aa56);};}var utilLicense=require(_0x2868('0x13'));exports[_0x2868('0x26')]=function(_0x47ee21,_0x2a7170){var _0x33f0d0={'raw':!![],'where':{'id':0x1}},_0x25f5bf={};_0x25f5bf['model']=_['keys'](db['License'][_0x2868('0x27')]);_0x25f5bf[_0x2868('0x28')]=_[_0x2868('0x29')](_0x47ee21[_0x2868('0x28')]);_0x25f5bf[_0x2868('0x2a')]=_[_0x2868('0x2b')](_0x25f5bf[_0x2868('0x2c')],_0x25f5bf[_0x2868('0x28')]);_0x33f0d0[_0x2868('0x2d')]=_['intersection'](_0x25f5bf[_0x2868('0x2c')],qs['fields'](_0x47ee21['query'][_0x2868('0x2e')]));_0x33f0d0[_0x2868('0x2d')]=_0x33f0d0[_0x2868('0x2d')][_0x2868('0x2f')]?_0x33f0d0['attributes']:_0x25f5bf[_0x2868('0x2c')];_0x33f0d0=_[_0x2868('0x30')]({},_0x33f0d0,_0x47ee21[_0x2868('0x31')]);return utilLicense['getLicense'](_0x33f0d0)[_0x2868('0x1f')](respondWithResult(_0x2a7170,null))[_0x2868('0x32')](handleError(_0x2a7170,null));};exports[_0x2868('0x1e')]=function(_0x46823a,_0x1e7ee8){if(_0x46823a[_0x2868('0x33')]['id']){delete _0x46823a[_0x2868('0x33')]['id'];}return db['License'][_0x2868('0x34')]({'where':{'id':_0x46823a[_0x2868('0x35')]['id']}})['then'](handleEntityNotFound(_0x1e7ee8,null))[_0x2868('0x1f')](function(_0xc865da){var _0x5386b1=_0xc865da[_0x2868('0x36')]({'plain':!![]});return utilLicense[_0x2868('0x37')](_0x5386b1,_0x46823a[_0x2868('0x33')][_0x2868('0x38')]);})[_0x2868('0x1f')](function(_0x14a17f){if(!_0x14a17f[_0x2868('0x39')]){return saveUpdates(_0x46823a[_0x2868('0x33')],null);}return _0x14a17f;})[_0x2868('0x1f')](respondWithResult(_0x1e7ee8,null))[_0x2868('0x32')](handleError(_0x1e7ee8,null));};exports['downloadLogFile']=function(_0x2ff526,_0x53c266){var _0x8d2f2f='license-info.log';var _0x5d11c3=path['join']('/var',_0x2868('0x3a'),_0x2868('0x3b'),_0x8d2f2f);_0x53c266['setHeader']('Content-disposition',_0x2868('0x3c')+_0x8d2f2f);_0x53c266['set'](_0x2868('0x3d'),_0x2868('0x3e'));_0x53c266[_0x2868('0x3f')](_0x5d11c3);}; \ No newline at end of file +var _0xc223=['downloadLogFile','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','model','License','rawAttributes','query','filters','intersection','attributes','fields','length','options','catch','body','find','get','key'];(function(_0x300ba2,_0xe84fce){var _0x4c780d=function(_0x531858){while(--_0x531858){_0x300ba2['push'](_0x300ba2['shift']());}};_0x4c780d(++_0xe84fce);}(_0xc223,0xde));var _0x3c22=function(_0x16ab8a,_0x1fce17){_0x16ab8a=_0x16ab8a-0x0;var _0x313bec=_0xc223[_0x16ab8a];return _0x313bec;};'use strict';var emlformat=require(_0x3c22('0x0'));var rimraf=require(_0x3c22('0x1'));var zipdir=require(_0x3c22('0x2'));var jsonpatch=require(_0x3c22('0x3'));var rp=require(_0x3c22('0x4'));var moment=require('moment');var BPromise=require(_0x3c22('0x5'));var Mustache=require(_0x3c22('0x6'));var util=require(_0x3c22('0x7'));var path=require(_0x3c22('0x8'));var sox=require(_0x3c22('0x9'));var csv=require(_0x3c22('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c22('0xb'));var _=require(_0x3c22('0xc'));var squel=require(_0x3c22('0xd'));var crypto=require(_0x3c22('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c22('0xa'));var querystring=require(_0x3c22('0xf'));var Papa=require(_0x3c22('0x10'));var Redis=require(_0x3c22('0x11'));var authService=require(_0x3c22('0x12'));var qs=require(_0x3c22('0x13'));var as=require(_0x3c22('0x14'));var hardwareService=require(_0x3c22('0x15'));var logger=require(_0x3c22('0x16'))(_0x3c22('0x17'));var utils=require(_0x3c22('0x18'));var config=require(_0x3c22('0x19'));var licenseUtil=require(_0x3c22('0x1a'));var db=require(_0x3c22('0x1b'))['db'];function respondWithStatusCode(_0x47f739,_0x775df4){_0x775df4=_0x775df4||0xcc;return function(_0xaf65e8){if(_0xaf65e8){return _0x47f739[_0x3c22('0x1c')](_0x775df4);}return _0x47f739['status'](_0x775df4)[_0x3c22('0x1d')]();};}function respondWithResult(_0x3bcc7f,_0x30393d){_0x30393d=_0x30393d||0xc8;return function(_0x5d037e){if(_0x5d037e){return _0x3bcc7f[_0x3c22('0x1e')](_0x30393d)['json'](_0x5d037e);}};}function respondWithFilteredResult(_0x469098,_0x277b6f){return function(_0x5b8d6b){if(_0x5b8d6b){var _0x2f8e7e=typeof _0x277b6f[_0x3c22('0x1f')]===_0x3c22('0x20')&&typeof _0x277b6f[_0x3c22('0x21')]===_0x3c22('0x20');var _0x322fb8=_0x5b8d6b['count'];var _0x451f85=_0x2f8e7e?0x0:_0x277b6f[_0x3c22('0x1f')];var _0x573f44=_0x2f8e7e?_0x5b8d6b['count']:_0x277b6f[_0x3c22('0x1f')]+_0x277b6f[_0x3c22('0x21')];var _0x385e1;if(_0x573f44>=_0x322fb8){_0x573f44=_0x322fb8;_0x385e1=0xc8;}else{_0x385e1=0xce;}_0x469098[_0x3c22('0x1e')](_0x385e1);return _0x469098[_0x3c22('0x22')](_0x3c22('0x23'),_0x451f85+'-'+_0x573f44+'/'+_0x322fb8)[_0x3c22('0x24')](_0x5b8d6b);}return null;};}function patchUpdates(_0x48d039){return function(_0x1e1065){try{jsonpatch[_0x3c22('0x25')](_0x1e1065,_0x48d039,!![]);}catch(_0x15c9fe){return BPromise[_0x3c22('0x26')](_0x15c9fe);}return _0x1e1065[_0x3c22('0x27')]();};}function saveUpdates(_0x10db78,_0x17bd83){return function(_0x3da8ae){if(_0x3da8ae){return _0x3da8ae[_0x3c22('0x28')](_0x10db78)[_0x3c22('0x29')](function(_0x105b4c){return _0x105b4c;});}return null;};}function removeEntity(_0x45fc23,_0x41f225){return function(_0x2a6322){if(_0x2a6322){return _0x2a6322[_0x3c22('0x2a')]()[_0x3c22('0x29')](function(){_0x45fc23[_0x3c22('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38ead,_0x24b6be){return function(_0x56af30){if(!_0x56af30){_0x38ead[_0x3c22('0x1c')](0x194);}return _0x56af30;};}function handleError(_0x38b683,_0x2b4e0d){_0x2b4e0d=_0x2b4e0d||0x1f4;return function(_0x290c27){logger[_0x3c22('0x2b')](_0x290c27['stack']);if(_0x290c27[_0x3c22('0x2c')]){delete _0x290c27[_0x3c22('0x2c')];}_0x38b683[_0x3c22('0x1e')](_0x2b4e0d)[_0x3c22('0x2d')](_0x290c27);};}var utilLicense=require(_0x3c22('0x1a'));exports[_0x3c22('0x2e')]=function(_0x42e84f,_0x4cf34c){var _0x5198d7={'raw':!![],'where':{'id':0x1}},_0x275dd5={};_0x275dd5[_0x3c22('0x2f')]=_['keys'](db[_0x3c22('0x30')][_0x3c22('0x31')]);_0x275dd5[_0x3c22('0x32')]=_['keys'](_0x42e84f[_0x3c22('0x32')]);_0x275dd5[_0x3c22('0x33')]=_[_0x3c22('0x34')](_0x275dd5[_0x3c22('0x2f')],_0x275dd5[_0x3c22('0x32')]);_0x5198d7[_0x3c22('0x35')]=_['intersection'](_0x275dd5[_0x3c22('0x2f')],qs[_0x3c22('0x36')](_0x42e84f[_0x3c22('0x32')][_0x3c22('0x36')]));_0x5198d7['attributes']=_0x5198d7['attributes'][_0x3c22('0x37')]?_0x5198d7['attributes']:_0x275dd5[_0x3c22('0x2f')];_0x5198d7=_['merge']({},_0x5198d7,_0x42e84f[_0x3c22('0x38')]);return utilLicense['getLicense'](_0x5198d7)[_0x3c22('0x29')](respondWithResult(_0x4cf34c,null))[_0x3c22('0x39')](handleError(_0x4cf34c,null));};exports[_0x3c22('0x28')]=function(_0x1360ab,_0x1eb46d){if(_0x1360ab[_0x3c22('0x3a')]['id']){delete _0x1360ab['body']['id'];}return db[_0x3c22('0x30')][_0x3c22('0x3b')]({'where':{'id':_0x1360ab['params']['id']}})[_0x3c22('0x29')](handleEntityNotFound(_0x1eb46d,null))['then'](function(_0x42ceca){var _0x12bd0f=_0x42ceca[_0x3c22('0x3c')]({'plain':!![]});return utilLicense['checkLicense'](_0x12bd0f,_0x1360ab[_0x3c22('0x3a')][_0x3c22('0x3d')]);})[_0x3c22('0x29')](function(_0x29e243){if(!_0x29e243['demo']){return saveUpdates(_0x1360ab[_0x3c22('0x3a')],null);}return _0x29e243;})[_0x3c22('0x29')](respondWithResult(_0x1eb46d,null))[_0x3c22('0x39')](handleError(_0x1eb46d,null));};exports[_0x3c22('0x3e')]=function(_0x20e2b2,_0x4adc37){var _0x248f1b='license-info.log';var _0x50f9eb=path['join'](_0x3c22('0x3f'),_0x3c22('0x40'),_0x3c22('0x41'),_0x248f1b);_0x4adc37[_0x3c22('0x42')](_0x3c22('0x43'),_0x3c22('0x44')+_0x248f1b);_0x4adc37['set'](_0x3c22('0x45'),_0x3c22('0x46'));_0x4adc37['download'](_0x50f9eb);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 5b838bf..f054291 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 _0x312c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','license','lodash'];(function(_0x2f21da,_0x1f2993){var _0x6fb44d=function(_0x54254d){while(--_0x54254d){_0x2f21da['push'](_0x2f21da['shift']());}};_0x6fb44d(++_0x1f2993);}(_0x312c,0xe0));var _0xc312=function(_0xde6aac,_0x590ed9){_0xde6aac=_0xde6aac-0x0;var _0x5a71a1=_0x312c[_0xde6aac];return _0x5a71a1;};'use strict';var _=require(_0xc312('0x0'));var util=require('util');var logger=require(_0xc312('0x1'))(_0xc312('0x2'));var moment=require(_0xc312('0x3'));var BPromise=require(_0xc312('0x4'));var rp=require(_0xc312('0x5'));var fs=require('fs');var path=require(_0xc312('0x6'));var rimraf=require(_0xc312('0x7'));var config=require('../../config/environment');var attributes=require('./license.attributes');module['exports']=function(_0x541e5d,_0x2f8226){return _0x541e5d['define']('License',attributes,{'tableName':_0xc312('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee0c=['moment','bluebird','path','rimraf','./license.attributes','license','util','../../config/logger'];(function(_0x2b5815,_0xe9501b){var _0x5b1f8b=function(_0x5d8dc3){while(--_0x5d8dc3){_0x2b5815['push'](_0x2b5815['shift']());}};_0x5b1f8b(++_0xe9501b);}(_0xee0c,0x10e));var _0xcee0=function(_0x2a7f3f,_0xff5dc6){_0x2a7f3f=_0x2a7f3f-0x0;var _0x47a609=_0xee0c[_0x2a7f3f];return _0x47a609;};'use strict';var _=require('lodash');var util=require(_0xcee0('0x0'));var logger=require(_0xcee0('0x1'))('api');var moment=require(_0xcee0('0x2'));var BPromise=require(_0xcee0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcee0('0x4'));var rimraf=require(_0xcee0('0x5'));var config=require('../../config/environment');var attributes=require(_0xcee0('0x6'));module['exports']=function(_0x3a1bbc,_0x5dad6a){return _0x3a1bbc['define']('License',attributes,{'tableName':_0xcee0('0x7'),'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 a555acd..a6a9906 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 _0x4a85=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util'];(function(_0x5443c6,_0x544e39){var _0x2a0bab=function(_0x509dbe){while(--_0x509dbe){_0x5443c6['push'](_0x5443c6['shift']());}};_0x2a0bab(++_0x544e39);}(_0x4a85,0xcd));var _0x54a8=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x4a85[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x54a8('0x0'));var util=require(_0x54a8('0x1'));var moment=require(_0x54a8('0x2'));var BPromise=require(_0x54a8('0x3'));var rs=require(_0x54a8('0x4'));var fs=require('fs');var Redis=require(_0x54a8('0x5'));var db=require(_0x54a8('0x6'))['db'];var utils=require(_0x54a8('0x7'));var logger=require(_0x54a8('0x8'))(_0x54a8('0x9'));var config=require(_0x54a8('0xa'));var jayson=require(_0x54a8('0xb'));var client=jayson[_0x54a8('0xc')][_0x54a8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x22ffe4,_0x135be1,_0x52ab13){return new BPromise(function(_0x11a61c,_0x6445ba){return client['request'](_0x22ffe4,_0x52ab13)[_0x54a8('0xe')](function(_0x421775){logger[_0x54a8('0xf')](_0x54a8('0x10'),_0x135be1,'request\x20sent');logger[_0x54a8('0x11')](_0x54a8('0x12'),_0x135be1,_0x54a8('0x13'),JSON['stringify'](_0x421775));if(_0x421775[_0x54a8('0x14')]){if(_0x421775['error']['code']===0x1f4){logger[_0x54a8('0x14')](_0x54a8('0x10'),_0x135be1,_0x421775[_0x54a8('0x14')][_0x54a8('0x15')]);return _0x6445ba(_0x421775['error'][_0x54a8('0x15')]);}logger[_0x54a8('0x14')](_0x54a8('0x10'),_0x135be1,_0x421775['error'][_0x54a8('0x15')]);return _0x11a61c(_0x421775[_0x54a8('0x14')][_0x54a8('0x15')]);}else{logger[_0x54a8('0xf')](_0x54a8('0x10'),_0x135be1,_0x54a8('0x13'));_0x11a61c(_0x421775[_0x54a8('0x16')][_0x54a8('0x15')]);}})['catch'](function(_0x17b144){logger[_0x54a8('0x14')](_0x54a8('0x10'),_0x135be1,_0x17b144);_0x6445ba(_0x17b144);});});} \ No newline at end of file +var _0x3820=['request','then','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2417a0,_0x20ea27){var _0x113f27=function(_0x3cb0b4){while(--_0x3cb0b4){_0x2417a0['push'](_0x2417a0['shift']());}};_0x113f27(++_0x20ea27);}(_0x3820,0x14c));var _0x0382=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0x3820[_0x836465];return _0x2150ea;};'use strict';var _=require('lodash');var util=require(_0x0382('0x0'));var moment=require(_0x0382('0x1'));var BPromise=require(_0x0382('0x2'));var rs=require(_0x0382('0x3'));var fs=require('fs');var Redis=require(_0x0382('0x4'));var db=require(_0x0382('0x5'))['db'];var utils=require(_0x0382('0x6'));var logger=require(_0x0382('0x7'))(_0x0382('0x8'));var config=require(_0x0382('0x9'));var jayson=require(_0x0382('0xa'));var client=jayson[_0x0382('0xb')][_0x0382('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3315a6,_0xfaf3e7,_0x3f89aa){return new BPromise(function(_0x5556f0,_0x193785){return client[_0x0382('0xd')](_0x3315a6,_0x3f89aa)[_0x0382('0xe')](function(_0x261ccb){logger['info'](_0x0382('0xf'),_0xfaf3e7,_0x0382('0x10'));logger[_0x0382('0x11')]('License,\x20%s,\x20%s,\x20%s',_0xfaf3e7,'request\x20sent',JSON[_0x0382('0x12')](_0x261ccb));if(_0x261ccb[_0x0382('0x13')]){if(_0x261ccb[_0x0382('0x13')][_0x0382('0x14')]===0x1f4){logger[_0x0382('0x13')](_0x0382('0xf'),_0xfaf3e7,_0x261ccb['error']['message']);return _0x193785(_0x261ccb['error']['message']);}logger[_0x0382('0x13')](_0x0382('0xf'),_0xfaf3e7,_0x261ccb[_0x0382('0x13')][_0x0382('0x15')]);return _0x5556f0(_0x261ccb[_0x0382('0x13')][_0x0382('0x15')]);}else{logger['info'](_0x0382('0xf'),_0xfaf3e7,'request\x20sent');_0x5556f0(_0x261ccb[_0x0382('0x16')][_0x0382('0x15')]);}})['catch'](function(_0x2ac843){logger[_0x0382('0x13')](_0x0382('0xf'),_0xfaf3e7,_0x2ac843);_0x193785(_0x2ac843);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ebc1326..8dde5aa 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 _0x0f1f=['send','put','removeAnswers','delete','removeSmtp','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addInteraction','/:id/applications','addApplications','/:id/send'];(function(_0x5a0dac,_0x30edd8){var _0xe0eaac=function(_0x5de0d5){while(--_0x5de0d5){_0x5a0dac['push'](_0x5a0dac['shift']());}};_0xe0eaac(++_0x30edd8);}(_0x0f1f,0x1df));var _0xf0f1=function(_0x481892,_0x347870){_0x481892=_0x481892-0x0;var _0x18f31f=_0x0f1f[_0x481892];return _0x18f31f;};'use strict';var multer=require('multer');var util=require(_0xf0f1('0x0'));var path=require(_0xf0f1('0x1'));var timeout=require(_0xf0f1('0x2'));var express=require(_0xf0f1('0x3'));var router=express[_0xf0f1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf0f1('0x5'));var config=require('../../config/environment');var controller=require(_0xf0f1('0x6'));router[_0xf0f1('0x7')]('/',auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x9')]);router['get'](_0xf0f1('0xa'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0xb')]);router[_0xf0f1('0x7')](_0xf0f1('0xc'),auth[_0xf0f1('0x8')](),controller['show']);router[_0xf0f1('0x7')](_0xf0f1('0xd'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0xe')]);router[_0xf0f1('0x7')](_0xf0f1('0xf'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x10')]);router[_0xf0f1('0x7')](_0xf0f1('0x11'),auth['isAuthenticated'](),controller[_0xf0f1('0x12')]);router['get'](_0xf0f1('0x13'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x14')]);router['get'](_0xf0f1('0x15'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x16')]);router[_0xf0f1('0x7')]('/:id/applications',auth[_0xf0f1('0x8')](),controller['getApplications']);router[_0xf0f1('0x7')](_0xf0f1('0x17'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xf0f1('0x18'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x19')]);router[_0xf0f1('0x7')](_0xf0f1('0x1a'),auth['isAuthenticated'](),controller[_0xf0f1('0x1b')]);router[_0xf0f1('0x1c')](_0xf0f1('0xd'),auth['isAuthenticated'](),controller[_0xf0f1('0x1d')]);router[_0xf0f1('0x1c')](_0xf0f1('0xf'),auth['isAuthenticated'](),controller[_0xf0f1('0x1e')]);router[_0xf0f1('0x1c')]('/',auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x1f')]);router[_0xf0f1('0x1c')](_0xf0f1('0x11'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x20')]);router[_0xf0f1('0x1c')](_0xf0f1('0x13'),auth[_0xf0f1('0x8')](),controller['addSmtp']);router[_0xf0f1('0x1c')](_0xf0f1('0x15'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x21')]);router[_0xf0f1('0x1c')](_0xf0f1('0x22'),auth['isAuthenticated'](),controller[_0xf0f1('0x23')]);router[_0xf0f1('0x1c')](_0xf0f1('0x24'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x25')]);router[_0xf0f1('0x1c')](_0xf0f1('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf0f1('0x26')](_0xf0f1('0xc'),auth[_0xf0f1('0x8')](),controller['update']);router['delete'](_0xf0f1('0xd'),auth[_0xf0f1('0x8')](),controller['removeDispositions']);router['delete'](_0xf0f1('0xf'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x27')]);router[_0xf0f1('0x28')](_0xf0f1('0x11'),auth[_0xf0f1('0x8')](),controller['removeImap']);router['delete'](_0xf0f1('0x13'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x29')]);router[_0xf0f1('0x28')](_0xf0f1('0xc'),auth[_0xf0f1('0x8')](),controller[_0xf0f1('0x2a')]);router[_0xf0f1('0x28')]('/:id/users',auth[_0xf0f1('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xadb1=['/:id/send','/:id/users','addAgents','update','/:id/dispositions','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','/:id/applications','/:id/messages','getMessages','verifySmtp','getAgents','post','addAnswer','create','addSmtp','/:id/interactions','addApplications'];(function(_0x1009ec,_0x424c79){var _0x1fa922=function(_0x30fb90){while(--_0x30fb90){_0x1009ec['push'](_0x1009ec['shift']());}};_0x1fa922(++_0x424c79);}(_0xadb1,0x1ad));var _0x1adb=function(_0x8d4d2c,_0x4e6c25){_0x8d4d2c=_0x8d4d2c-0x0;var _0x2113b9=_0xadb1[_0x8d4d2c];return _0x2113b9;};'use strict';var multer=require(_0x1adb('0x0'));var util=require(_0x1adb('0x1'));var path=require(_0x1adb('0x2'));var timeout=require(_0x1adb('0x3'));var express=require('express');var router=express[_0x1adb('0x4')]();var fs_extra=require(_0x1adb('0x5'));var auth=require(_0x1adb('0x6'));var interaction=require(_0x1adb('0x7'));var config=require(_0x1adb('0x8'));var controller=require('./mailAccount.controller');router[_0x1adb('0x9')]('/',auth[_0x1adb('0xa')](),controller[_0x1adb('0xb')]);router[_0x1adb('0x9')](_0x1adb('0xc'),auth[_0x1adb('0xa')](),controller[_0x1adb('0xd')]);router['get'](_0x1adb('0xe'),auth['isAuthenticated'](),controller[_0x1adb('0xf')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1adb('0x10')]);router[_0x1adb('0x9')](_0x1adb('0x11'),auth[_0x1adb('0xa')](),controller['getAnswers']);router[_0x1adb('0x9')](_0x1adb('0x12'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x13')]);router[_0x1adb('0x9')](_0x1adb('0x14'),auth[_0x1adb('0xa')](),controller['getSmtp']);router['get']('/:id/interactions',auth[_0x1adb('0xa')](),controller[_0x1adb('0x15')]);router[_0x1adb('0x9')](_0x1adb('0x16'),auth[_0x1adb('0xa')](),controller['getApplications']);router[_0x1adb('0x9')](_0x1adb('0x17'),auth['isAuthenticated'](),controller[_0x1adb('0x18')]);router[_0x1adb('0x9')]('/:id/verify',auth[_0x1adb('0xa')](),controller[_0x1adb('0x19')]);router[_0x1adb('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x1adb('0x1a')]);router[_0x1adb('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x1adb('0x1b')](_0x1adb('0x11'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x1c')]);router[_0x1adb('0x1b')]('/',auth[_0x1adb('0xa')](),controller[_0x1adb('0x1d')]);router['post']('/:id/in_servers',auth['isAuthenticated'](),controller['addImap']);router[_0x1adb('0x1b')](_0x1adb('0x14'),auth['isAuthenticated'](),controller[_0x1adb('0x1e')]);router[_0x1adb('0x1b')](_0x1adb('0x1f'),auth[_0x1adb('0xa')](),controller['addInteraction']);router['post'](_0x1adb('0x16'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x20')]);router['post'](_0x1adb('0x21'),auth[_0x1adb('0xa')](),controller['send']);router[_0x1adb('0x1b')](_0x1adb('0x22'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x23')]);router['put'](_0x1adb('0xe'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x24')]);router['delete'](_0x1adb('0x25'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x1adb('0x26')](_0x1adb('0x11'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x1adb('0x26')](_0x1adb('0x12'),auth[_0x1adb('0xa')](),controller['removeImap']);router[_0x1adb('0x26')](_0x1adb('0x14'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x1adb('0x26')](_0x1adb('0xe'),auth[_0x1adb('0xa')](),controller[_0x1adb('0x27')]);router[_0x1adb('0x26')]('/:id/users',auth['isAuthenticated'](),controller[_0x1adb('0x28')]);module[_0x1adb('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 771297e..2fda9e3 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 _0xdc9e=['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','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x10f80a,_0x3fca40){var _0x13d794=function(_0x4e6ca4){while(--_0x4e6ca4){_0x10f80a['push'](_0x10f80a['shift']());}};_0x13d794(++_0x3fca40);}(_0xdc9e,0xdf));var _0xedc9=function(_0xa363e5,_0x14c9ed){_0xa363e5=_0xa363e5-0x0;var _0x4c38a3=_0xdc9e[_0xa363e5];return _0x4c38a3;};'use strict';var Sequelize=require(_0xedc9('0x0'));module[_0xedc9('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xedc9('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0xedc9('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xedc9('0x3')],'allowNull':![],'defaultValue':_0xedc9('0x5')},'fontSize':{'type':Sequelize[_0xedc9('0x6')](0x2)[_0xedc9('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xedc9('0x4')],'defaultValue':function(){return _0xedc9('0x8');}},'notificationSound':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xedc9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xedc9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xedc9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xedc9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xedc9('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xedc9('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x207bf5){if(!_0x207bf5)this[_0xedc9('0xa')](_0xedc9('0xb'),null);this[_0xedc9('0xa')](_0xedc9('0xc'),_0x207bf5);}},'provider':{'type':Sequelize[_0xedc9('0xd')](_0xedc9('0xe'),_0xedc9('0xf'),_0xedc9('0x10'),_0xedc9('0x11')),'defaultValue':null,'get':function(){if(!this[_0xedc9('0x12')](_0xedc9('0x13')))return _0xedc9('0x14');return this[_0xedc9('0x12')]('provider');},'set':function(_0x3a2222){if(_0x3a2222===_0xedc9('0x14'))_0x3a2222=null;return this[_0xedc9('0xa')]('provider',_0x3a2222);}}}; \ No newline at end of file +var _0xbf87=['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','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','getDataValue','provider','custom','sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x65d8cd,_0x5407ad){var _0x320d76=function(_0x27e437){while(--_0x27e437){_0x65d8cd['push'](_0x65d8cd['shift']());}};_0x320d76(++_0x5407ad);}(_0xbf87,0x1c6));var _0x7bf8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbf87[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7bf8('0x0'));module[_0x7bf8('0x1')]={'description':{'type':Sequelize[_0x7bf8('0x2')]},'name':{'type':Sequelize[_0x7bf8('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7bf8('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x7bf8('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7bf8('0x3')]},'markAsUnread':{'type':Sequelize[_0x7bf8('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7bf8('0x2')],'allowNull':![],'defaultValue':_0x7bf8('0x5')},'fontSize':{'type':Sequelize[_0x7bf8('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7bf8('0x7');}},'notificationSound':{'type':Sequelize[_0x7bf8('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7bf8('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7bf8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7bf8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7bf8('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7bf8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7bf8('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x7bf8('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x39fae4){if(!_0x39fae4)this[_0x7bf8('0x9')](_0x7bf8('0xa'),null);this[_0x7bf8('0x9')](_0x7bf8('0xb'),_0x39fae4);}},'provider':{'type':Sequelize[_0x7bf8('0xc')](_0x7bf8('0xd'),'hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this[_0x7bf8('0xe')](_0x7bf8('0xf')))return _0x7bf8('0x10');return this[_0x7bf8('0xe')](_0x7bf8('0xf'));},'set':function(_0x1992b9){if(_0x1992b9===_0x7bf8('0x10'))_0x1992b9=null;return this[_0x7bf8('0x9')](_0x7bf8('0xf'),_0x1992b9);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 6eb73b9..01de129 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 _0x439d=['includeAll','include','findAll','rows','params','Pause','intersection','fields','length','options','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','filter','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','key','custom','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','stack','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','moment','util','path','lodash','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','update','destroy','get','MailAccounts','name','gmail','imap.mail.yahoo.com','hotmail','outlook365','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','keys','query','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x439d,0x6f));var _0xd439=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x439d[_0x20c9b2];return _0x2c6030;};'use strict';var moment=require(_0xd439('0x0'));var BPromise=require('bluebird');var util=require(_0xd439('0x1'));var path=require(_0xd439('0x2'));var _=require(_0xd439('0x3'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0xd439('0x4'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xd439('0x5'))['db'];config[_0xd439('0x6')]=_[_0xd439('0x7')](config[_0xd439('0x6')],{'host':_0xd439('0x8'),'port':0x18eb});var socket=require(_0xd439('0x9'))(new Redis(config['redis']));require(_0xd439('0xa'))[_0xd439('0xb')](socket);var jayson=require(_0xd439('0xc'));var client=jayson['client'][_0xd439('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x50afff,_0x52288f,_0x3c1291,_0x2c6992){return new BPromise(function(_0xea7818,_0x5b9fdd){var _0x3bb0fc=_0x2c6992||client;return _0x3bb0fc[_0xd439('0xe')](_0x50afff,_0x3c1291)[_0xd439('0xf')](function(_0x5f12d4){logger[_0xd439('0x10')](_0xd439('0x11'),_0x52288f,'request\x20sent');logger[_0xd439('0x12')](_0xd439('0x13'),_0x52288f,_0xd439('0x14'),JSON['stringify'](_0x5f12d4));if(_0x5f12d4[_0xd439('0x15')]){if(_0x5f12d4[_0xd439('0x15')][_0xd439('0x16')]===0x1f4){logger['error'](_0xd439('0x11'),_0x52288f,_0x5f12d4[_0xd439('0x15')]['message']);return _0x5b9fdd(_0x5f12d4[_0xd439('0x15')][_0xd439('0x17')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x52288f,_0x5f12d4['error'][_0xd439('0x17')]);return _0xea7818(_0x5f12d4['error'][_0xd439('0x17')]);}else{logger[_0xd439('0x10')](_0xd439('0x11'),_0x52288f,_0xd439('0x14'));_0xea7818(_0x5f12d4['result'][_0xd439('0x17')]);}})[_0xd439('0x18')](function(_0x29d296){logger['error']('MailAccount,\x20%s,\x20%s',_0x52288f,_0x29d296);_0x5b9fdd(_0x29d296);});});}function respondWithStatusCode(_0x27ec02,_0x6f9e06){_0x6f9e06=_0x6f9e06||0xcc;return function(_0x24d5e5){if(_0x24d5e5){return _0x27ec02[_0xd439('0x19')](_0x6f9e06);}return _0x27ec02[_0xd439('0x1a')](_0x6f9e06)[_0xd439('0x1b')]();};}function respondWithResult(_0x87c003,_0x485bc9){_0x485bc9=_0x485bc9||0xc8;return function(_0x39cfbd){if(_0x39cfbd){return _0x87c003['status'](_0x485bc9)['json'](_0x39cfbd);}};}function respondWithFilteredResult(_0x150b69,_0x1ae7a6){return function(_0x54714a){if(_0x54714a){var _0x44aa7a=typeof _0x1ae7a6['offset']===_0xd439('0x1c')&&typeof _0x1ae7a6[_0xd439('0x1d')]===_0xd439('0x1c');var _0x5ca223=_0x54714a[_0xd439('0x1e')];var _0x26760f=_0x44aa7a?0x0:_0x1ae7a6[_0xd439('0x1f')];var _0x1bcee4=_0x44aa7a?_0x54714a[_0xd439('0x1e')]:_0x1ae7a6['offset']+_0x1ae7a6[_0xd439('0x1d')];var _0x404959;if(_0x1bcee4>=_0x5ca223){_0x1bcee4=_0x5ca223;_0x404959=0xc8;}else{_0x404959=0xce;}_0x150b69[_0xd439('0x1a')](_0x404959);return _0x150b69[_0xd439('0x20')](_0xd439('0x21'),_0x26760f+'-'+_0x1bcee4+'/'+_0x5ca223)[_0xd439('0x22')](_0x54714a);}return null;};}function saveUpdates(_0x54675f){return function(_0x447052){if(_0x447052){return _0x447052[_0xd439('0x23')](_0x54675f)[_0xd439('0xf')](function(_0x2b220e){return _0x2b220e;});}return null;};}function removeEntity(_0xedd2cd){return function(_0x25c699){if(_0x25c699){return _0x25c699[_0xd439('0x24')]()['then'](function(){var _0x1614f9=_0x25c699[_0xd439('0x25')]({'plain':!![]});var _0x241f62=_0xd439('0x26');return db['UserProfileResource'][_0xd439('0x24')]({'where':{'type':_0x241f62,'resourceId':_0x1614f9['id']}})[_0xd439('0xf')](function(){return _0x25c699;});})[_0xd439('0xf')](function(){_0xedd2cd[_0xd439('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9381){return function(_0x540b94){if(!_0x540b94){_0x5b9381['sendStatus'](0x194);}return _0x540b94;};}function handleError(_0xc10481,_0x12b5f0){_0x12b5f0=_0x12b5f0||0x1f4;return function(_0x2cb34a){logger[_0xd439('0x15')](_0x2cb34a['stack']);if(_0x2cb34a['name']){delete _0x2cb34a[_0xd439('0x27')];}_0xc10481[_0xd439('0x1a')](_0x12b5f0)['send'](_0x2cb34a);};}function getImapHost(_0x1d70ab){switch(_0x1d70ab){case _0xd439('0x28'):return'imap.gmail.com';case'yahoo':return _0xd439('0x29');case _0xd439('0x2a'):return'imap-mail.outlook.com';case _0xd439('0x2b'):return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x1d70ab);}function getSmtpHost(_0x4f5dc6){switch(_0x4f5dc6){case _0xd439('0x28'):return _0xd439('0x2c');case _0xd439('0x2d'):return _0xd439('0x2e');case'hotmail':return _0xd439('0x2f');case _0xd439('0x2b'):return _0xd439('0x30');}throw new Error(_0xd439('0x31'),_0x4f5dc6);}function getAuthenticationOptions(_0x4bb311,_0x30b80e){var _0x247360={};var _0x18707b={};if(_0x4bb311){_0x247360[_0xd439('0x32')]=_0x18707b[_0xd439('0x32')]=_0x30b80e[_0xd439('0x33')];_0x247360[_0xd439('0x34')]=_0x18707b[_0xd439('0x35')]=_0x30b80e['password'];if(_0x30b80e[_0xd439('0x36')]){_0x247360[_0xd439('0x36')]=_0x18707b[_0xd439('0x36')]=!![];_0x247360[_0xd439('0x37')]=_0x18707b[_0xd439('0x37')]=_0x30b80e['CloudProviderId'];_0x247360['password']=_0x18707b[_0xd439('0x35')]=null;}else{_0x247360[_0xd439('0x37')]=_0x18707b[_0xd439('0x37')]=null;}_0x247360[_0xd439('0x38')]=getImapHost(_0x4bb311);_0x247360[_0xd439('0x39')]=0x3e1;_0x18707b[_0xd439('0x38')]=getSmtpHost(_0x4bb311);_0x18707b[_0xd439('0x39')]=0x24b;_0x18707b[_0xd439('0x3a')]=![];_0x247360['service']=_0x18707b[_0xd439('0x3b')]=null;}else{if(_0x30b80e[_0xd439('0x3c')]){_0x247360[_0xd439('0x32')]=_0x18707b[_0xd439('0x32')]=_0x30b80e[_0xd439('0x33')];_0x247360[_0xd439('0x34')]=_0x18707b[_0xd439('0x35')]=_0x30b80e['password'];}else{_0x247360[_0xd439('0x3c')]=_0x18707b[_0xd439('0x3c')]=![];_0x247360['user']=_0x18707b['user']=null;_0x247360[_0xd439('0x34')]=_0x18707b[_0xd439('0x35')]=null;}_0x247360[_0xd439('0x38')]=_0x30b80e[_0xd439('0x3d')][_0xd439('0x38')];_0x247360[_0xd439('0x39')]=_0x30b80e[_0xd439('0x3d')][_0xd439('0x39')];_0x18707b[_0xd439('0x38')]=_0x30b80e['Smtp'][_0xd439('0x38')];_0x18707b[_0xd439('0x39')]=_0x30b80e[_0xd439('0x3e')][_0xd439('0x39')];}return{'Imap':_0x247360,'Smtp':_0x18707b};}exports[_0xd439('0x3f')]=function(_0x5dc341,_0xf884b){var _0x20e436={'include':[{'model':db[_0xd439('0x40')],'as':_0xd439('0x3d')},{'model':db[_0xd439('0x41')],'as':_0xd439('0x3e')},{'model':db['Pause'],'as':_0xd439('0x42')}]},_0x193b0f={},_0x516ade={'count':0x0,'rows':[]};var _0x46599c=_[_0xd439('0x43')](db[_0xd439('0x44')][_0xd439('0x45')],function(_0x5ec6df){return{'name':_0x5ec6df['fieldName'],'type':_0x5ec6df[_0xd439('0x46')]['key']};});_0x193b0f['model']=_[_0xd439('0x43')](_0x46599c,_0xd439('0x27'));_0x193b0f['query']=_[_0xd439('0x47')](_0x5dc341[_0xd439('0x48')]);_0x193b0f['filters']=_['intersection'](_0x193b0f[_0xd439('0x49')],_0x193b0f[_0xd439('0x48')]);_0x20e436[_0xd439('0x4a')]=_['intersection'](_0x193b0f[_0xd439('0x49')],qs['fields'](_0x5dc341[_0xd439('0x48')]['fields']));_0x20e436[_0xd439('0x4a')]=_0x20e436[_0xd439('0x4a')]['length']?_0x20e436[_0xd439('0x4a')]:_0x193b0f[_0xd439('0x49')];if(!_0x5dc341['query'][_0xd439('0x4b')](_0xd439('0x4c'))){_0x20e436[_0xd439('0x1d')]=qs[_0xd439('0x1d')](_0x5dc341['query'][_0xd439('0x1d')]);_0x20e436[_0xd439('0x1f')]=qs[_0xd439('0x1f')](_0x5dc341[_0xd439('0x48')]['offset']);}_0x20e436[_0xd439('0x4d')]=qs['sort'](_0x5dc341[_0xd439('0x48')][_0xd439('0x4e')]);_0x20e436[_0xd439('0x4f')]=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0x5dc341[_0xd439('0x48')],_0x193b0f[_0xd439('0x50')]),_0x46599c);if(_0x5dc341[_0xd439('0x48')]['filter']){_0x20e436[_0xd439('0x4f')]=_[_0xd439('0x52')](_0x20e436[_0xd439('0x4f')],{'$or':_['map'](_0x46599c,function(_0x9da4a1){if(_0x9da4a1[_0xd439('0x46')]!=='VIRTUAL'){var _0x588302={};_0x588302[_0x9da4a1[_0xd439('0x27')]]={'$like':'%'+_0x5dc341['query']['filter']+'%'};return _0x588302;}})});}_0x20e436=_[_0xd439('0x52')]({},_0x20e436,_0x5dc341['options']);var _0x47666a={'where':_0x20e436[_0xd439('0x4f')]};return db[_0xd439('0x44')][_0xd439('0x1e')](_0x47666a)[_0xd439('0xf')](function(_0x1cfd36){_0x516ade[_0xd439('0x1e')]=_0x1cfd36;if(_0x5dc341['query'][_0xd439('0x53')]){_0x20e436[_0xd439('0x54')]=[{'all':!![]}];}return db['MailAccount'][_0xd439('0x55')](_0x20e436);})[_0xd439('0xf')](function(_0x26dd37){_0x516ade[_0xd439('0x56')]=_0x26dd37;return _0x516ade;})[_0xd439('0xf')](respondWithFilteredResult(_0xf884b,_0x20e436))[_0xd439('0x18')](handleError(_0xf884b,null));};exports['show']=function(_0x3c1e8f,_0x43c262){var _0x524e44={'raw':![],'where':{'id':_0x3c1e8f[_0xd439('0x57')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xd439('0x3d')},{'model':db['MailServerOut'],'as':_0xd439('0x3e')},{'model':db[_0xd439('0x58')],'as':_0xd439('0x42')}]},_0x162947={};_0x162947[_0xd439('0x49')]=_[_0xd439('0x47')](db['MailAccount'][_0xd439('0x45')]);_0x162947[_0xd439('0x48')]=_['keys'](_0x3c1e8f['query']);_0x162947['filters']=_['intersection'](_0x162947[_0xd439('0x49')],_0x162947[_0xd439('0x48')]);_0x524e44[_0xd439('0x4a')]=_[_0xd439('0x59')](_0x162947['model'],qs[_0xd439('0x5a')](_0x3c1e8f[_0xd439('0x48')]['fields']));_0x524e44[_0xd439('0x4a')]=_0x524e44['attributes'][_0xd439('0x5b')]?_0x524e44[_0xd439('0x4a')]:_0x162947['model'];if(_0x3c1e8f[_0xd439('0x48')][_0xd439('0x53')]){_0x524e44['include']=[{'all':!![]}];}_0x524e44=_['merge']({},_0x524e44,_0x3c1e8f[_0xd439('0x5c')]);return db[_0xd439('0x44')][_0xd439('0x5d')](_0x524e44)[_0xd439('0xf')](handleEntityNotFound(_0x43c262,null))[_0xd439('0xf')](respondWithResult(_0x43c262,null))[_0xd439('0x18')](handleError(_0x43c262,null));};exports[_0xd439('0x23')]=function(_0x153a8e,_0xe89427){if(_0x153a8e[_0xd439('0x5e')]['id']){delete _0x153a8e[_0xd439('0x5e')]['id'];}var _0x29026b=_0x153a8e['body'][_0xd439('0x5f')]==='custom'?null:_0x153a8e[_0xd439('0x5e')]['provider'];var _0x776448=_0x153a8e['body'][_0xd439('0x3d')]||{};var _0x2327d4=_0x153a8e[_0xd439('0x5e')]['Smtp']||{};if(_0x29026b){_0x776448['host']=getImapHost(_0x29026b);_0x776448[_0xd439('0x39')]=0x3e1;_0x2327d4['host']=getSmtpHost(_0x29026b);_0x2327d4[_0xd439('0x39')]=0x24b;_0x2327d4[_0xd439('0x3a')]=![];}if(_0x2327d4[_0xd439('0x36')]){_0x2327d4[_0xd439('0x3a')]=![];}else{_0x2327d4[_0xd439('0x37')]=null;}if(!_0x776448[_0xd439('0x36')])_0x776448[_0xd439('0x37')]=null;_0x153a8e[_0xd439('0x5e')][_0xd439('0x3d')]=_0x776448;_0x153a8e['body'][_0xd439('0x3e')]=_0x2327d4;return db[_0xd439('0x44')]['find']({'where':{'id':_0x153a8e['params']['id']},'include':[{'model':db[_0xd439('0x40')],'as':_0xd439('0x3d')},{'model':db['MailServerOut'],'as':_0xd439('0x3e')},{'model':db[_0xd439('0x58')],'as':_0xd439('0x42')}]})['then'](handleEntityNotFound(_0xe89427,null))[_0xd439('0xf')](function(_0x14091e){if(!_0x14091e)throw new Error(_0xd439('0x60'));if(_0x14091e[_0xd439('0x3b')])delete _0x153a8e[_0xd439('0x5e')][_0xd439('0x3d')];return _0x14091e;})['then'](saveUpdates(_0x153a8e[_0xd439('0x5e')],null))[_0xd439('0xf')](function(_0x10e292){if(!_0x153a8e[_0xd439('0x5e')][_0xd439('0x3d')])return _0x10e292;return db[_0xd439('0x40')][_0xd439('0x23')](_0x153a8e['body'][_0xd439('0x3d')],{'where':{'MailAccountId':_0x10e292['id']}})[_0xd439('0xf')](function(){return _0x10e292;});})[_0xd439('0xf')](function(_0x44ee81){if(!_0x153a8e[_0xd439('0x5e')][_0xd439('0x3e')])return _0x44ee81;return db[_0xd439('0x41')][_0xd439('0x23')](_0x153a8e[_0xd439('0x5e')][_0xd439('0x3e')],{'where':{'MailAccountId':_0x44ee81['id']}})[_0xd439('0xf')](function(){return _0x44ee81;});})[_0xd439('0xf')](respondWithResult(_0xe89427,null))[_0xd439('0x18')](handleError(_0xe89427,null));};exports[_0xd439('0x61')]=function(_0x2180a2,_0x2655cc){return db['MailAccount']['describe']()[_0xd439('0xf')](respondWithResult(_0x2655cc,null))[_0xd439('0x18')](handleError(_0x2655cc,null));};exports[_0xd439('0x62')]=function(_0x33dc4e,_0x322682){if(_0x33dc4e[_0xd439('0x5e')]['id']){delete _0x33dc4e[_0xd439('0x5e')]['id'];}return db['MailAccount'][_0xd439('0x5d')]({'where':{'id':_0x33dc4e['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x322682,null))['then'](function(_0x21c10e){if(_0x21c10e){_0x33dc4e[_0xd439('0x5e')][_0xd439('0x63')]=_0x21c10e['id'];return db[_0xd439('0x64')][_0xd439('0x65')](_0x33dc4e[_0xd439('0x5e')]);}})[_0xd439('0xf')](respondWithResult(_0x322682,null))[_0xd439('0x18')](handleError(_0x322682,null));};exports[_0xd439('0x66')]=function(_0x255ad6,_0x547af7){var _0x50e915={'raw':![],'where':{}};var _0x20ff04={};var _0x4a7c8c={'count':0x0,'rows':[]};return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x255ad6['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x547af7,null))[_0xd439('0xf')](function(_0x298dcd){if(_0x298dcd){_0x20ff04[_0xd439('0x49')]=_['keys'](db[_0xd439('0x64')][_0xd439('0x45')]);_0x20ff04[_0xd439('0x48')]=_['keys'](_0x255ad6[_0xd439('0x48')]);_0x20ff04[_0xd439('0x50')]=_[_0xd439('0x59')](_0x20ff04[_0xd439('0x49')],_0x20ff04['query']);_0x50e915[_0xd439('0x4a')]=_['intersection'](_0x20ff04['model'],qs['fields'](_0x255ad6[_0xd439('0x48')][_0xd439('0x5a')]));_0x50e915['attributes']=_0x50e915[_0xd439('0x4a')][_0xd439('0x5b')]?_0x50e915['attributes']:_0x20ff04['model'];if(!_0x255ad6[_0xd439('0x48')][_0xd439('0x4b')]('nolimit')){_0x50e915['limit']=qs[_0xd439('0x1d')](_0x255ad6[_0xd439('0x48')][_0xd439('0x1d')]);_0x50e915['offset']=qs[_0xd439('0x1f')](_0x255ad6['query'][_0xd439('0x1f')]);}_0x50e915[_0xd439('0x4d')]=qs['sort'](_0x255ad6['query']['sort']);_0x50e915[_0xd439('0x4f')]=qs[_0xd439('0x50')](_['pick'](_0x255ad6[_0xd439('0x48')],_0x20ff04[_0xd439('0x50')]));_0x50e915[_0xd439('0x4f')][_0xd439('0x63')]=_0x298dcd['id'];if(_0x255ad6[_0xd439('0x48')][_0xd439('0x68')]){_0x50e915['where']=_[_0xd439('0x52')](_0x50e915[_0xd439('0x4f')],{'$or':_[_0xd439('0x43')](_0x50e915['attributes'],function(_0x4dd2f3){var _0x48ca1e={};_0x48ca1e[_0x4dd2f3]={'$like':'%'+_0x255ad6[_0xd439('0x48')][_0xd439('0x68')]+'%'};return _0x48ca1e;})});}_0x50e915=_[_0xd439('0x52')]({},_0x50e915,_0x255ad6[_0xd439('0x5c')]);return db['Disposition'][_0xd439('0x1e')]({'where':_0x50e915[_0xd439('0x4f')]})[_0xd439('0xf')](function(_0xc7cca9){_0x4a7c8c[_0xd439('0x1e')]=_0xc7cca9;if(_0x255ad6['query']['includeAll']){_0x50e915['include']=[{'all':!![]}];}return db['Disposition'][_0xd439('0x55')](_0x50e915);})[_0xd439('0xf')](function(_0x516fe3){_0x4a7c8c[_0xd439('0x56')]=_0x516fe3;return _0x4a7c8c;});}})[_0xd439('0xf')](respondWithFilteredResult(_0x547af7,_0x50e915))[_0xd439('0x18')](handleError(_0x547af7,null));};exports[_0xd439('0x69')]=function(_0x3a4ca5,_0x1e70c5){return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x3a4ca5[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x1e70c5,null))[_0xd439('0xf')](function(_0x44e20c){if(_0x44e20c){return _0x44e20c['removeDispositions'](_0x3a4ca5[_0xd439('0x48')][_0xd439('0x6a')]);}})['then'](respondWithStatusCode(_0x1e70c5,null))['catch'](handleError(_0x1e70c5,null));};exports['addAnswer']=function(_0x2587f1,_0x2c20dd){if(_0x2587f1[_0xd439('0x5e')]['id']){delete _0x2587f1[_0xd439('0x5e')]['id'];}return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x2587f1[_0xd439('0x57')]['id']}})['then'](handleEntityNotFound(_0x2c20dd,null))[_0xd439('0xf')](function(_0x81c2d4){if(_0x81c2d4){_0x2587f1[_0xd439('0x5e')][_0xd439('0x63')]=_0x81c2d4['id'];return db[_0xd439('0x6b')][_0xd439('0x65')](_0x2587f1['body']);}})[_0xd439('0xf')](respondWithResult(_0x2c20dd,null))[_0xd439('0x18')](handleError(_0x2c20dd,null));};exports[_0xd439('0x6c')]=function(_0x1b2ed6,_0x54688c){var _0x55eff0={'raw':![],'where':{}};var _0x5d5674={};var _0x105c81={'count':0x0,'rows':[]};return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x1b2ed6['params']['id']}})['then'](handleEntityNotFound(_0x54688c,null))['then'](function(_0x5c36d5){if(_0x5c36d5){_0x5d5674[_0xd439('0x49')]=_[_0xd439('0x47')](db[_0xd439('0x6b')]['rawAttributes']);_0x5d5674[_0xd439('0x48')]=_[_0xd439('0x47')](_0x1b2ed6['query']);_0x5d5674[_0xd439('0x50')]=_['intersection'](_0x5d5674[_0xd439('0x49')],_0x5d5674[_0xd439('0x48')]);_0x55eff0[_0xd439('0x4a')]=_[_0xd439('0x59')](_0x5d5674[_0xd439('0x49')],qs[_0xd439('0x5a')](_0x1b2ed6[_0xd439('0x48')][_0xd439('0x5a')]));_0x55eff0['attributes']=_0x55eff0[_0xd439('0x4a')][_0xd439('0x5b')]?_0x55eff0[_0xd439('0x4a')]:_0x5d5674['model'];if(!_0x1b2ed6[_0xd439('0x48')][_0xd439('0x4b')](_0xd439('0x4c'))){_0x55eff0[_0xd439('0x1d')]=qs[_0xd439('0x1d')](_0x1b2ed6[_0xd439('0x48')]['limit']);_0x55eff0['offset']=qs['offset'](_0x1b2ed6[_0xd439('0x48')][_0xd439('0x1f')]);}_0x55eff0['order']=qs[_0xd439('0x4e')](_0x1b2ed6['query']['sort']);_0x55eff0['where']=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0x1b2ed6['query'],_0x5d5674[_0xd439('0x50')]));_0x55eff0['where'][_0xd439('0x63')]=_0x5c36d5['id'];if(_0x1b2ed6['query'][_0xd439('0x68')]){_0x55eff0['where']=_[_0xd439('0x52')](_0x55eff0[_0xd439('0x4f')],{'$or':_['map'](_0x55eff0[_0xd439('0x4a')],function(_0x80b3c8){var _0x3a27d7={};_0x3a27d7[_0x80b3c8]={'$like':'%'+_0x1b2ed6[_0xd439('0x48')]['filter']+'%'};return _0x3a27d7;})});}_0x55eff0=_[_0xd439('0x52')]({},_0x55eff0,_0x1b2ed6[_0xd439('0x5c')]);return db[_0xd439('0x6b')][_0xd439('0x1e')]({'where':_0x55eff0['where']})[_0xd439('0xf')](function(_0x215643){_0x105c81[_0xd439('0x1e')]=_0x215643;if(_0x1b2ed6[_0xd439('0x48')][_0xd439('0x53')]){_0x55eff0[_0xd439('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x55eff0);})[_0xd439('0xf')](function(_0x52f770){_0x105c81[_0xd439('0x56')]=_0x52f770;return _0x105c81;});}})[_0xd439('0xf')](respondWithFilteredResult(_0x54688c,_0x55eff0))[_0xd439('0x18')](handleError(_0x54688c,null));};exports[_0xd439('0x6d')]=function(_0x293b05,_0x25b4fa){return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x293b05[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x25b4fa,null))[_0xd439('0xf')](function(_0x42c6ab){if(_0x42c6ab){return _0x42c6ab['removeAnswers'](_0x293b05[_0xd439('0x48')][_0xd439('0x6a')]);}})[_0xd439('0xf')](respondWithStatusCode(_0x25b4fa,null))[_0xd439('0x18')](handleError(_0x25b4fa,null));};exports['create']=function(_0xd5023b,_0x37cdb5){var _0x4dbd93={'name':_0xd5023b[_0xd439('0x5e')][_0xd439('0x27')],'key':_0xd5023b[_0xd439('0x5e')][_0xd439('0x6e')],'provider':_0xd5023b[_0xd439('0x5e')][_0xd439('0x5f')]===_0xd439('0x6f')?null:_0xd5023b['body'][_0xd439('0x5f')],'email':_0xd5023b[_0xd439('0x5e')][_0xd439('0x70')],'ListId':_0xd5023b[_0xd439('0x5e')][_0xd439('0x71')],'active':!_[_0xd439('0x72')](_0xd5023b['body'][_0xd439('0x73')])?_0xd5023b[_0xd439('0x5e')][_0xd439('0x73')]:!![],'description':_0xd5023b[_0xd439('0x5e')]['description']||null};var _0x8532ed=getAuthenticationOptions(_0x4dbd93[_0xd439('0x5f')],_0xd5023b[_0xd439('0x5e')]);_0x4dbd93['Imap']=_0x8532ed[_0xd439('0x3d')];_0x4dbd93[_0xd439('0x3e')]=_0x8532ed[_0xd439('0x3e')];return db['MailAccount'][_0xd439('0x65')](_0x4dbd93,{'include':[{'model':db[_0xd439('0x41')],'as':_0xd439('0x3e')},{'model':db[_0xd439('0x40')],'as':_0xd439('0x3d')}]})[_0xd439('0xf')](function(_0x4a8101){var _0x123821=_0xd5023b[_0xd439('0x32')][_0xd439('0x25')]({'plain':!![]});if(!_0x123821)throw new Error(_0xd439('0x74'));if(_0x123821[_0xd439('0x75')]===_0xd439('0x32')){var _0x57cef7=_0x4a8101[_0xd439('0x25')]({'plain':!![]});return db[_0xd439('0x76')][_0xd439('0x5d')]({'where':{'name':_0xd439('0x26'),'userProfileId':_0x123821['userProfileId']},'raw':!![]})[_0xd439('0xf')](function(_0x566ba7){if(_0x566ba7&&_0x566ba7['autoAssociation']===0x0){return db[_0xd439('0x77')][_0xd439('0x65')]({'name':_0x57cef7[_0xd439('0x27')],'resourceId':_0x57cef7['id'],'type':_0x566ba7[_0xd439('0x27')],'sectionId':_0x566ba7['id']},{})[_0xd439('0xf')](function(){return _0x4a8101;});}else{return _0x4a8101;}})[_0xd439('0x18')](function(_0x27fa1b){logger[_0xd439('0x15')](_0xd439('0x78'),_0x27fa1b);throw _0x27fa1b;});}return _0x4a8101;})['then'](respondWithResult(_0x37cdb5,0xc9))[_0xd439('0x18')](handleError(_0x37cdb5,null));};exports[_0xd439('0x79')]=function(_0x3a7b0a,_0x2c9ad8){return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x3a7b0a[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x2c9ad8,null))[_0xd439('0xf')](function(_0x11ce7f){if(_0x11ce7f){return _0x11ce7f['getImap']();}return null;})[_0xd439('0xf')](respondWithResult(_0x2c9ad8,null))['catch'](handleError(_0x2c9ad8,null));};exports['addImap']=function(_0x18f12e,_0x30138d){if(_0x18f12e[_0xd439('0x5e')]['id']){delete _0x18f12e['body']['id'];}return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x18f12e['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x30138d,null))[_0xd439('0xf')](function(_0x17c019){if(_0x17c019){_0x18f12e['body'][_0xd439('0x63')]=_0x17c019['id'];return db[_0xd439('0x40')]['create'](_0x18f12e[_0xd439('0x5e')]);}})[_0xd439('0xf')](respondWithResult(_0x30138d,null))[_0xd439('0x18')](handleError(_0x30138d,null));};exports[_0xd439('0x7a')]=function(_0x235299,_0x10e1f7){return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x235299[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x10e1f7,null))['then'](function(_0x39bed9){if(_0x39bed9){return _0x39bed9['setImap'](null);}return null;})[_0xd439('0xf')](respondWithStatusCode(_0x10e1f7,null))[_0xd439('0x18')](handleError(_0x10e1f7,null));};exports[_0xd439('0x7b')]=function(_0x5a99ab,_0x1a4bc1){return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x5a99ab['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x1a4bc1,null))['then'](function(_0x42c0ed){if(_0x42c0ed){return _0x42c0ed[_0xd439('0x7b')]();}return null;})['then'](respondWithResult(_0x1a4bc1,null))[_0xd439('0x18')](handleError(_0x1a4bc1,null));};exports[_0xd439('0x7c')]=function(_0x313d2a,_0x3c37d7){if(_0x313d2a[_0xd439('0x5e')]['id']){delete _0x313d2a['body']['id'];}return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x313d2a[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x3c37d7,null))[_0xd439('0xf')](function(_0x343e8b){if(_0x343e8b){_0x313d2a[_0xd439('0x5e')]['MailAccountId']=_0x343e8b['id'];return db[_0xd439('0x41')]['create'](_0x313d2a[_0xd439('0x5e')]);}})[_0xd439('0xf')](respondWithResult(_0x3c37d7,null))['catch'](handleError(_0x3c37d7,null));};exports['removeSmtp']=function(_0x20c63c,_0xbeb9c7){return db['MailAccount'][_0xd439('0x67')]({'where':{'id':_0x20c63c['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0xbeb9c7,null))[_0xd439('0xf')](function(_0x47811c){if(_0x47811c){return _0x47811c[_0xd439('0x7d')](null);}return null;})[_0xd439('0xf')](respondWithStatusCode(_0xbeb9c7,null))[_0xd439('0x18')](handleError(_0xbeb9c7,null));};exports['addInteraction']=function(_0x449c43,_0x427c03){return db[_0xd439('0x7e')][_0xd439('0x5d')]({'where':{'id':_0x449c43[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x427c03,null))[_0xd439('0xf')](function(_0x2b5dde){if(_0x2b5dde){return _0x2b5dde[_0xd439('0x7f')](_0x449c43['body'][_0xd439('0x6a')],_[_0xd439('0x80')](_0x449c43[_0xd439('0x5e')],[_0xd439('0x6a'),'id'])||{});}})[_0xd439('0xf')](respondWithResult(_0x427c03,null))[_0xd439('0x18')](handleError(_0x427c03,null));};exports[_0xd439('0x81')]=function(_0x1bdad5,_0x127285){var _0x399bb5={'raw':![],'where':{}};var _0x241dc6={};var _0x57cc18={'count':0x0,'rows':[]};return db[_0xd439('0x44')]['findOne']({'where':{'id':_0x1bdad5[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x127285,null))[_0xd439('0xf')](function(_0x18ec9c){if(_0x18ec9c){_0x241dc6[_0xd439('0x49')]=_[_0xd439('0x47')](db[_0xd439('0x7e')]['rawAttributes']);_0x241dc6[_0xd439('0x48')]=_[_0xd439('0x47')](_0x1bdad5[_0xd439('0x48')]);_0x241dc6['filters']=_[_0xd439('0x59')](_0x241dc6[_0xd439('0x49')],_0x241dc6['query']);_0x399bb5[_0xd439('0x4a')]=_[_0xd439('0x59')](_0x241dc6[_0xd439('0x49')],qs['fields'](_0x1bdad5[_0xd439('0x48')][_0xd439('0x5a')]));_0x399bb5[_0xd439('0x4a')]=_0x399bb5[_0xd439('0x4a')][_0xd439('0x5b')]?_0x399bb5[_0xd439('0x4a')]:_0x241dc6[_0xd439('0x49')];if(!_0x1bdad5[_0xd439('0x48')]['hasOwnProperty'](_0xd439('0x4c'))){_0x399bb5['limit']=qs['limit'](_0x1bdad5[_0xd439('0x48')][_0xd439('0x1d')]);_0x399bb5[_0xd439('0x1f')]=qs[_0xd439('0x1f')](_0x1bdad5[_0xd439('0x48')][_0xd439('0x1f')]);}_0x399bb5[_0xd439('0x4d')]=qs[_0xd439('0x4e')](_0x1bdad5['query']['sort']);_0x399bb5[_0xd439('0x4f')]=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0x1bdad5['query'],_0x241dc6[_0xd439('0x50')]));_0x399bb5[_0xd439('0x4f')][_0xd439('0x63')]=_0x18ec9c['id'];if(_0x1bdad5[_0xd439('0x48')][_0xd439('0x68')]){_0x399bb5[_0xd439('0x4f')]=_[_0xd439('0x52')](_0x399bb5[_0xd439('0x4f')],{'$or':_['map'](_0x399bb5[_0xd439('0x4a')],function(_0x4d461e){var _0x1ffc58={};_0x1ffc58[_0x4d461e]={'$like':'%'+_0x1bdad5[_0xd439('0x48')][_0xd439('0x68')]+'%'};return _0x1ffc58;})});}_0x399bb5=_[_0xd439('0x52')]({},_0x399bb5,_0x1bdad5[_0xd439('0x5c')]);return db[_0xd439('0x7e')][_0xd439('0x1e')]({'where':_0x399bb5[_0xd439('0x4f')]})[_0xd439('0xf')](function(_0x3357d2){_0x57cc18[_0xd439('0x1e')]=_0x3357d2;if(_0x1bdad5[_0xd439('0x48')]['includeAll']){_0x399bb5[_0xd439('0x54')]=[{'model':db[_0xd439('0x82')],'as':_0xd439('0x83'),'required':![]},{'model':db[_0xd439('0x84')],'as':_0xd439('0x85'),'attributes':[_0xd439('0x27'),_0xd439('0x86'),_0xd439('0x87')],'required':![]},{'model':db[_0xd439('0x88')],'as':_0xd439('0x89'),'attributes':['id',_0xd439('0x27'),_0xd439('0x8a')],'where':_0x1bdad5['query'][_0xd439('0x8b')]?{'id':_0x1bdad5[_0xd439('0x48')][_0xd439('0x8b')]}:undefined,'required':_0x1bdad5[_0xd439('0x48')][_0xd439('0x8b')]?!![]:![]}];}return db['MailInteraction'][_0xd439('0x55')](_0x399bb5);})['then'](function(_0x493b3d){_0x57cc18[_0xd439('0x56')]=_0x493b3d;return _0x57cc18;});}})[_0xd439('0xf')](respondWithFilteredResult(_0x127285,_0x399bb5))[_0xd439('0x18')](handleError(_0x127285,null));};exports[_0xd439('0x8c')]=function addApplications(_0xd0bbbd,_0x49ce06){var _0x27e091=_0xd0bbbd[_0xd439('0x57')]['id'];var _0x439625=_0xd0bbbd[_0xd439('0x5e')];var _0x12dea5=0xc8;var _0x3c68a2=null;return db[_0xd439('0x8d')][_0xd439('0x8e')]({'isolationLevel':db[_0xd439('0x8d')][_0xd439('0x8f')][_0xd439('0x90')][_0xd439('0x91')]},function(_0x1204e1){return db['MailAccount'][_0xd439('0x67')]({'where':{'id':_0x27e091},'transaction':_0x1204e1})[_0xd439('0xf')](function(_0x3faa59){if(_0x3faa59){return db[_0xd439('0x92')][_0xd439('0x24')]({'where':{'MailAccountId':_0x27e091},'transaction':_0x1204e1})[_0xd439('0xf')](function(){var _0x594c23=_[_0xd439('0x43')](_0x439625,function(_0xddc35e){_0xddc35e[_0xd439('0x63')]=_0x27e091;return _0xddc35e;});return db[_0xd439('0x92')]['bulkCreate'](_0x594c23,{'transaction':_0x1204e1});});}else{_0x12dea5=0x194;_0x3c68a2=[];}});})[_0xd439('0xf')](function(){if(_0x12dea5!==0x194){return db[_0xd439('0x92')][_0xd439('0x93')]({'where':{'MailAccountId':_0x27e091},'order':_0xd439('0x94')})[_0xd439('0xf')](function(_0x2d98c7){_0x3c68a2=_0x2d98c7;});}})[_0xd439('0x18')](function(_0x25b776){_0x12dea5=0x1f4;logger[_0xd439('0x15')](_0x25b776[_0xd439('0x95')]);if(_0x25b776['name']){delete _0x25b776[_0xd439('0x27')];}_0x3c68a2=_0x25b776;})['finally'](function(){if(_0x3c68a2===null){_0x49ce06[_0xd439('0x19')](_0x12dea5);}else{if(_0x12dea5===0x1f4){_0x49ce06[_0xd439('0x1a')](_0x12dea5)[_0xd439('0x96')](_0x3c68a2);}else{_0x49ce06[_0xd439('0x1a')](_0x12dea5)[_0xd439('0x22')](_0x3c68a2);}}});};exports['getApplications']=function(_0xce66f4,_0x3f1668){var _0x2448b5={};var _0x160926={};var _0x258b22;var _0x36ee40;return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0xce66f4[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x3f1668,null))[_0xd439('0xf')](function(_0xae1575){if(_0xae1575){_0x258b22=_0xae1575;_0x160926['model']=_['keys'](db[_0xd439('0x92')]['rawAttributes']);_0x160926[_0xd439('0x48')]=_[_0xd439('0x47')](_0xce66f4[_0xd439('0x48')]);_0x160926[_0xd439('0x50')]=_[_0xd439('0x59')](_0x160926['model'],_0x160926[_0xd439('0x48')]);_0x2448b5['attributes']=_[_0xd439('0x59')](_0x160926[_0xd439('0x49')],qs[_0xd439('0x5a')](_0xce66f4[_0xd439('0x48')][_0xd439('0x5a')]));_0x2448b5['attributes']=_0x2448b5[_0xd439('0x4a')][_0xd439('0x5b')]?_0x2448b5[_0xd439('0x4a')]:_0x160926[_0xd439('0x49')];_0x2448b5[_0xd439('0x4d')]=qs[_0xd439('0x4e')](_0xce66f4[_0xd439('0x48')][_0xd439('0x4e')]);_0x2448b5[_0xd439('0x4f')]=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0xce66f4[_0xd439('0x48')],_0x160926['filters']));if(_0xce66f4[_0xd439('0x48')][_0xd439('0x68')]){_0x2448b5['where']=_[_0xd439('0x52')](_0x2448b5[_0xd439('0x4f')],{'$or':_[_0xd439('0x43')](_0x2448b5[_0xd439('0x4a')],function(_0xf572a){var _0x26444c={};_0x26444c[_0xf572a]={'$like':'%'+_0xce66f4[_0xd439('0x48')][_0xd439('0x68')]+'%'};return _0x26444c;})});}_0x2448b5=_[_0xd439('0x52')]({},_0x2448b5,_0xce66f4[_0xd439('0x5c')]);return _0x258b22[_0xd439('0x97')](_0x2448b5);}})[_0xd439('0xf')](function(_0x1c5d3d){if(_0x1c5d3d){_0x36ee40=_0x1c5d3d[_0xd439('0x5b')];if(!_0xce66f4[_0xd439('0x48')][_0xd439('0x4b')](_0xd439('0x4c'))){_0x2448b5['limit']=qs[_0xd439('0x1d')](_0xce66f4[_0xd439('0x48')][_0xd439('0x1d')]);_0x2448b5[_0xd439('0x1f')]=qs[_0xd439('0x1f')](_0xce66f4[_0xd439('0x48')][_0xd439('0x1f')]);}return _0x258b22[_0xd439('0x97')](_0x2448b5);}})[_0xd439('0xf')](function(_0x55acbc){if(_0x55acbc){return _0x55acbc?{'count':_0x36ee40,'rows':_0x55acbc}:null;}})[_0xd439('0xf')](respondWithResult(_0x3f1668,null))['catch'](handleError(_0x3f1668,null));};exports[_0xd439('0x98')]=function(_0x66f156,_0x1358ae){var _0x23a2ef={'raw':!![],'where':{}};var _0x2c27fd={};var _0x4175e3={'count':0x0,'rows':[]};return db[_0xd439('0x44')][_0xd439('0x67')]({'where':{'id':_0x66f156[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x1358ae,null))[_0xd439('0xf')](function(_0x96b34){if(_0x96b34){_0x2c27fd[_0xd439('0x49')]=_[_0xd439('0x47')](db[_0xd439('0x99')][_0xd439('0x45')]);_0x2c27fd[_0xd439('0x48')]=_[_0xd439('0x47')](_0x66f156['query']);_0x2c27fd[_0xd439('0x50')]=_[_0xd439('0x59')](_0x2c27fd[_0xd439('0x49')],_0x2c27fd[_0xd439('0x48')]);_0x23a2ef[_0xd439('0x4a')]=_[_0xd439('0x59')](_0x2c27fd['model'],qs[_0xd439('0x5a')](_0x66f156['query']['fields']));_0x23a2ef[_0xd439('0x4a')]=_0x23a2ef[_0xd439('0x4a')][_0xd439('0x5b')]?_0x23a2ef[_0xd439('0x4a')]:_0x2c27fd[_0xd439('0x49')];if(!_0x66f156[_0xd439('0x48')][_0xd439('0x4b')]('nolimit')){_0x23a2ef[_0xd439('0x1d')]=qs[_0xd439('0x1d')](_0x66f156[_0xd439('0x48')][_0xd439('0x1d')]);_0x23a2ef[_0xd439('0x1f')]=qs[_0xd439('0x1f')](_0x66f156[_0xd439('0x48')][_0xd439('0x1f')]);}_0x23a2ef[_0xd439('0x4d')]=qs['sort'](_0x66f156['query']['sort']);_0x23a2ef[_0xd439('0x4f')]=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0x66f156[_0xd439('0x48')],_0x2c27fd['filters']));_0x23a2ef[_0xd439('0x4f')][_0xd439('0x63')]=_0x96b34['id'];if(_0x66f156[_0xd439('0x48')][_0xd439('0x68')]){_0x23a2ef[_0xd439('0x4f')]=_['merge'](_0x23a2ef[_0xd439('0x4f')],{'$or':_['map'](_0x23a2ef[_0xd439('0x4a')],function(_0x306715){var _0x4d572d={};_0x4d572d[_0x306715]={'$like':'%'+_0x66f156['query']['filter']+'%'};return _0x4d572d;})});}if(_0x66f156['query'][_0xd439('0x9a')]){var _0x54886e=_0x66f156[_0xd439('0x48')]['$gte'][_0xd439('0x9b')](',');var _0x3bdf8e={};_0x3bdf8e[_0x54886e[0x0]]={'$gte':moment(_0x54886e[0x1])[_0xd439('0x9c')](_0xd439('0x9d'))};_0x23a2ef[_0xd439('0x4f')]=_[_0xd439('0x52')](_0x23a2ef[_0xd439('0x4f')],_0x3bdf8e);}_0x23a2ef=_[_0xd439('0x52')]({},_0x23a2ef,_0x66f156[_0xd439('0x5c')]);return db[_0xd439('0x99')][_0xd439('0x1e')]({'where':_0x23a2ef[_0xd439('0x4f')]})[_0xd439('0xf')](function(_0x231298){_0x4175e3['count']=_0x231298;if(_0x66f156[_0xd439('0x48')][_0xd439('0x53')]){_0x23a2ef[_0xd439('0x54')]=[{'all':!![]}];}return db[_0xd439('0x99')][_0xd439('0x55')](_0x23a2ef);})[_0xd439('0xf')](function(_0x43d282){if(_0x66f156[_0xd439('0x48')][_0xd439('0x9e')]===_0xd439('0x9f')){for(var _0xe4d9ef=0x0;_0xe4d9ef<_0x43d282[_0xd439('0x5b')];_0xe4d9ef++){_0x43d282[_0xe4d9ef][_0xd439('0x5e')]=juice(_0x43d282[_0xe4d9ef]['body']);}}_0x4175e3[_0xd439('0x56')]=_0x43d282;return _0x4175e3;});}})[_0xd439('0xf')](respondWithFilteredResult(_0x1358ae,_0x23a2ef))['catch'](handleError(_0x1358ae,null));};exports[_0xd439('0x96')]=function(_0x5b6838,_0x6d5799){var _0x1174af,_0x45d4a5={},_0x13918c;if(_0x5b6838[_0xd439('0x5e')]['to']){_0x13918c=_0x5b6838['body']['to'][_0xd439('0x9b')](',')[0x0];}return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x5b6838[_0xd439('0x57')]['id']},'include':[{'model':db[_0xd439('0xa0')],'as':_0xd439('0xa1'),'include':[{'model':db[_0xd439('0x82')],'as':_0xd439('0xa2'),'where':{'email':_0x13918c},'limit':0x1,'order':[[_0xd439('0xa3'),_0xd439('0xa4')]]}]},{'model':db['MailServerOut'],'as':_0xd439('0x3e'),'raw':!![],'include':[{'model':db[_0xd439('0xa5')],'as':_0xd439('0xa5'),'raw':!![]}]}]})[_0xd439('0xf')](handleEntityNotFound(_0x6d5799,null))[_0xd439('0xf')](function(_0x527a77){if(!_0x527a77)return;_0x1174af=_0x527a77;if(!_0x527a77['Smtp'])throw new Error(_0xd439('0xa6'));if(_[_0xd439('0x72')](_0x5b6838[_0xd439('0x5e')][_0xd439('0xa7')])){_0x5b6838[_0xd439('0x5e')][_0xd439('0xa7')]=util[_0xd439('0x9c')](_0xd439('0xa8'),_0x527a77[_0xd439('0x27')],_0x527a77[_0xd439('0x70')]||_0x527a77[_0xd439('0x3e')][_0xd439('0x32')]);}if(_0x5b6838[_0xd439('0x5e')][_0xd439('0xa9')]&&_0x5b6838[_0xd439('0x5e')][_0xd439('0xa9')][_0xd439('0x5b')]){for(var _0x32a467=0x0;_0x32a467<_0x5b6838[_0xd439('0x5e')][_0xd439('0xa9')][_0xd439('0x5b')];_0x32a467+=0x1){_0x5b6838['body']['attachments'][_0x32a467]={'filename':_0x5b6838[_0xd439('0x5e')][_0xd439('0xa9')][_0x32a467]['name'],'path':path[_0xd439('0xaa')](config[_0xd439('0xab')],_0xd439('0xac'),_0x5b6838[_0xd439('0x5e')][_0xd439('0xa9')][_0x32a467][_0xd439('0xad')])};}}var _0x13d5d6=_0x527a77[_0xd439('0xae')]();return respondWithRpcPromise(_0xd439('0xaf'),_0xd439('0xb0'),{'account':_0x13d5d6,'message':_0x5b6838[_0xd439('0x5e')]});})['then'](function(_0x1eee24){if(!_0x1eee24)return;_0x45d4a5=_0x1eee24;if(!_0x1174af[_0xd439('0xa1')])throw new Error('List\x20not\x20found');if(_0x1174af[_0xd439('0xa1')][_0xd439('0xa2')][_0xd439('0x5b')])return _0x1174af[_0xd439('0xa1')]['Contacts'][0x0];return db[_0xd439('0x82')][_0xd439('0x65')](_[_0xd439('0x7')](_0x5b6838[_0xd439('0x5e')],{'firstName':_0x5b6838['body']['to'],'email':_0x5b6838[_0xd439('0x5e')]['to'],'phone':_0x5b6838[_0xd439('0x5e')]['to'],'ListId':_0x1174af[_0xd439('0x71')]}));})[_0xd439('0xf')](function(_0x41f4f8){if(!_0x41f4f8)return;var _0x2e8d0c={'UserId':_0x5b6838[_0xd439('0x32')]['id'],'ContactId':_0x41f4f8['id'],'MailAccountId':_0x1174af['id'],'inReplyTo':_0x45d4a5['messageId'],'to':_0x5b6838[_0xd439('0x5e')][_0xd439('0xa7')],'cc':_0x5b6838[_0xd439('0x5e')]['cc'],'subject':_0x5b6838[_0xd439('0x5e')][_0xd439('0xb1')],'attach':_0x5b6838[_0xd439('0x5e')][_0xd439('0xb2')],'firstMsgDirection':_0xd439('0xb3'),'lastMsgAt':moment()[_0xd439('0x9c')](_0xd439('0x9d')),'lastMsgDirection':_0xd439('0xb3'),'Messages':[_[_0xd439('0x52')](_0x5b6838[_0xd439('0x5e')],{'messageId':_0x45d4a5['messageId'],'sentAt':moment()['format'](_0xd439('0x9d')),'read':!![],'MailAccountId':_0x1174af['id'],'UserId':_0x5b6838['user']['id'],'ContactId':_0x41f4f8['id']})]};if(_0x5b6838[_0xd439('0x5e')][_0xd439('0xb4')]){_0x2e8d0c=_[_0xd439('0x52')](_0x2e8d0c,_0x5b6838[_0xd439('0x5e')][_0xd439('0xb4')]);}return db[_0xd439('0x7e')][_0xd439('0x65')](_0x2e8d0c,{'include':[{'model':db[_0xd439('0x99')],'as':_0xd439('0xb5')}]});})[_0xd439('0xf')](respondWithResult(_0x6d5799,null))[_0xd439('0x18')](handleError(_0x6d5799,null));};exports[_0xd439('0xb6')]=function(_0xcbf6ba,_0x287c4d){return db[_0xd439('0x44')]['find']({'where':{'id':_0xcbf6ba[_0xd439('0x57')]['id']},'include':[{'model':db[_0xd439('0x41')],'as':_0xd439('0x3e'),'raw':!![],'include':[{'model':db[_0xd439('0xa5')],'as':_0xd439('0xa5'),'raw':!![]}]}]})[_0xd439('0xf')](handleEntityNotFound(_0x287c4d,null))[_0xd439('0xf')](function(_0x396528){if(!_0x396528[_0xd439('0x3e')])return;var _0x4e676a=_0x396528[_0xd439('0xae')]();return respondWithRpcPromise(_0xd439('0xb7'),'verifySmtp',{'account':_0x4e676a});})['then'](respondWithResult(_0x287c4d,null))[_0xd439('0x18')](handleError(_0x287c4d,null));};exports['destroy']=function(_0x3678e0,_0x55f06b){return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x3678e0['params']['id']}})['then'](handleEntityNotFound(_0x55f06b,null))['then'](function(_0x270784){if(_0x270784&&_0x270784[_0xd439('0x3b')]){throw new db[(_0xd439('0xb8'))][(_0xd439('0xb9'))](_0xd439('0xba'));}return _0x270784;})['then'](removeEntity(_0x55f06b,null))[_0xd439('0x18')](handleError(_0x55f06b,null));};exports[_0xd439('0xbb')]=function(_0x16ccfe,_0x2c2c7f){return db['MailAccount'][_0xd439('0x5d')]({'where':{'id':_0x16ccfe[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x2c2c7f,null))['then'](function(_0x245bc6){if(_0x245bc6){return _0x245bc6['addAgents'](_0x16ccfe[_0xd439('0x5e')][_0xd439('0x6a')],_['omit'](_0x16ccfe[_0xd439('0x5e')],[_0xd439('0x6a'),'id'])||{})[_0xd439('0xbc')](function(_0x55d44d){for(var _0x5c0222=0x0;_0x5c0222<_0x16ccfe[_0xd439('0x5e')][_0xd439('0x6a')][_0xd439('0x5b')];_0x5c0222+=0x1){socket['emit'](_0xd439('0xbd'),{'UserId':Number(_0x16ccfe[_0xd439('0x5e')][_0xd439('0x6a')][_0x5c0222]),'MailAccountId':Number(_0x16ccfe[_0xd439('0x57')]['id'])});}return _0x55d44d;});}})['then'](respondWithResult(_0x2c2c7f,null))[_0xd439('0x18')](handleError(_0x2c2c7f,null));};exports['removeAgents']=function(_0x4a5b8f,_0x54a9a0){return db[_0xd439('0x44')][_0xd439('0x5d')]({'where':{'id':_0x4a5b8f[_0xd439('0x57')]['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x54a9a0,null))[_0xd439('0xf')](function(_0x2a35f7){if(_0x2a35f7){return _0x2a35f7[_0xd439('0xbe')](_0x4a5b8f['query'][_0xd439('0x6a')])['then'](function(){if(_['isArray'](_0x4a5b8f[_0xd439('0x48')]['ids'])){for(var _0x58d173=0x0;_0x58d173<_0x4a5b8f['query'][_0xd439('0x6a')][_0xd439('0x5b')];_0x58d173+=0x1){socket[_0xd439('0xbf')](_0xd439('0xc0'),{'UserId':Number(_0x4a5b8f[_0xd439('0x48')][_0xd439('0x6a')][_0x58d173]),'MailAccountId':Number(_0x4a5b8f[_0xd439('0x57')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x4a5b8f[_0xd439('0x48')][_0xd439('0x6a')]),'MailAccountId':Number(_0x4a5b8f[_0xd439('0x57')]['id'])});}});}})[_0xd439('0xf')](respondWithStatusCode(_0x54a9a0,null))[_0xd439('0x18')](handleError(_0x54a9a0,null));};exports[_0xd439('0xc1')]=function(_0x52fa26,_0x1dd535){var _0x5f0a37={};var _0x57be36={};var _0x1a3e0e;var _0x1093a8;return db[_0xd439('0x44')]['findOne']({'where':{'id':_0x52fa26['params']['id']}})[_0xd439('0xf')](handleEntityNotFound(_0x1dd535,null))[_0xd439('0xf')](function(_0x32b857){if(_0x32b857){_0x1a3e0e=_0x32b857;_0x57be36['model']=_[_0xd439('0x47')](db[_0xd439('0x84')][_0xd439('0x45')]);_0x57be36['query']=_[_0xd439('0x47')](_0x52fa26[_0xd439('0x48')]);_0x57be36[_0xd439('0x50')]=_[_0xd439('0x59')](_0x57be36[_0xd439('0x49')],_0x57be36[_0xd439('0x48')]);_0x5f0a37['attributes']=_['intersection'](_0x57be36[_0xd439('0x49')],qs[_0xd439('0x5a')](_0x52fa26[_0xd439('0x48')][_0xd439('0x5a')]));_0x5f0a37[_0xd439('0x4a')]=_0x5f0a37[_0xd439('0x4a')][_0xd439('0x5b')]?_0x5f0a37[_0xd439('0x4a')]:_0x57be36[_0xd439('0x49')];_0x5f0a37[_0xd439('0x4d')]=qs[_0xd439('0x4e')](_0x52fa26[_0xd439('0x48')][_0xd439('0x4e')]);_0x5f0a37['where']=qs[_0xd439('0x50')](_[_0xd439('0x51')](_0x52fa26[_0xd439('0x48')],_0x57be36['filters']));if(_0x52fa26['query']['filter']){_0x5f0a37[_0xd439('0x4f')]=_['merge'](_0x5f0a37[_0xd439('0x4f')],{'$or':_['map'](_0x5f0a37[_0xd439('0x4a')],function(_0x40d9de){var _0x378884={};_0x378884[_0x40d9de]={'$like':'%'+_0x52fa26[_0xd439('0x48')][_0xd439('0x68')]+'%'};return _0x378884;})});}_0x5f0a37=_[_0xd439('0x52')]({},_0x5f0a37,_0x52fa26['options']);return _0x1a3e0e[_0xd439('0xc1')](_0x5f0a37);}})[_0xd439('0xf')](function(_0x19c568){if(_0x19c568){_0x1093a8=_0x19c568[_0xd439('0x5b')];if(!_0x52fa26[_0xd439('0x48')][_0xd439('0x4b')](_0xd439('0x4c'))){_0x5f0a37[_0xd439('0x1d')]=qs[_0xd439('0x1d')](_0x52fa26['query']['limit']);_0x5f0a37[_0xd439('0x1f')]=qs[_0xd439('0x1f')](_0x52fa26[_0xd439('0x48')]['offset']);}return _0x1a3e0e[_0xd439('0xc1')](_0x5f0a37);}})[_0xd439('0xf')](function(_0x3e8922){if(_0x3e8922){return _0x3e8922?{'count':_0x1093a8,'rows':_0x3e8922}:null;}})[_0xd439('0xf')](respondWithResult(_0x1dd535,null))[_0xd439('0x18')](handleError(_0x1dd535,null));}; \ No newline at end of file +var _0x43e1=['userProfileId','getImap','removeImap','setImap','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','ids','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','format','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','get','MailAccounts','UserProfileResource','destroy','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','fields','length','model','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','MailServerOut','find','body','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','provider','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x126645,_0x16ede2){var _0x46968b=function(_0x39b1c0){while(--_0x39b1c0){_0x126645['push'](_0x126645['shift']());}};_0x46968b(++_0x16ede2);}(_0x43e1,0x1d2));var _0x143e=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x43e1[_0x1e6b59];return _0x40d7c5;};'use strict';var moment=require(_0x143e('0x0'));var BPromise=require(_0x143e('0x1'));var util=require('util');var path=require(_0x143e('0x2'));var _=require(_0x143e('0x3'));var juice=require('juice');var Redis=require(_0x143e('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x143e('0x5'))(_0x143e('0x6'));var config=require(_0x143e('0x7'));var db=require('../../mysqldb')['db'];config[_0x143e('0x8')]=_[_0x143e('0x9')](config[_0x143e('0x8')],{'host':_0x143e('0xa'),'port':0x18eb});var socket=require(_0x143e('0xb'))(new Redis(config['redis']));require(_0x143e('0xc'))['register'](socket);var jayson=require(_0x143e('0xd'));var client=jayson[_0x143e('0xe')][_0x143e('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x1da0ed,_0x57453b,_0x2dfe15,_0x33948f){return new BPromise(function(_0x25c308,_0x572b8a){var _0x22661d=_0x33948f||client;return _0x22661d[_0x143e('0x10')](_0x1da0ed,_0x2dfe15)[_0x143e('0x11')](function(_0x13bd1b){logger['info'](_0x143e('0x12'),_0x57453b,_0x143e('0x13'));logger[_0x143e('0x14')](_0x143e('0x15'),_0x57453b,_0x143e('0x13'),JSON[_0x143e('0x16')](_0x13bd1b));if(_0x13bd1b[_0x143e('0x17')]){if(_0x13bd1b['error'][_0x143e('0x18')]===0x1f4){logger[_0x143e('0x17')]('MailAccount,\x20%s,\x20%s',_0x57453b,_0x13bd1b[_0x143e('0x17')]['message']);return _0x572b8a(_0x13bd1b['error'][_0x143e('0x19')]);}logger[_0x143e('0x17')](_0x143e('0x12'),_0x57453b,_0x13bd1b['error'][_0x143e('0x19')]);return _0x25c308(_0x13bd1b[_0x143e('0x17')][_0x143e('0x19')]);}else{logger[_0x143e('0x1a')](_0x143e('0x12'),_0x57453b,'request\x20sent');_0x25c308(_0x13bd1b[_0x143e('0x1b')][_0x143e('0x19')]);}})[_0x143e('0x1c')](function(_0xa4df6){logger[_0x143e('0x17')]('MailAccount,\x20%s,\x20%s',_0x57453b,_0xa4df6);_0x572b8a(_0xa4df6);});});}function respondWithStatusCode(_0x1cc445,_0x565358){_0x565358=_0x565358||0xcc;return function(_0x17efe9){if(_0x17efe9){return _0x1cc445[_0x143e('0x1d')](_0x565358);}return _0x1cc445[_0x143e('0x1e')](_0x565358)[_0x143e('0x1f')]();};}function respondWithResult(_0x116dd5,_0x521ef0){_0x521ef0=_0x521ef0||0xc8;return function(_0x4eb24e){if(_0x4eb24e){return _0x116dd5[_0x143e('0x1e')](_0x521ef0)['json'](_0x4eb24e);}};}function respondWithFilteredResult(_0x34ed1b,_0x428210){return function(_0x1ce00d){if(_0x1ce00d){var _0x7ed04b=typeof _0x428210[_0x143e('0x20')]===_0x143e('0x21')&&typeof _0x428210[_0x143e('0x22')]==='undefined';var _0x2589c2=_0x1ce00d[_0x143e('0x23')];var _0x5414df=_0x7ed04b?0x0:_0x428210[_0x143e('0x20')];var _0x11ff16=_0x7ed04b?_0x1ce00d[_0x143e('0x23')]:_0x428210[_0x143e('0x20')]+_0x428210[_0x143e('0x22')];var _0x26063c;if(_0x11ff16>=_0x2589c2){_0x11ff16=_0x2589c2;_0x26063c=0xc8;}else{_0x26063c=0xce;}_0x34ed1b['status'](_0x26063c);return _0x34ed1b['set'](_0x143e('0x24'),_0x5414df+'-'+_0x11ff16+'/'+_0x2589c2)[_0x143e('0x25')](_0x1ce00d);}return null;};}function saveUpdates(_0x2d7d81){return function(_0x36ad0b){if(_0x36ad0b){return _0x36ad0b[_0x143e('0x26')](_0x2d7d81)[_0x143e('0x11')](function(_0x28534e){return _0x28534e;});}return null;};}function removeEntity(_0x5bc9e9){return function(_0x173d5d){if(_0x173d5d){return _0x173d5d['destroy']()[_0x143e('0x11')](function(){var _0x4eebe1=_0x173d5d[_0x143e('0x27')]({'plain':!![]});var _0x4582e3=_0x143e('0x28');return db[_0x143e('0x29')][_0x143e('0x2a')]({'where':{'type':_0x4582e3,'resourceId':_0x4eebe1['id']}})[_0x143e('0x11')](function(){return _0x173d5d;});})[_0x143e('0x11')](function(){_0x5bc9e9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xeaa558){return function(_0x1fe2e6){if(!_0x1fe2e6){_0xeaa558[_0x143e('0x1d')](0x194);}return _0x1fe2e6;};}function handleError(_0x80a7f9,_0x51001f){_0x51001f=_0x51001f||0x1f4;return function(_0x499709){logger[_0x143e('0x17')](_0x499709['stack']);if(_0x499709[_0x143e('0x2b')]){delete _0x499709[_0x143e('0x2b')];}_0x80a7f9[_0x143e('0x1e')](_0x51001f)[_0x143e('0x2c')](_0x499709);};}function getImapHost(_0x5692db){switch(_0x5692db){case _0x143e('0x2d'):return'imap.gmail.com';case _0x143e('0x2e'):return _0x143e('0x2f');case _0x143e('0x30'):return _0x143e('0x31');case'outlook365':return _0x143e('0x32');}throw new Error(_0x143e('0x33'),_0x5692db);}function getSmtpHost(_0x513a45){switch(_0x513a45){case _0x143e('0x2d'):return _0x143e('0x34');case _0x143e('0x2e'):return _0x143e('0x35');case _0x143e('0x30'):return _0x143e('0x36');case _0x143e('0x37'):return _0x143e('0x38');}throw new Error(_0x143e('0x33'),_0x513a45);}function getAuthenticationOptions(_0x391f82,_0x1f58b6){var _0x1a155={};var _0x72f26e={};if(_0x391f82){_0x1a155[_0x143e('0x39')]=_0x72f26e['user']=_0x1f58b6[_0x143e('0x3a')];_0x1a155[_0x143e('0x3b')]=_0x72f26e[_0x143e('0x3c')]=_0x1f58b6[_0x143e('0x3b')];if(_0x1f58b6['modernAuthentication']){_0x1a155[_0x143e('0x3d')]=_0x72f26e[_0x143e('0x3d')]=!![];_0x1a155[_0x143e('0x3e')]=_0x72f26e['CloudProviderId']=_0x1f58b6['CloudProviderId'];_0x1a155[_0x143e('0x3b')]=_0x72f26e[_0x143e('0x3c')]=null;}else{_0x1a155[_0x143e('0x3e')]=_0x72f26e[_0x143e('0x3e')]=null;}_0x1a155[_0x143e('0x3f')]=getImapHost(_0x391f82);_0x1a155[_0x143e('0x40')]=0x3e1;_0x72f26e[_0x143e('0x3f')]=getSmtpHost(_0x391f82);_0x72f26e[_0x143e('0x40')]=0x24b;_0x72f26e[_0x143e('0x41')]=![];_0x1a155[_0x143e('0x42')]=_0x72f26e[_0x143e('0x42')]=null;}else{if(_0x1f58b6['authentication']){_0x1a155[_0x143e('0x39')]=_0x72f26e['user']=_0x1f58b6[_0x143e('0x3a')];_0x1a155[_0x143e('0x3b')]=_0x72f26e[_0x143e('0x3c')]=_0x1f58b6[_0x143e('0x3b')];}else{_0x1a155[_0x143e('0x43')]=_0x72f26e[_0x143e('0x43')]=![];_0x1a155[_0x143e('0x39')]=_0x72f26e[_0x143e('0x39')]=null;_0x1a155[_0x143e('0x3b')]=_0x72f26e['pass']=null;}_0x1a155[_0x143e('0x3f')]=_0x1f58b6[_0x143e('0x44')][_0x143e('0x3f')];_0x1a155[_0x143e('0x40')]=_0x1f58b6['Imap']['port'];_0x72f26e[_0x143e('0x3f')]=_0x1f58b6[_0x143e('0x45')]['host'];_0x72f26e['port']=_0x1f58b6[_0x143e('0x45')][_0x143e('0x40')];}return{'Imap':_0x1a155,'Smtp':_0x72f26e};}exports[_0x143e('0x46')]=function(_0x583af6,_0x23c94c){var _0x326019={'include':[{'model':db[_0x143e('0x47')],'as':_0x143e('0x44')},{'model':db['MailServerOut'],'as':_0x143e('0x45')},{'model':db[_0x143e('0x48')],'as':_0x143e('0x49')}]},_0x5f2aed={},_0x3119f1={'count':0x0,'rows':[]};var _0x566de9=_[_0x143e('0x4a')](db[_0x143e('0x4b')][_0x143e('0x4c')],function(_0x52bd50){return{'name':_0x52bd50[_0x143e('0x4d')],'type':_0x52bd50[_0x143e('0x4e')][_0x143e('0x4f')]};});_0x5f2aed['model']=_[_0x143e('0x4a')](_0x566de9,'name');_0x5f2aed[_0x143e('0x50')]=_[_0x143e('0x51')](_0x583af6['query']);_0x5f2aed[_0x143e('0x52')]=_['intersection'](_0x5f2aed['model'],_0x5f2aed[_0x143e('0x50')]);_0x326019[_0x143e('0x53')]=_[_0x143e('0x54')](_0x5f2aed['model'],qs['fields'](_0x583af6[_0x143e('0x50')][_0x143e('0x55')]));_0x326019[_0x143e('0x53')]=_0x326019['attributes'][_0x143e('0x56')]?_0x326019['attributes']:_0x5f2aed[_0x143e('0x57')];if(!_0x583af6[_0x143e('0x50')]['hasOwnProperty'](_0x143e('0x58'))){_0x326019[_0x143e('0x22')]=qs['limit'](_0x583af6['query']['limit']);_0x326019['offset']=qs[_0x143e('0x20')](_0x583af6[_0x143e('0x50')][_0x143e('0x20')]);}_0x326019[_0x143e('0x59')]=qs[_0x143e('0x5a')](_0x583af6[_0x143e('0x50')][_0x143e('0x5a')]);_0x326019['where']=qs['filters'](_[_0x143e('0x5b')](_0x583af6['query'],_0x5f2aed[_0x143e('0x52')]),_0x566de9);if(_0x583af6['query'][_0x143e('0x5c')]){_0x326019[_0x143e('0x5d')]=_[_0x143e('0x5e')](_0x326019['where'],{'$or':_[_0x143e('0x4a')](_0x566de9,function(_0x120434){if(_0x120434['type']!==_0x143e('0x5f')){var _0x57a2f6={};_0x57a2f6[_0x120434[_0x143e('0x2b')]]={'$like':'%'+_0x583af6[_0x143e('0x50')][_0x143e('0x5c')]+'%'};return _0x57a2f6;}})});}_0x326019=_[_0x143e('0x5e')]({},_0x326019,_0x583af6[_0x143e('0x60')]);var _0x4bc059={'where':_0x326019['where']};return db[_0x143e('0x4b')][_0x143e('0x23')](_0x4bc059)[_0x143e('0x11')](function(_0x162eb7){_0x3119f1[_0x143e('0x23')]=_0x162eb7;if(_0x583af6[_0x143e('0x50')][_0x143e('0x61')]){_0x326019[_0x143e('0x62')]=[{'all':!![]}];}return db['MailAccount'][_0x143e('0x63')](_0x326019);})['then'](function(_0x2337d8){_0x3119f1[_0x143e('0x64')]=_0x2337d8;return _0x3119f1;})[_0x143e('0x11')](respondWithFilteredResult(_0x23c94c,_0x326019))[_0x143e('0x1c')](handleError(_0x23c94c,null));};exports[_0x143e('0x65')]=function(_0x3db166,_0x1536c9){var _0x1fc78e={'raw':![],'where':{'id':_0x3db166[_0x143e('0x66')]['id']},'include':[{'model':db[_0x143e('0x47')],'as':'Imap'},{'model':db[_0x143e('0x67')],'as':_0x143e('0x45')},{'model':db[_0x143e('0x48')],'as':'mandatoryDispositionPause'}]},_0x6c1ad7={};_0x6c1ad7[_0x143e('0x57')]=_['keys'](db[_0x143e('0x4b')][_0x143e('0x4c')]);_0x6c1ad7[_0x143e('0x50')]=_[_0x143e('0x51')](_0x3db166[_0x143e('0x50')]);_0x6c1ad7[_0x143e('0x52')]=_[_0x143e('0x54')](_0x6c1ad7[_0x143e('0x57')],_0x6c1ad7[_0x143e('0x50')]);_0x1fc78e[_0x143e('0x53')]=_[_0x143e('0x54')](_0x6c1ad7['model'],qs['fields'](_0x3db166[_0x143e('0x50')][_0x143e('0x55')]));_0x1fc78e[_0x143e('0x53')]=_0x1fc78e[_0x143e('0x53')][_0x143e('0x56')]?_0x1fc78e['attributes']:_0x6c1ad7[_0x143e('0x57')];if(_0x3db166[_0x143e('0x50')]['includeAll']){_0x1fc78e[_0x143e('0x62')]=[{'all':!![]}];}_0x1fc78e=_[_0x143e('0x5e')]({},_0x1fc78e,_0x3db166[_0x143e('0x60')]);return db[_0x143e('0x4b')][_0x143e('0x68')](_0x1fc78e)['then'](handleEntityNotFound(_0x1536c9,null))[_0x143e('0x11')](respondWithResult(_0x1536c9,null))[_0x143e('0x1c')](handleError(_0x1536c9,null));};exports['update']=function(_0x300908,_0x27b953){if(_0x300908[_0x143e('0x69')]['id']){delete _0x300908['body']['id'];}var _0x24fa6e=_0x300908[_0x143e('0x69')]['provider']===_0x143e('0x6a')?null:_0x300908[_0x143e('0x69')]['provider'];var _0x4588a2=_0x300908[_0x143e('0x69')][_0x143e('0x44')]||{};var _0x41c1de=_0x300908['body'][_0x143e('0x45')]||{};if(_0x24fa6e){_0x4588a2['host']=getImapHost(_0x24fa6e);_0x4588a2[_0x143e('0x40')]=0x3e1;_0x41c1de[_0x143e('0x3f')]=getSmtpHost(_0x24fa6e);_0x41c1de[_0x143e('0x40')]=0x24b;_0x41c1de[_0x143e('0x41')]=![];}if(_0x41c1de[_0x143e('0x3d')]){_0x41c1de[_0x143e('0x41')]=![];}else{_0x41c1de['CloudProviderId']=null;}if(!_0x4588a2[_0x143e('0x3d')])_0x4588a2[_0x143e('0x3e')]=null;_0x300908[_0x143e('0x69')][_0x143e('0x44')]=_0x4588a2;_0x300908[_0x143e('0x69')][_0x143e('0x45')]=_0x41c1de;return db['MailAccount']['find']({'where':{'id':_0x300908[_0x143e('0x66')]['id']},'include':[{'model':db[_0x143e('0x47')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x143e('0x45')},{'model':db['Pause'],'as':_0x143e('0x49')}]})['then'](handleEntityNotFound(_0x27b953,null))['then'](function(_0x404f77){if(!_0x404f77)throw new Error(_0x143e('0x6b'));if(_0x404f77['service'])delete _0x300908[_0x143e('0x69')][_0x143e('0x44')];return _0x404f77;})[_0x143e('0x11')](saveUpdates(_0x300908[_0x143e('0x69')],null))[_0x143e('0x11')](function(_0x392510){if(!_0x300908['body'][_0x143e('0x44')])return _0x392510;return db[_0x143e('0x47')]['update'](_0x300908[_0x143e('0x69')][_0x143e('0x44')],{'where':{'MailAccountId':_0x392510['id']}})['then'](function(){return _0x392510;});})[_0x143e('0x11')](function(_0x537106){if(!_0x300908['body']['Smtp'])return _0x537106;return db['MailServerOut'][_0x143e('0x26')](_0x300908[_0x143e('0x69')]['Smtp'],{'where':{'MailAccountId':_0x537106['id']}})[_0x143e('0x11')](function(){return _0x537106;});})[_0x143e('0x11')](respondWithResult(_0x27b953,null))[_0x143e('0x1c')](handleError(_0x27b953,null));};exports[_0x143e('0x6c')]=function(_0x20d9b9,_0x232b9f){return db[_0x143e('0x4b')]['describe']()[_0x143e('0x11')](respondWithResult(_0x232b9f,null))['catch'](handleError(_0x232b9f,null));};exports[_0x143e('0x6d')]=function(_0x2dec90,_0x10661b){if(_0x2dec90['body']['id']){delete _0x2dec90[_0x143e('0x69')]['id'];}return db['MailAccount'][_0x143e('0x68')]({'where':{'id':_0x2dec90[_0x143e('0x66')]['id']}})['then'](handleEntityNotFound(_0x10661b,null))[_0x143e('0x11')](function(_0x1cda6b){if(_0x1cda6b){_0x2dec90[_0x143e('0x69')][_0x143e('0x6e')]=_0x1cda6b['id'];return db[_0x143e('0x6f')][_0x143e('0x70')](_0x2dec90[_0x143e('0x69')]);}})[_0x143e('0x11')](respondWithResult(_0x10661b,null))['catch'](handleError(_0x10661b,null));};exports['getDispositions']=function(_0x23af4a,_0x48652f){var _0x5646f1={'raw':![],'where':{}};var _0x24f09b={};var _0x2fac43={'count':0x0,'rows':[]};return db[_0x143e('0x4b')]['findOne']({'where':{'id':_0x23af4a['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x48652f,null))[_0x143e('0x11')](function(_0x42bf19){if(_0x42bf19){_0x24f09b['model']=_['keys'](db[_0x143e('0x6f')][_0x143e('0x4c')]);_0x24f09b[_0x143e('0x50')]=_[_0x143e('0x51')](_0x23af4a['query']);_0x24f09b['filters']=_[_0x143e('0x54')](_0x24f09b[_0x143e('0x57')],_0x24f09b[_0x143e('0x50')]);_0x5646f1[_0x143e('0x53')]=_[_0x143e('0x54')](_0x24f09b[_0x143e('0x57')],qs[_0x143e('0x55')](_0x23af4a['query']['fields']));_0x5646f1['attributes']=_0x5646f1[_0x143e('0x53')][_0x143e('0x56')]?_0x5646f1[_0x143e('0x53')]:_0x24f09b[_0x143e('0x57')];if(!_0x23af4a['query'][_0x143e('0x71')]('nolimit')){_0x5646f1[_0x143e('0x22')]=qs[_0x143e('0x22')](_0x23af4a[_0x143e('0x50')][_0x143e('0x22')]);_0x5646f1[_0x143e('0x20')]=qs[_0x143e('0x20')](_0x23af4a[_0x143e('0x50')]['offset']);}_0x5646f1['order']=qs[_0x143e('0x5a')](_0x23af4a[_0x143e('0x50')][_0x143e('0x5a')]);_0x5646f1['where']=qs[_0x143e('0x52')](_['pick'](_0x23af4a[_0x143e('0x50')],_0x24f09b[_0x143e('0x52')]));_0x5646f1[_0x143e('0x5d')][_0x143e('0x6e')]=_0x42bf19['id'];if(_0x23af4a[_0x143e('0x50')]['filter']){_0x5646f1['where']=_['merge'](_0x5646f1[_0x143e('0x5d')],{'$or':_['map'](_0x5646f1[_0x143e('0x53')],function(_0x5cfb38){var _0x59566a={};_0x59566a[_0x5cfb38]={'$like':'%'+_0x23af4a[_0x143e('0x50')]['filter']+'%'};return _0x59566a;})});}_0x5646f1=_[_0x143e('0x5e')]({},_0x5646f1,_0x23af4a[_0x143e('0x60')]);return db['Disposition'][_0x143e('0x23')]({'where':_0x5646f1[_0x143e('0x5d')]})[_0x143e('0x11')](function(_0x42bb91){_0x2fac43[_0x143e('0x23')]=_0x42bb91;if(_0x23af4a['query'][_0x143e('0x61')]){_0x5646f1['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x5646f1);})[_0x143e('0x11')](function(_0x2dec98){_0x2fac43[_0x143e('0x64')]=_0x2dec98;return _0x2fac43;});}})[_0x143e('0x11')](respondWithFilteredResult(_0x48652f,_0x5646f1))['catch'](handleError(_0x48652f,null));};exports[_0x143e('0x72')]=function(_0x260ea1,_0x4f0271){return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x260ea1[_0x143e('0x66')]['id']}})['then'](handleEntityNotFound(_0x4f0271,null))['then'](function(_0x2a1bdc){if(_0x2a1bdc){return _0x2a1bdc[_0x143e('0x72')](_0x260ea1[_0x143e('0x50')]['ids']);}})[_0x143e('0x11')](respondWithStatusCode(_0x4f0271,null))['catch'](handleError(_0x4f0271,null));};exports[_0x143e('0x73')]=function(_0x1a3de2,_0xaa3e27){if(_0x1a3de2[_0x143e('0x69')]['id']){delete _0x1a3de2[_0x143e('0x69')]['id'];}return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x1a3de2['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0xaa3e27,null))[_0x143e('0x11')](function(_0x3fc0b9){if(_0x3fc0b9){_0x1a3de2['body'][_0x143e('0x6e')]=_0x3fc0b9['id'];return db[_0x143e('0x74')][_0x143e('0x70')](_0x1a3de2[_0x143e('0x69')]);}})[_0x143e('0x11')](respondWithResult(_0xaa3e27,null))['catch'](handleError(_0xaa3e27,null));};exports[_0x143e('0x75')]=function(_0x2edaf1,_0x5778a1){var _0x3ca830={'raw':![],'where':{}};var _0x3c3cd7={};var _0x51392b={'count':0x0,'rows':[]};return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x2edaf1[_0x143e('0x66')]['id']}})['then'](handleEntityNotFound(_0x5778a1,null))[_0x143e('0x11')](function(_0x4cb0c1){if(_0x4cb0c1){_0x3c3cd7[_0x143e('0x57')]=_['keys'](db['CannedAnswer'][_0x143e('0x4c')]);_0x3c3cd7['query']=_[_0x143e('0x51')](_0x2edaf1[_0x143e('0x50')]);_0x3c3cd7['filters']=_[_0x143e('0x54')](_0x3c3cd7[_0x143e('0x57')],_0x3c3cd7[_0x143e('0x50')]);_0x3ca830['attributes']=_['intersection'](_0x3c3cd7[_0x143e('0x57')],qs[_0x143e('0x55')](_0x2edaf1[_0x143e('0x50')][_0x143e('0x55')]));_0x3ca830[_0x143e('0x53')]=_0x3ca830[_0x143e('0x53')]['length']?_0x3ca830[_0x143e('0x53')]:_0x3c3cd7['model'];if(!_0x2edaf1[_0x143e('0x50')][_0x143e('0x71')](_0x143e('0x58'))){_0x3ca830['limit']=qs[_0x143e('0x22')](_0x2edaf1[_0x143e('0x50')][_0x143e('0x22')]);_0x3ca830[_0x143e('0x20')]=qs[_0x143e('0x20')](_0x2edaf1['query'][_0x143e('0x20')]);}_0x3ca830[_0x143e('0x59')]=qs['sort'](_0x2edaf1[_0x143e('0x50')]['sort']);_0x3ca830['where']=qs[_0x143e('0x52')](_[_0x143e('0x5b')](_0x2edaf1['query'],_0x3c3cd7[_0x143e('0x52')]));_0x3ca830[_0x143e('0x5d')][_0x143e('0x6e')]=_0x4cb0c1['id'];if(_0x2edaf1[_0x143e('0x50')][_0x143e('0x5c')]){_0x3ca830[_0x143e('0x5d')]=_[_0x143e('0x5e')](_0x3ca830[_0x143e('0x5d')],{'$or':_['map'](_0x3ca830[_0x143e('0x53')],function(_0x286e63){var _0x527ea6={};_0x527ea6[_0x286e63]={'$like':'%'+_0x2edaf1['query'][_0x143e('0x5c')]+'%'};return _0x527ea6;})});}_0x3ca830=_['merge']({},_0x3ca830,_0x2edaf1[_0x143e('0x60')]);return db[_0x143e('0x74')][_0x143e('0x23')]({'where':_0x3ca830['where']})[_0x143e('0x11')](function(_0x46b6a7){_0x51392b[_0x143e('0x23')]=_0x46b6a7;if(_0x2edaf1[_0x143e('0x50')][_0x143e('0x61')]){_0x3ca830[_0x143e('0x62')]=[{'all':!![]}];}return db[_0x143e('0x74')][_0x143e('0x63')](_0x3ca830);})[_0x143e('0x11')](function(_0x390bac){_0x51392b[_0x143e('0x64')]=_0x390bac;return _0x51392b;});}})[_0x143e('0x11')](respondWithFilteredResult(_0x5778a1,_0x3ca830))[_0x143e('0x1c')](handleError(_0x5778a1,null));};exports['removeAnswers']=function(_0x5a881d,_0x3a12eb){return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x5a881d[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x3a12eb,null))[_0x143e('0x11')](function(_0x5bb2e1){if(_0x5bb2e1){return _0x5bb2e1[_0x143e('0x77')](_0x5a881d[_0x143e('0x50')]['ids']);}})[_0x143e('0x11')](respondWithStatusCode(_0x3a12eb,null))['catch'](handleError(_0x3a12eb,null));};exports[_0x143e('0x70')]=function(_0x140bae,_0x2bd8a7){var _0x17e775={'name':_0x140bae[_0x143e('0x69')][_0x143e('0x2b')],'key':_0x140bae[_0x143e('0x69')][_0x143e('0x4f')],'provider':_0x140bae['body']['provider']===_0x143e('0x6a')?null:_0x140bae[_0x143e('0x69')][_0x143e('0x78')],'email':_0x140bae[_0x143e('0x69')]['email'],'ListId':_0x140bae[_0x143e('0x69')][_0x143e('0x79')],'active':!_[_0x143e('0x7a')](_0x140bae[_0x143e('0x69')]['active'])?_0x140bae[_0x143e('0x69')][_0x143e('0x7b')]:!![],'description':_0x140bae[_0x143e('0x69')][_0x143e('0x7c')]||null};var _0x283889=getAuthenticationOptions(_0x17e775[_0x143e('0x78')],_0x140bae[_0x143e('0x69')]);_0x17e775[_0x143e('0x44')]=_0x283889[_0x143e('0x44')];_0x17e775[_0x143e('0x45')]=_0x283889[_0x143e('0x45')];return db[_0x143e('0x4b')][_0x143e('0x70')](_0x17e775,{'include':[{'model':db[_0x143e('0x67')],'as':_0x143e('0x45')},{'model':db[_0x143e('0x47')],'as':'Imap'}]})['then'](function(_0x14c0d5){var _0xee57d2=_0x140bae['user']['get']({'plain':!![]});if(!_0xee57d2)throw new Error(_0x143e('0x7d'));if(_0xee57d2[_0x143e('0x7e')]===_0x143e('0x39')){var _0x8122ff=_0x14c0d5[_0x143e('0x27')]({'plain':!![]});return db[_0x143e('0x7f')][_0x143e('0x68')]({'where':{'name':_0x143e('0x28'),'userProfileId':_0xee57d2[_0x143e('0x80')]},'raw':!![]})[_0x143e('0x11')](function(_0x22a400){if(_0x22a400&&_0x22a400['autoAssociation']===0x0){return db[_0x143e('0x29')][_0x143e('0x70')]({'name':_0x8122ff[_0x143e('0x2b')],'resourceId':_0x8122ff['id'],'type':_0x22a400[_0x143e('0x2b')],'sectionId':_0x22a400['id']},{})['then'](function(){return _0x14c0d5;});}else{return _0x14c0d5;}})[_0x143e('0x1c')](function(_0x5e9389){logger[_0x143e('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e9389);throw _0x5e9389;});}return _0x14c0d5;})[_0x143e('0x11')](respondWithResult(_0x2bd8a7,0xc9))[_0x143e('0x1c')](handleError(_0x2bd8a7,null));};exports[_0x143e('0x81')]=function(_0x252694,_0x196580){return db['MailAccount']['findOne']({'where':{'id':_0x252694[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x196580,null))[_0x143e('0x11')](function(_0xe229d7){if(_0xe229d7){return _0xe229d7[_0x143e('0x81')]();}return null;})['then'](respondWithResult(_0x196580,null))[_0x143e('0x1c')](handleError(_0x196580,null));};exports['addImap']=function(_0x2dcd5c,_0x5196e3){if(_0x2dcd5c[_0x143e('0x69')]['id']){delete _0x2dcd5c[_0x143e('0x69')]['id'];}return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x2dcd5c[_0x143e('0x66')]['id']}})['then'](handleEntityNotFound(_0x5196e3,null))['then'](function(_0x1e053a){if(_0x1e053a){_0x2dcd5c['body']['MailAccountId']=_0x1e053a['id'];return db[_0x143e('0x47')]['create'](_0x2dcd5c[_0x143e('0x69')]);}})[_0x143e('0x11')](respondWithResult(_0x5196e3,null))[_0x143e('0x1c')](handleError(_0x5196e3,null));};exports[_0x143e('0x82')]=function(_0x24e79c,_0x583236){return db['MailAccount'][_0x143e('0x76')]({'where':{'id':_0x24e79c[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x583236,null))[_0x143e('0x11')](function(_0x37658d){if(_0x37658d){return _0x37658d[_0x143e('0x83')](null);}return null;})[_0x143e('0x11')](respondWithStatusCode(_0x583236,null))['catch'](handleError(_0x583236,null));};exports['getSmtp']=function(_0x3a607f,_0x14be75){return db['MailAccount'][_0x143e('0x76')]({'where':{'id':_0x3a607f[_0x143e('0x66')]['id']}})['then'](handleEntityNotFound(_0x14be75,null))[_0x143e('0x11')](function(_0xf6145c){if(_0xf6145c){return _0xf6145c['getSmtp']();}return null;})['then'](respondWithResult(_0x14be75,null))[_0x143e('0x1c')](handleError(_0x14be75,null));};exports[_0x143e('0x84')]=function(_0x7aed34,_0x200ede){if(_0x7aed34[_0x143e('0x69')]['id']){delete _0x7aed34[_0x143e('0x69')]['id'];}return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x7aed34[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x200ede,null))[_0x143e('0x11')](function(_0x1d62ba){if(_0x1d62ba){_0x7aed34[_0x143e('0x69')][_0x143e('0x6e')]=_0x1d62ba['id'];return db[_0x143e('0x67')][_0x143e('0x70')](_0x7aed34['body']);}})[_0x143e('0x11')](respondWithResult(_0x200ede,null))[_0x143e('0x1c')](handleError(_0x200ede,null));};exports[_0x143e('0x85')]=function(_0x3a53a9,_0x4d8345){return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x3a53a9[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x4d8345,null))[_0x143e('0x11')](function(_0x1fbec4){if(_0x1fbec4){return _0x1fbec4[_0x143e('0x86')](null);}return null;})[_0x143e('0x11')](respondWithStatusCode(_0x4d8345,null))['catch'](handleError(_0x4d8345,null));};exports[_0x143e('0x87')]=function(_0x46475f,_0x4af99a){return db[_0x143e('0x88')][_0x143e('0x68')]({'where':{'id':_0x46475f['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x4af99a,null))[_0x143e('0x11')](function(_0x2d4b53){if(_0x2d4b53){return _0x2d4b53[_0x143e('0x87')](_0x46475f['body'][_0x143e('0x89')],_[_0x143e('0x8a')](_0x46475f[_0x143e('0x69')],[_0x143e('0x89'),'id'])||{});}})['then'](respondWithResult(_0x4af99a,null))['catch'](handleError(_0x4af99a,null));};exports[_0x143e('0x8b')]=function(_0x228def,_0x43010d){var _0x5f16f5={'raw':![],'where':{}};var _0x3ba55a={};var _0x402bd5={'count':0x0,'rows':[]};return db[_0x143e('0x4b')]['findOne']({'where':{'id':_0x228def['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x43010d,null))['then'](function(_0x3bd850){if(_0x3bd850){_0x3ba55a[_0x143e('0x57')]=_['keys'](db['MailInteraction'][_0x143e('0x4c')]);_0x3ba55a['query']=_['keys'](_0x228def['query']);_0x3ba55a[_0x143e('0x52')]=_[_0x143e('0x54')](_0x3ba55a['model'],_0x3ba55a[_0x143e('0x50')]);_0x5f16f5['attributes']=_['intersection'](_0x3ba55a[_0x143e('0x57')],qs[_0x143e('0x55')](_0x228def['query'][_0x143e('0x55')]));_0x5f16f5[_0x143e('0x53')]=_0x5f16f5[_0x143e('0x53')]['length']?_0x5f16f5[_0x143e('0x53')]:_0x3ba55a[_0x143e('0x57')];if(!_0x228def[_0x143e('0x50')][_0x143e('0x71')](_0x143e('0x58'))){_0x5f16f5[_0x143e('0x22')]=qs['limit'](_0x228def['query'][_0x143e('0x22')]);_0x5f16f5[_0x143e('0x20')]=qs[_0x143e('0x20')](_0x228def[_0x143e('0x50')][_0x143e('0x20')]);}_0x5f16f5['order']=qs['sort'](_0x228def[_0x143e('0x50')][_0x143e('0x5a')]);_0x5f16f5[_0x143e('0x5d')]=qs['filters'](_['pick'](_0x228def[_0x143e('0x50')],_0x3ba55a['filters']));_0x5f16f5['where'][_0x143e('0x6e')]=_0x3bd850['id'];if(_0x228def[_0x143e('0x50')][_0x143e('0x5c')]){_0x5f16f5['where']=_[_0x143e('0x5e')](_0x5f16f5[_0x143e('0x5d')],{'$or':_[_0x143e('0x4a')](_0x5f16f5[_0x143e('0x53')],function(_0x5af45c){var _0x53fff9={};_0x53fff9[_0x5af45c]={'$like':'%'+_0x228def[_0x143e('0x50')][_0x143e('0x5c')]+'%'};return _0x53fff9;})});}_0x5f16f5=_['merge']({},_0x5f16f5,_0x228def[_0x143e('0x60')]);return db['MailInteraction'][_0x143e('0x23')]({'where':_0x5f16f5[_0x143e('0x5d')]})[_0x143e('0x11')](function(_0x11dce2){_0x402bd5[_0x143e('0x23')]=_0x11dce2;if(_0x228def[_0x143e('0x50')][_0x143e('0x61')]){_0x5f16f5[_0x143e('0x62')]=[{'model':db[_0x143e('0x8c')],'as':_0x143e('0x8d'),'required':![]},{'model':db[_0x143e('0x8e')],'as':_0x143e('0x8f'),'attributes':['name',_0x143e('0x90'),_0x143e('0x91')],'required':![]},{'model':db[_0x143e('0x92')],'as':_0x143e('0x93'),'attributes':['id',_0x143e('0x2b'),_0x143e('0x94')],'where':_0x228def[_0x143e('0x50')][_0x143e('0x95')]?{'id':_0x228def[_0x143e('0x50')][_0x143e('0x95')]}:undefined,'required':_0x228def[_0x143e('0x50')][_0x143e('0x95')]?!![]:![]}];}return db[_0x143e('0x88')][_0x143e('0x63')](_0x5f16f5);})['then'](function(_0x35fb6d){_0x402bd5['rows']=_0x35fb6d;return _0x402bd5;});}})[_0x143e('0x11')](respondWithFilteredResult(_0x43010d,_0x5f16f5))[_0x143e('0x1c')](handleError(_0x43010d,null));};exports['addApplications']=function addApplications(_0x4002f6,_0x755441){var _0x7096b6=_0x4002f6['params']['id'];var _0x477aff=_0x4002f6['body'];var _0x251698=0xc8;var _0x9c5945=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x143e('0x96')][_0x143e('0x97')][_0x143e('0x98')]['READ_COMMITTED']},function(_0x419026){return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x7096b6},'transaction':_0x419026})[_0x143e('0x11')](function(_0x193824){if(_0x193824){return db['MailApplication'][_0x143e('0x2a')]({'where':{'MailAccountId':_0x7096b6},'transaction':_0x419026})['then'](function(){var _0x307657=_[_0x143e('0x4a')](_0x477aff,function(_0x2e9f22){_0x2e9f22['MailAccountId']=_0x7096b6;return _0x2e9f22;});return db[_0x143e('0x99')]['bulkCreate'](_0x307657,{'transaction':_0x419026});});}else{_0x251698=0x194;_0x9c5945=[];}});})[_0x143e('0x11')](function(){if(_0x251698!==0x194){return db[_0x143e('0x99')]['findAndCountAll']({'where':{'MailAccountId':_0x7096b6},'order':_0x143e('0x9a')})[_0x143e('0x11')](function(_0x51febe){_0x9c5945=_0x51febe;});}})[_0x143e('0x1c')](function(_0x164eee){_0x251698=0x1f4;logger['error'](_0x164eee[_0x143e('0x9b')]);if(_0x164eee[_0x143e('0x2b')]){delete _0x164eee['name'];}_0x9c5945=_0x164eee;})[_0x143e('0x9c')](function(){if(_0x9c5945===null){_0x755441[_0x143e('0x1d')](_0x251698);}else{if(_0x251698===0x1f4){_0x755441['status'](_0x251698)[_0x143e('0x2c')](_0x9c5945);}else{_0x755441[_0x143e('0x1e')](_0x251698)[_0x143e('0x25')](_0x9c5945);}}});};exports['getApplications']=function(_0x31ad39,_0x3c6896){var _0x34825f={};var _0x169b8b={};var _0x2b7ef9;var _0x5c9af3;return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x31ad39['params']['id']}})['then'](handleEntityNotFound(_0x3c6896,null))[_0x143e('0x11')](function(_0x4561e0){if(_0x4561e0){_0x2b7ef9=_0x4561e0;_0x169b8b[_0x143e('0x57')]=_['keys'](db[_0x143e('0x99')][_0x143e('0x4c')]);_0x169b8b[_0x143e('0x50')]=_['keys'](_0x31ad39[_0x143e('0x50')]);_0x169b8b[_0x143e('0x52')]=_[_0x143e('0x54')](_0x169b8b[_0x143e('0x57')],_0x169b8b['query']);_0x34825f['attributes']=_[_0x143e('0x54')](_0x169b8b[_0x143e('0x57')],qs[_0x143e('0x55')](_0x31ad39['query']['fields']));_0x34825f[_0x143e('0x53')]=_0x34825f[_0x143e('0x53')][_0x143e('0x56')]?_0x34825f[_0x143e('0x53')]:_0x169b8b[_0x143e('0x57')];_0x34825f[_0x143e('0x59')]=qs[_0x143e('0x5a')](_0x31ad39[_0x143e('0x50')][_0x143e('0x5a')]);_0x34825f[_0x143e('0x5d')]=qs['filters'](_[_0x143e('0x5b')](_0x31ad39[_0x143e('0x50')],_0x169b8b[_0x143e('0x52')]));if(_0x31ad39['query'][_0x143e('0x5c')]){_0x34825f[_0x143e('0x5d')]=_[_0x143e('0x5e')](_0x34825f[_0x143e('0x5d')],{'$or':_[_0x143e('0x4a')](_0x34825f[_0x143e('0x53')],function(_0x57e0c3){var _0x19d627={};_0x19d627[_0x57e0c3]={'$like':'%'+_0x31ad39['query'][_0x143e('0x5c')]+'%'};return _0x19d627;})});}_0x34825f=_['merge']({},_0x34825f,_0x31ad39[_0x143e('0x60')]);return _0x2b7ef9[_0x143e('0x9d')](_0x34825f);}})[_0x143e('0x11')](function(_0x102327){if(_0x102327){_0x5c9af3=_0x102327[_0x143e('0x56')];if(!_0x31ad39[_0x143e('0x50')][_0x143e('0x71')](_0x143e('0x58'))){_0x34825f['limit']=qs['limit'](_0x31ad39[_0x143e('0x50')]['limit']);_0x34825f['offset']=qs[_0x143e('0x20')](_0x31ad39[_0x143e('0x50')][_0x143e('0x20')]);}return _0x2b7ef9[_0x143e('0x9d')](_0x34825f);}})[_0x143e('0x11')](function(_0x4a22f7){if(_0x4a22f7){return _0x4a22f7?{'count':_0x5c9af3,'rows':_0x4a22f7}:null;}})[_0x143e('0x11')](respondWithResult(_0x3c6896,null))[_0x143e('0x1c')](handleError(_0x3c6896,null));};exports[_0x143e('0x9e')]=function(_0x7d0f2d,_0x2e420a){var _0x3cdf76={'raw':!![],'where':{}};var _0x3734f9={};var _0x55e8d6={'count':0x0,'rows':[]};return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x7d0f2d[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x2e420a,null))['then'](function(_0x3a58f7){if(_0x3a58f7){_0x3734f9[_0x143e('0x57')]=_['keys'](db[_0x143e('0x9f')][_0x143e('0x4c')]);_0x3734f9[_0x143e('0x50')]=_[_0x143e('0x51')](_0x7d0f2d['query']);_0x3734f9[_0x143e('0x52')]=_[_0x143e('0x54')](_0x3734f9[_0x143e('0x57')],_0x3734f9[_0x143e('0x50')]);_0x3cdf76[_0x143e('0x53')]=_[_0x143e('0x54')](_0x3734f9[_0x143e('0x57')],qs[_0x143e('0x55')](_0x7d0f2d['query'][_0x143e('0x55')]));_0x3cdf76[_0x143e('0x53')]=_0x3cdf76[_0x143e('0x53')][_0x143e('0x56')]?_0x3cdf76[_0x143e('0x53')]:_0x3734f9[_0x143e('0x57')];if(!_0x7d0f2d[_0x143e('0x50')][_0x143e('0x71')](_0x143e('0x58'))){_0x3cdf76[_0x143e('0x22')]=qs[_0x143e('0x22')](_0x7d0f2d[_0x143e('0x50')]['limit']);_0x3cdf76[_0x143e('0x20')]=qs[_0x143e('0x20')](_0x7d0f2d[_0x143e('0x50')]['offset']);}_0x3cdf76[_0x143e('0x59')]=qs[_0x143e('0x5a')](_0x7d0f2d['query'][_0x143e('0x5a')]);_0x3cdf76[_0x143e('0x5d')]=qs[_0x143e('0x52')](_[_0x143e('0x5b')](_0x7d0f2d['query'],_0x3734f9[_0x143e('0x52')]));_0x3cdf76[_0x143e('0x5d')][_0x143e('0x6e')]=_0x3a58f7['id'];if(_0x7d0f2d[_0x143e('0x50')][_0x143e('0x5c')]){_0x3cdf76['where']=_[_0x143e('0x5e')](_0x3cdf76['where'],{'$or':_[_0x143e('0x4a')](_0x3cdf76[_0x143e('0x53')],function(_0x4dec12){var _0x598541={};_0x598541[_0x4dec12]={'$like':'%'+_0x7d0f2d['query'][_0x143e('0x5c')]+'%'};return _0x598541;})});}if(_0x7d0f2d[_0x143e('0x50')][_0x143e('0xa0')]){var _0x312974=_0x7d0f2d[_0x143e('0x50')]['$gte'][_0x143e('0xa1')](',');var _0x5ba558={};_0x5ba558[_0x312974[0x0]]={'$gte':moment(_0x312974[0x1])['format'](_0x143e('0xa2'))};_0x3cdf76[_0x143e('0x5d')]=_[_0x143e('0x5e')](_0x3cdf76['where'],_0x5ba558);}_0x3cdf76=_['merge']({},_0x3cdf76,_0x7d0f2d[_0x143e('0x60')]);return db['MailMessage']['count']({'where':_0x3cdf76[_0x143e('0x5d')]})[_0x143e('0x11')](function(_0x1edd87){_0x55e8d6[_0x143e('0x23')]=_0x1edd87;if(_0x7d0f2d[_0x143e('0x50')][_0x143e('0x61')]){_0x3cdf76[_0x143e('0x62')]=[{'all':!![]}];}return db[_0x143e('0x9f')][_0x143e('0x63')](_0x3cdf76);})[_0x143e('0x11')](function(_0x8f56d8){if(_0x7d0f2d[_0x143e('0x50')][_0x143e('0xa3')]===_0x143e('0xa4')){for(var _0x1837d2=0x0;_0x1837d2<_0x8f56d8[_0x143e('0x56')];_0x1837d2++){_0x8f56d8[_0x1837d2][_0x143e('0x69')]=juice(_0x8f56d8[_0x1837d2][_0x143e('0x69')]);}}_0x55e8d6[_0x143e('0x64')]=_0x8f56d8;return _0x55e8d6;});}})[_0x143e('0x11')](respondWithFilteredResult(_0x2e420a,_0x3cdf76))[_0x143e('0x1c')](handleError(_0x2e420a,null));};exports['send']=function(_0x44eeee,_0x2bd7fe){var _0x150db3,_0x5779bd={},_0x2ef6e5;if(_0x44eeee[_0x143e('0x69')]['to']){_0x2ef6e5=_0x44eeee[_0x143e('0x69')]['to'][_0x143e('0xa1')](',')[0x0];}return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x44eeee['params']['id']},'include':[{'model':db['CmList'],'as':_0x143e('0xa5'),'include':[{'model':db[_0x143e('0x8c')],'as':_0x143e('0xa6'),'where':{'email':_0x2ef6e5},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':_0x143e('0x45'),'raw':!![],'include':[{'model':db[_0x143e('0xa7')],'as':_0x143e('0xa7'),'raw':!![]}]}]})[_0x143e('0x11')](handleEntityNotFound(_0x2bd7fe,null))[_0x143e('0x11')](function(_0x28ee0e){if(!_0x28ee0e)return;_0x150db3=_0x28ee0e;if(!_0x28ee0e[_0x143e('0x45')])throw new Error(_0x143e('0xa8'));if(_[_0x143e('0x7a')](_0x44eeee['body']['from'])){_0x44eeee[_0x143e('0x69')][_0x143e('0xa9')]=util['format'](_0x143e('0xaa'),_0x28ee0e[_0x143e('0x2b')],_0x28ee0e[_0x143e('0xab')]||_0x28ee0e[_0x143e('0x45')][_0x143e('0x39')]);}if(_0x44eeee['body']['attachments']&&_0x44eeee[_0x143e('0x69')][_0x143e('0xac')][_0x143e('0x56')]){for(var _0x91703d=0x0;_0x91703d<_0x44eeee[_0x143e('0x69')][_0x143e('0xac')][_0x143e('0x56')];_0x91703d+=0x1){_0x44eeee[_0x143e('0x69')][_0x143e('0xac')][_0x91703d]={'filename':_0x44eeee[_0x143e('0x69')][_0x143e('0xac')][_0x91703d][_0x143e('0x2b')],'path':path[_0x143e('0xad')](config[_0x143e('0xae')],_0x143e('0xaf'),_0x44eeee[_0x143e('0x69')]['attachments'][_0x91703d][_0x143e('0xb0')])};}}var _0x454141=_0x28ee0e[_0x143e('0xb1')]();return respondWithRpcPromise(_0x143e('0xb2'),_0x143e('0xb3'),{'account':_0x454141,'message':_0x44eeee[_0x143e('0x69')]});})['then'](function(_0x5bceb9){if(!_0x5bceb9)return;_0x5779bd=_0x5bceb9;if(!_0x150db3[_0x143e('0xa5')])throw new Error(_0x143e('0xb4'));if(_0x150db3[_0x143e('0xa5')]['Contacts'][_0x143e('0x56')])return _0x150db3['List'][_0x143e('0xa6')][0x0];return db[_0x143e('0x8c')][_0x143e('0x70')](_['defaults'](_0x44eeee[_0x143e('0x69')],{'firstName':_0x44eeee[_0x143e('0x69')]['to'],'email':_0x44eeee[_0x143e('0x69')]['to'],'phone':_0x44eeee[_0x143e('0x69')]['to'],'ListId':_0x150db3['ListId']}));})[_0x143e('0x11')](function(_0x176615){if(!_0x176615)return;var _0x574a12={'UserId':_0x44eeee[_0x143e('0x39')]['id'],'ContactId':_0x176615['id'],'MailAccountId':_0x150db3['id'],'inReplyTo':_0x5779bd[_0x143e('0xb5')],'to':_0x44eeee[_0x143e('0x69')][_0x143e('0xa9')],'cc':_0x44eeee[_0x143e('0x69')]['cc'],'subject':_0x44eeee[_0x143e('0x69')][_0x143e('0xb6')],'attach':_0x44eeee[_0x143e('0x69')]['attach'],'firstMsgDirection':_0x143e('0xb7'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x143e('0xb7'),'Messages':[_[_0x143e('0x5e')](_0x44eeee[_0x143e('0x69')],{'messageId':_0x5779bd[_0x143e('0xb5')],'sentAt':moment()[_0x143e('0xb8')](_0x143e('0xa2')),'read':!![],'MailAccountId':_0x150db3['id'],'UserId':_0x44eeee['user']['id'],'ContactId':_0x176615['id']})]};if(_0x44eeee[_0x143e('0x69')][_0x143e('0xb9')]){_0x574a12=_[_0x143e('0x5e')](_0x574a12,_0x44eeee[_0x143e('0x69')][_0x143e('0xb9')]);}return db[_0x143e('0x88')][_0x143e('0x70')](_0x574a12,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})['then'](respondWithResult(_0x2bd7fe,null))['catch'](handleError(_0x2bd7fe,null));};exports[_0x143e('0xba')]=function(_0x1787ca,_0x495c62){return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x1787ca[_0x143e('0x66')]['id']},'include':[{'model':db[_0x143e('0x67')],'as':_0x143e('0x45'),'raw':!![],'include':[{'model':db[_0x143e('0xa7')],'as':_0x143e('0xa7'),'raw':!![]}]}]})[_0x143e('0x11')](handleEntityNotFound(_0x495c62,null))['then'](function(_0x1f410d){if(!_0x1f410d['Smtp'])return;var _0x45e803=_0x1f410d['getSmtpOptions']();return respondWithRpcPromise(_0x143e('0xbb'),_0x143e('0xba'),{'account':_0x45e803});})[_0x143e('0x11')](respondWithResult(_0x495c62,null))[_0x143e('0x1c')](handleError(_0x495c62,null));};exports[_0x143e('0x2a')]=function(_0x25f091,_0xfa1ecf){return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0x25f091['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0xfa1ecf,null))['then'](function(_0x17e7ae){if(_0x17e7ae&&_0x17e7ae[_0x143e('0x42')]){throw new db[(_0x143e('0xbc'))][(_0x143e('0xbd'))](_0x143e('0xbe'));}return _0x17e7ae;})[_0x143e('0x11')](removeEntity(_0xfa1ecf,null))[_0x143e('0x1c')](handleError(_0xfa1ecf,null));};exports[_0x143e('0xbf')]=function(_0xf6d854,_0x9d966){return db[_0x143e('0x4b')][_0x143e('0x68')]({'where':{'id':_0xf6d854['params']['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x9d966,null))['then'](function(_0x344715){if(_0x344715){return _0x344715[_0x143e('0xbf')](_0xf6d854[_0x143e('0x69')][_0x143e('0x89')],_[_0x143e('0x8a')](_0xf6d854[_0x143e('0x69')],[_0x143e('0x89'),'id'])||{})[_0x143e('0xc0')](function(_0x2ded3f){for(var _0x5bd6a4=0x0;_0x5bd6a4<_0xf6d854['body'][_0x143e('0x89')]['length'];_0x5bd6a4+=0x1){socket[_0x143e('0xc1')](_0x143e('0xc2'),{'UserId':Number(_0xf6d854[_0x143e('0x69')][_0x143e('0x89')][_0x5bd6a4]),'MailAccountId':Number(_0xf6d854[_0x143e('0x66')]['id'])});}return _0x2ded3f;});}})[_0x143e('0x11')](respondWithResult(_0x9d966,null))[_0x143e('0x1c')](handleError(_0x9d966,null));};exports[_0x143e('0xc3')]=function(_0xa25195,_0x5b8c0f){return db['MailAccount'][_0x143e('0x68')]({'where':{'id':_0xa25195[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x5b8c0f,null))[_0x143e('0x11')](function(_0x42b8de){if(_0x42b8de){return _0x42b8de[_0x143e('0xc3')](_0xa25195['query'][_0x143e('0x89')])[_0x143e('0x11')](function(){if(_['isArray'](_0xa25195[_0x143e('0x50')][_0x143e('0x89')])){for(var _0x501db9=0x0;_0x501db9<_0xa25195['query'][_0x143e('0x89')]['length'];_0x501db9+=0x1){socket[_0x143e('0xc1')](_0x143e('0xc4'),{'UserId':Number(_0xa25195[_0x143e('0x50')]['ids'][_0x501db9]),'MailAccountId':Number(_0xa25195[_0x143e('0x66')]['id'])});}}else{socket[_0x143e('0xc1')](_0x143e('0xc4'),{'UserId':Number(_0xa25195['query'][_0x143e('0x89')]),'MailAccountId':Number(_0xa25195[_0x143e('0x66')]['id'])});}});}})[_0x143e('0x11')](respondWithStatusCode(_0x5b8c0f,null))[_0x143e('0x1c')](handleError(_0x5b8c0f,null));};exports[_0x143e('0xc5')]=function(_0x5d838f,_0x2f5850){var _0x1a4a32={};var _0x434f74={};var _0x1cef71;var _0x363bc8;return db[_0x143e('0x4b')][_0x143e('0x76')]({'where':{'id':_0x5d838f[_0x143e('0x66')]['id']}})[_0x143e('0x11')](handleEntityNotFound(_0x2f5850,null))[_0x143e('0x11')](function(_0xf02a68){if(_0xf02a68){_0x1cef71=_0xf02a68;_0x434f74['model']=_[_0x143e('0x51')](db[_0x143e('0x8e')][_0x143e('0x4c')]);_0x434f74[_0x143e('0x50')]=_['keys'](_0x5d838f[_0x143e('0x50')]);_0x434f74[_0x143e('0x52')]=_[_0x143e('0x54')](_0x434f74['model'],_0x434f74['query']);_0x1a4a32['attributes']=_[_0x143e('0x54')](_0x434f74[_0x143e('0x57')],qs['fields'](_0x5d838f[_0x143e('0x50')]['fields']));_0x1a4a32[_0x143e('0x53')]=_0x1a4a32[_0x143e('0x53')][_0x143e('0x56')]?_0x1a4a32['attributes']:_0x434f74[_0x143e('0x57')];_0x1a4a32[_0x143e('0x59')]=qs[_0x143e('0x5a')](_0x5d838f[_0x143e('0x50')][_0x143e('0x5a')]);_0x1a4a32[_0x143e('0x5d')]=qs[_0x143e('0x52')](_[_0x143e('0x5b')](_0x5d838f[_0x143e('0x50')],_0x434f74[_0x143e('0x52')]));if(_0x5d838f[_0x143e('0x50')][_0x143e('0x5c')]){_0x1a4a32[_0x143e('0x5d')]=_['merge'](_0x1a4a32[_0x143e('0x5d')],{'$or':_[_0x143e('0x4a')](_0x1a4a32[_0x143e('0x53')],function(_0x56fb09){var _0x57fa59={};_0x57fa59[_0x56fb09]={'$like':'%'+_0x5d838f[_0x143e('0x50')][_0x143e('0x5c')]+'%'};return _0x57fa59;})});}_0x1a4a32=_[_0x143e('0x5e')]({},_0x1a4a32,_0x5d838f[_0x143e('0x60')]);return _0x1cef71[_0x143e('0xc5')](_0x1a4a32);}})[_0x143e('0x11')](function(_0x5efd29){if(_0x5efd29){_0x363bc8=_0x5efd29[_0x143e('0x56')];if(!_0x5d838f[_0x143e('0x50')][_0x143e('0x71')](_0x143e('0x58'))){_0x1a4a32[_0x143e('0x22')]=qs[_0x143e('0x22')](_0x5d838f['query'][_0x143e('0x22')]);_0x1a4a32[_0x143e('0x20')]=qs['offset'](_0x5d838f[_0x143e('0x50')][_0x143e('0x20')]);}return _0x1cef71[_0x143e('0xc5')](_0x1a4a32);}})[_0x143e('0x11')](function(_0x3a9df5){if(_0x3a9df5){return _0x3a9df5?{'count':_0x363bc8,'rows':_0x3a9df5}:null;}})[_0x143e('0x11')](respondWithResult(_0x2f5850,null))[_0x143e('0x1c')](handleError(_0x2f5850,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 748a006..f888981 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 _0xa751=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa751,0x175));var _0x1a75=function(_0x4c09f4,_0x341594){_0x4c09f4=_0x4c09f4-0x0;var _0x3bc5aa=_0xa751[_0x4c09f4];return _0x3bc5aa;};'use strict';var EventEmitter=require(_0x1a75('0x0'));var MailAccount=require(_0x1a75('0x1'))['db'][_0x1a75('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1a75('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1a75('0x4'),'afterDestroy':'remove'};function emitEvent(_0x31db55){return function(_0x95fa7,_0x2ea393,_0x4ebf37){MailAccountEvents[_0x1a75('0x5')](_0x31db55+':'+_0x95fa7['id'],_0x95fa7);MailAccountEvents[_0x1a75('0x5')](_0x31db55,_0x95fa7);_0x4ebf37(null);};}for(var e in events){if(events[_0x1a75('0x6')](e)){var event=events[e];MailAccount[_0x1a75('0x7')](e,emitEvent(event));}}module[_0x1a75('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xbdc1=['save','update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0xbdc1,0x147));var _0x1bdc=function(_0x334b59,_0x46c37a){_0x334b59=_0x334b59-0x0;var _0x37cef4=_0xbdc1[_0x334b59];return _0x37cef4;};'use strict';var EventEmitter=require(_0x1bdc('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x1bdc('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1bdc('0x2')](0x0);var events={'afterCreate':_0x1bdc('0x3'),'afterUpdate':_0x1bdc('0x4'),'afterDestroy':_0x1bdc('0x5')};function emitEvent(_0xaa84ca){return function(_0x59cff6,_0x4fa3e0,_0x29074f){MailAccountEvents[_0x1bdc('0x6')](_0xaa84ca+':'+_0x59cff6['id'],_0x59cff6);MailAccountEvents['emit'](_0xaa84ca,_0x59cff6);_0x29074f(null);};}for(var e in events){if(events[_0x1bdc('0x7')](e)){var event=events[e];MailAccount[_0x1bdc('0x8')](e,emitEvent(event));}}module[_0x1bdc('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 5b5071c..dd52037 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 _0xbef7=['mail_accounts','provider','service','Smtp','host','port','secure','authentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','CloudProvider','data5','pass','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbef7,0x1ea));var _0x7bef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbef7[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0x7bef('0x0'));module[_0x7bef('0x1')]=function(_0x2b57d7){return _0x2b57d7[_0x7bef('0x2')](_0x7bef('0x3'),attributes,{'tableName':_0x7bef('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x2e23b8=this;var _0x192ad9={'id':_0x2e23b8['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2e23b8[_0x7bef('0x5')]!=='custom'){_0x192ad9[_0x7bef('0x6')]=_0x2e23b8[_0x7bef('0x5')];}else{_0x192ad9['host']=_0x2e23b8[_0x7bef('0x7')][_0x7bef('0x8')];_0x192ad9[_0x7bef('0x9')]=_0x2e23b8[_0x7bef('0x7')]['port'];_0x192ad9['secure']=_0x2e23b8[_0x7bef('0x7')][_0x7bef('0xa')];}if(_0x2e23b8[_0x7bef('0x7')][_0x7bef('0xb')]){if(_0x2e23b8[_0x7bef('0x7')]['modernAuthentication']){if(!_0x2e23b8[_0x7bef('0x7')]['CloudProvider'])throw new Error(_0x7bef('0xc'));_0x192ad9[_0x7bef('0xd')]={'type':_0x7bef('0xe'),'user':_0x2e23b8[_0x7bef('0x7')][_0x7bef('0xf')],'accessToken':_0x2e23b8[_0x7bef('0x7')][_0x7bef('0x10')][_0x7bef('0x11')]};}else{_0x192ad9['auth']={'user':_0x2e23b8[_0x7bef('0x7')][_0x7bef('0xf')],'pass':_0x2e23b8['Smtp'][_0x7bef('0x12')]};}}return _0x192ad9;}}});}; \ No newline at end of file +var _0xc101=['host','port','Smtp','secure','modernAuthentication','CloudProvider','OAuth2','user','data5','auth','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service'];(function(_0x1942bc,_0x22c1ba){var _0x193474=function(_0x15d6f5){while(--_0x15d6f5){_0x1942bc['push'](_0x1942bc['shift']());}};_0x193474(++_0x22c1ba);}(_0xc101,0x90));var _0x1c10=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0xc101[_0x4e8286];return _0x44a440;};'use strict';var attributes=require(_0x1c10('0x0'));module[_0x1c10('0x1')]=function(_0x39c6b6){return _0x39c6b6[_0x1c10('0x2')](_0x1c10('0x3'),attributes,{'tableName':_0x1c10('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x10d026=this;var _0x1154a8={'id':_0x10d026['id'],'tls':{'rejectUnauthorized':![]}};if(_0x10d026[_0x1c10('0x5')]!==_0x1c10('0x6')){_0x1154a8[_0x1c10('0x7')]=_0x10d026['provider'];}else{_0x1154a8[_0x1c10('0x8')]=_0x10d026['Smtp']['host'];_0x1154a8[_0x1c10('0x9')]=_0x10d026[_0x1c10('0xa')][_0x1c10('0x9')];_0x1154a8['secure']=_0x10d026[_0x1c10('0xa')][_0x1c10('0xb')];}if(_0x10d026[_0x1c10('0xa')]['authentication']){if(_0x10d026[_0x1c10('0xa')][_0x1c10('0xc')]){if(!_0x10d026[_0x1c10('0xa')][_0x1c10('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x1154a8['auth']={'type':_0x1c10('0xe'),'user':_0x10d026['Smtp'][_0x1c10('0xf')],'accessToken':_0x10d026[_0x1c10('0xa')][_0x1c10('0xd')][_0x1c10('0x10')]};}else{_0x1154a8[_0x1c10('0x11')]={'user':_0x10d026[_0x1c10('0xa')][_0x1c10('0xf')],'pass':_0x10d026[_0x1c10('0xa')][_0x1c10('0x12')]};}}return _0x1154a8;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 3732ce7..74cb865 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 _0x7278=['User','unshift','agent','name','queueId','MailQueue','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','GetMailAccount','findAll','options','raw','where','attributes','include','map','model','stringify','ShowMailAccount','MailAccount','find','smtp','smtpOptions','getSmtpOptions','catch','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','account','omit','Applications','list','applications','priority','asc','autoclose','push','length','close','defaults','List\x20not\x20found','messageId','generate','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','MailMessage','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','Attachment','Attachments','UserId'];(function(_0x494fed,_0x52030c){var _0x14ba95=function(_0x3db26f){while(--_0x3db26f){_0x494fed['push'](_0x494fed['shift']());}};_0x14ba95(++_0x52030c);}(_0x7278,0x161));var _0x8727=function(_0x10f05e,_0x54f4f3){_0x10f05e=_0x10f05e-0x0;var _0x6b9477=_0x7278[_0x10f05e];return _0x6b9477;};'use strict';var _=require(_0x8727('0x0'));var moment=require(_0x8727('0x1'));var BPromise=require(_0x8727('0x2'));var rs=require(_0x8727('0x3'));var Redis=require(_0x8727('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x8727('0x5'))(_0x8727('0x6'));var config=require(_0x8727('0x7'));var jayson=require(_0x8727('0x8'));var client=jayson[_0x8727('0x9')][_0x8727('0xa')]({'port':0x232c});config[_0x8727('0xb')]=_['defaults'](config[_0x8727('0xb')],{'host':_0x8727('0xc'),'port':0x18eb});var socket=require(_0x8727('0xd'))(new Redis(config[_0x8727('0xb')]));require(_0x8727('0xe'))['register'](socket);function respondWithRpcPromise(_0x4b1985,_0x4df6f8,_0xb575a3){return new BPromise(function(_0x336193,_0x3a6c9b){return client[_0x8727('0xf')](_0x4b1985,_0xb575a3)[_0x8727('0x10')](function(_0x344490){logger[_0x8727('0x11')](_0x8727('0x12'),_0x4df6f8,'request\x20sent');logger[_0x8727('0x13')](_0x8727('0x14'),_0x4df6f8,_0x8727('0x15'),JSON['stringify'](_0x344490));if(_0x344490[_0x8727('0x16')]){if(_0x344490[_0x8727('0x16')]['code']===0x1f4){logger[_0x8727('0x16')](_0x8727('0x12'),_0x4df6f8,_0x344490[_0x8727('0x16')][_0x8727('0x17')]);return _0x3a6c9b(_0x344490[_0x8727('0x16')][_0x8727('0x17')]);}logger[_0x8727('0x16')](_0x8727('0x12'),_0x4df6f8,_0x344490[_0x8727('0x16')][_0x8727('0x17')]);return _0x336193(_0x344490['error'][_0x8727('0x17')]);}else{logger[_0x8727('0x11')](_0x8727('0x12'),_0x4df6f8,_0x8727('0x15'));_0x336193(_0x344490[_0x8727('0x18')][_0x8727('0x17')]);}})['catch'](function(_0x575d29){logger[_0x8727('0x16')]('MailAccount,\x20%s,\x20%s',_0x4df6f8,_0x575d29);_0x3a6c9b(_0x575d29);});});}exports[_0x8727('0x19')]=function(_0xfd266f){var _0x32cabe=this;return new Promise(function(_0x22e6c9,_0x2dae91){return db['MailAccount'][_0x8727('0x1a')]({'raw':_0xfd266f[_0x8727('0x1b')]?_0xfd266f[_0x8727('0x1b')][_0x8727('0x1c')]===undefined?!![]:![]:!![],'where':_0xfd266f[_0x8727('0x1b')]?_0xfd266f[_0x8727('0x1b')][_0x8727('0x1d')]||null:null,'attributes':_0xfd266f[_0x8727('0x1b')]?_0xfd266f[_0x8727('0x1b')][_0x8727('0x1e')]||null:null,'limit':_0xfd266f[_0x8727('0x1b')]?_0xfd266f[_0x8727('0x1b')]['limit']||null:null,'include':_0xfd266f[_0x8727('0x1b')]?_0xfd266f[_0x8727('0x1b')]['include']?_['map'](_0xfd266f[_0x8727('0x1b')][_0x8727('0x1f')],function(_0x15e8bf){return{'model':db[_0x15e8bf['model']],'as':_0x15e8bf['as'],'attributes':_0x15e8bf[_0x8727('0x1e')],'include':_0x15e8bf[_0x8727('0x1f')]?_[_0x8727('0x20')](_0x15e8bf[_0x8727('0x1f')],function(_0x2c8cd5){return{'model':db[_0x2c8cd5[_0x8727('0x21')]],'as':_0x2c8cd5['as'],'attributes':_0x2c8cd5[_0x8727('0x1e')],'include':_0x2c8cd5[_0x8727('0x1f')]?_['map'](_0x2c8cd5[_0x8727('0x1f')],function(_0x307055){return{'model':db[_0x307055['model']],'as':_0x307055['as'],'attributes':_0x307055[_0x8727('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8727('0x10')](function(_0x3ecd6a){logger[_0x8727('0x11')](_0x8727('0x19'),_0xfd266f);logger[_0x8727('0x13')]('GetMailAccount',_0xfd266f,JSON[_0x8727('0x22')](_0x3ecd6a));_0x22e6c9(_0x3ecd6a);})['catch'](function(_0x34c58e){logger['error'](_0x8727('0x19'),_0x34c58e[_0x8727('0x17')],_0xfd266f);_0x2dae91(_0x32cabe[_0x8727('0x16')](0x1f4,_0x34c58e[_0x8727('0x17')]));});});};exports[_0x8727('0x23')]=function(_0x431b24){var _0x382be3=this;return new Promise(function(_0x4b6162,_0x3ac06a){return db[_0x8727('0x24')][_0x8727('0x25')]({'raw':_0x431b24[_0x8727('0x1b')]?_0x431b24[_0x8727('0x1b')][_0x8727('0x1c')]===undefined?!![]:![]:!![],'where':_0x431b24[_0x8727('0x1b')]?_0x431b24[_0x8727('0x1b')][_0x8727('0x1d')]||null:null,'attributes':_0x431b24[_0x8727('0x1b')]?_0x431b24[_0x8727('0x1b')][_0x8727('0x1e')]||null:null,'include':_0x431b24['options']?_0x431b24['options'][_0x8727('0x1f')]?_[_0x8727('0x20')](_0x431b24[_0x8727('0x1b')][_0x8727('0x1f')],function(_0x52220f){return{'model':db[_0x52220f[_0x8727('0x21')]],'as':_0x52220f['as'],'attributes':_0x52220f[_0x8727('0x1e')],'include':_0x52220f[_0x8727('0x1f')]?_[_0x8727('0x20')](_0x52220f[_0x8727('0x1f')],function(_0x5b96cc){return{'model':db[_0x5b96cc[_0x8727('0x21')]],'as':_0x5b96cc['as'],'attributes':_0x5b96cc[_0x8727('0x1e')],'include':_0x5b96cc[_0x8727('0x1f')]?_[_0x8727('0x20')](_0x5b96cc[_0x8727('0x1f')],function(_0x3b1022){return{'model':db[_0x3b1022[_0x8727('0x21')]],'as':_0x3b1022['as'],'attributes':_0x3b1022[_0x8727('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8727('0x10')](function(_0x1a607a){if(_0x431b24[_0x8727('0x1b')][_0x8727('0x26')]===!![])_0x1a607a['setDataValue'](_0x8727('0x27'),_0x1a607a[_0x8727('0x28')]());logger[_0x8727('0x11')](_0x8727('0x23'),_0x431b24);logger[_0x8727('0x13')](_0x8727('0x23'),_0x431b24,JSON[_0x8727('0x22')](_0x1a607a));_0x4b6162(_0x1a607a);})[_0x8727('0x29')](function(_0x42d767){logger[_0x8727('0x16')](_0x8727('0x23'),_0x42d767[_0x8727('0x17')],_0x431b24);_0x3ac06a(_0x382be3[_0x8727('0x16')](0x1f4,_0x42d767[_0x8727('0x17')]));});});};exports['NotifyMailAccount']=function(_0x15fbe6){var _0x332c87=this;return new Promise(function(_0x19d08a,_0x4ac9d2){var _0x2a506f={'body':_0x15fbe6[_0x8727('0x2a')],'channel':_0x8727('0x2b')};var _0x641064=_['difference'](_[_0x8727('0x2c')](db[_0x8727('0x2d')][_0x8727('0x2e')]),[_0x8727('0x2f'),_0x8727('0x30'),_0x8727('0x31'),_0x8727('0x32')]);var _0x15b764=![];if(_0x15fbe6[_0x8727('0x2a')]['id']){delete _0x15fbe6[_0x8727('0x2a')]['id'];}if(_['isNil'](_0x15fbe6[_0x8727('0x2a')][_0x8727('0x33')])){return _0x4ac9d2(_0x332c87[_0x8727('0x16')](0x1f4,_0x8727('0x34')));}if(_[_0x8727('0x35')](_0x15fbe6['body'][_0x8727('0x2a')])||_0x15fbe6[_0x8727('0x2a')][_0x8727('0x2a')]===''){return _0x4ac9d2(_0x332c87['error'](0x1f4,_0x8727('0x36')));}if(_[_0x8727('0x35')](_0x15fbe6[_0x8727('0x2a')][_0x8727('0x37')])){return _0x4ac9d2(_0x332c87[_0x8727('0x16')](0x1f4,_0x8727('0x38')+_0x641064));}if(!_['includes'](_0x641064,_0x15fbe6[_0x8727('0x2a')][_0x8727('0x37')])){return _0x4ac9d2(_0x332c87[_0x8727('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x641064));}var _0xc19ba5={};_0xc19ba5[_0x15fbe6[_0x8727('0x2a')][_0x8727('0x37')]]=_0x15fbe6[_0x8727('0x2a')][_0x8727('0x33')];return db[_0x8727('0x24')][_0x8727('0x25')]({'where':{'id':_0x15fbe6['account']['id']},'include':[{'model':db[_0x8727('0x39')],'as':_0x8727('0x3a'),'include':[{'model':db[_0x8727('0x2d')],'as':_0x8727('0x3b'),'where':_0xc19ba5,'limit':0x1,'order':[[_0x8727('0x30'),_0x8727('0x3c')]]}]},{'model':db[_0x8727('0x3d')],'as':'Applications'},{'model':db[_0x8727('0x3e')],'as':_0x8727('0x3f'),'include':[{'model':db[_0x8727('0x40')],'as':'CloudProvider'}]}]})[_0x8727('0x10')](function(_0x22cd31){if(_0x22cd31&&_0x22cd31[_0x8727('0x3a')]){var _0x4367e8=_0x22cd31[_0x8727('0x41')]({'plain':!![]});_0x2a506f[_0x8727('0x42')]=_[_0x8727('0x43')](_0x4367e8,['Applications',_0x8727('0x3a')]);_0x2a506f['account'][_0x8727('0x27')]=_0x22cd31[_0x8727('0x28')]();_0x2a506f['applications']=_0x4367e8[_0x8727('0x44')];_0x2a506f[_0x8727('0x45')]=_0x4367e8[_0x8727('0x3a')];_0x2a506f['applications']=_['orderBy'](_0x2a506f[_0x8727('0x46')],[_0x8727('0x47')],[_0x8727('0x48')]);if(_0x2a506f['account']&&_0x2a506f[_0x8727('0x42')][_0x8727('0x49')]){_0x2a506f[_0x8727('0x46')][_0x8727('0x4a')]({'id':0x0,'priority':_0x2a506f[_0x8727('0x46')][_0x8727('0x4b')]+0x1,'app':_0x8727('0x4c'),'appdata':_0x8727('0x49'),'interval':'*,*,*,*'});}if(_0x2a506f[_0x8727('0x42')][_0x8727('0x44')]){delete _0x2a506f[_0x8727('0x42')][_0x8727('0x44')];}if(_0x2a506f['account'][_0x8727('0x3a')]){delete _0x2a506f[_0x8727('0x42')][_0x8727('0x3a')];}if(_0x4367e8[_0x8727('0x3a')][_0x8727('0x3b')][_0x8727('0x4b')]){return _0x4367e8[_0x8727('0x3a')][_0x8727('0x3b')][0x0];}var _0x508cb2=_[_0x8727('0x4d')](_0x15fbe6[_0x8727('0x2a')],{'firstName':_0x15fbe6[_0x8727('0x2a')]['from'],'ListId':_0x4367e8[_0x8727('0x32')]});_0x508cb2[_0x15fbe6['body'][_0x8727('0x37')]]=_0x15fbe6['body'][_0x8727('0x33')];return db[_0x8727('0x2d')]['create'](_0x508cb2);}else{throw new Error(_0x8727('0x4e'));}})[_0x8727('0x10')](function(_0x105a9d){_0x2a506f['contact']=_0x105a9d;if(_0x105a9d){if(!_0x15fbe6['body']['message']['messageId']){_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x4f')]=rs[_0x8727('0x50')]()+'\x20'+_0x15fbe6[_0x8727('0x2a')]['message']['from'];}var _0x23e24d={'ContactId':_0x105a9d['id'],'MailAccountId':_0x15fbe6[_0x8727('0x42')]['id'],'inReplyTo':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x4f')],'to':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x33')],'cc':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['cc'],'subject':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['subject'],'attach':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['attach'],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x8727('0x25')]({'where':{'closed':![],'MailAccountId':_0x15fbe6[_0x8727('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':_0x8727('0x51'),'attributes':[_0x8727('0x4f')],'where':{'messageId':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x52')]}}]})['then'](function(_0x375f34){if(_0x375f34){return[_0x375f34,![]];}return db[_0x8727('0x53')][_0x8727('0x54')](_0x23e24d)[_0x8727('0x10')](function(_0x2b8a7c){return[_0x2b8a7c,!![]];});});}else{throw new Error(_0x8727('0x55'));}})[_0x8727('0x56')](function(_0x190f0d,_0x1f0338){if(_0x190f0d){_0x15b764=_0x1f0338;if(!_0x1f0338){return _0x190f0d['update']({'inReplyTo':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x4f')],'to':_0x15fbe6['body'][_0x8727('0x17')]['from'],'cc':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['cc'],'subject':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x57')],'attach':_0x190f0d['attach']?_0x190f0d['attach']:_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x58')],'substatus':null,'substatusAt':moment()[_0x8727('0x59')](_0x8727('0x5a')),'lastMsgAt':moment()['format'](_0x8727('0x5a')),'lastMsgDirection':'in'});}else{return _0x190f0d;}}})['then'](function(_0x24196b){_0x2a506f['interaction']=_0x24196b['get']({'plain':!![]});_0x2a506f[_0x8727('0x5b')][_0x8727('0x5c')]=_0x15b764;return db[_0x8727('0x5d')][_0x8727('0x54')]({'body':_0x15fbe6[_0x8727('0x2a')]['body'],'MailAccountId':_0x15fbe6['account']['id'],'MailInteractionId':_0x24196b['id'],'direction':'in','ContactId':_0x2a506f[_0x8727('0x5e')]['id'],'messageId':_0x15fbe6[_0x8727('0x2a')]['message'][_0x8727('0x4f')],'from':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x33')],'to':_0x15fbe6['body'][_0x8727('0x17')]['to'],'cc':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['cc'],'subject':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x57')],'attach':_0x15fbe6[_0x8727('0x2a')]['message']['attach'],'Attachments':_0x15fbe6['body'][_0x8727('0x17')][_0x8727('0x5f')],'originTo':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x60')],'originCc':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x61')],'bcc':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x62')],'ChatWebsiteId':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')][_0x8727('0x63')]||null,'originChannel':_0x15fbe6[_0x8727('0x2a')]['message']['originChannel']||'Email','ChatOfflineMessageId':_0x15fbe6[_0x8727('0x2a')][_0x8727('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x8727('0x64')],'as':_0x8727('0x65')}]});})[_0x8727('0x10')](function(_0x4afe0b){_0x2a506f[_0x8727('0x17')]=_0x4afe0b;if(!_0x2a506f['interaction'][_0x8727('0x66')]){return;}return db[_0x8727('0x67')][_0x8727('0x25')]({'attributes':['id','name'],'where':{'id':_0x2a506f['interaction'][_0x8727('0x66')]}});})[_0x8727('0x10')](function(_0x7f71d9){if(_0x7f71d9){_0x2a506f[_0x8727('0x46')][_0x8727('0x68')]({'id':0x0,'priority':0x0,'app':_0x8727('0x69'),'appdata':_0x7f71d9[_0x8727('0x6a')]+','+(_0x2a506f[_0x8727('0x42')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x2a506f['interaction'][_0x8727('0x6b')]){return;}return db[_0x8727('0x6c')][_0x8727('0x25')]({'attributes':['id','name'],'where':{'id':_0x2a506f[_0x8727('0x5b')][_0x8727('0x6b')]}});})['then'](function(_0x1474ba){if(_0x1474ba){_0x2a506f[_0x8727('0x46')][_0x8727('0x68')]({'id':0x0,'priority':0x1,'app':_0x8727('0x6d'),'appdata':_0x1474ba[_0x8727('0x6a')]+','+(_0x2a506f[_0x8727('0x42')][_0x8727('0x6e')]||0x12c),'interval':_0x8727('0x6f')});}return respondWithRpcPromise(_0x8727('0x70'),_0x8727('0x71'),_0x2a506f);})['then'](function(_0x3ae045){_0x19d08a(_0x3ae045);})[_0x8727('0x29')](function(_0x46c573){_0x4ac9d2(_0x332c87[_0x8727('0x16')](0x1f4,_0x46c573[_0x8727('0x17')]));});});}; \ No newline at end of file +var _0x1c9a=['./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','limit','map','include','model','attributes','then','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','keys','createdAt','CompanyId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','CmContact','Contacts','updatedAt','DESC','Applications','Smtp','CloudProvider','List','get','omit','getSmtpOptions','applications','orderBy','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','messageId','generate','subject','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','attach','format','created','attachments','originTo','originCc','bcc','ChatWebsiteId','ChatOfflineMessageId','Attachment','Attachments','interaction','UserId','name','unshift','waitForTheAssignedAgent','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x344e7c,_0x16205c){var _0x108a0c=function(_0xf18b8a){while(--_0xf18b8a){_0x344e7c['push'](_0x344e7c['shift']());}};_0x108a0c(++_0x16205c);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x1bc2b4,_0x58ae33){_0x1bc2b4=_0x1bc2b4-0x0;var _0x20e155=_0x1c9a[_0x1bc2b4];return _0x20e155;};'use strict';var _=require(_0xa1c9('0x0'));var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa1c9('0x7'));var client=jayson['client'][_0xa1c9('0x8')]({'port':0x232c});config[_0xa1c9('0x9')]=_[_0xa1c9('0xa')](config[_0xa1c9('0x9')],{'host':_0xa1c9('0xb'),'port':0x18eb});var socket=require(_0xa1c9('0xc'))(new Redis(config[_0xa1c9('0x9')]));require(_0xa1c9('0xd'))[_0xa1c9('0xe')](socket);function respondWithRpcPromise(_0xfab70b,_0x2fcbcd,_0xb96573){return new BPromise(function(_0x55c191,_0x53140c){return client[_0xa1c9('0xf')](_0xfab70b,_0xb96573)['then'](function(_0x26b475){logger[_0xa1c9('0x10')](_0xa1c9('0x11'),_0x2fcbcd,_0xa1c9('0x12'));logger[_0xa1c9('0x13')](_0xa1c9('0x14'),_0x2fcbcd,_0xa1c9('0x12'),JSON[_0xa1c9('0x15')](_0x26b475));if(_0x26b475[_0xa1c9('0x16')]){if(_0x26b475[_0xa1c9('0x16')][_0xa1c9('0x17')]===0x1f4){logger[_0xa1c9('0x16')](_0xa1c9('0x11'),_0x2fcbcd,_0x26b475[_0xa1c9('0x16')][_0xa1c9('0x18')]);return _0x53140c(_0x26b475[_0xa1c9('0x16')][_0xa1c9('0x18')]);}logger[_0xa1c9('0x16')](_0xa1c9('0x11'),_0x2fcbcd,_0x26b475[_0xa1c9('0x16')]['message']);return _0x55c191(_0x26b475[_0xa1c9('0x16')]['message']);}else{logger[_0xa1c9('0x10')](_0xa1c9('0x11'),_0x2fcbcd,_0xa1c9('0x12'));_0x55c191(_0x26b475[_0xa1c9('0x19')][_0xa1c9('0x18')]);}})[_0xa1c9('0x1a')](function(_0x223932){logger[_0xa1c9('0x16')](_0xa1c9('0x11'),_0x2fcbcd,_0x223932);_0x53140c(_0x223932);});});}exports[_0xa1c9('0x1b')]=function(_0x278ba6){var _0x18c22d=this;return new Promise(function(_0x58b01f,_0x1a5b8e){return db[_0xa1c9('0x1c')][_0xa1c9('0x1d')]({'raw':_0x278ba6[_0xa1c9('0x1e')]?_0x278ba6[_0xa1c9('0x1e')][_0xa1c9('0x1f')]===undefined?!![]:![]:!![],'where':_0x278ba6[_0xa1c9('0x1e')]?_0x278ba6[_0xa1c9('0x1e')]['where']||null:null,'attributes':_0x278ba6[_0xa1c9('0x1e')]?_0x278ba6[_0xa1c9('0x1e')]['attributes']||null:null,'limit':_0x278ba6[_0xa1c9('0x1e')]?_0x278ba6[_0xa1c9('0x1e')][_0xa1c9('0x20')]||null:null,'include':_0x278ba6[_0xa1c9('0x1e')]?_0x278ba6[_0xa1c9('0x1e')]['include']?_[_0xa1c9('0x21')](_0x278ba6[_0xa1c9('0x1e')][_0xa1c9('0x22')],function(_0x484a6b){return{'model':db[_0x484a6b[_0xa1c9('0x23')]],'as':_0x484a6b['as'],'attributes':_0x484a6b[_0xa1c9('0x24')],'include':_0x484a6b[_0xa1c9('0x22')]?_[_0xa1c9('0x21')](_0x484a6b[_0xa1c9('0x22')],function(_0x339dee){return{'model':db[_0x339dee[_0xa1c9('0x23')]],'as':_0x339dee['as'],'attributes':_0x339dee[_0xa1c9('0x24')],'include':_0x339dee[_0xa1c9('0x22')]?_[_0xa1c9('0x21')](_0x339dee[_0xa1c9('0x22')],function(_0x364e70){return{'model':db[_0x364e70[_0xa1c9('0x23')]],'as':_0x364e70['as'],'attributes':_0x364e70[_0xa1c9('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa1c9('0x25')](function(_0xf584e2){logger['info'](_0xa1c9('0x1b'),_0x278ba6);logger[_0xa1c9('0x13')](_0xa1c9('0x1b'),_0x278ba6,JSON[_0xa1c9('0x15')](_0xf584e2));_0x58b01f(_0xf584e2);})[_0xa1c9('0x1a')](function(_0x4c6dd4){logger[_0xa1c9('0x16')](_0xa1c9('0x1b'),_0x4c6dd4['message'],_0x278ba6);_0x1a5b8e(_0x18c22d[_0xa1c9('0x16')](0x1f4,_0x4c6dd4[_0xa1c9('0x18')]));});});};exports[_0xa1c9('0x26')]=function(_0x1339fd){var _0xd1f98e=this;return new Promise(function(_0x386b64,_0x220b63){return db[_0xa1c9('0x1c')][_0xa1c9('0x27')]({'raw':_0x1339fd[_0xa1c9('0x1e')]?_0x1339fd[_0xa1c9('0x1e')][_0xa1c9('0x1f')]===undefined?!![]:![]:!![],'where':_0x1339fd[_0xa1c9('0x1e')]?_0x1339fd[_0xa1c9('0x1e')][_0xa1c9('0x28')]||null:null,'attributes':_0x1339fd['options']?_0x1339fd[_0xa1c9('0x1e')][_0xa1c9('0x24')]||null:null,'include':_0x1339fd[_0xa1c9('0x1e')]?_0x1339fd[_0xa1c9('0x1e')]['include']?_[_0xa1c9('0x21')](_0x1339fd[_0xa1c9('0x1e')]['include'],function(_0x5ab2f2){return{'model':db[_0x5ab2f2[_0xa1c9('0x23')]],'as':_0x5ab2f2['as'],'attributes':_0x5ab2f2[_0xa1c9('0x24')],'include':_0x5ab2f2[_0xa1c9('0x22')]?_[_0xa1c9('0x21')](_0x5ab2f2[_0xa1c9('0x22')],function(_0x2c1825){return{'model':db[_0x2c1825[_0xa1c9('0x23')]],'as':_0x2c1825['as'],'attributes':_0x2c1825[_0xa1c9('0x24')],'include':_0x2c1825[_0xa1c9('0x22')]?_[_0xa1c9('0x21')](_0x2c1825[_0xa1c9('0x22')],function(_0x549afc){return{'model':db[_0x549afc[_0xa1c9('0x23')]],'as':_0x549afc['as'],'attributes':_0x549afc[_0xa1c9('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa1c9('0x25')](function(_0x3df11a){if(_0x1339fd[_0xa1c9('0x1e')][_0xa1c9('0x29')]===!![])_0x3df11a[_0xa1c9('0x2a')](_0xa1c9('0x2b'),_0x3df11a['getSmtpOptions']());logger[_0xa1c9('0x10')](_0xa1c9('0x26'),_0x1339fd);logger[_0xa1c9('0x13')]('ShowMailAccount',_0x1339fd,JSON[_0xa1c9('0x15')](_0x3df11a));_0x386b64(_0x3df11a);})[_0xa1c9('0x1a')](function(_0x23cab5){logger[_0xa1c9('0x16')](_0xa1c9('0x26'),_0x23cab5[_0xa1c9('0x18')],_0x1339fd);_0x220b63(_0xd1f98e[_0xa1c9('0x16')](0x1f4,_0x23cab5['message']));});});};exports[_0xa1c9('0x2c')]=function(_0x5f3084){var _0x1562f8=this;return new Promise(function(_0x4c1a9e,_0x114a21){var _0x313ec7={'body':_0x5f3084[_0xa1c9('0x2d')],'channel':'mail'};var _0x19d1aa=_['difference'](_[_0xa1c9('0x2e')](db['CmContact']['rawAttributes']),[_0xa1c9('0x2f'),'updatedAt',_0xa1c9('0x30'),'ListId']);var _0x550872=![];if(_0x5f3084[_0xa1c9('0x2d')]['id']){delete _0x5f3084[_0xa1c9('0x2d')]['id'];}if(_[_0xa1c9('0x31')](_0x5f3084[_0xa1c9('0x2d')]['from'])){return _0x114a21(_0x1562f8[_0xa1c9('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xa1c9('0x31')](_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x2d')])||_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x2d')]===''){return _0x114a21(_0x1562f8[_0xa1c9('0x16')](0x1f4,_0xa1c9('0x32')));}if(_[_0xa1c9('0x31')](_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x33')])){return _0x114a21(_0x1562f8['error'](0x1f4,_0xa1c9('0x34')+_0x19d1aa));}if(!_[_0xa1c9('0x35')](_0x19d1aa,_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x33')])){return _0x114a21(_0x1562f8[_0xa1c9('0x16')](0x1f4,_0xa1c9('0x36')+_0x19d1aa));}var _0x227e94={};_0x227e94[_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x33')]]=_0x5f3084['body'][_0xa1c9('0x37')];return db[_0xa1c9('0x1c')]['find']({'where':{'id':_0x5f3084[_0xa1c9('0x38')]['id']},'include':[{'model':db[_0xa1c9('0x39')],'as':'List','include':[{'model':db[_0xa1c9('0x3a')],'as':_0xa1c9('0x3b'),'where':_0x227e94,'limit':0x1,'order':[[_0xa1c9('0x3c'),_0xa1c9('0x3d')]]}]},{'model':db['MailApplication'],'as':_0xa1c9('0x3e')},{'model':db['MailServerOut'],'as':_0xa1c9('0x3f'),'include':[{'model':db['CloudProvider'],'as':_0xa1c9('0x40')}]}]})[_0xa1c9('0x25')](function(_0x6d28a1){if(_0x6d28a1&&_0x6d28a1[_0xa1c9('0x41')]){var _0x226a65=_0x6d28a1[_0xa1c9('0x42')]({'plain':!![]});_0x313ec7[_0xa1c9('0x38')]=_[_0xa1c9('0x43')](_0x226a65,[_0xa1c9('0x3e'),_0xa1c9('0x41')]);_0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x2b')]=_0x6d28a1[_0xa1c9('0x44')]();_0x313ec7[_0xa1c9('0x45')]=_0x226a65[_0xa1c9('0x3e')];_0x313ec7['list']=_0x226a65[_0xa1c9('0x41')];_0x313ec7[_0xa1c9('0x45')]=_[_0xa1c9('0x46')](_0x313ec7[_0xa1c9('0x45')],['priority'],[_0xa1c9('0x47')]);if(_0x313ec7[_0xa1c9('0x38')]&&_0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x48')]){_0x313ec7['applications'][_0xa1c9('0x49')]({'id':0x0,'priority':_0x313ec7[_0xa1c9('0x45')][_0xa1c9('0x4a')]+0x1,'app':_0xa1c9('0x4b'),'appdata':_0xa1c9('0x48'),'interval':_0xa1c9('0x4c')});}if(_0x313ec7['account'][_0xa1c9('0x3e')]){delete _0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x3e')];}if(_0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x41')]){delete _0x313ec7[_0xa1c9('0x38')]['List'];}if(_0x226a65['List'][_0xa1c9('0x3b')]['length']){return _0x226a65['List'][_0xa1c9('0x3b')][0x0];}var _0xe162c1=_[_0xa1c9('0xa')](_0x5f3084['body'],{'firstName':_0x5f3084['body'][_0xa1c9('0x37')],'ListId':_0x226a65['ListId']});_0xe162c1[_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x33')]]=_0x5f3084[_0xa1c9('0x2d')]['from'];return db[_0xa1c9('0x3a')][_0xa1c9('0x4d')](_0xe162c1);}else{throw new Error(_0xa1c9('0x4e'));}})[_0xa1c9('0x25')](function(_0x5ea7be){_0x313ec7['contact']=_0x5ea7be;if(_0x5ea7be){if(!_0x5f3084[_0xa1c9('0x2d')]['message'][_0xa1c9('0x4f')]){_0x5f3084['body'][_0xa1c9('0x18')][_0xa1c9('0x4f')]=rs[_0xa1c9('0x50')]()+'\x20'+_0x5f3084[_0xa1c9('0x2d')]['message'][_0xa1c9('0x37')];}var _0x519d0f={'ContactId':_0x5ea7be['id'],'MailAccountId':_0x5f3084[_0xa1c9('0x38')]['id'],'inReplyTo':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x4f')],'to':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x37')],'cc':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')]['cc'],'subject':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x51')],'attach':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')]['attach'],'lastMsgAt':moment()['format'](_0xa1c9('0x52')),'lastMsgDirection':'in'};return db[_0xa1c9('0x53')][_0xa1c9('0x27')]({'where':{'closed':![],'MailAccountId':_0x5f3084[_0xa1c9('0x38')]['id']},'include':[{'model':db[_0xa1c9('0x54')],'as':_0xa1c9('0x55'),'attributes':[_0xa1c9('0x4f')],'where':{'messageId':_0x5f3084[_0xa1c9('0x2d')]['message'][_0xa1c9('0x56')]}}]})[_0xa1c9('0x25')](function(_0x8e6b90){if(_0x8e6b90){return[_0x8e6b90,![]];}return db[_0xa1c9('0x53')]['create'](_0x519d0f)[_0xa1c9('0x25')](function(_0x423a34){return[_0x423a34,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xa1c9('0x57')](function(_0x13f428,_0x25bc30){if(_0x13f428){_0x550872=_0x25bc30;if(!_0x25bc30){return _0x13f428['update']({'inReplyTo':_0x5f3084[_0xa1c9('0x2d')]['message'][_0xa1c9('0x4f')],'to':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x37')],'cc':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')]['cc'],'subject':_0x5f3084['body'][_0xa1c9('0x18')]['subject'],'attach':_0x13f428[_0xa1c9('0x58')]?_0x13f428['attach']:_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x58')],'substatus':null,'substatusAt':moment()[_0xa1c9('0x59')](_0xa1c9('0x52')),'lastMsgAt':moment()[_0xa1c9('0x59')](_0xa1c9('0x52')),'lastMsgDirection':'in'});}else{return _0x13f428;}}})[_0xa1c9('0x25')](function(_0x2852ae){_0x313ec7['interaction']=_0x2852ae['get']({'plain':!![]});_0x313ec7['interaction'][_0xa1c9('0x5a')]=_0x550872;return db[_0xa1c9('0x54')][_0xa1c9('0x4d')]({'body':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x2d')],'MailAccountId':_0x5f3084['account']['id'],'MailInteractionId':_0x2852ae['id'],'direction':'in','ContactId':_0x313ec7['contact']['id'],'messageId':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x4f')],'from':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x37')],'to':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')]['to'],'cc':_0x5f3084['body']['message']['cc'],'subject':_0x5f3084['body'][_0xa1c9('0x18')][_0xa1c9('0x51')],'attach':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x58')],'Attachments':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x5b')],'originTo':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x5c')],'originCc':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x5d')],'bcc':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x5e')],'ChatWebsiteId':_0x5f3084[_0xa1c9('0x2d')]['message'][_0xa1c9('0x5f')]||null,'originChannel':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')]['originChannel']||'Email','ChatOfflineMessageId':_0x5f3084[_0xa1c9('0x2d')][_0xa1c9('0x18')][_0xa1c9('0x60')]||null},{'include':[{'model':db[_0xa1c9('0x61')],'as':_0xa1c9('0x62')}]});})[_0xa1c9('0x25')](function(_0x21099a){_0x313ec7['message']=_0x21099a;if(!_0x313ec7[_0xa1c9('0x63')][_0xa1c9('0x64')]){return;}return db['User']['find']({'attributes':['id',_0xa1c9('0x65')],'where':{'id':_0x313ec7[_0xa1c9('0x63')][_0xa1c9('0x64')]}});})['then'](function(_0x168d20){if(_0x168d20){_0x313ec7[_0xa1c9('0x45')][_0xa1c9('0x66')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x168d20['name']+','+(_0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x67')]||0xa),'interval':'*,*,*,*'});}if(!_0x313ec7['interaction']['queueId']){return;}return db[_0xa1c9('0x68')]['find']({'attributes':['id',_0xa1c9('0x65')],'where':{'id':_0x313ec7[_0xa1c9('0x63')]['queueId']}});})[_0xa1c9('0x25')](function(_0x3ca392){if(_0x3ca392){_0x313ec7['applications'][_0xa1c9('0x66')]({'id':0x0,'priority':0x1,'app':_0xa1c9('0x69'),'appdata':_0x3ca392[_0xa1c9('0x65')]+','+(_0x313ec7[_0xa1c9('0x38')][_0xa1c9('0x6a')]||0x12c),'interval':_0xa1c9('0x4c')});}return respondWithRpcPromise(_0xa1c9('0x6b'),_0xa1c9('0x6c'),_0x313ec7);})['then'](function(_0x51ef57){_0x4c1a9e(_0x51ef57);})[_0xa1c9('0x1a')](function(_0x5b7df9){_0x114a21(_0x1562f8[_0xa1c9('0x16')](0x1f4,_0x5b7df9[_0xa1c9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index aa6fb04..946c1ae 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 _0x00b8=['register','length','mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x50ead6,_0x5c4780){var _0xc69ae1=function(_0x3d5387){while(--_0x3d5387){_0x50ead6['push'](_0x50ead6['shift']());}};_0xc69ae1(++_0x5c4780);}(_0x00b8,0x1e0));var _0x800b=function(_0x248561,_0x3527ec){_0x248561=_0x248561-0x0;var _0x3386a6=_0x00b8[_0x248561];return _0x3386a6;};'use strict';var MailAccountEvents=require(_0x800b('0x0'));var events=[_0x800b('0x1'),_0x800b('0x2'),_0x800b('0x3')];function createListener(_0x2d9c40,_0x126755){return function(_0x5e380e){_0x126755[_0x800b('0x4')](_0x2d9c40,_0x5e380e);};}function removeListener(_0x54a4c5,_0x412185){return function(){MailAccountEvents[_0x800b('0x5')](_0x54a4c5,_0x412185);};}exports[_0x800b('0x6')]=function(_0xf9a2c7){for(var _0x695ff3=0x0,_0x41ad65=events[_0x800b('0x7')];_0x695ff3<_0x41ad65;_0x695ff3++){var _0xd2e393=events[_0x695ff3];var _0x2d72ec=createListener(_0x800b('0x8')+_0xd2e393,_0xf9a2c7);MailAccountEvents['on'](_0xd2e393,_0x2d72ec);}}; \ No newline at end of file +var _0x5255=['remove','removeListener','register','length','./mailAccount.events'];(function(_0x55d2b6,_0x3139b5){var _0x25d808=function(_0x32eb29){while(--_0x32eb29){_0x55d2b6['push'](_0x55d2b6['shift']());}};_0x25d808(++_0x3139b5);}(_0x5255,0xd1));var _0x5525=function(_0x10561e,_0xdb354d){_0x10561e=_0x10561e-0x0;var _0x5bdc82=_0x5255[_0x10561e];return _0x5bdc82;};'use strict';var MailAccountEvents=require(_0x5525('0x0'));var events=['save',_0x5525('0x1'),'update'];function createListener(_0xc0a40f,_0x509851){return function(_0x5d19cf){_0x509851['emit'](_0xc0a40f,_0x5d19cf);};}function removeListener(_0x35126f,_0x3f54c2){return function(){MailAccountEvents[_0x5525('0x2')](_0x35126f,_0x3f54c2);};}exports[_0x5525('0x3')]=function(_0x471e3c){for(var _0x46037f=0x0,_0x214256=events[_0x5525('0x4')];_0x46037f<_0x214256;_0x46037f++){var _0x1eced1=events[_0x46037f];var _0x17c355=createListener('mailAccount:'+_0x1eced1,_0x471e3c);MailAccountEvents['on'](_0x1eced1,_0x17c355);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 358372c..94cc939 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 _0x1c85=['put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','./mailApplication.controller','/:id','isAuthenticated','show'];(function(_0x2f0641,_0x32253b){var _0x129bb2=function(_0x14975b){while(--_0x14975b){_0x2f0641['push'](_0x2f0641['shift']());}};_0x129bb2(++_0x32253b);}(_0x1c85,0xad));var _0x51c8=function(_0x528595,_0x88ed8c){_0x528595=_0x528595-0x0;var _0x17103c=_0x1c85[_0x528595];return _0x17103c;};'use strict';var multer=require(_0x51c8('0x0'));var util=require('util');var path=require(_0x51c8('0x1'));var timeout=require('connect-timeout');var express=require(_0x51c8('0x2'));var router=express['Router']();var fs_extra=require(_0x51c8('0x3'));var auth=require(_0x51c8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x51c8('0x5'));router['get'](_0x51c8('0x6'),auth[_0x51c8('0x7')](),controller[_0x51c8('0x8')]);router[_0x51c8('0x9')](_0x51c8('0x6'),auth[_0x51c8('0x7')](),controller[_0x51c8('0xa')]);router[_0x51c8('0xb')](_0x51c8('0x6'),auth[_0x51c8('0x7')](),controller[_0x51c8('0xc')]);module[_0x51c8('0xd')]=router; \ No newline at end of file +var _0x2f44=['show','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailApplication.controller','/:id','isAuthenticated'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2f44,0x1f3));var _0x42f4=function(_0x3a1058,_0x255329){_0x3a1058=_0x3a1058-0x0;var _0x2509c5=_0x2f44[_0x3a1058];return _0x2509c5;};'use strict';var multer=require(_0x42f4('0x0'));var util=require(_0x42f4('0x1'));var path=require(_0x42f4('0x2'));var timeout=require(_0x42f4('0x3'));var express=require(_0x42f4('0x4'));var router=express[_0x42f4('0x5')]();var fs_extra=require(_0x42f4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x42f4('0x7'));var config=require('../../config/environment');var controller=require(_0x42f4('0x8'));router['get'](_0x42f4('0x9'),auth[_0x42f4('0xa')](),controller[_0x42f4('0xb')]);router[_0x42f4('0xc')](_0x42f4('0x9'),auth[_0x42f4('0xa')](),controller['update']);router[_0x42f4('0xd')](_0x42f4('0x9'),auth[_0x42f4('0xa')](),controller[_0x42f4('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 761b07c..22ad83d 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 _0x6633=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x29e2e6,_0xf7ef8c){var _0xb6bd20=function(_0x10dd27){while(--_0x10dd27){_0x29e2e6['push'](_0x29e2e6['shift']());}};_0xb6bd20(++_0xf7ef8c);}(_0x6633,0x1ce));var _0x3663=function(_0x4913b1,_0x4a115e){_0x4913b1=_0x4913b1-0x0;var _0x1b39a6=_0x6633[_0x4913b1];return _0x1b39a6;};'use strict';var Sequelize=require(_0x3663('0x0'));module[_0x3663('0x1')]={'priority':{'type':Sequelize[_0x3663('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3663('0x3')],'allowNull':![],'defaultValue':_0x3663('0x4')},'appdata':{'type':Sequelize[_0x3663('0x5')]()},'description':{'type':Sequelize[_0x3663('0x3')]},'interval':{'type':Sequelize[_0x3663('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xae01=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0xfa7140,_0x2cde39){var _0x3fe00e=function(_0x536685){while(--_0x536685){_0xfa7140['push'](_0xfa7140['shift']());}};_0x3fe00e(++_0x2cde39);}(_0xae01,0xb1));var _0x1ae0=function(_0x85de0a,_0x753f0e){_0x85de0a=_0x85de0a-0x0;var _0xbe267a=_0xae01[_0x85de0a];return _0xbe267a;};'use strict';var Sequelize=require(_0x1ae0('0x0'));module[_0x1ae0('0x1')]={'priority':{'type':Sequelize[_0x1ae0('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1ae0('0x3')]()},'description':{'type':Sequelize[_0x1ae0('0x4')]},'interval':{'type':Sequelize[_0x1ae0('0x4')],'defaultValue':_0x1ae0('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 20b0113..dd557df 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 _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x175fe5,_0xeba8c0){var _0x3432c3=function(_0x40ef01){while(--_0x40ef01){_0x175fe5['push'](_0x175fe5['shift']());}};_0x3432c3(++_0xeba8c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0xaa88[_0x3e3bee];return _0x3ae14c;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index f1d7ff1..179d41b 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 _0x587f=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes','define'];(function(_0x2d7cca,_0x104977){var _0x347b84=function(_0xfda4ea){while(--_0xfda4ea){_0x2d7cca['push'](_0x2d7cca['shift']());}};_0x347b84(++_0x104977);}(_0x587f,0x18c));var _0xf587=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x587f[_0x4e1a49];return _0x136aae;};'use strict';var _=require(_0xf587('0x0'));var util=require(_0xf587('0x1'));var logger=require(_0xf587('0x2'))('api');var moment=require(_0xf587('0x3'));var BPromise=require(_0xf587('0x4'));var rp=require(_0xf587('0x5'));var fs=require('fs');var path=require(_0xf587('0x6'));var rimraf=require('rimraf');var config=require(_0xf587('0x7'));var attributes=require(_0xf587('0x8'));module['exports']=function(_0x3de3d9,_0x37c313){return _0x3de3d9[_0xf587('0x9')](_0xf587('0xa'),attributes,{'tableName':_0xf587('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf587('0xc'),'collate':_0xf587('0xd')});}; \ No newline at end of file +var _0x8d57=['util','../../config/logger','api','moment','path','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','lodash'];(function(_0x2fac71,_0x2ae81d){var _0x28cb27=function(_0x348dc6){while(--_0x348dc6){_0x2fac71['push'](_0x2fac71['shift']());}};_0x28cb27(++_0x2ae81d);}(_0x8d57,0xb3));var _0x78d5=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x8d57[_0x1e4f2f];return _0xccea89;};'use strict';var _=require(_0x78d5('0x0'));var util=require(_0x78d5('0x1'));var logger=require(_0x78d5('0x2'))(_0x78d5('0x3'));var moment=require(_0x78d5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x78d5('0x5'));var rimraf=require('rimraf');var config=require(_0x78d5('0x6'));var attributes=require('./mailApplication.attributes');module[_0x78d5('0x7')]=function(_0x1a5eaf,_0x1df2f7){return _0x1a5eaf[_0x78d5('0x8')](_0x78d5('0x9'),attributes,{'tableName':_0x78d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x78d5('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 8b0a045..d3a3034 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 _0xb8e3=['code','message','info','catch','MailApplication,\x20%s,\x20%s','MailApplication','body','options','raw','where','limit','UpdateMailApplication','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3c1df4,_0x2079a2){var _0x3d5ed7=function(_0x1a9c6e){while(--_0x1a9c6e){_0x3c1df4['push'](_0x3c1df4['shift']());}};_0x3d5ed7(++_0x2079a2);}(_0xb8e3,0xa2));var _0x3b8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b8e('0x0'));var util=require('util');var moment=require(_0x3b8e('0x1'));var BPromise=require(_0x3b8e('0x2'));var rs=require(_0x3b8e('0x3'));var fs=require('fs');var Redis=require(_0x3b8e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b8e('0x5'));var logger=require(_0x3b8e('0x6'))(_0x3b8e('0x7'));var config=require(_0x3b8e('0x8'));var jayson=require(_0x3b8e('0x9'));var client=jayson['client'][_0x3b8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54ab09,_0x2d26bc,_0x3f31e8){return new BPromise(function(_0x1227e4,_0x40cfdb){return client[_0x3b8e('0xb')](_0x54ab09,_0x3f31e8)[_0x3b8e('0xc')](function(_0x5ae8a9){logger['info']('MailApplication,\x20%s,\x20%s',_0x2d26bc,_0x3b8e('0xd'));logger[_0x3b8e('0xe')](_0x3b8e('0xf'),_0x2d26bc,'request\x20sent',JSON[_0x3b8e('0x10')](_0x5ae8a9));if(_0x5ae8a9[_0x3b8e('0x11')]){if(_0x5ae8a9['error'][_0x3b8e('0x12')]===0x1f4){logger[_0x3b8e('0x11')]('MailApplication,\x20%s,\x20%s',_0x2d26bc,_0x5ae8a9[_0x3b8e('0x11')][_0x3b8e('0x13')]);return _0x40cfdb(_0x5ae8a9['error'][_0x3b8e('0x13')]);}logger[_0x3b8e('0x11')]('MailApplication,\x20%s,\x20%s',_0x2d26bc,_0x5ae8a9[_0x3b8e('0x11')][_0x3b8e('0x13')]);return _0x1227e4(_0x5ae8a9['error'][_0x3b8e('0x13')]);}else{logger[_0x3b8e('0x14')]('MailApplication,\x20%s,\x20%s',_0x2d26bc,_0x3b8e('0xd'));_0x1227e4(_0x5ae8a9['result'][_0x3b8e('0x13')]);}})[_0x3b8e('0x15')](function(_0x361c4e){logger[_0x3b8e('0x11')](_0x3b8e('0x16'),_0x2d26bc,_0x361c4e);_0x40cfdb(_0x361c4e);});});}exports['UpdateMailApplication']=function(_0x22c655){var _0x4de2f0=this;return new Promise(function(_0x5f1464,_0x528ebe){return db[_0x3b8e('0x17')]['update'](_0x22c655[_0x3b8e('0x18')],{'raw':_0x22c655[_0x3b8e('0x19')]?_0x22c655[_0x3b8e('0x19')][_0x3b8e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22c655['options']?_0x22c655[_0x3b8e('0x19')][_0x3b8e('0x1b')]||null:null,'attributes':_0x22c655['options']?_0x22c655['options']['attributes']||null:null,'limit':_0x22c655['options']?_0x22c655[_0x3b8e('0x19')][_0x3b8e('0x1c')]||null:null})['then'](function(_0x5a6d0d){logger['info'](_0x3b8e('0x1d'),_0x22c655);logger[_0x3b8e('0xe')](_0x3b8e('0x1d'),_0x22c655,JSON[_0x3b8e('0x10')](_0x5a6d0d));_0x5f1464(_0x5a6d0d);})['catch'](function(_0x5b969e){logger[_0x3b8e('0x11')](_0x3b8e('0x1d'),_0x5b969e[_0x3b8e('0x13')],_0x22c655);_0x528ebe(_0x4de2f0[_0x3b8e('0x11')](0x1f4,_0x5b969e['message']));});});}; \ No newline at end of file +var _0x206a=['util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','catch','lodash'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x206a,0xd1));var _0xa206=function(_0x2b7d12,_0x32d47e){_0x2b7d12=_0x2b7d12-0x0;var _0x435fe8=_0x206a[_0x2b7d12];return _0x435fe8;};'use strict';var _=require(_0xa206('0x0'));var util=require(_0xa206('0x1'));var moment=require('moment');var BPromise=require(_0xa206('0x2'));var rs=require(_0xa206('0x3'));var fs=require('fs');var Redis=require(_0xa206('0x4'));var db=require(_0xa206('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa206('0x6'));var config=require('../../config/environment');var jayson=require(_0xa206('0x7'));var client=jayson[_0xa206('0x8')][_0xa206('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b5a09,_0x5411af,_0x5057a7){return new BPromise(function(_0xfcb123,_0x2eb4e2){return client[_0xa206('0xa')](_0x4b5a09,_0x5057a7)[_0xa206('0xb')](function(_0x5cb034){logger[_0xa206('0xc')]('MailApplication,\x20%s,\x20%s',_0x5411af,_0xa206('0xd'));logger[_0xa206('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x5411af,'request\x20sent',JSON[_0xa206('0xf')](_0x5cb034));if(_0x5cb034['error']){if(_0x5cb034[_0xa206('0x10')][_0xa206('0x11')]===0x1f4){logger[_0xa206('0x10')](_0xa206('0x12'),_0x5411af,_0x5cb034['error']['message']);return _0x2eb4e2(_0x5cb034[_0xa206('0x10')][_0xa206('0x13')]);}logger[_0xa206('0x10')](_0xa206('0x12'),_0x5411af,_0x5cb034[_0xa206('0x10')][_0xa206('0x13')]);return _0xfcb123(_0x5cb034[_0xa206('0x10')]['message']);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x5411af,'request\x20sent');_0xfcb123(_0x5cb034[_0xa206('0x14')][_0xa206('0x13')]);}})['catch'](function(_0x1d6a1d){logger[_0xa206('0x10')](_0xa206('0x12'),_0x5411af,_0x1d6a1d);_0x2eb4e2(_0x1d6a1d);});});}exports[_0xa206('0x15')]=function(_0x1f53e0){var _0x442a3e=this;return new Promise(function(_0xba7eb7,_0xd9d3c0){return db[_0xa206('0x16')]['update'](_0x1f53e0[_0xa206('0x17')],{'raw':_0x1f53e0[_0xa206('0x18')]?_0x1f53e0[_0xa206('0x18')][_0xa206('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f53e0[_0xa206('0x18')]?_0x1f53e0['options'][_0xa206('0x1a')]||null:null,'attributes':_0x1f53e0[_0xa206('0x18')]?_0x1f53e0['options'][_0xa206('0x1b')]||null:null,'limit':_0x1f53e0[_0xa206('0x18')]?_0x1f53e0[_0xa206('0x18')][_0xa206('0x1c')]||null:null})['then'](function(_0x2f0a34){logger[_0xa206('0xc')](_0xa206('0x15'),_0x1f53e0);logger[_0xa206('0xe')](_0xa206('0x15'),_0x1f53e0,JSON[_0xa206('0xf')](_0x2f0a34));_0xba7eb7(_0x2f0a34);})[_0xa206('0x1d')](function(_0x355945){logger[_0xa206('0x10')](_0xa206('0x15'),_0x355945[_0xa206('0x13')],_0x1f53e0);_0xd9d3c0(_0x442a3e['error'](0x1f4,_0x355945['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 1c9f5ad..db4e43b 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 _0x7746=['express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','tracked','mail','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','exports'];(function(_0x517cd7,_0x4eed1a){var _0x557e73=function(_0x54ab86){while(--_0x54ab86){_0x517cd7['push'](_0x517cd7['shift']());}};_0x557e73(++_0x4eed1a);}(_0x7746,0x1e0));var _0x6774=function(_0x41abab,_0x3b6cc4){_0x41abab=_0x41abab-0x0;var _0x259af5=_0x7746[_0x41abab];return _0x259af5;};'use strict';var express=require(_0x6774('0x0'));var router=express['Router']();var auth=require(_0x6774('0x1'));var interaction=require(_0x6774('0x2'));var controller=require(_0x6774('0x3'));router[_0x6774('0x4')]('/',auth[_0x6774('0x5')](),controller[_0x6774('0x6')]);router[_0x6774('0x4')]('/describe',auth[_0x6774('0x5')](),controller[_0x6774('0x7')]);router['get'](_0x6774('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x6774('0x4')](_0x6774('0x9'),auth[_0x6774('0x5')](),controller[_0x6774('0xa')]);router[_0x6774('0x4')](_0x6774('0xb'),auth[_0x6774('0x5')](),controller['download']);router[_0x6774('0xc')]('/',auth[_0x6774('0x5')](),controller[_0x6774('0xd')]);router[_0x6774('0xc')](_0x6774('0x9'),auth['isAuthenticated'](),controller['addMessage']);router[_0x6774('0xc')]('/:id/tags',auth[_0x6774('0x5')](),interaction[_0x6774('0xe')](_0x6774('0xf'),'mailinteraction:addtags'),controller[_0x6774('0x10')]);router['put'](_0x6774('0x8'),auth['isAuthenticated'](),interaction['tracked'](_0x6774('0xf'),_0x6774('0x11')),controller[_0x6774('0x12')]);router[_0x6774('0x13')](_0x6774('0x8'),auth['isAuthenticated'](),interaction[_0x6774('0xe')](_0x6774('0xf'),_0x6774('0x14')),controller[_0x6774('0x15')]);router['delete'](_0x6774('0x16'),auth[_0x6774('0x5')](),controller['removeTags']);module[_0x6774('0x17')]=router; \ No newline at end of file +var _0xa8ab=['isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','put','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe'];(function(_0x12b9c2,_0x2aa1be){var _0x424f3f=function(_0x3bb497){while(--_0x3bb497){_0x12b9c2['push'](_0x12b9c2['shift']());}};_0x424f3f(++_0x2aa1be);}(_0xa8ab,0x138));var _0xba8a=function(_0x1615ff,_0x213e66){_0x1615ff=_0x1615ff-0x0;var _0x3a5eb0=_0xa8ab[_0x1615ff];return _0x3a5eb0;};'use strict';var express=require(_0xba8a('0x0'));var router=express['Router']();var auth=require(_0xba8a('0x1'));var interaction=require(_0xba8a('0x2'));var controller=require(_0xba8a('0x3'));router[_0xba8a('0x4')]('/',auth['isAuthenticated'](),controller[_0xba8a('0x5')]);router[_0xba8a('0x4')](_0xba8a('0x6'),auth[_0xba8a('0x7')](),controller[_0xba8a('0x8')]);router['get'](_0xba8a('0x9'),auth['isAuthenticated'](),controller[_0xba8a('0xa')]);router[_0xba8a('0x4')](_0xba8a('0xb'),auth['isAuthenticated'](),controller[_0xba8a('0xc')]);router['get'](_0xba8a('0xd'),auth[_0xba8a('0x7')](),controller[_0xba8a('0xe')]);router[_0xba8a('0xf')]('/',auth[_0xba8a('0x7')](),controller[_0xba8a('0x10')]);router[_0xba8a('0xf')]('/:id/messages',auth[_0xba8a('0x7')](),controller[_0xba8a('0x11')]);router[_0xba8a('0xf')](_0xba8a('0x12'),auth['isAuthenticated'](),interaction[_0xba8a('0x13')]('mail','mailinteraction:addtags'),controller['addTags']);router[_0xba8a('0x14')]('/:id',auth[_0xba8a('0x7')](),interaction['tracked'](_0xba8a('0x15'),_0xba8a('0x16')),controller[_0xba8a('0x17')]);router[_0xba8a('0x18')]('/:id',auth[_0xba8a('0x7')](),interaction['tracked'](_0xba8a('0x15'),_0xba8a('0x19')),controller[_0xba8a('0x1a')]);router['delete']('/:id/tags',auth['isAuthenticated'](),controller[_0xba8a('0x1b')]);module[_0xba8a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 2856251..ad978fb 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 _0x079f=['ENUM','out','sequelize','exports','DATE','STRING','TEXT','long','BOOLEAN'];(function(_0x1f6559,_0x5dc12a){var _0x3d57d1=function(_0x202a95){while(--_0x202a95){_0x1f6559['push'](_0x1f6559['shift']());}};_0x3d57d1(++_0x5dc12a);}(_0x079f,0x122));var _0xf079=function(_0x22d153,_0x4f6dbf){_0x22d153=_0x22d153-0x0;var _0x5c4ade=_0x079f[_0x22d153];return _0x5c4ade;};'use strict';var Sequelize=require(_0xf079('0x0'));var iconv=require('iconv');module[_0xf079('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf079('0x2')]},'disposition':{'type':Sequelize[_0xf079('0x3')]},'secondDisposition':{'type':Sequelize[_0xf079('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf079('0x3')]},'note':{'type':Sequelize[_0xf079('0x3')]},'inReplyTo':{'type':Sequelize[_0xf079('0x3')](0x1fe)},'to':{'type':Sequelize[_0xf079('0x3')]},'cc':{'type':Sequelize[_0xf079('0x4')](_0xf079('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xf079('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf079('0x2')]},'substatus':{'type':Sequelize[_0xf079('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xf079('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf079('0x7')]('in',_0xf079('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf079('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xf079('0x7')]('in',_0xf079('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0a51=['long','ENUM','out','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x433dc5,_0x34ec43){var _0x5b7ce0=function(_0x4a3594){while(--_0x4a3594){_0x433dc5['push'](_0x433dc5['shift']());}};_0x5b7ce0(++_0x34ec43);}(_0x0a51,0xed));var _0x10a5=function(_0x336585,_0xa160ec){_0x336585=_0x336585-0x0;var _0x148887=_0x0a51[_0x336585];return _0x148887;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x10a5('0x0'));module[_0x10a5('0x1')]={'closed':{'type':Sequelize[_0x10a5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x10a5('0x3')]},'disposition':{'type':Sequelize[_0x10a5('0x4')]},'secondDisposition':{'type':Sequelize[_0x10a5('0x4')]},'thirdDisposition':{'type':Sequelize[_0x10a5('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x10a5('0x4')]},'cc':{'type':Sequelize[_0x10a5('0x5')](_0x10a5('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x10a5('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x10a5('0x3')]},'substatus':{'type':Sequelize[_0x10a5('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x10a5('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x10a5('0x7')]('in',_0x10a5('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x10a5('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x10a5('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x10a5('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 08ab48e..2bd46c5 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 _0x2cdb=['from','missing.recipient@your.company.com','subject','headers','basename','existsSync','push','type','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','zip-dir','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','then','destroy','stack','name','send','map','MailInteraction','rawAttributes','fieldName','key','findAll','user','show','params','keys','query','filters','intersection','model','fields','attributes','length','include','merge','options','create','body','find','catch','describe','addMessage','MailMessage','ids','omit','getMessages','nolimit','order','sort','pick','MailInteractionId','filter','where','$gte','split','includeAll','inlineCss','rows','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','format','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','createdAt','get','mkdirSync','each'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x2cdb,0x1c9));var _0xb2cd=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2cdb[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb2cd('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xb2cd('0x1'));var path=require(_0xb2cd('0x2'));var fs=require('fs');var _=require(_0xb2cd('0x3'));var juice=require(_0xb2cd('0x4'));var Redis=require(_0xb2cd('0x5'));var interaction=require(_0xb2cd('0x6'));var qs=require(_0xb2cd('0x7'));var logger=require(_0xb2cd('0x8'))('api');var config=require(_0xb2cd('0x9'));var db=require(_0xb2cd('0xa'))['db'];var htmlEntities=require(_0xb2cd('0xb'));config[_0xb2cd('0xc')]=_[_0xb2cd('0xd')](config[_0xb2cd('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb2cd('0xe'))(new Redis(config[_0xb2cd('0xc')]));require(_0xb2cd('0xf'))[_0xb2cd('0x10')](socket);function respondWithStatusCode(_0x289699,_0x55b72d){_0x55b72d=_0x55b72d||0xcc;return function(_0x35f635){if(_0x35f635){return _0x289699[_0xb2cd('0x11')](_0x55b72d);}return _0x289699[_0xb2cd('0x12')](_0x55b72d)[_0xb2cd('0x13')]();};}function respondWithResult(_0x104078,_0x129a1d){_0x129a1d=_0x129a1d||0xc8;return function(_0x49578b){if(_0x49578b){return _0x104078['status'](_0x129a1d)[_0xb2cd('0x14')](_0x49578b);}};}function respondWithFilteredResult(_0x1912ab,_0x58b4c1){return function(_0x4b32d3){if(_0x4b32d3){var _0x93ff10=typeof _0x58b4c1[_0xb2cd('0x15')]===_0xb2cd('0x16')&&typeof _0x58b4c1['limit']===_0xb2cd('0x16');var _0x434cd7=_0x4b32d3[_0xb2cd('0x17')];var _0x556e59=_0x93ff10?0x0:_0x58b4c1[_0xb2cd('0x15')];var _0x258570=_0x93ff10?_0x4b32d3['count']:_0x58b4c1['offset']+_0x58b4c1[_0xb2cd('0x18')];var _0x10ef0a;if(_0x258570>=_0x434cd7){_0x258570=_0x434cd7;_0x10ef0a=0xc8;}else{_0x10ef0a=0xce;}_0x1912ab[_0xb2cd('0x12')](_0x10ef0a);return _0x1912ab[_0xb2cd('0x19')]('Content-Range',_0x556e59+'-'+_0x258570+'/'+_0x434cd7)['json'](_0x4b32d3);}return null;};}function saveUpdates(_0x33b41b){return function(_0x2fde45){if(_0x2fde45){return _0x2fde45['update'](_0x33b41b)[_0xb2cd('0x1a')](function(_0x43a92c){return _0x43a92c;});}return null;};}function removeEntity(_0x36c21f){return function(_0x1cecd4){if(_0x1cecd4){return _0x1cecd4[_0xb2cd('0x1b')]()[_0xb2cd('0x1a')](function(){_0x36c21f[_0xb2cd('0x12')](0xcc)[_0xb2cd('0x13')]();});}};}function handleEntityNotFound(_0x469827){return function(_0x4c35ef){if(!_0x4c35ef){_0x469827['sendStatus'](0x194);}return _0x4c35ef;};}function handleError(_0x47d6ae,_0x190d4c){_0x190d4c=_0x190d4c||0x1f4;return function(_0x210617){logger['error'](_0x210617[_0xb2cd('0x1c')]);if(_0x210617[_0xb2cd('0x1d')]){delete _0x210617['name'];}_0x47d6ae[_0xb2cd('0x12')](_0x190d4c)[_0xb2cd('0x1e')](_0x210617);};}exports['index']=function(_0x343bbb,_0x5e0f72){var _0xd78709={};var _0x5341e1=_[_0xb2cd('0x1f')](db[_0xb2cd('0x20')][_0xb2cd('0x21')],function(_0x1c1787){return{'name':_0x1c1787[_0xb2cd('0x22')],'type':_0x1c1787['type'][_0xb2cd('0x23')]};});_0xd78709=qs['getOptions'](_0x5341e1,_0x343bbb);return interaction[_0xb2cd('0x24')]('mail',_0x343bbb['query'],_0x343bbb[_0xb2cd('0x25')],_0xd78709,_0x5341e1)[_0xb2cd('0x1a')](respondWithFilteredResult(_0x5e0f72,_0xd78709))['catch'](handleError(_0x5e0f72,null));};exports[_0xb2cd('0x26')]=function(_0x29a139,_0x36c04b){var _0x271f1a={'raw':![],'where':{'id':_0x29a139[_0xb2cd('0x27')]['id']}},_0x50ae4b={};_0x50ae4b['model']=_[_0xb2cd('0x28')](db[_0xb2cd('0x20')][_0xb2cd('0x21')]);_0x50ae4b[_0xb2cd('0x29')]=_[_0xb2cd('0x28')](_0x29a139['query']);_0x50ae4b[_0xb2cd('0x2a')]=_[_0xb2cd('0x2b')](_0x50ae4b[_0xb2cd('0x2c')],_0x50ae4b[_0xb2cd('0x29')]);_0x271f1a['attributes']=_[_0xb2cd('0x2b')](_0x50ae4b[_0xb2cd('0x2c')],qs[_0xb2cd('0x2d')](_0x29a139['query'][_0xb2cd('0x2d')]));_0x271f1a[_0xb2cd('0x2e')]=_0x271f1a[_0xb2cd('0x2e')][_0xb2cd('0x2f')]?_0x271f1a[_0xb2cd('0x2e')]:_0x50ae4b[_0xb2cd('0x2c')];if(_0x29a139[_0xb2cd('0x29')]['includeAll']){_0x271f1a[_0xb2cd('0x30')]=[{'all':!![]}];}_0x271f1a=_[_0xb2cd('0x31')]({},_0x271f1a,_0x29a139[_0xb2cd('0x32')]);return db[_0xb2cd('0x20')]['find'](_0x271f1a)['then'](handleEntityNotFound(_0x36c04b,null))[_0xb2cd('0x1a')](respondWithResult(_0x36c04b,null))['catch'](handleError(_0x36c04b,null));};exports['create']=function(_0x4eb843,_0x4ccfaf){return db[_0xb2cd('0x20')][_0xb2cd('0x33')](_0x4eb843[_0xb2cd('0x34')],{})[_0xb2cd('0x1a')](respondWithResult(_0x4ccfaf,0xc9))['catch'](handleError(_0x4ccfaf,null));};exports['update']=function(_0x12ecf0,_0x1136bd){if(_0x12ecf0[_0xb2cd('0x34')]['id']){delete _0x12ecf0[_0xb2cd('0x34')]['id'];}return db[_0xb2cd('0x20')][_0xb2cd('0x35')]({'where':{'id':_0x12ecf0['params']['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x1136bd,null))[_0xb2cd('0x1a')](saveUpdates(_0x12ecf0['body'],null))[_0xb2cd('0x1a')](respondWithResult(_0x1136bd,null))[_0xb2cd('0x36')](handleError(_0x1136bd,null));};exports[_0xb2cd('0x1b')]=function(_0x50b530,_0x95ead6){return db['MailInteraction'][_0xb2cd('0x35')]({'where':{'id':_0x50b530[_0xb2cd('0x27')]['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x95ead6,null))['then'](removeEntity(_0x95ead6,null))[_0xb2cd('0x36')](handleError(_0x95ead6,null));};exports[_0xb2cd('0x37')]=function(_0x30970c,_0x4793ba){return db[_0xb2cd('0x20')]['describe']()[_0xb2cd('0x1a')](respondWithResult(_0x4793ba,null))[_0xb2cd('0x36')](handleError(_0x4793ba,null));};exports[_0xb2cd('0x38')]=function(_0x10602f,_0x420d80){return db[_0xb2cd('0x39')][_0xb2cd('0x35')]({'where':{'id':_0x10602f[_0xb2cd('0x27')]['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x420d80,null))[_0xb2cd('0x1a')](function(_0xf7f84){if(_0xf7f84){return _0xf7f84[_0xb2cd('0x38')](_0x10602f['body'][_0xb2cd('0x3a')],_[_0xb2cd('0x3b')](_0x10602f['body'],[_0xb2cd('0x3a'),'id'])||{});}})[_0xb2cd('0x1a')](respondWithResult(_0x420d80,null))[_0xb2cd('0x36')](handleError(_0x420d80,null));};exports[_0xb2cd('0x3c')]=function(_0x1ded9a,_0x27ab65){var _0x1667f4={'raw':![],'where':{}};var _0x7eabd7={};var _0x2fa54a={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x1ded9a['params']['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x27ab65,null))[_0xb2cd('0x1a')](function(_0x46e3c0){if(_0x46e3c0){_0x7eabd7[_0xb2cd('0x2c')]=_[_0xb2cd('0x28')](db[_0xb2cd('0x39')][_0xb2cd('0x21')]);_0x7eabd7['query']=_[_0xb2cd('0x28')](_0x1ded9a[_0xb2cd('0x29')]);_0x7eabd7[_0xb2cd('0x2a')]=_[_0xb2cd('0x2b')](_0x7eabd7['model'],_0x7eabd7[_0xb2cd('0x29')]);_0x1667f4['attributes']=_[_0xb2cd('0x2b')](_0x7eabd7[_0xb2cd('0x2c')],qs[_0xb2cd('0x2d')](_0x1ded9a['query'][_0xb2cd('0x2d')]));_0x1667f4[_0xb2cd('0x2e')]=_0x1667f4[_0xb2cd('0x2e')][_0xb2cd('0x2f')]?_0x1667f4[_0xb2cd('0x2e')]:_0x7eabd7[_0xb2cd('0x2c')];if(!_0x1ded9a[_0xb2cd('0x29')]['hasOwnProperty'](_0xb2cd('0x3d'))){_0x1667f4[_0xb2cd('0x18')]=qs[_0xb2cd('0x18')](_0x1ded9a['query']['limit']);_0x1667f4[_0xb2cd('0x15')]=qs['offset'](_0x1ded9a[_0xb2cd('0x29')][_0xb2cd('0x15')]);}_0x1667f4[_0xb2cd('0x3e')]=qs[_0xb2cd('0x3f')](_0x1ded9a[_0xb2cd('0x29')]['sort']);_0x1667f4['where']=qs[_0xb2cd('0x2a')](_[_0xb2cd('0x40')](_0x1ded9a['query'],_0x7eabd7[_0xb2cd('0x2a')]));_0x1667f4['where'][_0xb2cd('0x41')]=_0x46e3c0['id'];if(_0x1ded9a[_0xb2cd('0x29')][_0xb2cd('0x42')]){_0x1667f4[_0xb2cd('0x43')]=_[_0xb2cd('0x31')](_0x1667f4['where'],{'$or':_[_0xb2cd('0x1f')](_0x1667f4[_0xb2cd('0x2e')],function(_0x1d7c80){var _0x162ae8={};_0x162ae8[_0x1d7c80]={'$like':'%'+_0x1ded9a[_0xb2cd('0x29')][_0xb2cd('0x42')]+'%'};return _0x162ae8;})});}if(_0x1ded9a['query'][_0xb2cd('0x44')]){var _0x416846=_0x1ded9a[_0xb2cd('0x29')][_0xb2cd('0x44')][_0xb2cd('0x45')](',');var _0x2e4bf3={};_0x2e4bf3[_0x416846[0x0]]={'$gte':moment(_0x416846[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1667f4[_0xb2cd('0x43')]=_[_0xb2cd('0x31')](_0x1667f4[_0xb2cd('0x43')],_0x2e4bf3);}_0x1667f4=_[_0xb2cd('0x31')]({},_0x1667f4,_0x1ded9a[_0xb2cd('0x32')]);return db[_0xb2cd('0x39')][_0xb2cd('0x17')]({'where':_0x1667f4[_0xb2cd('0x43')]})[_0xb2cd('0x1a')](function(_0x463977){_0x2fa54a[_0xb2cd('0x17')]=_0x463977;if(_0x1ded9a['query'][_0xb2cd('0x46')]){_0x1667f4[_0xb2cd('0x30')]=[{'all':!![]}];}return db[_0xb2cd('0x39')][_0xb2cd('0x24')](_0x1667f4);})['then'](function(_0x61fd96){if(_0x1ded9a['query'][_0xb2cd('0x47')]==='true'){for(var _0x364abb=0x0;_0x364abb<_0x61fd96[_0xb2cd('0x2f')];_0x364abb++){_0x61fd96[_0x364abb]['body']=juice(_0x61fd96[_0x364abb][_0xb2cd('0x34')]);}}_0x2fa54a[_0xb2cd('0x48')]=_0x61fd96;return _0x2fa54a;});}})[_0xb2cd('0x1a')](respondWithFilteredResult(_0x27ab65,_0x1667f4))[_0xb2cd('0x36')](handleError(_0x27ab65,null));};exports[_0xb2cd('0x49')]=function(_0x18547a,_0x2c9f29){return db['MailInteraction']['find']({'where':{'id':_0x18547a[_0xb2cd('0x27')]['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x2c9f29,null))[_0xb2cd('0x1a')](function(_0x11a912){if(_0x11a912){return _0x11a912[_0xb2cd('0x4a')](_0x18547a['body'][_0xb2cd('0x3a')],_['omit'](_0x18547a['body'],[_0xb2cd('0x3a'),'id'])||{})[_0xb2cd('0x4b')](function(){return db['Tag'][_0xb2cd('0x24')]({'attributes':['id',_0xb2cd('0x1d'),'color'],'where':{'id':_0x18547a[_0xb2cd('0x34')]['ids']}});})[_0xb2cd('0x1a')](function(_0x49f711){socket[_0xb2cd('0x4c')](_0xb2cd('0x4d'),{'id':Number(_0x18547a[_0xb2cd('0x27')]['id']),'tags':_0x49f711||[]});return{'id':Number(_0x18547a[_0xb2cd('0x27')]['id']),'tags':_0x49f711||[]};});}})[_0xb2cd('0x1a')](respondWithResult(_0x2c9f29,null))[_0xb2cd('0x36')](handleError(_0x2c9f29,null));};exports['removeTags']=function(_0x1105f0,_0x1ba3d4){return db[_0xb2cd('0x20')][_0xb2cd('0x35')]({'where':{'id':_0x1105f0[_0xb2cd('0x27')]['id']}})[_0xb2cd('0x1a')](handleEntityNotFound(_0x1ba3d4,null))[_0xb2cd('0x1a')](function(_0x4c0b22){if(_0x4c0b22){return _0x4c0b22[_0xb2cd('0x4e')](_0x1105f0[_0xb2cd('0x29')][_0xb2cd('0x3a')]);}})[_0xb2cd('0x1a')](respondWithStatusCode(_0x1ba3d4,null))[_0xb2cd('0x36')](handleError(_0x1ba3d4,null));};exports[_0xb2cd('0x4f')]=function(_0x8d0d7d,_0x1299e2){var _0x17394c=moment()[_0xb2cd('0x50')]()[_0xb2cd('0x51')]();var _0x59f252=path['join'](config[_0xb2cd('0x52')],_0xb2cd('0x53'),_0xb2cd('0x54'),_0xb2cd('0x55'));var _0x2b7497=path[_0xb2cd('0x56')](config[_0xb2cd('0x52')],_0xb2cd('0x53'),'files','attachments');var _0x224545=path['join'](_0x59f252,_0x17394c);var _0x1ae9f0=util[_0xb2cd('0x57')](_0xb2cd('0x58'),_0x8d0d7d[_0xb2cd('0x27')]['id'],_0x17394c);var _0x539aef=path['join'](_0x59f252,_0x1ae9f0);var _0x5548b0=[];if(_0x8d0d7d[_0xb2cd('0x29')][_0xb2cd('0x59')]){_0x5548b0['push']({'model':db[_0xb2cd('0x5a')],'as':_0xb2cd('0x5b'),'raw':!![]});}var _0x3ccb04=[{'model':db[_0xb2cd('0x39')],'as':_0xb2cd('0x5c'),'attributes':['id',_0xb2cd('0x34'),'from','to','cc',_0xb2cd('0x5d'),'subject',_0xb2cd('0x5e')],'where':{'secret':![]},'order':qs[_0xb2cd('0x3f')]('id'),'include':_0x5548b0}];return db[_0xb2cd('0x20')][_0xb2cd('0x35')]({'where':{'id':_0x8d0d7d[_0xb2cd('0x27')]['id']},'include':_0x3ccb04})['then'](handleEntityNotFound(_0x1299e2,null))[_0xb2cd('0x1a')](function(_0x53b260){if(_0x53b260&&_0x53b260[_0xb2cd('0x5c')]){var _0xdd5aab=_0x53b260[_0xb2cd('0x5f')]({'plain':!![]});fs[_0xb2cd('0x60')](_0x224545);return BPromise[_0xb2cd('0x61')](_0xdd5aab[_0xb2cd('0x5c')],function(_0x32149d,_0xa4d136){var _0x219a19={'from':_0x32149d[_0xb2cd('0x62')],'to':_0x32149d['to']||_0xb2cd('0x63'),'subject':_0x32149d[_0xb2cd('0x64')],'html':htmlEntities['decode'](_0x32149d['body']),'headers':{'Date':moment(_0x32149d[_0xb2cd('0x5e')])[_0xb2cd('0x57')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x32149d['cc']){_0x219a19[_0xb2cd('0x65')]['Cc']=_0x32149d['cc'];}if(_0x32149d['bcc']){_0x219a19[_0xb2cd('0x65')]['Bcc']=_0x32149d['bcc'];}return new BPromise(function(_0xd6aa54,_0x203765){if(_0x32149d[_0xb2cd('0x5b')]){for(var _0x19345e=0x0;_0x19345e<_0x32149d['Attachments'][_0xb2cd('0x2f')];_0x19345e++){var _0x587e3d=_0x32149d[_0xb2cd('0x5b')][_0x19345e];var _0x4413fe=path[_0xb2cd('0x56')](_0x2b7497,_0x587e3d[_0xb2cd('0x66')]);if(fs[_0xb2cd('0x67')](_0x4413fe)){_0x219a19[_0xb2cd('0x59')][_0xb2cd('0x68')]({'name':_0x587e3d[_0xb2cd('0x1d')],'contentType':_0x587e3d[_0xb2cd('0x69')],'data':fs[_0xb2cd('0x6a')](_0x4413fe)});}}}emlformat[_0xb2cd('0x6b')](_0x219a19,function(_0x22de47,_0x30139c){if(_0x22de47)return _0x203765(_0x22de47);fs[_0xb2cd('0x6c')](path[_0xb2cd('0x56')](_0x224545,util[_0xb2cd('0x57')](_0xb2cd('0x6d'),_0xa4d136)),_0x30139c);return _0xd6aa54(_0x30139c);});});})[_0xb2cd('0x1a')](function(){return new BPromise(function(_0x52ca3b,_0x57962d){zipdir(_0x224545,{'saveTo':_0x539aef},function(_0x1a5bd3,_0x264341){if(_0x1a5bd3)return _0x57962d(_0x1a5bd3);return _0x52ca3b(_0x264341);});})[_0xb2cd('0x1a')](function(){return new BPromise(function(_0xf4b9b0,_0x4a445d){rimraf(_0x224545,function(_0x46f454){if(_0x46f454)_0x4a445d(_0x46f454);return _0xf4b9b0();});});})[_0xb2cd('0x1a')](function(){return _0x1299e2[_0xb2cd('0x4f')](_0x539aef,_0x1ae9f0,function(_0x4322cd){if(!_0x4322cd)fs[_0xb2cd('0x6e')](_0x539aef);});});});}else{return _0x1299e2[_0xb2cd('0x11')](0xc8);}})['catch'](handleError(_0x1299e2,null));}; \ No newline at end of file +var _0x16b5=['describe','addMessage','MailMessage','ids','omit','getMessages','order','sort','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','count','true','rows','addTags','setTags','spread','Tag','color','mailInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','subject','createdAt','get','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','Bcc','existsSync','readFileSync','writeFileSync','download','rimraf','zip-dir','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','register','status','end','json','undefined','limit','offset','set','Content-Range','then','destroy','sendStatus','error','stack','name','send','map','MailInteraction','fieldName','type','getOptions','findAll','mail','query','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','create','body','find'];(function(_0x12f160,_0x41aba8){var _0xf30ab7=function(_0xb3c040){while(--_0xb3c040){_0x12f160['push'](_0x12f160['shift']());}};_0xf30ab7(++_0x41aba8);}(_0x16b5,0x9f));var _0x516b=function(_0xa3db69,_0x19c428){_0xa3db69=_0xa3db69-0x0;var _0x13a7e2=_0x16b5[_0xa3db69];return _0x13a7e2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x516b('0x0'));var zipdir=require(_0x516b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x516b('0x2'));var path=require(_0x516b('0x3'));var fs=require('fs');var _=require(_0x516b('0x4'));var juice=require('juice');var Redis=require(_0x516b('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0x516b('0x6'));var logger=require(_0x516b('0x7'))(_0x516b('0x8'));var config=require(_0x516b('0x9'));var db=require(_0x516b('0xa'))['db'];var htmlEntities=require(_0x516b('0xb'));config[_0x516b('0xc')]=_[_0x516b('0xd')](config[_0x516b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x516b('0xe'))[_0x516b('0xf')](socket);function respondWithStatusCode(_0x5eab24,_0x58a90d){_0x58a90d=_0x58a90d||0xcc;return function(_0x430a82){if(_0x430a82){return _0x5eab24['sendStatus'](_0x58a90d);}return _0x5eab24[_0x516b('0x10')](_0x58a90d)[_0x516b('0x11')]();};}function respondWithResult(_0x4c475b,_0x1a5c03){_0x1a5c03=_0x1a5c03||0xc8;return function(_0x17247d){if(_0x17247d){return _0x4c475b[_0x516b('0x10')](_0x1a5c03)[_0x516b('0x12')](_0x17247d);}};}function respondWithFilteredResult(_0x36974e,_0x326918){return function(_0x4883e5){if(_0x4883e5){var _0xae005=typeof _0x326918['offset']===_0x516b('0x13')&&typeof _0x326918[_0x516b('0x14')]===_0x516b('0x13');var _0xeae240=_0x4883e5['count'];var _0x7ed399=_0xae005?0x0:_0x326918[_0x516b('0x15')];var _0x1f9970=_0xae005?_0x4883e5['count']:_0x326918[_0x516b('0x15')]+_0x326918[_0x516b('0x14')];var _0x4f4255;if(_0x1f9970>=_0xeae240){_0x1f9970=_0xeae240;_0x4f4255=0xc8;}else{_0x4f4255=0xce;}_0x36974e['status'](_0x4f4255);return _0x36974e[_0x516b('0x16')](_0x516b('0x17'),_0x7ed399+'-'+_0x1f9970+'/'+_0xeae240)[_0x516b('0x12')](_0x4883e5);}return null;};}function saveUpdates(_0x32192b){return function(_0x456615){if(_0x456615){return _0x456615['update'](_0x32192b)[_0x516b('0x18')](function(_0x59c9c9){return _0x59c9c9;});}return null;};}function removeEntity(_0x5f18ca){return function(_0x4a339f){if(_0x4a339f){return _0x4a339f[_0x516b('0x19')]()[_0x516b('0x18')](function(){_0x5f18ca[_0x516b('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b55e9){return function(_0x486ae2){if(!_0x486ae2){_0x1b55e9[_0x516b('0x1a')](0x194);}return _0x486ae2;};}function handleError(_0x36052,_0x1c6052){_0x1c6052=_0x1c6052||0x1f4;return function(_0x13e5df){logger[_0x516b('0x1b')](_0x13e5df[_0x516b('0x1c')]);if(_0x13e5df['name']){delete _0x13e5df[_0x516b('0x1d')];}_0x36052[_0x516b('0x10')](_0x1c6052)[_0x516b('0x1e')](_0x13e5df);};}exports['index']=function(_0x5bcd8c,_0x2301cd){var _0x18f942={};var _0xce4c9d=_[_0x516b('0x1f')](db[_0x516b('0x20')]['rawAttributes'],function(_0x3dee8c){return{'name':_0x3dee8c[_0x516b('0x21')],'type':_0x3dee8c[_0x516b('0x22')]['key']};});_0x18f942=qs[_0x516b('0x23')](_0xce4c9d,_0x5bcd8c);return interaction[_0x516b('0x24')](_0x516b('0x25'),_0x5bcd8c[_0x516b('0x26')],_0x5bcd8c['user'],_0x18f942,_0xce4c9d)[_0x516b('0x18')](respondWithFilteredResult(_0x2301cd,_0x18f942))[_0x516b('0x27')](handleError(_0x2301cd,null));};exports[_0x516b('0x28')]=function(_0x1ab6aa,_0x5ee2aa){var _0x447381={'raw':![],'where':{'id':_0x1ab6aa[_0x516b('0x29')]['id']}},_0x18ff37={};_0x18ff37[_0x516b('0x2a')]=_[_0x516b('0x2b')](db[_0x516b('0x20')][_0x516b('0x2c')]);_0x18ff37[_0x516b('0x26')]=_[_0x516b('0x2b')](_0x1ab6aa[_0x516b('0x26')]);_0x18ff37[_0x516b('0x2d')]=_[_0x516b('0x2e')](_0x18ff37[_0x516b('0x2a')],_0x18ff37['query']);_0x447381[_0x516b('0x2f')]=_['intersection'](_0x18ff37[_0x516b('0x2a')],qs['fields'](_0x1ab6aa['query'][_0x516b('0x30')]));_0x447381['attributes']=_0x447381[_0x516b('0x2f')][_0x516b('0x31')]?_0x447381[_0x516b('0x2f')]:_0x18ff37[_0x516b('0x2a')];if(_0x1ab6aa[_0x516b('0x26')][_0x516b('0x32')]){_0x447381[_0x516b('0x33')]=[{'all':!![]}];}_0x447381=_['merge']({},_0x447381,_0x1ab6aa['options']);return db['MailInteraction']['find'](_0x447381)[_0x516b('0x18')](handleEntityNotFound(_0x5ee2aa,null))[_0x516b('0x18')](respondWithResult(_0x5ee2aa,null))[_0x516b('0x27')](handleError(_0x5ee2aa,null));};exports[_0x516b('0x34')]=function(_0x5c4e71,_0xd3aa44){return db[_0x516b('0x20')][_0x516b('0x34')](_0x5c4e71[_0x516b('0x35')],{})['then'](respondWithResult(_0xd3aa44,0xc9))[_0x516b('0x27')](handleError(_0xd3aa44,null));};exports['update']=function(_0x4b2bf4,_0x193a06){if(_0x4b2bf4[_0x516b('0x35')]['id']){delete _0x4b2bf4[_0x516b('0x35')]['id'];}return db['MailInteraction'][_0x516b('0x36')]({'where':{'id':_0x4b2bf4[_0x516b('0x29')]['id']}})[_0x516b('0x18')](handleEntityNotFound(_0x193a06,null))[_0x516b('0x18')](saveUpdates(_0x4b2bf4[_0x516b('0x35')],null))[_0x516b('0x18')](respondWithResult(_0x193a06,null))[_0x516b('0x27')](handleError(_0x193a06,null));};exports[_0x516b('0x19')]=function(_0xd62a35,_0x50b28a){return db[_0x516b('0x20')][_0x516b('0x36')]({'where':{'id':_0xd62a35[_0x516b('0x29')]['id']}})[_0x516b('0x18')](handleEntityNotFound(_0x50b28a,null))[_0x516b('0x18')](removeEntity(_0x50b28a,null))[_0x516b('0x27')](handleError(_0x50b28a,null));};exports['describe']=function(_0x51b561,_0x5383a6){return db['MailInteraction'][_0x516b('0x37')]()['then'](respondWithResult(_0x5383a6,null))['catch'](handleError(_0x5383a6,null));};exports[_0x516b('0x38')]=function(_0x58f311,_0x661f35){return db[_0x516b('0x39')][_0x516b('0x36')]({'where':{'id':_0x58f311[_0x516b('0x29')]['id']}})[_0x516b('0x18')](handleEntityNotFound(_0x661f35,null))['then'](function(_0x54fd72){if(_0x54fd72){return _0x54fd72['addMessage'](_0x58f311[_0x516b('0x35')][_0x516b('0x3a')],_[_0x516b('0x3b')](_0x58f311[_0x516b('0x35')],[_0x516b('0x3a'),'id'])||{});}})[_0x516b('0x18')](respondWithResult(_0x661f35,null))[_0x516b('0x27')](handleError(_0x661f35,null));};exports[_0x516b('0x3c')]=function(_0x66b297,_0x27c685){var _0x17e07b={'raw':![],'where':{}};var _0x37ec56={};var _0x2a3d96={'count':0x0,'rows':[]};return db[_0x516b('0x20')]['findOne']({'where':{'id':_0x66b297[_0x516b('0x29')]['id']}})[_0x516b('0x18')](handleEntityNotFound(_0x27c685,null))[_0x516b('0x18')](function(_0x158f0e){if(_0x158f0e){_0x37ec56['model']=_[_0x516b('0x2b')](db[_0x516b('0x39')]['rawAttributes']);_0x37ec56[_0x516b('0x26')]=_[_0x516b('0x2b')](_0x66b297[_0x516b('0x26')]);_0x37ec56[_0x516b('0x2d')]=_['intersection'](_0x37ec56[_0x516b('0x2a')],_0x37ec56['query']);_0x17e07b[_0x516b('0x2f')]=_[_0x516b('0x2e')](_0x37ec56[_0x516b('0x2a')],qs[_0x516b('0x30')](_0x66b297[_0x516b('0x26')]['fields']));_0x17e07b[_0x516b('0x2f')]=_0x17e07b[_0x516b('0x2f')]['length']?_0x17e07b[_0x516b('0x2f')]:_0x37ec56[_0x516b('0x2a')];if(!_0x66b297[_0x516b('0x26')]['hasOwnProperty']('nolimit')){_0x17e07b[_0x516b('0x14')]=qs[_0x516b('0x14')](_0x66b297[_0x516b('0x26')]['limit']);_0x17e07b[_0x516b('0x15')]=qs['offset'](_0x66b297[_0x516b('0x26')][_0x516b('0x15')]);}_0x17e07b[_0x516b('0x3d')]=qs[_0x516b('0x3e')](_0x66b297['query'][_0x516b('0x3e')]);_0x17e07b['where']=qs[_0x516b('0x2d')](_['pick'](_0x66b297[_0x516b('0x26')],_0x37ec56[_0x516b('0x2d')]));_0x17e07b[_0x516b('0x3f')][_0x516b('0x40')]=_0x158f0e['id'];if(_0x66b297[_0x516b('0x26')][_0x516b('0x41')]){_0x17e07b['where']=_['merge'](_0x17e07b['where'],{'$or':_['map'](_0x17e07b[_0x516b('0x2f')],function(_0x35c74e){var _0x582a66={};_0x582a66[_0x35c74e]={'$like':'%'+_0x66b297['query'][_0x516b('0x41')]+'%'};return _0x582a66;})});}if(_0x66b297['query'][_0x516b('0x42')]){var _0x57b0bb=_0x66b297[_0x516b('0x26')][_0x516b('0x42')][_0x516b('0x43')](',');var _0x3cb425={};_0x3cb425[_0x57b0bb[0x0]]={'$gte':moment(_0x57b0bb[0x1])[_0x516b('0x44')](_0x516b('0x45'))};_0x17e07b[_0x516b('0x3f')]=_['merge'](_0x17e07b[_0x516b('0x3f')],_0x3cb425);}_0x17e07b=_[_0x516b('0x46')]({},_0x17e07b,_0x66b297['options']);return db['MailMessage'][_0x516b('0x47')]({'where':_0x17e07b['where']})[_0x516b('0x18')](function(_0x270201){_0x2a3d96[_0x516b('0x47')]=_0x270201;if(_0x66b297[_0x516b('0x26')][_0x516b('0x32')]){_0x17e07b['include']=[{'all':!![]}];}return db[_0x516b('0x39')]['findAll'](_0x17e07b);})['then'](function(_0x44c12b){if(_0x66b297[_0x516b('0x26')]['inlineCss']===_0x516b('0x48')){for(var _0x328237=0x0;_0x328237<_0x44c12b[_0x516b('0x31')];_0x328237++){_0x44c12b[_0x328237][_0x516b('0x35')]=juice(_0x44c12b[_0x328237][_0x516b('0x35')]);}}_0x2a3d96[_0x516b('0x49')]=_0x44c12b;return _0x2a3d96;});}})['then'](respondWithFilteredResult(_0x27c685,_0x17e07b))[_0x516b('0x27')](handleError(_0x27c685,null));};exports[_0x516b('0x4a')]=function(_0x49e7a8,_0x42d844){return db[_0x516b('0x20')][_0x516b('0x36')]({'where':{'id':_0x49e7a8[_0x516b('0x29')]['id']}})[_0x516b('0x18')](handleEntityNotFound(_0x42d844,null))[_0x516b('0x18')](function(_0x4b396f){if(_0x4b396f){return _0x4b396f[_0x516b('0x4b')](_0x49e7a8[_0x516b('0x35')]['ids'],_[_0x516b('0x3b')](_0x49e7a8[_0x516b('0x35')],[_0x516b('0x3a'),'id'])||{})[_0x516b('0x4c')](function(){return db[_0x516b('0x4d')][_0x516b('0x24')]({'attributes':['id','name',_0x516b('0x4e')],'where':{'id':_0x49e7a8['body'][_0x516b('0x3a')]}});})[_0x516b('0x18')](function(_0x2f75a1){socket['emit'](_0x516b('0x4f'),{'id':Number(_0x49e7a8[_0x516b('0x29')]['id']),'tags':_0x2f75a1||[]});return{'id':Number(_0x49e7a8[_0x516b('0x29')]['id']),'tags':_0x2f75a1||[]};});}})[_0x516b('0x18')](respondWithResult(_0x42d844,null))[_0x516b('0x27')](handleError(_0x42d844,null));};exports['removeTags']=function(_0x5a4fe2,_0x15dee0){return db[_0x516b('0x20')][_0x516b('0x36')]({'where':{'id':_0x5a4fe2[_0x516b('0x29')]['id']}})['then'](handleEntityNotFound(_0x15dee0,null))['then'](function(_0x476f9e){if(_0x476f9e){return _0x476f9e[_0x516b('0x50')](_0x5a4fe2[_0x516b('0x26')]['ids']);}})[_0x516b('0x18')](respondWithStatusCode(_0x15dee0,null))[_0x516b('0x27')](handleError(_0x15dee0,null));};exports['download']=function(_0x1622ab,_0x491f1b){var _0x20398d=moment()[_0x516b('0x51')]()[_0x516b('0x52')]();var _0x3a7e85=path[_0x516b('0x53')](config[_0x516b('0x54')],_0x516b('0x55'),_0x516b('0x56'),_0x516b('0x57'));var _0x1e1c3a=path[_0x516b('0x53')](config[_0x516b('0x54')],_0x516b('0x55'),_0x516b('0x56'),_0x516b('0x58'));var _0x11a3a9=path[_0x516b('0x53')](_0x3a7e85,_0x20398d);var _0x2b93d0=util[_0x516b('0x44')](_0x516b('0x59'),_0x1622ab[_0x516b('0x29')]['id'],_0x20398d);var _0x2ab0fb=path['join'](_0x3a7e85,_0x2b93d0);var _0x51eea6=[];if(_0x1622ab[_0x516b('0x26')][_0x516b('0x58')]){_0x51eea6[_0x516b('0x5a')]({'model':db[_0x516b('0x5b')],'as':_0x516b('0x5c'),'raw':!![]});}var _0x3fd17d=[{'model':db['MailMessage'],'as':_0x516b('0x5d'),'attributes':['id',_0x516b('0x35'),_0x516b('0x5e'),'to','cc','bcc',_0x516b('0x5f'),_0x516b('0x60')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x51eea6}];return db[_0x516b('0x20')][_0x516b('0x36')]({'where':{'id':_0x1622ab[_0x516b('0x29')]['id']},'include':_0x3fd17d})[_0x516b('0x18')](handleEntityNotFound(_0x491f1b,null))[_0x516b('0x18')](function(_0x266811){if(_0x266811&&_0x266811['Messages']){var _0x201f68=_0x266811[_0x516b('0x61')]({'plain':!![]});fs['mkdirSync'](_0x11a3a9);return BPromise['each'](_0x201f68[_0x516b('0x5d')],function(_0xfd5c21,_0x26f1b0){var _0x33e3e6={'from':_0xfd5c21[_0x516b('0x5e')],'to':_0xfd5c21['to']||_0x516b('0x62'),'subject':_0xfd5c21['subject'],'html':htmlEntities['decode'](_0xfd5c21[_0x516b('0x35')]),'headers':{'Date':moment(_0xfd5c21[_0x516b('0x60')])[_0x516b('0x44')](_0x516b('0x63'))},'attachments':[]};if(_0xfd5c21['cc']){_0x33e3e6['headers']['Cc']=_0xfd5c21['cc'];}if(_0xfd5c21[_0x516b('0x64')]){_0x33e3e6[_0x516b('0x65')][_0x516b('0x66')]=_0xfd5c21[_0x516b('0x64')];}return new BPromise(function(_0x202d35,_0x5e5bb9){if(_0xfd5c21['Attachments']){for(var _0x381208=0x0;_0x381208<_0xfd5c21['Attachments'][_0x516b('0x31')];_0x381208++){var _0x3e3b24=_0xfd5c21[_0x516b('0x5c')][_0x381208];var _0x565aab=path['join'](_0x1e1c3a,_0x3e3b24['basename']);if(fs[_0x516b('0x67')](_0x565aab)){_0x33e3e6['attachments'][_0x516b('0x5a')]({'name':_0x3e3b24['name'],'contentType':_0x3e3b24['type'],'data':fs[_0x516b('0x68')](_0x565aab)});}}}emlformat['build'](_0x33e3e6,function(_0x42fb5c,_0x43fb38){if(_0x42fb5c)return _0x5e5bb9(_0x42fb5c);fs[_0x516b('0x69')](path['join'](_0x11a3a9,util[_0x516b('0x44')]('message%d.eml',_0x26f1b0)),_0x43fb38);return _0x202d35(_0x43fb38);});});})[_0x516b('0x18')](function(){return new BPromise(function(_0x24b243,_0x4c2054){zipdir(_0x11a3a9,{'saveTo':_0x2ab0fb},function(_0x1d9678,_0x199411){if(_0x1d9678)return _0x4c2054(_0x1d9678);return _0x24b243(_0x199411);});})['then'](function(){return new BPromise(function(_0x4362b1,_0x236115){rimraf(_0x11a3a9,function(_0x4c942b){if(_0x4c942b)_0x236115(_0x4c942b);return _0x4362b1();});});})[_0x516b('0x18')](function(){return _0x491f1b[_0x516b('0x6a')](_0x2ab0fb,_0x2b93d0,function(_0x57aafb){if(!_0x57aafb)fs['unlinkSync'](_0x2ab0fb);});});});}else{return _0x491f1b[_0x516b('0x1a')](0xc8);}})[_0x516b('0x27')](handleError(_0x491f1b,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 8d38727..7c3c204 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 _0x7efe=['catch','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','getUsers','then','setDataValue','map','unreadMessages','length','emit'];(function(_0x365bf8,_0x4fba55){var _0x1a7275=function(_0x32eb37){while(--_0x32eb37){_0x365bf8['push'](_0x365bf8['shift']());}};_0x1a7275(++_0x4fba55);}(_0x7efe,0x123));var _0xe7ef=function(_0x386f01,_0x23cccc){_0x386f01=_0x386f01-0x0;var _0x5082c7=_0x7efe[_0x386f01];return _0x5082c7;};'use strict';var EventEmitter=require(_0xe7ef('0x0'));var MailInteraction=require(_0xe7ef('0x1'))['db'][_0xe7ef('0x2')];var MailMessage=require(_0xe7ef('0x1'))['db'][_0xe7ef('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xe7ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe7ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a3652){return function(_0x3323bd,_0xfe066a,_0x11e23e){_0x3323bd[_0xe7ef('0x6')]({'attributes':['id'],'raw':!![]})[_0xe7ef('0x7')](function(_0x16633f){_0x3323bd[_0xe7ef('0x8')]('Users',_0x16633f[_0xe7ef('0x9')](function(_0x15c580){return{'id':_0x15c580['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3323bd['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5d52cd){_0x3323bd['setDataValue'](_0xe7ef('0xa'),_0x5d52cd[_0xe7ef('0xb')]);MailInteractionEvents['emit'](_0x2a3652+':'+_0x3323bd['id'],_0x3323bd);MailInteractionEvents[_0xe7ef('0xc')](_0x2a3652,_0x3323bd);_0x11e23e(null);})[_0xe7ef('0xd')](_0x11e23e(null));};}for(var e in events){if(events[_0xe7ef('0xe')](e)){var event=events[e];MailInteraction[_0xe7ef('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xcfa1=['map','findAll','then','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','getUsers'];(function(_0x37728b,_0x162fb6){var _0x2c29ea=function(_0x1f3169){while(--_0x1f3169){_0x37728b['push'](_0x37728b['shift']());}};_0x2c29ea(++_0x162fb6);}(_0xcfa1,0xb3));var _0x1cfa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcfa1[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x1cfa('0x0'));var MailInteraction=require(_0x1cfa('0x1'))['db'][_0x1cfa('0x2')];var MailMessage=require(_0x1cfa('0x1'))['db'][_0x1cfa('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x1cfa('0x4')](0x0);var events={'afterCreate':_0x1cfa('0x5'),'afterUpdate':'update','afterDestroy':_0x1cfa('0x6')};function emitEvent(_0x496f43){return function(_0x40b84f,_0x59ea1f,_0x4aafcf){_0x40b84f[_0x1cfa('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x55903c){_0x40b84f['setDataValue']('Users',_0x55903c[_0x1cfa('0x8')](function(_0x615db6){return{'id':_0x615db6['id']};}));return MailMessage[_0x1cfa('0x9')]({'where':{'MailInteractionId':_0x40b84f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1cfa('0xa')](function(_0x280a86){_0x40b84f[_0x1cfa('0xb')](_0x1cfa('0xc'),_0x280a86[_0x1cfa('0xd')]);MailInteractionEvents[_0x1cfa('0xe')](_0x496f43+':'+_0x40b84f['id'],_0x40b84f);MailInteractionEvents[_0x1cfa('0xe')](_0x496f43,_0x40b84f);_0x4aafcf(null);})['catch'](_0x4aafcf(null));};}for(var e in events){if(events[_0x1cfa('0xf')](e)){var event=events[e];MailInteraction[_0x1cfa('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index f834612..2c018a9 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 _0xd7b2=['models','get','update','then','catch','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format'];(function(_0x2665a3,_0x1bd09e){var _0x4f8fb0=function(_0x255207){while(--_0x255207){_0x2665a3['push'](_0x2665a3['shift']());}};_0x4f8fb0(++_0x1bd09e);}(_0xd7b2,0xf9));var _0x2d7b=function(_0x4081aa,_0x26f620){_0x4081aa=_0x4081aa-0x0;var _0x3c69c7=_0xd7b2[_0x4081aa];return _0x3c69c7;};'use strict';var _=require('lodash');var util=require(_0x2d7b('0x0'));var logger=require(_0x2d7b('0x1'))(_0x2d7b('0x2'));var moment=require(_0x2d7b('0x3'));var BPromise=require(_0x2d7b('0x4'));var rp=require(_0x2d7b('0x5'));var fs=require('fs');var path=require(_0x2d7b('0x6'));var rimraf=require(_0x2d7b('0x7'));var config=require(_0x2d7b('0x8'));var attributes=require(_0x2d7b('0x9'));module[_0x2d7b('0xa')]=function(_0x25879c,_0x2383f8){return _0x25879c[_0x2d7b('0xb')]('MailInteraction',attributes,{'tableName':_0x2d7b('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x2d7b('0xd'),'to'],'type':_0x2d7b('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2afd4a,_0x47ebd7,_0x4157fa){if(_0x2afd4a[_0x2d7b('0xf')]){_0x2afd4a[_0x2d7b('0x10')]=moment()['format'](_0x2d7b('0x11'));}if(_0x2afd4a[_0x2d7b('0x12')]){_0x2afd4a[_0x2d7b('0x13')]=moment()[_0x2d7b('0x14')](_0x2d7b('0x11'));}_0x4157fa(null,_0x47ebd7);},'beforeUpdate':function(_0x3dfab0,_0x89760a,_0x4dba59){if(_0x3dfab0['changed'](_0x2d7b('0xf'))){_0x3dfab0[_0x2d7b('0x10')]=_0x3dfab0[_0x2d7b('0xf')]?moment()[_0x2d7b('0x14')](_0x2d7b('0x11')):null;}if(_0x3dfab0['changed'](_0x2d7b('0x12'))){_0x3dfab0[_0x2d7b('0x13')]=moment()[_0x2d7b('0x14')](_0x2d7b('0x11'));_0x3dfab0['substatus']=null;_0x3dfab0[_0x2d7b('0x10')]=null;}_0x4dba59(null,_0x3dfab0);},'afterUpdate':function(_0x1f885b,_0x2ed554,_0xbe9833){var _0x33c10e=_0x25879c[_0x2d7b('0x15')];var _0x16ca17=_0x1f885b[_0x2d7b('0x16')]({'plain':!![]});if(_0x16ca17[_0x2d7b('0x12')]){return _0x33c10e['MailMessage'][_0x2d7b('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x16ca17['id']}})[_0x2d7b('0x18')](function(){_0xbe9833();})[_0x2d7b('0x19')](function(_0x13ff68){_0xbe9833(_0x13ff68);});}else{_0xbe9833();}}},'charset':_0x2d7b('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x96d4=['then','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','format','changed','closedAt','models','get','update'];(function(_0x2c8f5e,_0x221a1b){var _0x59eb32=function(_0x275d88){while(--_0x275d88){_0x2c8f5e['push'](_0x2c8f5e['shift']());}};_0x59eb32(++_0x221a1b);}(_0x96d4,0x67));var _0x496d=function(_0x957133,_0x2b75fc){_0x957133=_0x957133-0x0;var _0x4cac53=_0x96d4[_0x957133];return _0x4cac53;};'use strict';var _=require(_0x496d('0x0'));var util=require(_0x496d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x496d('0x2'));var BPromise=require(_0x496d('0x3'));var rp=require(_0x496d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x496d('0x5'));var attributes=require(_0x496d('0x6'));module[_0x496d('0x7')]=function(_0x2fd4f8,_0x4a511f){return _0x2fd4f8[_0x496d('0x8')](_0x496d('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x496d('0xa'),'to'],'type':_0x496d('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1409e9,_0x8813ad,_0x2dcc75){if(_0x1409e9[_0x496d('0xc')]){_0x1409e9[_0x496d('0xd')]=moment()['format'](_0x496d('0xe'));}if(_0x1409e9[_0x496d('0xf')]){_0x1409e9['closedAt']=moment()[_0x496d('0x10')](_0x496d('0xe'));}_0x2dcc75(null,_0x8813ad);},'beforeUpdate':function(_0x169446,_0x1d28c1,_0x576c83){if(_0x169446['changed']('substatus')){_0x169446['substatusAt']=_0x169446[_0x496d('0xc')]?moment()[_0x496d('0x10')](_0x496d('0xe')):null;}if(_0x169446[_0x496d('0x11')](_0x496d('0xf'))){_0x169446[_0x496d('0x12')]=moment()[_0x496d('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x169446[_0x496d('0xc')]=null;_0x169446[_0x496d('0xd')]=null;}_0x576c83(null,_0x169446);},'afterUpdate':function(_0x4b1565,_0x3cda8c,_0x387a65){var _0x460b0f=_0x2fd4f8[_0x496d('0x13')];var _0x298a50=_0x4b1565[_0x496d('0x14')]({'plain':!![]});if(_0x298a50['closed']){return _0x460b0f['MailMessage'][_0x496d('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x298a50['id']}})[_0x496d('0x16')](function(){_0x387a65();})['catch'](function(_0x27d2c8){_0x387a65(_0x27d2c8);});}else{_0x387a65();}}},'charset':_0x496d('0x17'),'collate':_0x496d('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 9e14462..d04d0cd 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 _0xfb65=['AddTagsToMailInteraction','addTags','omit','body','ids','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','limit'];(function(_0x54ffe2,_0x27c17c){var _0x30f4f2=function(_0x26a131){while(--_0x26a131){_0x54ffe2['push'](_0x54ffe2['shift']());}};_0x30f4f2(++_0x27c17c);}(_0xfb65,0x82));var _0x5fb6=function(_0x15eb17,_0x3bd3c1){_0x15eb17=_0x15eb17-0x0;var _0x283076=_0xfb65[_0x15eb17];return _0x283076;};'use strict';var _=require('lodash');var util=require(_0x5fb6('0x0'));var moment=require(_0x5fb6('0x1'));var BPromise=require('bluebird');var rs=require(_0x5fb6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fb6('0x3'))['db'];var utils=require(_0x5fb6('0x4'));var logger=require(_0x5fb6('0x5'))(_0x5fb6('0x6'));var config=require(_0x5fb6('0x7'));var jayson=require(_0x5fb6('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x5fb6('0x9')]=_[_0x5fb6('0xa')](config[_0x5fb6('0x9')],{'host':_0x5fb6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5fb6('0x9')]));require(_0x5fb6('0xc'))[_0x5fb6('0xd')](socket);function respondWithRpcPromise(_0x21e613,_0x4ff5d2,_0x2b63fd){return new BPromise(function(_0xcf0402,_0x491bb6){return client[_0x5fb6('0xe')](_0x21e613,_0x2b63fd)[_0x5fb6('0xf')](function(_0x160070){logger[_0x5fb6('0x10')](_0x5fb6('0x11'),_0x4ff5d2,'request\x20sent');logger[_0x5fb6('0x12')](_0x5fb6('0x13'),_0x4ff5d2,_0x5fb6('0x14'),JSON[_0x5fb6('0x15')](_0x160070));if(_0x160070[_0x5fb6('0x16')]){if(_0x160070[_0x5fb6('0x16')][_0x5fb6('0x17')]===0x1f4){logger[_0x5fb6('0x16')]('MailInteraction,\x20%s,\x20%s',_0x4ff5d2,_0x160070['error'][_0x5fb6('0x18')]);return _0x491bb6(_0x160070[_0x5fb6('0x16')]['message']);}logger[_0x5fb6('0x16')](_0x5fb6('0x11'),_0x4ff5d2,_0x160070[_0x5fb6('0x16')]['message']);return _0xcf0402(_0x160070[_0x5fb6('0x16')][_0x5fb6('0x18')]);}else{logger[_0x5fb6('0x10')](_0x5fb6('0x11'),_0x4ff5d2,_0x5fb6('0x14'));_0xcf0402(_0x160070[_0x5fb6('0x19')]['message']);}})[_0x5fb6('0x1a')](function(_0x5aeb08){logger[_0x5fb6('0x16')]('MailInteraction,\x20%s,\x20%s',_0x4ff5d2,_0x5aeb08);_0x491bb6(_0x5aeb08);});});}exports[_0x5fb6('0x1b')]=function(_0x3ec3b0){var _0x402e8a=this;return new Promise(function(_0x1c5891,_0x5885f1){return db[_0x5fb6('0x1c')][_0x5fb6('0x1d')](_0x3ec3b0['body'],{'raw':_0x3ec3b0['options']?_0x3ec3b0[_0x5fb6('0x1e')][_0x5fb6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ec3b0['options']?_0x3ec3b0[_0x5fb6('0x1e')][_0x5fb6('0x20')]||null:null,'attributes':_0x3ec3b0[_0x5fb6('0x1e')]?_0x3ec3b0[_0x5fb6('0x1e')]['attributes']||null:null,'limit':_0x3ec3b0[_0x5fb6('0x1e')]?_0x3ec3b0[_0x5fb6('0x1e')][_0x5fb6('0x21')]||null:null})[_0x5fb6('0xf')](function(_0x1b6953){logger[_0x5fb6('0x10')]('UpdateMailInteraction',_0x3ec3b0);logger['debug'](_0x5fb6('0x1b'),_0x3ec3b0,JSON[_0x5fb6('0x15')](_0x1b6953));_0x1c5891(_0x1b6953);})[_0x5fb6('0x1a')](function(_0x3ce22f){logger[_0x5fb6('0x16')](_0x5fb6('0x1b'),_0x3ce22f[_0x5fb6('0x18')],_0x3ec3b0);_0x5885f1(_0x402e8a['error'](0x1f4,_0x3ce22f[_0x5fb6('0x18')]));});});};exports[_0x5fb6('0x22')]=function(_0xac9a34){return new Promise(function(_0x5a1f0d,_0x2afc08){return db[_0x5fb6('0x1c')]['find']({'where':_0xac9a34[_0x5fb6('0x1e')]?_0xac9a34[_0x5fb6('0x1e')]['where']||null:null})[_0x5fb6('0xf')](function(_0x4856d9){if(_0x4856d9){return _0x4856d9[_0x5fb6('0x23')](_0xac9a34['body']['ids'],_[_0x5fb6('0x24')](_0xac9a34[_0x5fb6('0x25')],[_0x5fb6('0x26'),'id'])||{});}})[_0x5fb6('0x27')](function(_0x36fc09){logger[_0x5fb6('0x10')]('AddTags',_0xac9a34);logger[_0x5fb6('0x12')](_0x5fb6('0x28'),_0xac9a34,JSON[_0x5fb6('0x15')](_0x36fc09));_0x5a1f0d(_0x36fc09);})[_0x5fb6('0x1a')](function(_0x6531fe){logger[_0x5fb6('0x16')](_0x5fb6('0x28'),_0x6531fe[_0x5fb6('0x18')],_0xac9a34);_0x2afc08(_this[_0x5fb6('0x16')](0x1f4,_0x6531fe[_0x5fb6('0x18')]));});});}; \ No newline at end of file +var _0xb458=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','AddTagsToMailInteraction','find','where','addTags','omit','ids','AddTags','lodash','util','moment','ioredis'];(function(_0x348dfc,_0x5917f6){var _0x59a3ab=function(_0x42a9e4){while(--_0x42a9e4){_0x348dfc['push'](_0x348dfc['shift']());}};_0x59a3ab(++_0x5917f6);}(_0xb458,0x94));var _0x8b45=function(_0x58abcc,_0x3e2cc8){_0x58abcc=_0x58abcc-0x0;var _0x3327be=_0xb458[_0x58abcc];return _0x3327be;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b45('0x4'));var logger=require(_0x8b45('0x5'))(_0x8b45('0x6'));var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8b45('0x8')][_0x8b45('0x9')]({'port':0x232a});config[_0x8b45('0xa')]=_[_0x8b45('0xb')](config[_0x8b45('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b45('0xa')]));require(_0x8b45('0xc'))[_0x8b45('0xd')](socket);function respondWithRpcPromise(_0x2a9c49,_0x16ad9a,_0x244adc){return new BPromise(function(_0xf4b398,_0xca52fb){return client['request'](_0x2a9c49,_0x244adc)[_0x8b45('0xe')](function(_0x30999d){logger[_0x8b45('0xf')](_0x8b45('0x10'),_0x16ad9a,_0x8b45('0x11'));logger[_0x8b45('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x16ad9a,_0x8b45('0x11'),JSON[_0x8b45('0x13')](_0x30999d));if(_0x30999d[_0x8b45('0x14')]){if(_0x30999d[_0x8b45('0x14')][_0x8b45('0x15')]===0x1f4){logger['error'](_0x8b45('0x10'),_0x16ad9a,_0x30999d[_0x8b45('0x14')][_0x8b45('0x16')]);return _0xca52fb(_0x30999d[_0x8b45('0x14')][_0x8b45('0x16')]);}logger[_0x8b45('0x14')](_0x8b45('0x10'),_0x16ad9a,_0x30999d['error']['message']);return _0xf4b398(_0x30999d[_0x8b45('0x14')][_0x8b45('0x16')]);}else{logger[_0x8b45('0xf')]('MailInteraction,\x20%s,\x20%s',_0x16ad9a,'request\x20sent');_0xf4b398(_0x30999d['result'][_0x8b45('0x16')]);}})[_0x8b45('0x17')](function(_0x40bfd7){logger['error'](_0x8b45('0x10'),_0x16ad9a,_0x40bfd7);_0xca52fb(_0x40bfd7);});});}exports[_0x8b45('0x18')]=function(_0x41b7f4){var _0x457cb8=this;return new Promise(function(_0x28c8f2,_0xd426f3){return db[_0x8b45('0x19')][_0x8b45('0x1a')](_0x41b7f4[_0x8b45('0x1b')],{'raw':_0x41b7f4[_0x8b45('0x1c')]?_0x41b7f4['options'][_0x8b45('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41b7f4['options']?_0x41b7f4['options']['where']||null:null,'attributes':_0x41b7f4[_0x8b45('0x1c')]?_0x41b7f4[_0x8b45('0x1c')][_0x8b45('0x1e')]||null:null,'limit':_0x41b7f4[_0x8b45('0x1c')]?_0x41b7f4[_0x8b45('0x1c')]['limit']||null:null})[_0x8b45('0xe')](function(_0x1934b9){logger['info'](_0x8b45('0x18'),_0x41b7f4);logger[_0x8b45('0x12')](_0x8b45('0x18'),_0x41b7f4,JSON['stringify'](_0x1934b9));_0x28c8f2(_0x1934b9);})[_0x8b45('0x17')](function(_0x52e6e4){logger[_0x8b45('0x14')](_0x8b45('0x18'),_0x52e6e4[_0x8b45('0x16')],_0x41b7f4);_0xd426f3(_0x457cb8[_0x8b45('0x14')](0x1f4,_0x52e6e4['message']));});});};exports[_0x8b45('0x1f')]=function(_0x49967e){return new Promise(function(_0x149abc,_0x105d26){return db['MailInteraction'][_0x8b45('0x20')]({'where':_0x49967e['options']?_0x49967e[_0x8b45('0x1c')][_0x8b45('0x21')]||null:null})['then'](function(_0x596cab){if(_0x596cab){return _0x596cab[_0x8b45('0x22')](_0x49967e['body']['ids'],_[_0x8b45('0x23')](_0x49967e[_0x8b45('0x1b')],[_0x8b45('0x24'),'id'])||{});}})['spread'](function(_0x2934cb){logger[_0x8b45('0xf')](_0x8b45('0x25'),_0x49967e);logger[_0x8b45('0x12')](_0x8b45('0x25'),_0x49967e,JSON[_0x8b45('0x13')](_0x2934cb));_0x149abc(_0x2934cb);})['catch'](function(_0x395eec){logger[_0x8b45('0x14')](_0x8b45('0x25'),_0x395eec['message'],_0x49967e);_0x105d26(_this[_0x8b45('0x14')](0x1f4,_0x395eec[_0x8b45('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index dd31913..088c5b2 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 _0x5662=['register','length','./mailInteraction.events','remove','emit'];(function(_0x21b0a2,_0x6ff36f){var _0x9aaa7f=function(_0x2ba2ba){while(--_0x2ba2ba){_0x21b0a2['push'](_0x21b0a2['shift']());}};_0x9aaa7f(++_0x6ff36f);}(_0x5662,0x12e));var _0x2566=function(_0x489fd4,_0x479f16){_0x489fd4=_0x489fd4-0x0;var _0x2b3bcb=_0x5662[_0x489fd4];return _0x2b3bcb;};'use strict';var MailInteractionEvents=require(_0x2566('0x0'));var events=['save',_0x2566('0x1'),'update'];function createListener(_0x1e34a3,_0x49bf34){return function(_0x34d735){_0x49bf34[_0x2566('0x2')](_0x1e34a3,_0x34d735);};}function removeListener(_0x4f95da,_0x52f15a){return function(){MailInteractionEvents['removeListener'](_0x4f95da,_0x52f15a);};}exports[_0x2566('0x3')]=function(_0xb8a5b7){for(var _0x47486c=0x0,_0x15098d=events[_0x2566('0x4')];_0x47486c<_0x15098d;_0x47486c++){var _0xbaf2f8=events[_0x47486c];var _0xe8794d=createListener('mailInteraction:'+_0xbaf2f8,_0xb8a5b7);MailInteractionEvents['on'](_0xbaf2f8,_0xe8794d);}}; \ No newline at end of file +var _0x58cf=['./mailInteraction.events','save','remove','emit','length','mailInteraction:'];(function(_0x38315c,_0x3b2ec6){var _0x5817b8=function(_0x6c717d){while(--_0x6c717d){_0x38315c['push'](_0x38315c['shift']());}};_0x5817b8(++_0x3b2ec6);}(_0x58cf,0xae));var _0xf58c=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x58cf[_0x154940];return _0x401409;};'use strict';var MailInteractionEvents=require(_0xf58c('0x0'));var events=[_0xf58c('0x1'),_0xf58c('0x2'),'update'];function createListener(_0xc422d9,_0xe9c578){return function(_0x15f2fb){_0xe9c578[_0xf58c('0x3')](_0xc422d9,_0x15f2fb);};}function removeListener(_0x190dcb,_0x105977){return function(){MailInteractionEvents['removeListener'](_0x190dcb,_0x105977);};}exports['register']=function(_0x1e16a0){for(var _0x2da231=0x0,_0x5414d9=events[_0xf58c('0x4')];_0x2da231<_0x5414d9;_0x2da231++){var _0x3a78f6=events[_0x2da231];var _0x79b70c=createListener(_0xf58c('0x5')+_0x3a78f6,_0x1e16a0);MailInteractionEvents['on'](_0x3a78f6,_0x79b70c);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 308072c..bf896b1 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 _0x4dd3=['isAuthenticated','index','/describe','/:id','/:id/download','download','post','mail','mailmessage:create','create','put','/:id/accept','reject','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x20752f,_0x2202a6){var _0x13b9c2=function(_0x79cb0c){while(--_0x79cb0c){_0x20752f['push'](_0x20752f['shift']());}};_0x13b9c2(++_0x2202a6);}(_0x4dd3,0xf5));var _0x34dd=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x4dd3[_0x202d24];return _0x2b3a8e;};'use strict';var multer=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var path=require(_0x34dd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x34dd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x34dd('0x4'));var interaction=require(_0x34dd('0x5'));var config=require(_0x34dd('0x6'));var controller=require('./mailMessage.controller');router[_0x34dd('0x7')]('/',auth[_0x34dd('0x8')](),controller[_0x34dd('0x9')]);router[_0x34dd('0x7')](_0x34dd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x34dd('0x7')](_0x34dd('0xb'),auth[_0x34dd('0x8')](),controller['show']);router[_0x34dd('0x7')](_0x34dd('0xc'),auth[_0x34dd('0x8')](),controller[_0x34dd('0xd')]);router[_0x34dd('0xe')]('/',auth[_0x34dd('0x8')](),interaction['tracked'](_0x34dd('0xf'),_0x34dd('0x10')),controller[_0x34dd('0x11')]);router[_0x34dd('0x12')](_0x34dd('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x34dd('0x12')](_0x34dd('0x13'),auth[_0x34dd('0x8')](),controller['accept']);router[_0x34dd('0x12')]('/:id/reject',auth[_0x34dd('0x8')](),controller[_0x34dd('0x14')]);router[_0x34dd('0x15')](_0x34dd('0xb'),auth[_0x34dd('0x8')](),controller[_0x34dd('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1120=['tracked','mail','mailmessage:create','create','/:id','update','put','accept','/:id/reject','reject','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post'];(function(_0x2d8667,_0x3a4ac6){var _0x2b6069=function(_0x166d2b){while(--_0x166d2b){_0x2d8667['push'](_0x2d8667['shift']());}};_0x2b6069(++_0x3a4ac6);}(_0x1120,0x140));var _0x0112=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x1120[_0x424501];return _0xb719af;};'use strict';var multer=require(_0x0112('0x0'));var util=require(_0x0112('0x1'));var path=require(_0x0112('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0112('0x3'));var interaction=require(_0x0112('0x4'));var config=require(_0x0112('0x5'));var controller=require(_0x0112('0x6'));router[_0x0112('0x7')]('/',auth[_0x0112('0x8')](),controller[_0x0112('0x9')]);router[_0x0112('0x7')](_0x0112('0xa'),auth[_0x0112('0x8')](),controller[_0x0112('0xb')]);router[_0x0112('0x7')]('/:id',auth[_0x0112('0x8')](),controller[_0x0112('0xc')]);router[_0x0112('0x7')](_0x0112('0xd'),auth[_0x0112('0x8')](),controller[_0x0112('0xe')]);router[_0x0112('0xf')]('/',auth['isAuthenticated'](),interaction[_0x0112('0x10')](_0x0112('0x11'),_0x0112('0x12')),controller[_0x0112('0x13')]);router['put'](_0x0112('0x14'),auth[_0x0112('0x8')](),controller[_0x0112('0x15')]);router[_0x0112('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0x0112('0x17')]);router['put'](_0x0112('0x18'),auth['isAuthenticated'](),controller[_0x0112('0x19')]);router[_0x0112('0x1a')](_0x0112('0x14'),auth[_0x0112('0x8')](),controller['destroy']);module[_0x0112('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 2644a37..50d7b1d 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 _0xd6cb=['DATE','BOOLEAN','Chat','sequelize','lodash','exports','TEXT','long','medium','ENUM','STRING'];(function(_0x1e52ac,_0x23314b){var _0x19c1c7=function(_0x45b4f6){while(--_0x45b4f6){_0x1e52ac['push'](_0x1e52ac['shift']());}};_0x19c1c7(++_0x23314b);}(_0xd6cb,0x9d));var _0xbd6c=function(_0x3f4d7c,_0x2f1184){_0x3f4d7c=_0x3f4d7c-0x0;var _0x47bf26=_0xd6cb[_0x3f4d7c];return _0x47bf26;};'use strict';var Sequelize=require(_0xbd6c('0x0'));var _=require(_0xbd6c('0x1'));module[_0xbd6c('0x2')]={'body':{'type':Sequelize[_0xbd6c('0x3')](_0xbd6c('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbd6c('0x3')](_0xbd6c('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xbd6c('0x6')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xbd6c('0x7')](0x1fe)},'from':{'type':Sequelize[_0xbd6c('0x7')]},'to':{'type':Sequelize[_0xbd6c('0x3')]('long')},'cc':{'type':Sequelize[_0xbd6c('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xbd6c('0x4'))},'subject':{'type':Sequelize[_0xbd6c('0x3')]},'sentAt':{'type':Sequelize[_0xbd6c('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xbd6c('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xbd6c('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xbd6c('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0xbd6c('0x4'))},'originChannel':{'type':Sequelize[_0xbd6c('0x6')]('Email',_0xbd6c('0xa')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xbcff=['ENUM','out','STRING','DATE','Email','Chat','sequelize','exports','TEXT','long','medium','BOOLEAN'];(function(_0x1bee45,_0x5c4ed3){var _0x2115f7=function(_0x32983d){while(--_0x32983d){_0x1bee45['push'](_0x1bee45['shift']());}};_0x2115f7(++_0x5c4ed3);}(_0xbcff,0x1da));var _0xfbcf=function(_0x51f1e1,_0x17ffae){_0x51f1e1=_0x51f1e1-0x0;var _0x462bb0=_0xbcff[_0x51f1e1];return _0x462bb0;};'use strict';var Sequelize=require(_0xfbcf('0x0'));var _=require('lodash');module[_0xfbcf('0x1')]={'body':{'type':Sequelize[_0xfbcf('0x2')](_0xfbcf('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xfbcf('0x2')](_0xfbcf('0x4'))},'read':{'type':Sequelize[_0xfbcf('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfbcf('0x6')]('in',_0xfbcf('0x7')),'defaultValue':_0xfbcf('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfbcf('0x8')](0x1fe)},'from':{'type':Sequelize[_0xfbcf('0x8')]},'to':{'type':Sequelize['TEXT'](_0xfbcf('0x3'))},'cc':{'type':Sequelize['TEXT'](_0xfbcf('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0xfbcf('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xfbcf('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xfbcf('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xfbcf('0x2')](_0xfbcf('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0xfbcf('0x3'))},'originChannel':{'type':Sequelize[_0xfbcf('0x6')](_0xfbcf('0xa'),_0xfbcf('0xb')),'defaultValue':_0xfbcf('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 17365c1..6f439b9 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 _0xe17d=['get','MailInteraction','MailInteractionId','isNil','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SELECT','fromString','rejectmessage','download','unix','toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','push','readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','json','offset','undefined','limit','count','Content-Range','update','destroy','stack','name','send','index','map','MailMessage','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','type','merge','options','includeAll','include','findAll','catch','show','params','length','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','defaults','ListId','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent'];(function(_0x2d1f93,_0x1ac50f){var _0x2df8c5=function(_0x38aa34){while(--_0x38aa34){_0x2d1f93['push'](_0x2d1f93['shift']());}};_0x2df8c5(++_0x1ac50f);}(_0xe17d,0x17a));var _0xde17=function(_0x2e9262,_0x46320d){_0x2e9262=_0x2e9262-0x0;var _0x2bb358=_0xe17d[_0x2e9262];return _0x2bb358;};'use strict';var emlformat=require('eml-format');var moment=require(_0xde17('0x0'));var BPromise=require(_0xde17('0x1'));var util=require('util');var path=require(_0xde17('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xde17('0x3'));var htmlToText=require(_0xde17('0x4'));var qs=require(_0xde17('0x5'));var logger=require(_0xde17('0x6'))('api');var interaction_log=require(_0xde17('0x6'))(_0xde17('0x7'));var config=require('../../config/environment');var db=require(_0xde17('0x8'))['db'];config[_0xde17('0x9')]=_['defaults'](config[_0xde17('0x9')],{'host':_0xde17('0xa'),'port':0x18eb});var socket=require(_0xde17('0xb'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xde17('0xc'))[_0xde17('0xd')](socket);var jayson=require(_0xde17('0xe'));var client=jayson[_0xde17('0xf')][_0xde17('0x10')]({'port':0x232c});var client9003=jayson['client'][_0xde17('0x10')]({'port':0x232b});var client9002=jayson[_0xde17('0xf')][_0xde17('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x35eda5,_0x365cd4,_0x1cd82b,_0x180698){return new BPromise(function(_0x1c09fd,_0x3698ae){var _0x3761e9=_0x180698||client;return _0x3761e9[_0xde17('0x11')](_0x35eda5,_0x1cd82b)[_0xde17('0x12')](function(_0x41d482){logger[_0xde17('0x13')](_0xde17('0x14'),_0x365cd4,_0xde17('0x15'));logger[_0xde17('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x365cd4,'request\x20sent',JSON[_0xde17('0x17')](_0x41d482));if(_0x41d482[_0xde17('0x18')]){if(_0x41d482['error'][_0xde17('0x19')]===0x1f4){logger[_0xde17('0x18')](_0xde17('0x14'),_0x365cd4,_0x41d482[_0xde17('0x18')][_0xde17('0x1a')]);return _0x3698ae(_0x41d482[_0xde17('0x18')][_0xde17('0x1a')]);}logger[_0xde17('0x18')](_0xde17('0x14'),_0x365cd4,_0x41d482[_0xde17('0x18')][_0xde17('0x1a')]);return _0x1c09fd(_0x41d482[_0xde17('0x18')][_0xde17('0x1a')]);}else{logger[_0xde17('0x13')](_0xde17('0x14'),_0x365cd4,_0xde17('0x15'));_0x1c09fd(_0x41d482[_0xde17('0x1b')][_0xde17('0x1a')]);}})['catch'](function(_0x3bd98e){logger[_0xde17('0x18')]('MailMessage,\x20%s,\x20%s',_0x365cd4,_0x3bd98e);_0x3698ae(_0x3bd98e);});});}function respondWithResult(_0x6fe42d,_0x1cb2e7){_0x1cb2e7=_0x1cb2e7||0xc8;return function(_0xb0f31e){if(_0xb0f31e){return _0x6fe42d[_0xde17('0x1c')](_0x1cb2e7)[_0xde17('0x1d')](_0xb0f31e);}};}function respondWithFilteredResult(_0x440c52,_0x37f959){return function(_0x4480b2){if(_0x4480b2){var _0x433597=typeof _0x37f959[_0xde17('0x1e')]===_0xde17('0x1f')&&typeof _0x37f959[_0xde17('0x20')]===_0xde17('0x1f');var _0x18d594=_0x4480b2[_0xde17('0x21')];var _0x4b94de=_0x433597?0x0:_0x37f959[_0xde17('0x1e')];var _0x20d7a9=_0x433597?_0x4480b2[_0xde17('0x21')]:_0x37f959[_0xde17('0x1e')]+_0x37f959[_0xde17('0x20')];var _0x79ef8a;if(_0x20d7a9>=_0x18d594){_0x20d7a9=_0x18d594;_0x79ef8a=0xc8;}else{_0x79ef8a=0xce;}_0x440c52[_0xde17('0x1c')](_0x79ef8a);return _0x440c52['set'](_0xde17('0x22'),_0x4b94de+'-'+_0x20d7a9+'/'+_0x18d594)[_0xde17('0x1d')](_0x4480b2);}return null;};}function saveUpdates(_0x46eec7){return function(_0x25b225){if(_0x25b225){return _0x25b225[_0xde17('0x23')](_0x46eec7)['then'](function(_0x3d279e){return _0x3d279e;});}return null;};}function removeEntity(_0x24fc66){return function(_0x2f3d17){if(_0x2f3d17){return _0x2f3d17[_0xde17('0x24')]()['then'](function(){_0x24fc66['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x132842){return function(_0x1593b4){if(!_0x1593b4){_0x132842['sendStatus'](0x194);}return _0x1593b4;};}function handleError(_0x2acab3,_0x3accd0){_0x3accd0=_0x3accd0||0x1f4;return function(_0x20ca73){logger[_0xde17('0x18')](_0x20ca73[_0xde17('0x25')]);if(_0x20ca73[_0xde17('0x26')]){delete _0x20ca73[_0xde17('0x26')];}_0x2acab3['status'](_0x3accd0)[_0xde17('0x27')](_0x20ca73);};}exports[_0xde17('0x28')]=function(_0x1ef8a5,_0x2edc0c){var _0x482d2a={},_0x593989={},_0x1491ca={'count':0x0,'rows':[]};var _0x362bde=_[_0xde17('0x29')](db[_0xde17('0x2a')][_0xde17('0x2b')],function(_0x25db90){return{'name':_0x25db90['fieldName'],'type':_0x25db90['type'][_0xde17('0x2c')]};});_0x593989['model']=_['map'](_0x362bde,_0xde17('0x26'));_0x593989[_0xde17('0x2d')]=_[_0xde17('0x2e')](_0x1ef8a5[_0xde17('0x2d')]);_0x593989[_0xde17('0x2f')]=_[_0xde17('0x30')](_0x593989[_0xde17('0x31')],_0x593989[_0xde17('0x2d')]);_0x482d2a[_0xde17('0x32')]=_['intersection'](_0x593989[_0xde17('0x31')],qs['fields'](_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x33')]));_0x482d2a[_0xde17('0x32')]=_0x482d2a[_0xde17('0x32')]['length']?_0x482d2a[_0xde17('0x32')]:_0x593989['model'];if(!_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x34')](_0xde17('0x35'))){_0x482d2a['limit']=qs[_0xde17('0x20')](_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x20')]);_0x482d2a[_0xde17('0x1e')]=qs[_0xde17('0x1e')](_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x1e')]);}_0x482d2a[_0xde17('0x36')]=qs[_0xde17('0x37')](_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x37')]);_0x482d2a['where']=qs['filters'](_['pick'](_0x1ef8a5[_0xde17('0x2d')],_0x593989[_0xde17('0x2f')]),_0x362bde);if(_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x38')]){_0x482d2a[_0xde17('0x39')]=_['merge'](_0x482d2a[_0xde17('0x39')],{'$or':_[_0xde17('0x29')](_0x362bde,function(_0x2a1eb4){if(_0x2a1eb4[_0xde17('0x3a')]!=='VIRTUAL'){var _0x558d2d={};_0x558d2d[_0x2a1eb4['name']]={'$like':'%'+_0x1ef8a5[_0xde17('0x2d')]['filter']+'%'};return _0x558d2d;}})});}_0x482d2a=_[_0xde17('0x3b')]({},_0x482d2a,_0x1ef8a5[_0xde17('0x3c')]);var _0x5c7938={'where':_0x482d2a[_0xde17('0x39')]};return db['MailMessage'][_0xde17('0x21')](_0x5c7938)[_0xde17('0x12')](function(_0x5ea11f){_0x1491ca[_0xde17('0x21')]=_0x5ea11f;if(_0x1ef8a5[_0xde17('0x2d')][_0xde17('0x3d')]){_0x482d2a[_0xde17('0x3e')]=[{'all':!![]}];}return db[_0xde17('0x2a')][_0xde17('0x3f')](_0x482d2a);})['then'](function(_0x44d0f3){_0x1491ca['rows']=_0x44d0f3;return _0x1491ca;})[_0xde17('0x12')](respondWithFilteredResult(_0x2edc0c,_0x482d2a))[_0xde17('0x40')](handleError(_0x2edc0c,null));};exports[_0xde17('0x41')]=function(_0x139406,_0x13bf87){var _0x45977f={'raw':!![],'where':{'id':_0x139406[_0xde17('0x42')]['id']}},_0x16a7b4={};_0x16a7b4[_0xde17('0x31')]=_[_0xde17('0x2e')](db['MailMessage'][_0xde17('0x2b')]);_0x16a7b4[_0xde17('0x2d')]=_[_0xde17('0x2e')](_0x139406['query']);_0x16a7b4[_0xde17('0x2f')]=_[_0xde17('0x30')](_0x16a7b4[_0xde17('0x31')],_0x16a7b4[_0xde17('0x2d')]);_0x45977f[_0xde17('0x32')]=_['intersection'](_0x16a7b4[_0xde17('0x31')],qs['fields'](_0x139406[_0xde17('0x2d')][_0xde17('0x33')]));_0x45977f[_0xde17('0x32')]=_0x45977f[_0xde17('0x32')][_0xde17('0x43')]?_0x45977f[_0xde17('0x32')]:_0x16a7b4[_0xde17('0x31')];if(_0x139406[_0xde17('0x2d')][_0xde17('0x3d')]){_0x45977f[_0xde17('0x3e')]=[{'all':!![]}];}_0x45977f=_[_0xde17('0x3b')]({},_0x45977f,_0x139406['options']);return db[_0xde17('0x2a')][_0xde17('0x44')](_0x45977f)[_0xde17('0x12')](handleEntityNotFound(_0x13bf87,null))[_0xde17('0x12')](respondWithResult(_0x13bf87,null))[_0xde17('0x40')](handleError(_0x13bf87,null));};exports[_0xde17('0x23')]=function(_0x3f80de,_0x583285){if(_0x3f80de['body']['id']){delete _0x3f80de[_0xde17('0x45')]['id'];}return db['MailMessage'][_0xde17('0x44')]({'where':{'id':_0x3f80de[_0xde17('0x42')]['id']}})['then'](handleEntityNotFound(_0x583285,null))['then'](saveUpdates(_0x3f80de[_0xde17('0x45')],null))[_0xde17('0x12')](respondWithResult(_0x583285,null))['catch'](handleError(_0x583285,null));};exports['destroy']=function(_0x300d55,_0x2065d1){return db['MailMessage'][_0xde17('0x44')]({'where':{'id':_0x300d55[_0xde17('0x42')]['id']}})['then'](handleEntityNotFound(_0x2065d1,null))['then'](removeEntity(_0x2065d1,null))['catch'](handleError(_0x2065d1,null));};exports[_0xde17('0x46')]=function(_0x43b481,_0x2bd326){return db[_0xde17('0x2a')][_0xde17('0x46')]()[_0xde17('0x12')](respondWithResult(_0x2bd326,null))[_0xde17('0x40')](handleError(_0x2bd326,null));};exports[_0xde17('0x47')]=function(_0x554b80,_0x1afc35){return db[_0xde17('0x2a')]['create'](_0x554b80[_0xde17('0x45')])[_0xde17('0x12')](function(_0x4ad3f2){if(_0x4ad3f2){if(_0x4ad3f2[_0xde17('0x48')]===_0xde17('0x49')&&!_0x4ad3f2[_0xde17('0x4a')]){var _0x33511d,_0x420ec0,_0x2b2b30;if(_0x554b80[_0xde17('0x45')]['to']){_0x420ec0=_0x554b80[_0xde17('0x45')]['to'][_0xde17('0x4b')](',')[0x0];}return db[_0xde17('0x4c')][_0xde17('0x4d')]({'where':{'id':_0x4ad3f2[_0xde17('0x4e')]},'include':[{'model':db[_0xde17('0x4f')],'as':_0xde17('0x50'),'include':[{'model':db[_0xde17('0x51')],'as':_0xde17('0x52'),'where':{'email':_0x420ec0},'limit':0x1,'order':[[_0xde17('0x53'),_0xde17('0x54')]]}]},{'model':db[_0xde17('0x55')],'as':_0xde17('0x56'),'raw':!![],'include':[{'model':db[_0xde17('0x57')],'as':_0xde17('0x57'),'raw':!![]}]}]})['then'](function(_0x432138){_0x33511d=_0x432138;if(!_0x33511d||!_0x33511d[_0xde17('0x56')])return;var _0x16668a=_0x33511d[_0xde17('0x58')]();if(_0x554b80[_0xde17('0x45')]['attachments']&&_0x554b80[_0xde17('0x45')][_0xde17('0x59')]['length']){for(var _0x16cf82=0x0;_0x16cf82<_0x554b80[_0xde17('0x45')][_0xde17('0x59')][_0xde17('0x43')];_0x16cf82+=0x1){_0x554b80['body'][_0xde17('0x59')][_0x16cf82]={'filename':_0x554b80[_0xde17('0x45')][_0xde17('0x59')][_0x16cf82]['name'],'path':path[_0xde17('0x5a')](config['root'],_0xde17('0x5b'),_0x554b80[_0xde17('0x45')]['attachments'][_0x16cf82][_0xde17('0x5c')])};}}_0x2b2b30={'account':_0x16668a,'message':_0x554b80[_0xde17('0x45')]};return;})[_0xde17('0x12')](function(){if(_0x33511d[_0xde17('0x50')]){if(_0x33511d[_0xde17('0x50')][_0xde17('0x52')][_0xde17('0x43')]){return _0x33511d['List'][_0xde17('0x52')][0x0];}else{return db[_0xde17('0x51')][_0xde17('0x47')](_[_0xde17('0x5d')](_0x554b80[_0xde17('0x45')],{'firstName':_0x554b80['body']['to'],'email':_0x554b80[_0xde17('0x45')]['to'],'phone':_0x554b80[_0xde17('0x45')]['to'],'ListId':_0x33511d[_0xde17('0x5e')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x2b2b30){return respondWithRpcPromise(_0xde17('0x5f'),_0xde17('0x60'),_0x2b2b30,client9003)[_0xde17('0x12')](function(_0x2410aa){return _0x4ad3f2[_0xde17('0x23')]({'read':!![],'messageId':_0x2410aa['messageId'],'sentAt':moment()[_0xde17('0x61')](_0xde17('0x62'))});})[_0xde17('0x40')](function(_0x23c7f1){logger['error']('%s',JSON[_0xde17('0x17')](_0x23c7f1));return _0x4ad3f2;});}return _0x4ad3f2;});}return _0x4ad3f2;}})[_0xde17('0x12')](respondWithResult(_0x1afc35,0xc9))[_0xde17('0x40')](handleError(_0x1afc35,null));};exports[_0xde17('0x63')]=function(_0x3c59e8,_0x386054){var _0xc7c4bf={'agent':{},'channel':_0xde17('0x64')};if(_0x3c59e8[_0xde17('0x45')]['id']){delete _0x3c59e8['body']['id'];}_0x3c59e8['body'][_0xde17('0x65')]=!![];_0x3c59e8[_0xde17('0x45')][_0xde17('0x66')]=moment()[_0xde17('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x3c59e8[_0xde17('0x45')][_0xde17('0x67')]=_0x3c59e8['body'][_0xde17('0x67')]||_0x3c59e8['user']['id'];_0xc7c4bf[_0xde17('0x68')]['id']=_0x3c59e8[_0xde17('0x45')][_0xde17('0x67')];return db[_0xde17('0x2a')][_0xde17('0x44')]({'where':{'id':_0x3c59e8[_0xde17('0x42')]['id'],'UserId':null}})[_0xde17('0x12')](handleEntityNotFound(_0x386054,null))['then'](saveUpdates(_0x3c59e8[_0xde17('0x45')],null))[_0xde17('0x12')](function(_0xb5bcd7){if(_0xb5bcd7){_0xc7c4bf[_0xde17('0x1a')]=_0xb5bcd7[_0xde17('0x69')]({'plain':!![]});return db[_0xde17('0x6a')][_0xde17('0x44')]({'where':{'id':_0xb5bcd7[_0xde17('0x6b')]}});}return null;})[_0xde17('0x12')](handleEntityNotFound(_0x386054,null))['then'](function(_0x46febb){if(_0x46febb){return _0x46febb[_0xde17('0x23')]({'UserId':_0x3c59e8['body'][_0xde17('0x67')],'read1stAt':_[_0xde17('0x6c')](_0x46febb['read1stAt'])?moment()[_0xde17('0x61')](_0xde17('0x62')):undefined});}return null;})['then'](function(_0x3b7b95){if(_0x3b7b95){_0xc7c4bf[_0xde17('0x6d')]=_0x3b7b95[_0xde17('0x69')]({'plain':!![]});interaction_log[_0xde17('0x13')](_0xde17('0x6e'),_0x3c59e8[_0xde17('0x6f')]['id'],_0x3c59e8[_0xde17('0x6f')][_0xde17('0x26')],_0x3c59e8[_0xde17('0x6f')]['role'],_0xc7c4bf['interaction']['id'],_0x3c59e8[_0xde17('0x45')]?JSON[_0xde17('0x17')](_0x3c59e8[_0xde17('0x45')]):_0xde17('0x70'));return respondWithRpcPromise(_0xde17('0x71'),_0xde17('0x72'),_0xc7c4bf);}return null;})[_0xde17('0x12')](function(_0x1746f9){var _0x4b338c=_0xde17('0x73')+_0x1746f9[_0xde17('0x1a')]['ContactId'];return db[_0xde17('0x74')][_0xde17('0x2d')](_0x4b338c,{'type':db[_0xde17('0x75')][_0xde17('0x76')]['SELECT'],'raw':!![]})['then'](function(_0x336a8a){return _0x336a8a;});})['then'](function(_0x3f3784){if(_0x3f3784){_0xc7c4bf[_0xde17('0x1a')][_0xde17('0x77')]=_0x3f3784[0x0];if(!_0x3c59e8['body'][_0xde17('0x67')])return;return db[_0xde17('0x78')][_0xde17('0x44')]({'where':{'id':_0x3c59e8['body'][_0xde17('0x67')],'role':_0xde17('0x68')},'attributes':['id',_0xde17('0x26'),_0xde17('0x79'),_0xde17('0x7a'),_0xde17('0x7b')],'raw':!![]});}return null;})[_0xde17('0x12')](function(_0xd2b8ab){if(!_0xd2b8ab)return null;_0xc7c4bf[_0xde17('0x1a')]['agent']=_0xd2b8ab;return _0xc7c4bf;})['then'](function(_0x453ae3){if(_0x453ae3){if(_0x3c59e8[_0xde17('0x45')]['manual']){_0xc7c4bf['message'][_0xde17('0x7c')]=util[_0xde17('0x61')](_0xde17('0x7d'),_0x3c59e8[_0xde17('0x6f')]['name']);_0xc7c4bf[_0xde17('0x1a')][_0xde17('0x7e')]=_0xc7c4bf[_0xde17('0x7e')];_0xc7c4bf[_0xde17('0x1a')][_0xde17('0x7f')]=_0xc7c4bf['channel'];_0xc7c4bf[_0xde17('0x1a')][_0xde17('0x80')]=_0xde17('0x63');_0xc7c4bf['message'][_0xde17('0x45')]=htmlToText['fromString'](_0xc7c4bf[_0xde17('0x1a')][_0xde17('0x45')]);return respondWithRpcPromise(_0xde17('0x81'),_0xde17('0x81'),{'event':_0xde17('0x82'),'message':_0xc7c4bf[_0xde17('0x1a')]},client9002)[_0xde17('0x12')](function(){return _0xc7c4bf;});}return _0xc7c4bf;}return null;})[_0xde17('0x12')](respondWithResult(_0x386054,null))[_0xde17('0x40')](handleError(_0x386054,null));};exports[_0xde17('0x83')]=function(_0x13a344,_0xf56495){var _0x3e7412={'agent':{},'channel':_0xde17('0x64')};if(_0x13a344[_0xde17('0x45')]['id']){delete _0x13a344[_0xde17('0x45')]['id'];}_0x13a344[_0xde17('0x45')]['UserId']=_0x13a344[_0xde17('0x45')]['UserId']||_0x13a344['user']['id'];_0x3e7412[_0xde17('0x68')]['id']=_0x13a344[_0xde17('0x45')][_0xde17('0x67')];return db[_0xde17('0x2a')][_0xde17('0x44')]({'where':{'id':_0x13a344[_0xde17('0x42')]['id'],'UserId':null}})[_0xde17('0x12')](handleEntityNotFound(_0xf56495,null))[_0xde17('0x12')](function(_0x5cfc83){if(_0x5cfc83){_0x3e7412[_0xde17('0x1a')]=_0x5cfc83['get']({'plain':!![]});return db[_0xde17('0x6a')][_0xde17('0x44')]({'where':{'id':_0x5cfc83[_0xde17('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0xf56495,null))['then'](function(_0x481bc7){if(_0x481bc7){_0x3e7412['interaction']=_0x481bc7[_0xde17('0x69')]({'plain':!![]});interaction_log[_0xde17('0x13')](_0xde17('0x84'),_0x13a344[_0xde17('0x6f')]['id'],_0x13a344[_0xde17('0x6f')][_0xde17('0x26')],_0x13a344['user'][_0xde17('0x85')],_0x3e7412[_0xde17('0x6d')]['id'],_0x13a344[_0xde17('0x45')]?JSON[_0xde17('0x17')](_0x13a344[_0xde17('0x45')]):_0xde17('0x70'));return respondWithRpcPromise(_0xde17('0x86'),'rejectMessage',_0x3e7412);}return null;})['then'](function(_0x5c0978){var _0x528cd1=_0xde17('0x73')+_0x5c0978[_0xde17('0x1a')]['ContactId'];return db[_0xde17('0x74')][_0xde17('0x2d')](_0x528cd1,{'type':db[_0xde17('0x75')]['QueryTypes'][_0xde17('0x87')],'raw':!![]})[_0xde17('0x12')](function(_0xbb71a9){return _0xbb71a9;});})['then'](function(_0x457eee){if(_0x457eee){_0x3e7412['message'][_0xde17('0x77')]=_0x457eee[0x0];if(!_0x13a344[_0xde17('0x45')][_0xde17('0x67')])return;return db[_0xde17('0x78')][_0xde17('0x44')]({'where':{'id':_0x13a344[_0xde17('0x45')][_0xde17('0x67')],'role':_0xde17('0x68')},'attributes':['id','name',_0xde17('0x79'),'email',_0xde17('0x7b')],'raw':!![]});}return null;})['then'](function(_0x796ca0){if(!_0x796ca0)return null;_0x3e7412[_0xde17('0x1a')][_0xde17('0x68')]=_0x796ca0;return _0x3e7412;})[_0xde17('0x12')](function(_0x339d46){if(_0x339d46){_0x339d46['message'][_0xde17('0x7c')]=util[_0xde17('0x61')](_0xde17('0x7d'),_0x13a344['user'][_0xde17('0x26')]);_0x339d46['message']['channel']=_0x3e7412[_0xde17('0x7e')];_0x339d46[_0xde17('0x1a')][_0xde17('0x7f')]=_0x3e7412[_0xde17('0x7e')];_0x339d46[_0xde17('0x1a')][_0xde17('0x80')]='reject';_0x339d46[_0xde17('0x1a')]['body']=htmlToText[_0xde17('0x88')](_0x3e7412['message'][_0xde17('0x45')]);respondWithRpcPromise(_0xde17('0x81'),_0xde17('0x81'),{'event':_0xde17('0x89'),'message':_0x339d46['message']},client9002);return _0x3e7412;}return null;})[_0xde17('0x12')](respondWithResult(_0xf56495,null))['catch'](handleError(_0xf56495,null));};exports[_0xde17('0x8a')]=function(_0x12d2a3,_0x13d57d){var _0x3bd35f=moment()[_0xde17('0x8b')]()[_0xde17('0x8c')]();var _0x1eac89=path['join'](config[_0xde17('0x8d')],_0xde17('0x8e'),_0xde17('0x8f'),_0xde17('0x90'));var _0x35aefa=path[_0xde17('0x5a')](config[_0xde17('0x8d')],_0xde17('0x8e'),'files',_0xde17('0x59'));var _0x230391=util[_0xde17('0x61')](_0xde17('0x91'),_0x3bd35f);return db[_0xde17('0x2a')]['find']({'where':{'id':_0x12d2a3[_0xde17('0x42')]['id']},'attributes':['id',_0xde17('0x45'),_0xde17('0x92'),'to','cc',_0xde17('0x93'),_0xde17('0x94'),_0xde17('0x95')],'include':_0x12d2a3[_0xde17('0x2d')][_0xde17('0x59')]?[{'model':db[_0xde17('0x96')],'as':'Attachments'}]:undefined})[_0xde17('0x12')](handleEntityNotFound(_0x13d57d,null))[_0xde17('0x12')](function(_0x4b9d39){if(_0x4b9d39){var _0x42e356=_0x4b9d39;var _0xe42c14={'from':_0x42e356[_0xde17('0x92')],'to':_0x42e356['to'],'subject':_0x42e356[_0xde17('0x94')],'html':htmlEntities[_0xde17('0x97')](_0x42e356[_0xde17('0x45')]),'headers':{'Date':moment(_0x42e356[_0xde17('0x95')])[_0xde17('0x61')](_0xde17('0x98'))},'attachments':[]};if(_0x4b9d39['cc']){_0xe42c14[_0xde17('0x99')]['Cc']=_0x4b9d39['cc'];}if(_0x4b9d39['bcc']){_0xe42c14[_0xde17('0x99')][_0xde17('0x9a')]=_0x4b9d39[_0xde17('0x93')];}return new BPromise(function(_0x262ae5,_0x1a9420){if(_0x4b9d39[_0xde17('0x9b')]){for(var _0x4b6ca2=0x0;_0x4b6ca2<_0x4b9d39[_0xde17('0x9b')][_0xde17('0x43')];_0x4b6ca2++){var _0xf3531c=_0x4b9d39[_0xde17('0x9b')][_0x4b6ca2];var _0x5a4993=path[_0xde17('0x5a')](_0x35aefa,_0xf3531c[_0xde17('0x5c')]);if(fs['existsSync'](_0x5a4993)){_0xe42c14[_0xde17('0x59')][_0xde17('0x9c')]({'name':_0xf3531c[_0xde17('0x26')],'contentType':_0xf3531c[_0xde17('0x3a')],'data':fs[_0xde17('0x9d')](_0x5a4993)});}}}emlformat[_0xde17('0x9e')](_0xe42c14,function(_0x20bb8f,_0x3386fd){if(_0x20bb8f)return _0x1a9420(_0x20bb8f);fs[_0xde17('0x9f')](path[_0xde17('0x5a')](_0x1eac89,_0x230391),_0x3386fd);return _0x262ae5(_0x3386fd);});});}})[_0xde17('0x12')](function(_0x528ab1){if(_0x528ab1){return _0x13d57d[_0xde17('0x8a')](path['join'](_0x1eac89,_0x230391),_0x230391,function(_0x6c404d){if(!_0x6c404d)fs[_0xde17('0xa0')](path[_0xde17('0x5a')](_0x1eac89,_0x230391));});}})['catch'](handleError(_0x13d57d,null));}; \ No newline at end of file +var _0x935e=['mail','read','readAt','UserId','user','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','fullname','download','unix','server','files','tmp','from','Attachment','subject','createdAt','Bcc','bcc','Attachments','existsSync','push','build','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','json','offset','undefined','limit','count','set','update','then','sendStatus','stack','name','status','index','map','MailMessage','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','catch','body','destroy','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify'];(function(_0x3e43e5,_0x27cffa){var _0x4caf23=function(_0x29a6b7){while(--_0x29a6b7){_0x3e43e5['push'](_0x3e43e5['shift']());}};_0x4caf23(++_0x27cffa);}(_0x935e,0xd9));var _0xe935=function(_0x3acf43,_0x452964){_0x3acf43=_0x3acf43-0x0;var _0x491d53=_0x935e[_0x3acf43];return _0x491d53;};'use strict';var emlformat=require(_0xe935('0x0'));var moment=require(_0xe935('0x1'));var BPromise=require(_0xe935('0x2'));var util=require(_0xe935('0x3'));var path=require(_0xe935('0x4'));var fs=require('fs');var _=require(_0xe935('0x5'));var Redis=require(_0xe935('0x6'));var htmlToText=require('html-to-text');var qs=require(_0xe935('0x7'));var logger=require(_0xe935('0x8'))(_0xe935('0x9'));var interaction_log=require(_0xe935('0x8'))(_0xe935('0xa'));var config=require(_0xe935('0xb'));var db=require(_0xe935('0xc'))['db'];config[_0xe935('0xd')]=_[_0xe935('0xe')](config[_0xe935('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xe935('0xf'))(new Redis(config[_0xe935('0xd')]));var htmlEntities=require(_0xe935('0x10'));require(_0xe935('0x11'))[_0xe935('0x12')](socket);var jayson=require(_0xe935('0x13'));var client=jayson[_0xe935('0x14')][_0xe935('0x15')]({'port':0x232c});var client9003=jayson['client'][_0xe935('0x15')]({'port':0x232b});var client9002=jayson[_0xe935('0x14')][_0xe935('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1290cf,_0x21ee1,_0x29ed63,_0x1e612b){return new BPromise(function(_0x47299c,_0x232283){var _0x2507e7=_0x1e612b||client;return _0x2507e7[_0xe935('0x16')](_0x1290cf,_0x29ed63)['then'](function(_0xb2975){logger[_0xe935('0x17')](_0xe935('0x18'),_0x21ee1,_0xe935('0x19'));logger[_0xe935('0x1a')](_0xe935('0x1b'),_0x21ee1,_0xe935('0x19'),JSON['stringify'](_0xb2975));if(_0xb2975['error']){if(_0xb2975[_0xe935('0x1c')][_0xe935('0x1d')]===0x1f4){logger['error'](_0xe935('0x18'),_0x21ee1,_0xb2975[_0xe935('0x1c')][_0xe935('0x1e')]);return _0x232283(_0xb2975[_0xe935('0x1c')][_0xe935('0x1e')]);}logger[_0xe935('0x1c')](_0xe935('0x18'),_0x21ee1,_0xb2975[_0xe935('0x1c')][_0xe935('0x1e')]);return _0x47299c(_0xb2975[_0xe935('0x1c')][_0xe935('0x1e')]);}else{logger[_0xe935('0x17')](_0xe935('0x18'),_0x21ee1,_0xe935('0x19'));_0x47299c(_0xb2975['result'][_0xe935('0x1e')]);}})['catch'](function(_0x189195){logger[_0xe935('0x1c')](_0xe935('0x18'),_0x21ee1,_0x189195);_0x232283(_0x189195);});});}function respondWithResult(_0x1ea49b,_0x39750b){_0x39750b=_0x39750b||0xc8;return function(_0x59298d){if(_0x59298d){return _0x1ea49b['status'](_0x39750b)[_0xe935('0x1f')](_0x59298d);}};}function respondWithFilteredResult(_0x9e5611,_0x382104){return function(_0x2c0497){if(_0x2c0497){var _0x443e99=typeof _0x382104[_0xe935('0x20')]===_0xe935('0x21')&&typeof _0x382104[_0xe935('0x22')]===_0xe935('0x21');var _0xafc125=_0x2c0497[_0xe935('0x23')];var _0x5f040d=_0x443e99?0x0:_0x382104[_0xe935('0x20')];var _0x4fbe9e=_0x443e99?_0x2c0497[_0xe935('0x23')]:_0x382104['offset']+_0x382104[_0xe935('0x22')];var _0x136033;if(_0x4fbe9e>=_0xafc125){_0x4fbe9e=_0xafc125;_0x136033=0xc8;}else{_0x136033=0xce;}_0x9e5611['status'](_0x136033);return _0x9e5611[_0xe935('0x24')]('Content-Range',_0x5f040d+'-'+_0x4fbe9e+'/'+_0xafc125)['json'](_0x2c0497);}return null;};}function saveUpdates(_0x120923){return function(_0x58d2ee){if(_0x58d2ee){return _0x58d2ee[_0xe935('0x25')](_0x120923)[_0xe935('0x26')](function(_0x552a5c){return _0x552a5c;});}return null;};}function removeEntity(_0x247a36){return function(_0x136106){if(_0x136106){return _0x136106['destroy']()[_0xe935('0x26')](function(){_0x247a36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f14b2){return function(_0x498bbb){if(!_0x498bbb){_0x5f14b2[_0xe935('0x27')](0x194);}return _0x498bbb;};}function handleError(_0x23df1e,_0x3420d1){_0x3420d1=_0x3420d1||0x1f4;return function(_0x4efa22){logger['error'](_0x4efa22[_0xe935('0x28')]);if(_0x4efa22[_0xe935('0x29')]){delete _0x4efa22[_0xe935('0x29')];}_0x23df1e[_0xe935('0x2a')](_0x3420d1)['send'](_0x4efa22);};}exports[_0xe935('0x2b')]=function(_0x156717,_0x28898a){var _0x2f6293={},_0x5703b3={},_0x4093c4={'count':0x0,'rows':[]};var _0x579648=_[_0xe935('0x2c')](db[_0xe935('0x2d')]['rawAttributes'],function(_0xca2998){return{'name':_0xca2998['fieldName'],'type':_0xca2998[_0xe935('0x2e')][_0xe935('0x2f')]};});_0x5703b3[_0xe935('0x30')]=_[_0xe935('0x2c')](_0x579648,'name');_0x5703b3[_0xe935('0x31')]=_['keys'](_0x156717[_0xe935('0x31')]);_0x5703b3['filters']=_[_0xe935('0x32')](_0x5703b3[_0xe935('0x30')],_0x5703b3[_0xe935('0x31')]);_0x2f6293[_0xe935('0x33')]=_[_0xe935('0x32')](_0x5703b3[_0xe935('0x30')],qs[_0xe935('0x34')](_0x156717[_0xe935('0x31')]['fields']));_0x2f6293[_0xe935('0x33')]=_0x2f6293[_0xe935('0x33')][_0xe935('0x35')]?_0x2f6293[_0xe935('0x33')]:_0x5703b3['model'];if(!_0x156717[_0xe935('0x31')][_0xe935('0x36')](_0xe935('0x37'))){_0x2f6293['limit']=qs[_0xe935('0x22')](_0x156717[_0xe935('0x31')][_0xe935('0x22')]);_0x2f6293['offset']=qs[_0xe935('0x20')](_0x156717['query']['offset']);}_0x2f6293['order']=qs[_0xe935('0x38')](_0x156717[_0xe935('0x31')]['sort']);_0x2f6293[_0xe935('0x39')]=qs[_0xe935('0x3a')](_[_0xe935('0x3b')](_0x156717['query'],_0x5703b3['filters']),_0x579648);if(_0x156717['query'][_0xe935('0x3c')]){_0x2f6293['where']=_[_0xe935('0x3d')](_0x2f6293[_0xe935('0x39')],{'$or':_[_0xe935('0x2c')](_0x579648,function(_0x230e83){if(_0x230e83[_0xe935('0x2e')]!==_0xe935('0x3e')){var _0x258f3e={};_0x258f3e[_0x230e83['name']]={'$like':'%'+_0x156717[_0xe935('0x31')][_0xe935('0x3c')]+'%'};return _0x258f3e;}})});}_0x2f6293=_['merge']({},_0x2f6293,_0x156717[_0xe935('0x3f')]);var _0xde5a3d={'where':_0x2f6293[_0xe935('0x39')]};return db[_0xe935('0x2d')]['count'](_0xde5a3d)[_0xe935('0x26')](function(_0x4d32d9){_0x4093c4[_0xe935('0x23')]=_0x4d32d9;if(_0x156717[_0xe935('0x31')][_0xe935('0x40')]){_0x2f6293[_0xe935('0x41')]=[{'all':!![]}];}return db[_0xe935('0x2d')][_0xe935('0x42')](_0x2f6293);})[_0xe935('0x26')](function(_0x22f709){_0x4093c4[_0xe935('0x43')]=_0x22f709;return _0x4093c4;})[_0xe935('0x26')](respondWithFilteredResult(_0x28898a,_0x2f6293))['catch'](handleError(_0x28898a,null));};exports[_0xe935('0x44')]=function(_0x4a6630,_0x30ff89){var _0x11ea9b={'raw':!![],'where':{'id':_0x4a6630[_0xe935('0x45')]['id']}},_0x125b6e={};_0x125b6e[_0xe935('0x30')]=_['keys'](db[_0xe935('0x2d')][_0xe935('0x46')]);_0x125b6e[_0xe935('0x31')]=_[_0xe935('0x47')](_0x4a6630[_0xe935('0x31')]);_0x125b6e[_0xe935('0x3a')]=_[_0xe935('0x32')](_0x125b6e['model'],_0x125b6e[_0xe935('0x31')]);_0x11ea9b['attributes']=_[_0xe935('0x32')](_0x125b6e[_0xe935('0x30')],qs[_0xe935('0x34')](_0x4a6630['query'][_0xe935('0x34')]));_0x11ea9b[_0xe935('0x33')]=_0x11ea9b[_0xe935('0x33')][_0xe935('0x35')]?_0x11ea9b[_0xe935('0x33')]:_0x125b6e[_0xe935('0x30')];if(_0x4a6630[_0xe935('0x31')][_0xe935('0x40')]){_0x11ea9b[_0xe935('0x41')]=[{'all':!![]}];}_0x11ea9b=_[_0xe935('0x3d')]({},_0x11ea9b,_0x4a6630['options']);return db[_0xe935('0x2d')][_0xe935('0x48')](_0x11ea9b)['then'](handleEntityNotFound(_0x30ff89,null))[_0xe935('0x26')](respondWithResult(_0x30ff89,null))[_0xe935('0x49')](handleError(_0x30ff89,null));};exports['update']=function(_0x983a34,_0xfd593c){if(_0x983a34['body']['id']){delete _0x983a34[_0xe935('0x4a')]['id'];}return db[_0xe935('0x2d')]['find']({'where':{'id':_0x983a34[_0xe935('0x45')]['id']}})['then'](handleEntityNotFound(_0xfd593c,null))[_0xe935('0x26')](saveUpdates(_0x983a34['body'],null))[_0xe935('0x26')](respondWithResult(_0xfd593c,null))[_0xe935('0x49')](handleError(_0xfd593c,null));};exports[_0xe935('0x4b')]=function(_0x323ef5,_0x228059){return db[_0xe935('0x2d')][_0xe935('0x48')]({'where':{'id':_0x323ef5[_0xe935('0x45')]['id']}})[_0xe935('0x26')](handleEntityNotFound(_0x228059,null))[_0xe935('0x26')](removeEntity(_0x228059,null))[_0xe935('0x49')](handleError(_0x228059,null));};exports[_0xe935('0x4c')]=function(_0x57e32c,_0x1dbdac){return db['MailMessage'][_0xe935('0x4c')]()['then'](respondWithResult(_0x1dbdac,null))[_0xe935('0x49')](handleError(_0x1dbdac,null));};exports[_0xe935('0x4d')]=function(_0x47eb6a,_0xdb3362){return db[_0xe935('0x2d')][_0xe935('0x4d')](_0x47eb6a[_0xe935('0x4a')])['then'](function(_0x22f4c5){if(_0x22f4c5){if(_0x22f4c5[_0xe935('0x4e')]==='out'&&!_0x22f4c5[_0xe935('0x4f')]){var _0x968cbe,_0x10c96b,_0x513ed8;if(_0x47eb6a['body']['to']){_0x10c96b=_0x47eb6a[_0xe935('0x4a')]['to'][_0xe935('0x50')](',')[0x0];}return db[_0xe935('0x51')][_0xe935('0x52')]({'where':{'id':_0x22f4c5[_0xe935('0x53')]},'include':[{'model':db[_0xe935('0x54')],'as':_0xe935('0x55'),'include':[{'model':db[_0xe935('0x56')],'as':'Contacts','where':{'email':_0x10c96b},'limit':0x1,'order':[[_0xe935('0x57'),_0xe935('0x58')]]}]},{'model':db[_0xe935('0x59')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe935('0x5a'),'raw':!![]}]}]})[_0xe935('0x26')](function(_0x3f2087){_0x968cbe=_0x3f2087;if(!_0x968cbe||!_0x968cbe[_0xe935('0x5b')])return;var _0x59dc3c=_0x968cbe[_0xe935('0x5c')]();if(_0x47eb6a[_0xe935('0x4a')][_0xe935('0x5d')]&&_0x47eb6a[_0xe935('0x4a')][_0xe935('0x5d')][_0xe935('0x35')]){for(var _0x4bbc5c=0x0;_0x4bbc5c<_0x47eb6a['body'][_0xe935('0x5d')]['length'];_0x4bbc5c+=0x1){_0x47eb6a['body'][_0xe935('0x5d')][_0x4bbc5c]={'filename':_0x47eb6a[_0xe935('0x4a')][_0xe935('0x5d')][_0x4bbc5c]['name'],'path':path[_0xe935('0x5e')](config[_0xe935('0x5f')],_0xe935('0x60'),_0x47eb6a[_0xe935('0x4a')][_0xe935('0x5d')][_0x4bbc5c][_0xe935('0x61')])};}}_0x513ed8={'account':_0x59dc3c,'message':_0x47eb6a['body']};return;})[_0xe935('0x26')](function(){if(_0x968cbe[_0xe935('0x55')]){if(_0x968cbe[_0xe935('0x55')][_0xe935('0x62')]['length']){return _0x968cbe['List'][_0xe935('0x62')][0x0];}else{return db[_0xe935('0x56')]['create'](_[_0xe935('0xe')](_0x47eb6a[_0xe935('0x4a')],{'firstName':_0x47eb6a[_0xe935('0x4a')]['to'],'email':_0x47eb6a['body']['to'],'phone':_0x47eb6a[_0xe935('0x4a')]['to'],'ListId':_0x968cbe[_0xe935('0x63')]}));}}else{throw new Error(_0xe935('0x64'));}})[_0xe935('0x26')](function(){if(_0x513ed8){return respondWithRpcPromise(_0xe935('0x65'),_0xe935('0x66'),_0x513ed8,client9003)[_0xe935('0x26')](function(_0x3ca24e){return _0x22f4c5['update']({'read':!![],'messageId':_0x3ca24e[_0xe935('0x67')],'sentAt':moment()[_0xe935('0x68')](_0xe935('0x69'))});})[_0xe935('0x49')](function(_0x25e26c){logger['error']('%s',JSON[_0xe935('0x6a')](_0x25e26c));return _0x22f4c5;});}return _0x22f4c5;});}return _0x22f4c5;}})[_0xe935('0x26')](respondWithResult(_0xdb3362,0xc9))['catch'](handleError(_0xdb3362,null));};exports['accept']=function(_0x1593b6,_0x4fddc5){var _0x4a8747={'agent':{},'channel':_0xe935('0x6b')};if(_0x1593b6[_0xe935('0x4a')]['id']){delete _0x1593b6[_0xe935('0x4a')]['id'];}_0x1593b6[_0xe935('0x4a')][_0xe935('0x6c')]=!![];_0x1593b6[_0xe935('0x4a')][_0xe935('0x6d')]=moment()[_0xe935('0x68')](_0xe935('0x69'));_0x1593b6[_0xe935('0x4a')]['UserId']=_0x1593b6['body'][_0xe935('0x6e')]||_0x1593b6[_0xe935('0x6f')]['id'];_0x4a8747['agent']['id']=_0x1593b6[_0xe935('0x4a')][_0xe935('0x6e')];return db[_0xe935('0x2d')]['find']({'where':{'id':_0x1593b6[_0xe935('0x45')]['id'],'UserId':null}})[_0xe935('0x26')](handleEntityNotFound(_0x4fddc5,null))[_0xe935('0x26')](saveUpdates(_0x1593b6[_0xe935('0x4a')],null))['then'](function(_0x1c7e68){if(_0x1c7e68){_0x4a8747[_0xe935('0x1e')]=_0x1c7e68[_0xe935('0x70')]({'plain':!![]});return db[_0xe935('0x71')][_0xe935('0x48')]({'where':{'id':_0x1c7e68[_0xe935('0x72')]}});}return null;})[_0xe935('0x26')](handleEntityNotFound(_0x4fddc5,null))[_0xe935('0x26')](function(_0x3661d9){if(_0x3661d9){return _0x3661d9[_0xe935('0x25')]({'UserId':_0x1593b6[_0xe935('0x4a')][_0xe935('0x6e')],'read1stAt':_[_0xe935('0x73')](_0x3661d9[_0xe935('0x74')])?moment()[_0xe935('0x68')](_0xe935('0x69')):undefined});}return null;})[_0xe935('0x26')](function(_0x4b3a67){if(_0x4b3a67){_0x4a8747[_0xe935('0x75')]=_0x4b3a67[_0xe935('0x70')]({'plain':!![]});interaction_log[_0xe935('0x17')](_0xe935('0x76'),_0x1593b6[_0xe935('0x6f')]['id'],_0x1593b6['user'][_0xe935('0x29')],_0x1593b6[_0xe935('0x6f')][_0xe935('0x77')],_0x4a8747['interaction']['id'],_0x1593b6[_0xe935('0x4a')]?JSON[_0xe935('0x6a')](_0x1593b6[_0xe935('0x4a')]):_0xe935('0x78'));return respondWithRpcPromise(_0xe935('0x79'),_0xe935('0x7a'),_0x4a8747);}return null;})['then'](function(_0x26b30d){var _0xc6ee7b=_0xe935('0x7b')+_0x26b30d[_0xe935('0x1e')][_0xe935('0x7c')];return db[_0xe935('0x7d')][_0xe935('0x31')](_0xc6ee7b,{'type':db['Sequelize'][_0xe935('0x7e')][_0xe935('0x7f')],'raw':!![]})[_0xe935('0x26')](function(_0x418a0d){return _0x418a0d;});})[_0xe935('0x26')](function(_0x55eff2){if(_0x55eff2){_0x4a8747[_0xe935('0x1e')][_0xe935('0x80')]=_0x55eff2[0x0];if(!_0x1593b6['body'][_0xe935('0x6e')])return;return db[_0xe935('0x81')][_0xe935('0x48')]({'where':{'id':_0x1593b6[_0xe935('0x4a')][_0xe935('0x6e')],'role':_0xe935('0x82')},'attributes':['id','name','fullname',_0xe935('0x83'),_0xe935('0x84')],'raw':!![]});}return null;})['then'](function(_0x2d23b1){if(!_0x2d23b1)return null;_0x4a8747[_0xe935('0x1e')][_0xe935('0x82')]=_0x2d23b1;return _0x4a8747;})['then'](function(_0xdfeac5){if(_0xdfeac5){if(_0x1593b6[_0xe935('0x4a')]['manual']){_0x4a8747[_0xe935('0x1e')][_0xe935('0x85')]=util['format'](_0xe935('0x86'),_0x1593b6[_0xe935('0x6f')]['name']);_0x4a8747[_0xe935('0x1e')]['channel']=_0x4a8747[_0xe935('0x87')];_0x4a8747[_0xe935('0x1e')][_0xe935('0x88')]=_0x4a8747[_0xe935('0x87')];_0x4a8747['message'][_0xe935('0x89')]='accept';_0x4a8747[_0xe935('0x1e')][_0xe935('0x4a')]=htmlToText[_0xe935('0x8a')](_0x4a8747[_0xe935('0x1e')]['body']);return respondWithRpcPromise(_0xe935('0x8b'),_0xe935('0x8b'),{'event':_0xe935('0x8c'),'message':_0x4a8747[_0xe935('0x1e')]},client9002)[_0xe935('0x26')](function(){return _0x4a8747;});}return _0x4a8747;}return null;})[_0xe935('0x26')](respondWithResult(_0x4fddc5,null))[_0xe935('0x49')](handleError(_0x4fddc5,null));};exports['reject']=function(_0x54ffd1,_0x14b81c){var _0x549687={'agent':{},'channel':_0xe935('0x6b')};if(_0x54ffd1['body']['id']){delete _0x54ffd1[_0xe935('0x4a')]['id'];}_0x54ffd1[_0xe935('0x4a')][_0xe935('0x6e')]=_0x54ffd1[_0xe935('0x4a')][_0xe935('0x6e')]||_0x54ffd1[_0xe935('0x6f')]['id'];_0x549687[_0xe935('0x82')]['id']=_0x54ffd1[_0xe935('0x4a')][_0xe935('0x6e')];return db[_0xe935('0x2d')][_0xe935('0x48')]({'where':{'id':_0x54ffd1[_0xe935('0x45')]['id'],'UserId':null}})[_0xe935('0x26')](handleEntityNotFound(_0x14b81c,null))[_0xe935('0x26')](function(_0x5bc5de){if(_0x5bc5de){_0x549687['message']=_0x5bc5de['get']({'plain':!![]});return db[_0xe935('0x71')][_0xe935('0x48')]({'where':{'id':_0x5bc5de[_0xe935('0x72')]}});}return null;})[_0xe935('0x26')](handleEntityNotFound(_0x14b81c,null))[_0xe935('0x26')](function(_0x3680e2){if(_0x3680e2){_0x549687[_0xe935('0x75')]=_0x3680e2[_0xe935('0x70')]({'plain':!![]});interaction_log['info'](_0xe935('0x8d'),_0x54ffd1[_0xe935('0x6f')]['id'],_0x54ffd1[_0xe935('0x6f')][_0xe935('0x29')],_0x54ffd1[_0xe935('0x6f')][_0xe935('0x77')],_0x549687['interaction']['id'],_0x54ffd1['body']?JSON[_0xe935('0x6a')](_0x54ffd1[_0xe935('0x4a')]):_0xe935('0x78'));return respondWithRpcPromise(_0xe935('0x8e'),_0xe935('0x8f'),_0x549687);}return null;})[_0xe935('0x26')](function(_0x286ad2){var _0x4a0c97=_0xe935('0x7b')+_0x286ad2[_0xe935('0x1e')][_0xe935('0x7c')];return db[_0xe935('0x7d')][_0xe935('0x31')](_0x4a0c97,{'type':db[_0xe935('0x90')][_0xe935('0x7e')]['SELECT'],'raw':!![]})[_0xe935('0x26')](function(_0x171807){return _0x171807;});})['then'](function(_0x372354){if(_0x372354){_0x549687[_0xe935('0x1e')][_0xe935('0x80')]=_0x372354[0x0];if(!_0x54ffd1[_0xe935('0x4a')]['UserId'])return;return db[_0xe935('0x81')][_0xe935('0x48')]({'where':{'id':_0x54ffd1[_0xe935('0x4a')][_0xe935('0x6e')],'role':_0xe935('0x82')},'attributes':['id',_0xe935('0x29'),_0xe935('0x91'),_0xe935('0x83'),'internal'],'raw':!![]});}return null;})[_0xe935('0x26')](function(_0x3bd6cf){if(!_0x3bd6cf)return null;_0x549687['message'][_0xe935('0x82')]=_0x3bd6cf;return _0x549687;})[_0xe935('0x26')](function(_0x39adc1){if(_0x39adc1){_0x39adc1[_0xe935('0x1e')][_0xe935('0x85')]=util[_0xe935('0x68')]('SIP/%s',_0x54ffd1[_0xe935('0x6f')][_0xe935('0x29')]);_0x39adc1[_0xe935('0x1e')][_0xe935('0x87')]=_0x549687[_0xe935('0x87')];_0x39adc1[_0xe935('0x1e')][_0xe935('0x88')]=_0x549687[_0xe935('0x87')];_0x39adc1[_0xe935('0x1e')]['event']='reject';_0x39adc1['message'][_0xe935('0x4a')]=htmlToText[_0xe935('0x8a')](_0x549687['message'][_0xe935('0x4a')]);respondWithRpcPromise(_0xe935('0x8b'),'EventManager',{'event':'rejectmessage','message':_0x39adc1['message']},client9002);return _0x549687;}return null;})[_0xe935('0x26')](respondWithResult(_0x14b81c,null))[_0xe935('0x49')](handleError(_0x14b81c,null));};exports[_0xe935('0x92')]=function(_0x5827f1,_0x5867b7){var _0x2b989a=moment()[_0xe935('0x93')]()['toString']();var _0x49734b=path[_0xe935('0x5e')](config['root'],_0xe935('0x94'),_0xe935('0x95'),_0xe935('0x96'));var _0x543972=path[_0xe935('0x5e')](config[_0xe935('0x5f')],_0xe935('0x94'),_0xe935('0x95'),_0xe935('0x5d'));var _0x1bab32=util[_0xe935('0x68')]('message-%s.eml',_0x2b989a);return db[_0xe935('0x2d')][_0xe935('0x48')]({'where':{'id':_0x5827f1[_0xe935('0x45')]['id']},'attributes':['id','body',_0xe935('0x97'),'to','cc','bcc','subject','createdAt'],'include':_0x5827f1[_0xe935('0x31')][_0xe935('0x5d')]?[{'model':db[_0xe935('0x98')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x5867b7,null))[_0xe935('0x26')](function(_0x5e3bd0){if(_0x5e3bd0){var _0x12dc43=_0x5e3bd0;var _0x4d05cb={'from':_0x12dc43['from'],'to':_0x12dc43['to'],'subject':_0x12dc43[_0xe935('0x99')],'html':htmlEntities['decode'](_0x12dc43[_0xe935('0x4a')]),'headers':{'Date':moment(_0x12dc43[_0xe935('0x9a')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5e3bd0['cc']){_0x4d05cb['headers']['Cc']=_0x5e3bd0['cc'];}if(_0x5e3bd0['bcc']){_0x4d05cb['headers'][_0xe935('0x9b')]=_0x5e3bd0[_0xe935('0x9c')];}return new BPromise(function(_0x154db2,_0x27c5fd){if(_0x5e3bd0['Attachments']){for(var _0x353e84=0x0;_0x353e84<_0x5e3bd0[_0xe935('0x9d')][_0xe935('0x35')];_0x353e84++){var _0x5c749b=_0x5e3bd0[_0xe935('0x9d')][_0x353e84];var _0x2cbd6a=path[_0xe935('0x5e')](_0x543972,_0x5c749b[_0xe935('0x61')]);if(fs[_0xe935('0x9e')](_0x2cbd6a)){_0x4d05cb[_0xe935('0x5d')][_0xe935('0x9f')]({'name':_0x5c749b['name'],'contentType':_0x5c749b[_0xe935('0x2e')],'data':fs['readFileSync'](_0x2cbd6a)});}}}emlformat[_0xe935('0xa0')](_0x4d05cb,function(_0x245f90,_0x4a565a){if(_0x245f90)return _0x27c5fd(_0x245f90);fs['writeFileSync'](path[_0xe935('0x5e')](_0x49734b,_0x1bab32),_0x4a565a);return _0x154db2(_0x4a565a);});});}})['then'](function(_0x17e554){if(_0x17e554){return _0x5867b7[_0xe935('0x92')](path['join'](_0x49734b,_0x1bab32),_0x1bab32,function(_0xa5ca23){if(!_0xa5ca23)fs[_0xe935('0xa1')](path[_0xe935('0x5e')](_0x49734b,_0x1bab32));});}})[_0xe935('0x49')](handleError(_0x5867b7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 93aca7e..55130a7 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 _0xc1e2=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','MailMessage','save'];(function(_0xee076a,_0x1ae9c7){var _0x3705ff=function(_0x39a8ff){while(--_0x39a8ff){_0xee076a['push'](_0xee076a['shift']());}};_0x3705ff(++_0x1ae9c7);}(_0xc1e2,0x1c5));var _0x2c1e=function(_0x53bcd4,_0x25ceba){_0x53bcd4=_0x53bcd4-0x0;var _0x259b9e=_0xc1e2[_0x53bcd4];return _0x259b9e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x2c1e('0x0'))['db'][_0x2c1e('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c1e('0x2'),'afterUpdate':'update','afterDestroy':_0x2c1e('0x3')};function emitEvent(_0x2bee5e){return function(_0x19da8f,_0x5d8eef,_0x4a7096){MailMessageEvents[_0x2c1e('0x4')](_0x2bee5e+':'+_0x19da8f['id'],_0x19da8f);MailMessageEvents[_0x2c1e('0x4')](_0x2bee5e,_0x19da8f);_0x4a7096(null);};}for(var e in events){if(events[_0x2c1e('0x5')](e)){var event=events[e];MailMessage[_0x2c1e('0x6')](e,emitEvent(event));}}module[_0x2c1e('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x84f0=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84f0,0x1c7));var _0x084f=function(_0x5c394b,_0x4ffcb8){_0x5c394b=_0x5c394b-0x0;var _0x7e9306=_0x84f0[_0x5c394b];return _0x7e9306;};'use strict';var EventEmitter=require(_0x084f('0x0'));var MailMessage=require(_0x084f('0x1'))['db'][_0x084f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x084f('0x3')](0x0);var events={'afterCreate':_0x084f('0x4'),'afterUpdate':_0x084f('0x5'),'afterDestroy':_0x084f('0x6')};function emitEvent(_0xadab7e){return function(_0x5c9d64,_0xeb467,_0x3765b2){MailMessageEvents[_0x084f('0x7')](_0xadab7e+':'+_0x5c9d64['id'],_0x5c9d64);MailMessageEvents['emit'](_0xadab7e,_0x5c9d64);_0x3765b2(null);};}for(var e in events){if(events[_0x084f('0x8')](e)){var event=events[e];MailMessage[_0x084f('0x9')](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 9231db6..01bf7a6 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 _0x3bcb=['moment','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','FULLTEXT','body','plainBody','models','get','direction','toLowerCase','out','secret','findOne','catch','utf8mb4','lodash','../../config/logger','api'];(function(_0x30133e,_0x241e57){var _0x3fe39b=function(_0x1e0ea8){while(--_0x1e0ea8){_0x30133e['push'](_0x30133e['shift']());}};_0x3fe39b(++_0x241e57);}(_0x3bcb,0x1eb));var _0xb3bc=function(_0x54abae,_0x154d8f){_0x54abae=_0x54abae-0x0;var _0x297e50=_0x3bcb[_0x54abae];return _0x297e50;};'use strict';var _=require(_0xb3bc('0x0'));var util=require('util');var logger=require(_0xb3bc('0x1'))(_0xb3bc('0x2'));var moment=require(_0xb3bc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0xb3bc('0x4'));var fs=require('fs');var path=require(_0xb3bc('0x5'));var rimraf=require(_0xb3bc('0x6'));var config=require(_0xb3bc('0x7'));var attributes=require(_0xb3bc('0x8'));module[_0xb3bc('0x9')]=function(_0x12645b,_0x10266d){return _0x12645b[_0xb3bc('0xa')](_0xb3bc('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xb3bc('0xc'),'fields':[_0xb3bc('0xc')]},{'name':_0xb3bc('0xd'),'fields':['plainBody','subject'],'type':_0xb3bc('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x194fec,_0x1cfb70,_0xf24ea6){if(_0x194fec[_0xb3bc('0xf')]){_0x194fec[_0xb3bc('0x10')]=htmlToText['fromString'](_0x194fec[_0xb3bc('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xf24ea6(null,_0x1cfb70);},'afterCreate':function(_0x5806d3,_0x98d655,_0x30fe17){var _0x42bee4=_0x12645b[_0xb3bc('0x11')];var _0x5666a1=_0x5806d3[_0xb3bc('0x12')]({'plain':!![]});if(_0x5666a1[_0xb3bc('0x13')][_0xb3bc('0x14')]()==='in'||_0x5666a1[_0xb3bc('0x13')][_0xb3bc('0x14')]()===_0xb3bc('0x15')&&!_0x5666a1[_0xb3bc('0x16')]&&!_['isNil'](_0x5666a1['UserId'])){_0x42bee4['MailInteraction'][_0xb3bc('0x17')]({'where':{'id':_0x5666a1['MailInteractionId']}})['then'](function(_0x32465d){if(_0x32465d){_0x32465d['update']({'lastMsgAt':_0x5666a1['createdAt'],'lastMsgDirection':_0x5666a1[_0xb3bc('0x13')][_0xb3bc('0x14')]()});}})[_0xb3bc('0x18')](function(_0x177ee8){console['error'](_0x177ee8);});}_0x30fe17();}},'charset':_0xb3bc('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x18f5=['messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','then','createdAt','catch','error','utf8mb4','util','api','moment','bluebird','request-promise','html-to-text','exports','define','MailMessage','mail_messages'];(function(_0x5b2309,_0x42468a){var _0x25b322=function(_0x5486e2){while(--_0x5486e2){_0x5b2309['push'](_0x5b2309['shift']());}};_0x25b322(++_0x42468a);}(_0x18f5,0xde));var _0x518f=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x18f5[_0x1f9f37];return _0x21c080;};'use strict';var _=require('lodash');var util=require(_0x518f('0x0'));var logger=require('../../config/logger')(_0x518f('0x1'));var moment=require(_0x518f('0x2'));var BPromise=require(_0x518f('0x3'));var rp=require(_0x518f('0x4'));var htmlToText=require(_0x518f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x518f('0x6')]=function(_0x46c1d6,_0x506881){return _0x46c1d6[_0x518f('0x7')](_0x518f('0x8'),attributes,{'tableName':_0x518f('0x9'),'paranoid':![],'indexes':[{'name':_0x518f('0xa'),'fields':[_0x518f('0xa')]},{'name':_0x518f('0xb'),'fields':[_0x518f('0xc'),'subject'],'type':_0x518f('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4622cc,_0x26beb5,_0x413d2c){if(_0x4622cc[_0x518f('0xe')]){_0x4622cc[_0x518f('0xc')]=htmlToText[_0x518f('0xf')](_0x4622cc[_0x518f('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x413d2c(null,_0x26beb5);},'afterCreate':function(_0x167d7b,_0x3af712,_0x228e67){var _0xe47895=_0x46c1d6['models'];var _0x142703=_0x167d7b['get']({'plain':!![]});if(_0x142703[_0x518f('0x10')][_0x518f('0x11')]()==='in'||_0x142703[_0x518f('0x10')][_0x518f('0x11')]()===_0x518f('0x12')&&!_0x142703[_0x518f('0x13')]&&!_[_0x518f('0x14')](_0x142703[_0x518f('0x15')])){_0xe47895[_0x518f('0x16')][_0x518f('0x17')]({'where':{'id':_0x142703['MailInteractionId']}})[_0x518f('0x18')](function(_0x4e3bb9){if(_0x4e3bb9){_0x4e3bb9['update']({'lastMsgAt':_0x142703[_0x518f('0x19')],'lastMsgDirection':_0x142703['direction'][_0x518f('0x11')]()});}})[_0x518f('0x1a')](function(_0x23ec78){console[_0x518f('0x1b')](_0x23ec78);});}_0x228e67();}},'charset':_0x518f('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b99dfd2..bd2b49f 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 _0x1c9a=['raw','CreateMailMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','MailMessage','create','options'];(function(_0x54c1da,_0x5e991e){var _0x25ddaa=function(_0x4d06cf){while(--_0x4d06cf){_0x54c1da['push'](_0x54c1da['shift']());}};_0x25ddaa(++_0x5e991e);}(_0x1c9a,0x98));var _0xa1c9=function(_0x17520a,_0x5cda84){_0x17520a=_0x17520a-0x0;var _0x590728=_0x1c9a[_0x17520a];return _0x590728;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});config['redis']=_[_0xa1c9('0xa')](config[_0xa1c9('0xb')],{'host':_0xa1c9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa1c9('0xb')]));require(_0xa1c9('0xd'))[_0xa1c9('0xe')](socket);function respondWithRpcPromise(_0x1efbab,_0x493cf6,_0x27b020){return new BPromise(function(_0x4437f2,_0x29e24a){return client[_0xa1c9('0xf')](_0x1efbab,_0x27b020)[_0xa1c9('0x10')](function(_0xbb76ef){logger[_0xa1c9('0x11')](_0xa1c9('0x12'),_0x493cf6,_0xa1c9('0x13'));logger[_0xa1c9('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x493cf6,_0xa1c9('0x13'),JSON[_0xa1c9('0x15')](_0xbb76ef));if(_0xbb76ef[_0xa1c9('0x16')]){if(_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x17')]===0x1f4){logger['error'](_0xa1c9('0x12'),_0x493cf6,_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x18')]);return _0x29e24a(_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x18')]);}logger[_0xa1c9('0x16')](_0xa1c9('0x12'),_0x493cf6,_0xbb76ef[_0xa1c9('0x16')][_0xa1c9('0x18')]);return _0x4437f2(_0xbb76ef[_0xa1c9('0x16')]['message']);}else{logger[_0xa1c9('0x11')](_0xa1c9('0x12'),_0x493cf6,_0xa1c9('0x13'));_0x4437f2(_0xbb76ef['result'][_0xa1c9('0x18')]);}})['catch'](function(_0x21cd35){logger[_0xa1c9('0x16')](_0xa1c9('0x12'),_0x493cf6,_0x21cd35);_0x29e24a(_0x21cd35);});});}exports['CreateMailMessage']=function(_0x3a1110){var _0x46b1e4=this;return new Promise(function(_0x128732,_0x4edf37){return db[_0xa1c9('0x19')][_0xa1c9('0x1a')](_0x3a1110['body'],{'raw':_0x3a1110[_0xa1c9('0x1b')]?_0x3a1110[_0xa1c9('0x1b')][_0xa1c9('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x29f1b1){logger[_0xa1c9('0x11')](_0xa1c9('0x1d'),_0x3a1110);logger[_0xa1c9('0x14')](_0xa1c9('0x1d'),_0x3a1110,JSON['stringify'](_0x29f1b1));_0x128732(_0x29f1b1);})['catch'](function(_0x200749){logger['error'](_0xa1c9('0x1d'),_0x200749[_0xa1c9('0x18')],_0x3a1110);_0x4edf37(_0x46b1e4[_0xa1c9('0x16')](0x1f4,_0x200749[_0xa1c9('0x18')]));});});}; \ No newline at end of file +var _0xfff0=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','body','options','CreateMailMessage','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x370130,_0x450a35){var _0xf437a3=function(_0x4e83d7){while(--_0x4e83d7){_0x370130['push'](_0x370130['shift']());}};_0xf437a3(++_0x450a35);}(_0xfff0,0x139));var _0x0fff=function(_0x204453,_0x30bcb5){_0x204453=_0x204453-0x0;var _0x59eb35=_0xfff0[_0x204453];return _0x59eb35;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});config[_0x0fff('0xa')]=_['defaults'](config[_0x0fff('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0xb'))(new Redis(config['redis']));require(_0x0fff('0xc'))[_0x0fff('0xd')](socket);function respondWithRpcPromise(_0x4cc3f3,_0x227d28,_0x377b2f){return new BPromise(function(_0x1de923,_0x289e01){return client[_0x0fff('0xe')](_0x4cc3f3,_0x377b2f)[_0x0fff('0xf')](function(_0x363c0d){logger[_0x0fff('0x10')](_0x0fff('0x11'),_0x227d28,_0x0fff('0x12'));logger[_0x0fff('0x13')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x227d28,_0x0fff('0x12'),JSON['stringify'](_0x363c0d));if(_0x363c0d[_0x0fff('0x14')]){if(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x15')]===0x1f4){logger[_0x0fff('0x14')]('MailMessage,\x20%s,\x20%s',_0x227d28,_0x363c0d['error'][_0x0fff('0x16')]);return _0x289e01(_0x363c0d['error']['message']);}logger['error'](_0x0fff('0x11'),_0x227d28,_0x363c0d[_0x0fff('0x14')]['message']);return _0x1de923(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x227d28,'request\x20sent');_0x1de923(_0x363c0d[_0x0fff('0x17')][_0x0fff('0x16')]);}})[_0x0fff('0x18')](function(_0x3762dc){logger[_0x0fff('0x14')](_0x0fff('0x11'),_0x227d28,_0x3762dc);_0x289e01(_0x3762dc);});});}exports['CreateMailMessage']=function(_0x44a54a){var _0x136520=this;return new Promise(function(_0x48e6f9,_0x49d211){return db['MailMessage'][_0x0fff('0x19')](_0x44a54a[_0x0fff('0x1a')],{'raw':_0x44a54a[_0x0fff('0x1b')]?_0x44a54a[_0x0fff('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0fff('0xf')](function(_0x2f8665){logger[_0x0fff('0x10')](_0x0fff('0x1c'),_0x44a54a);logger[_0x0fff('0x13')](_0x0fff('0x1c'),_0x44a54a,JSON['stringify'](_0x2f8665));_0x48e6f9(_0x2f8665);})[_0x0fff('0x18')](function(_0x29f702){logger[_0x0fff('0x14')](_0x0fff('0x1c'),_0x29f702[_0x0fff('0x16')],_0x44a54a);_0x49d211(_0x136520[_0x0fff('0x14')](0x1f4,_0x29f702['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index ea57d55..07b91ca 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 _0x727a=['update','emit','register','mailMessage:','./mailMessage.events','remove'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x727a,0x1f0));var _0xa727=function(_0x28a196,_0x349ebf){_0x28a196=_0x28a196-0x0;var _0x4ccb77=_0x727a[_0x28a196];return _0x4ccb77;};'use strict';var MailMessageEvents=require(_0xa727('0x0'));var events=['save',_0xa727('0x1'),_0xa727('0x2')];function createListener(_0x40adb8,_0x109975){return function(_0x2f3ab2){_0x109975[_0xa727('0x3')](_0x40adb8,_0x2f3ab2);};}function removeListener(_0x30b260,_0x18489c){return function(){MailMessageEvents['removeListener'](_0x30b260,_0x18489c);};}exports[_0xa727('0x4')]=function(_0x36b79a){for(var _0x18a608=0x0,_0x223816=events['length'];_0x18a608<_0x223816;_0x18a608++){var _0x4a616f=events[_0x18a608];var _0x269161=createListener(_0xa727('0x5')+_0x4a616f,_0x36b79a);MailMessageEvents['on'](_0x4a616f,_0x269161);}}; \ No newline at end of file +var _0x4d88=['update','emit','removeListener','register','mailMessage:','./mailMessage.events','save','remove'];(function(_0x9c4f57,_0x306efb){var _0x117937=function(_0x2193aa){while(--_0x2193aa){_0x9c4f57['push'](_0x9c4f57['shift']());}};_0x117937(++_0x306efb);}(_0x4d88,0x195));var _0x84d8=function(_0x20e5d4,_0x4ae460){_0x20e5d4=_0x20e5d4-0x0;var _0x54d52a=_0x4d88[_0x20e5d4];return _0x54d52a;};'use strict';var MailMessageEvents=require(_0x84d8('0x0'));var events=[_0x84d8('0x1'),_0x84d8('0x2'),_0x84d8('0x3')];function createListener(_0x3c0f63,_0x405420){return function(_0xdd5825){_0x405420[_0x84d8('0x4')](_0x3c0f63,_0xdd5825);};}function removeListener(_0x2b4832,_0x141c6a){return function(){MailMessageEvents[_0x84d8('0x5')](_0x2b4832,_0x141c6a);};}exports[_0x84d8('0x6')]=function(_0x38af88){for(var _0xee3556=0x0,_0xdda114=events['length'];_0xee3556<_0xdda114;_0xee3556++){var _0x55ffd4=events[_0xee3556];var _0x51f65c=createListener(_0x84d8('0x7')+_0x55ffd4,_0x38af88);MailMessageEvents['on'](_0x55ffd4,_0x51f65c);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 463b35c..a436d6a 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 _0x4f9b=['put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents'];(function(_0x1a7774,_0x426640){var _0x3347d2=function(_0x4ce6ac){while(--_0x4ce6ac){_0x1a7774['push'](_0x1a7774['shift']());}};_0x3347d2(++_0x426640);}(_0x4f9b,0xdf));var _0xb4f9=function(_0x16578c,_0x24fa12){_0x16578c=_0x16578c-0x0;var _0x7a6990=_0x4f9b[_0x16578c];return _0x7a6990;};'use strict';var multer=require(_0xb4f9('0x0'));var util=require(_0xb4f9('0x1'));var path=require(_0xb4f9('0x2'));var timeout=require(_0xb4f9('0x3'));var express=require('express');var router=express[_0xb4f9('0x4')]();var fs_extra=require(_0xb4f9('0x5'));var auth=require(_0xb4f9('0x6'));var interaction=require(_0xb4f9('0x7'));var config=require(_0xb4f9('0x8'));var controller=require(_0xb4f9('0x9'));router[_0xb4f9('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb4f9('0xa')](_0xb4f9('0xb'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0xd')]);router['get'](_0xb4f9('0xe'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0xf')]);router['get'](_0xb4f9('0x10'),auth[_0xb4f9('0xc')](),controller['getMembers']);router[_0xb4f9('0xa')](_0xb4f9('0x11'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x12')]);router[_0xb4f9('0xa')](_0xb4f9('0x13'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x14')]);router[_0xb4f9('0x15')]('/',auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x16')]);router[_0xb4f9('0x15')]('/:id/teams',auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x17')]);router[_0xb4f9('0x15')](_0xb4f9('0x13'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x18')]);router[_0xb4f9('0x19')](_0xb4f9('0xe'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x1a')]);router[_0xb4f9('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xb4f9('0x1c')]);router[_0xb4f9('0x1b')](_0xb4f9('0x11'),auth['isAuthenticated'](),controller[_0xb4f9('0x1d')]);router[_0xb4f9('0x1b')](_0xb4f9('0x13'),auth[_0xb4f9('0xc')](),controller[_0xb4f9('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x44cb=['destroy','removeTeams','removeAgents','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','update','delete','/:id'];(function(_0x276d17,_0x5e1e1f){var _0x2ce475=function(_0x534325){while(--_0x534325){_0x276d17['push'](_0x276d17['shift']());}};_0x2ce475(++_0x5e1e1f);}(_0x44cb,0x12f));var _0xb44c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x44cb[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xb44c('0x0'));var path=require(_0xb44c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb44c('0x2')]();var fs_extra=require(_0xb44c('0x3'));var auth=require(_0xb44c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb44c('0x5'));var controller=require('./mailQueue.controller');router[_0xb44c('0x6')]('/',auth['isAuthenticated'](),controller[_0xb44c('0x7')]);router[_0xb44c('0x6')]('/describe',auth[_0xb44c('0x8')](),controller[_0xb44c('0x9')]);router[_0xb44c('0x6')]('/:id',auth[_0xb44c('0x8')](),controller[_0xb44c('0xa')]);router[_0xb44c('0x6')]('/:id/members',auth['isAuthenticated'](),controller[_0xb44c('0xb')]);router[_0xb44c('0x6')](_0xb44c('0xc'),auth[_0xb44c('0x8')](),controller['getTeams']);router[_0xb44c('0x6')](_0xb44c('0xd'),auth['isAuthenticated'](),controller[_0xb44c('0xe')]);router[_0xb44c('0xf')]('/',auth[_0xb44c('0x8')](),controller[_0xb44c('0x10')]);router['post'](_0xb44c('0xc'),auth[_0xb44c('0x8')](),controller[_0xb44c('0x11')]);router['post'](_0xb44c('0xd'),auth[_0xb44c('0x8')](),controller['addAgents']);router[_0xb44c('0x12')]('/:id',auth[_0xb44c('0x8')](),controller[_0xb44c('0x13')]);router[_0xb44c('0x14')](_0xb44c('0x15'),auth[_0xb44c('0x8')](),controller[_0xb44c('0x16')]);router[_0xb44c('0x14')](_0xb44c('0xc'),auth[_0xb44c('0x8')](),controller[_0xb44c('0x17')]);router[_0xb44c('0x14')](_0xb44c('0xd'),auth[_0xb44c('0x8')](),controller[_0xb44c('0x18')]);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 23e1b6c..0c26510 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 _0xa043=['exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x3ef314,_0x4a3afd){var _0x4a6455=function(_0x479be9){while(--_0x479be9){_0x3ef314['push'](_0x3ef314['shift']());}};_0x4a6455(++_0x4a3afd);}(_0xa043,0x72));var _0x3a04=function(_0x6f942d,_0xd9244d){_0x6f942d=_0x6f942d-0x0;var _0x547805=_0xa043[_0x6f942d];return _0x547805;};'use strict';var Sequelize=require('sequelize');module[_0x3a04('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x3a04('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3a04('0x2')]},'timeout':{'type':Sequelize[_0x3a04('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3a04('0x4')](_0x3a04('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xf16f=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x2c5009,_0x63505f){var _0x40b7f9=function(_0x3921bf){while(--_0x3921bf){_0x2c5009['push'](_0x2c5009['shift']());}};_0x40b7f9(++_0x63505f);}(_0xf16f,0xee));var _0xff16=function(_0x5d4508,_0x102d84){_0x5d4508=_0x5d4508-0x0;var _0xa956c5=_0xf16f[_0x5d4508];return _0xa956c5;};'use strict';var Sequelize=require(_0xff16('0x0'));module[_0xff16('0x1')]={'name':{'type':Sequelize[_0xff16('0x2')],'unique':_0xff16('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xff16('0x2')]},'timeout':{'type':Sequelize[_0xff16('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xff16('0x5'),_0xff16('0x6'),_0xff16('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 8238fdf..31580f4 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 _0x3c03=['addTeams','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','includes','all','union','compact','value','transaction','isEmpty','userMailQueue:remove','addAgents','omit','removeAgents','isArray','bluebird','util','lodash','squel','ioredis','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','undefined','limit','offset','set','update','then','destroy','get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','count','include','query','findAll','catch','show','params','model','keys','MailQueue','filters','intersection','attributes','fields','length','merge','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','find','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','sort','where','pick','MailQueueId','filter','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','rows','format','SIP','Team','getTeams','nolimit'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0x3c03,0x114));var _0x33c0=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x3c03[_0x1477ef];return _0x164acd;};'use strict';var BPromise=require(_0x33c0('0x0'));var util=require(_0x33c0('0x1'));var _=require(_0x33c0('0x2'));var squel=require(_0x33c0('0x3'));var Redis=require(_0x33c0('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x33c0('0x5'));var config=require(_0x33c0('0x6'));var db=require(_0x33c0('0x7'))['db'];config['redis']=_[_0x33c0('0x8')](config[_0x33c0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x33c0('0xa'))(new Redis(config['redis']));require(_0x33c0('0xb'))[_0x33c0('0xc')](socket);function respondWithStatusCode(_0x447511,_0x259832){_0x259832=_0x259832||0xcc;return function(_0x6c41d4){if(_0x6c41d4){return _0x447511[_0x33c0('0xd')](_0x259832);}return _0x447511[_0x33c0('0xe')](_0x259832)['end']();};}function respondWithResult(_0x583659,_0x467aef){_0x467aef=_0x467aef||0xc8;return function(_0x340923){if(_0x340923){return _0x583659['status'](_0x467aef)[_0x33c0('0xf')](_0x340923);}};}function respondWithFilteredResult(_0x1362d6,_0x228ef3){return function(_0x31c838){if(_0x31c838){var _0xac3320=typeof _0x228ef3['offset']===_0x33c0('0x10')&&typeof _0x228ef3[_0x33c0('0x11')]===_0x33c0('0x10');var _0x2b94ba=_0x31c838['count'];var _0x34d1ad=_0xac3320?0x0:_0x228ef3[_0x33c0('0x12')];var _0x5d499e=_0xac3320?_0x31c838['count']:_0x228ef3[_0x33c0('0x12')]+_0x228ef3[_0x33c0('0x11')];var _0x2f2248;if(_0x5d499e>=_0x2b94ba){_0x5d499e=_0x2b94ba;_0x2f2248=0xc8;}else{_0x2f2248=0xce;}_0x1362d6['status'](_0x2f2248);return _0x1362d6[_0x33c0('0x13')]('Content-Range',_0x34d1ad+'-'+_0x5d499e+'/'+_0x2b94ba)[_0x33c0('0xf')](_0x31c838);}return null;};}function saveUpdates(_0x365483){return function(_0x33bcd0){if(_0x33bcd0){return _0x33bcd0[_0x33c0('0x14')](_0x365483)[_0x33c0('0x15')](function(_0x44a3ce){return _0x44a3ce;});}return null;};}function removeEntity(_0x8cbe6c){return function(_0x2f0962){if(_0x2f0962){return _0x2f0962[_0x33c0('0x16')]()[_0x33c0('0x15')](function(){var _0x3d15d7=_0x2f0962[_0x33c0('0x17')]({'plain':!![]});var _0x14c639='MailQueues';return db[_0x33c0('0x18')][_0x33c0('0x16')]({'where':{'type':_0x14c639,'resourceId':_0x3d15d7['id']}})[_0x33c0('0x15')](function(){return _0x2f0962;});})[_0x33c0('0x15')](function(){_0x8cbe6c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x499295){return function(_0x3e170c){if(!_0x3e170c){_0x499295[_0x33c0('0xd')](0x194);}return _0x3e170c;};}function handleError(_0x4e9cc,_0x16f066){_0x16f066=_0x16f066||0x1f4;return function(_0x2b2b91){logger[_0x33c0('0x19')](_0x2b2b91['stack']);if(_0x2b2b91[_0x33c0('0x1a')]){delete _0x2b2b91['name'];}_0x4e9cc['status'](_0x16f066)[_0x33c0('0x1b')](_0x2b2b91);};}exports[_0x33c0('0x1c')]=function(_0x3699d2,_0x59754d){var _0x1269ce={};var _0x43e77c={'count':0x0,'rows':[]};var _0x475df8=_[_0x33c0('0x1d')](db['MailQueue'][_0x33c0('0x1e')],function(_0x1c65ff){return{'name':_0x1c65ff[_0x33c0('0x1f')],'type':_0x1c65ff[_0x33c0('0x20')][_0x33c0('0x21')]};});_0x1269ce=qs['getOptions'](_0x475df8,_0x3699d2);var _0x59fb11={'where':_0x1269ce['where']};return db['MailQueue']['count'](_0x59fb11)['then'](function(_0x2b8998){_0x43e77c[_0x33c0('0x22')]=_0x2b8998;_0x1269ce[_0x33c0('0x23')]=qs['include'](_0x3699d2[_0x33c0('0x24')]);return db['MailQueue'][_0x33c0('0x25')](_0x1269ce);})['then'](function(_0x2abc3d){_0x43e77c['rows']=_0x2abc3d;return _0x43e77c;})[_0x33c0('0x15')](respondWithFilteredResult(_0x59754d,_0x1269ce))[_0x33c0('0x26')](handleError(_0x59754d,null));};exports[_0x33c0('0x27')]=function(_0x282620,_0x4d86d1){var _0x55aff8={'raw':!![],'where':{'id':_0x282620[_0x33c0('0x28')]['id']}},_0x37f6a2={};_0x37f6a2[_0x33c0('0x29')]=_[_0x33c0('0x2a')](db[_0x33c0('0x2b')][_0x33c0('0x1e')]);_0x37f6a2[_0x33c0('0x24')]=_[_0x33c0('0x2a')](_0x282620[_0x33c0('0x24')]);_0x37f6a2[_0x33c0('0x2c')]=_[_0x33c0('0x2d')](_0x37f6a2['model'],_0x37f6a2[_0x33c0('0x24')]);_0x55aff8[_0x33c0('0x2e')]=_[_0x33c0('0x2d')](_0x37f6a2[_0x33c0('0x29')],qs[_0x33c0('0x2f')](_0x282620[_0x33c0('0x24')]['fields']));_0x55aff8[_0x33c0('0x2e')]=_0x55aff8[_0x33c0('0x2e')][_0x33c0('0x30')]?_0x55aff8[_0x33c0('0x2e')]:_0x37f6a2[_0x33c0('0x29')];if(_0x282620[_0x33c0('0x24')]['includeAll']){_0x55aff8[_0x33c0('0x23')]=[{'all':!![]}];}_0x55aff8=_[_0x33c0('0x31')]({},_0x55aff8,_0x282620[_0x33c0('0x32')]);return db['MailQueue']['find'](_0x55aff8)['then'](handleEntityNotFound(_0x4d86d1,null))['then'](respondWithResult(_0x4d86d1,null))[_0x33c0('0x26')](handleError(_0x4d86d1,null));};exports[_0x33c0('0x33')]=function(_0x320c08,_0x5b7f31){return db['MailQueue']['create'](_0x320c08['body'],{})[_0x33c0('0x15')](function(_0x5f540c){var _0x5a3497=_0x320c08[_0x33c0('0x34')]['get']({'plain':!![]});if(!_0x5a3497)throw new Error(_0x33c0('0x35'));if(_0x5a3497[_0x33c0('0x36')]===_0x33c0('0x34')){var _0xda4637=_0x5f540c[_0x33c0('0x17')]({'plain':!![]});var _0x46abef=_0x33c0('0x37');return db[_0x33c0('0x38')][_0x33c0('0x39')]({'where':{'name':_0x46abef,'userProfileId':_0x5a3497[_0x33c0('0x3a')]},'raw':!![]})['then'](function(_0x4fe1c6){if(_0x4fe1c6&&_0x4fe1c6[_0x33c0('0x3b')]===0x0){return db[_0x33c0('0x18')][_0x33c0('0x33')]({'name':_0xda4637['name'],'resourceId':_0xda4637['id'],'type':_0x4fe1c6['name'],'sectionId':_0x4fe1c6['id']},{})[_0x33c0('0x15')](function(){return _0x5f540c;});}else{return _0x5f540c;}})['catch'](function(_0x4c484d){logger[_0x33c0('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c484d);throw _0x4c484d;});}return _0x5f540c;})[_0x33c0('0x15')](respondWithResult(_0x5b7f31,0xc9))[_0x33c0('0x26')](handleError(_0x5b7f31,null));};exports[_0x33c0('0x14')]=function(_0x2f2c54,_0x34ed00){if(_0x2f2c54['body']['id']){delete _0x2f2c54['body']['id'];}return db['MailQueue']['find']({'where':{'id':_0x2f2c54['params']['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x34ed00,null))[_0x33c0('0x15')](saveUpdates(_0x2f2c54[_0x33c0('0x3c')],null))['then'](respondWithResult(_0x34ed00,null))[_0x33c0('0x26')](handleError(_0x34ed00,null));};exports[_0x33c0('0x16')]=function(_0x411877,_0x1e327a){return db[_0x33c0('0x2b')][_0x33c0('0x39')]({'where':{'id':_0x411877[_0x33c0('0x28')]['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x1e327a,null))['then'](removeEntity(_0x1e327a,null))[_0x33c0('0x26')](handleError(_0x1e327a,null));};exports[_0x33c0('0x3d')]=function(_0x35cf4d,_0x5c5b5c){return db[_0x33c0('0x2b')][_0x33c0('0x3d')]()[_0x33c0('0x15')](respondWithResult(_0x5c5b5c,null))['catch'](handleError(_0x5c5b5c,null));};exports[_0x33c0('0x3e')]=function(_0x4d26ba,_0x592e55){var _0x4e783f={'raw':!![],'where':{}},_0x1a67b9={},_0x225ed5;return db['MailQueue'][_0x33c0('0x3f')]({'where':{'id':_0x4d26ba['params']['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x592e55,null))[_0x33c0('0x15')](function(_0x145e76){if(_0x145e76){_0x225ed5=_0x145e76['get']({'plain':!![]});_0x1a67b9['model']=_[_0x33c0('0x2a')](db[_0x33c0('0x40')][_0x33c0('0x1e')]);_0x1a67b9[_0x33c0('0x24')]=_[_0x33c0('0x2a')](_0x4d26ba[_0x33c0('0x24')]);_0x1a67b9['filters']=_['intersection'](_0x1a67b9[_0x33c0('0x29')],_0x1a67b9[_0x33c0('0x24')]);_0x4e783f[_0x33c0('0x2e')]=_[_0x33c0('0x2d')](_0x1a67b9[_0x33c0('0x29')],qs[_0x33c0('0x2f')](_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x2f')]));_0x4e783f['attributes']=_0x4e783f['attributes'][_0x33c0('0x30')]?_0x4e783f['attributes']:_0x1a67b9[_0x33c0('0x29')];if(!_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x41')]('nolimit')){_0x4e783f['limit']=qs[_0x33c0('0x11')](_0x4d26ba['query']['limit']);_0x4e783f[_0x33c0('0x12')]=qs[_0x33c0('0x12')](_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x12')]);}_0x4e783f[_0x33c0('0x42')]=qs[_0x33c0('0x43')](_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x43')]);_0x4e783f[_0x33c0('0x44')]=qs[_0x33c0('0x2c')](_[_0x33c0('0x45')](_0x4d26ba['query'],_0x1a67b9[_0x33c0('0x2c')]));_0x4e783f[_0x33c0('0x44')][_0x33c0('0x46')]=_0x145e76['id'];if(_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x47')]){_0x4e783f['where']=_[_0x33c0('0x31')](_0x4e783f['where'],{'$or':_[_0x33c0('0x1d')](_0x4e783f[_0x33c0('0x2e')],function(_0x939360){var _0x701b91={};_0x701b91[_0x939360]={'$like':'%'+_0x4d26ba[_0x33c0('0x24')][_0x33c0('0x47')]+'%'};return _0x701b91;})});}_0x4e783f=_[_0x33c0('0x31')]({},_0x4e783f,_0x4d26ba[_0x33c0('0x32')]);return db[_0x33c0('0x40')][_0x33c0('0x25')](_0x4e783f);}})[_0x33c0('0x15')](function(_0x9bc402){if(_0x9bc402){return db[_0x33c0('0x48')][_0x33c0('0x49')]({'where':{'id':_[_0x33c0('0x1d')](_0x9bc402,_0x33c0('0x4a')),'role':'agent'},'attributes':['id',_0x33c0('0x1a'),_0x33c0('0x4b'),_0x33c0('0x4c'),_0x33c0('0x4d')]});}})[_0x33c0('0x15')](function(_0x124fb7){if(_0x124fb7){return{'count':_0x124fb7[_0x33c0('0x22')],'rows':_[_0x33c0('0x1d')](_0x124fb7[_0x33c0('0x4e')],function(_0xad1edf){return{'membername':_0xad1edf[_0x33c0('0x1a')],'UserId':_0xad1edf['id'],'queue_name':_0x225ed5[_0x33c0('0x1a')],'MailQueueId':_0x225ed5['id'],'interface':util[_0x33c0('0x4f')]('%s/%s',_0x33c0('0x50'),_0xad1edf[_0x33c0('0x1a')]),'penalty':0x0,'paused':_0xad1edf['mailPause'],'createdAt':_0xad1edf[_0x33c0('0x4d')],'updatedAt':_0xad1edf[_0x33c0('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x33c0('0x15')](respondWithFilteredResult(_0x592e55,_0x4e783f))['catch'](handleError(_0x592e55,null));};exports['getTeams']=function(_0x45d190,_0x319f09){var _0x5e6a3f={};var _0xe3ad90={};var _0x2c4294;var _0x155cc6;return db['MailQueue'][_0x33c0('0x3f')]({'where':{'id':_0x45d190[_0x33c0('0x28')]['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x319f09,null))[_0x33c0('0x15')](function(_0x9734bd){if(_0x9734bd){_0x2c4294=_0x9734bd;_0xe3ad90[_0x33c0('0x29')]=_[_0x33c0('0x2a')](db[_0x33c0('0x51')][_0x33c0('0x1e')]);_0xe3ad90['query']=_[_0x33c0('0x2a')](_0x45d190[_0x33c0('0x24')]);_0xe3ad90['filters']=_[_0x33c0('0x2d')](_0xe3ad90[_0x33c0('0x29')],_0xe3ad90[_0x33c0('0x24')]);_0x5e6a3f['attributes']=_[_0x33c0('0x2d')](_0xe3ad90[_0x33c0('0x29')],qs[_0x33c0('0x2f')](_0x45d190[_0x33c0('0x24')][_0x33c0('0x2f')]));_0x5e6a3f[_0x33c0('0x2e')]=_0x5e6a3f[_0x33c0('0x2e')]['length']?_0x5e6a3f[_0x33c0('0x2e')]:_0xe3ad90[_0x33c0('0x29')];_0x5e6a3f[_0x33c0('0x42')]=qs[_0x33c0('0x43')](_0x45d190['query']['sort']);_0x5e6a3f['where']=qs[_0x33c0('0x2c')](_[_0x33c0('0x45')](_0x45d190[_0x33c0('0x24')],_0xe3ad90[_0x33c0('0x2c')]));if(_0x45d190['query'][_0x33c0('0x47')]){_0x5e6a3f[_0x33c0('0x44')]=_[_0x33c0('0x31')](_0x5e6a3f['where'],{'$or':_['map'](_0x5e6a3f[_0x33c0('0x2e')],function(_0x166f66){var _0x422fbe={};_0x422fbe[_0x166f66]={'$like':'%'+_0x45d190['query'][_0x33c0('0x47')]+'%'};return _0x422fbe;})});}_0x5e6a3f=_[_0x33c0('0x31')]({},_0x5e6a3f,_0x45d190[_0x33c0('0x32')]);return _0x2c4294[_0x33c0('0x52')](_0x5e6a3f);}})[_0x33c0('0x15')](function(_0x4d3cfc){if(_0x4d3cfc){_0x155cc6=_0x4d3cfc['length'];if(!_0x45d190[_0x33c0('0x24')][_0x33c0('0x41')](_0x33c0('0x53'))){_0x5e6a3f[_0x33c0('0x11')]=qs[_0x33c0('0x11')](_0x45d190[_0x33c0('0x24')][_0x33c0('0x11')]);_0x5e6a3f[_0x33c0('0x12')]=qs['offset'](_0x45d190[_0x33c0('0x24')][_0x33c0('0x12')]);}return _0x2c4294['getTeams'](_0x5e6a3f);}})[_0x33c0('0x15')](function(_0x105a3b){if(_0x105a3b){return _0x105a3b?{'count':_0x155cc6,'rows':_0x105a3b}:null;}})[_0x33c0('0x15')](respondWithResult(_0x319f09,null))[_0x33c0('0x26')](handleError(_0x319f09,null));};exports[_0x33c0('0x54')]=function(_0x2128db,_0x4a4c67){var _0x944b79=_0x2128db[_0x33c0('0x3c')]['ids'];return db['Team']['findAll']({'where':{'id':_0x944b79},'attributes':['id'],'include':[{'model':db[_0x33c0('0x48')],'as':_0x33c0('0x55'),'attributes':['id','name',_0x33c0('0x56'),_0x33c0('0x57'),_0x33c0('0x58')],'raw':!![]}]})[_0x33c0('0x15')](function(_0x56f43d){if(_0x56f43d){var _0x33988f=_[_0x33c0('0x59')](_0x56f43d,function(_0x59e3cf){var _0x26c715=_0x59e3cf[_0x33c0('0x17')]({'plain':!![]});return _0x26c715[_0x33c0('0x55')];});return db[_0x33c0('0x2b')]['find']({'where':{'id':_0x2128db[_0x33c0('0x28')]['id']}})[_0x33c0('0x15')](function(_0x154d6b){return db['sequelize']['transaction'](function(_0x4ad841){return _0x154d6b['addTeams'](_0x944b79,{'transaction':_0x4ad841})[_0x33c0('0x15')](function(){return BPromise[_0x33c0('0x5a')](_0x33988f,function(_0x393f7b){return db[_0x33c0('0x40')][_0x33c0('0x5b')]({'where':{'UserId':_0x393f7b['id'],'MailQueueId':_0x2128db[_0x33c0('0x28')]['id']},'transaction':_0x4ad841});});})[_0x33c0('0x15')](function(){_0x33988f[_0x33c0('0x5c')](function(_0x409b5c){socket[_0x33c0('0x5d')](_0x33c0('0x5e'),{'UserId':_0x409b5c['id'],'MailQueueId':_0x154d6b['id']});});});});});}})['then'](respondWithStatusCode(_0x4a4c67,null))[_0x33c0('0x26')](handleError(_0x4a4c67,null));};exports[_0x33c0('0x5f')]=function(_0x1a53b9,_0x505e9b){return db['Team'][_0x33c0('0x25')]({'where':{'id':_0x1a53b9[_0x33c0('0x24')][_0x33c0('0x60')]},'attributes':['id'],'include':[{'model':db[_0x33c0('0x48')],'as':_0x33c0('0x55'),'attributes':['id'],'raw':!![]}]})[_0x33c0('0x15')](handleEntityNotFound(_0x505e9b,null))[_0x33c0('0x15')](function(_0x4901d9){var _0x2b98e3=_[_0x33c0('0x1d')](_0x4901d9,'id');var _0x46ec59=[];var _0x262b26=[];var _0x5746f4=squel[_0x33c0('0x61')]();_0x5746f4['field'](_0x33c0('0x62'))['from']('team_has_mail_queues','tq')[_0x33c0('0x63')](_0x33c0('0x64'),'ut',_0x33c0('0x65'))[_0x33c0('0x44')](_0x33c0('0x66'),_0x1a53b9[_0x33c0('0x28')]['id']);for(var _0x55b363=0x0;_0x55b363<_0x4901d9['length'];_0x55b363+=0x1){let _0x4604db=_0x4901d9[_0x55b363];for(var _0xd6e114=0x0;_0xd6e114<_0x4604db[_0x33c0('0x55')][_0x33c0('0x30')];_0xd6e114+=0x1){let _0x238e80=_0x4604db['Agents'][_0xd6e114];var _0x1d767e=_0x5746f4[_0x33c0('0x67')]();_0x1d767e[_0x33c0('0x44')](_0x33c0('0x68'),_0x238e80['id']);_0x262b26[_0x33c0('0x69')](db[_0x33c0('0x6a')]['query'](_0x1d767e['toString'](),{'type':db['sequelize'][_0x33c0('0x6b')]['SELECT']})[_0x33c0('0x15')](function(_0x5c16b8){if(_0x5c16b8[_0x33c0('0x30')]===0x1){return _0x238e80['id'];}else{var _0x3f6ee3=_['every'](_[_0x33c0('0x1d')](_0x5c16b8,'TeamId'),function(_0x5abc8d){return _[_0x33c0('0x6c')](_0x2b98e3,_0x5abc8d);});if(_0x3f6ee3){return _0x238e80['id'];}}}));}}return BPromise[_0x33c0('0x6d')](_0x262b26)[_0x33c0('0x15')](function(_0x2d0fc1){_0x46ec59=_(_0x46ec59)[_0x33c0('0x6e')](_0x2d0fc1)[_0x33c0('0x6f')]()[_0x33c0('0x70')]();return db['MailQueue'][_0x33c0('0x39')]({'where':{'id':_0x1a53b9['params']['id']}})['then'](function(_0x5477b0){return db[_0x33c0('0x6a')][_0x33c0('0x71')](function(_0x355f6d){return _0x5477b0[_0x33c0('0x5f')](_0x1a53b9[_0x33c0('0x24')]['ids'],{'transaction':_0x355f6d})[_0x33c0('0x15')](function(){if(!_[_0x33c0('0x72')](_0x46ec59)){return _0x5477b0['removeAgents'](_0x46ec59,{'transaction':_0x355f6d});}})['then'](function(){_0x46ec59[_0x33c0('0x5c')](function(_0x59e4fd){socket['emit'](_0x33c0('0x73'),{'UserId':_0x59e4fd,'MailQueueId':_0x5477b0['id']});});});});});});})[_0x33c0('0x15')](respondWithStatusCode(_0x505e9b,null))[_0x33c0('0x26')](handleError(_0x505e9b,null));};exports['addAgents']=function(_0x41e604,_0x3459e2){return db[_0x33c0('0x2b')][_0x33c0('0x39')]({'where':{'id':_0x41e604[_0x33c0('0x28')]['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x3459e2,null))[_0x33c0('0x15')](function(_0x2bd186){if(_0x2bd186){return _0x2bd186[_0x33c0('0x74')](_0x41e604['body'][_0x33c0('0x60')],_[_0x33c0('0x75')](_0x41e604[_0x33c0('0x3c')],[_0x33c0('0x60'),'id'])||{})['spread'](function(_0x4e629e){for(var _0x126bbe=0x0;_0x126bbe<_0x41e604[_0x33c0('0x3c')]['ids'][_0x33c0('0x30')];_0x126bbe+=0x1){socket[_0x33c0('0x5d')](_0x33c0('0x5e'),{'UserId':Number(_0x41e604[_0x33c0('0x3c')][_0x33c0('0x60')][_0x126bbe]),'MailQueueId':Number(_0x41e604['params']['id'])});}return _0x4e629e;});}})[_0x33c0('0x15')](respondWithResult(_0x3459e2,null))[_0x33c0('0x26')](handleError(_0x3459e2,null));};exports[_0x33c0('0x76')]=function(_0x2ebe90,_0x7a0786){return db[_0x33c0('0x2b')][_0x33c0('0x39')]({'where':{'id':_0x2ebe90['params']['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x7a0786,null))[_0x33c0('0x15')](function(_0x14184c){if(_0x14184c){return _0x14184c['removeAgents'](_0x2ebe90['query']['ids'])[_0x33c0('0x15')](function(){if(_[_0x33c0('0x77')](_0x2ebe90[_0x33c0('0x24')][_0x33c0('0x60')])){for(var _0x17e736=0x0;_0x17e736<_0x2ebe90[_0x33c0('0x24')][_0x33c0('0x60')][_0x33c0('0x30')];_0x17e736+=0x1){socket[_0x33c0('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x2ebe90['query'][_0x33c0('0x60')][_0x17e736]),'MailQueueId':Number(_0x2ebe90[_0x33c0('0x28')]['id'])});}}else{socket['emit'](_0x33c0('0x73'),{'UserId':Number(_0x2ebe90[_0x33c0('0x24')][_0x33c0('0x60')]),'MailQueueId':Number(_0x2ebe90[_0x33c0('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x7a0786,null))[_0x33c0('0x26')](handleError(_0x7a0786,null));};exports['getAgents']=function(_0x339066,_0x344e04){var _0x1fb8e7={};var _0x483a6f={};var _0x2d93be;var _0x4a55e4;return db['MailQueue'][_0x33c0('0x3f')]({'where':{'id':_0x339066[_0x33c0('0x28')]['id']}})[_0x33c0('0x15')](handleEntityNotFound(_0x344e04,null))[_0x33c0('0x15')](function(_0x3a2b72){if(_0x3a2b72){_0x2d93be=_0x3a2b72;_0x483a6f['model']=_[_0x33c0('0x2a')](db[_0x33c0('0x48')][_0x33c0('0x1e')]);_0x483a6f[_0x33c0('0x24')]=_[_0x33c0('0x2a')](_0x339066[_0x33c0('0x24')]);_0x483a6f[_0x33c0('0x2c')]=_[_0x33c0('0x2d')](_0x483a6f[_0x33c0('0x29')],_0x483a6f[_0x33c0('0x24')]);_0x1fb8e7[_0x33c0('0x2e')]=_[_0x33c0('0x2d')](_0x483a6f[_0x33c0('0x29')],qs[_0x33c0('0x2f')](_0x339066['query'][_0x33c0('0x2f')]));_0x1fb8e7['attributes']=_0x1fb8e7[_0x33c0('0x2e')]['length']?_0x1fb8e7['attributes']:_0x483a6f[_0x33c0('0x29')];_0x1fb8e7[_0x33c0('0x42')]=qs['sort'](_0x339066[_0x33c0('0x24')][_0x33c0('0x43')]);_0x1fb8e7[_0x33c0('0x44')]=qs[_0x33c0('0x2c')](_['pick'](_0x339066['query'],_0x483a6f[_0x33c0('0x2c')]));if(_0x339066[_0x33c0('0x24')]['filter']){_0x1fb8e7[_0x33c0('0x44')]=_[_0x33c0('0x31')](_0x1fb8e7['where'],{'$or':_['map'](_0x1fb8e7[_0x33c0('0x2e')],function(_0x419ba8){var _0x4fedcb={};_0x4fedcb[_0x419ba8]={'$like':'%'+_0x339066['query']['filter']+'%'};return _0x4fedcb;})});}_0x1fb8e7=_[_0x33c0('0x31')]({},_0x1fb8e7,_0x339066[_0x33c0('0x32')]);return _0x2d93be['getAgents'](_0x1fb8e7);}})[_0x33c0('0x15')](function(_0x153168){if(_0x153168){_0x4a55e4=_0x153168[_0x33c0('0x30')];if(!_0x339066[_0x33c0('0x24')]['hasOwnProperty'](_0x33c0('0x53'))){_0x1fb8e7[_0x33c0('0x11')]=qs[_0x33c0('0x11')](_0x339066['query'][_0x33c0('0x11')]);_0x1fb8e7['offset']=qs['offset'](_0x339066[_0x33c0('0x24')][_0x33c0('0x12')]);}return _0x2d93be['getAgents'](_0x1fb8e7);}})[_0x33c0('0x15')](function(_0x387ad2){if(_0x387ad2){return _0x387ad2?{'count':_0x4a55e4,'rows':_0x387ad2}:null;}})[_0x33c0('0x15')](respondWithResult(_0x344e04,null))['catch'](handleError(_0x344e04,null));}; \ No newline at end of file +var _0xc0d9=['all','union','compact','isEmpty','removeAgents','forEach','userMailQueue:remove','addAgents','omit','userMailQueue:save','getAgents','hasOwnProperty','util','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','rawAttributes','attributes','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','intersection','fields','length','nolimit','order','sort','filters','pick','merge','filter','UserMailQueue','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','ids','User','online','voicePause','interface','Agents','transaction','addTeams','each','findOrCreate','emit','removeTeams','field','tq.TeamId','from','team_has_mail_queues','join','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','every','TeamId','includes'];(function(_0x4e8ece,_0x49ce4f){var _0x161e2c=function(_0x22c12c){while(--_0x22c12c){_0x4e8ece['push'](_0x4e8ece['shift']());}};_0x161e2c(++_0x49ce4f);}(_0xc0d9,0x1f0));var _0x9c0d=function(_0x5426ff,_0x134efe){_0x5426ff=_0x5426ff-0x0;var _0x47c991=_0xc0d9[_0x5426ff];return _0x47c991;};'use strict';var BPromise=require('bluebird');var util=require(_0x9c0d('0x0'));var _=require(_0x9c0d('0x1'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x9c0d('0x2'));var logger=require(_0x9c0d('0x3'))('api');var config=require(_0x9c0d('0x4'));var db=require(_0x9c0d('0x5'))['db'];config['redis']=_[_0x9c0d('0x6')](config['redis'],{'host':_0x9c0d('0x7'),'port':0x18eb});var socket=require(_0x9c0d('0x8'))(new Redis(config['redis']));require(_0x9c0d('0x9'))[_0x9c0d('0xa')](socket);function respondWithStatusCode(_0x1c648d,_0x2fac1c){_0x2fac1c=_0x2fac1c||0xcc;return function(_0x2ae2c5){if(_0x2ae2c5){return _0x1c648d[_0x9c0d('0xb')](_0x2fac1c);}return _0x1c648d['status'](_0x2fac1c)[_0x9c0d('0xc')]();};}function respondWithResult(_0x41d838,_0x4a7311){_0x4a7311=_0x4a7311||0xc8;return function(_0x10a596){if(_0x10a596){return _0x41d838[_0x9c0d('0xd')](_0x4a7311)[_0x9c0d('0xe')](_0x10a596);}};}function respondWithFilteredResult(_0x3adf61,_0x1dabb3){return function(_0x249d8b){if(_0x249d8b){var _0x3fd952=typeof _0x1dabb3[_0x9c0d('0xf')]===_0x9c0d('0x10')&&typeof _0x1dabb3[_0x9c0d('0x11')]===_0x9c0d('0x10');var _0x5583a7=_0x249d8b[_0x9c0d('0x12')];var _0x23cd5b=_0x3fd952?0x0:_0x1dabb3[_0x9c0d('0xf')];var _0x7ec8f5=_0x3fd952?_0x249d8b[_0x9c0d('0x12')]:_0x1dabb3[_0x9c0d('0xf')]+_0x1dabb3[_0x9c0d('0x11')];var _0x4956e3;if(_0x7ec8f5>=_0x5583a7){_0x7ec8f5=_0x5583a7;_0x4956e3=0xc8;}else{_0x4956e3=0xce;}_0x3adf61[_0x9c0d('0xd')](_0x4956e3);return _0x3adf61[_0x9c0d('0x13')](_0x9c0d('0x14'),_0x23cd5b+'-'+_0x7ec8f5+'/'+_0x5583a7)[_0x9c0d('0xe')](_0x249d8b);}return null;};}function saveUpdates(_0xcfcbb2){return function(_0x5360db){if(_0x5360db){return _0x5360db[_0x9c0d('0x15')](_0xcfcbb2)[_0x9c0d('0x16')](function(_0x32f050){return _0x32f050;});}return null;};}function removeEntity(_0x2de4fa){return function(_0x35cb9d){if(_0x35cb9d){return _0x35cb9d[_0x9c0d('0x17')]()['then'](function(){var _0x50817c=_0x35cb9d['get']({'plain':!![]});var _0x5113f7=_0x9c0d('0x18');return db[_0x9c0d('0x19')][_0x9c0d('0x17')]({'where':{'type':_0x5113f7,'resourceId':_0x50817c['id']}})[_0x9c0d('0x16')](function(){return _0x35cb9d;});})['then'](function(){_0x2de4fa[_0x9c0d('0xd')](0xcc)[_0x9c0d('0xc')]();});}};}function handleEntityNotFound(_0x47c79f){return function(_0x4ad099){if(!_0x4ad099){_0x47c79f[_0x9c0d('0xb')](0x194);}return _0x4ad099;};}function handleError(_0x2e0cc2,_0x5947b2){_0x5947b2=_0x5947b2||0x1f4;return function(_0x36e291){logger[_0x9c0d('0x1a')](_0x36e291['stack']);if(_0x36e291[_0x9c0d('0x1b')]){delete _0x36e291['name'];}_0x2e0cc2[_0x9c0d('0xd')](_0x5947b2)[_0x9c0d('0x1c')](_0x36e291);};}exports[_0x9c0d('0x1d')]=function(_0x54f2c1,_0x435fa8){var _0x4ee99b={};var _0x462d5={'count':0x0,'rows':[]};var _0x5cc039=_[_0x9c0d('0x1e')](db[_0x9c0d('0x1f')]['rawAttributes'],function(_0x3bcba8){return{'name':_0x3bcba8['fieldName'],'type':_0x3bcba8[_0x9c0d('0x20')][_0x9c0d('0x21')]};});_0x4ee99b=qs[_0x9c0d('0x22')](_0x5cc039,_0x54f2c1);var _0x5897bc={'where':_0x4ee99b[_0x9c0d('0x23')]};return db['MailQueue'][_0x9c0d('0x12')](_0x5897bc)[_0x9c0d('0x16')](function(_0x5d78af){_0x462d5['count']=_0x5d78af;_0x4ee99b['include']=qs[_0x9c0d('0x24')](_0x54f2c1[_0x9c0d('0x25')]);return db[_0x9c0d('0x1f')][_0x9c0d('0x26')](_0x4ee99b);})[_0x9c0d('0x16')](function(_0x39a98c){_0x462d5[_0x9c0d('0x27')]=_0x39a98c;return _0x462d5;})[_0x9c0d('0x16')](respondWithFilteredResult(_0x435fa8,_0x4ee99b))[_0x9c0d('0x28')](handleError(_0x435fa8,null));};exports[_0x9c0d('0x29')]=function(_0x25e6b4,_0x2546a5){var _0x162f5e={'raw':!![],'where':{'id':_0x25e6b4[_0x9c0d('0x2a')]['id']}},_0x462da7={};_0x462da7[_0x9c0d('0x2b')]=_[_0x9c0d('0x2c')](db['MailQueue'][_0x9c0d('0x2d')]);_0x462da7['query']=_[_0x9c0d('0x2c')](_0x25e6b4['query']);_0x462da7['filters']=_['intersection'](_0x462da7[_0x9c0d('0x2b')],_0x462da7[_0x9c0d('0x25')]);_0x162f5e['attributes']=_['intersection'](_0x462da7[_0x9c0d('0x2b')],qs['fields'](_0x25e6b4[_0x9c0d('0x25')]['fields']));_0x162f5e[_0x9c0d('0x2e')]=_0x162f5e[_0x9c0d('0x2e')]['length']?_0x162f5e[_0x9c0d('0x2e')]:_0x462da7[_0x9c0d('0x2b')];if(_0x25e6b4[_0x9c0d('0x25')][_0x9c0d('0x2f')]){_0x162f5e[_0x9c0d('0x24')]=[{'all':!![]}];}_0x162f5e=_['merge']({},_0x162f5e,_0x25e6b4[_0x9c0d('0x30')]);return db['MailQueue'][_0x9c0d('0x31')](_0x162f5e)[_0x9c0d('0x16')](handleEntityNotFound(_0x2546a5,null))[_0x9c0d('0x16')](respondWithResult(_0x2546a5,null))[_0x9c0d('0x28')](handleError(_0x2546a5,null));};exports['create']=function(_0x7dcacb,_0x44a460){return db[_0x9c0d('0x1f')][_0x9c0d('0x32')](_0x7dcacb[_0x9c0d('0x33')],{})[_0x9c0d('0x16')](function(_0x40be2f){var _0xc14c2e=_0x7dcacb[_0x9c0d('0x34')][_0x9c0d('0x35')]({'plain':!![]});if(!_0xc14c2e)throw new Error(_0x9c0d('0x36'));if(_0xc14c2e[_0x9c0d('0x37')]===_0x9c0d('0x34')){var _0x15282d=_0x40be2f[_0x9c0d('0x35')]({'plain':!![]});var _0x48ba6f=_0x9c0d('0x18');return db[_0x9c0d('0x38')][_0x9c0d('0x31')]({'where':{'name':_0x48ba6f,'userProfileId':_0xc14c2e[_0x9c0d('0x39')]},'raw':!![]})[_0x9c0d('0x16')](function(_0x9ec008){if(_0x9ec008&&_0x9ec008['autoAssociation']===0x0){return db[_0x9c0d('0x19')][_0x9c0d('0x32')]({'name':_0x15282d[_0x9c0d('0x1b')],'resourceId':_0x15282d['id'],'type':_0x9ec008['name'],'sectionId':_0x9ec008['id']},{})['then'](function(){return _0x40be2f;});}else{return _0x40be2f;}})[_0x9c0d('0x28')](function(_0x54d42a){logger[_0x9c0d('0x1a')](_0x9c0d('0x3a'),_0x54d42a);throw _0x54d42a;});}return _0x40be2f;})[_0x9c0d('0x16')](respondWithResult(_0x44a460,0xc9))[_0x9c0d('0x28')](handleError(_0x44a460,null));};exports['update']=function(_0x5902fe,_0xce529){if(_0x5902fe[_0x9c0d('0x33')]['id']){delete _0x5902fe['body']['id'];}return db[_0x9c0d('0x1f')][_0x9c0d('0x31')]({'where':{'id':_0x5902fe[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0xce529,null))[_0x9c0d('0x16')](saveUpdates(_0x5902fe['body'],null))[_0x9c0d('0x16')](respondWithResult(_0xce529,null))[_0x9c0d('0x28')](handleError(_0xce529,null));};exports[_0x9c0d('0x17')]=function(_0x1940bb,_0x147895){return db[_0x9c0d('0x1f')]['find']({'where':{'id':_0x1940bb[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0x147895,null))['then'](removeEntity(_0x147895,null))[_0x9c0d('0x28')](handleError(_0x147895,null));};exports[_0x9c0d('0x3b')]=function(_0x1d6110,_0x575709){return db['MailQueue'][_0x9c0d('0x3b')]()[_0x9c0d('0x16')](respondWithResult(_0x575709,null))['catch'](handleError(_0x575709,null));};exports['getMembers']=function(_0x4336fd,_0xfa40d3){var _0x38d2a8={'raw':!![],'where':{}},_0x594905={},_0x2d81c3;return db[_0x9c0d('0x1f')]['findOne']({'where':{'id':_0x4336fd[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0xfa40d3,null))[_0x9c0d('0x16')](function(_0xa8f8b7){if(_0xa8f8b7){_0x2d81c3=_0xa8f8b7[_0x9c0d('0x35')]({'plain':!![]});_0x594905[_0x9c0d('0x2b')]=_[_0x9c0d('0x2c')](db['UserMailQueue'][_0x9c0d('0x2d')]);_0x594905['query']=_['keys'](_0x4336fd[_0x9c0d('0x25')]);_0x594905['filters']=_[_0x9c0d('0x3c')](_0x594905[_0x9c0d('0x2b')],_0x594905[_0x9c0d('0x25')]);_0x38d2a8[_0x9c0d('0x2e')]=_[_0x9c0d('0x3c')](_0x594905[_0x9c0d('0x2b')],qs['fields'](_0x4336fd['query'][_0x9c0d('0x3d')]));_0x38d2a8[_0x9c0d('0x2e')]=_0x38d2a8[_0x9c0d('0x2e')][_0x9c0d('0x3e')]?_0x38d2a8[_0x9c0d('0x2e')]:_0x594905[_0x9c0d('0x2b')];if(!_0x4336fd[_0x9c0d('0x25')]['hasOwnProperty'](_0x9c0d('0x3f'))){_0x38d2a8[_0x9c0d('0x11')]=qs['limit'](_0x4336fd[_0x9c0d('0x25')][_0x9c0d('0x11')]);_0x38d2a8[_0x9c0d('0xf')]=qs[_0x9c0d('0xf')](_0x4336fd[_0x9c0d('0x25')][_0x9c0d('0xf')]);}_0x38d2a8[_0x9c0d('0x40')]=qs[_0x9c0d('0x41')](_0x4336fd[_0x9c0d('0x25')][_0x9c0d('0x41')]);_0x38d2a8[_0x9c0d('0x23')]=qs[_0x9c0d('0x42')](_[_0x9c0d('0x43')](_0x4336fd[_0x9c0d('0x25')],_0x594905[_0x9c0d('0x42')]));_0x38d2a8[_0x9c0d('0x23')]['MailQueueId']=_0xa8f8b7['id'];if(_0x4336fd['query']['filter']){_0x38d2a8[_0x9c0d('0x23')]=_[_0x9c0d('0x44')](_0x38d2a8['where'],{'$or':_[_0x9c0d('0x1e')](_0x38d2a8[_0x9c0d('0x2e')],function(_0x2c3dc6){var _0x57b975={};_0x57b975[_0x2c3dc6]={'$like':'%'+_0x4336fd['query'][_0x9c0d('0x45')]+'%'};return _0x57b975;})});}_0x38d2a8=_[_0x9c0d('0x44')]({},_0x38d2a8,_0x4336fd[_0x9c0d('0x30')]);return db[_0x9c0d('0x46')][_0x9c0d('0x26')](_0x38d2a8);}})[_0x9c0d('0x16')](function(_0x11f9d7){if(_0x11f9d7){return db['User'][_0x9c0d('0x47')]({'where':{'id':_[_0x9c0d('0x1e')](_0x11f9d7,_0x9c0d('0x48')),'role':_0x9c0d('0x49')},'attributes':['id','name',_0x9c0d('0x4a'),'updatedAt',_0x9c0d('0x4b')]});}})['then'](function(_0x2f98ac){if(_0x2f98ac){return{'count':_0x2f98ac[_0x9c0d('0x12')],'rows':_[_0x9c0d('0x1e')](_0x2f98ac[_0x9c0d('0x27')],function(_0x4ec590){return{'membername':_0x4ec590[_0x9c0d('0x1b')],'UserId':_0x4ec590['id'],'queue_name':_0x2d81c3[_0x9c0d('0x1b')],'MailQueueId':_0x2d81c3['id'],'interface':util[_0x9c0d('0x4c')](_0x9c0d('0x4d'),_0x9c0d('0x4e'),_0x4ec590[_0x9c0d('0x1b')]),'penalty':0x0,'paused':_0x4ec590[_0x9c0d('0x4a')],'createdAt':_0x4ec590[_0x9c0d('0x4b')],'updatedAt':_0x4ec590[_0x9c0d('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xfa40d3,_0x38d2a8))[_0x9c0d('0x28')](handleError(_0xfa40d3,null));};exports[_0x9c0d('0x50')]=function(_0x31bc01,_0x58cc6f){var _0x4e2803={};var _0x192cdd={};var _0x555180;var _0x23fb8e;return db[_0x9c0d('0x1f')][_0x9c0d('0x51')]({'where':{'id':_0x31bc01['params']['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0x58cc6f,null))['then'](function(_0x1ba204){if(_0x1ba204){_0x555180=_0x1ba204;_0x192cdd[_0x9c0d('0x2b')]=_['keys'](db[_0x9c0d('0x52')][_0x9c0d('0x2d')]);_0x192cdd[_0x9c0d('0x25')]=_['keys'](_0x31bc01[_0x9c0d('0x25')]);_0x192cdd[_0x9c0d('0x42')]=_['intersection'](_0x192cdd[_0x9c0d('0x2b')],_0x192cdd['query']);_0x4e2803[_0x9c0d('0x2e')]=_[_0x9c0d('0x3c')](_0x192cdd[_0x9c0d('0x2b')],qs['fields'](_0x31bc01[_0x9c0d('0x25')][_0x9c0d('0x3d')]));_0x4e2803['attributes']=_0x4e2803[_0x9c0d('0x2e')][_0x9c0d('0x3e')]?_0x4e2803['attributes']:_0x192cdd[_0x9c0d('0x2b')];_0x4e2803[_0x9c0d('0x40')]=qs[_0x9c0d('0x41')](_0x31bc01[_0x9c0d('0x25')][_0x9c0d('0x41')]);_0x4e2803[_0x9c0d('0x23')]=qs[_0x9c0d('0x42')](_[_0x9c0d('0x43')](_0x31bc01[_0x9c0d('0x25')],_0x192cdd[_0x9c0d('0x42')]));if(_0x31bc01[_0x9c0d('0x25')][_0x9c0d('0x45')]){_0x4e2803['where']=_['merge'](_0x4e2803[_0x9c0d('0x23')],{'$or':_[_0x9c0d('0x1e')](_0x4e2803[_0x9c0d('0x2e')],function(_0x551a7b){var _0x179bbb={};_0x179bbb[_0x551a7b]={'$like':'%'+_0x31bc01[_0x9c0d('0x25')][_0x9c0d('0x45')]+'%'};return _0x179bbb;})});}_0x4e2803=_[_0x9c0d('0x44')]({},_0x4e2803,_0x31bc01[_0x9c0d('0x30')]);return _0x555180[_0x9c0d('0x50')](_0x4e2803);}})['then'](function(_0x499487){if(_0x499487){_0x23fb8e=_0x499487[_0x9c0d('0x3e')];if(!_0x31bc01['query']['hasOwnProperty'](_0x9c0d('0x3f'))){_0x4e2803[_0x9c0d('0x11')]=qs[_0x9c0d('0x11')](_0x31bc01[_0x9c0d('0x25')][_0x9c0d('0x11')]);_0x4e2803[_0x9c0d('0xf')]=qs['offset'](_0x31bc01[_0x9c0d('0x25')]['offset']);}return _0x555180[_0x9c0d('0x50')](_0x4e2803);}})[_0x9c0d('0x16')](function(_0x378312){if(_0x378312){return _0x378312?{'count':_0x23fb8e,'rows':_0x378312}:null;}})[_0x9c0d('0x16')](respondWithResult(_0x58cc6f,null))['catch'](handleError(_0x58cc6f,null));};exports['addTeams']=function(_0x3d5e8a,_0x1922e2){var _0x18c89a=_0x3d5e8a['body'][_0x9c0d('0x53')];return db[_0x9c0d('0x52')][_0x9c0d('0x26')]({'where':{'id':_0x18c89a},'attributes':['id'],'include':[{'model':db[_0x9c0d('0x54')],'as':'Agents','attributes':['id',_0x9c0d('0x1b'),_0x9c0d('0x55'),_0x9c0d('0x56'),_0x9c0d('0x57')],'raw':!![]}]})[_0x9c0d('0x16')](function(_0x5207dd){if(_0x5207dd){var _0x2f7254=_['flatMap'](_0x5207dd,function(_0x3383d2){var _0x521daf=_0x3383d2[_0x9c0d('0x35')]({'plain':!![]});return _0x521daf[_0x9c0d('0x58')];});return db[_0x9c0d('0x1f')][_0x9c0d('0x31')]({'where':{'id':_0x3d5e8a[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](function(_0x25ebbe){return db['sequelize'][_0x9c0d('0x59')](function(_0x26417d){return _0x25ebbe[_0x9c0d('0x5a')](_0x18c89a,{'transaction':_0x26417d})[_0x9c0d('0x16')](function(){return BPromise[_0x9c0d('0x5b')](_0x2f7254,function(_0x48b883){return db[_0x9c0d('0x46')][_0x9c0d('0x5c')]({'where':{'UserId':_0x48b883['id'],'MailQueueId':_0x3d5e8a['params']['id']},'transaction':_0x26417d});});})['then'](function(){_0x2f7254['forEach'](function(_0x59d23b){socket[_0x9c0d('0x5d')]('userMailQueue:save',{'UserId':_0x59d23b['id'],'MailQueueId':_0x25ebbe['id']});});});});});}})[_0x9c0d('0x16')](respondWithStatusCode(_0x1922e2,null))['catch'](handleError(_0x1922e2,null));};exports[_0x9c0d('0x5e')]=function(_0x385426,_0x2d718f){return db[_0x9c0d('0x52')][_0x9c0d('0x26')]({'where':{'id':_0x385426[_0x9c0d('0x25')][_0x9c0d('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9c0d('0x16')](handleEntityNotFound(_0x2d718f,null))[_0x9c0d('0x16')](function(_0x5477f4){var _0x625859=_['map'](_0x5477f4,'id');var _0x29e038=[];var _0x12a2ca=[];var _0x2cd426=squel['select']();_0x2cd426[_0x9c0d('0x5f')](_0x9c0d('0x60'))[_0x9c0d('0x61')](_0x9c0d('0x62'),'tq')[_0x9c0d('0x63')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9c0d('0x23')](_0x9c0d('0x64'),_0x385426['params']['id']);for(var _0x547b83=0x0;_0x547b83<_0x5477f4[_0x9c0d('0x3e')];_0x547b83+=0x1){let _0x57e159=_0x5477f4[_0x547b83];for(var _0x53468b=0x0;_0x53468b<_0x57e159['Agents']['length'];_0x53468b+=0x1){let _0xb04eed=_0x57e159['Agents'][_0x53468b];var _0x3c6c96=_0x2cd426[_0x9c0d('0x65')]();_0x3c6c96[_0x9c0d('0x23')](_0x9c0d('0x66'),_0xb04eed['id']);_0x12a2ca['push'](db[_0x9c0d('0x67')]['query'](_0x3c6c96[_0x9c0d('0x68')](),{'type':db['sequelize'][_0x9c0d('0x69')]['SELECT']})[_0x9c0d('0x16')](function(_0x87a253){if(_0x87a253['length']===0x1){return _0xb04eed['id'];}else{var _0x5e3681=_[_0x9c0d('0x6a')](_[_0x9c0d('0x1e')](_0x87a253,_0x9c0d('0x6b')),function(_0x41edfd){return _[_0x9c0d('0x6c')](_0x625859,_0x41edfd);});if(_0x5e3681){return _0xb04eed['id'];}}}));}}return BPromise[_0x9c0d('0x6d')](_0x12a2ca)['then'](function(_0x24d2d1){_0x29e038=_(_0x29e038)[_0x9c0d('0x6e')](_0x24d2d1)[_0x9c0d('0x6f')]()['value']();return db[_0x9c0d('0x1f')][_0x9c0d('0x31')]({'where':{'id':_0x385426[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](function(_0xfbf04){return db['sequelize'][_0x9c0d('0x59')](function(_0x4e2cb2){return _0xfbf04[_0x9c0d('0x5e')](_0x385426[_0x9c0d('0x25')][_0x9c0d('0x53')],{'transaction':_0x4e2cb2})[_0x9c0d('0x16')](function(){if(!_[_0x9c0d('0x70')](_0x29e038)){return _0xfbf04[_0x9c0d('0x71')](_0x29e038,{'transaction':_0x4e2cb2});}})[_0x9c0d('0x16')](function(){_0x29e038[_0x9c0d('0x72')](function(_0x4562c6){socket[_0x9c0d('0x5d')](_0x9c0d('0x73'),{'UserId':_0x4562c6,'MailQueueId':_0xfbf04['id']});});});});});});})[_0x9c0d('0x16')](respondWithStatusCode(_0x2d718f,null))[_0x9c0d('0x28')](handleError(_0x2d718f,null));};exports[_0x9c0d('0x74')]=function(_0x3cc021,_0x31a323){return db[_0x9c0d('0x1f')]['find']({'where':{'id':_0x3cc021[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0x31a323,null))['then'](function(_0x32fdcb){if(_0x32fdcb){return _0x32fdcb[_0x9c0d('0x74')](_0x3cc021[_0x9c0d('0x33')][_0x9c0d('0x53')],_[_0x9c0d('0x75')](_0x3cc021[_0x9c0d('0x33')],[_0x9c0d('0x53'),'id'])||{})['spread'](function(_0x5f0496){for(var _0x475bc7=0x0;_0x475bc7<_0x3cc021[_0x9c0d('0x33')][_0x9c0d('0x53')][_0x9c0d('0x3e')];_0x475bc7+=0x1){socket[_0x9c0d('0x5d')](_0x9c0d('0x76'),{'UserId':Number(_0x3cc021[_0x9c0d('0x33')]['ids'][_0x475bc7]),'MailQueueId':Number(_0x3cc021[_0x9c0d('0x2a')]['id'])});}return _0x5f0496;});}})[_0x9c0d('0x16')](respondWithResult(_0x31a323,null))[_0x9c0d('0x28')](handleError(_0x31a323,null));};exports[_0x9c0d('0x71')]=function(_0x5ebfab,_0x4b615e){return db[_0x9c0d('0x1f')][_0x9c0d('0x31')]({'where':{'id':_0x5ebfab[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0x4b615e,null))[_0x9c0d('0x16')](function(_0x372d79){if(_0x372d79){return _0x372d79[_0x9c0d('0x71')](_0x5ebfab[_0x9c0d('0x25')][_0x9c0d('0x53')])[_0x9c0d('0x16')](function(){if(_['isArray'](_0x5ebfab[_0x9c0d('0x25')][_0x9c0d('0x53')])){for(var _0x5b75ce=0x0;_0x5b75ce<_0x5ebfab[_0x9c0d('0x25')][_0x9c0d('0x53')][_0x9c0d('0x3e')];_0x5b75ce+=0x1){socket[_0x9c0d('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x5ebfab[_0x9c0d('0x25')][_0x9c0d('0x53')][_0x5b75ce]),'MailQueueId':Number(_0x5ebfab['params']['id'])});}}else{socket[_0x9c0d('0x5d')]('userMailQueue:remove',{'UserId':Number(_0x5ebfab[_0x9c0d('0x25')][_0x9c0d('0x53')]),'MailQueueId':Number(_0x5ebfab[_0x9c0d('0x2a')]['id'])});}});}})[_0x9c0d('0x16')](respondWithStatusCode(_0x4b615e,null))['catch'](handleError(_0x4b615e,null));};exports['getAgents']=function(_0x1a2eb8,_0x5565ae){var _0x3148fd={};var _0x5d6cac={};var _0x5bdef6;var _0x5caa0b;return db[_0x9c0d('0x1f')][_0x9c0d('0x51')]({'where':{'id':_0x1a2eb8[_0x9c0d('0x2a')]['id']}})[_0x9c0d('0x16')](handleEntityNotFound(_0x5565ae,null))[_0x9c0d('0x16')](function(_0x512076){if(_0x512076){_0x5bdef6=_0x512076;_0x5d6cac[_0x9c0d('0x2b')]=_[_0x9c0d('0x2c')](db[_0x9c0d('0x54')][_0x9c0d('0x2d')]);_0x5d6cac[_0x9c0d('0x25')]=_[_0x9c0d('0x2c')](_0x1a2eb8[_0x9c0d('0x25')]);_0x5d6cac[_0x9c0d('0x42')]=_[_0x9c0d('0x3c')](_0x5d6cac[_0x9c0d('0x2b')],_0x5d6cac[_0x9c0d('0x25')]);_0x3148fd['attributes']=_[_0x9c0d('0x3c')](_0x5d6cac[_0x9c0d('0x2b')],qs['fields'](_0x1a2eb8[_0x9c0d('0x25')][_0x9c0d('0x3d')]));_0x3148fd[_0x9c0d('0x2e')]=_0x3148fd[_0x9c0d('0x2e')][_0x9c0d('0x3e')]?_0x3148fd['attributes']:_0x5d6cac[_0x9c0d('0x2b')];_0x3148fd[_0x9c0d('0x40')]=qs[_0x9c0d('0x41')](_0x1a2eb8['query'][_0x9c0d('0x41')]);_0x3148fd[_0x9c0d('0x23')]=qs[_0x9c0d('0x42')](_['pick'](_0x1a2eb8[_0x9c0d('0x25')],_0x5d6cac[_0x9c0d('0x42')]));if(_0x1a2eb8['query'][_0x9c0d('0x45')]){_0x3148fd[_0x9c0d('0x23')]=_[_0x9c0d('0x44')](_0x3148fd['where'],{'$or':_['map'](_0x3148fd[_0x9c0d('0x2e')],function(_0x55c53b){var _0x51fbb1={};_0x51fbb1[_0x55c53b]={'$like':'%'+_0x1a2eb8[_0x9c0d('0x25')]['filter']+'%'};return _0x51fbb1;})});}_0x3148fd=_['merge']({},_0x3148fd,_0x1a2eb8[_0x9c0d('0x30')]);return _0x5bdef6[_0x9c0d('0x77')](_0x3148fd);}})['then'](function(_0x4d8df0){if(_0x4d8df0){_0x5caa0b=_0x4d8df0['length'];if(!_0x1a2eb8[_0x9c0d('0x25')][_0x9c0d('0x78')](_0x9c0d('0x3f'))){_0x3148fd[_0x9c0d('0x11')]=qs[_0x9c0d('0x11')](_0x1a2eb8[_0x9c0d('0x25')][_0x9c0d('0x11')]);_0x3148fd['offset']=qs[_0x9c0d('0xf')](_0x1a2eb8[_0x9c0d('0x25')][_0x9c0d('0xf')]);}return _0x5bdef6[_0x9c0d('0x77')](_0x3148fd);}})[_0x9c0d('0x16')](function(_0x198f47){if(_0x198f47){return _0x198f47?{'count':_0x5caa0b,'rows':_0x198f47}:null;}})[_0x9c0d('0x16')](respondWithResult(_0x5565ae,null))['catch'](handleError(_0x5565ae,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 38a6632..3a0bfca 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 _0x0097=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x50b3fa,_0x322c75){var _0x3318fe=function(_0x316bd5){while(--_0x316bd5){_0x50b3fa['push'](_0x50b3fa['shift']());}};_0x3318fe(++_0x322c75);}(_0x0097,0x1e7));var _0x7009=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0097[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7009('0x0'));var MailQueue=require(_0x7009('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x7009('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7009('0x3'),'afterDestroy':_0x7009('0x4')};function emitEvent(_0xdcdeb4){return function(_0x2bf1af,_0x1ee7e8,_0x41e047){MailQueueEvents['emit'](_0xdcdeb4+':'+_0x2bf1af['id'],_0x2bf1af);MailQueueEvents[_0x7009('0x5')](_0xdcdeb4,_0x2bf1af);_0x41e047(null);};}for(var e in events){if(events[_0x7009('0x6')](e)){var event=events[e];MailQueue[_0x7009('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x2803=['exports','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3d6cb1,_0x6f4ae3){var _0x545f50=function(_0x3b3474){while(--_0x3b3474){_0x3d6cb1['push'](_0x3d6cb1['shift']());}};_0x545f50(++_0x6f4ae3);}(_0x2803,0x184));var _0x3280=function(_0x2df70e,_0x4608a4){_0x2df70e=_0x2df70e-0x0;var _0x1a07b3=_0x2803[_0x2df70e];return _0x1a07b3;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x3280('0x0'))['db'][_0x3280('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3280('0x2')](0x0);var events={'afterCreate':_0x3280('0x3'),'afterUpdate':_0x3280('0x4'),'afterDestroy':_0x3280('0x5')};function emitEvent(_0x548b69){return function(_0x50c618,_0x4c60c8,_0x397a42){MailQueueEvents[_0x3280('0x6')](_0x548b69+':'+_0x50c618['id'],_0x50c618);MailQueueEvents[_0x3280('0x6')](_0x548b69,_0x50c618);_0x397a42(null);};}for(var e in events){if(events[_0x3280('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x3280('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 2fe5b39..8074777 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 _0xe982=['lodash','util','../../config/logger','api','moment','request-promise','path','./mailQueue.attributes','exports','mail_queues'];(function(_0x32ee51,_0x26d577){var _0x57d860=function(_0x55b534){while(--_0x55b534){_0x32ee51['push'](_0x32ee51['shift']());}};_0x57d860(++_0x26d577);}(_0xe982,0xb4));var _0x2e98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe982[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x2e98('0x0'));var util=require(_0x2e98('0x1'));var logger=require(_0x2e98('0x2'))(_0x2e98('0x3'));var moment=require(_0x2e98('0x4'));var BPromise=require('bluebird');var rp=require(_0x2e98('0x5'));var fs=require('fs');var path=require(_0x2e98('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2e98('0x7'));module[_0x2e98('0x8')]=function(_0x22b335,_0x28f9d1){return _0x22b335['define']('MailQueue',attributes,{'tableName':_0x2e98('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8180=['api','moment','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8180,0x1c6));var _0x0818=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8180[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x0818('0x0'));var util=require('util');var logger=require(_0x0818('0x1'))(_0x0818('0x2'));var moment=require(_0x0818('0x3'));var BPromise=require('bluebird');var rp=require(_0x0818('0x4'));var fs=require('fs');var path=require(_0x0818('0x5'));var rimraf=require(_0x0818('0x6'));var config=require(_0x0818('0x7'));var attributes=require(_0x0818('0x8'));module[_0x0818('0x9')]=function(_0x578bd5,_0x1a3e90){return _0x578bd5['define'](_0x0818('0xa'),attributes,{'tableName':_0x0818('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 0ad75e9..e034867 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 _0x04f1=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','limit','map','include','model','attributes','debug','stringify','ShowMailQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x04f1,0xc1));var _0x104f=function(_0x1ae0ea,_0x5c0919){_0x1ae0ea=_0x1ae0ea-0x0;var _0x404277=_0x04f1[_0x1ae0ea];return _0x404277;};'use strict';var _=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var moment=require(_0x104f('0x2'));var BPromise=require(_0x104f('0x3'));var rs=require(_0x104f('0x4'));var fs=require('fs');var Redis=require(_0x104f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x104f('0x6'));var logger=require(_0x104f('0x7'))(_0x104f('0x8'));var config=require(_0x104f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x104f('0xa')]['http']({'port':0x232a});config[_0x104f('0xb')]=_[_0x104f('0xc')](config[_0x104f('0xb')],{'host':_0x104f('0xd'),'port':0x18eb});var socket=require(_0x104f('0xe'))(new Redis(config[_0x104f('0xb')]));require(_0x104f('0xf'))['register'](socket);function respondWithRpcPromise(_0x4e4872,_0xfc1f05,_0x1b3d82){return new BPromise(function(_0x536288,_0x41244b){return client[_0x104f('0x10')](_0x4e4872,_0x1b3d82)[_0x104f('0x11')](function(_0x478b56){logger[_0x104f('0x12')](_0x104f('0x13'),_0xfc1f05,_0x104f('0x14'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0xfc1f05,_0x104f('0x14'),JSON['stringify'](_0x478b56));if(_0x478b56['error']){if(_0x478b56[_0x104f('0x15')][_0x104f('0x16')]===0x1f4){logger[_0x104f('0x15')]('MailQueue,\x20%s,\x20%s',_0xfc1f05,_0x478b56[_0x104f('0x15')][_0x104f('0x17')]);return _0x41244b(_0x478b56[_0x104f('0x15')][_0x104f('0x17')]);}logger['error'](_0x104f('0x13'),_0xfc1f05,_0x478b56[_0x104f('0x15')][_0x104f('0x17')]);return _0x536288(_0x478b56[_0x104f('0x15')][_0x104f('0x17')]);}else{logger[_0x104f('0x12')](_0x104f('0x13'),_0xfc1f05,_0x104f('0x14'));_0x536288(_0x478b56['result']['message']);}})[_0x104f('0x18')](function(_0x5e69bc){logger[_0x104f('0x15')]('MailQueue,\x20%s,\x20%s',_0xfc1f05,_0x5e69bc);_0x41244b(_0x5e69bc);});});}exports[_0x104f('0x19')]=function(_0x1a012c){var _0x1bca00=this;return new Promise(function(_0x2e776c,_0x2a29fb){return db[_0x104f('0x1a')][_0x104f('0x1b')]({'raw':_0x1a012c['options']?_0x1a012c[_0x104f('0x1c')][_0x104f('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a012c[_0x104f('0x1c')]?_0x1a012c['options']['where']||null:null,'attributes':_0x1a012c[_0x104f('0x1c')]?_0x1a012c['options']['attributes']||null:null,'limit':_0x1a012c[_0x104f('0x1c')]?_0x1a012c[_0x104f('0x1c')][_0x104f('0x1e')]||null:null,'include':_0x1a012c[_0x104f('0x1c')]?_0x1a012c[_0x104f('0x1c')]['include']?_[_0x104f('0x1f')](_0x1a012c[_0x104f('0x1c')][_0x104f('0x20')],function(_0x445877){return{'model':db[_0x445877[_0x104f('0x21')]],'as':_0x445877['as'],'attributes':_0x445877['attributes'],'include':_0x445877['include']?_[_0x104f('0x1f')](_0x445877[_0x104f('0x20')],function(_0x4fd984){return{'model':db[_0x4fd984[_0x104f('0x21')]],'as':_0x4fd984['as'],'attributes':_0x4fd984[_0x104f('0x22')],'include':_0x4fd984[_0x104f('0x20')]?_[_0x104f('0x1f')](_0x4fd984['include'],function(_0x1f91dd){return{'model':db[_0x1f91dd[_0x104f('0x21')]],'as':_0x1f91dd['as'],'attributes':_0x1f91dd[_0x104f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x104f('0x11')](function(_0xf6b117){logger[_0x104f('0x12')](_0x104f('0x19'),_0x1a012c);logger[_0x104f('0x23')](_0x104f('0x19'),_0x1a012c,JSON[_0x104f('0x24')](_0xf6b117));_0x2e776c(_0xf6b117);})[_0x104f('0x18')](function(_0x179a51){logger[_0x104f('0x15')]('GetMailQueue',_0x179a51['message'],_0x1a012c);_0x2a29fb(_0x1bca00[_0x104f('0x15')](0x1f4,_0x179a51[_0x104f('0x17')]));});});};exports[_0x104f('0x25')]=function(_0x319bf0){var _0x1c97d7=this;return new Promise(function(_0x4108b0,_0x330476){return db[_0x104f('0x1a')][_0x104f('0x26')]({'raw':_0x319bf0['options']?_0x319bf0[_0x104f('0x1c')][_0x104f('0x1d')]===undefined?!![]:![]:!![],'where':_0x319bf0[_0x104f('0x1c')]?_0x319bf0[_0x104f('0x1c')][_0x104f('0x27')]||null:null,'attributes':_0x319bf0[_0x104f('0x1c')]?_0x319bf0[_0x104f('0x1c')][_0x104f('0x22')]||null:null,'include':_0x319bf0['options']?_0x319bf0[_0x104f('0x1c')][_0x104f('0x20')]?_['map'](_0x319bf0[_0x104f('0x1c')]['include'],function(_0xa177ac){return{'model':db[_0xa177ac['model']],'as':_0xa177ac['as'],'attributes':_0xa177ac['attributes'],'include':_0xa177ac['include']?_['map'](_0xa177ac['include'],function(_0x14e65d){return{'model':db[_0x14e65d[_0x104f('0x21')]],'as':_0x14e65d['as'],'attributes':_0x14e65d['attributes'],'include':_0x14e65d[_0x104f('0x20')]?_[_0x104f('0x1f')](_0x14e65d[_0x104f('0x20')],function(_0x88c569){return{'model':db[_0x88c569['model']],'as':_0x88c569['as'],'attributes':_0x88c569['attributes']};}):[]};}):[]};}):[]:[]})[_0x104f('0x11')](function(_0x205a15){logger[_0x104f('0x12')]('ShowMailQueue',_0x319bf0);logger[_0x104f('0x23')](_0x104f('0x25'),_0x319bf0,JSON[_0x104f('0x24')](_0x205a15));_0x4108b0(_0x205a15);})[_0x104f('0x18')](function(_0x43252b){logger['error'](_0x104f('0x25'),_0x43252b[_0x104f('0x17')],_0x319bf0);_0x330476(_0x1c97d7['error'](0x1f4,_0x43252b['message']));});});}; \ No newline at end of file +var _0x78f5=['redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','MailQueue,\x20%s,\x20%s','message','result','catch','MailQueue','options','attributes','limit','include','model','map','GetMailQueue','stringify','ShowMailQueue','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x78f5,0xbc));var _0x578f=function(_0x132d9e,_0x4a0839){_0x132d9e=_0x132d9e-0x0;var _0x40b733=_0x78f5[_0x132d9e];return _0x40b733;};'use strict';var _=require(_0x578f('0x0'));var util=require(_0x578f('0x1'));var moment=require(_0x578f('0x2'));var BPromise=require(_0x578f('0x3'));var rs=require(_0x578f('0x4'));var fs=require('fs');var Redis=require(_0x578f('0x5'));var db=require(_0x578f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x578f('0x7'))(_0x578f('0x8'));var config=require(_0x578f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x578f('0xa')]({'port':0x232a});config['redis']=_[_0x578f('0xb')](config[_0x578f('0xc')],{'host':_0x578f('0xd'),'port':0x18eb});var socket=require(_0x578f('0xe'))(new Redis(config[_0x578f('0xc')]));require('./mailQueue.socket')[_0x578f('0xf')](socket);function respondWithRpcPromise(_0x3d0a7f,_0x23f152,_0x1c9182){return new BPromise(function(_0x429a3b,_0xf18ea2){return client[_0x578f('0x10')](_0x3d0a7f,_0x1c9182)[_0x578f('0x11')](function(_0xf6b5b1){logger[_0x578f('0x12')]('MailQueue,\x20%s,\x20%s',_0x23f152,_0x578f('0x13'));logger[_0x578f('0x14')](_0x578f('0x15'),_0x23f152,_0x578f('0x13'),JSON['stringify'](_0xf6b5b1));if(_0xf6b5b1['error']){if(_0xf6b5b1[_0x578f('0x16')]['code']===0x1f4){logger[_0x578f('0x16')](_0x578f('0x17'),_0x23f152,_0xf6b5b1[_0x578f('0x16')][_0x578f('0x18')]);return _0xf18ea2(_0xf6b5b1[_0x578f('0x16')][_0x578f('0x18')]);}logger[_0x578f('0x16')](_0x578f('0x17'),_0x23f152,_0xf6b5b1[_0x578f('0x16')][_0x578f('0x18')]);return _0x429a3b(_0xf6b5b1[_0x578f('0x16')][_0x578f('0x18')]);}else{logger[_0x578f('0x12')](_0x578f('0x17'),_0x23f152,_0x578f('0x13'));_0x429a3b(_0xf6b5b1[_0x578f('0x19')][_0x578f('0x18')]);}})[_0x578f('0x1a')](function(_0x4823d0){logger[_0x578f('0x16')]('MailQueue,\x20%s,\x20%s',_0x23f152,_0x4823d0);_0xf18ea2(_0x4823d0);});});}exports['GetMailQueue']=function(_0x24db4a){var _0x3b1a17=this;return new Promise(function(_0x37a54f,_0x589380){return db[_0x578f('0x1b')]['findAll']({'raw':_0x24db4a[_0x578f('0x1c')]?_0x24db4a[_0x578f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x24db4a['options']?_0x24db4a['options']['where']||null:null,'attributes':_0x24db4a['options']?_0x24db4a[_0x578f('0x1c')][_0x578f('0x1d')]||null:null,'limit':_0x24db4a[_0x578f('0x1c')]?_0x24db4a[_0x578f('0x1c')][_0x578f('0x1e')]||null:null,'include':_0x24db4a['options']?_0x24db4a['options'][_0x578f('0x1f')]?_['map'](_0x24db4a['options'][_0x578f('0x1f')],function(_0x36d027){return{'model':db[_0x36d027[_0x578f('0x20')]],'as':_0x36d027['as'],'attributes':_0x36d027[_0x578f('0x1d')],'include':_0x36d027['include']?_[_0x578f('0x21')](_0x36d027[_0x578f('0x1f')],function(_0x59295f){return{'model':db[_0x59295f[_0x578f('0x20')]],'as':_0x59295f['as'],'attributes':_0x59295f[_0x578f('0x1d')],'include':_0x59295f[_0x578f('0x1f')]?_['map'](_0x59295f['include'],function(_0x2d8a85){return{'model':db[_0x2d8a85['model']],'as':_0x2d8a85['as'],'attributes':_0x2d8a85['attributes']};}):[]};}):[]};}):[]:[]})[_0x578f('0x11')](function(_0x37f84b){logger['info'](_0x578f('0x22'),_0x24db4a);logger[_0x578f('0x14')](_0x578f('0x22'),_0x24db4a,JSON[_0x578f('0x23')](_0x37f84b));_0x37a54f(_0x37f84b);})[_0x578f('0x1a')](function(_0x32636e){logger[_0x578f('0x16')]('GetMailQueue',_0x32636e[_0x578f('0x18')],_0x24db4a);_0x589380(_0x3b1a17['error'](0x1f4,_0x32636e[_0x578f('0x18')]));});});};exports[_0x578f('0x24')]=function(_0x2402b9){var _0x1776b3=this;return new Promise(function(_0x5016b0,_0x102988){return db[_0x578f('0x1b')][_0x578f('0x25')]({'raw':_0x2402b9[_0x578f('0x1c')]?_0x2402b9['options'][_0x578f('0x26')]===undefined?!![]:![]:!![],'where':_0x2402b9[_0x578f('0x1c')]?_0x2402b9[_0x578f('0x1c')][_0x578f('0x27')]||null:null,'attributes':_0x2402b9[_0x578f('0x1c')]?_0x2402b9[_0x578f('0x1c')][_0x578f('0x1d')]||null:null,'include':_0x2402b9['options']?_0x2402b9[_0x578f('0x1c')]['include']?_[_0x578f('0x21')](_0x2402b9[_0x578f('0x1c')][_0x578f('0x1f')],function(_0x4e38e7){return{'model':db[_0x4e38e7[_0x578f('0x20')]],'as':_0x4e38e7['as'],'attributes':_0x4e38e7[_0x578f('0x1d')],'include':_0x4e38e7[_0x578f('0x1f')]?_[_0x578f('0x21')](_0x4e38e7[_0x578f('0x1f')],function(_0x39ed62){return{'model':db[_0x39ed62['model']],'as':_0x39ed62['as'],'attributes':_0x39ed62[_0x578f('0x1d')],'include':_0x39ed62[_0x578f('0x1f')]?_[_0x578f('0x21')](_0x39ed62[_0x578f('0x1f')],function(_0x28c9f4){return{'model':db[_0x28c9f4[_0x578f('0x20')]],'as':_0x28c9f4['as'],'attributes':_0x28c9f4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x47caa5){logger['info']('ShowMailQueue',_0x2402b9);logger[_0x578f('0x14')]('ShowMailQueue',_0x2402b9,JSON[_0x578f('0x23')](_0x47caa5));_0x5016b0(_0x47caa5);})[_0x578f('0x1a')](function(_0x468720){logger[_0x578f('0x16')](_0x578f('0x24'),_0x468720[_0x578f('0x18')],_0x2402b9);_0x102988(_0x1776b3[_0x578f('0x16')](0x1f4,_0x468720[_0x578f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 582d658..03f8f22 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 _0xb01c=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','remove'];(function(_0x3b08b9,_0x3da8ae){var _0x4e4221=function(_0x4dfa91){while(--_0x4dfa91){_0x3b08b9['push'](_0x3b08b9['shift']());}};_0x4e4221(++_0x3da8ae);}(_0xb01c,0xbe));var _0xcb01=function(_0x542042,_0x532c69){_0x542042=_0x542042-0x0;var _0x15b140=_0xb01c[_0x542042];return _0x15b140;};'use strict';var MailQueueEvents=require(_0xcb01('0x0'));var events=['save',_0xcb01('0x1'),_0xcb01('0x2')];function createListener(_0x304172,_0xd9bf38){return function(_0x2cd85b){_0xd9bf38[_0xcb01('0x3')](_0x304172,_0x2cd85b);};}function removeListener(_0x106c60,_0x47dee2){return function(){MailQueueEvents[_0xcb01('0x4')](_0x106c60,_0x47dee2);};}exports[_0xcb01('0x5')]=function(_0x16b993){for(var _0x1b8ca8=0x0,_0x357bf9=events[_0xcb01('0x6')];_0x1b8ca8<_0x357bf9;_0x1b8ca8++){var _0x370bf7=events[_0x1b8ca8];var _0x57f028=createListener(_0xcb01('0x7')+_0x370bf7,_0x16b993);MailQueueEvents['on'](_0x370bf7,_0x57f028);}}; \ No newline at end of file +var _0xcbde=['mailQueue:','./mailQueue.events','remove','update','removeListener'];(function(_0x5763e2,_0x375e84){var _0x46f7fa=function(_0x1cf9b2){while(--_0x1cf9b2){_0x5763e2['push'](_0x5763e2['shift']());}};_0x46f7fa(++_0x375e84);}(_0xcbde,0x141));var _0xecbd=function(_0x37b08d,_0x26fb25){_0x37b08d=_0x37b08d-0x0;var _0x8af2a6=_0xcbde[_0x37b08d];return _0x8af2a6;};'use strict';var MailQueueEvents=require(_0xecbd('0x0'));var events=['save',_0xecbd('0x1'),_0xecbd('0x2')];function createListener(_0x2716db,_0x456f7f){return function(_0x1a4c26){_0x456f7f['emit'](_0x2716db,_0x1a4c26);};}function removeListener(_0x4ba743,_0x12470a){return function(){MailQueueEvents[_0xecbd('0x3')](_0x4ba743,_0x12470a);};}exports['register']=function(_0x25b899){for(var _0x27a04d=0x0,_0x545ca6=events['length'];_0x27a04d<_0x545ca6;_0x27a04d++){var _0x2947a0=events[_0x27a04d];var _0x3e9e7a=createListener(_0xecbd('0x4')+_0x2947a0,_0x25b899);MailQueueEvents['on'](_0x2947a0,_0x3e9e7a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index b06e687..9417fb0 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 _0x8aea=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x8aea,0x121));var _0xa8ae=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8aea[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xa8ae('0x0'));var util=require('util');var path=require(_0xa8ae('0x1'));var timeout=require(_0xa8ae('0x2'));var express=require(_0xa8ae('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(_0xa8ae('0x4'));var controller=require('./mailQueueReport.controller');router[_0xa8ae('0x5')]('/',auth[_0xa8ae('0x6')](),controller[_0xa8ae('0x7')]);router[_0xa8ae('0x5')](_0xa8ae('0x8'),auth[_0xa8ae('0x6')](),controller[_0xa8ae('0x9')]);router[_0xa8ae('0x5')](_0xa8ae('0xa'),auth[_0xa8ae('0x6')](),controller[_0xa8ae('0xb')]);router[_0xa8ae('0xc')]('/',auth['isAuthenticated'](),controller[_0xa8ae('0xd')]);router[_0xa8ae('0xe')](_0xa8ae('0xa'),auth[_0xa8ae('0x6')](),controller[_0xa8ae('0xf')]);router[_0xa8ae('0x10')](_0xa8ae('0xa'),auth['isAuthenticated'](),controller[_0xa8ae('0x11')]);module[_0xa8ae('0x12')]=router; \ No newline at end of file +var _0x4f3a=['isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get'];(function(_0x7f2354,_0xdac541){var _0x14fbc6=function(_0x2a9bd1){while(--_0x2a9bd1){_0x7f2354['push'](_0x7f2354['shift']());}};_0x14fbc6(++_0xdac541);}(_0x4f3a,0xc5));var _0xa4f3=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x4f3a[_0x2d3ab3];return _0x321f9e;};'use strict';var multer=require(_0xa4f3('0x0'));var util=require(_0xa4f3('0x1'));var path=require(_0xa4f3('0x2'));var timeout=require('connect-timeout');var express=require(_0xa4f3('0x3'));var router=express[_0xa4f3('0x4')]();var fs_extra=require(_0xa4f3('0x5'));var auth=require(_0xa4f3('0x6'));var interaction=require(_0xa4f3('0x7'));var config=require('../../config/environment');var controller=require(_0xa4f3('0x8'));router[_0xa4f3('0x9')]('/',auth[_0xa4f3('0xa')](),controller[_0xa4f3('0xb')]);router[_0xa4f3('0x9')](_0xa4f3('0xc'),auth[_0xa4f3('0xa')](),controller[_0xa4f3('0xd')]);router[_0xa4f3('0x9')]('/:id',auth[_0xa4f3('0xa')](),controller[_0xa4f3('0xe')]);router[_0xa4f3('0xf')]('/',auth[_0xa4f3('0xa')](),controller[_0xa4f3('0x10')]);router[_0xa4f3('0x11')](_0xa4f3('0x12'),auth[_0xa4f3('0xa')](),controller[_0xa4f3('0x13')]);router[_0xa4f3('0x14')](_0xa4f3('0x12'),auth[_0xa4f3('0xa')](),controller[_0xa4f3('0x15')]);module[_0xa4f3('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 30d7cde..d7b8dfd 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 _0x702c=['sequelize','exports','STRING','DATE','moment'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0x702c,0x1e4));var _0xc702=function(_0x4e300e,_0x2ecc96){_0x4e300e=_0x4e300e-0x0;var _0x49386b=_0x702c[_0x4e300e];return _0x49386b;};'use strict';var moment=require(_0xc702('0x0'));var Sequelize=require(_0xc702('0x1'));module[_0xc702('0x2')]={'uniqueid':{'type':Sequelize[_0xc702('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc702('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc702('0x4')]},'acceptAt':{'type':Sequelize[_0xc702('0x4')]},'exitAt':{'type':Sequelize[_0xc702('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa4f0=['moment','STRING','DATE'];(function(_0x1ea067,_0x29c0f2){var _0x2828d5=function(_0x2f1e20){while(--_0x2f1e20){_0x1ea067['push'](_0x1ea067['shift']());}};_0x2828d5(++_0x29c0f2);}(_0xa4f0,0x1c5));var _0x0a4f=function(_0x48dfc7,_0x28410f){_0x48dfc7=_0x48dfc7-0x0;var _0x553cbf=_0xa4f0[_0x48dfc7];return _0x553cbf;};'use strict';var moment=require(_0x0a4f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0a4f('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0a4f('0x2')]},'leaveAt':{'type':Sequelize[_0x0a4f('0x2')]},'acceptAt':{'type':Sequelize[_0x0a4f('0x2')]},'exitAt':{'type':Sequelize[_0x0a4f('0x2')]},'reason':{'type':Sequelize[_0x0a4f('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index b75c3ea..bd81146 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 _0x583c=['rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','MailQueueReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','eml-format'];(function(_0x3ff02b,_0x40ff09){var _0x108016=function(_0x532a52){while(--_0x532a52){_0x3ff02b['push'](_0x3ff02b['shift']());}};_0x108016(++_0x40ff09);}(_0x583c,0x12b));var _0xc583=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0x583c[_0x1fd9e7];return _0x1781f2;};'use strict';var emlformat=require(_0xc583('0x0'));var rimraf=require(_0xc583('0x1'));var zipdir=require(_0xc583('0x2'));var jsonpatch=require(_0xc583('0x3'));var rp=require('request-promise');var moment=require(_0xc583('0x4'));var BPromise=require(_0xc583('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc583('0x6'));var sox=require(_0xc583('0x7'));var csv=require('to-csv');var ejs=require(_0xc583('0x8'));var fs=require('fs');var fs_extra=require(_0xc583('0x9'));var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc583('0x17'))['db'];function respondWithStatusCode(_0x87632d,_0x24343b){_0x24343b=_0x24343b||0xcc;return function(_0x267da0){if(_0x267da0){return _0x87632d[_0xc583('0x18')](_0x24343b);}return _0x87632d[_0xc583('0x19')](_0x24343b)[_0xc583('0x1a')]();};}function respondWithResult(_0xf81809,_0x1c6b79){_0x1c6b79=_0x1c6b79||0xc8;return function(_0x5403a3){if(_0x5403a3){return _0xf81809[_0xc583('0x19')](_0x1c6b79)['json'](_0x5403a3);}};}function respondWithFilteredResult(_0x19f46a,_0x299fa1){return function(_0x510090){if(_0x510090){var _0x263552=typeof _0x299fa1[_0xc583('0x1b')]==='undefined'&&typeof _0x299fa1[_0xc583('0x1c')]===_0xc583('0x1d');var _0x5127fa=_0x510090[_0xc583('0x1e')];var _0x8a2d84=_0x263552?0x0:_0x299fa1[_0xc583('0x1b')];var _0x36e0fd=_0x263552?_0x510090['count']:_0x299fa1[_0xc583('0x1b')]+_0x299fa1['limit'];var _0x227ec2;if(_0x36e0fd>=_0x5127fa){_0x36e0fd=_0x5127fa;_0x227ec2=0xc8;}else{_0x227ec2=0xce;}_0x19f46a[_0xc583('0x19')](_0x227ec2);return _0x19f46a[_0xc583('0x1f')](_0xc583('0x20'),_0x8a2d84+'-'+_0x36e0fd+'/'+_0x5127fa)[_0xc583('0x21')](_0x510090);}return null;};}function patchUpdates(_0x12b910){return function(_0x3ce81b){try{jsonpatch[_0xc583('0x22')](_0x3ce81b,_0x12b910,!![]);}catch(_0x37fcd4){return BPromise[_0xc583('0x23')](_0x37fcd4);}return _0x3ce81b[_0xc583('0x24')]();};}function saveUpdates(_0x3b31bc,_0x21466f){return function(_0x478ee1){if(_0x478ee1){return _0x478ee1['update'](_0x3b31bc)[_0xc583('0x25')](function(_0x3e075c){return _0x3e075c;});}return null;};}function removeEntity(_0x8443dc,_0x5ceef1){return function(_0x1521e2){if(_0x1521e2){return _0x1521e2[_0xc583('0x26')]()[_0xc583('0x25')](function(){_0x8443dc[_0xc583('0x19')](0xcc)[_0xc583('0x1a')]();});}};}function handleEntityNotFound(_0x48c95e,_0x4cad36){return function(_0x45871c){if(!_0x45871c){_0x48c95e['sendStatus'](0x194);}return _0x45871c;};}function handleError(_0x45ef74,_0xcbe9b2){_0xcbe9b2=_0xcbe9b2||0x1f4;return function(_0xbabf24){logger[_0xc583('0x27')](_0xbabf24[_0xc583('0x28')]);if(_0xbabf24['name']){delete _0xbabf24[_0xc583('0x29')];}_0x45ef74[_0xc583('0x19')](_0xcbe9b2)['send'](_0xbabf24);};}exports[_0xc583('0x2a')]=function(_0x483357,_0x2c9088){var _0x8d4ecb={},_0x1c80b1={},_0x3ed083={'count':0x0,'rows':[]};var _0x1b2b49=_[_0xc583('0x2b')](db[_0xc583('0x2c')]['rawAttributes'],function(_0x529dbe){return{'name':_0x529dbe[_0xc583('0x2d')],'type':_0x529dbe[_0xc583('0x2e')][_0xc583('0x2f')]};});_0x1c80b1[_0xc583('0x30')]=_[_0xc583('0x2b')](_0x1b2b49,'name');_0x1c80b1[_0xc583('0x31')]=_['keys'](_0x483357['query']);_0x1c80b1[_0xc583('0x32')]=_[_0xc583('0x33')](_0x1c80b1[_0xc583('0x30')],_0x1c80b1[_0xc583('0x31')]);_0x8d4ecb[_0xc583('0x34')]=_['intersection'](_0x1c80b1[_0xc583('0x30')],qs[_0xc583('0x35')](_0x483357[_0xc583('0x31')]['fields']));_0x8d4ecb[_0xc583('0x34')]=_0x8d4ecb['attributes'][_0xc583('0x36')]?_0x8d4ecb[_0xc583('0x34')]:_0x1c80b1[_0xc583('0x30')];if(!_0x483357[_0xc583('0x31')][_0xc583('0x37')]('nolimit')){_0x8d4ecb[_0xc583('0x1c')]=qs['limit'](_0x483357[_0xc583('0x31')]['limit']);_0x8d4ecb[_0xc583('0x1b')]=qs[_0xc583('0x1b')](_0x483357[_0xc583('0x31')][_0xc583('0x1b')]);}_0x8d4ecb[_0xc583('0x38')]=qs[_0xc583('0x39')](_0x483357['query']['sort']);_0x8d4ecb[_0xc583('0x3a')]=qs[_0xc583('0x32')](_['pick'](_0x483357[_0xc583('0x31')],_0x1c80b1[_0xc583('0x32')]),_0x1b2b49);if(_0x483357[_0xc583('0x31')][_0xc583('0x3b')]){_0x8d4ecb[_0xc583('0x3a')]=_[_0xc583('0x3c')](_0x8d4ecb['where'],{'$or':_[_0xc583('0x2b')](_0x1b2b49,function(_0x595351){if(_0x595351[_0xc583('0x2e')]!==_0xc583('0x3d')){var _0x39bed4={};_0x39bed4[_0x595351['name']]={'$like':'%'+_0x483357['query']['filter']+'%'};return _0x39bed4;}})});}_0x8d4ecb=_[_0xc583('0x3c')]({},_0x8d4ecb,_0x483357[_0xc583('0x3e')]);var _0x2b957d={'where':_0x8d4ecb[_0xc583('0x3a')]};return db['MailQueueReport'][_0xc583('0x1e')](_0x2b957d)[_0xc583('0x25')](function(_0x594a0b){_0x3ed083['count']=_0x594a0b;if(_0x483357[_0xc583('0x31')]['includeAll']){_0x8d4ecb[_0xc583('0x3f')]=[{'all':!![]}];}return db[_0xc583('0x2c')][_0xc583('0x40')](_0x8d4ecb);})[_0xc583('0x25')](function(_0x58553e){_0x3ed083[_0xc583('0x41')]=_0x58553e;return _0x3ed083;})[_0xc583('0x25')](respondWithFilteredResult(_0x2c9088,_0x8d4ecb))[_0xc583('0x42')](handleError(_0x2c9088,null));};exports[_0xc583('0x43')]=function(_0x2c1c22,_0x5e6e7e){var _0x3ffeb7={'raw':!![],'where':{'id':_0x2c1c22['params']['id']}},_0x5f5a97={};_0x5f5a97[_0xc583('0x30')]=_[_0xc583('0x44')](db['MailQueueReport']['rawAttributes']);_0x5f5a97[_0xc583('0x31')]=_[_0xc583('0x44')](_0x2c1c22[_0xc583('0x31')]);_0x5f5a97[_0xc583('0x32')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],_0x5f5a97['query']);_0x3ffeb7[_0xc583('0x34')]=_['intersection'](_0x5f5a97[_0xc583('0x30')],qs[_0xc583('0x35')](_0x2c1c22[_0xc583('0x31')][_0xc583('0x35')]));_0x3ffeb7[_0xc583('0x34')]=_0x3ffeb7['attributes'][_0xc583('0x36')]?_0x3ffeb7[_0xc583('0x34')]:_0x5f5a97[_0xc583('0x30')];if(_0x2c1c22['query']['includeAll']){_0x3ffeb7['include']=[{'all':!![]}];}_0x3ffeb7=_[_0xc583('0x3c')]({},_0x3ffeb7,_0x2c1c22['options']);return db[_0xc583('0x2c')][_0xc583('0x45')](_0x3ffeb7)[_0xc583('0x25')](handleEntityNotFound(_0x5e6e7e,null))[_0xc583('0x25')](respondWithResult(_0x5e6e7e,null))[_0xc583('0x42')](handleError(_0x5e6e7e,null));};exports[_0xc583('0x46')]=function(_0x302038,_0x32cfbf){return db[_0xc583('0x2c')][_0xc583('0x46')](_0x302038[_0xc583('0x47')],{})['then'](respondWithResult(_0x32cfbf,0xc9))[_0xc583('0x42')](handleError(_0x32cfbf,null));};exports[_0xc583('0x48')]=function(_0x453df7,_0x230a45){if(_0x453df7['body']['id']){delete _0x453df7[_0xc583('0x47')]['id'];}return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x453df7[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x230a45,null))[_0xc583('0x25')](saveUpdates(_0x453df7[_0xc583('0x47')],null))[_0xc583('0x25')](respondWithResult(_0x230a45,null))[_0xc583('0x42')](handleError(_0x230a45,null));};exports['destroy']=function(_0x1f4901,_0x1919fa){return db[_0xc583('0x2c')][_0xc583('0x45')]({'where':{'id':_0x1f4901[_0xc583('0x49')]['id']}})[_0xc583('0x25')](handleEntityNotFound(_0x1919fa,null))[_0xc583('0x25')](removeEntity(_0x1919fa,null))[_0xc583('0x42')](handleError(_0x1919fa,null));};exports[_0xc583('0x4a')]=function(_0xa03d53,_0x1a0f91){return db[_0xc583('0x2c')][_0xc583('0x4a')]()['then'](respondWithResult(_0x1a0f91,null))[_0xc583('0x42')](handleError(_0x1a0f91,null));}; \ No newline at end of file +var _0x1893=['query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','map','VIRTUAL','filter','includeAll','include','catch','keys','merge','find','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','send','index','MailQueueReport','rawAttributes','type','key','model','name'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x1893,0xa2));var _0x3189=function(_0x3a218d,_0x340ffa){_0x3a218d=_0x3a218d-0x0;var _0x23580d=_0x1893[_0x3a218d];return _0x23580d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];function respondWithStatusCode(_0x5d9fff,_0x22b11e){_0x22b11e=_0x22b11e||0xcc;return function(_0x353b17){if(_0x353b17){return _0x5d9fff[_0x3189('0x19')](_0x22b11e);}return _0x5d9fff[_0x3189('0x1a')](_0x22b11e)[_0x3189('0x1b')]();};}function respondWithResult(_0x20dcc2,_0xef438){_0xef438=_0xef438||0xc8;return function(_0x25a917){if(_0x25a917){return _0x20dcc2['status'](_0xef438)[_0x3189('0x1c')](_0x25a917);}};}function respondWithFilteredResult(_0xb3e4c2,_0x1c209b){return function(_0x2fb62b){if(_0x2fb62b){var _0x486dd2=typeof _0x1c209b[_0x3189('0x1d')]==='undefined'&&typeof _0x1c209b['limit']===_0x3189('0x1e');var _0x49b1bc=_0x2fb62b[_0x3189('0x1f')];var _0xf8aed7=_0x486dd2?0x0:_0x1c209b[_0x3189('0x1d')];var _0x9905c4=_0x486dd2?_0x2fb62b['count']:_0x1c209b[_0x3189('0x1d')]+_0x1c209b[_0x3189('0x20')];var _0x16edd7;if(_0x9905c4>=_0x49b1bc){_0x9905c4=_0x49b1bc;_0x16edd7=0xc8;}else{_0x16edd7=0xce;}_0xb3e4c2['status'](_0x16edd7);return _0xb3e4c2[_0x3189('0x21')](_0x3189('0x22'),_0xf8aed7+'-'+_0x9905c4+'/'+_0x49b1bc)[_0x3189('0x1c')](_0x2fb62b);}return null;};}function patchUpdates(_0x2c1e59){return function(_0x29b275){try{jsonpatch['apply'](_0x29b275,_0x2c1e59,!![]);}catch(_0x1771a8){return BPromise[_0x3189('0x23')](_0x1771a8);}return _0x29b275[_0x3189('0x24')]();};}function saveUpdates(_0x539e12,_0x309c6e){return function(_0x47abb4){if(_0x47abb4){return _0x47abb4[_0x3189('0x25')](_0x539e12)[_0x3189('0x26')](function(_0x200f16){return _0x200f16;});}return null;};}function removeEntity(_0x38e56a,_0x1cbe33){return function(_0x393fcb){if(_0x393fcb){return _0x393fcb['destroy']()['then'](function(){_0x38e56a[_0x3189('0x1a')](0xcc)[_0x3189('0x1b')]();});}};}function handleEntityNotFound(_0x1dc1c8,_0x3cc1e5){return function(_0x103de4){if(!_0x103de4){_0x1dc1c8[_0x3189('0x19')](0x194);}return _0x103de4;};}function handleError(_0xdda38b,_0x379a48){_0x379a48=_0x379a48||0x1f4;return function(_0x17b540){logger[_0x3189('0x27')](_0x17b540['stack']);if(_0x17b540['name']){delete _0x17b540['name'];}_0xdda38b[_0x3189('0x1a')](_0x379a48)[_0x3189('0x28')](_0x17b540);};}exports[_0x3189('0x29')]=function(_0x90c31,_0x36b258){var _0x2f7504={},_0x4d453a={},_0x1ab94b={'count':0x0,'rows':[]};var _0x37b9ec=_['map'](db[_0x3189('0x2a')][_0x3189('0x2b')],function(_0x39c5e4){return{'name':_0x39c5e4['fieldName'],'type':_0x39c5e4[_0x3189('0x2c')][_0x3189('0x2d')]};});_0x4d453a[_0x3189('0x2e')]=_['map'](_0x37b9ec,_0x3189('0x2f'));_0x4d453a[_0x3189('0x30')]=_['keys'](_0x90c31[_0x3189('0x30')]);_0x4d453a[_0x3189('0x31')]=_[_0x3189('0x32')](_0x4d453a[_0x3189('0x2e')],_0x4d453a[_0x3189('0x30')]);_0x2f7504['attributes']=_['intersection'](_0x4d453a[_0x3189('0x2e')],qs['fields'](_0x90c31[_0x3189('0x30')][_0x3189('0x33')]));_0x2f7504[_0x3189('0x34')]=_0x2f7504[_0x3189('0x34')][_0x3189('0x35')]?_0x2f7504[_0x3189('0x34')]:_0x4d453a[_0x3189('0x2e')];if(!_0x90c31[_0x3189('0x30')][_0x3189('0x36')]('nolimit')){_0x2f7504[_0x3189('0x20')]=qs[_0x3189('0x20')](_0x90c31[_0x3189('0x30')][_0x3189('0x20')]);_0x2f7504[_0x3189('0x1d')]=qs[_0x3189('0x1d')](_0x90c31[_0x3189('0x30')]['offset']);}_0x2f7504['order']=qs[_0x3189('0x37')](_0x90c31['query'][_0x3189('0x37')]);_0x2f7504[_0x3189('0x38')]=qs['filters'](_[_0x3189('0x39')](_0x90c31[_0x3189('0x30')],_0x4d453a[_0x3189('0x31')]),_0x37b9ec);if(_0x90c31[_0x3189('0x30')]['filter']){_0x2f7504[_0x3189('0x38')]=_['merge'](_0x2f7504['where'],{'$or':_[_0x3189('0x3a')](_0x37b9ec,function(_0xed3041){if(_0xed3041[_0x3189('0x2c')]!==_0x3189('0x3b')){var _0x12dee0={};_0x12dee0[_0xed3041[_0x3189('0x2f')]]={'$like':'%'+_0x90c31[_0x3189('0x30')][_0x3189('0x3c')]+'%'};return _0x12dee0;}})});}_0x2f7504=_['merge']({},_0x2f7504,_0x90c31['options']);var _0x407e0a={'where':_0x2f7504[_0x3189('0x38')]};return db[_0x3189('0x2a')][_0x3189('0x1f')](_0x407e0a)[_0x3189('0x26')](function(_0xb52c70){_0x1ab94b['count']=_0xb52c70;if(_0x90c31[_0x3189('0x30')][_0x3189('0x3d')]){_0x2f7504[_0x3189('0x3e')]=[{'all':!![]}];}return db[_0x3189('0x2a')]['findAll'](_0x2f7504);})[_0x3189('0x26')](function(_0x2f0d49){_0x1ab94b['rows']=_0x2f0d49;return _0x1ab94b;})['then'](respondWithFilteredResult(_0x36b258,_0x2f7504))[_0x3189('0x3f')](handleError(_0x36b258,null));};exports['show']=function(_0x376787,_0x3074b9){var _0x38bf83={'raw':!![],'where':{'id':_0x376787['params']['id']}},_0x9593f3={};_0x9593f3[_0x3189('0x2e')]=_[_0x3189('0x40')](db['MailQueueReport'][_0x3189('0x2b')]);_0x9593f3[_0x3189('0x30')]=_[_0x3189('0x40')](_0x376787[_0x3189('0x30')]);_0x9593f3[_0x3189('0x31')]=_['intersection'](_0x9593f3['model'],_0x9593f3[_0x3189('0x30')]);_0x38bf83['attributes']=_[_0x3189('0x32')](_0x9593f3[_0x3189('0x2e')],qs[_0x3189('0x33')](_0x376787['query'][_0x3189('0x33')]));_0x38bf83[_0x3189('0x34')]=_0x38bf83[_0x3189('0x34')]['length']?_0x38bf83[_0x3189('0x34')]:_0x9593f3[_0x3189('0x2e')];if(_0x376787[_0x3189('0x30')][_0x3189('0x3d')]){_0x38bf83[_0x3189('0x3e')]=[{'all':!![]}];}_0x38bf83=_[_0x3189('0x41')]({},_0x38bf83,_0x376787['options']);return db['MailQueueReport'][_0x3189('0x42')](_0x38bf83)['then'](handleEntityNotFound(_0x3074b9,null))['then'](respondWithResult(_0x3074b9,null))[_0x3189('0x3f')](handleError(_0x3074b9,null));};exports['create']=function(_0x2d58fd,_0x1b6f09){return db[_0x3189('0x2a')]['create'](_0x2d58fd[_0x3189('0x43')],{})['then'](respondWithResult(_0x1b6f09,0xc9))[_0x3189('0x3f')](handleError(_0x1b6f09,null));};exports['update']=function(_0x49c4a8,_0x244166){if(_0x49c4a8['body']['id']){delete _0x49c4a8[_0x3189('0x43')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x49c4a8[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x244166,null))[_0x3189('0x26')](saveUpdates(_0x49c4a8[_0x3189('0x43')],null))[_0x3189('0x26')](respondWithResult(_0x244166,null))[_0x3189('0x3f')](handleError(_0x244166,null));};exports['destroy']=function(_0x21d446,_0x549bc7){return db['MailQueueReport'][_0x3189('0x42')]({'where':{'id':_0x21d446[_0x3189('0x44')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x549bc7,null))[_0x3189('0x26')](removeEntity(_0x549bc7,null))[_0x3189('0x3f')](handleError(_0x549bc7,null));};exports[_0x3189('0x45')]=function(_0x556ee5,_0x5117fb){return db['MailQueueReport'][_0x3189('0x45')]()[_0x3189('0x26')](respondWithResult(_0x5117fb,null))[_0x3189('0x3f')](handleError(_0x5117fb,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index cc6ed8f..9110608 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 _0x7c5a=['uniqueid','lodash','moment','bluebird','request-promise','path','rimraf','define','MailQueueReport'];(function(_0x1e393b,_0x355f6b){var _0x3d0bfe=function(_0x320830){while(--_0x320830){_0x1e393b['push'](_0x1e393b['shift']());}};_0x3d0bfe(++_0x355f6b);}(_0x7c5a,0xa3));var _0xa7c5=function(_0x2c46d2,_0x4d6258){_0x2c46d2=_0x2c46d2-0x0;var _0x4e1e11=_0x7c5a[_0x2c46d2];return _0x4e1e11;};'use strict';var _=require(_0xa7c5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa7c5('0x1'));var BPromise=require(_0xa7c5('0x2'));var rp=require(_0xa7c5('0x3'));var fs=require('fs');var path=require(_0xa7c5('0x4'));var rimraf=require(_0xa7c5('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x57ec7a,_0xb9f2a7){return _0x57ec7a[_0xa7c5('0x6')](_0xa7c5('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xa7c5('0x8'),'fields':[_0xa7c5('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd714=['MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x22b60b,_0x2825fe){var _0x198036=function(_0x4c69e3){while(--_0x4c69e3){_0x22b60b['push'](_0x22b60b['shift']());}};_0x198036(++_0x2825fe);}(_0xd714,0x1e4));var _0x4d71=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0xd714[_0x11f5ff];return _0x46eefb;};'use strict';var _=require(_0x4d71('0x0'));var util=require(_0x4d71('0x1'));var logger=require('../../config/logger')(_0x4d71('0x2'));var moment=require(_0x4d71('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d71('0x4'));var rimraf=require(_0x4d71('0x5'));var config=require(_0x4d71('0x6'));var attributes=require(_0x4d71('0x7'));module[_0x4d71('0x8')]=function(_0x154fa5,_0x3e04a6){return _0x154fa5[_0x4d71('0x9')](_0x4d71('0xa'),attributes,{'tableName':_0x4d71('0xb'),'paranoid':![],'indexes':[{'name':_0x4d71('0xc'),'fields':[_0x4d71('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 018afe7..6d918e5 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x231a00,_0x3637c2){var _0x21f4b8=function(_0x3c9db1){while(--_0x3c9db1){_0x231a00['push'](_0x231a00['shift']());}};_0x21f4b8(++_0x3637c2);}(_0x7a54,0x106));var _0x47a5=function(_0x110932,_0x155796){_0x110932=_0x110932-0x0;var _0x4899d4=_0x7a54[_0x110932];return _0x4899d4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +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(_0x5d3bf4,_0x1d72a4){var _0x428095=function(_0xfb414){while(--_0xfb414){_0x5d3bf4['push'](_0x5d3bf4['shift']());}};_0x428095(++_0x1d72a4);}(_0x1261,0x144));var _0x1126=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x1261[_0x45f951];return _0x24756c;};'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 c9d3048..4073d26 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(_0x2233f6,_0x14c6a2){var _0x5b5ad1=function(_0x558393){while(--_0x558393){_0x2233f6['push'](_0x2233f6['shift']());}};_0x5b5ad1(++_0x14c6a2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xcb91[_0x398294];return _0x2a872d;};'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(_0x21e79a,_0x5a7990){var _0x506c02=function(_0x566c95){while(--_0x566c95){_0x21e79a['push'](_0x21e79a['shift']());}};_0x506c02(++_0x5a7990);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'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 f79e89f..7818a67 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 _0x970d=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x545d6a,_0xe83bfa){var _0x554e15=function(_0x46329e){while(--_0x46329e){_0x545d6a['push'](_0x545d6a['shift']());}};_0x554e15(++_0xe83bfa);}(_0x970d,0xfd));var _0xd970=function(_0x1193ea,_0xc04ef0){_0x1193ea=_0x1193ea-0x0;var _0x5e4000=_0x970d[_0x1193ea];return _0x5e4000;};'use strict';var Sequelize=require(_0xd970('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xd970('0x1')]},'authentication':{'type':Sequelize[_0xd970('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xd970('0x1')]},'port':{'type':Sequelize[_0xd970('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd970('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xd970('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd970('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd970('0x1')]},'modernAuthentication':{'type':Sequelize[_0xd970('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd64b=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd64b,0x1ee));var _0xbd64=function(_0x594de8,_0x46d0d2){_0x594de8=_0x594de8-0x0;var _0x5fcbf=_0xd64b[_0x594de8];return _0x5fcbf;};'use strict';var Sequelize=require(_0xbd64('0x0'));module[_0xbd64('0x1')]={'description':{'type':Sequelize[_0xbd64('0x2')]},'host':{'type':Sequelize[_0xbd64('0x2')]},'authentication':{'type':Sequelize[_0xbd64('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xbd64('0x2')]},'password':{'type':Sequelize[_0xbd64('0x2')]},'port':{'type':Sequelize[_0xbd64('0x4')]},'tls':{'type':Sequelize[_0xbd64('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xbd64('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xbd64('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xbd64('0x2')]},'modernAuthentication':{'type':Sequelize[_0xbd64('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 cb32634..5e5f3a0 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 _0x3e15=['../../config/environment','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x46e1dc,_0x4c5b22){var _0x30bee6=function(_0x4b65ad){while(--_0x4b65ad){_0x46e1dc['push'](_0x46e1dc['shift']());}};_0x30bee6(++_0x4c5b22);}(_0x3e15,0x124));var _0x53e1=function(_0x118a07,_0x261e28){_0x118a07=_0x118a07-0x0;var _0x59c811=_0x3e15[_0x118a07];return _0x59c811;};'use strict';var _=require(_0x53e1('0x0'));var util=require(_0x53e1('0x1'));var logger=require(_0x53e1('0x2'))(_0x53e1('0x3'));var moment=require(_0x53e1('0x4'));var BPromise=require(_0x53e1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x53e1('0x6'));var rimraf=require(_0x53e1('0x7'));var config=require(_0x53e1('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x53e1('0x9')]=function(_0x21b9e3,_0x225ac9){return _0x21b9e3['define'](_0x53e1('0xa'),attributes,{'tableName':_0x53e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b31=['./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b5fb3,_0x15039f){var _0x5247af=function(_0x3a92b3){while(--_0x3a92b3){_0x1b5fb3['push'](_0x1b5fb3['shift']());}};_0x5247af(++_0x15039f);}(_0x0b31,0x1bc));var _0x10b3=function(_0x2bacd0,_0x30dc55){_0x2bacd0=_0x2bacd0-0x0;var _0x5f0cb6=_0x0b31[_0x2bacd0];return _0x5f0cb6;};'use strict';var _=require(_0x10b3('0x0'));var util=require(_0x10b3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x10b3('0x2'));var BPromise=require(_0x10b3('0x3'));var rp=require(_0x10b3('0x4'));var fs=require('fs');var path=require(_0x10b3('0x5'));var rimraf=require(_0x10b3('0x6'));var config=require('../../config/environment');var attributes=require(_0x10b3('0x7'));module[_0x10b3('0x8')]=function(_0x55ef86,_0x5437cb){return _0x55ef86[_0x10b3('0x9')]('MailServerIn',attributes,{'tableName':_0x10b3('0xa'),'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 4579970..5e9aa20 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 _0x8305=['model','GetMailServerIn','stringify','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','MailServerIn,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','catch','MailServerIn','options','raw','where','attributes','include','map'];(function(_0x363239,_0x269287){var _0x5b5c95=function(_0x38c3bc){while(--_0x38c3bc){_0x363239['push'](_0x363239['shift']());}};_0x5b5c95(++_0x269287);}(_0x8305,0x1d3));var _0x5830=function(_0x1f1ef5,_0x271f2a){_0x1f1ef5=_0x1f1ef5-0x0;var _0x3971e6=_0x8305[_0x1f1ef5];return _0x3971e6;};'use strict';var _=require(_0x5830('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5830('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5830('0x2'));var db=require(_0x5830('0x3'))['db'];var utils=require(_0x5830('0x4'));var logger=require(_0x5830('0x5'))(_0x5830('0x6'));var config=require(_0x5830('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5830('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5298fb,_0x51e44f,_0x1dc85c){return new BPromise(function(_0x34809a,_0x4bb686){return client[_0x5830('0x9')](_0x5298fb,_0x1dc85c)[_0x5830('0xa')](function(_0x19b969){logger['info'](_0x5830('0xb'),_0x51e44f,'request\x20sent');logger[_0x5830('0xc')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x51e44f,'request\x20sent',JSON['stringify'](_0x19b969));if(_0x19b969[_0x5830('0xd')]){if(_0x19b969[_0x5830('0xd')][_0x5830('0xe')]===0x1f4){logger[_0x5830('0xd')](_0x5830('0xb'),_0x51e44f,_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);return _0x4bb686(_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);}logger[_0x5830('0xd')](_0x5830('0xb'),_0x51e44f,_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);return _0x34809a(_0x19b969[_0x5830('0xd')]['message']);}else{logger[_0x5830('0x10')]('MailServerIn,\x20%s,\x20%s',_0x51e44f,_0x5830('0x11'));_0x34809a(_0x19b969['result'][_0x5830('0xf')]);}})[_0x5830('0x12')](function(_0x37a8e2){logger['error'](_0x5830('0xb'),_0x51e44f,_0x37a8e2);_0x4bb686(_0x37a8e2);});});}exports['GetMailServerIn']=function(_0x1d3450){var _0x55f311=this;return new Promise(function(_0x3e5ae3,_0x28b58f){return db[_0x5830('0x13')]['findAll']({'raw':_0x1d3450[_0x5830('0x14')]?_0x1d3450[_0x5830('0x14')][_0x5830('0x15')]===undefined?!![]:![]:!![],'where':_0x1d3450[_0x5830('0x14')]?_0x1d3450[_0x5830('0x14')][_0x5830('0x16')]||null:null,'attributes':_0x1d3450[_0x5830('0x14')]?_0x1d3450[_0x5830('0x14')][_0x5830('0x17')]||null:null,'limit':_0x1d3450[_0x5830('0x14')]?_0x1d3450['options']['limit']||null:null,'include':_0x1d3450[_0x5830('0x14')]?_0x1d3450[_0x5830('0x14')][_0x5830('0x18')]?_[_0x5830('0x19')](_0x1d3450[_0x5830('0x14')][_0x5830('0x18')],function(_0x41c7ec){return{'model':db[_0x41c7ec[_0x5830('0x1a')]],'as':_0x41c7ec['as'],'attributes':_0x41c7ec[_0x5830('0x17')],'include':_0x41c7ec[_0x5830('0x18')]?_[_0x5830('0x19')](_0x41c7ec[_0x5830('0x18')],function(_0xcc13ca){return{'model':db[_0xcc13ca[_0x5830('0x1a')]],'as':_0xcc13ca['as'],'attributes':_0xcc13ca[_0x5830('0x17')],'include':_0xcc13ca[_0x5830('0x18')]?_[_0x5830('0x19')](_0xcc13ca['include'],function(_0x30d9e8){return{'model':db[_0x30d9e8[_0x5830('0x1a')]],'as':_0x30d9e8['as'],'attributes':_0x30d9e8[_0x5830('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5830('0xa')](function(_0x12041c){logger[_0x5830('0x10')](_0x5830('0x1b'),_0x1d3450);logger[_0x5830('0xc')]('GetMailServerIn',_0x1d3450,JSON[_0x5830('0x1c')](_0x12041c));_0x3e5ae3(_0x12041c);})[_0x5830('0x12')](function(_0x172b01){logger['error']('GetMailServerIn',_0x172b01[_0x5830('0xf')],_0x1d3450);_0x28b58f(_0x55f311['error'](0x1f4,_0x172b01[_0x5830('0xf')]));});});}; \ No newline at end of file +var _0x8d37=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2726a9,_0x5b256e){var _0x2e153d=function(_0x54672f){while(--_0x54672f){_0x2726a9['push'](_0x2726a9['shift']());}};_0x2e153d(++_0x5b256e);}(_0x8d37,0x1d5));var _0x78d3=function(_0x92e599,_0x5d3b70){_0x92e599=_0x92e599-0x0;var _0x1825ba=_0x8d37[_0x92e599];return _0x1825ba;};'use strict';var _=require(_0x78d3('0x0'));var util=require(_0x78d3('0x1'));var moment=require(_0x78d3('0x2'));var BPromise=require(_0x78d3('0x3'));var rs=require(_0x78d3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78d3('0x5'))['db'];var utils=require(_0x78d3('0x6'));var logger=require(_0x78d3('0x7'))(_0x78d3('0x8'));var config=require(_0x78d3('0x9'));var jayson=require(_0x78d3('0xa'));var client=jayson[_0x78d3('0xb')][_0x78d3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ad1fd,_0x8cfd85,_0x865e71){return new BPromise(function(_0x202243,_0x38da43){return client[_0x78d3('0xd')](_0x4ad1fd,_0x865e71)[_0x78d3('0xe')](function(_0x44ef49){logger[_0x78d3('0xf')](_0x78d3('0x10'),_0x8cfd85,_0x78d3('0x11'));logger[_0x78d3('0x12')](_0x78d3('0x13'),_0x8cfd85,_0x78d3('0x11'),JSON[_0x78d3('0x14')](_0x44ef49));if(_0x44ef49[_0x78d3('0x15')]){if(_0x44ef49[_0x78d3('0x15')][_0x78d3('0x16')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x8cfd85,_0x44ef49[_0x78d3('0x15')][_0x78d3('0x17')]);return _0x38da43(_0x44ef49['error'][_0x78d3('0x17')]);}logger['error'](_0x78d3('0x10'),_0x8cfd85,_0x44ef49[_0x78d3('0x15')][_0x78d3('0x17')]);return _0x202243(_0x44ef49[_0x78d3('0x15')][_0x78d3('0x17')]);}else{logger[_0x78d3('0xf')](_0x78d3('0x10'),_0x8cfd85,_0x78d3('0x11'));_0x202243(_0x44ef49['result'][_0x78d3('0x17')]);}})[_0x78d3('0x18')](function(_0x4ad1c5){logger[_0x78d3('0x15')](_0x78d3('0x10'),_0x8cfd85,_0x4ad1c5);_0x38da43(_0x4ad1c5);});});}exports[_0x78d3('0x19')]=function(_0x32c53e){var _0x23ecca=this;return new Promise(function(_0x4ffecd,_0x123c35){return db[_0x78d3('0x1a')][_0x78d3('0x1b')]({'raw':_0x32c53e[_0x78d3('0x1c')]?_0x32c53e[_0x78d3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x32c53e[_0x78d3('0x1c')]?_0x32c53e[_0x78d3('0x1c')][_0x78d3('0x1d')]||null:null,'attributes':_0x32c53e[_0x78d3('0x1c')]?_0x32c53e['options'][_0x78d3('0x1e')]||null:null,'limit':_0x32c53e['options']?_0x32c53e['options']['limit']||null:null,'include':_0x32c53e['options']?_0x32c53e[_0x78d3('0x1c')][_0x78d3('0x1f')]?_['map'](_0x32c53e[_0x78d3('0x1c')][_0x78d3('0x1f')],function(_0x34594f){return{'model':db[_0x34594f[_0x78d3('0x20')]],'as':_0x34594f['as'],'attributes':_0x34594f['attributes'],'include':_0x34594f[_0x78d3('0x1f')]?_[_0x78d3('0x21')](_0x34594f[_0x78d3('0x1f')],function(_0x12a317){return{'model':db[_0x12a317[_0x78d3('0x20')]],'as':_0x12a317['as'],'attributes':_0x12a317[_0x78d3('0x1e')],'include':_0x12a317['include']?_[_0x78d3('0x21')](_0x12a317[_0x78d3('0x1f')],function(_0x166cd7){return{'model':db[_0x166cd7[_0x78d3('0x20')]],'as':_0x166cd7['as'],'attributes':_0x166cd7[_0x78d3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x78d3('0xe')](function(_0x28a5f2){logger['info']('GetMailServerIn',_0x32c53e);logger[_0x78d3('0x12')](_0x78d3('0x19'),_0x32c53e,JSON['stringify'](_0x28a5f2));_0x4ffecd(_0x28a5f2);})[_0x78d3('0x18')](function(_0x128c00){logger[_0x78d3('0x15')](_0x78d3('0x19'),_0x128c00[_0x78d3('0x17')],_0x32c53e);_0x123c35(_0x23ecca['error'](0x1f4,_0x128c00['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 76f6e1d..a3d49e8 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +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(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7a54,0x106));var _0x47a5=function(_0x4f6f1e,_0x3c6431){_0x4f6f1e=_0x4f6f1e-0x0;var _0x2699e0=_0x7a54[_0x4f6f1e];return _0x2699e0;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 2a88c13..c2d6485 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 _0x80ed=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0x80ed,0x11c));var _0xd80e=function(_0x5589f2,_0x3dec91){_0x5589f2=_0x5589f2-0x0;var _0x4ad62d=_0x80ed[_0x5589f2];return _0x4ad62d;};'use strict';var Sequelize=require(_0xd80e('0x0'));module['exports']={'description':{'type':Sequelize[_0xd80e('0x1')]},'host':{'type':Sequelize[_0xd80e('0x1')]},'user':{'type':Sequelize[_0xd80e('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd80e('0x2')]},'secure':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xd80e('0x1')]},'authentication':{'type':Sequelize[_0xd80e('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4483=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x5a5fbe,_0xbad7ce){var _0x59c38b=function(_0x5d7874){while(--_0x5d7874){_0x5a5fbe['push'](_0x5a5fbe['shift']());}};_0x59c38b(++_0xbad7ce);}(_0x4483,0x1a3));var _0x3448=function(_0x107e46,_0x3c1976){_0x107e46=_0x107e46-0x0;var _0x5dde6a=_0x4483[_0x107e46];return _0x5dde6a;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'description':{'type':Sequelize[_0x3448('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x3448('0x2')]},'pass':{'type':Sequelize[_0x3448('0x2')]},'port':{'type':Sequelize[_0x3448('0x3')]},'secure':{'type':Sequelize[_0x3448('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x3448('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3448('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 90bae71..d561ec8 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 _0x054c=['save','update','then','destroy','sendStatus','error','stack','name','send','MailServerOut','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject'];(function(_0x227839,_0x530c9e){var _0x32b9bc=function(_0x1cebfe){while(--_0x1cebfe){_0x227839['push'](_0x227839['shift']());}};_0x32b9bc(++_0x530c9e);}(_0x054c,0x1de));var _0xc054=function(_0x35f7d2,_0x28a49e){_0x35f7d2=_0x35f7d2-0x0;var _0x4c9429=_0x054c[_0x35f7d2];return _0x4c9429;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc054('0x0'));var rp=require('request-promise');var moment=require(_0xc054('0x1'));var BPromise=require(_0xc054('0x2'));var Mustache=require(_0xc054('0x3'));var util=require(_0xc054('0x4'));var path=require(_0xc054('0x5'));var sox=require(_0xc054('0x6'));var csv=require(_0xc054('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc054('0x8'));var _=require(_0xc054('0x9'));var squel=require(_0xc054('0xa'));var crypto=require('crypto');var jsforce=require(_0xc054('0xb'));var deskjs=require(_0xc054('0xc'));var toCsv=require(_0xc054('0x7'));var querystring=require(_0xc054('0xd'));var Papa=require(_0xc054('0xe'));var Redis=require(_0xc054('0xf'));var authService=require(_0xc054('0x10'));var qs=require(_0xc054('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc054('0x12'))(_0xc054('0x13'));var utils=require(_0xc054('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc054('0x15'));var db=require(_0xc054('0x16'))['db'];function respondWithStatusCode(_0x239576,_0x145bb3){_0x145bb3=_0x145bb3||0xcc;return function(_0x50e1a2){if(_0x50e1a2){return _0x239576['sendStatus'](_0x145bb3);}return _0x239576[_0xc054('0x17')](_0x145bb3)[_0xc054('0x18')]();};}function respondWithResult(_0x1ce8c2,_0x3567d2){_0x3567d2=_0x3567d2||0xc8;return function(_0x4ebb3e){if(_0x4ebb3e){return _0x1ce8c2[_0xc054('0x17')](_0x3567d2)[_0xc054('0x19')](_0x4ebb3e);}};}function respondWithFilteredResult(_0x266430,_0x3e02fc){return function(_0x43a2cc){if(_0x43a2cc){var _0x40d519=typeof _0x3e02fc[_0xc054('0x1a')]==='undefined'&&typeof _0x3e02fc['limit']===_0xc054('0x1b');var _0x58aceb=_0x43a2cc['count'];var _0x399463=_0x40d519?0x0:_0x3e02fc[_0xc054('0x1a')];var _0x378ee9=_0x40d519?_0x43a2cc[_0xc054('0x1c')]:_0x3e02fc[_0xc054('0x1a')]+_0x3e02fc['limit'];var _0x19bf0d;if(_0x378ee9>=_0x58aceb){_0x378ee9=_0x58aceb;_0x19bf0d=0xc8;}else{_0x19bf0d=0xce;}_0x266430['status'](_0x19bf0d);return _0x266430[_0xc054('0x1d')](_0xc054('0x1e'),_0x399463+'-'+_0x378ee9+'/'+_0x58aceb)[_0xc054('0x19')](_0x43a2cc);}return null;};}function patchUpdates(_0x3fef53){return function(_0x557d6f){try{jsonpatch[_0xc054('0x1f')](_0x557d6f,_0x3fef53,!![]);}catch(_0x30d5a1){return BPromise[_0xc054('0x20')](_0x30d5a1);}return _0x557d6f[_0xc054('0x21')]();};}function saveUpdates(_0x4d9206,_0x1a75e6){return function(_0x513c08){if(_0x513c08){return _0x513c08[_0xc054('0x22')](_0x4d9206)[_0xc054('0x23')](function(_0x426238){return _0x426238;});}return null;};}function removeEntity(_0x5fed37,_0x17f4d9){return function(_0xb9b7cb){if(_0xb9b7cb){return _0xb9b7cb[_0xc054('0x24')]()[_0xc054('0x23')](function(){_0x5fed37[_0xc054('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c56f4,_0x3f151d){return function(_0x5184f9){if(!_0x5184f9){_0x3c56f4[_0xc054('0x25')](0x194);}return _0x5184f9;};}function handleError(_0xfc0e38,_0x4a08a5){_0x4a08a5=_0x4a08a5||0x1f4;return function(_0x29d153){logger[_0xc054('0x26')](_0x29d153[_0xc054('0x27')]);if(_0x29d153[_0xc054('0x28')]){delete _0x29d153['name'];}_0xfc0e38['status'](_0x4a08a5)[_0xc054('0x29')](_0x29d153);};}exports['index']=function(_0x5b3e5c,_0x1f0a6){var _0x3bf42d={},_0x47688b={},_0x2c5266={'count':0x0,'rows':[]};var _0x5058f1=_['map'](db[_0xc054('0x2a')]['rawAttributes'],function(_0x294d7f){return{'name':_0x294d7f['fieldName'],'type':_0x294d7f[_0xc054('0x2b')][_0xc054('0x2c')]};});_0x47688b['model']=_[_0xc054('0x2d')](_0x5058f1,'name');_0x47688b['query']=_[_0xc054('0x2e')](_0x5b3e5c[_0xc054('0x2f')]);_0x47688b[_0xc054('0x30')]=_[_0xc054('0x31')](_0x47688b[_0xc054('0x32')],_0x47688b[_0xc054('0x2f')]);_0x3bf42d[_0xc054('0x33')]=_['intersection'](_0x47688b[_0xc054('0x32')],qs[_0xc054('0x34')](_0x5b3e5c[_0xc054('0x2f')][_0xc054('0x34')]));_0x3bf42d['attributes']=_0x3bf42d[_0xc054('0x33')][_0xc054('0x35')]?_0x3bf42d['attributes']:_0x47688b[_0xc054('0x32')];if(!_0x5b3e5c[_0xc054('0x2f')][_0xc054('0x36')](_0xc054('0x37'))){_0x3bf42d[_0xc054('0x38')]=qs['limit'](_0x5b3e5c[_0xc054('0x2f')][_0xc054('0x38')]);_0x3bf42d['offset']=qs[_0xc054('0x1a')](_0x5b3e5c['query'][_0xc054('0x1a')]);}_0x3bf42d[_0xc054('0x39')]=qs[_0xc054('0x3a')](_0x5b3e5c[_0xc054('0x2f')][_0xc054('0x3a')]);_0x3bf42d[_0xc054('0x3b')]=qs['filters'](_[_0xc054('0x3c')](_0x5b3e5c[_0xc054('0x2f')],_0x47688b[_0xc054('0x30')]),_0x5058f1);if(_0x5b3e5c[_0xc054('0x2f')][_0xc054('0x3d')]){_0x3bf42d[_0xc054('0x3b')]=_[_0xc054('0x3e')](_0x3bf42d[_0xc054('0x3b')],{'$or':_[_0xc054('0x2d')](_0x5058f1,function(_0x36f0b2){if(_0x36f0b2[_0xc054('0x2b')]!=='VIRTUAL'){var _0x2b1acf={};_0x2b1acf[_0x36f0b2[_0xc054('0x28')]]={'$like':'%'+_0x5b3e5c['query'][_0xc054('0x3d')]+'%'};return _0x2b1acf;}})});}_0x3bf42d=_[_0xc054('0x3e')]({},_0x3bf42d,_0x5b3e5c[_0xc054('0x3f')]);var _0x36224={'where':_0x3bf42d[_0xc054('0x3b')]};return db[_0xc054('0x2a')]['count'](_0x36224)[_0xc054('0x23')](function(_0x102f2c){_0x2c5266[_0xc054('0x1c')]=_0x102f2c;if(_0x5b3e5c[_0xc054('0x2f')]['includeAll']){_0x3bf42d['include']=[{'all':!![]}];}return db[_0xc054('0x2a')][_0xc054('0x40')](_0x3bf42d);})['then'](function(_0x67d4e1){_0x2c5266['rows']=_0x67d4e1;return _0x2c5266;})[_0xc054('0x23')](respondWithFilteredResult(_0x1f0a6,_0x3bf42d))[_0xc054('0x41')](handleError(_0x1f0a6,null));};exports[_0xc054('0x42')]=function(_0x16e09b,_0x34bccf){var _0x5f70ba={'raw':!![],'where':{'id':_0x16e09b[_0xc054('0x43')]['id']}},_0x39ffe5={};_0x39ffe5[_0xc054('0x32')]=_[_0xc054('0x2e')](db[_0xc054('0x2a')][_0xc054('0x44')]);_0x39ffe5[_0xc054('0x2f')]=_[_0xc054('0x2e')](_0x16e09b[_0xc054('0x2f')]);_0x39ffe5[_0xc054('0x30')]=_[_0xc054('0x31')](_0x39ffe5[_0xc054('0x32')],_0x39ffe5['query']);_0x5f70ba[_0xc054('0x33')]=_[_0xc054('0x31')](_0x39ffe5[_0xc054('0x32')],qs[_0xc054('0x34')](_0x16e09b[_0xc054('0x2f')]['fields']));_0x5f70ba[_0xc054('0x33')]=_0x5f70ba['attributes'][_0xc054('0x35')]?_0x5f70ba['attributes']:_0x39ffe5[_0xc054('0x32')];if(_0x16e09b['query'][_0xc054('0x45')]){_0x5f70ba['include']=[{'all':!![]}];}_0x5f70ba=_[_0xc054('0x3e')]({},_0x5f70ba,_0x16e09b[_0xc054('0x3f')]);return db[_0xc054('0x2a')][_0xc054('0x46')](_0x5f70ba)[_0xc054('0x23')](handleEntityNotFound(_0x34bccf,null))[_0xc054('0x23')](respondWithResult(_0x34bccf,null))[_0xc054('0x41')](handleError(_0x34bccf,null));};exports[_0xc054('0x47')]=function(_0x47b83b,_0x41e3c8){return db[_0xc054('0x2a')][_0xc054('0x47')](_0x47b83b[_0xc054('0x48')],{})[_0xc054('0x23')](respondWithResult(_0x41e3c8,0xc9))[_0xc054('0x41')](handleError(_0x41e3c8,null));};exports[_0xc054('0x22')]=function(_0x4f1173,_0xb053eb){if(_0x4f1173[_0xc054('0x48')]['id']){delete _0x4f1173[_0xc054('0x48')]['id'];}return db[_0xc054('0x2a')][_0xc054('0x46')]({'where':{'id':_0x4f1173[_0xc054('0x43')]['id']}})[_0xc054('0x23')](handleEntityNotFound(_0xb053eb,null))['then'](saveUpdates(_0x4f1173[_0xc054('0x48')],null))[_0xc054('0x23')](respondWithResult(_0xb053eb,null))['catch'](handleError(_0xb053eb,null));};exports[_0xc054('0x24')]=function(_0xb3b2d,_0xe836b0){return db[_0xc054('0x2a')][_0xc054('0x46')]({'where':{'id':_0xb3b2d[_0xc054('0x43')]['id']}})['then'](handleEntityNotFound(_0xe836b0,null))[_0xc054('0x23')](removeEntity(_0xe836b0,null))[_0xc054('0x41')](handleError(_0xe836b0,null));}; \ No newline at end of file +var _0x1f75=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','includeAll','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1f75,0xed));var _0x51f7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1f75[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x51f7('0x0'));var rimraf=require(_0x51f7('0x1'));var zipdir=require(_0x51f7('0x2'));var jsonpatch=require(_0x51f7('0x3'));var rp=require(_0x51f7('0x4'));var moment=require(_0x51f7('0x5'));var BPromise=require(_0x51f7('0x6'));var Mustache=require(_0x51f7('0x7'));var util=require(_0x51f7('0x8'));var path=require(_0x51f7('0x9'));var sox=require(_0x51f7('0xa'));var csv=require('to-csv');var ejs=require(_0x51f7('0xb'));var fs=require('fs');var fs_extra=require(_0x51f7('0xc'));var _=require(_0x51f7('0xd'));var squel=require(_0x51f7('0xe'));var crypto=require(_0x51f7('0xf'));var jsforce=require(_0x51f7('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x51f7('0x11'));var Papa=require(_0x51f7('0x12'));var Redis=require(_0x51f7('0x13'));var authService=require(_0x51f7('0x14'));var qs=require(_0x51f7('0x15'));var as=require(_0x51f7('0x16'));var hardwareService=require(_0x51f7('0x17'));var logger=require('../../config/logger')(_0x51f7('0x18'));var utils=require(_0x51f7('0x19'));var config=require(_0x51f7('0x1a'));var licenseUtil=require(_0x51f7('0x1b'));var db=require(_0x51f7('0x1c'))['db'];function respondWithStatusCode(_0x567564,_0x22badf){_0x22badf=_0x22badf||0xcc;return function(_0x5ddb35){if(_0x5ddb35){return _0x567564[_0x51f7('0x1d')](_0x22badf);}return _0x567564[_0x51f7('0x1e')](_0x22badf)[_0x51f7('0x1f')]();};}function respondWithResult(_0x2c670f,_0x3fec0d){_0x3fec0d=_0x3fec0d||0xc8;return function(_0x65594e){if(_0x65594e){return _0x2c670f[_0x51f7('0x1e')](_0x3fec0d)[_0x51f7('0x20')](_0x65594e);}};}function respondWithFilteredResult(_0x50aa01,_0x273b95){return function(_0x43c681){if(_0x43c681){var _0x5d33d8=typeof _0x273b95[_0x51f7('0x21')]===_0x51f7('0x22')&&typeof _0x273b95['limit']===_0x51f7('0x22');var _0x4e78f3=_0x43c681[_0x51f7('0x23')];var _0x5475b2=_0x5d33d8?0x0:_0x273b95[_0x51f7('0x21')];var _0x35cae8=_0x5d33d8?_0x43c681[_0x51f7('0x23')]:_0x273b95[_0x51f7('0x21')]+_0x273b95[_0x51f7('0x24')];var _0x5c2b31;if(_0x35cae8>=_0x4e78f3){_0x35cae8=_0x4e78f3;_0x5c2b31=0xc8;}else{_0x5c2b31=0xce;}_0x50aa01[_0x51f7('0x1e')](_0x5c2b31);return _0x50aa01[_0x51f7('0x25')](_0x51f7('0x26'),_0x5475b2+'-'+_0x35cae8+'/'+_0x4e78f3)['json'](_0x43c681);}return null;};}function patchUpdates(_0x2f96b7){return function(_0x56afe1){try{jsonpatch[_0x51f7('0x27')](_0x56afe1,_0x2f96b7,!![]);}catch(_0x5c826a){return BPromise['reject'](_0x5c826a);}return _0x56afe1[_0x51f7('0x28')]();};}function saveUpdates(_0x3c3c38,_0x52535e){return function(_0x5d9b3a){if(_0x5d9b3a){return _0x5d9b3a['update'](_0x3c3c38)[_0x51f7('0x29')](function(_0x35d722){return _0x35d722;});}return null;};}function removeEntity(_0x2011b5,_0x5ae0d1){return function(_0x10f081){if(_0x10f081){return _0x10f081[_0x51f7('0x2a')]()[_0x51f7('0x29')](function(){_0x2011b5[_0x51f7('0x1e')](0xcc)[_0x51f7('0x1f')]();});}};}function handleEntityNotFound(_0x49f46c,_0x2655f5){return function(_0x5e8d36){if(!_0x5e8d36){_0x49f46c['sendStatus'](0x194);}return _0x5e8d36;};}function handleError(_0x17bf2a,_0x12436f){_0x12436f=_0x12436f||0x1f4;return function(_0xccc7cf){logger[_0x51f7('0x2b')](_0xccc7cf[_0x51f7('0x2c')]);if(_0xccc7cf[_0x51f7('0x2d')]){delete _0xccc7cf['name'];}_0x17bf2a['status'](_0x12436f)[_0x51f7('0x2e')](_0xccc7cf);};}exports[_0x51f7('0x2f')]=function(_0x18a647,_0x1c5f5f){var _0x5d1285={},_0x16caf7={},_0x90dd08={'count':0x0,'rows':[]};var _0x36b19c=_[_0x51f7('0x30')](db[_0x51f7('0x31')][_0x51f7('0x32')],function(_0x39a79f){return{'name':_0x39a79f[_0x51f7('0x33')],'type':_0x39a79f[_0x51f7('0x34')][_0x51f7('0x35')]};});_0x16caf7['model']=_[_0x51f7('0x30')](_0x36b19c,_0x51f7('0x2d'));_0x16caf7[_0x51f7('0x36')]=_['keys'](_0x18a647[_0x51f7('0x36')]);_0x16caf7[_0x51f7('0x37')]=_[_0x51f7('0x38')](_0x16caf7[_0x51f7('0x39')],_0x16caf7[_0x51f7('0x36')]);_0x5d1285[_0x51f7('0x3a')]=_[_0x51f7('0x38')](_0x16caf7[_0x51f7('0x39')],qs[_0x51f7('0x3b')](_0x18a647[_0x51f7('0x36')]['fields']));_0x5d1285[_0x51f7('0x3a')]=_0x5d1285[_0x51f7('0x3a')][_0x51f7('0x3c')]?_0x5d1285[_0x51f7('0x3a')]:_0x16caf7['model'];if(!_0x18a647[_0x51f7('0x36')][_0x51f7('0x3d')](_0x51f7('0x3e'))){_0x5d1285[_0x51f7('0x24')]=qs[_0x51f7('0x24')](_0x18a647[_0x51f7('0x36')]['limit']);_0x5d1285[_0x51f7('0x21')]=qs['offset'](_0x18a647[_0x51f7('0x36')][_0x51f7('0x21')]);}_0x5d1285[_0x51f7('0x3f')]=qs[_0x51f7('0x40')](_0x18a647['query'][_0x51f7('0x40')]);_0x5d1285[_0x51f7('0x41')]=qs[_0x51f7('0x37')](_[_0x51f7('0x42')](_0x18a647[_0x51f7('0x36')],_0x16caf7[_0x51f7('0x37')]),_0x36b19c);if(_0x18a647[_0x51f7('0x36')][_0x51f7('0x43')]){_0x5d1285['where']=_['merge'](_0x5d1285['where'],{'$or':_[_0x51f7('0x30')](_0x36b19c,function(_0x39dbb6){if(_0x39dbb6[_0x51f7('0x34')]!==_0x51f7('0x44')){var _0x43df0c={};_0x43df0c[_0x39dbb6['name']]={'$like':'%'+_0x18a647['query'][_0x51f7('0x43')]+'%'};return _0x43df0c;}})});}_0x5d1285=_[_0x51f7('0x45')]({},_0x5d1285,_0x18a647[_0x51f7('0x46')]);var _0x76623a={'where':_0x5d1285[_0x51f7('0x41')]};return db['MailServerOut'][_0x51f7('0x23')](_0x76623a)[_0x51f7('0x29')](function(_0x30dc72){_0x90dd08[_0x51f7('0x23')]=_0x30dc72;if(_0x18a647[_0x51f7('0x36')]['includeAll']){_0x5d1285[_0x51f7('0x47')]=[{'all':!![]}];}return db[_0x51f7('0x31')][_0x51f7('0x48')](_0x5d1285);})['then'](function(_0x1b6e1d){_0x90dd08[_0x51f7('0x49')]=_0x1b6e1d;return _0x90dd08;})[_0x51f7('0x29')](respondWithFilteredResult(_0x1c5f5f,_0x5d1285))[_0x51f7('0x4a')](handleError(_0x1c5f5f,null));};exports['show']=function(_0x4583ae,_0x26bac1){var _0x259aff={'raw':!![],'where':{'id':_0x4583ae[_0x51f7('0x4b')]['id']}},_0x1860b2={};_0x1860b2[_0x51f7('0x39')]=_[_0x51f7('0x4c')](db['MailServerOut'][_0x51f7('0x32')]);_0x1860b2[_0x51f7('0x36')]=_[_0x51f7('0x4c')](_0x4583ae['query']);_0x1860b2[_0x51f7('0x37')]=_[_0x51f7('0x38')](_0x1860b2[_0x51f7('0x39')],_0x1860b2['query']);_0x259aff[_0x51f7('0x3a')]=_[_0x51f7('0x38')](_0x1860b2[_0x51f7('0x39')],qs[_0x51f7('0x3b')](_0x4583ae[_0x51f7('0x36')][_0x51f7('0x3b')]));_0x259aff[_0x51f7('0x3a')]=_0x259aff[_0x51f7('0x3a')][_0x51f7('0x3c')]?_0x259aff[_0x51f7('0x3a')]:_0x1860b2[_0x51f7('0x39')];if(_0x4583ae[_0x51f7('0x36')][_0x51f7('0x4d')]){_0x259aff[_0x51f7('0x47')]=[{'all':!![]}];}_0x259aff=_[_0x51f7('0x45')]({},_0x259aff,_0x4583ae[_0x51f7('0x46')]);return db[_0x51f7('0x31')]['find'](_0x259aff)['then'](handleEntityNotFound(_0x26bac1,null))[_0x51f7('0x29')](respondWithResult(_0x26bac1,null))['catch'](handleError(_0x26bac1,null));};exports[_0x51f7('0x4e')]=function(_0x34e37b,_0x57433d){return db['MailServerOut']['create'](_0x34e37b[_0x51f7('0x4f')],{})[_0x51f7('0x29')](respondWithResult(_0x57433d,0xc9))[_0x51f7('0x4a')](handleError(_0x57433d,null));};exports[_0x51f7('0x50')]=function(_0x5c9e52,_0x406f36){if(_0x5c9e52[_0x51f7('0x4f')]['id']){delete _0x5c9e52[_0x51f7('0x4f')]['id'];}return db['MailServerOut'][_0x51f7('0x51')]({'where':{'id':_0x5c9e52[_0x51f7('0x4b')]['id']}})[_0x51f7('0x29')](handleEntityNotFound(_0x406f36,null))['then'](saveUpdates(_0x5c9e52[_0x51f7('0x4f')],null))['then'](respondWithResult(_0x406f36,null))[_0x51f7('0x4a')](handleError(_0x406f36,null));};exports['destroy']=function(_0x506de3,_0x38e1c7){return db['MailServerOut'][_0x51f7('0x51')]({'where':{'id':_0x506de3['params']['id']}})[_0x51f7('0x29')](handleEntityNotFound(_0x38e1c7,null))['then'](removeEntity(_0x38e1c7,null))['catch'](handleError(_0x38e1c7,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 547bb59..dc0722b 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 _0xb110=['./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xb110,0xc8));var _0x0b11=function(_0x597a77,_0x36501d){_0x597a77=_0x597a77-0x0;var _0x28259a=_0xb110[_0x597a77];return _0x28259a;};'use strict';var _=require(_0x0b11('0x0'));var util=require(_0x0b11('0x1'));var logger=require(_0x0b11('0x2'))(_0x0b11('0x3'));var moment=require(_0x0b11('0x4'));var BPromise=require(_0x0b11('0x5'));var rp=require(_0x0b11('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0b11('0x7'));var attributes=require(_0x0b11('0x8'));module[_0x0b11('0x9')]=function(_0x3b6b6c,_0x2bbbab){return _0x3b6b6c[_0x0b11('0xa')](_0x0b11('0xb'),attributes,{'tableName':_0x0b11('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd077=['api','moment','bluebird','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','lodash','../../config/logger'];(function(_0xa1289e,_0x1aa3b7){var _0x1db11f=function(_0x20b1f9){while(--_0x20b1f9){_0xa1289e['push'](_0xa1289e['shift']());}};_0x1db11f(++_0x1aa3b7);}(_0xd077,0x152));var _0x7d07=function(_0x40e6c9,_0x2c8520){_0x40e6c9=_0x40e6c9-0x0;var _0x26919e=_0xd077[_0x40e6c9];return _0x26919e;};'use strict';var _=require(_0x7d07('0x0'));var util=require('util');var logger=require(_0x7d07('0x1'))(_0x7d07('0x2'));var moment=require(_0x7d07('0x3'));var BPromise=require(_0x7d07('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d07('0x5'));var config=require(_0x7d07('0x6'));var attributes=require(_0x7d07('0x7'));module[_0x7d07('0x8')]=function(_0x5ac2c1,_0x34e502){return _0x5ac2c1['define'](_0x7d07('0x9'),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 0f92908..870c230 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x276b3f,_0x38ba13){var _0x4a60b0=function(_0x3fb651){while(--_0x3fb651){_0x276b3f['push'](_0x276b3f['shift']());}};_0x4a60b0(++_0x38ba13);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x81a41,_0x434c3d){var _0x179fd5=function(_0x1c089c){while(--_0x1c089c){_0x81a41['push'](_0x81a41['shift']());}};_0x179fd5(++_0x434c3d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 17a1886..94732d3 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 _0x7b16=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x163053,_0x27ddb9){var _0x5e09b9=function(_0x24c395){while(--_0x24c395){_0x163053['push'](_0x163053['shift']());}};_0x5e09b9(++_0x27ddb9);}(_0x7b16,0xdb));var _0x67b1=function(_0x19abc7,_0x5aadb6){_0x19abc7=_0x19abc7-0x0;var _0xc24f10=_0x7b16[_0x19abc7];return _0xc24f10;};'use strict';var multer=require(_0x67b1('0x0'));var util=require(_0x67b1('0x1'));var path=require(_0x67b1('0x2'));var timeout=require(_0x67b1('0x3'));var express=require(_0x67b1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x67b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x67b1('0x6'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x67b1('0x7')](),controller[_0x67b1('0x8')]);router[_0x67b1('0x9')](_0x67b1('0xa'),auth[_0x67b1('0x7')](),controller[_0x67b1('0xb')]);router[_0x67b1('0x9')](_0x67b1('0xc'),auth[_0x67b1('0x7')](),controller[_0x67b1('0xd')]);router[_0x67b1('0xe')]('/',auth[_0x67b1('0x7')](),controller[_0x67b1('0xf')]);router['put'](_0x67b1('0xc'),auth[_0x67b1('0x7')](),controller[_0x67b1('0x10')]);router[_0x67b1('0x11')](_0x67b1('0xc'),auth['isAuthenticated'](),controller[_0x67b1('0x12')]);module[_0x67b1('0x13')]=router; \ No newline at end of file +var _0xc995=['put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id','show','create'];(function(_0x121617,_0x77c5fe){var _0x329f92=function(_0x54b8f9){while(--_0x54b8f9){_0x121617['push'](_0x121617['shift']());}};_0x329f92(++_0x77c5fe);}(_0xc995,0x1f3));var _0x5c99=function(_0x3de33b,_0x3601fd){_0x3de33b=_0x3de33b-0x0;var _0x16d8ff=_0xc995[_0x3de33b];return _0x16d8ff;};'use strict';var multer=require('multer');var util=require(_0x5c99('0x0'));var path=require(_0x5c99('0x1'));var timeout=require(_0x5c99('0x2'));var express=require('express');var router=express[_0x5c99('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5c99('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5c99('0x5'));var controller=require(_0x5c99('0x6'));router['get']('/',auth[_0x5c99('0x7')](),controller[_0x5c99('0x8')]);router[_0x5c99('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x5c99('0xa')]);router[_0x5c99('0x9')](_0x5c99('0xb'),auth['isAuthenticated'](),controller[_0x5c99('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5c99('0xd')]);router[_0x5c99('0xe')](_0x5c99('0xb'),auth[_0x5c99('0x7')](),controller[_0x5c99('0xf')]);router[_0x5c99('0x10')](_0x5c99('0xb'),auth[_0x5c99('0x7')](),controller[_0x5c99('0x11')]);module[_0x5c99('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index f73e45f..7398de5 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 _0x8506=['exports','name'];(function(_0x4cf475,_0x28d90c){var _0x5e7871=function(_0x5186c6){while(--_0x5186c6){_0x4cf475['push'](_0x4cf475['shift']());}};_0x5e7871(++_0x28d90c);}(_0x8506,0xe8));var _0x6850=function(_0x40d37b,_0x2734db){_0x40d37b=_0x40d37b-0x0;var _0x55d2be=_0x8506[_0x40d37b];return _0x55d2be;};'use strict';var Sequelize=require('sequelize');module[_0x6850('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6850('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x02a7=['exports','STRING'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0x02a7,0x7a));var _0x702a=function(_0x45ed6b,_0x4937b7){_0x45ed6b=_0x45ed6b-0x0;var _0x1cdda6=_0x02a7[_0x45ed6b];return _0x1cdda6;};'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 e0f92ef..906df28 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 _0x7442=['json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','MailSubstatus','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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','sendStatus','status','end'];(function(_0x456424,_0x5cd8b4){var _0x1f925f=function(_0x544553){while(--_0x544553){_0x456424['push'](_0x456424['shift']());}};_0x1f925f(++_0x5cd8b4);}(_0x7442,0x115));var _0x2744=function(_0xabb8a1,_0x5ed479){_0xabb8a1=_0xabb8a1-0x0;var _0x9a4673=_0x7442[_0xabb8a1];return _0x9a4673;};'use strict';var emlformat=require(_0x2744('0x0'));var rimraf=require(_0x2744('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2744('0x2'));var rp=require(_0x2744('0x3'));var moment=require(_0x2744('0x4'));var BPromise=require(_0x2744('0x5'));var Mustache=require(_0x2744('0x6'));var util=require('util');var path=require(_0x2744('0x7'));var sox=require('sox');var csv=require(_0x2744('0x8'));var ejs=require(_0x2744('0x9'));var fs=require('fs');var fs_extra=require(_0x2744('0xa'));var _=require(_0x2744('0xb'));var squel=require(_0x2744('0xc'));var crypto=require('crypto');var jsforce=require(_0x2744('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2744('0x8'));var querystring=require(_0x2744('0xe'));var Papa=require(_0x2744('0xf'));var Redis=require(_0x2744('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2744('0x11'));var as=require(_0x2744('0x12'));var hardwareService=require(_0x2744('0x13'));var logger=require(_0x2744('0x14'))(_0x2744('0x15'));var utils=require('../../config/utils');var config=require(_0x2744('0x16'));var licenseUtil=require(_0x2744('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23ec3b,_0x485186){_0x485186=_0x485186||0xcc;return function(_0x146564){if(_0x146564){return _0x23ec3b[_0x2744('0x18')](_0x485186);}return _0x23ec3b[_0x2744('0x19')](_0x485186)[_0x2744('0x1a')]();};}function respondWithResult(_0x3d9686,_0x520aa3){_0x520aa3=_0x520aa3||0xc8;return function(_0x106223){if(_0x106223){return _0x3d9686[_0x2744('0x19')](_0x520aa3)[_0x2744('0x1b')](_0x106223);}};}function respondWithFilteredResult(_0xa38d52,_0x262102){return function(_0x774914){if(_0x774914){var _0x385a19=typeof _0x262102[_0x2744('0x1c')]==='undefined'&&typeof _0x262102['limit']===_0x2744('0x1d');var _0x5249c9=_0x774914[_0x2744('0x1e')];var _0x3e3aba=_0x385a19?0x0:_0x262102[_0x2744('0x1c')];var _0x1e7711=_0x385a19?_0x774914[_0x2744('0x1e')]:_0x262102['offset']+_0x262102['limit'];var _0x50dea4;if(_0x1e7711>=_0x5249c9){_0x1e7711=_0x5249c9;_0x50dea4=0xc8;}else{_0x50dea4=0xce;}_0xa38d52[_0x2744('0x19')](_0x50dea4);return _0xa38d52[_0x2744('0x1f')](_0x2744('0x20'),_0x3e3aba+'-'+_0x1e7711+'/'+_0x5249c9)['json'](_0x774914);}return null;};}function patchUpdates(_0x421bdb){return function(_0x53a1cc){try{jsonpatch[_0x2744('0x21')](_0x53a1cc,_0x421bdb,!![]);}catch(_0x160dad){return BPromise[_0x2744('0x22')](_0x160dad);}return _0x53a1cc[_0x2744('0x23')]();};}function saveUpdates(_0x2b0a31,_0x2f37e7){return function(_0x4b326c){if(_0x4b326c){return _0x4b326c[_0x2744('0x24')](_0x2b0a31)[_0x2744('0x25')](function(_0x3d3ddb){return _0x3d3ddb;});}return null;};}function removeEntity(_0x1168f1,_0x6f586c){return function(_0x16d110){if(_0x16d110){return _0x16d110['destroy']()[_0x2744('0x25')](function(){_0x1168f1[_0x2744('0x19')](0xcc)[_0x2744('0x1a')]();});}};}function handleEntityNotFound(_0x46861e,_0x1b5bc7){return function(_0x4e3f7f){if(!_0x4e3f7f){_0x46861e[_0x2744('0x18')](0x194);}return _0x4e3f7f;};}function handleError(_0x36e870,_0x4c7b2f){_0x4c7b2f=_0x4c7b2f||0x1f4;return function(_0x8cc17e){logger[_0x2744('0x26')](_0x8cc17e['stack']);if(_0x8cc17e[_0x2744('0x27')]){delete _0x8cc17e[_0x2744('0x27')];}_0x36e870['status'](_0x4c7b2f)[_0x2744('0x28')](_0x8cc17e);};}exports['index']=function(_0x4bca8d,_0xcfc572){var _0x3580e0={},_0x900cc2={},_0x3245ff={'count':0x0,'rows':[]};var _0x438466=_[_0x2744('0x29')](db['MailSubstatus'][_0x2744('0x2a')],function(_0x1d1507){return{'name':_0x1d1507[_0x2744('0x2b')],'type':_0x1d1507['type'][_0x2744('0x2c')]};});_0x900cc2[_0x2744('0x2d')]=_['map'](_0x438466,'name');_0x900cc2[_0x2744('0x2e')]=_[_0x2744('0x2f')](_0x4bca8d[_0x2744('0x2e')]);_0x900cc2[_0x2744('0x30')]=_['intersection'](_0x900cc2[_0x2744('0x2d')],_0x900cc2[_0x2744('0x2e')]);_0x3580e0[_0x2744('0x31')]=_[_0x2744('0x32')](_0x900cc2[_0x2744('0x2d')],qs['fields'](_0x4bca8d[_0x2744('0x2e')][_0x2744('0x33')]));_0x3580e0[_0x2744('0x31')]=_0x3580e0[_0x2744('0x31')][_0x2744('0x34')]?_0x3580e0[_0x2744('0x31')]:_0x900cc2[_0x2744('0x2d')];if(!_0x4bca8d[_0x2744('0x2e')][_0x2744('0x35')](_0x2744('0x36'))){_0x3580e0[_0x2744('0x37')]=qs[_0x2744('0x37')](_0x4bca8d['query'][_0x2744('0x37')]);_0x3580e0[_0x2744('0x1c')]=qs['offset'](_0x4bca8d[_0x2744('0x2e')][_0x2744('0x1c')]);}_0x3580e0[_0x2744('0x38')]=qs[_0x2744('0x39')](_0x4bca8d[_0x2744('0x2e')]['sort']);_0x3580e0[_0x2744('0x3a')]=qs[_0x2744('0x30')](_[_0x2744('0x3b')](_0x4bca8d['query'],_0x900cc2[_0x2744('0x30')]),_0x438466);if(_0x4bca8d['query'][_0x2744('0x3c')]){_0x3580e0[_0x2744('0x3a')]=_[_0x2744('0x3d')](_0x3580e0['where'],{'$or':_[_0x2744('0x29')](_0x438466,function(_0x210ace){if(_0x210ace['type']!==_0x2744('0x3e')){var _0x246236={};_0x246236[_0x210ace[_0x2744('0x27')]]={'$like':'%'+_0x4bca8d[_0x2744('0x2e')][_0x2744('0x3c')]+'%'};return _0x246236;}})});}_0x3580e0=_[_0x2744('0x3d')]({},_0x3580e0,_0x4bca8d['options']);var _0x4aa69a={'where':_0x3580e0['where']};return db[_0x2744('0x3f')][_0x2744('0x1e')](_0x4aa69a)[_0x2744('0x25')](function(_0x4ca6bd){_0x3245ff['count']=_0x4ca6bd;if(_0x4bca8d[_0x2744('0x2e')][_0x2744('0x40')]){_0x3580e0[_0x2744('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0x2744('0x42')](_0x3580e0);})[_0x2744('0x25')](function(_0x4f876){_0x3245ff[_0x2744('0x43')]=_0x4f876;return _0x3245ff;})['then'](respondWithFilteredResult(_0xcfc572,_0x3580e0))[_0x2744('0x44')](handleError(_0xcfc572,null));};exports[_0x2744('0x45')]=function(_0xb6135e,_0x59564d){var _0x262095={'raw':!![],'where':{'id':_0xb6135e['params']['id']}},_0x1f65e6={};_0x1f65e6[_0x2744('0x2d')]=_[_0x2744('0x2f')](db['MailSubstatus'][_0x2744('0x2a')]);_0x1f65e6['query']=_[_0x2744('0x2f')](_0xb6135e[_0x2744('0x2e')]);_0x1f65e6[_0x2744('0x30')]=_[_0x2744('0x32')](_0x1f65e6[_0x2744('0x2d')],_0x1f65e6[_0x2744('0x2e')]);_0x262095[_0x2744('0x31')]=_[_0x2744('0x32')](_0x1f65e6[_0x2744('0x2d')],qs[_0x2744('0x33')](_0xb6135e[_0x2744('0x2e')][_0x2744('0x33')]));_0x262095['attributes']=_0x262095[_0x2744('0x31')][_0x2744('0x34')]?_0x262095['attributes']:_0x1f65e6[_0x2744('0x2d')];if(_0xb6135e[_0x2744('0x2e')][_0x2744('0x40')]){_0x262095[_0x2744('0x41')]=[{'all':!![]}];}_0x262095=_['merge']({},_0x262095,_0xb6135e[_0x2744('0x46')]);return db[_0x2744('0x3f')][_0x2744('0x47')](_0x262095)[_0x2744('0x25')](handleEntityNotFound(_0x59564d,null))['then'](respondWithResult(_0x59564d,null))[_0x2744('0x44')](handleError(_0x59564d,null));};exports[_0x2744('0x48')]=function(_0x133339,_0x928c3c){return db['MailSubstatus'][_0x2744('0x48')](_0x133339[_0x2744('0x49')],{})[_0x2744('0x25')](respondWithResult(_0x928c3c,0xc9))[_0x2744('0x44')](handleError(_0x928c3c,null));};exports[_0x2744('0x24')]=function(_0xb5776b,_0x48df83){if(_0xb5776b['body']['id']){delete _0xb5776b['body']['id'];}return db[_0x2744('0x3f')][_0x2744('0x47')]({'where':{'id':_0xb5776b[_0x2744('0x4a')]['id']}})[_0x2744('0x25')](handleEntityNotFound(_0x48df83,null))[_0x2744('0x25')](saveUpdates(_0xb5776b[_0x2744('0x49')],null))[_0x2744('0x25')](respondWithResult(_0x48df83,null))['catch'](handleError(_0x48df83,null));};exports['destroy']=function(_0x8cfc0c,_0x9a23f1){return db[_0x2744('0x3f')]['find']({'where':{'id':_0x8cfc0c['params']['id']}})['then'](handleEntityNotFound(_0x9a23f1,null))['then'](removeEntity(_0x9a23f1,null))[_0x2744('0x44')](handleError(_0x9a23f1,null));};exports[_0x2744('0x4b')]=function(_0xbcdd91,_0x1b8711){return db[_0x2744('0x3f')][_0x2744('0x4b')]()[_0x2744('0x25')](respondWithResult(_0x1b8711,null))['catch'](handleError(_0x1b8711,null));}; \ No newline at end of file +var _0x1e46=['api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','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'];(function(_0x3a024b,_0x413f45){var _0x1c7fb8=function(_0x1a08e8){while(--_0x1a08e8){_0x3a024b['push'](_0x3a024b['shift']());}};_0x1c7fb8(++_0x413f45);}(_0x1e46,0x80));var _0x61e4=function(_0xf61b07,_0x459c48){_0xf61b07=_0xf61b07-0x0;var _0x2ae736=_0x1e46[_0xf61b07];return _0x2ae736;};'use strict';var emlformat=require(_0x61e4('0x0'));var rimraf=require(_0x61e4('0x1'));var zipdir=require(_0x61e4('0x2'));var jsonpatch=require(_0x61e4('0x3'));var rp=require('request-promise');var moment=require(_0x61e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x61e4('0x5'));var util=require(_0x61e4('0x6'));var path=require(_0x61e4('0x7'));var sox=require(_0x61e4('0x8'));var csv=require(_0x61e4('0x9'));var ejs=require(_0x61e4('0xa'));var fs=require('fs');var fs_extra=require(_0x61e4('0xb'));var _=require(_0x61e4('0xc'));var squel=require(_0x61e4('0xd'));var crypto=require(_0x61e4('0xe'));var jsforce=require(_0x61e4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x61e4('0x9'));var querystring=require(_0x61e4('0x10'));var Papa=require(_0x61e4('0x11'));var Redis=require(_0x61e4('0x12'));var authService=require(_0x61e4('0x13'));var qs=require(_0x61e4('0x14'));var as=require(_0x61e4('0x15'));var hardwareService=require(_0x61e4('0x16'));var logger=require(_0x61e4('0x17'))(_0x61e4('0x18'));var utils=require('../../config/utils');var config=require(_0x61e4('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x61e4('0x1a'))['db'];function respondWithStatusCode(_0x526f6b,_0x544413){_0x544413=_0x544413||0xcc;return function(_0x4ff622){if(_0x4ff622){return _0x526f6b[_0x61e4('0x1b')](_0x544413);}return _0x526f6b[_0x61e4('0x1c')](_0x544413)[_0x61e4('0x1d')]();};}function respondWithResult(_0x1513c9,_0x382471){_0x382471=_0x382471||0xc8;return function(_0x50ddbd){if(_0x50ddbd){return _0x1513c9[_0x61e4('0x1c')](_0x382471)[_0x61e4('0x1e')](_0x50ddbd);}};}function respondWithFilteredResult(_0x229fba,_0x82d063){return function(_0x532931){if(_0x532931){var _0x118606=typeof _0x82d063[_0x61e4('0x1f')]===_0x61e4('0x20')&&typeof _0x82d063[_0x61e4('0x21')]===_0x61e4('0x20');var _0x3445af=_0x532931[_0x61e4('0x22')];var _0x2beb20=_0x118606?0x0:_0x82d063[_0x61e4('0x1f')];var _0x8acc58=_0x118606?_0x532931[_0x61e4('0x22')]:_0x82d063[_0x61e4('0x1f')]+_0x82d063['limit'];var _0x2be234;if(_0x8acc58>=_0x3445af){_0x8acc58=_0x3445af;_0x2be234=0xc8;}else{_0x2be234=0xce;}_0x229fba['status'](_0x2be234);return _0x229fba[_0x61e4('0x23')](_0x61e4('0x24'),_0x2beb20+'-'+_0x8acc58+'/'+_0x3445af)[_0x61e4('0x1e')](_0x532931);}return null;};}function patchUpdates(_0x1d2b41){return function(_0x217dc0){try{jsonpatch[_0x61e4('0x25')](_0x217dc0,_0x1d2b41,!![]);}catch(_0x549fc8){return BPromise[_0x61e4('0x26')](_0x549fc8);}return _0x217dc0['save']();};}function saveUpdates(_0x1c8b13,_0x59fddc){return function(_0xb5b227){if(_0xb5b227){return _0xb5b227[_0x61e4('0x27')](_0x1c8b13)['then'](function(_0x44a4d6){return _0x44a4d6;});}return null;};}function removeEntity(_0x2c929d,_0x300cd3){return function(_0x6259d5){if(_0x6259d5){return _0x6259d5[_0x61e4('0x28')]()[_0x61e4('0x29')](function(){_0x2c929d[_0x61e4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b6ae9,_0xe00710){return function(_0x3148e3){if(!_0x3148e3){_0x6b6ae9[_0x61e4('0x1b')](0x194);}return _0x3148e3;};}function handleError(_0x4ac268,_0x510280){_0x510280=_0x510280||0x1f4;return function(_0x260d3c){logger[_0x61e4('0x2a')](_0x260d3c[_0x61e4('0x2b')]);if(_0x260d3c[_0x61e4('0x2c')]){delete _0x260d3c['name'];}_0x4ac268[_0x61e4('0x1c')](_0x510280)['send'](_0x260d3c);};}exports[_0x61e4('0x2d')]=function(_0x428c97,_0x5727e8){var _0x1f8d83={},_0x4251d0={},_0x5e8955={'count':0x0,'rows':[]};var _0x17668a=_[_0x61e4('0x2e')](db[_0x61e4('0x2f')][_0x61e4('0x30')],function(_0x256620){return{'name':_0x256620[_0x61e4('0x31')],'type':_0x256620[_0x61e4('0x32')][_0x61e4('0x33')]};});_0x4251d0[_0x61e4('0x34')]=_['map'](_0x17668a,'name');_0x4251d0[_0x61e4('0x35')]=_['keys'](_0x428c97[_0x61e4('0x35')]);_0x4251d0[_0x61e4('0x36')]=_['intersection'](_0x4251d0[_0x61e4('0x34')],_0x4251d0[_0x61e4('0x35')]);_0x1f8d83[_0x61e4('0x37')]=_[_0x61e4('0x38')](_0x4251d0[_0x61e4('0x34')],qs['fields'](_0x428c97['query'][_0x61e4('0x39')]));_0x1f8d83[_0x61e4('0x37')]=_0x1f8d83[_0x61e4('0x37')]['length']?_0x1f8d83['attributes']:_0x4251d0[_0x61e4('0x34')];if(!_0x428c97[_0x61e4('0x35')]['hasOwnProperty']('nolimit')){_0x1f8d83['limit']=qs[_0x61e4('0x21')](_0x428c97[_0x61e4('0x35')]['limit']);_0x1f8d83['offset']=qs[_0x61e4('0x1f')](_0x428c97['query'][_0x61e4('0x1f')]);}_0x1f8d83[_0x61e4('0x3a')]=qs['sort'](_0x428c97[_0x61e4('0x35')]['sort']);_0x1f8d83['where']=qs[_0x61e4('0x36')](_['pick'](_0x428c97[_0x61e4('0x35')],_0x4251d0[_0x61e4('0x36')]),_0x17668a);if(_0x428c97['query'][_0x61e4('0x3b')]){_0x1f8d83[_0x61e4('0x3c')]=_[_0x61e4('0x3d')](_0x1f8d83[_0x61e4('0x3c')],{'$or':_['map'](_0x17668a,function(_0x37fdd0){if(_0x37fdd0['type']!==_0x61e4('0x3e')){var _0x26916b={};_0x26916b[_0x37fdd0[_0x61e4('0x2c')]]={'$like':'%'+_0x428c97[_0x61e4('0x35')][_0x61e4('0x3b')]+'%'};return _0x26916b;}})});}_0x1f8d83=_[_0x61e4('0x3d')]({},_0x1f8d83,_0x428c97[_0x61e4('0x3f')]);var _0x2ce0b3={'where':_0x1f8d83[_0x61e4('0x3c')]};return db[_0x61e4('0x2f')]['count'](_0x2ce0b3)[_0x61e4('0x29')](function(_0x40a406){_0x5e8955[_0x61e4('0x22')]=_0x40a406;if(_0x428c97['query'][_0x61e4('0x40')]){_0x1f8d83[_0x61e4('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0x61e4('0x42')](_0x1f8d83);})[_0x61e4('0x29')](function(_0x13267d){_0x5e8955[_0x61e4('0x43')]=_0x13267d;return _0x5e8955;})[_0x61e4('0x29')](respondWithFilteredResult(_0x5727e8,_0x1f8d83))[_0x61e4('0x44')](handleError(_0x5727e8,null));};exports[_0x61e4('0x45')]=function(_0x36b70b,_0x20e818){var _0x4eb07b={'raw':!![],'where':{'id':_0x36b70b[_0x61e4('0x46')]['id']}},_0x58ef90={};_0x58ef90[_0x61e4('0x34')]=_[_0x61e4('0x47')](db[_0x61e4('0x2f')]['rawAttributes']);_0x58ef90[_0x61e4('0x35')]=_['keys'](_0x36b70b['query']);_0x58ef90['filters']=_['intersection'](_0x58ef90[_0x61e4('0x34')],_0x58ef90['query']);_0x4eb07b['attributes']=_[_0x61e4('0x38')](_0x58ef90[_0x61e4('0x34')],qs[_0x61e4('0x39')](_0x36b70b[_0x61e4('0x35')]['fields']));_0x4eb07b[_0x61e4('0x37')]=_0x4eb07b[_0x61e4('0x37')][_0x61e4('0x48')]?_0x4eb07b[_0x61e4('0x37')]:_0x58ef90[_0x61e4('0x34')];if(_0x36b70b['query'][_0x61e4('0x40')]){_0x4eb07b[_0x61e4('0x41')]=[{'all':!![]}];}_0x4eb07b=_[_0x61e4('0x3d')]({},_0x4eb07b,_0x36b70b[_0x61e4('0x3f')]);return db['MailSubstatus']['find'](_0x4eb07b)[_0x61e4('0x29')](handleEntityNotFound(_0x20e818,null))[_0x61e4('0x29')](respondWithResult(_0x20e818,null))[_0x61e4('0x44')](handleError(_0x20e818,null));};exports[_0x61e4('0x49')]=function(_0x53cfe1,_0x4c21a1){return db[_0x61e4('0x2f')][_0x61e4('0x49')](_0x53cfe1[_0x61e4('0x4a')],{})[_0x61e4('0x29')](respondWithResult(_0x4c21a1,0xc9))['catch'](handleError(_0x4c21a1,null));};exports[_0x61e4('0x27')]=function(_0x202d19,_0x5cd88c){if(_0x202d19[_0x61e4('0x4a')]['id']){delete _0x202d19['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x202d19['params']['id']}})[_0x61e4('0x29')](handleEntityNotFound(_0x5cd88c,null))[_0x61e4('0x29')](saveUpdates(_0x202d19['body'],null))[_0x61e4('0x29')](respondWithResult(_0x5cd88c,null))[_0x61e4('0x44')](handleError(_0x5cd88c,null));};exports['destroy']=function(_0x2a97bf,_0x3bf9a2){return db[_0x61e4('0x2f')]['find']({'where':{'id':_0x2a97bf[_0x61e4('0x46')]['id']}})['then'](handleEntityNotFound(_0x3bf9a2,null))['then'](removeEntity(_0x3bf9a2,null))['catch'](handleError(_0x3bf9a2,null));};exports[_0x61e4('0x4b')]=function(_0x4d3a34,_0x23b0a2){return db[_0x61e4('0x2f')][_0x61e4('0x4b')]()[_0x61e4('0x29')](respondWithResult(_0x23b0a2,null))['catch'](handleError(_0x23b0a2,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 0e1bbae..b31c49c 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 _0x38fb=['MailSubstatus','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5372ec,_0x22d7a5){var _0x25cb86=function(_0x2680ed){while(--_0x2680ed){_0x5372ec['push'](_0x5372ec['shift']());}};_0x25cb86(++_0x22d7a5);}(_0x38fb,0x76));var _0xb38f=function(_0x8fb092,_0x883290){_0x8fb092=_0x8fb092-0x0;var _0xd63883=_0x38fb[_0x8fb092];return _0xd63883;};'use strict';var EventEmitter=require(_0xb38f('0x0'));var MailSubstatus=require(_0xb38f('0x1'))['db'][_0xb38f('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xb38f('0x3')};function emitEvent(_0xfa9f5b){return function(_0x26f673,_0xe1cc86,_0x4a743f){MailSubstatusEvents[_0xb38f('0x4')](_0xfa9f5b+':'+_0x26f673['id'],_0x26f673);MailSubstatusEvents[_0xb38f('0x4')](_0xfa9f5b,_0x26f673);_0x4a743f(null);};}for(var e in events){if(events[_0xb38f('0x5')](e)){var event=events[e];MailSubstatus[_0xb38f('0x6')](e,emitEvent(event));}}module[_0xb38f('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x5dba=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0x432b98,_0x44ca50){var _0x432d6e=function(_0x30ec4d){while(--_0x30ec4d){_0x432b98['push'](_0x432b98['shift']());}};_0x432d6e(++_0x44ca50);}(_0x5dba,0xa5));var _0xa5db=function(_0x30fde3,_0x69fd6){_0x30fde3=_0x30fde3-0x0;var _0x45703f=_0x5dba[_0x30fde3];return _0x45703f;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xa5db('0x0'))['db'][_0xa5db('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xa5db('0x2')](0x0);var events={'afterUpdate':_0xa5db('0x3')};function emitEvent(_0x4276b6){return function(_0x1e15df,_0x99ee2b,_0x293db9){MailSubstatusEvents['emit'](_0x4276b6+':'+_0x1e15df['id'],_0x1e15df);MailSubstatusEvents[_0xa5db('0x4')](_0x4276b6,_0x1e15df);_0x293db9(null);};}for(var e in events){if(events[_0xa5db('0x5')](e)){var event=events[e];MailSubstatus[_0xa5db('0x6')](e,emitEvent(event));}}module[_0xa5db('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 a138111..00a767d 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 _0x31f5=['define','MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','then','catch','./mailSubstatus.attributes','models'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31f5,0x1ac));var _0x531f=function(_0x1bb026,_0x1053b5){_0x1bb026=_0x1bb026-0x0;var _0x1c72f8=_0x31f5[_0x1bb026];return _0x1c72f8;};'use strict';var attributes=require(_0x531f('0x0'));module['exports']=function(_0x35d6d2){var _0x333793=_0x35d6d2[_0x531f('0x1')];return _0x35d6d2[_0x531f('0x2')](_0x531f('0x3'),attributes,{'tableName':_0x531f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x51e566,_0x581d1a,_0x429451){return _0x333793[_0x531f('0x5')]['update']({'value':_0x51e566[_0x531f('0x6')]},{'where':{'field':_0x531f('0x7'),'value':_0x51e566['_previousDataValues']['name']}})[_0x531f('0x8')](function(){_0x429451();})[_0x531f('0x9')](function(_0xce9d79){_0x429451(_0xce9d79);});}}});}; \ No newline at end of file +var _0x950b=['./mailSubstatus.attributes','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus','then','catch'];(function(_0x163d7e,_0x486a8b){var _0x54e389=function(_0xed9b2){while(--_0xed9b2){_0x163d7e['push'](_0x163d7e['shift']());}};_0x54e389(++_0x486a8b);}(_0x950b,0xd8));var _0xb950=function(_0x4c6e4a,_0x263ab8){_0x4c6e4a=_0x4c6e4a-0x0;var _0x3d69f4=_0x950b[_0x4c6e4a];return _0x3d69f4;};'use strict';var attributes=require(_0xb950('0x0'));module['exports']=function(_0x30afbb){var _0x2d1af5=_0x30afbb['models'];return _0x30afbb['define'](_0xb950('0x1'),attributes,{'tableName':_0xb950('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1269f0,_0x3e712b,_0x113021){return _0x2d1af5[_0xb950('0x3')][_0xb950('0x4')]({'value':_0x1269f0['name']},{'where':{'field':_0xb950('0x5'),'value':_0x1269f0['_previousDataValues']['name']}})[_0xb950('0x6')](function(){_0x113021();})[_0xb950('0x7')](function(_0x169eed){_0x113021(_0x169eed);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 07c2de6..e9af0ff 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 _0xa4f1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','MailSubstatus,\x20%s,\x20%s','message','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa4f1,0xe2));var _0x1a4f=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xa4f1[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a4f('0x0'));var BPromise=require(_0x1a4f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a4f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a4f('0x3'));var logger=require(_0x1a4f('0x4'))(_0x1a4f('0x5'));var config=require(_0x1a4f('0x6'));var jayson=require(_0x1a4f('0x7'));var client=jayson[_0x1a4f('0x8')][_0x1a4f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e9c19,_0x238e7d,_0x1d9fd5){return new BPromise(function(_0x29808c,_0x3accad){return client[_0x1a4f('0xa')](_0x1e9c19,_0x1d9fd5)[_0x1a4f('0xb')](function(_0x356cfd){logger[_0x1a4f('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x238e7d,_0x1a4f('0xd'));logger[_0x1a4f('0xe')](_0x1a4f('0xf'),_0x238e7d,_0x1a4f('0xd'),JSON[_0x1a4f('0x10')](_0x356cfd));if(_0x356cfd['error']){if(_0x356cfd[_0x1a4f('0x11')]['code']===0x1f4){logger[_0x1a4f('0x11')](_0x1a4f('0x12'),_0x238e7d,_0x356cfd[_0x1a4f('0x11')][_0x1a4f('0x13')]);return _0x3accad(_0x356cfd['error'][_0x1a4f('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x238e7d,_0x356cfd[_0x1a4f('0x11')][_0x1a4f('0x13')]);return _0x29808c(_0x356cfd['error'][_0x1a4f('0x13')]);}else{logger[_0x1a4f('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x238e7d,_0x1a4f('0xd'));_0x29808c(_0x356cfd['result'][_0x1a4f('0x13')]);}})[_0x1a4f('0x14')](function(_0x51ead7){logger[_0x1a4f('0x11')](_0x1a4f('0x12'),_0x238e7d,_0x51ead7);_0x3accad(_0x51ead7);});});} \ No newline at end of file +var _0x7127=['ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x4ecce9,_0x40c76b){var _0x40b946=function(_0x3f5dab){while(--_0x3f5dab){_0x4ecce9['push'](_0x4ecce9['shift']());}};_0x40b946(++_0x40c76b);}(_0x7127,0xe2));var _0x7712=function(_0x35f727,_0x5d7bce){_0x35f727=_0x35f727-0x0;var _0x214043=_0x7127[_0x35f727];return _0x214043;};'use strict';var _=require(_0x7712('0x0'));var util=require(_0x7712('0x1'));var moment=require(_0x7712('0x2'));var BPromise=require(_0x7712('0x3'));var rs=require(_0x7712('0x4'));var fs=require('fs');var Redis=require(_0x7712('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7712('0x6'))(_0x7712('0x7'));var config=require(_0x7712('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7712('0x9')][_0x7712('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x465038,_0x1c4f16,_0x55f393){return new BPromise(function(_0x5cfc93,_0x582518){return client['request'](_0x465038,_0x55f393)[_0x7712('0xb')](function(_0x4d1410){logger[_0x7712('0xc')](_0x7712('0xd'),_0x1c4f16,_0x7712('0xe'));logger['debug'](_0x7712('0xf'),_0x1c4f16,'request\x20sent',JSON[_0x7712('0x10')](_0x4d1410));if(_0x4d1410[_0x7712('0x11')]){if(_0x4d1410['error'][_0x7712('0x12')]===0x1f4){logger[_0x7712('0x11')](_0x7712('0xd'),_0x1c4f16,_0x4d1410[_0x7712('0x11')][_0x7712('0x13')]);return _0x582518(_0x4d1410[_0x7712('0x11')][_0x7712('0x13')]);}logger[_0x7712('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x1c4f16,_0x4d1410[_0x7712('0x11')][_0x7712('0x13')]);return _0x5cfc93(_0x4d1410[_0x7712('0x11')]['message']);}else{logger[_0x7712('0xc')](_0x7712('0xd'),_0x1c4f16,'request\x20sent');_0x5cfc93(_0x4d1410[_0x7712('0x14')][_0x7712('0x13')]);}})['catch'](function(_0x4c12d8){logger[_0x7712('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x1c4f16,_0x4c12d8);_0x582518(_0x4c12d8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 128d819..146e4be 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 _0x8a2a=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8a2a,0x136));var _0xa8a2=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x8a2a[_0x622035];return _0x326cf2;};'use strict';var multer=require(_0xa8a2('0x0'));var util=require(_0xa8a2('0x1'));var path=require(_0xa8a2('0x2'));var timeout=require(_0xa8a2('0x3'));var express=require(_0xa8a2('0x4'));var router=express[_0xa8a2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa8a2('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0xa8a2('0x7')]('/',auth[_0xa8a2('0x8')](),controller[_0xa8a2('0x9')]);router[_0xa8a2('0x7')]('/describe',auth[_0xa8a2('0x8')](),controller['describe']);router[_0xa8a2('0x7')](_0xa8a2('0xa'),auth[_0xa8a2('0x8')](),controller[_0xa8a2('0xb')]);router['post']('/',auth[_0xa8a2('0x8')](),controller[_0xa8a2('0xc')]);router[_0xa8a2('0xd')](_0xa8a2('0xa'),auth[_0xa8a2('0x8')](),controller[_0xa8a2('0xe')]);router[_0xa8a2('0xf')](_0xa8a2('0xa'),auth[_0xa8a2('0x8')](),controller['destroy']);module[_0xa8a2('0x10')]=router; \ No newline at end of file +var _0x7e88=['show','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id'];(function(_0x524aa8,_0x377769){var _0x416e5b=function(_0x307fe6){while(--_0x307fe6){_0x524aa8['push'](_0x524aa8['shift']());}};_0x416e5b(++_0x377769);}(_0x7e88,0x1d3));var _0x87e8=function(_0x54e291,_0x1a621a){_0x54e291=_0x54e291-0x0;var _0x3ca642=_0x7e88[_0x54e291];return _0x3ca642;};'use strict';var multer=require('multer');var util=require(_0x87e8('0x0'));var path=require('path');var timeout=require(_0x87e8('0x1'));var express=require(_0x87e8('0x2'));var router=express[_0x87e8('0x3')]();var fs_extra=require(_0x87e8('0x4'));var auth=require(_0x87e8('0x5'));var interaction=require(_0x87e8('0x6'));var config=require(_0x87e8('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x87e8('0x8')](),controller[_0x87e8('0x9')]);router[_0x87e8('0xa')](_0x87e8('0xb'),auth[_0x87e8('0x8')](),controller['describe']);router[_0x87e8('0xa')](_0x87e8('0xc'),auth[_0x87e8('0x8')](),controller[_0x87e8('0xd')]);router[_0x87e8('0xe')]('/',auth[_0x87e8('0x8')](),controller[_0x87e8('0xf')]);router[_0x87e8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x87e8('0x11')]);router[_0x87e8('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x87e8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 1684f17..c439c01 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4050bc,_0x31882c){var _0x524b78=function(_0x26f06e){while(--_0x26f06e){_0x4050bc['push'](_0x4050bc['shift']());}};_0x524b78(++_0x31882c);}(_0x00bb,0x1d8));var _0xb00b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x00bb[_0xb0f7c3];return _0x28ea68;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x238e3c,_0x40ed5f){var _0x44a1eb=function(_0x4be14a){while(--_0x4be14a){_0x238e3c['push'](_0x238e3c['shift']());}};_0x44a1eb(++_0x40ed5f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x252385,_0x4407eb){_0x252385=_0x252385-0x0;var _0x480fb0=_0xf4eb[_0x252385];return _0x480fb0;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 2b7b8c4..132deab 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 _0xcf8d=['sort','where','pick','filter','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','merge','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','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','sendStatus','status','json','offset','limit','count','set','apply','reject','save','destroy','then','error','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcf8d,0x1db));var _0xdcf8=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xcf8d[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require(_0xdcf8('0x0'));var rimraf=require(_0xdcf8('0x1'));var zipdir=require(_0xdcf8('0x2'));var jsonpatch=require(_0xdcf8('0x3'));var rp=require(_0xdcf8('0x4'));var moment=require(_0xdcf8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdcf8('0x6'));var path=require(_0xdcf8('0x7'));var sox=require('sox');var csv=require(_0xdcf8('0x8'));var ejs=require(_0xdcf8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdcf8('0xa'));var crypto=require(_0xdcf8('0xb'));var jsforce=require(_0xdcf8('0xc'));var deskjs=require(_0xdcf8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdcf8('0xe'));var Papa=require(_0xdcf8('0xf'));var Redis=require(_0xdcf8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdcf8('0x11'));var as=require(_0xdcf8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdcf8('0x13'))(_0xdcf8('0x14'));var utils=require(_0xdcf8('0x15'));var config=require(_0xdcf8('0x16'));var licenseUtil=require(_0xdcf8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e0d16,_0x2a9c06){_0x2a9c06=_0x2a9c06||0xcc;return function(_0x4074af){if(_0x4074af){return _0x4e0d16[_0xdcf8('0x18')](_0x2a9c06);}return _0x4e0d16[_0xdcf8('0x19')](_0x2a9c06)['end']();};}function respondWithResult(_0x3c6515,_0x8dca75){_0x8dca75=_0x8dca75||0xc8;return function(_0x12db81){if(_0x12db81){return _0x3c6515[_0xdcf8('0x19')](_0x8dca75)[_0xdcf8('0x1a')](_0x12db81);}};}function respondWithFilteredResult(_0x4da562,_0x4a398c){return function(_0x4ac303){if(_0x4ac303){var _0x118554=typeof _0x4a398c[_0xdcf8('0x1b')]==='undefined'&&typeof _0x4a398c[_0xdcf8('0x1c')]==='undefined';var _0x3eb13e=_0x4ac303[_0xdcf8('0x1d')];var _0x56c433=_0x118554?0x0:_0x4a398c[_0xdcf8('0x1b')];var _0x30126b=_0x118554?_0x4ac303[_0xdcf8('0x1d')]:_0x4a398c['offset']+_0x4a398c['limit'];var _0x2679ed;if(_0x30126b>=_0x3eb13e){_0x30126b=_0x3eb13e;_0x2679ed=0xc8;}else{_0x2679ed=0xce;}_0x4da562[_0xdcf8('0x19')](_0x2679ed);return _0x4da562[_0xdcf8('0x1e')]('Content-Range',_0x56c433+'-'+_0x30126b+'/'+_0x3eb13e)[_0xdcf8('0x1a')](_0x4ac303);}return null;};}function patchUpdates(_0x5415d5){return function(_0x5a82b3){try{jsonpatch[_0xdcf8('0x1f')](_0x5a82b3,_0x5415d5,!![]);}catch(_0x334068){return BPromise[_0xdcf8('0x20')](_0x334068);}return _0x5a82b3[_0xdcf8('0x21')]();};}function saveUpdates(_0x1a7542,_0x17d137){return function(_0x237c50){if(_0x237c50){return _0x237c50['update'](_0x1a7542)['then'](function(_0x547a8f){return _0x547a8f;});}return null;};}function removeEntity(_0x36c432,_0x1776e6){return function(_0x441b1b){if(_0x441b1b){return _0x441b1b[_0xdcf8('0x22')]()[_0xdcf8('0x23')](function(){_0x36c432[_0xdcf8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x182293,_0xe1178e){return function(_0x4570c3){if(!_0x4570c3){_0x182293[_0xdcf8('0x18')](0x194);}return _0x4570c3;};}function handleError(_0x49d742,_0x1a03d4){_0x1a03d4=_0x1a03d4||0x1f4;return function(_0x3401ae){logger[_0xdcf8('0x24')](_0x3401ae[_0xdcf8('0x25')]);if(_0x3401ae[_0xdcf8('0x26')]){delete _0x3401ae['name'];}_0x49d742[_0xdcf8('0x19')](_0x1a03d4)[_0xdcf8('0x27')](_0x3401ae);};}exports[_0xdcf8('0x28')]=function(_0x52a9fb,_0x332a1f){var _0x296052={},_0x4da31b={},_0x2e03e7={'count':0x0,'rows':[]};var _0x1b08ae=_['map'](db[_0xdcf8('0x29')][_0xdcf8('0x2a')],function(_0x218466){return{'name':_0x218466[_0xdcf8('0x2b')],'type':_0x218466[_0xdcf8('0x2c')][_0xdcf8('0x2d')]};});_0x4da31b[_0xdcf8('0x2e')]=_[_0xdcf8('0x2f')](_0x1b08ae,'name');_0x4da31b[_0xdcf8('0x30')]=_[_0xdcf8('0x31')](_0x52a9fb['query']);_0x4da31b[_0xdcf8('0x32')]=_[_0xdcf8('0x33')](_0x4da31b['model'],_0x4da31b[_0xdcf8('0x30')]);_0x296052['attributes']=_['intersection'](_0x4da31b[_0xdcf8('0x2e')],qs['fields'](_0x52a9fb[_0xdcf8('0x30')][_0xdcf8('0x34')]));_0x296052[_0xdcf8('0x35')]=_0x296052['attributes']['length']?_0x296052[_0xdcf8('0x35')]:_0x4da31b[_0xdcf8('0x2e')];if(!_0x52a9fb['query'][_0xdcf8('0x36')](_0xdcf8('0x37'))){_0x296052['limit']=qs['limit'](_0x52a9fb['query'][_0xdcf8('0x1c')]);_0x296052[_0xdcf8('0x1b')]=qs['offset'](_0x52a9fb['query'][_0xdcf8('0x1b')]);}_0x296052[_0xdcf8('0x38')]=qs[_0xdcf8('0x39')](_0x52a9fb[_0xdcf8('0x30')]['sort']);_0x296052[_0xdcf8('0x3a')]=qs[_0xdcf8('0x32')](_[_0xdcf8('0x3b')](_0x52a9fb[_0xdcf8('0x30')],_0x4da31b[_0xdcf8('0x32')]),_0x1b08ae);if(_0x52a9fb[_0xdcf8('0x30')][_0xdcf8('0x3c')]){_0x296052['where']=_['merge'](_0x296052[_0xdcf8('0x3a')],{'$or':_[_0xdcf8('0x2f')](_0x1b08ae,function(_0x330414){if(_0x330414['type']!==_0xdcf8('0x3d')){var _0x1ec211={};_0x1ec211[_0x330414[_0xdcf8('0x26')]]={'$like':'%'+_0x52a9fb['query']['filter']+'%'};return _0x1ec211;}})});}_0x296052=_['merge']({},_0x296052,_0x52a9fb[_0xdcf8('0x3e')]);var _0x245e7d={'where':_0x296052[_0xdcf8('0x3a')]};return db[_0xdcf8('0x29')]['count'](_0x245e7d)[_0xdcf8('0x23')](function(_0x31f7d5){_0x2e03e7['count']=_0x31f7d5;if(_0x52a9fb[_0xdcf8('0x30')][_0xdcf8('0x3f')]){_0x296052['include']=[{'all':!![]}];}return db[_0xdcf8('0x29')]['findAll'](_0x296052);})[_0xdcf8('0x23')](function(_0x2a39d5){_0x2e03e7[_0xdcf8('0x40')]=_0x2a39d5;return _0x2e03e7;})['then'](respondWithFilteredResult(_0x332a1f,_0x296052))[_0xdcf8('0x41')](handleError(_0x332a1f,null));};exports[_0xdcf8('0x42')]=function(_0x3bf87e,_0x402a0d){var _0x164ebf={'raw':!![],'where':{'id':_0x3bf87e[_0xdcf8('0x43')]['id']}},_0x89deed={};_0x89deed[_0xdcf8('0x2e')]=_[_0xdcf8('0x31')](db[_0xdcf8('0x29')][_0xdcf8('0x2a')]);_0x89deed['query']=_[_0xdcf8('0x31')](_0x3bf87e['query']);_0x89deed[_0xdcf8('0x32')]=_[_0xdcf8('0x33')](_0x89deed[_0xdcf8('0x2e')],_0x89deed[_0xdcf8('0x30')]);_0x164ebf['attributes']=_[_0xdcf8('0x33')](_0x89deed['model'],qs[_0xdcf8('0x34')](_0x3bf87e[_0xdcf8('0x30')][_0xdcf8('0x34')]));_0x164ebf[_0xdcf8('0x35')]=_0x164ebf[_0xdcf8('0x35')][_0xdcf8('0x44')]?_0x164ebf[_0xdcf8('0x35')]:_0x89deed[_0xdcf8('0x2e')];if(_0x3bf87e[_0xdcf8('0x30')]['includeAll']){_0x164ebf[_0xdcf8('0x45')]=[{'all':!![]}];}_0x164ebf=_[_0xdcf8('0x46')]({},_0x164ebf,_0x3bf87e[_0xdcf8('0x3e')]);return db[_0xdcf8('0x29')]['find'](_0x164ebf)[_0xdcf8('0x23')](handleEntityNotFound(_0x402a0d,null))[_0xdcf8('0x23')](respondWithResult(_0x402a0d,null))[_0xdcf8('0x41')](handleError(_0x402a0d,null));};exports[_0xdcf8('0x47')]=function(_0x1256b2,_0x174584){return db[_0xdcf8('0x29')][_0xdcf8('0x47')](_0x1256b2[_0xdcf8('0x48')],{})[_0xdcf8('0x23')](respondWithResult(_0x174584,0xc9))[_0xdcf8('0x41')](handleError(_0x174584,null));};exports[_0xdcf8('0x49')]=function(_0x5b8bf0,_0x2adfb3){if(_0x5b8bf0[_0xdcf8('0x48')]['id']){delete _0x5b8bf0['body']['id'];}return db['MailTransferReport'][_0xdcf8('0x4a')]({'where':{'id':_0x5b8bf0['params']['id']}})['then'](handleEntityNotFound(_0x2adfb3,null))[_0xdcf8('0x23')](saveUpdates(_0x5b8bf0[_0xdcf8('0x48')],null))[_0xdcf8('0x23')](respondWithResult(_0x2adfb3,null))[_0xdcf8('0x41')](handleError(_0x2adfb3,null));};exports[_0xdcf8('0x22')]=function(_0x121487,_0x1f5205){return db[_0xdcf8('0x29')][_0xdcf8('0x4a')]({'where':{'id':_0x121487[_0xdcf8('0x43')]['id']}})[_0xdcf8('0x23')](handleEntityNotFound(_0x1f5205,null))[_0xdcf8('0x23')](removeEntity(_0x1f5205,null))['catch'](handleError(_0x1f5205,null));};exports[_0xdcf8('0x4b')]=function(_0x5eb832,_0x5c22e4){return db[_0xdcf8('0x29')][_0xdcf8('0x4b')]()[_0xdcf8('0x23')](respondWithResult(_0x5c22e4,null))['catch'](handleError(_0x5c22e4,null));}; \ No newline at end of file +var _0x0b15=['squel','crypto','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','end','offset','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','options','MailTransferReport','includeAll','rows','catch','params','keys','rawAttributes','include','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash'];(function(_0x24e2cb,_0x2bc739){var _0x489bd9=function(_0x1a0949){while(--_0x1a0949){_0x24e2cb['push'](_0x24e2cb['shift']());}};_0x489bd9(++_0x2bc739);}(_0x0b15,0x87));var _0x50b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b15[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50b1('0x0'));var zipdir=require(_0x50b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x50b1('0x2'));var moment=require(_0x50b1('0x3'));var BPromise=require(_0x50b1('0x4'));var Mustache=require(_0x50b1('0x5'));var util=require(_0x50b1('0x6'));var path=require(_0x50b1('0x7'));var sox=require('sox');var csv=require(_0x50b1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x50b1('0x9'));var _=require(_0x50b1('0xa'));var squel=require(_0x50b1('0xb'));var crypto=require(_0x50b1('0xc'));var jsforce=require(_0x50b1('0xd'));var deskjs=require(_0x50b1('0xe'));var toCsv=require(_0x50b1('0x8'));var querystring=require(_0x50b1('0xf'));var Papa=require(_0x50b1('0x10'));var Redis=require('ioredis');var authService=require(_0x50b1('0x11'));var qs=require(_0x50b1('0x12'));var as=require(_0x50b1('0x13'));var hardwareService=require(_0x50b1('0x14'));var logger=require('../../config/logger')(_0x50b1('0x15'));var utils=require(_0x50b1('0x16'));var config=require(_0x50b1('0x17'));var licenseUtil=require(_0x50b1('0x18'));var db=require(_0x50b1('0x19'))['db'];function respondWithStatusCode(_0x44a590,_0x1f79de){_0x1f79de=_0x1f79de||0xcc;return function(_0x35da98){if(_0x35da98){return _0x44a590[_0x50b1('0x1a')](_0x1f79de);}return _0x44a590[_0x50b1('0x1b')](_0x1f79de)[_0x50b1('0x1c')]();};}function respondWithResult(_0x38be00,_0x179c59){_0x179c59=_0x179c59||0xc8;return function(_0x4a4017){if(_0x4a4017){return _0x38be00[_0x50b1('0x1b')](_0x179c59)['json'](_0x4a4017);}};}function respondWithFilteredResult(_0x1eeca2,_0xa90bef){return function(_0x279c84){if(_0x279c84){var _0x12ccac=typeof _0xa90bef[_0x50b1('0x1d')]===_0x50b1('0x1e')&&typeof _0xa90bef['limit']===_0x50b1('0x1e');var _0x5d3c76=_0x279c84[_0x50b1('0x1f')];var _0x4d34ee=_0x12ccac?0x0:_0xa90bef[_0x50b1('0x1d')];var _0x3e8ea2=_0x12ccac?_0x279c84[_0x50b1('0x1f')]:_0xa90bef[_0x50b1('0x1d')]+_0xa90bef['limit'];var _0x19d72a;if(_0x3e8ea2>=_0x5d3c76){_0x3e8ea2=_0x5d3c76;_0x19d72a=0xc8;}else{_0x19d72a=0xce;}_0x1eeca2[_0x50b1('0x1b')](_0x19d72a);return _0x1eeca2[_0x50b1('0x20')]('Content-Range',_0x4d34ee+'-'+_0x3e8ea2+'/'+_0x5d3c76)['json'](_0x279c84);}return null;};}function patchUpdates(_0x56a786){return function(_0x151a5f){try{jsonpatch[_0x50b1('0x21')](_0x151a5f,_0x56a786,!![]);}catch(_0x3b8761){return BPromise['reject'](_0x3b8761);}return _0x151a5f[_0x50b1('0x22')]();};}function saveUpdates(_0x3f6d69,_0x109716){return function(_0x10ac0e){if(_0x10ac0e){return _0x10ac0e[_0x50b1('0x23')](_0x3f6d69)[_0x50b1('0x24')](function(_0x140f7e){return _0x140f7e;});}return null;};}function removeEntity(_0x1c394b,_0x36a8b3){return function(_0x294052){if(_0x294052){return _0x294052[_0x50b1('0x25')]()[_0x50b1('0x24')](function(){_0x1c394b[_0x50b1('0x1b')](0xcc)[_0x50b1('0x1c')]();});}};}function handleEntityNotFound(_0xdee631,_0x3d39c4){return function(_0x4391c2){if(!_0x4391c2){_0xdee631[_0x50b1('0x1a')](0x194);}return _0x4391c2;};}function handleError(_0x261f5d,_0x52f9df){_0x52f9df=_0x52f9df||0x1f4;return function(_0x4bb96f){logger[_0x50b1('0x26')](_0x4bb96f[_0x50b1('0x27')]);if(_0x4bb96f[_0x50b1('0x28')]){delete _0x4bb96f[_0x50b1('0x28')];}_0x261f5d['status'](_0x52f9df)[_0x50b1('0x29')](_0x4bb96f);};}exports[_0x50b1('0x2a')]=function(_0x5b986c,_0x2dfd3f){var _0x5b53c7={},_0x2a609c={},_0x123f5d={'count':0x0,'rows':[]};var _0xdd531=_[_0x50b1('0x2b')](db['MailTransferReport']['rawAttributes'],function(_0x17e66d){return{'name':_0x17e66d[_0x50b1('0x2c')],'type':_0x17e66d[_0x50b1('0x2d')]['key']};});_0x2a609c[_0x50b1('0x2e')]=_[_0x50b1('0x2b')](_0xdd531,_0x50b1('0x28'));_0x2a609c[_0x50b1('0x2f')]=_['keys'](_0x5b986c[_0x50b1('0x2f')]);_0x2a609c[_0x50b1('0x30')]=_[_0x50b1('0x31')](_0x2a609c[_0x50b1('0x2e')],_0x2a609c[_0x50b1('0x2f')]);_0x5b53c7['attributes']=_[_0x50b1('0x31')](_0x2a609c[_0x50b1('0x2e')],qs['fields'](_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x32')]));_0x5b53c7[_0x50b1('0x33')]=_0x5b53c7[_0x50b1('0x33')][_0x50b1('0x34')]?_0x5b53c7['attributes']:_0x2a609c['model'];if(!_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x35')](_0x50b1('0x36'))){_0x5b53c7['limit']=qs[_0x50b1('0x37')](_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x37')]);_0x5b53c7[_0x50b1('0x1d')]=qs[_0x50b1('0x1d')](_0x5b986c[_0x50b1('0x2f')]['offset']);}_0x5b53c7['order']=qs[_0x50b1('0x38')](_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x38')]);_0x5b53c7[_0x50b1('0x39')]=qs[_0x50b1('0x30')](_['pick'](_0x5b986c[_0x50b1('0x2f')],_0x2a609c[_0x50b1('0x30')]),_0xdd531);if(_0x5b986c['query'][_0x50b1('0x3a')]){_0x5b53c7['where']=_['merge'](_0x5b53c7['where'],{'$or':_[_0x50b1('0x2b')](_0xdd531,function(_0x28947c){if(_0x28947c[_0x50b1('0x2d')]!=='VIRTUAL'){var _0x1e4053={};_0x1e4053[_0x28947c[_0x50b1('0x28')]]={'$like':'%'+_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x3a')]+'%'};return _0x1e4053;}})});}_0x5b53c7=_[_0x50b1('0x3b')]({},_0x5b53c7,_0x5b986c[_0x50b1('0x3c')]);var _0x3ecd5a={'where':_0x5b53c7['where']};return db[_0x50b1('0x3d')][_0x50b1('0x1f')](_0x3ecd5a)['then'](function(_0x199304){_0x123f5d[_0x50b1('0x1f')]=_0x199304;if(_0x5b986c[_0x50b1('0x2f')][_0x50b1('0x3e')]){_0x5b53c7['include']=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x5b53c7);})[_0x50b1('0x24')](function(_0x16948a){_0x123f5d[_0x50b1('0x3f')]=_0x16948a;return _0x123f5d;})[_0x50b1('0x24')](respondWithFilteredResult(_0x2dfd3f,_0x5b53c7))[_0x50b1('0x40')](handleError(_0x2dfd3f,null));};exports['show']=function(_0xccb8b7,_0x13f106){var _0x5ef46a={'raw':!![],'where':{'id':_0xccb8b7[_0x50b1('0x41')]['id']}},_0x3c9d11={};_0x3c9d11[_0x50b1('0x2e')]=_[_0x50b1('0x42')](db[_0x50b1('0x3d')][_0x50b1('0x43')]);_0x3c9d11['query']=_[_0x50b1('0x42')](_0xccb8b7[_0x50b1('0x2f')]);_0x3c9d11[_0x50b1('0x30')]=_[_0x50b1('0x31')](_0x3c9d11[_0x50b1('0x2e')],_0x3c9d11[_0x50b1('0x2f')]);_0x5ef46a['attributes']=_['intersection'](_0x3c9d11[_0x50b1('0x2e')],qs[_0x50b1('0x32')](_0xccb8b7[_0x50b1('0x2f')][_0x50b1('0x32')]));_0x5ef46a[_0x50b1('0x33')]=_0x5ef46a['attributes'][_0x50b1('0x34')]?_0x5ef46a[_0x50b1('0x33')]:_0x3c9d11[_0x50b1('0x2e')];if(_0xccb8b7[_0x50b1('0x2f')][_0x50b1('0x3e')]){_0x5ef46a[_0x50b1('0x44')]=[{'all':!![]}];}_0x5ef46a=_[_0x50b1('0x3b')]({},_0x5ef46a,_0xccb8b7[_0x50b1('0x3c')]);return db[_0x50b1('0x3d')][_0x50b1('0x45')](_0x5ef46a)[_0x50b1('0x24')](handleEntityNotFound(_0x13f106,null))['then'](respondWithResult(_0x13f106,null))[_0x50b1('0x40')](handleError(_0x13f106,null));};exports['create']=function(_0x570f42,_0x258971){return db[_0x50b1('0x3d')][_0x50b1('0x46')](_0x570f42[_0x50b1('0x47')],{})[_0x50b1('0x24')](respondWithResult(_0x258971,0xc9))[_0x50b1('0x40')](handleError(_0x258971,null));};exports[_0x50b1('0x23')]=function(_0x1f7e13,_0x3a8632){if(_0x1f7e13['body']['id']){delete _0x1f7e13[_0x50b1('0x47')]['id'];}return db[_0x50b1('0x3d')]['find']({'where':{'id':_0x1f7e13[_0x50b1('0x41')]['id']}})[_0x50b1('0x24')](handleEntityNotFound(_0x3a8632,null))[_0x50b1('0x24')](saveUpdates(_0x1f7e13[_0x50b1('0x47')],null))[_0x50b1('0x24')](respondWithResult(_0x3a8632,null))[_0x50b1('0x40')](handleError(_0x3a8632,null));};exports['destroy']=function(_0x2f434c,_0x272c43){return db[_0x50b1('0x3d')][_0x50b1('0x45')]({'where':{'id':_0x2f434c[_0x50b1('0x41')]['id']}})[_0x50b1('0x24')](handleEntityNotFound(_0x272c43,null))[_0x50b1('0x24')](removeEntity(_0x272c43,null))['catch'](handleError(_0x272c43,null));};exports[_0x50b1('0x48')]=function(_0x5b8248,_0x4f7416){return db[_0x50b1('0x3d')]['describe']()['then'](respondWithResult(_0x4f7416,null))[_0x50b1('0x40')](handleError(_0x4f7416,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index ef5683d..3383a12 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 _0x9ca8=['define','MailTransferReport','report_mail_transfer','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9ca8,0x123));var _0x89ca=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x9ca8[_0x31c19c];return _0x1a87f7;};'use strict';var _=require('lodash');var util=require(_0x89ca('0x0'));var logger=require('../../config/logger')(_0x89ca('0x1'));var moment=require(_0x89ca('0x2'));var BPromise=require(_0x89ca('0x3'));var rp=require(_0x89ca('0x4'));var fs=require('fs');var path=require(_0x89ca('0x5'));var rimraf=require('rimraf');var config=require(_0x89ca('0x6'));var attributes=require(_0x89ca('0x7'));module[_0x89ca('0x8')]=function(_0x1464be,_0x348f76){return _0x1464be[_0x89ca('0x9')](_0x89ca('0xa'),attributes,{'tableName':_0x89ca('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x757c=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46d995,_0x9b24ed){var _0x21202f=function(_0xab0f9c){while(--_0xab0f9c){_0x46d995['push'](_0x46d995['shift']());}};_0x21202f(++_0x9b24ed);}(_0x757c,0xc9));var _0xc757=function(_0x5aaac3,_0x5c5a75){_0x5aaac3=_0x5aaac3-0x0;var _0x2f9a6e=_0x757c[_0x5aaac3];return _0x2f9a6e;};'use strict';var _=require(_0xc757('0x0'));var util=require(_0xc757('0x1'));var logger=require('../../config/logger')(_0xc757('0x2'));var moment=require(_0xc757('0x3'));var BPromise=require(_0xc757('0x4'));var rp=require(_0xc757('0x5'));var fs=require('fs');var path=require(_0xc757('0x6'));var rimraf=require(_0xc757('0x7'));var config=require(_0xc757('0x8'));var attributes=require(_0xc757('0x9'));module[_0xc757('0xa')]=function(_0x29cb3a,_0x4f15ef){return _0x29cb3a[_0xc757('0xb')](_0xc757('0xc'),attributes,{'tableName':_0xc757('0xd'),'paranoid':![],'indexes':[{'name':_0xc757('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index e21cafe..c25ea1e 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 _0xdf70=['message','result','catch','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x531ec6,_0x3bbd29){var _0x4b6ec5=function(_0x6c4373){while(--_0x6c4373){_0x531ec6['push'](_0x531ec6['shift']());}};_0x4b6ec5(++_0x3bbd29);}(_0xdf70,0x12f));var _0x0df7=function(_0x32a606,_0x1c3058){_0x32a606=_0x32a606-0x0;var _0xeb176=_0xdf70[_0x32a606];return _0xeb176;};'use strict';var _=require('lodash');var util=require(_0x0df7('0x0'));var moment=require('moment');var BPromise=require(_0x0df7('0x1'));var rs=require(_0x0df7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0df7('0x3'))(_0x0df7('0x4'));var config=require(_0x0df7('0x5'));var jayson=require(_0x0df7('0x6'));var client=jayson[_0x0df7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x218ed7,_0x191df0,_0x49ad34){return new BPromise(function(_0x38bcaf,_0x24e511){return client[_0x0df7('0x8')](_0x218ed7,_0x49ad34)[_0x0df7('0x9')](function(_0x4cbe38){logger[_0x0df7('0xa')](_0x0df7('0xb'),_0x191df0,_0x0df7('0xc'));logger[_0x0df7('0xd')](_0x0df7('0xe'),_0x191df0,'request\x20sent',JSON['stringify'](_0x4cbe38));if(_0x4cbe38[_0x0df7('0xf')]){if(_0x4cbe38['error'][_0x0df7('0x10')]===0x1f4){logger[_0x0df7('0xf')](_0x0df7('0xb'),_0x191df0,_0x4cbe38[_0x0df7('0xf')]['message']);return _0x24e511(_0x4cbe38[_0x0df7('0xf')]['message']);}logger[_0x0df7('0xf')](_0x0df7('0xb'),_0x191df0,_0x4cbe38['error'][_0x0df7('0x11')]);return _0x38bcaf(_0x4cbe38['error'][_0x0df7('0x11')]);}else{logger[_0x0df7('0xa')](_0x0df7('0xb'),_0x191df0,_0x0df7('0xc'));_0x38bcaf(_0x4cbe38[_0x0df7('0x12')]['message']);}})[_0x0df7('0x13')](function(_0x4db98c){logger[_0x0df7('0xf')](_0x0df7('0xb'),_0x191df0,_0x4db98c);_0x24e511(_0x4db98c);});});} \ No newline at end of file +var _0xad0f=['then','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xad0f,0xfb));var _0xfad0=function(_0x57dc85,_0x3a6d51){_0x57dc85=_0x57dc85-0x0;var _0x563a2e=_0xad0f[_0x57dc85];return _0x563a2e;};'use strict';var _=require(_0xfad0('0x0'));var util=require('util');var moment=require(_0xfad0('0x1'));var BPromise=require('bluebird');var rs=require(_0xfad0('0x2'));var fs=require('fs');var Redis=require(_0xfad0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfad0('0x4'))(_0xfad0('0x5'));var config=require(_0xfad0('0x6'));var jayson=require(_0xfad0('0x7'));var client=jayson[_0xfad0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ece52,_0x16a9a3,_0x3654ba){return new BPromise(function(_0x25a81c,_0x3224f1){return client['request'](_0x4ece52,_0x3654ba)[_0xfad0('0x9')](function(_0x58e878){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x16a9a3,_0xfad0('0xa'));logger['debug'](_0xfad0('0xb'),_0x16a9a3,_0xfad0('0xa'),JSON[_0xfad0('0xc')](_0x58e878));if(_0x58e878[_0xfad0('0xd')]){if(_0x58e878[_0xfad0('0xd')][_0xfad0('0xe')]===0x1f4){logger[_0xfad0('0xd')](_0xfad0('0xf'),_0x16a9a3,_0x58e878[_0xfad0('0xd')]['message']);return _0x3224f1(_0x58e878[_0xfad0('0xd')][_0xfad0('0x10')]);}logger[_0xfad0('0xd')](_0xfad0('0xf'),_0x16a9a3,_0x58e878[_0xfad0('0xd')]['message']);return _0x25a81c(_0x58e878['error']['message']);}else{logger[_0xfad0('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x16a9a3,_0xfad0('0xa'));_0x25a81c(_0x58e878[_0xfad0('0x12')]['message']);}})[_0xfad0('0x13')](function(_0x1d682){logger[_0xfad0('0xd')](_0xfad0('0xf'),_0x16a9a3,_0x1d682);_0x3224f1(_0x1d682);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 03c5846..fbaa249 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 _0x8e8a=['create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x4b06ad,_0x1c8583){var _0x24f38e=function(_0x545fdc){while(--_0x545fdc){_0x4b06ad['push'](_0x4b06ad['shift']());}};_0x24f38e(++_0x1c8583);}(_0x8e8a,0x10f));var _0xa8e8=function(_0x4e35af,_0x46514d){_0x4e35af=_0x4e35af-0x0;var _0x164e55=_0x8e8a[_0x4e35af];return _0x164e55;};'use strict';var multer=require('multer');var util=require(_0xa8e8('0x0'));var path=require(_0xa8e8('0x1'));var timeout=require(_0xa8e8('0x2'));var express=require('express');var router=express[_0xa8e8('0x3')]();var fs_extra=require(_0xa8e8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa8e8('0x5'));var controller=require(_0xa8e8('0x6'));router[_0xa8e8('0x7')]('/',auth[_0xa8e8('0x8')](),controller[_0xa8e8('0x9')]);router[_0xa8e8('0x7')]('/describe',auth[_0xa8e8('0x8')](),controller[_0xa8e8('0xa')]);router[_0xa8e8('0x7')](_0xa8e8('0xb'),auth[_0xa8e8('0x8')](),controller[_0xa8e8('0xc')]);router[_0xa8e8('0xd')]('/',auth[_0xa8e8('0x8')](),controller[_0xa8e8('0xe')]);router[_0xa8e8('0xf')](_0xa8e8('0xb'),auth[_0xa8e8('0x8')](),controller['update']);router[_0xa8e8('0x10')](_0xa8e8('0xb'),auth['isAuthenticated'](),controller[_0xa8e8('0x11')]);module[_0xa8e8('0x12')]=router; \ No newline at end of file +var _0xac4d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','destroy','exports'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0xac4d,0x108));var _0xdac4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xac4d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xdac4('0x0'));var util=require(_0xdac4('0x1'));var path=require(_0xdac4('0x2'));var timeout=require(_0xdac4('0x3'));var express=require(_0xdac4('0x4'));var router=express[_0xdac4('0x5')]();var fs_extra=require(_0xdac4('0x6'));var auth=require(_0xdac4('0x7'));var interaction=require(_0xdac4('0x8'));var config=require(_0xdac4('0x9'));var controller=require(_0xdac4('0xa'));router[_0xdac4('0xb')]('/',auth[_0xdac4('0xc')](),controller['index']);router[_0xdac4('0xb')](_0xdac4('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xdac4('0xb')](_0xdac4('0xe'),auth[_0xdac4('0xc')](),controller[_0xdac4('0xf')]);router[_0xdac4('0x10')]('/',auth[_0xdac4('0xc')](),controller[_0xdac4('0x11')]);router[_0xdac4('0x12')]('/:id',auth[_0xdac4('0xc')](),controller[_0xdac4('0x13')]);router['delete'](_0xdac4('0xe'),auth[_0xdac4('0xc')](),controller[_0xdac4('0x14')]);module[_0xdac4('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 726553c..292279e 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 _0x88c9=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','setDataValue'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x88c9,0x177));var _0x988c=function(_0x5c7018,_0x122a48){_0x5c7018=_0x5c7018-0x0;var _0x468d7a=_0x88c9[_0x5c7018];return _0x468d7a;};'use strict';var Sequelize=require(_0x988c('0x0'));var moment=require(_0x988c('0x1'));module[_0x988c('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x988c('0x3')],'defaultValue':_0x988c('0x4'),'comment':_0x988c('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x988c('0x6')]},'exitAt':{'type':Sequelize[_0x988c('0x6')],'set':function(_0xf63387){var _0x1d15e9=moment(_0xf63387);var _0x2eaf15=moment(this['getDataValue'](_0x988c('0x7')));var _0x565c86=_0x1d15e9['diff'](_0x2eaf15,'seconds');this[_0x988c('0x8')]('exitAt',_0xf63387);this[_0x988c('0x8')](_0x988c('0x9'),_0x565c86>=0x0?_0x565c86:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x988c('0xa')},'data2':{'type':Sequelize[_0x988c('0x3')],'comment':_0x988c('0xb')},'data3':{'type':Sequelize[_0x988c('0x3')],'comment':_0x988c('0xc')},'data4':{'type':Sequelize[_0x988c('0x3')],'comment':_0x988c('0xd')},'data5':{'type':Sequelize[_0x988c('0x3')],'comment':_0x988c('0xe')},'role':{'type':Sequelize[_0x988c('0x3')]},'internal':{'type':Sequelize[_0x988c('0xf')]},'uniqueid':{'type':Sequelize[_0x988c('0x3')]}}; \ No newline at end of file +var _0x4d08=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','duration'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x4d08,0x66));var _0x84d0=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0x4d08[_0xe0b81f];return _0x290e5e;};'use strict';var Sequelize=require(_0x84d0('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x84d0('0x1')]},'membername':{'type':Sequelize[_0x84d0('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x84d0('0x1')],'defaultValue':_0x84d0('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x84d0('0x3')]},'enterAt':{'type':Sequelize[_0x84d0('0x4')]},'exitAt':{'type':Sequelize[_0x84d0('0x4')],'set':function(_0x4cc141){var _0x475cbf=moment(_0x4cc141);var _0x381893=moment(this[_0x84d0('0x5')]('enterAt'));var _0x528554=_0x475cbf[_0x84d0('0x6')](_0x381893,_0x84d0('0x7'));this[_0x84d0('0x8')]('exitAt',_0x4cc141);this[_0x84d0('0x8')](_0x84d0('0x9'),_0x528554>=0x0?_0x528554:null);}},'data1':{'type':Sequelize[_0x84d0('0x1')],'comment':_0x84d0('0xa')},'data2':{'type':Sequelize[_0x84d0('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x84d0('0xb')},'data4':{'type':Sequelize[_0x84d0('0x1')],'comment':_0x84d0('0xc')},'data5':{'type':Sequelize[_0x84d0('0x1')],'comment':_0x84d0('0xd')},'role':{'type':Sequelize[_0x84d0('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x84d0('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 5bbae97..5f61df3 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x34e8,0x12c));var _0x834e=function(_0x463787,_0x485ec9){_0x463787=_0x463787-0x0;var _0x26062d=_0x34e8[_0x463787];return _0x26062d;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x34e8,0x12c));var _0x834e=function(_0x57fb4a,_0x4770cb){_0x57fb4a=_0x57fb4a-0x0;var _0x541b75=_0x34e8[_0x57fb4a];return _0x541b75;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 23c4b94..ba268f6 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 _0xe585=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername','interface'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xe585,0x9a));var _0x5e58=function(_0x447006,_0x5d4600){_0x447006=_0x447006-0x0;var _0x1260f2=_0xe585[_0x447006];return _0x1260f2;};'use strict';var _=require(_0x5e58('0x0'));var util=require('util');var logger=require(_0x5e58('0x1'))('api');var moment=require(_0x5e58('0x2'));var BPromise=require(_0x5e58('0x3'));var rp=require(_0x5e58('0x4'));var fs=require('fs');var path=require(_0x5e58('0x5'));var rimraf=require(_0x5e58('0x6'));var config=require(_0x5e58('0x7'));var attributes=require(_0x5e58('0x8'));module['exports']=function(_0xc44f82,_0x159698){return _0xc44f82[_0x5e58('0x9')](_0x5e58('0xa'),attributes,{'tableName':_0x5e58('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x5e58('0xc'),_0x5e58('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb1c=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','lodash'];(function(_0x445491,_0x46bc66){var _0x4cfce5=function(_0x3626f8){while(--_0x3626f8){_0x445491['push'](_0x445491['shift']());}};_0x4cfce5(++_0x46bc66);}(_0xdb1c,0xcf));var _0xcdb1=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xdb1c[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0xcdb1('0x0'));var util=require(_0xcdb1('0x1'));var logger=require(_0xcdb1('0x2'))(_0xcdb1('0x3'));var moment=require(_0xcdb1('0x4'));var BPromise=require(_0xcdb1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdb1('0x6'));var rimraf=require(_0xcdb1('0x7'));var config=require(_0xcdb1('0x8'));var attributes=require(_0xcdb1('0x9'));module[_0xcdb1('0xa')]=function(_0x2c691d,_0x575070){return _0x2c691d['define'](_0xcdb1('0xb'),attributes,{'tableName':_0xcdb1('0xc'),'paranoid':![],'indexes':[{'name':_0xcdb1('0xd'),'fields':[_0xcdb1('0xe'),_0xcdb1('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 4d947b3..4c3419c 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 _0xe55d=['MemberReport,\x20%s,\x20%s','message','request\x20sent','result','catch','GetMemberReport','MemberReport','options','raw','where','limit','include','map','model','attributes','then','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x10e4c9,_0x577767){var _0x799009=function(_0x4f8223){while(--_0x4f8223){_0x10e4c9['push'](_0x10e4c9['shift']());}};_0x799009(++_0x577767);}(_0xe55d,0x126));var _0xde55=function(_0x3eaa29,_0x24a06e){_0x3eaa29=_0x3eaa29-0x0;var _0x4518c7=_0xe55d[_0x3eaa29];return _0x4518c7;};'use strict';var _=require(_0xde55('0x0'));var util=require(_0xde55('0x1'));var moment=require('moment');var BPromise=require(_0xde55('0x2'));var rs=require(_0xde55('0x3'));var fs=require('fs');var Redis=require(_0xde55('0x4'));var db=require(_0xde55('0x5'))['db'];var utils=require(_0xde55('0x6'));var logger=require(_0xde55('0x7'))('rpc');var config=require(_0xde55('0x8'));var jayson=require(_0xde55('0x9'));var client=jayson[_0xde55('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e7b53,_0x1468f2,_0x1e342e){return new BPromise(function(_0x2094bb,_0x22cbd8){return client[_0xde55('0xb')](_0x1e7b53,_0x1e342e)['then'](function(_0x11aa16){logger[_0xde55('0xc')]('MemberReport,\x20%s,\x20%s',_0x1468f2,'request\x20sent');logger[_0xde55('0xd')](_0xde55('0xe'),_0x1468f2,'request\x20sent',JSON[_0xde55('0xf')](_0x11aa16));if(_0x11aa16[_0xde55('0x10')]){if(_0x11aa16['error'][_0xde55('0x11')]===0x1f4){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16['error'][_0xde55('0x13')]);return _0x22cbd8(_0x11aa16[_0xde55('0x10')][_0xde55('0x13')]);}logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16[_0xde55('0x10')]['message']);return _0x2094bb(_0x11aa16['error'][_0xde55('0x13')]);}else{logger[_0xde55('0xc')]('MemberReport,\x20%s,\x20%s',_0x1468f2,_0xde55('0x14'));_0x2094bb(_0x11aa16[_0xde55('0x15')][_0xde55('0x13')]);}})[_0xde55('0x16')](function(_0x2f4a77){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x2f4a77);_0x22cbd8(_0x2f4a77);});});}exports[_0xde55('0x17')]=function(_0x4a97e2){var _0x1abffb=this;return new Promise(function(_0x42b6e4,_0x13551d){return db[_0xde55('0x18')]['findAll']({'raw':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2['options'][_0xde55('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2['options'][_0xde55('0x1b')]||null:null,'attributes':_0x4a97e2['options']?_0x4a97e2[_0xde55('0x19')]['attributes']||null:null,'limit':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2['options'][_0xde55('0x1c')]||null:null,'include':_0x4a97e2[_0xde55('0x19')]?_0x4a97e2[_0xde55('0x19')][_0xde55('0x1d')]?_[_0xde55('0x1e')](_0x4a97e2[_0xde55('0x19')][_0xde55('0x1d')],function(_0x2e7607){return{'model':db[_0x2e7607[_0xde55('0x1f')]],'as':_0x2e7607['as'],'attributes':_0x2e7607['attributes'],'include':_0x2e7607['include']?_[_0xde55('0x1e')](_0x2e7607[_0xde55('0x1d')],function(_0x15a04b){return{'model':db[_0x15a04b[_0xde55('0x1f')]],'as':_0x15a04b['as'],'attributes':_0x15a04b[_0xde55('0x20')],'include':_0x15a04b[_0xde55('0x1d')]?_[_0xde55('0x1e')](_0x15a04b[_0xde55('0x1d')],function(_0x35f246){return{'model':db[_0x35f246[_0xde55('0x1f')]],'as':_0x35f246['as'],'attributes':_0x35f246[_0xde55('0x20')]};}):[]};}):[]};}):[]:[]})[_0xde55('0x21')](function(_0x43c1f4){logger['info']('GetMemberReport',_0x4a97e2);logger[_0xde55('0xd')]('GetMemberReport',_0x4a97e2,JSON[_0xde55('0xf')](_0x43c1f4));_0x42b6e4(_0x43c1f4);})[_0xde55('0x16')](function(_0x2c42a2){logger['error'](_0xde55('0x17'),_0x2c42a2[_0xde55('0x13')],_0x4a97e2);_0x13551d(_0x1abffb['error'](0x1f4,_0x2c42a2[_0xde55('0x13')]));});});};exports[_0xde55('0x22')]=function(_0x76b11f){var _0x513eb5=this;return new Promise(function(_0x586008,_0x2629ea){return db[_0xde55('0x18')][_0xde55('0x23')](_0x76b11f[_0xde55('0x24')],{'raw':_0x76b11f[_0xde55('0x19')]?_0x76b11f[_0xde55('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xde55('0x21')](function(_0x4b92d8){logger[_0xde55('0xc')]('CreateMemberReport',_0x76b11f);logger[_0xde55('0xd')](_0xde55('0x22'),_0x76b11f,JSON[_0xde55('0xf')](_0x4b92d8));_0x586008(_0x4b92d8);})[_0xde55('0x16')](function(_0x12efc3){logger[_0xde55('0x10')](_0xde55('0x22'),_0x12efc3['message'],_0x76b11f);_0x2629ea(_0x513eb5[_0xde55('0x10')](0x1f4,_0x12efc3[_0xde55('0x13')]));});});};exports[_0xde55('0x25')]=function(_0x557097){var _0x17a0c5=this;return new Promise(function(_0x4e50dd,_0x196af8){return db['MemberReport'][_0xde55('0x26')](_0x557097[_0xde55('0x24')],{'raw':_0x557097['options']?_0x557097['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x557097[_0xde55('0x19')]?_0x557097[_0xde55('0x19')][_0xde55('0x1b')]||null:null,'attributes':_0x557097[_0xde55('0x19')]?_0x557097[_0xde55('0x19')][_0xde55('0x20')]||null:null,'limit':_0x557097[_0xde55('0x19')]?_0x557097[_0xde55('0x19')]['limit']||null:null})['then'](function(_0x1d0178){logger[_0xde55('0xc')](_0xde55('0x25'),_0x557097);logger[_0xde55('0xd')](_0xde55('0x25'),_0x557097,JSON[_0xde55('0xf')](_0x1d0178));_0x4e50dd(_0x1d0178);})[_0xde55('0x16')](function(_0x3ba8ed){logger[_0xde55('0x10')](_0xde55('0x25'),_0x3ba8ed[_0xde55('0x13')],_0x557097);_0x196af8(_0x17a0c5[_0xde55('0x10')](0x1f4,_0x3ba8ed[_0xde55('0x13')]));});});}; \ No newline at end of file +var _0x0763=['error','message','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','map','model','then','create','CreateMemberReport','debug','update','body','where','UpdateMemberReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x0763,0x87));var _0x3076=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0x0763[_0x37d0bc];return _0x170e60;};'use strict';var _=require(_0x3076('0x0'));var util=require('util');var moment=require(_0x3076('0x1'));var BPromise=require(_0x3076('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3076('0x3'));var db=require(_0x3076('0x4'))['db'];var utils=require(_0x3076('0x5'));var logger=require(_0x3076('0x6'))('rpc');var config=require(_0x3076('0x7'));var jayson=require(_0x3076('0x8'));var client=jayson[_0x3076('0x9')][_0x3076('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18b4c8,_0x5efd65,_0x2776c8){return new BPromise(function(_0xf1ee41,_0xf5b1b0){return client[_0x3076('0xb')](_0x18b4c8,_0x2776c8)['then'](function(_0x42804a){logger[_0x3076('0xc')](_0x3076('0xd'),_0x5efd65,'request\x20sent');logger['debug'](_0x3076('0xe'),_0x5efd65,_0x3076('0xf'),JSON[_0x3076('0x10')](_0x42804a));if(_0x42804a[_0x3076('0x11')]){if(_0x42804a[_0x3076('0x11')]['code']===0x1f4){logger[_0x3076('0x11')](_0x3076('0xd'),_0x5efd65,_0x42804a[_0x3076('0x11')][_0x3076('0x12')]);return _0xf5b1b0(_0x42804a[_0x3076('0x11')][_0x3076('0x12')]);}logger[_0x3076('0x11')](_0x3076('0xd'),_0x5efd65,_0x42804a['error']['message']);return _0xf1ee41(_0x42804a[_0x3076('0x11')][_0x3076('0x12')]);}else{logger[_0x3076('0xc')](_0x3076('0xd'),_0x5efd65,'request\x20sent');_0xf1ee41(_0x42804a['result'][_0x3076('0x12')]);}})[_0x3076('0x13')](function(_0x45a69b){logger[_0x3076('0x11')](_0x3076('0xd'),_0x5efd65,_0x45a69b);_0xf5b1b0(_0x45a69b);});});}exports[_0x3076('0x14')]=function(_0x21c242){var _0x2d7343=this;return new Promise(function(_0x1880b8,_0x1bb2ea){return db[_0x3076('0x15')][_0x3076('0x16')]({'raw':_0x21c242['options']?_0x21c242[_0x3076('0x17')][_0x3076('0x18')]===undefined?!![]:![]:!![],'where':_0x21c242['options']?_0x21c242[_0x3076('0x17')]['where']||null:null,'attributes':_0x21c242[_0x3076('0x17')]?_0x21c242[_0x3076('0x17')][_0x3076('0x19')]||null:null,'limit':_0x21c242['options']?_0x21c242[_0x3076('0x17')][_0x3076('0x1a')]||null:null,'include':_0x21c242[_0x3076('0x17')]?_0x21c242[_0x3076('0x17')][_0x3076('0x1b')]?_[_0x3076('0x1c')](_0x21c242[_0x3076('0x17')][_0x3076('0x1b')],function(_0x195606){return{'model':db[_0x195606[_0x3076('0x1d')]],'as':_0x195606['as'],'attributes':_0x195606['attributes'],'include':_0x195606[_0x3076('0x1b')]?_['map'](_0x195606[_0x3076('0x1b')],function(_0x4f4bdc){return{'model':db[_0x4f4bdc['model']],'as':_0x4f4bdc['as'],'attributes':_0x4f4bdc[_0x3076('0x19')],'include':_0x4f4bdc[_0x3076('0x1b')]?_[_0x3076('0x1c')](_0x4f4bdc[_0x3076('0x1b')],function(_0x28d834){return{'model':db[_0x28d834[_0x3076('0x1d')]],'as':_0x28d834['as'],'attributes':_0x28d834[_0x3076('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3076('0x1e')](function(_0x3a0ba7){logger[_0x3076('0xc')](_0x3076('0x14'),_0x21c242);logger['debug'](_0x3076('0x14'),_0x21c242,JSON[_0x3076('0x10')](_0x3a0ba7));_0x1880b8(_0x3a0ba7);})[_0x3076('0x13')](function(_0x5af88e){logger[_0x3076('0x11')](_0x3076('0x14'),_0x5af88e['message'],_0x21c242);_0x1bb2ea(_0x2d7343[_0x3076('0x11')](0x1f4,_0x5af88e[_0x3076('0x12')]));});});};exports['CreateMemberReport']=function(_0x44f7c7){var _0x5337bc=this;return new Promise(function(_0x4d6f8f,_0x28bcfb){return db[_0x3076('0x15')][_0x3076('0x1f')](_0x44f7c7['body'],{'raw':_0x44f7c7[_0x3076('0x17')]?_0x44f7c7[_0x3076('0x17')][_0x3076('0x18')]===undefined?!![]:![]:!![]})[_0x3076('0x1e')](function(_0x516e5d){logger[_0x3076('0xc')](_0x3076('0x20'),_0x44f7c7);logger[_0x3076('0x21')](_0x3076('0x20'),_0x44f7c7,JSON[_0x3076('0x10')](_0x516e5d));_0x4d6f8f(_0x516e5d);})['catch'](function(_0x5d40d8){logger[_0x3076('0x11')](_0x3076('0x20'),_0x5d40d8[_0x3076('0x12')],_0x44f7c7);_0x28bcfb(_0x5337bc[_0x3076('0x11')](0x1f4,_0x5d40d8[_0x3076('0x12')]));});});};exports['UpdateMemberReport']=function(_0x171d0a){var _0x538502=this;return new Promise(function(_0x445847,_0x1d6b0b){return db[_0x3076('0x15')][_0x3076('0x22')](_0x171d0a[_0x3076('0x23')],{'raw':_0x171d0a[_0x3076('0x17')]?_0x171d0a[_0x3076('0x17')][_0x3076('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x171d0a[_0x3076('0x17')]?_0x171d0a[_0x3076('0x17')][_0x3076('0x24')]||null:null,'attributes':_0x171d0a[_0x3076('0x17')]?_0x171d0a[_0x3076('0x17')][_0x3076('0x19')]||null:null,'limit':_0x171d0a[_0x3076('0x17')]?_0x171d0a[_0x3076('0x17')][_0x3076('0x1a')]||null:null})[_0x3076('0x1e')](function(_0x4525ea){logger[_0x3076('0xc')](_0x3076('0x25'),_0x171d0a);logger[_0x3076('0x21')](_0x3076('0x25'),_0x171d0a,JSON[_0x3076('0x10')](_0x4525ea));_0x445847(_0x4525ea);})[_0x3076('0x13')](function(_0x135fdd){logger[_0x3076('0x11')]('UpdateMemberReport',_0x135fdd[_0x3076('0x12')],_0x171d0a);_0x1d6b0b(_0x538502[_0x3076('0x11')](0x1f4,_0x135fdd[_0x3076('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f41f623..c5a7a98 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 _0x7a22=['fs-extra','../../components/interaction/service','./migration.controller','index','exports','multer','path','express'];(function(_0x3ed6ea,_0x3d28c9){var _0x3af06e=function(_0x48572f){while(--_0x48572f){_0x3ed6ea['push'](_0x3ed6ea['shift']());}};_0x3af06e(++_0x3d28c9);}(_0x7a22,0x1cd));var _0x27a2=function(_0x1fe200,_0x2aeacb){_0x1fe200=_0x1fe200-0x0;var _0x561a92=_0x7a22[_0x1fe200];return _0x561a92;};'use strict';var multer=require(_0x27a2('0x0'));var util=require('util');var path=require(_0x27a2('0x1'));var timeout=require('connect-timeout');var express=require(_0x27a2('0x2'));var router=express['Router']();var fs_extra=require(_0x27a2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x27a2('0x4'));var config=require('../../config/environment');var controller=require(_0x27a2('0x5'));router['get']('/',controller[_0x27a2('0x6')]);module[_0x27a2('0x7')]=router; \ No newline at end of file +var _0x3fea=['./migration.controller','index','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x46f7cb,_0x23f8aa){var _0x41fc78=function(_0x242356){while(--_0x242356){_0x46f7cb['push'](_0x46f7cb['shift']());}};_0x41fc78(++_0x23f8aa);}(_0x3fea,0x1bc));var _0xa3fe=function(_0x5f0427,_0x312c9d){_0x5f0427=_0x5f0427-0x0;var _0x5a341d=_0x3fea[_0x5f0427];return _0x5a341d;};'use strict';var multer=require(_0xa3fe('0x0'));var util=require(_0xa3fe('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa3fe('0x2'));var router=express[_0xa3fe('0x3')]();var fs_extra=require(_0xa3fe('0x4'));var auth=require(_0xa3fe('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa3fe('0x6'));router['get']('/',controller[_0xa3fe('0x7')]);module[_0xa3fe('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 325769e..8590d72 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 _0x646d=['sequelize','version'];(function(_0x1284e2,_0x149240){var _0x4f19bb=function(_0x312fd5){while(--_0x312fd5){_0x1284e2['push'](_0x1284e2['shift']());}};_0x4f19bb(++_0x149240);}(_0x646d,0x1c8));var _0xd646=function(_0x75f7c6,_0x32f25d){_0x75f7c6=_0x75f7c6-0x0;var _0x33137c=_0x646d[_0x75f7c6];return _0x33137c;};'use strict';var Sequelize=require(_0xd646('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0xd646('0x1')}}; \ No newline at end of file +var _0x4d16=['version','sequelize','exports'];(function(_0xec5bed,_0x5b2d68){var _0x15b715=function(_0x39d8b9){while(--_0x39d8b9){_0xec5bed['push'](_0xec5bed['shift']());}};_0x15b715(++_0x5b2d68);}(_0x4d16,0xe5));var _0x64d1=function(_0x18d716,_0xabc9d9){_0x18d716=_0x18d716-0x0;var _0x35fa38=_0x4d16[_0x18d716];return _0x35fa38;};'use strict';var Sequelize=require(_0x64d1('0x0'));module[_0x64d1('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x64d1('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 3fe3af5..f164604 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 _0xcc8e=['status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','Migration','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','where','merge','map','VIRTUAL','filter','options','include','findAll','catch','eml-format','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x49d280,_0x33d68f){var _0x25274a=function(_0x8ace90){while(--_0x8ace90){_0x49d280['push'](_0x49d280['shift']());}};_0x25274a(++_0x33d68f);}(_0xcc8e,0xa3));var _0xecc8=function(_0x24b614,_0x214193){_0x24b614=_0x24b614-0x0;var _0x2bf294=_0xcc8e[_0x24b614];return _0x2bf294;};'use strict';var emlformat=require(_0xecc8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecc8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecc8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xecc8('0x3'));var util=require(_0xecc8('0x4'));var path=require('path');var sox=require(_0xecc8('0x5'));var csv=require(_0xecc8('0x6'));var ejs=require(_0xecc8('0x7'));var fs=require('fs');var fs_extra=require(_0xecc8('0x8'));var _=require(_0xecc8('0x9'));var squel=require(_0xecc8('0xa'));var crypto=require(_0xecc8('0xb'));var jsforce=require(_0xecc8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xecc8('0x6'));var querystring=require(_0xecc8('0xd'));var Papa=require(_0xecc8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xecc8('0xf'));var hardwareService=require(_0xecc8('0x10'));var logger=require(_0xecc8('0x11'))(_0xecc8('0x12'));var utils=require(_0xecc8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xecc8('0x14'));var db=require(_0xecc8('0x15'))['db'];function respondWithStatusCode(_0x334687,_0x3398e1){_0x3398e1=_0x3398e1||0xcc;return function(_0xd415d3){if(_0xd415d3){return _0x334687[_0xecc8('0x16')](_0x3398e1);}return _0x334687['status'](_0x3398e1)['end']();};}function respondWithResult(_0x14edcd,_0x3d3ee2){_0x3d3ee2=_0x3d3ee2||0xc8;return function(_0x177e45){if(_0x177e45){return _0x14edcd[_0xecc8('0x17')](_0x3d3ee2)[_0xecc8('0x18')](_0x177e45);}};}function respondWithFilteredResult(_0x54f892,_0x14fd07){return function(_0x1b214c){if(_0x1b214c){var _0x565805=typeof _0x14fd07[_0xecc8('0x19')]===_0xecc8('0x1a')&&typeof _0x14fd07[_0xecc8('0x1b')]==='undefined';var _0xad217c=_0x1b214c[_0xecc8('0x1c')];var _0x284d4b=_0x565805?0x0:_0x14fd07[_0xecc8('0x19')];var _0x39d53d=_0x565805?_0x1b214c['count']:_0x14fd07[_0xecc8('0x19')]+_0x14fd07['limit'];var _0x5bbc11;if(_0x39d53d>=_0xad217c){_0x39d53d=_0xad217c;_0x5bbc11=0xc8;}else{_0x5bbc11=0xce;}_0x54f892[_0xecc8('0x17')](_0x5bbc11);return _0x54f892[_0xecc8('0x1d')]('Content-Range',_0x284d4b+'-'+_0x39d53d+'/'+_0xad217c)[_0xecc8('0x18')](_0x1b214c);}return null;};}function patchUpdates(_0xd190){return function(_0x3584ee){try{jsonpatch[_0xecc8('0x1e')](_0x3584ee,_0xd190,!![]);}catch(_0x327c17){return BPromise[_0xecc8('0x1f')](_0x327c17);}return _0x3584ee[_0xecc8('0x20')]();};}function saveUpdates(_0x23191b,_0x33576b){return function(_0x22cfe5){if(_0x22cfe5){return _0x22cfe5['update'](_0x23191b)[_0xecc8('0x21')](function(_0x2e2ce0){return _0x2e2ce0;});}return null;};}function removeEntity(_0x281b60,_0x12238f){return function(_0x2eb891){if(_0x2eb891){return _0x2eb891[_0xecc8('0x22')]()[_0xecc8('0x21')](function(){_0x281b60[_0xecc8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x462926,_0x4afb87){return function(_0x4e267c){if(!_0x4e267c){_0x462926['sendStatus'](0x194);}return _0x4e267c;};}function handleError(_0x51fa48,_0x2d22dc){_0x2d22dc=_0x2d22dc||0x1f4;return function(_0x2b2272){logger[_0xecc8('0x23')](_0x2b2272[_0xecc8('0x24')]);if(_0x2b2272['name']){delete _0x2b2272['name'];}_0x51fa48[_0xecc8('0x17')](_0x2d22dc)['send'](_0x2b2272);};}exports['index']=function(_0x4b2f00,_0x1bd89c){var _0x2987e9={},_0xd51beb={},_0x1bf822={'count':0x0,'rows':[]};var _0x88b2c0=_['map'](db[_0xecc8('0x25')][_0xecc8('0x26')],function(_0x259b92){return{'name':_0x259b92[_0xecc8('0x27')],'type':_0x259b92[_0xecc8('0x28')]['key']};});_0xd51beb[_0xecc8('0x29')]=_['map'](_0x88b2c0,_0xecc8('0x2a'));_0xd51beb[_0xecc8('0x2b')]=_[_0xecc8('0x2c')](_0x4b2f00['query']);_0xd51beb[_0xecc8('0x2d')]=_['intersection'](_0xd51beb[_0xecc8('0x29')],_0xd51beb['query']);_0x2987e9[_0xecc8('0x2e')]=_[_0xecc8('0x2f')](_0xd51beb[_0xecc8('0x29')],qs[_0xecc8('0x30')](_0x4b2f00[_0xecc8('0x2b')][_0xecc8('0x30')]));_0x2987e9[_0xecc8('0x2e')]=_0x2987e9[_0xecc8('0x2e')]['length']?_0x2987e9[_0xecc8('0x2e')]:_0xd51beb[_0xecc8('0x29')];if(!_0x4b2f00[_0xecc8('0x2b')][_0xecc8('0x31')]('nolimit')){_0x2987e9[_0xecc8('0x1b')]=qs[_0xecc8('0x1b')](_0x4b2f00['query'][_0xecc8('0x1b')]);_0x2987e9[_0xecc8('0x19')]=qs['offset'](_0x4b2f00[_0xecc8('0x2b')][_0xecc8('0x19')]);}_0x2987e9[_0xecc8('0x32')]=qs[_0xecc8('0x33')](_0x4b2f00[_0xecc8('0x2b')][_0xecc8('0x33')]);_0x2987e9['where']=qs[_0xecc8('0x2d')](_[_0xecc8('0x34')](_0x4b2f00[_0xecc8('0x2b')],_0xd51beb[_0xecc8('0x2d')]),_0x88b2c0);if(_0x4b2f00[_0xecc8('0x2b')]['filter']){_0x2987e9[_0xecc8('0x35')]=_[_0xecc8('0x36')](_0x2987e9[_0xecc8('0x35')],{'$or':_[_0xecc8('0x37')](_0x88b2c0,function(_0x2f1bc3){if(_0x2f1bc3[_0xecc8('0x28')]!==_0xecc8('0x38')){var _0xa981c9={};_0xa981c9[_0x2f1bc3[_0xecc8('0x2a')]]={'$like':'%'+_0x4b2f00['query'][_0xecc8('0x39')]+'%'};return _0xa981c9;}})});}_0x2987e9=_[_0xecc8('0x36')]({},_0x2987e9,_0x4b2f00[_0xecc8('0x3a')]);var _0x3f420a={'where':_0x2987e9[_0xecc8('0x35')]};return db[_0xecc8('0x25')][_0xecc8('0x1c')](_0x3f420a)[_0xecc8('0x21')](function(_0x4b66e3){_0x1bf822[_0xecc8('0x1c')]=_0x4b66e3;if(_0x4b2f00[_0xecc8('0x2b')]['includeAll']){_0x2987e9[_0xecc8('0x3b')]=[{'all':!![]}];}return db['Migration'][_0xecc8('0x3c')](_0x2987e9);})[_0xecc8('0x21')](function(_0x2643f5){_0x1bf822['rows']=_0x2643f5;return _0x1bf822;})['then'](respondWithFilteredResult(_0x1bd89c,_0x2987e9))[_0xecc8('0x3d')](handleError(_0x1bd89c,null));}; \ No newline at end of file +var _0x8b02=['index','map','Migration','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','findAll','rows','catch','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','stack','name'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x8b02,0x94));var _0x28b0=function(_0x585c86,_0x472ef9){_0x585c86=_0x585c86-0x0;var _0x26ce5d=_0x8b02[_0x585c86];return _0x26ce5d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x28b0('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28b0('0x1'));var moment=require(_0x28b0('0x2'));var BPromise=require(_0x28b0('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x28b0('0x4'));var sox=require(_0x28b0('0x5'));var csv=require(_0x28b0('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28b0('0x7'));var _=require(_0x28b0('0x8'));var squel=require(_0x28b0('0x9'));var crypto=require(_0x28b0('0xa'));var jsforce=require(_0x28b0('0xb'));var deskjs=require(_0x28b0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x28b0('0xd'));var Papa=require(_0x28b0('0xe'));var Redis=require('ioredis');var authService=require(_0x28b0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x28b0('0x10'));var hardwareService=require(_0x28b0('0x11'));var logger=require(_0x28b0('0x12'))(_0x28b0('0x13'));var utils=require(_0x28b0('0x14'));var config=require(_0x28b0('0x15'));var licenseUtil=require(_0x28b0('0x16'));var db=require(_0x28b0('0x17'))['db'];function respondWithStatusCode(_0x13eeed,_0x3af874){_0x3af874=_0x3af874||0xcc;return function(_0x1f8015){if(_0x1f8015){return _0x13eeed[_0x28b0('0x18')](_0x3af874);}return _0x13eeed[_0x28b0('0x19')](_0x3af874)[_0x28b0('0x1a')]();};}function respondWithResult(_0x52aef7,_0x3c3255){_0x3c3255=_0x3c3255||0xc8;return function(_0x21388d){if(_0x21388d){return _0x52aef7[_0x28b0('0x19')](_0x3c3255)[_0x28b0('0x1b')](_0x21388d);}};}function respondWithFilteredResult(_0x16426c,_0x14c347){return function(_0x463722){if(_0x463722){var _0x594df0=typeof _0x14c347[_0x28b0('0x1c')]===_0x28b0('0x1d')&&typeof _0x14c347[_0x28b0('0x1e')]===_0x28b0('0x1d');var _0x2488f6=_0x463722[_0x28b0('0x1f')];var _0x1d3589=_0x594df0?0x0:_0x14c347[_0x28b0('0x1c')];var _0x470be8=_0x594df0?_0x463722[_0x28b0('0x1f')]:_0x14c347[_0x28b0('0x1c')]+_0x14c347[_0x28b0('0x1e')];var _0x56c74e;if(_0x470be8>=_0x2488f6){_0x470be8=_0x2488f6;_0x56c74e=0xc8;}else{_0x56c74e=0xce;}_0x16426c[_0x28b0('0x19')](_0x56c74e);return _0x16426c['set'](_0x28b0('0x20'),_0x1d3589+'-'+_0x470be8+'/'+_0x2488f6)['json'](_0x463722);}return null;};}function patchUpdates(_0x4842a5){return function(_0xf55a6d){try{jsonpatch[_0x28b0('0x21')](_0xf55a6d,_0x4842a5,!![]);}catch(_0x1efe3){return BPromise[_0x28b0('0x22')](_0x1efe3);}return _0xf55a6d[_0x28b0('0x23')]();};}function saveUpdates(_0x278d8a,_0xf1c38c){return function(_0x518652){if(_0x518652){return _0x518652[_0x28b0('0x24')](_0x278d8a)['then'](function(_0xd22cab){return _0xd22cab;});}return null;};}function removeEntity(_0x32a29a,_0x4a2934){return function(_0x35b0e7){if(_0x35b0e7){return _0x35b0e7[_0x28b0('0x25')]()[_0x28b0('0x26')](function(){_0x32a29a['status'](0xcc)[_0x28b0('0x1a')]();});}};}function handleEntityNotFound(_0x34eacb,_0x3e35fe){return function(_0x4bd42f){if(!_0x4bd42f){_0x34eacb[_0x28b0('0x18')](0x194);}return _0x4bd42f;};}function handleError(_0x37bcdd,_0x473fd4){_0x473fd4=_0x473fd4||0x1f4;return function(_0x46868c){logger['error'](_0x46868c[_0x28b0('0x27')]);if(_0x46868c[_0x28b0('0x28')]){delete _0x46868c[_0x28b0('0x28')];}_0x37bcdd[_0x28b0('0x19')](_0x473fd4)['send'](_0x46868c);};}exports[_0x28b0('0x29')]=function(_0x38c1e3,_0xd7060d){var _0x327eda={},_0x1f5a91={},_0x223c55={'count':0x0,'rows':[]};var _0x4b5853=_[_0x28b0('0x2a')](db[_0x28b0('0x2b')]['rawAttributes'],function(_0x2bd20f){return{'name':_0x2bd20f[_0x28b0('0x2c')],'type':_0x2bd20f[_0x28b0('0x2d')]['key']};});_0x1f5a91['model']=_['map'](_0x4b5853,_0x28b0('0x28'));_0x1f5a91[_0x28b0('0x2e')]=_['keys'](_0x38c1e3[_0x28b0('0x2e')]);_0x1f5a91[_0x28b0('0x2f')]=_[_0x28b0('0x30')](_0x1f5a91[_0x28b0('0x31')],_0x1f5a91[_0x28b0('0x2e')]);_0x327eda[_0x28b0('0x32')]=_['intersection'](_0x1f5a91[_0x28b0('0x31')],qs[_0x28b0('0x33')](_0x38c1e3['query'][_0x28b0('0x33')]));_0x327eda['attributes']=_0x327eda['attributes'][_0x28b0('0x34')]?_0x327eda['attributes']:_0x1f5a91[_0x28b0('0x31')];if(!_0x38c1e3[_0x28b0('0x2e')][_0x28b0('0x35')](_0x28b0('0x36'))){_0x327eda[_0x28b0('0x1e')]=qs[_0x28b0('0x1e')](_0x38c1e3[_0x28b0('0x2e')][_0x28b0('0x1e')]);_0x327eda['offset']=qs['offset'](_0x38c1e3[_0x28b0('0x2e')][_0x28b0('0x1c')]);}_0x327eda['order']=qs['sort'](_0x38c1e3[_0x28b0('0x2e')]['sort']);_0x327eda[_0x28b0('0x37')]=qs[_0x28b0('0x2f')](_[_0x28b0('0x38')](_0x38c1e3[_0x28b0('0x2e')],_0x1f5a91[_0x28b0('0x2f')]),_0x4b5853);if(_0x38c1e3['query'][_0x28b0('0x39')]){_0x327eda['where']=_['merge'](_0x327eda['where'],{'$or':_['map'](_0x4b5853,function(_0x1f953b){if(_0x1f953b['type']!=='VIRTUAL'){var _0x28ae6d={};_0x28ae6d[_0x1f953b[_0x28b0('0x28')]]={'$like':'%'+_0x38c1e3[_0x28b0('0x2e')][_0x28b0('0x39')]+'%'};return _0x28ae6d;}})});}_0x327eda=_[_0x28b0('0x3a')]({},_0x327eda,_0x38c1e3[_0x28b0('0x3b')]);var _0x3ffd27={'where':_0x327eda['where']};return db[_0x28b0('0x2b')]['count'](_0x3ffd27)[_0x28b0('0x26')](function(_0x54303c){_0x223c55[_0x28b0('0x1f')]=_0x54303c;if(_0x38c1e3[_0x28b0('0x2e')]['includeAll']){_0x327eda['include']=[{'all':!![]}];}return db[_0x28b0('0x2b')][_0x28b0('0x3c')](_0x327eda);})[_0x28b0('0x26')](function(_0x4a8110){_0x223c55[_0x28b0('0x3d')]=_0x4a8110;return _0x223c55;})['then'](respondWithFilteredResult(_0xd7060d,_0x327eda))[_0x28b0('0x3e')](handleError(_0xd7060d,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index d29d850..7508da6 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 _0xbc04=['../../config/environment','./migration.attributes','exports','define','Migration','lodash','util','../../config/logger','api','bluebird'];(function(_0x34325b,_0x5e5afe){var _0x3da348=function(_0x3bf709){while(--_0x3bf709){_0x34325b['push'](_0x34325b['shift']());}};_0x3da348(++_0x5e5afe);}(_0xbc04,0xaf));var _0x4bc0=function(_0x4b5398,_0x1ded36){_0x4b5398=_0x4b5398-0x0;var _0x3c1039=_0xbc04[_0x4b5398];return _0x3c1039;};'use strict';var _=require(_0x4bc0('0x0'));var util=require(_0x4bc0('0x1'));var logger=require(_0x4bc0('0x2'))(_0x4bc0('0x3'));var moment=require('moment');var BPromise=require(_0x4bc0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4bc0('0x5'));var attributes=require(_0x4bc0('0x6'));module[_0x4bc0('0x7')]=function(_0x5d51f6,_0x286f13){return _0x5d51f6[_0x4bc0('0x8')](_0x4bc0('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0xfcf0,0x15d));var _0x0fcf=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0xfcf0[_0x2675da];return _0x5e6153;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require(_0x0fcf('0x2'))(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var rp=require(_0x0fcf('0x6'));var fs=require('fs');var path=require(_0x0fcf('0x7'));var rimraf=require(_0x0fcf('0x8'));var config=require(_0x0fcf('0x9'));var attributes=require(_0x0fcf('0xa'));module[_0x0fcf('0xb')]=function(_0x524105,_0x50c937){return _0x524105[_0x0fcf('0xc')](_0x0fcf('0xd'),attributes,{'tableName':_0x0fcf('0xe'),'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 a14fe25..da76d1b 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 _0xa477=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x1a2067,_0x3b141b){var _0x4a76ce=function(_0x5870d7){while(--_0x5870d7){_0x1a2067['push'](_0x1a2067['shift']());}};_0x4a76ce(++_0x3b141b);}(_0xa477,0xe6));var _0x7a47=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa477[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});} \ No newline at end of file +var _0xdfe9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x28cf9d,_0x412de3){_0x28cf9d=_0x28cf9d-0x0;var _0x18e793=_0xdfe9[_0x28cf9d];return _0x18e793;};'use strict';var _=require(_0x9dfe('0x0'));var util=require('util');var moment=require(_0x9dfe('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dfe('0x2'));var db=require(_0x9dfe('0x3'))['db'];var utils=require(_0x9dfe('0x4'));var logger=require(_0x9dfe('0x5'))(_0x9dfe('0x6'));var config=require(_0x9dfe('0x7'));var jayson=require(_0x9dfe('0x8'));var client=jayson[_0x9dfe('0x9')][_0x9dfe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3471f0,_0x13b6f8,_0x5e0faf){return new BPromise(function(_0x377c1e,_0xa21ae3){return client[_0x9dfe('0xb')](_0x3471f0,_0x5e0faf)[_0x9dfe('0xc')](function(_0xcd9ecb){logger[_0x9dfe('0xd')](_0x9dfe('0xe'),_0x13b6f8,_0x9dfe('0xf'));logger['debug'](_0x9dfe('0x10'),_0x13b6f8,_0x9dfe('0xf'),JSON[_0x9dfe('0x11')](_0xcd9ecb));if(_0xcd9ecb[_0x9dfe('0x12')]){if(_0xcd9ecb['error']['code']===0x1f4){logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0xcd9ecb['error']['message']);return _0xa21ae3(_0xcd9ecb['error'][_0x9dfe('0x13')]);}logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0xcd9ecb[_0x9dfe('0x12')][_0x9dfe('0x13')]);return _0x377c1e(_0xcd9ecb[_0x9dfe('0x12')][_0x9dfe('0x13')]);}else{logger[_0x9dfe('0xd')](_0x9dfe('0xe'),_0x13b6f8,'request\x20sent');_0x377c1e(_0xcd9ecb['result'][_0x9dfe('0x13')]);}})['catch'](function(_0x1a7cbe){logger[_0x9dfe('0x12')](_0x9dfe('0xe'),_0x13b6f8,_0x1a7cbe);_0xa21ae3(_0x1a7cbe);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 15c8da4..7c0d636 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 _0x6d11=['util','path','express','fs-extra','../../components/auth/service','./network.controller','get','isAuthenticated','index','/:id','create','put','delete','destroy','exports','multer'];(function(_0x365c61,_0x42532d){var _0x894d1=function(_0x240171){while(--_0x240171){_0x365c61['push'](_0x365c61['shift']());}};_0x894d1(++_0x42532d);}(_0x6d11,0xbf));var _0x16d1=function(_0x12c43b,_0x2197f6){_0x12c43b=_0x12c43b-0x0;var _0x1ffd81=_0x6d11[_0x12c43b];return _0x1ffd81;};'use strict';var multer=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var path=require(_0x16d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x16d1('0x3'));var router=express['Router']();var fs_extra=require(_0x16d1('0x4'));var auth=require(_0x16d1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x16d1('0x6'));router[_0x16d1('0x7')]('/',auth[_0x16d1('0x8')](),controller[_0x16d1('0x9')]);router[_0x16d1('0x7')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x16d1('0xb')]);router[_0x16d1('0xc')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller['update']);router[_0x16d1('0xd')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller[_0x16d1('0xe')]);module[_0x16d1('0xf')]=router; \ No newline at end of file +var _0xc4af=['Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4af,0x88));var _0xfc4a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc4af[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xfc4a('0x0'));var util=require('util');var path=require(_0xfc4a('0x1'));var timeout=require(_0xfc4a('0x2'));var express=require(_0xfc4a('0x3'));var router=express[_0xfc4a('0x4')]();var fs_extra=require(_0xfc4a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfc4a('0x6'));var config=require(_0xfc4a('0x7'));var controller=require(_0xfc4a('0x8'));router[_0xfc4a('0x9')]('/',auth[_0xfc4a('0xa')](),controller[_0xfc4a('0xb')]);router[_0xfc4a('0x9')](_0xfc4a('0xc'),auth[_0xfc4a('0xa')](),controller[_0xfc4a('0xd')]);router[_0xfc4a('0xe')]('/',auth[_0xfc4a('0xa')](),controller[_0xfc4a('0xf')]);router[_0xfc4a('0x10')](_0xfc4a('0xc'),auth[_0xfc4a('0xa')](),controller[_0xfc4a('0x11')]);router[_0xfc4a('0x12')](_0xfc4a('0xc'),auth['isAuthenticated'](),controller[_0xfc4a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 88676a3..40e86fc 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 _0x1dcf=['turn','STRING','sequelize','externip','stun'];(function(_0x5a66c3,_0x96b255){var _0xa2028d=function(_0x40bfc2){while(--_0x40bfc2){_0x5a66c3['push'](_0x5a66c3['shift']());}};_0xa2028d(++_0x96b255);}(_0x1dcf,0x1d8));var _0xf1dc=function(_0x4e924f,_0x2b7e01){_0x4e924f=_0x4e924f-0x0;var _0xb9a6a2=_0x1dcf[_0x4e924f];return _0xb9a6a2;};'use strict';var Sequelize=require(_0xf1dc('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('localnet',_0xf1dc('0x1'),_0xf1dc('0x2'),_0xf1dc('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf1dc('0x4')]}}; \ No newline at end of file +var _0x7a91=['externip','stun','STRING','sequelize','exports','ENUM'];(function(_0x3c1b2d,_0x23b1b9){var _0x412475=function(_0x1245ad){while(--_0x1245ad){_0x3c1b2d['push'](_0x3c1b2d['shift']());}};_0x412475(++_0x23b1b9);}(_0x7a91,0xc9));var _0x17a9=function(_0x10d479,_0x84ea59){_0x10d479=_0x10d479-0x0;var _0x1fec1f=_0x7a91[_0x10d479];return _0x1fec1f;};'use strict';var Sequelize=require(_0x17a9('0x0'));module[_0x17a9('0x1')]={'type':{'type':Sequelize[_0x17a9('0x2')]('localnet',_0x17a9('0x3'),_0x17a9('0x4'),'turn')},'value':{'type':Sequelize[_0x17a9('0x5')]},'username':{'type':Sequelize[_0x17a9('0x5')]},'password':{'type':Sequelize[_0x17a9('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 129a545..6c46774 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 _0xd2f3=['rows','show','params','rawAttributes','fields','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','offset','undefined','limit','count','set','json','update','then','destroy','send','Network','fieldName','type','key','map','name','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','includeAll','include','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd2f3,0x6d));var _0x3d2f=function(_0x43cf91,_0x197109){_0x43cf91=_0x43cf91-0x0;var _0x1f0fdb=_0xd2f3[_0x43cf91];return _0x1f0fdb;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0x3d2f('0x0'));var fs=require('fs');var _=require(_0x3d2f('0x1'));var qs=require(_0x3d2f('0x2'));var logger=require(_0x3d2f('0x3'))(_0x3d2f('0x4'));var config=require(_0x3d2f('0x5'));var db=require(_0x3d2f('0x6'))['db'];var jayson=require(_0x3d2f('0x7'));var client=jayson[_0x3d2f('0x8')][_0x3d2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d0684,_0x1fee7d,_0x59c640,_0x4b6e90){return new Promise(function(_0x187ea0,_0x3a981d){var _0x1c6de4=_0x4b6e90||client;return _0x1c6de4[_0x3d2f('0xa')](_0x1d0684,_0x59c640)['then'](function(_0x50fa9b){logger['info'](_0x3d2f('0xb'),_0x1fee7d,_0x3d2f('0xc'));logger['debug'](_0x3d2f('0xd'),_0x1fee7d,_0x3d2f('0xc'),JSON[_0x3d2f('0xe')](_0x50fa9b));if(_0x50fa9b['error']){if(_0x50fa9b[_0x3d2f('0xf')]['code']===0x1f4){logger[_0x3d2f('0xf')](_0x3d2f('0xb'),_0x1fee7d,_0x50fa9b[_0x3d2f('0xf')][_0x3d2f('0x10')]);return _0x3a981d(_0x50fa9b[_0x3d2f('0xf')][_0x3d2f('0x10')]);}logger[_0x3d2f('0xf')](_0x3d2f('0xb'),_0x1fee7d,_0x50fa9b[_0x3d2f('0xf')][_0x3d2f('0x10')]);return _0x187ea0(_0x50fa9b['error']['message']);}else{logger['info']('Network,\x20%s,\x20%s',_0x1fee7d,_0x3d2f('0xc'));_0x187ea0(_0x50fa9b['result'][_0x3d2f('0x10')]);}})[_0x3d2f('0x11')](function(_0x1e96fd){logger[_0x3d2f('0xf')](_0x3d2f('0xb'),_0x1fee7d,_0x1e96fd);_0x3a981d(_0x1e96fd);});});}function respondWithResult(_0xbb7995,_0x1d5bad){_0x1d5bad=_0x1d5bad||0xc8;return function(_0x3a4b56){if(_0x3a4b56){return _0xbb7995[_0x3d2f('0x12')](_0x1d5bad)['json'](_0x3a4b56);}};}function respondWithFilteredResult(_0x2610a5,_0x93b790){return function(_0x1abe6d){if(_0x1abe6d){var _0x4aefc9=typeof _0x93b790[_0x3d2f('0x13')]===_0x3d2f('0x14')&&typeof _0x93b790[_0x3d2f('0x15')]===_0x3d2f('0x14');var _0x45b8c8=_0x1abe6d[_0x3d2f('0x16')];var _0x1eb758=_0x4aefc9?0x0:_0x93b790[_0x3d2f('0x13')];var _0x4b694a=_0x4aefc9?_0x1abe6d[_0x3d2f('0x16')]:_0x93b790[_0x3d2f('0x13')]+_0x93b790[_0x3d2f('0x15')];var _0x382527;if(_0x4b694a>=_0x45b8c8){_0x4b694a=_0x45b8c8;_0x382527=0xc8;}else{_0x382527=0xce;}_0x2610a5[_0x3d2f('0x12')](_0x382527);return _0x2610a5[_0x3d2f('0x17')]('Content-Range',_0x1eb758+'-'+_0x4b694a+'/'+_0x45b8c8)[_0x3d2f('0x18')](_0x1abe6d);}return null;};}function saveUpdates(_0xf482d0){return function(_0x5daefc){if(_0x5daefc){return _0x5daefc[_0x3d2f('0x19')](_0xf482d0)[_0x3d2f('0x1a')](function(_0x547a02){return _0x547a02;});}return null;};}function removeEntity(_0x568942){return function(_0x377113){if(_0x377113){return _0x377113[_0x3d2f('0x1b')]()[_0x3d2f('0x1a')](function(){_0x568942[_0x3d2f('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4accab){return function(_0x570df8){if(!_0x570df8){_0x4accab['sendStatus'](0x194);}return _0x570df8;};}function handleError(_0xa80fb0,_0x5b4009){_0x5b4009=_0x5b4009||0x1f4;return function(_0x2875e2){logger['error'](_0x2875e2['stack']);if(_0x2875e2['name']){delete _0x2875e2['name'];}_0xa80fb0[_0x3d2f('0x12')](_0x5b4009)[_0x3d2f('0x1c')](_0x2875e2);};}exports['index']=function(_0x39bea0,_0x40fd3e){var _0x13b7fd={},_0x352951={},_0x8d4b6a={'count':0x0,'rows':[]};var _0x16bff1=_['map'](db[_0x3d2f('0x1d')]['rawAttributes'],function(_0x51f2c2){return{'name':_0x51f2c2[_0x3d2f('0x1e')],'type':_0x51f2c2[_0x3d2f('0x1f')][_0x3d2f('0x20')]};});_0x352951['model']=_[_0x3d2f('0x21')](_0x16bff1,_0x3d2f('0x22'));_0x352951[_0x3d2f('0x23')]=_[_0x3d2f('0x24')](_0x39bea0[_0x3d2f('0x23')]);_0x352951['filters']=_[_0x3d2f('0x25')](_0x352951[_0x3d2f('0x26')],_0x352951['query']);_0x13b7fd[_0x3d2f('0x27')]=_[_0x3d2f('0x25')](_0x352951[_0x3d2f('0x26')],qs['fields'](_0x39bea0[_0x3d2f('0x23')]['fields']));_0x13b7fd[_0x3d2f('0x27')]=_0x13b7fd[_0x3d2f('0x27')][_0x3d2f('0x28')]?_0x13b7fd[_0x3d2f('0x27')]:_0x352951['model'];if(!_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x29')](_0x3d2f('0x2a'))){_0x13b7fd[_0x3d2f('0x15')]=qs['limit'](_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x15')]);_0x13b7fd['offset']=qs['offset'](_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x13')]);}_0x13b7fd[_0x3d2f('0x2b')]=qs['sort'](_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x2c')]);_0x13b7fd['where']=qs[_0x3d2f('0x2d')](_['pick'](_0x39bea0[_0x3d2f('0x23')],_0x352951[_0x3d2f('0x2d')]),_0x16bff1);if(_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x2e')]){_0x13b7fd[_0x3d2f('0x2f')]=_['merge'](_0x13b7fd[_0x3d2f('0x2f')],{'$or':_[_0x3d2f('0x21')](_0x16bff1,function(_0x42e0c1){if(_0x42e0c1['type']!==_0x3d2f('0x30')){var _0x5ce5f7={};_0x5ce5f7[_0x42e0c1[_0x3d2f('0x22')]]={'$like':'%'+_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x2e')]+'%'};return _0x5ce5f7;}})});}_0x13b7fd=_[_0x3d2f('0x31')]({},_0x13b7fd,_0x39bea0['options']);var _0x415bd8={'where':_0x13b7fd[_0x3d2f('0x2f')]};return db[_0x3d2f('0x1d')][_0x3d2f('0x16')](_0x415bd8)[_0x3d2f('0x1a')](function(_0x529627){_0x8d4b6a[_0x3d2f('0x16')]=_0x529627;if(_0x39bea0[_0x3d2f('0x23')][_0x3d2f('0x32')]){_0x13b7fd[_0x3d2f('0x33')]=[{'all':!![]}];}return db[_0x3d2f('0x1d')][_0x3d2f('0x34')](_0x13b7fd);})[_0x3d2f('0x1a')](function(_0x6baa64){_0x8d4b6a[_0x3d2f('0x35')]=_0x6baa64;return _0x8d4b6a;})[_0x3d2f('0x1a')](respondWithFilteredResult(_0x40fd3e,_0x13b7fd))['catch'](handleError(_0x40fd3e,null));};exports[_0x3d2f('0x36')]=function(_0xba403d,_0x444c09){var _0x178963={'raw':!![],'where':{'id':_0xba403d[_0x3d2f('0x37')]['id']}},_0x1931b8={};_0x1931b8[_0x3d2f('0x26')]=_[_0x3d2f('0x24')](db[_0x3d2f('0x1d')][_0x3d2f('0x38')]);_0x1931b8['query']=_['keys'](_0xba403d[_0x3d2f('0x23')]);_0x1931b8['filters']=_[_0x3d2f('0x25')](_0x1931b8[_0x3d2f('0x26')],_0x1931b8[_0x3d2f('0x23')]);_0x178963[_0x3d2f('0x27')]=_['intersection'](_0x1931b8[_0x3d2f('0x26')],qs['fields'](_0xba403d[_0x3d2f('0x23')][_0x3d2f('0x39')]));_0x178963['attributes']=_0x178963[_0x3d2f('0x27')][_0x3d2f('0x28')]?_0x178963[_0x3d2f('0x27')]:_0x1931b8[_0x3d2f('0x26')];if(_0xba403d[_0x3d2f('0x23')][_0x3d2f('0x32')]){_0x178963[_0x3d2f('0x33')]=[{'all':!![]}];}_0x178963=_[_0x3d2f('0x31')]({},_0x178963,_0xba403d['options']);return db['Network'][_0x3d2f('0x3a')](_0x178963)[_0x3d2f('0x1a')](handleEntityNotFound(_0x444c09,null))[_0x3d2f('0x1a')](respondWithResult(_0x444c09,null))[_0x3d2f('0x11')](handleError(_0x444c09,null));};exports[_0x3d2f('0x3b')]=function(_0x585004,_0x4d5872){var _0x274fc6;return db[_0x3d2f('0x1d')][_0x3d2f('0x3b')](_0x585004[_0x3d2f('0x3c')],{'raw':!![]})[_0x3d2f('0x1a')](function(_0x27d0fb){_0x274fc6=_0x27d0fb;return db[_0x3d2f('0x1d')]['findAll']({'where':{'type':_0x585004['body']['type']},'raw':!![]});})[_0x3d2f('0x1a')](function(_0x47b1df){if(_0x274fc6[_0x3d2f('0x1f')][_0x3d2f('0x3d')]()==_0x3d2f('0x3e')){var _0x3e658e=fs['readFileSync'](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x41')),_0x3d2f('0x42'));var _0x530562=ejs['render'](_0x3e658e,{'networks':_0x47b1df||[]});fs[_0x3d2f('0x43')](_0x3d2f('0x44'),_0x530562);return respondWithRpcPromise(_0x3d2f('0x45'),_0x3d2f('0x3b'),{'module':_0x3d2f('0x46')});}else if(_0x274fc6['type'][_0x3d2f('0x3d')]()==_0x3d2f('0x47')){var _0x4b2d3b=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x49')),_0x3d2f('0x42'));var _0x472638=ejs[_0x3d2f('0x4a')](_0x4b2d3b,{'networks':_0x47b1df||[]});fs[_0x3d2f('0x43')](_0x3d2f('0x4b'),_0x472638);return respondWithRpcPromise(_0x3d2f('0x45'),_0x3d2f('0x3b'),{'module':_0x3d2f('0x46')});}else{var _0x320748=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x4c')),_0x3d2f('0x42'));var _0x568ff6=ejs['render'](_0x320748,{'networks':_0x47b1df||[]});fs[_0x3d2f('0x43')](util[_0x3d2f('0x4d')](_0x3d2f('0x4e'),_0x585004[_0x3d2f('0x3c')][_0x3d2f('0x1f')][_0x3d2f('0x4f')]()),_0x568ff6);return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});}})['then'](function(){return _0x274fc6;})[_0x3d2f('0x1a')](respondWithResult(_0x4d5872,0xc9))[_0x3d2f('0x11')](handleError(_0x4d5872,null));};exports['update']=function(_0xa1c675,_0x4aa102){var _0x19efb4;return db[_0x3d2f('0x1d')]['find']({'where':{'id':_0xa1c675[_0x3d2f('0x37')]['id']}})['then'](handleEntityNotFound(_0x4aa102,null))['then'](saveUpdates(_0xa1c675[_0x3d2f('0x3c')],null))['then'](function(_0x466591){if(_0x466591){_0x19efb4=_0x466591;return db[_0x3d2f('0x1d')][_0x3d2f('0x34')]({'where':{'type':_0x19efb4[_0x3d2f('0x1f')]},'raw':!![]});}return null;})['then'](function(_0xda4bcc){if(_0x19efb4[_0x3d2f('0x1f')][_0x3d2f('0x3d')]()==_0x3d2f('0x3e')){var _0x5a403e=fs['readFileSync'](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],'server/files/templates/stun_multiple.ejs'),_0x3d2f('0x42'));var _0x3d6d04=ejs[_0x3d2f('0x4a')](_0x5a403e,{'networks':_0xda4bcc||[]});fs[_0x3d2f('0x43')](_0x3d2f('0x44'),_0x3d6d04);return respondWithRpcPromise('Reload',_0x3d2f('0x19'),{'module':_0x3d2f('0x46')});}else if(_0x19efb4[_0x3d2f('0x1f')][_0x3d2f('0x3d')]()==_0x3d2f('0x47')){var _0xacc87d=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config['root'],_0x3d2f('0x49')),_0x3d2f('0x42'));var _0x5f26fa=ejs[_0x3d2f('0x4a')](_0xacc87d,{'networks':_0xda4bcc||[]});fs[_0x3d2f('0x43')](_0x3d2f('0x4b'),_0x5f26fa);return respondWithRpcPromise(_0x3d2f('0x45'),_0x3d2f('0x19'),{'module':_0x3d2f('0x46')});}else{var _0x1094a7=fs[_0x3d2f('0x48')](path['join'](config[_0x3d2f('0x40')],_0x3d2f('0x4c')),'utf8');var _0x33f00a=ejs['render'](_0x1094a7,{'networks':_0xda4bcc||[]});fs['writeFileSync'](util[_0x3d2f('0x4d')](_0x3d2f('0x4e'),_0xa1c675[_0x3d2f('0x3c')][_0x3d2f('0x1f')][_0x3d2f('0x4f')]()),_0x33f00a);return respondWithRpcPromise(_0x3d2f('0x45'),_0x3d2f('0x19'),{'module':'chan_sip.so'});}})['then'](function(_0x1686c8){if(_0x1686c8){return _0x19efb4;}return null;})[_0x3d2f('0x1a')](respondWithResult(_0x4aa102,null))['catch'](handleError(_0x4aa102,null));};exports[_0x3d2f('0x1b')]=function(_0x574999,_0x5d45bb){var _0x51857b;return db[_0x3d2f('0x1d')][_0x3d2f('0x3a')]({'where':{'id':_0x574999[_0x3d2f('0x37')]['id']}})['then'](function(_0x2fb7e2){_0x51857b=_0x2fb7e2;return _0x2fb7e2;})[_0x3d2f('0x1a')](handleEntityNotFound(_0x5d45bb,null))['then'](removeEntity(_0x5d45bb,null))[_0x3d2f('0x1a')](function(){if(_0x51857b){return db[_0x3d2f('0x1d')]['findAll']({'where':{'type':_0x51857b[_0x3d2f('0x1f')]},'raw':!![]});}})[_0x3d2f('0x1a')](function(_0x671a55){if(_0x51857b[_0x3d2f('0x1f')][_0x3d2f('0x3d')]()==_0x3d2f('0x3e')){var _0x2d3744=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x41')),_0x3d2f('0x42'));var _0x33f972=ejs[_0x3d2f('0x4a')](_0x2d3744,{'networks':_0x671a55||[]});fs[_0x3d2f('0x43')](_0x3d2f('0x44'),_0x33f972);return respondWithRpcPromise(_0x3d2f('0x45'),_0x3d2f('0x1b'),{'module':'res_stun_monitor.so'});}else if(_0x51857b[_0x3d2f('0x1f')][_0x3d2f('0x3d')]()==_0x3d2f('0x47')){var _0x8cc563=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x49')),'utf8');var _0x1b3d34=ejs[_0x3d2f('0x4a')](_0x8cc563,{'networks':_0x671a55||[]});fs[_0x3d2f('0x43')]('/etc/asterisk/turn_xcally.conf',_0x1b3d34);return respondWithRpcPromise('Reload',_0x3d2f('0x1b'),{'module':_0x3d2f('0x46')});}else{var _0x52c4d2=fs[_0x3d2f('0x48')](path[_0x3d2f('0x3f')](config[_0x3d2f('0x40')],_0x3d2f('0x4c')),_0x3d2f('0x42'));var _0x1511d6=ejs['render'](_0x52c4d2,{'networks':_0x671a55||[]});fs[_0x3d2f('0x43')](util[_0x3d2f('0x4d')](_0x3d2f('0x4e'),_0x51857b['type'][_0x3d2f('0x4f')]()),_0x1511d6);return respondWithRpcPromise(_0x3d2f('0x45'),'destroy',{'module':_0x3d2f('0x50')});}})[_0x3d2f('0x11')](handleError(_0x5d45bb,null));}; \ No newline at end of file +var _0xc691=['type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Network','rows','params','includeAll','include','find','create','body','findAll','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','toLowerCase','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','update','destroy','sendStatus','stack','name','send','map','rawAttributes','fieldName'];(function(_0x20cf8a,_0x44cd6b){var _0x54e165=function(_0xcce1d0){while(--_0xcce1d0){_0x20cf8a['push'](_0x20cf8a['shift']());}};_0x54e165(++_0x44cd6b);}(_0xc691,0xdb));var _0x1c69=function(_0x463c7e,_0x1dd4b3){_0x463c7e=_0x463c7e-0x0;var _0x250ec6=_0xc691[_0x463c7e];return _0x250ec6;};'use strict';var util=require(_0x1c69('0x0'));var path=require(_0x1c69('0x1'));var ejs=require(_0x1c69('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x1c69('0x3'));var logger=require(_0x1c69('0x4'))(_0x1c69('0x5'));var config=require(_0x1c69('0x6'));var db=require(_0x1c69('0x7'))['db'];var jayson=require(_0x1c69('0x8'));var client=jayson[_0x1c69('0x9')][_0x1c69('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x544e4a,_0x3e0943,_0x40021b,_0xdb0720){return new Promise(function(_0x558e7e,_0x416225){var _0x36676e=_0xdb0720||client;return _0x36676e[_0x1c69('0xb')](_0x544e4a,_0x40021b)[_0x1c69('0xc')](function(_0x244720){logger[_0x1c69('0xd')]('Network,\x20%s,\x20%s',_0x3e0943,_0x1c69('0xe'));logger[_0x1c69('0xf')](_0x1c69('0x10'),_0x3e0943,_0x1c69('0xe'),JSON['stringify'](_0x244720));if(_0x244720[_0x1c69('0x11')]){if(_0x244720[_0x1c69('0x11')][_0x1c69('0x12')]===0x1f4){logger['error'](_0x1c69('0x13'),_0x3e0943,_0x244720[_0x1c69('0x11')][_0x1c69('0x14')]);return _0x416225(_0x244720[_0x1c69('0x11')]['message']);}logger[_0x1c69('0x11')](_0x1c69('0x13'),_0x3e0943,_0x244720[_0x1c69('0x11')][_0x1c69('0x14')]);return _0x558e7e(_0x244720[_0x1c69('0x11')][_0x1c69('0x14')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x3e0943,_0x1c69('0xe'));_0x558e7e(_0x244720[_0x1c69('0x15')][_0x1c69('0x14')]);}})[_0x1c69('0x16')](function(_0xed9822){logger[_0x1c69('0x11')]('Network,\x20%s,\x20%s',_0x3e0943,_0xed9822);_0x416225(_0xed9822);});});}function respondWithResult(_0x35effa,_0x413ae0){_0x413ae0=_0x413ae0||0xc8;return function(_0x5e779b){if(_0x5e779b){return _0x35effa[_0x1c69('0x17')](_0x413ae0)[_0x1c69('0x18')](_0x5e779b);}};}function respondWithFilteredResult(_0x6a1814,_0x259e9c){return function(_0x196127){if(_0x196127){var _0x1d9f79=typeof _0x259e9c[_0x1c69('0x19')]===_0x1c69('0x1a')&&typeof _0x259e9c[_0x1c69('0x1b')]==='undefined';var _0x5e9edc=_0x196127['count'];var _0x3e2244=_0x1d9f79?0x0:_0x259e9c['offset'];var _0x954b5d=_0x1d9f79?_0x196127[_0x1c69('0x1c')]:_0x259e9c[_0x1c69('0x19')]+_0x259e9c[_0x1c69('0x1b')];var _0xcdf6ca;if(_0x954b5d>=_0x5e9edc){_0x954b5d=_0x5e9edc;_0xcdf6ca=0xc8;}else{_0xcdf6ca=0xce;}_0x6a1814[_0x1c69('0x17')](_0xcdf6ca);return _0x6a1814['set'](_0x1c69('0x1d'),_0x3e2244+'-'+_0x954b5d+'/'+_0x5e9edc)[_0x1c69('0x18')](_0x196127);}return null;};}function saveUpdates(_0x20cc91){return function(_0x4f4e8b){if(_0x4f4e8b){return _0x4f4e8b[_0x1c69('0x1e')](_0x20cc91)[_0x1c69('0xc')](function(_0x3017f6){return _0x3017f6;});}return null;};}function removeEntity(_0x4be705){return function(_0x2091e5){if(_0x2091e5){return _0x2091e5[_0x1c69('0x1f')]()[_0x1c69('0xc')](function(){_0x4be705[_0x1c69('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f26f0){return function(_0x14a32d){if(!_0x14a32d){_0x4f26f0[_0x1c69('0x20')](0x194);}return _0x14a32d;};}function handleError(_0x2d3ff6,_0x10f0a0){_0x10f0a0=_0x10f0a0||0x1f4;return function(_0x539a40){logger['error'](_0x539a40[_0x1c69('0x21')]);if(_0x539a40[_0x1c69('0x22')]){delete _0x539a40[_0x1c69('0x22')];}_0x2d3ff6[_0x1c69('0x17')](_0x10f0a0)[_0x1c69('0x23')](_0x539a40);};}exports['index']=function(_0x55d960,_0x366179){var _0x127e13={},_0x4f7058={},_0x4f6cc2={'count':0x0,'rows':[]};var _0x3a6fcd=_[_0x1c69('0x24')](db['Network'][_0x1c69('0x25')],function(_0x259097){return{'name':_0x259097[_0x1c69('0x26')],'type':_0x259097[_0x1c69('0x27')][_0x1c69('0x28')]};});_0x4f7058[_0x1c69('0x29')]=_[_0x1c69('0x24')](_0x3a6fcd,'name');_0x4f7058[_0x1c69('0x2a')]=_[_0x1c69('0x2b')](_0x55d960['query']);_0x4f7058[_0x1c69('0x2c')]=_['intersection'](_0x4f7058[_0x1c69('0x29')],_0x4f7058['query']);_0x127e13[_0x1c69('0x2d')]=_[_0x1c69('0x2e')](_0x4f7058[_0x1c69('0x29')],qs['fields'](_0x55d960[_0x1c69('0x2a')][_0x1c69('0x2f')]));_0x127e13['attributes']=_0x127e13[_0x1c69('0x2d')][_0x1c69('0x30')]?_0x127e13['attributes']:_0x4f7058[_0x1c69('0x29')];if(!_0x55d960[_0x1c69('0x2a')]['hasOwnProperty'](_0x1c69('0x31'))){_0x127e13[_0x1c69('0x1b')]=qs[_0x1c69('0x1b')](_0x55d960[_0x1c69('0x2a')][_0x1c69('0x1b')]);_0x127e13[_0x1c69('0x19')]=qs[_0x1c69('0x19')](_0x55d960['query']['offset']);}_0x127e13[_0x1c69('0x32')]=qs[_0x1c69('0x33')](_0x55d960[_0x1c69('0x2a')][_0x1c69('0x33')]);_0x127e13[_0x1c69('0x34')]=qs[_0x1c69('0x2c')](_[_0x1c69('0x35')](_0x55d960[_0x1c69('0x2a')],_0x4f7058[_0x1c69('0x2c')]),_0x3a6fcd);if(_0x55d960[_0x1c69('0x2a')][_0x1c69('0x36')]){_0x127e13['where']=_[_0x1c69('0x37')](_0x127e13[_0x1c69('0x34')],{'$or':_[_0x1c69('0x24')](_0x3a6fcd,function(_0x32b58b){if(_0x32b58b[_0x1c69('0x27')]!==_0x1c69('0x38')){var _0x27312a={};_0x27312a[_0x32b58b[_0x1c69('0x22')]]={'$like':'%'+_0x55d960['query'][_0x1c69('0x36')]+'%'};return _0x27312a;}})});}_0x127e13=_[_0x1c69('0x37')]({},_0x127e13,_0x55d960['options']);var _0x5c2330={'where':_0x127e13['where']};return db[_0x1c69('0x39')]['count'](_0x5c2330)[_0x1c69('0xc')](function(_0x156af3){_0x4f6cc2[_0x1c69('0x1c')]=_0x156af3;if(_0x55d960[_0x1c69('0x2a')]['includeAll']){_0x127e13['include']=[{'all':!![]}];}return db[_0x1c69('0x39')]['findAll'](_0x127e13);})['then'](function(_0x4dea6e){_0x4f6cc2[_0x1c69('0x3a')]=_0x4dea6e;return _0x4f6cc2;})[_0x1c69('0xc')](respondWithFilteredResult(_0x366179,_0x127e13))[_0x1c69('0x16')](handleError(_0x366179,null));};exports['show']=function(_0x34fd33,_0x1174ce){var _0x3f09c7={'raw':!![],'where':{'id':_0x34fd33[_0x1c69('0x3b')]['id']}},_0x116b06={};_0x116b06[_0x1c69('0x29')]=_[_0x1c69('0x2b')](db['Network'][_0x1c69('0x25')]);_0x116b06[_0x1c69('0x2a')]=_[_0x1c69('0x2b')](_0x34fd33[_0x1c69('0x2a')]);_0x116b06['filters']=_[_0x1c69('0x2e')](_0x116b06['model'],_0x116b06[_0x1c69('0x2a')]);_0x3f09c7[_0x1c69('0x2d')]=_[_0x1c69('0x2e')](_0x116b06[_0x1c69('0x29')],qs[_0x1c69('0x2f')](_0x34fd33['query'][_0x1c69('0x2f')]));_0x3f09c7[_0x1c69('0x2d')]=_0x3f09c7['attributes']['length']?_0x3f09c7['attributes']:_0x116b06[_0x1c69('0x29')];if(_0x34fd33[_0x1c69('0x2a')][_0x1c69('0x3c')]){_0x3f09c7[_0x1c69('0x3d')]=[{'all':!![]}];}_0x3f09c7=_[_0x1c69('0x37')]({},_0x3f09c7,_0x34fd33['options']);return db[_0x1c69('0x39')][_0x1c69('0x3e')](_0x3f09c7)['then'](handleEntityNotFound(_0x1174ce,null))['then'](respondWithResult(_0x1174ce,null))[_0x1c69('0x16')](handleError(_0x1174ce,null));};exports[_0x1c69('0x3f')]=function(_0x20532f,_0x3246fd){var _0x355dee;return db[_0x1c69('0x39')][_0x1c69('0x3f')](_0x20532f[_0x1c69('0x40')],{'raw':!![]})[_0x1c69('0xc')](function(_0x43b275){_0x355dee=_0x43b275;return db[_0x1c69('0x39')][_0x1c69('0x41')]({'where':{'type':_0x20532f[_0x1c69('0x40')][_0x1c69('0x27')]},'raw':!![]});})['then'](function(_0xd5d74a){if(_0x355dee['type'][_0x1c69('0x42')]()==_0x1c69('0x43')){var _0x23ff33=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config[_0x1c69('0x46')],_0x1c69('0x47')),_0x1c69('0x48'));var _0x508adc=ejs['render'](_0x23ff33,{'networks':_0xd5d74a||[]});fs[_0x1c69('0x49')](_0x1c69('0x4a'),_0x508adc);return respondWithRpcPromise('Reload',_0x1c69('0x3f'),{'module':_0x1c69('0x4b')});}else if(_0x355dee['type'][_0x1c69('0x42')]()==_0x1c69('0x4c')){var _0x3a9f79=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config[_0x1c69('0x46')],_0x1c69('0x4d')),_0x1c69('0x48'));var _0x57dae8=ejs[_0x1c69('0x4e')](_0x3a9f79,{'networks':_0xd5d74a||[]});fs[_0x1c69('0x49')](_0x1c69('0x4f'),_0x57dae8);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x3f'),{'module':'res_stun_monitor.so'});}else{var _0x4a403c=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config[_0x1c69('0x46')],_0x1c69('0x51')),_0x1c69('0x48'));var _0x7abda7=ejs[_0x1c69('0x4e')](_0x4a403c,{'networks':_0xd5d74a||[]});fs['writeFileSync'](util[_0x1c69('0x52')](_0x1c69('0x53'),_0x20532f[_0x1c69('0x40')][_0x1c69('0x27')]['toLowerCase']()),_0x7abda7);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x3f'),{'module':_0x1c69('0x54')});}})[_0x1c69('0xc')](function(){return _0x355dee;})[_0x1c69('0xc')](respondWithResult(_0x3246fd,0xc9))[_0x1c69('0x16')](handleError(_0x3246fd,null));};exports['update']=function(_0x2f4f60,_0x4c3a95){var _0x59fb06;return db['Network'][_0x1c69('0x3e')]({'where':{'id':_0x2f4f60[_0x1c69('0x3b')]['id']}})[_0x1c69('0xc')](handleEntityNotFound(_0x4c3a95,null))[_0x1c69('0xc')](saveUpdates(_0x2f4f60['body'],null))[_0x1c69('0xc')](function(_0x5891d2){if(_0x5891d2){_0x59fb06=_0x5891d2;return db[_0x1c69('0x39')][_0x1c69('0x41')]({'where':{'type':_0x59fb06['type']},'raw':!![]});}return null;})['then'](function(_0x412956){if(_0x59fb06[_0x1c69('0x27')][_0x1c69('0x42')]()=='STUN'){var _0x1f5fb5=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config[_0x1c69('0x46')],_0x1c69('0x47')),_0x1c69('0x48'));var _0x4d32aa=ejs[_0x1c69('0x4e')](_0x1f5fb5,{'networks':_0x412956||[]});fs['writeFileSync'](_0x1c69('0x4a'),_0x4d32aa);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x1e'),{'module':_0x1c69('0x4b')});}else if(_0x59fb06['type'][_0x1c69('0x42')]()==_0x1c69('0x4c')){var _0x457d90=fs['readFileSync'](path[_0x1c69('0x45')](config[_0x1c69('0x46')],_0x1c69('0x4d')),_0x1c69('0x48'));var _0x4297cb=ejs['render'](_0x457d90,{'networks':_0x412956||[]});fs[_0x1c69('0x49')](_0x1c69('0x4f'),_0x4297cb);return respondWithRpcPromise('Reload','update',{'module':_0x1c69('0x4b')});}else{var _0x22466d=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config['root'],_0x1c69('0x51')),_0x1c69('0x48'));var _0x4ca31a=ejs[_0x1c69('0x4e')](_0x22466d,{'networks':_0x412956||[]});fs[_0x1c69('0x49')](util[_0x1c69('0x52')](_0x1c69('0x53'),_0x2f4f60['body']['type'][_0x1c69('0x55')]()),_0x4ca31a);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x1e'),{'module':_0x1c69('0x54')});}})[_0x1c69('0xc')](function(_0xbbf1b){if(_0xbbf1b){return _0x59fb06;}return null;})[_0x1c69('0xc')](respondWithResult(_0x4c3a95,null))[_0x1c69('0x16')](handleError(_0x4c3a95,null));};exports[_0x1c69('0x1f')]=function(_0x463048,_0x552869){var _0x428010;return db[_0x1c69('0x39')][_0x1c69('0x3e')]({'where':{'id':_0x463048['params']['id']}})['then'](function(_0x388dc0){_0x428010=_0x388dc0;return _0x388dc0;})[_0x1c69('0xc')](handleEntityNotFound(_0x552869,null))[_0x1c69('0xc')](removeEntity(_0x552869,null))[_0x1c69('0xc')](function(){if(_0x428010){return db['Network'][_0x1c69('0x41')]({'where':{'type':_0x428010[_0x1c69('0x27')]},'raw':!![]});}})[_0x1c69('0xc')](function(_0x4361c9){if(_0x428010[_0x1c69('0x27')][_0x1c69('0x42')]()==_0x1c69('0x43')){var _0x22dc83=fs[_0x1c69('0x44')](path[_0x1c69('0x45')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x1c69('0x48'));var _0x39826e=ejs['render'](_0x22dc83,{'networks':_0x4361c9||[]});fs[_0x1c69('0x49')](_0x1c69('0x4a'),_0x39826e);return respondWithRpcPromise(_0x1c69('0x50'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x428010[_0x1c69('0x27')][_0x1c69('0x42')]()==_0x1c69('0x4c')){var _0x49e920=fs[_0x1c69('0x44')](path['join'](config['root'],_0x1c69('0x4d')),_0x1c69('0x48'));var _0x5ceaa6=ejs[_0x1c69('0x4e')](_0x49e920,{'networks':_0x4361c9||[]});fs[_0x1c69('0x49')](_0x1c69('0x4f'),_0x5ceaa6);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x1f'),{'module':'res_stun_monitor.so'});}else{var _0x5239b4=fs[_0x1c69('0x44')](path['join'](config['root'],'server/files/templates/network.ejs'),_0x1c69('0x48'));var _0x5f1a6d=ejs['render'](_0x5239b4,{'networks':_0x4361c9||[]});fs[_0x1c69('0x49')](util['format'](_0x1c69('0x53'),_0x428010[_0x1c69('0x27')]['toLowerCase']()),_0x5f1a6d);return respondWithRpcPromise(_0x1c69('0x50'),_0x1c69('0x1f'),{'module':_0x1c69('0x54')});}})[_0x1c69('0x16')](handleError(_0x552869,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index b39c597..49aa5db 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 _0x9567=['lodash','util','../../config/logger','api','moment','path','rimraf','./network.attributes','define','Network'];(function(_0x403702,_0x180d17){var _0x41b93e=function(_0x152c67){while(--_0x152c67){_0x403702['push'](_0x403702['shift']());}};_0x41b93e(++_0x180d17);}(_0x9567,0xdc));var _0x7956=function(_0x27dcc9,_0x1f5b5b){_0x27dcc9=_0x27dcc9-0x0;var _0xaa0fd9=_0x9567[_0x27dcc9];return _0xaa0fd9;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var logger=require(_0x7956('0x2'))(_0x7956('0x3'));var moment=require(_0x7956('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7956('0x5'));var rimraf=require(_0x7956('0x6'));var config=require('../../config/environment');var attributes=require(_0x7956('0x7'));module['exports']=function(_0x12c09e,_0x48c4b6){return _0x12c09e[_0x7956('0x8')](_0x7956('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e9f=['moment','path','./network.attributes','exports','Network','network','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0e9f,0x116));var _0xf0e9=function(_0x142a38,_0x225944){_0x142a38=_0x142a38-0x0;var _0xcf662c=_0x0e9f[_0x142a38];return _0xcf662c;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf0e9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0e9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf0e9('0x4'));module[_0xf0e9('0x5')]=function(_0x59ac7e,_0x2322dc){return _0x59ac7e['define'](_0xf0e9('0x6'),attributes,{'tableName':_0xf0e9('0x7'),'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 d49479f..b15269f 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(_0x1e5703,_0xfaacdc){var _0x202a30=function(_0x533e42){while(--_0x533e42){_0x1e5703['push'](_0x1e5703['shift']());}};_0x202a30(++_0xfaacdc);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x5a9c2d,_0x4350fb){_0x5a9c2d=_0x5a9c2d-0x0;var _0x4269bb=_0x7a54[_0x5a9c2d];return _0x4269bb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index c7be67b..7d63912 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 _0x9e11=['delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','Router','fs-extra','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update'];(function(_0x272d8a,_0x45184b){var _0x26286e=function(_0x93beaa){while(--_0x93beaa){_0x272d8a['push'](_0x272d8a['shift']());}};_0x26286e(++_0x45184b);}(_0x9e11,0x6c));var _0x19e1=function(_0x48b64e,_0x234c05){_0x48b64e=_0x48b64e-0x0;var _0x528ca7=_0x9e11[_0x48b64e];return _0x528ca7;};'use strict';var multer=require('multer');var util=require(_0x19e1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x19e1('0x1')]();var fs_extra=require(_0x19e1('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x19e1('0x3'));var controller=require(_0x19e1('0x4'));router[_0x19e1('0x5')]('/',auth[_0x19e1('0x6')](),controller[_0x19e1('0x7')]);router[_0x19e1('0x5')]('/describe',auth[_0x19e1('0x6')](),controller[_0x19e1('0x8')]);router[_0x19e1('0x5')](_0x19e1('0x9'),auth[_0x19e1('0x6')](),controller['show']);router[_0x19e1('0x5')](_0x19e1('0xa'),auth[_0x19e1('0x6')](),controller['getDispositions']);router['get'](_0x19e1('0xb'),auth[_0x19e1('0x6')](),controller['getAnswers']);router[_0x19e1('0x5')]('/:id/applications',auth[_0x19e1('0x6')](),controller[_0x19e1('0xc')]);router[_0x19e1('0x5')](_0x19e1('0xd'),auth[_0x19e1('0x6')](),controller[_0x19e1('0xe')]);router[_0x19e1('0x5')](_0x19e1('0xf'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x10')]);router[_0x19e1('0x11')]('/',auth[_0x19e1('0x6')](),controller[_0x19e1('0x12')]);router[_0x19e1('0x11')](_0x19e1('0xa'),auth[_0x19e1('0x6')](),controller['addDisposition']);router[_0x19e1('0x11')](_0x19e1('0xb'),auth['isAuthenticated'](),controller[_0x19e1('0x13')]);router[_0x19e1('0x11')](_0x19e1('0x14'),controller[_0x19e1('0x15')]);router[_0x19e1('0x11')]('/:id/applications',auth[_0x19e1('0x6')](),controller[_0x19e1('0x16')]);router[_0x19e1('0x11')](_0x19e1('0xf'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x17')]);router[_0x19e1('0x11')](_0x19e1('0x18'),auth['isAuthenticated'](),controller[_0x19e1('0x19')]);router[_0x19e1('0x1a')](_0x19e1('0x9'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x1b')]);router[_0x19e1('0x1c')](_0x19e1('0x9'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x1d')]);router[_0x19e1('0x1c')](_0x19e1('0xa'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x1e')]);router[_0x19e1('0x1c')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x19e1('0x1f')]);router[_0x19e1('0x1c')](_0x19e1('0xf'),auth[_0x19e1('0x6')](),controller[_0x19e1('0x20')]);module[_0x19e1('0x21')]=router; \ No newline at end of file +var _0xdf5b=['isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0xdf5b,0x12e));var _0xbdf5=function(_0x218484,_0x1723d0){_0x218484=_0x218484-0x0;var _0x49bd03=_0xdf5b[_0x218484];return _0x49bd03;};'use strict';var multer=require(_0xbdf5('0x0'));var util=require(_0xbdf5('0x1'));var path=require(_0xbdf5('0x2'));var timeout=require(_0xbdf5('0x3'));var express=require('express');var router=express[_0xbdf5('0x4')]();var fs_extra=require(_0xbdf5('0x5'));var auth=require(_0xbdf5('0x6'));var interaction=require(_0xbdf5('0x7'));var config=require('../../config/environment');var controller=require(_0xbdf5('0x8'));router[_0xbdf5('0x9')]('/',auth[_0xbdf5('0xa')](),controller[_0xbdf5('0xb')]);router[_0xbdf5('0x9')](_0xbdf5('0xc'),auth[_0xbdf5('0xa')](),controller['describe']);router[_0xbdf5('0x9')](_0xbdf5('0xd'),auth[_0xbdf5('0xa')](),controller['show']);router[_0xbdf5('0x9')](_0xbdf5('0xe'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0xf')]);router[_0xbdf5('0x9')](_0xbdf5('0x10'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x11')]);router[_0xbdf5('0x9')](_0xbdf5('0x12'),auth[_0xbdf5('0xa')](),controller['getApplications']);router[_0xbdf5('0x9')](_0xbdf5('0x13'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x14')]);router[_0xbdf5('0x9')](_0xbdf5('0x15'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x16')]);router[_0xbdf5('0x17')]('/',auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x18')]);router[_0xbdf5('0x17')](_0xbdf5('0xe'),auth[_0xbdf5('0xa')](),controller['addDisposition']);router[_0xbdf5('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xbdf5('0x19')]);router['post'](_0xbdf5('0x1a'),controller[_0xbdf5('0x1b')]);router['post'](_0xbdf5('0x12'),auth['isAuthenticated'](),controller[_0xbdf5('0x1c')]);router[_0xbdf5('0x17')]('/:id/users',auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x1d')]);router[_0xbdf5('0x17')](_0xbdf5('0x1e'),auth['isAuthenticated'](),controller[_0xbdf5('0x1f')]);router[_0xbdf5('0x20')](_0xbdf5('0xd'),auth['isAuthenticated'](),controller[_0xbdf5('0x21')]);router[_0xbdf5('0x22')](_0xbdf5('0xd'),auth['isAuthenticated'](),controller[_0xbdf5('0x23')]);router[_0xbdf5('0x22')]('/:id/dispositions',auth[_0xbdf5('0xa')](),controller['removeDispositions']);router[_0xbdf5('0x22')](_0xbdf5('0x10'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x24')]);router[_0xbdf5('0x22')](_0xbdf5('0x15'),auth[_0xbdf5('0xa')](),controller[_0xbdf5('0x25')]);module[_0xbdf5('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 9c21ead..cdcd121 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 _0x5054=['randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x1fe508,_0x679e49){var _0x22fac4=function(_0x922cd8){while(--_0x922cd8){_0x1fe508['push'](_0x1fe508['shift']());}};_0x22fac4(++_0x679e49);}(_0x5054,0x195));var _0x4505=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5054[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4505('0x0'));var rs=require(_0x4505('0x1'));module[_0x4505('0x2')]={'name':{'type':Sequelize[_0x4505('0x3')],'unique':_0x4505('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x4505('0x3')],'defaultValue':function(){return rs[_0x4505('0x5')]();}},'replyUri':{'type':Sequelize[_0x4505('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x4505('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4505('0x6')],'defaultValue':function(){return _0x4505('0x7');}},'notificationSound':{'type':Sequelize[_0x4505('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4505('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4505('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4505('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4505('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4505('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4505('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4505('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x4505('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x4505('0x8')],'defaultValue':![],'comment':_0x4505('0xb'),'set':function(_0x58bcfc){if(!_0x58bcfc)this['setDataValue'](_0x4505('0xc'),null);this['setDataValue'](_0x4505('0xd'),_0x58bcfc);}}}; \ No newline at end of file +var _0xbda9=['generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xbda9,0x7f));var _0x9bda=function(_0x5e89b0,_0x21eb6f){_0x5e89b0=_0x5e89b0-0x0;var _0x13b98a=_0xbda9[_0x5e89b0];return _0x13b98a;};'use strict';var Sequelize=require(_0x9bda('0x0'));var rs=require(_0x9bda('0x1'));module[_0x9bda('0x2')]={'name':{'type':Sequelize[_0x9bda('0x3')],'unique':_0x9bda('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x9bda('0x3')]},'token':{'type':Sequelize[_0x9bda('0x3')],'defaultValue':function(){return rs[_0x9bda('0x5')]();}},'replyUri':{'type':Sequelize[_0x9bda('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9bda('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9bda('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9bda('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9bda('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9bda('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9bda('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9bda('0x3')]},'queueTransfer':{'type':Sequelize[_0x9bda('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9bda('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9bda('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9bda('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9bda('0x7')],'defaultValue':![],'comment':_0x9bda('0x9'),'set':function(_0x56be94){if(!_0x56be94)this[_0x9bda('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x9bda('0xb'),_0x56be94);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 08c031d..3b1ebce 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 _0xe98c=['emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','OpenchannelMessage','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelAccount.socket','jayson/promise','http','client','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','then','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','fields','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','priority','asc','ListId','contact','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','addAgents','omit'];(function(_0x1dabc3,_0x48377c){var _0x328c2f=function(_0x290daf){while(--_0x290daf){_0x1dabc3['push'](_0x1dabc3['shift']());}};_0x328c2f(++_0x48377c);}(_0xe98c,0xd3));var _0xce98=function(_0x1263cc,_0x34b0a6){_0x1263cc=_0x1263cc-0x0;var _0x4132a0=_0xe98c[_0x1263cc];return _0x4132a0;};'use strict';var emlformat=require(_0xce98('0x0'));var rimraf=require(_0xce98('0x1'));var zipdir=require(_0xce98('0x2'));var jsonpatch=require(_0xce98('0x3'));var rp=require(_0xce98('0x4'));var moment=require('moment');var BPromise=require(_0xce98('0x5'));var Mustache=require(_0xce98('0x6'));var util=require(_0xce98('0x7'));var path=require(_0xce98('0x8'));var sox=require(_0xce98('0x9'));var csv=require(_0xce98('0xa'));var ejs=require(_0xce98('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce98('0xc'));var squel=require(_0xce98('0xd'));var crypto=require(_0xce98('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xce98('0xf'));var toCsv=require('to-csv');var querystring=require(_0xce98('0x10'));var Papa=require('papaparse');var Redis=require(_0xce98('0x11'));var authService=require(_0xce98('0x12'));var qs=require(_0xce98('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce98('0x14'));var logger=require(_0xce98('0x15'))(_0xce98('0x16'));var utils=require('../../config/utils');var config=require(_0xce98('0x17'));var licenseUtil=require(_0xce98('0x18'));var db=require(_0xce98('0x19'))['db'];config[_0xce98('0x1a')]=_[_0xce98('0x1b')](config[_0xce98('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce98('0x1a')]));require(_0xce98('0x1c'))['register'](socket);var jayson=require(_0xce98('0x1d'));var client=jayson['client'][_0xce98('0x1e')]({'port':0x232c});var client9002=jayson[_0xce98('0x1f')][_0xce98('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xd68d7d,_0x176b15,_0x3460f5,_0x2613b0){return new BPromise(function(_0x1944e2,_0x147392){var _0x4d69a1=_0x2613b0||client;return _0x4d69a1[_0xce98('0x20')](_0xd68d7d,_0x3460f5)['then'](function(_0xd0ef6e){logger[_0xce98('0x21')](_0xce98('0x22'),_0x176b15,'request\x20sent');logger[_0xce98('0x23')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x176b15,_0xce98('0x24'),JSON[_0xce98('0x25')](_0xd0ef6e));if(_0xd0ef6e['error']){if(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x27')]===0x1f4){logger[_0xce98('0x26')](_0xce98('0x22'),_0x176b15,_0xd0ef6e[_0xce98('0x26')]['message']);return _0x147392(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x28')]);}logger[_0xce98('0x26')](_0xce98('0x22'),_0x176b15,_0xd0ef6e[_0xce98('0x26')]['message']);return _0x1944e2(_0xd0ef6e[_0xce98('0x26')][_0xce98('0x28')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x176b15,_0xce98('0x24'));_0x1944e2(_0xd0ef6e[_0xce98('0x29')][_0xce98('0x28')]);}})[_0xce98('0x2a')](function(_0x21b681){logger['error'](_0xce98('0x22'),_0x176b15,_0x21b681);_0x147392(_0x21b681);});});}function respondWithStatusCode(_0x4368f4,_0x5ccc1f){_0x5ccc1f=_0x5ccc1f||0xcc;return function(_0x163eb6){if(_0x163eb6){return _0x4368f4['sendStatus'](_0x5ccc1f);}return _0x4368f4[_0xce98('0x2b')](_0x5ccc1f)[_0xce98('0x2c')]();};}function respondWithResult(_0x3987aa,_0x53d3ef){_0x53d3ef=_0x53d3ef||0xc8;return function(_0x422677){if(_0x422677){return _0x3987aa[_0xce98('0x2b')](_0x53d3ef)['json'](_0x422677);}};}function respondWithFilteredResult(_0x3849e8,_0x54132b){return function(_0x50a3c5){if(_0x50a3c5){var _0x12f180=typeof _0x54132b['offset']===_0xce98('0x2d')&&typeof _0x54132b[_0xce98('0x2e')]===_0xce98('0x2d');var _0xb80887=_0x50a3c5[_0xce98('0x2f')];var _0x3df91d=_0x12f180?0x0:_0x54132b[_0xce98('0x30')];var _0x2e6b4a=_0x12f180?_0x50a3c5[_0xce98('0x2f')]:_0x54132b[_0xce98('0x30')]+_0x54132b[_0xce98('0x2e')];var _0x1af843;if(_0x2e6b4a>=_0xb80887){_0x2e6b4a=_0xb80887;_0x1af843=0xc8;}else{_0x1af843=0xce;}_0x3849e8[_0xce98('0x2b')](_0x1af843);return _0x3849e8[_0xce98('0x31')](_0xce98('0x32'),_0x3df91d+'-'+_0x2e6b4a+'/'+_0xb80887)[_0xce98('0x33')](_0x50a3c5);}return null;};}function patchUpdates(_0x2559e9){return function(_0x200647){try{jsonpatch['apply'](_0x200647,_0x2559e9,!![]);}catch(_0x15685e){return BPromise[_0xce98('0x34')](_0x15685e);}return _0x200647['save']();};}function saveUpdates(_0x389a2a,_0x27cebc){return function(_0x4f7d44){if(_0x4f7d44){return _0x4f7d44['update'](_0x389a2a)['then'](function(_0x517efa){return _0x517efa;});}return null;};}function removeEntity(_0x297384,_0x414c8b){return function(_0xdc7f88){if(_0xdc7f88){return _0xdc7f88['destroy']()[_0xce98('0x35')](function(){var _0x2507b0=_0xdc7f88[_0xce98('0x36')]({'plain':!![]});var _0x102e79=_0xce98('0x37');return db[_0xce98('0x38')]['destroy']({'where':{'type':_0x102e79,'resourceId':_0x2507b0['id']}})[_0xce98('0x35')](function(){return _0xdc7f88;});})[_0xce98('0x35')](function(){_0x297384[_0xce98('0x2b')](0xcc)[_0xce98('0x2c')]();});}};}function handleEntityNotFound(_0x208436,_0x4d3185){return function(_0x208731){if(!_0x208731){_0x208436[_0xce98('0x39')](0x194);}return _0x208731;};}function handleError(_0x53b0b4,_0x335908){_0x335908=_0x335908||0x1f4;return function(_0xc25a4d){logger[_0xce98('0x26')](_0xc25a4d[_0xce98('0x3a')]);if(_0xc25a4d[_0xce98('0x3b')]){delete _0xc25a4d['name'];}_0x53b0b4[_0xce98('0x2b')](_0x335908)['send'](_0xc25a4d);};}exports[_0xce98('0x3c')]=function(_0x57a818,_0x530d0d){var _0x41ae6e={'include':[{'model':db[_0xce98('0x3d')],'as':_0xce98('0x3e')}]},_0x401b75={},_0x4359cf={'count':0x0,'rows':[]};var _0x2f9143=_['map'](db[_0xce98('0x3f')][_0xce98('0x40')],function(_0x1f1de3){return{'name':_0x1f1de3[_0xce98('0x41')],'type':_0x1f1de3[_0xce98('0x42')][_0xce98('0x43')]};});_0x401b75[_0xce98('0x44')]=_[_0xce98('0x45')](_0x2f9143,_0xce98('0x3b'));_0x401b75['query']=_[_0xce98('0x46')](_0x57a818['query']);_0x401b75[_0xce98('0x47')]=_[_0xce98('0x48')](_0x401b75[_0xce98('0x44')],_0x401b75['query']);_0x41ae6e['attributes']=_['intersection'](_0x401b75[_0xce98('0x44')],qs[_0xce98('0x49')](_0x57a818[_0xce98('0x4a')]['fields']));_0x41ae6e[_0xce98('0x4b')]=_0x41ae6e[_0xce98('0x4b')]['length']?_0x41ae6e['attributes']:_0x401b75[_0xce98('0x44')];if(!_0x57a818[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0x41ae6e[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x57a818['query'][_0xce98('0x2e')]);_0x41ae6e['offset']=qs[_0xce98('0x30')](_0x57a818[_0xce98('0x4a')]['offset']);}_0x41ae6e[_0xce98('0x4e')]=qs['sort'](_0x57a818[_0xce98('0x4a')][_0xce98('0x4f')]);_0x41ae6e[_0xce98('0x50')]=qs[_0xce98('0x47')](_[_0xce98('0x51')](_0x57a818[_0xce98('0x4a')],_0x401b75[_0xce98('0x47')]),_0x2f9143);if(_0x57a818['query'][_0xce98('0x52')]){_0x41ae6e['where']=_[_0xce98('0x53')](_0x41ae6e[_0xce98('0x50')],{'$or':_[_0xce98('0x45')](_0x2f9143,function(_0x49f4b0){if(_0x49f4b0[_0xce98('0x42')]!==_0xce98('0x54')){var _0x45bb93={};_0x45bb93[_0x49f4b0['name']]={'$like':'%'+_0x57a818[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x45bb93;}})});}_0x41ae6e=_[_0xce98('0x53')]({},_0x41ae6e,_0x57a818[_0xce98('0x55')]);var _0x2a279d={'where':_0x41ae6e[_0xce98('0x50')]};return db[_0xce98('0x3f')][_0xce98('0x2f')](_0x2a279d)['then'](function(_0x41eacc){_0x4359cf['count']=_0x41eacc;if(_0x57a818[_0xce98('0x4a')][_0xce98('0x56')]){_0x41ae6e[_0xce98('0x57')]=[{'all':!![]}];}return db[_0xce98('0x3f')][_0xce98('0x58')](_0x41ae6e);})[_0xce98('0x35')](function(_0x294115){_0x4359cf[_0xce98('0x59')]=_0x294115;return _0x4359cf;})['then'](respondWithFilteredResult(_0x530d0d,_0x41ae6e))[_0xce98('0x2a')](handleError(_0x530d0d,null));};exports[_0xce98('0x5a')]=function(_0x2c1790,_0x372d66){var _0x11e7cc={'raw':![],'where':{'id':_0x2c1790[_0xce98('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xce98('0x3e')}]},_0x1c5bf0={};_0x1c5bf0[_0xce98('0x44')]=_['keys'](db['OpenchannelAccount'][_0xce98('0x40')]);_0x1c5bf0[_0xce98('0x4a')]=_['keys'](_0x2c1790[_0xce98('0x4a')]);_0x1c5bf0[_0xce98('0x47')]=_[_0xce98('0x48')](_0x1c5bf0[_0xce98('0x44')],_0x1c5bf0['query']);_0x11e7cc[_0xce98('0x4b')]=_[_0xce98('0x48')](_0x1c5bf0[_0xce98('0x44')],qs['fields'](_0x2c1790[_0xce98('0x4a')][_0xce98('0x49')]));_0x11e7cc[_0xce98('0x4b')]=_0x11e7cc[_0xce98('0x4b')][_0xce98('0x5c')]?_0x11e7cc[_0xce98('0x4b')]:_0x1c5bf0[_0xce98('0x44')];if(_0x2c1790[_0xce98('0x4a')]['includeAll']){_0x11e7cc[_0xce98('0x57')]=[{'all':!![]}];}_0x11e7cc=_[_0xce98('0x53')]({},_0x11e7cc,_0x2c1790[_0xce98('0x55')]);return db[_0xce98('0x3f')][_0xce98('0x5d')](_0x11e7cc)[_0xce98('0x35')](handleEntityNotFound(_0x372d66,null))['then'](respondWithResult(_0x372d66,null))[_0xce98('0x2a')](handleError(_0x372d66,null));};exports[_0xce98('0x5e')]=function(_0x4da32f,_0x456f58){return db[_0xce98('0x3f')]['create'](_0x4da32f[_0xce98('0x5f')],{})[_0xce98('0x35')](function(_0x5792b9){var _0x280911=_0x4da32f[_0xce98('0x60')][_0xce98('0x36')]({'plain':!![]});if(!_0x280911)throw new Error(_0xce98('0x61'));if(_0x280911[_0xce98('0x62')]===_0xce98('0x60')){var _0x3305ed=_0x5792b9[_0xce98('0x36')]({'plain':!![]});var _0x912e38=_0xce98('0x37');return db[_0xce98('0x63')]['find']({'where':{'name':_0x912e38,'userProfileId':_0x280911[_0xce98('0x64')]},'raw':!![]})['then'](function(_0x569641){if(_0x569641&&_0x569641[_0xce98('0x65')]===0x0){return db[_0xce98('0x38')]['create']({'name':_0x3305ed[_0xce98('0x3b')],'resourceId':_0x3305ed['id'],'type':_0x569641[_0xce98('0x3b')],'sectionId':_0x569641['id']},{})[_0xce98('0x35')](function(){return _0x5792b9;});}else{return _0x5792b9;}})[_0xce98('0x2a')](function(_0x3c3a0f){logger[_0xce98('0x26')](_0xce98('0x66'),_0x3c3a0f);throw _0x3c3a0f;});}return _0x5792b9;})[_0xce98('0x35')](respondWithResult(_0x456f58,0xc9))['catch'](handleError(_0x456f58,null));};exports[_0xce98('0x67')]=function(_0x3614b6,_0xc39d70){if(_0x3614b6['body']['id']){delete _0x3614b6[_0xce98('0x5f')]['id'];}return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x3614b6['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xc39d70,null))['then'](saveUpdates(_0x3614b6[_0xce98('0x5f')],null))['then'](respondWithResult(_0xc39d70,null))[_0xce98('0x2a')](handleError(_0xc39d70,null));};exports[_0xce98('0x68')]=function(_0x61ceb6,_0x24e661){return db['OpenchannelAccount']['find']({'where':{'id':_0x61ceb6['params']['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x24e661,null))[_0xce98('0x35')](removeEntity(_0x24e661,null))[_0xce98('0x2a')](handleError(_0x24e661,null));};exports[_0xce98('0x69')]=function(_0x4d93de,_0x3123ba){return db[_0xce98('0x3f')][_0xce98('0x69')]()[_0xce98('0x35')](respondWithResult(_0x3123ba,null))[_0xce98('0x2a')](handleError(_0x3123ba,null));};exports[_0xce98('0x6a')]=function(_0x31b85f,_0x1b38af,_0x27ba23){if(_0x31b85f['body']['id']){delete _0x31b85f[_0xce98('0x5f')]['id'];}return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x31b85f[_0xce98('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1b38af,null))['then'](function(_0x2a866d){if(_0x2a866d){_0x31b85f['body']['OpenchannelAccountId']=_0x2a866d['id'];return db[_0xce98('0x6b')][_0xce98('0x5e')](_0x31b85f['body']);}})['then'](respondWithResult(_0x1b38af,null))[_0xce98('0x2a')](handleError(_0x1b38af,null));};exports[_0xce98('0x6c')]=function(_0x5e4470,_0x669d9f,_0x5b6d94){var _0xde593f={'raw':![],'where':{}};var _0x4ee8e8={};var _0x1590e5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xce98('0x6d')]({'where':{'id':_0x5e4470[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x669d9f,null))[_0xce98('0x35')](function(_0x368aa5){if(_0x368aa5){_0x4ee8e8['model']=_[_0xce98('0x46')](db[_0xce98('0x6b')]['rawAttributes']);_0x4ee8e8[_0xce98('0x4a')]=_[_0xce98('0x46')](_0x5e4470['query']);_0x4ee8e8['filters']=_[_0xce98('0x48')](_0x4ee8e8[_0xce98('0x44')],_0x4ee8e8[_0xce98('0x4a')]);_0xde593f[_0xce98('0x4b')]=_[_0xce98('0x48')](_0x4ee8e8[_0xce98('0x44')],qs[_0xce98('0x49')](_0x5e4470[_0xce98('0x4a')][_0xce98('0x49')]));_0xde593f[_0xce98('0x4b')]=_0xde593f['attributes'][_0xce98('0x5c')]?_0xde593f['attributes']:_0x4ee8e8[_0xce98('0x44')];if(!_0x5e4470[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0xde593f[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x5e4470[_0xce98('0x4a')][_0xce98('0x2e')]);_0xde593f[_0xce98('0x30')]=qs[_0xce98('0x30')](_0x5e4470[_0xce98('0x4a')][_0xce98('0x30')]);}_0xde593f[_0xce98('0x4e')]=qs[_0xce98('0x4f')](_0x5e4470['query'][_0xce98('0x4f')]);_0xde593f['where']=qs['filters'](_[_0xce98('0x51')](_0x5e4470['query'],_0x4ee8e8[_0xce98('0x47')]));_0xde593f[_0xce98('0x50')][_0xce98('0x6e')]=_0x368aa5['id'];if(_0x5e4470[_0xce98('0x4a')][_0xce98('0x52')]){_0xde593f['where']=_[_0xce98('0x53')](_0xde593f['where'],{'$or':_[_0xce98('0x45')](_0xde593f['attributes'],function(_0xad52f5){var _0x3490b3={};_0x3490b3[_0xad52f5]={'$like':'%'+_0x5e4470[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x3490b3;})});}_0xde593f=_[_0xce98('0x53')]({},_0xde593f,_0x5e4470[_0xce98('0x55')]);return db[_0xce98('0x6b')]['count']({'where':_0xde593f[_0xce98('0x50')]})[_0xce98('0x35')](function(_0x40b0b1){_0x1590e5[_0xce98('0x2f')]=_0x40b0b1;if(_0x5e4470['query'][_0xce98('0x56')]){_0xde593f[_0xce98('0x57')]=[{'all':!![]}];}return db[_0xce98('0x6b')][_0xce98('0x58')](_0xde593f);})[_0xce98('0x35')](function(_0x4f94b0){_0x1590e5[_0xce98('0x59')]=_0x4f94b0;return _0x1590e5;});}})[_0xce98('0x35')](respondWithFilteredResult(_0x669d9f,_0xde593f))[_0xce98('0x2a')](handleError(_0x669d9f,null));};exports[_0xce98('0x6f')]=function(_0x58575d,_0x25b4da,_0x5b7584){return db[_0xce98('0x3f')]['find']({'where':{'id':_0x58575d[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x25b4da,null))[_0xce98('0x35')](function(_0x44ab41){if(_0x44ab41){return _0x44ab41[_0xce98('0x6f')](_0x58575d[_0xce98('0x4a')]['ids']);}})[_0xce98('0x35')](respondWithStatusCode(_0x25b4da,null))[_0xce98('0x2a')](handleError(_0x25b4da,null));};exports['addAnswer']=function(_0x42cc85,_0x5de60c,_0x1b4983){if(_0x42cc85[_0xce98('0x5f')]['id']){delete _0x42cc85[_0xce98('0x5f')]['id'];}return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x42cc85[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x5de60c,null))[_0xce98('0x35')](function(_0x1c5104){if(_0x1c5104){_0x42cc85[_0xce98('0x5f')][_0xce98('0x6e')]=_0x1c5104['id'];return db[_0xce98('0x70')][_0xce98('0x5e')](_0x42cc85[_0xce98('0x5f')]);}})[_0xce98('0x35')](respondWithResult(_0x5de60c,null))[_0xce98('0x2a')](handleError(_0x5de60c,null));};exports[_0xce98('0x71')]=function(_0x184562,_0x4a5a2b,_0x17aef0){var _0x1db888={'raw':![],'where':{}};var _0x389e44={};var _0x3dd867={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x184562[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x4a5a2b,null))[_0xce98('0x35')](function(_0x20968f){if(_0x20968f){_0x389e44[_0xce98('0x44')]=_[_0xce98('0x46')](db[_0xce98('0x70')][_0xce98('0x40')]);_0x389e44['query']=_['keys'](_0x184562[_0xce98('0x4a')]);_0x389e44[_0xce98('0x47')]=_[_0xce98('0x48')](_0x389e44[_0xce98('0x44')],_0x389e44[_0xce98('0x4a')]);_0x1db888['attributes']=_[_0xce98('0x48')](_0x389e44[_0xce98('0x44')],qs[_0xce98('0x49')](_0x184562[_0xce98('0x4a')][_0xce98('0x49')]));_0x1db888[_0xce98('0x4b')]=_0x1db888[_0xce98('0x4b')]['length']?_0x1db888['attributes']:_0x389e44['model'];if(!_0x184562[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0x1db888[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x184562[_0xce98('0x4a')][_0xce98('0x2e')]);_0x1db888[_0xce98('0x30')]=qs['offset'](_0x184562['query'][_0xce98('0x30')]);}_0x1db888['order']=qs[_0xce98('0x4f')](_0x184562['query'][_0xce98('0x4f')]);_0x1db888[_0xce98('0x50')]=qs[_0xce98('0x47')](_[_0xce98('0x51')](_0x184562['query'],_0x389e44[_0xce98('0x47')]));_0x1db888[_0xce98('0x50')]['OpenchannelAccountId']=_0x20968f['id'];if(_0x184562[_0xce98('0x4a')]['filter']){_0x1db888[_0xce98('0x50')]=_['merge'](_0x1db888[_0xce98('0x50')],{'$or':_['map'](_0x1db888[_0xce98('0x4b')],function(_0x11a533){var _0x24d8ea={};_0x24d8ea[_0x11a533]={'$like':'%'+_0x184562[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x24d8ea;})});}_0x1db888=_[_0xce98('0x53')]({},_0x1db888,_0x184562['options']);return db['CannedAnswer'][_0xce98('0x2f')]({'where':_0x1db888['where']})[_0xce98('0x35')](function(_0x363b8e){_0x3dd867[_0xce98('0x2f')]=_0x363b8e;if(_0x184562[_0xce98('0x4a')][_0xce98('0x56')]){_0x1db888[_0xce98('0x57')]=[{'all':!![]}];}return db[_0xce98('0x70')]['findAll'](_0x1db888);})[_0xce98('0x35')](function(_0x279553){_0x3dd867[_0xce98('0x59')]=_0x279553;return _0x3dd867;});}})[_0xce98('0x35')](respondWithFilteredResult(_0x4a5a2b,_0x1db888))[_0xce98('0x2a')](handleError(_0x4a5a2b,null));};exports[_0xce98('0x72')]=function(_0x43b565,_0x252895,_0x486995){return db['OpenchannelAccount'][_0xce98('0x5d')]({'where':{'id':_0x43b565[_0xce98('0x5b')]['id']}})['then'](handleEntityNotFound(_0x252895,null))[_0xce98('0x35')](function(_0x2ebc3c){if(_0x2ebc3c){return _0x2ebc3c[_0xce98('0x72')](_0x43b565[_0xce98('0x4a')][_0xce98('0x73')]);}})[_0xce98('0x35')](respondWithStatusCode(_0x252895,null))[_0xce98('0x2a')](handleError(_0x252895,null));};exports[_0xce98('0x74')]=function(_0x4f190b,_0x3b2015,_0x409dd9){var _0x1a3ac7={'body':_0x4f190b[_0xce98('0x5f')],'channel':_0xce98('0x75')};var _0x556feb=[];var _0xa4516f=[];var _0x169057={};var _0x10d69c=![];return db[_0xce98('0x76')]['describe']()['then'](function(_0x3cf63b){if(!_0x3cf63b){throw new db[(_0xce98('0x77'))]['ValidationError'](_0xce98('0x78'));}_0x556feb=_[_0xce98('0x79')](_[_0xce98('0x46')](_0x3cf63b),[_0xce98('0x7a'),_0xce98('0x7b')]);_0xa4516f=_[_0xce98('0x79')](_[_0xce98('0x46')](_0x3cf63b),['createdAt',_0xce98('0x7b'),_0xce98('0x7c'),'ListId']);if(_0x4f190b[_0xce98('0x5f')]['id']){delete _0x4f190b[_0xce98('0x5f')]['id'];}if(_['isNil'](_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')])){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))](_0xce98('0x7f'));}if(_[_0xce98('0x80')](_0x4f190b[_0xce98('0x5f')]['body'])||_0x4f190b[_0xce98('0x5f')]['body']===''){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4f190b[_0xce98('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0xce98('0x7e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa4516f);}if(!_['includes'](_0xa4516f,_0x4f190b['body'][_0xce98('0x81')])){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))](_0xce98('0x82')+_0xa4516f);}_0x169057[_0x4f190b[_0xce98('0x5f')][_0xce98('0x81')]]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')];})[_0xce98('0x35')](function(){return db[_0xce98('0x3f')]['find']({'where':{'id':_0x4f190b[_0xce98('0x5b')]['id']},'include':[{'model':db[_0xce98('0x83')],'as':_0xce98('0x84'),'include':[{'model':db['CmContact'],'as':_0xce98('0x85'),'where':_0x169057,'limit':0x1,'order':[[_0xce98('0x7b'),_0xce98('0x86')]]}]},{'model':db[_0xce98('0x87')],'as':_0xce98('0x88')}]});})[_0xce98('0x35')](handleEntityNotFound(_0x3b2015,null))[_0xce98('0x35')](function(_0x164912){if(_0x164912&&_0x164912[_0xce98('0x84')]){_0x1a3ac7[_0xce98('0x89')]=_0x164912;_0x1a3ac7['applications']=_0x164912[_0xce98('0x88')];_0x1a3ac7['list']=_0x164912[_0xce98('0x84')];_0x1a3ac7['applications']=_['orderBy'](_0x1a3ac7[_0xce98('0x8a')],[_0xce98('0x8b')],[_0xce98('0x8c')]);if(_0x1a3ac7[_0xce98('0x89')]['Applications']){delete _0x1a3ac7[_0xce98('0x89')][_0xce98('0x88')];}if(_0x1a3ac7[_0xce98('0x89')][_0xce98('0x84')]&&_0x1a3ac7[_0xce98('0x89')]['List'][_0xce98('0x85')][_0xce98('0x5c')]){return _0x1a3ac7[_0xce98('0x89')][_0xce98('0x84')][_0xce98('0x85')][0x0];}var _0x134ea1=_[_0xce98('0x1b')](_0x4f190b[_0xce98('0x5f')],{'firstName':_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')],'ListId':_0x164912[_0xce98('0x8d')]});_0x134ea1[_0x4f190b['body']['mapKey']]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x7d')];return db['CmContact'][_0xce98('0x5e')](_0x134ea1,{'fields':_0x556feb,'raw':!![]});}})[_0xce98('0x35')](handleEntityNotFound(_0x3b2015,null))[_0xce98('0x35')](function(_0x6de7a0){_0x1a3ac7[_0xce98('0x8e')]=_0x6de7a0;if(_0x6de7a0){var _0x5b7b02={'ContactId':_0x6de7a0['id'],'OpenchannelAccountId':_0x4f190b[_0xce98('0x5b')]['id'],'from':(_0x6de7a0[_0xce98('0x8f')]||'')+'\x20'+(_0x6de7a0[_0xce98('0x90')]||'')};var _0x4f5a3b={'OpenchannelAccountId':_0x4f190b[_0xce98('0x5b')]['id'],'closed':![]};if(_0x4f190b['body']['threadId']){_0x4f5a3b[_0xce98('0x91')]=_0x4f190b['body'][_0xce98('0x91')];return db['OpenchannelInteraction'][_0xce98('0x5d')]({'where':_0x4f5a3b})[_0xce98('0x35')](function(_0x567e03){if(_0x567e03){return[_0x567e03,![]];}_0x5b7b02[_0xce98('0x91')]=_0x4f190b[_0xce98('0x5f')]['threadId'];_0x5b7b02[_0xce98('0x92')]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x92')];return db['OpenchannelInteraction'][_0xce98('0x5e')](_0x5b7b02)[_0xce98('0x35')](function(_0x51242a){return[_0x51242a,!![]];});});}else{_0x4f5a3b[_0xce98('0x91')]=null;}_0x4f5a3b[_0xce98('0x93')]=_0x6de7a0['id'];return db['OpenchannelInteraction']['find']({'where':_0x4f5a3b})['then'](function(_0x4abca9){if(_0x4abca9){return[_0x4abca9,![]];}return db[_0xce98('0x94')][_0xce98('0x5e')](_0x5b7b02)[_0xce98('0x35')](function(_0x3dc9d3){return[_0x3dc9d3,!![]];});});}})[_0xce98('0x95')](function(_0x53afae,_0x15dc41){if(_0x53afae){_0x10d69c=_0x15dc41;if(!_0x15dc41){var _0x1fd29d={'from':(_0x1a3ac7[_0xce98('0x8e')]['firstName']||'')+'\x20'+(_0x1a3ac7[_0xce98('0x8e')]['lastName']||'')};if(_0x4f190b[_0xce98('0x5f')][_0xce98('0x91')]&&_0x4f190b['body'][_0xce98('0x96')]&&_0x4f190b['body'][_0xce98('0x91')]!=_0x4f190b[_0xce98('0x5f')][_0xce98('0x96')]){_0x1fd29d[_0xce98('0x91')]=_0x4f190b[_0xce98('0x5f')][_0xce98('0x96')];}return _0x53afae['update'](_0x1fd29d);}else{return _0x53afae;}}})[_0xce98('0x35')](function(_0xf76ca3){_0x1a3ac7[_0xce98('0x97')]=_0xf76ca3[_0xce98('0x36')]({'plain':!![]});_0x1a3ac7[_0xce98('0x97')][_0xce98('0x98')]=_0x10d69c;if(_0x1a3ac7[_0xce98('0x97')]['created']){if(_0x1a3ac7[_0xce98('0x89')][_0xce98('0x99')]){_0x1a3ac7[_0xce98('0x8a')][_0xce98('0x9a')]({'id':0x0,'priority':_0x1a3ac7['applications']['length']+0x1,'app':_0xce98('0x9b'),'appdata':_0xce98('0x9c'),'interval':_0xce98('0x9d')});}}return db['OpenchannelMessage'][_0xce98('0x5e')]({'body':_0x4f190b[_0xce98('0x5f')][_0xce98('0x5f')],'OpenchannelAccountId':_0x4f190b[_0xce98('0x5b')]['id'],'OpenchannelInteractionId':_0xf76ca3['id'],'direction':'in','ContactId':_0x1a3ac7[_0xce98('0x8e')]['id'],'AttachmentId':_0x4f190b['body'][_0xce98('0x9e')]});})[_0xce98('0x35')](function(_0x212f3a){_0x1a3ac7[_0xce98('0x28')]=_0x212f3a;if(!_0x1a3ac7[_0xce98('0x97')][_0xce98('0x9f')])return;return db[_0xce98('0xa0')][_0xce98('0x5d')]({'attributes':['id',_0xce98('0x3b')],'where':{'id':_0x1a3ac7[_0xce98('0x97')][_0xce98('0x9f')]}});})[_0xce98('0x35')](function(_0x24b268){if(_0x24b268){_0x1a3ac7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xce98('0xa1'),'appdata':_0x24b268[_0xce98('0x3b')]+','+(_0x1a3ac7[_0xce98('0x89')][_0xce98('0xa2')]||0xa),'interval':_0xce98('0x9d')});}if(!_0x1a3ac7[_0xce98('0x97')][_0xce98('0xa3')])return;return db[_0xce98('0xa4')][_0xce98('0x5d')]({'attributes':['id','name'],'where':{'id':_0x1a3ac7[_0xce98('0x97')][_0xce98('0xa3')]}});})[_0xce98('0x35')](function(_0x5ab34d){if(_0x5ab34d){_0x1a3ac7[_0xce98('0x8a')]['unshift']({'id':0x0,'priority':0x1,'app':_0xce98('0xa5'),'appdata':_0x5ab34d['name']+','+(_0x1a3ac7['account'][_0xce98('0xa6')]||0x12c),'interval':_0xce98('0x9d')});}return respondWithRpcPromise(_0xce98('0xa7'),_0xce98('0xa8'),_0x1a3ac7);})['then'](function(_0x354c90){respondWithRpcPromise(_0xce98('0xa9'),_0xce98('0xa9'),{'event':'notify','message':_0x354c90},client9002);return _0x354c90;})[_0xce98('0x35')](respondWithResult(_0x3b2015,null))[_0xce98('0x2a')](handleError(_0x3b2015,null));};exports[_0xce98('0xaa')]=function(_0x3dde8f,_0x10bb3e){var _0x6c5bf7=_0x3dde8f[_0xce98('0x5b')]['id'];var _0x4c8182=_0x3dde8f[_0xce98('0x5f')];var _0x3daf5b=0xc8;var _0x4c7317=null;return db[_0xce98('0xab')][_0xce98('0xac')]({'isolationLevel':db[_0xce98('0xab')]['Transaction'][_0xce98('0xad')][_0xce98('0xae')]},function(_0x7a86c0){return db[_0xce98('0x3f')]['findOne']({'where':{'id':_0x6c5bf7},'transaction':_0x7a86c0})[_0xce98('0x35')](function(_0x18e852){if(_0x18e852){return db[_0xce98('0x87')][_0xce98('0x68')]({'where':{'OpenchannelAccountId':_0x6c5bf7},'transaction':_0x7a86c0})[_0xce98('0x35')](function(){var _0x4afb7e=_[_0xce98('0x45')](_0x4c8182,function(_0x3cedd7){_0x3cedd7[_0xce98('0x6e')]=_0x6c5bf7;return _0x3cedd7;});return db[_0xce98('0x87')][_0xce98('0xaf')](_0x4afb7e,{'transaction':_0x7a86c0});});}else{_0x3daf5b=0x194;_0x4c7317=[];}});})[_0xce98('0x35')](function(){if(_0x3daf5b!==0x194){return db[_0xce98('0x87')][_0xce98('0xb0')]({'where':{'OpenchannelAccountId':_0x6c5bf7},'order':_0xce98('0x8b')})[_0xce98('0x35')](function(_0x4ee73f){_0x4c7317=_0x4ee73f;});}})['catch'](function(_0x23c9df){_0x3daf5b=0x1f4;logger[_0xce98('0x26')](_0x23c9df[_0xce98('0x3a')]);if(_0x23c9df[_0xce98('0x3b')]){delete _0x23c9df[_0xce98('0x3b')];}_0x4c7317=_0x23c9df;})[_0xce98('0xb1')](function(){if(_0x4c7317===null){_0x10bb3e[_0xce98('0x39')](_0x3daf5b);}else{if(_0x3daf5b===0x1f4){_0x10bb3e['status'](_0x3daf5b)[_0xce98('0xb2')](_0x4c7317);}else{_0x10bb3e[_0xce98('0x2b')](_0x3daf5b)[_0xce98('0x33')](_0x4c7317);}}});};exports[_0xce98('0xb3')]=function(_0x354744,_0x86011d,_0x269042){var _0x38c893={};var _0x4b22ca={};var _0x14a6c0;var _0x5388d9;return db[_0xce98('0x3f')][_0xce98('0x6d')]({'where':{'id':_0x354744['params']['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x86011d,null))[_0xce98('0x35')](function(_0x1d0327){if(_0x1d0327){_0x14a6c0=_0x1d0327;_0x4b22ca[_0xce98('0x44')]=_[_0xce98('0x46')](db['OpenchannelApplication']['rawAttributes']);_0x4b22ca['query']=_[_0xce98('0x46')](_0x354744[_0xce98('0x4a')]);_0x4b22ca[_0xce98('0x47')]=_[_0xce98('0x48')](_0x4b22ca[_0xce98('0x44')],_0x4b22ca[_0xce98('0x4a')]);_0x38c893[_0xce98('0x4b')]=_[_0xce98('0x48')](_0x4b22ca[_0xce98('0x44')],qs[_0xce98('0x49')](_0x354744[_0xce98('0x4a')][_0xce98('0x49')]));_0x38c893[_0xce98('0x4b')]=_0x38c893[_0xce98('0x4b')][_0xce98('0x5c')]?_0x38c893[_0xce98('0x4b')]:_0x4b22ca[_0xce98('0x44')];_0x38c893[_0xce98('0x4e')]=qs[_0xce98('0x4f')](_0x354744[_0xce98('0x4a')][_0xce98('0x4f')]);_0x38c893[_0xce98('0x50')]=qs[_0xce98('0x47')](_['pick'](_0x354744[_0xce98('0x4a')],_0x4b22ca[_0xce98('0x47')]));if(_0x354744['query'][_0xce98('0x52')]){_0x38c893[_0xce98('0x50')]=_[_0xce98('0x53')](_0x38c893[_0xce98('0x50')],{'$or':_[_0xce98('0x45')](_0x38c893[_0xce98('0x4b')],function(_0x515a2b){var _0x171e8c={};_0x171e8c[_0x515a2b]={'$like':'%'+_0x354744[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x171e8c;})});}_0x38c893=_[_0xce98('0x53')]({},_0x38c893,_0x354744[_0xce98('0x55')]);return _0x14a6c0['getApplications'](_0x38c893);}})[_0xce98('0x35')](function(_0x1a1d46){if(_0x1a1d46){_0x5388d9=_0x1a1d46[_0xce98('0x5c')];if(!_0x354744[_0xce98('0x4a')][_0xce98('0x4c')]('nolimit')){_0x38c893['limit']=qs['limit'](_0x354744[_0xce98('0x4a')][_0xce98('0x2e')]);_0x38c893[_0xce98('0x30')]=qs[_0xce98('0x30')](_0x354744[_0xce98('0x4a')][_0xce98('0x30')]);}return _0x14a6c0[_0xce98('0xb3')](_0x38c893);}})[_0xce98('0x35')](function(_0xa1287){if(_0xa1287){return _0xa1287?{'count':_0x5388d9,'rows':_0xa1287}:null;}})[_0xce98('0x35')](respondWithResult(_0x86011d,null))[_0xce98('0x2a')](handleError(_0x86011d,null));};exports[_0xce98('0xb4')]=function(_0x5d16ae,_0x322ff5,_0x20968e){var _0x1317c9={'raw':![],'where':{}};var _0x422f8={};var _0x526ed8={'count':0x0,'rows':[]};return db[_0xce98('0x3f')][_0xce98('0x6d')]({'where':{'id':_0x5d16ae[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x322ff5,null))[_0xce98('0x35')](function(_0x2ed6df){if(_0x2ed6df){_0x422f8['model']=_['keys'](db[_0xce98('0x94')][_0xce98('0x40')]);_0x422f8[_0xce98('0x4a')]=_[_0xce98('0x46')](_0x5d16ae[_0xce98('0x4a')]);_0x422f8[_0xce98('0x47')]=_[_0xce98('0x48')](_0x422f8['model'],_0x422f8['query']);_0x1317c9['attributes']=_[_0xce98('0x48')](_0x422f8[_0xce98('0x44')],qs[_0xce98('0x49')](_0x5d16ae[_0xce98('0x4a')][_0xce98('0x49')]));_0x1317c9[_0xce98('0x4b')]=_0x1317c9[_0xce98('0x4b')][_0xce98('0x5c')]?_0x1317c9[_0xce98('0x4b')]:_0x422f8[_0xce98('0x44')];if(!_0x5d16ae[_0xce98('0x4a')][_0xce98('0x4c')](_0xce98('0x4d'))){_0x1317c9[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x5d16ae[_0xce98('0x4a')][_0xce98('0x2e')]);_0x1317c9[_0xce98('0x30')]=qs[_0xce98('0x30')](_0x5d16ae['query'][_0xce98('0x30')]);}_0x1317c9['order']=qs[_0xce98('0x4f')](_0x5d16ae[_0xce98('0x4a')][_0xce98('0x4f')]);_0x1317c9[_0xce98('0x50')]=qs[_0xce98('0x47')](_[_0xce98('0x51')](_0x5d16ae[_0xce98('0x4a')],_0x422f8[_0xce98('0x47')]));_0x1317c9[_0xce98('0x50')]['OpenchannelAccountId']=_0x2ed6df['id'];if(_0x5d16ae[_0xce98('0x4a')][_0xce98('0x52')]){_0x1317c9['where']=_[_0xce98('0x53')](_0x1317c9[_0xce98('0x50')],{'$or':_[_0xce98('0x45')](_0x1317c9[_0xce98('0x4b')],function(_0x4c6f2b){var _0x2874be={};_0x2874be[_0x4c6f2b]={'$like':'%'+_0x5d16ae[_0xce98('0x4a')][_0xce98('0x52')]+'%'};return _0x2874be;})});}_0x1317c9=_[_0xce98('0x53')]({},_0x1317c9,_0x5d16ae[_0xce98('0x55')]);return db[_0xce98('0x94')][_0xce98('0x2f')]({'where':_0x1317c9[_0xce98('0x50')]})[_0xce98('0x35')](function(_0x28348d){_0x526ed8[_0xce98('0x2f')]=_0x28348d;if(_0x5d16ae[_0xce98('0x4a')][_0xce98('0x56')]){_0x1317c9[_0xce98('0x57')]=[{'model':db['CmContact'],'as':_0xce98('0xb5'),'required':![]},{'model':db[_0xce98('0xa0')],'as':'Owner','attributes':[_0xce98('0x3b'),_0xce98('0xb6'),_0xce98('0xb7')],'required':![]},{'model':db[_0xce98('0xb8')],'as':_0xce98('0xb9'),'attributes':['id',_0xce98('0x3b'),'color'],'where':_0x5d16ae[_0xce98('0x4a')][_0xce98('0xba')]?{'id':_0x5d16ae['query'][_0xce98('0xba')]}:undefined,'required':_0x5d16ae['query'][_0xce98('0xba')]?!![]:![]}];}return db[_0xce98('0x94')][_0xce98('0x58')](_0x1317c9);})['then'](function(_0x48f7c9){_0x526ed8[_0xce98('0x59')]=_0x48f7c9;return _0x526ed8;});}})[_0xce98('0x35')](respondWithFilteredResult(_0x322ff5,_0x1317c9))['catch'](handleError(_0x322ff5,null));};exports[_0xce98('0xbb')]=function(_0x57d489,_0x432123,_0x598346){return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x57d489['params']['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x432123,null))[_0xce98('0x35')](function(_0x120c24){if(_0x120c24){return _0x120c24['addAgents'](_0x57d489[_0xce98('0x5f')]['ids'],_[_0xce98('0xbc')](_0x57d489['body'],['ids','id'])||{})['spread'](function(_0x41c752){for(var _0x49d2a6=0x0;_0x49d2a6<_0x57d489[_0xce98('0x5f')][_0xce98('0x73')][_0xce98('0x5c')];_0x49d2a6+=0x1){socket[_0xce98('0xbd')](_0xce98('0xbe'),{'UserId':Number(_0x57d489[_0xce98('0x5f')]['ids'][_0x49d2a6]),'OpenchannelAccountId':Number(_0x57d489[_0xce98('0x5b')]['id'])});}return _0x41c752;});}})[_0xce98('0x35')](respondWithResult(_0x432123,null))['catch'](handleError(_0x432123,null));};exports[_0xce98('0xbf')]=function(_0xe4445,_0x372799,_0x2fac50){return db['OpenchannelAccount']['find']({'where':{'id':_0xe4445[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x372799,null))[_0xce98('0x35')](function(_0x437f41){if(_0x437f41){return _0x437f41[_0xce98('0xbf')](_0xe4445[_0xce98('0x4a')][_0xce98('0x73')])[_0xce98('0x35')](function(){if(_[_0xce98('0xc0')](_0xe4445[_0xce98('0x4a')][_0xce98('0x73')])){for(var _0x232ddf=0x0;_0x232ddf<_0xe4445[_0xce98('0x4a')][_0xce98('0x73')][_0xce98('0x5c')];_0x232ddf+=0x1){socket[_0xce98('0xbd')](_0xce98('0xc1'),{'UserId':Number(_0xe4445['query']['ids'][_0x232ddf]),'OpenchannelAccountId':Number(_0xe4445[_0xce98('0x5b')]['id'])});}}else{socket['emit'](_0xce98('0xc1'),{'UserId':Number(_0xe4445[_0xce98('0x4a')][_0xce98('0x73')]),'OpenchannelAccountId':Number(_0xe4445[_0xce98('0x5b')]['id'])});}});}})[_0xce98('0x35')](respondWithStatusCode(_0x372799,null))[_0xce98('0x2a')](handleError(_0x372799,null));};exports[_0xce98('0xc2')]=function(_0x4dccdf,_0x141d6e,_0x4c7232){var _0x1ba7b9={};var _0xca4942={};var _0x4a35fd;var _0x5c4590;return db[_0xce98('0x3f')]['findOne']({'where':{'id':_0x4dccdf[_0xce98('0x5b')]['id']}})[_0xce98('0x35')](handleEntityNotFound(_0x141d6e,null))[_0xce98('0x35')](function(_0x5b97d4){if(_0x5b97d4){_0x4a35fd=_0x5b97d4;_0xca4942[_0xce98('0x44')]=_[_0xce98('0x46')](db[_0xce98('0xa0')][_0xce98('0x40')]);_0xca4942['query']=_[_0xce98('0x46')](_0x4dccdf[_0xce98('0x4a')]);_0xca4942['filters']=_['intersection'](_0xca4942[_0xce98('0x44')],_0xca4942[_0xce98('0x4a')]);_0x1ba7b9[_0xce98('0x4b')]=_[_0xce98('0x48')](_0xca4942[_0xce98('0x44')],qs[_0xce98('0x49')](_0x4dccdf['query']['fields']));_0x1ba7b9[_0xce98('0x4b')]=_0x1ba7b9[_0xce98('0x4b')][_0xce98('0x5c')]?_0x1ba7b9[_0xce98('0x4b')]:_0xca4942[_0xce98('0x44')];_0x1ba7b9[_0xce98('0x4e')]=qs[_0xce98('0x4f')](_0x4dccdf[_0xce98('0x4a')][_0xce98('0x4f')]);_0x1ba7b9['where']=qs[_0xce98('0x47')](_['pick'](_0x4dccdf[_0xce98('0x4a')],_0xca4942[_0xce98('0x47')]));if(_0x4dccdf[_0xce98('0x4a')][_0xce98('0x52')]){_0x1ba7b9['where']=_[_0xce98('0x53')](_0x1ba7b9['where'],{'$or':_[_0xce98('0x45')](_0x1ba7b9[_0xce98('0x4b')],function(_0x48afd8){var _0x17c0df={};_0x17c0df[_0x48afd8]={'$like':'%'+_0x4dccdf[_0xce98('0x4a')]['filter']+'%'};return _0x17c0df;})});}_0x1ba7b9=_[_0xce98('0x53')]({},_0x1ba7b9,_0x4dccdf[_0xce98('0x55')]);return _0x4a35fd[_0xce98('0xc2')](_0x1ba7b9);}})[_0xce98('0x35')](function(_0x1da763){if(_0x1da763){_0x5c4590=_0x1da763['length'];if(!_0x4dccdf[_0xce98('0x4a')]['hasOwnProperty']('nolimit')){_0x1ba7b9[_0xce98('0x2e')]=qs[_0xce98('0x2e')](_0x4dccdf[_0xce98('0x4a')][_0xce98('0x2e')]);_0x1ba7b9['offset']=qs[_0xce98('0x30')](_0x4dccdf[_0xce98('0x4a')][_0xce98('0x30')]);}return _0x4a35fd[_0xce98('0xc2')](_0x1ba7b9);}})[_0xce98('0x35')](function(_0x10c6b1){if(_0x10c6b1){return _0x10c6b1?{'count':_0x5c4590,'rows':_0x10c6b1}:null;}})['then'](respondWithResult(_0x141d6e,null))[_0xce98('0x2a')](handleError(_0x141d6e,null));};exports[_0xce98('0xb2')]=function(_0x1595e9,_0x2058ee,_0x39b1f5){var _0x2d0320,_0x309a24,_0x145a85;if(_['isNil'](_0x1595e9[_0xce98('0x5f')]['body'])||_0x1595e9[_0xce98('0x5f')]['body']===''){throw new db[(_0xce98('0x77'))][(_0xce98('0x7e'))](_0xce98('0xc3'));}if(_[_0xce98('0x80')](_0x1595e9[_0xce98('0x5f')]['to'])){}_0x2d0320=_0x1595e9[_0xce98('0x5f')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1595e9[_0xce98('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2058ee,null))[_0xce98('0x35')](function(_0x5d8515){if(_0x5d8515){return db[_0xce98('0x3f')][_0xce98('0x5d')]({'where':{'id':_0x5d8515['id']},'include':[{'model':db[_0xce98('0x83')],'as':_0xce98('0x84'),'include':[{'model':db[_0xce98('0x76')],'as':_0xce98('0x85'),'where':{[_0x5d8515[_0xce98('0x81')]]:_0x2d0320},'limit':0x1,'order':[[_0xce98('0x7b'),_0xce98('0x86')]]}]}]})[_0xce98('0x35')](handleEntityNotFound(_0x2058ee,null))[_0xce98('0x35')](function(_0x571483){if(_0x571483&&_0x571483[_0xce98('0x84')]){_0x309a24=_0x571483[_0xce98('0x36')]({'plain':!![]});if(_0x309a24[_0xce98('0x84')]&&_0x309a24['List']['Contacts'][_0xce98('0x5c')]){return _0x309a24[_0xce98('0x84')]['Contacts'][0x0];}return db[_0xce98('0x76')][_0xce98('0x5e')](_[_0xce98('0x1b')](_0x1595e9['body'],{'firstName':_0x2d0320,[_0x571483[_0xce98('0x81')]]:_0x2d0320,'phone':_0x2d0320,'ListId':_0x309a24[_0xce98('0x8d')]}));}})[_0xce98('0x35')](handleEntityNotFound(_0x2058ee,null))[_0xce98('0x35')](function(_0x7f98c){if(_0x7f98c){_0x145a85=_0x7f98c;return db[_0xce98('0x94')][_0xce98('0x5d')]({'where':{'ContactId':_0x145a85['id'],'closed':![],'OpenchannelAccountId':_0x309a24['id']}})[_0xce98('0x35')](function(_0x486d58){if(_0x486d58){return[_0x486d58,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x1595e9[_0xce98('0x60')]['id'],'ContactId':_0x145a85['id'],'OpenchannelAccountId':_0x309a24['id'],'lastMsgDirection':_0xce98('0xc4'),'firstMsgDirection':_0xce98('0xc4'),'Messages':[_[_0xce98('0x53')](_0x1595e9[_0xce98('0x5f')],{'read':![],'body':_0x1595e9[_0xce98('0x5f')][_0xce98('0x5f')],'OpenchannelAccountId':_0x309a24['id'],'UserId':_0x1595e9[_0xce98('0x60')]['id'],'ContactId':_0x145a85['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xce98('0xc5')}]})['then'](function(_0x49db6b){return[_0x49db6b,!![]];});});}})[_0xce98('0x95')](function(_0x5aad5b,_0x4fc9c7){if(_0x4fc9c7){return _0x5aad5b;}return db[_0xce98('0xc6')][_0xce98('0x5e')](_[_0xce98('0x53')](_0x1595e9['body'],{'read':![],'body':_0x1595e9[_0xce98('0x5f')]['body'],'OpenchannelAccountId':_0x309a24['id'],'OpenchannelInteractionId':_0x5aad5b['id'],'UserId':_0x1595e9[_0xce98('0x60')]['id'],'ContactId':_0x145a85['id']}))[_0xce98('0x35')](function(_0xa14a8d){_0x5aad5b[_0xce98('0xc7')][_0xce98('0xc5')]=[];_0x5aad5b[_0xce98('0xc7')][_0xce98('0xc5')][_0xce98('0x9a')](_0xa14a8d[_0xce98('0xc7')]);return _0x5aad5b;});});}})['then'](respondWithResult(_0x2058ee,null))[_0xce98('0x2a')](handleError(_0x2058ee,null));}; \ No newline at end of file +var _0x5353=['OpenchannelAccount','includeAll','include','findAll','rows','params','mandatoryDispositionPause','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','hasOwnProperty','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','ListId','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x54525d,_0x4e862c){var _0x23c23b=function(_0x4b6057){while(--_0x4b6057){_0x54525d['push'](_0x54525d['shift']());}};_0x23c23b(++_0x4e862c);}(_0x5353,0x12f));var _0x3535=function(_0x48403e,_0x275076){_0x48403e=_0x48403e-0x0;var _0x58f4f7=_0x5353[_0x48403e];return _0x58f4f7;};'use strict';var emlformat=require(_0x3535('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3535('0x1'));var jsonpatch=require(_0x3535('0x2'));var rp=require(_0x3535('0x3'));var moment=require(_0x3535('0x4'));var BPromise=require(_0x3535('0x5'));var Mustache=require(_0x3535('0x6'));var util=require(_0x3535('0x7'));var path=require(_0x3535('0x8'));var sox=require(_0x3535('0x9'));var csv=require(_0x3535('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3535('0xb'));var _=require('lodash');var squel=require(_0x3535('0xc'));var crypto=require(_0x3535('0xd'));var jsforce=require(_0x3535('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3535('0xa'));var querystring=require(_0x3535('0xf'));var Papa=require(_0x3535('0x10'));var Redis=require(_0x3535('0x11'));var authService=require(_0x3535('0x12'));var qs=require(_0x3535('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3535('0x14'));var logger=require(_0x3535('0x15'))('api');var utils=require(_0x3535('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3535('0x17'))['db'];config[_0x3535('0x18')]=_[_0x3535('0x19')](config[_0x3535('0x18')],{'host':_0x3535('0x1a'),'port':0x18eb});var socket=require(_0x3535('0x1b'))(new Redis(config[_0x3535('0x18')]));require('./openchannelAccount.socket')[_0x3535('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3535('0x1d')][_0x3535('0x1e')]({'port':0x232c});var client9002=jayson[_0x3535('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f18da,_0x4b7c81,_0x3451f2,_0x4dd36b){return new BPromise(function(_0x519c33,_0x4243c1){var _0x222937=_0x4dd36b||client;return _0x222937[_0x3535('0x1f')](_0x1f18da,_0x3451f2)[_0x3535('0x20')](function(_0x1dfdfe){logger[_0x3535('0x21')](_0x3535('0x22'),_0x4b7c81,_0x3535('0x23'));logger[_0x3535('0x24')](_0x3535('0x25'),_0x4b7c81,_0x3535('0x23'),JSON[_0x3535('0x26')](_0x1dfdfe));if(_0x1dfdfe['error']){if(_0x1dfdfe['error'][_0x3535('0x27')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4b7c81,_0x1dfdfe[_0x3535('0x28')][_0x3535('0x29')]);return _0x4243c1(_0x1dfdfe[_0x3535('0x28')]['message']);}logger['error'](_0x3535('0x22'),_0x4b7c81,_0x1dfdfe['error'][_0x3535('0x29')]);return _0x519c33(_0x1dfdfe['error'][_0x3535('0x29')]);}else{logger['info'](_0x3535('0x22'),_0x4b7c81,'request\x20sent');_0x519c33(_0x1dfdfe['result'][_0x3535('0x29')]);}})[_0x3535('0x2a')](function(_0x5a25d1){logger[_0x3535('0x28')](_0x3535('0x22'),_0x4b7c81,_0x5a25d1);_0x4243c1(_0x5a25d1);});});}function respondWithStatusCode(_0x5aa1d4,_0xefa28c){_0xefa28c=_0xefa28c||0xcc;return function(_0x51ba08){if(_0x51ba08){return _0x5aa1d4[_0x3535('0x2b')](_0xefa28c);}return _0x5aa1d4[_0x3535('0x2c')](_0xefa28c)[_0x3535('0x2d')]();};}function respondWithResult(_0x380948,_0x40009c){_0x40009c=_0x40009c||0xc8;return function(_0x2405b6){if(_0x2405b6){return _0x380948[_0x3535('0x2c')](_0x40009c)[_0x3535('0x2e')](_0x2405b6);}};}function respondWithFilteredResult(_0x4c993a,_0x167e64){return function(_0x17e2a0){if(_0x17e2a0){var _0x4cf180=typeof _0x167e64[_0x3535('0x2f')]===_0x3535('0x30')&&typeof _0x167e64[_0x3535('0x31')]==='undefined';var _0x57fcfa=_0x17e2a0[_0x3535('0x32')];var _0x3ccb51=_0x4cf180?0x0:_0x167e64['offset'];var _0x33a8e1=_0x4cf180?_0x17e2a0[_0x3535('0x32')]:_0x167e64[_0x3535('0x2f')]+_0x167e64[_0x3535('0x31')];var _0x5765e3;if(_0x33a8e1>=_0x57fcfa){_0x33a8e1=_0x57fcfa;_0x5765e3=0xc8;}else{_0x5765e3=0xce;}_0x4c993a[_0x3535('0x2c')](_0x5765e3);return _0x4c993a[_0x3535('0x33')]('Content-Range',_0x3ccb51+'-'+_0x33a8e1+'/'+_0x57fcfa)[_0x3535('0x2e')](_0x17e2a0);}return null;};}function patchUpdates(_0x1509b0){return function(_0x3a982e){try{jsonpatch[_0x3535('0x34')](_0x3a982e,_0x1509b0,!![]);}catch(_0x358c73){return BPromise[_0x3535('0x35')](_0x358c73);}return _0x3a982e[_0x3535('0x36')]();};}function saveUpdates(_0x59347e,_0x57b875){return function(_0x2c6cb4){if(_0x2c6cb4){return _0x2c6cb4[_0x3535('0x37')](_0x59347e)[_0x3535('0x20')](function(_0x1dd026){return _0x1dd026;});}return null;};}function removeEntity(_0x3f5558,_0x52051e){return function(_0x1cdce8){if(_0x1cdce8){return _0x1cdce8[_0x3535('0x38')]()['then'](function(){var _0x3a99ab=_0x1cdce8[_0x3535('0x39')]({'plain':!![]});var _0x3fd98f=_0x3535('0x3a');return db[_0x3535('0x3b')][_0x3535('0x38')]({'where':{'type':_0x3fd98f,'resourceId':_0x3a99ab['id']}})['then'](function(){return _0x1cdce8;});})[_0x3535('0x20')](function(){_0x3f5558['status'](0xcc)[_0x3535('0x2d')]();});}};}function handleEntityNotFound(_0x3ca1b4,_0x52dacb){return function(_0x40d4ad){if(!_0x40d4ad){_0x3ca1b4[_0x3535('0x2b')](0x194);}return _0x40d4ad;};}function handleError(_0x321da3,_0x264465){_0x264465=_0x264465||0x1f4;return function(_0x54b5a9){logger['error'](_0x54b5a9[_0x3535('0x3c')]);if(_0x54b5a9[_0x3535('0x3d')]){delete _0x54b5a9[_0x3535('0x3d')];}_0x321da3[_0x3535('0x2c')](_0x264465)[_0x3535('0x3e')](_0x54b5a9);};}exports[_0x3535('0x3f')]=function(_0x4778e3,_0x396fd9){var _0x28e187={'include':[{'model':db[_0x3535('0x40')],'as':'mandatoryDispositionPause'}]},_0x16ed33={},_0x2aec24={'count':0x0,'rows':[]};var _0x46aabb=_[_0x3535('0x41')](db['OpenchannelAccount'][_0x3535('0x42')],function(_0x22502a){return{'name':_0x22502a[_0x3535('0x43')],'type':_0x22502a[_0x3535('0x44')][_0x3535('0x45')]};});_0x16ed33[_0x3535('0x46')]=_['map'](_0x46aabb,_0x3535('0x3d'));_0x16ed33[_0x3535('0x47')]=_[_0x3535('0x48')](_0x4778e3['query']);_0x16ed33[_0x3535('0x49')]=_[_0x3535('0x4a')](_0x16ed33[_0x3535('0x46')],_0x16ed33[_0x3535('0x47')]);_0x28e187[_0x3535('0x4b')]=_[_0x3535('0x4a')](_0x16ed33[_0x3535('0x46')],qs[_0x3535('0x4c')](_0x4778e3[_0x3535('0x47')][_0x3535('0x4c')]));_0x28e187[_0x3535('0x4b')]=_0x28e187[_0x3535('0x4b')]['length']?_0x28e187[_0x3535('0x4b')]:_0x16ed33['model'];if(!_0x4778e3[_0x3535('0x47')]['hasOwnProperty'](_0x3535('0x4d'))){_0x28e187[_0x3535('0x31')]=qs[_0x3535('0x31')](_0x4778e3[_0x3535('0x47')][_0x3535('0x31')]);_0x28e187['offset']=qs[_0x3535('0x2f')](_0x4778e3[_0x3535('0x47')]['offset']);}_0x28e187[_0x3535('0x4e')]=qs[_0x3535('0x4f')](_0x4778e3[_0x3535('0x47')][_0x3535('0x4f')]);_0x28e187[_0x3535('0x50')]=qs[_0x3535('0x49')](_['pick'](_0x4778e3[_0x3535('0x47')],_0x16ed33[_0x3535('0x49')]),_0x46aabb);if(_0x4778e3['query'][_0x3535('0x51')]){_0x28e187['where']=_[_0x3535('0x52')](_0x28e187[_0x3535('0x50')],{'$or':_[_0x3535('0x41')](_0x46aabb,function(_0x548df7){if(_0x548df7[_0x3535('0x44')]!==_0x3535('0x53')){var _0x313778={};_0x313778[_0x548df7[_0x3535('0x3d')]]={'$like':'%'+_0x4778e3[_0x3535('0x47')][_0x3535('0x51')]+'%'};return _0x313778;}})});}_0x28e187=_[_0x3535('0x52')]({},_0x28e187,_0x4778e3[_0x3535('0x54')]);var _0x5c881d={'where':_0x28e187[_0x3535('0x50')]};return db[_0x3535('0x55')][_0x3535('0x32')](_0x5c881d)['then'](function(_0x4c0000){_0x2aec24[_0x3535('0x32')]=_0x4c0000;if(_0x4778e3[_0x3535('0x47')][_0x3535('0x56')]){_0x28e187[_0x3535('0x57')]=[{'all':!![]}];}return db[_0x3535('0x55')][_0x3535('0x58')](_0x28e187);})['then'](function(_0x1f17ed){_0x2aec24[_0x3535('0x59')]=_0x1f17ed;return _0x2aec24;})[_0x3535('0x20')](respondWithFilteredResult(_0x396fd9,_0x28e187))[_0x3535('0x2a')](handleError(_0x396fd9,null));};exports['show']=function(_0x5b59b2,_0x4964a5){var _0x1dc900={'raw':![],'where':{'id':_0x5b59b2[_0x3535('0x5a')]['id']},'include':[{'model':db[_0x3535('0x40')],'as':_0x3535('0x5b')}]},_0xe7561c={};_0xe7561c[_0x3535('0x46')]=_[_0x3535('0x48')](db[_0x3535('0x55')][_0x3535('0x42')]);_0xe7561c[_0x3535('0x47')]=_[_0x3535('0x48')](_0x5b59b2[_0x3535('0x47')]);_0xe7561c[_0x3535('0x49')]=_[_0x3535('0x4a')](_0xe7561c[_0x3535('0x46')],_0xe7561c[_0x3535('0x47')]);_0x1dc900[_0x3535('0x4b')]=_[_0x3535('0x4a')](_0xe7561c[_0x3535('0x46')],qs['fields'](_0x5b59b2['query'][_0x3535('0x4c')]));_0x1dc900['attributes']=_0x1dc900[_0x3535('0x4b')][_0x3535('0x5c')]?_0x1dc900['attributes']:_0xe7561c[_0x3535('0x46')];if(_0x5b59b2[_0x3535('0x47')][_0x3535('0x56')]){_0x1dc900[_0x3535('0x57')]=[{'all':!![]}];}_0x1dc900=_[_0x3535('0x52')]({},_0x1dc900,_0x5b59b2['options']);return db[_0x3535('0x55')][_0x3535('0x5d')](_0x1dc900)['then'](handleEntityNotFound(_0x4964a5,null))['then'](respondWithResult(_0x4964a5,null))['catch'](handleError(_0x4964a5,null));};exports['create']=function(_0x459d17,_0x3408f8){return db[_0x3535('0x55')][_0x3535('0x5e')](_0x459d17[_0x3535('0x5f')],{})['then'](function(_0xd0c9b9){var _0xc61089=_0x459d17[_0x3535('0x60')]['get']({'plain':!![]});if(!_0xc61089)throw new Error(_0x3535('0x61'));if(_0xc61089[_0x3535('0x62')]==='user'){var _0x4a811b=_0xd0c9b9[_0x3535('0x39')]({'plain':!![]});var _0x5e1067=_0x3535('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x5e1067,'userProfileId':_0xc61089[_0x3535('0x63')]},'raw':!![]})[_0x3535('0x20')](function(_0x4d16bd){if(_0x4d16bd&&_0x4d16bd[_0x3535('0x64')]===0x0){return db[_0x3535('0x3b')][_0x3535('0x5e')]({'name':_0x4a811b[_0x3535('0x3d')],'resourceId':_0x4a811b['id'],'type':_0x4d16bd[_0x3535('0x3d')],'sectionId':_0x4d16bd['id']},{})[_0x3535('0x20')](function(){return _0xd0c9b9;});}else{return _0xd0c9b9;}})[_0x3535('0x2a')](function(_0x1dd4ec){logger[_0x3535('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dd4ec);throw _0x1dd4ec;});}return _0xd0c9b9;})[_0x3535('0x20')](respondWithResult(_0x3408f8,0xc9))[_0x3535('0x2a')](handleError(_0x3408f8,null));};exports[_0x3535('0x37')]=function(_0x499283,_0x58909a){if(_0x499283['body']['id']){delete _0x499283[_0x3535('0x5f')]['id'];}return db['OpenchannelAccount'][_0x3535('0x5d')]({'where':{'id':_0x499283['params']['id']},'include':[{'model':db[_0x3535('0x40')],'as':_0x3535('0x5b')}]})[_0x3535('0x20')](handleEntityNotFound(_0x58909a,null))[_0x3535('0x20')](saveUpdates(_0x499283[_0x3535('0x5f')],null))['then'](respondWithResult(_0x58909a,null))['catch'](handleError(_0x58909a,null));};exports['destroy']=function(_0x107619,_0x28f5e9){return db[_0x3535('0x55')][_0x3535('0x5d')]({'where':{'id':_0x107619[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x28f5e9,null))['then'](removeEntity(_0x28f5e9,null))[_0x3535('0x2a')](handleError(_0x28f5e9,null));};exports['describe']=function(_0xa9071e,_0x3008f7){return db['OpenchannelAccount']['describe']()[_0x3535('0x20')](respondWithResult(_0x3008f7,null))[_0x3535('0x2a')](handleError(_0x3008f7,null));};exports[_0x3535('0x65')]=function(_0x51de47,_0x31bd65,_0xef83f8){if(_0x51de47[_0x3535('0x5f')]['id']){delete _0x51de47['body']['id'];}return db[_0x3535('0x55')][_0x3535('0x5d')]({'where':{'id':_0x51de47[_0x3535('0x5a')]['id']}})['then'](handleEntityNotFound(_0x31bd65,null))[_0x3535('0x20')](function(_0x3600be){if(_0x3600be){_0x51de47[_0x3535('0x5f')][_0x3535('0x66')]=_0x3600be['id'];return db['Disposition']['create'](_0x51de47[_0x3535('0x5f')]);}})[_0x3535('0x20')](respondWithResult(_0x31bd65,null))[_0x3535('0x2a')](handleError(_0x31bd65,null));};exports[_0x3535('0x67')]=function(_0x13f575,_0x2d1d17,_0x1d5d53){var _0xfd4d={'raw':![],'where':{}};var _0x449931={};var _0x22f959={'count':0x0,'rows':[]};return db[_0x3535('0x55')][_0x3535('0x68')]({'where':{'id':_0x13f575[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x2d1d17,null))[_0x3535('0x20')](function(_0x47a30b){if(_0x47a30b){_0x449931['model']=_['keys'](db[_0x3535('0x69')][_0x3535('0x42')]);_0x449931[_0x3535('0x47')]=_[_0x3535('0x48')](_0x13f575[_0x3535('0x47')]);_0x449931[_0x3535('0x49')]=_[_0x3535('0x4a')](_0x449931[_0x3535('0x46')],_0x449931[_0x3535('0x47')]);_0xfd4d[_0x3535('0x4b')]=_['intersection'](_0x449931['model'],qs['fields'](_0x13f575['query'][_0x3535('0x4c')]));_0xfd4d['attributes']=_0xfd4d[_0x3535('0x4b')]['length']?_0xfd4d[_0x3535('0x4b')]:_0x449931[_0x3535('0x46')];if(!_0x13f575[_0x3535('0x47')][_0x3535('0x6a')](_0x3535('0x4d'))){_0xfd4d[_0x3535('0x31')]=qs[_0x3535('0x31')](_0x13f575[_0x3535('0x47')][_0x3535('0x31')]);_0xfd4d[_0x3535('0x2f')]=qs['offset'](_0x13f575[_0x3535('0x47')][_0x3535('0x2f')]);}_0xfd4d[_0x3535('0x4e')]=qs['sort'](_0x13f575[_0x3535('0x47')][_0x3535('0x4f')]);_0xfd4d[_0x3535('0x50')]=qs[_0x3535('0x49')](_[_0x3535('0x6b')](_0x13f575['query'],_0x449931[_0x3535('0x49')]));_0xfd4d[_0x3535('0x50')][_0x3535('0x66')]=_0x47a30b['id'];if(_0x13f575[_0x3535('0x47')][_0x3535('0x51')]){_0xfd4d['where']=_['merge'](_0xfd4d[_0x3535('0x50')],{'$or':_[_0x3535('0x41')](_0xfd4d['attributes'],function(_0x25d41c){var _0x266cf5={};_0x266cf5[_0x25d41c]={'$like':'%'+_0x13f575[_0x3535('0x47')][_0x3535('0x51')]+'%'};return _0x266cf5;})});}_0xfd4d=_['merge']({},_0xfd4d,_0x13f575[_0x3535('0x54')]);return db[_0x3535('0x69')][_0x3535('0x32')]({'where':_0xfd4d['where']})['then'](function(_0x3730e0){_0x22f959[_0x3535('0x32')]=_0x3730e0;if(_0x13f575[_0x3535('0x47')][_0x3535('0x56')]){_0xfd4d[_0x3535('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x3535('0x58')](_0xfd4d);})['then'](function(_0x9640e5){_0x22f959['rows']=_0x9640e5;return _0x22f959;});}})[_0x3535('0x20')](respondWithFilteredResult(_0x2d1d17,_0xfd4d))['catch'](handleError(_0x2d1d17,null));};exports[_0x3535('0x6c')]=function(_0x5df7b1,_0x9b0160,_0x4be76e){return db[_0x3535('0x55')][_0x3535('0x5d')]({'where':{'id':_0x5df7b1[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x9b0160,null))[_0x3535('0x20')](function(_0x4878a6){if(_0x4878a6){return _0x4878a6[_0x3535('0x6c')](_0x5df7b1['query'][_0x3535('0x6d')]);}})[_0x3535('0x20')](respondWithStatusCode(_0x9b0160,null))['catch'](handleError(_0x9b0160,null));};exports[_0x3535('0x6e')]=function(_0x36337e,_0x26669f,_0x1769c8){if(_0x36337e['body']['id']){delete _0x36337e[_0x3535('0x5f')]['id'];}return db[_0x3535('0x55')][_0x3535('0x5d')]({'where':{'id':_0x36337e['params']['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x26669f,null))[_0x3535('0x20')](function(_0x3a271e){if(_0x3a271e){_0x36337e['body']['OpenchannelAccountId']=_0x3a271e['id'];return db[_0x3535('0x6f')][_0x3535('0x5e')](_0x36337e['body']);}})[_0x3535('0x20')](respondWithResult(_0x26669f,null))[_0x3535('0x2a')](handleError(_0x26669f,null));};exports[_0x3535('0x70')]=function(_0x1a5a7b,_0x279091,_0x5de340){var _0x4c278a={'raw':![],'where':{}};var _0x4d311e={};var _0x3802b7={'count':0x0,'rows':[]};return db[_0x3535('0x55')][_0x3535('0x68')]({'where':{'id':_0x1a5a7b['params']['id']}})['then'](handleEntityNotFound(_0x279091,null))[_0x3535('0x20')](function(_0xced1e){if(_0xced1e){_0x4d311e[_0x3535('0x46')]=_['keys'](db[_0x3535('0x6f')][_0x3535('0x42')]);_0x4d311e[_0x3535('0x47')]=_[_0x3535('0x48')](_0x1a5a7b[_0x3535('0x47')]);_0x4d311e[_0x3535('0x49')]=_[_0x3535('0x4a')](_0x4d311e[_0x3535('0x46')],_0x4d311e[_0x3535('0x47')]);_0x4c278a[_0x3535('0x4b')]=_[_0x3535('0x4a')](_0x4d311e[_0x3535('0x46')],qs[_0x3535('0x4c')](_0x1a5a7b[_0x3535('0x47')][_0x3535('0x4c')]));_0x4c278a[_0x3535('0x4b')]=_0x4c278a[_0x3535('0x4b')][_0x3535('0x5c')]?_0x4c278a[_0x3535('0x4b')]:_0x4d311e[_0x3535('0x46')];if(!_0x1a5a7b[_0x3535('0x47')][_0x3535('0x6a')](_0x3535('0x4d'))){_0x4c278a[_0x3535('0x31')]=qs[_0x3535('0x31')](_0x1a5a7b[_0x3535('0x47')]['limit']);_0x4c278a['offset']=qs[_0x3535('0x2f')](_0x1a5a7b[_0x3535('0x47')][_0x3535('0x2f')]);}_0x4c278a[_0x3535('0x4e')]=qs[_0x3535('0x4f')](_0x1a5a7b[_0x3535('0x47')]['sort']);_0x4c278a[_0x3535('0x50')]=qs['filters'](_['pick'](_0x1a5a7b[_0x3535('0x47')],_0x4d311e['filters']));_0x4c278a[_0x3535('0x50')][_0x3535('0x66')]=_0xced1e['id'];if(_0x1a5a7b[_0x3535('0x47')]['filter']){_0x4c278a[_0x3535('0x50')]=_[_0x3535('0x52')](_0x4c278a[_0x3535('0x50')],{'$or':_['map'](_0x4c278a[_0x3535('0x4b')],function(_0xd31081){var _0x3e6d32={};_0x3e6d32[_0xd31081]={'$like':'%'+_0x1a5a7b[_0x3535('0x47')][_0x3535('0x51')]+'%'};return _0x3e6d32;})});}_0x4c278a=_['merge']({},_0x4c278a,_0x1a5a7b[_0x3535('0x54')]);return db[_0x3535('0x6f')][_0x3535('0x32')]({'where':_0x4c278a['where']})[_0x3535('0x20')](function(_0x27f4a5){_0x3802b7[_0x3535('0x32')]=_0x27f4a5;if(_0x1a5a7b['query'][_0x3535('0x56')]){_0x4c278a[_0x3535('0x57')]=[{'all':!![]}];}return db[_0x3535('0x6f')][_0x3535('0x58')](_0x4c278a);})[_0x3535('0x20')](function(_0x56be4d){_0x3802b7[_0x3535('0x59')]=_0x56be4d;return _0x3802b7;});}})['then'](respondWithFilteredResult(_0x279091,_0x4c278a))[_0x3535('0x2a')](handleError(_0x279091,null));};exports[_0x3535('0x71')]=function(_0x2e3ebe,_0x26ae84,_0x3c874b){return db['OpenchannelAccount'][_0x3535('0x5d')]({'where':{'id':_0x2e3ebe['params']['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x26ae84,null))[_0x3535('0x20')](function(_0x44cce9){if(_0x44cce9){return _0x44cce9[_0x3535('0x71')](_0x2e3ebe['query'][_0x3535('0x6d')]);}})[_0x3535('0x20')](respondWithStatusCode(_0x26ae84,null))['catch'](handleError(_0x26ae84,null));};exports[_0x3535('0x72')]=function(_0x20c1ce,_0x2ae339,_0x506514){var _0x4091e7={'body':_0x20c1ce[_0x3535('0x5f')],'channel':_0x3535('0x73')};var _0x2349e7=[];var _0x4e755c=[];var _0x3c99ec={};var _0x26b09d=![];return db[_0x3535('0x74')][_0x3535('0x75')]()[_0x3535('0x20')](function(_0x46f29e){if(!_0x46f29e){throw new db[(_0x3535('0x76'))][(_0x3535('0x77'))](_0x3535('0x78'));}_0x2349e7=_['difference'](_['keys'](_0x46f29e),[_0x3535('0x79'),_0x3535('0x7a')]);_0x4e755c=_[_0x3535('0x7b')](_[_0x3535('0x48')](_0x46f29e),[_0x3535('0x79'),_0x3535('0x7a'),_0x3535('0x7c'),'ListId']);if(_0x20c1ce[_0x3535('0x5f')]['id']){delete _0x20c1ce[_0x3535('0x5f')]['id'];}if(_[_0x3535('0x7d')](_0x20c1ce[_0x3535('0x5f')][_0x3535('0x7e')])){throw new db[(_0x3535('0x76'))][(_0x3535('0x77'))]('from\x20is\x20mandatory');}if(_[_0x3535('0x7d')](_0x20c1ce[_0x3535('0x5f')][_0x3535('0x5f')])||_0x20c1ce[_0x3535('0x5f')][_0x3535('0x5f')]===''){throw new db[(_0x3535('0x76'))]['ValidationError'](_0x3535('0x7f'));}if(_[_0x3535('0x7d')](_0x20c1ce[_0x3535('0x5f')][_0x3535('0x80')])){throw new db[(_0x3535('0x76'))][(_0x3535('0x77'))](_0x3535('0x81')+_0x4e755c);}if(!_[_0x3535('0x82')](_0x4e755c,_0x20c1ce[_0x3535('0x5f')][_0x3535('0x80')])){throw new db[(_0x3535('0x76'))][(_0x3535('0x77'))](_0x3535('0x83')+_0x4e755c);}_0x3c99ec[_0x20c1ce[_0x3535('0x5f')]['mapKey']]=_0x20c1ce[_0x3535('0x5f')][_0x3535('0x7e')];})['then'](function(){return db['OpenchannelAccount'][_0x3535('0x5d')]({'where':{'id':_0x20c1ce[_0x3535('0x5a')]['id']},'include':[{'model':db[_0x3535('0x84')],'as':_0x3535('0x85'),'include':[{'model':db['CmContact'],'as':_0x3535('0x86'),'where':_0x3c99ec,'limit':0x1,'order':[[_0x3535('0x7a'),_0x3535('0x87')]]}]},{'model':db[_0x3535('0x88')],'as':_0x3535('0x89')}]});})['then'](handleEntityNotFound(_0x2ae339,null))['then'](function(_0xb784fe){if(_0xb784fe&&_0xb784fe[_0x3535('0x85')]){_0x4091e7['account']=_0xb784fe;_0x4091e7[_0x3535('0x8a')]=_0xb784fe[_0x3535('0x89')];_0x4091e7[_0x3535('0x8b')]=_0xb784fe[_0x3535('0x85')];_0x4091e7[_0x3535('0x8a')]=_[_0x3535('0x8c')](_0x4091e7['applications'],[_0x3535('0x8d')],[_0x3535('0x8e')]);if(_0x4091e7[_0x3535('0x8f')]['Applications']){delete _0x4091e7['account'][_0x3535('0x89')];}if(_0x4091e7[_0x3535('0x8f')][_0x3535('0x85')]&&_0x4091e7[_0x3535('0x8f')][_0x3535('0x85')]['Contacts'][_0x3535('0x5c')]){return _0x4091e7['account'][_0x3535('0x85')][_0x3535('0x86')][0x0];}var _0x4c2785=_[_0x3535('0x19')](_0x20c1ce[_0x3535('0x5f')],{'firstName':_0x20c1ce[_0x3535('0x5f')][_0x3535('0x7e')],'ListId':_0xb784fe['ListId']});_0x4c2785[_0x20c1ce[_0x3535('0x5f')][_0x3535('0x80')]]=_0x20c1ce[_0x3535('0x5f')][_0x3535('0x7e')];return db[_0x3535('0x74')][_0x3535('0x5e')](_0x4c2785,{'fields':_0x2349e7,'raw':!![]});}})[_0x3535('0x20')](handleEntityNotFound(_0x2ae339,null))[_0x3535('0x20')](function(_0x5ed345){_0x4091e7[_0x3535('0x90')]=_0x5ed345;if(_0x5ed345){var _0x20a35d={'ContactId':_0x5ed345['id'],'OpenchannelAccountId':_0x20c1ce[_0x3535('0x5a')]['id'],'from':(_0x5ed345[_0x3535('0x91')]||'')+'\x20'+(_0x5ed345[_0x3535('0x92')]||'')};var _0x35ed81={'OpenchannelAccountId':_0x20c1ce[_0x3535('0x5a')]['id'],'closed':![]};if(_0x20c1ce['body']['threadId']){_0x35ed81['threadId']=_0x20c1ce['body'][_0x3535('0x93')];return db[_0x3535('0x94')]['find']({'where':_0x35ed81})[_0x3535('0x20')](function(_0x1653f3){if(_0x1653f3){return[_0x1653f3,![]];}_0x20a35d[_0x3535('0x93')]=_0x20c1ce[_0x3535('0x5f')][_0x3535('0x93')];_0x20a35d[_0x3535('0x95')]=_0x20c1ce[_0x3535('0x5f')][_0x3535('0x95')];return db[_0x3535('0x94')][_0x3535('0x5e')](_0x20a35d)[_0x3535('0x20')](function(_0xc959fd){return[_0xc959fd,!![]];});});}else{_0x35ed81[_0x3535('0x93')]=null;}_0x35ed81['ContactId']=_0x5ed345['id'];return db[_0x3535('0x94')][_0x3535('0x5d')]({'where':_0x35ed81})[_0x3535('0x20')](function(_0x18abad){if(_0x18abad){return[_0x18abad,![]];}return db[_0x3535('0x94')]['create'](_0x20a35d)['then'](function(_0x2093ac){return[_0x2093ac,!![]];});});}})[_0x3535('0x96')](function(_0xe4e44e,_0x25d7b6){if(_0xe4e44e){_0x26b09d=_0x25d7b6;if(!_0x25d7b6){var _0x32b78f={'from':(_0x4091e7[_0x3535('0x90')][_0x3535('0x91')]||'')+'\x20'+(_0x4091e7[_0x3535('0x90')]['lastName']||'')};if(_0x20c1ce[_0x3535('0x5f')][_0x3535('0x93')]&&_0x20c1ce[_0x3535('0x5f')]['messageId']&&_0x20c1ce[_0x3535('0x5f')][_0x3535('0x93')]!=_0x20c1ce['body'][_0x3535('0x97')]){_0x32b78f['threadId']=_0x20c1ce[_0x3535('0x5f')][_0x3535('0x97')];}return _0xe4e44e['update'](_0x32b78f);}else{return _0xe4e44e;}}})['then'](function(_0x421700){_0x4091e7[_0x3535('0x98')]=_0x421700[_0x3535('0x39')]({'plain':!![]});_0x4091e7[_0x3535('0x98')]['created']=_0x26b09d;if(_0x4091e7[_0x3535('0x98')][_0x3535('0x99')]){if(_0x4091e7['account'][_0x3535('0x9a')]){_0x4091e7[_0x3535('0x8a')][_0x3535('0x9b')]({'id':0x0,'priority':_0x4091e7[_0x3535('0x8a')]['length']+0x1,'app':_0x3535('0x9c'),'appdata':_0x3535('0x9d'),'interval':_0x3535('0x9e')});}}return db[_0x3535('0x9f')][_0x3535('0x5e')]({'body':_0x20c1ce['body'][_0x3535('0x5f')],'OpenchannelAccountId':_0x20c1ce[_0x3535('0x5a')]['id'],'OpenchannelInteractionId':_0x421700['id'],'direction':'in','ContactId':_0x4091e7[_0x3535('0x90')]['id'],'AttachmentId':_0x20c1ce[_0x3535('0x5f')][_0x3535('0xa0')]});})[_0x3535('0x20')](function(_0x2eb1a8){_0x4091e7[_0x3535('0x29')]=_0x2eb1a8;if(!_0x4091e7['interaction'][_0x3535('0xa1')])return;return db[_0x3535('0xa2')][_0x3535('0x5d')]({'attributes':['id',_0x3535('0x3d')],'where':{'id':_0x4091e7[_0x3535('0x98')][_0x3535('0xa1')]}});})[_0x3535('0x20')](function(_0x2decbd){if(_0x2decbd){_0x4091e7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x3535('0xa3'),'appdata':_0x2decbd['name']+','+(_0x4091e7['account']['waitForTheAssignedAgent']||0xa),'interval':_0x3535('0x9e')});}if(!_0x4091e7[_0x3535('0x98')][_0x3535('0xa4')])return;return db[_0x3535('0xa5')][_0x3535('0x5d')]({'attributes':['id',_0x3535('0x3d')],'where':{'id':_0x4091e7[_0x3535('0x98')][_0x3535('0xa4')]}});})[_0x3535('0x20')](function(_0xc0ce01){if(_0xc0ce01){_0x4091e7['applications'][_0x3535('0xa6')]({'id':0x0,'priority':0x1,'app':_0x3535('0xa7'),'appdata':_0xc0ce01['name']+','+(_0x4091e7[_0x3535('0x8f')][_0x3535('0xa8')]||0x12c),'interval':_0x3535('0x9e')});}return respondWithRpcPromise('Start','startRouting',_0x4091e7);})[_0x3535('0x20')](function(_0x42068f){respondWithRpcPromise('EventManager',_0x3535('0xa9'),{'event':_0x3535('0x72'),'message':_0x42068f},client9002);return _0x42068f;})[_0x3535('0x20')](respondWithResult(_0x2ae339,null))[_0x3535('0x2a')](handleError(_0x2ae339,null));};exports[_0x3535('0xaa')]=function(_0x14910f,_0x25ce40){var _0xd4d2e4=_0x14910f[_0x3535('0x5a')]['id'];var _0x29a46c=_0x14910f[_0x3535('0x5f')];var _0x56fd9d=0xc8;var _0x245990=null;return db[_0x3535('0xab')][_0x3535('0xac')]({'isolationLevel':db[_0x3535('0xab')]['Transaction'][_0x3535('0xad')][_0x3535('0xae')]},function(_0x45c755){return db[_0x3535('0x55')]['findOne']({'where':{'id':_0xd4d2e4},'transaction':_0x45c755})[_0x3535('0x20')](function(_0x3411d3){if(_0x3411d3){return db[_0x3535('0x88')][_0x3535('0x38')]({'where':{'OpenchannelAccountId':_0xd4d2e4},'transaction':_0x45c755})['then'](function(){var _0x57c2a0=_[_0x3535('0x41')](_0x29a46c,function(_0x268e80){_0x268e80[_0x3535('0x66')]=_0xd4d2e4;return _0x268e80;});return db[_0x3535('0x88')][_0x3535('0xaf')](_0x57c2a0,{'transaction':_0x45c755});});}else{_0x56fd9d=0x194;_0x245990=[];}});})['then'](function(){if(_0x56fd9d!==0x194){return db['OpenchannelApplication'][_0x3535('0xb0')]({'where':{'OpenchannelAccountId':_0xd4d2e4},'order':_0x3535('0x8d')})[_0x3535('0x20')](function(_0x105c5e){_0x245990=_0x105c5e;});}})['catch'](function(_0x129f3e){_0x56fd9d=0x1f4;logger[_0x3535('0x28')](_0x129f3e[_0x3535('0x3c')]);if(_0x129f3e[_0x3535('0x3d')]){delete _0x129f3e[_0x3535('0x3d')];}_0x245990=_0x129f3e;})['finally'](function(){if(_0x245990===null){_0x25ce40[_0x3535('0x2b')](_0x56fd9d);}else{if(_0x56fd9d===0x1f4){_0x25ce40[_0x3535('0x2c')](_0x56fd9d)[_0x3535('0x3e')](_0x245990);}else{_0x25ce40[_0x3535('0x2c')](_0x56fd9d)[_0x3535('0x2e')](_0x245990);}}});};exports['getApplications']=function(_0x25a420,_0x3d9888,_0x41c033){var _0x289195={};var _0x3e5134={};var _0x3b7263;var _0x38bb2f;return db['OpenchannelAccount'][_0x3535('0x68')]({'where':{'id':_0x25a420[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x3d9888,null))['then'](function(_0x51285c){if(_0x51285c){_0x3b7263=_0x51285c;_0x3e5134[_0x3535('0x46')]=_[_0x3535('0x48')](db[_0x3535('0x88')][_0x3535('0x42')]);_0x3e5134[_0x3535('0x47')]=_[_0x3535('0x48')](_0x25a420[_0x3535('0x47')]);_0x3e5134['filters']=_['intersection'](_0x3e5134[_0x3535('0x46')],_0x3e5134['query']);_0x289195['attributes']=_[_0x3535('0x4a')](_0x3e5134[_0x3535('0x46')],qs[_0x3535('0x4c')](_0x25a420[_0x3535('0x47')][_0x3535('0x4c')]));_0x289195['attributes']=_0x289195['attributes'][_0x3535('0x5c')]?_0x289195['attributes']:_0x3e5134[_0x3535('0x46')];_0x289195[_0x3535('0x4e')]=qs['sort'](_0x25a420[_0x3535('0x47')][_0x3535('0x4f')]);_0x289195['where']=qs[_0x3535('0x49')](_[_0x3535('0x6b')](_0x25a420['query'],_0x3e5134['filters']));if(_0x25a420[_0x3535('0x47')]['filter']){_0x289195['where']=_[_0x3535('0x52')](_0x289195[_0x3535('0x50')],{'$or':_[_0x3535('0x41')](_0x289195[_0x3535('0x4b')],function(_0x23e976){var _0x5c849a={};_0x5c849a[_0x23e976]={'$like':'%'+_0x25a420[_0x3535('0x47')][_0x3535('0x51')]+'%'};return _0x5c849a;})});}_0x289195=_[_0x3535('0x52')]({},_0x289195,_0x25a420[_0x3535('0x54')]);return _0x3b7263[_0x3535('0xb1')](_0x289195);}})['then'](function(_0x370b23){if(_0x370b23){_0x38bb2f=_0x370b23[_0x3535('0x5c')];if(!_0x25a420['query']['hasOwnProperty'](_0x3535('0x4d'))){_0x289195['limit']=qs[_0x3535('0x31')](_0x25a420[_0x3535('0x47')][_0x3535('0x31')]);_0x289195[_0x3535('0x2f')]=qs[_0x3535('0x2f')](_0x25a420[_0x3535('0x47')][_0x3535('0x2f')]);}return _0x3b7263['getApplications'](_0x289195);}})[_0x3535('0x20')](function(_0x4eb872){if(_0x4eb872){return _0x4eb872?{'count':_0x38bb2f,'rows':_0x4eb872}:null;}})[_0x3535('0x20')](respondWithResult(_0x3d9888,null))['catch'](handleError(_0x3d9888,null));};exports['getInteractions']=function(_0x5e07a4,_0x2b6b26,_0x364ec8){var _0x3f251b={'raw':![],'where':{}};var _0x44fe39={};var _0x13d43c={'count':0x0,'rows':[]};return db[_0x3535('0x55')][_0x3535('0x68')]({'where':{'id':_0x5e07a4[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x2b6b26,null))[_0x3535('0x20')](function(_0x1732db){if(_0x1732db){_0x44fe39[_0x3535('0x46')]=_[_0x3535('0x48')](db[_0x3535('0x94')][_0x3535('0x42')]);_0x44fe39[_0x3535('0x47')]=_['keys'](_0x5e07a4[_0x3535('0x47')]);_0x44fe39[_0x3535('0x49')]=_['intersection'](_0x44fe39[_0x3535('0x46')],_0x44fe39[_0x3535('0x47')]);_0x3f251b[_0x3535('0x4b')]=_[_0x3535('0x4a')](_0x44fe39[_0x3535('0x46')],qs[_0x3535('0x4c')](_0x5e07a4[_0x3535('0x47')][_0x3535('0x4c')]));_0x3f251b[_0x3535('0x4b')]=_0x3f251b[_0x3535('0x4b')][_0x3535('0x5c')]?_0x3f251b[_0x3535('0x4b')]:_0x44fe39[_0x3535('0x46')];if(!_0x5e07a4[_0x3535('0x47')]['hasOwnProperty']('nolimit')){_0x3f251b[_0x3535('0x31')]=qs['limit'](_0x5e07a4['query']['limit']);_0x3f251b[_0x3535('0x2f')]=qs[_0x3535('0x2f')](_0x5e07a4[_0x3535('0x47')][_0x3535('0x2f')]);}_0x3f251b[_0x3535('0x4e')]=qs[_0x3535('0x4f')](_0x5e07a4['query'][_0x3535('0x4f')]);_0x3f251b['where']=qs[_0x3535('0x49')](_['pick'](_0x5e07a4[_0x3535('0x47')],_0x44fe39['filters']));_0x3f251b[_0x3535('0x50')][_0x3535('0x66')]=_0x1732db['id'];if(_0x5e07a4[_0x3535('0x47')]['filter']){_0x3f251b[_0x3535('0x50')]=_[_0x3535('0x52')](_0x3f251b[_0x3535('0x50')],{'$or':_[_0x3535('0x41')](_0x3f251b['attributes'],function(_0x3eb622){var _0x24ab12={};_0x24ab12[_0x3eb622]={'$like':'%'+_0x5e07a4['query'][_0x3535('0x51')]+'%'};return _0x24ab12;})});}_0x3f251b=_[_0x3535('0x52')]({},_0x3f251b,_0x5e07a4[_0x3535('0x54')]);return db[_0x3535('0x94')]['count']({'where':_0x3f251b[_0x3535('0x50')]})[_0x3535('0x20')](function(_0x4abd6c){_0x13d43c[_0x3535('0x32')]=_0x4abd6c;if(_0x5e07a4[_0x3535('0x47')][_0x3535('0x56')]){_0x3f251b['include']=[{'model':db[_0x3535('0x74')],'as':'Contact','required':![]},{'model':db[_0x3535('0xa2')],'as':'Owner','attributes':[_0x3535('0x3d'),'fullname',_0x3535('0xb2')],'required':![]},{'model':db['Tag'],'as':_0x3535('0xb3'),'attributes':['id','name',_0x3535('0xb4')],'where':_0x5e07a4['query'][_0x3535('0xb5')]?{'id':_0x5e07a4['query'][_0x3535('0xb5')]}:undefined,'required':_0x5e07a4[_0x3535('0x47')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x3535('0x58')](_0x3f251b);})['then'](function(_0x3b6663){_0x13d43c[_0x3535('0x59')]=_0x3b6663;return _0x13d43c;});}})[_0x3535('0x20')](respondWithFilteredResult(_0x2b6b26,_0x3f251b))[_0x3535('0x2a')](handleError(_0x2b6b26,null));};exports[_0x3535('0xb6')]=function(_0x88f4c7,_0x59492a,_0x3d8f99){return db['OpenchannelAccount'][_0x3535('0x5d')]({'where':{'id':_0x88f4c7[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x59492a,null))[_0x3535('0x20')](function(_0x3c64d3){if(_0x3c64d3){return _0x3c64d3[_0x3535('0xb6')](_0x88f4c7[_0x3535('0x5f')][_0x3535('0x6d')],_[_0x3535('0xb7')](_0x88f4c7['body'],['ids','id'])||{})[_0x3535('0x96')](function(_0x9b1ab8){for(var _0xe54cc7=0x0;_0xe54cc7<_0x88f4c7[_0x3535('0x5f')][_0x3535('0x6d')][_0x3535('0x5c')];_0xe54cc7+=0x1){socket[_0x3535('0xb8')](_0x3535('0xb9'),{'UserId':Number(_0x88f4c7[_0x3535('0x5f')]['ids'][_0xe54cc7]),'OpenchannelAccountId':Number(_0x88f4c7[_0x3535('0x5a')]['id'])});}return _0x9b1ab8;});}})[_0x3535('0x20')](respondWithResult(_0x59492a,null))[_0x3535('0x2a')](handleError(_0x59492a,null));};exports[_0x3535('0xba')]=function(_0x39e88e,_0x2667c4,_0x464f04){return db[_0x3535('0x55')][_0x3535('0x5d')]({'where':{'id':_0x39e88e[_0x3535('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2667c4,null))[_0x3535('0x20')](function(_0xab3e45){if(_0xab3e45){return _0xab3e45[_0x3535('0xba')](_0x39e88e[_0x3535('0x47')][_0x3535('0x6d')])[_0x3535('0x20')](function(){if(_[_0x3535('0xbb')](_0x39e88e[_0x3535('0x47')][_0x3535('0x6d')])){for(var _0x4de4b0=0x0;_0x4de4b0<_0x39e88e[_0x3535('0x47')]['ids'][_0x3535('0x5c')];_0x4de4b0+=0x1){socket[_0x3535('0xb8')](_0x3535('0xbc'),{'UserId':Number(_0x39e88e[_0x3535('0x47')]['ids'][_0x4de4b0]),'OpenchannelAccountId':Number(_0x39e88e[_0x3535('0x5a')]['id'])});}}else{socket[_0x3535('0xb8')]('userOpenchannelAccount:remove',{'UserId':Number(_0x39e88e[_0x3535('0x47')][_0x3535('0x6d')]),'OpenchannelAccountId':Number(_0x39e88e[_0x3535('0x5a')]['id'])});}});}})[_0x3535('0x20')](respondWithStatusCode(_0x2667c4,null))[_0x3535('0x2a')](handleError(_0x2667c4,null));};exports[_0x3535('0xbd')]=function(_0x239ee9,_0x3eee83,_0x1c0872){var _0x179ecc={};var _0x4725aa={};var _0x57e89e;var _0x102d93;return db[_0x3535('0x55')][_0x3535('0x68')]({'where':{'id':_0x239ee9[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x3eee83,null))[_0x3535('0x20')](function(_0x3f2592){if(_0x3f2592){_0x57e89e=_0x3f2592;_0x4725aa[_0x3535('0x46')]=_[_0x3535('0x48')](db[_0x3535('0xa2')][_0x3535('0x42')]);_0x4725aa[_0x3535('0x47')]=_[_0x3535('0x48')](_0x239ee9[_0x3535('0x47')]);_0x4725aa[_0x3535('0x49')]=_['intersection'](_0x4725aa[_0x3535('0x46')],_0x4725aa[_0x3535('0x47')]);_0x179ecc[_0x3535('0x4b')]=_[_0x3535('0x4a')](_0x4725aa[_0x3535('0x46')],qs[_0x3535('0x4c')](_0x239ee9[_0x3535('0x47')][_0x3535('0x4c')]));_0x179ecc[_0x3535('0x4b')]=_0x179ecc[_0x3535('0x4b')][_0x3535('0x5c')]?_0x179ecc[_0x3535('0x4b')]:_0x4725aa[_0x3535('0x46')];_0x179ecc[_0x3535('0x4e')]=qs['sort'](_0x239ee9[_0x3535('0x47')][_0x3535('0x4f')]);_0x179ecc['where']=qs[_0x3535('0x49')](_[_0x3535('0x6b')](_0x239ee9[_0x3535('0x47')],_0x4725aa['filters']));if(_0x239ee9[_0x3535('0x47')][_0x3535('0x51')]){_0x179ecc[_0x3535('0x50')]=_[_0x3535('0x52')](_0x179ecc[_0x3535('0x50')],{'$or':_['map'](_0x179ecc[_0x3535('0x4b')],function(_0x103a61){var _0x2825cd={};_0x2825cd[_0x103a61]={'$like':'%'+_0x239ee9['query'][_0x3535('0x51')]+'%'};return _0x2825cd;})});}_0x179ecc=_[_0x3535('0x52')]({},_0x179ecc,_0x239ee9[_0x3535('0x54')]);return _0x57e89e[_0x3535('0xbd')](_0x179ecc);}})[_0x3535('0x20')](function(_0x10292d){if(_0x10292d){_0x102d93=_0x10292d[_0x3535('0x5c')];if(!_0x239ee9[_0x3535('0x47')][_0x3535('0x6a')](_0x3535('0x4d'))){_0x179ecc['limit']=qs[_0x3535('0x31')](_0x239ee9['query']['limit']);_0x179ecc['offset']=qs[_0x3535('0x2f')](_0x239ee9[_0x3535('0x47')]['offset']);}return _0x57e89e[_0x3535('0xbd')](_0x179ecc);}})['then'](function(_0x1a7b51){if(_0x1a7b51){return _0x1a7b51?{'count':_0x102d93,'rows':_0x1a7b51}:null;}})['then'](respondWithResult(_0x3eee83,null))['catch'](handleError(_0x3eee83,null));};exports[_0x3535('0x3e')]=function(_0x123e3e,_0x563d94,_0x2c4815){var _0x28a971,_0x560243,_0x5e04eb;if(_[_0x3535('0x7d')](_0x123e3e[_0x3535('0x5f')][_0x3535('0x5f')])||_0x123e3e[_0x3535('0x5f')][_0x3535('0x5f')]===''){throw new db[(_0x3535('0x76'))][(_0x3535('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3535('0x7d')](_0x123e3e[_0x3535('0x5f')]['to'])){}_0x28a971=_0x123e3e[_0x3535('0x5f')]['to'];return db['OpenchannelAccount'][_0x3535('0x68')]({'where':{'id':_0x123e3e[_0x3535('0x5a')]['id']}})[_0x3535('0x20')](handleEntityNotFound(_0x563d94,null))['then'](function(_0x45a32c){if(_0x45a32c){return db[_0x3535('0x55')]['find']({'where':{'id':_0x45a32c['id']},'include':[{'model':db[_0x3535('0x84')],'as':_0x3535('0x85'),'include':[{'model':db[_0x3535('0x74')],'as':_0x3535('0x86'),'where':{[_0x45a32c[_0x3535('0x80')]]:_0x28a971},'limit':0x1,'order':[[_0x3535('0x7a'),_0x3535('0x87')]]}]}]})[_0x3535('0x20')](handleEntityNotFound(_0x563d94,null))[_0x3535('0x20')](function(_0x14c798){if(_0x14c798&&_0x14c798[_0x3535('0x85')]){_0x560243=_0x14c798[_0x3535('0x39')]({'plain':!![]});if(_0x560243[_0x3535('0x85')]&&_0x560243[_0x3535('0x85')][_0x3535('0x86')][_0x3535('0x5c')]){return _0x560243[_0x3535('0x85')][_0x3535('0x86')][0x0];}return db[_0x3535('0x74')]['create'](_[_0x3535('0x19')](_0x123e3e[_0x3535('0x5f')],{'firstName':_0x28a971,[_0x14c798['mapKey']]:_0x28a971,'phone':_0x28a971,'ListId':_0x560243[_0x3535('0xbe')]}));}})[_0x3535('0x20')](handleEntityNotFound(_0x563d94,null))[_0x3535('0x20')](function(_0x264817){if(_0x264817){_0x5e04eb=_0x264817;return db['OpenchannelInteraction'][_0x3535('0x5d')]({'where':{'ContactId':_0x5e04eb['id'],'closed':![],'OpenchannelAccountId':_0x560243['id']}})[_0x3535('0x20')](function(_0x1012fe){if(_0x1012fe){return[_0x1012fe,![]];}return db['OpenchannelInteraction'][_0x3535('0x5e')]({'UserId':_0x123e3e[_0x3535('0x60')]['id'],'ContactId':_0x5e04eb['id'],'OpenchannelAccountId':_0x560243['id'],'lastMsgDirection':_0x3535('0xbf'),'firstMsgDirection':_0x3535('0xbf'),'Messages':[_[_0x3535('0x52')](_0x123e3e[_0x3535('0x5f')],{'read':![],'body':_0x123e3e[_0x3535('0x5f')][_0x3535('0x5f')],'OpenchannelAccountId':_0x560243['id'],'UserId':_0x123e3e[_0x3535('0x60')]['id'],'ContactId':_0x5e04eb['id']})]},{'include':[{'model':db[_0x3535('0x9f')],'as':_0x3535('0xc0')}]})[_0x3535('0x20')](function(_0x54e0f3){return[_0x54e0f3,!![]];});});}})[_0x3535('0x96')](function(_0x15152e,_0x32d2c6){if(_0x32d2c6){return _0x15152e;}return db[_0x3535('0x9f')]['create'](_[_0x3535('0x52')](_0x123e3e[_0x3535('0x5f')],{'read':![],'body':_0x123e3e[_0x3535('0x5f')][_0x3535('0x5f')],'OpenchannelAccountId':_0x560243['id'],'OpenchannelInteractionId':_0x15152e['id'],'UserId':_0x123e3e[_0x3535('0x60')]['id'],'ContactId':_0x5e04eb['id']}))[_0x3535('0x20')](function(_0x2a6095){_0x15152e[_0x3535('0xc1')][_0x3535('0xc0')]=[];_0x15152e['dataValues'][_0x3535('0xc0')]['push'](_0x2a6095['dataValues']);return _0x15152e;});});}})[_0x3535('0x20')](respondWithResult(_0x563d94,null))[_0x3535('0x2a')](handleError(_0x563d94,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 70fa0c1..e9563bc 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 _0xda55=['update','remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xda55,0x6d));var _0x5da5=function(_0x16f475,_0x22b4b4){_0x16f475=_0x16f475-0x0;var _0x53372e=_0xda55[_0x16f475];return _0x53372e;};'use strict';var EventEmitter=require(_0x5da5('0x0'));var OpenchannelAccount=require(_0x5da5('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5da5('0x2'),'afterUpdate':_0x5da5('0x3'),'afterDestroy':_0x5da5('0x4')};function emitEvent(_0x50cf9f){return function(_0x1c3afd,_0x5da254,_0x3400e9){OpenchannelAccountEvents['emit'](_0x50cf9f+':'+_0x1c3afd['id'],_0x1c3afd);OpenchannelAccountEvents[_0x5da5('0x5')](_0x50cf9f,_0x1c3afd);_0x3400e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x5da5('0x6')](e,emitEvent(event));}}module[_0x5da5('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x1be1=['OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x1cb711,_0x3a63fe){var _0x9aa87d=function(_0x48ed39){while(--_0x48ed39){_0x1cb711['push'](_0x1cb711['shift']());}};_0x9aa87d(++_0x3a63fe);}(_0x1be1,0x192));var _0x11be=function(_0x3cf529,_0x4c0b38){_0x3cf529=_0x3cf529-0x0;var _0x35fad9=_0x1be1[_0x3cf529];return _0x35fad9;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x11be('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x11be('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11be('0x2'),'afterDestroy':_0x11be('0x3')};function emitEvent(_0x200b2a){return function(_0x318d41,_0x504d3a,_0x3ce56d){OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a+':'+_0x318d41['id'],_0x318d41);OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a,_0x318d41);_0x3ce56d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x11be('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 3618cc5..48b3928 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(_0x5765de,_0x4966f3){var _0x76fc79=function(_0x2687d0){while(--_0x2687d0){_0x5765de['push'](_0x5765de['shift']());}};_0x76fc79(++_0x4966f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x254ea1,_0x236bdd){var _0x27e390=function(_0x1a823f){while(--_0x1a823f){_0x254ea1['push'](_0x254ea1['shift']());}};_0x27e390(++_0x236bdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 49e4d6e..afc8cdd 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 _0x765e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x765e,0x131));var _0xe765=function(_0x28693e,_0xcdbedf){_0x28693e=_0x28693e-0x0;var _0x32b0bf=_0x765e[_0x28693e];return _0x32b0bf;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var moment=require(_0xe765('0x2'));var BPromise=require(_0xe765('0x3'));var rs=require(_0xe765('0x4'));var fs=require('fs');var Redis=require(_0xe765('0x5'));var db=require(_0xe765('0x6'))['db'];var utils=require(_0xe765('0x7'));var logger=require(_0xe765('0x8'))(_0xe765('0x9'));var config=require(_0xe765('0xa'));var jayson=require(_0xe765('0xb'));var client=jayson[_0xe765('0xc')][_0xe765('0xd')]({'port':0x232a});config[_0xe765('0xe')]=_['defaults'](config[_0xe765('0xe')],{'host':_0xe765('0xf'),'port':0x18eb});var socket=require(_0xe765('0x10'))(new Redis(config[_0xe765('0xe')]));require(_0xe765('0x11'))[_0xe765('0x12')](socket);function respondWithRpcPromise(_0x89a285,_0x53b110,_0x42953c){return new BPromise(function(_0x37db1b,_0x31114a){return client['request'](_0x89a285,_0x42953c)[_0xe765('0x13')](function(_0x57edaf){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x53b110,_0xe765('0x14'));logger[_0xe765('0x15')](_0xe765('0x16'),_0x53b110,_0xe765('0x14'),JSON[_0xe765('0x17')](_0x57edaf));if(_0x57edaf['error']){if(_0x57edaf[_0xe765('0x18')][_0xe765('0x19')]===0x1f4){logger[_0xe765('0x18')](_0xe765('0x1a'),_0x53b110,_0x57edaf[_0xe765('0x18')]['message']);return _0x31114a(_0x57edaf['error'][_0xe765('0x1b')]);}logger[_0xe765('0x18')](_0xe765('0x1a'),_0x53b110,_0x57edaf['error'][_0xe765('0x1b')]);return _0x37db1b(_0x57edaf[_0xe765('0x18')][_0xe765('0x1b')]);}else{logger[_0xe765('0x1c')](_0xe765('0x1a'),_0x53b110,_0xe765('0x14'));_0x37db1b(_0x57edaf[_0xe765('0x1d')][_0xe765('0x1b')]);}})[_0xe765('0x1e')](function(_0x57fb61){logger[_0xe765('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x53b110,_0x57fb61);_0x31114a(_0x57fb61);});});} \ No newline at end of file +var _0x1752=['client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x414a4e,_0x181824){var _0x13025f=function(_0x395d93){while(--_0x395d93){_0x414a4e['push'](_0x414a4e['shift']());}};_0x13025f(++_0x181824);}(_0x1752,0xa5));var _0x2175=function(_0xe179d5,_0x336fff){_0xe179d5=_0xe179d5-0x0;var _0x1912d0=_0x1752[_0xe179d5];return _0x1912d0;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var moment=require(_0x2175('0x1'));var BPromise=require(_0x2175('0x2'));var rs=require(_0x2175('0x3'));var fs=require('fs');var Redis=require(_0x2175('0x4'));var db=require(_0x2175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2175('0x6'))(_0x2175('0x7'));var config=require(_0x2175('0x8'));var jayson=require(_0x2175('0x9'));var client=jayson[_0x2175('0xa')][_0x2175('0xb')]({'port':0x232a});config[_0x2175('0xc')]=_[_0x2175('0xd')](config[_0x2175('0xc')],{'host':_0x2175('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2175('0xc')]));require(_0x2175('0xf'))[_0x2175('0x10')](socket);function respondWithRpcPromise(_0x455803,_0x77e3fa,_0x4be8c8){return new BPromise(function(_0x5ad5ad,_0x5717b0){return client[_0x2175('0x11')](_0x455803,_0x4be8c8)['then'](function(_0x5e275f){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x77e3fa,_0x2175('0x12'));logger['debug'](_0x2175('0x13'),_0x77e3fa,_0x2175('0x12'),JSON['stringify'](_0x5e275f));if(_0x5e275f[_0x2175('0x14')]){if(_0x5e275f[_0x2175('0x14')][_0x2175('0x15')]===0x1f4){logger[_0x2175('0x14')](_0x2175('0x16'),_0x77e3fa,_0x5e275f[_0x2175('0x14')][_0x2175('0x17')]);return _0x5717b0(_0x5e275f[_0x2175('0x14')]['message']);}logger['error'](_0x2175('0x16'),_0x77e3fa,_0x5e275f[_0x2175('0x14')][_0x2175('0x17')]);return _0x5ad5ad(_0x5e275f['error']['message']);}else{logger['info'](_0x2175('0x16'),_0x77e3fa,_0x2175('0x12'));_0x5ad5ad(_0x5e275f['result']['message']);}})[_0x2175('0x18')](function(_0x3d6467){logger[_0x2175('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x77e3fa,_0x3d6467);_0x5717b0(_0x3d6467);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 9751f70..13eaa0a 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 _0xa37e=['openchannelAccount:','remove','update','emit','removeListener','register'];(function(_0x56fbd4,_0x2f6661){var _0x545ada=function(_0x527666){while(--_0x527666){_0x56fbd4['push'](_0x56fbd4['shift']());}};_0x545ada(++_0x2f6661);}(_0xa37e,0x97));var _0xea37=function(_0x43de36,_0x25147e){_0x43de36=_0x43de36-0x0;var _0x2c34fe=_0xa37e[_0x43de36];return _0x2c34fe;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0xea37('0x0'),_0xea37('0x1')];function createListener(_0x204a22,_0x475c71){return function(_0x5430aa){_0x475c71[_0xea37('0x2')](_0x204a22,_0x5430aa);};}function removeListener(_0x537c5a,_0x360ed5){return function(){OpenchannelAccountEvents[_0xea37('0x3')](_0x537c5a,_0x360ed5);};}exports[_0xea37('0x4')]=function(_0x4d380b){for(var _0x57135b=0x0,_0x36c489=events['length'];_0x57135b<_0x36c489;_0x57135b++){var _0x4ae081=events[_0x57135b];var _0x2c2890=createListener(_0xea37('0x5')+_0x4ae081,_0x4d380b);OpenchannelAccountEvents['on'](_0x4ae081,_0x2c2890);}}; \ No newline at end of file +var _0xf996=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove','emit'];(function(_0x35ddf6,_0x3764af){var _0x303da0=function(_0x5df8ec){while(--_0x5df8ec){_0x35ddf6['push'](_0x35ddf6['shift']());}};_0x303da0(++_0x3764af);}(_0xf996,0x74));var _0x6f99=function(_0x129071,_0x360dba){_0x129071=_0x129071-0x0;var _0x4edaab=_0xf996[_0x129071];return _0x4edaab;};'use strict';var OpenchannelAccountEvents=require(_0x6f99('0x0'));var events=[_0x6f99('0x1'),_0x6f99('0x2'),'update'];function createListener(_0x12ac12,_0x56fd3f){return function(_0x5ceb57){_0x56fd3f[_0x6f99('0x3')](_0x12ac12,_0x5ceb57);};}function removeListener(_0xa0b3d7,_0x274f12){return function(){OpenchannelAccountEvents[_0x6f99('0x4')](_0xa0b3d7,_0x274f12);};}exports[_0x6f99('0x5')]=function(_0xf2b5ee){for(var _0xa07ac1=0x0,_0x2883cb=events[_0x6f99('0x6')];_0xa07ac1<_0x2883cb;_0xa07ac1++){var _0x1e4805=events[_0xa07ac1];var _0x5d8b7f=createListener(_0x6f99('0x7')+_0x1e4805,_0xf2b5ee);OpenchannelAccountEvents['on'](_0x1e4805,_0x5d8b7f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 472945d..66808eb 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 _0x5416=['update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create'];(function(_0x3b5a15,_0x13a661){var _0x119ee9=function(_0x476fde){while(--_0x476fde){_0x3b5a15['push'](_0x3b5a15['shift']());}};_0x119ee9(++_0x13a661);}(_0x5416,0x101));var _0x6541=function(_0x5e2b34,_0x58385c){_0x5e2b34=_0x5e2b34-0x0;var _0x4859f9=_0x5416[_0x5e2b34];return _0x4859f9;};'use strict';var multer=require(_0x6541('0x0'));var util=require(_0x6541('0x1'));var path=require(_0x6541('0x2'));var timeout=require(_0x6541('0x3'));var express=require('express');var router=express[_0x6541('0x4')]();var fs_extra=require(_0x6541('0x5'));var auth=require(_0x6541('0x6'));var interaction=require(_0x6541('0x7'));var config=require('../../config/environment');var controller=require(_0x6541('0x8'));router[_0x6541('0x9')]('/',auth[_0x6541('0xa')](),controller[_0x6541('0xb')]);router['get']('/:id',auth[_0x6541('0xa')](),controller[_0x6541('0xc')]);router[_0x6541('0xd')]('/',auth[_0x6541('0xa')](),controller[_0x6541('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6541('0xf')]);router[_0x6541('0x10')]('/:id',auth[_0x6541('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x720e=['util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','isAuthenticated','get','/:id','show','create','update','destroy','exports','multer'];(function(_0x3adda1,_0x516a63){var _0x28c863=function(_0x4d5fbf){while(--_0x4d5fbf){_0x3adda1['push'](_0x3adda1['shift']());}};_0x28c863(++_0x516a63);}(_0x720e,0x158));var _0xe720=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0x720e[_0x120bc2];return _0x454a41;};'use strict';var multer=require(_0xe720('0x0'));var util=require(_0xe720('0x1'));var path=require(_0xe720('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe720('0x3'));var auth=require(_0xe720('0x4'));var interaction=require(_0xe720('0x5'));var config=require('../../config/environment');var controller=require(_0xe720('0x6'));router['get']('/',auth[_0xe720('0x7')](),controller['index']);router[_0xe720('0x8')](_0xe720('0x9'),auth[_0xe720('0x7')](),controller[_0xe720('0xa')]);router['post']('/',auth[_0xe720('0x7')](),controller[_0xe720('0xb')]);router['put'](_0xe720('0x9'),auth[_0xe720('0x7')](),controller[_0xe720('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe720('0xd')]);module[_0xe720('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 8ad2182..dc4f551 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 _0x13bf=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0xaeb7b7,_0x5f3512){var _0x4b8a7e=function(_0x51bba5){while(--_0x51bba5){_0xaeb7b7['push'](_0xaeb7b7['shift']());}};_0x4b8a7e(++_0x5f3512);}(_0x13bf,0x1ae));var _0xf13b=function(_0x618bfb,_0x3ba7f0){_0x618bfb=_0x618bfb-0x0;var _0x39760c=_0x13bf[_0x618bfb];return _0x39760c;};'use strict';var Sequelize=require(_0xf13b('0x0'));module[_0xf13b('0x1')]={'priority':{'type':Sequelize[_0xf13b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf13b('0x3')],'allowNull':![],'defaultValue':_0xf13b('0x4')},'appdata':{'type':Sequelize[_0xf13b('0x5')]()},'description':{'type':Sequelize[_0xf13b('0x3')]},'interval':{'type':Sequelize[_0xf13b('0x3')],'defaultValue':_0xf13b('0x6')}}; \ No newline at end of file +var _0xc118=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x15efac,_0x6f493e){var _0x14f63c=function(_0x2431af){while(--_0x2431af){_0x15efac['push'](_0x15efac['shift']());}};_0x14f63c(++_0x6f493e);}(_0xc118,0x12a));var _0x8c11=function(_0x2fbaf9,_0x20dfb0){_0x2fbaf9=_0x2fbaf9-0x0;var _0x209449=_0xc118[_0x2fbaf9];return _0x209449;};'use strict';var Sequelize=require(_0x8c11('0x0'));module[_0x8c11('0x1')]={'priority':{'type':Sequelize[_0x8c11('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8c11('0x3')],'allowNull':![],'defaultValue':_0x8c11('0x4')},'appdata':{'type':Sequelize[_0x8c11('0x5')]()},'description':{'type':Sequelize[_0x8c11('0x3')]},'interval':{'type':Sequelize[_0x8c11('0x3')],'defaultValue':_0x8c11('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d663558..d1d48f1 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 _0x39c7=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','intersection','find','create','body','params','catch','destroy','eml-format'];(function(_0x471268,_0x5ce885){var _0x1298f3=function(_0x3f5110){while(--_0x3f5110){_0x471268['push'](_0x471268['shift']());}};_0x1298f3(++_0x5ce885);}(_0x39c7,0xe9));var _0x739c=function(_0xbbb6ff,_0x5b9ef8){_0xbbb6ff=_0xbbb6ff-0x0;var _0x5eb766=_0x39c7[_0xbbb6ff];return _0x5eb766;};'use strict';var emlformat=require(_0x739c('0x0'));var rimraf=require(_0x739c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x739c('0x2'));var rp=require(_0x739c('0x3'));var moment=require(_0x739c('0x4'));var BPromise=require(_0x739c('0x5'));var Mustache=require(_0x739c('0x6'));var util=require(_0x739c('0x7'));var path=require(_0x739c('0x8'));var sox=require(_0x739c('0x9'));var csv=require(_0x739c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x739c('0xb'));var _=require(_0x739c('0xc'));var squel=require(_0x739c('0xd'));var crypto=require(_0x739c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x739c('0xf'));var toCsv=require(_0x739c('0xa'));var querystring=require(_0x739c('0x10'));var Papa=require(_0x739c('0x11'));var Redis=require(_0x739c('0x12'));var authService=require(_0x739c('0x13'));var qs=require(_0x739c('0x14'));var as=require(_0x739c('0x15'));var hardwareService=require(_0x739c('0x16'));var logger=require(_0x739c('0x17'))('api');var utils=require(_0x739c('0x18'));var config=require(_0x739c('0x19'));var licenseUtil=require(_0x739c('0x1a'));var db=require(_0x739c('0x1b'))['db'];function respondWithStatusCode(_0x3003cd,_0x51724d){_0x51724d=_0x51724d||0xcc;return function(_0x499004){if(_0x499004){return _0x3003cd[_0x739c('0x1c')](_0x51724d);}return _0x3003cd[_0x739c('0x1d')](_0x51724d)[_0x739c('0x1e')]();};}function respondWithResult(_0x1888f7,_0x39d609){_0x39d609=_0x39d609||0xc8;return function(_0x1ca9f6){if(_0x1ca9f6){return _0x1888f7['status'](_0x39d609)[_0x739c('0x1f')](_0x1ca9f6);}};}function respondWithFilteredResult(_0x5c4b42,_0x5dda4a){return function(_0x442bda){if(_0x442bda){var _0x19072b=typeof _0x5dda4a[_0x739c('0x20')]==='undefined'&&typeof _0x5dda4a[_0x739c('0x21')]===_0x739c('0x22');var _0x2276dc=_0x442bda[_0x739c('0x23')];var _0x54fef1=_0x19072b?0x0:_0x5dda4a[_0x739c('0x20')];var _0x278719=_0x19072b?_0x442bda[_0x739c('0x23')]:_0x5dda4a[_0x739c('0x20')]+_0x5dda4a[_0x739c('0x21')];var _0x3e8c34;if(_0x278719>=_0x2276dc){_0x278719=_0x2276dc;_0x3e8c34=0xc8;}else{_0x3e8c34=0xce;}_0x5c4b42[_0x739c('0x1d')](_0x3e8c34);return _0x5c4b42[_0x739c('0x24')](_0x739c('0x25'),_0x54fef1+'-'+_0x278719+'/'+_0x2276dc)[_0x739c('0x1f')](_0x442bda);}return null;};}function patchUpdates(_0x31d722){return function(_0x3487ac){try{jsonpatch[_0x739c('0x26')](_0x3487ac,_0x31d722,!![]);}catch(_0x340309){return BPromise[_0x739c('0x27')](_0x340309);}return _0x3487ac['save']();};}function saveUpdates(_0x11ad24,_0x1ecf78){return function(_0x10bb42){if(_0x10bb42){return _0x10bb42[_0x739c('0x28')](_0x11ad24)[_0x739c('0x29')](function(_0xfbb35e){return _0xfbb35e;});}return null;};}function removeEntity(_0x39ac42,_0x2e3916){return function(_0x2ca016){if(_0x2ca016){return _0x2ca016['destroy']()[_0x739c('0x29')](function(){_0x39ac42['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x767212,_0x44b78d){return function(_0x5274a9){if(!_0x5274a9){_0x767212['sendStatus'](0x194);}return _0x5274a9;};}function handleError(_0xc04d5b,_0x27bd35){_0x27bd35=_0x27bd35||0x1f4;return function(_0x21a701){logger['error'](_0x21a701[_0x739c('0x2a')]);if(_0x21a701[_0x739c('0x2b')]){delete _0x21a701['name'];}_0xc04d5b[_0x739c('0x1d')](_0x27bd35)[_0x739c('0x2c')](_0x21a701);};}exports[_0x739c('0x2d')]=function(_0x3c1615,_0x167d89){var _0x3aa6c4={},_0x555be6={},_0x414a21={'count':0x0,'rows':[]};var _0x1d2d60=_['map'](db[_0x739c('0x2e')][_0x739c('0x2f')],function(_0x1edbb1){return{'name':_0x1edbb1[_0x739c('0x30')],'type':_0x1edbb1[_0x739c('0x31')]['key']};});_0x555be6[_0x739c('0x32')]=_['map'](_0x1d2d60,'name');_0x555be6[_0x739c('0x33')]=_[_0x739c('0x34')](_0x3c1615[_0x739c('0x33')]);_0x555be6[_0x739c('0x35')]=_['intersection'](_0x555be6[_0x739c('0x32')],_0x555be6[_0x739c('0x33')]);_0x3aa6c4['attributes']=_['intersection'](_0x555be6[_0x739c('0x32')],qs['fields'](_0x3c1615[_0x739c('0x33')][_0x739c('0x36')]));_0x3aa6c4[_0x739c('0x37')]=_0x3aa6c4[_0x739c('0x37')][_0x739c('0x38')]?_0x3aa6c4[_0x739c('0x37')]:_0x555be6[_0x739c('0x32')];if(!_0x3c1615[_0x739c('0x33')][_0x739c('0x39')]('nolimit')){_0x3aa6c4[_0x739c('0x21')]=qs[_0x739c('0x21')](_0x3c1615[_0x739c('0x33')]['limit']);_0x3aa6c4[_0x739c('0x20')]=qs['offset'](_0x3c1615[_0x739c('0x33')][_0x739c('0x20')]);}_0x3aa6c4[_0x739c('0x3a')]=qs[_0x739c('0x3b')](_0x3c1615[_0x739c('0x33')][_0x739c('0x3b')]);_0x3aa6c4[_0x739c('0x3c')]=qs[_0x739c('0x35')](_[_0x739c('0x3d')](_0x3c1615[_0x739c('0x33')],_0x555be6[_0x739c('0x35')]),_0x1d2d60);if(_0x3c1615[_0x739c('0x33')][_0x739c('0x3e')]){_0x3aa6c4[_0x739c('0x3c')]=_[_0x739c('0x3f')](_0x3aa6c4[_0x739c('0x3c')],{'$or':_[_0x739c('0x40')](_0x1d2d60,function(_0x4b4b77){if(_0x4b4b77[_0x739c('0x31')]!==_0x739c('0x41')){var _0x2d7846={};_0x2d7846[_0x4b4b77[_0x739c('0x2b')]]={'$like':'%'+_0x3c1615[_0x739c('0x33')][_0x739c('0x3e')]+'%'};return _0x2d7846;}})});}_0x3aa6c4=_[_0x739c('0x3f')]({},_0x3aa6c4,_0x3c1615[_0x739c('0x42')]);var _0x9b3e63={'where':_0x3aa6c4[_0x739c('0x3c')]};return db['OpenchannelApplication'][_0x739c('0x23')](_0x9b3e63)[_0x739c('0x29')](function(_0x377b02){_0x414a21['count']=_0x377b02;if(_0x3c1615[_0x739c('0x33')][_0x739c('0x43')]){_0x3aa6c4[_0x739c('0x44')]=[{'all':!![]}];}return db[_0x739c('0x2e')]['findAll'](_0x3aa6c4);})[_0x739c('0x29')](function(_0x1800a6){_0x414a21[_0x739c('0x45')]=_0x1800a6;return _0x414a21;})[_0x739c('0x29')](respondWithFilteredResult(_0x167d89,_0x3aa6c4))['catch'](handleError(_0x167d89,null));};exports[_0x739c('0x46')]=function(_0x3c946c,_0x1b08a7){var _0x169513={'raw':!![],'where':{'id':_0x3c946c['params']['id']}},_0x11e4c0={};_0x11e4c0[_0x739c('0x32')]=_[_0x739c('0x34')](db[_0x739c('0x2e')][_0x739c('0x2f')]);_0x11e4c0['query']=_[_0x739c('0x34')](_0x3c946c[_0x739c('0x33')]);_0x11e4c0[_0x739c('0x35')]=_[_0x739c('0x47')](_0x11e4c0[_0x739c('0x32')],_0x11e4c0[_0x739c('0x33')]);_0x169513[_0x739c('0x37')]=_[_0x739c('0x47')](_0x11e4c0[_0x739c('0x32')],qs[_0x739c('0x36')](_0x3c946c[_0x739c('0x33')][_0x739c('0x36')]));_0x169513[_0x739c('0x37')]=_0x169513[_0x739c('0x37')][_0x739c('0x38')]?_0x169513['attributes']:_0x11e4c0[_0x739c('0x32')];if(_0x3c946c[_0x739c('0x33')][_0x739c('0x43')]){_0x169513[_0x739c('0x44')]=[{'all':!![]}];}_0x169513=_[_0x739c('0x3f')]({},_0x169513,_0x3c946c['options']);return db[_0x739c('0x2e')][_0x739c('0x48')](_0x169513)[_0x739c('0x29')](handleEntityNotFound(_0x1b08a7,null))[_0x739c('0x29')](respondWithResult(_0x1b08a7,null))['catch'](handleError(_0x1b08a7,null));};exports[_0x739c('0x49')]=function(_0x5dfee8,_0x57a609){return db[_0x739c('0x2e')][_0x739c('0x49')](_0x5dfee8[_0x739c('0x4a')],{})[_0x739c('0x29')](respondWithResult(_0x57a609,0xc9))['catch'](handleError(_0x57a609,null));};exports[_0x739c('0x28')]=function(_0x43e9de,_0x3a276e){if(_0x43e9de[_0x739c('0x4a')]['id']){delete _0x43e9de[_0x739c('0x4a')]['id'];}return db[_0x739c('0x2e')]['find']({'where':{'id':_0x43e9de[_0x739c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a276e,null))[_0x739c('0x29')](saveUpdates(_0x43e9de[_0x739c('0x4a')],null))[_0x739c('0x29')](respondWithResult(_0x3a276e,null))[_0x739c('0x4c')](handleError(_0x3a276e,null));};exports[_0x739c('0x4d')]=function(_0x3c0656,_0x58e0ac){return db[_0x739c('0x2e')]['find']({'where':{'id':_0x3c0656[_0x739c('0x4b')]['id']}})[_0x739c('0x29')](handleEntityNotFound(_0x58e0ac,null))[_0x739c('0x29')](removeEntity(_0x58e0ac,null))[_0x739c('0x4c')](handleError(_0x58e0ac,null));}; \ No newline at end of file +var _0x0780=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','OpenchannelApplication','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','status'];(function(_0x1ca506,_0x381af4){var _0x2516a6=function(_0x3b5b29){while(--_0x3b5b29){_0x1ca506['push'](_0x1ca506['shift']());}};_0x2516a6(++_0x381af4);}(_0x0780,0x7a));var _0x0078=function(_0x24fe48,_0x10e97e){_0x24fe48=_0x24fe48-0x0;var _0x51e7d5=_0x0780[_0x24fe48];return _0x51e7d5;};'use strict';var emlformat=require(_0x0078('0x0'));var rimraf=require(_0x0078('0x1'));var zipdir=require(_0x0078('0x2'));var jsonpatch=require(_0x0078('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0078('0x4'));var sox=require(_0x0078('0x5'));var csv=require(_0x0078('0x6'));var ejs=require(_0x0078('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0078('0x8'));var squel=require(_0x0078('0x9'));var crypto=require(_0x0078('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0078('0xb'));var toCsv=require(_0x0078('0x6'));var querystring=require(_0x0078('0xc'));var Papa=require(_0x0078('0xd'));var Redis=require(_0x0078('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0078('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0078('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x0078('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0078('0x12'))['db'];function respondWithStatusCode(_0x1c999f,_0x41dbcf){_0x41dbcf=_0x41dbcf||0xcc;return function(_0x198130){if(_0x198130){return _0x1c999f['sendStatus'](_0x41dbcf);}return _0x1c999f[_0x0078('0x13')](_0x41dbcf)['end']();};}function respondWithResult(_0xeb5ddc,_0x2b78bc){_0x2b78bc=_0x2b78bc||0xc8;return function(_0xfc691c){if(_0xfc691c){return _0xeb5ddc[_0x0078('0x13')](_0x2b78bc)[_0x0078('0x14')](_0xfc691c);}};}function respondWithFilteredResult(_0x508dcb,_0x2b79bf){return function(_0x19ce6c){if(_0x19ce6c){var _0x4c70ec=typeof _0x2b79bf['offset']===_0x0078('0x15')&&typeof _0x2b79bf[_0x0078('0x16')]===_0x0078('0x15');var _0x30e3f5=_0x19ce6c[_0x0078('0x17')];var _0x21e35d=_0x4c70ec?0x0:_0x2b79bf['offset'];var _0xe8ea36=_0x4c70ec?_0x19ce6c[_0x0078('0x17')]:_0x2b79bf[_0x0078('0x18')]+_0x2b79bf['limit'];var _0x587873;if(_0xe8ea36>=_0x30e3f5){_0xe8ea36=_0x30e3f5;_0x587873=0xc8;}else{_0x587873=0xce;}_0x508dcb[_0x0078('0x13')](_0x587873);return _0x508dcb[_0x0078('0x19')](_0x0078('0x1a'),_0x21e35d+'-'+_0xe8ea36+'/'+_0x30e3f5)[_0x0078('0x14')](_0x19ce6c);}return null;};}function patchUpdates(_0x399b6e){return function(_0x3aa5b5){try{jsonpatch[_0x0078('0x1b')](_0x3aa5b5,_0x399b6e,!![]);}catch(_0x3d4466){return BPromise[_0x0078('0x1c')](_0x3d4466);}return _0x3aa5b5[_0x0078('0x1d')]();};}function saveUpdates(_0x18aaca,_0x48d6a8){return function(_0x3b513e){if(_0x3b513e){return _0x3b513e[_0x0078('0x1e')](_0x18aaca)[_0x0078('0x1f')](function(_0x43b670){return _0x43b670;});}return null;};}function removeEntity(_0x9a65c,_0x2e2122){return function(_0x4959ed){if(_0x4959ed){return _0x4959ed[_0x0078('0x20')]()[_0x0078('0x1f')](function(){_0x9a65c[_0x0078('0x13')](0xcc)[_0x0078('0x21')]();});}};}function handleEntityNotFound(_0x1156b8,_0x37a523){return function(_0x49f063){if(!_0x49f063){_0x1156b8['sendStatus'](0x194);}return _0x49f063;};}function handleError(_0xef4eda,_0x44f234){_0x44f234=_0x44f234||0x1f4;return function(_0x35ce06){logger['error'](_0x35ce06[_0x0078('0x22')]);if(_0x35ce06[_0x0078('0x23')]){delete _0x35ce06['name'];}_0xef4eda[_0x0078('0x13')](_0x44f234)[_0x0078('0x24')](_0x35ce06);};}exports[_0x0078('0x25')]=function(_0x10ba8f,_0x26bc60){var _0x2db457={},_0x4d16b6={},_0x1bb54e={'count':0x0,'rows':[]};var _0x4d549e=_[_0x0078('0x26')](db['OpenchannelApplication'][_0x0078('0x27')],function(_0x4e5ec6){return{'name':_0x4e5ec6[_0x0078('0x28')],'type':_0x4e5ec6[_0x0078('0x29')][_0x0078('0x2a')]};});_0x4d16b6[_0x0078('0x2b')]=_[_0x0078('0x26')](_0x4d549e,_0x0078('0x23'));_0x4d16b6[_0x0078('0x2c')]=_[_0x0078('0x2d')](_0x10ba8f['query']);_0x4d16b6['filters']=_[_0x0078('0x2e')](_0x4d16b6['model'],_0x4d16b6[_0x0078('0x2c')]);_0x2db457[_0x0078('0x2f')]=_['intersection'](_0x4d16b6[_0x0078('0x2b')],qs[_0x0078('0x30')](_0x10ba8f[_0x0078('0x2c')][_0x0078('0x30')]));_0x2db457[_0x0078('0x2f')]=_0x2db457[_0x0078('0x2f')][_0x0078('0x31')]?_0x2db457[_0x0078('0x2f')]:_0x4d16b6[_0x0078('0x2b')];if(!_0x10ba8f[_0x0078('0x2c')][_0x0078('0x32')](_0x0078('0x33'))){_0x2db457[_0x0078('0x16')]=qs['limit'](_0x10ba8f[_0x0078('0x2c')][_0x0078('0x16')]);_0x2db457['offset']=qs[_0x0078('0x18')](_0x10ba8f['query'][_0x0078('0x18')]);}_0x2db457['order']=qs[_0x0078('0x34')](_0x10ba8f[_0x0078('0x2c')][_0x0078('0x34')]);_0x2db457['where']=qs[_0x0078('0x35')](_[_0x0078('0x36')](_0x10ba8f['query'],_0x4d16b6[_0x0078('0x35')]),_0x4d549e);if(_0x10ba8f[_0x0078('0x2c')][_0x0078('0x37')]){_0x2db457[_0x0078('0x38')]=_[_0x0078('0x39')](_0x2db457[_0x0078('0x38')],{'$or':_[_0x0078('0x26')](_0x4d549e,function(_0x99ec66){if(_0x99ec66[_0x0078('0x29')]!==_0x0078('0x3a')){var _0x47414b={};_0x47414b[_0x99ec66[_0x0078('0x23')]]={'$like':'%'+_0x10ba8f['query'][_0x0078('0x37')]+'%'};return _0x47414b;}})});}_0x2db457=_[_0x0078('0x39')]({},_0x2db457,_0x10ba8f[_0x0078('0x3b')]);var _0x32ee23={'where':_0x2db457[_0x0078('0x38')]};return db['OpenchannelApplication'][_0x0078('0x17')](_0x32ee23)['then'](function(_0x55778a){_0x1bb54e[_0x0078('0x17')]=_0x55778a;if(_0x10ba8f['query'][_0x0078('0x3c')]){_0x2db457[_0x0078('0x3d')]=[{'all':!![]}];}return db[_0x0078('0x3e')][_0x0078('0x3f')](_0x2db457);})[_0x0078('0x1f')](function(_0x1b21c4){_0x1bb54e[_0x0078('0x40')]=_0x1b21c4;return _0x1bb54e;})[_0x0078('0x1f')](respondWithFilteredResult(_0x26bc60,_0x2db457))[_0x0078('0x41')](handleError(_0x26bc60,null));};exports[_0x0078('0x42')]=function(_0x3a22aa,_0x9afe05){var _0x52d38a={'raw':!![],'where':{'id':_0x3a22aa[_0x0078('0x43')]['id']}},_0x177108={};_0x177108['model']=_[_0x0078('0x2d')](db[_0x0078('0x3e')][_0x0078('0x27')]);_0x177108[_0x0078('0x2c')]=_[_0x0078('0x2d')](_0x3a22aa['query']);_0x177108[_0x0078('0x35')]=_[_0x0078('0x2e')](_0x177108[_0x0078('0x2b')],_0x177108[_0x0078('0x2c')]);_0x52d38a[_0x0078('0x2f')]=_[_0x0078('0x2e')](_0x177108[_0x0078('0x2b')],qs['fields'](_0x3a22aa['query'][_0x0078('0x30')]));_0x52d38a['attributes']=_0x52d38a[_0x0078('0x2f')][_0x0078('0x31')]?_0x52d38a[_0x0078('0x2f')]:_0x177108[_0x0078('0x2b')];if(_0x3a22aa[_0x0078('0x2c')][_0x0078('0x3c')]){_0x52d38a[_0x0078('0x3d')]=[{'all':!![]}];}_0x52d38a=_[_0x0078('0x39')]({},_0x52d38a,_0x3a22aa['options']);return db[_0x0078('0x3e')]['find'](_0x52d38a)[_0x0078('0x1f')](handleEntityNotFound(_0x9afe05,null))['then'](respondWithResult(_0x9afe05,null))[_0x0078('0x41')](handleError(_0x9afe05,null));};exports['create']=function(_0xfdbfd7,_0x27d037){return db[_0x0078('0x3e')][_0x0078('0x44')](_0xfdbfd7['body'],{})['then'](respondWithResult(_0x27d037,0xc9))[_0x0078('0x41')](handleError(_0x27d037,null));};exports[_0x0078('0x1e')]=function(_0x563114,_0x6e997f){if(_0x563114['body']['id']){delete _0x563114[_0x0078('0x45')]['id'];}return db['OpenchannelApplication'][_0x0078('0x46')]({'where':{'id':_0x563114[_0x0078('0x43')]['id']}})['then'](handleEntityNotFound(_0x6e997f,null))[_0x0078('0x1f')](saveUpdates(_0x563114[_0x0078('0x45')],null))['then'](respondWithResult(_0x6e997f,null))['catch'](handleError(_0x6e997f,null));};exports['destroy']=function(_0x517f31,_0xaff61){return db['OpenchannelApplication']['find']({'where':{'id':_0x517f31[_0x0078('0x43')]['id']}})[_0x0078('0x1f')](handleEntityNotFound(_0xaff61,null))[_0x0078('0x1f')](removeEntity(_0xaff61,null))[_0x0078('0x41')](handleError(_0xaff61,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 99cc09d..171d09d 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 _0xdb1f=['exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./openchannelApplication.attributes'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0xdb1f,0x70));var _0xfdb1=function(_0x27f6f1,_0x4b7b19){_0x27f6f1=_0x27f6f1-0x0;var _0x51fd31=_0xdb1f[_0x27f6f1];return _0x51fd31;};'use strict';var _=require(_0xfdb1('0x0'));var util=require(_0xfdb1('0x1'));var logger=require(_0xfdb1('0x2'))(_0xfdb1('0x3'));var moment=require(_0xfdb1('0x4'));var BPromise=require(_0xfdb1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfdb1('0x6'));var attributes=require(_0xfdb1('0x7'));module[_0xfdb1('0x8')]=function(_0x2a05e4,_0x5b91a3){return _0x2a05e4[_0xfdb1('0x9')](_0xfdb1('0xa'),attributes,{'tableName':_0xfdb1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdeab=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x2da95d,_0xf7b8dc){var _0x364121=function(_0x13f978){while(--_0x13f978){_0x2da95d['push'](_0x2da95d['shift']());}};_0x364121(++_0xf7b8dc);}(_0xdeab,0x98));var _0xbdea=function(_0x5233e5,_0x4e1b19){_0x5233e5=_0x5233e5-0x0;var _0x2a6caf=_0xdeab[_0x5233e5];return _0x2a6caf;};'use strict';var _=require(_0xbdea('0x0'));var util=require(_0xbdea('0x1'));var logger=require(_0xbdea('0x2'))(_0xbdea('0x3'));var moment=require('moment');var BPromise=require(_0xbdea('0x4'));var rp=require(_0xbdea('0x5'));var fs=require('fs');var path=require(_0xbdea('0x6'));var rimraf=require('rimraf');var config=require(_0xbdea('0x7'));var attributes=require(_0xbdea('0x8'));module[_0xbdea('0x9')]=function(_0x530a4b,_0x574ff3){return _0x530a4b[_0xbdea('0xa')](_0xbdea('0xb'),attributes,{'tableName':_0xbdea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbdea('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 7da3ff8..212aa9c 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 _0xed0c=['rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','lodash','util','bluebird','../../mysqldb','../../config/logger'];(function(_0x384ead,_0x296dec){var _0x50b15c=function(_0xdffd32){while(--_0xdffd32){_0x384ead['push'](_0x384ead['shift']());}};_0x50b15c(++_0x296dec);}(_0xed0c,0x175));var _0xced0=function(_0x4dd580,_0xadaefc){_0x4dd580=_0x4dd580-0x0;var _0x3380d1=_0xed0c[_0x4dd580];return _0x3380d1;};'use strict';var _=require(_0xced0('0x0'));var util=require(_0xced0('0x1'));var moment=require('moment');var BPromise=require(_0xced0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xced0('0x4'))(_0xced0('0x5'));var config=require(_0xced0('0x6'));var jayson=require(_0xced0('0x7'));var client=jayson[_0xced0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x597c1d,_0x3f465b,_0xc70968){return new BPromise(function(_0x41b888,_0x515caa){return client[_0xced0('0x9')](_0x597c1d,_0xc70968)[_0xced0('0xa')](function(_0x2b5220){logger[_0xced0('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x3f465b,_0xced0('0xc'));logger[_0xced0('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x3f465b,_0xced0('0xc'),JSON[_0xced0('0xe')](_0x2b5220));if(_0x2b5220[_0xced0('0xf')]){if(_0x2b5220[_0xced0('0xf')]['code']===0x1f4){logger[_0xced0('0xf')](_0xced0('0x10'),_0x3f465b,_0x2b5220[_0xced0('0xf')]['message']);return _0x515caa(_0x2b5220['error']['message']);}logger['error'](_0xced0('0x10'),_0x3f465b,_0x2b5220[_0xced0('0xf')][_0xced0('0x11')]);return _0x41b888(_0x2b5220[_0xced0('0xf')][_0xced0('0x11')]);}else{logger['info'](_0xced0('0x10'),_0x3f465b,_0xced0('0xc'));_0x41b888(_0x2b5220['result'][_0xced0('0x11')]);}})[_0xced0('0x12')](function(_0x157fd2){logger[_0xced0('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x3f465b,_0x157fd2);_0x515caa(_0x157fd2);});});}exports[_0xced0('0x13')]=function(_0x32e468){var _0x1ab3aa=this;return new Promise(function(_0x4795ac,_0x15797f){return db[_0xced0('0x14')][_0xced0('0x15')](_0x32e468[_0xced0('0x16')],{'raw':_0x32e468[_0xced0('0x17')]?_0x32e468[_0xced0('0x17')][_0xced0('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e468[_0xced0('0x17')]?_0x32e468[_0xced0('0x17')]['where']||null:null,'attributes':_0x32e468['options']?_0x32e468['options'][_0xced0('0x19')]||null:null,'limit':_0x32e468[_0xced0('0x17')]?_0x32e468[_0xced0('0x17')][_0xced0('0x1a')]||null:null})[_0xced0('0xa')](function(_0x23930e){logger[_0xced0('0xb')](_0xced0('0x13'),_0x32e468);logger['debug'](_0xced0('0x13'),_0x32e468,JSON[_0xced0('0xe')](_0x23930e));_0x4795ac(_0x23930e);})[_0xced0('0x12')](function(_0x545eaf){logger[_0xced0('0xf')]('UpdateOpenchannelApplication',_0x545eaf[_0xced0('0x11')],_0x32e468);_0x15797f(_0x1ab3aa['error'](0x1f4,_0x545eaf[_0xced0('0x11')]));});});}; \ No newline at end of file +var _0x675b=['../../config/environment','request','then','info','request\x20sent','debug','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','stringify','lodash','util','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x48f9dc,_0x34b322){var _0x2026f1=function(_0x2952ea){while(--_0x2952ea){_0x48f9dc['push'](_0x48f9dc['shift']());}};_0x2026f1(++_0x34b322);}(_0x675b,0x86));var _0xb675=function(_0x58b754,_0x17f588){_0x58b754=_0x58b754-0x0;var _0x39fe56=_0x675b[_0x58b754];return _0x39fe56;};'use strict';var _=require(_0xb675('0x0'));var util=require(_0xb675('0x1'));var moment=require('moment');var BPromise=require(_0xb675('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb675('0x3'));var db=require(_0xb675('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb675('0x5'));var config=require(_0xb675('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x456dee,_0x401cc5,_0x5b1f9b){return new BPromise(function(_0x11ded0,_0x33d3e6){return client[_0xb675('0x7')](_0x456dee,_0x5b1f9b)[_0xb675('0x8')](function(_0x1bec9f){logger[_0xb675('0x9')]('OpenchannelApplication,\x20%s,\x20%s',_0x401cc5,_0xb675('0xa'));logger[_0xb675('0xb')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x401cc5,_0xb675('0xa'),JSON['stringify'](_0x1bec9f));if(_0x1bec9f[_0xb675('0xc')]){if(_0x1bec9f[_0xb675('0xc')][_0xb675('0xd')]===0x1f4){logger[_0xb675('0xc')](_0xb675('0xe'),_0x401cc5,_0x1bec9f[_0xb675('0xc')][_0xb675('0xf')]);return _0x33d3e6(_0x1bec9f[_0xb675('0xc')][_0xb675('0xf')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x401cc5,_0x1bec9f['error'][_0xb675('0xf')]);return _0x11ded0(_0x1bec9f['error'][_0xb675('0xf')]);}else{logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x401cc5,_0xb675('0xa'));_0x11ded0(_0x1bec9f[_0xb675('0x10')][_0xb675('0xf')]);}})[_0xb675('0x11')](function(_0x2ac42a){logger[_0xb675('0xc')](_0xb675('0xe'),_0x401cc5,_0x2ac42a);_0x33d3e6(_0x2ac42a);});});}exports[_0xb675('0x12')]=function(_0x45eb4e){var _0x1d542e=this;return new Promise(function(_0x337a33,_0x250eea){return db[_0xb675('0x13')][_0xb675('0x14')](_0x45eb4e[_0xb675('0x15')],{'raw':_0x45eb4e[_0xb675('0x16')]?_0x45eb4e[_0xb675('0x16')][_0xb675('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45eb4e['options']?_0x45eb4e[_0xb675('0x16')][_0xb675('0x18')]||null:null,'attributes':_0x45eb4e[_0xb675('0x16')]?_0x45eb4e['options'][_0xb675('0x19')]||null:null,'limit':_0x45eb4e[_0xb675('0x16')]?_0x45eb4e[_0xb675('0x16')][_0xb675('0x1a')]||null:null})[_0xb675('0x8')](function(_0xe89f73){logger[_0xb675('0x9')](_0xb675('0x12'),_0x45eb4e);logger['debug'](_0xb675('0x12'),_0x45eb4e,JSON[_0xb675('0x1b')](_0xe89f73));_0x337a33(_0xe89f73);})['catch'](function(_0x4dda3f){logger[_0xb675('0xc')](_0xb675('0x12'),_0x4dda3f[_0xb675('0xf')],_0x45eb4e);_0x250eea(_0x1d542e[_0xb675('0xc')](0x1f4,_0x4dda3f[_0xb675('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index eb5f501..fe00e57 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 _0x32db=['/:id/messages','/:id/download','post','create','/:id/tags','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete','tracked','openchannelinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x122f4c,_0x2ff141){var _0x4d4c19=function(_0x8016e9){while(--_0x8016e9){_0x122f4c['push'](_0x122f4c['shift']());}};_0x4d4c19(++_0x2ff141);}(_0x32db,0x197));var _0xb32d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x32db[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xb32d('0x0'));var path=require(_0xb32d('0x1'));var timeout=require(_0xb32d('0x2'));var express=require('express');var router=express[_0xb32d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb32d('0x4'));var interaction=require(_0xb32d('0x5'));var config=require(_0xb32d('0x6'));var controller=require(_0xb32d('0x7'));router[_0xb32d('0x8')]('/',auth[_0xb32d('0x9')](),controller['index']);router[_0xb32d('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xb32d('0xa')]);router[_0xb32d('0x8')](_0xb32d('0xb'),auth[_0xb32d('0x9')](),controller[_0xb32d('0xc')]);router[_0xb32d('0x8')](_0xb32d('0xd'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xb32d('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xb32d('0xf')]('/',auth[_0xb32d('0x9')](),controller[_0xb32d('0x10')]);router[_0xb32d('0xf')](_0xb32d('0xd'),auth[_0xb32d('0x9')](),controller['addMessage']);router['post'](_0xb32d('0x11'),auth[_0xb32d('0x9')](),interaction['tracked']('openchannel',_0xb32d('0x12')),controller[_0xb32d('0x13')]);router[_0xb32d('0x14')](_0xb32d('0xb'),auth[_0xb32d('0x9')](),interaction['tracked'](_0xb32d('0x15'),_0xb32d('0x16')),controller[_0xb32d('0x17')]);router[_0xb32d('0x18')](_0xb32d('0xb'),auth['isAuthenticated'](),interaction[_0xb32d('0x19')](_0xb32d('0x15'),_0xb32d('0x1a')),controller[_0xb32d('0x1b')]);router[_0xb32d('0x18')](_0xb32d('0x11'),auth[_0xb32d('0x9')](),controller[_0xb32d('0x1c')]);module[_0xb32d('0x1d')]=router; \ No newline at end of file +var _0xff3d=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','describe','/:id','isAuthenticated','/:id/messages','getMessages','/:id/download','download','post','tracked','openchannel','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports'];(function(_0x17c5ef,_0x236eef){var _0x10e200=function(_0x5a9f38){while(--_0x5a9f38){_0x17c5ef['push'](_0x17c5ef['shift']());}};_0x10e200(++_0x236eef);}(_0xff3d,0x12c));var _0xdff3=function(_0x81b2b5,_0x19eb6f){_0x81b2b5=_0x81b2b5-0x0;var _0x38809d=_0xff3d[_0x81b2b5];return _0x38809d;};'use strict';var multer=require(_0xdff3('0x0'));var util=require('util');var path=require(_0xdff3('0x1'));var timeout=require(_0xdff3('0x2'));var express=require('express');var router=express[_0xdff3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdff3('0x4'));var interaction=require(_0xdff3('0x5'));var config=require(_0xdff3('0x6'));var controller=require(_0xdff3('0x7'));router[_0xdff3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdff3('0x8')](_0xdff3('0x9'),auth['isAuthenticated'](),controller[_0xdff3('0xa')]);router[_0xdff3('0x8')](_0xdff3('0xb'),auth[_0xdff3('0xc')](),controller['show']);router[_0xdff3('0x8')](_0xdff3('0xd'),auth[_0xdff3('0xc')](),controller[_0xdff3('0xe')]);router[_0xdff3('0x8')](_0xdff3('0xf'),auth[_0xdff3('0xc')](),controller[_0xdff3('0x10')]);router[_0xdff3('0x11')]('/',auth[_0xdff3('0xc')](),controller['create']);router['post'](_0xdff3('0xd'),auth[_0xdff3('0xc')](),controller['addMessage']);router[_0xdff3('0x11')]('/:id/tags',auth[_0xdff3('0xc')](),interaction[_0xdff3('0x12')](_0xdff3('0x13'),'openchannelinteraction:addtags'),controller[_0xdff3('0x14')]);router[_0xdff3('0x15')](_0xdff3('0xb'),auth[_0xdff3('0xc')](),interaction['tracked']('openchannel',_0xdff3('0x16')),controller[_0xdff3('0x17')]);router[_0xdff3('0x18')](_0xdff3('0xb'),auth[_0xdff3('0xc')](),interaction[_0xdff3('0x12')]('openchannel',_0xdff3('0x19')),controller[_0xdff3('0x1a')]);router[_0xdff3('0x18')](_0xdff3('0x1b'),auth[_0xdff3('0xc')](),controller[_0xdff3('0x1c')]);module[_0xdff3('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index f5cfda1..7f4ecd1 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 _0xaaf7=['INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x7daa20,_0x54639b){var _0x396bb3=function(_0x49ee54){while(--_0x49ee54){_0x7daa20['push'](_0x7daa20['shift']());}};_0x396bb3(++_0x54639b);}(_0xaaf7,0x79));var _0x7aaf=function(_0x221524,_0x5837e8){_0x221524=_0x221524-0x0;var _0x40e5e6=_0xaaf7[_0x221524];return _0x40e5e6;};'use strict';var Sequelize=require(_0x7aaf('0x0'));module[_0x7aaf('0x1')]={'closed':{'type':Sequelize[_0x7aaf('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7aaf('0x3')]},'disposition':{'type':Sequelize[_0x7aaf('0x4')]},'secondDisposition':{'type':Sequelize[_0x7aaf('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7aaf('0x4')]},'read1stAt':{'type':Sequelize[_0x7aaf('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x7aaf('0x4')]},'lastMsgAt':{'type':Sequelize[_0x7aaf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x7aaf('0x5')]('in',_0x7aaf('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7aaf('0x5')]('in',_0x7aaf('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7aaf('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x7aaf('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7aaf('0x7')]}}; \ No newline at end of file +var _0xca4a=['out','INTEGER','sequelize','exports','BOOLEAN','STRING','ENUM'];(function(_0x10f964,_0x51a1b8){var _0x197dbf=function(_0x1c96de){while(--_0x1c96de){_0x10f964['push'](_0x10f964['shift']());}};_0x197dbf(++_0x51a1b8);}(_0xca4a,0xaa));var _0xaca4=function(_0x5adb97,_0x2b1702){_0x5adb97=_0x5adb97-0x0;var _0x142516=_0xca4a[_0x5adb97];return _0x142516;};'use strict';var Sequelize=require(_0xaca4('0x0'));module[_0xaca4('0x1')]={'closed':{'type':Sequelize[_0xaca4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xaca4('0x3')]},'secondDisposition':{'type':Sequelize[_0xaca4('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaca4('0x3')]},'note':{'type':Sequelize[_0xaca4('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xaca4('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xaca4('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaca4('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xaca4('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xaca4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index a954622..47a971c 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 _0x0a41=['OpenchannelMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','spread','Tag','color','emit','download','toString','join','root','files','tmp','attachments','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','Attachment','Messages','createdAt','direction','OpenchannelAccount','Account','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','pipe','createWriteStream','System','lastName','secret','read','renderFile','server','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','update','destroy','then','error','stack','name','index','OpenchannelInteraction','rawAttributes','type','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','addMessage'];(function(_0x2f379a,_0x53382d){var _0x305249=function(_0x318d5f){while(--_0x318d5f){_0x2f379a['push'](_0x2f379a['shift']());}};_0x305249(++_0x53382d);}(_0x0a41,0x1b8));var _0x10a4=function(_0x53f740,_0x1c689c){_0x53f740=_0x53f740-0x0;var _0x50636a=_0x0a41[_0x53f740];return _0x50636a;};'use strict';var rimraf=require(_0x10a4('0x0'));var zipdir=require(_0x10a4('0x1'));var moment=require(_0x10a4('0x2'));var util=require('util');var path=require(_0x10a4('0x3'));var ejs=require(_0x10a4('0x4'));var fs=require('fs');var _=require(_0x10a4('0x5'));var Redis=require(_0x10a4('0x6'));var interaction=require(_0x10a4('0x7'));var qs=require(_0x10a4('0x8'));var pdf=require(_0x10a4('0x9'));var logger=require(_0x10a4('0xa'))(_0x10a4('0xb'));var config=require(_0x10a4('0xc'));var db=require(_0x10a4('0xd'))['db'];config[_0x10a4('0xe')]=_[_0x10a4('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x10a4('0x10')](socket);function respondWithStatusCode(_0x2d91e6,_0x359035){_0x359035=_0x359035||0xcc;return function(_0x9bde84){if(_0x9bde84){return _0x2d91e6[_0x10a4('0x11')](_0x359035);}return _0x2d91e6['status'](_0x359035)[_0x10a4('0x12')]();};}function respondWithResult(_0x55d855,_0x5f7df3){_0x5f7df3=_0x5f7df3||0xc8;return function(_0x747841){if(_0x747841){return _0x55d855[_0x10a4('0x13')](_0x5f7df3)[_0x10a4('0x14')](_0x747841);}};}function respondWithFilteredResult(_0x348951,_0x104ee8){return function(_0xbeeca3){if(_0xbeeca3){var _0x2ac96f=typeof _0x104ee8['offset']===_0x10a4('0x15')&&typeof _0x104ee8[_0x10a4('0x16')]==='undefined';var _0xa951ff=_0xbeeca3[_0x10a4('0x17')];var _0x3777fa=_0x2ac96f?0x0:_0x104ee8[_0x10a4('0x18')];var _0x29c089=_0x2ac96f?_0xbeeca3[_0x10a4('0x17')]:_0x104ee8[_0x10a4('0x18')]+_0x104ee8[_0x10a4('0x16')];var _0xd5b0;if(_0x29c089>=_0xa951ff){_0x29c089=_0xa951ff;_0xd5b0=0xc8;}else{_0xd5b0=0xce;}_0x348951['status'](_0xd5b0);return _0x348951['set'](_0x10a4('0x19'),_0x3777fa+'-'+_0x29c089+'/'+_0xa951ff)[_0x10a4('0x14')](_0xbeeca3);}return null;};}function saveUpdates(_0x2fb95e){return function(_0x4e28dc){if(_0x4e28dc){return _0x4e28dc[_0x10a4('0x1a')](_0x2fb95e)['then'](function(_0x482dc6){return _0x482dc6;});}return null;};}function removeEntity(_0x4a85fb){return function(_0x22729b){if(_0x22729b){return _0x22729b[_0x10a4('0x1b')]()[_0x10a4('0x1c')](function(){_0x4a85fb[_0x10a4('0x13')](0xcc)[_0x10a4('0x12')]();});}};}function handleEntityNotFound(_0x3b1c8f){return function(_0x2c5e90){if(!_0x2c5e90){_0x3b1c8f[_0x10a4('0x11')](0x194);}return _0x2c5e90;};}function handleError(_0x30c253,_0x3f04dc){_0x3f04dc=_0x3f04dc||0x1f4;return function(_0x43656e){logger[_0x10a4('0x1d')](_0x43656e[_0x10a4('0x1e')]);if(_0x43656e[_0x10a4('0x1f')]){delete _0x43656e[_0x10a4('0x1f')];}_0x30c253[_0x10a4('0x13')](_0x3f04dc)['send'](_0x43656e);};}exports[_0x10a4('0x20')]=function(_0x4d7a47,_0xb702b){var _0x4b5879={};var _0x36dbc2=_['map'](db[_0x10a4('0x21')][_0x10a4('0x22')],function(_0x1eeafc){return{'name':_0x1eeafc['fieldName'],'type':_0x1eeafc[_0x10a4('0x23')]['key']};});_0x4b5879=qs[_0x10a4('0x24')](_0x36dbc2,_0x4d7a47);return interaction[_0x10a4('0x25')](_0x10a4('0x26'),_0x4d7a47[_0x10a4('0x27')],_0x4d7a47[_0x10a4('0x28')],_0x4b5879,_0x36dbc2)[_0x10a4('0x1c')](respondWithFilteredResult(_0xb702b,_0x4b5879))[_0x10a4('0x29')](handleError(_0xb702b,null));};exports[_0x10a4('0x2a')]=function(_0x37fe05,_0x3aee03){var _0x40bf93={};if(_0x37fe05[_0x10a4('0x27')][_0x10a4('0x23')]&&_0x37fe05[_0x10a4('0x27')][_0x10a4('0x23')]===_0x10a4('0x2b')){_0x40bf93[_0x10a4('0x2b')]=_0x37fe05[_0x10a4('0x2c')]['id'];}else{_0x40bf93['id']=_0x37fe05['params']['id'];}var _0xef1c94={'raw':![],'where':_0x40bf93},_0x544fa7={};_0x544fa7[_0x10a4('0x2d')]=_[_0x10a4('0x2e')](db['OpenchannelInteraction'][_0x10a4('0x22')]);_0x544fa7[_0x10a4('0x27')]=_[_0x10a4('0x2e')](_0x37fe05['query']);_0x544fa7[_0x10a4('0x2f')]=_[_0x10a4('0x30')](_0x544fa7[_0x10a4('0x2d')],_0x544fa7[_0x10a4('0x27')]);_0xef1c94[_0x10a4('0x31')]=_[_0x10a4('0x30')](_0x544fa7[_0x10a4('0x2d')],qs[_0x10a4('0x32')](_0x37fe05['query'][_0x10a4('0x32')]));_0xef1c94[_0x10a4('0x31')]=_0xef1c94[_0x10a4('0x31')][_0x10a4('0x33')]?_0xef1c94[_0x10a4('0x31')]:_0x544fa7['model'];if(_0x37fe05[_0x10a4('0x27')]['includeAll']){_0xef1c94[_0x10a4('0x34')]=[{'all':!![]}];}_0xef1c94=_[_0x10a4('0x35')]({},_0xef1c94,_0x37fe05[_0x10a4('0x36')]);return db[_0x10a4('0x21')][_0x10a4('0x37')](_0xef1c94)['then'](handleEntityNotFound(_0x3aee03,null))[_0x10a4('0x1c')](respondWithResult(_0x3aee03,null))['catch'](handleError(_0x3aee03,null));};exports[_0x10a4('0x38')]=function(_0x5ef74b,_0x3573fc){return db['OpenchannelInteraction'][_0x10a4('0x38')](_0x5ef74b['body'],{})[_0x10a4('0x1c')](respondWithResult(_0x3573fc,0xc9))['catch'](handleError(_0x3573fc,null));};exports['update']=function(_0x580d17,_0xb52b97){if(_0x580d17[_0x10a4('0x39')]['id']){delete _0x580d17[_0x10a4('0x39')]['id'];}return db['OpenchannelInteraction'][_0x10a4('0x37')]({'where':{'id':_0x580d17['params']['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0xb52b97,null))[_0x10a4('0x1c')](saveUpdates(_0x580d17['body'],null))[_0x10a4('0x1c')](respondWithResult(_0xb52b97,null))[_0x10a4('0x29')](handleError(_0xb52b97,null));};exports[_0x10a4('0x1b')]=function(_0x1f23d8,_0x296262){return db[_0x10a4('0x21')][_0x10a4('0x37')]({'where':{'id':_0x1f23d8[_0x10a4('0x2c')]['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0x296262,null))[_0x10a4('0x1c')](removeEntity(_0x296262,null))[_0x10a4('0x29')](handleError(_0x296262,null));};exports[_0x10a4('0x3a')]=function(_0x84b940,_0x5a3628){return db['OpenchannelInteraction']['describe']()[_0x10a4('0x1c')](respondWithResult(_0x5a3628,null))[_0x10a4('0x29')](handleError(_0x5a3628,null));};exports[_0x10a4('0x3b')]=function(_0x152f94,_0x1d7300){return db[_0x10a4('0x3c')]['find']({'where':{'id':_0x152f94[_0x10a4('0x2c')]['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0x1d7300,null))['then'](function(_0x267c09){if(_0x267c09){return _0x267c09[_0x10a4('0x3b')](_0x152f94[_0x10a4('0x39')][_0x10a4('0x3d')],_[_0x10a4('0x3e')](_0x152f94[_0x10a4('0x39')],[_0x10a4('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x1d7300,null))['catch'](handleError(_0x1d7300,null));};exports[_0x10a4('0x3f')]=function(_0x90ab0a,_0x18f510){var _0xca7ea2={'raw':![],'where':{}};var _0x4b776f={};var _0x411d8f={'count':0x0,'rows':[]};return db[_0x10a4('0x21')][_0x10a4('0x40')]({'where':{'id':_0x90ab0a[_0x10a4('0x2c')]['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0x18f510,null))[_0x10a4('0x1c')](function(_0x3eddcb){if(_0x3eddcb){_0x4b776f[_0x10a4('0x2d')]=_[_0x10a4('0x2e')](db[_0x10a4('0x3c')]['rawAttributes']);_0x4b776f[_0x10a4('0x27')]=_[_0x10a4('0x2e')](_0x90ab0a[_0x10a4('0x27')]);_0x4b776f[_0x10a4('0x2f')]=_[_0x10a4('0x30')](_0x4b776f['model'],_0x4b776f[_0x10a4('0x27')]);_0xca7ea2[_0x10a4('0x31')]=_['intersection'](_0x4b776f[_0x10a4('0x2d')],qs[_0x10a4('0x32')](_0x90ab0a['query']['fields']));_0xca7ea2[_0x10a4('0x31')]=_0xca7ea2[_0x10a4('0x31')][_0x10a4('0x33')]?_0xca7ea2[_0x10a4('0x31')]:_0x4b776f['model'];if(!_0x90ab0a[_0x10a4('0x27')]['hasOwnProperty'](_0x10a4('0x41'))){_0xca7ea2[_0x10a4('0x16')]=qs['limit'](_0x90ab0a['query'][_0x10a4('0x16')]);_0xca7ea2['offset']=qs['offset'](_0x90ab0a['query']['offset']);}_0xca7ea2[_0x10a4('0x42')]=qs[_0x10a4('0x43')](_0x90ab0a[_0x10a4('0x27')][_0x10a4('0x43')]);_0xca7ea2[_0x10a4('0x44')]=qs[_0x10a4('0x2f')](_['pick'](_0x90ab0a[_0x10a4('0x27')],_0x4b776f[_0x10a4('0x2f')]));_0xca7ea2[_0x10a4('0x44')]['OpenchannelInteractionId']=_0x3eddcb['id'];if(_0x90ab0a[_0x10a4('0x27')][_0x10a4('0x45')]){_0xca7ea2['where']=_[_0x10a4('0x35')](_0xca7ea2[_0x10a4('0x44')],{'$or':_[_0x10a4('0x46')](_0xca7ea2[_0x10a4('0x31')],function(_0x8fee0){var _0x41b743={};_0x41b743[_0x8fee0]={'$like':'%'+_0x90ab0a[_0x10a4('0x27')][_0x10a4('0x45')]+'%'};return _0x41b743;})});}if(_0x90ab0a[_0x10a4('0x27')][_0x10a4('0x47')]){var _0x4c90dd=_0x90ab0a['query'][_0x10a4('0x47')][_0x10a4('0x48')](',');var _0x48b56b={};_0x48b56b[_0x4c90dd[0x0]]={'$gte':moment(_0x4c90dd[0x1])[_0x10a4('0x49')](_0x10a4('0x4a'))};_0xca7ea2['where']=_['merge'](_0xca7ea2[_0x10a4('0x44')],_0x48b56b);}_0xca7ea2=_[_0x10a4('0x35')]({},_0xca7ea2,_0x90ab0a[_0x10a4('0x36')]);return db[_0x10a4('0x3c')]['count']({'where':_0xca7ea2[_0x10a4('0x44')]})[_0x10a4('0x1c')](function(_0x181d8b){_0x411d8f['count']=_0x181d8b;if(_0x90ab0a['query'][_0x10a4('0x4b')]){_0xca7ea2[_0x10a4('0x34')]=[{'all':!![]}];}return db[_0x10a4('0x3c')]['findAll'](_0xca7ea2);})['then'](function(_0x545f32){_0x411d8f['rows']=_0x545f32;return _0x411d8f;});}})[_0x10a4('0x1c')](respondWithFilteredResult(_0x18f510,_0xca7ea2))[_0x10a4('0x29')](handleError(_0x18f510,null));};exports['addTags']=function(_0x255d56,_0xbf1007){return db['OpenchannelInteraction'][_0x10a4('0x37')]({'where':{'id':_0x255d56[_0x10a4('0x2c')]['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0xbf1007,null))['then'](function(_0x2930cd){if(_0x2930cd){return _0x2930cd['setTags'](_0x255d56['body'][_0x10a4('0x3d')],_[_0x10a4('0x3e')](_0x255d56[_0x10a4('0x39')],[_0x10a4('0x3d'),'id'])||{})[_0x10a4('0x4c')](function(){return db[_0x10a4('0x4d')]['findAll']({'attributes':['id','name',_0x10a4('0x4e')],'where':{'id':_0x255d56[_0x10a4('0x39')][_0x10a4('0x3d')]}});})[_0x10a4('0x1c')](function(_0x17a359){socket[_0x10a4('0x4f')]('openchannelInteractionTags:save',{'id':Number(_0x255d56[_0x10a4('0x2c')]['id']),'tags':_0x17a359||[]});return{'id':Number(_0x255d56[_0x10a4('0x2c')]['id']),'tags':_0x17a359||[]};});}})[_0x10a4('0x1c')](respondWithResult(_0xbf1007,null))[_0x10a4('0x29')](handleError(_0xbf1007,null));};exports['removeTags']=function(_0x489264,_0x33b10e){return db[_0x10a4('0x21')][_0x10a4('0x37')]({'where':{'id':_0x489264[_0x10a4('0x2c')]['id']}})[_0x10a4('0x1c')](handleEntityNotFound(_0x33b10e,null))[_0x10a4('0x1c')](function(_0x4530cc){if(_0x4530cc){return _0x4530cc['removeTags'](_0x489264[_0x10a4('0x27')][_0x10a4('0x3d')]);}})[_0x10a4('0x1c')](respondWithStatusCode(_0x33b10e,null))[_0x10a4('0x29')](handleError(_0x33b10e,null));};exports[_0x10a4('0x50')]=function(_0x26ef8b,_0xa05143){var _0x50d910=moment()['unix']()[_0x10a4('0x51')]();var _0x17b0d1=path[_0x10a4('0x52')](config[_0x10a4('0x53')],'server',_0x10a4('0x54'),_0x10a4('0x55'));var _0x2c7312=path[_0x10a4('0x52')](config[_0x10a4('0x53')],'server',_0x10a4('0x54'),_0x10a4('0x56'));var _0x5bb3a3=path['join'](_0x17b0d1,_0x50d910);var _0x514050=util[_0x10a4('0x49')](_0x10a4('0x57'),_0x26ef8b[_0x10a4('0x2c')]['id'],_0x50d910);var _0x4ef705=path[_0x10a4('0x52')](_0x17b0d1,_0x514050);var _0x5e6754=[];_0x5e6754['push']({'model':db[_0x10a4('0x58')],'as':_0x10a4('0x58'),'attributes':['id',_0x10a4('0x59')],'raw':!![]});_0x5e6754[_0x10a4('0x5a')]({'model':db['CmContact'],'as':_0x10a4('0x5b'),'attributes':['id',_0x10a4('0x5c'),'lastName'],'raw':!![]});if(_0x26ef8b[_0x10a4('0x27')]['attachments']){_0x5e6754[_0x10a4('0x5a')]({'model':db[_0x10a4('0x5d')],'as':_0x10a4('0x5d'),'raw':!![]});}var _0xb09804=[{'model':db[_0x10a4('0x3c')],'as':_0x10a4('0x5e'),'attributes':['id','body',_0x10a4('0x5f'),_0x10a4('0x60'),'secret','read'],'include':_0x5e6754}];_0xb09804['push']({'model':db[_0x10a4('0x61')],'as':_0x10a4('0x62'),'attributes':['id','name']});_0xb09804[_0x10a4('0x5a')]({'model':db[_0x10a4('0x58')],'as':'Owner','attributes':['id','fullname']});return db[_0x10a4('0x21')]['find']({'where':{'id':_0x26ef8b[_0x10a4('0x2c')]['id']},'include':_0xb09804})[_0x10a4('0x1c')](handleEntityNotFound(_0xa05143,null))['then'](function(_0x446ad9){if(_0x446ad9){var _0x9cd77f=_0x446ad9['get']({'plain':!![]});fs[_0x10a4('0x63')](_0x5bb3a3);var _0x45e0bd={'channel':_0x10a4('0x64'),'account':_0x9cd77f[_0x10a4('0x62')][_0x10a4('0x1f')],'agent':_0x9cd77f[_0x10a4('0x65')]?_0x9cd77f['Owner']['fullname']:_0x10a4('0x66'),'createdAt':moment(_0x9cd77f['createdAt'])['format'](_0x10a4('0x4a'))[_0x10a4('0x51')](),'closedAt':_0x9cd77f[_0x10a4('0x67')]?moment(_0x9cd77f[_0x10a4('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x10a4('0x51')]():'','disposition':_0x9cd77f[_0x10a4('0x69')],'visibility':_0x9cd77f[_0x10a4('0x6a')]?_0x10a4('0x6b'):_0x10a4('0x6c'),'messages':_(_0x9cd77f[_0x10a4('0x5e')])[_0x10a4('0x45')]({'secret':![]})[_0x10a4('0x46')](function(_0x39dc4f){if(_0x39dc4f['Attachment']){var _0x15d3b4=path[_0x10a4('0x52')](_0x2c7312,_0x39dc4f[_0x10a4('0x5d')][_0x10a4('0x6d')]);if(fs[_0x10a4('0x6e')](_0x15d3b4)){fs['createReadStream'](_0x15d3b4)[_0x10a4('0x6f')](fs[_0x10a4('0x70')](path[_0x10a4('0x52')](_0x5bb3a3,_0x39dc4f['Attachment'][_0x10a4('0x6d')])));}}return{'date':moment(_0x39dc4f[_0x10a4('0x5f')])[_0x10a4('0x49')](_0x10a4('0x4a'))['toString'](),'sender':_0x39dc4f['direction']==='out'?_0x39dc4f[_0x10a4('0x58')]?_0x39dc4f[_0x10a4('0x58')][_0x10a4('0x59')]:_0x10a4('0x71'):_0x39dc4f[_0x10a4('0x5b')][_0x10a4('0x5c')]+(_0x39dc4f[_0x10a4('0x5b')][_0x10a4('0x72')]?'\x20'+_0x39dc4f[_0x10a4('0x5b')][_0x10a4('0x72')]:''),'body':_0x39dc4f[_0x10a4('0x5d')]?_0x39dc4f['Attachment']['basename']:_0x39dc4f[_0x10a4('0x39')],'direction':_0x39dc4f[_0x10a4('0x60')]==='out'?'A':'C','secret':_0x39dc4f[_0x10a4('0x73')],'read':_0x39dc4f[_0x10a4('0x74')],'attachment':_0x39dc4f[_0x10a4('0x5d')]};})['value']()};return ejs[_0x10a4('0x75')](path['join'](config['root'],_0x10a4('0x76'),_0x10a4('0x77'),_0x10a4('0x78')),{'interaction':_0x45e0bd})[_0x10a4('0x1c')](function(_0x1092d5){var _0x1911b1=path[_0x10a4('0x52')](_0x5bb3a3,'transcript-'+_0x9cd77f['id']+'-'+_0x50d910+_0x10a4('0x79'));var _0x260c22={'path':_0x1911b1,'channel':_0x10a4('0x64'),'interactionId':_0x9cd77f['id']};return pdf[_0x10a4('0x7a')](_0x1092d5,_0x260c22);})[_0x10a4('0x1c')](function(){return new Promise(function(_0x5259a4,_0x3c1154){zipdir(_0x5bb3a3,{'saveTo':_0x4ef705},function(_0x50d928,_0x70fb48){if(_0x50d928)return _0x3c1154(_0x50d928);return _0x5259a4(_0x70fb48);});})['then'](function(){return new Promise(function(_0x31c09d,_0x35833f){rimraf(_0x5bb3a3,function(_0x43ab2d){if(_0x43ab2d)_0x35833f(_0x43ab2d);return _0x31c09d();});});})[_0x10a4('0x1c')](function(){return _0xa05143[_0x10a4('0x50')](_0x4ef705,_0x514050,function(_0x407f88){if(_0x407f88){logger[_0x10a4('0x1d')](_0x10a4('0x7b'),_0x407f88);}else{fs[_0x10a4('0x7c')](_0x4ef705);}});});});}else{return _0xa05143[_0x10a4('0x11')](0xc8);}})[_0x10a4('0x29')](handleError(_0xa05143,null));}; \ No newline at end of file +var _0x7c75=['sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','findAll','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','fullname','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','createdAt','toString','closed','closedAt','disposition','threadId','basename','existsSync','pipe','createWriteStream','out','System','Contact','read','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','sendStatus','status','undefined','limit','count','offset','Content-Range','destroy','then','end','error','stack','name','send','map','fieldName','type','getOptions','openchannel','catch','show','query','params','model','keys','rawAttributes','intersection','fields','attributes','length','includeAll','include','merge','options','OpenchannelInteraction','find','create','body','update','describe','OpenchannelMessage','addMessage','omit','ids','filters','hasOwnProperty','nolimit','order'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x7c75,0x1b8));var _0x57c7=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7c75[_0x40ac5e];return _0x2839d6;};'use strict';var rimraf=require(_0x57c7('0x0'));var zipdir=require(_0x57c7('0x1'));var moment=require('moment');var util=require('util');var path=require(_0x57c7('0x2'));var ejs=require(_0x57c7('0x3'));var fs=require('fs');var _=require(_0x57c7('0x4'));var Redis=require(_0x57c7('0x5'));var interaction=require(_0x57c7('0x6'));var qs=require(_0x57c7('0x7'));var pdf=require(_0x57c7('0x8'));var logger=require(_0x57c7('0x9'))(_0x57c7('0xa'));var config=require(_0x57c7('0xb'));var db=require('../../mysqldb')['db'];config[_0x57c7('0xc')]=_[_0x57c7('0xd')](config[_0x57c7('0xc')],{'host':_0x57c7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x57c7('0xf')](socket);function respondWithStatusCode(_0x5a6d33,_0x202d76){_0x202d76=_0x202d76||0xcc;return function(_0xcd260b){if(_0xcd260b){return _0x5a6d33[_0x57c7('0x10')](_0x202d76);}return _0x5a6d33['status'](_0x202d76)['end']();};}function respondWithResult(_0x3e3d28,_0x408ed8){_0x408ed8=_0x408ed8||0xc8;return function(_0x5a09da){if(_0x5a09da){return _0x3e3d28[_0x57c7('0x11')](_0x408ed8)['json'](_0x5a09da);}};}function respondWithFilteredResult(_0x3e4f98,_0x1a5023){return function(_0x1da4f7){if(_0x1da4f7){var _0x108d9e=typeof _0x1a5023['offset']===_0x57c7('0x12')&&typeof _0x1a5023[_0x57c7('0x13')]===_0x57c7('0x12');var _0x54d4ca=_0x1da4f7[_0x57c7('0x14')];var _0x11ae13=_0x108d9e?0x0:_0x1a5023['offset'];var _0x25cd1e=_0x108d9e?_0x1da4f7[_0x57c7('0x14')]:_0x1a5023[_0x57c7('0x15')]+_0x1a5023[_0x57c7('0x13')];var _0x1c3b20;if(_0x25cd1e>=_0x54d4ca){_0x25cd1e=_0x54d4ca;_0x1c3b20=0xc8;}else{_0x1c3b20=0xce;}_0x3e4f98[_0x57c7('0x11')](_0x1c3b20);return _0x3e4f98['set'](_0x57c7('0x16'),_0x11ae13+'-'+_0x25cd1e+'/'+_0x54d4ca)['json'](_0x1da4f7);}return null;};}function saveUpdates(_0x34ce16){return function(_0x5e2390){if(_0x5e2390){return _0x5e2390['update'](_0x34ce16)['then'](function(_0xb38062){return _0xb38062;});}return null;};}function removeEntity(_0x10d948){return function(_0x1b5803){if(_0x1b5803){return _0x1b5803[_0x57c7('0x17')]()[_0x57c7('0x18')](function(){_0x10d948[_0x57c7('0x11')](0xcc)[_0x57c7('0x19')]();});}};}function handleEntityNotFound(_0x102112){return function(_0x40b7ac){if(!_0x40b7ac){_0x102112['sendStatus'](0x194);}return _0x40b7ac;};}function handleError(_0x4226e1,_0x565040){_0x565040=_0x565040||0x1f4;return function(_0x1aa892){logger[_0x57c7('0x1a')](_0x1aa892[_0x57c7('0x1b')]);if(_0x1aa892['name']){delete _0x1aa892[_0x57c7('0x1c')];}_0x4226e1['status'](_0x565040)[_0x57c7('0x1d')](_0x1aa892);};}exports['index']=function(_0x3b457a,_0x42157c){var _0x2398d7={};var _0x186c82=_[_0x57c7('0x1e')](db['OpenchannelInteraction']['rawAttributes'],function(_0x4267f0){return{'name':_0x4267f0[_0x57c7('0x1f')],'type':_0x4267f0[_0x57c7('0x20')]['key']};});_0x2398d7=qs[_0x57c7('0x21')](_0x186c82,_0x3b457a);return interaction['findAll'](_0x57c7('0x22'),_0x3b457a['query'],_0x3b457a['user'],_0x2398d7,_0x186c82)[_0x57c7('0x18')](respondWithFilteredResult(_0x42157c,_0x2398d7))[_0x57c7('0x23')](handleError(_0x42157c,null));};exports[_0x57c7('0x24')]=function(_0x3f7451,_0x4600df){var _0x298f93={};if(_0x3f7451[_0x57c7('0x25')][_0x57c7('0x20')]&&_0x3f7451[_0x57c7('0x25')][_0x57c7('0x20')]==='from'){_0x298f93['from']=_0x3f7451['params']['id'];}else{_0x298f93['id']=_0x3f7451[_0x57c7('0x26')]['id'];}var _0x56d081={'raw':![],'where':_0x298f93},_0x3fb9cd={};_0x3fb9cd[_0x57c7('0x27')]=_[_0x57c7('0x28')](db['OpenchannelInteraction'][_0x57c7('0x29')]);_0x3fb9cd['query']=_[_0x57c7('0x28')](_0x3f7451[_0x57c7('0x25')]);_0x3fb9cd['filters']=_[_0x57c7('0x2a')](_0x3fb9cd[_0x57c7('0x27')],_0x3fb9cd[_0x57c7('0x25')]);_0x56d081['attributes']=_[_0x57c7('0x2a')](_0x3fb9cd[_0x57c7('0x27')],qs[_0x57c7('0x2b')](_0x3f7451[_0x57c7('0x25')][_0x57c7('0x2b')]));_0x56d081['attributes']=_0x56d081[_0x57c7('0x2c')][_0x57c7('0x2d')]?_0x56d081['attributes']:_0x3fb9cd[_0x57c7('0x27')];if(_0x3f7451[_0x57c7('0x25')][_0x57c7('0x2e')]){_0x56d081[_0x57c7('0x2f')]=[{'all':!![]}];}_0x56d081=_[_0x57c7('0x30')]({},_0x56d081,_0x3f7451[_0x57c7('0x31')]);return db[_0x57c7('0x32')][_0x57c7('0x33')](_0x56d081)[_0x57c7('0x18')](handleEntityNotFound(_0x4600df,null))['then'](respondWithResult(_0x4600df,null))[_0x57c7('0x23')](handleError(_0x4600df,null));};exports['create']=function(_0x4c337e,_0x55c199){return db[_0x57c7('0x32')][_0x57c7('0x34')](_0x4c337e[_0x57c7('0x35')],{})[_0x57c7('0x18')](respondWithResult(_0x55c199,0xc9))[_0x57c7('0x23')](handleError(_0x55c199,null));};exports[_0x57c7('0x36')]=function(_0x22a1cf,_0x539a87){if(_0x22a1cf[_0x57c7('0x35')]['id']){delete _0x22a1cf[_0x57c7('0x35')]['id'];}return db[_0x57c7('0x32')][_0x57c7('0x33')]({'where':{'id':_0x22a1cf[_0x57c7('0x26')]['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x539a87,null))[_0x57c7('0x18')](saveUpdates(_0x22a1cf['body'],null))['then'](respondWithResult(_0x539a87,null))[_0x57c7('0x23')](handleError(_0x539a87,null));};exports[_0x57c7('0x17')]=function(_0x263c7b,_0x830806){return db[_0x57c7('0x32')][_0x57c7('0x33')]({'where':{'id':_0x263c7b[_0x57c7('0x26')]['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x830806,null))['then'](removeEntity(_0x830806,null))[_0x57c7('0x23')](handleError(_0x830806,null));};exports[_0x57c7('0x37')]=function(_0x3f8bba,_0x1e35d8){return db[_0x57c7('0x32')][_0x57c7('0x37')]()[_0x57c7('0x18')](respondWithResult(_0x1e35d8,null))[_0x57c7('0x23')](handleError(_0x1e35d8,null));};exports['addMessage']=function(_0x27c82b,_0x1e5e71){return db[_0x57c7('0x38')][_0x57c7('0x33')]({'where':{'id':_0x27c82b[_0x57c7('0x26')]['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x1e5e71,null))[_0x57c7('0x18')](function(_0xfb59f0){if(_0xfb59f0){return _0xfb59f0[_0x57c7('0x39')](_0x27c82b[_0x57c7('0x35')]['ids'],_[_0x57c7('0x3a')](_0x27c82b[_0x57c7('0x35')],[_0x57c7('0x3b'),'id'])||{});}})[_0x57c7('0x18')](respondWithResult(_0x1e5e71,null))[_0x57c7('0x23')](handleError(_0x1e5e71,null));};exports['getMessages']=function(_0x371234,_0x55b6ea){var _0x31c597={'raw':![],'where':{}};var _0x4f56d3={};var _0x41cbc7={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x371234[_0x57c7('0x26')]['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x55b6ea,null))[_0x57c7('0x18')](function(_0x44c35c){if(_0x44c35c){_0x4f56d3[_0x57c7('0x27')]=_[_0x57c7('0x28')](db[_0x57c7('0x38')]['rawAttributes']);_0x4f56d3[_0x57c7('0x25')]=_[_0x57c7('0x28')](_0x371234[_0x57c7('0x25')]);_0x4f56d3[_0x57c7('0x3c')]=_[_0x57c7('0x2a')](_0x4f56d3[_0x57c7('0x27')],_0x4f56d3[_0x57c7('0x25')]);_0x31c597[_0x57c7('0x2c')]=_[_0x57c7('0x2a')](_0x4f56d3[_0x57c7('0x27')],qs[_0x57c7('0x2b')](_0x371234['query'][_0x57c7('0x2b')]));_0x31c597[_0x57c7('0x2c')]=_0x31c597[_0x57c7('0x2c')][_0x57c7('0x2d')]?_0x31c597[_0x57c7('0x2c')]:_0x4f56d3[_0x57c7('0x27')];if(!_0x371234[_0x57c7('0x25')][_0x57c7('0x3d')](_0x57c7('0x3e'))){_0x31c597[_0x57c7('0x13')]=qs[_0x57c7('0x13')](_0x371234[_0x57c7('0x25')][_0x57c7('0x13')]);_0x31c597[_0x57c7('0x15')]=qs[_0x57c7('0x15')](_0x371234['query'][_0x57c7('0x15')]);}_0x31c597[_0x57c7('0x3f')]=qs[_0x57c7('0x40')](_0x371234[_0x57c7('0x25')]['sort']);_0x31c597[_0x57c7('0x41')]=qs[_0x57c7('0x3c')](_[_0x57c7('0x42')](_0x371234[_0x57c7('0x25')],_0x4f56d3[_0x57c7('0x3c')]));_0x31c597[_0x57c7('0x41')][_0x57c7('0x43')]=_0x44c35c['id'];if(_0x371234['query']['filter']){_0x31c597[_0x57c7('0x41')]=_[_0x57c7('0x30')](_0x31c597['where'],{'$or':_[_0x57c7('0x1e')](_0x31c597['attributes'],function(_0x5ccfde){var _0x5d4f97={};_0x5d4f97[_0x5ccfde]={'$like':'%'+_0x371234[_0x57c7('0x25')][_0x57c7('0x44')]+'%'};return _0x5d4f97;})});}if(_0x371234[_0x57c7('0x25')]['$gte']){var _0x2fecf0=_0x371234[_0x57c7('0x25')][_0x57c7('0x45')][_0x57c7('0x46')](',');var _0x597bac={};_0x597bac[_0x2fecf0[0x0]]={'$gte':moment(_0x2fecf0[0x1])[_0x57c7('0x47')](_0x57c7('0x48'))};_0x31c597[_0x57c7('0x41')]=_[_0x57c7('0x30')](_0x31c597['where'],_0x597bac);}_0x31c597=_[_0x57c7('0x30')]({},_0x31c597,_0x371234[_0x57c7('0x31')]);return db['OpenchannelMessage']['count']({'where':_0x31c597[_0x57c7('0x41')]})[_0x57c7('0x18')](function(_0xbfc0b2){_0x41cbc7[_0x57c7('0x14')]=_0xbfc0b2;if(_0x371234[_0x57c7('0x25')][_0x57c7('0x2e')]){_0x31c597[_0x57c7('0x2f')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x31c597);})[_0x57c7('0x18')](function(_0x5d4dd6){_0x41cbc7[_0x57c7('0x49')]=_0x5d4dd6;return _0x41cbc7;});}})[_0x57c7('0x18')](respondWithFilteredResult(_0x55b6ea,_0x31c597))[_0x57c7('0x23')](handleError(_0x55b6ea,null));};exports[_0x57c7('0x4a')]=function(_0x443617,_0x247b93){return db[_0x57c7('0x32')][_0x57c7('0x33')]({'where':{'id':_0x443617['params']['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x247b93,null))[_0x57c7('0x18')](function(_0x2cd053){if(_0x2cd053){return _0x2cd053[_0x57c7('0x4b')](_0x443617[_0x57c7('0x35')][_0x57c7('0x3b')],_[_0x57c7('0x3a')](_0x443617[_0x57c7('0x35')],[_0x57c7('0x3b'),'id'])||{})['spread'](function(){return db['Tag'][_0x57c7('0x4c')]({'attributes':['id',_0x57c7('0x1c'),_0x57c7('0x4d')],'where':{'id':_0x443617[_0x57c7('0x35')][_0x57c7('0x3b')]}});})[_0x57c7('0x18')](function(_0x53c52a){socket[_0x57c7('0x4e')](_0x57c7('0x4f'),{'id':Number(_0x443617[_0x57c7('0x26')]['id']),'tags':_0x53c52a||[]});return{'id':Number(_0x443617[_0x57c7('0x26')]['id']),'tags':_0x53c52a||[]};});}})['then'](respondWithResult(_0x247b93,null))[_0x57c7('0x23')](handleError(_0x247b93,null));};exports[_0x57c7('0x50')]=function(_0x3fe42c,_0x3dd49d){return db[_0x57c7('0x32')][_0x57c7('0x33')]({'where':{'id':_0x3fe42c[_0x57c7('0x26')]['id']}})[_0x57c7('0x18')](handleEntityNotFound(_0x3dd49d,null))['then'](function(_0x48292a){if(_0x48292a){return _0x48292a[_0x57c7('0x50')](_0x3fe42c[_0x57c7('0x25')][_0x57c7('0x3b')]);}})[_0x57c7('0x18')](respondWithStatusCode(_0x3dd49d,null))[_0x57c7('0x23')](handleError(_0x3dd49d,null));};exports[_0x57c7('0x51')]=function(_0x191d7,_0x22ec5c){var _0xb9b0ad=moment()[_0x57c7('0x52')]()['toString']();var _0x3fb2a9=path[_0x57c7('0x53')](config[_0x57c7('0x54')],_0x57c7('0x55'),'files','tmp');var _0x3dc217=path[_0x57c7('0x53')](config['root'],'server',_0x57c7('0x56'),_0x57c7('0x57'));var _0x339cda=path[_0x57c7('0x53')](_0x3fb2a9,_0xb9b0ad);var _0x205cca=util['format'](_0x57c7('0x58'),_0x191d7[_0x57c7('0x26')]['id'],_0xb9b0ad);var _0x5b3712=path['join'](_0x3fb2a9,_0x205cca);var _0x505c50=[];_0x505c50[_0x57c7('0x59')]({'model':db['User'],'as':_0x57c7('0x5a'),'attributes':['id',_0x57c7('0x5b')],'raw':!![]});_0x505c50[_0x57c7('0x59')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x57c7('0x5c'),_0x57c7('0x5d')],'raw':!![]});if(_0x191d7['query']['attachments']){_0x505c50['push']({'model':db[_0x57c7('0x5e')],'as':_0x57c7('0x5e'),'raw':!![]});}var _0x3986b7=[{'model':db[_0x57c7('0x38')],'as':'Messages','attributes':['id',_0x57c7('0x35'),'createdAt',_0x57c7('0x5f'),_0x57c7('0x60'),'read'],'include':_0x505c50}];_0x3986b7[_0x57c7('0x59')]({'model':db[_0x57c7('0x61')],'as':_0x57c7('0x62'),'attributes':['id',_0x57c7('0x1c')]});_0x3986b7['push']({'model':db[_0x57c7('0x5a')],'as':_0x57c7('0x63'),'attributes':['id',_0x57c7('0x5b')]});return db[_0x57c7('0x32')][_0x57c7('0x33')]({'where':{'id':_0x191d7[_0x57c7('0x26')]['id']},'include':_0x3986b7})['then'](handleEntityNotFound(_0x22ec5c,null))['then'](function(_0x1c3992){if(_0x1c3992){var _0x3f7e17=_0x1c3992[_0x57c7('0x64')]({'plain':!![]});fs[_0x57c7('0x65')](_0x339cda);var _0x212ef2={'channel':_0x57c7('0x66'),'account':_0x3f7e17[_0x57c7('0x62')][_0x57c7('0x1c')],'agent':_0x3f7e17[_0x57c7('0x63')]?_0x3f7e17['Owner'][_0x57c7('0x5b')]:_0x57c7('0x67'),'createdAt':moment(_0x3f7e17[_0x57c7('0x68')])['format'](_0x57c7('0x48'))[_0x57c7('0x69')](),'closedAt':_0x3f7e17[_0x57c7('0x6a')]?moment(_0x3f7e17[_0x57c7('0x6b')])[_0x57c7('0x47')](_0x57c7('0x48'))[_0x57c7('0x69')]():'','disposition':_0x3f7e17[_0x57c7('0x6c')],'visibility':_0x3f7e17[_0x57c7('0x6d')]?'Public':'Private','messages':_(_0x3f7e17['Messages'])[_0x57c7('0x44')]({'secret':![]})['map'](function(_0x20622c){if(_0x20622c[_0x57c7('0x5e')]){var _0x1a304f=path['join'](_0x3dc217,_0x20622c['Attachment'][_0x57c7('0x6e')]);if(fs[_0x57c7('0x6f')](_0x1a304f)){fs['createReadStream'](_0x1a304f)[_0x57c7('0x70')](fs[_0x57c7('0x71')](path[_0x57c7('0x53')](_0x339cda,_0x20622c[_0x57c7('0x5e')][_0x57c7('0x6e')])));}}return{'date':moment(_0x20622c['createdAt'])['format'](_0x57c7('0x48'))[_0x57c7('0x69')](),'sender':_0x20622c['direction']===_0x57c7('0x72')?_0x20622c[_0x57c7('0x5a')]?_0x20622c[_0x57c7('0x5a')][_0x57c7('0x5b')]:_0x57c7('0x73'):_0x20622c['Contact'][_0x57c7('0x5c')]+(_0x20622c['Contact']['lastName']?'\x20'+_0x20622c[_0x57c7('0x74')]['lastName']:''),'body':_0x20622c[_0x57c7('0x5e')]?_0x20622c[_0x57c7('0x5e')][_0x57c7('0x6e')]:_0x20622c[_0x57c7('0x35')],'direction':_0x20622c['direction']==='out'?'A':'C','secret':_0x20622c[_0x57c7('0x60')],'read':_0x20622c[_0x57c7('0x75')],'attachment':_0x20622c[_0x57c7('0x5e')]};})[_0x57c7('0x76')]()};return ejs['renderFile'](path['join'](config[_0x57c7('0x54')],_0x57c7('0x55'),_0x57c7('0x77'),_0x57c7('0x78')),{'interaction':_0x212ef2})[_0x57c7('0x18')](function(_0x4abf06){var _0x111611=path[_0x57c7('0x53')](_0x339cda,_0x57c7('0x79')+_0x3f7e17['id']+'-'+_0xb9b0ad+_0x57c7('0x7a'));var _0x2040bb={'path':_0x111611,'channel':_0x57c7('0x66'),'interactionId':_0x3f7e17['id']};return pdf[_0x57c7('0x7b')](_0x4abf06,_0x2040bb);})[_0x57c7('0x18')](function(){return new Promise(function(_0x3cf2b6,_0x12064c){zipdir(_0x339cda,{'saveTo':_0x5b3712},function(_0x1ab4cf,_0x4b04d7){if(_0x1ab4cf)return _0x12064c(_0x1ab4cf);return _0x3cf2b6(_0x4b04d7);});})[_0x57c7('0x18')](function(){return new Promise(function(_0x5644ac,_0x5bceaa){rimraf(_0x339cda,function(_0x1d3216){if(_0x1d3216)_0x5bceaa(_0x1d3216);return _0x5644ac();});});})[_0x57c7('0x18')](function(){return _0x22ec5c['download'](_0x5b3712,_0x205cca,function(_0x5cda8f){if(_0x5cda8f){logger[_0x57c7('0x1a')](_0x57c7('0x7c'),_0x5cda8f);}else{fs[_0x57c7('0x7d')](_0x5b3712);}});});});}else{return _0x22ec5c[_0x57c7('0x10')](0xc8);}})[_0x57c7('0x23')](handleError(_0x22ec5c,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 626a30a..e18da45 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 _0x8709=['OpenchannelMessage','save','update','remove','getUsers','then','setDataValue','map','length','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x8709,0xee));var _0x9870=function(_0x8e6c5b,_0x33e4df){_0x8e6c5b=_0x8e6c5b-0x0;var _0x39e9d3=_0x8709[_0x8e6c5b];return _0x39e9d3;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x9870('0x0'))['db'][_0x9870('0x1')];var OpenchannelMessage=require(_0x9870('0x0'))['db'][_0x9870('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9870('0x3'),'afterUpdate':_0x9870('0x4'),'afterDestroy':_0x9870('0x5')};function emitEvent(_0x5762d9){return function(_0x189caa,_0x45b966,_0x3ae2da){_0x189caa[_0x9870('0x6')]({'attributes':['id'],'raw':!![]})[_0x9870('0x7')](function(_0x4ee41b){_0x189caa[_0x9870('0x8')]('Users',_0x4ee41b[_0x9870('0x9')](function(_0x5ebd04){return{'id':_0x5ebd04['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x189caa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9870('0x7')](function(_0x24a792){_0x189caa[_0x9870('0x8')]('unreadMessages',_0x24a792[_0x9870('0xa')]);OpenchannelInteractionEvents[_0x9870('0xb')](_0x5762d9+':'+_0x189caa['id'],_0x189caa);OpenchannelInteractionEvents[_0x9870('0xb')](_0x5762d9,_0x189caa);_0x3ae2da(null);})['catch'](_0x3ae2da(null));};}for(var e in events){if(events[_0x9870('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x9870('0xd')](e,emitEvent(event));}}module[_0x9870('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4f4d=['then','setDataValue','map','length','emit','hasOwnProperty','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','remove','getUsers'];(function(_0x591f88,_0x5267a8){var _0x401322=function(_0x373779){while(--_0x373779){_0x591f88['push'](_0x591f88['shift']());}};_0x401322(++_0x5267a8);}(_0x4f4d,0x1da));var _0xd4f4=function(_0x49dd98,_0x8dc77f){_0x49dd98=_0x49dd98-0x0;var _0x590ce3=_0x4f4d[_0x49dd98];return _0x590ce3;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xd4f4('0x0')];var OpenchannelMessage=require(_0xd4f4('0x1'))['db'][_0xd4f4('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd4f4('0x3'),'afterUpdate':'update','afterDestroy':_0xd4f4('0x4')};function emitEvent(_0x441eaf){return function(_0x2de198,_0x43dfdc,_0x187ff4){_0x2de198[_0xd4f4('0x5')]({'attributes':['id'],'raw':!![]})[_0xd4f4('0x6')](function(_0x52befa){_0x2de198[_0xd4f4('0x7')]('Users',_0x52befa[_0xd4f4('0x8')](function(_0x12d3cd){return{'id':_0x12d3cd['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x2de198['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd4f4('0x6')](function(_0x2a3c72){_0x2de198[_0xd4f4('0x7')]('unreadMessages',_0x2a3c72[_0xd4f4('0x9')]);OpenchannelInteractionEvents[_0xd4f4('0xa')](_0x441eaf+':'+_0x2de198['id'],_0x2de198);OpenchannelInteractionEvents[_0xd4f4('0xa')](_0x441eaf,_0x2de198);_0x187ff4(null);})['catch'](_0x187ff4(null));};}for(var e in events){if(events[_0xd4f4('0xb')](e)){var event=events[e];OpenchannelInteraction['hook'](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 935a79f..2afc178 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 _0x7fbc=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt'];(function(_0x12287a,_0x22f00c){var _0x2141a0=function(_0xeb3b07){while(--_0xeb3b07){_0x12287a['push'](_0x12287a['shift']());}};_0x2141a0(++_0x22f00c);}(_0x7fbc,0xdf));var _0xc7fb=function(_0x5766bc,_0x32a8a0){_0x5766bc=_0x5766bc-0x0;var _0x43d553=_0x7fbc[_0x5766bc];return _0x43d553;};'use strict';var _=require(_0xc7fb('0x0'));var util=require(_0xc7fb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc7fb('0x2'));var BPromise=require('bluebird');var rp=require(_0xc7fb('0x3'));var fs=require('fs');var path=require(_0xc7fb('0x4'));var rimraf=require(_0xc7fb('0x5'));var config=require('../../config/environment');var attributes=require(_0xc7fb('0x6'));module[_0xc7fb('0x7')]=function(_0x465ebf,_0x35bc3f){return _0x465ebf['define'](_0xc7fb('0x8'),attributes,{'tableName':_0xc7fb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc7fb('0xa'),'collate':_0xc7fb('0xb'),'hooks':{'beforeUpdate':function(_0x1dd905,_0x18fca9,_0x3a1c56){if(_0x1dd905[_0xc7fb('0xc')](_0xc7fb('0xd'))){_0x1dd905[_0xc7fb('0xe')]=moment()[_0xc7fb('0xf')](_0xc7fb('0x10'));}_0x3a1c56(null,_0x1dd905);}}});}; \ No newline at end of file +var _0x4095=['path','../../config/environment','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4095,0x1bd));var _0x5409=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x4095[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0x5409('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5409('0x1'));var moment=require(_0x5409('0x2'));var BPromise=require(_0x5409('0x3'));var rp=require(_0x5409('0x4'));var fs=require('fs');var path=require(_0x5409('0x5'));var rimraf=require('rimraf');var config=require(_0x5409('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x5409('0x7')]=function(_0x35cc99,_0x320612){return _0x35cc99['define'](_0x5409('0x8'),attributes,{'tableName':_0x5409('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5409('0xa'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5449fe,_0x42c473,_0x387426){if(_0x5449fe[_0x5409('0xb')]('closed')){_0x5449fe[_0x5409('0xc')]=moment()[_0x5409('0xd')](_0x5409('0xe'));}_0x387426(null,_0x5449fe);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e80ae3b..40b5cc8 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 _0x8e52=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','stringify','find','addTags','omit','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2d5457,_0x25ba33){var _0x3be1c3=function(_0x3db825){while(--_0x3db825){_0x2d5457['push'](_0x2d5457['shift']());}};_0x3be1c3(++_0x25ba33);}(_0x8e52,0x1c6));var _0x28e5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8e52[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x28e5('0x0'));var util=require(_0x28e5('0x1'));var moment=require(_0x28e5('0x2'));var BPromise=require(_0x28e5('0x3'));var rs=require(_0x28e5('0x4'));var fs=require('fs');var Redis=require(_0x28e5('0x5'));var db=require(_0x28e5('0x6'))['db'];var utils=require(_0x28e5('0x7'));var logger=require(_0x28e5('0x8'))(_0x28e5('0x9'));var config=require(_0x28e5('0xa'));var jayson=require(_0x28e5('0xb'));var client=jayson[_0x28e5('0xc')]['http']({'port':0x232a});config[_0x28e5('0xd')]=_[_0x28e5('0xe')](config[_0x28e5('0xd')],{'host':_0x28e5('0xf'),'port':0x18eb});var socket=require(_0x28e5('0x10'))(new Redis(config[_0x28e5('0xd')]));require(_0x28e5('0x11'))[_0x28e5('0x12')](socket);function respondWithRpcPromise(_0x78134e,_0x4489c0,_0x4101c5){return new BPromise(function(_0x13e552,_0x256dbd){return client[_0x28e5('0x13')](_0x78134e,_0x4101c5)[_0x28e5('0x14')](function(_0x141c72){logger['info'](_0x28e5('0x15'),_0x4489c0,_0x28e5('0x16'));logger[_0x28e5('0x17')](_0x28e5('0x18'),_0x4489c0,_0x28e5('0x16'),JSON['stringify'](_0x141c72));if(_0x141c72['error']){if(_0x141c72[_0x28e5('0x19')][_0x28e5('0x1a')]===0x1f4){logger[_0x28e5('0x19')](_0x28e5('0x15'),_0x4489c0,_0x141c72[_0x28e5('0x19')][_0x28e5('0x1b')]);return _0x256dbd(_0x141c72[_0x28e5('0x19')]['message']);}logger[_0x28e5('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4489c0,_0x141c72['error'][_0x28e5('0x1b')]);return _0x13e552(_0x141c72[_0x28e5('0x19')][_0x28e5('0x1b')]);}else{logger['info'](_0x28e5('0x15'),_0x4489c0,'request\x20sent');_0x13e552(_0x141c72[_0x28e5('0x1c')]['message']);}})[_0x28e5('0x1d')](function(_0x69c588){logger[_0x28e5('0x19')](_0x28e5('0x15'),_0x4489c0,_0x69c588);_0x256dbd(_0x69c588);});});}exports['UpdateOpenchannelInteraction']=function(_0x46e2e3){var _0x4c5968=this;return new Promise(function(_0x2bca13,_0x427430){return db[_0x28e5('0x1e')][_0x28e5('0x1f')](_0x46e2e3[_0x28e5('0x20')],{'raw':_0x46e2e3[_0x28e5('0x21')]?_0x46e2e3['options'][_0x28e5('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46e2e3[_0x28e5('0x21')]?_0x46e2e3[_0x28e5('0x21')][_0x28e5('0x23')]||null:null,'attributes':_0x46e2e3[_0x28e5('0x21')]?_0x46e2e3[_0x28e5('0x21')][_0x28e5('0x24')]||null:null,'limit':_0x46e2e3['options']?_0x46e2e3[_0x28e5('0x21')][_0x28e5('0x25')]||null:null})[_0x28e5('0x14')](function(_0x8061f){logger['info'](_0x28e5('0x26'),_0x46e2e3);logger[_0x28e5('0x17')](_0x28e5('0x26'),_0x46e2e3,JSON[_0x28e5('0x27')](_0x8061f));_0x2bca13(_0x8061f);})[_0x28e5('0x1d')](function(_0x2287fb){logger['error']('UpdateOpenchannelInteraction',_0x2287fb['message'],_0x46e2e3);_0x427430(_0x4c5968[_0x28e5('0x19')](0x1f4,_0x2287fb[_0x28e5('0x1b')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0xc8d977){return new Promise(function(_0x3f616b,_0x2c7e59){return db[_0x28e5('0x1e')][_0x28e5('0x28')]({'where':_0xc8d977[_0x28e5('0x21')]?_0xc8d977[_0x28e5('0x21')][_0x28e5('0x23')]||null:null})['then'](function(_0x336f36){if(_0x336f36){return _0x336f36[_0x28e5('0x29')](_0xc8d977[_0x28e5('0x20')]['ids'],_[_0x28e5('0x2a')](_0xc8d977[_0x28e5('0x20')],['ids','id'])||{});}})[_0x28e5('0x2b')](function(_0x29927f){logger[_0x28e5('0x2c')](_0x28e5('0x2d'),_0xc8d977);logger[_0x28e5('0x17')](_0x28e5('0x2d'),_0xc8d977,JSON[_0x28e5('0x27')](_0x29927f));_0x3f616b(_0x29927f);})['catch'](function(_0x149db9){logger[_0x28e5('0x19')](_0x28e5('0x2d'),_0x149db9[_0x28e5('0x1b')],_0xc8d977);_0x2c7e59(_this[_0x28e5('0x19')](0x1f4,_0x149db9[_0x28e5('0x1b')]));});});}; \ No newline at end of file +var _0x0e33=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','then','OpenchannelInteraction','find','addTags','ids','AddTags','stringify','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xc618fe,_0x5f2f8b){var _0x47373b=function(_0x318a0f){while(--_0x318a0f){_0xc618fe['push'](_0xc618fe['shift']());}};_0x47373b(++_0x5f2f8b);}(_0x0e33,0xbd));var _0x30e3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0e33[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x30e3('0x0'));var util=require(_0x30e3('0x1'));var moment=require(_0x30e3('0x2'));var BPromise=require(_0x30e3('0x3'));var rs=require(_0x30e3('0x4'));var fs=require('fs');var Redis=require(_0x30e3('0x5'));var db=require(_0x30e3('0x6'))['db'];var utils=require(_0x30e3('0x7'));var logger=require(_0x30e3('0x8'))(_0x30e3('0x9'));var config=require(_0x30e3('0xa'));var jayson=require(_0x30e3('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x30e3('0xc')]=_['defaults'](config[_0x30e3('0xc')],{'host':_0x30e3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x30e3('0xc')]));require('./openchannelInteraction.socket')[_0x30e3('0xe')](socket);function respondWithRpcPromise(_0x8b5dbc,_0x5e87bf,_0x4688a9){return new BPromise(function(_0x5a9a36,_0x5839d1){return client[_0x30e3('0xf')](_0x8b5dbc,_0x4688a9)['then'](function(_0x3410e9){logger[_0x30e3('0x10')](_0x30e3('0x11'),_0x5e87bf,_0x30e3('0x12'));logger[_0x30e3('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x5e87bf,'request\x20sent',JSON['stringify'](_0x3410e9));if(_0x3410e9[_0x30e3('0x14')]){if(_0x3410e9['error'][_0x30e3('0x15')]===0x1f4){logger[_0x30e3('0x14')](_0x30e3('0x11'),_0x5e87bf,_0x3410e9[_0x30e3('0x14')][_0x30e3('0x16')]);return _0x5839d1(_0x3410e9[_0x30e3('0x14')][_0x30e3('0x16')]);}logger[_0x30e3('0x14')](_0x30e3('0x11'),_0x5e87bf,_0x3410e9['error']['message']);return _0x5a9a36(_0x3410e9[_0x30e3('0x14')][_0x30e3('0x16')]);}else{logger['info'](_0x30e3('0x11'),_0x5e87bf,_0x30e3('0x12'));_0x5a9a36(_0x3410e9['result'][_0x30e3('0x16')]);}})[_0x30e3('0x17')](function(_0x2d6150){logger[_0x30e3('0x14')](_0x30e3('0x11'),_0x5e87bf,_0x2d6150);_0x5839d1(_0x2d6150);});});}exports[_0x30e3('0x18')]=function(_0x3a0443){var _0x1520e4=this;return new Promise(function(_0x5a96af,_0x3dbbb9){return db['OpenchannelInteraction'][_0x30e3('0x19')](_0x3a0443[_0x30e3('0x1a')],{'raw':_0x3a0443[_0x30e3('0x1b')]?_0x3a0443['options'][_0x30e3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a0443[_0x30e3('0x1b')]?_0x3a0443[_0x30e3('0x1b')][_0x30e3('0x1d')]||null:null,'attributes':_0x3a0443['options']?_0x3a0443[_0x30e3('0x1b')][_0x30e3('0x1e')]||null:null,'limit':_0x3a0443['options']?_0x3a0443[_0x30e3('0x1b')][_0x30e3('0x1f')]||null:null})[_0x30e3('0x20')](function(_0x15fafd){logger[_0x30e3('0x10')](_0x30e3('0x18'),_0x3a0443);logger[_0x30e3('0x13')]('UpdateOpenchannelInteraction',_0x3a0443,JSON['stringify'](_0x15fafd));_0x5a96af(_0x15fafd);})[_0x30e3('0x17')](function(_0x4978d9){logger['error'](_0x30e3('0x18'),_0x4978d9[_0x30e3('0x16')],_0x3a0443);_0x3dbbb9(_0x1520e4[_0x30e3('0x14')](0x1f4,_0x4978d9[_0x30e3('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x53dcba){return new Promise(function(_0x1d88eb,_0x4f3819){return db[_0x30e3('0x21')][_0x30e3('0x22')]({'where':_0x53dcba[_0x30e3('0x1b')]?_0x53dcba[_0x30e3('0x1b')][_0x30e3('0x1d')]||null:null})[_0x30e3('0x20')](function(_0x301ad9){if(_0x301ad9){return _0x301ad9[_0x30e3('0x23')](_0x53dcba[_0x30e3('0x1a')]['ids'],_['omit'](_0x53dcba[_0x30e3('0x1a')],[_0x30e3('0x24'),'id'])||{});}})['spread'](function(_0x2f734e){logger[_0x30e3('0x10')](_0x30e3('0x25'),_0x53dcba);logger['debug'](_0x30e3('0x25'),_0x53dcba,JSON[_0x30e3('0x26')](_0x2f734e));_0x1d88eb(_0x2f734e);})[_0x30e3('0x17')](function(_0x5b5b7a){logger[_0x30e3('0x14')](_0x30e3('0x25'),_0x5b5b7a[_0x30e3('0x16')],_0x53dcba);_0x4f3819(_this[_0x30e3('0x14')](0x1f4,_0x5b5b7a[_0x30e3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index da47f01..d892fae 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 _0xa114=['openchannelInteraction:','./openchannelInteraction.events','remove','emit','length'];(function(_0x1bb0b0,_0x2e56ba){var _0xb3573b=function(_0x55b4c8){while(--_0x55b4c8){_0x1bb0b0['push'](_0x1bb0b0['shift']());}};_0xb3573b(++_0x2e56ba);}(_0xa114,0x164));var _0x4a11=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0xa114[_0x3ba924];return _0x4cc1df;};'use strict';var OpenchannelInteractionEvents=require(_0x4a11('0x0'));var events=['save',_0x4a11('0x1'),'update'];function createListener(_0x16f1de,_0xd0fd06){return function(_0x1a8bb3){_0xd0fd06[_0x4a11('0x2')](_0x16f1de,_0x1a8bb3);};}function removeListener(_0xc081e0,_0x225f25){return function(){OpenchannelInteractionEvents['removeListener'](_0xc081e0,_0x225f25);};}exports['register']=function(_0x50d174){for(var _0x3f396e=0x0,_0x4231d4=events[_0x4a11('0x3')];_0x3f396e<_0x4231d4;_0x3f396e++){var _0x54e8d6=events[_0x3f396e];var _0xf143ac=createListener(_0x4a11('0x4')+_0x54e8d6,_0x50d174);OpenchannelInteractionEvents['on'](_0x54e8d6,_0xf143ac);}}; \ No newline at end of file +var _0x684b=['register','openchannelInteraction:','./openchannelInteraction.events','save','remove','emit','removeListener'];(function(_0xc106ce,_0x2c20cc){var _0x55260c=function(_0x12e6ba){while(--_0x12e6ba){_0xc106ce['push'](_0xc106ce['shift']());}};_0x55260c(++_0x2c20cc);}(_0x684b,0x17c));var _0xb684=function(_0x3cd47c,_0x5c0d63){_0x3cd47c=_0x3cd47c-0x0;var _0x4f454f=_0x684b[_0x3cd47c];return _0x4f454f;};'use strict';var OpenchannelInteractionEvents=require(_0xb684('0x0'));var events=[_0xb684('0x1'),_0xb684('0x2'),'update'];function createListener(_0x21d07f,_0x4310a5){return function(_0x38ce4b){_0x4310a5[_0xb684('0x3')](_0x21d07f,_0x38ce4b);};}function removeListener(_0x19d4b7,_0x5efce2){return function(){OpenchannelInteractionEvents[_0xb684('0x4')](_0x19d4b7,_0x5efce2);};}exports[_0xb684('0x5')]=function(_0x4e7f6d){for(var _0xd3a0ac=0x0,_0x4e129d=events['length'];_0xd3a0ac<_0x4e129d;_0xd3a0ac++){var _0x458829=events[_0xd3a0ac];var _0xeb2ec7=createListener(_0xb684('0x6')+_0x458829,_0x4e7f6d);OpenchannelInteractionEvents['on'](_0x458829,_0xeb2ec7);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9d812fa..56a1950 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0xe')]('/',auth[_0x3071('0x9')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x4e83d2,_0xd3fbb4){var _0x366b3b=function(_0x428233){while(--_0x428233){_0x4e83d2['push'](_0x4e83d2['shift']());}};_0x366b3b(++_0xd3fbb4);}(_0xe706,0xa3));var _0x6e70=function(_0x235e66,_0x4bef96){_0x235e66=_0x235e66-0x0;var _0x36019b=_0xe706[_0x235e66];return _0x36019b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index c48ebad..88ea82b 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 _0xe3d4=['out','STRING','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x110339,_0xded8c7){var _0x2cb138=function(_0xd25efd){while(--_0xd25efd){_0x110339['push'](_0x110339['shift']());}};_0x2cb138(++_0xded8c7);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x43db86,_0x34184b){_0x43db86=_0x43db86-0x0;var _0x27bda2=_0xe3d4[_0x43db86];return _0x27bda2;};'use strict';var Sequelize=require('sequelize');module[_0x4e3d('0x0')]={'body':{'type':Sequelize[_0x4e3d('0x1')](_0x4e3d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x4e3d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4e3d('0x4')]('in','out'),'defaultValue':_0x4e3d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x4e3d('0x6')]},'providerResponse':{'type':Sequelize[_0x4e3d('0x1')]}}; \ No newline at end of file +var _0x2cae=['out','DATE','STRING','sequelize','exports','BOOLEAN'];(function(_0x10c834,_0x233526){var _0x4c447a=function(_0x4aee1e){while(--_0x4aee1e){_0x10c834['push'](_0x10c834['shift']());}};_0x4c447a(++_0x233526);}(_0x2cae,0x16b));var _0xe2ca=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x2cae[_0x264545];return _0x114d10;};'use strict';var Sequelize=require(_0xe2ca('0x0'));module[_0xe2ca('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe2ca('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe2ca('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe2ca('0x3')),'defaultValue':_0xe2ca('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe2ca('0x4')]},'providerName':{'type':Sequelize[_0xe2ca('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f93cf70..f579093 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 _0x2fa9=['path','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./openchannelMessage.socket','register','jayson/promise','http','client','request','then','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','OpenchannelMessage,\x20%s,\x20%s','info','result','status','undefined','limit','count','offset','json','apply','save','update','destroy','sendStatus','stack','name','index','OpenchannelMessage','rawAttributes','fieldName','type','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','reject','OpenchannelInteraction','role','RejectMessage','rejectMessage','ContactId','Sequelize','EventManager','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x25fb1f,_0x4c2230){var _0x3f2dce=function(_0x236993){while(--_0x236993){_0x25fb1f['push'](_0x25fb1f['shift']());}};_0x3f2dce(++_0x4c2230);}(_0x2fa9,0x1e9));var _0x92fa=function(_0x381961,_0x297382){_0x381961=_0x381961-0x0;var _0x1a2de0=_0x2fa9[_0x381961];return _0x1a2de0;};'use strict';var emlformat=require(_0x92fa('0x0'));var rimraf=require(_0x92fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x92fa('0x2'));var moment=require(_0x92fa('0x3'));var BPromise=require(_0x92fa('0x4'));var Mustache=require(_0x92fa('0x5'));var util=require(_0x92fa('0x6'));var path=require(_0x92fa('0x7'));var sox=require('sox');var csv=require(_0x92fa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92fa('0x9'));var _=require('lodash');var squel=require(_0x92fa('0xa'));var crypto=require(_0x92fa('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x92fa('0x8'));var querystring=require(_0x92fa('0xc'));var Papa=require(_0x92fa('0xd'));var Redis=require(_0x92fa('0xe'));var authService=require(_0x92fa('0xf'));var qs=require(_0x92fa('0x10'));var as=require(_0x92fa('0x11'));var hardwareService=require(_0x92fa('0x12'));var logger=require('../../config/logger')(_0x92fa('0x13'));var utils=require(_0x92fa('0x14'));var config=require(_0x92fa('0x15'));var licenseUtil=require(_0x92fa('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x92fa('0x17')](config[_0x92fa('0x18')],{'host':_0x92fa('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x92fa('0x18')]));require(_0x92fa('0x1a'))[_0x92fa('0x1b')](socket);var jayson=require(_0x92fa('0x1c'));var client=jayson['client'][_0x92fa('0x1d')]({'port':0x232c});var client9002=jayson[_0x92fa('0x1e')][_0x92fa('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5dadd1,_0x2be260,_0x25ce5f,_0x1ab39d){return new BPromise(function(_0x4820a7,_0x5afd8c){var _0x16317f=_0x1ab39d||client;return _0x16317f[_0x92fa('0x1f')](_0x5dadd1,_0x25ce5f)[_0x92fa('0x20')](function(_0x20ba47){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2be260,_0x92fa('0x21'));logger[_0x92fa('0x22')](_0x92fa('0x23'),_0x2be260,_0x92fa('0x21'),JSON['stringify'](_0x20ba47));if(_0x20ba47[_0x92fa('0x24')]){if(_0x20ba47[_0x92fa('0x24')]['code']===0x1f4){logger[_0x92fa('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x2be260,_0x20ba47[_0x92fa('0x24')][_0x92fa('0x25')]);return _0x5afd8c(_0x20ba47['error'][_0x92fa('0x25')]);}logger[_0x92fa('0x24')](_0x92fa('0x26'),_0x2be260,_0x20ba47['error']['message']);return _0x4820a7(_0x20ba47[_0x92fa('0x24')][_0x92fa('0x25')]);}else{logger[_0x92fa('0x27')](_0x92fa('0x26'),_0x2be260,_0x92fa('0x21'));_0x4820a7(_0x20ba47[_0x92fa('0x28')][_0x92fa('0x25')]);}})['catch'](function(_0x57196f){logger[_0x92fa('0x24')](_0x92fa('0x26'),_0x2be260,_0x57196f);_0x5afd8c(_0x57196f);});});}function respondWithStatusCode(_0x34f6d0,_0x2a14eb){_0x2a14eb=_0x2a14eb||0xcc;return function(_0x44c334){if(_0x44c334){return _0x34f6d0['sendStatus'](_0x2a14eb);}return _0x34f6d0[_0x92fa('0x29')](_0x2a14eb)['end']();};}function respondWithResult(_0x4da957,_0x4095e3){_0x4095e3=_0x4095e3||0xc8;return function(_0x5b5786){if(_0x5b5786){return _0x4da957[_0x92fa('0x29')](_0x4095e3)['json'](_0x5b5786);}};}function respondWithFilteredResult(_0x47b327,_0x32e207){return function(_0x3d2860){if(_0x3d2860){var _0x5215e4=typeof _0x32e207['offset']===_0x92fa('0x2a')&&typeof _0x32e207[_0x92fa('0x2b')]==='undefined';var _0x1bd4f1=_0x3d2860[_0x92fa('0x2c')];var _0x2d4247=_0x5215e4?0x0:_0x32e207[_0x92fa('0x2d')];var _0x4a82c7=_0x5215e4?_0x3d2860[_0x92fa('0x2c')]:_0x32e207[_0x92fa('0x2d')]+_0x32e207[_0x92fa('0x2b')];var _0x4d8a7c;if(_0x4a82c7>=_0x1bd4f1){_0x4a82c7=_0x1bd4f1;_0x4d8a7c=0xc8;}else{_0x4d8a7c=0xce;}_0x47b327['status'](_0x4d8a7c);return _0x47b327['set']('Content-Range',_0x2d4247+'-'+_0x4a82c7+'/'+_0x1bd4f1)[_0x92fa('0x2e')](_0x3d2860);}return null;};}function patchUpdates(_0x5edee9){return function(_0x54e88d){try{jsonpatch[_0x92fa('0x2f')](_0x54e88d,_0x5edee9,!![]);}catch(_0xcc91a5){return BPromise['reject'](_0xcc91a5);}return _0x54e88d[_0x92fa('0x30')]();};}function saveUpdates(_0x297d26,_0x3b18af){return function(_0x53b2dc){if(_0x53b2dc){return _0x53b2dc[_0x92fa('0x31')](_0x297d26)[_0x92fa('0x20')](function(_0x57450b){return _0x57450b;});}return null;};}function removeEntity(_0x485997,_0x44f058){return function(_0x34100d){if(_0x34100d){return _0x34100d[_0x92fa('0x32')]()[_0x92fa('0x20')](function(){_0x485997[_0x92fa('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b70d8,_0x15362e){return function(_0xa6c117){if(!_0xa6c117){_0x2b70d8[_0x92fa('0x33')](0x194);}return _0xa6c117;};}function handleError(_0x62cd67,_0x568696){_0x568696=_0x568696||0x1f4;return function(_0x34a898){logger[_0x92fa('0x24')](_0x34a898[_0x92fa('0x34')]);if(_0x34a898[_0x92fa('0x35')]){delete _0x34a898[_0x92fa('0x35')];}_0x62cd67[_0x92fa('0x29')](_0x568696)['send'](_0x34a898);};}exports[_0x92fa('0x36')]=function(_0x5aaa0b,_0x5caf75){var _0x2a3df0={},_0xe1c0a2={},_0x530f33={'count':0x0,'rows':[]};var _0x5404f0=_['map'](db[_0x92fa('0x37')][_0x92fa('0x38')],function(_0x4fdf22){return{'name':_0x4fdf22[_0x92fa('0x39')],'type':_0x4fdf22[_0x92fa('0x3a')]['key']};});_0xe1c0a2['model']=_['map'](_0x5404f0,_0x92fa('0x35'));_0xe1c0a2[_0x92fa('0x3b')]=_['keys'](_0x5aaa0b[_0x92fa('0x3b')]);_0xe1c0a2[_0x92fa('0x3c')]=_['intersection'](_0xe1c0a2[_0x92fa('0x3d')],_0xe1c0a2[_0x92fa('0x3b')]);_0x2a3df0[_0x92fa('0x3e')]=_['intersection'](_0xe1c0a2[_0x92fa('0x3d')],qs[_0x92fa('0x3f')](_0x5aaa0b[_0x92fa('0x3b')]['fields']));_0x2a3df0[_0x92fa('0x3e')]=_0x2a3df0[_0x92fa('0x3e')]['length']?_0x2a3df0[_0x92fa('0x3e')]:_0xe1c0a2[_0x92fa('0x3d')];if(!_0x5aaa0b['query'][_0x92fa('0x40')](_0x92fa('0x41'))){_0x2a3df0['limit']=qs[_0x92fa('0x2b')](_0x5aaa0b[_0x92fa('0x3b')]['limit']);_0x2a3df0[_0x92fa('0x2d')]=qs[_0x92fa('0x2d')](_0x5aaa0b[_0x92fa('0x3b')][_0x92fa('0x2d')]);}_0x2a3df0[_0x92fa('0x42')]=qs['sort'](_0x5aaa0b[_0x92fa('0x3b')][_0x92fa('0x43')]);_0x2a3df0[_0x92fa('0x44')]=qs[_0x92fa('0x3c')](_[_0x92fa('0x45')](_0x5aaa0b[_0x92fa('0x3b')],_0xe1c0a2['filters']),_0x5404f0);if(_0x5aaa0b[_0x92fa('0x3b')]['filter']){_0x2a3df0[_0x92fa('0x44')]=_[_0x92fa('0x46')](_0x2a3df0[_0x92fa('0x44')],{'$or':_['map'](_0x5404f0,function(_0x51489c){if(_0x51489c[_0x92fa('0x3a')]!=='VIRTUAL'){var _0x4681ba={};_0x4681ba[_0x51489c[_0x92fa('0x35')]]={'$like':'%'+_0x5aaa0b[_0x92fa('0x3b')][_0x92fa('0x47')]+'%'};return _0x4681ba;}})});}_0x2a3df0=_[_0x92fa('0x46')]({},_0x2a3df0,_0x5aaa0b[_0x92fa('0x48')]);var _0x3d4b64={'where':_0x2a3df0[_0x92fa('0x44')]};return db['OpenchannelMessage'][_0x92fa('0x2c')](_0x3d4b64)[_0x92fa('0x20')](function(_0x3e49e8){_0x530f33[_0x92fa('0x2c')]=_0x3e49e8;if(_0x5aaa0b['query'][_0x92fa('0x49')]){_0x2a3df0[_0x92fa('0x4a')]=[{'all':!![]}];}return db[_0x92fa('0x37')][_0x92fa('0x4b')](_0x2a3df0);})['then'](function(_0x227ec0){_0x530f33[_0x92fa('0x4c')]=_0x227ec0;return _0x530f33;})['then'](respondWithFilteredResult(_0x5caf75,_0x2a3df0))[_0x92fa('0x4d')](handleError(_0x5caf75,null));};exports['show']=function(_0x14307e,_0x469ead){var _0x20ff92={'raw':!![],'where':{'id':_0x14307e[_0x92fa('0x4e')]['id']}},_0x36bbd7={};_0x36bbd7['model']=_[_0x92fa('0x4f')](db[_0x92fa('0x37')][_0x92fa('0x38')]);_0x36bbd7[_0x92fa('0x3b')]=_['keys'](_0x14307e['query']);_0x36bbd7[_0x92fa('0x3c')]=_['intersection'](_0x36bbd7['model'],_0x36bbd7[_0x92fa('0x3b')]);_0x20ff92[_0x92fa('0x3e')]=_['intersection'](_0x36bbd7[_0x92fa('0x3d')],qs[_0x92fa('0x3f')](_0x14307e[_0x92fa('0x3b')][_0x92fa('0x3f')]));_0x20ff92[_0x92fa('0x3e')]=_0x20ff92[_0x92fa('0x3e')]['length']?_0x20ff92[_0x92fa('0x3e')]:_0x36bbd7[_0x92fa('0x3d')];if(_0x14307e['query'][_0x92fa('0x49')]){_0x20ff92[_0x92fa('0x4a')]=[{'all':!![]}];}_0x20ff92=_[_0x92fa('0x46')]({},_0x20ff92,_0x14307e['options']);return db[_0x92fa('0x37')][_0x92fa('0x50')](_0x20ff92)['then'](handleEntityNotFound(_0x469ead,null))[_0x92fa('0x20')](respondWithResult(_0x469ead,null))[_0x92fa('0x4d')](handleError(_0x469ead,null));};exports[_0x92fa('0x51')]=function(_0x55acc9,_0x1d470c){return db[_0x92fa('0x37')][_0x92fa('0x51')](_0x55acc9[_0x92fa('0x52')],{})[_0x92fa('0x20')](respondWithResult(_0x1d470c,0xc9))[_0x92fa('0x4d')](handleError(_0x1d470c,null));};exports[_0x92fa('0x31')]=function(_0x35ab86,_0x1894f8){if(_0x35ab86[_0x92fa('0x52')]['id']){delete _0x35ab86[_0x92fa('0x52')]['id'];}return db['OpenchannelMessage'][_0x92fa('0x50')]({'where':{'id':_0x35ab86[_0x92fa('0x4e')]['id']}})[_0x92fa('0x20')](handleEntityNotFound(_0x1894f8,null))[_0x92fa('0x20')](saveUpdates(_0x35ab86[_0x92fa('0x52')],null))[_0x92fa('0x20')](respondWithResult(_0x1894f8,null))[_0x92fa('0x4d')](handleError(_0x1894f8,null));};exports[_0x92fa('0x32')]=function(_0x52fda7,_0x1a960f){return db[_0x92fa('0x37')][_0x92fa('0x50')]({'where':{'id':_0x52fda7['params']['id']}})[_0x92fa('0x20')](handleEntityNotFound(_0x1a960f,null))[_0x92fa('0x20')](removeEntity(_0x1a960f,null))[_0x92fa('0x4d')](handleError(_0x1a960f,null));};exports[_0x92fa('0x53')]=function(_0x50508d,_0x4833dc){return db['OpenchannelMessage'][_0x92fa('0x53')]()['then'](respondWithResult(_0x4833dc,null))[_0x92fa('0x4d')](handleError(_0x4833dc,null));};var interaction_log=require(_0x92fa('0x54'))(_0x92fa('0x55'));exports[_0x92fa('0x56')]=function(_0x445300,_0x1c28ac,_0x268a51){var _0x5b583c={'agent':{},'channel':_0x92fa('0x57')};if(_0x445300[_0x92fa('0x52')]['id']){delete _0x445300['body']['id'];}_0x445300['body'][_0x92fa('0x58')]=!![];_0x445300[_0x92fa('0x52')][_0x92fa('0x59')]=moment()[_0x92fa('0x5a')](_0x92fa('0x5b'));_0x445300[_0x92fa('0x52')][_0x92fa('0x5c')]=_0x445300[_0x92fa('0x52')][_0x92fa('0x5c')]||_0x445300[_0x92fa('0x5d')]['id'];_0x5b583c[_0x92fa('0x5e')]['id']=_0x445300[_0x92fa('0x52')]['UserId'];return db['OpenchannelMessage'][_0x92fa('0x50')]({'where':{'id':_0x445300['params']['id'],'UserId':null}})[_0x92fa('0x20')](handleEntityNotFound(_0x1c28ac,null))[_0x92fa('0x20')](saveUpdates(_0x445300[_0x92fa('0x52')],null))['then'](function(_0x384e39){if(_0x384e39){_0x5b583c[_0x92fa('0x25')]=_0x384e39[_0x92fa('0x5f')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x384e39[_0x92fa('0x60')]}});}return null;})[_0x92fa('0x20')](handleEntityNotFound(_0x1c28ac,null))[_0x92fa('0x20')](function(_0x4aafb9){if(_0x4aafb9){return _0x4aafb9['update']({'UserId':_0x445300[_0x92fa('0x52')][_0x92fa('0x5c')],'read1stAt':_['isNil'](_0x4aafb9[_0x92fa('0x61')])?moment()[_0x92fa('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x92fa('0x20')](function(_0x36b35a){if(_0x36b35a){_0x5b583c[_0x92fa('0x62')]=_0x36b35a[_0x92fa('0x5f')]({'plain':!![]});interaction_log[_0x92fa('0x27')](_0x92fa('0x63'),_0x445300[_0x92fa('0x5d')]['id'],_0x445300[_0x92fa('0x5d')][_0x92fa('0x35')],_0x445300[_0x92fa('0x5d')]['role'],_0x5b583c['interaction']['id'],_0x445300[_0x92fa('0x52')]?JSON[_0x92fa('0x64')](_0x445300[_0x92fa('0x52')]):_0x92fa('0x65'));return respondWithRpcPromise('AcceptMessage',_0x92fa('0x66'),_0x5b583c);}return null;})[_0x92fa('0x20')](function(_0x2d88f1){var _0x448ba9=_0x92fa('0x67')+_0x2d88f1[_0x92fa('0x25')]['ContactId'];return db[_0x92fa('0x68')][_0x92fa('0x3b')](_0x448ba9,{'type':db['Sequelize'][_0x92fa('0x69')][_0x92fa('0x6a')],'raw':!![]})['then'](function(_0x483bcb){return _0x483bcb;});})['then'](function(_0x321546){if(_0x321546){_0x5b583c['message'][_0x92fa('0x6b')]=_0x321546[0x0];if(!_0x445300[_0x92fa('0x52')][_0x92fa('0x5c')])return;return db['User']['find']({'where':{'id':_0x445300[_0x92fa('0x52')][_0x92fa('0x5c')],'role':_0x92fa('0x5e')},'attributes':['id',_0x92fa('0x35'),_0x92fa('0x6c'),'email',_0x92fa('0x6d')],'raw':!![]});}return null;})['then'](function(_0x5a09cc){if(!_0x5a09cc)return null;_0x5b583c['message']['agent']=_0x5a09cc;return _0x5b583c;})['then'](function(_0x13bf6b){if(_0x13bf6b){if(_0x445300['body'][_0x92fa('0x6e')]){_0x5b583c[_0x92fa('0x25')][_0x92fa('0x6f')]=util['format'](_0x92fa('0x70'),_0x445300[_0x92fa('0x5d')][_0x92fa('0x35')]);_0x5b583c[_0x92fa('0x25')][_0x92fa('0x71')]=_0x5b583c[_0x92fa('0x71')];_0x5b583c[_0x92fa('0x25')][_0x92fa('0x72')]=_0x5b583c[_0x92fa('0x71')];_0x5b583c[_0x92fa('0x25')][_0x92fa('0x73')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5b583c[_0x92fa('0x25')]},client9002)['then'](function(){return _0x5b583c;});}return _0x5b583c;}return null;})['then'](respondWithResult(_0x1c28ac,null))[_0x92fa('0x4d')](handleError(_0x1c28ac,null));};var interaction_log=require('../../config/logger')(_0x92fa('0x55'));exports[_0x92fa('0x74')]=function(_0x5acdf8,_0x16c08b,_0xc1be4e){var _0x2877e4={'agent':{},'channel':'openchannel'};if(_0x5acdf8[_0x92fa('0x52')]['id']){delete _0x5acdf8['body']['id'];}_0x5acdf8['body'][_0x92fa('0x5c')]=_0x5acdf8[_0x92fa('0x52')]['UserId']||_0x5acdf8[_0x92fa('0x5d')]['id'];_0x2877e4[_0x92fa('0x5e')]['id']=_0x5acdf8[_0x92fa('0x52')][_0x92fa('0x5c')];return db[_0x92fa('0x37')][_0x92fa('0x50')]({'where':{'id':_0x5acdf8[_0x92fa('0x4e')]['id'],'UserId':null}})[_0x92fa('0x20')](handleEntityNotFound(_0x16c08b,null))[_0x92fa('0x20')](function(_0x4e1fd1){if(_0x4e1fd1){_0x2877e4[_0x92fa('0x25')]=_0x4e1fd1[_0x92fa('0x5f')]({'plain':!![]});return db[_0x92fa('0x75')][_0x92fa('0x50')]({'where':{'id':_0x4e1fd1[_0x92fa('0x60')]}});}return null;})[_0x92fa('0x20')](handleEntityNotFound(_0x16c08b,null))[_0x92fa('0x20')](function(_0x37973d){if(_0x37973d){_0x2877e4['interaction']=_0x37973d[_0x92fa('0x5f')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5acdf8[_0x92fa('0x5d')]['id'],_0x5acdf8[_0x92fa('0x5d')][_0x92fa('0x35')],_0x5acdf8['user'][_0x92fa('0x76')],_0x2877e4['interaction']['id'],_0x5acdf8[_0x92fa('0x52')]?JSON['stringify'](_0x5acdf8[_0x92fa('0x52')]):'null');return respondWithRpcPromise(_0x92fa('0x77'),_0x92fa('0x78'),_0x2877e4);}return null;})[_0x92fa('0x20')](function(_0x298728){var _0x34e6fd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x298728[_0x92fa('0x25')][_0x92fa('0x79')];return db[_0x92fa('0x68')]['query'](_0x34e6fd,{'type':db[_0x92fa('0x7a')][_0x92fa('0x69')][_0x92fa('0x6a')],'raw':!![]})[_0x92fa('0x20')](function(_0x45101a){return _0x45101a;});})['then'](function(_0x3ced12){if(_0x3ced12){_0x2877e4['message'][_0x92fa('0x6b')]=_0x3ced12[0x0];if(!_0x5acdf8[_0x92fa('0x52')][_0x92fa('0x5c')])return;return db['User'][_0x92fa('0x50')]({'where':{'id':_0x5acdf8[_0x92fa('0x52')][_0x92fa('0x5c')],'role':'agent'},'attributes':['id',_0x92fa('0x35'),_0x92fa('0x6c'),'email',_0x92fa('0x6d')],'raw':!![]});}return null;})['then'](function(_0x17dd05){if(!_0x17dd05)return null;_0x2877e4[_0x92fa('0x25')][_0x92fa('0x5e')]=_0x17dd05;return _0x2877e4;})[_0x92fa('0x20')](function(_0x253ad1){if(_0x253ad1){_0x253ad1[_0x92fa('0x25')][_0x92fa('0x6f')]=util[_0x92fa('0x5a')](_0x92fa('0x70'),_0x5acdf8['user']['name']);_0x253ad1[_0x92fa('0x25')][_0x92fa('0x71')]=_0x2877e4[_0x92fa('0x71')];_0x253ad1[_0x92fa('0x25')]['motionChannel']=_0x2877e4[_0x92fa('0x71')];_0x253ad1[_0x92fa('0x25')][_0x92fa('0x73')]=_0x92fa('0x74');respondWithRpcPromise('EventManager',_0x92fa('0x7b'),{'event':'rejectmessage','message':_0x253ad1[_0x92fa('0x25')]},client9002);return _0x2877e4;}return null;})[_0x92fa('0x20')](respondWithResult(_0x16c08b,null))[_0x92fa('0x4d')](handleError(_0x16c08b,null));}; \ No newline at end of file +var _0xea6c=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','stack','name','map','OpenchannelMessage','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','keys','find','create','body','update','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request'];(function(_0x1fd9c1,_0x15f591){var _0x33f68a=function(_0x44be0b){while(--_0x44be0b){_0x1fd9c1['push'](_0x1fd9c1['shift']());}};_0x33f68a(++_0x15f591);}(_0xea6c,0x164));var _0xcea6=function(_0x5b9458,_0x184cc5){_0x5b9458=_0x5b9458-0x0;var _0x1134d4=_0xea6c[_0x5b9458];return _0x1134d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcea6('0x0'));var zipdir=require(_0xcea6('0x1'));var jsonpatch=require(_0xcea6('0x2'));var rp=require(_0xcea6('0x3'));var moment=require(_0xcea6('0x4'));var BPromise=require(_0xcea6('0x5'));var Mustache=require(_0xcea6('0x6'));var util=require(_0xcea6('0x7'));var path=require(_0xcea6('0x8'));var sox=require(_0xcea6('0x9'));var csv=require(_0xcea6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcea6('0xb'));var _=require('lodash');var squel=require(_0xcea6('0xc'));var crypto=require(_0xcea6('0xd'));var jsforce=require(_0xcea6('0xe'));var deskjs=require(_0xcea6('0xf'));var toCsv=require(_0xcea6('0xa'));var querystring=require('querystring');var Papa=require(_0xcea6('0x10'));var Redis=require(_0xcea6('0x11'));var authService=require(_0xcea6('0x12'));var qs=require(_0xcea6('0x13'));var as=require(_0xcea6('0x14'));var hardwareService=require(_0xcea6('0x15'));var logger=require(_0xcea6('0x16'))(_0xcea6('0x17'));var utils=require(_0xcea6('0x18'));var config=require(_0xcea6('0x19'));var licenseUtil=require(_0xcea6('0x1a'));var db=require('../../mysqldb')['db'];config[_0xcea6('0x1b')]=_[_0xcea6('0x1c')](config['redis'],{'host':_0xcea6('0x1d'),'port':0x18eb});var socket=require(_0xcea6('0x1e'))(new Redis(config[_0xcea6('0x1b')]));require(_0xcea6('0x1f'))[_0xcea6('0x20')](socket);var jayson=require(_0xcea6('0x21'));var client=jayson['client'][_0xcea6('0x22')]({'port':0x232c});var client9002=jayson[_0xcea6('0x23')][_0xcea6('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x56d51e,_0x209afd,_0x5c0532,_0x4744dc){return new BPromise(function(_0x233b3d,_0x4ccb5b){var _0x46a011=_0x4744dc||client;return _0x46a011[_0xcea6('0x24')](_0x56d51e,_0x5c0532)[_0xcea6('0x25')](function(_0x39a128){logger[_0xcea6('0x26')](_0xcea6('0x27'),_0x209afd,_0xcea6('0x28'));logger[_0xcea6('0x29')](_0xcea6('0x2a'),_0x209afd,'request\x20sent',JSON[_0xcea6('0x2b')](_0x39a128));if(_0x39a128[_0xcea6('0x2c')]){if(_0x39a128[_0xcea6('0x2c')]['code']===0x1f4){logger[_0xcea6('0x2c')](_0xcea6('0x27'),_0x209afd,_0x39a128['error']['message']);return _0x4ccb5b(_0x39a128[_0xcea6('0x2c')][_0xcea6('0x2d')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x209afd,_0x39a128['error'][_0xcea6('0x2d')]);return _0x233b3d(_0x39a128[_0xcea6('0x2c')]['message']);}else{logger[_0xcea6('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x209afd,'request\x20sent');_0x233b3d(_0x39a128['result'][_0xcea6('0x2d')]);}})[_0xcea6('0x2e')](function(_0xdf22da){logger[_0xcea6('0x2c')]('OpenchannelMessage,\x20%s,\x20%s',_0x209afd,_0xdf22da);_0x4ccb5b(_0xdf22da);});});}function respondWithStatusCode(_0x1fc827,_0x31e1b9){_0x31e1b9=_0x31e1b9||0xcc;return function(_0x474fa4){if(_0x474fa4){return _0x1fc827[_0xcea6('0x2f')](_0x31e1b9);}return _0x1fc827[_0xcea6('0x30')](_0x31e1b9)[_0xcea6('0x31')]();};}function respondWithResult(_0x57cb5,_0x2c46ed){_0x2c46ed=_0x2c46ed||0xc8;return function(_0x33ac52){if(_0x33ac52){return _0x57cb5[_0xcea6('0x30')](_0x2c46ed)[_0xcea6('0x32')](_0x33ac52);}};}function respondWithFilteredResult(_0x4585cf,_0xedf0ea){return function(_0xd9cdde){if(_0xd9cdde){var _0x2e3f4d=typeof _0xedf0ea[_0xcea6('0x33')]==='undefined'&&typeof _0xedf0ea[_0xcea6('0x34')]===_0xcea6('0x35');var _0x507da0=_0xd9cdde[_0xcea6('0x36')];var _0x476950=_0x2e3f4d?0x0:_0xedf0ea[_0xcea6('0x33')];var _0x58d276=_0x2e3f4d?_0xd9cdde[_0xcea6('0x36')]:_0xedf0ea['offset']+_0xedf0ea[_0xcea6('0x34')];var _0x3b3dd3;if(_0x58d276>=_0x507da0){_0x58d276=_0x507da0;_0x3b3dd3=0xc8;}else{_0x3b3dd3=0xce;}_0x4585cf[_0xcea6('0x30')](_0x3b3dd3);return _0x4585cf[_0xcea6('0x37')](_0xcea6('0x38'),_0x476950+'-'+_0x58d276+'/'+_0x507da0)[_0xcea6('0x32')](_0xd9cdde);}return null;};}function patchUpdates(_0x528b4b){return function(_0x2e500c){try{jsonpatch[_0xcea6('0x39')](_0x2e500c,_0x528b4b,!![]);}catch(_0x261533){return BPromise[_0xcea6('0x3a')](_0x261533);}return _0x2e500c['save']();};}function saveUpdates(_0x3a6824,_0x18b171){return function(_0x346a0e){if(_0x346a0e){return _0x346a0e['update'](_0x3a6824)[_0xcea6('0x25')](function(_0x493ca8){return _0x493ca8;});}return null;};}function removeEntity(_0xd86f2f,_0x31d237){return function(_0x4da04a){if(_0x4da04a){return _0x4da04a[_0xcea6('0x3b')]()['then'](function(){_0xd86f2f[_0xcea6('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5960d3,_0x584967){return function(_0x4f3ce4){if(!_0x4f3ce4){_0x5960d3[_0xcea6('0x2f')](0x194);}return _0x4f3ce4;};}function handleError(_0x88abb7,_0x44c880){_0x44c880=_0x44c880||0x1f4;return function(_0x29d2e7){logger['error'](_0x29d2e7[_0xcea6('0x3c')]);if(_0x29d2e7[_0xcea6('0x3d')]){delete _0x29d2e7[_0xcea6('0x3d')];}_0x88abb7[_0xcea6('0x30')](_0x44c880)['send'](_0x29d2e7);};}exports['index']=function(_0x375ac4,_0x1d9675){var _0x3d46c9={},_0x40181d={},_0x12aa7d={'count':0x0,'rows':[]};var _0x3e52af=_[_0xcea6('0x3e')](db[_0xcea6('0x3f')][_0xcea6('0x40')],function(_0xaa7a58){return{'name':_0xaa7a58['fieldName'],'type':_0xaa7a58['type'][_0xcea6('0x41')]};});_0x40181d[_0xcea6('0x42')]=_[_0xcea6('0x3e')](_0x3e52af,_0xcea6('0x3d'));_0x40181d[_0xcea6('0x43')]=_['keys'](_0x375ac4[_0xcea6('0x43')]);_0x40181d[_0xcea6('0x44')]=_['intersection'](_0x40181d[_0xcea6('0x42')],_0x40181d[_0xcea6('0x43')]);_0x3d46c9['attributes']=_[_0xcea6('0x45')](_0x40181d[_0xcea6('0x42')],qs[_0xcea6('0x46')](_0x375ac4[_0xcea6('0x43')][_0xcea6('0x46')]));_0x3d46c9[_0xcea6('0x47')]=_0x3d46c9['attributes'][_0xcea6('0x48')]?_0x3d46c9[_0xcea6('0x47')]:_0x40181d['model'];if(!_0x375ac4[_0xcea6('0x43')][_0xcea6('0x49')](_0xcea6('0x4a'))){_0x3d46c9[_0xcea6('0x34')]=qs[_0xcea6('0x34')](_0x375ac4[_0xcea6('0x43')][_0xcea6('0x34')]);_0x3d46c9['offset']=qs[_0xcea6('0x33')](_0x375ac4['query'][_0xcea6('0x33')]);}_0x3d46c9['order']=qs[_0xcea6('0x4b')](_0x375ac4[_0xcea6('0x43')][_0xcea6('0x4b')]);_0x3d46c9['where']=qs[_0xcea6('0x44')](_['pick'](_0x375ac4[_0xcea6('0x43')],_0x40181d[_0xcea6('0x44')]),_0x3e52af);if(_0x375ac4[_0xcea6('0x43')][_0xcea6('0x4c')]){_0x3d46c9[_0xcea6('0x4d')]=_[_0xcea6('0x4e')](_0x3d46c9[_0xcea6('0x4d')],{'$or':_['map'](_0x3e52af,function(_0x2c8275){if(_0x2c8275['type']!==_0xcea6('0x4f')){var _0x3a512d={};_0x3a512d[_0x2c8275[_0xcea6('0x3d')]]={'$like':'%'+_0x375ac4[_0xcea6('0x43')][_0xcea6('0x4c')]+'%'};return _0x3a512d;}})});}_0x3d46c9=_[_0xcea6('0x4e')]({},_0x3d46c9,_0x375ac4[_0xcea6('0x50')]);var _0x42ae71={'where':_0x3d46c9[_0xcea6('0x4d')]};return db[_0xcea6('0x3f')][_0xcea6('0x36')](_0x42ae71)[_0xcea6('0x25')](function(_0xec3e59){_0x12aa7d[_0xcea6('0x36')]=_0xec3e59;if(_0x375ac4[_0xcea6('0x43')][_0xcea6('0x51')]){_0x3d46c9['include']=[{'all':!![]}];}return db[_0xcea6('0x3f')]['findAll'](_0x3d46c9);})[_0xcea6('0x25')](function(_0x3b394c){_0x12aa7d[_0xcea6('0x52')]=_0x3b394c;return _0x12aa7d;})[_0xcea6('0x25')](respondWithFilteredResult(_0x1d9675,_0x3d46c9))[_0xcea6('0x2e')](handleError(_0x1d9675,null));};exports[_0xcea6('0x53')]=function(_0x4a3fc3,_0x3ee9da){var _0x3aa72c={'raw':!![],'where':{'id':_0x4a3fc3[_0xcea6('0x54')]['id']}},_0xe869da={};_0xe869da[_0xcea6('0x42')]=_[_0xcea6('0x55')](db[_0xcea6('0x3f')][_0xcea6('0x40')]);_0xe869da[_0xcea6('0x43')]=_[_0xcea6('0x55')](_0x4a3fc3['query']);_0xe869da[_0xcea6('0x44')]=_[_0xcea6('0x45')](_0xe869da[_0xcea6('0x42')],_0xe869da['query']);_0x3aa72c[_0xcea6('0x47')]=_[_0xcea6('0x45')](_0xe869da[_0xcea6('0x42')],qs[_0xcea6('0x46')](_0x4a3fc3[_0xcea6('0x43')]['fields']));_0x3aa72c[_0xcea6('0x47')]=_0x3aa72c['attributes']['length']?_0x3aa72c[_0xcea6('0x47')]:_0xe869da[_0xcea6('0x42')];if(_0x4a3fc3[_0xcea6('0x43')]['includeAll']){_0x3aa72c['include']=[{'all':!![]}];}_0x3aa72c=_['merge']({},_0x3aa72c,_0x4a3fc3['options']);return db[_0xcea6('0x3f')][_0xcea6('0x56')](_0x3aa72c)[_0xcea6('0x25')](handleEntityNotFound(_0x3ee9da,null))[_0xcea6('0x25')](respondWithResult(_0x3ee9da,null))[_0xcea6('0x2e')](handleError(_0x3ee9da,null));};exports[_0xcea6('0x57')]=function(_0x1ed669,_0x3c29ee){return db[_0xcea6('0x3f')]['create'](_0x1ed669[_0xcea6('0x58')],{})[_0xcea6('0x25')](respondWithResult(_0x3c29ee,0xc9))[_0xcea6('0x2e')](handleError(_0x3c29ee,null));};exports[_0xcea6('0x59')]=function(_0x434a4b,_0x4fa502){if(_0x434a4b[_0xcea6('0x58')]['id']){delete _0x434a4b[_0xcea6('0x58')]['id'];}return db[_0xcea6('0x3f')][_0xcea6('0x56')]({'where':{'id':_0x434a4b[_0xcea6('0x54')]['id']}})[_0xcea6('0x25')](handleEntityNotFound(_0x4fa502,null))['then'](saveUpdates(_0x434a4b[_0xcea6('0x58')],null))[_0xcea6('0x25')](respondWithResult(_0x4fa502,null))[_0xcea6('0x2e')](handleError(_0x4fa502,null));};exports[_0xcea6('0x3b')]=function(_0x13477a,_0x19fa20){return db['OpenchannelMessage'][_0xcea6('0x56')]({'where':{'id':_0x13477a[_0xcea6('0x54')]['id']}})[_0xcea6('0x25')](handleEntityNotFound(_0x19fa20,null))[_0xcea6('0x25')](removeEntity(_0x19fa20,null))[_0xcea6('0x2e')](handleError(_0x19fa20,null));};exports[_0xcea6('0x5a')]=function(_0x17cbb9,_0x205561){return db[_0xcea6('0x3f')][_0xcea6('0x5a')]()[_0xcea6('0x25')](respondWithResult(_0x205561,null))[_0xcea6('0x2e')](handleError(_0x205561,null));};var interaction_log=require(_0xcea6('0x16'))('openchannel-interactions');exports[_0xcea6('0x5b')]=function(_0x10f01c,_0x5d80b7,_0x394a27){var _0x5038a0={'agent':{},'channel':'openchannel'};if(_0x10f01c['body']['id']){delete _0x10f01c[_0xcea6('0x58')]['id'];}_0x10f01c[_0xcea6('0x58')][_0xcea6('0x5c')]=!![];_0x10f01c[_0xcea6('0x58')][_0xcea6('0x5d')]=moment()[_0xcea6('0x5e')](_0xcea6('0x5f'));_0x10f01c[_0xcea6('0x58')][_0xcea6('0x60')]=_0x10f01c[_0xcea6('0x58')]['UserId']||_0x10f01c[_0xcea6('0x61')]['id'];_0x5038a0['agent']['id']=_0x10f01c[_0xcea6('0x58')][_0xcea6('0x60')];return db[_0xcea6('0x3f')][_0xcea6('0x56')]({'where':{'id':_0x10f01c[_0xcea6('0x54')]['id'],'UserId':null}})[_0xcea6('0x25')](handleEntityNotFound(_0x5d80b7,null))[_0xcea6('0x25')](saveUpdates(_0x10f01c[_0xcea6('0x58')],null))['then'](function(_0x128d41){if(_0x128d41){_0x5038a0[_0xcea6('0x2d')]=_0x128d41[_0xcea6('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xcea6('0x56')]({'where':{'id':_0x128d41[_0xcea6('0x63')]}});}return null;})[_0xcea6('0x25')](handleEntityNotFound(_0x5d80b7,null))[_0xcea6('0x25')](function(_0x41f6fa){if(_0x41f6fa){return _0x41f6fa['update']({'UserId':_0x10f01c[_0xcea6('0x58')][_0xcea6('0x60')],'read1stAt':_[_0xcea6('0x64')](_0x41f6fa[_0xcea6('0x65')])?moment()[_0xcea6('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x1c2812){if(_0x1c2812){_0x5038a0[_0xcea6('0x66')]=_0x1c2812[_0xcea6('0x62')]({'plain':!![]});interaction_log[_0xcea6('0x26')](_0xcea6('0x67'),_0x10f01c['user']['id'],_0x10f01c['user'][_0xcea6('0x3d')],_0x10f01c[_0xcea6('0x61')]['role'],_0x5038a0['interaction']['id'],_0x10f01c['body']?JSON['stringify'](_0x10f01c[_0xcea6('0x58')]):'null');return respondWithRpcPromise(_0xcea6('0x68'),'acceptMessage',_0x5038a0);}return null;})['then'](function(_0x395374){var _0x54073f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x395374[_0xcea6('0x2d')]['ContactId'];return db['sequelize'][_0xcea6('0x43')](_0x54073f,{'type':db[_0xcea6('0x69')][_0xcea6('0x6a')][_0xcea6('0x6b')],'raw':!![]})[_0xcea6('0x25')](function(_0x1385ef){return _0x1385ef;});})[_0xcea6('0x25')](function(_0x1afb70){if(_0x1afb70){_0x5038a0[_0xcea6('0x2d')][_0xcea6('0x6c')]=_0x1afb70[0x0];if(!_0x10f01c[_0xcea6('0x58')][_0xcea6('0x60')])return;return db[_0xcea6('0x6d')]['find']({'where':{'id':_0x10f01c[_0xcea6('0x58')][_0xcea6('0x60')],'role':_0xcea6('0x6e')},'attributes':['id','name',_0xcea6('0x6f'),_0xcea6('0x70'),_0xcea6('0x71')],'raw':!![]});}return null;})[_0xcea6('0x25')](function(_0x263e31){if(!_0x263e31)return null;_0x5038a0[_0xcea6('0x2d')][_0xcea6('0x6e')]=_0x263e31;return _0x5038a0;})[_0xcea6('0x25')](function(_0x4d4668){if(_0x4d4668){if(_0x10f01c['body'][_0xcea6('0x72')]){_0x5038a0['message'][_0xcea6('0x73')]=util['format'](_0xcea6('0x74'),_0x10f01c[_0xcea6('0x61')][_0xcea6('0x3d')]);_0x5038a0[_0xcea6('0x2d')][_0xcea6('0x75')]=_0x5038a0[_0xcea6('0x75')];_0x5038a0[_0xcea6('0x2d')][_0xcea6('0x76')]=_0x5038a0[_0xcea6('0x75')];_0x5038a0[_0xcea6('0x2d')][_0xcea6('0x77')]='accept';return respondWithRpcPromise(_0xcea6('0x78'),_0xcea6('0x78'),{'event':_0xcea6('0x79'),'message':_0x5038a0[_0xcea6('0x2d')]},client9002)[_0xcea6('0x25')](function(){return _0x5038a0;});}return _0x5038a0;}return null;})[_0xcea6('0x25')](respondWithResult(_0x5d80b7,null))[_0xcea6('0x2e')](handleError(_0x5d80b7,null));};var interaction_log=require(_0xcea6('0x16'))(_0xcea6('0x7a'));exports[_0xcea6('0x3a')]=function(_0x2f555d,_0x58772e,_0x5d8630){var _0x2d359a={'agent':{},'channel':'openchannel'};if(_0x2f555d['body']['id']){delete _0x2f555d[_0xcea6('0x58')]['id'];}_0x2f555d['body'][_0xcea6('0x60')]=_0x2f555d['body']['UserId']||_0x2f555d[_0xcea6('0x61')]['id'];_0x2d359a[_0xcea6('0x6e')]['id']=_0x2f555d[_0xcea6('0x58')]['UserId'];return db[_0xcea6('0x3f')][_0xcea6('0x56')]({'where':{'id':_0x2f555d[_0xcea6('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x58772e,null))[_0xcea6('0x25')](function(_0x2c4dce){if(_0x2c4dce){_0x2d359a[_0xcea6('0x2d')]=_0x2c4dce[_0xcea6('0x62')]({'plain':!![]});return db[_0xcea6('0x7b')][_0xcea6('0x56')]({'where':{'id':_0x2c4dce['OpenchannelInteractionId']}});}return null;})[_0xcea6('0x25')](handleEntityNotFound(_0x58772e,null))['then'](function(_0x4da0bc){if(_0x4da0bc){_0x2d359a[_0xcea6('0x66')]=_0x4da0bc[_0xcea6('0x62')]({'plain':!![]});interaction_log['info'](_0xcea6('0x7c'),_0x2f555d['user']['id'],_0x2f555d[_0xcea6('0x61')][_0xcea6('0x3d')],_0x2f555d[_0xcea6('0x61')][_0xcea6('0x7d')],_0x2d359a[_0xcea6('0x66')]['id'],_0x2f555d[_0xcea6('0x58')]?JSON[_0xcea6('0x2b')](_0x2f555d[_0xcea6('0x58')]):'null');return respondWithRpcPromise(_0xcea6('0x7e'),_0xcea6('0x7f'),_0x2d359a);}return null;})['then'](function(_0x525b9f){var _0x4258d7=_0xcea6('0x80')+_0x525b9f['message'][_0xcea6('0x81')];return db['sequelize'][_0xcea6('0x43')](_0x4258d7,{'type':db[_0xcea6('0x69')][_0xcea6('0x6a')]['SELECT'],'raw':!![]})['then'](function(_0x3127d2){return _0x3127d2;});})[_0xcea6('0x25')](function(_0x156d20){if(_0x156d20){_0x2d359a[_0xcea6('0x2d')][_0xcea6('0x6c')]=_0x156d20[0x0];if(!_0x2f555d['body'][_0xcea6('0x60')])return;return db['User'][_0xcea6('0x56')]({'where':{'id':_0x2f555d[_0xcea6('0x58')][_0xcea6('0x60')],'role':'agent'},'attributes':['id',_0xcea6('0x3d'),_0xcea6('0x6f'),_0xcea6('0x70'),_0xcea6('0x71')],'raw':!![]});}return null;})[_0xcea6('0x25')](function(_0x5b8818){if(!_0x5b8818)return null;_0x2d359a[_0xcea6('0x2d')]['agent']=_0x5b8818;return _0x2d359a;})[_0xcea6('0x25')](function(_0xa99c46){if(_0xa99c46){_0xa99c46[_0xcea6('0x2d')][_0xcea6('0x73')]=util[_0xcea6('0x5e')](_0xcea6('0x74'),_0x2f555d['user'][_0xcea6('0x3d')]);_0xa99c46[_0xcea6('0x2d')][_0xcea6('0x75')]=_0x2d359a['channel'];_0xa99c46[_0xcea6('0x2d')][_0xcea6('0x76')]=_0x2d359a[_0xcea6('0x75')];_0xa99c46[_0xcea6('0x2d')][_0xcea6('0x77')]=_0xcea6('0x3a');respondWithRpcPromise(_0xcea6('0x78'),_0xcea6('0x78'),{'event':_0xcea6('0x82'),'message':_0xa99c46['message']},client9002);return _0x2d359a;}return null;})['then'](respondWithResult(_0x58772e,null))[_0xcea6('0x2e')](handleError(_0x58772e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 422a084..a174417 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 _0xe30d=['exports','events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hook'];(function(_0x407867,_0x126b05){var _0x17e975=function(_0x366ce4){while(--_0x366ce4){_0x407867['push'](_0x407867['shift']());}};_0x17e975(++_0x126b05);}(_0xe30d,0x7f));var _0xde30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe30d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xde30('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xde30('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xde30('0x2')](0x0);var events={'afterCreate':_0xde30('0x3'),'afterUpdate':_0xde30('0x4'),'afterDestroy':_0xde30('0x5')};function emitEvent(_0x56ba60){return function(_0x3ef50f,_0x2b4d35,_0x28d6ed){OpenchannelMessageEvents['emit'](_0x56ba60+':'+_0x3ef50f['id'],_0x3ef50f);OpenchannelMessageEvents[_0xde30('0x6')](_0x56ba60,_0x3ef50f);_0x28d6ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xde30('0x7')](e,emitEvent(event));}}module[_0xde30('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x3c51=['events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3f917e,_0x30bd9c){var _0x3a5098=function(_0x5c3956){while(--_0x5c3956){_0x3f917e['push'](_0x3f917e['shift']());}};_0x3a5098(++_0x30bd9c);}(_0x3c51,0xb4));var _0x13c5=function(_0xae4ea5,_0x23ffe5){_0xae4ea5=_0xae4ea5-0x0;var _0x46952c=_0x3c51[_0xae4ea5];return _0x46952c;};'use strict';var EventEmitter=require(_0x13c5('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x13c5('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x13c5('0x2')](0x0);var events={'afterCreate':_0x13c5('0x3'),'afterUpdate':_0x13c5('0x4'),'afterDestroy':_0x13c5('0x5')};function emitEvent(_0x43537e){return function(_0x1abb95,_0x2f97a0,_0x203741){OpenchannelMessageEvents['emit'](_0x43537e+':'+_0x1abb95['id'],_0x1abb95);OpenchannelMessageEvents[_0x13c5('0x6')](_0x43537e,_0x1abb95);_0x203741(null);};}for(var e in events){if(events[_0x13c5('0x7')](e)){var event=events[e];OpenchannelMessage[_0x13c5('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 13c093e..762e635 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 _0x957c=['out','isNil','findOne','then','createdAt','error','secret','CmContact','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','OpenchannelInteractionId','keys','replyUri','info','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','catch','inspect','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','models','get','direction','toLowerCase'];(function(_0x501f76,_0x291b7e){var _0x15fbe4=function(_0x3c3504){while(--_0x3c3504){_0x501f76['push'](_0x501f76['shift']());}};_0x15fbe4(++_0x291b7e);}(_0x957c,0xf1));var _0xc957=function(_0x15211f,_0x37c029){_0x15211f=_0x15211f-0x0;var _0x2c9af1=_0x957c[_0x15211f];return _0x2c9af1;};'use strict';var _=require(_0xc957('0x0'));var util=require(_0xc957('0x1'));var logger=require(_0xc957('0x2'))(_0xc957('0x3'));var moment=require(_0xc957('0x4'));var BPromise=require(_0xc957('0x5'));var rp=require(_0xc957('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc957('0x7'));var config=require(_0xc957('0x8'));var attributes=require(_0xc957('0x9'));module[_0xc957('0xa')]=function(_0x3adcfa,_0x4b1c4b){return _0x3adcfa[_0xc957('0xb')](_0xc957('0xc'),attributes,{'tableName':_0xc957('0xd'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xc957('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x207ffe,_0x51353c,_0x41ab84){var _0x5c27c2=_0x3adcfa[_0xc957('0xf')];var _0x284231=_0x207ffe[_0xc957('0x10')]({'plain':!![]});if(_0x284231[_0xc957('0x11')][_0xc957('0x12')]()==='in'||_0x284231[_0xc957('0x11')]['toLowerCase']()===_0xc957('0x13')&&!_0x284231['secret']&&!_[_0xc957('0x14')](_0x284231['UserId'])){_0x5c27c2['OpenchannelInteraction'][_0xc957('0x15')]({'where':{'id':_0x284231['OpenchannelInteractionId']}})[_0xc957('0x16')](function(_0x50da96){if(_0x50da96){_0x50da96['update']({'lastMsgAt':_0x284231[_0xc957('0x17')],'lastMsgDirection':_0x284231[_0xc957('0x11')][_0xc957('0x12')]()});}})['catch'](function(_0x1d8056){console[_0xc957('0x18')](_0x1d8056);});}if(_0x284231[_0xc957('0x11')]===_0xc957('0x13')&&!_0x284231[_0xc957('0x19')]){var _0x20d79b;_0x5c27c2[_0xc957('0x1a')]['describe']()[_0xc957('0x16')](function(_0x4aab71){return _0x5c27c2[_0xc957('0x1b')][_0xc957('0x1c')]({'where':{'id':_0x284231[_0xc957('0x1d')]},'include':[{'model':_0x5c27c2[_0xc957('0x1e')],'as':_0xc957('0x1f'),'where':{'id':_0x284231[_0xc957('0x20')]},'limit':0x1,'include':[{'model':_0x5c27c2['CmContact'],'as':'Contact','attributes':_[_0xc957('0x21')](_0x4aab71)}]}]});})[_0xc957('0x16')](function(_0x1ca044){_0x20d79b=_0x1ca044[_0xc957('0x10')]({'plain':!![]});if(_0x20d79b&&_0x20d79b[_0xc957('0x22')]){logger[_0xc957('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util['format'](_0xc957('0x24'),_0x284231['id'],_0x20d79b[_0xc957('0x22')]));if(_0x20d79b[_0xc957('0x1f')]&&_0x20d79b[_0xc957('0x1f')][_0xc957('0x25')]){_0x284231[_0xc957('0x26')]=_[_0xc957('0x27')](_0x20d79b[_0xc957('0x1f')][0x0],_0xc957('0x28'));_0x284231[_0xc957('0x28')]=_0x20d79b[_0xc957('0x1f')][0x0][_0xc957('0x28')];}var _0x51353c={'method':_0xc957('0x29'),'uri':encodeURI(_0x20d79b[_0xc957('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x51353c[_0xc957('0x2a')]){case _0xc957('0x2b'):_0x51353c['qs']=_0x284231;break;case _0xc957('0x29'):_0x51353c['body']=_0x284231;break;}return rp(_0x51353c)[_0xc957('0x16')](function(_0x1fdedb){logger['info'](_0xc957('0x2c'),'afterCreate',util[_0xc957('0x2d')](_0xc957('0x2e'),_0x284231['id'],_0x20d79b[_0xc957('0x22')]));if(_0x1fdedb[_0xc957('0xe')]['threadId']&&_0x1fdedb[_0xc957('0xe')][_0xc957('0x2f')]!=_0x284231[_0xc957('0x26')]['threadId']){return _0x5c27c2[_0xc957('0x1e')][_0xc957('0x30')]({'threadId':_0x1fdedb[_0xc957('0xe')][_0xc957('0x2f')]},{'where':{'id':_0x284231[_0xc957('0x26')]['id']}});}else{return;}})['then'](function(){return _0x207ffe[_0xc957('0x30')]({'read':!![]});})[_0xc957('0x31')](function(_0x37db4e){logger[_0xc957('0x18')](_0xc957('0x2c'),'afterCreate',util[_0xc957('0x32')](_0x37db4e,{'showHidden':![],'depth':null}));_0x41ab84();});}else{_0x41ab84();}})['finally'](function(){_0x41ab84();});}else{_0x41ab84();}}},'charset':_0xc957('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa96a=['omit','POST','method','GET','afterCreate','threadId','update','error','OpenchannelMessage,\x20%s,\x20%s','inspect','finally','utf8mb4','lodash','util','api','moment','request-promise','path','rimraf','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','secret','isNil','UserId','findOne','OpenchannelInteractionId','createdAt','toLowerCase','catch','out','CmContact','describe','then','OpenchannelAccount','find','OpenchannelInteraction','Contact','keys','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction'];(function(_0xab8ffa,_0x29179d){var _0x173c69=function(_0x595e6e){while(--_0x595e6e){_0xab8ffa['push'](_0xab8ffa['shift']());}};_0x173c69(++_0x29179d);}(_0xa96a,0x178));var _0xaa96=function(_0x2ab721,_0x196fa5){_0x2ab721=_0x2ab721-0x0;var _0x4be0b0=_0xa96a[_0x2ab721];return _0x4be0b0;};'use strict';var _=require(_0xaa96('0x0'));var util=require(_0xaa96('0x1'));var logger=require('../../config/logger')(_0xaa96('0x2'));var moment=require(_0xaa96('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa96('0x4'));var fs=require('fs');var path=require(_0xaa96('0x5'));var rimraf=require(_0xaa96('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa96('0x7'));module['exports']=function(_0x41d9fc,_0x2c7b04){return _0x41d9fc[_0xaa96('0x8')](_0xaa96('0x9'),attributes,{'tableName':_0xaa96('0xa'),'paranoid':![],'indexes':[{'name':_0xaa96('0xb'),'fields':[_0xaa96('0xc')],'type':_0xaa96('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41aa8c,_0x3b3f78,_0x4fe2cd){var _0x59698b=_0x41d9fc['models'];var _0x31e7c3=_0x41aa8c[_0xaa96('0xe')]({'plain':!![]});if(_0x31e7c3[_0xaa96('0xf')]['toLowerCase']()==='in'||_0x31e7c3['direction']['toLowerCase']()==='out'&&!_0x31e7c3[_0xaa96('0x10')]&&!_[_0xaa96('0x11')](_0x31e7c3[_0xaa96('0x12')])){_0x59698b['OpenchannelInteraction'][_0xaa96('0x13')]({'where':{'id':_0x31e7c3[_0xaa96('0x14')]}})['then'](function(_0x181c77){if(_0x181c77){_0x181c77['update']({'lastMsgAt':_0x31e7c3[_0xaa96('0x15')],'lastMsgDirection':_0x31e7c3[_0xaa96('0xf')][_0xaa96('0x16')]()});}})[_0xaa96('0x17')](function(_0x1ff5e4){console['error'](_0x1ff5e4);});}if(_0x31e7c3['direction']===_0xaa96('0x18')&&!_0x31e7c3[_0xaa96('0x10')]){var _0x23935c;_0x59698b[_0xaa96('0x19')][_0xaa96('0x1a')]()[_0xaa96('0x1b')](function(_0xecdd53){return _0x59698b[_0xaa96('0x1c')][_0xaa96('0x1d')]({'where':{'id':_0x31e7c3['OpenchannelAccountId']},'include':[{'model':_0x59698b[_0xaa96('0x1e')],'as':'Interactions','where':{'id':_0x31e7c3['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x59698b[_0xaa96('0x19')],'as':_0xaa96('0x1f'),'attributes':_[_0xaa96('0x20')](_0xecdd53)}]}]});})[_0xaa96('0x1b')](function(_0x39ea7e){_0x23935c=_0x39ea7e['get']({'plain':!![]});if(_0x23935c&&_0x23935c[_0xaa96('0x21')]){logger[_0xaa96('0x22')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xaa96('0x23')](_0xaa96('0x24'),_0x31e7c3['id'],_0x23935c[_0xaa96('0x21')]));if(_0x23935c[_0xaa96('0x25')]&&_0x23935c['Interactions'][_0xaa96('0x26')]){_0x31e7c3[_0xaa96('0x27')]=_[_0xaa96('0x28')](_0x23935c['Interactions'][0x0],_0xaa96('0x1f'));_0x31e7c3[_0xaa96('0x1f')]=_0x23935c['Interactions'][0x0][_0xaa96('0x1f')];}var _0x3b3f78={'method':_0xaa96('0x29'),'uri':encodeURI(_0x23935c[_0xaa96('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3b3f78[_0xaa96('0x2a')]){case _0xaa96('0x2b'):_0x3b3f78['qs']=_0x31e7c3;break;case _0xaa96('0x29'):_0x3b3f78[_0xaa96('0xc')]=_0x31e7c3;break;}return rp(_0x3b3f78)[_0xaa96('0x1b')](function(_0x1b1341){logger[_0xaa96('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0xaa96('0x2c'),util[_0xaa96('0x23')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x31e7c3['id'],_0x23935c[_0xaa96('0x21')]));if(_0x1b1341['body'][_0xaa96('0x2d')]&&_0x1b1341[_0xaa96('0xc')]['threadId']!=_0x31e7c3[_0xaa96('0x27')][_0xaa96('0x2d')]){return _0x59698b['OpenchannelInteraction']['update']({'threadId':_0x1b1341['body'][_0xaa96('0x2d')]},{'where':{'id':_0x31e7c3[_0xaa96('0x27')]['id']}});}else{return;}})[_0xaa96('0x1b')](function(){return _0x41aa8c[_0xaa96('0x2e')]({'read':!![]});})[_0xaa96('0x17')](function(_0x459551){logger[_0xaa96('0x2f')](_0xaa96('0x30'),_0xaa96('0x2c'),util[_0xaa96('0x31')](_0x459551,{'showHidden':![],'depth':null}));_0x4fe2cd();});}else{_0x4fe2cd();}})[_0xaa96('0x32')](function(){_0x4fe2cd();});}else{_0x4fe2cd();}}},'charset':_0xaa96('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index de944e1..09bce38 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 _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x36d57f,_0x2f9118){var _0x3f93fb=function(_0x567b58){while(--_0x567b58){_0x36d57f['push'](_0x36d57f['shift']());}};_0x3f93fb(++_0x2f9118);}(_0xdb28,0x106));var _0x8db2=function(_0x27aa81,_0x2e8750){_0x27aa81=_0x27aa81-0x0;var _0x559a99=_0xdb28[_0x27aa81];return _0x559a99;};'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});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ 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(_0x2577f7,_0x4e4781){var _0x55d372=function(_0x59b397){while(--_0x59b397){_0x2577f7['push'](_0x2577f7['shift']());}};_0x55d372(++_0x4e4781);}(_0x1261,0x144));var _0x1126=function(_0xc2e46e,_0x3b979c){_0xc2e46e=_0xc2e46e-0x0;var _0x1a355d=_0x1261[_0xc2e46e];return _0x1a355d;};'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 b26b70e..4ae7f49 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 _0x15b2=['openchannelMessage:','save','update','emit','register','length'];(function(_0x48ccc4,_0x4045e4){var _0x49d8bd=function(_0x25fc2b){while(--_0x25fc2b){_0x48ccc4['push'](_0x48ccc4['shift']());}};_0x49d8bd(++_0x4045e4);}(_0x15b2,0x145));var _0x215b=function(_0x2141ee,_0x4181e5){_0x2141ee=_0x2141ee-0x0;var _0x5bdc07=_0x15b2[_0x2141ee];return _0x5bdc07;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x215b('0x0'),'remove',_0x215b('0x1')];function createListener(_0x2ffbd3,_0x57263a){return function(_0x31ce87){_0x57263a[_0x215b('0x2')](_0x2ffbd3,_0x31ce87);};}function removeListener(_0x62c5ce,_0x506d00){return function(){OpenchannelMessageEvents['removeListener'](_0x62c5ce,_0x506d00);};}exports[_0x215b('0x3')]=function(_0x4ffb8e){for(var _0x2d8ea5=0x0,_0x3a5a4b=events[_0x215b('0x4')];_0x2d8ea5<_0x3a5a4b;_0x2d8ea5++){var _0x1a8033=events[_0x2d8ea5];var _0x2b64dc=createListener(_0x215b('0x5')+_0x1a8033,_0x4ffb8e);OpenchannelMessageEvents['on'](_0x1a8033,_0x2b64dc);}}; \ No newline at end of file +var _0x7278=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x9a29ea,_0x5b8b29){var _0x11f261=function(_0x397dea){while(--_0x397dea){_0x9a29ea['push'](_0x9a29ea['shift']());}};_0x11f261(++_0x5b8b29);}(_0x7278,0x161));var _0x8727=function(_0x312d15,_0x35f392){_0x312d15=_0x312d15-0x0;var _0x3b2a37=_0x7278[_0x312d15];return _0x3b2a37;};'use strict';var OpenchannelMessageEvents=require(_0x8727('0x0'));var events=[_0x8727('0x1'),_0x8727('0x2'),_0x8727('0x3')];function createListener(_0x2ee64e,_0x5822da){return function(_0x1ddbe9){_0x5822da[_0x8727('0x4')](_0x2ee64e,_0x1ddbe9);};}function removeListener(_0x6007de,_0x221021){return function(){OpenchannelMessageEvents[_0x8727('0x5')](_0x6007de,_0x221021);};}exports[_0x8727('0x6')]=function(_0x180b71){for(var _0x5549d5=0x0,_0xfd1902=events[_0x8727('0x7')];_0x5549d5<_0xfd1902;_0x5549d5++){var _0xffd783=events[_0x5549d5];var _0x435911=createListener(_0x8727('0x8')+_0xffd783,_0x180b71);OpenchannelMessageEvents['on'](_0xffd783,_0x435911);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 18cd3be..66ddf33 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 _0xe9b6=['show','getMembers','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xe9b6,0x177));var _0x6e9b=function(_0x18464f,_0xd2987){_0x18464f=_0x18464f-0x0;var _0x217a71=_0xe9b6[_0x18464f];return _0x217a71;};'use strict';var multer=require(_0x6e9b('0x0'));var util=require(_0x6e9b('0x1'));var path=require(_0x6e9b('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e9b('0x3'));var router=express[_0x6e9b('0x4')]();var fs_extra=require(_0x6e9b('0x5'));var auth=require(_0x6e9b('0x6'));var interaction=require(_0x6e9b('0x7'));var config=require(_0x6e9b('0x8'));var controller=require(_0x6e9b('0x9'));router[_0x6e9b('0xa')]('/',auth[_0x6e9b('0xb')](),controller[_0x6e9b('0xc')]);router[_0x6e9b('0xa')](_0x6e9b('0xd'),auth[_0x6e9b('0xb')](),controller[_0x6e9b('0xe')]);router['get']('/:id',auth[_0x6e9b('0xb')](),controller[_0x6e9b('0xf')]);router[_0x6e9b('0xa')]('/:id/members',auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x10')]);router[_0x6e9b('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6e9b('0x11')]);router[_0x6e9b('0xa')](_0x6e9b('0x12'),auth[_0x6e9b('0xb')](),controller['getAgents']);router[_0x6e9b('0x13')]('/',auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x14')]);router[_0x6e9b('0x13')](_0x6e9b('0x15'),auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x16')]);router['post'](_0x6e9b('0x12'),auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x17')]);router[_0x6e9b('0x18')](_0x6e9b('0x19'),auth[_0x6e9b('0xb')](),controller['update']);router[_0x6e9b('0x1a')](_0x6e9b('0x19'),auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x1b')]);router[_0x6e9b('0x1a')]('/:id/teams',auth[_0x6e9b('0xb')](),controller['removeTeams']);router[_0x6e9b('0x1a')](_0x6e9b('0x12'),auth[_0x6e9b('0xb')](),controller[_0x6e9b('0x1c')]);module[_0x6e9b('0x1d')]=router; \ No newline at end of file +var _0x4cba=['/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','destroy','/:id/teams','removeTeams','delete','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x1d0764,_0x2beb7c){var _0x423f49=function(_0x5334ee){while(--_0x5334ee){_0x1d0764['push'](_0x1d0764['shift']());}};_0x423f49(++_0x2beb7c);}(_0x4cba,0x140));var _0xa4cb=function(_0x35ead7,_0x453d3a){_0x35ead7=_0x35ead7-0x0;var _0x33b761=_0x4cba[_0x35ead7];return _0x33b761;};'use strict';var multer=require(_0xa4cb('0x0'));var util=require(_0xa4cb('0x1'));var path=require('path');var timeout=require(_0xa4cb('0x2'));var express=require('express');var router=express[_0xa4cb('0x3')]();var fs_extra=require(_0xa4cb('0x4'));var auth=require(_0xa4cb('0x5'));var interaction=require(_0xa4cb('0x6'));var config=require(_0xa4cb('0x7'));var controller=require('./openchannelQueue.controller');router[_0xa4cb('0x8')]('/',auth['isAuthenticated'](),controller[_0xa4cb('0x9')]);router[_0xa4cb('0x8')](_0xa4cb('0xa'),auth[_0xa4cb('0xb')](),controller[_0xa4cb('0xc')]);router[_0xa4cb('0x8')](_0xa4cb('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xa4cb('0xe'),auth['isAuthenticated'](),controller[_0xa4cb('0xf')]);router[_0xa4cb('0x8')]('/:id/teams',auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x10')]);router[_0xa4cb('0x8')](_0xa4cb('0x11'),auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x12')]);router[_0xa4cb('0x13')]('/',auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x14')]);router['post']('/:id/teams',auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x15')]);router['post']('/:id/users',auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x16')]);router[_0xa4cb('0x17')](_0xa4cb('0xd'),auth[_0xa4cb('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa4cb('0x18')]);router['delete'](_0xa4cb('0x19'),auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x1a')]);router[_0xa4cb('0x1b')]('/:id/users',auth[_0xa4cb('0xb')](),controller[_0xa4cb('0x1c')]);module[_0xa4cb('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index f4ce859..50341b3 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 _0x9331=['name','STRING','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0xbf1132,_0x176b34){var _0xe63ce4=function(_0x52d8ed){while(--_0x52d8ed){_0xbf1132['push'](_0xbf1132['shift']());}};_0xe63ce4(++_0x176b34);}(_0x9331,0xde));var _0x1933=function(_0x235d85,_0x2db080){_0x235d85=_0x235d85-0x0;var _0x559ead=_0x9331[_0x235d85];return _0x559ead;};'use strict';var Sequelize=require(_0x1933('0x0'));module[_0x1933('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1933('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1933('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1933('0x4')](_0x1933('0x5'),_0x1933('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x56c2=['exports','STRING','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x107689,_0x5d4673){var _0x1e28cf=function(_0x5873f0){while(--_0x5873f0){_0x107689['push'](_0x107689['shift']());}};_0x1e28cf(++_0x5d4673);}(_0x56c2,0x101));var _0x256c=function(_0x4935dc,_0x1eb53f){_0x4935dc=_0x4935dc-0x0;var _0x43a146=_0x56c2[_0x4935dc];return _0x43a146;};'use strict';var Sequelize=require(_0x256c('0x0'));module[_0x256c('0x1')]={'name':{'type':Sequelize[_0x256c('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x256c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x256c('0x4')](_0x256c('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 15e7ee1..8e46437 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 _0x382c=['describe','getMembers','findOne','UserOpenchannelQueue','intersection','length','hasOwnProperty','nolimit','sort','where','OpenchannelQueueId','filter','merge','findAll','findAndCountAll','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','userOpenchannelQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','order','util','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','offset','count','Content-Range','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','name','index','map','OpenchannelQueue','fieldName','type','key','include','query','rows','catch','show','params','model','rawAttributes','keys','filters','attributes','fields','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'];(function(_0x3ff58b,_0x5f4e9b){var _0x521dde=function(_0x3af056){while(--_0x3af056){_0x3ff58b['push'](_0x3ff58b['shift']());}};_0x521dde(++_0x5f4e9b);}(_0x382c,0x1b4));var _0xc382=function(_0x4e54e9,_0x40a2b7){_0x4e54e9=_0x4e54e9-0x0;var _0x32be8f=_0x382c[_0x4e54e9];return _0x32be8f;};'use strict';var BPromise=require('bluebird');var util=require(_0xc382('0x0'));var _=require('lodash');var squel=require(_0xc382('0x1'));var Redis=require('ioredis');var qs=require(_0xc382('0x2'));var logger=require('../../config/logger')(_0xc382('0x3'));var config=require(_0xc382('0x4'));var db=require(_0xc382('0x5'))['db'];config[_0xc382('0x6')]=_[_0xc382('0x7')](config[_0xc382('0x6')],{'host':_0xc382('0x8'),'port':0x18eb});var socket=require(_0xc382('0x9'))(new Redis(config[_0xc382('0x6')]));require('./openchannelQueue.socket')[_0xc382('0xa')](socket);function respondWithStatusCode(_0x552815,_0x6b2c0){_0x6b2c0=_0x6b2c0||0xcc;return function(_0x4de362){if(_0x4de362){return _0x552815[_0xc382('0xb')](_0x6b2c0);}return _0x552815[_0xc382('0xc')](_0x6b2c0)['end']();};}function respondWithResult(_0x114ee3,_0x41fe6a){_0x41fe6a=_0x41fe6a||0xc8;return function(_0x1d9be5){if(_0x1d9be5){return _0x114ee3[_0xc382('0xc')](_0x41fe6a)[_0xc382('0xd')](_0x1d9be5);}};}function respondWithFilteredResult(_0x1ffdde,_0x1ea32c){return function(_0x861924){if(_0x861924){var _0x46af87=typeof _0x1ea32c['offset']===_0xc382('0xe')&&typeof _0x1ea32c[_0xc382('0xf')]===_0xc382('0xe');var _0x19f1f1=_0x861924['count'];var _0xb334ac=_0x46af87?0x0:_0x1ea32c[_0xc382('0x10')];var _0x5a52ce=_0x46af87?_0x861924[_0xc382('0x11')]:_0x1ea32c[_0xc382('0x10')]+_0x1ea32c[_0xc382('0xf')];var _0x570d58;if(_0x5a52ce>=_0x19f1f1){_0x5a52ce=_0x19f1f1;_0x570d58=0xc8;}else{_0x570d58=0xce;}_0x1ffdde['status'](_0x570d58);return _0x1ffdde['set'](_0xc382('0x12'),_0xb334ac+'-'+_0x5a52ce+'/'+_0x19f1f1)[_0xc382('0xd')](_0x861924);}return null;};}function saveUpdates(_0x47c770){return function(_0x56eecd){if(_0x56eecd){return _0x56eecd[_0xc382('0x13')](_0x47c770)['then'](function(_0x4cf260){return _0x4cf260;});}return null;};}function removeEntity(_0x247f48){return function(_0x23d7a4){if(_0x23d7a4){return _0x23d7a4[_0xc382('0x14')]()[_0xc382('0x15')](function(){var _0x5512e0=_0x23d7a4[_0xc382('0x16')]({'plain':!![]});var _0x5d00fe=_0xc382('0x17');return db[_0xc382('0x18')]['destroy']({'where':{'type':_0x5d00fe,'resourceId':_0x5512e0['id']}})[_0xc382('0x15')](function(){return _0x23d7a4;});})[_0xc382('0x15')](function(){_0x247f48[_0xc382('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x139e75){return function(_0xc41c76){if(!_0xc41c76){_0x139e75[_0xc382('0xb')](0x194);}return _0xc41c76;};}function handleError(_0xc1ebe3,_0x25f1d5){_0x25f1d5=_0x25f1d5||0x1f4;return function(_0x1affb6){logger[_0xc382('0x19')](_0x1affb6['stack']);if(_0x1affb6['name']){delete _0x1affb6[_0xc382('0x1a')];}_0xc1ebe3[_0xc382('0xc')](_0x25f1d5)['send'](_0x1affb6);};}exports[_0xc382('0x1b')]=function(_0xabb5a3,_0x244899){var _0xc9ae4a={};var _0x3f1196={'count':0x0,'rows':[]};var _0x2ee87b=_[_0xc382('0x1c')](db[_0xc382('0x1d')]['rawAttributes'],function(_0x4b9051){return{'name':_0x4b9051[_0xc382('0x1e')],'type':_0x4b9051[_0xc382('0x1f')][_0xc382('0x20')]};});_0xc9ae4a=qs['getOptions'](_0x2ee87b,_0xabb5a3);var _0x24dfdc={'where':_0xc9ae4a['where']};return db[_0xc382('0x1d')][_0xc382('0x11')](_0x24dfdc)[_0xc382('0x15')](function(_0x3e4faa){_0x3f1196[_0xc382('0x11')]=_0x3e4faa;_0xc9ae4a[_0xc382('0x21')]=qs['include'](_0xabb5a3[_0xc382('0x22')]);return db[_0xc382('0x1d')]['findAll'](_0xc9ae4a);})[_0xc382('0x15')](function(_0x59713a){_0x3f1196[_0xc382('0x23')]=_0x59713a;return _0x3f1196;})[_0xc382('0x15')](respondWithFilteredResult(_0x244899,_0xc9ae4a))[_0xc382('0x24')](handleError(_0x244899,null));};exports[_0xc382('0x25')]=function(_0x1a927e,_0x33164c){var _0x7cf22a={'raw':!![],'where':{'id':_0x1a927e[_0xc382('0x26')]['id']}},_0x480040={};_0x480040[_0xc382('0x27')]=_['keys'](db[_0xc382('0x1d')][_0xc382('0x28')]);_0x480040['query']=_[_0xc382('0x29')](_0x1a927e['query']);_0x480040[_0xc382('0x2a')]=_['intersection'](_0x480040[_0xc382('0x27')],_0x480040[_0xc382('0x22')]);_0x7cf22a[_0xc382('0x2b')]=_['intersection'](_0x480040[_0xc382('0x27')],qs[_0xc382('0x2c')](_0x1a927e['query']['fields']));_0x7cf22a[_0xc382('0x2b')]=_0x7cf22a[_0xc382('0x2b')]['length']?_0x7cf22a['attributes']:_0x480040[_0xc382('0x27')];if(_0x1a927e['query']['includeAll']){_0x7cf22a[_0xc382('0x21')]=[{'all':!![]}];}_0x7cf22a=_['merge']({},_0x7cf22a,_0x1a927e[_0xc382('0x2d')]);return db[_0xc382('0x1d')][_0xc382('0x2e')](_0x7cf22a)[_0xc382('0x15')](handleEntityNotFound(_0x33164c,null))[_0xc382('0x15')](respondWithResult(_0x33164c,null))['catch'](handleError(_0x33164c,null));};exports[_0xc382('0x2f')]=function(_0x43cda0,_0x16b48c){return db[_0xc382('0x1d')][_0xc382('0x2f')](_0x43cda0[_0xc382('0x30')],{})['then'](function(_0x28297a){var _0x5812f7=_0x43cda0[_0xc382('0x31')][_0xc382('0x16')]({'plain':!![]});if(!_0x5812f7)throw new Error(_0xc382('0x32'));if(_0x5812f7[_0xc382('0x33')]===_0xc382('0x31')){var _0x5e5499=_0x28297a[_0xc382('0x16')]({'plain':!![]});var _0x54ad0b=_0xc382('0x17');return db[_0xc382('0x34')][_0xc382('0x2e')]({'where':{'name':_0x54ad0b,'userProfileId':_0x5812f7[_0xc382('0x35')]},'raw':!![]})[_0xc382('0x15')](function(_0x4a0157){if(_0x4a0157&&_0x4a0157[_0xc382('0x36')]===0x0){return db[_0xc382('0x18')][_0xc382('0x2f')]({'name':_0x5e5499[_0xc382('0x1a')],'resourceId':_0x5e5499['id'],'type':_0x4a0157[_0xc382('0x1a')],'sectionId':_0x4a0157['id']},{})[_0xc382('0x15')](function(){return _0x28297a;});}else{return _0x28297a;}})[_0xc382('0x24')](function(_0x5c7055){logger['error'](_0xc382('0x37'),_0x5c7055);throw _0x5c7055;});}return _0x28297a;})[_0xc382('0x15')](respondWithResult(_0x16b48c,0xc9))[_0xc382('0x24')](handleError(_0x16b48c,null));};exports['update']=function(_0x469732,_0x1793e8){if(_0x469732[_0xc382('0x30')]['id']){delete _0x469732['body']['id'];}return db[_0xc382('0x1d')][_0xc382('0x2e')]({'where':{'id':_0x469732[_0xc382('0x26')]['id']}})['then'](handleEntityNotFound(_0x1793e8,null))[_0xc382('0x15')](saveUpdates(_0x469732[_0xc382('0x30')],null))[_0xc382('0x15')](respondWithResult(_0x1793e8,null))[_0xc382('0x24')](handleError(_0x1793e8,null));};exports[_0xc382('0x14')]=function(_0x1e2e14,_0x271467){return db[_0xc382('0x1d')][_0xc382('0x2e')]({'where':{'id':_0x1e2e14[_0xc382('0x26')]['id']}})[_0xc382('0x15')](handleEntityNotFound(_0x271467,null))[_0xc382('0x15')](removeEntity(_0x271467,null))[_0xc382('0x24')](handleError(_0x271467,null));};exports[_0xc382('0x38')]=function(_0x4922ea,_0x23a8df){return db[_0xc382('0x1d')][_0xc382('0x38')]()[_0xc382('0x15')](respondWithResult(_0x23a8df,null))[_0xc382('0x24')](handleError(_0x23a8df,null));};exports[_0xc382('0x39')]=function(_0x4b9063,_0x4e698b){var _0x6550dc={'raw':!![],'where':{}},_0x4a5596={},_0x1b6764;return db['OpenchannelQueue'][_0xc382('0x3a')]({'where':{'id':_0x4b9063[_0xc382('0x26')]['id']}})[_0xc382('0x15')](handleEntityNotFound(_0x4e698b,null))[_0xc382('0x15')](function(_0x32bc80){if(_0x32bc80){_0x1b6764=_0x32bc80[_0xc382('0x16')]({'plain':!![]});_0x4a5596['model']=_[_0xc382('0x29')](db[_0xc382('0x3b')][_0xc382('0x28')]);_0x4a5596['query']=_[_0xc382('0x29')](_0x4b9063[_0xc382('0x22')]);_0x4a5596[_0xc382('0x2a')]=_[_0xc382('0x3c')](_0x4a5596['model'],_0x4a5596[_0xc382('0x22')]);_0x6550dc[_0xc382('0x2b')]=_[_0xc382('0x3c')](_0x4a5596[_0xc382('0x27')],qs[_0xc382('0x2c')](_0x4b9063['query'][_0xc382('0x2c')]));_0x6550dc[_0xc382('0x2b')]=_0x6550dc['attributes'][_0xc382('0x3d')]?_0x6550dc[_0xc382('0x2b')]:_0x4a5596[_0xc382('0x27')];if(!_0x4b9063['query'][_0xc382('0x3e')](_0xc382('0x3f'))){_0x6550dc[_0xc382('0xf')]=qs['limit'](_0x4b9063[_0xc382('0x22')][_0xc382('0xf')]);_0x6550dc[_0xc382('0x10')]=qs['offset'](_0x4b9063[_0xc382('0x22')][_0xc382('0x10')]);}_0x6550dc['order']=qs[_0xc382('0x40')](_0x4b9063['query'][_0xc382('0x40')]);_0x6550dc[_0xc382('0x41')]=qs[_0xc382('0x2a')](_['pick'](_0x4b9063['query'],_0x4a5596[_0xc382('0x2a')]));_0x6550dc[_0xc382('0x41')][_0xc382('0x42')]=_0x32bc80['id'];if(_0x4b9063['query'][_0xc382('0x43')]){_0x6550dc[_0xc382('0x41')]=_[_0xc382('0x44')](_0x6550dc[_0xc382('0x41')],{'$or':_['map'](_0x6550dc[_0xc382('0x2b')],function(_0x384c5e){var _0x4cd1bb={};_0x4cd1bb[_0x384c5e]={'$like':'%'+_0x4b9063['query'][_0xc382('0x43')]+'%'};return _0x4cd1bb;})});}_0x6550dc=_[_0xc382('0x44')]({},_0x6550dc,_0x4b9063[_0xc382('0x2d')]);return db['UserOpenchannelQueue'][_0xc382('0x45')](_0x6550dc);}})[_0xc382('0x15')](function(_0x17c671){if(_0x17c671){return db['User'][_0xc382('0x46')]({'where':{'id':_[_0xc382('0x1c')](_0x17c671,'UserId'),'role':'agent'},'attributes':['id',_0xc382('0x1a'),_0xc382('0x47'),_0xc382('0x48'),_0xc382('0x49')]});}})[_0xc382('0x15')](function(_0x15337d){if(_0x15337d){return{'count':_0x15337d[_0xc382('0x11')],'rows':_['map'](_0x15337d[_0xc382('0x23')],function(_0x1d83b4){return{'membername':_0x1d83b4['name'],'UserId':_0x1d83b4['id'],'queue_name':_0x1b6764[_0xc382('0x1a')],'OpenchannelQueueId':_0x1b6764['id'],'interface':util[_0xc382('0x4a')](_0xc382('0x4b'),_0xc382('0x4c'),_0x1d83b4[_0xc382('0x1a')]),'penalty':0x0,'paused':_0x1d83b4[_0xc382('0x47')],'createdAt':_0x1d83b4[_0xc382('0x49')],'updatedAt':_0x1d83b4[_0xc382('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4e698b,_0x6550dc))[_0xc382('0x24')](handleError(_0x4e698b,null));};exports[_0xc382('0x4d')]=function(_0x1ac6b8,_0x11bb23){var _0x521378={};var _0x5ece5c={};var _0x320c0f;var _0x20fe09;return db[_0xc382('0x1d')][_0xc382('0x3a')]({'where':{'id':_0x1ac6b8[_0xc382('0x26')]['id']}})['then'](handleEntityNotFound(_0x11bb23,null))[_0xc382('0x15')](function(_0x2d83c4){if(_0x2d83c4){_0x320c0f=_0x2d83c4;_0x5ece5c[_0xc382('0x27')]=_[_0xc382('0x29')](db[_0xc382('0x4e')][_0xc382('0x28')]);_0x5ece5c[_0xc382('0x22')]=_[_0xc382('0x29')](_0x1ac6b8['query']);_0x5ece5c[_0xc382('0x2a')]=_[_0xc382('0x3c')](_0x5ece5c['model'],_0x5ece5c[_0xc382('0x22')]);_0x521378[_0xc382('0x2b')]=_[_0xc382('0x3c')](_0x5ece5c[_0xc382('0x27')],qs[_0xc382('0x2c')](_0x1ac6b8[_0xc382('0x22')][_0xc382('0x2c')]));_0x521378[_0xc382('0x2b')]=_0x521378['attributes']['length']?_0x521378[_0xc382('0x2b')]:_0x5ece5c[_0xc382('0x27')];_0x521378['order']=qs[_0xc382('0x40')](_0x1ac6b8['query'][_0xc382('0x40')]);_0x521378[_0xc382('0x41')]=qs['filters'](_[_0xc382('0x4f')](_0x1ac6b8[_0xc382('0x22')],_0x5ece5c[_0xc382('0x2a')]));if(_0x1ac6b8[_0xc382('0x22')][_0xc382('0x43')]){_0x521378[_0xc382('0x41')]=_[_0xc382('0x44')](_0x521378['where'],{'$or':_[_0xc382('0x1c')](_0x521378['attributes'],function(_0x4a0117){var _0xd570cb={};_0xd570cb[_0x4a0117]={'$like':'%'+_0x1ac6b8[_0xc382('0x22')]['filter']+'%'};return _0xd570cb;})});}_0x521378=_[_0xc382('0x44')]({},_0x521378,_0x1ac6b8['options']);return _0x320c0f[_0xc382('0x4d')](_0x521378);}})[_0xc382('0x15')](function(_0x54bda5){if(_0x54bda5){_0x20fe09=_0x54bda5[_0xc382('0x3d')];if(!_0x1ac6b8[_0xc382('0x22')][_0xc382('0x3e')](_0xc382('0x3f'))){_0x521378[_0xc382('0xf')]=qs[_0xc382('0xf')](_0x1ac6b8['query']['limit']);_0x521378['offset']=qs[_0xc382('0x10')](_0x1ac6b8['query']['offset']);}return _0x320c0f['getTeams'](_0x521378);}})[_0xc382('0x15')](function(_0x1159e4){if(_0x1159e4){return _0x1159e4?{'count':_0x20fe09,'rows':_0x1159e4}:null;}})['then'](respondWithResult(_0x11bb23,null))[_0xc382('0x24')](handleError(_0x11bb23,null));};exports[_0xc382('0x50')]=function(_0x40b61b,_0x1eb665){var _0x23ae05=_0x40b61b['body'][_0xc382('0x51')];return db[_0xc382('0x4e')][_0xc382('0x45')]({'where':{'id':_0x23ae05},'attributes':['id'],'include':[{'model':db[_0xc382('0x52')],'as':_0xc382('0x53'),'attributes':['id',_0xc382('0x1a'),_0xc382('0x54'),_0xc382('0x55'),_0xc382('0x56')],'raw':!![]}]})[_0xc382('0x15')](function(_0x5a8553){if(_0x5a8553){var _0x336d42=_[_0xc382('0x57')](_0x5a8553,function(_0x42f3ef){var _0x4d8194=_0x42f3ef['get']({'plain':!![]});return _0x4d8194[_0xc382('0x53')];});return db[_0xc382('0x1d')]['find']({'where':{'id':_0x40b61b[_0xc382('0x26')]['id']}})[_0xc382('0x15')](function(_0x2dc81b){return db[_0xc382('0x58')][_0xc382('0x59')](function(_0x28d86a){return _0x2dc81b[_0xc382('0x50')](_0x23ae05,{'transaction':_0x28d86a})[_0xc382('0x15')](function(){return BPromise[_0xc382('0x5a')](_0x336d42,function(_0x3cfcee){return db[_0xc382('0x3b')][_0xc382('0x5b')]({'where':{'UserId':_0x3cfcee['id'],'OpenchannelQueueId':_0x40b61b['params']['id']},'transaction':_0x28d86a});});})[_0xc382('0x15')](function(){_0x336d42[_0xc382('0x5c')](function(_0x915ea5){socket[_0xc382('0x5d')](_0xc382('0x5e'),{'UserId':_0x915ea5['id'],'OpenchannelQueueId':_0x2dc81b['id']});});});});});}})[_0xc382('0x15')](respondWithStatusCode(_0x1eb665,null))['catch'](handleError(_0x1eb665,null));};exports[_0xc382('0x5f')]=function(_0x202f7a,_0x322526){return db[_0xc382('0x4e')][_0xc382('0x45')]({'where':{'id':_0x202f7a[_0xc382('0x22')][_0xc382('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc382('0x15')](handleEntityNotFound(_0x322526,null))[_0xc382('0x15')](function(_0x311143){var _0x4577fe=_['map'](_0x311143,'id');var _0xbba8cf=[];var _0x4ff55a=[];var _0x522afe=squel[_0xc382('0x60')]();_0x522afe['field'](_0xc382('0x61'))[_0xc382('0x62')](_0xc382('0x63'),'tq')[_0xc382('0x64')](_0xc382('0x65'),'ut',_0xc382('0x66'))['where'](_0xc382('0x67'),_0x202f7a[_0xc382('0x26')]['id']);for(var _0x5579d5=0x0;_0x5579d5<_0x311143[_0xc382('0x3d')];_0x5579d5+=0x1){let _0x34bc52=_0x311143[_0x5579d5];for(var _0x41723d=0x0;_0x41723d<_0x34bc52['Agents'][_0xc382('0x3d')];_0x41723d+=0x1){let _0x4228f1=_0x34bc52[_0xc382('0x53')][_0x41723d];var _0x446566=_0x522afe[_0xc382('0x68')]();_0x446566[_0xc382('0x41')](_0xc382('0x69'),_0x4228f1['id']);_0x4ff55a[_0xc382('0x6a')](db['sequelize'][_0xc382('0x22')](_0x446566['toString'](),{'type':db[_0xc382('0x58')][_0xc382('0x6b')][_0xc382('0x6c')]})[_0xc382('0x15')](function(_0x2f6b84){if(_0x2f6b84[_0xc382('0x3d')]===0x1){return _0x4228f1['id'];}else{var _0x4bf520=_[_0xc382('0x6d')](_[_0xc382('0x1c')](_0x2f6b84,_0xc382('0x6e')),function(_0x2c8232){return _[_0xc382('0x6f')](_0x4577fe,_0x2c8232);});if(_0x4bf520){return _0x4228f1['id'];}}}));}}return BPromise[_0xc382('0x70')](_0x4ff55a)['then'](function(_0x59b909){_0xbba8cf=_(_0xbba8cf)[_0xc382('0x71')](_0x59b909)[_0xc382('0x72')]()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x202f7a[_0xc382('0x26')]['id']}})[_0xc382('0x15')](function(_0x140567){return db[_0xc382('0x58')][_0xc382('0x59')](function(_0x53c1f0){return _0x140567['removeTeams'](_0x202f7a[_0xc382('0x22')]['ids'],{'transaction':_0x53c1f0})[_0xc382('0x15')](function(){if(!_[_0xc382('0x73')](_0xbba8cf)){return _0x140567['removeAgents'](_0xbba8cf,{'transaction':_0x53c1f0});}})[_0xc382('0x15')](function(){_0xbba8cf[_0xc382('0x5c')](function(_0x5032eb){socket['emit'](_0xc382('0x74'),{'UserId':_0x5032eb,'OpenchannelQueueId':_0x140567['id']});});});});});});})[_0xc382('0x15')](respondWithStatusCode(_0x322526,null))['catch'](handleError(_0x322526,null));};exports['addAgents']=function(_0x50ab81,_0x275b4c){return db[_0xc382('0x1d')]['find']({'where':{'id':_0x50ab81['params']['id']}})['then'](handleEntityNotFound(_0x275b4c,null))[_0xc382('0x15')](function(_0x39bece){if(_0x39bece){return _0x39bece[_0xc382('0x75')](_0x50ab81['body'][_0xc382('0x51')],_['omit'](_0x50ab81['body'],['ids','id'])||{})[_0xc382('0x76')](function(_0x47cbfe){for(var _0x1c0bdc=0x0;_0x1c0bdc<_0x50ab81[_0xc382('0x30')][_0xc382('0x51')][_0xc382('0x3d')];_0x1c0bdc+=0x1){socket[_0xc382('0x5d')](_0xc382('0x5e'),{'UserId':Number(_0x50ab81[_0xc382('0x30')][_0xc382('0x51')][_0x1c0bdc]),'OpenchannelQueueId':Number(_0x50ab81[_0xc382('0x26')]['id'])});}return _0x47cbfe;});}})[_0xc382('0x15')](respondWithResult(_0x275b4c,null))['catch'](handleError(_0x275b4c,null));};exports['removeAgents']=function(_0x3b13e4,_0x552d09){return db[_0xc382('0x1d')][_0xc382('0x2e')]({'where':{'id':_0x3b13e4['params']['id']}})[_0xc382('0x15')](handleEntityNotFound(_0x552d09,null))['then'](function(_0x2d271d){if(_0x2d271d){return _0x2d271d[_0xc382('0x77')](_0x3b13e4[_0xc382('0x22')][_0xc382('0x51')])[_0xc382('0x15')](function(){if(_[_0xc382('0x78')](_0x3b13e4[_0xc382('0x22')]['ids'])){for(var _0x15911e=0x0;_0x15911e<_0x3b13e4[_0xc382('0x22')][_0xc382('0x51')][_0xc382('0x3d')];_0x15911e+=0x1){socket[_0xc382('0x5d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3b13e4[_0xc382('0x22')]['ids'][_0x15911e]),'OpenchannelQueueId':Number(_0x3b13e4[_0xc382('0x26')]['id'])});}}else{socket[_0xc382('0x5d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3b13e4[_0xc382('0x22')][_0xc382('0x51')]),'OpenchannelQueueId':Number(_0x3b13e4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x552d09,null))[_0xc382('0x24')](handleError(_0x552d09,null));};exports[_0xc382('0x79')]=function(_0x2fda70,_0x18e3f9){var _0x1e7cfc={};var _0x50a8ed={};var _0x349a0d;var _0x46d4ae;return db[_0xc382('0x1d')][_0xc382('0x3a')]({'where':{'id':_0x2fda70[_0xc382('0x26')]['id']}})[_0xc382('0x15')](handleEntityNotFound(_0x18e3f9,null))[_0xc382('0x15')](function(_0x100476){if(_0x100476){_0x349a0d=_0x100476;_0x50a8ed['model']=_[_0xc382('0x29')](db['User'][_0xc382('0x28')]);_0x50a8ed['query']=_[_0xc382('0x29')](_0x2fda70['query']);_0x50a8ed[_0xc382('0x2a')]=_[_0xc382('0x3c')](_0x50a8ed['model'],_0x50a8ed['query']);_0x1e7cfc['attributes']=_['intersection'](_0x50a8ed[_0xc382('0x27')],qs[_0xc382('0x2c')](_0x2fda70[_0xc382('0x22')][_0xc382('0x2c')]));_0x1e7cfc[_0xc382('0x2b')]=_0x1e7cfc[_0xc382('0x2b')][_0xc382('0x3d')]?_0x1e7cfc[_0xc382('0x2b')]:_0x50a8ed['model'];_0x1e7cfc[_0xc382('0x7a')]=qs[_0xc382('0x40')](_0x2fda70[_0xc382('0x22')][_0xc382('0x40')]);_0x1e7cfc[_0xc382('0x41')]=qs['filters'](_[_0xc382('0x4f')](_0x2fda70[_0xc382('0x22')],_0x50a8ed[_0xc382('0x2a')]));if(_0x2fda70['query']['filter']){_0x1e7cfc[_0xc382('0x41')]=_[_0xc382('0x44')](_0x1e7cfc[_0xc382('0x41')],{'$or':_['map'](_0x1e7cfc['attributes'],function(_0x55c275){var _0x1c622f={};_0x1c622f[_0x55c275]={'$like':'%'+_0x2fda70[_0xc382('0x22')][_0xc382('0x43')]+'%'};return _0x1c622f;})});}_0x1e7cfc=_['merge']({},_0x1e7cfc,_0x2fda70[_0xc382('0x2d')]);return _0x349a0d[_0xc382('0x79')](_0x1e7cfc);}})[_0xc382('0x15')](function(_0x5c7090){if(_0x5c7090){_0x46d4ae=_0x5c7090[_0xc382('0x3d')];if(!_0x2fda70[_0xc382('0x22')]['hasOwnProperty'](_0xc382('0x3f'))){_0x1e7cfc['limit']=qs[_0xc382('0xf')](_0x2fda70['query']['limit']);_0x1e7cfc[_0xc382('0x10')]=qs[_0xc382('0x10')](_0x2fda70[_0xc382('0x22')][_0xc382('0x10')]);}return _0x349a0d[_0xc382('0x79')](_0x1e7cfc);}})[_0xc382('0x15')](function(_0xc84812){if(_0xc84812){return _0xc84812?{'count':_0x46d4ae,'rows':_0xc84812}:null;}})[_0xc382('0x15')](respondWithResult(_0x18e3f9,null))[_0xc382('0x24')](handleError(_0x18e3f9,null));}; \ No newline at end of file +var _0x2158=['getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','query','findAll','rows','catch','show','model','filters','intersection','attributes','fields','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','keys','UserOpenchannelQueue','nolimit','order','sort','where','pick','OpenchannelQueueId','filter','merge','User','findAndCountAll','UserId','openchannelPause','createdAt','format','%s/%s','SIP','getTeams','Team','length','hasOwnProperty','addTeams','ids','Agents','voicePause','flatMap','transaction','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','value','isEmpty','removeAgents','addAgents','omit','spread','userOpenchannelQueue:remove'];(function(_0x1341d6,_0xdb53b9){var _0x2a78db=function(_0x37cdaa){while(--_0x37cdaa){_0x1341d6['push'](_0x1341d6['shift']());}};_0x2a78db(++_0xdb53b9);}(_0x2158,0x79));var _0x8215=function(_0x1affed,_0x45765a){_0x1affed=_0x1affed-0x0;var _0x1cfa90=_0x2158[_0x1affed];return _0x1cfa90;};'use strict';var BPromise=require(_0x8215('0x0'));var util=require(_0x8215('0x1'));var _=require('lodash');var squel=require(_0x8215('0x2'));var Redis=require(_0x8215('0x3'));var qs=require(_0x8215('0x4'));var logger=require(_0x8215('0x5'))(_0x8215('0x6'));var config=require(_0x8215('0x7'));var db=require(_0x8215('0x8'))['db'];config['redis']=_[_0x8215('0x9')](config[_0x8215('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8215('0xb'))(new Redis(config[_0x8215('0xa')]));require('./openchannelQueue.socket')[_0x8215('0xc')](socket);function respondWithStatusCode(_0x4b44e4,_0x5b548c){_0x5b548c=_0x5b548c||0xcc;return function(_0xf67fb3){if(_0xf67fb3){return _0x4b44e4[_0x8215('0xd')](_0x5b548c);}return _0x4b44e4[_0x8215('0xe')](_0x5b548c)[_0x8215('0xf')]();};}function respondWithResult(_0x4703be,_0x2dd550){_0x2dd550=_0x2dd550||0xc8;return function(_0x121ea2){if(_0x121ea2){return _0x4703be[_0x8215('0xe')](_0x2dd550)[_0x8215('0x10')](_0x121ea2);}};}function respondWithFilteredResult(_0x4ca6a2,_0x22c70f){return function(_0x311e24){if(_0x311e24){var _0x45f1d8=typeof _0x22c70f[_0x8215('0x11')]===_0x8215('0x12')&&typeof _0x22c70f[_0x8215('0x13')]===_0x8215('0x12');var _0x543e1d=_0x311e24[_0x8215('0x14')];var _0x362bcd=_0x45f1d8?0x0:_0x22c70f[_0x8215('0x11')];var _0x7a7a9f=_0x45f1d8?_0x311e24[_0x8215('0x14')]:_0x22c70f['offset']+_0x22c70f['limit'];var _0x4a0987;if(_0x7a7a9f>=_0x543e1d){_0x7a7a9f=_0x543e1d;_0x4a0987=0xc8;}else{_0x4a0987=0xce;}_0x4ca6a2[_0x8215('0xe')](_0x4a0987);return _0x4ca6a2['set'](_0x8215('0x15'),_0x362bcd+'-'+_0x7a7a9f+'/'+_0x543e1d)[_0x8215('0x10')](_0x311e24);}return null;};}function saveUpdates(_0x429d3c){return function(_0x3de554){if(_0x3de554){return _0x3de554[_0x8215('0x16')](_0x429d3c)[_0x8215('0x17')](function(_0x1c05a7){return _0x1c05a7;});}return null;};}function removeEntity(_0x3fefef){return function(_0x1d9a8b){if(_0x1d9a8b){return _0x1d9a8b[_0x8215('0x18')]()[_0x8215('0x17')](function(){var _0x303cc2=_0x1d9a8b[_0x8215('0x19')]({'plain':!![]});var _0x3ed483=_0x8215('0x1a');return db[_0x8215('0x1b')][_0x8215('0x18')]({'where':{'type':_0x3ed483,'resourceId':_0x303cc2['id']}})[_0x8215('0x17')](function(){return _0x1d9a8b;});})['then'](function(){_0x3fefef[_0x8215('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1169be){return function(_0x280e50){if(!_0x280e50){_0x1169be[_0x8215('0xd')](0x194);}return _0x280e50;};}function handleError(_0x587ce9,_0xd4f0e9){_0xd4f0e9=_0xd4f0e9||0x1f4;return function(_0x549351){logger[_0x8215('0x1c')](_0x549351[_0x8215('0x1d')]);if(_0x549351[_0x8215('0x1e')]){delete _0x549351[_0x8215('0x1e')];}_0x587ce9['status'](_0xd4f0e9)[_0x8215('0x1f')](_0x549351);};}exports[_0x8215('0x20')]=function(_0x4ab540,_0x176d10){var _0x3bfc5c={};var _0x104169={'count':0x0,'rows':[]};var _0x1f0c44=_[_0x8215('0x21')](db[_0x8215('0x22')][_0x8215('0x23')],function(_0x423dc8){return{'name':_0x423dc8[_0x8215('0x24')],'type':_0x423dc8[_0x8215('0x25')][_0x8215('0x26')]};});_0x3bfc5c=qs[_0x8215('0x27')](_0x1f0c44,_0x4ab540);var _0x6eca1a={'where':_0x3bfc5c['where']};return db[_0x8215('0x22')]['count'](_0x6eca1a)[_0x8215('0x17')](function(_0x128c5f){_0x104169[_0x8215('0x14')]=_0x128c5f;_0x3bfc5c['include']=qs['include'](_0x4ab540[_0x8215('0x28')]);return db[_0x8215('0x22')][_0x8215('0x29')](_0x3bfc5c);})[_0x8215('0x17')](function(_0x3e6275){_0x104169[_0x8215('0x2a')]=_0x3e6275;return _0x104169;})['then'](respondWithFilteredResult(_0x176d10,_0x3bfc5c))[_0x8215('0x2b')](handleError(_0x176d10,null));};exports[_0x8215('0x2c')]=function(_0x12f288,_0xe90c0a){var _0x2640f3={'raw':!![],'where':{'id':_0x12f288['params']['id']}},_0x5be17f={};_0x5be17f[_0x8215('0x2d')]=_['keys'](db['OpenchannelQueue'][_0x8215('0x23')]);_0x5be17f['query']=_['keys'](_0x12f288[_0x8215('0x28')]);_0x5be17f[_0x8215('0x2e')]=_[_0x8215('0x2f')](_0x5be17f[_0x8215('0x2d')],_0x5be17f[_0x8215('0x28')]);_0x2640f3[_0x8215('0x30')]=_[_0x8215('0x2f')](_0x5be17f[_0x8215('0x2d')],qs[_0x8215('0x31')](_0x12f288[_0x8215('0x28')]['fields']));_0x2640f3[_0x8215('0x30')]=_0x2640f3[_0x8215('0x30')]['length']?_0x2640f3[_0x8215('0x30')]:_0x5be17f['model'];if(_0x12f288[_0x8215('0x28')]['includeAll']){_0x2640f3['include']=[{'all':!![]}];}_0x2640f3=_['merge']({},_0x2640f3,_0x12f288[_0x8215('0x32')]);return db[_0x8215('0x22')][_0x8215('0x33')](_0x2640f3)[_0x8215('0x17')](handleEntityNotFound(_0xe90c0a,null))[_0x8215('0x17')](respondWithResult(_0xe90c0a,null))[_0x8215('0x2b')](handleError(_0xe90c0a,null));};exports[_0x8215('0x34')]=function(_0x6b3b4e,_0x4283a9){return db[_0x8215('0x22')]['create'](_0x6b3b4e['body'],{})[_0x8215('0x17')](function(_0x15df2d){var _0x35b16e=_0x6b3b4e[_0x8215('0x35')][_0x8215('0x19')]({'plain':!![]});if(!_0x35b16e)throw new Error(_0x8215('0x36'));if(_0x35b16e[_0x8215('0x37')]===_0x8215('0x35')){var _0x53a570=_0x15df2d[_0x8215('0x19')]({'plain':!![]});var _0x32f924=_0x8215('0x1a');return db[_0x8215('0x38')][_0x8215('0x33')]({'where':{'name':_0x32f924,'userProfileId':_0x35b16e[_0x8215('0x39')]},'raw':!![]})[_0x8215('0x17')](function(_0x18de4d){if(_0x18de4d&&_0x18de4d[_0x8215('0x3a')]===0x0){return db[_0x8215('0x1b')][_0x8215('0x34')]({'name':_0x53a570[_0x8215('0x1e')],'resourceId':_0x53a570['id'],'type':_0x18de4d[_0x8215('0x1e')],'sectionId':_0x18de4d['id']},{})['then'](function(){return _0x15df2d;});}else{return _0x15df2d;}})['catch'](function(_0x340f6e){logger['error'](_0x8215('0x3b'),_0x340f6e);throw _0x340f6e;});}return _0x15df2d;})[_0x8215('0x17')](respondWithResult(_0x4283a9,0xc9))[_0x8215('0x2b')](handleError(_0x4283a9,null));};exports['update']=function(_0x3b491d,_0x2e9001){if(_0x3b491d[_0x8215('0x3c')]['id']){delete _0x3b491d[_0x8215('0x3c')]['id'];}return db['OpenchannelQueue'][_0x8215('0x33')]({'where':{'id':_0x3b491d[_0x8215('0x3d')]['id']}})[_0x8215('0x17')](handleEntityNotFound(_0x2e9001,null))[_0x8215('0x17')](saveUpdates(_0x3b491d[_0x8215('0x3c')],null))[_0x8215('0x17')](respondWithResult(_0x2e9001,null))[_0x8215('0x2b')](handleError(_0x2e9001,null));};exports['destroy']=function(_0x3c421e,_0x31718d){return db[_0x8215('0x22')][_0x8215('0x33')]({'where':{'id':_0x3c421e[_0x8215('0x3d')]['id']}})['then'](handleEntityNotFound(_0x31718d,null))[_0x8215('0x17')](removeEntity(_0x31718d,null))['catch'](handleError(_0x31718d,null));};exports['describe']=function(_0x57c18e,_0x300cc0){return db[_0x8215('0x22')][_0x8215('0x3e')]()[_0x8215('0x17')](respondWithResult(_0x300cc0,null))[_0x8215('0x2b')](handleError(_0x300cc0,null));};exports[_0x8215('0x3f')]=function(_0x4e4095,_0x4d3694){var _0x2ca583={'raw':!![],'where':{}},_0x412a1d={},_0x1f084a;return db[_0x8215('0x22')][_0x8215('0x40')]({'where':{'id':_0x4e4095[_0x8215('0x3d')]['id']}})[_0x8215('0x17')](handleEntityNotFound(_0x4d3694,null))[_0x8215('0x17')](function(_0x7b5673){if(_0x7b5673){_0x1f084a=_0x7b5673[_0x8215('0x19')]({'plain':!![]});_0x412a1d['model']=_[_0x8215('0x41')](db[_0x8215('0x42')][_0x8215('0x23')]);_0x412a1d[_0x8215('0x28')]=_[_0x8215('0x41')](_0x4e4095[_0x8215('0x28')]);_0x412a1d[_0x8215('0x2e')]=_[_0x8215('0x2f')](_0x412a1d[_0x8215('0x2d')],_0x412a1d['query']);_0x2ca583[_0x8215('0x30')]=_[_0x8215('0x2f')](_0x412a1d[_0x8215('0x2d')],qs['fields'](_0x4e4095['query'][_0x8215('0x31')]));_0x2ca583['attributes']=_0x2ca583[_0x8215('0x30')]['length']?_0x2ca583[_0x8215('0x30')]:_0x412a1d['model'];if(!_0x4e4095['query']['hasOwnProperty'](_0x8215('0x43'))){_0x2ca583['limit']=qs['limit'](_0x4e4095[_0x8215('0x28')][_0x8215('0x13')]);_0x2ca583[_0x8215('0x11')]=qs[_0x8215('0x11')](_0x4e4095[_0x8215('0x28')][_0x8215('0x11')]);}_0x2ca583[_0x8215('0x44')]=qs[_0x8215('0x45')](_0x4e4095[_0x8215('0x28')][_0x8215('0x45')]);_0x2ca583[_0x8215('0x46')]=qs[_0x8215('0x2e')](_[_0x8215('0x47')](_0x4e4095['query'],_0x412a1d['filters']));_0x2ca583[_0x8215('0x46')][_0x8215('0x48')]=_0x7b5673['id'];if(_0x4e4095[_0x8215('0x28')][_0x8215('0x49')]){_0x2ca583[_0x8215('0x46')]=_[_0x8215('0x4a')](_0x2ca583[_0x8215('0x46')],{'$or':_[_0x8215('0x21')](_0x2ca583[_0x8215('0x30')],function(_0x130e4f){var _0x2b0e0b={};_0x2b0e0b[_0x130e4f]={'$like':'%'+_0x4e4095[_0x8215('0x28')][_0x8215('0x49')]+'%'};return _0x2b0e0b;})});}_0x2ca583=_['merge']({},_0x2ca583,_0x4e4095[_0x8215('0x32')]);return db[_0x8215('0x42')][_0x8215('0x29')](_0x2ca583);}})[_0x8215('0x17')](function(_0x5d9f1f){if(_0x5d9f1f){return db[_0x8215('0x4b')][_0x8215('0x4c')]({'where':{'id':_[_0x8215('0x21')](_0x5d9f1f,_0x8215('0x4d')),'role':'agent'},'attributes':['id',_0x8215('0x1e'),_0x8215('0x4e'),'updatedAt',_0x8215('0x4f')]});}})[_0x8215('0x17')](function(_0x10fe19){if(_0x10fe19){return{'count':_0x10fe19[_0x8215('0x14')],'rows':_['map'](_0x10fe19[_0x8215('0x2a')],function(_0x50b9a2){return{'membername':_0x50b9a2[_0x8215('0x1e')],'UserId':_0x50b9a2['id'],'queue_name':_0x1f084a[_0x8215('0x1e')],'OpenchannelQueueId':_0x1f084a['id'],'interface':util[_0x8215('0x50')](_0x8215('0x51'),_0x8215('0x52'),_0x50b9a2[_0x8215('0x1e')]),'penalty':0x0,'paused':_0x50b9a2[_0x8215('0x4e')],'createdAt':_0x50b9a2['createdAt'],'updatedAt':_0x50b9a2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8215('0x17')](respondWithFilteredResult(_0x4d3694,_0x2ca583))['catch'](handleError(_0x4d3694,null));};exports[_0x8215('0x53')]=function(_0x556b17,_0x415ab2){var _0x1c09d4={};var _0x1c626b={};var _0x420660;var _0x5261e2;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x556b17[_0x8215('0x3d')]['id']}})['then'](handleEntityNotFound(_0x415ab2,null))['then'](function(_0x101aa8){if(_0x101aa8){_0x420660=_0x101aa8;_0x1c626b[_0x8215('0x2d')]=_[_0x8215('0x41')](db[_0x8215('0x54')]['rawAttributes']);_0x1c626b[_0x8215('0x28')]=_[_0x8215('0x41')](_0x556b17[_0x8215('0x28')]);_0x1c626b[_0x8215('0x2e')]=_[_0x8215('0x2f')](_0x1c626b['model'],_0x1c626b[_0x8215('0x28')]);_0x1c09d4[_0x8215('0x30')]=_[_0x8215('0x2f')](_0x1c626b[_0x8215('0x2d')],qs[_0x8215('0x31')](_0x556b17[_0x8215('0x28')][_0x8215('0x31')]));_0x1c09d4['attributes']=_0x1c09d4[_0x8215('0x30')][_0x8215('0x55')]?_0x1c09d4['attributes']:_0x1c626b[_0x8215('0x2d')];_0x1c09d4[_0x8215('0x44')]=qs[_0x8215('0x45')](_0x556b17[_0x8215('0x28')][_0x8215('0x45')]);_0x1c09d4[_0x8215('0x46')]=qs[_0x8215('0x2e')](_['pick'](_0x556b17[_0x8215('0x28')],_0x1c626b[_0x8215('0x2e')]));if(_0x556b17[_0x8215('0x28')]['filter']){_0x1c09d4[_0x8215('0x46')]=_['merge'](_0x1c09d4['where'],{'$or':_[_0x8215('0x21')](_0x1c09d4['attributes'],function(_0x5970f1){var _0x2efb6d={};_0x2efb6d[_0x5970f1]={'$like':'%'+_0x556b17['query'][_0x8215('0x49')]+'%'};return _0x2efb6d;})});}_0x1c09d4=_[_0x8215('0x4a')]({},_0x1c09d4,_0x556b17[_0x8215('0x32')]);return _0x420660[_0x8215('0x53')](_0x1c09d4);}})[_0x8215('0x17')](function(_0x5f2208){if(_0x5f2208){_0x5261e2=_0x5f2208[_0x8215('0x55')];if(!_0x556b17['query'][_0x8215('0x56')](_0x8215('0x43'))){_0x1c09d4['limit']=qs['limit'](_0x556b17[_0x8215('0x28')][_0x8215('0x13')]);_0x1c09d4[_0x8215('0x11')]=qs['offset'](_0x556b17['query'][_0x8215('0x11')]);}return _0x420660[_0x8215('0x53')](_0x1c09d4);}})['then'](function(_0x12343f){if(_0x12343f){return _0x12343f?{'count':_0x5261e2,'rows':_0x12343f}:null;}})[_0x8215('0x17')](respondWithResult(_0x415ab2,null))[_0x8215('0x2b')](handleError(_0x415ab2,null));};exports[_0x8215('0x57')]=function(_0x52ca42,_0x529923){var _0x5d28ff=_0x52ca42['body'][_0x8215('0x58')];return db[_0x8215('0x54')][_0x8215('0x29')]({'where':{'id':_0x5d28ff},'attributes':['id'],'include':[{'model':db[_0x8215('0x4b')],'as':_0x8215('0x59'),'attributes':['id',_0x8215('0x1e'),'online',_0x8215('0x5a'),'interface'],'raw':!![]}]})[_0x8215('0x17')](function(_0xf0070e){if(_0xf0070e){var _0x77fb38=_[_0x8215('0x5b')](_0xf0070e,function(_0x31a3a0){var _0x3a2984=_0x31a3a0[_0x8215('0x19')]({'plain':!![]});return _0x3a2984[_0x8215('0x59')];});return db[_0x8215('0x22')][_0x8215('0x33')]({'where':{'id':_0x52ca42['params']['id']}})[_0x8215('0x17')](function(_0x3506c9){return db['sequelize'][_0x8215('0x5c')](function(_0x4f80c7){return _0x3506c9[_0x8215('0x57')](_0x5d28ff,{'transaction':_0x4f80c7})[_0x8215('0x17')](function(){return BPromise['each'](_0x77fb38,function(_0x4bd965){return db[_0x8215('0x42')][_0x8215('0x5d')]({'where':{'UserId':_0x4bd965['id'],'OpenchannelQueueId':_0x52ca42[_0x8215('0x3d')]['id']},'transaction':_0x4f80c7});});})[_0x8215('0x17')](function(){_0x77fb38['forEach'](function(_0x1508b6){socket[_0x8215('0x5e')](_0x8215('0x5f'),{'UserId':_0x1508b6['id'],'OpenchannelQueueId':_0x3506c9['id']});});});});});}})['then'](respondWithStatusCode(_0x529923,null))['catch'](handleError(_0x529923,null));};exports[_0x8215('0x60')]=function(_0x534a9b,_0x29fb04){return db[_0x8215('0x54')][_0x8215('0x29')]({'where':{'id':_0x534a9b[_0x8215('0x28')][_0x8215('0x58')]},'attributes':['id'],'include':[{'model':db[_0x8215('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8215('0x17')](handleEntityNotFound(_0x29fb04,null))[_0x8215('0x17')](function(_0x15a3a9){var _0x11369b=_[_0x8215('0x21')](_0x15a3a9,'id');var _0x53818c=[];var _0x37d3c8=[];var _0x535272=squel[_0x8215('0x61')]();_0x535272[_0x8215('0x62')](_0x8215('0x63'))[_0x8215('0x64')]('team_has_openchannel_queues','tq')['join'](_0x8215('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8215('0x46')](_0x8215('0x66'),_0x534a9b[_0x8215('0x3d')]['id']);for(var _0x1c2bfb=0x0;_0x1c2bfb<_0x15a3a9['length'];_0x1c2bfb+=0x1){let _0x1f2074=_0x15a3a9[_0x1c2bfb];for(var _0x39d1fc=0x0;_0x39d1fc<_0x1f2074[_0x8215('0x59')][_0x8215('0x55')];_0x39d1fc+=0x1){let _0x4288ad=_0x1f2074['Agents'][_0x39d1fc];var _0x47e5a0=_0x535272[_0x8215('0x67')]();_0x47e5a0[_0x8215('0x46')](_0x8215('0x68'),_0x4288ad['id']);_0x37d3c8[_0x8215('0x69')](db['sequelize']['query'](_0x47e5a0['toString'](),{'type':db[_0x8215('0x6a')][_0x8215('0x6b')][_0x8215('0x6c')]})[_0x8215('0x17')](function(_0x31e533){if(_0x31e533[_0x8215('0x55')]===0x1){return _0x4288ad['id'];}else{var _0x6752b5=_[_0x8215('0x6d')](_['map'](_0x31e533,_0x8215('0x6e')),function(_0x2afe29){return _['includes'](_0x11369b,_0x2afe29);});if(_0x6752b5){return _0x4288ad['id'];}}}));}}return BPromise[_0x8215('0x6f')](_0x37d3c8)[_0x8215('0x17')](function(_0x4444ad){_0x53818c=_(_0x53818c)['union'](_0x4444ad)['compact']()[_0x8215('0x70')]();return db['OpenchannelQueue'][_0x8215('0x33')]({'where':{'id':_0x534a9b[_0x8215('0x3d')]['id']}})[_0x8215('0x17')](function(_0xe83321){return db['sequelize'][_0x8215('0x5c')](function(_0x489d54){return _0xe83321['removeTeams'](_0x534a9b['query'][_0x8215('0x58')],{'transaction':_0x489d54})[_0x8215('0x17')](function(){if(!_[_0x8215('0x71')](_0x53818c)){return _0xe83321[_0x8215('0x72')](_0x53818c,{'transaction':_0x489d54});}})[_0x8215('0x17')](function(){_0x53818c['forEach'](function(_0x4361b3){socket[_0x8215('0x5e')]('userOpenchannelQueue:remove',{'UserId':_0x4361b3,'OpenchannelQueueId':_0xe83321['id']});});});});});});})[_0x8215('0x17')](respondWithStatusCode(_0x29fb04,null))[_0x8215('0x2b')](handleError(_0x29fb04,null));};exports[_0x8215('0x73')]=function(_0x2144a6,_0x3ed5d1){return db[_0x8215('0x22')][_0x8215('0x33')]({'where':{'id':_0x2144a6[_0x8215('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3ed5d1,null))[_0x8215('0x17')](function(_0x2a771d){if(_0x2a771d){return _0x2a771d['addAgents'](_0x2144a6[_0x8215('0x3c')][_0x8215('0x58')],_[_0x8215('0x74')](_0x2144a6[_0x8215('0x3c')],[_0x8215('0x58'),'id'])||{})[_0x8215('0x75')](function(_0x208e4b){for(var _0xecd297=0x0;_0xecd297<_0x2144a6[_0x8215('0x3c')][_0x8215('0x58')]['length'];_0xecd297+=0x1){socket[_0x8215('0x5e')](_0x8215('0x5f'),{'UserId':Number(_0x2144a6['body'][_0x8215('0x58')][_0xecd297]),'OpenchannelQueueId':Number(_0x2144a6[_0x8215('0x3d')]['id'])});}return _0x208e4b;});}})[_0x8215('0x17')](respondWithResult(_0x3ed5d1,null))['catch'](handleError(_0x3ed5d1,null));};exports[_0x8215('0x72')]=function(_0x45fc1b,_0x37e17e){return db[_0x8215('0x22')][_0x8215('0x33')]({'where':{'id':_0x45fc1b[_0x8215('0x3d')]['id']}})['then'](handleEntityNotFound(_0x37e17e,null))[_0x8215('0x17')](function(_0x3f4914){if(_0x3f4914){return _0x3f4914['removeAgents'](_0x45fc1b[_0x8215('0x28')][_0x8215('0x58')])[_0x8215('0x17')](function(){if(_['isArray'](_0x45fc1b['query'][_0x8215('0x58')])){for(var _0x428cab=0x0;_0x428cab<_0x45fc1b['query']['ids'][_0x8215('0x55')];_0x428cab+=0x1){socket[_0x8215('0x5e')](_0x8215('0x76'),{'UserId':Number(_0x45fc1b[_0x8215('0x28')][_0x8215('0x58')][_0x428cab]),'OpenchannelQueueId':Number(_0x45fc1b[_0x8215('0x3d')]['id'])});}}else{socket[_0x8215('0x5e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x45fc1b[_0x8215('0x28')][_0x8215('0x58')]),'OpenchannelQueueId':Number(_0x45fc1b[_0x8215('0x3d')]['id'])});}});}})['then'](respondWithStatusCode(_0x37e17e,null))[_0x8215('0x2b')](handleError(_0x37e17e,null));};exports[_0x8215('0x77')]=function(_0x315089,_0x240b0b){var _0x500d6={};var _0x470994={};var _0x46a91b;var _0x5710af;return db[_0x8215('0x22')][_0x8215('0x40')]({'where':{'id':_0x315089[_0x8215('0x3d')]['id']}})[_0x8215('0x17')](handleEntityNotFound(_0x240b0b,null))[_0x8215('0x17')](function(_0x2da1e9){if(_0x2da1e9){_0x46a91b=_0x2da1e9;_0x470994[_0x8215('0x2d')]=_[_0x8215('0x41')](db['User']['rawAttributes']);_0x470994[_0x8215('0x28')]=_[_0x8215('0x41')](_0x315089[_0x8215('0x28')]);_0x470994['filters']=_[_0x8215('0x2f')](_0x470994[_0x8215('0x2d')],_0x470994['query']);_0x500d6[_0x8215('0x30')]=_[_0x8215('0x2f')](_0x470994[_0x8215('0x2d')],qs['fields'](_0x315089['query'][_0x8215('0x31')]));_0x500d6[_0x8215('0x30')]=_0x500d6[_0x8215('0x30')][_0x8215('0x55')]?_0x500d6[_0x8215('0x30')]:_0x470994[_0x8215('0x2d')];_0x500d6[_0x8215('0x44')]=qs['sort'](_0x315089['query'][_0x8215('0x45')]);_0x500d6['where']=qs['filters'](_[_0x8215('0x47')](_0x315089[_0x8215('0x28')],_0x470994[_0x8215('0x2e')]));if(_0x315089[_0x8215('0x28')][_0x8215('0x49')]){_0x500d6['where']=_[_0x8215('0x4a')](_0x500d6['where'],{'$or':_[_0x8215('0x21')](_0x500d6[_0x8215('0x30')],function(_0x548a27){var _0x56129f={};_0x56129f[_0x548a27]={'$like':'%'+_0x315089[_0x8215('0x28')][_0x8215('0x49')]+'%'};return _0x56129f;})});}_0x500d6=_[_0x8215('0x4a')]({},_0x500d6,_0x315089['options']);return _0x46a91b[_0x8215('0x77')](_0x500d6);}})[_0x8215('0x17')](function(_0x5ebfdf){if(_0x5ebfdf){_0x5710af=_0x5ebfdf[_0x8215('0x55')];if(!_0x315089['query']['hasOwnProperty'](_0x8215('0x43'))){_0x500d6['limit']=qs[_0x8215('0x13')](_0x315089[_0x8215('0x28')]['limit']);_0x500d6[_0x8215('0x11')]=qs['offset'](_0x315089[_0x8215('0x28')][_0x8215('0x11')]);}return _0x46a91b[_0x8215('0x77')](_0x500d6);}})[_0x8215('0x17')](function(_0x2cc4e1){if(_0x2cc4e1){return _0x2cc4e1?{'count':_0x5710af,'rows':_0x2cc4e1}:null;}})['then'](respondWithResult(_0x240b0b,null))['catch'](handleError(_0x240b0b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 51d7f70..fc905cb 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 _0xcf51=['../../mysqldb','OpenchannelQueue','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xcf51,0x182));var _0x1cf5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcf51[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x1cf5('0x0'));var OpenchannelQueue=require(_0x1cf5('0x1'))['db'][_0x1cf5('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x1cf5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1cf5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x19a7c5){return function(_0x5353db,_0x960f0f,_0x2824e3){OpenchannelQueueEvents[_0x1cf5('0x5')](_0x19a7c5+':'+_0x5353db['id'],_0x5353db);OpenchannelQueueEvents[_0x1cf5('0x5')](_0x19a7c5,_0x5353db);_0x2824e3(null);};}for(var e in events){if(events[_0x1cf5('0x6')](e)){var event=events[e];OpenchannelQueue[_0x1cf5('0x7')](e,emitEvent(event));}}module[_0x1cf5('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xa4dc=['hook','exports','events','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x472b43,_0x542745){var _0x483774=function(_0x4eb348){while(--_0x4eb348){_0x472b43['push'](_0x472b43['shift']());}};_0x483774(++_0x542745);}(_0xa4dc,0xe2));var _0xca4d=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xa4dc[_0x346737];return _0x1ade2e;};'use strict';var EventEmitter=require(_0xca4d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xca4d('0x1')](0x0);var events={'afterCreate':_0xca4d('0x2'),'afterUpdate':'update','afterDestroy':_0xca4d('0x3')};function emitEvent(_0x39b077){return function(_0xd55e6,_0x83e168,_0x360098){OpenchannelQueueEvents[_0xca4d('0x4')](_0x39b077+':'+_0xd55e6['id'],_0xd55e6);OpenchannelQueueEvents['emit'](_0x39b077,_0xd55e6);_0x360098(null);};}for(var e in events){if(events[_0xca4d('0x5')](e)){var event=events[e];OpenchannelQueue[_0xca4d('0x6')](e,emitEvent(event));}}module[_0xca4d('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 2ca5083..32c758d 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 _0xbeba=['api','moment','path','rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','lodash','util','../../config/logger'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0xbeba,0x15b));var _0xabeb=function(_0x49fcb7,_0x3b7b25){_0x49fcb7=_0x49fcb7-0x0;var _0x4156fa=_0xbeba[_0x49fcb7];return _0x4156fa;};'use strict';var _=require(_0xabeb('0x0'));var util=require(_0xabeb('0x1'));var logger=require(_0xabeb('0x2'))(_0xabeb('0x3'));var moment=require(_0xabeb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xabeb('0x5'));var rimraf=require(_0xabeb('0x6'));var config=require(_0xabeb('0x7'));var attributes=require(_0xabeb('0x8'));module['exports']=function(_0x27369f,_0x2f5de3){return _0x27369f['define'](_0xabeb('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec65=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','openchannel_queues','lodash','util','api'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xec65,0x11b));var _0x5ec6=function(_0x249d99,_0x16b584){_0x249d99=_0x249d99-0x0;var _0x5bfb05=_0xec65[_0x249d99];return _0x5bfb05;};'use strict';var _=require(_0x5ec6('0x0'));var util=require(_0x5ec6('0x1'));var logger=require('../../config/logger')(_0x5ec6('0x2'));var moment=require(_0x5ec6('0x3'));var BPromise=require(_0x5ec6('0x4'));var rp=require(_0x5ec6('0x5'));var fs=require('fs');var path=require(_0x5ec6('0x6'));var rimraf=require(_0x5ec6('0x7'));var config=require(_0x5ec6('0x8'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x569a7b,_0xd8994){return _0x569a7b[_0x5ec6('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x5ec6('0xa'),'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 465260c..28f5be6 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 _0x3c2d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','model','debug','stringify','ShowOpenchannelQueue','find','map','util'];(function(_0x41055a,_0x535849){var _0x3c1db5=function(_0xdef392){while(--_0xdef392){_0x41055a['push'](_0x41055a['shift']());}};_0x3c1db5(++_0x535849);}(_0x3c2d,0xc2));var _0xd3c2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3c2d[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xd3c2('0x0'));var moment=require('moment');var BPromise=require(_0xd3c2('0x1'));var rs=require(_0xd3c2('0x2'));var fs=require('fs');var Redis=require(_0xd3c2('0x3'));var db=require(_0xd3c2('0x4'))['db'];var utils=require(_0xd3c2('0x5'));var logger=require(_0xd3c2('0x6'))('rpc');var config=require(_0xd3c2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd3c2('0x8')][_0xd3c2('0x9')]({'port':0x232a});config[_0xd3c2('0xa')]=_['defaults'](config[_0xd3c2('0xa')],{'host':_0xd3c2('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd3c2('0xa')]));require(_0xd3c2('0xc'))[_0xd3c2('0xd')](socket);function respondWithRpcPromise(_0x26c13e,_0x25c1d0,_0x36719d){return new BPromise(function(_0x3115d5,_0x5a95ac){return client[_0xd3c2('0xe')](_0x26c13e,_0x36719d)[_0xd3c2('0xf')](function(_0x1b18ca){logger[_0xd3c2('0x10')](_0xd3c2('0x11'),_0x25c1d0,_0xd3c2('0x12'));logger['debug'](_0xd3c2('0x13'),_0x25c1d0,'request\x20sent',JSON['stringify'](_0x1b18ca));if(_0x1b18ca[_0xd3c2('0x14')]){if(_0x1b18ca['error']['code']===0x1f4){logger[_0xd3c2('0x14')](_0xd3c2('0x11'),_0x25c1d0,_0x1b18ca[_0xd3c2('0x14')]['message']);return _0x5a95ac(_0x1b18ca[_0xd3c2('0x14')][_0xd3c2('0x15')]);}logger[_0xd3c2('0x14')](_0xd3c2('0x11'),_0x25c1d0,_0x1b18ca[_0xd3c2('0x14')]['message']);return _0x3115d5(_0x1b18ca[_0xd3c2('0x14')]['message']);}else{logger['info'](_0xd3c2('0x11'),_0x25c1d0,'request\x20sent');_0x3115d5(_0x1b18ca[_0xd3c2('0x16')][_0xd3c2('0x15')]);}})[_0xd3c2('0x17')](function(_0x4a6ff5){logger[_0xd3c2('0x14')](_0xd3c2('0x11'),_0x25c1d0,_0x4a6ff5);_0x5a95ac(_0x4a6ff5);});});}exports[_0xd3c2('0x18')]=function(_0x3b7c79){var _0x270d02=this;return new Promise(function(_0x23b033,_0x42a058){return db[_0xd3c2('0x19')][_0xd3c2('0x1a')]({'raw':_0x3b7c79[_0xd3c2('0x1b')]?_0x3b7c79[_0xd3c2('0x1b')][_0xd3c2('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b7c79[_0xd3c2('0x1b')]?_0x3b7c79['options'][_0xd3c2('0x1d')]||null:null,'attributes':_0x3b7c79[_0xd3c2('0x1b')]?_0x3b7c79[_0xd3c2('0x1b')][_0xd3c2('0x1e')]||null:null,'limit':_0x3b7c79[_0xd3c2('0x1b')]?_0x3b7c79[_0xd3c2('0x1b')][_0xd3c2('0x1f')]||null:null,'include':_0x3b7c79[_0xd3c2('0x1b')]?_0x3b7c79[_0xd3c2('0x1b')]['include']?_['map'](_0x3b7c79['options'][_0xd3c2('0x20')],function(_0xc3954b){return{'model':db[_0xc3954b['model']],'as':_0xc3954b['as'],'attributes':_0xc3954b[_0xd3c2('0x1e')],'include':_0xc3954b[_0xd3c2('0x20')]?_['map'](_0xc3954b[_0xd3c2('0x20')],function(_0x3b42ad){return{'model':db[_0x3b42ad[_0xd3c2('0x21')]],'as':_0x3b42ad['as'],'attributes':_0x3b42ad[_0xd3c2('0x1e')],'include':_0x3b42ad[_0xd3c2('0x20')]?_['map'](_0x3b42ad[_0xd3c2('0x20')],function(_0x374dd4){return{'model':db[_0x374dd4[_0xd3c2('0x21')]],'as':_0x374dd4['as'],'attributes':_0x374dd4[_0xd3c2('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x262b3f){logger[_0xd3c2('0x10')]('GetOpenchannelQueue',_0x3b7c79);logger[_0xd3c2('0x22')](_0xd3c2('0x18'),_0x3b7c79,JSON[_0xd3c2('0x23')](_0x262b3f));_0x23b033(_0x262b3f);})[_0xd3c2('0x17')](function(_0x1da133){logger[_0xd3c2('0x14')](_0xd3c2('0x18'),_0x1da133['message'],_0x3b7c79);_0x42a058(_0x270d02[_0xd3c2('0x14')](0x1f4,_0x1da133[_0xd3c2('0x15')]));});});};exports[_0xd3c2('0x24')]=function(_0x536473){var _0x245b73=this;return new Promise(function(_0x1c8342,_0x593de1){return db[_0xd3c2('0x19')][_0xd3c2('0x25')]({'raw':_0x536473[_0xd3c2('0x1b')]?_0x536473[_0xd3c2('0x1b')][_0xd3c2('0x1c')]===undefined?!![]:![]:!![],'where':_0x536473[_0xd3c2('0x1b')]?_0x536473[_0xd3c2('0x1b')][_0xd3c2('0x1d')]||null:null,'attributes':_0x536473[_0xd3c2('0x1b')]?_0x536473[_0xd3c2('0x1b')][_0xd3c2('0x1e')]||null:null,'include':_0x536473[_0xd3c2('0x1b')]?_0x536473[_0xd3c2('0x1b')][_0xd3c2('0x20')]?_[_0xd3c2('0x26')](_0x536473['options'][_0xd3c2('0x20')],function(_0x529c42){return{'model':db[_0x529c42[_0xd3c2('0x21')]],'as':_0x529c42['as'],'attributes':_0x529c42[_0xd3c2('0x1e')],'include':_0x529c42['include']?_[_0xd3c2('0x26')](_0x529c42[_0xd3c2('0x20')],function(_0x38de0d){return{'model':db[_0x38de0d[_0xd3c2('0x21')]],'as':_0x38de0d['as'],'attributes':_0x38de0d[_0xd3c2('0x1e')],'include':_0x38de0d[_0xd3c2('0x20')]?_[_0xd3c2('0x26')](_0x38de0d[_0xd3c2('0x20')],function(_0x3ae55f){return{'model':db[_0x3ae55f['model']],'as':_0x3ae55f['as'],'attributes':_0x3ae55f[_0xd3c2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd3c2('0xf')](function(_0x5d620e){logger[_0xd3c2('0x10')]('ShowOpenchannelQueue',_0x536473);logger[_0xd3c2('0x22')]('ShowOpenchannelQueue',_0x536473,JSON[_0xd3c2('0x23')](_0x5d620e));_0x1c8342(_0x5d620e);})[_0xd3c2('0x17')](function(_0x4bae4f){logger['error']('ShowOpenchannelQueue',_0x4bae4f['message'],_0x536473);_0x593de1(_0x245b73['error'](0x1f4,_0x4bae4f[_0xd3c2('0x15')]));});});}; \ No newline at end of file +var _0x5f9f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetOpenchannelQueue','debug','ShowOpenchannelQueue','find','util','randomstring'];(function(_0x2f225c,_0x465b58){var _0x40470f=function(_0x4cc378){while(--_0x4cc378){_0x2f225c['push'](_0x2f225c['shift']());}};_0x40470f(++_0x465b58);}(_0x5f9f,0xa6));var _0xf5f9=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x5f9f[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require(_0xf5f9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf5f9('0x1'));var fs=require('fs');var Redis=require(_0xf5f9('0x2'));var db=require(_0xf5f9('0x3'))['db'];var utils=require(_0xf5f9('0x4'));var logger=require(_0xf5f9('0x5'))(_0xf5f9('0x6'));var config=require(_0xf5f9('0x7'));var jayson=require(_0xf5f9('0x8'));var client=jayson[_0xf5f9('0x9')][_0xf5f9('0xa')]({'port':0x232a});config['redis']=_[_0xf5f9('0xb')](config[_0xf5f9('0xc')],{'host':_0xf5f9('0xd'),'port':0x18eb});var socket=require(_0xf5f9('0xe'))(new Redis(config['redis']));require(_0xf5f9('0xf'))[_0xf5f9('0x10')](socket);function respondWithRpcPromise(_0x4364aa,_0x484406,_0x324b32){return new BPromise(function(_0xea0b39,_0x312602){return client['request'](_0x4364aa,_0x324b32)['then'](function(_0x176647){logger[_0xf5f9('0x11')](_0xf5f9('0x12'),_0x484406,_0xf5f9('0x13'));logger['debug'](_0xf5f9('0x14'),_0x484406,'request\x20sent',JSON[_0xf5f9('0x15')](_0x176647));if(_0x176647[_0xf5f9('0x16')]){if(_0x176647[_0xf5f9('0x16')][_0xf5f9('0x17')]===0x1f4){logger[_0xf5f9('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x484406,_0x176647[_0xf5f9('0x16')]['message']);return _0x312602(_0x176647[_0xf5f9('0x16')][_0xf5f9('0x18')]);}logger['error'](_0xf5f9('0x12'),_0x484406,_0x176647[_0xf5f9('0x16')][_0xf5f9('0x18')]);return _0xea0b39(_0x176647['error'][_0xf5f9('0x18')]);}else{logger[_0xf5f9('0x11')](_0xf5f9('0x12'),_0x484406,_0xf5f9('0x13'));_0xea0b39(_0x176647[_0xf5f9('0x19')][_0xf5f9('0x18')]);}})[_0xf5f9('0x1a')](function(_0x376faf){logger[_0xf5f9('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x484406,_0x376faf);_0x312602(_0x376faf);});});}exports['GetOpenchannelQueue']=function(_0x200b11){var _0x45a3b3=this;return new Promise(function(_0x182f42,_0x3debe6){return db[_0xf5f9('0x1b')][_0xf5f9('0x1c')]({'raw':_0x200b11[_0xf5f9('0x1d')]?_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x1e')]===undefined?!![]:![]:!![],'where':_0x200b11[_0xf5f9('0x1d')]?_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x1f')]||null:null,'attributes':_0x200b11[_0xf5f9('0x1d')]?_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x20')]||null:null,'limit':_0x200b11[_0xf5f9('0x1d')]?_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x21')]||null:null,'include':_0x200b11[_0xf5f9('0x1d')]?_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x22')]?_[_0xf5f9('0x23')](_0x200b11[_0xf5f9('0x1d')][_0xf5f9('0x22')],function(_0x5304c3){return{'model':db[_0x5304c3[_0xf5f9('0x24')]],'as':_0x5304c3['as'],'attributes':_0x5304c3[_0xf5f9('0x20')],'include':_0x5304c3[_0xf5f9('0x22')]?_[_0xf5f9('0x23')](_0x5304c3[_0xf5f9('0x22')],function(_0x5636b1){return{'model':db[_0x5636b1['model']],'as':_0x5636b1['as'],'attributes':_0x5636b1[_0xf5f9('0x20')],'include':_0x5636b1[_0xf5f9('0x22')]?_[_0xf5f9('0x23')](_0x5636b1['include'],function(_0x182259){return{'model':db[_0x182259[_0xf5f9('0x24')]],'as':_0x182259['as'],'attributes':_0x182259[_0xf5f9('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f9('0x25')](function(_0x13e52a){logger[_0xf5f9('0x11')](_0xf5f9('0x26'),_0x200b11);logger[_0xf5f9('0x27')](_0xf5f9('0x26'),_0x200b11,JSON['stringify'](_0x13e52a));_0x182f42(_0x13e52a);})['catch'](function(_0x38aae9){logger[_0xf5f9('0x16')](_0xf5f9('0x26'),_0x38aae9[_0xf5f9('0x18')],_0x200b11);_0x3debe6(_0x45a3b3[_0xf5f9('0x16')](0x1f4,_0x38aae9[_0xf5f9('0x18')]));});});};exports[_0xf5f9('0x28')]=function(_0x10341b){var _0x22f848=this;return new Promise(function(_0x142b21,_0x37e3ef){return db['OpenchannelQueue'][_0xf5f9('0x29')]({'raw':_0x10341b['options']?_0x10341b[_0xf5f9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x10341b[_0xf5f9('0x1d')]?_0x10341b[_0xf5f9('0x1d')][_0xf5f9('0x1f')]||null:null,'attributes':_0x10341b[_0xf5f9('0x1d')]?_0x10341b['options']['attributes']||null:null,'include':_0x10341b['options']?_0x10341b[_0xf5f9('0x1d')][_0xf5f9('0x22')]?_['map'](_0x10341b[_0xf5f9('0x1d')][_0xf5f9('0x22')],function(_0x484029){return{'model':db[_0x484029[_0xf5f9('0x24')]],'as':_0x484029['as'],'attributes':_0x484029[_0xf5f9('0x20')],'include':_0x484029[_0xf5f9('0x22')]?_[_0xf5f9('0x23')](_0x484029[_0xf5f9('0x22')],function(_0x5dd51b){return{'model':db[_0x5dd51b[_0xf5f9('0x24')]],'as':_0x5dd51b['as'],'attributes':_0x5dd51b[_0xf5f9('0x20')],'include':_0x5dd51b[_0xf5f9('0x22')]?_['map'](_0x5dd51b[_0xf5f9('0x22')],function(_0xd0d420){return{'model':db[_0xd0d420['model']],'as':_0xd0d420['as'],'attributes':_0xd0d420[_0xf5f9('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f9('0x25')](function(_0xcfbeaa){logger[_0xf5f9('0x11')](_0xf5f9('0x28'),_0x10341b);logger[_0xf5f9('0x27')]('ShowOpenchannelQueue',_0x10341b,JSON[_0xf5f9('0x15')](_0xcfbeaa));_0x142b21(_0xcfbeaa);})['catch'](function(_0x57d6e5){logger[_0xf5f9('0x16')](_0xf5f9('0x28'),_0x57d6e5[_0xf5f9('0x18')],_0x10341b);_0x37e3ef(_0x22f848[_0xf5f9('0x16')](0x1f4,_0x57d6e5[_0xf5f9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 3d325f3..6174a17 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 _0xd026=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0xe99253,_0x3a3b1e){var _0x2b5bd7=function(_0x1151b2){while(--_0x1151b2){_0xe99253['push'](_0xe99253['shift']());}};_0x2b5bd7(++_0x3a3b1e);}(_0xd026,0x17f));var _0x6d02=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xd026[_0xbb091];return _0x467a04;};'use strict';var OpenchannelQueueEvents=require(_0x6d02('0x0'));var events=[_0x6d02('0x1'),'remove','update'];function createListener(_0xf3e257,_0x1d4e36){return function(_0x110f3a){_0x1d4e36[_0x6d02('0x2')](_0xf3e257,_0x110f3a);};}function removeListener(_0x5e08f3,_0x431119){return function(){OpenchannelQueueEvents[_0x6d02('0x3')](_0x5e08f3,_0x431119);};}exports[_0x6d02('0x4')]=function(_0x5c4d32){for(var _0x30e6b0=0x0,_0x25cce9=events[_0x6d02('0x5')];_0x30e6b0<_0x25cce9;_0x30e6b0++){var _0x2d997f=events[_0x30e6b0];var _0x4d37dc=createListener(_0x6d02('0x6')+_0x2d997f,_0x5c4d32);OpenchannelQueueEvents['on'](_0x2d997f,_0x4d37dc);}}; \ No newline at end of file +var _0xe819=['save','remove','removeListener','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x2c7152,_0xcfc1e){var _0x5e385f=function(_0x50a51b){while(--_0x50a51b){_0x2c7152['push'](_0x2c7152['shift']());}};_0x5e385f(++_0xcfc1e);}(_0xe819,0x1a3));var _0x9e81=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe819[_0x14add3];return _0x4a174f;};'use strict';var OpenchannelQueueEvents=require(_0x9e81('0x0'));var events=[_0x9e81('0x1'),_0x9e81('0x2'),'update'];function createListener(_0x4a5e80,_0x5d0059){return function(_0x118ef0){_0x5d0059['emit'](_0x4a5e80,_0x118ef0);};}function removeListener(_0x28c1f4,_0x3c9e3e){return function(){OpenchannelQueueEvents[_0x9e81('0x3')](_0x28c1f4,_0x3c9e3e);};}exports[_0x9e81('0x4')]=function(_0x3e3c9a){for(var _0x664fe6=0x0,_0x560784=events[_0x9e81('0x5')];_0x664fe6<_0x560784;_0x664fe6++){var _0x3eab31=events[_0x664fe6];var _0x25e60c=createListener(_0x9e81('0x6')+_0x3eab31,_0x3e3c9a);OpenchannelQueueEvents['on'](_0x3eab31,_0x25e60c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 22093b3..7dd8d17 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 _0xf7a5=['connect-timeout','express','fs-extra','./openchannelQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7a5,0xa1));var _0x5f7a=function(_0x48ea38,_0xb5b397){_0x48ea38=_0x48ea38-0x0;var _0xa6780=_0xf7a5[_0x48ea38];return _0xa6780;};'use strict';var multer=require(_0x5f7a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f7a('0x1'));var express=require(_0x5f7a('0x2'));var router=express['Router']();var fs_extra=require(_0x5f7a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5f7a('0x4'));router[_0x5f7a('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5f7a('0x5')](_0x5f7a('0x6'),auth[_0x5f7a('0x7')](),controller[_0x5f7a('0x8')]);router[_0x5f7a('0x5')](_0x5f7a('0x9'),auth[_0x5f7a('0x7')](),controller[_0x5f7a('0xa')]);router[_0x5f7a('0xb')]('/',auth[_0x5f7a('0x7')](),controller[_0x5f7a('0xc')]);router[_0x5f7a('0xd')](_0x5f7a('0x9'),auth[_0x5f7a('0x7')](),controller[_0x5f7a('0xe')]);router[_0x5f7a('0xf')]('/:id',auth[_0x5f7a('0x7')](),controller[_0x5f7a('0x10')]);module[_0x5f7a('0x11')]=router; \ No newline at end of file +var _0x2e88=['post','create','put','/:id','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x2e88,0x195));var _0x82e8=function(_0x443494,_0x51fc7e){_0x443494=_0x443494-0x0;var _0x4a6794=_0x2e88[_0x443494];return _0x4a6794;};'use strict';var multer=require(_0x82e8('0x0'));var util=require(_0x82e8('0x1'));var path=require(_0x82e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x82e8('0x3'));var router=express[_0x82e8('0x4')]();var fs_extra=require(_0x82e8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x82e8('0x6'));var config=require(_0x82e8('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x82e8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x82e8('0x9'),auth[_0x82e8('0xa')](),controller[_0x82e8('0xb')]);router[_0x82e8('0x8')]('/:id',auth[_0x82e8('0xa')](),controller[_0x82e8('0xc')]);router[_0x82e8('0xd')]('/',auth[_0x82e8('0xa')](),controller[_0x82e8('0xe')]);router[_0x82e8('0xf')](_0x82e8('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x82e8('0x11')](_0x82e8('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x82e8('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c6d2bad..88fb826 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 _0x3ea4=['sequelize','exports','STRING','DATE','moment'];(function(_0x25ce4f,_0xad7194){var _0x3de67c=function(_0x573309){while(--_0x573309){_0x25ce4f['push'](_0x25ce4f['shift']());}};_0x3de67c(++_0xad7194);}(_0x3ea4,0xd6));var _0x43ea=function(_0x377743,_0x584cab){_0x377743=_0x377743-0x0;var _0x30ae30=_0x3ea4[_0x377743];return _0x30ae30;};'use strict';var moment=require(_0x43ea('0x0'));var Sequelize=require(_0x43ea('0x1'));module[_0x43ea('0x2')]={'uniqueid':{'type':Sequelize[_0x43ea('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x43ea('0x4')]},'leaveAt':{'type':Sequelize[_0x43ea('0x4')]},'acceptAt':{'type':Sequelize[_0x43ea('0x4')]},'exitAt':{'type':Sequelize[_0x43ea('0x4')]},'reason':{'type':Sequelize[_0x43ea('0x3')]}}; \ No newline at end of file +var _0x557e=['STRING','DATE','moment','sequelize','exports'];(function(_0x381542,_0x39322c){var _0x179617=function(_0x372701){while(--_0x372701){_0x381542['push'](_0x381542['shift']());}};_0x179617(++_0x39322c);}(_0x557e,0x16f));var _0xe557=function(_0x4e647d,_0x3d133c){_0x4e647d=_0x4e647d-0x0;var _0x57bc3f=_0x557e[_0x4e647d];return _0x57bc3f;};'use strict';var moment=require(_0xe557('0x0'));var Sequelize=require(_0xe557('0x1'));module[_0xe557('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe557('0x3')]},'joinAt':{'type':Sequelize[_0xe557('0x4')]},'leaveAt':{'type':Sequelize[_0xe557('0x4')]},'acceptAt':{'type':Sequelize[_0xe557('0x4')]},'exitAt':{'type':Sequelize[_0xe557('0x4')]},'reason':{'type':Sequelize[_0xe557('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index e02747d..dbebf03 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 _0x5249=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','VIRTUAL','filter','options','includeAll','rows','show','params','include','merge','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x56a7dd,_0x3fd9ae){var _0xc7b980=function(_0x34221b){while(--_0x34221b){_0x56a7dd['push'](_0x56a7dd['shift']());}};_0xc7b980(++_0x3fd9ae);}(_0x5249,0xc3));var _0x9524=function(_0x494ad2,_0x5840fb){_0x494ad2=_0x494ad2-0x0;var _0x636790=_0x5249[_0x494ad2];return _0x636790;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9524('0x0'));var zipdir=require(_0x9524('0x1'));var jsonpatch=require(_0x9524('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9524('0x3'));var util=require('util');var path=require(_0x9524('0x4'));var sox=require(_0x9524('0x5'));var csv=require(_0x9524('0x6'));var ejs=require(_0x9524('0x7'));var fs=require('fs');var fs_extra=require(_0x9524('0x8'));var _=require(_0x9524('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9524('0xa'));var deskjs=require(_0x9524('0xb'));var toCsv=require(_0x9524('0x6'));var querystring=require(_0x9524('0xc'));var Papa=require(_0x9524('0xd'));var Redis=require(_0x9524('0xe'));var authService=require(_0x9524('0xf'));var qs=require(_0x9524('0x10'));var as=require(_0x9524('0x11'));var hardwareService=require(_0x9524('0x12'));var logger=require(_0x9524('0x13'))(_0x9524('0x14'));var utils=require(_0x9524('0x15'));var config=require(_0x9524('0x16'));var licenseUtil=require(_0x9524('0x17'));var db=require(_0x9524('0x18'))['db'];function respondWithStatusCode(_0x50cb07,_0x233806){_0x233806=_0x233806||0xcc;return function(_0x32f0dc){if(_0x32f0dc){return _0x50cb07[_0x9524('0x19')](_0x233806);}return _0x50cb07[_0x9524('0x1a')](_0x233806)['end']();};}function respondWithResult(_0xed8c30,_0x4be4bc){_0x4be4bc=_0x4be4bc||0xc8;return function(_0x42711c){if(_0x42711c){return _0xed8c30['status'](_0x4be4bc)['json'](_0x42711c);}};}function respondWithFilteredResult(_0xd1bf09,_0x4dc0cf){return function(_0x26b9be){if(_0x26b9be){var _0x117f77=typeof _0x4dc0cf[_0x9524('0x1b')]===_0x9524('0x1c')&&typeof _0x4dc0cf[_0x9524('0x1d')]===_0x9524('0x1c');var _0xfdf6b8=_0x26b9be[_0x9524('0x1e')];var _0x520a5c=_0x117f77?0x0:_0x4dc0cf[_0x9524('0x1b')];var _0x5307a3=_0x117f77?_0x26b9be['count']:_0x4dc0cf[_0x9524('0x1b')]+_0x4dc0cf[_0x9524('0x1d')];var _0x4f8baf;if(_0x5307a3>=_0xfdf6b8){_0x5307a3=_0xfdf6b8;_0x4f8baf=0xc8;}else{_0x4f8baf=0xce;}_0xd1bf09['status'](_0x4f8baf);return _0xd1bf09[_0x9524('0x1f')](_0x9524('0x20'),_0x520a5c+'-'+_0x5307a3+'/'+_0xfdf6b8)[_0x9524('0x21')](_0x26b9be);}return null;};}function patchUpdates(_0x544ac6){return function(_0x5ed3a0){try{jsonpatch['apply'](_0x5ed3a0,_0x544ac6,!![]);}catch(_0x549086){return BPromise[_0x9524('0x22')](_0x549086);}return _0x5ed3a0[_0x9524('0x23')]();};}function saveUpdates(_0x46ef92,_0x221fc1){return function(_0x48f208){if(_0x48f208){return _0x48f208[_0x9524('0x24')](_0x46ef92)[_0x9524('0x25')](function(_0x45e3fb){return _0x45e3fb;});}return null;};}function removeEntity(_0x2c3773,_0x1957a3){return function(_0x4fe93a){if(_0x4fe93a){return _0x4fe93a[_0x9524('0x26')]()[_0x9524('0x25')](function(){_0x2c3773['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x399ce6,_0x48bc6d){return function(_0x21df90){if(!_0x21df90){_0x399ce6[_0x9524('0x19')](0x194);}return _0x21df90;};}function handleError(_0x16b47b,_0x224b9e){_0x224b9e=_0x224b9e||0x1f4;return function(_0x29beac){logger[_0x9524('0x27')](_0x29beac[_0x9524('0x28')]);if(_0x29beac[_0x9524('0x29')]){delete _0x29beac['name'];}_0x16b47b['status'](_0x224b9e)['send'](_0x29beac);};}exports[_0x9524('0x2a')]=function(_0x1c9b79,_0xd3bf14){var _0x477a51={},_0x37db0b={},_0x4c3ecc={'count':0x0,'rows':[]};var _0x5040b5=_[_0x9524('0x2b')](db[_0x9524('0x2c')][_0x9524('0x2d')],function(_0x569cb3){return{'name':_0x569cb3['fieldName'],'type':_0x569cb3[_0x9524('0x2e')]['key']};});_0x37db0b[_0x9524('0x2f')]=_['map'](_0x5040b5,_0x9524('0x29'));_0x37db0b['query']=_[_0x9524('0x30')](_0x1c9b79[_0x9524('0x31')]);_0x37db0b[_0x9524('0x32')]=_['intersection'](_0x37db0b['model'],_0x37db0b[_0x9524('0x31')]);_0x477a51['attributes']=_[_0x9524('0x33')](_0x37db0b['model'],qs[_0x9524('0x34')](_0x1c9b79[_0x9524('0x31')][_0x9524('0x34')]));_0x477a51[_0x9524('0x35')]=_0x477a51['attributes'][_0x9524('0x36')]?_0x477a51[_0x9524('0x35')]:_0x37db0b[_0x9524('0x2f')];if(!_0x1c9b79['query']['hasOwnProperty'](_0x9524('0x37'))){_0x477a51[_0x9524('0x1d')]=qs[_0x9524('0x1d')](_0x1c9b79[_0x9524('0x31')][_0x9524('0x1d')]);_0x477a51[_0x9524('0x1b')]=qs[_0x9524('0x1b')](_0x1c9b79[_0x9524('0x31')]['offset']);}_0x477a51['order']=qs[_0x9524('0x38')](_0x1c9b79[_0x9524('0x31')]['sort']);_0x477a51[_0x9524('0x39')]=qs[_0x9524('0x32')](_['pick'](_0x1c9b79['query'],_0x37db0b[_0x9524('0x32')]),_0x5040b5);if(_0x1c9b79[_0x9524('0x31')]['filter']){_0x477a51[_0x9524('0x39')]=_['merge'](_0x477a51['where'],{'$or':_['map'](_0x5040b5,function(_0x4aeb49){if(_0x4aeb49[_0x9524('0x2e')]!==_0x9524('0x3a')){var _0x1ad152={};_0x1ad152[_0x4aeb49['name']]={'$like':'%'+_0x1c9b79[_0x9524('0x31')][_0x9524('0x3b')]+'%'};return _0x1ad152;}})});}_0x477a51=_['merge']({},_0x477a51,_0x1c9b79[_0x9524('0x3c')]);var _0x5637fe={'where':_0x477a51['where']};return db[_0x9524('0x2c')][_0x9524('0x1e')](_0x5637fe)[_0x9524('0x25')](function(_0x32bf9d){_0x4c3ecc[_0x9524('0x1e')]=_0x32bf9d;if(_0x1c9b79[_0x9524('0x31')][_0x9524('0x3d')]){_0x477a51['include']=[{'all':!![]}];}return db[_0x9524('0x2c')]['findAll'](_0x477a51);})[_0x9524('0x25')](function(_0x329fdc){_0x4c3ecc[_0x9524('0x3e')]=_0x329fdc;return _0x4c3ecc;})[_0x9524('0x25')](respondWithFilteredResult(_0xd3bf14,_0x477a51))['catch'](handleError(_0xd3bf14,null));};exports[_0x9524('0x3f')]=function(_0x414c1b,_0x1d7ff8){var _0x2e0093={'raw':!![],'where':{'id':_0x414c1b[_0x9524('0x40')]['id']}},_0x215e45={};_0x215e45[_0x9524('0x2f')]=_[_0x9524('0x30')](db[_0x9524('0x2c')]['rawAttributes']);_0x215e45[_0x9524('0x31')]=_[_0x9524('0x30')](_0x414c1b[_0x9524('0x31')]);_0x215e45['filters']=_[_0x9524('0x33')](_0x215e45[_0x9524('0x2f')],_0x215e45[_0x9524('0x31')]);_0x2e0093[_0x9524('0x35')]=_[_0x9524('0x33')](_0x215e45[_0x9524('0x2f')],qs[_0x9524('0x34')](_0x414c1b[_0x9524('0x31')][_0x9524('0x34')]));_0x2e0093[_0x9524('0x35')]=_0x2e0093[_0x9524('0x35')][_0x9524('0x36')]?_0x2e0093[_0x9524('0x35')]:_0x215e45[_0x9524('0x2f')];if(_0x414c1b[_0x9524('0x31')]['includeAll']){_0x2e0093[_0x9524('0x41')]=[{'all':!![]}];}_0x2e0093=_[_0x9524('0x42')]({},_0x2e0093,_0x414c1b[_0x9524('0x3c')]);return db[_0x9524('0x2c')][_0x9524('0x43')](_0x2e0093)[_0x9524('0x25')](handleEntityNotFound(_0x1d7ff8,null))['then'](respondWithResult(_0x1d7ff8,null))[_0x9524('0x44')](handleError(_0x1d7ff8,null));};exports[_0x9524('0x45')]=function(_0x2079e4,_0x129600){return db[_0x9524('0x2c')][_0x9524('0x45')](_0x2079e4[_0x9524('0x46')],{})[_0x9524('0x25')](respondWithResult(_0x129600,0xc9))[_0x9524('0x44')](handleError(_0x129600,null));};exports[_0x9524('0x24')]=function(_0x4c1712,_0x248c14){if(_0x4c1712[_0x9524('0x46')]['id']){delete _0x4c1712[_0x9524('0x46')]['id'];}return db[_0x9524('0x2c')][_0x9524('0x43')]({'where':{'id':_0x4c1712[_0x9524('0x40')]['id']}})['then'](handleEntityNotFound(_0x248c14,null))[_0x9524('0x25')](saveUpdates(_0x4c1712['body'],null))[_0x9524('0x25')](respondWithResult(_0x248c14,null))[_0x9524('0x44')](handleError(_0x248c14,null));};exports[_0x9524('0x26')]=function(_0x30c34a,_0x2dd2c4){return db['OpenchannelQueueReport'][_0x9524('0x43')]({'where':{'id':_0x30c34a[_0x9524('0x40')]['id']}})['then'](handleEntityNotFound(_0x2dd2c4,null))['then'](removeEntity(_0x2dd2c4,null))[_0x9524('0x44')](handleError(_0x2dd2c4,null));};exports[_0x9524('0x47')]=function(_0x167d4b,_0xffe51b){return db[_0x9524('0x2c')][_0x9524('0x47')]()['then'](respondWithResult(_0xffe51b,null))[_0x9524('0x44')](handleError(_0xffe51b,null));}; \ No newline at end of file +var _0x5bc5=['end','status','json','offset','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','OpenchannelQueueReport','rawAttributes','fieldName','type','key','map','query','intersection','fields','attributes','length','model','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x523cca,_0x724b3b){var _0x1504dd=function(_0x41437f){while(--_0x41437f){_0x523cca['push'](_0x523cca['shift']());}};_0x1504dd(++_0x724b3b);}(_0x5bc5,0x78));var _0x55bc=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x5bc5[_0x2ab76b];return _0x201126;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55bc('0x0'));var zipdir=require(_0x55bc('0x1'));var jsonpatch=require(_0x55bc('0x2'));var rp=require(_0x55bc('0x3'));var moment=require(_0x55bc('0x4'));var BPromise=require(_0x55bc('0x5'));var Mustache=require(_0x55bc('0x6'));var util=require(_0x55bc('0x7'));var path=require(_0x55bc('0x8'));var sox=require(_0x55bc('0x9'));var csv=require(_0x55bc('0xa'));var ejs=require(_0x55bc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55bc('0xc'));var squel=require(_0x55bc('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x55bc('0xe'));var Papa=require(_0x55bc('0xf'));var Redis=require(_0x55bc('0x10'));var authService=require(_0x55bc('0x11'));var qs=require(_0x55bc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x55bc('0x13'));var logger=require(_0x55bc('0x14'))('api');var utils=require(_0x55bc('0x15'));var config=require(_0x55bc('0x16'));var licenseUtil=require(_0x55bc('0x17'));var db=require(_0x55bc('0x18'))['db'];function respondWithStatusCode(_0x3c4b93,_0xd82cbc){_0xd82cbc=_0xd82cbc||0xcc;return function(_0x5a7583){if(_0x5a7583){return _0x3c4b93[_0x55bc('0x19')](_0xd82cbc);}return _0x3c4b93['status'](_0xd82cbc)[_0x55bc('0x1a')]();};}function respondWithResult(_0x14ab9f,_0x6b8bf9){_0x6b8bf9=_0x6b8bf9||0xc8;return function(_0x5f418b){if(_0x5f418b){return _0x14ab9f[_0x55bc('0x1b')](_0x6b8bf9)[_0x55bc('0x1c')](_0x5f418b);}};}function respondWithFilteredResult(_0x36e13e,_0x264b15){return function(_0x12013d){if(_0x12013d){var _0x5ee386=typeof _0x264b15[_0x55bc('0x1d')]==='undefined'&&typeof _0x264b15[_0x55bc('0x1e')]==='undefined';var _0x235086=_0x12013d[_0x55bc('0x1f')];var _0x587606=_0x5ee386?0x0:_0x264b15['offset'];var _0x2df703=_0x5ee386?_0x12013d['count']:_0x264b15[_0x55bc('0x1d')]+_0x264b15[_0x55bc('0x1e')];var _0x429c6d;if(_0x2df703>=_0x235086){_0x2df703=_0x235086;_0x429c6d=0xc8;}else{_0x429c6d=0xce;}_0x36e13e[_0x55bc('0x1b')](_0x429c6d);return _0x36e13e[_0x55bc('0x20')]('Content-Range',_0x587606+'-'+_0x2df703+'/'+_0x235086)[_0x55bc('0x1c')](_0x12013d);}return null;};}function patchUpdates(_0x2fe524){return function(_0x5cb8db){try{jsonpatch[_0x55bc('0x21')](_0x5cb8db,_0x2fe524,!![]);}catch(_0x22c1e1){return BPromise['reject'](_0x22c1e1);}return _0x5cb8db[_0x55bc('0x22')]();};}function saveUpdates(_0x1b6e98,_0x37fa33){return function(_0x46ac95){if(_0x46ac95){return _0x46ac95[_0x55bc('0x23')](_0x1b6e98)[_0x55bc('0x24')](function(_0x28ebfb){return _0x28ebfb;});}return null;};}function removeEntity(_0x3e8d8b,_0x43dd58){return function(_0x143095){if(_0x143095){return _0x143095[_0x55bc('0x25')]()[_0x55bc('0x24')](function(){_0x3e8d8b['status'](0xcc)[_0x55bc('0x1a')]();});}};}function handleEntityNotFound(_0x2b7cf6,_0x513d51){return function(_0x4ae67f){if(!_0x4ae67f){_0x2b7cf6[_0x55bc('0x19')](0x194);}return _0x4ae67f;};}function handleError(_0x33eaae,_0x26de31){_0x26de31=_0x26de31||0x1f4;return function(_0xcc3706){logger[_0x55bc('0x26')](_0xcc3706[_0x55bc('0x27')]);if(_0xcc3706[_0x55bc('0x28')]){delete _0xcc3706['name'];}_0x33eaae[_0x55bc('0x1b')](_0x26de31)[_0x55bc('0x29')](_0xcc3706);};}exports['index']=function(_0x3ad985,_0x35b7d9){var _0x4efb72={},_0x37d141={},_0xd63c65={'count':0x0,'rows':[]};var _0x286b52=_['map'](db[_0x55bc('0x2a')][_0x55bc('0x2b')],function(_0x4dd94e){return{'name':_0x4dd94e[_0x55bc('0x2c')],'type':_0x4dd94e[_0x55bc('0x2d')][_0x55bc('0x2e')]};});_0x37d141['model']=_[_0x55bc('0x2f')](_0x286b52,'name');_0x37d141[_0x55bc('0x30')]=_['keys'](_0x3ad985['query']);_0x37d141['filters']=_[_0x55bc('0x31')](_0x37d141['model'],_0x37d141['query']);_0x4efb72['attributes']=_[_0x55bc('0x31')](_0x37d141['model'],qs[_0x55bc('0x32')](_0x3ad985[_0x55bc('0x30')][_0x55bc('0x32')]));_0x4efb72[_0x55bc('0x33')]=_0x4efb72[_0x55bc('0x33')][_0x55bc('0x34')]?_0x4efb72[_0x55bc('0x33')]:_0x37d141[_0x55bc('0x35')];if(!_0x3ad985[_0x55bc('0x30')]['hasOwnProperty']('nolimit')){_0x4efb72['limit']=qs[_0x55bc('0x1e')](_0x3ad985['query'][_0x55bc('0x1e')]);_0x4efb72[_0x55bc('0x1d')]=qs[_0x55bc('0x1d')](_0x3ad985['query']['offset']);}_0x4efb72[_0x55bc('0x36')]=qs[_0x55bc('0x37')](_0x3ad985['query'][_0x55bc('0x37')]);_0x4efb72[_0x55bc('0x38')]=qs[_0x55bc('0x39')](_['pick'](_0x3ad985[_0x55bc('0x30')],_0x37d141['filters']),_0x286b52);if(_0x3ad985[_0x55bc('0x30')][_0x55bc('0x3a')]){_0x4efb72['where']=_[_0x55bc('0x3b')](_0x4efb72[_0x55bc('0x38')],{'$or':_[_0x55bc('0x2f')](_0x286b52,function(_0x141db8){if(_0x141db8[_0x55bc('0x2d')]!==_0x55bc('0x3c')){var _0x191f11={};_0x191f11[_0x141db8[_0x55bc('0x28')]]={'$like':'%'+_0x3ad985['query']['filter']+'%'};return _0x191f11;}})});}_0x4efb72=_[_0x55bc('0x3b')]({},_0x4efb72,_0x3ad985[_0x55bc('0x3d')]);var _0x38bd03={'where':_0x4efb72[_0x55bc('0x38')]};return db[_0x55bc('0x2a')]['count'](_0x38bd03)[_0x55bc('0x24')](function(_0x451879){_0xd63c65[_0x55bc('0x1f')]=_0x451879;if(_0x3ad985[_0x55bc('0x30')][_0x55bc('0x3e')]){_0x4efb72[_0x55bc('0x3f')]=[{'all':!![]}];}return db[_0x55bc('0x2a')][_0x55bc('0x40')](_0x4efb72);})[_0x55bc('0x24')](function(_0x8565b5){_0xd63c65['rows']=_0x8565b5;return _0xd63c65;})[_0x55bc('0x24')](respondWithFilteredResult(_0x35b7d9,_0x4efb72))[_0x55bc('0x41')](handleError(_0x35b7d9,null));};exports[_0x55bc('0x42')]=function(_0x2673d3,_0x25e316){var _0x1bebee={'raw':!![],'where':{'id':_0x2673d3[_0x55bc('0x43')]['id']}},_0x2095d8={};_0x2095d8['model']=_[_0x55bc('0x44')](db[_0x55bc('0x2a')][_0x55bc('0x2b')]);_0x2095d8['query']=_[_0x55bc('0x44')](_0x2673d3['query']);_0x2095d8['filters']=_[_0x55bc('0x31')](_0x2095d8[_0x55bc('0x35')],_0x2095d8[_0x55bc('0x30')]);_0x1bebee[_0x55bc('0x33')]=_[_0x55bc('0x31')](_0x2095d8[_0x55bc('0x35')],qs[_0x55bc('0x32')](_0x2673d3['query'][_0x55bc('0x32')]));_0x1bebee[_0x55bc('0x33')]=_0x1bebee[_0x55bc('0x33')][_0x55bc('0x34')]?_0x1bebee[_0x55bc('0x33')]:_0x2095d8[_0x55bc('0x35')];if(_0x2673d3[_0x55bc('0x30')][_0x55bc('0x3e')]){_0x1bebee[_0x55bc('0x3f')]=[{'all':!![]}];}_0x1bebee=_[_0x55bc('0x3b')]({},_0x1bebee,_0x2673d3[_0x55bc('0x3d')]);return db[_0x55bc('0x2a')][_0x55bc('0x45')](_0x1bebee)[_0x55bc('0x24')](handleEntityNotFound(_0x25e316,null))[_0x55bc('0x24')](respondWithResult(_0x25e316,null))[_0x55bc('0x41')](handleError(_0x25e316,null));};exports[_0x55bc('0x46')]=function(_0x4ab1b1,_0x9af145){return db['OpenchannelQueueReport']['create'](_0x4ab1b1[_0x55bc('0x47')],{})[_0x55bc('0x24')](respondWithResult(_0x9af145,0xc9))[_0x55bc('0x41')](handleError(_0x9af145,null));};exports['update']=function(_0x5c5100,_0xe8b4ca){if(_0x5c5100[_0x55bc('0x47')]['id']){delete _0x5c5100[_0x55bc('0x47')]['id'];}return db['OpenchannelQueueReport'][_0x55bc('0x45')]({'where':{'id':_0x5c5100[_0x55bc('0x43')]['id']}})['then'](handleEntityNotFound(_0xe8b4ca,null))[_0x55bc('0x24')](saveUpdates(_0x5c5100[_0x55bc('0x47')],null))['then'](respondWithResult(_0xe8b4ca,null))['catch'](handleError(_0xe8b4ca,null));};exports['destroy']=function(_0x17482f,_0x1b2c1b){return db[_0x55bc('0x2a')][_0x55bc('0x45')]({'where':{'id':_0x17482f['params']['id']}})[_0x55bc('0x24')](handleEntityNotFound(_0x1b2c1b,null))[_0x55bc('0x24')](removeEntity(_0x1b2c1b,null))[_0x55bc('0x41')](handleError(_0x1b2c1b,null));};exports[_0x55bc('0x48')]=function(_0x1b2cf6,_0x5e7aa5){return db[_0x55bc('0x2a')]['describe']()[_0x55bc('0x24')](respondWithResult(_0x5e7aa5,null))[_0x55bc('0x41')](handleError(_0x5e7aa5,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index b2fa107..53ddca1 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x4c2f30,_0xa91340){var _0xb8854d=function(_0x5ddf3d){while(--_0x5ddf3d){_0x4c2f30['push'](_0x4c2f30['shift']());}};_0xb8854d(++_0xa91340);}(_0x814b,0x1a2));var _0xb814=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x814b[_0x2962d5];return _0x273406;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x521a15,_0x7e8b4e){var _0x4d61a9=function(_0x11c248){while(--_0x11c248){_0x521a15['push'](_0x521a15['shift']());}};_0x4d61a9(++_0x7e8b4e);}(_0x326f,0xd1));var _0xf326=function(_0x161e48,_0x4e28e5){_0x161e48=_0x161e48-0x0;var _0x5d111d=_0x326f[_0x161e48];return _0x5d111d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 037f05a..935ea31 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 _0x235b=['code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','UpdateOpenchannelQueueReport','where','limit','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x417025,_0x36b36e){var _0x16ca0c=function(_0x25d07f){while(--_0x25d07f){_0x417025['push'](_0x417025['shift']());}};_0x16ca0c(++_0x36b36e);}(_0x235b,0x1ed));var _0xb235=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x235b[_0x1ab180];return _0xfb2c2d;};'use strict';var _=require(_0xb235('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb235('0x1'));var rs=require(_0xb235('0x2'));var fs=require('fs');var Redis=require(_0xb235('0x3'));var db=require(_0xb235('0x4'))['db'];var utils=require(_0xb235('0x5'));var logger=require(_0xb235('0x6'))('rpc');var config=require(_0xb235('0x7'));var jayson=require(_0xb235('0x8'));var client=jayson[_0xb235('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12d0ae,_0x44559a,_0x2affe8){return new BPromise(function(_0x436d63,_0x3241b4){return client['request'](_0x12d0ae,_0x2affe8)['then'](function(_0xecf759){logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));logger[_0xb235('0xd')](_0xb235('0xe'),_0x44559a,_0xb235('0xc'),JSON[_0xb235('0xf')](_0xecf759));if(_0xecf759['error']){if(_0xecf759[_0xb235('0x10')][_0xb235('0x11')]===0x1f4){logger[_0xb235('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x44559a,_0xecf759[_0xb235('0x10')]['message']);return _0x3241b4(_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);}logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0xecf759[_0xb235('0x10')][_0xb235('0x12')]);return _0x436d63(_0xecf759[_0xb235('0x10')]['message']);}else{logger[_0xb235('0xa')](_0xb235('0xb'),_0x44559a,_0xb235('0xc'));_0x436d63(_0xecf759[_0xb235('0x13')][_0xb235('0x12')]);}})[_0xb235('0x14')](function(_0x16f044){logger[_0xb235('0x10')](_0xb235('0xb'),_0x44559a,_0x16f044);_0x3241b4(_0x16f044);});});}exports[_0xb235('0x15')]=function(_0x2f1c46){var _0x1b9eae=this;return new Promise(function(_0x1f7cb9,_0x55a479){return db[_0xb235('0x16')]['create'](_0x2f1c46[_0xb235('0x17')],{'raw':_0x2f1c46['options']?_0x2f1c46[_0xb235('0x18')][_0xb235('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x447ec6){logger[_0xb235('0xa')](_0xb235('0x15'),_0x2f1c46);logger[_0xb235('0xd')](_0xb235('0x15'),_0x2f1c46,JSON['stringify'](_0x447ec6));_0x1f7cb9(_0x447ec6);})[_0xb235('0x14')](function(_0x12f787){logger[_0xb235('0x10')](_0xb235('0x15'),_0x12f787[_0xb235('0x12')],_0x2f1c46);_0x55a479(_0x1b9eae[_0xb235('0x10')](0x1f4,_0x12f787['message']));});});};exports[_0xb235('0x1a')]=function(_0x57d7f5){var _0x2b5c93=this;return new Promise(function(_0x1d7122,_0xb97b29){return db['OpenchannelQueueReport']['update'](_0x57d7f5['body'],{'raw':_0x57d7f5[_0xb235('0x18')]?_0x57d7f5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57d7f5[_0xb235('0x18')]?_0x57d7f5[_0xb235('0x18')][_0xb235('0x1b')]||null:null,'attributes':_0x57d7f5['options']?_0x57d7f5[_0xb235('0x18')]['attributes']||null:null,'limit':_0x57d7f5['options']?_0x57d7f5[_0xb235('0x18')][_0xb235('0x1c')]||null:null})[_0xb235('0x1d')](function(_0x4fe640){logger[_0xb235('0xa')](_0xb235('0x1a'),_0x57d7f5);logger[_0xb235('0xd')]('UpdateOpenchannelQueueReport',_0x57d7f5,JSON['stringify'](_0x4fe640));_0x1d7122(_0x4fe640);})[_0xb235('0x14')](function(_0x4871b7){logger[_0xb235('0x10')]('UpdateOpenchannelQueueReport',_0x4871b7['message'],_0x57d7f5);_0xb97b29(_0x2b5c93[_0xb235('0x10')](0x1f4,_0x4871b7[_0xb235('0x12')]));});});}; \ No newline at end of file +var _0x4f7b=['where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','raw','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','options'];(function(_0x14e8dc,_0x798969){var _0x1f2a36=function(_0x1d15f8){while(--_0x1d15f8){_0x14e8dc['push'](_0x14e8dc['shift']());}};_0x1f2a36(++_0x798969);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x4d37f2,_0x51bcaf){_0x4d37f2=_0x4d37f2-0x0;var _0x2757f2=_0x4f7b[_0x4d37f2];return _0x2757f2;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var moment=require(_0xb4f7('0x2'));var BPromise=require(_0xb4f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4f7('0x4'));var db=require(_0xb4f7('0x5'))['db'];var utils=require(_0xb4f7('0x6'));var logger=require(_0xb4f7('0x7'))(_0xb4f7('0x8'));var config=require(_0xb4f7('0x9'));var jayson=require(_0xb4f7('0xa'));var client=jayson[_0xb4f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27872e,_0x5e7b94,_0x179391){return new BPromise(function(_0xf56d08,_0x2849ed){return client['request'](_0x27872e,_0x179391)[_0xb4f7('0xc')](function(_0x5af41f){logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));logger['debug'](_0xb4f7('0x10'),_0x5e7b94,_0xb4f7('0xf'),JSON[_0xb4f7('0x11')](_0x5af41f));if(_0x5af41f[_0xb4f7('0x12')]){if(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x13')]===0x1f4){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f['error'][_0xb4f7('0x14')]);return _0x2849ed(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x14')]);}logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f[_0xb4f7('0x12')]['message']);return _0xf56d08(_0x5af41f[_0xb4f7('0x12')]['message']);}else{logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));_0xf56d08(_0x5af41f[_0xb4f7('0x15')][_0xb4f7('0x14')]);}})[_0xb4f7('0x16')](function(_0xbc599a){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0xbc599a);_0x2849ed(_0xbc599a);});});}exports['CreateOpenchannelQueueReport']=function(_0x53b135){var _0x3a78b7=this;return new Promise(function(_0x22e273,_0x4b93fc){return db[_0xb4f7('0x17')][_0xb4f7('0x18')](_0x53b135[_0xb4f7('0x19')],{'raw':_0x53b135['options']?_0x53b135['options'][_0xb4f7('0x1a')]===undefined?!![]:![]:!![]})[_0xb4f7('0xc')](function(_0x5cc40e){logger[_0xb4f7('0xd')](_0xb4f7('0x1b'),_0x53b135);logger[_0xb4f7('0x1c')](_0xb4f7('0x1b'),_0x53b135,JSON['stringify'](_0x5cc40e));_0x22e273(_0x5cc40e);})[_0xb4f7('0x16')](function(_0x56bac5){logger[_0xb4f7('0x12')](_0xb4f7('0x1b'),_0x56bac5[_0xb4f7('0x14')],_0x53b135);_0x4b93fc(_0x3a78b7[_0xb4f7('0x12')](0x1f4,_0x56bac5[_0xb4f7('0x14')]));});});};exports[_0xb4f7('0x1d')]=function(_0x493d81){var _0x1fe0cf=this;return new Promise(function(_0x291166,_0x19e549){return db[_0xb4f7('0x17')][_0xb4f7('0x1e')](_0x493d81[_0xb4f7('0x19')],{'raw':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493d81[_0xb4f7('0x1f')]?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x20')]||null:null,'attributes':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x21')]||null:null,'limit':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x22')]||null:null})[_0xb4f7('0xc')](function(_0x35582a){logger['info'](_0xb4f7('0x1d'),_0x493d81);logger[_0xb4f7('0x1c')](_0xb4f7('0x1d'),_0x493d81,JSON[_0xb4f7('0x11')](_0x35582a));_0x291166(_0x35582a);})['catch'](function(_0x4ea802){logger[_0xb4f7('0x12')]('UpdateOpenchannelQueueReport',_0x4ea802[_0xb4f7('0x14')],_0x493d81);_0x19e549(_0x1fe0cf[_0xb4f7('0x12')](0x1f4,_0x4ea802['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 7c71029..c039273 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 _0xf70f=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','index','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0xf70f,0x1e4));var _0xff70=function(_0x41b133,_0x114320){_0x41b133=_0x41b133-0x0;var _0x844201=_0xf70f[_0x41b133];return _0x844201;};'use strict';var multer=require(_0xff70('0x0'));var util=require(_0xff70('0x1'));var path=require('path');var timeout=require(_0xff70('0x2'));var express=require(_0xff70('0x3'));var router=express[_0xff70('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff70('0x5'));var interaction=require(_0xff70('0x6'));var config=require(_0xff70('0x7'));var controller=require(_0xff70('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xff70('0x9')]);router[_0xff70('0xa')]('/describe',auth[_0xff70('0xb')](),controller[_0xff70('0xc')]);router['get'](_0xff70('0xd'),auth[_0xff70('0xb')](),controller[_0xff70('0xe')]);router[_0xff70('0xf')]('/',auth['isAuthenticated'](),controller[_0xff70('0x10')]);router[_0xff70('0x11')]('/:id',auth[_0xff70('0xb')](),controller[_0xff70('0x12')]);router[_0xff70('0x13')]('/:id',auth[_0xff70('0xb')](),controller[_0xff70('0x14')]);module[_0xff70('0x15')]=router; \ No newline at end of file +var _0x3191=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','post','create','put','/:id','delete','destroy','multer','util','path','connect-timeout'];(function(_0x255005,_0x1e1de1){var _0x3c4730=function(_0x54201f){while(--_0x54201f){_0x255005['push'](_0x255005['shift']());}};_0x3c4730(++_0x1e1de1);}(_0x3191,0xd4));var _0x1319=function(_0x2ab055,_0x3e5a1a){_0x2ab055=_0x2ab055-0x0;var _0x2da2b4=_0x3191[_0x2ab055];return _0x2da2b4;};'use strict';var multer=require(_0x1319('0x0'));var util=require(_0x1319('0x1'));var path=require(_0x1319('0x2'));var timeout=require(_0x1319('0x3'));var express=require(_0x1319('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1319('0x5'));var interaction=require(_0x1319('0x6'));var config=require(_0x1319('0x7'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0x1319('0x8')](),controller['index']);router['get'](_0x1319('0x9'),auth['isAuthenticated'](),controller[_0x1319('0xa')]);router[_0x1319('0xb')]('/:id',auth[_0x1319('0x8')](),controller['show']);router[_0x1319('0xc')]('/',auth[_0x1319('0x8')](),controller[_0x1319('0xd')]);router[_0x1319('0xe')](_0x1319('0xf'),auth[_0x1319('0x8')](),controller['update']);router[_0x1319('0x10')](_0x1319('0xf'),auth[_0x1319('0x8')](),controller[_0x1319('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 4167b49..95251c2 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x589a09,_0x3f1377){var _0x5d6642=function(_0x1eee12){while(--_0x1eee12){_0x589a09['push'](_0x589a09['shift']());}};_0x5d6642(++_0x3f1377);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0xcb91[_0x2b305c];return _0x5d8c85;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5d0a06,_0x2f8043){var _0x2350ca=function(_0xcda60d){while(--_0xcda60d){_0x5d0a06['push'](_0x5d0a06['shift']());}};_0x2350ca(++_0x2f8043);}(_0x34e8,0x12c));var _0x834e=function(_0x16cf0a,_0x2c57fd){_0x16cf0a=_0x16cf0a-0x0;var _0x4e4e12=_0x34e8[_0x16cf0a];return _0x4e4e12;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 4ec63ef..38f9033 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 _0x14f8=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','then','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','catch','create','body','find','params','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse'];(function(_0x3a6d22,_0x18f734){var _0x2c12f8=function(_0x2df71f){while(--_0x2df71f){_0x3a6d22['push'](_0x3a6d22['shift']());}};_0x2c12f8(++_0x18f734);}(_0x14f8,0x7f));var _0x814f=function(_0xb2e201,_0x3bdc08){_0xb2e201=_0xb2e201-0x0;var _0xa380b=_0x14f8[_0xb2e201];return _0xa380b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x814f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x814f('0x1'));var rp=require(_0x814f('0x2'));var moment=require('moment');var BPromise=require(_0x814f('0x3'));var Mustache=require(_0x814f('0x4'));var util=require('util');var path=require(_0x814f('0x5'));var sox=require(_0x814f('0x6'));var csv=require('to-csv');var ejs=require(_0x814f('0x7'));var fs=require('fs');var fs_extra=require(_0x814f('0x8'));var _=require(_0x814f('0x9'));var squel=require(_0x814f('0xa'));var crypto=require(_0x814f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x814f('0xc'));var toCsv=require(_0x814f('0xd'));var querystring=require('querystring');var Papa=require(_0x814f('0xe'));var Redis=require(_0x814f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x814f('0x10'));var as=require(_0x814f('0x11'));var hardwareService=require(_0x814f('0x12'));var logger=require(_0x814f('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x814f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x565d42,_0x273533){_0x273533=_0x273533||0xcc;return function(_0x202ed2){if(_0x202ed2){return _0x565d42[_0x814f('0x15')](_0x273533);}return _0x565d42[_0x814f('0x16')](_0x273533)[_0x814f('0x17')]();};}function respondWithResult(_0x2a343e,_0x4c2467){_0x4c2467=_0x4c2467||0xc8;return function(_0x4858aa){if(_0x4858aa){return _0x2a343e[_0x814f('0x16')](_0x4c2467)[_0x814f('0x18')](_0x4858aa);}};}function respondWithFilteredResult(_0x4b2189,_0x28dbda){return function(_0x34ba84){if(_0x34ba84){var _0x1d8970=typeof _0x28dbda[_0x814f('0x19')]===_0x814f('0x1a')&&typeof _0x28dbda['limit']===_0x814f('0x1a');var _0x23dd9d=_0x34ba84[_0x814f('0x1b')];var _0x49a266=_0x1d8970?0x0:_0x28dbda['offset'];var _0x44877b=_0x1d8970?_0x34ba84[_0x814f('0x1b')]:_0x28dbda[_0x814f('0x19')]+_0x28dbda[_0x814f('0x1c')];var _0x824c4e;if(_0x44877b>=_0x23dd9d){_0x44877b=_0x23dd9d;_0x824c4e=0xc8;}else{_0x824c4e=0xce;}_0x4b2189[_0x814f('0x16')](_0x824c4e);return _0x4b2189[_0x814f('0x1d')](_0x814f('0x1e'),_0x49a266+'-'+_0x44877b+'/'+_0x23dd9d)[_0x814f('0x18')](_0x34ba84);}return null;};}function patchUpdates(_0x4db27a){return function(_0x44899){try{jsonpatch['apply'](_0x44899,_0x4db27a,!![]);}catch(_0x36ec5d){return BPromise[_0x814f('0x1f')](_0x36ec5d);}return _0x44899['save']();};}function saveUpdates(_0x95648d,_0x299dfe){return function(_0x233bdd){if(_0x233bdd){return _0x233bdd['update'](_0x95648d)[_0x814f('0x20')](function(_0x2eddf2){return _0x2eddf2;});}return null;};}function removeEntity(_0x26f95b,_0x2fbfd3){return function(_0x27a479){if(_0x27a479){return _0x27a479['destroy']()[_0x814f('0x20')](function(){_0x26f95b[_0x814f('0x16')](0xcc)[_0x814f('0x17')]();});}};}function handleEntityNotFound(_0x1fb85d,_0x2bc625){return function(_0x48143d){if(!_0x48143d){_0x1fb85d[_0x814f('0x15')](0x194);}return _0x48143d;};}function handleError(_0x10981b,_0x240711){_0x240711=_0x240711||0x1f4;return function(_0x19f682){logger[_0x814f('0x21')](_0x19f682[_0x814f('0x22')]);if(_0x19f682[_0x814f('0x23')]){delete _0x19f682['name'];}_0x10981b[_0x814f('0x16')](_0x240711)[_0x814f('0x24')](_0x19f682);};}exports[_0x814f('0x25')]=function(_0x5ed51b,_0x1296d6){var _0x284981={},_0x156ae9={},_0x364490={'count':0x0,'rows':[]};var _0x3c80f6=_['map'](db[_0x814f('0x26')][_0x814f('0x27')],function(_0x34a73e){return{'name':_0x34a73e[_0x814f('0x28')],'type':_0x34a73e[_0x814f('0x29')][_0x814f('0x2a')]};});_0x156ae9[_0x814f('0x2b')]=_[_0x814f('0x2c')](_0x3c80f6,_0x814f('0x23'));_0x156ae9['query']=_[_0x814f('0x2d')](_0x5ed51b['query']);_0x156ae9[_0x814f('0x2e')]=_['intersection'](_0x156ae9[_0x814f('0x2b')],_0x156ae9[_0x814f('0x2f')]);_0x284981[_0x814f('0x30')]=_[_0x814f('0x31')](_0x156ae9[_0x814f('0x2b')],qs[_0x814f('0x32')](_0x5ed51b['query']['fields']));_0x284981[_0x814f('0x30')]=_0x284981['attributes'][_0x814f('0x33')]?_0x284981[_0x814f('0x30')]:_0x156ae9['model'];if(!_0x5ed51b[_0x814f('0x2f')][_0x814f('0x34')](_0x814f('0x35'))){_0x284981['limit']=qs['limit'](_0x5ed51b[_0x814f('0x2f')]['limit']);_0x284981[_0x814f('0x19')]=qs['offset'](_0x5ed51b[_0x814f('0x2f')][_0x814f('0x19')]);}_0x284981[_0x814f('0x36')]=qs[_0x814f('0x37')](_0x5ed51b[_0x814f('0x2f')][_0x814f('0x37')]);_0x284981[_0x814f('0x38')]=qs[_0x814f('0x2e')](_[_0x814f('0x39')](_0x5ed51b['query'],_0x156ae9['filters']),_0x3c80f6);if(_0x5ed51b['query'][_0x814f('0x3a')]){_0x284981['where']=_[_0x814f('0x3b')](_0x284981[_0x814f('0x38')],{'$or':_[_0x814f('0x2c')](_0x3c80f6,function(_0x340701){if(_0x340701[_0x814f('0x29')]!=='VIRTUAL'){var _0x1d75c4={};_0x1d75c4[_0x340701['name']]={'$like':'%'+_0x5ed51b[_0x814f('0x2f')][_0x814f('0x3a')]+'%'};return _0x1d75c4;}})});}_0x284981=_[_0x814f('0x3b')]({},_0x284981,_0x5ed51b[_0x814f('0x3c')]);var _0xa45e74={'where':_0x284981['where']};return db[_0x814f('0x26')]['count'](_0xa45e74)[_0x814f('0x20')](function(_0x5f18a3){_0x364490[_0x814f('0x1b')]=_0x5f18a3;if(_0x5ed51b[_0x814f('0x2f')][_0x814f('0x3d')]){_0x284981[_0x814f('0x3e')]=[{'all':!![]}];}return db[_0x814f('0x26')][_0x814f('0x3f')](_0x284981);})['then'](function(_0x5ac318){_0x364490['rows']=_0x5ac318;return _0x364490;})[_0x814f('0x20')](respondWithFilteredResult(_0x1296d6,_0x284981))['catch'](handleError(_0x1296d6,null));};exports[_0x814f('0x40')]=function(_0x2459b2,_0x392b5c){var _0x81f494={'raw':!![],'where':{'id':_0x2459b2['params']['id']}},_0x3fecb3={};_0x3fecb3['model']=_[_0x814f('0x2d')](db[_0x814f('0x26')][_0x814f('0x27')]);_0x3fecb3[_0x814f('0x2f')]=_['keys'](_0x2459b2[_0x814f('0x2f')]);_0x3fecb3[_0x814f('0x2e')]=_[_0x814f('0x31')](_0x3fecb3['model'],_0x3fecb3[_0x814f('0x2f')]);_0x81f494[_0x814f('0x30')]=_['intersection'](_0x3fecb3[_0x814f('0x2b')],qs[_0x814f('0x32')](_0x2459b2[_0x814f('0x2f')][_0x814f('0x32')]));_0x81f494[_0x814f('0x30')]=_0x81f494[_0x814f('0x30')][_0x814f('0x33')]?_0x81f494[_0x814f('0x30')]:_0x3fecb3[_0x814f('0x2b')];if(_0x2459b2[_0x814f('0x2f')][_0x814f('0x3d')]){_0x81f494[_0x814f('0x3e')]=[{'all':!![]}];}_0x81f494=_[_0x814f('0x3b')]({},_0x81f494,_0x2459b2[_0x814f('0x3c')]);return db[_0x814f('0x26')]['find'](_0x81f494)[_0x814f('0x20')](handleEntityNotFound(_0x392b5c,null))[_0x814f('0x20')](respondWithResult(_0x392b5c,null))[_0x814f('0x41')](handleError(_0x392b5c,null));};exports['create']=function(_0x55fd4b,_0x2e7659){return db[_0x814f('0x26')][_0x814f('0x42')](_0x55fd4b[_0x814f('0x43')],{})[_0x814f('0x20')](respondWithResult(_0x2e7659,0xc9))[_0x814f('0x41')](handleError(_0x2e7659,null));};exports['update']=function(_0x232aa6,_0x387f24){if(_0x232aa6[_0x814f('0x43')]['id']){delete _0x232aa6['body']['id'];}return db[_0x814f('0x26')][_0x814f('0x44')]({'where':{'id':_0x232aa6['params']['id']}})['then'](handleEntityNotFound(_0x387f24,null))[_0x814f('0x20')](saveUpdates(_0x232aa6[_0x814f('0x43')],null))['then'](respondWithResult(_0x387f24,null))[_0x814f('0x41')](handleError(_0x387f24,null));};exports['destroy']=function(_0x3595f5,_0x56811e){return db[_0x814f('0x26')][_0x814f('0x44')]({'where':{'id':_0x3595f5[_0x814f('0x45')]['id']}})[_0x814f('0x20')](handleEntityNotFound(_0x56811e,null))[_0x814f('0x20')](removeEntity(_0x56811e,null))['catch'](handleError(_0x56811e,null));};exports[_0x814f('0x46')]=function(_0xb1d8f,_0x31c2d1){return db[_0x814f('0x26')][_0x814f('0x46')]()[_0x814f('0x20')](respondWithResult(_0x31c2d1,null))[_0x814f('0x41')](handleError(_0x31c2d1,null));}; \ No newline at end of file +var _0xbd93=['hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x10f5d1,_0x32f939){var _0x5b7aec=function(_0x20ca5e){while(--_0x20ca5e){_0x10f5d1['push'](_0x10f5d1['shift']());}};_0x5b7aec(++_0x32f939);}(_0xbd93,0xa4));var _0x3bd9=function(_0x5a0837,_0x500c31){_0x5a0837=_0x5a0837-0x0;var _0x54ff81=_0xbd93[_0x5a0837];return _0x54ff81;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bd9('0x0'));var zipdir=require(_0x3bd9('0x1'));var jsonpatch=require(_0x3bd9('0x2'));var rp=require(_0x3bd9('0x3'));var moment=require(_0x3bd9('0x4'));var BPromise=require(_0x3bd9('0x5'));var Mustache=require('mustache');var util=require(_0x3bd9('0x6'));var path=require(_0x3bd9('0x7'));var sox=require('sox');var csv=require(_0x3bd9('0x8'));var ejs=require(_0x3bd9('0x9'));var fs=require('fs');var fs_extra=require(_0x3bd9('0xa'));var _=require(_0x3bd9('0xb'));var squel=require(_0x3bd9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3bd9('0x8'));var querystring=require('querystring');var Papa=require(_0x3bd9('0xd'));var Redis=require(_0x3bd9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3bd9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bd9('0x10'))('api');var utils=require(_0x3bd9('0x11'));var config=require(_0x3bd9('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3df9d1,_0x3a61da){_0x3a61da=_0x3a61da||0xcc;return function(_0x37c2b0){if(_0x37c2b0){return _0x3df9d1[_0x3bd9('0x13')](_0x3a61da);}return _0x3df9d1[_0x3bd9('0x14')](_0x3a61da)[_0x3bd9('0x15')]();};}function respondWithResult(_0x2f0366,_0x16e9c9){_0x16e9c9=_0x16e9c9||0xc8;return function(_0x103ade){if(_0x103ade){return _0x2f0366[_0x3bd9('0x14')](_0x16e9c9)[_0x3bd9('0x16')](_0x103ade);}};}function respondWithFilteredResult(_0x16c865,_0x3baf0e){return function(_0x5ac62b){if(_0x5ac62b){var _0x5782c7=typeof _0x3baf0e['offset']===_0x3bd9('0x17')&&typeof _0x3baf0e[_0x3bd9('0x18')]===_0x3bd9('0x17');var _0xcc0c72=_0x5ac62b[_0x3bd9('0x19')];var _0x558d5d=_0x5782c7?0x0:_0x3baf0e['offset'];var _0x28fee5=_0x5782c7?_0x5ac62b['count']:_0x3baf0e['offset']+_0x3baf0e['limit'];var _0x2fae76;if(_0x28fee5>=_0xcc0c72){_0x28fee5=_0xcc0c72;_0x2fae76=0xc8;}else{_0x2fae76=0xce;}_0x16c865[_0x3bd9('0x14')](_0x2fae76);return _0x16c865[_0x3bd9('0x1a')](_0x3bd9('0x1b'),_0x558d5d+'-'+_0x28fee5+'/'+_0xcc0c72)[_0x3bd9('0x16')](_0x5ac62b);}return null;};}function patchUpdates(_0x54b725){return function(_0x9f9157){try{jsonpatch[_0x3bd9('0x1c')](_0x9f9157,_0x54b725,!![]);}catch(_0x303844){return BPromise[_0x3bd9('0x1d')](_0x303844);}return _0x9f9157[_0x3bd9('0x1e')]();};}function saveUpdates(_0x14f5b5,_0x1231ca){return function(_0x500319){if(_0x500319){return _0x500319[_0x3bd9('0x1f')](_0x14f5b5)['then'](function(_0x442606){return _0x442606;});}return null;};}function removeEntity(_0x30b8a9,_0x5ec198){return function(_0x2869e0){if(_0x2869e0){return _0x2869e0[_0x3bd9('0x20')]()[_0x3bd9('0x21')](function(){_0x30b8a9[_0x3bd9('0x14')](0xcc)[_0x3bd9('0x15')]();});}};}function handleEntityNotFound(_0x594f27,_0x1b9b2b){return function(_0xaf86ed){if(!_0xaf86ed){_0x594f27['sendStatus'](0x194);}return _0xaf86ed;};}function handleError(_0x36ae2c,_0x3c109f){_0x3c109f=_0x3c109f||0x1f4;return function(_0x752f15){logger[_0x3bd9('0x22')](_0x752f15[_0x3bd9('0x23')]);if(_0x752f15[_0x3bd9('0x24')]){delete _0x752f15[_0x3bd9('0x24')];}_0x36ae2c[_0x3bd9('0x14')](_0x3c109f)['send'](_0x752f15);};}exports[_0x3bd9('0x25')]=function(_0x521a34,_0x3515fb){var _0x2b3b3b={},_0x57e78d={},_0x3dc683={'count':0x0,'rows':[]};var _0xdf8762=_[_0x3bd9('0x26')](db[_0x3bd9('0x27')][_0x3bd9('0x28')],function(_0x1c6884){return{'name':_0x1c6884[_0x3bd9('0x29')],'type':_0x1c6884[_0x3bd9('0x2a')][_0x3bd9('0x2b')]};});_0x57e78d[_0x3bd9('0x2c')]=_[_0x3bd9('0x26')](_0xdf8762,'name');_0x57e78d[_0x3bd9('0x2d')]=_[_0x3bd9('0x2e')](_0x521a34['query']);_0x57e78d[_0x3bd9('0x2f')]=_[_0x3bd9('0x30')](_0x57e78d[_0x3bd9('0x2c')],_0x57e78d['query']);_0x2b3b3b[_0x3bd9('0x31')]=_[_0x3bd9('0x30')](_0x57e78d[_0x3bd9('0x2c')],qs[_0x3bd9('0x32')](_0x521a34['query'][_0x3bd9('0x32')]));_0x2b3b3b[_0x3bd9('0x31')]=_0x2b3b3b['attributes'][_0x3bd9('0x33')]?_0x2b3b3b['attributes']:_0x57e78d['model'];if(!_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x34')](_0x3bd9('0x35'))){_0x2b3b3b[_0x3bd9('0x18')]=qs[_0x3bd9('0x18')](_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x18')]);_0x2b3b3b[_0x3bd9('0x36')]=qs[_0x3bd9('0x36')](_0x521a34['query']['offset']);}_0x2b3b3b[_0x3bd9('0x37')]=qs[_0x3bd9('0x38')](_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x38')]);_0x2b3b3b[_0x3bd9('0x39')]=qs[_0x3bd9('0x2f')](_[_0x3bd9('0x3a')](_0x521a34[_0x3bd9('0x2d')],_0x57e78d['filters']),_0xdf8762);if(_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x3b')]){_0x2b3b3b['where']=_[_0x3bd9('0x3c')](_0x2b3b3b[_0x3bd9('0x39')],{'$or':_['map'](_0xdf8762,function(_0x873ca9){if(_0x873ca9['type']!==_0x3bd9('0x3d')){var _0x18343e={};_0x18343e[_0x873ca9['name']]={'$like':'%'+_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x3b')]+'%'};return _0x18343e;}})});}_0x2b3b3b=_['merge']({},_0x2b3b3b,_0x521a34['options']);var _0x1ee730={'where':_0x2b3b3b[_0x3bd9('0x39')]};return db[_0x3bd9('0x27')][_0x3bd9('0x19')](_0x1ee730)[_0x3bd9('0x21')](function(_0x23d45d){_0x3dc683[_0x3bd9('0x19')]=_0x23d45d;if(_0x521a34[_0x3bd9('0x2d')][_0x3bd9('0x3e')]){_0x2b3b3b['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x2b3b3b);})['then'](function(_0x255242){_0x3dc683[_0x3bd9('0x3f')]=_0x255242;return _0x3dc683;})[_0x3bd9('0x21')](respondWithFilteredResult(_0x3515fb,_0x2b3b3b))[_0x3bd9('0x40')](handleError(_0x3515fb,null));};exports[_0x3bd9('0x41')]=function(_0x27d15d,_0x438cf0){var _0x17b6c5={'raw':!![],'where':{'id':_0x27d15d[_0x3bd9('0x42')]['id']}},_0x2a9f73={};_0x2a9f73[_0x3bd9('0x2c')]=_['keys'](db[_0x3bd9('0x27')][_0x3bd9('0x28')]);_0x2a9f73[_0x3bd9('0x2d')]=_['keys'](_0x27d15d[_0x3bd9('0x2d')]);_0x2a9f73['filters']=_[_0x3bd9('0x30')](_0x2a9f73[_0x3bd9('0x2c')],_0x2a9f73[_0x3bd9('0x2d')]);_0x17b6c5[_0x3bd9('0x31')]=_[_0x3bd9('0x30')](_0x2a9f73[_0x3bd9('0x2c')],qs[_0x3bd9('0x32')](_0x27d15d[_0x3bd9('0x2d')][_0x3bd9('0x32')]));_0x17b6c5[_0x3bd9('0x31')]=_0x17b6c5[_0x3bd9('0x31')]['length']?_0x17b6c5[_0x3bd9('0x31')]:_0x2a9f73[_0x3bd9('0x2c')];if(_0x27d15d[_0x3bd9('0x2d')][_0x3bd9('0x3e')]){_0x17b6c5[_0x3bd9('0x43')]=[{'all':!![]}];}_0x17b6c5=_['merge']({},_0x17b6c5,_0x27d15d[_0x3bd9('0x44')]);return db[_0x3bd9('0x27')][_0x3bd9('0x45')](_0x17b6c5)[_0x3bd9('0x21')](handleEntityNotFound(_0x438cf0,null))[_0x3bd9('0x21')](respondWithResult(_0x438cf0,null))['catch'](handleError(_0x438cf0,null));};exports['create']=function(_0x4df9d2,_0x5dfe5b){return db['OpenchannelTransferReport']['create'](_0x4df9d2['body'],{})[_0x3bd9('0x21')](respondWithResult(_0x5dfe5b,0xc9))[_0x3bd9('0x40')](handleError(_0x5dfe5b,null));};exports['update']=function(_0x211ebd,_0x42a9c6){if(_0x211ebd[_0x3bd9('0x46')]['id']){delete _0x211ebd[_0x3bd9('0x46')]['id'];}return db[_0x3bd9('0x27')][_0x3bd9('0x45')]({'where':{'id':_0x211ebd[_0x3bd9('0x42')]['id']}})[_0x3bd9('0x21')](handleEntityNotFound(_0x42a9c6,null))[_0x3bd9('0x21')](saveUpdates(_0x211ebd['body'],null))[_0x3bd9('0x21')](respondWithResult(_0x42a9c6,null))['catch'](handleError(_0x42a9c6,null));};exports[_0x3bd9('0x20')]=function(_0x3675af,_0x4de7ba){return db[_0x3bd9('0x27')][_0x3bd9('0x45')]({'where':{'id':_0x3675af[_0x3bd9('0x42')]['id']}})['then'](handleEntityNotFound(_0x4de7ba,null))[_0x3bd9('0x21')](removeEntity(_0x4de7ba,null))[_0x3bd9('0x40')](handleError(_0x4de7ba,null));};exports[_0x3bd9('0x47')]=function(_0x3a399b,_0x20284c){return db[_0x3bd9('0x27')][_0x3bd9('0x47')]()[_0x3bd9('0x21')](respondWithResult(_0x20284c,null))[_0x3bd9('0x40')](handleError(_0x20284c,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 7d2fe08..711a43e 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 _0xeaba=['../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x57454b,_0x563920){var _0x39623b=function(_0x1e94a5){while(--_0x1e94a5){_0x57454b['push'](_0x57454b['shift']());}};_0x39623b(++_0x563920);}(_0xeaba,0x1b2));var _0xaeab=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeaba[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xaeab('0x0'));var logger=require(_0xaeab('0x1'))('api');var moment=require(_0xaeab('0x2'));var BPromise=require('bluebird');var rp=require(_0xaeab('0x3'));var fs=require('fs');var path=require(_0xaeab('0x4'));var rimraf=require(_0xaeab('0x5'));var config=require(_0xaeab('0x6'));var attributes=require(_0xaeab('0x7'));module[_0xaeab('0x8')]=function(_0x5194e4,_0x40c64b){return _0x5194e4['define'](_0xaeab('0x9'),attributes,{'tableName':_0xaeab('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe7c9=['path','rimraf','./openchannelTransferReport.attributes','exports','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4c69d3,_0x49f5f6){var _0x618dd7=function(_0x462bbf){while(--_0x462bbf){_0x4c69d3['push'](_0x4c69d3['shift']());}};_0x618dd7(++_0x49f5f6);}(_0xe7c9,0x10e));var _0x9e7c=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xe7c9[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x9e7c('0x0'));var util=require(_0x9e7c('0x1'));var logger=require('../../config/logger')(_0x9e7c('0x2'));var moment=require(_0x9e7c('0x3'));var BPromise=require(_0x9e7c('0x4'));var rp=require(_0x9e7c('0x5'));var fs=require('fs');var path=require(_0x9e7c('0x6'));var rimraf=require(_0x9e7c('0x7'));var config=require('../../config/environment');var attributes=require(_0x9e7c('0x8'));module[_0x9e7c('0x9')]=function(_0x302b22,_0x402771){return _0x302b22['define']('OpenchannelTransferReport',attributes,{'tableName':_0x9e7c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9e7c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 5fe2873..c15e0ec 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 _0x23f4=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x1ca9b7,_0x58e6be){var _0x21fa2d=function(_0x3d5661){while(--_0x3d5661){_0x1ca9b7['push'](_0x1ca9b7['shift']());}};_0x21fa2d(++_0x58e6be);}(_0x23f4,0x1ee));var _0x423f=function(_0x4ed1d8,_0x559671){_0x4ed1d8=_0x4ed1d8-0x0;var _0x2e5a71=_0x23f4[_0x4ed1d8];return _0x2e5a71;};'use strict';var _=require('lodash');var util=require(_0x423f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x423f('0x1'));var fs=require('fs');var Redis=require(_0x423f('0x2'));var db=require(_0x423f('0x3'))['db'];var utils=require(_0x423f('0x4'));var logger=require(_0x423f('0x5'))(_0x423f('0x6'));var config=require(_0x423f('0x7'));var jayson=require(_0x423f('0x8'));var client=jayson[_0x423f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x260eae,_0x47716d,_0x55258d){return new BPromise(function(_0x727b4e,_0x416fb1){return client[_0x423f('0xa')](_0x260eae,_0x55258d)['then'](function(_0x5b5ee6){logger['info'](_0x423f('0xb'),_0x47716d,'request\x20sent');logger[_0x423f('0xc')](_0x423f('0xd'),_0x47716d,_0x423f('0xe'),JSON[_0x423f('0xf')](_0x5b5ee6));if(_0x5b5ee6['error']){if(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x11')]===0x1f4){logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x5b5ee6[_0x423f('0x10')]['message']);return _0x416fb1(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);}logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);return _0x727b4e(_0x5b5ee6[_0x423f('0x10')][_0x423f('0x12')]);}else{logger[_0x423f('0x13')](_0x423f('0xb'),_0x47716d,_0x423f('0xe'));_0x727b4e(_0x5b5ee6[_0x423f('0x14')][_0x423f('0x12')]);}})[_0x423f('0x15')](function(_0x9d1487){logger[_0x423f('0x10')](_0x423f('0xb'),_0x47716d,_0x9d1487);_0x416fb1(_0x9d1487);});});} \ No newline at end of file +var _0x8c32=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x10b70c,_0x7eba93){var _0x3f779c=function(_0x2cb001){while(--_0x2cb001){_0x10b70c['push'](_0x10b70c['shift']());}};_0x3f779c(++_0x7eba93);}(_0x8c32,0x130));var _0x28c3=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8c32[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x28c3('0x0'));var util=require(_0x28c3('0x1'));var moment=require(_0x28c3('0x2'));var BPromise=require(_0x28c3('0x3'));var rs=require(_0x28c3('0x4'));var fs=require('fs');var Redis=require(_0x28c3('0x5'));var db=require(_0x28c3('0x6'))['db'];var utils=require(_0x28c3('0x7'));var logger=require(_0x28c3('0x8'))(_0x28c3('0x9'));var config=require(_0x28c3('0xa'));var jayson=require(_0x28c3('0xb'));var client=jayson['client'][_0x28c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ed515,_0x2ce6c1,_0x482952){return new BPromise(function(_0xbaee6f,_0x2fb4cb){return client['request'](_0x4ed515,_0x482952)[_0x28c3('0xd')](function(_0x37bda3){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2ce6c1,'request\x20sent');logger[_0x28c3('0xe')](_0x28c3('0xf'),_0x2ce6c1,'request\x20sent',JSON[_0x28c3('0x10')](_0x37bda3));if(_0x37bda3[_0x28c3('0x11')]){if(_0x37bda3[_0x28c3('0x11')]['code']===0x1f4){logger[_0x28c3('0x11')](_0x28c3('0x12'),_0x2ce6c1,_0x37bda3[_0x28c3('0x11')][_0x28c3('0x13')]);return _0x2fb4cb(_0x37bda3[_0x28c3('0x11')]['message']);}logger[_0x28c3('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2ce6c1,_0x37bda3[_0x28c3('0x11')]['message']);return _0xbaee6f(_0x37bda3[_0x28c3('0x11')]['message']);}else{logger[_0x28c3('0x14')](_0x28c3('0x12'),_0x2ce6c1,'request\x20sent');_0xbaee6f(_0x37bda3[_0x28c3('0x15')]['message']);}})['catch'](function(_0x58e2b9){logger[_0x28c3('0x11')](_0x28c3('0x12'),_0x2ce6c1,_0x58e2b9);_0x2fb4cb(_0x58e2b9);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index c06675d..9c772ef 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 _0x66ef=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','/:id','show','create','put','update'];(function(_0x1373f8,_0x3102e3){var _0x588833=function(_0x51b547){while(--_0x51b547){_0x1373f8['push'](_0x1373f8['shift']());}};_0x588833(++_0x3102e3);}(_0x66ef,0x145));var _0xf66e=function(_0x28f9cd,_0x4141fa){_0x28f9cd=_0x28f9cd-0x0;var _0x23ca51=_0x66ef[_0x28f9cd];return _0x23ca51;};'use strict';var multer=require(_0xf66e('0x0'));var util=require(_0xf66e('0x1'));var path=require(_0xf66e('0x2'));var timeout=require(_0xf66e('0x3'));var express=require(_0xf66e('0x4'));var router=express[_0xf66e('0x5')]();var fs_extra=require(_0xf66e('0x6'));var auth=require(_0xf66e('0x7'));var interaction=require(_0xf66e('0x8'));var config=require('../../config/environment');var controller=require(_0xf66e('0x9'));router[_0xf66e('0xa')]('/',auth[_0xf66e('0xb')](),controller['index']);router[_0xf66e('0xa')](_0xf66e('0xc'),auth[_0xf66e('0xb')](),controller[_0xf66e('0xd')]);router['post']('/',auth[_0xf66e('0xb')](),controller[_0xf66e('0xe')]);router[_0xf66e('0xf')]('/:id',auth[_0xf66e('0xb')](),controller[_0xf66e('0x10')]);router[_0xf66e('0x11')]('/:id',auth[_0xf66e('0xb')](),controller[_0xf66e('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd79f=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2ee353,_0x4fb599){var _0x165ce6=function(_0x592945){while(--_0x592945){_0x2ee353['push'](_0x2ee353['shift']());}};_0x165ce6(++_0x4fb599);}(_0xd79f,0x1be));var _0xfd79=function(_0xff03c9,_0x53d47e){_0xff03c9=_0xff03c9-0x0;var _0x4bc893=_0xd79f[_0xff03c9];return _0x4bc893;};'use strict';var multer=require(_0xfd79('0x0'));var util=require(_0xfd79('0x1'));var path=require(_0xfd79('0x2'));var timeout=require(_0xfd79('0x3'));var express=require(_0xfd79('0x4'));var router=express[_0xfd79('0x5')]();var fs_extra=require(_0xfd79('0x6'));var auth=require(_0xfd79('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xfd79('0x8'));var controller=require(_0xfd79('0x9'));router[_0xfd79('0xa')]('/',auth[_0xfd79('0xb')](),controller[_0xfd79('0xc')]);router[_0xfd79('0xa')](_0xfd79('0xd'),auth[_0xfd79('0xb')](),controller[_0xfd79('0xe')]);router[_0xfd79('0xf')]('/',auth[_0xfd79('0xb')](),controller[_0xfd79('0x10')]);router[_0xfd79('0x11')](_0xfd79('0xd'),auth[_0xfd79('0xb')](),controller[_0xfd79('0x12')]);router['delete'](_0xfd79('0xd'),auth[_0xfd79('0xb')](),controller[_0xfd79('0x13')]);module[_0xfd79('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 617418b..fc25e96 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 _0xec6a=['exports','name','STRING','sequelize'];(function(_0xf3d95e,_0x4034b7){var _0x2e0ca7=function(_0x3bf02c){while(--_0x3bf02c){_0xf3d95e['push'](_0xf3d95e['shift']());}};_0x2e0ca7(++_0x4034b7);}(_0xec6a,0x127));var _0xaec6=function(_0x2dc513,_0x38f3e0){_0x2dc513=_0x2dc513-0x0;var _0x3ded47=_0xec6a[_0x2dc513];return _0x3ded47;};'use strict';var Sequelize=require(_0xaec6('0x0'));module[_0xaec6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xaec6('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xaec6('0x3')]}}; \ No newline at end of file +var _0xa8e6=['name','sequelize','exports','STRING'];(function(_0x37b083,_0x188d8a){var _0x3cf208=function(_0x4490b0){while(--_0x4490b0){_0x37b083['push'](_0x37b083['shift']());}};_0x3cf208(++_0x188d8a);}(_0xa8e6,0xa5));var _0x6a8e=function(_0x2d798b,_0x3259ad){_0x2d798b=_0x2d798b-0x0;var _0x24a27d=_0xa8e6[_0x2d798b];return _0x24a27d;};'use strict';var Sequelize=require(_0x6a8e('0x0'));module[_0x6a8e('0x1')]={'name':{'type':Sequelize[_0x6a8e('0x2')],'unique':_0x6a8e('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6a8e('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 064aaa4..b337a86 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 _0x1b74=['destroy','get','Pauses','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Pause','include','findAll','rows','catch','show','params','length','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','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then'];(function(_0x2ebee7,_0x333543){var _0xd8485=function(_0x5d3d3a){while(--_0x5d3d3a){_0x2ebee7['push'](_0x2ebee7['shift']());}};_0xd8485(++_0x333543);}(_0x1b74,0xe5));var _0x41b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1b74[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x41b7('0x0'));var rimraf=require(_0x41b7('0x1'));var zipdir=require(_0x41b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x41b7('0x3'));var moment=require(_0x41b7('0x4'));var BPromise=require(_0x41b7('0x5'));var Mustache=require(_0x41b7('0x6'));var util=require(_0x41b7('0x7'));var path=require('path');var sox=require(_0x41b7('0x8'));var csv=require(_0x41b7('0x9'));var ejs=require(_0x41b7('0xa'));var fs=require('fs');var fs_extra=require(_0x41b7('0xb'));var _=require(_0x41b7('0xc'));var squel=require('squel');var crypto=require(_0x41b7('0xd'));var jsforce=require(_0x41b7('0xe'));var deskjs=require(_0x41b7('0xf'));var toCsv=require(_0x41b7('0x9'));var querystring=require(_0x41b7('0x10'));var Papa=require('papaparse');var Redis=require(_0x41b7('0x11'));var authService=require(_0x41b7('0x12'));var qs=require(_0x41b7('0x13'));var as=require(_0x41b7('0x14'));var hardwareService=require(_0x41b7('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x41b7('0x16'));var config=require(_0x41b7('0x17'));var licenseUtil=require(_0x41b7('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x426c0a,_0x5e1942){_0x5e1942=_0x5e1942||0xcc;return function(_0x5e1b92){if(_0x5e1b92){return _0x426c0a['sendStatus'](_0x5e1942);}return _0x426c0a[_0x41b7('0x19')](_0x5e1942)['end']();};}function respondWithResult(_0xafd39e,_0x39a915){_0x39a915=_0x39a915||0xc8;return function(_0xa9a09e){if(_0xa9a09e){return _0xafd39e[_0x41b7('0x19')](_0x39a915)['json'](_0xa9a09e);}};}function respondWithFilteredResult(_0x3c1793,_0x3bd0b7){return function(_0x22c387){if(_0x22c387){var _0x57eedb=typeof _0x3bd0b7[_0x41b7('0x1a')]===_0x41b7('0x1b')&&typeof _0x3bd0b7[_0x41b7('0x1c')]===_0x41b7('0x1b');var _0x524789=_0x22c387[_0x41b7('0x1d')];var _0x4d684d=_0x57eedb?0x0:_0x3bd0b7['offset'];var _0x320177=_0x57eedb?_0x22c387[_0x41b7('0x1d')]:_0x3bd0b7[_0x41b7('0x1a')]+_0x3bd0b7[_0x41b7('0x1c')];var _0x1051d9;if(_0x320177>=_0x524789){_0x320177=_0x524789;_0x1051d9=0xc8;}else{_0x1051d9=0xce;}_0x3c1793[_0x41b7('0x19')](_0x1051d9);return _0x3c1793[_0x41b7('0x1e')](_0x41b7('0x1f'),_0x4d684d+'-'+_0x320177+'/'+_0x524789)[_0x41b7('0x20')](_0x22c387);}return null;};}function patchUpdates(_0xde98d7){return function(_0x2a934c){try{jsonpatch[_0x41b7('0x21')](_0x2a934c,_0xde98d7,!![]);}catch(_0x1e8a20){return BPromise[_0x41b7('0x22')](_0x1e8a20);}return _0x2a934c[_0x41b7('0x23')]();};}function saveUpdates(_0x5603d2,_0x57673e){return function(_0x45e61f){if(_0x45e61f){return _0x45e61f[_0x41b7('0x24')](_0x5603d2)[_0x41b7('0x25')](function(_0xa2eb5b){return _0xa2eb5b;});}return null;};}function removeEntity(_0x5ef02e,_0x51816d){return function(_0x2fb010){if(_0x2fb010){return _0x2fb010[_0x41b7('0x26')]()['then'](function(){var _0x48a1ad=_0x2fb010[_0x41b7('0x27')]({'plain':!![]});var _0x186376=_0x41b7('0x28');return db[_0x41b7('0x29')][_0x41b7('0x26')]({'where':{'type':_0x186376,'resourceId':_0x48a1ad['id']}})[_0x41b7('0x25')](function(){return _0x2fb010;});})['then'](function(){_0x5ef02e['status'](0xcc)[_0x41b7('0x2a')]();});}};}function handleEntityNotFound(_0x2fe000,_0x28e0f6){return function(_0x509f88){if(!_0x509f88){_0x2fe000['sendStatus'](0x194);}return _0x509f88;};}function handleError(_0xd05b45,_0x1d5b5c){_0x1d5b5c=_0x1d5b5c||0x1f4;return function(_0x36db0d){logger[_0x41b7('0x2b')](_0x36db0d[_0x41b7('0x2c')]);if(_0x36db0d[_0x41b7('0x2d')]){delete _0x36db0d['name'];}_0xd05b45['status'](_0x1d5b5c)[_0x41b7('0x2e')](_0x36db0d);};}exports[_0x41b7('0x2f')]=function(_0x46c7a2,_0xa5628a){var _0x44ba31={},_0x12dec9={},_0x47a0aa={'count':0x0,'rows':[]};var _0x441fd4=_[_0x41b7('0x30')](db['Pause'][_0x41b7('0x31')],function(_0x2e14ed){return{'name':_0x2e14ed[_0x41b7('0x32')],'type':_0x2e14ed[_0x41b7('0x33')][_0x41b7('0x34')]};});_0x12dec9[_0x41b7('0x35')]=_[_0x41b7('0x30')](_0x441fd4,'name');_0x12dec9[_0x41b7('0x36')]=_[_0x41b7('0x37')](_0x46c7a2[_0x41b7('0x36')]);_0x12dec9[_0x41b7('0x38')]=_[_0x41b7('0x39')](_0x12dec9[_0x41b7('0x35')],_0x12dec9['query']);_0x44ba31[_0x41b7('0x3a')]=_[_0x41b7('0x39')](_0x12dec9['model'],qs[_0x41b7('0x3b')](_0x46c7a2[_0x41b7('0x36')][_0x41b7('0x3b')]));_0x44ba31[_0x41b7('0x3a')]=_0x44ba31[_0x41b7('0x3a')]['length']?_0x44ba31[_0x41b7('0x3a')]:_0x12dec9[_0x41b7('0x35')];if(!_0x46c7a2['query'][_0x41b7('0x3c')](_0x41b7('0x3d'))){_0x44ba31['limit']=qs[_0x41b7('0x1c')](_0x46c7a2['query']['limit']);_0x44ba31[_0x41b7('0x1a')]=qs[_0x41b7('0x1a')](_0x46c7a2[_0x41b7('0x36')][_0x41b7('0x1a')]);}_0x44ba31[_0x41b7('0x3e')]=qs[_0x41b7('0x3f')](_0x46c7a2[_0x41b7('0x36')][_0x41b7('0x3f')]);_0x44ba31[_0x41b7('0x40')]=qs[_0x41b7('0x38')](_[_0x41b7('0x41')](_0x46c7a2[_0x41b7('0x36')],_0x12dec9[_0x41b7('0x38')]),_0x441fd4);if(_0x46c7a2[_0x41b7('0x36')][_0x41b7('0x42')]){_0x44ba31[_0x41b7('0x40')]=_[_0x41b7('0x43')](_0x44ba31[_0x41b7('0x40')],{'$or':_[_0x41b7('0x30')](_0x441fd4,function(_0x20872f){if(_0x20872f['type']!==_0x41b7('0x44')){var _0x18fe2c={};_0x18fe2c[_0x20872f[_0x41b7('0x2d')]]={'$like':'%'+_0x46c7a2[_0x41b7('0x36')]['filter']+'%'};return _0x18fe2c;}})});}_0x44ba31=_[_0x41b7('0x43')]({},_0x44ba31,_0x46c7a2[_0x41b7('0x45')]);var _0xb6a7d8={'where':_0x44ba31[_0x41b7('0x40')]};return db[_0x41b7('0x46')][_0x41b7('0x1d')](_0xb6a7d8)[_0x41b7('0x25')](function(_0x57081c){_0x47a0aa[_0x41b7('0x1d')]=_0x57081c;if(_0x46c7a2[_0x41b7('0x36')]['includeAll']){_0x44ba31[_0x41b7('0x47')]=[{'all':!![]}];}return db[_0x41b7('0x46')][_0x41b7('0x48')](_0x44ba31);})[_0x41b7('0x25')](function(_0x333d14){_0x47a0aa[_0x41b7('0x49')]=_0x333d14;return _0x47a0aa;})[_0x41b7('0x25')](respondWithFilteredResult(_0xa5628a,_0x44ba31))[_0x41b7('0x4a')](handleError(_0xa5628a,null));};exports[_0x41b7('0x4b')]=function(_0x1e688d,_0x21a2ce){var _0x295b3d={'raw':!![],'where':{'id':_0x1e688d[_0x41b7('0x4c')]['id']}},_0x117e81={};_0x117e81[_0x41b7('0x35')]=_[_0x41b7('0x37')](db['Pause']['rawAttributes']);_0x117e81['query']=_['keys'](_0x1e688d[_0x41b7('0x36')]);_0x117e81[_0x41b7('0x38')]=_[_0x41b7('0x39')](_0x117e81['model'],_0x117e81[_0x41b7('0x36')]);_0x295b3d[_0x41b7('0x3a')]=_[_0x41b7('0x39')](_0x117e81['model'],qs[_0x41b7('0x3b')](_0x1e688d[_0x41b7('0x36')]['fields']));_0x295b3d[_0x41b7('0x3a')]=_0x295b3d[_0x41b7('0x3a')][_0x41b7('0x4d')]?_0x295b3d[_0x41b7('0x3a')]:_0x117e81['model'];if(_0x1e688d[_0x41b7('0x36')][_0x41b7('0x4e')]){_0x295b3d[_0x41b7('0x47')]=[{'all':!![]}];}_0x295b3d=_[_0x41b7('0x43')]({},_0x295b3d,_0x1e688d[_0x41b7('0x45')]);return db[_0x41b7('0x46')][_0x41b7('0x4f')](_0x295b3d)[_0x41b7('0x25')](handleEntityNotFound(_0x21a2ce,null))[_0x41b7('0x25')](respondWithResult(_0x21a2ce,null))[_0x41b7('0x4a')](handleError(_0x21a2ce,null));};exports[_0x41b7('0x50')]=function(_0x1324a7,_0x50d365){return db[_0x41b7('0x46')][_0x41b7('0x50')](_0x1324a7[_0x41b7('0x51')],{})[_0x41b7('0x25')](function(_0x8cf175){var _0x520dc8=_0x1324a7[_0x41b7('0x52')][_0x41b7('0x27')]({'plain':!![]});if(!_0x520dc8)throw new Error(_0x41b7('0x53'));if(_0x520dc8[_0x41b7('0x54')]==='user'){var _0x293df9=_0x8cf175[_0x41b7('0x27')]({'plain':!![]});var _0x230065='Pauses';return db[_0x41b7('0x55')][_0x41b7('0x4f')]({'where':{'name':_0x230065,'userProfileId':_0x520dc8[_0x41b7('0x56')]},'raw':!![]})['then'](function(_0x765e13){if(_0x765e13&&_0x765e13[_0x41b7('0x57')]===0x0){return db[_0x41b7('0x29')][_0x41b7('0x50')]({'name':_0x293df9[_0x41b7('0x2d')],'resourceId':_0x293df9['id'],'type':_0x765e13[_0x41b7('0x2d')],'sectionId':_0x765e13['id']},{})[_0x41b7('0x25')](function(){return _0x8cf175;});}else{return _0x8cf175;}})[_0x41b7('0x4a')](function(_0x1c63a9){logger[_0x41b7('0x2b')](_0x41b7('0x58'),_0x1c63a9);throw _0x1c63a9;});}return _0x8cf175;})['then'](respondWithResult(_0x50d365,0xc9))[_0x41b7('0x4a')](handleError(_0x50d365,null));};exports['update']=function(_0x267167,_0x25c69a){if(_0x267167[_0x41b7('0x51')]['id']){delete _0x267167['body']['id'];}return db['Pause'][_0x41b7('0x4f')]({'where':{'id':_0x267167[_0x41b7('0x4c')]['id']}})[_0x41b7('0x25')](handleEntityNotFound(_0x25c69a,null))[_0x41b7('0x25')](saveUpdates(_0x267167[_0x41b7('0x51')],null))['then'](respondWithResult(_0x25c69a,null))[_0x41b7('0x4a')](handleError(_0x25c69a,null));};exports['destroy']=function(_0x382c4a,_0x23d333){return db[_0x41b7('0x46')]['find']({'where':{'id':_0x382c4a[_0x41b7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23d333,null))[_0x41b7('0x25')](removeEntity(_0x23d333,null))[_0x41b7('0x4a')](handleError(_0x23d333,null));}; \ No newline at end of file +var _0x0e54=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','Pauses','error','stack','name','send','map','Pause','fieldName','key','model','query','attributes','intersection','fields','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','keys','length','includeAll','find','create','body','user','get'];(function(_0x3a0ecc,_0xb6a6a7){var _0x45f9bf=function(_0x528417){while(--_0x528417){_0x3a0ecc['push'](_0x3a0ecc['shift']());}};_0x45f9bf(++_0xb6a6a7);}(_0x0e54,0x147));var _0x40e5=function(_0x2b100c,_0x1da489){_0x2b100c=_0x2b100c-0x0;var _0x550694=_0x0e54[_0x2b100c];return _0x550694;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x40e5('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40e5('0x1'));var moment=require('moment');var BPromise=require(_0x40e5('0x2'));var Mustache=require(_0x40e5('0x3'));var util=require(_0x40e5('0x4'));var path=require(_0x40e5('0x5'));var sox=require('sox');var csv=require(_0x40e5('0x6'));var ejs=require(_0x40e5('0x7'));var fs=require('fs');var fs_extra=require(_0x40e5('0x8'));var _=require(_0x40e5('0x9'));var squel=require(_0x40e5('0xa'));var crypto=require(_0x40e5('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x40e5('0x6'));var querystring=require(_0x40e5('0xc'));var Papa=require(_0x40e5('0xd'));var Redis=require('ioredis');var authService=require(_0x40e5('0xe'));var qs=require(_0x40e5('0xf'));var as=require(_0x40e5('0x10'));var hardwareService=require(_0x40e5('0x11'));var logger=require(_0x40e5('0x12'))('api');var utils=require(_0x40e5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x40e5('0x14'));var db=require(_0x40e5('0x15'))['db'];function respondWithStatusCode(_0x58584c,_0x290816){_0x290816=_0x290816||0xcc;return function(_0x5aa9b6){if(_0x5aa9b6){return _0x58584c[_0x40e5('0x16')](_0x290816);}return _0x58584c[_0x40e5('0x17')](_0x290816)[_0x40e5('0x18')]();};}function respondWithResult(_0x35b1df,_0x1cb2b2){_0x1cb2b2=_0x1cb2b2||0xc8;return function(_0xf4e882){if(_0xf4e882){return _0x35b1df['status'](_0x1cb2b2)[_0x40e5('0x19')](_0xf4e882);}};}function respondWithFilteredResult(_0x43ad76,_0x15d8a2){return function(_0xe582c5){if(_0xe582c5){var _0x3c3589=typeof _0x15d8a2['offset']==='undefined'&&typeof _0x15d8a2['limit']===_0x40e5('0x1a');var _0x184413=_0xe582c5[_0x40e5('0x1b')];var _0x5f38c3=_0x3c3589?0x0:_0x15d8a2[_0x40e5('0x1c')];var _0x541fff=_0x3c3589?_0xe582c5['count']:_0x15d8a2[_0x40e5('0x1c')]+_0x15d8a2[_0x40e5('0x1d')];var _0x303a9d;if(_0x541fff>=_0x184413){_0x541fff=_0x184413;_0x303a9d=0xc8;}else{_0x303a9d=0xce;}_0x43ad76[_0x40e5('0x17')](_0x303a9d);return _0x43ad76[_0x40e5('0x1e')](_0x40e5('0x1f'),_0x5f38c3+'-'+_0x541fff+'/'+_0x184413)[_0x40e5('0x19')](_0xe582c5);}return null;};}function patchUpdates(_0xf3f3d8){return function(_0x1990f7){try{jsonpatch[_0x40e5('0x20')](_0x1990f7,_0xf3f3d8,!![]);}catch(_0x11000c){return BPromise[_0x40e5('0x21')](_0x11000c);}return _0x1990f7['save']();};}function saveUpdates(_0x4a23ef,_0x79fcd7){return function(_0x5ce91e){if(_0x5ce91e){return _0x5ce91e[_0x40e5('0x22')](_0x4a23ef)[_0x40e5('0x23')](function(_0x5bb0b0){return _0x5bb0b0;});}return null;};}function removeEntity(_0x3b334d,_0x2b6c7f){return function(_0x3e702b){if(_0x3e702b){return _0x3e702b[_0x40e5('0x24')]()[_0x40e5('0x23')](function(){var _0x225ab6=_0x3e702b['get']({'plain':!![]});var _0x52acf0=_0x40e5('0x25');return db['UserProfileResource'][_0x40e5('0x24')]({'where':{'type':_0x52acf0,'resourceId':_0x225ab6['id']}})[_0x40e5('0x23')](function(){return _0x3e702b;});})[_0x40e5('0x23')](function(){_0x3b334d[_0x40e5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ccc2a,_0x15a3cd){return function(_0x1dfc31){if(!_0x1dfc31){_0x5ccc2a[_0x40e5('0x16')](0x194);}return _0x1dfc31;};}function handleError(_0x3283c7,_0x34ea40){_0x34ea40=_0x34ea40||0x1f4;return function(_0x4278c6){logger[_0x40e5('0x26')](_0x4278c6[_0x40e5('0x27')]);if(_0x4278c6['name']){delete _0x4278c6[_0x40e5('0x28')];}_0x3283c7['status'](_0x34ea40)[_0x40e5('0x29')](_0x4278c6);};}exports['index']=function(_0x4a1a0d,_0x5702d6){var _0x323dec={},_0x78276a={},_0x1d7262={'count':0x0,'rows':[]};var _0x19ee58=_[_0x40e5('0x2a')](db[_0x40e5('0x2b')]['rawAttributes'],function(_0x54dfbf){return{'name':_0x54dfbf[_0x40e5('0x2c')],'type':_0x54dfbf['type'][_0x40e5('0x2d')]};});_0x78276a[_0x40e5('0x2e')]=_[_0x40e5('0x2a')](_0x19ee58,_0x40e5('0x28'));_0x78276a[_0x40e5('0x2f')]=_['keys'](_0x4a1a0d[_0x40e5('0x2f')]);_0x78276a['filters']=_['intersection'](_0x78276a[_0x40e5('0x2e')],_0x78276a['query']);_0x323dec[_0x40e5('0x30')]=_[_0x40e5('0x31')](_0x78276a[_0x40e5('0x2e')],qs[_0x40e5('0x32')](_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x32')]));_0x323dec[_0x40e5('0x30')]=_0x323dec[_0x40e5('0x30')]['length']?_0x323dec[_0x40e5('0x30')]:_0x78276a[_0x40e5('0x2e')];if(!_0x4a1a0d['query']['hasOwnProperty'](_0x40e5('0x33'))){_0x323dec[_0x40e5('0x1d')]=qs[_0x40e5('0x1d')](_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x1d')]);_0x323dec[_0x40e5('0x1c')]=qs[_0x40e5('0x1c')](_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x1c')]);}_0x323dec['order']=qs[_0x40e5('0x34')](_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x34')]);_0x323dec[_0x40e5('0x35')]=qs[_0x40e5('0x36')](_['pick'](_0x4a1a0d[_0x40e5('0x2f')],_0x78276a[_0x40e5('0x36')]),_0x19ee58);if(_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x37')]){_0x323dec[_0x40e5('0x35')]=_[_0x40e5('0x38')](_0x323dec[_0x40e5('0x35')],{'$or':_[_0x40e5('0x2a')](_0x19ee58,function(_0x4da16a){if(_0x4da16a[_0x40e5('0x39')]!==_0x40e5('0x3a')){var _0x2eabd3={};_0x2eabd3[_0x4da16a[_0x40e5('0x28')]]={'$like':'%'+_0x4a1a0d[_0x40e5('0x2f')][_0x40e5('0x37')]+'%'};return _0x2eabd3;}})});}_0x323dec=_[_0x40e5('0x38')]({},_0x323dec,_0x4a1a0d[_0x40e5('0x3b')]);var _0x49196c={'where':_0x323dec[_0x40e5('0x35')]};return db['Pause'][_0x40e5('0x1b')](_0x49196c)[_0x40e5('0x23')](function(_0x385c26){_0x1d7262['count']=_0x385c26;if(_0x4a1a0d['query']['includeAll']){_0x323dec[_0x40e5('0x3c')]=[{'all':!![]}];}return db[_0x40e5('0x2b')][_0x40e5('0x3d')](_0x323dec);})['then'](function(_0x59e03c){_0x1d7262['rows']=_0x59e03c;return _0x1d7262;})[_0x40e5('0x23')](respondWithFilteredResult(_0x5702d6,_0x323dec))[_0x40e5('0x3e')](handleError(_0x5702d6,null));};exports[_0x40e5('0x3f')]=function(_0x1538f9,_0x5cb9d4){var _0xab3c1b={'raw':!![],'where':{'id':_0x1538f9[_0x40e5('0x40')]['id']}},_0x294e0e={};_0x294e0e['model']=_[_0x40e5('0x41')](db[_0x40e5('0x2b')]['rawAttributes']);_0x294e0e[_0x40e5('0x2f')]=_[_0x40e5('0x41')](_0x1538f9[_0x40e5('0x2f')]);_0x294e0e[_0x40e5('0x36')]=_[_0x40e5('0x31')](_0x294e0e[_0x40e5('0x2e')],_0x294e0e['query']);_0xab3c1b[_0x40e5('0x30')]=_[_0x40e5('0x31')](_0x294e0e['model'],qs['fields'](_0x1538f9['query']['fields']));_0xab3c1b[_0x40e5('0x30')]=_0xab3c1b[_0x40e5('0x30')][_0x40e5('0x42')]?_0xab3c1b['attributes']:_0x294e0e[_0x40e5('0x2e')];if(_0x1538f9[_0x40e5('0x2f')][_0x40e5('0x43')]){_0xab3c1b[_0x40e5('0x3c')]=[{'all':!![]}];}_0xab3c1b=_[_0x40e5('0x38')]({},_0xab3c1b,_0x1538f9[_0x40e5('0x3b')]);return db[_0x40e5('0x2b')][_0x40e5('0x44')](_0xab3c1b)[_0x40e5('0x23')](handleEntityNotFound(_0x5cb9d4,null))[_0x40e5('0x23')](respondWithResult(_0x5cb9d4,null))[_0x40e5('0x3e')](handleError(_0x5cb9d4,null));};exports[_0x40e5('0x45')]=function(_0xd2d41d,_0x1d8a11){return db[_0x40e5('0x2b')][_0x40e5('0x45')](_0xd2d41d[_0x40e5('0x46')],{})[_0x40e5('0x23')](function(_0x1716c9){var _0x1219cc=_0xd2d41d[_0x40e5('0x47')][_0x40e5('0x48')]({'plain':!![]});if(!_0x1219cc)throw new Error(_0x40e5('0x49'));if(_0x1219cc[_0x40e5('0x4a')]===_0x40e5('0x47')){var _0x420925=_0x1716c9[_0x40e5('0x48')]({'plain':!![]});var _0x488d07=_0x40e5('0x25');return db[_0x40e5('0x4b')][_0x40e5('0x44')]({'where':{'name':_0x488d07,'userProfileId':_0x1219cc[_0x40e5('0x4c')]},'raw':!![]})['then'](function(_0x1c0bdd){if(_0x1c0bdd&&_0x1c0bdd[_0x40e5('0x4d')]===0x0){return db[_0x40e5('0x4e')]['create']({'name':_0x420925[_0x40e5('0x28')],'resourceId':_0x420925['id'],'type':_0x1c0bdd[_0x40e5('0x28')],'sectionId':_0x1c0bdd['id']},{})[_0x40e5('0x23')](function(){return _0x1716c9;});}else{return _0x1716c9;}})[_0x40e5('0x3e')](function(_0x27bde7){logger[_0x40e5('0x26')](_0x40e5('0x4f'),_0x27bde7);throw _0x27bde7;});}return _0x1716c9;})['then'](respondWithResult(_0x1d8a11,0xc9))[_0x40e5('0x3e')](handleError(_0x1d8a11,null));};exports[_0x40e5('0x22')]=function(_0x59a423,_0x26f5bc){if(_0x59a423[_0x40e5('0x46')]['id']){delete _0x59a423[_0x40e5('0x46')]['id'];}return db[_0x40e5('0x2b')][_0x40e5('0x44')]({'where':{'id':_0x59a423[_0x40e5('0x40')]['id']}})['then'](handleEntityNotFound(_0x26f5bc,null))[_0x40e5('0x23')](saveUpdates(_0x59a423['body'],null))[_0x40e5('0x23')](respondWithResult(_0x26f5bc,null))[_0x40e5('0x3e')](handleError(_0x26f5bc,null));};exports[_0x40e5('0x24')]=function(_0x3e299c,_0x121346){return db[_0x40e5('0x2b')][_0x40e5('0x44')]({'where':{'id':_0x3e299c[_0x40e5('0x40')]['id']}})[_0x40e5('0x23')](handleEntityNotFound(_0x121346,null))[_0x40e5('0x23')](removeEntity(_0x121346,null))[_0x40e5('0x3e')](handleError(_0x121346,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 7ea2dfe..eb9e449 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x215b81,_0x2e5b6d){_0x215b81=_0x215b81-0x0;var _0x52177b=_0x7fbe[_0x215b81];return _0x52177b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 61c625e..40e2662 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(_0x1b0618,_0x2590aa){var _0x480841=function(_0x38b15a){while(--_0x38b15a){_0x1b0618['push'](_0x1b0618['shift']());}};_0x480841(++_0x2590aa);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a94b1,_0x4f2518){_0x4a94b1=_0x4a94b1-0x0;var _0x20949f=_0xb10b[_0x4a94b1];return _0x20949f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x40c4da,_0x3364ff){var _0x13e776=function(_0x3c1919){while(--_0x3c1919){_0x40c4da['push'](_0x40c4da['shift']());}};_0x13e776(++_0x3364ff);}(_0x7a54,0x106));var _0x47a5=function(_0x13c890,_0x335b8f){_0x13c890=_0x13c890-0x0;var _0x57a2e2=_0x7a54[_0x13c890];return _0x57a2e2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 35560f6..09f3a8e 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 _0x98a8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','webhookGet','/:id','show','/:id/download','download','diskStorage','root','format','%s-%s%s','basename','originalname','extname','post','file','webhookPost','put','update','delete'];(function(_0x31af8c,_0x2be236){var _0x35d49b=function(_0x32d8ae){while(--_0x32d8ae){_0x31af8c['push'](_0x31af8c['shift']());}};_0x35d49b(++_0x2be236);}(_0x98a8,0x12c));var _0x898a=function(_0xe271e2,_0x54fd70){_0xe271e2=_0xe271e2-0x0;var _0x1bd00=_0x98a8[_0xe271e2];return _0x1bd00;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')]('/',auth[_0x898a('0xb')](),controller['index']);router[_0x898a('0xa')]('/webhook',controller[_0x898a('0xc')]);router['get'](_0x898a('0xd'),auth[_0x898a('0xb')](),controller[_0x898a('0xe')]);router[_0x898a('0xa')](_0x898a('0xf'),auth[_0x898a('0xb')](),controller[_0x898a('0x10')]);var upload=multer({'storage':multer[_0x898a('0x11')]({'destination':function(_0x3806cb,_0x5d2de4,_0x3e1867){_0x3e1867(null,path['join'](config[_0x898a('0x12')],'server/files/plugins'));},'filename':function(_0x25d7f2,_0x2c76b7,_0x364a23){_0x2c76b7['originalname']=_0x2c76b7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x364a23(null,util[_0x898a('0x13')](_0x898a('0x14'),path[_0x898a('0x15')](_0x2c76b7[_0x898a('0x16')],path[_0x898a('0x17')](_0x2c76b7[_0x898a('0x16')])),Date['now'](),path[_0x898a('0x17')](_0x2c76b7['originalname'])));}})});router[_0x898a('0x18')]('/',upload['single'](_0x898a('0x19')),controller['upload']);router[_0x898a('0x18')]('/webhook',controller[_0x898a('0x1a')]);router[_0x898a('0x1b')](_0x898a('0xd'),auth['isAuthenticated'](),controller[_0x898a('0x1c')]);router['delete']('/:id',auth[_0x898a('0xb')](),controller[_0x898a('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x222f=['index','webhookGet','isAuthenticated','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','extname','now','post','single','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x135904,_0x1e252b){var _0x1ce7d5=function(_0x25a721){while(--_0x25a721){_0x135904['push'](_0x135904['shift']());}};_0x1ce7d5(++_0x1e252b);}(_0x222f,0x1a4));var _0xf222=function(_0x582d5a,_0x3b57c0){_0x582d5a=_0x582d5a-0x0;var _0x5625ef=_0x222f[_0x582d5a];return _0x5625ef;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf222('0x4'));var auth=require(_0xf222('0x5'));var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require('./plugin.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/webhook',controller[_0xf222('0xa')]);router[_0xf222('0x8')]('/:id',auth[_0xf222('0xb')](),controller[_0xf222('0xc')]);router[_0xf222('0x8')](_0xf222('0xd'),auth[_0xf222('0xb')](),controller[_0xf222('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e29ad,_0x405080,_0x226dbd){_0x226dbd(null,path[_0xf222('0xf')](config['root'],_0xf222('0x10')));},'filename':function(_0x2850c7,_0x2a6965,_0x3d3d29){_0x2a6965[_0xf222('0x11')]=_0x2a6965[_0xf222('0x11')][_0xf222('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d3d29(null,util[_0xf222('0x13')]('%s-%s%s',path['basename'](_0x2a6965[_0xf222('0x11')],path[_0xf222('0x14')](_0x2a6965['originalname'])),Date[_0xf222('0x15')](),path[_0xf222('0x14')](_0x2a6965[_0xf222('0x11')])));}})});router[_0xf222('0x16')]('/',upload[_0xf222('0x17')](_0xf222('0x18')),controller[_0xf222('0x19')]);router['post'](_0xf222('0x1a'),controller[_0xf222('0x1b')]);router[_0xf222('0x1c')](_0xf222('0x1d'),auth[_0xf222('0xb')](),controller[_0xf222('0x1e')]);router[_0xf222('0x1f')]('/:id',auth[_0xf222('0xb')](),controller[_0xf222('0x1f')]);module[_0xf222('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 468af27..6f1d74d 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 _0xb401=['ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','sequelize','exports','STRING'];(function(_0x5cbc60,_0xef6bb4){var _0xc11013=function(_0x570477){while(--_0x570477){_0x5cbc60['push'](_0x5cbc60['shift']());}};_0xc11013(++_0xef6bb4);}(_0xb401,0xe3));var _0x1b40=function(_0x4f9ff3,_0x108236){_0x4f9ff3=_0x4f9ff3-0x0;var _0x1a6c55=_0xb401[_0x4f9ff3];return _0x1a6c55;};'use strict';var Sequelize=require(_0x1b40('0x0'));module[_0x1b40('0x1')]={'name':{'type':Sequelize[_0x1b40('0x2')]},'type':{'type':Sequelize[_0x1b40('0x3')](_0x1b40('0x4'),_0x1b40('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x1b40('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1b40('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x1b40('0x8'),_0x1b40('0x9'),'always','never'),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x1b40('0x2')]},'adminUrl':{'type':Sequelize[_0x1b40('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x1b40('0x2')]}}; \ No newline at end of file +var _0x79af=['html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x79af,0x99));var _0xf79a=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x79af[_0x58e469];return _0x4c01c5;};'use strict';var Sequelize=require(_0xf79a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xf79a('0x1'),_0xf79a('0x2'))},'description':{'type':Sequelize[_0xf79a('0x3')]},'version':{'type':Sequelize[_0xf79a('0x3')]},'path':{'type':Sequelize[_0xf79a('0x4')],'comment':_0xf79a('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf79a('0x6')},'sidebar':{'type':Sequelize[_0xf79a('0x7')]('adminOnly','agentOnly',_0xf79a('0x8'),_0xf79a('0x9')),'defaultValue':_0xf79a('0x8'),'comment':_0xf79a('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xf79a('0x4')]},'agentUrl':{'type':Sequelize[_0xf79a('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xf79a('0x4')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 9bca2a7..a7e2a27 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 _0x6f91=['plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','scriptPath','body','userProfileId','role','user','get','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','then','destroy','Plugins','UserProfileResource','name','send','index','map','Plugin','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','rawAttributes','length','includeAll','find','path','root','basename','warning','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','join','dirname','node_modules/**/*','attachments/**/*','close','download','format','%s.zip','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test'];(function(_0x111165,_0x4f9303){var _0x64f7b6=function(_0x400882){while(--_0x400882){_0x111165['push'](_0x111165['shift']());}};_0x64f7b6(++_0x4f9303);}(_0x6f91,0xbf));var _0x16f9=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x6f91[_0x596f6e];return _0x1e0803;};'use strict';var emlformat=require(_0x16f9('0x0'));var rimraf=require(_0x16f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x16f9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x16f9('0x3'));var Mustache=require(_0x16f9('0x4'));var util=require(_0x16f9('0x5'));var path=require('path');var sox=require(_0x16f9('0x6'));var csv=require(_0x16f9('0x7'));var ejs=require(_0x16f9('0x8'));var fs=require('fs');var fs_extra=require(_0x16f9('0x9'));var _=require(_0x16f9('0xa'));var squel=require(_0x16f9('0xb'));var crypto=require(_0x16f9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x16f9('0xd'));var toCsv=require(_0x16f9('0x7'));var querystring=require(_0x16f9('0xe'));var Papa=require('papaparse');var extract=require(_0x16f9('0xf'));var rimraf=require(_0x16f9('0x1'));var archiver=require(_0x16f9('0x10'));var Redis=require('ioredis');var authService=require(_0x16f9('0x11'));var qs=require(_0x16f9('0x12'));var as=require(_0x16f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x16f9('0x14'))(_0x16f9('0x15'));var utils=require('../../config/utils');var config=require(_0x16f9('0x16'));var licenseUtil=require(_0x16f9('0x17'));var db=require('../../mysqldb')['db'];config[_0x16f9('0x18')]=_[_0x16f9('0x19')](config['redis'],{'host':_0x16f9('0x1a'),'port':0x18eb});var socket=require(_0x16f9('0x1b'))(new Redis(config['redis']));require(_0x16f9('0x1c'))[_0x16f9('0x1d')](socket);function respondWithStatusCode(_0x23b42b,_0x1c49d4){_0x1c49d4=_0x1c49d4||0xcc;return function(_0x52638d){if(_0x52638d){return _0x23b42b[_0x16f9('0x1e')](_0x1c49d4);}return _0x23b42b['status'](_0x1c49d4)['end']();};}function respondWithResult(_0x4024bb,_0x402634){_0x402634=_0x402634||0xc8;return function(_0xce3838){if(_0xce3838){return _0x4024bb[_0x16f9('0x1f')](_0x402634)[_0x16f9('0x20')](_0xce3838);}};}function respondWithFilteredResult(_0x1735d4,_0x4771ab){return function(_0x2c0d9b){if(_0x2c0d9b){var _0x48ecd5=typeof _0x4771ab[_0x16f9('0x21')]===_0x16f9('0x22')&&typeof _0x4771ab[_0x16f9('0x23')]===_0x16f9('0x22');var _0x16efd9=_0x2c0d9b['count'];var _0x3f85db=_0x48ecd5?0x0:_0x4771ab[_0x16f9('0x21')];var _0x5eff47=_0x48ecd5?_0x2c0d9b[_0x16f9('0x24')]:_0x4771ab[_0x16f9('0x21')]+_0x4771ab[_0x16f9('0x23')];var _0x5753c2;if(_0x5eff47>=_0x16efd9){_0x5eff47=_0x16efd9;_0x5753c2=0xc8;}else{_0x5753c2=0xce;}_0x1735d4[_0x16f9('0x1f')](_0x5753c2);return _0x1735d4[_0x16f9('0x25')]('Content-Range',_0x3f85db+'-'+_0x5eff47+'/'+_0x16efd9)[_0x16f9('0x20')](_0x2c0d9b);}return null;};}function patchUpdates(_0x34f220){return function(_0x1932dc){try{jsonpatch['apply'](_0x1932dc,_0x34f220,!![]);}catch(_0x38bc4a){return BPromise[_0x16f9('0x26')](_0x38bc4a);}return _0x1932dc['save']();};}function saveUpdates(_0x12704b,_0x49286d){return function(_0x8b09f){if(_0x8b09f){return _0x8b09f[_0x16f9('0x27')](_0x12704b)[_0x16f9('0x28')](function(_0x9ea0d7){return _0x9ea0d7;});}return null;};}function removeEntity(_0xa7c9fc,_0x26d629){return function(_0x159dde){if(_0x159dde){return _0x159dde[_0x16f9('0x29')]()[_0x16f9('0x28')](function(){var _0x3bb6e2=_0x159dde['get']({'plain':!![]});var _0x4c9bb9=_0x16f9('0x2a');return db[_0x16f9('0x2b')]['destroy']({'where':{'type':_0x4c9bb9,'resourceId':_0x3bb6e2['id']}})[_0x16f9('0x28')](function(){return _0x159dde;});})[_0x16f9('0x28')](function(){_0xa7c9fc[_0x16f9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ce0dc,_0x509053){return function(_0x252c5a){if(!_0x252c5a){_0x5ce0dc['sendStatus'](0x194);}return _0x252c5a;};}function handleError(_0x511694,_0x40bde1){_0x40bde1=_0x40bde1||0x1f4;return function(_0x5f433b){logger['error'](_0x5f433b['stack']);if(_0x5f433b[_0x16f9('0x2c')]){delete _0x5f433b[_0x16f9('0x2c')];}_0x511694[_0x16f9('0x1f')](_0x40bde1)[_0x16f9('0x2d')](_0x5f433b);};}exports[_0x16f9('0x2e')]=function(_0xec6d32,_0x299db2){var _0x54a58f={},_0x3b6eec={},_0x53f44f={'count':0x0,'rows':[]};var _0x493418=_[_0x16f9('0x2f')](db[_0x16f9('0x30')]['rawAttributes'],function(_0x276c6f){return{'name':_0x276c6f[_0x16f9('0x31')],'type':_0x276c6f[_0x16f9('0x32')][_0x16f9('0x33')]};});_0x3b6eec[_0x16f9('0x34')]=_['map'](_0x493418,'name');_0x3b6eec['query']=_['keys'](_0xec6d32[_0x16f9('0x35')]);_0x3b6eec['filters']=_[_0x16f9('0x36')](_0x3b6eec[_0x16f9('0x34')],_0x3b6eec[_0x16f9('0x35')]);_0x54a58f['attributes']=_[_0x16f9('0x36')](_0x3b6eec['model'],qs[_0x16f9('0x37')](_0xec6d32[_0x16f9('0x35')][_0x16f9('0x37')]));_0x54a58f['attributes']=_0x54a58f[_0x16f9('0x38')]['length']?_0x54a58f[_0x16f9('0x38')]:_0x3b6eec[_0x16f9('0x34')];if(!_0xec6d32[_0x16f9('0x35')][_0x16f9('0x39')]('nolimit')){_0x54a58f[_0x16f9('0x23')]=qs[_0x16f9('0x23')](_0xec6d32[_0x16f9('0x35')][_0x16f9('0x23')]);_0x54a58f[_0x16f9('0x21')]=qs[_0x16f9('0x21')](_0xec6d32[_0x16f9('0x35')][_0x16f9('0x21')]);}_0x54a58f['order']=qs[_0x16f9('0x3a')](_0xec6d32[_0x16f9('0x35')][_0x16f9('0x3a')]);_0x54a58f[_0x16f9('0x3b')]=qs[_0x16f9('0x3c')](_['pick'](_0xec6d32[_0x16f9('0x35')],_0x3b6eec['filters']),_0x493418);if(_0xec6d32[_0x16f9('0x35')][_0x16f9('0x3d')]){_0x54a58f[_0x16f9('0x3b')]=_['merge'](_0x54a58f[_0x16f9('0x3b')],{'$or':_[_0x16f9('0x2f')](_0x493418,function(_0x58e9bb){if(_0x58e9bb[_0x16f9('0x32')]!==_0x16f9('0x3e')){var _0x4123ee={};_0x4123ee[_0x58e9bb[_0x16f9('0x2c')]]={'$like':'%'+_0xec6d32[_0x16f9('0x35')][_0x16f9('0x3d')]+'%'};return _0x4123ee;}})});}_0x54a58f=_[_0x16f9('0x3f')]({},_0x54a58f,_0xec6d32[_0x16f9('0x40')]);var _0x342867={'where':_0x54a58f[_0x16f9('0x3b')]};return db[_0x16f9('0x30')][_0x16f9('0x24')](_0x342867)[_0x16f9('0x28')](function(_0x38f5ee){_0x53f44f[_0x16f9('0x24')]=_0x38f5ee;if(_0xec6d32['query']['includeAll']){_0x54a58f[_0x16f9('0x41')]=[{'all':!![]}];}return db[_0x16f9('0x30')][_0x16f9('0x42')](_0x54a58f);})[_0x16f9('0x28')](function(_0x70bdbd){_0x53f44f['rows']=_0x70bdbd;return _0x53f44f;})[_0x16f9('0x28')](respondWithFilteredResult(_0x299db2,_0x54a58f))[_0x16f9('0x43')](handleError(_0x299db2,null));};exports[_0x16f9('0x44')]=function(_0x1a9592,_0x17a0e5){var _0x493640={'raw':!![],'where':{'id':_0x1a9592[_0x16f9('0x45')]['id']}},_0x92e3a7={};_0x92e3a7[_0x16f9('0x34')]=_[_0x16f9('0x46')](db[_0x16f9('0x30')][_0x16f9('0x47')]);_0x92e3a7['query']=_[_0x16f9('0x46')](_0x1a9592[_0x16f9('0x35')]);_0x92e3a7[_0x16f9('0x3c')]=_[_0x16f9('0x36')](_0x92e3a7[_0x16f9('0x34')],_0x92e3a7[_0x16f9('0x35')]);_0x493640[_0x16f9('0x38')]=_[_0x16f9('0x36')](_0x92e3a7[_0x16f9('0x34')],qs[_0x16f9('0x37')](_0x1a9592[_0x16f9('0x35')][_0x16f9('0x37')]));_0x493640[_0x16f9('0x38')]=_0x493640[_0x16f9('0x38')][_0x16f9('0x48')]?_0x493640[_0x16f9('0x38')]:_0x92e3a7[_0x16f9('0x34')];if(_0x1a9592['query'][_0x16f9('0x49')]){_0x493640[_0x16f9('0x41')]=[{'all':!![]}];}_0x493640=_[_0x16f9('0x3f')]({},_0x493640,_0x1a9592[_0x16f9('0x40')]);return db[_0x16f9('0x30')]['find'](_0x493640)[_0x16f9('0x28')](handleEntityNotFound(_0x17a0e5,null))['then'](respondWithResult(_0x17a0e5,null))[_0x16f9('0x43')](handleError(_0x17a0e5,null));};exports['download']=function(_0x50c1dd,_0x369354,_0x1e710b){return db[_0x16f9('0x30')][_0x16f9('0x4a')]({'where':{'id':_0x50c1dd[_0x16f9('0x45')]['id']},'attributes':[_0x16f9('0x2c'),_0x16f9('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x369354,null))[_0x16f9('0x28')](function(_0x5d11b1){if(_0x5d11b1){var _0x4c5638=path['join'](config[_0x16f9('0x4c')],'server/files/plugins',util['format']('%s.zip',path[_0x16f9('0x4d')](_0x5d11b1[_0x16f9('0x4b')])));var _0x50a6ae=fs['createWriteStream'](_0x4c5638);var _0x16ba49=archiver('zip',{'zlib':{'level':0x9}});_0x16ba49['on'](_0x16f9('0x4e'),function(_0x1bd410){if(_0x1bd410['code']==='ENOENT'){logger[_0x16f9('0x4f')](_0x1bd410);}else{throw new db[(_0x16f9('0x50'))]['Error'](_0x16f9('0x51'));}});_0x16ba49['on'](_0x16f9('0x4f'),function(_0x4ac727){throw new db[(_0x16f9('0x50'))][(_0x16f9('0x52'))](_0x16f9('0x51'));});_0x16ba49[_0x16f9('0x53')](_0x50a6ae);_0x16ba49[_0x16f9('0x54')]('**/*',{'cwd':path[_0x16f9('0x55')](config[_0x16f9('0x4c')],'server/files/plugins',path[_0x16f9('0x56')](_0x5d11b1[_0x16f9('0x4b')])),'ignore':[path[_0x16f9('0x55')](path[_0x16f9('0x4d')](_0x5d11b1['path']),_0x16f9('0x57')),path['join'](path[_0x16f9('0x4d')](_0x5d11b1[_0x16f9('0x4b')]),_0x16f9('0x58'))],'nodir':!![]})['finalize']();_0x50a6ae['on'](_0x16f9('0x59'),function(){if(!fs['existsSync'](_0x4c5638)){throw new db['Sequelize'][(_0x16f9('0x52'))]('Plugin\x20not\x20found');}return _0x369354[_0x16f9('0x5a')](_0x4c5638,util[_0x16f9('0x5b')](_0x16f9('0x5c'),path['basename'](_0x5d11b1[_0x16f9('0x4b')])),function(_0x2584e0){if(_0x2584e0){throw new db['Sequelize'][(_0x16f9('0x52'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x16f9('0x5d')](_0x4c5638);logger[_0x16f9('0x5e')](_0x16f9('0x5f'));logger[_0x16f9('0x5e')](_0x16f9('0x60'));});});}return null;})[_0x16f9('0x43')](handleError(_0x369354,null));};exports[_0x16f9('0x61')]=function(_0x24c3e3,_0x1e18b1,_0x5670c7){var _0x5097ce=path[_0x16f9('0x4d')](_0x24c3e3['file'][_0x16f9('0x62')],path[_0x16f9('0x63')](_0x24c3e3[_0x16f9('0x64')][_0x16f9('0x62')]));var _0x58f738=path[_0x16f9('0x55')](config[_0x16f9('0x4c')],_0x16f9('0x65'),_0x24c3e3[_0x16f9('0x64')][_0x16f9('0x62')]);var _0x2d0941=path[_0x16f9('0x55')](config[_0x16f9('0x4c')],_0x16f9('0x65'),_0x5097ce);logger['info'](_0x16f9('0x66'),_0x58f738);logger['info'](_0x16f9('0x67'),_0x2d0941);try{fs[_0x16f9('0x68')](_0x58f738,parseInt(_0x16f9('0x69'),0x8));extract(_0x58f738,{'dir':_0x2d0941},function(_0x5cb38e){if(_0x5cb38e){logger[_0x16f9('0x4f')](_0x5cb38e);handleError(_0x5cb38e,!![]);};var _0x34331b=fs[_0x16f9('0x6a')](_0x2d0941);if(_0x34331b['length']>0x1){removeReferences(_0x58f738,_0x2d0941);logger['error'](_0x16f9('0x6b'));return _0x5670c7(new Error('Invalid\x20plugin\x20structure'));}var _0x3e9814=fs[_0x16f9('0x6c')](path[_0x16f9('0x55')](_0x2d0941,_0x34331b[0x0]));if(_0x3e9814[_0x16f9('0x6d')]()){removeReferences(_0x58f738,_0x2d0941);logger['error'](_0x16f9('0x6b'));return _0x5670c7(new Error(_0x16f9('0x6b')));}if(_0x3e9814[_0x16f9('0x6e')]()){var _0x516929=fs[_0x16f9('0x6a')](path[_0x16f9('0x55')](_0x2d0941,_0x34331b[0x0]));if(_0x516929['length']===0x0){removeReferences(_0x58f738,_0x2d0941);logger[_0x16f9('0x4f')](_0x16f9('0x6b'));return _0x5670c7(new Error(_0x16f9('0x6b')));}var _0xbf839c=_0x516929[_0x16f9('0x6f')](function(_0x44ea09){return _0x44ea09===_0x16f9('0x70');});if(!_0xbf839c){return _0x5670c7(new Error(_0x16f9('0x71')));}var _0x498f15=fs[_0x16f9('0x72')](path[_0x16f9('0x55')](_0x2d0941,_0x34331b[0x0],_0x16f9('0x70')));var _0x32f448=JSON['parse'](_0x498f15);if('undefined'==typeof _0x32f448[_0x16f9('0x2c')]){return _0x5670c7(new Error(_0x16f9('0x73')));}if(_0x16f9('0x22')==typeof _0x32f448['type']){return _0x5670c7(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x32f448[_0x16f9('0x74')]){return _0x5670c7(new Error(_0x16f9('0x75')));}if(_0x16f9('0x22')==typeof _0x32f448[_0x16f9('0x76')]){return _0x5670c7(new Error(_0x16f9('0x77')));}if(_0x32f448['type']===_0x16f9('0x78')){if(_0x16f9('0x22')==typeof _0x32f448['parameters'][_0x16f9('0x79')]){return _0x5670c7(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x16f9('0x22')==typeof _0x32f448['parameters'][_0x16f9('0x79')][_0x16f9('0x7a')]&&_0x16f9('0x22')==typeof _0x32f448[_0x16f9('0x76')][_0x16f9('0x79')]['agent']){return _0x5670c7(new Error(_0x16f9('0x7b')));}}else if(_0x32f448[_0x16f9('0x32')]==='script'){if('undefined'==typeof _0x32f448['parameters'][_0x16f9('0x7c')]){return _0x5670c7(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x32f448[_0x16f9('0x76')]['scriptPath']){return _0x5670c7(new Error(_0x16f9('0x7d')));}}else{return _0x5670c7(new Error(_0x16f9('0x7e')));}var _0x186f1f=_0x32f448[_0x16f9('0x2c')];var _0x1384d6=_0x32f448[_0x16f9('0x7f')];var _0x5d8cc1=_0x32f448[_0x16f9('0x32')];var _0x2e5029=_0x32f448['sidebar']?_0x32f448[_0x16f9('0x80')]:_0x16f9('0x81');var _0x49dc2d=_0x32f448['icon']?_0x32f448[_0x16f9('0x82')]:_0x16f9('0x83');var _0x4ca2ae='';var _0x34408d='';var _0x38f238='';var _0x395424='';var _0x1bf55f=_0x32f448['version'];if(_0x5d8cc1===_0x16f9('0x78')){if('undefined'!=typeof _0x32f448[_0x16f9('0x76')][_0x16f9('0x79')][_0x16f9('0x7a')]){var _0x482b14=_0x32f448[_0x16f9('0x76')]['views'][_0x16f9('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x16f9('0x84')](_0x482b14)){_0x4ca2ae=path[_0x16f9('0x55')](_0x16f9('0x85'),_0x5097ce,_0x34331b[0x0],_0x482b14);}else{_0x4ca2ae=_0x482b14;}}else{logger[_0x16f9('0x5e')](_0x16f9('0x86'));}if(_0x16f9('0x22')!=typeof _0x32f448['parameters'][_0x16f9('0x79')][_0x16f9('0x87')]){var _0x1bde1b=_0x32f448['parameters'][_0x16f9('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x16f9('0x84')](_0x1bde1b)){_0x34408d=path[_0x16f9('0x55')](_0x16f9('0x85'),_0x5097ce,_0x34331b[0x0],_0x1bde1b);}else{_0x34408d=_0x1bde1b;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5d8cc1==='script'){_0x38f238=_0x32f448[_0x16f9('0x76')][_0x16f9('0x7c')];_0x395424=_0x32f448[_0x16f9('0x76')][_0x16f9('0x88')];if(_0x16f9('0x22')!=typeof _0x32f448[_0x16f9('0x76')]['views']){if(_0x16f9('0x22')!=typeof _0x32f448[_0x16f9('0x76')][_0x16f9('0x79')][_0x16f9('0x7a')]){var _0x482b14=_0x32f448[_0x16f9('0x76')][_0x16f9('0x79')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x16f9('0x84')](_0x482b14)){_0x4ca2ae=path['join'](_0x16f9('0x85'),_0x5097ce,_0x34331b[0x0],_0x482b14);}else{_0x4ca2ae=_0x482b14;}}if(_0x16f9('0x22')!=typeof _0x32f448[_0x16f9('0x76')][_0x16f9('0x79')]['agent']){var _0x1bde1b=_0x32f448[_0x16f9('0x76')]['views'][_0x16f9('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1bde1b)){_0x34408d=path[_0x16f9('0x55')](_0x16f9('0x85'),_0x5097ce,_0x34331b[0x0],_0x1bde1b);}else{_0x34408d=_0x1bde1b;}}}}var _0x555564={'name':_0x186f1f,'description':_0x1384d6,'path':path['join'](_0x5097ce,_0x34331b[0x0]),'type':_0x5d8cc1,'sidebar':_0x2e5029,'icon':_0x49dc2d,'adminUrl':_0x4ca2ae,'agentUrl':_0x34408d,'scriptName':_0x38f238,'scriptPath':_0x395424,'version':_0x1bf55f};removeReferences(_0x58f738,null);return db[_0x16f9('0x30')]['create'](_0x555564)[_0x16f9('0x28')](function(_0x35c4a0){var _0x35571d={'role':_0x24c3e3[_0x16f9('0x89')]['role'],'userProfileId':_0x24c3e3[_0x16f9('0x89')][_0x16f9('0x8a')]};if(!_0x35571d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35571d[_0x16f9('0x8b')]===_0x16f9('0x8c')){var _0x289cd4=_0x35c4a0[_0x16f9('0x8d')]({'plain':!![]});return db[_0x16f9('0x8e')][_0x16f9('0x4a')]({'where':{'name':_0x16f9('0x2a'),'userProfileId':_0x35571d[_0x16f9('0x8a')]},'raw':!![]})[_0x16f9('0x28')](function(_0x4db9a4){if(_0x4db9a4&&_0x4db9a4['autoAssociation']===0x0){return db[_0x16f9('0x2b')][_0x16f9('0x8f')]({'name':_0x289cd4[_0x16f9('0x2c')],'resourceId':_0x289cd4['id'],'type':_0x4db9a4[_0x16f9('0x2c')],'sectionId':_0x4db9a4['id']},{})[_0x16f9('0x28')](function(){return _0x35c4a0;});}else{return _0x35c4a0;}})['catch'](function(_0x367b7f){logger['error'](_0x16f9('0x90'),_0x367b7f);throw _0x367b7f;});}return _0x35c4a0;})[_0x16f9('0x28')](respondWithResult(_0x1e18b1,null))[_0x16f9('0x43')](handleError(_0x1e18b1,null));}});}catch(_0x5134c7){_0x1e18b1[_0x16f9('0x1f')](0x1f4)[_0x16f9('0x2d')](_0x5134c7);}};function removeReferences(_0x8afe55,_0x570c43){try{if(_0x8afe55){fs[_0x16f9('0x5d')](_0x8afe55);logger[_0x16f9('0x5e')](_0x16f9('0x91'));}if(_0x570c43){rimraf(_0x570c43,function(){});logger['info'](_0x16f9('0x92'));}}catch(_0x156a54){logger[_0x16f9('0x4f')](_0x156a54);}}exports['update']=function(_0xea4e39,_0x495d36,_0x2b8e5c){return db[_0x16f9('0x30')][_0x16f9('0x4a')]({'where':{'id':_0xea4e39['params']['id']}})['then'](handleEntityNotFound(_0x495d36,null))[_0x16f9('0x28')](saveUpdates(_0xea4e39[_0x16f9('0x89')],null))[_0x16f9('0x28')](respondWithResult(_0x495d36,null))['catch'](handleError(_0x495d36,null));};exports['delete']=function(_0x280405,_0xb8aca2,_0x1bead6){return db[_0x16f9('0x30')][_0x16f9('0x4a')]({'where':{'id':_0x280405[_0x16f9('0x45')]['id']}})['then'](function(_0x3b4d99){if(_0x3b4d99){return _0x3b4d99[_0x16f9('0x29')]();}})[_0x16f9('0x28')](function(_0x2c92b1){rimraf(path['join'](config[_0x16f9('0x4c')],_0x16f9('0x65'),path['dirname'](_0x2c92b1['path'])),function(){});return _0x2c92b1;})[_0x16f9('0x28')](handleEntityNotFound(_0xb8aca2,null))[_0x16f9('0x28')](respondWithStatusCode(_0xb8aca2,null))[_0x16f9('0x43')](handleError(_0xb8aca2,null));};exports[_0x16f9('0x93')]=function(_0x30be6a,_0x4ef0e2,_0x5c781b){return BPromise[_0x16f9('0x94')]()[_0x16f9('0x28')](function(){if(!_0x30be6a['query']['path']){throw new Error(_0x16f9('0x95'));}if(!_0x30be6a[_0x16f9('0x35')][_0x16f9('0x96')]){throw new Error(_0x16f9('0x97'));}var _0x1e9f73=_0x30be6a['query'][_0x16f9('0x98')]?_0x30be6a[_0x16f9('0x35')][_0x16f9('0x98')]+':'+_0x30be6a[_0x16f9('0x35')]['port']:'http://localhost:'+_0x30be6a[_0x16f9('0x35')]['port'];var _0x360dff=_0x30be6a['query'][_0x16f9('0x20')]?_0x30be6a[_0x16f9('0x35')][_0x16f9('0x20')]:!![];var _0x483f0d=_0x30be6a[_0x16f9('0x35')][_0x16f9('0x99')]?_0x30be6a[_0x16f9('0x35')][_0x16f9('0x99')]:null;var _0x2c1707={'method':_0x30be6a[_0x16f9('0x9a')],'uri':util[_0x16f9('0x5b')](_0x16f9('0x9b'),_0x1e9f73,_0x30be6a[_0x16f9('0x35')]['path']),'json':_0x360dff,'resolveWithFullResponse':!![],'encoding':_0x483f0d,'qs':_0x30be6a[_0x16f9('0x35')]};if(_0x30be6a[_0x16f9('0x9c')]){_0x2c1707[_0x16f9('0x9c')]=_0x30be6a[_0x16f9('0x9c')];if(_0x2c1707[_0x16f9('0x9c')][_0x16f9('0x9d')]){delete _0x2c1707[_0x16f9('0x9c')][_0x16f9('0x9d')];}}if(_0x2c1707[_0x16f9('0x9c')][_0x16f9('0x9e')]){delete _0x2c1707[_0x16f9('0x9c')][_0x16f9('0x9e')];}return rp(_0x2c1707);})['then'](function(_0x37bb2f){if(_0x37bb2f){_0x4ef0e2[_0x16f9('0x25')](_0x37bb2f[_0x16f9('0x9c')]);logger[_0x16f9('0x5e')](_0x37bb2f['body']);if(_[_0x16f9('0x9f')](_0x30be6a[_0x16f9('0x35')][_0x16f9('0x4b')],_0x16f9('0x5a'))&&_0x37bb2f[_0x16f9('0xa0')]==0x1f4){return _0x4ef0e2['sendStatus'](_0x37bb2f[_0x16f9('0xa0')]);}else{return _0x4ef0e2[_0x16f9('0x1f')](_0x37bb2f[_0x16f9('0xa0')])[_0x16f9('0x2d')](_0x37bb2f[_0x16f9('0x89')]);}}else{return _0x4ef0e2[_0x16f9('0x1e')](0xc8);}})[_0x16f9('0x43')](handleError(_0x4ef0e2,null));};exports[_0x16f9('0xa1')]=function(_0x371269,_0x7865ee,_0x544d56){return BPromise[_0x16f9('0x94')]()[_0x16f9('0x28')](function(){if(!_0x371269[_0x16f9('0x35')][_0x16f9('0x4b')]){throw new Error(_0x16f9('0x95'));}if(!_0x371269['query'][_0x16f9('0x96')]){throw new Error(_0x16f9('0x97'));}var _0x4e1975=_0x371269[_0x16f9('0x35')]['hostname']?_0x371269[_0x16f9('0x35')][_0x16f9('0x98')]+':'+_0x371269['query']['port']:'http://localhost:'+_0x371269['query'][_0x16f9('0x96')];var _0x50e666=_0x371269[_0x16f9('0x35')]['json']?_0x371269[_0x16f9('0x35')][_0x16f9('0x20')]:!![];var _0x50e88c=_0x371269[_0x16f9('0x35')]['encoding']?_0x371269[_0x16f9('0x35')]['encoding']:null;var _0x237a3f={'method':_0x371269[_0x16f9('0x9a')],'uri':util['format'](_0x16f9('0x9b'),_0x4e1975,_0x371269['query'][_0x16f9('0x4b')]),'json':_0x50e666,'resolveWithFullResponse':!![],'encoding':_0x50e88c,'body':_0x371269['body']};if(_0x371269['headers']){_0x237a3f[_0x16f9('0x9c')]=_0x371269[_0x16f9('0x9c')];if(_0x237a3f[_0x16f9('0x9c')][_0x16f9('0x9d')]){delete _0x237a3f[_0x16f9('0x9c')][_0x16f9('0x9d')];}}if(_0x237a3f['headers'][_0x16f9('0x9e')]){delete _0x237a3f[_0x16f9('0x9c')][_0x16f9('0x9e')];}return rp(_0x237a3f);})['then'](function(_0x10f833){if(_0x10f833){_0x7865ee[_0x16f9('0x25')](_0x10f833['headers']);logger[_0x16f9('0x5e')](_0x10f833[_0x16f9('0x89')]);return _0x7865ee['status'](_0x10f833[_0x16f9('0xa0')])[_0x16f9('0x2d')](_0x10f833['body']);}else{return _0x7865ee['sendStatus'](0xc8);}})[_0x16f9('0x43')](handleError(_0x7865ee,null));}; \ No newline at end of file +var _0x2188=['offset','undefined','limit','count','status','Content-Range','reject','save','update','then','Plugins','UserProfileResource','destroy','end','error','stack','name','send','index','map','Plugin','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','rows','params','keys','include','merge','find','catch','download','join','root','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','lstatSync','Invalid\x20plugin\x20structure','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','views','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','userProfileId','role','user','get','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','method','headers','content-length','set','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','%s%s','content-type','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','redis','defaults','localhost','./plugin.socket','register','sendStatus','json'];(function(_0x21c3e5,_0x4e57da){var _0x6f4453=function(_0x29e920){while(--_0x29e920){_0x21c3e5['push'](_0x21c3e5['shift']());}};_0x6f4453(++_0x4e57da);}(_0x2188,0x140));var _0x8218=function(_0x42e1c8,_0x3c967e){_0x42e1c8=_0x42e1c8-0x0;var _0x36e470=_0x2188[_0x42e1c8];return _0x36e470;};'use strict';var emlformat=require(_0x8218('0x0'));var rimraf=require(_0x8218('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8218('0x2'));var rp=require(_0x8218('0x3'));var moment=require('moment');var BPromise=require(_0x8218('0x4'));var Mustache=require(_0x8218('0x5'));var util=require(_0x8218('0x6'));var path=require(_0x8218('0x7'));var sox=require(_0x8218('0x8'));var csv=require(_0x8218('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8218('0xa'));var squel=require(_0x8218('0xb'));var crypto=require(_0x8218('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8218('0xd'));var toCsv=require(_0x8218('0x9'));var querystring=require('querystring');var Papa=require(_0x8218('0xe'));var extract=require(_0x8218('0xf'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x8218('0x10'));var authService=require(_0x8218('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8218('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8218('0x13'));var utils=require(_0x8218('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8218('0x15')]=_[_0x8218('0x16')](config[_0x8218('0x15')],{'host':_0x8218('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8218('0x18'))[_0x8218('0x19')](socket);function respondWithStatusCode(_0x5b814f,_0x14b7f5){_0x14b7f5=_0x14b7f5||0xcc;return function(_0x17c59d){if(_0x17c59d){return _0x5b814f[_0x8218('0x1a')](_0x14b7f5);}return _0x5b814f['status'](_0x14b7f5)['end']();};}function respondWithResult(_0x53101d,_0x1eed76){_0x1eed76=_0x1eed76||0xc8;return function(_0x567849){if(_0x567849){return _0x53101d['status'](_0x1eed76)[_0x8218('0x1b')](_0x567849);}};}function respondWithFilteredResult(_0x3c11e3,_0x46ee02){return function(_0x336186){if(_0x336186){var _0x41a9b8=typeof _0x46ee02[_0x8218('0x1c')]===_0x8218('0x1d')&&typeof _0x46ee02[_0x8218('0x1e')]===_0x8218('0x1d');var _0x32d671=_0x336186[_0x8218('0x1f')];var _0x13bd4b=_0x41a9b8?0x0:_0x46ee02[_0x8218('0x1c')];var _0xbf8263=_0x41a9b8?_0x336186['count']:_0x46ee02[_0x8218('0x1c')]+_0x46ee02[_0x8218('0x1e')];var _0x3b611c;if(_0xbf8263>=_0x32d671){_0xbf8263=_0x32d671;_0x3b611c=0xc8;}else{_0x3b611c=0xce;}_0x3c11e3[_0x8218('0x20')](_0x3b611c);return _0x3c11e3['set'](_0x8218('0x21'),_0x13bd4b+'-'+_0xbf8263+'/'+_0x32d671)[_0x8218('0x1b')](_0x336186);}return null;};}function patchUpdates(_0x309ad8){return function(_0x1724aa){try{jsonpatch['apply'](_0x1724aa,_0x309ad8,!![]);}catch(_0x289232){return BPromise[_0x8218('0x22')](_0x289232);}return _0x1724aa[_0x8218('0x23')]();};}function saveUpdates(_0x3b8b24,_0x52aebc){return function(_0x67d15b){if(_0x67d15b){return _0x67d15b[_0x8218('0x24')](_0x3b8b24)[_0x8218('0x25')](function(_0x4c7a58){return _0x4c7a58;});}return null;};}function removeEntity(_0x59b482,_0xf9480c){return function(_0x817744){if(_0x817744){return _0x817744['destroy']()[_0x8218('0x25')](function(){var _0x19b080=_0x817744['get']({'plain':!![]});var _0x57945d=_0x8218('0x26');return db[_0x8218('0x27')][_0x8218('0x28')]({'where':{'type':_0x57945d,'resourceId':_0x19b080['id']}})[_0x8218('0x25')](function(){return _0x817744;});})[_0x8218('0x25')](function(){_0x59b482[_0x8218('0x20')](0xcc)[_0x8218('0x29')]();});}};}function handleEntityNotFound(_0xaab7ed,_0x18dfd7){return function(_0x4072ff){if(!_0x4072ff){_0xaab7ed[_0x8218('0x1a')](0x194);}return _0x4072ff;};}function handleError(_0x1385d9,_0x2887fa){_0x2887fa=_0x2887fa||0x1f4;return function(_0x122317){logger[_0x8218('0x2a')](_0x122317[_0x8218('0x2b')]);if(_0x122317[_0x8218('0x2c')]){delete _0x122317[_0x8218('0x2c')];}_0x1385d9[_0x8218('0x20')](_0x2887fa)[_0x8218('0x2d')](_0x122317);};}exports[_0x8218('0x2e')]=function(_0x4b1a86,_0x3f8a31){var _0x362226={},_0x27147={},_0x2b8754={'count':0x0,'rows':[]};var _0x24c86f=_[_0x8218('0x2f')](db[_0x8218('0x30')][_0x8218('0x31')],function(_0xd8478d){return{'name':_0xd8478d['fieldName'],'type':_0xd8478d['type'][_0x8218('0x32')]};});_0x27147[_0x8218('0x33')]=_['map'](_0x24c86f,_0x8218('0x2c'));_0x27147['query']=_['keys'](_0x4b1a86[_0x8218('0x34')]);_0x27147[_0x8218('0x35')]=_[_0x8218('0x36')](_0x27147['model'],_0x27147[_0x8218('0x34')]);_0x362226[_0x8218('0x37')]=_[_0x8218('0x36')](_0x27147[_0x8218('0x33')],qs[_0x8218('0x38')](_0x4b1a86['query'][_0x8218('0x38')]));_0x362226['attributes']=_0x362226[_0x8218('0x37')][_0x8218('0x39')]?_0x362226[_0x8218('0x37')]:_0x27147[_0x8218('0x33')];if(!_0x4b1a86[_0x8218('0x34')][_0x8218('0x3a')](_0x8218('0x3b'))){_0x362226[_0x8218('0x1e')]=qs[_0x8218('0x1e')](_0x4b1a86[_0x8218('0x34')][_0x8218('0x1e')]);_0x362226[_0x8218('0x1c')]=qs[_0x8218('0x1c')](_0x4b1a86[_0x8218('0x34')][_0x8218('0x1c')]);}_0x362226[_0x8218('0x3c')]=qs['sort'](_0x4b1a86[_0x8218('0x34')][_0x8218('0x3d')]);_0x362226['where']=qs[_0x8218('0x35')](_[_0x8218('0x3e')](_0x4b1a86['query'],_0x27147['filters']),_0x24c86f);if(_0x4b1a86[_0x8218('0x34')][_0x8218('0x3f')]){_0x362226[_0x8218('0x40')]=_['merge'](_0x362226[_0x8218('0x40')],{'$or':_['map'](_0x24c86f,function(_0x58b701){if(_0x58b701[_0x8218('0x41')]!==_0x8218('0x42')){var _0x593547={};_0x593547[_0x58b701[_0x8218('0x2c')]]={'$like':'%'+_0x4b1a86['query'][_0x8218('0x3f')]+'%'};return _0x593547;}})});}_0x362226=_['merge']({},_0x362226,_0x4b1a86[_0x8218('0x43')]);var _0x2c7b66={'where':_0x362226['where']};return db[_0x8218('0x30')][_0x8218('0x1f')](_0x2c7b66)[_0x8218('0x25')](function(_0x171b7f){_0x2b8754[_0x8218('0x1f')]=_0x171b7f;if(_0x4b1a86[_0x8218('0x34')][_0x8218('0x44')]){_0x362226['include']=[{'all':!![]}];}return db[_0x8218('0x30')]['findAll'](_0x362226);})['then'](function(_0x266428){_0x2b8754[_0x8218('0x45')]=_0x266428;return _0x2b8754;})[_0x8218('0x25')](respondWithFilteredResult(_0x3f8a31,_0x362226))['catch'](handleError(_0x3f8a31,null));};exports['show']=function(_0x5bf99c,_0xbbc35b){var _0x4e1c3a={'raw':!![],'where':{'id':_0x5bf99c[_0x8218('0x46')]['id']}},_0x360a2b={};_0x360a2b[_0x8218('0x33')]=_[_0x8218('0x47')](db[_0x8218('0x30')]['rawAttributes']);_0x360a2b[_0x8218('0x34')]=_[_0x8218('0x47')](_0x5bf99c[_0x8218('0x34')]);_0x360a2b[_0x8218('0x35')]=_[_0x8218('0x36')](_0x360a2b[_0x8218('0x33')],_0x360a2b['query']);_0x4e1c3a[_0x8218('0x37')]=_[_0x8218('0x36')](_0x360a2b[_0x8218('0x33')],qs[_0x8218('0x38')](_0x5bf99c[_0x8218('0x34')][_0x8218('0x38')]));_0x4e1c3a[_0x8218('0x37')]=_0x4e1c3a[_0x8218('0x37')]['length']?_0x4e1c3a['attributes']:_0x360a2b['model'];if(_0x5bf99c[_0x8218('0x34')][_0x8218('0x44')]){_0x4e1c3a[_0x8218('0x48')]=[{'all':!![]}];}_0x4e1c3a=_[_0x8218('0x49')]({},_0x4e1c3a,_0x5bf99c[_0x8218('0x43')]);return db[_0x8218('0x30')][_0x8218('0x4a')](_0x4e1c3a)[_0x8218('0x25')](handleEntityNotFound(_0xbbc35b,null))[_0x8218('0x25')](respondWithResult(_0xbbc35b,null))[_0x8218('0x4b')](handleError(_0xbbc35b,null));};exports[_0x8218('0x4c')]=function(_0x3110db,_0x272c65,_0x429791){return db[_0x8218('0x30')][_0x8218('0x4a')]({'where':{'id':_0x3110db[_0x8218('0x46')]['id']},'attributes':[_0x8218('0x2c'),_0x8218('0x7')],'raw':!![]})[_0x8218('0x25')](handleEntityNotFound(_0x272c65,null))[_0x8218('0x25')](function(_0x454ffe){if(_0x454ffe){var _0x2c2f87=path[_0x8218('0x4d')](config[_0x8218('0x4e')],'server/files/plugins',util['format'](_0x8218('0x4f'),path[_0x8218('0x50')](_0x454ffe[_0x8218('0x7')])));var _0x257919=fs[_0x8218('0x51')](_0x2c2f87);var _0x3118a8=archiver(_0x8218('0x52'),{'zlib':{'level':0x9}});_0x3118a8['on'](_0x8218('0x53'),function(_0x1957fe){if(_0x1957fe[_0x8218('0x54')]===_0x8218('0x55')){logger[_0x8218('0x2a')](_0x1957fe);}else{throw new db[(_0x8218('0x56'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x3118a8['on'](_0x8218('0x2a'),function(_0x1d8e8e){throw new db[(_0x8218('0x56'))][(_0x8218('0x57'))](_0x8218('0x58'));});_0x3118a8[_0x8218('0x59')](_0x257919);_0x3118a8[_0x8218('0x5a')](_0x8218('0x5b'),{'cwd':path[_0x8218('0x4d')](config['root'],_0x8218('0x5c'),path[_0x8218('0x5d')](_0x454ffe['path'])),'ignore':[path['join'](path[_0x8218('0x50')](_0x454ffe[_0x8218('0x7')]),_0x8218('0x5e')),path[_0x8218('0x4d')](path[_0x8218('0x50')](_0x454ffe[_0x8218('0x7')]),_0x8218('0x5f'))],'nodir':!![]})[_0x8218('0x60')]();_0x257919['on'](_0x8218('0x61'),function(){if(!fs['existsSync'](_0x2c2f87)){throw new db[(_0x8218('0x56'))][(_0x8218('0x57'))](_0x8218('0x62'));}return _0x272c65['download'](_0x2c2f87,util[_0x8218('0x63')](_0x8218('0x4f'),path[_0x8218('0x50')](_0x454ffe[_0x8218('0x7')])),function(_0xffb58b){if(_0xffb58b){throw new db[(_0x8218('0x56'))][(_0x8218('0x57'))](_0x8218('0x64'));}fs[_0x8218('0x65')](_0x2c2f87);logger['info']('Download\x20completed');logger[_0x8218('0x66')](_0x8218('0x67'));});});}return null;})['catch'](handleError(_0x272c65,null));};exports[_0x8218('0x68')]=function(_0x34afb3,_0x1ad373,_0x314ad8){var _0x3fd875=path[_0x8218('0x50')](_0x34afb3[_0x8218('0x69')][_0x8218('0x6a')],path[_0x8218('0x6b')](_0x34afb3[_0x8218('0x69')][_0x8218('0x6a')]));var _0x47606c=path['join'](config[_0x8218('0x4e')],_0x8218('0x5c'),_0x34afb3['file'][_0x8218('0x6a')]);var _0x2dccff=path[_0x8218('0x4d')](config['root'],_0x8218('0x5c'),_0x3fd875);logger[_0x8218('0x66')](_0x8218('0x6c'),_0x47606c);logger[_0x8218('0x66')](_0x8218('0x6d'),_0x2dccff);try{fs[_0x8218('0x6e')](_0x47606c,parseInt(_0x8218('0x6f'),0x8));extract(_0x47606c,{'dir':_0x2dccff},function(_0x3dabce){if(_0x3dabce){logger['error'](_0x3dabce);handleError(_0x3dabce,!![]);};var _0x2e6292=fs[_0x8218('0x70')](_0x2dccff);if(_0x2e6292[_0x8218('0x39')]>0x1){removeReferences(_0x47606c,_0x2dccff);logger['error']('Invalid\x20plugin\x20structure');return _0x314ad8(new Error('Invalid\x20plugin\x20structure'));}var _0x4e068e=fs[_0x8218('0x71')](path['join'](_0x2dccff,_0x2e6292[0x0]));if(_0x4e068e['isFile']()){removeReferences(_0x47606c,_0x2dccff);logger['error'](_0x8218('0x72'));return _0x314ad8(new Error(_0x8218('0x72')));}if(_0x4e068e[_0x8218('0x73')]()){var _0x55d6a4=fs[_0x8218('0x70')](path[_0x8218('0x4d')](_0x2dccff,_0x2e6292[0x0]));if(_0x55d6a4[_0x8218('0x39')]===0x0){removeReferences(_0x47606c,_0x2dccff);logger[_0x8218('0x2a')]('Invalid\x20plugin\x20structure');return _0x314ad8(new Error('Invalid\x20plugin\x20structure'));}var _0x3a5740=_0x55d6a4[_0x8218('0x74')](function(_0x5a3291){return _0x5a3291==='manifest.json';});if(!_0x3a5740){return _0x314ad8(new Error(_0x8218('0x75')));}var _0x380478=fs[_0x8218('0x76')](path[_0x8218('0x4d')](_0x2dccff,_0x2e6292[0x0],_0x8218('0x77')));var _0x3cec8f=JSON[_0x8218('0x78')](_0x380478);if(_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x2c')]){return _0x314ad8(new Error(_0x8218('0x79')));}if('undefined'==typeof _0x3cec8f[_0x8218('0x41')]){return _0x314ad8(new Error(_0x8218('0x7a')));}if(_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x7b')]){return _0x314ad8(new Error(_0x8218('0x7c')));}if(_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x7d')]){return _0x314ad8(new Error(_0x8218('0x7e')));}if(_0x3cec8f[_0x8218('0x41')]==='html'){if('undefined'==typeof _0x3cec8f['parameters']['views']){return _0x314ad8(new Error(_0x8218('0x7f')));}if(_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')]['admin']&&_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')]['agent']){return _0x314ad8(new Error(_0x8218('0x81')));}}else if(_0x3cec8f[_0x8218('0x41')]==='script'){if(_0x8218('0x1d')==typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x82')]){return _0x314ad8(new Error(_0x8218('0x83')));}if('undefined'==typeof _0x3cec8f['parameters'][_0x8218('0x84')]){return _0x314ad8(new Error(_0x8218('0x85')));}}else{return _0x314ad8(new Error(_0x8218('0x86')));}var _0xaff97=_0x3cec8f[_0x8218('0x2c')];var _0x2e70e8=_0x3cec8f['description'];var _0x22941c=_0x3cec8f[_0x8218('0x41')];var _0x163471=_0x3cec8f['sidebar']?_0x3cec8f[_0x8218('0x87')]:'always';var _0x3eec08=_0x3cec8f[_0x8218('0x88')]?_0x3cec8f[_0x8218('0x88')]:_0x8218('0x89');var _0x472f54='';var _0x404892='';var _0x2cfdd2='';var _0x1280bd='';var _0x1e9af4=_0x3cec8f[_0x8218('0x7b')];if(_0x22941c==='html'){if('undefined'!=typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')]['admin']){var _0x18ae38=_0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')][_0x8218('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x18ae38)){_0x472f54=path[_0x8218('0x4d')](_0x8218('0x8b'),_0x3fd875,_0x2e6292[0x0],_0x18ae38);}else{_0x472f54=_0x18ae38;}}else{logger[_0x8218('0x66')](_0x8218('0x8c'));}if('undefined'!=typeof _0x3cec8f['parameters'][_0x8218('0x80')][_0x8218('0x8d')]){var _0x2ebd77=_0x3cec8f['parameters'][_0x8218('0x80')][_0x8218('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x8218('0x8e')](_0x2ebd77)){_0x404892=path[_0x8218('0x4d')](_0x8218('0x8b'),_0x3fd875,_0x2e6292[0x0],_0x2ebd77);}else{_0x404892=_0x2ebd77;}}else{logger[_0x8218('0x66')](_0x8218('0x8f'));}}else if(_0x22941c===_0x8218('0x90')){_0x2cfdd2=_0x3cec8f['parameters'][_0x8218('0x82')];_0x1280bd=_0x3cec8f[_0x8218('0x7d')]['scriptPath'];if(_0x8218('0x1d')!=typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')]){if(_0x8218('0x1d')!=typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')][_0x8218('0x8a')]){var _0x18ae38=_0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')][_0x8218('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x8218('0x8e')](_0x18ae38)){_0x472f54=path[_0x8218('0x4d')](_0x8218('0x8b'),_0x3fd875,_0x2e6292[0x0],_0x18ae38);}else{_0x472f54=_0x18ae38;}}if('undefined'!=typeof _0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')][_0x8218('0x8d')]){var _0x2ebd77=_0x3cec8f[_0x8218('0x7d')][_0x8218('0x80')][_0x8218('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x8218('0x8e')](_0x2ebd77)){_0x404892=path['join'](_0x8218('0x8b'),_0x3fd875,_0x2e6292[0x0],_0x2ebd77);}else{_0x404892=_0x2ebd77;}}}}var _0x295275={'name':_0xaff97,'description':_0x2e70e8,'path':path['join'](_0x3fd875,_0x2e6292[0x0]),'type':_0x22941c,'sidebar':_0x163471,'icon':_0x3eec08,'adminUrl':_0x472f54,'agentUrl':_0x404892,'scriptName':_0x2cfdd2,'scriptPath':_0x1280bd,'version':_0x1e9af4};removeReferences(_0x47606c,null);return db[_0x8218('0x30')][_0x8218('0x91')](_0x295275)[_0x8218('0x25')](function(_0xd9411){var _0x3d472e={'role':_0x34afb3[_0x8218('0x92')]['role'],'userProfileId':_0x34afb3[_0x8218('0x92')][_0x8218('0x93')]};if(!_0x3d472e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d472e[_0x8218('0x94')]===_0x8218('0x95')){var _0x289dea=_0xd9411[_0x8218('0x96')]({'plain':!![]});return db[_0x8218('0x97')][_0x8218('0x4a')]({'where':{'name':_0x8218('0x26'),'userProfileId':_0x3d472e[_0x8218('0x93')]},'raw':!![]})[_0x8218('0x25')](function(_0x5625d4){if(_0x5625d4&&_0x5625d4[_0x8218('0x98')]===0x0){return db[_0x8218('0x27')]['create']({'name':_0x289dea[_0x8218('0x2c')],'resourceId':_0x289dea['id'],'type':_0x5625d4['name'],'sectionId':_0x5625d4['id']},{})[_0x8218('0x25')](function(){return _0xd9411;});}else{return _0xd9411;}})[_0x8218('0x4b')](function(_0x551277){logger[_0x8218('0x2a')](_0x8218('0x99'),_0x551277);throw _0x551277;});}return _0xd9411;})[_0x8218('0x25')](respondWithResult(_0x1ad373,null))[_0x8218('0x4b')](handleError(_0x1ad373,null));}});}catch(_0x3892f0){_0x1ad373[_0x8218('0x20')](0x1f4)['send'](_0x3892f0);}};function removeReferences(_0x11e0d1,_0x625987){try{if(_0x11e0d1){fs['unlinkSync'](_0x11e0d1);logger['info'](_0x8218('0x9a'));}if(_0x625987){rimraf(_0x625987,function(){});logger[_0x8218('0x66')](_0x8218('0x9b'));}}catch(_0x49a220){logger[_0x8218('0x2a')](_0x49a220);}}exports[_0x8218('0x24')]=function(_0x181fa6,_0x341c93,_0x114e39){return db[_0x8218('0x30')]['find']({'where':{'id':_0x181fa6[_0x8218('0x46')]['id']}})['then'](handleEntityNotFound(_0x341c93,null))['then'](saveUpdates(_0x181fa6['body'],null))[_0x8218('0x25')](respondWithResult(_0x341c93,null))['catch'](handleError(_0x341c93,null));};exports[_0x8218('0x9c')]=function(_0x6eb748,_0x108369,_0x5deb81){return db[_0x8218('0x30')][_0x8218('0x4a')]({'where':{'id':_0x6eb748[_0x8218('0x46')]['id']}})[_0x8218('0x25')](function(_0x3f1507){if(_0x3f1507){return _0x3f1507[_0x8218('0x28')]();}})[_0x8218('0x25')](function(_0x276783){rimraf(path[_0x8218('0x4d')](config[_0x8218('0x4e')],'server/files/plugins',path[_0x8218('0x5d')](_0x276783[_0x8218('0x7')])),function(){});return _0x276783;})[_0x8218('0x25')](handleEntityNotFound(_0x108369,null))[_0x8218('0x25')](respondWithStatusCode(_0x108369,null))[_0x8218('0x4b')](handleError(_0x108369,null));};exports[_0x8218('0x9d')]=function(_0x18b9f4,_0x1c0cdf,_0x43871e){return BPromise[_0x8218('0x9e')]()['then'](function(){if(!_0x18b9f4[_0x8218('0x34')][_0x8218('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x18b9f4[_0x8218('0x34')][_0x8218('0x9f')]){throw new Error(_0x8218('0xa0'));}var _0x381fcc=_0x18b9f4[_0x8218('0x34')][_0x8218('0xa1')]?_0x18b9f4[_0x8218('0x34')][_0x8218('0xa1')]+':'+_0x18b9f4[_0x8218('0x34')][_0x8218('0x9f')]:_0x8218('0xa2')+_0x18b9f4[_0x8218('0x34')][_0x8218('0x9f')];var _0x40fe30=_0x18b9f4[_0x8218('0x34')][_0x8218('0x1b')]?_0x18b9f4[_0x8218('0x34')][_0x8218('0x1b')]:!![];var _0x1b8f39=_0x18b9f4[_0x8218('0x34')]['encoding']?_0x18b9f4['query'][_0x8218('0xa3')]:null;var _0x452aa8={'method':_0x18b9f4[_0x8218('0xa4')],'uri':util[_0x8218('0x63')]('%s%s',_0x381fcc,_0x18b9f4[_0x8218('0x34')][_0x8218('0x7')]),'json':_0x40fe30,'resolveWithFullResponse':!![],'encoding':_0x1b8f39,'qs':_0x18b9f4[_0x8218('0x34')]};if(_0x18b9f4[_0x8218('0xa5')]){_0x452aa8[_0x8218('0xa5')]=_0x18b9f4[_0x8218('0xa5')];if(_0x452aa8[_0x8218('0xa5')][_0x8218('0xa6')]){delete _0x452aa8[_0x8218('0xa5')][_0x8218('0xa6')];}}if(_0x452aa8[_0x8218('0xa5')]['content-type']){delete _0x452aa8[_0x8218('0xa5')]['content-type'];}return rp(_0x452aa8);})[_0x8218('0x25')](function(_0x496712){if(_0x496712){_0x1c0cdf[_0x8218('0xa7')](_0x496712[_0x8218('0xa5')]);logger['info'](_0x496712[_0x8218('0x92')]);if(_[_0x8218('0xa8')](_0x18b9f4[_0x8218('0x34')][_0x8218('0x7')],_0x8218('0x4c'))&&_0x496712[_0x8218('0xa9')]==0x1f4){return _0x1c0cdf[_0x8218('0x1a')](_0x496712[_0x8218('0xa9')]);}else{return _0x1c0cdf['status'](_0x496712[_0x8218('0xa9')])[_0x8218('0x2d')](_0x496712[_0x8218('0x92')]);}}else{return _0x1c0cdf[_0x8218('0x1a')](0xc8);}})[_0x8218('0x4b')](handleError(_0x1c0cdf,null));};exports[_0x8218('0xaa')]=function(_0x3b09f5,_0xfb5a88,_0x248c2a){return BPromise[_0x8218('0x9e')]()[_0x8218('0x25')](function(){if(!_0x3b09f5['query'][_0x8218('0x7')]){throw new Error(_0x8218('0xab'));}if(!_0x3b09f5[_0x8218('0x34')][_0x8218('0x9f')]){throw new Error(_0x8218('0xa0'));}var _0x13b11f=_0x3b09f5[_0x8218('0x34')]['hostname']?_0x3b09f5['query']['hostname']+':'+_0x3b09f5['query'][_0x8218('0x9f')]:_0x8218('0xa2')+_0x3b09f5[_0x8218('0x34')]['port'];var _0x27eaf3=_0x3b09f5[_0x8218('0x34')][_0x8218('0x1b')]?_0x3b09f5[_0x8218('0x34')]['json']:!![];var _0x394d43=_0x3b09f5[_0x8218('0x34')][_0x8218('0xa3')]?_0x3b09f5[_0x8218('0x34')][_0x8218('0xa3')]:null;var _0x512ecd={'method':_0x3b09f5[_0x8218('0xa4')],'uri':util[_0x8218('0x63')](_0x8218('0xac'),_0x13b11f,_0x3b09f5['query'][_0x8218('0x7')]),'json':_0x27eaf3,'resolveWithFullResponse':!![],'encoding':_0x394d43,'body':_0x3b09f5['body']};if(_0x3b09f5[_0x8218('0xa5')]){_0x512ecd['headers']=_0x3b09f5[_0x8218('0xa5')];if(_0x512ecd[_0x8218('0xa5')][_0x8218('0xa6')]){delete _0x512ecd[_0x8218('0xa5')][_0x8218('0xa6')];}}if(_0x512ecd['headers'][_0x8218('0xad')]){delete _0x512ecd['headers'][_0x8218('0xad')];}return rp(_0x512ecd);})[_0x8218('0x25')](function(_0x3e8a6a){if(_0x3e8a6a){_0xfb5a88[_0x8218('0xa7')](_0x3e8a6a[_0x8218('0xa5')]);logger[_0x8218('0x66')](_0x3e8a6a['body']);return _0xfb5a88[_0x8218('0x20')](_0x3e8a6a['statusCode'])[_0x8218('0x2d')](_0x3e8a6a[_0x8218('0x92')]);}else{return _0xfb5a88[_0x8218('0x1a')](0xc8);}})['catch'](handleError(_0xfb5a88,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1ef224f..2448367 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 _0xcbd3=['save','update','remove','emit','hook','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x4ac2ff,_0x51838d){var _0x463521=function(_0x246f23){while(--_0x246f23){_0x4ac2ff['push'](_0x4ac2ff['shift']());}};_0x463521(++_0x51838d);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x1134b9,_0x1a0e66){_0x1134b9=_0x1134b9-0x0;var _0x59ed49=_0xcbd3[_0x1134b9];return _0x59ed49;};'use strict';var EventEmitter=require(_0x3cbd('0x0'));var Plugin=require(_0x3cbd('0x1'))['db'][_0x3cbd('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x3cbd('0x3')](0x0);var events={'afterCreate':_0x3cbd('0x4'),'afterUpdate':_0x3cbd('0x5'),'afterDestroy':_0x3cbd('0x6')};function emitEvent(_0x3c40e5){return function(_0x2f4854,_0x32a914,_0x5484ce){PluginEvents[_0x3cbd('0x7')](_0x3c40e5+':'+_0x2f4854['id'],_0x2f4854);PluginEvents[_0x3cbd('0x7')](_0x3c40e5,_0x2f4854);_0x5484ce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x3cbd('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x13c5=['emit','hasOwnProperty','events'];(function(_0x4bac2e,_0xdb7d8f){var _0x460173=function(_0x224bbb){while(--_0x224bbb){_0x4bac2e['push'](_0x4bac2e['shift']());}};_0x460173(++_0xdb7d8f);}(_0x13c5,0x7a));var _0x513c=function(_0x341149,_0x4b76d4){_0x341149=_0x341149-0x0;var _0x3fecdd=_0x13c5[_0x341149];return _0x3fecdd;};'use strict';var EventEmitter=require(_0x513c('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x432ab7){return function(_0x516e1a,_0x4d46c0,_0x477e2c){PluginEvents[_0x513c('0x1')](_0x432ab7+':'+_0x516e1a['id'],_0x516e1a);PluginEvents[_0x513c('0x1')](_0x432ab7,_0x516e1a);_0x477e2c(null);};}for(var e in events){if(events[_0x513c('0x2')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 9875449..e65cfaf 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 _0x1d8d=['path','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird'];(function(_0x412b93,_0x2cc773){var _0x5b984c=function(_0x1b8ad9){while(--_0x1b8ad9){_0x412b93['push'](_0x412b93['shift']());}};_0x5b984c(++_0x2cc773);}(_0x1d8d,0x1e7));var _0xd1d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d8d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1d8('0x0'));var util=require('util');var logger=require(_0xd1d8('0x1'))(_0xd1d8('0x2'));var moment=require(_0xd1d8('0x3'));var BPromise=require(_0xd1d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1d8('0x5'));var rimraf=require('rimraf');var config=require(_0xd1d8('0x6'));var attributes=require(_0xd1d8('0x7'));module[_0xd1d8('0x8')]=function(_0x4e5ce3,_0x3402cd){return _0x4e5ce3[_0xd1d8('0x9')](_0xd1d8('0xa'),attributes,{'tableName':_0xd1d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d9e=['../../config/environment','./plugin.attributes','define','Plugin','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x58e582,_0x41b688){var _0x27f1cd=function(_0x530c74){while(--_0x530c74){_0x58e582['push'](_0x58e582['shift']());}};_0x27f1cd(++_0x41b688);}(_0x4d9e,0x93));var _0xe4d9=function(_0xd6173,_0x3635f5){_0xd6173=_0xd6173-0x0;var _0x201ccb=_0x4d9e[_0xd6173];return _0x201ccb;};'use strict';var _=require('lodash');var util=require(_0xe4d9('0x0'));var logger=require(_0xe4d9('0x1'))(_0xe4d9('0x2'));var moment=require(_0xe4d9('0x3'));var BPromise=require('bluebird');var rp=require(_0xe4d9('0x4'));var fs=require('fs');var path=require(_0xe4d9('0x5'));var rimraf=require(_0xe4d9('0x6'));var config=require(_0xe4d9('0x7'));var attributes=require(_0xe4d9('0x8'));module['exports']=function(_0x475c75,_0x9c2c72){return _0x475c75[_0xe4d9('0x9')](_0xe4d9('0xa'),attributes,{'tableName':'plugins','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 6f238f0..ae8afc4 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 _0x3353=['./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x516d26,_0x43b1b1){var _0x2f2da2=function(_0xdeee91){while(--_0xdeee91){_0x516d26['push'](_0x516d26['shift']());}};_0x2f2da2(++_0x43b1b1);}(_0x3353,0x1ef));var _0x3335=function(_0x3d9290,_0x14602a){_0x3d9290=_0x3d9290-0x0;var _0x32ca9f=_0x3353[_0x3d9290];return _0x32ca9f;};'use strict';var _=require('lodash');var util=require(_0x3335('0x0'));var moment=require(_0x3335('0x1'));var BPromise=require('bluebird');var rs=require(_0x3335('0x2'));var fs=require('fs');var Redis=require(_0x3335('0x3'));var db=require(_0x3335('0x4'))['db'];var utils=require(_0x3335('0x5'));var logger=require(_0x3335('0x6'))(_0x3335('0x7'));var config=require(_0x3335('0x8'));var jayson=require(_0x3335('0x9'));var client=jayson[_0x3335('0xa')][_0x3335('0xb')]({'port':0x232a});config[_0x3335('0xc')]=_[_0x3335('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3335('0xe'))(new Redis(config[_0x3335('0xc')]));require(_0x3335('0xf'))[_0x3335('0x10')](socket);function respondWithRpcPromise(_0x337d98,_0x1afd05,_0x4d9420){return new BPromise(function(_0x2c1441,_0x946456){return client['request'](_0x337d98,_0x4d9420)[_0x3335('0x11')](function(_0x494ae7){logger[_0x3335('0x12')](_0x3335('0x13'),_0x1afd05,_0x3335('0x14'));logger[_0x3335('0x15')](_0x3335('0x16'),_0x1afd05,_0x3335('0x14'),JSON[_0x3335('0x17')](_0x494ae7));if(_0x494ae7['error']){if(_0x494ae7[_0x3335('0x18')][_0x3335('0x19')]===0x1f4){logger['error'](_0x3335('0x13'),_0x1afd05,_0x494ae7[_0x3335('0x18')][_0x3335('0x1a')]);return _0x946456(_0x494ae7['error'][_0x3335('0x1a')]);}logger[_0x3335('0x18')](_0x3335('0x13'),_0x1afd05,_0x494ae7[_0x3335('0x18')][_0x3335('0x1a')]);return _0x2c1441(_0x494ae7[_0x3335('0x18')][_0x3335('0x1a')]);}else{logger['info'](_0x3335('0x13'),_0x1afd05,_0x3335('0x14'));_0x2c1441(_0x494ae7[_0x3335('0x1b')][_0x3335('0x1a')]);}})[_0x3335('0x1c')](function(_0x5e4c72){logger[_0x3335('0x18')](_0x3335('0x13'),_0x1afd05,_0x5e4c72);_0x946456(_0x5e4c72);});});}exports[_0x3335('0x1d')]=function(_0xc491e6){var _0x55ef42=this;return new Promise(function(_0xcdb437,_0xb08d00){return db[_0x3335('0x1e')][_0x3335('0x1f')](_0xc491e6[_0x3335('0x20')],{'raw':_0xc491e6[_0x3335('0x21')]?_0xc491e6[_0x3335('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x3335('0x11')](function(_0x2fc85b){logger['info'](_0x3335('0x1d'),_0xc491e6);logger['debug'](_0x3335('0x1d'),_0xc491e6,JSON['stringify'](_0x2fc85b));_0xcdb437(_0x2fc85b);})[_0x3335('0x1c')](function(_0x2d17eb){logger[_0x3335('0x18')](_0x3335('0x1d'),_0x2d17eb['message'],_0xc491e6);_0xb08d00(_0x55ef42[_0x3335('0x18')](0x1f4,_0x2d17eb['message']));});});}; \ No newline at end of file +var _0x5123=['debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','Plugin,\x20%s,\x20%s','result','catch','CreatePlugin','Plugin','create','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','info','request\x20sent'];(function(_0x5365ad,_0x41ec9b){var _0x365519=function(_0x5f0cd2){while(--_0x5f0cd2){_0x5365ad['push'](_0x5365ad['shift']());}};_0x365519(++_0x41ec9b);}(_0x5123,0xb9));var _0x3512=function(_0x3b30df,_0xd79126){_0x3b30df=_0x3b30df-0x0;var _0x3f35c8=_0x5123[_0x3b30df];return _0x3f35c8;};'use strict';var _=require(_0x3512('0x0'));var util=require(_0x3512('0x1'));var moment=require(_0x3512('0x2'));var BPromise=require(_0x3512('0x3'));var rs=require(_0x3512('0x4'));var fs=require('fs');var Redis=require(_0x3512('0x5'));var db=require(_0x3512('0x6'))['db'];var utils=require(_0x3512('0x7'));var logger=require(_0x3512('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3512('0x9'));var client=jayson['client'][_0x3512('0xa')]({'port':0x232a});config[_0x3512('0xb')]=_[_0x3512('0xc')](config['redis'],{'host':_0x3512('0xd'),'port':0x18eb});var socket=require(_0x3512('0xe'))(new Redis(config[_0x3512('0xb')]));require(_0x3512('0xf'))[_0x3512('0x10')](socket);function respondWithRpcPromise(_0x969c3b,_0x39de0b,_0x2c8829){return new BPromise(function(_0x2de07e,_0x1a1690){return client['request'](_0x969c3b,_0x2c8829)['then'](function(_0x26c65f){logger[_0x3512('0x11')]('Plugin,\x20%s,\x20%s',_0x39de0b,_0x3512('0x12'));logger[_0x3512('0x13')](_0x3512('0x14'),_0x39de0b,_0x3512('0x12'),JSON['stringify'](_0x26c65f));if(_0x26c65f[_0x3512('0x15')]){if(_0x26c65f[_0x3512('0x15')][_0x3512('0x16')]===0x1f4){logger[_0x3512('0x15')]('Plugin,\x20%s,\x20%s',_0x39de0b,_0x26c65f[_0x3512('0x15')][_0x3512('0x17')]);return _0x1a1690(_0x26c65f[_0x3512('0x15')]['message']);}logger[_0x3512('0x15')](_0x3512('0x18'),_0x39de0b,_0x26c65f[_0x3512('0x15')][_0x3512('0x17')]);return _0x2de07e(_0x26c65f['error'][_0x3512('0x17')]);}else{logger[_0x3512('0x11')](_0x3512('0x18'),_0x39de0b,_0x3512('0x12'));_0x2de07e(_0x26c65f[_0x3512('0x19')]['message']);}})[_0x3512('0x1a')](function(_0x1d1922){logger[_0x3512('0x15')](_0x3512('0x18'),_0x39de0b,_0x1d1922);_0x1a1690(_0x1d1922);});});}exports[_0x3512('0x1b')]=function(_0x41b002){var _0xb6364c=this;return new Promise(function(_0x2abb09,_0x6b9a5e){return db[_0x3512('0x1c')][_0x3512('0x1d')](_0x41b002['body'],{'raw':_0x41b002[_0x3512('0x1e')]?_0x41b002[_0x3512('0x1e')][_0x3512('0x1f')]===undefined?!![]:![]:!![]})[_0x3512('0x20')](function(_0x293ad6){logger[_0x3512('0x11')](_0x3512('0x1b'),_0x41b002);logger[_0x3512('0x13')](_0x3512('0x1b'),_0x41b002,JSON[_0x3512('0x21')](_0x293ad6));_0x2abb09(_0x293ad6);})['catch'](function(_0x47ea87){logger[_0x3512('0x15')](_0x3512('0x1b'),_0x47ea87[_0x3512('0x17')],_0x41b002);_0x6b9a5e(_0xb6364c[_0x3512('0x15')](0x1f4,_0x47ea87[_0x3512('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 1066c28..e50746f 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 _0x8cef=['./plugin.events','remove','update','emit','length','plugin:'];(function(_0x7e6fd4,_0x1368b5){var _0x4b7c2f=function(_0x20a152){while(--_0x20a152){_0x7e6fd4['push'](_0x7e6fd4['shift']());}};_0x4b7c2f(++_0x1368b5);}(_0x8cef,0x14a));var _0xf8ce=function(_0x1d2fb6,_0x1ccb03){_0x1d2fb6=_0x1d2fb6-0x0;var _0x22d8a7=_0x8cef[_0x1d2fb6];return _0x22d8a7;};'use strict';var PluginEvents=require(_0xf8ce('0x0'));var events=['save',_0xf8ce('0x1'),_0xf8ce('0x2')];function createListener(_0x4962ba,_0x5bd31e){return function(_0x149002){_0x5bd31e[_0xf8ce('0x3')](_0x4962ba,_0x149002);};}function removeListener(_0x30168d,_0x484418){return function(){PluginEvents['removeListener'](_0x30168d,_0x484418);};}exports['register']=function(_0x1f52b2){for(var _0x40de30=0x0,_0x474be4=events[_0xf8ce('0x4')];_0x40de30<_0x474be4;_0x40de30++){var _0x253303=events[_0x40de30];var _0x4c9ed1=createListener(_0xf8ce('0x5')+_0x253303,_0x1f52b2);PluginEvents['on'](_0x253303,_0x4c9ed1);}}; \ No newline at end of file +var _0xd3ca=['emit','length','plugin:','./plugin.events','save','update'];(function(_0x4bc4f6,_0x3c540d){var _0x37f94c=function(_0x463473){while(--_0x463473){_0x4bc4f6['push'](_0x4bc4f6['shift']());}};_0x37f94c(++_0x3c540d);}(_0xd3ca,0x177));var _0xad3c=function(_0x217098,_0x55c56d){_0x217098=_0x217098-0x0;var _0x35bbda=_0xd3ca[_0x217098];return _0x35bbda;};'use strict';var PluginEvents=require(_0xad3c('0x0'));var events=[_0xad3c('0x1'),'remove',_0xad3c('0x2')];function createListener(_0x1db8bd,_0x4ec9b2){return function(_0x17c678){_0x4ec9b2[_0xad3c('0x3')](_0x1db8bd,_0x17c678);};}function removeListener(_0x275382,_0x2e34fc){return function(){PluginEvents['removeListener'](_0x275382,_0x2e34fc);};}exports['register']=function(_0x1b0e28){for(var _0x20aaa2=0x0,_0x2bfbc2=events[_0xad3c('0x4')];_0x20aaa2<_0x2bfbc2;_0x20aaa2++){var _0x4761aa=events[_0x20aaa2];var _0x1d5e2f=createListener(_0xad3c('0x5')+_0x4761aa,_0x1b0e28);PluginEvents['on'](_0x4761aa,_0x1d5e2f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index de34614..b895fce 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(_0x46db0d,_0x283fae){var _0x4a8c25=function(_0x55481b){while(--_0x55481b){_0x46db0d['push'](_0x46db0d['shift']());}};_0x4a8c25(++_0x283fae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x20b4be,_0x2ed5d6){var _0x1f884e=function(_0x26a8f6){while(--_0x26a8f6){_0x20b4be['push'](_0x20b4be['shift']());}};_0x1f884e(++_0x2ed5d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 861c935..3a3e8f9 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 _0xd8b0=['info','index','list','then','reject','express','motion2','length','show','describe','params','catch','body','script','join','dirname','chdir','start','update','restart','hasOwnProperty','Unknown\x20status','destroy','dump','Unknown\x20id','lodash','../../config/pm2','child_process','exec','bluebird','json','error','stack','name','status','send','npm\x20install'];(function(_0x4cfd0f,_0x1eb109){var _0x42aaf0=function(_0x3bdfee){while(--_0x3bdfee){_0x4cfd0f['push'](_0x4cfd0f['shift']());}};_0x42aaf0(++_0x1eb109);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var pm2=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var path=require('path');var exec=require(_0x0d8b('0x2'))[_0x0d8b('0x3')];var BPromise=require(_0x0d8b('0x4'));function handleEntityNotFound(_0x364286,_0x8196ed){return function(_0x577834){if(!_0x577834){_0x364286['sendStatus'](0x194);;}return _0x577834;};}function respondWithResult(_0x3f8b6f,_0x227c63){_0x227c63=_0x227c63||0xc8;return function(_0x39f43a){if(_0x39f43a){return _0x3f8b6f['status'](_0x227c63)[_0x0d8b('0x5')](_0x39f43a);}return null;};}function handleError(_0x284169,_0x58e4e2){_0x58e4e2=_0x58e4e2||0x1f4;return function(_0x129310){logger[_0x0d8b('0x6')](_0x129310[_0x0d8b('0x7')]);if(_0x129310[_0x0d8b('0x8')]){delete _0x129310[_0x0d8b('0x8')];}_0x284169[_0x0d8b('0x9')](_0x58e4e2)[_0x0d8b('0xa')](_0x129310);};}function execChildProcess(){return new BPromise(function(_0x28f87c,_0x48fa16){exec(_0x0d8b('0xb'),function(_0x4e0269,_0x4225c4,_0xc574a3){logger[_0x0d8b('0xc')](_0x4225c4);logger[_0x0d8b('0xc')](_0xc574a3);if(_0x4e0269){logger[_0x0d8b('0x6')](_0x4e0269);return _0x48fa16(_0x4e0269);}return _0x28f87c(_0x4225c4);});});}exports[_0x0d8b('0xd')]=function(_0x15dd0f,_0x31a8cc){return pm2[_0x0d8b('0xe')]()[_0x0d8b('0xf')](function(_0x5ad086){if(_0x5ad086){var _0xe65334=_[_0x0d8b('0x10')](_0x5ad086,function(_0x2d4e1c){return _0x2d4e1c['name']===_0x0d8b('0x11')||_0x2d4e1c[_0x0d8b('0x8')]===_0x0d8b('0x12');});return{'rows':_0xe65334,'count':_0xe65334[_0x0d8b('0x13')]};}return null;})[_0x0d8b('0xf')](respondWithResult(_0x31a8cc,null))['catch'](handleError(_0x31a8cc,null));};exports[_0x0d8b('0x14')]=function(_0x4586c2,_0x2fd0fc){return pm2[_0x0d8b('0x15')](_0x4586c2[_0x0d8b('0x16')]['id'])[_0x0d8b('0xf')](respondWithResult(_0x2fd0fc,null))[_0x0d8b('0xf')](handleEntityNotFound(_0x2fd0fc,null))[_0x0d8b('0x17')](handleError(_0x2fd0fc,null));};exports['create']=function(_0x27512e,_0x23d58f){if(_0x27512e[_0x0d8b('0x18')][_0x0d8b('0x8')]&&_0x27512e[_0x0d8b('0x18')][_0x0d8b('0x19')]){var _0x393beb=path[_0x0d8b('0x1a')](__dirname,'../../files/plugins',_0x27512e['body'][_0x0d8b('0x19')]);var _0x54a9a7=process['cwd']();process['chdir'](path[_0x0d8b('0x1b')](_0x393beb));return execChildProcess()[_0x0d8b('0xf')](function(_0x214778){process[_0x0d8b('0x1c')](_0x54a9a7);return pm2[_0x0d8b('0x1d')]({'name':_0x27512e[_0x0d8b('0x18')][_0x0d8b('0x8')],'script':_0x393beb});})[_0x0d8b('0xf')](function(_0x27b695){pm2['dump']();return _0x27b695[0x0];})[_0x0d8b('0xf')](respondWithResult(_0x23d58f,0xc9))[_0x0d8b('0x17')](handleError(_0x23d58f,null));}else{return _0x23d58f['status'](0x1f4)[_0x0d8b('0xa')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x0d8b('0x1e')]=function(_0x234bdd,_0xa2af02){if(_0x234bdd['body']['id']){delete _0x234bdd['body']['id'];}var _0x28f639={'online':_0x0d8b('0x1f'),'stopped':'stop'};if(_0x28f639[_0x0d8b('0x20')](_0x234bdd['body'][_0x0d8b('0x9')])){return pm2[_0x28f639[_0x234bdd['body'][_0x0d8b('0x9')]]](_0x234bdd['params']['id'])[_0x0d8b('0xf')](respondWithResult(_0xa2af02,0xc8))['catch'](handleError(_0xa2af02,null));}else{return _0xa2af02[_0x0d8b('0x9')](0x1f4)['send']({'message':_0x0d8b('0x21')});}};exports[_0x0d8b('0x22')]=function(_0x2c058d,_0x56120a){if(_0x2c058d['body']['id']){delete _0x2c058d['body']['id'];}if(_0x2c058d[_0x0d8b('0x16')]['id']){return pm2['delete'](_0x2c058d[_0x0d8b('0x16')]['id'])['then'](function(_0x5d05fc){pm2[_0x0d8b('0x23')]();return _0x5d05fc[0x0];})[_0x0d8b('0xf')](respondWithResult(_0x56120a,null))[_0x0d8b('0x17')](handleError(_0x56120a,null));}else{return _0x56120a[_0x0d8b('0x9')](0x1f4)[_0x0d8b('0xa')]({'message':_0x0d8b('0x24')});}}; \ No newline at end of file +var _0xa8a8=['dirname','start','dump','update','restart','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','length','catch','show','describe','params','create','script','join','../../files/plugins','body','cwd','chdir'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0xa8a8,0xec));var _0x8a8a=function(_0x39c172,_0x23ed66){_0x39c172=_0x39c172-0x0;var _0x1ecba3=_0xa8a8[_0x39c172];return _0x1ecba3;};'use strict';var _=require(_0x8a8a('0x0'));var pm2=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var path=require('path');var exec=require(_0x8a8a('0x4'))[_0x8a8a('0x5')];var BPromise=require(_0x8a8a('0x6'));function handleEntityNotFound(_0x3ed1de,_0x45515d){return function(_0x1cecd4){if(!_0x1cecd4){_0x3ed1de[_0x8a8a('0x7')](0x194);;}return _0x1cecd4;};}function respondWithResult(_0x12db82,_0x2e8193){_0x2e8193=_0x2e8193||0xc8;return function(_0x315fe9){if(_0x315fe9){return _0x12db82[_0x8a8a('0x8')](_0x2e8193)[_0x8a8a('0x9')](_0x315fe9);}return null;};}function handleError(_0x4225b9,_0xecaa6f){_0xecaa6f=_0xecaa6f||0x1f4;return function(_0x3287f5){logger['error'](_0x3287f5['stack']);if(_0x3287f5[_0x8a8a('0xa')]){delete _0x3287f5['name'];}_0x4225b9[_0x8a8a('0x8')](_0xecaa6f)[_0x8a8a('0xb')](_0x3287f5);};}function execChildProcess(){return new BPromise(function(_0x532621,_0x118380){exec(_0x8a8a('0xc'),function(_0xb13fca,_0x5e448d,_0x679da2){logger[_0x8a8a('0xd')](_0x5e448d);logger[_0x8a8a('0xd')](_0x679da2);if(_0xb13fca){logger[_0x8a8a('0xe')](_0xb13fca);return _0x118380(_0xb13fca);}return _0x532621(_0x5e448d);});});}exports['index']=function(_0x23febf,_0x4e5d74){return pm2[_0x8a8a('0xf')]()[_0x8a8a('0x10')](function(_0x787eec){if(_0x787eec){var _0x2f6e33=_[_0x8a8a('0x11')](_0x787eec,function(_0x78b0f0){return _0x78b0f0[_0x8a8a('0xa')]==='express'||_0x78b0f0[_0x8a8a('0xa')]==='motion2';});return{'rows':_0x2f6e33,'count':_0x2f6e33[_0x8a8a('0x12')]};}return null;})[_0x8a8a('0x10')](respondWithResult(_0x4e5d74,null))[_0x8a8a('0x13')](handleError(_0x4e5d74,null));};exports[_0x8a8a('0x14')]=function(_0x42e8b6,_0x5dd616){return pm2[_0x8a8a('0x15')](_0x42e8b6[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](respondWithResult(_0x5dd616,null))[_0x8a8a('0x10')](handleEntityNotFound(_0x5dd616,null))[_0x8a8a('0x13')](handleError(_0x5dd616,null));};exports[_0x8a8a('0x17')]=function(_0x4d7a45,_0x5dc5ae){if(_0x4d7a45['body']['name']&&_0x4d7a45['body'][_0x8a8a('0x18')]){var _0x45095b=path[_0x8a8a('0x19')](__dirname,_0x8a8a('0x1a'),_0x4d7a45[_0x8a8a('0x1b')][_0x8a8a('0x18')]);var _0x242bac=process[_0x8a8a('0x1c')]();process[_0x8a8a('0x1d')](path[_0x8a8a('0x1e')](_0x45095b));return execChildProcess()[_0x8a8a('0x10')](function(_0x3aa2bb){process[_0x8a8a('0x1d')](_0x242bac);return pm2[_0x8a8a('0x1f')]({'name':_0x4d7a45[_0x8a8a('0x1b')]['name'],'script':_0x45095b});})[_0x8a8a('0x10')](function(_0x16c55b){pm2[_0x8a8a('0x20')]();return _0x16c55b[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x5dc5ae,0xc9))[_0x8a8a('0x13')](handleError(_0x5dc5ae,null));}else{return _0x5dc5ae[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8a8a('0x21')]=function(_0x38c1e0,_0x2e217a){if(_0x38c1e0['body']['id']){delete _0x38c1e0['body']['id'];}var _0x2dafcd={'online':_0x8a8a('0x22'),'stopped':'stop'};if(_0x2dafcd['hasOwnProperty'](_0x38c1e0['body'][_0x8a8a('0x8')])){return pm2[_0x2dafcd[_0x38c1e0['body'][_0x8a8a('0x8')]]](_0x38c1e0[_0x8a8a('0x16')]['id'])['then'](respondWithResult(_0x2e217a,0xc8))[_0x8a8a('0x13')](handleError(_0x2e217a,null));}else{return _0x2e217a[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x23')});}};exports[_0x8a8a('0x24')]=function(_0x3d6594,_0x3e73b1){if(_0x3d6594[_0x8a8a('0x1b')]['id']){delete _0x3d6594['body']['id'];}if(_0x3d6594['params']['id']){return pm2['delete'](_0x3d6594[_0x8a8a('0x16')]['id'])[_0x8a8a('0x10')](function(_0x5f301e){pm2[_0x8a8a('0x20')]();return _0x5f301e[0x0];})[_0x8a8a('0x10')](respondWithResult(_0x3e73b1,null))['catch'](handleError(_0x3e73b1,null));}else{return _0x3e73b1[_0x8a8a('0x8')](0x1f4)[_0x8a8a('0xb')]({'message':_0x8a8a('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index cdca47d..ed91340 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 _0x5144=['getQueues','express','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x168392,_0x126016){var _0x31c66d=function(_0x513826){while(--_0x513826){_0x168392['push'](_0x168392['shift']());}};_0x31c66d(++_0x126016);}(_0x5144,0xa9));var _0x4514=function(_0x4a8636,_0x30e1db){_0x4a8636=_0x4a8636-0x0;var _0x2c7a55=_0x5144[_0x4a8636];return _0x2c7a55;};'use strict';var express=require(_0x4514('0x0'));var router=express['Router']();var auth=require(_0x4514('0x1'));var controller=require(_0x4514('0x2'));router[_0x4514('0x3')](_0x4514('0x4'),auth[_0x4514('0x5')](),controller[_0x4514('0x6')]);router[_0x4514('0x3')]('/queues',auth['isAuthenticated'](),controller[_0x4514('0x7')]);module['exports']=router; \ No newline at end of file +var _0x3d40=['getAgents','exports','express','Router','../../components/auth/service','./realtime.controller','get','isAuthenticated'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x3d40,0x15a));var _0x03d4=function(_0x3ef337,_0x2e1a46){_0x3ef337=_0x3ef337-0x0;var _0x49faa5=_0x3d40[_0x3ef337];return _0x49faa5;};'use strict';var express=require(_0x03d4('0x0'));var router=express[_0x03d4('0x1')]();var auth=require(_0x03d4('0x2'));var controller=require(_0x03d4('0x3'));router[_0x03d4('0x4')]('/agents',auth[_0x03d4('0x5')](),controller[_0x03d4('0x6')]);router['get']('/queues',auth[_0x03d4('0x5')](),controller['getQueues']);module[_0x03d4('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 f1a1dc0..bfd592d 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 _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x2d5b37,_0x51612e){var _0x167f72=function(_0x3a706f){while(--_0x3a706f){_0x2d5b37['push'](_0x2d5b37['shift']());}};_0x167f72(++_0x51612e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file +var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x56e60b,_0x3c1bdc){var _0x305ce1=function(_0x98659c){while(--_0x98659c){_0x56e60b['push'](_0x56e60b['shift']());}};_0x305ce1(++_0x3c1bdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 2427c6c..4db177a 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x183678,_0x3a89fa){var _0x4816a0=function(_0x596563){while(--_0x596563){_0x183678['push'](_0x183678['shift']());}};_0x4816a0(++_0x3a89fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2b59db,_0x2fd753){var _0x1b8a3b=function(_0x41c9ab){while(--_0x41c9ab){_0x2b59db['push'](_0x2b59db['shift']());}};_0x1b8a3b(++_0x2fd753);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 0d8a170..e5be972 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 _0x5a4f=['STRING','sequelize','INTEGER','DATE'];(function(_0x4af563,_0x2b2308){var _0x7deac1=function(_0x20deca){while(--_0x20deca){_0x4af563['push'](_0x4af563['shift']());}};_0x7deac1(++_0x2b2308);}(_0x5a4f,0x10d));var _0xf5a4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x5a4f[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0xf5a4('0x0'));module['exports']={'state':{'type':Sequelize[_0xf5a4('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf5a4('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf5a4('0x2')]},'responsetime':{'type':Sequelize[_0xf5a4('0x2')]},'ringtime':{'type':Sequelize[_0xf5a4('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf5a4('0x3')]},'campaigntype':{'type':Sequelize[_0xf5a4('0x3')]},'membername':{'type':Sequelize[_0xf5a4('0x3')]}}; \ No newline at end of file +var _0x3641=['DATE','STRING','INTEGER','exports'];(function(_0x2ab688,_0x206b54){var _0x352100=function(_0x5a0e54){while(--_0x5a0e54){_0x2ab688['push'](_0x2ab688['shift']());}};_0x352100(++_0x206b54);}(_0x3641,0x173));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x1364('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1364('0x1')]},'uniqueid':{'type':Sequelize[_0x1364('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x1364('0x1')]},'ringtime':{'type':Sequelize[_0x1364('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1364('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1364('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index c180b54..8b40647 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 _0x4568=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./reportAgentPreview.attributes','define','lodash'];(function(_0x2c4a46,_0x38bea3){var _0x4ddfd8=function(_0x12f2d7){while(--_0x12f2d7){_0x2c4a46['push'](_0x2c4a46['shift']());}};_0x4ddfd8(++_0x38bea3);}(_0x4568,0xb3));var _0x8456=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4568[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x8456('0x0'));var util=require(_0x8456('0x1'));var logger=require(_0x8456('0x2'))(_0x8456('0x3'));var moment=require('moment');var BPromise=require(_0x8456('0x4'));var rp=require(_0x8456('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8456('0x6'));var attributes=require(_0x8456('0x7'));module['exports']=function(_0x29fe18,_0x5e5026){return _0x29fe18[_0x8456('0x8')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1a4=['api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash','util'];(function(_0x1c27d1,_0x151c13){var _0x424f6d=function(_0x1ed5c3){while(--_0x1ed5c3){_0x1c27d1['push'](_0x1c27d1['shift']());}};_0x424f6d(++_0x151c13);}(_0xa1a4,0x174));var _0x4a1a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa1a4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4a1a('0x0'));var util=require(_0x4a1a('0x1'));var logger=require('../../config/logger')(_0x4a1a('0x2'));var moment=require(_0x4a1a('0x3'));var BPromise=require(_0x4a1a('0x4'));var rp=require(_0x4a1a('0x5'));var fs=require('fs');var path=require(_0x4a1a('0x6'));var rimraf=require('rimraf');var config=require(_0x4a1a('0x7'));var attributes=require(_0x4a1a('0x8'));module['exports']=function(_0xff9e94,_0xfd3627){return _0xff9e94['define'](_0x4a1a('0x9'),attributes,{'tableName':_0x4a1a('0xa'),'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 b18033b..7a3b89d 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 _0x32ce=['debug','request\x20sent','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','ReportAgentPreview','create','body','options','CreateReportAgentPreview','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x27aafd,_0x15b25){var _0x4eeb27=function(_0x777c9b){while(--_0x777c9b){_0x27aafd['push'](_0x27aafd['shift']());}};_0x4eeb27(++_0x15b25);}(_0x32ce,0xc3));var _0xe32c=function(_0xa1afdd,_0x545768){_0xa1afdd=_0xa1afdd-0x0;var _0x4a9722=_0x32ce[_0xa1afdd];return _0x4a9722;};'use strict';var _=require(_0xe32c('0x0'));var util=require(_0xe32c('0x1'));var moment=require(_0xe32c('0x2'));var BPromise=require(_0xe32c('0x3'));var rs=require(_0xe32c('0x4'));var fs=require('fs');var Redis=require(_0xe32c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe32c('0x6'));var logger=require(_0xe32c('0x7'))(_0xe32c('0x8'));var config=require(_0xe32c('0x9'));var jayson=require(_0xe32c('0xa'));var client=jayson[_0xe32c('0xb')][_0xe32c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1958ee,_0x28bcba,_0x33f3c0){return new BPromise(function(_0x42dc2d,_0x101ab5){return client[_0xe32c('0xd')](_0x1958ee,_0x33f3c0)[_0xe32c('0xe')](function(_0x330809){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x28bcba,'request\x20sent');logger[_0xe32c('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x28bcba,_0xe32c('0x10'),JSON[_0xe32c('0x11')](_0x330809));if(_0x330809['error']){if(_0x330809[_0xe32c('0x12')][_0xe32c('0x13')]===0x1f4){logger[_0xe32c('0x12')](_0xe32c('0x14'),_0x28bcba,_0x330809[_0xe32c('0x12')][_0xe32c('0x15')]);return _0x101ab5(_0x330809['error'][_0xe32c('0x15')]);}logger[_0xe32c('0x12')](_0xe32c('0x14'),_0x28bcba,_0x330809[_0xe32c('0x12')][_0xe32c('0x15')]);return _0x42dc2d(_0x330809['error'][_0xe32c('0x15')]);}else{logger[_0xe32c('0x16')]('ReportAgentPreview,\x20%s,\x20%s',_0x28bcba,'request\x20sent');_0x42dc2d(_0x330809[_0xe32c('0x17')][_0xe32c('0x15')]);}})['catch'](function(_0x17e65a){logger[_0xe32c('0x12')](_0xe32c('0x14'),_0x28bcba,_0x17e65a);_0x101ab5(_0x17e65a);});});}exports['CreateReportAgentPreview']=function(_0x202513){var _0x1a271b=this;return new Promise(function(_0x534bf6,_0x338ff6){return db[_0xe32c('0x18')][_0xe32c('0x19')](_0x202513[_0xe32c('0x1a')],{'raw':_0x202513[_0xe32c('0x1b')]?_0x202513['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x76d3f8){logger[_0xe32c('0x16')](_0xe32c('0x1c'),_0x202513);logger[_0xe32c('0xf')]('CreateReportAgentPreview',_0x202513,JSON[_0xe32c('0x11')](_0x76d3f8));_0x534bf6(_0x76d3f8);})[_0xe32c('0x1d')](function(_0x39efe7){logger[_0xe32c('0x12')](_0xe32c('0x1c'),_0x39efe7[_0xe32c('0x15')],_0x202513);_0x338ff6(_0x1a271b[_0xe32c('0x12')](0x1f4,_0x39efe7[_0xe32c('0x15')]));});});}; \ No newline at end of file +var _0xeaa4=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify'];(function(_0x32bbda,_0xf42ffe){var _0x311e86=function(_0xc88b2f){while(--_0xc88b2f){_0x32bbda['push'](_0x32bbda['shift']());}};_0x311e86(++_0xf42ffe);}(_0xeaa4,0x105));var _0x4eaa=function(_0xd269fa,_0x116b28){_0xd269fa=_0xd269fa-0x0;var _0x4c5440=_0xeaa4[_0xd269fa];return _0x4c5440;};'use strict';var _=require(_0x4eaa('0x0'));var util=require(_0x4eaa('0x1'));var moment=require(_0x4eaa('0x2'));var BPromise=require(_0x4eaa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4eaa('0x4'));var db=require(_0x4eaa('0x5'))['db'];var utils=require(_0x4eaa('0x6'));var logger=require('../../config/logger')(_0x4eaa('0x7'));var config=require(_0x4eaa('0x8'));var jayson=require(_0x4eaa('0x9'));var client=jayson[_0x4eaa('0xa')][_0x4eaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa83ee2,_0x4b7d1,_0x42da1e){return new BPromise(function(_0x45e7d9,_0x24cffe){return client['request'](_0xa83ee2,_0x42da1e)[_0x4eaa('0xc')](function(_0x22f496){logger['info'](_0x4eaa('0xd'),_0x4b7d1,_0x4eaa('0xe'));logger[_0x4eaa('0xf')](_0x4eaa('0x10'),_0x4b7d1,'request\x20sent',JSON['stringify'](_0x22f496));if(_0x22f496[_0x4eaa('0x11')]){if(_0x22f496[_0x4eaa('0x11')][_0x4eaa('0x12')]===0x1f4){logger[_0x4eaa('0x11')](_0x4eaa('0xd'),_0x4b7d1,_0x22f496[_0x4eaa('0x11')][_0x4eaa('0x13')]);return _0x24cffe(_0x22f496['error'][_0x4eaa('0x13')]);}logger[_0x4eaa('0x11')](_0x4eaa('0xd'),_0x4b7d1,_0x22f496[_0x4eaa('0x11')][_0x4eaa('0x13')]);return _0x45e7d9(_0x22f496[_0x4eaa('0x11')][_0x4eaa('0x13')]);}else{logger[_0x4eaa('0x14')](_0x4eaa('0xd'),_0x4b7d1,_0x4eaa('0xe'));_0x45e7d9(_0x22f496['result'][_0x4eaa('0x13')]);}})[_0x4eaa('0x15')](function(_0x497eb0){logger[_0x4eaa('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x4b7d1,_0x497eb0);_0x24cffe(_0x497eb0);});});}exports[_0x4eaa('0x16')]=function(_0x101122){var _0x571d87=this;return new Promise(function(_0x44536e,_0x34e45d){return db[_0x4eaa('0x17')][_0x4eaa('0x18')](_0x101122[_0x4eaa('0x19')],{'raw':_0x101122['options']?_0x101122[_0x4eaa('0x1a')][_0x4eaa('0x1b')]===undefined?!![]:![]:!![]})[_0x4eaa('0xc')](function(_0x2f3218){logger['info']('CreateReportAgentPreview',_0x101122);logger[_0x4eaa('0xf')](_0x4eaa('0x16'),_0x101122,JSON[_0x4eaa('0x1c')](_0x2f3218));_0x44536e(_0x2f3218);})['catch'](function(_0x236ca2){logger[_0x4eaa('0x11')](_0x4eaa('0x16'),_0x236ca2['message'],_0x101122);_0x34e45d(_0x571d87[_0x4eaa('0x11')](0x1f4,_0x236ca2[_0x4eaa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3ae39a2..31cc83a 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 _0xe802=['voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','/outbound/channels','/agents','agents','put','agentCapacity','/telephones','telephones','trunks','/fax/accounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated'];(function(_0x2a1257,_0x181d87){var _0x4f8bff=function(_0x4d7e32){while(--_0x4d7e32){_0x2a1257['push'](_0x2a1257['shift']());}};_0x4f8bff(++_0x181d87);}(_0xe802,0x97));var _0x2e80=function(_0x548f36,_0x61ba79){_0x548f36=_0x548f36-0x0;var _0xb41361=_0xe802[_0x548f36];return _0xb41361;};'use strict';var multer=require('multer');var util=require(_0x2e80('0x0'));var path=require('path');var express=require(_0x2e80('0x1'));var router=express[_0x2e80('0x2')]();var auth=require(_0x2e80('0x3'));var controller=require(_0x2e80('0x4'));router['get'](_0x2e80('0x5'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x7')]);router['get'](_0x2e80('0x8'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x9')]);router[_0x2e80('0xa')](_0x2e80('0xb'),auth[_0x2e80('0x6')](),controller[_0x2e80('0xc')]);router[_0x2e80('0xa')](_0x2e80('0xd'),auth['isAuthenticated'](),controller[_0x2e80('0xe')]);router[_0x2e80('0xa')]('/chat/queues',auth[_0x2e80('0x6')](),controller[_0x2e80('0xf')]);router[_0x2e80('0xa')](_0x2e80('0x10'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x11')]);router[_0x2e80('0xa')](_0x2e80('0x12'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x13')]);router[_0x2e80('0xa')](_0x2e80('0x14'),auth['isAuthenticated'](),controller[_0x2e80('0x15')]);router[_0x2e80('0xa')]('/sms/queues',auth['isAuthenticated'](),controller[_0x2e80('0x16')]);router[_0x2e80('0xa')](_0x2e80('0x17'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x18')]);router['get'](_0x2e80('0x19'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x1a')]);router[_0x2e80('0xa')]('/voice/queues/preview/:id',auth[_0x2e80('0x6')](),controller[_0x2e80('0x1b')]);router[_0x2e80('0xa')]('/voice/queues/channels',auth[_0x2e80('0x6')](),controller['voiceQueuesChannels']);router[_0x2e80('0xa')](_0x2e80('0x1c'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x1d')]);router[_0x2e80('0xa')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x2e80('0x1e')]);router['get'](_0x2e80('0x1f'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x20')]);router[_0x2e80('0xa')]('/voice/queues/:id',auth[_0x2e80('0x6')](),controller[_0x2e80('0x21')]);router['put'](_0x2e80('0x22'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x23')]);router['get'](_0x2e80('0x24'),auth[_0x2e80('0x6')](),controller['outbound']);router['get'](_0x2e80('0x25'),auth[_0x2e80('0x6')](),controller['outboundChannels']);router[_0x2e80('0xa')](_0x2e80('0x26'),auth['isAuthenticated'](),controller[_0x2e80('0x27')]);router[_0x2e80('0x28')]('/agents/:id/capacity',auth[_0x2e80('0x6')](),controller[_0x2e80('0x29')]);router[_0x2e80('0xa')](_0x2e80('0x2a'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x2b')]);router['get']('/trunks',auth[_0x2e80('0x6')](),controller[_0x2e80('0x2c')]);router[_0x2e80('0xa')]('/campaigns',auth[_0x2e80('0x6')](),controller['campaigns']);router[_0x2e80('0xa')](_0x2e80('0x2d'),auth[_0x2e80('0x6')](),controller['faxAccounts']);router[_0x2e80('0xa')](_0x2e80('0x2e'),auth[_0x2e80('0x6')](),controller['chatQueuesWaitingInteractions']);router['get']('/mail/queues/waitinginteractions',auth[_0x2e80('0x6')](),controller[_0x2e80('0x2f')]);router[_0x2e80('0xa')](_0x2e80('0x30'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x31')]);router[_0x2e80('0xa')](_0x2e80('0x32'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x33')]);router[_0x2e80('0xa')](_0x2e80('0x34'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x35')]);router[_0x2e80('0xa')]('/whatsapp/queues/waitinginteractions',auth[_0x2e80('0x6')](),controller[_0x2e80('0x36')]);router['get']('/fax/queues/waitinginteractions',auth[_0x2e80('0x6')](),controller[_0x2e80('0x37')]);router[_0x2e80('0x38')](_0x2e80('0x39'),auth['isAuthenticated'](),controller[_0x2e80('0x3a')]('mail'));router[_0x2e80('0xa')](_0x2e80('0x3b'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x3c')]);router[_0x2e80('0x38')](_0x2e80('0x3d'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x3a')](_0x2e80('0x3e')));router['get'](_0x2e80('0x3f'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x2e80('0x38')]('/fax/queues/:id/notify',auth[_0x2e80('0x6')](),controller['queueNotify'](_0x2e80('0x40')));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x2e80('0x41')]);router[_0x2e80('0x38')](_0x2e80('0x42'),auth[_0x2e80('0x6')](),controller['queueNotify'](_0x2e80('0x43')));router[_0x2e80('0xa')](_0x2e80('0x44'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x45')]);router[_0x2e80('0x38')](_0x2e80('0x46'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x3a')](_0x2e80('0x47')));router[_0x2e80('0x38')](_0x2e80('0x48'),auth[_0x2e80('0x6')](),controller[_0x2e80('0x3a')](_0x2e80('0x49')));router[_0x2e80('0xa')]('/sms/queues/:id',auth[_0x2e80('0x6')](),controller[_0x2e80('0x4a')]);router[_0x2e80('0xa')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x2e80('0x4b')]);router['post'](_0x2e80('0x4c'),auth['isAuthenticated'](),controller[_0x2e80('0x4d')]);module[_0x2e80('0x4e')]=router; \ No newline at end of file +var _0x9165=['get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','trunks','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','queueNotify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x2bd8a6,_0x5b9211){var _0x1e037a=function(_0x486e4b){while(--_0x486e4b){_0x2bd8a6['push'](_0x2bd8a6['shift']());}};_0x1e037a(++_0x5b9211);}(_0x9165,0x17c));var _0x5916=function(_0x1a9c94,_0x2f2473){_0x1a9c94=_0x1a9c94-0x0;var _0x9c8ea=_0x9165[_0x1a9c94];return _0x9c8ea;};'use strict';var multer=require(_0x5916('0x0'));var util=require('util');var path=require(_0x5916('0x1'));var express=require(_0x5916('0x2'));var router=express[_0x5916('0x3')]();var auth=require(_0x5916('0x4'));var controller=require('./rpc.controller');router[_0x5916('0x5')]('/voice/channels',auth[_0x5916('0x6')](),controller['voiceChannels']);router[_0x5916('0x5')](_0x5916('0x7'),auth[_0x5916('0x6')](),controller['voiceChannelMixMonitor']);router[_0x5916('0x5')](_0x5916('0x8'),auth[_0x5916('0x6')](),controller[_0x5916('0x9')]);router[_0x5916('0x5')](_0x5916('0xa'),auth[_0x5916('0x6')](),controller[_0x5916('0xb')]);router['get'](_0x5916('0xc'),auth[_0x5916('0x6')](),controller[_0x5916('0xd')]);router['get'](_0x5916('0xe'),auth[_0x5916('0x6')](),controller[_0x5916('0xf')]);router['get'](_0x5916('0x10'),auth[_0x5916('0x6')](),controller[_0x5916('0x11')]);router[_0x5916('0x5')](_0x5916('0x12'),auth[_0x5916('0x6')](),controller[_0x5916('0x13')]);router[_0x5916('0x5')](_0x5916('0x14'),auth[_0x5916('0x6')](),controller['smsQueues']);router[_0x5916('0x5')](_0x5916('0x15'),auth[_0x5916('0x6')](),controller[_0x5916('0x16')]);router['get'](_0x5916('0x17'),auth[_0x5916('0x6')](),controller[_0x5916('0x18')]);router[_0x5916('0x5')](_0x5916('0x19'),auth[_0x5916('0x6')](),controller[_0x5916('0x1a')]);router[_0x5916('0x5')](_0x5916('0x1b'),auth[_0x5916('0x6')](),controller[_0x5916('0x1c')]);router[_0x5916('0x5')](_0x5916('0x1d'),auth[_0x5916('0x6')](),controller[_0x5916('0x1e')]);router[_0x5916('0x5')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x5916('0x1f')]);router[_0x5916('0x5')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x5916('0x6')](),controller[_0x5916('0x20')]);router[_0x5916('0x5')](_0x5916('0x21'),auth[_0x5916('0x6')](),controller[_0x5916('0x22')]);router['put'](_0x5916('0x21'),auth[_0x5916('0x6')](),controller[_0x5916('0x23')]);router[_0x5916('0x5')](_0x5916('0x24'),auth[_0x5916('0x6')](),controller['outbound']);router['get'](_0x5916('0x25'),auth[_0x5916('0x6')](),controller['outboundChannels']);router[_0x5916('0x5')](_0x5916('0x26'),auth[_0x5916('0x6')](),controller[_0x5916('0x27')]);router[_0x5916('0x28')](_0x5916('0x29'),auth['isAuthenticated'](),controller[_0x5916('0x2a')]);router['get']('/telephones',auth['isAuthenticated'](),controller['telephones']);router['get']('/trunks',auth[_0x5916('0x6')](),controller[_0x5916('0x2b')]);router[_0x5916('0x5')]('/campaigns',auth[_0x5916('0x6')](),controller['campaigns']);router['get']('/fax/accounts',auth['isAuthenticated'](),controller[_0x5916('0x2c')]);router[_0x5916('0x5')]('/chat/queues/waitinginteractions',auth[_0x5916('0x6')](),controller[_0x5916('0x2d')]);router[_0x5916('0x5')](_0x5916('0x2e'),auth[_0x5916('0x6')](),controller[_0x5916('0x2f')]);router[_0x5916('0x5')](_0x5916('0x30'),auth[_0x5916('0x6')](),controller[_0x5916('0x31')]);router[_0x5916('0x5')](_0x5916('0x32'),auth['isAuthenticated'](),controller[_0x5916('0x33')]);router[_0x5916('0x5')](_0x5916('0x34'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x5916('0x5')](_0x5916('0x35'),auth[_0x5916('0x6')](),controller[_0x5916('0x36')]);router[_0x5916('0x5')](_0x5916('0x37'),auth[_0x5916('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0x5916('0x38')]('/mail/queues/:id/notify',auth[_0x5916('0x6')](),controller['queueNotify'](_0x5916('0x39')));router[_0x5916('0x5')](_0x5916('0x3a'),auth[_0x5916('0x6')](),controller[_0x5916('0x3b')]);router[_0x5916('0x38')](_0x5916('0x3c'),auth['isAuthenticated'](),controller['queueNotify'](_0x5916('0x3d')));router[_0x5916('0x5')]('/chat/queues/:id',auth[_0x5916('0x6')](),controller[_0x5916('0x3e')]);router[_0x5916('0x38')](_0x5916('0x3f'),auth[_0x5916('0x6')](),controller[_0x5916('0x40')]('fax'));router['get']('/fax/queues/:id',auth[_0x5916('0x6')](),controller['showFaxQueues']);router[_0x5916('0x38')]('/openchannel/queues/:id/notify',auth[_0x5916('0x6')](),controller['queueNotify'](_0x5916('0x41')));router['get'](_0x5916('0x42'),auth[_0x5916('0x6')](),controller[_0x5916('0x43')]);router[_0x5916('0x38')](_0x5916('0x44'),auth['isAuthenticated'](),controller[_0x5916('0x40')](_0x5916('0x45')));router[_0x5916('0x38')](_0x5916('0x46'),auth[_0x5916('0x6')](),controller[_0x5916('0x40')](_0x5916('0x47')));router[_0x5916('0x5')](_0x5916('0x48'),auth['isAuthenticated'](),controller[_0x5916('0x49')]);router['get'](_0x5916('0x4a'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router['post'](_0x5916('0x4b'),auth[_0x5916('0x6')](),controller['agentNotify']);module[_0x5916('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 89956a7..b598398 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 _0x1e02=['merge','voiceChannelStopMixMonitor','params','voiceQueues','updateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','body','user','interaction','hasOwnProperty','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','SIP/%s','agent','internal','capacity','telephones','Telephones','trunks','Trunks','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','findOne','MessageId','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','http','client','then','error','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','query','VoiceChannelMixMonitor'];(function(_0x308f0e,_0x108910){var _0x13167a=function(_0x2b8692){while(--_0x2b8692){_0x308f0e['push'](_0x308f0e['shift']());}};_0x13167a(++_0x108910);}(_0x1e02,0x1bd));var _0x21e0=function(_0xc8fc2d,_0x388076){_0xc8fc2d=_0xc8fc2d-0x0;var _0x324170=_0x1e02[_0xc8fc2d];return _0x324170;};'use strict';var BPromise=require('bluebird');var moment=require(_0x21e0('0x0'));var _=require(_0x21e0('0x1'));var util=require(_0x21e0('0x2'));var db=require(_0x21e0('0x3'))['db'];var logger=require(_0x21e0('0x4'))('api');var jayson=require(_0x21e0('0x5'));var amiClient=jayson['client'][_0x21e0('0x6')]({'port':0x232a});var mailClient=jayson[_0x21e0('0x7')][_0x21e0('0x6')]({'port':0x232b});var routingClient=jayson[_0x21e0('0x7')][_0x21e0('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x3eb3ae,_0x5559c7,_0xda8af9){return new BPromise(function(_0x507510,_0x1e404c){var _0x1d2ea7=_0xda8af9?_0xda8af9:amiClient;return _0x1d2ea7['request'](_0x3eb3ae,_0x5559c7)[_0x21e0('0x8')](function(_0x3d02df){if(_0x3d02df[_0x21e0('0x9')]){if(_0x3d02df[_0x21e0('0x9')]['code']===0x1f4){return _0x1e404c(_0x3d02df[_0x21e0('0x9')]['message']);}return _0x507510(_0x3d02df[_0x21e0('0x9')]['message']);}else{_0x507510(_0x3d02df[_0x21e0('0xa')]);}})[_0x21e0('0xb')](function(_0x5e7638){_0x1e404c(_0x5e7638);});});}function respondWithResult(_0x2b8fbd,_0xbb6dc2){_0xbb6dc2=_0xbb6dc2||0xc8;return function(_0x57ba59){if(_0x57ba59){return _0x2b8fbd[_0x21e0('0xc')](_0xbb6dc2)[_0x21e0('0xd')](_0x57ba59);}return _0x2b8fbd[_0x21e0('0xe')](0x194);};}function handleError(_0x9d8bbe,_0x21c1a6){_0x21c1a6=_0x21c1a6||0x1f4;return function(_0x420901){logger[_0x21e0('0x9')](_0x420901[_0x21e0('0xf')]);if(_0x420901[_0x21e0('0x10')]){delete _0x420901[_0x21e0('0x10')];}_0x9d8bbe[_0x21e0('0xc')](_0x21c1a6)[_0x21e0('0x11')](_0x420901);};}function findById(_0x4ae831){return function(_0x13e0e4){if(!_[_0x21e0('0x12')](_0x4ae831)&&!_['isNil'](_0x13e0e4)&&!_[_0x21e0('0x12')](_0x13e0e4[_0x21e0('0x13')])){return _[_0x21e0('0x14')](_0x13e0e4['rows'],function(_0x2e640a){return _0x2e640a['id']==_0x4ae831;});}return null;};}exports['voiceChannels']=function(_0x5bcc8b,_0xd70f48){return respondWithRpcPromise('VoiceChannels',_0x5bcc8b[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0xd70f48,null))[_0x21e0('0xb')](handleError(_0xd70f48,null));};exports['voiceChannelMixMonitor']=function(_0x3ed209,_0x4338bd){return respondWithRpcPromise(_0x21e0('0x16'),_[_0x21e0('0x17')](_0x3ed209[_0x21e0('0x15')],_0x3ed209['params']))[_0x21e0('0x8')](respondWithResult(_0x4338bd,null))[_0x21e0('0xb')](handleError(_0x4338bd,null));};exports[_0x21e0('0x18')]=function(_0x4ae1fc,_0x3686ec){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x21e0('0x17')](_0x4ae1fc['query'],_0x4ae1fc[_0x21e0('0x19')]))[_0x21e0('0x8')](respondWithResult(_0x3686ec,null))[_0x21e0('0xb')](handleError(_0x3686ec,null));};exports[_0x21e0('0x1a')]=function(_0x2b83ef,_0x4c6e8c){return respondWithRpcPromise('VoiceQueues',_0x2b83ef[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x4c6e8c,null))[_0x21e0('0xb')](handleError(_0x4c6e8c,null));};exports['showVoiceQueues']=function(_0x211ad3,_0xe3bda2){return respondWithRpcPromise('VoiceQueues',_0x211ad3['query'])[_0x21e0('0x8')](findById(_0x211ad3[_0x21e0('0x19')]['id']))['then'](respondWithResult(_0xe3bda2,null))['catch'](handleError(_0xe3bda2,null));};exports[_0x21e0('0x1b')]=function(_0x10968a,_0xc0e0e5){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x21e0('0x17')](_0x10968a['body'],_0x10968a['params']))[_0x21e0('0x8')](respondWithResult(_0xc0e0e5,null))['catch'](handleError(_0xc0e0e5,null));};exports[_0x21e0('0x1c')]=function(_0x55a8d6,_0x147860){return respondWithRpcPromise(_0x21e0('0x1d'),_['merge'](_0x55a8d6['query'],_0x55a8d6[_0x21e0('0x19')]))[_0x21e0('0x8')](respondWithResult(_0x147860,null))[_0x21e0('0xb')](handleError(_0x147860,null));};exports[_0x21e0('0x1e')]=function(_0x19c997,_0xfa071f){return respondWithRpcPromise(_0x21e0('0x1f'),_0x19c997[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0xfa071f,null))[_0x21e0('0xb')](handleError(_0xfa071f,null));};exports[_0x21e0('0x20')]=function(_0x4b2aea,_0x2c3b8a){return respondWithRpcPromise(_0x21e0('0x21'),_['merge'](_0x4b2aea[_0x21e0('0x15')],_0x4b2aea[_0x21e0('0x19')]))['then'](respondWithResult(_0x2c3b8a,null))[_0x21e0('0xb')](handleError(_0x2c3b8a,null));};exports['voiceQueuesChannelHangup']=function(_0x5c1780,_0x52bd20){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x21e0('0x17')](_0x5c1780[_0x21e0('0x15')],_0x5c1780[_0x21e0('0x19')]))[_0x21e0('0x8')](respondWithResult(_0x52bd20,null))['catch'](handleError(_0x52bd20,null));};exports['voiceQueuesChannelRedirect']=function(_0x430e0a,_0x593d04){return respondWithRpcPromise(_0x21e0('0x22'),_['merge'](_0x430e0a[_0x21e0('0x15')],_0x430e0a[_0x21e0('0x19')]))[_0x21e0('0x8')](respondWithResult(_0x593d04,null))[_0x21e0('0xb')](handleError(_0x593d04,null));};exports[_0x21e0('0x23')]=function(_0x15f86a,_0x5f5778){return respondWithRpcPromise('Outbound',_0x15f86a[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x5f5778,null))[_0x21e0('0xb')](handleError(_0x5f5778,null));};exports[_0x21e0('0x24')]=function(_0x53c58b,_0x3d3568){return respondWithRpcPromise('OutboundChannels',_0x53c58b[_0x21e0('0x15')])['then'](respondWithResult(_0x3d3568,null))[_0x21e0('0xb')](handleError(_0x3d3568,null));};exports[_0x21e0('0x25')]=function(_0x3901fa,_0xea51f7){var _0x4624d9;return respondWithRpcPromise('Agents',_0x3901fa[_0x21e0('0x15')])['then'](function(_0x10e109){_0x4624d9=_0x10e109;return respondWithRpcPromise('Agents',_0x3901fa[_0x21e0('0x15')],routingClient);})[_0x21e0('0x8')](function(_0x5646bf){return _[_0x21e0('0x17')]({},_0x5646bf,_0x4624d9);})[_0x21e0('0x8')](respondWithResult(_0xea51f7,null))[_0x21e0('0xb')](handleError(_0xea51f7,null));};exports['agentCapacity']=function(_0x356e17,_0x32d586){if(_0x356e17['body']&&_0x356e17[_0x21e0('0x26')]['interaction']&&_0x356e17[_0x21e0('0x27')]&&_0x356e17[_0x21e0('0x27')][_0x21e0('0x10')]){for(var _0xe7ff26 in _0x356e17[_0x21e0('0x26')]['interaction']){if(_0x356e17[_0x21e0('0x26')][_0x21e0('0x28')][_0x21e0('0x29')](_0xe7ff26)){db['MemberReport'][_0x21e0('0x2a')]({'where':{'channel':_0xe7ff26,'membername':_0x356e17[_0x21e0('0x27')][_0x21e0('0x10')],'type':_0x21e0('0x2b'),'exitAt':null,'uniqueid':_0x356e17['body'][_0x21e0('0x28')][_0xe7ff26]&&_0x356e17[_0x21e0('0x26')][_0x21e0('0x28')][_0xe7ff26][_0x21e0('0x2c')]?{'$notIn':_0x356e17['body']['interaction'][_0xe7ff26]}:{'$ne':null}}})[_0x21e0('0x8')](function(_0x36f5d7){var _0x32675b=moment()['format'](_0x21e0('0x2d'));for(var _0x593c85=0x0,_0x15d607=_0x36f5d7['length'];_0x593c85<_0x15d607;_0x593c85+=0x1){_0x36f5d7[_0x593c85][_0x21e0('0x2e')]({'exitAt':_0x32675b});}});for(var _0xc00f0e=0x0;_0xc00f0e<_0x356e17[_0x21e0('0x26')][_0x21e0('0x28')][_0xe7ff26]['length'];_0xc00f0e+=0x1){db['MemberReport'][_0x21e0('0x2f')]({'where':{'channel':_0xe7ff26,'membername':_0x356e17[_0x21e0('0x27')][_0x21e0('0x10')],'type':_0x21e0('0x2b'),'uniqueid':_0x356e17['body']['interaction'][_0xe7ff26][_0xc00f0e],'exitAt':null},'defaults':{'channel':_0xe7ff26,'membername':_0x356e17[_0x21e0('0x27')][_0x21e0('0x10')],'interface':_[_0x21e0('0x12')](_0x356e17[_0x21e0('0x27')][_0x21e0('0x30')])?util[_0x21e0('0x31')](_0x21e0('0x32'),_0x356e17['user']['name']):_0x356e17['user']['interface'],'type':'INTERACTION','enterAt':moment()[_0x21e0('0x31')](_0x21e0('0x2d')),'role':_0x21e0('0x33'),'internal':_0x356e17['user'][_0x21e0('0x34')],'uniqueid':_0x356e17[_0x21e0('0x26')][_0x21e0('0x28')][_0xe7ff26][_0xc00f0e]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x356e17[_0x21e0('0x19')]['id'],'capacity':_0x356e17[_0x21e0('0x26')][_0x21e0('0x35')]},routingClient)[_0x21e0('0x8')](respondWithResult(_0x32d586,null))[_0x21e0('0xb')](handleError(_0x32d586,null));};exports[_0x21e0('0x36')]=function(_0x5a6808,_0x582a25){return respondWithRpcPromise(_0x21e0('0x37'),_0x5a6808[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x582a25,null))[_0x21e0('0xb')](handleError(_0x582a25,null));};exports[_0x21e0('0x38')]=function(_0xc3c08f,_0x4413fb){return respondWithRpcPromise(_0x21e0('0x39'),_0xc3c08f[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x4413fb,null))[_0x21e0('0xb')](handleError(_0x4413fb,null));};exports['campaigns']=function(_0xac0579,_0x12e014){return respondWithRpcPromise('Campaigns',_0xac0579[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x12e014,null))[_0x21e0('0xb')](handleError(_0x12e014,null));};exports[_0x21e0('0x3a')]=function(_0x5064f2,_0xb0f666){return respondWithRpcPromise(_0x21e0('0x3b'),_0x5064f2[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0xb0f666,null))[_0x21e0('0xb')](handleError(_0xb0f666,null));};exports[_0x21e0('0x3c')]=function(_0x21ad39,_0x1bf257){return respondWithRpcPromise(_0x21e0('0x3b'),_0x21ad39[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](findById(_0x21ad39['params']['id']))[_0x21e0('0x8')](respondWithResult(_0x1bf257,null))[_0x21e0('0xb')](handleError(_0x1bf257,null));};exports['mailQueues']=function(_0xcc04ff,_0x349c53){return respondWithRpcPromise('MailQueues',_0xcc04ff[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x349c53,null))[_0x21e0('0xb')](handleError(_0x349c53,null));};exports[_0x21e0('0x3d')]=function(_0x10525b,_0xb8f99c){return respondWithRpcPromise(_0x21e0('0x3e'),_0x10525b[_0x21e0('0x15')],routingClient)['then'](findById(_0x10525b[_0x21e0('0x19')]['id']))[_0x21e0('0x8')](respondWithResult(_0xb8f99c,null))['catch'](handleError(_0xb8f99c,null));};exports[_0x21e0('0x3f')]=function(_0x1ee7e8,_0x589839){return respondWithRpcPromise(_0x21e0('0x40'),_0x1ee7e8[_0x21e0('0x15')],mailClient)['then'](respondWithResult(_0x589839,null))[_0x21e0('0xb')](handleError(_0x589839,null));};exports['openchannelQueues']=function(_0x352773,_0x54fa71){return respondWithRpcPromise(_0x21e0('0x41'),_0x352773[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x54fa71,null))[_0x21e0('0xb')](handleError(_0x54fa71,null));};exports[_0x21e0('0x42')]=function(_0x5a2698,_0x37c1b2){return respondWithRpcPromise(_0x21e0('0x41'),_0x5a2698[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](findById(_0x5a2698[_0x21e0('0x19')]['id']))[_0x21e0('0x8')](respondWithResult(_0x37c1b2,null))[_0x21e0('0xb')](handleError(_0x37c1b2,null));};exports[_0x21e0('0x43')]=function(_0x2976ea,_0x34f111){return respondWithRpcPromise(_0x21e0('0x44'),_0x2976ea['query'],routingClient)[_0x21e0('0x8')](respondWithResult(_0x34f111,null))[_0x21e0('0xb')](handleError(_0x34f111,null));};exports[_0x21e0('0x45')]=function(_0x12539c,_0x58abc6){return respondWithRpcPromise('SmsQueues',_0x12539c[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](findById(_0x12539c[_0x21e0('0x19')]['id']))['then'](respondWithResult(_0x58abc6,null))[_0x21e0('0xb')](handleError(_0x58abc6,null));};exports[_0x21e0('0x46')]=function(_0x55a5c2,_0x26e675){return respondWithRpcPromise('WhatsappQueues',_0x55a5c2[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x26e675,null))[_0x21e0('0xb')](handleError(_0x26e675,null));};exports['showWhatsappQueues']=function(_0x222f6a,_0x17086f){return respondWithRpcPromise(_0x21e0('0x47'),_0x222f6a[_0x21e0('0x15')],routingClient)['then'](findById(_0x222f6a[_0x21e0('0x19')]['id']))[_0x21e0('0x8')](respondWithResult(_0x17086f,null))[_0x21e0('0xb')](handleError(_0x17086f,null));};exports['faxQueues']=function(_0x162994,_0x1f93e7){return respondWithRpcPromise(_0x21e0('0x48'),_0x162994[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x1f93e7,null))['catch'](handleError(_0x1f93e7,null));};exports[_0x21e0('0x49')]=function(_0x3bf3e2,_0x1a7d97){return respondWithRpcPromise(_0x21e0('0x48'),_0x3bf3e2['query'],routingClient)[_0x21e0('0x8')](findById(_0x3bf3e2['params']['id']))[_0x21e0('0x8')](respondWithResult(_0x1a7d97,null))['catch'](handleError(_0x1a7d97,null));};exports[_0x21e0('0x4a')]=function(_0x1475ae,_0x481495){return respondWithRpcPromise(_0x21e0('0x4b'),_0x1475ae[_0x21e0('0x15')])[_0x21e0('0x8')](respondWithResult(_0x481495,null))[_0x21e0('0xb')](handleError(_0x481495,null));};exports[_0x21e0('0x4c')]=function(_0x552e28,_0x1ac360){return respondWithRpcPromise(_0x21e0('0x4d'),_0x552e28[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x1ac360,null))['catch'](handleError(_0x1ac360,null));};exports[_0x21e0('0x4e')]=function(_0x50fcac,_0x529bf7){return respondWithRpcPromise(_0x21e0('0x4f'),_0x50fcac[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x529bf7,null))[_0x21e0('0xb')](handleError(_0x529bf7,null));};exports[_0x21e0('0x50')]=function(_0xf1abd2,_0x5a9737){return respondWithRpcPromise(_0x21e0('0x51'),_0xf1abd2[_0x21e0('0x15')],routingClient)['then'](respondWithResult(_0x5a9737,null))['catch'](handleError(_0x5a9737,null));};exports[_0x21e0('0x52')]=function(_0x435951,_0x2e9ec9){return respondWithRpcPromise(_0x21e0('0x51'),_0x435951[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](function(_0x5eff4a){if(_0x435951['query'][_0x21e0('0x53')]!==undefined){var _0x28fe08=_(_0x5eff4a[_0x21e0('0x13')])[_0x21e0('0x54')]([_0x435951[_0x21e0('0x15')]['type'],_0x435951['params']['id']])[_0x21e0('0x55')](_0x21e0('0x56'))[_0x21e0('0x57')]()[_0x21e0('0x58')]();return _0x5eff4a[_0x21e0('0x13')][_0x21e0('0x54')](function(_0x3f2ab9){return _0x28fe08['indexOf'](_0x3f2ab9['queue_id'])>-0x1;});}else{return _0x5eff4a['rows']['filter'](function(_0x3c73ca){return _0x3c73ca[_0x21e0('0x56')]===parseInt(_0x435951[_0x21e0('0x19')]['id']);});}})[_0x21e0('0x8')](respondWithResult(_0x2e9ec9,null))[_0x21e0('0xb')](handleError(_0x2e9ec9,null));};exports['smsQueuesWaitingInteractions']=function(_0x122fcc,_0x56ce1c){return respondWithRpcPromise(_0x21e0('0x59'),_0x122fcc[_0x21e0('0x15')],routingClient)['then'](respondWithResult(_0x56ce1c,null))[_0x21e0('0xb')](handleError(_0x56ce1c,null));};exports[_0x21e0('0x5a')]=function(_0x1bcfc6,_0x493031){return respondWithRpcPromise(_0x21e0('0x5b'),_0x1bcfc6['query'],routingClient)['then'](respondWithResult(_0x493031,null))[_0x21e0('0xb')](handleError(_0x493031,null));};exports[_0x21e0('0x5c')]=function(_0x5c6dcb,_0x4ddeba){return respondWithRpcPromise(_0x21e0('0x5d'),_0x5c6dcb[_0x21e0('0x15')],routingClient)[_0x21e0('0x8')](respondWithResult(_0x4ddeba,null))[_0x21e0('0xb')](handleError(_0x4ddeba,null));};exports[_0x21e0('0x5e')]=function(_0x2f6982){return function(_0x1c1151,_0x3936e9){var _0x13c639,_0x223a74;var _0x38533e=_[_0x21e0('0x5f')](_0x2f6982);var _0x468ddd=_0x2f6982===_0x21e0('0x60')?_0x21e0('0x61'):_0x21e0('0x62');return db[_0x38533e+'Queue']['findOne']({'raw':!![],'where':{'id':_0x1c1151['params']['id']}})[_0x21e0('0x8')](function(_0x3bfd2f){if(_[_0x21e0('0x12')](_0x3bfd2f)){throw new Error(_0x38533e+'\x20Queue\x20not\x20found');}_0x13c639=_0x3bfd2f;return db[_0x38533e+_0x21e0('0x63')]['findOne']({'where':{'id':_0x1c1151[_0x21e0('0x26')][_0x21e0('0x64')]},'include':[{'model':db[_0x38533e+'Interaction'],'as':_0x21e0('0x65')},{'model':db[_0x38533e+_0x468ddd],'as':'Account'}]});})[_0x21e0('0x8')](function(_0x557fda){if(_[_0x21e0('0x12')](_0x557fda)){throw new Error(_0x38533e+_0x21e0('0x66'));}_0x223a74=_0x557fda;return _0x557fda['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x21e0('0x8')](function(){var _0x54a4f0={'uniqueid':_0x2f6982+'.'+_0x223a74['id']+'.'+_0x223a74[_0x21e0('0x65')]['id'],'FromUserId':_0x1c1151[_0x21e0('0x27')]['id'],'type':_0x21e0('0x67')};_0x54a4f0[_0x38533e+'MessageId']=_0x223a74['id'];_0x54a4f0[_0x38533e+_0x21e0('0x68')]=_0x223a74['Interaction']['id'];_0x54a4f0[_0x21e0('0x69')+_0x38533e+_0x468ddd+'Id']=_0x223a74['Account']['id'];_0x54a4f0['To'+_0x38533e+_0x21e0('0x6a')]=_0x13c639['id'];return db[_0x38533e+_0x21e0('0x6b')][_0x21e0('0x6c')](_0x54a4f0);})[_0x21e0('0x8')](function(){return respondWithRpcPromise(_0x21e0('0x6d'),{'channel':_0x2f6982,'interaction':_0x223a74[_0x21e0('0x65')],'message':_0x223a74,'account':_0x223a74[_0x21e0('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x13c639['name']+','+(_0x223a74['Account'][_0x21e0('0x6e')]||0x12c),'interval':_0x21e0('0x6f')}]},routingClient);})[_0x21e0('0x8')](respondWithResult(_0x3936e9,null))[_0x21e0('0xb')](handleError(_0x3936e9,null));};};exports['agentNotify']=function(_0x59a4ac,_0x15fbfd){var _0x5b3346,_0x2ab809;if(_[_0x21e0('0x12')](_0x59a4ac[_0x21e0('0x26')][_0x21e0('0x70')])){throw new Error(_0x21e0('0x71'));}var _0x1a0ad9=_0x59a4ac[_0x21e0('0x26')][_0x21e0('0x70')];var _0x2bf49a=_[_0x21e0('0x5f')](_0x1a0ad9);var _0x1c6987=_0x1a0ad9===_0x21e0('0x60')?_0x21e0('0x61'):'Account';return db[_0x21e0('0x72')][_0x21e0('0x73')]({'raw':!![],'where':{'id':_0x59a4ac[_0x21e0('0x19')]['id'],'role':_0x21e0('0x33')}})[_0x21e0('0x8')](function(_0x1f6c7d){if(_[_0x21e0('0x12')](_0x1f6c7d)){throw new Error('Agent\x20not\x20found');}_0x5b3346=_0x1f6c7d;return db[_0x2bf49a+'Message'][_0x21e0('0x73')]({'where':{'id':_0x59a4ac[_0x21e0('0x26')][_0x21e0('0x64')]},'include':[{'model':db[_0x2bf49a+_0x21e0('0x65')],'as':'Interaction'},{'model':db[_0x2bf49a+_0x1c6987],'as':_0x21e0('0x62')}]});})[_0x21e0('0x8')](function(_0x2ba57c){if(_['isNil'](_0x2ba57c)){throw new Error(_0x2bf49a+_0x21e0('0x66'));}_0x2ab809=_0x2ba57c;return _0x2ba57c['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x37da0b={'uniqueid':_0x1a0ad9+'.'+_0x2ab809['id']+'.'+_0x2ab809['Interaction']['id'],'FromUserId':_0x59a4ac[_0x21e0('0x27')]['id'],'type':_0x21e0('0x33'),'ToUserId':_0x5b3346['id']};_0x37da0b[_0x2bf49a+_0x21e0('0x74')]=_0x2ab809['id'];_0x37da0b[_0x2bf49a+'InteractionId']=_0x2ab809['Interaction']['id'];_0x37da0b['From'+_0x2bf49a+_0x1c6987+'Id']=_0x2ab809[_0x21e0('0x62')]['id'];return db[_0x2bf49a+'TransferReport']['create'](_0x37da0b);})[_0x21e0('0x8')](function(){return respondWithRpcPromise(_0x21e0('0x6d'),{'channel':_0x1a0ad9,'interaction':_0x2ab809[_0x21e0('0x65')],'message':_0x2ab809,'account':_0x2ab809[_0x21e0('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x21e0('0x33'),'appdata':_0x5b3346['name']+','+(_0x2ab809[_0x21e0('0x62')]['agentTransferTimeout']||0x12c),'interval':_0x21e0('0x6f')}]},routingClient);})[_0x21e0('0x8')](respondWithResult(_0x15fbfd,null))[_0x21e0('0xb')](handleError(_0x15fbfd,null));}; \ No newline at end of file +var _0x8ada=['query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','showVoiceQueues','updateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','openchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','queue','MessageId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','messageId','update','InteractionId','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels'];(function(_0x59b4c5,_0x32dc27){var _0x45ce98=function(_0x1e0b45){while(--_0x1e0b45){_0x59b4c5['push'](_0x59b4c5['shift']());}};_0x45ce98(++_0x32dc27);}(_0x8ada,0x6b));var _0xa8ad=function(_0x35ef7a,_0x2b3df3){_0x35ef7a=_0x35ef7a-0x0;var _0x3e1c56=_0x8ada[_0x35ef7a];return _0x3e1c56;};'use strict';var BPromise=require(_0xa8ad('0x0'));var moment=require(_0xa8ad('0x1'));var _=require(_0xa8ad('0x2'));var util=require('util');var db=require(_0xa8ad('0x3'))['db'];var logger=require(_0xa8ad('0x4'))(_0xa8ad('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa8ad('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0xa8ad('0x6')][_0xa8ad('0x7')]({'port':0x232b});var routingClient=jayson[_0xa8ad('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4f6fc9,_0x4d8318,_0x52c007){return new BPromise(function(_0x1dfc8d,_0x571c33){var _0x1b11a1=_0x52c007?_0x52c007:amiClient;return _0x1b11a1[_0xa8ad('0x8')](_0x4f6fc9,_0x4d8318)[_0xa8ad('0x9')](function(_0x56cc90){if(_0x56cc90['error']){if(_0x56cc90[_0xa8ad('0xa')][_0xa8ad('0xb')]===0x1f4){return _0x571c33(_0x56cc90[_0xa8ad('0xa')][_0xa8ad('0xc')]);}return _0x1dfc8d(_0x56cc90['error'][_0xa8ad('0xc')]);}else{_0x1dfc8d(_0x56cc90[_0xa8ad('0xd')]);}})['catch'](function(_0x2cdb58){_0x571c33(_0x2cdb58);});});}function respondWithResult(_0x228464,_0x531485){_0x531485=_0x531485||0xc8;return function(_0x59638f){if(_0x59638f){return _0x228464[_0xa8ad('0xe')](_0x531485)['json'](_0x59638f);}return _0x228464[_0xa8ad('0xf')](0x194);};}function handleError(_0x3704c4,_0x422e6b){_0x422e6b=_0x422e6b||0x1f4;return function(_0x5d01cc){logger['error'](_0x5d01cc[_0xa8ad('0x10')]);if(_0x5d01cc[_0xa8ad('0x11')]){delete _0x5d01cc[_0xa8ad('0x11')];}_0x3704c4['status'](_0x422e6b)[_0xa8ad('0x12')](_0x5d01cc);};}function findById(_0x42ec81){return function(_0x88ef34){if(!_[_0xa8ad('0x13')](_0x42ec81)&&!_[_0xa8ad('0x13')](_0x88ef34)&&!_[_0xa8ad('0x13')](_0x88ef34['rows'])){return _[_0xa8ad('0x14')](_0x88ef34[_0xa8ad('0x15')],function(_0x38ad30){return _0x38ad30['id']==_0x42ec81;});}return null;};}exports[_0xa8ad('0x16')]=function(_0x5e1620,_0x998c22){return respondWithRpcPromise(_0xa8ad('0x17'),_0x5e1620[_0xa8ad('0x18')])['then'](respondWithResult(_0x998c22,null))['catch'](handleError(_0x998c22,null));};exports[_0xa8ad('0x19')]=function(_0x2ef798,_0x102902){return respondWithRpcPromise(_0xa8ad('0x1a'),_['merge'](_0x2ef798[_0xa8ad('0x18')],_0x2ef798[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x102902,null))[_0xa8ad('0x1c')](handleError(_0x102902,null));};exports[_0xa8ad('0x1d')]=function(_0x13dd43,_0x360297){return respondWithRpcPromise(_0xa8ad('0x1e'),_[_0xa8ad('0x1f')](_0x13dd43[_0xa8ad('0x18')],_0x13dd43[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x360297,null))[_0xa8ad('0x1c')](handleError(_0x360297,null));};exports[_0xa8ad('0x20')]=function(_0x2451c7,_0x2f3580){return respondWithRpcPromise('VoiceQueues',_0x2451c7[_0xa8ad('0x18')])[_0xa8ad('0x9')](respondWithResult(_0x2f3580,null))['catch'](handleError(_0x2f3580,null));};exports[_0xa8ad('0x21')]=function(_0x20dd4d,_0x4e3af2){return respondWithRpcPromise('VoiceQueues',_0x20dd4d[_0xa8ad('0x18')])[_0xa8ad('0x9')](findById(_0x20dd4d[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x4e3af2,null))[_0xa8ad('0x1c')](handleError(_0x4e3af2,null));};exports[_0xa8ad('0x22')]=function(_0x1b4550,_0x5c2d80){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xa8ad('0x1f')](_0x1b4550[_0xa8ad('0x23')],_0x1b4550[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x5c2d80,null))[_0xa8ad('0x1c')](handleError(_0x5c2d80,null));};exports[_0xa8ad('0x24')]=function(_0xff55a4,_0x416b79){return respondWithRpcPromise(_0xa8ad('0x25'),_[_0xa8ad('0x1f')](_0xff55a4[_0xa8ad('0x18')],_0xff55a4[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x416b79,null))[_0xa8ad('0x1c')](handleError(_0x416b79,null));};exports[_0xa8ad('0x26')]=function(_0xcabd5f,_0x249aee){return respondWithRpcPromise(_0xa8ad('0x27'),_0xcabd5f[_0xa8ad('0x18')])[_0xa8ad('0x9')](respondWithResult(_0x249aee,null))[_0xa8ad('0x1c')](handleError(_0x249aee,null));};exports[_0xa8ad('0x28')]=function(_0x11116a,_0x3a5f2f){return respondWithRpcPromise(_0xa8ad('0x29'),_[_0xa8ad('0x1f')](_0x11116a[_0xa8ad('0x18')],_0x11116a[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x3a5f2f,null))[_0xa8ad('0x1c')](handleError(_0x3a5f2f,null));};exports[_0xa8ad('0x2a')]=function(_0x2eb7f6,_0x564258){return respondWithRpcPromise(_0xa8ad('0x2b'),_[_0xa8ad('0x1f')](_0x2eb7f6[_0xa8ad('0x18')],_0x2eb7f6[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x564258,null))[_0xa8ad('0x1c')](handleError(_0x564258,null));};exports[_0xa8ad('0x2c')]=function(_0x3692b5,_0x2040f7){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xa8ad('0x1f')](_0x3692b5[_0xa8ad('0x18')],_0x3692b5[_0xa8ad('0x1b')]))[_0xa8ad('0x9')](respondWithResult(_0x2040f7,null))['catch'](handleError(_0x2040f7,null));};exports[_0xa8ad('0x2d')]=function(_0x457c46,_0x27e3e3){return respondWithRpcPromise(_0xa8ad('0x2e'),_0x457c46['query'])[_0xa8ad('0x9')](respondWithResult(_0x27e3e3,null))[_0xa8ad('0x1c')](handleError(_0x27e3e3,null));};exports[_0xa8ad('0x2f')]=function(_0x4ab66e,_0x23866c){return respondWithRpcPromise(_0xa8ad('0x30'),_0x4ab66e[_0xa8ad('0x18')])[_0xa8ad('0x9')](respondWithResult(_0x23866c,null))[_0xa8ad('0x1c')](handleError(_0x23866c,null));};exports[_0xa8ad('0x31')]=function(_0x47cbf4,_0x1566ad){var _0x71e32f;return respondWithRpcPromise('Agents',_0x47cbf4[_0xa8ad('0x18')])[_0xa8ad('0x9')](function(_0x5aae58){_0x71e32f=_0x5aae58;return respondWithRpcPromise('Agents',_0x47cbf4[_0xa8ad('0x18')],routingClient);})[_0xa8ad('0x9')](function(_0x1b8c25){return _[_0xa8ad('0x1f')]({},_0x1b8c25,_0x71e32f);})[_0xa8ad('0x9')](respondWithResult(_0x1566ad,null))[_0xa8ad('0x1c')](handleError(_0x1566ad,null));};exports[_0xa8ad('0x32')]=function(_0x11b5f0,_0x12af2e){if(_0x11b5f0[_0xa8ad('0x23')]&&_0x11b5f0['body']['interaction']&&_0x11b5f0[_0xa8ad('0x33')]&&_0x11b5f0[_0xa8ad('0x33')]['name']){for(var _0x1eaca5 in _0x11b5f0[_0xa8ad('0x23')][_0xa8ad('0x34')]){if(_0x11b5f0['body'][_0xa8ad('0x34')][_0xa8ad('0x35')](_0x1eaca5)){db[_0xa8ad('0x36')]['findAll']({'where':{'channel':_0x1eaca5,'membername':_0x11b5f0[_0xa8ad('0x33')]['name'],'type':_0xa8ad('0x37'),'exitAt':null,'uniqueid':_0x11b5f0[_0xa8ad('0x23')][_0xa8ad('0x34')][_0x1eaca5]&&_0x11b5f0[_0xa8ad('0x23')][_0xa8ad('0x34')][_0x1eaca5][_0xa8ad('0x38')]?{'$notIn':_0x11b5f0[_0xa8ad('0x23')]['interaction'][_0x1eaca5]}:{'$ne':null}}})['then'](function(_0x876a08){var _0x18b05e=moment()[_0xa8ad('0x39')](_0xa8ad('0x3a'));for(var _0x16aa0c=0x0,_0x805fe0=_0x876a08[_0xa8ad('0x38')];_0x16aa0c<_0x805fe0;_0x16aa0c+=0x1){_0x876a08[_0x16aa0c][_0xa8ad('0x3b')]({'exitAt':_0x18b05e});}});for(var _0x4c665d=0x0;_0x4c665d<_0x11b5f0[_0xa8ad('0x23')][_0xa8ad('0x34')][_0x1eaca5]['length'];_0x4c665d+=0x1){db[_0xa8ad('0x36')][_0xa8ad('0x3c')]({'where':{'channel':_0x1eaca5,'membername':_0x11b5f0[_0xa8ad('0x33')][_0xa8ad('0x11')],'type':_0xa8ad('0x37'),'uniqueid':_0x11b5f0[_0xa8ad('0x23')][_0xa8ad('0x34')][_0x1eaca5][_0x4c665d],'exitAt':null},'defaults':{'channel':_0x1eaca5,'membername':_0x11b5f0[_0xa8ad('0x33')][_0xa8ad('0x11')],'interface':_[_0xa8ad('0x13')](_0x11b5f0[_0xa8ad('0x33')][_0xa8ad('0x3d')])?util['format'](_0xa8ad('0x3e'),_0x11b5f0[_0xa8ad('0x33')][_0xa8ad('0x11')]):_0x11b5f0['user'][_0xa8ad('0x3d')],'type':_0xa8ad('0x37'),'enterAt':moment()[_0xa8ad('0x39')](_0xa8ad('0x3a')),'role':_0xa8ad('0x3f'),'internal':_0x11b5f0[_0xa8ad('0x33')][_0xa8ad('0x40')],'uniqueid':_0x11b5f0['body'][_0xa8ad('0x34')][_0x1eaca5][_0x4c665d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x11b5f0['params']['id'],'capacity':_0x11b5f0[_0xa8ad('0x23')]['capacity']},routingClient)[_0xa8ad('0x9')](respondWithResult(_0x12af2e,null))[_0xa8ad('0x1c')](handleError(_0x12af2e,null));};exports[_0xa8ad('0x41')]=function(_0x18d513,_0x45507d){return respondWithRpcPromise(_0xa8ad('0x42'),_0x18d513[_0xa8ad('0x18')])['then'](respondWithResult(_0x45507d,null))['catch'](handleError(_0x45507d,null));};exports[_0xa8ad('0x43')]=function(_0x277ecc,_0x25d860){return respondWithRpcPromise(_0xa8ad('0x44'),_0x277ecc['query'])[_0xa8ad('0x9')](respondWithResult(_0x25d860,null))[_0xa8ad('0x1c')](handleError(_0x25d860,null));};exports[_0xa8ad('0x45')]=function(_0x43644d,_0x418228){return respondWithRpcPromise(_0xa8ad('0x46'),_0x43644d[_0xa8ad('0x18')])[_0xa8ad('0x9')](respondWithResult(_0x418228,null))[_0xa8ad('0x1c')](handleError(_0x418228,null));};exports[_0xa8ad('0x47')]=function(_0x43a2a5,_0x57ff70){return respondWithRpcPromise('ChatQueues',_0x43a2a5[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x57ff70,null))[_0xa8ad('0x1c')](handleError(_0x57ff70,null));};exports[_0xa8ad('0x48')]=function(_0x414260,_0x31f35f){return respondWithRpcPromise(_0xa8ad('0x49'),_0x414260[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](findById(_0x414260[_0xa8ad('0x1b')]['id']))['then'](respondWithResult(_0x31f35f,null))['catch'](handleError(_0x31f35f,null));};exports[_0xa8ad('0x4a')]=function(_0x194503,_0x5d18a6){return respondWithRpcPromise('MailQueues',_0x194503[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x5d18a6,null))[_0xa8ad('0x1c')](handleError(_0x5d18a6,null));};exports['showMailQueues']=function(_0x2513dd,_0x31fedc){return respondWithRpcPromise(_0xa8ad('0x4b'),_0x2513dd[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](findById(_0x2513dd[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x31fedc,null))['catch'](handleError(_0x31fedc,null));};exports['mailAccounts']=function(_0x2bb664,_0x5566dd){return respondWithRpcPromise('MailAccounts',_0x2bb664[_0xa8ad('0x18')],mailClient)['then'](respondWithResult(_0x5566dd,null))[_0xa8ad('0x1c')](handleError(_0x5566dd,null));};exports[_0xa8ad('0x4c')]=function(_0x1b9c9c,_0x45019e){return respondWithRpcPromise('OpenchannelQueues',_0x1b9c9c[_0xa8ad('0x18')],routingClient)['then'](respondWithResult(_0x45019e,null))[_0xa8ad('0x1c')](handleError(_0x45019e,null));};exports[_0xa8ad('0x4d')]=function(_0x14d215,_0x2ee02d){return respondWithRpcPromise('OpenchannelQueues',_0x14d215['query'],routingClient)[_0xa8ad('0x9')](findById(_0x14d215[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x2ee02d,null))[_0xa8ad('0x1c')](handleError(_0x2ee02d,null));};exports['smsQueues']=function(_0x27dc7d,_0x15203b){return respondWithRpcPromise('SmsQueues',_0x27dc7d[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x15203b,null))[_0xa8ad('0x1c')](handleError(_0x15203b,null));};exports[_0xa8ad('0x4e')]=function(_0xc524a4,_0x3541e6){return respondWithRpcPromise(_0xa8ad('0x4f'),_0xc524a4[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](findById(_0xc524a4[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x3541e6,null))[_0xa8ad('0x1c')](handleError(_0x3541e6,null));};exports[_0xa8ad('0x50')]=function(_0x13f80f,_0x298827){return respondWithRpcPromise(_0xa8ad('0x51'),_0x13f80f[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x298827,null))[_0xa8ad('0x1c')](handleError(_0x298827,null));};exports[_0xa8ad('0x52')]=function(_0xdaf23c,_0x3d6d3f){return respondWithRpcPromise(_0xa8ad('0x51'),_0xdaf23c['query'],routingClient)[_0xa8ad('0x9')](findById(_0xdaf23c[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x3d6d3f,null))[_0xa8ad('0x1c')](handleError(_0x3d6d3f,null));};exports[_0xa8ad('0x53')]=function(_0x573381,_0x473138){return respondWithRpcPromise(_0xa8ad('0x54'),_0x573381['query'],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x473138,null))['catch'](handleError(_0x473138,null));};exports[_0xa8ad('0x55')]=function(_0x44c734,_0x27ed1d){return respondWithRpcPromise(_0xa8ad('0x54'),_0x44c734['query'],routingClient)[_0xa8ad('0x9')](findById(_0x44c734[_0xa8ad('0x1b')]['id']))[_0xa8ad('0x9')](respondWithResult(_0x27ed1d,null))[_0xa8ad('0x1c')](handleError(_0x27ed1d,null));};exports[_0xa8ad('0x56')]=function(_0x4f8127,_0x424f02){return respondWithRpcPromise(_0xa8ad('0x57'),_0x4f8127[_0xa8ad('0x18')])[_0xa8ad('0x9')](respondWithResult(_0x424f02,null))[_0xa8ad('0x1c')](handleError(_0x424f02,null));};exports[_0xa8ad('0x58')]=function(_0x245f86,_0x1ab594){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x245f86[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x1ab594,null))[_0xa8ad('0x1c')](handleError(_0x1ab594,null));};exports[_0xa8ad('0x59')]=function(_0x455688,_0x17a072){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x455688[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x17a072,null))[_0xa8ad('0x1c')](handleError(_0x17a072,null));};exports[_0xa8ad('0x5a')]=function(_0x2819fa,_0x28f0ab){return respondWithRpcPromise(_0xa8ad('0x5b'),_0x2819fa[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x28f0ab,null))[_0xa8ad('0x1c')](handleError(_0x28f0ab,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4b9761,_0x4d83c9){return respondWithRpcPromise(_0xa8ad('0x5b'),_0x4b9761[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](function(_0x186c98){if(_0x4b9761[_0xa8ad('0x18')][_0xa8ad('0x5c')]!==undefined){var _0x9969e1=_(_0x186c98[_0xa8ad('0x15')])[_0xa8ad('0x5d')]([_0x4b9761[_0xa8ad('0x18')]['type'],_0x4b9761[_0xa8ad('0x1b')]['id']])[_0xa8ad('0x5e')](_0xa8ad('0x5f'))[_0xa8ad('0x60')]()['value']();return _0x186c98[_0xa8ad('0x15')]['filter'](function(_0x2d6529){return _0x9969e1[_0xa8ad('0x61')](_0x2d6529[_0xa8ad('0x5f')])>-0x1;});}else{return _0x186c98['rows']['filter'](function(_0x358baf){return _0x358baf['queue_id']===parseInt(_0x4b9761['params']['id']);});}})[_0xa8ad('0x9')](respondWithResult(_0x4d83c9,null))[_0xa8ad('0x1c')](handleError(_0x4d83c9,null));};exports[_0xa8ad('0x62')]=function(_0x1ccc66,_0x24c8c9){return respondWithRpcPromise(_0xa8ad('0x63'),_0x1ccc66['query'],routingClient)['then'](respondWithResult(_0x24c8c9,null))[_0xa8ad('0x1c')](handleError(_0x24c8c9,null));};exports[_0xa8ad('0x64')]=function(_0xdfabf8,_0x43c813){return respondWithRpcPromise(_0xa8ad('0x65'),_0xdfabf8[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x43c813,null))[_0xa8ad('0x1c')](handleError(_0x43c813,null));};exports[_0xa8ad('0x66')]=function(_0x460336,_0x5d1364){return respondWithRpcPromise(_0xa8ad('0x67'),_0x460336[_0xa8ad('0x18')],routingClient)[_0xa8ad('0x9')](respondWithResult(_0x5d1364,null))[_0xa8ad('0x1c')](handleError(_0x5d1364,null));};exports[_0xa8ad('0x68')]=function(_0x9bbe79){return function(_0xcb88de,_0x1d9b8e){var _0x5e6406,_0x359ab2;var _0x439293=_[_0xa8ad('0x69')](_0x9bbe79);var _0x5ba816=_0x9bbe79===_0xa8ad('0x6a')?_0xa8ad('0x6b'):_0xa8ad('0x6c');return db[_0x439293+_0xa8ad('0x6d')][_0xa8ad('0x6e')]({'raw':!![],'where':{'id':_0xcb88de[_0xa8ad('0x1b')]['id']}})[_0xa8ad('0x9')](function(_0x170bdd){if(_['isNil'](_0x170bdd)){throw new Error(_0x439293+_0xa8ad('0x6f'));}_0x5e6406=_0x170bdd;return db[_0x439293+_0xa8ad('0x70')][_0xa8ad('0x6e')]({'where':{'id':_0xcb88de[_0xa8ad('0x23')]['messageId']},'include':[{'model':db[_0x439293+_0xa8ad('0x71')],'as':_0xa8ad('0x71')},{'model':db[_0x439293+_0x5ba816],'as':_0xa8ad('0x6c')}]});})[_0xa8ad('0x9')](function(_0x6d38a7){if(_[_0xa8ad('0x13')](_0x6d38a7)){throw new Error(_0x439293+_0xa8ad('0x72'));}_0x359ab2=_0x6d38a7;return _0x6d38a7['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x29ecc9={'uniqueid':_0x9bbe79+'.'+_0x359ab2['id']+'.'+_0x359ab2[_0xa8ad('0x71')]['id'],'FromUserId':_0xcb88de[_0xa8ad('0x33')]['id'],'type':_0xa8ad('0x73')};_0x29ecc9[_0x439293+_0xa8ad('0x74')]=_0x359ab2['id'];_0x29ecc9[_0x439293+'InteractionId']=_0x359ab2['Interaction']['id'];_0x29ecc9[_0xa8ad('0x75')+_0x439293+_0x5ba816+'Id']=_0x359ab2['Account']['id'];_0x29ecc9['To'+_0x439293+_0xa8ad('0x76')]=_0x5e6406['id'];return db[_0x439293+_0xa8ad('0x77')][_0xa8ad('0x78')](_0x29ecc9);})['then'](function(){return respondWithRpcPromise(_0xa8ad('0x79'),{'channel':_0x9bbe79,'interaction':_0x359ab2[_0xa8ad('0x71')],'message':_0x359ab2,'account':_0x359ab2[_0xa8ad('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa8ad('0x73'),'appdata':_0x5e6406['name']+','+(_0x359ab2[_0xa8ad('0x6c')][_0xa8ad('0x7a')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x1d9b8e,null))[_0xa8ad('0x1c')](handleError(_0x1d9b8e,null));};};exports[_0xa8ad('0x7b')]=function(_0x108662,_0x1b1589){var _0x15b34a,_0x3854eb;if(_[_0xa8ad('0x13')](_0x108662[_0xa8ad('0x23')][_0xa8ad('0x7c')])){throw new Error(_0xa8ad('0x7d'));}var _0x4dde9e=_0x108662[_0xa8ad('0x23')]['channel'];var _0x12ef36=_['capitalize'](_0x4dde9e);var _0x2d31a0=_0x4dde9e===_0xa8ad('0x6a')?_0xa8ad('0x6b'):_0xa8ad('0x6c');return db['User'][_0xa8ad('0x6e')]({'raw':!![],'where':{'id':_0x108662['params']['id'],'role':_0xa8ad('0x3f')}})[_0xa8ad('0x9')](function(_0x2c1a1d){if(_[_0xa8ad('0x13')](_0x2c1a1d)){throw new Error(_0xa8ad('0x7e'));}_0x15b34a=_0x2c1a1d;return db[_0x12ef36+'Message'][_0xa8ad('0x6e')]({'where':{'id':_0x108662[_0xa8ad('0x23')][_0xa8ad('0x7f')]},'include':[{'model':db[_0x12ef36+'Interaction'],'as':_0xa8ad('0x71')},{'model':db[_0x12ef36+_0x2d31a0],'as':_0xa8ad('0x6c')}]});})[_0xa8ad('0x9')](function(_0x97944){if(_[_0xa8ad('0x13')](_0x97944)){throw new Error(_0x12ef36+_0xa8ad('0x72'));}_0x3854eb=_0x97944;return _0x97944[_0xa8ad('0x80')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa8ad('0x9')](function(){var _0xdc14bf={'uniqueid':_0x4dde9e+'.'+_0x3854eb['id']+'.'+_0x3854eb[_0xa8ad('0x71')]['id'],'FromUserId':_0x108662[_0xa8ad('0x33')]['id'],'type':_0xa8ad('0x3f'),'ToUserId':_0x15b34a['id']};_0xdc14bf[_0x12ef36+_0xa8ad('0x74')]=_0x3854eb['id'];_0xdc14bf[_0x12ef36+_0xa8ad('0x81')]=_0x3854eb[_0xa8ad('0x71')]['id'];_0xdc14bf[_0xa8ad('0x75')+_0x12ef36+_0x2d31a0+'Id']=_0x3854eb[_0xa8ad('0x6c')]['id'];return db[_0x12ef36+_0xa8ad('0x77')]['create'](_0xdc14bf);})[_0xa8ad('0x9')](function(){return respondWithRpcPromise(_0xa8ad('0x79'),{'channel':_0x4dde9e,'interaction':_0x3854eb[_0xa8ad('0x71')],'message':_0x3854eb,'account':_0x3854eb[_0xa8ad('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa8ad('0x3f'),'appdata':_0x15b34a['name']+','+(_0x3854eb['Account'][_0xa8ad('0x82')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xa8ad('0x9')](respondWithResult(_0x1b1589,null))[_0xa8ad('0x1c')](handleError(_0x1b1589,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index ab5b613..0b12876 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 _0x16c2=['delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','/:id','/:id/run','run','post','update'];(function(_0x1244a1,_0x2e7359){var _0x278f3d=function(_0x1a4fd7){while(--_0x1a4fd7){_0x1244a1['push'](_0x1244a1['shift']());}};_0x278f3d(++_0x2e7359);}(_0x16c2,0x171));var _0x216c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16c2[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x216c('0x0'));var util=require('util');var path=require(_0x216c('0x1'));var timeout=require(_0x216c('0x2'));var express=require('express');var router=express[_0x216c('0x3')]();var fs_extra=require(_0x216c('0x4'));var auth=require(_0x216c('0x5'));var interaction=require(_0x216c('0x6'));var config=require('../../config/environment');var controller=require(_0x216c('0x7'));router[_0x216c('0x8')]('/',auth[_0x216c('0x9')](),controller['index']);router[_0x216c('0x8')](_0x216c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x216c('0x8')](_0x216c('0xb'),auth[_0x216c('0x9')](),controller[_0x216c('0xc')]);router[_0x216c('0xd')]('/',auth[_0x216c('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x216c('0xe')]);router[_0x216c('0xf')](_0x216c('0xa'),auth[_0x216c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xced3=['run','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run'];(function(_0x470457,_0x38401d){var _0xc6b8de=function(_0x2a2f5b){while(--_0x2a2f5b){_0x470457['push'](_0x470457['shift']());}};_0xc6b8de(++_0x38401d);}(_0xced3,0x1bf));var _0x3ced=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xced3[_0x1477ef];return _0x164acd;};'use strict';var multer=require(_0x3ced('0x0'));var util=require(_0x3ced('0x1'));var path=require(_0x3ced('0x2'));var timeout=require('connect-timeout');var express=require(_0x3ced('0x3'));var router=express[_0x3ced('0x4')]();var fs_extra=require(_0x3ced('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3ced('0x6'));var config=require(_0x3ced('0x7'));var controller=require(_0x3ced('0x8'));router[_0x3ced('0x9')]('/',auth['isAuthenticated'](),controller[_0x3ced('0xa')]);router[_0x3ced('0x9')](_0x3ced('0xb'),auth[_0x3ced('0xc')](),controller[_0x3ced('0xd')]);router[_0x3ced('0x9')](_0x3ced('0xe'),auth[_0x3ced('0xc')](),controller[_0x3ced('0xf')]);router[_0x3ced('0x10')]('/',auth[_0x3ced('0xc')](),controller[_0x3ced('0x11')]);router[_0x3ced('0x12')](_0x3ced('0xb'),auth[_0x3ced('0xc')](),controller[_0x3ced('0x13')]);router[_0x3ced('0x14')](_0x3ced('0xb'),auth[_0x3ced('0xc')](),controller[_0x3ced('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index d9270eb..39183c3 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 _0xa8e8=['xlsx','default','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','days','csv','pdf'];(function(_0x8fbc60,_0x2b1dd5){var _0x44e6dd=function(_0x2dd901){while(--_0x2dd901){_0x8fbc60['push'](_0x8fbc60['shift']());}};_0x44e6dd(++_0x2b1dd5);}(_0xa8e8,0x101));var _0x8a8e=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xa8e8[_0x30cd7e];return _0x462a02;};'use strict';var Sequelize=require(_0x8a8e('0x0'));module[_0x8a8e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8a8e('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8a8e('0x3')},'startAt':{'type':Sequelize[_0x8a8e('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x8a8e('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8a8e('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8a8e('0x6')](_0x8a8e('0x7'),_0x8a8e('0x8'),_0x8a8e('0x9'),_0x8a8e('0xa'),'days',_0x8a8e('0xb'),_0x8a8e('0xc')),'allowNull':![],'defaultValue':_0x8a8e('0xd')},'output':{'type':Sequelize[_0x8a8e('0x6')](_0x8a8e('0xe'),_0x8a8e('0xf'),_0x8a8e('0x10')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM']('custom',_0x8a8e('0x11')),'allowNull':![],'defaultValue':_0x8a8e('0x12')},'sendMail':{'type':Sequelize[_0x8a8e('0x13')],'defaultValue':![]},'email':{'type':Sequelize[_0x8a8e('0x2')]},'cc':{'type':Sequelize[_0x8a8e('0x14')]},'bcc':{'type':Sequelize[_0x8a8e('0x14')]},'sendIfEmpty':{'type':Sequelize[_0x8a8e('0x13')],'defaultValue':!![]}}; \ No newline at end of file +var _0x63ca=['custom','default','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','days','hours','csv','xlsx'];(function(_0x43a9e4,_0x4645f5){var _0x3f5be5=function(_0x59af9f){while(--_0x59af9f){_0x43a9e4['push'](_0x43a9e4['shift']());}};_0x3f5be5(++_0x4645f5);}(_0x63ca,0x1c4));var _0xa63c=function(_0x1e1ca7,_0x27e6c1){_0x1e1ca7=_0x1e1ca7-0x0;var _0x52b594=_0x63ca[_0x1e1ca7];return _0x52b594;};'use strict';var Sequelize=require(_0xa63c('0x0'));module[_0xa63c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa63c('0x2')]},'active':{'type':Sequelize[_0xa63c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa63c('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xa63c('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa63c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa63c('0x6')](_0xa63c('0x7'),_0xa63c('0x8'),'months','weeks',_0xa63c('0x9'),_0xa63c('0xa'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xa63c('0x6')](_0xa63c('0xb'),'pdf',_0xa63c('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xa63c('0xd'),_0xa63c('0xe')),'allowNull':![],'defaultValue':_0xa63c('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xa63c('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xa63c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index b7c6ec1..38db1a3 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 _0xfbba=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Scheduler','UserProfileSection','find','UserProfileResource','run','../../config/schedule','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5e54e4,_0x1e9219){var _0x8a9935=function(_0x49206e){while(--_0x49206e){_0x5e54e4['push'](_0x5e54e4['shift']());}};_0x8a9935(++_0x1e9219);}(_0xfbba,0x191));var _0xafbb=function(_0x4cc0ab,_0x2c62ae){_0x4cc0ab=_0x4cc0ab-0x0;var _0x3eba37=_0xfbba[_0x4cc0ab];return _0x3eba37;};'use strict';var emlformat=require(_0xafbb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xafbb('0x1'));var rp=require(_0xafbb('0x2'));var moment=require('moment');var BPromise=require(_0xafbb('0x3'));var Mustache=require(_0xafbb('0x4'));var util=require(_0xafbb('0x5'));var path=require(_0xafbb('0x6'));var sox=require(_0xafbb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xafbb('0x8'));var _=require(_0xafbb('0x9'));var squel=require(_0xafbb('0xa'));var crypto=require(_0xafbb('0xb'));var jsforce=require(_0xafbb('0xc'));var deskjs=require(_0xafbb('0xd'));var toCsv=require(_0xafbb('0xe'));var querystring=require(_0xafbb('0xf'));var Papa=require(_0xafbb('0x10'));var Redis=require(_0xafbb('0x11'));var authService=require(_0xafbb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xafbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xafbb('0x14'));var utils=require(_0xafbb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xafbb('0x16'));var db=require(_0xafbb('0x17'))['db'];function respondWithStatusCode(_0x2937d1,_0x689da7){_0x689da7=_0x689da7||0xcc;return function(_0x333d8d){if(_0x333d8d){return _0x2937d1[_0xafbb('0x18')](_0x689da7);}return _0x2937d1[_0xafbb('0x19')](_0x689da7)[_0xafbb('0x1a')]();};}function respondWithResult(_0x257d51,_0x3c2934){_0x3c2934=_0x3c2934||0xc8;return function(_0x4a0b23){if(_0x4a0b23){return _0x257d51[_0xafbb('0x19')](_0x3c2934)[_0xafbb('0x1b')](_0x4a0b23);}};}function respondWithFilteredResult(_0x3da567,_0xd6fc1b){return function(_0x4283de){if(_0x4283de){var _0x466ec6=typeof _0xd6fc1b[_0xafbb('0x1c')]==='undefined'&&typeof _0xd6fc1b[_0xafbb('0x1d')]===_0xafbb('0x1e');var _0x1983e2=_0x4283de[_0xafbb('0x1f')];var _0x460256=_0x466ec6?0x0:_0xd6fc1b[_0xafbb('0x1c')];var _0x3b5d88=_0x466ec6?_0x4283de['count']:_0xd6fc1b['offset']+_0xd6fc1b['limit'];var _0x5d0634;if(_0x3b5d88>=_0x1983e2){_0x3b5d88=_0x1983e2;_0x5d0634=0xc8;}else{_0x5d0634=0xce;}_0x3da567[_0xafbb('0x19')](_0x5d0634);return _0x3da567[_0xafbb('0x20')](_0xafbb('0x21'),_0x460256+'-'+_0x3b5d88+'/'+_0x1983e2)[_0xafbb('0x1b')](_0x4283de);}return null;};}function patchUpdates(_0x502136){return function(_0xb03cdb){try{jsonpatch['apply'](_0xb03cdb,_0x502136,!![]);}catch(_0x37d0a7){return BPromise[_0xafbb('0x22')](_0x37d0a7);}return _0xb03cdb[_0xafbb('0x23')]();};}function saveUpdates(_0x155267,_0x8b5bfd){return function(_0x58a0ec){if(_0x58a0ec){return _0x58a0ec[_0xafbb('0x24')](_0x155267)[_0xafbb('0x25')](function(_0x479e1c){return _0x479e1c;});}return null;};}function removeEntity(_0x4ffa5b,_0x2211e7){return function(_0x2b4ed6){if(_0x2b4ed6){return _0x2b4ed6[_0xafbb('0x26')]()[_0xafbb('0x25')](function(){var _0x246dd9=_0x2b4ed6['get']({'plain':!![]});var _0xe5a8a0='Scheduler';return db['UserProfileResource'][_0xafbb('0x26')]({'where':{'type':_0xe5a8a0,'resourceId':_0x246dd9['id']}})['then'](function(){return _0x2b4ed6;});})[_0xafbb('0x25')](function(){_0x4ffa5b[_0xafbb('0x19')](0xcc)[_0xafbb('0x1a')]();});}};}function handleEntityNotFound(_0x134ae7,_0x196e9f){return function(_0x1f68bf){if(!_0x1f68bf){_0x134ae7[_0xafbb('0x18')](0x194);}return _0x1f68bf;};}function handleError(_0x38e747,_0x43559b){_0x43559b=_0x43559b||0x1f4;return function(_0x47c012){logger[_0xafbb('0x27')](_0x47c012[_0xafbb('0x28')]);if(_0x47c012['name']){delete _0x47c012[_0xafbb('0x29')];}_0x38e747[_0xafbb('0x19')](_0x43559b)['send'](_0x47c012);};}exports[_0xafbb('0x2a')]=function(_0x22eae6,_0x2f2a01){var _0x2aea3f={},_0x1c887c={},_0x8d730c={'count':0x0,'rows':[]};var _0x326501=_[_0xafbb('0x2b')](db[_0xafbb('0x2c')][_0xafbb('0x2d')],function(_0x5894a0){return{'name':_0x5894a0[_0xafbb('0x2e')],'type':_0x5894a0[_0xafbb('0x2f')][_0xafbb('0x30')]};});_0x1c887c[_0xafbb('0x31')]=_['map'](_0x326501,'name');_0x1c887c[_0xafbb('0x32')]=_[_0xafbb('0x33')](_0x22eae6[_0xafbb('0x32')]);_0x1c887c[_0xafbb('0x34')]=_[_0xafbb('0x35')](_0x1c887c[_0xafbb('0x31')],_0x1c887c[_0xafbb('0x32')]);_0x2aea3f[_0xafbb('0x36')]=_[_0xafbb('0x35')](_0x1c887c['model'],qs[_0xafbb('0x37')](_0x22eae6['query']['fields']));_0x2aea3f[_0xafbb('0x36')]=_0x2aea3f[_0xafbb('0x36')]['length']?_0x2aea3f[_0xafbb('0x36')]:_0x1c887c[_0xafbb('0x31')];if(!_0x22eae6[_0xafbb('0x32')][_0xafbb('0x38')](_0xafbb('0x39'))){_0x2aea3f[_0xafbb('0x1d')]=qs['limit'](_0x22eae6[_0xafbb('0x32')][_0xafbb('0x1d')]);_0x2aea3f[_0xafbb('0x1c')]=qs['offset'](_0x22eae6[_0xafbb('0x32')]['offset']);}_0x2aea3f['order']=qs[_0xafbb('0x3a')](_0x22eae6[_0xafbb('0x32')][_0xafbb('0x3a')]);_0x2aea3f[_0xafbb('0x3b')]=qs[_0xafbb('0x34')](_['pick'](_0x22eae6[_0xafbb('0x32')],_0x1c887c[_0xafbb('0x34')]),_0x326501);if(_0x22eae6['query'][_0xafbb('0x3c')]){_0x2aea3f[_0xafbb('0x3b')]=_[_0xafbb('0x3d')](_0x2aea3f['where'],{'$or':_[_0xafbb('0x2b')](_0x326501,function(_0x33bfbd){if(_0x33bfbd[_0xafbb('0x2f')]!==_0xafbb('0x3e')){var _0x3859f8={};_0x3859f8[_0x33bfbd[_0xafbb('0x29')]]={'$like':'%'+_0x22eae6['query'][_0xafbb('0x3c')]+'%'};return _0x3859f8;}})});}_0x2aea3f=_[_0xafbb('0x3d')]({},_0x2aea3f,_0x22eae6[_0xafbb('0x3f')]);var _0x479c24={'where':_0x2aea3f['where']};return db[_0xafbb('0x2c')][_0xafbb('0x1f')](_0x479c24)['then'](function(_0x15dd24){_0x8d730c[_0xafbb('0x1f')]=_0x15dd24;if(_0x22eae6[_0xafbb('0x32')][_0xafbb('0x40')]){_0x2aea3f[_0xafbb('0x41')]=[{'all':!![]}];}return db[_0xafbb('0x2c')]['findAll'](_0x2aea3f);})['then'](function(_0x27c3aa){_0x8d730c[_0xafbb('0x42')]=_0x27c3aa;return _0x8d730c;})[_0xafbb('0x25')](respondWithFilteredResult(_0x2f2a01,_0x2aea3f))[_0xafbb('0x43')](handleError(_0x2f2a01,null));};exports[_0xafbb('0x44')]=function(_0x4221d3,_0x48acc1){var _0x57f58f={'raw':![],'where':{'id':_0x4221d3[_0xafbb('0x45')]['id']}},_0x5b9ee6={};_0x5b9ee6['model']=_[_0xafbb('0x33')](db[_0xafbb('0x2c')]['rawAttributes']);_0x5b9ee6[_0xafbb('0x32')]=_['keys'](_0x4221d3['query']);_0x5b9ee6[_0xafbb('0x34')]=_[_0xafbb('0x35')](_0x5b9ee6[_0xafbb('0x31')],_0x5b9ee6[_0xafbb('0x32')]);_0x57f58f[_0xafbb('0x36')]=_[_0xafbb('0x35')](_0x5b9ee6[_0xafbb('0x31')],qs[_0xafbb('0x37')](_0x4221d3[_0xafbb('0x32')][_0xafbb('0x37')]));_0x57f58f[_0xafbb('0x36')]=_0x57f58f[_0xafbb('0x36')][_0xafbb('0x46')]?_0x57f58f['attributes']:_0x5b9ee6[_0xafbb('0x31')];if(_0x4221d3[_0xafbb('0x32')][_0xafbb('0x40')]){_0x57f58f[_0xafbb('0x41')]=[{'all':!![]}];}_0x57f58f=_[_0xafbb('0x3d')]({},_0x57f58f,_0x4221d3[_0xafbb('0x3f')]);return db['Schedule']['find'](_0x57f58f)[_0xafbb('0x25')](handleEntityNotFound(_0x48acc1,null))['then'](respondWithResult(_0x48acc1,null))[_0xafbb('0x43')](handleError(_0x48acc1,null));};exports[_0xafbb('0x47')]=function(_0x1e098f,_0x357c50){return db[_0xafbb('0x2c')]['create'](_0x1e098f[_0xafbb('0x48')],{})[_0xafbb('0x25')](function(_0x557745){var _0xd1cc9=_0x1e098f[_0xafbb('0x49')]['get']({'plain':!![]});if(!_0xd1cc9)throw new Error(_0xafbb('0x4a'));if(_0xd1cc9[_0xafbb('0x4b')]===_0xafbb('0x49')){var _0x4a58e5=_0x557745[_0xafbb('0x4c')]({'plain':!![]});var _0x5eadc8=_0xafbb('0x4d');return db[_0xafbb('0x4e')][_0xafbb('0x4f')]({'where':{'name':_0x5eadc8,'userProfileId':_0xd1cc9['userProfileId']},'raw':!![]})[_0xafbb('0x25')](function(_0x1abc56){if(_0x1abc56&&_0x1abc56['autoAssociation']===0x0){return db[_0xafbb('0x50')]['create']({'name':_0x4a58e5[_0xafbb('0x29')],'resourceId':_0x4a58e5['id'],'type':_0x1abc56['name'],'sectionId':_0x1abc56['id']},{})[_0xafbb('0x25')](function(){return _0x557745;});}else{return _0x557745;}})[_0xafbb('0x43')](function(_0x1640fe){logger[_0xafbb('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1640fe);throw _0x1640fe;});}return _0x557745;})['then'](respondWithResult(_0x357c50,0xc9))[_0xafbb('0x43')](handleError(_0x357c50,null));};exports[_0xafbb('0x24')]=function(_0x51e409,_0x3a8004){if(_0x51e409['body']['id']){delete _0x51e409[_0xafbb('0x48')]['id'];}return db[_0xafbb('0x2c')][_0xafbb('0x4f')]({'where':{'id':_0x51e409[_0xafbb('0x45')]['id']}})[_0xafbb('0x25')](handleEntityNotFound(_0x3a8004,null))[_0xafbb('0x25')](saveUpdates(_0x51e409[_0xafbb('0x48')],null))[_0xafbb('0x25')](respondWithResult(_0x3a8004,null))[_0xafbb('0x43')](handleError(_0x3a8004,null));};exports[_0xafbb('0x26')]=function(_0x648d13,_0x4c5dad){return db[_0xafbb('0x2c')][_0xafbb('0x4f')]({'where':{'id':_0x648d13[_0xafbb('0x45')]['id']}})[_0xafbb('0x25')](handleEntityNotFound(_0x4c5dad,null))['then'](removeEntity(_0x4c5dad,null))[_0xafbb('0x43')](handleError(_0x4c5dad,null));};exports[_0xafbb('0x51')]=function(_0x315218,_0x3b5b36,_0x36467f){var _0x237e70=require(_0xafbb('0x52'));return db['Schedule'][_0xafbb('0x4f')]({'where':{'id':_0x315218[_0xafbb('0x45')]['id']},'raw':!![]})[_0xafbb('0x25')](handleEntityNotFound(_0x3b5b36,null))[_0xafbb('0x25')](function(){_0x237e70[_0xafbb('0x51')](_0x315218[_0xafbb('0x45')]['id']);})['then'](respondWithStatusCode(_0x3b5b36,null))[_0xafbb('0x43')](handleError(_0x3b5b36,null));}; \ No newline at end of file +var _0x8f95=['VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','Scheduler','destroy','end','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x3dfc95,_0x508aaf){var _0x248517=function(_0x26e492){while(--_0x26e492){_0x3dfc95['push'](_0x3dfc95['shift']());}};_0x248517(++_0x508aaf);}(_0x8f95,0x181));var _0x58f9=function(_0x42d232,_0x1dafda){_0x42d232=_0x42d232-0x0;var _0x56b141=_0x8f95[_0x42d232];return _0x56b141;};'use strict';var emlformat=require(_0x58f9('0x0'));var rimraf=require(_0x58f9('0x1'));var zipdir=require(_0x58f9('0x2'));var jsonpatch=require(_0x58f9('0x3'));var rp=require('request-promise');var moment=require(_0x58f9('0x4'));var BPromise=require(_0x58f9('0x5'));var Mustache=require(_0x58f9('0x6'));var util=require(_0x58f9('0x7'));var path=require(_0x58f9('0x8'));var sox=require(_0x58f9('0x9'));var csv=require(_0x58f9('0xa'));var ejs=require(_0x58f9('0xb'));var fs=require('fs');var fs_extra=require(_0x58f9('0xc'));var _=require(_0x58f9('0xd'));var squel=require(_0x58f9('0xe'));var crypto=require(_0x58f9('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x58f9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x58f9('0x11'));var Papa=require(_0x58f9('0x12'));var Redis=require(_0x58f9('0x13'));var authService=require(_0x58f9('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x58f9('0x15'));var hardwareService=require(_0x58f9('0x16'));var logger=require(_0x58f9('0x17'))(_0x58f9('0x18'));var utils=require(_0x58f9('0x19'));var config=require(_0x58f9('0x1a'));var licenseUtil=require(_0x58f9('0x1b'));var db=require(_0x58f9('0x1c'))['db'];function respondWithStatusCode(_0x544940,_0x4a9e1e){_0x4a9e1e=_0x4a9e1e||0xcc;return function(_0x3ae034){if(_0x3ae034){return _0x544940[_0x58f9('0x1d')](_0x4a9e1e);}return _0x544940[_0x58f9('0x1e')](_0x4a9e1e)['end']();};}function respondWithResult(_0x48cc1e,_0x1b5463){_0x1b5463=_0x1b5463||0xc8;return function(_0xd18605){if(_0xd18605){return _0x48cc1e[_0x58f9('0x1e')](_0x1b5463)[_0x58f9('0x1f')](_0xd18605);}};}function respondWithFilteredResult(_0x27437e,_0x299d68){return function(_0x2cc537){if(_0x2cc537){var _0x4ed60c=typeof _0x299d68['offset']===_0x58f9('0x20')&&typeof _0x299d68[_0x58f9('0x21')]===_0x58f9('0x20');var _0x203515=_0x2cc537[_0x58f9('0x22')];var _0x5b4c80=_0x4ed60c?0x0:_0x299d68[_0x58f9('0x23')];var _0x1a809e=_0x4ed60c?_0x2cc537[_0x58f9('0x22')]:_0x299d68[_0x58f9('0x23')]+_0x299d68[_0x58f9('0x21')];var _0x176fcb;if(_0x1a809e>=_0x203515){_0x1a809e=_0x203515;_0x176fcb=0xc8;}else{_0x176fcb=0xce;}_0x27437e[_0x58f9('0x1e')](_0x176fcb);return _0x27437e['set'](_0x58f9('0x24'),_0x5b4c80+'-'+_0x1a809e+'/'+_0x203515)['json'](_0x2cc537);}return null;};}function patchUpdates(_0xabaa1){return function(_0x30147a){try{jsonpatch[_0x58f9('0x25')](_0x30147a,_0xabaa1,!![]);}catch(_0x550681){return BPromise[_0x58f9('0x26')](_0x550681);}return _0x30147a['save']();};}function saveUpdates(_0x290e97,_0x4326df){return function(_0x19a59e){if(_0x19a59e){return _0x19a59e[_0x58f9('0x27')](_0x290e97)[_0x58f9('0x28')](function(_0x575b96){return _0x575b96;});}return null;};}function removeEntity(_0x21087e,_0x451121){return function(_0x2df0b3){if(_0x2df0b3){return _0x2df0b3['destroy']()[_0x58f9('0x28')](function(){var _0x194ba8=_0x2df0b3['get']({'plain':!![]});var _0x5d9b51=_0x58f9('0x29');return db['UserProfileResource'][_0x58f9('0x2a')]({'where':{'type':_0x5d9b51,'resourceId':_0x194ba8['id']}})[_0x58f9('0x28')](function(){return _0x2df0b3;});})['then'](function(){_0x21087e[_0x58f9('0x1e')](0xcc)[_0x58f9('0x2b')]();});}};}function handleEntityNotFound(_0x18f34b,_0x5af19c){return function(_0x35c14c){if(!_0x35c14c){_0x18f34b['sendStatus'](0x194);}return _0x35c14c;};}function handleError(_0x5e3226,_0x46f023){_0x46f023=_0x46f023||0x1f4;return function(_0x3ad4bf){logger[_0x58f9('0x2c')](_0x3ad4bf[_0x58f9('0x2d')]);if(_0x3ad4bf[_0x58f9('0x2e')]){delete _0x3ad4bf[_0x58f9('0x2e')];}_0x5e3226['status'](_0x46f023)[_0x58f9('0x2f')](_0x3ad4bf);};}exports[_0x58f9('0x30')]=function(_0x34a3dd,_0x5b30eb){var _0xf6259f={},_0x2c90e7={},_0x5ebe01={'count':0x0,'rows':[]};var _0x3e9f48=_[_0x58f9('0x31')](db[_0x58f9('0x32')][_0x58f9('0x33')],function(_0x2b3956){return{'name':_0x2b3956[_0x58f9('0x34')],'type':_0x2b3956[_0x58f9('0x35')][_0x58f9('0x36')]};});_0x2c90e7[_0x58f9('0x37')]=_['map'](_0x3e9f48,'name');_0x2c90e7['query']=_[_0x58f9('0x38')](_0x34a3dd[_0x58f9('0x39')]);_0x2c90e7[_0x58f9('0x3a')]=_[_0x58f9('0x3b')](_0x2c90e7['model'],_0x2c90e7['query']);_0xf6259f['attributes']=_[_0x58f9('0x3b')](_0x2c90e7[_0x58f9('0x37')],qs[_0x58f9('0x3c')](_0x34a3dd[_0x58f9('0x39')][_0x58f9('0x3c')]));_0xf6259f[_0x58f9('0x3d')]=_0xf6259f[_0x58f9('0x3d')][_0x58f9('0x3e')]?_0xf6259f['attributes']:_0x2c90e7[_0x58f9('0x37')];if(!_0x34a3dd[_0x58f9('0x39')][_0x58f9('0x3f')](_0x58f9('0x40'))){_0xf6259f[_0x58f9('0x21')]=qs['limit'](_0x34a3dd[_0x58f9('0x39')][_0x58f9('0x21')]);_0xf6259f[_0x58f9('0x23')]=qs[_0x58f9('0x23')](_0x34a3dd[_0x58f9('0x39')][_0x58f9('0x23')]);}_0xf6259f['order']=qs[_0x58f9('0x41')](_0x34a3dd['query'][_0x58f9('0x41')]);_0xf6259f[_0x58f9('0x42')]=qs['filters'](_[_0x58f9('0x43')](_0x34a3dd[_0x58f9('0x39')],_0x2c90e7[_0x58f9('0x3a')]),_0x3e9f48);if(_0x34a3dd['query'][_0x58f9('0x44')]){_0xf6259f['where']=_[_0x58f9('0x45')](_0xf6259f[_0x58f9('0x42')],{'$or':_['map'](_0x3e9f48,function(_0x7d2f12){if(_0x7d2f12[_0x58f9('0x35')]!==_0x58f9('0x46')){var _0x5370d6={};_0x5370d6[_0x7d2f12[_0x58f9('0x2e')]]={'$like':'%'+_0x34a3dd['query']['filter']+'%'};return _0x5370d6;}})});}_0xf6259f=_['merge']({},_0xf6259f,_0x34a3dd[_0x58f9('0x47')]);var _0x470ee5={'where':_0xf6259f['where']};return db['Schedule']['count'](_0x470ee5)[_0x58f9('0x28')](function(_0x2aca73){_0x5ebe01[_0x58f9('0x22')]=_0x2aca73;if(_0x34a3dd['query'][_0x58f9('0x48')]){_0xf6259f[_0x58f9('0x49')]=[{'all':!![]}];}return db[_0x58f9('0x32')]['findAll'](_0xf6259f);})['then'](function(_0x372d6f){_0x5ebe01[_0x58f9('0x4a')]=_0x372d6f;return _0x5ebe01;})[_0x58f9('0x28')](respondWithFilteredResult(_0x5b30eb,_0xf6259f))[_0x58f9('0x4b')](handleError(_0x5b30eb,null));};exports[_0x58f9('0x4c')]=function(_0x135d3b,_0x279392){var _0x43eb08={'raw':![],'where':{'id':_0x135d3b[_0x58f9('0x4d')]['id']}},_0x2d8ffb={};_0x2d8ffb[_0x58f9('0x37')]=_[_0x58f9('0x38')](db[_0x58f9('0x32')]['rawAttributes']);_0x2d8ffb['query']=_['keys'](_0x135d3b[_0x58f9('0x39')]);_0x2d8ffb[_0x58f9('0x3a')]=_[_0x58f9('0x3b')](_0x2d8ffb['model'],_0x2d8ffb['query']);_0x43eb08[_0x58f9('0x3d')]=_['intersection'](_0x2d8ffb[_0x58f9('0x37')],qs['fields'](_0x135d3b['query'][_0x58f9('0x3c')]));_0x43eb08['attributes']=_0x43eb08[_0x58f9('0x3d')][_0x58f9('0x3e')]?_0x43eb08[_0x58f9('0x3d')]:_0x2d8ffb[_0x58f9('0x37')];if(_0x135d3b[_0x58f9('0x39')]['includeAll']){_0x43eb08[_0x58f9('0x49')]=[{'all':!![]}];}_0x43eb08=_[_0x58f9('0x45')]({},_0x43eb08,_0x135d3b['options']);return db[_0x58f9('0x32')][_0x58f9('0x4e')](_0x43eb08)[_0x58f9('0x28')](handleEntityNotFound(_0x279392,null))[_0x58f9('0x28')](respondWithResult(_0x279392,null))['catch'](handleError(_0x279392,null));};exports[_0x58f9('0x4f')]=function(_0x5e18a2,_0x544606){return db[_0x58f9('0x32')][_0x58f9('0x4f')](_0x5e18a2['body'],{})['then'](function(_0x4daaff){var _0x476b3d=_0x5e18a2[_0x58f9('0x50')]['get']({'plain':!![]});if(!_0x476b3d)throw new Error(_0x58f9('0x51'));if(_0x476b3d['role']===_0x58f9('0x50')){var _0x178fec=_0x4daaff[_0x58f9('0x52')]({'plain':!![]});var _0x41f2da=_0x58f9('0x29');return db[_0x58f9('0x53')][_0x58f9('0x4e')]({'where':{'name':_0x41f2da,'userProfileId':_0x476b3d[_0x58f9('0x54')]},'raw':!![]})['then'](function(_0x20a7c0){if(_0x20a7c0&&_0x20a7c0[_0x58f9('0x55')]===0x0){return db[_0x58f9('0x56')][_0x58f9('0x4f')]({'name':_0x178fec[_0x58f9('0x2e')],'resourceId':_0x178fec['id'],'type':_0x20a7c0[_0x58f9('0x2e')],'sectionId':_0x20a7c0['id']},{})[_0x58f9('0x28')](function(){return _0x4daaff;});}else{return _0x4daaff;}})[_0x58f9('0x4b')](function(_0x186da4){logger[_0x58f9('0x2c')](_0x58f9('0x57'),_0x186da4);throw _0x186da4;});}return _0x4daaff;})[_0x58f9('0x28')](respondWithResult(_0x544606,0xc9))['catch'](handleError(_0x544606,null));};exports['update']=function(_0x3ae37a,_0x1ad56f){if(_0x3ae37a[_0x58f9('0x58')]['id']){delete _0x3ae37a[_0x58f9('0x58')]['id'];}return db['Schedule']['find']({'where':{'id':_0x3ae37a[_0x58f9('0x4d')]['id']}})[_0x58f9('0x28')](handleEntityNotFound(_0x1ad56f,null))[_0x58f9('0x28')](saveUpdates(_0x3ae37a[_0x58f9('0x58')],null))[_0x58f9('0x28')](respondWithResult(_0x1ad56f,null))[_0x58f9('0x4b')](handleError(_0x1ad56f,null));};exports['destroy']=function(_0x100f21,_0x1741e5){return db['Schedule'][_0x58f9('0x4e')]({'where':{'id':_0x100f21[_0x58f9('0x4d')]['id']}})[_0x58f9('0x28')](handleEntityNotFound(_0x1741e5,null))[_0x58f9('0x28')](removeEntity(_0x1741e5,null))[_0x58f9('0x4b')](handleError(_0x1741e5,null));};exports[_0x58f9('0x59')]=function(_0x4d8d16,_0x381e35,_0x5a7979){var _0x3e820c=require(_0x58f9('0x5a'));return db[_0x58f9('0x32')][_0x58f9('0x4e')]({'where':{'id':_0x4d8d16['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x381e35,null))[_0x58f9('0x28')](function(){_0x3e820c[_0x58f9('0x59')](_0x4d8d16[_0x58f9('0x4d')]['id']);})[_0x58f9('0x28')](respondWithStatusCode(_0x381e35,null))['catch'](handleError(_0x381e35,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 109611b..b551609 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 _0x4518=['path','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','api','moment','bluebird'];(function(_0x17a7a9,_0x35d809){var _0x4280ab=function(_0x4bdf58){while(--_0x4bdf58){_0x17a7a9['push'](_0x17a7a9['shift']());}};_0x4280ab(++_0x35d809);}(_0x4518,0xd7));var _0x8451=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x4518[_0x5cbace];return _0x6de5b8;};'use strict';var _=require(_0x8451('0x0'));var util=require(_0x8451('0x1'));var logger=require('../../config/logger')(_0x8451('0x2'));var moment=require(_0x8451('0x3'));var BPromise=require(_0x8451('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8451('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8451('0x6'));module[_0x8451('0x7')]=function(_0x1185bf,_0xd112cd){return _0x1185bf[_0x8451('0x8')](_0x8451('0x9'),attributes,{'tableName':_0x8451('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda55=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','lodash'];(function(_0x3d9a12,_0x1ae4ec){var _0x426c70=function(_0x84a7bf){while(--_0x84a7bf){_0x3d9a12['push'](_0x3d9a12['shift']());}};_0x426c70(++_0x1ae4ec);}(_0xda55,0x11d));var _0x5da5=function(_0x4965d1,_0xb546d4){_0x4965d1=_0x4965d1-0x0;var _0x59e849=_0xda55[_0x4965d1];return _0x59e849;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require(_0x5da5('0x2'))(_0x5da5('0x3'));var moment=require(_0x5da5('0x4'));var BPromise=require(_0x5da5('0x5'));var rp=require(_0x5da5('0x6'));var fs=require('fs');var path=require(_0x5da5('0x7'));var rimraf=require(_0x5da5('0x8'));var config=require(_0x5da5('0x9'));var attributes=require(_0x5da5('0xa'));module['exports']=function(_0x51d135,_0x37bdcc){return _0x51d135[_0x5da5('0xb')](_0x5da5('0xc'),attributes,{'tableName':'tools_schedules','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 81984e7..48440e5 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 _0xb4ee=['debug','error','code','message','info','request\x20sent','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','Schedule,\x20%s,\x20%s'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xb4ee,0x1e6));var _0xeb4e=function(_0x1af3be,_0x594198){_0x1af3be=_0x1af3be-0x0;var _0x374a3b=_0xb4ee[_0x1af3be];return _0x374a3b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeb4e('0x0'));var BPromise=require(_0xeb4e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb4e('0x2'))['db'];var utils=require(_0xeb4e('0x3'));var logger=require(_0xeb4e('0x4'))(_0xeb4e('0x5'));var config=require(_0xeb4e('0x6'));var jayson=require(_0xeb4e('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b861e,_0x3df20d,_0x376f75){return new BPromise(function(_0x4d4711,_0x5f436e){return client['request'](_0x3b861e,_0x376f75)[_0xeb4e('0x8')](function(_0x1e00c8){logger['info'](_0xeb4e('0x9'),_0x3df20d,'request\x20sent');logger[_0xeb4e('0xa')]('Schedule,\x20%s,\x20%s,\x20%s',_0x3df20d,'request\x20sent',JSON['stringify'](_0x1e00c8));if(_0x1e00c8[_0xeb4e('0xb')]){if(_0x1e00c8['error'][_0xeb4e('0xc')]===0x1f4){logger[_0xeb4e('0xb')](_0xeb4e('0x9'),_0x3df20d,_0x1e00c8[_0xeb4e('0xb')]['message']);return _0x5f436e(_0x1e00c8[_0xeb4e('0xb')][_0xeb4e('0xd')]);}logger[_0xeb4e('0xb')](_0xeb4e('0x9'),_0x3df20d,_0x1e00c8[_0xeb4e('0xb')][_0xeb4e('0xd')]);return _0x4d4711(_0x1e00c8[_0xeb4e('0xb')][_0xeb4e('0xd')]);}else{logger[_0xeb4e('0xe')](_0xeb4e('0x9'),_0x3df20d,_0xeb4e('0xf'));_0x4d4711(_0x1e00c8['result'][_0xeb4e('0xd')]);}})['catch'](function(_0x309362){logger[_0xeb4e('0xb')](_0xeb4e('0x9'),_0x3df20d,_0x309362);_0x5f436e(_0x309362);});});} \ No newline at end of file +var _0x4ad5=['message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s'];(function(_0x19ed6a,_0x26097b){var _0x5509a5=function(_0xbc797e){while(--_0xbc797e){_0x19ed6a['push'](_0x19ed6a['shift']());}};_0x5509a5(++_0x26097b);}(_0x4ad5,0xb3));var _0x54ad=function(_0x198f2d,_0x2d4c28){_0x198f2d=_0x198f2d-0x0;var _0xa6ab6a=_0x4ad5[_0x198f2d];return _0xa6ab6a;};'use strict';var _=require('lodash');var util=require(_0x54ad('0x0'));var moment=require(_0x54ad('0x1'));var BPromise=require(_0x54ad('0x2'));var rs=require(_0x54ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x54ad('0x5'))(_0x54ad('0x6'));var config=require('../../config/environment');var jayson=require(_0x54ad('0x7'));var client=jayson['client'][_0x54ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47158f,_0x59b8a2,_0x3f9833){return new BPromise(function(_0x1206ef,_0x3e98f5){return client[_0x54ad('0x9')](_0x47158f,_0x3f9833)[_0x54ad('0xa')](function(_0x1d25e1){logger[_0x54ad('0xb')]('Schedule,\x20%s,\x20%s',_0x59b8a2,_0x54ad('0xc'));logger[_0x54ad('0xd')](_0x54ad('0xe'),_0x59b8a2,_0x54ad('0xc'),JSON[_0x54ad('0xf')](_0x1d25e1));if(_0x1d25e1[_0x54ad('0x10')]){if(_0x1d25e1[_0x54ad('0x10')][_0x54ad('0x11')]===0x1f4){logger['error'](_0x54ad('0x12'),_0x59b8a2,_0x1d25e1[_0x54ad('0x10')][_0x54ad('0x13')]);return _0x3e98f5(_0x1d25e1[_0x54ad('0x10')]['message']);}logger[_0x54ad('0x10')](_0x54ad('0x12'),_0x59b8a2,_0x1d25e1['error'][_0x54ad('0x13')]);return _0x1206ef(_0x1d25e1[_0x54ad('0x10')][_0x54ad('0x13')]);}else{logger[_0x54ad('0xb')]('Schedule,\x20%s,\x20%s',_0x59b8a2,_0x54ad('0xc'));_0x1206ef(_0x1d25e1[_0x54ad('0x14')][_0x54ad('0x13')]);}})[_0x54ad('0x15')](function(_0x4f2b3a){logger['error']('Schedule,\x20%s,\x20%s',_0x59b8a2,_0x4f2b3a);_0x3e98f5(_0x4f2b3a);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 391985e..3eaebe5 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 _0x33dd=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','show','download','put','delete','destroy'];(function(_0x4740b6,_0x375080){var _0x499e31=function(_0x5b553b){while(--_0x5b553b){_0x4740b6['push'](_0x4740b6['shift']());}};_0x499e31(++_0x375080);}(_0x33dd,0xc6));var _0xd33d=function(_0x4fba63,_0x2345fc){_0x4fba63=_0x4fba63-0x0;var _0x55a7dd=_0x33dd[_0x4fba63];return _0x55a7dd;};'use strict';var multer=require(_0xd33d('0x0'));var util=require(_0xd33d('0x1'));var path=require('path');var timeout=require(_0xd33d('0x2'));var express=require('express');var router=express[_0xd33d('0x3')]();var fs_extra=require(_0xd33d('0x4'));var auth=require(_0xd33d('0x5'));var interaction=require(_0xd33d('0x6'));var config=require('../../config/environment');var controller=require(_0xd33d('0x7'));router[_0xd33d('0x8')]('/',auth[_0xd33d('0x9')](),controller[_0xd33d('0xa')]);router[_0xd33d('0x8')](_0xd33d('0xb'),auth[_0xd33d('0x9')](),controller['describe']);router['get'](_0xd33d('0xc'),auth[_0xd33d('0x9')](),controller[_0xd33d('0xd')]);router['get']('/:id/download',auth[_0xd33d('0x9')](),controller[_0xd33d('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd33d('0xf')](_0xd33d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd33d('0x10')](_0xd33d('0xc'),auth['isAuthenticated'](),controller[_0xd33d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbc19=['../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x799d4a,_0x8101a2){var _0x5008fd=function(_0xa47b1){while(--_0xa47b1){_0x799d4a['push'](_0x799d4a['shift']());}};_0x5008fd(++_0x8101a2);}(_0xbc19,0x125));var _0x9bc1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbc19[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x9bc1('0x0'));var util=require(_0x9bc1('0x1'));var path=require(_0x9bc1('0x2'));var timeout=require(_0x9bc1('0x3'));var express=require('express');var router=express[_0x9bc1('0x4')]();var fs_extra=require(_0x9bc1('0x5'));var auth=require(_0x9bc1('0x6'));var interaction=require(_0x9bc1('0x7'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router['get']('/',auth[_0x9bc1('0x8')](),controller[_0x9bc1('0x9')]);router[_0x9bc1('0xa')](_0x9bc1('0xb'),auth['isAuthenticated'](),controller[_0x9bc1('0xc')]);router[_0x9bc1('0xa')](_0x9bc1('0xd'),auth['isAuthenticated'](),controller[_0x9bc1('0xe')]);router[_0x9bc1('0xa')](_0x9bc1('0xf'),auth[_0x9bc1('0x8')](),controller[_0x9bc1('0x10')]);router[_0x9bc1('0x11')]('/',auth[_0x9bc1('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9bc1('0x12')]('/:id',auth[_0x9bc1('0x8')](),controller['destroy']);module[_0x9bc1('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index cd35b99..a7e5186 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 _0x7382=['DATE','createdAt','updatedAt','moment','value','extname','getDataValue','STRING','setDataValue','INTEGER','startedAt','closedAt','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x7382,0x111));var _0x2738=function(_0x63c9d,_0x5269ef){_0x63c9d=_0x63c9d-0x0;var _0x4c4abe=_0x7382[_0x63c9d];return _0x4c4abe;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2738('0x0'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x2738('0x1'))?path[_0x2738('0x2')](this[_0x2738('0x3')](_0x2738('0x1'))):undefined;}},'interactionid':{'type':Sequelize[_0x2738('0x4')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x2738('0x4')],'set':function(_0x2bc38a){var _0xd74b07=_0x2bc38a['replace'](/\\/g,'/');this[_0x2738('0x5')](_0x2738('0x1'),_0xd74b07);}},'rating':{'type':Sequelize[_0x2738('0x6')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x476864){this[_0x2738('0x5')](_0x2738('0x7'),moment()['subtract'](_0x476864,'ms'));this[_0x2738('0x5')](_0x2738('0x8'),moment());this[_0x2738('0x5')]('duration',_0x476864);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2738('0x3')](_0x2738('0x7')))[_0x2738('0x9')](_0x2738('0xa'))[_0x2738('0xb')]();}},'closedAt':{'type':Sequelize[_0x2738('0xc')],'get':function(){return moment(this[_0x2738('0x3')](_0x2738('0x8')))[_0x2738('0x9')](_0x2738('0xa'))[_0x2738('0xb')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2738('0x3')](_0x2738('0xd')))['format'](_0x2738('0xa'))['toString']();}},'updatedAt':{'type':Sequelize[_0x2738('0xc')],'get':function(){return moment(this['getDataValue'](_0x2738('0xe')))['format'](_0x2738('0xa'))[_0x2738('0xb')]();}}}; \ No newline at end of file +var _0x794b=['startedAt','subtract','closedAt','duration','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','moment','../../config/environment','exports','value','extname','STRING','replace','INTEGER','setDataValue'];(function(_0x116ab0,_0x599dee){var _0x37d0ec=function(_0x5c7eb6){while(--_0x5c7eb6){_0x116ab0['push'](_0x116ab0['shift']());}};_0x37d0ec(++_0x599dee);}(_0x794b,0x1c2));var _0xb794=function(_0x4a2fb6,_0x50dfcc){_0x4a2fb6=_0x4a2fb6-0x0;var _0x31f9e5=_0x794b[_0x4a2fb6];return _0x31f9e5;};'use strict';var Sequelize=require(_0xb794('0x0'));var moment=require(_0xb794('0x1'));var path=require('path');var config=require(_0xb794('0x2'));module[_0xb794('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xb794('0x4'))?path[_0xb794('0x5')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0xb794('0x6')]},'channel':{'type':Sequelize[_0xb794('0x6')]},'value':{'type':Sequelize[_0xb794('0x6')],'set':function(_0x20e4d4){var _0x231206=_0x20e4d4[_0xb794('0x7')](/\\/g,'/');this['setDataValue'](_0xb794('0x4'),_0x231206);}},'rating':{'type':Sequelize[_0xb794('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb794('0x8')],'set':function(_0xc3dde7){this[_0xb794('0x9')](_0xb794('0xa'),moment()[_0xb794('0xb')](_0xc3dde7,'ms'));this[_0xb794('0x9')](_0xb794('0xc'),moment());this[_0xb794('0x9')](_0xb794('0xd'),_0xc3dde7);}},'startedAt':{'type':Sequelize[_0xb794('0xe')],'get':function(){return moment(this[_0xb794('0xf')](_0xb794('0xa')))[_0xb794('0x10')](_0xb794('0x11'))[_0xb794('0x12')]();}},'closedAt':{'type':Sequelize[_0xb794('0xe')],'get':function(){return moment(this[_0xb794('0xf')](_0xb794('0xc')))[_0xb794('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xb794('0x12')]();}},'createdAt':{'type':Sequelize[_0xb794('0xe')],'get':function(){return moment(this[_0xb794('0xf')](_0xb794('0x13')))[_0xb794('0x10')](_0xb794('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0xb794('0xe')],'get':function(){return moment(this[_0xb794('0xf')]('updatedAt'))[_0xb794('0x10')](_0xb794('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 747574a..edb7d31 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 _0x7bae=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','params','options','find','create','body','duration','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','format','%s.cypher','existsSync','secrets','recording','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x3d6a00,_0x41f7f6){var _0xaeb4d5=function(_0x4ef862){while(--_0x4ef862){_0x3d6a00['push'](_0x3d6a00['shift']());}};_0xaeb4d5(++_0x41f7f6);}(_0x7bae,0x13b));var _0xe7ba=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x7bae[_0x173d7e];return _0x2220d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7ba('0x0'));var jsonpatch=require(_0xe7ba('0x1'));var rp=require('request-promise');var moment=require(_0xe7ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7ba('0x3'));var util=require(_0xe7ba('0x4'));var path=require(_0xe7ba('0x5'));var sox=require(_0xe7ba('0x6'));var csv=require(_0xe7ba('0x7'));var ejs=require(_0xe7ba('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ba('0x9'));var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x7'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ba('0x19'))['db'];function respondWithStatusCode(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xcc;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0x1a')](_0x602b1);}return _0x588c8b[_0xe7ba('0x1b')](_0x602b1)[_0xe7ba('0x1c')]();};}function respondWithResult(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0xc8;return function(_0x561c48){if(_0x561c48){return _0x41369f[_0xe7ba('0x1b')](_0x561dbb)[_0xe7ba('0x1d')](_0x561c48);}};}function respondWithFilteredResult(_0x359f6f,_0x5d1d03){return function(_0x4390e3){if(_0x4390e3){var _0x4b20fd=typeof _0x5d1d03['offset']==='undefined'&&typeof _0x5d1d03[_0xe7ba('0x1e')]==='undefined';var _0x41a773=_0x4390e3['count'];var _0x4e3021=_0x4b20fd?0x0:_0x5d1d03['offset'];var _0x3f326a=_0x4b20fd?_0x4390e3[_0xe7ba('0x1f')]:_0x5d1d03[_0xe7ba('0x20')]+_0x5d1d03[_0xe7ba('0x1e')];var _0x1c8b5b;if(_0x3f326a>=_0x41a773){_0x3f326a=_0x41a773;_0x1c8b5b=0xc8;}else{_0x1c8b5b=0xce;}_0x359f6f['status'](_0x1c8b5b);return _0x359f6f[_0xe7ba('0x21')](_0xe7ba('0x22'),_0x4e3021+'-'+_0x3f326a+'/'+_0x41a773)[_0xe7ba('0x1d')](_0x4390e3);}return null;};}function patchUpdates(_0x136ec6){return function(_0x4aaf35){try{jsonpatch[_0xe7ba('0x23')](_0x4aaf35,_0x136ec6,!![]);}catch(_0x2936b7){return BPromise['reject'](_0x2936b7);}return _0x4aaf35[_0xe7ba('0x24')]();};}function saveUpdates(_0x4514e8,_0x27c882){return function(_0x7ab9e4){if(_0x7ab9e4){return _0x7ab9e4[_0xe7ba('0x25')](_0x4514e8)[_0xe7ba('0x26')](function(_0x293b14){return _0x293b14;});}return null;};}function removeEntity(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(_0xa72f1c){return _0xa72f1c['destroy']()['then'](function(){_0x2b29f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4363a8,_0x576513){return function(_0x4ecc0d){if(!_0x4ecc0d){_0x4363a8['sendStatus'](0x194);}return _0x4ecc0d;};}function handleError(_0x255def,_0x32cc00){_0x32cc00=_0x32cc00||0x1f4;return function(_0xe32862){logger[_0xe7ba('0x27')](_0xe32862[_0xe7ba('0x28')]);if(_0xe32862[_0xe7ba('0x29')]){delete _0xe32862[_0xe7ba('0x29')];}_0x255def[_0xe7ba('0x1b')](_0x32cc00)['send'](_0xe32862);};}exports[_0xe7ba('0x2a')]=function(_0x48c869,_0x102925){var _0x92fe7={},_0x369451={},_0x4bf5f9={'count':0x0,'rows':[]};var _0x587c7d=_[_0xe7ba('0x2b')](db[_0xe7ba('0x2c')][_0xe7ba('0x2d')],function(_0x20b6cd){return{'name':_0x20b6cd[_0xe7ba('0x2e')],'type':_0x20b6cd['type'][_0xe7ba('0x2f')]};});_0x369451[_0xe7ba('0x30')]=_['differenceBy'](_[_0xe7ba('0x2b')](_0x587c7d,'name'),['format']);_0x369451[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x48c869[_0xe7ba('0x31')]);_0x369451['filters']=_[_0xe7ba('0x33')](_0x369451['model'],_0x369451[_0xe7ba('0x31')]);_0x92fe7[_0xe7ba('0x34')]=_[_0xe7ba('0x33')](_0x369451[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x48c869['query'][_0xe7ba('0x35')]));_0x92fe7[_0xe7ba('0x34')]=_0x92fe7['attributes'][_0xe7ba('0x36')]?_0x92fe7[_0xe7ba('0x34')]:_0x369451[_0xe7ba('0x30')];if(!_0x48c869['query'][_0xe7ba('0x37')](_0xe7ba('0x38'))){_0x92fe7['limit']=qs[_0xe7ba('0x1e')](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x1e')]);_0x92fe7['offset']=qs[_0xe7ba('0x20')](_0x48c869[_0xe7ba('0x31')]['offset']);}_0x92fe7[_0xe7ba('0x39')]=qs[_0xe7ba('0x3a')](_0x48c869[_0xe7ba('0x31')]['sort']);_0x92fe7['where']=qs[_0xe7ba('0x3b')](_[_0xe7ba('0x3c')](_0x48c869[_0xe7ba('0x31')],_0x369451[_0xe7ba('0x3b')]),_0x587c7d);if(_0x48c869[_0xe7ba('0x31')]['filter']){_0x92fe7[_0xe7ba('0x3d')]=_[_0xe7ba('0x3e')](_0x92fe7[_0xe7ba('0x3d')],{'$or':_[_0xe7ba('0x2b')](_0x587c7d,function(_0x5e9619){if(_0x5e9619[_0xe7ba('0x3f')]!==_0xe7ba('0x40')){var _0x46e31a={};_0x46e31a[_0x5e9619[_0xe7ba('0x29')]]={'$like':'%'+_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x41')]+'%'};return _0x46e31a;}})});}_0x92fe7=_[_0xe7ba('0x3e')]({},_0x92fe7,_0x48c869['options']);var _0x3429fa={'where':_0x92fe7[_0xe7ba('0x3d')]};return db[_0xe7ba('0x2c')][_0xe7ba('0x1f')](_0x3429fa)[_0xe7ba('0x26')](function(_0x3b3abe){_0x4bf5f9[_0xe7ba('0x1f')]=_0x3b3abe;if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x42')]){_0x92fe7['include']=[{'all':!![]}];}return db[_0xe7ba('0x2c')][_0xe7ba('0x43')](_0x92fe7);})['then'](function(_0x5dae52){_0x4bf5f9[_0xe7ba('0x44')]=_0x5dae52;return _0x4bf5f9;})[_0xe7ba('0x26')](respondWithFilteredResult(_0x102925,_0x92fe7))[_0xe7ba('0x45')](handleError(_0x102925,null));};exports['show']=function(_0x249e1d,_0x82246e){var _0x3569b6={'raw':![],'where':{'id':_0x249e1d[_0xe7ba('0x46')]['id']}},_0x12770d={};_0x12770d['model']=_[_0xe7ba('0x32')](db['ScreenRecording'][_0xe7ba('0x2d')]);_0x12770d[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x249e1d[_0xe7ba('0x31')]);_0x12770d[_0xe7ba('0x3b')]=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],_0x12770d[_0xe7ba('0x31')]);_0x3569b6['attributes']=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x249e1d[_0xe7ba('0x31')][_0xe7ba('0x35')]));_0x3569b6[_0xe7ba('0x34')]=_0x3569b6[_0xe7ba('0x34')][_0xe7ba('0x36')]?_0x3569b6[_0xe7ba('0x34')]:_0x12770d[_0xe7ba('0x30')];if(_0x249e1d['query'][_0xe7ba('0x42')]){_0x3569b6['include']=[{'all':!![]}];}_0x3569b6=_[_0xe7ba('0x3e')]({},_0x3569b6,_0x249e1d[_0xe7ba('0x47')]);return db[_0xe7ba('0x2c')][_0xe7ba('0x48')](_0x3569b6)[_0xe7ba('0x26')](handleEntityNotFound(_0x82246e,null))[_0xe7ba('0x26')](respondWithResult(_0x82246e,null))['catch'](handleError(_0x82246e,null));};exports[_0xe7ba('0x49')]=function(_0x1cc668,_0x3f17ed){return db[_0xe7ba('0x2c')][_0xe7ba('0x49')](_0x1cc668[_0xe7ba('0x4a')],{})[_0xe7ba('0x26')](respondWithResult(_0x3f17ed,0xc9))[_0xe7ba('0x45')](handleError(_0x3f17ed,null));};exports[_0xe7ba('0x25')]=function(_0x1189bd,_0xbe2a32){if(_0x1189bd['body']['id']){delete _0x1189bd[_0xe7ba('0x4a')]['id'];}delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4b')];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4c')];delete _0x1189bd[_0xe7ba('0x4a')]['closedAt'];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4d')];return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x1189bd[_0xe7ba('0x46')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0xbe2a32,null))[_0xe7ba('0x26')](saveUpdates(_0x1189bd['body'],null))['then'](respondWithResult(_0xbe2a32,null))[_0xe7ba('0x45')](handleError(_0xbe2a32,null));};exports[_0xe7ba('0x4e')]=function(_0x285743,_0x5af106){return db[_0xe7ba('0x2c')][_0xe7ba('0x4e')]()[_0xe7ba('0x26')](respondWithResult(_0x5af106,null))[_0xe7ba('0x45')](handleError(_0x5af106,null));};exports[_0xe7ba('0x4f')]=function(_0x6b6f1,_0xf3a41f,_0x5e6612){var _0x2a6fdd=require(_0xe7ba('0x50'));var _0x316b51=![];var _0x5863c8={};if(_0x6b6f1[_0xe7ba('0x31')][_0xe7ba('0x3f')]&&_0x6b6f1['query'][_0xe7ba('0x3f')]===_0xe7ba('0x51')){_0x5863c8['uniqueid']=_0x6b6f1[_0xe7ba('0x46')]['id'];}else{_0x5863c8['id']=_0x6b6f1['params']['id'];}return db[_0xe7ba('0x2c')][_0xe7ba('0x48')]({'where':_0x5863c8,'attributes':['id',_0xe7ba('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0xf3a41f,null))[_0xe7ba('0x26')](function(_0x1128be){if(_0x1128be){var _0x314549=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],'server/files/screen_recordings',_0x1128be[_0xe7ba('0x4d')]);var _0x455e50=util[_0xe7ba('0x54')](_0xe7ba('0x55'),_0x314549);if(fs[_0xe7ba('0x56')](_0x455e50)){_0x316b51=!![];return _0x2a6fdd['decryptFile'](_0x455e50,_0x314549,config[_0xe7ba('0x57')][_0xe7ba('0x58')])[_0xe7ba('0x26')](function(){return _0x1128be;});}return _0x1128be;}})[_0xe7ba('0x26')](function(_0x57b23e){if(_0x57b23e){var _0x3e31c1=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],_0xe7ba('0x59'),_0x57b23e[_0xe7ba('0x4d')]);if(!fs[_0xe7ba('0x56')](_0x3e31c1)){throw new db['Sequelize'][(_0xe7ba('0x5a'))](_0xe7ba('0x5b'));}if(_0x57b23e[_0xe7ba('0x5c')]){return _0xf3a41f['download'](_0x3e31c1,_0x57b23e[_0xe7ba('0x5c')]+path[_0xe7ba('0x5d')](_0x3e31c1),function(){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}else{return _0xf3a41f[_0xe7ba('0x4f')](_0x3e31c1,function(_0x45fb0f){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}}})[_0xe7ba('0x45')](function(_0x3351d5){if(_0x3351d5[_0xe7ba('0x5f')]===_0xe7ba('0x5b')){_0xf3a41f[_0xe7ba('0x1b')](0x194)[_0xe7ba('0x60')]('Not\x20found');}else{return handleError(_0xf3a41f,null);}});};exports[_0xe7ba('0x61')]=function(_0x384cea,_0x357af4){return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x384cea['params']['id']}})[_0xe7ba('0x26')](function(_0x194dff){if(_[_0xe7ba('0x62')](_0x194dff)){throw new ReferenceError('Entity\x20not\x20found');}return _0x194dff;})['then'](function(_0x46d06e){var _0x2812af=path[_0xe7ba('0x52')](config['root'],_0xe7ba('0x59'),_0x46d06e[_0xe7ba('0x4d')]);logger[_0xe7ba('0x63')](_0xe7ba('0x64'),_0x2812af);if(!_[_0xe7ba('0x62')](_0x46d06e['value'])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7ba('0x66')](_0x2812af);}_0x2812af=_0x2812af+_0xe7ba('0x67');if(!_[_0xe7ba('0x62')](_0x46d06e[_0xe7ba('0x4d')])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+_0xe7ba('0x68'));fs[_0xe7ba('0x66')](_0x2812af);}return _0x46d06e;})[_0xe7ba('0x26')](function(_0x5a5394){if(!_0x5a5394)throw new InternalError();return _0x5a5394[_0xe7ba('0x61')]();})[_0xe7ba('0x26')](function(){_0x357af4[_0xe7ba('0x1b')](0xcc)[_0xe7ba('0x1c')]();})['catch'](handleError(_0x357af4,null));}; \ No newline at end of file +var _0x24ca=['server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','ScreenRecording','include','findAll','rows','catch','show','model','includeAll','find','create','body','duration','createdAt','closedAt','params','describe','download','uniqueid','value','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','join'];(function(_0x1aec44,_0x5ad6cc){var _0x3bb996=function(_0x13e0b1){while(--_0x13e0b1){_0x1aec44['push'](_0x1aec44['shift']());}};_0x3bb996(++_0x5ad6cc);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x24ca[_0x3d42d8];return _0x27fc41;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){_0x346ee8['status'](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x5cc9cb,_0x2365f9){return function(_0x3951ae){if(!_0x3951ae){_0x5cc9cb[_0xa24c('0x29')](0x194);}return _0x3951ae;};}function handleError(_0x51dc3f,_0x1beb55){_0x1beb55=_0x1beb55||0x1f4;return function(_0x31c4d9){logger[_0xa24c('0x2a')](_0x31c4d9[_0xa24c('0x2b')]);if(_0x31c4d9[_0xa24c('0x2c')]){delete _0x31c4d9[_0xa24c('0x2c')];}_0x51dc3f[_0xa24c('0x1b')](_0x1beb55)['send'](_0x31c4d9);};}exports[_0xa24c('0x2d')]=function(_0x28675f,_0x152120){var _0x12dbdc={},_0x5e491e={},_0x21d2a8={'count':0x0,'rows':[]};var _0xc96ce7=_[_0xa24c('0x2e')](db['ScreenRecording'][_0xa24c('0x2f')],function(_0x3dcb1b){return{'name':_0x3dcb1b[_0xa24c('0x30')],'type':_0x3dcb1b['type'][_0xa24c('0x31')]};});_0x5e491e['model']=_[_0xa24c('0x32')](_[_0xa24c('0x2e')](_0xc96ce7,_0xa24c('0x2c')),['format']);_0x5e491e[_0xa24c('0x33')]=_[_0xa24c('0x34')](_0x28675f[_0xa24c('0x33')]);_0x5e491e['filters']=_[_0xa24c('0x35')](_0x5e491e['model'],_0x5e491e[_0xa24c('0x33')]);_0x12dbdc[_0xa24c('0x36')]=_['intersection'](_0x5e491e['model'],qs[_0xa24c('0x37')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x37')]));_0x12dbdc[_0xa24c('0x36')]=_0x12dbdc[_0xa24c('0x36')][_0xa24c('0x38')]?_0x12dbdc[_0xa24c('0x36')]:_0x5e491e['model'];if(!_0x28675f[_0xa24c('0x33')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x12dbdc[_0xa24c('0x1e')]=qs[_0xa24c('0x1e')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x1e')]);_0x12dbdc[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x28675f[_0xa24c('0x33')]['offset']);}_0x12dbdc[_0xa24c('0x3b')]=qs[_0xa24c('0x3c')](_0x28675f[_0xa24c('0x33')][_0xa24c('0x3c')]);_0x12dbdc['where']=qs['filters'](_[_0xa24c('0x3d')](_0x28675f['query'],_0x5e491e[_0xa24c('0x3e')]),_0xc96ce7);if(_0x28675f[_0xa24c('0x33')][_0xa24c('0x3f')]){_0x12dbdc[_0xa24c('0x40')]=_[_0xa24c('0x41')](_0x12dbdc['where'],{'$or':_['map'](_0xc96ce7,function(_0x3121e){if(_0x3121e[_0xa24c('0x42')]!==_0xa24c('0x43')){var _0x213dc3={};_0x213dc3[_0x3121e[_0xa24c('0x2c')]]={'$like':'%'+_0x28675f[_0xa24c('0x33')]['filter']+'%'};return _0x213dc3;}})});}_0x12dbdc=_['merge']({},_0x12dbdc,_0x28675f[_0xa24c('0x44')]);var _0x1ce83e={'where':_0x12dbdc[_0xa24c('0x40')]};return db[_0xa24c('0x45')][_0xa24c('0x20')](_0x1ce83e)['then'](function(_0x171c51){_0x21d2a8[_0xa24c('0x20')]=_0x171c51;if(_0x28675f['query']['includeAll']){_0x12dbdc[_0xa24c('0x46')]=[{'all':!![]}];}return db[_0xa24c('0x45')][_0xa24c('0x47')](_0x12dbdc);})['then'](function(_0x58ac8b){_0x21d2a8[_0xa24c('0x48')]=_0x58ac8b;return _0x21d2a8;})[_0xa24c('0x27')](respondWithFilteredResult(_0x152120,_0x12dbdc))[_0xa24c('0x49')](handleError(_0x152120,null));};exports[_0xa24c('0x4a')]=function(_0x3f640e,_0x1b7faf){var _0x23d1e0={'raw':![],'where':{'id':_0x3f640e['params']['id']}},_0x394d19={};_0x394d19['model']=_[_0xa24c('0x34')](db[_0xa24c('0x45')][_0xa24c('0x2f')]);_0x394d19['query']=_[_0xa24c('0x34')](_0x3f640e[_0xa24c('0x33')]);_0x394d19[_0xa24c('0x3e')]=_[_0xa24c('0x35')](_0x394d19[_0xa24c('0x4b')],_0x394d19[_0xa24c('0x33')]);_0x23d1e0[_0xa24c('0x36')]=_[_0xa24c('0x35')](_0x394d19[_0xa24c('0x4b')],qs[_0xa24c('0x37')](_0x3f640e['query'][_0xa24c('0x37')]));_0x23d1e0[_0xa24c('0x36')]=_0x23d1e0[_0xa24c('0x36')]['length']?_0x23d1e0[_0xa24c('0x36')]:_0x394d19[_0xa24c('0x4b')];if(_0x3f640e[_0xa24c('0x33')][_0xa24c('0x4c')]){_0x23d1e0[_0xa24c('0x46')]=[{'all':!![]}];}_0x23d1e0=_[_0xa24c('0x41')]({},_0x23d1e0,_0x3f640e[_0xa24c('0x44')]);return db[_0xa24c('0x45')][_0xa24c('0x4d')](_0x23d1e0)[_0xa24c('0x27')](handleEntityNotFound(_0x1b7faf,null))[_0xa24c('0x27')](respondWithResult(_0x1b7faf,null))['catch'](handleError(_0x1b7faf,null));};exports[_0xa24c('0x4e')]=function(_0x96b977,_0x42028b){return db[_0xa24c('0x45')][_0xa24c('0x4e')](_0x96b977[_0xa24c('0x4f')],{})[_0xa24c('0x27')](respondWithResult(_0x42028b,0xc9))[_0xa24c('0x49')](handleError(_0x42028b,null));};exports[_0xa24c('0x26')]=function(_0x4f56ae,_0x540da8){if(_0x4f56ae[_0xa24c('0x4f')]['id']){delete _0x4f56ae['body']['id'];}delete _0x4f56ae[_0xa24c('0x4f')][_0xa24c('0x50')];delete _0x4f56ae['body'][_0xa24c('0x51')];delete _0x4f56ae[_0xa24c('0x4f')][_0xa24c('0x52')];delete _0x4f56ae['body']['value'];return db[_0xa24c('0x45')]['find']({'where':{'id':_0x4f56ae[_0xa24c('0x53')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x540da8,null))[_0xa24c('0x27')](saveUpdates(_0x4f56ae[_0xa24c('0x4f')],null))[_0xa24c('0x27')](respondWithResult(_0x540da8,null))[_0xa24c('0x49')](handleError(_0x540da8,null));};exports[_0xa24c('0x54')]=function(_0x286d57,_0x22a0db){return db[_0xa24c('0x45')]['describe']()[_0xa24c('0x27')](respondWithResult(_0x22a0db,null))[_0xa24c('0x49')](handleError(_0x22a0db,null));};exports[_0xa24c('0x55')]=function(_0x513271,_0x5bde94,_0x487cc9){var _0x2da4f0=require('../../components/encryptor');var _0x4757ff=![];var _0x21d0fc={};if(_0x513271['query'][_0xa24c('0x42')]&&_0x513271[_0xa24c('0x33')][_0xa24c('0x42')]===_0xa24c('0x56')){_0x21d0fc[_0xa24c('0x56')]=_0x513271[_0xa24c('0x53')]['id'];}else{_0x21d0fc['id']=_0x513271[_0xa24c('0x53')]['id'];}return db[_0xa24c('0x45')]['find']({'where':_0x21d0fc,'attributes':['id',_0xa24c('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x5bde94,null))['then'](function(_0x565f0a){if(_0x565f0a){var _0x5bd2af=path['join'](config[_0xa24c('0x58')],'server/files/screen_recordings',_0x565f0a[_0xa24c('0x57')]);var _0x3fd3f9=util[_0xa24c('0x59')](_0xa24c('0x5a'),_0x5bd2af);if(fs[_0xa24c('0x5b')](_0x3fd3f9)){_0x4757ff=!![];return _0x2da4f0[_0xa24c('0x5c')](_0x3fd3f9,_0x5bd2af,config[_0xa24c('0x5d')][_0xa24c('0x5e')])[_0xa24c('0x27')](function(){return _0x565f0a;});}return _0x565f0a;}})[_0xa24c('0x27')](function(_0x303b7d){if(_0x303b7d){var _0x37dbbd=path[_0xa24c('0x5f')](config[_0xa24c('0x58')],_0xa24c('0x60'),_0x303b7d['value']);if(!fs[_0xa24c('0x5b')](_0x37dbbd)){throw new db[(_0xa24c('0x61'))]['ValidationError'](_0xa24c('0x62'));}if(_0x303b7d[_0xa24c('0x63')]){return _0x5bde94[_0xa24c('0x55')](_0x37dbbd,_0x303b7d[_0xa24c('0x63')]+path['extname'](_0x37dbbd),function(){if(_0x4757ff){fs['unlink'](_0x37dbbd);}});}else{return _0x5bde94[_0xa24c('0x55')](_0x37dbbd,function(_0x5e9631){if(_0x4757ff){fs['unlink'](_0x37dbbd);}});}}})[_0xa24c('0x49')](function(_0x2515b1){if(_0x2515b1[_0xa24c('0x64')]===_0xa24c('0x62')){_0x5bde94['status'](0x194)['send'](_0xa24c('0x65'));}else{return handleError(_0x5bde94,null);}});};exports['destroy']=function(_0x52a895,_0xfcc193){return db[_0xa24c('0x45')][_0xa24c('0x4d')]({'where':{'id':_0x52a895['params']['id']}})[_0xa24c('0x27')](function(_0x128e5b){if(_['isNil'](_0x128e5b)){throw new ReferenceError(_0xa24c('0x66'));}return _0x128e5b;})[_0xa24c('0x27')](function(_0x3096bf){var _0x4bee5c=path[_0xa24c('0x5f')](config[_0xa24c('0x58')],_0xa24c('0x60'),_0x3096bf[_0xa24c('0x57')]);logger[_0xa24c('0x67')]('cancellazione\x20fisica\x20documento\x20%s',_0x4bee5c);if(!_[_0xa24c('0x68')](_0x3096bf[_0xa24c('0x57')])&&fs[_0xa24c('0x5b')](_0x4bee5c)){logger[_0xa24c('0x67')](_0xa24c('0x69')+_0x4bee5c+_0xa24c('0x6a'));fs[_0xa24c('0x6b')](_0x4bee5c);}_0x4bee5c=_0x4bee5c+'.cypher';if(!_[_0xa24c('0x68')](_0x3096bf[_0xa24c('0x57')])&&fs['existsSync'](_0x4bee5c)){logger[_0xa24c('0x67')](_0xa24c('0x69')+_0x4bee5c+_0xa24c('0x6a'));fs[_0xa24c('0x6b')](_0x4bee5c);}return _0x3096bf;})[_0xa24c('0x27')](function(_0x3a241a){if(!_0x3a241a)throw new InternalError();return _0x3a241a[_0xa24c('0x28')]();})[_0xa24c('0x27')](function(){_0xfcc193[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();})['catch'](handleError(_0xfcc193,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 5de5be5..a06c263 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 _0xa779=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x1d291d,_0x17314a){var _0x44cc4e=function(_0x38d29f){while(--_0x38d29f){_0x1d291d['push'](_0x1d291d['shift']());}};_0x44cc4e(++_0x17314a);}(_0xa779,0x195));var _0x9a77=function(_0x1ca347,_0x17f0f4){_0x1ca347=_0x1ca347-0x0;var _0x2aec46=_0xa779[_0x1ca347];return _0x2aec46;};'use strict';var _=require(_0x9a77('0x0'));var util=require(_0x9a77('0x1'));var logger=require(_0x9a77('0x2'))(_0x9a77('0x3'));var moment=require('moment');var BPromise=require(_0x9a77('0x4'));var rp=require(_0x9a77('0x5'));var fs=require('fs');var path=require(_0x9a77('0x6'));var rimraf=require(_0x9a77('0x7'));var config=require(_0x9a77('0x8'));var attributes=require(_0x9a77('0x9'));module[_0x9a77('0xa')]=function(_0x578a4f,_0x4c340){return _0x578a4f[_0x9a77('0xb')](_0x9a77('0xc'),attributes,{'tableName':_0x9a77('0xd'),'paranoid':![],'indexes':[{'name':_0x9a77('0xe'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b2c=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x496a49,_0x5430cd){var _0x3f7705=function(_0x13a9cb){while(--_0x13a9cb){_0x496a49['push'](_0x496a49['shift']());}};_0x3f7705(++_0x5430cd);}(_0x0b2c,0xfc));var _0xc0b2=function(_0xb8fd70,_0x2f4a52){_0xb8fd70=_0xb8fd70-0x0;var _0x2a9179=_0x0b2c[_0xb8fd70];return _0x2a9179;};'use strict';var _=require(_0xc0b2('0x0'));var util=require(_0xc0b2('0x1'));var logger=require(_0xc0b2('0x2'))('api');var moment=require(_0xc0b2('0x3'));var BPromise=require(_0xc0b2('0x4'));var rp=require(_0xc0b2('0x5'));var fs=require('fs');var path=require(_0xc0b2('0x6'));var rimraf=require(_0xc0b2('0x7'));var config=require('../../config/environment');var attributes=require(_0xc0b2('0x8'));module[_0xc0b2('0x9')]=function(_0x4db7c7,_0x488b9e){return _0x4db7c7[_0xc0b2('0xa')](_0xc0b2('0xb'),attributes,{'tableName':_0xc0b2('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xc0b2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 9b87802..ff99041 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 _0xdd9e=['client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3a04a5,_0x101026){var _0x4e3298=function(_0x3549a4){while(--_0x3549a4){_0x3a04a5['push'](_0x3a04a5['shift']());}};_0x4e3298(++_0x101026);}(_0xdd9e,0x92));var _0xedd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd9e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xedd9('0x0'));var moment=require(_0xedd9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedd9('0x2'));var db=require(_0xedd9('0x3'))['db'];var utils=require(_0xedd9('0x4'));var logger=require(_0xedd9('0x5'))(_0xedd9('0x6'));var config=require('../../config/environment');var jayson=require(_0xedd9('0x7'));var client=jayson[_0xedd9('0x8')][_0xedd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a8095,_0x51e479,_0x214faa){return new BPromise(function(_0x214d96,_0x525d85){return client[_0xedd9('0xa')](_0x2a8095,_0x214faa)[_0xedd9('0xb')](function(_0x9c702f){logger[_0xedd9('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x51e479,_0xedd9('0xd'));logger[_0xedd9('0xe')](_0xedd9('0xf'),_0x51e479,_0xedd9('0xd'),JSON[_0xedd9('0x10')](_0x9c702f));if(_0x9c702f['error']){if(_0x9c702f['error']['code']===0x1f4){logger[_0xedd9('0x11')](_0xedd9('0x12'),_0x51e479,_0x9c702f[_0xedd9('0x11')][_0xedd9('0x13')]);return _0x525d85(_0x9c702f[_0xedd9('0x11')]['message']);}logger[_0xedd9('0x11')](_0xedd9('0x12'),_0x51e479,_0x9c702f['error'][_0xedd9('0x13')]);return _0x214d96(_0x9c702f['error'][_0xedd9('0x13')]);}else{logger[_0xedd9('0xc')](_0xedd9('0x12'),_0x51e479,'request\x20sent');_0x214d96(_0x9c702f[_0xedd9('0x14')]['message']);}})[_0xedd9('0x15')](function(_0x20098a){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x51e479,_0x20098a);_0x525d85(_0x20098a);});});} \ No newline at end of file +var _0x2b76=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','info','result','catch'];(function(_0x5ad52c,_0x507728){var _0x4179f7=function(_0x4394fb){while(--_0x4394fb){_0x5ad52c['push'](_0x5ad52c['shift']());}};_0x4179f7(++_0x507728);}(_0x2b76,0x1b5));var _0x62b7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2b76[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x62b7('0x0'));var util=require(_0x62b7('0x1'));var moment=require(_0x62b7('0x2'));var BPromise=require(_0x62b7('0x3'));var rs=require(_0x62b7('0x4'));var fs=require('fs');var Redis=require(_0x62b7('0x5'));var db=require(_0x62b7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x62b7('0x7'))(_0x62b7('0x8'));var config=require(_0x62b7('0x9'));var jayson=require(_0x62b7('0xa'));var client=jayson[_0x62b7('0xb')][_0x62b7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57ef99,_0x4f75a7,_0x2f5869){return new BPromise(function(_0xf4aa18,_0x1d321e){return client[_0x62b7('0xd')](_0x57ef99,_0x2f5869)['then'](function(_0x35848b){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x4f75a7,_0x62b7('0xe'));logger['debug'](_0x62b7('0xf'),_0x4f75a7,_0x62b7('0xe'),JSON[_0x62b7('0x10')](_0x35848b));if(_0x35848b[_0x62b7('0x11')]){if(_0x35848b[_0x62b7('0x11')]['code']===0x1f4){logger[_0x62b7('0x11')](_0x62b7('0x12'),_0x4f75a7,_0x35848b[_0x62b7('0x11')][_0x62b7('0x13')]);return _0x1d321e(_0x35848b[_0x62b7('0x11')]['message']);}logger[_0x62b7('0x11')](_0x62b7('0x12'),_0x4f75a7,_0x35848b['error'][_0x62b7('0x13')]);return _0xf4aa18(_0x35848b[_0x62b7('0x11')][_0x62b7('0x13')]);}else{logger[_0x62b7('0x14')](_0x62b7('0x12'),_0x4f75a7,_0x62b7('0xe'));_0xf4aa18(_0x35848b[_0x62b7('0x15')][_0x62b7('0x13')]);}})[_0x62b7('0x16')](function(_0x20c50f){logger[_0x62b7('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x4f75a7,_0x20c50f);_0x1d321e(_0x20c50f);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 6f99d73..b4770fb 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 _0x2e6c=['post','single','file','addLogo','diskStorage','format','%s%s','addLogoLogin','/:id/favicon','addFavicon','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','getFavicon','join','root','server/files/images/logos/','logo','extname','originalname'];(function(_0x2b7f6c,_0x21af82){var _0x1a2983=function(_0x508d96){while(--_0x508d96){_0x2b7f6c['push'](_0x2b7f6c['shift']());}};_0x1a2983(++_0x21af82);}(_0x2e6c,0xd3));var _0xc2e6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2e6c[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xc2e6('0x0'));var util=require(_0xc2e6('0x1'));var path=require(_0xc2e6('0x2'));var timeout=require(_0xc2e6('0x3'));var express=require(_0xc2e6('0x4'));var router=express['Router']();var fs_extra=require(_0xc2e6('0x5'));var auth=require(_0xc2e6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc2e6('0x7'));var controller=require(_0xc2e6('0x8'));router[_0xc2e6('0x9')]('/',auth[_0xc2e6('0xa')](),controller[_0xc2e6('0xb')]);router[_0xc2e6('0x9')](_0xc2e6('0xc'),controller[_0xc2e6('0xd')]);router['get']('/:id',controller[_0xc2e6('0xe')]);router[_0xc2e6('0x9')](_0xc2e6('0xf'),controller[_0xc2e6('0x10')]);router[_0xc2e6('0x9')](_0xc2e6('0x11'),controller[_0xc2e6('0x12')]);router[_0xc2e6('0x9')](_0xc2e6('0x13'),controller['gdpr']);router[_0xc2e6('0x9')](_0xc2e6('0x14'),controller[_0xc2e6('0x15')]);router['get']('/:id/favicon',controller[_0xc2e6('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2aa7ee,_0x7890b2,_0x5a5025){_0x5a5025(null,path[_0xc2e6('0x17')](config[_0xc2e6('0x18')],_0xc2e6('0x19')));},'filename':function(_0x54484a,_0x295d58,_0x8e479a){_0x8e479a(null,util['format']('%s%s',_0xc2e6('0x1a'),path[_0xc2e6('0x1b')](_0x295d58[_0xc2e6('0x1c')])));}})});router[_0xc2e6('0x1d')](_0xc2e6('0xf'),upload[_0xc2e6('0x1e')](_0xc2e6('0x1f')),controller[_0xc2e6('0x20')]);var upload=multer({'storage':multer[_0xc2e6('0x21')]({'destination':function(_0x132891,_0x35919e,_0x548a5d){_0x548a5d(null,path[_0xc2e6('0x17')](config[_0xc2e6('0x18')],_0xc2e6('0x19')));},'filename':function(_0x2b041a,_0x276b45,_0x256bea){_0x256bea(null,util[_0xc2e6('0x22')](_0xc2e6('0x23'),'logologin',path['extname'](_0x276b45[_0xc2e6('0x1c')])));}})});router[_0xc2e6('0x1d')]('/:id/logo_login',upload[_0xc2e6('0x1e')](_0xc2e6('0x1f')),controller[_0xc2e6('0x24')]);var upload=multer({'storage':multer[_0xc2e6('0x21')]({'destination':function(_0x495fd9,_0x529350,_0x490fb6){_0x490fb6(null,path[_0xc2e6('0x17')](config['root'],_0xc2e6('0x19')));},'filename':function(_0x356f69,_0x1a15f0,_0x1d1965){_0x1d1965(null,util['format'](_0xc2e6('0x23'),'preferred',path['extname'](_0x1a15f0['originalname'])));}})});router['post'](_0xc2e6('0x14'),upload[_0xc2e6('0x1e')](_0xc2e6('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22ec39,_0x467257,_0x124496){_0x124496(null,path[_0xc2e6('0x17')](config[_0xc2e6('0x18')],_0xc2e6('0x19')));},'filename':function(_0x117afa,_0x429cb6,_0x235622){_0x235622(null,util[_0xc2e6('0x22')](_0xc2e6('0x23'),'favicon',path['extname'](_0x429cb6[_0xc2e6('0x1c')])));}})});router[_0xc2e6('0x1d')](_0xc2e6('0x25'),upload['single'](_0xc2e6('0x1f')),controller[_0xc2e6('0x26')]);router['put']('/:id',auth[_0xc2e6('0xa')](),controller[_0xc2e6('0x27')]);module['exports']=router; \ No newline at end of file +var _0xa3d5=['format','logo','originalname','post','/:id/logo','single','file','addLogo','join','%s%s','logologin','extname','addPreferred','favicon','addFavicon','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/now','getDate','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/'];(function(_0x571461,_0x6f7b6b){var _0x15abf5=function(_0x178272){while(--_0x178272){_0x571461['push'](_0x571461['shift']());}};_0x15abf5(++_0x6f7b6b);}(_0xa3d5,0x1b6));var _0x5a3d=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xa3d5[_0x1a9204];return _0x17ca68;};'use strict';var multer=require(_0x5a3d('0x0'));var util=require(_0x5a3d('0x1'));var path=require(_0x5a3d('0x2'));var timeout=require(_0x5a3d('0x3'));var express=require(_0x5a3d('0x4'));var router=express[_0x5a3d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5a3d('0x6'));var interaction=require(_0x5a3d('0x7'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x5a3d('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a3d('0x9')]);router['get'](_0x5a3d('0xa'),controller[_0x5a3d('0xb')]);router['get'](_0x5a3d('0xc'),controller[_0x5a3d('0xd')]);router[_0x5a3d('0x8')]('/:id/logo',controller[_0x5a3d('0xe')]);router[_0x5a3d('0x8')](_0x5a3d('0xf'),controller[_0x5a3d('0x10')]);router[_0x5a3d('0x8')](_0x5a3d('0x11'),controller['gdpr']);router[_0x5a3d('0x8')](_0x5a3d('0x12'),controller['getPreferred']);router[_0x5a3d('0x8')](_0x5a3d('0x13'),controller[_0x5a3d('0x14')]);var upload=multer({'storage':multer[_0x5a3d('0x15')]({'destination':function(_0x557a7e,_0x25d208,_0x5b4bab){_0x5b4bab(null,path['join'](config[_0x5a3d('0x16')],_0x5a3d('0x17')));},'filename':function(_0x545a5a,_0x243657,_0x34d609){_0x34d609(null,util[_0x5a3d('0x18')]('%s%s',_0x5a3d('0x19'),path['extname'](_0x243657[_0x5a3d('0x1a')])));}})});router[_0x5a3d('0x1b')](_0x5a3d('0x1c'),upload[_0x5a3d('0x1d')](_0x5a3d('0x1e')),controller[_0x5a3d('0x1f')]);var upload=multer({'storage':multer[_0x5a3d('0x15')]({'destination':function(_0x24e73f,_0x8c9af2,_0x538d34){_0x538d34(null,path[_0x5a3d('0x20')](config[_0x5a3d('0x16')],_0x5a3d('0x17')));},'filename':function(_0x465875,_0x37bb31,_0x5a86f4){_0x5a86f4(null,util[_0x5a3d('0x18')](_0x5a3d('0x21'),_0x5a3d('0x22'),path[_0x5a3d('0x23')](_0x37bb31[_0x5a3d('0x1a')])));}})});router['post'](_0x5a3d('0xf'),upload[_0x5a3d('0x1d')](_0x5a3d('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x5a3d('0x15')]({'destination':function(_0x570d28,_0x43f438,_0x21659a){_0x21659a(null,path[_0x5a3d('0x20')](config[_0x5a3d('0x16')],_0x5a3d('0x17')));},'filename':function(_0x4d0f04,_0x52f783,_0x26f90e){_0x26f90e(null,util[_0x5a3d('0x18')](_0x5a3d('0x21'),'preferred',path[_0x5a3d('0x23')](_0x52f783['originalname'])));}})});router['post'](_0x5a3d('0x12'),upload[_0x5a3d('0x1d')](_0x5a3d('0x1e')),controller[_0x5a3d('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39824f,_0x407eb3,_0x15e3e8){_0x15e3e8(null,path['join'](config[_0x5a3d('0x16')],_0x5a3d('0x17')));},'filename':function(_0xd6cc3b,_0x23635c,_0x30c9d6){_0x30c9d6(null,util[_0x5a3d('0x18')]('%s%s',_0x5a3d('0x25'),path['extname'](_0x23635c[_0x5a3d('0x1a')])));}})});router['post'](_0x5a3d('0x13'),upload[_0x5a3d('0x1d')]('file'),controller[_0x5a3d('0x26')]);router['put'](_0x5a3d('0xc'),auth[_0x5a3d('0x27')](),controller[_0x5a3d('0x28')]);module[_0x5a3d('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 5b4d1d0..a6cb0ed 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x4bbb6f,_0x5edc17){var _0x3582f4=function(_0x4c9d52){while(--_0x4c9d52){_0x4bbb6f['push'](_0x4bbb6f['shift']());}};_0x3582f4(++_0x5edc17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x181bfa,_0x5c072c){var _0x524654=function(_0x5be814){while(--_0x5be814){_0x181bfa['push'](_0x181bfa['shift']());}};_0x524654(++_0x5c072c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index e79a99b..8a877b5 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 _0xecd9=['reject','then','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','find','update','body','addLogo','file','logo','filename','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLoginLogo','default','default_loginLogo.svg','securePassword','preferred','getPreferred','defaultPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x1ae93b,_0x5a91df){var _0x4c3c22=function(_0x47370d){while(--_0x47370d){_0x1ae93b['push'](_0x1ae93b['shift']());}};_0x4c3c22(++_0x5a91df);}(_0xecd9,0x13f));var _0x9ecd=function(_0x448f39,_0x34f2bb){_0x448f39=_0x448f39-0x0;var _0x30da64=_0xecd9[_0x448f39];return _0x30da64;};'use strict';var emlformat=require(_0x9ecd('0x0'));var rimraf=require(_0x9ecd('0x1'));var zipdir=require(_0x9ecd('0x2'));var jsonpatch=require(_0x9ecd('0x3'));var rp=require(_0x9ecd('0x4'));var moment=require(_0x9ecd('0x5'));var BPromise=require(_0x9ecd('0x6'));var Mustache=require(_0x9ecd('0x7'));var util=require('util');var path=require(_0x9ecd('0x8'));var sox=require(_0x9ecd('0x9'));var csv=require(_0x9ecd('0xa'));var ejs=require(_0x9ecd('0xb'));var fs=require('fs');var fs_extra=require(_0x9ecd('0xc'));var _=require('lodash');var squel=require(_0x9ecd('0xd'));var crypto=require(_0x9ecd('0xe'));var jsforce=require(_0x9ecd('0xf'));var deskjs=require(_0x9ecd('0x10'));var toCsv=require(_0x9ecd('0xa'));var querystring=require(_0x9ecd('0x11'));var Papa=require(_0x9ecd('0x12'));var Redis=require(_0x9ecd('0x13'));var authService=require(_0x9ecd('0x14'));var qs=require(_0x9ecd('0x15'));var as=require(_0x9ecd('0x16'));var hardwareService=require(_0x9ecd('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x9ecd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9ecd('0x19'));var db=require(_0x9ecd('0x1a'))['db'];var jayson=require(_0x9ecd('0x1b'));var client=jayson[_0x9ecd('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ff91c,_0x2907e8,_0x1ff37c,_0x24270c){return new BPromise(function(_0x4f2ef4,_0x294067){var _0x11dce2=_0x24270c||client;return _0x11dce2[_0x9ecd('0x1d')](_0x5ff91c,_0x1ff37c)['then'](function(_0x3e8ce1){logger[_0x9ecd('0x1e')](_0x9ecd('0x1f'),_0x2907e8,_0x9ecd('0x20'));logger[_0x9ecd('0x21')]('Setting,\x20%s,\x20%s,\x20%s',_0x2907e8,_0x9ecd('0x20'),JSON[_0x9ecd('0x22')](_0x3e8ce1));if(_0x3e8ce1[_0x9ecd('0x23')]){if(_0x3e8ce1[_0x9ecd('0x23')][_0x9ecd('0x24')]===0x1f4){logger[_0x9ecd('0x23')](_0x9ecd('0x1f'),_0x2907e8,_0x3e8ce1[_0x9ecd('0x23')][_0x9ecd('0x25')]);return _0x294067(_0x3e8ce1[_0x9ecd('0x23')][_0x9ecd('0x25')]);}logger[_0x9ecd('0x23')]('Setting,\x20%s,\x20%s',_0x2907e8,_0x3e8ce1[_0x9ecd('0x23')][_0x9ecd('0x25')]);return _0x4f2ef4(_0x3e8ce1['error'][_0x9ecd('0x25')]);}else{logger[_0x9ecd('0x1e')](_0x9ecd('0x1f'),_0x2907e8,'request\x20sent');_0x4f2ef4(_0x3e8ce1[_0x9ecd('0x26')][_0x9ecd('0x25')]);}})[_0x9ecd('0x27')](function(_0x275a94){logger[_0x9ecd('0x23')](_0x9ecd('0x1f'),_0x2907e8,_0x275a94);_0x294067(_0x275a94);});});}function respondWithStatusCode(_0x2485cf,_0x284341){_0x284341=_0x284341||0xcc;return function(_0x575ec4){if(_0x575ec4){return _0x2485cf[_0x9ecd('0x28')](_0x284341);}return _0x2485cf[_0x9ecd('0x29')](_0x284341)['end']();};}function respondWithResult(_0x3a4e2a,_0x28e541){_0x28e541=_0x28e541||0xc8;return function(_0x6d44cf){if(_0x6d44cf){return _0x3a4e2a[_0x9ecd('0x29')](_0x28e541)['json'](_0x6d44cf);}};}function respondWithFilteredResult(_0x1522ab,_0x52be78){return function(_0x54d9ae){if(_0x54d9ae){var _0x1df783=typeof _0x52be78[_0x9ecd('0x2a')]===_0x9ecd('0x2b')&&typeof _0x52be78[_0x9ecd('0x2c')]===_0x9ecd('0x2b');var _0x504784=_0x54d9ae[_0x9ecd('0x2d')];var _0x2de3b1=_0x1df783?0x0:_0x52be78[_0x9ecd('0x2a')];var _0x5b7e6d=_0x1df783?_0x54d9ae[_0x9ecd('0x2d')]:_0x52be78[_0x9ecd('0x2a')]+_0x52be78[_0x9ecd('0x2c')];var _0x4c6401;if(_0x5b7e6d>=_0x504784){_0x5b7e6d=_0x504784;_0x4c6401=0xc8;}else{_0x4c6401=0xce;}_0x1522ab[_0x9ecd('0x29')](_0x4c6401);return _0x1522ab[_0x9ecd('0x2e')](_0x9ecd('0x2f'),_0x2de3b1+'-'+_0x5b7e6d+'/'+_0x504784)[_0x9ecd('0x30')](_0x54d9ae);}return null;};}function patchUpdates(_0x4f0471){return function(_0x4a94ad){try{jsonpatch[_0x9ecd('0x31')](_0x4a94ad,_0x4f0471,!![]);}catch(_0x44de61){return BPromise[_0x9ecd('0x32')](_0x44de61);}return _0x4a94ad['save']();};}function saveUpdates(_0x35e9b6,_0x5e7fde){return function(_0x28f965){if(_0x28f965){return _0x28f965['update'](_0x35e9b6)[_0x9ecd('0x33')](function(_0x195145){return _0x195145;});}return null;};}function removeEntity(_0x4c614b,_0x57f1bb){return function(_0x29b0ed){if(_0x29b0ed){return _0x29b0ed['destroy']()[_0x9ecd('0x33')](function(){_0x4c614b[_0x9ecd('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x538991,_0x51cc82){return function(_0x4ca56d){if(!_0x4ca56d){_0x538991[_0x9ecd('0x28')](0x194);}return _0x4ca56d;};}function handleError(_0x467f99,_0x2a1f12){_0x2a1f12=_0x2a1f12||0x1f4;return function(_0x5bcdae){logger[_0x9ecd('0x23')](_0x5bcdae['stack']);if(_0x5bcdae[_0x9ecd('0x34')]){delete _0x5bcdae[_0x9ecd('0x34')];}_0x467f99[_0x9ecd('0x29')](_0x2a1f12)[_0x9ecd('0x35')](_0x5bcdae);};}exports[_0x9ecd('0x36')]=function(_0x376a70,_0x42cede){var _0x50aafb={},_0x5a2e19={},_0x1ffb23={'count':0x0,'rows':[]};var _0x4b1d67=_[_0x9ecd('0x37')](db[_0x9ecd('0x38')][_0x9ecd('0x39')],function(_0x173d6c){return{'name':_0x173d6c[_0x9ecd('0x3a')],'type':_0x173d6c['type'][_0x9ecd('0x3b')]};});_0x5a2e19[_0x9ecd('0x3c')]=_[_0x9ecd('0x37')](_0x4b1d67,_0x9ecd('0x34'));_0x5a2e19[_0x9ecd('0x3d')]=_[_0x9ecd('0x3e')](_0x376a70[_0x9ecd('0x3d')]);_0x5a2e19[_0x9ecd('0x3f')]=_[_0x9ecd('0x40')](_0x5a2e19['model'],_0x5a2e19[_0x9ecd('0x3d')]);_0x50aafb[_0x9ecd('0x41')]=_[_0x9ecd('0x40')](_0x5a2e19['model'],qs[_0x9ecd('0x42')](_0x376a70[_0x9ecd('0x3d')][_0x9ecd('0x42')]));_0x50aafb[_0x9ecd('0x41')]=_0x50aafb['attributes'][_0x9ecd('0x43')]?_0x50aafb[_0x9ecd('0x41')]:_0x5a2e19[_0x9ecd('0x3c')];if(!_0x376a70[_0x9ecd('0x3d')]['hasOwnProperty'](_0x9ecd('0x44'))){_0x50aafb['limit']=qs[_0x9ecd('0x2c')](_0x376a70['query'][_0x9ecd('0x2c')]);_0x50aafb['offset']=qs['offset'](_0x376a70[_0x9ecd('0x3d')][_0x9ecd('0x2a')]);}_0x50aafb[_0x9ecd('0x45')]=qs['sort'](_0x376a70[_0x9ecd('0x3d')][_0x9ecd('0x46')]);_0x50aafb[_0x9ecd('0x47')]=qs[_0x9ecd('0x3f')](_[_0x9ecd('0x48')](_0x376a70[_0x9ecd('0x3d')],_0x5a2e19[_0x9ecd('0x3f')]),_0x4b1d67);if(_0x376a70['query'][_0x9ecd('0x49')]){_0x50aafb[_0x9ecd('0x47')]=_[_0x9ecd('0x4a')](_0x50aafb[_0x9ecd('0x47')],{'$or':_[_0x9ecd('0x37')](_0x4b1d67,function(_0x310f3b){if(_0x310f3b[_0x9ecd('0x4b')]!==_0x9ecd('0x4c')){var _0x1089bc={};_0x1089bc[_0x310f3b['name']]={'$like':'%'+_0x376a70[_0x9ecd('0x3d')]['filter']+'%'};return _0x1089bc;}})});}_0x50aafb=_[_0x9ecd('0x4a')]({},_0x50aafb,_0x376a70[_0x9ecd('0x4d')]);var _0x265177={'where':_0x50aafb[_0x9ecd('0x47')]};return db['Setting'][_0x9ecd('0x2d')](_0x265177)['then'](function(_0x578e7f){_0x1ffb23['count']=_0x578e7f;if(_0x376a70[_0x9ecd('0x3d')][_0x9ecd('0x4e')]){_0x50aafb['include']=[{'all':!![]}];}return db[_0x9ecd('0x38')][_0x9ecd('0x4f')](_0x50aafb);})['then'](function(_0x31c294){_0x1ffb23[_0x9ecd('0x50')]=_0x31c294;return _0x1ffb23;})['then'](respondWithFilteredResult(_0x42cede,_0x50aafb))['catch'](handleError(_0x42cede,null));};exports[_0x9ecd('0x51')]=function(_0x4b9a16,_0x2c4fd8){var _0x5b8315={'raw':![],'where':{'id':_0x4b9a16[_0x9ecd('0x52')]['id']}},_0x9c5563={};_0x9c5563['model']=_[_0x9ecd('0x3e')](db['Setting'][_0x9ecd('0x39')]);_0x9c5563[_0x9ecd('0x3d')]=_['keys'](_0x4b9a16[_0x9ecd('0x3d')]);_0x9c5563[_0x9ecd('0x3f')]=_[_0x9ecd('0x40')](_0x9c5563[_0x9ecd('0x3c')],_0x9c5563['query']);_0x5b8315[_0x9ecd('0x41')]=_['intersection'](_0x9c5563[_0x9ecd('0x3c')],qs[_0x9ecd('0x42')](_0x4b9a16['query'][_0x9ecd('0x42')]));_0x5b8315[_0x9ecd('0x41')]=_0x5b8315[_0x9ecd('0x41')]['length']?_0x5b8315[_0x9ecd('0x41')]:_0x9c5563[_0x9ecd('0x3c')];if(_0x4b9a16[_0x9ecd('0x3d')][_0x9ecd('0x4e')]){_0x5b8315['include']=[{'all':!![]}];}_0x5b8315=_[_0x9ecd('0x4a')]({},_0x5b8315,_0x4b9a16[_0x9ecd('0x4d')]);return db[_0x9ecd('0x38')][_0x9ecd('0x53')](_0x5b8315)[_0x9ecd('0x33')](handleEntityNotFound(_0x2c4fd8,null))[_0x9ecd('0x33')](respondWithResult(_0x2c4fd8,null))[_0x9ecd('0x27')](handleError(_0x2c4fd8,null));};exports[_0x9ecd('0x54')]=function(_0xc1e84d,_0x3a7ebc){if(_0xc1e84d[_0x9ecd('0x55')]['id']){delete _0xc1e84d[_0x9ecd('0x55')]['id'];}return db[_0x9ecd('0x38')]['find']({'where':{'id':_0xc1e84d[_0x9ecd('0x52')]['id']}})[_0x9ecd('0x33')](handleEntityNotFound(_0x3a7ebc,null))[_0x9ecd('0x33')](saveUpdates(_0xc1e84d['body'],null))[_0x9ecd('0x33')](respondWithResult(_0x3a7ebc,null))[_0x9ecd('0x27')](handleError(_0x3a7ebc,null));};exports[_0x9ecd('0x56')]=function(_0x3367,_0x1d3d63,_0x399c3c){if(_0x3367[_0x9ecd('0x57')]&&_0x3367[_0x9ecd('0x57')]['filename']){_0x3367[_0x9ecd('0x55')][_0x9ecd('0x58')]=_0x3367['file'][_0x9ecd('0x59')];}return db[_0x9ecd('0x38')][_0x9ecd('0x53')]({'where':{'id':_0x3367['params']['id']}})[_0x9ecd('0x33')](handleEntityNotFound(_0x1d3d63,null))['then'](saveUpdates(_0x3367[_0x9ecd('0x55')],null))[_0x9ecd('0x33')](respondWithResult(_0x1d3d63,null))[_0x9ecd('0x27')](handleError(_0x1d3d63,null));};exports['addLogoLogin']=function(_0x35b61b,_0x181479,_0x477b04){if(_0x35b61b['file']&&_0x35b61b['file'][_0x9ecd('0x59')]){_0x35b61b['body'][_0x9ecd('0x5a')]=_0x35b61b[_0x9ecd('0x57')][_0x9ecd('0x59')];}return db[_0x9ecd('0x38')][_0x9ecd('0x53')]({'where':{'id':_0x35b61b['params']['id']}})[_0x9ecd('0x33')](handleEntityNotFound(_0x181479,null))[_0x9ecd('0x33')](saveUpdates(_0x35b61b[_0x9ecd('0x55')],null))[_0x9ecd('0x33')](respondWithResult(_0x181479,null))[_0x9ecd('0x27')](handleError(_0x181479,null));};var utilLicense=require(_0x9ecd('0x19'));exports[_0x9ecd('0x5b')]=function(_0x37a8a0,_0x36c081,_0x1b4ac6){var _0x39aac5=_0x9ecd('0x5c');var _0x935814={'custom':![]};return utilLicense[_0x9ecd('0x5d')]()[_0x9ecd('0x33')](function(_0x11fe5a){if(_0x11fe5a){_0x935814=_0x11fe5a;}return db[_0x9ecd('0x38')]['find']({'where':{'id':_0x37a8a0[_0x9ecd('0x52')]['id']},'attributes':[_0x9ecd('0x58'),_0x9ecd('0x5a'),'preferred',_0x9ecd('0x5e'),_0x9ecd('0x5f'),'defaultLoginLogo','defaultPreferred',_0x9ecd('0x60')],'raw':!![]});})[_0x9ecd('0x33')](handleEntityNotFound(_0x36c081,null))['then'](function(_0x14fda6){if(_0x14fda6){var _0x29c962=_0x14fda6[_0x9ecd('0x58')]&&fs[_0x9ecd('0x61')](path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x39aac5,_[_0x9ecd('0x64')](_0x14fda6[_0x9ecd('0x58')])))?path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x39aac5,_[_0x9ecd('0x64')](_0x14fda6[_0x9ecd('0x58')])):path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x39aac5,_[_0x9ecd('0x64')](_0x9ecd('0x65')));var _0x5ddd4f='default'+_[_0x9ecd('0x66')](_0x9ecd('0x58'));if(_0x14fda6[_0x5ddd4f]||!_0x935814[_0x9ecd('0x67')]){_0x29c962=path['join'](config[_0x9ecd('0x63')],_0x39aac5,_[_0x9ecd('0x64')](_0x9ecd('0x65')));}if(!fs[_0x9ecd('0x61')](_0x29c962)){throw new db[(_0x9ecd('0x68'))][(_0x9ecd('0x69'))](_[_0x9ecd('0x66')](_0x9ecd('0x58'))+_0x9ecd('0x6a'));}return _0x36c081[_0x9ecd('0x6b')](_0x29c962);}})['catch'](handleError(_0x36c081,null));};var utilLicense=require(_0x9ecd('0x19'));exports[_0x9ecd('0x6c')]=function(_0x3e1375,_0x1d2fb6,_0x426cf4){var _0x1a0e7d='server/files/images/logos';var _0x21c605={'custom':![]};return utilLicense[_0x9ecd('0x5d')]()['then'](function(_0x59b8c4){if(_0x59b8c4){_0x21c605=_0x59b8c4;}return db[_0x9ecd('0x38')]['find']({'where':{'id':_0x3e1375['params']['id']},'attributes':['logo',_0x9ecd('0x5a'),'preferred',_0x9ecd('0x5e'),'defaultLogo',_0x9ecd('0x6d'),'defaultPreferred',_0x9ecd('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x1d2fb6,null))[_0x9ecd('0x33')](function(_0x4749a8){if(_0x4749a8){var _0x4f793a=_0x4749a8['loginLogo']&&fs[_0x9ecd('0x61')](path['join'](config['root'],_0x1a0e7d,_[_0x9ecd('0x64')](_0x4749a8[_0x9ecd('0x5a')])))?path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x1a0e7d,_[_0x9ecd('0x64')](_0x4749a8['loginLogo'])):path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x1a0e7d,_['toLower']('default_loginLogo.svg'));var _0x597815=_0x9ecd('0x6e')+_[_0x9ecd('0x66')](_0x9ecd('0x5a'));if(_0x4749a8[_0x597815]||!_0x21c605[_0x9ecd('0x67')]){_0x4f793a=path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x1a0e7d,_[_0x9ecd('0x64')](_0x9ecd('0x6f')));}if(!fs[_0x9ecd('0x61')](_0x4f793a)){throw new db[(_0x9ecd('0x68'))]['ValidationError'](_[_0x9ecd('0x66')](_0x9ecd('0x5a'))+_0x9ecd('0x6a'));}return _0x1d2fb6['download'](_0x4f793a);}})[_0x9ecd('0x27')](handleError(_0x1d2fb6,null));};exports['gdpr']=function(_0x10b7a3,_0x4d815d){return db[_0x9ecd('0x38')]['find']({'where':{'id':_0x10b7a3[_0x9ecd('0x52')]['id']},'attributes':[_0x9ecd('0x70')]})['then'](respondWithResult(_0x4d815d,null))[_0x9ecd('0x27')](handleError(_0x4d815d,null));};exports['addPreferred']=function(_0x497e5d,_0x12e826,_0xd7091f){if(_0x497e5d[_0x9ecd('0x57')]&&_0x497e5d['file'][_0x9ecd('0x59')]){_0x497e5d[_0x9ecd('0x55')][_0x9ecd('0x71')]=_0x497e5d[_0x9ecd('0x57')][_0x9ecd('0x59')];}return db[_0x9ecd('0x38')][_0x9ecd('0x53')]({'where':{'id':_0x497e5d[_0x9ecd('0x52')]['id']}})[_0x9ecd('0x33')](handleEntityNotFound(_0x12e826,null))[_0x9ecd('0x33')](saveUpdates(_0x497e5d['body'],null))['then'](respondWithResult(_0x12e826,null))[_0x9ecd('0x27')](handleError(_0x12e826,null));};var utilLicense=require(_0x9ecd('0x19'));exports[_0x9ecd('0x72')]=function(_0x1e9a6c,_0x5d91c1,_0x3f93c5){var _0x47893b=_0x9ecd('0x5c');var _0x3a56c4={'custom':![]};return utilLicense[_0x9ecd('0x5d')]()['then'](function(_0x10f78c){if(_0x10f78c){_0x3a56c4=_0x10f78c;}return db[_0x9ecd('0x38')]['find']({'where':{'id':_0x1e9a6c[_0x9ecd('0x52')]['id']},'attributes':[_0x9ecd('0x58'),_0x9ecd('0x5a'),_0x9ecd('0x71'),_0x9ecd('0x5e'),'defaultLogo',_0x9ecd('0x6d'),_0x9ecd('0x73'),_0x9ecd('0x60')],'raw':!![]});})[_0x9ecd('0x33')](handleEntityNotFound(_0x5d91c1,null))[_0x9ecd('0x33')](function(_0x14cddb){if(_0x14cddb){var _0x7aee1c=_0x14cddb[_0x9ecd('0x71')]&&fs[_0x9ecd('0x61')](path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x47893b,_[_0x9ecd('0x64')](_0x14cddb[_0x9ecd('0x71')])))?path['join'](config['root'],_0x47893b,_[_0x9ecd('0x64')](_0x14cddb[_0x9ecd('0x71')])):path['join'](config[_0x9ecd('0x63')],_0x47893b,_[_0x9ecd('0x64')](_0x9ecd('0x74')));var _0x3f3206=_0x9ecd('0x6e')+_[_0x9ecd('0x66')](_0x9ecd('0x71'));if(_0x14cddb[_0x3f3206]||!_0x3a56c4[_0x9ecd('0x67')]||!_0x3a56c4[_0x9ecd('0x71')]){_0x7aee1c=path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x47893b,_['toLower']('default_preferred.png'));}if(!fs[_0x9ecd('0x61')](_0x7aee1c)){throw new db[(_0x9ecd('0x68'))][(_0x9ecd('0x69'))](_[_0x9ecd('0x66')](_0x9ecd('0x71'))+'\x20not\x20found');}return _0x5d91c1[_0x9ecd('0x6b')](_0x7aee1c);}})[_0x9ecd('0x27')](handleError(_0x5d91c1,null));};exports[_0x9ecd('0x75')]=function(_0x562d2c,_0x4513e4,_0x38fcef){if(_0x562d2c[_0x9ecd('0x57')]&&_0x562d2c[_0x9ecd('0x57')][_0x9ecd('0x59')]){_0x562d2c[_0x9ecd('0x55')]['favicon']=_0x562d2c[_0x9ecd('0x57')]['filename'];}return db[_0x9ecd('0x38')][_0x9ecd('0x53')]({'where':{'id':_0x562d2c[_0x9ecd('0x52')]['id']}})[_0x9ecd('0x33')](handleEntityNotFound(_0x4513e4,null))['then'](saveUpdates(_0x562d2c['body'],null))['then'](respondWithResult(_0x4513e4,null))[_0x9ecd('0x27')](handleError(_0x4513e4,null));};var utilLicense=require('../../config/license/util');exports[_0x9ecd('0x76')]=function(_0x329e47,_0x266d87,_0x72e355){var _0x49c16c=_0x9ecd('0x5c');var _0x375be6={'custom':![]};return utilLicense[_0x9ecd('0x5d')]()[_0x9ecd('0x33')](function(_0xa67126){if(_0xa67126){_0x375be6=_0xa67126;}return db[_0x9ecd('0x38')][_0x9ecd('0x53')]({'where':{'id':_0x329e47[_0x9ecd('0x52')]['id']},'attributes':[_0x9ecd('0x58'),_0x9ecd('0x5a'),_0x9ecd('0x71'),_0x9ecd('0x5e'),_0x9ecd('0x5f'),_0x9ecd('0x6d'),_0x9ecd('0x73'),'defaultFavicon'],'raw':!![]});})[_0x9ecd('0x33')](handleEntityNotFound(_0x266d87,null))[_0x9ecd('0x33')](function(_0x31e247){if(_0x31e247){var _0x129677=_0x31e247['favicon']&&fs[_0x9ecd('0x61')](path['join'](config[_0x9ecd('0x63')],_0x49c16c,_[_0x9ecd('0x64')](_0x31e247[_0x9ecd('0x5e')])))?path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x49c16c,_[_0x9ecd('0x64')](_0x31e247[_0x9ecd('0x5e')])):path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x49c16c,_[_0x9ecd('0x64')](_0x9ecd('0x77')));var _0x112231='default'+_[_0x9ecd('0x66')](_0x9ecd('0x5e'));if(_0x31e247[_0x112231]||!_0x375be6[_0x9ecd('0x67')]){_0x129677=path[_0x9ecd('0x62')](config[_0x9ecd('0x63')],_0x49c16c,_['toLower'](_0x9ecd('0x77')));}if(!fs['existsSync'](_0x129677)){throw new db[(_0x9ecd('0x68'))][(_0x9ecd('0x69'))](_[_0x9ecd('0x66')](_0x9ecd('0x5e'))+_0x9ecd('0x6a'));}return _0x266d87['download'](_0x129677);}})[_0x9ecd('0x27')](handleError(_0x266d87,null));};exports['getDate']=function(_0x54d341,_0x25258e){var _0x285468={'offset':moment()[_0x9ecd('0x78')]()};_0x285468[_0x9ecd('0x79')]=moment()[_0x9ecd('0x78')](_0x285468[_0x9ecd('0x2a')])['format'](_0x9ecd('0x7a'));return _0x25258e['status'](0xc8)[_0x9ecd('0x35')](_0x285468);}; \ No newline at end of file +var _0x2bd6=['getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','update','destroy','stack','name','index','Setting','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','params','includeAll','body','find','addLogo','file','filename','logo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','upperFirst','custom','download','server/files/images/logos','loginLogo','default_loginLogo.svg','default','Sequelize','\x20not\x20found','gdpr','securePassword','addPreferred','default_preferred.png','ValidationError','addFavicon','getFavicon','default_favicon.ico'];(function(_0x237c45,_0x55cf99){var _0x2942f6=function(_0x45a615){while(--_0x45a615){_0x237c45['push'](_0x237c45['shift']());}};_0x2942f6(++_0x55cf99);}(_0x2bd6,0x16d));var _0x62bd=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x2bd6[_0x25efdf];return _0x22c495;};'use strict';var emlformat=require(_0x62bd('0x0'));var rimraf=require(_0x62bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62bd('0x2'));var rp=require(_0x62bd('0x3'));var moment=require(_0x62bd('0x4'));var BPromise=require(_0x62bd('0x5'));var Mustache=require('mustache');var util=require(_0x62bd('0x6'));var path=require(_0x62bd('0x7'));var sox=require('sox');var csv=require(_0x62bd('0x8'));var ejs=require(_0x62bd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x62bd('0xa'));var crypto=require(_0x62bd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x62bd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x62bd('0xd'));var Papa=require(_0x62bd('0xe'));var Redis=require(_0x62bd('0xf'));var authService=require(_0x62bd('0x10'));var qs=require(_0x62bd('0x11'));var as=require(_0x62bd('0x12'));var hardwareService=require(_0x62bd('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x62bd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x62bd('0x15'));var db=require(_0x62bd('0x16'))['db'];var jayson=require(_0x62bd('0x17'));var client=jayson['client'][_0x62bd('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x389305,_0x1325b6,_0xc35cce,_0x140ff6){return new BPromise(function(_0x22f4f3,_0x272c91){var _0x35fcf2=_0x140ff6||client;return _0x35fcf2[_0x62bd('0x19')](_0x389305,_0xc35cce)[_0x62bd('0x1a')](function(_0x468772){logger['info'](_0x62bd('0x1b'),_0x1325b6,'request\x20sent');logger['debug'](_0x62bd('0x1c'),_0x1325b6,_0x62bd('0x1d'),JSON[_0x62bd('0x1e')](_0x468772));if(_0x468772[_0x62bd('0x1f')]){if(_0x468772[_0x62bd('0x1f')][_0x62bd('0x20')]===0x1f4){logger[_0x62bd('0x1f')](_0x62bd('0x1b'),_0x1325b6,_0x468772[_0x62bd('0x1f')][_0x62bd('0x21')]);return _0x272c91(_0x468772['error']['message']);}logger['error'](_0x62bd('0x1b'),_0x1325b6,_0x468772[_0x62bd('0x1f')][_0x62bd('0x21')]);return _0x22f4f3(_0x468772[_0x62bd('0x1f')][_0x62bd('0x21')]);}else{logger[_0x62bd('0x22')](_0x62bd('0x1b'),_0x1325b6,_0x62bd('0x1d'));_0x22f4f3(_0x468772[_0x62bd('0x23')]['message']);}})[_0x62bd('0x24')](function(_0x5d8b14){logger[_0x62bd('0x1f')](_0x62bd('0x1b'),_0x1325b6,_0x5d8b14);_0x272c91(_0x5d8b14);});});}function respondWithStatusCode(_0x4ebe4c,_0x589e76){_0x589e76=_0x589e76||0xcc;return function(_0x49a4fd){if(_0x49a4fd){return _0x4ebe4c[_0x62bd('0x25')](_0x589e76);}return _0x4ebe4c['status'](_0x589e76)['end']();};}function respondWithResult(_0xd638bb,_0x50a313){_0x50a313=_0x50a313||0xc8;return function(_0x198192){if(_0x198192){return _0xd638bb['status'](_0x50a313)[_0x62bd('0x26')](_0x198192);}};}function respondWithFilteredResult(_0x3927ae,_0x1f037e){return function(_0x298aff){if(_0x298aff){var _0x12bb27=typeof _0x1f037e['offset']===_0x62bd('0x27')&&typeof _0x1f037e[_0x62bd('0x28')]===_0x62bd('0x27');var _0x5950a9=_0x298aff['count'];var _0x2eb36b=_0x12bb27?0x0:_0x1f037e['offset'];var _0x17992f=_0x12bb27?_0x298aff[_0x62bd('0x29')]:_0x1f037e[_0x62bd('0x2a')]+_0x1f037e['limit'];var _0x496835;if(_0x17992f>=_0x5950a9){_0x17992f=_0x5950a9;_0x496835=0xc8;}else{_0x496835=0xce;}_0x3927ae[_0x62bd('0x2b')](_0x496835);return _0x3927ae[_0x62bd('0x2c')](_0x62bd('0x2d'),_0x2eb36b+'-'+_0x17992f+'/'+_0x5950a9)[_0x62bd('0x26')](_0x298aff);}return null;};}function patchUpdates(_0x3b05a3){return function(_0x3d5b2c){try{jsonpatch[_0x62bd('0x2e')](_0x3d5b2c,_0x3b05a3,!![]);}catch(_0x1b29a2){return BPromise[_0x62bd('0x2f')](_0x1b29a2);}return _0x3d5b2c['save']();};}function saveUpdates(_0x432360,_0x2602fe){return function(_0x3bb623){if(_0x3bb623){return _0x3bb623[_0x62bd('0x30')](_0x432360)[_0x62bd('0x1a')](function(_0x2f03f4){return _0x2f03f4;});}return null;};}function removeEntity(_0x1b4c62,_0x50ecad){return function(_0x4c7ad7){if(_0x4c7ad7){return _0x4c7ad7[_0x62bd('0x31')]()['then'](function(){_0x1b4c62[_0x62bd('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24f90b,_0x564326){return function(_0x3be103){if(!_0x3be103){_0x24f90b[_0x62bd('0x25')](0x194);}return _0x3be103;};}function handleError(_0x256b6e,_0x1873cc){_0x1873cc=_0x1873cc||0x1f4;return function(_0x2959a7){logger[_0x62bd('0x1f')](_0x2959a7[_0x62bd('0x32')]);if(_0x2959a7[_0x62bd('0x33')]){delete _0x2959a7[_0x62bd('0x33')];}_0x256b6e[_0x62bd('0x2b')](_0x1873cc)['send'](_0x2959a7);};}exports[_0x62bd('0x34')]=function(_0xb6586d,_0x192a5e){var _0x5ebacb={},_0x401c9a={},_0x2de4e6={'count':0x0,'rows':[]};var _0x3e0499=_['map'](db[_0x62bd('0x35')][_0x62bd('0x36')],function(_0x32d38e){return{'name':_0x32d38e[_0x62bd('0x37')],'type':_0x32d38e[_0x62bd('0x38')][_0x62bd('0x39')]};});_0x401c9a[_0x62bd('0x3a')]=_[_0x62bd('0x3b')](_0x3e0499,_0x62bd('0x33'));_0x401c9a[_0x62bd('0x3c')]=_[_0x62bd('0x3d')](_0xb6586d[_0x62bd('0x3c')]);_0x401c9a['filters']=_[_0x62bd('0x3e')](_0x401c9a[_0x62bd('0x3a')],_0x401c9a['query']);_0x5ebacb[_0x62bd('0x3f')]=_['intersection'](_0x401c9a[_0x62bd('0x3a')],qs['fields'](_0xb6586d[_0x62bd('0x3c')][_0x62bd('0x40')]));_0x5ebacb[_0x62bd('0x3f')]=_0x5ebacb[_0x62bd('0x3f')][_0x62bd('0x41')]?_0x5ebacb['attributes']:_0x401c9a[_0x62bd('0x3a')];if(!_0xb6586d[_0x62bd('0x3c')][_0x62bd('0x42')](_0x62bd('0x43'))){_0x5ebacb['limit']=qs[_0x62bd('0x28')](_0xb6586d[_0x62bd('0x3c')]['limit']);_0x5ebacb[_0x62bd('0x2a')]=qs[_0x62bd('0x2a')](_0xb6586d['query'][_0x62bd('0x2a')]);}_0x5ebacb['order']=qs[_0x62bd('0x44')](_0xb6586d[_0x62bd('0x3c')]['sort']);_0x5ebacb[_0x62bd('0x45')]=qs[_0x62bd('0x46')](_[_0x62bd('0x47')](_0xb6586d[_0x62bd('0x3c')],_0x401c9a[_0x62bd('0x46')]),_0x3e0499);if(_0xb6586d[_0x62bd('0x3c')][_0x62bd('0x48')]){_0x5ebacb[_0x62bd('0x45')]=_[_0x62bd('0x49')](_0x5ebacb[_0x62bd('0x45')],{'$or':_[_0x62bd('0x3b')](_0x3e0499,function(_0x4c29fc){if(_0x4c29fc[_0x62bd('0x38')]!==_0x62bd('0x4a')){var _0x1ceccf={};_0x1ceccf[_0x4c29fc[_0x62bd('0x33')]]={'$like':'%'+_0xb6586d[_0x62bd('0x3c')]['filter']+'%'};return _0x1ceccf;}})});}_0x5ebacb=_[_0x62bd('0x49')]({},_0x5ebacb,_0xb6586d[_0x62bd('0x4b')]);var _0x4e7cd2={'where':_0x5ebacb[_0x62bd('0x45')]};return db[_0x62bd('0x35')]['count'](_0x4e7cd2)[_0x62bd('0x1a')](function(_0x57e526){_0x2de4e6[_0x62bd('0x29')]=_0x57e526;if(_0xb6586d[_0x62bd('0x3c')]['includeAll']){_0x5ebacb[_0x62bd('0x4c')]=[{'all':!![]}];}return db[_0x62bd('0x35')]['findAll'](_0x5ebacb);})[_0x62bd('0x1a')](function(_0x4d5a00){_0x2de4e6['rows']=_0x4d5a00;return _0x2de4e6;})[_0x62bd('0x1a')](respondWithFilteredResult(_0x192a5e,_0x5ebacb))[_0x62bd('0x24')](handleError(_0x192a5e,null));};exports[_0x62bd('0x4d')]=function(_0x2b55ea,_0x663599){var _0x410049={'raw':![],'where':{'id':_0x2b55ea[_0x62bd('0x4e')]['id']}},_0x1eadd6={};_0x1eadd6[_0x62bd('0x3a')]=_[_0x62bd('0x3d')](db['Setting'][_0x62bd('0x36')]);_0x1eadd6[_0x62bd('0x3c')]=_[_0x62bd('0x3d')](_0x2b55ea[_0x62bd('0x3c')]);_0x1eadd6[_0x62bd('0x46')]=_['intersection'](_0x1eadd6[_0x62bd('0x3a')],_0x1eadd6[_0x62bd('0x3c')]);_0x410049['attributes']=_[_0x62bd('0x3e')](_0x1eadd6['model'],qs[_0x62bd('0x40')](_0x2b55ea[_0x62bd('0x3c')][_0x62bd('0x40')]));_0x410049[_0x62bd('0x3f')]=_0x410049[_0x62bd('0x3f')][_0x62bd('0x41')]?_0x410049[_0x62bd('0x3f')]:_0x1eadd6[_0x62bd('0x3a')];if(_0x2b55ea['query'][_0x62bd('0x4f')]){_0x410049[_0x62bd('0x4c')]=[{'all':!![]}];}_0x410049=_[_0x62bd('0x49')]({},_0x410049,_0x2b55ea[_0x62bd('0x4b')]);return db['Setting']['find'](_0x410049)[_0x62bd('0x1a')](handleEntityNotFound(_0x663599,null))[_0x62bd('0x1a')](respondWithResult(_0x663599,null))[_0x62bd('0x24')](handleError(_0x663599,null));};exports[_0x62bd('0x30')]=function(_0xb9ca72,_0x4656e1){if(_0xb9ca72[_0x62bd('0x50')]['id']){delete _0xb9ca72['body']['id'];}return db[_0x62bd('0x35')][_0x62bd('0x51')]({'where':{'id':_0xb9ca72[_0x62bd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4656e1,null))[_0x62bd('0x1a')](saveUpdates(_0xb9ca72['body'],null))[_0x62bd('0x1a')](respondWithResult(_0x4656e1,null))[_0x62bd('0x24')](handleError(_0x4656e1,null));};exports[_0x62bd('0x52')]=function(_0x22e677,_0x452a97,_0x5974d0){if(_0x22e677[_0x62bd('0x53')]&&_0x22e677['file'][_0x62bd('0x54')]){_0x22e677[_0x62bd('0x50')][_0x62bd('0x55')]=_0x22e677[_0x62bd('0x53')][_0x62bd('0x54')];}return db[_0x62bd('0x35')][_0x62bd('0x51')]({'where':{'id':_0x22e677['params']['id']}})[_0x62bd('0x1a')](handleEntityNotFound(_0x452a97,null))[_0x62bd('0x1a')](saveUpdates(_0x22e677[_0x62bd('0x50')],null))[_0x62bd('0x1a')](respondWithResult(_0x452a97,null))[_0x62bd('0x24')](handleError(_0x452a97,null));};exports['addLogoLogin']=function(_0x5029df,_0x29a1bf,_0x517fa8){if(_0x5029df['file']&&_0x5029df[_0x62bd('0x53')][_0x62bd('0x54')]){_0x5029df[_0x62bd('0x50')]['loginLogo']=_0x5029df[_0x62bd('0x53')][_0x62bd('0x54')];}return db[_0x62bd('0x35')]['find']({'where':{'id':_0x5029df[_0x62bd('0x4e')]['id']}})[_0x62bd('0x1a')](handleEntityNotFound(_0x29a1bf,null))[_0x62bd('0x1a')](saveUpdates(_0x5029df['body'],null))[_0x62bd('0x1a')](respondWithResult(_0x29a1bf,null))[_0x62bd('0x24')](handleError(_0x29a1bf,null));};var utilLicense=require(_0x62bd('0x15'));exports['getLogo']=function(_0x338a18,_0x1caa28,_0x3a48e9){var _0x23f0ad='server/files/images/logos';var _0x5ecb0c={'custom':![]};return utilLicense[_0x62bd('0x56')]()[_0x62bd('0x1a')](function(_0x3f611b){if(_0x3f611b){_0x5ecb0c=_0x3f611b;}return db[_0x62bd('0x35')][_0x62bd('0x51')]({'where':{'id':_0x338a18[_0x62bd('0x4e')]['id']},'attributes':['logo','loginLogo',_0x62bd('0x57'),_0x62bd('0x58'),_0x62bd('0x59'),_0x62bd('0x5a'),_0x62bd('0x5b'),_0x62bd('0x5c')],'raw':!![]});})['then'](handleEntityNotFound(_0x1caa28,null))[_0x62bd('0x1a')](function(_0x2474bc){if(_0x2474bc){var _0x1ae0a8=_0x2474bc[_0x62bd('0x55')]&&fs[_0x62bd('0x5d')](path['join'](config[_0x62bd('0x5e')],_0x23f0ad,_[_0x62bd('0x5f')](_0x2474bc[_0x62bd('0x55')])))?path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x23f0ad,_[_0x62bd('0x5f')](_0x2474bc['logo'])):path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x23f0ad,_[_0x62bd('0x5f')](_0x62bd('0x61')));var _0x14b217='default'+_[_0x62bd('0x62')](_0x62bd('0x55'));if(_0x2474bc[_0x14b217]||!_0x5ecb0c[_0x62bd('0x63')]){_0x1ae0a8=path[_0x62bd('0x60')](config['root'],_0x23f0ad,_[_0x62bd('0x5f')](_0x62bd('0x61')));}if(!fs[_0x62bd('0x5d')](_0x1ae0a8)){throw new db['Sequelize']['ValidationError'](_[_0x62bd('0x62')](_0x62bd('0x55'))+'\x20not\x20found');}return _0x1caa28[_0x62bd('0x64')](_0x1ae0a8);}})[_0x62bd('0x24')](handleError(_0x1caa28,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x232f30,_0x238c9b,_0x5864b6){var _0x17543c=_0x62bd('0x65');var _0x5abdb9={'custom':![]};return utilLicense['getLicense']()[_0x62bd('0x1a')](function(_0x3a354a){if(_0x3a354a){_0x5abdb9=_0x3a354a;}return db['Setting'][_0x62bd('0x51')]({'where':{'id':_0x232f30[_0x62bd('0x4e')]['id']},'attributes':[_0x62bd('0x55'),_0x62bd('0x66'),_0x62bd('0x57'),_0x62bd('0x58'),_0x62bd('0x59'),'defaultLoginLogo',_0x62bd('0x5b'),_0x62bd('0x5c')],'raw':!![]});})[_0x62bd('0x1a')](handleEntityNotFound(_0x238c9b,null))[_0x62bd('0x1a')](function(_0x4dcb22){if(_0x4dcb22){var _0x49c80c=_0x4dcb22[_0x62bd('0x66')]&&fs['existsSync'](path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x17543c,_[_0x62bd('0x5f')](_0x4dcb22['loginLogo'])))?path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x17543c,_[_0x62bd('0x5f')](_0x4dcb22[_0x62bd('0x66')])):path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x17543c,_[_0x62bd('0x5f')](_0x62bd('0x67')));var _0x572c29=_0x62bd('0x68')+_[_0x62bd('0x62')](_0x62bd('0x66'));if(_0x4dcb22[_0x572c29]||!_0x5abdb9[_0x62bd('0x63')]){_0x49c80c=path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x17543c,_[_0x62bd('0x5f')](_0x62bd('0x67')));}if(!fs[_0x62bd('0x5d')](_0x49c80c)){throw new db[(_0x62bd('0x69'))]['ValidationError'](_[_0x62bd('0x62')](_0x62bd('0x66'))+_0x62bd('0x6a'));}return _0x238c9b[_0x62bd('0x64')](_0x49c80c);}})['catch'](handleError(_0x238c9b,null));};exports[_0x62bd('0x6b')]=function(_0x1a5efb,_0x3569a1){return db[_0x62bd('0x35')]['find']({'where':{'id':_0x1a5efb['params']['id']},'attributes':[_0x62bd('0x6c')]})['then'](respondWithResult(_0x3569a1,null))['catch'](handleError(_0x3569a1,null));};exports[_0x62bd('0x6d')]=function(_0x2f0f22,_0x446ac4,_0x1b52ce){if(_0x2f0f22[_0x62bd('0x53')]&&_0x2f0f22['file']['filename']){_0x2f0f22[_0x62bd('0x50')][_0x62bd('0x57')]=_0x2f0f22[_0x62bd('0x53')]['filename'];}return db[_0x62bd('0x35')][_0x62bd('0x51')]({'where':{'id':_0x2f0f22['params']['id']}})[_0x62bd('0x1a')](handleEntityNotFound(_0x446ac4,null))[_0x62bd('0x1a')](saveUpdates(_0x2f0f22[_0x62bd('0x50')],null))[_0x62bd('0x1a')](respondWithResult(_0x446ac4,null))[_0x62bd('0x24')](handleError(_0x446ac4,null));};var utilLicense=require(_0x62bd('0x15'));exports['getPreferred']=function(_0x18bbed,_0x24934e,_0x38f46e){var _0x4ed01f=_0x62bd('0x65');var _0x5cfaee={'custom':![]};return utilLicense[_0x62bd('0x56')]()[_0x62bd('0x1a')](function(_0x31e299){if(_0x31e299){_0x5cfaee=_0x31e299;}return db[_0x62bd('0x35')]['find']({'where':{'id':_0x18bbed[_0x62bd('0x4e')]['id']},'attributes':[_0x62bd('0x55'),_0x62bd('0x66'),'preferred',_0x62bd('0x58'),_0x62bd('0x59'),'defaultLoginLogo','defaultPreferred',_0x62bd('0x5c')],'raw':!![]});})[_0x62bd('0x1a')](handleEntityNotFound(_0x24934e,null))[_0x62bd('0x1a')](function(_0x136777){if(_0x136777){var _0x1e1f87=_0x136777[_0x62bd('0x57')]&&fs['existsSync'](path['join'](config[_0x62bd('0x5e')],_0x4ed01f,_[_0x62bd('0x5f')](_0x136777[_0x62bd('0x57')])))?path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x4ed01f,_[_0x62bd('0x5f')](_0x136777[_0x62bd('0x57')])):path['join'](config['root'],_0x4ed01f,_[_0x62bd('0x5f')](_0x62bd('0x6e')));var _0x15ca23=_0x62bd('0x68')+_['upperFirst'](_0x62bd('0x57'));if(_0x136777[_0x15ca23]||!_0x5cfaee[_0x62bd('0x63')]||!_0x5cfaee[_0x62bd('0x57')]){_0x1e1f87=path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x4ed01f,_['toLower'](_0x62bd('0x6e')));}if(!fs[_0x62bd('0x5d')](_0x1e1f87)){throw new db['Sequelize'][(_0x62bd('0x6f'))](_[_0x62bd('0x62')](_0x62bd('0x57'))+'\x20not\x20found');}return _0x24934e[_0x62bd('0x64')](_0x1e1f87);}})[_0x62bd('0x24')](handleError(_0x24934e,null));};exports[_0x62bd('0x70')]=function(_0x230aca,_0x29d94a,_0x20ff6d){if(_0x230aca[_0x62bd('0x53')]&&_0x230aca[_0x62bd('0x53')][_0x62bd('0x54')]){_0x230aca[_0x62bd('0x50')][_0x62bd('0x58')]=_0x230aca[_0x62bd('0x53')][_0x62bd('0x54')];}return db['Setting'][_0x62bd('0x51')]({'where':{'id':_0x230aca[_0x62bd('0x4e')]['id']}})[_0x62bd('0x1a')](handleEntityNotFound(_0x29d94a,null))[_0x62bd('0x1a')](saveUpdates(_0x230aca[_0x62bd('0x50')],null))[_0x62bd('0x1a')](respondWithResult(_0x29d94a,null))[_0x62bd('0x24')](handleError(_0x29d94a,null));};var utilLicense=require(_0x62bd('0x15'));exports[_0x62bd('0x71')]=function(_0x3ba9d2,_0x4bf603,_0x2d12e3){var _0x2abbc8='server/files/images/logos';var _0x415567={'custom':![]};return utilLicense[_0x62bd('0x56')]()[_0x62bd('0x1a')](function(_0x1e8548){if(_0x1e8548){_0x415567=_0x1e8548;}return db[_0x62bd('0x35')]['find']({'where':{'id':_0x3ba9d2[_0x62bd('0x4e')]['id']},'attributes':[_0x62bd('0x55'),_0x62bd('0x66'),_0x62bd('0x57'),_0x62bd('0x58'),_0x62bd('0x59'),_0x62bd('0x5a'),_0x62bd('0x5b'),_0x62bd('0x5c')],'raw':!![]});})[_0x62bd('0x1a')](handleEntityNotFound(_0x4bf603,null))[_0x62bd('0x1a')](function(_0x3bb301){if(_0x3bb301){var _0x56fd65=_0x3bb301[_0x62bd('0x58')]&&fs[_0x62bd('0x5d')](path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x2abbc8,_[_0x62bd('0x5f')](_0x3bb301[_0x62bd('0x58')])))?path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x2abbc8,_['toLower'](_0x3bb301[_0x62bd('0x58')])):path[_0x62bd('0x60')](config[_0x62bd('0x5e')],_0x2abbc8,_['toLower'](_0x62bd('0x72')));var _0x1ea889=_0x62bd('0x68')+_['upperFirst'](_0x62bd('0x58'));if(_0x3bb301[_0x1ea889]||!_0x415567[_0x62bd('0x63')]){_0x56fd65=path['join'](config[_0x62bd('0x5e')],_0x2abbc8,_[_0x62bd('0x5f')](_0x62bd('0x72')));}if(!fs[_0x62bd('0x5d')](_0x56fd65)){throw new db[(_0x62bd('0x69'))][(_0x62bd('0x6f'))](_['upperFirst'](_0x62bd('0x58'))+_0x62bd('0x6a'));}return _0x4bf603[_0x62bd('0x64')](_0x56fd65);}})[_0x62bd('0x24')](handleError(_0x4bf603,null));};exports[_0x62bd('0x73')]=function(_0x3d0892,_0x142b89){var _0x1a9be8={'offset':moment()[_0x62bd('0x74')]()};_0x1a9be8[_0x62bd('0x75')]=moment()[_0x62bd('0x74')](_0x1a9be8['offset'])[_0x62bd('0x76')](_0x62bd('0x77'));return _0x142b89[_0x62bd('0x2b')](0xc8)['send'](_0x1a9be8);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 8c2228a..2c93e24 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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_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 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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x88aeb1,_0x50bae7){var _0x53ce95=function(_0x6dc50c){while(--_0x6dc50c){_0x88aeb1['push'](_0x88aeb1['shift']());}};_0x53ce95(++_0x50bae7);}(_0xedd9,0xfc));var _0x9edd=function(_0xc00ed,_0x5d809c){_0xc00ed=_0xc00ed-0x0;var _0x53c738=_0xedd9[_0xc00ed];return _0x53c738;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','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 005aad5..9b6690e 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 _0x410f=['Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Setting','find','options','attributes','include','model','map','ShowSetting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x2b0b61,_0x170827){var _0x2ae144=function(_0x4f0459){while(--_0x4f0459){_0x2b0b61['push'](_0x2b0b61['shift']());}};_0x2ae144(++_0x170827);}(_0x410f,0x1c5));var _0xf410=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x410f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf410('0x0'));var util=require('util');var moment=require(_0xf410('0x1'));var BPromise=require(_0xf410('0x2'));var rs=require(_0xf410('0x3'));var fs=require('fs');var Redis=require(_0xf410('0x4'));var db=require(_0xf410('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf410('0x6'))(_0xf410('0x7'));var config=require('../../config/environment');var jayson=require(_0xf410('0x8'));var client=jayson[_0xf410('0x9')][_0xf410('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1152ea,_0x3f74e2,_0x3cda28){return new BPromise(function(_0x38701b,_0x5a577c){return client['request'](_0x1152ea,_0x3cda28)[_0xf410('0xb')](function(_0x3018e0){logger['info'](_0xf410('0xc'),_0x3f74e2,_0xf410('0xd'));logger[_0xf410('0xe')](_0xf410('0xf'),_0x3f74e2,'request\x20sent',JSON[_0xf410('0x10')](_0x3018e0));if(_0x3018e0[_0xf410('0x11')]){if(_0x3018e0[_0xf410('0x11')][_0xf410('0x12')]===0x1f4){logger[_0xf410('0x11')](_0xf410('0xc'),_0x3f74e2,_0x3018e0[_0xf410('0x11')][_0xf410('0x13')]);return _0x5a577c(_0x3018e0['error']['message']);}logger[_0xf410('0x11')](_0xf410('0xc'),_0x3f74e2,_0x3018e0[_0xf410('0x11')][_0xf410('0x13')]);return _0x38701b(_0x3018e0[_0xf410('0x11')]['message']);}else{logger[_0xf410('0x14')](_0xf410('0xc'),_0x3f74e2,_0xf410('0xd'));_0x38701b(_0x3018e0[_0xf410('0x15')][_0xf410('0x13')]);}})[_0xf410('0x16')](function(_0x1045f7){logger[_0xf410('0x11')](_0xf410('0xc'),_0x3f74e2,_0x1045f7);_0x5a577c(_0x1045f7);});});}exports['ShowSetting']=function(_0xdd7fe1){var _0x409749=this;return new Promise(function(_0x4c27e9,_0x596ec3){return db[_0xf410('0x17')][_0xf410('0x18')]({'raw':_0xdd7fe1['options']?_0xdd7fe1[_0xf410('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xdd7fe1[_0xf410('0x19')]?_0xdd7fe1[_0xf410('0x19')]['where']||null:null,'attributes':_0xdd7fe1[_0xf410('0x19')]?_0xdd7fe1[_0xf410('0x19')][_0xf410('0x1a')]||null:null,'include':_0xdd7fe1[_0xf410('0x19')]?_0xdd7fe1[_0xf410('0x19')][_0xf410('0x1b')]?_['map'](_0xdd7fe1[_0xf410('0x19')][_0xf410('0x1b')],function(_0x519186){return{'model':db[_0x519186[_0xf410('0x1c')]],'as':_0x519186['as'],'attributes':_0x519186[_0xf410('0x1a')],'include':_0x519186[_0xf410('0x1b')]?_[_0xf410('0x1d')](_0x519186['include'],function(_0x1b9819){return{'model':db[_0x1b9819[_0xf410('0x1c')]],'as':_0x1b9819['as'],'attributes':_0x1b9819[_0xf410('0x1a')],'include':_0x1b9819['include']?_[_0xf410('0x1d')](_0x1b9819[_0xf410('0x1b')],function(_0x3c331c){return{'model':db[_0x3c331c['model']],'as':_0x3c331c['as'],'attributes':_0x3c331c[_0xf410('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf410('0xb')](function(_0x233329){logger['info'](_0xf410('0x1e'),_0xdd7fe1);logger[_0xf410('0xe')](_0xf410('0x1e'),_0xdd7fe1,JSON[_0xf410('0x10')](_0x233329));_0x4c27e9(_0x233329);})[_0xf410('0x16')](function(_0x3304e1){logger[_0xf410('0x11')](_0xf410('0x1e'),_0x3304e1[_0xf410('0x13')],_0xdd7fe1);_0x596ec3(_0x409749[_0xf410('0x11')](0x1f4,_0x3304e1[_0xf410('0x13')]));});});}; \ No newline at end of file +var _0x3e84=['Setting','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','ShowSetting'];(function(_0x3e60fa,_0x495abd){var _0x15eef4=function(_0x1ebc4f){while(--_0x1ebc4f){_0x3e60fa['push'](_0x3e60fa['shift']());}};_0x15eef4(++_0x495abd);}(_0x3e84,0xbc));var _0x43e8=function(_0x4dbbdc,_0x1eb315){_0x4dbbdc=_0x4dbbdc-0x0;var _0x3b4842=_0x3e84[_0x4dbbdc];return _0x3b4842;};'use strict';var _=require(_0x43e8('0x0'));var util=require(_0x43e8('0x1'));var moment=require('moment');var BPromise=require(_0x43e8('0x2'));var rs=require(_0x43e8('0x3'));var fs=require('fs');var Redis=require(_0x43e8('0x4'));var db=require(_0x43e8('0x5'))['db'];var utils=require(_0x43e8('0x6'));var logger=require(_0x43e8('0x7'))(_0x43e8('0x8'));var config=require('../../config/environment');var jayson=require(_0x43e8('0x9'));var client=jayson['client'][_0x43e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x406562,_0x3011f1,_0x252633){return new BPromise(function(_0x1a2f8a,_0xc658eb){return client['request'](_0x406562,_0x252633)[_0x43e8('0xb')](function(_0x376223){logger[_0x43e8('0xc')](_0x43e8('0xd'),_0x3011f1,'request\x20sent');logger[_0x43e8('0xe')](_0x43e8('0xf'),_0x3011f1,'request\x20sent',JSON['stringify'](_0x376223));if(_0x376223[_0x43e8('0x10')]){if(_0x376223['error']['code']===0x1f4){logger[_0x43e8('0x10')]('Setting,\x20%s,\x20%s',_0x3011f1,_0x376223['error'][_0x43e8('0x11')]);return _0xc658eb(_0x376223[_0x43e8('0x10')][_0x43e8('0x11')]);}logger[_0x43e8('0x10')](_0x43e8('0xd'),_0x3011f1,_0x376223['error'][_0x43e8('0x11')]);return _0x1a2f8a(_0x376223[_0x43e8('0x10')][_0x43e8('0x11')]);}else{logger[_0x43e8('0xc')](_0x43e8('0xd'),_0x3011f1,_0x43e8('0x12'));_0x1a2f8a(_0x376223[_0x43e8('0x13')][_0x43e8('0x11')]);}})[_0x43e8('0x14')](function(_0x4007f0){logger[_0x43e8('0x10')](_0x43e8('0xd'),_0x3011f1,_0x4007f0);_0xc658eb(_0x4007f0);});});}exports[_0x43e8('0x15')]=function(_0x536b75){var _0x2a9003=this;return new Promise(function(_0x1eaf67,_0x771f99){return db[_0x43e8('0x16')]['find']({'raw':_0x536b75[_0x43e8('0x17')]?_0x536b75['options'][_0x43e8('0x18')]===undefined?!![]:![]:!![],'where':_0x536b75[_0x43e8('0x17')]?_0x536b75['options'][_0x43e8('0x19')]||null:null,'attributes':_0x536b75[_0x43e8('0x17')]?_0x536b75[_0x43e8('0x17')][_0x43e8('0x1a')]||null:null,'include':_0x536b75[_0x43e8('0x17')]?_0x536b75[_0x43e8('0x17')][_0x43e8('0x1b')]?_[_0x43e8('0x1c')](_0x536b75[_0x43e8('0x17')][_0x43e8('0x1b')],function(_0x25b83b){return{'model':db[_0x25b83b[_0x43e8('0x1d')]],'as':_0x25b83b['as'],'attributes':_0x25b83b[_0x43e8('0x1a')],'include':_0x25b83b[_0x43e8('0x1b')]?_[_0x43e8('0x1c')](_0x25b83b[_0x43e8('0x1b')],function(_0x46d949){return{'model':db[_0x46d949[_0x43e8('0x1d')]],'as':_0x46d949['as'],'attributes':_0x46d949['attributes'],'include':_0x46d949[_0x43e8('0x1b')]?_[_0x43e8('0x1c')](_0x46d949['include'],function(_0x4e365b){return{'model':db[_0x4e365b[_0x43e8('0x1d')]],'as':_0x4e365b['as'],'attributes':_0x4e365b[_0x43e8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ce9b2){logger[_0x43e8('0xc')](_0x43e8('0x15'),_0x536b75);logger['debug'](_0x43e8('0x15'),_0x536b75,JSON['stringify'](_0x5ce9b2));_0x1eaf67(_0x5ce9b2);})[_0x43e8('0x14')](function(_0x4a50d6){logger[_0x43e8('0x10')](_0x43e8('0x15'),_0x4a50d6[_0x43e8('0x11')],_0x536b75);_0x771f99(_0x2a9003[_0x43e8('0x10')](0x1f4,_0x4a50d6[_0x43e8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7f7cf6b..5c0c4cb 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(_0x2223be,_0x4e4034){var _0x453496=function(_0x18f9ee){while(--_0x18f9ee){_0x2223be['push'](_0x2223be['shift']());}};_0x453496(++_0x4e4034);}(_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/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x15054c,_0xd98c03){var _0xab8889=function(_0x57e7b3){while(--_0x57e7b3){_0x15054c['push'](_0x15054c['shift']());}};_0xab8889(++_0xd98c03);}(_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/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 8d27055..fcdf37a 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 _0xe89a=['connectel','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','ENUM','twilio','skebby'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe89a,0xad));var _0xae89=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xe89a[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xae89('0x0'));module[_0xae89('0x1')]={'name':{'type':Sequelize[_0xae89('0x2')],'unique':_0xae89('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xae89('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xae89('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xae89('0x2')]},'type':{'type':Sequelize[_0xae89('0x4')](_0xae89('0x5'),_0xae89('0x6'),_0xae89('0x7'),'clicksend',_0xae89('0x8'),_0xae89('0x9'),'bandwidth',_0xae89('0xa'),_0xae89('0xb'),_0xae89('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xae89('0x2')]},'authToken':{'type':Sequelize[_0xae89('0x2')]},'smsMethod':{'type':Sequelize[_0xae89('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xae89('0x2')]},'password':{'type':Sequelize[_0xae89('0x2')]},'apiKey':{'type':Sequelize[_0xae89('0x2')]},'applicationId':{'type':Sequelize[_0xae89('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xae89('0x2')]},'deliveryReport':{'type':Sequelize[_0xae89('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xae89('0xe');}},'notificationSound':{'type':Sequelize[_0xae89('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xae89('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xae89('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xae89('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xae89('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xae89('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae89('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae89('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xae89('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae89('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xae89('0x10'),'set':function(_0x3336b1){if(!_0x3336b1)this[_0xae89('0x11')](_0xae89('0x12'),null);this['setDataValue'](_0xae89('0x13'),_0x3336b1);}}}; \ No newline at end of file +var _0x67e7=['skebby','clicksend','clickatell','bandwidth','csc','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0x2ff762,_0x342c0b){var _0x158b02=function(_0x13c38e){while(--_0x13c38e){_0x2ff762['push'](_0x2ff762['shift']());}};_0x158b02(++_0x342c0b);}(_0x67e7,0xa0));var _0x767e=function(_0x3ce373,_0x4ded0f){_0x3ce373=_0x3ce373-0x0;var _0x3bce37=_0x67e7[_0x3ce373];return _0x3bce37;};'use strict';var Sequelize=require(_0x767e('0x0'));var rs=require(_0x767e('0x1'));module[_0x767e('0x2')]={'name':{'type':Sequelize[_0x767e('0x3')],'unique':_0x767e('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x767e('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x767e('0x5')]();}},'phone':{'type':Sequelize[_0x767e('0x3')]},'type':{'type':Sequelize[_0x767e('0x6')](_0x767e('0x7'),_0x767e('0x8'),'connectel',_0x767e('0x9'),'plivo',_0x767e('0xa'),_0x767e('0xb'),_0x767e('0xc'),'infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x767e('0x3')]},'authToken':{'type':Sequelize[_0x767e('0x3')]},'smsMethod':{'type':Sequelize[_0x767e('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x767e('0x3')]},'password':{'type':Sequelize[_0x767e('0x3')]},'apiKey':{'type':Sequelize[_0x767e('0x3')]},'applicationId':{'type':Sequelize[_0x767e('0x3')]},'accountId':{'type':Sequelize[_0x767e('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x767e('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x767e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x767e('0xe')],'defaultValue':function(){return _0x767e('0xf');}},'notificationSound':{'type':Sequelize[_0x767e('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x767e('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x767e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x767e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x767e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x767e('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x767e('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x767e('0x10')],'comment':_0x767e('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x767e('0xd')],'defaultValue':![],'comment':_0x767e('0x12'),'set':function(_0x5a996c){if(!_0x5a996c)this[_0x767e('0x13')]('mandatoryDispositionPauseId',null);this[_0x767e('0x13')](_0x767e('0x14'),_0x5a996c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 77fa413..43a51d2 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 _0xa4fb=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./smsAccount.socket','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','type','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','SmsAccount','includeAll','include','findAll','rows','show','params','Pause','keys','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','getDispositions','findOne','SmsAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','notify','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','MessageSid','sender','text','connectel','clicksend','messageId','message_id','plivo','MessageUUID','results','csc','originatingAddress','clickatell','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','defaults','contact','SmsInteraction','spread','interaction','applications','close','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','User','unshift','agent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','List','DESC','ListId','out','Messages','dataValues','inspect','skebby','skebby_dispatch_id','statusInt','status_code','groupName','DELIVERED','bandwidth','intelepeer','redif','error_code','infobip','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto'];(function(_0x553035,_0x211a8f){var _0x25248b=function(_0x2d1e06){while(--_0x2d1e06){_0x553035['push'](_0x553035['shift']());}};_0x25248b(++_0x211a8f);}(_0xa4fb,0x1b9));var _0xba4f=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0xa4fb[_0x59162a];return _0x35e50d;};'use strict';var emlformat=require(_0xba4f('0x0'));var rimraf=require(_0xba4f('0x1'));var zipdir=require(_0xba4f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba4f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xba4f('0x4'));var util=require('util');var path=require(_0xba4f('0x5'));var sox=require(_0xba4f('0x6'));var csv=require(_0xba4f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba4f('0x8'));var _=require(_0xba4f('0x9'));var squel=require('squel');var crypto=require(_0xba4f('0xa'));var jsforce=require(_0xba4f('0xb'));var deskjs=require(_0xba4f('0xc'));var toCsv=require(_0xba4f('0x7'));var querystring=require(_0xba4f('0xd'));var Papa=require('papaparse');var Redis=require(_0xba4f('0xe'));var authService=require(_0xba4f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xba4f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba4f('0x11'))(_0xba4f('0x12'));var utils=require(_0xba4f('0x13'));var config=require(_0xba4f('0x14'));var licenseUtil=require(_0xba4f('0x15'));var db=require('../../mysqldb')['db'];config[_0xba4f('0x16')]=_['defaults'](config[_0xba4f('0x16')],{'host':_0xba4f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba4f('0x16')]));require(_0xba4f('0x18'))[_0xba4f('0x19')](socket);var jayson=require(_0xba4f('0x1a'));var client=jayson['client'][_0xba4f('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x255474,_0x3cadff,_0x3eb06e,_0x1727a9){return new BPromise(function(_0x2ec3c9,_0x3e8932){var _0x21c206=_0x1727a9||client;return _0x21c206[_0xba4f('0x1c')](_0x255474,_0x3eb06e)[_0xba4f('0x1d')](function(_0x41abc8){logger[_0xba4f('0x1e')](_0xba4f('0x1f'),_0x3cadff,_0xba4f('0x20'));logger[_0xba4f('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3cadff,'request\x20sent',JSON[_0xba4f('0x22')](_0x41abc8));if(_0x41abc8['error']){if(_0x41abc8['error'][_0xba4f('0x23')]===0x1f4){logger['error'](_0xba4f('0x1f'),_0x3cadff,_0x41abc8[_0xba4f('0x24')][_0xba4f('0x25')]);return _0x3e8932(_0x41abc8[_0xba4f('0x24')][_0xba4f('0x25')]);}logger[_0xba4f('0x24')](_0xba4f('0x1f'),_0x3cadff,_0x41abc8[_0xba4f('0x24')][_0xba4f('0x25')]);return _0x2ec3c9(_0x41abc8['error'][_0xba4f('0x25')]);}else{logger[_0xba4f('0x1e')](_0xba4f('0x1f'),_0x3cadff,_0xba4f('0x20'));_0x2ec3c9(_0x41abc8[_0xba4f('0x26')][_0xba4f('0x25')]);}})[_0xba4f('0x27')](function(_0x192c56){logger[_0xba4f('0x24')](_0xba4f('0x1f'),_0x3cadff,_0x192c56);_0x3e8932(_0x192c56);});});}function respondWithStatusCode(_0x3c54e6,_0x4da41a){_0x4da41a=_0x4da41a||0xcc;return function(_0x137328){if(_0x137328){return _0x3c54e6[_0xba4f('0x28')](_0x4da41a);}return _0x3c54e6[_0xba4f('0x29')](_0x4da41a)[_0xba4f('0x2a')]();};}function respondWithResult(_0x2b5447,_0x2a3273){_0x2a3273=_0x2a3273||0xc8;return function(_0x59b6cd){if(_0x59b6cd){return _0x2b5447['status'](_0x2a3273)[_0xba4f('0x2b')](_0x59b6cd);}};}function respondWithFilteredResult(_0xc9f9b9,_0x3ed3e8){return function(_0x3973e9){if(_0x3973e9){var _0xe62b08=typeof _0x3ed3e8['offset']==='undefined'&&typeof _0x3ed3e8['limit']===_0xba4f('0x2c');var _0x13c4b9=_0x3973e9['count'];var _0x197822=_0xe62b08?0x0:_0x3ed3e8[_0xba4f('0x2d')];var _0x348c47=_0xe62b08?_0x3973e9[_0xba4f('0x2e')]:_0x3ed3e8[_0xba4f('0x2d')]+_0x3ed3e8[_0xba4f('0x2f')];var _0x4b5b51;if(_0x348c47>=_0x13c4b9){_0x348c47=_0x13c4b9;_0x4b5b51=0xc8;}else{_0x4b5b51=0xce;}_0xc9f9b9[_0xba4f('0x29')](_0x4b5b51);return _0xc9f9b9[_0xba4f('0x30')](_0xba4f('0x31'),_0x197822+'-'+_0x348c47+'/'+_0x13c4b9)[_0xba4f('0x2b')](_0x3973e9);}return null;};}function patchUpdates(_0x434285){return function(_0x4ad9e7){try{jsonpatch['apply'](_0x4ad9e7,_0x434285,!![]);}catch(_0x487d3f){return BPromise[_0xba4f('0x32')](_0x487d3f);}return _0x4ad9e7[_0xba4f('0x33')]();};}function saveUpdates(_0x5bb6b0,_0xe7e9d1){return function(_0x4ec43d){if(_0x4ec43d){return _0x4ec43d[_0xba4f('0x34')](_0x5bb6b0)[_0xba4f('0x1d')](function(_0x2b52c3){return _0x2b52c3;});}return null;};}function removeEntity(_0xb9518c,_0xa4ada2){return function(_0x431a72){if(_0x431a72){return _0x431a72[_0xba4f('0x35')]()[_0xba4f('0x1d')](function(){var _0x1e527c=_0x431a72[_0xba4f('0x36')]({'plain':!![]});var _0x142b6d=_0xba4f('0x37');return db[_0xba4f('0x38')][_0xba4f('0x35')]({'where':{'type':_0x142b6d,'resourceId':_0x1e527c['id']}})['then'](function(){return _0x431a72;});})[_0xba4f('0x1d')](function(){_0xb9518c[_0xba4f('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4116f7,_0x58c55e){return function(_0x60434c){if(!_0x60434c){_0x4116f7[_0xba4f('0x28')](0x194);}return _0x60434c;};}function handleError(_0x3d344a,_0x3607f4){_0x3607f4=_0x3607f4||0x1f4;return function(_0x505459){logger[_0xba4f('0x24')](_0x505459[_0xba4f('0x39')]);if(_0x505459[_0xba4f('0x3a')]){delete _0x505459[_0xba4f('0x3a')];}_0x3d344a[_0xba4f('0x29')](_0x3607f4)[_0xba4f('0x3b')](_0x505459);};}exports[_0xba4f('0x3c')]=function(_0x281a4d,_0x1550d3){var _0x2ffd84={'include':[{'model':db['Pause'],'as':_0xba4f('0x3d')}]},_0xf5e231={},_0x6d635={'count':0x0,'rows':[]};var _0x2199f1=_[_0xba4f('0x3e')](db['SmsAccount'][_0xba4f('0x3f')],function(_0xda5a1c){return{'name':_0xda5a1c['fieldName'],'type':_0xda5a1c[_0xba4f('0x40')]['key']};});_0xf5e231['model']=_[_0xba4f('0x3e')](_0x2199f1,_0xba4f('0x3a'));_0xf5e231[_0xba4f('0x41')]=_['keys'](_0x281a4d['query']);_0xf5e231['filters']=_['intersection'](_0xf5e231[_0xba4f('0x42')],_0xf5e231[_0xba4f('0x41')]);_0x2ffd84['attributes']=_[_0xba4f('0x43')](_0xf5e231['model'],qs[_0xba4f('0x44')](_0x281a4d[_0xba4f('0x41')][_0xba4f('0x44')]));_0x2ffd84[_0xba4f('0x45')]=_0x2ffd84['attributes'][_0xba4f('0x46')]?_0x2ffd84[_0xba4f('0x45')]:_0xf5e231[_0xba4f('0x42')];if(!_0x281a4d['query'][_0xba4f('0x47')](_0xba4f('0x48'))){_0x2ffd84[_0xba4f('0x2f')]=qs['limit'](_0x281a4d[_0xba4f('0x41')][_0xba4f('0x2f')]);_0x2ffd84['offset']=qs[_0xba4f('0x2d')](_0x281a4d[_0xba4f('0x41')][_0xba4f('0x2d')]);}_0x2ffd84[_0xba4f('0x49')]=qs[_0xba4f('0x4a')](_0x281a4d['query']['sort']);_0x2ffd84['where']=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x281a4d[_0xba4f('0x41')],_0xf5e231['filters']),_0x2199f1);if(_0x281a4d[_0xba4f('0x41')][_0xba4f('0x4d')]){_0x2ffd84[_0xba4f('0x4e')]=_[_0xba4f('0x4f')](_0x2ffd84[_0xba4f('0x4e')],{'$or':_[_0xba4f('0x3e')](_0x2199f1,function(_0x5aad95){if(_0x5aad95[_0xba4f('0x40')]!=='VIRTUAL'){var _0x2aa902={};_0x2aa902[_0x5aad95['name']]={'$like':'%'+_0x281a4d[_0xba4f('0x41')]['filter']+'%'};return _0x2aa902;}})});}_0x2ffd84=_['merge']({},_0x2ffd84,_0x281a4d[_0xba4f('0x50')]);var _0x2d2039={'where':_0x2ffd84[_0xba4f('0x4e')]};return db[_0xba4f('0x51')]['count'](_0x2d2039)[_0xba4f('0x1d')](function(_0x349bb5){_0x6d635['count']=_0x349bb5;if(_0x281a4d['query'][_0xba4f('0x52')]){_0x2ffd84[_0xba4f('0x53')]=[{'all':!![]}];}return db['SmsAccount'][_0xba4f('0x54')](_0x2ffd84);})[_0xba4f('0x1d')](function(_0x523280){_0x6d635[_0xba4f('0x55')]=_0x523280;return _0x6d635;})['then'](respondWithFilteredResult(_0x1550d3,_0x2ffd84))['catch'](handleError(_0x1550d3,null));};exports[_0xba4f('0x56')]=function(_0x7c3726,_0x2de2d8){var _0x5ccf65={'raw':![],'where':{'id':_0x7c3726[_0xba4f('0x57')]['id']},'include':[{'model':db[_0xba4f('0x58')],'as':_0xba4f('0x3d')}]},_0x1869e0={};_0x1869e0[_0xba4f('0x42')]=_[_0xba4f('0x59')](db[_0xba4f('0x51')][_0xba4f('0x3f')]);_0x1869e0[_0xba4f('0x41')]=_[_0xba4f('0x59')](_0x7c3726['query']);_0x1869e0[_0xba4f('0x4b')]=_[_0xba4f('0x43')](_0x1869e0['model'],_0x1869e0[_0xba4f('0x41')]);_0x5ccf65['attributes']=_['intersection'](_0x1869e0[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x7c3726[_0xba4f('0x41')][_0xba4f('0x44')]));_0x5ccf65[_0xba4f('0x45')]=_0x5ccf65['attributes'][_0xba4f('0x46')]?_0x5ccf65['attributes']:_0x1869e0[_0xba4f('0x42')];if(_0x7c3726['query'][_0xba4f('0x52')]){_0x5ccf65['include']=[{'all':!![]}];}_0x5ccf65=_['merge']({},_0x5ccf65,_0x7c3726[_0xba4f('0x50')]);return db[_0xba4f('0x51')][_0xba4f('0x5a')](_0x5ccf65)[_0xba4f('0x1d')](handleEntityNotFound(_0x2de2d8,null))['then'](respondWithResult(_0x2de2d8,null))[_0xba4f('0x27')](handleError(_0x2de2d8,null));};exports[_0xba4f('0x5b')]=function(_0x4cd1f9,_0x1559ab){return db[_0xba4f('0x51')][_0xba4f('0x5b')](_0x4cd1f9['body'],{})[_0xba4f('0x1d')](function(_0x52a91c){var _0x13a1b1=_0x4cd1f9[_0xba4f('0x5c')][_0xba4f('0x36')]({'plain':!![]});if(!_0x13a1b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13a1b1['role']==='user'){var _0x162fa8=_0x52a91c[_0xba4f('0x36')]({'plain':!![]});var _0x48b472=_0xba4f('0x37');return db[_0xba4f('0x5d')][_0xba4f('0x5a')]({'where':{'name':_0x48b472,'userProfileId':_0x13a1b1[_0xba4f('0x5e')]},'raw':!![]})[_0xba4f('0x1d')](function(_0x36fab2){if(_0x36fab2&&_0x36fab2[_0xba4f('0x5f')]===0x0){return db[_0xba4f('0x38')][_0xba4f('0x5b')]({'name':_0x162fa8[_0xba4f('0x3a')],'resourceId':_0x162fa8['id'],'type':_0x36fab2[_0xba4f('0x3a')],'sectionId':_0x36fab2['id']},{})[_0xba4f('0x1d')](function(){return _0x52a91c;});}else{return _0x52a91c;}})['catch'](function(_0x144393){logger[_0xba4f('0x24')](_0xba4f('0x60'),_0x144393);throw _0x144393;});}return _0x52a91c;})['then'](respondWithResult(_0x1559ab,0xc9))[_0xba4f('0x27')](handleError(_0x1559ab,null));};exports['update']=function(_0x1d34b0,_0x46cd82){if(_0x1d34b0[_0xba4f('0x61')]['id']){delete _0x1d34b0[_0xba4f('0x61')]['id'];}return db[_0xba4f('0x51')][_0xba4f('0x5a')]({'where':{'id':_0x1d34b0[_0xba4f('0x57')]['id']},'include':[{'model':db[_0xba4f('0x58')],'as':_0xba4f('0x3d')}]})[_0xba4f('0x1d')](handleEntityNotFound(_0x46cd82,null))[_0xba4f('0x1d')](saveUpdates(_0x1d34b0['body'],null))[_0xba4f('0x1d')](respondWithResult(_0x46cd82,null))[_0xba4f('0x27')](handleError(_0x46cd82,null));};exports[_0xba4f('0x35')]=function(_0x5911ea,_0x508af5){return db[_0xba4f('0x51')]['find']({'where':{'id':_0x5911ea[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x508af5,null))[_0xba4f('0x1d')](removeEntity(_0x508af5,null))[_0xba4f('0x27')](handleError(_0x508af5,null));};exports['describe']=function(_0x57463c,_0x374b0f){return db['SmsAccount']['describe']()[_0xba4f('0x1d')](respondWithResult(_0x374b0f,null))[_0xba4f('0x27')](handleError(_0x374b0f,null));};exports[_0xba4f('0x62')]=function(_0x17756d,_0x3da0af,_0x1b12d8){if(_0x17756d[_0xba4f('0x61')]['id']){delete _0x17756d[_0xba4f('0x61')]['id'];}return db['SmsAccount'][_0xba4f('0x5a')]({'where':{'id':_0x17756d['params']['id']}})['then'](handleEntityNotFound(_0x3da0af,null))[_0xba4f('0x1d')](function(_0x5d98ad){if(_0x5d98ad){_0x17756d[_0xba4f('0x61')]['SmsAccountId']=_0x5d98ad['id'];return db['Disposition'][_0xba4f('0x5b')](_0x17756d[_0xba4f('0x61')]);}})[_0xba4f('0x1d')](respondWithResult(_0x3da0af,null))[_0xba4f('0x27')](handleError(_0x3da0af,null));};exports[_0xba4f('0x63')]=function(_0x1326cf,_0x59b7ca,_0x1ed6f0){var _0x1f652e={'raw':![],'where':{}};var _0x291b3a={};var _0x21e4f4={'count':0x0,'rows':[]};return db['SmsAccount'][_0xba4f('0x64')]({'where':{'id':_0x1326cf[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x59b7ca,null))[_0xba4f('0x1d')](function(_0x2d07db){if(_0x2d07db){_0x291b3a[_0xba4f('0x42')]=_['keys'](db['Disposition'][_0xba4f('0x3f')]);_0x291b3a[_0xba4f('0x41')]=_['keys'](_0x1326cf[_0xba4f('0x41')]);_0x291b3a['filters']=_[_0xba4f('0x43')](_0x291b3a['model'],_0x291b3a['query']);_0x1f652e[_0xba4f('0x45')]=_[_0xba4f('0x43')](_0x291b3a[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x1326cf[_0xba4f('0x41')][_0xba4f('0x44')]));_0x1f652e[_0xba4f('0x45')]=_0x1f652e['attributes'][_0xba4f('0x46')]?_0x1f652e[_0xba4f('0x45')]:_0x291b3a['model'];if(!_0x1326cf[_0xba4f('0x41')]['hasOwnProperty']('nolimit')){_0x1f652e['limit']=qs[_0xba4f('0x2f')](_0x1326cf[_0xba4f('0x41')][_0xba4f('0x2f')]);_0x1f652e[_0xba4f('0x2d')]=qs[_0xba4f('0x2d')](_0x1326cf['query']['offset']);}_0x1f652e[_0xba4f('0x49')]=qs[_0xba4f('0x4a')](_0x1326cf[_0xba4f('0x41')][_0xba4f('0x4a')]);_0x1f652e[_0xba4f('0x4e')]=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x1326cf[_0xba4f('0x41')],_0x291b3a[_0xba4f('0x4b')]));_0x1f652e['where'][_0xba4f('0x65')]=_0x2d07db['id'];if(_0x1326cf[_0xba4f('0x41')]['filter']){_0x1f652e['where']=_[_0xba4f('0x4f')](_0x1f652e[_0xba4f('0x4e')],{'$or':_[_0xba4f('0x3e')](_0x1f652e['attributes'],function(_0x5161db){var _0x5df981={};_0x5df981[_0x5161db]={'$like':'%'+_0x1326cf['query'][_0xba4f('0x4d')]+'%'};return _0x5df981;})});}_0x1f652e=_['merge']({},_0x1f652e,_0x1326cf['options']);return db['Disposition'][_0xba4f('0x2e')]({'where':_0x1f652e['where']})[_0xba4f('0x1d')](function(_0x82653e){_0x21e4f4[_0xba4f('0x2e')]=_0x82653e;if(_0x1326cf[_0xba4f('0x41')]['includeAll']){_0x1f652e[_0xba4f('0x53')]=[{'all':!![]}];}return db[_0xba4f('0x66')][_0xba4f('0x54')](_0x1f652e);})[_0xba4f('0x1d')](function(_0x738bf9){_0x21e4f4['rows']=_0x738bf9;return _0x21e4f4;});}})[_0xba4f('0x1d')](respondWithFilteredResult(_0x59b7ca,_0x1f652e))['catch'](handleError(_0x59b7ca,null));};exports[_0xba4f('0x67')]=function(_0x38e89c,_0x37b7b5,_0x8d8a7a){return db[_0xba4f('0x51')]['find']({'where':{'id':_0x38e89c['params']['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x37b7b5,null))['then'](function(_0x4a592d){if(_0x4a592d){return _0x4a592d['removeDispositions'](_0x38e89c[_0xba4f('0x41')][_0xba4f('0x68')]);}})[_0xba4f('0x1d')](respondWithStatusCode(_0x37b7b5,null))[_0xba4f('0x27')](handleError(_0x37b7b5,null));};exports['addAnswer']=function(_0x59c6f7,_0x4c39ab,_0x1686dd){if(_0x59c6f7[_0xba4f('0x61')]['id']){delete _0x59c6f7[_0xba4f('0x61')]['id'];}return db['SmsAccount'][_0xba4f('0x5a')]({'where':{'id':_0x59c6f7[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x4c39ab,null))[_0xba4f('0x1d')](function(_0x5c1b52){if(_0x5c1b52){_0x59c6f7[_0xba4f('0x61')][_0xba4f('0x65')]=_0x5c1b52['id'];return db[_0xba4f('0x69')][_0xba4f('0x5b')](_0x59c6f7[_0xba4f('0x61')]);}})[_0xba4f('0x1d')](respondWithResult(_0x4c39ab,null))[_0xba4f('0x27')](handleError(_0x4c39ab,null));};exports[_0xba4f('0x6a')]=function(_0x19f8f4,_0x45ebd4,_0x1e00ae){var _0x5a6df6={'raw':![],'where':{}};var _0x4e665d={};var _0x399a4c={'count':0x0,'rows':[]};return db[_0xba4f('0x51')]['findOne']({'where':{'id':_0x19f8f4[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x45ebd4,null))['then'](function(_0x1f2d2a){if(_0x1f2d2a){_0x4e665d[_0xba4f('0x42')]=_['keys'](db[_0xba4f('0x69')]['rawAttributes']);_0x4e665d[_0xba4f('0x41')]=_[_0xba4f('0x59')](_0x19f8f4[_0xba4f('0x41')]);_0x4e665d[_0xba4f('0x4b')]=_['intersection'](_0x4e665d[_0xba4f('0x42')],_0x4e665d['query']);_0x5a6df6[_0xba4f('0x45')]=_['intersection'](_0x4e665d[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x19f8f4[_0xba4f('0x41')][_0xba4f('0x44')]));_0x5a6df6[_0xba4f('0x45')]=_0x5a6df6[_0xba4f('0x45')]['length']?_0x5a6df6[_0xba4f('0x45')]:_0x4e665d[_0xba4f('0x42')];if(!_0x19f8f4[_0xba4f('0x41')][_0xba4f('0x47')]('nolimit')){_0x5a6df6[_0xba4f('0x2f')]=qs[_0xba4f('0x2f')](_0x19f8f4[_0xba4f('0x41')][_0xba4f('0x2f')]);_0x5a6df6[_0xba4f('0x2d')]=qs[_0xba4f('0x2d')](_0x19f8f4['query'][_0xba4f('0x2d')]);}_0x5a6df6[_0xba4f('0x49')]=qs[_0xba4f('0x4a')](_0x19f8f4[_0xba4f('0x41')][_0xba4f('0x4a')]);_0x5a6df6[_0xba4f('0x4e')]=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x19f8f4['query'],_0x4e665d['filters']));_0x5a6df6[_0xba4f('0x4e')][_0xba4f('0x65')]=_0x1f2d2a['id'];if(_0x19f8f4['query'][_0xba4f('0x4d')]){_0x5a6df6['where']=_['merge'](_0x5a6df6[_0xba4f('0x4e')],{'$or':_['map'](_0x5a6df6[_0xba4f('0x45')],function(_0x116ca6){var _0x5d6e20={};_0x5d6e20[_0x116ca6]={'$like':'%'+_0x19f8f4[_0xba4f('0x41')][_0xba4f('0x4d')]+'%'};return _0x5d6e20;})});}_0x5a6df6=_['merge']({},_0x5a6df6,_0x19f8f4[_0xba4f('0x50')]);return db['CannedAnswer'][_0xba4f('0x2e')]({'where':_0x5a6df6[_0xba4f('0x4e')]})[_0xba4f('0x1d')](function(_0x2e1a55){_0x399a4c['count']=_0x2e1a55;if(_0x19f8f4[_0xba4f('0x41')]['includeAll']){_0x5a6df6['include']=[{'all':!![]}];}return db[_0xba4f('0x69')]['findAll'](_0x5a6df6);})['then'](function(_0x39a903){_0x399a4c[_0xba4f('0x55')]=_0x39a903;return _0x399a4c;});}})['then'](respondWithFilteredResult(_0x45ebd4,_0x5a6df6))[_0xba4f('0x27')](handleError(_0x45ebd4,null));};exports['removeAnswers']=function(_0x3a29f1,_0x42beaa,_0x3835bc){return db['SmsAccount']['find']({'where':{'id':_0x3a29f1[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x42beaa,null))[_0xba4f('0x1d')](function(_0x2e4c4c){if(_0x2e4c4c){return _0x2e4c4c['removeAnswers'](_0x3a29f1['query'][_0xba4f('0x68')]);}})['then'](respondWithStatusCode(_0x42beaa,null))[_0xba4f('0x27')](handleError(_0x42beaa,null));};exports[_0xba4f('0x6b')]=function(_0x349416,_0x4b6f1f,_0x4391c5){var _0x378167={'channel':'sms'};var _0x5d6bfd=[];var _0x19242d=[];var _0x19c8f1={};return db[_0xba4f('0x51')][_0xba4f('0x5a')]({'where':{'id':_0x349416['params']['id']},'include':[{'model':db[_0xba4f('0x6c')],'as':_0xba4f('0x6d')}]})[_0xba4f('0x1d')](handleEntityNotFound(_0x4b6f1f,null))[_0xba4f('0x1d')](function(_0x1f7dde){_0x378167[_0xba4f('0x6e')]=_0x1f7dde;_0x378167['applications']=_[_0xba4f('0x6f')](_0x1f7dde[_0xba4f('0x6d')],[_0xba4f('0x70')],[_0xba4f('0x71')]);if(_0x378167[_0xba4f('0x6e')][_0xba4f('0x6d')]){delete _0x378167[_0xba4f('0x6e')][_0xba4f('0x6d')];}return db[_0xba4f('0x72')][_0xba4f('0x73')]();})[_0xba4f('0x1d')](function(_0x3c6203){if(!_0x3c6203){throw new db[(_0xba4f('0x74'))][(_0xba4f('0x75'))](_0xba4f('0x76'));}_0x5d6bfd=_[_0xba4f('0x77')](_[_0xba4f('0x59')](_0x3c6203),[_0xba4f('0x78'),'updatedAt']);_0x19242d=_[_0xba4f('0x77')](_['keys'](_0x3c6203),['createdAt',_0xba4f('0x79'),_0xba4f('0x7a'),'ListId']);_0x378167[_0xba4f('0x61')]={'mapKey':_0xba4f('0x7b')};if(_0x378167[_0xba4f('0x6e')]['type']){switch(_0x378167[_0xba4f('0x6e')][_0xba4f('0x40')]){case _0xba4f('0x7c'):_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x7e')];_0x378167[_0xba4f('0x61')]['body']=_0x349416[_0xba4f('0x61')]['Body'];_0x378167[_0xba4f('0x61')]['messageId']=_0x349416[_0xba4f('0x61')][_0xba4f('0x7f')];break;case'skebby':_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]='+'+_0x349416['body'][_0xba4f('0x80')];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x81')];break;case _0xba4f('0x82'):_0x378167[_0xba4f('0x61')]['from']=_0x349416[_0xba4f('0x61')]['from'];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416[_0xba4f('0x61')]['message'];break;case _0xba4f('0x83'):_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]=_0x349416['body'][_0xba4f('0x7d')];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x61')];_0x378167[_0xba4f('0x61')][_0xba4f('0x84')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x85')];break;case _0xba4f('0x86'):_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]=_0x349416[_0xba4f('0x61')]['From'];_0x378167['body'][_0xba4f('0x61')]=_0x349416['body']['Text'];_0x378167[_0xba4f('0x61')][_0xba4f('0x84')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x87')];break;case'infobip':_0x378167['body'][_0xba4f('0x7d')]='+'+_0x349416[_0xba4f('0x61')][_0xba4f('0x88')][0x0]['from'];_0x378167['body'][_0xba4f('0x61')]=_0x349416['body'][_0xba4f('0x88')][0x0][_0xba4f('0x81')];_0x378167['body'][_0xba4f('0x84')]=_0x349416[_0xba4f('0x61')]['results'][0x0]['messageId'];break;case _0xba4f('0x89'):_0x378167[_0xba4f('0x61')]['from']=_0x349416[_0xba4f('0x61')][_0xba4f('0x8a')];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416['body']['segmentedMessage'][_0xba4f('0x25')];break;case _0xba4f('0x8b'):_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]=_0x349416['body']['fromNumber'];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416[_0xba4f('0x61')]['text'];_0x378167['body'][_0xba4f('0x84')]=_0x349416[_0xba4f('0x61')]['replyMessageId'];break;case'bandwidth':_0x378167[_0xba4f('0x61')][_0xba4f('0x84')]=_0x349416[_0xba4f('0x61')][0x0][_0xba4f('0x25')]['id'];_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')]=_0x349416[_0xba4f('0x61')][0x0]['message'][_0xba4f('0x7d')];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416['body'][0x0][_0xba4f('0x25')]['text'];break;case'intelepeer':_0x378167['body']['from']=_0x349416[_0xba4f('0x61')][_0xba4f('0x7d')];_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]=_0x349416[_0xba4f('0x61')][_0xba4f('0x25')];_0x378167[_0xba4f('0x61')][_0xba4f('0x84')]=_0x349416['body'][_0xba4f('0x8c')];break;}}if(_0x378167[_0xba4f('0x61')]['id']){delete _0x378167[_0xba4f('0x61')]['id'];}if(_[_0xba4f('0x8d')](_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')])){throw new db['Sequelize'][(_0xba4f('0x75'))](_0xba4f('0x8e'));}if(_[_0xba4f('0x8d')](_0x378167[_0xba4f('0x61')][_0xba4f('0x61')])||_0x378167[_0xba4f('0x61')][_0xba4f('0x61')]===''){throw new db[(_0xba4f('0x74'))][(_0xba4f('0x75'))](_0xba4f('0x8f'));}if(_[_0xba4f('0x8d')](_0x378167[_0xba4f('0x61')]['mapKey'])){throw new db[(_0xba4f('0x74'))][(_0xba4f('0x75'))](_0xba4f('0x90')+_0x19242d);}if(!_[_0xba4f('0x91')](_0x19242d,_0x378167[_0xba4f('0x61')][_0xba4f('0x92')])){throw new db[(_0xba4f('0x74'))]['ValidationError'](_0xba4f('0x93')+_0x19242d);}_0x19c8f1[_0x378167[_0xba4f('0x61')][_0xba4f('0x92')]]=_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')];return db[_0xba4f('0x94')]['find']({'where':{'id':_0x378167[_0xba4f('0x6e')]['ListId']},'include':[{'model':db[_0xba4f('0x72')],'as':_0xba4f('0x95'),'where':_0x19c8f1,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xba4f('0x1d')](handleEntityNotFound(_0x4b6f1f,null))[_0xba4f('0x1d')](function(_0x2f7b12){if(_0x2f7b12){_0x378167[_0xba4f('0x96')]=_['omit'](_0x2f7b12,['Contacts']);if(_0x2f7b12[_0xba4f('0x95')][_0xba4f('0x46')]){return _0x2f7b12[_0xba4f('0x95')][0x0];}var _0x48966c=_[_0xba4f('0x97')](_0x378167[_0xba4f('0x61')],{'firstName':_0x378167[_0xba4f('0x61')]['from'],'ListId':_0x2f7b12['id']});_0x48966c[_0x378167['body']['mapKey']]=_0x378167['body'][_0xba4f('0x7d')];return db[_0xba4f('0x72')][_0xba4f('0x5b')](_0x48966c,{'fields':_0x5d6bfd,'raw':!![]});}})[_0xba4f('0x1d')](handleEntityNotFound(_0x4b6f1f,null))[_0xba4f('0x1d')](function(_0x204597){if(_0x204597){_0x378167[_0xba4f('0x98')]=_0x204597;var _0xffdffe={'ContactId':_0x204597['id'],'phone':_0x378167['body'][_0xba4f('0x7d')],'SmsAccountId':_0x349416[_0xba4f('0x57')]['id']};var _0x1f86bd={'ContactId':_0x204597['id'],'SmsAccountId':_0x349416[_0xba4f('0x57')]['id'],'closed':![]};return db[_0xba4f('0x99')][_0xba4f('0x5a')]({'where':_0x1f86bd})[_0xba4f('0x1d')](function(_0x1b5073){if(_0x1b5073){return[_0x1b5073,![]];}return db[_0xba4f('0x99')][_0xba4f('0x5b')](_0xffdffe)['then'](function(_0x5d2d0d){return[_0x5d2d0d,!![]];});});}})[_0xba4f('0x9a')](function(_0x1dbd4a,_0x1efac1){_0x378167[_0xba4f('0x9b')]=_0x1dbd4a[_0xba4f('0x36')]({'plain':!![]});_0x378167[_0xba4f('0x9b')]['created']=![];if(_0x1efac1){if(_0x378167[_0xba4f('0x6e')]['autoclose']){_0x378167[_0xba4f('0x9c')]['push']({'id':0x0,'priority':_0x378167[_0xba4f('0x9c')][_0xba4f('0x46')]+0x1,'app':_0xba4f('0x9d'),'appdata':'unmanaged','interval':_0xba4f('0x9e')});}_0x378167[_0xba4f('0x9b')][_0xba4f('0x9f')]=!![];}return db[_0xba4f('0xa0')][_0xba4f('0x5b')]({'phone':_0x378167[_0xba4f('0x61')][_0xba4f('0x7d')],'messageId':_0x378167[_0xba4f('0x61')][_0xba4f('0x84')],'body':_0x378167[_0xba4f('0x61')][_0xba4f('0x61')],'SmsAccountId':_0x349416[_0xba4f('0x57')]['id'],'SmsInteractionId':_0x1dbd4a['id'],'direction':'in','ContactId':_0x1dbd4a[_0xba4f('0xa1')],'AttachmentId':_0x378167['body'][_0xba4f('0xa2')]});})[_0xba4f('0x1d')](function(_0x5419f8){_0x378167[_0xba4f('0x25')]=_0x5419f8;if(!_0x378167[_0xba4f('0x9b')]['UserId'])return;return db[_0xba4f('0xa3')][_0xba4f('0x5a')]({'attributes':['id',_0xba4f('0x3a')],'where':{'id':_0x378167[_0xba4f('0x9b')]['UserId']}});})['then'](function(_0x1db1ee){if(_0x1db1ee){_0x378167[_0xba4f('0x9c')][_0xba4f('0xa4')]({'id':0x0,'priority':0x0,'app':_0xba4f('0xa5'),'appdata':_0x1db1ee[_0xba4f('0x3a')]+','+(_0x378167['account']['waitForTheAssignedAgent']||0xa),'interval':_0xba4f('0x9e')});}if(!_0x378167[_0xba4f('0x9b')]['queueId'])return;return db['SmsQueue'][_0xba4f('0x5a')]({'attributes':['id',_0xba4f('0x3a')],'where':{'id':_0x378167[_0xba4f('0x9b')][_0xba4f('0xa6')]}});})[_0xba4f('0x1d')](function(_0xc6e7a6){if(_0xc6e7a6){_0x378167[_0xba4f('0x9c')][_0xba4f('0xa4')]({'id':0x0,'priority':0x1,'app':_0xba4f('0xa7'),'appdata':_0xc6e7a6[_0xba4f('0x3a')]+','+(_0x378167[_0xba4f('0x6e')][_0xba4f('0xa8')]||0x12c),'interval':_0xba4f('0x9e')});}return respondWithRpcPromise(_0xba4f('0xa9'),_0xba4f('0xaa'),_0x378167);})[_0xba4f('0x1d')](function(_0x49a550){if(_0x49a550){var _0x2e58af=0xc8;var _0x4b6338=_0xba4f('0xab');logger[_0xba4f('0x1e')](_0xba4f('0xac'),_0x4b6338,_0x2e58af,_0xba4f('0xad'));logger[_0xba4f('0x21')](_0xba4f('0xae'),_0x4b6338,_0x2e58af,_0xba4f('0xad'),JSON['stringify'](_0x49a550));if(_0x378167['account'][_0xba4f('0x40')]===_0xba4f('0x7c')){return _0x4b6f1f[_0xba4f('0x29')](_0x2e58af)['set'](_0xba4f('0xaf'),_0xba4f('0xb0'))[_0xba4f('0x3b')](_0xba4f('0xb1'));}else{return _0x4b6f1f[_0xba4f('0x29')](_0x2e58af)[_0xba4f('0x2b')](_0x49a550);}}})[_0xba4f('0x27')](handleError(_0x4b6f1f,null));};exports['addApplications']=function(_0x3e28a,_0x2f70c2){var _0x41ae18=_0x3e28a[_0xba4f('0x57')]['id'];var _0x8ede43=_0x3e28a[_0xba4f('0x61')];var _0x2b076d=0xc8;var _0x3aa781=null;return db[_0xba4f('0xb2')][_0xba4f('0xb3')]({'isolationLevel':db[_0xba4f('0xb2')][_0xba4f('0xb4')][_0xba4f('0xb5')][_0xba4f('0xb6')]},function(_0x128e62){return db[_0xba4f('0x51')][_0xba4f('0x64')]({'where':{'id':_0x41ae18},'transaction':_0x128e62})[_0xba4f('0x1d')](function(_0x5181c7){if(_0x5181c7){return db[_0xba4f('0x6c')][_0xba4f('0x35')]({'where':{'SmsAccountId':_0x41ae18},'transaction':_0x128e62})[_0xba4f('0x1d')](function(){var _0x40ba95=_[_0xba4f('0x3e')](_0x8ede43,function(_0x17125e){_0x17125e[_0xba4f('0x65')]=_0x41ae18;return _0x17125e;});return db['SmsApplication'][_0xba4f('0xb7')](_0x40ba95,{'transaction':_0x128e62});});}else{_0x2b076d=0x194;_0x3aa781=[];}});})[_0xba4f('0x1d')](function(){if(_0x2b076d!==0x194){return db[_0xba4f('0x6c')]['findAndCountAll']({'where':{'SmsAccountId':_0x41ae18},'order':'priority'})[_0xba4f('0x1d')](function(_0x2d6b72){_0x3aa781=_0x2d6b72;});}})[_0xba4f('0x27')](function(_0x171880){_0x2b076d=0x1f4;logger['error'](_0x171880[_0xba4f('0x39')]);if(_0x171880[_0xba4f('0x3a')]){delete _0x171880[_0xba4f('0x3a')];}_0x3aa781=_0x171880;})[_0xba4f('0xb8')](function(){if(_0x3aa781===null){_0x2f70c2[_0xba4f('0x28')](_0x2b076d);}else{if(_0x2b076d===0x1f4){_0x2f70c2[_0xba4f('0x29')](_0x2b076d)[_0xba4f('0x3b')](_0x3aa781);}else{_0x2f70c2['status'](_0x2b076d)[_0xba4f('0x2b')](_0x3aa781);}}});};exports['getApplications']=function(_0x3f76d0,_0x80ac82,_0x1533cb){var _0x1fd2e3={};var _0x130cdb={};var _0x5dd119;var _0x246b4a;return db['SmsAccount']['findOne']({'where':{'id':_0x3f76d0['params']['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x80ac82,null))['then'](function(_0x3f773d){if(_0x3f773d){_0x5dd119=_0x3f773d;_0x130cdb[_0xba4f('0x42')]=_[_0xba4f('0x59')](db[_0xba4f('0x6c')][_0xba4f('0x3f')]);_0x130cdb[_0xba4f('0x41')]=_['keys'](_0x3f76d0[_0xba4f('0x41')]);_0x130cdb[_0xba4f('0x4b')]=_[_0xba4f('0x43')](_0x130cdb[_0xba4f('0x42')],_0x130cdb[_0xba4f('0x41')]);_0x1fd2e3[_0xba4f('0x45')]=_['intersection'](_0x130cdb[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x3f76d0[_0xba4f('0x41')][_0xba4f('0x44')]));_0x1fd2e3[_0xba4f('0x45')]=_0x1fd2e3[_0xba4f('0x45')][_0xba4f('0x46')]?_0x1fd2e3['attributes']:_0x130cdb[_0xba4f('0x42')];_0x1fd2e3['order']=qs[_0xba4f('0x4a')](_0x3f76d0[_0xba4f('0x41')][_0xba4f('0x4a')]);_0x1fd2e3[_0xba4f('0x4e')]=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x3f76d0['query'],_0x130cdb['filters']));if(_0x3f76d0['query'][_0xba4f('0x4d')]){_0x1fd2e3[_0xba4f('0x4e')]=_['merge'](_0x1fd2e3[_0xba4f('0x4e')],{'$or':_[_0xba4f('0x3e')](_0x1fd2e3[_0xba4f('0x45')],function(_0x52e2a5){var _0xa4e9b1={};_0xa4e9b1[_0x52e2a5]={'$like':'%'+_0x3f76d0[_0xba4f('0x41')][_0xba4f('0x4d')]+'%'};return _0xa4e9b1;})});}_0x1fd2e3=_[_0xba4f('0x4f')]({},_0x1fd2e3,_0x3f76d0['options']);return _0x5dd119['getApplications'](_0x1fd2e3);}})['then'](function(_0xd90d23){if(_0xd90d23){_0x246b4a=_0xd90d23[_0xba4f('0x46')];if(!_0x3f76d0[_0xba4f('0x41')][_0xba4f('0x47')](_0xba4f('0x48'))){_0x1fd2e3[_0xba4f('0x2f')]=qs[_0xba4f('0x2f')](_0x3f76d0['query'][_0xba4f('0x2f')]);_0x1fd2e3[_0xba4f('0x2d')]=qs[_0xba4f('0x2d')](_0x3f76d0[_0xba4f('0x41')][_0xba4f('0x2d')]);}return _0x5dd119[_0xba4f('0xb9')](_0x1fd2e3);}})['then'](function(_0x5e62df){if(_0x5e62df){return _0x5e62df?{'count':_0x246b4a,'rows':_0x5e62df}:null;}})['then'](respondWithResult(_0x80ac82,null))['catch'](handleError(_0x80ac82,null));};exports['getInteractions']=function(_0x4289bb,_0x17f6bf,_0x1d21fc){var _0x59efb5={'raw':![],'where':{}};var _0x3c3d07={};var _0x5d0b3e={'count':0x0,'rows':[]};return db['SmsAccount'][_0xba4f('0x64')]({'where':{'id':_0x4289bb['params']['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x17f6bf,null))['then'](function(_0x2d91fc){if(_0x2d91fc){_0x3c3d07['model']=_[_0xba4f('0x59')](db[_0xba4f('0x99')][_0xba4f('0x3f')]);_0x3c3d07[_0xba4f('0x41')]=_['keys'](_0x4289bb[_0xba4f('0x41')]);_0x3c3d07[_0xba4f('0x4b')]=_['intersection'](_0x3c3d07[_0xba4f('0x42')],_0x3c3d07[_0xba4f('0x41')]);_0x59efb5[_0xba4f('0x45')]=_[_0xba4f('0x43')](_0x3c3d07[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x4289bb[_0xba4f('0x41')][_0xba4f('0x44')]));_0x59efb5[_0xba4f('0x45')]=_0x59efb5['attributes']['length']?_0x59efb5[_0xba4f('0x45')]:_0x3c3d07[_0xba4f('0x42')];if(!_0x4289bb[_0xba4f('0x41')]['hasOwnProperty'](_0xba4f('0x48'))){_0x59efb5[_0xba4f('0x2f')]=qs[_0xba4f('0x2f')](_0x4289bb['query']['limit']);_0x59efb5[_0xba4f('0x2d')]=qs[_0xba4f('0x2d')](_0x4289bb[_0xba4f('0x41')][_0xba4f('0x2d')]);}_0x59efb5[_0xba4f('0x49')]=qs[_0xba4f('0x4a')](_0x4289bb[_0xba4f('0x41')][_0xba4f('0x4a')]);_0x59efb5[_0xba4f('0x4e')]=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x4289bb[_0xba4f('0x41')],_0x3c3d07[_0xba4f('0x4b')]));_0x59efb5[_0xba4f('0x4e')]['SmsAccountId']=_0x2d91fc['id'];if(_0x4289bb['query']['filter']){_0x59efb5[_0xba4f('0x4e')]=_[_0xba4f('0x4f')](_0x59efb5[_0xba4f('0x4e')],{'$or':_[_0xba4f('0x3e')](_0x59efb5[_0xba4f('0x45')],function(_0x2912fb){var _0xea33ac={};_0xea33ac[_0x2912fb]={'$like':'%'+_0x4289bb[_0xba4f('0x41')][_0xba4f('0x4d')]+'%'};return _0xea33ac;})});}_0x59efb5=_[_0xba4f('0x4f')]({},_0x59efb5,_0x4289bb[_0xba4f('0x50')]);return db['SmsInteraction'][_0xba4f('0x2e')]({'where':_0x59efb5[_0xba4f('0x4e')]})[_0xba4f('0x1d')](function(_0x2c62f7){_0x5d0b3e[_0xba4f('0x2e')]=_0x2c62f7;if(_0x4289bb[_0xba4f('0x41')][_0xba4f('0x52')]){_0x59efb5['include']=[{'model':db[_0xba4f('0x72')],'as':_0xba4f('0xba'),'required':![]},{'model':db[_0xba4f('0xa3')],'as':'Owner','attributes':[_0xba4f('0x3a'),_0xba4f('0xbb'),_0xba4f('0xbc')],'required':![]},{'model':db[_0xba4f('0xbd')],'as':'Tags','attributes':['id',_0xba4f('0x3a'),_0xba4f('0xbe')],'where':_0x4289bb[_0xba4f('0x41')]['tag']?{'id':_0x4289bb[_0xba4f('0x41')][_0xba4f('0xbf')]}:undefined,'required':_0x4289bb[_0xba4f('0x41')][_0xba4f('0xbf')]?!![]:![]}];}return db[_0xba4f('0x99')]['findAll'](_0x59efb5);})[_0xba4f('0x1d')](function(_0x49281b){_0x5d0b3e[_0xba4f('0x55')]=_0x49281b;return _0x5d0b3e;});}})[_0xba4f('0x1d')](respondWithFilteredResult(_0x17f6bf,_0x59efb5))['catch'](handleError(_0x17f6bf,null));};exports[_0xba4f('0x3b')]=function(_0x49f2e7,_0x4cb674,_0x346ae2){var _0x1de21f,_0x418c70,_0x4ee370;if(_[_0xba4f('0x8d')](_0x49f2e7[_0xba4f('0x61')][_0xba4f('0x61')])||_0x49f2e7[_0xba4f('0x61')][_0xba4f('0x61')]===''){throw new db[(_0xba4f('0x74'))][(_0xba4f('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xba4f('0x8d')](_0x49f2e7[_0xba4f('0x61')]['to'])){throw new db[(_0xba4f('0x74'))][(_0xba4f('0x75'))](_0xba4f('0xc0'));}_0x1de21f=_0x49f2e7[_0xba4f('0x61')]['to'];return db[_0xba4f('0x51')][_0xba4f('0x5a')]({'where':{'id':_0x49f2e7[_0xba4f('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xba4f('0xc1'),'include':[{'model':db['CmContact'],'as':_0xba4f('0x95'),'where':{'mobile':_0x1de21f},'limit':0x1,'order':[['updatedAt',_0xba4f('0xc2')]]}]}]})[_0xba4f('0x1d')](handleEntityNotFound(_0x4cb674,null))['then'](function(_0x36c515){if(_0x36c515&&_0x36c515[_0xba4f('0xc1')]){_0x418c70=_0x36c515[_0xba4f('0x36')]({'plain':!![]});if(_0x418c70['List']&&_0x418c70[_0xba4f('0xc1')][_0xba4f('0x95')][_0xba4f('0x46')]){return _0x418c70[_0xba4f('0xc1')][_0xba4f('0x95')][0x0];}return db[_0xba4f('0x72')]['create'](_[_0xba4f('0x97')](_0x49f2e7[_0xba4f('0x61')],{'firstName':_0x1de21f,'mobile':_0x1de21f,'phone':_0x1de21f,'ListId':_0x418c70[_0xba4f('0xc3')]}));}})[_0xba4f('0x1d')](handleEntityNotFound(_0x4cb674,null))[_0xba4f('0x1d')](function(_0x1e5282){if(_0x1e5282){_0x4ee370=_0x1e5282;return db[_0xba4f('0x99')][_0xba4f('0x5a')]({'where':{'ContactId':_0x4ee370['id'],'closed':![],'SmsAccountId':_0x418c70['id']}})[_0xba4f('0x1d')](function(_0x1bdce8){if(_0x1bdce8){return[_0x1bdce8,![]];}return db['SmsInteraction'][_0xba4f('0x5b')]({'UserId':_0x49f2e7[_0xba4f('0x5c')]['id'],'ContactId':_0x4ee370['id'],'SmsAccountId':_0x418c70['id'],'phone':_0x1de21f,'firstMsgDirection':_0xba4f('0xc4'),'Messages':[_['merge'](_0x49f2e7['body'],{'read':![],'body':_0x49f2e7[_0xba4f('0x61')][_0xba4f('0x61')],'phone':_0x1de21f,'SmsAccountId':_0x418c70['id'],'UserId':_0x49f2e7['user']['id'],'ContactId':_0x4ee370['id']})]},{'include':[{'model':db[_0xba4f('0xa0')],'as':_0xba4f('0xc5')}]})['then'](function(_0x2762f8){return[_0x2762f8,!![]];});});}})[_0xba4f('0x9a')](function(_0x448963,_0x6433b5){if(_0x6433b5){return _0x448963;}return db[_0xba4f('0xa0')][_0xba4f('0x5b')](_[_0xba4f('0x4f')](_0x49f2e7[_0xba4f('0x61')],{'read':![],'body':_0x49f2e7[_0xba4f('0x61')][_0xba4f('0x61')],'phone':_0x1de21f,'SmsAccountId':_0x418c70['id'],'SmsInteractionId':_0x448963['id'],'UserId':_0x49f2e7[_0xba4f('0x5c')]['id'],'ContactId':_0x4ee370['id']}))[_0xba4f('0x1d')](function(_0x3f603c){_0x448963[_0xba4f('0xc6')][_0xba4f('0xc5')]=[];_0x448963[_0xba4f('0xc6')][_0xba4f('0xc5')]['push'](_0x3f603c[_0xba4f('0xc6')]);return _0x448963;});})[_0xba4f('0x1d')](respondWithResult(_0x4cb674,null))[_0xba4f('0x27')](handleError(_0x4cb674,null));};exports[_0xba4f('0x29')]=function(_0x3361ea,_0x399a7a,_0x1a0ade){if(_0x3361ea[_0xba4f('0x61')]['id']){delete _0x3361ea['body']['id'];}var _0x1da220,_0x5e9f64,_0x49b828;return db['SmsAccount'][_0xba4f('0x5a')]({'where':{'id':_0x3361ea['params']['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x399a7a,null))[_0xba4f('0x1d')](function(_0xdf716e){if(_0xdf716e){_0x49b828=_0xdf716e;logger[_0xba4f('0x21')](_0xba4f('0xac'),_0xba4f('0x29'),'received\x20delivery\x20report\x20from',_0xdf716e[_0xba4f('0x40')],util[_0xba4f('0xc7')](_0x3361ea['body'],{'showHidden':![],'depth':null}));switch(_0xdf716e[_0xba4f('0x40')]){case _0xba4f('0xc8'):if(_0x3361ea[_0xba4f('0x61')][_0xba4f('0xc9')]&&_0x3361ea[_0xba4f('0x61')][_0xba4f('0x29')]){_0x5e9f64=_0x3361ea[_0xba4f('0x61')][_0xba4f('0x29')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea['body'][_0xba4f('0xc9')]}});}break;case _0xba4f('0x82'):if(_0x3361ea[_0xba4f('0x61')]['requestid']&&_0x3361ea[_0xba4f('0x61')][_0xba4f('0xca')]){_0x5e9f64=_0x3361ea[_0xba4f('0x61')][_0xba4f('0xca')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea[_0xba4f('0x61')]['requestid']}});}break;case'clicksend':if(_0x3361ea[_0xba4f('0x61')][_0xba4f('0x85')]&&_0x3361ea[_0xba4f('0x61')][_0xba4f('0xcb')]){_0x5e9f64=_0x3361ea[_0xba4f('0x61')][_0xba4f('0xcb')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea[_0xba4f('0x61')][_0xba4f('0x85')]}});}break;case'infobip':var _0x5d0b5f=_0x3361ea['body'][_0xba4f('0x88')][0x0];if(_0x5d0b5f[_0xba4f('0x84')]&&_0x5d0b5f['status'][_0xba4f('0xcc')]===_0xba4f('0xcd')){_0x5e9f64=_0x5d0b5f[_0xba4f('0x29')][_0xba4f('0xcc')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x5d0b5f[_0xba4f('0x84')]}});}break;case'clickatell':if(_0x3361ea[_0xba4f('0x61')]['messageId']&&_0x3361ea['body']['status']){_0x5e9f64=_0x3361ea['body'][_0xba4f('0x29')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea['body']['messageId']}});}break;case _0xba4f('0xce'):if(_0x3361ea[_0xba4f('0x61')][0x0][_0xba4f('0x25')]['id']){_0x5e9f64=_0x3361ea['body'][0x0]['type'];return db['SmsMessage'][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea[_0xba4f('0x61')][0x0]['message']['id']}});}break;case _0xba4f('0xcf'):if(_0x3361ea[_0xba4f('0x61')][_0xba4f('0xd0')]&&_0x3361ea[_0xba4f('0x61')][_0xba4f('0x29')]){_0x5e9f64=_0x3361ea[_0xba4f('0x61')]['status'];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3361ea[_0xba4f('0x61')][_0xba4f('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x399a7a,null))['then'](function(_0x7d94d1){if(_0x7d94d1){_0x1da220=_0x7d94d1;switch(_0x49b828[_0xba4f('0x40')]){case _0xba4f('0xc8'):if(_0x5e9f64===_0xba4f('0xcd')){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),'status',_0xba4f('0xc8'),util[_0xba4f('0xc7')](_0x3361ea['body'],{'showHidden':![],'depth':null}));}break;case _0xba4f('0x82'):if(_0x5e9f64==='1'){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),'status',_0xba4f('0xc8'),util['inspect'](_0x3361ea[_0xba4f('0x61')],{'showHidden':![],'depth':null}));}break;case _0xba4f('0x83'):if(!_0x3361ea[_0xba4f('0x61')][_0xba4f('0xd1')]&&_0x5e9f64>=0xc8&&_0x5e9f64<=0xce){return _0x1da220['update']({'read':!![]});}else{logger['error'](_0xba4f('0xac'),_0xba4f('0x29'),_0xba4f('0x83'),util[_0xba4f('0xc7')](_0x3361ea[_0xba4f('0x61')],{'showHidden':![],'depth':null}));}break;case _0xba4f('0xd2'):var _0xa1d59=_0x3361ea[_0xba4f('0x61')]['results'][0x0];if(_0xa1d59[_0xba4f('0x29')]['groupName']==='DELIVERED'){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),_0xba4f('0x29'),_0xba4f('0xd2'),util['inspect'](_0x3361ea[_0xba4f('0x61')],{'showHidden':![],'depth':null}));}break;case _0xba4f('0x8b'):if(_0x5e9f64=='DELIVERED_TO_GATEWAY'||_0x5e9f64==_0xba4f('0xd3')){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger['error'](_0xba4f('0xac'),'status',_0xba4f('0x8b'),util['inspect'](_0x3361ea['body'],{'showHidden':![],'depth':null}));}break;case _0xba4f('0xce'):if(_0x5e9f64==_0xba4f('0xd4')){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),_0xba4f('0x29'),_0xba4f('0xce'),util['inspect'](_0x3361ea[_0xba4f('0x61')],{'showHidden':![],'depth':null}));}break;case _0xba4f('0xcf'):if(_0x5e9f64===_0xba4f('0xd5')||_0x5e9f64===_0xba4f('0xd6')){return _0x1da220[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),_0xba4f('0x29'),_0xba4f('0xcf'),util[_0xba4f('0xc7')](_0x3361ea['body'],{'showHidden':![],'depth':null}));}break;}return _0x1da220;}})['then'](respondWithResult(_0x399a7a,null))[_0xba4f('0x27')](handleError(_0x399a7a,null));};exports[_0xba4f('0xd7')]=function(_0x3147a9,_0x2e8117,_0x21e61d){var _0x2ce1ed,_0x1cb6f2,_0x198ba4;return db[_0xba4f('0x51')][_0xba4f('0x5a')]({'where':{'id':_0x3147a9[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x2e8117,null))[_0xba4f('0x1d')](function(_0x20c1ef){if(_0x20c1ef){_0x198ba4=_0x20c1ef;logger[_0xba4f('0x21')](_0xba4f('0xac'),'status',_0xba4f('0xd8'),_0x20c1ef[_0xba4f('0x40')],util[_0xba4f('0xc7')](_0x3147a9['query'],{'showHidden':![],'depth':null}));switch(_0x20c1ef[_0xba4f('0x40')]){case _0xba4f('0x89'):if(_0x3147a9[_0xba4f('0x41')][_0xba4f('0xd9')]&&_0x3147a9[_0xba4f('0x41')]['state']){_0x1cb6f2=_0x3147a9[_0xba4f('0x41')][_0xba4f('0xda')];return db[_0xba4f('0xa0')][_0xba4f('0x5a')]({'where':{'messageId':_0x3147a9[_0xba4f('0x41')][_0xba4f('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x2e8117,null))[_0xba4f('0x1d')](function(_0x4810f6){if(_0x4810f6){_0x2ce1ed=_0x4810f6;switch(_0x198ba4[_0xba4f('0x40')]){case'csc':if(_0x1cb6f2==='2'||_0x1cb6f2==='6'){return _0x2ce1ed[_0xba4f('0x34')]({'read':!![]});}else{logger[_0xba4f('0x24')](_0xba4f('0xac'),_0xba4f('0x29'),_0xba4f('0x89'),util[_0xba4f('0xc7')](_0x3147a9[_0xba4f('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x2ce1ed;}})['then'](respondWithResult(_0x2e8117,null))[_0xba4f('0x27')](handleError(_0x2e8117,null));};exports['addAgents']=function(_0x17f149,_0x4bd79d,_0x406323){return db['SmsAccount'][_0xba4f('0x5a')]({'where':{'id':_0x17f149[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x4bd79d,null))[_0xba4f('0x1d')](function(_0x5e8bb0){if(_0x5e8bb0){return _0x5e8bb0[_0xba4f('0xdb')](_0x17f149[_0xba4f('0x61')][_0xba4f('0x68')],_['omit'](_0x17f149['body'],[_0xba4f('0x68'),'id'])||{})[_0xba4f('0x9a')](function(_0x96523e){for(var _0x37c589=0x0;_0x37c589<_0x17f149[_0xba4f('0x61')][_0xba4f('0x68')][_0xba4f('0x46')];_0x37c589+=0x1){socket[_0xba4f('0xdc')](_0xba4f('0xdd'),{'UserId':Number(_0x17f149[_0xba4f('0x61')][_0xba4f('0x68')][_0x37c589]),'SmsAccountId':Number(_0x17f149['params']['id'])});}return _0x96523e;});}})[_0xba4f('0x1d')](respondWithResult(_0x4bd79d,null))[_0xba4f('0x27')](handleError(_0x4bd79d,null));};exports[_0xba4f('0xde')]=function(_0x2de21d,_0x4c6ced,_0x42b892){return db[_0xba4f('0x51')]['find']({'where':{'id':_0x2de21d[_0xba4f('0x57')]['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x4c6ced,null))[_0xba4f('0x1d')](function(_0x23ec91){if(_0x23ec91){return _0x23ec91['removeAgents'](_0x2de21d[_0xba4f('0x41')][_0xba4f('0x68')])['then'](function(){if(_[_0xba4f('0xdf')](_0x2de21d[_0xba4f('0x41')][_0xba4f('0x68')])){for(var _0x45d690=0x0;_0x45d690<_0x2de21d[_0xba4f('0x41')][_0xba4f('0x68')][_0xba4f('0x46')];_0x45d690+=0x1){socket[_0xba4f('0xdc')](_0xba4f('0xe0'),{'UserId':Number(_0x2de21d['query'][_0xba4f('0x68')][_0x45d690]),'SmsAccountId':Number(_0x2de21d[_0xba4f('0x57')]['id'])});}}else{socket[_0xba4f('0xdc')](_0xba4f('0xe0'),{'UserId':Number(_0x2de21d[_0xba4f('0x41')]['ids']),'SmsAccountId':Number(_0x2de21d['params']['id'])});}});}})[_0xba4f('0x1d')](respondWithStatusCode(_0x4c6ced,null))[_0xba4f('0x27')](handleError(_0x4c6ced,null));};exports[_0xba4f('0xe1')]=function(_0x20dbd5,_0x263a2c,_0x285b0f){var _0x3b8933={};var _0x9a26bb={};var _0x287bed;var _0xd10bff;return db[_0xba4f('0x51')]['findOne']({'where':{'id':_0x20dbd5['params']['id']}})[_0xba4f('0x1d')](handleEntityNotFound(_0x263a2c,null))[_0xba4f('0x1d')](function(_0x5e2193){if(_0x5e2193){_0x287bed=_0x5e2193;_0x9a26bb[_0xba4f('0x42')]=_[_0xba4f('0x59')](db[_0xba4f('0xa3')][_0xba4f('0x3f')]);_0x9a26bb['query']=_[_0xba4f('0x59')](_0x20dbd5[_0xba4f('0x41')]);_0x9a26bb['filters']=_[_0xba4f('0x43')](_0x9a26bb[_0xba4f('0x42')],_0x9a26bb[_0xba4f('0x41')]);_0x3b8933[_0xba4f('0x45')]=_['intersection'](_0x9a26bb[_0xba4f('0x42')],qs[_0xba4f('0x44')](_0x20dbd5[_0xba4f('0x41')][_0xba4f('0x44')]));_0x3b8933[_0xba4f('0x45')]=_0x3b8933[_0xba4f('0x45')]['length']?_0x3b8933['attributes']:_0x9a26bb['model'];_0x3b8933[_0xba4f('0x49')]=qs['sort'](_0x20dbd5['query'][_0xba4f('0x4a')]);_0x3b8933[_0xba4f('0x4e')]=qs[_0xba4f('0x4b')](_[_0xba4f('0x4c')](_0x20dbd5[_0xba4f('0x41')],_0x9a26bb[_0xba4f('0x4b')]));if(_0x20dbd5[_0xba4f('0x41')][_0xba4f('0x4d')]){_0x3b8933[_0xba4f('0x4e')]=_['merge'](_0x3b8933[_0xba4f('0x4e')],{'$or':_[_0xba4f('0x3e')](_0x3b8933[_0xba4f('0x45')],function(_0x2b62fa){var _0x368aa1={};_0x368aa1[_0x2b62fa]={'$like':'%'+_0x20dbd5['query'][_0xba4f('0x4d')]+'%'};return _0x368aa1;})});}_0x3b8933=_['merge']({},_0x3b8933,_0x20dbd5['options']);return _0x287bed[_0xba4f('0xe1')](_0x3b8933);}})[_0xba4f('0x1d')](function(_0x5e9e09){if(_0x5e9e09){_0xd10bff=_0x5e9e09['length'];if(!_0x20dbd5[_0xba4f('0x41')]['hasOwnProperty'](_0xba4f('0x48'))){_0x3b8933[_0xba4f('0x2f')]=qs[_0xba4f('0x2f')](_0x20dbd5[_0xba4f('0x41')][_0xba4f('0x2f')]);_0x3b8933['offset']=qs['offset'](_0x20dbd5['query'][_0xba4f('0x2d')]);}return _0x287bed[_0xba4f('0xe1')](_0x3b8933);}})[_0xba4f('0x1d')](function(_0x2d8cf6){if(_0x2d8cf6){return _0x2d8cf6?{'count':_0xd10bff,'rows':_0x2d8cf6}:null;}})[_0xba4f('0x1d')](respondWithResult(_0x263a2c,null))[_0xba4f('0x27')](handleError(_0x263a2c,null));}; \ No newline at end of file +var _0x2786=['error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','model','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','type','VIRTUAL','filter','SmsAccount','includeAll','include','findAll','rows','params','keys','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','getDispositions','findOne','nolimit','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','account','applications','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','waitForTheAssignedAgent','SmsQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','\x0a','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','finally','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','DELIVERED','groupName','redif','error_code','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a5b82,_0xc61f63){var _0x322e1a=function(_0x3b2858){while(--_0x3b2858){_0x2a5b82['push'](_0x2a5b82['shift']());}};_0x322e1a(++_0xc61f63);}(_0x2786,0xc5));var _0x6278=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2786[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x6278('0x0'));var rimraf=require(_0x6278('0x1'));var zipdir=require(_0x6278('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6278('0x3'));var moment=require(_0x6278('0x4'));var BPromise=require(_0x6278('0x5'));var Mustache=require(_0x6278('0x6'));var util=require('util');var path=require(_0x6278('0x7'));var sox=require(_0x6278('0x8'));var csv=require(_0x6278('0x9'));var ejs=require(_0x6278('0xa'));var fs=require('fs');var fs_extra=require(_0x6278('0xb'));var _=require(_0x6278('0xc'));var squel=require(_0x6278('0xd'));var crypto=require(_0x6278('0xe'));var jsforce=require(_0x6278('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6278('0x10'));var Papa=require('papaparse');var Redis=require(_0x6278('0x11'));var authService=require(_0x6278('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6278('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6278('0x14'));var utils=require(_0x6278('0x15'));var config=require(_0x6278('0x16'));var licenseUtil=require(_0x6278('0x17'));var db=require(_0x6278('0x18'))['db'];config[_0x6278('0x19')]=_[_0x6278('0x1a')](config[_0x6278('0x19')],{'host':_0x6278('0x1b'),'port':0x18eb});var socket=require(_0x6278('0x1c'))(new Redis(config[_0x6278('0x19')]));require(_0x6278('0x1d'))['register'](socket);var jayson=require(_0x6278('0x1e'));var client=jayson['client'][_0x6278('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xa1c3,_0x54ee6c,_0x2c46cd,_0xef6591){return new BPromise(function(_0x11589f,_0x33455c){var _0x1a5ef7=_0xef6591||client;return _0x1a5ef7[_0x6278('0x20')](_0xa1c3,_0x2c46cd)[_0x6278('0x21')](function(_0x449444){logger[_0x6278('0x22')](_0x6278('0x23'),_0x54ee6c,_0x6278('0x24'));logger['debug'](_0x6278('0x25'),_0x54ee6c,'request\x20sent',JSON[_0x6278('0x26')](_0x449444));if(_0x449444[_0x6278('0x27')]){if(_0x449444[_0x6278('0x27')][_0x6278('0x28')]===0x1f4){logger[_0x6278('0x27')](_0x6278('0x23'),_0x54ee6c,_0x449444[_0x6278('0x27')]['message']);return _0x33455c(_0x449444[_0x6278('0x27')][_0x6278('0x29')]);}logger[_0x6278('0x27')]('SmsAccount,\x20%s,\x20%s',_0x54ee6c,_0x449444['error'][_0x6278('0x29')]);return _0x11589f(_0x449444[_0x6278('0x27')][_0x6278('0x29')]);}else{logger['info'](_0x6278('0x23'),_0x54ee6c,'request\x20sent');_0x11589f(_0x449444[_0x6278('0x2a')]['message']);}})[_0x6278('0x2b')](function(_0x33fc41){logger[_0x6278('0x27')]('SmsAccount,\x20%s,\x20%s',_0x54ee6c,_0x33fc41);_0x33455c(_0x33fc41);});});}function respondWithStatusCode(_0x261c60,_0x4ab5a6){_0x4ab5a6=_0x4ab5a6||0xcc;return function(_0x435b5e){if(_0x435b5e){return _0x261c60[_0x6278('0x2c')](_0x4ab5a6);}return _0x261c60['status'](_0x4ab5a6)['end']();};}function respondWithResult(_0x1f7bf8,_0xb29521){_0xb29521=_0xb29521||0xc8;return function(_0x2293e2){if(_0x2293e2){return _0x1f7bf8[_0x6278('0x2d')](_0xb29521)[_0x6278('0x2e')](_0x2293e2);}};}function respondWithFilteredResult(_0x429c8f,_0x18d652){return function(_0x39ab87){if(_0x39ab87){var _0x115bae=typeof _0x18d652[_0x6278('0x2f')]===_0x6278('0x30')&&typeof _0x18d652[_0x6278('0x31')]===_0x6278('0x30');var _0x4161b5=_0x39ab87['count'];var _0x46e1bc=_0x115bae?0x0:_0x18d652[_0x6278('0x2f')];var _0x3b0175=_0x115bae?_0x39ab87[_0x6278('0x32')]:_0x18d652[_0x6278('0x2f')]+_0x18d652['limit'];var _0x1c9351;if(_0x3b0175>=_0x4161b5){_0x3b0175=_0x4161b5;_0x1c9351=0xc8;}else{_0x1c9351=0xce;}_0x429c8f[_0x6278('0x2d')](_0x1c9351);return _0x429c8f[_0x6278('0x33')](_0x6278('0x34'),_0x46e1bc+'-'+_0x3b0175+'/'+_0x4161b5)[_0x6278('0x2e')](_0x39ab87);}return null;};}function patchUpdates(_0x291f82){return function(_0x408e40){try{jsonpatch[_0x6278('0x35')](_0x408e40,_0x291f82,!![]);}catch(_0x219c68){return BPromise[_0x6278('0x36')](_0x219c68);}return _0x408e40['save']();};}function saveUpdates(_0x540ea9,_0x3dc06b){return function(_0x210b30){if(_0x210b30){return _0x210b30[_0x6278('0x37')](_0x540ea9)[_0x6278('0x21')](function(_0x65cda4){return _0x65cda4;});}return null;};}function removeEntity(_0x1b6bf7,_0x355143){return function(_0x5f5915){if(_0x5f5915){return _0x5f5915[_0x6278('0x38')]()['then'](function(){var _0x389e06=_0x5f5915[_0x6278('0x39')]({'plain':!![]});var _0x4774f1=_0x6278('0x3a');return db[_0x6278('0x3b')]['destroy']({'where':{'type':_0x4774f1,'resourceId':_0x389e06['id']}})[_0x6278('0x21')](function(){return _0x5f5915;});})[_0x6278('0x21')](function(){_0x1b6bf7[_0x6278('0x2d')](0xcc)[_0x6278('0x3c')]();});}};}function handleEntityNotFound(_0x4f0a2d,_0x503558){return function(_0x1c89af){if(!_0x1c89af){_0x4f0a2d['sendStatus'](0x194);}return _0x1c89af;};}function handleError(_0x584680,_0x5db99d){_0x5db99d=_0x5db99d||0x1f4;return function(_0x4d0315){logger[_0x6278('0x27')](_0x4d0315[_0x6278('0x3d')]);if(_0x4d0315[_0x6278('0x3e')]){delete _0x4d0315['name'];}_0x584680[_0x6278('0x2d')](_0x5db99d)[_0x6278('0x3f')](_0x4d0315);};}exports[_0x6278('0x40')]=function(_0x207018,_0x3d04d3){var _0x390f71={'include':[{'model':db[_0x6278('0x41')],'as':_0x6278('0x42')}]},_0x52fb75={},_0x5c237a={'count':0x0,'rows':[]};var _0xcbbcef=_[_0x6278('0x43')](db['SmsAccount'][_0x6278('0x44')],function(_0x1744be){return{'name':_0x1744be[_0x6278('0x45')],'type':_0x1744be['type'][_0x6278('0x46')]};});_0x52fb75['model']=_[_0x6278('0x43')](_0xcbbcef,_0x6278('0x3e'));_0x52fb75[_0x6278('0x47')]=_['keys'](_0x207018['query']);_0x52fb75['filters']=_['intersection'](_0x52fb75[_0x6278('0x48')],_0x52fb75['query']);_0x390f71[_0x6278('0x49')]=_[_0x6278('0x4a')](_0x52fb75[_0x6278('0x48')],qs[_0x6278('0x4b')](_0x207018['query'][_0x6278('0x4b')]));_0x390f71[_0x6278('0x49')]=_0x390f71[_0x6278('0x49')]['length']?_0x390f71[_0x6278('0x49')]:_0x52fb75[_0x6278('0x48')];if(!_0x207018[_0x6278('0x47')][_0x6278('0x4c')]('nolimit')){_0x390f71['limit']=qs[_0x6278('0x31')](_0x207018[_0x6278('0x47')]['limit']);_0x390f71['offset']=qs[_0x6278('0x2f')](_0x207018[_0x6278('0x47')][_0x6278('0x2f')]);}_0x390f71['order']=qs[_0x6278('0x4d')](_0x207018[_0x6278('0x47')]['sort']);_0x390f71[_0x6278('0x4e')]=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x207018[_0x6278('0x47')],_0x52fb75[_0x6278('0x4f')]),_0xcbbcef);if(_0x207018[_0x6278('0x47')]['filter']){_0x390f71[_0x6278('0x4e')]=_[_0x6278('0x51')](_0x390f71[_0x6278('0x4e')],{'$or':_[_0x6278('0x43')](_0xcbbcef,function(_0x49d7e5){if(_0x49d7e5[_0x6278('0x52')]!==_0x6278('0x53')){var _0x5318c4={};_0x5318c4[_0x49d7e5[_0x6278('0x3e')]]={'$like':'%'+_0x207018[_0x6278('0x47')][_0x6278('0x54')]+'%'};return _0x5318c4;}})});}_0x390f71=_[_0x6278('0x51')]({},_0x390f71,_0x207018['options']);var _0x4b92ac={'where':_0x390f71[_0x6278('0x4e')]};return db[_0x6278('0x55')][_0x6278('0x32')](_0x4b92ac)[_0x6278('0x21')](function(_0xa334dd){_0x5c237a['count']=_0xa334dd;if(_0x207018[_0x6278('0x47')][_0x6278('0x56')]){_0x390f71[_0x6278('0x57')]=[{'all':!![]}];}return db[_0x6278('0x55')][_0x6278('0x58')](_0x390f71);})[_0x6278('0x21')](function(_0x49b54a){_0x5c237a[_0x6278('0x59')]=_0x49b54a;return _0x5c237a;})[_0x6278('0x21')](respondWithFilteredResult(_0x3d04d3,_0x390f71))[_0x6278('0x2b')](handleError(_0x3d04d3,null));};exports['show']=function(_0x917e72,_0x4ba934){var _0x144584={'raw':![],'where':{'id':_0x917e72[_0x6278('0x5a')]['id']},'include':[{'model':db[_0x6278('0x41')],'as':_0x6278('0x42')}]},_0x21c53b={};_0x21c53b[_0x6278('0x48')]=_[_0x6278('0x5b')](db[_0x6278('0x55')][_0x6278('0x44')]);_0x21c53b[_0x6278('0x47')]=_[_0x6278('0x5b')](_0x917e72['query']);_0x21c53b[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0x21c53b['model'],_0x21c53b['query']);_0x144584[_0x6278('0x49')]=_[_0x6278('0x4a')](_0x21c53b[_0x6278('0x48')],qs['fields'](_0x917e72[_0x6278('0x47')][_0x6278('0x4b')]));_0x144584[_0x6278('0x49')]=_0x144584[_0x6278('0x49')][_0x6278('0x5c')]?_0x144584[_0x6278('0x49')]:_0x21c53b['model'];if(_0x917e72[_0x6278('0x47')][_0x6278('0x56')]){_0x144584[_0x6278('0x57')]=[{'all':!![]}];}_0x144584=_[_0x6278('0x51')]({},_0x144584,_0x917e72[_0x6278('0x5d')]);return db[_0x6278('0x55')][_0x6278('0x5e')](_0x144584)[_0x6278('0x21')](handleEntityNotFound(_0x4ba934,null))['then'](respondWithResult(_0x4ba934,null))[_0x6278('0x2b')](handleError(_0x4ba934,null));};exports[_0x6278('0x5f')]=function(_0x53e6c7,_0x1b7856){return db[_0x6278('0x55')][_0x6278('0x5f')](_0x53e6c7[_0x6278('0x60')],{})[_0x6278('0x21')](function(_0x2f1c23){var _0x69778f=_0x53e6c7['user'][_0x6278('0x39')]({'plain':!![]});if(!_0x69778f)throw new Error(_0x6278('0x61'));if(_0x69778f[_0x6278('0x62')]===_0x6278('0x63')){var _0xba9acc=_0x2f1c23[_0x6278('0x39')]({'plain':!![]});var _0x1511b7='SmsAccounts';return db[_0x6278('0x64')]['find']({'where':{'name':_0x1511b7,'userProfileId':_0x69778f['userProfileId']},'raw':!![]})[_0x6278('0x21')](function(_0x3fb88f){if(_0x3fb88f&&_0x3fb88f['autoAssociation']===0x0){return db[_0x6278('0x3b')]['create']({'name':_0xba9acc[_0x6278('0x3e')],'resourceId':_0xba9acc['id'],'type':_0x3fb88f[_0x6278('0x3e')],'sectionId':_0x3fb88f['id']},{})[_0x6278('0x21')](function(){return _0x2f1c23;});}else{return _0x2f1c23;}})[_0x6278('0x2b')](function(_0x93e376){logger[_0x6278('0x27')](_0x6278('0x65'),_0x93e376);throw _0x93e376;});}return _0x2f1c23;})[_0x6278('0x21')](respondWithResult(_0x1b7856,0xc9))['catch'](handleError(_0x1b7856,null));};exports[_0x6278('0x37')]=function(_0x42d94f,_0x242cbd){if(_0x42d94f[_0x6278('0x60')]['id']){delete _0x42d94f[_0x6278('0x60')]['id'];}return db[_0x6278('0x55')]['find']({'where':{'id':_0x42d94f['params']['id']},'include':[{'model':db[_0x6278('0x41')],'as':_0x6278('0x42')}]})['then'](handleEntityNotFound(_0x242cbd,null))[_0x6278('0x21')](saveUpdates(_0x42d94f[_0x6278('0x60')],null))['then'](respondWithResult(_0x242cbd,null))[_0x6278('0x2b')](handleError(_0x242cbd,null));};exports['destroy']=function(_0x145132,_0x1dc694){return db[_0x6278('0x55')][_0x6278('0x5e')]({'where':{'id':_0x145132[_0x6278('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1dc694,null))['then'](removeEntity(_0x1dc694,null))[_0x6278('0x2b')](handleError(_0x1dc694,null));};exports[_0x6278('0x66')]=function(_0x265ca5,_0x459063){return db['SmsAccount'][_0x6278('0x66')]()[_0x6278('0x21')](respondWithResult(_0x459063,null))[_0x6278('0x2b')](handleError(_0x459063,null));};exports['addDisposition']=function(_0x165357,_0x427e79,_0x55b93b){if(_0x165357[_0x6278('0x60')]['id']){delete _0x165357[_0x6278('0x60')]['id'];}return db[_0x6278('0x55')][_0x6278('0x5e')]({'where':{'id':_0x165357[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x427e79,null))['then'](function(_0x573f06){if(_0x573f06){_0x165357[_0x6278('0x60')][_0x6278('0x67')]=_0x573f06['id'];return db[_0x6278('0x68')][_0x6278('0x5f')](_0x165357[_0x6278('0x60')]);}})[_0x6278('0x21')](respondWithResult(_0x427e79,null))['catch'](handleError(_0x427e79,null));};exports[_0x6278('0x69')]=function(_0x3ba14c,_0x2ec923,_0x286de9){var _0x24d39c={'raw':![],'where':{}};var _0x5e8daa={};var _0x24ac07={'count':0x0,'rows':[]};return db[_0x6278('0x55')][_0x6278('0x6a')]({'where':{'id':_0x3ba14c[_0x6278('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2ec923,null))[_0x6278('0x21')](function(_0x4287f2){if(_0x4287f2){_0x5e8daa[_0x6278('0x48')]=_[_0x6278('0x5b')](db[_0x6278('0x68')][_0x6278('0x44')]);_0x5e8daa[_0x6278('0x47')]=_['keys'](_0x3ba14c[_0x6278('0x47')]);_0x5e8daa[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0x5e8daa[_0x6278('0x48')],_0x5e8daa['query']);_0x24d39c['attributes']=_[_0x6278('0x4a')](_0x5e8daa[_0x6278('0x48')],qs['fields'](_0x3ba14c[_0x6278('0x47')]['fields']));_0x24d39c[_0x6278('0x49')]=_0x24d39c['attributes'][_0x6278('0x5c')]?_0x24d39c[_0x6278('0x49')]:_0x5e8daa[_0x6278('0x48')];if(!_0x3ba14c[_0x6278('0x47')]['hasOwnProperty'](_0x6278('0x6b'))){_0x24d39c[_0x6278('0x31')]=qs['limit'](_0x3ba14c['query']['limit']);_0x24d39c['offset']=qs['offset'](_0x3ba14c['query']['offset']);}_0x24d39c[_0x6278('0x6c')]=qs[_0x6278('0x4d')](_0x3ba14c[_0x6278('0x47')]['sort']);_0x24d39c['where']=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x3ba14c[_0x6278('0x47')],_0x5e8daa[_0x6278('0x4f')]));_0x24d39c[_0x6278('0x4e')][_0x6278('0x67')]=_0x4287f2['id'];if(_0x3ba14c['query'][_0x6278('0x54')]){_0x24d39c[_0x6278('0x4e')]=_[_0x6278('0x51')](_0x24d39c[_0x6278('0x4e')],{'$or':_['map'](_0x24d39c[_0x6278('0x49')],function(_0xd4b997){var _0x33a167={};_0x33a167[_0xd4b997]={'$like':'%'+_0x3ba14c[_0x6278('0x47')][_0x6278('0x54')]+'%'};return _0x33a167;})});}_0x24d39c=_[_0x6278('0x51')]({},_0x24d39c,_0x3ba14c[_0x6278('0x5d')]);return db['Disposition'][_0x6278('0x32')]({'where':_0x24d39c[_0x6278('0x4e')]})[_0x6278('0x21')](function(_0x318b06){_0x24ac07[_0x6278('0x32')]=_0x318b06;if(_0x3ba14c[_0x6278('0x47')][_0x6278('0x56')]){_0x24d39c[_0x6278('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x6278('0x58')](_0x24d39c);})[_0x6278('0x21')](function(_0x4fcd9d){_0x24ac07['rows']=_0x4fcd9d;return _0x24ac07;});}})[_0x6278('0x21')](respondWithFilteredResult(_0x2ec923,_0x24d39c))[_0x6278('0x2b')](handleError(_0x2ec923,null));};exports[_0x6278('0x6d')]=function(_0x1daa5c,_0x6885e7,_0x2d3e29){return db['SmsAccount'][_0x6278('0x5e')]({'where':{'id':_0x1daa5c[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x6885e7,null))[_0x6278('0x21')](function(_0x2701e0){if(_0x2701e0){return _0x2701e0[_0x6278('0x6d')](_0x1daa5c['query'][_0x6278('0x6e')]);}})[_0x6278('0x21')](respondWithStatusCode(_0x6885e7,null))[_0x6278('0x2b')](handleError(_0x6885e7,null));};exports[_0x6278('0x6f')]=function(_0x237bf3,_0x584f1a,_0x533af9){if(_0x237bf3[_0x6278('0x60')]['id']){delete _0x237bf3[_0x6278('0x60')]['id'];}return db[_0x6278('0x55')]['find']({'where':{'id':_0x237bf3['params']['id']}})['then'](handleEntityNotFound(_0x584f1a,null))[_0x6278('0x21')](function(_0x42f2d3){if(_0x42f2d3){_0x237bf3[_0x6278('0x60')]['SmsAccountId']=_0x42f2d3['id'];return db[_0x6278('0x70')][_0x6278('0x5f')](_0x237bf3[_0x6278('0x60')]);}})[_0x6278('0x21')](respondWithResult(_0x584f1a,null))['catch'](handleError(_0x584f1a,null));};exports[_0x6278('0x71')]=function(_0x3598a8,_0x1eb3ba,_0x1d5442){var _0x2ef791={'raw':![],'where':{}};var _0x1016a9={};var _0x37a56c={'count':0x0,'rows':[]};return db[_0x6278('0x55')][_0x6278('0x6a')]({'where':{'id':_0x3598a8[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x1eb3ba,null))[_0x6278('0x21')](function(_0x41cd39){if(_0x41cd39){_0x1016a9['model']=_[_0x6278('0x5b')](db[_0x6278('0x70')][_0x6278('0x44')]);_0x1016a9[_0x6278('0x47')]=_[_0x6278('0x5b')](_0x3598a8[_0x6278('0x47')]);_0x1016a9[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0x1016a9[_0x6278('0x48')],_0x1016a9[_0x6278('0x47')]);_0x2ef791['attributes']=_[_0x6278('0x4a')](_0x1016a9[_0x6278('0x48')],qs['fields'](_0x3598a8['query']['fields']));_0x2ef791['attributes']=_0x2ef791[_0x6278('0x49')][_0x6278('0x5c')]?_0x2ef791[_0x6278('0x49')]:_0x1016a9[_0x6278('0x48')];if(!_0x3598a8['query'][_0x6278('0x4c')](_0x6278('0x6b'))){_0x2ef791[_0x6278('0x31')]=qs[_0x6278('0x31')](_0x3598a8[_0x6278('0x47')][_0x6278('0x31')]);_0x2ef791[_0x6278('0x2f')]=qs['offset'](_0x3598a8['query']['offset']);}_0x2ef791[_0x6278('0x6c')]=qs[_0x6278('0x4d')](_0x3598a8['query'][_0x6278('0x4d')]);_0x2ef791[_0x6278('0x4e')]=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x3598a8[_0x6278('0x47')],_0x1016a9[_0x6278('0x4f')]));_0x2ef791[_0x6278('0x4e')][_0x6278('0x67')]=_0x41cd39['id'];if(_0x3598a8['query'][_0x6278('0x54')]){_0x2ef791['where']=_[_0x6278('0x51')](_0x2ef791[_0x6278('0x4e')],{'$or':_[_0x6278('0x43')](_0x2ef791[_0x6278('0x49')],function(_0x20fbc1){var _0x3e4b46={};_0x3e4b46[_0x20fbc1]={'$like':'%'+_0x3598a8['query'][_0x6278('0x54')]+'%'};return _0x3e4b46;})});}_0x2ef791=_['merge']({},_0x2ef791,_0x3598a8['options']);return db[_0x6278('0x70')]['count']({'where':_0x2ef791[_0x6278('0x4e')]})[_0x6278('0x21')](function(_0x5e2230){_0x37a56c[_0x6278('0x32')]=_0x5e2230;if(_0x3598a8['query'][_0x6278('0x56')]){_0x2ef791[_0x6278('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6278('0x58')](_0x2ef791);})[_0x6278('0x21')](function(_0x4b86d0){_0x37a56c[_0x6278('0x59')]=_0x4b86d0;return _0x37a56c;});}})['then'](respondWithFilteredResult(_0x1eb3ba,_0x2ef791))[_0x6278('0x2b')](handleError(_0x1eb3ba,null));};exports[_0x6278('0x72')]=function(_0x5082f3,_0x6f92b2,_0x280b47){return db[_0x6278('0x55')][_0x6278('0x5e')]({'where':{'id':_0x5082f3[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x6f92b2,null))['then'](function(_0x35645c){if(_0x35645c){return _0x35645c['removeAnswers'](_0x5082f3[_0x6278('0x47')][_0x6278('0x6e')]);}})[_0x6278('0x21')](respondWithStatusCode(_0x6f92b2,null))[_0x6278('0x2b')](handleError(_0x6f92b2,null));};exports[_0x6278('0x73')]=function(_0x58b65a,_0xf2ae75,_0x44b02f){var _0x5bad01={'channel':'sms'};var _0xaab5bb=[];var _0x3f842c=[];var _0x151bc9={};return db['SmsAccount'][_0x6278('0x5e')]({'where':{'id':_0x58b65a['params']['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0xf2ae75,null))[_0x6278('0x21')](function(_0x257ad3){_0x5bad01[_0x6278('0x74')]=_0x257ad3;_0x5bad01[_0x6278('0x75')]=_[_0x6278('0x76')](_0x257ad3[_0x6278('0x77')],[_0x6278('0x78')],[_0x6278('0x79')]);if(_0x5bad01[_0x6278('0x74')][_0x6278('0x77')]){delete _0x5bad01[_0x6278('0x74')]['Applications'];}return db[_0x6278('0x7a')][_0x6278('0x66')]();})[_0x6278('0x21')](function(_0x1ca536){if(!_0x1ca536){throw new db[(_0x6278('0x7b'))][(_0x6278('0x7c'))](_0x6278('0x7d'));}_0xaab5bb=_['difference'](_[_0x6278('0x5b')](_0x1ca536),[_0x6278('0x7e'),_0x6278('0x7f')]);_0x3f842c=_[_0x6278('0x80')](_[_0x6278('0x5b')](_0x1ca536),[_0x6278('0x7e'),_0x6278('0x7f'),_0x6278('0x81'),_0x6278('0x82')]);_0x5bad01[_0x6278('0x60')]={'mapKey':_0x6278('0x83')};if(_0x5bad01['account'][_0x6278('0x52')]){switch(_0x5bad01[_0x6278('0x74')][_0x6278('0x52')]){case _0x6278('0x84'):_0x5bad01['body'][_0x6278('0x85')]=_0x58b65a['body'][_0x6278('0x86')];_0x5bad01['body'][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x87')];_0x5bad01[_0x6278('0x60')][_0x6278('0x88')]=_0x58b65a[_0x6278('0x60')]['MessageSid'];break;case _0x6278('0x89'):_0x5bad01['body'][_0x6278('0x85')]='+'+_0x58b65a[_0x6278('0x60')][_0x6278('0x8a')];_0x5bad01[_0x6278('0x60')][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x8b')];break;case _0x6278('0x8c'):_0x5bad01[_0x6278('0x60')][_0x6278('0x85')]=_0x58b65a[_0x6278('0x60')]['from'];_0x5bad01['body']['body']=_0x58b65a['body'][_0x6278('0x29')];break;case _0x6278('0x8d'):_0x5bad01['body'][_0x6278('0x85')]=_0x58b65a['body'][_0x6278('0x85')];_0x5bad01['body'][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')]['body'];_0x5bad01['body']['messageId']=_0x58b65a[_0x6278('0x60')]['message_id'];break;case _0x6278('0x8e'):_0x5bad01['body'][_0x6278('0x85')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x86')];_0x5bad01[_0x6278('0x60')][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x8f')];_0x5bad01[_0x6278('0x60')][_0x6278('0x88')]=_0x58b65a['body'][_0x6278('0x90')];break;case'infobip':_0x5bad01[_0x6278('0x60')]['from']='+'+_0x58b65a[_0x6278('0x60')][_0x6278('0x91')][0x0]['from'];_0x5bad01[_0x6278('0x60')]['body']=_0x58b65a[_0x6278('0x60')]['results'][0x0][_0x6278('0x8b')];_0x5bad01['body']['messageId']=_0x58b65a[_0x6278('0x60')]['results'][0x0]['messageId'];break;case _0x6278('0x92'):_0x5bad01[_0x6278('0x60')][_0x6278('0x85')]=_0x58b65a['body'][_0x6278('0x93')];_0x5bad01[_0x6278('0x60')]['body']=_0x58b65a['body'][_0x6278('0x94')][_0x6278('0x29')];break;case _0x6278('0x95'):_0x5bad01[_0x6278('0x60')][_0x6278('0x85')]=_0x58b65a[_0x6278('0x60')]['fromNumber'];_0x5bad01[_0x6278('0x60')][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x8b')];_0x5bad01[_0x6278('0x60')][_0x6278('0x88')]=_0x58b65a['body'][_0x6278('0x96')];break;case _0x6278('0x97'):_0x5bad01[_0x6278('0x60')]['messageId']=_0x58b65a[_0x6278('0x60')][0x0]['message']['id'];_0x5bad01[_0x6278('0x60')][_0x6278('0x85')]=_0x58b65a[_0x6278('0x60')][0x0][_0x6278('0x29')][_0x6278('0x85')];_0x5bad01['body']['body']=_0x58b65a[_0x6278('0x60')][0x0][_0x6278('0x29')]['text'];break;case _0x6278('0x98'):_0x5bad01[_0x6278('0x60')]['from']=_0x58b65a['body'][_0x6278('0x85')];_0x5bad01[_0x6278('0x60')][_0x6278('0x60')]=_0x58b65a[_0x6278('0x60')][_0x6278('0x29')];_0x5bad01[_0x6278('0x60')]['messageId']=_0x58b65a[_0x6278('0x60')][_0x6278('0x99')];break;}}if(_0x5bad01['body']['id']){delete _0x5bad01[_0x6278('0x60')]['id'];}if(_[_0x6278('0x9a')](_0x5bad01[_0x6278('0x60')][_0x6278('0x85')])){throw new db[(_0x6278('0x7b'))][(_0x6278('0x7c'))]('from\x20is\x20mandatory');}if(_[_0x6278('0x9a')](_0x5bad01[_0x6278('0x60')][_0x6278('0x60')])||_0x5bad01['body'][_0x6278('0x60')]===''){throw new db[(_0x6278('0x7b'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6278('0x9a')](_0x5bad01['body'][_0x6278('0x9b')])){throw new db['Sequelize'][(_0x6278('0x7c'))](_0x6278('0x9c')+_0x3f842c);}if(!_[_0x6278('0x9d')](_0x3f842c,_0x5bad01[_0x6278('0x60')]['mapKey'])){throw new db[(_0x6278('0x7b'))][(_0x6278('0x7c'))](_0x6278('0x9e')+_0x3f842c);}_0x151bc9[_0x5bad01[_0x6278('0x60')]['mapKey']]=_0x5bad01['body'][_0x6278('0x85')];return db['CmList'][_0x6278('0x5e')]({'where':{'id':_0x5bad01[_0x6278('0x74')][_0x6278('0x82')]},'include':[{'model':db[_0x6278('0x7a')],'as':_0x6278('0x9f'),'where':_0x151bc9,'limit':0x1,'order':[[_0x6278('0x7f'),_0x6278('0xa0')]]}]});})[_0x6278('0x21')](handleEntityNotFound(_0xf2ae75,null))[_0x6278('0x21')](function(_0x479c2d){if(_0x479c2d){_0x5bad01[_0x6278('0xa1')]=_['omit'](_0x479c2d,[_0x6278('0x9f')]);if(_0x479c2d[_0x6278('0x9f')]['length']){return _0x479c2d[_0x6278('0x9f')][0x0];}var _0x1875c0=_['defaults'](_0x5bad01[_0x6278('0x60')],{'firstName':_0x5bad01['body'][_0x6278('0x85')],'ListId':_0x479c2d['id']});_0x1875c0[_0x5bad01['body']['mapKey']]=_0x5bad01[_0x6278('0x60')][_0x6278('0x85')];return db[_0x6278('0x7a')][_0x6278('0x5f')](_0x1875c0,{'fields':_0xaab5bb,'raw':!![]});}})[_0x6278('0x21')](handleEntityNotFound(_0xf2ae75,null))[_0x6278('0x21')](function(_0x10b4ff){if(_0x10b4ff){_0x5bad01[_0x6278('0xa2')]=_0x10b4ff;var _0x7ce3e5={'ContactId':_0x10b4ff['id'],'phone':_0x5bad01[_0x6278('0x60')][_0x6278('0x85')],'SmsAccountId':_0x58b65a['params']['id']};var _0x238702={'ContactId':_0x10b4ff['id'],'SmsAccountId':_0x58b65a[_0x6278('0x5a')]['id'],'closed':![]};return db[_0x6278('0xa3')][_0x6278('0x5e')]({'where':_0x238702})[_0x6278('0x21')](function(_0xebadb8){if(_0xebadb8){return[_0xebadb8,![]];}return db[_0x6278('0xa3')][_0x6278('0x5f')](_0x7ce3e5)[_0x6278('0x21')](function(_0x206b2f){return[_0x206b2f,!![]];});});}})[_0x6278('0xa4')](function(_0x2e04d8,_0x39ede0){_0x5bad01[_0x6278('0xa5')]=_0x2e04d8[_0x6278('0x39')]({'plain':!![]});_0x5bad01[_0x6278('0xa5')][_0x6278('0xa6')]=![];if(_0x39ede0){if(_0x5bad01[_0x6278('0x74')][_0x6278('0xa7')]){_0x5bad01[_0x6278('0x75')][_0x6278('0xa8')]({'id':0x0,'priority':_0x5bad01[_0x6278('0x75')][_0x6278('0x5c')]+0x1,'app':_0x6278('0xa9'),'appdata':_0x6278('0xaa'),'interval':_0x6278('0xab')});}_0x5bad01[_0x6278('0xa5')]['created']=!![];}return db[_0x6278('0xac')][_0x6278('0x5f')]({'phone':_0x5bad01[_0x6278('0x60')][_0x6278('0x85')],'messageId':_0x5bad01[_0x6278('0x60')][_0x6278('0x88')],'body':_0x5bad01[_0x6278('0x60')][_0x6278('0x60')],'SmsAccountId':_0x58b65a[_0x6278('0x5a')]['id'],'SmsInteractionId':_0x2e04d8['id'],'direction':'in','ContactId':_0x2e04d8[_0x6278('0xad')],'AttachmentId':_0x5bad01[_0x6278('0x60')][_0x6278('0xae')]});})[_0x6278('0x21')](function(_0x409dff){_0x5bad01[_0x6278('0x29')]=_0x409dff;if(!_0x5bad01[_0x6278('0xa5')][_0x6278('0xaf')])return;return db[_0x6278('0xb0')][_0x6278('0x5e')]({'attributes':['id',_0x6278('0x3e')],'where':{'id':_0x5bad01[_0x6278('0xa5')][_0x6278('0xaf')]}});})['then'](function(_0x350d6e){if(_0x350d6e){_0x5bad01[_0x6278('0x75')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x350d6e['name']+','+(_0x5bad01[_0x6278('0x74')][_0x6278('0xb1')]||0xa),'interval':_0x6278('0xab')});}if(!_0x5bad01[_0x6278('0xa5')]['queueId'])return;return db[_0x6278('0xb2')][_0x6278('0x5e')]({'attributes':['id',_0x6278('0x3e')],'where':{'id':_0x5bad01[_0x6278('0xa5')]['queueId']}});})[_0x6278('0x21')](function(_0x32b875){if(_0x32b875){_0x5bad01[_0x6278('0x75')][_0x6278('0xb3')]({'id':0x0,'priority':0x1,'app':_0x6278('0xb4'),'appdata':_0x32b875[_0x6278('0x3e')]+','+(_0x5bad01[_0x6278('0x74')][_0x6278('0xb5')]||0x12c),'interval':_0x6278('0xab')});}return respondWithRpcPromise(_0x6278('0xb6'),_0x6278('0xb7'),_0x5bad01);})[_0x6278('0x21')](function(_0xf20321){if(_0xf20321){var _0x1cc94d=0xc8;var _0x28026b=_0x6278('0xb8');logger[_0x6278('0x22')](_0x6278('0x25'),_0x28026b,_0x1cc94d,'entity\x20found');logger[_0x6278('0xb9')](_0x6278('0xba'),_0x28026b,_0x1cc94d,_0x6278('0xbb'),JSON[_0x6278('0x26')](_0xf20321));if(_0x5bad01[_0x6278('0x74')][_0x6278('0x52')]==='twilio'){return _0xf2ae75[_0x6278('0x2d')](_0x1cc94d)[_0x6278('0x33')]('Content-Type',_0x6278('0xbc'))[_0x6278('0x3f')](_0x6278('0xbd'));}else{return _0xf2ae75[_0x6278('0x2d')](_0x1cc94d)[_0x6278('0x2e')](_0xf20321);}}})[_0x6278('0x2b')](handleError(_0xf2ae75,null));};exports[_0x6278('0xbe')]=function(_0x1e5dee,_0x442297){var _0x807c2=_0x1e5dee[_0x6278('0x5a')]['id'];var _0x307bd1=_0x1e5dee[_0x6278('0x60')];var _0x611377=0xc8;var _0x1afa77=null;return db[_0x6278('0xbf')]['transaction']({'isolationLevel':db[_0x6278('0xbf')]['Transaction'][_0x6278('0xc0')][_0x6278('0xc1')]},function(_0x42d9d5){return db[_0x6278('0x55')][_0x6278('0x6a')]({'where':{'id':_0x807c2},'transaction':_0x42d9d5})[_0x6278('0x21')](function(_0x380169){if(_0x380169){return db[_0x6278('0xc2')][_0x6278('0x38')]({'where':{'SmsAccountId':_0x807c2},'transaction':_0x42d9d5})['then'](function(){var _0x461061=_[_0x6278('0x43')](_0x307bd1,function(_0x2e67f9){_0x2e67f9[_0x6278('0x67')]=_0x807c2;return _0x2e67f9;});return db[_0x6278('0xc2')]['bulkCreate'](_0x461061,{'transaction':_0x42d9d5});});}else{_0x611377=0x194;_0x1afa77=[];}});})[_0x6278('0x21')](function(){if(_0x611377!==0x194){return db[_0x6278('0xc2')]['findAndCountAll']({'where':{'SmsAccountId':_0x807c2},'order':_0x6278('0x78')})[_0x6278('0x21')](function(_0x105310){_0x1afa77=_0x105310;});}})[_0x6278('0x2b')](function(_0x10f679){_0x611377=0x1f4;logger[_0x6278('0x27')](_0x10f679[_0x6278('0x3d')]);if(_0x10f679['name']){delete _0x10f679[_0x6278('0x3e')];}_0x1afa77=_0x10f679;})[_0x6278('0xc3')](function(){if(_0x1afa77===null){_0x442297[_0x6278('0x2c')](_0x611377);}else{if(_0x611377===0x1f4){_0x442297[_0x6278('0x2d')](_0x611377)[_0x6278('0x3f')](_0x1afa77);}else{_0x442297[_0x6278('0x2d')](_0x611377)[_0x6278('0x2e')](_0x1afa77);}}});};exports[_0x6278('0xc4')]=function(_0x5b441d,_0x881d6d,_0x39feb1){var _0x40c846={};var _0x594fa5={};var _0x5b4927;var _0x1a1716;return db['SmsAccount'][_0x6278('0x6a')]({'where':{'id':_0x5b441d[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x881d6d,null))['then'](function(_0x4fc1d7){if(_0x4fc1d7){_0x5b4927=_0x4fc1d7;_0x594fa5['model']=_[_0x6278('0x5b')](db[_0x6278('0xc2')][_0x6278('0x44')]);_0x594fa5[_0x6278('0x47')]=_[_0x6278('0x5b')](_0x5b441d['query']);_0x594fa5[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0x594fa5['model'],_0x594fa5[_0x6278('0x47')]);_0x40c846[_0x6278('0x49')]=_['intersection'](_0x594fa5['model'],qs[_0x6278('0x4b')](_0x5b441d[_0x6278('0x47')][_0x6278('0x4b')]));_0x40c846[_0x6278('0x49')]=_0x40c846[_0x6278('0x49')][_0x6278('0x5c')]?_0x40c846[_0x6278('0x49')]:_0x594fa5[_0x6278('0x48')];_0x40c846[_0x6278('0x6c')]=qs[_0x6278('0x4d')](_0x5b441d[_0x6278('0x47')][_0x6278('0x4d')]);_0x40c846[_0x6278('0x4e')]=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x5b441d[_0x6278('0x47')],_0x594fa5['filters']));if(_0x5b441d[_0x6278('0x47')][_0x6278('0x54')]){_0x40c846[_0x6278('0x4e')]=_['merge'](_0x40c846[_0x6278('0x4e')],{'$or':_[_0x6278('0x43')](_0x40c846[_0x6278('0x49')],function(_0x5515ea){var _0x3cea72={};_0x3cea72[_0x5515ea]={'$like':'%'+_0x5b441d[_0x6278('0x47')][_0x6278('0x54')]+'%'};return _0x3cea72;})});}_0x40c846=_['merge']({},_0x40c846,_0x5b441d[_0x6278('0x5d')]);return _0x5b4927[_0x6278('0xc4')](_0x40c846);}})[_0x6278('0x21')](function(_0x440f4b){if(_0x440f4b){_0x1a1716=_0x440f4b[_0x6278('0x5c')];if(!_0x5b441d[_0x6278('0x47')]['hasOwnProperty'](_0x6278('0x6b'))){_0x40c846[_0x6278('0x31')]=qs['limit'](_0x5b441d[_0x6278('0x47')]['limit']);_0x40c846['offset']=qs[_0x6278('0x2f')](_0x5b441d[_0x6278('0x47')][_0x6278('0x2f')]);}return _0x5b4927[_0x6278('0xc4')](_0x40c846);}})[_0x6278('0x21')](function(_0x260d18){if(_0x260d18){return _0x260d18?{'count':_0x1a1716,'rows':_0x260d18}:null;}})['then'](respondWithResult(_0x881d6d,null))['catch'](handleError(_0x881d6d,null));};exports['getInteractions']=function(_0x2932c0,_0x4839da,_0x4b0882){var _0x46e167={'raw':![],'where':{}};var _0x2aaa1d={};var _0x2bcc35={'count':0x0,'rows':[]};return db['SmsAccount'][_0x6278('0x6a')]({'where':{'id':_0x2932c0[_0x6278('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4839da,null))[_0x6278('0x21')](function(_0x54af16){if(_0x54af16){_0x2aaa1d[_0x6278('0x48')]=_[_0x6278('0x5b')](db['SmsInteraction'][_0x6278('0x44')]);_0x2aaa1d['query']=_[_0x6278('0x5b')](_0x2932c0[_0x6278('0x47')]);_0x2aaa1d[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0x2aaa1d[_0x6278('0x48')],_0x2aaa1d[_0x6278('0x47')]);_0x46e167[_0x6278('0x49')]=_['intersection'](_0x2aaa1d[_0x6278('0x48')],qs[_0x6278('0x4b')](_0x2932c0[_0x6278('0x47')]['fields']));_0x46e167[_0x6278('0x49')]=_0x46e167[_0x6278('0x49')][_0x6278('0x5c')]?_0x46e167['attributes']:_0x2aaa1d[_0x6278('0x48')];if(!_0x2932c0[_0x6278('0x47')][_0x6278('0x4c')](_0x6278('0x6b'))){_0x46e167['limit']=qs['limit'](_0x2932c0[_0x6278('0x47')]['limit']);_0x46e167['offset']=qs[_0x6278('0x2f')](_0x2932c0[_0x6278('0x47')][_0x6278('0x2f')]);}_0x46e167[_0x6278('0x6c')]=qs[_0x6278('0x4d')](_0x2932c0[_0x6278('0x47')][_0x6278('0x4d')]);_0x46e167[_0x6278('0x4e')]=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x2932c0[_0x6278('0x47')],_0x2aaa1d['filters']));_0x46e167['where'][_0x6278('0x67')]=_0x54af16['id'];if(_0x2932c0[_0x6278('0x47')][_0x6278('0x54')]){_0x46e167['where']=_[_0x6278('0x51')](_0x46e167[_0x6278('0x4e')],{'$or':_[_0x6278('0x43')](_0x46e167['attributes'],function(_0x431197){var _0x251149={};_0x251149[_0x431197]={'$like':'%'+_0x2932c0[_0x6278('0x47')][_0x6278('0x54')]+'%'};return _0x251149;})});}_0x46e167=_['merge']({},_0x46e167,_0x2932c0[_0x6278('0x5d')]);return db[_0x6278('0xa3')][_0x6278('0x32')]({'where':_0x46e167[_0x6278('0x4e')]})[_0x6278('0x21')](function(_0x410ab0){_0x2bcc35[_0x6278('0x32')]=_0x410ab0;if(_0x2932c0[_0x6278('0x47')][_0x6278('0x56')]){_0x46e167[_0x6278('0x57')]=[{'model':db[_0x6278('0x7a')],'as':_0x6278('0xc5'),'required':![]},{'model':db[_0x6278('0xb0')],'as':_0x6278('0xc6'),'attributes':[_0x6278('0x3e'),_0x6278('0xc7'),_0x6278('0xc8')],'required':![]},{'model':db[_0x6278('0xc9')],'as':'Tags','attributes':['id',_0x6278('0x3e'),_0x6278('0xca')],'where':_0x2932c0[_0x6278('0x47')][_0x6278('0xcb')]?{'id':_0x2932c0[_0x6278('0x47')][_0x6278('0xcb')]}:undefined,'required':_0x2932c0[_0x6278('0x47')][_0x6278('0xcb')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x46e167);})[_0x6278('0x21')](function(_0x5ab5f4){_0x2bcc35[_0x6278('0x59')]=_0x5ab5f4;return _0x2bcc35;});}})[_0x6278('0x21')](respondWithFilteredResult(_0x4839da,_0x46e167))[_0x6278('0x2b')](handleError(_0x4839da,null));};exports[_0x6278('0x3f')]=function(_0x1b7ea6,_0x177b89,_0x2bcb56){var _0x5e5e6f,_0x3d640f,_0x47e63f;if(_[_0x6278('0x9a')](_0x1b7ea6['body']['body'])||_0x1b7ea6['body'][_0x6278('0x60')]===''){throw new db['Sequelize']['ValidationError'](_0x6278('0xcc'));}if(_[_0x6278('0x9a')](_0x1b7ea6[_0x6278('0x60')]['to'])){throw new db['Sequelize'][(_0x6278('0x7c'))](_0x6278('0xcd'));}_0x5e5e6f=_0x1b7ea6['body']['to'];return db[_0x6278('0x55')][_0x6278('0x5e')]({'where':{'id':_0x1b7ea6['params']['id']},'include':[{'model':db[_0x6278('0xce')],'as':_0x6278('0xcf'),'include':[{'model':db[_0x6278('0x7a')],'as':'Contacts','where':{'mobile':_0x5e5e6f},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x6278('0x21')](handleEntityNotFound(_0x177b89,null))[_0x6278('0x21')](function(_0x218ec1){if(_0x218ec1&&_0x218ec1[_0x6278('0xcf')]){_0x3d640f=_0x218ec1['get']({'plain':!![]});if(_0x3d640f[_0x6278('0xcf')]&&_0x3d640f[_0x6278('0xcf')][_0x6278('0x9f')][_0x6278('0x5c')]){return _0x3d640f[_0x6278('0xcf')][_0x6278('0x9f')][0x0];}return db[_0x6278('0x7a')][_0x6278('0x5f')](_[_0x6278('0x1a')](_0x1b7ea6[_0x6278('0x60')],{'firstName':_0x5e5e6f,'mobile':_0x5e5e6f,'phone':_0x5e5e6f,'ListId':_0x3d640f[_0x6278('0x82')]}));}})[_0x6278('0x21')](handleEntityNotFound(_0x177b89,null))[_0x6278('0x21')](function(_0x2cfffb){if(_0x2cfffb){_0x47e63f=_0x2cfffb;return db[_0x6278('0xa3')][_0x6278('0x5e')]({'where':{'ContactId':_0x47e63f['id'],'closed':![],'SmsAccountId':_0x3d640f['id']}})[_0x6278('0x21')](function(_0x2474d3){if(_0x2474d3){return[_0x2474d3,![]];}return db[_0x6278('0xa3')][_0x6278('0x5f')]({'UserId':_0x1b7ea6['user']['id'],'ContactId':_0x47e63f['id'],'SmsAccountId':_0x3d640f['id'],'phone':_0x5e5e6f,'firstMsgDirection':_0x6278('0xd0'),'Messages':[_[_0x6278('0x51')](_0x1b7ea6[_0x6278('0x60')],{'read':![],'body':_0x1b7ea6[_0x6278('0x60')][_0x6278('0x60')],'phone':_0x5e5e6f,'SmsAccountId':_0x3d640f['id'],'UserId':_0x1b7ea6[_0x6278('0x63')]['id'],'ContactId':_0x47e63f['id']})]},{'include':[{'model':db[_0x6278('0xac')],'as':'Messages'}]})[_0x6278('0x21')](function(_0x570cf9){return[_0x570cf9,!![]];});});}})[_0x6278('0xa4')](function(_0x724392,_0x20029b){if(_0x20029b){return _0x724392;}return db[_0x6278('0xac')][_0x6278('0x5f')](_[_0x6278('0x51')](_0x1b7ea6[_0x6278('0x60')],{'read':![],'body':_0x1b7ea6[_0x6278('0x60')]['body'],'phone':_0x5e5e6f,'SmsAccountId':_0x3d640f['id'],'SmsInteractionId':_0x724392['id'],'UserId':_0x1b7ea6[_0x6278('0x63')]['id'],'ContactId':_0x47e63f['id']}))[_0x6278('0x21')](function(_0x3c74e5){_0x724392[_0x6278('0xd1')][_0x6278('0xd2')]=[];_0x724392[_0x6278('0xd1')][_0x6278('0xd2')][_0x6278('0xa8')](_0x3c74e5['dataValues']);return _0x724392;});})[_0x6278('0x21')](respondWithResult(_0x177b89,null))['catch'](handleError(_0x177b89,null));};exports[_0x6278('0x2d')]=function(_0x410c1e,_0x52eba2,_0x51ba6b){if(_0x410c1e[_0x6278('0x60')]['id']){delete _0x410c1e[_0x6278('0x60')]['id'];}var _0x2897bc,_0x47e404,_0x34bf3c;return db['SmsAccount'][_0x6278('0x5e')]({'where':{'id':_0x410c1e[_0x6278('0x5a')]['id']}})['then'](handleEntityNotFound(_0x52eba2,null))[_0x6278('0x21')](function(_0x52e3b3){if(_0x52e3b3){_0x34bf3c=_0x52e3b3;logger['debug'](_0x6278('0x25'),_0x6278('0x2d'),_0x6278('0xd3'),_0x52e3b3['type'],util[_0x6278('0xd4')](_0x410c1e['body'],{'showHidden':![],'depth':null}));switch(_0x52e3b3[_0x6278('0x52')]){case _0x6278('0x89'):if(_0x410c1e[_0x6278('0x60')][_0x6278('0xd5')]&&_0x410c1e['body']['status']){_0x47e404=_0x410c1e[_0x6278('0x60')]['status'];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')]['skebby_dispatch_id']}});}break;case _0x6278('0x8c'):if(_0x410c1e[_0x6278('0x60')][_0x6278('0xd6')]&&_0x410c1e[_0x6278('0x60')][_0x6278('0xd7')]){_0x47e404=_0x410c1e['body'][_0x6278('0xd7')];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')][_0x6278('0xd6')]}});}break;case _0x6278('0x8d'):if(_0x410c1e['body'][_0x6278('0xd8')]&&_0x410c1e[_0x6278('0x60')][_0x6278('0xd9')]){_0x47e404=_0x410c1e['body'][_0x6278('0xd9')];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')]['message_id']}});}break;case _0x6278('0xda'):var _0x423809=_0x410c1e[_0x6278('0x60')][_0x6278('0x91')][0x0];if(_0x423809[_0x6278('0x88')]&&_0x423809[_0x6278('0x2d')]['groupName']===_0x6278('0xdb')){_0x47e404=_0x423809[_0x6278('0x2d')][_0x6278('0xdc')];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x423809['messageId']}});}break;case _0x6278('0x95'):if(_0x410c1e['body'][_0x6278('0x88')]&&_0x410c1e[_0x6278('0x60')][_0x6278('0x2d')]){_0x47e404=_0x410c1e[_0x6278('0x60')]['status'];return db['SmsMessage'][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')]['messageId']}});}break;case _0x6278('0x97'):if(_0x410c1e[_0x6278('0x60')][0x0][_0x6278('0x29')]['id']){_0x47e404=_0x410c1e['body'][0x0][_0x6278('0x52')];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')][0x0][_0x6278('0x29')]['id']}});}break;case _0x6278('0x98'):if(_0x410c1e[_0x6278('0x60')][_0x6278('0xdd')]&&_0x410c1e[_0x6278('0x60')][_0x6278('0x2d')]){_0x47e404=_0x410c1e[_0x6278('0x60')][_0x6278('0x2d')];return db['SmsMessage'][_0x6278('0x5e')]({'where':{'messageId':_0x410c1e[_0x6278('0x60')][_0x6278('0xdd')]}});}break;}}})[_0x6278('0x21')](handleEntityNotFound(_0x52eba2,null))[_0x6278('0x21')](function(_0x2f717c){if(_0x2f717c){_0x2897bc=_0x2f717c;switch(_0x34bf3c[_0x6278('0x52')]){case _0x6278('0x89'):if(_0x47e404===_0x6278('0xdb')){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),'status',_0x6278('0x89'),util['inspect'](_0x410c1e['body'],{'showHidden':![],'depth':null}));}break;case _0x6278('0x8c'):if(_0x47e404==='1'){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),_0x6278('0x2d'),_0x6278('0x89'),util[_0x6278('0xd4')](_0x410c1e[_0x6278('0x60')],{'showHidden':![],'depth':null}));}break;case _0x6278('0x8d'):if(!_0x410c1e[_0x6278('0x60')][_0x6278('0xde')]&&_0x47e404>=0xc8&&_0x47e404<=0xce){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),_0x6278('0x2d'),'clicksend',util['inspect'](_0x410c1e[_0x6278('0x60')],{'showHidden':![],'depth':null}));}break;case _0x6278('0xda'):var _0x5b0045=_0x410c1e[_0x6278('0x60')][_0x6278('0x91')][0x0];if(_0x5b0045[_0x6278('0x2d')]['groupName']===_0x6278('0xdb')){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger['error'](_0x6278('0x25'),'status','infobip',util[_0x6278('0xd4')](_0x410c1e['body'],{'showHidden':![],'depth':null}));}break;case _0x6278('0x95'):if(_0x47e404=='DELIVERED_TO_GATEWAY'||_0x47e404==_0x6278('0xdf')){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),_0x6278('0x2d'),_0x6278('0x95'),util[_0x6278('0xd4')](_0x410c1e[_0x6278('0x60')],{'showHidden':![],'depth':null}));}break;case _0x6278('0x97'):if(_0x47e404=='message-delivered'){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),_0x6278('0x2d'),_0x6278('0x97'),util['inspect'](_0x410c1e[_0x6278('0x60')],{'showHidden':![],'depth':null}));}break;case _0x6278('0x98'):if(_0x47e404===_0x6278('0xe0')||_0x47e404==='ACCEPTD'){return _0x2897bc[_0x6278('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6278('0x2d'),'intelepeer',util[_0x6278('0xd4')](_0x410c1e[_0x6278('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x2897bc;}})['then'](respondWithResult(_0x52eba2,null))[_0x6278('0x2b')](handleError(_0x52eba2,null));};exports[_0x6278('0xe1')]=function(_0x55aa78,_0x57d799,_0x5cb118){var _0x1be0f8,_0x2aed98,_0x70ec05;return db[_0x6278('0x55')][_0x6278('0x5e')]({'where':{'id':_0x55aa78[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x57d799,null))[_0x6278('0x21')](function(_0xf64538){if(_0xf64538){_0x70ec05=_0xf64538;logger['debug'](_0x6278('0x25'),_0x6278('0x2d'),'received\x20delivery\x20report\x20from',_0xf64538[_0x6278('0x52')],util[_0x6278('0xd4')](_0x55aa78['query'],{'showHidden':![],'depth':null}));switch(_0xf64538[_0x6278('0x52')]){case _0x6278('0x92'):if(_0x55aa78[_0x6278('0x47')][_0x6278('0xe2')]&&_0x55aa78['query']['state']){_0x2aed98=_0x55aa78['query'][_0x6278('0xe3')];return db[_0x6278('0xac')][_0x6278('0x5e')]({'where':{'messageId':_0x55aa78[_0x6278('0x47')][_0x6278('0xe2')]}});}break;}}})[_0x6278('0x21')](handleEntityNotFound(_0x57d799,null))[_0x6278('0x21')](function(_0x33d88c){if(_0x33d88c){_0x1be0f8=_0x33d88c;switch(_0x70ec05[_0x6278('0x52')]){case'csc':if(_0x2aed98==='2'||_0x2aed98==='6'){return _0x1be0f8['update']({'read':!![]});}else{logger[_0x6278('0x27')](_0x6278('0x25'),'status','csc',util['inspect'](_0x55aa78[_0x6278('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x1be0f8;}})['then'](respondWithResult(_0x57d799,null))['catch'](handleError(_0x57d799,null));};exports['addAgents']=function(_0x4fb793,_0x10b2f6,_0x2336f2){return db[_0x6278('0x55')]['find']({'where':{'id':_0x4fb793[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x10b2f6,null))['then'](function(_0x4843d3){if(_0x4843d3){return _0x4843d3[_0x6278('0xe4')](_0x4fb793[_0x6278('0x60')]['ids'],_[_0x6278('0xe5')](_0x4fb793[_0x6278('0x60')],[_0x6278('0x6e'),'id'])||{})[_0x6278('0xa4')](function(_0x3cca0e){for(var _0xd95e6c=0x0;_0xd95e6c<_0x4fb793['body'][_0x6278('0x6e')]['length'];_0xd95e6c+=0x1){socket['emit'](_0x6278('0xe6'),{'UserId':Number(_0x4fb793['body'][_0x6278('0x6e')][_0xd95e6c]),'SmsAccountId':Number(_0x4fb793[_0x6278('0x5a')]['id'])});}return _0x3cca0e;});}})['then'](respondWithResult(_0x10b2f6,null))[_0x6278('0x2b')](handleError(_0x10b2f6,null));};exports[_0x6278('0xe7')]=function(_0x1cdf3d,_0x54e7d8,_0x4ec2da){return db['SmsAccount'][_0x6278('0x5e')]({'where':{'id':_0x1cdf3d[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x54e7d8,null))[_0x6278('0x21')](function(_0x23634b){if(_0x23634b){return _0x23634b['removeAgents'](_0x1cdf3d[_0x6278('0x47')]['ids'])[_0x6278('0x21')](function(){if(_[_0x6278('0xe8')](_0x1cdf3d[_0x6278('0x47')][_0x6278('0x6e')])){for(var _0x274155=0x0;_0x274155<_0x1cdf3d['query'][_0x6278('0x6e')]['length'];_0x274155+=0x1){socket[_0x6278('0xe9')]('userSmsAccount:remove',{'UserId':Number(_0x1cdf3d['query'][_0x6278('0x6e')][_0x274155]),'SmsAccountId':Number(_0x1cdf3d[_0x6278('0x5a')]['id'])});}}else{socket[_0x6278('0xe9')](_0x6278('0xea'),{'UserId':Number(_0x1cdf3d[_0x6278('0x47')][_0x6278('0x6e')]),'SmsAccountId':Number(_0x1cdf3d[_0x6278('0x5a')]['id'])});}});}})[_0x6278('0x21')](respondWithStatusCode(_0x54e7d8,null))[_0x6278('0x2b')](handleError(_0x54e7d8,null));};exports[_0x6278('0xeb')]=function(_0x18f43e,_0x1ba7f6,_0x11e8d5){var _0x5b81fa={};var _0xb585d2={};var _0x4c1720;var _0x377233;return db[_0x6278('0x55')][_0x6278('0x6a')]({'where':{'id':_0x18f43e[_0x6278('0x5a')]['id']}})[_0x6278('0x21')](handleEntityNotFound(_0x1ba7f6,null))[_0x6278('0x21')](function(_0x3a0b53){if(_0x3a0b53){_0x4c1720=_0x3a0b53;_0xb585d2[_0x6278('0x48')]=_[_0x6278('0x5b')](db[_0x6278('0xb0')][_0x6278('0x44')]);_0xb585d2[_0x6278('0x47')]=_[_0x6278('0x5b')](_0x18f43e[_0x6278('0x47')]);_0xb585d2[_0x6278('0x4f')]=_[_0x6278('0x4a')](_0xb585d2[_0x6278('0x48')],_0xb585d2[_0x6278('0x47')]);_0x5b81fa['attributes']=_[_0x6278('0x4a')](_0xb585d2[_0x6278('0x48')],qs[_0x6278('0x4b')](_0x18f43e[_0x6278('0x47')][_0x6278('0x4b')]));_0x5b81fa[_0x6278('0x49')]=_0x5b81fa[_0x6278('0x49')]['length']?_0x5b81fa['attributes']:_0xb585d2[_0x6278('0x48')];_0x5b81fa[_0x6278('0x6c')]=qs[_0x6278('0x4d')](_0x18f43e[_0x6278('0x47')][_0x6278('0x4d')]);_0x5b81fa[_0x6278('0x4e')]=qs[_0x6278('0x4f')](_[_0x6278('0x50')](_0x18f43e[_0x6278('0x47')],_0xb585d2[_0x6278('0x4f')]));if(_0x18f43e[_0x6278('0x47')]['filter']){_0x5b81fa[_0x6278('0x4e')]=_[_0x6278('0x51')](_0x5b81fa[_0x6278('0x4e')],{'$or':_[_0x6278('0x43')](_0x5b81fa[_0x6278('0x49')],function(_0x39ea85){var _0x16521b={};_0x16521b[_0x39ea85]={'$like':'%'+_0x18f43e[_0x6278('0x47')]['filter']+'%'};return _0x16521b;})});}_0x5b81fa=_[_0x6278('0x51')]({},_0x5b81fa,_0x18f43e[_0x6278('0x5d')]);return _0x4c1720[_0x6278('0xeb')](_0x5b81fa);}})[_0x6278('0x21')](function(_0x38dfb6){if(_0x38dfb6){_0x377233=_0x38dfb6[_0x6278('0x5c')];if(!_0x18f43e[_0x6278('0x47')][_0x6278('0x4c')](_0x6278('0x6b'))){_0x5b81fa['limit']=qs[_0x6278('0x31')](_0x18f43e[_0x6278('0x47')][_0x6278('0x31')]);_0x5b81fa[_0x6278('0x2f')]=qs[_0x6278('0x2f')](_0x18f43e[_0x6278('0x47')]['offset']);}return _0x4c1720[_0x6278('0xeb')](_0x5b81fa);}})[_0x6278('0x21')](function(_0x37a324){if(_0x37a324){return _0x37a324?{'count':_0x377233,'rows':_0x37a324}:null;}})[_0x6278('0x21')](respondWithResult(_0x1ba7f6,null))[_0x6278('0x2b')](handleError(_0x1ba7f6,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index fbc7b62..ec28445 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 _0x9b58=['events','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x39abaf,_0x264258){var _0x2f7166=function(_0x1bc01e){while(--_0x1bc01e){_0x39abaf['push'](_0x39abaf['shift']());}};_0x2f7166(++_0x264258);}(_0x9b58,0x1b0));var _0x89b5=function(_0xeb7891,_0x4771f7){_0xeb7891=_0xeb7891-0x0;var _0x11cc19=_0x9b58[_0xeb7891];return _0x11cc19;};'use strict';var EventEmitter=require(_0x89b5('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x89b5('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x89b5('0x2')](0x0);var events={'afterCreate':_0x89b5('0x3'),'afterUpdate':_0x89b5('0x4'),'afterDestroy':_0x89b5('0x5')};function emitEvent(_0x415939){return function(_0x419b1f,_0x3139a7,_0x1ce5e2){SmsAccountEvents['emit'](_0x415939+':'+_0x419b1f['id'],_0x419b1f);SmsAccountEvents[_0x89b5('0x6')](_0x415939,_0x419b1f);_0x1ce5e2(null);};}for(var e in events){if(events[_0x89b5('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xbb5e=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x22bdd3,_0x552e50){var _0x44d9d9=function(_0x2b4ab9){while(--_0x2b4ab9){_0x22bdd3['push'](_0x22bdd3['shift']());}};_0x44d9d9(++_0x552e50);}(_0xbb5e,0x1e7));var _0xebb5=function(_0x1eed93,_0x177a48){_0x1eed93=_0x1eed93-0x0;var _0x5ab049=_0xbb5e[_0x1eed93];return _0x5ab049;};'use strict';var EventEmitter=require(_0xebb5('0x0'));var SmsAccount=require(_0xebb5('0x1'))['db'][_0xebb5('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xebb5('0x3')](0x0);var events={'afterCreate':_0xebb5('0x4'),'afterUpdate':_0xebb5('0x5'),'afterDestroy':_0xebb5('0x6')};function emitEvent(_0x9652ce){return function(_0x4e9f7e,_0x5662ec,_0x192b9a){SmsAccountEvents[_0xebb5('0x7')](_0x9652ce+':'+_0x4e9f7e['id'],_0x4e9f7e);SmsAccountEvents['emit'](_0x9652ce,_0x4e9f7e);_0x192b9a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xebb5('0x8')](e,emitEvent(event));}}module[_0xebb5('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index daab530..92de0b8 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 _0xee81=['./smsAccount.attributes','define','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x1318c2,_0x16e0c1){var _0x28c62e=function(_0x16f068){while(--_0x16f068){_0x1318c2['push'](_0x1318c2['shift']());}};_0x28c62e(++_0x16e0c1);}(_0xee81,0x17c));var _0x1ee8=function(_0x14cc95,_0x42b2bc){_0x14cc95=_0x14cc95-0x0;var _0x12c064=_0xee81[_0x14cc95];return _0x12c064;};'use strict';var _=require(_0x1ee8('0x0'));var util=require(_0x1ee8('0x1'));var logger=require(_0x1ee8('0x2'))('api');var moment=require(_0x1ee8('0x3'));var BPromise=require('bluebird');var rp=require(_0x1ee8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ee8('0x5'));var config=require(_0x1ee8('0x6'));var attributes=require(_0x1ee8('0x7'));module['exports']=function(_0x2e5751,_0x53c26c){return _0x2e5751[_0x1ee8('0x8')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd314=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util'];(function(_0x1bd5e6,_0xa7c02c){var _0xc6af09=function(_0x5ac750){while(--_0x5ac750){_0x1bd5e6['push'](_0x1bd5e6['shift']());}};_0xc6af09(++_0xa7c02c);}(_0xd314,0x9a));var _0x4d31=function(_0x3e4ff5,_0x135929){_0x3e4ff5=_0x3e4ff5-0x0;var _0x5e793e=_0xd314[_0x3e4ff5];return _0x5e793e;};'use strict';var _=require(_0x4d31('0x0'));var util=require(_0x4d31('0x1'));var logger=require(_0x4d31('0x2'))('api');var moment=require(_0x4d31('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d31('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d31('0x5'));var config=require(_0x4d31('0x6'));var attributes=require(_0x4d31('0x7'));module[_0x4d31('0x8')]=function(_0x32b901,_0x1eb188){return _0x32b901[_0x4d31('0x9')](_0x4d31('0xa'),attributes,{'tableName':_0x4d31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index a65546a..ee22dd4 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 _0x187c=['http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SmsAccount,\x20%s,\x20%s','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x595aad,_0x535031){var _0x3140f6=function(_0x26e97f){while(--_0x26e97f){_0x595aad['push'](_0x595aad['shift']());}};_0x3140f6(++_0x535031);}(_0x187c,0x1be));var _0xc187=function(_0x3d4643,_0x11ee58){_0x3d4643=_0x3d4643-0x0;var _0x1d139e=_0x187c[_0x3d4643];return _0x1d139e;};'use strict';var _=require(_0xc187('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc187('0x1'));var fs=require('fs');var Redis=require(_0xc187('0x2'));var db=require(_0xc187('0x3'))['db'];var utils=require(_0xc187('0x4'));var logger=require(_0xc187('0x5'))('rpc');var config=require(_0xc187('0x6'));var jayson=require(_0xc187('0x7'));var client=jayson[_0xc187('0x8')][_0xc187('0x9')]({'port':0x232a});config['redis']=_[_0xc187('0xa')](config[_0xc187('0xb')],{'host':_0xc187('0xc'),'port':0x18eb});var socket=require(_0xc187('0xd'))(new Redis(config[_0xc187('0xb')]));require(_0xc187('0xe'))['register'](socket);function respondWithRpcPromise(_0x36551c,_0x22a0c3,_0x13fb5a){return new BPromise(function(_0x281523,_0x4acb12){return client[_0xc187('0xf')](_0x36551c,_0x13fb5a)[_0xc187('0x10')](function(_0x36dead){logger[_0xc187('0x11')]('SmsAccount,\x20%s,\x20%s',_0x22a0c3,'request\x20sent');logger[_0xc187('0x12')](_0xc187('0x13'),_0x22a0c3,_0xc187('0x14'),JSON[_0xc187('0x15')](_0x36dead));if(_0x36dead['error']){if(_0x36dead['error']['code']===0x1f4){logger[_0xc187('0x16')]('SmsAccount,\x20%s,\x20%s',_0x22a0c3,_0x36dead[_0xc187('0x16')][_0xc187('0x17')]);return _0x4acb12(_0x36dead[_0xc187('0x16')][_0xc187('0x17')]);}logger[_0xc187('0x16')]('SmsAccount,\x20%s,\x20%s',_0x22a0c3,_0x36dead[_0xc187('0x16')][_0xc187('0x17')]);return _0x281523(_0x36dead[_0xc187('0x16')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x22a0c3,_0xc187('0x14'));_0x281523(_0x36dead['result'][_0xc187('0x17')]);}})['catch'](function(_0x5552a5){logger['error'](_0xc187('0x18'),_0x22a0c3,_0x5552a5);_0x4acb12(_0x5552a5);});});}exports[_0xc187('0x19')]=function(_0x588915){var _0x3160f1=this;return new Promise(function(_0x242805,_0x35411e){return db[_0xc187('0x1a')][_0xc187('0x1b')]({'raw':_0x588915[_0xc187('0x1c')]?_0x588915[_0xc187('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x588915['options']?_0x588915[_0xc187('0x1c')][_0xc187('0x1d')]||null:null,'attributes':_0x588915[_0xc187('0x1c')]?_0x588915[_0xc187('0x1c')][_0xc187('0x1e')]||null:null,'include':_0x588915[_0xc187('0x1c')]?_0x588915[_0xc187('0x1c')][_0xc187('0x1f')]?_[_0xc187('0x20')](_0x588915[_0xc187('0x1c')][_0xc187('0x1f')],function(_0x2ee9ea){return{'model':db[_0x2ee9ea[_0xc187('0x21')]],'as':_0x2ee9ea['as'],'attributes':_0x2ee9ea[_0xc187('0x1e')],'include':_0x2ee9ea[_0xc187('0x1f')]?_['map'](_0x2ee9ea['include'],function(_0x51a4d4){return{'model':db[_0x51a4d4[_0xc187('0x21')]],'as':_0x51a4d4['as'],'attributes':_0x51a4d4[_0xc187('0x1e')],'include':_0x51a4d4['include']?_[_0xc187('0x20')](_0x51a4d4['include'],function(_0x205fd8){return{'model':db[_0x205fd8[_0xc187('0x21')]],'as':_0x205fd8['as'],'attributes':_0x205fd8[_0xc187('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc187('0x10')](function(_0x10292a){logger[_0xc187('0x11')](_0xc187('0x19'),_0x588915);logger['debug'](_0xc187('0x19'),_0x588915,JSON['stringify'](_0x10292a));_0x242805(_0x10292a);})[_0xc187('0x22')](function(_0x1df78c){logger[_0xc187('0x16')](_0xc187('0x19'),_0x1df78c[_0xc187('0x17')],_0x588915);_0x35411e(_0x3160f1[_0xc187('0x16')](0x1f4,_0x1df78c['message']));});});}; \ No newline at end of file +var _0xf559=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','redis','socket.io-emitter','./smsAccount.socket','register','request','then','info','debug','request\x20sent','stringify','error','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','options','where','attributes','include','map','model'];(function(_0x31bbbf,_0x19e84a){var _0x5d6a77=function(_0x2f5874){while(--_0x2f5874){_0x31bbbf['push'](_0x31bbbf['shift']());}};_0x5d6a77(++_0x19e84a);}(_0xf559,0xa0));var _0x9f55=function(_0x223207,_0x522af9){_0x223207=_0x223207-0x0;var _0x433997=_0xf559[_0x223207];return _0x433997;};'use strict';var _=require(_0x9f55('0x0'));var util=require(_0x9f55('0x1'));var moment=require(_0x9f55('0x2'));var BPromise=require(_0x9f55('0x3'));var rs=require(_0x9f55('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9f55('0x5'));var logger=require(_0x9f55('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f55('0x7'));var client=jayson[_0x9f55('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x9f55('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f55('0xa'))(new Redis(config[_0x9f55('0x9')]));require(_0x9f55('0xb'))[_0x9f55('0xc')](socket);function respondWithRpcPromise(_0x564783,_0x2be4f5,_0x263137){return new BPromise(function(_0x5a4d2e,_0x83da68){return client[_0x9f55('0xd')](_0x564783,_0x263137)[_0x9f55('0xe')](function(_0x52b7bc){logger[_0x9f55('0xf')]('SmsAccount,\x20%s,\x20%s',_0x2be4f5,'request\x20sent');logger[_0x9f55('0x10')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2be4f5,_0x9f55('0x11'),JSON[_0x9f55('0x12')](_0x52b7bc));if(_0x52b7bc[_0x9f55('0x13')]){if(_0x52b7bc[_0x9f55('0x13')]['code']===0x1f4){logger[_0x9f55('0x13')](_0x9f55('0x14'),_0x2be4f5,_0x52b7bc[_0x9f55('0x13')][_0x9f55('0x15')]);return _0x83da68(_0x52b7bc['error'][_0x9f55('0x15')]);}logger['error'](_0x9f55('0x14'),_0x2be4f5,_0x52b7bc[_0x9f55('0x13')][_0x9f55('0x15')]);return _0x5a4d2e(_0x52b7bc[_0x9f55('0x13')]['message']);}else{logger[_0x9f55('0xf')](_0x9f55('0x14'),_0x2be4f5,_0x9f55('0x11'));_0x5a4d2e(_0x52b7bc[_0x9f55('0x16')][_0x9f55('0x15')]);}})[_0x9f55('0x17')](function(_0x19b5ae){logger[_0x9f55('0x13')](_0x9f55('0x14'),_0x2be4f5,_0x19b5ae);_0x83da68(_0x19b5ae);});});}exports[_0x9f55('0x18')]=function(_0x4a2167){var _0x40e005=this;return new Promise(function(_0x250d40,_0x50fe24){return db[_0x9f55('0x19')]['find']({'raw':_0x4a2167[_0x9f55('0x1a')]?_0x4a2167[_0x9f55('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4a2167[_0x9f55('0x1a')]?_0x4a2167[_0x9f55('0x1a')][_0x9f55('0x1b')]||null:null,'attributes':_0x4a2167[_0x9f55('0x1a')]?_0x4a2167[_0x9f55('0x1a')][_0x9f55('0x1c')]||null:null,'include':_0x4a2167[_0x9f55('0x1a')]?_0x4a2167['options'][_0x9f55('0x1d')]?_['map'](_0x4a2167[_0x9f55('0x1a')][_0x9f55('0x1d')],function(_0x54617f){return{'model':db[_0x54617f['model']],'as':_0x54617f['as'],'attributes':_0x54617f['attributes'],'include':_0x54617f['include']?_[_0x9f55('0x1e')](_0x54617f[_0x9f55('0x1d')],function(_0x57cc42){return{'model':db[_0x57cc42[_0x9f55('0x1f')]],'as':_0x57cc42['as'],'attributes':_0x57cc42[_0x9f55('0x1c')],'include':_0x57cc42[_0x9f55('0x1d')]?_[_0x9f55('0x1e')](_0x57cc42[_0x9f55('0x1d')],function(_0x379b85){return{'model':db[_0x379b85[_0x9f55('0x1f')]],'as':_0x379b85['as'],'attributes':_0x379b85[_0x9f55('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a2888){logger[_0x9f55('0xf')]('ShowSmsAccount',_0x4a2167);logger[_0x9f55('0x10')]('ShowSmsAccount',_0x4a2167,JSON[_0x9f55('0x12')](_0x2a2888));_0x250d40(_0x2a2888);})[_0x9f55('0x17')](function(_0xc4eee7){logger[_0x9f55('0x13')](_0x9f55('0x18'),_0xc4eee7['message'],_0x4a2167);_0x50fe24(_0x40e005[_0x9f55('0x13')](0x1f4,_0xc4eee7[_0x9f55('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 595af56..7973515 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 dacf8cb..c4fcdec 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x306646,_0xdc2e1b){var _0x40bd8d=function(_0x397d05){while(--_0x397d05){_0x306646['push'](_0x306646['shift']());}};_0x40bd8d(++_0xdc2e1b);}(_0x3e74,0x175));var _0x43e7=function(_0x126aa6,_0x372048){_0x126aa6=_0x126aa6-0x0;var _0x16a90a=_0x3e74[_0x126aa6];return _0x16a90a;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _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(_0x1f9594,_0x9f5a86){var _0x154a45=function(_0x5af2ad){while(--_0x5af2ad){_0x1f9594['push'](_0x1f9594['shift']());}};_0x154a45(++_0x9f5a86);}(_0xedd9,0xfc));var _0x9edd=function(_0x2a8e84,_0x3084ae){_0x2a8e84=_0x2a8e84-0x0;var _0x11e05c=_0xedd9[_0x2a8e84];return _0x11e05c;};'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 00b186b..6756d15 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 _0x3a8b=['STRING','noop','TEXT','sequelize','exports'];(function(_0x16aa3f,_0xadb524){var _0x3a98e8=function(_0x1c7cc8){while(--_0x1c7cc8){_0x16aa3f['push'](_0x16aa3f['shift']());}};_0x3a98e8(++_0xadb524);}(_0x3a8b,0x9e));var _0xb3a8=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x3a8b[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0xb3a8('0x0'));module[_0xb3a8('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb3a8('0x2')],'allowNull':![],'defaultValue':_0xb3a8('0x3')},'appdata':{'type':Sequelize[_0xb3a8('0x4')]()},'description':{'type':Sequelize[_0xb3a8('0x2')]},'interval':{'type':Sequelize[_0xb3a8('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x799d=['noop','STRING','sequelize','exports','INTEGER'];(function(_0x3feb3d,_0x597999){var _0x24439e=function(_0x5f1de0){while(--_0x5f1de0){_0x3feb3d['push'](_0x3feb3d['shift']());}};_0x24439e(++_0x597999);}(_0x799d,0x7a));var _0xd799=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x799d[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xd799('0x0'));module[_0xd799('0x1')]={'priority':{'type':Sequelize[_0xd799('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd799('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd799('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index a1c1aae..95cc055 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 _0x21cf=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','create','body','find','params','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x1f69b9,_0x5ae69a){var _0xf13c03=function(_0x40133f){while(--_0x40133f){_0x1f69b9['push'](_0x1f69b9['shift']());}};_0xf13c03(++_0x5ae69a);}(_0x21cf,0xab));var _0xf21c=function(_0x3613d9,_0x266ce5){_0x3613d9=_0x3613d9-0x0;var _0x376f9a=_0x21cf[_0x3613d9];return _0x376f9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf21c('0x0'));var zipdir=require(_0xf21c('0x1'));var jsonpatch=require(_0xf21c('0x2'));var rp=require('request-promise');var moment=require(_0xf21c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf21c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf21c('0x5'));var csv=require(_0xf21c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf21c('0x7'));var _=require('lodash');var squel=require(_0xf21c('0x8'));var crypto=require(_0xf21c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf21c('0xa'));var toCsv=require(_0xf21c('0x6'));var querystring=require(_0xf21c('0xb'));var Papa=require(_0xf21c('0xc'));var Redis=require(_0xf21c('0xd'));var authService=require(_0xf21c('0xe'));var qs=require(_0xf21c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf21c('0x10'))(_0xf21c('0x11'));var utils=require(_0xf21c('0x12'));var config=require(_0xf21c('0x13'));var licenseUtil=require(_0xf21c('0x14'));var db=require(_0xf21c('0x15'))['db'];function respondWithStatusCode(_0x1d911d,_0x3a2a20){_0x3a2a20=_0x3a2a20||0xcc;return function(_0x12cfb6){if(_0x12cfb6){return _0x1d911d[_0xf21c('0x16')](_0x3a2a20);}return _0x1d911d[_0xf21c('0x17')](_0x3a2a20)[_0xf21c('0x18')]();};}function respondWithResult(_0x5128ba,_0x59b512){_0x59b512=_0x59b512||0xc8;return function(_0x4fef5a){if(_0x4fef5a){return _0x5128ba[_0xf21c('0x17')](_0x59b512)[_0xf21c('0x19')](_0x4fef5a);}};}function respondWithFilteredResult(_0x2794ff,_0x39dd91){return function(_0x68123f){if(_0x68123f){var _0x3a680d=typeof _0x39dd91[_0xf21c('0x1a')]===_0xf21c('0x1b')&&typeof _0x39dd91[_0xf21c('0x1c')]===_0xf21c('0x1b');var _0x45bea6=_0x68123f[_0xf21c('0x1d')];var _0x339c2d=_0x3a680d?0x0:_0x39dd91['offset'];var _0x4af461=_0x3a680d?_0x68123f[_0xf21c('0x1d')]:_0x39dd91[_0xf21c('0x1a')]+_0x39dd91[_0xf21c('0x1c')];var _0x4a6af2;if(_0x4af461>=_0x45bea6){_0x4af461=_0x45bea6;_0x4a6af2=0xc8;}else{_0x4a6af2=0xce;}_0x2794ff[_0xf21c('0x17')](_0x4a6af2);return _0x2794ff[_0xf21c('0x1e')](_0xf21c('0x1f'),_0x339c2d+'-'+_0x4af461+'/'+_0x45bea6)[_0xf21c('0x19')](_0x68123f);}return null;};}function patchUpdates(_0x4e2c61){return function(_0x37c5e1){try{jsonpatch['apply'](_0x37c5e1,_0x4e2c61,!![]);}catch(_0x254484){return BPromise['reject'](_0x254484);}return _0x37c5e1[_0xf21c('0x20')]();};}function saveUpdates(_0x422d0f,_0x203427){return function(_0x1232f3){if(_0x1232f3){return _0x1232f3[_0xf21c('0x21')](_0x422d0f)[_0xf21c('0x22')](function(_0x372a42){return _0x372a42;});}return null;};}function removeEntity(_0x185290,_0x15d8b6){return function(_0x1369e5){if(_0x1369e5){return _0x1369e5[_0xf21c('0x23')]()[_0xf21c('0x22')](function(){_0x185290[_0xf21c('0x17')](0xcc)[_0xf21c('0x18')]();});}};}function handleEntityNotFound(_0x45a2bc,_0x48eab0){return function(_0x31dfa9){if(!_0x31dfa9){_0x45a2bc[_0xf21c('0x16')](0x194);}return _0x31dfa9;};}function handleError(_0x5c5d5d,_0x5bdf98){_0x5bdf98=_0x5bdf98||0x1f4;return function(_0x1c38d9){logger[_0xf21c('0x24')](_0x1c38d9['stack']);if(_0x1c38d9['name']){delete _0x1c38d9['name'];}_0x5c5d5d['status'](_0x5bdf98)[_0xf21c('0x25')](_0x1c38d9);};}exports[_0xf21c('0x26')]=function(_0x100b86,_0xb2e277){var _0x585d87={},_0x255627={},_0xdc1900={'count':0x0,'rows':[]};var _0x15f713=_[_0xf21c('0x27')](db[_0xf21c('0x28')][_0xf21c('0x29')],function(_0x1fb0f8){return{'name':_0x1fb0f8[_0xf21c('0x2a')],'type':_0x1fb0f8[_0xf21c('0x2b')][_0xf21c('0x2c')]};});_0x255627[_0xf21c('0x2d')]=_[_0xf21c('0x27')](_0x15f713,_0xf21c('0x2e'));_0x255627[_0xf21c('0x2f')]=_[_0xf21c('0x30')](_0x100b86['query']);_0x255627['filters']=_[_0xf21c('0x31')](_0x255627['model'],_0x255627['query']);_0x585d87[_0xf21c('0x32')]=_[_0xf21c('0x31')](_0x255627['model'],qs[_0xf21c('0x33')](_0x100b86[_0xf21c('0x2f')][_0xf21c('0x33')]));_0x585d87[_0xf21c('0x32')]=_0x585d87[_0xf21c('0x32')][_0xf21c('0x34')]?_0x585d87[_0xf21c('0x32')]:_0x255627[_0xf21c('0x2d')];if(!_0x100b86[_0xf21c('0x2f')][_0xf21c('0x35')](_0xf21c('0x36'))){_0x585d87[_0xf21c('0x1c')]=qs['limit'](_0x100b86[_0xf21c('0x2f')][_0xf21c('0x1c')]);_0x585d87['offset']=qs[_0xf21c('0x1a')](_0x100b86[_0xf21c('0x2f')][_0xf21c('0x1a')]);}_0x585d87[_0xf21c('0x37')]=qs['sort'](_0x100b86[_0xf21c('0x2f')][_0xf21c('0x38')]);_0x585d87[_0xf21c('0x39')]=qs[_0xf21c('0x3a')](_['pick'](_0x100b86['query'],_0x255627[_0xf21c('0x3a')]),_0x15f713);if(_0x100b86['query'][_0xf21c('0x3b')]){_0x585d87[_0xf21c('0x39')]=_[_0xf21c('0x3c')](_0x585d87[_0xf21c('0x39')],{'$or':_[_0xf21c('0x27')](_0x15f713,function(_0x48cccd){if(_0x48cccd[_0xf21c('0x2b')]!==_0xf21c('0x3d')){var _0x3a5f3a={};_0x3a5f3a[_0x48cccd[_0xf21c('0x2e')]]={'$like':'%'+_0x100b86[_0xf21c('0x2f')][_0xf21c('0x3b')]+'%'};return _0x3a5f3a;}})});}_0x585d87=_[_0xf21c('0x3c')]({},_0x585d87,_0x100b86['options']);var _0x4d89fb={'where':_0x585d87[_0xf21c('0x39')]};return db[_0xf21c('0x28')][_0xf21c('0x1d')](_0x4d89fb)['then'](function(_0xa3745){_0xdc1900[_0xf21c('0x1d')]=_0xa3745;if(_0x100b86[_0xf21c('0x2f')]['includeAll']){_0x585d87[_0xf21c('0x3e')]=[{'all':!![]}];}return db[_0xf21c('0x28')][_0xf21c('0x3f')](_0x585d87);})[_0xf21c('0x22')](function(_0x5aa362){_0xdc1900[_0xf21c('0x40')]=_0x5aa362;return _0xdc1900;})[_0xf21c('0x22')](respondWithFilteredResult(_0xb2e277,_0x585d87))[_0xf21c('0x41')](handleError(_0xb2e277,null));};exports[_0xf21c('0x42')]=function(_0x653083,_0x4c6e51){var _0x189856={'raw':!![],'where':{'id':_0x653083['params']['id']}},_0x5434b8={};_0x5434b8[_0xf21c('0x2d')]=_[_0xf21c('0x30')](db[_0xf21c('0x28')]['rawAttributes']);_0x5434b8[_0xf21c('0x2f')]=_['keys'](_0x653083[_0xf21c('0x2f')]);_0x5434b8[_0xf21c('0x3a')]=_[_0xf21c('0x31')](_0x5434b8['model'],_0x5434b8[_0xf21c('0x2f')]);_0x189856['attributes']=_['intersection'](_0x5434b8[_0xf21c('0x2d')],qs[_0xf21c('0x33')](_0x653083['query'][_0xf21c('0x33')]));_0x189856[_0xf21c('0x32')]=_0x189856[_0xf21c('0x32')][_0xf21c('0x34')]?_0x189856[_0xf21c('0x32')]:_0x5434b8[_0xf21c('0x2d')];if(_0x653083[_0xf21c('0x2f')][_0xf21c('0x43')]){_0x189856[_0xf21c('0x3e')]=[{'all':!![]}];}_0x189856=_[_0xf21c('0x3c')]({},_0x189856,_0x653083[_0xf21c('0x44')]);return db[_0xf21c('0x28')]['find'](_0x189856)[_0xf21c('0x22')](handleEntityNotFound(_0x4c6e51,null))[_0xf21c('0x22')](respondWithResult(_0x4c6e51,null))[_0xf21c('0x41')](handleError(_0x4c6e51,null));};exports[_0xf21c('0x45')]=function(_0x54e2ee,_0x1ae848){return db['SmsApplication'][_0xf21c('0x45')](_0x54e2ee[_0xf21c('0x46')],{})[_0xf21c('0x22')](respondWithResult(_0x1ae848,0xc9))['catch'](handleError(_0x1ae848,null));};exports[_0xf21c('0x21')]=function(_0x5f4a14,_0x408cb8){if(_0x5f4a14[_0xf21c('0x46')]['id']){delete _0x5f4a14[_0xf21c('0x46')]['id'];}return db[_0xf21c('0x28')][_0xf21c('0x47')]({'where':{'id':_0x5f4a14[_0xf21c('0x48')]['id']}})[_0xf21c('0x22')](handleEntityNotFound(_0x408cb8,null))[_0xf21c('0x22')](saveUpdates(_0x5f4a14[_0xf21c('0x46')],null))[_0xf21c('0x22')](respondWithResult(_0x408cb8,null))[_0xf21c('0x41')](handleError(_0x408cb8,null));};exports['destroy']=function(_0x15ecc7,_0x511f53){return db['SmsApplication'][_0xf21c('0x47')]({'where':{'id':_0x15ecc7['params']['id']}})['then'](handleEntityNotFound(_0x511f53,null))[_0xf21c('0x22')](removeEntity(_0x511f53,null))[_0xf21c('0x41')](handleError(_0x511f53,null));}; \ No newline at end of file +var _0x6a58=['fields','attributes','length','nolimit','limit','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','includeAll','SmsApplication','findAll','rows','catch','params','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','name','map','rawAttributes','fieldName','key','model','query','keys','intersection'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6a58,0x17c));var _0x86a5=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x6a58[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require(_0x86a5('0x0'));var rimraf=require(_0x86a5('0x1'));var zipdir=require(_0x86a5('0x2'));var jsonpatch=require(_0x86a5('0x3'));var rp=require(_0x86a5('0x4'));var moment=require('moment');var BPromise=require(_0x86a5('0x5'));var Mustache=require('mustache');var util=require(_0x86a5('0x6'));var path=require(_0x86a5('0x7'));var sox=require(_0x86a5('0x8'));var csv=require('to-csv');var ejs=require(_0x86a5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x86a5('0xa'));var squel=require(_0x86a5('0xb'));var crypto=require(_0x86a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x86a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x86a5('0xe'));var Redis=require(_0x86a5('0xf'));var authService=require(_0x86a5('0x10'));var qs=require(_0x86a5('0x11'));var as=require(_0x86a5('0x12'));var hardwareService=require(_0x86a5('0x13'));var logger=require('../../config/logger')(_0x86a5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x86a5('0x15'));var db=require(_0x86a5('0x16'))['db'];function respondWithStatusCode(_0x535335,_0x29df65){_0x29df65=_0x29df65||0xcc;return function(_0x30370a){if(_0x30370a){return _0x535335[_0x86a5('0x17')](_0x29df65);}return _0x535335[_0x86a5('0x18')](_0x29df65)['end']();};}function respondWithResult(_0x3c6270,_0xb22f94){_0xb22f94=_0xb22f94||0xc8;return function(_0x3d8a7b){if(_0x3d8a7b){return _0x3c6270[_0x86a5('0x18')](_0xb22f94)[_0x86a5('0x19')](_0x3d8a7b);}};}function respondWithFilteredResult(_0x1cd374,_0x4267eb){return function(_0x553ebb){if(_0x553ebb){var _0x20a505=typeof _0x4267eb[_0x86a5('0x1a')]===_0x86a5('0x1b')&&typeof _0x4267eb['limit']===_0x86a5('0x1b');var _0xc8a8b5=_0x553ebb[_0x86a5('0x1c')];var _0xe04d39=_0x20a505?0x0:_0x4267eb[_0x86a5('0x1a')];var _0x4e21ce=_0x20a505?_0x553ebb[_0x86a5('0x1c')]:_0x4267eb[_0x86a5('0x1a')]+_0x4267eb['limit'];var _0x409bc2;if(_0x4e21ce>=_0xc8a8b5){_0x4e21ce=_0xc8a8b5;_0x409bc2=0xc8;}else{_0x409bc2=0xce;}_0x1cd374[_0x86a5('0x18')](_0x409bc2);return _0x1cd374[_0x86a5('0x1d')](_0x86a5('0x1e'),_0xe04d39+'-'+_0x4e21ce+'/'+_0xc8a8b5)['json'](_0x553ebb);}return null;};}function patchUpdates(_0x5253cd){return function(_0x179956){try{jsonpatch['apply'](_0x179956,_0x5253cd,!![]);}catch(_0x64030e){return BPromise[_0x86a5('0x1f')](_0x64030e);}return _0x179956[_0x86a5('0x20')]();};}function saveUpdates(_0x10030f,_0x3da281){return function(_0x525410){if(_0x525410){return _0x525410[_0x86a5('0x21')](_0x10030f)[_0x86a5('0x22')](function(_0x3763f0){return _0x3763f0;});}return null;};}function removeEntity(_0x27b524,_0x334631){return function(_0x35957f){if(_0x35957f){return _0x35957f[_0x86a5('0x23')]()[_0x86a5('0x22')](function(){_0x27b524[_0x86a5('0x18')](0xcc)[_0x86a5('0x24')]();});}};}function handleEntityNotFound(_0x118640,_0x48ec2b){return function(_0x1ca453){if(!_0x1ca453){_0x118640['sendStatus'](0x194);}return _0x1ca453;};}function handleError(_0x5910d4,_0x415242){_0x415242=_0x415242||0x1f4;return function(_0x1188f4){logger['error'](_0x1188f4['stack']);if(_0x1188f4[_0x86a5('0x25')]){delete _0x1188f4[_0x86a5('0x25')];}_0x5910d4[_0x86a5('0x18')](_0x415242)['send'](_0x1188f4);};}exports['index']=function(_0x20b97d,_0x1e12c2){var _0x248aa1={},_0x288b5d={},_0x4caab1={'count':0x0,'rows':[]};var _0x3a47d5=_[_0x86a5('0x26')](db['SmsApplication'][_0x86a5('0x27')],function(_0x4e024b){return{'name':_0x4e024b[_0x86a5('0x28')],'type':_0x4e024b['type'][_0x86a5('0x29')]};});_0x288b5d[_0x86a5('0x2a')]=_['map'](_0x3a47d5,'name');_0x288b5d[_0x86a5('0x2b')]=_[_0x86a5('0x2c')](_0x20b97d[_0x86a5('0x2b')]);_0x288b5d['filters']=_['intersection'](_0x288b5d[_0x86a5('0x2a')],_0x288b5d[_0x86a5('0x2b')]);_0x248aa1['attributes']=_[_0x86a5('0x2d')](_0x288b5d['model'],qs[_0x86a5('0x2e')](_0x20b97d[_0x86a5('0x2b')]['fields']));_0x248aa1[_0x86a5('0x2f')]=_0x248aa1[_0x86a5('0x2f')][_0x86a5('0x30')]?_0x248aa1['attributes']:_0x288b5d[_0x86a5('0x2a')];if(!_0x20b97d[_0x86a5('0x2b')]['hasOwnProperty'](_0x86a5('0x31'))){_0x248aa1['limit']=qs[_0x86a5('0x32')](_0x20b97d[_0x86a5('0x2b')][_0x86a5('0x32')]);_0x248aa1[_0x86a5('0x1a')]=qs[_0x86a5('0x1a')](_0x20b97d['query'][_0x86a5('0x1a')]);}_0x248aa1[_0x86a5('0x33')]=qs[_0x86a5('0x34')](_0x20b97d[_0x86a5('0x2b')]['sort']);_0x248aa1['where']=qs[_0x86a5('0x35')](_[_0x86a5('0x36')](_0x20b97d[_0x86a5('0x2b')],_0x288b5d[_0x86a5('0x35')]),_0x3a47d5);if(_0x20b97d[_0x86a5('0x2b')][_0x86a5('0x37')]){_0x248aa1['where']=_[_0x86a5('0x38')](_0x248aa1[_0x86a5('0x39')],{'$or':_['map'](_0x3a47d5,function(_0x2c1e3d){if(_0x2c1e3d[_0x86a5('0x3a')]!==_0x86a5('0x3b')){var _0xf65af8={};_0xf65af8[_0x2c1e3d['name']]={'$like':'%'+_0x20b97d[_0x86a5('0x2b')][_0x86a5('0x37')]+'%'};return _0xf65af8;}})});}_0x248aa1=_[_0x86a5('0x38')]({},_0x248aa1,_0x20b97d[_0x86a5('0x3c')]);var _0x343aae={'where':_0x248aa1[_0x86a5('0x39')]};return db['SmsApplication'][_0x86a5('0x1c')](_0x343aae)[_0x86a5('0x22')](function(_0x319c44){_0x4caab1[_0x86a5('0x1c')]=_0x319c44;if(_0x20b97d[_0x86a5('0x2b')][_0x86a5('0x3d')]){_0x248aa1['include']=[{'all':!![]}];}return db[_0x86a5('0x3e')][_0x86a5('0x3f')](_0x248aa1);})[_0x86a5('0x22')](function(_0x1e327b){_0x4caab1[_0x86a5('0x40')]=_0x1e327b;return _0x4caab1;})[_0x86a5('0x22')](respondWithFilteredResult(_0x1e12c2,_0x248aa1))[_0x86a5('0x41')](handleError(_0x1e12c2,null));};exports['show']=function(_0x2d6da4,_0x225965){var _0x3245e6={'raw':!![],'where':{'id':_0x2d6da4[_0x86a5('0x42')]['id']}},_0xc7e099={};_0xc7e099[_0x86a5('0x2a')]=_['keys'](db['SmsApplication'][_0x86a5('0x27')]);_0xc7e099[_0x86a5('0x2b')]=_[_0x86a5('0x2c')](_0x2d6da4[_0x86a5('0x2b')]);_0xc7e099[_0x86a5('0x35')]=_[_0x86a5('0x2d')](_0xc7e099[_0x86a5('0x2a')],_0xc7e099[_0x86a5('0x2b')]);_0x3245e6[_0x86a5('0x2f')]=_[_0x86a5('0x2d')](_0xc7e099[_0x86a5('0x2a')],qs['fields'](_0x2d6da4[_0x86a5('0x2b')]['fields']));_0x3245e6[_0x86a5('0x2f')]=_0x3245e6[_0x86a5('0x2f')][_0x86a5('0x30')]?_0x3245e6['attributes']:_0xc7e099[_0x86a5('0x2a')];if(_0x2d6da4[_0x86a5('0x2b')][_0x86a5('0x3d')]){_0x3245e6[_0x86a5('0x43')]=[{'all':!![]}];}_0x3245e6=_[_0x86a5('0x38')]({},_0x3245e6,_0x2d6da4[_0x86a5('0x3c')]);return db[_0x86a5('0x3e')]['find'](_0x3245e6)['then'](handleEntityNotFound(_0x225965,null))[_0x86a5('0x22')](respondWithResult(_0x225965,null))[_0x86a5('0x41')](handleError(_0x225965,null));};exports[_0x86a5('0x44')]=function(_0x3d3448,_0x3caef3){return db[_0x86a5('0x3e')][_0x86a5('0x44')](_0x3d3448[_0x86a5('0x45')],{})[_0x86a5('0x22')](respondWithResult(_0x3caef3,0xc9))[_0x86a5('0x41')](handleError(_0x3caef3,null));};exports['update']=function(_0x4fb39a,_0x4fe121){if(_0x4fb39a['body']['id']){delete _0x4fb39a[_0x86a5('0x45')]['id'];}return db[_0x86a5('0x3e')][_0x86a5('0x46')]({'where':{'id':_0x4fb39a[_0x86a5('0x42')]['id']}})['then'](handleEntityNotFound(_0x4fe121,null))[_0x86a5('0x22')](saveUpdates(_0x4fb39a['body'],null))[_0x86a5('0x22')](respondWithResult(_0x4fe121,null))[_0x86a5('0x41')](handleError(_0x4fe121,null));};exports[_0x86a5('0x23')]=function(_0x16c626,_0x7482ad){return db['SmsApplication']['find']({'where':{'id':_0x16c626[_0x86a5('0x42')]['id']}})[_0x86a5('0x22')](handleEntityNotFound(_0x7482ad,null))['then'](removeEntity(_0x7482ad,null))[_0x86a5('0x41')](handleError(_0x7482ad,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f820611..b0851c3 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 _0x5e6d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','sms_applications','utf8mb4','lodash'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x5e6d,0x1e9));var _0xd5e6=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x5e6d[_0x87b0ff];return _0x3bc0b2;};'use strict';var _=require(_0xd5e6('0x0'));var util=require(_0xd5e6('0x1'));var logger=require(_0xd5e6('0x2'))(_0xd5e6('0x3'));var moment=require(_0xd5e6('0x4'));var BPromise=require(_0xd5e6('0x5'));var rp=require(_0xd5e6('0x6'));var fs=require('fs');var path=require(_0xd5e6('0x7'));var rimraf=require(_0xd5e6('0x8'));var config=require(_0xd5e6('0x9'));var attributes=require(_0xd5e6('0xa'));module['exports']=function(_0x9ab464,_0x23d6e1){return _0x9ab464['define'](_0xd5e6('0xb'),attributes,{'tableName':_0xd5e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd5e6('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x13d5=['rimraf','../../config/environment','exports','define','SmsApplication','lodash','util','../../config/logger','path'];(function(_0x62f2b3,_0x54f02e){var _0x467ade=function(_0x2a5390){while(--_0x2a5390){_0x62f2b3['push'](_0x62f2b3['shift']());}};_0x467ade(++_0x54f02e);}(_0x13d5,0x1a3));var _0x513d=function(_0x28c1ee,_0x5e9056){_0x28c1ee=_0x28c1ee-0x0;var _0x4e0fe8=_0x13d5[_0x28c1ee];return _0x4e0fe8;};'use strict';var _=require(_0x513d('0x0'));var util=require(_0x513d('0x1'));var logger=require(_0x513d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x513d('0x3'));var rimraf=require(_0x513d('0x4'));var config=require(_0x513d('0x5'));var attributes=require('./smsApplication.attributes');module[_0x513d('0x6')]=function(_0x5c2d56,_0x5a6a76){return _0x5c2d56[_0x513d('0x7')](_0x513d('0x8'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 2496cb6..53ad14b 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 _0xbca0=['stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4d05dd,_0x258cdd){var _0x1c5226=function(_0x1a857c){while(--_0x1a857c){_0x4d05dd['push'](_0x4d05dd['shift']());}};_0x1c5226(++_0x258cdd);}(_0xbca0,0x8b));var _0x0bca=function(_0x3da912,_0x40d8ae){_0x3da912=_0x3da912-0x0;var _0x569755=_0xbca0[_0x3da912];return _0x569755;};'use strict';var _=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bca('0x2'));var db=require(_0x0bca('0x3'))['db'];var utils=require(_0x0bca('0x4'));var logger=require(_0x0bca('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0bca('0x6'));var client=jayson[_0x0bca('0x7')][_0x0bca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x454627,_0x4dcba6,_0x48260c){return new BPromise(function(_0x55fbf0,_0x241ca5){return client[_0x0bca('0x9')](_0x454627,_0x48260c)[_0x0bca('0xa')](function(_0x206194){logger[_0x0bca('0xb')]('SmsApplication,\x20%s,\x20%s',_0x4dcba6,'request\x20sent');logger[_0x0bca('0xc')](_0x0bca('0xd'),_0x4dcba6,_0x0bca('0xe'),JSON[_0x0bca('0xf')](_0x206194));if(_0x206194[_0x0bca('0x10')]){if(_0x206194[_0x0bca('0x10')][_0x0bca('0x11')]===0x1f4){logger[_0x0bca('0x10')](_0x0bca('0x12'),_0x4dcba6,_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);return _0x241ca5(_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);}logger[_0x0bca('0x10')](_0x0bca('0x12'),_0x4dcba6,_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);return _0x55fbf0(_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);}else{logger['info'](_0x0bca('0x12'),_0x4dcba6,_0x0bca('0xe'));_0x55fbf0(_0x206194[_0x0bca('0x14')][_0x0bca('0x13')]);}})[_0x0bca('0x15')](function(_0x2ed970){logger[_0x0bca('0x10')]('SmsApplication,\x20%s,\x20%s',_0x4dcba6,_0x2ed970);_0x241ca5(_0x2ed970);});});} \ No newline at end of file +var _0x7669=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','lodash'];(function(_0x272cd4,_0x3e9a8a){var _0x291e61=function(_0x205914){while(--_0x205914){_0x272cd4['push'](_0x272cd4['shift']());}};_0x291e61(++_0x3e9a8a);}(_0x7669,0xe5));var _0x9766=function(_0x27af05,_0x488012){_0x27af05=_0x27af05-0x0;var _0x45b4b2=_0x7669[_0x27af05];return _0x45b4b2;};'use strict';var _=require(_0x9766('0x0'));var util=require(_0x9766('0x1'));var moment=require(_0x9766('0x2'));var BPromise=require('bluebird');var rs=require(_0x9766('0x3'));var fs=require('fs');var Redis=require(_0x9766('0x4'));var db=require(_0x9766('0x5'))['db'];var utils=require(_0x9766('0x6'));var logger=require(_0x9766('0x7'))(_0x9766('0x8'));var config=require('../../config/environment');var jayson=require(_0x9766('0x9'));var client=jayson[_0x9766('0xa')][_0x9766('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x251329,_0x4f85e7,_0x26bbd9){return new BPromise(function(_0x2b5b52,_0x2381eb){return client[_0x9766('0xc')](_0x251329,_0x26bbd9)[_0x9766('0xd')](function(_0x5cb787){logger[_0x9766('0xe')]('SmsApplication,\x20%s,\x20%s',_0x4f85e7,_0x9766('0xf'));logger['debug'](_0x9766('0x10'),_0x4f85e7,'request\x20sent',JSON[_0x9766('0x11')](_0x5cb787));if(_0x5cb787['error']){if(_0x5cb787[_0x9766('0x12')][_0x9766('0x13')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x4f85e7,_0x5cb787[_0x9766('0x12')]['message']);return _0x2381eb(_0x5cb787[_0x9766('0x12')]['message']);}logger[_0x9766('0x12')](_0x9766('0x14'),_0x4f85e7,_0x5cb787['error'][_0x9766('0x15')]);return _0x2b5b52(_0x5cb787['error'][_0x9766('0x15')]);}else{logger[_0x9766('0xe')](_0x9766('0x14'),_0x4f85e7,_0x9766('0xf'));_0x2b5b52(_0x5cb787[_0x9766('0x16')][_0x9766('0x15')]);}})['catch'](function(_0x8f9b2a){logger[_0x9766('0x12')](_0x9766('0x14'),_0x4f85e7,_0x8f9b2a);_0x2381eb(_0x8f9b2a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7f3175a..a011fba 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 _0x13f6=['isAuthenticated','index','get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x3c8fc7,_0x2eaa2c){var _0x2bf49e=function(_0x2dd676){while(--_0x2dd676){_0x3c8fc7['push'](_0x3c8fc7['shift']());}};_0x2bf49e(++_0x2eaa2c);}(_0x13f6,0x124));var _0x613f=function(_0x415280,_0x28ea89){_0x415280=_0x415280-0x0;var _0x40ee89=_0x13f6[_0x415280];return _0x40ee89;};'use strict';var multer=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x613f('0x2'));var router=express[_0x613f('0x3')]();var fs_extra=require(_0x613f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router['get']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x613f('0xa')](_0x613f('0xb'),auth[_0x613f('0x8')](),controller[_0x613f('0xc')]);router['get'](_0x613f('0xd'),auth[_0x613f('0x8')](),controller[_0x613f('0xe')]);router['get'](_0x613f('0xf'),auth[_0x613f('0x8')](),controller[_0x613f('0x10')]);router['post']('/',auth[_0x613f('0x8')](),controller[_0x613f('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x613f('0x12')]);router[_0x613f('0x13')](_0x613f('0x14'),auth[_0x613f('0x8')](),interaction[_0x613f('0x15')](_0x613f('0x16'),_0x613f('0x17')),controller[_0x613f('0x18')]);router[_0x613f('0x19')](_0x613f('0xb'),auth['isAuthenticated'](),interaction[_0x613f('0x15')]('sms','smsinteraction:update'),controller[_0x613f('0x1a')]);router[_0x613f('0x1b')]('/:id',auth[_0x613f('0x8')](),interaction['tracked'](_0x613f('0x16'),_0x613f('0x1c')),controller[_0x613f('0x1d')]);router[_0x613f('0x1b')](_0x613f('0x14'),auth[_0x613f('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x0713=['put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','smsinteraction:addtags','addTags'];(function(_0x4fd21d,_0x41a819){var _0x28fe8d=function(_0x5b192e){while(--_0x5b192e){_0x4fd21d['push'](_0x4fd21d['shift']());}};_0x28fe8d(++_0x41a819);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['show']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/download',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x11')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['post']('/:id/messages',auth[_0x3071('0x9')](),controller['addMessage']);router[_0x3071('0x11')](_0x3071('0x13'),auth['isAuthenticated'](),interaction[_0x3071('0x14')]('sms',_0x3071('0x15')),controller[_0x3071('0x16')]);router[_0x3071('0x17')](_0x3071('0xd'),auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x19')),controller[_0x3071('0x1a')]);router[_0x3071('0x1b')]('/:id',auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x1c')),controller[_0x3071('0x1d')]);router[_0x3071('0x1b')](_0x3071('0x13'),auth[_0x3071('0x9')](),controller['removeTags']);module[_0x3071('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 0b07523..f85a14a 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 _0xc19f=['BOOLEAN','STRING','DATE','ENUM','out','INTEGER','exports'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0xc19f,0x164));var _0xfc19=function(_0x88d45a,_0x521cee){_0x88d45a=_0x88d45a-0x0;var _0x3d9ed2=_0xc19f[_0x88d45a];return _0x3d9ed2;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xfc19('0x0')]={'closed':{'type':Sequelize[_0xfc19('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xfc19('0x2')]},'thirdDisposition':{'type':Sequelize[_0xfc19('0x2')]},'note':{'type':Sequelize[_0xfc19('0x2')]},'phone':{'type':Sequelize[_0xfc19('0x2')]},'read1stAt':{'type':Sequelize[_0xfc19('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xfc19('0x4')]('in',_0xfc19('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfc19('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfc19('0x6')]}}; \ No newline at end of file +var _0x69d4=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x17c927,_0x1f9cb5){var _0x1320ee=function(_0x3a8eb2){while(--_0x3a8eb2){_0x17c927['push'](_0x17c927['shift']());}};_0x1320ee(++_0x1f9cb5);}(_0x69d4,0x83));var _0x469d=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x69d4[_0x4aba15];return _0x1c8122;};'use strict';var Sequelize=require(_0x469d('0x0'));var moment=require(_0x469d('0x1'));module['exports']={'closed':{'type':Sequelize[_0x469d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x469d('0x3')]},'disposition':{'type':Sequelize[_0x469d('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x469d('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x469d('0x4')]},'read1stAt':{'type':Sequelize[_0x469d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x469d('0x5')]('in',_0x469d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x469d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x469d('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x469d('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 4677ba4..b98bdcf 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 _0xd10f=['attributes','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','SmsMessage','ids','getMessages','findOne','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','color','emit','smsInteractionTags:save','removeTags','download','toString','root','server','files','tmp','format','push','User','fullname','CmContact','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','mkdirSync','Sms','closed','closedAt','disposition','out','System','Contact','read','value','renderFile','join','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection'];(function(_0x1d17a6,_0x11e005){var _0x10387a=function(_0x407003){while(--_0x407003){_0x1d17a6['push'](_0x1d17a6['shift']());}};_0x10387a(++_0x11e005);}(_0xd10f,0xc9));var _0xfd10=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd10f[_0x3b380d];return _0x54502b;};'use strict';var rimraf=require(_0xfd10('0x0'));var zipdir=require(_0xfd10('0x1'));var moment=require(_0xfd10('0x2'));var BPromise=require(_0xfd10('0x3'));var util=require(_0xfd10('0x4'));var path=require(_0xfd10('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfd10('0x6'));var Redis=require(_0xfd10('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xfd10('0x8'));var pdf=require(_0xfd10('0x9'));var logger=require('../../config/logger')(_0xfd10('0xa'));var config=require(_0xfd10('0xb'));var db=require('../../mysqldb')['db'];config[_0xfd10('0xc')]=_['defaults'](config[_0xfd10('0xc')],{'host':_0xfd10('0xd'),'port':0x18eb});var socket=require(_0xfd10('0xe'))(new Redis(config[_0xfd10('0xc')]));require(_0xfd10('0xf'))[_0xfd10('0x10')](socket);function respondWithStatusCode(_0x10fece,_0x4bc1da){_0x4bc1da=_0x4bc1da||0xcc;return function(_0xde7c2c){if(_0xde7c2c){return _0x10fece['sendStatus'](_0x4bc1da);}return _0x10fece[_0xfd10('0x11')](_0x4bc1da)[_0xfd10('0x12')]();};}function respondWithResult(_0x2d9483,_0x141922){_0x141922=_0x141922||0xc8;return function(_0x4f0629){if(_0x4f0629){return _0x2d9483[_0xfd10('0x11')](_0x141922)[_0xfd10('0x13')](_0x4f0629);}};}function respondWithFilteredResult(_0x157f8,_0x5f5ad7){return function(_0x2740c7){if(_0x2740c7){var _0xe5d0e2=typeof _0x5f5ad7[_0xfd10('0x14')]===_0xfd10('0x15')&&typeof _0x5f5ad7['limit']===_0xfd10('0x15');var _0x8ebaf6=_0x2740c7[_0xfd10('0x16')];var _0x26a0a0=_0xe5d0e2?0x0:_0x5f5ad7[_0xfd10('0x14')];var _0x3adc1b=_0xe5d0e2?_0x2740c7[_0xfd10('0x16')]:_0x5f5ad7['offset']+_0x5f5ad7[_0xfd10('0x17')];var _0x3c9b3e;if(_0x3adc1b>=_0x8ebaf6){_0x3adc1b=_0x8ebaf6;_0x3c9b3e=0xc8;}else{_0x3c9b3e=0xce;}_0x157f8[_0xfd10('0x11')](_0x3c9b3e);return _0x157f8[_0xfd10('0x18')](_0xfd10('0x19'),_0x26a0a0+'-'+_0x3adc1b+'/'+_0x8ebaf6)[_0xfd10('0x13')](_0x2740c7);}return null;};}function saveUpdates(_0x4f7f0c){return function(_0x48fd4d){if(_0x48fd4d){return _0x48fd4d[_0xfd10('0x1a')](_0x4f7f0c)['then'](function(_0x16f35b){return _0x16f35b;});}return null;};}function removeEntity(_0x5c6f11){return function(_0x99db2e){if(_0x99db2e){return _0x99db2e['destroy']()[_0xfd10('0x1b')](function(){_0x5c6f11[_0xfd10('0x11')](0xcc)[_0xfd10('0x12')]();});}};}function handleEntityNotFound(_0x94e656){return function(_0x31aa3b){if(!_0x31aa3b){_0x94e656[_0xfd10('0x1c')](0x194);}return _0x31aa3b;};}function handleError(_0x5b5ec7,_0x10c160){_0x10c160=_0x10c160||0x1f4;return function(_0x58d9d4){logger[_0xfd10('0x1d')](_0x58d9d4[_0xfd10('0x1e')]);if(_0x58d9d4[_0xfd10('0x1f')]){delete _0x58d9d4[_0xfd10('0x1f')];}_0x5b5ec7[_0xfd10('0x11')](_0x10c160)[_0xfd10('0x20')](_0x58d9d4);};}exports[_0xfd10('0x21')]=function(_0x11085b,_0x4a2ba5){var _0x144ba6={};var _0x5dc4cb=_[_0xfd10('0x22')](db[_0xfd10('0x23')][_0xfd10('0x24')],function(_0x1182ff){return{'name':_0x1182ff[_0xfd10('0x25')],'type':_0x1182ff[_0xfd10('0x26')][_0xfd10('0x27')]};});_0x144ba6=qs['getOptions'](_0x5dc4cb,_0x11085b);return interaction[_0xfd10('0x28')](_0xfd10('0x29'),_0x11085b[_0xfd10('0x2a')],_0x11085b[_0xfd10('0x2b')],_0x144ba6,_0x5dc4cb)[_0xfd10('0x1b')](respondWithFilteredResult(_0x4a2ba5,_0x144ba6))[_0xfd10('0x2c')](handleError(_0x4a2ba5,null));};exports[_0xfd10('0x2d')]=function(_0x4e149c,_0x3902d2){var _0x2b3c08={'raw':![],'where':{'id':_0x4e149c[_0xfd10('0x2e')]['id']}},_0x2d8ce2={};_0x2d8ce2[_0xfd10('0x2f')]=_[_0xfd10('0x30')](db[_0xfd10('0x23')]['rawAttributes']);_0x2d8ce2[_0xfd10('0x2a')]=_['keys'](_0x4e149c[_0xfd10('0x2a')]);_0x2d8ce2[_0xfd10('0x31')]=_[_0xfd10('0x32')](_0x2d8ce2['model'],_0x2d8ce2['query']);_0x2b3c08[_0xfd10('0x33')]=_[_0xfd10('0x32')](_0x2d8ce2[_0xfd10('0x2f')],qs['fields'](_0x4e149c['query']['fields']));_0x2b3c08['attributes']=_0x2b3c08[_0xfd10('0x33')]['length']?_0x2b3c08['attributes']:_0x2d8ce2[_0xfd10('0x2f')];if(_0x4e149c['query'][_0xfd10('0x34')]){_0x2b3c08[_0xfd10('0x35')]=[{'all':!![]}];}_0x2b3c08=_[_0xfd10('0x36')]({},_0x2b3c08,_0x4e149c[_0xfd10('0x37')]);return db[_0xfd10('0x23')][_0xfd10('0x38')](_0x2b3c08)[_0xfd10('0x1b')](handleEntityNotFound(_0x3902d2,null))[_0xfd10('0x1b')](respondWithResult(_0x3902d2,null))[_0xfd10('0x2c')](handleError(_0x3902d2,null));};exports[_0xfd10('0x39')]=function(_0x268273,_0x35d04d){return db[_0xfd10('0x23')][_0xfd10('0x39')](_0x268273[_0xfd10('0x3a')],{})[_0xfd10('0x1b')](respondWithResult(_0x35d04d,0xc9))[_0xfd10('0x2c')](handleError(_0x35d04d,null));};exports[_0xfd10('0x1a')]=function(_0x2d5282,_0x37c4d9){if(_0x2d5282[_0xfd10('0x3a')]['id']){delete _0x2d5282[_0xfd10('0x3a')]['id'];}return db[_0xfd10('0x23')][_0xfd10('0x38')]({'where':{'id':_0x2d5282[_0xfd10('0x2e')]['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x37c4d9,null))[_0xfd10('0x1b')](saveUpdates(_0x2d5282[_0xfd10('0x3a')],null))[_0xfd10('0x1b')](respondWithResult(_0x37c4d9,null))[_0xfd10('0x2c')](handleError(_0x37c4d9,null));};exports[_0xfd10('0x3b')]=function(_0x30dfaf,_0x31f992){return db['SmsInteraction'][_0xfd10('0x38')]({'where':{'id':_0x30dfaf['params']['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x31f992,null))[_0xfd10('0x1b')](removeEntity(_0x31f992,null))[_0xfd10('0x2c')](handleError(_0x31f992,null));};exports[_0xfd10('0x3c')]=function(_0x3a481c,_0x4a70a6){return db['SmsInteraction'][_0xfd10('0x3c')]()[_0xfd10('0x1b')](respondWithResult(_0x4a70a6,null))[_0xfd10('0x2c')](handleError(_0x4a70a6,null));};exports[_0xfd10('0x3d')]=function(_0x2a6609,_0x5dabd1){return db[_0xfd10('0x3e')][_0xfd10('0x38')]({'where':{'id':_0x2a6609[_0xfd10('0x2e')]['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x5dabd1,null))[_0xfd10('0x1b')](function(_0x130096){if(_0x130096){return _0x130096[_0xfd10('0x3d')](_0x2a6609[_0xfd10('0x3a')][_0xfd10('0x3f')],_['omit'](_0x2a6609[_0xfd10('0x3a')],[_0xfd10('0x3f'),'id'])||{});}})[_0xfd10('0x1b')](respondWithResult(_0x5dabd1,null))[_0xfd10('0x2c')](handleError(_0x5dabd1,null));};exports[_0xfd10('0x40')]=function(_0x56c973,_0x51e8a1){var _0x12ea46={'raw':![],'where':{}};var _0x46b24a={};var _0x22ce6c={'count':0x0,'rows':[]};return db[_0xfd10('0x23')][_0xfd10('0x41')]({'where':{'id':_0x56c973[_0xfd10('0x2e')]['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x51e8a1,null))[_0xfd10('0x1b')](function(_0x2f864b){if(_0x2f864b){_0x46b24a[_0xfd10('0x2f')]=_[_0xfd10('0x30')](db['SmsMessage'][_0xfd10('0x24')]);_0x46b24a[_0xfd10('0x2a')]=_[_0xfd10('0x30')](_0x56c973[_0xfd10('0x2a')]);_0x46b24a[_0xfd10('0x31')]=_[_0xfd10('0x32')](_0x46b24a[_0xfd10('0x2f')],_0x46b24a[_0xfd10('0x2a')]);_0x12ea46[_0xfd10('0x33')]=_[_0xfd10('0x32')](_0x46b24a[_0xfd10('0x2f')],qs[_0xfd10('0x42')](_0x56c973[_0xfd10('0x2a')]['fields']));_0x12ea46[_0xfd10('0x33')]=_0x12ea46['attributes'][_0xfd10('0x43')]?_0x12ea46[_0xfd10('0x33')]:_0x46b24a[_0xfd10('0x2f')];if(!_0x56c973['query'][_0xfd10('0x44')](_0xfd10('0x45'))){_0x12ea46[_0xfd10('0x17')]=qs['limit'](_0x56c973[_0xfd10('0x2a')][_0xfd10('0x17')]);_0x12ea46['offset']=qs['offset'](_0x56c973[_0xfd10('0x2a')][_0xfd10('0x14')]);}_0x12ea46[_0xfd10('0x46')]=qs[_0xfd10('0x47')](_0x56c973[_0xfd10('0x2a')][_0xfd10('0x47')]);_0x12ea46[_0xfd10('0x48')]=qs[_0xfd10('0x31')](_[_0xfd10('0x49')](_0x56c973[_0xfd10('0x2a')],_0x46b24a[_0xfd10('0x31')]));_0x12ea46[_0xfd10('0x48')]['SmsInteractionId']=_0x2f864b['id'];if(_0x56c973['query']['filter']){_0x12ea46['where']=_[_0xfd10('0x36')](_0x12ea46['where'],{'$or':_['map'](_0x12ea46[_0xfd10('0x33')],function(_0x4248e3){var _0x3c81ab={};_0x3c81ab[_0x4248e3]={'$like':'%'+_0x56c973[_0xfd10('0x2a')][_0xfd10('0x4a')]+'%'};return _0x3c81ab;})});}if(_0x56c973[_0xfd10('0x2a')][_0xfd10('0x4b')]){var _0x48af17=_0x56c973[_0xfd10('0x2a')][_0xfd10('0x4b')][_0xfd10('0x4c')](',');var _0x5908cd={};_0x5908cd[_0x48af17[0x0]]={'$gte':moment(_0x48af17[0x1])['format'](_0xfd10('0x4d'))};_0x12ea46[_0xfd10('0x48')]=_[_0xfd10('0x36')](_0x12ea46['where'],_0x5908cd);}_0x12ea46=_[_0xfd10('0x36')]({},_0x12ea46,_0x56c973[_0xfd10('0x37')]);return db[_0xfd10('0x3e')][_0xfd10('0x16')]({'where':_0x12ea46['where']})[_0xfd10('0x1b')](function(_0x24111b){_0x22ce6c['count']=_0x24111b;if(_0x56c973[_0xfd10('0x2a')]['includeAll']){_0x12ea46[_0xfd10('0x35')]=[{'all':!![]}];}return db[_0xfd10('0x3e')][_0xfd10('0x28')](_0x12ea46);})['then'](function(_0x18b008){_0x22ce6c[_0xfd10('0x4e')]=_0x18b008;return _0x22ce6c;});}})[_0xfd10('0x1b')](respondWithFilteredResult(_0x51e8a1,_0x12ea46))[_0xfd10('0x2c')](handleError(_0x51e8a1,null));};exports[_0xfd10('0x4f')]=function(_0x22bb49,_0x3f7375){return db[_0xfd10('0x23')][_0xfd10('0x38')]({'where':{'id':_0x22bb49[_0xfd10('0x2e')]['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x3f7375,null))[_0xfd10('0x1b')](function(_0x4a5b48){if(_0x4a5b48){return _0x4a5b48[_0xfd10('0x50')](_0x22bb49['body'][_0xfd10('0x3f')],_[_0xfd10('0x51')](_0x22bb49[_0xfd10('0x3a')],['ids','id'])||{})[_0xfd10('0x52')](function(){return db['Tag'][_0xfd10('0x28')]({'attributes':['id',_0xfd10('0x1f'),_0xfd10('0x53')],'where':{'id':_0x22bb49[_0xfd10('0x3a')][_0xfd10('0x3f')]}});})[_0xfd10('0x1b')](function(_0x111870){socket[_0xfd10('0x54')](_0xfd10('0x55'),{'id':Number(_0x22bb49[_0xfd10('0x2e')]['id']),'tags':_0x111870||[]});return{'id':Number(_0x22bb49[_0xfd10('0x2e')]['id']),'tags':_0x111870||[]};});}})[_0xfd10('0x1b')](respondWithResult(_0x3f7375,null))[_0xfd10('0x2c')](handleError(_0x3f7375,null));};exports[_0xfd10('0x56')]=function(_0x18e421,_0x3e9a74){return db[_0xfd10('0x23')][_0xfd10('0x38')]({'where':{'id':_0x18e421[_0xfd10('0x2e')]['id']}})[_0xfd10('0x1b')](handleEntityNotFound(_0x3e9a74,null))[_0xfd10('0x1b')](function(_0x4cd777){if(_0x4cd777){return _0x4cd777['removeTags'](_0x18e421['query']['ids']);}})[_0xfd10('0x1b')](respondWithStatusCode(_0x3e9a74,null))[_0xfd10('0x2c')](handleError(_0x3e9a74,null));};exports[_0xfd10('0x57')]=function(_0x27ee09,_0x22cd96){var _0x4335d8=moment()['unix']()[_0xfd10('0x58')]();var _0x22ca48=path['join'](config[_0xfd10('0x59')],_0xfd10('0x5a'),_0xfd10('0x5b'),_0xfd10('0x5c'));var _0xbe6409=path['join'](_0x22ca48,_0x4335d8);var _0x2dcb4a=util[_0xfd10('0x5d')]('transcript-%d-%s.zip',_0x27ee09[_0xfd10('0x2e')]['id'],_0x4335d8);var _0x3e7f9b=path['join'](_0x22ca48,_0x2dcb4a);var _0x598acd=[];_0x598acd[_0xfd10('0x5e')]({'model':db['User'],'as':_0xfd10('0x5f'),'attributes':['id',_0xfd10('0x60')],'raw':!![]});_0x598acd[_0xfd10('0x5e')]({'model':db[_0xfd10('0x61')],'as':'Contact','attributes':['id',_0xfd10('0x62'),_0xfd10('0x63')],'raw':!![]});var _0x113172=[{'model':db[_0xfd10('0x3e')],'as':_0xfd10('0x64'),'attributes':['id',_0xfd10('0x3a'),_0xfd10('0x65'),_0xfd10('0x66'),_0xfd10('0x67'),'read'],'include':_0x598acd}];_0x113172['push']({'model':db[_0xfd10('0x68')],'as':_0xfd10('0x69'),'attributes':['id',_0xfd10('0x1f')]});_0x113172[_0xfd10('0x5e')]({'model':db[_0xfd10('0x5f')],'as':_0xfd10('0x6a'),'attributes':['id',_0xfd10('0x60')]});return db[_0xfd10('0x23')]['find']({'where':{'id':_0x27ee09['params']['id']},'include':_0x113172})[_0xfd10('0x1b')](handleEntityNotFound(_0x22cd96,null))[_0xfd10('0x1b')](function(_0x450949){if(_0x450949){var _0x5f099b=_0x450949['get']({'plain':!![]});fs[_0xfd10('0x6b')](_0xbe6409);var _0xff5508={'channel':_0xfd10('0x6c'),'account':_0x5f099b[_0xfd10('0x69')][_0xfd10('0x1f')],'agent':_0x5f099b[_0xfd10('0x6a')]?_0x5f099b[_0xfd10('0x6a')][_0xfd10('0x60')]:'N.A.','createdAt':moment(_0x5f099b['createdAt'])['format'](_0xfd10('0x4d'))['toString'](),'closedAt':_0x5f099b[_0xfd10('0x6d')]?moment(_0x5f099b[_0xfd10('0x6e')])['format'](_0xfd10('0x4d'))[_0xfd10('0x58')]():'','disposition':_0x5f099b[_0xfd10('0x6f')],'messages':_(_0x5f099b[_0xfd10('0x64')])[_0xfd10('0x4a')]({'secret':![]})[_0xfd10('0x22')](function(_0x54cbdb){return{'date':moment(_0x54cbdb[_0xfd10('0x65')])[_0xfd10('0x5d')](_0xfd10('0x4d'))[_0xfd10('0x58')](),'sender':_0x54cbdb[_0xfd10('0x66')]===_0xfd10('0x70')?_0x54cbdb['User']?_0x54cbdb[_0xfd10('0x5f')][_0xfd10('0x60')]:_0xfd10('0x71'):_0x54cbdb[_0xfd10('0x72')][_0xfd10('0x62')]+(_0x54cbdb[_0xfd10('0x72')][_0xfd10('0x63')]?'\x20'+_0x54cbdb[_0xfd10('0x72')][_0xfd10('0x63')]:''),'body':_0x54cbdb[_0xfd10('0x3a')],'direction':_0x54cbdb[_0xfd10('0x66')]===_0xfd10('0x70')?'A':'C','secret':_0x54cbdb[_0xfd10('0x67')],'read':_0x54cbdb[_0xfd10('0x73')]};})[_0xfd10('0x74')]()};return ejs[_0xfd10('0x75')](path[_0xfd10('0x76')](config[_0xfd10('0x59')],_0xfd10('0x5a'),_0xfd10('0x77'),_0xfd10('0x78')),{'interaction':_0xff5508})[_0xfd10('0x1b')](function(_0x577fda){var _0x1ab463=path[_0xfd10('0x76')](_0xbe6409,_0xfd10('0x79')+_0x5f099b['id']+'-'+_0x4335d8+_0xfd10('0x7a'));var _0x2ad8aa={'path':_0x1ab463,'channel':_0xfd10('0x6c'),'interactionId':_0x5f099b['id']};return pdf['createPdfFromHTML'](_0x577fda,_0x2ad8aa);})[_0xfd10('0x1b')](function(){return new BPromise(function(_0x280289,_0x2553e2){zipdir(_0xbe6409,{'saveTo':_0x3e7f9b},function(_0x34ba13,_0x489b0f){if(_0x34ba13)return _0x2553e2(_0x34ba13);return _0x280289(_0x489b0f);});})[_0xfd10('0x1b')](function(){return new BPromise(function(_0x403ed1,_0x433e9c){rimraf(_0xbe6409,function(_0x3bba75){if(_0x3bba75)_0x433e9c(_0x3bba75);return _0x403ed1();});});})['then'](function(){return _0x22cd96[_0xfd10('0x57')](_0x3e7f9b,_0x2dcb4a,function(_0x209d95){if(_0x209d95){console[_0xfd10('0x7b')](_0xfd10('0x7c'),_0x209d95);}else{fs[_0xfd10('0x7d')](_0x3e7f9b);}});});});}else{return _0x22cd96[_0xfd10('0x1c')](0xc8);}})[_0xfd10('0x2c')](handleError(_0x22cd96,null));}; \ No newline at end of file +var _0x6bbb=['json','undefined','offset','limit','set','update','then','error','name','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','destroy','describe','addMessage','ids','omit','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','pick','where','SmsInteractionId','filter','$gte','split','format','count','rows','addTags','setTags','Tag','emit','removeTags','download','join','root','server','files','tmp','push','User','fullname','Contact','firstName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','YYYY-MM-DD\x20HH:mm:ss','toString','closed','out','System','lastName','value','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','sendStatus','status','end'];(function(_0x120d6a,_0x47fcb6){var _0x3c56e5=function(_0x321e51){while(--_0x321e51){_0x120d6a['push'](_0x120d6a['shift']());}};_0x3c56e5(++_0x47fcb6);}(_0x6bbb,0x148));var _0xb6bb=function(_0x1d30a3,_0x5f428c){_0x1d30a3=_0x1d30a3-0x0;var _0x32bba1=_0x6bbb[_0x1d30a3];return _0x32bba1;};'use strict';var rimraf=require(_0xb6bb('0x0'));var zipdir=require(_0xb6bb('0x1'));var moment=require('moment');var BPromise=require(_0xb6bb('0x2'));var util=require('util');var path=require('path');var ejs=require(_0xb6bb('0x3'));var fs=require('fs');var _=require(_0xb6bb('0x4'));var Redis=require('ioredis');var interaction=require(_0xb6bb('0x5'));var qs=require(_0xb6bb('0x6'));var pdf=require(_0xb6bb('0x7'));var logger=require(_0xb6bb('0x8'))(_0xb6bb('0x9'));var config=require(_0xb6bb('0xa'));var db=require(_0xb6bb('0xb'))['db'];config[_0xb6bb('0xc')]=_[_0xb6bb('0xd')](config[_0xb6bb('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6bb('0xc')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1f72f8,_0x586708){_0x586708=_0x586708||0xcc;return function(_0x126da7){if(_0x126da7){return _0x1f72f8[_0xb6bb('0xe')](_0x586708);}return _0x1f72f8[_0xb6bb('0xf')](_0x586708)[_0xb6bb('0x10')]();};}function respondWithResult(_0x5834ee,_0x5d9452){_0x5d9452=_0x5d9452||0xc8;return function(_0x25b150){if(_0x25b150){return _0x5834ee[_0xb6bb('0xf')](_0x5d9452)[_0xb6bb('0x11')](_0x25b150);}};}function respondWithFilteredResult(_0x5e67b0,_0x3bba80){return function(_0x42f33e){if(_0x42f33e){var _0x62bb90=typeof _0x3bba80['offset']==='undefined'&&typeof _0x3bba80['limit']===_0xb6bb('0x12');var _0x2227f9=_0x42f33e['count'];var _0x53ff59=_0x62bb90?0x0:_0x3bba80[_0xb6bb('0x13')];var _0xcdfe26=_0x62bb90?_0x42f33e['count']:_0x3bba80[_0xb6bb('0x13')]+_0x3bba80[_0xb6bb('0x14')];var _0x3320b2;if(_0xcdfe26>=_0x2227f9){_0xcdfe26=_0x2227f9;_0x3320b2=0xc8;}else{_0x3320b2=0xce;}_0x5e67b0[_0xb6bb('0xf')](_0x3320b2);return _0x5e67b0[_0xb6bb('0x15')]('Content-Range',_0x53ff59+'-'+_0xcdfe26+'/'+_0x2227f9)[_0xb6bb('0x11')](_0x42f33e);}return null;};}function saveUpdates(_0x5d6f1e){return function(_0x12be45){if(_0x12be45){return _0x12be45[_0xb6bb('0x16')](_0x5d6f1e)['then'](function(_0x54b1cb){return _0x54b1cb;});}return null;};}function removeEntity(_0x1b5412){return function(_0x5d8568){if(_0x5d8568){return _0x5d8568['destroy']()[_0xb6bb('0x17')](function(){_0x1b5412['status'](0xcc)[_0xb6bb('0x10')]();});}};}function handleEntityNotFound(_0xd5a7b9){return function(_0x318073){if(!_0x318073){_0xd5a7b9[_0xb6bb('0xe')](0x194);}return _0x318073;};}function handleError(_0x2f6d9b,_0x937bdd){_0x937bdd=_0x937bdd||0x1f4;return function(_0x2bce22){logger[_0xb6bb('0x18')](_0x2bce22['stack']);if(_0x2bce22[_0xb6bb('0x19')]){delete _0x2bce22['name'];}_0x2f6d9b[_0xb6bb('0xf')](_0x937bdd)['send'](_0x2bce22);};}exports[_0xb6bb('0x1a')]=function(_0x5731d3,_0x1a5457){var _0x3d7a6d={};var _0x2e451e=_[_0xb6bb('0x1b')](db[_0xb6bb('0x1c')][_0xb6bb('0x1d')],function(_0xfb45d2){return{'name':_0xfb45d2[_0xb6bb('0x1e')],'type':_0xfb45d2[_0xb6bb('0x1f')][_0xb6bb('0x20')]};});_0x3d7a6d=qs[_0xb6bb('0x21')](_0x2e451e,_0x5731d3);return interaction[_0xb6bb('0x22')](_0xb6bb('0x23'),_0x5731d3[_0xb6bb('0x24')],_0x5731d3[_0xb6bb('0x25')],_0x3d7a6d,_0x2e451e)['then'](respondWithFilteredResult(_0x1a5457,_0x3d7a6d))[_0xb6bb('0x26')](handleError(_0x1a5457,null));};exports[_0xb6bb('0x27')]=function(_0x266c5c,_0x2e14a9){var _0x369bb5={'raw':![],'where':{'id':_0x266c5c[_0xb6bb('0x28')]['id']}},_0x1030fa={};_0x1030fa[_0xb6bb('0x29')]=_[_0xb6bb('0x2a')](db[_0xb6bb('0x1c')][_0xb6bb('0x1d')]);_0x1030fa['query']=_['keys'](_0x266c5c[_0xb6bb('0x24')]);_0x1030fa['filters']=_[_0xb6bb('0x2b')](_0x1030fa[_0xb6bb('0x29')],_0x1030fa[_0xb6bb('0x24')]);_0x369bb5[_0xb6bb('0x2c')]=_['intersection'](_0x1030fa['model'],qs[_0xb6bb('0x2d')](_0x266c5c['query'][_0xb6bb('0x2d')]));_0x369bb5['attributes']=_0x369bb5[_0xb6bb('0x2c')][_0xb6bb('0x2e')]?_0x369bb5['attributes']:_0x1030fa[_0xb6bb('0x29')];if(_0x266c5c[_0xb6bb('0x24')][_0xb6bb('0x2f')]){_0x369bb5[_0xb6bb('0x30')]=[{'all':!![]}];}_0x369bb5=_[_0xb6bb('0x31')]({},_0x369bb5,_0x266c5c[_0xb6bb('0x32')]);return db[_0xb6bb('0x1c')]['find'](_0x369bb5)[_0xb6bb('0x17')](handleEntityNotFound(_0x2e14a9,null))[_0xb6bb('0x17')](respondWithResult(_0x2e14a9,null))[_0xb6bb('0x26')](handleError(_0x2e14a9,null));};exports[_0xb6bb('0x33')]=function(_0x52b6fa,_0x4f0e3a){return db['SmsInteraction'][_0xb6bb('0x33')](_0x52b6fa[_0xb6bb('0x34')],{})[_0xb6bb('0x17')](respondWithResult(_0x4f0e3a,0xc9))[_0xb6bb('0x26')](handleError(_0x4f0e3a,null));};exports['update']=function(_0x3fc889,_0x432f31){if(_0x3fc889[_0xb6bb('0x34')]['id']){delete _0x3fc889[_0xb6bb('0x34')]['id'];}return db[_0xb6bb('0x1c')][_0xb6bb('0x35')]({'where':{'id':_0x3fc889[_0xb6bb('0x28')]['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x432f31,null))[_0xb6bb('0x17')](saveUpdates(_0x3fc889['body'],null))[_0xb6bb('0x17')](respondWithResult(_0x432f31,null))['catch'](handleError(_0x432f31,null));};exports[_0xb6bb('0x36')]=function(_0x2cc5d2,_0x68e275){return db[_0xb6bb('0x1c')]['find']({'where':{'id':_0x2cc5d2[_0xb6bb('0x28')]['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x68e275,null))[_0xb6bb('0x17')](removeEntity(_0x68e275,null))[_0xb6bb('0x26')](handleError(_0x68e275,null));};exports[_0xb6bb('0x37')]=function(_0x490428,_0x2da59){return db[_0xb6bb('0x1c')]['describe']()['then'](respondWithResult(_0x2da59,null))[_0xb6bb('0x26')](handleError(_0x2da59,null));};exports['addMessage']=function(_0x5eee22,_0x1edb9f){return db['SmsMessage'][_0xb6bb('0x35')]({'where':{'id':_0x5eee22[_0xb6bb('0x28')]['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x1edb9f,null))[_0xb6bb('0x17')](function(_0x20b15f){if(_0x20b15f){return _0x20b15f[_0xb6bb('0x38')](_0x5eee22[_0xb6bb('0x34')][_0xb6bb('0x39')],_[_0xb6bb('0x3a')](_0x5eee22[_0xb6bb('0x34')],['ids','id'])||{});}})[_0xb6bb('0x17')](respondWithResult(_0x1edb9f,null))[_0xb6bb('0x26')](handleError(_0x1edb9f,null));};exports[_0xb6bb('0x3b')]=function(_0x526f89,_0x12825d){var _0x120790={'raw':![],'where':{}};var _0x33afb3={};var _0x49e3dc={'count':0x0,'rows':[]};return db[_0xb6bb('0x1c')][_0xb6bb('0x3c')]({'where':{'id':_0x526f89[_0xb6bb('0x28')]['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x12825d,null))[_0xb6bb('0x17')](function(_0x5f3dec){if(_0x5f3dec){_0x33afb3[_0xb6bb('0x29')]=_['keys'](db['SmsMessage']['rawAttributes']);_0x33afb3[_0xb6bb('0x24')]=_['keys'](_0x526f89['query']);_0x33afb3[_0xb6bb('0x3d')]=_[_0xb6bb('0x2b')](_0x33afb3['model'],_0x33afb3[_0xb6bb('0x24')]);_0x120790[_0xb6bb('0x2c')]=_[_0xb6bb('0x2b')](_0x33afb3['model'],qs[_0xb6bb('0x2d')](_0x526f89[_0xb6bb('0x24')][_0xb6bb('0x2d')]));_0x120790['attributes']=_0x120790[_0xb6bb('0x2c')][_0xb6bb('0x2e')]?_0x120790['attributes']:_0x33afb3['model'];if(!_0x526f89['query'][_0xb6bb('0x3e')](_0xb6bb('0x3f'))){_0x120790[_0xb6bb('0x14')]=qs[_0xb6bb('0x14')](_0x526f89[_0xb6bb('0x24')]['limit']);_0x120790[_0xb6bb('0x13')]=qs[_0xb6bb('0x13')](_0x526f89[_0xb6bb('0x24')][_0xb6bb('0x13')]);}_0x120790[_0xb6bb('0x40')]=qs['sort'](_0x526f89['query'][_0xb6bb('0x41')]);_0x120790['where']=qs[_0xb6bb('0x3d')](_[_0xb6bb('0x42')](_0x526f89['query'],_0x33afb3['filters']));_0x120790[_0xb6bb('0x43')][_0xb6bb('0x44')]=_0x5f3dec['id'];if(_0x526f89[_0xb6bb('0x24')][_0xb6bb('0x45')]){_0x120790[_0xb6bb('0x43')]=_[_0xb6bb('0x31')](_0x120790[_0xb6bb('0x43')],{'$or':_[_0xb6bb('0x1b')](_0x120790[_0xb6bb('0x2c')],function(_0x33c895){var _0x2dbd4b={};_0x2dbd4b[_0x33c895]={'$like':'%'+_0x526f89[_0xb6bb('0x24')]['filter']+'%'};return _0x2dbd4b;})});}if(_0x526f89['query'][_0xb6bb('0x46')]){var _0x21b156=_0x526f89[_0xb6bb('0x24')][_0xb6bb('0x46')][_0xb6bb('0x47')](',');var _0x8a03aa={};_0x8a03aa[_0x21b156[0x0]]={'$gte':moment(_0x21b156[0x1])[_0xb6bb('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x120790['where']=_[_0xb6bb('0x31')](_0x120790[_0xb6bb('0x43')],_0x8a03aa);}_0x120790=_[_0xb6bb('0x31')]({},_0x120790,_0x526f89[_0xb6bb('0x32')]);return db['SmsMessage'][_0xb6bb('0x49')]({'where':_0x120790[_0xb6bb('0x43')]})[_0xb6bb('0x17')](function(_0x1492f4){_0x49e3dc[_0xb6bb('0x49')]=_0x1492f4;if(_0x526f89[_0xb6bb('0x24')][_0xb6bb('0x2f')]){_0x120790[_0xb6bb('0x30')]=[{'all':!![]}];}return db['SmsMessage'][_0xb6bb('0x22')](_0x120790);})['then'](function(_0x1ebbe3){_0x49e3dc[_0xb6bb('0x4a')]=_0x1ebbe3;return _0x49e3dc;});}})[_0xb6bb('0x17')](respondWithFilteredResult(_0x12825d,_0x120790))[_0xb6bb('0x26')](handleError(_0x12825d,null));};exports[_0xb6bb('0x4b')]=function(_0x191e5b,_0x3855dd){return db[_0xb6bb('0x1c')]['find']({'where':{'id':_0x191e5b['params']['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x3855dd,null))[_0xb6bb('0x17')](function(_0x4f1f8b){if(_0x4f1f8b){return _0x4f1f8b[_0xb6bb('0x4c')](_0x191e5b[_0xb6bb('0x34')][_0xb6bb('0x39')],_[_0xb6bb('0x3a')](_0x191e5b[_0xb6bb('0x34')],[_0xb6bb('0x39'),'id'])||{})['spread'](function(){return db[_0xb6bb('0x4d')]['findAll']({'attributes':['id',_0xb6bb('0x19'),'color'],'where':{'id':_0x191e5b[_0xb6bb('0x34')][_0xb6bb('0x39')]}});})[_0xb6bb('0x17')](function(_0x43d656){socket[_0xb6bb('0x4e')]('smsInteractionTags:save',{'id':Number(_0x191e5b['params']['id']),'tags':_0x43d656||[]});return{'id':Number(_0x191e5b['params']['id']),'tags':_0x43d656||[]};});}})[_0xb6bb('0x17')](respondWithResult(_0x3855dd,null))[_0xb6bb('0x26')](handleError(_0x3855dd,null));};exports[_0xb6bb('0x4f')]=function(_0x392e85,_0x5c6974){return db['SmsInteraction'][_0xb6bb('0x35')]({'where':{'id':_0x392e85[_0xb6bb('0x28')]['id']}})[_0xb6bb('0x17')](handleEntityNotFound(_0x5c6974,null))['then'](function(_0x6c8b3d){if(_0x6c8b3d){return _0x6c8b3d[_0xb6bb('0x4f')](_0x392e85[_0xb6bb('0x24')][_0xb6bb('0x39')]);}})['then'](respondWithStatusCode(_0x5c6974,null))[_0xb6bb('0x26')](handleError(_0x5c6974,null));};exports[_0xb6bb('0x50')]=function(_0x37b29d,_0x2ef9ac){var _0x41fef2=moment()['unix']()['toString']();var _0x229768=path[_0xb6bb('0x51')](config[_0xb6bb('0x52')],_0xb6bb('0x53'),_0xb6bb('0x54'),_0xb6bb('0x55'));var _0x9675df=path['join'](_0x229768,_0x41fef2);var _0x464e18=util[_0xb6bb('0x48')]('transcript-%d-%s.zip',_0x37b29d[_0xb6bb('0x28')]['id'],_0x41fef2);var _0x2dbb11=path['join'](_0x229768,_0x464e18);var _0x1a3390=[];_0x1a3390[_0xb6bb('0x56')]({'model':db[_0xb6bb('0x57')],'as':_0xb6bb('0x57'),'attributes':['id',_0xb6bb('0x58')],'raw':!![]});_0x1a3390[_0xb6bb('0x56')]({'model':db['CmContact'],'as':_0xb6bb('0x59'),'attributes':['id',_0xb6bb('0x5a'),'lastName'],'raw':!![]});var _0x142d52=[{'model':db['SmsMessage'],'as':_0xb6bb('0x5b'),'attributes':['id','body',_0xb6bb('0x5c'),_0xb6bb('0x5d'),_0xb6bb('0x5e'),_0xb6bb('0x5f')],'include':_0x1a3390}];_0x142d52[_0xb6bb('0x56')]({'model':db[_0xb6bb('0x60')],'as':_0xb6bb('0x61'),'attributes':['id',_0xb6bb('0x19')]});_0x142d52[_0xb6bb('0x56')]({'model':db['User'],'as':_0xb6bb('0x62'),'attributes':['id','fullname']});return db[_0xb6bb('0x1c')][_0xb6bb('0x35')]({'where':{'id':_0x37b29d[_0xb6bb('0x28')]['id']},'include':_0x142d52})[_0xb6bb('0x17')](handleEntityNotFound(_0x2ef9ac,null))[_0xb6bb('0x17')](function(_0x16f540){if(_0x16f540){var _0x4f2c97=_0x16f540[_0xb6bb('0x63')]({'plain':!![]});fs[_0xb6bb('0x64')](_0x9675df);var _0xce4488={'channel':_0xb6bb('0x65'),'account':_0x4f2c97['Account'][_0xb6bb('0x19')],'agent':_0x4f2c97[_0xb6bb('0x62')]?_0x4f2c97[_0xb6bb('0x62')]['fullname']:'N.A.','createdAt':moment(_0x4f2c97[_0xb6bb('0x5c')])[_0xb6bb('0x48')](_0xb6bb('0x66'))[_0xb6bb('0x67')](),'closedAt':_0x4f2c97[_0xb6bb('0x68')]?moment(_0x4f2c97['closedAt'])[_0xb6bb('0x48')](_0xb6bb('0x66'))['toString']():'','disposition':_0x4f2c97['disposition'],'messages':_(_0x4f2c97[_0xb6bb('0x5b')])[_0xb6bb('0x45')]({'secret':![]})[_0xb6bb('0x1b')](function(_0x589188){return{'date':moment(_0x589188[_0xb6bb('0x5c')])[_0xb6bb('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb6bb('0x67')](),'sender':_0x589188['direction']===_0xb6bb('0x69')?_0x589188['User']?_0x589188['User']['fullname']:_0xb6bb('0x6a'):_0x589188[_0xb6bb('0x59')]['firstName']+(_0x589188[_0xb6bb('0x59')]['lastName']?'\x20'+_0x589188[_0xb6bb('0x59')][_0xb6bb('0x6b')]:''),'body':_0x589188[_0xb6bb('0x34')],'direction':_0x589188[_0xb6bb('0x5d')]===_0xb6bb('0x69')?'A':'C','secret':_0x589188[_0xb6bb('0x5e')],'read':_0x589188[_0xb6bb('0x5f')]};})[_0xb6bb('0x6c')]()};return ejs['renderFile'](path['join'](config[_0xb6bb('0x52')],'server',_0xb6bb('0x6d'),_0xb6bb('0x6e')),{'interaction':_0xce4488})[_0xb6bb('0x17')](function(_0xa4fef){var _0x29ce36=path[_0xb6bb('0x51')](_0x9675df,'transcript-'+_0x4f2c97['id']+'-'+_0x41fef2+'.pdf');var _0xa80f2f={'path':_0x29ce36,'channel':'Sms','interactionId':_0x4f2c97['id']};return pdf[_0xb6bb('0x6f')](_0xa4fef,_0xa80f2f);})[_0xb6bb('0x17')](function(){return new BPromise(function(_0x1166ca,_0x3b1086){zipdir(_0x9675df,{'saveTo':_0x2dbb11},function(_0xf558ef,_0x13eff0){if(_0xf558ef)return _0x3b1086(_0xf558ef);return _0x1166ca(_0x13eff0);});})[_0xb6bb('0x17')](function(){return new BPromise(function(_0x347c09,_0x537429){rimraf(_0x9675df,function(_0x465aad){if(_0x465aad)_0x537429(_0x465aad);return _0x347c09();});});})[_0xb6bb('0x17')](function(){return _0x2ef9ac[_0xb6bb('0x50')](_0x2dbb11,_0x464e18,function(_0x4806db){if(_0x4806db){console[_0xb6bb('0x70')](_0xb6bb('0x71'),_0x4806db);}else{fs[_0xb6bb('0x72')](_0x2dbb11);}});});});}else{return _0x2ef9ac['sendStatus'](0xc8);}})[_0xb6bb('0x26')](handleError(_0x2ef9ac,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 047cf78..a9112f8 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 _0x236c=['length','emit','catch','hasOwnProperty','exports','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','getUsers','setDataValue','findAll','unreadMessages'];(function(_0x7e637c,_0x4a409f){var _0x14d7bb=function(_0x62beee){while(--_0x62beee){_0x7e637c['push'](_0x7e637c['shift']());}};_0x14d7bb(++_0x4a409f);}(_0x236c,0x155));var _0xc236=function(_0x42c06c,_0x1ced12){_0x42c06c=_0x42c06c-0x0;var _0x2ac08c=_0x236c[_0x42c06c];return _0x2ac08c;};'use strict';var EventEmitter=require(_0xc236('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xc236('0x1')];var SmsMessage=require(_0xc236('0x2'))['db'][_0xc236('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc236('0x4')](0x0);var events={'afterCreate':_0xc236('0x5'),'afterUpdate':'update','afterDestroy':_0xc236('0x6')};function emitEvent(_0x36e87d){return function(_0x33bc57,_0xd582f6,_0x23d3cc){_0x33bc57[_0xc236('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xd612c6){_0x33bc57[_0xc236('0x8')]('Users',_0xd612c6['map'](function(_0x5cdee5){return{'id':_0x5cdee5['id']};}));return SmsMessage[_0xc236('0x9')]({'where':{'SmsInteractionId':_0x33bc57['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30a28d){_0x33bc57[_0xc236('0x8')](_0xc236('0xa'),_0x30a28d[_0xc236('0xb')]);SmsInteractionEvents[_0xc236('0xc')](_0x36e87d+':'+_0x33bc57['id'],_0x33bc57);SmsInteractionEvents['emit'](_0x36e87d,_0x33bc57);_0x23d3cc(null);})[_0xc236('0xd')](_0x23d3cc(null));};}for(var e in events){if(events[_0xc236('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc236('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x056b=['hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x5bbfe9,_0x38cc04){var _0x589e98=function(_0x3f259d){while(--_0x3f259d){_0x5bbfe9['push'](_0x5bbfe9['shift']());}};_0x589e98(++_0x38cc04);}(_0x056b,0xb6));var _0xb056=function(_0x39df6e,_0x548a5a){_0x39df6e=_0x39df6e-0x0;var _0xcbceb6=_0x056b[_0x39df6e];return _0xcbceb6;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xb056('0x0'))['db'][_0xb056('0x1')];var SmsMessage=require(_0xb056('0x0'))['db'][_0xb056('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xb056('0x3')](0x0);var events={'afterCreate':_0xb056('0x4'),'afterUpdate':_0xb056('0x5'),'afterDestroy':_0xb056('0x6')};function emitEvent(_0x343d88){return function(_0x2ff09d,_0x15a545,_0x515612){_0x2ff09d[_0xb056('0x7')]({'attributes':['id'],'raw':!![]})[_0xb056('0x8')](function(_0x3eae69){_0x2ff09d[_0xb056('0x9')](_0xb056('0xa'),_0x3eae69[_0xb056('0xb')](function(_0x539126){return{'id':_0x539126['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x2ff09d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb056('0x8')](function(_0x160c2a){_0x2ff09d[_0xb056('0x9')](_0xb056('0xc'),_0x160c2a['length']);SmsInteractionEvents[_0xb056('0xd')](_0x343d88+':'+_0x2ff09d['id'],_0x2ff09d);SmsInteractionEvents['emit'](_0x343d88,_0x2ff09d);_0x515612(null);})[_0xb056('0xe')](_0x515612(null));};}for(var e in events){if(events[_0xb056('0xf')](e)){var event=events[e];SmsInteraction[_0xb056('0x10')](e,emitEvent(event));}}module[_0xb056('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 5e0190f..3735239 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 _0x85a3=['format','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt'];(function(_0x5a0357,_0x83e3af){var _0x54769f=function(_0x92a59e){while(--_0x92a59e){_0x5a0357['push'](_0x5a0357['shift']());}};_0x54769f(++_0x83e3af);}(_0x85a3,0x199));var _0x385a=function(_0x31f3e6,_0x5462dc){_0x31f3e6=_0x31f3e6-0x0;var _0x3a1f86=_0x85a3[_0x31f3e6];return _0x3a1f86;};'use strict';var _=require('lodash');var util=require(_0x385a('0x0'));var logger=require(_0x385a('0x1'))(_0x385a('0x2'));var moment=require(_0x385a('0x3'));var BPromise=require(_0x385a('0x4'));var rp=require(_0x385a('0x5'));var fs=require('fs');var path=require(_0x385a('0x6'));var rimraf=require(_0x385a('0x7'));var config=require(_0x385a('0x8'));var attributes=require(_0x385a('0x9'));module[_0x385a('0xa')]=function(_0x6f8c3d,_0x292f47){return _0x6f8c3d[_0x385a('0xb')](_0x385a('0xc'),attributes,{'tableName':_0x385a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57a480,_0x592f5c,_0x58c268){if(_0x57a480['changed'](_0x385a('0xe'))){_0x57a480[_0x385a('0xf')]=moment()[_0x385a('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x58c268(null,_0x57a480);}}});}; \ No newline at end of file +var _0xeffd=['lodash','util','../../config/logger','api','moment','bluebird','path','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4d173e,_0x2cba6d){var _0x6a26a0=function(_0x28e530){while(--_0x28e530){_0x4d173e['push'](_0x4d173e['shift']());}};_0x6a26a0(++_0x2cba6d);}(_0xeffd,0x1c0));var _0xdeff=function(_0x1afd68,_0x2b104f){_0x1afd68=_0x1afd68-0x0;var _0x12cb3a=_0xeffd[_0x1afd68];return _0x12cb3a;};'use strict';var _=require(_0xdeff('0x0'));var util=require(_0xdeff('0x1'));var logger=require(_0xdeff('0x2'))(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var BPromise=require(_0xdeff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeff('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdeff('0x7'));module[_0xdeff('0x8')]=function(_0x1fdf2e,_0x56a85e){return _0x1fdf2e['define'](_0xdeff('0x9'),attributes,{'tableName':_0xdeff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25c526,_0x23e44d,_0x34fd76){if(_0x25c526[_0xdeff('0xb')](_0xdeff('0xc'))){_0x25c526[_0xdeff('0xd')]=moment()[_0xdeff('0xe')](_0xdeff('0xf'));}_0x34fd76(null,_0x25c526);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ec4705e..6b17205 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 _0x20b3=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','then','addTags','body','ids','omit','spread','AddTags','stringify','lodash','util'];(function(_0x2c4bc3,_0x34f08b){var _0x31ca59=function(_0x2190f0){while(--_0x2190f0){_0x2c4bc3['push'](_0x2c4bc3['shift']());}};_0x31ca59(++_0x34f08b);}(_0x20b3,0x112));var _0x320b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20b3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x320b('0x0'));var util=require(_0x320b('0x1'));var moment=require(_0x320b('0x2'));var BPromise=require(_0x320b('0x3'));var rs=require(_0x320b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x320b('0x5'))['db'];var utils=require(_0x320b('0x6'));var logger=require(_0x320b('0x7'))(_0x320b('0x8'));var config=require(_0x320b('0x9'));var jayson=require(_0x320b('0xa'));var client=jayson['client'][_0x320b('0xb')]({'port':0x232a});config[_0x320b('0xc')]=_[_0x320b('0xd')](config['redis'],{'host':_0x320b('0xe'),'port':0x18eb});var socket=require(_0x320b('0xf'))(new Redis(config['redis']));require(_0x320b('0x10'))[_0x320b('0x11')](socket);function respondWithRpcPromise(_0x21c280,_0x2d8055,_0x3210a3){return new BPromise(function(_0x1e2ea7,_0xb54238){return client[_0x320b('0x12')](_0x21c280,_0x3210a3)['then'](function(_0x480dd9){logger['info'](_0x320b('0x13'),_0x2d8055,'request\x20sent');logger[_0x320b('0x14')](_0x320b('0x15'),_0x2d8055,_0x320b('0x16'),JSON['stringify'](_0x480dd9));if(_0x480dd9['error']){if(_0x480dd9[_0x320b('0x17')][_0x320b('0x18')]===0x1f4){logger[_0x320b('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x2d8055,_0x480dd9['error'][_0x320b('0x19')]);return _0xb54238(_0x480dd9['error'][_0x320b('0x19')]);}logger[_0x320b('0x17')](_0x320b('0x13'),_0x2d8055,_0x480dd9[_0x320b('0x17')]['message']);return _0x1e2ea7(_0x480dd9['error'][_0x320b('0x19')]);}else{logger[_0x320b('0x1a')](_0x320b('0x13'),_0x2d8055,_0x320b('0x16'));_0x1e2ea7(_0x480dd9['result'][_0x320b('0x19')]);}})[_0x320b('0x1b')](function(_0x40a9b3){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x2d8055,_0x40a9b3);_0xb54238(_0x40a9b3);});});}exports[_0x320b('0x1c')]=function(_0x229492){var _0x25c8ce=this;return new Promise(function(_0x52f4c2,_0x2227dc){return db[_0x320b('0x1d')][_0x320b('0x1e')](_0x229492['body'],{'raw':_0x229492[_0x320b('0x1f')]?_0x229492[_0x320b('0x1f')][_0x320b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x229492[_0x320b('0x1f')]?_0x229492['options'][_0x320b('0x21')]||null:null,'attributes':_0x229492['options']?_0x229492[_0x320b('0x1f')][_0x320b('0x22')]||null:null,'limit':_0x229492[_0x320b('0x1f')]?_0x229492[_0x320b('0x1f')][_0x320b('0x23')]||null:null})['then'](function(_0x3ea22a){logger[_0x320b('0x1a')](_0x320b('0x1c'),_0x229492);logger[_0x320b('0x14')]('UpdateSmsInteraction',_0x229492,JSON['stringify'](_0x3ea22a));_0x52f4c2(_0x3ea22a);})[_0x320b('0x1b')](function(_0xddd352){logger['error'](_0x320b('0x1c'),_0xddd352['message'],_0x229492);_0x2227dc(_0x25c8ce[_0x320b('0x17')](0x1f4,_0xddd352['message']));});});};exports[_0x320b('0x24')]=function(_0x3e9c1d){return new Promise(function(_0x3385d4,_0x33c5c7){return db[_0x320b('0x1d')][_0x320b('0x25')]({'where':_0x3e9c1d[_0x320b('0x1f')]?_0x3e9c1d[_0x320b('0x1f')][_0x320b('0x21')]||null:null})[_0x320b('0x26')](function(_0x494531){if(_0x494531){return _0x494531[_0x320b('0x27')](_0x3e9c1d[_0x320b('0x28')][_0x320b('0x29')],_[_0x320b('0x2a')](_0x3e9c1d['body'],[_0x320b('0x29'),'id'])||{});}})[_0x320b('0x2b')](function(_0x12382e){logger[_0x320b('0x1a')](_0x320b('0x2c'),_0x3e9c1d);logger['debug']('AddTags',_0x3e9c1d,JSON[_0x320b('0x2d')](_0x12382e));_0x3385d4(_0x12382e);})[_0x320b('0x1b')](function(_0x586c10){logger['error'](_0x320b('0x2c'),_0x586c10[_0x320b('0x19')],_0x3e9c1d);_0x33c5c7(_this[_0x320b('0x17')](0x1f4,_0x586c10['message']));});});}; \ No newline at end of file +var _0x00ba=['SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','update','body','options','raw','attributes','debug','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','find','where','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info'];(function(_0x192772,_0x100b16){var _0x2b50bd=function(_0x3cbf90){while(--_0x3cbf90){_0x192772['push'](_0x192772['shift']());}};_0x2b50bd(++_0x100b16);}(_0x00ba,0x1a4));var _0xa00b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x00ba[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa00b('0x0'));var util=require(_0xa00b('0x1'));var moment=require(_0xa00b('0x2'));var BPromise=require(_0xa00b('0x3'));var rs=require(_0xa00b('0x4'));var fs=require('fs');var Redis=require(_0xa00b('0x5'));var db=require(_0xa00b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa00b('0x7'))(_0xa00b('0x8'));var config=require('../../config/environment');var jayson=require(_0xa00b('0x9'));var client=jayson[_0xa00b('0xa')][_0xa00b('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa00b('0xc')],{'host':_0xa00b('0xd'),'port':0x18eb});var socket=require(_0xa00b('0xe'))(new Redis(config[_0xa00b('0xc')]));require(_0xa00b('0xf'))[_0xa00b('0x10')](socket);function respondWithRpcPromise(_0x999973,_0xe135a0,_0x259dfa){return new BPromise(function(_0x4102c5,_0x1eeb7e){return client[_0xa00b('0x11')](_0x999973,_0x259dfa)[_0xa00b('0x12')](function(_0x2aef83){logger[_0xa00b('0x13')](_0xa00b('0x14'),_0xe135a0,'request\x20sent');logger['debug'](_0xa00b('0x15'),_0xe135a0,_0xa00b('0x16'),JSON[_0xa00b('0x17')](_0x2aef83));if(_0x2aef83[_0xa00b('0x18')]){if(_0x2aef83['error'][_0xa00b('0x19')]===0x1f4){logger[_0xa00b('0x18')](_0xa00b('0x14'),_0xe135a0,_0x2aef83[_0xa00b('0x18')][_0xa00b('0x1a')]);return _0x1eeb7e(_0x2aef83['error'][_0xa00b('0x1a')]);}logger[_0xa00b('0x18')](_0xa00b('0x14'),_0xe135a0,_0x2aef83[_0xa00b('0x18')]['message']);return _0x4102c5(_0x2aef83[_0xa00b('0x18')][_0xa00b('0x1a')]);}else{logger['info'](_0xa00b('0x14'),_0xe135a0,_0xa00b('0x16'));_0x4102c5(_0x2aef83[_0xa00b('0x1b')]['message']);}})[_0xa00b('0x1c')](function(_0x33b9bc){logger['error']('SmsInteraction,\x20%s,\x20%s',_0xe135a0,_0x33b9bc);_0x1eeb7e(_0x33b9bc);});});}exports['UpdateSmsInteraction']=function(_0x4656cb){var _0x23c0b9=this;return new Promise(function(_0x5c3e12,_0x47030b){return db['SmsInteraction'][_0xa00b('0x1d')](_0x4656cb[_0xa00b('0x1e')],{'raw':_0x4656cb[_0xa00b('0x1f')]?_0x4656cb['options'][_0xa00b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4656cb[_0xa00b('0x1f')]?_0x4656cb[_0xa00b('0x1f')]['where']||null:null,'attributes':_0x4656cb[_0xa00b('0x1f')]?_0x4656cb['options'][_0xa00b('0x21')]||null:null,'limit':_0x4656cb[_0xa00b('0x1f')]?_0x4656cb[_0xa00b('0x1f')]['limit']||null:null})[_0xa00b('0x12')](function(_0x496872){logger[_0xa00b('0x13')]('UpdateSmsInteraction',_0x4656cb);logger[_0xa00b('0x22')]('UpdateSmsInteraction',_0x4656cb,JSON['stringify'](_0x496872));_0x5c3e12(_0x496872);})[_0xa00b('0x1c')](function(_0x24f33d){logger[_0xa00b('0x18')](_0xa00b('0x23'),_0x24f33d[_0xa00b('0x1a')],_0x4656cb);_0x47030b(_0x23c0b9[_0xa00b('0x18')](0x1f4,_0x24f33d[_0xa00b('0x1a')]));});});};exports[_0xa00b('0x24')]=function(_0x41ff75){return new Promise(function(_0x53ade5,_0x5636ea){return db[_0xa00b('0x25')][_0xa00b('0x26')]({'where':_0x41ff75[_0xa00b('0x1f')]?_0x41ff75[_0xa00b('0x1f')][_0xa00b('0x27')]||null:null})['then'](function(_0x2adb1e){if(_0x2adb1e){return _0x2adb1e['addTags'](_0x41ff75[_0xa00b('0x1e')][_0xa00b('0x28')],_[_0xa00b('0x29')](_0x41ff75[_0xa00b('0x1e')],['ids','id'])||{});}})[_0xa00b('0x2a')](function(_0x30c67d){logger[_0xa00b('0x13')](_0xa00b('0x2b'),_0x41ff75);logger[_0xa00b('0x22')](_0xa00b('0x2b'),_0x41ff75,JSON[_0xa00b('0x17')](_0x30c67d));_0x53ade5(_0x30c67d);})[_0xa00b('0x1c')](function(_0x4faf9d){logger[_0xa00b('0x18')](_0xa00b('0x2b'),_0x4faf9d['message'],_0x41ff75);_0x5636ea(_this[_0xa00b('0x18')](0x1f4,_0x4faf9d[_0xa00b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 7d484c1..2289481 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 _0x5888=['removeListener','register','length','./smsInteraction.events','remove','update'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0x5888,0x1cb));var _0x8588=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x5888[_0x15876a];return _0xbd900f;};'use strict';var SmsInteractionEvents=require(_0x8588('0x0'));var events=['save',_0x8588('0x1'),_0x8588('0x2')];function createListener(_0x58d84c,_0xd1c01){return function(_0x420e1d){_0xd1c01['emit'](_0x58d84c,_0x420e1d);};}function removeListener(_0x209b22,_0x46f9db){return function(){SmsInteractionEvents[_0x8588('0x3')](_0x209b22,_0x46f9db);};}exports[_0x8588('0x4')]=function(_0x435c3f){for(var _0x46465b=0x0,_0x419a3c=events[_0x8588('0x5')];_0x46465b<_0x419a3c;_0x46465b++){var _0x382119=events[_0x46465b];var _0x4c92a1=createListener('smsInteraction:'+_0x382119,_0x435c3f);SmsInteractionEvents['on'](_0x382119,_0x4c92a1);}}; \ No newline at end of file +var _0x9744=['remove','emit','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x36fe00,_0x3ff5d0){var _0x34e1c2=function(_0xc7dc03){while(--_0xc7dc03){_0x36fe00['push'](_0x36fe00['shift']());}};_0x34e1c2(++_0x3ff5d0);}(_0x9744,0xa6));var _0x4974=function(_0x4cf5d8,_0x1f61ee){_0x4cf5d8=_0x4cf5d8-0x0;var _0x4f8cc0=_0x9744[_0x4cf5d8];return _0x4f8cc0;};'use strict';var SmsInteractionEvents=require(_0x4974('0x0'));var events=[_0x4974('0x1'),_0x4974('0x2'),'update'];function createListener(_0x670dc7,_0x495691){return function(_0x3f221f){_0x495691[_0x4974('0x3')](_0x670dc7,_0x3f221f);};}function removeListener(_0x2543b7,_0x4efd58){return function(){SmsInteractionEvents['removeListener'](_0x2543b7,_0x4efd58);};}exports[_0x4974('0x4')]=function(_0x4dd893){for(var _0x48a813=0x0,_0x5d4dfd=events[_0x4974('0x5')];_0x48a813<_0x5d4dfd;_0x48a813++){var _0x4ff22a=events[_0x48a813];var _0x2a0537=createListener(_0x4974('0x6')+_0x4ff22a,_0x4dd893);SmsInteractionEvents['on'](_0x4ff22a,_0x2a0537);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index b60e4d0..c8c493e 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 _0x6a3c=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','/describe','post','tracked','sms','smsmessage:create','create','/:id/status','status','update','put','/:id/accept','/:id/reject','delete','destroy','util','path'];(function(_0x3d3e5e,_0x5d2920){var _0x391dc9=function(_0x2185e0){while(--_0x2185e0){_0x3d3e5e['push'](_0x3d3e5e['shift']());}};_0x391dc9(++_0x5d2920);}(_0x6a3c,0x106));var _0xc6a3=function(_0x250bc3,_0x1b022a){_0x250bc3=_0x250bc3-0x0;var _0x1953a2=_0x6a3c[_0x250bc3];return _0x1953a2;};'use strict';var multer=require('multer');var util=require(_0xc6a3('0x0'));var path=require(_0xc6a3('0x1'));var timeout=require(_0xc6a3('0x2'));var express=require(_0xc6a3('0x3'));var router=express[_0xc6a3('0x4')]();var fs_extra=require(_0xc6a3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc6a3('0x6'));var config=require('../../config/environment');var controller=require(_0xc6a3('0x7'));router[_0xc6a3('0x8')]('/',auth[_0xc6a3('0x9')](),controller['index']);router[_0xc6a3('0x8')](_0xc6a3('0xa'),auth[_0xc6a3('0x9')](),controller['describe']);router[_0xc6a3('0x8')]('/:id',auth[_0xc6a3('0x9')](),controller['show']);router[_0xc6a3('0xb')]('/',auth[_0xc6a3('0x9')](),interaction[_0xc6a3('0xc')](_0xc6a3('0xd'),_0xc6a3('0xe')),controller[_0xc6a3('0xf')]);router[_0xc6a3('0xb')](_0xc6a3('0x10'),controller[_0xc6a3('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc6a3('0x12')]);router[_0xc6a3('0x13')](_0xc6a3('0x14'),auth[_0xc6a3('0x9')](),controller['accept']);router[_0xc6a3('0x13')](_0xc6a3('0x15'),auth[_0xc6a3('0x9')](),controller['reject']);router[_0xc6a3('0x16')]('/:id',auth[_0xc6a3('0x9')](),controller[_0xc6a3('0x17')]);module['exports']=router; \ No newline at end of file +var _0x53f8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','show','post','sms','smsmessage:create','/:id/status','status','/:id','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','fs-extra'];(function(_0x192b7d,_0x3db1eb){var _0x57e19a=function(_0x15287d){while(--_0x15287d){_0x192b7d['push'](_0x192b7d['shift']());}};_0x57e19a(++_0x3db1eb);}(_0x53f8,0xf7));var _0x853f=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x53f8[_0x3de8a4];return _0x4635cf;};'use strict';var multer=require(_0x853f('0x0'));var util=require(_0x853f('0x1'));var path=require('path');var timeout=require(_0x853f('0x2'));var express=require(_0x853f('0x3'));var router=express['Router']();var fs_extra=require(_0x853f('0x4'));var auth=require(_0x853f('0x5'));var interaction=require(_0x853f('0x6'));var config=require(_0x853f('0x7'));var controller=require(_0x853f('0x8'));router[_0x853f('0x9')]('/',auth[_0x853f('0xa')](),controller[_0x853f('0xb')]);router[_0x853f('0x9')](_0x853f('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x853f('0xa')](),controller[_0x853f('0xd')]);router[_0x853f('0xe')]('/',auth[_0x853f('0xa')](),interaction['tracked'](_0x853f('0xf'),_0x853f('0x10')),controller['create']);router['post'](_0x853f('0x11'),controller[_0x853f('0x12')]);router['put'](_0x853f('0x13'),auth[_0x853f('0xa')](),controller[_0x853f('0x14')]);router[_0x853f('0x15')](_0x853f('0x16'),auth[_0x853f('0xa')](),controller[_0x853f('0x17')]);router[_0x853f('0x15')](_0x853f('0x18'),auth[_0x853f('0xa')](),controller[_0x853f('0x19')]);router[_0x853f('0x1a')]('/:id',auth[_0x853f('0xa')](),controller[_0x853f('0x1b')]);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 0c2a19a..902a235 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 _0x864a=['BOOLEAN','STRING','sequelize','exports','TEXT','medium','out','DATE'];(function(_0x5c5409,_0x237ce5){var _0x29b7f1=function(_0x2407f8){while(--_0x2407f8){_0x5c5409['push'](_0x5c5409['shift']());}};_0x29b7f1(++_0x237ce5);}(_0x864a,0x8a));var _0xa864=function(_0x57b6e5,_0x5a8580){_0x57b6e5=_0x57b6e5-0x0;var _0x110145=_0x864a[_0x57b6e5];return _0x110145;};'use strict';var Sequelize=require(_0xa864('0x0'));module[_0xa864('0x1')]={'body':{'type':Sequelize[_0xa864('0x2')](_0xa864('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa864('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa864('0x5')]},'secret':{'type':Sequelize[_0xa864('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa864('0x7')]},'providerResponse':{'type':Sequelize[_0xa864('0x2')]}}; \ No newline at end of file +var _0x5a05=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x579fba,_0x470bcd){var _0x4540d3=function(_0x3ed69f){while(--_0x3ed69f){_0x579fba['push'](_0x579fba['shift']());}};_0x4540d3(++_0x470bcd);}(_0x5a05,0x93));var _0x55a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5a05[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x55a0('0x0'));module[_0x55a0('0x1')]={'body':{'type':Sequelize[_0x55a0('0x2')](_0x55a0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x55a0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x55a0('0x5')]('in',_0x55a0('0x6')),'defaultValue':_0x55a0('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x55a0('0x7')](0xbe)},'phone':{'type':Sequelize[_0x55a0('0x7')]},'readAt':{'type':Sequelize[_0x55a0('0x8')]},'secret':{'type':Sequelize[_0x55a0('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x55a0('0x7')]},'providerResponse':{'type':Sequelize[_0x55a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index cfc7e22..2194f26 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 _0xd4ad=['UserId','user','agent','get','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','channel','event','EventManager','acceptmessage','sms-interactions','reject','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','fullname','SIP/%s','motionChannel','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageUUID','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','client','request','info','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','stack','name','index','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SmsMessage','then','includeAll','include','findAll','rows','show','params','create','body','catch','find','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x236f3d,_0x74a251){var _0xc45c34=function(_0x1bd75b){while(--_0x1bd75b){_0x236f3d['push'](_0x236f3d['shift']());}};_0xc45c34(++_0x74a251);}(_0xd4ad,0x158));var _0xdd4a=function(_0x18fc78,_0x53d72b){_0x18fc78=_0x18fc78-0x0;var _0x23d2b4=_0xd4ad[_0x18fc78];return _0x23d2b4;};'use strict';var emlformat=require(_0xdd4a('0x0'));var rimraf=require(_0xdd4a('0x1'));var zipdir=require(_0xdd4a('0x2'));var jsonpatch=require(_0xdd4a('0x3'));var rp=require('request-promise');var moment=require(_0xdd4a('0x4'));var BPromise=require(_0xdd4a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdd4a('0x6'));var sox=require(_0xdd4a('0x7'));var csv=require('to-csv');var ejs=require(_0xdd4a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd4a('0x9'));var squel=require(_0xdd4a('0xa'));var crypto=require('crypto');var jsforce=require(_0xdd4a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd4a('0xc'));var querystring=require(_0xdd4a('0xd'));var Papa=require(_0xdd4a('0xe'));var Redis=require(_0xdd4a('0xf'));var authService=require(_0xdd4a('0x10'));var qs=require(_0xdd4a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd4a('0x12'))('api');var utils=require(_0xdd4a('0x13'));var config=require(_0xdd4a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd4a('0x15'))['db'];config[_0xdd4a('0x16')]=_['defaults'](config[_0xdd4a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd4a('0x17'))(new Redis(config['redis']));require(_0xdd4a('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdd4a('0x19')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2971b6,_0x898d87,_0xe41bc0,_0x2bdd14){return new BPromise(function(_0x37d755,_0x335bb6){var _0x154364=_0x2bdd14||client;return _0x154364[_0xdd4a('0x1a')](_0x2971b6,_0xe41bc0)['then'](function(_0x3c3fdd){logger[_0xdd4a('0x1b')]('SmsMessage,\x20%s,\x20%s',_0x898d87,_0xdd4a('0x1c'));logger[_0xdd4a('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x898d87,_0xdd4a('0x1c'),JSON[_0xdd4a('0x1e')](_0x3c3fdd));if(_0x3c3fdd[_0xdd4a('0x1f')]){if(_0x3c3fdd[_0xdd4a('0x1f')][_0xdd4a('0x20')]===0x1f4){logger[_0xdd4a('0x1f')](_0xdd4a('0x21'),_0x898d87,_0x3c3fdd['error']['message']);return _0x335bb6(_0x3c3fdd['error']['message']);}logger[_0xdd4a('0x1f')](_0xdd4a('0x21'),_0x898d87,_0x3c3fdd[_0xdd4a('0x1f')][_0xdd4a('0x22')]);return _0x37d755(_0x3c3fdd[_0xdd4a('0x1f')]['message']);}else{logger[_0xdd4a('0x1b')](_0xdd4a('0x21'),_0x898d87,_0xdd4a('0x1c'));_0x37d755(_0x3c3fdd[_0xdd4a('0x23')]['message']);}})['catch'](function(_0x5301ee){logger['error'](_0xdd4a('0x21'),_0x898d87,_0x5301ee);_0x335bb6(_0x5301ee);});});}function respondWithStatusCode(_0x516667,_0x537099){_0x537099=_0x537099||0xcc;return function(_0x26846d){if(_0x26846d){return _0x516667[_0xdd4a('0x24')](_0x537099);}return _0x516667[_0xdd4a('0x25')](_0x537099)[_0xdd4a('0x26')]();};}function respondWithResult(_0x6eaea3,_0x28e499){_0x28e499=_0x28e499||0xc8;return function(_0x4d2b89){if(_0x4d2b89){return _0x6eaea3[_0xdd4a('0x25')](_0x28e499)[_0xdd4a('0x27')](_0x4d2b89);}};}function respondWithFilteredResult(_0x540597,_0x10cf52){return function(_0x48cd1e){if(_0x48cd1e){var _0x5f1a9e=typeof _0x10cf52[_0xdd4a('0x28')]===_0xdd4a('0x29')&&typeof _0x10cf52[_0xdd4a('0x2a')]==='undefined';var _0x117d2a=_0x48cd1e[_0xdd4a('0x2b')];var _0x292d67=_0x5f1a9e?0x0:_0x10cf52['offset'];var _0x2b6d01=_0x5f1a9e?_0x48cd1e['count']:_0x10cf52[_0xdd4a('0x28')]+_0x10cf52[_0xdd4a('0x2a')];var _0x87a9a7;if(_0x2b6d01>=_0x117d2a){_0x2b6d01=_0x117d2a;_0x87a9a7=0xc8;}else{_0x87a9a7=0xce;}_0x540597['status'](_0x87a9a7);return _0x540597[_0xdd4a('0x2c')](_0xdd4a('0x2d'),_0x292d67+'-'+_0x2b6d01+'/'+_0x117d2a)['json'](_0x48cd1e);}return null;};}function patchUpdates(_0x40c826){return function(_0x456627){try{jsonpatch['apply'](_0x456627,_0x40c826,!![]);}catch(_0x17f253){return BPromise['reject'](_0x17f253);}return _0x456627[_0xdd4a('0x2e')]();};}function saveUpdates(_0x20c9d5,_0x122d4a){return function(_0x342182){if(_0x342182){return _0x342182[_0xdd4a('0x2f')](_0x20c9d5)['then'](function(_0x1bc986){return _0x1bc986;});}return null;};}function removeEntity(_0xff5437,_0x32abdd){return function(_0x18777b){if(_0x18777b){return _0x18777b[_0xdd4a('0x30')]()['then'](function(){_0xff5437['status'](0xcc)[_0xdd4a('0x26')]();});}};}function handleEntityNotFound(_0x19b9df,_0x50c38d){return function(_0x187660){if(!_0x187660){_0x19b9df['sendStatus'](0x194);}return _0x187660;};}function handleError(_0x1fd026,_0x14b9b0){_0x14b9b0=_0x14b9b0||0x1f4;return function(_0x52abd1){logger[_0xdd4a('0x1f')](_0x52abd1[_0xdd4a('0x31')]);if(_0x52abd1['name']){delete _0x52abd1[_0xdd4a('0x32')];}_0x1fd026['status'](_0x14b9b0)['send'](_0x52abd1);};}exports[_0xdd4a('0x33')]=function(_0x26cb9e,_0x1d4eed){var _0x441646={},_0x2b2cc6={},_0x72710b={'count':0x0,'rows':[]};var _0x3f676e=_['map'](db['SmsMessage'][_0xdd4a('0x34')],function(_0x2f4417){return{'name':_0x2f4417['fieldName'],'type':_0x2f4417[_0xdd4a('0x35')][_0xdd4a('0x36')]};});_0x2b2cc6[_0xdd4a('0x37')]=_[_0xdd4a('0x38')](_0x3f676e,'name');_0x2b2cc6['query']=_[_0xdd4a('0x39')](_0x26cb9e[_0xdd4a('0x3a')]);_0x2b2cc6[_0xdd4a('0x3b')]=_['intersection'](_0x2b2cc6[_0xdd4a('0x37')],_0x2b2cc6[_0xdd4a('0x3a')]);_0x441646[_0xdd4a('0x3c')]=_[_0xdd4a('0x3d')](_0x2b2cc6[_0xdd4a('0x37')],qs['fields'](_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x3e')]));_0x441646[_0xdd4a('0x3c')]=_0x441646[_0xdd4a('0x3c')][_0xdd4a('0x3f')]?_0x441646['attributes']:_0x2b2cc6[_0xdd4a('0x37')];if(!_0x26cb9e[_0xdd4a('0x3a')]['hasOwnProperty'](_0xdd4a('0x40'))){_0x441646[_0xdd4a('0x2a')]=qs[_0xdd4a('0x2a')](_0x26cb9e[_0xdd4a('0x3a')]['limit']);_0x441646['offset']=qs[_0xdd4a('0x28')](_0x26cb9e['query'][_0xdd4a('0x28')]);}_0x441646[_0xdd4a('0x41')]=qs[_0xdd4a('0x42')](_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x42')]);_0x441646[_0xdd4a('0x43')]=qs[_0xdd4a('0x3b')](_['pick'](_0x26cb9e[_0xdd4a('0x3a')],_0x2b2cc6[_0xdd4a('0x3b')]),_0x3f676e);if(_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x44')]){_0x441646[_0xdd4a('0x43')]=_['merge'](_0x441646[_0xdd4a('0x43')],{'$or':_[_0xdd4a('0x38')](_0x3f676e,function(_0x3572fb){if(_0x3572fb[_0xdd4a('0x35')]!==_0xdd4a('0x45')){var _0x235f1b={};_0x235f1b[_0x3572fb[_0xdd4a('0x32')]]={'$like':'%'+_0x26cb9e[_0xdd4a('0x3a')][_0xdd4a('0x44')]+'%'};return _0x235f1b;}})});}_0x441646=_[_0xdd4a('0x46')]({},_0x441646,_0x26cb9e[_0xdd4a('0x47')]);var _0x2e1544={'where':_0x441646[_0xdd4a('0x43')]};return db[_0xdd4a('0x48')][_0xdd4a('0x2b')](_0x2e1544)[_0xdd4a('0x49')](function(_0x583cfb){_0x72710b[_0xdd4a('0x2b')]=_0x583cfb;if(_0x26cb9e['query'][_0xdd4a('0x4a')]){_0x441646[_0xdd4a('0x4b')]=[{'all':!![]}];}return db[_0xdd4a('0x48')][_0xdd4a('0x4c')](_0x441646);})[_0xdd4a('0x49')](function(_0x543b31){_0x72710b[_0xdd4a('0x4d')]=_0x543b31;return _0x72710b;})['then'](respondWithFilteredResult(_0x1d4eed,_0x441646))['catch'](handleError(_0x1d4eed,null));};exports[_0xdd4a('0x4e')]=function(_0x24da0c,_0x1df8ee){var _0x5ef072={'raw':!![],'where':{'id':_0x24da0c[_0xdd4a('0x4f')]['id']}},_0x36d033={};_0x36d033['model']=_[_0xdd4a('0x39')](db[_0xdd4a('0x48')]['rawAttributes']);_0x36d033[_0xdd4a('0x3a')]=_[_0xdd4a('0x39')](_0x24da0c['query']);_0x36d033[_0xdd4a('0x3b')]=_[_0xdd4a('0x3d')](_0x36d033['model'],_0x36d033[_0xdd4a('0x3a')]);_0x5ef072[_0xdd4a('0x3c')]=_[_0xdd4a('0x3d')](_0x36d033[_0xdd4a('0x37')],qs[_0xdd4a('0x3e')](_0x24da0c['query']['fields']));_0x5ef072[_0xdd4a('0x3c')]=_0x5ef072[_0xdd4a('0x3c')][_0xdd4a('0x3f')]?_0x5ef072[_0xdd4a('0x3c')]:_0x36d033[_0xdd4a('0x37')];if(_0x24da0c['query'][_0xdd4a('0x4a')]){_0x5ef072[_0xdd4a('0x4b')]=[{'all':!![]}];}_0x5ef072=_[_0xdd4a('0x46')]({},_0x5ef072,_0x24da0c[_0xdd4a('0x47')]);return db[_0xdd4a('0x48')]['find'](_0x5ef072)['then'](handleEntityNotFound(_0x1df8ee,null))[_0xdd4a('0x49')](respondWithResult(_0x1df8ee,null))['catch'](handleError(_0x1df8ee,null));};exports[_0xdd4a('0x50')]=function(_0x303f3b,_0xc5b22){return db[_0xdd4a('0x48')][_0xdd4a('0x50')](_0x303f3b[_0xdd4a('0x51')],{})['then'](respondWithResult(_0xc5b22,0xc9))[_0xdd4a('0x52')](handleError(_0xc5b22,null));};exports[_0xdd4a('0x2f')]=function(_0xa71a66,_0x5f097e){if(_0xa71a66[_0xdd4a('0x51')]['id']){delete _0xa71a66['body']['id'];}return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0xa71a66['params']['id']}})['then'](handleEntityNotFound(_0x5f097e,null))[_0xdd4a('0x49')](saveUpdates(_0xa71a66[_0xdd4a('0x51')],null))[_0xdd4a('0x49')](respondWithResult(_0x5f097e,null))['catch'](handleError(_0x5f097e,null));};exports[_0xdd4a('0x30')]=function(_0x419c1f,_0x5dcfe1){return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x419c1f[_0xdd4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5dcfe1,null))['then'](removeEntity(_0x5dcfe1,null))[_0xdd4a('0x52')](handleError(_0x5dcfe1,null));};exports[_0xdd4a('0x54')]=function(_0x2cdcff,_0x36a6d3){return db[_0xdd4a('0x48')][_0xdd4a('0x54')]()['then'](respondWithResult(_0x36a6d3,null))[_0xdd4a('0x52')](handleError(_0x36a6d3,null));};var interaction_log=require(_0xdd4a('0x12'))('sms-interactions');exports[_0xdd4a('0x55')]=function(_0x5040b4,_0x342d4f,_0x14fbb9){var _0x371ca3={'agent':{},'channel':_0xdd4a('0x56')};if(_0x5040b4[_0xdd4a('0x51')]['id']){delete _0x5040b4[_0xdd4a('0x51')]['id'];}_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x57')]=!![];_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x58')]=moment()[_0xdd4a('0x59')](_0xdd4a('0x5a'));_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x5b')]=_0x5040b4['body'][_0xdd4a('0x5b')]||_0x5040b4[_0xdd4a('0x5c')]['id'];_0x371ca3[_0xdd4a('0x5d')]['id']=_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x5b')];return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x5040b4[_0xdd4a('0x4f')]['id'],'UserId':null}})[_0xdd4a('0x49')](handleEntityNotFound(_0x342d4f,null))[_0xdd4a('0x49')](saveUpdates(_0x5040b4[_0xdd4a('0x51')],null))['then'](function(_0x12a3d3){if(_0x12a3d3){_0x371ca3[_0xdd4a('0x22')]=_0x12a3d3[_0xdd4a('0x5e')]({'plain':!![]});return db['SmsInteraction'][_0xdd4a('0x53')]({'where':{'id':_0x12a3d3['SmsInteractionId']}});}return null;})[_0xdd4a('0x49')](handleEntityNotFound(_0x342d4f,null))['then'](function(_0x549933){if(_0x549933){return _0x549933[_0xdd4a('0x2f')]({'UserId':_0x5040b4[_0xdd4a('0x51')]['UserId'],'read1stAt':_[_0xdd4a('0x5f')](_0x549933[_0xdd4a('0x60')])?moment()[_0xdd4a('0x59')](_0xdd4a('0x5a')):undefined});}return null;})[_0xdd4a('0x49')](function(_0x52136f){if(_0x52136f){_0x371ca3['interaction']=_0x52136f[_0xdd4a('0x5e')]({'plain':!![]});interaction_log[_0xdd4a('0x1b')](_0xdd4a('0x61'),_0x5040b4[_0xdd4a('0x5c')]['id'],_0x5040b4[_0xdd4a('0x5c')]['name'],_0x5040b4[_0xdd4a('0x5c')][_0xdd4a('0x62')],_0x371ca3[_0xdd4a('0x63')]['id'],_0x5040b4[_0xdd4a('0x51')]?JSON[_0xdd4a('0x1e')](_0x5040b4['body']):_0xdd4a('0x64'));return respondWithRpcPromise(_0xdd4a('0x65'),_0xdd4a('0x66'),_0x371ca3);}return null;})[_0xdd4a('0x49')](function(_0x17ffb2){var _0x1a96f2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x17ffb2[_0xdd4a('0x22')]['ContactId'];return db[_0xdd4a('0x67')][_0xdd4a('0x3a')](_0x1a96f2,{'type':db['Sequelize'][_0xdd4a('0x68')][_0xdd4a('0x69')],'raw':!![]})[_0xdd4a('0x49')](function(_0x52ea04){return _0x52ea04;});})[_0xdd4a('0x49')](function(_0x4b5202){if(_0x4b5202){_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x6a')]=_0x4b5202[0x0];if(!_0x5040b4['body'][_0xdd4a('0x5b')])return;return db[_0xdd4a('0x6b')]['find']({'where':{'id':_0x5040b4[_0xdd4a('0x51')][_0xdd4a('0x5b')],'role':'agent'},'attributes':['id',_0xdd4a('0x32'),'fullname',_0xdd4a('0x6c'),_0xdd4a('0x6d')],'raw':!![]});}return null;})[_0xdd4a('0x49')](function(_0x31ee1e){if(!_0x31ee1e)return null;_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x5d')]=_0x31ee1e;return _0x371ca3;})[_0xdd4a('0x49')](function(_0x7e6e50){if(_0x7e6e50){if(_0x5040b4['body'][_0xdd4a('0x6e')]){_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x6f')]=util['format']('SIP/%s',_0x5040b4[_0xdd4a('0x5c')][_0xdd4a('0x32')]);_0x371ca3[_0xdd4a('0x22')]['channel']=_0x371ca3['channel'];_0x371ca3[_0xdd4a('0x22')]['motionChannel']=_0x371ca3[_0xdd4a('0x70')];_0x371ca3[_0xdd4a('0x22')][_0xdd4a('0x71')]=_0xdd4a('0x55');return respondWithRpcPromise(_0xdd4a('0x72'),'EventManager',{'event':_0xdd4a('0x73'),'message':_0x371ca3[_0xdd4a('0x22')]},client9002)['then'](function(){return _0x371ca3;});}return _0x371ca3;}return null;})['then'](respondWithResult(_0x342d4f,null))['catch'](handleError(_0x342d4f,null));};var interaction_log=require(_0xdd4a('0x12'))(_0xdd4a('0x74'));exports[_0xdd4a('0x75')]=function(_0x51d996,_0x2715e0,_0x1a1e12){var _0x23ffe7={'agent':{},'channel':'sms'};if(_0x51d996[_0xdd4a('0x51')]['id']){delete _0x51d996[_0xdd4a('0x51')]['id'];}_0x51d996[_0xdd4a('0x51')][_0xdd4a('0x5b')]=_0x51d996[_0xdd4a('0x51')][_0xdd4a('0x5b')]||_0x51d996['user']['id'];_0x23ffe7['agent']['id']=_0x51d996[_0xdd4a('0x51')][_0xdd4a('0x5b')];return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x51d996[_0xdd4a('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2715e0,null))[_0xdd4a('0x49')](function(_0xb957be){if(_0xb957be){_0x23ffe7[_0xdd4a('0x22')]=_0xb957be[_0xdd4a('0x5e')]({'plain':!![]});return db[_0xdd4a('0x76')][_0xdd4a('0x53')]({'where':{'id':_0xb957be[_0xdd4a('0x77')]}});}return null;})[_0xdd4a('0x49')](handleEntityNotFound(_0x2715e0,null))[_0xdd4a('0x49')](function(_0x2ece25){if(_0x2ece25){_0x23ffe7[_0xdd4a('0x63')]=_0x2ece25[_0xdd4a('0x5e')]({'plain':!![]});interaction_log['info'](_0xdd4a('0x78'),_0x51d996[_0xdd4a('0x5c')]['id'],_0x51d996[_0xdd4a('0x5c')][_0xdd4a('0x32')],_0x51d996[_0xdd4a('0x5c')][_0xdd4a('0x62')],_0x23ffe7[_0xdd4a('0x63')]['id'],_0x51d996[_0xdd4a('0x51')]?JSON['stringify'](_0x51d996['body']):_0xdd4a('0x64'));return respondWithRpcPromise(_0xdd4a('0x79'),_0xdd4a('0x7a'),_0x23ffe7);}return null;})[_0xdd4a('0x49')](function(_0x1bca5f){var _0x61e573=_0xdd4a('0x7b')+_0x1bca5f['message'][_0xdd4a('0x7c')];return db[_0xdd4a('0x67')][_0xdd4a('0x3a')](_0x61e573,{'type':db[_0xdd4a('0x7d')][_0xdd4a('0x68')]['SELECT'],'raw':!![]})[_0xdd4a('0x49')](function(_0x4a29da){return _0x4a29da;});})[_0xdd4a('0x49')](function(_0x471d4f){if(_0x471d4f){_0x23ffe7[_0xdd4a('0x22')]['contact']=_0x471d4f[0x0];if(!_0x51d996['body']['UserId'])return;return db[_0xdd4a('0x6b')][_0xdd4a('0x53')]({'where':{'id':_0x51d996[_0xdd4a('0x51')]['UserId'],'role':_0xdd4a('0x5d')},'attributes':['id','name',_0xdd4a('0x7e'),'email',_0xdd4a('0x6d')],'raw':!![]});}return null;})[_0xdd4a('0x49')](function(_0x10097f){if(!_0x10097f)return null;_0x23ffe7[_0xdd4a('0x22')][_0xdd4a('0x5d')]=_0x10097f;return _0x23ffe7;})[_0xdd4a('0x49')](function(_0x147732){if(_0x147732){_0x147732[_0xdd4a('0x22')][_0xdd4a('0x6f')]=util[_0xdd4a('0x59')](_0xdd4a('0x7f'),_0x51d996['user']['name']);_0x147732['message'][_0xdd4a('0x70')]=_0x23ffe7[_0xdd4a('0x70')];_0x147732[_0xdd4a('0x22')][_0xdd4a('0x80')]=_0x23ffe7[_0xdd4a('0x70')];_0x147732[_0xdd4a('0x22')]['event']=_0xdd4a('0x75');respondWithRpcPromise(_0xdd4a('0x72'),'EventManager',{'event':_0xdd4a('0x81'),'message':_0x147732[_0xdd4a('0x22')]},client9002);return _0x23ffe7;}return null;})['then'](respondWithResult(_0x2715e0,null))[_0xdd4a('0x52')](handleError(_0x2715e0,null));};exports[_0xdd4a('0x25')]=function(_0x1fba0e,_0x2f86dd,_0x530eab){if(_0x1fba0e[_0xdd4a('0x51')]['id']){delete _0x1fba0e[_0xdd4a('0x51')]['id'];}var _0x326df2;return db[_0xdd4a('0x48')][_0xdd4a('0x53')]({'where':{'id':_0x1fba0e[_0xdd4a('0x4f')]['id']}})[_0xdd4a('0x49')](handleEntityNotFound(_0x2f86dd,null))[_0xdd4a('0x49')](function(_0x5acb5b){if(_0x5acb5b){_0x326df2=_0x5acb5b;return db['SmsAccount'][_0xdd4a('0x53')]({'where':{'id':_0x5acb5b[_0xdd4a('0x82')]}});}})[_0xdd4a('0x49')](handleEntityNotFound(_0x2f86dd,null))[_0xdd4a('0x49')](function(_0x2f5e23){if(_0x2f5e23){logger[_0xdd4a('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdd4a('0x25'),_0xdd4a('0x83'),_0x2f5e23[_0xdd4a('0x35')],util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));switch(_0x2f5e23[_0xdd4a('0x35')]){case _0xdd4a('0x85'):if(_0x1fba0e['body'][_0xdd4a('0x86')]&&_0x1fba0e[_0xdd4a('0x51')][_0xdd4a('0x86')]===_0x326df2[_0xdd4a('0x87')]){return _0x326df2[_0xdd4a('0x2f')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdd4a('0x25'),_0xdd4a('0x85'),util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x1fba0e[_0xdd4a('0x51')][_0xdd4a('0x88')]&&_0x1fba0e[_0xdd4a('0x51')][_0xdd4a('0x88')]===_0x326df2[_0xdd4a('0x87')]&&_['indexOf']([_0xdd4a('0x89'),_0xdd4a('0x8a')],_0x1fba0e[_0xdd4a('0x51')]['Status'])>=0x0){return _0x326df2['update']({'read':!![]});}else{logger[_0xdd4a('0x1f')](_0xdd4a('0x8b'),'status',_0xdd4a('0x8c'),util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));}break;case _0xdd4a('0x8d'):var _0x21db59=_0x1fba0e['body'][_0xdd4a('0x8e')][0x0];if(_0x21db59['status'][_0xdd4a('0x8f')]===_0xdd4a('0x90')){return _0x326df2[_0xdd4a('0x2f')]({'read':!![]});}else{logger['error'](_0xdd4a('0x8b'),_0xdd4a('0x25'),_0xdd4a('0x8d'),util[_0xdd4a('0x84')](_0x1fba0e[_0xdd4a('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x326df2;}})[_0xdd4a('0x49')](respondWithResult(_0x2f86dd,null))['catch'](handleError(_0x2f86dd,null));}; \ No newline at end of file +var _0x61d0=['message','result','end','json','offset','undefined','limit','count','status','Content-Range','save','update','destroy','sendStatus','name','send','map','SmsMessage','rawAttributes','fieldName','key','filters','intersection','query','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','SmsInteraction','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SIP/%s','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio','results','groupName','DELIVERED','infobip','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x61d0,0x187));var _0x061d=function(_0x1460ab,_0x74d06e){_0x1460ab=_0x1460ab-0x0;var _0x1eeb5c=_0x61d0[_0x1460ab];return _0x1eeb5c;};'use strict';var emlformat=require(_0x061d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x061d('0x1'));var jsonpatch=require(_0x061d('0x2'));var rp=require('request-promise');var moment=require(_0x061d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x061d('0x4'));var util=require(_0x061d('0x5'));var path=require('path');var sox=require(_0x061d('0x6'));var csv=require(_0x061d('0x7'));var ejs=require(_0x061d('0x8'));var fs=require('fs');var fs_extra=require(_0x061d('0x9'));var _=require(_0x061d('0xa'));var squel=require(_0x061d('0xb'));var crypto=require(_0x061d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x061d('0xd'));var Papa=require('papaparse');var Redis=require(_0x061d('0xe'));var authService=require(_0x061d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x061d('0x10'));var hardwareService=require(_0x061d('0x11'));var logger=require(_0x061d('0x12'))(_0x061d('0x13'));var utils=require(_0x061d('0x14'));var config=require(_0x061d('0x15'));var licenseUtil=require(_0x061d('0x16'));var db=require('../../mysqldb')['db'];config[_0x061d('0x17')]=_[_0x061d('0x18')](config[_0x061d('0x17')],{'host':_0x061d('0x19'),'port':0x18eb});var socket=require(_0x061d('0x1a'))(new Redis(config[_0x061d('0x17')]));require(_0x061d('0x1b'))[_0x061d('0x1c')](socket);var jayson=require(_0x061d('0x1d'));var client=jayson[_0x061d('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x061d('0x1e')][_0x061d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x457423,_0x4f926b,_0x28a1db,_0x4fda9e){return new BPromise(function(_0x571fa8,_0x2195fe){var _0x25f253=_0x4fda9e||client;return _0x25f253[_0x061d('0x20')](_0x457423,_0x28a1db)[_0x061d('0x21')](function(_0x5d2472){logger[_0x061d('0x22')](_0x061d('0x23'),_0x4f926b,_0x061d('0x24'));logger['debug'](_0x061d('0x25'),_0x4f926b,_0x061d('0x24'),JSON[_0x061d('0x26')](_0x5d2472));if(_0x5d2472[_0x061d('0x27')]){if(_0x5d2472['error'][_0x061d('0x28')]===0x1f4){logger[_0x061d('0x27')]('SmsMessage,\x20%s,\x20%s',_0x4f926b,_0x5d2472[_0x061d('0x27')][_0x061d('0x29')]);return _0x2195fe(_0x5d2472[_0x061d('0x27')][_0x061d('0x29')]);}logger[_0x061d('0x27')](_0x061d('0x23'),_0x4f926b,_0x5d2472[_0x061d('0x27')][_0x061d('0x29')]);return _0x571fa8(_0x5d2472['error'][_0x061d('0x29')]);}else{logger[_0x061d('0x22')]('SmsMessage,\x20%s,\x20%s',_0x4f926b,_0x061d('0x24'));_0x571fa8(_0x5d2472[_0x061d('0x2a')]['message']);}})['catch'](function(_0x300b39){logger[_0x061d('0x27')](_0x061d('0x23'),_0x4f926b,_0x300b39);_0x2195fe(_0x300b39);});});}function respondWithStatusCode(_0x2bace6,_0x267049){_0x267049=_0x267049||0xcc;return function(_0x41e3db){if(_0x41e3db){return _0x2bace6['sendStatus'](_0x267049);}return _0x2bace6['status'](_0x267049)[_0x061d('0x2b')]();};}function respondWithResult(_0x16f1db,_0x5be49a){_0x5be49a=_0x5be49a||0xc8;return function(_0x159c9d){if(_0x159c9d){return _0x16f1db['status'](_0x5be49a)[_0x061d('0x2c')](_0x159c9d);}};}function respondWithFilteredResult(_0x1d3d76,_0x2179d5){return function(_0x366188){if(_0x366188){var _0xc8f0cd=typeof _0x2179d5[_0x061d('0x2d')]===_0x061d('0x2e')&&typeof _0x2179d5[_0x061d('0x2f')]===_0x061d('0x2e');var _0x16f00c=_0x366188[_0x061d('0x30')];var _0xbf9d7b=_0xc8f0cd?0x0:_0x2179d5['offset'];var _0x17fd4a=_0xc8f0cd?_0x366188[_0x061d('0x30')]:_0x2179d5[_0x061d('0x2d')]+_0x2179d5[_0x061d('0x2f')];var _0x545d34;if(_0x17fd4a>=_0x16f00c){_0x17fd4a=_0x16f00c;_0x545d34=0xc8;}else{_0x545d34=0xce;}_0x1d3d76[_0x061d('0x31')](_0x545d34);return _0x1d3d76['set'](_0x061d('0x32'),_0xbf9d7b+'-'+_0x17fd4a+'/'+_0x16f00c)['json'](_0x366188);}return null;};}function patchUpdates(_0x3af042){return function(_0x3c00c0){try{jsonpatch['apply'](_0x3c00c0,_0x3af042,!![]);}catch(_0x3b32e0){return BPromise['reject'](_0x3b32e0);}return _0x3c00c0[_0x061d('0x33')]();};}function saveUpdates(_0x3376fe,_0x3f7f97){return function(_0xb09b02){if(_0xb09b02){return _0xb09b02[_0x061d('0x34')](_0x3376fe)['then'](function(_0x3d990c){return _0x3d990c;});}return null;};}function removeEntity(_0x157d64,_0x2cc972){return function(_0x25e14a){if(_0x25e14a){return _0x25e14a[_0x061d('0x35')]()[_0x061d('0x21')](function(){_0x157d64[_0x061d('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e79d7,_0xcf4749){return function(_0x4ebdb6){if(!_0x4ebdb6){_0x3e79d7[_0x061d('0x36')](0x194);}return _0x4ebdb6;};}function handleError(_0x4b7357,_0x3c85c5){_0x3c85c5=_0x3c85c5||0x1f4;return function(_0xf0cc3f){logger[_0x061d('0x27')](_0xf0cc3f['stack']);if(_0xf0cc3f[_0x061d('0x37')]){delete _0xf0cc3f[_0x061d('0x37')];}_0x4b7357[_0x061d('0x31')](_0x3c85c5)[_0x061d('0x38')](_0xf0cc3f);};}exports['index']=function(_0xdfcee7,_0x4426d3){var _0x461c55={},_0x197044={},_0x281c7a={'count':0x0,'rows':[]};var _0x32e81d=_[_0x061d('0x39')](db[_0x061d('0x3a')][_0x061d('0x3b')],function(_0x54d639){return{'name':_0x54d639[_0x061d('0x3c')],'type':_0x54d639['type'][_0x061d('0x3d')]};});_0x197044['model']=_[_0x061d('0x39')](_0x32e81d,_0x061d('0x37'));_0x197044['query']=_['keys'](_0xdfcee7['query']);_0x197044[_0x061d('0x3e')]=_[_0x061d('0x3f')](_0x197044['model'],_0x197044[_0x061d('0x40')]);_0x461c55[_0x061d('0x41')]=_[_0x061d('0x3f')](_0x197044[_0x061d('0x42')],qs[_0x061d('0x43')](_0xdfcee7[_0x061d('0x40')][_0x061d('0x43')]));_0x461c55[_0x061d('0x41')]=_0x461c55[_0x061d('0x41')]['length']?_0x461c55[_0x061d('0x41')]:_0x197044['model'];if(!_0xdfcee7[_0x061d('0x40')][_0x061d('0x44')](_0x061d('0x45'))){_0x461c55['limit']=qs[_0x061d('0x2f')](_0xdfcee7[_0x061d('0x40')][_0x061d('0x2f')]);_0x461c55['offset']=qs[_0x061d('0x2d')](_0xdfcee7[_0x061d('0x40')][_0x061d('0x2d')]);}_0x461c55[_0x061d('0x46')]=qs[_0x061d('0x47')](_0xdfcee7[_0x061d('0x40')][_0x061d('0x47')]);_0x461c55[_0x061d('0x48')]=qs[_0x061d('0x3e')](_[_0x061d('0x49')](_0xdfcee7[_0x061d('0x40')],_0x197044[_0x061d('0x3e')]),_0x32e81d);if(_0xdfcee7[_0x061d('0x40')]['filter']){_0x461c55['where']=_[_0x061d('0x4a')](_0x461c55['where'],{'$or':_[_0x061d('0x39')](_0x32e81d,function(_0x20453b){if(_0x20453b[_0x061d('0x4b')]!==_0x061d('0x4c')){var _0x240e0c={};_0x240e0c[_0x20453b[_0x061d('0x37')]]={'$like':'%'+_0xdfcee7[_0x061d('0x40')][_0x061d('0x4d')]+'%'};return _0x240e0c;}})});}_0x461c55=_[_0x061d('0x4a')]({},_0x461c55,_0xdfcee7['options']);var _0x5ee577={'where':_0x461c55['where']};return db[_0x061d('0x3a')][_0x061d('0x30')](_0x5ee577)[_0x061d('0x21')](function(_0x1818f4){_0x281c7a[_0x061d('0x30')]=_0x1818f4;if(_0xdfcee7[_0x061d('0x40')][_0x061d('0x4e')]){_0x461c55[_0x061d('0x4f')]=[{'all':!![]}];}return db['SmsMessage'][_0x061d('0x50')](_0x461c55);})['then'](function(_0x99924e){_0x281c7a[_0x061d('0x51')]=_0x99924e;return _0x281c7a;})[_0x061d('0x21')](respondWithFilteredResult(_0x4426d3,_0x461c55))[_0x061d('0x52')](handleError(_0x4426d3,null));};exports[_0x061d('0x53')]=function(_0x3e8551,_0x2c0d96){var _0x1f2423={'raw':!![],'where':{'id':_0x3e8551[_0x061d('0x54')]['id']}},_0x19c935={};_0x19c935['model']=_['keys'](db[_0x061d('0x3a')][_0x061d('0x3b')]);_0x19c935[_0x061d('0x40')]=_['keys'](_0x3e8551['query']);_0x19c935[_0x061d('0x3e')]=_[_0x061d('0x3f')](_0x19c935[_0x061d('0x42')],_0x19c935[_0x061d('0x40')]);_0x1f2423['attributes']=_['intersection'](_0x19c935[_0x061d('0x42')],qs[_0x061d('0x43')](_0x3e8551[_0x061d('0x40')][_0x061d('0x43')]));_0x1f2423[_0x061d('0x41')]=_0x1f2423['attributes']['length']?_0x1f2423['attributes']:_0x19c935['model'];if(_0x3e8551[_0x061d('0x40')][_0x061d('0x4e')]){_0x1f2423[_0x061d('0x4f')]=[{'all':!![]}];}_0x1f2423=_[_0x061d('0x4a')]({},_0x1f2423,_0x3e8551[_0x061d('0x55')]);return db[_0x061d('0x3a')][_0x061d('0x56')](_0x1f2423)['then'](handleEntityNotFound(_0x2c0d96,null))[_0x061d('0x21')](respondWithResult(_0x2c0d96,null))[_0x061d('0x52')](handleError(_0x2c0d96,null));};exports[_0x061d('0x57')]=function(_0x13b1cd,_0x372491){return db[_0x061d('0x3a')]['create'](_0x13b1cd[_0x061d('0x58')],{})[_0x061d('0x21')](respondWithResult(_0x372491,0xc9))[_0x061d('0x52')](handleError(_0x372491,null));};exports[_0x061d('0x34')]=function(_0x5de628,_0x141b62){if(_0x5de628['body']['id']){delete _0x5de628[_0x061d('0x58')]['id'];}return db[_0x061d('0x3a')][_0x061d('0x56')]({'where':{'id':_0x5de628['params']['id']}})[_0x061d('0x21')](handleEntityNotFound(_0x141b62,null))['then'](saveUpdates(_0x5de628[_0x061d('0x58')],null))[_0x061d('0x21')](respondWithResult(_0x141b62,null))[_0x061d('0x52')](handleError(_0x141b62,null));};exports[_0x061d('0x35')]=function(_0x2665b8,_0x41a215){return db[_0x061d('0x3a')][_0x061d('0x56')]({'where':{'id':_0x2665b8['params']['id']}})['then'](handleEntityNotFound(_0x41a215,null))[_0x061d('0x21')](removeEntity(_0x41a215,null))[_0x061d('0x52')](handleError(_0x41a215,null));};exports[_0x061d('0x59')]=function(_0x2b06b2,_0x3126c6){return db[_0x061d('0x3a')]['describe']()[_0x061d('0x21')](respondWithResult(_0x3126c6,null))[_0x061d('0x52')](handleError(_0x3126c6,null));};var interaction_log=require('../../config/logger')(_0x061d('0x5a'));exports[_0x061d('0x5b')]=function(_0x512f67,_0x2d2067,_0x2f357d){var _0x18bd07={'agent':{},'channel':_0x061d('0x5c')};if(_0x512f67['body']['id']){delete _0x512f67[_0x061d('0x58')]['id'];}_0x512f67[_0x061d('0x58')][_0x061d('0x5d')]=!![];_0x512f67['body']['readAt']=moment()[_0x061d('0x5e')](_0x061d('0x5f'));_0x512f67[_0x061d('0x58')][_0x061d('0x60')]=_0x512f67[_0x061d('0x58')][_0x061d('0x60')]||_0x512f67[_0x061d('0x61')]['id'];_0x18bd07[_0x061d('0x62')]['id']=_0x512f67[_0x061d('0x58')][_0x061d('0x60')];return db[_0x061d('0x3a')]['find']({'where':{'id':_0x512f67['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d2067,null))['then'](saveUpdates(_0x512f67[_0x061d('0x58')],null))[_0x061d('0x21')](function(_0x485a57){if(_0x485a57){_0x18bd07[_0x061d('0x29')]=_0x485a57[_0x061d('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x061d('0x56')]({'where':{'id':_0x485a57[_0x061d('0x64')]}});}return null;})[_0x061d('0x21')](handleEntityNotFound(_0x2d2067,null))[_0x061d('0x21')](function(_0x27de9b){if(_0x27de9b){return _0x27de9b['update']({'UserId':_0x512f67[_0x061d('0x58')][_0x061d('0x60')],'read1stAt':_['isNil'](_0x27de9b[_0x061d('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x061d('0x21')](function(_0x4ae03d){if(_0x4ae03d){_0x18bd07[_0x061d('0x66')]=_0x4ae03d[_0x061d('0x63')]({'plain':!![]});interaction_log[_0x061d('0x22')](_0x061d('0x67'),_0x512f67[_0x061d('0x61')]['id'],_0x512f67[_0x061d('0x61')][_0x061d('0x37')],_0x512f67['user'][_0x061d('0x68')],_0x18bd07[_0x061d('0x66')]['id'],_0x512f67['body']?JSON[_0x061d('0x26')](_0x512f67['body']):'null');return respondWithRpcPromise(_0x061d('0x69'),'acceptMessage',_0x18bd07);}return null;})['then'](function(_0x24d5c9){var _0x4cff59='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x24d5c9[_0x061d('0x29')][_0x061d('0x6a')];return db['sequelize'][_0x061d('0x40')](_0x4cff59,{'type':db[_0x061d('0x6b')]['QueryTypes'][_0x061d('0x6c')],'raw':!![]})['then'](function(_0x324bdf){return _0x324bdf;});})['then'](function(_0x494ed4){if(_0x494ed4){_0x18bd07[_0x061d('0x29')][_0x061d('0x6d')]=_0x494ed4[0x0];if(!_0x512f67[_0x061d('0x58')][_0x061d('0x60')])return;return db[_0x061d('0x6e')][_0x061d('0x56')]({'where':{'id':_0x512f67[_0x061d('0x58')][_0x061d('0x60')],'role':_0x061d('0x62')},'attributes':['id',_0x061d('0x37'),_0x061d('0x6f'),_0x061d('0x70'),_0x061d('0x71')],'raw':!![]});}return null;})[_0x061d('0x21')](function(_0x4148d7){if(!_0x4148d7)return null;_0x18bd07[_0x061d('0x29')][_0x061d('0x62')]=_0x4148d7;return _0x18bd07;})[_0x061d('0x21')](function(_0x59fac8){if(_0x59fac8){if(_0x512f67[_0x061d('0x58')][_0x061d('0x72')]){_0x18bd07[_0x061d('0x29')][_0x061d('0x73')]=util[_0x061d('0x5e')]('SIP/%s',_0x512f67[_0x061d('0x61')]['name']);_0x18bd07['message']['channel']=_0x18bd07[_0x061d('0x74')];_0x18bd07['message'][_0x061d('0x75')]=_0x18bd07[_0x061d('0x74')];_0x18bd07[_0x061d('0x29')][_0x061d('0x76')]=_0x061d('0x5b');return respondWithRpcPromise(_0x061d('0x77'),'EventManager',{'event':_0x061d('0x78'),'message':_0x18bd07[_0x061d('0x29')]},client9002)[_0x061d('0x21')](function(){return _0x18bd07;});}return _0x18bd07;}return null;})[_0x061d('0x21')](respondWithResult(_0x2d2067,null))[_0x061d('0x52')](handleError(_0x2d2067,null));};var interaction_log=require('../../config/logger')(_0x061d('0x5a'));exports[_0x061d('0x79')]=function(_0x25aa82,_0x7f6a13,_0x38367c){var _0x3c867d={'agent':{},'channel':'sms'};if(_0x25aa82['body']['id']){delete _0x25aa82[_0x061d('0x58')]['id'];}_0x25aa82['body'][_0x061d('0x60')]=_0x25aa82[_0x061d('0x58')][_0x061d('0x60')]||_0x25aa82[_0x061d('0x61')]['id'];_0x3c867d[_0x061d('0x62')]['id']=_0x25aa82[_0x061d('0x58')]['UserId'];return db[_0x061d('0x3a')]['find']({'where':{'id':_0x25aa82[_0x061d('0x54')]['id'],'UserId':null}})[_0x061d('0x21')](handleEntityNotFound(_0x7f6a13,null))[_0x061d('0x21')](function(_0x31fe9a){if(_0x31fe9a){_0x3c867d[_0x061d('0x29')]=_0x31fe9a[_0x061d('0x63')]({'plain':!![]});return db[_0x061d('0x7a')][_0x061d('0x56')]({'where':{'id':_0x31fe9a['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x7f6a13,null))[_0x061d('0x21')](function(_0x580b83){if(_0x580b83){_0x3c867d[_0x061d('0x66')]=_0x580b83[_0x061d('0x63')]({'plain':!![]});interaction_log[_0x061d('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x25aa82[_0x061d('0x61')]['id'],_0x25aa82[_0x061d('0x61')]['name'],_0x25aa82[_0x061d('0x61')][_0x061d('0x68')],_0x3c867d[_0x061d('0x66')]['id'],_0x25aa82[_0x061d('0x58')]?JSON[_0x061d('0x26')](_0x25aa82[_0x061d('0x58')]):'null');return respondWithRpcPromise(_0x061d('0x7b'),'rejectMessage',_0x3c867d);}return null;})[_0x061d('0x21')](function(_0x219db3){var _0x22a9bc=_0x061d('0x7c')+_0x219db3['message'][_0x061d('0x6a')];return db['sequelize']['query'](_0x22a9bc,{'type':db['Sequelize'][_0x061d('0x7d')]['SELECT'],'raw':!![]})[_0x061d('0x21')](function(_0x349f88){return _0x349f88;});})[_0x061d('0x21')](function(_0x39dda7){if(_0x39dda7){_0x3c867d[_0x061d('0x29')][_0x061d('0x6d')]=_0x39dda7[0x0];if(!_0x25aa82[_0x061d('0x58')][_0x061d('0x60')])return;return db[_0x061d('0x6e')][_0x061d('0x56')]({'where':{'id':_0x25aa82[_0x061d('0x58')][_0x061d('0x60')],'role':_0x061d('0x62')},'attributes':['id',_0x061d('0x37'),_0x061d('0x6f'),_0x061d('0x70'),_0x061d('0x71')],'raw':!![]});}return null;})['then'](function(_0x5019f0){if(!_0x5019f0)return null;_0x3c867d['message']['agent']=_0x5019f0;return _0x3c867d;})['then'](function(_0x2896bb){if(_0x2896bb){_0x2896bb[_0x061d('0x29')][_0x061d('0x73')]=util[_0x061d('0x5e')](_0x061d('0x7e'),_0x25aa82[_0x061d('0x61')][_0x061d('0x37')]);_0x2896bb[_0x061d('0x29')][_0x061d('0x74')]=_0x3c867d[_0x061d('0x74')];_0x2896bb[_0x061d('0x29')][_0x061d('0x75')]=_0x3c867d['channel'];_0x2896bb[_0x061d('0x29')][_0x061d('0x76')]='reject';respondWithRpcPromise(_0x061d('0x77'),_0x061d('0x77'),{'event':_0x061d('0x7f'),'message':_0x2896bb['message']},client9002);return _0x3c867d;}return null;})[_0x061d('0x21')](respondWithResult(_0x7f6a13,null))[_0x061d('0x52')](handleError(_0x7f6a13,null));};exports['status']=function(_0xfdbd23,_0x2fcd92,_0x3f08ae){if(_0xfdbd23[_0x061d('0x58')]['id']){delete _0xfdbd23[_0x061d('0x58')]['id'];}var _0x368b67;return db[_0x061d('0x3a')][_0x061d('0x56')]({'where':{'id':_0xfdbd23['params']['id']}})[_0x061d('0x21')](handleEntityNotFound(_0x2fcd92,null))[_0x061d('0x21')](function(_0x368f55){if(_0x368f55){_0x368b67=_0x368f55;return db['SmsAccount'][_0x061d('0x56')]({'where':{'id':_0x368f55[_0x061d('0x80')]}});}})[_0x061d('0x21')](handleEntityNotFound(_0x2fcd92,null))[_0x061d('0x21')](function(_0x3151e8){if(_0x3151e8){logger['debug'](_0x061d('0x25'),_0x061d('0x31'),_0x061d('0x81'),_0x3151e8[_0x061d('0x4b')],util[_0x061d('0x82')](_0xfdbd23['body'],{'showHidden':![],'depth':null}));switch(_0x3151e8[_0x061d('0x4b')]){case _0x061d('0x83'):if(_0xfdbd23[_0x061d('0x58')][_0x061d('0x84')]&&_0xfdbd23[_0x061d('0x58')][_0x061d('0x84')]===_0x368b67['messageId']){return _0x368b67[_0x061d('0x34')]({'read':!![]});}else{logger[_0x061d('0x27')](_0x061d('0x85'),_0x061d('0x31'),'twilio',util[_0x061d('0x82')](_0xfdbd23[_0x061d('0x58')],{'showHidden':![],'depth':null}));}break;case _0x061d('0x86'):if(_0xfdbd23['body'][_0x061d('0x87')]&&_0xfdbd23[_0x061d('0x58')][_0x061d('0x87')]===_0x368b67['messageId']&&_[_0x061d('0x88')]([_0x061d('0x89'),_0x061d('0x8a')],_0xfdbd23[_0x061d('0x58')]['Status'])>=0x0){return _0x368b67[_0x061d('0x34')]({'read':!![]});}else{logger[_0x061d('0x27')](_0x061d('0x85'),_0x061d('0x31'),_0x061d('0x8b'),util['inspect'](_0xfdbd23[_0x061d('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x30772f=_0xfdbd23['body'][_0x061d('0x8c')][0x0];if(_0x30772f[_0x061d('0x31')][_0x061d('0x8d')]===_0x061d('0x8e')){return _0x368b67[_0x061d('0x34')]({'read':!![]});}else{logger[_0x061d('0x27')](_0x061d('0x85'),_0x061d('0x31'),_0x061d('0x8f'),util[_0x061d('0x82')](_0xfdbd23['body'],{'showHidden':![],'depth':null}));}break;}return _0x368b67;}})['then'](respondWithResult(_0x2fcd92,null))['catch'](handleError(_0x2fcd92,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index b6412ef..c6b4393 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 _0xea9b=['setMaxListeners','remove','emit','hasOwnProperty','hook','../../mysqldb','SmsMessage'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0xea9b,0x1e8));var _0xbea9=function(_0x4cb9aa,_0x58b44f){_0x4cb9aa=_0x4cb9aa-0x0;var _0x2eff51=_0xea9b[_0x4cb9aa];return _0x2eff51;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xbea9('0x0'))['db'][_0xbea9('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xbea9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbea9('0x3')};function emitEvent(_0x406f3e){return function(_0x3cb029,_0x54e166,_0x46f67b){SmsMessageEvents[_0xbea9('0x4')](_0x406f3e+':'+_0x3cb029['id'],_0x3cb029);SmsMessageEvents[_0xbea9('0x4')](_0x406f3e,_0x3cb029);_0x46f67b(null);};}for(var e in events){if(events[_0xbea9('0x5')](e)){var event=events[e];SmsMessage[_0xbea9('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x6142=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x233cb1,_0x8ca9a2){var _0x29ee7e=function(_0x20e277){while(--_0x20e277){_0x233cb1['push'](_0x233cb1['shift']());}};_0x29ee7e(++_0x8ca9a2);}(_0x6142,0x147));var _0x2614=function(_0x2c5435,_0x1bbff8){_0x2c5435=_0x2c5435-0x0;var _0x1f7ffe=_0x6142[_0x2c5435];return _0x1f7ffe;};'use strict';var EventEmitter=require(_0x2614('0x0'));var SmsMessage=require(_0x2614('0x1'))['db'][_0x2614('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2614('0x3'),'afterUpdate':_0x2614('0x4'),'afterDestroy':_0x2614('0x5')};function emitEvent(_0x47d24d){return function(_0x55922d,_0x39d9c8,_0x37e975){SmsMessageEvents[_0x2614('0x6')](_0x47d24d+':'+_0x55922d['id'],_0x55922d);SmsMessageEvents['emit'](_0x47d24d,_0x55922d);_0x37e975(null);};}for(var e in events){if(events[_0x2614('0x7')](e)){var event=events[e];SmsMessage[_0x2614('0x8')](e,emitEvent(event));}}module[_0x2614('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index b8cd504..6292f92 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 _0xea4f=['SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','sender','password','GET','split','sms','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','toString','http_code','data','head','message_id','clickSend','authId','/api/sms/messages/','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','timestamp','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','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','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','out'];(function(_0x3b3750,_0x28f3b8){var _0x1b9e8b=function(_0xaf75c3){while(--_0xaf75c3){_0x3b3750['push'](_0x3b3750['shift']());}};_0x1b9e8b(++_0x28f3b8);}(_0xea4f,0x1d0));var _0xfea4=function(_0x5d4a12,_0x5a335d){_0x5d4a12=_0x5d4a12-0x0;var _0x5a7d8f=_0xea4f[_0x5d4a12];return _0x5a7d8f;};'use strict';var _=require(_0xfea4('0x0'));var util=require('util');var logger=require(_0xfea4('0x1'))(_0xfea4('0x2'));var moment=require(_0xfea4('0x3'));var BPromise=require('bluebird');var rp=require(_0xfea4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfea4('0x5'));var attributes=require(_0xfea4('0x6'));module[_0xfea4('0x7')]=function(_0x1c2658,_0x56fa85){return _0x1c2658['define'](_0xfea4('0x8'),attributes,{'tableName':_0xfea4('0x9'),'paranoid':![],'indexes':[{'name':_0xfea4('0xa'),'fields':[_0xfea4('0xa')]},{'name':_0xfea4('0xb'),'fields':[_0xfea4('0xc')],'type':_0xfea4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x326f78,_0x4d1fc8,_0x5566c5){var _0x2c3b21=_0x1c2658[_0xfea4('0xe')];var _0x6e2065=_0x326f78['get']({'plain':!![]});if(_0x6e2065[_0xfea4('0xf')][_0xfea4('0x10')]()==='in'||_0x6e2065[_0xfea4('0xf')][_0xfea4('0x10')]()==='out'&&!_0x6e2065[_0xfea4('0x11')]&&!_[_0xfea4('0x12')](_0x6e2065['UserId'])&&!_[_0xfea4('0x12')](_0x6e2065[_0xfea4('0x13')])){_0x2c3b21[_0xfea4('0x14')][_0xfea4('0x15')]({'where':{'id':_0x6e2065[_0xfea4('0x13')]}})[_0xfea4('0x16')](function(_0x12fd27){if(_0x12fd27){_0x12fd27[_0xfea4('0x17')]({'lastMsgAt':_0x6e2065[_0xfea4('0x18')],'lastMsgDirection':_0x6e2065[_0xfea4('0xf')]['toLowerCase']()});}})[_0xfea4('0x19')](function(_0x3fe001){console[_0xfea4('0x1a')](_0x3fe001);});}if(_0x6e2065[_0xfea4('0xf')]===_0xfea4('0x1b')&&!_0x6e2065[_0xfea4('0x11')]){var _0x34d877;_0x2c3b21[_0xfea4('0x1c')][_0xfea4('0x1d')]({'where':{'id':_0x6e2065[_0xfea4('0x1e')]},'raw':!![]})[_0xfea4('0x16')](function(_0x102480){_0x34d877=_0x102480;if(_0x34d877&&_0x34d877[_0xfea4('0x1f')]){switch(_0x34d877[_0xfea4('0x1f')]){case _0xfea4('0x20'):var _0x1bd2ca=require(_0xfea4('0x20'));if(_0x34d877[_0xfea4('0x21')]&&_0x34d877[_0xfea4('0x22')]&&_0x34d877[_0xfea4('0x23')]){var _0x225b25=new _0x1bd2ca(_0x34d877['accountSid'],_0x34d877['authToken']);_0x225b25[_0xfea4('0x24')][_0xfea4('0x25')]({'body':_0x6e2065[_0xfea4('0xc')],'to':_0x6e2065[_0xfea4('0x23')],'from':_0x34d877[_0xfea4('0x23')],'statusCallback':_0x34d877[_0xfea4('0x26')]+'/api/sms/messages/'+_0x6e2065['id']+_0xfea4('0x27')+_0x34d877[_0xfea4('0x28')]})[_0xfea4('0x16')](function(_0x362413){if(_0x362413[_0xfea4('0x29')]){return _0x326f78[_0xfea4('0x17')]({'messageId':_0x362413['sid']});}})[_0xfea4('0x19')](function(_0x5189a2){logger['error'](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x20'),util['inspect'](_0x5189a2,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xfea4('0x2c'):var _0x1249a6=_0xfea4('0x2d');if(_0x34d877[_0xfea4('0x2e')]&&_0x34d877['password']){var _0x462da1={'recipient':[_0x6e2065['phone']],'message':_0x6e2065[_0xfea4('0xc')],'message_type':_0x34d877['smsMethod']};if(_0x34d877['smsMethod']&&_0x34d877['smsMethod']!=='SI'){_0x462da1[_0xfea4('0x2f')]=_0x34d877[_0xfea4('0x23')];}var _0x286f93={'url':_0x1249a6+'login?username='+_0x34d877[_0xfea4('0x2e')]+'&password='+_0x34d877[_0xfea4('0x30')],'method':_0xfea4('0x31')};rp(_0x286f93)[_0xfea4('0x16')](function(_0x559e91){var _0x559f1d=_0x559e91[_0xfea4('0x32')](';');var _0x41209c={'user_key':_0x559f1d[0x0],'session_key':_0x559f1d[0x1]};_0x286f93={'url':_0x1249a6+_0xfea4('0x33'),'method':'POST','headers':{'user_key':_0x41209c['user_key'],'Session_key':_0x41209c[_0xfea4('0x34')]},'json':!![],'body':_0x462da1};return rp(_0x286f93);})[_0xfea4('0x16')](function(_0x3f8cca){if(_0x3f8cca[_0xfea4('0x35')]>=0x1){var _0xe7bdb5={'messageId':_0x3f8cca[_0xfea4('0x36')]};if(_0x34d877['smsMethod']!=='GP'||!_0x34d877[_0xfea4('0x37')]){_0xe7bdb5[_0xfea4('0x38')]=!![];}return _0x326f78[_0xfea4('0x17')](_0xe7bdb5);}else{return logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfea4('0x2b'),'skebby',util[_0xfea4('0x39')](_0x3f8cca,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1b81d7){return logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0xfea4('0x39')](_0x1b81d7,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x2c'),_0xfea4('0x3a'));}break;case _0xfea4('0x3b'):if(_0x34d877[_0xfea4('0x22')]){var _0x6d6b74={'recipient':_0x6e2065[_0xfea4('0x23')],'message':_0x6e2065['body'],'sender':_0x34d877['senderString']||_0x34d877[_0xfea4('0x23')],'authorization':_0x34d877[_0xfea4('0x22')]};var _0x4d1fc8={'method':_0xfea4('0x3c'),'uri':_0xfea4('0x3d'),'body':_0x6d6b74,'json':!![]};rp(_0x4d1fc8)[_0xfea4('0x16')](function(_0x6396fb){var _0x36f0b7={'messageId':_0x6396fb[_0xfea4('0x3e')]};if(!_0x34d877[_0xfea4('0x37')]){_0x36f0b7[_0xfea4('0x38')]=!![];}return _0x326f78[_0xfea4('0x17')](_0x36f0b7);})['catch'](function(_0x2cff73){logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfea4('0x2b'),'connectel',util[_0xfea4('0x39')](_0x2cff73,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),'connectel',_0xfea4('0x3f'));}break;case'clicksend':if(_0x34d877['username']&&_0x34d877[_0xfea4('0x30')]){var _0x6d6b74={'messages':[{'source':_0xfea4('0x40'),'to':_0x6e2065[_0xfea4('0x23')],'body':_0x6e2065[_0xfea4('0xc')],'from':_0x34d877[_0xfea4('0x41')]||_0x34d877[_0xfea4('0x23')]}]};var _0x16a10b=util[_0xfea4('0x42')](_0xfea4('0x43'),_0x34d877[_0xfea4('0x2e')],_0x34d877['password']);var _0x4d1fc8={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x6d6b74,'headers':{'Authorization':util[_0xfea4('0x42')](_0xfea4('0x44'),new Buffer(_0x16a10b)[_0xfea4('0x45')]('base64'))},'json':!![]};rp(_0x4d1fc8)[_0xfea4('0x16')](function(_0x49a1ab){if(_0x49a1ab[_0xfea4('0x46')]>=0xc8&&_0x49a1ab[_0xfea4('0x46')]<=0xce){if(_0x49a1ab[_0xfea4('0x47')]&&_0x49a1ab[_0xfea4('0x47')]['queued_count']>0x0){var _0x2b1299=_[_0xfea4('0x48')](_0x49a1ab['data'][_0xfea4('0x24')]);var _0x264217={'messageId':_0x2b1299[_0xfea4('0x49')]};if(!_0x34d877['deliveryReport']){_0x264217[_0xfea4('0x38')]=!![];}return _0x326f78['update'](_0x264217);}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x4a'),util[_0xfea4('0x39')](_0x49a1ab,{'showHidden':![],'depth':null}));}}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),'clickSend',util[_0xfea4('0x39')](_0x49a1ab,{'showHidden':![],'depth':null}));}})[_0xfea4('0x19')](function(_0x2c8849){logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),'clickSend',util[_0xfea4('0x39')](_0x2c8849,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x34d877[_0xfea4('0x4b')]&&_0x34d877[_0xfea4('0x22')]){var _0x6d6b74={'dst':_0x6e2065[_0xfea4('0x23')],'text':_0x6e2065[_0xfea4('0xc')],'src':_0x34d877[_0xfea4('0x41')]||_0x34d877[_0xfea4('0x23')],'url':_0x34d877[_0xfea4('0x26')]+_0xfea4('0x4c')+_0x6e2065['id']+_0xfea4('0x27')+_0x34d877[_0xfea4('0x28')]};var _0x16a10b=util[_0xfea4('0x42')](_0xfea4('0x43'),_0x34d877[_0xfea4('0x4b')],_0x34d877[_0xfea4('0x22')]);var _0x4d1fc8={'method':_0xfea4('0x3c'),'uri':util[_0xfea4('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x34d877['authId']),'body':_0x6d6b74,'headers':{'Authorization':util[_0xfea4('0x42')]('Basic\x20%s',new Buffer(_0x16a10b)['toString'](_0xfea4('0x4d')))},'json':!![]};rp(_0x4d1fc8)[_0xfea4('0x16')](function(_0x30c685){var _0x347ed0={'messageId':_0x30c685[_0xfea4('0x4e')][0x0]};return _0x326f78[_0xfea4('0x17')](_0x347ed0);})['catch'](function(_0x29c180){logger['error'](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x4f'),util[_0xfea4('0x39')](_0x29c180,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x4f'),_0xfea4('0x50'));}break;case'infobip':if(_0x34d877['username']&&_0x34d877['password']){if(_0x34d877[_0xfea4('0x51')]){var _0x20626a={'method':_0xfea4('0x3c'),'uri':_0x34d877[_0xfea4('0x51')]+_0xfea4('0x52'),'body':{'username':_0x34d877[_0xfea4('0x2e')],'password':_0x34d877['password']},'json':!![]};return rp(_0x20626a)[_0xfea4('0x16')](function(_0x3e25f5){var _0x24ad52={'method':'POST','uri':_0x34d877[_0xfea4('0x51')]+_0xfea4('0x53'),'body':{'messages':[{'from':_0x34d877[_0xfea4('0x23')],'destinations':[{'to':_0x6e2065[_0xfea4('0x23')]}],'text':_0x6e2065[_0xfea4('0xc')],'notifyUrl':_0x34d877[_0xfea4('0x26')]+_0xfea4('0x4c')+_0x6e2065['id']+_0xfea4('0x27')+_0x34d877[_0xfea4('0x28')],'notifyContentType':_0xfea4('0x54'),'callbackData':_0x34d877[_0xfea4('0x23')]+';'+_0x6e2065[_0xfea4('0xc')]}]},'headers':{'Authorization':_0xfea4('0x55')+_0x3e25f5[_0xfea4('0x28')]},'json':!![]};return rp(_0x24ad52)[_0xfea4('0x16')](function(_0x5d4ff8){if(_0x5d4ff8[_0xfea4('0x24')]){var _0x468874={'messageId':_0x5d4ff8['messages'][0x0][_0xfea4('0xa')]};if(!_0x34d877[_0xfea4('0x37')]){_0x468874[_0xfea4('0x38')]=!![];}return _0x326f78[_0xfea4('0x17')](_0x468874);}else{return logger['error'](_0xfea4('0x2a'),_0xfea4('0x2b'),'infobip',util[_0xfea4('0x39')](_0x5d4ff8,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x14aa34){return logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfea4('0x2b'),_0xfea4('0x56'),util['inspect'](_0x14aa34,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x56'),_0xfea4('0x57'));}}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x56'),_0xfea4('0x3a'));}break;case'csc':var _0x31fc70=require(_0xfea4('0x58'));if(_0x34d877[_0xfea4('0x59')]){var _0x2e284a={};_0x2e284a[_0xfea4('0x5a')]=_0x34d877[_0xfea4('0x2e')];_0x2e284a[_0xfea4('0x23')]=_0x6e2065[_0xfea4('0x23')];_0x2e284a[_0xfea4('0x2f')]=_0x34d877[_0xfea4('0x23')];_0x2e284a['text']=_0x6e2065[_0xfea4('0xc')];_0x2e284a[_0xfea4('0x5b')]=+new Date();var _0x278229='';var _0x3d1d03='';var _0xcf90cf=Object[_0xfea4('0x5c')](_0x2e284a);_0xcf90cf[_0xfea4('0x5d')]();for(var _0x5c750d=0x0;_0x5c750d<_0xcf90cf[_0xfea4('0x5e')];_0x5c750d++){if(_0x278229!=''){_0x278229+='&';}_0x278229+=_0xcf90cf[_0x5c750d]+'='+encodeURIComponent(_0x2e284a[_0xcf90cf[_0x5c750d]]);_0x3d1d03+=_0x2e284a[_0xcf90cf[_0x5c750d]];}_0x3d1d03+=_0x34d877[_0xfea4('0x59')];_0x3d1d03=_0x31fc70[_0xfea4('0x5f')](_0xfea4('0x60'))[_0xfea4('0x17')](_0x3d1d03)[_0xfea4('0x61')](_0xfea4('0x62'));if(_0x278229!==''){_0x278229+='&';}_0x278229+='signature='+_0x3d1d03;var _0x286f93={'method':_0xfea4('0x31'),'uri':_0x34d877[_0xfea4('0x51')]+_0xfea4('0x63')+_0x278229,'json':!![]};return rp(_0x286f93)[_0xfea4('0x16')](function(_0x29692e){var _0x66bc16=Object['keys'](_0x29692e);if(_0x29692e[_0x66bc16[0x0]][_0xfea4('0x1a')]&&parseInt(_0x29692e[_0x66bc16[0x0]][_0xfea4('0x1a')])===0x0){var _0x41536c={'messageId':_0x29692e[_0x66bc16[0x0]][_0xfea4('0x64')]};if(!_0x34d877[_0xfea4('0x37')]){_0x41536c[_0xfea4('0x38')]=!![];}return _0x326f78[_0xfea4('0x17')](_0x41536c);}else{return logger[_0xfea4('0x1a')](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x65'),util[_0xfea4('0x39')](_0x29692e[_0xfea4('0x1a')],{'showHidden':![],'depth':null}));}})[_0xfea4('0x19')](function(_0x59bb3f){return logger[_0xfea4('0x1a')](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x65'),util[_0xfea4('0x39')](_0x59bb3f,{'showHidden':![],'depth':null}));});}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x65'),_0xfea4('0x66'));}break;case _0xfea4('0x67'):if(_0x34d877[_0xfea4('0x59')]){var _0x13c9c0={'method':_0xfea4('0x3c'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x34d877[_0xfea4('0x59')]},'body':{'content':_0x6e2065[_0xfea4('0xc')],'to':[_0x6e2065[_0xfea4('0x23')]],'from':_0x34d877[_0xfea4('0x23')],'binary':![],'clientMessageId':_0xfea4('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0x13c9c0)[_0xfea4('0x16')](function(_0x55d2d6){if(!_0x55d2d6['error']){var _0x37629e={'messageId':_0x55d2d6[_0xfea4('0x24')][0x0][_0xfea4('0x69')]};if(!_0x34d877[_0xfea4('0x37')]){_0x37629e['read']=!![];}return _0x326f78[_0xfea4('0x17')](_0x37629e);}else{return logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x67'),util['inspect'](_0x55d2d6[_0xfea4('0x1a')],{'showHidden':![],'depth':null}));}})[_0xfea4('0x19')](function(_0x1d8bb0){return logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfea4('0x2b'),_0xfea4('0x67'),util[_0xfea4('0x39')](_0x1d8bb0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x67'),'Missing\x20parameters:\x20apiKey');}break;case _0xfea4('0x6a'):if(_0x34d877['username']&&_0x34d877['password']){var _0x16a10b=util['format'](_0xfea4('0x43'),_0x34d877['username'],_0x34d877[_0xfea4('0x30')]);var _0x4d1fc8={'method':_0xfea4('0x3c'),'uri':_0xfea4('0x6b')+_0x34d877[_0xfea4('0x6c')]+_0xfea4('0x6d'),'body':{'to':[_0x6e2065['phone']],'text':_0x6e2065['body'],'from':_0x34d877[_0xfea4('0x23')],'applicationId':_0x34d877[_0xfea4('0x6e')]},'headers':{'Authorization':util[_0xfea4('0x42')]('Basic\x20%s',new Buffer(_0x16a10b)[_0xfea4('0x45')](_0xfea4('0x4d')))},'json':!![]};rp(_0x4d1fc8)['then'](function(_0x5191a8){if(_0x5191a8['id']){var _0x9e3d68={'messageId':_0x5191a8['id']};return _0x326f78['update'](_0x9e3d68);}else{logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x6a'),util[_0xfea4('0x39')](_0x5191a8,{'showHidden':![],'depth':null}));}})[_0xfea4('0x19')](function(_0x14cf68){logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),'bandwidth',util[_0xfea4('0x39')](_0x14cf68,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfea4('0x6a'),_0xfea4('0x3a'));}break;case'intelepeer':if(_0x34d877['apiKey']){var _0x36b1b4={};var _0x286f93={'method':'POST','uri':_0xfea4('0x6f'),'headers':{'Authorization':_0xfea4('0x70')+_0x34d877[_0xfea4('0x59')],'Content-Type':_0xfea4('0x54')},'body':{'from':_0x34d877[_0xfea4('0x23')],'to':_0x6e2065[_0xfea4('0x23')],'text':_0x6e2065[_0xfea4('0xc')]},'json':!![]};return rp(_0x286f93)[_0xfea4('0x16')](function(_0x35e3d6){if(_0x35e3d6[_0xfea4('0x71')]==0xca){_0x36b1b4[_0xfea4('0x72')]=_0x35e3d6;var _0x17b1ef={'method':_0xfea4('0x3c'),'uri':_0xfea4('0x73'),'headers':{'Authorization':_0xfea4('0x70')+_0x34d877[_0xfea4('0x59')],'Content-Type':_0xfea4('0x54')},'body':{'refid':_0x36b1b4['message'][_0xfea4('0x74')]},'json':!![]};return rp(_0x17b1ef)['then'](function(_0x5947e7){_0x36b1b4[_0xfea4('0x75')]=_0x5947e7;var _0x33e445={'messageId':_0x36b1b4['message'][_0xfea4('0x74')],'read':!![]};return _0x326f78['update'](_0x33e445);});}else{return logger[_0xfea4('0x1a')](_0xfea4('0x2a'),'afterCreate',_0xfea4('0x76'),util[_0xfea4('0x39')](_0x35e3d6,{'showHidden':![],'depth':null}));}})[_0xfea4('0x19')](function(_0x3f6721){return logger[_0xfea4('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfea4('0x2b'),_0xfea4('0x76'),util[_0xfea4('0x39')](_0x3f6721,{'showHidden':![],'depth':null}));});}else{return logger[_0xfea4('0x1a')](_0xfea4('0x2a'),_0xfea4('0x2b'),_0xfea4('0x76'),_0xfea4('0x77'));}break;}}})[_0xfea4('0x78')](function(){_0x5566c5();});}else{_0x5566c5();}}},'charset':_0xfea4('0x79'),'collate':_0xfea4('0x7a')});}; \ No newline at end of file +var _0x9c03=['accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','&password=','GET','split','POST','user_key','session_key','internal_order_id','deliveryReport','read','skebby','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','/status?token=','token','%s:%s','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','keys','sort','length','apiKey','createHash','md5','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/'];(function(_0x469318,_0x2c7c98){var _0x77c40e=function(_0x5795e7){while(--_0x5795e7){_0x469318['push'](_0x469318['shift']());}};_0x77c40e(++_0x2c7c98);}(_0x9c03,0x87));var _0x39c0=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9c03[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x39c0('0x0'));var logger=require(_0x39c0('0x1'))(_0x39c0('0x2'));var moment=require('moment');var BPromise=require(_0x39c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39c0('0x4'));var rimraf=require('rimraf');var config=require(_0x39c0('0x5'));var attributes=require(_0x39c0('0x6'));module[_0x39c0('0x7')]=function(_0x2dead8,_0x2eee65){return _0x2dead8[_0x39c0('0x8')](_0x39c0('0x9'),attributes,{'tableName':_0x39c0('0xa'),'paranoid':![],'indexes':[{'name':_0x39c0('0xb'),'fields':[_0x39c0('0xb')]},{'name':_0x39c0('0xc'),'fields':[_0x39c0('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x110921,_0x3bcd88,_0x4d3bf0){var _0x550104=_0x2dead8[_0x39c0('0xe')];var _0x38820e=_0x110921[_0x39c0('0xf')]({'plain':!![]});if(_0x38820e[_0x39c0('0x10')][_0x39c0('0x11')]()==='in'||_0x38820e[_0x39c0('0x10')][_0x39c0('0x11')]()===_0x39c0('0x12')&&!_0x38820e[_0x39c0('0x13')]&&!_[_0x39c0('0x14')](_0x38820e[_0x39c0('0x15')])&&!_['isNil'](_0x38820e[_0x39c0('0x16')])){_0x550104['SmsInteraction']['findOne']({'where':{'id':_0x38820e['SmsInteractionId']}})[_0x39c0('0x17')](function(_0x3e7bb2){if(_0x3e7bb2){_0x3e7bb2[_0x39c0('0x18')]({'lastMsgAt':_0x38820e[_0x39c0('0x19')],'lastMsgDirection':_0x38820e[_0x39c0('0x10')][_0x39c0('0x11')]()});}})[_0x39c0('0x1a')](function(_0x8cb5f9){console[_0x39c0('0x1b')](_0x8cb5f9);});}if(_0x38820e[_0x39c0('0x10')]===_0x39c0('0x12')&&!_0x38820e[_0x39c0('0x13')]){var _0x48d791;_0x550104[_0x39c0('0x1c')][_0x39c0('0x1d')]({'where':{'id':_0x38820e[_0x39c0('0x1e')]},'raw':!![]})[_0x39c0('0x17')](function(_0x305482){_0x48d791=_0x305482;if(_0x48d791&&_0x48d791[_0x39c0('0x1f')]){switch(_0x48d791[_0x39c0('0x1f')]){case _0x39c0('0x20'):var _0x5d8f97=require(_0x39c0('0x20'));if(_0x48d791[_0x39c0('0x21')]&&_0x48d791[_0x39c0('0x22')]&&_0x48d791[_0x39c0('0x23')]){var _0x37f003=new _0x5d8f97(_0x48d791[_0x39c0('0x21')],_0x48d791['authToken']);_0x37f003[_0x39c0('0x24')][_0x39c0('0x25')]({'body':_0x38820e['body'],'to':_0x38820e[_0x39c0('0x23')],'from':_0x48d791[_0x39c0('0x23')],'statusCallback':_0x48d791[_0x39c0('0x26')]+_0x39c0('0x27')+_0x38820e['id']+'/status?token='+_0x48d791['token']})[_0x39c0('0x17')](function(_0x104436){if(_0x104436['sid']){return _0x110921[_0x39c0('0x18')]({'messageId':_0x104436[_0x39c0('0x28')]});}})[_0x39c0('0x1a')](function(_0x46153d){logger['error'](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x20'),util['inspect'](_0x46153d,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x20'),_0x39c0('0x2b'));}break;case'skebby':var _0x22777c='https://api.skebby.it/API/v1.0/REST/';if(_0x48d791[_0x39c0('0x2c')]&&_0x48d791[_0x39c0('0x2d')]){var _0x4037f3={'recipient':[_0x38820e['phone']],'message':_0x38820e[_0x39c0('0xd')],'message_type':_0x48d791[_0x39c0('0x2e')]};if(_0x48d791[_0x39c0('0x2e')]&&_0x48d791[_0x39c0('0x2e')]!=='SI'){_0x4037f3[_0x39c0('0x2f')]=_0x48d791['phone'];}var _0x18b180={'url':_0x22777c+'login?username='+_0x48d791[_0x39c0('0x2c')]+_0x39c0('0x30')+_0x48d791[_0x39c0('0x2d')],'method':_0x39c0('0x31')};rp(_0x18b180)[_0x39c0('0x17')](function(_0x100999){var _0x3904bb=_0x100999[_0x39c0('0x32')](';');var _0x24169a={'user_key':_0x3904bb[0x0],'session_key':_0x3904bb[0x1]};_0x18b180={'url':_0x22777c+'sms','method':_0x39c0('0x33'),'headers':{'user_key':_0x24169a[_0x39c0('0x34')],'Session_key':_0x24169a[_0x39c0('0x35')]},'json':!![],'body':_0x4037f3};return rp(_0x18b180);})['then'](function(_0x49ee80){if(_0x49ee80['total_sent']>=0x1){var _0x2d88bb={'messageId':_0x49ee80[_0x39c0('0x36')]};if(_0x48d791[_0x39c0('0x2e')]!=='GP'||!_0x48d791[_0x39c0('0x37')]){_0x2d88bb[_0x39c0('0x38')]=!![];}return _0x110921[_0x39c0('0x18')](_0x2d88bb);}else{return logger['error'](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x39'),util[_0x39c0('0x3a')](_0x49ee80,{'showHidden':![],'depth':null}));}})[_0x39c0('0x1a')](function(_0x5639b2){return logger[_0x39c0('0x1b')](_0x39c0('0x29'),'afterCreate',_0x39c0('0x39'),util[_0x39c0('0x3a')](_0x5639b2,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x39c0('0x3b'):if(_0x48d791[_0x39c0('0x22')]){var _0x568718={'recipient':_0x38820e[_0x39c0('0x23')],'message':_0x38820e['body'],'sender':_0x48d791[_0x39c0('0x3c')]||_0x48d791[_0x39c0('0x23')],'authorization':_0x48d791[_0x39c0('0x22')]};var _0x3bcd88={'method':_0x39c0('0x33'),'uri':_0x39c0('0x3d'),'body':_0x568718,'json':!![]};rp(_0x3bcd88)[_0x39c0('0x17')](function(_0x567cbb){var _0x2b88f6={'messageId':_0x567cbb['requestid']};if(!_0x48d791[_0x39c0('0x37')]){_0x2b88f6[_0x39c0('0x38')]=!![];}return _0x110921[_0x39c0('0x18')](_0x2b88f6);})[_0x39c0('0x1a')](function(_0x9c7f69){logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),'connectel',util['inspect'](_0x9c7f69,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')](_0x39c0('0x29'),'afterCreate',_0x39c0('0x3b'),_0x39c0('0x3e'));}break;case'clicksend':if(_0x48d791[_0x39c0('0x2c')]&&_0x48d791[_0x39c0('0x2d')]){var _0x568718={'messages':[{'source':'xCALLY\x20Motion','to':_0x38820e[_0x39c0('0x23')],'body':_0x38820e['body'],'from':_0x48d791[_0x39c0('0x3c')]||_0x48d791[_0x39c0('0x23')]}]};var _0x2199a7=util[_0x39c0('0x3f')]('%s:%s',_0x48d791[_0x39c0('0x2c')],_0x48d791[_0x39c0('0x2d')]);var _0x3bcd88={'method':'POST','uri':_0x39c0('0x40'),'body':_0x568718,'headers':{'Authorization':util[_0x39c0('0x3f')](_0x39c0('0x41'),new Buffer(_0x2199a7)[_0x39c0('0x42')](_0x39c0('0x43')))},'json':!![]};rp(_0x3bcd88)['then'](function(_0x152f2c){if(_0x152f2c[_0x39c0('0x44')]>=0xc8&&_0x152f2c['http_code']<=0xce){if(_0x152f2c[_0x39c0('0x45')]&&_0x152f2c[_0x39c0('0x45')][_0x39c0('0x46')]>0x0){var _0x410b2f=_[_0x39c0('0x47')](_0x152f2c['data'][_0x39c0('0x24')]);var _0x1a11a3={'messageId':_0x410b2f['message_id']};if(!_0x48d791[_0x39c0('0x37')]){_0x1a11a3[_0x39c0('0x38')]=!![];}return _0x110921[_0x39c0('0x18')](_0x1a11a3);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),'clickSend',util['inspect'](_0x152f2c,{'showHidden':![],'depth':null}));}}else{logger[_0x39c0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),_0x39c0('0x48'),util[_0x39c0('0x3a')](_0x152f2c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4a5820){logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x48'),util[_0x39c0('0x3a')](_0x4a5820,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),'clickSend',_0x39c0('0x49'));}break;case _0x39c0('0x4a'):if(_0x48d791['authId']&&_0x48d791[_0x39c0('0x22')]){var _0x568718={'dst':_0x38820e['phone'],'text':_0x38820e[_0x39c0('0xd')],'src':_0x48d791['senderString']||_0x48d791[_0x39c0('0x23')],'url':_0x48d791[_0x39c0('0x26')]+'/api/sms/messages/'+_0x38820e['id']+_0x39c0('0x4b')+_0x48d791[_0x39c0('0x4c')]};var _0x2199a7=util[_0x39c0('0x3f')](_0x39c0('0x4d'),_0x48d791[_0x39c0('0x4e')],_0x48d791['authToken']);var _0x3bcd88={'method':_0x39c0('0x33'),'uri':util[_0x39c0('0x3f')](_0x39c0('0x4f'),_0x48d791[_0x39c0('0x4e')]),'body':_0x568718,'headers':{'Authorization':util[_0x39c0('0x3f')]('Basic\x20%s',new Buffer(_0x2199a7)[_0x39c0('0x42')](_0x39c0('0x43')))},'json':!![]};rp(_0x3bcd88)['then'](function(_0x2c868c){var _0x28cca3={'messageId':_0x2c868c[_0x39c0('0x50')][0x0]};return _0x110921[_0x39c0('0x18')](_0x28cca3);})[_0x39c0('0x1a')](function(_0x5bfc8b){logger[_0x39c0('0x1b')](_0x39c0('0x29'),'afterCreate','plivo',util[_0x39c0('0x3a')](_0x5bfc8b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x39c0('0x51'):if(_0x48d791[_0x39c0('0x2c')]&&_0x48d791[_0x39c0('0x2d')]){if(_0x48d791[_0x39c0('0x52')]){var _0x19dff4={'method':'POST','uri':_0x48d791[_0x39c0('0x52')]+_0x39c0('0x53'),'body':{'username':_0x48d791[_0x39c0('0x2c')],'password':_0x48d791[_0x39c0('0x2d')]},'json':!![]};return rp(_0x19dff4)['then'](function(_0xf34454){var _0x3fcf17={'method':_0x39c0('0x33'),'uri':_0x48d791['baseUrl']+_0x39c0('0x54'),'body':{'messages':[{'from':_0x48d791[_0x39c0('0x23')],'destinations':[{'to':_0x38820e[_0x39c0('0x23')]}],'text':_0x38820e[_0x39c0('0xd')],'notifyUrl':_0x48d791['remote']+_0x39c0('0x27')+_0x38820e['id']+_0x39c0('0x4b')+_0x48d791[_0x39c0('0x4c')],'notifyContentType':_0x39c0('0x55'),'callbackData':_0x48d791['phone']+';'+_0x38820e[_0x39c0('0xd')]}]},'headers':{'Authorization':_0x39c0('0x56')+_0xf34454['token']},'json':!![]};return rp(_0x3fcf17)[_0x39c0('0x17')](function(_0x2e7506){if(_0x2e7506[_0x39c0('0x24')]){var _0x192a60={'messageId':_0x2e7506[_0x39c0('0x24')][0x0][_0x39c0('0xb')]};if(!_0x48d791[_0x39c0('0x37')]){_0x192a60[_0x39c0('0x38')]=!![];}return _0x110921[_0x39c0('0x18')](_0x192a60);}else{return logger['error'](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x51'),util[_0x39c0('0x3a')](_0x2e7506,{'showHidden':![],'depth':null}));}});})[_0x39c0('0x1a')](function(_0x13215e){return logger[_0x39c0('0x1b')](_0x39c0('0x29'),'afterCreate',_0x39c0('0x51'),util['inspect'](_0x13215e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x39c0('0x29'),'afterCreate',_0x39c0('0x51'),_0x39c0('0x57'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x39c0('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x39c0('0x58'):var _0x5367ef=require(_0x39c0('0x59'));if(_0x48d791['apiKey']){var _0x420806={};_0x420806[_0x39c0('0x5a')]=_0x48d791['username'];_0x420806[_0x39c0('0x23')]=_0x38820e[_0x39c0('0x23')];_0x420806[_0x39c0('0x2f')]=_0x48d791[_0x39c0('0x23')];_0x420806[_0x39c0('0x5b')]=_0x38820e['body'];_0x420806['timestamp']=+new Date();var _0x11f45c='';var _0x7a353d='';var _0x2f1cdd=Object[_0x39c0('0x5c')](_0x420806);_0x2f1cdd[_0x39c0('0x5d')]();for(var _0x30b6a5=0x0;_0x30b6a5<_0x2f1cdd[_0x39c0('0x5e')];_0x30b6a5++){if(_0x11f45c!=''){_0x11f45c+='&';}_0x11f45c+=_0x2f1cdd[_0x30b6a5]+'='+encodeURIComponent(_0x420806[_0x2f1cdd[_0x30b6a5]]);_0x7a353d+=_0x420806[_0x2f1cdd[_0x30b6a5]];}_0x7a353d+=_0x48d791[_0x39c0('0x5f')];_0x7a353d=_0x5367ef[_0x39c0('0x60')](_0x39c0('0x61'))[_0x39c0('0x18')](_0x7a353d)['digest']('hex');if(_0x11f45c!==''){_0x11f45c+='&';}_0x11f45c+=_0x39c0('0x62')+_0x7a353d;var _0x18b180={'method':_0x39c0('0x31'),'uri':_0x48d791[_0x39c0('0x52')]+_0x39c0('0x63')+_0x11f45c,'json':!![]};return rp(_0x18b180)[_0x39c0('0x17')](function(_0x2a9abe){var _0x1738c9=Object[_0x39c0('0x5c')](_0x2a9abe);if(_0x2a9abe[_0x1738c9[0x0]]['error']&&parseInt(_0x2a9abe[_0x1738c9[0x0]]['error'])===0x0){var _0x1c56c5={'messageId':_0x2a9abe[_0x1738c9[0x0]][_0x39c0('0x64')]};if(!_0x48d791[_0x39c0('0x37')]){_0x1c56c5[_0x39c0('0x38')]=!![];}return _0x110921['update'](_0x1c56c5);}else{return logger[_0x39c0('0x1b')](_0x39c0('0x29'),'afterCreate',_0x39c0('0x58'),util[_0x39c0('0x3a')](_0x2a9abe[_0x39c0('0x1b')],{'showHidden':![],'depth':null}));}})[_0x39c0('0x1a')](function(_0x5334cf){return logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),'csc',util[_0x39c0('0x3a')](_0x5334cf,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x58'),_0x39c0('0x65'));}break;case _0x39c0('0x66'):if(_0x48d791[_0x39c0('0x5f')]){var _0x4d6c79={'method':_0x39c0('0x33'),'uri':_0x39c0('0x67'),'headers':{'Authorization':_0x48d791['apiKey']},'body':{'content':_0x38820e[_0x39c0('0xd')],'to':[_0x38820e[_0x39c0('0x23')]],'from':_0x48d791[_0x39c0('0x23')],'binary':![],'clientMessageId':_0x39c0('0x68'),'charset':_0x39c0('0x69')},'json':!![]};rp(_0x4d6c79)[_0x39c0('0x17')](function(_0x537555){if(!_0x537555[_0x39c0('0x1b')]){var _0x46e390={'messageId':_0x537555[_0x39c0('0x24')][0x0][_0x39c0('0x6a')]};if(!_0x48d791[_0x39c0('0x37')]){_0x46e390[_0x39c0('0x38')]=!![];}return _0x110921['update'](_0x46e390);}else{return logger['error'](_0x39c0('0x29'),_0x39c0('0x2a'),'clickatell',util['inspect'](_0x537555[_0x39c0('0x1b')],{'showHidden':![],'depth':null}));}})[_0x39c0('0x1a')](function(_0x3b3a43){return logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x66'),util[_0x39c0('0x3a')](_0x3b3a43,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),_0x39c0('0x66'),_0x39c0('0x65'));}break;case _0x39c0('0x6b'):if(_0x48d791['username']&&_0x48d791[_0x39c0('0x2d')]){var _0x2199a7=util['format'](_0x39c0('0x4d'),_0x48d791[_0x39c0('0x2c')],_0x48d791[_0x39c0('0x2d')]);var _0x3bcd88={'method':_0x39c0('0x33'),'uri':_0x39c0('0x6c')+_0x48d791[_0x39c0('0x6d')]+_0x39c0('0x6e'),'body':{'to':[_0x38820e['phone']],'text':_0x38820e[_0x39c0('0xd')],'from':_0x48d791['phone'],'applicationId':_0x48d791[_0x39c0('0x6f')]},'headers':{'Authorization':util[_0x39c0('0x3f')](_0x39c0('0x41'),new Buffer(_0x2199a7)['toString'](_0x39c0('0x43')))},'json':!![]};rp(_0x3bcd88)[_0x39c0('0x17')](function(_0x2f03ae){if(_0x2f03ae['id']){var _0x6ad54e={'messageId':_0x2f03ae['id']};return _0x110921['update'](_0x6ad54e);}else{logger[_0x39c0('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),_0x39c0('0x6b'),util[_0x39c0('0x3a')](_0x2f03ae,{'showHidden':![],'depth':null}));}})[_0x39c0('0x1a')](function(_0x5956e0){logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x6b'),util[_0x39c0('0x3a')](_0x5956e0,{'showHidden':![],'depth':null}));});}else{logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x6b'),_0x39c0('0x49'));}break;case _0x39c0('0x70'):if(_0x48d791[_0x39c0('0x5f')]){var _0x2f03e={};var _0x18b180={'method':_0x39c0('0x33'),'uri':_0x39c0('0x71'),'headers':{'Authorization':_0x39c0('0x72')+_0x48d791[_0x39c0('0x5f')],'Content-Type':_0x39c0('0x55')},'body':{'from':_0x48d791[_0x39c0('0x23')],'to':_0x38820e[_0x39c0('0x23')],'text':_0x38820e[_0x39c0('0xd')]},'json':!![]};return rp(_0x18b180)['then'](function(_0x224fc1){if(_0x224fc1['code']==0xca){_0x2f03e[_0x39c0('0x73')]=_0x224fc1;var _0x533d1d={'method':_0x39c0('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x39c0('0x72')+_0x48d791[_0x39c0('0x5f')],'Content-Type':_0x39c0('0x55')},'body':{'refid':_0x2f03e[_0x39c0('0x73')]['refid']},'json':!![]};return rp(_0x533d1d)['then'](function(_0x120acc){_0x2f03e[_0x39c0('0x74')]=_0x120acc;var _0x4c9190={'messageId':_0x2f03e[_0x39c0('0x73')][_0x39c0('0x75')],'read':!![]};return _0x110921[_0x39c0('0x18')](_0x4c9190);});}else{return logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x70'),util[_0x39c0('0x3a')](_0x224fc1,{'showHidden':![],'depth':null}));}})[_0x39c0('0x1a')](function(_0x59b0fc){return logger[_0x39c0('0x1b')](_0x39c0('0x29'),_0x39c0('0x2a'),_0x39c0('0x70'),util[_0x39c0('0x3a')](_0x59b0fc,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x39c0('0x2a'),_0x39c0('0x70'),_0x39c0('0x76'));}break;}}})[_0x39c0('0x77')](function(){_0x4d3bf0();});}else{_0x4d3bf0();}}},'charset':_0x39c0('0x78'),'collate':_0x39c0('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 9dec601..b3b0fd7 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 _0x9dd8=['options','raw','info','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage','body'];(function(_0x528e4e,_0x42e9f6){var _0x48d1a3=function(_0x24de1c){while(--_0x24de1c){_0x528e4e['push'](_0x528e4e['shift']());}};_0x48d1a3(++_0x42e9f6);}(_0x9dd8,0x8c));var _0x89dd=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x9dd8[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x89dd('0x0'));var util=require(_0x89dd('0x1'));var moment=require(_0x89dd('0x2'));var BPromise=require(_0x89dd('0x3'));var rs=require(_0x89dd('0x4'));var fs=require('fs');var Redis=require(_0x89dd('0x5'));var db=require(_0x89dd('0x6'))['db'];var utils=require(_0x89dd('0x7'));var logger=require(_0x89dd('0x8'))('rpc');var config=require(_0x89dd('0x9'));var jayson=require(_0x89dd('0xa'));var client=jayson[_0x89dd('0xb')][_0x89dd('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x89dd('0xd')],{'host':_0x89dd('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x89dd('0xd')]));require(_0x89dd('0xf'))[_0x89dd('0x10')](socket);function respondWithRpcPromise(_0x4a7bc5,_0x218552,_0x29bbd2){return new BPromise(function(_0x5ce1cf,_0x1a9f8c){return client[_0x89dd('0x11')](_0x4a7bc5,_0x29bbd2)[_0x89dd('0x12')](function(_0x4ab8a7){logger['info'](_0x89dd('0x13'),_0x218552,'request\x20sent');logger['debug'](_0x89dd('0x14'),_0x218552,_0x89dd('0x15'),JSON[_0x89dd('0x16')](_0x4ab8a7));if(_0x4ab8a7['error']){if(_0x4ab8a7[_0x89dd('0x17')][_0x89dd('0x18')]===0x1f4){logger['error'](_0x89dd('0x13'),_0x218552,_0x4ab8a7[_0x89dd('0x17')]['message']);return _0x1a9f8c(_0x4ab8a7['error'][_0x89dd('0x19')]);}logger[_0x89dd('0x17')]('SmsMessage,\x20%s,\x20%s',_0x218552,_0x4ab8a7[_0x89dd('0x17')]['message']);return _0x5ce1cf(_0x4ab8a7['error'][_0x89dd('0x19')]);}else{logger['info'](_0x89dd('0x13'),_0x218552,_0x89dd('0x15'));_0x5ce1cf(_0x4ab8a7[_0x89dd('0x1a')][_0x89dd('0x19')]);}})[_0x89dd('0x1b')](function(_0xd5db73){logger[_0x89dd('0x17')]('SmsMessage,\x20%s,\x20%s',_0x218552,_0xd5db73);_0x1a9f8c(_0xd5db73);});});}exports[_0x89dd('0x1c')]=function(_0x2ac984){var _0x4b025e=this;return new Promise(function(_0x4b57db,_0xffbcd0){return db['SmsMessage']['create'](_0x2ac984[_0x89dd('0x1d')],{'raw':_0x2ac984[_0x89dd('0x1e')]?_0x2ac984['options'][_0x89dd('0x1f')]===undefined?!![]:![]:!![]})[_0x89dd('0x12')](function(_0x1b844a){logger[_0x89dd('0x20')]('CreateSmsMessage',_0x2ac984);logger[_0x89dd('0x21')](_0x89dd('0x1c'),_0x2ac984,JSON[_0x89dd('0x16')](_0x1b844a));_0x4b57db(_0x1b844a);})[_0x89dd('0x1b')](function(_0x50b5ae){logger[_0x89dd('0x17')](_0x89dd('0x1c'),_0x50b5ae[_0x89dd('0x19')],_0x2ac984);_0xffbcd0(_0x4b025e[_0x89dd('0x17')](0x1f4,_0x50b5ae[_0x89dd('0x19')]));});});}; \ No newline at end of file +var _0x50c1=['redis','localhost','socket.io-emitter','register','request','then','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','SmsMessage','create','body','options','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults'];(function(_0x10b2ae,_0x2db8e9){var _0x193043=function(_0x2fe3cc){while(--_0x2fe3cc){_0x10b2ae['push'](_0x10b2ae['shift']());}};_0x193043(++_0x2db8e9);}(_0x50c1,0x171));var _0x150c=function(_0x20f3a4,_0x5089d4){_0x20f3a4=_0x20f3a4-0x0;var _0x3d5d35=_0x50c1[_0x20f3a4];return _0x3d5d35;};'use strict';var _=require(_0x150c('0x0'));var util=require('util');var moment=require(_0x150c('0x1'));var BPromise=require('bluebird');var rs=require(_0x150c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x150c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x150c('0x4'))('rpc');var config=require(_0x150c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x150c('0x6')][_0x150c('0x7')]({'port':0x232a});config['redis']=_[_0x150c('0x8')](config[_0x150c('0x9')],{'host':_0x150c('0xa'),'port':0x18eb});var socket=require(_0x150c('0xb'))(new Redis(config[_0x150c('0x9')]));require('./smsMessage.socket')[_0x150c('0xc')](socket);function respondWithRpcPromise(_0x41442c,_0x355c80,_0x480570){return new BPromise(function(_0x50be63,_0xd66817){return client[_0x150c('0xd')](_0x41442c,_0x480570)[_0x150c('0xe')](function(_0x4e1c9f){logger['info']('SmsMessage,\x20%s,\x20%s',_0x355c80,_0x150c('0xf'));logger['debug'](_0x150c('0x10'),_0x355c80,_0x150c('0xf'),JSON['stringify'](_0x4e1c9f));if(_0x4e1c9f['error']){if(_0x4e1c9f['error']['code']===0x1f4){logger[_0x150c('0x11')](_0x150c('0x12'),_0x355c80,_0x4e1c9f[_0x150c('0x11')][_0x150c('0x13')]);return _0xd66817(_0x4e1c9f[_0x150c('0x11')]['message']);}logger[_0x150c('0x11')](_0x150c('0x12'),_0x355c80,_0x4e1c9f[_0x150c('0x11')][_0x150c('0x13')]);return _0x50be63(_0x4e1c9f[_0x150c('0x11')][_0x150c('0x13')]);}else{logger['info'](_0x150c('0x12'),_0x355c80,_0x150c('0xf'));_0x50be63(_0x4e1c9f[_0x150c('0x14')][_0x150c('0x13')]);}})['catch'](function(_0x56b14f){logger[_0x150c('0x11')](_0x150c('0x12'),_0x355c80,_0x56b14f);_0xd66817(_0x56b14f);});});}exports[_0x150c('0x15')]=function(_0x2526ec){var _0x40f7c6=this;return new Promise(function(_0x45a705,_0x38619c){return db[_0x150c('0x16')][_0x150c('0x17')](_0x2526ec[_0x150c('0x18')],{'raw':_0x2526ec['options']?_0x2526ec[_0x150c('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x150c('0xe')](function(_0x4356b5){logger['info'](_0x150c('0x15'),_0x2526ec);logger['debug'](_0x150c('0x15'),_0x2526ec,JSON['stringify'](_0x4356b5));_0x45a705(_0x4356b5);})[_0x150c('0x1a')](function(_0x27f9cf){logger[_0x150c('0x11')]('CreateSmsMessage',_0x27f9cf[_0x150c('0x13')],_0x2526ec);_0x38619c(_0x40f7c6[_0x150c('0x11')](0x1f4,_0x27f9cf[_0x150c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index faf58c2..1fe6fc5 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 _0xbdc2=['update','removeListener','register','length','save'];(function(_0x274f66,_0x3f9e72){var _0x5af856=function(_0xe9b23e){while(--_0xe9b23e){_0x274f66['push'](_0x274f66['shift']());}};_0x5af856(++_0x3f9e72);}(_0xbdc2,0x1e9));var _0x2bdc=function(_0x5e1fb6,_0xf3495b){_0x5e1fb6=_0x5e1fb6-0x0;var _0x2cf20e=_0xbdc2[_0x5e1fb6];return _0x2cf20e;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x2bdc('0x0'),'remove',_0x2bdc('0x1')];function createListener(_0x1a81f9,_0x43c0a8){return function(_0x6eaf73){_0x43c0a8['emit'](_0x1a81f9,_0x6eaf73);};}function removeListener(_0x13c46d,_0x4a4946){return function(){SmsMessageEvents[_0x2bdc('0x2')](_0x13c46d,_0x4a4946);};}exports[_0x2bdc('0x3')]=function(_0x20f611){for(var _0x19d373=0x0,_0x227db8=events[_0x2bdc('0x4')];_0x19d373<_0x227db8;_0x19d373++){var _0x2f3748=events[_0x19d373];var _0x5a206e=createListener('smsMessage:'+_0x2f3748,_0x20f611);SmsMessageEvents['on'](_0x2f3748,_0x5a206e);}}; \ No newline at end of file +var _0xa4b2=['removeListener','register','length','./smsMessage.events','save','remove'];(function(_0x1836e8,_0x10ffa5){var _0x2e17cc=function(_0x55ccc9){while(--_0x55ccc9){_0x1836e8['push'](_0x1836e8['shift']());}};_0x2e17cc(++_0x10ffa5);}(_0xa4b2,0x123));var _0x2a4b=function(_0x2e9bc3,_0x2c28da){_0x2e9bc3=_0x2e9bc3-0x0;var _0x3a87c6=_0xa4b2[_0x2e9bc3];return _0x3a87c6;};'use strict';var SmsMessageEvents=require(_0x2a4b('0x0'));var events=[_0x2a4b('0x1'),_0x2a4b('0x2'),'update'];function createListener(_0x3a4314,_0x35eb02){return function(_0x5b152e){_0x35eb02['emit'](_0x3a4314,_0x5b152e);};}function removeListener(_0x401c68,_0x2f99d6){return function(){SmsMessageEvents[_0x2a4b('0x3')](_0x401c68,_0x2f99d6);};}exports[_0x2a4b('0x4')]=function(_0x55da1e){for(var _0x1cfe6b=0x0,_0x328f63=events[_0x2a4b('0x5')];_0x1cfe6b<_0x328f63;_0x1cfe6b++){var _0x1c9a58=events[_0x1cfe6b];var _0x5f53ef=createListener('smsMessage:'+_0x1c9a58,_0x55da1e);SmsMessageEvents['on'](_0x1c9a58,_0x5f53ef);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 76c618f..4d770df 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 _0x2c0a=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5492b1,_0xe58672){var _0x3cf29d=function(_0x240f05){while(--_0x240f05){_0x5492b1['push'](_0x5492b1['shift']());}};_0x3cf29d(++_0xe58672);}(_0x2c0a,0x1f1));var _0xa2c0=function(_0x4cba56,_0x5b2c44){_0x4cba56=_0x4cba56-0x0;var _0x3cc9f3=_0x2c0a[_0x4cba56];return _0x3cc9f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa2c0('0x0'));var timeout=require(_0xa2c0('0x1'));var express=require(_0xa2c0('0x2'));var router=express[_0xa2c0('0x3')]();var fs_extra=require(_0xa2c0('0x4'));var auth=require(_0xa2c0('0x5'));var interaction=require(_0xa2c0('0x6'));var config=require('../../config/environment');var controller=require(_0xa2c0('0x7'));router[_0xa2c0('0x8')]('/',auth[_0xa2c0('0x9')](),controller[_0xa2c0('0xa')]);router[_0xa2c0('0x8')](_0xa2c0('0xb'),auth['isAuthenticated'](),controller[_0xa2c0('0xc')]);router['get'](_0xa2c0('0xd'),auth['isAuthenticated'](),controller[_0xa2c0('0xe')]);router[_0xa2c0('0x8')](_0xa2c0('0xf'),auth['isAuthenticated'](),controller[_0xa2c0('0x10')]);router[_0xa2c0('0x8')](_0xa2c0('0x11'),auth[_0xa2c0('0x9')](),controller[_0xa2c0('0x12')]);router[_0xa2c0('0x8')](_0xa2c0('0x13'),auth[_0xa2c0('0x9')](),controller[_0xa2c0('0x14')]);router[_0xa2c0('0x15')]('/',auth[_0xa2c0('0x9')](),controller['create']);router[_0xa2c0('0x15')](_0xa2c0('0x11'),auth[_0xa2c0('0x9')](),controller[_0xa2c0('0x16')]);router[_0xa2c0('0x15')](_0xa2c0('0x13'),auth[_0xa2c0('0x9')](),controller[_0xa2c0('0x17')]);router[_0xa2c0('0x18')](_0xa2c0('0xd'),auth['isAuthenticated'](),controller[_0xa2c0('0x19')]);router[_0xa2c0('0x1a')](_0xa2c0('0xd'),auth['isAuthenticated'](),controller[_0xa2c0('0x1b')]);router[_0xa2c0('0x1a')]('/:id/teams',auth[_0xa2c0('0x9')](),controller['removeTeams']);router['delete'](_0xa2c0('0x13'),auth[_0xa2c0('0x9')](),controller[_0xa2c0('0x1c')]);module[_0xa2c0('0x1d')]=router; \ No newline at end of file +var _0x753c=['/:id','show','/:id/teams','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x1a5d3c,_0x597cd0){var _0x2802e7=function(_0x119a92){while(--_0x119a92){_0x1a5d3c['push'](_0x1a5d3c['shift']());}};_0x2802e7(++_0x597cd0);}(_0x753c,0x92));var _0xc753=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x753c[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc753('0x0'));var express=require(_0xc753('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc753('0x2'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0xc753('0x3')]('/',auth[_0xc753('0x4')](),controller[_0xc753('0x5')]);router[_0xc753('0x3')](_0xc753('0x6'),auth['isAuthenticated'](),controller[_0xc753('0x7')]);router[_0xc753('0x3')](_0xc753('0x8'),auth[_0xc753('0x4')](),controller[_0xc753('0x9')]);router[_0xc753('0x3')]('/:id/members',auth[_0xc753('0x4')](),controller['getMembers']);router['get'](_0xc753('0xa'),auth[_0xc753('0x4')](),controller['getTeams']);router['get']('/:id/users',auth[_0xc753('0x4')](),controller['getAgents']);router[_0xc753('0xb')]('/',auth[_0xc753('0x4')](),controller['create']);router[_0xc753('0xb')](_0xc753('0xa'),auth[_0xc753('0x4')](),controller[_0xc753('0xc')]);router[_0xc753('0xb')]('/:id/users',auth['isAuthenticated'](),controller[_0xc753('0xd')]);router[_0xc753('0xe')](_0xc753('0x8'),auth['isAuthenticated'](),controller[_0xc753('0xf')]);router[_0xc753('0x10')](_0xc753('0x8'),auth[_0xc753('0x4')](),controller[_0xc753('0x11')]);router[_0xc753('0x10')]('/:id/teams',auth[_0xc753('0x4')](),controller[_0xc753('0x12')]);router['delete'](_0xc753('0x13'),auth['isAuthenticated'](),controller[_0xc753('0x14')]);module[_0xc753('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 5ae5c4a..b85919b 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 _0x9597=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x27d26d,_0x337726){var _0x355be9=function(_0x6bb9fe){while(--_0x6bb9fe){_0x27d26d['push'](_0x27d26d['shift']());}};_0x355be9(++_0x337726);}(_0x9597,0x14d));var _0x7959=function(_0x5ecb54,_0x2c98ed){_0x5ecb54=_0x5ecb54-0x0;var _0x41a24b=_0x9597[_0x5ecb54];return _0x41a24b;};'use strict';var Sequelize=require('sequelize');module[_0x7959('0x0')]={'name':{'type':Sequelize[_0x7959('0x1')],'unique':_0x7959('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7959('0x1')]},'timeout':{'type':Sequelize[_0x7959('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7959('0x4')](_0x7959('0x5'),_0x7959('0x6'),_0x7959('0x7'))}}; \ No newline at end of file +var _0x0c31=['ENUM','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x3e97e4,_0x46742d){var _0x31f467=function(_0x407e7a){while(--_0x407e7a){_0x3e97e4['push'](_0x3e97e4['shift']());}};_0x31f467(++_0x46742d);}(_0x0c31,0x96));var _0x10c3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0c31[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x10c3('0x0'));module[_0x10c3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x10c3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x10c3('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x10c3('0x4')]('rrmemory',_0x10c3('0x5'),_0x10c3('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 9de69e2..847ca94 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 _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0xadb5,0xad));var _0x5adb=function(_0x5593fb,_0x167972){_0x5593fb=_0x5593fb-0x0;var _0x5592b4=_0xadb5[_0x5593fb];return _0x5592b4;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file +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(_0x5f24c4,_0x508a17){var _0x3adf4f=function(_0x1b0e20){while(--_0x1b0e20){_0x5f24c4['push'](_0x5f24c4['shift']());}};_0x3adf4f(++_0x508a17);}(_0xdb28,0x106));var _0x8db2=function(_0x2f8782,_0x4bd976){_0x2f8782=_0x2f8782-0x0;var _0x59a6a1=_0xdb28[_0x2f8782];return _0x59a6a1;};'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 0af3af1..031a182 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 _0xcf69=['save','update','remove','emit','hook','exports','SmsQueue','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf69,0xbe));var _0x9cf6=function(_0x538633,_0x212f1b){_0x538633=_0x538633-0x0;var _0x211be9=_0xcf69[_0x538633];return _0x211be9;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x9cf6('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9cf6('0x1')](0x0);var events={'afterCreate':_0x9cf6('0x2'),'afterUpdate':_0x9cf6('0x3'),'afterDestroy':_0x9cf6('0x4')};function emitEvent(_0x27e1cc){return function(_0x339188,_0xbdedcd,_0x3667a3){SmsQueueEvents[_0x9cf6('0x5')](_0x27e1cc+':'+_0x339188['id'],_0x339188);SmsQueueEvents['emit'](_0x27e1cc,_0x339188);_0x3667a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x9cf6('0x6')](e,emitEvent(event));}}module[_0x9cf6('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0xf585=['exports','save','update','emit','hasOwnProperty','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf585,0xf7));var _0x5f58=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf585[_0xfae23b];return _0x200640;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5f58('0x0'),'afterUpdate':_0x5f58('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4f022b){return function(_0x212b2c,_0x3c497d,_0x48538e){SmsQueueEvents['emit'](_0x4f022b+':'+_0x212b2c['id'],_0x212b2c);SmsQueueEvents[_0x5f58('0x2')](_0x4f022b,_0x212b2c);_0x48538e(null);};}for(var e in events){if(events[_0x5f58('0x3')](e)){var event=events[e];SmsQueue[_0x5f58('0x4')](e,emitEvent(event));}}module[_0x5f58('0x5')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index e924ce3..d2f58c9 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 _0xbe99=['exports','define','SmsQueue','sms_queues','lodash','util','api','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes'];(function(_0x5ab4cd,_0x5e3220){var _0x353331=function(_0x697a){while(--_0x697a){_0x5ab4cd['push'](_0x5ab4cd['shift']());}};_0x353331(++_0x5e3220);}(_0xbe99,0x190));var _0x9be9=function(_0x3d7c58,_0x5113cb){_0x3d7c58=_0x3d7c58-0x0;var _0x330b65=_0xbe99[_0x3d7c58];return _0x330b65;};'use strict';var _=require(_0x9be9('0x0'));var util=require(_0x9be9('0x1'));var logger=require('../../config/logger')(_0x9be9('0x2'));var moment=require('moment');var BPromise=require(_0x9be9('0x3'));var rp=require(_0x9be9('0x4'));var fs=require('fs');var path=require(_0x9be9('0x5'));var rimraf=require('rimraf');var config=require(_0x9be9('0x6'));var attributes=require(_0x9be9('0x7'));module[_0x9be9('0x8')]=function(_0x47594f,_0x163909){return _0x47594f[_0x9be9('0x9')](_0x9be9('0xa'),attributes,{'tableName':_0x9be9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78ad=['SmsQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0x276f21,_0x5d5821){var _0x4a75e4=function(_0x4e214c){while(--_0x4e214c){_0x276f21['push'](_0x276f21['shift']());}};_0x4a75e4(++_0x5d5821);}(_0x78ad,0x1e1));var _0xd78a=function(_0x2de0f3,_0x358a0a){_0x2de0f3=_0x2de0f3-0x0;var _0x5e992c=_0x78ad[_0x2de0f3];return _0x5e992c;};'use strict';var _=require('lodash');var util=require(_0xd78a('0x0'));var logger=require(_0xd78a('0x1'))(_0xd78a('0x2'));var moment=require(_0xd78a('0x3'));var BPromise=require(_0xd78a('0x4'));var rp=require(_0xd78a('0x5'));var fs=require('fs');var path=require(_0xd78a('0x6'));var rimraf=require(_0xd78a('0x7'));var config=require(_0xd78a('0x8'));var attributes=require(_0xd78a('0x9'));module[_0xd78a('0xa')]=function(_0x4359a2,_0x2a1c3a){return _0x4359a2['define'](_0xd78a('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 5b5f64e..96bf7d8 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 _0x1a3d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','SmsQueue,\x20%s,\x20%s','message','result','SmsQueue','findAll','options','where','attributes','limit','include','map','model','GetSmsQueue','catch','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3f6ec6,_0x370a00){var _0x42ccb6=function(_0x52e0ac){while(--_0x52e0ac){_0x3f6ec6['push'](_0x3f6ec6['shift']());}};_0x42ccb6(++_0x370a00);}(_0x1a3d,0x19e));var _0xd1a3=function(_0xadc85b,_0x2cf6c5){_0xadc85b=_0xadc85b-0x0;var _0x5be2ad=_0x1a3d[_0xadc85b];return _0x5be2ad;};'use strict';var _=require(_0xd1a3('0x0'));var util=require(_0xd1a3('0x1'));var moment=require(_0xd1a3('0x2'));var BPromise=require(_0xd1a3('0x3'));var rs=require(_0xd1a3('0x4'));var fs=require('fs');var Redis=require(_0xd1a3('0x5'));var db=require(_0xd1a3('0x6'))['db'];var utils=require(_0xd1a3('0x7'));var logger=require(_0xd1a3('0x8'))(_0xd1a3('0x9'));var config=require(_0xd1a3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd1a3('0xb')][_0xd1a3('0xc')]({'port':0x232a});config[_0xd1a3('0xd')]=_[_0xd1a3('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd1a3('0xf'))(new Redis(config[_0xd1a3('0xd')]));require(_0xd1a3('0x10'))[_0xd1a3('0x11')](socket);function respondWithRpcPromise(_0x247c92,_0x2ba999,_0x3ef424){return new BPromise(function(_0x337884,_0x68646c){return client['request'](_0x247c92,_0x3ef424)[_0xd1a3('0x12')](function(_0x32b78b){logger[_0xd1a3('0x13')]('SmsQueue,\x20%s,\x20%s',_0x2ba999,_0xd1a3('0x14'));logger[_0xd1a3('0x15')](_0xd1a3('0x16'),_0x2ba999,_0xd1a3('0x14'),JSON['stringify'](_0x32b78b));if(_0x32b78b[_0xd1a3('0x17')]){if(_0x32b78b[_0xd1a3('0x17')][_0xd1a3('0x18')]===0x1f4){logger['error'](_0xd1a3('0x19'),_0x2ba999,_0x32b78b['error'][_0xd1a3('0x1a')]);return _0x68646c(_0x32b78b['error'][_0xd1a3('0x1a')]);}logger[_0xd1a3('0x17')](_0xd1a3('0x19'),_0x2ba999,_0x32b78b['error'][_0xd1a3('0x1a')]);return _0x337884(_0x32b78b[_0xd1a3('0x17')][_0xd1a3('0x1a')]);}else{logger[_0xd1a3('0x13')](_0xd1a3('0x19'),_0x2ba999,_0xd1a3('0x14'));_0x337884(_0x32b78b[_0xd1a3('0x1b')][_0xd1a3('0x1a')]);}})['catch'](function(_0x386ce6){logger[_0xd1a3('0x17')](_0xd1a3('0x19'),_0x2ba999,_0x386ce6);_0x68646c(_0x386ce6);});});}exports['GetSmsQueue']=function(_0x4cc94e){var _0x2198dd=this;return new Promise(function(_0x2d4fa8,_0xdda45){return db[_0xd1a3('0x1c')][_0xd1a3('0x1d')]({'raw':_0x4cc94e[_0xd1a3('0x1e')]?_0x4cc94e['options']['raw']===undefined?!![]:![]:!![],'where':_0x4cc94e['options']?_0x4cc94e[_0xd1a3('0x1e')][_0xd1a3('0x1f')]||null:null,'attributes':_0x4cc94e[_0xd1a3('0x1e')]?_0x4cc94e[_0xd1a3('0x1e')][_0xd1a3('0x20')]||null:null,'limit':_0x4cc94e[_0xd1a3('0x1e')]?_0x4cc94e[_0xd1a3('0x1e')][_0xd1a3('0x21')]||null:null,'include':_0x4cc94e[_0xd1a3('0x1e')]?_0x4cc94e[_0xd1a3('0x1e')][_0xd1a3('0x22')]?_[_0xd1a3('0x23')](_0x4cc94e[_0xd1a3('0x1e')][_0xd1a3('0x22')],function(_0x524923){return{'model':db[_0x524923[_0xd1a3('0x24')]],'as':_0x524923['as'],'attributes':_0x524923[_0xd1a3('0x20')],'include':_0x524923[_0xd1a3('0x22')]?_[_0xd1a3('0x23')](_0x524923['include'],function(_0x469002){return{'model':db[_0x469002[_0xd1a3('0x24')]],'as':_0x469002['as'],'attributes':_0x469002['attributes'],'include':_0x469002[_0xd1a3('0x22')]?_[_0xd1a3('0x23')](_0x469002[_0xd1a3('0x22')],function(_0x12d12d){return{'model':db[_0x12d12d[_0xd1a3('0x24')]],'as':_0x12d12d['as'],'attributes':_0x12d12d[_0xd1a3('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd1a3('0x12')](function(_0x1d90a5){logger[_0xd1a3('0x13')](_0xd1a3('0x25'),_0x4cc94e);logger['debug'](_0xd1a3('0x25'),_0x4cc94e,JSON['stringify'](_0x1d90a5));_0x2d4fa8(_0x1d90a5);})[_0xd1a3('0x26')](function(_0x345c0e){logger[_0xd1a3('0x17')](_0xd1a3('0x25'),_0x345c0e[_0xd1a3('0x1a')],_0x4cc94e);_0xdda45(_0x2198dd[_0xd1a3('0x17')](0x1f4,_0x345c0e[_0xd1a3('0x1a')]));});});};exports[_0xd1a3('0x27')]=function(_0xbc7ef8){var _0x59e660=this;return new Promise(function(_0x18082e,_0x27a17f){return db[_0xd1a3('0x1c')][_0xd1a3('0x28')]({'raw':_0xbc7ef8[_0xd1a3('0x1e')]?_0xbc7ef8[_0xd1a3('0x1e')][_0xd1a3('0x29')]===undefined?!![]:![]:!![],'where':_0xbc7ef8['options']?_0xbc7ef8[_0xd1a3('0x1e')][_0xd1a3('0x1f')]||null:null,'attributes':_0xbc7ef8[_0xd1a3('0x1e')]?_0xbc7ef8[_0xd1a3('0x1e')][_0xd1a3('0x20')]||null:null,'include':_0xbc7ef8['options']?_0xbc7ef8[_0xd1a3('0x1e')][_0xd1a3('0x22')]?_[_0xd1a3('0x23')](_0xbc7ef8[_0xd1a3('0x1e')][_0xd1a3('0x22')],function(_0x3ecd2a){return{'model':db[_0x3ecd2a[_0xd1a3('0x24')]],'as':_0x3ecd2a['as'],'attributes':_0x3ecd2a[_0xd1a3('0x20')],'include':_0x3ecd2a[_0xd1a3('0x22')]?_[_0xd1a3('0x23')](_0x3ecd2a[_0xd1a3('0x22')],function(_0xcaae28){return{'model':db[_0xcaae28[_0xd1a3('0x24')]],'as':_0xcaae28['as'],'attributes':_0xcaae28[_0xd1a3('0x20')],'include':_0xcaae28[_0xd1a3('0x22')]?_['map'](_0xcaae28[_0xd1a3('0x22')],function(_0x489ae7){return{'model':db[_0x489ae7[_0xd1a3('0x24')]],'as':_0x489ae7['as'],'attributes':_0x489ae7['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1a3('0x12')](function(_0x477d12){logger[_0xd1a3('0x13')]('ShowSmsQueue',_0xbc7ef8);logger[_0xd1a3('0x15')](_0xd1a3('0x27'),_0xbc7ef8,JSON['stringify'](_0x477d12));_0x18082e(_0x477d12);})[_0xd1a3('0x26')](function(_0x54f638){logger[_0xd1a3('0x17')](_0xd1a3('0x27'),_0x54f638['message'],_0xbc7ef8);_0x27a17f(_0x59e660[_0xd1a3('0x17')](0x1f4,_0x54f638[_0xd1a3('0x1a')]));});});}; \ No newline at end of file +var _0x8906=['localhost','./smsQueue.socket','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x28b39b,_0x58f18a){var _0x253233=function(_0x464f37){while(--_0x464f37){_0x28b39b['push'](_0x28b39b['shift']());}};_0x253233(++_0x58f18a);}(_0x8906,0xbc));var _0x6890=function(_0x39ac07,_0xabefb4){_0x39ac07=_0x39ac07-0x0;var _0x4b9fc8=_0x8906[_0x39ac07];return _0x4b9fc8;};'use strict';var _=require(_0x6890('0x0'));var util=require(_0x6890('0x1'));var moment=require(_0x6890('0x2'));var BPromise=require(_0x6890('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6890('0x4'));var db=require(_0x6890('0x5'))['db'];var utils=require(_0x6890('0x6'));var logger=require('../../config/logger')(_0x6890('0x7'));var config=require(_0x6890('0x8'));var jayson=require(_0x6890('0x9'));var client=jayson[_0x6890('0xa')]['http']({'port':0x232a});config[_0x6890('0xb')]=_['defaults'](config[_0x6890('0xb')],{'host':_0x6890('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6890('0xb')]));require(_0x6890('0xd'))[_0x6890('0xe')](socket);function respondWithRpcPromise(_0x28c86b,_0x2aa048,_0x164d03){return new BPromise(function(_0x36ed52,_0x56c32d){return client[_0x6890('0xf')](_0x28c86b,_0x164d03)[_0x6890('0x10')](function(_0x236640){logger[_0x6890('0x11')]('SmsQueue,\x20%s,\x20%s',_0x2aa048,_0x6890('0x12'));logger[_0x6890('0x13')](_0x6890('0x14'),_0x2aa048,_0x6890('0x12'),JSON[_0x6890('0x15')](_0x236640));if(_0x236640[_0x6890('0x16')]){if(_0x236640[_0x6890('0x16')][_0x6890('0x17')]===0x1f4){logger[_0x6890('0x16')](_0x6890('0x18'),_0x2aa048,_0x236640[_0x6890('0x16')][_0x6890('0x19')]);return _0x56c32d(_0x236640[_0x6890('0x16')]['message']);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x2aa048,_0x236640[_0x6890('0x16')]['message']);return _0x36ed52(_0x236640['error'][_0x6890('0x19')]);}else{logger['info'](_0x6890('0x18'),_0x2aa048,_0x6890('0x12'));_0x36ed52(_0x236640['result'][_0x6890('0x19')]);}})[_0x6890('0x1a')](function(_0x5259d4){logger['error'](_0x6890('0x18'),_0x2aa048,_0x5259d4);_0x56c32d(_0x5259d4);});});}exports[_0x6890('0x1b')]=function(_0x340b4e){var _0x49df81=this;return new Promise(function(_0x35e76a,_0x3471e3){return db[_0x6890('0x1c')][_0x6890('0x1d')]({'raw':_0x340b4e[_0x6890('0x1e')]?_0x340b4e[_0x6890('0x1e')][_0x6890('0x1f')]===undefined?!![]:![]:!![],'where':_0x340b4e['options']?_0x340b4e[_0x6890('0x1e')][_0x6890('0x20')]||null:null,'attributes':_0x340b4e['options']?_0x340b4e[_0x6890('0x1e')][_0x6890('0x21')]||null:null,'limit':_0x340b4e[_0x6890('0x1e')]?_0x340b4e['options'][_0x6890('0x22')]||null:null,'include':_0x340b4e[_0x6890('0x1e')]?_0x340b4e[_0x6890('0x1e')][_0x6890('0x23')]?_[_0x6890('0x24')](_0x340b4e[_0x6890('0x1e')][_0x6890('0x23')],function(_0x490c92){return{'model':db[_0x490c92[_0x6890('0x25')]],'as':_0x490c92['as'],'attributes':_0x490c92['attributes'],'include':_0x490c92[_0x6890('0x23')]?_[_0x6890('0x24')](_0x490c92[_0x6890('0x23')],function(_0x5523e2){return{'model':db[_0x5523e2['model']],'as':_0x5523e2['as'],'attributes':_0x5523e2[_0x6890('0x21')],'include':_0x5523e2[_0x6890('0x23')]?_[_0x6890('0x24')](_0x5523e2[_0x6890('0x23')],function(_0xa6bada){return{'model':db[_0xa6bada[_0x6890('0x25')]],'as':_0xa6bada['as'],'attributes':_0xa6bada[_0x6890('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56b5b1){logger[_0x6890('0x11')](_0x6890('0x1b'),_0x340b4e);logger[_0x6890('0x13')](_0x6890('0x1b'),_0x340b4e,JSON[_0x6890('0x15')](_0x56b5b1));_0x35e76a(_0x56b5b1);})[_0x6890('0x1a')](function(_0x416ec3){logger['error']('GetSmsQueue',_0x416ec3[_0x6890('0x19')],_0x340b4e);_0x3471e3(_0x49df81[_0x6890('0x16')](0x1f4,_0x416ec3[_0x6890('0x19')]));});});};exports[_0x6890('0x26')]=function(_0x1f6938){var _0x1f17f8=this;return new Promise(function(_0x32c65c,_0x2ecf60){return db[_0x6890('0x1c')][_0x6890('0x27')]({'raw':_0x1f6938[_0x6890('0x1e')]?_0x1f6938[_0x6890('0x1e')][_0x6890('0x1f')]===undefined?!![]:![]:!![],'where':_0x1f6938[_0x6890('0x1e')]?_0x1f6938[_0x6890('0x1e')][_0x6890('0x20')]||null:null,'attributes':_0x1f6938['options']?_0x1f6938[_0x6890('0x1e')][_0x6890('0x21')]||null:null,'include':_0x1f6938[_0x6890('0x1e')]?_0x1f6938[_0x6890('0x1e')]['include']?_[_0x6890('0x24')](_0x1f6938[_0x6890('0x1e')][_0x6890('0x23')],function(_0x56200d){return{'model':db[_0x56200d[_0x6890('0x25')]],'as':_0x56200d['as'],'attributes':_0x56200d[_0x6890('0x21')],'include':_0x56200d[_0x6890('0x23')]?_[_0x6890('0x24')](_0x56200d[_0x6890('0x23')],function(_0x2aca09){return{'model':db[_0x2aca09[_0x6890('0x25')]],'as':_0x2aca09['as'],'attributes':_0x2aca09[_0x6890('0x21')],'include':_0x2aca09[_0x6890('0x23')]?_[_0x6890('0x24')](_0x2aca09[_0x6890('0x23')],function(_0x42ad60){return{'model':db[_0x42ad60[_0x6890('0x25')]],'as':_0x42ad60['as'],'attributes':_0x42ad60[_0x6890('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6890('0x10')](function(_0x1d5d71){logger[_0x6890('0x11')](_0x6890('0x26'),_0x1f6938);logger[_0x6890('0x13')](_0x6890('0x26'),_0x1f6938,JSON[_0x6890('0x15')](_0x1d5d71));_0x32c65c(_0x1d5d71);})['catch'](function(_0x300740){logger[_0x6890('0x16')]('ShowSmsQueue',_0x300740[_0x6890('0x19')],_0x1f6938);_0x2ecf60(_0x1f17f8[_0x6890('0x16')](0x1f4,_0x300740[_0x6890('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 12df08b..427c737 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 _0x6815=['update','emit','register','length','smsQueue:','./smsQueue.events','remove'];(function(_0x5cdc52,_0x33ce72){var _0x455283=function(_0x54070d){while(--_0x54070d){_0x5cdc52['push'](_0x5cdc52['shift']());}};_0x455283(++_0x33ce72);}(_0x6815,0x10f));var _0x5681=function(_0x1bd465,_0x5b5b1a){_0x1bd465=_0x1bd465-0x0;var _0x1a7aaa=_0x6815[_0x1bd465];return _0x1a7aaa;};'use strict';var SmsQueueEvents=require(_0x5681('0x0'));var events=['save',_0x5681('0x1'),_0x5681('0x2')];function createListener(_0x1305a6,_0x56af64){return function(_0x301603){_0x56af64[_0x5681('0x3')](_0x1305a6,_0x301603);};}function removeListener(_0x345385,_0x48431f){return function(){SmsQueueEvents['removeListener'](_0x345385,_0x48431f);};}exports[_0x5681('0x4')]=function(_0x2950be){for(var _0x233b25=0x0,_0x51a5c5=events[_0x5681('0x5')];_0x233b25<_0x51a5c5;_0x233b25++){var _0xee5234=events[_0x233b25];var _0xfcc182=createListener(_0x5681('0x6')+_0xee5234,_0x2950be);SmsQueueEvents['on'](_0xee5234,_0xfcc182);}}; \ No newline at end of file +var _0xae77=['remove','update','emit','removeListener','./smsQueue.events','save'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xae77,0x196));var _0x7ae7=function(_0x115f84,_0x5f5c55){_0x115f84=_0x115f84-0x0;var _0x53c7d4=_0xae77[_0x115f84];return _0x53c7d4;};'use strict';var SmsQueueEvents=require(_0x7ae7('0x0'));var events=[_0x7ae7('0x1'),_0x7ae7('0x2'),_0x7ae7('0x3')];function createListener(_0x400371,_0x4ba2ad){return function(_0x517109){_0x4ba2ad[_0x7ae7('0x4')](_0x400371,_0x517109);};}function removeListener(_0x8f30ad,_0x53bfc5){return function(){SmsQueueEvents[_0x7ae7('0x5')](_0x8f30ad,_0x53bfc5);};}exports['register']=function(_0x3e98e1){for(var _0x179086=0x0,_0x53256e=events['length'];_0x179086<_0x53256e;_0x179086++){var _0x51512c=events[_0x179086];var _0x444876=createListener('smsQueue:'+_0x51512c,_0x3e98e1);SmsQueueEvents['on'](_0x51512c,_0x444876);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 85fbacd..f0e389a 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 _0xabd7=['/:id','post','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe'];(function(_0x21b62a,_0x592986){var _0x35e8ce=function(_0x278b73){while(--_0x278b73){_0x21b62a['push'](_0x21b62a['shift']());}};_0x35e8ce(++_0x592986);}(_0xabd7,0x6b));var _0x7abd=function(_0x4482b7,_0x2e4f0e){_0x4482b7=_0x4482b7-0x0;var _0x2aef2f=_0xabd7[_0x4482b7];return _0x2aef2f;};'use strict';var multer=require('multer');var util=require(_0x7abd('0x0'));var path=require(_0x7abd('0x1'));var timeout=require(_0x7abd('0x2'));var express=require(_0x7abd('0x3'));var router=express[_0x7abd('0x4')]();var fs_extra=require(_0x7abd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7abd('0x6'));var config=require(_0x7abd('0x7'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x7abd('0x8')](),controller['index']);router[_0x7abd('0x9')](_0x7abd('0xa'),auth[_0x7abd('0x8')](),controller[_0x7abd('0xb')]);router['get'](_0x7abd('0xc'),auth[_0x7abd('0x8')](),controller['show']);router[_0x7abd('0xd')]('/',auth[_0x7abd('0x8')](),controller['create']);router[_0x7abd('0xe')](_0x7abd('0xc'),auth['isAuthenticated'](),controller[_0x7abd('0xf')]);router[_0x7abd('0x10')](_0x7abd('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf22c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x3ab7ea,_0x23b0f0){var _0x2eab6f=function(_0x58f051){while(--_0x58f051){_0x3ab7ea['push'](_0x3ab7ea['shift']());}};_0x2eab6f(++_0x23b0f0);}(_0xf22c,0x19f));var _0xcf22=function(_0x2e185e,_0x2c061a){_0x2e185e=_0x2e185e-0x0;var _0x23687c=_0xf22c[_0x2e185e];return _0x23687c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcf22('0x0'));var timeout=require(_0xcf22('0x1'));var express=require(_0xcf22('0x2'));var router=express[_0xcf22('0x3')]();var fs_extra=require(_0xcf22('0x4'));var auth=require(_0xcf22('0x5'));var interaction=require(_0xcf22('0x6'));var config=require(_0xcf22('0x7'));var controller=require(_0xcf22('0x8'));router['get']('/',auth[_0xcf22('0x9')](),controller['index']);router[_0xcf22('0xa')](_0xcf22('0xb'),auth[_0xcf22('0x9')](),controller[_0xcf22('0xc')]);router[_0xcf22('0xa')](_0xcf22('0xd'),auth[_0xcf22('0x9')](),controller[_0xcf22('0xe')]);router[_0xcf22('0xf')]('/',auth[_0xcf22('0x9')](),controller[_0xcf22('0x10')]);router[_0xcf22('0x11')](_0xcf22('0xd'),auth[_0xcf22('0x9')](),controller[_0xcf22('0x12')]);router[_0xcf22('0x13')](_0xcf22('0xd'),auth[_0xcf22('0x9')](),controller[_0xcf22('0x14')]);module[_0xcf22('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index c0db0c0..f3a5f37 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 _0x6b35=['STRING','DATE','moment','sequelize','exports'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0x6b35,0x1f1));var _0x56b3=function(_0x980451,_0x38ac25){_0x980451=_0x980451-0x0;var _0x471258=_0x6b35[_0x980451];return _0x471258;};'use strict';var moment=require(_0x56b3('0x0'));var Sequelize=require(_0x56b3('0x1'));module[_0x56b3('0x2')]={'uniqueid':{'type':Sequelize[_0x56b3('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x56b3('0x4')]},'leaveAt':{'type':Sequelize[_0x56b3('0x4')]},'acceptAt':{'type':Sequelize[_0x56b3('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x56b3('0x3')]}}; \ No newline at end of file +var _0x757b=['sequelize','STRING','DATE','moment'];(function(_0x313352,_0x4f9bd4){var _0x217947=function(_0x5c63fe){while(--_0x5c63fe){_0x313352['push'](_0x313352['shift']());}};_0x217947(++_0x4f9bd4);}(_0x757b,0xa7));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xb757('0x0'));var Sequelize=require(_0xb757('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb757('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb757('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb757('0x3')]},'exitAt':{'type':Sequelize[_0xb757('0x3')]},'reason':{'type':Sequelize[_0xb757('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 306101b..5eef818 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 _0x34e3=['findAll','rows','catch','params','rawAttributes','includeAll','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','map','SmsQueueReport','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x366195,_0x50da84){var _0xf37646=function(_0x53a253){while(--_0x53a253){_0x366195['push'](_0x366195['shift']());}};_0xf37646(++_0x50da84);}(_0x34e3,0x97));var _0x334e=function(_0x43918d,_0x255ee2){_0x43918d=_0x43918d-0x0;var _0xdf6288=_0x34e3[_0x43918d];return _0xdf6288;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x334e('0x0'));var jsonpatch=require(_0x334e('0x1'));var rp=require(_0x334e('0x2'));var moment=require(_0x334e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x334e('0x4'));var path=require(_0x334e('0x5'));var sox=require(_0x334e('0x6'));var csv=require(_0x334e('0x7'));var ejs=require(_0x334e('0x8'));var fs=require('fs');var fs_extra=require(_0x334e('0x9'));var _=require(_0x334e('0xa'));var squel=require(_0x334e('0xb'));var crypto=require(_0x334e('0xc'));var jsforce=require(_0x334e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x334e('0x7'));var querystring=require('querystring');var Papa=require(_0x334e('0xe'));var Redis=require(_0x334e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x334e('0x10'));var as=require(_0x334e('0x11'));var hardwareService=require(_0x334e('0x12'));var logger=require(_0x334e('0x13'))(_0x334e('0x14'));var utils=require('../../config/utils');var config=require(_0x334e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x334e('0x16'))['db'];function respondWithStatusCode(_0x1c2b47,_0xc26f23){_0xc26f23=_0xc26f23||0xcc;return function(_0x3131aa){if(_0x3131aa){return _0x1c2b47[_0x334e('0x17')](_0xc26f23);}return _0x1c2b47[_0x334e('0x18')](_0xc26f23)[_0x334e('0x19')]();};}function respondWithResult(_0x4081fd,_0x381e8d){_0x381e8d=_0x381e8d||0xc8;return function(_0x10a55b){if(_0x10a55b){return _0x4081fd[_0x334e('0x18')](_0x381e8d)[_0x334e('0x1a')](_0x10a55b);}};}function respondWithFilteredResult(_0xd392a1,_0x1e04e0){return function(_0x3a23c6){if(_0x3a23c6){var _0x1f1c07=typeof _0x1e04e0[_0x334e('0x1b')]===_0x334e('0x1c')&&typeof _0x1e04e0[_0x334e('0x1d')]==='undefined';var _0x58f967=_0x3a23c6[_0x334e('0x1e')];var _0x1aaf37=_0x1f1c07?0x0:_0x1e04e0[_0x334e('0x1b')];var _0x2d02a5=_0x1f1c07?_0x3a23c6[_0x334e('0x1e')]:_0x1e04e0[_0x334e('0x1b')]+_0x1e04e0['limit'];var _0x2fdd29;if(_0x2d02a5>=_0x58f967){_0x2d02a5=_0x58f967;_0x2fdd29=0xc8;}else{_0x2fdd29=0xce;}_0xd392a1['status'](_0x2fdd29);return _0xd392a1[_0x334e('0x1f')]('Content-Range',_0x1aaf37+'-'+_0x2d02a5+'/'+_0x58f967)['json'](_0x3a23c6);}return null;};}function patchUpdates(_0x36ad5b){return function(_0x5b0fa3){try{jsonpatch[_0x334e('0x20')](_0x5b0fa3,_0x36ad5b,!![]);}catch(_0x4d09e8){return BPromise[_0x334e('0x21')](_0x4d09e8);}return _0x5b0fa3[_0x334e('0x22')]();};}function saveUpdates(_0x4ac0b8,_0x4c2144){return function(_0x153d47){if(_0x153d47){return _0x153d47['update'](_0x4ac0b8)[_0x334e('0x23')](function(_0x44eb09){return _0x44eb09;});}return null;};}function removeEntity(_0x4d6c92,_0x155ef6){return function(_0x22da1e){if(_0x22da1e){return _0x22da1e[_0x334e('0x24')]()[_0x334e('0x23')](function(){_0x4d6c92[_0x334e('0x18')](0xcc)[_0x334e('0x19')]();});}};}function handleEntityNotFound(_0x192744,_0x342a0a){return function(_0x23be11){if(!_0x23be11){_0x192744[_0x334e('0x17')](0x194);}return _0x23be11;};}function handleError(_0x34337a,_0x486f77){_0x486f77=_0x486f77||0x1f4;return function(_0x27ea67){logger[_0x334e('0x25')](_0x27ea67[_0x334e('0x26')]);if(_0x27ea67[_0x334e('0x27')]){delete _0x27ea67[_0x334e('0x27')];}_0x34337a[_0x334e('0x18')](_0x486f77)[_0x334e('0x28')](_0x27ea67);};}exports['index']=function(_0x1894ec,_0x5bfc12){var _0x5d8d74={},_0x36ac3f={},_0x57b457={'count':0x0,'rows':[]};var _0x4d198e=_[_0x334e('0x29')](db[_0x334e('0x2a')]['rawAttributes'],function(_0x3eeb59){return{'name':_0x3eeb59['fieldName'],'type':_0x3eeb59[_0x334e('0x2b')][_0x334e('0x2c')]};});_0x36ac3f[_0x334e('0x2d')]=_[_0x334e('0x29')](_0x4d198e,_0x334e('0x27'));_0x36ac3f[_0x334e('0x2e')]=_[_0x334e('0x2f')](_0x1894ec['query']);_0x36ac3f[_0x334e('0x30')]=_['intersection'](_0x36ac3f['model'],_0x36ac3f[_0x334e('0x2e')]);_0x5d8d74['attributes']=_[_0x334e('0x31')](_0x36ac3f[_0x334e('0x2d')],qs[_0x334e('0x32')](_0x1894ec['query'][_0x334e('0x32')]));_0x5d8d74[_0x334e('0x33')]=_0x5d8d74['attributes'][_0x334e('0x34')]?_0x5d8d74['attributes']:_0x36ac3f[_0x334e('0x2d')];if(!_0x1894ec['query'][_0x334e('0x35')]('nolimit')){_0x5d8d74[_0x334e('0x1d')]=qs[_0x334e('0x1d')](_0x1894ec[_0x334e('0x2e')][_0x334e('0x1d')]);_0x5d8d74[_0x334e('0x1b')]=qs[_0x334e('0x1b')](_0x1894ec[_0x334e('0x2e')][_0x334e('0x1b')]);}_0x5d8d74['order']=qs[_0x334e('0x36')](_0x1894ec['query']['sort']);_0x5d8d74[_0x334e('0x37')]=qs[_0x334e('0x30')](_[_0x334e('0x38')](_0x1894ec[_0x334e('0x2e')],_0x36ac3f['filters']),_0x4d198e);if(_0x1894ec['query'][_0x334e('0x39')]){_0x5d8d74[_0x334e('0x37')]=_[_0x334e('0x3a')](_0x5d8d74[_0x334e('0x37')],{'$or':_[_0x334e('0x29')](_0x4d198e,function(_0x2eccd9){if(_0x2eccd9['type']!==_0x334e('0x3b')){var _0x4c34aa={};_0x4c34aa[_0x2eccd9[_0x334e('0x27')]]={'$like':'%'+_0x1894ec['query'][_0x334e('0x39')]+'%'};return _0x4c34aa;}})});}_0x5d8d74=_[_0x334e('0x3a')]({},_0x5d8d74,_0x1894ec[_0x334e('0x3c')]);var _0x2f56bf={'where':_0x5d8d74[_0x334e('0x37')]};return db[_0x334e('0x2a')][_0x334e('0x1e')](_0x2f56bf)['then'](function(_0x3f08c0){_0x57b457[_0x334e('0x1e')]=_0x3f08c0;if(_0x1894ec[_0x334e('0x2e')]['includeAll']){_0x5d8d74[_0x334e('0x3d')]=[{'all':!![]}];}return db[_0x334e('0x2a')][_0x334e('0x3e')](_0x5d8d74);})[_0x334e('0x23')](function(_0x18f4be){_0x57b457[_0x334e('0x3f')]=_0x18f4be;return _0x57b457;})[_0x334e('0x23')](respondWithFilteredResult(_0x5bfc12,_0x5d8d74))[_0x334e('0x40')](handleError(_0x5bfc12,null));};exports['show']=function(_0x36c682,_0x55456e){var _0x48759d={'raw':!![],'where':{'id':_0x36c682[_0x334e('0x41')]['id']}},_0x3d745c={};_0x3d745c[_0x334e('0x2d')]=_[_0x334e('0x2f')](db['SmsQueueReport'][_0x334e('0x42')]);_0x3d745c[_0x334e('0x2e')]=_[_0x334e('0x2f')](_0x36c682[_0x334e('0x2e')]);_0x3d745c[_0x334e('0x30')]=_[_0x334e('0x31')](_0x3d745c[_0x334e('0x2d')],_0x3d745c[_0x334e('0x2e')]);_0x48759d[_0x334e('0x33')]=_['intersection'](_0x3d745c[_0x334e('0x2d')],qs[_0x334e('0x32')](_0x36c682[_0x334e('0x2e')][_0x334e('0x32')]));_0x48759d[_0x334e('0x33')]=_0x48759d[_0x334e('0x33')]['length']?_0x48759d['attributes']:_0x3d745c['model'];if(_0x36c682[_0x334e('0x2e')][_0x334e('0x43')]){_0x48759d[_0x334e('0x3d')]=[{'all':!![]}];}_0x48759d=_[_0x334e('0x3a')]({},_0x48759d,_0x36c682[_0x334e('0x3c')]);return db[_0x334e('0x2a')]['find'](_0x48759d)[_0x334e('0x23')](handleEntityNotFound(_0x55456e,null))[_0x334e('0x23')](respondWithResult(_0x55456e,null))[_0x334e('0x40')](handleError(_0x55456e,null));};exports[_0x334e('0x44')]=function(_0x3cbe6c,_0x1af8aa){return db[_0x334e('0x2a')][_0x334e('0x44')](_0x3cbe6c[_0x334e('0x45')],{})[_0x334e('0x23')](respondWithResult(_0x1af8aa,0xc9))[_0x334e('0x40')](handleError(_0x1af8aa,null));};exports['update']=function(_0xaebe7,_0x51e203){if(_0xaebe7[_0x334e('0x45')]['id']){delete _0xaebe7[_0x334e('0x45')]['id'];}return db[_0x334e('0x2a')]['find']({'where':{'id':_0xaebe7[_0x334e('0x41')]['id']}})['then'](handleEntityNotFound(_0x51e203,null))['then'](saveUpdates(_0xaebe7['body'],null))[_0x334e('0x23')](respondWithResult(_0x51e203,null))[_0x334e('0x40')](handleError(_0x51e203,null));};exports[_0x334e('0x24')]=function(_0x3233ed,_0x3c6b09){return db[_0x334e('0x2a')]['find']({'where':{'id':_0x3233ed[_0x334e('0x41')]['id']}})[_0x334e('0x23')](handleEntityNotFound(_0x3c6b09,null))[_0x334e('0x23')](removeEntity(_0x3c6b09,null))['catch'](handleError(_0x3c6b09,null));};exports['describe']=function(_0x4374ad,_0x3dfbd2){return db['SmsQueueReport'][_0x334e('0x46')]()['then'](respondWithResult(_0x3dfbd2,null))[_0x334e('0x40')](handleError(_0x3dfbd2,null));}; \ No newline at end of file +var _0xa663=['apply','save','update','then','destroy','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x39195c,_0x509c6c){var _0xd4ddfb=function(_0x4255dc){while(--_0x4255dc){_0x39195c['push'](_0x39195c['shift']());}};_0xd4ddfb(++_0x509c6c);}(_0xa663,0x159));var _0x3a66=function(_0x2d6d88,_0x2ea070){_0x2d6d88=_0x2d6d88-0x0;var _0x1991b0=_0xa663[_0x2d6d88];return _0x1991b0;};'use strict';var emlformat=require(_0x3a66('0x0'));var rimraf=require(_0x3a66('0x1'));var zipdir=require(_0x3a66('0x2'));var jsonpatch=require(_0x3a66('0x3'));var rp=require(_0x3a66('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3a66('0x5'));var sox=require(_0x3a66('0x6'));var csv=require('to-csv');var ejs=require(_0x3a66('0x7'));var fs=require('fs');var fs_extra=require(_0x3a66('0x8'));var _=require(_0x3a66('0x9'));var squel=require(_0x3a66('0xa'));var crypto=require(_0x3a66('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3a66('0xc'));var toCsv=require(_0x3a66('0xd'));var querystring=require(_0x3a66('0xe'));var Papa=require('papaparse');var Redis=require(_0x3a66('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3a66('0x10'));var as=require(_0x3a66('0x11'));var hardwareService=require(_0x3a66('0x12'));var logger=require(_0x3a66('0x13'))(_0x3a66('0x14'));var utils=require(_0x3a66('0x15'));var config=require(_0x3a66('0x16'));var licenseUtil=require(_0x3a66('0x17'));var db=require(_0x3a66('0x18'))['db'];function respondWithStatusCode(_0x242215,_0x169d8a){_0x169d8a=_0x169d8a||0xcc;return function(_0x737f9c){if(_0x737f9c){return _0x242215[_0x3a66('0x19')](_0x169d8a);}return _0x242215[_0x3a66('0x1a')](_0x169d8a)[_0x3a66('0x1b')]();};}function respondWithResult(_0x5f5193,_0x2e0af9){_0x2e0af9=_0x2e0af9||0xc8;return function(_0x2cafa5){if(_0x2cafa5){return _0x5f5193[_0x3a66('0x1a')](_0x2e0af9)[_0x3a66('0x1c')](_0x2cafa5);}};}function respondWithFilteredResult(_0x242c47,_0xb0d6df){return function(_0x29cfd4){if(_0x29cfd4){var _0x4f4efb=typeof _0xb0d6df[_0x3a66('0x1d')]===_0x3a66('0x1e')&&typeof _0xb0d6df['limit']==='undefined';var _0x3ec8b4=_0x29cfd4[_0x3a66('0x1f')];var _0x145eea=_0x4f4efb?0x0:_0xb0d6df[_0x3a66('0x1d')];var _0x56b74f=_0x4f4efb?_0x29cfd4[_0x3a66('0x1f')]:_0xb0d6df['offset']+_0xb0d6df[_0x3a66('0x20')];var _0x37bde1;if(_0x56b74f>=_0x3ec8b4){_0x56b74f=_0x3ec8b4;_0x37bde1=0xc8;}else{_0x37bde1=0xce;}_0x242c47[_0x3a66('0x1a')](_0x37bde1);return _0x242c47[_0x3a66('0x21')](_0x3a66('0x22'),_0x145eea+'-'+_0x56b74f+'/'+_0x3ec8b4)['json'](_0x29cfd4);}return null;};}function patchUpdates(_0xafbd5){return function(_0x3c07f5){try{jsonpatch[_0x3a66('0x23')](_0x3c07f5,_0xafbd5,!![]);}catch(_0x427a6f){return BPromise['reject'](_0x427a6f);}return _0x3c07f5[_0x3a66('0x24')]();};}function saveUpdates(_0x7ef713,_0x2eab48){return function(_0x476f56){if(_0x476f56){return _0x476f56[_0x3a66('0x25')](_0x7ef713)[_0x3a66('0x26')](function(_0x11fc21){return _0x11fc21;});}return null;};}function removeEntity(_0xc4df65,_0x4e80d5){return function(_0xe38c7c){if(_0xe38c7c){return _0xe38c7c[_0x3a66('0x27')]()[_0x3a66('0x26')](function(){_0xc4df65['status'](0xcc)[_0x3a66('0x1b')]();});}};}function handleEntityNotFound(_0x15ed75,_0x17015a){return function(_0x290de8){if(!_0x290de8){_0x15ed75['sendStatus'](0x194);}return _0x290de8;};}function handleError(_0x1f7bbe,_0x41ea72){_0x41ea72=_0x41ea72||0x1f4;return function(_0x4a9eec){logger[_0x3a66('0x28')](_0x4a9eec[_0x3a66('0x29')]);if(_0x4a9eec[_0x3a66('0x2a')]){delete _0x4a9eec[_0x3a66('0x2a')];}_0x1f7bbe[_0x3a66('0x1a')](_0x41ea72)[_0x3a66('0x2b')](_0x4a9eec);};}exports[_0x3a66('0x2c')]=function(_0x2ce50c,_0x564106){var _0x2c5c49={},_0x39248d={},_0x460c30={'count':0x0,'rows':[]};var _0x321e26=_['map'](db[_0x3a66('0x2d')][_0x3a66('0x2e')],function(_0x1ab8bf){return{'name':_0x1ab8bf[_0x3a66('0x2f')],'type':_0x1ab8bf[_0x3a66('0x30')]['key']};});_0x39248d['model']=_[_0x3a66('0x31')](_0x321e26,_0x3a66('0x2a'));_0x39248d[_0x3a66('0x32')]=_[_0x3a66('0x33')](_0x2ce50c[_0x3a66('0x32')]);_0x39248d[_0x3a66('0x34')]=_['intersection'](_0x39248d['model'],_0x39248d[_0x3a66('0x32')]);_0x2c5c49['attributes']=_[_0x3a66('0x35')](_0x39248d[_0x3a66('0x36')],qs[_0x3a66('0x37')](_0x2ce50c[_0x3a66('0x32')]['fields']));_0x2c5c49[_0x3a66('0x38')]=_0x2c5c49[_0x3a66('0x38')]['length']?_0x2c5c49['attributes']:_0x39248d[_0x3a66('0x36')];if(!_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x39')](_0x3a66('0x3a'))){_0x2c5c49['limit']=qs[_0x3a66('0x20')](_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x20')]);_0x2c5c49[_0x3a66('0x1d')]=qs[_0x3a66('0x1d')](_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x1d')]);}_0x2c5c49[_0x3a66('0x3b')]=qs[_0x3a66('0x3c')](_0x2ce50c['query']['sort']);_0x2c5c49[_0x3a66('0x3d')]=qs[_0x3a66('0x34')](_[_0x3a66('0x3e')](_0x2ce50c[_0x3a66('0x32')],_0x39248d[_0x3a66('0x34')]),_0x321e26);if(_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x3f')]){_0x2c5c49[_0x3a66('0x3d')]=_[_0x3a66('0x40')](_0x2c5c49['where'],{'$or':_['map'](_0x321e26,function(_0x4f6fac){if(_0x4f6fac['type']!==_0x3a66('0x41')){var _0xee04fb={};_0xee04fb[_0x4f6fac[_0x3a66('0x2a')]]={'$like':'%'+_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x3f')]+'%'};return _0xee04fb;}})});}_0x2c5c49=_[_0x3a66('0x40')]({},_0x2c5c49,_0x2ce50c[_0x3a66('0x42')]);var _0x248118={'where':_0x2c5c49[_0x3a66('0x3d')]};return db[_0x3a66('0x2d')]['count'](_0x248118)[_0x3a66('0x26')](function(_0x1526d8){_0x460c30[_0x3a66('0x1f')]=_0x1526d8;if(_0x2ce50c[_0x3a66('0x32')][_0x3a66('0x43')]){_0x2c5c49[_0x3a66('0x44')]=[{'all':!![]}];}return db[_0x3a66('0x2d')]['findAll'](_0x2c5c49);})[_0x3a66('0x26')](function(_0x4305a7){_0x460c30['rows']=_0x4305a7;return _0x460c30;})[_0x3a66('0x26')](respondWithFilteredResult(_0x564106,_0x2c5c49))[_0x3a66('0x45')](handleError(_0x564106,null));};exports[_0x3a66('0x46')]=function(_0x54430a,_0x4a9467){var _0x452616={'raw':!![],'where':{'id':_0x54430a[_0x3a66('0x47')]['id']}},_0x443881={};_0x443881[_0x3a66('0x36')]=_[_0x3a66('0x33')](db[_0x3a66('0x2d')][_0x3a66('0x2e')]);_0x443881[_0x3a66('0x32')]=_['keys'](_0x54430a[_0x3a66('0x32')]);_0x443881[_0x3a66('0x34')]=_[_0x3a66('0x35')](_0x443881['model'],_0x443881[_0x3a66('0x32')]);_0x452616[_0x3a66('0x38')]=_['intersection'](_0x443881['model'],qs['fields'](_0x54430a[_0x3a66('0x32')]['fields']));_0x452616[_0x3a66('0x38')]=_0x452616[_0x3a66('0x38')][_0x3a66('0x48')]?_0x452616[_0x3a66('0x38')]:_0x443881['model'];if(_0x54430a[_0x3a66('0x32')][_0x3a66('0x43')]){_0x452616['include']=[{'all':!![]}];}_0x452616=_[_0x3a66('0x40')]({},_0x452616,_0x54430a['options']);return db[_0x3a66('0x2d')][_0x3a66('0x49')](_0x452616)[_0x3a66('0x26')](handleEntityNotFound(_0x4a9467,null))[_0x3a66('0x26')](respondWithResult(_0x4a9467,null))[_0x3a66('0x45')](handleError(_0x4a9467,null));};exports[_0x3a66('0x4a')]=function(_0x5ef124,_0x1428d4){return db[_0x3a66('0x2d')][_0x3a66('0x4a')](_0x5ef124[_0x3a66('0x4b')],{})[_0x3a66('0x26')](respondWithResult(_0x1428d4,0xc9))[_0x3a66('0x45')](handleError(_0x1428d4,null));};exports[_0x3a66('0x25')]=function(_0x24715d,_0x4865a8){if(_0x24715d['body']['id']){delete _0x24715d[_0x3a66('0x4b')]['id'];}return db[_0x3a66('0x2d')]['find']({'where':{'id':_0x24715d[_0x3a66('0x47')]['id']}})['then'](handleEntityNotFound(_0x4865a8,null))[_0x3a66('0x26')](saveUpdates(_0x24715d[_0x3a66('0x4b')],null))['then'](respondWithResult(_0x4865a8,null))[_0x3a66('0x45')](handleError(_0x4865a8,null));};exports['destroy']=function(_0x584271,_0x9c7fcc){return db[_0x3a66('0x2d')][_0x3a66('0x49')]({'where':{'id':_0x584271[_0x3a66('0x47')]['id']}})[_0x3a66('0x26')](handleEntityNotFound(_0x9c7fcc,null))[_0x3a66('0x26')](removeEntity(_0x9c7fcc,null))[_0x3a66('0x45')](handleError(_0x9c7fcc,null));};exports['describe']=function(_0x5bd95d,_0x1520e0){return db[_0x3a66('0x2d')]['describe']()[_0x3a66('0x26')](respondWithResult(_0x1520e0,null))[_0x3a66('0x45')](handleError(_0x1520e0,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 754abf5..1e5cc00 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x13315d,_0x1d9044){var _0x51d04e=function(_0xc25963){while(--_0xc25963){_0x13315d['push'](_0x13315d['shift']());}};_0x51d04e(++_0x1d9044);}(_0xb7e7,0x121));var _0x7b7e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xb7e7[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 686ad31..a864e18 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 _0x4f22=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','update','attributes','limit','UpdateSmsQueueReport','debug','catch','lodash','util','moment'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x4f22,0x1aa));var _0x24f2=function(_0x1e9bd9,_0x18a90a){_0x1e9bd9=_0x1e9bd9-0x0;var _0x2076d6=_0x4f22[_0x1e9bd9];return _0x2076d6;};'use strict';var _=require(_0x24f2('0x0'));var util=require(_0x24f2('0x1'));var moment=require(_0x24f2('0x2'));var BPromise=require(_0x24f2('0x3'));var rs=require(_0x24f2('0x4'));var fs=require('fs');var Redis=require(_0x24f2('0x5'));var db=require(_0x24f2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x24f2('0x7'));var config=require('../../config/environment');var jayson=require(_0x24f2('0x8'));var client=jayson[_0x24f2('0x9')][_0x24f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32cbba,_0x11948f,_0x4ce78f){return new BPromise(function(_0x3cbedb,_0x359191){return client[_0x24f2('0xb')](_0x32cbba,_0x4ce78f)[_0x24f2('0xc')](function(_0x495456){logger[_0x24f2('0xd')](_0x24f2('0xe'),_0x11948f,_0x24f2('0xf'));logger['debug'](_0x24f2('0x10'),_0x11948f,'request\x20sent',JSON[_0x24f2('0x11')](_0x495456));if(_0x495456['error']){if(_0x495456[_0x24f2('0x12')][_0x24f2('0x13')]===0x1f4){logger[_0x24f2('0x12')](_0x24f2('0xe'),_0x11948f,_0x495456[_0x24f2('0x12')][_0x24f2('0x14')]);return _0x359191(_0x495456[_0x24f2('0x12')][_0x24f2('0x14')]);}logger[_0x24f2('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x11948f,_0x495456[_0x24f2('0x12')][_0x24f2('0x14')]);return _0x3cbedb(_0x495456[_0x24f2('0x12')][_0x24f2('0x14')]);}else{logger['info'](_0x24f2('0xe'),_0x11948f,_0x24f2('0xf'));_0x3cbedb(_0x495456[_0x24f2('0x15')][_0x24f2('0x14')]);}})['catch'](function(_0x8acbd4){logger[_0x24f2('0x12')](_0x24f2('0xe'),_0x11948f,_0x8acbd4);_0x359191(_0x8acbd4);});});}exports[_0x24f2('0x16')]=function(_0x12dde9){var _0x462b64=this;return new Promise(function(_0x3087bf,_0x35902a){return db[_0x24f2('0x17')][_0x24f2('0x18')](_0x12dde9[_0x24f2('0x19')],{'raw':_0x12dde9['options']?_0x12dde9[_0x24f2('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x24f2('0xc')](function(_0x46c4e3){logger[_0x24f2('0xd')](_0x24f2('0x16'),_0x12dde9);logger['debug']('CreateSmsQueueReport',_0x12dde9,JSON[_0x24f2('0x11')](_0x46c4e3));_0x3087bf(_0x46c4e3);})['catch'](function(_0x42e5a0){logger[_0x24f2('0x12')]('CreateSmsQueueReport',_0x42e5a0[_0x24f2('0x14')],_0x12dde9);_0x35902a(_0x462b64['error'](0x1f4,_0x42e5a0['message']));});});};exports['UpdateSmsQueueReport']=function(_0x5e3d2a){var _0x68c497=this;return new Promise(function(_0x2592c2,_0x5f24a0){return db[_0x24f2('0x17')][_0x24f2('0x1b')](_0x5e3d2a[_0x24f2('0x19')],{'raw':_0x5e3d2a['options']?_0x5e3d2a[_0x24f2('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3d2a[_0x24f2('0x1a')]?_0x5e3d2a[_0x24f2('0x1a')]['where']||null:null,'attributes':_0x5e3d2a[_0x24f2('0x1a')]?_0x5e3d2a['options'][_0x24f2('0x1c')]||null:null,'limit':_0x5e3d2a[_0x24f2('0x1a')]?_0x5e3d2a[_0x24f2('0x1a')][_0x24f2('0x1d')]||null:null})[_0x24f2('0xc')](function(_0x2a4175){logger[_0x24f2('0xd')](_0x24f2('0x1e'),_0x5e3d2a);logger[_0x24f2('0x1f')](_0x24f2('0x1e'),_0x5e3d2a,JSON['stringify'](_0x2a4175));_0x2592c2(_0x2a4175);})[_0x24f2('0x20')](function(_0x4ed972){logger['error'](_0x24f2('0x1e'),_0x4ed972[_0x24f2('0x14')],_0x5e3d2a);_0x5f24a0(_0x68c497[_0x24f2('0x12')](0x1f4,_0x4ed972['message']));});});}; \ No newline at end of file +var _0xd66f=['code','message','result','catch','SmsQueueReport','body','options','CreateSmsQueueReport','debug','stringify','raw','where','limit','then','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4d986d,_0x1d9bd1){var _0x1e6676=function(_0x272835){while(--_0x272835){_0x4d986d['push'](_0x4d986d['shift']());}};_0x1e6676(++_0x1d9bd1);}(_0xd66f,0xc9));var _0xfd66=function(_0x17c1e9,_0x1c5e8a){_0x17c1e9=_0x17c1e9-0x0;var _0x26f699=_0xd66f[_0x17c1e9];return _0x26f699;};'use strict';var _=require(_0xfd66('0x0'));var util=require(_0xfd66('0x1'));var moment=require(_0xfd66('0x2'));var BPromise=require(_0xfd66('0x3'));var rs=require(_0xfd66('0x4'));var fs=require('fs');var Redis=require(_0xfd66('0x5'));var db=require(_0xfd66('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd66('0x7'))(_0xfd66('0x8'));var config=require('../../config/environment');var jayson=require(_0xfd66('0x9'));var client=jayson[_0xfd66('0xa')][_0xfd66('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4deca8,_0x448826,_0x33f89b){return new BPromise(function(_0x2a4176,_0x38d600){return client['request'](_0x4deca8,_0x33f89b)['then'](function(_0x4a121a){logger[_0xfd66('0xc')](_0xfd66('0xd'),_0x448826,'request\x20sent');logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x448826,_0xfd66('0xe'),JSON['stringify'](_0x4a121a));if(_0x4a121a[_0xfd66('0xf')]){if(_0x4a121a[_0xfd66('0xf')][_0xfd66('0x10')]===0x1f4){logger[_0xfd66('0xf')](_0xfd66('0xd'),_0x448826,_0x4a121a[_0xfd66('0xf')][_0xfd66('0x11')]);return _0x38d600(_0x4a121a[_0xfd66('0xf')][_0xfd66('0x11')]);}logger['error'](_0xfd66('0xd'),_0x448826,_0x4a121a[_0xfd66('0xf')]['message']);return _0x2a4176(_0x4a121a[_0xfd66('0xf')][_0xfd66('0x11')]);}else{logger[_0xfd66('0xc')](_0xfd66('0xd'),_0x448826,'request\x20sent');_0x2a4176(_0x4a121a[_0xfd66('0x12')]['message']);}})[_0xfd66('0x13')](function(_0x9b4059){logger[_0xfd66('0xf')](_0xfd66('0xd'),_0x448826,_0x9b4059);_0x38d600(_0x9b4059);});});}exports['CreateSmsQueueReport']=function(_0x50282b){var _0x253276=this;return new Promise(function(_0x4789db,_0x16aaed){return db[_0xfd66('0x14')]['create'](_0x50282b[_0xfd66('0x15')],{'raw':_0x50282b['options']?_0x50282b[_0xfd66('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5f1e84){logger[_0xfd66('0xc')](_0xfd66('0x17'),_0x50282b);logger[_0xfd66('0x18')]('CreateSmsQueueReport',_0x50282b,JSON[_0xfd66('0x19')](_0x5f1e84));_0x4789db(_0x5f1e84);})[_0xfd66('0x13')](function(_0x1c7b4a){logger[_0xfd66('0xf')](_0xfd66('0x17'),_0x1c7b4a[_0xfd66('0x11')],_0x50282b);_0x16aaed(_0x253276[_0xfd66('0xf')](0x1f4,_0x1c7b4a['message']));});});};exports['UpdateSmsQueueReport']=function(_0x47f51b){var _0x42c861=this;return new Promise(function(_0x2e5e48,_0x3270d4){return db[_0xfd66('0x14')]['update'](_0x47f51b[_0xfd66('0x15')],{'raw':_0x47f51b[_0xfd66('0x16')]?_0x47f51b['options'][_0xfd66('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47f51b['options']?_0x47f51b[_0xfd66('0x16')][_0xfd66('0x1b')]||null:null,'attributes':_0x47f51b[_0xfd66('0x16')]?_0x47f51b['options']['attributes']||null:null,'limit':_0x47f51b['options']?_0x47f51b[_0xfd66('0x16')][_0xfd66('0x1c')]||null:null})[_0xfd66('0x1d')](function(_0x4f34e2){logger[_0xfd66('0xc')](_0xfd66('0x1e'),_0x47f51b);logger[_0xfd66('0x18')](_0xfd66('0x1e'),_0x47f51b,JSON['stringify'](_0x4f34e2));_0x2e5e48(_0x4f34e2);})['catch'](function(_0xf49643){logger[_0xfd66('0xf')]('UpdateSmsQueueReport',_0xf49643[_0xfd66('0x11')],_0x47f51b);_0x3270d4(_0x42c861[_0xfd66('0xf')](0x1f4,_0xf49643['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 11e660a..40d9cdb 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 _0x02a7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','get','/describe','describe','/:id','post','put','update','destroy','exports','util','express','Router','fs-extra'];(function(_0x12aeb7,_0xd624eb){var _0x54e761=function(_0x412ea1){while(--_0x412ea1){_0x12aeb7['push'](_0x12aeb7['shift']());}};_0x54e761(++_0xd624eb);}(_0x02a7,0x7a));var _0x702a=function(_0x814142,_0x4ff597){_0x814142=_0x814142-0x0;var _0x274bb1=_0x02a7[_0x814142];return _0x274bb1;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x702a('0x1'));var router=express[_0x702a('0x2')]();var fs_extra=require(_0x702a('0x3'));var auth=require(_0x702a('0x4'));var interaction=require(_0x702a('0x5'));var config=require(_0x702a('0x6'));var controller=require(_0x702a('0x7'));router['get']('/',auth[_0x702a('0x8')](),controller['index']);router[_0x702a('0x9')](_0x702a('0xa'),auth[_0x702a('0x8')](),controller[_0x702a('0xb')]);router[_0x702a('0x9')](_0x702a('0xc'),auth[_0x702a('0x8')](),controller['show']);router[_0x702a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x702a('0xe')](_0x702a('0xc'),auth[_0x702a('0x8')](),controller[_0x702a('0xf')]);router['delete'](_0x702a('0xc'),auth[_0x702a('0x8')](),controller[_0x702a('0x10')]);module[_0x702a('0x11')]=router; \ No newline at end of file +var _0x43fd=['create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post'];(function(_0x162a95,_0x9dfb1f){var _0x54cd40=function(_0x249ed1){while(--_0x249ed1){_0x162a95['push'](_0x162a95['shift']());}};_0x54cd40(++_0x9dfb1f);}(_0x43fd,0x1ec));var _0xd43f=function(_0x5c0427,_0x340e41){_0x5c0427=_0x5c0427-0x0;var _0x523ee7=_0x43fd[_0x5c0427];return _0x523ee7;};'use strict';var multer=require('multer');var util=require(_0xd43f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd43f('0x1'));var router=express[_0xd43f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd43f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd43f('0x4'));var controller=require(_0xd43f('0x5'));router[_0xd43f('0x6')]('/',auth[_0xd43f('0x7')](),controller['index']);router[_0xd43f('0x6')](_0xd43f('0x8'),auth[_0xd43f('0x7')](),controller[_0xd43f('0x9')]);router['get'](_0xd43f('0xa'),auth[_0xd43f('0x7')](),controller['show']);router[_0xd43f('0xb')]('/',auth[_0xd43f('0x7')](),controller[_0xd43f('0xc')]);router[_0xd43f('0xd')](_0xd43f('0xa'),auth['isAuthenticated'](),controller[_0xd43f('0xe')]);router[_0xd43f('0xf')](_0xd43f('0xa'),auth[_0xd43f('0x7')](),controller[_0xd43f('0x10')]);module[_0xd43f('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 407ac39..cd11a02 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x4eef4f,_0xb516a7){var _0x2feb83=function(_0x1eddf2){while(--_0x1eddf2){_0x4eef4f['push'](_0x4eef4f['shift']());}};_0x2feb83(++_0xb516a7);}(_0xf4eb,0xec));var _0xbf4e=function(_0x908c3d,_0x1a4509){_0x908c3d=_0x908c3d-0x0;var _0x9b7445=_0xf4eb[_0x908c3d];return _0x9b7445;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xd76d5f,_0x2aeadd){var _0x38f169=function(_0x2d7598){while(--_0x2d7598){_0xd76d5f['push'](_0xd76d5f['shift']());}};_0x38f169(++_0x2aeadd);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x00bb[_0x47e7cb];return _0x2a8874;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index b15fd2d..2923267 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 _0x33c8=['../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','options','SmsTransferReport','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x33c8,0x1be));var _0x833c=function(_0x4da18b,_0x3a46f6){_0x4da18b=_0x4da18b-0x0;var _0x749fcf=_0x33c8[_0x4da18b];return _0x749fcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x833c('0x0'));var zipdir=require(_0x833c('0x1'));var jsonpatch=require(_0x833c('0x2'));var rp=require(_0x833c('0x3'));var moment=require(_0x833c('0x4'));var BPromise=require(_0x833c('0x5'));var Mustache=require('mustache');var util=require(_0x833c('0x6'));var path=require(_0x833c('0x7'));var sox=require('sox');var csv=require(_0x833c('0x8'));var ejs=require(_0x833c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x833c('0xa'));var squel=require(_0x833c('0xb'));var crypto=require(_0x833c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x833c('0xd'));var toCsv=require(_0x833c('0x8'));var querystring=require(_0x833c('0xe'));var Papa=require(_0x833c('0xf'));var Redis=require('ioredis');var authService=require(_0x833c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x833c('0x11'));var logger=require('../../config/logger')(_0x833c('0x12'));var utils=require(_0x833c('0x13'));var config=require(_0x833c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f77a6,_0x5c7c84){_0x5c7c84=_0x5c7c84||0xcc;return function(_0x1fa667){if(_0x1fa667){return _0x1f77a6[_0x833c('0x15')](_0x5c7c84);}return _0x1f77a6[_0x833c('0x16')](_0x5c7c84)[_0x833c('0x17')]();};}function respondWithResult(_0x4c1363,_0x380d8c){_0x380d8c=_0x380d8c||0xc8;return function(_0x2f1eee){if(_0x2f1eee){return _0x4c1363['status'](_0x380d8c)[_0x833c('0x18')](_0x2f1eee);}};}function respondWithFilteredResult(_0x14784f,_0x4246b6){return function(_0x13a3ce){if(_0x13a3ce){var _0x3af5e4=typeof _0x4246b6[_0x833c('0x19')]===_0x833c('0x1a')&&typeof _0x4246b6[_0x833c('0x1b')]==='undefined';var _0x40699d=_0x13a3ce[_0x833c('0x1c')];var _0x593ed5=_0x3af5e4?0x0:_0x4246b6['offset'];var _0xa7aece=_0x3af5e4?_0x13a3ce[_0x833c('0x1c')]:_0x4246b6[_0x833c('0x19')]+_0x4246b6[_0x833c('0x1b')];var _0x47a263;if(_0xa7aece>=_0x40699d){_0xa7aece=_0x40699d;_0x47a263=0xc8;}else{_0x47a263=0xce;}_0x14784f[_0x833c('0x16')](_0x47a263);return _0x14784f[_0x833c('0x1d')]('Content-Range',_0x593ed5+'-'+_0xa7aece+'/'+_0x40699d)[_0x833c('0x18')](_0x13a3ce);}return null;};}function patchUpdates(_0x216e18){return function(_0x3e33c9){try{jsonpatch[_0x833c('0x1e')](_0x3e33c9,_0x216e18,!![]);}catch(_0x60a4ab){return BPromise['reject'](_0x60a4ab);}return _0x3e33c9['save']();};}function saveUpdates(_0x265acd,_0x50bdd6){return function(_0x52652a){if(_0x52652a){return _0x52652a[_0x833c('0x1f')](_0x265acd)[_0x833c('0x20')](function(_0x4cb422){return _0x4cb422;});}return null;};}function removeEntity(_0x3b0a98,_0x2c7296){return function(_0x1844e0){if(_0x1844e0){return _0x1844e0[_0x833c('0x21')]()['then'](function(){_0x3b0a98[_0x833c('0x16')](0xcc)[_0x833c('0x17')]();});}};}function handleEntityNotFound(_0x266e81,_0x543036){return function(_0x10c948){if(!_0x10c948){_0x266e81[_0x833c('0x15')](0x194);}return _0x10c948;};}function handleError(_0x1f106,_0x384133){_0x384133=_0x384133||0x1f4;return function(_0x371c0d){logger[_0x833c('0x22')](_0x371c0d['stack']);if(_0x371c0d[_0x833c('0x23')]){delete _0x371c0d['name'];}_0x1f106['status'](_0x384133)[_0x833c('0x24')](_0x371c0d);};}exports[_0x833c('0x25')]=function(_0x51e4ec,_0x5b740f){var _0x3d95a9={},_0x3ecaa3={},_0x392931={'count':0x0,'rows':[]};var _0x1f4b09=_[_0x833c('0x26')](db['SmsTransferReport']['rawAttributes'],function(_0x116ef2){return{'name':_0x116ef2['fieldName'],'type':_0x116ef2[_0x833c('0x27')][_0x833c('0x28')]};});_0x3ecaa3[_0x833c('0x29')]=_[_0x833c('0x26')](_0x1f4b09,_0x833c('0x23'));_0x3ecaa3[_0x833c('0x2a')]=_['keys'](_0x51e4ec['query']);_0x3ecaa3[_0x833c('0x2b')]=_[_0x833c('0x2c')](_0x3ecaa3[_0x833c('0x29')],_0x3ecaa3[_0x833c('0x2a')]);_0x3d95a9[_0x833c('0x2d')]=_['intersection'](_0x3ecaa3[_0x833c('0x29')],qs[_0x833c('0x2e')](_0x51e4ec[_0x833c('0x2a')][_0x833c('0x2e')]));_0x3d95a9[_0x833c('0x2d')]=_0x3d95a9[_0x833c('0x2d')]['length']?_0x3d95a9[_0x833c('0x2d')]:_0x3ecaa3[_0x833c('0x29')];if(!_0x51e4ec[_0x833c('0x2a')][_0x833c('0x2f')](_0x833c('0x30'))){_0x3d95a9[_0x833c('0x1b')]=qs[_0x833c('0x1b')](_0x51e4ec[_0x833c('0x2a')]['limit']);_0x3d95a9[_0x833c('0x19')]=qs[_0x833c('0x19')](_0x51e4ec[_0x833c('0x2a')][_0x833c('0x19')]);}_0x3d95a9['order']=qs['sort'](_0x51e4ec[_0x833c('0x2a')][_0x833c('0x31')]);_0x3d95a9['where']=qs[_0x833c('0x2b')](_['pick'](_0x51e4ec[_0x833c('0x2a')],_0x3ecaa3['filters']),_0x1f4b09);if(_0x51e4ec[_0x833c('0x2a')][_0x833c('0x32')]){_0x3d95a9[_0x833c('0x33')]=_[_0x833c('0x34')](_0x3d95a9[_0x833c('0x33')],{'$or':_[_0x833c('0x26')](_0x1f4b09,function(_0x1f04f5){if(_0x1f04f5[_0x833c('0x27')]!=='VIRTUAL'){var _0x46ff1d={};_0x46ff1d[_0x1f04f5[_0x833c('0x23')]]={'$like':'%'+_0x51e4ec[_0x833c('0x2a')]['filter']+'%'};return _0x46ff1d;}})});}_0x3d95a9=_[_0x833c('0x34')]({},_0x3d95a9,_0x51e4ec[_0x833c('0x35')]);var _0x86dab1={'where':_0x3d95a9[_0x833c('0x33')]};return db[_0x833c('0x36')]['count'](_0x86dab1)['then'](function(_0x1b8668){_0x392931[_0x833c('0x1c')]=_0x1b8668;if(_0x51e4ec[_0x833c('0x2a')][_0x833c('0x37')]){_0x3d95a9[_0x833c('0x38')]=[{'all':!![]}];}return db[_0x833c('0x36')][_0x833c('0x39')](_0x3d95a9);})[_0x833c('0x20')](function(_0x1e3c05){_0x392931[_0x833c('0x3a')]=_0x1e3c05;return _0x392931;})[_0x833c('0x20')](respondWithFilteredResult(_0x5b740f,_0x3d95a9))['catch'](handleError(_0x5b740f,null));};exports['show']=function(_0x136fb9,_0x2f30af){var _0x425444={'raw':!![],'where':{'id':_0x136fb9[_0x833c('0x3b')]['id']}},_0x4db310={};_0x4db310[_0x833c('0x29')]=_['keys'](db[_0x833c('0x36')]['rawAttributes']);_0x4db310[_0x833c('0x2a')]=_[_0x833c('0x3c')](_0x136fb9[_0x833c('0x2a')]);_0x4db310[_0x833c('0x2b')]=_[_0x833c('0x2c')](_0x4db310[_0x833c('0x29')],_0x4db310[_0x833c('0x2a')]);_0x425444[_0x833c('0x2d')]=_[_0x833c('0x2c')](_0x4db310[_0x833c('0x29')],qs[_0x833c('0x2e')](_0x136fb9[_0x833c('0x2a')][_0x833c('0x2e')]));_0x425444[_0x833c('0x2d')]=_0x425444[_0x833c('0x2d')]['length']?_0x425444[_0x833c('0x2d')]:_0x4db310['model'];if(_0x136fb9[_0x833c('0x2a')][_0x833c('0x37')]){_0x425444['include']=[{'all':!![]}];}_0x425444=_[_0x833c('0x34')]({},_0x425444,_0x136fb9[_0x833c('0x35')]);return db['SmsTransferReport'][_0x833c('0x3d')](_0x425444)['then'](handleEntityNotFound(_0x2f30af,null))[_0x833c('0x20')](respondWithResult(_0x2f30af,null))[_0x833c('0x3e')](handleError(_0x2f30af,null));};exports[_0x833c('0x3f')]=function(_0x4dc63f,_0x41f335){return db[_0x833c('0x36')]['create'](_0x4dc63f['body'],{})['then'](respondWithResult(_0x41f335,0xc9))[_0x833c('0x3e')](handleError(_0x41f335,null));};exports['update']=function(_0x443e60,_0x1db07b){if(_0x443e60[_0x833c('0x40')]['id']){delete _0x443e60[_0x833c('0x40')]['id'];}return db[_0x833c('0x36')]['find']({'where':{'id':_0x443e60[_0x833c('0x3b')]['id']}})[_0x833c('0x20')](handleEntityNotFound(_0x1db07b,null))[_0x833c('0x20')](saveUpdates(_0x443e60[_0x833c('0x40')],null))[_0x833c('0x20')](respondWithResult(_0x1db07b,null))[_0x833c('0x3e')](handleError(_0x1db07b,null));};exports[_0x833c('0x21')]=function(_0x25ff36,_0x82afd2){return db['SmsTransferReport'][_0x833c('0x3d')]({'where':{'id':_0x25ff36['params']['id']}})['then'](handleEntityNotFound(_0x82afd2,null))[_0x833c('0x20')](removeEntity(_0x82afd2,null))[_0x833c('0x3e')](handleError(_0x82afd2,null));};exports[_0x833c('0x41')]=function(_0x5a1dc2,_0x495241){return db[_0x833c('0x36')][_0x833c('0x41')]()[_0x833c('0x20')](respondWithResult(_0x495241,null))[_0x833c('0x3e')](handleError(_0x495241,null));}; \ No newline at end of file +var _0xca48=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','filters','query','attributes','intersection','fields','length','nolimit','order','sort','filter','where','merge','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1312f4,_0x34085f){var _0x56042f=function(_0x17db9a){while(--_0x17db9a){_0x1312f4['push'](_0x1312f4['shift']());}};_0x56042f(++_0x34085f);}(_0xca48,0xe9));var _0x8ca4=function(_0x5e5b5e,_0x1d4bde){_0x5e5b5e=_0x5e5b5e-0x0;var _0x296489=_0xca48[_0x5e5b5e];return _0x296489;};'use strict';var emlformat=require(_0x8ca4('0x0'));var rimraf=require(_0x8ca4('0x1'));var zipdir=require(_0x8ca4('0x2'));var jsonpatch=require(_0x8ca4('0x3'));var rp=require(_0x8ca4('0x4'));var moment=require(_0x8ca4('0x5'));var BPromise=require(_0x8ca4('0x6'));var Mustache=require(_0x8ca4('0x7'));var util=require(_0x8ca4('0x8'));var path=require(_0x8ca4('0x9'));var sox=require(_0x8ca4('0xa'));var csv=require(_0x8ca4('0xb'));var ejs=require(_0x8ca4('0xc'));var fs=require('fs');var fs_extra=require(_0x8ca4('0xd'));var _=require('lodash');var squel=require(_0x8ca4('0xe'));var crypto=require(_0x8ca4('0xf'));var jsforce=require(_0x8ca4('0x10'));var deskjs=require(_0x8ca4('0x11'));var toCsv=require(_0x8ca4('0xb'));var querystring=require(_0x8ca4('0x12'));var Papa=require(_0x8ca4('0x13'));var Redis=require(_0x8ca4('0x14'));var authService=require(_0x8ca4('0x15'));var qs=require(_0x8ca4('0x16'));var as=require(_0x8ca4('0x17'));var hardwareService=require(_0x8ca4('0x18'));var logger=require(_0x8ca4('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x8ca4('0x1a'));var licenseUtil=require(_0x8ca4('0x1b'));var db=require(_0x8ca4('0x1c'))['db'];function respondWithStatusCode(_0x3c8a29,_0x16ff10){_0x16ff10=_0x16ff10||0xcc;return function(_0x5b5a2d){if(_0x5b5a2d){return _0x3c8a29['sendStatus'](_0x16ff10);}return _0x3c8a29['status'](_0x16ff10)[_0x8ca4('0x1d')]();};}function respondWithResult(_0x4ce544,_0xc35b9a){_0xc35b9a=_0xc35b9a||0xc8;return function(_0x54b5dd){if(_0x54b5dd){return _0x4ce544[_0x8ca4('0x1e')](_0xc35b9a)[_0x8ca4('0x1f')](_0x54b5dd);}};}function respondWithFilteredResult(_0x2344cc,_0x5801d0){return function(_0x3e9338){if(_0x3e9338){var _0x5f112c=typeof _0x5801d0[_0x8ca4('0x20')]==='undefined'&&typeof _0x5801d0[_0x8ca4('0x21')]===_0x8ca4('0x22');var _0xb34bc6=_0x3e9338['count'];var _0x3c64d2=_0x5f112c?0x0:_0x5801d0[_0x8ca4('0x20')];var _0x365522=_0x5f112c?_0x3e9338[_0x8ca4('0x23')]:_0x5801d0['offset']+_0x5801d0[_0x8ca4('0x21')];var _0x15ecb7;if(_0x365522>=_0xb34bc6){_0x365522=_0xb34bc6;_0x15ecb7=0xc8;}else{_0x15ecb7=0xce;}_0x2344cc['status'](_0x15ecb7);return _0x2344cc[_0x8ca4('0x24')]('Content-Range',_0x3c64d2+'-'+_0x365522+'/'+_0xb34bc6)[_0x8ca4('0x1f')](_0x3e9338);}return null;};}function patchUpdates(_0x308a9a){return function(_0x4fc5ce){try{jsonpatch[_0x8ca4('0x25')](_0x4fc5ce,_0x308a9a,!![]);}catch(_0x160423){return BPromise[_0x8ca4('0x26')](_0x160423);}return _0x4fc5ce[_0x8ca4('0x27')]();};}function saveUpdates(_0x376e45,_0x444955){return function(_0x23bb2c){if(_0x23bb2c){return _0x23bb2c[_0x8ca4('0x28')](_0x376e45)[_0x8ca4('0x29')](function(_0x22a13d){return _0x22a13d;});}return null;};}function removeEntity(_0x4aa43d,_0x40ea03){return function(_0xb5fc2){if(_0xb5fc2){return _0xb5fc2[_0x8ca4('0x2a')]()[_0x8ca4('0x29')](function(){_0x4aa43d[_0x8ca4('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19e9c0,_0x273c37){return function(_0x599705){if(!_0x599705){_0x19e9c0[_0x8ca4('0x2b')](0x194);}return _0x599705;};}function handleError(_0xdf280,_0xee6814){_0xee6814=_0xee6814||0x1f4;return function(_0x4a6fc7){logger[_0x8ca4('0x2c')](_0x4a6fc7[_0x8ca4('0x2d')]);if(_0x4a6fc7[_0x8ca4('0x2e')]){delete _0x4a6fc7[_0x8ca4('0x2e')];}_0xdf280[_0x8ca4('0x1e')](_0xee6814)[_0x8ca4('0x2f')](_0x4a6fc7);};}exports[_0x8ca4('0x30')]=function(_0x8a59b4,_0x33cf2d){var _0x326d86={},_0x2c485b={},_0x26605c={'count':0x0,'rows':[]};var _0x4e6194=_[_0x8ca4('0x31')](db[_0x8ca4('0x32')][_0x8ca4('0x33')],function(_0x2f9ab0){return{'name':_0x2f9ab0[_0x8ca4('0x34')],'type':_0x2f9ab0[_0x8ca4('0x35')]['key']};});_0x2c485b[_0x8ca4('0x36')]=_[_0x8ca4('0x31')](_0x4e6194,_0x8ca4('0x2e'));_0x2c485b['query']=_['keys'](_0x8a59b4['query']);_0x2c485b[_0x8ca4('0x37')]=_['intersection'](_0x2c485b[_0x8ca4('0x36')],_0x2c485b[_0x8ca4('0x38')]);_0x326d86[_0x8ca4('0x39')]=_[_0x8ca4('0x3a')](_0x2c485b[_0x8ca4('0x36')],qs[_0x8ca4('0x3b')](_0x8a59b4['query'][_0x8ca4('0x3b')]));_0x326d86[_0x8ca4('0x39')]=_0x326d86[_0x8ca4('0x39')][_0x8ca4('0x3c')]?_0x326d86[_0x8ca4('0x39')]:_0x2c485b[_0x8ca4('0x36')];if(!_0x8a59b4[_0x8ca4('0x38')]['hasOwnProperty'](_0x8ca4('0x3d'))){_0x326d86[_0x8ca4('0x21')]=qs[_0x8ca4('0x21')](_0x8a59b4[_0x8ca4('0x38')]['limit']);_0x326d86[_0x8ca4('0x20')]=qs['offset'](_0x8a59b4[_0x8ca4('0x38')]['offset']);}_0x326d86[_0x8ca4('0x3e')]=qs[_0x8ca4('0x3f')](_0x8a59b4[_0x8ca4('0x38')][_0x8ca4('0x3f')]);_0x326d86['where']=qs[_0x8ca4('0x37')](_['pick'](_0x8a59b4[_0x8ca4('0x38')],_0x2c485b[_0x8ca4('0x37')]),_0x4e6194);if(_0x8a59b4[_0x8ca4('0x38')][_0x8ca4('0x40')]){_0x326d86[_0x8ca4('0x41')]=_[_0x8ca4('0x42')](_0x326d86[_0x8ca4('0x41')],{'$or':_[_0x8ca4('0x31')](_0x4e6194,function(_0x36250b){if(_0x36250b[_0x8ca4('0x35')]!=='VIRTUAL'){var _0x1056bd={};_0x1056bd[_0x36250b[_0x8ca4('0x2e')]]={'$like':'%'+_0x8a59b4[_0x8ca4('0x38')][_0x8ca4('0x40')]+'%'};return _0x1056bd;}})});}_0x326d86=_['merge']({},_0x326d86,_0x8a59b4[_0x8ca4('0x43')]);var _0x59f245={'where':_0x326d86[_0x8ca4('0x41')]};return db[_0x8ca4('0x32')]['count'](_0x59f245)[_0x8ca4('0x29')](function(_0x24c126){_0x26605c[_0x8ca4('0x23')]=_0x24c126;if(_0x8a59b4[_0x8ca4('0x38')]['includeAll']){_0x326d86[_0x8ca4('0x44')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x8ca4('0x45')](_0x326d86);})['then'](function(_0x56aa34){_0x26605c['rows']=_0x56aa34;return _0x26605c;})[_0x8ca4('0x29')](respondWithFilteredResult(_0x33cf2d,_0x326d86))[_0x8ca4('0x46')](handleError(_0x33cf2d,null));};exports[_0x8ca4('0x47')]=function(_0x40dd30,_0x3e28b0){var _0x178b4={'raw':!![],'where':{'id':_0x40dd30[_0x8ca4('0x48')]['id']}},_0x86061c={};_0x86061c[_0x8ca4('0x36')]=_[_0x8ca4('0x49')](db[_0x8ca4('0x32')]['rawAttributes']);_0x86061c[_0x8ca4('0x38')]=_[_0x8ca4('0x49')](_0x40dd30['query']);_0x86061c[_0x8ca4('0x37')]=_[_0x8ca4('0x3a')](_0x86061c[_0x8ca4('0x36')],_0x86061c[_0x8ca4('0x38')]);_0x178b4[_0x8ca4('0x39')]=_['intersection'](_0x86061c[_0x8ca4('0x36')],qs[_0x8ca4('0x3b')](_0x40dd30[_0x8ca4('0x38')][_0x8ca4('0x3b')]));_0x178b4['attributes']=_0x178b4[_0x8ca4('0x39')][_0x8ca4('0x3c')]?_0x178b4['attributes']:_0x86061c[_0x8ca4('0x36')];if(_0x40dd30[_0x8ca4('0x38')][_0x8ca4('0x4a')]){_0x178b4[_0x8ca4('0x44')]=[{'all':!![]}];}_0x178b4=_['merge']({},_0x178b4,_0x40dd30[_0x8ca4('0x43')]);return db[_0x8ca4('0x32')][_0x8ca4('0x4b')](_0x178b4)[_0x8ca4('0x29')](handleEntityNotFound(_0x3e28b0,null))['then'](respondWithResult(_0x3e28b0,null))[_0x8ca4('0x46')](handleError(_0x3e28b0,null));};exports[_0x8ca4('0x4c')]=function(_0x4e7884,_0x16fa01){return db[_0x8ca4('0x32')][_0x8ca4('0x4c')](_0x4e7884[_0x8ca4('0x4d')],{})[_0x8ca4('0x29')](respondWithResult(_0x16fa01,0xc9))[_0x8ca4('0x46')](handleError(_0x16fa01,null));};exports['update']=function(_0x3f59e0,_0x2e521d){if(_0x3f59e0[_0x8ca4('0x4d')]['id']){delete _0x3f59e0[_0x8ca4('0x4d')]['id'];}return db[_0x8ca4('0x32')][_0x8ca4('0x4b')]({'where':{'id':_0x3f59e0['params']['id']}})[_0x8ca4('0x29')](handleEntityNotFound(_0x2e521d,null))['then'](saveUpdates(_0x3f59e0['body'],null))[_0x8ca4('0x29')](respondWithResult(_0x2e521d,null))['catch'](handleError(_0x2e521d,null));};exports[_0x8ca4('0x2a')]=function(_0x25005e,_0x14e9a2){return db[_0x8ca4('0x32')][_0x8ca4('0x4b')]({'where':{'id':_0x25005e[_0x8ca4('0x48')]['id']}})[_0x8ca4('0x29')](handleEntityNotFound(_0x14e9a2,null))['then'](removeEntity(_0x14e9a2,null))[_0x8ca4('0x46')](handleError(_0x14e9a2,null));};exports[_0x8ca4('0x4e')]=function(_0x5ab038,_0x42991a){return db[_0x8ca4('0x32')][_0x8ca4('0x4e')]()[_0x8ca4('0x29')](respondWithResult(_0x42991a,null))[_0x8ca4('0x46')](handleError(_0x42991a,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 0d0b980..2e974ba 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 _0x49c2=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','report_sms_transfer','uniqueid'];(function(_0x4b7886,_0x304059){var _0x1332fd=function(_0x2867bd){while(--_0x2867bd){_0x4b7886['push'](_0x4b7886['shift']());}};_0x1332fd(++_0x304059);}(_0x49c2,0x176));var _0x249c=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0x49c2[_0x5f42f1];return _0x5534ee;};'use strict';var _=require(_0x249c('0x0'));var util=require(_0x249c('0x1'));var logger=require(_0x249c('0x2'))(_0x249c('0x3'));var moment=require('moment');var BPromise=require(_0x249c('0x4'));var rp=require(_0x249c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x249c('0x6'));var config=require(_0x249c('0x7'));var attributes=require('./smsTransferReport.attributes');module[_0x249c('0x8')]=function(_0x4c0c15,_0x5c5f30){return _0x4c0c15['define']('SmsTransferReport',attributes,{'tableName':_0x249c('0x9'),'paranoid':![],'indexes':[{'name':_0x249c('0xa'),'fields':[_0x249c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1301=['SmsTransferReport','uniqueid','lodash','util','moment','bluebird','request-promise','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1301,0x70));var _0x1130=function(_0x229618,_0x47a1c7){_0x229618=_0x229618-0x0;var _0x23283c=_0x1301[_0x229618];return _0x23283c;};'use strict';var _=require(_0x1130('0x0'));var util=require(_0x1130('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1130('0x2'));var BPromise=require(_0x1130('0x3'));var rp=require(_0x1130('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1130('0x5'));var attributes=require(_0x1130('0x6'));module[_0x1130('0x7')]=function(_0x282638,_0x928ad4){return _0x282638[_0x1130('0x8')](_0x1130('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1130('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 8379591..5a6e59b 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 _0x3eea=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','lodash','moment','bluebird','randomstring'];(function(_0x3cbd1a,_0x5143a0){var _0x370fd1=function(_0x285950){while(--_0x285950){_0x3cbd1a['push'](_0x3cbd1a['shift']());}};_0x370fd1(++_0x5143a0);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1e25e1,_0x7bc914){_0x1e25e1=_0x1e25e1-0x0;var _0x496d82=_0x3eea[_0x1e25e1];return _0x496d82;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var moment=require(_0xa3ee('0x1'));var BPromise=require(_0xa3ee('0x2'));var rs=require(_0xa3ee('0x3'));var fs=require('fs');var Redis=require(_0xa3ee('0x4'));var db=require(_0xa3ee('0x5'))['db'];var utils=require(_0xa3ee('0x6'));var logger=require(_0xa3ee('0x7'))(_0xa3ee('0x8'));var config=require(_0xa3ee('0x9'));var jayson=require(_0xa3ee('0xa'));var client=jayson[_0xa3ee('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x538bf9,_0x4183ee,_0x4e4588){return new BPromise(function(_0x37a3f0,_0x56f37b){return client[_0xa3ee('0xc')](_0x538bf9,_0x4e4588)['then'](function(_0xb1b96d){logger['info'](_0xa3ee('0xd'),_0x4183ee,_0xa3ee('0xe'));logger[_0xa3ee('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x4183ee,_0xa3ee('0xe'),JSON[_0xa3ee('0x10')](_0xb1b96d));if(_0xb1b96d['error']){if(_0xb1b96d['error'][_0xa3ee('0x11')]===0x1f4){logger[_0xa3ee('0x12')](_0xa3ee('0xd'),_0x4183ee,_0xb1b96d[_0xa3ee('0x12')]['message']);return _0x56f37b(_0xb1b96d[_0xa3ee('0x12')]['message']);}logger[_0xa3ee('0x12')](_0xa3ee('0xd'),_0x4183ee,_0xb1b96d[_0xa3ee('0x12')][_0xa3ee('0x13')]);return _0x37a3f0(_0xb1b96d['error'][_0xa3ee('0x13')]);}else{logger[_0xa3ee('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x4183ee,'request\x20sent');_0x37a3f0(_0xb1b96d['result'][_0xa3ee('0x13')]);}})[_0xa3ee('0x15')](function(_0x354dd5){logger[_0xa3ee('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x4183ee,_0x354dd5);_0x56f37b(_0x354dd5);});});} \ No newline at end of file +var _0xbdb9=['request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','jayson/promise','http'];(function(_0x4e86db,_0x2dda03){var _0x231111=function(_0x34c9fa){while(--_0x34c9fa){_0x4e86db['push'](_0x4e86db['shift']());}};_0x231111(++_0x2dda03);}(_0xbdb9,0xac));var _0x9bdb=function(_0x40f288,_0x48150a){_0x40f288=_0x40f288-0x0;var _0x5cc7d4=_0xbdb9[_0x40f288];return _0x5cc7d4;};'use strict';var _=require(_0x9bdb('0x0'));var util=require(_0x9bdb('0x1'));var moment=require(_0x9bdb('0x2'));var BPromise=require(_0x9bdb('0x3'));var rs=require(_0x9bdb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bdb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9bdb('0x6'));var client=jayson['client'][_0x9bdb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e9c54,_0x369e4a,_0x27cdd8){return new BPromise(function(_0x27c6b8,_0x4bbae9){return client[_0x9bdb('0x8')](_0x4e9c54,_0x27cdd8)[_0x9bdb('0x9')](function(_0x152c08){logger['info'](_0x9bdb('0xa'),_0x369e4a,_0x9bdb('0xb'));logger[_0x9bdb('0xc')](_0x9bdb('0xd'),_0x369e4a,_0x9bdb('0xb'),JSON['stringify'](_0x152c08));if(_0x152c08['error']){if(_0x152c08[_0x9bdb('0xe')][_0x9bdb('0xf')]===0x1f4){logger[_0x9bdb('0xe')](_0x9bdb('0xa'),_0x369e4a,_0x152c08[_0x9bdb('0xe')][_0x9bdb('0x10')]);return _0x4bbae9(_0x152c08['error'][_0x9bdb('0x10')]);}logger[_0x9bdb('0xe')](_0x9bdb('0xa'),_0x369e4a,_0x152c08[_0x9bdb('0xe')][_0x9bdb('0x10')]);return _0x27c6b8(_0x152c08['error'][_0x9bdb('0x10')]);}else{logger[_0x9bdb('0x11')](_0x9bdb('0xa'),_0x369e4a,'request\x20sent');_0x27c6b8(_0x152c08[_0x9bdb('0x12')][_0x9bdb('0x10')]);}})[_0x9bdb('0x13')](function(_0x1f575e){logger[_0x9bdb('0xe')](_0x9bdb('0xa'),_0x369e4a,_0x1f575e);_0x4bbae9(_0x1f575e);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0e0ead7..76e3070 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 _0xaea8=['../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','create','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4996b8,_0x3a099b){var _0x12162d=function(_0x32467e){while(--_0x32467e){_0x4996b8['push'](_0x4996b8['shift']());}};_0x12162d(++_0x3a099b);}(_0xaea8,0x1ea));var _0x8aea=function(_0x4b8c6b,_0x887ecc){_0x4b8c6b=_0x4b8c6b-0x0;var _0x247bfb=_0xaea8[_0x4b8c6b];return _0x247bfb;};'use strict';var multer=require(_0x8aea('0x0'));var util=require('util');var path=require(_0x8aea('0x1'));var timeout=require(_0x8aea('0x2'));var express=require('express');var router=express[_0x8aea('0x3')]();var fs_extra=require(_0x8aea('0x4'));var auth=require(_0x8aea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8aea('0x6'));var controller=require(_0x8aea('0x7'));router[_0x8aea('0x8')]('/',auth[_0x8aea('0x9')](),controller['index']);router[_0x8aea('0x8')](_0x8aea('0xa'),auth[_0x8aea('0x9')](),controller[_0x8aea('0xb')]);router['get'](_0x8aea('0xc'),auth['isAuthenticated'](),controller[_0x8aea('0xd')]);var upload=multer({'storage':multer[_0x8aea('0xe')]({'destination':function(_0x10e0ce,_0x4a061f,_0x2a09b8){_0x2a09b8(null,path[_0x8aea('0xf')](config[_0x8aea('0x10')],_0x8aea('0x11')));},'filename':function(_0x528f34,_0x5bfb8d,_0x3a5338){_0x5bfb8d[_0x8aea('0x12')]=_0x5bfb8d[_0x8aea('0x12')][_0x8aea('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a5338(null,util[_0x8aea('0x14')](_0x8aea('0x15'),path[_0x8aea('0x16')](_0x5bfb8d['originalname'],path[_0x8aea('0x17')](_0x5bfb8d['originalname'])),Date['now'](),path[_0x8aea('0x17')](_0x5bfb8d[_0x8aea('0x12')])));}})});router[_0x8aea('0x18')]('/',upload[_0x8aea('0x19')]('file'),controller[_0x8aea('0x1a')]);router[_0x8aea('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x8aea('0x1c')]);router[_0x8aea('0x1d')](_0x8aea('0xa'),auth[_0x8aea('0x9')](),controller[_0x8aea('0x1d')]);module[_0x8aea('0x1e')]=router; \ No newline at end of file +var _0x4df6=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','create'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x4df6,0x13a));var _0x64df=function(_0x57c534,_0x2203e7){_0x57c534=_0x57c534-0x0;var _0x409017=_0x4df6[_0x57c534];return _0x409017;};'use strict';var multer=require(_0x64df('0x0'));var util=require(_0x64df('0x1'));var path=require(_0x64df('0x2'));var timeout=require(_0x64df('0x3'));var express=require(_0x64df('0x4'));var router=express[_0x64df('0x5')]();var fs_extra=require(_0x64df('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x64df('0x7'));var config=require(_0x64df('0x8'));var controller=require(_0x64df('0x9'));router[_0x64df('0xa')]('/',auth[_0x64df('0xb')](),controller[_0x64df('0xc')]);router['get'](_0x64df('0xd'),auth[_0x64df('0xb')](),controller[_0x64df('0xe')]);router['get'](_0x64df('0xf'),auth[_0x64df('0xb')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5bcac4,_0x297a01,_0x120538){_0x120538(null,path[_0x64df('0x10')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x3b46ad,_0x4f3c30,_0x491ab2){_0x4f3c30['originalname']=_0x4f3c30[_0x64df('0x11')][_0x64df('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x491ab2(null,util[_0x64df('0x13')](_0x64df('0x14'),path[_0x64df('0x15')](_0x4f3c30['originalname'],path[_0x64df('0x16')](_0x4f3c30['originalname'])),Date[_0x64df('0x17')](),path[_0x64df('0x16')](_0x4f3c30[_0x64df('0x11')])));}})});router['post']('/',upload[_0x64df('0x18')](_0x64df('0x19')),controller[_0x64df('0x1a')]);router[_0x64df('0x1b')](_0x64df('0xd'),auth[_0x64df('0xb')](),controller[_0x64df('0x1c')]);router[_0x64df('0x1d')]('/:id',auth[_0x64df('0xb')](),controller[_0x64df('0x1d')]);module[_0x64df('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 6229a92..ef22b19 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 _0xf03c=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x42b47f,_0x438d12){var _0x35b220=function(_0x1fae8a){while(--_0x1fae8a){_0x42b47f['push'](_0x42b47f['shift']());}};_0x35b220(++_0x438d12);}(_0xf03c,0x1eb));var _0xcf03=function(_0x4375ea,_0xf214ad){_0x4375ea=_0x4375ea-0x0;var _0x15dcda=_0xf03c[_0x4375ea];return _0x15dcda;};'use strict';var Sequelize=require(_0xcf03('0x0'));module[_0xcf03('0x1')]={'name':{'type':Sequelize[_0xcf03('0x2')],'unique':_0xcf03('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xcf03('0x2')]},'display_name':{'type':Sequelize[_0xcf03('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xcf03('0x2')]},'original_format':{'type':Sequelize[_0xcf03('0x2')]},'original_duration':{'type':Sequelize[_0xcf03('0x4')]},'original_sampleCount':{'type':Sequelize[_0xcf03('0x5')]},'original_channelCount':{'type':Sequelize[_0xcf03('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xcf03('0x6')]},'converted_format':{'type':Sequelize[_0xcf03('0x2')]},'converted_duration':{'type':Sequelize[_0xcf03('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xcf03('0x5')]},'converted_channelCount':{'type':Sequelize[_0xcf03('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xcf03('0x6')]}}; \ No newline at end of file +var _0x8f27=['STRING','FLOAT','BIGINT','sequelize','exports','name'];(function(_0x5f1453,_0x2e2c8a){var _0x33e311=function(_0xd0461b){while(--_0xd0461b){_0x5f1453['push'](_0x5f1453['shift']());}};_0x33e311(++_0x2e2c8a);}(_0x8f27,0x11d));var _0x78f2=function(_0x2fdc1a,_0x2a0a5a){_0x2fdc1a=_0x2fdc1a-0x0;var _0x51fb16=_0x8f27[_0x2fdc1a];return _0x51fb16;};'use strict';var Sequelize=require(_0x78f2('0x0'));module[_0x78f2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x78f2('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x78f2('0x3')]},'display_name':{'type':Sequelize[_0x78f2('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x78f2('0x3')]},'original_duration':{'type':Sequelize[_0x78f2('0x4')]},'original_sampleCount':{'type':Sequelize[_0x78f2('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x78f2('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x78f2('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index f058480..dfdbe3d 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 _0xfb2d=['limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','Sound','includeAll','include','findAll','rows','catch','show','params','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','create','basename','originalname','extname','file','filename','substring','wav','info','chmodSync','error','send','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','server/files/sounds/original','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb2d,0x1d5));var _0xdfb2=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0xfb2d[_0x5e8c32];return _0x595f7b;};'use strict';var emlformat=require(_0xdfb2('0x0'));var rimraf=require(_0xdfb2('0x1'));var zipdir=require(_0xdfb2('0x2'));var jsonpatch=require(_0xdfb2('0x3'));var rp=require(_0xdfb2('0x4'));var moment=require(_0xdfb2('0x5'));var BPromise=require(_0xdfb2('0x6'));var Mustache=require(_0xdfb2('0x7'));var util=require('util');var path=require(_0xdfb2('0x8'));var sox=require(_0xdfb2('0x9'));var csv=require(_0xdfb2('0xa'));var ejs=require(_0xdfb2('0xb'));var fs=require('fs');var fs_extra=require(_0xdfb2('0xc'));var _=require(_0xdfb2('0xd'));var squel=require(_0xdfb2('0xe'));var crypto=require(_0xdfb2('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdfb2('0xa'));var querystring=require(_0xdfb2('0x10'));var Papa=require(_0xdfb2('0x11'));var Redis=require(_0xdfb2('0x12'));var authService=require(_0xdfb2('0x13'));var qs=require(_0xdfb2('0x14'));var as=require(_0xdfb2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdfb2('0x16'))(_0xdfb2('0x17'));var utils=require('../../config/utils');var config=require(_0xdfb2('0x18'));var licenseUtil=require(_0xdfb2('0x19'));var db=require(_0xdfb2('0x1a'))['db'];function respondWithStatusCode(_0x1450be,_0x628e4c){_0x628e4c=_0x628e4c||0xcc;return function(_0x27ec13){if(_0x27ec13){return _0x1450be['sendStatus'](_0x628e4c);}return _0x1450be[_0xdfb2('0x1b')](_0x628e4c)[_0xdfb2('0x1c')]();};}function respondWithResult(_0x84f83,_0x13d2cc){_0x13d2cc=_0x13d2cc||0xc8;return function(_0x1c46fa){if(_0x1c46fa){return _0x84f83[_0xdfb2('0x1b')](_0x13d2cc)[_0xdfb2('0x1d')](_0x1c46fa);}};}function respondWithFilteredResult(_0x1c9bd9,_0x396f64){return function(_0x311143){if(_0x311143){var _0xd17b5d=typeof _0x396f64[_0xdfb2('0x1e')]==='undefined'&&typeof _0x396f64[_0xdfb2('0x1f')]===_0xdfb2('0x20');var _0x26112a=_0x311143[_0xdfb2('0x21')];var _0x2a6be4=_0xd17b5d?0x0:_0x396f64['offset'];var _0x56726d=_0xd17b5d?_0x311143['count']:_0x396f64[_0xdfb2('0x1e')]+_0x396f64[_0xdfb2('0x1f')];var _0x268ae3;if(_0x56726d>=_0x26112a){_0x56726d=_0x26112a;_0x268ae3=0xc8;}else{_0x268ae3=0xce;}_0x1c9bd9[_0xdfb2('0x1b')](_0x268ae3);return _0x1c9bd9['set'](_0xdfb2('0x22'),_0x2a6be4+'-'+_0x56726d+'/'+_0x26112a)[_0xdfb2('0x1d')](_0x311143);}return null;};}function patchUpdates(_0x2ba354){return function(_0x12bbc6){try{jsonpatch[_0xdfb2('0x23')](_0x12bbc6,_0x2ba354,!![]);}catch(_0x29cc95){return BPromise[_0xdfb2('0x24')](_0x29cc95);}return _0x12bbc6[_0xdfb2('0x25')]();};}function saveUpdates(_0xb66e2f,_0x4e0e85){return function(_0x248032){if(_0x248032){return _0x248032[_0xdfb2('0x26')](_0xb66e2f)[_0xdfb2('0x27')](function(_0x1e4f72){return _0x1e4f72;});}return null;};}function removeEntity(_0x8d33a0,_0x34e3d5){return function(_0xe1c653){if(_0xe1c653){return _0xe1c653[_0xdfb2('0x28')]()['then'](function(){var _0x46e57c=_0xe1c653['get']({'plain':!![]});var _0x351ac0='Sounds';return db[_0xdfb2('0x29')][_0xdfb2('0x28')]({'where':{'type':_0x351ac0,'resourceId':_0x46e57c['id']}})[_0xdfb2('0x27')](function(){return _0xe1c653;});})['then'](function(){_0x8d33a0['status'](0xcc)[_0xdfb2('0x1c')]();});}};}function handleEntityNotFound(_0x571db2,_0x1fc190){return function(_0x238cd8){if(!_0x238cd8){_0x571db2[_0xdfb2('0x2a')](0x194);}return _0x238cd8;};}function handleError(_0x135589,_0x184fd9){_0x184fd9=_0x184fd9||0x1f4;return function(_0x4fe6b4){logger['error'](_0x4fe6b4[_0xdfb2('0x2b')]);if(_0x4fe6b4[_0xdfb2('0x2c')]){delete _0x4fe6b4[_0xdfb2('0x2c')];}_0x135589[_0xdfb2('0x1b')](_0x184fd9)['send'](_0x4fe6b4);};}exports[_0xdfb2('0x2d')]=function(_0x21b371,_0x341081){var _0x17d776={},_0x502115={},_0x56c11f={'count':0x0,'rows':[]};var _0xb0d97b=_[_0xdfb2('0x2e')](db['Sound'][_0xdfb2('0x2f')],function(_0x297b4d){return{'name':_0x297b4d[_0xdfb2('0x30')],'type':_0x297b4d[_0xdfb2('0x31')]['key']};});_0x502115[_0xdfb2('0x32')]=_[_0xdfb2('0x2e')](_0xb0d97b,_0xdfb2('0x2c'));_0x502115['query']=_[_0xdfb2('0x33')](_0x21b371[_0xdfb2('0x34')]);_0x502115[_0xdfb2('0x35')]=_[_0xdfb2('0x36')](_0x502115[_0xdfb2('0x32')],_0x502115['query']);_0x17d776[_0xdfb2('0x37')]=_[_0xdfb2('0x36')](_0x502115[_0xdfb2('0x32')],qs[_0xdfb2('0x38')](_0x21b371[_0xdfb2('0x34')][_0xdfb2('0x38')]));_0x17d776[_0xdfb2('0x37')]=_0x17d776[_0xdfb2('0x37')][_0xdfb2('0x39')]?_0x17d776[_0xdfb2('0x37')]:_0x502115[_0xdfb2('0x32')];if(!_0x21b371[_0xdfb2('0x34')][_0xdfb2('0x3a')](_0xdfb2('0x3b'))){_0x17d776['limit']=qs[_0xdfb2('0x1f')](_0x21b371[_0xdfb2('0x34')][_0xdfb2('0x1f')]);_0x17d776[_0xdfb2('0x1e')]=qs[_0xdfb2('0x1e')](_0x21b371['query']['offset']);}_0x17d776['order']=qs[_0xdfb2('0x3c')](_0x21b371[_0xdfb2('0x34')][_0xdfb2('0x3c')]);_0x17d776[_0xdfb2('0x3d')]=qs[_0xdfb2('0x35')](_[_0xdfb2('0x3e')](_0x21b371[_0xdfb2('0x34')],_0x502115['filters']),_0xb0d97b);if(_0x21b371[_0xdfb2('0x34')]['filter']){_0x17d776[_0xdfb2('0x3d')]=_['merge'](_0x17d776[_0xdfb2('0x3d')],{'$or':_['map'](_0xb0d97b,function(_0x58db75){if(_0x58db75['type']!==_0xdfb2('0x3f')){var _0x12e6b8={};_0x12e6b8[_0x58db75[_0xdfb2('0x2c')]]={'$like':'%'+_0x21b371['query'][_0xdfb2('0x40')]+'%'};return _0x12e6b8;}})});}_0x17d776=_[_0xdfb2('0x41')]({},_0x17d776,_0x21b371[_0xdfb2('0x42')]);var _0x23ba04={'where':_0x17d776[_0xdfb2('0x3d')]};return db[_0xdfb2('0x43')][_0xdfb2('0x21')](_0x23ba04)['then'](function(_0x3b27be){_0x56c11f[_0xdfb2('0x21')]=_0x3b27be;if(_0x21b371['query'][_0xdfb2('0x44')]){_0x17d776[_0xdfb2('0x45')]=[{'all':!![]}];}return db[_0xdfb2('0x43')][_0xdfb2('0x46')](_0x17d776);})[_0xdfb2('0x27')](function(_0x3f50ba){_0x56c11f[_0xdfb2('0x47')]=_0x3f50ba;return _0x56c11f;})[_0xdfb2('0x27')](respondWithFilteredResult(_0x341081,_0x17d776))[_0xdfb2('0x48')](handleError(_0x341081,null));};exports[_0xdfb2('0x49')]=function(_0x320182,_0x37f7b7){var _0x4f6d84={'raw':!![],'where':{'id':_0x320182[_0xdfb2('0x4a')]['id']}},_0x160636={};_0x160636[_0xdfb2('0x32')]=_[_0xdfb2('0x33')](db['Sound'][_0xdfb2('0x2f')]);_0x160636[_0xdfb2('0x34')]=_[_0xdfb2('0x33')](_0x320182[_0xdfb2('0x34')]);_0x160636[_0xdfb2('0x35')]=_[_0xdfb2('0x36')](_0x160636[_0xdfb2('0x32')],_0x160636[_0xdfb2('0x34')]);_0x4f6d84[_0xdfb2('0x37')]=_[_0xdfb2('0x36')](_0x160636[_0xdfb2('0x32')],qs[_0xdfb2('0x38')](_0x320182['query'][_0xdfb2('0x38')]));_0x4f6d84[_0xdfb2('0x37')]=_0x4f6d84[_0xdfb2('0x37')]['length']?_0x4f6d84[_0xdfb2('0x37')]:_0x160636[_0xdfb2('0x32')];if(_0x320182[_0xdfb2('0x34')][_0xdfb2('0x44')]){_0x4f6d84[_0xdfb2('0x45')]=[{'all':!![]}];}_0x4f6d84=_[_0xdfb2('0x41')]({},_0x4f6d84,_0x320182[_0xdfb2('0x42')]);return db[_0xdfb2('0x43')][_0xdfb2('0x4b')](_0x4f6d84)['then'](handleEntityNotFound(_0x37f7b7,null))['then'](respondWithResult(_0x37f7b7,null))['catch'](handleError(_0x37f7b7,null));};exports['download']=function(_0x35aff7,_0x196776,_0x49c546){return db[_0xdfb2('0x43')][_0xdfb2('0x4b')]({'where':{'id':_0x35aff7[_0xdfb2('0x4a')]['id']},'attributes':[_0xdfb2('0x2c'),_0xdfb2('0x4c'),_0xdfb2('0x4d')],'raw':!![]})[_0xdfb2('0x27')](handleEntityNotFound(_0x196776,null))['then'](function(_0x4539bc){if(_0x4539bc){if(!fs[_0xdfb2('0x4e')](path['join'](config[_0xdfb2('0x4f')],_0xdfb2('0x50'),_0x4539bc[_0xdfb2('0x4c')]+'.'+_0x4539bc['converted_format']))){throw new db[(_0xdfb2('0x51'))][(_0xdfb2('0x52'))](_0xdfb2('0x53'));}return _0x196776['download'](path[_0xdfb2('0x54')](config[_0xdfb2('0x4f')],_0xdfb2('0x50'),util[_0xdfb2('0x55')](_0xdfb2('0x56'),_0x4539bc[_0xdfb2('0x4c')],_0x4539bc[_0xdfb2('0x4d')])),util[_0xdfb2('0x55')](_0xdfb2('0x56'),_0x4539bc[_0xdfb2('0x2c')],_0x4539bc[_0xdfb2('0x4d')]));}return null;})[_0xdfb2('0x48')](handleError(_0x196776,null));};exports[_0xdfb2('0x57')]=function(_0x320c13,_0x3eeba8,_0x287158){var _0x36299c={'name':path[_0xdfb2('0x58')](_0x320c13['file'][_0xdfb2('0x59')],path[_0xdfb2('0x5a')](_0x320c13[_0xdfb2('0x5b')]['originalname'])),'save_name':path[_0xdfb2('0x58')](_0x320c13[_0xdfb2('0x5b')]['filename'],path[_0xdfb2('0x5a')](_0x320c13[_0xdfb2('0x5b')][_0xdfb2('0x5c')])),'original_format':path['extname'](_0x320c13['file'][_0xdfb2('0x59')])[_0xdfb2('0x5d')](0x1),'converted_format':_0xdfb2('0x5e')};var _0x4bc265=path['join'](config[_0xdfb2('0x4f')],'server/files/sounds/original',_0x320c13[_0xdfb2('0x5b')]['filename']);var _0x55d8e9=path['join'](config['root'],_0xdfb2('0x50'),util['format']('%s.%s',path[_0xdfb2('0x58')](_0x320c13[_0xdfb2('0x5b')][_0xdfb2('0x5c')],path['extname'](_0x320c13['file'][_0xdfb2('0x5c')])),_0x36299c['converted_format']));logger[_0xdfb2('0x5f')]('Sound\x20upload\x20filepath:\x20%s',_0x4bc265);logger[_0xdfb2('0x5f')]('Sound\x20upload\x20destination:\x20%s',_0x55d8e9);try{fs[_0xdfb2('0x60')](_0x4bc265,parseInt('0777',0x8));var _0x450045=sox['transcode'](_0x4bc265,_0x55d8e9,{'sampleRate':0x1f40,'format':_0xdfb2('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x450045['on'](_0xdfb2('0x61'),function(_0x41800f){fs['unlinkSync'](_0x4bc265);_0x3eeba8[_0xdfb2('0x1b')](0x1f4)[_0xdfb2('0x62')](_0x41800f);});_0x450045['on']('src',function(_0x19872d){_0x36299c[_0xdfb2('0x63')]=isNaN(_0x19872d[_0xdfb2('0x64')])?null:_0x19872d[_0xdfb2('0x64')]*0x3e8;_0x36299c['original_sampleCount']=isNaN(_0x19872d[_0xdfb2('0x65')])?null:_0x19872d[_0xdfb2('0x65')];_0x36299c[_0xdfb2('0x66')]=isNaN(_0x19872d['channelCount'])?null:_0x19872d[_0xdfb2('0x67')];_0x36299c[_0xdfb2('0x68')]=isNaN(_0x19872d[_0xdfb2('0x69')])?null:_0x19872d[_0xdfb2('0x69')];_0x36299c[_0xdfb2('0x6a')]=isNaN(_0x19872d[_0xdfb2('0x6b')])?null:_0x19872d[_0xdfb2('0x6b')];});_0x450045['on'](_0xdfb2('0x6c'),function(_0xda21d7){_0x36299c['converted_duration']=isNaN(_0xda21d7[_0xdfb2('0x64')])?null:_0xda21d7['duration']*0x3e8;_0x36299c[_0xdfb2('0x6d')]=isNaN(_0xda21d7[_0xdfb2('0x65')])?null:_0xda21d7[_0xdfb2('0x65')];_0x36299c[_0xdfb2('0x6e')]=isNaN(_0xda21d7[_0xdfb2('0x67')])?null:_0xda21d7[_0xdfb2('0x67')];_0x36299c['converted_bitRate']=isNaN(_0xda21d7[_0xdfb2('0x69')])?null:_0xda21d7[_0xdfb2('0x69')];_0x36299c['converted_sampleRate']=isNaN(_0xda21d7[_0xdfb2('0x6b')])?null:_0xda21d7[_0xdfb2('0x6b')];});_0x450045['on'](_0xdfb2('0x1c'),function(){fs[_0xdfb2('0x60')](_0x55d8e9,parseInt(_0xdfb2('0x6f'),0x8));return db[_0xdfb2('0x43')][_0xdfb2('0x57')](_0x36299c)[_0xdfb2('0x27')](function(_0x4c4cb8){var _0x2bc230={'role':_0x320c13[_0xdfb2('0x70')][_0xdfb2('0x71')],'userProfileId':_0x320c13[_0xdfb2('0x70')][_0xdfb2('0x72')]};if(!_0x2bc230)throw new Error(_0xdfb2('0x73'));if(_0x2bc230[_0xdfb2('0x71')]==='user'){var _0x42abcd=_0x4c4cb8[_0xdfb2('0x74')]({'plain':!![]});return db[_0xdfb2('0x75')][_0xdfb2('0x4b')]({'where':{'name':_0xdfb2('0x76'),'userProfileId':_0x2bc230[_0xdfb2('0x72')]},'raw':!![]})[_0xdfb2('0x27')](function(_0x50a1ca){if(_0x50a1ca&&_0x50a1ca[_0xdfb2('0x77')]===0x0){return db['UserProfileResource'][_0xdfb2('0x57')]({'name':_0x42abcd[_0xdfb2('0x2c')],'resourceId':_0x42abcd['id'],'type':_0x50a1ca[_0xdfb2('0x2c')],'sectionId':_0x50a1ca['id']},{})[_0xdfb2('0x27')](function(){return _0x4c4cb8;});}else{return _0x4c4cb8;}})[_0xdfb2('0x48')](function(_0x41a74c){logger[_0xdfb2('0x61')](_0xdfb2('0x78'),_0x41a74c);throw _0x41a74c;});}return _0x4c4cb8;})[_0xdfb2('0x27')](respondWithResult(_0x3eeba8,null))['catch'](handleError(_0x3eeba8,null));});_0x450045['start']();}catch(_0x4ac3d9){_0x3eeba8[_0xdfb2('0x1b')](0x1f4)[_0xdfb2('0x62')](_0x4ac3d9);}};exports[_0xdfb2('0x26')]=function(_0x139786,_0xd06d20,_0x3181cf){return db[_0xdfb2('0x43')][_0xdfb2('0x4b')]({'where':{'id':_0x139786[_0xdfb2('0x4a')]['id']}})['then'](handleEntityNotFound(_0xd06d20,null))['then'](saveUpdates(_['pick'](_0x139786[_0xdfb2('0x70')],[_0xdfb2('0x2c'),_0xdfb2('0x79')]),null))[_0xdfb2('0x27')](respondWithResult(_0xd06d20,null))[_0xdfb2('0x48')](handleError(_0xd06d20,null));};exports[_0xdfb2('0x7a')]=function(_0x4fd92f,_0x514490,_0x5bbaa2){return db[_0xdfb2('0x43')][_0xdfb2('0x4b')]({'where':{'id':_0x4fd92f[_0xdfb2('0x4a')]['id']}})['then'](function(_0x33550b){if(_0x33550b){return _0x33550b[_0xdfb2('0x28')]();}})['then'](function(_0x3b69af){var _0x45cfd4=path[_0xdfb2('0x54')](config[_0xdfb2('0x4f')],_0xdfb2('0x7b'),util[_0xdfb2('0x55')]('%s.%s',_0x3b69af[_0xdfb2('0x4c')],_0x3b69af['original_format']));var _0x5b4a9b=path[_0xdfb2('0x54')](config['root'],_0xdfb2('0x50'),util[_0xdfb2('0x55')](_0xdfb2('0x56'),_0x3b69af[_0xdfb2('0x4c')],_0x3b69af[_0xdfb2('0x4d')]));fs[_0xdfb2('0x7c')](_0x45cfd4);fs[_0xdfb2('0x7c')](_0x5b4a9b);return _0x3b69af;})[_0xdfb2('0x27')](function(_0x385530){if(_0x385530){return _0x514490[_0xdfb2('0x1b')](0xcc)['end']();}})[_0xdfb2('0x27')](handleEntityNotFound(_0x514490,null))[_0xdfb2('0x48')](handleError(_0x514490,null));}; \ No newline at end of file +var _0xd3c3=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','then','get','Sounds','UserProfileResource','destroy','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','save_name','existsSync','server/files/sounds/converted','converted_format','Sequelize','Sound\x20not\x20found','download','join','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3c3,0x1ef));var _0x3d3c=function(_0x192258,_0x4de6e3){_0x192258=_0x192258-0x0;var _0x1d08bb=_0xd3c3[_0x192258];return _0x1d08bb;};'use strict';var emlformat=require(_0x3d3c('0x0'));var rimraf=require(_0x3d3c('0x1'));var zipdir=require(_0x3d3c('0x2'));var jsonpatch=require(_0x3d3c('0x3'));var rp=require(_0x3d3c('0x4'));var moment=require(_0x3d3c('0x5'));var BPromise=require(_0x3d3c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3d3c('0x7'));var sox=require(_0x3d3c('0x8'));var csv=require(_0x3d3c('0x9'));var ejs=require(_0x3d3c('0xa'));var fs=require('fs');var fs_extra=require(_0x3d3c('0xb'));var _=require(_0x3d3c('0xc'));var squel=require(_0x3d3c('0xd'));var crypto=require(_0x3d3c('0xe'));var jsforce=require(_0x3d3c('0xf'));var deskjs=require(_0x3d3c('0x10'));var toCsv=require(_0x3d3c('0x9'));var querystring=require(_0x3d3c('0x11'));var Papa=require(_0x3d3c('0x12'));var Redis=require(_0x3d3c('0x13'));var authService=require(_0x3d3c('0x14'));var qs=require(_0x3d3c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d3c('0x16'));var logger=require(_0x3d3c('0x17'))(_0x3d3c('0x18'));var utils=require('../../config/utils');var config=require(_0x3d3c('0x19'));var licenseUtil=require(_0x3d3c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c012d,_0x1a78fb){_0x1a78fb=_0x1a78fb||0xcc;return function(_0x2bdf34){if(_0x2bdf34){return _0x5c012d[_0x3d3c('0x1b')](_0x1a78fb);}return _0x5c012d[_0x3d3c('0x1c')](_0x1a78fb)[_0x3d3c('0x1d')]();};}function respondWithResult(_0x110638,_0x137c82){_0x137c82=_0x137c82||0xc8;return function(_0x2a6e34){if(_0x2a6e34){return _0x110638[_0x3d3c('0x1c')](_0x137c82)[_0x3d3c('0x1e')](_0x2a6e34);}};}function respondWithFilteredResult(_0x469f32,_0x199b7e){return function(_0x5190ea){if(_0x5190ea){var _0x51aa54=typeof _0x199b7e[_0x3d3c('0x1f')]==='undefined'&&typeof _0x199b7e[_0x3d3c('0x20')]===_0x3d3c('0x21');var _0x53b351=_0x5190ea[_0x3d3c('0x22')];var _0x43e079=_0x51aa54?0x0:_0x199b7e[_0x3d3c('0x1f')];var _0x4afa20=_0x51aa54?_0x5190ea[_0x3d3c('0x22')]:_0x199b7e[_0x3d3c('0x1f')]+_0x199b7e[_0x3d3c('0x20')];var _0x50cd4e;if(_0x4afa20>=_0x53b351){_0x4afa20=_0x53b351;_0x50cd4e=0xc8;}else{_0x50cd4e=0xce;}_0x469f32[_0x3d3c('0x1c')](_0x50cd4e);return _0x469f32['set'](_0x3d3c('0x23'),_0x43e079+'-'+_0x4afa20+'/'+_0x53b351)['json'](_0x5190ea);}return null;};}function patchUpdates(_0x3d6b6c){return function(_0xb93fa1){try{jsonpatch[_0x3d3c('0x24')](_0xb93fa1,_0x3d6b6c,!![]);}catch(_0xce028a){return BPromise[_0x3d3c('0x25')](_0xce028a);}return _0xb93fa1['save']();};}function saveUpdates(_0x4e5342,_0x296d88){return function(_0x6e4bf2){if(_0x6e4bf2){return _0x6e4bf2['update'](_0x4e5342)[_0x3d3c('0x26')](function(_0xb8af79){return _0xb8af79;});}return null;};}function removeEntity(_0x1cef39,_0x1ed111){return function(_0x32056f){if(_0x32056f){return _0x32056f['destroy']()[_0x3d3c('0x26')](function(){var _0x577c2a=_0x32056f[_0x3d3c('0x27')]({'plain':!![]});var _0x30386c=_0x3d3c('0x28');return db[_0x3d3c('0x29')][_0x3d3c('0x2a')]({'where':{'type':_0x30386c,'resourceId':_0x577c2a['id']}})[_0x3d3c('0x26')](function(){return _0x32056f;});})[_0x3d3c('0x26')](function(){_0x1cef39[_0x3d3c('0x1c')](0xcc)[_0x3d3c('0x1d')]();});}};}function handleEntityNotFound(_0x58bc3c,_0x443b18){return function(_0x49f423){if(!_0x49f423){_0x58bc3c[_0x3d3c('0x1b')](0x194);}return _0x49f423;};}function handleError(_0x177085,_0x12764f){_0x12764f=_0x12764f||0x1f4;return function(_0x485207){logger[_0x3d3c('0x2b')](_0x485207[_0x3d3c('0x2c')]);if(_0x485207['name']){delete _0x485207[_0x3d3c('0x2d')];}_0x177085['status'](_0x12764f)[_0x3d3c('0x2e')](_0x485207);};}exports[_0x3d3c('0x2f')]=function(_0x5b6b13,_0x1412e6){var _0x459459={},_0x5df754={},_0x5dbc0e={'count':0x0,'rows':[]};var _0x8d59c3=_[_0x3d3c('0x30')](db[_0x3d3c('0x31')][_0x3d3c('0x32')],function(_0x2ed02d){return{'name':_0x2ed02d[_0x3d3c('0x33')],'type':_0x2ed02d['type'][_0x3d3c('0x34')]};});_0x5df754[_0x3d3c('0x35')]=_[_0x3d3c('0x30')](_0x8d59c3,'name');_0x5df754[_0x3d3c('0x36')]=_[_0x3d3c('0x37')](_0x5b6b13['query']);_0x5df754['filters']=_[_0x3d3c('0x38')](_0x5df754[_0x3d3c('0x35')],_0x5df754[_0x3d3c('0x36')]);_0x459459[_0x3d3c('0x39')]=_[_0x3d3c('0x38')](_0x5df754['model'],qs[_0x3d3c('0x3a')](_0x5b6b13[_0x3d3c('0x36')][_0x3d3c('0x3a')]));_0x459459[_0x3d3c('0x39')]=_0x459459[_0x3d3c('0x39')][_0x3d3c('0x3b')]?_0x459459['attributes']:_0x5df754[_0x3d3c('0x35')];if(!_0x5b6b13[_0x3d3c('0x36')][_0x3d3c('0x3c')](_0x3d3c('0x3d'))){_0x459459['limit']=qs[_0x3d3c('0x20')](_0x5b6b13[_0x3d3c('0x36')][_0x3d3c('0x20')]);_0x459459[_0x3d3c('0x1f')]=qs['offset'](_0x5b6b13[_0x3d3c('0x36')][_0x3d3c('0x1f')]);}_0x459459[_0x3d3c('0x3e')]=qs[_0x3d3c('0x3f')](_0x5b6b13[_0x3d3c('0x36')]['sort']);_0x459459[_0x3d3c('0x40')]=qs[_0x3d3c('0x41')](_[_0x3d3c('0x42')](_0x5b6b13['query'],_0x5df754[_0x3d3c('0x41')]),_0x8d59c3);if(_0x5b6b13['query']['filter']){_0x459459[_0x3d3c('0x40')]=_[_0x3d3c('0x43')](_0x459459[_0x3d3c('0x40')],{'$or':_[_0x3d3c('0x30')](_0x8d59c3,function(_0x3f926e){if(_0x3f926e['type']!==_0x3d3c('0x44')){var _0x498766={};_0x498766[_0x3f926e[_0x3d3c('0x2d')]]={'$like':'%'+_0x5b6b13[_0x3d3c('0x36')][_0x3d3c('0x45')]+'%'};return _0x498766;}})});}_0x459459=_[_0x3d3c('0x43')]({},_0x459459,_0x5b6b13[_0x3d3c('0x46')]);var _0x9eb39a={'where':_0x459459[_0x3d3c('0x40')]};return db[_0x3d3c('0x31')]['count'](_0x9eb39a)[_0x3d3c('0x26')](function(_0x4dbe3a){_0x5dbc0e[_0x3d3c('0x22')]=_0x4dbe3a;if(_0x5b6b13[_0x3d3c('0x36')]['includeAll']){_0x459459[_0x3d3c('0x47')]=[{'all':!![]}];}return db['Sound'][_0x3d3c('0x48')](_0x459459);})[_0x3d3c('0x26')](function(_0x502923){_0x5dbc0e[_0x3d3c('0x49')]=_0x502923;return _0x5dbc0e;})[_0x3d3c('0x26')](respondWithFilteredResult(_0x1412e6,_0x459459))[_0x3d3c('0x4a')](handleError(_0x1412e6,null));};exports[_0x3d3c('0x4b')]=function(_0x3c5ae5,_0x539031){var _0x2f9205={'raw':!![],'where':{'id':_0x3c5ae5[_0x3d3c('0x4c')]['id']}},_0x414e20={};_0x414e20[_0x3d3c('0x35')]=_[_0x3d3c('0x37')](db[_0x3d3c('0x31')][_0x3d3c('0x32')]);_0x414e20[_0x3d3c('0x36')]=_['keys'](_0x3c5ae5[_0x3d3c('0x36')]);_0x414e20[_0x3d3c('0x41')]=_[_0x3d3c('0x38')](_0x414e20[_0x3d3c('0x35')],_0x414e20[_0x3d3c('0x36')]);_0x2f9205[_0x3d3c('0x39')]=_['intersection'](_0x414e20[_0x3d3c('0x35')],qs[_0x3d3c('0x3a')](_0x3c5ae5[_0x3d3c('0x36')][_0x3d3c('0x3a')]));_0x2f9205[_0x3d3c('0x39')]=_0x2f9205['attributes']['length']?_0x2f9205['attributes']:_0x414e20[_0x3d3c('0x35')];if(_0x3c5ae5[_0x3d3c('0x36')][_0x3d3c('0x4d')]){_0x2f9205[_0x3d3c('0x47')]=[{'all':!![]}];}_0x2f9205=_['merge']({},_0x2f9205,_0x3c5ae5[_0x3d3c('0x46')]);return db[_0x3d3c('0x31')]['find'](_0x2f9205)[_0x3d3c('0x26')](handleEntityNotFound(_0x539031,null))['then'](respondWithResult(_0x539031,null))[_0x3d3c('0x4a')](handleError(_0x539031,null));};exports['download']=function(_0x1fc035,_0x1b5d6c,_0xcf1c2c){return db[_0x3d3c('0x31')][_0x3d3c('0x4e')]({'where':{'id':_0x1fc035[_0x3d3c('0x4c')]['id']},'attributes':[_0x3d3c('0x2d'),_0x3d3c('0x4f'),'converted_format'],'raw':!![]})[_0x3d3c('0x26')](handleEntityNotFound(_0x1b5d6c,null))[_0x3d3c('0x26')](function(_0x1e27fb){if(_0x1e27fb){if(!fs[_0x3d3c('0x50')](path['join'](config['root'],_0x3d3c('0x51'),_0x1e27fb['save_name']+'.'+_0x1e27fb[_0x3d3c('0x52')]))){throw new db[(_0x3d3c('0x53'))]['ValidationError'](_0x3d3c('0x54'));}return _0x1b5d6c[_0x3d3c('0x55')](path[_0x3d3c('0x56')](config['root'],_0x3d3c('0x51'),util[_0x3d3c('0x57')]('%s.%s',_0x1e27fb[_0x3d3c('0x4f')],_0x1e27fb[_0x3d3c('0x52')])),util['format'](_0x3d3c('0x58'),_0x1e27fb['name'],_0x1e27fb[_0x3d3c('0x52')]));}return null;})[_0x3d3c('0x4a')](handleError(_0x1b5d6c,null));};exports[_0x3d3c('0x59')]=function(_0x43b5eb,_0x3190da,_0x1a1950){var _0xf2e2c7={'name':path[_0x3d3c('0x5a')](_0x43b5eb[_0x3d3c('0x5b')][_0x3d3c('0x5c')],path['extname'](_0x43b5eb[_0x3d3c('0x5b')][_0x3d3c('0x5c')])),'save_name':path[_0x3d3c('0x5a')](_0x43b5eb[_0x3d3c('0x5b')]['filename'],path[_0x3d3c('0x5d')](_0x43b5eb[_0x3d3c('0x5b')][_0x3d3c('0x5e')])),'original_format':path[_0x3d3c('0x5d')](_0x43b5eb[_0x3d3c('0x5b')][_0x3d3c('0x5c')])[_0x3d3c('0x5f')](0x1),'converted_format':_0x3d3c('0x60')};var _0x4add31=path[_0x3d3c('0x56')](config[_0x3d3c('0x61')],_0x3d3c('0x62'),_0x43b5eb[_0x3d3c('0x5b')]['filename']);var _0x5af7c3=path[_0x3d3c('0x56')](config[_0x3d3c('0x61')],_0x3d3c('0x51'),util[_0x3d3c('0x57')]('%s.%s',path['basename'](_0x43b5eb['file'][_0x3d3c('0x5e')],path[_0x3d3c('0x5d')](_0x43b5eb[_0x3d3c('0x5b')][_0x3d3c('0x5e')])),_0xf2e2c7[_0x3d3c('0x52')]));logger[_0x3d3c('0x63')](_0x3d3c('0x64'),_0x4add31);logger[_0x3d3c('0x63')](_0x3d3c('0x65'),_0x5af7c3);try{fs[_0x3d3c('0x66')](_0x4add31,parseInt(_0x3d3c('0x67'),0x8));var _0x137a49=sox[_0x3d3c('0x68')](_0x4add31,_0x5af7c3,{'sampleRate':0x1f40,'format':_0x3d3c('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x137a49['on'](_0x3d3c('0x2b'),function(_0x5a9905){fs[_0x3d3c('0x69')](_0x4add31);_0x3190da[_0x3d3c('0x1c')](0x1f4)[_0x3d3c('0x2e')](_0x5a9905);});_0x137a49['on'](_0x3d3c('0x6a'),function(_0x44ed65){_0xf2e2c7['original_duration']=isNaN(_0x44ed65['duration'])?null:_0x44ed65[_0x3d3c('0x6b')]*0x3e8;_0xf2e2c7['original_sampleCount']=isNaN(_0x44ed65[_0x3d3c('0x6c')])?null:_0x44ed65[_0x3d3c('0x6c')];_0xf2e2c7['original_channelCount']=isNaN(_0x44ed65[_0x3d3c('0x6d')])?null:_0x44ed65[_0x3d3c('0x6d')];_0xf2e2c7[_0x3d3c('0x6e')]=isNaN(_0x44ed65[_0x3d3c('0x6f')])?null:_0x44ed65[_0x3d3c('0x6f')];_0xf2e2c7['original_sampleRate']=isNaN(_0x44ed65[_0x3d3c('0x70')])?null:_0x44ed65[_0x3d3c('0x70')];});_0x137a49['on'](_0x3d3c('0x71'),function(_0x269240){_0xf2e2c7[_0x3d3c('0x72')]=isNaN(_0x269240['duration'])?null:_0x269240['duration']*0x3e8;_0xf2e2c7[_0x3d3c('0x73')]=isNaN(_0x269240[_0x3d3c('0x6c')])?null:_0x269240[_0x3d3c('0x6c')];_0xf2e2c7[_0x3d3c('0x74')]=isNaN(_0x269240[_0x3d3c('0x6d')])?null:_0x269240[_0x3d3c('0x6d')];_0xf2e2c7['converted_bitRate']=isNaN(_0x269240[_0x3d3c('0x6f')])?null:_0x269240[_0x3d3c('0x6f')];_0xf2e2c7[_0x3d3c('0x75')]=isNaN(_0x269240[_0x3d3c('0x70')])?null:_0x269240[_0x3d3c('0x70')];});_0x137a49['on'](_0x3d3c('0x1d'),function(){fs[_0x3d3c('0x66')](_0x5af7c3,parseInt(_0x3d3c('0x67'),0x8));return db[_0x3d3c('0x31')]['create'](_0xf2e2c7)[_0x3d3c('0x26')](function(_0x33ff1a){var _0x46a841={'role':_0x43b5eb['body'][_0x3d3c('0x76')],'userProfileId':_0x43b5eb['body']['userProfileId']};if(!_0x46a841)throw new Error(_0x3d3c('0x77'));if(_0x46a841['role']==='user'){var _0x4635fd=_0x33ff1a[_0x3d3c('0x27')]({'plain':!![]});return db[_0x3d3c('0x78')][_0x3d3c('0x4e')]({'where':{'name':_0x3d3c('0x28'),'userProfileId':_0x46a841['userProfileId']},'raw':!![]})[_0x3d3c('0x26')](function(_0x4df623){if(_0x4df623&&_0x4df623['autoAssociation']===0x0){return db[_0x3d3c('0x29')][_0x3d3c('0x59')]({'name':_0x4635fd[_0x3d3c('0x2d')],'resourceId':_0x4635fd['id'],'type':_0x4df623[_0x3d3c('0x2d')],'sectionId':_0x4df623['id']},{})[_0x3d3c('0x26')](function(){return _0x33ff1a;});}else{return _0x33ff1a;}})[_0x3d3c('0x4a')](function(_0x55f712){logger[_0x3d3c('0x2b')](_0x3d3c('0x79'),_0x55f712);throw _0x55f712;});}return _0x33ff1a;})[_0x3d3c('0x26')](respondWithResult(_0x3190da,null))[_0x3d3c('0x4a')](handleError(_0x3190da,null));});_0x137a49[_0x3d3c('0x7a')]();}catch(_0x48b448){_0x3190da['status'](0x1f4)[_0x3d3c('0x2e')](_0x48b448);}};exports[_0x3d3c('0x7b')]=function(_0x6bc6b8,_0x508d4b,_0xcda9f8){return db[_0x3d3c('0x31')][_0x3d3c('0x4e')]({'where':{'id':_0x6bc6b8[_0x3d3c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x508d4b,null))[_0x3d3c('0x26')](saveUpdates(_[_0x3d3c('0x42')](_0x6bc6b8['body'],[_0x3d3c('0x2d'),_0x3d3c('0x7c')]),null))['then'](respondWithResult(_0x508d4b,null))['catch'](handleError(_0x508d4b,null));};exports[_0x3d3c('0x7d')]=function(_0x508878,_0x2d9240,_0x1ef4da){return db[_0x3d3c('0x31')][_0x3d3c('0x4e')]({'where':{'id':_0x508878[_0x3d3c('0x4c')]['id']}})['then'](function(_0x3a6160){if(_0x3a6160){return _0x3a6160['destroy']();}})[_0x3d3c('0x26')](function(_0xfd58ee){var _0x5e24d2=path['join'](config[_0x3d3c('0x61')],_0x3d3c('0x62'),util[_0x3d3c('0x57')](_0x3d3c('0x58'),_0xfd58ee[_0x3d3c('0x4f')],_0xfd58ee[_0x3d3c('0x7e')]));var _0x92c701=path[_0x3d3c('0x56')](config[_0x3d3c('0x61')],'server/files/sounds/converted',util[_0x3d3c('0x57')](_0x3d3c('0x58'),_0xfd58ee[_0x3d3c('0x4f')],_0xfd58ee['converted_format']));fs[_0x3d3c('0x69')](_0x5e24d2);fs[_0x3d3c('0x69')](_0x92c701);return _0xfd58ee;})[_0x3d3c('0x26')](function(_0x1c3eed){if(_0x1c3eed){return _0x2d9240[_0x3d3c('0x1c')](0xcc)['end']();}})[_0x3d3c('0x26')](handleEntityNotFound(_0x2d9240,null))[_0x3d3c('0x4a')](handleError(_0x2d9240,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 92b9bde..602046e 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 _0x3b61=['./sound.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x20ebaf,_0x2e737f){var _0x3fa8d7=function(_0x4d72f1){while(--_0x4d72f1){_0x20ebaf['push'](_0x20ebaf['shift']());}};_0x3fa8d7(++_0x2e737f);}(_0x3b61,0xa8));var _0x13b6=function(_0x58cff3,_0x52ed33){_0x58cff3=_0x58cff3-0x0;var _0x3a2cb0=_0x3b61[_0x58cff3];return _0x3a2cb0;};'use strict';var _=require(_0x13b6('0x0'));var util=require(_0x13b6('0x1'));var logger=require(_0x13b6('0x2'))(_0x13b6('0x3'));var moment=require('moment');var BPromise=require(_0x13b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13b6('0x5'));var rimraf=require(_0x13b6('0x6'));var config=require(_0x13b6('0x7'));var attributes=require(_0x13b6('0x8'));module[_0x13b6('0x9')]=function(_0x17f1ab,_0x3fa2a2){return _0x17f1ab[_0x13b6('0xa')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4df=['moment','bluebird','rimraf','./sound.attributes','define','Sound','lodash','util','../../config/logger','api'];(function(_0x56b610,_0x568e2a){var _0x2ca198=function(_0x55729f){while(--_0x55729f){_0x56b610['push'](_0x56b610['shift']());}};_0x2ca198(++_0x568e2a);}(_0xd4df,0x16e));var _0xfd4d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4df[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfd4d('0x0'));var util=require(_0xfd4d('0x1'));var logger=require(_0xfd4d('0x2'))(_0xfd4d('0x3'));var moment=require(_0xfd4d('0x4'));var BPromise=require(_0xfd4d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfd4d('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd4d('0x7'));module['exports']=function(_0x229d57,_0x1d2136){return _0x229d57[_0xfd4d('0x8')](_0xfd4d('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 78765b8..f49af69 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 _0xe7b6=['rpc','../../config/environment','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','Sound','options','raw','where','attributes','map','include','model','then','ShowSound','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x2f481c,_0x4ca48e){var _0x4d5f90=function(_0x1972ac){while(--_0x1972ac){_0x2f481c['push'](_0x2f481c['shift']());}};_0x4d5f90(++_0x4ca48e);}(_0xe7b6,0x144));var _0x6e7b=function(_0x301c75,_0x597c15){_0x301c75=_0x301c75-0x0;var _0x36cfc4=_0xe7b6[_0x301c75];return _0x36cfc4;};'use strict';var _=require(_0x6e7b('0x0'));var util=require(_0x6e7b('0x1'));var moment=require('moment');var BPromise=require(_0x6e7b('0x2'));var rs=require(_0x6e7b('0x3'));var fs=require('fs');var Redis=require(_0x6e7b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6e7b('0x5'))(_0x6e7b('0x6'));var config=require(_0x6e7b('0x7'));var jayson=require(_0x6e7b('0x8'));var client=jayson[_0x6e7b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36ddb7,_0x203770,_0x3add4e){return new BPromise(function(_0x13cf01,_0x2b0d1e){return client[_0x6e7b('0xa')](_0x36ddb7,_0x3add4e)['then'](function(_0x308d08){logger[_0x6e7b('0xb')](_0x6e7b('0xc'),_0x203770,_0x6e7b('0xd'));logger[_0x6e7b('0xe')](_0x6e7b('0xf'),_0x203770,_0x6e7b('0xd'),JSON[_0x6e7b('0x10')](_0x308d08));if(_0x308d08[_0x6e7b('0x11')]){if(_0x308d08[_0x6e7b('0x11')]['code']===0x1f4){logger[_0x6e7b('0x11')](_0x6e7b('0xc'),_0x203770,_0x308d08[_0x6e7b('0x11')]['message']);return _0x2b0d1e(_0x308d08[_0x6e7b('0x11')][_0x6e7b('0x12')]);}logger['error'](_0x6e7b('0xc'),_0x203770,_0x308d08[_0x6e7b('0x11')][_0x6e7b('0x12')]);return _0x13cf01(_0x308d08[_0x6e7b('0x11')]['message']);}else{logger[_0x6e7b('0xb')](_0x6e7b('0xc'),_0x203770,_0x6e7b('0xd'));_0x13cf01(_0x308d08['result'][_0x6e7b('0x12')]);}})['catch'](function(_0x106c84){logger[_0x6e7b('0x11')](_0x6e7b('0xc'),_0x203770,_0x106c84);_0x2b0d1e(_0x106c84);});});}exports['ShowSound']=function(_0x1c1949){var _0x4b7e96=this;return new Promise(function(_0x28212f,_0x32ec5d){return db[_0x6e7b('0x13')]['find']({'raw':_0x1c1949[_0x6e7b('0x14')]?_0x1c1949[_0x6e7b('0x14')][_0x6e7b('0x15')]===undefined?!![]:![]:!![],'where':_0x1c1949[_0x6e7b('0x14')]?_0x1c1949['options'][_0x6e7b('0x16')]||null:null,'attributes':_0x1c1949[_0x6e7b('0x14')]?_0x1c1949[_0x6e7b('0x14')][_0x6e7b('0x17')]||null:null,'include':_0x1c1949['options']?_0x1c1949[_0x6e7b('0x14')]['include']?_[_0x6e7b('0x18')](_0x1c1949[_0x6e7b('0x14')]['include'],function(_0x583722){return{'model':db[_0x583722['model']],'as':_0x583722['as'],'attributes':_0x583722['attributes'],'include':_0x583722[_0x6e7b('0x19')]?_['map'](_0x583722[_0x6e7b('0x19')],function(_0xdd2371){return{'model':db[_0xdd2371[_0x6e7b('0x1a')]],'as':_0xdd2371['as'],'attributes':_0xdd2371[_0x6e7b('0x17')],'include':_0xdd2371[_0x6e7b('0x19')]?_[_0x6e7b('0x18')](_0xdd2371[_0x6e7b('0x19')],function(_0x23b820){return{'model':db[_0x23b820[_0x6e7b('0x1a')]],'as':_0x23b820['as'],'attributes':_0x23b820[_0x6e7b('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6e7b('0x1b')](function(_0x3f3291){logger[_0x6e7b('0xb')](_0x6e7b('0x1c'),_0x1c1949);logger[_0x6e7b('0xe')](_0x6e7b('0x1c'),_0x1c1949,JSON[_0x6e7b('0x10')](_0x3f3291));_0x28212f(_0x3f3291);})[_0x6e7b('0x1d')](function(_0x50f553){logger['error'](_0x6e7b('0x1c'),_0x50f553[_0x6e7b('0x12')],_0x1c1949);_0x32ec5d(_0x4b7e96[_0x6e7b('0x11')](0x1f4,_0x50f553[_0x6e7b('0x12')]));});});}; \ No newline at end of file +var _0xef35=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','find','raw','options','where','include','map','model','attributes','ShowSound','debug','stringify','catch','moment','ioredis','../../mysqldb'];(function(_0x1275e8,_0x40ab85){var _0x2bfdbd=function(_0x3424c7){while(--_0x3424c7){_0x1275e8['push'](_0x1275e8['shift']());}};_0x2bfdbd(++_0x40ab85);}(_0xef35,0x98));var _0x5ef3=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xef35[_0x28669c];return _0x4a3af6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5ef3('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ef3('0x1'));var db=require(_0x5ef3('0x2'))['db'];var utils=require(_0x5ef3('0x3'));var logger=require(_0x5ef3('0x4'))(_0x5ef3('0x5'));var config=require(_0x5ef3('0x6'));var jayson=require(_0x5ef3('0x7'));var client=jayson[_0x5ef3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x284857,_0x7b6373,_0x19bb19){return new BPromise(function(_0x113fb6,_0x196189){return client[_0x5ef3('0x9')](_0x284857,_0x19bb19)[_0x5ef3('0xa')](function(_0x2da40a){logger['info'](_0x5ef3('0xb'),_0x7b6373,'request\x20sent');logger['debug'](_0x5ef3('0xc'),_0x7b6373,'request\x20sent',JSON['stringify'](_0x2da40a));if(_0x2da40a[_0x5ef3('0xd')]){if(_0x2da40a[_0x5ef3('0xd')][_0x5ef3('0xe')]===0x1f4){logger[_0x5ef3('0xd')](_0x5ef3('0xb'),_0x7b6373,_0x2da40a[_0x5ef3('0xd')][_0x5ef3('0xf')]);return _0x196189(_0x2da40a[_0x5ef3('0xd')][_0x5ef3('0xf')]);}logger['error'](_0x5ef3('0xb'),_0x7b6373,_0x2da40a[_0x5ef3('0xd')]['message']);return _0x113fb6(_0x2da40a[_0x5ef3('0xd')][_0x5ef3('0xf')]);}else{logger[_0x5ef3('0x10')](_0x5ef3('0xb'),_0x7b6373,_0x5ef3('0x11'));_0x113fb6(_0x2da40a[_0x5ef3('0x12')]['message']);}})['catch'](function(_0x28a145){logger[_0x5ef3('0xd')](_0x5ef3('0xb'),_0x7b6373,_0x28a145);_0x196189(_0x28a145);});});}exports['ShowSound']=function(_0x1bf997){var _0x54c8ff=this;return new Promise(function(_0x315ba0,_0x3c882f){return db['Sound'][_0x5ef3('0x13')]({'raw':_0x1bf997['options']?_0x1bf997['options'][_0x5ef3('0x14')]===undefined?!![]:![]:!![],'where':_0x1bf997[_0x5ef3('0x15')]?_0x1bf997[_0x5ef3('0x15')][_0x5ef3('0x16')]||null:null,'attributes':_0x1bf997[_0x5ef3('0x15')]?_0x1bf997[_0x5ef3('0x15')]['attributes']||null:null,'include':_0x1bf997['options']?_0x1bf997['options'][_0x5ef3('0x17')]?_[_0x5ef3('0x18')](_0x1bf997[_0x5ef3('0x15')][_0x5ef3('0x17')],function(_0x2abb71){return{'model':db[_0x2abb71[_0x5ef3('0x19')]],'as':_0x2abb71['as'],'attributes':_0x2abb71[_0x5ef3('0x1a')],'include':_0x2abb71['include']?_['map'](_0x2abb71[_0x5ef3('0x17')],function(_0x21f966){return{'model':db[_0x21f966['model']],'as':_0x21f966['as'],'attributes':_0x21f966['attributes'],'include':_0x21f966['include']?_[_0x5ef3('0x18')](_0x21f966[_0x5ef3('0x17')],function(_0x293af1){return{'model':db[_0x293af1[_0x5ef3('0x19')]],'as':_0x293af1['as'],'attributes':_0x293af1[_0x5ef3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ef3('0xa')](function(_0xc2e978){logger[_0x5ef3('0x10')](_0x5ef3('0x1b'),_0x1bf997);logger[_0x5ef3('0x1c')]('ShowSound',_0x1bf997,JSON[_0x5ef3('0x1d')](_0xc2e978));_0x315ba0(_0xc2e978);})[_0x5ef3('0x1e')](function(_0x1c74ea){logger[_0x5ef3('0xd')](_0x5ef3('0x1b'),_0x1c74ea[_0x5ef3('0xf')],_0x1bf997);_0x3c882f(_0x54c8ff[_0x5ef3('0xd')](0x1f4,_0x1c74ea[_0x5ef3('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 89dc7b8..57021d4 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 _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x478266,_0x262b6c){var _0xba35eb=function(_0x1a20e4){while(--_0x1a20e4){_0x478266['push'](_0x478266['shift']());}};_0xba35eb(++_0x262b6c);}(_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('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x4966a4,_0x39662c){var _0x3c6bf6=function(_0x53c4f2){while(--_0x53c4f2){_0x4966a4['push'](_0x4966a4['shift']());}};_0x3c6bf6(++_0x39662c);}(_0x2032,0xd9));var _0x2203=function(_0x3c1183,_0x1ecbe8){_0x3c1183=_0x3c1183-0x0;var _0x5b2deb=_0x2032[_0x3c1183];return _0x5b2deb;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0d3f18a..875813d 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 _0x8a7b=['sequelize','exports','medium','ENUM','out','STRING','TEXT'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x8a7b,0x150));var _0xb8a7=function(_0x4c9915,_0x406b1a){_0x4c9915=_0x4c9915-0x0;var _0x473218=_0x8a7b[_0x4c9915];return _0x473218;};'use strict';var Sequelize=require(_0xb8a7('0x0'));module[_0xb8a7('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0xb8a7('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xb8a7('0x3')]('in',_0xb8a7('0x4')),'defaultValue':_0xb8a7('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xb8a7('0x5')]},'providerResponse':{'type':Sequelize[_0xb8a7('0x6')]}}; \ No newline at end of file +var _0x744f=['TEXT','sequelize','exports','medium','ENUM','out','STRING'];(function(_0x542f20,_0x107fac){var _0x35ce6d=function(_0x1bf92a){while(--_0x1bf92a){_0x542f20['push'](_0x542f20['shift']());}};_0x35ce6d(++_0x107fac);}(_0x744f,0x119));var _0xf744=function(_0x248e22,_0x115f43){_0x248e22=_0x248e22-0x0;var _0xbef947=_0x744f[_0x248e22];return _0xbef947;};'use strict';var Sequelize=require(_0xf744('0x0'));module[_0xf744('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0xf744('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xf744('0x3')]('in',_0xf744('0x4')),'defaultValue':_0xf744('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xf744('0x5')]},'providerResponse':{'type':Sequelize[_0xf744('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f400e22..423f496 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 _0x72ec=['end','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status'];(function(_0x46a75f,_0x491882){var _0x268d0f=function(_0x5fc6af){while(--_0x5fc6af){_0x46a75f['push'](_0x46a75f['shift']());}};_0x268d0f(++_0x491882);}(_0x72ec,0xc3));var _0xc72e=function(_0x2e2720,_0x1ae995){_0x2e2720=_0x2e2720-0x0;var _0x3f9d2d=_0x72ec[_0x2e2720];return _0x3f9d2d;};'use strict';var emlformat=require(_0xc72e('0x0'));var rimraf=require(_0xc72e('0x1'));var zipdir=require(_0xc72e('0x2'));var jsonpatch=require(_0xc72e('0x3'));var rp=require(_0xc72e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc72e('0x5'));var util=require(_0xc72e('0x6'));var path=require(_0xc72e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc72e('0x8'));var fs=require('fs');var fs_extra=require(_0xc72e('0x9'));var _=require(_0xc72e('0xa'));var squel=require(_0xc72e('0xb'));var crypto=require(_0xc72e('0xc'));var jsforce=require(_0xc72e('0xd'));var deskjs=require(_0xc72e('0xe'));var toCsv=require(_0xc72e('0xf'));var querystring=require(_0xc72e('0x10'));var Papa=require(_0xc72e('0x11'));var Redis=require(_0xc72e('0x12'));var authService=require(_0xc72e('0x13'));var qs=require(_0xc72e('0x14'));var as=require(_0xc72e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc72e('0x16'))('api');var utils=require(_0xc72e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc72e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10cbc7,_0xe637f2){_0xe637f2=_0xe637f2||0xcc;return function(_0x2fb526){if(_0x2fb526){return _0x10cbc7[_0xc72e('0x19')](_0xe637f2);}return _0x10cbc7[_0xc72e('0x1a')](_0xe637f2)[_0xc72e('0x1b')]();};}function respondWithResult(_0x52ca51,_0x1406a0){_0x1406a0=_0x1406a0||0xc8;return function(_0x1a6dcc){if(_0x1a6dcc){return _0x52ca51['status'](_0x1406a0)['json'](_0x1a6dcc);}};}function respondWithFilteredResult(_0x5ed8df,_0x97062d){return function(_0x6e66b5){if(_0x6e66b5){var _0x5294ca=typeof _0x97062d['offset']===_0xc72e('0x1c')&&typeof _0x97062d['limit']===_0xc72e('0x1c');var _0x407758=_0x6e66b5['count'];var _0x1bc6c6=_0x5294ca?0x0:_0x97062d[_0xc72e('0x1d')];var _0x27df1f=_0x5294ca?_0x6e66b5[_0xc72e('0x1e')]:_0x97062d['offset']+_0x97062d[_0xc72e('0x1f')];var _0x4e64cc;if(_0x27df1f>=_0x407758){_0x27df1f=_0x407758;_0x4e64cc=0xc8;}else{_0x4e64cc=0xce;}_0x5ed8df[_0xc72e('0x1a')](_0x4e64cc);return _0x5ed8df['set'](_0xc72e('0x20'),_0x1bc6c6+'-'+_0x27df1f+'/'+_0x407758)['json'](_0x6e66b5);}return null;};}function patchUpdates(_0x2f7329){return function(_0x295a43){try{jsonpatch[_0xc72e('0x21')](_0x295a43,_0x2f7329,!![]);}catch(_0x5a4e77){return BPromise[_0xc72e('0x22')](_0x5a4e77);}return _0x295a43[_0xc72e('0x23')]();};}function saveUpdates(_0x1a900c,_0x14463f){return function(_0x4c7627){if(_0x4c7627){return _0x4c7627[_0xc72e('0x24')](_0x1a900c)[_0xc72e('0x25')](function(_0xef0027){return _0xef0027;});}return null;};}function removeEntity(_0x5060c5,_0x4290d0){return function(_0x2a8513){if(_0x2a8513){return _0x2a8513[_0xc72e('0x26')]()['then'](function(){_0x5060c5[_0xc72e('0x1a')](0xcc)[_0xc72e('0x1b')]();});}};}function handleEntityNotFound(_0x373cbb,_0xb53460){return function(_0x40d7bb){if(!_0x40d7bb){_0x373cbb['sendStatus'](0x194);}return _0x40d7bb;};}function handleError(_0x2d30cd,_0x5c1764){_0x5c1764=_0x5c1764||0x1f4;return function(_0x13ca95){logger[_0xc72e('0x27')](_0x13ca95[_0xc72e('0x28')]);if(_0x13ca95[_0xc72e('0x29')]){delete _0x13ca95[_0xc72e('0x29')];}_0x2d30cd['status'](_0x5c1764)['send'](_0x13ca95);};}exports[_0xc72e('0x2a')]=function(_0x3f70a5,_0xbaba51){var _0x4dc45d={},_0x56c97a={},_0x4ae320={'count':0x0,'rows':[]};var _0x350353=_[_0xc72e('0x2b')](db[_0xc72e('0x2c')][_0xc72e('0x2d')],function(_0x161d8a){return{'name':_0x161d8a[_0xc72e('0x2e')],'type':_0x161d8a[_0xc72e('0x2f')][_0xc72e('0x30')]};});_0x56c97a['model']=_['map'](_0x350353,'name');_0x56c97a[_0xc72e('0x31')]=_[_0xc72e('0x32')](_0x3f70a5[_0xc72e('0x31')]);_0x56c97a['filters']=_[_0xc72e('0x33')](_0x56c97a[_0xc72e('0x34')],_0x56c97a[_0xc72e('0x31')]);_0x4dc45d[_0xc72e('0x35')]=_[_0xc72e('0x33')](_0x56c97a[_0xc72e('0x34')],qs['fields'](_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x36')]));_0x4dc45d[_0xc72e('0x35')]=_0x4dc45d[_0xc72e('0x35')][_0xc72e('0x37')]?_0x4dc45d[_0xc72e('0x35')]:_0x56c97a[_0xc72e('0x34')];if(!_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x38')]('nolimit')){_0x4dc45d['limit']=qs['limit'](_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x1f')]);_0x4dc45d[_0xc72e('0x1d')]=qs[_0xc72e('0x1d')](_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x1d')]);}_0x4dc45d['order']=qs[_0xc72e('0x39')](_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x39')]);_0x4dc45d[_0xc72e('0x3a')]=qs[_0xc72e('0x3b')](_[_0xc72e('0x3c')](_0x3f70a5['query'],_0x56c97a[_0xc72e('0x3b')]),_0x350353);if(_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x3d')]){_0x4dc45d[_0xc72e('0x3a')]=_[_0xc72e('0x3e')](_0x4dc45d[_0xc72e('0x3a')],{'$or':_[_0xc72e('0x2b')](_0x350353,function(_0x5be347){if(_0x5be347[_0xc72e('0x2f')]!=='VIRTUAL'){var _0x1da176={};_0x1da176[_0x5be347[_0xc72e('0x29')]]={'$like':'%'+_0x3f70a5[_0xc72e('0x31')][_0xc72e('0x3d')]+'%'};return _0x1da176;}})});}_0x4dc45d=_[_0xc72e('0x3e')]({},_0x4dc45d,_0x3f70a5[_0xc72e('0x3f')]);var _0x217a7a={'where':_0x4dc45d[_0xc72e('0x3a')]};return db[_0xc72e('0x2c')][_0xc72e('0x1e')](_0x217a7a)[_0xc72e('0x25')](function(_0x4f1f5c){_0x4ae320['count']=_0x4f1f5c;if(_0x3f70a5[_0xc72e('0x31')]['includeAll']){_0x4dc45d[_0xc72e('0x40')]=[{'all':!![]}];}return db[_0xc72e('0x2c')][_0xc72e('0x41')](_0x4dc45d);})[_0xc72e('0x25')](function(_0x2cbdf1){_0x4ae320[_0xc72e('0x42')]=_0x2cbdf1;return _0x4ae320;})[_0xc72e('0x25')](respondWithFilteredResult(_0xbaba51,_0x4dc45d))[_0xc72e('0x43')](handleError(_0xbaba51,null));};exports[_0xc72e('0x44')]=function(_0x129f5f,_0x200929){var _0x392661={'raw':!![],'where':{'id':_0x129f5f[_0xc72e('0x45')]['id']}},_0x4ba7b4={};_0x4ba7b4[_0xc72e('0x34')]=_['keys'](db[_0xc72e('0x2c')][_0xc72e('0x2d')]);_0x4ba7b4['query']=_[_0xc72e('0x32')](_0x129f5f[_0xc72e('0x31')]);_0x4ba7b4[_0xc72e('0x3b')]=_[_0xc72e('0x33')](_0x4ba7b4[_0xc72e('0x34')],_0x4ba7b4['query']);_0x392661[_0xc72e('0x35')]=_[_0xc72e('0x33')](_0x4ba7b4[_0xc72e('0x34')],qs['fields'](_0x129f5f[_0xc72e('0x31')][_0xc72e('0x36')]));_0x392661['attributes']=_0x392661[_0xc72e('0x35')][_0xc72e('0x37')]?_0x392661['attributes']:_0x4ba7b4[_0xc72e('0x34')];if(_0x129f5f[_0xc72e('0x31')][_0xc72e('0x46')]){_0x392661['include']=[{'all':!![]}];}_0x392661=_['merge']({},_0x392661,_0x129f5f['options']);return db[_0xc72e('0x2c')][_0xc72e('0x47')](_0x392661)['then'](handleEntityNotFound(_0x200929,null))[_0xc72e('0x25')](respondWithResult(_0x200929,null))[_0xc72e('0x43')](handleError(_0x200929,null));};exports[_0xc72e('0x48')]=function(_0x597e8b,_0x4a9a6e){return db['SquareMessage'][_0xc72e('0x48')](_0x597e8b[_0xc72e('0x49')],{})[_0xc72e('0x25')](respondWithResult(_0x4a9a6e,0xc9))[_0xc72e('0x43')](handleError(_0x4a9a6e,null));};exports[_0xc72e('0x24')]=function(_0xb7ec1,_0x3a1ac2){if(_0xb7ec1[_0xc72e('0x49')]['id']){delete _0xb7ec1[_0xc72e('0x49')]['id'];}return db['SquareMessage'][_0xc72e('0x47')]({'where':{'id':_0xb7ec1[_0xc72e('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a1ac2,null))[_0xc72e('0x25')](saveUpdates(_0xb7ec1[_0xc72e('0x49')],null))[_0xc72e('0x25')](respondWithResult(_0x3a1ac2,null))['catch'](handleError(_0x3a1ac2,null));};exports['destroy']=function(_0x3e5f60,_0x490e60){return db['SquareMessage']['find']({'where':{'id':_0x3e5f60[_0xc72e('0x45')]['id']}})[_0xc72e('0x25')](handleEntityNotFound(_0x490e60,null))[_0xc72e('0x25')](removeEntity(_0x490e60,null))['catch'](handleError(_0x490e60,null));}; \ No newline at end of file +var _0x71a1=['util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','update','then','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','where','pick','filters','filter','merge','include','findAll','catch','show','params','keys','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x17558f,_0x42f9f5){var _0x4a81a5=function(_0x14ec0a){while(--_0x14ec0a){_0x17558f['push'](_0x17558f['shift']());}};_0x4a81a5(++_0x42f9f5);}(_0x71a1,0x1eb));var _0x171a=function(_0x25b7e9,_0x40e68e){_0x25b7e9=_0x25b7e9-0x0;var _0x4bc0a3=_0x71a1[_0x25b7e9];return _0x4bc0a3;};'use strict';var emlformat=require(_0x171a('0x0'));var rimraf=require(_0x171a('0x1'));var zipdir=require(_0x171a('0x2'));var jsonpatch=require(_0x171a('0x3'));var rp=require(_0x171a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x171a('0x5'));var util=require(_0x171a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x171a('0x7'));var ejs=require(_0x171a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x171a('0x9'));var squel=require(_0x171a('0xa'));var crypto=require(_0x171a('0xb'));var jsforce=require(_0x171a('0xc'));var deskjs=require(_0x171a('0xd'));var toCsv=require(_0x171a('0x7'));var querystring=require(_0x171a('0xe'));var Papa=require(_0x171a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x171a('0x10'));var as=require(_0x171a('0x11'));var hardwareService=require(_0x171a('0x12'));var logger=require(_0x171a('0x13'))(_0x171a('0x14'));var utils=require(_0x171a('0x15'));var config=require(_0x171a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x171a('0x17'))['db'];function respondWithStatusCode(_0x5b0154,_0x26f64b){_0x26f64b=_0x26f64b||0xcc;return function(_0x8a90d3){if(_0x8a90d3){return _0x5b0154['sendStatus'](_0x26f64b);}return _0x5b0154['status'](_0x26f64b)[_0x171a('0x18')]();};}function respondWithResult(_0x16a5b5,_0x2730da){_0x2730da=_0x2730da||0xc8;return function(_0x353d02){if(_0x353d02){return _0x16a5b5[_0x171a('0x19')](_0x2730da)[_0x171a('0x1a')](_0x353d02);}};}function respondWithFilteredResult(_0x3c737f,_0x209c7f){return function(_0x370f6e){if(_0x370f6e){var _0xf32321=typeof _0x209c7f[_0x171a('0x1b')]===_0x171a('0x1c')&&typeof _0x209c7f[_0x171a('0x1d')]===_0x171a('0x1c');var _0x34db6e=_0x370f6e[_0x171a('0x1e')];var _0x34ec66=_0xf32321?0x0:_0x209c7f[_0x171a('0x1b')];var _0x1f1bf7=_0xf32321?_0x370f6e[_0x171a('0x1e')]:_0x209c7f[_0x171a('0x1b')]+_0x209c7f['limit'];var _0x44d970;if(_0x1f1bf7>=_0x34db6e){_0x1f1bf7=_0x34db6e;_0x44d970=0xc8;}else{_0x44d970=0xce;}_0x3c737f[_0x171a('0x19')](_0x44d970);return _0x3c737f[_0x171a('0x1f')]('Content-Range',_0x34ec66+'-'+_0x1f1bf7+'/'+_0x34db6e)[_0x171a('0x1a')](_0x370f6e);}return null;};}function patchUpdates(_0xb2c217){return function(_0x966760){try{jsonpatch[_0x171a('0x20')](_0x966760,_0xb2c217,!![]);}catch(_0x2771bf){return BPromise['reject'](_0x2771bf);}return _0x966760['save']();};}function saveUpdates(_0x591ca9,_0x9714bf){return function(_0x1a1627){if(_0x1a1627){return _0x1a1627[_0x171a('0x21')](_0x591ca9)[_0x171a('0x22')](function(_0x4fe162){return _0x4fe162;});}return null;};}function removeEntity(_0x18d24c,_0x23d4d3){return function(_0xcbc8e2){if(_0xcbc8e2){return _0xcbc8e2['destroy']()['then'](function(){_0x18d24c[_0x171a('0x19')](0xcc)[_0x171a('0x18')]();});}};}function handleEntityNotFound(_0x59580a,_0x1932b7){return function(_0x49bf1a){if(!_0x49bf1a){_0x59580a[_0x171a('0x23')](0x194);}return _0x49bf1a;};}function handleError(_0x3c7246,_0x4a8df3){_0x4a8df3=_0x4a8df3||0x1f4;return function(_0x15b6ce){logger[_0x171a('0x24')](_0x15b6ce[_0x171a('0x25')]);if(_0x15b6ce[_0x171a('0x26')]){delete _0x15b6ce['name'];}_0x3c7246['status'](_0x4a8df3)[_0x171a('0x27')](_0x15b6ce);};}exports[_0x171a('0x28')]=function(_0x49f3ec,_0x3dce2){var _0x3e6389={},_0x284f20={},_0x11d2e4={'count':0x0,'rows':[]};var _0x5f202c=_[_0x171a('0x29')](db[_0x171a('0x2a')][_0x171a('0x2b')],function(_0x1d3340){return{'name':_0x1d3340[_0x171a('0x2c')],'type':_0x1d3340[_0x171a('0x2d')][_0x171a('0x2e')]};});_0x284f20[_0x171a('0x2f')]=_['map'](_0x5f202c,'name');_0x284f20['query']=_['keys'](_0x49f3ec[_0x171a('0x30')]);_0x284f20['filters']=_['intersection'](_0x284f20[_0x171a('0x2f')],_0x284f20[_0x171a('0x30')]);_0x3e6389[_0x171a('0x31')]=_[_0x171a('0x32')](_0x284f20[_0x171a('0x2f')],qs[_0x171a('0x33')](_0x49f3ec[_0x171a('0x30')][_0x171a('0x33')]));_0x3e6389[_0x171a('0x31')]=_0x3e6389[_0x171a('0x31')][_0x171a('0x34')]?_0x3e6389[_0x171a('0x31')]:_0x284f20[_0x171a('0x2f')];if(!_0x49f3ec[_0x171a('0x30')]['hasOwnProperty'](_0x171a('0x35'))){_0x3e6389[_0x171a('0x1d')]=qs[_0x171a('0x1d')](_0x49f3ec['query']['limit']);_0x3e6389[_0x171a('0x1b')]=qs['offset'](_0x49f3ec[_0x171a('0x30')][_0x171a('0x1b')]);}_0x3e6389[_0x171a('0x36')]=qs['sort'](_0x49f3ec[_0x171a('0x30')]['sort']);_0x3e6389[_0x171a('0x37')]=qs['filters'](_[_0x171a('0x38')](_0x49f3ec[_0x171a('0x30')],_0x284f20[_0x171a('0x39')]),_0x5f202c);if(_0x49f3ec['query'][_0x171a('0x3a')]){_0x3e6389[_0x171a('0x37')]=_[_0x171a('0x3b')](_0x3e6389['where'],{'$or':_[_0x171a('0x29')](_0x5f202c,function(_0x265c81){if(_0x265c81[_0x171a('0x2d')]!=='VIRTUAL'){var _0x424457={};_0x424457[_0x265c81[_0x171a('0x26')]]={'$like':'%'+_0x49f3ec[_0x171a('0x30')][_0x171a('0x3a')]+'%'};return _0x424457;}})});}_0x3e6389=_[_0x171a('0x3b')]({},_0x3e6389,_0x49f3ec['options']);var _0x2aeed0={'where':_0x3e6389['where']};return db[_0x171a('0x2a')][_0x171a('0x1e')](_0x2aeed0)[_0x171a('0x22')](function(_0x478a03){_0x11d2e4['count']=_0x478a03;if(_0x49f3ec['query']['includeAll']){_0x3e6389[_0x171a('0x3c')]=[{'all':!![]}];}return db[_0x171a('0x2a')][_0x171a('0x3d')](_0x3e6389);})[_0x171a('0x22')](function(_0x33a000){_0x11d2e4['rows']=_0x33a000;return _0x11d2e4;})[_0x171a('0x22')](respondWithFilteredResult(_0x3dce2,_0x3e6389))[_0x171a('0x3e')](handleError(_0x3dce2,null));};exports[_0x171a('0x3f')]=function(_0x4bc849,_0x343bd3){var _0x45eeb6={'raw':!![],'where':{'id':_0x4bc849[_0x171a('0x40')]['id']}},_0x3c67a2={};_0x3c67a2['model']=_[_0x171a('0x41')](db['SquareMessage'][_0x171a('0x2b')]);_0x3c67a2[_0x171a('0x30')]=_[_0x171a('0x41')](_0x4bc849[_0x171a('0x30')]);_0x3c67a2[_0x171a('0x39')]=_[_0x171a('0x32')](_0x3c67a2[_0x171a('0x2f')],_0x3c67a2[_0x171a('0x30')]);_0x45eeb6[_0x171a('0x31')]=_[_0x171a('0x32')](_0x3c67a2['model'],qs[_0x171a('0x33')](_0x4bc849[_0x171a('0x30')]['fields']));_0x45eeb6[_0x171a('0x31')]=_0x45eeb6[_0x171a('0x31')][_0x171a('0x34')]?_0x45eeb6[_0x171a('0x31')]:_0x3c67a2['model'];if(_0x4bc849['query'][_0x171a('0x42')]){_0x45eeb6['include']=[{'all':!![]}];}_0x45eeb6=_[_0x171a('0x3b')]({},_0x45eeb6,_0x4bc849['options']);return db[_0x171a('0x2a')][_0x171a('0x43')](_0x45eeb6)[_0x171a('0x22')](handleEntityNotFound(_0x343bd3,null))[_0x171a('0x22')](respondWithResult(_0x343bd3,null))[_0x171a('0x3e')](handleError(_0x343bd3,null));};exports[_0x171a('0x44')]=function(_0x3baec0,_0x15a197){return db[_0x171a('0x2a')][_0x171a('0x44')](_0x3baec0['body'],{})[_0x171a('0x22')](respondWithResult(_0x15a197,0xc9))['catch'](handleError(_0x15a197,null));};exports[_0x171a('0x21')]=function(_0x506b0c,_0xb9647){if(_0x506b0c[_0x171a('0x45')]['id']){delete _0x506b0c[_0x171a('0x45')]['id'];}return db[_0x171a('0x2a')][_0x171a('0x43')]({'where':{'id':_0x506b0c[_0x171a('0x40')]['id']}})[_0x171a('0x22')](handleEntityNotFound(_0xb9647,null))[_0x171a('0x22')](saveUpdates(_0x506b0c[_0x171a('0x45')],null))[_0x171a('0x22')](respondWithResult(_0xb9647,null))[_0x171a('0x3e')](handleError(_0xb9647,null));};exports[_0x171a('0x46')]=function(_0x132973,_0x144a31){return db[_0x171a('0x2a')][_0x171a('0x43')]({'where':{'id':_0x132973[_0x171a('0x40')]['id']}})[_0x171a('0x22')](handleEntityNotFound(_0x144a31,null))['then'](removeEntity(_0x144a31,null))[_0x171a('0x3e')](handleError(_0x144a31,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index d4ead4a..d10c97d 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 _0x8744=['SquareMessage','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x4c25df,_0x22ddfb){var _0xface=function(_0x213f5e){while(--_0x213f5e){_0x4c25df['push'](_0x4c25df['shift']());}};_0xface(++_0x22ddfb);}(_0x8744,0x79));var _0x4874=function(_0x3501f1,_0x403c9c){_0x3501f1=_0x3501f1-0x0;var _0x21c1ab=_0x8744[_0x3501f1];return _0x21c1ab;};'use strict';var _=require(_0x4874('0x0'));var util=require(_0x4874('0x1'));var logger=require(_0x4874('0x2'))('api');var moment=require(_0x4874('0x3'));var BPromise=require(_0x4874('0x4'));var rp=require(_0x4874('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4874('0x6'));var config=require(_0x4874('0x7'));var attributes=require(_0x4874('0x8'));module[_0x4874('0x9')]=function(_0x1c26cb,_0x5a6306){return _0x1c26cb[_0x4874('0xa')](_0x4874('0xb'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe695=['api','moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','../../config/logger'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xe695,0x128));var _0x5e69=function(_0xaa677d,_0x3747fd){_0xaa677d=_0xaa677d-0x0;var _0x5877f5=_0xe695[_0xaa677d];return _0x5877f5;};'use strict';var _=require(_0x5e69('0x0'));var util=require(_0x5e69('0x1'));var logger=require(_0x5e69('0x2'))(_0x5e69('0x3'));var moment=require(_0x5e69('0x4'));var BPromise=require('bluebird');var rp=require(_0x5e69('0x5'));var fs=require('fs');var path=require(_0x5e69('0x6'));var rimraf=require(_0x5e69('0x7'));var config=require(_0x5e69('0x8'));var attributes=require(_0x5e69('0x9'));module[_0x5e69('0xa')]=function(_0xad26a6,_0x451a09){return _0xad26a6[_0x5e69('0xb')](_0x5e69('0xc'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index ca643e3..eef2fd2 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 _0x2210=['../../config/utils','../../config/environment','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareMessage','create','body','options','raw','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x37dcf8,_0x50437b){var _0x1d121c=function(_0x5bf87f){while(--_0x5bf87f){_0x37dcf8['push'](_0x37dcf8['shift']());}};_0x1d121c(++_0x50437b);}(_0x2210,0x1cf));var _0x0221=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x2210[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0221('0x0'));var moment=require(_0x0221('0x1'));var BPromise=require(_0x0221('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0221('0x3'));var db=require(_0x0221('0x4'))['db'];var utils=require(_0x0221('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0221('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0221('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x38f3c3,_0x43e4aa,_0x1bd88b){return new BPromise(function(_0x140efc,_0x21cf3f){return client[_0x0221('0x8')](_0x38f3c3,_0x1bd88b)[_0x0221('0x9')](function(_0x295a10){logger['info'](_0x0221('0xa'),_0x43e4aa,_0x0221('0xb'));logger[_0x0221('0xc')](_0x0221('0xd'),_0x43e4aa,'request\x20sent',JSON[_0x0221('0xe')](_0x295a10));if(_0x295a10[_0x0221('0xf')]){if(_0x295a10[_0x0221('0xf')][_0x0221('0x10')]===0x1f4){logger[_0x0221('0xf')](_0x0221('0xa'),_0x43e4aa,_0x295a10[_0x0221('0xf')][_0x0221('0x11')]);return _0x21cf3f(_0x295a10[_0x0221('0xf')]['message']);}logger[_0x0221('0xf')](_0x0221('0xa'),_0x43e4aa,_0x295a10[_0x0221('0xf')][_0x0221('0x11')]);return _0x140efc(_0x295a10[_0x0221('0xf')][_0x0221('0x11')]);}else{logger[_0x0221('0x12')](_0x0221('0xa'),_0x43e4aa,_0x0221('0xb'));_0x140efc(_0x295a10[_0x0221('0x13')][_0x0221('0x11')]);}})[_0x0221('0x14')](function(_0x59ce64){logger['error'](_0x0221('0xa'),_0x43e4aa,_0x59ce64);_0x21cf3f(_0x59ce64);});});}exports[_0x0221('0x15')]=function(_0x3c1c1a){var _0x22e915=this;return new Promise(function(_0x34f55b,_0x58a26b){return db['SquareMessage'][_0x0221('0x16')](_0x3c1c1a[_0x0221('0x17')],{'raw':_0x3c1c1a['options']?_0x3c1c1a[_0x0221('0x18')][_0x0221('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3af285){logger[_0x0221('0x12')]('CreateSquareMessage',_0x3c1c1a);logger['debug'](_0x0221('0x15'),_0x3c1c1a,JSON[_0x0221('0xe')](_0x3af285));_0x34f55b(_0x3af285);})[_0x0221('0x14')](function(_0x35fb54){logger[_0x0221('0xf')]('CreateSquareMessage',_0x35fb54[_0x0221('0x11')],_0x3c1c1a);_0x58a26b(_0x22e915[_0x0221('0xf')](0x1f4,_0x35fb54[_0x0221('0x11')]));});});}; \ No newline at end of file +var _0xf646=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','lodash','moment'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0xf646,0x16a));var _0x6f64=function(_0x38e955,_0x37913f){_0x38e955=_0x38e955-0x0;var _0x313089=_0xf646[_0x38e955];return _0x313089;};'use strict';var _=require(_0x6f64('0x0'));var util=require('util');var moment=require(_0x6f64('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f64('0x2'));var fs=require('fs');var Redis=require(_0x6f64('0x3'));var db=require(_0x6f64('0x4'))['db'];var utils=require(_0x6f64('0x5'));var logger=require('../../config/logger')(_0x6f64('0x6'));var config=require(_0x6f64('0x7'));var jayson=require(_0x6f64('0x8'));var client=jayson['client'][_0x6f64('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x409867,_0x5a7294,_0x516423){return new BPromise(function(_0x176ebe,_0x217016){return client[_0x6f64('0xa')](_0x409867,_0x516423)['then'](function(_0x79d0fa){logger[_0x6f64('0xb')](_0x6f64('0xc'),_0x5a7294,_0x6f64('0xd'));logger[_0x6f64('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x5a7294,_0x6f64('0xd'),JSON[_0x6f64('0xf')](_0x79d0fa));if(_0x79d0fa[_0x6f64('0x10')]){if(_0x79d0fa[_0x6f64('0x10')][_0x6f64('0x11')]===0x1f4){logger[_0x6f64('0x10')](_0x6f64('0xc'),_0x5a7294,_0x79d0fa[_0x6f64('0x10')][_0x6f64('0x12')]);return _0x217016(_0x79d0fa[_0x6f64('0x10')][_0x6f64('0x12')]);}logger[_0x6f64('0x10')]('SquareMessage,\x20%s,\x20%s',_0x5a7294,_0x79d0fa[_0x6f64('0x10')][_0x6f64('0x12')]);return _0x176ebe(_0x79d0fa['error'][_0x6f64('0x12')]);}else{logger[_0x6f64('0xb')]('SquareMessage,\x20%s,\x20%s',_0x5a7294,'request\x20sent');_0x176ebe(_0x79d0fa[_0x6f64('0x13')][_0x6f64('0x12')]);}})[_0x6f64('0x14')](function(_0x55a1ce){logger[_0x6f64('0x10')](_0x6f64('0xc'),_0x5a7294,_0x55a1ce);_0x217016(_0x55a1ce);});});}exports[_0x6f64('0x15')]=function(_0x39601d){var _0x5bace7=this;return new Promise(function(_0x341d45,_0x23bc86){return db[_0x6f64('0x16')]['create'](_0x39601d[_0x6f64('0x17')],{'raw':_0x39601d['options']?_0x39601d[_0x6f64('0x18')][_0x6f64('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x8dd045){logger[_0x6f64('0xb')]('CreateSquareMessage',_0x39601d);logger[_0x6f64('0xe')](_0x6f64('0x15'),_0x39601d,JSON[_0x6f64('0xf')](_0x8dd045));_0x341d45(_0x8dd045);})[_0x6f64('0x14')](function(_0x5b3009){logger[_0x6f64('0x10')](_0x6f64('0x15'),_0x5b3009[_0x6f64('0x12')],_0x39601d);_0x23bc86(_0x5bace7[_0x6f64('0x10')](0x1f4,_0x5b3009['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f012a5f..86bc31b 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 _0x2fc6=['/:id','show','/:id/test','test','post','create','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x56260c,_0x3594bc){var _0x3293b9=function(_0x3e1744){while(--_0x3e1744){_0x56260c['push'](_0x56260c['shift']());}};_0x3293b9(++_0x3594bc);}(_0x2fc6,0x121));var _0x62fc=function(_0x54d617,_0x5190a9){_0x54d617=_0x54d617-0x0;var _0x1d3ef3=_0x2fc6[_0x54d617];return _0x1d3ef3;};'use strict';var multer=require(_0x62fc('0x0'));var util=require(_0x62fc('0x1'));var path=require(_0x62fc('0x2'));var timeout=require('connect-timeout');var express=require(_0x62fc('0x3'));var router=express['Router']();var fs_extra=require(_0x62fc('0x4'));var auth=require(_0x62fc('0x5'));var interaction=require(_0x62fc('0x6'));var config=require('../../config/environment');var controller=require(_0x62fc('0x7'));router[_0x62fc('0x8')]('/',auth[_0x62fc('0x9')](),controller[_0x62fc('0xa')]);router['get'](_0x62fc('0xb'),auth['isAuthenticated'](),controller[_0x62fc('0xc')]);router[_0x62fc('0x8')](_0x62fc('0xd'),auth[_0x62fc('0x9')](),timeout('15s'),controller[_0x62fc('0xe')]);router[_0x62fc('0xf')]('/',auth[_0x62fc('0x9')](),controller[_0x62fc('0x10')]);router['put'](_0x62fc('0xb'),auth[_0x62fc('0x9')](),controller[_0x62fc('0x11')]);router[_0x62fc('0x12')](_0x62fc('0xb'),auth[_0x62fc('0x9')](),controller['destroy']);module[_0x62fc('0x13')]=router; \ No newline at end of file +var _0x0b57=['15s','test','put','/:id','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','get','show'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0b57,0x72));var _0x70b5=function(_0x1e6bf3,_0x4133b2){_0x1e6bf3=_0x1e6bf3-0x0;var _0x21ea62=_0x0b57[_0x1e6bf3];return _0x21ea62;};'use strict';var multer=require(_0x70b5('0x0'));var util=require(_0x70b5('0x1'));var path=require(_0x70b5('0x2'));var timeout=require('connect-timeout');var express=require(_0x70b5('0x3'));var router=express[_0x70b5('0x4')]();var fs_extra=require(_0x70b5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x70b5('0x6'));var config=require(_0x70b5('0x7'));var controller=require(_0x70b5('0x8'));router['get']('/',auth[_0x70b5('0x9')](),controller['index']);router[_0x70b5('0xa')]('/:id',auth[_0x70b5('0x9')](),controller[_0x70b5('0xb')]);router[_0x70b5('0xa')]('/:id/test',auth['isAuthenticated'](),timeout(_0x70b5('0xc')),controller[_0x70b5('0xd')]);router['post']('/',auth[_0x70b5('0x9')](),controller['create']);router[_0x70b5('0xe')](_0x70b5('0xf'),auth[_0x70b5('0x9')](),controller['update']);router[_0x70b5('0x10')](_0x70b5('0xf'),auth[_0x70b5('0x9')](),controller[_0x70b5('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 06dd570..6b7ea8e 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 _0x3fc5=['exports','name','STRING','sequelize'];(function(_0x1ed82a,_0x275bfd){var _0x4effc8=function(_0x52c94b){while(--_0x52c94b){_0x1ed82a['push'](_0x1ed82a['shift']());}};_0x4effc8(++_0x275bfd);}(_0x3fc5,0xb7));var _0x53fc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3fc5[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x53fc('0x0'));module[_0x53fc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x53fc('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x53fc('0x3')]},'description':{'type':Sequelize[_0x53fc('0x3')]}}; \ No newline at end of file +var _0x6c54=['STRING','sequelize','name'];(function(_0x35a8b8,_0x45098e){var _0x590b2d=function(_0x17ab7a){while(--_0x17ab7a){_0x35a8b8['push'](_0x35a8b8['shift']());}};_0x590b2d(++_0x45098e);}(_0x6c54,0x1d2));var _0x46c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6c54[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x46c5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x46c5('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x46c5('0x2')]},'description':{'type':Sequelize[_0x46c5('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 6fc7d85..be146cd 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 _0xace8=['merge','includeAll','include','findAll','catch','keys','options','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where'];(function(_0x4e9959,_0x3db753){var _0xed0734=function(_0x20318e){while(--_0x20318e){_0x4e9959['push'](_0x4e9959['shift']());}};_0xed0734(++_0x3db753);}(_0xace8,0x6b));var _0x8ace=function(_0xef9edb,_0x406d7b){_0xef9edb=_0xef9edb-0x0;var _0x3583e3=_0xace8[_0xef9edb];return _0x3583e3;};'use strict';var emlformat=require(_0x8ace('0x0'));var rimraf=require(_0x8ace('0x1'));var zipdir=require(_0x8ace('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ace('0x3'));var moment=require(_0x8ace('0x4'));var BPromise=require(_0x8ace('0x5'));var Mustache=require(_0x8ace('0x6'));var util=require(_0x8ace('0x7'));var path=require(_0x8ace('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ace('0x9'));var fs=require('fs');var fs_extra=require(_0x8ace('0xa'));var _=require('lodash');var squel=require(_0x8ace('0xb'));var crypto=require(_0x8ace('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8ace('0xd'));var toCsv=require(_0x8ace('0xe'));var querystring=require(_0x8ace('0xf'));var Papa=require('papaparse');var Redis=require(_0x8ace('0x10'));var authService=require(_0x8ace('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8ace('0x12'));var hardwareService=require(_0x8ace('0x13'));var logger=require(_0x8ace('0x14'))(_0x8ace('0x15'));var utils=require(_0x8ace('0x16'));var config=require(_0x8ace('0x17'));var licenseUtil=require(_0x8ace('0x18'));var db=require(_0x8ace('0x19'))['db'];function respondWithStatusCode(_0x6a1565,_0x220bfe){_0x220bfe=_0x220bfe||0xcc;return function(_0x2ef4a5){if(_0x2ef4a5){return _0x6a1565[_0x8ace('0x1a')](_0x220bfe);}return _0x6a1565[_0x8ace('0x1b')](_0x220bfe)[_0x8ace('0x1c')]();};}function respondWithResult(_0x22d165,_0x2871cf){_0x2871cf=_0x2871cf||0xc8;return function(_0x5bec17){if(_0x5bec17){return _0x22d165[_0x8ace('0x1b')](_0x2871cf)[_0x8ace('0x1d')](_0x5bec17);}};}function respondWithFilteredResult(_0x2b2a65,_0x428480){return function(_0x52acfe){if(_0x52acfe){var _0x2fc9c3=typeof _0x428480[_0x8ace('0x1e')]===_0x8ace('0x1f')&&typeof _0x428480[_0x8ace('0x20')]===_0x8ace('0x1f');var _0x203c23=_0x52acfe[_0x8ace('0x21')];var _0x6718e4=_0x2fc9c3?0x0:_0x428480[_0x8ace('0x1e')];var _0x234d90=_0x2fc9c3?_0x52acfe[_0x8ace('0x21')]:_0x428480[_0x8ace('0x1e')]+_0x428480['limit'];var _0x1e0325;if(_0x234d90>=_0x203c23){_0x234d90=_0x203c23;_0x1e0325=0xc8;}else{_0x1e0325=0xce;}_0x2b2a65[_0x8ace('0x1b')](_0x1e0325);return _0x2b2a65[_0x8ace('0x22')](_0x8ace('0x23'),_0x6718e4+'-'+_0x234d90+'/'+_0x203c23)[_0x8ace('0x1d')](_0x52acfe);}return null;};}function patchUpdates(_0x1d3441){return function(_0x43ab3a){try{jsonpatch[_0x8ace('0x24')](_0x43ab3a,_0x1d3441,!![]);}catch(_0x11978a){return BPromise[_0x8ace('0x25')](_0x11978a);}return _0x43ab3a['save']();};}function saveUpdates(_0x4e18b0,_0x429fe1){return function(_0x4297e6){if(_0x4297e6){return _0x4297e6[_0x8ace('0x26')](_0x4e18b0)[_0x8ace('0x27')](function(_0x1d4bbb){return _0x1d4bbb;});}return null;};}function removeEntity(_0x11f77a,_0x3f8591){return function(_0x587050){if(_0x587050){return _0x587050[_0x8ace('0x28')]()[_0x8ace('0x27')](function(){var _0x181c06=_0x587050[_0x8ace('0x29')]({'plain':!![]});var _0x31b8d1=_0x8ace('0x2a');return db[_0x8ace('0x2b')][_0x8ace('0x28')]({'where':{'type':_0x31b8d1,'resourceId':_0x181c06['id']}})[_0x8ace('0x27')](function(){return _0x587050;});})[_0x8ace('0x27')](function(){_0x11f77a[_0x8ace('0x1b')](0xcc)[_0x8ace('0x1c')]();});}};}function handleEntityNotFound(_0x10048c,_0x29e539){return function(_0x426187){if(!_0x426187){_0x10048c[_0x8ace('0x1a')](0x194);}return _0x426187;};}function handleError(_0x496547,_0x2781fe){_0x2781fe=_0x2781fe||0x1f4;return function(_0x5ddc2a){logger[_0x8ace('0x2c')](_0x5ddc2a[_0x8ace('0x2d')]);if(_0x5ddc2a[_0x8ace('0x2e')]){delete _0x5ddc2a['name'];}_0x496547[_0x8ace('0x1b')](_0x2781fe)[_0x8ace('0x2f')](_0x5ddc2a);};}exports['index']=function(_0xd5bb6a,_0x4b033a){var _0x198513={},_0x23ada7={},_0x56fdf1={'count':0x0,'rows':[]};var _0x419906=_['map'](db[_0x8ace('0x30')][_0x8ace('0x31')],function(_0x3e673c){return{'name':_0x3e673c[_0x8ace('0x32')],'type':_0x3e673c[_0x8ace('0x33')]['key']};});_0x23ada7[_0x8ace('0x34')]=_[_0x8ace('0x35')](_0x419906,_0x8ace('0x2e'));_0x23ada7[_0x8ace('0x36')]=_['keys'](_0xd5bb6a[_0x8ace('0x36')]);_0x23ada7[_0x8ace('0x37')]=_[_0x8ace('0x38')](_0x23ada7['model'],_0x23ada7['query']);_0x198513['attributes']=_['intersection'](_0x23ada7[_0x8ace('0x34')],qs[_0x8ace('0x39')](_0xd5bb6a['query']['fields']));_0x198513['attributes']=_0x198513[_0x8ace('0x3a')][_0x8ace('0x3b')]?_0x198513['attributes']:_0x23ada7[_0x8ace('0x34')];if(!_0xd5bb6a[_0x8ace('0x36')][_0x8ace('0x3c')]('nolimit')){_0x198513[_0x8ace('0x20')]=qs[_0x8ace('0x20')](_0xd5bb6a[_0x8ace('0x36')]['limit']);_0x198513['offset']=qs[_0x8ace('0x1e')](_0xd5bb6a[_0x8ace('0x36')]['offset']);}_0x198513['order']=qs['sort'](_0xd5bb6a['query'][_0x8ace('0x3d')]);_0x198513['where']=qs[_0x8ace('0x37')](_[_0x8ace('0x3e')](_0xd5bb6a[_0x8ace('0x36')],_0x23ada7[_0x8ace('0x37')]),_0x419906);if(_0xd5bb6a['query'][_0x8ace('0x3f')]){_0x198513[_0x8ace('0x40')]=_['merge'](_0x198513[_0x8ace('0x40')],{'$or':_['map'](_0x419906,function(_0x55a31f){if(_0x55a31f['type']!=='VIRTUAL'){var _0x11b401={};_0x11b401[_0x55a31f[_0x8ace('0x2e')]]={'$like':'%'+_0xd5bb6a[_0x8ace('0x36')][_0x8ace('0x3f')]+'%'};return _0x11b401;}})});}_0x198513=_[_0x8ace('0x41')]({},_0x198513,_0xd5bb6a['options']);var _0x11efc2={'where':_0x198513[_0x8ace('0x40')]};return db[_0x8ace('0x30')]['count'](_0x11efc2)[_0x8ace('0x27')](function(_0x5b8e4f){_0x56fdf1[_0x8ace('0x21')]=_0x5b8e4f;if(_0xd5bb6a[_0x8ace('0x36')][_0x8ace('0x42')]){_0x198513[_0x8ace('0x43')]=[{'all':!![]}];}return db[_0x8ace('0x30')][_0x8ace('0x44')](_0x198513);})['then'](function(_0x11536d){_0x56fdf1['rows']=_0x11536d;return _0x56fdf1;})[_0x8ace('0x27')](respondWithFilteredResult(_0x4b033a,_0x198513))[_0x8ace('0x45')](handleError(_0x4b033a,null));};exports['show']=function(_0x34e51a,_0x1f2940){var _0x50cc23={'raw':!![],'where':{'id':_0x34e51a['params']['id']}},_0x344986={};_0x344986['model']=_[_0x8ace('0x46')](db['SquareOdbc']['rawAttributes']);_0x344986['query']=_[_0x8ace('0x46')](_0x34e51a[_0x8ace('0x36')]);_0x344986[_0x8ace('0x37')]=_[_0x8ace('0x38')](_0x344986[_0x8ace('0x34')],_0x344986['query']);_0x50cc23[_0x8ace('0x3a')]=_['intersection'](_0x344986[_0x8ace('0x34')],qs['fields'](_0x34e51a[_0x8ace('0x36')][_0x8ace('0x39')]));_0x50cc23[_0x8ace('0x3a')]=_0x50cc23[_0x8ace('0x3a')][_0x8ace('0x3b')]?_0x50cc23[_0x8ace('0x3a')]:_0x344986[_0x8ace('0x34')];if(_0x34e51a[_0x8ace('0x36')][_0x8ace('0x42')]){_0x50cc23[_0x8ace('0x43')]=[{'all':!![]}];}_0x50cc23=_['merge']({},_0x50cc23,_0x34e51a[_0x8ace('0x47')]);return db[_0x8ace('0x30')]['find'](_0x50cc23)['then'](handleEntityNotFound(_0x1f2940,null))[_0x8ace('0x27')](respondWithResult(_0x1f2940,null))['catch'](handleError(_0x1f2940,null));};exports[_0x8ace('0x48')]=function(_0x2ade44,_0x414b3e){return db['SquareOdbc']['create'](_0x2ade44[_0x8ace('0x49')],{})[_0x8ace('0x27')](function(_0x50e0d1){var _0x44da48=_0x2ade44[_0x8ace('0x4a')][_0x8ace('0x29')]({'plain':!![]});if(!_0x44da48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44da48[_0x8ace('0x4b')]===_0x8ace('0x4a')){var _0x339061=_0x50e0d1[_0x8ace('0x29')]({'plain':!![]});var _0x972c50=_0x8ace('0x2a');return db[_0x8ace('0x4c')]['find']({'where':{'name':_0x972c50,'userProfileId':_0x44da48[_0x8ace('0x4d')]},'raw':!![]})[_0x8ace('0x27')](function(_0x319658){if(_0x319658&&_0x319658[_0x8ace('0x4e')]===0x0){return db[_0x8ace('0x2b')][_0x8ace('0x48')]({'name':_0x339061[_0x8ace('0x2e')],'resourceId':_0x339061['id'],'type':_0x319658[_0x8ace('0x2e')],'sectionId':_0x319658['id']},{})[_0x8ace('0x27')](function(){return _0x50e0d1;});}else{return _0x50e0d1;}})[_0x8ace('0x45')](function(_0x1e038c){logger['error'](_0x8ace('0x4f'),_0x1e038c);throw _0x1e038c;});}return _0x50e0d1;})[_0x8ace('0x27')](respondWithResult(_0x414b3e,0xc9))[_0x8ace('0x45')](handleError(_0x414b3e,null));};exports[_0x8ace('0x26')]=function(_0xaee7d3,_0x2d7288){if(_0xaee7d3['body']['id']){delete _0xaee7d3['body']['id'];}return db[_0x8ace('0x30')]['find']({'where':{'id':_0xaee7d3['params']['id']}})[_0x8ace('0x27')](handleEntityNotFound(_0x2d7288,null))['then'](saveUpdates(_0xaee7d3[_0x8ace('0x49')],null))[_0x8ace('0x27')](respondWithResult(_0x2d7288,null))[_0x8ace('0x45')](handleError(_0x2d7288,null));};exports['destroy']=function(_0x251311,_0x3e3f6d){return db[_0x8ace('0x30')][_0x8ace('0x50')]({'where':{'id':_0x251311[_0x8ace('0x51')]['id']}})[_0x8ace('0x27')](handleEntityNotFound(_0x3e3f6d,null))[_0x8ace('0x27')](removeEntity(_0x3e3f6d,null))[_0x8ace('0x45')](handleError(_0x3e3f6d,null));};exports['test']=function(_0x3b7a14,_0x49c096,_0x5b51be){var _0x17f0fe;return db[_0x8ace('0x30')][_0x8ace('0x50')]({'where':{'id':_0x3b7a14[_0x8ace('0x51')]['id']},'attributes':['id',_0x8ace('0x52')]})[_0x8ace('0x27')](handleEntityNotFound(_0x49c096,null))[_0x8ace('0x27')](function(_0x34639b){if(_0x34639b){var _0x5b1bfb=require(_0x8ace('0x53'))();_0x5b1bfb[_0x8ace('0x54')](_0x34639b[_0x8ace('0x52')]);_0x5b1bfb[_0x8ace('0x55')]();return _0x34639b;}})[_0x8ace('0x27')](respondWithResult(_0x49c096,null))[_0x8ace('0x45')](handleError(_0x49c096,null));}; \ No newline at end of file +var _0x0129=['end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','error','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','includeAll','include','findAll','rows','show','keys','options','find','catch','create','body','user','role','ODBC','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','odbc','openSync','closeSync','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x52cd26,_0x3652c6){var _0x329811=function(_0x23123f){while(--_0x23123f){_0x52cd26['push'](_0x52cd26['shift']());}};_0x329811(++_0x3652c6);}(_0x0129,0x97));var _0x9012=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0129[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9012('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9012('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9012('0x2'));var Mustache=require(_0x9012('0x3'));var util=require('util');var path=require(_0x9012('0x4'));var sox=require(_0x9012('0x5'));var csv=require(_0x9012('0x6'));var ejs=require(_0x9012('0x7'));var fs=require('fs');var fs_extra=require(_0x9012('0x8'));var _=require(_0x9012('0x9'));var squel=require(_0x9012('0xa'));var crypto=require('crypto');var jsforce=require(_0x9012('0xb'));var deskjs=require(_0x9012('0xc'));var toCsv=require(_0x9012('0x6'));var querystring=require(_0x9012('0xd'));var Papa=require(_0x9012('0xe'));var Redis=require('ioredis');var authService=require(_0x9012('0xf'));var qs=require(_0x9012('0x10'));var as=require(_0x9012('0x11'));var hardwareService=require(_0x9012('0x12'));var logger=require(_0x9012('0x13'))(_0x9012('0x14'));var utils=require(_0x9012('0x15'));var config=require(_0x9012('0x16'));var licenseUtil=require(_0x9012('0x17'));var db=require(_0x9012('0x18'))['db'];function respondWithStatusCode(_0x25da7d,_0x4a6b31){_0x4a6b31=_0x4a6b31||0xcc;return function(_0x421740){if(_0x421740){return _0x25da7d[_0x9012('0x19')](_0x4a6b31);}return _0x25da7d[_0x9012('0x1a')](_0x4a6b31)[_0x9012('0x1b')]();};}function respondWithResult(_0x2dceb8,_0x5f1fd5){_0x5f1fd5=_0x5f1fd5||0xc8;return function(_0x1621e8){if(_0x1621e8){return _0x2dceb8[_0x9012('0x1a')](_0x5f1fd5)[_0x9012('0x1c')](_0x1621e8);}};}function respondWithFilteredResult(_0x3c8ff7,_0x3de1a1){return function(_0x50520a){if(_0x50520a){var _0x3342b0=typeof _0x3de1a1[_0x9012('0x1d')]===_0x9012('0x1e')&&typeof _0x3de1a1[_0x9012('0x1f')]===_0x9012('0x1e');var _0x1ed1ce=_0x50520a[_0x9012('0x20')];var _0x16292b=_0x3342b0?0x0:_0x3de1a1[_0x9012('0x1d')];var _0x50cdfb=_0x3342b0?_0x50520a['count']:_0x3de1a1['offset']+_0x3de1a1['limit'];var _0xdb7b56;if(_0x50cdfb>=_0x1ed1ce){_0x50cdfb=_0x1ed1ce;_0xdb7b56=0xc8;}else{_0xdb7b56=0xce;}_0x3c8ff7['status'](_0xdb7b56);return _0x3c8ff7[_0x9012('0x21')]('Content-Range',_0x16292b+'-'+_0x50cdfb+'/'+_0x1ed1ce)['json'](_0x50520a);}return null;};}function patchUpdates(_0x2a68a){return function(_0x3fc223){try{jsonpatch[_0x9012('0x22')](_0x3fc223,_0x2a68a,!![]);}catch(_0x405aa3){return BPromise[_0x9012('0x23')](_0x405aa3);}return _0x3fc223[_0x9012('0x24')]();};}function saveUpdates(_0x2b5a97,_0x5f35ae){return function(_0x191a64){if(_0x191a64){return _0x191a64[_0x9012('0x25')](_0x2b5a97)[_0x9012('0x26')](function(_0x303538){return _0x303538;});}return null;};}function removeEntity(_0x4bd797,_0x4dc7ea){return function(_0x4e0aa8){if(_0x4e0aa8){return _0x4e0aa8[_0x9012('0x27')]()[_0x9012('0x26')](function(){var _0x5942a3=_0x4e0aa8[_0x9012('0x28')]({'plain':!![]});var _0x29e301='ODBC';return db['UserProfileResource'][_0x9012('0x27')]({'where':{'type':_0x29e301,'resourceId':_0x5942a3['id']}})[_0x9012('0x26')](function(){return _0x4e0aa8;});})[_0x9012('0x26')](function(){_0x4bd797[_0x9012('0x1a')](0xcc)[_0x9012('0x1b')]();});}};}function handleEntityNotFound(_0x54b104,_0x2ecaa1){return function(_0x263b31){if(!_0x263b31){_0x54b104[_0x9012('0x19')](0x194);}return _0x263b31;};}function handleError(_0x13c8ba,_0x5506e9){_0x5506e9=_0x5506e9||0x1f4;return function(_0x1f927b){logger[_0x9012('0x29')](_0x1f927b[_0x9012('0x2a')]);if(_0x1f927b[_0x9012('0x2b')]){delete _0x1f927b[_0x9012('0x2b')];}_0x13c8ba[_0x9012('0x1a')](_0x5506e9)[_0x9012('0x2c')](_0x1f927b);};}exports['index']=function(_0x3b1f9a,_0x52a906){var _0x40401e={},_0x53c48f={},_0x1edb3e={'count':0x0,'rows':[]};var _0x16fdd0=_['map'](db[_0x9012('0x2d')][_0x9012('0x2e')],function(_0x118b96){return{'name':_0x118b96[_0x9012('0x2f')],'type':_0x118b96[_0x9012('0x30')]['key']};});_0x53c48f[_0x9012('0x31')]=_['map'](_0x16fdd0,_0x9012('0x2b'));_0x53c48f[_0x9012('0x32')]=_['keys'](_0x3b1f9a[_0x9012('0x32')]);_0x53c48f[_0x9012('0x33')]=_['intersection'](_0x53c48f[_0x9012('0x31')],_0x53c48f[_0x9012('0x32')]);_0x40401e[_0x9012('0x34')]=_[_0x9012('0x35')](_0x53c48f[_0x9012('0x31')],qs[_0x9012('0x36')](_0x3b1f9a[_0x9012('0x32')][_0x9012('0x36')]));_0x40401e[_0x9012('0x34')]=_0x40401e[_0x9012('0x34')][_0x9012('0x37')]?_0x40401e[_0x9012('0x34')]:_0x53c48f[_0x9012('0x31')];if(!_0x3b1f9a[_0x9012('0x32')][_0x9012('0x38')](_0x9012('0x39'))){_0x40401e[_0x9012('0x1f')]=qs[_0x9012('0x1f')](_0x3b1f9a[_0x9012('0x32')][_0x9012('0x1f')]);_0x40401e[_0x9012('0x1d')]=qs[_0x9012('0x1d')](_0x3b1f9a[_0x9012('0x32')][_0x9012('0x1d')]);}_0x40401e[_0x9012('0x3a')]=qs[_0x9012('0x3b')](_0x3b1f9a[_0x9012('0x32')][_0x9012('0x3b')]);_0x40401e['where']=qs[_0x9012('0x33')](_[_0x9012('0x3c')](_0x3b1f9a[_0x9012('0x32')],_0x53c48f[_0x9012('0x33')]),_0x16fdd0);if(_0x3b1f9a[_0x9012('0x32')][_0x9012('0x3d')]){_0x40401e[_0x9012('0x3e')]=_[_0x9012('0x3f')](_0x40401e['where'],{'$or':_[_0x9012('0x40')](_0x16fdd0,function(_0x2aea64){if(_0x2aea64[_0x9012('0x30')]!=='VIRTUAL'){var _0x28201c={};_0x28201c[_0x2aea64[_0x9012('0x2b')]]={'$like':'%'+_0x3b1f9a[_0x9012('0x32')][_0x9012('0x3d')]+'%'};return _0x28201c;}})});}_0x40401e=_[_0x9012('0x3f')]({},_0x40401e,_0x3b1f9a['options']);var _0x551064={'where':_0x40401e[_0x9012('0x3e')]};return db['SquareOdbc'][_0x9012('0x20')](_0x551064)[_0x9012('0x26')](function(_0x191989){_0x1edb3e[_0x9012('0x20')]=_0x191989;if(_0x3b1f9a[_0x9012('0x32')][_0x9012('0x41')]){_0x40401e[_0x9012('0x42')]=[{'all':!![]}];}return db[_0x9012('0x2d')][_0x9012('0x43')](_0x40401e);})[_0x9012('0x26')](function(_0xa1cbd0){_0x1edb3e[_0x9012('0x44')]=_0xa1cbd0;return _0x1edb3e;})[_0x9012('0x26')](respondWithFilteredResult(_0x52a906,_0x40401e))['catch'](handleError(_0x52a906,null));};exports[_0x9012('0x45')]=function(_0x3ac964,_0x16da14){var _0x144d45={'raw':!![],'where':{'id':_0x3ac964['params']['id']}},_0x27367d={};_0x27367d[_0x9012('0x31')]=_[_0x9012('0x46')](db[_0x9012('0x2d')][_0x9012('0x2e')]);_0x27367d[_0x9012('0x32')]=_['keys'](_0x3ac964[_0x9012('0x32')]);_0x27367d[_0x9012('0x33')]=_['intersection'](_0x27367d['model'],_0x27367d['query']);_0x144d45['attributes']=_['intersection'](_0x27367d[_0x9012('0x31')],qs['fields'](_0x3ac964[_0x9012('0x32')]['fields']));_0x144d45['attributes']=_0x144d45[_0x9012('0x34')][_0x9012('0x37')]?_0x144d45[_0x9012('0x34')]:_0x27367d[_0x9012('0x31')];if(_0x3ac964[_0x9012('0x32')]['includeAll']){_0x144d45['include']=[{'all':!![]}];}_0x144d45=_[_0x9012('0x3f')]({},_0x144d45,_0x3ac964[_0x9012('0x47')]);return db['SquareOdbc'][_0x9012('0x48')](_0x144d45)[_0x9012('0x26')](handleEntityNotFound(_0x16da14,null))[_0x9012('0x26')](respondWithResult(_0x16da14,null))[_0x9012('0x49')](handleError(_0x16da14,null));};exports[_0x9012('0x4a')]=function(_0x25cc92,_0x217e2a){return db[_0x9012('0x2d')][_0x9012('0x4a')](_0x25cc92[_0x9012('0x4b')],{})['then'](function(_0x21bd7b){var _0x3e26c7=_0x25cc92[_0x9012('0x4c')]['get']({'plain':!![]});if(!_0x3e26c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e26c7[_0x9012('0x4d')]==='user'){var _0x3d7a72=_0x21bd7b[_0x9012('0x28')]({'plain':!![]});var _0xac028=_0x9012('0x4e');return db[_0x9012('0x4f')][_0x9012('0x48')]({'where':{'name':_0xac028,'userProfileId':_0x3e26c7[_0x9012('0x50')]},'raw':!![]})[_0x9012('0x26')](function(_0x103205){if(_0x103205&&_0x103205[_0x9012('0x51')]===0x0){return db[_0x9012('0x52')][_0x9012('0x4a')]({'name':_0x3d7a72['name'],'resourceId':_0x3d7a72['id'],'type':_0x103205[_0x9012('0x2b')],'sectionId':_0x103205['id']},{})['then'](function(){return _0x21bd7b;});}else{return _0x21bd7b;}})['catch'](function(_0x584572){logger[_0x9012('0x29')](_0x9012('0x53'),_0x584572);throw _0x584572;});}return _0x21bd7b;})['then'](respondWithResult(_0x217e2a,0xc9))[_0x9012('0x49')](handleError(_0x217e2a,null));};exports[_0x9012('0x25')]=function(_0x2898b6,_0x4352e4){if(_0x2898b6['body']['id']){delete _0x2898b6[_0x9012('0x4b')]['id'];}return db['SquareOdbc'][_0x9012('0x48')]({'where':{'id':_0x2898b6[_0x9012('0x54')]['id']}})['then'](handleEntityNotFound(_0x4352e4,null))[_0x9012('0x26')](saveUpdates(_0x2898b6[_0x9012('0x4b')],null))[_0x9012('0x26')](respondWithResult(_0x4352e4,null))[_0x9012('0x49')](handleError(_0x4352e4,null));};exports[_0x9012('0x27')]=function(_0x4901f7,_0xe21a73){return db[_0x9012('0x2d')][_0x9012('0x48')]({'where':{'id':_0x4901f7['params']['id']}})['then'](handleEntityNotFound(_0xe21a73,null))[_0x9012('0x26')](removeEntity(_0xe21a73,null))['catch'](handleError(_0xe21a73,null));};exports['test']=function(_0x131a5e,_0x5b43af,_0x27791c){var _0x2afc8f;return db['SquareOdbc'][_0x9012('0x48')]({'where':{'id':_0x131a5e[_0x9012('0x54')]['id']},'attributes':['id',_0x9012('0x55')]})[_0x9012('0x26')](handleEntityNotFound(_0x5b43af,null))['then'](function(_0x1f7852){if(_0x1f7852){var _0x4fd0d8=require(_0x9012('0x56'))();_0x4fd0d8[_0x9012('0x57')](_0x1f7852[_0x9012('0x55')]);_0x4fd0d8[_0x9012('0x58')]();return _0x1f7852;}})['then'](respondWithResult(_0x5b43af,null))['catch'](handleError(_0x5b43af,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 99c0d73..7faa24e 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 _0xe5bb=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc'];(function(_0xa223ad,_0x5a574b){var _0x306d47=function(_0x4b19ab){while(--_0x4b19ab){_0xa223ad['push'](_0xa223ad['shift']());}};_0x306d47(++_0x5a574b);}(_0xe5bb,0x15f));var _0xbe5b=function(_0x4385f6,_0x59db64){_0x4385f6=_0x4385f6-0x0;var _0x28f5da=_0xe5bb[_0x4385f6];return _0x28f5da;};'use strict';var _=require(_0xbe5b('0x0'));var util=require(_0xbe5b('0x1'));var logger=require(_0xbe5b('0x2'))(_0xbe5b('0x3'));var moment=require(_0xbe5b('0x4'));var BPromise=require(_0xbe5b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe5b('0x6'));var rimraf=require(_0xbe5b('0x7'));var config=require(_0xbe5b('0x8'));var attributes=require('./squareOdbc.attributes');module[_0xbe5b('0x9')]=function(_0x4f3e1a,_0x267cdf){return _0x4f3e1a[_0xbe5b('0xa')](_0xbe5b('0xb'),attributes,{'tableName':_0xbe5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ec4=['bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ec4,0xe9));var _0x40ec=function(_0x3a47e4,_0x21b1d5){_0x3a47e4=_0x3a47e4-0x0;var _0x2486f9=_0x0ec4[_0x3a47e4];return _0x2486f9;};'use strict';var _=require(_0x40ec('0x0'));var util=require(_0x40ec('0x1'));var logger=require(_0x40ec('0x2'))(_0x40ec('0x3'));var moment=require(_0x40ec('0x4'));var BPromise=require(_0x40ec('0x5'));var rp=require(_0x40ec('0x6'));var fs=require('fs');var path=require(_0x40ec('0x7'));var rimraf=require(_0x40ec('0x8'));var config=require(_0x40ec('0x9'));var attributes=require(_0x40ec('0xa'));module['exports']=function(_0x501e0f,_0x1cd8c3){return _0x501e0f[_0x40ec('0xb')](_0x40ec('0xc'),attributes,{'tableName':_0x40ec('0xd'),'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 da81a71..0dc22b0 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 _0xb4c1=['rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','options','raw','where','attributes','include','model','map','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xb4c1,0x14a));var _0x1b4c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb4c1[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x1b4c('0x0'));var moment=require(_0x1b4c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b4c('0x2'));var db=require(_0x1b4c('0x3'))['db'];var utils=require(_0x1b4c('0x4'));var logger=require(_0x1b4c('0x5'))(_0x1b4c('0x6'));var config=require(_0x1b4c('0x7'));var jayson=require(_0x1b4c('0x8'));var client=jayson[_0x1b4c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5498f3,_0x342731,_0x3157c3){return new BPromise(function(_0x21331d,_0x4e5000){return client['request'](_0x5498f3,_0x3157c3)[_0x1b4c('0xa')](function(_0xffebe){logger[_0x1b4c('0xb')]('SquareOdbc,\x20%s,\x20%s',_0x342731,_0x1b4c('0xc'));logger[_0x1b4c('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x342731,_0x1b4c('0xc'),JSON[_0x1b4c('0xe')](_0xffebe));if(_0xffebe[_0x1b4c('0xf')]){if(_0xffebe['error']['code']===0x1f4){logger[_0x1b4c('0xf')](_0x1b4c('0x10'),_0x342731,_0xffebe[_0x1b4c('0xf')][_0x1b4c('0x11')]);return _0x4e5000(_0xffebe[_0x1b4c('0xf')][_0x1b4c('0x11')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x342731,_0xffebe['error']['message']);return _0x21331d(_0xffebe[_0x1b4c('0xf')][_0x1b4c('0x11')]);}else{logger['info'](_0x1b4c('0x10'),_0x342731,'request\x20sent');_0x21331d(_0xffebe[_0x1b4c('0x12')]['message']);}})[_0x1b4c('0x13')](function(_0xf97459){logger[_0x1b4c('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x342731,_0xf97459);_0x4e5000(_0xf97459);});});}exports[_0x1b4c('0x14')]=function(_0x188062){var _0x261c39=this;return new Promise(function(_0x2372a2,_0x11c051){return db['SquareOdbc']['find']({'raw':_0x188062[_0x1b4c('0x15')]?_0x188062[_0x1b4c('0x15')][_0x1b4c('0x16')]===undefined?!![]:![]:!![],'where':_0x188062[_0x1b4c('0x15')]?_0x188062[_0x1b4c('0x15')][_0x1b4c('0x17')]||null:null,'attributes':_0x188062[_0x1b4c('0x15')]?_0x188062['options'][_0x1b4c('0x18')]||null:null,'include':_0x188062[_0x1b4c('0x15')]?_0x188062[_0x1b4c('0x15')][_0x1b4c('0x19')]?_['map'](_0x188062[_0x1b4c('0x15')]['include'],function(_0x589396){return{'model':db[_0x589396[_0x1b4c('0x1a')]],'as':_0x589396['as'],'attributes':_0x589396['attributes'],'include':_0x589396[_0x1b4c('0x19')]?_[_0x1b4c('0x1b')](_0x589396[_0x1b4c('0x19')],function(_0x6b665a){return{'model':db[_0x6b665a['model']],'as':_0x6b665a['as'],'attributes':_0x6b665a['attributes'],'include':_0x6b665a[_0x1b4c('0x19')]?_[_0x1b4c('0x1b')](_0x6b665a['include'],function(_0x739639){return{'model':db[_0x739639['model']],'as':_0x739639['as'],'attributes':_0x739639[_0x1b4c('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1b4c('0xa')](function(_0x4538db){logger[_0x1b4c('0xb')](_0x1b4c('0x14'),_0x188062);logger[_0x1b4c('0xd')](_0x1b4c('0x14'),_0x188062,JSON[_0x1b4c('0xe')](_0x4538db));_0x2372a2(_0x4538db);})['catch'](function(_0x4f2d78){logger[_0x1b4c('0xf')](_0x1b4c('0x14'),_0x4f2d78[_0x1b4c('0x11')],_0x188062);_0x11c051(_0x261c39[_0x1b4c('0xf')](0x1f4,_0x4f2d78[_0x1b4c('0x11')]));});});}; \ No newline at end of file +var _0xd086=['then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xd086,0x98));var _0x6d08=function(_0x5d480a,_0x3943b7){_0x5d480a=_0x5d480a-0x0;var _0x56a943=_0xd086[_0x5d480a];return _0x56a943;};'use strict';var _=require(_0x6d08('0x0'));var util=require(_0x6d08('0x1'));var moment=require(_0x6d08('0x2'));var BPromise=require(_0x6d08('0x3'));var rs=require(_0x6d08('0x4'));var fs=require('fs');var Redis=require(_0x6d08('0x5'));var db=require(_0x6d08('0x6'))['db'];var utils=require(_0x6d08('0x7'));var logger=require(_0x6d08('0x8'))(_0x6d08('0x9'));var config=require('../../config/environment');var jayson=require(_0x6d08('0xa'));var client=jayson[_0x6d08('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x512cec,_0x49284d,_0x5e20b4){return new BPromise(function(_0x312537,_0xc9222c){return client[_0x6d08('0xc')](_0x512cec,_0x5e20b4)[_0x6d08('0xd')](function(_0xa63e38){logger['info'](_0x6d08('0xe'),_0x49284d,_0x6d08('0xf'));logger[_0x6d08('0x10')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x49284d,_0x6d08('0xf'),JSON[_0x6d08('0x11')](_0xa63e38));if(_0xa63e38[_0x6d08('0x12')]){if(_0xa63e38['error'][_0x6d08('0x13')]===0x1f4){logger[_0x6d08('0x12')](_0x6d08('0xe'),_0x49284d,_0xa63e38[_0x6d08('0x12')]['message']);return _0xc9222c(_0xa63e38[_0x6d08('0x12')][_0x6d08('0x14')]);}logger[_0x6d08('0x12')](_0x6d08('0xe'),_0x49284d,_0xa63e38[_0x6d08('0x12')]['message']);return _0x312537(_0xa63e38['error']['message']);}else{logger[_0x6d08('0x15')](_0x6d08('0xe'),_0x49284d,'request\x20sent');_0x312537(_0xa63e38[_0x6d08('0x16')][_0x6d08('0x14')]);}})[_0x6d08('0x17')](function(_0x391696){logger['error'](_0x6d08('0xe'),_0x49284d,_0x391696);_0xc9222c(_0x391696);});});}exports[_0x6d08('0x18')]=function(_0x334130){var _0x76e8f2=this;return new Promise(function(_0x2a5817,_0x1e504a){return db['SquareOdbc'][_0x6d08('0x19')]({'raw':_0x334130[_0x6d08('0x1a')]?_0x334130['options'][_0x6d08('0x1b')]===undefined?!![]:![]:!![],'where':_0x334130[_0x6d08('0x1a')]?_0x334130[_0x6d08('0x1a')][_0x6d08('0x1c')]||null:null,'attributes':_0x334130['options']?_0x334130['options'][_0x6d08('0x1d')]||null:null,'include':_0x334130['options']?_0x334130[_0x6d08('0x1a')][_0x6d08('0x1e')]?_[_0x6d08('0x1f')](_0x334130[_0x6d08('0x1a')][_0x6d08('0x1e')],function(_0x2817b2){return{'model':db[_0x2817b2[_0x6d08('0x20')]],'as':_0x2817b2['as'],'attributes':_0x2817b2[_0x6d08('0x1d')],'include':_0x2817b2['include']?_[_0x6d08('0x1f')](_0x2817b2[_0x6d08('0x1e')],function(_0x148d91){return{'model':db[_0x148d91[_0x6d08('0x20')]],'as':_0x148d91['as'],'attributes':_0x148d91[_0x6d08('0x1d')],'include':_0x148d91[_0x6d08('0x1e')]?_[_0x6d08('0x1f')](_0x148d91[_0x6d08('0x1e')],function(_0x110434){return{'model':db[_0x110434[_0x6d08('0x20')]],'as':_0x110434['as'],'attributes':_0x110434['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d08('0xd')](function(_0x23b379){logger[_0x6d08('0x15')]('ShowSquareOdbc',_0x334130);logger[_0x6d08('0x10')](_0x6d08('0x18'),_0x334130,JSON[_0x6d08('0x11')](_0x23b379));_0x2a5817(_0x23b379);})['catch'](function(_0x497bcc){logger[_0x6d08('0x12')]('ShowSquareOdbc',_0x497bcc['message'],_0x334130);_0x1e504a(_0x76e8f2[_0x6d08('0x12')](0x1f4,_0x497bcc['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index cc74166..3d0efa6 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 _0x1842=['index','/:id','show','create','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0x1842,0xa1));var _0x2184=function(_0x57c073,_0x33e1ba){_0x57c073=_0x57c073-0x0;var _0x1155ab=_0x1842[_0x57c073];return _0x1155ab;};'use strict';var multer=require('multer');var util=require(_0x2184('0x0'));var path=require(_0x2184('0x1'));var timeout=require('connect-timeout');var express=require(_0x2184('0x2'));var router=express[_0x2184('0x3')]();var fs_extra=require(_0x2184('0x4'));var auth=require(_0x2184('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2184('0x6'));var controller=require('./squareProject.controller');router[_0x2184('0x7')]('/',auth[_0x2184('0x8')](),controller[_0x2184('0x9')]);router[_0x2184('0x7')](_0x2184('0xa'),auth[_0x2184('0x8')](),controller[_0x2184('0xb')]);router['post']('/',auth[_0x2184('0x8')](),controller[_0x2184('0xc')]);router[_0x2184('0xd')](_0x2184('0xa'),auth[_0x2184('0x8')](),controller[_0x2184('0xe')]);router[_0x2184('0xf')](_0x2184('0xa'),auth[_0x2184('0x8')](),controller['destroy']);module[_0x2184('0x10')]=router; \ No newline at end of file +var _0x8402=['../../components/interaction/service','./squareProject.controller','get','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x405056,_0x186a8c){var _0x576c59=function(_0x1c6fd4){while(--_0x1c6fd4){_0x405056['push'](_0x405056['shift']());}};_0x576c59(++_0x186a8c);}(_0x8402,0xf9));var _0x2840=function(_0x20a861,_0x61c48d){_0x20a861=_0x20a861-0x0;var _0xa93d1c=_0x8402[_0x20a861];return _0xa93d1c;};'use strict';var multer=require(_0x2840('0x0'));var util=require(_0x2840('0x1'));var path=require(_0x2840('0x2'));var timeout=require('connect-timeout');var express=require(_0x2840('0x3'));var router=express[_0x2840('0x4')]();var fs_extra=require(_0x2840('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2840('0x6'));var config=require('../../config/environment');var controller=require(_0x2840('0x7'));router[_0x2840('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2840('0x8')](_0x2840('0x9'),auth[_0x2840('0xa')](),controller[_0x2840('0xb')]);router[_0x2840('0xc')]('/',auth[_0x2840('0xa')](),controller[_0x2840('0xd')]);router[_0x2840('0xe')](_0x2840('0x9'),auth[_0x2840('0xa')](),controller['update']);router[_0x2840('0xf')](_0x2840('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x2840('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 fc2c6a1..9d682c9 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 _0xef3f=['long','getDataValue','preproduction','toString','production','DATE','sequelize','exports','name','STRING','BLOB'];(function(_0x2edb9f,_0x36fad0){var _0x4e5979=function(_0x425f9f){while(--_0x425f9f){_0x2edb9f['push'](_0x2edb9f['shift']());}};_0x4e5979(++_0x36fad0);}(_0xef3f,0xe2));var _0xfef3=function(_0x2d5910,_0x376c4e){_0x2d5910=_0x2d5910-0x0;var _0x1aa5b8=_0xef3f[_0x2d5910];return _0x1aa5b8;};'use strict';var Sequelize=require(_0xfef3('0x0'));module[_0xfef3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfef3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xfef3('0x3')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xfef3('0x4')](_0xfef3('0x5')),'get':function(){if(this[_0xfef3('0x6')](_0xfef3('0x7'))){return this['getDataValue'](_0xfef3('0x7'))[_0xfef3('0x8')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0xfef3('0x9'))){return this[_0xfef3('0x6')](_0xfef3('0x9'))['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0xfef3('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x813b=['preproduction','toString','long','production','utf8','DATE','sequelize','STRING','name','TEXT','BLOB','getDataValue'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x813b,0x126));var _0xb813=function(_0x5ce916,_0x10f92c){_0x5ce916=_0x5ce916-0x0;var _0x19c16e=_0x813b[_0x5ce916];return _0x19c16e;};'use strict';var Sequelize=require(_0xb813('0x0'));module['exports']={'name':{'type':Sequelize[_0xb813('0x1')],'unique':_0xb813('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb813('0x1')]},'notes':{'type':Sequelize[_0xb813('0x3')]},'preproduction':{'type':Sequelize[_0xb813('0x4')]('long'),'get':function(){if(this[_0xb813('0x5')](_0xb813('0x6'))){return this[_0xb813('0x5')](_0xb813('0x6'))[_0xb813('0x7')]('utf8');}}},'production':{'type':Sequelize[_0xb813('0x4')](_0xb813('0x8')),'get':function(){if(this[_0xb813('0x5')]('production')){return this[_0xb813('0x5')](_0xb813('0x9'))['toString'](_0xb813('0xa'));}}},'savedAt':{'type':Sequelize[_0xb813('0xb')]},'publishedAt':{'type':Sequelize[_0xb813('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 05fb63a..1cdb253 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 _0xeb02=['key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','production','destroy','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','undefined','limit','count','offset','Content-Range','then','get','SquareProjects','publish','stringify','end','error','name','SquareProject','fieldName','type'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xeb02,0x1b8));var _0x2eb0=function(_0x2ccfa0,_0x5c9186){_0x2ccfa0=_0x2ccfa0-0x0;var _0xf34a17=_0xeb02[_0x2ccfa0];return _0xf34a17;};'use strict';var _=require(_0x2eb0('0x0'));var Redis=require(_0x2eb0('0x1'));var qs=require(_0x2eb0('0x2'));var logger=require('../../config/logger')(_0x2eb0('0x3'));var config=require(_0x2eb0('0x4'));var db=require(_0x2eb0('0x5'))['db'];config[_0x2eb0('0x6')]=_[_0x2eb0('0x7')](config['redis'],{'host':_0x2eb0('0x8'),'port':0x18eb});var socket=require(_0x2eb0('0x9'))(new Redis(config[_0x2eb0('0x6')]));require('./squareProject.socket')[_0x2eb0('0xa')](socket);function respondWithResult(_0x2cc42c,_0x40e4df){_0x40e4df=_0x40e4df||0xc8;return function(_0x535f9f){if(_0x535f9f){return _0x2cc42c[_0x2eb0('0xb')](_0x40e4df)[_0x2eb0('0xc')](_0x535f9f);}};}function respondWithFilteredResult(_0x4d7544,_0x1aa95f){return function(_0x210b6c){if(_0x210b6c){var _0x2fa52c=typeof _0x1aa95f['offset']===_0x2eb0('0xd')&&typeof _0x1aa95f[_0x2eb0('0xe')]===_0x2eb0('0xd');var _0x4894ac=_0x210b6c[_0x2eb0('0xf')];var _0x6c25b2=_0x2fa52c?0x0:_0x1aa95f[_0x2eb0('0x10')];var _0x54e0d7=_0x2fa52c?_0x210b6c[_0x2eb0('0xf')]:_0x1aa95f[_0x2eb0('0x10')]+_0x1aa95f[_0x2eb0('0xe')];var _0x7fb935;if(_0x54e0d7>=_0x4894ac){_0x54e0d7=_0x4894ac;_0x7fb935=0xc8;}else{_0x7fb935=0xce;}_0x4d7544['status'](_0x7fb935);return _0x4d7544['set'](_0x2eb0('0x11'),_0x6c25b2+'-'+_0x54e0d7+'/'+_0x4894ac)[_0x2eb0('0xc')](_0x210b6c);}return null;};}function saveUpdates(_0x36aaa1){return function(_0x17f9e9){if(_0x17f9e9){return _0x17f9e9['update'](_0x36aaa1)['then'](function(_0x2ff7dc){return _0x2ff7dc;});}return null;};}function removeEntity(_0x219f8d){return function(_0x2c99d4){if(_0x2c99d4){return _0x2c99d4['destroy']()[_0x2eb0('0x12')](function(){var _0x3d94e7=_0x2c99d4[_0x2eb0('0x13')]({'plain':!![]});var _0x225692=_0x2eb0('0x14');return db['UserProfileResource']['destroy']({'where':{'type':_0x225692,'resourceId':_0x3d94e7['id']}})['then'](function(){return _0x2c99d4;});})['then'](function(){var _0x2ef22a=new Redis(config[_0x2eb0('0x6')]);_0x2ef22a[_0x2eb0('0x15')]('agi',JSON[_0x2eb0('0x16')]({'id':_0x2c99d4['id'],'deleted':!![]}));})[_0x2eb0('0x12')](function(){_0x219f8d[_0x2eb0('0xb')](0xcc)[_0x2eb0('0x17')]();});}};}function handleEntityNotFound(_0x5f111e){return function(_0x1a341b){if(!_0x1a341b){_0x5f111e['sendStatus'](0x194);}return _0x1a341b;};}function handleError(_0x53a483,_0x41e0d3){_0x41e0d3=_0x41e0d3||0x1f4;return function(_0x20a8e5){logger[_0x2eb0('0x18')](_0x20a8e5['stack']);if(_0x20a8e5[_0x2eb0('0x19')]){delete _0x20a8e5[_0x2eb0('0x19')];}_0x53a483[_0x2eb0('0xb')](_0x41e0d3)['send'](_0x20a8e5);};}exports['index']=function(_0x4b43d7,_0x59f2cc){var _0x5f336e={},_0x209d51={},_0x4e6b46={'count':0x0,'rows':[]};var _0x2ae2f8=_['map'](db[_0x2eb0('0x1a')]['rawAttributes'],function(_0x26485d){return{'name':_0x26485d[_0x2eb0('0x1b')],'type':_0x26485d[_0x2eb0('0x1c')][_0x2eb0('0x1d')]};});_0x209d51[_0x2eb0('0x1e')]=_[_0x2eb0('0x1f')](_0x2ae2f8,'name');_0x209d51[_0x2eb0('0x20')]=_[_0x2eb0('0x21')](_0x4b43d7['query']);_0x209d51[_0x2eb0('0x22')]=_['intersection'](_0x209d51[_0x2eb0('0x1e')],_0x209d51[_0x2eb0('0x20')]);_0x5f336e[_0x2eb0('0x23')]=_[_0x2eb0('0x24')](_0x209d51[_0x2eb0('0x1e')],qs[_0x2eb0('0x25')](_0x4b43d7['query'][_0x2eb0('0x25')]));_0x5f336e[_0x2eb0('0x23')]=_0x5f336e[_0x2eb0('0x23')]['length']?_0x5f336e[_0x2eb0('0x23')]:_0x209d51[_0x2eb0('0x1e')];if(!_0x4b43d7['query'][_0x2eb0('0x26')](_0x2eb0('0x27'))){_0x5f336e[_0x2eb0('0xe')]=qs[_0x2eb0('0xe')](_0x4b43d7[_0x2eb0('0x20')][_0x2eb0('0xe')]);_0x5f336e[_0x2eb0('0x10')]=qs[_0x2eb0('0x10')](_0x4b43d7[_0x2eb0('0x20')][_0x2eb0('0x10')]);}_0x5f336e[_0x2eb0('0x28')]=qs[_0x2eb0('0x29')](_0x4b43d7['query'][_0x2eb0('0x29')]);_0x5f336e[_0x2eb0('0x2a')]=qs[_0x2eb0('0x22')](_[_0x2eb0('0x2b')](_0x4b43d7['query'],_0x209d51[_0x2eb0('0x22')]),_0x2ae2f8);if(_0x4b43d7[_0x2eb0('0x20')][_0x2eb0('0x2c')]){_0x5f336e[_0x2eb0('0x2a')]=_[_0x2eb0('0x2d')](_0x5f336e['where'],{'$or':_[_0x2eb0('0x1f')](_0x2ae2f8,function(_0x6fa152){if(_0x6fa152[_0x2eb0('0x1c')]!==_0x2eb0('0x2e')){var _0x4a2c3c={};_0x4a2c3c[_0x6fa152[_0x2eb0('0x19')]]={'$like':'%'+_0x4b43d7[_0x2eb0('0x20')][_0x2eb0('0x2c')]+'%'};return _0x4a2c3c;}})});}_0x5f336e=_[_0x2eb0('0x2d')]({},_0x5f336e,_0x4b43d7['options']);var _0x29edd5={'where':_0x5f336e[_0x2eb0('0x2a')]};return db['SquareProject'][_0x2eb0('0xf')](_0x29edd5)[_0x2eb0('0x12')](function(_0x22b9bb){_0x4e6b46['count']=_0x22b9bb;if(_0x4b43d7[_0x2eb0('0x20')][_0x2eb0('0x2f')]){_0x5f336e['include']=[{'all':!![]}];}return db[_0x2eb0('0x1a')][_0x2eb0('0x30')](_0x5f336e);})[_0x2eb0('0x12')](function(_0x52ea6d){_0x4e6b46['rows']=_0x52ea6d;return _0x4e6b46;})['then'](respondWithFilteredResult(_0x59f2cc,_0x5f336e))[_0x2eb0('0x31')](handleError(_0x59f2cc,null));};exports['show']=function(_0x7cb55c,_0x30ec25){var _0x57f758={'raw':![],'where':{'id':_0x7cb55c['params']['id']}},_0x49cf53={};_0x49cf53[_0x2eb0('0x1e')]=_[_0x2eb0('0x21')](db['SquareProject']['rawAttributes']);_0x49cf53[_0x2eb0('0x20')]=_['keys'](_0x7cb55c['query']);_0x49cf53[_0x2eb0('0x22')]=_[_0x2eb0('0x24')](_0x49cf53['model'],_0x49cf53[_0x2eb0('0x20')]);_0x57f758['attributes']=_[_0x2eb0('0x24')](_0x49cf53['model'],qs['fields'](_0x7cb55c[_0x2eb0('0x20')]['fields']));_0x57f758[_0x2eb0('0x23')]=_0x57f758[_0x2eb0('0x23')][_0x2eb0('0x32')]?_0x57f758[_0x2eb0('0x23')]:_0x49cf53[_0x2eb0('0x1e')];if(_0x7cb55c[_0x2eb0('0x20')][_0x2eb0('0x2f')]){_0x57f758[_0x2eb0('0x33')]=[{'all':!![]}];}_0x57f758=_[_0x2eb0('0x2d')]({},_0x57f758,_0x7cb55c[_0x2eb0('0x34')]);return db[_0x2eb0('0x1a')][_0x2eb0('0x35')](_0x57f758)[_0x2eb0('0x12')](handleEntityNotFound(_0x30ec25,null))[_0x2eb0('0x12')](respondWithResult(_0x30ec25,null))['catch'](handleError(_0x30ec25,null));};exports[_0x2eb0('0x36')]=function(_0x49fff8,_0x5628ad){return db[_0x2eb0('0x1a')]['create'](_0x49fff8[_0x2eb0('0x37')],{})[_0x2eb0('0x12')](function(_0x3130c9){var _0xb6830e=_0x49fff8[_0x2eb0('0x38')][_0x2eb0('0x13')]({'plain':!![]});if(!_0xb6830e)throw new Error(_0x2eb0('0x39'));if(_0xb6830e[_0x2eb0('0x3a')]===_0x2eb0('0x38')){var _0x5e5a21=_0x3130c9[_0x2eb0('0x13')]({'plain':!![]});var _0x4f7bd8='SquareProjects';return db[_0x2eb0('0x3b')]['find']({'where':{'name':_0x4f7bd8,'userProfileId':_0xb6830e[_0x2eb0('0x3c')]},'raw':!![]})[_0x2eb0('0x12')](function(_0x4bc5e2){if(_0x4bc5e2&&_0x4bc5e2['autoAssociation']===0x0){return db[_0x2eb0('0x3d')][_0x2eb0('0x36')]({'name':_0x5e5a21[_0x2eb0('0x19')],'resourceId':_0x5e5a21['id'],'type':_0x4bc5e2[_0x2eb0('0x19')],'sectionId':_0x4bc5e2['id']},{})['then'](function(){return _0x3130c9;});}else{return _0x3130c9;}})[_0x2eb0('0x31')](function(_0x3aa43f){logger[_0x2eb0('0x18')](_0x2eb0('0x3e'),_0x3aa43f);throw _0x3aa43f;});}return _0x3130c9;})['then'](respondWithResult(_0x5628ad,0xc9))[_0x2eb0('0x31')](handleError(_0x5628ad,null));};exports[_0x2eb0('0x3f')]=function(_0x571efe,_0x1359f2){if(_0x571efe[_0x2eb0('0x37')]['id']){delete _0x571efe[_0x2eb0('0x37')]['id'];}return db[_0x2eb0('0x1a')][_0x2eb0('0x35')]({'where':{'id':_0x571efe[_0x2eb0('0x40')]['id']}})[_0x2eb0('0x12')](handleEntityNotFound(_0x1359f2,null))['then'](saveUpdates(_0x571efe[_0x2eb0('0x37')],null))['then'](function(_0x5bcdba){if(!_0x5bcdba)return;var _0x45afd4=_0x5bcdba[_0x2eb0('0x13')]({'plain':!![]});return _0x45afd4;})[_0x2eb0('0x12')](function(_0x14c273){var _0x206ba1=new Redis(config[_0x2eb0('0x6')]);_0x206ba1[_0x2eb0('0x15')]('agi',JSON[_0x2eb0('0x16')](_[_0x2eb0('0x2b')](_0x14c273,['id',_0x2eb0('0x19'),_0x2eb0('0x41')])));return _0x14c273;})[_0x2eb0('0x12')](respondWithResult(_0x1359f2,null))['catch'](handleError(_0x1359f2,null));};exports[_0x2eb0('0x42')]=function(_0x5d0ea3,_0x50682a){return db[_0x2eb0('0x1a')][_0x2eb0('0x35')]({'where':{'id':_0x5d0ea3[_0x2eb0('0x40')]['id']}})[_0x2eb0('0x12')](handleEntityNotFound(_0x50682a,null))['then'](removeEntity(_0x50682a,null))['catch'](handleError(_0x50682a,null));}; \ No newline at end of file +var _0x147d=['options','count','rows','show','params','keys','include','find','catch','body','user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','offset','limit','undefined','set','Content-Range','json','update','then','destroy','get','publish','agi','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter'];(function(_0x31a125,_0x139136){var _0x1b1baa=function(_0x5aa7aa){while(--_0x5aa7aa){_0x31a125['push'](_0x31a125['shift']());}};_0x1b1baa(++_0x139136);}(_0x147d,0xe9));var _0xd147=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x147d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Redis=require(_0xd147('0x0'));var qs=require(_0xd147('0x1'));var logger=require(_0xd147('0x2'))(_0xd147('0x3'));var config=require(_0xd147('0x4'));var db=require(_0xd147('0x5'))['db'];config[_0xd147('0x6')]=_[_0xd147('0x7')](config[_0xd147('0x6')],{'host':_0xd147('0x8'),'port':0x18eb});var socket=require(_0xd147('0x9'))(new Redis(config[_0xd147('0x6')]));require(_0xd147('0xa'))[_0xd147('0xb')](socket);function respondWithResult(_0x334adc,_0x2c9669){_0x2c9669=_0x2c9669||0xc8;return function(_0x5b1b4f){if(_0x5b1b4f){return _0x334adc[_0xd147('0xc')](_0x2c9669)['json'](_0x5b1b4f);}};}function respondWithFilteredResult(_0x51400d,_0x534700){return function(_0x878ca0){if(_0x878ca0){var _0x699a6d=typeof _0x534700[_0xd147('0xd')]==='undefined'&&typeof _0x534700[_0xd147('0xe')]===_0xd147('0xf');var _0x132073=_0x878ca0['count'];var _0x189dc9=_0x699a6d?0x0:_0x534700[_0xd147('0xd')];var _0x4df449=_0x699a6d?_0x878ca0['count']:_0x534700['offset']+_0x534700[_0xd147('0xe')];var _0x451ba3;if(_0x4df449>=_0x132073){_0x4df449=_0x132073;_0x451ba3=0xc8;}else{_0x451ba3=0xce;}_0x51400d[_0xd147('0xc')](_0x451ba3);return _0x51400d[_0xd147('0x10')](_0xd147('0x11'),_0x189dc9+'-'+_0x4df449+'/'+_0x132073)[_0xd147('0x12')](_0x878ca0);}return null;};}function saveUpdates(_0x3d133b){return function(_0x274f6d){if(_0x274f6d){return _0x274f6d[_0xd147('0x13')](_0x3d133b)[_0xd147('0x14')](function(_0x3284fd){return _0x3284fd;});}return null;};}function removeEntity(_0x48b7ef){return function(_0x3ee7bb){if(_0x3ee7bb){return _0x3ee7bb[_0xd147('0x15')]()[_0xd147('0x14')](function(){var _0x47ba99=_0x3ee7bb[_0xd147('0x16')]({'plain':!![]});var _0x41ad8f='SquareProjects';return db['UserProfileResource'][_0xd147('0x15')]({'where':{'type':_0x41ad8f,'resourceId':_0x47ba99['id']}})[_0xd147('0x14')](function(){return _0x3ee7bb;});})[_0xd147('0x14')](function(){var _0x5dc83f=new Redis(config[_0xd147('0x6')]);_0x5dc83f[_0xd147('0x17')](_0xd147('0x18'),JSON['stringify']({'id':_0x3ee7bb['id'],'deleted':!![]}));})['then'](function(){_0x48b7ef[_0xd147('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x587429){return function(_0x56587b){if(!_0x56587b){_0x587429['sendStatus'](0x194);}return _0x56587b;};}function handleError(_0x41e033,_0x394c84){_0x394c84=_0x394c84||0x1f4;return function(_0x3eb826){logger[_0xd147('0x19')](_0x3eb826[_0xd147('0x1a')]);if(_0x3eb826[_0xd147('0x1b')]){delete _0x3eb826[_0xd147('0x1b')];}_0x41e033[_0xd147('0xc')](_0x394c84)[_0xd147('0x1c')](_0x3eb826);};}exports[_0xd147('0x1d')]=function(_0x554fa5,_0x5e3567){var _0x564cf7={},_0x35d509={},_0x385bff={'count':0x0,'rows':[]};var _0xd4cb53=_[_0xd147('0x1e')](db[_0xd147('0x1f')][_0xd147('0x20')],function(_0x3b9b12){return{'name':_0x3b9b12[_0xd147('0x21')],'type':_0x3b9b12[_0xd147('0x22')][_0xd147('0x23')]};});_0x35d509['model']=_[_0xd147('0x1e')](_0xd4cb53,_0xd147('0x1b'));_0x35d509[_0xd147('0x24')]=_['keys'](_0x554fa5['query']);_0x35d509['filters']=_[_0xd147('0x25')](_0x35d509['model'],_0x35d509['query']);_0x564cf7['attributes']=_[_0xd147('0x25')](_0x35d509[_0xd147('0x26')],qs['fields'](_0x554fa5[_0xd147('0x24')][_0xd147('0x27')]));_0x564cf7[_0xd147('0x28')]=_0x564cf7[_0xd147('0x28')][_0xd147('0x29')]?_0x564cf7[_0xd147('0x28')]:_0x35d509[_0xd147('0x26')];if(!_0x554fa5[_0xd147('0x24')]['hasOwnProperty'](_0xd147('0x2a'))){_0x564cf7[_0xd147('0xe')]=qs[_0xd147('0xe')](_0x554fa5[_0xd147('0x24')]['limit']);_0x564cf7[_0xd147('0xd')]=qs[_0xd147('0xd')](_0x554fa5[_0xd147('0x24')][_0xd147('0xd')]);}_0x564cf7[_0xd147('0x2b')]=qs[_0xd147('0x2c')](_0x554fa5[_0xd147('0x24')][_0xd147('0x2c')]);_0x564cf7[_0xd147('0x2d')]=qs[_0xd147('0x2e')](_[_0xd147('0x2f')](_0x554fa5[_0xd147('0x24')],_0x35d509[_0xd147('0x2e')]),_0xd4cb53);if(_0x554fa5['query']['filter']){_0x564cf7[_0xd147('0x2d')]=_[_0xd147('0x30')](_0x564cf7[_0xd147('0x2d')],{'$or':_[_0xd147('0x1e')](_0xd4cb53,function(_0x3cc20e){if(_0x3cc20e[_0xd147('0x22')]!==_0xd147('0x31')){var _0x5eb056={};_0x5eb056[_0x3cc20e[_0xd147('0x1b')]]={'$like':'%'+_0x554fa5[_0xd147('0x24')][_0xd147('0x32')]+'%'};return _0x5eb056;}})});}_0x564cf7=_[_0xd147('0x30')]({},_0x564cf7,_0x554fa5[_0xd147('0x33')]);var _0x4c0bf0={'where':_0x564cf7[_0xd147('0x2d')]};return db[_0xd147('0x1f')][_0xd147('0x34')](_0x4c0bf0)['then'](function(_0x55c3cd){_0x385bff[_0xd147('0x34')]=_0x55c3cd;if(_0x554fa5[_0xd147('0x24')]['includeAll']){_0x564cf7['include']=[{'all':!![]}];}return db[_0xd147('0x1f')]['findAll'](_0x564cf7);})[_0xd147('0x14')](function(_0x5ee0c7){_0x385bff[_0xd147('0x35')]=_0x5ee0c7;return _0x385bff;})['then'](respondWithFilteredResult(_0x5e3567,_0x564cf7))['catch'](handleError(_0x5e3567,null));};exports[_0xd147('0x36')]=function(_0x565cf7,_0x40a793){var _0x3faf46={'raw':![],'where':{'id':_0x565cf7[_0xd147('0x37')]['id']}},_0x4e3ae4={};_0x4e3ae4['model']=_[_0xd147('0x38')](db[_0xd147('0x1f')][_0xd147('0x20')]);_0x4e3ae4[_0xd147('0x24')]=_[_0xd147('0x38')](_0x565cf7[_0xd147('0x24')]);_0x4e3ae4['filters']=_[_0xd147('0x25')](_0x4e3ae4['model'],_0x4e3ae4[_0xd147('0x24')]);_0x3faf46[_0xd147('0x28')]=_['intersection'](_0x4e3ae4[_0xd147('0x26')],qs[_0xd147('0x27')](_0x565cf7['query'][_0xd147('0x27')]));_0x3faf46[_0xd147('0x28')]=_0x3faf46[_0xd147('0x28')][_0xd147('0x29')]?_0x3faf46[_0xd147('0x28')]:_0x4e3ae4[_0xd147('0x26')];if(_0x565cf7[_0xd147('0x24')]['includeAll']){_0x3faf46[_0xd147('0x39')]=[{'all':!![]}];}_0x3faf46=_[_0xd147('0x30')]({},_0x3faf46,_0x565cf7[_0xd147('0x33')]);return db['SquareProject'][_0xd147('0x3a')](_0x3faf46)[_0xd147('0x14')](handleEntityNotFound(_0x40a793,null))[_0xd147('0x14')](respondWithResult(_0x40a793,null))[_0xd147('0x3b')](handleError(_0x40a793,null));};exports['create']=function(_0x444368,_0x3bba60){return db['SquareProject']['create'](_0x444368[_0xd147('0x3c')],{})['then'](function(_0x39055d){var _0x5b7744=_0x444368[_0xd147('0x3d')][_0xd147('0x16')]({'plain':!![]});if(!_0x5b7744)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b7744[_0xd147('0x3e')]===_0xd147('0x3d')){var _0x4898fb=_0x39055d[_0xd147('0x16')]({'plain':!![]});var _0x20fe18=_0xd147('0x3f');return db[_0xd147('0x40')][_0xd147('0x3a')]({'where':{'name':_0x20fe18,'userProfileId':_0x5b7744[_0xd147('0x41')]},'raw':!![]})[_0xd147('0x14')](function(_0x491107){if(_0x491107&&_0x491107[_0xd147('0x42')]===0x0){return db[_0xd147('0x43')][_0xd147('0x44')]({'name':_0x4898fb[_0xd147('0x1b')],'resourceId':_0x4898fb['id'],'type':_0x491107[_0xd147('0x1b')],'sectionId':_0x491107['id']},{})[_0xd147('0x14')](function(){return _0x39055d;});}else{return _0x39055d;}})[_0xd147('0x3b')](function(_0xe8655d){logger[_0xd147('0x19')](_0xd147('0x45'),_0xe8655d);throw _0xe8655d;});}return _0x39055d;})['then'](respondWithResult(_0x3bba60,0xc9))[_0xd147('0x3b')](handleError(_0x3bba60,null));};exports[_0xd147('0x13')]=function(_0x502bf3,_0x3afbb5){if(_0x502bf3[_0xd147('0x3c')]['id']){delete _0x502bf3[_0xd147('0x3c')]['id'];}return db[_0xd147('0x1f')][_0xd147('0x3a')]({'where':{'id':_0x502bf3['params']['id']}})['then'](handleEntityNotFound(_0x3afbb5,null))[_0xd147('0x14')](saveUpdates(_0x502bf3['body'],null))[_0xd147('0x14')](function(_0x244488){if(!_0x244488)return;var _0x5f5ddc=_0x244488[_0xd147('0x16')]({'plain':!![]});return _0x5f5ddc;})[_0xd147('0x14')](function(_0x59893b){var _0x46bed3=new Redis(config[_0xd147('0x6')]);_0x46bed3['publish'](_0xd147('0x18'),JSON['stringify'](_[_0xd147('0x2f')](_0x59893b,['id',_0xd147('0x1b'),_0xd147('0x46')])));return _0x59893b;})['then'](respondWithResult(_0x3afbb5,null))[_0xd147('0x3b')](handleError(_0x3afbb5,null));};exports['destroy']=function(_0x23e013,_0x2a0d7d){return db[_0xd147('0x1f')]['find']({'where':{'id':_0x23e013['params']['id']}})[_0xd147('0x14')](handleEntityNotFound(_0x2a0d7d,null))[_0xd147('0x14')](removeEntity(_0x2a0d7d,null))['catch'](handleError(_0x2a0d7d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index acbc8cf..5d0493a 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 _0x0195=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xeb6f8d,_0x1138f1){var _0x41f045=function(_0x2e8f0e){while(--_0x2e8f0e){_0xeb6f8d['push'](_0xeb6f8d['shift']());}};_0x41f045(++_0x1138f1);}(_0x0195,0x8d));var _0x5019=function(_0x2ca357,_0x4b938a){_0x2ca357=_0x2ca357-0x0;var _0x397f40=_0x0195[_0x2ca357];return _0x397f40;};'use strict';var EventEmitter=require(_0x5019('0x0'));var SquareProject=require(_0x5019('0x1'))['db'][_0x5019('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5019('0x3')](0x0);var events={'afterCreate':_0x5019('0x4'),'afterUpdate':_0x5019('0x5'),'afterDestroy':_0x5019('0x6')};function emitEvent(_0x252c1b){return function(_0x4c2c24,_0x523c6c,_0x32f709){SquareProjectEvents[_0x5019('0x7')](_0x252c1b+':'+_0x4c2c24['id'],_0x4c2c24);SquareProjectEvents['emit'](_0x252c1b,_0x4c2c24);_0x32f709(null);};}for(var e in events){if(events[_0x5019('0x8')](e)){var event=events[e];SquareProject[_0x5019('0x9')](e,emitEvent(event));}}module[_0x5019('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x1d3b=['save','remove','emit','hook','events','../../mysqldb'];(function(_0x5f52ab,_0x2a745b){var _0x34f6e0=function(_0x4ebca5){while(--_0x4ebca5){_0x5f52ab['push'](_0x5f52ab['shift']());}};_0x34f6e0(++_0x2a745b);}(_0x1d3b,0xb2));var _0xb1d3=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x1d3b[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require(_0xb1d3('0x0'));var SquareProject=require(_0xb1d3('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb1d3('0x2'),'afterUpdate':'update','afterDestroy':_0xb1d3('0x3')};function emitEvent(_0x2d7cfc){return function(_0x4add64,_0x55721b,_0x38f745){SquareProjectEvents[_0xb1d3('0x4')](_0x2d7cfc+':'+_0x4add64['id'],_0x4add64);SquareProjectEvents[_0xb1d3('0x4')](_0x2d7cfc,_0x4add64);_0x38f745(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xb1d3('0x5')](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 4819ca7..b56388d 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 _0x67af=['changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0x67af,0x123));var _0xf67a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x67af[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xf67a('0x0'));var util=require(_0xf67a('0x1'));var logger=require(_0xf67a('0x2'))(_0xf67a('0x3'));var moment=require(_0xf67a('0x4'));var BPromise=require('bluebird');var rp=require(_0xf67a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf67a('0x6'));var config=require(_0xf67a('0x7'));var attributes=require(_0xf67a('0x8'));module[_0xf67a('0x9')]=function(_0x57b06f,_0xee5407){return _0x57b06f[_0xf67a('0xa')](_0xf67a('0xb'),attributes,{'tableName':_0xf67a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5190a4,_0x202e72,_0x3ba1bf){if(_0x5190a4[_0xf67a('0xd')](_0xf67a('0xe'))){_0x5190a4['savedAt']=moment()[_0xf67a('0xf')](_0xf67a('0x10'));}if(_0x5190a4['changed'](_0xf67a('0x11'))){_0x5190a4[_0xf67a('0x12')]=moment()[_0xf67a('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3ba1bf(null,_0x5190a4);}}});}; \ No newline at end of file +var _0x6606=['SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','rimraf','./squareProject.attributes','exports','define'];(function(_0x15d1c4,_0x5a032e){var _0x481032=function(_0x19f55e){while(--_0x19f55e){_0x15d1c4['push'](_0x15d1c4['shift']());}};_0x481032(++_0x5a032e);}(_0x6606,0x158));var _0x6660=function(_0x7dee27,_0x545b55){_0x7dee27=_0x7dee27-0x0;var _0x4fb661=_0x6606[_0x7dee27];return _0x4fb661;};'use strict';var _=require(_0x6660('0x0'));var util=require(_0x6660('0x1'));var logger=require(_0x6660('0x2'))(_0x6660('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6660('0x4'));var config=require('../../config/environment');var attributes=require(_0x6660('0x5'));module[_0x6660('0x6')]=function(_0xbd2cef,_0x5b2790){return _0xbd2cef[_0x6660('0x7')](_0x6660('0x8'),attributes,{'tableName':_0x6660('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a54a0,_0x5dfaa2,_0x40a8f0){if(_0x1a54a0['changed'](_0x6660('0xa'))){_0x1a54a0[_0x6660('0xb')]=moment()[_0x6660('0xc')](_0x6660('0xd'));}if(_0x1a54a0['changed'](_0x6660('0xe'))){_0x1a54a0[_0x6660('0xf')]=moment()[_0x6660('0xc')](_0x6660('0xd'));}_0x40a8f0(null,_0x1a54a0);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index eae1388..ee4524b 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 _0x5744=['findAll','options','raw','where','attributes','map','include','model','then','info','stringify','catch','message','error','find','debug','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects'];(function(_0x4804a0,_0x2ecc6c){var _0x118114=function(_0x5595e5){while(--_0x5595e5){_0x4804a0['push'](_0x4804a0['shift']());}};_0x118114(++_0x2ecc6c);}(_0x5744,0x129));var _0x4574=function(_0x23a97c,_0x2d19e7){_0x23a97c=_0x23a97c-0x0;var _0xe5e1df=_0x5744[_0x23a97c];return _0xe5e1df;};'use strict';var _=require(_0x4574('0x0'));var Redis=require(_0x4574('0x1'));var db=require(_0x4574('0x2'))['db'];var logger=require(_0x4574('0x3'))('rpc');var config=require(_0x4574('0x4'));config[_0x4574('0x5')]=_[_0x4574('0x6')](config[_0x4574('0x5')],{'host':_0x4574('0x7'),'port':0x18eb});var socket=require(_0x4574('0x8'))(new Redis(config[_0x4574('0x5')]));require(_0x4574('0x9'))['register'](socket);exports[_0x4574('0xa')]=function(_0x552122){var _0x3aa488=this;return new Promise(function(_0x3ff7f0,_0x3cb9fc){return db['SquareProject'][_0x4574('0xb')]({'raw':_0x552122[_0x4574('0xc')]?_0x552122['options'][_0x4574('0xd')]===undefined?!![]:![]:!![],'where':_0x552122[_0x4574('0xc')]?_0x552122[_0x4574('0xc')][_0x4574('0xe')]||null:null,'attributes':_0x552122[_0x4574('0xc')]?_0x552122[_0x4574('0xc')][_0x4574('0xf')]||null:null,'limit':_0x552122[_0x4574('0xc')]?_0x552122[_0x4574('0xc')]['limit']||null:null,'include':_0x552122[_0x4574('0xc')]?_0x552122[_0x4574('0xc')]['include']?_[_0x4574('0x10')](_0x552122['options'][_0x4574('0x11')],function(_0x2c793c){return{'model':db[_0x2c793c[_0x4574('0x12')]],'as':_0x2c793c['as'],'attributes':_0x2c793c[_0x4574('0xf')],'include':_0x2c793c[_0x4574('0x11')]?_[_0x4574('0x10')](_0x2c793c[_0x4574('0x11')],function(_0x485bc6){return{'model':db[_0x485bc6[_0x4574('0x12')]],'as':_0x485bc6['as'],'attributes':_0x485bc6[_0x4574('0xf')],'include':_0x485bc6['include']?_['map'](_0x485bc6[_0x4574('0x11')],function(_0x17d56e){return{'model':db[_0x17d56e['model']],'as':_0x17d56e['as'],'attributes':_0x17d56e[_0x4574('0xf')]};}):[]};}):[]};}):[]:[]})[_0x4574('0x13')](function(_0x4c5671){logger[_0x4574('0x14')](_0x4574('0xa'),_0x552122);logger['debug'](_0x4574('0xa'),_0x552122,JSON[_0x4574('0x15')](_0x4c5671));_0x3ff7f0(_0x4c5671);})[_0x4574('0x16')](function(_0x2bf8d7){logger['error'](_0x4574('0xa'),_0x2bf8d7[_0x4574('0x17')],_0x552122);_0x3cb9fc(_0x3aa488[_0x4574('0x18')](0x1f4,_0x2bf8d7['message']));});});};exports['ShowSquareProject']=function(_0xac9200){var _0x4b3f26=this;return new Promise(function(_0x26cc21,_0x313223){return db['SquareProject'][_0x4574('0x19')]({'raw':_0xac9200['options']?_0xac9200['options'][_0x4574('0xd')]===undefined?!![]:![]:!![],'where':_0xac9200[_0x4574('0xc')]?_0xac9200[_0x4574('0xc')]['where']||null:null,'attributes':_0xac9200[_0x4574('0xc')]?_0xac9200[_0x4574('0xc')][_0x4574('0xf')]||null:null,'include':_0xac9200[_0x4574('0xc')]?_0xac9200['options'][_0x4574('0x11')]?_[_0x4574('0x10')](_0xac9200['options'][_0x4574('0x11')],function(_0x26053f){return{'model':db[_0x26053f[_0x4574('0x12')]],'as':_0x26053f['as'],'attributes':_0x26053f[_0x4574('0xf')],'include':_0x26053f[_0x4574('0x11')]?_[_0x4574('0x10')](_0x26053f[_0x4574('0x11')],function(_0x3827e7){return{'model':db[_0x3827e7[_0x4574('0x12')]],'as':_0x3827e7['as'],'attributes':_0x3827e7[_0x4574('0xf')],'include':_0x3827e7[_0x4574('0x11')]?_[_0x4574('0x10')](_0x3827e7[_0x4574('0x11')],function(_0x3a8cce){return{'model':db[_0x3a8cce[_0x4574('0x12')]],'as':_0x3a8cce['as'],'attributes':_0x3a8cce[_0x4574('0xf')]};}):[]};}):[]};}):[]:[]})[_0x4574('0x13')](function(_0x2d0fea){logger['info']('ShowSquareProject',_0xac9200);logger[_0x4574('0x1a')](_0x4574('0x1b'),_0xac9200,JSON[_0x4574('0x15')](_0x2d0fea));_0x26cc21(_0x2d0fea);})[_0x4574('0x16')](function(_0x4d086a){logger[_0x4574('0x18')]('ShowSquareProject',_0x4d086a[_0x4574('0x17')],_0xac9200);_0x313223(_0x4b3f26[_0x4574('0x18')](0x1f4,_0x4d086a[_0x4574('0x17')]));});});}; \ No newline at end of file +var _0xdd38=['where','attributes','limit','include','model','map','info','debug','catch','error','message','find','then','ShowSquareProject','stringify','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','./squareProject.socket','register','GetSquareProjects','SquareProject','raw','options'];(function(_0x5a7521,_0x2d1d5e){var _0x3d6e6a=function(_0x1ea2b8){while(--_0x1ea2b8){_0x5a7521['push'](_0x5a7521['shift']());}};_0x3d6e6a(++_0x2d1d5e);}(_0xdd38,0x197));var _0x8dd3=function(_0x17474a,_0xd1a49c){_0x17474a=_0x17474a-0x0;var _0x3a5495=_0xdd38[_0x17474a];return _0x3a5495;};'use strict';var _=require('lodash');var Redis=require(_0x8dd3('0x0'));var db=require(_0x8dd3('0x1'))['db'];var logger=require(_0x8dd3('0x2'))(_0x8dd3('0x3'));var config=require(_0x8dd3('0x4'));config['redis']=_[_0x8dd3('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8dd3('0x6')]));require(_0x8dd3('0x7'))[_0x8dd3('0x8')](socket);exports[_0x8dd3('0x9')]=function(_0xb18985){var _0x2e979b=this;return new Promise(function(_0x46f71b,_0x2422ba){return db[_0x8dd3('0xa')]['findAll']({'raw':_0xb18985['options']?_0xb18985['options'][_0x8dd3('0xb')]===undefined?!![]:![]:!![],'where':_0xb18985[_0x8dd3('0xc')]?_0xb18985[_0x8dd3('0xc')][_0x8dd3('0xd')]||null:null,'attributes':_0xb18985[_0x8dd3('0xc')]?_0xb18985['options'][_0x8dd3('0xe')]||null:null,'limit':_0xb18985[_0x8dd3('0xc')]?_0xb18985[_0x8dd3('0xc')][_0x8dd3('0xf')]||null:null,'include':_0xb18985[_0x8dd3('0xc')]?_0xb18985['options'][_0x8dd3('0x10')]?_['map'](_0xb18985[_0x8dd3('0xc')][_0x8dd3('0x10')],function(_0x551360){return{'model':db[_0x551360[_0x8dd3('0x11')]],'as':_0x551360['as'],'attributes':_0x551360[_0x8dd3('0xe')],'include':_0x551360[_0x8dd3('0x10')]?_[_0x8dd3('0x12')](_0x551360[_0x8dd3('0x10')],function(_0x14cfc0){return{'model':db[_0x14cfc0['model']],'as':_0x14cfc0['as'],'attributes':_0x14cfc0['attributes'],'include':_0x14cfc0[_0x8dd3('0x10')]?_['map'](_0x14cfc0[_0x8dd3('0x10')],function(_0x2a0aa2){return{'model':db[_0x2a0aa2['model']],'as':_0x2a0aa2['as'],'attributes':_0x2a0aa2[_0x8dd3('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3edc2e){logger[_0x8dd3('0x13')]('GetSquareProjects',_0xb18985);logger[_0x8dd3('0x14')](_0x8dd3('0x9'),_0xb18985,JSON['stringify'](_0x3edc2e));_0x46f71b(_0x3edc2e);})[_0x8dd3('0x15')](function(_0x1aed83){logger[_0x8dd3('0x16')]('GetSquareProjects',_0x1aed83['message'],_0xb18985);_0x2422ba(_0x2e979b[_0x8dd3('0x16')](0x1f4,_0x1aed83[_0x8dd3('0x17')]));});});};exports['ShowSquareProject']=function(_0x6b36ee){var _0x23b8c6=this;return new Promise(function(_0x28ab8c,_0x130d01){return db['SquareProject'][_0x8dd3('0x18')]({'raw':_0x6b36ee[_0x8dd3('0xc')]?_0x6b36ee['options']['raw']===undefined?!![]:![]:!![],'where':_0x6b36ee[_0x8dd3('0xc')]?_0x6b36ee[_0x8dd3('0xc')][_0x8dd3('0xd')]||null:null,'attributes':_0x6b36ee['options']?_0x6b36ee['options'][_0x8dd3('0xe')]||null:null,'include':_0x6b36ee[_0x8dd3('0xc')]?_0x6b36ee[_0x8dd3('0xc')]['include']?_[_0x8dd3('0x12')](_0x6b36ee['options']['include'],function(_0x450c49){return{'model':db[_0x450c49[_0x8dd3('0x11')]],'as':_0x450c49['as'],'attributes':_0x450c49[_0x8dd3('0xe')],'include':_0x450c49['include']?_[_0x8dd3('0x12')](_0x450c49[_0x8dd3('0x10')],function(_0x25b4b4){return{'model':db[_0x25b4b4[_0x8dd3('0x11')]],'as':_0x25b4b4['as'],'attributes':_0x25b4b4[_0x8dd3('0xe')],'include':_0x25b4b4[_0x8dd3('0x10')]?_[_0x8dd3('0x12')](_0x25b4b4[_0x8dd3('0x10')],function(_0x5942d0){return{'model':db[_0x5942d0[_0x8dd3('0x11')]],'as':_0x5942d0['as'],'attributes':_0x5942d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8dd3('0x19')](function(_0x4347c3){logger[_0x8dd3('0x13')](_0x8dd3('0x1a'),_0x6b36ee);logger[_0x8dd3('0x14')](_0x8dd3('0x1a'),_0x6b36ee,JSON[_0x8dd3('0x1b')](_0x4347c3));_0x28ab8c(_0x4347c3);})[_0x8dd3('0x15')](function(_0x11e23f){logger[_0x8dd3('0x16')](_0x8dd3('0x1a'),_0x11e23f['message'],_0x6b36ee);_0x130d01(_0x23b8c6[_0x8dd3('0x16')](0x1f4,_0x11e23f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9f93e19..50124f5 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 _0x4306=['./squareProject.events','remove','emit','removeListener','length'];(function(_0x4f6e3b,_0x179b8c){var _0x1073b2=function(_0x536c0a){while(--_0x536c0a){_0x4f6e3b['push'](_0x4f6e3b['shift']());}};_0x1073b2(++_0x179b8c);}(_0x4306,0x172));var _0x6430=function(_0x281be2,_0x5db43){_0x281be2=_0x281be2-0x0;var _0x59830a=_0x4306[_0x281be2];return _0x59830a;};'use strict';var SquareProjectEvents=require(_0x6430('0x0'));var events=['save',_0x6430('0x1'),'update'];function createListener(_0xf21284,_0x2266a9){return function(_0x1c4bc8){_0x2266a9[_0x6430('0x2')](_0xf21284,_0x1c4bc8);};}function removeListener(_0x503e75,_0x7bf85b){return function(){SquareProjectEvents[_0x6430('0x3')](_0x503e75,_0x7bf85b);};}exports['register']=function(_0x271c77){for(var _0x1105ae=0x0,_0x1e715b=events[_0x6430('0x4')];_0x1105ae<_0x1e715b;_0x1105ae++){var _0x4fa45a=events[_0x1105ae];var _0x2f452f=createListener('squareProject:'+_0x4fa45a,_0x271c77);SquareProjectEvents['on'](_0x4fa45a,_0x2f452f);}}; \ No newline at end of file +var _0xd3c2=['removeListener','register','squareProject:','save','remove','emit'];(function(_0x4a002e,_0x14a5f6){var _0xb86ae3=function(_0x10a189){while(--_0x10a189){_0x4a002e['push'](_0x4a002e['shift']());}};_0xb86ae3(++_0x14a5f6);}(_0xd3c2,0x183));var _0x2d3c=function(_0x36c712,_0x4cc6a0){_0x36c712=_0x36c712-0x0;var _0x59c77a=_0xd3c2[_0x36c712];return _0x59c77a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x2d3c('0x0'),_0x2d3c('0x1'),'update'];function createListener(_0x49939d,_0x3f6002){return function(_0x408ad9){_0x3f6002[_0x2d3c('0x2')](_0x49939d,_0x408ad9);};}function removeListener(_0x3a55e2,_0x3451d0){return function(){SquareProjectEvents[_0x2d3c('0x3')](_0x3a55e2,_0x3451d0);};}exports[_0x2d3c('0x4')]=function(_0x4e6cc6){for(var _0x4cef3a=0x0,_0x21a926=events['length'];_0x4cef3a<_0x21a926;_0x4cef3a++){var _0x4a8649=events[_0x4cef3a];var _0x2ef41e=createListener(_0x2d3c('0x5')+_0x4a8649,_0x4e6cc6);SquareProjectEvents['on'](_0x4a8649,_0x2ef41e);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 742da2c..36951cf 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 _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(_0x38683c,_0x1d522f){var _0x41a2b2=function(_0x47b0a4){while(--_0x47b0a4){_0x38683c['push'](_0x38683c['shift']());}};_0x41a2b2(++_0x1d522f);}(_0x53ec,0x192));var _0xc53e=function(_0x46800d,_0x588500){_0x46800d=_0x46800d-0x0;var _0x3824cd=_0x53ec[_0x46800d];return _0x3824cd;};'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 +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2a44a9,_0x4985a3){var _0x257b8e=function(_0x10ffb3){while(--_0x10ffb3){_0x2a44a9['push'](_0x2a44a9['shift']());}};_0x257b8e(++_0x4985a3);}(_0x4975,0x86));var _0x5497=function(_0x1d6904,_0x4ca73e){_0x1d6904=_0x1d6904-0x0;var _0x4630ac=_0x4975[_0x1d6904];return _0x4630ac;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 694bca0..11213e3 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 _0xae24=['VIRTUAL','savePath','sequelize','STRING'];(function(_0x51add7,_0x449f37){var _0x35a81e=function(_0xbf9e04){while(--_0xbf9e04){_0x51add7['push'](_0x51add7['shift']());}};_0x35a81e(++_0x449f37);}(_0xae24,0x182));var _0x4ae2=function(_0x4d6b0a,_0x102a14){_0x4d6b0a=_0x4d6b0a-0x0;var _0x44adac=_0xae24[_0x4d6b0a];return _0x44adac;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4ae2('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4ae2('0x1')]},'context':{'type':Sequelize[_0x4ae2('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ae2('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x4ae2('0x1')]},'saveName':{'type':Sequelize[_0x4ae2('0x1')]},'filename':{'type':Sequelize[_0x4ae2('0x1')]},'savePath':{'type':Sequelize[_0x4ae2('0x1')]},'format':{'type':Sequelize[_0x4ae2('0x2')],'get':function(){var _0x307247='';var _0x4f2e84=this['getDataValue'](_0x4ae2('0x3'));if(_0x4f2e84){_0x307247=_0x4f2e84['substring'](_0x4f2e84['lastIndexOf']('.'));}return _0x307247;}}}; \ No newline at end of file +var _0xed1f=['lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','substring'];(function(_0x1e24b1,_0x14ab30){var _0x212baf=function(_0x2bd3e9){while(--_0x2bd3e9){_0x1e24b1['push'](_0x1e24b1['shift']());}};_0x212baf(++_0x14ab30);}(_0xed1f,0x6a));var _0xfed1=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xed1f[_0x1477ef];return _0x164acd;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'callerid':{'type':Sequelize[_0xfed1('0x2')]},'calleridname':{'type':Sequelize[_0xfed1('0x2')]},'context':{'type':Sequelize[_0xfed1('0x2')]},'extension':{'type':Sequelize[_0xfed1('0x2')]},'priority':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize[_0xfed1('0x2')]},'dnid':{'type':Sequelize[_0xfed1('0x2')]},'projectName':{'type':Sequelize[_0xfed1('0x2')]},'saveName':{'type':Sequelize[_0xfed1('0x2')]},'filename':{'type':Sequelize[_0xfed1('0x2')]},'savePath':{'type':Sequelize[_0xfed1('0x2')]},'format':{'type':Sequelize[_0xfed1('0x3')],'get':function(){var _0x612b38='';var _0x2a6082=this[_0xfed1('0x4')]('savePath');if(_0x2a6082){_0x612b38=_0x2a6082[_0xfed1('0x5')](_0x2a6082[_0xfed1('0x6')]('.'));}return _0x612b38;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 085b61c..75d4b59 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 _0x146a=['format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','find','download','../../components/encryptor','uniqueid','savePath'];(function(_0x1f4c26,_0x1071f2){var _0x30a853=function(_0x3e3cac){while(--_0x3e3cac){_0x1f4c26['push'](_0x1f4c26['shift']());}};_0x30a853(++_0x1071f2);}(_0x146a,0x195));var _0xa146=function(_0x5a427c,_0x1c7b6f){_0x5a427c=_0x5a427c-0x0;var _0xc17e0d=_0x146a[_0x5a427c];return _0xc17e0d;};'use strict';var emlformat=require(_0xa146('0x0'));var rimraf=require(_0xa146('0x1'));var zipdir=require(_0xa146('0x2'));var jsonpatch=require(_0xa146('0x3'));var rp=require(_0xa146('0x4'));var moment=require('moment');var BPromise=require(_0xa146('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa146('0x6'));var sox=require(_0xa146('0x7'));var csv=require(_0xa146('0x8'));var ejs=require(_0xa146('0x9'));var fs=require('fs');var fs_extra=require(_0xa146('0xa'));var _=require('lodash');var squel=require(_0xa146('0xb'));var crypto=require(_0xa146('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa146('0x8'));var querystring=require(_0xa146('0xd'));var Papa=require(_0xa146('0xe'));var Redis=require(_0xa146('0xf'));var authService=require(_0xa146('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa146('0x11'));var logger=require('../../config/logger')(_0xa146('0x12'));var utils=require(_0xa146('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa146('0x14'));var db=require(_0xa146('0x15'))['db'];function respondWithStatusCode(_0x3273c7,_0xddf866){_0xddf866=_0xddf866||0xcc;return function(_0x4219de){if(_0x4219de){return _0x3273c7[_0xa146('0x16')](_0xddf866);}return _0x3273c7[_0xa146('0x17')](_0xddf866)[_0xa146('0x18')]();};}function respondWithResult(_0x221b41,_0x1fb931){_0x1fb931=_0x1fb931||0xc8;return function(_0x4716b9){if(_0x4716b9){return _0x221b41[_0xa146('0x17')](_0x1fb931)[_0xa146('0x19')](_0x4716b9);}};}function respondWithFilteredResult(_0x1ca248,_0x3cf623){return function(_0x29c86e){if(_0x29c86e){var _0x93f2d2=typeof _0x3cf623['offset']===_0xa146('0x1a')&&typeof _0x3cf623[_0xa146('0x1b')]==='undefined';var _0x272eee=_0x29c86e[_0xa146('0x1c')];var _0x534bec=_0x93f2d2?0x0:_0x3cf623[_0xa146('0x1d')];var _0x492cf7=_0x93f2d2?_0x29c86e['count']:_0x3cf623[_0xa146('0x1d')]+_0x3cf623[_0xa146('0x1b')];var _0x35ddfc;if(_0x492cf7>=_0x272eee){_0x492cf7=_0x272eee;_0x35ddfc=0xc8;}else{_0x35ddfc=0xce;}_0x1ca248[_0xa146('0x17')](_0x35ddfc);return _0x1ca248['set'](_0xa146('0x1e'),_0x534bec+'-'+_0x492cf7+'/'+_0x272eee)[_0xa146('0x19')](_0x29c86e);}return null;};}function patchUpdates(_0x111a16){return function(_0x8c4b03){try{jsonpatch[_0xa146('0x1f')](_0x8c4b03,_0x111a16,!![]);}catch(_0x1ba68a){return BPromise['reject'](_0x1ba68a);}return _0x8c4b03['save']();};}function saveUpdates(_0x8b4e3f,_0x2aa589){return function(_0x99b0b7){if(_0x99b0b7){return _0x99b0b7[_0xa146('0x20')](_0x8b4e3f)[_0xa146('0x21')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x114c5c,_0x191fc4){return function(_0x113f27){if(_0x113f27){return _0x113f27[_0xa146('0x22')]()[_0xa146('0x21')](function(){_0x114c5c[_0xa146('0x17')](0xcc)[_0xa146('0x18')]();});}};}function handleEntityNotFound(_0x1d84e2,_0x3b3e04){return function(_0x1ed01c){if(!_0x1ed01c){_0x1d84e2['sendStatus'](0x194);}return _0x1ed01c;};}function handleError(_0xd2528b,_0x4af532){_0x4af532=_0x4af532||0x1f4;return function(_0x2fe115){logger[_0xa146('0x23')](_0x2fe115[_0xa146('0x24')]);if(_0x2fe115[_0xa146('0x25')]){delete _0x2fe115[_0xa146('0x25')];}_0xd2528b[_0xa146('0x17')](_0x4af532)[_0xa146('0x26')](_0x2fe115);};}exports[_0xa146('0x27')]=function(_0x40594e,_0x13ff97){var _0x4a2762={},_0xcaaee9={},_0x2e709c={'count':0x0,'rows':[]};var _0x39f066=_[_0xa146('0x28')](db[_0xa146('0x29')][_0xa146('0x2a')],function(_0x25c4c5){return{'name':_0x25c4c5[_0xa146('0x2b')],'type':_0x25c4c5['type'][_0xa146('0x2c')]};});_0xcaaee9['model']=_[_0xa146('0x28')](_0x39f066,'name');_0xcaaee9['query']=_[_0xa146('0x2d')](_0x40594e[_0xa146('0x2e')]);_0xcaaee9[_0xa146('0x2f')]=_[_0xa146('0x30')](_0xcaaee9['model'],_0xcaaee9['query']);_0x4a2762['attributes']=_[_0xa146('0x30')](_0xcaaee9[_0xa146('0x31')],qs[_0xa146('0x32')](_0x40594e['query'][_0xa146('0x32')]));_0x4a2762[_0xa146('0x33')]=_0x4a2762[_0xa146('0x33')][_0xa146('0x34')]?_0x4a2762[_0xa146('0x33')]:_0xcaaee9[_0xa146('0x31')];if(!_0x40594e[_0xa146('0x2e')]['hasOwnProperty'](_0xa146('0x35'))){_0x4a2762['limit']=qs[_0xa146('0x1b')](_0x40594e[_0xa146('0x2e')][_0xa146('0x1b')]);_0x4a2762[_0xa146('0x1d')]=qs['offset'](_0x40594e['query'][_0xa146('0x1d')]);}_0x4a2762['order']=qs[_0xa146('0x36')](_0x40594e[_0xa146('0x2e')][_0xa146('0x36')]);_0x4a2762['where']=qs[_0xa146('0x2f')](_[_0xa146('0x37')](_0x40594e[_0xa146('0x2e')],_0xcaaee9[_0xa146('0x2f')]),_0x39f066);if(_0x40594e['query'][_0xa146('0x38')]){_0x4a2762[_0xa146('0x39')]=_[_0xa146('0x3a')](_0x4a2762[_0xa146('0x39')],{'$or':_['map'](_0x39f066,function(_0x46e99d){if(_0x46e99d[_0xa146('0x3b')]!==_0xa146('0x3c')){var _0x1530f7={};_0x1530f7[_0x46e99d[_0xa146('0x25')]]={'$like':'%'+_0x40594e[_0xa146('0x2e')][_0xa146('0x38')]+'%'};return _0x1530f7;}})});}_0x4a2762=_['merge']({},_0x4a2762,_0x40594e[_0xa146('0x3d')]);var _0x22b458={'where':_0x4a2762['where']};return db[_0xa146('0x29')][_0xa146('0x1c')](_0x22b458)[_0xa146('0x21')](function(_0x357d28){_0x2e709c[_0xa146('0x1c')]=_0x357d28;if(_0x40594e[_0xa146('0x2e')][_0xa146('0x3e')]){_0x4a2762[_0xa146('0x3f')]=[{'all':!![]}];}return db['SquareRecording'][_0xa146('0x40')](_0x4a2762);})[_0xa146('0x21')](function(_0x5a83e){_0x2e709c['rows']=_0x5a83e;return _0x2e709c;})[_0xa146('0x21')](respondWithFilteredResult(_0x13ff97,_0x4a2762))['catch'](handleError(_0x13ff97,null));};exports[_0xa146('0x41')]=function(_0x39762c,_0x2c39e3){var _0x2e809f={'raw':!![],'where':{'id':_0x39762c[_0xa146('0x42')]['id']}},_0x38270d={};_0x38270d['model']=_[_0xa146('0x2d')](db[_0xa146('0x29')][_0xa146('0x2a')]);_0x38270d['query']=_[_0xa146('0x2d')](_0x39762c[_0xa146('0x2e')]);_0x38270d[_0xa146('0x2f')]=_[_0xa146('0x30')](_0x38270d[_0xa146('0x31')],_0x38270d[_0xa146('0x2e')]);_0x2e809f[_0xa146('0x33')]=_[_0xa146('0x30')](_0x38270d[_0xa146('0x31')],qs[_0xa146('0x32')](_0x39762c[_0xa146('0x2e')][_0xa146('0x32')]));_0x2e809f[_0xa146('0x33')]=_0x2e809f['attributes'][_0xa146('0x34')]?_0x2e809f[_0xa146('0x33')]:_0x38270d[_0xa146('0x31')];if(_0x39762c['query'][_0xa146('0x3e')]){_0x2e809f[_0xa146('0x3f')]=[{'all':!![]}];}_0x2e809f=_['merge']({},_0x2e809f,_0x39762c[_0xa146('0x3d')]);return db[_0xa146('0x29')]['find'](_0x2e809f)[_0xa146('0x21')](handleEntityNotFound(_0x2c39e3,null))['then'](respondWithResult(_0x2c39e3,null))[_0xa146('0x43')](handleError(_0x2c39e3,null));};exports[_0xa146('0x44')]=function(_0x55249d,_0x22a464){return db['SquareRecording'][_0xa146('0x44')](_0x55249d['body'],{})[_0xa146('0x21')](respondWithResult(_0x22a464,0xc9))[_0xa146('0x43')](handleError(_0x22a464,null));};exports['update']=function(_0x324c92,_0x4eedb7){if(_0x324c92['body']['id']){delete _0x324c92[_0xa146('0x45')]['id'];}return db[_0xa146('0x29')][_0xa146('0x46')]({'where':{'id':_0x324c92[_0xa146('0x42')]['id']}})['then'](handleEntityNotFound(_0x4eedb7,null))['then'](saveUpdates(_0x324c92['body'],null))['then'](respondWithResult(_0x4eedb7,null))[_0xa146('0x43')](handleError(_0x4eedb7,null));};exports[_0xa146('0x47')]=function(_0x3371c3,_0x18bdd5,_0x26dc17){var _0x5f28d0=require(_0xa146('0x48'));var _0x3959ff=![];var _0x15db47={};if(_0x3371c3[_0xa146('0x2e')][_0xa146('0x3b')]&&_0x3371c3['query']['type']===_0xa146('0x49')){_0x15db47['uniqueid']=_0x3371c3['params']['id'];}else{_0x15db47['id']=_0x3371c3[_0xa146('0x42')]['id'];}return db['SquareRecording'][_0xa146('0x46')]({'where':_0x15db47,'attributes':['id',_0xa146('0x4a'),'filename'],'raw':!![]})[_0xa146('0x21')](handleEntityNotFound(_0x18bdd5,null))[_0xa146('0x21')](function(_0xefd4ca){if(_0xefd4ca){var _0x3b2577=_0xefd4ca['savePath'];var _0x10b045=util[_0xa146('0x4b')](_0xa146('0x4c'),_0x3b2577);if(fs[_0xa146('0x4d')](_0x10b045)){_0x3959ff=!![];return _0x5f28d0[_0xa146('0x4e')](_0x10b045,_0x3b2577,config[_0xa146('0x4f')][_0xa146('0x50')])[_0xa146('0x21')](function(){return _0xefd4ca;});}return _0xefd4ca;}})['then'](function(_0x38736f){if(_0x38736f){var _0x493956=_0x38736f[_0xa146('0x4a')];if(!fs[_0xa146('0x4d')](_0x493956)){throw new db[(_0xa146('0x51'))]['ValidationError'](_0xa146('0x52'));}if(_0x38736f[_0xa146('0x53')]){return _0x18bdd5[_0xa146('0x47')](_0x493956,_0x38736f[_0xa146('0x53')]+path[_0xa146('0x54')](_0x493956),function(){if(_0x3959ff){fs[_0xa146('0x55')](_0x493956);}});}else{return _0x18bdd5[_0xa146('0x47')](_0x493956,function(_0x754ddf){if(_0x3959ff){fs[_0xa146('0x55')](_0x493956);}});}}})[_0xa146('0x43')](function(_0x122f00){if(_0x122f00[_0xa146('0x56')]===_0xa146('0x52')){_0x18bdd5['status'](0x194)[_0xa146('0x26')](_0xa146('0x57'));}else{return handleError(_0x18bdd5,null);}});};exports[_0xa146('0x22')]=function(_0x429230,_0x3f36d9){return db['SquareRecording'][_0xa146('0x46')]({'where':{'id':_0x429230[_0xa146('0x42')]['id']}})[_0xa146('0x21')](function(_0x464bf1){if(_[_0xa146('0x58')](_0x464bf1)){throw new ReferenceError(_0xa146('0x59'));}return _0x464bf1;})['then'](function(_0x12a4d8){var _0x26ebaa=_0x12a4d8[_0xa146('0x4a')];logger[_0xa146('0x5a')](_0xa146('0x5b'),_0x26ebaa);if(!_[_0xa146('0x58')](_0x12a4d8['savePath'])&&fs[_0xa146('0x4d')](_0x26ebaa)){logger['info'](_0xa146('0x5c')+_0x26ebaa+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa146('0x5d')](_0x26ebaa);}_0x26ebaa=_0x26ebaa+_0xa146('0x5e');if(!_['isNil'](_0x12a4d8[_0xa146('0x4a')])&&fs[_0xa146('0x4d')](_0x26ebaa)){logger[_0xa146('0x5a')](_0xa146('0x5c')+_0x26ebaa+_0xa146('0x5f'));fs[_0xa146('0x5d')](_0x26ebaa);}return _0x12a4d8;})['then'](function(_0x2aefe2){if(!_0x2aefe2)throw new InternalError();return _0x2aefe2[_0xa146('0x22')]();})['then'](function(){_0x3f36d9[_0xa146('0x17')](0xcc)[_0xa146('0x18')]();})[_0xa146('0x43')](handleError(_0x3f36d9,null));}; \ No newline at end of file +var _0x95af=['filter','options','findAll','show','params','SquareRecording','includeAll','include','find','catch','create','body','download','../../components/encryptor','type','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge'];(function(_0x305551,_0x868339){var _0x115ce2=function(_0x49265b){while(--_0x49265b){_0x305551['push'](_0x305551['shift']());}};_0x115ce2(++_0x868339);}(_0x95af,0x8b));var _0xf95a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x95af[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf95a('0x0'));var zipdir=require(_0xf95a('0x1'));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(_0xf95a('0x9'));var csv=require(_0xf95a('0xa'));var ejs=require(_0xf95a('0xb'));var fs=require('fs');var fs_extra=require(_0xf95a('0xc'));var _=require(_0xf95a('0xd'));var squel=require(_0xf95a('0xe'));var crypto=require(_0xf95a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf95a('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf95a('0x11'));var Papa=require(_0xf95a('0x12'));var Redis=require(_0xf95a('0x13'));var authService=require(_0xf95a('0x14'));var qs=require(_0xf95a('0x15'));var as=require(_0xf95a('0x16'));var hardwareService=require(_0xf95a('0x17'));var logger=require(_0xf95a('0x18'))(_0xf95a('0x19'));var utils=require(_0xf95a('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xf95a('0x1b'));var db=require(_0xf95a('0x1c'))['db'];function respondWithStatusCode(_0x36138f,_0x20812d){_0x20812d=_0x20812d||0xcc;return function(_0x425836){if(_0x425836){return _0x36138f[_0xf95a('0x1d')](_0x20812d);}return _0x36138f[_0xf95a('0x1e')](_0x20812d)[_0xf95a('0x1f')]();};}function respondWithResult(_0x213145,_0x14bb58){_0x14bb58=_0x14bb58||0xc8;return function(_0x391659){if(_0x391659){return _0x213145[_0xf95a('0x1e')](_0x14bb58)[_0xf95a('0x20')](_0x391659);}};}function respondWithFilteredResult(_0x281ca4,_0x3c94af){return function(_0x37be11){if(_0x37be11){var _0x1203db=typeof _0x3c94af['offset']===_0xf95a('0x21')&&typeof _0x3c94af[_0xf95a('0x22')]===_0xf95a('0x21');var _0x2bea3b=_0x37be11[_0xf95a('0x23')];var _0x4f4c71=_0x1203db?0x0:_0x3c94af[_0xf95a('0x24')];var _0x2b4d5c=_0x1203db?_0x37be11['count']:_0x3c94af['offset']+_0x3c94af[_0xf95a('0x22')];var _0xb5553e;if(_0x2b4d5c>=_0x2bea3b){_0x2b4d5c=_0x2bea3b;_0xb5553e=0xc8;}else{_0xb5553e=0xce;}_0x281ca4[_0xf95a('0x1e')](_0xb5553e);return _0x281ca4[_0xf95a('0x25')](_0xf95a('0x26'),_0x4f4c71+'-'+_0x2b4d5c+'/'+_0x2bea3b)[_0xf95a('0x20')](_0x37be11);}return null;};}function patchUpdates(_0x3706e1){return function(_0x42b051){try{jsonpatch['apply'](_0x42b051,_0x3706e1,!![]);}catch(_0x3a001c){return BPromise[_0xf95a('0x27')](_0x3a001c);}return _0x42b051[_0xf95a('0x28')]();};}function saveUpdates(_0x2b1df8,_0x18c65c){return function(_0x5053d7){if(_0x5053d7){return _0x5053d7[_0xf95a('0x29')](_0x2b1df8)[_0xf95a('0x2a')](function(_0x5619ac){return _0x5619ac;});}return null;};}function removeEntity(_0x3b4a10,_0xf406df){return function(_0x24e97e){if(_0x24e97e){return _0x24e97e[_0xf95a('0x2b')]()[_0xf95a('0x2a')](function(){_0x3b4a10[_0xf95a('0x1e')](0xcc)[_0xf95a('0x1f')]();});}};}function handleEntityNotFound(_0x5e642e,_0x17c6ec){return function(_0x481084){if(!_0x481084){_0x5e642e['sendStatus'](0x194);}return _0x481084;};}function handleError(_0x48f4d1,_0x10b16d){_0x10b16d=_0x10b16d||0x1f4;return function(_0x402eb8){logger[_0xf95a('0x2c')](_0x402eb8[_0xf95a('0x2d')]);if(_0x402eb8[_0xf95a('0x2e')]){delete _0x402eb8[_0xf95a('0x2e')];}_0x48f4d1[_0xf95a('0x1e')](_0x10b16d)[_0xf95a('0x2f')](_0x402eb8);};}exports[_0xf95a('0x30')]=function(_0x11b39b,_0x18b912){var _0x36547f={},_0x4fb9ce={},_0x3148e0={'count':0x0,'rows':[]};var _0x5b3e1a=_[_0xf95a('0x31')](db['SquareRecording'][_0xf95a('0x32')],function(_0xd8387d){return{'name':_0xd8387d[_0xf95a('0x33')],'type':_0xd8387d['type'][_0xf95a('0x34')]};});_0x4fb9ce[_0xf95a('0x35')]=_['map'](_0x5b3e1a,_0xf95a('0x2e'));_0x4fb9ce[_0xf95a('0x36')]=_[_0xf95a('0x37')](_0x11b39b[_0xf95a('0x36')]);_0x4fb9ce[_0xf95a('0x38')]=_[_0xf95a('0x39')](_0x4fb9ce[_0xf95a('0x35')],_0x4fb9ce[_0xf95a('0x36')]);_0x36547f[_0xf95a('0x3a')]=_['intersection'](_0x4fb9ce[_0xf95a('0x35')],qs['fields'](_0x11b39b[_0xf95a('0x36')][_0xf95a('0x3b')]));_0x36547f[_0xf95a('0x3a')]=_0x36547f['attributes'][_0xf95a('0x3c')]?_0x36547f[_0xf95a('0x3a')]:_0x4fb9ce[_0xf95a('0x35')];if(!_0x11b39b['query'][_0xf95a('0x3d')](_0xf95a('0x3e'))){_0x36547f['limit']=qs['limit'](_0x11b39b[_0xf95a('0x36')][_0xf95a('0x22')]);_0x36547f[_0xf95a('0x24')]=qs[_0xf95a('0x24')](_0x11b39b[_0xf95a('0x36')][_0xf95a('0x24')]);}_0x36547f['order']=qs['sort'](_0x11b39b[_0xf95a('0x36')][_0xf95a('0x3f')]);_0x36547f[_0xf95a('0x40')]=qs['filters'](_[_0xf95a('0x41')](_0x11b39b[_0xf95a('0x36')],_0x4fb9ce[_0xf95a('0x38')]),_0x5b3e1a);if(_0x11b39b[_0xf95a('0x36')]['filter']){_0x36547f[_0xf95a('0x40')]=_[_0xf95a('0x42')](_0x36547f[_0xf95a('0x40')],{'$or':_[_0xf95a('0x31')](_0x5b3e1a,function(_0x34a22f){if(_0x34a22f['type']!=='VIRTUAL'){var _0x4726bc={};_0x4726bc[_0x34a22f[_0xf95a('0x2e')]]={'$like':'%'+_0x11b39b[_0xf95a('0x36')][_0xf95a('0x43')]+'%'};return _0x4726bc;}})});}_0x36547f=_['merge']({},_0x36547f,_0x11b39b[_0xf95a('0x44')]);var _0x3f424e={'where':_0x36547f[_0xf95a('0x40')]};return db['SquareRecording'][_0xf95a('0x23')](_0x3f424e)[_0xf95a('0x2a')](function(_0x53638b){_0x3148e0[_0xf95a('0x23')]=_0x53638b;if(_0x11b39b[_0xf95a('0x36')]['includeAll']){_0x36547f['include']=[{'all':!![]}];}return db['SquareRecording'][_0xf95a('0x45')](_0x36547f);})[_0xf95a('0x2a')](function(_0x68f5f){_0x3148e0['rows']=_0x68f5f;return _0x3148e0;})[_0xf95a('0x2a')](respondWithFilteredResult(_0x18b912,_0x36547f))['catch'](handleError(_0x18b912,null));};exports[_0xf95a('0x46')]=function(_0x418efc,_0x31cee3){var _0x5e81d4={'raw':!![],'where':{'id':_0x418efc[_0xf95a('0x47')]['id']}},_0x1e9871={};_0x1e9871['model']=_['keys'](db[_0xf95a('0x48')][_0xf95a('0x32')]);_0x1e9871[_0xf95a('0x36')]=_[_0xf95a('0x37')](_0x418efc[_0xf95a('0x36')]);_0x1e9871[_0xf95a('0x38')]=_['intersection'](_0x1e9871['model'],_0x1e9871[_0xf95a('0x36')]);_0x5e81d4[_0xf95a('0x3a')]=_[_0xf95a('0x39')](_0x1e9871['model'],qs[_0xf95a('0x3b')](_0x418efc['query'][_0xf95a('0x3b')]));_0x5e81d4['attributes']=_0x5e81d4['attributes'][_0xf95a('0x3c')]?_0x5e81d4[_0xf95a('0x3a')]:_0x1e9871[_0xf95a('0x35')];if(_0x418efc[_0xf95a('0x36')][_0xf95a('0x49')]){_0x5e81d4[_0xf95a('0x4a')]=[{'all':!![]}];}_0x5e81d4=_['merge']({},_0x5e81d4,_0x418efc[_0xf95a('0x44')]);return db[_0xf95a('0x48')][_0xf95a('0x4b')](_0x5e81d4)[_0xf95a('0x2a')](handleEntityNotFound(_0x31cee3,null))['then'](respondWithResult(_0x31cee3,null))[_0xf95a('0x4c')](handleError(_0x31cee3,null));};exports['create']=function(_0x517b3a,_0x57d64a){return db[_0xf95a('0x48')][_0xf95a('0x4d')](_0x517b3a[_0xf95a('0x4e')],{})[_0xf95a('0x2a')](respondWithResult(_0x57d64a,0xc9))['catch'](handleError(_0x57d64a,null));};exports[_0xf95a('0x29')]=function(_0x2875d8,_0x3c30fe){if(_0x2875d8[_0xf95a('0x4e')]['id']){delete _0x2875d8['body']['id'];}return db[_0xf95a('0x48')][_0xf95a('0x4b')]({'where':{'id':_0x2875d8[_0xf95a('0x47')]['id']}})[_0xf95a('0x2a')](handleEntityNotFound(_0x3c30fe,null))['then'](saveUpdates(_0x2875d8['body'],null))[_0xf95a('0x2a')](respondWithResult(_0x3c30fe,null))[_0xf95a('0x4c')](handleError(_0x3c30fe,null));};exports[_0xf95a('0x4f')]=function(_0x456739,_0x4f1cc9,_0x349d75){var _0x502bed=require(_0xf95a('0x50'));var _0x5d908a=![];var _0x121001={};if(_0x456739[_0xf95a('0x36')][_0xf95a('0x51')]&&_0x456739[_0xf95a('0x36')][_0xf95a('0x51')]===_0xf95a('0x52')){_0x121001[_0xf95a('0x52')]=_0x456739[_0xf95a('0x47')]['id'];}else{_0x121001['id']=_0x456739[_0xf95a('0x47')]['id'];}return db['SquareRecording'][_0xf95a('0x4b')]({'where':_0x121001,'attributes':['id','savePath',_0xf95a('0x53')],'raw':!![]})[_0xf95a('0x2a')](handleEntityNotFound(_0x4f1cc9,null))[_0xf95a('0x2a')](function(_0x2f17c5){if(_0x2f17c5){var _0x567c46=_0x2f17c5[_0xf95a('0x54')];var _0x68624a=util[_0xf95a('0x55')](_0xf95a('0x56'),_0x567c46);if(fs[_0xf95a('0x57')](_0x68624a)){_0x5d908a=!![];return _0x502bed[_0xf95a('0x58')](_0x68624a,_0x567c46,config[_0xf95a('0x59')][_0xf95a('0x5a')])[_0xf95a('0x2a')](function(){return _0x2f17c5;});}return _0x2f17c5;}})[_0xf95a('0x2a')](function(_0x4a2ceb){if(_0x4a2ceb){var _0x87058d=_0x4a2ceb[_0xf95a('0x54')];if(!fs['existsSync'](_0x87058d)){throw new db[(_0xf95a('0x5b'))][(_0xf95a('0x5c'))](_0xf95a('0x5d'));}if(_0x4a2ceb[_0xf95a('0x53')]){return _0x4f1cc9[_0xf95a('0x4f')](_0x87058d,_0x4a2ceb[_0xf95a('0x53')]+path[_0xf95a('0x5e')](_0x87058d),function(){if(_0x5d908a){fs[_0xf95a('0x5f')](_0x87058d);}});}else{return _0x4f1cc9[_0xf95a('0x4f')](_0x87058d,function(_0x3a1a6d){if(_0x5d908a){fs['unlink'](_0x87058d);}});}}})['catch'](function(_0x48be10){if(_0x48be10['message']===_0xf95a('0x5d')){_0x4f1cc9[_0xf95a('0x1e')](0x194)['send']('Not\x20found');}else{return handleError(_0x4f1cc9,null);}});};exports[_0xf95a('0x2b')]=function(_0x23be00,_0x111949){return db[_0xf95a('0x48')]['find']({'where':{'id':_0x23be00[_0xf95a('0x47')]['id']}})[_0xf95a('0x2a')](function(_0x1b6810){if(_[_0xf95a('0x60')](_0x1b6810)){throw new ReferenceError(_0xf95a('0x61'));}return _0x1b6810;})[_0xf95a('0x2a')](function(_0x594a10){var _0x534529=_0x594a10[_0xf95a('0x54')];logger[_0xf95a('0x62')](_0xf95a('0x63'),_0x534529);if(!_['isNil'](_0x594a10['savePath'])&&fs[_0xf95a('0x57')](_0x534529)){logger[_0xf95a('0x62')](_0xf95a('0x64')+_0x534529+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf95a('0x65')](_0x534529);}_0x534529=_0x534529+'.cypher';if(!_[_0xf95a('0x60')](_0x594a10[_0xf95a('0x54')])&&fs['existsSync'](_0x534529)){logger[_0xf95a('0x62')](_0xf95a('0x64')+_0x534529+_0xf95a('0x66'));fs[_0xf95a('0x65')](_0x534529);}return _0x594a10;})['then'](function(_0x3dbffd){if(!_0x3dbffd)throw new InternalError();return _0x3dbffd[_0xf95a('0x2b')]();})['then'](function(){_0x111949[_0xf95a('0x1e')](0xcc)['end']();})[_0xf95a('0x4c')](handleError(_0x111949,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index dd60f7c..75b81e0 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 _0xbb61=['rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x437545,_0x4ab48b){var _0x408060=function(_0x564586){while(--_0x564586){_0x437545['push'](_0x437545['shift']());}};_0x408060(++_0x4ab48b);}(_0xbb61,0x131));var _0x1bb6=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xbb61[_0x270adf];return _0x29eda9;};'use strict';var _=require(_0x1bb6('0x0'));var util=require('util');var logger=require(_0x1bb6('0x1'))(_0x1bb6('0x2'));var moment=require(_0x1bb6('0x3'));var BPromise=require(_0x1bb6('0x4'));var rp=require(_0x1bb6('0x5'));var fs=require('fs');var path=require(_0x1bb6('0x6'));var rimraf=require(_0x1bb6('0x7'));var config=require('../../config/environment');var attributes=require(_0x1bb6('0x8'));module[_0x1bb6('0x9')]=function(_0x2d59c2,_0x4e4b01){return _0x2d59c2[_0x1bb6('0xa')](_0x1bb6('0xb'),attributes,{'tableName':_0x1bb6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9ce=['square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0x14cba0,_0x1db963){var _0x4da603=function(_0x375b5b){while(--_0x375b5b){_0x14cba0['push'](_0x14cba0['shift']());}};_0x4da603(++_0x1db963);}(_0xd9ce,0xeb));var _0xed9c=function(_0x1097d7,_0x1bf6df){_0x1097d7=_0x1097d7-0x0;var _0x140177=_0xd9ce[_0x1097d7];return _0x140177;};'use strict';var _=require(_0xed9c('0x0'));var util=require(_0xed9c('0x1'));var logger=require(_0xed9c('0x2'))(_0xed9c('0x3'));var moment=require(_0xed9c('0x4'));var BPromise=require(_0xed9c('0x5'));var rp=require(_0xed9c('0x6'));var fs=require('fs');var path=require(_0xed9c('0x7'));var rimraf=require('rimraf');var config=require(_0xed9c('0x8'));var attributes=require(_0xed9c('0x9'));module[_0xed9c('0xa')]=function(_0x154e9d,_0x3043a6){return _0x154e9d[_0xed9c('0xb')]('SquareRecording',attributes,{'tableName':_0xed9c('0xc'),'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 038a7f9..9cdb7ba 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 _0x9334=['result','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','stringify','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x5c496d,_0x46795c){var _0x230b83=function(_0x4e1040){while(--_0x4e1040){_0x5c496d['push'](_0x5c496d['shift']());}};_0x230b83(++_0x46795c);}(_0x9334,0xd1));var _0x4933=function(_0xeb36e4,_0x2faa0c){_0xeb36e4=_0xeb36e4-0x0;var _0x5233b1=_0x9334[_0xeb36e4];return _0x5233b1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4933('0x0'));var BPromise=require('bluebird');var rs=require(_0x4933('0x1'));var fs=require('fs');var Redis=require(_0x4933('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4933('0x3'))(_0x4933('0x4'));var config=require(_0x4933('0x5'));var jayson=require(_0x4933('0x6'));var client=jayson['client'][_0x4933('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd5bc6,_0x3d6500,_0x6ff0b8){return new BPromise(function(_0x42b495,_0x45f284){return client[_0x4933('0x8')](_0xd5bc6,_0x6ff0b8)[_0x4933('0x9')](function(_0x1b1cbc){logger[_0x4933('0xa')](_0x4933('0xb'),_0x3d6500,_0x4933('0xc'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3d6500,'request\x20sent',JSON['stringify'](_0x1b1cbc));if(_0x1b1cbc[_0x4933('0xd')]){if(_0x1b1cbc[_0x4933('0xd')][_0x4933('0xe')]===0x1f4){logger[_0x4933('0xd')](_0x4933('0xb'),_0x3d6500,_0x1b1cbc[_0x4933('0xd')]['message']);return _0x45f284(_0x1b1cbc[_0x4933('0xd')]['message']);}logger[_0x4933('0xd')](_0x4933('0xb'),_0x3d6500,_0x1b1cbc[_0x4933('0xd')][_0x4933('0xf')]);return _0x42b495(_0x1b1cbc[_0x4933('0xd')][_0x4933('0xf')]);}else{logger[_0x4933('0xa')](_0x4933('0xb'),_0x3d6500,_0x4933('0xc'));_0x42b495(_0x1b1cbc[_0x4933('0x10')][_0x4933('0xf')]);}})['catch'](function(_0x2aa2d5){logger['error'](_0x4933('0xb'),_0x3d6500,_0x2aa2d5);_0x45f284(_0x2aa2d5);});});}exports[_0x4933('0x11')]=function(_0x5ccf87){var _0x4c05b8=this;return new Promise(function(_0x264553,_0x2b24e3){return db[_0x4933('0x12')][_0x4933('0x13')](_0x5ccf87[_0x4933('0x14')],{'raw':_0x5ccf87['options']?_0x5ccf87[_0x4933('0x15')][_0x4933('0x16')]===undefined?!![]:![]:!![]})[_0x4933('0x9')](function(_0x42865f){logger['info'](_0x4933('0x11'),_0x5ccf87);logger[_0x4933('0x17')](_0x4933('0x11'),_0x5ccf87,JSON[_0x4933('0x18')](_0x42865f));_0x264553(_0x42865f);})['catch'](function(_0x3eb0bb){logger[_0x4933('0xd')](_0x4933('0x11'),_0x3eb0bb[_0x4933('0xf')],_0x5ccf87);_0x2b24e3(_0x4c05b8[_0x4933('0xd')](0x1f4,_0x3eb0bb['message']));});});}; \ No newline at end of file +var _0x9ae3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','moment','bluebird'];(function(_0x20e859,_0x68926d){var _0x23622d=function(_0x527ccf){while(--_0x527ccf){_0x20e859['push'](_0x20e859['shift']());}};_0x23622d(++_0x68926d);}(_0x9ae3,0xf1));var _0x39ae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ae3[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x39ae('0x0'));var BPromise=require(_0x39ae('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39ae('0x2'));var db=require(_0x39ae('0x3'))['db'];var utils=require(_0x39ae('0x4'));var logger=require(_0x39ae('0x5'))('rpc');var config=require(_0x39ae('0x6'));var jayson=require(_0x39ae('0x7'));var client=jayson[_0x39ae('0x8')][_0x39ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b4538,_0x264f14,_0x504fbd){return new BPromise(function(_0x2e7196,_0x224521){return client[_0x39ae('0xa')](_0x4b4538,_0x504fbd)[_0x39ae('0xb')](function(_0xf2d7cc){logger[_0x39ae('0xc')](_0x39ae('0xd'),_0x264f14,_0x39ae('0xe'));logger[_0x39ae('0xf')](_0x39ae('0x10'),_0x264f14,_0x39ae('0xe'),JSON[_0x39ae('0x11')](_0xf2d7cc));if(_0xf2d7cc['error']){if(_0xf2d7cc['error']['code']===0x1f4){logger[_0x39ae('0x12')](_0x39ae('0xd'),_0x264f14,_0xf2d7cc[_0x39ae('0x12')][_0x39ae('0x13')]);return _0x224521(_0xf2d7cc[_0x39ae('0x12')][_0x39ae('0x13')]);}logger[_0x39ae('0x12')]('SquareRecording,\x20%s,\x20%s',_0x264f14,_0xf2d7cc['error'][_0x39ae('0x13')]);return _0x2e7196(_0xf2d7cc[_0x39ae('0x12')][_0x39ae('0x13')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x264f14,_0x39ae('0xe'));_0x2e7196(_0xf2d7cc['result'][_0x39ae('0x13')]);}})[_0x39ae('0x14')](function(_0x146abe){logger[_0x39ae('0x12')](_0x39ae('0xd'),_0x264f14,_0x146abe);_0x224521(_0x146abe);});});}exports[_0x39ae('0x15')]=function(_0x2c5103){var _0x114be4=this;return new Promise(function(_0x42d426,_0x59ab1d){return db[_0x39ae('0x16')][_0x39ae('0x17')](_0x2c5103[_0x39ae('0x18')],{'raw':_0x2c5103[_0x39ae('0x19')]?_0x2c5103[_0x39ae('0x19')][_0x39ae('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x584ff8){logger[_0x39ae('0xc')](_0x39ae('0x15'),_0x2c5103);logger[_0x39ae('0xf')](_0x39ae('0x15'),_0x2c5103,JSON[_0x39ae('0x11')](_0x584ff8));_0x42d426(_0x584ff8);})[_0x39ae('0x14')](function(_0xb27655){logger[_0x39ae('0x12')]('CreateSquareRecording',_0xb27655['message'],_0x2c5103);_0x59ab1d(_0x114be4['error'](0x1f4,_0xb27655[_0x39ae('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 72c7f36..520f4b5 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(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_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('./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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a740a40..678a6bc 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 _0x5a4d=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x2da33e,_0x4c3d69){var _0xee9d45=function(_0x2da6d1){while(--_0x2da6d1){_0x2da33e['push'](_0x2da33e['shift']());}};_0xee9d45(++_0x4c3d69);}(_0x5a4d,0x1c2));var _0xd5a4=function(_0x68b568,_0x1a04e8){_0x68b568=_0x68b568-0x0;var _0xdc8cc4=_0x5a4d[_0x68b568];return _0xdc8cc4;};'use strict';var Sequelize=require(_0xd5a4('0x0'));module[_0xd5a4('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xd5a4('0x2')]},'request':{'type':Sequelize[_0xd5a4('0x2')]},'channel':{'type':Sequelize[_0xd5a4('0x2')]},'language':{'type':Sequelize[_0xd5a4('0x2')]},'type':{'type':Sequelize[_0xd5a4('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd5a4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xd5a4('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xd5a4('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xd5a4('0x2')]},'context':{'type':Sequelize[_0xd5a4('0x2')]},'extension':{'type':Sequelize[_0xd5a4('0x2')]},'priority':{'type':Sequelize[_0xd5a4('0x2')]},'enhanced':{'type':Sequelize[_0xd5a4('0x2')]},'accountcode':{'type':Sequelize[_0xd5a4('0x2')]},'threadid':{'type':Sequelize[_0xd5a4('0x2')]},'project_name':{'type':Sequelize[_0xd5a4('0x2')]},'joinAt':{'type':Sequelize[_0xd5a4('0x3')]},'leaveAt':{'type':Sequelize[_0xd5a4('0x3')]},'bot':{'type':Sequelize[_0xd5a4('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3183=['BOOLEAN','STRING','DATE'];(function(_0x244dd0,_0x2b2073){var _0x5f123e=function(_0x303249){while(--_0x303249){_0x244dd0['push'](_0x244dd0['shift']());}};_0x5f123e(++_0x2b2073);}(_0x3183,0x10f));var _0x3318=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3183[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x3318('0x0')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3318('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3318('0x0')]},'uniqueid':{'type':Sequelize[_0x3318('0x0')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x3318('0x0')]},'calleridname':{'type':Sequelize[_0x3318('0x0')]},'callingpres':{'type':Sequelize[_0x3318('0x0')]},'callingani2':{'type':Sequelize[_0x3318('0x0')]},'callington':{'type':Sequelize[_0x3318('0x0')]},'callingtns':{'type':Sequelize[_0x3318('0x0')]},'dnid':{'type':Sequelize[_0x3318('0x0')]},'rdnis':{'type':Sequelize[_0x3318('0x0')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3318('0x0')]},'priority':{'type':Sequelize[_0x3318('0x0')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3318('0x0')]},'threadid':{'type':Sequelize[_0x3318('0x0')]},'project_name':{'type':Sequelize[_0x3318('0x0')]},'joinAt':{'type':Sequelize[_0x3318('0x1')]},'leaveAt':{'type':Sequelize[_0x3318('0x1')]},'bot':{'type':Sequelize[_0x3318('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index d7ce33b..01e519a 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 _0x00d4=['params','keys','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','SquareReport','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','filter','where','map','merge','includeAll','include','rows','show'];(function(_0x1ad119,_0x5bcfac){var _0xe6b725=function(_0x2ca853){while(--_0x2ca853){_0x1ad119['push'](_0x1ad119['shift']());}};_0xe6b725(++_0x5bcfac);}(_0x00d4,0x161));var _0x400d=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x00d4[_0x19b3f9];return _0x18c3f6;};'use strict';var emlformat=require(_0x400d('0x0'));var rimraf=require(_0x400d('0x1'));var zipdir=require(_0x400d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x400d('0x3'));var moment=require(_0x400d('0x4'));var BPromise=require(_0x400d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x400d('0x6'));var sox=require(_0x400d('0x7'));var csv=require(_0x400d('0x8'));var ejs=require(_0x400d('0x9'));var fs=require('fs');var fs_extra=require(_0x400d('0xa'));var _=require('lodash');var squel=require(_0x400d('0xb'));var crypto=require('crypto');var jsforce=require(_0x400d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x400d('0x8'));var querystring=require('querystring');var Papa=require(_0x400d('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x400d('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x400d('0xf'))(_0x400d('0x10'));var utils=require(_0x400d('0x11'));var config=require(_0x400d('0x12'));var licenseUtil=require(_0x400d('0x13'));var db=require(_0x400d('0x14'))['db'];function respondWithStatusCode(_0xa92cf0,_0x2c5260){_0x2c5260=_0x2c5260||0xcc;return function(_0x59db86){if(_0x59db86){return _0xa92cf0[_0x400d('0x15')](_0x2c5260);}return _0xa92cf0[_0x400d('0x16')](_0x2c5260)[_0x400d('0x17')]();};}function respondWithResult(_0x3b21c6,_0x5d6fee){_0x5d6fee=_0x5d6fee||0xc8;return function(_0xb4a131){if(_0xb4a131){return _0x3b21c6[_0x400d('0x16')](_0x5d6fee)[_0x400d('0x18')](_0xb4a131);}};}function respondWithFilteredResult(_0x57b20e,_0x5cb006){return function(_0x420e97){if(_0x420e97){var _0x29b40b=typeof _0x5cb006[_0x400d('0x19')]==='undefined'&&typeof _0x5cb006[_0x400d('0x1a')]===_0x400d('0x1b');var _0x46cde3=_0x420e97[_0x400d('0x1c')];var _0x3305ed=_0x29b40b?0x0:_0x5cb006[_0x400d('0x19')];var _0x30d145=_0x29b40b?_0x420e97[_0x400d('0x1c')]:_0x5cb006['offset']+_0x5cb006['limit'];var _0xa60483;if(_0x30d145>=_0x46cde3){_0x30d145=_0x46cde3;_0xa60483=0xc8;}else{_0xa60483=0xce;}_0x57b20e[_0x400d('0x16')](_0xa60483);return _0x57b20e[_0x400d('0x1d')](_0x400d('0x1e'),_0x3305ed+'-'+_0x30d145+'/'+_0x46cde3)[_0x400d('0x18')](_0x420e97);}return null;};}function patchUpdates(_0x13a971){return function(_0xe72e61){try{jsonpatch[_0x400d('0x1f')](_0xe72e61,_0x13a971,!![]);}catch(_0x431303){return BPromise[_0x400d('0x20')](_0x431303);}return _0xe72e61[_0x400d('0x21')]();};}function saveUpdates(_0xf50632,_0x462e07){return function(_0x3700c1){if(_0x3700c1){return _0x3700c1[_0x400d('0x22')](_0xf50632)[_0x400d('0x23')](function(_0x30db3e){return _0x30db3e;});}return null;};}function removeEntity(_0x3723ac,_0x4409bf){return function(_0x16ea02){if(_0x16ea02){return _0x16ea02[_0x400d('0x24')]()[_0x400d('0x23')](function(){_0x3723ac[_0x400d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14c2d0,_0x388b99){return function(_0xd2a347){if(!_0xd2a347){_0x14c2d0[_0x400d('0x15')](0x194);}return _0xd2a347;};}function handleError(_0xf524,_0x11316e){_0x11316e=_0x11316e||0x1f4;return function(_0x3fdc70){logger[_0x400d('0x25')](_0x3fdc70[_0x400d('0x26')]);if(_0x3fdc70[_0x400d('0x27')]){delete _0x3fdc70[_0x400d('0x27')];}_0xf524[_0x400d('0x16')](_0x11316e)['send'](_0x3fdc70);};}exports[_0x400d('0x28')]=function(_0x17ef97,_0x24626d){var _0x39b5fa={},_0x44536d={},_0x2b2834={'count':0x0,'rows':[]};var _0x4e41f2=_['map'](db[_0x400d('0x29')][_0x400d('0x2a')],function(_0x2b32ee){return{'name':_0x2b32ee[_0x400d('0x2b')],'type':_0x2b32ee['type']['key']};});_0x44536d['model']=_['map'](_0x4e41f2,'name');_0x44536d[_0x400d('0x2c')]=_['keys'](_0x17ef97[_0x400d('0x2c')]);_0x44536d[_0x400d('0x2d')]=_[_0x400d('0x2e')](_0x44536d[_0x400d('0x2f')],_0x44536d[_0x400d('0x2c')]);_0x39b5fa[_0x400d('0x30')]=_[_0x400d('0x2e')](_0x44536d[_0x400d('0x2f')],qs[_0x400d('0x31')](_0x17ef97['query'][_0x400d('0x31')]));_0x39b5fa[_0x400d('0x30')]=_0x39b5fa[_0x400d('0x30')]['length']?_0x39b5fa[_0x400d('0x30')]:_0x44536d[_0x400d('0x2f')];if(!_0x17ef97[_0x400d('0x2c')][_0x400d('0x32')]('nolimit')){_0x39b5fa['limit']=qs[_0x400d('0x1a')](_0x17ef97[_0x400d('0x2c')][_0x400d('0x1a')]);_0x39b5fa[_0x400d('0x19')]=qs[_0x400d('0x19')](_0x17ef97[_0x400d('0x2c')][_0x400d('0x19')]);}_0x39b5fa[_0x400d('0x33')]=qs[_0x400d('0x34')](_0x17ef97['query'][_0x400d('0x34')]);_0x39b5fa['where']=qs[_0x400d('0x2d')](_['pick'](_0x17ef97[_0x400d('0x2c')],_0x44536d[_0x400d('0x2d')]),_0x4e41f2);if(_0x17ef97[_0x400d('0x2c')][_0x400d('0x35')]){_0x39b5fa['where']=_['merge'](_0x39b5fa[_0x400d('0x36')],{'$or':_[_0x400d('0x37')](_0x4e41f2,function(_0x86c29d){if(_0x86c29d['type']!=='VIRTUAL'){var _0x289823={};_0x289823[_0x86c29d['name']]={'$like':'%'+_0x17ef97[_0x400d('0x2c')][_0x400d('0x35')]+'%'};return _0x289823;}})});}_0x39b5fa=_[_0x400d('0x38')]({},_0x39b5fa,_0x17ef97['options']);var _0xf148f8={'where':_0x39b5fa[_0x400d('0x36')]};return db[_0x400d('0x29')][_0x400d('0x1c')](_0xf148f8)['then'](function(_0x563dc7){_0x2b2834[_0x400d('0x1c')]=_0x563dc7;if(_0x17ef97[_0x400d('0x2c')][_0x400d('0x39')]){_0x39b5fa[_0x400d('0x3a')]=[{'all':!![]}];}return db[_0x400d('0x29')]['findAll'](_0x39b5fa);})[_0x400d('0x23')](function(_0x428b75){_0x2b2834[_0x400d('0x3b')]=_0x428b75;return _0x2b2834;})[_0x400d('0x23')](respondWithFilteredResult(_0x24626d,_0x39b5fa))['catch'](handleError(_0x24626d,null));};exports[_0x400d('0x3c')]=function(_0x101d84,_0x3c3181){var _0x480056={'raw':!![],'where':{'id':_0x101d84[_0x400d('0x3d')]['id']}},_0x56e2e4={};_0x56e2e4[_0x400d('0x2f')]=_[_0x400d('0x3e')](db[_0x400d('0x29')]['rawAttributes']);_0x56e2e4['query']=_[_0x400d('0x3e')](_0x101d84[_0x400d('0x2c')]);_0x56e2e4['filters']=_[_0x400d('0x2e')](_0x56e2e4['model'],_0x56e2e4[_0x400d('0x2c')]);_0x480056[_0x400d('0x30')]=_['intersection'](_0x56e2e4[_0x400d('0x2f')],qs[_0x400d('0x31')](_0x101d84['query'][_0x400d('0x31')]));_0x480056['attributes']=_0x480056[_0x400d('0x30')][_0x400d('0x3f')]?_0x480056[_0x400d('0x30')]:_0x56e2e4[_0x400d('0x2f')];if(_0x101d84[_0x400d('0x2c')][_0x400d('0x39')]){_0x480056['include']=[{'all':!![]}];}_0x480056=_[_0x400d('0x38')]({},_0x480056,_0x101d84['options']);return db[_0x400d('0x29')]['find'](_0x480056)[_0x400d('0x23')](handleEntityNotFound(_0x3c3181,null))[_0x400d('0x23')](respondWithResult(_0x3c3181,null))[_0x400d('0x40')](handleError(_0x3c3181,null));};exports[_0x400d('0x41')]=function(_0x39c1a3,_0x52115d){return db[_0x400d('0x29')][_0x400d('0x41')](_0x39c1a3[_0x400d('0x42')],{})[_0x400d('0x23')](respondWithResult(_0x52115d,0xc9))['catch'](handleError(_0x52115d,null));};exports[_0x400d('0x22')]=function(_0xec0163,_0x34a15a){if(_0xec0163[_0x400d('0x42')]['id']){delete _0xec0163['body']['id'];}return db['SquareReport'][_0x400d('0x43')]({'where':{'id':_0xec0163[_0x400d('0x3d')]['id']}})[_0x400d('0x23')](handleEntityNotFound(_0x34a15a,null))[_0x400d('0x23')](saveUpdates(_0xec0163['body'],null))[_0x400d('0x23')](respondWithResult(_0x34a15a,null))['catch'](handleError(_0x34a15a,null));};exports[_0x400d('0x24')]=function(_0x41c67a,_0x498a16){return db[_0x400d('0x29')]['find']({'where':{'id':_0x41c67a[_0x400d('0x3d')]['id']}})[_0x400d('0x23')](handleEntityNotFound(_0x498a16,null))[_0x400d('0x23')](removeEntity(_0x498a16,null))['catch'](handleError(_0x498a16,null));};exports[_0x400d('0x44')]=function(_0x347038,_0x239f23){return db['SquareReport'][_0x400d('0x44')]()[_0x400d('0x23')](respondWithResult(_0x239f23,null))['catch'](handleError(_0x239f23,null));}; \ No newline at end of file +var _0x4ae3=['findAll','rows','params','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ae3,0x179));var _0x34ae=function(_0x282320,_0x379ad6){_0x282320=_0x282320-0x0;var _0x271d54=_0x4ae3[_0x282320];return _0x271d54;};'use strict';var emlformat=require(_0x34ae('0x0'));var rimraf=require(_0x34ae('0x1'));var zipdir=require(_0x34ae('0x2'));var jsonpatch=require(_0x34ae('0x3'));var rp=require('request-promise');var moment=require(_0x34ae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x34ae('0x5'));var util=require('util');var path=require(_0x34ae('0x6'));var sox=require(_0x34ae('0x7'));var csv=require(_0x34ae('0x8'));var ejs=require(_0x34ae('0x9'));var fs=require('fs');var fs_extra=require(_0x34ae('0xa'));var _=require(_0x34ae('0xb'));var squel=require(_0x34ae('0xc'));var crypto=require('crypto');var jsforce=require(_0x34ae('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x34ae('0x8'));var querystring=require(_0x34ae('0xe'));var Papa=require('papaparse');var Redis=require(_0x34ae('0xf'));var authService=require(_0x34ae('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x34ae('0x11'))('api');var utils=require(_0x34ae('0x12'));var config=require(_0x34ae('0x13'));var licenseUtil=require(_0x34ae('0x14'));var db=require(_0x34ae('0x15'))['db'];function respondWithStatusCode(_0x1533aa,_0x122fcf){_0x122fcf=_0x122fcf||0xcc;return function(_0x168bbf){if(_0x168bbf){return _0x1533aa['sendStatus'](_0x122fcf);}return _0x1533aa[_0x34ae('0x16')](_0x122fcf)[_0x34ae('0x17')]();};}function respondWithResult(_0x194ef2,_0x51bff1){_0x51bff1=_0x51bff1||0xc8;return function(_0x53d3d6){if(_0x53d3d6){return _0x194ef2[_0x34ae('0x16')](_0x51bff1)[_0x34ae('0x18')](_0x53d3d6);}};}function respondWithFilteredResult(_0x231fed,_0xd370b1){return function(_0xde0b91){if(_0xde0b91){var _0x4bb676=typeof _0xd370b1[_0x34ae('0x19')]===_0x34ae('0x1a')&&typeof _0xd370b1[_0x34ae('0x1b')]===_0x34ae('0x1a');var _0x12e825=_0xde0b91[_0x34ae('0x1c')];var _0x119361=_0x4bb676?0x0:_0xd370b1[_0x34ae('0x19')];var _0xd115a9=_0x4bb676?_0xde0b91['count']:_0xd370b1[_0x34ae('0x19')]+_0xd370b1[_0x34ae('0x1b')];var _0x3accc3;if(_0xd115a9>=_0x12e825){_0xd115a9=_0x12e825;_0x3accc3=0xc8;}else{_0x3accc3=0xce;}_0x231fed['status'](_0x3accc3);return _0x231fed[_0x34ae('0x1d')](_0x34ae('0x1e'),_0x119361+'-'+_0xd115a9+'/'+_0x12e825)[_0x34ae('0x18')](_0xde0b91);}return null;};}function patchUpdates(_0x47f593){return function(_0x4777e9){try{jsonpatch[_0x34ae('0x1f')](_0x4777e9,_0x47f593,!![]);}catch(_0x113cc5){return BPromise[_0x34ae('0x20')](_0x113cc5);}return _0x4777e9[_0x34ae('0x21')]();};}function saveUpdates(_0x92a607,_0x1f6a7d){return function(_0x118e03){if(_0x118e03){return _0x118e03[_0x34ae('0x22')](_0x92a607)[_0x34ae('0x23')](function(_0x277360){return _0x277360;});}return null;};}function removeEntity(_0x1f0a14,_0x1a80a6){return function(_0x422723){if(_0x422723){return _0x422723[_0x34ae('0x24')]()[_0x34ae('0x23')](function(){_0x1f0a14[_0x34ae('0x16')](0xcc)[_0x34ae('0x17')]();});}};}function handleEntityNotFound(_0x3b1bbc,_0x3253cf){return function(_0x13b6fb){if(!_0x13b6fb){_0x3b1bbc['sendStatus'](0x194);}return _0x13b6fb;};}function handleError(_0x24b03e,_0x5653a9){_0x5653a9=_0x5653a9||0x1f4;return function(_0xa5161){logger[_0x34ae('0x25')](_0xa5161[_0x34ae('0x26')]);if(_0xa5161[_0x34ae('0x27')]){delete _0xa5161[_0x34ae('0x27')];}_0x24b03e['status'](_0x5653a9)[_0x34ae('0x28')](_0xa5161);};}exports[_0x34ae('0x29')]=function(_0x19a46d,_0x1e41d4){var _0x24a549={},_0x45c4a1={},_0x58dc85={'count':0x0,'rows':[]};var _0xb4a49c=_['map'](db[_0x34ae('0x2a')][_0x34ae('0x2b')],function(_0x57e8c7){return{'name':_0x57e8c7[_0x34ae('0x2c')],'type':_0x57e8c7[_0x34ae('0x2d')][_0x34ae('0x2e')]};});_0x45c4a1[_0x34ae('0x2f')]=_[_0x34ae('0x30')](_0xb4a49c,'name');_0x45c4a1[_0x34ae('0x31')]=_[_0x34ae('0x32')](_0x19a46d[_0x34ae('0x31')]);_0x45c4a1['filters']=_[_0x34ae('0x33')](_0x45c4a1[_0x34ae('0x2f')],_0x45c4a1['query']);_0x24a549[_0x34ae('0x34')]=_[_0x34ae('0x33')](_0x45c4a1['model'],qs[_0x34ae('0x35')](_0x19a46d[_0x34ae('0x31')][_0x34ae('0x35')]));_0x24a549[_0x34ae('0x34')]=_0x24a549[_0x34ae('0x34')][_0x34ae('0x36')]?_0x24a549['attributes']:_0x45c4a1[_0x34ae('0x2f')];if(!_0x19a46d[_0x34ae('0x31')][_0x34ae('0x37')]('nolimit')){_0x24a549[_0x34ae('0x1b')]=qs[_0x34ae('0x1b')](_0x19a46d[_0x34ae('0x31')]['limit']);_0x24a549['offset']=qs[_0x34ae('0x19')](_0x19a46d[_0x34ae('0x31')]['offset']);}_0x24a549[_0x34ae('0x38')]=qs[_0x34ae('0x39')](_0x19a46d[_0x34ae('0x31')][_0x34ae('0x39')]);_0x24a549[_0x34ae('0x3a')]=qs[_0x34ae('0x3b')](_[_0x34ae('0x3c')](_0x19a46d[_0x34ae('0x31')],_0x45c4a1[_0x34ae('0x3b')]),_0xb4a49c);if(_0x19a46d[_0x34ae('0x31')][_0x34ae('0x3d')]){_0x24a549[_0x34ae('0x3a')]=_['merge'](_0x24a549[_0x34ae('0x3a')],{'$or':_[_0x34ae('0x30')](_0xb4a49c,function(_0x1a255f){if(_0x1a255f[_0x34ae('0x2d')]!==_0x34ae('0x3e')){var _0x11eb36={};_0x11eb36[_0x1a255f[_0x34ae('0x27')]]={'$like':'%'+_0x19a46d[_0x34ae('0x31')][_0x34ae('0x3d')]+'%'};return _0x11eb36;}})});}_0x24a549=_[_0x34ae('0x3f')]({},_0x24a549,_0x19a46d[_0x34ae('0x40')]);var _0xf7a1ec={'where':_0x24a549['where']};return db[_0x34ae('0x2a')][_0x34ae('0x1c')](_0xf7a1ec)[_0x34ae('0x23')](function(_0x1743c7){_0x58dc85[_0x34ae('0x1c')]=_0x1743c7;if(_0x19a46d[_0x34ae('0x31')][_0x34ae('0x41')]){_0x24a549[_0x34ae('0x42')]=[{'all':!![]}];}return db[_0x34ae('0x2a')][_0x34ae('0x43')](_0x24a549);})['then'](function(_0x44d769){_0x58dc85[_0x34ae('0x44')]=_0x44d769;return _0x58dc85;})[_0x34ae('0x23')](respondWithFilteredResult(_0x1e41d4,_0x24a549))['catch'](handleError(_0x1e41d4,null));};exports['show']=function(_0x5374e9,_0xe240d2){var _0x1a397f={'raw':!![],'where':{'id':_0x5374e9[_0x34ae('0x45')]['id']}},_0x3774dc={};_0x3774dc[_0x34ae('0x2f')]=_[_0x34ae('0x32')](db[_0x34ae('0x2a')][_0x34ae('0x2b')]);_0x3774dc[_0x34ae('0x31')]=_[_0x34ae('0x32')](_0x5374e9['query']);_0x3774dc[_0x34ae('0x3b')]=_[_0x34ae('0x33')](_0x3774dc[_0x34ae('0x2f')],_0x3774dc[_0x34ae('0x31')]);_0x1a397f[_0x34ae('0x34')]=_[_0x34ae('0x33')](_0x3774dc[_0x34ae('0x2f')],qs[_0x34ae('0x35')](_0x5374e9['query'][_0x34ae('0x35')]));_0x1a397f['attributes']=_0x1a397f['attributes'][_0x34ae('0x36')]?_0x1a397f[_0x34ae('0x34')]:_0x3774dc[_0x34ae('0x2f')];if(_0x5374e9[_0x34ae('0x31')][_0x34ae('0x41')]){_0x1a397f[_0x34ae('0x42')]=[{'all':!![]}];}_0x1a397f=_[_0x34ae('0x3f')]({},_0x1a397f,_0x5374e9['options']);return db[_0x34ae('0x2a')]['find'](_0x1a397f)[_0x34ae('0x23')](handleEntityNotFound(_0xe240d2,null))[_0x34ae('0x23')](respondWithResult(_0xe240d2,null))[_0x34ae('0x46')](handleError(_0xe240d2,null));};exports['create']=function(_0x19db28,_0x517d8a){return db[_0x34ae('0x2a')]['create'](_0x19db28[_0x34ae('0x47')],{})['then'](respondWithResult(_0x517d8a,0xc9))[_0x34ae('0x46')](handleError(_0x517d8a,null));};exports[_0x34ae('0x22')]=function(_0xec00df,_0x591483){if(_0xec00df[_0x34ae('0x47')]['id']){delete _0xec00df[_0x34ae('0x47')]['id'];}return db[_0x34ae('0x2a')][_0x34ae('0x48')]({'where':{'id':_0xec00df['params']['id']}})[_0x34ae('0x23')](handleEntityNotFound(_0x591483,null))[_0x34ae('0x23')](saveUpdates(_0xec00df[_0x34ae('0x47')],null))[_0x34ae('0x23')](respondWithResult(_0x591483,null))[_0x34ae('0x46')](handleError(_0x591483,null));};exports['destroy']=function(_0x42d988,_0x3a384b){return db[_0x34ae('0x2a')][_0x34ae('0x48')]({'where':{'id':_0x42d988[_0x34ae('0x45')]['id']}})[_0x34ae('0x23')](handleEntityNotFound(_0x3a384b,null))['then'](removeEntity(_0x3a384b,null))['catch'](handleError(_0x3a384b,null));};exports['describe']=function(_0x4d4916,_0x73e214){return db[_0x34ae('0x2a')][_0x34ae('0x49')]()[_0x34ae('0x23')](respondWithResult(_0x73e214,null))['catch'](handleError(_0x73e214,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e82f550..470d416 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 _0xd2a4=['SquareReport','report_square','uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x155e84,_0x1ffffa){var _0x14a727=function(_0x378203){while(--_0x378203){_0x155e84['push'](_0x155e84['shift']());}};_0x14a727(++_0x1ffffa);}(_0xd2a4,0x164));var _0x4d2a=function(_0x3c698e,_0x56c906){_0x3c698e=_0x3c698e-0x0;var _0x2a779c=_0xd2a4[_0x3c698e];return _0x2a779c;};'use strict';var _=require(_0x4d2a('0x0'));var util=require(_0x4d2a('0x1'));var logger=require(_0x4d2a('0x2'))(_0x4d2a('0x3'));var moment=require(_0x4d2a('0x4'));var BPromise=require(_0x4d2a('0x5'));var rp=require(_0x4d2a('0x6'));var fs=require('fs');var path=require(_0x4d2a('0x7'));var rimraf=require(_0x4d2a('0x8'));var config=require(_0x4d2a('0x9'));var attributes=require('./squareReport.attributes');module[_0x4d2a('0xa')]=function(_0x5acc77,_0x4f984a){return _0x5acc77[_0x4d2a('0xb')](_0x4d2a('0xc'),attributes,{'tableName':_0x4d2a('0xd'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x4d2a('0xe'),'project_name']},{'name':_0x4d2a('0xf'),'fields':[_0x4d2a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x74cc=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','leaveAt'];(function(_0x26d906,_0x53c612){var _0x178b39=function(_0xbda359){while(--_0xbda359){_0x26d906['push'](_0x26d906['shift']());}};_0x178b39(++_0x53c612);}(_0x74cc,0x78));var _0xc74c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x74cc[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0xc74c('0x0'));var logger=require(_0xc74c('0x1'))(_0xc74c('0x2'));var moment=require(_0xc74c('0x3'));var BPromise=require(_0xc74c('0x4'));var rp=require(_0xc74c('0x5'));var fs=require('fs');var path=require(_0xc74c('0x6'));var rimraf=require('rimraf');var config=require(_0xc74c('0x7'));var attributes=require(_0xc74c('0x8'));module[_0xc74c('0x9')]=function(_0x155f51,_0x5deb66){return _0x155f51[_0xc74c('0xa')]('SquareReport',attributes,{'tableName':_0xc74c('0xb'),'paranoid':![],'indexes':[{'name':_0xc74c('0xc'),'fields':[_0xc74c('0xd'),'project_name']},{'name':_0xc74c('0xe'),'fields':[_0xc74c('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 c5ee8f9..03ef32a 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 _0x3452=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSquareReport','SquareReport','create','body','raw','UpdateSquareReport','update','options','where','limit'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x3452,0x10e));var _0x2345=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x3452[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x2345('0x0'));var moment=require(_0x2345('0x1'));var BPromise=require('bluebird');var rs=require(_0x2345('0x2'));var fs=require('fs');var Redis=require(_0x2345('0x3'));var db=require(_0x2345('0x4'))['db'];var utils=require(_0x2345('0x5'));var logger=require(_0x2345('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2345('0x7')][_0x2345('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b5bdb,_0x146445,_0x32316d){return new BPromise(function(_0x24bbbe,_0x13efd3){return client['request'](_0x4b5bdb,_0x32316d)[_0x2345('0x9')](function(_0x483d07){logger['info'](_0x2345('0xa'),_0x146445,_0x2345('0xb'));logger[_0x2345('0xc')](_0x2345('0xd'),_0x146445,_0x2345('0xb'),JSON[_0x2345('0xe')](_0x483d07));if(_0x483d07['error']){if(_0x483d07[_0x2345('0xf')]['code']===0x1f4){logger[_0x2345('0xf')](_0x2345('0xa'),_0x146445,_0x483d07[_0x2345('0xf')][_0x2345('0x10')]);return _0x13efd3(_0x483d07['error'][_0x2345('0x10')]);}logger[_0x2345('0xf')](_0x2345('0xa'),_0x146445,_0x483d07[_0x2345('0xf')][_0x2345('0x10')]);return _0x24bbbe(_0x483d07[_0x2345('0xf')]['message']);}else{logger[_0x2345('0x11')](_0x2345('0xa'),_0x146445,_0x2345('0xb'));_0x24bbbe(_0x483d07[_0x2345('0x12')][_0x2345('0x10')]);}})[_0x2345('0x13')](function(_0x8198a3){logger[_0x2345('0xf')](_0x2345('0xa'),_0x146445,_0x8198a3);_0x13efd3(_0x8198a3);});});}exports[_0x2345('0x14')]=function(_0x5ccf20){var _0x58f6a3=this;return new Promise(function(_0x284e97,_0x308d2e){return db[_0x2345('0x15')][_0x2345('0x16')](_0x5ccf20[_0x2345('0x17')],{'raw':_0x5ccf20['options']?_0x5ccf20['options'][_0x2345('0x18')]===undefined?!![]:![]:!![]})[_0x2345('0x9')](function(_0x221442){logger[_0x2345('0x11')](_0x2345('0x14'),_0x5ccf20);logger[_0x2345('0xc')](_0x2345('0x14'),_0x5ccf20,JSON[_0x2345('0xe')](_0x221442));_0x284e97(_0x221442);})['catch'](function(_0x22b679){logger['error'](_0x2345('0x14'),_0x22b679[_0x2345('0x10')],_0x5ccf20);_0x308d2e(_0x58f6a3[_0x2345('0xf')](0x1f4,_0x22b679['message']));});});};exports[_0x2345('0x19')]=function(_0x145822){var _0x3d748a=this;return new Promise(function(_0x18a2b0,_0x26fad7){return db[_0x2345('0x15')][_0x2345('0x1a')](_0x145822[_0x2345('0x17')],{'raw':_0x145822[_0x2345('0x1b')]?_0x145822[_0x2345('0x1b')][_0x2345('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x145822[_0x2345('0x1b')]?_0x145822[_0x2345('0x1b')][_0x2345('0x1c')]||null:null,'attributes':_0x145822[_0x2345('0x1b')]?_0x145822[_0x2345('0x1b')]['attributes']||null:null,'limit':_0x145822[_0x2345('0x1b')]?_0x145822[_0x2345('0x1b')][_0x2345('0x1d')]||null:null})[_0x2345('0x9')](function(_0x512a64){logger['info'](_0x2345('0x19'),_0x145822);logger['debug'](_0x2345('0x19'),_0x145822,JSON[_0x2345('0xe')](_0x512a64));_0x18a2b0(_0x512a64);})[_0x2345('0x13')](function(_0x2c534b){logger[_0x2345('0xf')]('UpdateSquareReport',_0x2c534b[_0x2345('0x10')],_0x145822);_0x26fad7(_0x3d748a[_0x2345('0xf')](0x1f4,_0x2c534b['message']));});});}; \ No newline at end of file +var _0xc218=['body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','options','raw','UpdateSquareReport','SquareReport'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xc218,0xb8));var _0x8c21=function(_0xe66930,_0x2860cf){_0xe66930=_0xe66930-0x0;var _0x348660=_0xc218[_0xe66930];return _0x348660;};'use strict';var _=require(_0x8c21('0x0'));var util=require(_0x8c21('0x1'));var moment=require(_0x8c21('0x2'));var BPromise=require(_0x8c21('0x3'));var rs=require(_0x8c21('0x4'));var fs=require('fs');var Redis=require(_0x8c21('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c21('0x6'));var logger=require(_0x8c21('0x7'))(_0x8c21('0x8'));var config=require('../../config/environment');var jayson=require(_0x8c21('0x9'));var client=jayson[_0x8c21('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e5a7e,_0x5d42a4,_0x5ec2e8){return new BPromise(function(_0x111e0f,_0xd9cf61){return client[_0x8c21('0xb')](_0x1e5a7e,_0x5ec2e8)[_0x8c21('0xc')](function(_0x5e32d4){logger[_0x8c21('0xd')]('SquareReport,\x20%s,\x20%s',_0x5d42a4,_0x8c21('0xe'));logger[_0x8c21('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x5d42a4,'request\x20sent',JSON[_0x8c21('0x10')](_0x5e32d4));if(_0x5e32d4['error']){if(_0x5e32d4[_0x8c21('0x11')]['code']===0x1f4){logger[_0x8c21('0x11')](_0x8c21('0x12'),_0x5d42a4,_0x5e32d4[_0x8c21('0x11')]['message']);return _0xd9cf61(_0x5e32d4[_0x8c21('0x11')][_0x8c21('0x13')]);}logger[_0x8c21('0x11')](_0x8c21('0x12'),_0x5d42a4,_0x5e32d4[_0x8c21('0x11')][_0x8c21('0x13')]);return _0x111e0f(_0x5e32d4['error'][_0x8c21('0x13')]);}else{logger[_0x8c21('0xd')](_0x8c21('0x12'),_0x5d42a4,'request\x20sent');_0x111e0f(_0x5e32d4['result'][_0x8c21('0x13')]);}})[_0x8c21('0x14')](function(_0x5a8a11){logger[_0x8c21('0x11')]('SquareReport,\x20%s,\x20%s',_0x5d42a4,_0x5a8a11);_0xd9cf61(_0x5a8a11);});});}exports[_0x8c21('0x15')]=function(_0xe26b81){var _0x59526a=this;return new Promise(function(_0x46e231,_0x261619){return db['SquareReport']['create'](_0xe26b81['body'],{'raw':_0xe26b81[_0x8c21('0x16')]?_0xe26b81[_0x8c21('0x16')][_0x8c21('0x17')]===undefined?!![]:![]:!![]})[_0x8c21('0xc')](function(_0x26efa4){logger[_0x8c21('0xd')](_0x8c21('0x15'),_0xe26b81);logger[_0x8c21('0xf')](_0x8c21('0x15'),_0xe26b81,JSON[_0x8c21('0x10')](_0x26efa4));_0x46e231(_0x26efa4);})[_0x8c21('0x14')](function(_0x161fb3){logger[_0x8c21('0x11')](_0x8c21('0x15'),_0x161fb3['message'],_0xe26b81);_0x261619(_0x59526a['error'](0x1f4,_0x161fb3[_0x8c21('0x13')]));});});};exports[_0x8c21('0x18')]=function(_0x58583){var _0x3d21ac=this;return new Promise(function(_0x21c7ad,_0xf33c9){return db[_0x8c21('0x19')]['update'](_0x58583[_0x8c21('0x1a')],{'raw':_0x58583[_0x8c21('0x16')]?_0x58583[_0x8c21('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58583[_0x8c21('0x16')]?_0x58583[_0x8c21('0x16')][_0x8c21('0x1b')]||null:null,'attributes':_0x58583[_0x8c21('0x16')]?_0x58583[_0x8c21('0x16')][_0x8c21('0x1c')]||null:null,'limit':_0x58583[_0x8c21('0x16')]?_0x58583['options'][_0x8c21('0x1d')]||null:null})['then'](function(_0x8495ba){logger['info'](_0x8c21('0x18'),_0x58583);logger[_0x8c21('0xf')](_0x8c21('0x18'),_0x58583,JSON[_0x8c21('0x10')](_0x8495ba));_0x21c7ad(_0x8495ba);})[_0x8c21('0x14')](function(_0x64e34a){logger[_0x8c21('0x11')](_0x8c21('0x18'),_0x64e34a[_0x8c21('0x13')],_0x58583);_0xf33c9(_0x3d21ac['error'](0x1f4,_0x64e34a[_0x8c21('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 216e81a..42b440b 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 _0x0800=['util','connect-timeout','express','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','/:id','show','post','put','delete','destroy','exports'];(function(_0x89fffe,_0x1ef3ba){var _0x4a9fad=function(_0x8690eb){while(--_0x8690eb){_0x89fffe['push'](_0x89fffe['shift']());}};_0x4a9fad(++_0x1ef3ba);}(_0x0800,0xa0));var _0x0080=function(_0x708913,_0x5f7b3b){_0x708913=_0x708913-0x0;var _0x2e0632=_0x0800[_0x708913];return _0x2e0632;};'use strict';var multer=require('multer');var util=require(_0x0080('0x0'));var path=require('path');var timeout=require(_0x0080('0x1'));var express=require(_0x0080('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0080('0x3'));var config=require(_0x0080('0x4'));var controller=require(_0x0080('0x5'));router[_0x0080('0x6')]('/',auth[_0x0080('0x7')](),controller['index']);router[_0x0080('0x6')](_0x0080('0x8'),auth[_0x0080('0x7')](),controller['describe']);router[_0x0080('0x6')](_0x0080('0x9'),auth[_0x0080('0x7')](),controller[_0x0080('0xa')]);router[_0x0080('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0080('0xc')](_0x0080('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x0080('0xd')](_0x0080('0x9'),auth[_0x0080('0x7')](),controller[_0x0080('0xe')]);module[_0x0080('0xf')]=router; \ No newline at end of file +var _0x3501=['post','update','delete','multer','path','connect-timeout','express','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x1866aa,_0xfd4dd4){var _0x439033=function(_0x4b7f43){while(--_0x4b7f43){_0x1866aa['push'](_0x1866aa['shift']());}};_0x439033(++_0xfd4dd4);}(_0x3501,0x8a));var _0x1350=function(_0x382868,_0xb5acfd){_0x382868=_0x382868-0x0;var _0x43e191=_0x3501[_0x382868];return _0x43e191;};'use strict';var multer=require(_0x1350('0x0'));var util=require('util');var path=require(_0x1350('0x1'));var timeout=require(_0x1350('0x2'));var express=require(_0x1350('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1350('0x4'));var config=require('../../config/environment');var controller=require(_0x1350('0x5'));router[_0x1350('0x6')]('/',auth[_0x1350('0x7')](),controller[_0x1350('0x8')]);router[_0x1350('0x6')](_0x1350('0x9'),auth[_0x1350('0x7')](),controller['describe']);router[_0x1350('0x6')](_0x1350('0xa'),auth['isAuthenticated'](),controller[_0x1350('0xb')]);router[_0x1350('0xc')]('/',auth[_0x1350('0x7')](),controller['create']);router['put'](_0x1350('0xa'),auth['isAuthenticated'](),controller[_0x1350('0xd')]);router[_0x1350('0xe')](_0x1350('0xa'),auth[_0x1350('0x7')](),controller['destroy']);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 d4cff53..78745f9 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 _0xc5fc=['exports','STRING','TEXT','sequelize'];(function(_0x447f6d,_0x36fc29){var _0x56a9b8=function(_0x16444e){while(--_0x16444e){_0x447f6d['push'](_0x447f6d['shift']());}};_0x56a9b8(++_0x36fc29);}(_0xc5fc,0x16f));var _0xcc5f=function(_0x1991e1,_0x2c6945){_0x1991e1=_0x1991e1-0x0;var _0xba7b97=_0xc5fc[_0x1991e1];return _0xba7b97;};'use strict';var Sequelize=require(_0xcc5f('0x0'));module[_0xcc5f('0x1')]={'uniqueid':{'type':Sequelize[_0xcc5f('0x2')]},'node':{'type':Sequelize[_0xcc5f('0x2')]},'application':{'type':Sequelize[_0xcc5f('0x2')]},'data':{'type':Sequelize[_0xcc5f('0x3')]},'project_name':{'type':Sequelize[_0xcc5f('0x2')]},'callerid':{'type':Sequelize[_0xcc5f('0x2')]}}; \ No newline at end of file +var _0xd09d=['exports','STRING','sequelize'];(function(_0x3727b6,_0x4c3cd3){var _0x23263d=function(_0x155be3){while(--_0x155be3){_0x3727b6['push'](_0x3727b6['shift']());}};_0x23263d(++_0x4c3cd3);}(_0xd09d,0x1a0));var _0xdd09=function(_0x7cc9f5,_0x44951f){_0x7cc9f5=_0x7cc9f5-0x0;var _0x4fdbbf=_0xd09d[_0x7cc9f5];return _0x4fdbbf;};'use strict';var Sequelize=require(_0xdd09('0x0'));module[_0xdd09('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xdd09('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xdd09('0x2')]},'callerid':{'type':Sequelize[_0xdd09('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 627eb3e..97e5c72 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 _0xcb3c=['error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','then','show','find','create','catch','body','destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update'];(function(_0x33154d,_0x854047){var _0x3b2f03=function(_0x35f7a6){while(--_0x35f7a6){_0x33154d['push'](_0x33154d['shift']());}};_0x3b2f03(++_0x854047);}(_0xcb3c,0xc4));var _0xccb3=function(_0x3174d2,_0x4dbb8a){_0x3174d2=_0x3174d2-0x0;var _0x28519a=_0xcb3c[_0x3174d2];return _0x28519a;};'use strict';var emlformat=require(_0xccb3('0x0'));var rimraf=require(_0xccb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccb3('0x2'));var rp=require(_0xccb3('0x3'));var moment=require(_0xccb3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xccb3('0x5'));var util=require(_0xccb3('0x6'));var path=require(_0xccb3('0x7'));var sox=require(_0xccb3('0x8'));var csv=require('to-csv');var ejs=require(_0xccb3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xccb3('0xa'));var crypto=require(_0xccb3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xccb3('0xc'));var querystring=require(_0xccb3('0xd'));var Papa=require(_0xccb3('0xe'));var Redis=require(_0xccb3('0xf'));var authService=require(_0xccb3('0x10'));var qs=require(_0xccb3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xccb3('0x12'));var logger=require(_0xccb3('0x13'))('api');var utils=require(_0xccb3('0x14'));var config=require(_0xccb3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xccb3('0x16'))['db'];function respondWithStatusCode(_0xfdb0fa,_0x4f8302){_0x4f8302=_0x4f8302||0xcc;return function(_0x3cba58){if(_0x3cba58){return _0xfdb0fa[_0xccb3('0x17')](_0x4f8302);}return _0xfdb0fa[_0xccb3('0x18')](_0x4f8302)[_0xccb3('0x19')]();};}function respondWithResult(_0x42fa8d,_0x5f3dbb){_0x5f3dbb=_0x5f3dbb||0xc8;return function(_0x138a1d){if(_0x138a1d){return _0x42fa8d[_0xccb3('0x18')](_0x5f3dbb)[_0xccb3('0x1a')](_0x138a1d);}};}function respondWithFilteredResult(_0x2d45e1,_0x47f6b7){return function(_0xe7c06f){if(_0xe7c06f){var _0x5c6211=typeof _0x47f6b7[_0xccb3('0x1b')]==='undefined'&&typeof _0x47f6b7[_0xccb3('0x1c')]==='undefined';var _0x3f1912=_0xe7c06f[_0xccb3('0x1d')];var _0x3ba69c=_0x5c6211?0x0:_0x47f6b7[_0xccb3('0x1b')];var _0x2b7bb3=_0x5c6211?_0xe7c06f[_0xccb3('0x1d')]:_0x47f6b7[_0xccb3('0x1b')]+_0x47f6b7['limit'];var _0x446915;if(_0x2b7bb3>=_0x3f1912){_0x2b7bb3=_0x3f1912;_0x446915=0xc8;}else{_0x446915=0xce;}_0x2d45e1[_0xccb3('0x18')](_0x446915);return _0x2d45e1[_0xccb3('0x1e')](_0xccb3('0x1f'),_0x3ba69c+'-'+_0x2b7bb3+'/'+_0x3f1912)[_0xccb3('0x1a')](_0xe7c06f);}return null;};}function patchUpdates(_0x29c127){return function(_0x4e4864){try{jsonpatch['apply'](_0x4e4864,_0x29c127,!![]);}catch(_0x3e8f8d){return BPromise[_0xccb3('0x20')](_0x3e8f8d);}return _0x4e4864[_0xccb3('0x21')]();};}function saveUpdates(_0x575aa1,_0x2dc7fb){return function(_0x3a4289){if(_0x3a4289){return _0x3a4289[_0xccb3('0x22')](_0x575aa1)['then'](function(_0x3ab6b3){return _0x3ab6b3;});}return null;};}function removeEntity(_0x129325,_0x3c8974){return function(_0xd7224a){if(_0xd7224a){return _0xd7224a['destroy']()['then'](function(){_0x129325[_0xccb3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bca27,_0x5bc027){return function(_0x2d4cb0){if(!_0x2d4cb0){_0x5bca27[_0xccb3('0x17')](0x194);}return _0x2d4cb0;};}function handleError(_0x58623b,_0x1a6f11){_0x1a6f11=_0x1a6f11||0x1f4;return function(_0x308547){logger[_0xccb3('0x23')](_0x308547[_0xccb3('0x24')]);if(_0x308547[_0xccb3('0x25')]){delete _0x308547[_0xccb3('0x25')];}_0x58623b[_0xccb3('0x18')](_0x1a6f11)[_0xccb3('0x26')](_0x308547);};}exports[_0xccb3('0x27')]=function(_0x3a6cc7,_0x35235f){var _0x290bf7={},_0x542046={},_0x15bc68={'count':0x0,'rows':[]};var _0x3ccdf5=_['map'](db[_0xccb3('0x28')][_0xccb3('0x29')],function(_0x2bfa5d){return{'name':_0x2bfa5d[_0xccb3('0x2a')],'type':_0x2bfa5d[_0xccb3('0x2b')][_0xccb3('0x2c')]};});_0x542046[_0xccb3('0x2d')]=_[_0xccb3('0x2e')](_0x3ccdf5,_0xccb3('0x25'));_0x542046[_0xccb3('0x2f')]=_[_0xccb3('0x30')](_0x3a6cc7[_0xccb3('0x2f')]);_0x542046[_0xccb3('0x31')]=_[_0xccb3('0x32')](_0x542046[_0xccb3('0x2d')],_0x542046[_0xccb3('0x2f')]);_0x290bf7['attributes']=_[_0xccb3('0x32')](_0x542046[_0xccb3('0x2d')],qs[_0xccb3('0x33')](_0x3a6cc7['query']['fields']));_0x290bf7[_0xccb3('0x34')]=_0x290bf7[_0xccb3('0x34')][_0xccb3('0x35')]?_0x290bf7[_0xccb3('0x34')]:_0x542046[_0xccb3('0x2d')];if(!_0x3a6cc7['query'][_0xccb3('0x36')](_0xccb3('0x37'))){_0x290bf7[_0xccb3('0x1c')]=qs[_0xccb3('0x1c')](_0x3a6cc7[_0xccb3('0x2f')][_0xccb3('0x1c')]);_0x290bf7[_0xccb3('0x1b')]=qs[_0xccb3('0x1b')](_0x3a6cc7['query']['offset']);}_0x290bf7[_0xccb3('0x38')]=qs[_0xccb3('0x39')](_0x3a6cc7['query'][_0xccb3('0x39')]);_0x290bf7[_0xccb3('0x3a')]=qs['filters'](_[_0xccb3('0x3b')](_0x3a6cc7[_0xccb3('0x2f')],_0x542046[_0xccb3('0x31')]),_0x3ccdf5);if(_0x3a6cc7[_0xccb3('0x2f')][_0xccb3('0x3c')]){_0x290bf7['where']=_[_0xccb3('0x3d')](_0x290bf7['where'],{'$or':_['map'](_0x3ccdf5,function(_0x48adf4){if(_0x48adf4[_0xccb3('0x2b')]!==_0xccb3('0x3e')){var _0x45ee1c={};_0x45ee1c[_0x48adf4[_0xccb3('0x25')]]={'$like':'%'+_0x3a6cc7['query']['filter']+'%'};return _0x45ee1c;}})});}_0x290bf7=_[_0xccb3('0x3d')]({},_0x290bf7,_0x3a6cc7[_0xccb3('0x3f')]);var _0x2337a0={'where':_0x290bf7['where']};return db[_0xccb3('0x28')][_0xccb3('0x1d')](_0x2337a0)['then'](function(_0x1be7fe){_0x15bc68[_0xccb3('0x1d')]=_0x1be7fe;if(_0x3a6cc7[_0xccb3('0x2f')][_0xccb3('0x40')]){_0x290bf7[_0xccb3('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xccb3('0x42')](_0x290bf7);})['then'](function(_0x545947){_0x15bc68[_0xccb3('0x43')]=_0x545947;return _0x15bc68;})[_0xccb3('0x44')](respondWithFilteredResult(_0x35235f,_0x290bf7))['catch'](handleError(_0x35235f,null));};exports[_0xccb3('0x45')]=function(_0x3ac04c,_0x296193){var _0x2f02dc={'raw':!![],'where':{'id':_0x3ac04c['params']['id']}},_0x56537f={};_0x56537f[_0xccb3('0x2d')]=_[_0xccb3('0x30')](db[_0xccb3('0x28')]['rawAttributes']);_0x56537f['query']=_[_0xccb3('0x30')](_0x3ac04c[_0xccb3('0x2f')]);_0x56537f[_0xccb3('0x31')]=_[_0xccb3('0x32')](_0x56537f[_0xccb3('0x2d')],_0x56537f[_0xccb3('0x2f')]);_0x2f02dc['attributes']=_[_0xccb3('0x32')](_0x56537f[_0xccb3('0x2d')],qs[_0xccb3('0x33')](_0x3ac04c[_0xccb3('0x2f')][_0xccb3('0x33')]));_0x2f02dc[_0xccb3('0x34')]=_0x2f02dc[_0xccb3('0x34')]['length']?_0x2f02dc[_0xccb3('0x34')]:_0x56537f[_0xccb3('0x2d')];if(_0x3ac04c['query'][_0xccb3('0x40')]){_0x2f02dc[_0xccb3('0x41')]=[{'all':!![]}];}_0x2f02dc=_[_0xccb3('0x3d')]({},_0x2f02dc,_0x3ac04c[_0xccb3('0x3f')]);return db['SquareDetailsReport'][_0xccb3('0x46')](_0x2f02dc)[_0xccb3('0x44')](handleEntityNotFound(_0x296193,null))[_0xccb3('0x44')](respondWithResult(_0x296193,null))['catch'](handleError(_0x296193,null));};exports[_0xccb3('0x47')]=function(_0x41a951,_0x880ba1){return db[_0xccb3('0x28')][_0xccb3('0x47')](_0x41a951['body'],{})[_0xccb3('0x44')](respondWithResult(_0x880ba1,0xc9))[_0xccb3('0x48')](handleError(_0x880ba1,null));};exports['update']=function(_0x7833bf,_0x485d32){if(_0x7833bf[_0xccb3('0x49')]['id']){delete _0x7833bf[_0xccb3('0x49')]['id'];}return db['SquareDetailsReport'][_0xccb3('0x46')]({'where':{'id':_0x7833bf['params']['id']}})[_0xccb3('0x44')](handleEntityNotFound(_0x485d32,null))[_0xccb3('0x44')](saveUpdates(_0x7833bf[_0xccb3('0x49')],null))[_0xccb3('0x44')](respondWithResult(_0x485d32,null))[_0xccb3('0x48')](handleError(_0x485d32,null));};exports[_0xccb3('0x4a')]=function(_0x311cc9,_0x38a6c0){return db[_0xccb3('0x28')][_0xccb3('0x46')]({'where':{'id':_0x311cc9[_0xccb3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x38a6c0,null))['then'](removeEntity(_0x38a6c0,null))[_0xccb3('0x48')](handleError(_0x38a6c0,null));};exports[_0xccb3('0x4c')]=function(_0x5f09b1,_0x33374a){return db[_0xccb3('0x28')]['describe']()['then'](respondWithResult(_0x33374a,null))['catch'](handleError(_0x33374a,null));}; \ No newline at end of file +var _0x8f23=['rawAttributes','fieldName','type','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','create','body','find','describe','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport'];(function(_0x30579f,_0x45217b){var _0x53b36b=function(_0x4b529a){while(--_0x4b529a){_0x30579f['push'](_0x30579f['shift']());}};_0x53b36b(++_0x45217b);}(_0x8f23,0x1e0));var _0x38f2=function(_0x5e1a7a,_0x4498af){_0x5e1a7a=_0x5e1a7a-0x0;var _0x231e48=_0x8f23[_0x5e1a7a];return _0x231e48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38f2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x38f2('0x1'));var Mustache=require(_0x38f2('0x2'));var util=require(_0x38f2('0x3'));var path=require(_0x38f2('0x4'));var sox=require(_0x38f2('0x5'));var csv=require(_0x38f2('0x6'));var ejs=require(_0x38f2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38f2('0x8'));var squel=require(_0x38f2('0x9'));var crypto=require(_0x38f2('0xa'));var jsforce=require(_0x38f2('0xb'));var deskjs=require(_0x38f2('0xc'));var toCsv=require(_0x38f2('0x6'));var querystring=require('querystring');var Papa=require(_0x38f2('0xd'));var Redis=require(_0x38f2('0xe'));var authService=require(_0x38f2('0xf'));var qs=require(_0x38f2('0x10'));var as=require(_0x38f2('0x11'));var hardwareService=require(_0x38f2('0x12'));var logger=require(_0x38f2('0x13'))(_0x38f2('0x14'));var utils=require(_0x38f2('0x15'));var config=require(_0x38f2('0x16'));var licenseUtil=require(_0x38f2('0x17'));var db=require(_0x38f2('0x18'))['db'];function respondWithStatusCode(_0x23d888,_0xa6918f){_0xa6918f=_0xa6918f||0xcc;return function(_0x5ccb05){if(_0x5ccb05){return _0x23d888[_0x38f2('0x19')](_0xa6918f);}return _0x23d888[_0x38f2('0x1a')](_0xa6918f)[_0x38f2('0x1b')]();};}function respondWithResult(_0x227f6a,_0x2d7b9c){_0x2d7b9c=_0x2d7b9c||0xc8;return function(_0x135241){if(_0x135241){return _0x227f6a[_0x38f2('0x1a')](_0x2d7b9c)['json'](_0x135241);}};}function respondWithFilteredResult(_0x464080,_0x53761b){return function(_0x421720){if(_0x421720){var _0x129327=typeof _0x53761b[_0x38f2('0x1c')]===_0x38f2('0x1d')&&typeof _0x53761b[_0x38f2('0x1e')]===_0x38f2('0x1d');var _0x30d4e8=_0x421720[_0x38f2('0x1f')];var _0x5e6c5b=_0x129327?0x0:_0x53761b[_0x38f2('0x1c')];var _0x37ba57=_0x129327?_0x421720['count']:_0x53761b[_0x38f2('0x1c')]+_0x53761b[_0x38f2('0x1e')];var _0x3c616f;if(_0x37ba57>=_0x30d4e8){_0x37ba57=_0x30d4e8;_0x3c616f=0xc8;}else{_0x3c616f=0xce;}_0x464080['status'](_0x3c616f);return _0x464080['set'](_0x38f2('0x20'),_0x5e6c5b+'-'+_0x37ba57+'/'+_0x30d4e8)[_0x38f2('0x21')](_0x421720);}return null;};}function patchUpdates(_0x1b4083){return function(_0x3aedaa){try{jsonpatch[_0x38f2('0x22')](_0x3aedaa,_0x1b4083,!![]);}catch(_0x2325ea){return BPromise['reject'](_0x2325ea);}return _0x3aedaa['save']();};}function saveUpdates(_0x5a9270,_0x2ec493){return function(_0x1eee2e){if(_0x1eee2e){return _0x1eee2e[_0x38f2('0x23')](_0x5a9270)[_0x38f2('0x24')](function(_0x5661ff){return _0x5661ff;});}return null;};}function removeEntity(_0x17f432,_0x56adf7){return function(_0x4e9fb4){if(_0x4e9fb4){return _0x4e9fb4[_0x38f2('0x25')]()[_0x38f2('0x24')](function(){_0x17f432['status'](0xcc)[_0x38f2('0x1b')]();});}};}function handleEntityNotFound(_0x78a33,_0x199c19){return function(_0x310f0d){if(!_0x310f0d){_0x78a33[_0x38f2('0x19')](0x194);}return _0x310f0d;};}function handleError(_0x2895de,_0x5d3f90){_0x5d3f90=_0x5d3f90||0x1f4;return function(_0x4a7acb){logger[_0x38f2('0x26')](_0x4a7acb[_0x38f2('0x27')]);if(_0x4a7acb['name']){delete _0x4a7acb[_0x38f2('0x28')];}_0x2895de[_0x38f2('0x1a')](_0x5d3f90)[_0x38f2('0x29')](_0x4a7acb);};}exports[_0x38f2('0x2a')]=function(_0x4bebdb,_0x48436f){var _0x50fd7={},_0x2e9f84={},_0x4ee078={'count':0x0,'rows':[]};var _0x1f4b72=_[_0x38f2('0x2b')](db[_0x38f2('0x2c')][_0x38f2('0x2d')],function(_0x53558e){return{'name':_0x53558e[_0x38f2('0x2e')],'type':_0x53558e[_0x38f2('0x2f')]['key']};});_0x2e9f84['model']=_[_0x38f2('0x2b')](_0x1f4b72,_0x38f2('0x28'));_0x2e9f84['query']=_[_0x38f2('0x30')](_0x4bebdb['query']);_0x2e9f84[_0x38f2('0x31')]=_[_0x38f2('0x32')](_0x2e9f84[_0x38f2('0x33')],_0x2e9f84[_0x38f2('0x34')]);_0x50fd7['attributes']=_[_0x38f2('0x32')](_0x2e9f84[_0x38f2('0x33')],qs[_0x38f2('0x35')](_0x4bebdb['query']['fields']));_0x50fd7[_0x38f2('0x36')]=_0x50fd7[_0x38f2('0x36')][_0x38f2('0x37')]?_0x50fd7['attributes']:_0x2e9f84[_0x38f2('0x33')];if(!_0x4bebdb[_0x38f2('0x34')][_0x38f2('0x38')](_0x38f2('0x39'))){_0x50fd7['limit']=qs['limit'](_0x4bebdb[_0x38f2('0x34')]['limit']);_0x50fd7[_0x38f2('0x1c')]=qs['offset'](_0x4bebdb['query'][_0x38f2('0x1c')]);}_0x50fd7[_0x38f2('0x3a')]=qs[_0x38f2('0x3b')](_0x4bebdb[_0x38f2('0x34')][_0x38f2('0x3b')]);_0x50fd7[_0x38f2('0x3c')]=qs['filters'](_[_0x38f2('0x3d')](_0x4bebdb[_0x38f2('0x34')],_0x2e9f84[_0x38f2('0x31')]),_0x1f4b72);if(_0x4bebdb[_0x38f2('0x34')][_0x38f2('0x3e')]){_0x50fd7[_0x38f2('0x3c')]=_[_0x38f2('0x3f')](_0x50fd7[_0x38f2('0x3c')],{'$or':_[_0x38f2('0x2b')](_0x1f4b72,function(_0x52838d){if(_0x52838d[_0x38f2('0x2f')]!==_0x38f2('0x40')){var _0x1afc3e={};_0x1afc3e[_0x52838d[_0x38f2('0x28')]]={'$like':'%'+_0x4bebdb['query']['filter']+'%'};return _0x1afc3e;}})});}_0x50fd7=_['merge']({},_0x50fd7,_0x4bebdb['options']);var _0x1a1ba5={'where':_0x50fd7['where']};return db[_0x38f2('0x2c')][_0x38f2('0x1f')](_0x1a1ba5)[_0x38f2('0x24')](function(_0x14e2e1){_0x4ee078['count']=_0x14e2e1;if(_0x4bebdb[_0x38f2('0x34')][_0x38f2('0x41')]){_0x50fd7[_0x38f2('0x42')]=[{'all':!![]}];}return db[_0x38f2('0x2c')]['findAll'](_0x50fd7);})[_0x38f2('0x24')](function(_0x85dc1e){_0x4ee078['rows']=_0x85dc1e;return _0x4ee078;})[_0x38f2('0x24')](respondWithFilteredResult(_0x48436f,_0x50fd7))[_0x38f2('0x43')](handleError(_0x48436f,null));};exports[_0x38f2('0x44')]=function(_0xce88bf,_0x10a5ef){var _0x2abdeb={'raw':!![],'where':{'id':_0xce88bf[_0x38f2('0x45')]['id']}},_0x3b0761={};_0x3b0761[_0x38f2('0x33')]=_[_0x38f2('0x30')](db[_0x38f2('0x2c')]['rawAttributes']);_0x3b0761[_0x38f2('0x34')]=_[_0x38f2('0x30')](_0xce88bf[_0x38f2('0x34')]);_0x3b0761['filters']=_[_0x38f2('0x32')](_0x3b0761[_0x38f2('0x33')],_0x3b0761[_0x38f2('0x34')]);_0x2abdeb[_0x38f2('0x36')]=_['intersection'](_0x3b0761['model'],qs['fields'](_0xce88bf[_0x38f2('0x34')][_0x38f2('0x35')]));_0x2abdeb['attributes']=_0x2abdeb[_0x38f2('0x36')][_0x38f2('0x37')]?_0x2abdeb[_0x38f2('0x36')]:_0x3b0761[_0x38f2('0x33')];if(_0xce88bf[_0x38f2('0x34')]['includeAll']){_0x2abdeb[_0x38f2('0x42')]=[{'all':!![]}];}_0x2abdeb=_[_0x38f2('0x3f')]({},_0x2abdeb,_0xce88bf[_0x38f2('0x46')]);return db[_0x38f2('0x2c')]['find'](_0x2abdeb)['then'](handleEntityNotFound(_0x10a5ef,null))[_0x38f2('0x24')](respondWithResult(_0x10a5ef,null))[_0x38f2('0x43')](handleError(_0x10a5ef,null));};exports[_0x38f2('0x47')]=function(_0x37586a,_0x3ae311){return db['SquareDetailsReport'][_0x38f2('0x47')](_0x37586a[_0x38f2('0x48')],{})[_0x38f2('0x24')](respondWithResult(_0x3ae311,0xc9))[_0x38f2('0x43')](handleError(_0x3ae311,null));};exports[_0x38f2('0x23')]=function(_0xaac5c2,_0x27bcf3){if(_0xaac5c2[_0x38f2('0x48')]['id']){delete _0xaac5c2[_0x38f2('0x48')]['id'];}return db[_0x38f2('0x2c')][_0x38f2('0x49')]({'where':{'id':_0xaac5c2[_0x38f2('0x45')]['id']}})[_0x38f2('0x24')](handleEntityNotFound(_0x27bcf3,null))['then'](saveUpdates(_0xaac5c2[_0x38f2('0x48')],null))[_0x38f2('0x24')](respondWithResult(_0x27bcf3,null))[_0x38f2('0x43')](handleError(_0x27bcf3,null));};exports[_0x38f2('0x25')]=function(_0x5aa599,_0x48507e){return db[_0x38f2('0x2c')]['find']({'where':{'id':_0x5aa599[_0x38f2('0x45')]['id']}})[_0x38f2('0x24')](handleEntityNotFound(_0x48507e,null))['then'](removeEntity(_0x48507e,null))['catch'](handleError(_0x48507e,null));};exports[_0x38f2('0x4a')]=function(_0xd3bcc7,_0x48ac81){return db[_0x38f2('0x2c')]['describe']()[_0x38f2('0x24')](respondWithResult(_0x48ac81,null))[_0x38f2('0x43')](handleError(_0x48ac81,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index a8d958e..42f4da8 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 _0x9e58=['report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x564360,_0x54364f){var _0x1af12e=function(_0xf4dbed){while(--_0xf4dbed){_0x564360['push'](_0x564360['shift']());}};_0x1af12e(++_0x54364f);}(_0x9e58,0x197));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x89e5('0x0'));var util=require(_0x89e5('0x1'));var logger=require(_0x89e5('0x2'))(_0x89e5('0x3'));var moment=require(_0x89e5('0x4'));var BPromise=require(_0x89e5('0x5'));var rp=require(_0x89e5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89e5('0x7'));var config=require(_0x89e5('0x8'));var attributes=require(_0x89e5('0x9'));module[_0x89e5('0xa')]=function(_0x6ccc9a,_0x1523a0){return _0x6ccc9a[_0x89e5('0xb')](_0x89e5('0xc'),attributes,{'tableName':_0x89e5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8612=['moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','lodash','api'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0x8612,0xda));var _0x2861=function(_0xf5186a,_0x5abfd0){_0xf5186a=_0xf5186a-0x0;var _0x3c1548=_0x8612[_0xf5186a];return _0x3c1548;};'use strict';var _=require(_0x2861('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2861('0x1'));var moment=require(_0x2861('0x2'));var BPromise=require('bluebird');var rp=require(_0x2861('0x3'));var fs=require('fs');var path=require(_0x2861('0x4'));var rimraf=require(_0x2861('0x5'));var config=require(_0x2861('0x6'));var attributes=require(_0x2861('0x7'));module['exports']=function(_0x162bfa,_0x133109){return _0x162bfa[_0x2861('0x8')](_0x2861('0x9'),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 92aff66..97f6781 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 _0xa5fa=['../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x50a1f6,_0x238fd8){var _0x84f8d4=function(_0x2d9586){while(--_0x2d9586){_0x50a1f6['push'](_0x50a1f6['shift']());}};_0x84f8d4(++_0x238fd8);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xa5fa[_0x4063a4];return _0x17908d;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')](_0x3d874f[_0xaa5f('0x19')],{'raw':_0x3d874f[_0xaa5f('0x1a')]?_0x3d874f[_0xaa5f('0x1a')][_0xaa5f('0x1b')]===undefined?!![]:![]:!![]})[_0xaa5f('0x1c')](function(_0x194691){logger[_0xaa5f('0xc')](_0xaa5f('0x16'),_0x3d874f);logger[_0xaa5f('0xd')](_0xaa5f('0x16'),_0x3d874f,JSON[_0xaa5f('0xe')](_0x194691));_0x1019e8(_0x194691);})['catch'](function(_0x1e917d){logger['error'](_0xaa5f('0x16'),_0x1e917d[_0xaa5f('0x12')],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x1e917d[_0xaa5f('0x12')]));});});}; \ No newline at end of file +var _0x1775=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x579526,_0x40166f){var _0x336049=function(_0x67b5b0){while(--_0x67b5b0){_0x579526['push'](_0x579526['shift']());}};_0x336049(++_0x40166f);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['create'](_0x1b4102[_0x5177('0x1c')],{'raw':_0x1b4102['options']?_0x1b4102[_0x5177('0x1d')][_0x5177('0x1e')]===undefined?!![]:![]:!![]})[_0x5177('0xe')](function(_0x27b732){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON[_0x5177('0x13')](_0x27b732));_0x3e6944(_0x27b732);})[_0x5177('0x19')](function(_0x23dad2){logger[_0x5177('0x14')]('CreateSquareDetailsReport',_0x23dad2[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4['error'](0x1f4,_0x23dad2[_0x5177('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 84ca64d..bee5757 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 _0x9b67=['/process/:pid/kill','killProcess','exports','Router','./system.controller','get'];(function(_0x5f0ea6,_0x4245c7){var _0x324271=function(_0x443494){while(--_0x443494){_0x5f0ea6['push'](_0x5f0ea6['shift']());}};_0x324271(++_0x4245c7);}(_0x9b67,0x189));var _0x79b6=function(_0x5ee1bc,_0x40eafd){_0x5ee1bc=_0x5ee1bc-0x0;var _0x456616=_0x9b67[_0x5ee1bc];return _0x456616;};'use strict';var express=require('express');var router=express[_0x79b6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x79b6('0x1'));router[_0x79b6('0x2')]('/',auth['isAuthenticated'](),controller['index']);router[_0x79b6('0x2')](_0x79b6('0x3'),auth['isAuthenticated'](),controller[_0x79b6('0x4')]);module[_0x79b6('0x5')]=router; \ No newline at end of file +var _0xfbd8=['express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess'];(function(_0x2bc061,_0x20a594){var _0x3a1435=function(_0x66fb53){while(--_0x66fb53){_0x2bc061['push'](_0x2bc061['shift']());}};_0x3a1435(++_0x20a594);}(_0xfbd8,0x99));var _0x8fbd=function(_0x333965,_0x16e0f5){_0x333965=_0x333965-0x0;var _0x50290e=_0xfbd8[_0x333965];return _0x50290e;};'use strict';var express=require(_0x8fbd('0x0'));var router=express[_0x8fbd('0x1')]();var auth=require(_0x8fbd('0x2'));var controller=require(_0x8fbd('0x3'));router[_0x8fbd('0x4')]('/',auth[_0x8fbd('0x5')](),controller[_0x8fbd('0x6')]);router[_0x8fbd('0x4')](_0x8fbd('0x7'),auth['isAuthenticated'](),controller[_0x8fbd('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index a16c1a0..5aa7017 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 _0x6979=['then','status','json','catch','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger','api','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','index'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6979,0x117));var _0x9697=function(_0x2e6f19,_0x448c24){_0x2e6f19=_0x2e6f19-0x0;var _0x33f0fc=_0x6979[_0x2e6f19];return _0x33f0fc;};'use strict';var info=require('systeminformation');var exec=require(_0x9697('0x0'))['exec'];var logger=require(_0x9697('0x1'))(_0x9697('0x2'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x9697('0x3'));function handleError(_0x226af5,_0x437e97,_0x4c1860){_0x437e97=_0x437e97||0x1f4;return function(_0x6c812e){logger[_0x9697('0x4')](_0x9697('0x5'),_0x4c1860,_0x437e97,util['inspect'](_0x6c812e,{'showHidden':![],'depth':null}));delete _0x6c812e['name'];_0x226af5['status'](_0x437e97)['send'](_0x6c812e);};}exports[_0x9697('0x6')]=function(_0x1f58e7,_0x5c10e4){return info['getAllData']()[_0x9697('0x7')](function(_0x376e8b){return _0x5c10e4[_0x9697('0x8')](0xc8)[_0x9697('0x9')](_0x376e8b);})[_0x9697('0xa')](function(_0x4851b5){return _0x5c10e4[_0x9697('0x8')](0x1f4)[_0x9697('0x9')](_0x4851b5);});};exports[_0x9697('0xb')]=function(_0x24afcc,_0x36d618){var _0x2bd6ee=[_0x9697('0xc')];return new BPromise(function(_0x999a59,_0x2f5e07){return exec(util['format'](_0x9697('0xd'),_0x24afcc[_0x9697('0xe')][_0x9697('0xf')]),function(_0xe74c64,_0x5c213a,_0x5caac4){if(_0xe74c64){return _0x2f5e07(_0xe74c64);}return _0x999a59(_0x5c213a);});})[_0x9697('0x7')](function(_0x543c0c){var _0x1d0901=![];var _0x4a51c5=_0x543c0c['split'](/\n/);for(var _0x5c76c4=0x0,_0x346e84=_0x2bd6ee[_0x9697('0x10')];_0x5c76c4<_0x346e84,_0x1d0901===![];_0x5c76c4+=0x1){if(_0x543c0c['indexOf'](_0x2bd6ee[_0x5c76c4])>=0x0){_0x1d0901=!![];}}if(!_0x1d0901){throw new Error(util[_0x9697('0x11')](_0x9697('0x12'),_0x24afcc['params'][_0x9697('0xf')]));}process[_0x9697('0x13')](_0x24afcc['params'][_0x9697('0xf')],_0x9697('0x14'));return _0x36d618['status'](0xc8)[_0x9697('0x9')]({'message':util['format'](_0x9697('0x15'),_0x24afcc[_0x9697('0xe')][_0x9697('0xf')])});})[_0x9697('0xa')](handleError(_0x36d618,null,'killProcess'));}; \ No newline at end of file +var _0x951b=['child_process','exec','../../config/logger','api','util','bluebird','lodash','status','send','index','then','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','split','length','kill','params','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x22e942,_0x7ee516){var _0xf5e153=function(_0x8891b7){while(--_0x8891b7){_0x22e942['push'](_0x22e942['shift']());}};_0xf5e153(++_0x7ee516);}(_0x951b,0x12b));var _0xb951=function(_0x4a84f7,_0x5a64cc){_0x4a84f7=_0x4a84f7-0x0;var _0x31771c=_0x951b[_0x4a84f7];return _0x31771c;};'use strict';var info=require('systeminformation');var exec=require(_0xb951('0x0'))[_0xb951('0x1')];var logger=require(_0xb951('0x2'))(_0xb951('0x3'));var util=require(_0xb951('0x4'));var BPromise=require(_0xb951('0x5'));var _=require(_0xb951('0x6'));function handleError(_0x91860c,_0x41d595,_0x4f16bf){_0x41d595=_0x41d595||0x1f4;return function(_0x5582d4){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4f16bf,_0x41d595,util['inspect'](_0x5582d4,{'showHidden':![],'depth':null}));delete _0x5582d4['name'];_0x91860c[_0xb951('0x7')](_0x41d595)[_0xb951('0x8')](_0x5582d4);};}exports[_0xb951('0x9')]=function(_0x42ed76,_0x416ec8){return info['getAllData']()[_0xb951('0xa')](function(_0x31460f){return _0x416ec8[_0xb951('0x7')](0xc8)[_0xb951('0xb')](_0x31460f);})[_0xb951('0xc')](function(_0x4b2215){return _0x416ec8['status'](0x1f4)[_0xb951('0xb')](_0x4b2215);});};exports[_0xb951('0xd')]=function(_0xa4f95a,_0x4ec5bc){var _0x59667c=['components/import/cm'];return new BPromise(function(_0x4e59ae,_0x199850){return exec(util[_0xb951('0xe')](_0xb951('0xf'),_0xa4f95a['params']['pid']),function(_0x448a65,_0x76d685,_0x2801ad){if(_0x448a65){return _0x199850(_0x448a65);}return _0x4e59ae(_0x76d685);});})['then'](function(_0xfa8cf9){var _0x4b8327=![];var _0x40f907=_0xfa8cf9[_0xb951('0x10')](/\n/);for(var _0x485b05=0x0,_0x4f6c9d=_0x59667c[_0xb951('0x11')];_0x485b05<_0x4f6c9d,_0x4b8327===![];_0x485b05+=0x1){if(_0xfa8cf9['indexOf'](_0x59667c[_0x485b05])>=0x0){_0x4b8327=!![];}}if(!_0x4b8327){throw new Error(util[_0xb951('0xe')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0xa4f95a['params']['pid']));}process[_0xb951('0x12')](_0xa4f95a[_0xb951('0x13')][_0xb951('0x14')],_0xb951('0x15'));return _0x4ec5bc[_0xb951('0x7')](0xc8)[_0xb951('0xb')]({'message':util['format'](_0xb951('0x16'),_0xa4f95a[_0xb951('0x13')][_0xb951('0x14')])});})[_0xb951('0xc')](handleError(_0x4ec5bc,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7ff6cbe..755345c 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 _0x8374=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x436ecb,_0x3fb837){var _0x3930a5=function(_0x38b928){while(--_0x38b928){_0x436ecb['push'](_0x436ecb['shift']());}};_0x3930a5(++_0x3fb837);}(_0x8374,0x174));var _0x4837=function(_0x7a4905,_0x553600){_0x7a4905=_0x7a4905-0x0;var _0x44b80b=_0x8374[_0x7a4905];return _0x44b80b;};'use strict';var multer=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var path=require(_0x4837('0x2'));var timeout=require(_0x4837('0x3'));var express=require(_0x4837('0x4'));var router=express[_0x4837('0x5')]();var fs_extra=require(_0x4837('0x6'));var auth=require(_0x4837('0x7'));var interaction=require(_0x4837('0x8'));var config=require(_0x4837('0x9'));var controller=require(_0x4837('0xa'));router[_0x4837('0xb')]('/',auth[_0x4837('0xc')](),controller[_0x4837('0xd')]);router['get'](_0x4837('0xe'),auth['isAuthenticated'](),controller[_0x4837('0xf')]);router[_0x4837('0x10')]('/',auth[_0x4837('0xc')](),controller[_0x4837('0x11')]);router[_0x4837('0x12')](_0x4837('0xe'),auth[_0x4837('0xc')](),controller[_0x4837('0x13')]);router[_0x4837('0x14')](_0x4837('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x4837('0x15')]=router; \ No newline at end of file +var _0x726f=['./tag.controller','index','/:id','post','isAuthenticated','create','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x23e50f,_0x47e473){var _0xb10df7=function(_0x361fc8){while(--_0x361fc8){_0x23e50f['push'](_0x23e50f['shift']());}};_0xb10df7(++_0x47e473);}(_0x726f,0x1ca));var _0xf726=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x726f[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xf726('0x0'));var util=require(_0xf726('0x1'));var path=require(_0xf726('0x2'));var timeout=require(_0xf726('0x3'));var express=require(_0xf726('0x4'));var router=express[_0xf726('0x5')]();var fs_extra=require(_0xf726('0x6'));var auth=require(_0xf726('0x7'));var interaction=require(_0xf726('0x8'));var config=require(_0xf726('0x9'));var controller=require(_0xf726('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xf726('0xb')]);router['get'](_0xf726('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf726('0xd')]('/',auth[_0xf726('0xe')](),controller[_0xf726('0xf')]);router['put'](_0xf726('0xc'),auth[_0xf726('0xe')](),controller[_0xf726('0x10')]);router['delete'](_0xf726('0xc'),auth[_0xf726('0xe')](),controller['destroy']);module[_0xf726('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index ae44504..7b99aac 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 _0xb5fb=['sequelize','exports','STRING','name','#0091EA'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb5fb,0x172));var _0xbb5f=function(_0x477b78,_0x302499){_0x477b78=_0x477b78-0x0;var _0x2f3f99=_0xb5fb[_0x477b78];return _0x2f3f99;};'use strict';var Sequelize=require(_0xbb5f('0x0'));module[_0xbb5f('0x1')]={'name':{'type':Sequelize[_0xbb5f('0x2')],'unique':_0xbb5f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xbb5f('0x2')],'defaultValue':_0xbb5f('0x4')},'description':{'type':Sequelize[_0xbb5f('0x2')]}}; \ No newline at end of file +var _0x4b74=['exports','STRING','#0091EA','sequelize'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x4b74,0x103));var _0x44b7=function(_0x232332,_0x3cb82b){_0x232332=_0x232332-0x0;var _0x3e71f6=_0x4b74[_0x232332];return _0x3e71f6;};'use strict';var Sequelize=require(_0x44b7('0x0'));module[_0x44b7('0x1')]={'name':{'type':Sequelize[_0x44b7('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x44b7('0x2')],'defaultValue':_0x44b7('0x3')},'description':{'type':Sequelize[_0x44b7('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index a925059..b0461b4 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 _0xe600=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Tag','includeAll','include','catch','show','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','fast-json-patch','request-promise'];(function(_0x14f6fa,_0x44743d){var _0x2c62a5=function(_0x398da0){while(--_0x398da0){_0x14f6fa['push'](_0x14f6fa['shift']());}};_0x2c62a5(++_0x44743d);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e60('0x1'));var rp=require(_0x0e60('0x2'));var moment=require(_0x0e60('0x3'));var BPromise=require(_0x0e60('0x4'));var Mustache=require(_0x0e60('0x5'));var util=require(_0x0e60('0x6'));var path=require(_0x0e60('0x7'));var sox=require(_0x0e60('0x8'));var csv=require(_0x0e60('0x9'));var ejs=require(_0x0e60('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e60('0xb'));var squel=require(_0x0e60('0xc'));var crypto=require(_0x0e60('0xd'));var jsforce=require(_0x0e60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e60('0x9'));var querystring=require(_0x0e60('0xf'));var Papa=require(_0x0e60('0x10'));var Redis=require(_0x0e60('0x11'));var authService=require(_0x0e60('0x12'));var qs=require(_0x0e60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e60('0x14'));var logger=require(_0x0e60('0x15'))(_0x0e60('0x16'));var utils=require(_0x0e60('0x17'));var config=require(_0x0e60('0x18'));var licenseUtil=require(_0x0e60('0x19'));var db=require(_0x0e60('0x1a'))['db'];function respondWithStatusCode(_0x2f5ee4,_0x540411){_0x540411=_0x540411||0xcc;return function(_0x2d848f){if(_0x2d848f){return _0x2f5ee4[_0x0e60('0x1b')](_0x540411);}return _0x2f5ee4[_0x0e60('0x1c')](_0x540411)[_0x0e60('0x1d')]();};}function respondWithResult(_0x45328b,_0x37bf95){_0x37bf95=_0x37bf95||0xc8;return function(_0x5d7f84){if(_0x5d7f84){return _0x45328b[_0x0e60('0x1c')](_0x37bf95)['json'](_0x5d7f84);}};}function respondWithFilteredResult(_0x91cd1,_0x128887){return function(_0x170890){if(_0x170890){var _0x5ab4ba=typeof _0x128887[_0x0e60('0x1e')]===_0x0e60('0x1f')&&typeof _0x128887[_0x0e60('0x20')]===_0x0e60('0x1f');var _0x2e6270=_0x170890['count'];var _0x992490=_0x5ab4ba?0x0:_0x128887[_0x0e60('0x1e')];var _0x599c1d=_0x5ab4ba?_0x170890[_0x0e60('0x21')]:_0x128887[_0x0e60('0x1e')]+_0x128887[_0x0e60('0x20')];var _0x504b31;if(_0x599c1d>=_0x2e6270){_0x599c1d=_0x2e6270;_0x504b31=0xc8;}else{_0x504b31=0xce;}_0x91cd1[_0x0e60('0x1c')](_0x504b31);return _0x91cd1['set'](_0x0e60('0x22'),_0x992490+'-'+_0x599c1d+'/'+_0x2e6270)[_0x0e60('0x23')](_0x170890);}return null;};}function patchUpdates(_0xb9f037){return function(_0xabf953){try{jsonpatch[_0x0e60('0x24')](_0xabf953,_0xb9f037,!![]);}catch(_0x31a63e){return BPromise[_0x0e60('0x25')](_0x31a63e);}return _0xabf953[_0x0e60('0x26')]();};}function saveUpdates(_0x352633,_0x10f875){return function(_0x22c0e0){if(_0x22c0e0){return _0x22c0e0[_0x0e60('0x27')](_0x352633)[_0x0e60('0x28')](function(_0x16985f){return _0x16985f;});}return null;};}function removeEntity(_0x4702f,_0x33f9f3){return function(_0x41642c){if(_0x41642c){return _0x41642c[_0x0e60('0x29')]()[_0x0e60('0x28')](function(){var _0x4ba1a8=_0x41642c[_0x0e60('0x2a')]({'plain':!![]});var _0x41ad9a='Tags';return db[_0x0e60('0x2b')]['destroy']({'where':{'type':_0x41ad9a,'resourceId':_0x4ba1a8['id']}})[_0x0e60('0x28')](function(){return _0x41642c;});})['then'](function(){_0x4702f['status'](0xcc)[_0x0e60('0x1d')]();});}};}function handleEntityNotFound(_0x39dae2,_0x526aaa){return function(_0x4eb9b8){if(!_0x4eb9b8){_0x39dae2[_0x0e60('0x1b')](0x194);}return _0x4eb9b8;};}function handleError(_0x54d7ce,_0x73e732){_0x73e732=_0x73e732||0x1f4;return function(_0x548919){logger['error'](_0x548919[_0x0e60('0x2c')]);if(_0x548919[_0x0e60('0x2d')]){delete _0x548919[_0x0e60('0x2d')];}_0x54d7ce['status'](_0x73e732)[_0x0e60('0x2e')](_0x548919);};}exports['index']=function(_0x2e22eb,_0x1d54c0){var _0x5beb5f={},_0x540c2c={},_0xc4a74c={'count':0x0,'rows':[]};var _0x1de60a=_[_0x0e60('0x2f')](db['Tag'][_0x0e60('0x30')],function(_0x3ea4ac){return{'name':_0x3ea4ac[_0x0e60('0x31')],'type':_0x3ea4ac[_0x0e60('0x32')][_0x0e60('0x33')]};});_0x540c2c['model']=_[_0x0e60('0x2f')](_0x1de60a,'name');_0x540c2c[_0x0e60('0x34')]=_['keys'](_0x2e22eb[_0x0e60('0x34')]);_0x540c2c[_0x0e60('0x35')]=_[_0x0e60('0x36')](_0x540c2c['model'],_0x540c2c[_0x0e60('0x34')]);_0x5beb5f[_0x0e60('0x37')]=_[_0x0e60('0x36')](_0x540c2c[_0x0e60('0x38')],qs[_0x0e60('0x39')](_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x39')]));_0x5beb5f[_0x0e60('0x37')]=_0x5beb5f[_0x0e60('0x37')][_0x0e60('0x3a')]?_0x5beb5f[_0x0e60('0x37')]:_0x540c2c[_0x0e60('0x38')];if(!_0x2e22eb['query'][_0x0e60('0x3b')](_0x0e60('0x3c'))){_0x5beb5f[_0x0e60('0x20')]=qs[_0x0e60('0x20')](_0x2e22eb['query']['limit']);_0x5beb5f[_0x0e60('0x1e')]=qs['offset'](_0x2e22eb[_0x0e60('0x34')]['offset']);}_0x5beb5f[_0x0e60('0x3d')]=qs[_0x0e60('0x3e')](_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x3e')]);_0x5beb5f[_0x0e60('0x3f')]=qs[_0x0e60('0x35')](_[_0x0e60('0x40')](_0x2e22eb[_0x0e60('0x34')],_0x540c2c[_0x0e60('0x35')]),_0x1de60a);if(_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x41')]){_0x5beb5f[_0x0e60('0x3f')]=_['merge'](_0x5beb5f[_0x0e60('0x3f')],{'$or':_['map'](_0x1de60a,function(_0x345a12){if(_0x345a12[_0x0e60('0x32')]!=='VIRTUAL'){var _0x482583={};_0x482583[_0x345a12[_0x0e60('0x2d')]]={'$like':'%'+_0x2e22eb[_0x0e60('0x34')]['filter']+'%'};return _0x482583;}})});}_0x5beb5f=_[_0x0e60('0x42')]({},_0x5beb5f,_0x2e22eb[_0x0e60('0x43')]);var _0x50090c={'where':_0x5beb5f[_0x0e60('0x3f')]};return db[_0x0e60('0x44')][_0x0e60('0x21')](_0x50090c)[_0x0e60('0x28')](function(_0x3ac0f0){_0xc4a74c[_0x0e60('0x21')]=_0x3ac0f0;if(_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x45')]){_0x5beb5f[_0x0e60('0x46')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x5beb5f);})['then'](function(_0x39c7d4){_0xc4a74c['rows']=_0x39c7d4;return _0xc4a74c;})[_0x0e60('0x28')](respondWithFilteredResult(_0x1d54c0,_0x5beb5f))[_0x0e60('0x47')](handleError(_0x1d54c0,null));};exports[_0x0e60('0x48')]=function(_0x4bfebf,_0x2b2354){var _0x2432a8={'raw':!![],'where':{'id':_0x4bfebf['params']['id']}},_0x4ce029={};_0x4ce029[_0x0e60('0x38')]=_[_0x0e60('0x49')](db[_0x0e60('0x44')][_0x0e60('0x30')]);_0x4ce029[_0x0e60('0x34')]=_[_0x0e60('0x49')](_0x4bfebf['query']);_0x4ce029[_0x0e60('0x35')]=_[_0x0e60('0x36')](_0x4ce029[_0x0e60('0x38')],_0x4ce029[_0x0e60('0x34')]);_0x2432a8[_0x0e60('0x37')]=_['intersection'](_0x4ce029['model'],qs['fields'](_0x4bfebf[_0x0e60('0x34')][_0x0e60('0x39')]));_0x2432a8[_0x0e60('0x37')]=_0x2432a8[_0x0e60('0x37')]['length']?_0x2432a8['attributes']:_0x4ce029['model'];if(_0x4bfebf[_0x0e60('0x34')][_0x0e60('0x45')]){_0x2432a8[_0x0e60('0x46')]=[{'all':!![]}];}_0x2432a8=_[_0x0e60('0x42')]({},_0x2432a8,_0x4bfebf[_0x0e60('0x43')]);return db['Tag']['find'](_0x2432a8)[_0x0e60('0x28')](handleEntityNotFound(_0x2b2354,null))[_0x0e60('0x28')](respondWithResult(_0x2b2354,null))[_0x0e60('0x47')](handleError(_0x2b2354,null));};exports[_0x0e60('0x4a')]=function(_0x4ad156,_0x36a999){return db[_0x0e60('0x44')][_0x0e60('0x4a')](_0x4ad156['body'],{})[_0x0e60('0x28')](function(_0xc6cee0){var _0x5e710d=_0x4ad156[_0x0e60('0x4b')]['get']({'plain':!![]});if(!_0x5e710d)throw new Error(_0x0e60('0x4c'));if(_0x5e710d[_0x0e60('0x4d')]===_0x0e60('0x4b')){var _0x2e887c=_0xc6cee0[_0x0e60('0x2a')]({'plain':!![]});var _0x4caeed=_0x0e60('0x4e');return db[_0x0e60('0x4f')][_0x0e60('0x50')]({'where':{'name':_0x4caeed,'userProfileId':_0x5e710d[_0x0e60('0x51')]},'raw':!![]})['then'](function(_0x19d7bc){if(_0x19d7bc&&_0x19d7bc[_0x0e60('0x52')]===0x0){return db[_0x0e60('0x2b')][_0x0e60('0x4a')]({'name':_0x2e887c['name'],'resourceId':_0x2e887c['id'],'type':_0x19d7bc[_0x0e60('0x2d')],'sectionId':_0x19d7bc['id']},{})['then'](function(){return _0xc6cee0;});}else{return _0xc6cee0;}})[_0x0e60('0x47')](function(_0x707dc6){logger[_0x0e60('0x53')](_0x0e60('0x54'),_0x707dc6);throw _0x707dc6;});}return _0xc6cee0;})[_0x0e60('0x28')](respondWithResult(_0x36a999,0xc9))[_0x0e60('0x47')](handleError(_0x36a999,null));};exports[_0x0e60('0x27')]=function(_0x49daf6,_0x124b8e){if(_0x49daf6['body']['id']){delete _0x49daf6[_0x0e60('0x55')]['id'];}return db[_0x0e60('0x44')][_0x0e60('0x50')]({'where':{'id':_0x49daf6[_0x0e60('0x56')]['id']}})['then'](handleEntityNotFound(_0x124b8e,null))['then'](saveUpdates(_0x49daf6[_0x0e60('0x55')],null))['then'](respondWithResult(_0x124b8e,null))[_0x0e60('0x47')](handleError(_0x124b8e,null));};exports[_0x0e60('0x29')]=function(_0x313dd2,_0x24ada9){return db[_0x0e60('0x44')][_0x0e60('0x50')]({'where':{'id':_0x313dd2[_0x0e60('0x56')]['id']}})[_0x0e60('0x28')](handleEntityNotFound(_0x24ada9,null))['then'](removeEntity(_0x24ada9,null))[_0x0e60('0x47')](handleError(_0x24ada9,null));}; \ No newline at end of file +var _0x8d9b=['filter','type','options','Tag','rows','params','length','includeAll','include','merge','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x289c45,_0x552084){var _0x46d1e7=function(_0x589742){while(--_0x589742){_0x289c45['push'](_0x289c45['shift']());}};_0x46d1e7(++_0x552084);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb8d9('0x0'));var rimraf=require(_0xb8d9('0x1'));var zipdir=require(_0xb8d9('0x2'));var jsonpatch=require(_0xb8d9('0x3'));var rp=require(_0xb8d9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb8d9('0x5'));var util=require('util');var path=require(_0xb8d9('0x6'));var sox=require(_0xb8d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8d9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8d9('0x9'));var toCsv=require(_0xb8d9('0xa'));var querystring=require(_0xb8d9('0xb'));var Papa=require(_0xb8d9('0xc'));var Redis=require(_0xb8d9('0xd'));var authService=require(_0xb8d9('0xe'));var qs=require(_0xb8d9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8d9('0x10'));var logger=require('../../config/logger')(_0xb8d9('0x11'));var utils=require(_0xb8d9('0x12'));var config=require(_0xb8d9('0x13'));var licenseUtil=require(_0xb8d9('0x14'));var db=require(_0xb8d9('0x15'))['db'];function respondWithStatusCode(_0x13b1d8,_0x10b7fe){_0x10b7fe=_0x10b7fe||0xcc;return function(_0x265472){if(_0x265472){return _0x13b1d8[_0xb8d9('0x16')](_0x10b7fe);}return _0x13b1d8[_0xb8d9('0x17')](_0x10b7fe)[_0xb8d9('0x18')]();};}function respondWithResult(_0x4b0f9,_0x1bcb02){_0x1bcb02=_0x1bcb02||0xc8;return function(_0xb3fa68){if(_0xb3fa68){return _0x4b0f9['status'](_0x1bcb02)[_0xb8d9('0x19')](_0xb3fa68);}};}function respondWithFilteredResult(_0x2c5265,_0x513edf){return function(_0x24f33a){if(_0x24f33a){var _0x283780=typeof _0x513edf['offset']==='undefined'&&typeof _0x513edf['limit']===_0xb8d9('0x1a');var _0x2d1b34=_0x24f33a[_0xb8d9('0x1b')];var _0x1183e4=_0x283780?0x0:_0x513edf['offset'];var _0x31b33f=_0x283780?_0x24f33a['count']:_0x513edf[_0xb8d9('0x1c')]+_0x513edf[_0xb8d9('0x1d')];var _0x447367;if(_0x31b33f>=_0x2d1b34){_0x31b33f=_0x2d1b34;_0x447367=0xc8;}else{_0x447367=0xce;}_0x2c5265[_0xb8d9('0x17')](_0x447367);return _0x2c5265[_0xb8d9('0x1e')]('Content-Range',_0x1183e4+'-'+_0x31b33f+'/'+_0x2d1b34)['json'](_0x24f33a);}return null;};}function patchUpdates(_0x5444a5){return function(_0x42f600){try{jsonpatch[_0xb8d9('0x1f')](_0x42f600,_0x5444a5,!![]);}catch(_0x15495f){return BPromise[_0xb8d9('0x20')](_0x15495f);}return _0x42f600[_0xb8d9('0x21')]();};}function saveUpdates(_0x48c504,_0x963afa){return function(_0x430794){if(_0x430794){return _0x430794[_0xb8d9('0x22')](_0x48c504)[_0xb8d9('0x23')](function(_0x3cefe3){return _0x3cefe3;});}return null;};}function removeEntity(_0x1d94aa,_0x3f4b9d){return function(_0x3d1659){if(_0x3d1659){return _0x3d1659[_0xb8d9('0x24')]()[_0xb8d9('0x23')](function(){var _0x52df47=_0x3d1659[_0xb8d9('0x25')]({'plain':!![]});var _0x49380d='Tags';return db[_0xb8d9('0x26')][_0xb8d9('0x24')]({'where':{'type':_0x49380d,'resourceId':_0x52df47['id']}})[_0xb8d9('0x23')](function(){return _0x3d1659;});})[_0xb8d9('0x23')](function(){_0x1d94aa[_0xb8d9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x241041,_0x282db6){return function(_0x3111aa){if(!_0x3111aa){_0x241041['sendStatus'](0x194);}return _0x3111aa;};}function handleError(_0x2d1439,_0x1c9bd4){_0x1c9bd4=_0x1c9bd4||0x1f4;return function(_0x336918){logger['error'](_0x336918[_0xb8d9('0x27')]);if(_0x336918[_0xb8d9('0x28')]){delete _0x336918['name'];}_0x2d1439[_0xb8d9('0x17')](_0x1c9bd4)[_0xb8d9('0x29')](_0x336918);};}exports[_0xb8d9('0x2a')]=function(_0x1b1212,_0x358e4d){var _0x84b01c={},_0x13120c={},_0x27ed72={'count':0x0,'rows':[]};var _0x8674fc=_[_0xb8d9('0x2b')](db['Tag'][_0xb8d9('0x2c')],function(_0x374def){return{'name':_0x374def[_0xb8d9('0x2d')],'type':_0x374def['type'][_0xb8d9('0x2e')]};});_0x13120c[_0xb8d9('0x2f')]=_[_0xb8d9('0x2b')](_0x8674fc,_0xb8d9('0x28'));_0x13120c[_0xb8d9('0x30')]=_[_0xb8d9('0x31')](_0x1b1212['query']);_0x13120c['filters']=_[_0xb8d9('0x32')](_0x13120c[_0xb8d9('0x2f')],_0x13120c[_0xb8d9('0x30')]);_0x84b01c[_0xb8d9('0x33')]=_[_0xb8d9('0x32')](_0x13120c[_0xb8d9('0x2f')],qs['fields'](_0x1b1212['query'][_0xb8d9('0x34')]));_0x84b01c[_0xb8d9('0x33')]=_0x84b01c[_0xb8d9('0x33')]['length']?_0x84b01c[_0xb8d9('0x33')]:_0x13120c['model'];if(!_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x35')](_0xb8d9('0x36'))){_0x84b01c['limit']=qs[_0xb8d9('0x1d')](_0x1b1212[_0xb8d9('0x30')]['limit']);_0x84b01c['offset']=qs[_0xb8d9('0x1c')](_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x1c')]);}_0x84b01c[_0xb8d9('0x37')]=qs[_0xb8d9('0x38')](_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x38')]);_0x84b01c[_0xb8d9('0x39')]=qs[_0xb8d9('0x3a')](_[_0xb8d9('0x3b')](_0x1b1212[_0xb8d9('0x30')],_0x13120c[_0xb8d9('0x3a')]),_0x8674fc);if(_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x3c')]){_0x84b01c['where']=_['merge'](_0x84b01c[_0xb8d9('0x39')],{'$or':_[_0xb8d9('0x2b')](_0x8674fc,function(_0x364bb1){if(_0x364bb1[_0xb8d9('0x3d')]!=='VIRTUAL'){var _0x4b1d71={};_0x4b1d71[_0x364bb1[_0xb8d9('0x28')]]={'$like':'%'+_0x1b1212['query'][_0xb8d9('0x3c')]+'%'};return _0x4b1d71;}})});}_0x84b01c=_['merge']({},_0x84b01c,_0x1b1212[_0xb8d9('0x3e')]);var _0x5ae97b={'where':_0x84b01c[_0xb8d9('0x39')]};return db[_0xb8d9('0x3f')][_0xb8d9('0x1b')](_0x5ae97b)['then'](function(_0x40fd3e){_0x27ed72[_0xb8d9('0x1b')]=_0x40fd3e;if(_0x1b1212[_0xb8d9('0x30')]['includeAll']){_0x84b01c['include']=[{'all':!![]}];}return db['Tag']['findAll'](_0x84b01c);})['then'](function(_0xc1816a){_0x27ed72[_0xb8d9('0x40')]=_0xc1816a;return _0x27ed72;})[_0xb8d9('0x23')](respondWithFilteredResult(_0x358e4d,_0x84b01c))['catch'](handleError(_0x358e4d,null));};exports['show']=function(_0x142e54,_0x496d4f){var _0x13f7ce={'raw':!![],'where':{'id':_0x142e54[_0xb8d9('0x41')]['id']}},_0x25ae38={};_0x25ae38[_0xb8d9('0x2f')]=_[_0xb8d9('0x31')](db['Tag'][_0xb8d9('0x2c')]);_0x25ae38[_0xb8d9('0x30')]=_['keys'](_0x142e54[_0xb8d9('0x30')]);_0x25ae38[_0xb8d9('0x3a')]=_['intersection'](_0x25ae38['model'],_0x25ae38[_0xb8d9('0x30')]);_0x13f7ce[_0xb8d9('0x33')]=_[_0xb8d9('0x32')](_0x25ae38[_0xb8d9('0x2f')],qs[_0xb8d9('0x34')](_0x142e54['query'][_0xb8d9('0x34')]));_0x13f7ce[_0xb8d9('0x33')]=_0x13f7ce[_0xb8d9('0x33')][_0xb8d9('0x42')]?_0x13f7ce[_0xb8d9('0x33')]:_0x25ae38[_0xb8d9('0x2f')];if(_0x142e54['query'][_0xb8d9('0x43')]){_0x13f7ce[_0xb8d9('0x44')]=[{'all':!![]}];}_0x13f7ce=_[_0xb8d9('0x45')]({},_0x13f7ce,_0x142e54[_0xb8d9('0x3e')]);return db[_0xb8d9('0x3f')][_0xb8d9('0x46')](_0x13f7ce)['then'](handleEntityNotFound(_0x496d4f,null))[_0xb8d9('0x23')](respondWithResult(_0x496d4f,null))[_0xb8d9('0x47')](handleError(_0x496d4f,null));};exports['create']=function(_0x212310,_0x41f38b){return db['Tag']['create'](_0x212310[_0xb8d9('0x48')],{})[_0xb8d9('0x23')](function(_0x3c2a57){var _0xca2c82=_0x212310[_0xb8d9('0x49')][_0xb8d9('0x25')]({'plain':!![]});if(!_0xca2c82)throw new Error(_0xb8d9('0x4a'));if(_0xca2c82['role']===_0xb8d9('0x49')){var _0x431c21=_0x3c2a57[_0xb8d9('0x25')]({'plain':!![]});var _0x53575d=_0xb8d9('0x4b');return db[_0xb8d9('0x4c')]['find']({'where':{'name':_0x53575d,'userProfileId':_0xca2c82['userProfileId']},'raw':!![]})[_0xb8d9('0x23')](function(_0x213915){if(_0x213915&&_0x213915['autoAssociation']===0x0){return db[_0xb8d9('0x26')][_0xb8d9('0x4d')]({'name':_0x431c21[_0xb8d9('0x28')],'resourceId':_0x431c21['id'],'type':_0x213915[_0xb8d9('0x28')],'sectionId':_0x213915['id']},{})['then'](function(){return _0x3c2a57;});}else{return _0x3c2a57;}})[_0xb8d9('0x47')](function(_0x3d7ea6){logger[_0xb8d9('0x4e')](_0xb8d9('0x4f'),_0x3d7ea6);throw _0x3d7ea6;});}return _0x3c2a57;})[_0xb8d9('0x23')](respondWithResult(_0x41f38b,0xc9))[_0xb8d9('0x47')](handleError(_0x41f38b,null));};exports[_0xb8d9('0x22')]=function(_0x518bb4,_0x3101da){if(_0x518bb4['body']['id']){delete _0x518bb4[_0xb8d9('0x48')]['id'];}return db[_0xb8d9('0x3f')][_0xb8d9('0x46')]({'where':{'id':_0x518bb4['params']['id']}})[_0xb8d9('0x23')](handleEntityNotFound(_0x3101da,null))[_0xb8d9('0x23')](saveUpdates(_0x518bb4[_0xb8d9('0x48')],null))[_0xb8d9('0x23')](respondWithResult(_0x3101da,null))[_0xb8d9('0x47')](handleError(_0x3101da,null));};exports[_0xb8d9('0x24')]=function(_0x4533e5,_0x3480d1){return db[_0xb8d9('0x3f')][_0xb8d9('0x46')]({'where':{'id':_0x4533e5[_0xb8d9('0x41')]['id']}})['then'](handleEntityNotFound(_0x3480d1,null))[_0xb8d9('0x23')](removeEntity(_0x3480d1,null))[_0xb8d9('0x47')](handleError(_0x3480d1,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 0f3c8d7..75ce018 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 _0xb8a4=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','tools_tags','util'];(function(_0x27c24d,_0x2b50f1){var _0x14e722=function(_0x2422ad){while(--_0x2422ad){_0x27c24d['push'](_0x27c24d['shift']());}};_0x14e722(++_0x2b50f1);}(_0xb8a4,0x83));var _0x4b8a=function(_0x4f2dfa,_0x2be505){_0x4f2dfa=_0x4f2dfa-0x0;var _0x1eebd2=_0xb8a4[_0x4f2dfa];return _0x1eebd2;};'use strict';var _=require('lodash');var util=require(_0x4b8a('0x0'));var logger=require(_0x4b8a('0x1'))(_0x4b8a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4b8a('0x3'));var fs=require('fs');var path=require(_0x4b8a('0x4'));var rimraf=require(_0x4b8a('0x5'));var config=require(_0x4b8a('0x6'));var attributes=require(_0x4b8a('0x7'));module[_0x4b8a('0x8')]=function(_0x149596,_0x269cd7){return _0x149596[_0x4b8a('0x9')]('Tag',attributes,{'tableName':_0x4b8a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39a0=['./tag.attributes','exports','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xbf78f7,_0x3b955f){var _0x35da95=function(_0x4fbb5e){while(--_0x4fbb5e){_0xbf78f7['push'](_0xbf78f7['shift']());}};_0x35da95(++_0x3b955f);}(_0x39a0,0x7b));var _0x039a=function(_0x36c5a0,_0x5acca5){_0x36c5a0=_0x36c5a0-0x0;var _0x47af7a=_0x39a0[_0x36c5a0];return _0x47af7a;};'use strict';var _=require(_0x039a('0x0'));var util=require(_0x039a('0x1'));var logger=require(_0x039a('0x2'))(_0x039a('0x3'));var moment=require(_0x039a('0x4'));var BPromise=require(_0x039a('0x5'));var rp=require(_0x039a('0x6'));var fs=require('fs');var path=require(_0x039a('0x7'));var rimraf=require(_0x039a('0x8'));var config=require('../../config/environment');var attributes=require(_0x039a('0x9'));module[_0x039a('0xa')]=function(_0x4e09d4,_0x3ad7b0){return _0x4e09d4['define']('Tag',attributes,{'tableName':_0x039a('0xb'),'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 33db51a..7b1c0a6 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 _0x32ef=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x2742bc,_0x4286ad){var _0x38f8c2=function(_0x1ae199){while(--_0x1ae199){_0x2742bc['push'](_0x2742bc['shift']());}};_0x38f8c2(++_0x4286ad);}(_0x32ef,0xf9));var _0xf32e=function(_0x1e3c4a,_0x1c35cc){_0x1e3c4a=_0x1e3c4a-0x0;var _0x439074=_0x32ef[_0x1e3c4a];return _0x439074;};'use strict';var _=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var moment=require(_0xf32e('0x2'));var BPromise=require(_0xf32e('0x3'));var rs=require(_0xf32e('0x4'));var fs=require('fs');var Redis=require(_0xf32e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf32e('0x6'));var logger=require(_0xf32e('0x7'))('rpc');var config=require(_0xf32e('0x8'));var jayson=require(_0xf32e('0x9'));var client=jayson[_0xf32e('0xa')][_0xf32e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xefc0a7,_0x899efc,_0x5aa5c8){return new BPromise(function(_0xdac5e,_0x5b3463){return client[_0xf32e('0xc')](_0xefc0a7,_0x5aa5c8)[_0xf32e('0xd')](function(_0xc37ea7){logger[_0xf32e('0xe')](_0xf32e('0xf'),_0x899efc,'request\x20sent');logger[_0xf32e('0x10')](_0xf32e('0x11'),_0x899efc,_0xf32e('0x12'),JSON[_0xf32e('0x13')](_0xc37ea7));if(_0xc37ea7[_0xf32e('0x14')]){if(_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x15')]===0x1f4){logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x16')]);return _0x5b3463(_0xc37ea7['error'][_0xf32e('0x16')]);}logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0xc37ea7[_0xf32e('0x14')][_0xf32e('0x16')]);return _0xdac5e(_0xc37ea7[_0xf32e('0x14')]['message']);}else{logger[_0xf32e('0xe')](_0xf32e('0xf'),_0x899efc,_0xf32e('0x12'));_0xdac5e(_0xc37ea7[_0xf32e('0x17')][_0xf32e('0x16')]);}})[_0xf32e('0x18')](function(_0x6a0231){logger[_0xf32e('0x14')](_0xf32e('0xf'),_0x899efc,_0x6a0231);_0x5b3463(_0x6a0231);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x008c,0x188));var _0xc008=function(_0x5e03fc,_0x1b5ed7){_0x5e03fc=_0x5e03fc-0x0;var _0x116ada=_0x008c[_0x5e03fc];return _0x116ada;};'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});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('Tag,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('Tag,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('Tag,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('Tag,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 3d99412..250fa58 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 73a1a5f..fca6a9d 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 _0x757a=['exports','STRING'];(function(_0x49f601,_0x4d7500){var _0x1b73b9=function(_0x2282c5){while(--_0x2282c5){_0x49f601['push'](_0x49f601['shift']());}};_0x1b73b9(++_0x4d7500);}(_0x757a,0xde));var _0xa757=function(_0x25b482,_0xc0818c){_0x25b482=_0x25b482-0x0;var _0x8670b1=_0x757a[_0x25b482];return _0x8670b1;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x24b122,_0x4a667c){var _0x4652fd=function(_0x3a62eb){while(--_0x3a62eb){_0x24b122['push'](_0x24b122['shift']());}};_0x4652fd(++_0x4a667c);}(_0x757a,0xde));var _0xa757=function(_0x5ef013,_0x2a3eae){_0x5ef013=_0x5ef013-0x0;var _0x3106a0=_0x757a[_0x5ef013];return _0x3106a0;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 119d926..6e8a75c 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 _0x394d=['Mail','Sms','Fax','Openchannel','Whatsapp','transaction','TeamVoiceQueue','penalty','User','findOrCreate','QueueId','online','voicePause','UserVoiceQueueRt','upsert','interface','format','SIP/%s','all','UserVoicePrefix','addAgents','removeAgents','emit','VoicePrefixId','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','Team','findAll','rows','catch','show','params','keys','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','find','autoAssociation','UserProfileResource','body','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','getQueues','findOne','channel','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','ValidationError','add','remove','isArray','ids','Voice','Chat'];(function(_0x4165de,_0x12b90d){var _0x1852f9=function(_0x15535f){while(--_0x15535f){_0x4165de['push'](_0x4165de['shift']());}};_0x1852f9(++_0x12b90d);}(_0x394d,0x1ee));var _0xd394=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x394d[_0x1deb03];return _0x189fe7;};'use strict';var emlformat=require(_0xd394('0x0'));var rimraf=require(_0xd394('0x1'));var zipdir=require(_0xd394('0x2'));var jsonpatch=require(_0xd394('0x3'));var rp=require(_0xd394('0x4'));var moment=require(_0xd394('0x5'));var BPromise=require(_0xd394('0x6'));var Mustache=require('mustache');var util=require(_0xd394('0x7'));var path=require(_0xd394('0x8'));var sox=require(_0xd394('0x9'));var csv=require(_0xd394('0xa'));var ejs=require(_0xd394('0xb'));var fs=require('fs');var fs_extra=require(_0xd394('0xc'));var _=require(_0xd394('0xd'));var squel=require(_0xd394('0xe'));var crypto=require('crypto');var jsforce=require(_0xd394('0xf'));var deskjs=require(_0xd394('0x10'));var toCsv=require(_0xd394('0xa'));var querystring=require(_0xd394('0x11'));var Papa=require(_0xd394('0x12'));var Redis=require(_0xd394('0x13'));var authService=require(_0xd394('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd394('0x15'));var logger=require('../../config/logger')(_0xd394('0x16'));var utils=require(_0xd394('0x17'));var config=require(_0xd394('0x18'));var licenseUtil=require(_0xd394('0x19'));var db=require(_0xd394('0x1a'))['db'];config[_0xd394('0x1b')]=_[_0xd394('0x1c')](config['redis'],{'host':_0xd394('0x1d'),'port':0x18eb});var socket=require(_0xd394('0x1e'))(new Redis(config[_0xd394('0x1b')]));require(_0xd394('0x1f'))[_0xd394('0x20')](socket);function respondWithStatusCode(_0x1f0359,_0x5b95ef){_0x5b95ef=_0x5b95ef||0xcc;return function(_0x455d33){if(_0x455d33){return _0x1f0359['sendStatus'](_0x5b95ef);}return _0x1f0359[_0xd394('0x21')](_0x5b95ef)[_0xd394('0x22')]();};}function respondWithResult(_0x580590,_0x28cde1){_0x28cde1=_0x28cde1||0xc8;return function(_0x2e83fe){if(_0x2e83fe){return _0x580590['status'](_0x28cde1)[_0xd394('0x23')](_0x2e83fe);}};}function respondWithFilteredResult(_0x559839,_0x44f01f){return function(_0x46c917){if(_0x46c917){var _0x45d1d8=typeof _0x44f01f[_0xd394('0x24')]==='undefined'&&typeof _0x44f01f['limit']===_0xd394('0x25');var _0x1f4cc1=_0x46c917[_0xd394('0x26')];var _0x539ee4=_0x45d1d8?0x0:_0x44f01f[_0xd394('0x24')];var _0x5a13c8=_0x45d1d8?_0x46c917[_0xd394('0x26')]:_0x44f01f[_0xd394('0x24')]+_0x44f01f[_0xd394('0x27')];var _0x13ee6;if(_0x5a13c8>=_0x1f4cc1){_0x5a13c8=_0x1f4cc1;_0x13ee6=0xc8;}else{_0x13ee6=0xce;}_0x559839[_0xd394('0x21')](_0x13ee6);return _0x559839[_0xd394('0x28')]('Content-Range',_0x539ee4+'-'+_0x5a13c8+'/'+_0x1f4cc1)['json'](_0x46c917);}return null;};}function patchUpdates(_0x5d0fd2){return function(_0x152c1c){try{jsonpatch['apply'](_0x152c1c,_0x5d0fd2,!![]);}catch(_0xea00ed){return BPromise[_0xd394('0x29')](_0xea00ed);}return _0x152c1c[_0xd394('0x2a')]();};}function saveUpdates(_0x2f5280,_0x1cf3be){return function(_0xd70f0){if(_0xd70f0){return _0xd70f0[_0xd394('0x2b')](_0x2f5280)[_0xd394('0x2c')](function(_0x2494d2){return _0x2494d2;});}return null;};}function handleEntityNotFound(_0x4220c0,_0x375ead){return function(_0x232496){if(!_0x232496){_0x4220c0[_0xd394('0x2d')](0x194);}return _0x232496;};}function handleError(_0x126f44,_0x15ac5e){_0x15ac5e=_0x15ac5e||0x1f4;return function(_0x5a32cc){logger[_0xd394('0x2e')](_0x5a32cc['stack']);if(_0x5a32cc[_0xd394('0x2f')]){delete _0x5a32cc[_0xd394('0x2f')];}_0x126f44[_0xd394('0x21')](_0x15ac5e)[_0xd394('0x30')](_0x5a32cc);};}exports[_0xd394('0x31')]=function(_0x5af372,_0x3399e0){var _0x251ebf={},_0x3f8671={},_0x212e48={'count':0x0,'rows':[]};var _0x1af9fc=_[_0xd394('0x32')](db['Team'][_0xd394('0x33')],function(_0xca59fe){return{'name':_0xca59fe[_0xd394('0x34')],'type':_0xca59fe[_0xd394('0x35')]['key']};});_0x3f8671['model']=_[_0xd394('0x32')](_0x1af9fc,'name');_0x3f8671[_0xd394('0x36')]=_['keys'](_0x5af372[_0xd394('0x36')]);_0x3f8671[_0xd394('0x37')]=_[_0xd394('0x38')](_0x3f8671[_0xd394('0x39')],_0x3f8671[_0xd394('0x36')]);_0x251ebf[_0xd394('0x3a')]=_['intersection'](_0x3f8671[_0xd394('0x39')],qs[_0xd394('0x3b')](_0x5af372['query'][_0xd394('0x3b')]));_0x251ebf['attributes']=_0x251ebf[_0xd394('0x3a')][_0xd394('0x3c')]?_0x251ebf[_0xd394('0x3a')]:_0x3f8671['model'];if(!_0x5af372['query']['hasOwnProperty'](_0xd394('0x3d'))){_0x251ebf[_0xd394('0x27')]=qs[_0xd394('0x27')](_0x5af372['query']['limit']);_0x251ebf[_0xd394('0x24')]=qs[_0xd394('0x24')](_0x5af372[_0xd394('0x36')]['offset']);}_0x251ebf[_0xd394('0x3e')]=qs[_0xd394('0x3f')](_0x5af372[_0xd394('0x36')][_0xd394('0x3f')]);_0x251ebf[_0xd394('0x40')]=qs[_0xd394('0x37')](_['pick'](_0x5af372[_0xd394('0x36')],_0x3f8671[_0xd394('0x37')]),_0x1af9fc);if(_0x5af372[_0xd394('0x36')][_0xd394('0x41')]){_0x251ebf[_0xd394('0x40')]=_[_0xd394('0x42')](_0x251ebf[_0xd394('0x40')],{'$or':_[_0xd394('0x32')](_0x1af9fc,function(_0x38a079){if(_0x38a079[_0xd394('0x35')]!==_0xd394('0x43')){var _0x487d7d={};_0x487d7d[_0x38a079[_0xd394('0x2f')]]={'$like':'%'+_0x5af372['query'][_0xd394('0x41')]+'%'};return _0x487d7d;}})});}_0x251ebf=_[_0xd394('0x42')]({},_0x251ebf,_0x5af372[_0xd394('0x44')]);var _0x3ab8f1={'where':_0x251ebf[_0xd394('0x40')]};return db['Team'][_0xd394('0x26')](_0x3ab8f1)['then'](function(_0x3bc328){_0x212e48[_0xd394('0x26')]=_0x3bc328;if(_0x5af372[_0xd394('0x36')][_0xd394('0x45')]){_0x251ebf['include']=[{'all':!![]}];}return db[_0xd394('0x46')][_0xd394('0x47')](_0x251ebf);})[_0xd394('0x2c')](function(_0x1b662b){_0x212e48[_0xd394('0x48')]=_0x1b662b;return _0x212e48;})[_0xd394('0x2c')](respondWithFilteredResult(_0x3399e0,_0x251ebf))[_0xd394('0x49')](handleError(_0x3399e0,null));};exports[_0xd394('0x4a')]=function(_0x780602,_0x15064d){var _0xdfa2ef={'raw':![],'where':{'id':_0x780602[_0xd394('0x4b')]['id']}},_0x2508c1={};_0x2508c1[_0xd394('0x39')]=_[_0xd394('0x4c')](db['Team'][_0xd394('0x33')]);_0x2508c1['query']=_[_0xd394('0x4c')](_0x780602[_0xd394('0x36')]);_0x2508c1[_0xd394('0x37')]=_[_0xd394('0x38')](_0x2508c1[_0xd394('0x39')],_0x2508c1[_0xd394('0x36')]);_0xdfa2ef['attributes']=_[_0xd394('0x38')](_0x2508c1[_0xd394('0x39')],qs['fields'](_0x780602[_0xd394('0x36')]['fields']));_0xdfa2ef[_0xd394('0x3a')]=_0xdfa2ef[_0xd394('0x3a')]['length']?_0xdfa2ef[_0xd394('0x3a')]:_0x2508c1[_0xd394('0x39')];if(_0x780602[_0xd394('0x36')][_0xd394('0x45')]){_0xdfa2ef['include']=[{'all':!![]}];}_0xdfa2ef=_['merge']({},_0xdfa2ef,_0x780602[_0xd394('0x44')]);return db[_0xd394('0x46')]['find'](_0xdfa2ef)[_0xd394('0x2c')](handleEntityNotFound(_0x15064d,null))['then'](respondWithResult(_0x15064d,null))[_0xd394('0x49')](handleError(_0x15064d,null));};exports[_0xd394('0x4d')]=function(_0x161d1a,_0x2673e6){return db[_0xd394('0x46')][_0xd394('0x4d')](_0x161d1a['body'],{})['then'](function(_0x316e49){var _0x430e48=_0x161d1a['user'][_0xd394('0x4e')]({'plain':!![]});if(!_0x430e48)throw new Error(_0xd394('0x4f'));if(_0x430e48[_0xd394('0x50')]===_0xd394('0x51')){var _0x4f8fed=_0x316e49[_0xd394('0x4e')]({'plain':!![]});var _0x250bf8=_0xd394('0x52');return db[_0xd394('0x53')][_0xd394('0x54')]({'where':{'name':_0x250bf8,'userProfileId':_0x430e48['userProfileId']},'raw':!![]})['then'](function(_0x27c31b){if(_0x27c31b&&_0x27c31b[_0xd394('0x55')]===0x0){return db[_0xd394('0x56')]['create']({'name':_0x4f8fed['name'],'resourceId':_0x4f8fed['id'],'type':_0x27c31b[_0xd394('0x2f')],'sectionId':_0x27c31b['id']},{})[_0xd394('0x2c')](function(){return _0x316e49;});}else{return _0x316e49;}})[_0xd394('0x49')](function(_0xb4f236){logger[_0xd394('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb4f236);throw _0xb4f236;});}return _0x316e49;})[_0xd394('0x2c')](respondWithResult(_0x2673e6,0xc9))['catch'](handleError(_0x2673e6,null));};exports[_0xd394('0x2b')]=function(_0x438c04,_0x58b318){if(_0x438c04[_0xd394('0x57')]['id']){delete _0x438c04[_0xd394('0x57')]['id'];}return db[_0xd394('0x46')][_0xd394('0x54')]({'where':{'id':_0x438c04['params']['id']}})[_0xd394('0x2c')](handleEntityNotFound(_0x58b318,null))['then'](saveUpdates(_0x438c04[_0xd394('0x57')],null))[_0xd394('0x2c')](respondWithResult(_0x58b318,null))[_0xd394('0x49')](handleError(_0x58b318,null));};exports['destroy']=function(_0x22f584,_0x6cbe1b){var _0x577ee9=_0x22f584[_0xd394('0x4b')]['id'];var _0x5e2350=[];return db[_0xd394('0x58')]['transaction'](function(_0x3c8825){var _0x38c0c3=_0xd394('0x59')+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0x38c0c3,{'type':db['Sequelize']['QueryTypes'][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825})[_0xd394('0x2c')](function(_0x3c1243){_0x5e2350=_[_0xd394('0x32')](_0x3c1243,function(_0x3b70b8){return Number(_0x3b70b8[_0xd394('0x5b')]);});})[_0xd394('0x2c')](function(){var _0x22f33b=_0xd394('0x5c')+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0x22f33b,{'type':db[_0xd394('0x5d')][_0xd394('0x5e')]['SELECT'],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x49c976){var _0x334f45=_[_0xd394('0x32')](_0x49c976,function(_0x557fe8){return Number(_0x557fe8[_0xd394('0x5f')]);});return db[_0xd394('0x60')][_0xd394('0x61')]({'where':{'UserId':{'$in':_0x5e2350},'VoiceQueueId':{'$in':_0x334f45}},'transaction':_0x3c8825});})[_0xd394('0x2c')](function(){var _0x4b326f=_0xd394('0x62')+_0x577ee9;return db[_0xd394('0x58')]['query'](_0x4b326f,{'type':db[_0xd394('0x5d')]['QueryTypes'][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x5c12d7){var _0x173815=_[_0xd394('0x32')](_0x5c12d7,function(_0x3f1e07){return Number(_0x3f1e07[_0xd394('0x63')]);});return db[_0xd394('0x64')][_0xd394('0x61')]({'where':{'UserId':{'$in':_0x5e2350},'MailQueueId':{'$in':_0x173815}},'transaction':_0x3c8825});})[_0xd394('0x2c')](function(){var _0xb5cd07=_0xd394('0x65')+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0xb5cd07,{'type':db[_0xd394('0x5d')][_0xd394('0x5e')][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825});})['then'](function(_0x2e06f3){var _0x149199=_[_0xd394('0x32')](_0x2e06f3,function(_0xac79a4){return Number(_0xac79a4['SmsQueueId']);});return db[_0xd394('0x66')][_0xd394('0x61')]({'where':{'UserId':{'$in':_0x5e2350},'SmsQueueId':{'$in':_0x149199}},'transaction':_0x3c8825});})[_0xd394('0x2c')](function(){var _0x5df391='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x577ee9;return db['sequelize']['query'](_0x5df391,{'type':db[_0xd394('0x5d')][_0xd394('0x5e')]['SELECT'],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x5b4e67){var _0x2bd875=_['map'](_0x5b4e67,function(_0x49e41e){return Number(_0x49e41e[_0xd394('0x67')]);});return db[_0xd394('0x68')]['destroy']({'where':{'UserId':{'$in':_0x5e2350},'ChatQueueId':{'$in':_0x2bd875}},'transaction':_0x3c8825});})['then'](function(){var _0xb19ea0=_0xd394('0x69')+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0xb19ea0,{'type':db['Sequelize'][_0xd394('0x5e')][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x446321){var _0x2dd8f0=_[_0xd394('0x32')](_0x446321,function(_0x19491c){return Number(_0x19491c['FaxQueueId']);});return db[_0xd394('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x5e2350},'FaxQueueId':{'$in':_0x2dd8f0}},'transaction':_0x3c8825});})[_0xd394('0x2c')](function(){var _0xc7e6d8='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0xc7e6d8,{'type':db['Sequelize'][_0xd394('0x5e')][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x305747){var _0x106a45=_[_0xd394('0x32')](_0x305747,function(_0x4f8057){return Number(_0x4f8057[_0xd394('0x6b')]);});return db[_0xd394('0x6c')][_0xd394('0x61')]({'where':{'UserId':{'$in':_0x5e2350},'OpenchannelQueueId':{'$in':_0x106a45}},'transaction':_0x3c8825});})['then'](function(){var _0x418fcc=_0xd394('0x6d')+_0x577ee9;return db[_0xd394('0x58')][_0xd394('0x36')](_0x418fcc,{'type':db[_0xd394('0x5d')][_0xd394('0x5e')][_0xd394('0x5a')],'raw':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x544d03){var _0x1c4277=_['map'](_0x544d03,function(_0x101692){return Number(_0x101692[_0xd394('0x6e')]);});return db[_0xd394('0x6f')]['destroy']({'where':{'UserId':{'$in':_0x5e2350},'WhatsappQueueId':{'$in':_0x1c4277}},'transaction':_0x3c8825});})['then'](function(){return db[_0xd394('0x70')]['find']({'where':{'TeamId':_0x577ee9}});})[_0xd394('0x2c')](function(_0x201680){if(_0x201680===null){return;}return db['UserVoicePrefix'][_0xd394('0x61')]({'where':{'UserId':{'$in':_0x5e2350},'VoicePrefixId':_0x201680['VoicePrefixId']},'transaction':_0x3c8825});})[_0xd394('0x2c')](function(){return db[_0xd394('0x46')][_0xd394('0x61')]({'where':{'id':_0x577ee9},'cascade':!![],'transaction':_0x3c8825});})[_0xd394('0x2c')](function(_0x1d857d){if(_0x1d857d===0x0){_0x6cbe1b[_0xd394('0x2d')](0x194);}else{return db[_0xd394('0x56')][_0xd394('0x61')]({'where':{'type':_0xd394('0x52'),'resourceId':_0x577ee9},'cascade':!![],'transaction':_0x3c8825})[_0xd394('0x2c')](function(){_0x6cbe1b[_0xd394('0x21')](0xcc)[_0xd394('0x22')]();});}})[_0xd394('0x49')](function(_0x19a1e0){_0x6cbe1b[_0xd394('0x21')](0x1f4)['send'](_0x19a1e0);});});};exports[_0xd394('0x71')]=function(_0xa03ce6,_0x562941,_0x2d77cd){return db['Team'][_0xd394('0x72')]({'where':{'id':_0xa03ce6[_0xd394('0x4b')]['id']}})['then'](handleEntityNotFound(_0x562941,null))[_0xd394('0x2c')](function(_0x5dfa39){if(!_0xa03ce6['query'][_0xd394('0x73')]||!utils['isValidChannel'](_0xa03ce6[_0xd394('0x36')]['channel'])){throw new db[(_0xd394('0x5d'))]['ValidationError'](_0xd394('0x74'));}var _0x1a1990={};var _0x4c6588={};_0x4c6588['model']=_[_0xd394('0x4c')](db[_[_0xd394('0x75')](_0xa03ce6[_0xd394('0x36')]['channel'][_0xd394('0x76')]())+_0xd394('0x77')][_0xd394('0x33')]);_0x4c6588[_0xd394('0x36')]=_[_0xd394('0x4c')](_0xa03ce6['query']);_0x4c6588[_0xd394('0x37')]=_[_0xd394('0x38')](_0x4c6588[_0xd394('0x39')],_0x4c6588[_0xd394('0x36')]);_0x1a1990['attributes']=_[_0xd394('0x38')](_0x4c6588['model'],qs['fields'](_0xa03ce6[_0xd394('0x36')][_0xd394('0x3b')]));_0x1a1990[_0xd394('0x3a')]=_0x1a1990[_0xd394('0x3a')][_0xd394('0x3c')]?_0x1a1990[_0xd394('0x3a')]:_0x4c6588[_0xd394('0x39')];_0x1a1990[_0xd394('0x27')]=qs[_0xd394('0x27')](_0xa03ce6[_0xd394('0x36')][_0xd394('0x27')]);_0x1a1990[_0xd394('0x24')]=qs[_0xd394('0x24')](_0xa03ce6[_0xd394('0x36')][_0xd394('0x24')]);_0x1a1990[_0xd394('0x3e')]=qs[_0xd394('0x3f')](_0xa03ce6[_0xd394('0x36')][_0xd394('0x3f')]);_0x1a1990['where']=qs['filters'](_['pick'](_0xa03ce6[_0xd394('0x36')],_0x4c6588[_0xd394('0x37')]));_0x1a1990=_[_0xd394('0x42')]({},_0x1a1990,_0xa03ce6['options']);return _0x5dfa39[_0xd394('0x4e')+_['capitalize'](_0xa03ce6['query']['channel']['toLowerCase']())+_0xd394('0x78')](_0x1a1990);})[_0xd394('0x2c')](respondWithResult(_0x562941,null))[_0xd394('0x49')](handleError(_0x562941,null));};exports[_0xd394('0x79')]=function(_0x59157d,_0x12c5c9,_0xae6302){return db[_0xd394('0x46')][_0xd394('0x72')]({'where':{'id':_0x59157d['params']['id']}})[_0xd394('0x2c')](function(_0x4deeef){if(_0x4deeef){if(!_0x59157d['body'][_0xd394('0x73')]||!utils[_0xd394('0x7a')](_0x59157d[_0xd394('0x57')][_0xd394('0x73')])){throw new db[(_0xd394('0x5d'))][(_0xd394('0x7b'))](_0xd394('0x74'));}return _0x4deeef[_0xd394('0x7c')+_[_0xd394('0x75')](_0x59157d[_0xd394('0x57')][_0xd394('0x73')]['toLowerCase']())+'Queues'](_0x59157d[_0xd394('0x57')]['ids']);}return null;})[_0xd394('0x2c')](handleEntityNotFound(_0x12c5c9,null))[_0xd394('0x2c')](respondWithStatusCode(_0x12c5c9,null))[_0xd394('0x49')](handleError(_0x12c5c9,null));};exports['removeQueues']=function(_0x4329c6,_0x2ec4d8,_0x145c28){return db['Team'][_0xd394('0x72')]({'where':{'id':_0x4329c6['params']['id']}})['then'](function(_0x373ffa){if(_0x373ffa){if(!_0x4329c6[_0xd394('0x36')][_0xd394('0x73')]||!utils[_0xd394('0x7a')](_0x4329c6[_0xd394('0x36')]['channel'])){throw new db['Sequelize'][(_0xd394('0x7b'))](_0xd394('0x74'));}return _0x373ffa[_0xd394('0x7d')+_['capitalize'](_0x4329c6[_0xd394('0x36')][_0xd394('0x73')][_0xd394('0x76')]())+_0xd394('0x78')](_0x4329c6[_0xd394('0x36')]['ids']);}return null;})[_0xd394('0x2c')](handleEntityNotFound(_0x2ec4d8,null))[_0xd394('0x2c')](respondWithStatusCode(_0x2ec4d8,null))[_0xd394('0x49')](handleError(_0x2ec4d8,null));};exports['addAgents']=function(_0x2659ae,_0x1a80d5){var _0x45c12e=_[_0xd394('0x7e')](_0x2659ae['body']['ids'])?_0x2659ae[_0xd394('0x57')][_0xd394('0x7f')]:[_0x2659ae[_0xd394('0x57')]['ids']];var _0x279c0a=_0x2659ae['params']['id'];return db[_0xd394('0x46')]['find']({'where':{'id':_0x279c0a}})['then'](handleEntityNotFound(_0x1a80d5,null))[_0xd394('0x2c')](function(_0xeaa6d3){if(_0xeaa6d3){var _0xfcd9cb=[_0xd394('0x80'),_0xd394('0x81'),_0xd394('0x82'),_0xd394('0x83'),_0xd394('0x84'),_0xd394('0x85'),_0xd394('0x86')];return db[_0xd394('0x58')][_0xd394('0x87')](function(_0x85bf29){var _0x48b81d=_[_0xd394('0x32')](_0xfcd9cb,function(_0x5d1db1){var _0x3b11b={'attributes':['id','name']};if(_0x5d1db1==='Voice'){_0x3b11b['through']={'attributes':['penalty']};}return _0xeaa6d3[_0xd394('0x4e')+_0x5d1db1+_0xd394('0x78')](_0x3b11b)[_0xd394('0x2c')](function(_0x4faa6b){var _0x2f4f40=_[_0xd394('0x32')](_0x4faa6b,function(_0x4c1f0b){var _0x2ca999=_[_0xd394('0x32')](_0x45c12e,function(_0x1e03a7){var _0x7fb2e6={'where':{'UserId':_0x1e03a7,[_0x5d1db1+'QueueId']:_0x4c1f0b['id']},'transaction':_0x85bf29};if(_0x5d1db1===_0xd394('0x80')){_0x7fb2e6[_0xd394('0x1c')]={'penalty':_0x4c1f0b[_0xd394('0x88')][_0xd394('0x89')]};}return db[_0xd394('0x8a')+_0x5d1db1+_0xd394('0x77')][_0xd394('0x8b')](_0x7fb2e6)['then'](function(){socket['emit'](_0xd394('0x51')+_0x5d1db1+'Queue:save',{'UserId':_0x1e03a7,[_0x5d1db1+_0xd394('0x8c')]:_0x4c1f0b['id']});if(_0x5d1db1!==_0xd394('0x80')){return;}return db[_0xd394('0x8a')]['findAll']({'where':{'id':_0x45c12e,'online':0x1},'attributes':['id',_0xd394('0x2f'),_0xd394('0x8d'),_0xd394('0x8e'),'interface'],'raw':!![]})[_0xd394('0x2c')](function(_0x7527d8){var _0x1ff76c=_[_0xd394('0x32')](_0x7527d8,function(_0x1f02c6){return db[_0xd394('0x8f')][_0xd394('0x90')]({'membername':_0x1f02c6[_0xd394('0x2f')],'UserId':_0x1f02c6['id'],'queue_name':_0x4c1f0b[_0xd394('0x2f')],'VoiceQueueId':_0x4c1f0b['id'],'interface':_['isNil'](_0x1f02c6[_0xd394('0x91')])?util[_0xd394('0x92')](_0xd394('0x93'),_0x1f02c6['name']):_0x1f02c6[_0xd394('0x91')],'paused':_0x1f02c6[_0xd394('0x8e')]||![],'penalty':_0x4c1f0b[_0xd394('0x88')][_0xd394('0x89')]},{'transaction':_0x85bf29});});return Promise[_0xd394('0x94')](_0x1ff76c);});});});return Promise['all'](_0x2ca999);});return Promise[_0xd394('0x94')](_0x2f4f40);})[_0xd394('0x2c')](function(){return db[_0xd394('0x70')][_0xd394('0x72')]({'where':{'teamId':_0x279c0a}})[_0xd394('0x2c')](function(_0x404cbf){if(_0x404cbf){var _0x5066b3=_[_0xd394('0x32')](_0x45c12e,function(_0x354e5f){db[_0xd394('0x95')][_0xd394('0x90')]({'UserId':_0x354e5f,'VoicePrefixId':_0x404cbf['VoicePrefixId']});});return Promise[_0xd394('0x94')](_0x5066b3);}});});});return Promise[_0xd394('0x94')](_0x48b81d)[_0xd394('0x2c')](function(){return _0xeaa6d3[_0xd394('0x96')](_0x45c12e,{'transaction':_0x85bf29})['spread'](function(_0x2a867c){return _0x2a867c;});});});}})[_0xd394('0x2c')](respondWithResult(_0x1a80d5,null))[_0xd394('0x49')](handleError(_0x1a80d5,null));};exports[_0xd394('0x97')]=function(_0x14e5a4,_0x480439){var _0x40b198=_['isArray'](_0x14e5a4[_0xd394('0x36')][_0xd394('0x7f')])?_0x14e5a4[_0xd394('0x36')][_0xd394('0x7f')]:[_0x14e5a4[_0xd394('0x36')]['ids']];var _0x30c3b7=_0x14e5a4[_0xd394('0x4b')]['id'];return db['Team']['find']({'where':{'id':_0x30c3b7}})[_0xd394('0x2c')](handleEntityNotFound(_0x480439,null))[_0xd394('0x2c')](function(_0x197ba8){if(_0x197ba8){var _0x43fed1=[_0xd394('0x80'),_0xd394('0x81'),'Mail','Sms',_0xd394('0x84'),_0xd394('0x85'),_0xd394('0x86')];return db['sequelize'][_0xd394('0x87')](function(_0x3cfba8){var _0x571ebe=_[_0xd394('0x32')](_0x43fed1,function(_0x22afb4){var _0x99d357={'attributes':['id',_0xd394('0x2f')]};return _0x197ba8[_0xd394('0x4e')+_0x22afb4+_0xd394('0x78')](_0x99d357)[_0xd394('0x2c')](function(_0x58b404){var _0x449b3d=_[_0xd394('0x32')](_0x58b404,function(_0x51c6b0){return _0x51c6b0[_0xd394('0x97')](_0x40b198,{'transaction':_0x3cfba8})[_0xd394('0x2c')](function(){var _0x22ac60=_[_0xd394('0x32')](_0x40b198,function(_0x1a3b85){socket[_0xd394('0x98')](_0xd394('0x51')+_0x22afb4+'Queue:remove',{'UserId':Number(_0x1a3b85),[_0x22afb4+_0xd394('0x8c')]:_0x51c6b0['id']});if(_0x22afb4!==_0xd394('0x80')){return;}return db[_0xd394('0x8f')][_0xd394('0x61')]({'where':{'VoiceQueueId':_0x51c6b0['id'],'UserId':_0x1a3b85},'transaction':_0x3cfba8});});return Promise[_0xd394('0x94')](_0x22ac60);});});return Promise[_0xd394('0x94')](_0x449b3d);});});return Promise[_0xd394('0x94')](_0x571ebe)[_0xd394('0x2c')](function(){return _0x197ba8[_0xd394('0x97')](_0x40b198,{'transaction':_0x3cfba8});})['then'](function(){return db[_0xd394('0x70')][_0xd394('0x72')]({'where':{'teamId':_0x30c3b7}})[_0xd394('0x2c')](function(_0x54aeac){if(_0x54aeac){var _0x51ce0d=_[_0xd394('0x32')](_0x40b198,function(_0x3c9357){db['UserVoicePrefix'][_0xd394('0x61')]({'where':{'UserId':_0x3c9357,'VoicePrefixId':_0x54aeac[_0xd394('0x99')]}});});return Promise[_0xd394('0x94')](_0x51ce0d);}});});});}})['then'](respondWithStatusCode(_0x480439,null))[_0xd394('0x49')](handleError(_0x480439,null));};exports[_0xd394('0x9a')]=function(_0x4d2af0,_0x599148,_0x444e0e){var _0x31f905={};var _0x49d583={};var _0x49d825;var _0x370d45;return db[_0xd394('0x46')][_0xd394('0x72')]({'where':{'id':_0x4d2af0[_0xd394('0x4b')]['id']}})[_0xd394('0x2c')](handleEntityNotFound(_0x599148,null))[_0xd394('0x2c')](function(_0x3bfd94){if(_0x3bfd94){_0x49d825=_0x3bfd94;_0x49d583[_0xd394('0x39')]=_[_0xd394('0x4c')](db[_0xd394('0x8a')][_0xd394('0x33')]);_0x49d583[_0xd394('0x36')]=_['keys'](_0x4d2af0[_0xd394('0x36')]);_0x49d583[_0xd394('0x37')]=_[_0xd394('0x38')](_0x49d583['model'],_0x49d583[_0xd394('0x36')]);_0x31f905[_0xd394('0x3a')]=_[_0xd394('0x38')](_0x49d583['model'],qs['fields'](_0x4d2af0[_0xd394('0x36')][_0xd394('0x3b')]));_0x31f905['attributes']=_0x31f905[_0xd394('0x3a')][_0xd394('0x3c')]?_0x31f905[_0xd394('0x3a')]:_0x49d583[_0xd394('0x39')];_0x31f905[_0xd394('0x3e')]=qs[_0xd394('0x3f')](_0x4d2af0[_0xd394('0x36')][_0xd394('0x3f')]);_0x31f905[_0xd394('0x40')]=qs[_0xd394('0x37')](_[_0xd394('0x9b')](_0x4d2af0[_0xd394('0x36')],_0x49d583[_0xd394('0x37')]));if(_0x4d2af0['query'][_0xd394('0x41')]){_0x31f905[_0xd394('0x40')]=_['merge'](_0x31f905[_0xd394('0x40')],{'$or':_['map'](_0x31f905['attributes'],function(_0x18b77d){var _0x41c55e={};_0x41c55e[_0x18b77d]={'$like':'%'+_0x4d2af0[_0xd394('0x36')]['filter']+'%'};return _0x41c55e;})});}_0x31f905=_[_0xd394('0x42')]({},_0x31f905,_0x4d2af0[_0xd394('0x44')]);return _0x49d825['getAgents'](_0x31f905);}})[_0xd394('0x2c')](function(_0x3ac6a6){if(_0x3ac6a6){_0x370d45=_0x3ac6a6[_0xd394('0x3c')];if(!_0x4d2af0[_0xd394('0x36')]['hasOwnProperty'](_0xd394('0x3d'))){_0x31f905[_0xd394('0x27')]=qs[_0xd394('0x27')](_0x4d2af0[_0xd394('0x36')][_0xd394('0x27')]);_0x31f905[_0xd394('0x24')]=qs[_0xd394('0x24')](_0x4d2af0[_0xd394('0x36')][_0xd394('0x24')]);}return _0x49d825[_0xd394('0x9a')](_0x31f905);}})[_0xd394('0x2c')](function(_0xc0321f){if(_0xc0321f){return _0xc0321f?{'count':_0x370d45,'rows':_0xc0321f}:null;}})['then'](respondWithResult(_0x599148,null))[_0xd394('0x49')](handleError(_0x599148,null));}; \ No newline at end of file +var _0x3db8=['filter','merge','VIRTUAL','options','includeAll','rows','show','rawAttributes','include','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','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','Teams','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','findAll','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','all','spread','Openchannel','Whatsapp','Queue:remove','removeAgents','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','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','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','Team','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x8550ba,_0x57c10d){var _0x432399=function(_0x33ab8a){while(--_0x33ab8a){_0x8550ba['push'](_0x8550ba['shift']());}};_0x432399(++_0x57c10d);}(_0x3db8,0xff));var _0x83db=function(_0x17be8a,_0xc4f89b){_0x17be8a=_0x17be8a-0x0;var _0x3ef88f=_0x3db8[_0x17be8a];return _0x3ef88f;};'use strict';var emlformat=require(_0x83db('0x0'));var rimraf=require(_0x83db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83db('0x2'));var rp=require('request-promise');var moment=require(_0x83db('0x3'));var BPromise=require(_0x83db('0x4'));var Mustache=require(_0x83db('0x5'));var util=require('util');var path=require('path');var sox=require(_0x83db('0x6'));var csv=require(_0x83db('0x7'));var ejs=require(_0x83db('0x8'));var fs=require('fs');var fs_extra=require(_0x83db('0x9'));var _=require(_0x83db('0xa'));var squel=require('squel');var crypto=require(_0x83db('0xb'));var jsforce=require(_0x83db('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x83db('0x7'));var querystring=require(_0x83db('0xd'));var Papa=require(_0x83db('0xe'));var Redis=require(_0x83db('0xf'));var authService=require(_0x83db('0x10'));var qs=require(_0x83db('0x11'));var as=require(_0x83db('0x12'));var hardwareService=require(_0x83db('0x13'));var logger=require(_0x83db('0x14'))(_0x83db('0x15'));var utils=require(_0x83db('0x16'));var config=require(_0x83db('0x17'));var licenseUtil=require(_0x83db('0x18'));var db=require(_0x83db('0x19'))['db'];config['redis']=_[_0x83db('0x1a')](config['redis'],{'host':_0x83db('0x1b'),'port':0x18eb});var socket=require(_0x83db('0x1c'))(new Redis(config['redis']));require(_0x83db('0x1d'))[_0x83db('0x1e')](socket);function respondWithStatusCode(_0x47111,_0x5e6530){_0x5e6530=_0x5e6530||0xcc;return function(_0x3c7179){if(_0x3c7179){return _0x47111[_0x83db('0x1f')](_0x5e6530);}return _0x47111[_0x83db('0x20')](_0x5e6530)[_0x83db('0x21')]();};}function respondWithResult(_0x2c39da,_0x5b23e5){_0x5b23e5=_0x5b23e5||0xc8;return function(_0x5e1979){if(_0x5e1979){return _0x2c39da[_0x83db('0x20')](_0x5b23e5)['json'](_0x5e1979);}};}function respondWithFilteredResult(_0x13badc,_0x38badb){return function(_0x1be912){if(_0x1be912){var _0x2e302d=typeof _0x38badb[_0x83db('0x22')]==='undefined'&&typeof _0x38badb[_0x83db('0x23')]===_0x83db('0x24');var _0x482805=_0x1be912[_0x83db('0x25')];var _0x14ffb0=_0x2e302d?0x0:_0x38badb[_0x83db('0x22')];var _0x38ad9d=_0x2e302d?_0x1be912[_0x83db('0x25')]:_0x38badb[_0x83db('0x22')]+_0x38badb[_0x83db('0x23')];var _0x45dad9;if(_0x38ad9d>=_0x482805){_0x38ad9d=_0x482805;_0x45dad9=0xc8;}else{_0x45dad9=0xce;}_0x13badc[_0x83db('0x20')](_0x45dad9);return _0x13badc[_0x83db('0x26')](_0x83db('0x27'),_0x14ffb0+'-'+_0x38ad9d+'/'+_0x482805)[_0x83db('0x28')](_0x1be912);}return null;};}function patchUpdates(_0x2419f7){return function(_0x279402){try{jsonpatch[_0x83db('0x29')](_0x279402,_0x2419f7,!![]);}catch(_0x569f4d){return BPromise[_0x83db('0x2a')](_0x569f4d);}return _0x279402[_0x83db('0x2b')]();};}function saveUpdates(_0x1a66c1,_0x5537d8){return function(_0x16cab9){if(_0x16cab9){return _0x16cab9['update'](_0x1a66c1)[_0x83db('0x2c')](function(_0x578213){return _0x578213;});}return null;};}function handleEntityNotFound(_0x2d6a93,_0xe20dee){return function(_0x346111){if(!_0x346111){_0x2d6a93[_0x83db('0x1f')](0x194);}return _0x346111;};}function handleError(_0x3796ee,_0x215cdd){_0x215cdd=_0x215cdd||0x1f4;return function(_0x29a7f2){logger[_0x83db('0x2d')](_0x29a7f2[_0x83db('0x2e')]);if(_0x29a7f2[_0x83db('0x2f')]){delete _0x29a7f2[_0x83db('0x2f')];}_0x3796ee['status'](_0x215cdd)[_0x83db('0x30')](_0x29a7f2);};}exports[_0x83db('0x31')]=function(_0x5447f3,_0x4cd3b4){var _0x3739ce={},_0x3ba77c={},_0x2c5537={'count':0x0,'rows':[]};var _0x302714=_[_0x83db('0x32')](db[_0x83db('0x33')]['rawAttributes'],function(_0x2f3cda){return{'name':_0x2f3cda[_0x83db('0x34')],'type':_0x2f3cda[_0x83db('0x35')][_0x83db('0x36')]};});_0x3ba77c[_0x83db('0x37')]=_[_0x83db('0x32')](_0x302714,'name');_0x3ba77c[_0x83db('0x38')]=_[_0x83db('0x39')](_0x5447f3[_0x83db('0x38')]);_0x3ba77c[_0x83db('0x3a')]=_[_0x83db('0x3b')](_0x3ba77c[_0x83db('0x37')],_0x3ba77c[_0x83db('0x38')]);_0x3739ce[_0x83db('0x3c')]=_[_0x83db('0x3b')](_0x3ba77c[_0x83db('0x37')],qs[_0x83db('0x3d')](_0x5447f3['query'][_0x83db('0x3d')]));_0x3739ce[_0x83db('0x3c')]=_0x3739ce[_0x83db('0x3c')][_0x83db('0x3e')]?_0x3739ce[_0x83db('0x3c')]:_0x3ba77c[_0x83db('0x37')];if(!_0x5447f3['query'][_0x83db('0x3f')](_0x83db('0x40'))){_0x3739ce['limit']=qs['limit'](_0x5447f3['query']['limit']);_0x3739ce[_0x83db('0x22')]=qs[_0x83db('0x22')](_0x5447f3[_0x83db('0x38')]['offset']);}_0x3739ce[_0x83db('0x41')]=qs[_0x83db('0x42')](_0x5447f3['query'][_0x83db('0x42')]);_0x3739ce[_0x83db('0x43')]=qs[_0x83db('0x3a')](_[_0x83db('0x44')](_0x5447f3[_0x83db('0x38')],_0x3ba77c['filters']),_0x302714);if(_0x5447f3[_0x83db('0x38')][_0x83db('0x45')]){_0x3739ce[_0x83db('0x43')]=_[_0x83db('0x46')](_0x3739ce[_0x83db('0x43')],{'$or':_[_0x83db('0x32')](_0x302714,function(_0x7ca2b8){if(_0x7ca2b8[_0x83db('0x35')]!==_0x83db('0x47')){var _0x13fb9d={};_0x13fb9d[_0x7ca2b8[_0x83db('0x2f')]]={'$like':'%'+_0x5447f3[_0x83db('0x38')]['filter']+'%'};return _0x13fb9d;}})});}_0x3739ce=_[_0x83db('0x46')]({},_0x3739ce,_0x5447f3[_0x83db('0x48')]);var _0x4b33ac={'where':_0x3739ce[_0x83db('0x43')]};return db[_0x83db('0x33')][_0x83db('0x25')](_0x4b33ac)['then'](function(_0x197aad){_0x2c5537[_0x83db('0x25')]=_0x197aad;if(_0x5447f3[_0x83db('0x38')][_0x83db('0x49')]){_0x3739ce['include']=[{'all':!![]}];}return db['Team']['findAll'](_0x3739ce);})[_0x83db('0x2c')](function(_0x1c03f7){_0x2c5537[_0x83db('0x4a')]=_0x1c03f7;return _0x2c5537;})[_0x83db('0x2c')](respondWithFilteredResult(_0x4cd3b4,_0x3739ce))['catch'](handleError(_0x4cd3b4,null));};exports[_0x83db('0x4b')]=function(_0x18127a,_0x40a246){var _0x453da0={'raw':![],'where':{'id':_0x18127a['params']['id']}},_0xcffa50={};_0xcffa50['model']=_[_0x83db('0x39')](db[_0x83db('0x33')][_0x83db('0x4c')]);_0xcffa50[_0x83db('0x38')]=_[_0x83db('0x39')](_0x18127a[_0x83db('0x38')]);_0xcffa50['filters']=_[_0x83db('0x3b')](_0xcffa50[_0x83db('0x37')],_0xcffa50[_0x83db('0x38')]);_0x453da0[_0x83db('0x3c')]=_[_0x83db('0x3b')](_0xcffa50[_0x83db('0x37')],qs[_0x83db('0x3d')](_0x18127a[_0x83db('0x38')][_0x83db('0x3d')]));_0x453da0[_0x83db('0x3c')]=_0x453da0[_0x83db('0x3c')][_0x83db('0x3e')]?_0x453da0['attributes']:_0xcffa50[_0x83db('0x37')];if(_0x18127a['query']['includeAll']){_0x453da0[_0x83db('0x4d')]=[{'all':!![]}];}_0x453da0=_['merge']({},_0x453da0,_0x18127a[_0x83db('0x48')]);return db['Team'][_0x83db('0x4e')](_0x453da0)[_0x83db('0x2c')](handleEntityNotFound(_0x40a246,null))[_0x83db('0x2c')](respondWithResult(_0x40a246,null))[_0x83db('0x4f')](handleError(_0x40a246,null));};exports['create']=function(_0x17fd20,_0x430dff){return db[_0x83db('0x33')]['create'](_0x17fd20[_0x83db('0x50')],{})[_0x83db('0x2c')](function(_0x4ae587){var _0x296a8a=_0x17fd20[_0x83db('0x51')][_0x83db('0x52')]({'plain':!![]});if(!_0x296a8a)throw new Error(_0x83db('0x53'));if(_0x296a8a['role']==='user'){var _0x224830=_0x4ae587['get']({'plain':!![]});var _0x160475='Teams';return db['UserProfileSection']['find']({'where':{'name':_0x160475,'userProfileId':_0x296a8a[_0x83db('0x54')]},'raw':!![]})[_0x83db('0x2c')](function(_0x33121e){if(_0x33121e&&_0x33121e[_0x83db('0x55')]===0x0){return db['UserProfileResource'][_0x83db('0x56')]({'name':_0x224830[_0x83db('0x2f')],'resourceId':_0x224830['id'],'type':_0x33121e[_0x83db('0x2f')],'sectionId':_0x33121e['id']},{})['then'](function(){return _0x4ae587;});}else{return _0x4ae587;}})[_0x83db('0x4f')](function(_0x52d9ff){logger[_0x83db('0x2d')](_0x83db('0x57'),_0x52d9ff);throw _0x52d9ff;});}return _0x4ae587;})[_0x83db('0x2c')](respondWithResult(_0x430dff,0xc9))['catch'](handleError(_0x430dff,null));};exports[_0x83db('0x58')]=function(_0x28ec23,_0x1fb5c2){if(_0x28ec23['body']['id']){delete _0x28ec23['body']['id'];}return db[_0x83db('0x33')]['find']({'where':{'id':_0x28ec23[_0x83db('0x59')]['id']}})[_0x83db('0x2c')](handleEntityNotFound(_0x1fb5c2,null))[_0x83db('0x2c')](saveUpdates(_0x28ec23[_0x83db('0x50')],null))[_0x83db('0x2c')](respondWithResult(_0x1fb5c2,null))[_0x83db('0x4f')](handleError(_0x1fb5c2,null));};exports[_0x83db('0x5a')]=function(_0xdec844,_0x1dcb07){var _0x6415dd=_0xdec844[_0x83db('0x59')]['id'];var _0x33c6ea=[];return db[_0x83db('0x5b')][_0x83db('0x5c')](function(_0x63fbd7){var _0x496b25=_0x83db('0x5d')+_0x6415dd;return db[_0x83db('0x5b')][_0x83db('0x38')](_0x496b25,{'type':db[_0x83db('0x5e')][_0x83db('0x5f')][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7})['then'](function(_0x83b22a){_0x33c6ea=_[_0x83db('0x32')](_0x83b22a,function(_0x230960){return Number(_0x230960[_0x83db('0x61')]);});})[_0x83db('0x2c')](function(){var _0xe6e6b3=_0x83db('0x62')+_0x6415dd;return db[_0x83db('0x5b')][_0x83db('0x38')](_0xe6e6b3,{'type':db[_0x83db('0x5e')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0x44de75){var _0x437b9d=_[_0x83db('0x32')](_0x44de75,function(_0x332d54){return Number(_0x332d54['VoiceQueueId']);});return db[_0x83db('0x63')]['destroy']({'where':{'UserId':{'$in':_0x33c6ea},'VoiceQueueId':{'$in':_0x437b9d}},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){var _0x596a7e='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x6415dd;return db[_0x83db('0x5b')][_0x83db('0x38')](_0x596a7e,{'type':db[_0x83db('0x5e')][_0x83db('0x5f')][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0x46c533){var _0x5aab36=_['map'](_0x46c533,function(_0x4883e6){return Number(_0x4883e6[_0x83db('0x64')]);});return db[_0x83db('0x65')][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'MailQueueId':{'$in':_0x5aab36}},'transaction':_0x63fbd7});})['then'](function(){var _0x49ab4f=_0x83db('0x66')+_0x6415dd;return db['sequelize'][_0x83db('0x38')](_0x49ab4f,{'type':db['Sequelize']['QueryTypes'][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})['then'](function(_0x7bc48a){var _0x52702d=_[_0x83db('0x32')](_0x7bc48a,function(_0x5144c1){return Number(_0x5144c1[_0x83db('0x67')]);});return db[_0x83db('0x68')][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'SmsQueueId':{'$in':_0x52702d}},'transaction':_0x63fbd7});})['then'](function(){var _0x46b136=_0x83db('0x69')+_0x6415dd;return db['sequelize'][_0x83db('0x38')](_0x46b136,{'type':db[_0x83db('0x5e')]['QueryTypes'][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0x5068c7){var _0x7afea6=_[_0x83db('0x32')](_0x5068c7,function(_0x560eaf){return Number(_0x560eaf[_0x83db('0x6a')]);});return db[_0x83db('0x6b')][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'ChatQueueId':{'$in':_0x7afea6}},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){var _0x2d74c7=_0x83db('0x6c')+_0x6415dd;return db[_0x83db('0x5b')][_0x83db('0x38')](_0x2d74c7,{'type':db['Sequelize'][_0x83db('0x5f')][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})['then'](function(_0x38cf08){var _0x2640eb=_[_0x83db('0x32')](_0x38cf08,function(_0x573337){return Number(_0x573337[_0x83db('0x6d')]);});return db['UserFaxQueue'][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'FaxQueueId':{'$in':_0x2640eb}},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){var _0x569fcf=_0x83db('0x6e')+_0x6415dd;return db[_0x83db('0x5b')]['query'](_0x569fcf,{'type':db[_0x83db('0x5e')][_0x83db('0x5f')][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0x157df4){var _0x13b3f1=_[_0x83db('0x32')](_0x157df4,function(_0x468ed9){return Number(_0x468ed9[_0x83db('0x6f')]);});return db['UserOpenchannelQueue'][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'OpenchannelQueueId':{'$in':_0x13b3f1}},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){var _0x2268f3=_0x83db('0x70')+_0x6415dd;return db[_0x83db('0x5b')]['query'](_0x2268f3,{'type':db[_0x83db('0x5e')][_0x83db('0x5f')][_0x83db('0x60')],'raw':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0xd9384f){var _0x48febd=_[_0x83db('0x32')](_0xd9384f,function(_0x330987){return Number(_0x330987['WhatsappQueueId']);});return db[_0x83db('0x71')][_0x83db('0x5a')]({'where':{'UserId':{'$in':_0x33c6ea},'WhatsappQueueId':{'$in':_0x48febd}},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){return db[_0x83db('0x72')][_0x83db('0x4e')]({'where':{'TeamId':_0x6415dd}});})['then'](function(_0x43c71e){if(_0x43c71e===null){return;}return db[_0x83db('0x73')]['destroy']({'where':{'UserId':{'$in':_0x33c6ea},'VoicePrefixId':_0x43c71e[_0x83db('0x74')]},'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(){return db['Team'][_0x83db('0x5a')]({'where':{'id':_0x6415dd},'cascade':!![],'transaction':_0x63fbd7});})[_0x83db('0x2c')](function(_0x37b02d){if(_0x37b02d===0x0){_0x1dcb07[_0x83db('0x1f')](0x194);}else{return db[_0x83db('0x75')][_0x83db('0x5a')]({'where':{'type':_0x83db('0x76'),'resourceId':_0x6415dd},'cascade':!![],'transaction':_0x63fbd7})[_0x83db('0x2c')](function(){_0x1dcb07[_0x83db('0x20')](0xcc)[_0x83db('0x21')]();});}})[_0x83db('0x4f')](function(_0x335c3e){_0x1dcb07[_0x83db('0x20')](0x1f4)[_0x83db('0x30')](_0x335c3e);});});};exports[_0x83db('0x77')]=function(_0x4c0bd0,_0x35f932,_0xc77e7a){return db[_0x83db('0x33')][_0x83db('0x78')]({'where':{'id':_0x4c0bd0[_0x83db('0x59')]['id']}})[_0x83db('0x2c')](handleEntityNotFound(_0x35f932,null))[_0x83db('0x2c')](function(_0xa3b6f4){if(!_0x4c0bd0[_0x83db('0x38')][_0x83db('0x79')]||!utils['isValidChannel'](_0x4c0bd0[_0x83db('0x38')]['channel'])){throw new db[(_0x83db('0x5e'))][(_0x83db('0x7a'))](_0x83db('0x7b'));}var _0x45a17c={};var _0x3c4e73={};_0x3c4e73[_0x83db('0x37')]=_[_0x83db('0x39')](db[_[_0x83db('0x7c')](_0x4c0bd0[_0x83db('0x38')][_0x83db('0x79')][_0x83db('0x7d')]())+_0x83db('0x7e')][_0x83db('0x4c')]);_0x3c4e73[_0x83db('0x38')]=_['keys'](_0x4c0bd0[_0x83db('0x38')]);_0x3c4e73[_0x83db('0x3a')]=_[_0x83db('0x3b')](_0x3c4e73['model'],_0x3c4e73[_0x83db('0x38')]);_0x45a17c[_0x83db('0x3c')]=_['intersection'](_0x3c4e73[_0x83db('0x37')],qs[_0x83db('0x3d')](_0x4c0bd0[_0x83db('0x38')][_0x83db('0x3d')]));_0x45a17c[_0x83db('0x3c')]=_0x45a17c[_0x83db('0x3c')]['length']?_0x45a17c[_0x83db('0x3c')]:_0x3c4e73[_0x83db('0x37')];_0x45a17c[_0x83db('0x23')]=qs[_0x83db('0x23')](_0x4c0bd0['query'][_0x83db('0x23')]);_0x45a17c[_0x83db('0x22')]=qs[_0x83db('0x22')](_0x4c0bd0[_0x83db('0x38')][_0x83db('0x22')]);_0x45a17c['order']=qs[_0x83db('0x42')](_0x4c0bd0[_0x83db('0x38')][_0x83db('0x42')]);_0x45a17c[_0x83db('0x43')]=qs['filters'](_['pick'](_0x4c0bd0[_0x83db('0x38')],_0x3c4e73[_0x83db('0x3a')]));_0x45a17c=_[_0x83db('0x46')]({},_0x45a17c,_0x4c0bd0[_0x83db('0x48')]);return _0xa3b6f4[_0x83db('0x52')+_['capitalize'](_0x4c0bd0['query'][_0x83db('0x79')]['toLowerCase']())+_0x83db('0x7f')](_0x45a17c);})['then'](respondWithResult(_0x35f932,null))[_0x83db('0x4f')](handleError(_0x35f932,null));};exports[_0x83db('0x80')]=function(_0x3757af,_0x4a4739,_0x416cba){return db['Team'][_0x83db('0x78')]({'where':{'id':_0x3757af['params']['id']}})[_0x83db('0x2c')](function(_0x3777ee){if(_0x3777ee){if(!_0x3757af[_0x83db('0x50')][_0x83db('0x79')]||!utils[_0x83db('0x81')](_0x3757af[_0x83db('0x50')][_0x83db('0x79')])){throw new db[(_0x83db('0x5e'))][(_0x83db('0x7a'))](_0x83db('0x7b'));}return _0x3777ee['add'+_[_0x83db('0x7c')](_0x3757af[_0x83db('0x50')]['channel'][_0x83db('0x7d')]())+_0x83db('0x7f')](_0x3757af['body'][_0x83db('0x82')]);}return null;})[_0x83db('0x2c')](handleEntityNotFound(_0x4a4739,null))[_0x83db('0x2c')](respondWithStatusCode(_0x4a4739,null))['catch'](handleError(_0x4a4739,null));};exports[_0x83db('0x83')]=function(_0x5a76a2,_0x3cee54,_0x21cb77){return db[_0x83db('0x33')][_0x83db('0x78')]({'where':{'id':_0x5a76a2[_0x83db('0x59')]['id']}})['then'](function(_0x36ccf9){if(_0x36ccf9){if(!_0x5a76a2[_0x83db('0x38')][_0x83db('0x79')]||!utils[_0x83db('0x81')](_0x5a76a2[_0x83db('0x38')][_0x83db('0x79')])){throw new db[(_0x83db('0x5e'))][(_0x83db('0x7a'))](_0x83db('0x7b'));}return _0x36ccf9[_0x83db('0x84')+_[_0x83db('0x7c')](_0x5a76a2[_0x83db('0x38')][_0x83db('0x79')][_0x83db('0x7d')]())+_0x83db('0x7f')](_0x5a76a2['query'][_0x83db('0x82')]);}return null;})['then'](handleEntityNotFound(_0x3cee54,null))['then'](respondWithStatusCode(_0x3cee54,null))[_0x83db('0x4f')](handleError(_0x3cee54,null));};exports[_0x83db('0x85')]=function(_0x139e4c,_0x46eff0){var _0x38337e=_[_0x83db('0x86')](_0x139e4c[_0x83db('0x50')][_0x83db('0x82')])?_0x139e4c['body'][_0x83db('0x82')]:[_0x139e4c[_0x83db('0x50')][_0x83db('0x82')]];var _0x4ab6c7=_0x139e4c[_0x83db('0x59')]['id'];return db['Team'][_0x83db('0x4e')]({'where':{'id':_0x4ab6c7}})[_0x83db('0x2c')](handleEntityNotFound(_0x46eff0,null))[_0x83db('0x2c')](function(_0x4f7218){if(_0x4f7218){var _0x414515=[_0x83db('0x87'),_0x83db('0x88'),_0x83db('0x89'),_0x83db('0x8a'),_0x83db('0x8b'),'Openchannel','Whatsapp'];return db['sequelize']['transaction'](function(_0x16264c){var _0x85861a=_['map'](_0x414515,function(_0x2992ae){var _0x11ba96={'attributes':['id',_0x83db('0x2f')]};if(_0x2992ae==='Voice'){_0x11ba96[_0x83db('0x8c')]={'attributes':[_0x83db('0x8d')]};}return _0x4f7218['get'+_0x2992ae+'Queues'](_0x11ba96)[_0x83db('0x2c')](function(_0x37e373){var _0x559f3c=_[_0x83db('0x32')](_0x37e373,function(_0x462ad5){var _0x30e0f2=_[_0x83db('0x32')](_0x38337e,function(_0x3a20be){var _0x8df244={'where':{'UserId':_0x3a20be,[_0x2992ae+_0x83db('0x8e')]:_0x462ad5['id']},'transaction':_0x16264c};if(_0x2992ae===_0x83db('0x87')){_0x8df244['defaults']={'penalty':_0x462ad5[_0x83db('0x8f')][_0x83db('0x8d')]};}return db[_0x83db('0x90')+_0x2992ae+_0x83db('0x7e')][_0x83db('0x91')](_0x8df244)['then'](function(){socket[_0x83db('0x92')](_0x83db('0x51')+_0x2992ae+_0x83db('0x93'),{'UserId':_0x3a20be,[_0x2992ae+_0x83db('0x8e')]:_0x462ad5['id']});if(_0x2992ae!==_0x83db('0x87')){return;}return db['User'][_0x83db('0x94')]({'where':{'id':_0x38337e,'online':0x1},'attributes':['id',_0x83db('0x2f'),'online',_0x83db('0x95'),'interface'],'raw':!![]})[_0x83db('0x2c')](function(_0x3ac152){var _0x29a6f3=_['map'](_0x3ac152,function(_0x4b22b9){return db[_0x83db('0x96')][_0x83db('0x97')]({'membername':_0x4b22b9[_0x83db('0x2f')],'UserId':_0x4b22b9['id'],'queue_name':_0x462ad5['name'],'VoiceQueueId':_0x462ad5['id'],'interface':_[_0x83db('0x98')](_0x4b22b9[_0x83db('0x99')])?util[_0x83db('0x9a')]('SIP/%s',_0x4b22b9[_0x83db('0x2f')]):_0x4b22b9[_0x83db('0x99')],'paused':_0x4b22b9[_0x83db('0x95')]||![],'penalty':_0x462ad5['TeamVoiceQueue'][_0x83db('0x8d')]},{'transaction':_0x16264c});});return Promise[_0x83db('0x9b')](_0x29a6f3);});});});return Promise[_0x83db('0x9b')](_0x30e0f2);});return Promise[_0x83db('0x9b')](_0x559f3c);})[_0x83db('0x2c')](function(){return db[_0x83db('0x72')]['findOne']({'where':{'teamId':_0x4ab6c7}})[_0x83db('0x2c')](function(_0x54b680){if(_0x54b680){var _0x3fc659=_[_0x83db('0x32')](_0x38337e,function(_0x1ce138){db[_0x83db('0x73')][_0x83db('0x97')]({'UserId':_0x1ce138,'VoicePrefixId':_0x54b680[_0x83db('0x74')]});});return Promise[_0x83db('0x9b')](_0x3fc659);}});});});return Promise[_0x83db('0x9b')](_0x85861a)[_0x83db('0x2c')](function(){return _0x4f7218[_0x83db('0x85')](_0x38337e,{'transaction':_0x16264c})[_0x83db('0x9c')](function(_0x6937e9){return _0x6937e9;});});});}})[_0x83db('0x2c')](respondWithResult(_0x46eff0,null))[_0x83db('0x4f')](handleError(_0x46eff0,null));};exports['removeAgents']=function(_0x17f29d,_0x543bbe){var _0x50b028=_[_0x83db('0x86')](_0x17f29d[_0x83db('0x38')][_0x83db('0x82')])?_0x17f29d['query'][_0x83db('0x82')]:[_0x17f29d[_0x83db('0x38')]['ids']];var _0x328480=_0x17f29d[_0x83db('0x59')]['id'];return db['Team']['find']({'where':{'id':_0x328480}})[_0x83db('0x2c')](handleEntityNotFound(_0x543bbe,null))['then'](function(_0x50c7d5){if(_0x50c7d5){var _0x56eb0b=[_0x83db('0x87'),_0x83db('0x88'),_0x83db('0x89'),_0x83db('0x8a'),_0x83db('0x8b'),_0x83db('0x9d'),_0x83db('0x9e')];return db['sequelize']['transaction'](function(_0x4d606c){var _0x10136d=_[_0x83db('0x32')](_0x56eb0b,function(_0x4a8a65){var _0x27fb64={'attributes':['id',_0x83db('0x2f')]};return _0x50c7d5[_0x83db('0x52')+_0x4a8a65+_0x83db('0x7f')](_0x27fb64)[_0x83db('0x2c')](function(_0x2b9d3e){var _0x1fa43c=_['map'](_0x2b9d3e,function(_0x3ed454){return _0x3ed454['removeAgents'](_0x50b028,{'transaction':_0x4d606c})[_0x83db('0x2c')](function(){var _0x5e5e9a=_[_0x83db('0x32')](_0x50b028,function(_0x5b2014){socket[_0x83db('0x92')](_0x83db('0x51')+_0x4a8a65+_0x83db('0x9f'),{'UserId':Number(_0x5b2014),[_0x4a8a65+_0x83db('0x8e')]:_0x3ed454['id']});if(_0x4a8a65!==_0x83db('0x87')){return;}return db[_0x83db('0x96')][_0x83db('0x5a')]({'where':{'VoiceQueueId':_0x3ed454['id'],'UserId':_0x5b2014},'transaction':_0x4d606c});});return Promise[_0x83db('0x9b')](_0x5e5e9a);});});return Promise[_0x83db('0x9b')](_0x1fa43c);});});return Promise[_0x83db('0x9b')](_0x10136d)['then'](function(){return _0x50c7d5[_0x83db('0xa0')](_0x50b028,{'transaction':_0x4d606c});})[_0x83db('0x2c')](function(){return db[_0x83db('0x72')]['findOne']({'where':{'teamId':_0x328480}})[_0x83db('0x2c')](function(_0x42b6df){if(_0x42b6df){var _0x4f153d=_[_0x83db('0x32')](_0x50b028,function(_0x3c90b2){db[_0x83db('0x73')]['destroy']({'where':{'UserId':_0x3c90b2,'VoicePrefixId':_0x42b6df[_0x83db('0x74')]}});});return Promise[_0x83db('0x9b')](_0x4f153d);}});});});}})[_0x83db('0x2c')](respondWithStatusCode(_0x543bbe,null))[_0x83db('0x4f')](handleError(_0x543bbe,null));};exports[_0x83db('0xa1')]=function(_0x4472df,_0x340ed6,_0x5412aa){var _0x1e3430={};var _0x47abe8={};var _0x287eb2;var _0x42dc7c;return db[_0x83db('0x33')][_0x83db('0x78')]({'where':{'id':_0x4472df[_0x83db('0x59')]['id']}})[_0x83db('0x2c')](handleEntityNotFound(_0x340ed6,null))[_0x83db('0x2c')](function(_0x896ab8){if(_0x896ab8){_0x287eb2=_0x896ab8;_0x47abe8[_0x83db('0x37')]=_['keys'](db[_0x83db('0x90')][_0x83db('0x4c')]);_0x47abe8['query']=_[_0x83db('0x39')](_0x4472df[_0x83db('0x38')]);_0x47abe8[_0x83db('0x3a')]=_[_0x83db('0x3b')](_0x47abe8[_0x83db('0x37')],_0x47abe8[_0x83db('0x38')]);_0x1e3430[_0x83db('0x3c')]=_[_0x83db('0x3b')](_0x47abe8[_0x83db('0x37')],qs['fields'](_0x4472df['query']['fields']));_0x1e3430['attributes']=_0x1e3430[_0x83db('0x3c')]['length']?_0x1e3430[_0x83db('0x3c')]:_0x47abe8[_0x83db('0x37')];_0x1e3430[_0x83db('0x41')]=qs[_0x83db('0x42')](_0x4472df[_0x83db('0x38')][_0x83db('0x42')]);_0x1e3430[_0x83db('0x43')]=qs[_0x83db('0x3a')](_[_0x83db('0x44')](_0x4472df[_0x83db('0x38')],_0x47abe8[_0x83db('0x3a')]));if(_0x4472df[_0x83db('0x38')][_0x83db('0x45')]){_0x1e3430[_0x83db('0x43')]=_['merge'](_0x1e3430[_0x83db('0x43')],{'$or':_['map'](_0x1e3430[_0x83db('0x3c')],function(_0x3cf55c){var _0x4e2332={};_0x4e2332[_0x3cf55c]={'$like':'%'+_0x4472df[_0x83db('0x38')]['filter']+'%'};return _0x4e2332;})});}_0x1e3430=_['merge']({},_0x1e3430,_0x4472df[_0x83db('0x48')]);return _0x287eb2[_0x83db('0xa1')](_0x1e3430);}})[_0x83db('0x2c')](function(_0x115c9a){if(_0x115c9a){_0x42dc7c=_0x115c9a[_0x83db('0x3e')];if(!_0x4472df['query'][_0x83db('0x3f')](_0x83db('0x40'))){_0x1e3430[_0x83db('0x23')]=qs[_0x83db('0x23')](_0x4472df[_0x83db('0x38')][_0x83db('0x23')]);_0x1e3430[_0x83db('0x22')]=qs['offset'](_0x4472df[_0x83db('0x38')][_0x83db('0x22')]);}return _0x287eb2[_0x83db('0xa1')](_0x1e3430);}})[_0x83db('0x2c')](function(_0x4da6cd){if(_0x4da6cd){return _0x4da6cd?{'count':_0x42dc7c,'rows':_0x4da6cd}:null;}})[_0x83db('0x2c')](respondWithResult(_0x340ed6,null))[_0x83db('0x4f')](handleError(_0x340ed6,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7b4459b..3f87b95 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 _0x56cb=['Team','setMaxListeners','hasOwnProperty','events','../../mysqldb'];(function(_0x3b5dfe,_0x1f46b7){var _0x21bf8e=function(_0x24b3ba){while(--_0x24b3ba){_0x3b5dfe['push'](_0x3b5dfe['shift']());}};_0x21bf8e(++_0x1f46b7);}(_0x56cb,0xee));var _0xb56c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x56cb[_0x4ff09b];return _0x3f5c2e;};'use strict';var EventEmitter=require(_0xb56c('0x0'));var Team=require(_0xb56c('0x1'))['db'][_0xb56c('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xb56c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x205dad){return function(_0x5184f4,_0xd1fcc9,_0x579025){TeamEvents['emit'](_0x205dad+':'+_0x5184f4['id'],_0x5184f4);TeamEvents['emit'](_0x205dad,_0x5184f4);_0x579025(null);};}for(var e in events){if(events[_0xb56c('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x8674=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x2437c2,_0x2da5aa){var _0x49e9d1=function(_0x351517){while(--_0x351517){_0x2437c2['push'](_0x2437c2['shift']());}};_0x49e9d1(++_0x2da5aa);}(_0x8674,0x12e));var _0x4867=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8674[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require(_0x4867('0x0'));var Team=require(_0x4867('0x1'))['db'][_0x4867('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x4867('0x3')](0x0);var events={'afterCreate':_0x4867('0x4'),'afterUpdate':_0x4867('0x5'),'afterDestroy':_0x4867('0x6')};function emitEvent(_0x5b58c9){return function(_0x137aae,_0x4efd27,_0x2e479b){TeamEvents[_0x4867('0x7')](_0x5b58c9+':'+_0x137aae['id'],_0x137aae);TeamEvents[_0x4867('0x7')](_0x5b58c9,_0x137aae);_0x2e479b(null);};}for(var e in events){if(events[_0x4867('0x8')](e)){var event=events[e];Team[_0x4867('0x9')](e,emitEvent(event));}}module[_0x4867('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 6bc5496..dd448c5 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 _0xb0bf=['get','then','map','setDataValue','channel','catch','exports','define','teams','Chat','Fax','Openchannel','Sms','Voice','Whatsapp','resolve','lodash','./team.attributes'];(function(_0x6ae37,_0x50e951){var _0x4a16c2=function(_0x1dcaae){while(--_0x1dcaae){_0x6ae37['push'](_0x6ae37['shift']());}};_0x4a16c2(++_0x50e951);}(_0xb0bf,0x19c));var _0xfb0b=function(_0x2a55b5,_0x3c75ea){_0x2a55b5=_0x2a55b5-0x0;var _0x5b25a4=_0xb0bf[_0x2a55b5];return _0x5b25a4;};'use strict';var _=require(_0xfb0b('0x0'));var attributes=require(_0xfb0b('0x1'));function getQueuesByChannel(_0x2b7313,_0x436004){var _0x57abef=_0xfb0b('0x2')+_0x436004+'Queues';return _0x2b7313[_0x57abef]()[_0xfb0b('0x3')](function(_0x44637d){return _[_0xfb0b('0x4')](_0x44637d,function(_0x130808){_0x130808[_0xfb0b('0x5')](_0xfb0b('0x6'),_0x436004);return _0x130808;});})[_0xfb0b('0x7')](function(_0x4f2498){throw _0x4f2498;});}module[_0xfb0b('0x8')]=function(_0x200d31){return _0x200d31[_0xfb0b('0x9')]('Team',attributes,{'tableName':_0xfb0b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5c277b=this;var _0x1774dc=[_0xfb0b('0xb'),_0xfb0b('0xc'),'Mail',_0xfb0b('0xd'),_0xfb0b('0xe'),_0xfb0b('0xf'),_0xfb0b('0x10')];return Promise[_0xfb0b('0x11')]()[_0xfb0b('0x3')](function(){var _0x3aba25=_['map'](_0x1774dc,function(_0x51c27a){return getQueuesByChannel(_0x5c277b,_0x51c27a);});return Promise['all'](_0x3aba25);})[_0xfb0b('0x7')](function(_0x1af645){throw _0x1af645;});}}});}; \ No newline at end of file +var _0xf29e=['Whatsapp','resolve','./team.attributes','get','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice'];(function(_0x2a1290,_0x3b8277){var _0x2a18ea=function(_0x50e040){while(--_0x50e040){_0x2a1290['push'](_0x2a1290['shift']());}};_0x2a18ea(++_0x3b8277);}(_0xf29e,0xa4));var _0xef29=function(_0x5b0701,_0xbd6d61){_0x5b0701=_0x5b0701-0x0;var _0x49939c=_0xf29e[_0x5b0701];return _0x49939c;};'use strict';var _=require('lodash');var attributes=require(_0xef29('0x0'));function getQueuesByChannel(_0x2bd018,_0x4679e4){var _0x5bda87=_0xef29('0x1')+_0x4679e4+'Queues';return _0x2bd018[_0x5bda87]()['then'](function(_0x4352c8){return _[_0xef29('0x2')](_0x4352c8,function(_0x9fb549){_0x9fb549[_0xef29('0x3')](_0xef29('0x4'),_0x4679e4);return _0x9fb549;});})[_0xef29('0x5')](function(_0x1f8a92){throw _0x1f8a92;});}module[_0xef29('0x6')]=function(_0x53d402){return _0x53d402[_0xef29('0x7')](_0xef29('0x8'),attributes,{'tableName':_0xef29('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5e4143=this;var _0x513faa=[_0xef29('0xa'),_0xef29('0xb'),_0xef29('0xc'),_0xef29('0xd'),_0xef29('0xe'),_0xef29('0xf'),_0xef29('0x10')];return Promise[_0xef29('0x11')]()['then'](function(){var _0x4e3023=_[_0xef29('0x2')](_0x513faa,function(_0x3abcfb){return getQueuesByChannel(_0x5e4143,_0x3abcfb);});return Promise['all'](_0x4e3023);})[_0xef29('0x5')](function(_0xcb0ed0){throw _0xcb0ed0;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 6dd608e..9caac99 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 _0xde9c=['../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','bluebird','randomstring','../../config/logger','rpc'];(function(_0x233921,_0x24a0a6){var _0xa81f85=function(_0xfd0f3){while(--_0xfd0f3){_0x233921['push'](_0x233921['shift']());}};_0xa81f85(++_0x24a0a6);}(_0xde9c,0x15c));var _0xcde9=function(_0x387106,_0x510f30){_0x387106=_0x387106-0x0;var _0x5ba67c=_0xde9c[_0x387106];return _0x5ba67c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xcde9('0x0'));var rs=require(_0xcde9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcde9('0x2'))(_0xcde9('0x3'));var config=require(_0xcde9('0x4'));var jayson=require(_0xcde9('0x5'));var client=jayson[_0xcde9('0x6')][_0xcde9('0x7')]({'port':0x232a});config[_0xcde9('0x8')]=_['defaults'](config[_0xcde9('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xcde9('0x9'))(new Redis(config['redis']));require(_0xcde9('0xa'))[_0xcde9('0xb')](socket);function respondWithRpcPromise(_0x3b8bbe,_0x3727b8,_0x3def0c){return new BPromise(function(_0x3a3dcc,_0x5d57e1){return client[_0xcde9('0xc')](_0x3b8bbe,_0x3def0c)['then'](function(_0xf162f){logger[_0xcde9('0xd')](_0xcde9('0xe'),_0x3727b8,'request\x20sent');logger['debug'](_0xcde9('0xf'),_0x3727b8,_0xcde9('0x10'),JSON['stringify'](_0xf162f));if(_0xf162f[_0xcde9('0x11')]){if(_0xf162f['error'][_0xcde9('0x12')]===0x1f4){logger[_0xcde9('0x11')]('Team,\x20%s,\x20%s',_0x3727b8,_0xf162f['error'][_0xcde9('0x13')]);return _0x5d57e1(_0xf162f['error'][_0xcde9('0x13')]);}logger['error'](_0xcde9('0xe'),_0x3727b8,_0xf162f[_0xcde9('0x11')]['message']);return _0x3a3dcc(_0xf162f[_0xcde9('0x11')][_0xcde9('0x13')]);}else{logger[_0xcde9('0xd')](_0xcde9('0xe'),_0x3727b8,_0xcde9('0x10'));_0x3a3dcc(_0xf162f[_0xcde9('0x14')][_0xcde9('0x13')]);}})[_0xcde9('0x15')](function(_0x1e7c35){logger[_0xcde9('0x11')]('Team,\x20%s,\x20%s',_0x3727b8,_0x1e7c35);_0x5d57e1(_0x1e7c35);});});} \ No newline at end of file +var _0x5d2c=['./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x5eb1e7,_0x354ca1){var _0x36d9d2=function(_0x299f56){while(--_0x299f56){_0x5eb1e7['push'](_0x5eb1e7['shift']());}};_0x36d9d2(++_0x354ca1);}(_0x5d2c,0xbb));var _0xc5d2=function(_0xd2a17f,_0x28243c){_0xd2a17f=_0xd2a17f-0x0;var _0x3a8e49=_0x5d2c[_0xd2a17f];return _0x3a8e49;};'use strict';var _=require(_0xc5d2('0x0'));var util=require(_0xc5d2('0x1'));var moment=require(_0xc5d2('0x2'));var BPromise=require(_0xc5d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5d2('0x4'));var db=require(_0xc5d2('0x5'))['db'];var utils=require(_0xc5d2('0x6'));var logger=require(_0xc5d2('0x7'))(_0xc5d2('0x8'));var config=require(_0xc5d2('0x9'));var jayson=require(_0xc5d2('0xa'));var client=jayson[_0xc5d2('0xb')][_0xc5d2('0xc')]({'port':0x232a});config[_0xc5d2('0xd')]=_['defaults'](config['redis'],{'host':_0xc5d2('0xe'),'port':0x18eb});var socket=require(_0xc5d2('0xf'))(new Redis(config[_0xc5d2('0xd')]));require(_0xc5d2('0x10'))[_0xc5d2('0x11')](socket);function respondWithRpcPromise(_0x4330ef,_0x324fbe,_0x211cfa){return new BPromise(function(_0x424bb3,_0x357521){return client[_0xc5d2('0x12')](_0x4330ef,_0x211cfa)[_0xc5d2('0x13')](function(_0x5f3543){logger[_0xc5d2('0x14')](_0xc5d2('0x15'),_0x324fbe,_0xc5d2('0x16'));logger['debug'](_0xc5d2('0x17'),_0x324fbe,_0xc5d2('0x16'),JSON[_0xc5d2('0x18')](_0x5f3543));if(_0x5f3543['error']){if(_0x5f3543[_0xc5d2('0x19')][_0xc5d2('0x1a')]===0x1f4){logger[_0xc5d2('0x19')](_0xc5d2('0x15'),_0x324fbe,_0x5f3543[_0xc5d2('0x19')]['message']);return _0x357521(_0x5f3543[_0xc5d2('0x19')][_0xc5d2('0x1b')]);}logger['error'](_0xc5d2('0x15'),_0x324fbe,_0x5f3543[_0xc5d2('0x19')]['message']);return _0x424bb3(_0x5f3543[_0xc5d2('0x19')]['message']);}else{logger[_0xc5d2('0x14')]('Team,\x20%s,\x20%s',_0x324fbe,'request\x20sent');_0x424bb3(_0x5f3543[_0xc5d2('0x1c')][_0xc5d2('0x1b')]);}})['catch'](function(_0x45d211){logger['error'](_0xc5d2('0x15'),_0x324fbe,_0x45d211);_0x357521(_0x45d211);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5a1a633..5506578 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 _0x4046=['remove','update','removeListener','register','save'];(function(_0x4a9a17,_0x273a09){var _0x30e831=function(_0xabbcbd){while(--_0xabbcbd){_0x4a9a17['push'](_0x4a9a17['shift']());}};_0x30e831(++_0x273a09);}(_0x4046,0x126));var _0x6404=function(_0xc1ca27,_0x47dd84){_0xc1ca27=_0xc1ca27-0x0;var _0x4857b6=_0x4046[_0xc1ca27];return _0x4857b6;};'use strict';var TeamEvents=require('./team.events');var events=[_0x6404('0x0'),_0x6404('0x1'),_0x6404('0x2')];function createListener(_0x285d0d,_0x15ac05){return function(_0x4e2695){_0x15ac05['emit'](_0x285d0d,_0x4e2695);};}function removeListener(_0x54bd4a,_0x522e47){return function(){TeamEvents[_0x6404('0x3')](_0x54bd4a,_0x522e47);};}exports[_0x6404('0x4')]=function(_0x4136af){for(var _0x21e34e=0x0,_0x2eba27=events['length'];_0x21e34e<_0x2eba27;_0x21e34e++){var _0x4cbc18=events[_0x21e34e];var _0x21b3d6=createListener('team:'+_0x4cbc18,_0x4136af);TeamEvents['on'](_0x4cbc18,_0x21b3d6);}}; \ No newline at end of file +var _0xe083=['register','length','./team.events','save'];(function(_0x4d53a5,_0x3da5df){var _0xb85e6e=function(_0x3a726e){while(--_0x3a726e){_0x4d53a5['push'](_0x4d53a5['shift']());}};_0xb85e6e(++_0x3da5df);}(_0xe083,0x76));var _0x3e08=function(_0x3dbb83,_0x529e37){_0x3dbb83=_0x3dbb83-0x0;var _0x9478b4=_0xe083[_0x3dbb83];return _0x9478b4;};'use strict';var TeamEvents=require(_0x3e08('0x0'));var events=[_0x3e08('0x1'),'remove','update'];function createListener(_0x38141e,_0x908deb){return function(_0x22c0d9){_0x908deb['emit'](_0x38141e,_0x22c0d9);};}function removeListener(_0x3e8cb2,_0xf65806){return function(){TeamEvents['removeListener'](_0x3e8cb2,_0xf65806);};}exports[_0x3e08('0x2')]=function(_0xb2983d){for(var _0x3975ae=0x0,_0x51bd77=events[_0x3e08('0x3')];_0x3975ae<_0x51bd77;_0x3975ae++){var _0x2ddcdd=events[_0x3975ae];var _0x4378ca=createListener('team:'+_0x2ddcdd,_0xb2983d);TeamEvents['on'](_0x2ddcdd,_0x4378ca);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index db58b29..e615a6a 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 _0x12dc=['sequelize','exports','INTEGER'];(function(_0x88a98e,_0x56668b){var _0x23eede=function(_0x165899){while(--_0x165899){_0x88a98e['push'](_0x88a98e['shift']());}};_0x23eede(++_0x56668b);}(_0x12dc,0xb4));var _0xc12d=function(_0x55493b,_0xbf3600){_0x55493b=_0x55493b-0x0;var _0x3946e7=_0x12dc[_0x55493b];return _0x3946e7;};'use strict';var Sequelize=require(_0xc12d('0x0'));module[_0xc12d('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xc12d('0x2')]}}; \ No newline at end of file +var _0x3ae9=['INTEGER'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3ae9,0xdb));var _0x93ae=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x3ae9[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0x93ae('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x93ae('0x0')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 9c45842..f8565fe 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 _0x9ffd=['TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','define'];(function(_0x8ce99,_0xe40fa0){var _0x186ca7=function(_0xa277bc){while(--_0xa277bc){_0x8ce99['push'](_0x8ce99['shift']());}};_0x186ca7(++_0xe40fa0);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x7ff57e,_0x6faea2){_0x7ff57e=_0x7ff57e-0x0;var _0x2ed07a=_0x9ffd[_0x7ff57e];return _0x2ed07a;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd9ff('0x7'));var attributes=require(_0xd9ff('0x8'));module['exports']=function(_0x3aa26b,_0x2982c3){return _0x3aa26b[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':_0xd9ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7a0=['path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','bluebird','request-promise'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0xd7a0,0x163));var _0x0d7a=function(_0xa767af,_0x3799ca){_0xa767af=_0xa767af-0x0;var _0x3fe4b6=_0xd7a0[_0xa767af];return _0x3fe4b6;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var logger=require('../../config/logger')(_0x0d7a('0x2'));var moment=require('moment');var BPromise=require(_0x0d7a('0x3'));var rp=require(_0x0d7a('0x4'));var fs=require('fs');var path=require(_0x0d7a('0x5'));var rimraf=require(_0x0d7a('0x6'));var config=require(_0x0d7a('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0x0d7a('0x8')]=function(_0x37c000,_0x321114){return _0x37c000[_0x0d7a('0x9')](_0x0d7a('0xa'),attributes,{'tableName':_0x0d7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 1cae50e..0290cae 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x952069,_0x95198f){var _0x5e8273=function(_0xcd0a8){while(--_0xcd0a8){_0x952069['push'](_0x952069['shift']());}};_0x5e8273(++_0x95198f);}(_0x70e0,0x17b));var _0x070e=function(_0x479255,_0x1bad8c){_0x479255=_0x479255-0x0;var _0x30815f=_0x70e0[_0x479255];return _0x30815f;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x47cebb,_0x371972){var _0x1d9d6d=function(_0x8baa2e){while(--_0x8baa2e){_0x47cebb['push'](_0x47cebb['shift']());}};_0x1d9d6d(++_0x371972);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0xcb91[_0x305c31];return _0x17f39f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 7963aa0..9a59e7a 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 _0xcd28=['exports','INTEGER'];(function(_0x5e5d0f,_0x11c528){var _0xab96bf=function(_0x1fd5da){while(--_0x1fd5da){_0x5e5d0f['push'](_0x5e5d0f['shift']());}};_0xab96bf(++_0x11c528);}(_0xcd28,0x18c));var _0x8cd2=function(_0x17b9af,_0xa33811){_0x17b9af=_0x17b9af-0x0;var _0x461cd0=_0xcd28[_0x17b9af];return _0x461cd0;};'use strict';var Sequelize=require('sequelize');module[_0x8cd2('0x0')]={'penalty':{'type':Sequelize[_0x8cd2('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5126=['INTEGER','sequelize','exports'];(function(_0x506544,_0x3a5287){var _0x9282a3=function(_0x17ebb2){while(--_0x17ebb2){_0x506544['push'](_0x506544['shift']());}};_0x9282a3(++_0x3a5287);}(_0x5126,0x7c));var _0x6512=function(_0x44c1f1,_0x4c57b4){_0x44c1f1=_0x44c1f1-0x0;var _0x23dcd5=_0x5126[_0x44c1f1];return _0x23dcd5;};'use strict';var Sequelize=require(_0x6512('0x0'));module[_0x6512('0x1')]={'penalty':{'type':Sequelize[_0x6512('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 2d4c819..5596330 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 _0xf6fb=['define','TeamVoiceQueue','team_has_voice_queues','../../config/logger','api','bluebird','request-promise','rimraf','./teamVoiceQueue.attributes','exports'];(function(_0x495927,_0x4e7c43){var _0xae37d=function(_0xac03ed){while(--_0xac03ed){_0x495927['push'](_0x495927['shift']());}};_0xae37d(++_0x4e7c43);}(_0xf6fb,0x111));var _0xbf6f=function(_0x459467,_0x161bbd){_0x459467=_0x459467-0x0;var _0x10eba5=_0xf6fb[_0x459467];return _0x10eba5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf6f('0x0'))(_0xbf6f('0x1'));var moment=require('moment');var BPromise=require(_0xbf6f('0x2'));var rp=require(_0xbf6f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf6f('0x4'));var config=require('../../config/environment');var attributes=require(_0xbf6f('0x5'));module[_0xbf6f('0x6')]=function(_0x2d8ffb,_0x370983){return _0x2d8ffb[_0xbf6f('0x7')](_0xbf6f('0x8'),attributes,{'tableName':_0xbf6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d9b=['util','../../config/logger','api','moment','path','../../config/environment','./teamVoiceQueue.attributes','define','lodash'];(function(_0x3d4472,_0x32614d){var _0x3df20f=function(_0x5dde98){while(--_0x5dde98){_0x3d4472['push'](_0x3d4472['shift']());}};_0x3df20f(++_0x32614d);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var util=require(_0xb8d9('0x1'));var logger=require(_0xb8d9('0x2'))(_0xb8d9('0x3'));var moment=require(_0xb8d9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8d9('0x5'));var rimraf=require('rimraf');var config=require(_0xb8d9('0x6'));var attributes=require(_0xb8d9('0x7'));module['exports']=function(_0x5996e9,_0x529b0a){return _0x5996e9[_0xb8d9('0x8')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','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 053ac95..05d6911 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 _0xb9da=['TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info'];(function(_0x4ad323,_0x40e25e){var _0xe4b67d=function(_0x993c26){while(--_0x993c26){_0x4ad323['push'](_0x4ad323['shift']());}};_0xe4b67d(++_0x40e25e);}(_0xb9da,0x1d6));var _0xab9d=function(_0x3be2e2,_0x5c166d){_0x3be2e2=_0x3be2e2-0x0;var _0x53b9c5=_0xb9da[_0x3be2e2];return _0x53b9c5;};'use strict';var _=require(_0xab9d('0x0'));var util=require(_0xab9d('0x1'));var moment=require(_0xab9d('0x2'));var BPromise=require(_0xab9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab9d('0x4'));var db=require(_0xab9d('0x5'))['db'];var utils=require(_0xab9d('0x6'));var logger=require(_0xab9d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab9d('0x8'));var client=jayson[_0xab9d('0x9')][_0xab9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1146fc,_0xd4a6c,_0x6caba6){return new BPromise(function(_0x46fb17,_0x59e162){return client[_0xab9d('0xb')](_0x1146fc,_0x6caba6)['then'](function(_0x20b703){logger[_0xab9d('0xc')](_0xab9d('0xd'),_0xd4a6c,'request\x20sent');logger[_0xab9d('0xe')](_0xab9d('0xf'),_0xd4a6c,_0xab9d('0x10'),JSON[_0xab9d('0x11')](_0x20b703));if(_0x20b703['error']){if(_0x20b703['error'][_0xab9d('0x12')]===0x1f4){logger[_0xab9d('0x13')](_0xab9d('0xd'),_0xd4a6c,_0x20b703[_0xab9d('0x13')][_0xab9d('0x14')]);return _0x59e162(_0x20b703[_0xab9d('0x13')][_0xab9d('0x14')]);}logger[_0xab9d('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0xd4a6c,_0x20b703[_0xab9d('0x13')][_0xab9d('0x14')]);return _0x46fb17(_0x20b703['error'][_0xab9d('0x14')]);}else{logger['info'](_0xab9d('0xd'),_0xd4a6c,_0xab9d('0x10'));_0x46fb17(_0x20b703[_0xab9d('0x15')]['message']);}})[_0xab9d('0x16')](function(_0x3616ad){logger[_0xab9d('0x13')](_0xab9d('0xd'),_0xd4a6c,_0x3616ad);_0x59e162(_0x3616ad);});});} \ No newline at end of file +var _0x643f=['message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x556bbc,_0x3d16aa){var _0x456cb3=function(_0x3e5b27){while(--_0x3e5b27){_0x556bbc['push'](_0x556bbc['shift']());}};_0x456cb3(++_0x3d16aa);}(_0x643f,0x1e6));var _0xf643=function(_0x67fdbf,_0xc3c2f3){_0x67fdbf=_0x67fdbf-0x0;var _0x3e8004=_0x643f[_0x67fdbf];return _0x3e8004;};'use strict';var _=require('lodash');var util=require(_0xf643('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf643('0x1'));var fs=require('fs');var Redis=require(_0xf643('0x2'));var db=require(_0xf643('0x3'))['db'];var utils=require(_0xf643('0x4'));var logger=require(_0xf643('0x5'))(_0xf643('0x6'));var config=require(_0xf643('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf643('0x8')][_0xf643('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x531a6e,_0x5acb9a,_0x28904b){return new BPromise(function(_0x3544d6,_0x36cf77){return client['request'](_0x531a6e,_0x28904b)[_0xf643('0xa')](function(_0x2f0a19){logger[_0xf643('0xb')](_0xf643('0xc'),_0x5acb9a,_0xf643('0xd'));logger[_0xf643('0xe')](_0xf643('0xf'),_0x5acb9a,_0xf643('0xd'),JSON[_0xf643('0x10')](_0x2f0a19));if(_0x2f0a19[_0xf643('0x11')]){if(_0x2f0a19[_0xf643('0x11')]['code']===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x5acb9a,_0x2f0a19['error'][_0xf643('0x12')]);return _0x36cf77(_0x2f0a19['error']['message']);}logger[_0xf643('0x11')](_0xf643('0xc'),_0x5acb9a,_0x2f0a19['error'][_0xf643('0x12')]);return _0x3544d6(_0x2f0a19[_0xf643('0x11')][_0xf643('0x12')]);}else{logger[_0xf643('0xb')](_0xf643('0xc'),_0x5acb9a,_0xf643('0xd'));_0x3544d6(_0x2f0a19[_0xf643('0x13')][_0xf643('0x12')]);}})[_0xf643('0x14')](function(_0x3f1566){logger[_0xf643('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x5acb9a,_0x3f1566);_0x36cf77(_0x3f1566);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index c1f3760..f395ef1 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 _0x9f0e=['../../config/environment','./template.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9f0e,0x116));var _0xe9f0=function(_0x5503c1,_0x59a45f){_0x5503c1=_0x5503c1-0x0;var _0x352e10=_0x9f0e[_0x5503c1];return _0x352e10;};'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['show']);router[_0xe9f0('0xc')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xa'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);module[_0xe9f0('0x12')]=router; \ No newline at end of file +var _0xa46e=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','create','update','delete'];(function(_0x146be0,_0x39a85e){var _0x1bcc25=function(_0x4f871f){while(--_0x4f871f){_0x146be0['push'](_0x146be0['shift']());}};_0x1bcc25(++_0x39a85e);}(_0xa46e,0x8a));var _0xea46=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0xa46e[_0x277af0];return _0x43bd7c;};'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('./template.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0xb')]('/',auth[_0xea46('0x9')](),controller[_0xea46('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xea46('0xd')]);router[_0xea46('0xe')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xf')]);module[_0xea46('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e1223bf..e09576c 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 _0x6a87=['sequelize','STRING','TEXT'];(function(_0x170a93,_0x69bda0){var _0x4adb1a=function(_0xe8c940){while(--_0xe8c940){_0x170a93['push'](_0x170a93['shift']());}};_0x4adb1a(++_0x69bda0);}(_0x6a87,0x1bc));var _0x76a8=function(_0x42abcf,_0x2ceadc){_0x42abcf=_0x42abcf-0x0;var _0x5d13b5=_0x6a87[_0x42abcf];return _0x5d13b5;};'use strict';var Sequelize=require(_0x76a8('0x0'));module['exports']={'name':{'type':Sequelize[_0x76a8('0x1')]},'description':{'type':Sequelize[_0x76a8('0x1')]},'html':{'type':Sequelize[_0x76a8('0x2')]}}; \ No newline at end of file +var _0x37db=['sequelize','exports','STRING','TEXT'];(function(_0x2169ed,_0x2b39f8){var _0x35c6f4=function(_0x13f577){while(--_0x13f577){_0x2169ed['push'](_0x2169ed['shift']());}};_0x35c6f4(++_0x2b39f8);}(_0x37db,0x144));var _0xb37d=function(_0x24b156,_0xc079ef){_0x24b156=_0x24b156-0x0;var _0xc6ceec=_0x37db[_0x24b156];return _0xc6ceec;};'use strict';var Sequelize=require(_0xb37d('0x0'));module[_0xb37d('0x1')]={'name':{'type':Sequelize[_0xb37d('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xb37d('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index a229583..ef9ec3b 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 _0xa0a2=['stack','name','status','send','map','Template','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','get','Templates','UserProfileResource','then','error'];(function(_0x3e7336,_0x3fe25e){var _0x31357c=function(_0x5d1eaf){while(--_0x5d1eaf){_0x3e7336['push'](_0x3e7336['shift']());}};_0x31357c(++_0x3fe25e);}(_0xa0a2,0x81));var _0x2a0a=function(_0x591a90,_0x5525b0){_0x591a90=_0x591a90-0x0;var _0x551587=_0xa0a2[_0x591a90];return _0x551587;};'use strict';var emlformat=require(_0x2a0a('0x0'));var rimraf=require(_0x2a0a('0x1'));var zipdir=require(_0x2a0a('0x2'));var jsonpatch=require(_0x2a0a('0x3'));var rp=require(_0x2a0a('0x4'));var moment=require(_0x2a0a('0x5'));var BPromise=require(_0x2a0a('0x6'));var Mustache=require('mustache');var util=require(_0x2a0a('0x7'));var path=require(_0x2a0a('0x8'));var sox=require(_0x2a0a('0x9'));var csv=require(_0x2a0a('0xa'));var ejs=require(_0x2a0a('0xb'));var fs=require('fs');var fs_extra=require(_0x2a0a('0xc'));var _=require(_0x2a0a('0xd'));var squel=require(_0x2a0a('0xe'));var crypto=require(_0x2a0a('0xf'));var jsforce=require(_0x2a0a('0x10'));var deskjs=require(_0x2a0a('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2a0a('0x12'));var Papa=require(_0x2a0a('0x13'));var Redis=require('ioredis');var authService=require(_0x2a0a('0x14'));var qs=require(_0x2a0a('0x15'));var as=require(_0x2a0a('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a0a('0x17'))(_0x2a0a('0x18'));var utils=require(_0x2a0a('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2a0a('0x1a'));var db=require(_0x2a0a('0x1b'))['db'];function respondWithStatusCode(_0x204546,_0xaf0759){_0xaf0759=_0xaf0759||0xcc;return function(_0x1f6c69){if(_0x1f6c69){return _0x204546[_0x2a0a('0x1c')](_0xaf0759);}return _0x204546['status'](_0xaf0759)[_0x2a0a('0x1d')]();};}function respondWithResult(_0x2d82a7,_0xfff64c){_0xfff64c=_0xfff64c||0xc8;return function(_0x32bed9){if(_0x32bed9){return _0x2d82a7['status'](_0xfff64c)[_0x2a0a('0x1e')](_0x32bed9);}};}function respondWithFilteredResult(_0xa92b45,_0x14a8dd){return function(_0x5e07fe){if(_0x5e07fe){var _0x35f8c8=typeof _0x14a8dd[_0x2a0a('0x1f')]===_0x2a0a('0x20')&&typeof _0x14a8dd[_0x2a0a('0x21')]===_0x2a0a('0x20');var _0x1e5f9f=_0x5e07fe['count'];var _0xfc4dcb=_0x35f8c8?0x0:_0x14a8dd['offset'];var _0x14bef2=_0x35f8c8?_0x5e07fe['count']:_0x14a8dd[_0x2a0a('0x1f')]+_0x14a8dd[_0x2a0a('0x21')];var _0xd0b07f;if(_0x14bef2>=_0x1e5f9f){_0x14bef2=_0x1e5f9f;_0xd0b07f=0xc8;}else{_0xd0b07f=0xce;}_0xa92b45['status'](_0xd0b07f);return _0xa92b45['set'](_0x2a0a('0x22'),_0xfc4dcb+'-'+_0x14bef2+'/'+_0x1e5f9f)[_0x2a0a('0x1e')](_0x5e07fe);}return null;};}function patchUpdates(_0x3b5fe7){return function(_0x342e8b){try{jsonpatch[_0x2a0a('0x23')](_0x342e8b,_0x3b5fe7,!![]);}catch(_0x528844){return BPromise[_0x2a0a('0x24')](_0x528844);}return _0x342e8b[_0x2a0a('0x25')]();};}function saveUpdates(_0x4753be,_0x48034e){return function(_0x40b763){if(_0x40b763){return _0x40b763[_0x2a0a('0x26')](_0x4753be)['then'](function(_0x5db923){return _0x5db923;});}return null;};}function removeEntity(_0x5c20c3,_0x3277bf){return function(_0x2f2db2){if(_0x2f2db2){return _0x2f2db2[_0x2a0a('0x27')]()['then'](function(){var _0x4b1d32=_0x2f2db2[_0x2a0a('0x28')]({'plain':!![]});var _0x56d626=_0x2a0a('0x29');return db[_0x2a0a('0x2a')][_0x2a0a('0x27')]({'where':{'type':_0x56d626,'resourceId':_0x4b1d32['id']}})[_0x2a0a('0x2b')](function(){return _0x2f2db2;});})[_0x2a0a('0x2b')](function(){_0x5c20c3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5666bb,_0x149e61){return function(_0x203706){if(!_0x203706){_0x5666bb[_0x2a0a('0x1c')](0x194);}return _0x203706;};}function handleError(_0x1fc2d8,_0x5720c8){_0x5720c8=_0x5720c8||0x1f4;return function(_0x132e74){logger[_0x2a0a('0x2c')](_0x132e74[_0x2a0a('0x2d')]);if(_0x132e74[_0x2a0a('0x2e')]){delete _0x132e74[_0x2a0a('0x2e')];}_0x1fc2d8[_0x2a0a('0x2f')](_0x5720c8)[_0x2a0a('0x30')](_0x132e74);};}exports['index']=function(_0x5066e4,_0x535c16){var _0x1ac046={},_0x274be2={},_0x280f54={'count':0x0,'rows':[]};var _0x1c1414=_[_0x2a0a('0x31')](db[_0x2a0a('0x32')]['rawAttributes'],function(_0xb787a6){return{'name':_0xb787a6[_0x2a0a('0x33')],'type':_0xb787a6['type'][_0x2a0a('0x34')]};});_0x274be2['model']=_[_0x2a0a('0x31')](_0x1c1414,_0x2a0a('0x2e'));_0x274be2[_0x2a0a('0x35')]=_[_0x2a0a('0x36')](_0x5066e4[_0x2a0a('0x35')]);_0x274be2[_0x2a0a('0x37')]=_[_0x2a0a('0x38')](_0x274be2[_0x2a0a('0x39')],_0x274be2[_0x2a0a('0x35')]);_0x1ac046[_0x2a0a('0x3a')]=_[_0x2a0a('0x38')](_0x274be2['model'],qs['fields'](_0x5066e4['query'][_0x2a0a('0x3b')]));_0x1ac046[_0x2a0a('0x3a')]=_0x1ac046[_0x2a0a('0x3a')][_0x2a0a('0x3c')]?_0x1ac046[_0x2a0a('0x3a')]:_0x274be2[_0x2a0a('0x39')];if(!_0x5066e4[_0x2a0a('0x35')]['hasOwnProperty'](_0x2a0a('0x3d'))){_0x1ac046[_0x2a0a('0x21')]=qs[_0x2a0a('0x21')](_0x5066e4[_0x2a0a('0x35')][_0x2a0a('0x21')]);_0x1ac046[_0x2a0a('0x1f')]=qs[_0x2a0a('0x1f')](_0x5066e4[_0x2a0a('0x35')][_0x2a0a('0x1f')]);}_0x1ac046[_0x2a0a('0x3e')]=qs[_0x2a0a('0x3f')](_0x5066e4['query'][_0x2a0a('0x3f')]);_0x1ac046[_0x2a0a('0x40')]=qs[_0x2a0a('0x37')](_[_0x2a0a('0x41')](_0x5066e4['query'],_0x274be2['filters']),_0x1c1414);if(_0x5066e4['query'][_0x2a0a('0x42')]){_0x1ac046[_0x2a0a('0x40')]=_[_0x2a0a('0x43')](_0x1ac046[_0x2a0a('0x40')],{'$or':_['map'](_0x1c1414,function(_0x1352ca){if(_0x1352ca['type']!==_0x2a0a('0x44')){var _0x4262a3={};_0x4262a3[_0x1352ca['name']]={'$like':'%'+_0x5066e4[_0x2a0a('0x35')][_0x2a0a('0x42')]+'%'};return _0x4262a3;}})});}_0x1ac046=_['merge']({},_0x1ac046,_0x5066e4['options']);var _0x485f42={'where':_0x1ac046[_0x2a0a('0x40')]};return db[_0x2a0a('0x32')][_0x2a0a('0x45')](_0x485f42)[_0x2a0a('0x2b')](function(_0xca67c1){_0x280f54[_0x2a0a('0x45')]=_0xca67c1;if(_0x5066e4['query'][_0x2a0a('0x46')]){_0x1ac046[_0x2a0a('0x47')]=[{'all':!![]}];}return db[_0x2a0a('0x32')]['findAll'](_0x1ac046);})[_0x2a0a('0x2b')](function(_0x13545a){_0x280f54[_0x2a0a('0x48')]=_0x13545a;return _0x280f54;})[_0x2a0a('0x2b')](respondWithFilteredResult(_0x535c16,_0x1ac046))[_0x2a0a('0x49')](handleError(_0x535c16,null));};exports[_0x2a0a('0x4a')]=function(_0x5a15b5,_0x4d9ff9){var _0x52370c={'raw':!![],'where':{'id':_0x5a15b5[_0x2a0a('0x4b')]['id']}},_0x49c0b1={};_0x49c0b1[_0x2a0a('0x39')]=_[_0x2a0a('0x36')](db['Template'][_0x2a0a('0x4c')]);_0x49c0b1[_0x2a0a('0x35')]=_[_0x2a0a('0x36')](_0x5a15b5[_0x2a0a('0x35')]);_0x49c0b1[_0x2a0a('0x37')]=_[_0x2a0a('0x38')](_0x49c0b1['model'],_0x49c0b1[_0x2a0a('0x35')]);_0x52370c[_0x2a0a('0x3a')]=_[_0x2a0a('0x38')](_0x49c0b1[_0x2a0a('0x39')],qs[_0x2a0a('0x3b')](_0x5a15b5[_0x2a0a('0x35')][_0x2a0a('0x3b')]));_0x52370c[_0x2a0a('0x3a')]=_0x52370c[_0x2a0a('0x3a')][_0x2a0a('0x3c')]?_0x52370c[_0x2a0a('0x3a')]:_0x49c0b1[_0x2a0a('0x39')];if(_0x5a15b5[_0x2a0a('0x35')][_0x2a0a('0x46')]){_0x52370c[_0x2a0a('0x47')]=[{'all':!![]}];}_0x52370c=_[_0x2a0a('0x43')]({},_0x52370c,_0x5a15b5['options']);return db[_0x2a0a('0x32')]['find'](_0x52370c)[_0x2a0a('0x2b')](handleEntityNotFound(_0x4d9ff9,null))[_0x2a0a('0x2b')](respondWithResult(_0x4d9ff9,null))[_0x2a0a('0x49')](handleError(_0x4d9ff9,null));};exports[_0x2a0a('0x4d')]=function(_0x227b10,_0x50332f){return db['Template']['create'](_0x227b10[_0x2a0a('0x4e')],{})[_0x2a0a('0x2b')](function(_0x504568){var _0x5857dd=_0x227b10[_0x2a0a('0x4f')]['get']({'plain':!![]});if(!_0x5857dd)throw new Error(_0x2a0a('0x50'));if(_0x5857dd[_0x2a0a('0x51')]==='user'){var _0x599d95=_0x504568[_0x2a0a('0x28')]({'plain':!![]});var _0x2aa4be=_0x2a0a('0x29');return db[_0x2a0a('0x52')]['find']({'where':{'name':_0x2aa4be,'userProfileId':_0x5857dd[_0x2a0a('0x53')]},'raw':!![]})['then'](function(_0x1549be){if(_0x1549be&&_0x1549be[_0x2a0a('0x54')]===0x0){return db[_0x2a0a('0x2a')][_0x2a0a('0x4d')]({'name':_0x599d95[_0x2a0a('0x2e')],'resourceId':_0x599d95['id'],'type':_0x1549be[_0x2a0a('0x2e')],'sectionId':_0x1549be['id']},{})[_0x2a0a('0x2b')](function(){return _0x504568;});}else{return _0x504568;}})[_0x2a0a('0x49')](function(_0x4b5560){logger[_0x2a0a('0x2c')](_0x2a0a('0x55'),_0x4b5560);throw _0x4b5560;});}return _0x504568;})[_0x2a0a('0x2b')](respondWithResult(_0x50332f,0xc9))[_0x2a0a('0x49')](handleError(_0x50332f,null));};exports[_0x2a0a('0x26')]=function(_0x11f7da,_0x3571c0){if(_0x11f7da[_0x2a0a('0x4e')]['id']){delete _0x11f7da[_0x2a0a('0x4e')]['id'];}return db[_0x2a0a('0x32')][_0x2a0a('0x56')]({'where':{'id':_0x11f7da[_0x2a0a('0x4b')]['id']}})[_0x2a0a('0x2b')](handleEntityNotFound(_0x3571c0,null))['then'](saveUpdates(_0x11f7da[_0x2a0a('0x4e')],null))['then'](respondWithResult(_0x3571c0,null))[_0x2a0a('0x49')](handleError(_0x3571c0,null));};exports['destroy']=function(_0x732bb9,_0x1feb71){return db[_0x2a0a('0x32')]['find']({'where':{'id':_0x732bb9['params']['id']}})['then'](handleEntityNotFound(_0x1feb71,null))['then'](removeEntity(_0x1feb71,null))[_0x2a0a('0x49')](handleError(_0x1feb71,null));}; \ No newline at end of file +var _0x986f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','index','map','Template','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params'];(function(_0x41f3f6,_0x2f4694){var _0x4c006a=function(_0x23043e){while(--_0x23043e){_0x41f3f6['push'](_0x41f3f6['shift']());}};_0x4c006a(++_0x2f4694);}(_0x986f,0xa8));var _0xf986=function(_0x2557b0,_0x57fba2){_0x2557b0=_0x2557b0-0x0;var _0x468e8f=_0x986f[_0x2557b0];return _0x468e8f;};'use strict';var emlformat=require(_0xf986('0x0'));var rimraf=require(_0xf986('0x1'));var zipdir=require(_0xf986('0x2'));var jsonpatch=require(_0xf986('0x3'));var rp=require(_0xf986('0x4'));var moment=require('moment');var BPromise=require(_0xf986('0x5'));var Mustache=require(_0xf986('0x6'));var util=require(_0xf986('0x7'));var path=require(_0xf986('0x8'));var sox=require('sox');var csv=require(_0xf986('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf986('0xa'));var _=require(_0xf986('0xb'));var squel=require(_0xf986('0xc'));var crypto=require(_0xf986('0xd'));var jsforce=require(_0xf986('0xe'));var deskjs=require(_0xf986('0xf'));var toCsv=require(_0xf986('0x9'));var querystring=require(_0xf986('0x10'));var Papa=require('papaparse');var Redis=require(_0xf986('0x11'));var authService=require(_0xf986('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf986('0x13'));var hardwareService=require(_0xf986('0x14'));var logger=require(_0xf986('0x15'))(_0xf986('0x16'));var utils=require(_0xf986('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf986('0x18'))['db'];function respondWithStatusCode(_0x5ac359,_0x199022){_0x199022=_0x199022||0xcc;return function(_0x3f675d){if(_0x3f675d){return _0x5ac359[_0xf986('0x19')](_0x199022);}return _0x5ac359[_0xf986('0x1a')](_0x199022)[_0xf986('0x1b')]();};}function respondWithResult(_0x1c7316,_0xf748e7){_0xf748e7=_0xf748e7||0xc8;return function(_0x1d14bd){if(_0x1d14bd){return _0x1c7316[_0xf986('0x1a')](_0xf748e7)['json'](_0x1d14bd);}};}function respondWithFilteredResult(_0x177154,_0x428bf3){return function(_0x3c995b){if(_0x3c995b){var _0x24c024=typeof _0x428bf3[_0xf986('0x1c')]===_0xf986('0x1d')&&typeof _0x428bf3[_0xf986('0x1e')]===_0xf986('0x1d');var _0x4aff19=_0x3c995b[_0xf986('0x1f')];var _0x48e2b3=_0x24c024?0x0:_0x428bf3['offset'];var _0x7b34c2=_0x24c024?_0x3c995b[_0xf986('0x1f')]:_0x428bf3[_0xf986('0x1c')]+_0x428bf3[_0xf986('0x1e')];var _0x1ac80c;if(_0x7b34c2>=_0x4aff19){_0x7b34c2=_0x4aff19;_0x1ac80c=0xc8;}else{_0x1ac80c=0xce;}_0x177154[_0xf986('0x1a')](_0x1ac80c);return _0x177154[_0xf986('0x20')](_0xf986('0x21'),_0x48e2b3+'-'+_0x7b34c2+'/'+_0x4aff19)['json'](_0x3c995b);}return null;};}function patchUpdates(_0x21eb89){return function(_0xfe3857){try{jsonpatch[_0xf986('0x22')](_0xfe3857,_0x21eb89,!![]);}catch(_0x18984a){return BPromise[_0xf986('0x23')](_0x18984a);}return _0xfe3857[_0xf986('0x24')]();};}function saveUpdates(_0x8eaf63,_0x417008){return function(_0x54606a){if(_0x54606a){return _0x54606a['update'](_0x8eaf63)[_0xf986('0x25')](function(_0x24a742){return _0x24a742;});}return null;};}function removeEntity(_0x1c2015,_0x3f5ce5){return function(_0x759a43){if(_0x759a43){return _0x759a43['destroy']()[_0xf986('0x25')](function(){var _0x657fb7=_0x759a43[_0xf986('0x26')]({'plain':!![]});var _0x563c11='Templates';return db[_0xf986('0x27')][_0xf986('0x28')]({'where':{'type':_0x563c11,'resourceId':_0x657fb7['id']}})[_0xf986('0x25')](function(){return _0x759a43;});})[_0xf986('0x25')](function(){_0x1c2015[_0xf986('0x1a')](0xcc)[_0xf986('0x1b')]();});}};}function handleEntityNotFound(_0x314edb,_0x33a60b){return function(_0x14c009){if(!_0x14c009){_0x314edb[_0xf986('0x19')](0x194);}return _0x14c009;};}function handleError(_0x5da339,_0x37ab85){_0x37ab85=_0x37ab85||0x1f4;return function(_0x3226c0){logger['error'](_0x3226c0[_0xf986('0x29')]);if(_0x3226c0[_0xf986('0x2a')]){delete _0x3226c0[_0xf986('0x2a')];}_0x5da339[_0xf986('0x1a')](_0x37ab85)[_0xf986('0x2b')](_0x3226c0);};}exports[_0xf986('0x2c')]=function(_0x2ac740,_0x5cc2d9){var _0x1f5142={},_0x444698={},_0x4a970e={'count':0x0,'rows':[]};var _0x4e560a=_[_0xf986('0x2d')](db[_0xf986('0x2e')][_0xf986('0x2f')],function(_0x240408){return{'name':_0x240408['fieldName'],'type':_0x240408[_0xf986('0x30')][_0xf986('0x31')]};});_0x444698[_0xf986('0x32')]=_[_0xf986('0x2d')](_0x4e560a,'name');_0x444698['query']=_[_0xf986('0x33')](_0x2ac740[_0xf986('0x34')]);_0x444698[_0xf986('0x35')]=_['intersection'](_0x444698[_0xf986('0x32')],_0x444698[_0xf986('0x34')]);_0x1f5142[_0xf986('0x36')]=_[_0xf986('0x37')](_0x444698['model'],qs[_0xf986('0x38')](_0x2ac740[_0xf986('0x34')]['fields']));_0x1f5142['attributes']=_0x1f5142['attributes']['length']?_0x1f5142[_0xf986('0x36')]:_0x444698[_0xf986('0x32')];if(!_0x2ac740['query'][_0xf986('0x39')](_0xf986('0x3a'))){_0x1f5142[_0xf986('0x1e')]=qs[_0xf986('0x1e')](_0x2ac740[_0xf986('0x34')]['limit']);_0x1f5142['offset']=qs[_0xf986('0x1c')](_0x2ac740[_0xf986('0x34')][_0xf986('0x1c')]);}_0x1f5142[_0xf986('0x3b')]=qs['sort'](_0x2ac740['query'][_0xf986('0x3c')]);_0x1f5142[_0xf986('0x3d')]=qs[_0xf986('0x35')](_[_0xf986('0x3e')](_0x2ac740[_0xf986('0x34')],_0x444698[_0xf986('0x35')]),_0x4e560a);if(_0x2ac740['query'][_0xf986('0x3f')]){_0x1f5142[_0xf986('0x3d')]=_[_0xf986('0x40')](_0x1f5142['where'],{'$or':_[_0xf986('0x2d')](_0x4e560a,function(_0x5e1a0a){if(_0x5e1a0a['type']!=='VIRTUAL'){var _0xf56c71={};_0xf56c71[_0x5e1a0a['name']]={'$like':'%'+_0x2ac740[_0xf986('0x34')][_0xf986('0x3f')]+'%'};return _0xf56c71;}})});}_0x1f5142=_[_0xf986('0x40')]({},_0x1f5142,_0x2ac740[_0xf986('0x41')]);var _0x7d17d0={'where':_0x1f5142[_0xf986('0x3d')]};return db[_0xf986('0x2e')][_0xf986('0x1f')](_0x7d17d0)[_0xf986('0x25')](function(_0x1a1a9d){_0x4a970e[_0xf986('0x1f')]=_0x1a1a9d;if(_0x2ac740[_0xf986('0x34')][_0xf986('0x42')]){_0x1f5142[_0xf986('0x43')]=[{'all':!![]}];}return db[_0xf986('0x2e')][_0xf986('0x44')](_0x1f5142);})[_0xf986('0x25')](function(_0x43ef51){_0x4a970e[_0xf986('0x45')]=_0x43ef51;return _0x4a970e;})[_0xf986('0x25')](respondWithFilteredResult(_0x5cc2d9,_0x1f5142))[_0xf986('0x46')](handleError(_0x5cc2d9,null));};exports['show']=function(_0x54a6a2,_0x3e571a){var _0x58cef3={'raw':!![],'where':{'id':_0x54a6a2['params']['id']}},_0x401b18={};_0x401b18['model']=_['keys'](db['Template'][_0xf986('0x2f')]);_0x401b18[_0xf986('0x34')]=_[_0xf986('0x33')](_0x54a6a2['query']);_0x401b18['filters']=_[_0xf986('0x37')](_0x401b18[_0xf986('0x32')],_0x401b18[_0xf986('0x34')]);_0x58cef3[_0xf986('0x36')]=_[_0xf986('0x37')](_0x401b18[_0xf986('0x32')],qs[_0xf986('0x38')](_0x54a6a2[_0xf986('0x34')][_0xf986('0x38')]));_0x58cef3[_0xf986('0x36')]=_0x58cef3[_0xf986('0x36')][_0xf986('0x47')]?_0x58cef3[_0xf986('0x36')]:_0x401b18[_0xf986('0x32')];if(_0x54a6a2[_0xf986('0x34')][_0xf986('0x42')]){_0x58cef3[_0xf986('0x43')]=[{'all':!![]}];}_0x58cef3=_[_0xf986('0x40')]({},_0x58cef3,_0x54a6a2[_0xf986('0x41')]);return db[_0xf986('0x2e')][_0xf986('0x48')](_0x58cef3)['then'](handleEntityNotFound(_0x3e571a,null))[_0xf986('0x25')](respondWithResult(_0x3e571a,null))['catch'](handleError(_0x3e571a,null));};exports['create']=function(_0x4001fa,_0xec51b6){return db['Template'][_0xf986('0x49')](_0x4001fa['body'],{})[_0xf986('0x25')](function(_0x56b2f4){var _0x3cb9d6=_0x4001fa[_0xf986('0x4a')][_0xf986('0x26')]({'plain':!![]});if(!_0x3cb9d6)throw new Error(_0xf986('0x4b'));if(_0x3cb9d6[_0xf986('0x4c')]===_0xf986('0x4a')){var _0x3d1538=_0x56b2f4[_0xf986('0x26')]({'plain':!![]});var _0x4bbc74='Templates';return db[_0xf986('0x4d')][_0xf986('0x48')]({'where':{'name':_0x4bbc74,'userProfileId':_0x3cb9d6[_0xf986('0x4e')]},'raw':!![]})[_0xf986('0x25')](function(_0x225fd0){if(_0x225fd0&&_0x225fd0[_0xf986('0x4f')]===0x0){return db[_0xf986('0x27')][_0xf986('0x49')]({'name':_0x3d1538[_0xf986('0x2a')],'resourceId':_0x3d1538['id'],'type':_0x225fd0[_0xf986('0x2a')],'sectionId':_0x225fd0['id']},{})[_0xf986('0x25')](function(){return _0x56b2f4;});}else{return _0x56b2f4;}})[_0xf986('0x46')](function(_0x53d7d2){logger[_0xf986('0x50')](_0xf986('0x51'),_0x53d7d2);throw _0x53d7d2;});}return _0x56b2f4;})[_0xf986('0x25')](respondWithResult(_0xec51b6,0xc9))[_0xf986('0x46')](handleError(_0xec51b6,null));};exports[_0xf986('0x52')]=function(_0x51200a,_0x3afbdb){if(_0x51200a['body']['id']){delete _0x51200a['body']['id'];}return db[_0xf986('0x2e')][_0xf986('0x48')]({'where':{'id':_0x51200a['params']['id']}})[_0xf986('0x25')](handleEntityNotFound(_0x3afbdb,null))['then'](saveUpdates(_0x51200a['body'],null))[_0xf986('0x25')](respondWithResult(_0x3afbdb,null))[_0xf986('0x46')](handleError(_0x3afbdb,null));};exports[_0xf986('0x28')]=function(_0x4b1f43,_0x57291e){return db[_0xf986('0x2e')][_0xf986('0x48')]({'where':{'id':_0x4b1f43[_0xf986('0x53')]['id']}})['then'](handleEntityNotFound(_0x57291e,null))[_0xf986('0x25')](removeEntity(_0x57291e,null))[_0xf986('0x46')](handleError(_0x57291e,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 6332880..e560916 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 _0x9b09=['lodash','util','moment','path','rimraf','../../config/environment','Template','tools_templates'];(function(_0xd899ea,_0x29dcdc){var _0x3e254f=function(_0x48c89f){while(--_0x48c89f){_0xd899ea['push'](_0xd899ea['shift']());}};_0x3e254f(++_0x29dcdc);}(_0x9b09,0x1d0));var _0x99b0=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0x9b09[_0x35e75a];return _0xb23c7f;};'use strict';var _=require(_0x99b0('0x0'));var util=require(_0x99b0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x99b0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x99b0('0x3'));var rimraf=require(_0x99b0('0x4'));var config=require(_0x99b0('0x5'));var attributes=require('./template.attributes');module['exports']=function(_0x2fc78a,_0x5a5298){return _0x2fc78a['define'](_0x99b0('0x6'),attributes,{'tableName':_0x99b0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88f2=['request-promise','rimraf','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2419c7,_0x1486e6){var _0x1fd347=function(_0x10716f){while(--_0x10716f){_0x2419c7['push'](_0x2419c7['shift']());}};_0x1fd347(++_0x1486e6);}(_0x88f2,0x66));var _0x288f=function(_0x1cc949,_0x2d58a2){_0x1cc949=_0x1cc949-0x0;var _0x5c4a28=_0x88f2[_0x1cc949];return _0x5c4a28;};'use strict';var _=require(_0x288f('0x0'));var util=require(_0x288f('0x1'));var logger=require(_0x288f('0x2'))(_0x288f('0x3'));var moment=require(_0x288f('0x4'));var BPromise=require(_0x288f('0x5'));var rp=require(_0x288f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x288f('0x7'));var config=require('../../config/environment');var attributes=require(_0x288f('0x8'));module['exports']=function(_0x4234b0,_0x5da8d6){return _0x4234b0[_0x288f('0x9')](_0x288f('0xa'),attributes,{'tableName':_0x288f('0xb'),'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 5823efa..5a67c39 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 _0x0915=['options','raw','where','limit','map','model','attributes','include','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetTemplate','Template','findAll'];(function(_0x5e6d65,_0x5db89c){var _0x5e1f75=function(_0x3729a1){while(--_0x3729a1){_0x5e6d65['push'](_0x5e6d65['shift']());}};_0x5e1f75(++_0x5db89c);}(_0x0915,0x1c5));var _0x5091=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x0915[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x5091('0x0'));var util=require(_0x5091('0x1'));var moment=require(_0x5091('0x2'));var BPromise=require(_0x5091('0x3'));var rs=require(_0x5091('0x4'));var fs=require('fs');var Redis=require(_0x5091('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5091('0x6'));var config=require(_0x5091('0x7'));var jayson=require(_0x5091('0x8'));var client=jayson[_0x5091('0x9')][_0x5091('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecd7f,_0x22a17e,_0x24bd12){return new BPromise(function(_0x4357fb,_0x1d8341){return client[_0x5091('0xb')](_0x5ecd7f,_0x24bd12)['then'](function(_0x4af6c3){logger[_0x5091('0xc')](_0x5091('0xd'),_0x22a17e,_0x5091('0xe'));logger['debug'](_0x5091('0xf'),_0x22a17e,_0x5091('0xe'),JSON[_0x5091('0x10')](_0x4af6c3));if(_0x4af6c3['error']){if(_0x4af6c3[_0x5091('0x11')]['code']===0x1f4){logger[_0x5091('0x11')](_0x5091('0xd'),_0x22a17e,_0x4af6c3[_0x5091('0x11')][_0x5091('0x12')]);return _0x1d8341(_0x4af6c3['error']['message']);}logger[_0x5091('0x11')](_0x5091('0xd'),_0x22a17e,_0x4af6c3[_0x5091('0x11')][_0x5091('0x12')]);return _0x4357fb(_0x4af6c3[_0x5091('0x11')][_0x5091('0x12')]);}else{logger['info'](_0x5091('0xd'),_0x22a17e,'request\x20sent');_0x4357fb(_0x4af6c3[_0x5091('0x13')][_0x5091('0x12')]);}})['catch'](function(_0x3c8d00){logger['error']('Template,\x20%s,\x20%s',_0x22a17e,_0x3c8d00);_0x1d8341(_0x3c8d00);});});}exports[_0x5091('0x14')]=function(_0x189ac6){var _0x5c8729=this;return new Promise(function(_0x36fadd,_0x397657){return db[_0x5091('0x15')][_0x5091('0x16')]({'raw':_0x189ac6[_0x5091('0x17')]?_0x189ac6[_0x5091('0x17')][_0x5091('0x18')]===undefined?!![]:![]:!![],'where':_0x189ac6[_0x5091('0x17')]?_0x189ac6[_0x5091('0x17')][_0x5091('0x19')]||null:null,'attributes':_0x189ac6['options']?_0x189ac6[_0x5091('0x17')]['attributes']||null:null,'limit':_0x189ac6[_0x5091('0x17')]?_0x189ac6[_0x5091('0x17')][_0x5091('0x1a')]||null:null,'include':_0x189ac6[_0x5091('0x17')]?_0x189ac6[_0x5091('0x17')]['include']?_[_0x5091('0x1b')](_0x189ac6[_0x5091('0x17')]['include'],function(_0x35ac42){return{'model':db[_0x35ac42[_0x5091('0x1c')]],'as':_0x35ac42['as'],'attributes':_0x35ac42[_0x5091('0x1d')],'include':_0x35ac42[_0x5091('0x1e')]?_[_0x5091('0x1b')](_0x35ac42[_0x5091('0x1e')],function(_0x483a40){return{'model':db[_0x483a40[_0x5091('0x1c')]],'as':_0x483a40['as'],'attributes':_0x483a40['attributes'],'include':_0x483a40[_0x5091('0x1e')]?_[_0x5091('0x1b')](_0x483a40[_0x5091('0x1e')],function(_0x748ee0){return{'model':db[_0x748ee0[_0x5091('0x1c')]],'as':_0x748ee0['as'],'attributes':_0x748ee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x5091('0x1f')](function(_0x4adfc2){logger[_0x5091('0xc')](_0x5091('0x14'),_0x189ac6);logger[_0x5091('0x20')](_0x5091('0x14'),_0x189ac6,JSON[_0x5091('0x10')](_0x4adfc2));_0x36fadd(_0x4adfc2);})[_0x5091('0x21')](function(_0x3a38d3){logger[_0x5091('0x11')]('GetTemplate',_0x3a38d3['message'],_0x189ac6);_0x397657(_0x5c8729[_0x5091('0x11')](0x1f4,_0x3a38d3[_0x5091('0x12')]));});});}; \ No newline at end of file +var _0x7dc8=['model','include','map','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit'];(function(_0x273de0,_0x564057){var _0x309969=function(_0x1fa6de){while(--_0x1fa6de){_0x273de0['push'](_0x273de0['shift']());}};_0x309969(++_0x564057);}(_0x7dc8,0x1b0));var _0x87dc=function(_0x1d0b52,_0x24b776){_0x1d0b52=_0x1d0b52-0x0;var _0x2e9da3=_0x7dc8[_0x1d0b52];return _0x2e9da3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x87dc('0x0'));var rs=require(_0x87dc('0x1'));var fs=require('fs');var Redis=require(_0x87dc('0x2'));var db=require(_0x87dc('0x3'))['db'];var utils=require(_0x87dc('0x4'));var logger=require('../../config/logger')(_0x87dc('0x5'));var config=require(_0x87dc('0x6'));var jayson=require(_0x87dc('0x7'));var client=jayson[_0x87dc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x223649,_0x528525,_0x543a14){return new BPromise(function(_0xb6148c,_0x548b80){return client[_0x87dc('0x9')](_0x223649,_0x543a14)[_0x87dc('0xa')](function(_0x3a30c1){logger[_0x87dc('0xb')](_0x87dc('0xc'),_0x528525,_0x87dc('0xd'));logger[_0x87dc('0xe')](_0x87dc('0xf'),_0x528525,'request\x20sent',JSON[_0x87dc('0x10')](_0x3a30c1));if(_0x3a30c1[_0x87dc('0x11')]){if(_0x3a30c1[_0x87dc('0x11')][_0x87dc('0x12')]===0x1f4){logger[_0x87dc('0x11')](_0x87dc('0xc'),_0x528525,_0x3a30c1[_0x87dc('0x11')][_0x87dc('0x13')]);return _0x548b80(_0x3a30c1['error'][_0x87dc('0x13')]);}logger['error'](_0x87dc('0xc'),_0x528525,_0x3a30c1[_0x87dc('0x11')][_0x87dc('0x13')]);return _0xb6148c(_0x3a30c1[_0x87dc('0x11')][_0x87dc('0x13')]);}else{logger[_0x87dc('0xb')](_0x87dc('0xc'),_0x528525,'request\x20sent');_0xb6148c(_0x3a30c1[_0x87dc('0x14')]['message']);}})[_0x87dc('0x15')](function(_0x14541b){logger['error'](_0x87dc('0xc'),_0x528525,_0x14541b);_0x548b80(_0x14541b);});});}exports[_0x87dc('0x16')]=function(_0x4f3554){var _0x4b314c=this;return new Promise(function(_0x10af3f,_0x342117){return db[_0x87dc('0x17')][_0x87dc('0x18')]({'raw':_0x4f3554['options']?_0x4f3554[_0x87dc('0x19')][_0x87dc('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f3554[_0x87dc('0x19')]?_0x4f3554[_0x87dc('0x19')][_0x87dc('0x1b')]||null:null,'attributes':_0x4f3554['options']?_0x4f3554[_0x87dc('0x19')][_0x87dc('0x1c')]||null:null,'limit':_0x4f3554[_0x87dc('0x19')]?_0x4f3554[_0x87dc('0x19')][_0x87dc('0x1d')]||null:null,'include':_0x4f3554[_0x87dc('0x19')]?_0x4f3554['options']['include']?_['map'](_0x4f3554[_0x87dc('0x19')]['include'],function(_0x30bf3){return{'model':db[_0x30bf3[_0x87dc('0x1e')]],'as':_0x30bf3['as'],'attributes':_0x30bf3[_0x87dc('0x1c')],'include':_0x30bf3[_0x87dc('0x1f')]?_[_0x87dc('0x20')](_0x30bf3[_0x87dc('0x1f')],function(_0x2adab0){return{'model':db[_0x2adab0[_0x87dc('0x1e')]],'as':_0x2adab0['as'],'attributes':_0x2adab0['attributes'],'include':_0x2adab0[_0x87dc('0x1f')]?_[_0x87dc('0x20')](_0x2adab0['include'],function(_0x2eb6d5){return{'model':db[_0x2eb6d5[_0x87dc('0x1e')]],'as':_0x2eb6d5['as'],'attributes':_0x2eb6d5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c7441){logger['info'](_0x87dc('0x16'),_0x4f3554);logger[_0x87dc('0xe')](_0x87dc('0x16'),_0x4f3554,JSON[_0x87dc('0x10')](_0x4c7441));_0x10af3f(_0x4c7441);})[_0x87dc('0x15')](function(_0x1fa42a){logger[_0x87dc('0x11')](_0x87dc('0x16'),_0x1fa42a[_0x87dc('0x13')],_0x4f3554);_0x342117(_0x4b314c[_0x87dc('0x11')](0x1f4,_0x1fa42a[_0x87dc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 9e8de99..07236bf 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 _0x60d7=['get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','addAllCondition','addAction','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x490417,_0xd287e2){var _0x2b9524=function(_0x23a118){while(--_0x23a118){_0x490417['push'](_0x490417['shift']());}};_0x2b9524(++_0xd287e2);}(_0x60d7,0x149));var _0x760d=function(_0x36f6f0,_0x17d022){_0x36f6f0=_0x36f6f0-0x0;var _0xefa562=_0x60d7[_0x36f6f0];return _0xefa562;};'use strict';var multer=require(_0x760d('0x0'));var util=require(_0x760d('0x1'));var path=require(_0x760d('0x2'));var timeout=require(_0x760d('0x3'));var express=require(_0x760d('0x4'));var router=express[_0x760d('0x5')]();var fs_extra=require(_0x760d('0x6'));var auth=require(_0x760d('0x7'));var interaction=require(_0x760d('0x8'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x760d('0x9')]('/',auth[_0x760d('0xa')](),controller[_0x760d('0xb')]);router[_0x760d('0x9')](_0x760d('0xc'),auth[_0x760d('0xa')](),controller[_0x760d('0xd')]);router[_0x760d('0x9')](_0x760d('0xe'),auth[_0x760d('0xa')](),controller[_0x760d('0xf')]);router[_0x760d('0x9')](_0x760d('0x10'),auth['isAuthenticated'](),controller[_0x760d('0x11')]);router[_0x760d('0x9')](_0x760d('0x12'),auth[_0x760d('0xa')](),controller[_0x760d('0x13')]);router['post']('/',auth[_0x760d('0xa')](),controller[_0x760d('0x14')]);router[_0x760d('0x15')](_0x760d('0xe'),auth[_0x760d('0xa')](),controller[_0x760d('0x16')]);router[_0x760d('0x15')](_0x760d('0x10'),auth[_0x760d('0xa')](),controller['addAnyCondition']);router['post'](_0x760d('0x12'),auth['isAuthenticated'](),controller[_0x760d('0x17')]);router['put'](_0x760d('0xc'),auth['isAuthenticated'](),controller[_0x760d('0x18')]);router['delete'](_0x760d('0xc'),auth[_0x760d('0xa')](),controller[_0x760d('0x19')]);module['exports']=router; \ No newline at end of file +var _0x25c2=['index','/:id','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','/:id/all_conditions','addAnyCondition','addAction','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x449f61,_0x232c0d){var _0x3b57f3=function(_0x43b26e){while(--_0x43b26e){_0x449f61['push'](_0x449f61['shift']());}};_0x3b57f3(++_0x232c0d);}(_0x25c2,0xdd));var _0x225c=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x25c2[_0x29db36];return _0x234e87;};'use strict';var multer=require(_0x225c('0x0'));var util=require('util');var path=require(_0x225c('0x1'));var timeout=require(_0x225c('0x2'));var express=require('express');var router=express[_0x225c('0x3')]();var fs_extra=require(_0x225c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x225c('0x5'));var config=require(_0x225c('0x6'));var controller=require('./trigger.controller');router[_0x225c('0x7')]('/',auth[_0x225c('0x8')](),controller[_0x225c('0x9')]);router[_0x225c('0x7')](_0x225c('0xa'),auth[_0x225c('0x8')](),controller['show']);router[_0x225c('0x7')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x225c('0xb')]);router[_0x225c('0x7')](_0x225c('0xc'),auth['isAuthenticated'](),controller[_0x225c('0xd')]);router[_0x225c('0x7')](_0x225c('0xe'),auth[_0x225c('0x8')](),controller['getActions']);router[_0x225c('0xf')]('/',auth[_0x225c('0x8')](),controller['create']);router[_0x225c('0xf')](_0x225c('0x10'),auth[_0x225c('0x8')](),controller['addAllCondition']);router[_0x225c('0xf')](_0x225c('0xc'),auth[_0x225c('0x8')](),controller[_0x225c('0x11')]);router[_0x225c('0xf')](_0x225c('0xe'),auth[_0x225c('0x8')](),controller[_0x225c('0x12')]);router['put']('/:id',auth[_0x225c('0x8')](),controller[_0x225c('0x13')]);router[_0x225c('0x14')](_0x225c('0xa'),auth['isAuthenticated'](),controller[_0x225c('0x15')]);module[_0x225c('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index bdc0e18..4a0b6b3 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 _0xe4a3=['exports','STRING'];(function(_0x43c594,_0x5adeb3){var _0x2c2e87=function(_0x10df52){while(--_0x10df52){_0x43c594['push'](_0x43c594['shift']());}};_0x2c2e87(++_0x5adeb3);}(_0xe4a3,0x1ae));var _0x3e4a=function(_0x3f872a,_0x3ec864){_0x3f872a=_0x3f872a-0x0;var _0x13e5fd=_0xe4a3[_0x3f872a];return _0x13e5fd;};'use strict';var Sequelize=require('sequelize');module[_0x3e4a('0x0')]={'name':{'type':Sequelize[_0x3e4a('0x1')]},'channel':{'type':Sequelize[_0x3e4a('0x1')]},'description':{'type':Sequelize[_0x3e4a('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xcc1b=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3167a8,_0x4d5006){var _0x20073f=function(_0x5b7216){while(--_0x5b7216){_0x3167a8['push'](_0x3167a8['shift']());}};_0x20073f(++_0x4d5006);}(_0xcc1b,0x89));var _0xbcc1=function(_0xede81e,_0x15ffce){_0xede81e=_0xede81e-0x0;var _0xb1193=_0xcc1b[_0xede81e];return _0xb1193;};'use strict';var Sequelize=require(_0xbcc1('0x0'));module[_0xbcc1('0x1')]={'name':{'type':Sequelize[_0xbcc1('0x2')]},'channel':{'type':Sequelize[_0xbcc1('0x2')]},'description':{'type':Sequelize[_0xbcc1('0x2')]},'status':{'type':Sequelize[_0xbcc1('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 3da9e15..fd4d1b5 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 _0x3764=['fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Triggers','UserProfileResource','error','stack','name','Trigger','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','TriggerAllId','Condition','TriggerAnyId','findOne','order','pick','getAllConditions','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x4aee90,_0x35faaa){var _0x4fd2ea=function(_0x1617cd){while(--_0x1617cd){_0x4aee90['push'](_0x4aee90['shift']());}};_0x4fd2ea(++_0x35faaa);}(_0x3764,0x116));var _0x4376=function(_0x100497,_0x1aa6a2){_0x100497=_0x100497-0x0;var _0x10f131=_0x3764[_0x100497];return _0x10f131;};'use strict';var emlformat=require(_0x4376('0x0'));var rimraf=require(_0x4376('0x1'));var zipdir=require(_0x4376('0x2'));var jsonpatch=require(_0x4376('0x3'));var rp=require(_0x4376('0x4'));var moment=require(_0x4376('0x5'));var BPromise=require(_0x4376('0x6'));var Mustache=require(_0x4376('0x7'));var util=require(_0x4376('0x8'));var path=require(_0x4376('0x9'));var sox=require(_0x4376('0xa'));var csv=require(_0x4376('0xb'));var ejs=require(_0x4376('0xc'));var fs=require('fs');var fs_extra=require(_0x4376('0xd'));var _=require(_0x4376('0xe'));var squel=require(_0x4376('0xf'));var crypto=require(_0x4376('0x10'));var jsforce=require(_0x4376('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4376('0x12'));var Papa=require('papaparse');var Redis=require(_0x4376('0x13'));var authService=require(_0x4376('0x14'));var qs=require(_0x4376('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4376('0x16'))(_0x4376('0x17'));var utils=require(_0x4376('0x18'));var config=require(_0x4376('0x19'));var licenseUtil=require(_0x4376('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26eb57,_0x131510){_0x131510=_0x131510||0xcc;return function(_0x235425){if(_0x235425){return _0x26eb57[_0x4376('0x1b')](_0x131510);}return _0x26eb57[_0x4376('0x1c')](_0x131510)[_0x4376('0x1d')]();};}function respondWithResult(_0x3524dc,_0x51fa80){_0x51fa80=_0x51fa80||0xc8;return function(_0x36c204){if(_0x36c204){return _0x3524dc[_0x4376('0x1c')](_0x51fa80)[_0x4376('0x1e')](_0x36c204);}};}function respondWithFilteredResult(_0x53223e,_0x2959bf){return function(_0x45c20c){if(_0x45c20c){var _0x4ce40f=typeof _0x2959bf[_0x4376('0x1f')]==='undefined'&&typeof _0x2959bf[_0x4376('0x20')]===_0x4376('0x21');var _0x49f79f=_0x45c20c[_0x4376('0x22')];var _0x998786=_0x4ce40f?0x0:_0x2959bf[_0x4376('0x1f')];var _0x383d37=_0x4ce40f?_0x45c20c[_0x4376('0x22')]:_0x2959bf[_0x4376('0x1f')]+_0x2959bf[_0x4376('0x20')];var _0x18b7ae;if(_0x383d37>=_0x49f79f){_0x383d37=_0x49f79f;_0x18b7ae=0xc8;}else{_0x18b7ae=0xce;}_0x53223e[_0x4376('0x1c')](_0x18b7ae);return _0x53223e[_0x4376('0x23')](_0x4376('0x24'),_0x998786+'-'+_0x383d37+'/'+_0x49f79f)[_0x4376('0x1e')](_0x45c20c);}return null;};}function patchUpdates(_0x1738c1){return function(_0x1a822d){try{jsonpatch[_0x4376('0x25')](_0x1a822d,_0x1738c1,!![]);}catch(_0x50a469){return BPromise[_0x4376('0x26')](_0x50a469);}return _0x1a822d[_0x4376('0x27')]();};}function saveUpdates(_0x24d539,_0xb1bf4){return function(_0x504c31){if(_0x504c31){return _0x504c31['update'](_0x24d539)[_0x4376('0x28')](function(_0x2203a7){return _0x2203a7;});}return null;};}function removeEntity(_0x1baebb,_0x2ec687){return function(_0x14df68){if(_0x14df68){return _0x14df68[_0x4376('0x29')]()['then'](function(){var _0x418147=_0x14df68['get']({'plain':!![]});var _0x33a75f=_0x4376('0x2a');return db[_0x4376('0x2b')]['destroy']({'where':{'type':_0x33a75f,'resourceId':_0x418147['id']}})[_0x4376('0x28')](function(){return _0x14df68;});})[_0x4376('0x28')](function(){_0x1baebb['status'](0xcc)[_0x4376('0x1d')]();});}};}function handleEntityNotFound(_0x456df2,_0x4e8eed){return function(_0x5c4d5b){if(!_0x5c4d5b){_0x456df2[_0x4376('0x1b')](0x194);}return _0x5c4d5b;};}function handleError(_0x59ce09,_0x469c0e){_0x469c0e=_0x469c0e||0x1f4;return function(_0x1bdbff){logger[_0x4376('0x2c')](_0x1bdbff[_0x4376('0x2d')]);if(_0x1bdbff[_0x4376('0x2e')]){delete _0x1bdbff['name'];}_0x59ce09['status'](_0x469c0e)['send'](_0x1bdbff);};}exports['index']=function(_0x24cc43,_0x3af4b6){var _0x43ada5={},_0x9d33c6={},_0x10b15a={'count':0x0,'rows':[]};var _0x4e40a9=_['map'](db[_0x4376('0x2f')][_0x4376('0x30')],function(_0x13a583){return{'name':_0x13a583['fieldName'],'type':_0x13a583['type'][_0x4376('0x31')]};});_0x9d33c6['model']=_['map'](_0x4e40a9,_0x4376('0x2e'));_0x9d33c6['query']=_['keys'](_0x24cc43[_0x4376('0x32')]);_0x9d33c6[_0x4376('0x33')]=_[_0x4376('0x34')](_0x9d33c6[_0x4376('0x35')],_0x9d33c6[_0x4376('0x32')]);_0x43ada5['attributes']=_[_0x4376('0x34')](_0x9d33c6[_0x4376('0x35')],qs[_0x4376('0x36')](_0x24cc43[_0x4376('0x32')][_0x4376('0x36')]));_0x43ada5[_0x4376('0x37')]=_0x43ada5['attributes'][_0x4376('0x38')]?_0x43ada5[_0x4376('0x37')]:_0x9d33c6['model'];if(!_0x24cc43['query'][_0x4376('0x39')]('nolimit')){_0x43ada5[_0x4376('0x20')]=qs['limit'](_0x24cc43[_0x4376('0x32')][_0x4376('0x20')]);_0x43ada5[_0x4376('0x1f')]=qs[_0x4376('0x1f')](_0x24cc43[_0x4376('0x32')]['offset']);}_0x43ada5['order']=qs[_0x4376('0x3a')](_0x24cc43[_0x4376('0x32')][_0x4376('0x3a')]);_0x43ada5[_0x4376('0x3b')]=qs['filters'](_['pick'](_0x24cc43['query'],_0x9d33c6[_0x4376('0x33')]),_0x4e40a9);if(_0x24cc43[_0x4376('0x32')][_0x4376('0x3c')]){_0x43ada5[_0x4376('0x3b')]=_[_0x4376('0x3d')](_0x43ada5['where'],{'$or':_[_0x4376('0x3e')](_0x4e40a9,function(_0x1e111b){if(_0x1e111b[_0x4376('0x3f')]!==_0x4376('0x40')){var _0x56ca09={};_0x56ca09[_0x1e111b[_0x4376('0x2e')]]={'$like':'%'+_0x24cc43[_0x4376('0x32')]['filter']+'%'};return _0x56ca09;}})});}_0x43ada5=_[_0x4376('0x3d')]({},_0x43ada5,_0x24cc43['options']);var _0xc7df19={'where':_0x43ada5[_0x4376('0x3b')]};return db[_0x4376('0x2f')]['count'](_0xc7df19)[_0x4376('0x28')](function(_0x5c815c){_0x10b15a[_0x4376('0x22')]=_0x5c815c;if(_0x24cc43[_0x4376('0x32')][_0x4376('0x41')]){_0x43ada5[_0x4376('0x42')]=[{'all':!![]}];}return db[_0x4376('0x2f')][_0x4376('0x43')](_0x43ada5);})[_0x4376('0x28')](function(_0x4a8ecf){_0x10b15a[_0x4376('0x44')]=_0x4a8ecf;return _0x10b15a;})[_0x4376('0x28')](respondWithFilteredResult(_0x3af4b6,_0x43ada5))[_0x4376('0x45')](handleError(_0x3af4b6,null));};exports[_0x4376('0x46')]=function(_0x55dc9d,_0x2543d2){var _0x380beb={'raw':![],'where':{'id':_0x55dc9d['params']['id']}},_0x4ac2f8={};_0x4ac2f8[_0x4376('0x35')]=_[_0x4376('0x47')](db[_0x4376('0x2f')][_0x4376('0x30')]);_0x4ac2f8[_0x4376('0x32')]=_[_0x4376('0x47')](_0x55dc9d['query']);_0x4ac2f8['filters']=_[_0x4376('0x34')](_0x4ac2f8['model'],_0x4ac2f8[_0x4376('0x32')]);_0x380beb[_0x4376('0x37')]=_[_0x4376('0x34')](_0x4ac2f8[_0x4376('0x35')],qs[_0x4376('0x36')](_0x55dc9d['query']['fields']));_0x380beb[_0x4376('0x37')]=_0x380beb['attributes']['length']?_0x380beb[_0x4376('0x37')]:_0x4ac2f8[_0x4376('0x35')];if(_0x55dc9d[_0x4376('0x32')]['includeAll']){_0x380beb[_0x4376('0x42')]=[{'all':!![]}];}_0x380beb=_[_0x4376('0x3d')]({},_0x380beb,_0x55dc9d[_0x4376('0x48')]);return db['Trigger']['find'](_0x380beb)['then'](handleEntityNotFound(_0x2543d2,null))[_0x4376('0x28')](respondWithResult(_0x2543d2,null))[_0x4376('0x45')](handleError(_0x2543d2,null));};exports[_0x4376('0x49')]=function(_0x13322e,_0x1ec637){return db[_0x4376('0x2f')][_0x4376('0x49')](_0x13322e[_0x4376('0x4a')],{})['then'](function(_0x18d4bc){var _0x501ff2=_0x13322e[_0x4376('0x4b')][_0x4376('0x4c')]({'plain':!![]});if(!_0x501ff2)throw new Error(_0x4376('0x4d'));if(_0x501ff2[_0x4376('0x4e')]==='user'){var _0x260a99=_0x18d4bc[_0x4376('0x4c')]({'plain':!![]});var _0x3905a8=_0x4376('0x2a');return db['UserProfileSection'][_0x4376('0x4f')]({'where':{'name':_0x3905a8,'userProfileId':_0x501ff2['userProfileId']},'raw':!![]})[_0x4376('0x28')](function(_0x4d3231){if(_0x4d3231&&_0x4d3231[_0x4376('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x260a99[_0x4376('0x2e')],'resourceId':_0x260a99['id'],'type':_0x4d3231[_0x4376('0x2e')],'sectionId':_0x4d3231['id']},{})[_0x4376('0x28')](function(){return _0x18d4bc;});}else{return _0x18d4bc;}})[_0x4376('0x45')](function(_0x2c1f9e){logger['error'](_0x4376('0x51'),_0x2c1f9e);throw _0x2c1f9e;});}return _0x18d4bc;})['then'](respondWithResult(_0x1ec637,0xc9))[_0x4376('0x45')](handleError(_0x1ec637,null));};exports[_0x4376('0x52')]=function(_0x48bb72,_0x3dbf2b){if(_0x48bb72[_0x4376('0x4a')]['id']){delete _0x48bb72[_0x4376('0x4a')]['id'];}return db[_0x4376('0x2f')][_0x4376('0x4f')]({'where':{'id':_0x48bb72[_0x4376('0x53')]['id']}})[_0x4376('0x28')](handleEntityNotFound(_0x3dbf2b,null))['then'](saveUpdates(_0x48bb72[_0x4376('0x4a')],null))['then'](respondWithResult(_0x3dbf2b,null))['catch'](handleError(_0x3dbf2b,null));};exports[_0x4376('0x29')]=function(_0x4e7e5c,_0x630a20){return db[_0x4376('0x2f')][_0x4376('0x4f')]({'where':{'id':_0x4e7e5c[_0x4376('0x53')]['id']}})['then'](handleEntityNotFound(_0x630a20,null))[_0x4376('0x28')](removeEntity(_0x630a20,null))[_0x4376('0x45')](handleError(_0x630a20,null));};exports['addAllCondition']=function(_0x1b7e56,_0x296447,_0x533434){if(_0x1b7e56[_0x4376('0x4a')]['id']){delete _0x1b7e56[_0x4376('0x4a')]['id'];}return db[_0x4376('0x2f')]['find']({'where':{'id':_0x1b7e56[_0x4376('0x53')]['id']}})[_0x4376('0x28')](handleEntityNotFound(_0x296447,null))[_0x4376('0x28')](function(_0x164997){if(_0x164997){_0x1b7e56[_0x4376('0x4a')][_0x4376('0x54')]=_0x164997['id'];return db[_0x4376('0x55')][_0x4376('0x49')](_0x1b7e56['body']);}})[_0x4376('0x28')](respondWithResult(_0x296447,null))['catch'](handleError(_0x296447,null));};exports['addAnyCondition']=function(_0x3eeafa,_0x5eb855,_0x599799){if(_0x3eeafa[_0x4376('0x4a')]['id']){delete _0x3eeafa[_0x4376('0x4a')]['id'];}return db[_0x4376('0x2f')][_0x4376('0x4f')]({'where':{'id':_0x3eeafa[_0x4376('0x53')]['id']}})['then'](handleEntityNotFound(_0x5eb855,null))[_0x4376('0x28')](function(_0x482d8c){if(_0x482d8c){_0x3eeafa['body'][_0x4376('0x56')]=_0x482d8c['id'];return db[_0x4376('0x55')][_0x4376('0x49')](_0x3eeafa[_0x4376('0x4a')]);}})['then'](respondWithResult(_0x5eb855,null))[_0x4376('0x45')](handleError(_0x5eb855,null));};exports['getAllConditions']=function(_0x4c4f84,_0x23b9cf,_0x4ec6e8){var _0x138a89={};var _0x1343c9={};var _0x14842d;var _0x35d8a7;return db[_0x4376('0x2f')][_0x4376('0x57')]({'where':{'id':_0x4c4f84[_0x4376('0x53')]['id']}})[_0x4376('0x28')](handleEntityNotFound(_0x23b9cf,null))[_0x4376('0x28')](function(_0x21afbf){if(_0x21afbf){_0x14842d=_0x21afbf;_0x1343c9[_0x4376('0x35')]=_['keys'](db['Condition'][_0x4376('0x30')]);_0x1343c9[_0x4376('0x32')]=_[_0x4376('0x47')](_0x4c4f84['query']);_0x1343c9['filters']=_[_0x4376('0x34')](_0x1343c9[_0x4376('0x35')],_0x1343c9[_0x4376('0x32')]);_0x138a89[_0x4376('0x37')]=_['intersection'](_0x1343c9['model'],qs[_0x4376('0x36')](_0x4c4f84[_0x4376('0x32')]['fields']));_0x138a89[_0x4376('0x37')]=_0x138a89['attributes'][_0x4376('0x38')]?_0x138a89[_0x4376('0x37')]:_0x1343c9[_0x4376('0x35')];_0x138a89[_0x4376('0x58')]=qs[_0x4376('0x3a')](_0x4c4f84[_0x4376('0x32')][_0x4376('0x3a')]);_0x138a89[_0x4376('0x3b')]=qs[_0x4376('0x33')](_[_0x4376('0x59')](_0x4c4f84[_0x4376('0x32')],_0x1343c9[_0x4376('0x33')]));if(_0x4c4f84[_0x4376('0x32')]['filter']){_0x138a89[_0x4376('0x3b')]=_[_0x4376('0x3d')](_0x138a89[_0x4376('0x3b')],{'$or':_[_0x4376('0x3e')](_0x138a89[_0x4376('0x37')],function(_0x1c85ea){var _0x393853={};_0x393853[_0x1c85ea]={'$like':'%'+_0x4c4f84[_0x4376('0x32')]['filter']+'%'};return _0x393853;})});}_0x138a89=_[_0x4376('0x3d')]({},_0x138a89,_0x4c4f84[_0x4376('0x48')]);return _0x14842d[_0x4376('0x5a')](_0x138a89);}})[_0x4376('0x28')](function(_0x2c6d7e){if(_0x2c6d7e){_0x35d8a7=_0x2c6d7e[_0x4376('0x38')];if(!_0x4c4f84[_0x4376('0x32')][_0x4376('0x39')](_0x4376('0x5b'))){_0x138a89[_0x4376('0x20')]=qs['limit'](_0x4c4f84['query']['limit']);_0x138a89[_0x4376('0x1f')]=qs['offset'](_0x4c4f84[_0x4376('0x32')]['offset']);}return _0x14842d[_0x4376('0x5a')](_0x138a89);}})[_0x4376('0x28')](function(_0x30cd67){if(_0x30cd67){return _0x30cd67?{'count':_0x35d8a7,'rows':_0x30cd67}:null;}})[_0x4376('0x28')](respondWithResult(_0x23b9cf,null))[_0x4376('0x45')](handleError(_0x23b9cf,null));};exports[_0x4376('0x5c')]=function(_0x52038a,_0x52847b,_0x2703ce){var _0xfc36e={};var _0x258fa9={};var _0x2a5ffc;var _0x575435;return db['Trigger'][_0x4376('0x57')]({'where':{'id':_0x52038a[_0x4376('0x53')]['id']}})['then'](handleEntityNotFound(_0x52847b,null))[_0x4376('0x28')](function(_0x113cc8){if(_0x113cc8){_0x2a5ffc=_0x113cc8;_0x258fa9[_0x4376('0x35')]=_['keys'](db['Condition']['rawAttributes']);_0x258fa9[_0x4376('0x32')]=_[_0x4376('0x47')](_0x52038a[_0x4376('0x32')]);_0x258fa9[_0x4376('0x33')]=_[_0x4376('0x34')](_0x258fa9['model'],_0x258fa9[_0x4376('0x32')]);_0xfc36e[_0x4376('0x37')]=_[_0x4376('0x34')](_0x258fa9['model'],qs['fields'](_0x52038a[_0x4376('0x32')][_0x4376('0x36')]));_0xfc36e[_0x4376('0x37')]=_0xfc36e['attributes'][_0x4376('0x38')]?_0xfc36e['attributes']:_0x258fa9['model'];_0xfc36e[_0x4376('0x58')]=qs[_0x4376('0x3a')](_0x52038a[_0x4376('0x32')][_0x4376('0x3a')]);_0xfc36e[_0x4376('0x3b')]=qs[_0x4376('0x33')](_['pick'](_0x52038a['query'],_0x258fa9[_0x4376('0x33')]));if(_0x52038a[_0x4376('0x32')][_0x4376('0x3c')]){_0xfc36e['where']=_[_0x4376('0x3d')](_0xfc36e[_0x4376('0x3b')],{'$or':_[_0x4376('0x3e')](_0xfc36e[_0x4376('0x37')],function(_0x144d6f){var _0x22afdd={};_0x22afdd[_0x144d6f]={'$like':'%'+_0x52038a[_0x4376('0x32')][_0x4376('0x3c')]+'%'};return _0x22afdd;})});}_0xfc36e=_[_0x4376('0x3d')]({},_0xfc36e,_0x52038a[_0x4376('0x48')]);return _0x2a5ffc[_0x4376('0x5c')](_0xfc36e);}})['then'](function(_0xb71ed0){if(_0xb71ed0){_0x575435=_0xb71ed0['length'];if(!_0x52038a[_0x4376('0x32')][_0x4376('0x39')](_0x4376('0x5b'))){_0xfc36e[_0x4376('0x20')]=qs[_0x4376('0x20')](_0x52038a[_0x4376('0x32')][_0x4376('0x20')]);_0xfc36e[_0x4376('0x1f')]=qs[_0x4376('0x1f')](_0x52038a[_0x4376('0x32')]['offset']);}return _0x2a5ffc['getAnyConditions'](_0xfc36e);}})[_0x4376('0x28')](function(_0x4e0564){if(_0x4e0564){return _0x4e0564?{'count':_0x575435,'rows':_0x4e0564}:null;}})[_0x4376('0x28')](respondWithResult(_0x52847b,null))[_0x4376('0x45')](handleError(_0x52847b,null));};exports[_0x4376('0x5d')]=function(_0x4f7793,_0x19bf32,_0x885af0){if(_0x4f7793[_0x4376('0x4a')]['id']){delete _0x4f7793['body']['id'];}return db[_0x4376('0x2f')][_0x4376('0x4f')]({'where':{'id':_0x4f7793[_0x4376('0x53')]['id']}})['then'](handleEntityNotFound(_0x19bf32,null))[_0x4376('0x28')](function(_0x2aa272){if(_0x2aa272){_0x4f7793[_0x4376('0x4a')][_0x4376('0x5e')]=_0x2aa272['id'];return db[_0x4376('0x5f')]['create'](_0x4f7793[_0x4376('0x4a')]);}})['then'](respondWithResult(_0x19bf32,null))['catch'](handleError(_0x19bf32,null));};exports[_0x4376('0x60')]=function(_0x1e2d6e,_0x2798d1,_0x2382af){var _0x390d41={};var _0x4c33d5={};var _0x373e43;var _0x376fac;return db[_0x4376('0x2f')][_0x4376('0x57')]({'where':{'id':_0x1e2d6e[_0x4376('0x53')]['id']}})[_0x4376('0x28')](handleEntityNotFound(_0x2798d1,null))['then'](function(_0x4ca91e){if(_0x4ca91e){_0x373e43=_0x4ca91e;_0x4c33d5[_0x4376('0x35')]=_[_0x4376('0x47')](db[_0x4376('0x5f')][_0x4376('0x30')]);_0x4c33d5[_0x4376('0x32')]=_[_0x4376('0x47')](_0x1e2d6e[_0x4376('0x32')]);_0x4c33d5[_0x4376('0x33')]=_[_0x4376('0x34')](_0x4c33d5['model'],_0x4c33d5[_0x4376('0x32')]);_0x390d41[_0x4376('0x37')]=_[_0x4376('0x34')](_0x4c33d5['model'],qs[_0x4376('0x36')](_0x1e2d6e[_0x4376('0x32')]['fields']));_0x390d41[_0x4376('0x37')]=_0x390d41[_0x4376('0x37')][_0x4376('0x38')]?_0x390d41['attributes']:_0x4c33d5['model'];_0x390d41[_0x4376('0x58')]=qs[_0x4376('0x3a')](_0x1e2d6e[_0x4376('0x32')][_0x4376('0x3a')]);_0x390d41[_0x4376('0x3b')]=qs[_0x4376('0x33')](_[_0x4376('0x59')](_0x1e2d6e[_0x4376('0x32')],_0x4c33d5['filters']));if(_0x1e2d6e[_0x4376('0x32')][_0x4376('0x3c')]){_0x390d41[_0x4376('0x3b')]=_[_0x4376('0x3d')](_0x390d41[_0x4376('0x3b')],{'$or':_[_0x4376('0x3e')](_0x390d41[_0x4376('0x37')],function(_0x6991b2){var _0x1b9c75={};_0x1b9c75[_0x6991b2]={'$like':'%'+_0x1e2d6e[_0x4376('0x32')][_0x4376('0x3c')]+'%'};return _0x1b9c75;})});}_0x390d41=_['merge']({},_0x390d41,_0x1e2d6e[_0x4376('0x48')]);return _0x373e43['getActions'](_0x390d41);}})[_0x4376('0x28')](function(_0x458567){if(_0x458567){_0x376fac=_0x458567[_0x4376('0x38')];if(!_0x1e2d6e[_0x4376('0x32')][_0x4376('0x39')](_0x4376('0x5b'))){_0x390d41[_0x4376('0x20')]=qs[_0x4376('0x20')](_0x1e2d6e['query'][_0x4376('0x20')]);_0x390d41[_0x4376('0x1f')]=qs[_0x4376('0x1f')](_0x1e2d6e[_0x4376('0x32')][_0x4376('0x1f')]);}return _0x373e43[_0x4376('0x60')](_0x390d41);}})[_0x4376('0x28')](function(_0x59d8cf){if(_0x59d8cf){return _0x59d8cf?{'count':_0x376fac,'rows':_0x59d8cf}:null;}})['then'](respondWithResult(_0x2798d1,null))[_0x4376('0x45')](handleError(_0x2798d1,null));}; \ No newline at end of file +var _0x9f2c=['role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Condition','addAnyCondition','getAllConditions','findOne','pick','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','request-promise','moment','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../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','reject','update','destroy','get','Triggers','UserProfileResource','then','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user'];(function(_0x29d172,_0x130406){var _0xf0fbea=function(_0x4bdba5){while(--_0x4bdba5){_0x29d172['push'](_0x29d172['shift']());}};_0xf0fbea(++_0x130406);}(_0x9f2c,0x66));var _0xc9f2=function(_0x549928,_0x363b7a){_0x549928=_0x549928-0x0;var _0x941e27=_0x9f2c[_0x549928];return _0x941e27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9f2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc9f2('0x1'));var moment=require(_0xc9f2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc9f2('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc9f2('0x4'));var csv=require(_0xc9f2('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9f2('0x6'));var _=require(_0xc9f2('0x7'));var squel=require('squel');var crypto=require(_0xc9f2('0x8'));var jsforce=require(_0xc9f2('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xc9f2('0x5'));var querystring=require('querystring');var Papa=require(_0xc9f2('0xa'));var Redis=require(_0xc9f2('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xc9f2('0xc'));var as=require(_0xc9f2('0xd'));var hardwareService=require(_0xc9f2('0xe'));var logger=require(_0xc9f2('0xf'))(_0xc9f2('0x10'));var utils=require('../../config/utils');var config=require(_0xc9f2('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xc9f2('0x12'))['db'];function respondWithStatusCode(_0x57f7fc,_0x4a0484){_0x4a0484=_0x4a0484||0xcc;return function(_0x56deee){if(_0x56deee){return _0x57f7fc[_0xc9f2('0x13')](_0x4a0484);}return _0x57f7fc[_0xc9f2('0x14')](_0x4a0484)[_0xc9f2('0x15')]();};}function respondWithResult(_0x578bce,_0x4dd391){_0x4dd391=_0x4dd391||0xc8;return function(_0xb56feb){if(_0xb56feb){return _0x578bce['status'](_0x4dd391)['json'](_0xb56feb);}};}function respondWithFilteredResult(_0xd02e80,_0x201efe){return function(_0x9f4502){if(_0x9f4502){var _0x252d5f=typeof _0x201efe[_0xc9f2('0x16')]===_0xc9f2('0x17')&&typeof _0x201efe[_0xc9f2('0x18')]===_0xc9f2('0x17');var _0x10c6a7=_0x9f4502[_0xc9f2('0x19')];var _0x54fb87=_0x252d5f?0x0:_0x201efe['offset'];var _0x4983aa=_0x252d5f?_0x9f4502['count']:_0x201efe[_0xc9f2('0x16')]+_0x201efe[_0xc9f2('0x18')];var _0x529f69;if(_0x4983aa>=_0x10c6a7){_0x4983aa=_0x10c6a7;_0x529f69=0xc8;}else{_0x529f69=0xce;}_0xd02e80[_0xc9f2('0x14')](_0x529f69);return _0xd02e80[_0xc9f2('0x1a')](_0xc9f2('0x1b'),_0x54fb87+'-'+_0x4983aa+'/'+_0x10c6a7)[_0xc9f2('0x1c')](_0x9f4502);}return null;};}function patchUpdates(_0x29dd24){return function(_0x15ed6d){try{jsonpatch[_0xc9f2('0x1d')](_0x15ed6d,_0x29dd24,!![]);}catch(_0x530b0e){return BPromise[_0xc9f2('0x1e')](_0x530b0e);}return _0x15ed6d['save']();};}function saveUpdates(_0x4c6554,_0x5a850b){return function(_0x1dc23f){if(_0x1dc23f){return _0x1dc23f[_0xc9f2('0x1f')](_0x4c6554)['then'](function(_0xcaec78){return _0xcaec78;});}return null;};}function removeEntity(_0x280f8d,_0xfb0bc1){return function(_0x11f2a4){if(_0x11f2a4){return _0x11f2a4[_0xc9f2('0x20')]()['then'](function(){var _0x48a076=_0x11f2a4[_0xc9f2('0x21')]({'plain':!![]});var _0x449231=_0xc9f2('0x22');return db[_0xc9f2('0x23')][_0xc9f2('0x20')]({'where':{'type':_0x449231,'resourceId':_0x48a076['id']}})[_0xc9f2('0x24')](function(){return _0x11f2a4;});})[_0xc9f2('0x24')](function(){_0x280f8d[_0xc9f2('0x14')](0xcc)[_0xc9f2('0x15')]();});}};}function handleEntityNotFound(_0xa01330,_0x590444){return function(_0x254125){if(!_0x254125){_0xa01330[_0xc9f2('0x13')](0x194);}return _0x254125;};}function handleError(_0x387a3f,_0xb7225a){_0xb7225a=_0xb7225a||0x1f4;return function(_0x5d04e5){logger[_0xc9f2('0x25')](_0x5d04e5[_0xc9f2('0x26')]);if(_0x5d04e5[_0xc9f2('0x27')]){delete _0x5d04e5[_0xc9f2('0x27')];}_0x387a3f[_0xc9f2('0x14')](_0xb7225a)[_0xc9f2('0x28')](_0x5d04e5);};}exports[_0xc9f2('0x29')]=function(_0x143a8a,_0xdb3e08){var _0x56f242={},_0x586be7={},_0x4b42b0={'count':0x0,'rows':[]};var _0x49d79b=_[_0xc9f2('0x2a')](db[_0xc9f2('0x2b')][_0xc9f2('0x2c')],function(_0x537326){return{'name':_0x537326[_0xc9f2('0x2d')],'type':_0x537326[_0xc9f2('0x2e')][_0xc9f2('0x2f')]};});_0x586be7['model']=_[_0xc9f2('0x2a')](_0x49d79b,'name');_0x586be7[_0xc9f2('0x30')]=_[_0xc9f2('0x31')](_0x143a8a[_0xc9f2('0x30')]);_0x586be7['filters']=_['intersection'](_0x586be7[_0xc9f2('0x32')],_0x586be7[_0xc9f2('0x30')]);_0x56f242[_0xc9f2('0x33')]=_[_0xc9f2('0x34')](_0x586be7[_0xc9f2('0x32')],qs[_0xc9f2('0x35')](_0x143a8a[_0xc9f2('0x30')][_0xc9f2('0x35')]));_0x56f242[_0xc9f2('0x33')]=_0x56f242[_0xc9f2('0x33')][_0xc9f2('0x36')]?_0x56f242[_0xc9f2('0x33')]:_0x586be7[_0xc9f2('0x32')];if(!_0x143a8a[_0xc9f2('0x30')][_0xc9f2('0x37')](_0xc9f2('0x38'))){_0x56f242[_0xc9f2('0x18')]=qs[_0xc9f2('0x18')](_0x143a8a['query']['limit']);_0x56f242['offset']=qs[_0xc9f2('0x16')](_0x143a8a[_0xc9f2('0x30')][_0xc9f2('0x16')]);}_0x56f242[_0xc9f2('0x39')]=qs[_0xc9f2('0x3a')](_0x143a8a[_0xc9f2('0x30')][_0xc9f2('0x3a')]);_0x56f242[_0xc9f2('0x3b')]=qs[_0xc9f2('0x3c')](_['pick'](_0x143a8a['query'],_0x586be7[_0xc9f2('0x3c')]),_0x49d79b);if(_0x143a8a[_0xc9f2('0x30')][_0xc9f2('0x3d')]){_0x56f242['where']=_['merge'](_0x56f242['where'],{'$or':_[_0xc9f2('0x2a')](_0x49d79b,function(_0x55f5da){if(_0x55f5da[_0xc9f2('0x2e')]!==_0xc9f2('0x3e')){var _0xf671c5={};_0xf671c5[_0x55f5da['name']]={'$like':'%'+_0x143a8a['query']['filter']+'%'};return _0xf671c5;}})});}_0x56f242=_[_0xc9f2('0x3f')]({},_0x56f242,_0x143a8a[_0xc9f2('0x40')]);var _0x1be9e0={'where':_0x56f242[_0xc9f2('0x3b')]};return db[_0xc9f2('0x2b')]['count'](_0x1be9e0)['then'](function(_0x45cd11){_0x4b42b0[_0xc9f2('0x19')]=_0x45cd11;if(_0x143a8a[_0xc9f2('0x30')]['includeAll']){_0x56f242[_0xc9f2('0x41')]=[{'all':!![]}];}return db['Trigger'][_0xc9f2('0x42')](_0x56f242);})[_0xc9f2('0x24')](function(_0xf6354a){_0x4b42b0[_0xc9f2('0x43')]=_0xf6354a;return _0x4b42b0;})['then'](respondWithFilteredResult(_0xdb3e08,_0x56f242))[_0xc9f2('0x44')](handleError(_0xdb3e08,null));};exports[_0xc9f2('0x45')]=function(_0x39df27,_0x3d8b94){var _0x28cd1e={'raw':![],'where':{'id':_0x39df27[_0xc9f2('0x46')]['id']}},_0x431bc8={};_0x431bc8['model']=_[_0xc9f2('0x31')](db['Trigger']['rawAttributes']);_0x431bc8[_0xc9f2('0x30')]=_[_0xc9f2('0x31')](_0x39df27[_0xc9f2('0x30')]);_0x431bc8[_0xc9f2('0x3c')]=_[_0xc9f2('0x34')](_0x431bc8[_0xc9f2('0x32')],_0x431bc8[_0xc9f2('0x30')]);_0x28cd1e['attributes']=_[_0xc9f2('0x34')](_0x431bc8['model'],qs[_0xc9f2('0x35')](_0x39df27['query'][_0xc9f2('0x35')]));_0x28cd1e[_0xc9f2('0x33')]=_0x28cd1e['attributes'][_0xc9f2('0x36')]?_0x28cd1e[_0xc9f2('0x33')]:_0x431bc8[_0xc9f2('0x32')];if(_0x39df27[_0xc9f2('0x30')][_0xc9f2('0x47')]){_0x28cd1e[_0xc9f2('0x41')]=[{'all':!![]}];}_0x28cd1e=_[_0xc9f2('0x3f')]({},_0x28cd1e,_0x39df27['options']);return db[_0xc9f2('0x2b')][_0xc9f2('0x48')](_0x28cd1e)['then'](handleEntityNotFound(_0x3d8b94,null))[_0xc9f2('0x24')](respondWithResult(_0x3d8b94,null))[_0xc9f2('0x44')](handleError(_0x3d8b94,null));};exports[_0xc9f2('0x49')]=function(_0x209cf9,_0x4365ce){return db['Trigger'][_0xc9f2('0x49')](_0x209cf9[_0xc9f2('0x4a')],{})[_0xc9f2('0x24')](function(_0x1e08bd){var _0x4d2880=_0x209cf9[_0xc9f2('0x4b')][_0xc9f2('0x21')]({'plain':!![]});if(!_0x4d2880)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d2880[_0xc9f2('0x4c')]==='user'){var _0x5699d4=_0x1e08bd[_0xc9f2('0x21')]({'plain':!![]});var _0x57a380=_0xc9f2('0x22');return db[_0xc9f2('0x4d')]['find']({'where':{'name':_0x57a380,'userProfileId':_0x4d2880['userProfileId']},'raw':!![]})[_0xc9f2('0x24')](function(_0x17b6a3){if(_0x17b6a3&&_0x17b6a3['autoAssociation']===0x0){return db[_0xc9f2('0x23')][_0xc9f2('0x49')]({'name':_0x5699d4[_0xc9f2('0x27')],'resourceId':_0x5699d4['id'],'type':_0x17b6a3[_0xc9f2('0x27')],'sectionId':_0x17b6a3['id']},{})['then'](function(){return _0x1e08bd;});}else{return _0x1e08bd;}})[_0xc9f2('0x44')](function(_0x38e770){logger[_0xc9f2('0x25')](_0xc9f2('0x4e'),_0x38e770);throw _0x38e770;});}return _0x1e08bd;})['then'](respondWithResult(_0x4365ce,0xc9))[_0xc9f2('0x44')](handleError(_0x4365ce,null));};exports[_0xc9f2('0x1f')]=function(_0xe0d2c0,_0x2ff8e9){if(_0xe0d2c0[_0xc9f2('0x4a')]['id']){delete _0xe0d2c0[_0xc9f2('0x4a')]['id'];}return db[_0xc9f2('0x2b')][_0xc9f2('0x48')]({'where':{'id':_0xe0d2c0['params']['id']}})['then'](handleEntityNotFound(_0x2ff8e9,null))[_0xc9f2('0x24')](saveUpdates(_0xe0d2c0[_0xc9f2('0x4a')],null))['then'](respondWithResult(_0x2ff8e9,null))[_0xc9f2('0x44')](handleError(_0x2ff8e9,null));};exports[_0xc9f2('0x20')]=function(_0x4c5dbd,_0x536a2f){return db[_0xc9f2('0x2b')][_0xc9f2('0x48')]({'where':{'id':_0x4c5dbd[_0xc9f2('0x46')]['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x536a2f,null))[_0xc9f2('0x24')](removeEntity(_0x536a2f,null))[_0xc9f2('0x44')](handleError(_0x536a2f,null));};exports['addAllCondition']=function(_0x28aaf1,_0x86565b,_0x36bd1a){if(_0x28aaf1[_0xc9f2('0x4a')]['id']){delete _0x28aaf1[_0xc9f2('0x4a')]['id'];}return db[_0xc9f2('0x2b')][_0xc9f2('0x48')]({'where':{'id':_0x28aaf1[_0xc9f2('0x46')]['id']}})['then'](handleEntityNotFound(_0x86565b,null))['then'](function(_0x476989){if(_0x476989){_0x28aaf1[_0xc9f2('0x4a')]['TriggerAllId']=_0x476989['id'];return db[_0xc9f2('0x4f')][_0xc9f2('0x49')](_0x28aaf1[_0xc9f2('0x4a')]);}})[_0xc9f2('0x24')](respondWithResult(_0x86565b,null))['catch'](handleError(_0x86565b,null));};exports[_0xc9f2('0x50')]=function(_0x45ac48,_0x4083e6,_0x4ee0f2){if(_0x45ac48[_0xc9f2('0x4a')]['id']){delete _0x45ac48[_0xc9f2('0x4a')]['id'];}return db['Trigger']['find']({'where':{'id':_0x45ac48['params']['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x4083e6,null))[_0xc9f2('0x24')](function(_0x24f778){if(_0x24f778){_0x45ac48[_0xc9f2('0x4a')]['TriggerAnyId']=_0x24f778['id'];return db['Condition'][_0xc9f2('0x49')](_0x45ac48[_0xc9f2('0x4a')]);}})[_0xc9f2('0x24')](respondWithResult(_0x4083e6,null))[_0xc9f2('0x44')](handleError(_0x4083e6,null));};exports[_0xc9f2('0x51')]=function(_0xf0e950,_0x1b8c4f,_0x2cbb){var _0x5a471a={};var _0x17e5e8={};var _0x427c64;var _0x45e9cd;return db[_0xc9f2('0x2b')][_0xc9f2('0x52')]({'where':{'id':_0xf0e950[_0xc9f2('0x46')]['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x1b8c4f,null))[_0xc9f2('0x24')](function(_0x5d6913){if(_0x5d6913){_0x427c64=_0x5d6913;_0x17e5e8['model']=_['keys'](db[_0xc9f2('0x4f')]['rawAttributes']);_0x17e5e8[_0xc9f2('0x30')]=_['keys'](_0xf0e950[_0xc9f2('0x30')]);_0x17e5e8[_0xc9f2('0x3c')]=_[_0xc9f2('0x34')](_0x17e5e8[_0xc9f2('0x32')],_0x17e5e8['query']);_0x5a471a[_0xc9f2('0x33')]=_['intersection'](_0x17e5e8['model'],qs[_0xc9f2('0x35')](_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x35')]));_0x5a471a[_0xc9f2('0x33')]=_0x5a471a[_0xc9f2('0x33')][_0xc9f2('0x36')]?_0x5a471a[_0xc9f2('0x33')]:_0x17e5e8[_0xc9f2('0x32')];_0x5a471a[_0xc9f2('0x39')]=qs[_0xc9f2('0x3a')](_0xf0e950[_0xc9f2('0x30')]['sort']);_0x5a471a[_0xc9f2('0x3b')]=qs[_0xc9f2('0x3c')](_[_0xc9f2('0x53')](_0xf0e950[_0xc9f2('0x30')],_0x17e5e8['filters']));if(_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x3d')]){_0x5a471a['where']=_['merge'](_0x5a471a['where'],{'$or':_[_0xc9f2('0x2a')](_0x5a471a[_0xc9f2('0x33')],function(_0x4a7ce6){var _0x4952f5={};_0x4952f5[_0x4a7ce6]={'$like':'%'+_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x3d')]+'%'};return _0x4952f5;})});}_0x5a471a=_[_0xc9f2('0x3f')]({},_0x5a471a,_0xf0e950[_0xc9f2('0x40')]);return _0x427c64[_0xc9f2('0x51')](_0x5a471a);}})[_0xc9f2('0x24')](function(_0x5f9a5d){if(_0x5f9a5d){_0x45e9cd=_0x5f9a5d[_0xc9f2('0x36')];if(!_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x37')](_0xc9f2('0x38'))){_0x5a471a[_0xc9f2('0x18')]=qs[_0xc9f2('0x18')](_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x18')]);_0x5a471a[_0xc9f2('0x16')]=qs[_0xc9f2('0x16')](_0xf0e950[_0xc9f2('0x30')][_0xc9f2('0x16')]);}return _0x427c64[_0xc9f2('0x51')](_0x5a471a);}})[_0xc9f2('0x24')](function(_0x234b32){if(_0x234b32){return _0x234b32?{'count':_0x45e9cd,'rows':_0x234b32}:null;}})[_0xc9f2('0x24')](respondWithResult(_0x1b8c4f,null))[_0xc9f2('0x44')](handleError(_0x1b8c4f,null));};exports[_0xc9f2('0x54')]=function(_0x4e8dd7,_0x58b401,_0x3f664b){var _0x1742d0={};var _0x1c6ed4={};var _0x28735f;var _0x4982a5;return db[_0xc9f2('0x2b')]['findOne']({'where':{'id':_0x4e8dd7['params']['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x58b401,null))[_0xc9f2('0x24')](function(_0x10b7ac){if(_0x10b7ac){_0x28735f=_0x10b7ac;_0x1c6ed4[_0xc9f2('0x32')]=_[_0xc9f2('0x31')](db[_0xc9f2('0x4f')][_0xc9f2('0x2c')]);_0x1c6ed4[_0xc9f2('0x30')]=_['keys'](_0x4e8dd7[_0xc9f2('0x30')]);_0x1c6ed4[_0xc9f2('0x3c')]=_[_0xc9f2('0x34')](_0x1c6ed4[_0xc9f2('0x32')],_0x1c6ed4[_0xc9f2('0x30')]);_0x1742d0[_0xc9f2('0x33')]=_[_0xc9f2('0x34')](_0x1c6ed4[_0xc9f2('0x32')],qs[_0xc9f2('0x35')](_0x4e8dd7[_0xc9f2('0x30')][_0xc9f2('0x35')]));_0x1742d0[_0xc9f2('0x33')]=_0x1742d0[_0xc9f2('0x33')]['length']?_0x1742d0['attributes']:_0x1c6ed4['model'];_0x1742d0['order']=qs['sort'](_0x4e8dd7[_0xc9f2('0x30')][_0xc9f2('0x3a')]);_0x1742d0['where']=qs[_0xc9f2('0x3c')](_[_0xc9f2('0x53')](_0x4e8dd7['query'],_0x1c6ed4[_0xc9f2('0x3c')]));if(_0x4e8dd7['query']['filter']){_0x1742d0[_0xc9f2('0x3b')]=_[_0xc9f2('0x3f')](_0x1742d0[_0xc9f2('0x3b')],{'$or':_['map'](_0x1742d0['attributes'],function(_0x51d0bf){var _0x83a1f0={};_0x83a1f0[_0x51d0bf]={'$like':'%'+_0x4e8dd7[_0xc9f2('0x30')][_0xc9f2('0x3d')]+'%'};return _0x83a1f0;})});}_0x1742d0=_[_0xc9f2('0x3f')]({},_0x1742d0,_0x4e8dd7[_0xc9f2('0x40')]);return _0x28735f[_0xc9f2('0x54')](_0x1742d0);}})[_0xc9f2('0x24')](function(_0x1268ce){if(_0x1268ce){_0x4982a5=_0x1268ce[_0xc9f2('0x36')];if(!_0x4e8dd7['query'][_0xc9f2('0x37')]('nolimit')){_0x1742d0['limit']=qs[_0xc9f2('0x18')](_0x4e8dd7[_0xc9f2('0x30')][_0xc9f2('0x18')]);_0x1742d0['offset']=qs[_0xc9f2('0x16')](_0x4e8dd7[_0xc9f2('0x30')][_0xc9f2('0x16')]);}return _0x28735f[_0xc9f2('0x54')](_0x1742d0);}})['then'](function(_0x1eb84c){if(_0x1eb84c){return _0x1eb84c?{'count':_0x4982a5,'rows':_0x1eb84c}:null;}})[_0xc9f2('0x24')](respondWithResult(_0x58b401,null))[_0xc9f2('0x44')](handleError(_0x58b401,null));};exports[_0xc9f2('0x55')]=function(_0x5177c8,_0x491702,_0x221dbc){if(_0x5177c8['body']['id']){delete _0x5177c8['body']['id'];}return db['Trigger'][_0xc9f2('0x48')]({'where':{'id':_0x5177c8[_0xc9f2('0x46')]['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x491702,null))[_0xc9f2('0x24')](function(_0x3f552a){if(_0x3f552a){_0x5177c8['body'][_0xc9f2('0x56')]=_0x3f552a['id'];return db[_0xc9f2('0x57')][_0xc9f2('0x49')](_0x5177c8[_0xc9f2('0x4a')]);}})[_0xc9f2('0x24')](respondWithResult(_0x491702,null))['catch'](handleError(_0x491702,null));};exports[_0xc9f2('0x58')]=function(_0x33b51c,_0x4bd72b,_0x16952a){var _0x334515={};var _0x33eac6={};var _0x3128c5;var _0x57df5f;return db[_0xc9f2('0x2b')][_0xc9f2('0x52')]({'where':{'id':_0x33b51c[_0xc9f2('0x46')]['id']}})[_0xc9f2('0x24')](handleEntityNotFound(_0x4bd72b,null))[_0xc9f2('0x24')](function(_0x21a2e8){if(_0x21a2e8){_0x3128c5=_0x21a2e8;_0x33eac6['model']=_['keys'](db[_0xc9f2('0x57')][_0xc9f2('0x2c')]);_0x33eac6[_0xc9f2('0x30')]=_[_0xc9f2('0x31')](_0x33b51c[_0xc9f2('0x30')]);_0x33eac6['filters']=_[_0xc9f2('0x34')](_0x33eac6[_0xc9f2('0x32')],_0x33eac6['query']);_0x334515['attributes']=_[_0xc9f2('0x34')](_0x33eac6['model'],qs[_0xc9f2('0x35')](_0x33b51c['query'][_0xc9f2('0x35')]));_0x334515['attributes']=_0x334515[_0xc9f2('0x33')]['length']?_0x334515[_0xc9f2('0x33')]:_0x33eac6[_0xc9f2('0x32')];_0x334515['order']=qs[_0xc9f2('0x3a')](_0x33b51c['query'][_0xc9f2('0x3a')]);_0x334515[_0xc9f2('0x3b')]=qs['filters'](_[_0xc9f2('0x53')](_0x33b51c[_0xc9f2('0x30')],_0x33eac6[_0xc9f2('0x3c')]));if(_0x33b51c[_0xc9f2('0x30')][_0xc9f2('0x3d')]){_0x334515['where']=_[_0xc9f2('0x3f')](_0x334515[_0xc9f2('0x3b')],{'$or':_[_0xc9f2('0x2a')](_0x334515[_0xc9f2('0x33')],function(_0x2b6d3f){var _0x370219={};_0x370219[_0x2b6d3f]={'$like':'%'+_0x33b51c['query']['filter']+'%'};return _0x370219;})});}_0x334515=_[_0xc9f2('0x3f')]({},_0x334515,_0x33b51c['options']);return _0x3128c5[_0xc9f2('0x58')](_0x334515);}})[_0xc9f2('0x24')](function(_0x20af93){if(_0x20af93){_0x57df5f=_0x20af93[_0xc9f2('0x36')];if(!_0x33b51c[_0xc9f2('0x30')][_0xc9f2('0x37')](_0xc9f2('0x38'))){_0x334515['limit']=qs[_0xc9f2('0x18')](_0x33b51c[_0xc9f2('0x30')][_0xc9f2('0x18')]);_0x334515[_0xc9f2('0x16')]=qs[_0xc9f2('0x16')](_0x33b51c[_0xc9f2('0x30')][_0xc9f2('0x16')]);}return _0x3128c5[_0xc9f2('0x58')](_0x334515);}})[_0xc9f2('0x24')](function(_0x485ce0){if(_0x485ce0){return _0x485ce0?{'count':_0x57df5f,'rows':_0x485ce0}:null;}})[_0xc9f2('0x24')](respondWithResult(_0x4bd72b,null))[_0xc9f2('0x44')](handleError(_0x4bd72b,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 64e1929..ae06e4f 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 _0x85d8=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','Trigger','tools_triggers'];(function(_0x42e92c,_0x3886ea){var _0x53a67e=function(_0x2c555d){while(--_0x2c555d){_0x42e92c['push'](_0x42e92c['shift']());}};_0x53a67e(++_0x3886ea);}(_0x85d8,0x1b0));var _0x885d=function(_0x1bee14,_0x3a8307){_0x1bee14=_0x1bee14-0x0;var _0x44ad41=_0x85d8[_0x1bee14];return _0x44ad41;};'use strict';var _=require(_0x885d('0x0'));var util=require(_0x885d('0x1'));var logger=require(_0x885d('0x2'))(_0x885d('0x3'));var moment=require(_0x885d('0x4'));var BPromise=require('bluebird');var rp=require(_0x885d('0x5'));var fs=require('fs');var path=require(_0x885d('0x6'));var rimraf=require(_0x885d('0x7'));var config=require(_0x885d('0x8'));var attributes=require('./trigger.attributes');module['exports']=function(_0x186504,_0x30dcc2){return _0x186504[_0x885d('0x9')](_0x885d('0xa'),attributes,{'tableName':_0x885d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2830=['rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b2e06,_0xfb05f){var _0x4c5424=function(_0x26aba6){while(--_0x26aba6){_0x1b2e06['push'](_0x1b2e06['shift']());}};_0x4c5424(++_0xfb05f);}(_0x2830,0x117));var _0x0283=function(_0x211df5,_0x11a49f){_0x211df5=_0x211df5-0x0;var _0x13d513=_0x2830[_0x211df5];return _0x13d513;};'use strict';var _=require(_0x0283('0x0'));var util=require(_0x0283('0x1'));var logger=require(_0x0283('0x2'))(_0x0283('0x3'));var moment=require(_0x0283('0x4'));var BPromise=require(_0x0283('0x5'));var rp=require(_0x0283('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0283('0x7'));var config=require('../../config/environment');var attributes=require(_0x0283('0x8'));module[_0x0283('0x9')]=function(_0xc56cd7,_0x2125db){return _0xc56cd7[_0x0283('0xa')](_0x0283('0xb'),attributes,{'tableName':_0x0283('0xc'),'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 6899aa8..698029d 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 _0x7c45=['then','catch','ShowTrigger','where','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0x7c45,0x71));var _0x57c4=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x7c45[_0x32b542];return _0x554d54;};'use strict';var _=require(_0x57c4('0x0'));var util=require(_0x57c4('0x1'));var moment=require(_0x57c4('0x2'));var BPromise=require(_0x57c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57c4('0x4'));var db=require(_0x57c4('0x5'))['db'];var utils=require(_0x57c4('0x6'));var logger=require(_0x57c4('0x7'))(_0x57c4('0x8'));var config=require(_0x57c4('0x9'));var jayson=require(_0x57c4('0xa'));var client=jayson['client'][_0x57c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x81e6b0,_0x3bb3b9,_0x57f50b){return new BPromise(function(_0x1f8091,_0x5378ff){return client[_0x57c4('0xc')](_0x81e6b0,_0x57f50b)['then'](function(_0x641937){logger[_0x57c4('0xd')]('Trigger,\x20%s,\x20%s',_0x3bb3b9,_0x57c4('0xe'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x3bb3b9,'request\x20sent',JSON[_0x57c4('0xf')](_0x641937));if(_0x641937[_0x57c4('0x10')]){if(_0x641937[_0x57c4('0x10')][_0x57c4('0x11')]===0x1f4){logger[_0x57c4('0x10')](_0x57c4('0x12'),_0x3bb3b9,_0x641937[_0x57c4('0x10')][_0x57c4('0x13')]);return _0x5378ff(_0x641937['error'][_0x57c4('0x13')]);}logger[_0x57c4('0x10')](_0x57c4('0x12'),_0x3bb3b9,_0x641937[_0x57c4('0x10')][_0x57c4('0x13')]);return _0x1f8091(_0x641937['error'][_0x57c4('0x13')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x3bb3b9,_0x57c4('0xe'));_0x1f8091(_0x641937[_0x57c4('0x14')][_0x57c4('0x13')]);}})['catch'](function(_0x535939){logger[_0x57c4('0x10')](_0x57c4('0x12'),_0x3bb3b9,_0x535939);_0x5378ff(_0x535939);});});}exports[_0x57c4('0x15')]=function(_0x33e6c1){var _0x53eb82=this;return new Promise(function(_0x5438fc,_0x52cb30){return db[_0x57c4('0x16')][_0x57c4('0x17')]({'raw':_0x33e6c1[_0x57c4('0x18')]?_0x33e6c1[_0x57c4('0x18')][_0x57c4('0x19')]===undefined?!![]:![]:!![],'where':_0x33e6c1[_0x57c4('0x18')]?_0x33e6c1[_0x57c4('0x18')]['where']||null:null,'attributes':_0x33e6c1[_0x57c4('0x18')]?_0x33e6c1[_0x57c4('0x18')][_0x57c4('0x1a')]||null:null,'limit':_0x33e6c1[_0x57c4('0x18')]?_0x33e6c1[_0x57c4('0x18')][_0x57c4('0x1b')]||null:null,'include':_0x33e6c1['options']?_0x33e6c1['options'][_0x57c4('0x1c')]?_[_0x57c4('0x1d')](_0x33e6c1[_0x57c4('0x18')][_0x57c4('0x1c')],function(_0x4c7ca4){return{'model':db[_0x4c7ca4[_0x57c4('0x1e')]],'as':_0x4c7ca4['as'],'attributes':_0x4c7ca4[_0x57c4('0x1a')],'include':_0x4c7ca4[_0x57c4('0x1c')]?_[_0x57c4('0x1d')](_0x4c7ca4[_0x57c4('0x1c')],function(_0x43a219){return{'model':db[_0x43a219[_0x57c4('0x1e')]],'as':_0x43a219['as'],'attributes':_0x43a219[_0x57c4('0x1a')],'include':_0x43a219[_0x57c4('0x1c')]?_[_0x57c4('0x1d')](_0x43a219[_0x57c4('0x1c')],function(_0x1f6a69){return{'model':db[_0x1f6a69['model']],'as':_0x1f6a69['as'],'attributes':_0x1f6a69[_0x57c4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x57c4('0x1f')](function(_0x22b993){logger[_0x57c4('0xd')](_0x57c4('0x15'),_0x33e6c1);logger['debug'](_0x57c4('0x15'),_0x33e6c1,JSON[_0x57c4('0xf')](_0x22b993));_0x5438fc(_0x22b993);})[_0x57c4('0x20')](function(_0x5d335e){logger['error'](_0x57c4('0x15'),_0x5d335e[_0x57c4('0x13')],_0x33e6c1);_0x52cb30(_0x53eb82[_0x57c4('0x10')](0x1f4,_0x5d335e[_0x57c4('0x13')]));});});};exports[_0x57c4('0x21')]=function(_0x353b8d){var _0x27873f=this;return new Promise(function(_0x43bca3,_0x2d0c99){return db['Trigger']['find']({'raw':_0x353b8d[_0x57c4('0x18')]?_0x353b8d['options'][_0x57c4('0x19')]===undefined?!![]:![]:!![],'where':_0x353b8d['options']?_0x353b8d[_0x57c4('0x18')][_0x57c4('0x22')]||null:null,'attributes':_0x353b8d[_0x57c4('0x18')]?_0x353b8d['options'][_0x57c4('0x1a')]||null:null,'include':_0x353b8d[_0x57c4('0x18')]?_0x353b8d[_0x57c4('0x18')][_0x57c4('0x1c')]?_[_0x57c4('0x1d')](_0x353b8d[_0x57c4('0x18')]['include'],function(_0x46d9c8){return{'model':db[_0x46d9c8[_0x57c4('0x1e')]],'as':_0x46d9c8['as'],'attributes':_0x46d9c8[_0x57c4('0x1a')],'include':_0x46d9c8[_0x57c4('0x1c')]?_[_0x57c4('0x1d')](_0x46d9c8[_0x57c4('0x1c')],function(_0x12f9a9){return{'model':db[_0x12f9a9[_0x57c4('0x1e')]],'as':_0x12f9a9['as'],'attributes':_0x12f9a9[_0x57c4('0x1a')],'include':_0x12f9a9['include']?_[_0x57c4('0x1d')](_0x12f9a9['include'],function(_0x37c037){return{'model':db[_0x37c037[_0x57c4('0x1e')]],'as':_0x37c037['as'],'attributes':_0x37c037[_0x57c4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfbbf2e){logger['info'](_0x57c4('0x21'),_0x353b8d);logger[_0x57c4('0x23')]('ShowTrigger',_0x353b8d,JSON[_0x57c4('0xf')](_0xfbbf2e));_0x43bca3(_0xfbbf2e);})['catch'](function(_0xbb84cd){logger[_0x57c4('0x10')](_0x57c4('0x21'),_0xbb84cd[_0x57c4('0x13')],_0x353b8d);_0x2d0c99(_0x27873f[_0x57c4('0x10')](0x1f4,_0xbb84cd[_0x57c4('0x13')]));});});}; \ No newline at end of file +var _0x7f37=['attributes','debug','catch','raw','where','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','info','result','GetTrigger','Trigger','findAll','options','limit','include','map','model'];(function(_0x4b0625,_0x4bcba3){var _0x3d7ce8=function(_0x4fe2ae){while(--_0x4fe2ae){_0x4b0625['push'](_0x4b0625['shift']());}};_0x3d7ce8(++_0x4bcba3);}(_0x7f37,0x6f));var _0x77f3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7f37[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x77f3('0x0'));var util=require(_0x77f3('0x1'));var moment=require(_0x77f3('0x2'));var BPromise=require(_0x77f3('0x3'));var rs=require(_0x77f3('0x4'));var fs=require('fs');var Redis=require(_0x77f3('0x5'));var db=require(_0x77f3('0x6'))['db'];var utils=require(_0x77f3('0x7'));var logger=require('../../config/logger')(_0x77f3('0x8'));var config=require(_0x77f3('0x9'));var jayson=require(_0x77f3('0xa'));var client=jayson['client'][_0x77f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x139366,_0x395e8c,_0xfec0fc){return new BPromise(function(_0x16c69f,_0x3d58b9){return client[_0x77f3('0xc')](_0x139366,_0xfec0fc)['then'](function(_0x3cc462){logger['info']('Trigger,\x20%s,\x20%s',_0x395e8c,'request\x20sent');logger['debug'](_0x77f3('0xd'),_0x395e8c,_0x77f3('0xe'),JSON[_0x77f3('0xf')](_0x3cc462));if(_0x3cc462[_0x77f3('0x10')]){if(_0x3cc462[_0x77f3('0x10')]['code']===0x1f4){logger[_0x77f3('0x10')](_0x77f3('0x11'),_0x395e8c,_0x3cc462[_0x77f3('0x10')]['message']);return _0x3d58b9(_0x3cc462[_0x77f3('0x10')][_0x77f3('0x12')]);}logger[_0x77f3('0x10')](_0x77f3('0x11'),_0x395e8c,_0x3cc462['error'][_0x77f3('0x12')]);return _0x16c69f(_0x3cc462[_0x77f3('0x10')][_0x77f3('0x12')]);}else{logger[_0x77f3('0x13')](_0x77f3('0x11'),_0x395e8c,_0x77f3('0xe'));_0x16c69f(_0x3cc462[_0x77f3('0x14')][_0x77f3('0x12')]);}})['catch'](function(_0x80781a){logger['error'](_0x77f3('0x11'),_0x395e8c,_0x80781a);_0x3d58b9(_0x80781a);});});}exports[_0x77f3('0x15')]=function(_0x3667b8){var _0x3ff41d=this;return new Promise(function(_0x4de32d,_0x9d2434){return db[_0x77f3('0x16')][_0x77f3('0x17')]({'raw':_0x3667b8[_0x77f3('0x18')]?_0x3667b8['options']['raw']===undefined?!![]:![]:!![],'where':_0x3667b8[_0x77f3('0x18')]?_0x3667b8[_0x77f3('0x18')]['where']||null:null,'attributes':_0x3667b8[_0x77f3('0x18')]?_0x3667b8['options']['attributes']||null:null,'limit':_0x3667b8[_0x77f3('0x18')]?_0x3667b8[_0x77f3('0x18')][_0x77f3('0x19')]||null:null,'include':_0x3667b8['options']?_0x3667b8[_0x77f3('0x18')][_0x77f3('0x1a')]?_[_0x77f3('0x1b')](_0x3667b8[_0x77f3('0x18')][_0x77f3('0x1a')],function(_0x5579c6){return{'model':db[_0x5579c6[_0x77f3('0x1c')]],'as':_0x5579c6['as'],'attributes':_0x5579c6[_0x77f3('0x1d')],'include':_0x5579c6['include']?_[_0x77f3('0x1b')](_0x5579c6[_0x77f3('0x1a')],function(_0x752e59){return{'model':db[_0x752e59['model']],'as':_0x752e59['as'],'attributes':_0x752e59[_0x77f3('0x1d')],'include':_0x752e59['include']?_[_0x77f3('0x1b')](_0x752e59['include'],function(_0x415604){return{'model':db[_0x415604[_0x77f3('0x1c')]],'as':_0x415604['as'],'attributes':_0x415604[_0x77f3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b5119){logger[_0x77f3('0x13')](_0x77f3('0x15'),_0x3667b8);logger[_0x77f3('0x1e')](_0x77f3('0x15'),_0x3667b8,JSON['stringify'](_0x5b5119));_0x4de32d(_0x5b5119);})[_0x77f3('0x1f')](function(_0x3a1799){logger[_0x77f3('0x10')]('GetTrigger',_0x3a1799[_0x77f3('0x12')],_0x3667b8);_0x9d2434(_0x3ff41d[_0x77f3('0x10')](0x1f4,_0x3a1799[_0x77f3('0x12')]));});});};exports['ShowTrigger']=function(_0x480947){var _0x4594c9=this;return new Promise(function(_0x3eb5f5,_0x2e7c18){return db[_0x77f3('0x16')]['find']({'raw':_0x480947['options']?_0x480947['options'][_0x77f3('0x20')]===undefined?!![]:![]:!![],'where':_0x480947['options']?_0x480947[_0x77f3('0x18')][_0x77f3('0x21')]||null:null,'attributes':_0x480947[_0x77f3('0x18')]?_0x480947['options'][_0x77f3('0x1d')]||null:null,'include':_0x480947[_0x77f3('0x18')]?_0x480947['options'][_0x77f3('0x1a')]?_['map'](_0x480947['options'][_0x77f3('0x1a')],function(_0x22dabb){return{'model':db[_0x22dabb[_0x77f3('0x1c')]],'as':_0x22dabb['as'],'attributes':_0x22dabb['attributes'],'include':_0x22dabb[_0x77f3('0x1a')]?_[_0x77f3('0x1b')](_0x22dabb[_0x77f3('0x1a')],function(_0x4307f0){return{'model':db[_0x4307f0['model']],'as':_0x4307f0['as'],'attributes':_0x4307f0[_0x77f3('0x1d')],'include':_0x4307f0[_0x77f3('0x1a')]?_[_0x77f3('0x1b')](_0x4307f0[_0x77f3('0x1a')],function(_0x4eff1d){return{'model':db[_0x4eff1d[_0x77f3('0x1c')]],'as':_0x4eff1d['as'],'attributes':_0x4eff1d[_0x77f3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x170981){logger[_0x77f3('0x13')]('ShowTrigger',_0x480947);logger[_0x77f3('0x1e')](_0x77f3('0x22'),_0x480947,JSON[_0x77f3('0xf')](_0x170981));_0x3eb5f5(_0x170981);})['catch'](function(_0x3ab8ba){logger[_0x77f3('0x10')](_0x77f3('0x22'),_0x3ab8ba['message'],_0x480947);_0x2e7c18(_0x4594c9[_0x77f3('0x10')](0x1f4,_0x3ab8ba[_0x77f3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 4671227..b5f898d 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 _0xa84a=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id/clone','post','create','put','/:id','update','destroy','exports'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xa84a,0x18f));var _0xaa84=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa84a[_0x13ea00];return _0x1f7347;};'use strict';var multer=require(_0xaa84('0x0'));var util=require(_0xaa84('0x1'));var path=require('path');var timeout=require(_0xaa84('0x2'));var express=require(_0xaa84('0x3'));var router=express[_0xaa84('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaa84('0x5'));var interaction=require(_0xaa84('0x6'));var config=require('../../config/environment');var controller=require(_0xaa84('0x7'));router[_0xaa84('0x8')]('/',auth[_0xaa84('0x9')](),controller[_0xaa84('0xa')]);router[_0xaa84('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post'](_0xaa84('0xb'),auth[_0xaa84('0x9')](),controller['clone']);router[_0xaa84('0xc')]('/',auth['isAuthenticated'](),controller[_0xaa84('0xd')]);router[_0xaa84('0xe')](_0xaa84('0xf'),auth[_0xaa84('0x9')](),controller[_0xaa84('0x10')]);router['delete'](_0xaa84('0xf'),auth[_0xaa84('0x9')](),controller[_0xaa84('0x11')]);module[_0xaa84('0x12')]=router; \ No newline at end of file +var _0xa2b5=['post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','show','/:id/clone','clone'];(function(_0xc7d92f,_0x2f2193){var _0x3a17ea=function(_0x4315de){while(--_0x4315de){_0xc7d92f['push'](_0xc7d92f['shift']());}};_0x3a17ea(++_0x2f2193);}(_0xa2b5,0x1bd));var _0x5a2b=function(_0x58e2bd,_0x3dacea){_0x58e2bd=_0x58e2bd-0x0;var _0x2d0a5b=_0xa2b5[_0x58e2bd];return _0x2d0a5b;};'use strict';var multer=require(_0x5a2b('0x0'));var util=require(_0x5a2b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5a2b('0x2'));var router=express[_0x5a2b('0x3')]();var fs_extra=require(_0x5a2b('0x4'));var auth=require(_0x5a2b('0x5'));var interaction=require(_0x5a2b('0x6'));var config=require(_0x5a2b('0x7'));var controller=require(_0x5a2b('0x8'));router[_0x5a2b('0x9')]('/',auth[_0x5a2b('0xa')](),controller[_0x5a2b('0xb')]);router[_0x5a2b('0x9')]('/:id',auth[_0x5a2b('0xa')](),controller[_0x5a2b('0xc')]);router['post'](_0x5a2b('0xd'),auth[_0x5a2b('0xa')](),controller[_0x5a2b('0xe')]);router[_0x5a2b('0xf')]('/',auth['isAuthenticated'](),controller[_0x5a2b('0x10')]);router[_0x5a2b('0x11')](_0x5a2b('0x12'),auth['isAuthenticated'](),controller[_0x5a2b('0x13')]);router[_0x5a2b('0x14')](_0x5a2b('0x12'),auth[_0x5a2b('0xa')](),controller[_0x5a2b('0x15')]);module[_0x5a2b('0x16')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index e277fb5..ad746a7 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 _0x077c=['port,invite','insecure','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update','BOOLEAN','sequelize','STRING','name','friend','user','peer','ENUM','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','info','shortinfo','inband','rfc2833','yes','nonat','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'];(function(_0x21b11f,_0x3732e6){var _0x351177=function(_0x456f73){while(--_0x456f73){_0x21b11f['push'](_0x21b11f['shift']());}};_0x351177(++_0x3732e6);}(_0x077c,0xd6));var _0xc077=function(_0x571edb,_0x5a648d){_0x571edb=_0x571edb-0x0;var _0x2a682e=_0x077c[_0x571edb];return _0x2a682e;};'use strict';var Sequelize=require(_0xc077('0x0'));module['exports']={'name':{'type':Sequelize[_0xc077('0x1')],'allowNull':![],'unique':_0xc077('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xc077('0x3'),_0xc077('0x4'),_0xc077('0x5')),'allowNull':![],'defaultValue':_0xc077('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc077('0x6')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0xc077('0x7'),_0xc077('0x8'),_0xc077('0x9'),_0xc077('0xa'),'PROHIB_FAILED_SCREEN',_0xc077('0xb'))},'deny':{'type':Sequelize[_0xc077('0x1')]},'permit':{'type':Sequelize[_0xc077('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xc077('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0xc'),'set':function(_0x28beea){this[_0xc077('0xd')](_0xc077('0xe'),_0x28beea?_0x28beea[_0xc077('0xf')](','):null);},'get':function(){return this[_0xc077('0x10')]('transport')?this[_0xc077('0x10')](_0xc077('0xe'))[_0xc077('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xc077('0x6')]('rfc2833',_0xc077('0x12'),_0xc077('0x13'),_0xc077('0x14'),'auto'),'defaultValue':_0xc077('0x15')},'directmedia':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no',_0xc077('0x17'),'update',_0xc077('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc077('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0x19'),'set':function(_0x3a6c38){this['setDataValue'](_0xc077('0x1a'),_0x3a6c38?_0x3a6c38[_0xc077('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xc077('0x1a'))?this[_0xc077('0x10')](_0xc077('0x1a'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xc077('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc077('0x1')]},'language':{'type':Sequelize[_0xc077('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0x1b')},'allow':{'type':Sequelize[_0xc077('0x1')],'allowNull':![],'defaultValue':_0xc077('0x1c'),'set':function(_0x53a770){this['setDataValue']('allow',_0x53a770?_0x53a770[_0xc077('0xf')](';'):_0xc077('0x1c'));},'get':function(){return this[_0xc077('0x10')](_0xc077('0x1d'))?this[_0xc077('0x10')](_0xc077('0x1d'))['split'](';'):null;},'comment':_0xc077('0x1e')},'autoframing':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'insecure':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0x1f'),'set':function(_0x26f243){this[_0xc077('0xd')](_0xc077('0x20'),_0x26f243?_0x26f243['join'](','):null);},'get':function(){return this[_0xc077('0x10')](_0xc077('0x20'))?this['getDataValue']('insecure')[_0xc077('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xc077('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'accountcode':{'type':Sequelize[_0xc077('0x21')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0x22')},'amaflags':{'type':Sequelize[_0xc077('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0xc077('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0xc077('0x1')]},'template':{'type':Sequelize[_0xc077('0x1')]},'videosupport':{'type':Sequelize[_0xc077('0x6')]('yes','no',_0xc077('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc077('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc077('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x24'),_0xc077('0x25'),_0xc077('0x26'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xc077('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0xc077('0x6')]('uac',_0xc077('0x27')),'defaultValue':_0xc077('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0xc077('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xc077('0x1')]},'port':{'type':Sequelize[_0xc077('0x21')](0x5)},'qualify':{'type':Sequelize[_0xc077('0x6')]('yes','no'),'defaultValue':_0xc077('0x16')},'keepalive':{'type':Sequelize[_0xc077('0x21')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xc077('0x1')]},'rtptimeout':{'type':Sequelize[_0xc077('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc077('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc077('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no',_0xc077('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xc077('0x1')]},'timert1':{'type':Sequelize[_0xc077('0x21')](0xb)},'timerb':{'type':Sequelize[_0xc077('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc077('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0xc077('0x1')]},'contactdeny':{'type':Sequelize[_0xc077('0x1')]},'contactacl':{'type':Sequelize[_0xc077('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xc077('0x1')]},'use_q850_reason':{'type':Sequelize[_0xc077('0x1')]},'maxforwards':{'type':Sequelize[_0xc077('0x21')](0xb)},'encryption':{'type':Sequelize[_0xc077('0x6')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'force_avp':{'type':Sequelize[_0xc077('0x6')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0xc077('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xc077('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no',_0xc077('0x29'),_0xc077('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xc077('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc077('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xc077('0x1')]},'dtlscafile':{'type':Sequelize[_0xc077('0x1')]},'dtlscapath':{'type':Sequelize[_0xc077('0x1')]},'dtlssetup':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x2b'),_0xc077('0x2c'),_0xc077('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc077('0x1')]},'usereqphone':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc077('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no')},'vmexten':{'type':Sequelize[_0xc077('0x1')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xc077('0x1')]},'parkinglot':{'type':Sequelize[_0xc077('0x1')]},'description':{'type':Sequelize[_0xc077('0x1')]},'host':{'type':Sequelize[_0xc077('0x1')],'defaultValue':_0xc077('0x2e')},'canreinvite':{'type':Sequelize[_0xc077('0x6')](_0xc077('0x16'),'no',_0xc077('0x17'),_0xc077('0x2f'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc077('0x1')]},'otherFields':{'type':Sequelize[_0xc077('0x1')]},'active':{'type':Sequelize[_0xc077('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc077('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x157c=['dynamic','sequelize','exports','STRING','name','ENUM','user','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass'];(function(_0x51cd5e,_0x162cbe){var _0xa9acd8=function(_0x2606f3){while(--_0x2606f3){_0x51cd5e['push'](_0x51cd5e['shift']());}};_0xa9acd8(++_0x162cbe);}(_0x157c,0x1c3));var _0xc157=function(_0x3c700f,_0x2ad2c8){_0x3c700f=_0x3c700f-0x0;var _0x1bf773=_0x157c[_0x3c700f];return _0x1bf773;};'use strict';var Sequelize=require(_0xc157('0x0'));module[_0xc157('0x1')]={'name':{'type':Sequelize[_0xc157('0x2')],'allowNull':![],'unique':_0xc157('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc157('0x4')]('friend',_0xc157('0x5'),_0xc157('0x6')),'allowNull':![],'defaultValue':_0xc157('0x7')},'context':{'type':Sequelize[_0xc157('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x8'),_0xc157('0x9'),_0xc157('0xa'),'ALLOWED',_0xc157('0xb'),_0xc157('0xc'),_0xc157('0xd'),_0xc157('0xe'))},'deny':{'type':Sequelize[_0xc157('0x2')]},'permit':{'type':Sequelize[_0xc157('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xc157('0x2')]},'remotesecret':{'type':Sequelize[_0xc157('0x2')]},'transport':{'type':Sequelize[_0xc157('0x2')],'defaultValue':_0xc157('0xf'),'set':function(_0xfd9d4b){this[_0xc157('0x10')](_0xc157('0x11'),_0xfd9d4b?_0xfd9d4b[_0xc157('0x12')](','):null);},'get':function(){return this[_0xc157('0x13')](_0xc157('0x11'))?this[_0xc157('0x13')](_0xc157('0x11'))[_0xc157('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xc157('0x4')]('rfc2833','info',_0xc157('0x15'),_0xc157('0x16'),_0xc157('0x17')),'defaultValue':_0xc157('0x18')},'directmedia':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no',_0xc157('0x1a'),_0xc157('0x1b'),_0xc157('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc157('0x2')]},'directmediadeny':{'type':Sequelize[_0xc157('0x2')]},'nat':{'type':Sequelize[_0xc157('0x2')],'defaultValue':_0xc157('0x1d'),'set':function(_0x4c4926){this['setDataValue'](_0xc157('0x1e'),_0x4c4926?_0x4c4926[_0xc157('0x12')](','):null);},'get':function(){return this[_0xc157('0x13')](_0xc157('0x1e'))?this[_0xc157('0x13')](_0xc157('0x1e'))[_0xc157('0x14')](','):null;},'comment':_0xc157('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc157('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc157('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0xc157('0x2')],'allowNull':![],'defaultValue':_0xc157('0x20'),'set':function(_0xbb7aa8){this[_0xc157('0x10')](_0xc157('0x21'),_0xbb7aa8?_0xbb7aa8[_0xc157('0x12')](';'):_0xc157('0x20'));},'get':function(){return this[_0xc157('0x13')](_0xc157('0x21'))?this[_0xc157('0x13')](_0xc157('0x21'))[_0xc157('0x14')](';'):null;},'comment':_0xc157('0x22')},'autoframing':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'insecure':{'type':Sequelize[_0xc157('0x2')],'defaultValue':_0xc157('0x23'),'set':function(_0x15def3){this['setDataValue'](_0xc157('0x24'),_0x15def3?_0x15def3[_0xc157('0x12')](','):null);},'get':function(){return this[_0xc157('0x13')](_0xc157('0x24'))?this[_0xc157('0x13')](_0xc157('0x24'))[_0xc157('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0xc157('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc157('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no',_0xc157('0x25'))},'promiscredir':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'accountcode':{'type':Sequelize[_0xc157('0x26')](0xb)},'setvar':{'type':Sequelize[_0xc157('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc157('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xc157('0x19'),'no'),'defaultValue':_0xc157('0x19')},'busylevel':{'type':Sequelize[_0xc157('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xc157('0x4')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xc157('0x2')]},'template':{'type':Sequelize[_0xc157('0x2')]},'videosupport':{'type':Sequelize[_0xc157('0x4')]('yes','no',_0xc157('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc157('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0xc157('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xc157('0x28'),_0xc157('0x29'),_0xc157('0x2a'))},'session_expires':{'type':Sequelize[_0xc157('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xc157('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xc157('0x2b')),'defaultValue':_0xc157('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xc157('0x2')]},'regexten':{'type':Sequelize[_0xc157('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc157('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xc157('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xc157('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc157('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xc157('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc157('0x2')]},'callbackextension':{'type':Sequelize[_0xc157('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xc157('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xc157('0x2')]},'contactdeny':{'type':Sequelize[_0xc157('0x2')]},'contactacl':{'type':Sequelize[_0xc157('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xc157('0x26')](0xb)},'encryption':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc157('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'icesupport':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no',_0xc157('0x2c'),_0xc157('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xc157('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc157('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xc157('0x2')]},'dtlscipher':{'type':Sequelize[_0xc157('0x2')]},'dtlscafile':{'type':Sequelize[_0xc157('0x2')]},'dtlscapath':{'type':Sequelize[_0xc157('0x2')]},'dtlssetup':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x2e'),_0xc157('0x2f'),_0xc157('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc157('0x2')]},'usereqphone':{'type':Sequelize[_0xc157('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xc157('0x2')]},'call_limit':{'type':Sequelize[_0xc157('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no')},'vmexten':{'type':Sequelize[_0xc157('0x2')]},'mohinterpret':{'type':Sequelize[_0xc157('0x2')]},'mohsuggest':{'type':Sequelize[_0xc157('0x2')]},'parkinglot':{'type':Sequelize[_0xc157('0x2')]},'description':{'type':Sequelize[_0xc157('0x2')]},'host':{'type':Sequelize[_0xc157('0x2')],'defaultValue':_0xc157('0x31')},'canreinvite':{'type':Sequelize[_0xc157('0x4')](_0xc157('0x19'),'no',_0xc157('0x1a'),_0xc157('0x1b'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc157('0x2')]},'otherFields':{'type':Sequelize[_0xc157('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc157('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 9bad492..5ca1ce7 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 _0x24ca=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x51cadf,_0x43e776){var _0x1e1ed9=function(_0x42675a){while(--_0x42675a){_0x51cadf['push'](_0x51cadf['shift']());}};_0x1e1ed9(++_0x43e776);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2e9187,_0x3763f6){_0x2e9187=_0x2e9187-0x0;var _0x1fc3a8=_0x24ca[_0x2e9187];return _0x1fc3a8;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file +var _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','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','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x46db9a,_0x40dfa3){var _0x49d522=function(_0x1eeb20){while(--_0x1eeb20){_0x46db9a['push'](_0x46db9a['shift']());}};_0x49d522(++_0x40dfa3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'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'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 409badf..1da9163 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 _0x3477=['tools_trunks','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk'];(function(_0x2b9517,_0x5b9a93){var _0x43f966=function(_0x257f28){while(--_0x257f28){_0x2b9517['push'](_0x2b9517['shift']());}};_0x43f966(++_0x5b9a93);}(_0x3477,0xf8));var _0x7347=function(_0x29a912,_0x232d36){_0x29a912=_0x29a912-0x0;var _0x996902=_0x3477[_0x29a912];return _0x996902;};'use strict';var _=require(_0x7347('0x0'));var util=require(_0x7347('0x1'));var logger=require(_0x7347('0x2'))('api');var moment=require(_0x7347('0x3'));var BPromise=require('bluebird');var rp=require(_0x7347('0x4'));var fs=require('fs');var path=require(_0x7347('0x5'));var rimraf=require(_0x7347('0x6'));var config=require(_0x7347('0x7'));var attributes=require(_0x7347('0x8'));module[_0x7347('0x9')]=function(_0x62173c,_0x4e4d11){return _0x62173c[_0x7347('0xa')](_0x7347('0xb'),attributes,{'tableName':_0x7347('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2091=['rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2091,0x68));var _0x1209=function(_0x380fcf,_0x32e2c6){_0x380fcf=_0x380fcf-0x0;var _0x135471=_0x2091[_0x380fcf];return _0x135471;};'use strict';var _=require(_0x1209('0x0'));var util=require(_0x1209('0x1'));var logger=require(_0x1209('0x2'))(_0x1209('0x3'));var moment=require(_0x1209('0x4'));var BPromise=require(_0x1209('0x5'));var rp=require(_0x1209('0x6'));var fs=require('fs');var path=require(_0x1209('0x7'));var rimraf=require(_0x1209('0x8'));var config=require('../../config/environment');var attributes=require(_0x1209('0x9'));module[_0x1209('0xa')]=function(_0x8fa5fe,_0x2304f2){return _0x8fa5fe[_0x1209('0xb')](_0x1209('0xc'),attributes,{'tableName':_0x1209('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 39c2a3e..10b0bfe 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 _0x0d2a=['GetTrunk','debug','message','ShowTrunk','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','catch','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x352de7,_0x42d665){var _0x76cff2=function(_0x4e9f7c){while(--_0x4e9f7c){_0x352de7['push'](_0x352de7['shift']());}};_0x76cff2(++_0x42d665);}(_0x0d2a,0x13f));var _0xa0d2=function(_0x57954f,_0xe509ea){_0x57954f=_0x57954f-0x0;var _0x50bd0a=_0x0d2a[_0x57954f];return _0x50bd0a;};'use strict';var _=require(_0xa0d2('0x0'));var util=require(_0xa0d2('0x1'));var moment=require('moment');var BPromise=require(_0xa0d2('0x2'));var rs=require(_0xa0d2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa0d2('0x4'))['db'];var utils=require(_0xa0d2('0x5'));var logger=require(_0xa0d2('0x6'))(_0xa0d2('0x7'));var config=require(_0xa0d2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa0d2('0x9')][_0xa0d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e45a0,_0x527112,_0xce118e){return new BPromise(function(_0x48594d,_0x31214b){return client['request'](_0x2e45a0,_0xce118e)['then'](function(_0x2b3395){logger[_0xa0d2('0xb')](_0xa0d2('0xc'),_0x527112,'request\x20sent');logger['debug'](_0xa0d2('0xd'),_0x527112,_0xa0d2('0xe'),JSON[_0xa0d2('0xf')](_0x2b3395));if(_0x2b3395['error']){if(_0x2b3395[_0xa0d2('0x10')][_0xa0d2('0x11')]===0x1f4){logger[_0xa0d2('0x10')](_0xa0d2('0xc'),_0x527112,_0x2b3395[_0xa0d2('0x10')]['message']);return _0x31214b(_0x2b3395['error']['message']);}logger[_0xa0d2('0x10')](_0xa0d2('0xc'),_0x527112,_0x2b3395[_0xa0d2('0x10')]['message']);return _0x48594d(_0x2b3395[_0xa0d2('0x10')]['message']);}else{logger[_0xa0d2('0xb')](_0xa0d2('0xc'),_0x527112,_0xa0d2('0xe'));_0x48594d(_0x2b3395[_0xa0d2('0x12')]['message']);}})[_0xa0d2('0x13')](function(_0x13b64e){logger['error'](_0xa0d2('0xc'),_0x527112,_0x13b64e);_0x31214b(_0x13b64e);});});}exports['GetTrunk']=function(_0x599953){var _0x5113bb=this;return new Promise(function(_0x1bab11,_0x1ee48b){return db[_0xa0d2('0x14')][_0xa0d2('0x15')]({'raw':_0x599953[_0xa0d2('0x16')]?_0x599953[_0xa0d2('0x16')][_0xa0d2('0x17')]===undefined?!![]:![]:!![],'where':_0x599953['options']?_0x599953[_0xa0d2('0x16')][_0xa0d2('0x18')]||null:null,'attributes':_0x599953[_0xa0d2('0x16')]?_0x599953[_0xa0d2('0x16')][_0xa0d2('0x19')]||null:null,'limit':_0x599953[_0xa0d2('0x16')]?_0x599953[_0xa0d2('0x16')][_0xa0d2('0x1a')]||null:null,'include':_0x599953[_0xa0d2('0x16')]?_0x599953[_0xa0d2('0x16')][_0xa0d2('0x1b')]?_['map'](_0x599953['options']['include'],function(_0x30f213){return{'model':db[_0x30f213['model']],'as':_0x30f213['as'],'attributes':_0x30f213[_0xa0d2('0x19')],'include':_0x30f213[_0xa0d2('0x1b')]?_['map'](_0x30f213[_0xa0d2('0x1b')],function(_0x4843cc){return{'model':db[_0x4843cc['model']],'as':_0x4843cc['as'],'attributes':_0x4843cc[_0xa0d2('0x19')],'include':_0x4843cc[_0xa0d2('0x1b')]?_[_0xa0d2('0x1c')](_0x4843cc[_0xa0d2('0x1b')],function(_0x136148){return{'model':db[_0x136148[_0xa0d2('0x1d')]],'as':_0x136148['as'],'attributes':_0x136148['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0d2('0x1e')](function(_0x5697ed){logger[_0xa0d2('0xb')](_0xa0d2('0x1f'),_0x599953);logger[_0xa0d2('0x20')]('GetTrunk',_0x599953,JSON[_0xa0d2('0xf')](_0x5697ed));_0x1bab11(_0x5697ed);})['catch'](function(_0xf5681c){logger[_0xa0d2('0x10')](_0xa0d2('0x1f'),_0xf5681c[_0xa0d2('0x21')],_0x599953);_0x1ee48b(_0x5113bb[_0xa0d2('0x10')](0x1f4,_0xf5681c['message']));});});};exports[_0xa0d2('0x22')]=function(_0x6daaeb){var _0x23875f=this;return new Promise(function(_0x227c86,_0x3159fd){return db[_0xa0d2('0x14')]['find']({'raw':_0x6daaeb['options']?_0x6daaeb[_0xa0d2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x6daaeb['options']?_0x6daaeb[_0xa0d2('0x16')][_0xa0d2('0x18')]||null:null,'attributes':_0x6daaeb[_0xa0d2('0x16')]?_0x6daaeb[_0xa0d2('0x16')][_0xa0d2('0x19')]||null:null,'include':_0x6daaeb[_0xa0d2('0x16')]?_0x6daaeb[_0xa0d2('0x16')]['include']?_[_0xa0d2('0x1c')](_0x6daaeb[_0xa0d2('0x16')][_0xa0d2('0x1b')],function(_0x341462){return{'model':db[_0x341462[_0xa0d2('0x1d')]],'as':_0x341462['as'],'attributes':_0x341462[_0xa0d2('0x19')],'include':_0x341462['include']?_['map'](_0x341462[_0xa0d2('0x1b')],function(_0x40886b){return{'model':db[_0x40886b[_0xa0d2('0x1d')]],'as':_0x40886b['as'],'attributes':_0x40886b[_0xa0d2('0x19')],'include':_0x40886b[_0xa0d2('0x1b')]?_[_0xa0d2('0x1c')](_0x40886b['include'],function(_0x38d637){return{'model':db[_0x38d637[_0xa0d2('0x1d')]],'as':_0x38d637['as'],'attributes':_0x38d637[_0xa0d2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa0d2('0x1e')](function(_0xa5d143){logger[_0xa0d2('0xb')](_0xa0d2('0x22'),_0x6daaeb);logger[_0xa0d2('0x20')](_0xa0d2('0x22'),_0x6daaeb,JSON[_0xa0d2('0xf')](_0xa5d143));_0x227c86(_0xa5d143);})['catch'](function(_0x342486){logger['error']('ShowTrunk',_0x342486[_0xa0d2('0x21')],_0x6daaeb);_0x3159fd(_0x23875f['error'](0x1f4,_0x342486['message']));});});}; \ No newline at end of file +var _0x9729=['include','model','attributes','then','GetTrunk','catch','find','ShowTrunk','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','Trunk','findAll','options','raw','where','limit','map'];(function(_0x39658b,_0xf72a7f){var _0xa37442=function(_0x2edfaf){while(--_0x2edfaf){_0x39658b['push'](_0x39658b['shift']());}};_0xa37442(++_0xf72a7f);}(_0x9729,0xce));var _0x9972=function(_0x3af631,_0x2a5244){_0x3af631=_0x3af631-0x0;var _0x46bc92=_0x9729[_0x3af631];return _0x46bc92;};'use strict';var _=require(_0x9972('0x0'));var util=require('util');var moment=require(_0x9972('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9972('0x2'));var db=require(_0x9972('0x3'))['db'];var utils=require(_0x9972('0x4'));var logger=require(_0x9972('0x5'))(_0x9972('0x6'));var config=require(_0x9972('0x7'));var jayson=require(_0x9972('0x8'));var client=jayson['client'][_0x9972('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7d88e5,_0x25de29,_0x589d85){return new BPromise(function(_0x8b8420,_0xb9b7ad){return client[_0x9972('0xa')](_0x7d88e5,_0x589d85)['then'](function(_0x232981){logger['info'](_0x9972('0xb'),_0x25de29,_0x9972('0xc'));logger[_0x9972('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x25de29,'request\x20sent',JSON[_0x9972('0xe')](_0x232981));if(_0x232981['error']){if(_0x232981[_0x9972('0xf')]['code']===0x1f4){logger[_0x9972('0xf')](_0x9972('0xb'),_0x25de29,_0x232981['error']['message']);return _0xb9b7ad(_0x232981['error']['message']);}logger[_0x9972('0xf')](_0x9972('0xb'),_0x25de29,_0x232981[_0x9972('0xf')][_0x9972('0x10')]);return _0x8b8420(_0x232981[_0x9972('0xf')][_0x9972('0x10')]);}else{logger[_0x9972('0x11')](_0x9972('0xb'),_0x25de29,'request\x20sent');_0x8b8420(_0x232981['result'][_0x9972('0x10')]);}})['catch'](function(_0x3bd7b1){logger[_0x9972('0xf')](_0x9972('0xb'),_0x25de29,_0x3bd7b1);_0xb9b7ad(_0x3bd7b1);});});}exports['GetTrunk']=function(_0x3e3fdb){var _0x41b48c=this;return new Promise(function(_0x50ef97,_0x5b4eec){return db[_0x9972('0x12')][_0x9972('0x13')]({'raw':_0x3e3fdb['options']?_0x3e3fdb[_0x9972('0x14')][_0x9972('0x15')]===undefined?!![]:![]:!![],'where':_0x3e3fdb[_0x9972('0x14')]?_0x3e3fdb['options'][_0x9972('0x16')]||null:null,'attributes':_0x3e3fdb['options']?_0x3e3fdb[_0x9972('0x14')]['attributes']||null:null,'limit':_0x3e3fdb[_0x9972('0x14')]?_0x3e3fdb[_0x9972('0x14')][_0x9972('0x17')]||null:null,'include':_0x3e3fdb[_0x9972('0x14')]?_0x3e3fdb[_0x9972('0x14')]['include']?_[_0x9972('0x18')](_0x3e3fdb['options'][_0x9972('0x19')],function(_0x40e3e9){return{'model':db[_0x40e3e9[_0x9972('0x1a')]],'as':_0x40e3e9['as'],'attributes':_0x40e3e9[_0x9972('0x1b')],'include':_0x40e3e9['include']?_[_0x9972('0x18')](_0x40e3e9[_0x9972('0x19')],function(_0x5e717b){return{'model':db[_0x5e717b[_0x9972('0x1a')]],'as':_0x5e717b['as'],'attributes':_0x5e717b[_0x9972('0x1b')],'include':_0x5e717b['include']?_['map'](_0x5e717b[_0x9972('0x19')],function(_0x44c0fe){return{'model':db[_0x44c0fe[_0x9972('0x1a')]],'as':_0x44c0fe['as'],'attributes':_0x44c0fe[_0x9972('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9972('0x1c')](function(_0x4058f2){logger[_0x9972('0x11')](_0x9972('0x1d'),_0x3e3fdb);logger[_0x9972('0xd')](_0x9972('0x1d'),_0x3e3fdb,JSON[_0x9972('0xe')](_0x4058f2));_0x50ef97(_0x4058f2);})[_0x9972('0x1e')](function(_0x39f672){logger['error']('GetTrunk',_0x39f672[_0x9972('0x10')],_0x3e3fdb);_0x5b4eec(_0x41b48c[_0x9972('0xf')](0x1f4,_0x39f672[_0x9972('0x10')]));});});};exports['ShowTrunk']=function(_0x5c2817){var _0x320444=this;return new Promise(function(_0x21a4a0,_0x249253){return db[_0x9972('0x12')][_0x9972('0x1f')]({'raw':_0x5c2817[_0x9972('0x14')]?_0x5c2817[_0x9972('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5c2817['options']?_0x5c2817[_0x9972('0x14')][_0x9972('0x16')]||null:null,'attributes':_0x5c2817[_0x9972('0x14')]?_0x5c2817[_0x9972('0x14')][_0x9972('0x1b')]||null:null,'include':_0x5c2817['options']?_0x5c2817[_0x9972('0x14')][_0x9972('0x19')]?_[_0x9972('0x18')](_0x5c2817[_0x9972('0x14')][_0x9972('0x19')],function(_0x5e1eda){return{'model':db[_0x5e1eda['model']],'as':_0x5e1eda['as'],'attributes':_0x5e1eda['attributes'],'include':_0x5e1eda[_0x9972('0x19')]?_[_0x9972('0x18')](_0x5e1eda[_0x9972('0x19')],function(_0x4b8ccc){return{'model':db[_0x4b8ccc['model']],'as':_0x4b8ccc['as'],'attributes':_0x4b8ccc[_0x9972('0x1b')],'include':_0x4b8ccc[_0x9972('0x19')]?_[_0x9972('0x18')](_0x4b8ccc[_0x9972('0x19')],function(_0x4223f3){return{'model':db[_0x4223f3[_0x9972('0x1a')]],'as':_0x4223f3['as'],'attributes':_0x4223f3[_0x9972('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9972('0x1c')](function(_0x5824d3){logger['info']('ShowTrunk',_0x5c2817);logger[_0x9972('0xd')](_0x9972('0x20'),_0x5c2817,JSON[_0x9972('0xe')](_0x5824d3));_0x21a4a0(_0x5824d3);})[_0x9972('0x1e')](function(_0x3cbe36){logger[_0x9972('0xf')](_0x9972('0x20'),_0x3cbe36[_0x9972('0x10')],_0x5c2817);_0x249253(_0x320444[_0x9972('0xf')](0x1f4,_0x3cbe36['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index b0b06a8..36c65cc 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 _0x18f3=['update','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0xd8f220,_0x453a11){var _0x4e865f=function(_0x3e37ff){while(--_0x3e37ff){_0xd8f220['push'](_0xd8f220['shift']());}};_0x4e865f(++_0x453a11);}(_0x18f3,0x1cf));var _0x318f=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x18f3[_0x122096];return _0x3d1966;};'use strict';var express=require('express');var router=express[_0x318f('0x0')]();var auth=require(_0x318f('0x1'));var controller=require(_0x318f('0x2'));router[_0x318f('0x3')](_0x318f('0x4'),auth[_0x318f('0x5')](),controller[_0x318f('0x6')]);module['exports']=router; \ No newline at end of file +var _0xc733=['exports','express','Router','../../components/auth/service','put','/:id','isAuthenticated'];(function(_0x1b8bac,_0x390bc9){var _0x4390d0=function(_0x2e46df){while(--_0x2e46df){_0x1b8bac['push'](_0x1b8bac['shift']());}};_0x4390d0(++_0x390bc9);}(_0xc733,0x1ba));var _0x3c73=function(_0x45ed20,_0x347b04){_0x45ed20=_0x45ed20-0x0;var _0x629f0f=_0xc733[_0x45ed20];return _0x629f0f;};'use strict';var express=require(_0x3c73('0x0'));var router=express[_0x3c73('0x1')]();var auth=require(_0x3c73('0x2'));var controller=require('./user-setting.controller');router[_0x3c73('0x3')](_0x3c73('0x4'),auth[_0x3c73('0x5')](),controller['update']);module[_0x3c73('0x6')]=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 996b911..1dbcc04 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 _0x218c=['info','debug','exports','error','BOOLEAN','DATE','INTEGER','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x218c,0xa8));var _0xc218=function(_0x6823e,_0xc66f0e){_0x6823e=_0x6823e-0x0;var _0x5a2be8=_0x218c[_0x6823e];return _0x5a2be8;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0xc218('0x0'),_0xc218('0x1')];module[_0xc218('0x2')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xc218('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xc218('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xc218('0x5')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xc218('0x6')],'unique':_0xc218('0x7')}}; \ No newline at end of file +var _0x8a6d=['TEXT','DATE','INTEGER','sequelize','warning','info','debug','ENUM','error'];(function(_0x291659,_0x55ef07){var _0xa6afaf=function(_0x758d77){while(--_0x758d77){_0x291659['push'](_0x291659['shift']());}};_0xa6afaf(++_0x55ef07);}(_0x8a6d,0x11a));var _0xd8a6=function(_0x53a102,_0x5df034){_0x53a102=_0x53a102-0x0;var _0x4aa650=_0x8a6d[_0x53a102];return _0x4aa650;};'use strict';var Sequelize=require(_0xd8a6('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xd8a6('0x1'),_0xd8a6('0x2'),_0xd8a6('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xd8a6('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xd8a6('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xd8a6('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xd8a6('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xd8a6('0x8')],'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 09906f3..4c6cc6f 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 _0x1ddc=['status','send','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','then','catch','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','./user-setting.socket','register','defaults','redis','json','update','sendStatus','error','stack','name'];(function(_0x3a6ee1,_0x4de9fe){var _0xbe4556=function(_0x3ab5d0){while(--_0x3ab5d0){_0x3a6ee1['push'](_0x3a6ee1['shift']());}};_0xbe4556(++_0x4de9fe);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x54a7aa,_0x55d59c){_0x54a7aa=_0x54a7aa-0x0;var _0x43a783=_0x1ddc[_0x54a7aa];return _0x43a783;};'use strict';var _=require('lodash');var Redis=require(_0xc1dd('0x0'));var logger=require(_0xc1dd('0x1'))(_0xc1dd('0x2'));var config=require('../../config/environment');var db=require(_0xc1dd('0x3'))['db'];var socket=require(_0xc1dd('0x4'))(new Redis(config['redis']));require(_0xc1dd('0x5'))[_0xc1dd('0x6')](socket);config['redis']=_[_0xc1dd('0x7')](config[_0xc1dd('0x8')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x3938ff,_0x25c543){_0x25c543=_0x25c543||0xc8;return function(_0x593de5){if(_0x593de5){return _0x3938ff['status'](_0x25c543)[_0xc1dd('0x9')](_0x593de5);}};}function saveUpdates(_0x2bf2bd){return function(_0x17157a){if(_0x17157a){return _0x17157a[_0xc1dd('0xa')](_0x2bf2bd)['then'](function(_0x38b62e){return _0x38b62e;});}return null;};}function handleEntityNotFound(_0x1b4b3f){return function(_0xa720ed){if(!_0xa720ed){_0x1b4b3f[_0xc1dd('0xb')](0x194);}return _0xa720ed;};}function handleError(_0x4f404d,_0xaf56b8){_0xaf56b8=_0xaf56b8||0x1f4;return function(_0x1d28a7){logger[_0xc1dd('0xc')](_0x1d28a7[_0xc1dd('0xd')]);if(_0x1d28a7[_0xc1dd('0xe')]){delete _0x1d28a7[_0xc1dd('0xe')];}_0x4f404d[_0xc1dd('0xf')](_0xaf56b8)[_0xc1dd('0x10')](_0x1d28a7);};}exports[_0xc1dd('0xa')]=function(_0x3882fc,_0x433b64){if(_0x3882fc['user'][_0xc1dd('0x11')]!==_0xc1dd('0x12'))throw new Error(_0xc1dd('0x13'));if(isNaN(Number(_0x3882fc[_0xc1dd('0x14')]['id'])))throw new Error(_0xc1dd('0x15'));return db['UserSetting'][_0xc1dd('0x16')]({'where':{'id':_0x3882fc[_0xc1dd('0x14')]['id']}})[_0xc1dd('0x17')](handleEntityNotFound(_0x433b64,null))[_0xc1dd('0x17')](saveUpdates(_0x3882fc['body'],null))['then'](respondWithResult(_0x433b64,null))[_0xc1dd('0x18')](handleError(_0x433b64,null));}; \ No newline at end of file +var _0x59c3=['send','user','role','admin','params','Invalid\x20user\x20setting\x20id','find','then','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','register','defaults','status','json','update','sendStatus','error','stack','name'];(function(_0x50ed96,_0x19bac2){var _0x193c04=function(_0x3d7769){while(--_0x3d7769){_0x50ed96['push'](_0x50ed96['shift']());}};_0x193c04(++_0x19bac2);}(_0x59c3,0x133));var _0x359c=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x59c3[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x359c('0x0'));var Redis=require(_0x359c('0x1'));var logger=require(_0x359c('0x2'))(_0x359c('0x3'));var config=require(_0x359c('0x4'));var db=require(_0x359c('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x359c('0x6')]));require(_0x359c('0x7'))[_0x359c('0x8')](socket);config[_0x359c('0x6')]=_[_0x359c('0x9')](config[_0x359c('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x9c107b,_0x58b390){_0x58b390=_0x58b390||0xc8;return function(_0x3a7d8e){if(_0x3a7d8e){return _0x9c107b[_0x359c('0xa')](_0x58b390)[_0x359c('0xb')](_0x3a7d8e);}};}function saveUpdates(_0x682720){return function(_0x536426){if(_0x536426){return _0x536426[_0x359c('0xc')](_0x682720)['then'](function(_0x15b56d){return _0x15b56d;});}return null;};}function handleEntityNotFound(_0x1d7417){return function(_0xb48a01){if(!_0xb48a01){_0x1d7417[_0x359c('0xd')](0x194);}return _0xb48a01;};}function handleError(_0x160271,_0x218e8b){_0x218e8b=_0x218e8b||0x1f4;return function(_0x5567d7){logger[_0x359c('0xe')](_0x5567d7[_0x359c('0xf')]);if(_0x5567d7[_0x359c('0x10')]){delete _0x5567d7[_0x359c('0x10')];}_0x160271[_0x359c('0xa')](_0x218e8b)[_0x359c('0x11')](_0x5567d7);};}exports[_0x359c('0xc')]=function(_0x246dc1,_0x3a73ca){if(_0x246dc1[_0x359c('0x12')][_0x359c('0x13')]!==_0x359c('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x246dc1[_0x359c('0x15')]['id'])))throw new Error(_0x359c('0x16'));return db['UserSetting'][_0x359c('0x17')]({'where':{'id':_0x246dc1[_0x359c('0x15')]['id']}})[_0x359c('0x18')](handleEntityNotFound(_0x3a73ca,null))[_0x359c('0x18')](saveUpdates(_0x246dc1[_0x359c('0x19')],null))[_0x359c('0x18')](respondWithResult(_0x3a73ca,null))[_0x359c('0x1a')](handleError(_0x3a73ca,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 dd043d9..5b8c62c 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 _0xdd45=['UserSetting','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1d9e0a,_0x186cb6){var _0x511957=function(_0x25ab3c){while(--_0x25ab3c){_0x1d9e0a['push'](_0x1d9e0a['shift']());}};_0x511957(++_0x186cb6);}(_0xdd45,0x1f2));var _0x5dd4=function(_0x5a556b,_0x36cbc5){_0x5a556b=_0x5a556b-0x0;var _0x3f88a2=_0xdd45[_0x5a556b];return _0x3f88a2;};'use strict';var EventEmitter=require(_0x5dd4('0x0'));var UserSetting=require(_0x5dd4('0x1'))['db'][_0x5dd4('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x5dd4('0x3')](0x0);var events={'afterCreate':_0x5dd4('0x4'),'afterUpdate':_0x5dd4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5e569f){return function(_0x4e1a0e,_0x3debb8,_0x6ab5dd){UserSettingEvents[_0x5dd4('0x6')](_0x5e569f+':'+_0x4e1a0e['id'],_0x4e1a0e);UserSettingEvents[_0x5dd4('0x6')](_0x5e569f,_0x4e1a0e);_0x6ab5dd(null);};}for(var e in events){if(events[_0x5dd4('0x7')](e)){var event=events[e];UserSetting[_0x5dd4('0x8')](e,emitEvent(event));}}module[_0x5dd4('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x028d=['update','emit','hasOwnProperty','hook','exports','UserSetting','save'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0x028d,0x1a2));var _0xd028=function(_0x48bceb,_0x3658d8){_0x48bceb=_0x48bceb-0x0;var _0x274484=_0x028d[_0x48bceb];return _0x274484;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0xd028('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd028('0x1'),'afterUpdate':_0xd028('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3f4600){return function(_0x3ba3d1,_0x56b0a0,_0x15c68d){UserSettingEvents[_0xd028('0x3')](_0x3f4600+':'+_0x3ba3d1['id'],_0x3ba3d1);UserSettingEvents[_0xd028('0x3')](_0x3f4600,_0x3ba3d1);_0x15c68d(null);};}for(var e in events){if(events[_0xd028('0x4')](e)){var event=events[e];UserSetting[_0xd028('0x5')](e,emitEvent(event));}}module[_0xd028('0x6')]=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 c02c403..76535e5 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 _0x5ff3=['clientSideLoggingEnabledSince','exports','define','user_settings','clientSideLoggingEnabled'];(function(_0x1be098,_0x396596){var _0x37be1a=function(_0x183c39){while(--_0x183c39){_0x1be098['push'](_0x1be098['shift']());}};_0x37be1a(++_0x396596);}(_0x5ff3,0x17d));var _0x35ff=function(_0x1a81b4,_0x4d011a){_0x1a81b4=_0x1a81b4-0x0;var _0x42964e=_0x5ff3[_0x1a81b4];return _0x42964e;};'use strict';var attributes=require('./user-setting.attributes');module[_0x35ff('0x0')]=function(_0x48cbf7){return _0x48cbf7[_0x35ff('0x1')]('UserSetting',attributes,{'tableName':_0x35ff('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bb200){if(!_0x1bb200[_0x35ff('0x3')])_0x1bb200[_0x35ff('0x4')]=null;else if(_0x1bb200['clientSideLoggingEnabledSince']===null)_0x1bb200[_0x35ff('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x9234=['clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x49c663,_0x37d7a3){var _0x5a3e7e=function(_0x2fe2b3){while(--_0x2fe2b3){_0x49c663['push'](_0x49c663['shift']());}};_0x5a3e7e(++_0x37d7a3);}(_0x9234,0x1bd));var _0x4923=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x9234[_0x24259d];return _0x5a701;};'use strict';var attributes=require(_0x4923('0x0'));module['exports']=function(_0x1ece6e){return _0x1ece6e[_0x4923('0x1')](_0x4923('0x2'),attributes,{'tableName':_0x4923('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x481178){if(!_0x481178[_0x4923('0x4')])_0x481178[_0x4923('0x5')]=null;else if(_0x481178['clientSideLoggingEnabledSince']===null)_0x481178[_0x4923('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 65a9d06..adaa087 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 _0xe57f=['length','user-setting:','./user-setting.events','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register'];(function(_0x18b2a3,_0x2a639b){var _0x50659f=function(_0x6cb26e){while(--_0x6cb26e){_0x18b2a3['push'](_0x18b2a3['shift']());}};_0x50659f(++_0x2a639b);}(_0xe57f,0x1a6));var _0xfe57=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe57f[_0x17d9e3];return _0x14192d;};'use strict';var UserSettingEvents=require(_0xfe57('0x0'));var events=['save',_0xfe57('0x1'),_0xfe57('0x2')];function createListener(_0x482b40,_0x343f85){return function(_0x18c3c4){_0x343f85[_0xfe57('0x3')](_0x482b40,_0x18c3c4);if(_0x482b40===_0xfe57('0x4')){_0x343f85[_0xfe57('0x3')](_0xfe57('0x5')+_0x18c3c4[_0xfe57('0x6')],_0x18c3c4);}};}exports[_0xfe57('0x7')]=function(_0x493552){for(var _0x1b8b07=0x0,_0x1d34ec=events[_0xfe57('0x8')];_0x1b8b07<_0x1d34ec;_0x1b8b07++){var _0x32cda5=events[_0x1b8b07];var _0x3298d8=createListener(_0xfe57('0x9')+_0x32cda5,_0x493552);UserSettingEvents['on'](_0x32cda5,_0x3298d8);}}; \ No newline at end of file +var _0x3ee8=['remove','update','emit','user-setting:update','user-setting:update:user-','UserId','length','user-setting:','./user-setting.events','save'];(function(_0x34e76c,_0x11d21e){var _0x267d83=function(_0x204033){while(--_0x204033){_0x34e76c['push'](_0x34e76c['shift']());}};_0x267d83(++_0x11d21e);}(_0x3ee8,0x9e));var _0x83ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ee8[_0x3dd15e];return _0x231fd0;};'use strict';var UserSettingEvents=require(_0x83ee('0x0'));var events=[_0x83ee('0x1'),_0x83ee('0x2'),_0x83ee('0x3')];function createListener(_0xec6bb6,_0x5f410c){return function(_0x495bd2){_0x5f410c[_0x83ee('0x4')](_0xec6bb6,_0x495bd2);if(_0xec6bb6===_0x83ee('0x5')){_0x5f410c[_0x83ee('0x4')](_0x83ee('0x6')+_0x495bd2[_0x83ee('0x7')],_0x495bd2);}};}exports['register']=function(_0x47511b){for(var _0x1469fe=0x0,_0x52cd53=events[_0x83ee('0x8')];_0x1469fe<_0x52cd53;_0x1469fe++){var _0xd397fd=events[_0x1469fe];var _0x3cac2c=createListener(_0x83ee('0x9')+_0xd397fd,_0x47511b);UserSettingEvents['on'](_0xd397fd,_0x3cac2c);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5a3f8d3..8fac042 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 _0xe586=['removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','index','get','/describe','describe','/whoami','isAuthenticated','/presence','getPresence','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','create','/create_many','addQueues','join','root','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','/:id/login','/:id/logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','/:id','update','put','changePassword','delete','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites'];(function(_0x815c81,_0x54224f){var _0x432fb6=function(_0x26254b){while(--_0x26254b){_0x815c81['push'](_0x815c81['shift']());}};_0x432fb6(++_0x54224f);}(_0xe586,0x151));var _0x6e58=function(_0x594542,_0x49a7b6){_0x594542=_0x594542-0x0;var _0x1b47fc=_0xe586[_0x594542];return _0x1b47fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6e58('0x0'));var timeout=require(_0x6e58('0x1'));var express=require('express');var router=express[_0x6e58('0x2')]();var fs_extra=require(_0x6e58('0x3'));var auth=require(_0x6e58('0x4'));var interaction=require(_0x6e58('0x5'));var config=require(_0x6e58('0x6'));var controller=require(_0x6e58('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6e58('0x8')]);router[_0x6e58('0x9')](_0x6e58('0xa'),auth['isAuthenticated'](),controller[_0x6e58('0xb')]);router['get'](_0x6e58('0xc'),auth[_0x6e58('0xd')](),controller['whoami']);router['get'](_0x6e58('0xe'),auth['isAuthenticated'](),controller[_0x6e58('0xf')]);router[_0x6e58('0x9')]('/:id',auth[_0x6e58('0xd')](),controller['show']);router[_0x6e58('0x9')](_0x6e58('0x10'),controller[_0x6e58('0x11')]);router[_0x6e58('0x9')](_0x6e58('0x12'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x13')]);router[_0x6e58('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x6e58('0x9')](_0x6e58('0x14'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x15')]);router[_0x6e58('0x9')]('/:id/queues_rt',auth[_0x6e58('0xd')](),controller[_0x6e58('0x16')]);router[_0x6e58('0x9')](_0x6e58('0x17'),auth['isAuthenticated'](),controller[_0x6e58('0x18')]);router['get'](_0x6e58('0x19'),auth[_0x6e58('0xd')](),controller['getRecordings']);router[_0x6e58('0x9')](_0x6e58('0x1a'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x1b')]);router[_0x6e58('0x9')]('/:id/chat/interactions',auth[_0x6e58('0xd')](),controller[_0x6e58('0x1c')]);router[_0x6e58('0x9')](_0x6e58('0x1d'),auth[_0x6e58('0xd')](),controller['getOpenchannelInteractions']);router[_0x6e58('0x9')](_0x6e58('0x1e'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x1f')]);router['get'](_0x6e58('0x20'),auth[_0x6e58('0xd')](),controller['getSmsInteractions']);router[_0x6e58('0x9')](_0x6e58('0x21'),auth['isAuthenticated'](),controller[_0x6e58('0x22')]);router['get'](_0x6e58('0x23'),auth[_0x6e58('0xd')](),controller['getWhatsappInteractions']);router[_0x6e58('0x9')](_0x6e58('0x24'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x25')]);router[_0x6e58('0x9')](_0x6e58('0x26'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x27')]);router[_0x6e58('0x9')](_0x6e58('0x28'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x29')]);router[_0x6e58('0x9')]('/:id/prefixes',auth[_0x6e58('0xd')](),controller[_0x6e58('0x2a')]);router[_0x6e58('0x9')](_0x6e58('0x2b'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x2c')]);router[_0x6e58('0x9')]('/:id/mail_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x2d')]);router['get'](_0x6e58('0x2e'),auth['isAuthenticated'](),controller[_0x6e58('0x2f')]);router['get'](_0x6e58('0x30'),auth[_0x6e58('0xd')](),controller['getSmsAccounts']);router[_0x6e58('0x9')](_0x6e58('0x31'),auth['isAuthenticated'](),controller[_0x6e58('0x32')]);router[_0x6e58('0x9')](_0x6e58('0x33'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x34')]);router[_0x6e58('0x9')](_0x6e58('0x35'),auth['isAuthenticated'](),controller[_0x6e58('0x36')]);router['get'](_0x6e58('0x37'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x38')]);router[_0x6e58('0x39')](_0x6e58('0x3a'),auth[_0x6e58('0xd')](),controller['addContacts']);router[_0x6e58('0x39')]('/',auth[_0x6e58('0xd')](),controller[_0x6e58('0x3b')]);router[_0x6e58('0x39')](_0x6e58('0x3c'),auth[_0x6e58('0xd')](),controller['bulkCreate']);router[_0x6e58('0x39')]('/:id/queues',auth[_0x6e58('0xd')](),controller[_0x6e58('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x9a66b7,_0x1af1d7,_0x536823){_0x536823(null,path[_0x6e58('0x3e')](config[_0x6e58('0x3f')],_0x6e58('0x40')));},'filename':function(_0x497ce5,_0x32d2b5,_0x35f7cb){_0x35f7cb(null,util[_0x6e58('0x41')](_0x6e58('0x42'),Date['now'](),_0x32d2b5[_0x6e58('0x43')]));}})});router[_0x6e58('0x39')]('/:id/avatar',upload[_0x6e58('0x44')](_0x6e58('0x45')),controller[_0x6e58('0x46')]);router[_0x6e58('0x39')](_0x6e58('0x47'),auth[_0x6e58('0xd')](),controller['login']);router[_0x6e58('0x39')](_0x6e58('0x48'),auth[_0x6e58('0xd')](),controller['logout']);router[_0x6e58('0x39')](_0x6e58('0x49'),auth['isAuthenticated'](),controller['pause']);router['post'](_0x6e58('0x4a'),auth['isAuthenticated'](),controller[_0x6e58('0x4b')]);router[_0x6e58('0x39')](_0x6e58('0x24'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x4c')]);router[_0x6e58('0x39')](_0x6e58('0x4d'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x4e')]);router[_0x6e58('0x39')](_0x6e58('0x4f'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x50')]);router['post'](_0x6e58('0x51'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x52')]);router[_0x6e58('0x39')](_0x6e58('0x53'),auth['isAuthenticated'](),controller[_0x6e58('0x54')]);router[_0x6e58('0x39')]('/:id/openchannel_interactions',auth[_0x6e58('0xd')](),controller['addOpenchannelInteractions']);router[_0x6e58('0x39')]('/:id/whatsapp_interactions',auth[_0x6e58('0xd')](),controller[_0x6e58('0x55')]);router[_0x6e58('0x39')](_0x6e58('0x2b'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x56')]);router[_0x6e58('0x39')]('/:id/mail_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x57')]);router['post']('/:id/openchannel_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x58')]);router[_0x6e58('0x39')]('/:id/sms_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x59')]);router[_0x6e58('0x39')](_0x6e58('0x31'),auth[_0x6e58('0xd')](),controller['addChatWebsites']);router[_0x6e58('0x39')](_0x6e58('0x33'),auth['isAuthenticated'](),controller[_0x6e58('0x5a')]);router[_0x6e58('0x39')](_0x6e58('0x37'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x5b')]);router['put'](_0x6e58('0x5c'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x5d')]);router[_0x6e58('0x5e')]('/:id/password',auth[_0x6e58('0xd')](),controller[_0x6e58('0x5f')]);router[_0x6e58('0x60')](_0x6e58('0x14'),auth[_0x6e58('0xd')](),controller['removeQueues']);router[_0x6e58('0x60')](_0x6e58('0x24'),auth[_0x6e58('0xd')](),controller['removeTeams']);router[_0x6e58('0x60')](_0x6e58('0x5c'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x61')]);router[_0x6e58('0x60')]('/:id/chat_interactions',auth[_0x6e58('0xd')](),controller[_0x6e58('0x62')]);router[_0x6e58('0x60')](_0x6e58('0x4f'),auth[_0x6e58('0xd')](),controller['removeMailInteractions']);router[_0x6e58('0x60')]('/:id/fax_interactions',auth[_0x6e58('0xd')](),controller[_0x6e58('0x63')]);router[_0x6e58('0x60')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x6e58('0x64')]);router[_0x6e58('0x60')]('/:id/openchannel_interactions',auth[_0x6e58('0xd')](),controller[_0x6e58('0x65')]);router[_0x6e58('0x60')](_0x6e58('0x66'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router['delete']('/:id/fax_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x67')]);router[_0x6e58('0x60')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete']('/:id/openchannel_accounts',auth[_0x6e58('0xd')](),controller[_0x6e58('0x68')]);router['delete'](_0x6e58('0x30'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x69')]);router[_0x6e58('0x60')]('/:id/chat_websites',auth[_0x6e58('0xd')](),controller[_0x6e58('0x6a')]);router[_0x6e58('0x60')](_0x6e58('0x33'),auth[_0x6e58('0xd')](),controller[_0x6e58('0x6b')]);router[_0x6e58('0x60')]('/:id/api_key',auth[_0x6e58('0xd')](),controller[_0x6e58('0x6c')]);router[_0x6e58('0x39')](_0x6e58('0x6d'),auth[_0x6e58('0xd')](),controller['messengerSoundNotification']);module[_0x6e58('0x6e')]=router; \ No newline at end of file +var _0xfdbf=['getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','file','addAvatar','login','logout','/:id/pause','/:id/unpause','/:id/chat_interactions','addChatInteractions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','show','getAvatar','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites'];(function(_0x17a72f,_0x564733){var _0x3c85e6=function(_0x5dc310){while(--_0x5dc310){_0x17a72f['push'](_0x17a72f['shift']());}};_0x3c85e6(++_0x564733);}(_0xfdbf,0xb5));var _0xffdb=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xfdbf[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0xffdb('0x0'));var util=require(_0xffdb('0x1'));var path=require(_0xffdb('0x2'));var timeout=require('connect-timeout');var express=require(_0xffdb('0x3'));var router=express[_0xffdb('0x4')]();var fs_extra=require(_0xffdb('0x5'));var auth=require(_0xffdb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xffdb('0x7'));var controller=require('./user.controller');router[_0xffdb('0x8')]('/',auth[_0xffdb('0x9')](),controller[_0xffdb('0xa')]);router[_0xffdb('0x8')](_0xffdb('0xb'),auth[_0xffdb('0x9')](),controller[_0xffdb('0xc')]);router[_0xffdb('0x8')](_0xffdb('0xd'),auth[_0xffdb('0x9')](),controller[_0xffdb('0xe')]);router[_0xffdb('0x8')](_0xffdb('0xf'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x10')]);router[_0xffdb('0x8')]('/:id',auth[_0xffdb('0x9')](),controller[_0xffdb('0x11')]);router['get']('/:id/avatar',controller[_0xffdb('0x12')]);router['get']('/:id/open_tabs',auth[_0xffdb('0x9')](),controller[_0xffdb('0x13')]);router[_0xffdb('0x8')](_0xffdb('0x14'),auth['isAuthenticated'](),controller['getContacts']);router[_0xffdb('0x8')](_0xffdb('0x15'),auth['isAuthenticated'](),controller[_0xffdb('0x16')]);router[_0xffdb('0x8')](_0xffdb('0x17'),auth[_0xffdb('0x9')](),controller['getVoiceQueuesRt']);router[_0xffdb('0x8')]('/:id/groups',auth['isAuthenticated'](),controller[_0xffdb('0x18')]);router['get'](_0xffdb('0x19'),auth[_0xffdb('0x9')](),controller['getRecordings']);router['get'](_0xffdb('0x1a'),auth[_0xffdb('0x9')](),controller['getScreenRecordings']);router['get']('/:id/chat/interactions',auth[_0xffdb('0x9')](),controller[_0xffdb('0x1b')]);router[_0xffdb('0x8')](_0xffdb('0x1c'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x1d')]);router[_0xffdb('0x8')]('/:id/mail/interactions',auth['isAuthenticated'](),controller['getMailInteractions']);router['get'](_0xffdb('0x1e'),auth['isAuthenticated'](),controller[_0xffdb('0x1f')]);router[_0xffdb('0x8')](_0xffdb('0x20'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x21')]);router[_0xffdb('0x8')]('/:id/whatsapp/interactions',auth[_0xffdb('0x9')](),controller[_0xffdb('0x22')]);router['get'](_0xffdb('0x23'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x24')]);router['get'](_0xffdb('0x25'),auth['isAuthenticated'](),controller[_0xffdb('0x26')]);router[_0xffdb('0x8')](_0xffdb('0x27'),auth['isAuthenticated'](),controller[_0xffdb('0x28')]);router[_0xffdb('0x8')](_0xffdb('0x29'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x2a')]);router[_0xffdb('0x8')](_0xffdb('0x2b'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x2c')]);router[_0xffdb('0x8')](_0xffdb('0x2d'),auth['isAuthenticated'](),controller['getMailAccounts']);router['get']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0xffdb('0x2e'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x2f')]);router[_0xffdb('0x8')](_0xffdb('0x30'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x31')]);router[_0xffdb('0x8')](_0xffdb('0x32'),auth['isAuthenticated'](),controller[_0xffdb('0x33')]);router[_0xffdb('0x8')](_0xffdb('0x34'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x35')]);router['get'](_0xffdb('0x36'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x37')]);router[_0xffdb('0x38')](_0xffdb('0x14'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x39')]);router['post']('/',auth['isAuthenticated'](),controller[_0xffdb('0x3a')]);router[_0xffdb('0x38')](_0xffdb('0x3b'),auth['isAuthenticated'](),controller[_0xffdb('0x3c')]);router[_0xffdb('0x38')](_0xffdb('0x15'),auth[_0xffdb('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0xffdb('0x3d')]({'destination':function(_0x4785b8,_0x4c2731,_0x4b6d9d){_0x4b6d9d(null,path['join'](config[_0xffdb('0x3e')],_0xffdb('0x3f')));},'filename':function(_0x52569b,_0x191285,_0x4d3c22){_0x4d3c22(null,util[_0xffdb('0x40')](_0xffdb('0x41'),Date[_0xffdb('0x42')](),_0x191285[_0xffdb('0x43')]));}})});router[_0xffdb('0x38')](_0xffdb('0x44'),upload['single'](_0xffdb('0x45')),controller[_0xffdb('0x46')]);router[_0xffdb('0x38')]('/:id/login',auth[_0xffdb('0x9')](),controller[_0xffdb('0x47')]);router['post']('/:id/logout',auth[_0xffdb('0x9')](),controller[_0xffdb('0x48')]);router[_0xffdb('0x38')](_0xffdb('0x49'),auth[_0xffdb('0x9')](),controller['pause']);router['post'](_0xffdb('0x4a'),auth[_0xffdb('0x9')](),controller['unpause']);router[_0xffdb('0x38')]('/:id/teams',auth[_0xffdb('0x9')](),controller['addTeams']);router['post'](_0xffdb('0x4b'),auth['isAuthenticated'](),controller[_0xffdb('0x4c')]);router[_0xffdb('0x38')]('/:id/mail_interactions',auth[_0xffdb('0x9')](),controller[_0xffdb('0x4d')]);router[_0xffdb('0x38')]('/:id/fax_interactions',auth[_0xffdb('0x9')](),controller[_0xffdb('0x4e')]);router[_0xffdb('0x38')](_0xffdb('0x4f'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x50')]);router[_0xffdb('0x38')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xffdb('0x51')]);router[_0xffdb('0x38')](_0xffdb('0x52'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x53')]);router[_0xffdb('0x38')](_0xffdb('0x2b'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x54')]);router['post'](_0xffdb('0x2d'),auth['isAuthenticated'](),controller[_0xffdb('0x55')]);router['post'](_0xffdb('0x56'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router['post']('/:id/sms_accounts',auth[_0xffdb('0x9')](),controller[_0xffdb('0x57')]);router['post'](_0xffdb('0x30'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x58')]);router[_0xffdb('0x38')](_0xffdb('0x32'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x59')]);router[_0xffdb('0x38')](_0xffdb('0x36'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x5a')]);router[_0xffdb('0x5b')](_0xffdb('0x5c'),auth[_0xffdb('0x9')](),controller['update']);router['put'](_0xffdb('0x5d'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x5e')]);router[_0xffdb('0x5f')]('/:id/queues',auth[_0xffdb('0x9')](),controller[_0xffdb('0x60')]);router[_0xffdb('0x5f')]('/:id/teams',auth[_0xffdb('0x9')](),controller[_0xffdb('0x61')]);router[_0xffdb('0x5f')](_0xffdb('0x5c'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x62')]);router['delete']('/:id/chat_interactions',auth[_0xffdb('0x9')](),controller[_0xffdb('0x63')]);router['delete'](_0xffdb('0x64'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x65')]);router[_0xffdb('0x5f')](_0xffdb('0x66'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x67')]);router[_0xffdb('0x5f')](_0xffdb('0x4f'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x68')]);router[_0xffdb('0x5f')](_0xffdb('0x69'),auth['isAuthenticated'](),controller[_0xffdb('0x6a')]);router[_0xffdb('0x5f')](_0xffdb('0x52'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x6b')]);router[_0xffdb('0x5f')](_0xffdb('0x2b'),auth[_0xffdb('0x9')](),controller['removeFaxAccounts']);router[_0xffdb('0x5f')](_0xffdb('0x2d'),auth['isAuthenticated'](),controller[_0xffdb('0x6c')]);router[_0xffdb('0x5f')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xffdb('0x5f')](_0xffdb('0x2e'),auth[_0xffdb('0x9')](),controller['removeSmsAccounts']);router[_0xffdb('0x5f')](_0xffdb('0x30'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x6d')]);router[_0xffdb('0x5f')](_0xffdb('0x32'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x6e')]);router['delete'](_0xffdb('0x36'),auth['isAuthenticated'](),controller[_0xffdb('0x6f')]);router['post'](_0xffdb('0x70'),auth[_0xffdb('0x9')](),controller[_0xffdb('0x71')]);module[_0xffdb('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 41dad45..b61b5d9 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 _0xc91e=['refuse','originate','uas','fingerprint','certificate','active','passive','update,nonat','TEXT','showWebBar','get','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','actpass','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','local','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','insecure','always','accept'];(function(_0x536f11,_0x1e921c){var _0xe15654=function(_0x386dd6){while(--_0x386dd6){_0x536f11['push'](_0x536f11['shift']());}};_0xe15654(++_0x1e921c);}(_0xc91e,0x74));var _0xec91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc91e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xec91('0x0'));var moment=require('moment');var util=require(_0xec91('0x1'));var _=require(_0xec91('0x2'));module[_0xec91('0x3')]={'name':{'type':Sequelize[_0xec91('0x4')],'allowNull':![],'unique':_0xec91('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x135dc2){this['setDataValue'](_0xec91('0x5'),_0x135dc2);this[_0xec91('0x6')](_0xec91('0x7'),_0x135dc2);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xec91('0x4')],'allowNull':![],'set':function(_0x46abd6){this[_0xec91('0x6')](_0xec91('0x8'),_0x46abd6);this[_0xec91('0x6')](_0xec91('0x9'),util['format'](_0xec91('0xa'),_0x46abd6,this[_0xec91('0xb')](_0xec91('0xc'))));}},'alias':{'type':Sequelize[_0xec91('0x4')]},'email':{'type':Sequelize[_0xec91('0x4')],'allowNull':![],'unique':_0xec91('0xd'),'validate':{'isEmail':!![]},'set':function(_0x48e78e){if(_0x48e78e){this[_0xec91('0x6')](_0xec91('0xd'),_0x48e78e[_0xec91('0xe')]());}}},'role':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x10'),_0xec91('0x11'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xec91('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xec91('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xec91('0xc'),'set':function(_0x48cd94){this[_0xec91('0x6')](_0xec91('0xc'),_0x48cd94);this[_0xec91('0x6')](_0xec91('0x13'),_0x48cd94);this[_0xec91('0x6')](_0xec91('0x9'),util['format'](_0xec91('0xa'),this[_0xec91('0xb')](_0xec91('0x8')),_0x48cd94));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xec91('0x4')]},'mobile':{'type':Sequelize[_0xec91('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xec91('0x4')]},'userpic':{'type':Sequelize[_0xec91('0x4')]},'city':{'type':Sequelize[_0xec91('0x4')]},'country':{'type':Sequelize[_0xec91('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xec91('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xec91('0x4')],'defaultValue':_0xec91('0x16')},'lastPauseAt':{'type':Sequelize[_0xec91('0x14')]},'chatCapacity':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xec91('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xec91('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![],'defaultValue':_0xec91('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xec91('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x19'),'user',_0xec91('0x1a')),'allowNull':!![],'defaultValue':_0xec91('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xec91('0x1b')},'callingpres':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x1c'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED',_0xec91('0x1d'),_0xec91('0x1e'),_0xec91('0x1f'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![],'defaultValue':_0xec91('0x20'),'set':function(_0x434bf7){this[_0xec91('0x6')](_0xec91('0x21'),_0x434bf7?_0x434bf7[_0xec91('0x22')](','):null);},'get':function(){return this['getDataValue'](_0xec91('0x21'))?this[_0xec91('0xb')](_0xec91('0x21'))[_0xec91('0x23')](','):null;},'comment':_0xec91('0x24')},'dtmfmode':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x25'),'info','shortinfo',_0xec91('0x26'),_0xec91('0x27')),'allowNull':!![],'defaultValue':_0xec91('0x25')},'directmedia':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no',_0xec91('0x29'),_0xec91('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x4b78c2){this[_0xec91('0x6')](_0xec91('0x2b'),_0x4b78c2?_0x4b78c2['join'](','):null);},'get':function(){return this[_0xec91('0xb')](_0xec91('0x2b'))?this[_0xec91('0xb')](_0xec91('0x2b'))['split'](','):null;},'comment':_0xec91('0x2c')},'callgroup':{'type':Sequelize[_0xec91('0x4')]},'namedcallgroup':{'type':Sequelize[_0xec91('0x4')]},'pickupgroup':{'type':Sequelize[_0xec91('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xec91('0x4')]},'language':{'type':Sequelize[_0xec91('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xec91('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xec91('0x2d')},'allow':{'type':Sequelize[_0xec91('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x45687a){this['setDataValue'](_0xec91('0x2e'),_0x45687a?_0x45687a[_0xec91('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xec91('0xb')](_0xec91('0x2e'))?this[_0xec91('0xb')](_0xec91('0x2e'))[_0xec91('0x23')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![],'set':function(_0x2359fb){this['setDataValue']('insecure',_0x2359fb?_0x2359fb[_0xec91('0x22')](','):null);},'get':function(){return this[_0xec91('0xb')](_0xec91('0x2f'))?this[_0xec91('0xb')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xec91('0x30')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x31'),_0xec91('0x32'),_0xec91('0x33')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xec91('0x34')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':_0xec91('0x28')},'keepalive':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xec91('0xf')]('yes','no',_0xec91('0x35'),_0xec91('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x37'),_0xec91('0x38'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xec91('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xec91('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xec91('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xec91('0xf')]('yes','no',_0xec91('0x29'),_0xec91('0x2a'),_0xec91('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xec91('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xec91('0x14')]},'passwordResetAt':{'type':Sequelize[_0xec91('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xec91('0x3a')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x1a8dc7){this[_0xec91('0x6')](_0xec91('0x3b'),_0x1a8dc7);var _0x19adb0=this[_0xec91('0x3c')]({'plain':!![]});switch(_0x1a8dc7){case 0x0:case 0x1:var _0x4c3542=_0x19adb0[_0xec91('0x21')]?_['isArray'](_0x19adb0[_0xec91('0x21')])?_0x19adb0[_0xec91('0x21')][_0xec91('0x22')]():_0x19adb0['transport']:_0xec91('0x20');if(_0x4c3542===_0xec91('0x3d')){_0x4c3542='udp';}this[_0xec91('0x6')]('transport',_0x4c3542);this[_0xec91('0x6')](_0xec91('0x3e'),'no');this[_0xec91('0x6')](_0xec91('0x3f'),null);this[_0xec91('0x6')]('force_avp',null);this['setDataValue'](_0xec91('0x40'),null);this[_0xec91('0x6')](_0xec91('0x41'),null);this['setDataValue'](_0xec91('0x42'),null);this[_0xec91('0x6')](_0xec91('0x43'),null);this[_0xec91('0x6')](_0xec91('0x44'),null);this[_0xec91('0x6')](_0xec91('0x45'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xec91('0x6')](_0xec91('0x21'),_0xec91('0x3d'));this[_0xec91('0x6')](_0xec91('0x3e'),_0xec91('0x28'));this[_0xec91('0x6')](_0xec91('0x3f'),_0xec91('0x28'));this['setDataValue']('force_avp',_0xec91('0x28'));this[_0xec91('0x6')](_0xec91('0x40'),_0xec91('0x28'));this[_0xec91('0x6')](_0xec91('0x41'),'yes');this['setDataValue']('dtlsverify','no');this[_0xec91('0x6')]('dtlssetup',_0xec91('0x46'));this[_0xec91('0x6')](_0xec91('0x44'),_0x19adb0[_0xec91('0x44')]||_0xec91('0x47'));this[_0xec91('0x6')](_0xec91('0x45'),_0x19adb0[_0xec91('0x45')]||_0xec91('0x48'));this[_0xec91('0x6')](_0xec91('0x49'),_0xec91('0x28'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x4f31ca){this['setDataValue'](_0xec91('0x4a'),_0x4f31ca?_0x4f31ca[_0xec91('0x22')](','):[]);},'get':function(){return this[_0xec91('0xb')](_0xec91('0x4a'))?_[_0xec91('0x4b')](this[_0xec91('0xb')]('permissions')['split'](','),function(_0x107738){return parseInt(_0x107738,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xec91('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xec91('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xec91('0xf')](_0xec91('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xec91('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xec91('0x4c'))?this['getDataValue'](_0xec91('0x4c')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xec91('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xec91('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![],'set':function(_0x158d94){if(typeof _0x158d94==='string'){var _0x2527fd=_0x158d94==='1'?!![]:_0x158d94==='0'?![]:_0x158d94===_0xec91('0x4d')?!![]:_0x158d94===_0xec91('0x4e')?![]:![];this['setDataValue'](_0xec91('0x4f'),_0x2527fd);}else{this['setDataValue'](_0xec91('0x4f'),_0x158d94);}}},'blocked':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![],'set':function(_0x155e93){this['setDataValue'](_0xec91('0x50'),_0x155e93);if(_0x155e93===!![]){this[_0xec91('0x6')](_0xec91('0x51'),moment());this[_0xec91('0x6')](_0xec91('0x52'),0x0);}else{this[_0xec91('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xec91('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xec91('0x17')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xec91('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xec91('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xec91('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x2258=['dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','active','actpass','update,nonat','DATE','TEXT','isArray','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','encryption','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','lodash','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','local','accountcode','callerid','getDataValue','BOOLEAN','DEFAULT\x20PAUSE','INTEGER'];(function(_0x3f88b9,_0x212f54){var _0x49f57b=function(_0xde0bb2){while(--_0xde0bb2){_0x3f88b9['push'](_0x3f88b9['shift']());}};_0x49f57b(++_0x212f54);}(_0x2258,0xfe));var _0x8225=function(_0x4f7f74,_0x23df79){_0x4f7f74=_0x4f7f74-0x0;var _0x425467=_0x2258[_0x4f7f74];return _0x425467;};'use strict';var Sequelize=require(_0x8225('0x0'));var moment=require('moment');var util=require(_0x8225('0x1'));var _=require(_0x8225('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x503c21){this[_0x8225('0x3')](_0x8225('0x4'),_0x503c21);this[_0x8225('0x3')](_0x8225('0x5'),_0x503c21);},'comment':_0x8225('0x6')},'fullname':{'type':Sequelize[_0x8225('0x7')],'allowNull':![],'set':function(_0x44ecb8){this['setDataValue'](_0x8225('0x8'),_0x44ecb8);this[_0x8225('0x3')]('callerid',util[_0x8225('0x9')](_0x8225('0xa'),_0x44ecb8,this['getDataValue'](_0x8225('0xb'))));}},'alias':{'type':Sequelize[_0x8225('0x7')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8225('0xc'),'validate':{'isEmail':!![]},'set':function(_0x485b46){if(_0x485b46){this[_0x8225('0x3')](_0x8225('0xc'),_0x485b46[_0x8225('0xd')]());}}},'role':{'type':Sequelize[_0x8225('0xe')](_0x8225('0xf'),_0x8225('0x10'),_0x8225('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x8225('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x8225('0x7')],'defaultValue':_0x8225('0x12')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x8225('0xb'),'set':function(_0x17c04a){this[_0x8225('0x3')](_0x8225('0xb'),_0x17c04a);this[_0x8225('0x3')](_0x8225('0x13'),_0x17c04a);this[_0x8225('0x3')](_0x8225('0x14'),util[_0x8225('0x9')](_0x8225('0xa'),this[_0x8225('0x15')]('fullname'),_0x17c04a));}},'salt':{'type':Sequelize[_0x8225('0x7')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x8225('0x7')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x8225('0x7')]},'city':{'type':Sequelize[_0x8225('0x7')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x8225('0x7')],'defaultValue':_0x8225('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x8225('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'defaultValue':_0x8225('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x8225('0x1a'),'user',_0x8225('0x1b')),'allowNull':!![],'defaultValue':_0x8225('0x1a')},'context':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'defaultValue':_0x8225('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x8225('0x1d'),_0x8225('0x1e'),_0x8225('0x1f'),_0x8225('0x20'),_0x8225('0x21'),_0x8225('0x22'),_0x8225('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'defaultValue':_0x8225('0x24'),'set':function(_0x59c023){this[_0x8225('0x3')]('transport',_0x59c023?_0x59c023[_0x8225('0x25')](','):null);},'get':function(){return this[_0x8225('0x15')](_0x8225('0x26'))?this[_0x8225('0x15')]('transport')[_0x8225('0x27')](','):null;},'comment':_0x8225('0x28')},'dtmfmode':{'type':Sequelize[_0x8225('0xe')]('rfc2833',_0x8225('0x29'),_0x8225('0x2a'),'inband',_0x8225('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no',_0x8225('0x2d'),_0x8225('0x2e'),_0x8225('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'defaultValue':_0x8225('0x30'),'set':function(_0x47bd05){this[_0x8225('0x3')]('nat',_0x47bd05?_0x47bd05[_0x8225('0x25')](','):null);},'get':function(){return this['getDataValue'](_0x8225('0x31'))?this[_0x8225('0x15')](_0x8225('0x31'))[_0x8225('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x8225('0x7')]},'namedcallgroup':{'type':Sequelize[_0x8225('0x7')]},'pickupgroup':{'type':Sequelize[_0x8225('0x7')]},'namedpickupgroup':{'type':Sequelize[_0x8225('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8225('0x7')]},'disallow':{'type':Sequelize[_0x8225('0x7')],'allowNull':![],'defaultValue':_0x8225('0x32')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8225('0x33'),'set':function(_0x4210fb){this[_0x8225('0x3')](_0x8225('0x34'),_0x4210fb?_0x4210fb[_0x8225('0x25')](';'):_0x8225('0x33'));},'get':function(){return this['getDataValue'](_0x8225('0x34'))?this[_0x8225('0x15')]('allow')[_0x8225('0x27')](';'):null;},'comment':_0x8225('0x35')},'autoframing':{'type':Sequelize['ENUM'](_0x8225('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'set':function(_0x46d3d0){this[_0x8225('0x3')](_0x8225('0x36'),_0x46d3d0?_0x46d3d0[_0x8225('0x25')](','):null);},'get':function(){return this[_0x8225('0x15')](_0x8225('0x36'))?this[_0x8225('0x15')](_0x8225('0x36'))[_0x8225('0x27')](','):null;},'comment':_0x8225('0x37')},'trustrpid':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8225('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no',_0x8225('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x8225('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![],'defaultValue':_0x8225('0x39')},'amaflags':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x8225('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x8225('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no',_0x8225('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x3b'),_0x8225('0x3c'),_0x8225('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x3e'),_0x8225('0x3f')),'allowNull':!![],'defaultValue':_0x8225('0x3f')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x8225('0x2c')},'keepalive':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x8225('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x8225('0xe')]('yes','no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x8225('0x40'),'passive',_0x8225('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x8225('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x8225('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x8225('0xe')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x8225('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x8225('0xe')](_0x8225('0x2c'),'no',_0x8225('0x2d'),_0x8225('0x2e'),_0x8225('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x8225('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0x8225('0x43')]},'passwordResetAt':{'type':Sequelize[_0x8225('0x43')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x8225('0x44')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x5f2bfe){this[_0x8225('0x3')]('showWebBar',_0x5f2bfe);var _0x2b738b=this['get']({'plain':!![]});switch(_0x5f2bfe){case 0x0:case 0x1:var _0x297e1a=_0x2b738b[_0x8225('0x26')]?_[_0x8225('0x45')](_0x2b738b[_0x8225('0x26')])?_0x2b738b[_0x8225('0x26')][_0x8225('0x25')]():_0x2b738b[_0x8225('0x26')]:_0x8225('0x24');if(_0x297e1a==='wss'){_0x297e1a=_0x8225('0x24');}this[_0x8225('0x3')](_0x8225('0x26'),_0x297e1a);this[_0x8225('0x3')]('encryption','no');this[_0x8225('0x3')](_0x8225('0x46'),null);this[_0x8225('0x3')](_0x8225('0x47'),null);this[_0x8225('0x3')](_0x8225('0x48'),null);this[_0x8225('0x3')](_0x8225('0x49'),null);this[_0x8225('0x3')](_0x8225('0x4a'),null);this['setDataValue'](_0x8225('0x4b'),null);this['setDataValue'](_0x8225('0x4c'),null);this['setDataValue'](_0x8225('0x4d'),null);this[_0x8225('0x3')](_0x8225('0x4e'),'no');break;case 0x2:this[_0x8225('0x3')]('transport',_0x8225('0x4f'));this[_0x8225('0x3')](_0x8225('0x50'),'yes');this[_0x8225('0x3')](_0x8225('0x46'),_0x8225('0x2c'));this[_0x8225('0x3')](_0x8225('0x47'),'yes');this[_0x8225('0x3')](_0x8225('0x48'),_0x8225('0x2c'));this[_0x8225('0x3')]('dtlsenable',_0x8225('0x2c'));this[_0x8225('0x3')]('dtlsverify','no');this[_0x8225('0x3')](_0x8225('0x4b'),_0x8225('0x41'));this['setDataValue'](_0x8225('0x4c'),_0x2b738b[_0x8225('0x4c')]||_0x8225('0x51'));this[_0x8225('0x3')](_0x8225('0x4d'),_0x2b738b[_0x8225('0x4d')]||_0x8225('0x52'));this['setDataValue'](_0x8225('0x4e'),_0x8225('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x8225('0x44')],'set':function(_0x3ca9b4){this['setDataValue'](_0x8225('0x53'),_0x3ca9b4?_0x3ca9b4[_0x8225('0x25')](','):[]);},'get':function(){return this[_0x8225('0x15')]('permissions')?_[_0x8225('0x54')](this[_0x8225('0x15')](_0x8225('0x53'))[_0x8225('0x27')](','),function(_0x23ea56){return parseInt(_0x23ea56,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x8225('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0x8225('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8225('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x8225('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x8225('0x7')]},'phoneBarEnableJaws':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x8225('0x55')],'get':function(){return this[_0x8225('0x15')](_0x8225('0x56'))?this[_0x8225('0x15')](_0x8225('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x125627){if(typeof _0x125627===_0x8225('0x57')){var _0x21d1e7=_0x125627==='1'?!![]:_0x125627==='0'?![]:_0x125627===_0x8225('0x58')?!![]:_0x125627==='false'?![]:![];this[_0x8225('0x3')](_0x8225('0x59'),_0x21d1e7);}else{this[_0x8225('0x3')](_0x8225('0x59'),_0x125627);}}},'blocked':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![],'set':function(_0xba31c7){this[_0x8225('0x3')](_0x8225('0x5a'),_0xba31c7);if(_0xba31c7===!![]){this[_0x8225('0x3')](_0x8225('0x5b'),moment());this[_0x8225('0x3')](_0x8225('0x5c'),0x0);}else{this[_0x8225('0x3')](_0x8225('0x5b'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x8225('0x18')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8225('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x8225('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x8225('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 23c0d6f..b198fcb 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 _0xf071=['Team','getAssociatedQueues','flattenDeep','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getDataValue','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$iLike','$notILike','$contains','$contained','$any','firstName','lastName','phone','CmContact','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','ringing','teams','queues','inbound','flatten','toString','lower','col','asc','desc','substring','uniqBy','getRealtimeAgents','offline','pause','voiceStatus','unavailable','busy','slice','toUpperCase','QueryTypes','select','field','ui.','InteractionId','ui.createdAt','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','enabled','moment','util','path','lodash','squel','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','emit','userNotification:recalc:','destroy','get','role','admin','user','Agents','Telephones','telephone','map','value','includes','find','name','UserProfileResource','error','stack','send','rawAttributes','fieldName','type','key','filter','password','salt','previousPasswords','resetPasswordExpires','md5secret','index','getOptions','includeAll','include','query','userSetting','true','UserSetting','attributes','push','User','findAll','openTabs','chat','rows','dataValues','sms','fax','mail','openchannel','whatsapp','all','catch','params','merge','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)','SELECT','length','from','voicemail','mailbox','email','permissions','103','113','110','104','105','106','107','108','109','100','111','114','115','create','agent','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','validatePasswordHistory','passwordHistoryLimit','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','capitalize','toLowerCase','Queues','QueueId','Queue:save','voice','VoiceQueue','SIP/%s','penalty','UserVoiceQueueRt','removeQueues','remove','isArray','Queue:remove','addAvatar','userpic','filename','getAvatar','join','server/files/images/logos/default_profile.png','existsSync','server/files/images/','download','root','ChatOpenTabs','createdAt','FAX','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','concat','getContacts','findOne','format','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tag','Tags','color','tag','getQueues','Unknown\x20channel','model','keys','Queue','filters','intersection','fields','order','sort','where','options','getVoiceQueuesRt','pick','nolimit','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','remoteAddress','socket','connection','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','isMiddleware','resolve','logout','forEach','PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xf071,0x7d));var _0x1f07=function(_0x3ded7d,_0x1813c6){_0x3ded7d=_0x3ded7d-0x0;var _0x182b9e=_0xf071[_0x3ded7d];return _0x182b9e;};'use strict';var moment=require(_0x1f07('0x0'));var util=require(_0x1f07('0x1'));var path=require(_0x1f07('0x2'));var fs=require('fs');var _=require(_0x1f07('0x3'));var squel=require(_0x1f07('0x4'));var Redis=require(_0x1f07('0x5'));var authService=require(_0x1f07('0x6'));var contacts=require(_0x1f07('0x7'));var qs=require(_0x1f07('0x8'));var rta=require(_0x1f07('0x9'));var logger=require(_0x1f07('0xa'))(_0x1f07('0xb'));var utils=require(_0x1f07('0xc'));var config=require(_0x1f07('0xd'));var licenseUtil=require(_0x1f07('0xe'));var APIBadRequestError=require(_0x1f07('0xf'))[_0x1f07('0x10')];var APINotFoundError=require(_0x1f07('0xf'))[_0x1f07('0x11')];var APIHandleError=require(_0x1f07('0xf'))[_0x1f07('0x12')];var db=require(_0x1f07('0x13'))['db'];var socket=require(_0x1f07('0x14'))(new Redis(config[_0x1f07('0x15')]));require('./user.socket')[_0x1f07('0x16')](socket);config['redis']=_[_0x1f07('0x17')](config[_0x1f07('0x15')],{'host':'localhost','port':0x18eb});var values;function respondWithStatusCode(_0x558660,_0x391f20){_0x391f20=_0x391f20||0xcc;return function(_0x14fdb3){if(_0x14fdb3){return _0x558660[_0x1f07('0x18')](_0x391f20);}return _0x558660[_0x1f07('0x19')](_0x391f20)[_0x1f07('0x1a')]();};}function respondWithResult(_0x3844c0,_0x260705){_0x260705=_0x260705||0xc8;return function(_0x3f5a83){if(_0x3f5a83){return _0x3844c0[_0x1f07('0x19')](_0x260705)[_0x1f07('0x1b')](_0x3f5a83);}};}function respondWithFilteredResult(_0x88d61f,_0x5f3bbf){return function(_0x2b447c){if(_0x2b447c){var _0x14d842=typeof _0x5f3bbf[_0x1f07('0x1c')]===_0x1f07('0x1d')&&typeof _0x5f3bbf[_0x1f07('0x1e')]===_0x1f07('0x1d');var _0x1ca0f2=_0x2b447c[_0x1f07('0x1f')];var _0x102a1a=_0x14d842?0x0:_0x5f3bbf[_0x1f07('0x1c')];var _0x117af9=_0x14d842?_0x2b447c[_0x1f07('0x1f')]:_0x5f3bbf[_0x1f07('0x1c')]+_0x5f3bbf['limit'];var _0x132a28;if(_0x117af9>=_0x1ca0f2){_0x117af9=_0x1ca0f2;_0x132a28=0xc8;}else{_0x132a28=0xce;}_0x88d61f[_0x1f07('0x19')](_0x132a28);return _0x88d61f[_0x1f07('0x20')]('Content-Range',_0x102a1a+'-'+_0x117af9+'/'+_0x1ca0f2)[_0x1f07('0x1b')](_0x2b447c);}return null;};}function saveUpdates(_0x50a994){return function(_0x2d6a9d){if(_0x2d6a9d){return _0x2d6a9d[_0x1f07('0x21')](_0x50a994)[_0x1f07('0x22')](function(_0x1940d0){if(_0x1940d0['role']==='agent'){socket[_0x1f07('0x23')](_0x1f07('0x24')+_0x1940d0['id'],_0x1940d0);}return _0x1940d0;});}return null;};}function removeEntity(_0x1aefaa){return function(_0xa7a533){if(_0xa7a533){return _0xa7a533[_0x1f07('0x25')]()['then'](function(){var _0x3c6719=_0xa7a533[_0x1f07('0x26')]({'plain':!![]});if(_0x3c6719[_0x1f07('0x27')]===_0x1f07('0x28'))return;var _0x51d2ef=[{'name':'Users','value':_0x1f07('0x29'),'ignore':!![]},{'name':_0x1f07('0x2a'),'value':'agent','ignore':![]},{'name':_0x1f07('0x2b'),'value':_0x1f07('0x2c'),'ignore':![]}];var _0x197e9f=_(_0x51d2ef)['filter']('ignore')[_0x1f07('0x2d')](_0x1f07('0x2e'))['value']();if(_[_0x1f07('0x2f')](_0x197e9f,_0x3c6719[_0x1f07('0x27')])){return;}var _0x38896e=_[_0x1f07('0x30')](_0x51d2ef,[_0x1f07('0x2e'),_0x3c6719['role']])[_0x1f07('0x31')];return db[_0x1f07('0x32')][_0x1f07('0x25')]({'where':{'type':_0x38896e,'resourceId':_0x3c6719['id']}})[_0x1f07('0x22')](function(){return _0xa7a533;});})[_0x1f07('0x22')](function(){_0x1aefaa['status'](0xcc)[_0x1f07('0x1a')]();});}};}function handleEntityNotFound(_0xeff084){return function(_0x386368){if(!_0x386368){_0xeff084[_0x1f07('0x18')](0x194);}return _0x386368;};}function handleError(_0x4f1eb6,_0x3eabec){_0x3eabec=_0x3eabec||0x1f4;return function(_0xd31224){logger[_0x1f07('0x33')](_0xd31224[_0x1f07('0x34')]);if(_0xd31224['name']){delete _0xd31224['name'];}_0x4f1eb6[_0x1f07('0x19')](_0x3eabec)[_0x1f07('0x35')](_0xd31224);};}function getUserAttributes(){return _(db['User'][_0x1f07('0x36')])[_0x1f07('0x2d')](function(_0x25e0bf){return{'name':_0x25e0bf[_0x1f07('0x37')],'type':_0x25e0bf[_0x1f07('0x38')][_0x1f07('0x39')]};})[_0x1f07('0x3a')](function(_0x1d6b40){return![_0x1f07('0x3b'),_0x1f07('0x3c'),_0x1f07('0x3d'),'resetPasswordToken',_0x1f07('0x3e'),_0x1f07('0x3f')][_0x1f07('0x2f')](_0x1d6b40[_0x1f07('0x31')]);})[_0x1f07('0x2e')]();}exports[_0x1f07('0x40')]=function(_0x295962,_0x10c615){var _0x10789c={},_0x4b2389={'count':0x0,'rows':[]};var _0x5c88cc=getUserAttributes();_0x10789c=qs[_0x1f07('0x41')](_0x5c88cc,_0x295962);var _0x2492e9={'where':_0x10789c['where']};return db['User'][_0x1f07('0x1f')](_0x2492e9)['then'](function(_0x3f5bfb){_0x4b2389[_0x1f07('0x1f')]=_0x3f5bfb;if(_0x295962['query'][_0x1f07('0x42')]){_0x10789c[_0x1f07('0x43')]=[{'all':!![]}];}if(_0x295962[_0x1f07('0x44')][_0x1f07('0x45')]===_0x1f07('0x46')){_0x10789c[_0x1f07('0x43')]=[{'model':db[_0x1f07('0x47')],'as':'userSetting'}];}if(!_[_0x1f07('0x2f')](_0x10789c[_0x1f07('0x48')],'id')){_0x10789c[_0x1f07('0x48')][_0x1f07('0x49')]('id');}return db[_0x1f07('0x4a')][_0x1f07('0x4b')](_0x10789c);})['then'](function(_0x4487b1){_0x4b2389['rows']=_0x4487b1;if(_0x295962[_0x1f07('0x44')][_0x1f07('0x4c')]===_0x1f07('0x46')){var _0x318b53=[];for(var _0x1ad687=0x0;_0x1ad687<_0x4b2389['rows']['length'];_0x1ad687++){_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x4d'),_0x4b2389[_0x1f07('0x4e')][_0x1ad687][_0x1f07('0x4f')]));_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x50'),_0x4b2389['rows'][_0x1ad687][_0x1f07('0x4f')]));_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x51'),_0x4b2389[_0x1f07('0x4e')][_0x1ad687][_0x1f07('0x4f')]));_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x52'),_0x4b2389[_0x1f07('0x4e')][_0x1ad687][_0x1f07('0x4f')]));_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x53'),_0x4b2389[_0x1f07('0x4e')][_0x1ad687]['dataValues']));_0x318b53[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x54'),_0x4b2389['rows'][_0x1ad687][_0x1f07('0x4f')]));}return Promise[_0x1f07('0x55')](_0x318b53)['then'](function(){return _0x4b2389;});}else{return _0x4b2389;}})['then'](respondWithFilteredResult(_0x10c615,_0x10789c))[_0x1f07('0x56')](handleError(_0x10c615,null));};exports['show']=function(_0x84b0af,_0x1abbc3){var _0x23ea3a=getUserAttributes();_0x84b0af[_0x1f07('0x44')]['id']=_0x84b0af[_0x1f07('0x57')]['id'];var _0x132ca=qs[_0x1f07('0x41')](_0x23ea3a,_0x84b0af);if(_0x84b0af[_0x1f07('0x44')][_0x1f07('0x42')]){_0x132ca['include']=[{'all':!![]}];}if(_0x84b0af['query'][_0x1f07('0x45')]==='true'){_0x132ca[_0x1f07('0x43')]=[{'model':db[_0x1f07('0x47')],'as':_0x1f07('0x45')}];}_0x132ca=_[_0x1f07('0x58')]({},_0x132ca,_0x84b0af['options']);if(!_[_0x1f07('0x2f')](_0x132ca[_0x1f07('0x48')],'id')){_0x132ca[_0x1f07('0x48')][_0x1f07('0x49')]('id');}return db['User'][_0x1f07('0x30')](_0x132ca)['then'](handleEntityNotFound(_0x1abbc3,null))[_0x1f07('0x22')](function(_0x2faad8){var _0x4fd237=[];values=_0x2faad8;if(_0x84b0af[_0x1f07('0x44')][_0x1f07('0x4c')]===_0x1f07('0x46')){_0x4fd237[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x4d'),_0x2faad8[_0x1f07('0x4f')]));_0x4fd237[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x50'),_0x2faad8[_0x1f07('0x4f')]));_0x4fd237['push'](get_open_tabs(_0x1f07('0x53'),_0x2faad8['dataValues']));_0x4fd237[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x54'),_0x2faad8[_0x1f07('0x4f')]));_0x4fd237[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x51'),_0x2faad8[_0x1f07('0x4f')]));_0x4fd237[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x52'),_0x2faad8[_0x1f07('0x4f')]));return Promise[_0x1f07('0x55')](_0x4fd237);}else{return values;}})[_0x1f07('0x22')](function(){return values;})[_0x1f07('0x22')](respondWithResult(_0x1abbc3,null))['catch'](handleError(_0x1abbc3,null));};exports['update']=function(_0x46025a,_0x5e90fa){if(_0x46025a[_0x1f07('0x59')]['id']){delete _0x46025a[_0x1f07('0x59')]['id'];}delete _0x46025a['body'][_0x1f07('0x27')];return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0x46025a[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x5e90fa,null))[_0x1f07('0x22')](saveUpdates(_0x46025a['body'],null))[_0x1f07('0x22')](respondWithResult(_0x5e90fa,null))[_0x1f07('0x56')](handleError(_0x5e90fa,null));};exports[_0x1f07('0x5a')]=function(_0x39f7f5,_0x4048de){return db[_0x1f07('0x4a')][_0x1f07('0x5a')]()[_0x1f07('0x22')](respondWithResult(_0x4048de,null))['catch'](handleError(_0x4048de,null));};exports[_0x1f07('0x5b')]=function(_0x47f56d,_0x641944){return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0x47f56d['params']['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x641944,null))[_0x1f07('0x22')](function(_0x7e4af){if(_0x7e4af){return _0x7e4af[_0x1f07('0x5b')](_0x47f56d[_0x1f07('0x59')][_0x1f07('0x5c')],_[_0x1f07('0x5d')](_0x47f56d['body'],['ids','id'])||{});}})[_0x1f07('0x22')](respondWithResult(_0x641944,null))['catch'](handleError(_0x641944,null));};function validateUser(_0xa3b693){return new Promise(function(_0x412a23,_0x11b2d6){if(_0xa3b693[_0x1f07('0x5e')])return _0x412a23(_0xa3b693);return db[_0x1f07('0x5f')][_0x1f07('0x60')](0x1)['then'](function(_0x5e6b6d){if(_0x5e6b6d[_0x1f07('0x61')])authService[_0x1f07('0x62')](_0xa3b693[_0x1f07('0x3b')]);db[_0x1f07('0x4a')][_0x1f07('0x63')](_0x1f07('0x5e'))[_0x1f07('0x22')](function(_0x35b823){if(_[_0x1f07('0x64')](_0x35b823)){_0xa3b693['internal']=_0x5e6b6d[_0x1f07('0x65')]||0x1;return;}if(_[_0x1f07('0x64')](_0x5e6b6d[_0x1f07('0x65')])||_0x5e6b6d[_0x1f07('0x65')]===_0x35b823){_0xa3b693['internal']=_0x35b823+0x1;return;}if(_0x5e6b6d[_0x1f07('0x65')]>_0x35b823){_0xa3b693[_0x1f07('0x5e')]=_0x5e6b6d[_0x1f07('0x65')];return;}return db[_0x1f07('0x66')][_0x1f07('0x44')](_0x1f07('0x67'),{'type':db[_0x1f07('0x66')]['QueryTypes'][_0x1f07('0x68')]})[_0x1f07('0x22')](function(_0x2023ac){if(_0x2023ac&&_0x2023ac['length']){for(var _0x44e7f3=0x0,_0x488c00=_0x2023ac[_0x1f07('0x69')];_0x44e7f3<_0x488c00&&_[_0x1f07('0x64')](_0xa3b693[_0x1f07('0x5e')]);_0x44e7f3++){if(_0x5e6b6d[_0x1f07('0x65')]<=_0x2023ac[_0x44e7f3][_0x1f07('0x6a')]){_0xa3b693[_0x1f07('0x5e')]=_0x2023ac[_0x44e7f3][_0x1f07('0x6a')];}else if(_0x5e6b6d[_0x1f07('0x65')]>_0x2023ac[_0x44e7f3][_0x1f07('0x6a')]&&_0x5e6b6d[_0x1f07('0x65')]<=_0x2023ac[_0x44e7f3]['to']){_0xa3b693['internal']=_0x5e6b6d['min_internal'];}}}if(_['isNil'](_0xa3b693[_0x1f07('0x5e')])){_0xa3b693[_0x1f07('0x5e')]=_0x35b823+0x1;}return _0x412a23(_0xa3b693);});});})[_0x1f07('0x56')](function(_0x378482){_0x11b2d6(_0x378482);});});}function updateUser(_0x520edd){return new Promise(function(_0x39f881,_0x558ab2){try{if(_0x520edd[_0x1f07('0x6b')]){_0x520edd[_0x1f07('0x6c')]=_0x520edd[_0x1f07('0x5e')];_0x520edd['VoiceMail']={'mailbox':_0x520edd[_0x1f07('0x5e')],'password':_0x520edd[_0x1f07('0x3b')],'fullname':_0x520edd['fullname'],'email':_0x520edd[_0x1f07('0x6d')]};}if(_0x520edd[_0x1f07('0x27')]==='agent'){if(!_0x520edd[_0x1f07('0x6e')])_0x520edd[_0x1f07('0x6e')]=['101','102',_0x1f07('0x6f'),_0x1f07('0x70'),_0x1f07('0x71'),_0x1f07('0x72'),_0x1f07('0x73'),_0x1f07('0x74'),_0x1f07('0x75'),_0x1f07('0x76'),_0x1f07('0x77'),_0x1f07('0x78'),_0x1f07('0x79'),_0x1f07('0x7a'),_0x1f07('0x7b')];}_0x39f881(_0x520edd);}catch(_0x228c92){_0x558ab2(_0x228c92);}});}exports[_0x1f07('0x7c')]=function(_0x22879e,_0x11ffee){if(_0x22879e[_0x1f07('0x29')][_0x1f07('0x27')]===_0x1f07('0x7d'))throw new Error('Unauthorized');if(_0x22879e[_0x1f07('0x59')][_0x1f07('0x27')]===_0x1f07('0x29')&&_0x22879e[_0x1f07('0x29')][_0x1f07('0x27')]!==_0x1f07('0x28')){throw new Error(_0x1f07('0x7e'));}if(_0x22879e['body'][_0x1f07('0x27')]===_0x1f07('0x28')&&_0x22879e[_0x1f07('0x29')]['role']!==_0x1f07('0x28')){throw new Error(_0x1f07('0x7f'));}return licenseUtil[_0x1f07('0x80')]([_0x22879e[_0x1f07('0x59')]])[_0x1f07('0x22')](function(){return validateUser(_0x22879e[_0x1f07('0x59')]);})[_0x1f07('0x22')](function(_0x25aae8){return updateUser(_0x25aae8)[_0x1f07('0x22')](function(_0x4fc15f){if(_0x4fc15f['role']===_0x1f07('0x28')){_0x4fc15f[_0x1f07('0x81')]=_0x22879e['user']['settingsEnabled'];delete _0x4fc15f[_0x1f07('0x82')];}return _0x4fc15f;});})[_0x1f07('0x22')](function(_0x4eccf0){return db['User']['create'](_0x4eccf0,{'include':[{'model':db[_0x1f07('0x83')],'as':'VoiceMail'}]});})[_0x1f07('0x22')](function(_0x4d6e1e){if(_0x22879e['body'][_0x1f07('0x27')]===_0x1f07('0x29'))return _0x4d6e1e;if(_0x22879e[_0x1f07('0x29')][_0x1f07('0x27')]!==_0x1f07('0x29'))return _0x4d6e1e;return db[_0x1f07('0x84')]['find']({'where':{'name':_0x4d6e1e[_0x1f07('0x27')]===_0x1f07('0x7d')?_0x1f07('0x2a'):_0x1f07('0x2b'),'userProfileId':_0x22879e['user'][_0x1f07('0x82')]},'raw':!![]})[_0x1f07('0x22')](function(_0x19242e){if(!_0x19242e||_0x19242e[_0x1f07('0x85')]!=0x0)return _0x4d6e1e;return db[_0x1f07('0x32')][_0x1f07('0x7c')]({'name':_0x4d6e1e[_0x1f07('0x31')],'resourceId':_0x4d6e1e['id'],'type':_0x19242e[_0x1f07('0x31')],'sectionId':_0x19242e['id']},{})[_0x1f07('0x22')](function(){return _0x4d6e1e;});})['catch'](function(_0x20a751){logger[_0x1f07('0x33')](_0x1f07('0x86'),_0x20a751);throw _0x20a751;});})[_0x1f07('0x22')](respondWithResult(_0x11ffee,0xc9))[_0x1f07('0x56')](handleError(_0x11ffee,null));};exports[_0x1f07('0x87')]=function(_0x598fda,_0x5f3b14){var _0x1b94a8=_0x598fda[_0x1f07('0x59')];var _0x53d0e7=[];if(_0x598fda[_0x1f07('0x29')][_0x1f07('0x27')]==='agent')throw new Error(_0x1f07('0x88'));if(_['some'](_0x1b94a8,[_0x1f07('0x27'),'user'])&&_0x598fda[_0x1f07('0x29')][_0x1f07('0x27')]!=='admin'){throw new Error(_0x1f07('0x7e'));}if(_['some'](_0x1b94a8,[_0x1f07('0x27'),_0x1f07('0x28')])&&_0x598fda[_0x1f07('0x29')][_0x1f07('0x27')]!==_0x1f07('0x28')){throw new Error(_0x1f07('0x89'));}return licenseUtil['checkUserLimits'](_0x1b94a8)[_0x1f07('0x22')](function(){return validateUser(_0x1b94a8[0x0]);})[_0x1f07('0x22')](function(){for(var _0x3c31fc=0x1;_0x3c31fc<_0x1b94a8[_0x1f07('0x69')];_0x3c31fc++){var _0x128608=_0x1b94a8[_0x3c31fc-0x1]['internal'];if(!_0x1b94a8[_0x3c31fc][_0x1f07('0x5e')])_0x1b94a8[_0x3c31fc][_0x1f07('0x5e')]=_0x128608+0x1;_0x53d0e7['push'](validateUser(_0x1b94a8[_0x3c31fc]));}return Promise['all'](_0x53d0e7);})['then'](function(){_0x53d0e7=[];for(var _0x18559c=0x0;_0x18559c<_0x1b94a8['length'];_0x18559c++){_0x53d0e7[_0x1f07('0x49')](updateUser(_0x1b94a8[_0x18559c]));}return Promise[_0x1f07('0x55')](_0x53d0e7);})[_0x1f07('0x22')](function(){_0x53d0e7=_0x1b94a8[_0x1f07('0x2d')](function(_0x38f865){return db[_0x1f07('0x4a')][_0x1f07('0x7c')](_0x38f865,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x1f07('0x22')](function(_0x366bec){_0x38f865['id']=_0x366bec['id'];return _0x38f865;});});return Promise[_0x1f07('0x55')](_0x53d0e7);})['then'](function(_0x3e3be9){if(_0x598fda[_0x1f07('0x59')][_0x1f07('0x27')]===_0x1f07('0x29'))return _0x3e3be9;if(_0x598fda[_0x1f07('0x29')][_0x1f07('0x27')]!==_0x1f07('0x29'))return _0x3e3be9;var _0x5122f5=_['some'](_0x3e3be9,function(_0x210ffe){return _0x210ffe[_0x1f07('0x27')]==='agent'||_0x210ffe[_0x1f07('0x27')]==='telephone';});if(!_0x5122f5)return _0x3e3be9;return db[_0x1f07('0x84')]['findAll']({'where':{'name':{'$or':[_0x1f07('0x2a'),'Telephones']},'userProfileId':_0x598fda[_0x1f07('0x29')][_0x1f07('0x82')]},'raw':!![]})[_0x1f07('0x22')](function(_0x2a5aea){if(_[_0x1f07('0x8a')](_0x2a5aea)||!_['some'](_0x2a5aea,[_0x1f07('0x85'),0x0]))return _0x3e3be9;_0x53d0e7=[];var _0x4b06eb=_(_0x2a5aea)['map'](function(_0x24196b){if(_0x24196b['autoAssociation']===0x1)return;return _0x24196b[_0x1f07('0x31')]==='Agents'?_0x1f07('0x7d'):_0x1f07('0x2c');})['compact']()[_0x1f07('0x2e')]();for(var _0x4050c1=0x0;_0x4050c1<_0x3e3be9['length'];_0x4050c1++){if(!_[_0x1f07('0x2f')](_0x4b06eb,_0x3e3be9[_0x4050c1][_0x1f07('0x27')]))return;var _0x54dd6b=_0x3e3be9[_0x4050c1][_0x1f07('0x27')]==='agent'?_0x1f07('0x2a'):'Telephones';_0x53d0e7[_0x1f07('0x49')](db['UserProfileResource']['create']({'name':_0x3e3be9[_0x4050c1][_0x1f07('0x31')],'resourceId':_0x3e3be9[_0x4050c1]['id'],'type':_0x54dd6b,'sectionId':_[_0x1f07('0x30')](_0x2a5aea,[_0x1f07('0x31'),_0x54dd6b])['id']},{}));}return Promise['all'](_0x53d0e7);});})[_0x1f07('0x22')](respondWithResult(_0x5f3b14,0xc9))['catch'](handleError(_0x5f3b14,null));};exports[_0x1f07('0x8b')]=function(_0xefc2fd,_0x3b0132){if(_0xefc2fd['body']['id']){delete _0xefc2fd[_0x1f07('0x59')]['id'];}return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0xefc2fd[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](function(_0xbb3feb){if(!_0xbb3feb)return null;if(_0xbb3feb['id']===_0xefc2fd['user']['id']){if(!_0xefc2fd[_0x1f07('0x59')]['oldPassword']||!_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')]){throw new db[(_0x1f07('0x8d'))][(_0x1f07('0x8e'))](_0x1f07('0x8f'));}if(!_0xbb3feb[_0x1f07('0x90')](_0xefc2fd['body'][_0x1f07('0x91')])){throw new db[(_0x1f07('0x8d'))][(_0x1f07('0x8e'))]('Wrong\x20credentials');}if(_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x91')]===_0xefc2fd[_0x1f07('0x59')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x1f07('0x92'));}}else if(_0xefc2fd[_0x1f07('0x29')][_0x1f07('0x27')]===_0x1f07('0x28')){if(!_0xefc2fd[_0x1f07('0x59')]['newPassword']){throw new db[(_0x1f07('0x8d'))][(_0x1f07('0x8e'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0xefc2fd[_0x1f07('0x29')][_0x1f07('0x27')]==='user'){if(!_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')]){throw new db['Sequelize'][(_0x1f07('0x8e'))](_0x1f07('0x93'));}if(_0xbb3feb['role']!==_0x1f07('0x7d')){throw new db['Sequelize'][(_0x1f07('0x8e'))](_0x1f07('0x88'));}}else{throw new db[(_0x1f07('0x8d'))][(_0x1f07('0x8e'))](_0x1f07('0x88'));}return _0xbb3feb;})[_0x1f07('0x22')](handleEntityNotFound(_0x3b0132,null))[_0x1f07('0x22')](function(_0x43ad0a){return db[_0x1f07('0x5f')]['findOne']({'attributes':['id',_0x1f07('0x61'),_0x1f07('0x94'),'passwordHistoryLimit']})[_0x1f07('0x22')](function(_0x49a6fb){if(_0x49a6fb[_0x1f07('0x61')])authService['validatePasswordPattern'](_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')]);if(!_0x49a6fb['enforcePasswordHistory']||!_0x43ad0a['previousPasswords'])return _0x43ad0a;authService[_0x1f07('0x95')](_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')],_0x43ad0a[_0x1f07('0x3d')],_0x49a6fb[_0x1f07('0x96')]);return _0x43ad0a;})[_0x1f07('0x22')](saveUpdates({'password':_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')],'passwordResetAt':_0xefc2fd['user']['id']==_0xefc2fd[_0x1f07('0x57')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xefc2fd[_0x1f07('0x59')][_0x1f07('0x8c')],_0x43ad0a['previousPasswords'])},null));})[_0x1f07('0x22')](respondWithResult(_0x3b0132,null))['catch'](handleError(_0x3b0132,null));};exports[_0x1f07('0x97')]=function(_0x47293d,_0x4125ec){var _0xab05c3=_0x47293d['body'][_0x1f07('0x98')];return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0x47293d['params']['id']},'attributes':['id',_0x1f07('0x31'),_0x1f07('0x27'),_0x1f07('0x99'),_0x1f07('0x9a'),_0x1f07('0x9b'),_0x1f07('0x9c')]})[_0x1f07('0x22')](handleEntityNotFound(_0x4125ec,null))['then'](function(_0x220673){if(_0x220673){if(!utils[_0x1f07('0x9d')](_0xab05c3)){throw new db[(_0x1f07('0x8d'))][(_0x1f07('0x8e'))]('Unknown\x20channel');}return _0x220673['add'+_[_0x1f07('0x9e')](_0xab05c3[_0x1f07('0x9f')]())+_0x1f07('0xa0')](_0x47293d[_0x1f07('0x59')]['ids'],{'penalty':_0x47293d[_0x1f07('0x59')]['penalty']||0x0})['spread'](function(_0x371fa4){for(var _0x4fc826=0x0;_0x4fc826<_0x47293d[_0x1f07('0x59')][_0x1f07('0x5c')]['length'];_0x4fc826+=0x1){var _0x479f8c={'UserId':Number(_0x47293d[_0x1f07('0x57')]['id'])};_0x479f8c[_['capitalize'](_0xab05c3['toLowerCase']())+_0x1f07('0xa1')]=Number(_0x47293d[_0x1f07('0x59')][_0x1f07('0x5c')][_0x4fc826]);socket[_0x1f07('0x23')]('user'+_[_0x1f07('0x9e')](_0xab05c3['toLowerCase']())+_0x1f07('0xa2'),_0x479f8c);}return _0x371fa4;})[_0x1f07('0x22')](function(){if(_0xab05c3===_0x1f07('0xa3')){return db[_0x1f07('0xa4')]['findAll']({'where':{'id':_0x47293d[_0x1f07('0x59')][_0x1f07('0x5c')]||[]},'raw':!![],'attributes':['id',_0x1f07('0x31')]});}})[_0x1f07('0x22')](function(_0x20b695){var _0x519c89=_0x220673[_0x1f07('0x26')]({'plain':!![]});var _0x116d6d=[];if(_0xab05c3==='voice'&&_0x519c89[_0x1f07('0x27')]===_0x1f07('0x7d')&&_0x519c89[_0x1f07('0x99')]){for(let _0x369412=0x0;_0x369412<_0x20b695[_0x1f07('0x69')];_0x369412+=0x1){_0x116d6d[_0x1f07('0x49')]({'membername':_0x519c89['name'],'UserId':_0x519c89['id'],'queue_name':_0x20b695[_0x369412][_0x1f07('0x31')],'VoiceQueueId':_0x20b695[_0x369412]['id'],'interface':_[_0x1f07('0x64')](_0x519c89[_0x1f07('0x9c')])?util['format'](_0x1f07('0xa5'),_0x519c89[_0x1f07('0x31')]):_0x519c89[_0x1f07('0x9c')],'paused':_0x519c89['voicePause']||![],'penalty':_0x47293d['body'][_0x1f07('0xa6')]||0x0});}return Promise[_0x1f07('0x55')](_0x116d6d[_0x1f07('0x2d')](function(_0x310e0d){return db[_0x1f07('0xa7')]['upsert'](_0x310e0d);}));}return _0x220673;});}})[_0x1f07('0x22')](respondWithStatusCode(_0x4125ec,null))[_0x1f07('0x56')](handleError(_0x4125ec,null));};exports[_0x1f07('0xa8')]=function(_0x1b8618,_0x5bde12){var _0x392205,_0x58dcb5;return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0x1b8618['params']['id']},'attributes':['id',_0x1f07('0x31'),'role']})[_0x1f07('0x22')](handleEntityNotFound(_0x5bde12,null))[_0x1f07('0x22')](function(_0x198555){if(_0x198555){_0x392205=_0x198555;if(!_0x1b8618[_0x1f07('0x44')][_0x1f07('0x98')]||!utils['isValidChannel'](_0x1b8618[_0x1f07('0x44')]['channel'])){throw new db['Sequelize'][(_0x1f07('0x8e'))]('Unknown\x20channel');}return _0x198555[_0x1f07('0xa9')+_[_0x1f07('0x9e')](_0x1b8618['query']['channel'][_0x1f07('0x9f')]())+_0x1f07('0xa0')](_0x1b8618['query'][_0x1f07('0x5c')]);}})[_0x1f07('0x22')](function(_0x42a873){if(_[_0x1f07('0xaa')](_0x1b8618[_0x1f07('0x44')]['ids'])){for(var _0x10bd84=0x0;_0x10bd84<_0x1b8618[_0x1f07('0x44')][_0x1f07('0x5c')][_0x1f07('0x69')];_0x10bd84+=0x1){_0x58dcb5={'UserId':Number(_0x1b8618[_0x1f07('0x57')]['id'])};_0x58dcb5[_[_0x1f07('0x9e')](_0x1b8618['query'][_0x1f07('0x98')][_0x1f07('0x9f')]())+_0x1f07('0xa1')]=Number(_0x1b8618['query'][_0x1f07('0x5c')][_0x10bd84]);socket[_0x1f07('0x23')](_0x1f07('0x29')+_[_0x1f07('0x9e')](_0x1b8618[_0x1f07('0x44')][_0x1f07('0x98')][_0x1f07('0x9f')]())+_0x1f07('0xab'),_0x58dcb5);}}else{_0x58dcb5={'UserId':Number(_0x1b8618['params']['id'])};_0x58dcb5[_[_0x1f07('0x9e')](_0x1b8618[_0x1f07('0x44')][_0x1f07('0x98')][_0x1f07('0x9f')]())+_0x1f07('0xa1')]=Number(_0x1b8618[_0x1f07('0x44')]['ids']);socket[_0x1f07('0x23')](_0x1f07('0x29')+_['capitalize'](_0x1b8618[_0x1f07('0x44')]['channel']['toLowerCase']())+'Queue:remove',_0x58dcb5);}return _0x42a873;})['then'](function(){if(_0x1b8618[_0x1f07('0x44')]['channel']===_0x1f07('0xa3')){return db['UserVoiceQueueRt'][_0x1f07('0x25')]({'where':{'UserId':_0x1b8618[_0x1f07('0x57')]['id'],'VoiceQueueId':_0x1b8618[_0x1f07('0x44')][_0x1f07('0x5c')]},'individualHooks':!![]})[_0x1f07('0x22')](function(){return _0x392205;});}return _0x392205;})[_0x1f07('0x22')](respondWithStatusCode(_0x5bde12,null))[_0x1f07('0x56')](handleError(_0x5bde12,null));};exports[_0x1f07('0xac')]=function(_0x54881a,_0x43df93){_0x54881a['body'][_0x1f07('0xad')]=_0x54881a['file'][_0x1f07('0xae')];return db['User'][_0x1f07('0x30')]({'where':{'id':_0x54881a[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x43df93,null))[_0x1f07('0x22')](saveUpdates(_0x54881a['body'],null))[_0x1f07('0x22')](respondWithResult(_0x43df93,null))[_0x1f07('0x56')](handleError(_0x43df93,null));};exports[_0x1f07('0xaf')]=function(_0x430326,_0x44942a){var _0x11b8a8=path[_0x1f07('0xb0')](config['root'],_0x1f07('0xb1'));return db[_0x1f07('0x4a')]['find']({'where':{'id':_0x430326[_0x1f07('0x57')]['id']},'attributes':['id',_0x1f07('0xad')],'raw':!![]})['then'](handleEntityNotFound(_0x44942a,null))[_0x1f07('0x22')](function(_0x5a68cb){if(_0x5a68cb){if(_[_0x1f07('0x64')](_0x5a68cb[_0x1f07('0xad')])){return _0x44942a['download'](_0x11b8a8);}else{if(!fs[_0x1f07('0xb2')](path[_0x1f07('0xb0')](config['root'],_0x1f07('0xb3'),_0x5a68cb[_0x1f07('0xad')]))){return _0x44942a[_0x1f07('0xb4')](_0x11b8a8);}return _0x44942a[_0x1f07('0xb4')](path['join'](config[_0x1f07('0xb5')],_0x1f07('0xb3'),_0x5a68cb[_0x1f07('0xad')]));}}})['catch'](handleError(_0x44942a,null));};exports['getOpenTabs']=function(_0x137eeb,_0x46b220){return db[_0x1f07('0x4a')]['find']({'where':{'id':_0x137eeb[_0x1f07('0x57')]['id']},'attributes':['id']})[_0x1f07('0x22')](handleEntityNotFound(_0x46b220,null))[_0x1f07('0x22')](function(_0x5a93d1){var _0x4da413=[];values=_0x5a93d1[_0x1f07('0x4f')];_0x4da413[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x4d'),_0x5a93d1[_0x1f07('0x4f')]));_0x4da413['push'](get_open_tabs(_0x1f07('0x50'),_0x5a93d1[_0x1f07('0x4f')]));_0x4da413[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x53'),_0x5a93d1[_0x1f07('0x4f')]));_0x4da413[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x54'),_0x5a93d1[_0x1f07('0x4f')]));_0x4da413[_0x1f07('0x49')](get_open_tabs('fax',_0x5a93d1[_0x1f07('0x4f')]));_0x4da413[_0x1f07('0x49')](get_open_tabs(_0x1f07('0x52'),_0x5a93d1[_0x1f07('0x4f')]));return Promise['all'](_0x4da413);})[_0x1f07('0x22')](function(_0x5c6fd7){if(_0x5c6fd7){var _0x5a7b45=_[_0x1f07('0x2d')](values[_0x1f07('0xb6')],function(_0x3255c2){return{'channel':'CHAT','id':_0x3255c2['id'],'createdAt':_0x3255c2[_0x1f07('0xb7')]};});var _0x2f6fe5=_[_0x1f07('0x2d')](values['FaxOpenTabs'],function(_0x3281e6){return{'channel':_0x1f07('0xb8'),'id':_0x3281e6['id'],'createdAt':_0x3281e6[_0x1f07('0xb7')]};});var _0x3d38ab=_[_0x1f07('0x2d')](values['OpenchannelOpenTabs'],function(_0x13dfb0){return{'channel':_0x1f07('0xb9'),'id':_0x13dfb0['id'],'createdAt':_0x13dfb0[_0x1f07('0xb7')]};});var _0x4b62c6=_[_0x1f07('0x2d')](values[_0x1f07('0xba')],function(_0x4f1095){return{'channel':_0x1f07('0xbb'),'id':_0x4f1095['id'],'createdAt':_0x4f1095[_0x1f07('0xb7')]};});var _0x38f335=_[_0x1f07('0x2d')](values[_0x1f07('0xbc')],function(_0x4bd657){return{'channel':_0x1f07('0xbd'),'id':_0x4bd657['id'],'createdAt':_0x4bd657[_0x1f07('0xb7')]};});var _0x3c7e7c=_[_0x1f07('0x2d')](values['WhatsappOpenTabs'],function(_0x76030e){return{'channel':'WHATSAPP','id':_0x76030e['id'],'createdAt':_0x76030e[_0x1f07('0xb7')]};});var _0x4845e8=_[_0x1f07('0xbe')](_0x5a7b45,_0x2f6fe5,_0x3d38ab,_0x4b62c6,_0x38f335,_0x3c7e7c);var _0x31b42a={'count':_0x4845e8[_0x1f07('0x69')],'rows':_0x4845e8};return _0x31b42a;}else return null;})[_0x1f07('0x22')](respondWithResult(_0x46b220,null))[_0x1f07('0x56')](handleError(_0x46b220,null));};exports[_0x1f07('0xbf')]=function(_0x4cd2f5,_0x169fcc){var _0x1bc53b={};return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x4cd2f5[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](function(_0x5077bb){if(!_0x5077bb){throw new APINotFoundError(util[_0x1f07('0xc1')](_0x1f07('0xc2'),_0x4cd2f5[_0x1f07('0x57')]['id']));}return contacts['describe']();})['then'](function(_0xd05a1c){_0x4cd2f5['query'][_0x1f07('0x4a')]=_0x4cd2f5[_0x1f07('0x57')]['id'];_0x1bc53b=qs[_0x1f07('0x41')](_0xd05a1c,_0x4cd2f5);if(_0x4cd2f5[_0x1f07('0x44')][_0x1f07('0xc3')](_0x1f07('0x42'))){_0x1bc53b[_0x1f07('0x43')]=[{'model':db[_0x1f07('0xc4')],'as':_0x1f07('0xc5'),'required':![]},{'model':db[_0x1f07('0xc6')],'as':_0x1f07('0xc7'),'attributes':['id',_0x1f07('0x31'),_0x1f07('0xc8')],'where':_0x4cd2f5[_0x1f07('0x44')][_0x1f07('0xc9')]?{'id':_0x4cd2f5[_0x1f07('0x44')][_0x1f07('0xc9')]}:undefined,'required':_0x4cd2f5[_0x1f07('0x44')][_0x1f07('0xc9')]?!![]:![]}];}return contacts['findAll'](_0x4cd2f5[_0x1f07('0x44')],_0x4cd2f5[_0x1f07('0x29')],_0x1bc53b,_0xd05a1c);})['then'](respondWithFilteredResult(_0x169fcc,_0x1bc53b))[_0x1f07('0x56')](APIHandleError(_0x169fcc));};exports[_0x1f07('0xca')]=function(_0x220dcc,_0x3b52cd){var _0x4159a0;var _0xd6add4={};var _0x3336ba;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x220dcc[_0x1f07('0x57')]['id']},'attributes':['id','name',_0x1f07('0x27')]})[_0x1f07('0x22')](handleEntityNotFound(_0x3b52cd,null))[_0x1f07('0x22')](function(_0x4c7818){if(!utils[_0x1f07('0x9d')](_0x220dcc[_0x1f07('0x44')]['channel'])){throw new db['Sequelize'][(_0x1f07('0x8e'))](_0x1f07('0xcb'));}_0x4159a0=_0x4c7818;var _0x2dbf60={};_0x2dbf60[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_[_0x1f07('0x9e')](_0x220dcc[_0x1f07('0x44')]['channel'])+_0x1f07('0xce')][_0x1f07('0x36')]);_0x2dbf60[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x220dcc[_0x1f07('0x44')]);_0x2dbf60[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x2dbf60['model'],_0x2dbf60['query']);_0xd6add4[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x2dbf60[_0x1f07('0xcc')],qs['fields'](_0x220dcc[_0x1f07('0x44')][_0x1f07('0xd1')]));_0xd6add4[_0x1f07('0x48')]=_0xd6add4[_0x1f07('0x48')][_0x1f07('0x69')]?_0xd6add4['attributes']:_0x2dbf60[_0x1f07('0xcc')];_0xd6add4[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x220dcc[_0x1f07('0x44')][_0x1f07('0xd3')]);_0xd6add4[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_['pick'](_0x220dcc[_0x1f07('0x44')],_0x2dbf60[_0x1f07('0xcf')]));if(_0x220dcc[_0x1f07('0x44')][_0x1f07('0x3a')]){_0xd6add4[_0x1f07('0xd4')]=_['merge'](_0xd6add4[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0xd6add4[_0x1f07('0x48')],function(_0x385bd2){var _0x1349db={};_0x1349db[_0x385bd2]={'$like':'%'+_0x220dcc[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x1349db;})});}_0xd6add4=_['merge']({},_0xd6add4,_0x220dcc[_0x1f07('0xd5')]);switch(_0x4159a0[_0x1f07('0x27')]){case _0x1f07('0x28'):return db[_[_0x1f07('0x9e')](_0x220dcc['query'][_0x1f07('0x98')])+_0x1f07('0xce')][_0x1f07('0x4b')](_0xd6add4);case'user':case _0x1f07('0x7d'):return _0x4159a0[_0x1f07('0x26')+_['capitalize'](_0x220dcc['query'][_0x1f07('0x98')])+_0x1f07('0xa0')](_0xd6add4);default:throw new db['Sequelize']['ValidationError']('Unknown\x20role');}})['then'](function(_0x2b8fc7){_0x3336ba=_0x2b8fc7['length'];if(!_0x220dcc[_0x1f07('0x44')][_0x1f07('0xc3')]('nolimit')){_0xd6add4[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x220dcc[_0x1f07('0x44')][_0x1f07('0x1e')]);_0xd6add4[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x220dcc[_0x1f07('0x44')]['offset']);}switch(_0x4159a0[_0x1f07('0x27')]){case _0x1f07('0x28'):return db[_[_0x1f07('0x9e')](_0x220dcc[_0x1f07('0x44')][_0x1f07('0x98')])+_0x1f07('0xce')][_0x1f07('0x4b')](_0xd6add4);case _0x1f07('0x29'):case _0x1f07('0x7d'):return _0x4159a0[_0x1f07('0x26')+_[_0x1f07('0x9e')](_0x220dcc[_0x1f07('0x44')][_0x1f07('0x98')])+_0x1f07('0xa0')](_0xd6add4);}})[_0x1f07('0x22')](function(_0x1c6a21){return{'count':_0x3336ba,'rows':_0x1c6a21};})['then'](respondWithResult(_0x3b52cd,null))[_0x1f07('0x56')](handleError(_0x3b52cd,null));};exports[_0x1f07('0xd6')]=function(_0x7a6c02,_0x372615){var _0x1b28f3={};var _0x24b93f={};var _0x36cf84;var _0x129dfc;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x7a6c02['params']['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x372615,null))[_0x1f07('0x22')](function(_0x3cadc5){if(_0x3cadc5){_0x36cf84=_0x3cadc5;_0x24b93f['model']=_['keys'](db['UserVoiceQueueRt'][_0x1f07('0x36')]);_0x24b93f[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x7a6c02[_0x1f07('0x44')]);_0x24b93f[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x24b93f[_0x1f07('0xcc')],_0x24b93f['query']);_0x1b28f3[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x24b93f[_0x1f07('0xcc')],qs['fields'](_0x7a6c02['query'][_0x1f07('0xd1')]));_0x1b28f3[_0x1f07('0x48')]=_0x1b28f3[_0x1f07('0x48')]['length']?_0x1b28f3[_0x1f07('0x48')]:_0x24b93f[_0x1f07('0xcc')];_0x1b28f3[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x7a6c02[_0x1f07('0x44')][_0x1f07('0xd3')]);_0x1b28f3['where']=qs['filters'](_[_0x1f07('0xd7')](_0x7a6c02[_0x1f07('0x44')],_0x24b93f[_0x1f07('0xcf')]));if(_0x7a6c02[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x1b28f3[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x1b28f3[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x1b28f3[_0x1f07('0x48')],function(_0x4d5c9f){var _0x2a76e7={};_0x2a76e7[_0x4d5c9f]={'$like':'%'+_0x7a6c02[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x2a76e7;})});}_0x1b28f3=_[_0x1f07('0x58')]({},_0x1b28f3,_0x7a6c02[_0x1f07('0xd5')]);return _0x36cf84[_0x1f07('0xd6')](_0x1b28f3);}})[_0x1f07('0x22')](function(_0x33e440){if(_0x33e440){_0x129dfc=_0x33e440[_0x1f07('0x69')];if(!_0x7a6c02['query']['hasOwnProperty'](_0x1f07('0xd8'))){_0x1b28f3['limit']=qs[_0x1f07('0x1e')](_0x7a6c02[_0x1f07('0x44')][_0x1f07('0x1e')]);_0x1b28f3[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x7a6c02[_0x1f07('0x44')]['offset']);}return _0x36cf84[_0x1f07('0xd6')](_0x1b28f3);}})[_0x1f07('0x22')](function(_0x2509fe){if(_0x2509fe){return _0x2509fe?{'count':_0x129dfc,'rows':_0x2509fe}:null;}})[_0x1f07('0x22')](respondWithResult(_0x372615,null))[_0x1f07('0x56')](handleError(_0x372615,null));};exports['getGroups']=function(_0x1eef85,_0x5e3c7d){var _0x3daf6e={};var _0x59cc44={};var _0x2e293f;var _0x1c5ccf;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x1eef85['params']['id']}})['then'](handleEntityNotFound(_0x5e3c7d,null))['then'](function(_0x13442a){if(_0x13442a){_0x2e293f=_0x13442a;_0x59cc44[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xd9')]['rawAttributes']);_0x59cc44[_0x1f07('0x44')]=_['keys'](_0x1eef85[_0x1f07('0x44')]);_0x59cc44[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x59cc44[_0x1f07('0xcc')],_0x59cc44['query']);_0x3daf6e[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x59cc44[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x1eef85[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x3daf6e[_0x1f07('0x48')]=_0x3daf6e[_0x1f07('0x48')][_0x1f07('0x69')]?_0x3daf6e[_0x1f07('0x48')]:_0x59cc44[_0x1f07('0xcc')];_0x3daf6e[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x1eef85['query'][_0x1f07('0xd3')]);_0x3daf6e[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x1eef85[_0x1f07('0x44')],_0x59cc44[_0x1f07('0xcf')]));if(_0x1eef85[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x3daf6e[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x3daf6e[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x3daf6e[_0x1f07('0x48')],function(_0x49c067){var _0x49fbab={};_0x49fbab[_0x49c067]={'$like':'%'+_0x1eef85[_0x1f07('0x44')]['filter']+'%'};return _0x49fbab;})});}_0x3daf6e=_[_0x1f07('0x58')]({},_0x3daf6e,_0x1eef85[_0x1f07('0xd5')]);return _0x2e293f[_0x1f07('0xda')](_0x3daf6e);}})[_0x1f07('0x22')](function(_0x299fb0){if(_0x299fb0){_0x1c5ccf=_0x299fb0[_0x1f07('0x69')];if(!_0x1eef85[_0x1f07('0x44')][_0x1f07('0xc3')](_0x1f07('0xd8'))){_0x3daf6e[_0x1f07('0x1e')]=qs['limit'](_0x1eef85[_0x1f07('0x44')]['limit']);_0x3daf6e[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x1eef85[_0x1f07('0x44')][_0x1f07('0x1c')]);}return _0x2e293f[_0x1f07('0xda')](_0x3daf6e);}})[_0x1f07('0x22')](function(_0x4b4742){if(_0x4b4742){return _0x4b4742?{'count':_0x1c5ccf,'rows':_0x4b4742}:null;}})[_0x1f07('0x22')](respondWithResult(_0x5e3c7d,null))[_0x1f07('0x56')](handleError(_0x5e3c7d,null));};exports[_0x1f07('0xdb')]=function(_0x81d054,_0x3a69a9){var _0x43f9e9={'raw':!![],'where':{}};var _0x30d21f={};var _0x466ed5={'count':0x0,'rows':[]};return db['User'][_0x1f07('0xc0')]({'where':{'id':_0x81d054[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x3a69a9,null))[_0x1f07('0x22')](function(_0x11ae85){if(_0x11ae85){_0x30d21f[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xdc')][_0x1f07('0x36')]);_0x30d21f['query']=_[_0x1f07('0xcd')](_0x81d054[_0x1f07('0x44')]);_0x30d21f['filters']=_[_0x1f07('0xd0')](_0x30d21f['model'],_0x30d21f[_0x1f07('0x44')]);_0x43f9e9[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x30d21f[_0x1f07('0xcc')],qs['fields'](_0x81d054[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x43f9e9[_0x1f07('0x48')]=_0x43f9e9['attributes'][_0x1f07('0x69')]?_0x43f9e9[_0x1f07('0x48')]:_0x30d21f[_0x1f07('0xcc')];if(!_0x81d054[_0x1f07('0x44')][_0x1f07('0xc3')](_0x1f07('0xd8'))){_0x43f9e9[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x81d054[_0x1f07('0x44')][_0x1f07('0x1e')]);_0x43f9e9[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x81d054[_0x1f07('0x44')][_0x1f07('0x1c')]);}_0x43f9e9['order']=qs[_0x1f07('0xd3')](_0x81d054[_0x1f07('0x44')][_0x1f07('0xd3')]);_0x43f9e9[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x81d054[_0x1f07('0x44')],_0x30d21f[_0x1f07('0xcf')]));_0x43f9e9['where'][_0x1f07('0xdd')]=_0x11ae85['id'];if(_0x81d054['query']['filter']){_0x43f9e9[_0x1f07('0xd4')]=_['merge'](_0x43f9e9[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x43f9e9[_0x1f07('0x48')],function(_0x3363dd){var _0x1b7eb8={};_0x1b7eb8[_0x3363dd]={'$like':'%'+_0x81d054[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x1b7eb8;})});}_0x43f9e9=_[_0x1f07('0x58')]({},_0x43f9e9,_0x81d054[_0x1f07('0xd5')]);return db[_0x1f07('0xdc')][_0x1f07('0x1f')]({'where':_0x43f9e9['where']})['then'](function(_0xceac15){_0x466ed5['count']=_0xceac15;if(_0x81d054[_0x1f07('0x44')][_0x1f07('0x42')]){_0x43f9e9[_0x1f07('0x43')]=[{'all':!![]}];}return db[_0x1f07('0xdc')][_0x1f07('0x4b')](_0x43f9e9);})[_0x1f07('0x22')](function(_0xebe723){_0x466ed5[_0x1f07('0x4e')]=_0xebe723;return _0x466ed5;});}})[_0x1f07('0x22')](respondWithFilteredResult(_0x3a69a9,_0x43f9e9))[_0x1f07('0x56')](handleError(_0x3a69a9,null));};exports[_0x1f07('0xde')]=function(_0x1035de,_0x4dee0e){var _0x2928ab={'raw':!![],'where':{}};var _0x41f834={};var _0x2447f6={'count':0x0,'rows':[]};return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x1035de[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x4dee0e,null))['then'](function(_0x430241){if(_0x430241){_0x41f834[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xdf')][_0x1f07('0x36')]);_0x41f834[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x1035de[_0x1f07('0x44')]);_0x41f834['filters']=_[_0x1f07('0xd0')](_0x41f834[_0x1f07('0xcc')],_0x41f834[_0x1f07('0x44')]);_0x2928ab[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x41f834[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x1035de[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x2928ab['attributes']=_0x2928ab['attributes']['length']?_0x2928ab['attributes']:_0x41f834[_0x1f07('0xcc')];if(!_0x1035de[_0x1f07('0x44')][_0x1f07('0xc3')]('nolimit')){_0x2928ab[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x1035de[_0x1f07('0x44')][_0x1f07('0x1e')]);_0x2928ab['offset']=qs[_0x1f07('0x1c')](_0x1035de[_0x1f07('0x44')][_0x1f07('0x1c')]);}_0x2928ab[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x1035de['query']['sort']);_0x2928ab[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x1035de[_0x1f07('0x44')],_0x41f834[_0x1f07('0xcf')]));_0x2928ab['where']['UserId']=_0x430241['id'];if(_0x1035de[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x2928ab[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x2928ab[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x2928ab[_0x1f07('0x48')],function(_0x338c49){var _0x4d3aa6={};_0x4d3aa6[_0x338c49]={'$like':'%'+_0x1035de[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x4d3aa6;})});}_0x2928ab=_['merge']({},_0x2928ab,_0x1035de[_0x1f07('0xd5')]);return db['ScreenRecording'][_0x1f07('0x1f')]({'where':_0x2928ab[_0x1f07('0xd4')]})[_0x1f07('0x22')](function(_0x14d231){_0x2447f6[_0x1f07('0x1f')]=_0x14d231;if(_0x1035de['query']['includeAll']){_0x2928ab[_0x1f07('0x43')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x2928ab);})[_0x1f07('0x22')](function(_0x1b2bd3){_0x2447f6[_0x1f07('0x4e')]=_0x1b2bd3;return _0x2447f6;});}})['then'](respondWithFilteredResult(_0x4dee0e,_0x2928ab))[_0x1f07('0x56')](handleError(_0x4dee0e,null));};exports['getChatInteractions']=function(_0x11f03c,_0x374c56){var _0x16f902={};var _0x4a52cf={};var _0x5e70bd;var _0x21c540;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x11f03c[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x374c56,null))[_0x1f07('0x22')](function(_0x5ba1cf){if(_0x5ba1cf){_0x5e70bd=_0x5ba1cf;_0x4a52cf[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db['ChatInteraction'][_0x1f07('0x36')]);_0x4a52cf['query']=_[_0x1f07('0xcd')](_0x11f03c[_0x1f07('0x44')]);_0x4a52cf['filters']=_[_0x1f07('0xd0')](_0x4a52cf['model'],_0x4a52cf[_0x1f07('0x44')]);_0x16f902[_0x1f07('0x48')]=_['intersection'](_0x4a52cf[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x11f03c[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x16f902['attributes']=_0x16f902[_0x1f07('0x48')][_0x1f07('0x69')]?_0x16f902['attributes']:_0x4a52cf[_0x1f07('0xcc')];_0x16f902[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x11f03c[_0x1f07('0x44')][_0x1f07('0xd3')]);_0x16f902[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_['pick'](_0x11f03c[_0x1f07('0x44')],_0x4a52cf['filters']));if(_0x11f03c[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x16f902[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x16f902[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x16f902[_0x1f07('0x48')],function(_0x28de71){var _0xe9e24f={};_0xe9e24f[_0x28de71]={'$like':'%'+_0x11f03c[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0xe9e24f;})});}_0x16f902=_[_0x1f07('0x58')]({},_0x16f902,_0x11f03c['options']);return _0x5e70bd[_0x1f07('0xe0')](_0x16f902);}})[_0x1f07('0x22')](function(_0x1cf219){if(_0x1cf219){_0x21c540=_0x1cf219['length'];if(!_0x11f03c[_0x1f07('0x44')]['hasOwnProperty'](_0x1f07('0xd8'))){_0x16f902[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x11f03c[_0x1f07('0x44')]['limit']);_0x16f902[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x11f03c[_0x1f07('0x44')]['offset']);}return _0x5e70bd[_0x1f07('0xe0')](_0x16f902);}})['then'](function(_0x3ac7c8){if(_0x3ac7c8){return _0x3ac7c8?{'count':_0x21c540,'rows':_0x3ac7c8}:null;}})[_0x1f07('0x22')](respondWithResult(_0x374c56,null))[_0x1f07('0x56')](handleError(_0x374c56,null));};exports[_0x1f07('0xe1')]=function(_0x5673ef,_0x1ca247){var _0xcef7e1={};var _0x10954f={};var _0x4d6564;var _0x151aca;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x5673ef[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x1ca247,null))[_0x1f07('0x22')](function(_0x1bb327){if(_0x1bb327){_0x4d6564=_0x1bb327;_0x10954f[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xe2')][_0x1f07('0x36')]);_0x10954f[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x5673ef[_0x1f07('0x44')]);_0x10954f[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x10954f['model'],_0x10954f[_0x1f07('0x44')]);_0xcef7e1['attributes']=_[_0x1f07('0xd0')](_0x10954f[_0x1f07('0xcc')],qs['fields'](_0x5673ef['query']['fields']));_0xcef7e1[_0x1f07('0x48')]=_0xcef7e1[_0x1f07('0x48')][_0x1f07('0x69')]?_0xcef7e1[_0x1f07('0x48')]:_0x10954f['model'];_0xcef7e1[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x5673ef[_0x1f07('0x44')][_0x1f07('0xd3')]);_0xcef7e1[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x5673ef[_0x1f07('0x44')],_0x10954f[_0x1f07('0xcf')]));if(_0x5673ef['query'][_0x1f07('0x3a')]){_0xcef7e1['where']=_[_0x1f07('0x58')](_0xcef7e1[_0x1f07('0xd4')],{'$or':_['map'](_0xcef7e1[_0x1f07('0x48')],function(_0x1a0893){var _0x16c04a={};_0x16c04a[_0x1a0893]={'$like':'%'+_0x5673ef[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x16c04a;})});}_0xcef7e1=_[_0x1f07('0x58')]({},_0xcef7e1,_0x5673ef[_0x1f07('0xd5')]);return _0x4d6564[_0x1f07('0xe1')](_0xcef7e1);}})[_0x1f07('0x22')](function(_0x467fce){if(_0x467fce){_0x151aca=_0x467fce[_0x1f07('0x69')];if(!_0x5673ef[_0x1f07('0x44')][_0x1f07('0xc3')](_0x1f07('0xd8'))){_0xcef7e1[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x5673ef[_0x1f07('0x44')][_0x1f07('0x1e')]);_0xcef7e1['offset']=qs[_0x1f07('0x1c')](_0x5673ef[_0x1f07('0x44')][_0x1f07('0x1c')]);}return _0x4d6564['getOpenchannelInteractions'](_0xcef7e1);}})['then'](function(_0x42717a){if(_0x42717a){return _0x42717a?{'count':_0x151aca,'rows':_0x42717a}:null;}})[_0x1f07('0x22')](respondWithResult(_0x1ca247,null))[_0x1f07('0x56')](handleError(_0x1ca247,null));};exports[_0x1f07('0xe3')]=function(_0x5c503b,_0x3ffa0b){var _0x134280={'raw':!![],'where':{}};var _0x23b8fa={};var _0x3ea168={'count':0x0,'rows':[]};return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x5c503b[_0x1f07('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ffa0b,null))[_0x1f07('0x22')](function(_0x17a540){if(_0x17a540){_0x23b8fa[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db['MailInteraction'][_0x1f07('0x36')]);_0x23b8fa[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x5c503b[_0x1f07('0x44')]);_0x23b8fa[_0x1f07('0xcf')]=_['intersection'](_0x23b8fa[_0x1f07('0xcc')],_0x23b8fa[_0x1f07('0x44')]);_0x134280[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x23b8fa[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x5c503b[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x134280[_0x1f07('0x48')]=_0x134280['attributes'][_0x1f07('0x69')]?_0x134280[_0x1f07('0x48')]:_0x23b8fa[_0x1f07('0xcc')];if(!_0x5c503b['query'][_0x1f07('0xc3')]('nolimit')){_0x134280[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x5c503b['query'][_0x1f07('0x1e')]);_0x134280['offset']=qs[_0x1f07('0x1c')](_0x5c503b['query']['offset']);}_0x134280[_0x1f07('0xd2')]=qs['sort'](_0x5c503b[_0x1f07('0x44')][_0x1f07('0xd3')]);_0x134280[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x5c503b[_0x1f07('0x44')],_0x23b8fa[_0x1f07('0xcf')]));_0x134280[_0x1f07('0xd4')][_0x1f07('0xdd')]=_0x17a540['id'];if(_0x5c503b[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x134280[_0x1f07('0xd4')]=_['merge'](_0x134280['where'],{'$or':_[_0x1f07('0x2d')](_0x134280[_0x1f07('0x48')],function(_0x218a9a){var _0x28602a={};_0x28602a[_0x218a9a]={'$like':'%'+_0x5c503b[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x28602a;})});}_0x134280=_[_0x1f07('0x58')]({},_0x134280,_0x5c503b[_0x1f07('0xd5')]);return db['MailInteraction'][_0x1f07('0x1f')]({'where':_0x134280[_0x1f07('0xd4')]})['then'](function(_0x3495db){_0x3ea168['count']=_0x3495db;if(_0x5c503b[_0x1f07('0x44')][_0x1f07('0x42')]){_0x134280[_0x1f07('0x43')]=[{'all':!![]}];}return db[_0x1f07('0xe4')]['findAll'](_0x134280);})[_0x1f07('0x22')](function(_0x5b6a89){_0x3ea168['rows']=_0x5b6a89;return _0x3ea168;});}})[_0x1f07('0x22')](respondWithFilteredResult(_0x3ffa0b,_0x134280))[_0x1f07('0x56')](handleError(_0x3ffa0b,null));};exports[_0x1f07('0xe5')]=function(_0x4b523e,_0x5115b7){var _0x443aa8={};var _0x5afc02={};var _0x1897b3;var _0x26014f;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x4b523e[_0x1f07('0x57')]['id']}})['then'](handleEntityNotFound(_0x5115b7,null))['then'](function(_0x947ca1){if(_0x947ca1){_0x1897b3=_0x947ca1;_0x5afc02[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xe6')][_0x1f07('0x36')]);_0x5afc02[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x4b523e[_0x1f07('0x44')]);_0x5afc02[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x5afc02[_0x1f07('0xcc')],_0x5afc02['query']);_0x443aa8[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x5afc02[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x4b523e[_0x1f07('0x44')]['fields']));_0x443aa8[_0x1f07('0x48')]=_0x443aa8[_0x1f07('0x48')][_0x1f07('0x69')]?_0x443aa8[_0x1f07('0x48')]:_0x5afc02['model'];_0x443aa8[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x4b523e[_0x1f07('0x44')][_0x1f07('0xd3')]);_0x443aa8[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x4b523e['query'],_0x5afc02['filters']));if(_0x4b523e['query'][_0x1f07('0x3a')]){_0x443aa8[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x443aa8['where'],{'$or':_['map'](_0x443aa8[_0x1f07('0x48')],function(_0x5ed62b){var _0xa7729f={};_0xa7729f[_0x5ed62b]={'$like':'%'+_0x4b523e[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0xa7729f;})});}_0x443aa8=_[_0x1f07('0x58')]({},_0x443aa8,_0x4b523e[_0x1f07('0xd5')]);return _0x1897b3[_0x1f07('0xe5')](_0x443aa8);}})[_0x1f07('0x22')](function(_0x1aeb1e){if(_0x1aeb1e){_0x26014f=_0x1aeb1e['length'];if(!_0x4b523e['query']['hasOwnProperty']('nolimit')){_0x443aa8['limit']=qs[_0x1f07('0x1e')](_0x4b523e['query'][_0x1f07('0x1e')]);_0x443aa8['offset']=qs[_0x1f07('0x1c')](_0x4b523e[_0x1f07('0x44')]['offset']);}return _0x1897b3[_0x1f07('0xe5')](_0x443aa8);}})[_0x1f07('0x22')](function(_0x39de31){if(_0x39de31){return _0x39de31?{'count':_0x26014f,'rows':_0x39de31}:null;}})[_0x1f07('0x22')](respondWithResult(_0x5115b7,null))[_0x1f07('0x56')](handleError(_0x5115b7,null));};exports[_0x1f07('0xe7')]=function(_0x4fb2f0,_0x4fa2ca){var _0x5bf177={};var _0x4ac9d7={};var _0x197ad2;var _0x3b6a0b;return db[_0x1f07('0x4a')]['findOne']({'where':{'id':_0x4fb2f0['params']['id']}})['then'](handleEntityNotFound(_0x4fa2ca,null))[_0x1f07('0x22')](function(_0xc88e29){if(_0xc88e29){_0x197ad2=_0xc88e29;_0x4ac9d7[_0x1f07('0xcc')]=_['keys'](db[_0x1f07('0xe8')][_0x1f07('0x36')]);_0x4ac9d7['query']=_[_0x1f07('0xcd')](_0x4fb2f0[_0x1f07('0x44')]);_0x4ac9d7[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x4ac9d7[_0x1f07('0xcc')],_0x4ac9d7['query']);_0x5bf177[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x4ac9d7[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x4fb2f0[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x5bf177[_0x1f07('0x48')]=_0x5bf177['attributes'][_0x1f07('0x69')]?_0x5bf177[_0x1f07('0x48')]:_0x4ac9d7['model'];_0x5bf177[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x4fb2f0['query'][_0x1f07('0xd3')]);_0x5bf177[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x4fb2f0[_0x1f07('0x44')],_0x4ac9d7[_0x1f07('0xcf')]));if(_0x4fb2f0['query']['filter']){_0x5bf177[_0x1f07('0xd4')]=_['merge'](_0x5bf177[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x5bf177[_0x1f07('0x48')],function(_0x300085){var _0x399a4f={};_0x399a4f[_0x300085]={'$like':'%'+_0x4fb2f0[_0x1f07('0x44')][_0x1f07('0x3a')]+'%'};return _0x399a4f;})});}_0x5bf177=_[_0x1f07('0x58')]({},_0x5bf177,_0x4fb2f0[_0x1f07('0xd5')]);return _0x197ad2[_0x1f07('0xe7')](_0x5bf177);}})[_0x1f07('0x22')](function(_0x32360f){if(_0x32360f){_0x3b6a0b=_0x32360f[_0x1f07('0x69')];if(!_0x4fb2f0[_0x1f07('0x44')]['hasOwnProperty'](_0x1f07('0xd8'))){_0x5bf177['limit']=qs[_0x1f07('0x1e')](_0x4fb2f0[_0x1f07('0x44')][_0x1f07('0x1e')]);_0x5bf177[_0x1f07('0x1c')]=qs['offset'](_0x4fb2f0[_0x1f07('0x44')][_0x1f07('0x1c')]);}return _0x197ad2[_0x1f07('0xe7')](_0x5bf177);}})['then'](function(_0x421d3e){if(_0x421d3e){return _0x421d3e?{'count':_0x3b6a0b,'rows':_0x421d3e}:null;}})[_0x1f07('0x22')](respondWithResult(_0x4fa2ca,null))[_0x1f07('0x56')](handleError(_0x4fa2ca,null));};exports[_0x1f07('0xe9')]=function(_0x52ac46,_0x285444){var _0x594e43={};var _0x56b4ec={};var _0x55f7f9;var _0x26f3a8;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x52ac46['params']['id']}})['then'](handleEntityNotFound(_0x285444,null))[_0x1f07('0x22')](function(_0x3f15de){if(_0x3f15de){_0x55f7f9=_0x3f15de;_0x56b4ec[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xea')][_0x1f07('0x36')]);_0x56b4ec[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x52ac46[_0x1f07('0x44')]);_0x56b4ec[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x56b4ec['model'],_0x56b4ec[_0x1f07('0x44')]);_0x594e43['attributes']=_[_0x1f07('0xd0')](_0x56b4ec[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x52ac46[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x594e43[_0x1f07('0x48')]=_0x594e43[_0x1f07('0x48')][_0x1f07('0x69')]?_0x594e43['attributes']:_0x56b4ec[_0x1f07('0xcc')];_0x594e43['order']=qs[_0x1f07('0xd3')](_0x52ac46[_0x1f07('0x44')]['sort']);_0x594e43['where']=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x52ac46[_0x1f07('0x44')],_0x56b4ec[_0x1f07('0xcf')]));if(_0x52ac46[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x594e43[_0x1f07('0xd4')]=_['merge'](_0x594e43[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0x594e43[_0x1f07('0x48')],function(_0x262c9f){var _0x533079={};_0x533079[_0x262c9f]={'$like':'%'+_0x52ac46['query'][_0x1f07('0x3a')]+'%'};return _0x533079;})});}_0x594e43=_[_0x1f07('0x58')]({},_0x594e43,_0x52ac46[_0x1f07('0xd5')]);return _0x55f7f9['getWhatsappInteractions'](_0x594e43);}})[_0x1f07('0x22')](function(_0x57cc0c){if(_0x57cc0c){_0x26f3a8=_0x57cc0c[_0x1f07('0x69')];if(!_0x52ac46[_0x1f07('0x44')][_0x1f07('0xc3')](_0x1f07('0xd8'))){_0x594e43[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x52ac46['query'][_0x1f07('0x1e')]);_0x594e43[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x52ac46[_0x1f07('0x44')][_0x1f07('0x1c')]);}return _0x55f7f9[_0x1f07('0xe9')](_0x594e43);}})['then'](function(_0x683262){if(_0x683262){return _0x683262?{'count':_0x26f3a8,'rows':_0x683262}:null;}})[_0x1f07('0x22')](respondWithResult(_0x285444,null))['catch'](handleError(_0x285444,null));};exports[_0x1f07('0xeb')]=function(_0x5497fe,_0x40b777,_0x2bf02f){var _0x2f265c;var _0x240984;var _0x202e13;var _0x3ca8aa=!_[_0x1f07('0x64')](_0x5497fe[_0x1f07('0x57')]['id'])?_0x5497fe[_0x1f07('0x57')]['id']:!_['isNil'](_0x5497fe['user']['id'])?_0x5497fe[_0x1f07('0x29')]['id']:null;return db[_0x1f07('0x4a')]['find']({'where':{'id':_0x3ca8aa,'role':{'$or':['admin','user',_0x1f07('0x7d')]}},'attributes':['id','name','phone',_0x1f07('0xec'),_0x1f07('0x27'),_0x1f07('0x5e'),_0x1f07('0x9a')]})[_0x1f07('0x22')](function(_0x4a823e){if(_0x4a823e){if(_0x4a823e[_0x1f07('0x27')]===_0x1f07('0x7d')){_0x2f265c=_0x4a823e;if(_0x5497fe[_0x1f07('0x59')]['interface']){_0x202e13=util[_0x1f07('0xc1')](_0x1f07('0xed'),_0x2f265c[_0x5497fe[_0x1f07('0x59')][_0x1f07('0x9c')]]);}else if(_0x5497fe['body'][_0x1f07('0xee')]){_0x202e13=util[_0x1f07('0xc1')](_0x1f07('0xa5'),_0x5497fe[_0x1f07('0x59')][_0x1f07('0xee')]);}else{_0x202e13=util[_0x1f07('0xc1')](_0x1f07('0xa5'),_0x2f265c['name']);}socket['to'](util['format'](_0x1f07('0xef'),_0x2f265c['name']))[_0x1f07('0x23')](_0x1f07('0xf0'),{'user':{'id':_0x2f265c['id'],'name':_0x2f265c[_0x1f07('0x31')]},'ip':_0x5497fe[_0x1f07('0xf1')]['x-forwarded-for']||_0x5497fe['connection'][_0x1f07('0xf2')]||_0x5497fe[_0x1f07('0xf3')][_0x1f07('0xf2')]||_0x5497fe[_0x1f07('0xf4')][_0x1f07('0xf3')][_0x1f07('0xf2')]});return db[_0x1f07('0xa7')][_0x1f07('0x25')]({'where':{'membername':_0x2f265c[_0x1f07('0x31')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x1f07('0x22')](function(){if(_0x2f265c){return _0x2f265c[_0x1f07('0xf5')]({'raw':!![]});}})[_0x1f07('0x22')](function(_0x5daabb){if(_0x2f265c){if(_0x5daabb){_0x240984=_0x5daabb;if(_0x240984[_0x1f07('0x69')]){var _0x50ec59=_0x240984[_0x1f07('0x2d')](function(_0x3745e2){var _0xf2f789={'membername':_0x2f265c[_0x1f07('0x31')],'UserId':_0x2f265c['id'],'queue_name':_0x3745e2[_0x1f07('0x31')],'VoiceQueueId':_0x3745e2['id'],'interface':_0x202e13,'paused':_0x2f265c[_0x1f07('0x9a')]||![],'penalty':_0x3745e2[_0x1f07('0xf6')]||0x0};return db[_0x1f07('0xa7')][_0x1f07('0xf7')](_0xf2f789);});return Promise[_0x1f07('0x55')](_0x50ec59);}}}})[_0x1f07('0x22')](function(){if(_0x2f265c){return db[_0x1f07('0xf8')][_0x1f07('0x4b')]({'where':{'membername':_0x2f265c[_0x1f07('0x31')],'exitAt':null}});}})[_0x1f07('0x22')](function(_0xed74d9){if(_0x2f265c){var _0x5c6c39=[];_0xed74d9['forEach'](function(_0x15ec48){_0x5c6c39['push'](_0x15ec48['update']({'exitAt':moment()[_0x1f07('0xc1')](_0x1f07('0xf9'))}));});return Promise[_0x1f07('0x55')](_0x5c6c39);}})[_0x1f07('0x22')](function(){if(_0x2f265c){var _0x40fada=[];var _0x3b8e6a=[];var _0x49b63a=utils[_0x1f07('0xfa')]();var _0xc1f635={'membername':_0x2f265c[_0x1f07('0x31')],'interface':_0x202e13,'enterAt':moment()[_0x1f07('0xc1')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2f265c[_0x1f07('0x27')],'internal':_0x2f265c['internal']};_0x49b63a['forEach'](function(_0x177373){_0x40fada[_0x1f07('0x49')](_[_0x1f07('0x58')]({'channel':_0x177373,'type':_0x1f07('0xfb'),'data1':_0x5497fe[_0x1f07('0x59')][_0x1f07('0xfc')],'data2':_0x202e13},_0xc1f635));if(_0x2f265c['loginInPause']){_0x3b8e6a[_0x1f07('0x49')](_[_0x1f07('0x58')]({'channel':_0x177373,'type':'PAUSE','data1':'LOGININPAUSE'},_0xc1f635));}});return db['MemberReport'][_0x1f07('0x87')](_0x40fada[_0x1f07('0xbe')](_0x3b8e6a),{'individualHooks':!![]});}})[_0x1f07('0x22')](function(){if(_0x2f265c){return _0x2f265c[_0x1f07('0x21')]({'online':!![],'lastLoginAt':moment()['format'](_0x1f07('0xf9')),'voicePause':_0x2f265c[_0x1f07('0x9a')]||![],'mailPause':_0x2f265c[_0x1f07('0x9a')]||![],'chatPause':_0x2f265c['loginInPause']||![],'faxPause':_0x2f265c['loginInPause']||![],'smsPause':_0x2f265c[_0x1f07('0x9a')]||![],'openchannelPause':_0x2f265c[_0x1f07('0x9a')]||![],'whatsappPause':_0x2f265c['loginInPause']||![],'pauseType':_0x2f265c[_0x1f07('0x9a')]?_0x1f07('0xfd'):null,'interface':_0x202e13,'lastPauseAt':moment()[_0x1f07('0xc1')](_0x1f07('0xf9'))});}})[_0x1f07('0x22')](function(_0x36a468){if(_0x5497fe[_0x1f07('0xfe')]){return _0x2bf02f();}else{return Promise[_0x1f07('0xff')](_0x36a468)[_0x1f07('0x22')](respondWithResult(_0x40b777,null));}})['catch'](handleError(_0x40b777,null));};exports[_0x1f07('0x100')]=function(_0x3d4bd9,_0x2d5411){var _0x5245c9;return db[_0x1f07('0x4a')][_0x1f07('0x30')]({'where':{'id':_0x3d4bd9[_0x1f07('0x57')]['id'],'role':'agent'},'attributes':['id',_0x1f07('0x31'),_0x1f07('0x27')]})[_0x1f07('0x22')](handleEntityNotFound(_0x2d5411,null))[_0x1f07('0x22')](function(_0x416be3){if(_0x416be3){_0x5245c9=_0x416be3;return db[_0x1f07('0xa7')]['destroy']({'where':{'membername':_0x5245c9[_0x1f07('0x31')]},'individualHooks':!![]});}})[_0x1f07('0x22')](function(){return db[_0x1f07('0xf8')][_0x1f07('0x4b')]({'where':{'membername':_0x5245c9[_0x1f07('0x31')],'exitAt':null}});})['then'](function(_0x1d10fe){var _0x4ff1a9=[];_0x1d10fe[_0x1f07('0x101')](function(_0x5111f6){_0x4ff1a9[_0x1f07('0x49')](_0x5111f6[_0x1f07('0x21')]({'exitAt':moment()[_0x1f07('0xc1')](_0x1f07('0xf9'))}));});return Promise['all'](_0x4ff1a9);})[_0x1f07('0x22')](function(){return _0x5245c9[_0x1f07('0x21')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x1f07('0x22')](respondWithResult(_0x2d5411,null))[_0x1f07('0x56')](handleError(_0x2d5411,null));};exports['pause']=function(_0x1ec8cb,_0x54ca30){var _0x3e610e;return db[_0x1f07('0xa7')][_0x1f07('0x21')]({'paused':0x1},{'where':{'UserId':_0x1ec8cb['params']['id']},'individualHooks':!![]})[_0x1f07('0x22')](function(){return db[_0x1f07('0x4a')]['find']({'where':{'id':_0x1ec8cb['params']['id'],'role':_0x1f07('0x7d')},'attributes':['id',_0x1f07('0x31'),_0x1f07('0x27'),_0x1f07('0x5e'),_0x1f07('0x9c'),_0x1f07('0x99')]});})['then'](handleEntityNotFound(_0x54ca30,null))[_0x1f07('0x22')](function(_0xb6ac94){if(_0xb6ac94){_0x3e610e=_0xb6ac94;return db['MemberReport'][_0x1f07('0x4b')]({'where':{'membername':_0x3e610e[_0x1f07('0x31')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x39aac7){if(_0x39aac7[_0x1f07('0x69')]){var _0x296bcb=moment()[_0x1f07('0xc1')](_0x1f07('0xf9'));for(var _0x543122=0x0,_0x3ce9c3=_0x39aac7['length'];_0x543122<_0x3ce9c3;_0x543122++){_0x39aac7[_0x543122]['updateAttributes']({'exitAt':_0x296bcb});}}})['then'](function(){var _0x4d32aa=[];var _0x3444e6=utils[_0x1f07('0xfa')]();_0x3444e6[_0x1f07('0x101')](function(_0x42f052){_0x4d32aa[_0x1f07('0x49')]({'channel':_0x42f052,'membername':_0x3e610e[_0x1f07('0x31')],'interface':_[_0x1f07('0x64')](_0x3e610e[_0x1f07('0x9c')])?util['format'](_0x1f07('0xa5'),_0x3e610e['name']):_0x3e610e[_0x1f07('0x9c')],'type':_0x1f07('0x102'),'enterAt':moment()[_0x1f07('0xc1')](_0x1f07('0xf9')),'data1':_0x1ec8cb['body'][_0x1f07('0x38')]||'DEFAULT\x20PAUSE','role':_0x3e610e[_0x1f07('0x27')],'internal':_0x3e610e[_0x1f07('0x5e')]});});return db[_0x1f07('0xf8')][_0x1f07('0x87')](_0x4d32aa,{'individualHooks':!![]});})[_0x1f07('0x22')](function(){return _0x3e610e[_0x1f07('0x21')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1ec8cb['body'][_0x1f07('0x38')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x1f07('0xc1')](_0x1f07('0xf9'))});})[_0x1f07('0x22')](respondWithResult(_0x54ca30,null))['catch'](handleError(_0x54ca30,null));};exports[_0x1f07('0x103')]=function(_0x2d1288,_0x132af7){if(_0x2d1288[_0x1f07('0x59')][_0x1f07('0x98')]&&!utils[_0x1f07('0x9d')](_0x2d1288[_0x1f07('0x59')][_0x1f07('0x98')])){throw new APIBadRequestError(util[_0x1f07('0xc1')](_0x1f07('0x104'),_0x2d1288['body']['channel']));}return db[_0x1f07('0x4a')]['find']({'where':{'id':_0x2d1288[_0x1f07('0x57')]['id']},'attributes':['id',_0x1f07('0x31'),_0x1f07('0x27'),_0x1f07('0x5e'),_0x1f07('0x9c'),'online','voicePause','mailPause',_0x1f07('0x105'),_0x1f07('0x106'),_0x1f07('0x107'),_0x1f07('0x108'),_0x1f07('0x109'),'pauseType',_0x1f07('0x10a')]})[_0x1f07('0x22')](function(_0x33ce6c){if(!_0x33ce6c){throw new APINotFoundError(util[_0x1f07('0xc1')](_0x1f07('0xc2'),_0x2d1288['params']['id']));}return _0x33ce6c[_0x1f07('0x103')](_0x2d1288[_0x1f07('0x59')][_0x1f07('0x98')]);})['then'](respondWithResult(_0x132af7,null))[_0x1f07('0x56')](APIHandleError(_0x132af7));};exports[_0x1f07('0x10b')]=function(_0x458daa,_0x1d6c6a){var _0x36a6ae={};var _0x29c875={};var _0x394f48;var _0x13a0ce;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x458daa[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x1d6c6a,null))[_0x1f07('0x22')](function(_0x5278ca){if(_0x5278ca){_0x394f48=_0x5278ca;_0x29c875[_0x1f07('0xcc')]=_['keys'](db['Team']['rawAttributes']);_0x29c875['query']=_[_0x1f07('0xcd')](_0x458daa[_0x1f07('0x44')]);_0x29c875[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x29c875[_0x1f07('0xcc')],_0x29c875[_0x1f07('0x44')]);_0x36a6ae[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x29c875[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x458daa['query']['fields']));_0x36a6ae[_0x1f07('0x48')]=_0x36a6ae[_0x1f07('0x48')]['length']?_0x36a6ae[_0x1f07('0x48')]:_0x29c875[_0x1f07('0xcc')];_0x36a6ae[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x458daa['query']['sort']);_0x36a6ae['where']=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x458daa[_0x1f07('0x44')],_0x29c875[_0x1f07('0xcf')]));if(_0x458daa[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x36a6ae[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0x36a6ae[_0x1f07('0xd4')],{'$or':_['map'](_0x36a6ae[_0x1f07('0x48')],function(_0x36b937){var _0x3b21dc={};_0x3b21dc[_0x36b937]={'$like':'%'+_0x458daa[_0x1f07('0x44')]['filter']+'%'};return _0x3b21dc;})});}_0x36a6ae=_['merge']({},_0x36a6ae,_0x458daa['options']);return _0x394f48[_0x1f07('0x10b')](_0x36a6ae);}})['then'](function(_0x4ea400){if(_0x4ea400){_0x13a0ce=_0x4ea400[_0x1f07('0x69')];if(!_0x458daa[_0x1f07('0x44')]['hasOwnProperty'](_0x1f07('0xd8'))){_0x36a6ae['limit']=qs[_0x1f07('0x1e')](_0x458daa[_0x1f07('0x44')][_0x1f07('0x1e')]);_0x36a6ae['offset']=qs['offset'](_0x458daa['query'][_0x1f07('0x1c')]);}return _0x394f48[_0x1f07('0x10b')](_0x36a6ae);}})[_0x1f07('0x22')](function(_0xd3034d){if(_0xd3034d){return _0xd3034d?{'count':_0x13a0ce,'rows':_0xd3034d}:null;}})[_0x1f07('0x22')](respondWithResult(_0x1d6c6a,null))[_0x1f07('0x56')](handleError(_0x1d6c6a,null));};exports[_0x1f07('0x10c')]=function(_0x5d24c5,_0x58d27e){var _0x4776c3=_0x5d24c5[_0x1f07('0x57')]['id'];var _0x16ce39=_0x5d24c5[_0x1f07('0x59')]?_0x5d24c5[_0x1f07('0x59')][_0x1f07('0x5c')]:null;var _0x4f9baa=[];return Promise['resolve']()[_0x1f07('0x22')](function(){if(!_0x16ce39)throw new APIBadRequestError(_0x1f07('0x10d'));})[_0x1f07('0x22')](function(){return db['User'][_0x1f07('0xc0')]({'where':{'id':_0x4776c3}});})[_0x1f07('0x22')](function(_0x2f0d45){if(!_0x2f0d45)throw new APINotFoundError(util[_0x1f07('0xc1')](_0x1f07('0xc2'),_0x5d24c5[_0x1f07('0x57')]['id']));return db[_0x1f07('0x66')][_0x1f07('0x10e')](function(_0x1aee77){return _0x2f0d45[_0x1f07('0x10c')](_0x16ce39,{'transaction':_0x1aee77})[_0x1f07('0x22')](function(){return db[_0x1f07('0x10f')][_0x1f07('0x4b')]({'where':{'id':{'$in':_0x16ce39}}});})[_0x1f07('0x22')](function(_0x18dac2){var _0x152a55=_[_0x1f07('0x2d')](_0x18dac2,function(_0x5f9fdd){return _0x5f9fdd[_0x1f07('0x110')]();});return Promise[_0x1f07('0x55')](_0x152a55);})['then'](function(_0x185bfc){_0x4f9baa=_[_0x1f07('0x111')](_0x185bfc);var _0x417d9c=_[_0x1f07('0x2d')](_0x4f9baa,function(_0x16a570){return _0x16a570[_0x1f07('0x112')](_0x2f0d45['id'],{'transaction':_0x1aee77});});return Promise[_0x1f07('0x55')](_0x417d9c);})[_0x1f07('0x22')](function(){if(!_0x2f0d45[_0x1f07('0x99')])return;var _0x2485ba=_['filter'](_0x4f9baa,function(_0x323794){return _0x323794['getDataValue'](_0x1f07('0x98'))===_0x1f07('0x113');});var _0x4daaf8=_[_0x1f07('0x2d')](_0x2485ba,function(_0x358164){return db[_0x1f07('0xa7')]['upsert']({'membername':_0x2f0d45[_0x1f07('0x31')],'UserId':_0x2f0d45['id'],'queue_name':_0x358164['name'],'VoiceQueueId':_0x358164['id'],'interface':_[_0x1f07('0x64')](_0x2f0d45[_0x1f07('0x9c')])?util[_0x1f07('0xc1')]('SIP/%s',_0x2f0d45['name']):_0x2f0d45[_0x1f07('0x9c')],'paused':_0x2f0d45[_0x1f07('0x9b')]||![],'penalty':_0x2f0d45[_0x1f07('0xa6')]},{'transaction':_0x1aee77});});return Promise['all'](_0x4daaf8);})[_0x1f07('0x22')](function(){return db[_0x1f07('0x114')][_0x1f07('0x4b')]({'where':{'teamId':{'$in':_0x16ce39}}});})[_0x1f07('0x22')](function(_0x48882b){var _0x40ce2a=_[_0x1f07('0x2d')](_0x48882b,function(_0x47e38c){return db[_0x1f07('0x115')][_0x1f07('0x7c')]({'UserId':_0x2f0d45['id'],'VoicePrefixId':_0x47e38c[_0x1f07('0x116')]},{'transaction':_0x1aee77});});return Promise[_0x1f07('0x55')](_0x40ce2a);});});})['then'](function(){for(var _0x1c76ac=0x0;_0x1c76ac<_0x4f9baa[_0x1f07('0x69')];_0x1c76ac++){var _0x5c6508=_0x4f9baa[_0x1c76ac]['getDataValue'](_0x1f07('0x98'));var _0x56ca73=_0x5c6508+_0x1f07('0xa1');socket[_0x1f07('0x23')](_0x1f07('0x29')+_0x5c6508+_0x1f07('0xa2'),{'UserId':_0x4776c3,['queueField']:_0x4f9baa[_0x1c76ac]['id']});}})[_0x1f07('0x22')](respondWithStatusCode(_0x58d27e,null))[_0x1f07('0x56')](APIHandleError(_0x58d27e));};exports[_0x1f07('0x117')]=function(_0x4792a7,_0x5ab837){var _0x448e03=_0x4792a7[_0x1f07('0x57')]['id'];var _0x1b9645=null;if(_0x4792a7[_0x1f07('0x44')][_0x1f07('0x5c')]){_0x1b9645=_[_0x1f07('0xaa')](_0x4792a7[_0x1f07('0x44')]['ids'])?_0x4792a7[_0x1f07('0x44')][_0x1f07('0x5c')]:[_0x4792a7[_0x1f07('0x44')]['ids']];}var _0x515f00=[];return Promise[_0x1f07('0xff')]()[_0x1f07('0x22')](function(){if(!_0x1b9645)throw new APIBadRequestError(_0x1f07('0x118'));})[_0x1f07('0x22')](function(){return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x448e03}});})[_0x1f07('0x22')](function(_0x115e99){if(!_0x115e99)throw new APINotFoundError(util['format'](_0x1f07('0xc2'),_0x4792a7[_0x1f07('0x57')]['id']));return db[_0x1f07('0x66')][_0x1f07('0x10e')](function(_0x58ded0){return _0x115e99[_0x1f07('0x117')](_0x1b9645,{'transaction':_0x58ded0})[_0x1f07('0x22')](function(){return db['Team'][_0x1f07('0x4b')]({'where':{'id':{'$in':_0x1b9645}}});})[_0x1f07('0x22')](function(_0x211dbc){var _0x270e96=_[_0x1f07('0x2d')](_0x211dbc,function(_0x2d8f72){return _0x2d8f72[_0x1f07('0x110')]();});return Promise[_0x1f07('0x55')](_0x270e96);})[_0x1f07('0x22')](function(_0x491085){_0x515f00=_[_0x1f07('0x111')](_0x491085);var _0x2fa058=_[_0x1f07('0x2d')](_0x515f00,function(_0xc73ba7){return _0xc73ba7[_0x1f07('0x119')](_0x115e99['id'],{'transaction':_0x58ded0});});return Promise['all'](_0x2fa058);})['then'](function(){if(!_0x115e99[_0x1f07('0x99')])return;var _0x1e39a1=_[_0x1f07('0x3a')](_0x515f00,function(_0x366c21){return _0x366c21[_0x1f07('0x11a')]('channel')===_0x1f07('0x113');});var _0x5e8d0f=_[_0x1f07('0x2d')](_0x1e39a1,function(_0x56d116){return db[_0x1f07('0xa7')][_0x1f07('0x25')]({'where':{'VoiceQueueId':_0x56d116['id'],'UserId':_0x115e99['id']},'transaction':_0x58ded0});});return Promise['all'](_0x5e8d0f);})['then'](function(){return db[_0x1f07('0x114')][_0x1f07('0x4b')]({'where':{'teamId':{'$in':_0x1b9645}}});})['then'](function(_0x1b76e6){var _0x2feb6c=_[_0x1f07('0x2d')](_0x1b76e6,function(_0x4b317c){return db[_0x1f07('0x115')]['destroy']({'where':{'UserId':_0x115e99['id'],'VoicePrefixId':_0x4b317c['VoicePrefixId']}},{'transaction':_0x58ded0});});return Promise['all'](_0x2feb6c);});});})['then'](function(){for(var _0x3b996e=0x0;_0x3b996e<_0x515f00[_0x1f07('0x69')];_0x3b996e++){var _0x9029a5=_0x515f00[_0x3b996e][_0x1f07('0x11a')]('channel');var _0x78918e=_0x9029a5+_0x1f07('0xa1');socket[_0x1f07('0x23')](_0x1f07('0x29')+_0x9029a5+_0x1f07('0xab'),{'UserId':_0x448e03,['queueField']:_0x515f00[_0x3b996e]['id']});}})['then'](respondWithStatusCode(_0x5ab837,null))[_0x1f07('0x56')](APIHandleError(_0x5ab837));};exports[_0x1f07('0x11b')]=function(_0x289e31,_0x3ef9b5){var _0x1309e0={};var _0x292446={};var _0xa123a8;var _0x5515b4;return db[_0x1f07('0x4a')]['findOne']({'where':{'id':_0x289e31[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x3ef9b5,null))[_0x1f07('0x22')](function(_0x2e1caa){if(_0x2e1caa){_0xa123a8=_0x2e1caa;_0x292446[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db[_0x1f07('0xc4')][_0x1f07('0x36')]);_0x292446[_0x1f07('0x44')]=_[_0x1f07('0xcd')](_0x289e31[_0x1f07('0x44')]);_0x292446[_0x1f07('0xcf')]=_[_0x1f07('0xd0')](_0x292446['model'],_0x292446['query']);_0x1309e0[_0x1f07('0x48')]=_[_0x1f07('0xd0')](_0x292446[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x289e31[_0x1f07('0x44')][_0x1f07('0xd1')]));_0x1309e0[_0x1f07('0x48')]=_0x1309e0['attributes'][_0x1f07('0x69')]?_0x1309e0[_0x1f07('0x48')]:_0x292446[_0x1f07('0xcc')];_0x1309e0[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x289e31['query'][_0x1f07('0xd3')]);_0x1309e0[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x289e31[_0x1f07('0x44')],_0x292446[_0x1f07('0xcf')]));if(_0x289e31[_0x1f07('0x44')][_0x1f07('0x3a')]){_0x1309e0['where']=_[_0x1f07('0x58')](_0x1309e0['where'],{'$or':_[_0x1f07('0x2d')](_0x1309e0[_0x1f07('0x48')],function(_0x20b381){var _0x158b25={};_0x158b25[_0x20b381]={'$like':'%'+_0x289e31['query'][_0x1f07('0x3a')]+'%'};return _0x158b25;})});}_0x1309e0=_['merge']({},_0x1309e0,_0x289e31[_0x1f07('0xd5')]);return _0xa123a8[_0x1f07('0x11b')](_0x1309e0);}})[_0x1f07('0x22')](function(_0x58c756){if(_0x58c756){_0x5515b4=_0x58c756[_0x1f07('0x69')];if(!_0x289e31['query'][_0x1f07('0xc3')](_0x1f07('0xd8'))){_0x1309e0[_0x1f07('0x1e')]=qs[_0x1f07('0x1e')](_0x289e31[_0x1f07('0x44')]['limit']);_0x1309e0[_0x1f07('0x1c')]=qs[_0x1f07('0x1c')](_0x289e31['query']['offset']);}return _0xa123a8[_0x1f07('0x11b')](_0x1309e0);}})[_0x1f07('0x22')](function(_0x54e45d){if(_0x54e45d){return _0x54e45d?{'count':_0x5515b4,'rows':_0x54e45d}:null;}})['then'](respondWithResult(_0x3ef9b5,null))[_0x1f07('0x56')](handleError(_0x3ef9b5,null));};exports[_0x1f07('0x11c')]=function(_0x2e7f04,_0x4228ab){var _0xb95aa={};var _0x392b62={};var _0x35412c;return db[_0x1f07('0x4a')][_0x1f07('0xc0')]({'where':{'id':_0x2e7f04[_0x1f07('0x57')]['id']}})[_0x1f07('0x22')](handleEntityNotFound(_0x4228ab,null))[_0x1f07('0x22')](function(_0xda6c3){if(_0xda6c3){_0x35412c=_0xda6c3;_0x392b62[_0x1f07('0xcc')]=_[_0x1f07('0xcd')](db['User'][_0x1f07('0x36')]);_0x392b62[_0x1f07('0x44')]=_['keys'](_0x2e7f04[_0x1f07('0x44')]);_0x392b62[_0x1f07('0xcf')]=_['intersection'](_0x392b62[_0x1f07('0xcc')],_0x392b62[_0x1f07('0x44')]);_0xb95aa[_0x1f07('0x48')]=_['intersection'](_0x392b62[_0x1f07('0xcc')],qs[_0x1f07('0xd1')](_0x2e7f04[_0x1f07('0x44')][_0x1f07('0xd1')]));_0xb95aa[_0x1f07('0x48')]=_0xb95aa[_0x1f07('0x48')][_0x1f07('0x69')]?_0xb95aa[_0x1f07('0x48')]:_0x392b62[_0x1f07('0xcc')];_0xb95aa[_0x1f07('0xd2')]=qs[_0x1f07('0xd3')](_0x2e7f04[_0x1f07('0x44')]['sort']);_0xb95aa[_0x1f07('0xd4')]=qs[_0x1f07('0xcf')](_[_0x1f07('0xd7')](_0x2e7f04[_0x1f07('0x44')],_0x392b62[_0x1f07('0xcf')]));if(_0x2e7f04[_0x1f07('0x44')][_0x1f07('0x3a')]){_0xb95aa[_0x1f07('0xd4')]=_[_0x1f07('0x58')](_0xb95aa[_0x1f07('0xd4')],{'$or':_[_0x1f07('0x2d')](_0xb95aa[_0x1f07('0x48')],function(_0x503dd9){var _0x1f13ef={};_0x1f13ef[_0x503dd9]={'$like':'%'+_0x2e7f04['query']['filter']+'%'};return _0x1f13ef;})});}_0xb95aa[_0x1f07('0xcc')]=db[_0x1f07('0x4a')];_0xb95aa['as']=_0x1f07('0x2a');_0xb95aa=_[_0x1f07('0x58')]({},_0xb95aa,_0x2e7f04['options']);return _0x35412c[_0x1f07('0xf5')]({'include':[_0xb95aa]});}})[_0x1f07('0x22')](function(_0x4ed93d){if(_0x4ed93d){var _0x5e45fc={},_0x11e2ab=[];for(var _0x9e7f6c=0x0;_0x9e7f6c<_0x4ed93d[_0x1f07('0x69')];_0x9e7f6c+=0x1){for(var _0x25f667=0x0,_0x64e3d1;_0x25f667<_0x4ed93d[_0x9e7f6c][_0x1f07('0x2a')]['length'];_0x25f667+=0x1){_0x64e3d1=_0x4ed93d[_0x9e7f6c]['Agents'][_0x25f667][_0x1f07('0x26')]({'plain':!![]});_0x5e45fc[_0x64e3d1['id']]=_0x64e3d1;}}_0x5e45fc=_['values'](_0x5e45fc);for(var _0x5102ed=qs['offset'](_0x2e7f04[_0x1f07('0x44')][_0x1f07('0x1c')]);_0x5102ed<_0x5e45fc[_0x1f07('0x69')]&&_0x11e2ab[_0x1f07('0x69')]=_0x4d2112){_0x45c5e0=_0x4d2112;_0x132fbb=0xc8;}else{_0x132fbb=0xce;}_0x3c2095[_0x9a9e('0x16')](_0x132fbb);return _0x3c2095[_0x9a9e('0x1c')](_0x9a9e('0x1d'),_0x34f20f+'-'+_0x45c5e0+'/'+_0x4d2112)[_0x9a9e('0x1e')](_0x5006e5);}return null;};}function saveUpdates(_0x2652e7){return function(_0x24b06c){if(_0x24b06c){return _0x24b06c[_0x9a9e('0x1f')](_0x2652e7)[_0x9a9e('0x20')](function(_0x2ad965){if(_0x2ad965[_0x9a9e('0x21')]===_0x9a9e('0x22')){socket[_0x9a9e('0x23')](_0x9a9e('0x24')+_0x2ad965['id'],_0x2ad965);}return _0x2ad965;});}return null;};}function removeEntity(_0x4b1c7f){return function(_0x49174a){if(_0x49174a){return _0x49174a[_0x9a9e('0x25')]()['then'](function(){var _0x52bd16=_0x49174a[_0x9a9e('0x26')]({'plain':!![]});if(_0x52bd16[_0x9a9e('0x21')]==='admin')return;var _0x2b1d07=[{'name':_0x9a9e('0x27'),'value':_0x9a9e('0x28'),'ignore':!![]},{'name':_0x9a9e('0x29'),'value':_0x9a9e('0x22'),'ignore':![]},{'name':_0x9a9e('0x2a'),'value':_0x9a9e('0x2b'),'ignore':![]}];var _0x537e55=_(_0x2b1d07)['filter'](_0x9a9e('0x2c'))[_0x9a9e('0x2d')]('value')[_0x9a9e('0x2e')]();if(_[_0x9a9e('0x2f')](_0x537e55,_0x52bd16[_0x9a9e('0x21')])){return;}var _0x187892=_[_0x9a9e('0x30')](_0x2b1d07,[_0x9a9e('0x2e'),_0x52bd16[_0x9a9e('0x21')]])[_0x9a9e('0x31')];return db['UserProfileResource'][_0x9a9e('0x25')]({'where':{'type':_0x187892,'resourceId':_0x52bd16['id']}})[_0x9a9e('0x20')](function(){return _0x49174a;});})[_0x9a9e('0x20')](function(){_0x4b1c7f['status'](0xcc)[_0x9a9e('0x17')]();});}};}function handleEntityNotFound(_0x10a633){return function(_0x58f70c){if(!_0x58f70c){_0x10a633['sendStatus'](0x194);}return _0x58f70c;};}function handleError(_0x180be5,_0x47533e){_0x47533e=_0x47533e||0x1f4;return function(_0x3c196b){logger['error'](_0x3c196b['stack']);if(_0x3c196b[_0x9a9e('0x31')]){delete _0x3c196b[_0x9a9e('0x31')];}_0x180be5[_0x9a9e('0x16')](_0x47533e)[_0x9a9e('0x32')](_0x3c196b);};}function getUserAttributes(){return _(db['User']['rawAttributes'])[_0x9a9e('0x2d')](function(_0x329c68){return{'name':_0x329c68[_0x9a9e('0x33')],'type':_0x329c68[_0x9a9e('0x34')][_0x9a9e('0x35')]};})[_0x9a9e('0x36')](function(_0x59ecaa){return!['password',_0x9a9e('0x37'),_0x9a9e('0x38'),_0x9a9e('0x39'),_0x9a9e('0x3a'),_0x9a9e('0x3b')][_0x9a9e('0x2f')](_0x59ecaa[_0x9a9e('0x31')]);})[_0x9a9e('0x2e')]();}exports[_0x9a9e('0x3c')]=function(_0x264a39,_0x31dc82){var _0x517c7e={},_0x3e7edf={'count':0x0,'rows':[]};var _0x2b6574=getUserAttributes();_0x517c7e=qs[_0x9a9e('0x3d')](_0x2b6574,_0x264a39);var _0x440285={'where':_0x517c7e[_0x9a9e('0x3e')]};return db[_0x9a9e('0x3f')][_0x9a9e('0x1b')](_0x440285)[_0x9a9e('0x20')](function(_0x49a500){_0x3e7edf['count']=_0x49a500;if(_0x264a39['query'][_0x9a9e('0x40')]){_0x517c7e[_0x9a9e('0x41')]=[{'all':!![]}];}if(_0x264a39[_0x9a9e('0x42')][_0x9a9e('0x43')]===_0x9a9e('0x44')){_0x517c7e[_0x9a9e('0x41')]=[{'model':db[_0x9a9e('0x45')],'as':_0x9a9e('0x43')}];}if(!_['includes'](_0x517c7e[_0x9a9e('0x46')],'id')){_0x517c7e[_0x9a9e('0x46')][_0x9a9e('0x47')]('id');}return db[_0x9a9e('0x3f')][_0x9a9e('0x48')](_0x517c7e);})[_0x9a9e('0x20')](function(_0x1f3986){_0x3e7edf[_0x9a9e('0x49')]=_0x1f3986;if(_0x264a39['query'][_0x9a9e('0x4a')]===_0x9a9e('0x44')){var _0x3de245=[];for(var _0x49a2a1=0x0;_0x49a2a1<_0x3e7edf['rows'][_0x9a9e('0x4b')];_0x49a2a1++){_0x3de245[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4c'),_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1][_0x9a9e('0x4d')]));_0x3de245[_0x9a9e('0x47')](get_open_tabs('sms',_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1]['dataValues']));_0x3de245[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4e'),_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1]['dataValues']));_0x3de245[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4f'),_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1][_0x9a9e('0x4d')]));_0x3de245[_0x9a9e('0x47')](get_open_tabs('openchannel',_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1][_0x9a9e('0x4d')]));_0x3de245['push'](get_open_tabs(_0x9a9e('0x50'),_0x3e7edf[_0x9a9e('0x49')][_0x49a2a1][_0x9a9e('0x4d')]));}return Promise['all'](_0x3de245)[_0x9a9e('0x20')](function(){return _0x3e7edf;});}else{return _0x3e7edf;}})['then'](respondWithFilteredResult(_0x31dc82,_0x517c7e))[_0x9a9e('0x51')](handleError(_0x31dc82,null));};exports['show']=function(_0x2baee2,_0x16bc0d){var _0x1e1915=getUserAttributes();_0x2baee2[_0x9a9e('0x42')]['id']=_0x2baee2['params']['id'];var _0x1ae2a6=qs[_0x9a9e('0x3d')](_0x1e1915,_0x2baee2);if(_0x2baee2[_0x9a9e('0x42')][_0x9a9e('0x40')]){_0x1ae2a6[_0x9a9e('0x41')]=[{'all':!![]}];}if(_0x2baee2[_0x9a9e('0x42')][_0x9a9e('0x43')]===_0x9a9e('0x44')){_0x1ae2a6[_0x9a9e('0x41')]=[{'model':db['UserSetting'],'as':_0x9a9e('0x43')}];}_0x1ae2a6=_[_0x9a9e('0x52')]({},_0x1ae2a6,_0x2baee2[_0x9a9e('0x53')]);if(!_[_0x9a9e('0x2f')](_0x1ae2a6[_0x9a9e('0x46')],'id')){_0x1ae2a6[_0x9a9e('0x46')][_0x9a9e('0x47')]('id');}return db['User'][_0x9a9e('0x30')](_0x1ae2a6)[_0x9a9e('0x20')](handleEntityNotFound(_0x16bc0d,null))[_0x9a9e('0x20')](function(_0x1b3097){var _0x5bf53c=[];values=_0x1b3097;if(_0x2baee2['query']['openTabs']===_0x9a9e('0x44')){_0x5bf53c[_0x9a9e('0x47')](get_open_tabs('chat',_0x1b3097['dataValues']));_0x5bf53c[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x54'),_0x1b3097[_0x9a9e('0x4d')]));_0x5bf53c[_0x9a9e('0x47')](get_open_tabs('openchannel',_0x1b3097[_0x9a9e('0x4d')]));_0x5bf53c[_0x9a9e('0x47')](get_open_tabs('whatsapp',_0x1b3097['dataValues']));_0x5bf53c[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4e'),_0x1b3097[_0x9a9e('0x4d')]));_0x5bf53c[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4f'),_0x1b3097[_0x9a9e('0x4d')]));return Promise[_0x9a9e('0x55')](_0x5bf53c);}else{return values;}})[_0x9a9e('0x20')](function(){return values;})[_0x9a9e('0x20')](respondWithResult(_0x16bc0d,null))[_0x9a9e('0x51')](handleError(_0x16bc0d,null));};exports[_0x9a9e('0x1f')]=function(_0x5de696,_0x5c3b1b){if(_0x5de696[_0x9a9e('0x56')]['id']){delete _0x5de696[_0x9a9e('0x56')]['id'];}delete _0x5de696[_0x9a9e('0x56')][_0x9a9e('0x21')];return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x5de696[_0x9a9e('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c3b1b,null))[_0x9a9e('0x20')](saveUpdates(_0x5de696[_0x9a9e('0x56')],null))[_0x9a9e('0x20')](respondWithResult(_0x5c3b1b,null))[_0x9a9e('0x51')](handleError(_0x5c3b1b,null));};exports['describe']=function(_0xf6a6ff,_0x476417){return db[_0x9a9e('0x3f')]['describe']()[_0x9a9e('0x20')](respondWithResult(_0x476417,null))[_0x9a9e('0x51')](handleError(_0x476417,null));};exports['addContacts']=function(_0x21aa16,_0x34efb4){return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x21aa16[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x34efb4,null))[_0x9a9e('0x20')](function(_0x3cd3f4){if(_0x3cd3f4){return _0x3cd3f4[_0x9a9e('0x58')](_0x21aa16[_0x9a9e('0x56')][_0x9a9e('0x59')],_[_0x9a9e('0x5a')](_0x21aa16['body'],[_0x9a9e('0x59'),'id'])||{});}})['then'](respondWithResult(_0x34efb4,null))[_0x9a9e('0x51')](handleError(_0x34efb4,null));};function validateUser(_0x61230a){return new Promise(function(_0x212c54,_0x366651){if(_0x61230a[_0x9a9e('0x5b')])return _0x212c54(_0x61230a);return db['Setting'][_0x9a9e('0x5c')](0x1)[_0x9a9e('0x20')](function(_0x28a09f){if(_0x28a09f[_0x9a9e('0x5d')])authService['validatePasswordPattern'](_0x61230a['password']);db[_0x9a9e('0x3f')]['max'](_0x9a9e('0x5b'))[_0x9a9e('0x20')](function(_0x1153b1){if(_[_0x9a9e('0x5e')](_0x1153b1)){_0x61230a['internal']=_0x28a09f[_0x9a9e('0x5f')]||0x1;return;}if(_[_0x9a9e('0x5e')](_0x28a09f[_0x9a9e('0x5f')])||_0x28a09f[_0x9a9e('0x5f')]===_0x1153b1){_0x61230a[_0x9a9e('0x5b')]=_0x1153b1+0x1;return;}if(_0x28a09f[_0x9a9e('0x5f')]>_0x1153b1){_0x61230a[_0x9a9e('0x5b')]=_0x28a09f[_0x9a9e('0x5f')];return;}return db[_0x9a9e('0x60')][_0x9a9e('0x42')](_0x9a9e('0x61'),{'type':db[_0x9a9e('0x60')][_0x9a9e('0x62')][_0x9a9e('0x63')]})[_0x9a9e('0x20')](function(_0x46f3b2){if(_0x46f3b2&&_0x46f3b2['length']){for(var _0x5d9d7a=0x0,_0x2aa88b=_0x46f3b2[_0x9a9e('0x4b')];_0x5d9d7a<_0x2aa88b&&_[_0x9a9e('0x5e')](_0x61230a[_0x9a9e('0x5b')]);_0x5d9d7a++){if(_0x28a09f[_0x9a9e('0x5f')]<=_0x46f3b2[_0x5d9d7a][_0x9a9e('0x64')]){_0x61230a[_0x9a9e('0x5b')]=_0x46f3b2[_0x5d9d7a]['from'];}else if(_0x28a09f['min_internal']>_0x46f3b2[_0x5d9d7a][_0x9a9e('0x64')]&&_0x28a09f[_0x9a9e('0x5f')]<=_0x46f3b2[_0x5d9d7a]['to']){_0x61230a[_0x9a9e('0x5b')]=_0x28a09f[_0x9a9e('0x5f')];}}}if(_[_0x9a9e('0x5e')](_0x61230a['internal'])){_0x61230a['internal']=_0x1153b1+0x1;}return _0x212c54(_0x61230a);});});})[_0x9a9e('0x51')](function(_0x2bd345){_0x366651(_0x2bd345);});});}function updateUser(_0x3d56f5){return new Promise(function(_0x582d74,_0x415a28){try{if(_0x3d56f5[_0x9a9e('0x65')]){_0x3d56f5['mailbox']=_0x3d56f5[_0x9a9e('0x5b')];_0x3d56f5['VoiceMail']={'mailbox':_0x3d56f5[_0x9a9e('0x5b')],'password':_0x3d56f5[_0x9a9e('0x66')],'fullname':_0x3d56f5[_0x9a9e('0x67')],'email':_0x3d56f5[_0x9a9e('0x68')]};}if(_0x3d56f5[_0x9a9e('0x21')]==='agent'){if(!_0x3d56f5[_0x9a9e('0x69')])_0x3d56f5[_0x9a9e('0x69')]=[_0x9a9e('0x6a'),_0x9a9e('0x6b'),_0x9a9e('0x6c'),'113',_0x9a9e('0x6d'),_0x9a9e('0x6e'),_0x9a9e('0x6f'),'106','107',_0x9a9e('0x70'),'109',_0x9a9e('0x71'),_0x9a9e('0x72'),'114',_0x9a9e('0x73')];}_0x582d74(_0x3d56f5);}catch(_0x19a790){_0x415a28(_0x19a790);}});}exports[_0x9a9e('0x74')]=function(_0x2140c6,_0x42ac80){if(_0x2140c6[_0x9a9e('0x28')]['role']===_0x9a9e('0x22'))throw new Error(_0x9a9e('0x75'));if(_0x2140c6[_0x9a9e('0x56')][_0x9a9e('0x21')]===_0x9a9e('0x28')&&_0x2140c6[_0x9a9e('0x28')][_0x9a9e('0x21')]!==_0x9a9e('0x76')){throw new Error(_0x9a9e('0x77'));}if(_0x2140c6['body'][_0x9a9e('0x21')]===_0x9a9e('0x76')&&_0x2140c6[_0x9a9e('0x28')][_0x9a9e('0x21')]!==_0x9a9e('0x76')){throw new Error(_0x9a9e('0x78'));}return licenseUtil[_0x9a9e('0x79')]([_0x2140c6[_0x9a9e('0x56')]])['then'](function(){return validateUser(_0x2140c6[_0x9a9e('0x56')]);})['then'](function(_0x485ab1){return updateUser(_0x485ab1)[_0x9a9e('0x20')](function(_0x411699){if(_0x411699[_0x9a9e('0x21')]===_0x9a9e('0x76')){_0x411699[_0x9a9e('0x7a')]=_0x2140c6['user']['settingsEnabled'];delete _0x411699[_0x9a9e('0x7b')];}return _0x411699;});})[_0x9a9e('0x20')](function(_0x521e86){return db['User'][_0x9a9e('0x74')](_0x521e86,{'include':[{'model':db['VoiceMail'],'as':_0x9a9e('0x7c')}]});})[_0x9a9e('0x20')](function(_0x1be99d){if(_0x2140c6['body']['role']==='user')return _0x1be99d;if(_0x2140c6[_0x9a9e('0x28')]['role']!=='user')return _0x1be99d;return db['UserProfileSection'][_0x9a9e('0x30')]({'where':{'name':_0x1be99d[_0x9a9e('0x21')]===_0x9a9e('0x22')?_0x9a9e('0x29'):'Telephones','userProfileId':_0x2140c6[_0x9a9e('0x28')]['userProfileId']},'raw':!![]})[_0x9a9e('0x20')](function(_0x1e95f1){if(!_0x1e95f1||_0x1e95f1[_0x9a9e('0x7d')]!=0x0)return _0x1be99d;return db[_0x9a9e('0x7e')][_0x9a9e('0x74')]({'name':_0x1be99d['name'],'resourceId':_0x1be99d['id'],'type':_0x1e95f1[_0x9a9e('0x31')],'sectionId':_0x1e95f1['id']},{})['then'](function(){return _0x1be99d;});})['catch'](function(_0x4aeefd){logger[_0x9a9e('0x7f')](_0x9a9e('0x80'),_0x4aeefd);throw _0x4aeefd;});})['then'](respondWithResult(_0x42ac80,0xc9))['catch'](handleError(_0x42ac80,null));};exports[_0x9a9e('0x81')]=function(_0x14fb97,_0x3a872f){var _0x292ae7=_0x14fb97[_0x9a9e('0x56')];var _0x547324=[];if(_0x14fb97[_0x9a9e('0x28')][_0x9a9e('0x21')]===_0x9a9e('0x22'))throw new Error(_0x9a9e('0x75'));if(_[_0x9a9e('0x82')](_0x292ae7,[_0x9a9e('0x21'),_0x9a9e('0x28')])&&_0x14fb97[_0x9a9e('0x28')][_0x9a9e('0x21')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x9a9e('0x82')](_0x292ae7,['role',_0x9a9e('0x76')])&&_0x14fb97[_0x9a9e('0x28')][_0x9a9e('0x21')]!=='admin'){throw new Error(_0x9a9e('0x83'));}return licenseUtil['checkUserLimits'](_0x292ae7)['then'](function(){return validateUser(_0x292ae7[0x0]);})[_0x9a9e('0x20')](function(){for(var _0x647621=0x1;_0x647621<_0x292ae7[_0x9a9e('0x4b')];_0x647621++){var _0x5c9337=_0x292ae7[_0x647621-0x1][_0x9a9e('0x5b')];if(!_0x292ae7[_0x647621][_0x9a9e('0x5b')])_0x292ae7[_0x647621]['internal']=_0x5c9337+0x1;_0x547324[_0x9a9e('0x47')](validateUser(_0x292ae7[_0x647621]));}return Promise[_0x9a9e('0x55')](_0x547324);})[_0x9a9e('0x20')](function(){_0x547324=[];for(var _0x3dfff5=0x0;_0x3dfff5<_0x292ae7[_0x9a9e('0x4b')];_0x3dfff5++){_0x547324[_0x9a9e('0x47')](updateUser(_0x292ae7[_0x3dfff5]));}return Promise[_0x9a9e('0x55')](_0x547324);})['then'](function(){_0x547324=_0x292ae7[_0x9a9e('0x2d')](function(_0x354cce){return db['User'][_0x9a9e('0x74')](_0x354cce,{'include':[{'model':db[_0x9a9e('0x7c')],'as':'VoiceMail'}]})[_0x9a9e('0x20')](function(_0x2b3e6a){_0x354cce['id']=_0x2b3e6a['id'];return _0x354cce;});});return Promise[_0x9a9e('0x55')](_0x547324);})[_0x9a9e('0x20')](function(_0x5c7cc0){if(_0x14fb97['body'][_0x9a9e('0x21')]===_0x9a9e('0x28'))return _0x5c7cc0;if(_0x14fb97[_0x9a9e('0x28')][_0x9a9e('0x21')]!==_0x9a9e('0x28'))return _0x5c7cc0;var _0x2a331b=_[_0x9a9e('0x82')](_0x5c7cc0,function(_0x388b25){return _0x388b25[_0x9a9e('0x21')]===_0x9a9e('0x22')||_0x388b25['role']==='telephone';});if(!_0x2a331b)return _0x5c7cc0;return db['UserProfileSection'][_0x9a9e('0x48')]({'where':{'name':{'$or':[_0x9a9e('0x29'),_0x9a9e('0x2a')]},'userProfileId':_0x14fb97[_0x9a9e('0x28')]['userProfileId']},'raw':!![]})[_0x9a9e('0x20')](function(_0x6c2b36){if(_[_0x9a9e('0x84')](_0x6c2b36)||!_['some'](_0x6c2b36,['autoAssociation',0x0]))return _0x5c7cc0;_0x547324=[];var _0x1df22e=_(_0x6c2b36)[_0x9a9e('0x2d')](function(_0x1d77ce){if(_0x1d77ce[_0x9a9e('0x7d')]===0x1)return;return _0x1d77ce['name']===_0x9a9e('0x29')?_0x9a9e('0x22'):_0x9a9e('0x2b');})['compact']()[_0x9a9e('0x2e')]();for(var _0x5b89e1=0x0;_0x5b89e1<_0x5c7cc0[_0x9a9e('0x4b')];_0x5b89e1++){if(!_[_0x9a9e('0x2f')](_0x1df22e,_0x5c7cc0[_0x5b89e1]['role']))return;var _0x2a3f73=_0x5c7cc0[_0x5b89e1][_0x9a9e('0x21')]===_0x9a9e('0x22')?'Agents':_0x9a9e('0x2a');_0x547324['push'](db[_0x9a9e('0x7e')][_0x9a9e('0x74')]({'name':_0x5c7cc0[_0x5b89e1][_0x9a9e('0x31')],'resourceId':_0x5c7cc0[_0x5b89e1]['id'],'type':_0x2a3f73,'sectionId':_[_0x9a9e('0x30')](_0x6c2b36,['name',_0x2a3f73])['id']},{}));}return Promise[_0x9a9e('0x55')](_0x547324);});})[_0x9a9e('0x20')](respondWithResult(_0x3a872f,0xc9))[_0x9a9e('0x51')](handleError(_0x3a872f,null));};exports['changePassword']=function(_0x2358a7,_0x290d7c){if(_0x2358a7[_0x9a9e('0x56')]['id']){delete _0x2358a7[_0x9a9e('0x56')]['id'];}return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x2358a7['params']['id']}})['then'](function(_0x5e47a9){if(!_0x5e47a9)return null;if(_0x5e47a9['id']===_0x2358a7['user']['id']){if(!_0x2358a7[_0x9a9e('0x56')][_0x9a9e('0x85')]||!_0x2358a7[_0x9a9e('0x56')][_0x9a9e('0x86')]){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0x89'));}if(!_0x5e47a9[_0x9a9e('0x8a')](_0x2358a7['body'][_0x9a9e('0x85')])){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0x8b'));}if(_0x2358a7[_0x9a9e('0x56')]['oldPassword']===_0x2358a7['body'][_0x9a9e('0x86')]){throw new db['Sequelize'][(_0x9a9e('0x88'))](_0x9a9e('0x8c'));}}else if(_0x2358a7[_0x9a9e('0x28')][_0x9a9e('0x21')]==='admin'){if(!_0x2358a7[_0x9a9e('0x56')]['newPassword']){throw new db['Sequelize'][(_0x9a9e('0x88'))](_0x9a9e('0x8d'));}}else if(_0x2358a7[_0x9a9e('0x28')][_0x9a9e('0x21')]===_0x9a9e('0x28')){if(!_0x2358a7['body'][_0x9a9e('0x86')]){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x5e47a9['role']!==_0x9a9e('0x22')){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0x75'));}}else{throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0x75'));}return _0x5e47a9;})[_0x9a9e('0x20')](handleEntityNotFound(_0x290d7c,null))[_0x9a9e('0x20')](function(_0x50f6fa){return db[_0x9a9e('0x8e')][_0x9a9e('0x8f')]({'attributes':['id',_0x9a9e('0x5d'),_0x9a9e('0x90'),_0x9a9e('0x91')]})[_0x9a9e('0x20')](function(_0x3bf8d2){if(_0x3bf8d2[_0x9a9e('0x5d')])authService[_0x9a9e('0x92')](_0x2358a7[_0x9a9e('0x56')][_0x9a9e('0x86')]);if(!_0x3bf8d2[_0x9a9e('0x90')]||!_0x50f6fa[_0x9a9e('0x38')])return _0x50f6fa;authService['validatePasswordHistory'](_0x2358a7[_0x9a9e('0x56')]['newPassword'],_0x50f6fa[_0x9a9e('0x38')],_0x3bf8d2[_0x9a9e('0x91')]);return _0x50f6fa;})[_0x9a9e('0x20')](saveUpdates({'password':_0x2358a7[_0x9a9e('0x56')][_0x9a9e('0x86')],'passwordResetAt':_0x2358a7[_0x9a9e('0x28')]['id']==_0x2358a7[_0x9a9e('0x57')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x2358a7[_0x9a9e('0x56')][_0x9a9e('0x86')],_0x50f6fa[_0x9a9e('0x38')])},null));})['then'](respondWithResult(_0x290d7c,null))[_0x9a9e('0x51')](handleError(_0x290d7c,null));};exports[_0x9a9e('0x93')]=function(_0x2fa1d6,_0x5b2e54){var _0x1fc7e0=_0x2fa1d6[_0x9a9e('0x56')][_0x9a9e('0x94')];return db['User'][_0x9a9e('0x30')]({'where':{'id':_0x2fa1d6[_0x9a9e('0x57')]['id']},'attributes':['id',_0x9a9e('0x31'),_0x9a9e('0x21'),'online','loginInPause','voicePause','interface']})[_0x9a9e('0x20')](handleEntityNotFound(_0x5b2e54,null))[_0x9a9e('0x20')](function(_0xe409e){if(_0xe409e){if(!utils[_0x9a9e('0x95')](_0x1fc7e0)){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))]('Unknown\x20channel');}return _0xe409e[_0x9a9e('0x96')+_[_0x9a9e('0x97')](_0x1fc7e0[_0x9a9e('0x98')]())+_0x9a9e('0x99')](_0x2fa1d6['body']['ids'],{'penalty':_0x2fa1d6[_0x9a9e('0x56')]['penalty']||0x0})[_0x9a9e('0x9a')](function(_0x400981){for(var _0x5bf56e=0x0;_0x5bf56e<_0x2fa1d6['body'][_0x9a9e('0x59')][_0x9a9e('0x4b')];_0x5bf56e+=0x1){var _0x333405={'UserId':Number(_0x2fa1d6['params']['id'])};_0x333405[_['capitalize'](_0x1fc7e0[_0x9a9e('0x98')]())+'QueueId']=Number(_0x2fa1d6['body'][_0x9a9e('0x59')][_0x5bf56e]);socket['emit'](_0x9a9e('0x28')+_['capitalize'](_0x1fc7e0['toLowerCase']())+_0x9a9e('0x9b'),_0x333405);}return _0x400981;})[_0x9a9e('0x20')](function(){if(_0x1fc7e0===_0x9a9e('0x9c')){return db[_0x9a9e('0x9d')]['findAll']({'where':{'id':_0x2fa1d6[_0x9a9e('0x56')][_0x9a9e('0x59')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x82d6c5){var _0x18ed03=_0xe409e[_0x9a9e('0x26')]({'plain':!![]});var _0x3e381b=[];if(_0x1fc7e0===_0x9a9e('0x9c')&&_0x18ed03['role']===_0x9a9e('0x22')&&_0x18ed03[_0x9a9e('0x9e')]){for(let _0x262dd5=0x0;_0x262dd5<_0x82d6c5[_0x9a9e('0x4b')];_0x262dd5+=0x1){_0x3e381b['push']({'membername':_0x18ed03[_0x9a9e('0x31')],'UserId':_0x18ed03['id'],'queue_name':_0x82d6c5[_0x262dd5]['name'],'VoiceQueueId':_0x82d6c5[_0x262dd5]['id'],'interface':_[_0x9a9e('0x5e')](_0x18ed03[_0x9a9e('0x9f')])?util['format'](_0x9a9e('0xa0'),_0x18ed03[_0x9a9e('0x31')]):_0x18ed03[_0x9a9e('0x9f')],'paused':_0x18ed03[_0x9a9e('0xa1')]||![],'penalty':_0x2fa1d6['body'][_0x9a9e('0xa2')]||0x0});}return Promise[_0x9a9e('0x55')](_0x3e381b['map'](function(_0x3dc59f){return db[_0x9a9e('0xa3')]['upsert'](_0x3dc59f);}));}return _0xe409e;});}})[_0x9a9e('0x20')](respondWithStatusCode(_0x5b2e54,null))[_0x9a9e('0x51')](handleError(_0x5b2e54,null));};exports[_0x9a9e('0xa4')]=function(_0x43b481,_0x37dcc2){var _0x5c7c03,_0x3b2757;return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x43b481[_0x9a9e('0x57')]['id']},'attributes':['id','name',_0x9a9e('0x21')]})[_0x9a9e('0x20')](handleEntityNotFound(_0x37dcc2,null))[_0x9a9e('0x20')](function(_0x3a63ed){if(_0x3a63ed){_0x5c7c03=_0x3a63ed;if(!_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')]||!utils[_0x9a9e('0x95')](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')])){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0xa5'));}return _0x3a63ed[_0x9a9e('0xa6')+_[_0x9a9e('0x97')](_0x43b481[_0x9a9e('0x42')]['channel'][_0x9a9e('0x98')]())+_0x9a9e('0x99')](_0x43b481['query'][_0x9a9e('0x59')]);}})[_0x9a9e('0x20')](function(_0x70c94){if(_[_0x9a9e('0xa7')](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x59')])){for(var _0xb97bf5=0x0;_0xb97bf5<_0x43b481['query']['ids']['length'];_0xb97bf5+=0x1){_0x3b2757={'UserId':Number(_0x43b481[_0x9a9e('0x57')]['id'])};_0x3b2757[_['capitalize'](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')][_0x9a9e('0x98')]())+_0x9a9e('0xa8')]=Number(_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x59')][_0xb97bf5]);socket[_0x9a9e('0x23')]('user'+_[_0x9a9e('0x97')](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')]['toLowerCase']())+_0x9a9e('0xa9'),_0x3b2757);}}else{_0x3b2757={'UserId':Number(_0x43b481['params']['id'])};_0x3b2757[_[_0x9a9e('0x97')](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')]['toLowerCase']())+'QueueId']=Number(_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x59')]);socket[_0x9a9e('0x23')]('user'+_[_0x9a9e('0x97')](_0x43b481[_0x9a9e('0x42')][_0x9a9e('0x94')]['toLowerCase']())+'Queue:remove',_0x3b2757);}return _0x70c94;})[_0x9a9e('0x20')](function(){if(_0x43b481[_0x9a9e('0x42')]['channel']===_0x9a9e('0x9c')){return db[_0x9a9e('0xa3')][_0x9a9e('0x25')]({'where':{'UserId':_0x43b481[_0x9a9e('0x57')]['id'],'VoiceQueueId':_0x43b481['query'][_0x9a9e('0x59')]},'individualHooks':!![]})[_0x9a9e('0x20')](function(){return _0x5c7c03;});}return _0x5c7c03;})[_0x9a9e('0x20')](respondWithStatusCode(_0x37dcc2,null))[_0x9a9e('0x51')](handleError(_0x37dcc2,null));};exports[_0x9a9e('0xaa')]=function(_0x56a77c,_0x416c4f){_0x56a77c[_0x9a9e('0x56')]['userpic']=_0x56a77c[_0x9a9e('0xab')][_0x9a9e('0xac')];return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x56a77c['params']['id']}})['then'](handleEntityNotFound(_0x416c4f,null))[_0x9a9e('0x20')](saveUpdates(_0x56a77c['body'],null))[_0x9a9e('0x20')](respondWithResult(_0x416c4f,null))[_0x9a9e('0x51')](handleError(_0x416c4f,null));};exports[_0x9a9e('0xad')]=function(_0xf29624,_0x49b3d2){var _0x39835a=path[_0x9a9e('0xae')](config[_0x9a9e('0xaf')],_0x9a9e('0xb0'));return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0xf29624[_0x9a9e('0x57')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x9a9e('0x20')](handleEntityNotFound(_0x49b3d2,null))['then'](function(_0x4dde59){if(_0x4dde59){if(_[_0x9a9e('0x5e')](_0x4dde59[_0x9a9e('0xb1')])){return _0x49b3d2[_0x9a9e('0xb2')](_0x39835a);}else{if(!fs[_0x9a9e('0xb3')](path['join'](config[_0x9a9e('0xaf')],'server/files/images/',_0x4dde59[_0x9a9e('0xb1')]))){return _0x49b3d2[_0x9a9e('0xb2')](_0x39835a);}return _0x49b3d2[_0x9a9e('0xb2')](path[_0x9a9e('0xae')](config['root'],_0x9a9e('0xb4'),_0x4dde59[_0x9a9e('0xb1')]));}}})[_0x9a9e('0x51')](handleError(_0x49b3d2,null));};exports[_0x9a9e('0xb5')]=function(_0x36dd0f,_0x4089e9){return db[_0x9a9e('0x3f')]['find']({'where':{'id':_0x36dd0f[_0x9a9e('0x57')]['id']},'attributes':['id']})[_0x9a9e('0x20')](handleEntityNotFound(_0x4089e9,null))[_0x9a9e('0x20')](function(_0x14af92){var _0x1974c3=[];values=_0x14af92[_0x9a9e('0x4d')];_0x1974c3[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4c'),_0x14af92[_0x9a9e('0x4d')]));_0x1974c3[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x54'),_0x14af92[_0x9a9e('0x4d')]));_0x1974c3['push'](get_open_tabs(_0x9a9e('0xb6'),_0x14af92[_0x9a9e('0x4d')]));_0x1974c3[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x50'),_0x14af92[_0x9a9e('0x4d')]));_0x1974c3[_0x9a9e('0x47')](get_open_tabs(_0x9a9e('0x4e'),_0x14af92[_0x9a9e('0x4d')]));_0x1974c3['push'](get_open_tabs(_0x9a9e('0x4f'),_0x14af92['dataValues']));return Promise[_0x9a9e('0x55')](_0x1974c3);})[_0x9a9e('0x20')](function(_0x5d55cf){if(_0x5d55cf){var _0x4bc06b=_['map'](values[_0x9a9e('0xb7')],function(_0x5ebc85){return{'channel':_0x9a9e('0xb8'),'id':_0x5ebc85['id'],'createdAt':_0x5ebc85[_0x9a9e('0xb9')]};});var _0xa84480=_[_0x9a9e('0x2d')](values[_0x9a9e('0xba')],function(_0x23de27){return{'channel':_0x9a9e('0xbb'),'id':_0x23de27['id'],'createdAt':_0x23de27['createdAt']};});var _0x42e6f3=_[_0x9a9e('0x2d')](values['OpenchannelOpenTabs'],function(_0x1d9f6e){return{'channel':_0x9a9e('0xbc'),'id':_0x1d9f6e['id'],'createdAt':_0x1d9f6e[_0x9a9e('0xb9')]};});var _0x301d08=_[_0x9a9e('0x2d')](values['MailOpenTabs'],function(_0x29766a){return{'channel':'MAIL','id':_0x29766a['id'],'createdAt':_0x29766a['createdAt']};});var _0x17b957=_[_0x9a9e('0x2d')](values[_0x9a9e('0xbd')],function(_0x188e54){return{'channel':_0x9a9e('0xbe'),'id':_0x188e54['id'],'createdAt':_0x188e54[_0x9a9e('0xb9')]};});var _0x2a5998=_[_0x9a9e('0x2d')](values[_0x9a9e('0xbf')],function(_0x2719b0){return{'channel':'WHATSAPP','id':_0x2719b0['id'],'createdAt':_0x2719b0[_0x9a9e('0xb9')]};});var _0x1928d3=_[_0x9a9e('0xc0')](_0x4bc06b,_0xa84480,_0x42e6f3,_0x301d08,_0x17b957,_0x2a5998);var _0x5ad6fb={'count':_0x1928d3[_0x9a9e('0x4b')],'rows':_0x1928d3};return _0x5ad6fb;}else return null;})['then'](respondWithResult(_0x4089e9,null))['catch'](handleError(_0x4089e9,null));};exports[_0x9a9e('0xc1')]=function(_0x50285f,_0x57f7e0){var _0x5dc14a={};return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x50285f['params']['id']}})[_0x9a9e('0x20')](function(_0x166322){if(!_0x166322){throw new APINotFoundError(util['format'](_0x9a9e('0xc2'),_0x50285f[_0x9a9e('0x57')]['id']));}return contacts['describe']();})['then'](function(_0xaeb3b4){_0x50285f[_0x9a9e('0x42')][_0x9a9e('0x3f')]=_0x50285f[_0x9a9e('0x57')]['id'];_0x5dc14a=qs[_0x9a9e('0x3d')](_0xaeb3b4,_0x50285f);if(_0x50285f[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0x40'))){_0x5dc14a[_0x9a9e('0x41')]=[{'model':db[_0x9a9e('0xc4')],'as':_0x9a9e('0xc5'),'required':![]},{'model':db[_0x9a9e('0xc6')],'as':_0x9a9e('0xc7'),'attributes':['id','name',_0x9a9e('0xc8')],'where':_0x50285f[_0x9a9e('0x42')][_0x9a9e('0xc9')]?{'id':_0x50285f[_0x9a9e('0x42')]['tag']}:undefined,'required':_0x50285f['query']['tag']?!![]:![]}];}return contacts[_0x9a9e('0x48')](_0x50285f[_0x9a9e('0x42')],_0x50285f[_0x9a9e('0x28')],_0x5dc14a,_0xaeb3b4);})[_0x9a9e('0x20')](respondWithFilteredResult(_0x57f7e0,_0x5dc14a))[_0x9a9e('0x51')](APIHandleError(_0x57f7e0));};exports[_0x9a9e('0xca')]=function(_0x46bcd4,_0x2d46e0){var _0x43c9d3;var _0x5b162e={};var _0x31ce60;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x46bcd4[_0x9a9e('0x57')]['id']},'attributes':['id','name',_0x9a9e('0x21')]})['then'](handleEntityNotFound(_0x2d46e0,null))['then'](function(_0x1244bc){if(!utils[_0x9a9e('0x95')](_0x46bcd4['query'][_0x9a9e('0x94')])){throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0xa5'));}_0x43c9d3=_0x1244bc;var _0x4f274e={};_0x4f274e[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db[_[_0x9a9e('0x97')](_0x46bcd4['query'][_0x9a9e('0x94')])+_0x9a9e('0xcd')][_0x9a9e('0xce')]);_0x4f274e[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x46bcd4[_0x9a9e('0x42')]);_0x4f274e[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x4f274e[_0x9a9e('0xcb')],_0x4f274e[_0x9a9e('0x42')]);_0x5b162e[_0x9a9e('0x46')]=_['intersection'](_0x4f274e['model'],qs[_0x9a9e('0xd1')](_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x5b162e[_0x9a9e('0x46')]=_0x5b162e[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x5b162e[_0x9a9e('0x46')]:_0x4f274e[_0x9a9e('0xcb')];_0x5b162e[_0x9a9e('0xd2')]=qs['sort'](_0x46bcd4['query'][_0x9a9e('0xd3')]);_0x5b162e[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x46bcd4[_0x9a9e('0x42')],_0x4f274e['filters']));if(_0x46bcd4['query'][_0x9a9e('0x36')]){_0x5b162e[_0x9a9e('0x3e')]=_['merge'](_0x5b162e['where'],{'$or':_[_0x9a9e('0x2d')](_0x5b162e[_0x9a9e('0x46')],function(_0x2f0713){var _0x141a99={};_0x141a99[_0x2f0713]={'$like':'%'+_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x141a99;})});}_0x5b162e=_['merge']({},_0x5b162e,_0x46bcd4['options']);switch(_0x43c9d3[_0x9a9e('0x21')]){case _0x9a9e('0x76'):return db[_[_0x9a9e('0x97')](_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0x94')])+_0x9a9e('0xcd')][_0x9a9e('0x48')](_0x5b162e);case'user':case _0x9a9e('0x22'):return _0x43c9d3[_0x9a9e('0x26')+_[_0x9a9e('0x97')](_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0x94')])+'Queues'](_0x5b162e);default:throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0xd5'));}})['then'](function(_0xb90e0c){_0x31ce60=_0xb90e0c[_0x9a9e('0x4b')];if(!_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x5b162e[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x46bcd4['query'][_0x9a9e('0x1a')]);_0x5b162e[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x46bcd4['query'][_0x9a9e('0x18')]);}switch(_0x43c9d3['role']){case _0x9a9e('0x76'):return db[_['capitalize'](_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0x94')])+_0x9a9e('0xcd')][_0x9a9e('0x48')](_0x5b162e);case _0x9a9e('0x28'):case _0x9a9e('0x22'):return _0x43c9d3[_0x9a9e('0x26')+_[_0x9a9e('0x97')](_0x46bcd4[_0x9a9e('0x42')][_0x9a9e('0x94')])+_0x9a9e('0x99')](_0x5b162e);}})[_0x9a9e('0x20')](function(_0x3dc593){return{'count':_0x31ce60,'rows':_0x3dc593};})[_0x9a9e('0x20')](respondWithResult(_0x2d46e0,null))[_0x9a9e('0x51')](handleError(_0x2d46e0,null));};exports[_0x9a9e('0xd7')]=function(_0x4072b1,_0x36a1ee){var _0x3d431f={};var _0x5cb82c={};var _0x48ae11;var _0x21d6e9;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x4072b1[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x36a1ee,null))['then'](function(_0x78e26f){if(_0x78e26f){_0x48ae11=_0x78e26f;_0x5cb82c[_0x9a9e('0xcb')]=_['keys'](db[_0x9a9e('0xa3')][_0x9a9e('0xce')]);_0x5cb82c['query']=_['keys'](_0x4072b1['query']);_0x5cb82c[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x5cb82c[_0x9a9e('0xcb')],_0x5cb82c[_0x9a9e('0x42')]);_0x3d431f['attributes']=_[_0x9a9e('0xd0')](_0x5cb82c['model'],qs[_0x9a9e('0xd1')](_0x4072b1[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x3d431f[_0x9a9e('0x46')]=_0x3d431f[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x3d431f[_0x9a9e('0x46')]:_0x5cb82c[_0x9a9e('0xcb')];_0x3d431f[_0x9a9e('0xd2')]=qs['sort'](_0x4072b1[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x3d431f[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x4072b1[_0x9a9e('0x42')],_0x5cb82c[_0x9a9e('0xcf')]));if(_0x4072b1[_0x9a9e('0x42')][_0x9a9e('0x36')]){_0x3d431f[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x3d431f[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x3d431f[_0x9a9e('0x46')],function(_0x1fa485){var _0x2538b0={};_0x2538b0[_0x1fa485]={'$like':'%'+_0x4072b1['query'][_0x9a9e('0x36')]+'%'};return _0x2538b0;})});}_0x3d431f=_[_0x9a9e('0x52')]({},_0x3d431f,_0x4072b1[_0x9a9e('0x53')]);return _0x48ae11[_0x9a9e('0xd7')](_0x3d431f);}})['then'](function(_0x226cde){if(_0x226cde){_0x21d6e9=_0x226cde['length'];if(!_0x4072b1['query']['hasOwnProperty']('nolimit')){_0x3d431f[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x4072b1['query'][_0x9a9e('0x1a')]);_0x3d431f[_0x9a9e('0x18')]=qs['offset'](_0x4072b1[_0x9a9e('0x42')][_0x9a9e('0x18')]);}return _0x48ae11[_0x9a9e('0xd7')](_0x3d431f);}})[_0x9a9e('0x20')](function(_0xf7eb8d){if(_0xf7eb8d){return _0xf7eb8d?{'count':_0x21d6e9,'rows':_0xf7eb8d}:null;}})['then'](respondWithResult(_0x36a1ee,null))[_0x9a9e('0x51')](handleError(_0x36a1ee,null));};exports[_0x9a9e('0xd8')]=function(_0x5065f3,_0x25f509){var _0x1330c5={};var _0x58c54b={};var _0x561ff1;var _0x351d0b;return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x5065f3[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x25f509,null))['then'](function(_0x30dab4){if(_0x30dab4){_0x561ff1=_0x30dab4;_0x58c54b[_0x9a9e('0xcb')]=_['keys'](db[_0x9a9e('0xd9')][_0x9a9e('0xce')]);_0x58c54b[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x5065f3[_0x9a9e('0x42')]);_0x58c54b['filters']=_[_0x9a9e('0xd0')](_0x58c54b[_0x9a9e('0xcb')],_0x58c54b[_0x9a9e('0x42')]);_0x1330c5[_0x9a9e('0x46')]=_['intersection'](_0x58c54b['model'],qs[_0x9a9e('0xd1')](_0x5065f3['query'][_0x9a9e('0xd1')]));_0x1330c5[_0x9a9e('0x46')]=_0x1330c5[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x1330c5['attributes']:_0x58c54b['model'];_0x1330c5[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x5065f3['query'][_0x9a9e('0xd3')]);_0x1330c5[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_['pick'](_0x5065f3['query'],_0x58c54b['filters']));if(_0x5065f3[_0x9a9e('0x42')][_0x9a9e('0x36')]){_0x1330c5[_0x9a9e('0x3e')]=_['merge'](_0x1330c5[_0x9a9e('0x3e')],{'$or':_['map'](_0x1330c5['attributes'],function(_0x27c36a){var _0x17847e={};_0x17847e[_0x27c36a]={'$like':'%'+_0x5065f3[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x17847e;})});}_0x1330c5=_[_0x9a9e('0x52')]({},_0x1330c5,_0x5065f3[_0x9a9e('0x53')]);return _0x561ff1[_0x9a9e('0xd8')](_0x1330c5);}})[_0x9a9e('0x20')](function(_0x3b7276){if(_0x3b7276){_0x351d0b=_0x3b7276[_0x9a9e('0x4b')];if(!_0x5065f3[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x1330c5[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x5065f3[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x1330c5[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x5065f3['query'][_0x9a9e('0x18')]);}return _0x561ff1[_0x9a9e('0xd8')](_0x1330c5);}})[_0x9a9e('0x20')](function(_0x53460d){if(_0x53460d){return _0x53460d?{'count':_0x351d0b,'rows':_0x53460d}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x25f509,null))[_0x9a9e('0x51')](handleError(_0x25f509,null));};exports['getRecordings']=function(_0x1987e7,_0x3ab3d2){var _0x1e333f={'raw':!![],'where':{}};var _0xba6acc={};var _0x32bf9b={'count':0x0,'rows':[]};return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x1987e7['params']['id']}})['then'](handleEntityNotFound(_0x3ab3d2,null))[_0x9a9e('0x20')](function(_0x52578d){if(_0x52578d){_0xba6acc['model']=_['keys'](db['VoiceRecording'][_0x9a9e('0xce')]);_0xba6acc[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x1987e7[_0x9a9e('0x42')]);_0xba6acc['filters']=_[_0x9a9e('0xd0')](_0xba6acc['model'],_0xba6acc[_0x9a9e('0x42')]);_0x1e333f[_0x9a9e('0x46')]=_['intersection'](_0xba6acc[_0x9a9e('0xcb')],qs[_0x9a9e('0xd1')](_0x1987e7[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x1e333f[_0x9a9e('0x46')]=_0x1e333f[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x1e333f['attributes']:_0xba6acc[_0x9a9e('0xcb')];if(!_0x1987e7[_0x9a9e('0x42')]['hasOwnProperty'](_0x9a9e('0xd6'))){_0x1e333f[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x1987e7['query'][_0x9a9e('0x1a')]);_0x1e333f[_0x9a9e('0x18')]=qs['offset'](_0x1987e7[_0x9a9e('0x42')][_0x9a9e('0x18')]);}_0x1e333f[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x1987e7[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x1e333f[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_['pick'](_0x1987e7[_0x9a9e('0x42')],_0xba6acc[_0x9a9e('0xcf')]));_0x1e333f[_0x9a9e('0x3e')]['UserId']=_0x52578d['id'];if(_0x1987e7[_0x9a9e('0x42')]['filter']){_0x1e333f[_0x9a9e('0x3e')]=_['merge'](_0x1e333f[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x1e333f[_0x9a9e('0x46')],function(_0x2da6f5){var _0x5dbeaf={};_0x5dbeaf[_0x2da6f5]={'$like':'%'+_0x1987e7['query'][_0x9a9e('0x36')]+'%'};return _0x5dbeaf;})});}_0x1e333f=_[_0x9a9e('0x52')]({},_0x1e333f,_0x1987e7[_0x9a9e('0x53')]);return db[_0x9a9e('0xda')]['count']({'where':_0x1e333f['where']})[_0x9a9e('0x20')](function(_0x308a42){_0x32bf9b['count']=_0x308a42;if(_0x1987e7[_0x9a9e('0x42')][_0x9a9e('0x40')]){_0x1e333f[_0x9a9e('0x41')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x1e333f);})[_0x9a9e('0x20')](function(_0x5b930b){_0x32bf9b[_0x9a9e('0x49')]=_0x5b930b;return _0x32bf9b;});}})[_0x9a9e('0x20')](respondWithFilteredResult(_0x3ab3d2,_0x1e333f))[_0x9a9e('0x51')](handleError(_0x3ab3d2,null));};exports['getScreenRecordings']=function(_0x3d752f,_0x46b2f8){var _0x563d64={'raw':!![],'where':{}};var _0x1a2166={};var _0x8d04de={'count':0x0,'rows':[]};return db['User'][_0x9a9e('0x8f')]({'where':{'id':_0x3d752f[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x46b2f8,null))[_0x9a9e('0x20')](function(_0x18e428){if(_0x18e428){_0x1a2166[_0x9a9e('0xcb')]=_['keys'](db[_0x9a9e('0xdb')][_0x9a9e('0xce')]);_0x1a2166[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x3d752f['query']);_0x1a2166[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x1a2166[_0x9a9e('0xcb')],_0x1a2166[_0x9a9e('0x42')]);_0x563d64[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x1a2166['model'],qs['fields'](_0x3d752f[_0x9a9e('0x42')]['fields']));_0x563d64[_0x9a9e('0x46')]=_0x563d64['attributes'][_0x9a9e('0x4b')]?_0x563d64['attributes']:_0x1a2166['model'];if(!_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x563d64[_0x9a9e('0x1a')]=qs['limit'](_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x563d64[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0x18')]);}_0x563d64[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x563d64[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x3d752f[_0x9a9e('0x42')],_0x1a2166[_0x9a9e('0xcf')]));_0x563d64['where'][_0x9a9e('0xdc')]=_0x18e428['id'];if(_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0x36')]){_0x563d64['where']=_[_0x9a9e('0x52')](_0x563d64[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x563d64['attributes'],function(_0x15af03){var _0x30beae={};_0x30beae[_0x15af03]={'$like':'%'+_0x3d752f[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x30beae;})});}_0x563d64=_[_0x9a9e('0x52')]({},_0x563d64,_0x3d752f[_0x9a9e('0x53')]);return db[_0x9a9e('0xdb')][_0x9a9e('0x1b')]({'where':_0x563d64['where']})[_0x9a9e('0x20')](function(_0x337bb2){_0x8d04de['count']=_0x337bb2;if(_0x3d752f[_0x9a9e('0x42')]['includeAll']){_0x563d64[_0x9a9e('0x41')]=[{'all':!![]}];}return db[_0x9a9e('0xdb')][_0x9a9e('0x48')](_0x563d64);})['then'](function(_0x15e1e0){_0x8d04de['rows']=_0x15e1e0;return _0x8d04de;});}})[_0x9a9e('0x20')](respondWithFilteredResult(_0x46b2f8,_0x563d64))[_0x9a9e('0x51')](handleError(_0x46b2f8,null));};exports[_0x9a9e('0xdd')]=function(_0x3b4eec,_0x259947){var _0x594abb={};var _0x5f4f61={};var _0x43f296;var _0x2a2108;return db['User'][_0x9a9e('0x8f')]({'where':{'id':_0x3b4eec[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x259947,null))[_0x9a9e('0x20')](function(_0x5b7352){if(_0x5b7352){_0x43f296=_0x5b7352;_0x5f4f61[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db['ChatInteraction']['rawAttributes']);_0x5f4f61['query']=_[_0x9a9e('0xcc')](_0x3b4eec[_0x9a9e('0x42')]);_0x5f4f61['filters']=_['intersection'](_0x5f4f61[_0x9a9e('0xcb')],_0x5f4f61['query']);_0x594abb['attributes']=_[_0x9a9e('0xd0')](_0x5f4f61['model'],qs['fields'](_0x3b4eec['query'][_0x9a9e('0xd1')]));_0x594abb[_0x9a9e('0x46')]=_0x594abb['attributes'][_0x9a9e('0x4b')]?_0x594abb[_0x9a9e('0x46')]:_0x5f4f61[_0x9a9e('0xcb')];_0x594abb['order']=qs['sort'](_0x3b4eec['query'][_0x9a9e('0xd3')]);_0x594abb['where']=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x3b4eec[_0x9a9e('0x42')],_0x5f4f61[_0x9a9e('0xcf')]));if(_0x3b4eec['query'][_0x9a9e('0x36')]){_0x594abb[_0x9a9e('0x3e')]=_['merge'](_0x594abb[_0x9a9e('0x3e')],{'$or':_['map'](_0x594abb[_0x9a9e('0x46')],function(_0x23d340){var _0x2dc7b5={};_0x2dc7b5[_0x23d340]={'$like':'%'+_0x3b4eec[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x2dc7b5;})});}_0x594abb=_[_0x9a9e('0x52')]({},_0x594abb,_0x3b4eec[_0x9a9e('0x53')]);return _0x43f296[_0x9a9e('0xdd')](_0x594abb);}})[_0x9a9e('0x20')](function(_0x85be9a){if(_0x85be9a){_0x2a2108=_0x85be9a[_0x9a9e('0x4b')];if(!_0x3b4eec[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x594abb[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x3b4eec[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x594abb[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x3b4eec[_0x9a9e('0x42')]['offset']);}return _0x43f296[_0x9a9e('0xdd')](_0x594abb);}})[_0x9a9e('0x20')](function(_0x202613){if(_0x202613){return _0x202613?{'count':_0x2a2108,'rows':_0x202613}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x259947,null))[_0x9a9e('0x51')](handleError(_0x259947,null));};exports[_0x9a9e('0xde')]=function(_0x1679b6,_0x54acc9){var _0x5808d8={};var _0x5a6be2={};var _0x5a3c25;var _0x4de7d8;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x1679b6[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x54acc9,null))[_0x9a9e('0x20')](function(_0x19e735){if(_0x19e735){_0x5a3c25=_0x19e735;_0x5a6be2[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db['OpenchannelInteraction']['rawAttributes']);_0x5a6be2[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x1679b6[_0x9a9e('0x42')]);_0x5a6be2[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x5a6be2[_0x9a9e('0xcb')],_0x5a6be2[_0x9a9e('0x42')]);_0x5808d8[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x5a6be2[_0x9a9e('0xcb')],qs['fields'](_0x1679b6[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x5808d8[_0x9a9e('0x46')]=_0x5808d8['attributes'][_0x9a9e('0x4b')]?_0x5808d8[_0x9a9e('0x46')]:_0x5a6be2['model'];_0x5808d8[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x1679b6[_0x9a9e('0x42')]['sort']);_0x5808d8['where']=qs[_0x9a9e('0xcf')](_['pick'](_0x1679b6[_0x9a9e('0x42')],_0x5a6be2[_0x9a9e('0xcf')]));if(_0x1679b6[_0x9a9e('0x42')][_0x9a9e('0x36')]){_0x5808d8[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x5808d8[_0x9a9e('0x3e')],{'$or':_['map'](_0x5808d8[_0x9a9e('0x46')],function(_0x2beab5){var _0x460ae7={};_0x460ae7[_0x2beab5]={'$like':'%'+_0x1679b6['query']['filter']+'%'};return _0x460ae7;})});}_0x5808d8=_[_0x9a9e('0x52')]({},_0x5808d8,_0x1679b6['options']);return _0x5a3c25[_0x9a9e('0xde')](_0x5808d8);}})['then'](function(_0xe2b5b2){if(_0xe2b5b2){_0x4de7d8=_0xe2b5b2[_0x9a9e('0x4b')];if(!_0x1679b6[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x5808d8[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x1679b6[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x5808d8['offset']=qs[_0x9a9e('0x18')](_0x1679b6['query'][_0x9a9e('0x18')]);}return _0x5a3c25['getOpenchannelInteractions'](_0x5808d8);}})[_0x9a9e('0x20')](function(_0x4e0a97){if(_0x4e0a97){return _0x4e0a97?{'count':_0x4de7d8,'rows':_0x4e0a97}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x54acc9,null))[_0x9a9e('0x51')](handleError(_0x54acc9,null));};exports['getMailInteractions']=function(_0x2ef9b0,_0x1437c6){var _0x393ecf={'raw':!![],'where':{}};var _0x17a24a={};var _0x3f3edb={'count':0x0,'rows':[]};return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x2ef9b0[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x1437c6,null))['then'](function(_0x52f5bf){if(_0x52f5bf){_0x17a24a['model']=_[_0x9a9e('0xcc')](db[_0x9a9e('0xdf')][_0x9a9e('0xce')]);_0x17a24a[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x2ef9b0['query']);_0x17a24a[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x17a24a[_0x9a9e('0xcb')],_0x17a24a[_0x9a9e('0x42')]);_0x393ecf[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x17a24a['model'],qs[_0x9a9e('0xd1')](_0x2ef9b0[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x393ecf[_0x9a9e('0x46')]=_0x393ecf[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x393ecf[_0x9a9e('0x46')]:_0x17a24a[_0x9a9e('0xcb')];if(!_0x2ef9b0[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x393ecf[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x2ef9b0[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x393ecf[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x2ef9b0[_0x9a9e('0x42')]['offset']);}_0x393ecf[_0x9a9e('0xd2')]=qs['sort'](_0x2ef9b0[_0x9a9e('0x42')]['sort']);_0x393ecf[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x2ef9b0[_0x9a9e('0x42')],_0x17a24a[_0x9a9e('0xcf')]));_0x393ecf[_0x9a9e('0x3e')][_0x9a9e('0xdc')]=_0x52f5bf['id'];if(_0x2ef9b0['query'][_0x9a9e('0x36')]){_0x393ecf[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x393ecf[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x393ecf[_0x9a9e('0x46')],function(_0x2b7ce3){var _0x42d304={};_0x42d304[_0x2b7ce3]={'$like':'%'+_0x2ef9b0['query']['filter']+'%'};return _0x42d304;})});}_0x393ecf=_[_0x9a9e('0x52')]({},_0x393ecf,_0x2ef9b0[_0x9a9e('0x53')]);return db[_0x9a9e('0xdf')]['count']({'where':_0x393ecf[_0x9a9e('0x3e')]})['then'](function(_0x1f7b21){_0x3f3edb['count']=_0x1f7b21;if(_0x2ef9b0['query'][_0x9a9e('0x40')]){_0x393ecf[_0x9a9e('0x41')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x393ecf);})['then'](function(_0x5428cf){_0x3f3edb[_0x9a9e('0x49')]=_0x5428cf;return _0x3f3edb;});}})['then'](respondWithFilteredResult(_0x1437c6,_0x393ecf))[_0x9a9e('0x51')](handleError(_0x1437c6,null));};exports[_0x9a9e('0xe0')]=function(_0x485e3b,_0x539281){var _0x5d9832={};var _0x1e3056={};var _0xb3ff71;var _0x5c30b2;return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x485e3b[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x539281,null))['then'](function(_0x1152bb){if(_0x1152bb){_0xb3ff71=_0x1152bb;_0x1e3056[_0x9a9e('0xcb')]=_['keys'](db[_0x9a9e('0xe1')]['rawAttributes']);_0x1e3056['query']=_[_0x9a9e('0xcc')](_0x485e3b[_0x9a9e('0x42')]);_0x1e3056[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x1e3056[_0x9a9e('0xcb')],_0x1e3056[_0x9a9e('0x42')]);_0x5d9832['attributes']=_[_0x9a9e('0xd0')](_0x1e3056[_0x9a9e('0xcb')],qs['fields'](_0x485e3b[_0x9a9e('0x42')]['fields']));_0x5d9832['attributes']=_0x5d9832[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x5d9832[_0x9a9e('0x46')]:_0x1e3056[_0x9a9e('0xcb')];_0x5d9832[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x485e3b['query'][_0x9a9e('0xd3')]);_0x5d9832['where']=qs[_0x9a9e('0xcf')](_['pick'](_0x485e3b[_0x9a9e('0x42')],_0x1e3056[_0x9a9e('0xcf')]));if(_0x485e3b['query'][_0x9a9e('0x36')]){_0x5d9832[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x5d9832[_0x9a9e('0x3e')],{'$or':_['map'](_0x5d9832['attributes'],function(_0x389775){var _0x464efd={};_0x464efd[_0x389775]={'$like':'%'+_0x485e3b['query'][_0x9a9e('0x36')]+'%'};return _0x464efd;})});}_0x5d9832=_[_0x9a9e('0x52')]({},_0x5d9832,_0x485e3b[_0x9a9e('0x53')]);return _0xb3ff71[_0x9a9e('0xe0')](_0x5d9832);}})[_0x9a9e('0x20')](function(_0x25ea0a){if(_0x25ea0a){_0x5c30b2=_0x25ea0a['length'];if(!_0x485e3b['query']['hasOwnProperty'](_0x9a9e('0xd6'))){_0x5d9832[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x485e3b['query'][_0x9a9e('0x1a')]);_0x5d9832[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x485e3b[_0x9a9e('0x42')][_0x9a9e('0x18')]);}return _0xb3ff71[_0x9a9e('0xe0')](_0x5d9832);}})[_0x9a9e('0x20')](function(_0x19ac95){if(_0x19ac95){return _0x19ac95?{'count':_0x5c30b2,'rows':_0x19ac95}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x539281,null))[_0x9a9e('0x51')](handleError(_0x539281,null));};exports[_0x9a9e('0xe2')]=function(_0x466eb2,_0x568f1c){var _0xf85bdf={};var _0x425358={};var _0x2a7fc2;var _0x777070;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x466eb2['params']['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x568f1c,null))[_0x9a9e('0x20')](function(_0x59123f){if(_0x59123f){_0x2a7fc2=_0x59123f;_0x425358[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db[_0x9a9e('0xe3')][_0x9a9e('0xce')]);_0x425358[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x466eb2[_0x9a9e('0x42')]);_0x425358[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x425358[_0x9a9e('0xcb')],_0x425358['query']);_0xf85bdf[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x425358[_0x9a9e('0xcb')],qs['fields'](_0x466eb2['query'][_0x9a9e('0xd1')]));_0xf85bdf[_0x9a9e('0x46')]=_0xf85bdf['attributes']['length']?_0xf85bdf[_0x9a9e('0x46')]:_0x425358['model'];_0xf85bdf[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x466eb2[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0xf85bdf[_0x9a9e('0x3e')]=qs['filters'](_[_0x9a9e('0xd4')](_0x466eb2[_0x9a9e('0x42')],_0x425358[_0x9a9e('0xcf')]));if(_0x466eb2['query'][_0x9a9e('0x36')]){_0xf85bdf[_0x9a9e('0x3e')]=_['merge'](_0xf85bdf[_0x9a9e('0x3e')],{'$or':_['map'](_0xf85bdf[_0x9a9e('0x46')],function(_0x143b14){var _0x13f8a4={};_0x13f8a4[_0x143b14]={'$like':'%'+_0x466eb2[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x13f8a4;})});}_0xf85bdf=_['merge']({},_0xf85bdf,_0x466eb2[_0x9a9e('0x53')]);return _0x2a7fc2['getFaxInteractions'](_0xf85bdf);}})[_0x9a9e('0x20')](function(_0x524413){if(_0x524413){_0x777070=_0x524413['length'];if(!_0x466eb2[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0xf85bdf[_0x9a9e('0x1a')]=qs[_0x9a9e('0x1a')](_0x466eb2[_0x9a9e('0x42')]['limit']);_0xf85bdf[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x466eb2[_0x9a9e('0x42')]['offset']);}return _0x2a7fc2[_0x9a9e('0xe2')](_0xf85bdf);}})[_0x9a9e('0x20')](function(_0x40ec0e){if(_0x40ec0e){return _0x40ec0e?{'count':_0x777070,'rows':_0x40ec0e}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x568f1c,null))['catch'](handleError(_0x568f1c,null));};exports[_0x9a9e('0xe4')]=function(_0x4aed4f,_0x21b880){var _0x4ee178={};var _0x1e1d74={};var _0x31a23e;var _0x5f020d;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x4aed4f[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x21b880,null))['then'](function(_0x4b888c){if(_0x4b888c){_0x31a23e=_0x4b888c;_0x1e1d74['model']=_[_0x9a9e('0xcc')](db['WhatsappInteraction'][_0x9a9e('0xce')]);_0x1e1d74[_0x9a9e('0x42')]=_['keys'](_0x4aed4f[_0x9a9e('0x42')]);_0x1e1d74[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x1e1d74['model'],_0x1e1d74[_0x9a9e('0x42')]);_0x4ee178[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x1e1d74[_0x9a9e('0xcb')],qs[_0x9a9e('0xd1')](_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x4ee178[_0x9a9e('0x46')]=_0x4ee178[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x4ee178[_0x9a9e('0x46')]:_0x1e1d74[_0x9a9e('0xcb')];_0x4ee178['order']=qs[_0x9a9e('0xd3')](_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x4ee178[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_['pick'](_0x4aed4f[_0x9a9e('0x42')],_0x1e1d74['filters']));if(_0x4aed4f[_0x9a9e('0x42')]['filter']){_0x4ee178[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x4ee178[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x4ee178['attributes'],function(_0x331e8c){var _0xa85858={};_0xa85858[_0x331e8c]={'$like':'%'+_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0xa85858;})});}_0x4ee178=_[_0x9a9e('0x52')]({},_0x4ee178,_0x4aed4f[_0x9a9e('0x53')]);return _0x31a23e[_0x9a9e('0xe4')](_0x4ee178);}})['then'](function(_0xb67a79){if(_0xb67a79){_0x5f020d=_0xb67a79['length'];if(!_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x4ee178[_0x9a9e('0x1a')]=qs['limit'](_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x4ee178[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x4aed4f[_0x9a9e('0x42')][_0x9a9e('0x18')]);}return _0x31a23e[_0x9a9e('0xe4')](_0x4ee178);}})['then'](function(_0x13ad77){if(_0x13ad77){return _0x13ad77?{'count':_0x5f020d,'rows':_0x13ad77}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x21b880,null))[_0x9a9e('0x51')](handleError(_0x21b880,null));};exports[_0x9a9e('0xe5')]=function(_0x5734e8,_0x56e909,_0x538b0c){var _0x522687;var _0x1c1ca8;var _0x32fc99;var _0x18c195=!_[_0x9a9e('0x5e')](_0x5734e8[_0x9a9e('0x57')]['id'])?_0x5734e8[_0x9a9e('0x57')]['id']:!_['isNil'](_0x5734e8['user']['id'])?_0x5734e8['user']['id']:null;return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x18c195,'role':{'$or':['admin',_0x9a9e('0x28'),_0x9a9e('0x22')]}},'attributes':['id','name','phone',_0x9a9e('0xe6'),_0x9a9e('0x21'),'internal','loginInPause']})[_0x9a9e('0x20')](function(_0x47730c){if(_0x47730c){if(_0x47730c['role']===_0x9a9e('0x22')){_0x522687=_0x47730c;if(_0x5734e8[_0x9a9e('0x56')][_0x9a9e('0x9f')]){_0x32fc99=util[_0x9a9e('0xe7')](_0x9a9e('0xe8'),_0x522687[_0x5734e8[_0x9a9e('0x56')][_0x9a9e('0x9f')]]);}else if(_0x5734e8[_0x9a9e('0x56')][_0x9a9e('0xe9')]){_0x32fc99=util[_0x9a9e('0xe7')](_0x9a9e('0xa0'),_0x5734e8[_0x9a9e('0x56')]['intrf']);}else{_0x32fc99=util[_0x9a9e('0xe7')](_0x9a9e('0xa0'),_0x522687['name']);}socket['to'](util[_0x9a9e('0xe7')](_0x9a9e('0xea'),_0x522687['name']))[_0x9a9e('0x23')](_0x9a9e('0xeb'),{'user':{'id':_0x522687['id'],'name':_0x522687['name']},'ip':_0x5734e8[_0x9a9e('0xec')][_0x9a9e('0xed')]||_0x5734e8[_0x9a9e('0xee')][_0x9a9e('0xef')]||_0x5734e8[_0x9a9e('0xf0')][_0x9a9e('0xef')]||_0x5734e8[_0x9a9e('0xee')]['socket'][_0x9a9e('0xef')]});return db[_0x9a9e('0xa3')][_0x9a9e('0x25')]({'where':{'membername':_0x522687[_0x9a9e('0x31')]},'individualHooks':!![]});}}else{throw new db[(_0x9a9e('0x87'))][(_0x9a9e('0x88'))](_0x9a9e('0xf1'));}})[_0x9a9e('0x20')](function(){if(_0x522687){return _0x522687[_0x9a9e('0xf2')]({'raw':!![]});}})[_0x9a9e('0x20')](function(_0x20b7a0){if(_0x522687){if(_0x20b7a0){_0x1c1ca8=_0x20b7a0;if(_0x1c1ca8[_0x9a9e('0x4b')]){var _0x21382d=_0x1c1ca8[_0x9a9e('0x2d')](function(_0x24ec93){var _0x3d70b1={'membername':_0x522687[_0x9a9e('0x31')],'UserId':_0x522687['id'],'queue_name':_0x24ec93['name'],'VoiceQueueId':_0x24ec93['id'],'interface':_0x32fc99,'paused':_0x522687[_0x9a9e('0xf3')]||![],'penalty':_0x24ec93[_0x9a9e('0xf4')]||0x0};return db[_0x9a9e('0xa3')]['upsert'](_0x3d70b1);});return Promise['all'](_0x21382d);}}}})[_0x9a9e('0x20')](function(){if(_0x522687){return db[_0x9a9e('0xf5')][_0x9a9e('0x48')]({'where':{'membername':_0x522687[_0x9a9e('0x31')],'exitAt':null}});}})['then'](function(_0x57f2bd){if(_0x522687){var _0x23ac30=[];_0x57f2bd[_0x9a9e('0xf6')](function(_0xc9c7c2){_0x23ac30[_0x9a9e('0x47')](_0xc9c7c2[_0x9a9e('0x1f')]({'exitAt':moment()[_0x9a9e('0xe7')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x9a9e('0x55')](_0x23ac30);}})['then'](function(){if(_0x522687){var _0xd207d7=[];var _0x449940=[];var _0x5ac72b=utils['getChannels']();var _0x2fd532={'membername':_0x522687[_0x9a9e('0x31')],'interface':_0x32fc99,'enterAt':moment()['format'](_0x9a9e('0xf7')),'role':_0x522687[_0x9a9e('0x21')],'internal':_0x522687[_0x9a9e('0x5b')]};_0x5ac72b[_0x9a9e('0xf6')](function(_0x36089d){_0xd207d7['push'](_[_0x9a9e('0x52')]({'channel':_0x36089d,'type':'LOGIN','data1':_0x5734e8[_0x9a9e('0x56')][_0x9a9e('0xf8')],'data2':_0x32fc99},_0x2fd532));if(_0x522687[_0x9a9e('0xf3')]){_0x449940[_0x9a9e('0x47')](_[_0x9a9e('0x52')]({'channel':_0x36089d,'type':_0x9a9e('0xf9'),'data1':_0x9a9e('0xfa')},_0x2fd532));}});return db['MemberReport'][_0x9a9e('0x81')](_0xd207d7['concat'](_0x449940),{'individualHooks':!![]});}})[_0x9a9e('0x20')](function(){if(_0x522687){return _0x522687[_0x9a9e('0x1f')]({'online':!![],'lastLoginAt':moment()['format'](_0x9a9e('0xf7')),'voicePause':_0x522687[_0x9a9e('0xf3')]||![],'mailPause':_0x522687[_0x9a9e('0xf3')]||![],'chatPause':_0x522687[_0x9a9e('0xf3')]||![],'faxPause':_0x522687[_0x9a9e('0xf3')]||![],'smsPause':_0x522687['loginInPause']||![],'openchannelPause':_0x522687[_0x9a9e('0xf3')]||![],'whatsappPause':_0x522687[_0x9a9e('0xf3')]||![],'pauseType':_0x522687[_0x9a9e('0xf3')]?_0x9a9e('0xfa'):null,'interface':_0x32fc99,'lastPauseAt':moment()[_0x9a9e('0xe7')](_0x9a9e('0xf7'))});}})[_0x9a9e('0x20')](function(_0x1f25ef){if(_0x5734e8[_0x9a9e('0xfb')]){return _0x538b0c();}else{return Promise[_0x9a9e('0xfc')](_0x1f25ef)[_0x9a9e('0x20')](respondWithResult(_0x56e909,null));}})[_0x9a9e('0x51')](handleError(_0x56e909,null));};exports['logout']=function(_0x41cc25,_0x44f683){var _0x1f6c21;return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x41cc25[_0x9a9e('0x57')]['id'],'role':'agent'},'attributes':['id',_0x9a9e('0x31'),'role']})[_0x9a9e('0x20')](handleEntityNotFound(_0x44f683,null))[_0x9a9e('0x20')](function(_0x529270){if(_0x529270){_0x1f6c21=_0x529270;return db[_0x9a9e('0xa3')]['destroy']({'where':{'membername':_0x1f6c21[_0x9a9e('0x31')]},'individualHooks':!![]});}})[_0x9a9e('0x20')](function(){return db[_0x9a9e('0xf5')]['findAll']({'where':{'membername':_0x1f6c21[_0x9a9e('0x31')],'exitAt':null}});})['then'](function(_0x357ccb){var _0x8b63=[];_0x357ccb[_0x9a9e('0xf6')](function(_0x15c877){_0x8b63['push'](_0x15c877[_0x9a9e('0x1f')]({'exitAt':moment()[_0x9a9e('0xe7')](_0x9a9e('0xf7'))}));});return Promise[_0x9a9e('0x55')](_0x8b63);})['then'](function(){return _0x1f6c21[_0x9a9e('0x1f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x44f683,null))['catch'](handleError(_0x44f683,null));};exports['pause']=function(_0x38dfe1,_0x14a633){var _0x23fc68;return db[_0x9a9e('0xa3')]['update']({'paused':0x1},{'where':{'UserId':_0x38dfe1['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x38dfe1[_0x9a9e('0x57')]['id'],'role':_0x9a9e('0x22')},'attributes':['id','name','role','internal',_0x9a9e('0x9f'),_0x9a9e('0x9e')]});})['then'](handleEntityNotFound(_0x14a633,null))[_0x9a9e('0x20')](function(_0x525f4d){if(_0x525f4d){_0x23fc68=_0x525f4d;return db[_0x9a9e('0xf5')][_0x9a9e('0x48')]({'where':{'membername':_0x23fc68['name'],'type':'PAUSE','exitAt':null}});}})[_0x9a9e('0x20')](function(_0x5324c2){if(_0x5324c2[_0x9a9e('0x4b')]){var _0x1a4062=moment()[_0x9a9e('0xe7')](_0x9a9e('0xf7'));for(var _0x3a7aa3=0x0,_0x3ac790=_0x5324c2['length'];_0x3a7aa3<_0x3ac790;_0x3a7aa3++){_0x5324c2[_0x3a7aa3][_0x9a9e('0xfd')]({'exitAt':_0x1a4062});}}})['then'](function(){var _0x4df566=[];var _0x1abc79=utils[_0x9a9e('0xfe')]();_0x1abc79[_0x9a9e('0xf6')](function(_0x11f6ec){_0x4df566[_0x9a9e('0x47')]({'channel':_0x11f6ec,'membername':_0x23fc68[_0x9a9e('0x31')],'interface':_[_0x9a9e('0x5e')](_0x23fc68['interface'])?util['format']('SIP/%s',_0x23fc68[_0x9a9e('0x31')]):_0x23fc68[_0x9a9e('0x9f')],'type':_0x9a9e('0xf9'),'enterAt':moment()[_0x9a9e('0xe7')](_0x9a9e('0xf7')),'data1':_0x38dfe1[_0x9a9e('0x56')]['type']||'DEFAULT\x20PAUSE','role':_0x23fc68[_0x9a9e('0x21')],'internal':_0x23fc68['internal']});});return db[_0x9a9e('0xf5')][_0x9a9e('0x81')](_0x4df566,{'individualHooks':!![]});})['then'](function(){return _0x23fc68[_0x9a9e('0x1f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x38dfe1[_0x9a9e('0x56')][_0x9a9e('0x34')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x9a9e('0xe7')](_0x9a9e('0xf7'))});})['then'](respondWithResult(_0x14a633,null))[_0x9a9e('0x51')](handleError(_0x14a633,null));};exports[_0x9a9e('0xff')]=function(_0x28687a,_0x3832ee){if(_0x28687a[_0x9a9e('0x56')][_0x9a9e('0x94')]&&!utils[_0x9a9e('0x95')](_0x28687a[_0x9a9e('0x56')][_0x9a9e('0x94')])){throw new APIBadRequestError(util[_0x9a9e('0xe7')](_0x9a9e('0x100'),_0x28687a[_0x9a9e('0x56')]['channel']));}return db[_0x9a9e('0x3f')][_0x9a9e('0x30')]({'where':{'id':_0x28687a[_0x9a9e('0x57')]['id']},'attributes':['id',_0x9a9e('0x31'),_0x9a9e('0x21'),_0x9a9e('0x5b'),'interface',_0x9a9e('0x9e'),_0x9a9e('0xa1'),_0x9a9e('0x101'),_0x9a9e('0x102'),_0x9a9e('0x103'),_0x9a9e('0x104'),_0x9a9e('0x105'),_0x9a9e('0x106'),_0x9a9e('0x107'),_0x9a9e('0x108')]})[_0x9a9e('0x20')](function(_0xa3eab6){if(!_0xa3eab6){throw new APINotFoundError(util[_0x9a9e('0xe7')](_0x9a9e('0xc2'),_0x28687a[_0x9a9e('0x57')]['id']));}return _0xa3eab6[_0x9a9e('0xff')](_0x28687a['body']['channel']);})[_0x9a9e('0x20')](respondWithResult(_0x3832ee,null))[_0x9a9e('0x51')](APIHandleError(_0x3832ee));};exports[_0x9a9e('0x109')]=function(_0x4c836c,_0x4a5b84){var _0x199840={};var _0x53d00e={};var _0x227b91;var _0x355833;return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x4c836c[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x4a5b84,null))[_0x9a9e('0x20')](function(_0x4b1c0d){if(_0x4b1c0d){_0x227b91=_0x4b1c0d;_0x53d00e[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db['Team'][_0x9a9e('0xce')]);_0x53d00e[_0x9a9e('0x42')]=_['keys'](_0x4c836c[_0x9a9e('0x42')]);_0x53d00e[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x53d00e[_0x9a9e('0xcb')],_0x53d00e[_0x9a9e('0x42')]);_0x199840['attributes']=_[_0x9a9e('0xd0')](_0x53d00e[_0x9a9e('0xcb')],qs[_0x9a9e('0xd1')](_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x199840[_0x9a9e('0x46')]=_0x199840[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x199840[_0x9a9e('0x46')]:_0x53d00e[_0x9a9e('0xcb')];_0x199840[_0x9a9e('0xd2')]=qs['sort'](_0x4c836c['query']['sort']);_0x199840['where']=qs[_0x9a9e('0xcf')](_['pick'](_0x4c836c['query'],_0x53d00e['filters']));if(_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0x36')]){_0x199840[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x199840[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x199840[_0x9a9e('0x46')],function(_0x9b578){var _0x6fbfe2={};_0x6fbfe2[_0x9b578]={'$like':'%'+_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x6fbfe2;})});}_0x199840=_['merge']({},_0x199840,_0x4c836c[_0x9a9e('0x53')]);return _0x227b91[_0x9a9e('0x109')](_0x199840);}})['then'](function(_0x103902){if(_0x103902){_0x355833=_0x103902[_0x9a9e('0x4b')];if(!_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x199840['limit']=qs['limit'](_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x199840[_0x9a9e('0x18')]=qs[_0x9a9e('0x18')](_0x4c836c[_0x9a9e('0x42')][_0x9a9e('0x18')]);}return _0x227b91['getTeams'](_0x199840);}})[_0x9a9e('0x20')](function(_0x1d5e7c){if(_0x1d5e7c){return _0x1d5e7c?{'count':_0x355833,'rows':_0x1d5e7c}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x4a5b84,null))[_0x9a9e('0x51')](handleError(_0x4a5b84,null));};exports['addTeams']=function(_0x119539,_0x582ade){var _0xe30177=_0x119539[_0x9a9e('0x57')]['id'];var _0x5c6f99=_0x119539[_0x9a9e('0x56')]?_0x119539[_0x9a9e('0x56')][_0x9a9e('0x59')]:null;var _0x183cf0=[];return Promise[_0x9a9e('0xfc')]()[_0x9a9e('0x20')](function(){if(!_0x5c6f99)throw new APIBadRequestError(_0x9a9e('0x10a'));})[_0x9a9e('0x20')](function(){return db['User'][_0x9a9e('0x8f')]({'where':{'id':_0xe30177}});})[_0x9a9e('0x20')](function(_0x217955){if(!_0x217955)throw new APINotFoundError(util[_0x9a9e('0xe7')](_0x9a9e('0xc2'),_0x119539[_0x9a9e('0x57')]['id']));return db[_0x9a9e('0x60')][_0x9a9e('0x10b')](function(_0x57f395){return _0x217955[_0x9a9e('0x10c')](_0x5c6f99,{'transaction':_0x57f395})['then'](function(){return db['Team'][_0x9a9e('0x48')]({'where':{'id':{'$in':_0x5c6f99}}});})[_0x9a9e('0x20')](function(_0x52327c){var _0x586fc0=_[_0x9a9e('0x2d')](_0x52327c,function(_0x5022c3){return _0x5022c3[_0x9a9e('0x10d')]();});return Promise[_0x9a9e('0x55')](_0x586fc0);})[_0x9a9e('0x20')](function(_0x11ebfd){_0x183cf0=_[_0x9a9e('0x10e')](_0x11ebfd);var _0x1d35b2=_[_0x9a9e('0x2d')](_0x183cf0,function(_0x4d1b2f){return _0x4d1b2f[_0x9a9e('0x10f')](_0x217955['id'],{'transaction':_0x57f395});});return Promise[_0x9a9e('0x55')](_0x1d35b2);})[_0x9a9e('0x20')](function(){if(!_0x217955['online'])return;var _0x502a63=_['filter'](_0x183cf0,function(_0x22a5b1){return _0x22a5b1['getDataValue'](_0x9a9e('0x94'))===_0x9a9e('0x110');});var _0x592cdb=_[_0x9a9e('0x2d')](_0x502a63,function(_0x753ef4){return db['UserVoiceQueueRt'][_0x9a9e('0x111')]({'membername':_0x217955[_0x9a9e('0x31')],'UserId':_0x217955['id'],'queue_name':_0x753ef4['name'],'VoiceQueueId':_0x753ef4['id'],'interface':_[_0x9a9e('0x5e')](_0x217955[_0x9a9e('0x9f')])?util['format'](_0x9a9e('0xa0'),_0x217955['name']):_0x217955[_0x9a9e('0x9f')],'paused':_0x217955[_0x9a9e('0xa1')]||![],'penalty':_0x217955[_0x9a9e('0xa2')]},{'transaction':_0x57f395});});return Promise[_0x9a9e('0x55')](_0x592cdb);})[_0x9a9e('0x20')](function(){return db['TeamVoicePrefix'][_0x9a9e('0x48')]({'where':{'teamId':{'$in':_0x5c6f99}}});})['then'](function(_0x18f706){var _0x196e34=_[_0x9a9e('0x2d')](_0x18f706,function(_0xcf1984){return db['UserVoicePrefix']['create']({'UserId':_0x217955['id'],'VoicePrefixId':_0xcf1984['VoicePrefixId']},{'transaction':_0x57f395});});return Promise['all'](_0x196e34);});});})[_0x9a9e('0x20')](function(){for(var _0x4ae16b=0x0;_0x4ae16b<_0x183cf0[_0x9a9e('0x4b')];_0x4ae16b++){var _0x3e236a=_0x183cf0[_0x4ae16b][_0x9a9e('0x112')]('channel');var _0x5086d7=_0x3e236a+_0x9a9e('0xa8');socket[_0x9a9e('0x23')](_0x9a9e('0x28')+_0x3e236a+_0x9a9e('0x9b'),{'UserId':_0xe30177,['queueField']:_0x183cf0[_0x4ae16b]['id']});}})[_0x9a9e('0x20')](respondWithStatusCode(_0x582ade,null))[_0x9a9e('0x51')](APIHandleError(_0x582ade));};exports[_0x9a9e('0x113')]=function(_0x10f0b7,_0x1dcaa2){var _0x30abdc=_0x10f0b7['params']['id'];var _0x17cc80=null;if(_0x10f0b7[_0x9a9e('0x42')][_0x9a9e('0x59')]){_0x17cc80=_[_0x9a9e('0xa7')](_0x10f0b7[_0x9a9e('0x42')]['ids'])?_0x10f0b7[_0x9a9e('0x42')][_0x9a9e('0x59')]:[_0x10f0b7[_0x9a9e('0x42')][_0x9a9e('0x59')]];}var _0x3f2e5a=[];return Promise[_0x9a9e('0xfc')]()['then'](function(){if(!_0x17cc80)throw new APIBadRequestError(_0x9a9e('0x114'));})[_0x9a9e('0x20')](function(){return db[_0x9a9e('0x3f')][_0x9a9e('0x8f')]({'where':{'id':_0x30abdc}});})[_0x9a9e('0x20')](function(_0x2e35df){if(!_0x2e35df)throw new APINotFoundError(util[_0x9a9e('0xe7')](_0x9a9e('0xc2'),_0x10f0b7[_0x9a9e('0x57')]['id']));return db[_0x9a9e('0x60')]['transaction'](function(_0x243e81){return _0x2e35df['removeTeams'](_0x17cc80,{'transaction':_0x243e81})[_0x9a9e('0x20')](function(){return db[_0x9a9e('0x115')]['findAll']({'where':{'id':{'$in':_0x17cc80}}});})[_0x9a9e('0x20')](function(_0x3eed78){var _0x207f46=_[_0x9a9e('0x2d')](_0x3eed78,function(_0x40c315){return _0x40c315[_0x9a9e('0x10d')]();});return Promise['all'](_0x207f46);})[_0x9a9e('0x20')](function(_0x13d2c7){_0x3f2e5a=_[_0x9a9e('0x10e')](_0x13d2c7);var _0x113270=_['map'](_0x3f2e5a,function(_0x50ad50){return _0x50ad50['removeAgent'](_0x2e35df['id'],{'transaction':_0x243e81});});return Promise[_0x9a9e('0x55')](_0x113270);})[_0x9a9e('0x20')](function(){if(!_0x2e35df[_0x9a9e('0x9e')])return;var _0x4f2f2d=_[_0x9a9e('0x36')](_0x3f2e5a,function(_0x22dd99){return _0x22dd99['getDataValue'](_0x9a9e('0x94'))===_0x9a9e('0x110');});var _0x182b7c=_[_0x9a9e('0x2d')](_0x4f2f2d,function(_0x5c5639){return db[_0x9a9e('0xa3')][_0x9a9e('0x25')]({'where':{'VoiceQueueId':_0x5c5639['id'],'UserId':_0x2e35df['id']},'transaction':_0x243e81});});return Promise[_0x9a9e('0x55')](_0x182b7c);})[_0x9a9e('0x20')](function(){return db[_0x9a9e('0x116')][_0x9a9e('0x48')]({'where':{'teamId':{'$in':_0x17cc80}}});})[_0x9a9e('0x20')](function(_0x1c6dca){var _0x42286c=_[_0x9a9e('0x2d')](_0x1c6dca,function(_0x882285){return db[_0x9a9e('0x117')][_0x9a9e('0x25')]({'where':{'UserId':_0x2e35df['id'],'VoicePrefixId':_0x882285[_0x9a9e('0x118')]}},{'transaction':_0x243e81});});return Promise[_0x9a9e('0x55')](_0x42286c);});});})[_0x9a9e('0x20')](function(){for(var _0x50b0f8=0x0;_0x50b0f8<_0x3f2e5a[_0x9a9e('0x4b')];_0x50b0f8++){var _0x24f607=_0x3f2e5a[_0x50b0f8][_0x9a9e('0x112')](_0x9a9e('0x94'));var _0x474459=_0x24f607+_0x9a9e('0xa8');socket[_0x9a9e('0x23')](_0x9a9e('0x28')+_0x24f607+'Queue:remove',{'UserId':_0x30abdc,['queueField']:_0x3f2e5a[_0x50b0f8]['id']});}})[_0x9a9e('0x20')](respondWithStatusCode(_0x1dcaa2,null))[_0x9a9e('0x51')](APIHandleError(_0x1dcaa2));};exports[_0x9a9e('0x119')]=function(_0x2a89a9,_0x5b9e2f){var _0x459f4f={};var _0x16342a={};var _0x1c47df;var _0x2ec482;return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x2a89a9[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x5b9e2f,null))['then'](function(_0x39d3d4){if(_0x39d3d4){_0x1c47df=_0x39d3d4;_0x16342a[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db[_0x9a9e('0xc4')]['rawAttributes']);_0x16342a[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x2a89a9[_0x9a9e('0x42')]);_0x16342a[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x16342a['model'],_0x16342a[_0x9a9e('0x42')]);_0x459f4f[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x16342a[_0x9a9e('0xcb')],qs[_0x9a9e('0xd1')](_0x2a89a9[_0x9a9e('0x42')][_0x9a9e('0xd1')]));_0x459f4f['attributes']=_0x459f4f[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x459f4f[_0x9a9e('0x46')]:_0x16342a['model'];_0x459f4f[_0x9a9e('0xd2')]=qs[_0x9a9e('0xd3')](_0x2a89a9[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x459f4f[_0x9a9e('0x3e')]=qs[_0x9a9e('0xcf')](_[_0x9a9e('0xd4')](_0x2a89a9[_0x9a9e('0x42')],_0x16342a['filters']));if(_0x2a89a9['query']['filter']){_0x459f4f[_0x9a9e('0x3e')]=_[_0x9a9e('0x52')](_0x459f4f[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x459f4f['attributes'],function(_0xbaefd3){var _0x157ddf={};_0x157ddf[_0xbaefd3]={'$like':'%'+_0x2a89a9['query'][_0x9a9e('0x36')]+'%'};return _0x157ddf;})});}_0x459f4f=_[_0x9a9e('0x52')]({},_0x459f4f,_0x2a89a9[_0x9a9e('0x53')]);return _0x1c47df['getLists'](_0x459f4f);}})[_0x9a9e('0x20')](function(_0x4a2406){if(_0x4a2406){_0x2ec482=_0x4a2406[_0x9a9e('0x4b')];if(!_0x2a89a9[_0x9a9e('0x42')][_0x9a9e('0xc3')](_0x9a9e('0xd6'))){_0x459f4f['limit']=qs[_0x9a9e('0x1a')](_0x2a89a9[_0x9a9e('0x42')][_0x9a9e('0x1a')]);_0x459f4f['offset']=qs[_0x9a9e('0x18')](_0x2a89a9['query'][_0x9a9e('0x18')]);}return _0x1c47df[_0x9a9e('0x119')](_0x459f4f);}})[_0x9a9e('0x20')](function(_0x420f7c){if(_0x420f7c){return _0x420f7c?{'count':_0x2ec482,'rows':_0x420f7c}:null;}})[_0x9a9e('0x20')](respondWithResult(_0x5b9e2f,null))[_0x9a9e('0x51')](handleError(_0x5b9e2f,null));};exports[_0x9a9e('0x11a')]=function(_0x1d358a,_0x38b299){var _0x324d5c={};var _0x488a50={};var _0x1ac4e4;return db[_0x9a9e('0x3f')]['findOne']({'where':{'id':_0x1d358a[_0x9a9e('0x57')]['id']}})[_0x9a9e('0x20')](handleEntityNotFound(_0x38b299,null))[_0x9a9e('0x20')](function(_0x1b1b8a){if(_0x1b1b8a){_0x1ac4e4=_0x1b1b8a;_0x488a50[_0x9a9e('0xcb')]=_[_0x9a9e('0xcc')](db[_0x9a9e('0x3f')][_0x9a9e('0xce')]);_0x488a50[_0x9a9e('0x42')]=_[_0x9a9e('0xcc')](_0x1d358a[_0x9a9e('0x42')]);_0x488a50[_0x9a9e('0xcf')]=_[_0x9a9e('0xd0')](_0x488a50[_0x9a9e('0xcb')],_0x488a50['query']);_0x324d5c[_0x9a9e('0x46')]=_[_0x9a9e('0xd0')](_0x488a50[_0x9a9e('0xcb')],qs['fields'](_0x1d358a['query'][_0x9a9e('0xd1')]));_0x324d5c[_0x9a9e('0x46')]=_0x324d5c[_0x9a9e('0x46')][_0x9a9e('0x4b')]?_0x324d5c[_0x9a9e('0x46')]:_0x488a50[_0x9a9e('0xcb')];_0x324d5c['order']=qs[_0x9a9e('0xd3')](_0x1d358a[_0x9a9e('0x42')][_0x9a9e('0xd3')]);_0x324d5c['where']=qs['filters'](_[_0x9a9e('0xd4')](_0x1d358a[_0x9a9e('0x42')],_0x488a50[_0x9a9e('0xcf')]));if(_0x1d358a[_0x9a9e('0x42')]['filter']){_0x324d5c[_0x9a9e('0x3e')]=_['merge'](_0x324d5c[_0x9a9e('0x3e')],{'$or':_[_0x9a9e('0x2d')](_0x324d5c['attributes'],function(_0x1f1b84){var _0x3f7365={};_0x3f7365[_0x1f1b84]={'$like':'%'+_0x1d358a[_0x9a9e('0x42')][_0x9a9e('0x36')]+'%'};return _0x3f7365;})});}_0x324d5c[_0x9a9e('0xcb')]=db['User'];_0x324d5c['as']=_0x9a9e('0x29');_0x324d5c=_[_0x9a9e('0x52')]({},_0x324d5c,_0x1d358a[_0x9a9e('0x53')]);return _0x1ac4e4[_0x9a9e('0xf2')]({'include':[_0x324d5c]});}})[_0x9a9e('0x20')](function(_0x231b03){if(_0x231b03){var _0x47e738={},_0x62f6da=[];for(var _0x2bf011=0x0;_0x2bf011<_0x231b03[_0x9a9e('0x4b')];_0x2bf011+=0x1){for(var _0x4069c6=0x0,_0x53f615;_0x4069c6<_0x231b03[_0x2bf011]['Agents'][_0x9a9e('0x4b')];_0x4069c6+=0x1){_0x53f615=_0x231b03[_0x2bf011]['Agents'][_0x4069c6][_0x9a9e('0x26')]({'plain':!![]});_0x47e738[_0x53f615['id']]=_0x53f615;}}_0x47e738=_['values'](_0x47e738);for(var _0x58a6f6=qs[_0x9a9e('0x18')](_0x1d358a[_0x9a9e('0x42')]['offset']);_0x58a6f6<_0x47e738[_0x9a9e('0x4b')]&&_0x62f6da[_0x9a9e('0x4b')]=_0x4bdf70['agents']){throw new Error(_0x348d('0x4d'));}})[_0x348d('0x2c')](function(){if(_0x2be508){return db[_0x348d('0x41')]['destroy']({'where':{'membername':_0x2be508[_0x348d('0x23')]},'individualHooks':!![]});}})[_0x348d('0x2c')](function(){if(_0x2be508){return _0x2be508[_0x348d('0x4e')]({'raw':!![]});}})[_0x348d('0x2c')](function(_0x706a7f){if(_0x2be508){if(_0x706a7f){var _0x3dd291=[];_0x1e0ba4=_0x706a7f;if(_0x1e0ba4[_0x348d('0x4f')]){for(var _0x3b5c38=0x0;_0x3b5c38<_0x1e0ba4['length'];_0x3b5c38++){_0x3dd291[_0x348d('0x44')](db['UserVoiceQueueRt']['upsert']({'membername':_0x2be508[_0x348d('0x23')],'UserId':_0x2be508['id'],'queue_name':_0x1e0ba4[_0x3b5c38][_0x348d('0x23')],'VoiceQueueId':_0x1e0ba4[_0x3b5c38]['id'],'interface':_0x4f83ee,'paused':_0x2be508[_0x348d('0x48')]||![],'penalty':_0x1e0ba4[_0x3b5c38][_0x348d('0x50')]||0x0}));}return BPromise[_0x348d('0x45')](_0x3dd291);}}}})[_0x348d('0x2c')](function(){if(_0x2be508){return db[_0x348d('0x43')]['findAll']({'where':{'membername':_0x2be508[_0x348d('0x23')],'exitAt':null}});}})[_0x348d('0x2c')](function(_0x8861c5){if(_0x2be508){if(_0x8861c5&&_0x8861c5[_0x348d('0x4f')]){var _0x210933=[];_0x8861c5['forEach'](function(_0x4b98a0){_0x210933[_0x348d('0x44')](_0x4b98a0[_0x348d('0x2a')]({'exitAt':moment()[_0x348d('0x27')](_0x348d('0x32'))}));});return BPromise[_0x348d('0x45')](_0x210933);}}})[_0x348d('0x2c')](function(){if(_0x2be508){var _0x343708=[];var _0x4b1220=[];var _0xe6c4df=utils[_0x348d('0x2e')]();var _0x3ed4ab={'membername':_0x2be508['name'],'interface':_0x4f83ee,'enterAt':moment()[_0x348d('0x27')](_0x348d('0x32')),'role':_0x2be508[_0x348d('0x24')],'internal':_0x2be508[_0x348d('0x25')]};_0xe6c4df[_0x348d('0x2f')](function(_0x659f3e){_0x343708['push'](_[_0x348d('0x51')]({'channel':_0x659f3e,'type':_0x348d('0x52'),'data1':'callysquare','data2':_0x4f83ee},_0x3ed4ab));if(_0x2be508[_0x348d('0x48')]){_0x4b1220[_0x348d('0x44')](_[_0x348d('0x51')]({'channel':_0x659f3e,'type':_0x348d('0x2b'),'data1':_0x348d('0x53')},_0x3ed4ab));}});return db[_0x348d('0x43')][_0x348d('0x36')](_0x343708[_0x348d('0x54')](_0x4b1220),{'individualHooks':!![]});}})[_0x348d('0x2c')](function(){if(_0x2be508){return _0x2be508[_0x348d('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x348d('0x27')](_0x348d('0x32')),'voicePause':_0x2be508[_0x348d('0x48')]||![],'mailPause':_0x2be508[_0x348d('0x48')]||![],'chatPause':_0x2be508[_0x348d('0x48')]||![],'faxPause':_0x2be508[_0x348d('0x48')]||![],'smsPause':_0x2be508[_0x348d('0x48')]||![],'openchannelPause':_0x2be508[_0x348d('0x48')]||![],'pauseType':_0x2be508[_0x348d('0x48')]?_0x348d('0x53'):null,'lastPauseAt':moment()[_0x348d('0x27')](_0x348d('0x32')),'interface':_0x4f83ee});}})['then'](function(_0x4214df){_0x270698(_0x4214df);})[_0x348d('0x21')](function(_0x2c5325){_0x3320f6(_0x276d21[_0x348d('0x1d')](0x1f4,_0x2c5325[_0x348d('0x1e')]));});});}; \ No newline at end of file +var _0x67ba=['util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','redis','localhost','register','GetUser','User','findAll','options','raw','where','attributes','include','map','model','info','debug','stringify','catch','message','error','ShowUser','find','role','interface','then','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','name','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','body','internal','bulkCreate','type','DEFAULT\x20PAUSE','UnpauseUser','resolve','channel','online','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','unpause','system','LogoutUser','destroy','all','LoginUser','findOne','mobile','phone','loginInPause','SIP/%s','count','agent','../../config/license/util','getLicense','agents','getVoiceQueues','UserVoiceQueue.penalty','merge','PAUSE','LOGININPAUSE','lodash'];(function(_0x21c23e,_0x1d33e3){var _0xa7b7e2=function(_0x6ac2a8){while(--_0x6ac2a8){_0x21c23e['push'](_0x21c23e['shift']());}};_0xa7b7e2(++_0x1d33e3);}(_0x67ba,0xa5));var _0xa67b=function(_0x497c96,_0x3f474d){_0x497c96=_0x497c96-0x0;var _0x53372c=_0x67ba[_0x497c96];return _0x53372c;};'use strict';var _=require(_0xa67b('0x0'));var util=require(_0xa67b('0x1'));var moment=require(_0xa67b('0x2'));var BPromise=require(_0xa67b('0x3'));var Redis=require(_0xa67b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa67b('0x5'))(_0xa67b('0x6'));var config=require(_0xa67b('0x7'));config[_0xa67b('0x8')]=_['defaults'](config['redis'],{'host':_0xa67b('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa67b('0x8')]));require('./user.socket')[_0xa67b('0xa')](socket);exports[_0xa67b('0xb')]=function(_0x377897){var _0x5943b3=this;return new Promise(function(_0xd36457,_0x5ce990){return db[_0xa67b('0xc')][_0xa67b('0xd')]({'raw':_0x377897[_0xa67b('0xe')]?_0x377897['options'][_0xa67b('0xf')]===undefined?!![]:![]:!![],'where':_0x377897[_0xa67b('0xe')]?_0x377897[_0xa67b('0xe')][_0xa67b('0x10')]||null:null,'attributes':_0x377897[_0xa67b('0xe')]?_0x377897[_0xa67b('0xe')][_0xa67b('0x11')]||null:null,'limit':_0x377897[_0xa67b('0xe')]?_0x377897['options']['limit']||null:null,'include':_0x377897['options']?_0x377897[_0xa67b('0xe')][_0xa67b('0x12')]?_[_0xa67b('0x13')](_0x377897['options'][_0xa67b('0x12')],function(_0x27d34b){return{'model':db[_0x27d34b[_0xa67b('0x14')]],'as':_0x27d34b['as'],'attributes':_0x27d34b[_0xa67b('0x11')],'include':_0x27d34b['include']?_[_0xa67b('0x13')](_0x27d34b['include'],function(_0x5e713f){return{'model':db[_0x5e713f[_0xa67b('0x14')]],'as':_0x5e713f['as'],'attributes':_0x5e713f['attributes'],'include':_0x5e713f['include']?_[_0xa67b('0x13')](_0x5e713f['include'],function(_0x25f2b6){return{'model':db[_0x25f2b6[_0xa67b('0x14')]],'as':_0x25f2b6['as'],'attributes':_0x25f2b6[_0xa67b('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3075c5){logger[_0xa67b('0x15')](_0xa67b('0xb'),_0x377897);logger[_0xa67b('0x16')](_0xa67b('0xb'),_0x377897,JSON[_0xa67b('0x17')](_0x3075c5));_0xd36457(_0x3075c5);})[_0xa67b('0x18')](function(_0x175040){logger['error'](_0xa67b('0xb'),_0x175040[_0xa67b('0x19')],_0x377897);_0x5ce990(_0x5943b3[_0xa67b('0x1a')](0x1f4,_0x175040[_0xa67b('0x19')]));});});};exports[_0xa67b('0x1b')]=function(_0x552ed7){var _0x2446f3=this;return new Promise(function(_0x3cdcd5,_0xbb3099){return db['User'][_0xa67b('0x1c')]({'raw':_0x552ed7[_0xa67b('0xe')]?_0x552ed7[_0xa67b('0xe')][_0xa67b('0xf')]===undefined?!![]:![]:!![],'where':_0x552ed7[_0xa67b('0xe')]?_0x552ed7[_0xa67b('0xe')][_0xa67b('0x10')]||null:null,'attributes':_0x552ed7[_0xa67b('0xe')]?_0x552ed7[_0xa67b('0xe')]['attributes']||null:null,'include':_0x552ed7['options']?_0x552ed7[_0xa67b('0xe')][_0xa67b('0x12')]?_[_0xa67b('0x13')](_0x552ed7[_0xa67b('0xe')][_0xa67b('0x12')],function(_0x33b281){return{'model':db[_0x33b281[_0xa67b('0x14')]],'as':_0x33b281['as'],'attributes':_0x33b281['attributes'],'include':_0x33b281['include']?_[_0xa67b('0x13')](_0x33b281[_0xa67b('0x12')],function(_0x45c7b7){return{'model':db[_0x45c7b7[_0xa67b('0x14')]],'as':_0x45c7b7['as'],'attributes':_0x45c7b7['attributes'],'include':_0x45c7b7[_0xa67b('0x12')]?_[_0xa67b('0x13')](_0x45c7b7[_0xa67b('0x12')],function(_0x12fbfa){return{'model':db[_0x12fbfa[_0xa67b('0x14')]],'as':_0x12fbfa['as'],'attributes':_0x12fbfa[_0xa67b('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a43ca){logger[_0xa67b('0x15')](_0xa67b('0x1b'),_0x552ed7);logger['debug'](_0xa67b('0x1b'),_0x552ed7,JSON['stringify'](_0x1a43ca));_0x3cdcd5(_0x1a43ca);})[_0xa67b('0x18')](function(_0x413d16){logger[_0xa67b('0x1a')](_0xa67b('0x1b'),_0x413d16[_0xa67b('0x19')],_0x552ed7);_0xbb3099(_0x2446f3[_0xa67b('0x1a')](0x1f4,_0x413d16['message']));});});};exports['PauseUser']=function(_0x3e507c){var _0x5e3fd7;return db['User'][_0xa67b('0x1c')]({'where':_0x3e507c['options'][_0xa67b('0x10')]||{},'attributes':['id','name',_0xa67b('0x1d'),'internal',_0xa67b('0x1e')]})[_0xa67b('0x1f')](function(_0x3f26d4){if(!_0x3f26d4){throw new Error(util[_0xa67b('0x20')](_0xa67b('0x21'),_0x3e507c[_0xa67b('0x22')]['id']));}_0x5e3fd7=_0x3f26d4;return db[_0xa67b('0x23')][_0xa67b('0x24')]({'paused':0x1},{'where':{'UserId':_0x5e3fd7['id']},'individualHooks':!![]});})[_0xa67b('0x1f')](function(){return db[_0xa67b('0x25')][_0xa67b('0xd')]({'where':{'membername':_0x5e3fd7[_0xa67b('0x26')],'type':'PAUSE','exitAt':null}});})[_0xa67b('0x1f')](function(_0x35cb24){if(_0x35cb24&&_0x35cb24[_0xa67b('0x27')]){var _0x248611=moment()['format'](_0xa67b('0x28'));for(var _0x5e9349=0x0,_0x5a166d=_0x35cb24['length'];_0x5e9349<_0x5a166d;_0x5e9349++){_0x35cb24[_0x5e9349][_0xa67b('0x29')]({'exitAt':_0x248611});}}})[_0xa67b('0x1f')](function(){var _0x4ec10b=[];var _0x2cc0fb=utils[_0xa67b('0x2a')]();_0x2cc0fb[_0xa67b('0x2b')](function(_0x1f62c2){_0x4ec10b[_0xa67b('0x2c')]({'channel':_0x1f62c2,'membername':_0x5e3fd7[_0xa67b('0x26')],'interface':_[_0xa67b('0x2d')](_0x5e3fd7['interface'])?util[_0xa67b('0x20')]('SIP/%s',_0x5e3fd7['name']):_0x5e3fd7['interface'],'type':'PAUSE','enterAt':moment()[_0xa67b('0x20')](_0xa67b('0x28')),'data1':_0x3e507c[_0xa67b('0x2e')]['type']||'DEFAULT\x20PAUSE','role':_0x5e3fd7['role'],'internal':_0x5e3fd7[_0xa67b('0x2f')],'uniqueid':_0x3e507c['body']['uniqueid']||null});});return db[_0xa67b('0x25')][_0xa67b('0x30')](_0x4ec10b,{'individualHooks':!![]});})['then'](function(){return _0x5e3fd7[_0xa67b('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3e507c[_0xa67b('0x2e')][_0xa67b('0x31')]||_0xa67b('0x32'),'lastPauseAt':moment()['format'](_0xa67b('0x28'))});})[_0xa67b('0x18')](function(_0x4d464d){throw _0x4d464d;});};exports[_0xa67b('0x33')]=function(_0x37aa0c){return Promise[_0xa67b('0x34')]()['then'](function(){if(_0x37aa0c[_0xa67b('0x2e')][_0xa67b('0x35')]&&!utils['isValidChannel'](_0x37aa0c['body'][_0xa67b('0x35')])){throw new Error(util[_0xa67b('0x20')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x37aa0c[_0xa67b('0x2e')]['channel']));}return db[_0xa67b('0xc')]['findOne']({'where':_0x37aa0c[_0xa67b('0xe')]['where']||{},'attributes':['id','name','role',_0xa67b('0x2f'),'interface',_0xa67b('0x36'),'voicePause',_0xa67b('0x37'),_0xa67b('0x38'),_0xa67b('0x39'),_0xa67b('0x3a'),_0xa67b('0x3b'),_0xa67b('0x3c'),_0xa67b('0x3d'),'lastPauseAt']});})[_0xa67b('0x1f')](function(_0x3ba58c){if(!_0x3ba58c){throw new Error(util[_0xa67b('0x20')](_0xa67b('0x21'),_0x37aa0c['params']['id']));}return _0x3ba58c[_0xa67b('0x3e')](_0x37aa0c['body'][_0xa67b('0x35')],_0xa67b('0x3f'));})[_0xa67b('0x18')](function(_0x3b2e39){throw _0x3b2e39;});};exports[_0xa67b('0x40')]=function(_0x54079b){var _0x34ae98=this;return new Promise(function(_0x2b3288,_0x38c823){var _0x38507f;return db['User']['findOne']({'where':_0x54079b[_0xa67b('0xe')]['where']||{},'attributes':['id',_0xa67b('0x26')]})['then'](function(_0xccd46d){if(_0xccd46d){_0x38507f=_0xccd46d;return db['UserVoiceQueueRt'][_0xa67b('0x41')]({'where':{'membername':_0x38507f['name']},'individualHooks':!![]});}})[_0xa67b('0x1f')](function(){if(_0x38507f){return db[_0xa67b('0x25')][_0xa67b('0xd')]({'where':{'membername':_0x38507f[_0xa67b('0x26')],'exitAt':null}});}})[_0xa67b('0x1f')](function(_0x35b4cb){if(_0x38507f){if(_0x35b4cb&&_0x35b4cb[_0xa67b('0x27')]){var _0x59d376=[];_0x35b4cb[_0xa67b('0x2b')](function(_0x564476){_0x59d376[_0xa67b('0x2c')](_0x564476[_0xa67b('0x24')]({'exitAt':moment()[_0xa67b('0x20')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xa67b('0x42')](_0x59d376);}}})[_0xa67b('0x1f')](function(){if(_0x38507f){return _0x38507f['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xa67b('0x1f')](function(_0x5a51bd){_0x2b3288(_0x5a51bd);})[_0xa67b('0x18')](function(_0x3698c0){_0x38c823(_0x34ae98['error'](0x1f4,_0x3698c0['message']));});});};exports[_0xa67b('0x43')]=function(_0x11e1d6){var _0x274fa4=this;return new Promise(function(_0x250e96,_0x5abcbe){var _0x30e0d2;var _0x53de88;var _0x5711d7;var _0x4ce593;return db[_0xa67b('0xc')][_0xa67b('0x44')]({'where':_0x11e1d6[_0xa67b('0xe')][_0xa67b('0x10')]||{},'attributes':['id',_0xa67b('0x26'),_0xa67b('0x1d'),_0xa67b('0x45'),_0xa67b('0x46'),'internal',_0xa67b('0x47'),_0xa67b('0x1e')]})[_0xa67b('0x1f')](function(_0x24eda7){if(_0x24eda7){_0x30e0d2=_0x24eda7;_0x4ce593=_0x11e1d6[_0xa67b('0x2e')][_0xa67b('0x1e')]?_0x11e1d6[_0xa67b('0x2e')][_0xa67b('0x1e')]:util['format'](_0xa67b('0x48'),_0x30e0d2['name']);return db['User'][_0xa67b('0x49')]({'where':{'role':_0xa67b('0x4a'),'online':!![],'id':{'$ne':_0x30e0d2['id']}}});}})['then'](function(_0x246b41){if(_0x246b41){_0x5711d7=_0x246b41;return require(_0xa67b('0x4b'))[_0xa67b('0x4c')]();}})['then'](function(_0x20e662){if(_0x20e662&&_0x20e662[_0xa67b('0x4d')]&&_0x5711d7>=_0x20e662[_0xa67b('0x4d')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xa67b('0x1f')](function(){if(_0x30e0d2){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x30e0d2[_0xa67b('0x26')]},'individualHooks':!![]});}})['then'](function(){if(_0x30e0d2){return _0x30e0d2[_0xa67b('0x4e')]({'raw':!![]});}})[_0xa67b('0x1f')](function(_0x5577c0){if(_0x30e0d2){if(_0x5577c0){var _0x37c718=[];_0x53de88=_0x5577c0;if(_0x53de88[_0xa67b('0x27')]){for(var _0x11a145=0x0;_0x11a145<_0x53de88[_0xa67b('0x27')];_0x11a145++){_0x37c718[_0xa67b('0x2c')](db[_0xa67b('0x23')]['upsert']({'membername':_0x30e0d2[_0xa67b('0x26')],'UserId':_0x30e0d2['id'],'queue_name':_0x53de88[_0x11a145][_0xa67b('0x26')],'VoiceQueueId':_0x53de88[_0x11a145]['id'],'interface':_0x4ce593,'paused':_0x30e0d2[_0xa67b('0x47')]||![],'penalty':_0x53de88[_0x11a145][_0xa67b('0x4f')]||0x0}));}return BPromise[_0xa67b('0x42')](_0x37c718);}}}})['then'](function(){if(_0x30e0d2){return db[_0xa67b('0x25')][_0xa67b('0xd')]({'where':{'membername':_0x30e0d2[_0xa67b('0x26')],'exitAt':null}});}})[_0xa67b('0x1f')](function(_0x1e0409){if(_0x30e0d2){if(_0x1e0409&&_0x1e0409['length']){var _0x949da6=[];_0x1e0409[_0xa67b('0x2b')](function(_0x116504){_0x949da6['push'](_0x116504[_0xa67b('0x24')]({'exitAt':moment()[_0xa67b('0x20')](_0xa67b('0x28'))}));});return BPromise[_0xa67b('0x42')](_0x949da6);}}})[_0xa67b('0x1f')](function(){if(_0x30e0d2){var _0x2c0a84=[];var _0x5b9685=[];var _0x316c8a=utils['getChannels']();var _0x1c4aaf={'membername':_0x30e0d2[_0xa67b('0x26')],'interface':_0x4ce593,'enterAt':moment()[_0xa67b('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x30e0d2[_0xa67b('0x1d')],'internal':_0x30e0d2['internal']};_0x316c8a[_0xa67b('0x2b')](function(_0x2a7c38){_0x2c0a84[_0xa67b('0x2c')](_[_0xa67b('0x50')]({'channel':_0x2a7c38,'type':'LOGIN','data1':'callysquare','data2':_0x4ce593},_0x1c4aaf));if(_0x30e0d2[_0xa67b('0x47')]){_0x5b9685[_0xa67b('0x2c')](_[_0xa67b('0x50')]({'channel':_0x2a7c38,'type':_0xa67b('0x51'),'data1':_0xa67b('0x52')},_0x1c4aaf));}});return db['MemberReport']['bulkCreate'](_0x2c0a84['concat'](_0x5b9685),{'individualHooks':!![]});}})['then'](function(){if(_0x30e0d2){return _0x30e0d2['update']({'online':!![],'lastLoginAt':moment()['format'](_0xa67b('0x28')),'voicePause':_0x30e0d2[_0xa67b('0x47')]||![],'mailPause':_0x30e0d2[_0xa67b('0x47')]||![],'chatPause':_0x30e0d2[_0xa67b('0x47')]||![],'faxPause':_0x30e0d2[_0xa67b('0x47')]||![],'smsPause':_0x30e0d2[_0xa67b('0x47')]||![],'openchannelPause':_0x30e0d2[_0xa67b('0x47')]||![],'pauseType':_0x30e0d2[_0xa67b('0x47')]?_0xa67b('0x52'):null,'lastPauseAt':moment()[_0xa67b('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x4ce593});}})[_0xa67b('0x1f')](function(_0x3b2f5e){_0x250e96(_0x3b2f5e);})[_0xa67b('0x18')](function(_0x1dfe2f){_0x5abcbe(_0x274fa4[_0xa67b('0x1a')](0x1f4,_0x1dfe2f[_0xa67b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 69dbb6c..84c942c 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 _0x0160=['removeListener','register','user:','remove','update','emit'];(function(_0x283106,_0x15bd22){var _0x23f1d7=function(_0x266bba){while(--_0x266bba){_0x283106['push'](_0x283106['shift']());}};_0x23f1d7(++_0x15bd22);}(_0x0160,0x1bf));var _0x0016=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x0160[_0x2f4c1c];return _0x25e0f2;};'use strict';var UserEvents=require('./user.events');var events=['save',_0x0016('0x0'),_0x0016('0x1')];function createListener(_0x224c23,_0x4a1e28){return function(_0x209509){_0x4a1e28[_0x0016('0x2')](_0x224c23,_0x209509);};}function removeListener(_0x340e91,_0x54fddf){return function(){UserEvents[_0x0016('0x3')](_0x340e91,_0x54fddf);};}exports[_0x0016('0x4')]=function(_0x154668){for(var _0x5c9208=0x0,_0x350773=events['length'];_0x5c9208<_0x350773;_0x5c9208++){var _0x3e834=events[_0x5c9208];var _0x12e55c=createListener(_0x0016('0x5')+_0x3e834,_0x154668);UserEvents['on'](_0x3e834,_0x12e55c);}}; \ No newline at end of file +var _0xf64c=['./user.events','save','update','emit','removeListener','register','length','user:'];(function(_0x171a4a,_0x1ee852){var _0x2dc33e=function(_0x52ca80){while(--_0x52ca80){_0x171a4a['push'](_0x171a4a['shift']());}};_0x2dc33e(++_0x1ee852);}(_0xf64c,0x100));var _0xcf64=function(_0x42a9e0,_0x432991){_0x42a9e0=_0x42a9e0-0x0;var _0x51fb2e=_0xf64c[_0x42a9e0];return _0x51fb2e;};'use strict';var UserEvents=require(_0xcf64('0x0'));var events=[_0xcf64('0x1'),'remove',_0xcf64('0x2')];function createListener(_0x4e6f46,_0x5a32a0){return function(_0x58c75a){_0x5a32a0[_0xcf64('0x3')](_0x4e6f46,_0x58c75a);};}function removeListener(_0x5454b7,_0x464be9){return function(){UserEvents[_0xcf64('0x4')](_0x5454b7,_0x464be9);};}exports[_0xcf64('0x5')]=function(_0x504686){for(var _0x786187=0x0,_0x4af05a=events[_0xcf64('0x6')];_0x786187<_0x4af05a;_0x786187++){var _0x297c8c=events[_0x786187];var _0x22e22a=createListener(_0xcf64('0x7')+_0x297c8c,_0x504686);UserEvents['on'](_0x297c8c,_0x22e22a);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index da56123..5245236 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x258796,_0x50d62b){var _0x399594=function(_0x396d6e){while(--_0x396d6e){_0x258796['push'](_0x258796['shift']());}};_0x399594(++_0x50d62b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5084b8,_0x41f192){var _0x1617a0=function(_0x353526){while(--_0x353526){_0x5084b8['push'](_0x5084b8['shift']());}};_0x1617a0(++_0x41f192);}(_0x70e0,0x17b));var _0x070e=function(_0x448a88,_0x2bde69){_0x448a88=_0x448a88-0x0;var _0x583d37=_0x70e0[_0x448a88];return _0x583d37;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index c3b109e..e68354a 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 _0x11fc=['INTEGER','exports'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x11fc,0x187));var _0xc11f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x11fc[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0xc11f('0x0')]={'penalty':{'type':Sequelize[_0xc11f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc1fe=['exports','INTEGER','sequelize'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0xc1fe,0xdd));var _0xec1f=function(_0x185276,_0x54a4be){_0x185276=_0x185276-0x0;var _0x3b770b=_0xc1fe[_0x185276];return _0x3b770b;};'use strict';var Sequelize=require(_0xec1f('0x0'));module[_0xec1f('0x1')]={'penalty':{'type':Sequelize[_0xec1f('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 23bc3a5..3ed750d 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 _0x0188=['user_has_chat_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x0188,0x9d));var _0x8018=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0x0188[_0x282a1f];return _0x296ea7;};'use strict';var _=require(_0x8018('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8018('0x1'));var moment=require(_0x8018('0x2'));var BPromise=require(_0x8018('0x3'));var rp=require(_0x8018('0x4'));var fs=require('fs');var path=require(_0x8018('0x5'));var rimraf=require(_0x8018('0x6'));var config=require(_0x8018('0x7'));var attributes=require(_0x8018('0x8'));module[_0x8018('0x9')]=function(_0x3c474e,_0x2ed114){return _0x3c474e['define'](_0x8018('0xa'),attributes,{'tableName':_0x8018('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a2a=['exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x5233d4,_0x323ed8){var _0x1b7f4f=function(_0x1b41b4){while(--_0x1b41b4){_0x5233d4['push'](_0x5233d4['shift']());}};_0x1b7f4f(++_0x323ed8);}(_0x3a2a,0x12e));var _0xa3a2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3a2a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xa3a2('0x0'));var logger=require(_0xa3a2('0x1'))(_0xa3a2('0x2'));var moment=require(_0xa3a2('0x3'));var BPromise=require(_0xa3a2('0x4'));var rp=require(_0xa3a2('0x5'));var fs=require('fs');var path=require(_0xa3a2('0x6'));var rimraf=require(_0xa3a2('0x7'));var config=require(_0xa3a2('0x8'));var attributes=require(_0xa3a2('0x9'));module[_0xa3a2('0xa')]=function(_0x1cf493,_0x3b5903){return _0x1cf493[_0xa3a2('0xb')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index be7321d..8e18e0c 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 _0x881e=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5e9ea7,_0x199845){var _0xd87526=function(_0x2f4a7e){while(--_0x2f4a7e){_0x5e9ea7['push'](_0x5e9ea7['shift']());}};_0xd87526(++_0x199845);}(_0x881e,0x102));var _0xe881=function(_0x1304de,_0x39663f){_0x1304de=_0x1304de-0x0;var _0x4a68fc=_0x881e[_0x1304de];return _0x4a68fc;};'use strict';var _=require(_0xe881('0x0'));var util=require(_0xe881('0x1'));var moment=require(_0xe881('0x2'));var BPromise=require(_0xe881('0x3'));var rs=require(_0xe881('0x4'));var fs=require('fs');var Redis=require(_0xe881('0x5'));var db=require(_0xe881('0x6'))['db'];var utils=require(_0xe881('0x7'));var logger=require(_0xe881('0x8'))(_0xe881('0x9'));var config=require('../../config/environment');var jayson=require(_0xe881('0xa'));var client=jayson[_0xe881('0xb')][_0xe881('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20fdcb,_0x299632,_0x4a3ef8){return new BPromise(function(_0x86c7d6,_0xece977){return client[_0xe881('0xd')](_0x20fdcb,_0x4a3ef8)[_0xe881('0xe')](function(_0x114d86){logger[_0xe881('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x299632,_0xe881('0x10'));logger[_0xe881('0x11')](_0xe881('0x12'),_0x299632,_0xe881('0x10'),JSON[_0xe881('0x13')](_0x114d86));if(_0x114d86['error']){if(_0x114d86[_0xe881('0x14')][_0xe881('0x15')]===0x1f4){logger['error'](_0xe881('0x16'),_0x299632,_0x114d86['error'][_0xe881('0x17')]);return _0xece977(_0x114d86[_0xe881('0x14')]['message']);}logger[_0xe881('0x14')](_0xe881('0x16'),_0x299632,_0x114d86[_0xe881('0x14')][_0xe881('0x17')]);return _0x86c7d6(_0x114d86['error'][_0xe881('0x17')]);}else{logger[_0xe881('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x299632,_0xe881('0x10'));_0x86c7d6(_0x114d86['result'][_0xe881('0x17')]);}})['catch'](function(_0x58747c){logger[_0xe881('0x14')](_0xe881('0x16'),_0x299632,_0x58747c);_0xece977(_0x58747c);});});} \ No newline at end of file +var _0xb2f0=['code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xb2f0,0x9c));var _0x0b2f=function(_0x576fdd,_0x2d8b37){_0x576fdd=_0x576fdd-0x0;var _0xe6ec51=_0xb2f0[_0x576fdd];return _0xe6ec51;};'use strict';var _=require(_0x0b2f('0x0'));var util=require(_0x0b2f('0x1'));var moment=require('moment');var BPromise=require(_0x0b2f('0x2'));var rs=require(_0x0b2f('0x3'));var fs=require('fs');var Redis=require(_0x0b2f('0x4'));var db=require(_0x0b2f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b2f('0x6'))(_0x0b2f('0x7'));var config=require(_0x0b2f('0x8'));var jayson=require(_0x0b2f('0x9'));var client=jayson[_0x0b2f('0xa')][_0x0b2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x537a1c,_0xde50e3,_0x1c0b12){return new BPromise(function(_0x265246,_0xe55aea){return client[_0x0b2f('0xc')](_0x537a1c,_0x1c0b12)[_0x0b2f('0xd')](function(_0x1b2c05){logger[_0x0b2f('0xe')](_0x0b2f('0xf'),_0xde50e3,_0x0b2f('0x10'));logger[_0x0b2f('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xde50e3,_0x0b2f('0x10'),JSON[_0x0b2f('0x12')](_0x1b2c05));if(_0x1b2c05[_0x0b2f('0x13')]){if(_0x1b2c05['error'][_0x0b2f('0x14')]===0x1f4){logger['error'](_0x0b2f('0xf'),_0xde50e3,_0x1b2c05[_0x0b2f('0x13')][_0x0b2f('0x15')]);return _0xe55aea(_0x1b2c05['error'][_0x0b2f('0x15')]);}logger['error'](_0x0b2f('0xf'),_0xde50e3,_0x1b2c05[_0x0b2f('0x13')][_0x0b2f('0x15')]);return _0x265246(_0x1b2c05[_0x0b2f('0x13')][_0x0b2f('0x15')]);}else{logger[_0x0b2f('0xe')](_0x0b2f('0xf'),_0xde50e3,_0x0b2f('0x10'));_0x265246(_0x1b2c05['result'][_0x0b2f('0x15')]);}})['catch'](function(_0x199f80){logger[_0x0b2f('0x13')](_0x0b2f('0xf'),_0xde50e3,_0x199f80);_0xe55aea(_0x199f80);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 755b575..ed45376 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x7f34b7,_0x40b68d){var _0x4d3d9d=function(_0x4831d1){while(--_0x4831d1){_0x7f34b7['push'](_0x7f34b7['shift']());}};_0x4d3d9d(++_0x40b68d);}(_0xe706,0xa3));var _0x6e70=function(_0x1cb931,_0x41493d){_0x1cb931=_0x1cb931-0x0;var _0x1ef86b=_0xe706[_0x1cb931];return _0x1ef86b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x421e3a,_0xd69d11){var _0x3f9abd=function(_0x4b9bb4){while(--_0x4b9bb4){_0x421e3a['push'](_0x421e3a['shift']());}};_0x3f9abd(++_0xd69d11);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'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 b9420ca..0d66a96 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 _0x1715=['STRING','sequelize','exports','INTEGER'];(function(_0x185860,_0x5b276e){var _0x15bf16=function(_0x21751b){while(--_0x21751b){_0x185860['push'](_0x185860['shift']());}};_0x15bf16(++_0x5b276e);}(_0x1715,0x1c9));var _0x5171=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1715[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x5171('0x0'));module[_0x5171('0x1')]={'penalty':{'type':Sequelize[_0x5171('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5171('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5171('0x3')]}}; \ No newline at end of file +var _0x6ad2=['exports','INTEGER','STRING'];(function(_0x57479b,_0x279609){var _0x40efc7=function(_0x4a622c){while(--_0x4a622c){_0x57479b['push'](_0x57479b['shift']());}};_0x40efc7(++_0x279609);}(_0x6ad2,0x1da));var _0x26ad=function(_0x1f5822,_0x50a5ab){_0x1f5822=_0x1f5822-0x0;var _0x124d1e=_0x6ad2[_0x1f5822];return _0x124d1e;};'use strict';var Sequelize=require('sequelize');module[_0x26ad('0x0')]={'penalty':{'type':Sequelize[_0x26ad('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x26ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 0fcf4c7..5858555 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 _0x5693=['exports','UserFaxQueue','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x5693,0x1db));var _0x3569=function(_0x342db7,_0x2f2fac){_0x342db7=_0x342db7-0x0;var _0x2742e1=_0x5693[_0x342db7];return _0x2742e1;};'use strict';var _=require(_0x3569('0x0'));var util=require(_0x3569('0x1'));var logger=require(_0x3569('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3569('0x3'));var rp=require(_0x3569('0x4'));var fs=require('fs');var path=require(_0x3569('0x5'));var rimraf=require(_0x3569('0x6'));var config=require(_0x3569('0x7'));var attributes=require(_0x3569('0x8'));module[_0x3569('0x9')]=function(_0x368b73,_0x1c0c31){return _0x368b73['define'](_0x3569('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa12b=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa12b,0xb9));var _0xba12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa12b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba12('0x0'));var util=require(_0xba12('0x1'));var logger=require(_0xba12('0x2'))(_0xba12('0x3'));var moment=require(_0xba12('0x4'));var BPromise=require('bluebird');var rp=require(_0xba12('0x5'));var fs=require('fs');var path=require(_0xba12('0x6'));var rimraf=require(_0xba12('0x7'));var config=require(_0xba12('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0xba12('0x9')]=function(_0x51c3ae,_0x62c6ee){return _0x51c3ae[_0xba12('0xa')](_0xba12('0xb'),attributes,{'tableName':_0xba12('0xc'),'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 55d291b..a771209 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 _0x4520=['UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x159a1d,_0x4fd041){var _0x56c1ed=function(_0x322395){while(--_0x322395){_0x159a1d['push'](_0x159a1d['shift']());}};_0x56c1ed(++_0x4fd041);}(_0x4520,0xa3));var _0x0452=function(_0x48271f,_0xc4f6d3){_0x48271f=_0x48271f-0x0;var _0x13eb5c=_0x4520[_0x48271f];return _0x13eb5c;};'use strict';var _=require(_0x0452('0x0'));var util=require(_0x0452('0x1'));var moment=require(_0x0452('0x2'));var BPromise=require(_0x0452('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0452('0x4'))['db'];var utils=require(_0x0452('0x5'));var logger=require(_0x0452('0x6'))(_0x0452('0x7'));var config=require(_0x0452('0x8'));var jayson=require(_0x0452('0x9'));var client=jayson[_0x0452('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x195756,_0x17ccf4,_0x36f147){return new BPromise(function(_0x2fac58,_0x386c88){return client['request'](_0x195756,_0x36f147)[_0x0452('0xb')](function(_0x57c49a){logger[_0x0452('0xc')](_0x0452('0xd'),_0x17ccf4,_0x0452('0xe'));logger[_0x0452('0xf')](_0x0452('0x10'),_0x17ccf4,'request\x20sent',JSON['stringify'](_0x57c49a));if(_0x57c49a[_0x0452('0x11')]){if(_0x57c49a[_0x0452('0x11')][_0x0452('0x12')]===0x1f4){logger[_0x0452('0x11')](_0x0452('0xd'),_0x17ccf4,_0x57c49a[_0x0452('0x11')][_0x0452('0x13')]);return _0x386c88(_0x57c49a[_0x0452('0x11')][_0x0452('0x13')]);}logger[_0x0452('0x11')](_0x0452('0xd'),_0x17ccf4,_0x57c49a[_0x0452('0x11')][_0x0452('0x13')]);return _0x2fac58(_0x57c49a[_0x0452('0x11')][_0x0452('0x13')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x17ccf4,'request\x20sent');_0x2fac58(_0x57c49a[_0x0452('0x14')]['message']);}})[_0x0452('0x15')](function(_0x92f25d){logger[_0x0452('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x17ccf4,_0x92f25d);_0x386c88(_0x92f25d);});});} \ No newline at end of file +var _0x62be=['request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x51207c,_0x14afc6){var _0x2509c2=function(_0x325f49){while(--_0x325f49){_0x51207c['push'](_0x51207c['shift']());}};_0x2509c2(++_0x14afc6);}(_0x62be,0x130));var _0xe62b=function(_0x3af707,_0x1b7c6a){_0x3af707=_0x3af707-0x0;var _0x3cf60a=_0x62be[_0x3af707];return _0x3cf60a;};'use strict';var _=require(_0xe62b('0x0'));var util=require(_0xe62b('0x1'));var moment=require(_0xe62b('0x2'));var BPromise=require(_0xe62b('0x3'));var rs=require(_0xe62b('0x4'));var fs=require('fs');var Redis=require(_0xe62b('0x5'));var db=require(_0xe62b('0x6'))['db'];var utils=require(_0xe62b('0x7'));var logger=require('../../config/logger')(_0xe62b('0x8'));var config=require('../../config/environment');var jayson=require(_0xe62b('0x9'));var client=jayson[_0xe62b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3db94a,_0x554541,_0x48e3f6){return new BPromise(function(_0x57b40e,_0x3e1f2c){return client[_0xe62b('0xb')](_0x3db94a,_0x48e3f6)['then'](function(_0x37b1c4){logger[_0xe62b('0xc')](_0xe62b('0xd'),_0x554541,_0xe62b('0xe'));logger[_0xe62b('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x554541,_0xe62b('0xe'),JSON['stringify'](_0x37b1c4));if(_0x37b1c4[_0xe62b('0x10')]){if(_0x37b1c4[_0xe62b('0x10')][_0xe62b('0x11')]===0x1f4){logger[_0xe62b('0x10')](_0xe62b('0xd'),_0x554541,_0x37b1c4['error'][_0xe62b('0x12')]);return _0x3e1f2c(_0x37b1c4['error'][_0xe62b('0x12')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x554541,_0x37b1c4['error'][_0xe62b('0x12')]);return _0x57b40e(_0x37b1c4['error']['message']);}else{logger[_0xe62b('0xc')](_0xe62b('0xd'),_0x554541,_0xe62b('0xe'));_0x57b40e(_0x37b1c4[_0xe62b('0x13')][_0xe62b('0x12')]);}})[_0xe62b('0x14')](function(_0x54bbfa){logger['error'](_0xe62b('0xd'),_0x554541,_0x54bbfa);_0x3e1f2c(_0x54bbfa);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ad96d99..ac42571 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x118efa,_0x3575a0){var _0x5a28e3=function(_0x299923){while(--_0x299923){_0x118efa['push'](_0x118efa['shift']());}};_0x5a28e3(++_0x3575a0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0xcb91[_0x1778e1];return _0x2bc4c6;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2d496c,_0x3e3f9d){var _0x2b7a91=function(_0x5c5b26){while(--_0x5c5b26){_0x2d496c['push'](_0x2d496c['shift']());}};_0x2b7a91(++_0x3e3f9d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0xcb91[_0x5b5cde];return _0x364ad2;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index a45518c..5cdc4b9 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 _0xfadd=['exports','sequelize'];(function(_0x19c7e8,_0x1b1f1d){var _0x36c64f=function(_0x1deccf){while(--_0x1deccf){_0x19c7e8['push'](_0x19c7e8['shift']());}};_0x36c64f(++_0x1b1f1d);}(_0xfadd,0x1df));var _0xdfad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfadd[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xdfad('0x0'));module[_0xdfad('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xabbc=['sequelize','exports'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xabbc,0x1bc));var _0xcabb=function(_0x533852,_0x5e1347){_0x533852=_0x533852-0x0;var _0x3b39f2=_0xabbc[_0x533852];return _0x3b39f2;};'use strict';var Sequelize=require(_0xcabb('0x0'));module[_0xcabb('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index aeb50b8..7b12c70 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 _0x0105=['../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5400a1,_0x2275aa){var _0x4006c7=function(_0x5002dc){while(--_0x5002dc){_0x5400a1['push'](_0x5400a1['shift']());}};_0x4006c7(++_0x2275aa);}(_0x0105,0xc9));var _0x5010=function(_0x26d4d9,_0x58129b){_0x26d4d9=_0x26d4d9-0x0;var _0x4601c4=_0x0105[_0x26d4d9];return _0x4601c4;};'use strict';var _=require(_0x5010('0x0'));var util=require(_0x5010('0x1'));var logger=require(_0x5010('0x2'))(_0x5010('0x3'));var moment=require(_0x5010('0x4'));var BPromise=require(_0x5010('0x5'));var rp=require(_0x5010('0x6'));var fs=require('fs');var path=require(_0x5010('0x7'));var rimraf=require('rimraf');var config=require(_0x5010('0x8'));var attributes=require('./userMailQueue.attributes');module[_0x5010('0x9')]=function(_0x26ae17,_0x37a997){return _0x26ae17[_0x5010('0xa')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6eb=['rimraf','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util','../../config/logger','request-promise','path'];(function(_0x5285de,_0x554a15){var _0x55691e=function(_0x347520){while(--_0x347520){_0x5285de['push'](_0x5285de['shift']());}};_0x55691e(++_0x554a15);}(_0xc6eb,0xe1));var _0xbc6e=function(_0x51ce14,_0x5cd58b){_0x51ce14=_0x51ce14-0x0;var _0x301a2d=_0xc6eb[_0x51ce14];return _0x301a2d;};'use strict';var _=require(_0xbc6e('0x0'));var util=require(_0xbc6e('0x1'));var logger=require(_0xbc6e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbc6e('0x3'));var fs=require('fs');var path=require(_0xbc6e('0x4'));var rimraf=require(_0xbc6e('0x5'));var config=require('../../config/environment');var attributes=require(_0xbc6e('0x6'));module[_0xbc6e('0x7')]=function(_0xdce366,_0x8f1048){return _0xdce366[_0xbc6e('0x8')]('UserMailQueue',attributes,{'tableName':_0xbc6e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 730e229..5faf781 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7217,0x19e));var _0x7721=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7217[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x40c64f,_0x1ff2a2){var _0x3882c1=function(_0x3506a3){while(--_0x3506a3){_0x40c64f['push'](_0x40c64f['shift']());}};_0x3882c1(++_0x1ff2a2);}(_0x3e74,0x175));var _0x43e7=function(_0x508642,_0x32e05b){_0x508642=_0x508642-0x0;var _0x442d9f=_0x3e74[_0x508642];return _0x442d9f;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 146895b..effa08a 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 _0x8743=['Router','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','sendUserNotification','exports','multer','util','path','express'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8743,0x1b4));var _0x3874=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8743[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x3874('0x0'));var util=require(_0x3874('0x1'));var path=require(_0x3874('0x2'));var timeout=require('connect-timeout');var express=require(_0x3874('0x3'));var router=express[_0x3874('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3874('0x5'));var interaction=require(_0x3874('0x6'));var config=require('../../config/environment');var controller=require(_0x3874('0x7'));router[_0x3874('0x8')]('/',auth['isAuthenticated'](),controller[_0x3874('0x9')]);module[_0x3874('0xa')]=router; \ No newline at end of file +var _0xe76c=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','./userNotification.controller','exports'];(function(_0x40ef20,_0x294d44){var _0x415188=function(_0x213549){while(--_0x213549){_0x40ef20['push'](_0x40ef20['shift']());}};_0x415188(++_0x294d44);}(_0xe76c,0x171));var _0xce76=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xe76c[_0x386c3e];return _0x4b8e13;};'use strict';var multer=require(_0xce76('0x0'));var util=require(_0xce76('0x1'));var path=require(_0xce76('0x2'));var timeout=require('connect-timeout');var express=require(_0xce76('0x3'));var router=express[_0xce76('0x4')]();var fs_extra=require(_0xce76('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xce76('0x6'));var config=require('../../config/environment');var controller=require(_0xce76('0x7'));router['post']('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0xce76('0x8')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index d6a5289..58d6150 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 _0xb4c6=['exports','STRING','TEXT','sequelize'];(function(_0x24d7b8,_0x13ad17){var _0x5d89ab=function(_0x31d763){while(--_0x31d763){_0x24d7b8['push'](_0x24d7b8['shift']());}};_0x5d89ab(++_0x13ad17);}(_0xb4c6,0x12f));var _0x6b4c=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0xb4c6[_0x5a26db];return _0x4619dd;};'use strict';var Sequelize=require(_0x6b4c('0x0'));module[_0x6b4c('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x6b4c('0x2')]},'recipientsId':{'type':Sequelize[_0x6b4c('0x3')]},'recipientsDescription':{'type':Sequelize[_0x6b4c('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x31b4=['TEXT','BOOLEAN','sequelize','exports'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0x31b4,0xf2));var _0x431b=function(_0x67a688,_0x3019b6){_0x67a688=_0x67a688-0x0;var _0x2f197a=_0x31b4[_0x67a688];return _0x2f197a;};'use strict';var Sequelize=require(_0x431b('0x0'));module[_0x431b('0x1')]={'body':{'type':Sequelize[_0x431b('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x431b('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index cc04697..1d1d308 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 _0x3a5e=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','end','sendStatus','stack','name','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','mailqueue','openchannelqueue','smsqueue','voicequeue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','recipient','emit','userNotification:send','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','catch','forEach','startCase','User','union','ids','queue','Queue','push','all','flatten','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3a5e,0x177));var _0xe3a5=function(_0x5c7b36,_0x531722){_0x5c7b36=_0x5c7b36-0x0;var _0x4d9138=_0x3a5e[_0x5c7b36];return _0x4d9138;};'use strict';var emlformat=require(_0xe3a5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe3a5('0x1'));var rp=require(_0xe3a5('0x2'));var moment=require(_0xe3a5('0x3'));var BPromise=require(_0xe3a5('0x4'));var Mustache=require('mustache');var util=require(_0xe3a5('0x5'));var path=require('path');var sox=require(_0xe3a5('0x6'));var csv=require(_0xe3a5('0x7'));var ejs=require(_0xe3a5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe3a5('0x9'));var crypto=require(_0xe3a5('0xa'));var jsforce=require(_0xe3a5('0xb'));var deskjs=require(_0xe3a5('0xc'));var toCsv=require(_0xe3a5('0x7'));var querystring=require(_0xe3a5('0xd'));var Papa=require(_0xe3a5('0xe'));var Redis=require(_0xe3a5('0xf'));var authService=require(_0xe3a5('0x10'));var qs=require(_0xe3a5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3a5('0x12'));var logger=require('../../config/logger')(_0xe3a5('0x13'));var utils=require('../../config/utils');var config=require(_0xe3a5('0x14'));var licenseUtil=require(_0xe3a5('0x15'));var db=require(_0xe3a5('0x16'))['db'];config[_0xe3a5('0x17')]=_[_0xe3a5('0x18')](config[_0xe3a5('0x17')],{'host':_0xe3a5('0x19'),'port':0x18eb});var socket=require(_0xe3a5('0x1a'))(new Redis(config[_0xe3a5('0x17')]));require(_0xe3a5('0x1b'))[_0xe3a5('0x1c')](socket);function respondWithStatusCode(_0x2f1c0b,_0xb28aab){_0xb28aab=_0xb28aab||0xcc;return function(_0x1ee6a4){if(_0x1ee6a4){return _0x2f1c0b['sendStatus'](_0xb28aab);}return _0x2f1c0b[_0xe3a5('0x1d')](_0xb28aab)['end']();};}function respondWithResult(_0x30fbf5,_0x166555){_0x166555=_0x166555||0xc8;return function(_0x67abc8){if(_0x67abc8){return _0x30fbf5[_0xe3a5('0x1d')](_0x166555)['json'](_0x67abc8);}};}function respondWithFilteredResult(_0x58f829,_0x2372a7){return function(_0x55fcd4){if(_0x55fcd4){var _0x1c482b=typeof _0x2372a7[_0xe3a5('0x1e')]===_0xe3a5('0x1f')&&typeof _0x2372a7[_0xe3a5('0x20')]===_0xe3a5('0x1f');var _0x1ce27a=_0x55fcd4['count'];var _0x59d75f=_0x1c482b?0x0:_0x2372a7['offset'];var _0x483774=_0x1c482b?_0x55fcd4[_0xe3a5('0x21')]:_0x2372a7[_0xe3a5('0x1e')]+_0x2372a7[_0xe3a5('0x20')];var _0x43a743;if(_0x483774>=_0x1ce27a){_0x483774=_0x1ce27a;_0x43a743=0xc8;}else{_0x43a743=0xce;}_0x58f829[_0xe3a5('0x1d')](_0x43a743);return _0x58f829[_0xe3a5('0x22')](_0xe3a5('0x23'),_0x59d75f+'-'+_0x483774+'/'+_0x1ce27a)[_0xe3a5('0x24')](_0x55fcd4);}return null;};}function patchUpdates(_0x5c9a85){return function(_0xdec302){try{jsonpatch[_0xe3a5('0x25')](_0xdec302,_0x5c9a85,!![]);}catch(_0x7d34d0){return BPromise['reject'](_0x7d34d0);}return _0xdec302[_0xe3a5('0x26')]();};}function saveUpdates(_0x57f8c2,_0x28e686){return function(_0x2a49f8){if(_0x2a49f8){return _0x2a49f8[_0xe3a5('0x27')](_0x57f8c2)['then'](function(_0x2523c2){return _0x2523c2;});}return null;};}function removeEntity(_0x1466d4,_0x4d1e69){return function(_0x4d3c5b){if(_0x4d3c5b){return _0x4d3c5b[_0xe3a5('0x28')]()[_0xe3a5('0x29')](function(){_0x1466d4['status'](0xcc)[_0xe3a5('0x2a')]();});}};}function handleEntityNotFound(_0x2d6658,_0x3ca838){return function(_0x1fc45b){if(!_0x1fc45b){_0x2d6658[_0xe3a5('0x2b')](0x194);}return _0x1fc45b;};}function handleError(_0x538fe3,_0x753a9){_0x753a9=_0x753a9||0x1f4;return function(_0x4f2470){logger['error'](_0x4f2470[_0xe3a5('0x2c')]);if(_0x4f2470[_0xe3a5('0x2d')]){delete _0x4f2470[_0xe3a5('0x2d')];}_0x538fe3[_0xe3a5('0x1d')](_0x753a9)[_0xe3a5('0x2e')](_0x4f2470);};}exports[_0xe3a5('0x2f')]=function(_0x35b402,_0xb67402,_0x420665){if(!_0x35b402['body'][_0xe3a5('0x30')](_0xe3a5('0x31'))&&!_0x35b402[_0xe3a5('0x32')]['hasOwnProperty'](_0xe3a5('0x33'))){throw new db[(_0xe3a5('0x34'))][(_0xe3a5('0x35'))](_0xe3a5('0x36'));}else{if(_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x30')]('TemplateId')&&!_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x30')]('view')){throw new db[(_0xe3a5('0x34'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x35b402['body'][_0xe3a5('0x30')](_0xe3a5('0x37'))){throw new db[(_0xe3a5('0x34'))]['ValidationError'](_0xe3a5('0x38'));}else{try{var _0x5c29f2=JSON['parse'](_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x37')]);}catch(_0x4884f4){logger['error'](_0x4884f4);throw new db['Sequelize'][(_0xe3a5('0x35'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x5bf5e5=['chatqueue','faxqueue',_0xe3a5('0x39'),_0xe3a5('0x3a'),_0xe3a5('0x3b'),_0xe3a5('0x3c'),'whatsappqueue','team',_0xe3a5('0x3d')];if(_['some'](_0x5c29f2,function(_0x1f70db){return!_[_0xe3a5('0x3e')](_0x5bf5e5,_0x1f70db[_0xe3a5('0x3f')][_0xe3a5('0x40')]());})){throw new db['Sequelize'][(_0xe3a5('0x35'))](_0xe3a5('0x41'));}}}var _0x375012={};_0x375012[_0xe3a5('0x42')]=_0x35b402['body'][_0xe3a5('0x30')]('senderName')?_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x42')]:_0x35b402[_0xe3a5('0x3d')]['fullname'];_0x375012['recipientsDescription']=_[_0xe3a5('0x43')](_0x35b402[_0xe3a5('0x32')]['recipientsDescription'])?null:_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x44')];_0x375012[_0xe3a5('0x45')]=_0x35b402[_0xe3a5('0x32')][_0xe3a5('0x45')]||![];_0x375012[_0xe3a5('0x46')]=_0x35b402['user']['id'];return getContent(_0x35b402[_0xe3a5('0x32')])[_0xe3a5('0x29')](function(_0x3c5884){_0x375012[_0xe3a5('0x32')]=_0x3c5884;return getRecipients(_0x5c29f2);})[_0xe3a5('0x29')](function(_0x3c0802){_0x375012[_0xe3a5('0x47')]=_[_0xe3a5('0x48')](_0x3c0802)[_0xe3a5('0x49')](',');return db[_0xe3a5('0x4a')][_0xe3a5('0x4b')](function(_0x80af84){return db[_0xe3a5('0x4c')]['create'](_0x375012,{'raw':!![],'transaction':_0x80af84})[_0xe3a5('0x29')](function(_0x3a26c4){var _0x1c93f6={'sender':_0x375012[_0xe3a5('0x42')],'description':_0x375012[_0xe3a5('0x44')],'content':_0x375012[_0xe3a5('0x32')],'beep':_0x375012[_0xe3a5('0x45')]};_0x3c0802['forEach'](function(_0x47fd59){_0x1c93f6[_0xe3a5('0x4d')]=_0x47fd59;socket[_0xe3a5('0x4e')](_0xe3a5('0x4f'),_0x1c93f6);});return _0x3a26c4;});});})['then'](respondWithResult(_0xb67402,0xc9))['catch'](handleError(_0xb67402,null));};function getContent(_0x44ae29){return new BPromise(function(_0x4a75ce,_0x2018c5){if(_0x44ae29[_0xe3a5('0x31')]){_0x4a75ce(_0x44ae29[_0xe3a5('0x31')]);return;}return db['Template'][_0xe3a5('0x50')]({'attributes':[_0xe3a5('0x51')],'where':{'id':_0x44ae29[_0xe3a5('0x33')]},'raw':!![]})[_0xe3a5('0x29')](function(_0x307c97){if(!_0x307c97)throw new db[(_0xe3a5('0x34'))][(_0xe3a5('0x35'))](_0xe3a5('0x52'));var _0x45e420=Mustache[_0xe3a5('0x53')](_0x307c97['html'],_0x44ae29[_0xe3a5('0x54')]);_0x4a75ce(_0x45e420);})[_0xe3a5('0x55')](function(_0x5596f5){_0x2018c5(_0x5596f5);});});}function getRecipients(_0x535dd3){return new BPromise(function(_0x2b840b,_0x647e0b){var _0x1286c5=[];var _0x4f872b=[];_0x535dd3[_0xe3a5('0x56')](function(_0x293df3){var _0x163fab=_[_0xe3a5('0x57')](_0x293df3['model'][_0xe3a5('0x40')]());if(_0x163fab===_0xe3a5('0x58')){_0x1286c5=_[_0xe3a5('0x59')](_0x1286c5,_0x293df3[_0xe3a5('0x5a')]);}else{if(_[_0xe3a5('0x3e')](_0x163fab,_0xe3a5('0x5b')))_0x163fab=_0x163fab['replace'](_0xe3a5('0x5b'),_0xe3a5('0x5c'));_0x293df3[_0xe3a5('0x5a')][_0xe3a5('0x56')](function(_0x3db316){_0x4f872b[_0xe3a5('0x5d')](getAgents(_0x163fab,_0x3db316));});}});return BPromise[_0xe3a5('0x5e')](_0x4f872b)[_0xe3a5('0x29')](function(_0xbb65d7){_0x1286c5=_[_0xe3a5('0x59')](_0x1286c5,_[_0xe3a5('0x5f')](_0xbb65d7));_0x2b840b(_0x1286c5);})[_0xe3a5('0x55')](function(_0x2505ae){_0x647e0b(_0x2505ae);});});}function getAgents(_0x337ca9,_0x1ef5ce){return new BPromise(function(_0x2e5f94,_0x5c23dd){return db[_0x337ca9][_0xe3a5('0x50')]({'where':{'id':_0x1ef5ce}})[_0xe3a5('0x29')](function(_0x4af318){return _0x4af318['getAgents']({'attributes':['id'],'raw':!![]})[_0xe3a5('0x29')](function(_0x14bb68){var _0x44fe22=_['map'](_0x14bb68,'id');_0x2e5f94(_0x44fe22);});})[_0xe3a5('0x55')](function(_0x1048a4){_0x5c23dd(_0x1048a4);});});} \ No newline at end of file +var _0x7f8c=['Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','union','ids','replace','queue','Queue','push','all','flatten','findOne','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','./userNotification.socket','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch'];(function(_0x4ba774,_0x3bec9b){var _0x49f22c=function(_0x2ede12){while(--_0x2ede12){_0x4ba774['push'](_0x4ba774['shift']());}};_0x49f22c(++_0x3bec9b);}(_0x7f8c,0xd9));var _0xc7f8=function(_0xef241b,_0x3c216f){_0xef241b=_0xef241b-0x0;var _0x5cfa2e=_0x7f8c[_0xef241b];return _0x5cfa2e;};'use strict';var emlformat=require(_0xc7f8('0x0'));var rimraf=require(_0xc7f8('0x1'));var zipdir=require(_0xc7f8('0x2'));var jsonpatch=require(_0xc7f8('0x3'));var rp=require('request-promise');var moment=require(_0xc7f8('0x4'));var BPromise=require(_0xc7f8('0x5'));var Mustache=require('mustache');var util=require(_0xc7f8('0x6'));var path=require(_0xc7f8('0x7'));var sox=require(_0xc7f8('0x8'));var csv=require(_0xc7f8('0x9'));var ejs=require(_0xc7f8('0xa'));var fs=require('fs');var fs_extra=require(_0xc7f8('0xb'));var _=require(_0xc7f8('0xc'));var squel=require(_0xc7f8('0xd'));var crypto=require(_0xc7f8('0xe'));var jsforce=require(_0xc7f8('0xf'));var deskjs=require(_0xc7f8('0x10'));var toCsv=require(_0xc7f8('0x9'));var querystring=require(_0xc7f8('0x11'));var Papa=require(_0xc7f8('0x12'));var Redis=require(_0xc7f8('0x13'));var authService=require(_0xc7f8('0x14'));var qs=require(_0xc7f8('0x15'));var as=require(_0xc7f8('0x16'));var hardwareService=require(_0xc7f8('0x17'));var logger=require(_0xc7f8('0x18'))(_0xc7f8('0x19'));var utils=require('../../config/utils');var config=require(_0xc7f8('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc7f8('0x1b')]=_['defaults'](config[_0xc7f8('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7f8('0x1b')]));require(_0xc7f8('0x1c'))['register'](socket);function respondWithStatusCode(_0x4d87a4,_0x1c8d9d){_0x1c8d9d=_0x1c8d9d||0xcc;return function(_0x38c4b5){if(_0x38c4b5){return _0x4d87a4['sendStatus'](_0x1c8d9d);}return _0x4d87a4['status'](_0x1c8d9d)[_0xc7f8('0x1d')]();};}function respondWithResult(_0x5e6de1,_0x4ba518){_0x4ba518=_0x4ba518||0xc8;return function(_0x3e0bef){if(_0x3e0bef){return _0x5e6de1[_0xc7f8('0x1e')](_0x4ba518)[_0xc7f8('0x1f')](_0x3e0bef);}};}function respondWithFilteredResult(_0x984069,_0x3d27f9){return function(_0x389a14){if(_0x389a14){var _0x329606=typeof _0x3d27f9[_0xc7f8('0x20')]===_0xc7f8('0x21')&&typeof _0x3d27f9[_0xc7f8('0x22')]===_0xc7f8('0x21');var _0x61bf49=_0x389a14[_0xc7f8('0x23')];var _0xfec17=_0x329606?0x0:_0x3d27f9[_0xc7f8('0x20')];var _0x5ce1a0=_0x329606?_0x389a14[_0xc7f8('0x23')]:_0x3d27f9[_0xc7f8('0x20')]+_0x3d27f9[_0xc7f8('0x22')];var _0x29b926;if(_0x5ce1a0>=_0x61bf49){_0x5ce1a0=_0x61bf49;_0x29b926=0xc8;}else{_0x29b926=0xce;}_0x984069['status'](_0x29b926);return _0x984069[_0xc7f8('0x24')]('Content-Range',_0xfec17+'-'+_0x5ce1a0+'/'+_0x61bf49)['json'](_0x389a14);}return null;};}function patchUpdates(_0x5b7c09){return function(_0x487dd0){try{jsonpatch[_0xc7f8('0x25')](_0x487dd0,_0x5b7c09,!![]);}catch(_0x3e7fee){return BPromise[_0xc7f8('0x26')](_0x3e7fee);}return _0x487dd0[_0xc7f8('0x27')]();};}function saveUpdates(_0x2a849d,_0x5e2d2d){return function(_0x32f14f){if(_0x32f14f){return _0x32f14f['update'](_0x2a849d)[_0xc7f8('0x28')](function(_0x45d80f){return _0x45d80f;});}return null;};}function removeEntity(_0x33ffd8,_0x2fb91f){return function(_0x2b61e2){if(_0x2b61e2){return _0x2b61e2[_0xc7f8('0x29')]()['then'](function(){_0x33ffd8[_0xc7f8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e97db,_0x5ccafe){return function(_0x31fa53){if(!_0x31fa53){_0x2e97db['sendStatus'](0x194);}return _0x31fa53;};}function handleError(_0x53d562,_0x3938a5){_0x3938a5=_0x3938a5||0x1f4;return function(_0x564935){logger[_0xc7f8('0x2a')](_0x564935[_0xc7f8('0x2b')]);if(_0x564935['name']){delete _0x564935['name'];}_0x53d562[_0xc7f8('0x1e')](_0x3938a5)[_0xc7f8('0x2c')](_0x564935);};}exports[_0xc7f8('0x2d')]=function(_0x2ece5a,_0x33747a,_0x7f9268){if(!_0x2ece5a['body'][_0xc7f8('0x2e')](_0xc7f8('0x2f'))&&!_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x2e')](_0xc7f8('0x31'))){throw new db[(_0xc7f8('0x32'))][(_0xc7f8('0x33'))](_0xc7f8('0x34'));}else{if(_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x2e')](_0xc7f8('0x31'))&&!_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x2e')](_0xc7f8('0x35'))){throw new db[(_0xc7f8('0x32'))][(_0xc7f8('0x33'))](_0xc7f8('0x36'));}if(!_0x2ece5a[_0xc7f8('0x30')]['hasOwnProperty']('recipients')){throw new db[(_0xc7f8('0x32'))][(_0xc7f8('0x33'))](_0xc7f8('0x37'));}else{try{var _0x344400=JSON['parse'](_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x38')]);}catch(_0x1549d4){logger[_0xc7f8('0x2a')](_0x1549d4);throw new db[(_0xc7f8('0x32'))][(_0xc7f8('0x33'))](_0xc7f8('0x39'));}var _0x4107ec=['chatqueue',_0xc7f8('0x3a'),_0xc7f8('0x3b'),_0xc7f8('0x3c'),_0xc7f8('0x3d'),_0xc7f8('0x3e'),_0xc7f8('0x3f'),'team',_0xc7f8('0x40')];if(_[_0xc7f8('0x41')](_0x344400,function(_0x4de16e){return!_[_0xc7f8('0x42')](_0x4107ec,_0x4de16e[_0xc7f8('0x43')][_0xc7f8('0x44')]());})){throw new db['Sequelize'][(_0xc7f8('0x33'))](_0xc7f8('0x45'));}}}var _0x342904={};_0x342904[_0xc7f8('0x46')]=_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x2e')](_0xc7f8('0x46'))?_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x46')]:_0x2ece5a['user']['fullname'];_0x342904['recipientsDescription']=_[_0xc7f8('0x47')](_0x2ece5a['body'][_0xc7f8('0x48')])?null:_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x48')];_0x342904[_0xc7f8('0x49')]=_0x2ece5a[_0xc7f8('0x30')][_0xc7f8('0x49')]||![];_0x342904[_0xc7f8('0x4a')]=_0x2ece5a[_0xc7f8('0x40')]['id'];return getContent(_0x2ece5a[_0xc7f8('0x30')])['then'](function(_0x3b88b2){_0x342904[_0xc7f8('0x30')]=_0x3b88b2;return getRecipients(_0x344400);})[_0xc7f8('0x28')](function(_0x2d3924){_0x342904['recipientsId']=_[_0xc7f8('0x4b')](_0x2d3924)[_0xc7f8('0x4c')](',');return db[_0xc7f8('0x4d')][_0xc7f8('0x4e')](function(_0x3dbf85){return db[_0xc7f8('0x4f')][_0xc7f8('0x50')](_0x342904,{'raw':!![],'transaction':_0x3dbf85})[_0xc7f8('0x28')](function(_0x3d9ea1){var _0x3dfb7a={'sender':_0x342904['senderName'],'description':_0x342904[_0xc7f8('0x48')],'content':_0x342904[_0xc7f8('0x30')],'beep':_0x342904['beep']};_0x2d3924[_0xc7f8('0x51')](function(_0x381b1b){_0x3dfb7a[_0xc7f8('0x52')]=_0x381b1b;socket[_0xc7f8('0x53')](_0xc7f8('0x54'),_0x3dfb7a);});return _0x3d9ea1;});});})[_0xc7f8('0x28')](respondWithResult(_0x33747a,0xc9))[_0xc7f8('0x55')](handleError(_0x33747a,null));};function getContent(_0x38161d){return new BPromise(function(_0x1b4df5,_0x2f377d){if(_0x38161d[_0xc7f8('0x2f')]){_0x1b4df5(_0x38161d[_0xc7f8('0x2f')]);return;}return db[_0xc7f8('0x56')]['findOne']({'attributes':[_0xc7f8('0x57')],'where':{'id':_0x38161d[_0xc7f8('0x31')]},'raw':!![]})[_0xc7f8('0x28')](function(_0x182268){if(!_0x182268)throw new db['Sequelize'][(_0xc7f8('0x33'))](_0xc7f8('0x58'));var _0x261f01=Mustache[_0xc7f8('0x59')](_0x182268['html'],_0x38161d[_0xc7f8('0x35')]);_0x1b4df5(_0x261f01);})[_0xc7f8('0x55')](function(_0x3be99e){_0x2f377d(_0x3be99e);});});}function getRecipients(_0x37d90e){return new BPromise(function(_0x452a90,_0xb1aef2){var _0x4c0148=[];var _0x3d86ac=[];_0x37d90e[_0xc7f8('0x51')](function(_0x5dce6f){var _0x3194c0=_[_0xc7f8('0x5a')](_0x5dce6f['model'][_0xc7f8('0x44')]());if(_0x3194c0==='User'){_0x4c0148=_[_0xc7f8('0x5b')](_0x4c0148,_0x5dce6f[_0xc7f8('0x5c')]);}else{if(_[_0xc7f8('0x42')](_0x3194c0,'queue'))_0x3194c0=_0x3194c0[_0xc7f8('0x5d')](_0xc7f8('0x5e'),_0xc7f8('0x5f'));_0x5dce6f[_0xc7f8('0x5c')][_0xc7f8('0x51')](function(_0x470ce0){_0x3d86ac[_0xc7f8('0x60')](getAgents(_0x3194c0,_0x470ce0));});}});return BPromise[_0xc7f8('0x61')](_0x3d86ac)['then'](function(_0x1689ce){_0x4c0148=_[_0xc7f8('0x5b')](_0x4c0148,_[_0xc7f8('0x62')](_0x1689ce));_0x452a90(_0x4c0148);})[_0xc7f8('0x55')](function(_0x288554){_0xb1aef2(_0x288554);});});}function getAgents(_0x4ac272,_0xbc3f08){return new BPromise(function(_0xcbde41,_0x54f52c){return db[_0x4ac272][_0xc7f8('0x63')]({'where':{'id':_0xbc3f08}})[_0xc7f8('0x28')](function(_0x1c9a0b){return _0x1c9a0b['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0xf3774){var _0x17a190=_[_0xc7f8('0x64')](_0xf3774,'id');_0xcbde41(_0x17a190);});})['catch'](function(_0x3db692){_0x54f52c(_0x3db692);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 9b4af78..7d4ba17 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 _0x39cf=['UserNotification','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3d7954,_0x74af94){var _0x242873=function(_0x4851d3){while(--_0x4851d3){_0x3d7954['push'](_0x3d7954['shift']());}};_0x242873(++_0x74af94);}(_0x39cf,0x1ae));var _0xf39c=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x39cf[_0x57486e];return _0x5f110b;};'use strict';var EventEmitter=require(_0xf39c('0x0'));var UserNotification=require(_0xf39c('0x1'))['db'][_0xf39c('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf39c('0x3')](0x0);var events={'afterCreate':_0xf39c('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e8459){return function(_0x36b657,_0xf2d482,_0xe28b3a){UserNotificationEvents[_0xf39c('0x5')](_0x2e8459+':'+_0x36b657['id'],_0x36b657);UserNotificationEvents[_0xf39c('0x5')](_0x2e8459,_0x36b657);_0xe28b3a(null);};}for(var e in events){if(events[_0xf39c('0x6')](e)){var event=events[e];UserNotification[_0xf39c('0x7')](e,emitEvent(event));}}module[_0xf39c('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x0d3a=['../../mysqldb','UserNotification','save','update','remove','emit','hook','exports','events'];(function(_0xb4bed2,_0x1ba3db){var _0x17a2a5=function(_0x3957c1){while(--_0x3957c1){_0xb4bed2['push'](_0xb4bed2['shift']());}};_0x17a2a5(++_0x1ba3db);}(_0x0d3a,0x13a));var _0xa0d3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0d3a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xa0d3('0x0'));var UserNotification=require(_0xa0d3('0x1'))['db'][_0xa0d3('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa0d3('0x3'),'afterUpdate':_0xa0d3('0x4'),'afterDestroy':_0xa0d3('0x5')};function emitEvent(_0x19ded7){return function(_0x29a9b5,_0x54b477,_0x14f3bf){UserNotificationEvents[_0xa0d3('0x6')](_0x19ded7+':'+_0x29a9b5['id'],_0x29a9b5);UserNotificationEvents['emit'](_0x19ded7,_0x29a9b5);_0x14f3bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xa0d3('0x7')](e,emitEvent(event));}}module[_0xa0d3('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 6e0bff2..5e9f508 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 _0x38e7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x592eeb,_0x10ef82){var _0x3ea777=function(_0x4ca4f7){while(--_0x4ca4f7){_0x592eeb['push'](_0x592eeb['shift']());}};_0x3ea777(++_0x10ef82);}(_0x38e7,0x1b3));var _0x738e=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0x38e7[_0x4de9e8];return _0x4db0de;};'use strict';var _=require('lodash');var util=require(_0x738e('0x0'));var logger=require(_0x738e('0x1'))(_0x738e('0x2'));var moment=require(_0x738e('0x3'));var BPromise=require(_0x738e('0x4'));var rp=require(_0x738e('0x5'));var fs=require('fs');var path=require(_0x738e('0x6'));var rimraf=require(_0x738e('0x7'));var config=require('../../config/environment');var attributes=require(_0x738e('0x8'));module[_0x738e('0x9')]=function(_0x33a23f,_0x17fa11){return _0x33a23f[_0x738e('0xa')](_0x738e('0xb'),attributes,{'tableName':_0x738e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x738e('0xd'),'collate':_0x738e('0xe')});}; \ No newline at end of file +var _0xbd0c=['path','rimraf','../../config/environment','exports','define','userNotifications','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xbd0c,0x8a));var _0xcbd0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbd0c[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xcbd0('0x0'));var util=require('util');var logger=require(_0xcbd0('0x1'))(_0xcbd0('0x2'));var moment=require(_0xcbd0('0x3'));var BPromise=require(_0xcbd0('0x4'));var rp=require(_0xcbd0('0x5'));var fs=require('fs');var path=require(_0xcbd0('0x6'));var rimraf=require(_0xcbd0('0x7'));var config=require(_0xcbd0('0x8'));var attributes=require('./userNotification.attributes');module[_0xcbd0('0x9')]=function(_0x30df0b,_0x3c2333){return _0x30df0b[_0xcbd0('0xa')]('UserNotification',attributes,{'tableName':_0xcbd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 3a2227f..daafa7b 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 _0x0225=['client','redis','localhost','socket.io-emitter','./userNotification.socket','register','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserNotification,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x55cea0,_0x4debe7){var _0x1fa966=function(_0x4b561a){while(--_0x4b561a){_0x55cea0['push'](_0x55cea0['shift']());}};_0x1fa966(++_0x4debe7);}(_0x0225,0x74));var _0x5022=function(_0x338391,_0x4d5e84){_0x338391=_0x338391-0x0;var _0x363e1c=_0x0225[_0x338391];return _0x363e1c;};'use strict';var _=require(_0x5022('0x0'));var util=require(_0x5022('0x1'));var moment=require('moment');var BPromise=require(_0x5022('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5022('0x3'));var db=require(_0x5022('0x4'))['db'];var utils=require(_0x5022('0x5'));var logger=require(_0x5022('0x6'))('rpc');var config=require(_0x5022('0x7'));var jayson=require(_0x5022('0x8'));var client=jayson[_0x5022('0x9')]['http']({'port':0x232a});config[_0x5022('0xa')]=_['defaults'](config[_0x5022('0xa')],{'host':_0x5022('0xb'),'port':0x18eb});var socket=require(_0x5022('0xc'))(new Redis(config[_0x5022('0xa')]));require(_0x5022('0xd'))[_0x5022('0xe')](socket);function respondWithRpcPromise(_0x16659a,_0x50239a,_0x3d454b){return new BPromise(function(_0x93cdb4,_0xb67e0e){return client['request'](_0x16659a,_0x3d454b)[_0x5022('0xf')](function(_0x1261a7){logger[_0x5022('0x10')]('UserNotification,\x20%s,\x20%s',_0x50239a,'request\x20sent');logger[_0x5022('0x11')](_0x5022('0x12'),_0x50239a,_0x5022('0x13'),JSON[_0x5022('0x14')](_0x1261a7));if(_0x1261a7[_0x5022('0x15')]){if(_0x1261a7[_0x5022('0x15')]['code']===0x1f4){logger[_0x5022('0x15')](_0x5022('0x16'),_0x50239a,_0x1261a7[_0x5022('0x15')]['message']);return _0xb67e0e(_0x1261a7[_0x5022('0x15')][_0x5022('0x17')]);}logger[_0x5022('0x15')](_0x5022('0x16'),_0x50239a,_0x1261a7[_0x5022('0x15')][_0x5022('0x17')]);return _0x93cdb4(_0x1261a7['error'][_0x5022('0x17')]);}else{logger[_0x5022('0x10')](_0x5022('0x16'),_0x50239a,_0x5022('0x13'));_0x93cdb4(_0x1261a7['result'][_0x5022('0x17')]);}})[_0x5022('0x18')](function(_0x3bfe1e){logger['error'](_0x5022('0x16'),_0x50239a,_0x3bfe1e);_0xb67e0e(_0x3bfe1e);});});} \ No newline at end of file +var _0x99ea=['register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./userNotification.socket'];(function(_0x350034,_0x341770){var _0x303eb4=function(_0x306295){while(--_0x306295){_0x350034['push'](_0x350034['shift']());}};_0x303eb4(++_0x341770);}(_0x99ea,0x1c7));var _0xa99e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x99ea[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xa99e('0x0'));var util=require(_0xa99e('0x1'));var moment=require('moment');var BPromise=require(_0xa99e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa99e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa99e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa99e('0x5'));var jayson=require(_0xa99e('0x6'));var client=jayson[_0xa99e('0x7')][_0xa99e('0x8')]({'port':0x232a});config['redis']=_[_0xa99e('0x9')](config[_0xa99e('0xa')],{'host':_0xa99e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa99e('0xa')]));require(_0xa99e('0xc'))[_0xa99e('0xd')](socket);function respondWithRpcPromise(_0x418434,_0x42d449,_0x4b938c){return new BPromise(function(_0x10c127,_0x2fe270){return client[_0xa99e('0xe')](_0x418434,_0x4b938c)['then'](function(_0x422d60){logger[_0xa99e('0xf')](_0xa99e('0x10'),_0x42d449,_0xa99e('0x11'));logger[_0xa99e('0x12')](_0xa99e('0x13'),_0x42d449,_0xa99e('0x11'),JSON[_0xa99e('0x14')](_0x422d60));if(_0x422d60[_0xa99e('0x15')]){if(_0x422d60[_0xa99e('0x15')][_0xa99e('0x16')]===0x1f4){logger[_0xa99e('0x15')](_0xa99e('0x10'),_0x42d449,_0x422d60[_0xa99e('0x15')]['message']);return _0x2fe270(_0x422d60['error'][_0xa99e('0x17')]);}logger[_0xa99e('0x15')](_0xa99e('0x10'),_0x42d449,_0x422d60[_0xa99e('0x15')][_0xa99e('0x17')]);return _0x10c127(_0x422d60[_0xa99e('0x15')]['message']);}else{logger[_0xa99e('0xf')](_0xa99e('0x10'),_0x42d449,_0xa99e('0x11'));_0x10c127(_0x422d60[_0xa99e('0x18')]['message']);}})[_0xa99e('0x19')](function(_0x3cc5de){logger['error']('UserNotification,\x20%s,\x20%s',_0x42d449,_0x3cc5de);_0x2fe270(_0x3cc5de);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 13277d5..dfa78fa 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 _0x6c51=['save','remove','update','removeListener','length','userNotification:','./userNotification.events'];(function(_0x5c44ca,_0x176260){var _0x112eeb=function(_0x278a66){while(--_0x278a66){_0x5c44ca['push'](_0x5c44ca['shift']());}};_0x112eeb(++_0x176260);}(_0x6c51,0x1c6));var _0x16c5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6c51[_0xa464c9];return _0x3d73c4;};'use strict';var UserNotificationEvents=require(_0x16c5('0x0'));var events=[_0x16c5('0x1'),_0x16c5('0x2'),_0x16c5('0x3')];function createListener(_0x159341,_0xa45eb4){return function(_0xda6901){_0xa45eb4['emit'](_0x159341,_0xda6901);};}function removeListener(_0x53abac,_0x23bbae){return function(){UserNotificationEvents[_0x16c5('0x4')](_0x53abac,_0x23bbae);};}exports['register']=function(_0x4429bc){for(var _0x1e1f8b=0x0,_0x39b033=events[_0x16c5('0x5')];_0x1e1f8b<_0x39b033;_0x1e1f8b++){var _0x5276a4=events[_0x1e1f8b];var _0x4b2fb1=createListener(_0x16c5('0x6')+_0x5276a4,_0x4429bc);UserNotificationEvents['on'](_0x5276a4,_0x4b2fb1);}}; \ No newline at end of file +var _0x642f=['update','emit','removeListener','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x642f,0x1e3));var _0xf642=function(_0xe8d2f2,_0x13e30b){_0xe8d2f2=_0xe8d2f2-0x0;var _0x296102=_0x642f[_0xe8d2f2];return _0x296102;};'use strict';var UserNotificationEvents=require(_0xf642('0x0'));var events=[_0xf642('0x1'),_0xf642('0x2'),_0xf642('0x3')];function createListener(_0x451355,_0x1987b0){return function(_0x825f2){_0x1987b0[_0xf642('0x4')](_0x451355,_0x825f2);};}function removeListener(_0x2f8abe,_0x2a9fa5){return function(){UserNotificationEvents[_0xf642('0x5')](_0x2f8abe,_0x2a9fa5);};}exports[_0xf642('0x6')]=function(_0xb0bb8){for(var _0x7ff770=0x0,_0xa0f6c1=events[_0xf642('0x7')];_0x7ff770<_0xa0f6c1;_0x7ff770++){var _0x3322c6=events[_0x7ff770];var _0x2c84cc=createListener(_0xf642('0x8')+_0x3322c6,_0xb0bb8);UserNotificationEvents['on'](_0x3322c6,_0x2c84cc);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 85a50b7..7b298ba 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x495acf,_0x5c0120){var _0x417f5e=function(_0x1405b9){while(--_0x1405b9){_0x495acf['push'](_0x495acf['shift']());}};_0x417f5e(++_0x5c0120);}(_0xe706,0xa3));var _0x6e70=function(_0x44b346,_0xeb097d){_0x44b346=_0x44b346-0x0;var _0x1c2f2b=_0xe706[_0x44b346];return _0x1c2f2b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a86a2,_0x560c79){var _0x6beb21=function(_0x5a871d){while(--_0x5a871d){_0x2a86a2['push'](_0x2a86a2['shift']());}};_0x6beb21(++_0x560c79);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 821ccfd..e237c39 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 _0x1a6b=['INTEGER','sequelize','exports'];(function(_0x1b67aa,_0x57f59d){var _0x19ed6d=function(_0x192e56){while(--_0x192e56){_0x1b67aa['push'](_0x1b67aa['shift']());}};_0x19ed6d(++_0x57f59d);}(_0x1a6b,0x94));var _0xb1a6=function(_0x305f4b,_0x39199b){_0x305f4b=_0x305f4b-0x0;var _0x140130=_0x1a6b[_0x305f4b];return _0x140130;};'use strict';var Sequelize=require(_0xb1a6('0x0'));module[_0xb1a6('0x1')]={'penalty':{'type':Sequelize[_0xb1a6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c9a=['exports','sequelize'];(function(_0x17348b,_0x1a42ba){var _0x3a9762=function(_0x654285){while(--_0x654285){_0x17348b['push'](_0x17348b['shift']());}};_0x3a9762(++_0x1a42ba);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x468031,_0x55d261){_0x468031=_0x468031-0x0;var _0x47accd=_0x1c9a[_0x468031];return _0x47accd;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module[_0xa1c9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 2b57bb8..5139f06 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 _0x4a7c=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x7677eb,_0x59ba67){var _0x523039=function(_0x27edf7){while(--_0x27edf7){_0x7677eb['push'](_0x7677eb['shift']());}};_0x523039(++_0x59ba67);}(_0x4a7c,0x1ed));var _0xc4a7=function(_0x167769,_0x3f5533){_0x167769=_0x167769-0x0;var _0x2bc551=_0x4a7c[_0x167769];return _0x2bc551;};'use strict';var _=require(_0xc4a7('0x0'));var util=require('util');var logger=require(_0xc4a7('0x1'))('api');var moment=require(_0xc4a7('0x2'));var BPromise=require(_0xc4a7('0x3'));var rp=require(_0xc4a7('0x4'));var fs=require('fs');var path=require(_0xc4a7('0x5'));var rimraf=require(_0xc4a7('0x6'));var config=require(_0xc4a7('0x7'));var attributes=require(_0xc4a7('0x8'));module[_0xc4a7('0x9')]=function(_0x47960d,_0x546a96){return _0x47960d[_0xc4a7('0xa')](_0xc4a7('0xb'),attributes,{'tableName':_0xc4a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8482=['util','moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','lodash'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0x8482,0x103));var _0x2848=function(_0xc857e5,_0x561cfa){_0xc857e5=_0xc857e5-0x0;var _0x59a0f3=_0x8482[_0xc857e5];return _0x59a0f3;};'use strict';var _=require(_0x2848('0x0'));var util=require(_0x2848('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2848('0x2'));var BPromise=require(_0x2848('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2848('0x4'));var rimraf=require(_0x2848('0x5'));var config=require(_0x2848('0x6'));var attributes=require(_0x2848('0x7'));module['exports']=function(_0x3b6ad3,_0xaf237c){return _0x3b6ad3[_0x2848('0x8')](_0x2848('0x9'),attributes,{'tableName':'user_has_openchannel_queues','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 f332e13..7beb655 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 _0xbe7f=['../../config/utils','../../config/logger','rpc','client','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x18ba26,_0x4c142c){var _0x58ad0c=function(_0x872d4b){while(--_0x872d4b){_0x18ba26['push'](_0x18ba26['shift']());}};_0x58ad0c(++_0x4c142c);}(_0xbe7f,0xa7));var _0xfbe7=function(_0x6cdf62,_0x25d4f5){_0x6cdf62=_0x6cdf62-0x0;var _0x24a12a=_0xbe7f[_0x6cdf62];return _0x24a12a;};'use strict';var _=require(_0xfbe7('0x0'));var util=require(_0xfbe7('0x1'));var moment=require(_0xfbe7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbe7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbe7('0x4'));var logger=require(_0xfbe7('0x5'))(_0xfbe7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfbe7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5c04,_0x21c973,_0x480a4b){return new BPromise(function(_0x40caae,_0x546109){return client[_0xfbe7('0x8')](_0x3c5c04,_0x480a4b)['then'](function(_0x48627a){logger[_0xfbe7('0x9')](_0xfbe7('0xa'),_0x21c973,_0xfbe7('0xb'));logger['debug'](_0xfbe7('0xc'),_0x21c973,_0xfbe7('0xb'),JSON[_0xfbe7('0xd')](_0x48627a));if(_0x48627a['error']){if(_0x48627a[_0xfbe7('0xe')][_0xfbe7('0xf')]===0x1f4){logger[_0xfbe7('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x21c973,_0x48627a['error']['message']);return _0x546109(_0x48627a[_0xfbe7('0xe')][_0xfbe7('0x10')]);}logger[_0xfbe7('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x21c973,_0x48627a[_0xfbe7('0xe')][_0xfbe7('0x10')]);return _0x40caae(_0x48627a['error'][_0xfbe7('0x10')]);}else{logger[_0xfbe7('0x9')](_0xfbe7('0xa'),_0x21c973,'request\x20sent');_0x40caae(_0x48627a[_0xfbe7('0x11')][_0xfbe7('0x10')]);}})[_0xfbe7('0x12')](function(_0x108579){logger[_0xfbe7('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x21c973,_0x108579);_0x546109(_0x108579);});});} \ No newline at end of file +var _0xc820=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x29db09,_0x1462e5){var _0x54cc55=function(_0x318e12){while(--_0x318e12){_0x29db09['push'](_0x29db09['shift']());}};_0x54cc55(++_0x1462e5);}(_0xc820,0x1a9));var _0x0c82=function(_0x1f6a87,_0x1f1605){_0x1f6a87=_0x1f6a87-0x0;var _0x22ef00=_0xc820[_0x1f6a87];return _0x22ef00;};'use strict';var _=require(_0x0c82('0x0'));var util=require(_0x0c82('0x1'));var moment=require(_0x0c82('0x2'));var BPromise=require(_0x0c82('0x3'));var rs=require(_0x0c82('0x4'));var fs=require('fs');var Redis=require(_0x0c82('0x5'));var db=require(_0x0c82('0x6'))['db'];var utils=require(_0x0c82('0x7'));var logger=require(_0x0c82('0x8'))('rpc');var config=require(_0x0c82('0x9'));var jayson=require(_0x0c82('0xa'));var client=jayson[_0x0c82('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25de4f,_0x23679d,_0x4338e1){return new BPromise(function(_0x14eee9,_0x54e5b){return client[_0x0c82('0xc')](_0x25de4f,_0x4338e1)[_0x0c82('0xd')](function(_0xb5365){logger[_0x0c82('0xe')](_0x0c82('0xf'),_0x23679d,_0x0c82('0x10'));logger[_0x0c82('0x11')](_0x0c82('0x12'),_0x23679d,_0x0c82('0x10'),JSON['stringify'](_0xb5365));if(_0xb5365[_0x0c82('0x13')]){if(_0xb5365[_0x0c82('0x13')]['code']===0x1f4){logger[_0x0c82('0x13')](_0x0c82('0xf'),_0x23679d,_0xb5365['error'][_0x0c82('0x14')]);return _0x54e5b(_0xb5365[_0x0c82('0x13')][_0x0c82('0x14')]);}logger['error'](_0x0c82('0xf'),_0x23679d,_0xb5365['error'][_0x0c82('0x14')]);return _0x14eee9(_0xb5365[_0x0c82('0x13')][_0x0c82('0x14')]);}else{logger[_0x0c82('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x23679d,_0x0c82('0x10'));_0x14eee9(_0xb5365['result'][_0x0c82('0x14')]);}})[_0x0c82('0x15')](function(_0x514b7c){logger['error'](_0x0c82('0xf'),_0x23679d,_0x514b7c);_0x54e5b(_0x514b7c);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7a13a26..7c1688b 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 _0x5594=['post','/:id/clone','clone','addResources','put','update','delete','/:id','destroy','removeResources','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','create'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5594,0x173));var _0x4559=function(_0x23707a,_0x4c5296){_0x23707a=_0x23707a-0x0;var _0x3eeea8=_0x5594[_0x23707a];return _0x3eeea8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4559('0x0'));var timeout=require(_0x4559('0x1'));var express=require(_0x4559('0x2'));var router=express['Router']();var fs_extra=require(_0x4559('0x3'));var auth=require(_0x4559('0x4'));var interaction=require(_0x4559('0x5'));var config=require(_0x4559('0x6'));var controller=require(_0x4559('0x7'));router[_0x4559('0x8')]('/',auth[_0x4559('0x9')](),controller[_0x4559('0xa')]);router['get'](_0x4559('0xb'),auth[_0x4559('0x9')](),controller[_0x4559('0xc')]);router[_0x4559('0x8')]('/:id',auth[_0x4559('0x9')](),controller[_0x4559('0xd')]);router[_0x4559('0x8')](_0x4559('0xe'),auth[_0x4559('0x9')](),controller[_0x4559('0xf')]);router[_0x4559('0x8')](_0x4559('0x10'),auth[_0x4559('0x9')](),controller[_0x4559('0x11')]);router['post']('/',auth[_0x4559('0x9')](),controller[_0x4559('0x12')]);router[_0x4559('0x13')](_0x4559('0x14'),auth[_0x4559('0x9')](),controller[_0x4559('0x15')]);router[_0x4559('0x13')](_0x4559('0xe'),auth['isAuthenticated'](),controller['addSections']);router[_0x4559('0x13')](_0x4559('0x10'),auth[_0x4559('0x9')](),controller[_0x4559('0x16')]);router[_0x4559('0x17')]('/:id',auth[_0x4559('0x9')](),controller[_0x4559('0x18')]);router[_0x4559('0x19')](_0x4559('0x1a'),auth[_0x4559('0x9')](),controller[_0x4559('0x1b')]);router[_0x4559('0x19')](_0x4559('0xe'),auth['isAuthenticated'](),controller['removeSections']);router[_0x4559('0x19')](_0x4559('0x10'),auth[_0x4559('0x9')](),controller[_0x4559('0x1c')]);module[_0x4559('0x1d')]=router; \ No newline at end of file +var _0x0bf1=['put','update','destroy','delete','/:id/sections','removeSections','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','/describe','describe','/:id','isAuthenticated','show','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x0bf1,0xc7));var _0x10bf=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x0bf1[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x10bf('0x0'));var util=require('util');var path=require(_0x10bf('0x1'));var timeout=require(_0x10bf('0x2'));var express=require(_0x10bf('0x3'));var router=express[_0x10bf('0x4')]();var fs_extra=require(_0x10bf('0x5'));var auth=require(_0x10bf('0x6'));var interaction=require(_0x10bf('0x7'));var config=require(_0x10bf('0x8'));var controller=require(_0x10bf('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x10bf('0xa')](_0x10bf('0xb'),auth['isAuthenticated'](),controller[_0x10bf('0xc')]);router[_0x10bf('0xa')](_0x10bf('0xd'),auth[_0x10bf('0xe')](),controller[_0x10bf('0xf')]);router['get']('/:id/sections',auth[_0x10bf('0xe')](),controller[_0x10bf('0x10')]);router[_0x10bf('0xa')](_0x10bf('0x11'),auth['isAuthenticated'](),controller[_0x10bf('0x12')]);router[_0x10bf('0x13')]('/',auth[_0x10bf('0xe')](),controller[_0x10bf('0x14')]);router[_0x10bf('0x13')](_0x10bf('0x15'),auth[_0x10bf('0xe')](),controller[_0x10bf('0x16')]);router[_0x10bf('0x13')]('/:id/sections',auth[_0x10bf('0xe')](),controller[_0x10bf('0x17')]);router[_0x10bf('0x13')](_0x10bf('0x11'),auth['isAuthenticated'](),controller[_0x10bf('0x18')]);router[_0x10bf('0x19')](_0x10bf('0xd'),auth['isAuthenticated'](),controller[_0x10bf('0x1a')]);router['delete'](_0x10bf('0xd'),auth[_0x10bf('0xe')](),controller[_0x10bf('0x1b')]);router[_0x10bf('0x1c')](_0x10bf('0x1d'),auth['isAuthenticated'](),controller[_0x10bf('0x1e')]);router[_0x10bf('0x1c')](_0x10bf('0x11'),auth[_0x10bf('0xe')](),controller['removeResources']);module[_0x10bf('0x1f')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index a4cfb66..28da06a 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 _0x3a7e=['STRING','name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x534733,_0x115d0b){var _0x1166e8=function(_0x4a79d6){while(--_0x4a79d6){_0x534733['push'](_0x534733['shift']());}};_0x1166e8(++_0x115d0b);}(_0x3a7e,0x1de));var _0xe3a7=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x3a7e[_0x285824];return _0x311d7e;};'use strict';var Sequelize=require(_0xe3a7('0x0'));module[_0xe3a7('0x1')]={'name':{'type':Sequelize[_0xe3a7('0x2')],'allowNull':![],'unique':_0xe3a7('0x3')},'crudPermissions':{'type':Sequelize[_0xe3a7('0x2')],'set':function(_0x417747){this[_0xe3a7('0x4')](_0xe3a7('0x5'),_0x417747?_0x417747[_0xe3a7('0x6')](''):[]);},'get':function(){return this[_0xe3a7('0x7')]('crudPermissions')?this['getDataValue'](_0xe3a7('0x5'))[_0xe3a7('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe3a7('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x83e3=['STRING','name','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x475b37,_0x463bea){var _0x10485d=function(_0x201b24){while(--_0x201b24){_0x475b37['push'](_0x475b37['shift']());}};_0x10485d(++_0x463bea);}(_0x83e3,0xf1));var _0x383e=function(_0x2fbe56,_0x403a39){_0x2fbe56=_0x2fbe56-0x0;var _0x3ad88b=_0x83e3[_0x2fbe56];return _0x3ad88b;};'use strict';var Sequelize=require(_0x383e('0x0'));module[_0x383e('0x1')]={'name':{'type':Sequelize[_0x383e('0x2')],'allowNull':![],'unique':_0x383e('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xfd3d7f){this['setDataValue'](_0x383e('0x4'),_0xfd3d7f?_0xfd3d7f[_0x383e('0x5')](''):[]);},'get':function(){return this[_0x383e('0x6')](_0x383e('0x4'))?this['getDataValue'](_0x383e('0x4'))[_0x383e('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x383e('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x383e('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index a5a5d4e..a60a137 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 _0x4bde=['zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','limit','undefined','count','set','apply','reject','save','destroy','error','stack','name','send','map','UserProfile','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','type','VIRTUAL','merge','options','then','includeAll','findAll','rows','show','params','include','create','body','clone','keys','find','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','each','autoAssociation','sectionId','catch','userProfileId','Resources','UserProfileSection','UserProfileResource','update','describe','addSections','removeSections','getSections','enabled','subsections','includes','concat','push','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format'];(function(_0x213462,_0x135726){var _0x20d2b9=function(_0x585c06){while(--_0x585c06){_0x213462['push'](_0x213462['shift']());}};_0x20d2b9(++_0x135726);}(_0x4bde,0xe3));var _0xe4bd=function(_0x401744,_0x30a0be){_0x401744=_0x401744-0x0;var _0x20eb56=_0x4bde[_0x401744];return _0x20eb56;};'use strict';var emlformat=require(_0xe4bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe4bd('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe4bd('0x3'));var util=require(_0xe4bd('0x4'));var path=require(_0xe4bd('0x5'));var sox=require(_0xe4bd('0x6'));var csv=require(_0xe4bd('0x7'));var ejs=require(_0xe4bd('0x8'));var fs=require('fs');var fs_extra=require(_0xe4bd('0x9'));var _=require(_0xe4bd('0xa'));var squel=require(_0xe4bd('0xb'));var crypto=require('crypto');var jsforce=require(_0xe4bd('0xc'));var deskjs=require(_0xe4bd('0xd'));var toCsv=require(_0xe4bd('0x7'));var querystring=require(_0xe4bd('0xe'));var Papa=require('papaparse');var Redis=require(_0xe4bd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe4bd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4bd('0x11'));var logger=require(_0xe4bd('0x12'))(_0xe4bd('0x13'));var utils=require('../../config/utils');var config=require(_0xe4bd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4bd('0x15'))['db'];config[_0xe4bd('0x16')]=_[_0xe4bd('0x17')](config[_0xe4bd('0x16')],{'host':_0xe4bd('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4bd('0x16')]));require(_0xe4bd('0x19'))[_0xe4bd('0x1a')](socket);function respondWithStatusCode(_0x28f7f4,_0x2c5b16){_0x2c5b16=_0x2c5b16||0xcc;return function(_0x5cef7c){if(_0x5cef7c){return _0x28f7f4[_0xe4bd('0x1b')](_0x2c5b16);}return _0x28f7f4[_0xe4bd('0x1c')](_0x2c5b16)[_0xe4bd('0x1d')]();};}function respondWithResult(_0xdd2fdd,_0x14fd91){_0x14fd91=_0x14fd91||0xc8;return function(_0x3b8f0b){if(_0x3b8f0b){return _0xdd2fdd[_0xe4bd('0x1c')](_0x14fd91)[_0xe4bd('0x1e')](_0x3b8f0b);}};}function respondWithFilteredResult(_0x26954a,_0x47f682){return function(_0x360a4c){if(_0x360a4c){var _0x4c75b6=typeof _0x47f682['offset']==='undefined'&&typeof _0x47f682[_0xe4bd('0x1f')]===_0xe4bd('0x20');var _0x453502=_0x360a4c[_0xe4bd('0x21')];var _0xd8ac84=_0x4c75b6?0x0:_0x47f682['offset'];var _0x8b047=_0x4c75b6?_0x360a4c['count']:_0x47f682['offset']+_0x47f682[_0xe4bd('0x1f')];var _0xdb3b15;if(_0x8b047>=_0x453502){_0x8b047=_0x453502;_0xdb3b15=0xc8;}else{_0xdb3b15=0xce;}_0x26954a[_0xe4bd('0x1c')](_0xdb3b15);return _0x26954a[_0xe4bd('0x22')]('Content-Range',_0xd8ac84+'-'+_0x8b047+'/'+_0x453502)[_0xe4bd('0x1e')](_0x360a4c);}return null;};}function patchUpdates(_0x85413d){return function(_0x572706){try{jsonpatch[_0xe4bd('0x23')](_0x572706,_0x85413d,!![]);}catch(_0x2c5267){return BPromise[_0xe4bd('0x24')](_0x2c5267);}return _0x572706[_0xe4bd('0x25')]();};}function saveUpdates(_0x5b92b2,_0x11d1f8){return function(_0x2b9d39){if(_0x2b9d39){return _0x2b9d39['update'](_0x5b92b2)['then'](function(_0x3402dc){return _0x3402dc;});}return null;};}function removeEntity(_0xec5af7,_0x955264){return function(_0x182ed0){if(_0x182ed0){return _0x182ed0[_0xe4bd('0x26')]()['then'](function(){_0xec5af7[_0xe4bd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a707,_0xecd4e9){return function(_0x5e317a){if(!_0x5e317a){_0x42a707['sendStatus'](0x194);}return _0x5e317a;};}function handleError(_0x3a9804,_0x152f83){_0x152f83=_0x152f83||0x1f4;return function(_0x149cee){logger[_0xe4bd('0x27')](_0x149cee[_0xe4bd('0x28')]);if(_0x149cee[_0xe4bd('0x29')]){delete _0x149cee[_0xe4bd('0x29')];}_0x3a9804['status'](_0x152f83)[_0xe4bd('0x2a')](_0x149cee);};}exports['index']=function(_0x5455be,_0x55025c){var _0x1fff1a={},_0x17289a={},_0x5969d7={'count':0x0,'rows':[]};var _0x51dca2=_[_0xe4bd('0x2b')](db[_0xe4bd('0x2c')][_0xe4bd('0x2d')],function(_0x3a4a81){return{'name':_0x3a4a81['fieldName'],'type':_0x3a4a81['type'][_0xe4bd('0x2e')]};});_0x17289a[_0xe4bd('0x2f')]=_['map'](_0x51dca2,_0xe4bd('0x29'));_0x17289a[_0xe4bd('0x30')]=_['keys'](_0x5455be[_0xe4bd('0x30')]);_0x17289a[_0xe4bd('0x31')]=_[_0xe4bd('0x32')](_0x17289a[_0xe4bd('0x2f')],_0x17289a[_0xe4bd('0x30')]);_0x1fff1a[_0xe4bd('0x33')]=_[_0xe4bd('0x32')](_0x17289a[_0xe4bd('0x2f')],qs['fields'](_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x34')]));_0x1fff1a[_0xe4bd('0x33')]=_0x1fff1a['attributes'][_0xe4bd('0x35')]?_0x1fff1a[_0xe4bd('0x33')]:_0x17289a['model'];if(!_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x36')](_0xe4bd('0x37'))){_0x1fff1a[_0xe4bd('0x1f')]=qs[_0xe4bd('0x1f')](_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x1f')]);_0x1fff1a[_0xe4bd('0x38')]=qs[_0xe4bd('0x38')](_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x38')]);}_0x1fff1a[_0xe4bd('0x39')]=qs[_0xe4bd('0x3a')](_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x3a')]);_0x1fff1a[_0xe4bd('0x3b')]=qs[_0xe4bd('0x31')](_[_0xe4bd('0x3c')](_0x5455be[_0xe4bd('0x30')],_0x17289a[_0xe4bd('0x31')]),_0x51dca2);if(_0x5455be['query'][_0xe4bd('0x3d')]){_0x1fff1a[_0xe4bd('0x3b')]=_['merge'](_0x1fff1a[_0xe4bd('0x3b')],{'$or':_[_0xe4bd('0x2b')](_0x51dca2,function(_0x571de5){if(_0x571de5[_0xe4bd('0x3e')]!==_0xe4bd('0x3f')){var _0x2fb35d={};_0x2fb35d[_0x571de5[_0xe4bd('0x29')]]={'$like':'%'+_0x5455be[_0xe4bd('0x30')][_0xe4bd('0x3d')]+'%'};return _0x2fb35d;}})});}_0x1fff1a=_[_0xe4bd('0x40')]({},_0x1fff1a,_0x5455be[_0xe4bd('0x41')]);var _0x8053e0={'where':_0x1fff1a['where']};return db['UserProfile'][_0xe4bd('0x21')](_0x8053e0)[_0xe4bd('0x42')](function(_0x53865d){_0x5969d7['count']=_0x53865d;if(_0x5455be['query'][_0xe4bd('0x43')]){_0x1fff1a['include']=[{'all':!![]}];}return db[_0xe4bd('0x2c')][_0xe4bd('0x44')](_0x1fff1a);})[_0xe4bd('0x42')](function(_0x2ac785){_0x5969d7[_0xe4bd('0x45')]=_0x2ac785;return _0x5969d7;})['then'](respondWithFilteredResult(_0x55025c,_0x1fff1a))['catch'](handleError(_0x55025c,null));};exports[_0xe4bd('0x46')]=function(_0x19195f,_0x414329){var _0x525fce={'raw':![],'where':{'id':_0x19195f[_0xe4bd('0x47')]['id']}},_0x166be2={};_0x166be2[_0xe4bd('0x2f')]=_['keys'](db[_0xe4bd('0x2c')][_0xe4bd('0x2d')]);_0x166be2['query']=_['keys'](_0x19195f[_0xe4bd('0x30')]);_0x166be2[_0xe4bd('0x31')]=_[_0xe4bd('0x32')](_0x166be2[_0xe4bd('0x2f')],_0x166be2['query']);_0x525fce[_0xe4bd('0x33')]=_[_0xe4bd('0x32')](_0x166be2['model'],qs[_0xe4bd('0x34')](_0x19195f[_0xe4bd('0x30')][_0xe4bd('0x34')]));_0x525fce[_0xe4bd('0x33')]=_0x525fce[_0xe4bd('0x33')][_0xe4bd('0x35')]?_0x525fce['attributes']:_0x166be2[_0xe4bd('0x2f')];if(_0x19195f[_0xe4bd('0x30')][_0xe4bd('0x43')]){_0x525fce[_0xe4bd('0x48')]=[{'all':!![]}];}_0x525fce=_['merge']({},_0x525fce,_0x19195f[_0xe4bd('0x41')]);return db[_0xe4bd('0x2c')]['find'](_0x525fce)[_0xe4bd('0x42')](handleEntityNotFound(_0x414329,null))[_0xe4bd('0x42')](respondWithResult(_0x414329,null))['catch'](handleError(_0x414329,null));};exports[_0xe4bd('0x49')]=function(_0x5ac475,_0x4a6ca2){return db['UserProfile'][_0xe4bd('0x49')](_0x5ac475[_0xe4bd('0x4a')],{})[_0xe4bd('0x42')](respondWithResult(_0x4a6ca2,0xc9))['catch'](handleError(_0x4a6ca2,null));};exports[_0xe4bd('0x4b')]=function(_0x1e4472,_0x455a1f){var _0x14ff73={'where':{'id':_0x1e4472[_0xe4bd('0x47')]['id']}},_0x188f44={};_0x188f44[_0xe4bd('0x2f')]=_[_0xe4bd('0x4c')](db[_0xe4bd('0x2c')]['rawAttributes']);_0x14ff73[_0xe4bd('0x33')]=_['intersection'](_0x188f44[_0xe4bd('0x2f')],qs[_0xe4bd('0x34')](_0x1e4472[_0xe4bd('0x30')][_0xe4bd('0x34')]));_0x14ff73[_0xe4bd('0x33')]=_0x14ff73[_0xe4bd('0x33')]['length']?_0x14ff73[_0xe4bd('0x33')]:_0x188f44[_0xe4bd('0x2f')];if(_0x1e4472[_0xe4bd('0x30')]['includeAll']){_0x14ff73[_0xe4bd('0x48')]=[{'all':!![]}];}_0x14ff73=_[_0xe4bd('0x40')]({},_0x14ff73,_0x1e4472[_0xe4bd('0x41')]);return db[_0xe4bd('0x2c')][_0xe4bd('0x4d')](_0x14ff73)[_0xe4bd('0x42')](handleEntityNotFound(_0x455a1f,null))['then'](function(_0x3f1618){if(_0x3f1618){var _0x412712=_0x3f1618[_0xe4bd('0x4e')]({'plain':!![]});_0x412712=qs[_0xe4bd('0x4f')](_0x412712,['id','createdAt',_0xe4bd('0x50'),_0xe4bd('0x51')]);_0x1e4472[_0xe4bd('0x4a')]=_[_0xe4bd('0x4f')](_0x1e4472[_0xe4bd('0x4a')],['id',_0xe4bd('0x52'),_0xe4bd('0x50')]);return db[_0xe4bd('0x53')][_0xe4bd('0x54')](function(_0x43a6c1){return db[_0xe4bd('0x2c')][_0xe4bd('0x49')](_[_0xe4bd('0x40')](_0x412712,_0x1e4472[_0xe4bd('0x4a')]),{'include':_0x1e4472[_0xe4bd('0x30')][_0xe4bd('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x43a6c1})[_0xe4bd('0x42')](function(_0xc832ee){var _0x471200=_0xc832ee[_0xe4bd('0x4e')]({'plain':!![]});return db['UserProfileSection'][_0xe4bd('0x44')]({'where':{'userProfileId':_0x1e4472[_0xe4bd('0x47')]['id']},'raw':!![]})['then'](function(_0x543652){if(_0x543652){return BPromise[_0xe4bd('0x55')](_0x543652,function(_0x973073){return new BPromise(function(_0x3c3ec5,_0x3296f9){if(_0x973073[_0xe4bd('0x56')]===null||_0x973073['autoAssociation']===0x1)_0x3c3ec5(null);return db['UserProfileResource'][_0xe4bd('0x44')]({'where':{'sectionId':_0x973073['id']},'raw':!![]})[_0xe4bd('0x42')](function(_0xa43a45){var _0x4bd7a2=_[_0xe4bd('0x2b')](_0xa43a45,function(_0x1caac8){return qs['omit'](_0x1caac8,['id',_0xe4bd('0x52'),'updatedAt',_0xe4bd('0x57')]);});_0x3c3ec5(_0x4bd7a2);})[_0xe4bd('0x58')](function(_0x58ac24){_0x3296f9(_0x58ac24);});})[_0xe4bd('0x42')](function(_0x1f31da){var _0x21aa6a=qs[_0xe4bd('0x4f')](_0x973073,['id',_0xe4bd('0x52'),_0xe4bd('0x50')]);_0x21aa6a[_0xe4bd('0x59')]=_0x471200['id'];if(_0x1f31da)_0x21aa6a[_0xe4bd('0x5a')]=_0x1f31da;return _0x21aa6a;})[_0xe4bd('0x42')](function(_0x4aad76){return db[_0xe4bd('0x5b')][_0xe4bd('0x49')](_0x4aad76,{'include':[{'model':db[_0xe4bd('0x5c')],'as':_0xe4bd('0x5a')}],'raw':!![],'transaction':_0x43a6c1});});})['then'](function(){return _0x471200;});}});});});}})[_0xe4bd('0x42')](respondWithResult(_0x455a1f,0xc9))[_0xe4bd('0x58')](handleError(_0x455a1f,null));};exports[_0xe4bd('0x5d')]=function(_0x3c08e6,_0x4f8b95){if(_0x3c08e6['body']['id']){delete _0x3c08e6[_0xe4bd('0x4a')]['id'];}return db['UserProfile'][_0xe4bd('0x4d')]({'where':{'id':_0x3c08e6[_0xe4bd('0x47')]['id']}})[_0xe4bd('0x42')](handleEntityNotFound(_0x4f8b95,null))[_0xe4bd('0x42')](saveUpdates(_0x3c08e6['body'],null))[_0xe4bd('0x42')](respondWithResult(_0x4f8b95,null))['catch'](handleError(_0x4f8b95,null));};exports['destroy']=function(_0x1baab0,_0x3718c5){return db[_0xe4bd('0x2c')][_0xe4bd('0x4d')]({'where':{'id':_0x1baab0[_0xe4bd('0x47')]['id']}})[_0xe4bd('0x42')](handleEntityNotFound(_0x3718c5,null))[_0xe4bd('0x42')](removeEntity(_0x3718c5,null))[_0xe4bd('0x58')](handleError(_0x3718c5,null));};exports[_0xe4bd('0x5e')]=function(_0x403200,_0x129c9e){return db[_0xe4bd('0x2c')]['describe']()[_0xe4bd('0x42')](respondWithResult(_0x129c9e,null))['catch'](handleError(_0x129c9e,null));};exports[_0xe4bd('0x5f')]=function(_0x56c8f8,_0x557526){var _0x94558f=_0x56c8f8[_0xe4bd('0x4a')];return db['UserProfile'][_0xe4bd('0x4d')]({'where':{'id':_0x56c8f8[_0xe4bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x557526,null))['then'](function(_0x17296f){if(_0x17296f){return db[_0xe4bd('0x53')][_0xe4bd('0x54')](function(_0x5576a9){return db[_0xe4bd('0x5b')][_0xe4bd('0x26')]({'where':{'userProfileId':_0x56c8f8['params']['id'],'sectionId':_['map'](_0x94558f,function(_0x3c30f3){return _0x3c30f3[_0xe4bd('0x57')];})},'transaction':_0x5576a9})['then'](function(){var _0x30b818=_[_0xe4bd('0x2b')](_0x94558f,function(_0x2880eb){_0x2880eb[_0xe4bd('0x59')]=_0x56c8f8[_0xe4bd('0x47')]['id'];return _0x2880eb;});var _0x433e90=[];return BPromise[_0xe4bd('0x55')](_0x30b818,function(_0x5dfcd0){return db['UserProfileSection'][_0xe4bd('0x49')](_0x5dfcd0,{'include':[{'model':db[_0xe4bd('0x5c')],'as':_0xe4bd('0x5a')}],'raw':!![],'transaction':_0x5576a9})[_0xe4bd('0x42')](function(_0x60e6dd){_0x433e90['push'](_0x60e6dd[_0xe4bd('0x4e')]({'plain':!![]}));});})['then'](function(){return _0x433e90;});});});}})[_0xe4bd('0x42')](function(_0x144e61){return _0x144e61;})[_0xe4bd('0x42')](respondWithResult(_0x557526,null))[_0xe4bd('0x58')](handleError(_0x557526,null));};exports[_0xe4bd('0x60')]=function(_0x591bf9,_0x3d6f70){var _0x31299e;return db[_0xe4bd('0x2c')][_0xe4bd('0x4d')]({'where':{'id':_0x591bf9[_0xe4bd('0x47')]['id']},'attributes':['id',_0xe4bd('0x29')]})[_0xe4bd('0x42')](handleEntityNotFound(_0x3d6f70,null))['then'](function(_0x2c6b79){if(_0x2c6b79){_0x31299e=_0x2c6b79;return db[_0xe4bd('0x5b')][_0xe4bd('0x26')]({'where':{'userProfileId':_0x591bf9[_0xe4bd('0x47')]['id'],'sectionId':_0x591bf9['query']['ids']}});}})[_0xe4bd('0x42')](function(){return _0x31299e;})['then'](respondWithStatusCode(_0x3d6f70,null))[_0xe4bd('0x58')](handleError(_0x3d6f70,null));};exports[_0xe4bd('0x61')]=function(_0x1897d1,_0x1bbed3){var _0x1637ad=[];var _0x47e8e8=[];return db[_0xe4bd('0x5b')][_0xe4bd('0x44')]({'where':{'userProfileId':_0x1897d1[_0xe4bd('0x47')]['id']},'raw':!![]})[_0xe4bd('0x42')](function(_0x608c87){_0x1637ad=_[_0xe4bd('0x3d')](_0x608c87,function(_0x4d2633){return _0x4d2633[_0xe4bd('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x4d2633[_0xe4bd('0x57')]);});if(!_['isEmpty'](_0x1637ad)){return _[_0xe4bd('0x2b')](_0x1637ad,function(_0x5a1750){return _0x5a1750[_0xe4bd('0x57')];});}else{return;}})[_0xe4bd('0x42')](function(_0x193650){if(_0x193650)_0x47e8e8=_0x193650;if(_['includes'](_0x47e8e8,0x64)){var _0x5635b5=_[_0xe4bd('0x4d')](_0x1637ad,{'sectionId':0x64});return hasDefaultDashboard(_0x5635b5)[_0xe4bd('0x42')](function(_0x573432){return _[_0xe4bd('0x2b')](_0x1637ad,function(_0x53e4ed){if(_0x53e4ed[_0xe4bd('0x57')]===0x64){_0x53e4ed[_0xe4bd('0x63')]=_0x573432;}return _0x53e4ed;});});}else{return;}})['then'](function(_0x46b471){if(_0x46b471)_0x1637ad=_0x46b471;if(_[_0xe4bd('0x64')](_0x47e8e8,0x3eb)){var _0x47408e=_['find'](_0x1637ad,{'sectionId':0x3eb});return getCustomDashboards(_0x47408e)[_0xe4bd('0x42')](function(_0x5393cd){return _[_0xe4bd('0x2b')](_0x1637ad,function(_0x4fb067){if(_0x47408e[_0xe4bd('0x62')]){if(_0x4fb067[_0xe4bd('0x57')]===0x3eb){_0x4fb067['subsections']=_0x5393cd;}}else{if(_0x4fb067['sectionId']===0x64){if(!_0x4fb067['subsections']){_0x4fb067[_0xe4bd('0x63')]=[];}_0x4fb067[_0xe4bd('0x63')]=_0x4fb067['subsections'][_0xe4bd('0x65')](_0x5393cd);}}return _0x4fb067;});});}else{return;}})[_0xe4bd('0x42')](function(_0x3608bb){if(_0x3608bb)_0x1637ad=_0x3608bb;if(_['includes'](_0x47e8e8,0x709)){var _0x1f0485=_[_0xe4bd('0x4d')](_0x1637ad,{'sectionId':0x709});return getPlugins(_0x1f0485)[_0xe4bd('0x42')](function(_0x49450d){if(_0x1f0485['enabled']){return _[_0xe4bd('0x2b')](_0x1637ad,function(_0x51275a){if(_0x51275a[_0xe4bd('0x57')]===0x709){_0x51275a[_0xe4bd('0x63')]=_0x49450d;}return _0x51275a;});}else{var _0xeaedfa={'sectionId':0x76c,'enabled':0x1,'subsections':_0x49450d};var _0x539241=_['map'](_0x1637ad);_0x539241[_0xe4bd('0x66')](_0xeaedfa);return _0x539241;}});}else{return;}})[_0xe4bd('0x42')](function(_0x236224){if(_0x236224)_0x1637ad=_0x236224;return _['filter'](_0x1637ad,[_0xe4bd('0x62'),0x1]);})[_0xe4bd('0x42')](respondWithResult(_0x1bbed3,null))['catch'](handleError(_0x1bbed3,null));};function hasDefaultDashboard(_0x241c38){var _0x5ce6fa=[0x65];return new BPromise(function(_0x2d4780,_0x431772){try{if(_0x241c38[_0xe4bd('0x56')]){_0x2d4780(_0x5ce6fa);}else{return db[_0xe4bd('0x5c')][_0xe4bd('0x67')]({'where':{'sectionId':_0x241c38['id']},'raw':!![]})['then'](function(_0x1983e9){_0x1983e9?_0x2d4780(_0x5ce6fa):_0x2d4780();});}}catch(_0x58283a){_0x431772(_0x58283a);}});}function getCustomDashboards(_0xcff8c){var _0x4c28df=[];return new BPromise(function(_0x57fa4f,_0x7ac04c){try{if(_0xcff8c[_0xe4bd('0x56')]){return db[_0xe4bd('0x68')]['findAll']({'raw':!![]})[_0xe4bd('0x42')](function(_0x59de48){_0x59de48[_0xe4bd('0x69')](function(_0xd92651){_0x4c28df['push'](_0xd92651['id']+0x1869f);});_0x57fa4f(_0x4c28df);});}else{return db[_0xe4bd('0x5c')][_0xe4bd('0x44')]({'where':{'sectionId':_0xcff8c['id']},'raw':!![]})['then'](function(_0x5b6b36){_0x5b6b36['forEach'](function(_0x450cf2){_0x4c28df['push'](_0x450cf2[_0xe4bd('0x6a')]+0x1869f);});_0x57fa4f(_0x4c28df);});}}catch(_0x2663ed){_0x7ac04c(_0x2663ed);}});}function getPlugins(_0x4b9ebb){var _0x113947=[];return new BPromise(function(_0x2c7700,_0x40a052){try{if(_0x4b9ebb[_0xe4bd('0x56')]){return db['Plugin'][_0xe4bd('0x44')]({'raw':!![]})[_0xe4bd('0x42')](function(_0x3b10b0){_0x3b10b0[_0xe4bd('0x69')](function(_0x3b03cb){_0x113947['push'](_0x3b03cb['id']+0x15b38);});_0x2c7700(_0x113947);});}else{return db[_0xe4bd('0x5c')][_0xe4bd('0x44')]({'where':{'sectionId':_0x4b9ebb['id']},'raw':!![]})[_0xe4bd('0x42')](function(_0xaa0db){_0xaa0db[_0xe4bd('0x69')](function(_0x5202ff){_0x113947['push'](_0x5202ff[_0xe4bd('0x6a')]+0x15b38);});_0x2c7700(_0x113947);});}}catch(_0x4b7f99){_0x40a052(_0x4b7f99);}});}exports[_0xe4bd('0x6b')]=function(_0x49a1aa,_0x1bcdb7){return db[_0xe4bd('0x2c')][_0xe4bd('0x4d')]({'where':{'id':_0x49a1aa[_0xe4bd('0x47')]['id']}})[_0xe4bd('0x42')](handleEntityNotFound(_0x1bcdb7,null))['then'](function(_0x49c3cf){if(_0x49c3cf){return db[_0xe4bd('0x53')]['transaction'](function(_0x140050){return db[_0xe4bd('0x5b')][_0xe4bd('0x44')]({'where':{'userProfileId':_0x49a1aa[_0xe4bd('0x47')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x2d69c3){if(_0x2d69c3){return db[_0xe4bd('0x5b')][_0xe4bd('0x26')]({'where':{'userProfileId':_0x49a1aa[_0xe4bd('0x47')]['id'],'id':_[_0xe4bd('0x2b')](_0x2d69c3,function(_0x3e1749){return _0x3e1749['id'];})},'transaction':_0x140050});}})[_0xe4bd('0x42')](function(_0x15810c){var _0x35ac12=_[_0xe4bd('0x2b')](_0x49a1aa['body'],function(_0x4e35f5){_0x4e35f5[_0xe4bd('0x59')]=_0x49a1aa[_0xe4bd('0x47')]['id'];return _0x4e35f5;});return db[_0xe4bd('0x5b')]['bulkCreate'](_0x35ac12,{'raw':!![],'transaction':_0x140050});})[_0xe4bd('0x42')](function(_0x51b312){var _0x296cce=_[_0xe4bd('0x3d')](_['map'](_0x51b312,function(_0x5d41e6){return _0x5d41e6['get']({'plain':!![]});}),{'includeAll':![]});if(_0x296cce){return db['UserProfileSection'][_0xe4bd('0x44')]({'where':{'userProfileId':_0x49a1aa[_0xe4bd('0x47')]['id'],'sectionId':_[_0xe4bd('0x2b')](_0x296cce,function(_0x2080e5){return _0x2080e5[_0xe4bd('0x57')];})},'attributes':['id',_0xe4bd('0x57')],'raw':!![]})['then'](function(_0x263767){var _0x635c61=_[_0xe4bd('0x2b')](_0x49a1aa[_0xe4bd('0x4a')],function(_0x1d8cf3){_0x1d8cf3[_0xe4bd('0x59')]=_0x49a1aa[_0xe4bd('0x47')]['id'];return _0x1d8cf3;});return db[_0xe4bd('0x5c')][_0xe4bd('0x6c')](_0x635c61,{'raw':!![],'transaction':_0x140050});});}})[_0xe4bd('0x58')](handleError(_0x1bcdb7,null));});}})[_0xe4bd('0x42')](function(_0x2514be){var _0x174d22=_[_0xe4bd('0x2b')](_0x2514be,function(_0x2a816d){return _0x2a816d['get']({'plain':!![]});});})[_0xe4bd('0x42')](respondWithResult(_0x1bcdb7,null))[_0xe4bd('0x58')](handleError(_0x1bcdb7,null));};exports['removeResources']=function(_0x38ed05,_0xdd9ca1,_0x2588d0){return db['UserProfile'][_0xe4bd('0x4d')]({'where':{'id':_0x38ed05[_0xe4bd('0x47')]['id']}})[_0xe4bd('0x42')](handleEntityNotFound(_0xdd9ca1,null))[_0xe4bd('0x42')](function(_0x3e1ca6){if(_0x3e1ca6){return _0x3e1ca6[_0xe4bd('0x6d')](_0x38ed05[_0xe4bd('0x30')]['ids']);}})[_0xe4bd('0x42')](respondWithStatusCode(_0xdd9ca1,null))[_0xe4bd('0x58')](handleError(_0xdd9ca1,null));};exports['getResources']=function(_0x3e095c,_0xd87080){var _0x26155c={};if(!_0x3e095c['query'][_0xe4bd('0x6e')])throw new Error(_0xe4bd('0x6f'));if(!_0x3e095c[_0xe4bd('0x30')][_0xe4bd('0x36')](_0xe4bd('0x37'))){_0x26155c['limit']=qs[_0xe4bd('0x1f')](_0x3e095c[_0xe4bd('0x30')]['limit']);_0x26155c[_0xe4bd('0x38')]=qs['offset'](_0x3e095c[_0xe4bd('0x30')][_0xe4bd('0x38')]);}return db['UserProfile'][_0xe4bd('0x4d')]({'where':{'id':_0x3e095c[_0xe4bd('0x47')]['id']}})[_0xe4bd('0x42')](function(_0x16de5d){if(!_0x16de5d)throw new Error(_0xe4bd('0x70')+_0x3e095c['params']['id']);return db['UserProfile'][_0xe4bd('0x71')](_0x3e095c);})[_0xe4bd('0x42')](respondWithFilteredResult(_0xd87080,_0x26155c))['catch'](handleError(_0xd87080,null));}; \ No newline at end of file +var _0x90ce=['offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','include','UserProfile','findAll','show','params','includeAll','merge','options','find','create','body','catch','get','omit','crudPermissions','createdAt','updatedAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','removeSections','ids','getSections','enabled','includes','subsections','push','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','register','sendStatus','end','status','json'];(function(_0x45a367,_0xe4419e){var _0xefdf5e=function(_0x3eec0a){while(--_0x3eec0a){_0x45a367['push'](_0x45a367['shift']());}};_0xefdf5e(++_0xe4419e);}(_0x90ce,0x19a));var _0xe90c=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0x90ce[_0x256d6a];return _0x460058;};'use strict';var emlformat=require(_0xe90c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe90c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe90c('0x2'));var moment=require(_0xe90c('0x3'));var BPromise=require(_0xe90c('0x4'));var Mustache=require(_0xe90c('0x5'));var util=require(_0xe90c('0x6'));var path=require(_0xe90c('0x7'));var sox=require('sox');var csv=require(_0xe90c('0x8'));var ejs=require(_0xe90c('0x9'));var fs=require('fs');var fs_extra=require(_0xe90c('0xa'));var _=require(_0xe90c('0xb'));var squel=require(_0xe90c('0xc'));var crypto=require('crypto');var jsforce=require(_0xe90c('0xd'));var deskjs=require(_0xe90c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe90c('0xf'));var Papa=require(_0xe90c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe90c('0x11'));var as=require(_0xe90c('0x12'));var hardwareService=require(_0xe90c('0x13'));var logger=require(_0xe90c('0x14'))(_0xe90c('0x15'));var utils=require(_0xe90c('0x16'));var config=require(_0xe90c('0x17'));var licenseUtil=require(_0xe90c('0x18'));var db=require('../../mysqldb')['db'];config[_0xe90c('0x19')]=_[_0xe90c('0x1a')](config[_0xe90c('0x19')],{'host':_0xe90c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe90c('0x19')]));require(_0xe90c('0x1c'))[_0xe90c('0x1d')](socket);function respondWithStatusCode(_0x4a6fe3,_0x50228b){_0x50228b=_0x50228b||0xcc;return function(_0x48c983){if(_0x48c983){return _0x4a6fe3[_0xe90c('0x1e')](_0x50228b);}return _0x4a6fe3['status'](_0x50228b)[_0xe90c('0x1f')]();};}function respondWithResult(_0x857d20,_0x9e479){_0x9e479=_0x9e479||0xc8;return function(_0x403088){if(_0x403088){return _0x857d20[_0xe90c('0x20')](_0x9e479)[_0xe90c('0x21')](_0x403088);}};}function respondWithFilteredResult(_0x1c77a5,_0x393b1f){return function(_0x49ba81){if(_0x49ba81){var _0x311e1d=typeof _0x393b1f[_0xe90c('0x22')]===_0xe90c('0x23')&&typeof _0x393b1f['limit']===_0xe90c('0x23');var _0x1fe5ef=_0x49ba81['count'];var _0x3ed834=_0x311e1d?0x0:_0x393b1f[_0xe90c('0x22')];var _0x2b4576=_0x311e1d?_0x49ba81[_0xe90c('0x24')]:_0x393b1f['offset']+_0x393b1f[_0xe90c('0x25')];var _0x42c3f6;if(_0x2b4576>=_0x1fe5ef){_0x2b4576=_0x1fe5ef;_0x42c3f6=0xc8;}else{_0x42c3f6=0xce;}_0x1c77a5[_0xe90c('0x20')](_0x42c3f6);return _0x1c77a5['set'](_0xe90c('0x26'),_0x3ed834+'-'+_0x2b4576+'/'+_0x1fe5ef)['json'](_0x49ba81);}return null;};}function patchUpdates(_0x20b11b){return function(_0xc3635c){try{jsonpatch['apply'](_0xc3635c,_0x20b11b,!![]);}catch(_0x40bd2b){return BPromise[_0xe90c('0x27')](_0x40bd2b);}return _0xc3635c[_0xe90c('0x28')]();};}function saveUpdates(_0x11a627,_0x264527){return function(_0x2725e3){if(_0x2725e3){return _0x2725e3[_0xe90c('0x29')](_0x11a627)[_0xe90c('0x2a')](function(_0x31200c){return _0x31200c;});}return null;};}function removeEntity(_0x4984d1,_0x25294d){return function(_0x41ba2a){if(_0x41ba2a){return _0x41ba2a[_0xe90c('0x2b')]()['then'](function(){_0x4984d1[_0xe90c('0x20')](0xcc)[_0xe90c('0x1f')]();});}};}function handleEntityNotFound(_0x1a92fb,_0x3ef217){return function(_0x26fb3a){if(!_0x26fb3a){_0x1a92fb['sendStatus'](0x194);}return _0x26fb3a;};}function handleError(_0x4c6425,_0x15eb8e){_0x15eb8e=_0x15eb8e||0x1f4;return function(_0x4c7733){logger[_0xe90c('0x2c')](_0x4c7733[_0xe90c('0x2d')]);if(_0x4c7733['name']){delete _0x4c7733[_0xe90c('0x2e')];}_0x4c6425['status'](_0x15eb8e)['send'](_0x4c7733);};}exports[_0xe90c('0x2f')]=function(_0x3dc8ab,_0x4a1d46){var _0x246188={},_0x8b1fc={},_0x37783a={'count':0x0,'rows':[]};var _0x131c1a=_[_0xe90c('0x30')](db['UserProfile'][_0xe90c('0x31')],function(_0x89444e){return{'name':_0x89444e[_0xe90c('0x32')],'type':_0x89444e['type'][_0xe90c('0x33')]};});_0x8b1fc[_0xe90c('0x34')]=_[_0xe90c('0x30')](_0x131c1a,_0xe90c('0x2e'));_0x8b1fc['query']=_[_0xe90c('0x35')](_0x3dc8ab['query']);_0x8b1fc[_0xe90c('0x36')]=_[_0xe90c('0x37')](_0x8b1fc[_0xe90c('0x34')],_0x8b1fc[_0xe90c('0x38')]);_0x246188[_0xe90c('0x39')]=_[_0xe90c('0x37')](_0x8b1fc['model'],qs[_0xe90c('0x3a')](_0x3dc8ab[_0xe90c('0x38')][_0xe90c('0x3a')]));_0x246188[_0xe90c('0x39')]=_0x246188[_0xe90c('0x39')][_0xe90c('0x3b')]?_0x246188[_0xe90c('0x39')]:_0x8b1fc[_0xe90c('0x34')];if(!_0x3dc8ab['query'][_0xe90c('0x3c')](_0xe90c('0x3d'))){_0x246188[_0xe90c('0x25')]=qs[_0xe90c('0x25')](_0x3dc8ab['query']['limit']);_0x246188[_0xe90c('0x22')]=qs[_0xe90c('0x22')](_0x3dc8ab[_0xe90c('0x38')][_0xe90c('0x22')]);}_0x246188['order']=qs[_0xe90c('0x3e')](_0x3dc8ab[_0xe90c('0x38')][_0xe90c('0x3e')]);_0x246188[_0xe90c('0x3f')]=qs[_0xe90c('0x36')](_[_0xe90c('0x40')](_0x3dc8ab['query'],_0x8b1fc[_0xe90c('0x36')]),_0x131c1a);if(_0x3dc8ab['query']['filter']){_0x246188[_0xe90c('0x3f')]=_['merge'](_0x246188[_0xe90c('0x3f')],{'$or':_[_0xe90c('0x30')](_0x131c1a,function(_0x616859){if(_0x616859[_0xe90c('0x41')]!==_0xe90c('0x42')){var _0xd09e11={};_0xd09e11[_0x616859[_0xe90c('0x2e')]]={'$like':'%'+_0x3dc8ab[_0xe90c('0x38')][_0xe90c('0x43')]+'%'};return _0xd09e11;}})});}_0x246188=_['merge']({},_0x246188,_0x3dc8ab['options']);var _0x5347ae={'where':_0x246188[_0xe90c('0x3f')]};return db['UserProfile']['count'](_0x5347ae)[_0xe90c('0x2a')](function(_0x32e106){_0x37783a[_0xe90c('0x24')]=_0x32e106;if(_0x3dc8ab['query']['includeAll']){_0x246188[_0xe90c('0x44')]=[{'all':!![]}];}return db[_0xe90c('0x45')][_0xe90c('0x46')](_0x246188);})['then'](function(_0x1dc079){_0x37783a['rows']=_0x1dc079;return _0x37783a;})[_0xe90c('0x2a')](respondWithFilteredResult(_0x4a1d46,_0x246188))['catch'](handleError(_0x4a1d46,null));};exports[_0xe90c('0x47')]=function(_0xaa3a48,_0x1d4327){var _0x12f5cd={'raw':![],'where':{'id':_0xaa3a48[_0xe90c('0x48')]['id']}},_0x2c508e={};_0x2c508e['model']=_[_0xe90c('0x35')](db[_0xe90c('0x45')][_0xe90c('0x31')]);_0x2c508e['query']=_[_0xe90c('0x35')](_0xaa3a48[_0xe90c('0x38')]);_0x2c508e[_0xe90c('0x36')]=_[_0xe90c('0x37')](_0x2c508e[_0xe90c('0x34')],_0x2c508e['query']);_0x12f5cd['attributes']=_[_0xe90c('0x37')](_0x2c508e[_0xe90c('0x34')],qs['fields'](_0xaa3a48[_0xe90c('0x38')][_0xe90c('0x3a')]));_0x12f5cd[_0xe90c('0x39')]=_0x12f5cd[_0xe90c('0x39')][_0xe90c('0x3b')]?_0x12f5cd[_0xe90c('0x39')]:_0x2c508e[_0xe90c('0x34')];if(_0xaa3a48[_0xe90c('0x38')][_0xe90c('0x49')]){_0x12f5cd[_0xe90c('0x44')]=[{'all':!![]}];}_0x12f5cd=_[_0xe90c('0x4a')]({},_0x12f5cd,_0xaa3a48[_0xe90c('0x4b')]);return db['UserProfile'][_0xe90c('0x4c')](_0x12f5cd)['then'](handleEntityNotFound(_0x1d4327,null))[_0xe90c('0x2a')](respondWithResult(_0x1d4327,null))['catch'](handleError(_0x1d4327,null));};exports[_0xe90c('0x4d')]=function(_0x210784,_0x138fe9){return db[_0xe90c('0x45')][_0xe90c('0x4d')](_0x210784[_0xe90c('0x4e')],{})[_0xe90c('0x2a')](respondWithResult(_0x138fe9,0xc9))[_0xe90c('0x4f')](handleError(_0x138fe9,null));};exports['clone']=function(_0x5cb309,_0x5d2930){var _0x2ad5f1={'where':{'id':_0x5cb309[_0xe90c('0x48')]['id']}},_0x3a26a3={};_0x3a26a3[_0xe90c('0x34')]=_[_0xe90c('0x35')](db[_0xe90c('0x45')][_0xe90c('0x31')]);_0x2ad5f1[_0xe90c('0x39')]=_[_0xe90c('0x37')](_0x3a26a3[_0xe90c('0x34')],qs[_0xe90c('0x3a')](_0x5cb309['query'][_0xe90c('0x3a')]));_0x2ad5f1[_0xe90c('0x39')]=_0x2ad5f1[_0xe90c('0x39')][_0xe90c('0x3b')]?_0x2ad5f1['attributes']:_0x3a26a3['model'];if(_0x5cb309[_0xe90c('0x38')][_0xe90c('0x49')]){_0x2ad5f1[_0xe90c('0x44')]=[{'all':!![]}];}_0x2ad5f1=_['merge']({},_0x2ad5f1,_0x5cb309['options']);return db[_0xe90c('0x45')]['find'](_0x2ad5f1)[_0xe90c('0x2a')](handleEntityNotFound(_0x5d2930,null))[_0xe90c('0x2a')](function(_0x270dd2){if(_0x270dd2){var _0x33e08f=_0x270dd2[_0xe90c('0x50')]({'plain':!![]});_0x33e08f=qs[_0xe90c('0x51')](_0x33e08f,['id','createdAt','updatedAt',_0xe90c('0x52')]);_0x5cb309[_0xe90c('0x4e')]=_[_0xe90c('0x51')](_0x5cb309['body'],['id',_0xe90c('0x53'),_0xe90c('0x54')]);return db[_0xe90c('0x55')][_0xe90c('0x56')](function(_0x4d212e){return db[_0xe90c('0x45')][_0xe90c('0x4d')](_[_0xe90c('0x4a')](_0x33e08f,_0x5cb309[_0xe90c('0x4e')]),{'include':_0x5cb309['query'][_0xe90c('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x4d212e})[_0xe90c('0x2a')](function(_0x3c5e2a){var _0xf4c4d6=_0x3c5e2a[_0xe90c('0x50')]({'plain':!![]});return db[_0xe90c('0x57')][_0xe90c('0x46')]({'where':{'userProfileId':_0x5cb309['params']['id']},'raw':!![]})[_0xe90c('0x2a')](function(_0x296dbd){if(_0x296dbd){return BPromise['each'](_0x296dbd,function(_0x7ae01a){return new BPromise(function(_0x3efb0e,_0x10b372){if(_0x7ae01a[_0xe90c('0x58')]===null||_0x7ae01a[_0xe90c('0x58')]===0x1)_0x3efb0e(null);return db[_0xe90c('0x59')]['findAll']({'where':{'sectionId':_0x7ae01a['id']},'raw':!![]})[_0xe90c('0x2a')](function(_0x33151d){var _0x12b633=_[_0xe90c('0x30')](_0x33151d,function(_0x27655){return qs[_0xe90c('0x51')](_0x27655,['id',_0xe90c('0x53'),_0xe90c('0x54'),_0xe90c('0x5a')]);});_0x3efb0e(_0x12b633);})['catch'](function(_0x21e731){_0x10b372(_0x21e731);});})[_0xe90c('0x2a')](function(_0x543e5c){var _0x321076=qs['omit'](_0x7ae01a,['id',_0xe90c('0x53'),_0xe90c('0x54')]);_0x321076['userProfileId']=_0xf4c4d6['id'];if(_0x543e5c)_0x321076[_0xe90c('0x5b')]=_0x543e5c;return _0x321076;})[_0xe90c('0x2a')](function(_0x12125d){return db[_0xe90c('0x57')][_0xe90c('0x4d')](_0x12125d,{'include':[{'model':db[_0xe90c('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x4d212e});});})[_0xe90c('0x2a')](function(){return _0xf4c4d6;});}});});});}})[_0xe90c('0x2a')](respondWithResult(_0x5d2930,0xc9))[_0xe90c('0x4f')](handleError(_0x5d2930,null));};exports[_0xe90c('0x29')]=function(_0x21ddfc,_0x3a7fe2){if(_0x21ddfc[_0xe90c('0x4e')]['id']){delete _0x21ddfc['body']['id'];}return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x21ddfc['params']['id']}})[_0xe90c('0x2a')](handleEntityNotFound(_0x3a7fe2,null))['then'](saveUpdates(_0x21ddfc[_0xe90c('0x4e')],null))['then'](respondWithResult(_0x3a7fe2,null))['catch'](handleError(_0x3a7fe2,null));};exports[_0xe90c('0x2b')]=function(_0x5ab84d,_0x35c5a0){return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x5ab84d[_0xe90c('0x48')]['id']}})[_0xe90c('0x2a')](handleEntityNotFound(_0x35c5a0,null))[_0xe90c('0x2a')](removeEntity(_0x35c5a0,null))['catch'](handleError(_0x35c5a0,null));};exports[_0xe90c('0x5c')]=function(_0x104c71,_0x298dd6){return db[_0xe90c('0x45')][_0xe90c('0x5c')]()[_0xe90c('0x2a')](respondWithResult(_0x298dd6,null))[_0xe90c('0x4f')](handleError(_0x298dd6,null));};exports[_0xe90c('0x5d')]=function(_0x2e4bc3,_0x3c0103){var _0x18a835=_0x2e4bc3[_0xe90c('0x4e')];return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x2e4bc3['params']['id']}})[_0xe90c('0x2a')](handleEntityNotFound(_0x3c0103,null))[_0xe90c('0x2a')](function(_0x598894){if(_0x598894){return db[_0xe90c('0x55')][_0xe90c('0x56')](function(_0xed7f12){return db['UserProfileSection'][_0xe90c('0x2b')]({'where':{'userProfileId':_0x2e4bc3['params']['id'],'sectionId':_[_0xe90c('0x30')](_0x18a835,function(_0x126eab){return _0x126eab[_0xe90c('0x5a')];})},'transaction':_0xed7f12})[_0xe90c('0x2a')](function(){var _0x559ae8=_[_0xe90c('0x30')](_0x18a835,function(_0xfbf815){_0xfbf815[_0xe90c('0x5e')]=_0x2e4bc3[_0xe90c('0x48')]['id'];return _0xfbf815;});var _0x102395=[];return BPromise['each'](_0x559ae8,function(_0x77afd3){return db[_0xe90c('0x57')][_0xe90c('0x4d')](_0x77afd3,{'include':[{'model':db['UserProfileResource'],'as':_0xe90c('0x5b')}],'raw':!![],'transaction':_0xed7f12})['then'](function(_0x307417){_0x102395['push'](_0x307417[_0xe90c('0x50')]({'plain':!![]}));});})[_0xe90c('0x2a')](function(){return _0x102395;});});});}})[_0xe90c('0x2a')](function(_0x2c12bf){return _0x2c12bf;})[_0xe90c('0x2a')](respondWithResult(_0x3c0103,null))[_0xe90c('0x4f')](handleError(_0x3c0103,null));};exports[_0xe90c('0x5f')]=function(_0x1ba888,_0x50cfa7){var _0xfff1b1;return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x1ba888[_0xe90c('0x48')]['id']},'attributes':['id',_0xe90c('0x2e')]})[_0xe90c('0x2a')](handleEntityNotFound(_0x50cfa7,null))[_0xe90c('0x2a')](function(_0x3cd378){if(_0x3cd378){_0xfff1b1=_0x3cd378;return db[_0xe90c('0x57')][_0xe90c('0x2b')]({'where':{'userProfileId':_0x1ba888[_0xe90c('0x48')]['id'],'sectionId':_0x1ba888[_0xe90c('0x38')][_0xe90c('0x60')]}});}})[_0xe90c('0x2a')](function(){return _0xfff1b1;})[_0xe90c('0x2a')](respondWithStatusCode(_0x50cfa7,null))[_0xe90c('0x4f')](handleError(_0x50cfa7,null));};exports[_0xe90c('0x61')]=function(_0x533a8b,_0x551d09){var _0x176ae6=[];var _0x3b2da1=[];return db[_0xe90c('0x57')][_0xe90c('0x46')]({'where':{'userProfileId':_0x533a8b[_0xe90c('0x48')]['id']},'raw':!![]})[_0xe90c('0x2a')](function(_0x502e26){_0x176ae6=_['filter'](_0x502e26,function(_0x2265c2){return _0x2265c2[_0xe90c('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x2265c2[_0xe90c('0x5a')]);});if(!_['isEmpty'](_0x176ae6)){return _[_0xe90c('0x30')](_0x176ae6,function(_0x44b76f){return _0x44b76f[_0xe90c('0x5a')];});}else{return;}})[_0xe90c('0x2a')](function(_0x116308){if(_0x116308)_0x3b2da1=_0x116308;if(_[_0xe90c('0x63')](_0x3b2da1,0x64)){var _0xc317a9=_[_0xe90c('0x4c')](_0x176ae6,{'sectionId':0x64});return hasDefaultDashboard(_0xc317a9)['then'](function(_0x5f2299){return _['map'](_0x176ae6,function(_0x5f3d9b){if(_0x5f3d9b['sectionId']===0x64){_0x5f3d9b[_0xe90c('0x64')]=_0x5f2299;}return _0x5f3d9b;});});}else{return;}})[_0xe90c('0x2a')](function(_0x43a16b){if(_0x43a16b)_0x176ae6=_0x43a16b;if(_[_0xe90c('0x63')](_0x3b2da1,0x3eb)){var _0x161af4=_[_0xe90c('0x4c')](_0x176ae6,{'sectionId':0x3eb});return getCustomDashboards(_0x161af4)[_0xe90c('0x2a')](function(_0x3adf3c){return _[_0xe90c('0x30')](_0x176ae6,function(_0x4665fc){if(_0x161af4[_0xe90c('0x62')]){if(_0x4665fc[_0xe90c('0x5a')]===0x3eb){_0x4665fc[_0xe90c('0x64')]=_0x3adf3c;}}else{if(_0x4665fc['sectionId']===0x64){if(!_0x4665fc[_0xe90c('0x64')]){_0x4665fc[_0xe90c('0x64')]=[];}_0x4665fc[_0xe90c('0x64')]=_0x4665fc['subsections']['concat'](_0x3adf3c);}}return _0x4665fc;});});}else{return;}})[_0xe90c('0x2a')](function(_0x28ca45){if(_0x28ca45)_0x176ae6=_0x28ca45;if(_['includes'](_0x3b2da1,0x709)){var _0x6342f4=_['find'](_0x176ae6,{'sectionId':0x709});return getPlugins(_0x6342f4)['then'](function(_0x25322b){if(_0x6342f4[_0xe90c('0x62')]){return _[_0xe90c('0x30')](_0x176ae6,function(_0x391894){if(_0x391894['sectionId']===0x709){_0x391894[_0xe90c('0x64')]=_0x25322b;}return _0x391894;});}else{var _0x1c85c2={'sectionId':0x76c,'enabled':0x1,'subsections':_0x25322b};var _0x1a88ad=_['map'](_0x176ae6);_0x1a88ad[_0xe90c('0x65')](_0x1c85c2);return _0x1a88ad;}});}else{return;}})[_0xe90c('0x2a')](function(_0x2c21ab){if(_0x2c21ab)_0x176ae6=_0x2c21ab;return _['filter'](_0x176ae6,[_0xe90c('0x62'),0x1]);})[_0xe90c('0x2a')](respondWithResult(_0x551d09,null))[_0xe90c('0x4f')](handleError(_0x551d09,null));};function hasDefaultDashboard(_0x506a63){var _0x52167e=[0x65];return new BPromise(function(_0x392bbf,_0x54a130){try{if(_0x506a63[_0xe90c('0x58')]){_0x392bbf(_0x52167e);}else{return db[_0xe90c('0x59')][_0xe90c('0x66')]({'where':{'sectionId':_0x506a63['id']},'raw':!![]})[_0xe90c('0x2a')](function(_0x2d40c1){_0x2d40c1?_0x392bbf(_0x52167e):_0x392bbf();});}}catch(_0x3b9e58){_0x54a130(_0x3b9e58);}});}function getCustomDashboards(_0x51f00f){var _0x348f43=[];return new BPromise(function(_0x101471,_0x1da3ac){try{if(_0x51f00f[_0xe90c('0x58')]){return db['Dashboard'][_0xe90c('0x46')]({'raw':!![]})[_0xe90c('0x2a')](function(_0x59d9a3){_0x59d9a3[_0xe90c('0x67')](function(_0x1516d3){_0x348f43[_0xe90c('0x65')](_0x1516d3['id']+0x1869f);});_0x101471(_0x348f43);});}else{return db[_0xe90c('0x59')]['findAll']({'where':{'sectionId':_0x51f00f['id']},'raw':!![]})['then'](function(_0x53aa5d){_0x53aa5d[_0xe90c('0x67')](function(_0x49aecd){_0x348f43[_0xe90c('0x65')](_0x49aecd[_0xe90c('0x68')]+0x1869f);});_0x101471(_0x348f43);});}}catch(_0x144fd3){_0x1da3ac(_0x144fd3);}});}function getPlugins(_0x34128d){var _0x10d8f1=[];return new BPromise(function(_0x32272f,_0x5ef4e4){try{if(_0x34128d[_0xe90c('0x58')]){return db[_0xe90c('0x69')][_0xe90c('0x46')]({'raw':!![]})[_0xe90c('0x2a')](function(_0x37a0e2){_0x37a0e2[_0xe90c('0x67')](function(_0x3d99e1){_0x10d8f1[_0xe90c('0x65')](_0x3d99e1['id']+0x15b38);});_0x32272f(_0x10d8f1);});}else{return db['UserProfileResource'][_0xe90c('0x46')]({'where':{'sectionId':_0x34128d['id']},'raw':!![]})[_0xe90c('0x2a')](function(_0x2d1a04){_0x2d1a04[_0xe90c('0x67')](function(_0x1fa0a2){_0x10d8f1[_0xe90c('0x65')](_0x1fa0a2['resourceId']+0x15b38);});_0x32272f(_0x10d8f1);});}}catch(_0x33dc53){_0x5ef4e4(_0x33dc53);}});}exports[_0xe90c('0x6a')]=function(_0x3a7690,_0x299fe3){return db[_0xe90c('0x45')]['find']({'where':{'id':_0x3a7690[_0xe90c('0x48')]['id']}})[_0xe90c('0x2a')](handleEntityNotFound(_0x299fe3,null))[_0xe90c('0x2a')](function(_0x3a7d7e){if(_0x3a7d7e){return db[_0xe90c('0x55')][_0xe90c('0x56')](function(_0x4d9dfc){return db[_0xe90c('0x57')][_0xe90c('0x46')]({'where':{'userProfileId':_0x3a7690[_0xe90c('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0xe90c('0x2a')](function(_0x36b85c){if(_0x36b85c){return db[_0xe90c('0x57')][_0xe90c('0x2b')]({'where':{'userProfileId':_0x3a7690['params']['id'],'id':_[_0xe90c('0x30')](_0x36b85c,function(_0xf93bba){return _0xf93bba['id'];})},'transaction':_0x4d9dfc});}})[_0xe90c('0x2a')](function(_0x5401c0){var _0x7e385a=_[_0xe90c('0x30')](_0x3a7690[_0xe90c('0x4e')],function(_0x5e9bc4){_0x5e9bc4['userProfileId']=_0x3a7690['params']['id'];return _0x5e9bc4;});return db[_0xe90c('0x57')][_0xe90c('0x6b')](_0x7e385a,{'raw':!![],'transaction':_0x4d9dfc});})[_0xe90c('0x2a')](function(_0x175c33){var _0x2a5fcf=_['filter'](_['map'](_0x175c33,function(_0x25fe58){return _0x25fe58[_0xe90c('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x2a5fcf){return db[_0xe90c('0x57')][_0xe90c('0x46')]({'where':{'userProfileId':_0x3a7690['params']['id'],'sectionId':_[_0xe90c('0x30')](_0x2a5fcf,function(_0x415ac4){return _0x415ac4['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xe90c('0x2a')](function(_0x10daee){var _0x15e62c=_['map'](_0x3a7690['body'],function(_0x1c11b1){_0x1c11b1[_0xe90c('0x5e')]=_0x3a7690['params']['id'];return _0x1c11b1;});return db[_0xe90c('0x59')][_0xe90c('0x6b')](_0x15e62c,{'raw':!![],'transaction':_0x4d9dfc});});}})[_0xe90c('0x4f')](handleError(_0x299fe3,null));});}})[_0xe90c('0x2a')](function(_0x4de4da){var _0x170b5b=_[_0xe90c('0x30')](_0x4de4da,function(_0x18c99e){return _0x18c99e[_0xe90c('0x50')]({'plain':!![]});});})[_0xe90c('0x2a')](respondWithResult(_0x299fe3,null))['catch'](handleError(_0x299fe3,null));};exports[_0xe90c('0x6c')]=function(_0x3c1039,_0x39d83e,_0x34cc67){return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x3c1039[_0xe90c('0x48')]['id']}})[_0xe90c('0x2a')](handleEntityNotFound(_0x39d83e,null))[_0xe90c('0x2a')](function(_0x3f5bf7){if(_0x3f5bf7){return _0x3f5bf7[_0xe90c('0x6c')](_0x3c1039[_0xe90c('0x38')][_0xe90c('0x60')]);}})['then'](respondWithStatusCode(_0x39d83e,null))[_0xe90c('0x4f')](handleError(_0x39d83e,null));};exports[_0xe90c('0x6d')]=function(_0x513a03,_0x3ee236){var _0x9a148b={};if(!_0x513a03[_0xe90c('0x38')]['section'])throw new Error(_0xe90c('0x6e'));if(!_0x513a03['query'][_0xe90c('0x3c')]('nolimit')){_0x9a148b[_0xe90c('0x25')]=qs[_0xe90c('0x25')](_0x513a03[_0xe90c('0x38')][_0xe90c('0x25')]);_0x9a148b[_0xe90c('0x22')]=qs[_0xe90c('0x22')](_0x513a03[_0xe90c('0x38')]['offset']);}return db[_0xe90c('0x45')][_0xe90c('0x4c')]({'where':{'id':_0x513a03['params']['id']}})['then'](function(_0x290bd2){if(!_0x290bd2)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x513a03[_0xe90c('0x48')]['id']);return db['UserProfile'][_0xe90c('0x6d')](_0x513a03);})['then'](respondWithFilteredResult(_0x3ee236,_0x9a148b))['catch'](handleError(_0x3ee236,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 45b7d47..fc151ea 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 _0x323f=['save','update','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x5752a0,_0x2b0f7b){var _0x214a1e=function(_0x2fb1b9){while(--_0x2fb1b9){_0x5752a0['push'](_0x5752a0['shift']());}};_0x214a1e(++_0x2b0f7b);}(_0x323f,0x1ee));var _0xf323=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x323f[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf323('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf323('0x1')](0x0);var events={'afterCreate':_0xf323('0x2'),'afterUpdate':_0xf323('0x3'),'afterDestroy':_0xf323('0x4')};function emitEvent(_0x111042){return function(_0x2c9d35,_0xb4caa8,_0x2d4750){UserProfileEvents[_0xf323('0x5')](_0x111042+':'+_0x2c9d35['id'],_0x2c9d35);UserProfileEvents[_0xf323('0x5')](_0x111042,_0x2c9d35);_0x2d4750(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xf323('0x6')](e,emitEvent(event));}}module[_0xf323('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x50e5=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x45eaf0,_0x347e3d){var _0x3a8201=function(_0x1ae24a){while(--_0x1ae24a){_0x45eaf0['push'](_0x45eaf0['shift']());}};_0x3a8201(++_0x347e3d);}(_0x50e5,0xb7));var _0x550e=function(_0x42846c,_0x484578){_0x42846c=_0x42846c-0x0;var _0x3829b2=_0x50e5[_0x42846c];return _0x3829b2;};'use strict';var EventEmitter=require(_0x550e('0x0'));var UserProfile=require(_0x550e('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x550e('0x2')](0x0);var events={'afterCreate':_0x550e('0x3'),'afterUpdate':_0x550e('0x4'),'afterDestroy':_0x550e('0x5')};function emitEvent(_0x40aee6){return function(_0x3f3a13,_0x78e6c5,_0xafede5){UserProfileEvents[_0x550e('0x6')](_0x40aee6+':'+_0x3f3a13['id'],_0x3f3a13);UserProfileEvents[_0x550e('0x6')](_0x40aee6,_0x3f3a13);_0xafede5(null);};}for(var e in events){if(events[_0x550e('0x7')](e)){var event=events[e];UserProfile[_0x550e('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 1175788..fd685d8 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 _0x5052=['options','autoAssociation','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','extraQueryConditions','CmContact','Tags','color','tag','openTabs','true','dataValues','mail','openchannel','whatsapp','./userProfile.attributes','squel','models','filter','field','value','associatedResources','catch','model','findAll','then','map','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareRecording','parentSections','projectName','projects','contacts','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','queue','VoiceQueue','inbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','VoiceQueues','QueueCampaigns','users','Users','admin','user','zendeskaccounts','salesforceaccounts','sugarcrmaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.createdAt','_interactions','where','sequelize','query','toString','OpenTabs','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','find','params','ignore','isEmpty','union','all','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x5052,0x187));var _0x2505=function(_0x3a7258,_0x4f9d4f){_0x3a7258=_0x3a7258-0x0;var _0x2f6012=_0x5052[_0x3a7258];return _0x2f6012;};'use strict';var _=require('lodash');var attributes=require(_0x2505('0x0'));var squel=require(_0x2505('0x1'));module['exports']=function(_0x13d416){var _0x1a0fc4=_0x13d416[_0x2505('0x2')];function _0x376069(_0x20ff6c,_0x229a33){return new Promise(function(_0x2bff57,_0xd740cb){if(!_0x229a33)return _0x2bff57(null);var _0x5d2b6b=_0x229a33[_0x2505('0x3')]?{[_0x229a33['filter'][_0x2505('0x4')]]:_0x229a33['filter'][_0x2505('0x5')]}:undefined;return _0x1a0fc4[_0x20ff6c]['findAll']({'where':_0x5d2b6b,'raw':!![]})['then'](function(_0x434b3a){_0x229a33[_0x2505('0x6')]=_['map'](_0x434b3a,'id');_0x2bff57(_0x229a33);})[_0x2505('0x7')](function(_0xac6d8e){_0xd740cb(_0xac6d8e);});});}function _0x4c3ca2(_0x39c1a3,_0x35cfdc){return new Promise(function(_0x3fa29c,_0x18d496){var _0x87572a=_0x39c1a3[_0x2505('0x3')]?{[_0x39c1a3['filter'][_0x2505('0x4')]]:_0x39c1a3[_0x2505('0x3')][_0x2505('0x5')]}:undefined;return _0x1a0fc4[_0x39c1a3[_0x2505('0x8')]][_0x2505('0x9')]({'where':_0x87572a,'raw':!![]})[_0x2505('0xa')](function(_0x2be9af){_0x35cfdc[_0x2505('0x6')]=_[_0x2505('0xb')](_0x2be9af,function(_0x44e79d){return _0x44e79d[_0x2505('0xc')];});_0x3fa29c(_0x35cfdc);})[_0x2505('0x7')](function(_0x155cd5){_0x18d496(_0x155cd5);});});}function _0x2d45a0(_0x43d31f,_0x2bad1a,_0x2f56fe){if(!_0x2bad1a)return Promise[_0x2505('0xd')](null);return new Promise(function(_0x3e1023,_0x5657a0){return _0x1a0fc4[_0x2505('0xe')]['findAll']({'where':{'sectionId':_0x2bad1a['id']},'raw':!![]})[_0x2505('0xa')](function(_0x3a647c){if(_0x43d31f['field']&&_0x43d31f['field']!=='id'){_0x2bad1a['associatedResources']=_[_0x2505('0xb')](_0x3a647c,function(_0x1ed323){return _0x1ed323[_0x43d31f[_0x2505('0x4')]];});}else{if(_0x2f56fe===_0x2505('0xf')){_0x2bad1a[_0x2505('0x6')]=_[_0x2505('0xb')](_0x3a647c,function(_0x1b3543){return{'id':_0x1b3543[_0x2505('0x10')],'type':_0x1b3543[_0x2505('0x11')]};});}else{_0x2bad1a['associatedResources']=_[_0x2505('0xb')](_0x3a647c,function(_0x3860f9){return _0x3860f9['resourceId'];});}}_0x3e1023(_0x2bad1a);})[_0x2505('0x7')](function(_0x124984){_0x5657a0(_0x124984);});});}function _0x3077f8(_0xa917e5,_0x269ba0){var _0x4424e7={'parentSections':[]};switch(_0xa917e5[_0x2505('0x12')]()){case _0x2505('0x13'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x15');break;case _0x2505('0x16'):_0x4424e7[_0x2505('0x14')]='SquareOdbc';break;case'squarerecordings':_0x4424e7[_0x2505('0x14')]=_0x2505('0x17');_0x4424e7[_0x2505('0x18')]=[{'name':'SquareProjects','field':_0x2505('0xc'),'foreignKey':_0x2505('0x19')}];break;case _0x2505('0x1a'):_0x4424e7[_0x2505('0x14')]='JscriptyProject';break;case _0x2505('0x1b'):_0x4424e7[_0x2505('0x14')]='CmContact';_0x4424e7['parentSections']=[{'name':_0x2505('0x1c'),'field':'id','foreignKey':_0x2505('0x1d')}];break;case'lists':_0x4424e7[_0x2505('0x14')]=_0x2505('0x1e');break;case _0x2505('0x1f'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x20');break;case _0x2505('0x21'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x22');break;case _0x2505('0x23'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x24');break;case _0x2505('0x25'):_0x4424e7['childModel']=_0x2505('0x26');break;case _0x2505('0x27'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x28');break;case _0x2505('0x29'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x2a');break;case _0x2505('0x2b'):case'internalroutes':case _0x2505('0x2c'):_0x4424e7['childModel']=_0x2505('0x2d');break;case _0x2505('0x2e'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x2f');break;case _0x2505('0x30'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x31');break;case _0x2505('0x32'):_0x4424e7['childModel']=_0x2505('0x33');_0x4424e7['parentSections']=[{'name':_0x2505('0x34'),'field':_0x2505('0xc'),'foreignKey':'membername','model':_0x2505('0x35'),'filter':{'field':_0x2505('0x36'),'value':[_0x2505('0x37')]}},{'name':_0x2505('0x38'),'field':'name','foreignKey':_0x2505('0x39'),'model':_0x2505('0x35'),'filter':{'field':_0x2505('0x36'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x2505('0xc'),'foreignKey':_0x2505('0x3a'),'model':_0x2505('0x3b'),'filter':{'field':_0x2505('0x11'),'value':[_0x2505('0x3c')]}},{'name':'QueueCampaigns','field':'name','foreignKey':'queue','model':_0x2505('0x3b'),'filter':{'field':_0x2505('0x11'),'value':['outbound']}}];break;case'musiconholds':_0x4424e7[_0x2505('0x14')]=_0x2505('0x3d');break;case _0x2505('0x3e'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x3f');break;case'voiceprefixes':_0x4424e7['childModel']=_0x2505('0x40');break;case'ivrcampaigns':_0x4424e7[_0x2505('0x14')]=_0x2505('0x41');break;case'mailqueues':_0x4424e7['childModel']=_0x2505('0x42');break;case _0x2505('0x43'):_0x4424e7['childModel']=_0x2505('0x44');break;case'mailsubstatuses':_0x4424e7[_0x2505('0x14')]='MailSubstatus';break;case _0x2505('0x45'):_0x4424e7[_0x2505('0x14')]='OpenchannelQueue';break;case _0x2505('0x46'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x47');break;case _0x2505('0x48'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x49');break;case _0x2505('0x4a'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x4b');break;case'whatsappqueues':_0x4424e7[_0x2505('0x14')]='WhatsappQueue';break;case _0x2505('0x4c'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x4d');break;case _0x2505('0x4e'):_0x4424e7[_0x2505('0x14')]='Team';break;case'voicequeues':case _0x2505('0x4f'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x3b');if(_0x269ba0){_0x4424e7['parentSections']=[{'name':_0x2505('0x50')},{'name':_0x2505('0x51')}];}break;case _0x2505('0x52'):case'agents':case'telephones':_0x4424e7['childModel']=_0x2505('0x35');if(_0x269ba0){_0x4424e7[_0x2505('0x18')]=[{'name':_0x2505('0x53'),'filter':{'field':_0x2505('0x36'),'value':[_0x2505('0x54'),_0x2505('0x55')]},'ignore':!![]},{'name':_0x2505('0x34')},{'name':'Telephones'}];}break;case _0x2505('0x56'):_0x4424e7[_0x2505('0x14')]='ZendeskAccount';break;case _0x2505('0x57'):_0x4424e7[_0x2505('0x14')]='SalesforceAccount';break;case'freshdeskaccounts':_0x4424e7[_0x2505('0x14')]='FreshdeskAccount';break;case _0x2505('0x58'):_0x4424e7[_0x2505('0x14')]='SugarcrmAccount';break;case'deskaccounts':_0x4424e7['childModel']=_0x2505('0x59');break;case'zohoaccounts':_0x4424e7[_0x2505('0x14')]=_0x2505('0x5a');break;case _0x2505('0x5b'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x35');break;case _0x2505('0x5c'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x5d');break;case _0x2505('0x5e'):_0x4424e7['childModel']=_0x2505('0x5f');break;case'customdashboards':_0x4424e7[_0x2505('0x14')]=_0x2505('0x60');break;case _0x2505('0x61'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x62');break;case _0x2505('0x63'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x64');break;case _0x2505('0x65'):_0x4424e7[_0x2505('0x14')]='Schedule';break;case _0x2505('0x66'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x67');break;case'tags':_0x4424e7[_0x2505('0x14')]=_0x2505('0x68');break;case'templates':_0x4424e7[_0x2505('0x14')]=_0x2505('0x69');break;case _0x2505('0x6a'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x6b');break;case _0x2505('0x6c'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x6d');break;case _0x2505('0x6e'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x6f');break;case _0x2505('0x70'):_0x4424e7[_0x2505('0x14')]=_0x2505('0x71');break;case'extractedreports':_0x4424e7[_0x2505('0x14')]=_0x2505('0xf');_0x4424e7[_0x2505('0x18')]=[{'name':_0x2505('0x72'),'field':'id','foreignKey':_0x2505('0x73')}];break;case _0x2505('0x74'):_0x4424e7['childModel']=_0x2505('0x75');break;}return _0x4424e7;}function _0xf4154d(_0x108502,_0x1e496e){var _0x23e477=_0x108502[_0x2505('0x76')](0x0)[_0x2505('0x77')]()+_0x108502[_0x2505('0x78')](0x1);var _0x626fee={'type':_0x1a0fc4[_0x2505('0x79')][_0x2505('0x7a')]['SELECT'],'raw':!![]};return new Promise(function(_0x26f953,_0x1bc864){var _0x1b7fe4=squel[_0x2505('0x7b')]()[_0x2505('0x4')]('ui.'+_0x23e477+'InteractionId','id')[_0x2505('0x4')](_0x2505('0x7c'))['from']('user_has_'+_0x108502+_0x2505('0x7d'),'ui')[_0x2505('0x7e')]('ui.UserId\x20=\x20?',_0x1e496e['id']);return _0x1a0fc4[_0x2505('0x7f')][_0x2505('0x80')](_0x1b7fe4[_0x2505('0x81')](),_0x626fee)[_0x2505('0xa')](function(_0x12e212){_0x1e496e[_0x23e477+_0x2505('0x82')]=_0x12e212;_0x26f953(_0x12e212);})[_0x2505('0x7')](function(_0x3e0459){_0x1bc864(_0x3e0459);});});}return _0x13d416['define']('UserProfile',attributes,{'tableName':_0x2505('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3eddc6){var _0x52df6b=require('../../components/parsers/qs');var _0x5888da={'raw':_0x3eddc6[_0x2505('0x80')][_0x2505('0x84')],'where':{}};var _0x1457ea={};var _0x5b553b={'count':0x0,'rows':[]};var _0x51efc2=_0x3eddc6[_0x2505('0x80')][_0x2505('0x85')];var _0x39628f=_0x3eddc6['query'][_0x2505('0x86')]||![];var _0x231693=_0x3077f8(_0x51efc2,_0x39628f);if(!_0x231693[_0x2505('0x14')])throw new Error(_0x2505('0x87')+_0x51efc2+'\x27');var _0x6d931e=[{'name':_0x51efc2}];if(!_['isEmpty'](_0x231693['parentSections']))_0x6d931e=_0x231693['parentSections'];var _0x351119=[];for(var _0x299f3e=0x0;_0x299f3e<_0x6d931e[_0x2505('0x88')];_0x299f3e++){_0x351119[_0x2505('0x89')](_0x1a0fc4['UserProfileSection'][_0x2505('0x8a')]({'where':{'userProfileId':_0x3eddc6[_0x2505('0x8b')]['id'],'name':_0x6d931e[_0x299f3e][_0x2505('0xc')]},'raw':!![]}));}return Promise['all'](_0x351119)['then'](function(_0x314232){var _0x2e6af2=_[_0x2505('0x3')](_0x314232,function(_0x13c858){return _0x13c858?_0x13c858:undefined;});var _0x4d395f=_[_0x2505('0x3')](_0x6d931e,[_0x2505('0x8c'),!![]]);var _0x35b7c7=_[_0x2505('0x8d')](_0x2e6af2)&&_[_0x2505('0x8d')](_0x4d395f)?null:_[_0x2505('0x8e')](_0x4d395f,_0x2e6af2);if(!_0x35b7c7)return null;var _0x48a2fd=[];for(var _0x1de88f=0x0;_0x1de88f<_0x35b7c7[_0x2505('0x88')];_0x1de88f++){var _0x16402b=_[_0x2505('0x8a')](_0x6d931e,function(_0x10e52c){return _0x35b7c7[_0x1de88f]?_0x10e52c[_0x2505('0xc')]===_0x35b7c7[_0x1de88f][_0x2505('0xc')]:null;});if(_0x16402b){if(_0x35b7c7[_0x1de88f][_0x2505('0x8c')]){_0x48a2fd[_0x2505('0x89')](_0x376069(_0x231693[_0x2505('0x14')],_0x35b7c7[_0x1de88f]));}else{if(!_0x35b7c7[_0x1de88f]['autoAssociation']){_0x48a2fd[_0x2505('0x89')](_0x2d45a0(_0x16402b,_0x35b7c7[_0x1de88f],_0x231693[_0x2505('0x14')]));}else{if(_0x16402b['model']){_0x48a2fd[_0x2505('0x89')](_0x4c3ca2(_0x16402b,_0x35b7c7[_0x1de88f]));}}}}}return Promise[_0x2505('0x8f')](_0x48a2fd);})[_0x2505('0xa')](function(_0x6f4c4e){var _0xcd8b62=_0x6f4c4e;var _0x46297d=null;if(_0xcd8b62){_0x46297d=_0xcd8b62[_0x2505('0x88')]===0x1?_0xcd8b62[0x0]:null;}if(!_0x46297d&&!_0xcd8b62)return _0x5b553b;var _0x37f8bf=_0x1a0fc4[_0x231693[_0x2505('0x14')]][_0x2505('0x90')];_0x1457ea[_0x2505('0x8')]=_['keys'](_0x37f8bf);_0x1457ea[_0x2505('0x80')]=_[_0x2505('0x91')](_0x3eddc6[_0x2505('0x80')]);_0x1457ea['filters']=_[_0x2505('0x92')](_0x1457ea[_0x2505('0x8')],_0x1457ea['query']);_0x5888da[_0x2505('0x93')]=_[_0x2505('0x92')](_0x1457ea[_0x2505('0x8')],_0x52df6b[_0x2505('0x94')](_0x3eddc6[_0x2505('0x80')][_0x2505('0x94')]));_0x5888da['attributes']=_0x5888da['attributes']['length']?_0x5888da['attributes']:_0x1457ea[_0x2505('0x8')];if(!_0x3eddc6[_0x2505('0x80')][_0x2505('0x95')]('nolimit')){_0x5888da[_0x2505('0x96')]=_0x52df6b[_0x2505('0x96')](_0x3eddc6[_0x2505('0x80')][_0x2505('0x96')]);_0x5888da[_0x2505('0x97')]=_0x52df6b[_0x2505('0x97')](_0x3eddc6[_0x2505('0x80')]['offset']);}_0x5888da[_0x2505('0x98')]=_0x52df6b[_0x2505('0x99')](_0x3eddc6['query'][_0x2505('0x99')]);_0x5888da[_0x2505('0x7e')]=_0x52df6b[_0x2505('0x9a')](_[_0x2505('0x9b')](_0x3eddc6[_0x2505('0x80')],_0x1457ea[_0x2505('0x9a')]));if(_0x3eddc6[_0x2505('0x80')][_0x2505('0x3')]){_0x5888da[_0x2505('0x7e')]=_[_0x2505('0x9c')](_0x5888da['where'],{'$or':_['map'](_0x37f8bf,function(_0xe0fb76){if(_0xe0fb76[_0x2505('0x11')][_0x2505('0x9d')]!==_0x2505('0x9e')){var _0x217065={};_0x217065[_0xe0fb76[_0x2505('0x4')]]={'$like':'%'+_0x3eddc6[_0x2505('0x80')]['filter']+'%'};return _0x217065;}})});}var _0x380525=[];var _0x36a420=null;var _0x13ea20={};if(_0x46297d){_0x36a420=_[_0x2505('0x8a')](_0x6d931e,['name',_0x46297d['name']]);if(_0x36a420['field']){_0x13ea20={};if(_0x231693[_0x2505('0x14')]===_0x2505('0xf')){_0x13ea20[_0x36a420['foreignKey']]=_[_0x2505('0xb')](_0x46297d[_0x2505('0x6')],'id');}else{_0x13ea20[_0x36a420[_0x2505('0x9f')]]=_0x46297d[_0x2505('0x6')];}_0x380525[_0x2505('0x89')](_0x13ea20);}else{_0x5888da['where']['id']=_0x46297d['associatedResources'];}}else{for(var _0x3ff5c6=0x0;_0x3ff5c6<_0xcd8b62['length'];_0x3ff5c6++){_0x36a420=_[_0x2505('0x8a')](_0x6d931e,[_0x2505('0xc'),_0xcd8b62[_0x3ff5c6][_0x2505('0xc')]]);if(_0x36a420[_0x2505('0x4')]){_0x13ea20={};_0x13ea20[_0x36a420[_0x2505('0x9f')]]=_0xcd8b62[_0x3ff5c6][_0x2505('0x6')];_0x380525['push'](_0x13ea20);}else{if(!_0x5888da['where']['id'])_0x5888da['where']['id']=[];_0xcd8b62[_0x3ff5c6]['associatedResources'][_0x2505('0xa0')](function(_0x540493){_0x5888da['where']['id'][_0x2505('0x89')](_0x540493);});}}}if(!_[_0x2505('0x8d')](_0x380525)){_0x5888da[_0x2505('0x7e')]=_[_0x2505('0x9c')](_0x5888da[_0x2505('0x7e')],{'$and':{'$or':_0x380525}});}_0x5888da=_[_0x2505('0x9c')]({},_0x5888da,_0x3eddc6[_0x2505('0xa1')]);if(_0x46297d&&!_0x46297d[_0x2505('0xa2')]&&_0x231693[_0x2505('0x14')]==='AnalyticExtractedReport'){if(_0x3eddc6['query'][_0x2505('0xa3')]){_0x5888da[_0x2505('0xa4')]=[{'all':!![]}];}return _0x1a0fc4[_0x231693[_0x2505('0x14')]][_0x2505('0x9')](_0x5888da)[_0x2505('0xa')](function(_0x3af96d){var _0xc8b1bb=[];_0x3af96d[_0x2505('0xa0')](function(_0x2a912c){var _0x51b732;switch(_0x2a912c[_0x2505('0xa5')]){case _0x2505('0xa6'):_0x51b732=_['find'](_0x46297d[_0x2505('0x6')],function(_0x3c5922){return _0x3c5922['id']===_0x2a912c[_0x2505('0x73')]&&_0x3c5922[_0x2505('0x11')]===_0x2505('0xa7');});break;case _0x2505('0xa8'):_0x51b732=_[_0x2505('0x8a')](_0x46297d[_0x2505('0x6')],function(_0x34d9a3){return _0x34d9a3['id']===_0x2a912c[_0x2505('0x73')]&&_0x34d9a3[_0x2505('0x11')]===_0x2505('0xa9');});break;}if(_0x51b732)_0xc8b1bb[_0x2505('0x89')](_0x2a912c);});_0x5b553b[_0x2505('0xaa')]=_0xc8b1bb[_0x2505('0x88')];_0x5b553b[_0x2505('0xab')]=_0xc8b1bb;return _0x5b553b;});}else{if(!_[_0x2505('0x8d')](_0x3eddc6['query']['ids'])){_0x5888da[_0x2505('0x7e')]['id']=_0x5888da[_0x2505('0x7e')]['id']?_['intersection'](_0x5888da['where']['id'],_0x3eddc6[_0x2505('0x80')][_0x2505('0xac')]):_0x3eddc6[_0x2505('0x80')][_0x2505('0xac')];if(_0x3eddc6[_0x2505('0x80')]['customSorting']){_0x5888da[_0x2505('0x98')]=_0x3eddc6[_0x2505('0x80')]['customSorting'];}}if(_0x3eddc6['query'][_0x2505('0xad')]){_0x5888da['where']=_[_0x2505('0x9c')](_0x5888da[_0x2505('0x7e')],{'$and':_0x3eddc6[_0x2505('0x80')]['extraQueryConditions']});}return _0x1a0fc4[_0x231693[_0x2505('0x14')]][_0x2505('0xaa')]({'where':_0x5888da[_0x2505('0x7e')]})[_0x2505('0xa')](function(_0x400548){_0x5b553b[_0x2505('0xaa')]=_0x400548;if(_0x3eddc6[_0x2505('0x80')]['includeAll']){if(_0x231693[_0x2505('0x14')]===_0x2505('0xae')){_0x5888da[_0x2505('0xa4')]=[{'model':_0x1a0fc4[_0x2505('0x68')],'as':_0x2505('0xaf'),'attributes':['id',_0x2505('0xc'),_0x2505('0xb0')],'required':_0x3eddc6[_0x2505('0x80')]['tag']?!![]:![]},{'model':_0x1a0fc4['Tag'],'as':'ThroughTags','attributes':['id','name',_0x2505('0xb0')],'through':_0x3eddc6[_0x2505('0x80')][_0x2505('0xb1')]?{'attributes':[],'where':{'TagId':_0x3eddc6['query']['tag']||undefined}}:{},'required':_0x3eddc6[_0x2505('0x80')][_0x2505('0xb1')]?!![]:![]}];}else{_0x5888da[_0x2505('0xa4')]=[{'all':!![]}];}}return _0x1a0fc4[_0x231693[_0x2505('0x14')]][_0x2505('0x9')](_0x5888da);})['then'](function(_0x4054e7){_0x5b553b[_0x2505('0xab')]=_0x4054e7;if(_0x51efc2==='Agents'&&_0x3eddc6['query'][_0x2505('0xb2')]===_0x2505('0xb3')){var _0x181600=[];for(var _0x537067=0x0;_0x537067<_0x5b553b['rows'][_0x2505('0x88')];_0x537067++){_0x181600[_0x2505('0x89')](_0xf4154d('chat',_0x5b553b['rows'][_0x537067]['dataValues']));_0x181600['push'](_0xf4154d('sms',_0x5b553b[_0x2505('0xab')][_0x537067][_0x2505('0xb4')]));_0x181600[_0x2505('0x89')](_0xf4154d('fax',_0x5b553b[_0x2505('0xab')][_0x537067]['dataValues']));_0x181600[_0x2505('0x89')](_0xf4154d(_0x2505('0xb5'),_0x5b553b[_0x2505('0xab')][_0x537067][_0x2505('0xb4')]));_0x181600[_0x2505('0x89')](_0xf4154d(_0x2505('0xb6'),_0x5b553b['rows'][_0x537067][_0x2505('0xb4')]));_0x181600[_0x2505('0x89')](_0xf4154d(_0x2505('0xb7'),_0x5b553b[_0x2505('0xab')][_0x537067][_0x2505('0xb4')]));}return Promise[_0x2505('0x8f')](_0x181600)['then'](function(){return _0x5b553b;});}return _0x5b553b;});}});}}});}; \ No newline at end of file +var _0x49f4=['outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','Pause','scheduler','Schedule','sounds','tags','Tag','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','catch','define','UserProfile','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','union','autoAssociation','model','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','filters','pick','where','VIRTUAL','foreignKey','forEach','options','include','reportType','default','CustomReports','count','rows','ids','customSorting','merge','extraQueryConditions','includeAll','Tags','color','tag','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','resolve','UserProfileResource','resourceId','type','toLowerCase','childModel','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','name','projectName','contacts','CmContact','parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','agent','Telephones','User','role','VoiceQueues','queue','VoiceQueue','QueueCampaigns'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x49f4,0x147));var _0x449f=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x49f4[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require(_0x449f('0x0'));var attributes=require(_0x449f('0x1'));var squel=require(_0x449f('0x2'));module[_0x449f('0x3')]=function(_0x1925cf){var _0x1bb48a=_0x1925cf[_0x449f('0x4')];function _0x55ce78(_0x5ee851,_0x585444){return new Promise(function(_0x587485,_0x17045d){if(!_0x585444)return _0x587485(null);var _0x58cf40=_0x585444[_0x449f('0x5')]?{[_0x585444[_0x449f('0x5')][_0x449f('0x6')]]:_0x585444['filter'][_0x449f('0x7')]}:undefined;return _0x1bb48a[_0x5ee851][_0x449f('0x8')]({'where':_0x58cf40,'raw':!![]})[_0x449f('0x9')](function(_0x3559a6){_0x585444[_0x449f('0xa')]=_[_0x449f('0xb')](_0x3559a6,'id');_0x587485(_0x585444);})['catch'](function(_0x42a603){_0x17045d(_0x42a603);});});}function _0xc13d42(_0x528a5b,_0x39e78f){return new Promise(function(_0x405655,_0x569a22){var _0x5b73e3=_0x528a5b[_0x449f('0x5')]?{[_0x528a5b[_0x449f('0x5')]['field']]:_0x528a5b[_0x449f('0x5')][_0x449f('0x7')]}:undefined;return _0x1bb48a[_0x528a5b['model']]['findAll']({'where':_0x5b73e3,'raw':!![]})[_0x449f('0x9')](function(_0x3dd46c){_0x39e78f['associatedResources']=_['map'](_0x3dd46c,function(_0x38a22b){return _0x38a22b['name'];});_0x405655(_0x39e78f);})['catch'](function(_0x567eaf){_0x569a22(_0x567eaf);});});}function _0x1160e0(_0x306c1f,_0x3b4471,_0x413833){if(!_0x3b4471)return Promise[_0x449f('0xc')](null);return new Promise(function(_0x317dad,_0x1ed4e3){return _0x1bb48a[_0x449f('0xd')][_0x449f('0x8')]({'where':{'sectionId':_0x3b4471['id']},'raw':!![]})[_0x449f('0x9')](function(_0x3482bc){if(_0x306c1f[_0x449f('0x6')]&&_0x306c1f['field']!=='id'){_0x3b4471[_0x449f('0xa')]=_[_0x449f('0xb')](_0x3482bc,function(_0x2be46e){return _0x2be46e[_0x306c1f[_0x449f('0x6')]];});}else{if(_0x413833==='AnalyticExtractedReport'){_0x3b4471[_0x449f('0xa')]=_[_0x449f('0xb')](_0x3482bc,function(_0x3a19d5){return{'id':_0x3a19d5[_0x449f('0xe')],'type':_0x3a19d5[_0x449f('0xf')]};});}else{_0x3b4471[_0x449f('0xa')]=_['map'](_0x3482bc,function(_0x386503){return _0x386503[_0x449f('0xe')];});}}_0x317dad(_0x3b4471);})['catch'](function(_0x54d107){_0x1ed4e3(_0x54d107);});});}function _0xbb2add(_0x441a2d,_0x1571be){var _0x2a8f88={'parentSections':[]};switch(_0x441a2d[_0x449f('0x10')]()){case'squareprojects':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x12');break;case _0x449f('0x13'):_0x2a8f88[_0x449f('0x11')]='SquareOdbc';break;case _0x449f('0x14'):_0x2a8f88['childModel']=_0x449f('0x15');_0x2a8f88['parentSections']=[{'name':_0x449f('0x16'),'field':_0x449f('0x17'),'foreignKey':_0x449f('0x18')}];break;case'projects':_0x2a8f88[_0x449f('0x11')]='JscriptyProject';break;case _0x449f('0x19'):_0x2a8f88['childModel']=_0x449f('0x1a');_0x2a8f88[_0x449f('0x1b')]=[{'name':_0x449f('0x1c'),'field':'id','foreignKey':_0x449f('0x1d')}];break;case _0x449f('0x1e'):_0x2a8f88['childModel']=_0x449f('0x1f');break;case _0x449f('0x20'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x21');break;case _0x449f('0x22'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x23');break;case _0x449f('0x24'):_0x2a8f88['childModel']=_0x449f('0x25');break;case _0x449f('0x26'):_0x2a8f88['childModel']=_0x449f('0x27');break;case _0x449f('0x28'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x29');break;case'faxaccounts':_0x2a8f88[_0x449f('0x11')]='FaxAccount';break;case'inboundroutes':case _0x449f('0x2a'):case _0x449f('0x2b'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x2c');break;case'contexts':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x2d');break;case _0x449f('0x2e'):_0x2a8f88[_0x449f('0x11')]='VoiceMail';break;case _0x449f('0x2f'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x30');_0x2a8f88[_0x449f('0x1b')]=[{'name':_0x449f('0x31'),'field':_0x449f('0x17'),'foreignKey':_0x449f('0x32'),'model':'User','filter':{'field':'role','value':[_0x449f('0x33')]}},{'name':_0x449f('0x34'),'field':'name','foreignKey':_0x449f('0x32'),'model':_0x449f('0x35'),'filter':{'field':_0x449f('0x36'),'value':['telephone']}},{'name':_0x449f('0x37'),'field':_0x449f('0x17'),'foreignKey':_0x449f('0x38'),'model':_0x449f('0x39'),'filter':{'field':_0x449f('0xf'),'value':['inbound']}},{'name':_0x449f('0x3a'),'field':_0x449f('0x17'),'foreignKey':_0x449f('0x38'),'model':_0x449f('0x39'),'filter':{'field':_0x449f('0xf'),'value':[_0x449f('0x3b')]}}];break;case _0x449f('0x3c'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x3d');break;case _0x449f('0x3e'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x3f');break;case _0x449f('0x40'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x41');break;case _0x449f('0x42'):_0x2a8f88['childModel']='Campaign';break;case'mailqueues':_0x2a8f88['childModel']=_0x449f('0x43');break;case _0x449f('0x44'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x45');break;case _0x449f('0x46'):_0x2a8f88['childModel']='MailSubstatus';break;case _0x449f('0x47'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x48');break;case _0x449f('0x49'):_0x2a8f88[_0x449f('0x11')]='OpenchannelAccount';break;case _0x449f('0x4a'):_0x2a8f88[_0x449f('0x11')]='SmsQueue';break;case _0x449f('0x4b'):_0x2a8f88['childModel']='SmsAccount';break;case _0x449f('0x4c'):_0x2a8f88['childModel']=_0x449f('0x4d');break;case _0x449f('0x4e'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x4f');break;case _0x449f('0x50'):_0x2a8f88[_0x449f('0x11')]='Team';break;case _0x449f('0x51'):case _0x449f('0x52'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x39');if(_0x1571be){_0x2a8f88[_0x449f('0x1b')]=[{'name':_0x449f('0x37')},{'name':'QueueCampaigns'}];}break;case _0x449f('0x53'):case _0x449f('0x54'):case _0x449f('0x55'):_0x2a8f88[_0x449f('0x11')]='User';if(_0x1571be){_0x2a8f88[_0x449f('0x1b')]=[{'name':'Users','filter':{'field':'role','value':[_0x449f('0x56'),_0x449f('0x57')]},'ignore':!![]},{'name':_0x449f('0x31')},{'name':_0x449f('0x34')}];}break;case _0x449f('0x58'):_0x2a8f88[_0x449f('0x11')]='ZendeskAccount';break;case _0x449f('0x59'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x5a');break;case _0x449f('0x5b'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x5c');break;case _0x449f('0x5d'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x5e');break;case _0x449f('0x5f'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x60');break;case'zohoaccounts':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x61');break;case'vtigeraccounts':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x35');break;case'cannedanswers':_0x2a8f88['childModel']=_0x449f('0x62');break;case _0x449f('0x63'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x64');break;case _0x449f('0x65'):_0x2a8f88[_0x449f('0x11')]='Dashboard';break;case _0x449f('0x66'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x67');break;case'pauses':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x68');break;case _0x449f('0x69'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x6a');break;case _0x449f('0x6b'):_0x2a8f88['childModel']='Sound';break;case _0x449f('0x6c'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x6d');break;case'templates':_0x2a8f88[_0x449f('0x11')]=_0x449f('0x6e');break;case _0x449f('0x6f'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x70');break;case _0x449f('0x71'):_0x2a8f88['childModel']=_0x449f('0x72');break;case _0x449f('0x73'):_0x2a8f88['childModel']='Variable';break;case _0x449f('0x74'):_0x2a8f88['childModel']=_0x449f('0x75');break;case _0x449f('0x76'):_0x2a8f88['childModel']=_0x449f('0x77');_0x2a8f88[_0x449f('0x1b')]=[{'name':_0x449f('0x78'),'field':'id','foreignKey':_0x449f('0x79')}];break;case _0x449f('0x7a'):_0x2a8f88[_0x449f('0x11')]=_0x449f('0x7b');break;}return _0x2a8f88;}function _0x40b3c1(_0x5383d0,_0x53e3f4){var _0x2092b3=_0x5383d0['charAt'](0x0)['toUpperCase']()+_0x5383d0['slice'](0x1);var _0x238330={'type':_0x1bb48a[_0x449f('0x7c')][_0x449f('0x7d')][_0x449f('0x7e')],'raw':!![]};return new Promise(function(_0x4c415a,_0x64b4fa){var _0x53e99f=squel['select']()[_0x449f('0x6')](_0x449f('0x7f')+_0x2092b3+_0x449f('0x80'),'id')[_0x449f('0x6')](_0x449f('0x81'))[_0x449f('0x82')](_0x449f('0x83')+_0x5383d0+'_interactions','ui')['where'](_0x449f('0x84'),_0x53e3f4['id']);return _0x1bb48a[_0x449f('0x85')][_0x449f('0x86')](_0x53e99f[_0x449f('0x87')](),_0x238330)['then'](function(_0x5258a6){_0x53e3f4[_0x2092b3+_0x449f('0x88')]=_0x5258a6;_0x4c415a(_0x5258a6);})[_0x449f('0x89')](function(_0x58461e){_0x64b4fa(_0x58461e);});});}return _0x1925cf[_0x449f('0x8a')](_0x449f('0x8b'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xfb165f){var _0x16ac72=require(_0x449f('0x8c'));var _0xe16cc6={'raw':_0xfb165f[_0x449f('0x86')][_0x449f('0x8d')],'where':{}};var _0x59043d={};var _0x4ebb75={'count':0x0,'rows':[]};var _0xbaa9a0=_0xfb165f[_0x449f('0x86')][_0x449f('0x8e')];var _0x19819f=_0xfb165f[_0x449f('0x86')][_0x449f('0x8f')]||![];var _0x4fdf1a=_0xbb2add(_0xbaa9a0,_0x19819f);if(!_0x4fdf1a['childModel'])throw new Error(_0x449f('0x90')+_0xbaa9a0+'\x27');var _0xd20753=[{'name':_0xbaa9a0}];if(!_['isEmpty'](_0x4fdf1a['parentSections']))_0xd20753=_0x4fdf1a[_0x449f('0x1b')];var _0x3eac09=[];for(var _0x590c58=0x0;_0x590c58<_0xd20753[_0x449f('0x91')];_0x590c58++){_0x3eac09[_0x449f('0x92')](_0x1bb48a[_0x449f('0x93')][_0x449f('0x94')]({'where':{'userProfileId':_0xfb165f[_0x449f('0x95')]['id'],'name':_0xd20753[_0x590c58][_0x449f('0x17')]},'raw':!![]}));}return Promise[_0x449f('0x96')](_0x3eac09)[_0x449f('0x9')](function(_0x4598bf){var _0x2f50fd=_[_0x449f('0x5')](_0x4598bf,function(_0x54cdbb){return _0x54cdbb?_0x54cdbb:undefined;});var _0x380cba=_[_0x449f('0x5')](_0xd20753,[_0x449f('0x97'),!![]]);var _0x1c9474=_[_0x449f('0x98')](_0x2f50fd)&&_[_0x449f('0x98')](_0x380cba)?null:_[_0x449f('0x99')](_0x380cba,_0x2f50fd);if(!_0x1c9474)return null;var _0x22e44a=[];for(var _0x106fc5=0x0;_0x106fc5<_0x1c9474['length'];_0x106fc5++){var _0x3d8a3c=_['find'](_0xd20753,function(_0x3c3aaf){return _0x1c9474[_0x106fc5]?_0x3c3aaf[_0x449f('0x17')]===_0x1c9474[_0x106fc5][_0x449f('0x17')]:null;});if(_0x3d8a3c){if(_0x1c9474[_0x106fc5][_0x449f('0x97')]){_0x22e44a[_0x449f('0x92')](_0x55ce78(_0x4fdf1a[_0x449f('0x11')],_0x1c9474[_0x106fc5]));}else{if(!_0x1c9474[_0x106fc5][_0x449f('0x9a')]){_0x22e44a[_0x449f('0x92')](_0x1160e0(_0x3d8a3c,_0x1c9474[_0x106fc5],_0x4fdf1a['childModel']));}else{if(_0x3d8a3c[_0x449f('0x9b')]){_0x22e44a[_0x449f('0x92')](_0xc13d42(_0x3d8a3c,_0x1c9474[_0x106fc5]));}}}}}return Promise[_0x449f('0x96')](_0x22e44a);})[_0x449f('0x9')](function(_0x160145){var _0x3df778=_0x160145;var _0x380473=null;if(_0x3df778){_0x380473=_0x3df778[_0x449f('0x91')]===0x1?_0x3df778[0x0]:null;}if(!_0x380473&&!_0x3df778)return _0x4ebb75;var _0x48f51a=_0x1bb48a[_0x4fdf1a['childModel']][_0x449f('0x9c')];_0x59043d[_0x449f('0x9b')]=_[_0x449f('0x9d')](_0x48f51a);_0x59043d[_0x449f('0x86')]=_[_0x449f('0x9d')](_0xfb165f['query']);_0x59043d['filters']=_[_0x449f('0x9e')](_0x59043d['model'],_0x59043d[_0x449f('0x86')]);_0xe16cc6[_0x449f('0x9f')]=_[_0x449f('0x9e')](_0x59043d['model'],_0x16ac72[_0x449f('0xa0')](_0xfb165f[_0x449f('0x86')][_0x449f('0xa0')]));_0xe16cc6[_0x449f('0x9f')]=_0xe16cc6['attributes'][_0x449f('0x91')]?_0xe16cc6['attributes']:_0x59043d[_0x449f('0x9b')];if(!_0xfb165f[_0x449f('0x86')][_0x449f('0xa1')]('nolimit')){_0xe16cc6['limit']=_0x16ac72[_0x449f('0xa2')](_0xfb165f[_0x449f('0x86')][_0x449f('0xa2')]);_0xe16cc6[_0x449f('0xa3')]=_0x16ac72['offset'](_0xfb165f[_0x449f('0x86')]['offset']);}_0xe16cc6[_0x449f('0xa4')]=_0x16ac72[_0x449f('0xa5')](_0xfb165f['query'][_0x449f('0xa5')]);_0xe16cc6['where']=_0x16ac72[_0x449f('0xa6')](_[_0x449f('0xa7')](_0xfb165f[_0x449f('0x86')],_0x59043d[_0x449f('0xa6')]));if(_0xfb165f['query'][_0x449f('0x5')]){_0xe16cc6[_0x449f('0xa8')]=_['merge'](_0xe16cc6[_0x449f('0xa8')],{'$or':_[_0x449f('0xb')](_0x48f51a,function(_0xd52b00){if(_0xd52b00[_0x449f('0xf')]['key']!==_0x449f('0xa9')){var _0x141af5={};_0x141af5[_0xd52b00['field']]={'$like':'%'+_0xfb165f['query'][_0x449f('0x5')]+'%'};return _0x141af5;}})});}var _0x22f903=[];var _0x11f431=null;var _0x17dcb2={};if(_0x380473){_0x11f431=_['find'](_0xd20753,[_0x449f('0x17'),_0x380473[_0x449f('0x17')]]);if(_0x11f431[_0x449f('0x6')]){_0x17dcb2={};if(_0x4fdf1a[_0x449f('0x11')]===_0x449f('0x77')){_0x17dcb2[_0x11f431[_0x449f('0xaa')]]=_['map'](_0x380473[_0x449f('0xa')],'id');}else{_0x17dcb2[_0x11f431[_0x449f('0xaa')]]=_0x380473[_0x449f('0xa')];}_0x22f903[_0x449f('0x92')](_0x17dcb2);}else{_0xe16cc6['where']['id']=_0x380473[_0x449f('0xa')];}}else{for(var _0x4771de=0x0;_0x4771de<_0x3df778[_0x449f('0x91')];_0x4771de++){_0x11f431=_[_0x449f('0x94')](_0xd20753,[_0x449f('0x17'),_0x3df778[_0x4771de]['name']]);if(_0x11f431['field']){_0x17dcb2={};_0x17dcb2[_0x11f431[_0x449f('0xaa')]]=_0x3df778[_0x4771de][_0x449f('0xa')];_0x22f903['push'](_0x17dcb2);}else{if(!_0xe16cc6[_0x449f('0xa8')]['id'])_0xe16cc6[_0x449f('0xa8')]['id']=[];_0x3df778[_0x4771de][_0x449f('0xa')][_0x449f('0xab')](function(_0x1d5d6d){_0xe16cc6[_0x449f('0xa8')]['id'][_0x449f('0x92')](_0x1d5d6d);});}}}if(!_[_0x449f('0x98')](_0x22f903)){_0xe16cc6[_0x449f('0xa8')]=_['merge'](_0xe16cc6['where'],{'$and':{'$or':_0x22f903}});}_0xe16cc6=_['merge']({},_0xe16cc6,_0xfb165f[_0x449f('0xac')]);if(_0x380473&&!_0x380473[_0x449f('0x9a')]&&_0x4fdf1a[_0x449f('0x11')]===_0x449f('0x77')){if(_0xfb165f[_0x449f('0x86')]['includeAll']){_0xe16cc6[_0x449f('0xad')]=[{'all':!![]}];}return _0x1bb48a[_0x4fdf1a['childModel']][_0x449f('0x8')](_0xe16cc6)['then'](function(_0x145d88){var _0x27f8ec=[];_0x145d88['forEach'](function(_0x151667){var _0x444e2c;switch(_0x151667[_0x449f('0xae')]){case _0x449f('0xaf'):_0x444e2c=_[_0x449f('0x94')](_0x380473[_0x449f('0xa')],function(_0x3a6dff){return _0x3a6dff['id']===_0x151667[_0x449f('0x79')]&&_0x3a6dff[_0x449f('0xf')]==='DefaultReports';});break;case'custom':_0x444e2c=_[_0x449f('0x94')](_0x380473['associatedResources'],function(_0x1c32a1){return _0x1c32a1['id']===_0x151667[_0x449f('0x79')]&&_0x1c32a1['type']===_0x449f('0xb0');});break;}if(_0x444e2c)_0x27f8ec['push'](_0x151667);});_0x4ebb75[_0x449f('0xb1')]=_0x27f8ec[_0x449f('0x91')];_0x4ebb75[_0x449f('0xb2')]=_0x27f8ec;return _0x4ebb75;});}else{if(!_[_0x449f('0x98')](_0xfb165f[_0x449f('0x86')]['ids'])){_0xe16cc6[_0x449f('0xa8')]['id']=_0xe16cc6[_0x449f('0xa8')]['id']?_[_0x449f('0x9e')](_0xe16cc6[_0x449f('0xa8')]['id'],_0xfb165f[_0x449f('0x86')][_0x449f('0xb3')]):_0xfb165f[_0x449f('0x86')][_0x449f('0xb3')];if(_0xfb165f[_0x449f('0x86')][_0x449f('0xb4')]){_0xe16cc6[_0x449f('0xa4')]=_0xfb165f[_0x449f('0x86')][_0x449f('0xb4')];}}if(_0xfb165f[_0x449f('0x86')]['extraQueryConditions']){_0xe16cc6[_0x449f('0xa8')]=_[_0x449f('0xb5')](_0xe16cc6['where'],{'$and':_0xfb165f[_0x449f('0x86')][_0x449f('0xb6')]});}return _0x1bb48a[_0x4fdf1a[_0x449f('0x11')]][_0x449f('0xb1')]({'where':_0xe16cc6['where']})[_0x449f('0x9')](function(_0x13d8e3){_0x4ebb75[_0x449f('0xb1')]=_0x13d8e3;if(_0xfb165f[_0x449f('0x86')][_0x449f('0xb7')]){if(_0x4fdf1a['childModel']===_0x449f('0x1a')){_0xe16cc6[_0x449f('0xad')]=[{'model':_0x1bb48a['Tag'],'as':_0x449f('0xb8'),'attributes':['id',_0x449f('0x17'),_0x449f('0xb9')],'required':_0xfb165f[_0x449f('0x86')][_0x449f('0xba')]?!![]:![]},{'model':_0x1bb48a[_0x449f('0x6d')],'as':'ThroughTags','attributes':['id',_0x449f('0x17'),_0x449f('0xb9')],'through':_0xfb165f[_0x449f('0x86')][_0x449f('0xba')]?{'attributes':[],'where':{'TagId':_0xfb165f['query']['tag']||undefined}}:{},'required':_0xfb165f['query']['tag']?!![]:![]}];}else{_0xe16cc6[_0x449f('0xad')]=[{'all':!![]}];}}return _0x1bb48a[_0x4fdf1a[_0x449f('0x11')]][_0x449f('0x8')](_0xe16cc6);})[_0x449f('0x9')](function(_0x1d4baa){_0x4ebb75['rows']=_0x1d4baa;if(_0xbaa9a0===_0x449f('0x31')&&_0xfb165f['query']['openTabs']==='true'){var _0x2a43f9=[];for(var _0x387fa0=0x0;_0x387fa0<_0x4ebb75[_0x449f('0xb2')][_0x449f('0x91')];_0x387fa0++){_0x2a43f9['push'](_0x40b3c1(_0x449f('0xbb'),_0x4ebb75[_0x449f('0xb2')][_0x387fa0][_0x449f('0xbc')]));_0x2a43f9[_0x449f('0x92')](_0x40b3c1(_0x449f('0xbd'),_0x4ebb75['rows'][_0x387fa0][_0x449f('0xbc')]));_0x2a43f9[_0x449f('0x92')](_0x40b3c1('fax',_0x4ebb75[_0x449f('0xb2')][_0x387fa0]['dataValues']));_0x2a43f9[_0x449f('0x92')](_0x40b3c1(_0x449f('0xbe'),_0x4ebb75['rows'][_0x387fa0][_0x449f('0xbc')]));_0x2a43f9[_0x449f('0x92')](_0x40b3c1(_0x449f('0xbf'),_0x4ebb75[_0x449f('0xb2')][_0x387fa0][_0x449f('0xbc')]));_0x2a43f9['push'](_0x40b3c1(_0x449f('0xc0'),_0x4ebb75['rows'][_0x387fa0][_0x449f('0xbc')]));}return Promise['all'](_0x2a43f9)[_0x449f('0x9')](function(){return _0x4ebb75;});}return _0x4ebb75;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ac17762..e7c495c 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 _0x444e=['debug','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./userProfile.socket','register','request','info','request\x20sent'];(function(_0x365df3,_0x25d6a7){var _0x2a02a0=function(_0x5797a3){while(--_0x5797a3){_0x365df3['push'](_0x365df3['shift']());}};_0x2a02a0(++_0x25d6a7);}(_0x444e,0xe8));var _0xe444=function(_0x494413,_0x40e7ec){_0x494413=_0x494413-0x0;var _0x2217ed=_0x444e[_0x494413];return _0x2217ed;};'use strict';var _=require(_0xe444('0x0'));var util=require('util');var moment=require(_0xe444('0x1'));var BPromise=require('bluebird');var rs=require(_0xe444('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe444('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe444('0x4'))(_0xe444('0x5'));var config=require(_0xe444('0x6'));var jayson=require(_0xe444('0x7'));var client=jayson[_0xe444('0x8')][_0xe444('0x9')]({'port':0x232a});config['redis']=_[_0xe444('0xa')](config['redis'],{'host':_0xe444('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe444('0xc')]));require(_0xe444('0xd'))[_0xe444('0xe')](socket);function respondWithRpcPromise(_0x48907b,_0x55697b,_0x36c8a5){return new BPromise(function(_0x1f41ff,_0x5e53cb){return client[_0xe444('0xf')](_0x48907b,_0x36c8a5)['then'](function(_0x5f0f7f){logger[_0xe444('0x10')]('UserProfile,\x20%s,\x20%s',_0x55697b,_0xe444('0x11'));logger[_0xe444('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x55697b,_0xe444('0x11'),JSON['stringify'](_0x5f0f7f));if(_0x5f0f7f['error']){if(_0x5f0f7f[_0xe444('0x13')][_0xe444('0x14')]===0x1f4){logger['error'](_0xe444('0x15'),_0x55697b,_0x5f0f7f['error'][_0xe444('0x16')]);return _0x5e53cb(_0x5f0f7f[_0xe444('0x13')][_0xe444('0x16')]);}logger[_0xe444('0x13')](_0xe444('0x15'),_0x55697b,_0x5f0f7f[_0xe444('0x13')][_0xe444('0x16')]);return _0x1f41ff(_0x5f0f7f[_0xe444('0x13')][_0xe444('0x16')]);}else{logger[_0xe444('0x10')](_0xe444('0x15'),_0x55697b,_0xe444('0x11'));_0x1f41ff(_0x5f0f7f[_0xe444('0x17')]['message']);}})[_0xe444('0x18')](function(_0x1f904f){logger[_0xe444('0x13')](_0xe444('0x15'),_0x55697b,_0x1f904f);_0x5e53cb(_0x1f904f);});});} \ No newline at end of file +var _0xdb8b=['http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x550d49,_0x870b44){var _0xec46f3=function(_0x2fa514){while(--_0x2fa514){_0x550d49['push'](_0x550d49['shift']());}};_0xec46f3(++_0x870b44);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x503710,_0x5eb02d){_0x503710=_0x503710-0x0;var _0x3a6bff=_0xdb8b[_0x503710];return _0x3a6bff;};'use strict';var _=require('lodash');var util=require(_0xbdb8('0x0'));var moment=require(_0xbdb8('0x1'));var BPromise=require(_0xbdb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdb8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdb8('0x4'))(_0xbdb8('0x5'));var config=require(_0xbdb8('0x6'));var jayson=require(_0xbdb8('0x7'));var client=jayson['client'][_0xbdb8('0x8')]({'port':0x232a});config['redis']=_[_0xbdb8('0x9')](config[_0xbdb8('0xa')],{'host':_0xbdb8('0xb'),'port':0x18eb});var socket=require(_0xbdb8('0xc'))(new Redis(config[_0xbdb8('0xa')]));require(_0xbdb8('0xd'))['register'](socket);function respondWithRpcPromise(_0x3339c2,_0x176a31,_0x3cc8d1){return new BPromise(function(_0x682657,_0x2fba54){return client[_0xbdb8('0xe')](_0x3339c2,_0x3cc8d1)[_0xbdb8('0xf')](function(_0x55f17e){logger['info'](_0xbdb8('0x10'),_0x176a31,'request\x20sent');logger[_0xbdb8('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x176a31,_0xbdb8('0x12'),JSON['stringify'](_0x55f17e));if(_0x55f17e[_0xbdb8('0x13')]){if(_0x55f17e[_0xbdb8('0x13')][_0xbdb8('0x14')]===0x1f4){logger[_0xbdb8('0x13')](_0xbdb8('0x10'),_0x176a31,_0x55f17e[_0xbdb8('0x13')][_0xbdb8('0x15')]);return _0x2fba54(_0x55f17e[_0xbdb8('0x13')][_0xbdb8('0x15')]);}logger[_0xbdb8('0x13')](_0xbdb8('0x10'),_0x176a31,_0x55f17e[_0xbdb8('0x13')][_0xbdb8('0x15')]);return _0x682657(_0x55f17e['error'][_0xbdb8('0x15')]);}else{logger[_0xbdb8('0x16')](_0xbdb8('0x10'),_0x176a31,'request\x20sent');_0x682657(_0x55f17e['result'][_0xbdb8('0x15')]);}})['catch'](function(_0x37177b){logger[_0xbdb8('0x13')](_0xbdb8('0x10'),_0x176a31,_0x37177b);_0x2fba54(_0x37177b);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 46b240d..a88e706 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 _0xdf05=['remove','emit','removeListener','register','length','userProfile:','./userProfile.events','save'];(function(_0x4bfd41,_0x4330e0){var _0x8bd130=function(_0xe2ff10){while(--_0xe2ff10){_0x4bfd41['push'](_0x4bfd41['shift']());}};_0x8bd130(++_0x4330e0);}(_0xdf05,0x1be));var _0x5df0=function(_0x35e6ca,_0x54939f){_0x35e6ca=_0x35e6ca-0x0;var _0x239e43=_0xdf05[_0x35e6ca];return _0x239e43;};'use strict';var UserProfileEvents=require(_0x5df0('0x0'));var events=[_0x5df0('0x1'),_0x5df0('0x2'),'update'];function createListener(_0x3125fd,_0x36ffff){return function(_0x233b9a){_0x36ffff[_0x5df0('0x3')](_0x3125fd,_0x233b9a);};}function removeListener(_0x230700,_0x1c7533){return function(){UserProfileEvents[_0x5df0('0x4')](_0x230700,_0x1c7533);};}exports[_0x5df0('0x5')]=function(_0x38f567){for(var _0x1a87bd=0x0,_0x1c64c0=events[_0x5df0('0x6')];_0x1a87bd<_0x1c64c0;_0x1a87bd++){var _0x3e78d6=events[_0x1a87bd];var _0x11f17a=createListener(_0x5df0('0x7')+_0x3e78d6,_0x38f567);UserProfileEvents['on'](_0x3e78d6,_0x11f17a);}}; \ No newline at end of file +var _0xefe6=['register','length','save','remove','update','emit','removeListener'];(function(_0x1021b5,_0x71c972){var _0x3fa0df=function(_0x103ae4){while(--_0x103ae4){_0x1021b5['push'](_0x1021b5['shift']());}};_0x3fa0df(++_0x71c972);}(_0xefe6,0x144));var _0x6efe=function(_0x2dd6b1,_0x4485d7){_0x2dd6b1=_0x2dd6b1-0x0;var _0x494306=_0xefe6[_0x2dd6b1];return _0x494306;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x6efe('0x0'),_0x6efe('0x1'),_0x6efe('0x2')];function createListener(_0x1407c8,_0x453f5f){return function(_0x2a26b4){_0x453f5f[_0x6efe('0x3')](_0x1407c8,_0x2a26b4);};}function removeListener(_0x1a8629,_0x562f0f){return function(){UserProfileEvents[_0x6efe('0x4')](_0x1a8629,_0x562f0f);};}exports[_0x6efe('0x5')]=function(_0x2d3530){for(var _0x25dd14=0x0,_0xb7df64=events[_0x6efe('0x6')];_0x25dd14<_0xb7df64;_0x25dd14++){var _0x4de038=events[_0x25dd14];var _0x55b282=createListener('userProfile:'+_0x4de038,_0x2d3530);UserProfileEvents['on'](_0x4de038,_0x55b282);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 558d395..db71118 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 _0x1817=['put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./userProfileResource.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x1817,0x1e5));var _0x7181=function(_0x31e87f,_0x2223c9){_0x31e87f=_0x31e87f-0x0;var _0xab5ab0=_0x1817[_0x31e87f];return _0xab5ab0;};'use strict';var multer=require(_0x7181('0x0'));var util=require(_0x7181('0x1'));var path=require('path');var timeout=require(_0x7181('0x2'));var express=require('express');var router=express[_0x7181('0x3')]();var fs_extra=require(_0x7181('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7181('0x5'));var controller=require(_0x7181('0x6'));router[_0x7181('0x7')]('/',auth['isAuthenticated'](),controller[_0x7181('0x8')]);router[_0x7181('0x7')](_0x7181('0x9'),auth['isAuthenticated'](),controller[_0x7181('0xa')]);router[_0x7181('0x7')](_0x7181('0xb'),auth[_0x7181('0xc')](),controller[_0x7181('0xd')]);router[_0x7181('0xe')]('/',auth[_0x7181('0xc')](),controller['create']);router[_0x7181('0xf')]('/:id',auth[_0x7181('0xc')](),controller[_0x7181('0x10')]);router[_0x7181('0x11')](_0x7181('0xb'),auth[_0x7181('0xc')](),controller[_0x7181('0x12')]);module[_0x7181('0x13')]=router; \ No newline at end of file +var _0x0084=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','show','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2e505f,_0xee12ca){var _0x43aedd=function(_0x57db39){while(--_0x57db39){_0x2e505f['push'](_0x2e505f['shift']());}};_0x43aedd(++_0xee12ca);}(_0x0084,0x68));var _0x4008=function(_0x2ece52,_0x538ee5){_0x2ece52=_0x2ece52-0x0;var _0x585ea8=_0x0084[_0x2ece52];return _0x585ea8;};'use strict';var multer=require(_0x4008('0x0'));var util=require(_0x4008('0x1'));var path=require(_0x4008('0x2'));var timeout=require(_0x4008('0x3'));var express=require(_0x4008('0x4'));var router=express['Router']();var fs_extra=require(_0x4008('0x5'));var auth=require(_0x4008('0x6'));var interaction=require(_0x4008('0x7'));var config=require(_0x4008('0x8'));var controller=require(_0x4008('0x9'));router[_0x4008('0xa')]('/',auth['isAuthenticated'](),controller[_0x4008('0xb')]);router[_0x4008('0xa')](_0x4008('0xc'),auth[_0x4008('0xd')](),controller[_0x4008('0xe')]);router[_0x4008('0xa')]('/:id',auth[_0x4008('0xd')](),controller[_0x4008('0xf')]);router['post']('/',auth[_0x4008('0xd')](),controller[_0x4008('0x10')]);router[_0x4008('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4008('0x12')]);router[_0x4008('0x13')](_0x4008('0x14'),auth['isAuthenticated'](),controller[_0x4008('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 9915345..07745ab 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 _0x2eeb=['INTEGER','sequelize','exports','STRING'];(function(_0x1e0063,_0x836add){var _0xd870fa=function(_0x4ef016){while(--_0x4ef016){_0x1e0063['push'](_0x1e0063['shift']());}};_0xd870fa(++_0x836add);}(_0x2eeb,0x181));var _0xb2ee=function(_0x3f86e9,_0x1d57d5){_0x3f86e9=_0x3f86e9-0x0;var _0x4151a5=_0x2eeb[_0x3f86e9];return _0x4151a5;};'use strict';var Sequelize=require(_0xb2ee('0x0'));module[_0xb2ee('0x1')]={'name':{'type':Sequelize[_0xb2ee('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb2ee('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb2ee('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x36e8=['STRING','sequelize'];(function(_0x505ef4,_0x4bb0b7){var _0x13da45=function(_0x4c09a5){while(--_0x4c09a5){_0x505ef4['push'](_0x505ef4['shift']());}};_0x13da45(++_0x4bb0b7);}(_0x36e8,0xfb));var _0x836e=function(_0x1ca3d6,_0x312dad){_0x1ca3d6=_0x1ca3d6-0x0;var _0x5d1060=_0x36e8[_0x1ca3d6];return _0x5d1060;};'use strict';var Sequelize=require(_0x836e('0x0'));module['exports']={'name':{'type':Sequelize[_0x836e('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x836e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index d383d5c..00f501d 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 _0x1883=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileResource','includeAll','include','findAll','params','catch','create','body','find','describe','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x26b116,_0x50d113){var _0x36fa36=function(_0x326bfc){while(--_0x326bfc){_0x26b116['push'](_0x26b116['shift']());}};_0x36fa36(++_0x50d113);}(_0x1883,0xab));var _0x3188=function(_0x56ee08,_0x3d7e2e){_0x56ee08=_0x56ee08-0x0;var _0x11e6bc=_0x1883[_0x56ee08];return _0x11e6bc;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['UserProfileResource'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['UserProfileResource'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')](_0xe4cbb0[_0x3188('0x48')],{})[_0x3188('0x23')](respondWithResult(_0x315524,0xc9))[_0x3188('0x46')](handleError(_0x315524,null));};exports['update']=function(_0x50fd56,_0x1b012d){if(_0x50fd56['body']['id']){delete _0x50fd56[_0x3188('0x48')]['id'];}return db[_0x3188('0x41')]['find']({'where':{'id':_0x50fd56[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x1b012d,null))[_0x3188('0x23')](saveUpdates(_0x50fd56[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x1b012d,null))[_0x3188('0x46')](handleError(_0x1b012d,null));};exports[_0x3188('0x24')]=function(_0x1e3592,_0x59a177){return db[_0x3188('0x41')][_0x3188('0x49')]({'where':{'id':_0x1e3592['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x59a177,null))['then'](removeEntity(_0x59a177,null))[_0x3188('0x46')](handleError(_0x59a177,null));};exports[_0x3188('0x4a')]=function(_0x4f8852,_0x559264){return db['UserProfileResource']['describe']()['then'](respondWithResult(_0x559264,null))['catch'](handleError(_0x559264,null));}; \ No newline at end of file +var _0xc6ac=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','describe','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','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','UserProfileResource','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4669d6,_0x1afcc7){_0x4669d6=_0x4669d6-0x0;var _0x44ef97=_0xc6ac[_0x4669d6];return _0x44ef97;};'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'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['UserProfileResource'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));};exports[_0xcc6a('0x4f')]=function(_0x34531d,_0x14f5e5){return db[_0xcc6a('0x2d')]['describe']()['then'](respondWithResult(_0x14f5e5,null))[_0xcc6a('0x4b')](handleError(_0x14f5e5,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index fd44722..c1fc38d 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 _0xb517=['compositeIndex','resourceId','sectionId','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','user_profile_has_resources'];(function(_0x42dd68,_0x3b2dcf){var _0x1578a5=function(_0x599343){while(--_0x599343){_0x42dd68['push'](_0x42dd68['shift']());}};_0x1578a5(++_0x3b2dcf);}(_0xb517,0x177));var _0x7b51=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xb517[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x7b51('0x0'));var util=require('util');var logger=require(_0x7b51('0x1'))('api');var moment=require(_0x7b51('0x2'));var BPromise=require(_0x7b51('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b51('0x4'));var rimraf=require(_0x7b51('0x5'));var config=require(_0x7b51('0x6'));var attributes=require(_0x7b51('0x7'));module['exports']=function(_0x1c196b,_0x5741a5){return _0x1c196b['define']('UserProfileResource',attributes,{'tableName':_0x7b51('0x8'),'paranoid':![],'indexes':[{'name':_0x7b51('0x9'),'fields':[_0x7b51('0xa'),_0x7b51('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8294=['user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports','define','UserProfileResource'];(function(_0x36de1a,_0x6e814){var _0x50eafe=function(_0x74f49f){while(--_0x74f49f){_0x36de1a['push'](_0x36de1a['shift']());}};_0x50eafe(++_0x6e814);}(_0x8294,0x19a));var _0x4829=function(_0x57e3b8,_0x413555){_0x57e3b8=_0x57e3b8-0x0;var _0x1634b2=_0x8294[_0x57e3b8];return _0x1634b2;};'use strict';var _=require(_0x4829('0x0'));var util=require(_0x4829('0x1'));var logger=require(_0x4829('0x2'))(_0x4829('0x3'));var moment=require('moment');var BPromise=require(_0x4829('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4829('0x5'));var rimraf=require('rimraf');var config=require(_0x4829('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x4829('0x7')]=function(_0x583237,_0x5041fa){return _0x583237[_0x4829('0x8')](_0x4829('0x9'),attributes,{'tableName':_0x4829('0xa'),'paranoid':![],'indexes':[{'name':_0x4829('0xb'),'fields':[_0x4829('0xc'),_0x4829('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 3efa0bc..a9c6504 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 _0x8ffc=['info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8ffc,0x197));var _0xc8ff=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x8ffc[_0x35d4e9];return _0x5c2770;};'use strict';var _=require(_0xc8ff('0x0'));var util=require(_0xc8ff('0x1'));var moment=require(_0xc8ff('0x2'));var BPromise=require(_0xc8ff('0x3'));var rs=require(_0xc8ff('0x4'));var fs=require('fs');var Redis=require(_0xc8ff('0x5'));var db=require(_0xc8ff('0x6'))['db'];var utils=require(_0xc8ff('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xc8ff('0x8'));var jayson=require(_0xc8ff('0x9'));var client=jayson[_0xc8ff('0xa')][_0xc8ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27a106,_0x325425,_0x13d302){return new BPromise(function(_0x259769,_0x2e9051){return client['request'](_0x27a106,_0x13d302)[_0xc8ff('0xc')](function(_0x40e0d3){logger[_0xc8ff('0xd')](_0xc8ff('0xe'),_0x325425,_0xc8ff('0xf'));logger[_0xc8ff('0x10')](_0xc8ff('0x11'),_0x325425,_0xc8ff('0xf'),JSON[_0xc8ff('0x12')](_0x40e0d3));if(_0x40e0d3[_0xc8ff('0x13')]){if(_0x40e0d3[_0xc8ff('0x13')]['code']===0x1f4){logger['error'](_0xc8ff('0xe'),_0x325425,_0x40e0d3[_0xc8ff('0x13')][_0xc8ff('0x14')]);return _0x2e9051(_0x40e0d3[_0xc8ff('0x13')][_0xc8ff('0x14')]);}logger['error'](_0xc8ff('0xe'),_0x325425,_0x40e0d3[_0xc8ff('0x13')][_0xc8ff('0x14')]);return _0x259769(_0x40e0d3[_0xc8ff('0x13')][_0xc8ff('0x14')]);}else{logger[_0xc8ff('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x325425,_0xc8ff('0xf'));_0x259769(_0x40e0d3['result'][_0xc8ff('0x14')]);}})['catch'](function(_0x1997ff){logger[_0xc8ff('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x325425,_0x1997ff);_0x2e9051(_0x1997ff);});});} \ No newline at end of file +var _0xbb57=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','error','UserProfileResource,\x20%s,\x20%s','message'];(function(_0x12aa79,_0x11dbf4){var _0x9819d7=function(_0xb215c0){while(--_0xb215c0){_0x12aa79['push'](_0x12aa79['shift']());}};_0x9819d7(++_0x11dbf4);}(_0xbb57,0x105));var _0x7bb5=function(_0x35caf6,_0x2538c8){_0x35caf6=_0x35caf6-0x0;var _0x12eda3=_0xbb57[_0x35caf6];return _0x12eda3;};'use strict';var _=require(_0x7bb5('0x0'));var util=require(_0x7bb5('0x1'));var moment=require(_0x7bb5('0x2'));var BPromise=require('bluebird');var rs=require(_0x7bb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bb5('0x4'))['db'];var utils=require(_0x7bb5('0x5'));var logger=require(_0x7bb5('0x6'))(_0x7bb5('0x7'));var config=require(_0x7bb5('0x8'));var jayson=require(_0x7bb5('0x9'));var client=jayson[_0x7bb5('0xa')][_0x7bb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e2c15,_0x296f59,_0x48ef01){return new BPromise(function(_0x5ae2df,_0x5506e6){return client[_0x7bb5('0xc')](_0x3e2c15,_0x48ef01)['then'](function(_0x231969){logger[_0x7bb5('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x296f59,_0x7bb5('0xe'));logger['debug'](_0x7bb5('0xf'),_0x296f59,_0x7bb5('0xe'),JSON['stringify'](_0x231969));if(_0x231969['error']){if(_0x231969[_0x7bb5('0x10')]['code']===0x1f4){logger[_0x7bb5('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x296f59,_0x231969['error']['message']);return _0x5506e6(_0x231969[_0x7bb5('0x10')]['message']);}logger['error'](_0x7bb5('0x11'),_0x296f59,_0x231969[_0x7bb5('0x10')]['message']);return _0x5ae2df(_0x231969['error'][_0x7bb5('0x12')]);}else{logger[_0x7bb5('0xd')](_0x7bb5('0x11'),_0x296f59,_0x7bb5('0xe'));_0x5ae2df(_0x231969['result']['message']);}})[_0x7bb5('0x13')](function(_0x3fec6f){logger['error'](_0x7bb5('0x11'),_0x296f59,_0x3fec6f);_0x5506e6(_0x3fec6f);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7326745..019e511 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 _0x11d3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x38ad08,_0x471444){var _0x4eac9a=function(_0x55e19c){while(--_0x55e19c){_0x38ad08['push'](_0x38ad08['shift']());}};_0x4eac9a(++_0x471444);}(_0x11d3,0x18a));var _0x311d=function(_0x59e4e3,_0x430f6c){_0x59e4e3=_0x59e4e3-0x0;var _0x54be45=_0x11d3[_0x59e4e3];return _0x54be45;};'use strict';var multer=require(_0x311d('0x0'));var util=require(_0x311d('0x1'));var path=require(_0x311d('0x2'));var timeout=require(_0x311d('0x3'));var express=require(_0x311d('0x4'));var router=express[_0x311d('0x5')]();var fs_extra=require(_0x311d('0x6'));var auth=require(_0x311d('0x7'));var interaction=require(_0x311d('0x8'));var config=require(_0x311d('0x9'));var controller=require('./userProfileSection.controller');router[_0x311d('0xa')]('/',auth['isAuthenticated'](),controller[_0x311d('0xb')]);router[_0x311d('0xa')](_0x311d('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x311d('0xa')]('/:id',auth[_0x311d('0xd')](),controller[_0x311d('0xe')]);router['post']('/',auth[_0x311d('0xd')](),controller[_0x311d('0xf')]);router['put'](_0x311d('0x10'),auth[_0x311d('0xd')](),controller[_0x311d('0x11')]);router[_0x311d('0x12')](_0x311d('0x10'),auth[_0x311d('0xd')](),controller[_0x311d('0x13')]);module[_0x311d('0x14')]=router; \ No newline at end of file +var _0x761a=['post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x2d7226,_0x35edb1){var _0x59b03f=function(_0x45c59a){while(--_0x45c59a){_0x2d7226['push'](_0x2d7226['shift']());}};_0x59b03f(++_0x35edb1);}(_0x761a,0x1d3));var _0xa761=function(_0x4ef8bc,_0x5eb00d){_0x4ef8bc=_0x4ef8bc-0x0;var _0x5d4d56=_0x761a[_0x4ef8bc];return _0x5d4d56;};'use strict';var multer=require(_0xa761('0x0'));var util=require(_0xa761('0x1'));var path=require(_0xa761('0x2'));var timeout=require(_0xa761('0x3'));var express=require(_0xa761('0x4'));var router=express[_0xa761('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa761('0x6'));var interaction=require(_0xa761('0x7'));var config=require(_0xa761('0x8'));var controller=require(_0xa761('0x9'));router[_0xa761('0xa')]('/',auth[_0xa761('0xb')](),controller[_0xa761('0xc')]);router[_0xa761('0xa')](_0xa761('0xd'),auth[_0xa761('0xb')](),controller['describe']);router[_0xa761('0xa')](_0xa761('0xe'),auth['isAuthenticated'](),controller[_0xa761('0xf')]);router[_0xa761('0x10')]('/',auth[_0xa761('0xb')](),controller['create']);router['put'](_0xa761('0xe'),auth[_0xa761('0xb')](),controller[_0xa761('0x11')]);router[_0xa761('0x12')](_0xa761('0xe'),auth['isAuthenticated'](),controller[_0xa761('0x13')]);module[_0xa761('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 724bb4b..62b4cec 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 _0xd4a2=['join','getDataValue','split','sequelize','STRING','BOOLEAN','setDataValue','crudPermissions'];(function(_0x351d50,_0x11da89){var _0x4c8d58=function(_0x274153){while(--_0x274153){_0x351d50['push'](_0x351d50['shift']());}};_0x4c8d58(++_0x11da89);}(_0xd4a2,0x173));var _0x2d4a=function(_0x323582,_0x30f533){_0x323582=_0x323582-0x0;var _0x5bf833=_0xd4a2[_0x323582];return _0x5bf833;};'use strict';var Sequelize=require(_0x2d4a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x2d4a('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x2d4a('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x2d4a('0x1')],'set':function(_0x5d435a){this[_0x2d4a('0x3')](_0x2d4a('0x4'),_0x5d435a?_0x5d435a[_0x2d4a('0x5')](''):[]);},'get':function(){return this[_0x2d4a('0x6')](_0x2d4a('0x4'))?this['getDataValue'](_0x2d4a('0x4'))[_0x2d4a('0x7')](''):[];}}}; \ No newline at end of file +var _0xd4f4=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xccb2fc,_0x55cbd9){_0xccb2fc=_0xccb2fc-0x0;var _0x47d127=_0xd4f4[_0xccb2fc];return _0x47d127;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'name':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x4d4f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d4f('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d4f('0x2')],'set':function(_0x25087a){this[_0x4d4f('0x5')](_0x4d4f('0x6'),_0x25087a?_0x25087a['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x4d4f('0x7')](_0x4d4f('0x6'))[_0x4d4f('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 0bb1141..b86cfba 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 _0xc4ff=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','UserProfileSection','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','length','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring'];(function(_0x355aed,_0x33647e){var _0x122f31=function(_0x349636){while(--_0x349636){_0x355aed['push'](_0x355aed['shift']());}};_0x122f31(++_0x33647e);}(_0xc4ff,0x15f));var _0xfc4f=function(_0x9a470b,_0x2e81dc){_0x9a470b=_0x9a470b-0x0;var _0x884638=_0xc4ff[_0x9a470b];return _0x884638;};'use strict';var emlformat=require(_0xfc4f('0x0'));var rimraf=require(_0xfc4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc4f('0x2'));var rp=require('request-promise');var moment=require(_0xfc4f('0x3'));var BPromise=require(_0xfc4f('0x4'));var Mustache=require(_0xfc4f('0x5'));var util=require('util');var path=require(_0xfc4f('0x6'));var sox=require(_0xfc4f('0x7'));var csv=require(_0xfc4f('0x8'));var ejs=require(_0xfc4f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc4f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc4f('0xb'));var deskjs=require(_0xfc4f('0xc'));var toCsv=require(_0xfc4f('0x8'));var querystring=require(_0xfc4f('0xd'));var Papa=require('papaparse');var Redis=require(_0xfc4f('0xe'));var authService=require(_0xfc4f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfc4f('0x10'));var hardwareService=require(_0xfc4f('0x11'));var logger=require(_0xfc4f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xfc4f('0x13'));var licenseUtil=require(_0xfc4f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x163953,_0xaf6ec3){_0xaf6ec3=_0xaf6ec3||0xcc;return function(_0x58f6b7){if(_0x58f6b7){return _0x163953[_0xfc4f('0x15')](_0xaf6ec3);}return _0x163953[_0xfc4f('0x16')](_0xaf6ec3)[_0xfc4f('0x17')]();};}function respondWithResult(_0x4c36a1,_0x387e52){_0x387e52=_0x387e52||0xc8;return function(_0x21fc2a){if(_0x21fc2a){return _0x4c36a1[_0xfc4f('0x16')](_0x387e52)[_0xfc4f('0x18')](_0x21fc2a);}};}function respondWithFilteredResult(_0x1366ae,_0x1e6227){return function(_0x40386f){if(_0x40386f){var _0x6d827c=typeof _0x1e6227[_0xfc4f('0x19')]===_0xfc4f('0x1a')&&typeof _0x1e6227[_0xfc4f('0x1b')]===_0xfc4f('0x1a');var _0x9a5cdc=_0x40386f[_0xfc4f('0x1c')];var _0x241f36=_0x6d827c?0x0:_0x1e6227[_0xfc4f('0x19')];var _0xe9baa0=_0x6d827c?_0x40386f[_0xfc4f('0x1c')]:_0x1e6227[_0xfc4f('0x19')]+_0x1e6227[_0xfc4f('0x1b')];var _0x52df78;if(_0xe9baa0>=_0x9a5cdc){_0xe9baa0=_0x9a5cdc;_0x52df78=0xc8;}else{_0x52df78=0xce;}_0x1366ae[_0xfc4f('0x16')](_0x52df78);return _0x1366ae[_0xfc4f('0x1d')](_0xfc4f('0x1e'),_0x241f36+'-'+_0xe9baa0+'/'+_0x9a5cdc)[_0xfc4f('0x18')](_0x40386f);}return null;};}function patchUpdates(_0xab72c0){return function(_0x3cea55){try{jsonpatch[_0xfc4f('0x1f')](_0x3cea55,_0xab72c0,!![]);}catch(_0x2b5dbc){return BPromise[_0xfc4f('0x20')](_0x2b5dbc);}return _0x3cea55['save']();};}function saveUpdates(_0x5aa1e0,_0x41dac8){return function(_0x59825a){if(_0x59825a){return _0x59825a[_0xfc4f('0x21')](_0x5aa1e0)[_0xfc4f('0x22')](function(_0x1deed7){return _0x1deed7;});}return null;};}function removeEntity(_0x4d1b36,_0xf7dd2f){return function(_0x430ce8){if(_0x430ce8){return _0x430ce8[_0xfc4f('0x23')]()[_0xfc4f('0x22')](function(){_0x4d1b36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e27e,_0x2cee2b){return function(_0x127885){if(!_0x127885){_0x58e27e[_0xfc4f('0x15')](0x194);}return _0x127885;};}function handleError(_0x23e3db,_0x430f14){_0x430f14=_0x430f14||0x1f4;return function(_0x57907f){logger[_0xfc4f('0x24')](_0x57907f[_0xfc4f('0x25')]);if(_0x57907f[_0xfc4f('0x26')]){delete _0x57907f[_0xfc4f('0x26')];}_0x23e3db[_0xfc4f('0x16')](_0x430f14)['send'](_0x57907f);};}exports[_0xfc4f('0x27')]=function(_0x159535,_0x98dfd2){var _0x3dfccd={},_0x218398={},_0xcd34d3={'count':0x0,'rows':[]};var _0x5b701e=_['map'](db[_0xfc4f('0x28')][_0xfc4f('0x29')],function(_0x54a167){return{'name':_0x54a167[_0xfc4f('0x2a')],'type':_0x54a167[_0xfc4f('0x2b')][_0xfc4f('0x2c')]};});_0x218398['model']=_[_0xfc4f('0x2d')](_0x5b701e,_0xfc4f('0x26'));_0x218398[_0xfc4f('0x2e')]=_[_0xfc4f('0x2f')](_0x159535[_0xfc4f('0x2e')]);_0x218398[_0xfc4f('0x30')]=_[_0xfc4f('0x31')](_0x218398['model'],_0x218398[_0xfc4f('0x2e')]);_0x3dfccd[_0xfc4f('0x32')]=_[_0xfc4f('0x31')](_0x218398[_0xfc4f('0x33')],qs[_0xfc4f('0x34')](_0x159535[_0xfc4f('0x2e')][_0xfc4f('0x34')]));_0x3dfccd[_0xfc4f('0x32')]=_0x3dfccd['attributes']['length']?_0x3dfccd[_0xfc4f('0x32')]:_0x218398[_0xfc4f('0x33')];if(!_0x159535[_0xfc4f('0x2e')][_0xfc4f('0x35')]('nolimit')){_0x3dfccd[_0xfc4f('0x1b')]=qs[_0xfc4f('0x1b')](_0x159535[_0xfc4f('0x2e')][_0xfc4f('0x1b')]);_0x3dfccd[_0xfc4f('0x19')]=qs[_0xfc4f('0x19')](_0x159535['query'][_0xfc4f('0x19')]);}_0x3dfccd[_0xfc4f('0x36')]=qs[_0xfc4f('0x37')](_0x159535['query'][_0xfc4f('0x37')]);_0x3dfccd['where']=qs['filters'](_[_0xfc4f('0x38')](_0x159535[_0xfc4f('0x2e')],_0x218398[_0xfc4f('0x30')]),_0x5b701e);if(_0x159535[_0xfc4f('0x2e')]['filter']){_0x3dfccd[_0xfc4f('0x39')]=_[_0xfc4f('0x3a')](_0x3dfccd[_0xfc4f('0x39')],{'$or':_[_0xfc4f('0x2d')](_0x5b701e,function(_0x19fb79){if(_0x19fb79['type']!==_0xfc4f('0x3b')){var _0x6fcd8d={};_0x6fcd8d[_0x19fb79[_0xfc4f('0x26')]]={'$like':'%'+_0x159535[_0xfc4f('0x2e')][_0xfc4f('0x3c')]+'%'};return _0x6fcd8d;}})});}_0x3dfccd=_[_0xfc4f('0x3a')]({},_0x3dfccd,_0x159535['options']);var _0x302a75={'where':_0x3dfccd[_0xfc4f('0x39')]};return db[_0xfc4f('0x28')][_0xfc4f('0x1c')](_0x302a75)[_0xfc4f('0x22')](function(_0x3d9450){_0xcd34d3[_0xfc4f('0x1c')]=_0x3d9450;if(_0x159535[_0xfc4f('0x2e')]['includeAll']){_0x3dfccd[_0xfc4f('0x3d')]=[{'all':!![]}];}return db[_0xfc4f('0x28')][_0xfc4f('0x3e')](_0x3dfccd);})[_0xfc4f('0x22')](function(_0x597b83){_0xcd34d3[_0xfc4f('0x3f')]=_0x597b83;return _0xcd34d3;})[_0xfc4f('0x22')](respondWithFilteredResult(_0x98dfd2,_0x3dfccd))[_0xfc4f('0x40')](handleError(_0x98dfd2,null));};exports[_0xfc4f('0x41')]=function(_0x28557a,_0x27b96d){var _0x1d144f={'raw':![],'where':{'id':_0x28557a[_0xfc4f('0x42')]['id']}},_0x4f1d1c={};_0x4f1d1c['model']=_[_0xfc4f('0x2f')](db[_0xfc4f('0x28')][_0xfc4f('0x29')]);_0x4f1d1c['query']=_[_0xfc4f('0x2f')](_0x28557a[_0xfc4f('0x2e')]);_0x4f1d1c[_0xfc4f('0x30')]=_[_0xfc4f('0x31')](_0x4f1d1c['model'],_0x4f1d1c[_0xfc4f('0x2e')]);_0x1d144f[_0xfc4f('0x32')]=_[_0xfc4f('0x31')](_0x4f1d1c[_0xfc4f('0x33')],qs['fields'](_0x28557a[_0xfc4f('0x2e')][_0xfc4f('0x34')]));_0x1d144f[_0xfc4f('0x32')]=_0x1d144f['attributes'][_0xfc4f('0x43')]?_0x1d144f[_0xfc4f('0x32')]:_0x4f1d1c[_0xfc4f('0x33')];if(_0x28557a[_0xfc4f('0x2e')]['includeAll']){_0x1d144f[_0xfc4f('0x3d')]=[{'all':!![]}];}_0x1d144f=_['merge']({},_0x1d144f,_0x28557a[_0xfc4f('0x44')]);return db[_0xfc4f('0x28')]['find'](_0x1d144f)[_0xfc4f('0x22')](handleEntityNotFound(_0x27b96d,null))[_0xfc4f('0x22')](respondWithResult(_0x27b96d,null))[_0xfc4f('0x40')](handleError(_0x27b96d,null));};exports['create']=function(_0x1fbdd5,_0x13f6fc){return db[_0xfc4f('0x28')][_0xfc4f('0x45')](_0x1fbdd5[_0xfc4f('0x46')],{})[_0xfc4f('0x22')](respondWithResult(_0x13f6fc,0xc9))['catch'](handleError(_0x13f6fc,null));};exports[_0xfc4f('0x21')]=function(_0x3bacca,_0x481115){if(_0x3bacca[_0xfc4f('0x46')]['id']){delete _0x3bacca[_0xfc4f('0x46')]['id'];}return db['UserProfileSection'][_0xfc4f('0x47')]({'where':{'id':_0x3bacca[_0xfc4f('0x42')]['id']}})[_0xfc4f('0x22')](handleEntityNotFound(_0x481115,null))['then'](saveUpdates(_0x3bacca['body'],null))[_0xfc4f('0x22')](respondWithResult(_0x481115,null))[_0xfc4f('0x40')](handleError(_0x481115,null));};exports['destroy']=function(_0x184dcd,_0x46d478){return db[_0xfc4f('0x28')][_0xfc4f('0x47')]({'where':{'id':_0x184dcd[_0xfc4f('0x42')]['id']}})['then'](handleEntityNotFound(_0x46d478,null))[_0xfc4f('0x22')](removeEntity(_0x46d478,null))['catch'](handleError(_0x46d478,null));};exports['describe']=function(_0x1f6120,_0xc811f8){return db[_0xfc4f('0x28')][_0xfc4f('0x48')]()[_0xfc4f('0x22')](respondWithResult(_0xc811f8,null))['catch'](handleError(_0xc811f8,null));}; \ No newline at end of file +var _0xc654=['sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','intersection','include','find','create','body','destroy','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','error','name','index','UserProfileSection','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc654,0x131));var _0x4c65=function(_0x2e79dd,_0x59fcaf){_0x2e79dd=_0x2e79dd-0x0;var _0x113a76=_0xc654[_0x2e79dd];return _0x113a76;};'use strict';var emlformat=require(_0x4c65('0x0'));var rimraf=require(_0x4c65('0x1'));var zipdir=require(_0x4c65('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4c65('0x3'));var Mustache=require(_0x4c65('0x4'));var util=require('util');var path=require(_0x4c65('0x5'));var sox=require('sox');var csv=require(_0x4c65('0x6'));var ejs=require(_0x4c65('0x7'));var fs=require('fs');var fs_extra=require(_0x4c65('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4c65('0x9'));var jsforce=require(_0x4c65('0xa'));var deskjs=require(_0x4c65('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4c65('0xc'));var Redis=require(_0x4c65('0xd'));var authService=require(_0x4c65('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4c65('0xf'));var hardwareService=require(_0x4c65('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x4c65('0x11'));var config=require(_0x4c65('0x12'));var licenseUtil=require(_0x4c65('0x13'));var db=require(_0x4c65('0x14'))['db'];function respondWithStatusCode(_0xbfc9df,_0x4dbd38){_0x4dbd38=_0x4dbd38||0xcc;return function(_0x1d7315){if(_0x1d7315){return _0xbfc9df[_0x4c65('0x15')](_0x4dbd38);}return _0xbfc9df['status'](_0x4dbd38)[_0x4c65('0x16')]();};}function respondWithResult(_0x9884d2,_0x1c9952){_0x1c9952=_0x1c9952||0xc8;return function(_0x48c5af){if(_0x48c5af){return _0x9884d2['status'](_0x1c9952)[_0x4c65('0x17')](_0x48c5af);}};}function respondWithFilteredResult(_0x4c817f,_0x5242ee){return function(_0x398893){if(_0x398893){var _0x2a81e4=typeof _0x5242ee[_0x4c65('0x18')]===_0x4c65('0x19')&&typeof _0x5242ee[_0x4c65('0x1a')]===_0x4c65('0x19');var _0x32d68f=_0x398893['count'];var _0x5ed7f1=_0x2a81e4?0x0:_0x5242ee[_0x4c65('0x18')];var _0x10e2b=_0x2a81e4?_0x398893[_0x4c65('0x1b')]:_0x5242ee[_0x4c65('0x18')]+_0x5242ee[_0x4c65('0x1a')];var _0x2c989a;if(_0x10e2b>=_0x32d68f){_0x10e2b=_0x32d68f;_0x2c989a=0xc8;}else{_0x2c989a=0xce;}_0x4c817f[_0x4c65('0x1c')](_0x2c989a);return _0x4c817f['set'](_0x4c65('0x1d'),_0x5ed7f1+'-'+_0x10e2b+'/'+_0x32d68f)['json'](_0x398893);}return null;};}function patchUpdates(_0x201f5c){return function(_0x5b5c94){try{jsonpatch[_0x4c65('0x1e')](_0x5b5c94,_0x201f5c,!![]);}catch(_0x21eccc){return BPromise[_0x4c65('0x1f')](_0x21eccc);}return _0x5b5c94[_0x4c65('0x20')]();};}function saveUpdates(_0x2a4a53,_0x3a9189){return function(_0x4a401c){if(_0x4a401c){return _0x4a401c[_0x4c65('0x21')](_0x2a4a53)[_0x4c65('0x22')](function(_0x45a6a8){return _0x45a6a8;});}return null;};}function removeEntity(_0xca52b5,_0x304d8b){return function(_0x398f0c){if(_0x398f0c){return _0x398f0c['destroy']()[_0x4c65('0x22')](function(){_0xca52b5['status'](0xcc)[_0x4c65('0x16')]();});}};}function handleEntityNotFound(_0x120811,_0xfc0d47){return function(_0x10058b){if(!_0x10058b){_0x120811[_0x4c65('0x15')](0x194);}return _0x10058b;};}function handleError(_0x521c0d,_0x1c07a6){_0x1c07a6=_0x1c07a6||0x1f4;return function(_0xefd836){logger[_0x4c65('0x23')](_0xefd836['stack']);if(_0xefd836['name']){delete _0xefd836[_0x4c65('0x24')];}_0x521c0d['status'](_0x1c07a6)['send'](_0xefd836);};}exports[_0x4c65('0x25')]=function(_0x170fbc,_0x3c44d8){var _0x32ec46={},_0x3bdf19={},_0x43899c={'count':0x0,'rows':[]};var _0x464c8f=_['map'](db[_0x4c65('0x26')][_0x4c65('0x27')],function(_0x30e12e){return{'name':_0x30e12e[_0x4c65('0x28')],'type':_0x30e12e[_0x4c65('0x29')]['key']};});_0x3bdf19[_0x4c65('0x2a')]=_['map'](_0x464c8f,'name');_0x3bdf19[_0x4c65('0x2b')]=_['keys'](_0x170fbc[_0x4c65('0x2b')]);_0x3bdf19[_0x4c65('0x2c')]=_['intersection'](_0x3bdf19[_0x4c65('0x2a')],_0x3bdf19['query']);_0x32ec46[_0x4c65('0x2d')]=_['intersection'](_0x3bdf19[_0x4c65('0x2a')],qs[_0x4c65('0x2e')](_0x170fbc[_0x4c65('0x2b')][_0x4c65('0x2e')]));_0x32ec46[_0x4c65('0x2d')]=_0x32ec46['attributes'][_0x4c65('0x2f')]?_0x32ec46[_0x4c65('0x2d')]:_0x3bdf19['model'];if(!_0x170fbc['query'][_0x4c65('0x30')](_0x4c65('0x31'))){_0x32ec46[_0x4c65('0x1a')]=qs['limit'](_0x170fbc[_0x4c65('0x2b')][_0x4c65('0x1a')]);_0x32ec46[_0x4c65('0x18')]=qs[_0x4c65('0x18')](_0x170fbc[_0x4c65('0x2b')][_0x4c65('0x18')]);}_0x32ec46['order']=qs['sort'](_0x170fbc[_0x4c65('0x2b')][_0x4c65('0x32')]);_0x32ec46[_0x4c65('0x33')]=qs['filters'](_[_0x4c65('0x34')](_0x170fbc[_0x4c65('0x2b')],_0x3bdf19[_0x4c65('0x2c')]),_0x464c8f);if(_0x170fbc[_0x4c65('0x2b')]['filter']){_0x32ec46[_0x4c65('0x33')]=_[_0x4c65('0x35')](_0x32ec46['where'],{'$or':_[_0x4c65('0x36')](_0x464c8f,function(_0x1a33b5){if(_0x1a33b5['type']!==_0x4c65('0x37')){var _0x1c101a={};_0x1c101a[_0x1a33b5[_0x4c65('0x24')]]={'$like':'%'+_0x170fbc['query'][_0x4c65('0x38')]+'%'};return _0x1c101a;}})});}_0x32ec46=_[_0x4c65('0x35')]({},_0x32ec46,_0x170fbc[_0x4c65('0x39')]);var _0x105f78={'where':_0x32ec46[_0x4c65('0x33')]};return db['UserProfileSection'][_0x4c65('0x1b')](_0x105f78)[_0x4c65('0x22')](function(_0x61780){_0x43899c['count']=_0x61780;if(_0x170fbc[_0x4c65('0x2b')][_0x4c65('0x3a')]){_0x32ec46['include']=[{'all':!![]}];}return db[_0x4c65('0x26')][_0x4c65('0x3b')](_0x32ec46);})[_0x4c65('0x22')](function(_0x5f0d0f){_0x43899c[_0x4c65('0x3c')]=_0x5f0d0f;return _0x43899c;})[_0x4c65('0x22')](respondWithFilteredResult(_0x3c44d8,_0x32ec46))[_0x4c65('0x3d')](handleError(_0x3c44d8,null));};exports[_0x4c65('0x3e')]=function(_0x418005,_0x1755a0){var _0x1bcc91={'raw':![],'where':{'id':_0x418005[_0x4c65('0x3f')]['id']}},_0x80d5de={};_0x80d5de[_0x4c65('0x2a')]=_[_0x4c65('0x40')](db[_0x4c65('0x26')][_0x4c65('0x27')]);_0x80d5de['query']=_[_0x4c65('0x40')](_0x418005[_0x4c65('0x2b')]);_0x80d5de[_0x4c65('0x2c')]=_['intersection'](_0x80d5de['model'],_0x80d5de[_0x4c65('0x2b')]);_0x1bcc91[_0x4c65('0x2d')]=_[_0x4c65('0x41')](_0x80d5de[_0x4c65('0x2a')],qs[_0x4c65('0x2e')](_0x418005['query']['fields']));_0x1bcc91['attributes']=_0x1bcc91[_0x4c65('0x2d')]['length']?_0x1bcc91['attributes']:_0x80d5de[_0x4c65('0x2a')];if(_0x418005['query']['includeAll']){_0x1bcc91[_0x4c65('0x42')]=[{'all':!![]}];}_0x1bcc91=_[_0x4c65('0x35')]({},_0x1bcc91,_0x418005['options']);return db[_0x4c65('0x26')][_0x4c65('0x43')](_0x1bcc91)[_0x4c65('0x22')](handleEntityNotFound(_0x1755a0,null))['then'](respondWithResult(_0x1755a0,null))['catch'](handleError(_0x1755a0,null));};exports[_0x4c65('0x44')]=function(_0x56f2e8,_0x5c0808){return db[_0x4c65('0x26')][_0x4c65('0x44')](_0x56f2e8[_0x4c65('0x45')],{})[_0x4c65('0x22')](respondWithResult(_0x5c0808,0xc9))[_0x4c65('0x3d')](handleError(_0x5c0808,null));};exports['update']=function(_0x49f316,_0x59a78b){if(_0x49f316[_0x4c65('0x45')]['id']){delete _0x49f316[_0x4c65('0x45')]['id'];}return db[_0x4c65('0x26')]['find']({'where':{'id':_0x49f316[_0x4c65('0x3f')]['id']}})[_0x4c65('0x22')](handleEntityNotFound(_0x59a78b,null))['then'](saveUpdates(_0x49f316[_0x4c65('0x45')],null))[_0x4c65('0x22')](respondWithResult(_0x59a78b,null))['catch'](handleError(_0x59a78b,null));};exports[_0x4c65('0x46')]=function(_0xd40bc6,_0x2070e7){return db['UserProfileSection'][_0x4c65('0x43')]({'where':{'id':_0xd40bc6[_0x4c65('0x3f')]['id']}})[_0x4c65('0x22')](handleEntityNotFound(_0x2070e7,null))[_0x4c65('0x22')](removeEntity(_0x2070e7,null))['catch'](handleError(_0x2070e7,null));};exports['describe']=function(_0x59ad40,_0x1242b9){return db[_0x4c65('0x26')]['describe']()[_0x4c65('0x22')](respondWithResult(_0x1242b9,null))[_0x4c65('0x3d')](handleError(_0x1242b9,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index c580053..fef666e 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 _0x2732=['moment','request-promise','path','rimraf','../../config/environment','exports','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','util','api'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0x2732,0x112));var _0x2273=function(_0x5f03e8,_0x33075e){_0x5f03e8=_0x5f03e8-0x0;var _0x5d9c9c=_0x2732[_0x5f03e8];return _0x5d9c9c;};'use strict';var _=require('lodash');var util=require(_0x2273('0x0'));var logger=require('../../config/logger')(_0x2273('0x1'));var moment=require(_0x2273('0x2'));var BPromise=require('bluebird');var rp=require(_0x2273('0x3'));var fs=require('fs');var path=require(_0x2273('0x4'));var rimraf=require(_0x2273('0x5'));var config=require(_0x2273('0x6'));var attributes=require('./userProfileSection.attributes');module[_0x2273('0x7')]=function(_0x3c1940,_0xbe1a19){return _0x3c1940['define'](_0x2273('0x8'),attributes,{'tableName':_0x2273('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x2273('0xa'),_0x2273('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc871=['exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc871,0x164));var _0x1c87=function(_0x3c0083,_0x76a45a){_0x3c0083=_0x3c0083-0x0;var _0x362617=_0xc871[_0x3c0083];return _0x362617;};'use strict';var _=require(_0x1c87('0x0'));var util=require(_0x1c87('0x1'));var logger=require(_0x1c87('0x2'))('api');var moment=require(_0x1c87('0x3'));var BPromise=require(_0x1c87('0x4'));var rp=require(_0x1c87('0x5'));var fs=require('fs');var path=require(_0x1c87('0x6'));var rimraf=require('rimraf');var config=require(_0x1c87('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x1c87('0x8')]=function(_0x18bc77,_0x1e24cb){return _0x18bc77['define'](_0x1c87('0x9'),attributes,{'tableName':_0x1c87('0xa'),'paranoid':![],'indexes':[{'name':_0x1c87('0xb'),'fields':[_0x1c87('0xc'),_0x1c87('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 85ec766..0f245d1 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 _0xef6d=['stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x51d691,_0x559a81){var _0x564552=function(_0x192dc8){while(--_0x192dc8){_0x51d691['push'](_0x51d691['shift']());}};_0x564552(++_0x559a81);}(_0xef6d,0x12c));var _0xdef6=function(_0x77149d,_0x2e8d8a){_0x77149d=_0x77149d-0x0;var _0x86e543=_0xef6d[_0x77149d];return _0x86e543;};'use strict';var _=require('lodash');var util=require(_0xdef6('0x0'));var moment=require(_0xdef6('0x1'));var BPromise=require('bluebird');var rs=require(_0xdef6('0x2'));var fs=require('fs');var Redis=require(_0xdef6('0x3'));var db=require(_0xdef6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdef6('0x5'))(_0xdef6('0x6'));var config=require(_0xdef6('0x7'));var jayson=require(_0xdef6('0x8'));var client=jayson['client'][_0xdef6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35b512,_0x2401f8,_0x1a5979){return new BPromise(function(_0x4f7f24,_0x39e6cf){return client['request'](_0x35b512,_0x1a5979)[_0xdef6('0xa')](function(_0x2194b2){logger[_0xdef6('0xb')](_0xdef6('0xc'),_0x2401f8,_0xdef6('0xd'));logger[_0xdef6('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2401f8,_0xdef6('0xd'),JSON[_0xdef6('0xf')](_0x2194b2));if(_0x2194b2[_0xdef6('0x10')]){if(_0x2194b2[_0xdef6('0x10')][_0xdef6('0x11')]===0x1f4){logger[_0xdef6('0x10')](_0xdef6('0xc'),_0x2401f8,_0x2194b2['error'][_0xdef6('0x12')]);return _0x39e6cf(_0x2194b2[_0xdef6('0x10')][_0xdef6('0x12')]);}logger[_0xdef6('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x2401f8,_0x2194b2[_0xdef6('0x10')]['message']);return _0x4f7f24(_0x2194b2[_0xdef6('0x10')]['message']);}else{logger[_0xdef6('0xb')](_0xdef6('0xc'),_0x2401f8,_0xdef6('0xd'));_0x4f7f24(_0x2194b2[_0xdef6('0x13')][_0xdef6('0x12')]);}})[_0xdef6('0x14')](function(_0x477eb7){logger[_0xdef6('0x10')](_0xdef6('0xc'),_0x2401f8,_0x477eb7);_0x39e6cf(_0x477eb7);});});} \ No newline at end of file +var _0xb55c=['request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','client','http'];(function(_0x7f0c96,_0x2f5107){var _0x2afa3f=function(_0x3e3709){while(--_0x3e3709){_0x7f0c96['push'](_0x7f0c96['shift']());}};_0x2afa3f(++_0x2f5107);}(_0xb55c,0x187));var _0xcb55=function(_0x10413d,_0x39ceb2){_0x10413d=_0x10413d-0x0;var _0x26c937=_0xb55c[_0x10413d];return _0x26c937;};'use strict';var _=require(_0xcb55('0x0'));var util=require(_0xcb55('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb55('0x2'));var fs=require('fs');var Redis=require(_0xcb55('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcb55('0x4'));var logger=require(_0xcb55('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcb55('0x6')][_0xcb55('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e38d5,_0x265280,_0x50ccb9){return new BPromise(function(_0xda320a,_0x58a244){return client[_0xcb55('0x8')](_0x4e38d5,_0x50ccb9)[_0xcb55('0x9')](function(_0x31f383){logger['info'](_0xcb55('0xa'),_0x265280,_0xcb55('0xb'));logger['debug'](_0xcb55('0xc'),_0x265280,'request\x20sent',JSON['stringify'](_0x31f383));if(_0x31f383[_0xcb55('0xd')]){if(_0x31f383['error'][_0xcb55('0xe')]===0x1f4){logger[_0xcb55('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x265280,_0x31f383[_0xcb55('0xd')][_0xcb55('0xf')]);return _0x58a244(_0x31f383[_0xcb55('0xd')][_0xcb55('0xf')]);}logger[_0xcb55('0xd')](_0xcb55('0xa'),_0x265280,_0x31f383[_0xcb55('0xd')][_0xcb55('0xf')]);return _0xda320a(_0x31f383[_0xcb55('0xd')]['message']);}else{logger[_0xcb55('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x265280,'request\x20sent');_0xda320a(_0x31f383[_0xcb55('0x11')]['message']);}})[_0xcb55('0x12')](function(_0x263aa2){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x265280,_0x263aa2);_0x58a244(_0x263aa2);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 5261ab2..c2a157f 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x34882f,_0x601a99){var _0x455929=function(_0x463c7c){while(--_0x463c7c){_0x34882f['push'](_0x34882f['shift']());}};_0x455929(++_0x601a99);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5cf516,_0x407555){var _0x55d480=function(_0x46f364){while(--_0x46f364){_0x5cf516['push'](_0x5cf516['shift']());}};_0x55d480(++_0x407555);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0xcb91[_0x35e75a];return _0xb23c7f;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 9e3b606..fbd0059 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 _0xbd06=['exports','INTEGER'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbd06,0x98));var _0x6bd0=function(_0x38313f,_0x31f6ab){_0x38313f=_0x38313f-0x0;var _0x3255c8=_0xbd06[_0x38313f];return _0x3255c8;};'use strict';var Sequelize=require('sequelize');module[_0x6bd0('0x0')]={'penalty':{'type':Sequelize[_0x6bd0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf23c=['INTEGER'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf23c,0x113));var _0xcf23=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xf23c[_0x4a8bad];return _0x30cf32;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xcf23('0x0')],'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 bf7c5a6..e965783 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 _0x964b=['util','api','moment','bluebird','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x38e870,_0x3d2e6a){var _0x2dabbe=function(_0x3ddea3){while(--_0x3ddea3){_0x38e870['push'](_0x38e870['shift']());}};_0x2dabbe(++_0x3d2e6a);}(_0x964b,0x112));var _0xb964=function(_0x2577ab,_0x29d56d){_0x2577ab=_0x2577ab-0x0;var _0x3185a6=_0x964b[_0x2577ab];return _0x3185a6;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var logger=require('../../config/logger')(_0xb964('0x2'));var moment=require(_0xb964('0x3'));var BPromise=require(_0xb964('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb964('0x5'));var config=require('../../config/environment');var attributes=require(_0xb964('0x6'));module[_0xb964('0x7')]=function(_0xba9f19,_0x11a0c1){return _0xba9f19[_0xb964('0x8')](_0xb964('0x9'),attributes,{'tableName':_0xb964('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7de=['define','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userSmsQueue.attributes','exports'];(function(_0x5670b2,_0x247622){var _0x287d48=function(_0x142573){while(--_0x142573){_0x5670b2['push'](_0x5670b2['shift']());}};_0x287d48(++_0x247622);}(_0xb7de,0xc7));var _0xeb7d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb7de[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var logger=require(_0xeb7d('0x2'))('api');var moment=require(_0xeb7d('0x3'));var BPromise=require(_0xeb7d('0x4'));var rp=require(_0xeb7d('0x5'));var fs=require('fs');var path=require(_0xeb7d('0x6'));var rimraf=require(_0xeb7d('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb7d('0x8'));module[_0xeb7d('0x9')]=function(_0xadf4,_0x433c32){return _0xadf4[_0xeb7d('0xa')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index c1d432c..920fc0b 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 _0x7f9c=['message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x36a6e6,_0x189ec4){var _0x4559d6=function(_0x93da28){while(--_0x93da28){_0x36a6e6['push'](_0x36a6e6['shift']());}};_0x4559d6(++_0x189ec4);}(_0x7f9c,0x1cf));var _0xc7f9=function(_0x18f702,_0x354b61){_0x18f702=_0x18f702-0x0;var _0xe37bad=_0x7f9c[_0x18f702];return _0xe37bad;};'use strict';var _=require(_0xc7f9('0x0'));var util=require(_0xc7f9('0x1'));var moment=require(_0xc7f9('0x2'));var BPromise=require('bluebird');var rs=require(_0xc7f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7f9('0x4'))['db'];var utils=require(_0xc7f9('0x5'));var logger=require(_0xc7f9('0x6'))(_0xc7f9('0x7'));var config=require(_0xc7f9('0x8'));var jayson=require(_0xc7f9('0x9'));var client=jayson[_0xc7f9('0xa')][_0xc7f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bf291,_0x181929,_0x5736dd){return new BPromise(function(_0x320cc7,_0x2d8cae){return client[_0xc7f9('0xc')](_0x4bf291,_0x5736dd)[_0xc7f9('0xd')](function(_0x31ab01){logger[_0xc7f9('0xe')](_0xc7f9('0xf'),_0x181929,_0xc7f9('0x10'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x181929,_0xc7f9('0x10'),JSON[_0xc7f9('0x11')](_0x31ab01));if(_0x31ab01[_0xc7f9('0x12')]){if(_0x31ab01[_0xc7f9('0x12')][_0xc7f9('0x13')]===0x1f4){logger[_0xc7f9('0x12')](_0xc7f9('0xf'),_0x181929,_0x31ab01[_0xc7f9('0x12')][_0xc7f9('0x14')]);return _0x2d8cae(_0x31ab01[_0xc7f9('0x12')][_0xc7f9('0x14')]);}logger[_0xc7f9('0x12')](_0xc7f9('0xf'),_0x181929,_0x31ab01[_0xc7f9('0x12')][_0xc7f9('0x14')]);return _0x320cc7(_0x31ab01['error'][_0xc7f9('0x14')]);}else{logger[_0xc7f9('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x181929,_0xc7f9('0x10'));_0x320cc7(_0x31ab01[_0xc7f9('0x15')][_0xc7f9('0x14')]);}})[_0xc7f9('0x16')](function(_0x4d9e9a){logger['error'](_0xc7f9('0xf'),_0x181929,_0x4d9e9a);_0x2d8cae(_0x4d9e9a);});});} \ No newline at end of file +var _0x4829=['../../config/logger','rpc','jayson/promise','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xbd703,_0x3253a6){var _0x12d984=function(_0x5b47f1){while(--_0x5b47f1){_0xbd703['push'](_0xbd703['shift']());}};_0x12d984(++_0x3253a6);}(_0x4829,0xbf));var _0x9482=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4829[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x9482('0x0'));var util=require(_0x9482('0x1'));var moment=require(_0x9482('0x2'));var BPromise=require('bluebird');var rs=require(_0x9482('0x3'));var fs=require('fs');var Redis=require(_0x9482('0x4'));var db=require(_0x9482('0x5'))['db'];var utils=require(_0x9482('0x6'));var logger=require(_0x9482('0x7'))(_0x9482('0x8'));var config=require('../../config/environment');var jayson=require(_0x9482('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x358381,_0x14cc7a,_0xb5b5df){return new BPromise(function(_0x373203,_0x3838d0){return client[_0x9482('0xa')](_0x358381,_0xb5b5df)[_0x9482('0xb')](function(_0x80b8f7){logger['info'](_0x9482('0xc'),_0x14cc7a,_0x9482('0xd'));logger[_0x9482('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x14cc7a,_0x9482('0xd'),JSON[_0x9482('0xf')](_0x80b8f7));if(_0x80b8f7['error']){if(_0x80b8f7[_0x9482('0x10')][_0x9482('0x11')]===0x1f4){logger[_0x9482('0x10')](_0x9482('0xc'),_0x14cc7a,_0x80b8f7[_0x9482('0x10')]['message']);return _0x3838d0(_0x80b8f7[_0x9482('0x10')][_0x9482('0x12')]);}logger['error'](_0x9482('0xc'),_0x14cc7a,_0x80b8f7[_0x9482('0x10')]['message']);return _0x373203(_0x80b8f7[_0x9482('0x10')][_0x9482('0x12')]);}else{logger[_0x9482('0x13')](_0x9482('0xc'),_0x14cc7a,_0x9482('0xd'));_0x373203(_0x80b8f7[_0x9482('0x14')]['message']);}})[_0x9482('0x15')](function(_0x16b33b){logger[_0x9482('0x10')](_0x9482('0xc'),_0x14cc7a,_0x16b33b);_0x3838d0(_0x16b33b);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index ee8c271..ed1e765 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 _0x9f2c=['exports','INTEGER','sequelize'];(function(_0x52af3f,_0x254cd8){var _0x4d496a=function(_0x2f8d40){while(--_0x2f8d40){_0x52af3f['push'](_0x52af3f['shift']());}};_0x4d496a(++_0x254cd8);}(_0x9f2c,0x155));var _0xc9f2=function(_0x58b900,_0x4067f4){_0x58b900=_0x58b900-0x0;var _0x142565=_0x9f2c[_0x58b900];return _0x142565;};'use strict';var Sequelize=require(_0xc9f2('0x0'));module[_0xc9f2('0x1')]={'UserId':{'type':Sequelize[_0xc9f2('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfd47=['INTEGER','exports'];(function(_0x4b1e43,_0x554b63){var _0x6e1fb7=function(_0x3fc750){while(--_0x3fc750){_0x4b1e43['push'](_0x4b1e43['shift']());}};_0x6e1fb7(++_0x554b63);}(_0xfd47,0xa9));var _0x7fd4=function(_0xe6830f,_0x40d9a8){_0xe6830f=_0xe6830f-0x0;var _0x234da9=_0xfd47[_0xe6830f];return _0x234da9;};'use strict';var Sequelize=require('sequelize');module[_0x7fd4('0x0')]={'UserId':{'type':Sequelize[_0x7fd4('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7fd4('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 2bd6282..6325083 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(_0x170b55,_0xf3245a){var _0x23e3c0=function(_0x2d6dea){while(--_0x2d6dea){_0x170b55['push'](_0x170b55['shift']());}};_0x23e3c0(++_0xf3245a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x2bd6a4,_0x5b3487){var _0x3f4976=function(_0x588b81){while(--_0x588b81){_0x2bd6a4['push'](_0x2bd6a4['shift']());}};_0x3f4976(++_0x5b3487);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 5bbf251..fafa182 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x56e6c6,_0x4486ce){var _0x21547e=function(_0x5f0730){while(--_0x5f0730){_0x56e6c6['push'](_0x56e6c6['shift']());}};_0x21547e(++_0x4486ce);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47195e,_0x347734){var _0x571abb=function(_0x3574ad){while(--_0x3574ad){_0x47195e['push'](_0x47195e['shift']());}};_0x571abb(++_0x347734);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 749559c..102b991 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 _0x2080=['sequelize','exports'];(function(_0x504221,_0x59d9a9){var _0x114c4e=function(_0x3ce03f){while(--_0x3ce03f){_0x504221['push'](_0x504221['shift']());}};_0x114c4e(++_0x59d9a9);}(_0x2080,0x1c6));var _0x0208=function(_0x3abf39,_0x2a8ca5){_0x3abf39=_0x3abf39-0x0;var _0x447491=_0x2080[_0x3abf39];return _0x447491;};'use strict';var Sequelize=require(_0x0208('0x0'));module[_0x0208('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd086=['sequelize','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd086,0x1da));var _0x6d08=function(_0xb5db5a,_0x2aee49){_0xb5db5a=_0xb5db5a-0x0;var _0x56218a=_0xd086[_0xb5db5a];return _0x56218a;};'use strict';var Sequelize=require(_0x6d08('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6d08('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 491648b..91a71ff 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 _0xe7f5=['request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4933b3,_0x34d834){var _0x1f81c1=function(_0x582fd9){while(--_0x582fd9){_0x4933b3['push'](_0x4933b3['shift']());}};_0x1f81c1(++_0x34d834);}(_0xe7f5,0x97));var _0x5e7f=function(_0x4c462e,_0x4bd48c){_0x4c462e=_0x4c462e-0x0;var _0x5133cd=_0xe7f5[_0x4c462e];return _0x5133cd;};'use strict';var _=require(_0x5e7f('0x0'));var util=require('util');var logger=require(_0x5e7f('0x1'))(_0x5e7f('0x2'));var moment=require(_0x5e7f('0x3'));var BPromise=require(_0x5e7f('0x4'));var rp=require(_0x5e7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e7f('0x6'));var config=require(_0x5e7f('0x7'));var attributes=require(_0x5e7f('0x8'));module['exports']=function(_0x59ba22,_0x44192e){return _0x59ba22[_0x5e7f('0x9')](_0x5e7f('0xa'),attributes,{'tableName':_0x5e7f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1e6=['bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x786e9,_0x1a029){var _0x1f891b=function(_0x31ad7c){while(--_0x31ad7c){_0x786e9['push'](_0x786e9['shift']());}};_0x1f891b(++_0x1a029);}(_0xe1e6,0xf2));var _0x6e1e=function(_0x436b5f,_0xaede2d){_0x436b5f=_0x436b5f-0x0;var _0x11f0da=_0xe1e6[_0x436b5f];return _0x11f0da;};'use strict';var _=require(_0x6e1e('0x0'));var util=require(_0x6e1e('0x1'));var logger=require(_0x6e1e('0x2'))(_0x6e1e('0x3'));var moment=require(_0x6e1e('0x4'));var BPromise=require(_0x6e1e('0x5'));var rp=require(_0x6e1e('0x6'));var fs=require('fs');var path=require(_0x6e1e('0x7'));var rimraf=require('rimraf');var config=require(_0x6e1e('0x8'));var attributes=require(_0x6e1e('0x9'));module[_0x6e1e('0xa')]=function(_0x3bf05e,_0x5c4e77){return _0x3bf05e[_0x6e1e('0xb')]('UserVoiceQueue',attributes,{'tableName':_0x6e1e('0xc'),'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 f9c31df..587aa55 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 _0xfe43=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfe43,0x166));var _0x3fe4=function(_0x3c918a,_0x5ef50e){_0x3c918a=_0x3c918a-0x0;var _0x480bf3=_0xfe43[_0x3c918a];return _0x480bf3;};'use strict';var _=require(_0x3fe4('0x0'));var util=require(_0x3fe4('0x1'));var moment=require(_0x3fe4('0x2'));var BPromise=require(_0x3fe4('0x3'));var rs=require(_0x3fe4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fe4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fe4('0x6'))(_0x3fe4('0x7'));var config=require(_0x3fe4('0x8'));var jayson=require(_0x3fe4('0x9'));var client=jayson[_0x3fe4('0xa')][_0x3fe4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ca5bb,_0x20db9b,_0x20ee5c){return new BPromise(function(_0x49c5d0,_0x4dccbe){return client[_0x3fe4('0xc')](_0x5ca5bb,_0x20ee5c)[_0x3fe4('0xd')](function(_0x4b7cfa){logger[_0x3fe4('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x20db9b,_0x3fe4('0xf'));logger['debug'](_0x3fe4('0x10'),_0x20db9b,_0x3fe4('0xf'),JSON['stringify'](_0x4b7cfa));if(_0x4b7cfa[_0x3fe4('0x11')]){if(_0x4b7cfa[_0x3fe4('0x11')]['code']===0x1f4){logger[_0x3fe4('0x11')](_0x3fe4('0x12'),_0x20db9b,_0x4b7cfa[_0x3fe4('0x11')][_0x3fe4('0x13')]);return _0x4dccbe(_0x4b7cfa['error'][_0x3fe4('0x13')]);}logger[_0x3fe4('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x20db9b,_0x4b7cfa[_0x3fe4('0x11')][_0x3fe4('0x13')]);return _0x49c5d0(_0x4b7cfa[_0x3fe4('0x11')]['message']);}else{logger[_0x3fe4('0xe')](_0x3fe4('0x12'),_0x20db9b,_0x3fe4('0xf'));_0x49c5d0(_0x4b7cfa[_0x3fe4('0x14')][_0x3fe4('0x13')]);}})[_0x3fe4('0x15')](function(_0x56d8e3){logger[_0x3fe4('0x11')](_0x3fe4('0x12'),_0x20db9b,_0x56d8e3);_0x4dccbe(_0x56d8e3);});});} \ No newline at end of file +var _0x81f9=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x424ebf,_0x4c64d3){var _0x4c6aef=function(_0x3e17eb){while(--_0x3e17eb){_0x424ebf['push'](_0x424ebf['shift']());}};_0x4c6aef(++_0x4c64d3);}(_0x81f9,0x1b5));var _0x981f=function(_0x2a217b,_0xb039df){_0x2a217b=_0x2a217b-0x0;var _0x29a6ac=_0x81f9[_0x2a217b];return _0x29a6ac;};'use strict';var _=require('lodash');var util=require(_0x981f('0x0'));var moment=require(_0x981f('0x1'));var BPromise=require(_0x981f('0x2'));var rs=require(_0x981f('0x3'));var fs=require('fs');var Redis=require(_0x981f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x981f('0x5'));var logger=require(_0x981f('0x6'))(_0x981f('0x7'));var config=require(_0x981f('0x8'));var jayson=require(_0x981f('0x9'));var client=jayson['client'][_0x981f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x70292,_0xa8d5dd,_0x26d693){return new BPromise(function(_0x18c2b6,_0x3828ba){return client[_0x981f('0xb')](_0x70292,_0x26d693)[_0x981f('0xc')](function(_0x52e5db){logger[_0x981f('0xd')](_0x981f('0xe'),_0xa8d5dd,_0x981f('0xf'));logger[_0x981f('0x10')](_0x981f('0x11'),_0xa8d5dd,_0x981f('0xf'),JSON['stringify'](_0x52e5db));if(_0x52e5db[_0x981f('0x12')]){if(_0x52e5db[_0x981f('0x12')][_0x981f('0x13')]===0x1f4){logger[_0x981f('0x12')](_0x981f('0xe'),_0xa8d5dd,_0x52e5db[_0x981f('0x12')][_0x981f('0x14')]);return _0x3828ba(_0x52e5db['error'][_0x981f('0x14')]);}logger[_0x981f('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0xa8d5dd,_0x52e5db[_0x981f('0x12')][_0x981f('0x14')]);return _0x18c2b6(_0x52e5db[_0x981f('0x12')][_0x981f('0x14')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0xa8d5dd,'request\x20sent');_0x18c2b6(_0x52e5db[_0x981f('0x15')]['message']);}})[_0x981f('0x16')](function(_0x3cb4d9){logger['error'](_0x981f('0xe'),_0xa8d5dd,_0x3cb4d9);_0x3828ba(_0x3cb4d9);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index ad992a9..654a266 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x292427,_0x5dc5d1){var _0x1e5629=function(_0xeb9913){while(--_0xeb9913){_0x292427['push'](_0x292427['shift']());}};_0x1e5629(++_0x5dc5d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x2dc682,_0x1b3401){var _0x3acf92=function(_0x25089e){while(--_0x25089e){_0x2dc682['push'](_0x2dc682['shift']());}};_0x3acf92(++_0x1b3401);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xcb91[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 9777934..b4f84d9 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 _0xeff1=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0x1cd674,_0x8d3638){var _0x27928f=function(_0x5e3c70){while(--_0x5e3c70){_0x1cd674['push'](_0x1cd674['shift']());}};_0x27928f(++_0x8d3638);}(_0xeff1,0x198));var _0x1eff=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0xeff1[_0x4d8dc3];return _0x9b03d9;};'use strict';var Sequelize=require(_0x1eff('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1eff('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1eff('0x2')},'membername':{'type':Sequelize[_0x1eff('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x1eff('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x1eff('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x1eff('0x3')],'allowNull':![],'unique':_0x1eff('0x4'),'comment':_0x1eff('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x1eff('0x2')},'paused':{'type':Sequelize[_0x1eff('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x88fa=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x44c8a5,_0x49186f){var _0x5c4c0e=function(_0x43fc6d){while(--_0x43fc6d){_0x44c8a5['push'](_0x44c8a5['shift']());}};_0x5c4c0e(++_0x49186f);}(_0x88fa,0x19f));var _0xa88f=function(_0x412572,_0x37e9e2){_0x412572=_0x412572-0x0;var _0x20881f=_0x88fa[_0x412572];return _0x20881f;};'use strict';var Sequelize=require(_0xa88f('0x0'));module[_0xa88f('0x1')]={'uniqueid':{'type':Sequelize[_0xa88f('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa88f('0x3')},'membername':{'type':Sequelize[_0xa88f('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xa88f('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa88f('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xa88f('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xa88f('0x4')],'allowNull':![],'unique':_0xa88f('0x5'),'comment':_0xa88f('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xa88f('0x3')},'paused':{'type':Sequelize[_0xa88f('0x2')](0xb),'defaultValue':0x0,'comment':_0xa88f('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 0ec8efe..5e36689 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 _0xd45f=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','update'];(function(_0x243d5e,_0x23718){var _0x3092c1=function(_0x16cdc3){while(--_0x16cdc3){_0x243d5e['push'](_0x243d5e['shift']());}};_0x3092c1(++_0x23718);}(_0xd45f,0xa4));var _0xfd45=function(_0x39c8ea,_0x53e7c1){_0x39c8ea=_0x39c8ea-0x0;var _0xfa2892=_0xd45f[_0x39c8ea];return _0xfa2892;};'use strict';var EventEmitter=require(_0xfd45('0x0'));var UserVoiceQueueRt=require(_0xfd45('0x1'))['db'][_0xfd45('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfd45('0x3'),'afterDestroy':_0xfd45('0x4')};function emitEvent(_0x51330c){return function(_0x25c3bc,_0xdb2e59,_0x30b508){UserVoiceQueueRtEvents[_0xfd45('0x5')](_0x51330c+':'+_0x25c3bc['id'],_0x25c3bc);UserVoiceQueueRtEvents[_0xfd45('0x5')](_0x51330c,_0x25c3bc);_0x30b508(null);};}for(var e in events){if(events[_0xfd45('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xfd45('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x03a0=['UserVoiceQueueRt','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x359828,_0x5a3f9f){var _0x2a368a=function(_0x460e65){while(--_0x460e65){_0x359828['push'](_0x359828['shift']());}};_0x2a368a(++_0x5a3f9f);}(_0x03a0,0x15f));var _0x003a=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x03a0[_0xd050c6];return _0x7278a;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x003a('0x0'))['db'][_0x003a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x003a('0x2'),'afterUpdate':_0x003a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2abecd){return function(_0x5ab6c0,_0x59a49a,_0xef8dcf){UserVoiceQueueRtEvents['emit'](_0x2abecd+':'+_0x5ab6c0['id'],_0x5ab6c0);UserVoiceQueueRtEvents[_0x003a('0x4')](_0x2abecd,_0x5ab6c0);_0xef8dcf(null);};}for(var e in events){if(events[_0x003a('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x003a('0x6')](e,emitEvent(event));}}module[_0x003a('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 174f5ea..101daca 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 _0x811d=['api','moment','bluebird','request-promise','../../config/environment','exports','define','user_has_voice_queues_rt','util','../../config/logger'];(function(_0x153f57,_0x390473){var _0xe1070b=function(_0x38c04a){while(--_0x38c04a){_0x153f57['push'](_0x153f57['shift']());}};_0xe1070b(++_0x390473);}(_0x811d,0x148));var _0xd811=function(_0x2bac1f,_0x1dba62){_0x2bac1f=_0x2bac1f-0x0;var _0x514736=_0x811d[_0x2bac1f];return _0x514736;};'use strict';var _=require('lodash');var util=require(_0xd811('0x0'));var logger=require(_0xd811('0x1'))(_0xd811('0x2'));var moment=require(_0xd811('0x3'));var BPromise=require(_0xd811('0x4'));var rp=require(_0xd811('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd811('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xd811('0x7')]=function(_0x465607,_0x26a00c){return _0x465607[_0xd811('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0xd811('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fb6=['request-promise','path','./userVoiceQueueRt.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x2fb6,0x165));var _0x62fb=function(_0x1d5823,_0x365410){_0x1d5823=_0x1d5823-0x0;var _0x1a599f=_0x2fb6[_0x1d5823];return _0x1a599f;};'use strict';var _=require(_0x62fb('0x0'));var util=require(_0x62fb('0x1'));var logger=require(_0x62fb('0x2'))(_0x62fb('0x3'));var moment=require(_0x62fb('0x4'));var BPromise=require(_0x62fb('0x5'));var rp=require(_0x62fb('0x6'));var fs=require('fs');var path=require(_0x62fb('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x62fb('0x8'));module[_0x62fb('0x9')]=function(_0x712e1f,_0x5357ef){return _0x712e1f[_0x62fb('0xa')]('UserVoiceQueueRt',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 af6c9ab..62f7d38 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 _0x3bd7=['./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','GetVoiceQueueRtPauses','debug','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter'];(function(_0x276c9f,_0x182acf){var _0x2c9305=function(_0x45bfe6){while(--_0x45bfe6){_0x276c9f['push'](_0x276c9f['shift']());}};_0x2c9305(++_0x182acf);}(_0x3bd7,0x87));var _0x73bd=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0x3bd7[_0x3c4062];return _0x3f5bf3;};'use strict';var _=require(_0x73bd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x73bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x73bd('0x2'));var db=require(_0x73bd('0x3'))['db'];var utils=require(_0x73bd('0x4'));var logger=require(_0x73bd('0x5'))(_0x73bd('0x6'));var config=require(_0x73bd('0x7'));var jayson=require(_0x73bd('0x8'));var client=jayson['client'][_0x73bd('0x9')]({'port':0x232a});config[_0x73bd('0xa')]=_['defaults'](config[_0x73bd('0xa')],{'host':_0x73bd('0xb'),'port':0x18eb});var socket=require(_0x73bd('0xc'))(new Redis(config[_0x73bd('0xa')]));require(_0x73bd('0xd'))[_0x73bd('0xe')](socket);function respondWithRpcPromise(_0x27ea58,_0x3d4568,_0x3692e3){return new BPromise(function(_0x4e8efb,_0x271adf){return client[_0x73bd('0xf')](_0x27ea58,_0x3692e3)[_0x73bd('0x10')](function(_0x4d565b){logger[_0x73bd('0x11')](_0x73bd('0x12'),_0x3d4568,_0x73bd('0x13'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x3d4568,_0x73bd('0x13'),JSON[_0x73bd('0x14')](_0x4d565b));if(_0x4d565b['error']){if(_0x4d565b[_0x73bd('0x15')][_0x73bd('0x16')]===0x1f4){logger[_0x73bd('0x15')](_0x73bd('0x12'),_0x3d4568,_0x4d565b[_0x73bd('0x15')][_0x73bd('0x17')]);return _0x271adf(_0x4d565b[_0x73bd('0x15')][_0x73bd('0x17')]);}logger[_0x73bd('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3d4568,_0x4d565b[_0x73bd('0x15')][_0x73bd('0x17')]);return _0x4e8efb(_0x4d565b[_0x73bd('0x15')][_0x73bd('0x17')]);}else{logger[_0x73bd('0x11')](_0x73bd('0x12'),_0x3d4568,_0x73bd('0x13'));_0x4e8efb(_0x4d565b[_0x73bd('0x18')][_0x73bd('0x17')]);}})['catch'](function(_0x3eeea8){logger[_0x73bd('0x15')](_0x73bd('0x12'),_0x3d4568,_0x3eeea8);_0x271adf(_0x3eeea8);});});}exports['GetVoiceQueueRtPauses']=function(_0x40846d){var _0x2b37a5=this;return new Promise(function(_0x25494b,_0x5e2f35){return db[_0x73bd('0x19')][_0x73bd('0x1a')]({'raw':_0x40846d['options']?_0x40846d[_0x73bd('0x1b')][_0x73bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x40846d['options']?_0x40846d[_0x73bd('0x1b')][_0x73bd('0x1d')]||null:null,'attributes':[[db[_0x73bd('0x1e')]['fn'](_0x73bd('0x1f'),db['sequelize']['fn']('IF',db[_0x73bd('0x1e')][_0x73bd('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),_0x73bd('0x21')]]})['then'](function(_0x1184b8){logger['info'](_0x73bd('0x22'),_0x40846d);logger[_0x73bd('0x23')]('GetVoiceQueueRtPauses',_0x40846d,JSON[_0x73bd('0x14')](_0x1184b8));_0x25494b(_0x1184b8);})[_0x73bd('0x24')](function(_0x3a2d8e){logger[_0x73bd('0x15')](_0x73bd('0x22'),_0x3a2d8e[_0x73bd('0x17')],_0x40846d);_0x5e2f35(_0x2b37a5[_0x73bd('0x15')](0x1f4,_0x3a2d8e[_0x73bd('0x17')]));});});}; \ No newline at end of file +var _0x0a92=['client','http','redis','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','raw','options','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1d13df,_0x2cc45d){var _0x54fd6d=function(_0x51abe8){while(--_0x51abe8){_0x1d13df['push'](_0x1d13df['shift']());}};_0x54fd6d(++_0x2cc45d);}(_0x0a92,0x168));var _0x20a9=function(_0x5d6b41,_0x3d1c8f){_0x5d6b41=_0x5d6b41-0x0;var _0x1c2dd6=_0x0a92[_0x5d6b41];return _0x1c2dd6;};'use strict';var _=require(_0x20a9('0x0'));var util=require(_0x20a9('0x1'));var moment=require(_0x20a9('0x2'));var BPromise=require(_0x20a9('0x3'));var rs=require(_0x20a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x20a9('0x6'))(_0x20a9('0x7'));var config=require(_0x20a9('0x8'));var jayson=require(_0x20a9('0x9'));var client=jayson[_0x20a9('0xa')][_0x20a9('0xb')]({'port':0x232a});config[_0x20a9('0xc')]=_['defaults'](config[_0x20a9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x20a9('0xd'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x20a9('0xe')](socket);function respondWithRpcPromise(_0x3d4054,_0x14786f,_0x2c16e4){return new BPromise(function(_0x5920e7,_0x573c9d){return client[_0x20a9('0xf')](_0x3d4054,_0x2c16e4)[_0x20a9('0x10')](function(_0x428a8){logger[_0x20a9('0x11')](_0x20a9('0x12'),_0x14786f,'request\x20sent');logger[_0x20a9('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x14786f,'request\x20sent',JSON[_0x20a9('0x14')](_0x428a8));if(_0x428a8[_0x20a9('0x15')]){if(_0x428a8[_0x20a9('0x15')][_0x20a9('0x16')]===0x1f4){logger[_0x20a9('0x15')](_0x20a9('0x12'),_0x14786f,_0x428a8[_0x20a9('0x15')][_0x20a9('0x17')]);return _0x573c9d(_0x428a8['error']['message']);}logger['error'](_0x20a9('0x12'),_0x14786f,_0x428a8[_0x20a9('0x15')]['message']);return _0x5920e7(_0x428a8[_0x20a9('0x15')][_0x20a9('0x17')]);}else{logger[_0x20a9('0x11')](_0x20a9('0x12'),_0x14786f,_0x20a9('0x18'));_0x5920e7(_0x428a8[_0x20a9('0x19')][_0x20a9('0x17')]);}})[_0x20a9('0x1a')](function(_0x47604b){logger[_0x20a9('0x15')](_0x20a9('0x12'),_0x14786f,_0x47604b);_0x573c9d(_0x47604b);});});}exports[_0x20a9('0x1b')]=function(_0x499d70){var _0x2e221d=this;return new Promise(function(_0x76b028,_0x3ce387){return db[_0x20a9('0x1c')][_0x20a9('0x1d')]({'raw':_0x499d70['options']?_0x499d70['options'][_0x20a9('0x1e')]===undefined?!![]:![]:!![],'where':_0x499d70[_0x20a9('0x1f')]?_0x499d70['options'][_0x20a9('0x20')]||null:null,'attributes':[[db[_0x20a9('0x21')]['fn'](_0x20a9('0x22'),db[_0x20a9('0x21')]['fn']('IF',db['sequelize'][_0x20a9('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),_0x20a9('0x24')]]})[_0x20a9('0x10')](function(_0x1c1306){logger[_0x20a9('0x11')]('GetVoiceQueueRtPauses',_0x499d70);logger[_0x20a9('0x13')](_0x20a9('0x1b'),_0x499d70,JSON[_0x20a9('0x14')](_0x1c1306));_0x76b028(_0x1c1306);})[_0x20a9('0x1a')](function(_0x5d231e){logger[_0x20a9('0x15')](_0x20a9('0x1b'),_0x5d231e[_0x20a9('0x17')],_0x499d70);_0x3ce387(_0x2e221d[_0x20a9('0x15')](0x1f4,_0x5d231e[_0x20a9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 228f31e..e9746eb 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 _0x3eea=['removeListener','register','length','./userVoiceQueueRt.events','remove','update','emit'];(function(_0x8ef83d,_0x520c3d){var _0x4a4a19=function(_0x189336){while(--_0x189336){_0x8ef83d['push'](_0x8ef83d['shift']());}};_0x4a4a19(++_0x520c3d);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x2846df,_0x278188){_0x2846df=_0x2846df-0x0;var _0x388335=_0x3eea[_0x2846df];return _0x388335;};'use strict';var UserVoiceQueueRtEvents=require(_0xa3ee('0x0'));var events=['save',_0xa3ee('0x1'),_0xa3ee('0x2')];function createListener(_0x16512c,_0x1c6a49){return function(_0x46acfa){_0x1c6a49[_0xa3ee('0x3')](_0x16512c,_0x46acfa);};}function removeListener(_0x104913,_0x35ed7d){return function(){UserVoiceQueueRtEvents[_0xa3ee('0x4')](_0x104913,_0x35ed7d);};}exports[_0xa3ee('0x5')]=function(_0xb93cdb){for(var _0x5776bb=0x0,_0x538bf9=events[_0xa3ee('0x6')];_0x5776bb<_0x538bf9;_0x5776bb++){var _0x4e4588=events[_0x5776bb];var _0x37a3f0=createListener('userVoiceQueueRt:'+_0x4e4588,_0xb93cdb);UserVoiceQueueRtEvents['on'](_0x4e4588,_0x37a3f0);}}; \ No newline at end of file +var _0x6144=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register'];(function(_0x5cb4fc,_0x222fbb){var _0xe29f03=function(_0x14b4a4){while(--_0x14b4a4){_0x5cb4fc['push'](_0x5cb4fc['shift']());}};_0xe29f03(++_0x222fbb);}(_0x6144,0x99));var _0x4614=function(_0x3440c4,_0xb565db){_0x3440c4=_0x3440c4-0x0;var _0x536069=_0x6144[_0x3440c4];return _0x536069;};'use strict';var UserVoiceQueueRtEvents=require(_0x4614('0x0'));var events=[_0x4614('0x1'),_0x4614('0x2'),_0x4614('0x3')];function createListener(_0x56bf24,_0x1db9ab){return function(_0x3b8b58){_0x1db9ab[_0x4614('0x4')](_0x56bf24,_0x3b8b58);};}function removeListener(_0x254bb6,_0x5ac7b6){return function(){UserVoiceQueueRtEvents[_0x4614('0x5')](_0x254bb6,_0x5ac7b6);};}exports[_0x4614('0x6')]=function(_0x40832b){for(var _0x935177=0x0,_0x3d6142=events['length'];_0x935177<_0x3d6142;_0x935177++){var _0x45e5f2=events[_0x935177];var _0x3eb8ea=createListener(_0x4614('0x7')+_0x45e5f2,_0x40832b);UserVoiceQueueRtEvents['on'](_0x45e5f2,_0x3eb8ea);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index dfbeaf8..5df2106 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x34edc6,_0x4a0b01){var _0x5788b1=function(_0x36e634){while(--_0x36e634){_0x34edc6['push'](_0x34edc6['shift']());}};_0x5788b1(++_0x4a0b01);}(_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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x362d16,_0x31c1a2){var _0x5596de=function(_0x3e588b){while(--_0x3e588b){_0x362d16['push'](_0x362d16['shift']());}};_0x5596de(++_0x31c1a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 576c2f2..c7ece3f 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 _0xb19f=['exports','sequelize'];(function(_0x151f00,_0x4ca3a1){var _0x418d9b=function(_0x5c37c7){while(--_0x5c37c7){_0x151f00['push'](_0x151f00['shift']());}};_0x418d9b(++_0x4ca3a1);}(_0xb19f,0x7d));var _0xfb19=function(_0x46a89e,_0x3c223c){_0x46a89e=_0x46a89e-0x0;var _0x50a1e7=_0xb19f[_0x46a89e];return _0x50a1e7;};'use strict';var Sequelize=require(_0xfb19('0x0'));module[_0xfb19('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7e88=['sequelize'];(function(_0x3125f4,_0x2e5641){var _0x2088da=function(_0x3b4e91){while(--_0x3b4e91){_0x3125f4['push'](_0x3125f4['shift']());}};_0x2088da(++_0x2e5641);}(_0x7e88,0x149));var _0x87e8=function(_0x1db10d,_0xb105){_0x1db10d=_0x1db10d-0x0;var _0x23981b=_0x7e88[_0x1db10d];return _0x23981b;};'use strict';var Sequelize=require(_0x87e8('0x0'));module['exports']={'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 d85d841..78d61c3 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 _0x4905=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x4d311e,_0x4715f3){var _0x54fc0a=function(_0x297a15){while(--_0x297a15){_0x4d311e['push'](_0x4d311e['shift']());}};_0x54fc0a(++_0x4715f3);}(_0x4905,0x144));var _0x5490=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x4905[_0x4c7935];return _0x30651d;};'use strict';var _=require(_0x5490('0x0'));var util=require(_0x5490('0x1'));var logger=require(_0x5490('0x2'))('api');var moment=require(_0x5490('0x3'));var BPromise=require('bluebird');var rp=require(_0x5490('0x4'));var fs=require('fs');var path=require(_0x5490('0x5'));var rimraf=require(_0x5490('0x6'));var config=require(_0x5490('0x7'));var attributes=require(_0x5490('0x8'));module['exports']=function(_0xe5d0a0,_0x190571){return _0xe5d0a0[_0x5490('0x9')](_0x5490('0xa'),attributes,{'tableName':_0x5490('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fa3=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue'];(function(_0x4a2581,_0x180153){var _0x3ed126=function(_0x4b2f0c){while(--_0x4b2f0c){_0x4a2581['push'](_0x4a2581['shift']());}};_0x3ed126(++_0x180153);}(_0x3fa3,0xfd));var _0x33fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fa3[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x33fa('0x0'));var logger=require(_0x33fa('0x1'))(_0x33fa('0x2'));var moment=require(_0x33fa('0x3'));var BPromise=require(_0x33fa('0x4'));var rp=require(_0x33fa('0x5'));var fs=require('fs');var path=require(_0x33fa('0x6'));var rimraf=require('rimraf');var config=require(_0x33fa('0x7'));var attributes=require(_0x33fa('0x8'));module[_0x33fa('0x9')]=function(_0x358904,_0x34f4b4){return _0x358904['define'](_0x33fa('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 05a9593..f846827 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 _0xa0ae=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xa0ae,0x155));var _0xea0a=function(_0x533daf,_0x19a7bf){_0x533daf=_0x533daf-0x0;var _0x3c161f=_0xa0ae[_0x533daf];return _0x3c161f;};'use strict';var _=require(_0xea0a('0x0'));var util=require(_0xea0a('0x1'));var moment=require(_0xea0a('0x2'));var BPromise=require(_0xea0a('0x3'));var rs=require(_0xea0a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea0a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xea0a('0x6'))(_0xea0a('0x7'));var config=require(_0xea0a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xea0a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38da46,_0x178729,_0x209d32){return new BPromise(function(_0x5715af,_0xd4ab5e){return client['request'](_0x38da46,_0x209d32)[_0xea0a('0xa')](function(_0x356065){logger[_0xea0a('0xb')](_0xea0a('0xc'),_0x178729,_0xea0a('0xd'));logger[_0xea0a('0xe')](_0xea0a('0xf'),_0x178729,_0xea0a('0xd'),JSON[_0xea0a('0x10')](_0x356065));if(_0x356065['error']){if(_0x356065[_0xea0a('0x11')]['code']===0x1f4){logger[_0xea0a('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x178729,_0x356065[_0xea0a('0x11')][_0xea0a('0x12')]);return _0xd4ab5e(_0x356065[_0xea0a('0x11')][_0xea0a('0x12')]);}logger[_0xea0a('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x178729,_0x356065['error'][_0xea0a('0x12')]);return _0x5715af(_0x356065[_0xea0a('0x11')][_0xea0a('0x12')]);}else{logger[_0xea0a('0xb')](_0xea0a('0xc'),_0x178729,_0xea0a('0xd'));_0x5715af(_0x356065[_0xea0a('0x13')][_0xea0a('0x12')]);}})[_0xea0a('0x14')](function(_0x24fec8){logger[_0xea0a('0x11')](_0xea0a('0xc'),_0x178729,_0x24fec8);_0xd4ab5e(_0x24fec8);});});} \ No newline at end of file +var _0xe733=['../../config/logger','rpc','../../config/environment','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xd058a7,_0x519154){var _0x211a5d=function(_0x459f66){while(--_0x459f66){_0xd058a7['push'](_0xd058a7['shift']());}};_0x211a5d(++_0x519154);}(_0xe733,0xa1));var _0x3e73=function(_0x343285,_0x4cb733){_0x343285=_0x343285-0x0;var _0x7395c1=_0xe733[_0x343285];return _0x7395c1;};'use strict';var _=require(_0x3e73('0x0'));var util=require(_0x3e73('0x1'));var moment=require(_0x3e73('0x2'));var BPromise=require(_0x3e73('0x3'));var rs=require(_0x3e73('0x4'));var fs=require('fs');var Redis=require(_0x3e73('0x5'));var db=require(_0x3e73('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e73('0x7'))(_0x3e73('0x8'));var config=require(_0x3e73('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3e73('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26abaa,_0x3b5a0d,_0x2dcbc7){return new BPromise(function(_0x9ebb71,_0x49ed37){return client[_0x3e73('0xb')](_0x26abaa,_0x2dcbc7)[_0x3e73('0xc')](function(_0x1d197a){logger[_0x3e73('0xd')](_0x3e73('0xe'),_0x3b5a0d,_0x3e73('0xf'));logger[_0x3e73('0x10')](_0x3e73('0x11'),_0x3b5a0d,_0x3e73('0xf'),JSON[_0x3e73('0x12')](_0x1d197a));if(_0x1d197a[_0x3e73('0x13')]){if(_0x1d197a[_0x3e73('0x13')][_0x3e73('0x14')]===0x1f4){logger[_0x3e73('0x13')](_0x3e73('0xe'),_0x3b5a0d,_0x1d197a['error'][_0x3e73('0x15')]);return _0x49ed37(_0x1d197a[_0x3e73('0x13')][_0x3e73('0x15')]);}logger['error'](_0x3e73('0xe'),_0x3b5a0d,_0x1d197a['error'][_0x3e73('0x15')]);return _0x9ebb71(_0x1d197a[_0x3e73('0x13')][_0x3e73('0x15')]);}else{logger[_0x3e73('0xd')](_0x3e73('0xe'),_0x3b5a0d,_0x3e73('0xf'));_0x9ebb71(_0x1d197a[_0x3e73('0x16')][_0x3e73('0x15')]);}})[_0x3e73('0x17')](function(_0x3ed640){logger['error'](_0x3e73('0xe'),_0x3b5a0d,_0x3ed640);_0x49ed37(_0x3ed640);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index a7ee21a..8b05f1a 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 _0xad53=['post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show'];(function(_0x114720,_0x100b90){var _0x482582=function(_0x2998e3){while(--_0x2998e3){_0x114720['push'](_0x114720['shift']());}};_0x482582(++_0x100b90);}(_0xad53,0x1ea));var _0x3ad5=function(_0x58d320,_0x2eaad2){_0x58d320=_0x58d320-0x0;var _0x4357cc=_0xad53[_0x58d320];return _0x4357cc;};'use strict';var multer=require(_0x3ad5('0x0'));var util=require(_0x3ad5('0x1'));var path=require(_0x3ad5('0x2'));var timeout=require(_0x3ad5('0x3'));var express=require(_0x3ad5('0x4'));var router=express[_0x3ad5('0x5')]();var fs_extra=require(_0x3ad5('0x6'));var auth=require(_0x3ad5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3ad5('0x8'));var controller=require(_0x3ad5('0x9'));router[_0x3ad5('0xa')]('/',auth[_0x3ad5('0xb')](),controller[_0x3ad5('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3ad5('0xd')]);router[_0x3ad5('0xe')]('/',auth[_0x3ad5('0xb')](),controller[_0x3ad5('0xf')]);router[_0x3ad5('0x10')](_0x3ad5('0x11'),auth[_0x3ad5('0xb')](),controller[_0x3ad5('0x12')]);router['delete'](_0x3ad5('0x11'),auth[_0x3ad5('0xb')](),controller[_0x3ad5('0x13')]);module[_0x3ad5('0x14')]=router; \ No newline at end of file +var _0x2f72=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x4123a0,_0x8eb7c){var _0x41643c=function(_0x4014f8){while(--_0x4014f8){_0x4123a0['push'](_0x4123a0['shift']());}};_0x41643c(++_0x8eb7c);}(_0x2f72,0x166));var _0x22f7=function(_0x4930c3,_0x1898bd){_0x4930c3=_0x4930c3-0x0;var _0x23911b=_0x2f72[_0x4930c3];return _0x23911b;};'use strict';var multer=require(_0x22f7('0x0'));var util=require(_0x22f7('0x1'));var path=require(_0x22f7('0x2'));var timeout=require(_0x22f7('0x3'));var express=require(_0x22f7('0x4'));var router=express[_0x22f7('0x5')]();var fs_extra=require(_0x22f7('0x6'));var auth=require(_0x22f7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x22f7('0x8'));var controller=require(_0x22f7('0x9'));router[_0x22f7('0xa')]('/',auth[_0x22f7('0xb')](),controller[_0x22f7('0xc')]);router[_0x22f7('0xa')](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller[_0x22f7('0xe')]);router[_0x22f7('0xf')]('/',auth[_0x22f7('0xb')](),controller[_0x22f7('0x10')]);router[_0x22f7('0x11')](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller[_0x22f7('0x12')]);router['delete'](_0x22f7('0xd'),auth[_0x22f7('0xb')](),controller['destroy']);module[_0x22f7('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index c7be544..4103114 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 _0x2c8b=['name','sequelize'];(function(_0x5c6ceb,_0x4ed099){var _0x28821b=function(_0x391add){while(--_0x391add){_0x5c6ceb['push'](_0x5c6ceb['shift']());}};_0x28821b(++_0x4ed099);}(_0x2c8b,0x8b));var _0xb2c8=function(_0x4a4d18,_0x1ba46f){_0x4a4d18=_0x4a4d18-0x0;var _0x48f353=_0x2c8b[_0x4a4d18];return _0x48f353;};'use strict';var Sequelize=require(_0xb2c8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb2c8('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x64f6=['exports','STRING','name','sequelize'];(function(_0x2a5716,_0x4641fb){var _0x1f6916=function(_0x36c524){while(--_0x36c524){_0x2a5716['push'](_0x2a5716['shift']());}};_0x1f6916(++_0x4641fb);}(_0x64f6,0xb3));var _0x664f=function(_0x10f8f3,_0x21e890){_0x10f8f3=_0x10f8f3-0x0;var _0x2d0a23=_0x64f6[_0x10f8f3];return _0x2d0a23;};'use strict';var Sequelize=require(_0x664f('0x0'));module[_0x664f('0x1')]={'name':{'type':Sequelize[_0x664f('0x2')],'unique':_0x664f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index a692e03..48c4ced 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 _0x2d50=['attributes','fields','length','nolimit','limit','order','sort','pick','merge','VIRTUAL','where','includeAll','include','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','count','set','apply','reject','save','then','get','UserProfileResource','sendStatus','error','stack','name','map','Variable','type','key','model','query','keys','filters','intersection'];(function(_0x4b4fd9,_0xd601f4){var _0x1c7ade=function(_0x33bcd0){while(--_0x33bcd0){_0x4b4fd9['push'](_0x4b4fd9['shift']());}};_0x1c7ade(++_0xd601f4);}(_0x2d50,0x10c));var _0x02d5=function(_0xb31e2,_0x3d0cba){_0xb31e2=_0xb31e2-0x0;var _0x1e8c24=_0x2d50[_0xb31e2];return _0x1e8c24;};'use strict';var emlformat=require(_0x02d5('0x0'));var rimraf=require(_0x02d5('0x1'));var zipdir=require(_0x02d5('0x2'));var jsonpatch=require(_0x02d5('0x3'));var rp=require('request-promise');var moment=require(_0x02d5('0x4'));var BPromise=require(_0x02d5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x02d5('0x6'));var sox=require('sox');var csv=require(_0x02d5('0x7'));var ejs=require(_0x02d5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x02d5('0x9'));var squel=require('squel');var crypto=require(_0x02d5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x02d5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x02d5('0xc'));var Papa=require(_0x02d5('0xd'));var Redis=require(_0x02d5('0xe'));var authService=require(_0x02d5('0xf'));var qs=require(_0x02d5('0x10'));var as=require(_0x02d5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x02d5('0x12'))(_0x02d5('0x13'));var utils=require(_0x02d5('0x14'));var config=require(_0x02d5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x02d5('0x16'))['db'];function respondWithStatusCode(_0x47c010,_0x39a384){_0x39a384=_0x39a384||0xcc;return function(_0x415339){if(_0x415339){return _0x47c010['sendStatus'](_0x39a384);}return _0x47c010[_0x02d5('0x17')](_0x39a384)[_0x02d5('0x18')]();};}function respondWithResult(_0x2a1a31,_0x4fa8c6){_0x4fa8c6=_0x4fa8c6||0xc8;return function(_0x24c900){if(_0x24c900){return _0x2a1a31[_0x02d5('0x17')](_0x4fa8c6)[_0x02d5('0x19')](_0x24c900);}};}function respondWithFilteredResult(_0x5a6412,_0xafdcdd){return function(_0x5e6b40){if(_0x5e6b40){var _0x82d204=typeof _0xafdcdd[_0x02d5('0x1a')]==='undefined'&&typeof _0xafdcdd['limit']==='undefined';var _0xeb19bf=_0x5e6b40[_0x02d5('0x1b')];var _0x37349c=_0x82d204?0x0:_0xafdcdd[_0x02d5('0x1a')];var _0x5cfa23=_0x82d204?_0x5e6b40[_0x02d5('0x1b')]:_0xafdcdd[_0x02d5('0x1a')]+_0xafdcdd['limit'];var _0x1858d5;if(_0x5cfa23>=_0xeb19bf){_0x5cfa23=_0xeb19bf;_0x1858d5=0xc8;}else{_0x1858d5=0xce;}_0x5a6412[_0x02d5('0x17')](_0x1858d5);return _0x5a6412[_0x02d5('0x1c')]('Content-Range',_0x37349c+'-'+_0x5cfa23+'/'+_0xeb19bf)[_0x02d5('0x19')](_0x5e6b40);}return null;};}function patchUpdates(_0x2edec6){return function(_0xf7880c){try{jsonpatch[_0x02d5('0x1d')](_0xf7880c,_0x2edec6,!![]);}catch(_0x4738ba){return BPromise[_0x02d5('0x1e')](_0x4738ba);}return _0xf7880c[_0x02d5('0x1f')]();};}function saveUpdates(_0x40cd84,_0x378ef5){return function(_0x271f63){if(_0x271f63){return _0x271f63['update'](_0x40cd84)[_0x02d5('0x20')](function(_0x4629cf){return _0x4629cf;});}return null;};}function removeEntity(_0x40bae4,_0x3620d1){return function(_0x4567d3){if(_0x4567d3){return _0x4567d3['destroy']()[_0x02d5('0x20')](function(){var _0x470dfe=_0x4567d3[_0x02d5('0x21')]({'plain':!![]});var _0x216b56='Variables';return db[_0x02d5('0x22')]['destroy']({'where':{'type':_0x216b56,'resourceId':_0x470dfe['id']}})[_0x02d5('0x20')](function(){return _0x4567d3;});})['then'](function(){_0x40bae4['status'](0xcc)[_0x02d5('0x18')]();});}};}function handleEntityNotFound(_0x9e9d7d,_0x2aa2b1){return function(_0x59fd8f){if(!_0x59fd8f){_0x9e9d7d[_0x02d5('0x23')](0x194);}return _0x59fd8f;};}function handleError(_0x25e5a4,_0x17ee65){_0x17ee65=_0x17ee65||0x1f4;return function(_0xe3691e){logger[_0x02d5('0x24')](_0xe3691e[_0x02d5('0x25')]);if(_0xe3691e[_0x02d5('0x26')]){delete _0xe3691e[_0x02d5('0x26')];}_0x25e5a4[_0x02d5('0x17')](_0x17ee65)['send'](_0xe3691e);};}exports['index']=function(_0x4e08c0,_0x2db58e){var _0x39ac32={},_0x1f473f={},_0x2227b4={'count':0x0,'rows':[]};var _0x1ae0fa=_[_0x02d5('0x27')](db[_0x02d5('0x28')]['rawAttributes'],function(_0x6504d0){return{'name':_0x6504d0['fieldName'],'type':_0x6504d0[_0x02d5('0x29')][_0x02d5('0x2a')]};});_0x1f473f[_0x02d5('0x2b')]=_[_0x02d5('0x27')](_0x1ae0fa,'name');_0x1f473f[_0x02d5('0x2c')]=_[_0x02d5('0x2d')](_0x4e08c0['query']);_0x1f473f[_0x02d5('0x2e')]=_[_0x02d5('0x2f')](_0x1f473f[_0x02d5('0x2b')],_0x1f473f['query']);_0x39ac32[_0x02d5('0x30')]=_[_0x02d5('0x2f')](_0x1f473f[_0x02d5('0x2b')],qs[_0x02d5('0x31')](_0x4e08c0[_0x02d5('0x2c')][_0x02d5('0x31')]));_0x39ac32[_0x02d5('0x30')]=_0x39ac32[_0x02d5('0x30')][_0x02d5('0x32')]?_0x39ac32[_0x02d5('0x30')]:_0x1f473f['model'];if(!_0x4e08c0[_0x02d5('0x2c')]['hasOwnProperty'](_0x02d5('0x33'))){_0x39ac32[_0x02d5('0x34')]=qs[_0x02d5('0x34')](_0x4e08c0[_0x02d5('0x2c')]['limit']);_0x39ac32['offset']=qs[_0x02d5('0x1a')](_0x4e08c0['query']['offset']);}_0x39ac32[_0x02d5('0x35')]=qs[_0x02d5('0x36')](_0x4e08c0[_0x02d5('0x2c')][_0x02d5('0x36')]);_0x39ac32['where']=qs[_0x02d5('0x2e')](_[_0x02d5('0x37')](_0x4e08c0['query'],_0x1f473f[_0x02d5('0x2e')]),_0x1ae0fa);if(_0x4e08c0[_0x02d5('0x2c')]['filter']){_0x39ac32['where']=_[_0x02d5('0x38')](_0x39ac32['where'],{'$or':_[_0x02d5('0x27')](_0x1ae0fa,function(_0x3cb1cd){if(_0x3cb1cd[_0x02d5('0x29')]!==_0x02d5('0x39')){var _0x24f2bb={};_0x24f2bb[_0x3cb1cd[_0x02d5('0x26')]]={'$like':'%'+_0x4e08c0[_0x02d5('0x2c')]['filter']+'%'};return _0x24f2bb;}})});}_0x39ac32=_[_0x02d5('0x38')]({},_0x39ac32,_0x4e08c0['options']);var _0x1822b3={'where':_0x39ac32[_0x02d5('0x3a')]};return db['Variable']['count'](_0x1822b3)[_0x02d5('0x20')](function(_0x19b2d8){_0x2227b4[_0x02d5('0x1b')]=_0x19b2d8;if(_0x4e08c0[_0x02d5('0x2c')][_0x02d5('0x3b')]){_0x39ac32[_0x02d5('0x3c')]=[{'all':!![]}];}return db[_0x02d5('0x28')]['findAll'](_0x39ac32);})[_0x02d5('0x20')](function(_0x42eca9){_0x2227b4[_0x02d5('0x3d')]=_0x42eca9;return _0x2227b4;})[_0x02d5('0x20')](respondWithFilteredResult(_0x2db58e,_0x39ac32))[_0x02d5('0x3e')](handleError(_0x2db58e,null));};exports[_0x02d5('0x3f')]=function(_0xd1b83e,_0x2cf8b7){var _0x2fd062={'raw':!![],'where':{'id':_0xd1b83e[_0x02d5('0x40')]['id']}},_0x4fb987={};_0x4fb987[_0x02d5('0x2b')]=_[_0x02d5('0x2d')](db['Variable']['rawAttributes']);_0x4fb987[_0x02d5('0x2c')]=_[_0x02d5('0x2d')](_0xd1b83e['query']);_0x4fb987['filters']=_['intersection'](_0x4fb987[_0x02d5('0x2b')],_0x4fb987['query']);_0x2fd062[_0x02d5('0x30')]=_[_0x02d5('0x2f')](_0x4fb987[_0x02d5('0x2b')],qs[_0x02d5('0x31')](_0xd1b83e[_0x02d5('0x2c')][_0x02d5('0x31')]));_0x2fd062['attributes']=_0x2fd062['attributes'][_0x02d5('0x32')]?_0x2fd062[_0x02d5('0x30')]:_0x4fb987[_0x02d5('0x2b')];if(_0xd1b83e[_0x02d5('0x2c')][_0x02d5('0x3b')]){_0x2fd062[_0x02d5('0x3c')]=[{'all':!![]}];}_0x2fd062=_[_0x02d5('0x38')]({},_0x2fd062,_0xd1b83e[_0x02d5('0x41')]);return db[_0x02d5('0x28')][_0x02d5('0x42')](_0x2fd062)[_0x02d5('0x20')](handleEntityNotFound(_0x2cf8b7,null))[_0x02d5('0x20')](respondWithResult(_0x2cf8b7,null))[_0x02d5('0x3e')](handleError(_0x2cf8b7,null));};exports[_0x02d5('0x43')]=function(_0x3dbeff,_0x4fa79b){return db[_0x02d5('0x28')]['create'](_0x3dbeff[_0x02d5('0x44')],{})[_0x02d5('0x20')](function(_0x1925ca){var _0x466996=_0x3dbeff[_0x02d5('0x45')]['get']({'plain':!![]});if(!_0x466996)throw new Error(_0x02d5('0x46'));if(_0x466996[_0x02d5('0x47')]==='user'){var _0x5688bc=_0x1925ca[_0x02d5('0x21')]({'plain':!![]});var _0x2381ae=_0x02d5('0x48');return db[_0x02d5('0x49')]['find']({'where':{'name':_0x2381ae,'userProfileId':_0x466996[_0x02d5('0x4a')]},'raw':!![]})[_0x02d5('0x20')](function(_0x26300f){if(_0x26300f&&_0x26300f[_0x02d5('0x4b')]===0x0){return db[_0x02d5('0x22')][_0x02d5('0x43')]({'name':_0x5688bc[_0x02d5('0x26')],'resourceId':_0x5688bc['id'],'type':_0x26300f[_0x02d5('0x26')],'sectionId':_0x26300f['id']},{})[_0x02d5('0x20')](function(){return _0x1925ca;});}else{return _0x1925ca;}})['catch'](function(_0x240eb7){logger[_0x02d5('0x24')](_0x02d5('0x4c'),_0x240eb7);throw _0x240eb7;});}return _0x1925ca;})['then'](respondWithResult(_0x4fa79b,0xc9))['catch'](handleError(_0x4fa79b,null));};exports[_0x02d5('0x4d')]=function(_0x13ddfe,_0x531f4b){if(_0x13ddfe[_0x02d5('0x44')]['id']){delete _0x13ddfe[_0x02d5('0x44')]['id'];}return db[_0x02d5('0x28')][_0x02d5('0x42')]({'where':{'id':_0x13ddfe[_0x02d5('0x40')]['id']}})[_0x02d5('0x20')](handleEntityNotFound(_0x531f4b,null))[_0x02d5('0x20')](saveUpdates(_0x13ddfe[_0x02d5('0x44')],null))['then'](respondWithResult(_0x531f4b,null))[_0x02d5('0x3e')](handleError(_0x531f4b,null));};exports[_0x02d5('0x4e')]=function(_0x946ebf,_0xe5777a){return db['Variable']['find']({'where':{'id':_0x946ebf['params']['id']}})[_0x02d5('0x20')](handleEntityNotFound(_0xe5777a,null))[_0x02d5('0x20')](removeEntity(_0xe5777a,null))[_0x02d5('0x3e')](handleError(_0xe5777a,null));}; \ No newline at end of file +var _0x6067=['filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','index','map','Variable','fieldName','type','query','keys'];(function(_0x3fca12,_0x15fb5d){var _0x5b2b83=function(_0x4d8d05){while(--_0x4d8d05){_0x3fca12['push'](_0x3fca12['shift']());}};_0x5b2b83(++_0x15fb5d);}(_0x6067,0x121));var _0x7606=function(_0x14c6f5,_0x1c88a7){_0x14c6f5=_0x14c6f5-0x0;var _0x2278bb=_0x6067[_0x14c6f5];return _0x2278bb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7606('0x0'));var jsonpatch=require(_0x7606('0x1'));var rp=require('request-promise');var moment=require(_0x7606('0x2'));var BPromise=require(_0x7606('0x3'));var Mustache=require(_0x7606('0x4'));var util=require(_0x7606('0x5'));var path=require(_0x7606('0x6'));var sox=require(_0x7606('0x7'));var csv=require(_0x7606('0x8'));var ejs=require(_0x7606('0x9'));var fs=require('fs');var fs_extra=require(_0x7606('0xa'));var _=require(_0x7606('0xb'));var squel=require(_0x7606('0xc'));var crypto=require(_0x7606('0xd'));var jsforce=require(_0x7606('0xe'));var deskjs=require(_0x7606('0xf'));var toCsv=require(_0x7606('0x8'));var querystring=require(_0x7606('0x10'));var Papa=require(_0x7606('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7606('0x12'));var as=require(_0x7606('0x13'));var hardwareService=require(_0x7606('0x14'));var logger=require(_0x7606('0x15'))(_0x7606('0x16'));var utils=require(_0x7606('0x17'));var config=require(_0x7606('0x18'));var licenseUtil=require(_0x7606('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dbb60,_0x582f4a){_0x582f4a=_0x582f4a||0xcc;return function(_0xa7d66c){if(_0xa7d66c){return _0x4dbb60[_0x7606('0x1a')](_0x582f4a);}return _0x4dbb60['status'](_0x582f4a)[_0x7606('0x1b')]();};}function respondWithResult(_0x331224,_0x2dbb02){_0x2dbb02=_0x2dbb02||0xc8;return function(_0x4da474){if(_0x4da474){return _0x331224[_0x7606('0x1c')](_0x2dbb02)[_0x7606('0x1d')](_0x4da474);}};}function respondWithFilteredResult(_0x1f510b,_0x5310cf){return function(_0x2f01e1){if(_0x2f01e1){var _0x16e6cf=typeof _0x5310cf[_0x7606('0x1e')]===_0x7606('0x1f')&&typeof _0x5310cf[_0x7606('0x20')]==='undefined';var _0x2bfdd5=_0x2f01e1[_0x7606('0x21')];var _0x2701b6=_0x16e6cf?0x0:_0x5310cf['offset'];var _0x2973b0=_0x16e6cf?_0x2f01e1['count']:_0x5310cf[_0x7606('0x1e')]+_0x5310cf[_0x7606('0x20')];var _0x3ffce4;if(_0x2973b0>=_0x2bfdd5){_0x2973b0=_0x2bfdd5;_0x3ffce4=0xc8;}else{_0x3ffce4=0xce;}_0x1f510b[_0x7606('0x1c')](_0x3ffce4);return _0x1f510b[_0x7606('0x22')](_0x7606('0x23'),_0x2701b6+'-'+_0x2973b0+'/'+_0x2bfdd5)['json'](_0x2f01e1);}return null;};}function patchUpdates(_0x13c194){return function(_0x4fc140){try{jsonpatch[_0x7606('0x24')](_0x4fc140,_0x13c194,!![]);}catch(_0x3f4f9b){return BPromise['reject'](_0x3f4f9b);}return _0x4fc140[_0x7606('0x25')]();};}function saveUpdates(_0x5a687b,_0x40c751){return function(_0x209748){if(_0x209748){return _0x209748[_0x7606('0x26')](_0x5a687b)[_0x7606('0x27')](function(_0x16aa3a){return _0x16aa3a;});}return null;};}function removeEntity(_0xcfd0c7,_0x46fd9b){return function(_0x41b53f){if(_0x41b53f){return _0x41b53f['destroy']()[_0x7606('0x27')](function(){var _0x45c63b=_0x41b53f[_0x7606('0x28')]({'plain':!![]});var _0x32b119=_0x7606('0x29');return db[_0x7606('0x2a')][_0x7606('0x2b')]({'where':{'type':_0x32b119,'resourceId':_0x45c63b['id']}})[_0x7606('0x27')](function(){return _0x41b53f;});})[_0x7606('0x27')](function(){_0xcfd0c7[_0x7606('0x1c')](0xcc)[_0x7606('0x1b')]();});}};}function handleEntityNotFound(_0x39264b,_0x44bed1){return function(_0xdb377d){if(!_0xdb377d){_0x39264b[_0x7606('0x1a')](0x194);}return _0xdb377d;};}function handleError(_0x4e3e62,_0x486e37){_0x486e37=_0x486e37||0x1f4;return function(_0x333c14){logger[_0x7606('0x2c')](_0x333c14[_0x7606('0x2d')]);if(_0x333c14[_0x7606('0x2e')]){delete _0x333c14[_0x7606('0x2e')];}_0x4e3e62[_0x7606('0x1c')](_0x486e37)[_0x7606('0x2f')](_0x333c14);};}exports[_0x7606('0x30')]=function(_0x15f824,_0x2641ad){var _0x49b54e={},_0x1d800d={},_0x1802cc={'count':0x0,'rows':[]};var _0x57419c=_[_0x7606('0x31')](db[_0x7606('0x32')]['rawAttributes'],function(_0x25bb55){return{'name':_0x25bb55[_0x7606('0x33')],'type':_0x25bb55[_0x7606('0x34')]['key']};});_0x1d800d['model']=_[_0x7606('0x31')](_0x57419c,'name');_0x1d800d[_0x7606('0x35')]=_[_0x7606('0x36')](_0x15f824['query']);_0x1d800d[_0x7606('0x37')]=_['intersection'](_0x1d800d['model'],_0x1d800d[_0x7606('0x35')]);_0x49b54e['attributes']=_[_0x7606('0x38')](_0x1d800d[_0x7606('0x39')],qs[_0x7606('0x3a')](_0x15f824[_0x7606('0x35')][_0x7606('0x3a')]));_0x49b54e[_0x7606('0x3b')]=_0x49b54e[_0x7606('0x3b')][_0x7606('0x3c')]?_0x49b54e[_0x7606('0x3b')]:_0x1d800d[_0x7606('0x39')];if(!_0x15f824['query']['hasOwnProperty'](_0x7606('0x3d'))){_0x49b54e[_0x7606('0x20')]=qs[_0x7606('0x20')](_0x15f824[_0x7606('0x35')][_0x7606('0x20')]);_0x49b54e['offset']=qs[_0x7606('0x1e')](_0x15f824[_0x7606('0x35')]['offset']);}_0x49b54e[_0x7606('0x3e')]=qs[_0x7606('0x3f')](_0x15f824['query'][_0x7606('0x3f')]);_0x49b54e[_0x7606('0x40')]=qs['filters'](_[_0x7606('0x41')](_0x15f824[_0x7606('0x35')],_0x1d800d[_0x7606('0x37')]),_0x57419c);if(_0x15f824[_0x7606('0x35')][_0x7606('0x42')]){_0x49b54e[_0x7606('0x40')]=_[_0x7606('0x43')](_0x49b54e[_0x7606('0x40')],{'$or':_['map'](_0x57419c,function(_0x39f901){if(_0x39f901[_0x7606('0x34')]!==_0x7606('0x44')){var _0x30e1cc={};_0x30e1cc[_0x39f901['name']]={'$like':'%'+_0x15f824[_0x7606('0x35')][_0x7606('0x42')]+'%'};return _0x30e1cc;}})});}_0x49b54e=_[_0x7606('0x43')]({},_0x49b54e,_0x15f824[_0x7606('0x45')]);var _0x5c3139={'where':_0x49b54e[_0x7606('0x40')]};return db[_0x7606('0x32')][_0x7606('0x21')](_0x5c3139)[_0x7606('0x27')](function(_0x4df635){_0x1802cc[_0x7606('0x21')]=_0x4df635;if(_0x15f824['query'][_0x7606('0x46')]){_0x49b54e[_0x7606('0x47')]=[{'all':!![]}];}return db['Variable'][_0x7606('0x48')](_0x49b54e);})[_0x7606('0x27')](function(_0x3b2c49){_0x1802cc[_0x7606('0x49')]=_0x3b2c49;return _0x1802cc;})[_0x7606('0x27')](respondWithFilteredResult(_0x2641ad,_0x49b54e))[_0x7606('0x4a')](handleError(_0x2641ad,null));};exports['show']=function(_0x2d5990,_0x59fefe){var _0x24d037={'raw':!![],'where':{'id':_0x2d5990[_0x7606('0x4b')]['id']}},_0x455801={};_0x455801[_0x7606('0x39')]=_[_0x7606('0x36')](db[_0x7606('0x32')][_0x7606('0x4c')]);_0x455801[_0x7606('0x35')]=_['keys'](_0x2d5990['query']);_0x455801[_0x7606('0x37')]=_['intersection'](_0x455801['model'],_0x455801[_0x7606('0x35')]);_0x24d037['attributes']=_[_0x7606('0x38')](_0x455801[_0x7606('0x39')],qs[_0x7606('0x3a')](_0x2d5990[_0x7606('0x35')][_0x7606('0x3a')]));_0x24d037['attributes']=_0x24d037[_0x7606('0x3b')]['length']?_0x24d037[_0x7606('0x3b')]:_0x455801[_0x7606('0x39')];if(_0x2d5990[_0x7606('0x35')][_0x7606('0x46')]){_0x24d037[_0x7606('0x47')]=[{'all':!![]}];}_0x24d037=_[_0x7606('0x43')]({},_0x24d037,_0x2d5990[_0x7606('0x45')]);return db[_0x7606('0x32')][_0x7606('0x4d')](_0x24d037)[_0x7606('0x27')](handleEntityNotFound(_0x59fefe,null))[_0x7606('0x27')](respondWithResult(_0x59fefe,null))[_0x7606('0x4a')](handleError(_0x59fefe,null));};exports[_0x7606('0x4e')]=function(_0x1062f3,_0x1dc49a){return db[_0x7606('0x32')][_0x7606('0x4e')](_0x1062f3['body'],{})['then'](function(_0x2952de){var _0x5a9547=_0x1062f3[_0x7606('0x4f')][_0x7606('0x28')]({'plain':!![]});if(!_0x5a9547)throw new Error(_0x7606('0x50'));if(_0x5a9547['role']===_0x7606('0x4f')){var _0x50ea65=_0x2952de[_0x7606('0x28')]({'plain':!![]});var _0x34bd43='Variables';return db[_0x7606('0x51')][_0x7606('0x4d')]({'where':{'name':_0x34bd43,'userProfileId':_0x5a9547[_0x7606('0x52')]},'raw':!![]})['then'](function(_0x55b642){if(_0x55b642&&_0x55b642[_0x7606('0x53')]===0x0){return db[_0x7606('0x2a')][_0x7606('0x4e')]({'name':_0x50ea65[_0x7606('0x2e')],'resourceId':_0x50ea65['id'],'type':_0x55b642[_0x7606('0x2e')],'sectionId':_0x55b642['id']},{})['then'](function(){return _0x2952de;});}else{return _0x2952de;}})['catch'](function(_0x4aae65){logger[_0x7606('0x2c')](_0x7606('0x54'),_0x4aae65);throw _0x4aae65;});}return _0x2952de;})[_0x7606('0x27')](respondWithResult(_0x1dc49a,0xc9))[_0x7606('0x4a')](handleError(_0x1dc49a,null));};exports[_0x7606('0x26')]=function(_0x216be9,_0x223375){if(_0x216be9[_0x7606('0x55')]['id']){delete _0x216be9[_0x7606('0x55')]['id'];}return db[_0x7606('0x32')]['find']({'where':{'id':_0x216be9[_0x7606('0x4b')]['id']}})[_0x7606('0x27')](handleEntityNotFound(_0x223375,null))[_0x7606('0x27')](saveUpdates(_0x216be9[_0x7606('0x55')],null))[_0x7606('0x27')](respondWithResult(_0x223375,null))[_0x7606('0x4a')](handleError(_0x223375,null));};exports[_0x7606('0x2b')]=function(_0x32dbf3,_0x3eb5e5){return db['Variable'][_0x7606('0x4d')]({'where':{'id':_0x32dbf3['params']['id']}})[_0x7606('0x27')](handleEntityNotFound(_0x3eb5e5,null))[_0x7606('0x27')](removeEntity(_0x3eb5e5,null))[_0x7606('0x4a')](handleError(_0x3eb5e5,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 01f0b00..a328774 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 _0x4ed1=['./variable.attributes','Variable','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3afda9,_0x157233){var _0x54df67=function(_0x75b42a){while(--_0x75b42a){_0x3afda9['push'](_0x3afda9['shift']());}};_0x54df67(++_0x157233);}(_0x4ed1,0x119));var _0x14ed=function(_0x28a2d4,_0x5ecf15){_0x28a2d4=_0x28a2d4-0x0;var _0x374ddb=_0x4ed1[_0x28a2d4];return _0x374ddb;};'use strict';var _=require(_0x14ed('0x0'));var util=require('util');var logger=require(_0x14ed('0x1'))(_0x14ed('0x2'));var moment=require(_0x14ed('0x3'));var BPromise=require('bluebird');var rp=require(_0x14ed('0x4'));var fs=require('fs');var path=require(_0x14ed('0x5'));var rimraf=require('rimraf');var config=require(_0x14ed('0x6'));var attributes=require(_0x14ed('0x7'));module['exports']=function(_0x1b4e10,_0x3c9b3a){return _0x1b4e10['define'](_0x14ed('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13be=['define','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports'];(function(_0xd53f87,_0x16c6bd){var _0x190178=function(_0x4cc0ed){while(--_0x4cc0ed){_0xd53f87['push'](_0xd53f87['shift']());}};_0x190178(++_0x16c6bd);}(_0x13be,0x1e3));var _0xe13b=function(_0x54ae0d,_0xd4fae){_0x54ae0d=_0x54ae0d-0x0;var _0x456421=_0x13be[_0x54ae0d];return _0x456421;};'use strict';var _=require(_0xe13b('0x0'));var util=require(_0xe13b('0x1'));var logger=require(_0xe13b('0x2'))(_0xe13b('0x3'));var moment=require(_0xe13b('0x4'));var BPromise=require(_0xe13b('0x5'));var rp=require(_0xe13b('0x6'));var fs=require('fs');var path=require(_0xe13b('0x7'));var rimraf=require('rimraf');var config=require(_0xe13b('0x8'));var attributes=require(_0xe13b('0x9'));module[_0xe13b('0xa')]=function(_0x23de83,_0x426938){return _0x23de83[_0xe13b('0xb')]('Variable',attributes,{'tableName':_0xe13b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 5b01447..252f578 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x42314b,_0x3d6128){var _0x3f9e0c=function(_0x341c84){while(--_0x341c84){_0x42314b['push'](_0x42314b['shift']());}};_0x3f9e0c(++_0x3d6128);}(_0x814b,0x1a2));var _0xb814=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0x814b[_0x301dab];return _0x2500a2;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x12c289,_0x3376b8){var _0x9e28d5=function(_0x33cb58){while(--_0x33cb58){_0x12c289['push'](_0x12c289['shift']());}};_0x9e28d5(++_0x3376b8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x58f99f,_0x59c1b0){_0x58f99f=_0x58f99f-0x0;var _0x2976e9=_0x1cb9[_0x58f99f];return _0x2976e9;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index aee47ca..474a222 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 _0x1301=['reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','isAuthenticated','fetch','/reset','canUpdate'];(function(_0x35aa81,_0xf12756){var _0x4069d5=function(_0x35e4f8){while(--_0x35e4f8){_0x35aa81['push'](_0x35aa81['shift']());}};_0x4069d5(++_0xf12756);}(_0x1301,0x1e4));var _0x1130=function(_0x2df6f2,_0x1c47ff){_0x2df6f2=_0x2df6f2-0x0;var _0x52c534=_0x1301[_0x2df6f2];return _0x52c534;};'use strict';var express=require(_0x1130('0x0'));var router=express[_0x1130('0x1')]();var auth=require(_0x1130('0x2'));var controller=require(_0x1130('0x3'));router[_0x1130('0x4')]('/',controller['index']);router['get']('/fetch',auth[_0x1130('0x5')](),auth['canUpdate'](),controller[_0x1130('0x6')]);router[_0x1130('0x4')](_0x1130('0x7'),auth[_0x1130('0x5')](),auth[_0x1130('0x8')](),controller[_0x1130('0x9')]);router[_0x1130('0x4')](_0x1130('0xa'),auth[_0x1130('0x5')](),auth[_0x1130('0x8')](),controller[_0x1130('0xb')]);router[_0x1130('0x4')](_0x1130('0xc'),auth['isAuthenticated'](),controller[_0x1130('0xd')]);router[_0x1130('0x4')](_0x1130('0xe'),controller[_0x1130('0xf')]);module[_0x1130('0x10')]=router; \ No newline at end of file +var _0xe3f2=['get','/fetch','isAuthenticated','canUpdate','reset','/pull','pull','/restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','index'];(function(_0x4e3b54,_0x1e6976){var _0x5e686=function(_0x145d22){while(--_0x145d22){_0x4e3b54['push'](_0x4e3b54['shift']());}};_0x5e686(++_0x1e6976);}(_0xe3f2,0x1ab));var _0x2e3f=function(_0x5e8b76,_0x198600){_0x5e8b76=_0x5e8b76-0x0;var _0x19ff83=_0xe3f2[_0x5e8b76];return _0x19ff83;};'use strict';var express=require(_0x2e3f('0x0'));var router=express[_0x2e3f('0x1')]();var auth=require(_0x2e3f('0x2'));var controller=require(_0x2e3f('0x3'));router['get']('/',controller[_0x2e3f('0x4')]);router[_0x2e3f('0x5')](_0x2e3f('0x6'),auth[_0x2e3f('0x7')](),auth[_0x2e3f('0x8')](),controller['fetch']);router[_0x2e3f('0x5')]('/reset',auth[_0x2e3f('0x7')](),auth[_0x2e3f('0x8')](),controller[_0x2e3f('0x9')]);router[_0x2e3f('0x5')](_0x2e3f('0xa'),auth['isAuthenticated'](),auth[_0x2e3f('0x8')](),controller[_0x2e3f('0xb')]);router['get'](_0x2e3f('0xc'),auth[_0x2e3f('0x7')](),controller['restart']);router[_0x2e3f('0x5')](_0x2e3f('0xd'),controller[_0x2e3f('0xe')]);module[_0x2e3f('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 4855806..d89fb0a 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 _0x5973=['path','lodash','version','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','query','latest','tags','exports','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','pull','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','catch','migrations','join','server','length','replace','.js','push','sequelize','Migration','getQueryInterface','constructor','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5973,0x103));var _0x3597=function(_0xec9c4e,_0x1f3b34){_0xec9c4e=_0xec9c4e-0x0;var _0x49cf7b=_0x5973[_0xec9c4e];return _0x49cf7b;};'use strict';var Umzug=require(_0x3597('0x0'));var path=require(_0x3597('0x1'));var fs=require('fs');var _=require(_0x3597('0x2'));var pkginfo=require('pkginfo')(module,_0x3597('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x3597('0x4'))[_0x3597('0x5')];var db=require(_0x3597('0x6'))['db'];var config=require(_0x3597('0x7'));var pm2=require(_0x3597('0x8'));var logger=require(_0x3597('0x9'))(_0x3597('0xa'));var git=require('simple-git')(config[_0x3597('0xb')]);exports[_0x3597('0xc')]=function(_0x5654a9,_0x198db5){var _0x59c143={'current':module['exports'][_0x3597('0x3')],'phonebar':0x2};if(_0x5654a9[_0x3597('0xd')]&&_0x5654a9[_0x3597('0xd')][_0x3597('0xe')]){return git['fetch']()[_0x3597('0xf')](function(_0x347b1d,_0x5400ad){_0x59c143[_0x3597('0xe')]=(_0x347b1d?module[_0x3597('0x10')][_0x3597('0x3')]:_0x5400ad[_0x3597('0xe')])||_0x3597('0x11');return _0x198db5[_0x3597('0x12')](0xc8)[_0x3597('0x13')](_0x59c143);});}else{return _0x198db5['status'](0xc8)[_0x3597('0x13')](_0x59c143);}};exports['fetch']=function(_0x47429b,_0x13e76c){return git[_0x3597('0x14')]([_0x3597('0x15'),_0x3597('0x16')],function(_0x3ba63b){if(_0x3ba63b){logger[_0x3597('0x17')](_0x3ba63b);return _0x13e76c[_0x3597('0x12')](0x1f4)[_0x3597('0x13')](_0x3ba63b);}logger[_0x3597('0x18')](_0x3597('0x19'));return _0x13e76c['status'](0xc8)[_0x3597('0x13')]({'output':_0x3597('0x1a')});});};exports[_0x3597('0x1b')]=function(_0x1230e9,_0x3cf331){return git['reset']([_0x3597('0x1c'),_0x3597('0x1d')],function(_0x30465f){if(_0x30465f){logger[_0x3597('0x17')](_0x30465f);return _0x3cf331[_0x3597('0x12')](0x1f4)[_0x3597('0x13')](_0x30465f);}logger[_0x3597('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3cf331[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':'git\x20reset\x20--hard'});});};exports[_0x3597('0x1e')]=function(_0x4eb866,_0x473013){exec(_0x3597('0x1f'),function(_0x571c77,_0x5b8298,_0x1082ab){logger[_0x3597('0x18')](_0x5b8298);logger[_0x3597('0x18')](_0x1082ab);if(_0x571c77){logger[_0x3597('0x17')](_0x571c77);return _0x473013[_0x3597('0x12')](0x1f4)['json'](_0x571c77);}return _0x473013[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':_0x5b8298});});};exports[_0x3597('0x20')]=function(_0x89a52b,_0x1e2c2b){return pm2[_0x3597('0x20')]('motion2')['then'](function(_0x16e817){logger['info'](_0x3597('0x21'),_0x16e817);return _0x1e2c2b[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x3597('0x22')](function(_0xe2b03f){logger['error'](_0xe2b03f);return _0x1e2c2b[_0x3597('0x12')](0x1f4)['json'](_0xe2b03f);});};exports[_0x3597('0x23')]=function(_0x4aba5c,_0x15d829){var _0x1720ac=fs['readdirSync'](path[_0x3597('0x24')](config['root'],_0x3597('0x25'),_0x3597('0x23')));var _0x4df91d=[];for(var _0x38e460=0x0;_0x38e460<_0x1720ac[_0x3597('0x26')];_0x38e460++){var _0x4d605e=_0x1720ac[_0x38e460][_0x3597('0x27')](_0x3597('0x28'),'');if(compareVersions(module['exports']['version'],_0x4d605e)===-0x1){_0x4df91d[_0x3597('0x29')](_0x4d605e);}}if(_0x4df91d[_0x3597('0x26')]){var _0x5adf47=_0x4df91d['sort'](compareVersions);var _0x3e60e6=new Umzug({'storage':_0x3597('0x2a'),'storageOptions':{'model':db[_0x3597('0x2b')],'modelName':_0x3597('0x2b'),'columnName':_0x3597('0x3')},'migrations':{'params':[db[_0x3597('0x2a')][_0x3597('0x2c')](),db['sequelize'][_0x3597('0x2d')],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['root'],_0x3597('0x25'),_0x3597('0x23')),'pattern':/\.js$/}});_0x3e60e6['up']({'migrations':_[_0x3597('0x2e')](_0x5adf47,function(_0x490384){return _0x490384+'.js';})})[_0x3597('0x2f')](function(){return _0x15d829[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':_0x3597('0x30')+module[_0x3597('0x10')][_0x3597('0x3')]+_0x3597('0x31')+_[_0x3597('0x32')](_0x5adf47),'migrations':_[_0x3597('0x24')](_0x5adf47)});})[_0x3597('0x22')](function(_0x186ec7){if(_0x186ec7 instanceof db['sequelize']['UniqueConstraintError']){return _0x15d829[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x15d829['status'](0x1f4)[_0x3597('0x13')](_0x186ec7);}});}else{return _0x15d829[_0x3597('0x12')](0xc8)[_0x3597('0x13')]({'output':_0x3597('0x33')});}}; \ No newline at end of file +var _0x1ae7=['../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','then','pm2\x20restart\x20motion\x20%s','catch','migrations','join','length','replace','.js','push','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','compare-versions','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1ae7,0x86));var _0x71ae=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x1ae7[_0x3054be];return _0x3df150;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x71ae('0x0'));var pkginfo=require(_0x71ae('0x1'))(module,'version');var compareVersions=require(_0x71ae('0x2'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x71ae('0x3'));var pm2=require(_0x71ae('0x4'));var logger=require(_0x71ae('0x5'))(_0x71ae('0x6'));var git=require(_0x71ae('0x7'))(config[_0x71ae('0x8')]);exports[_0x71ae('0x9')]=function(_0x5f5b18,_0x59449f){var _0x134095={'current':module[_0x71ae('0xa')][_0x71ae('0xb')],'phonebar':0x2};if(_0x5f5b18['query']&&_0x5f5b18[_0x71ae('0xc')][_0x71ae('0xd')]){return git[_0x71ae('0xe')]()[_0x71ae('0xf')](function(_0x1479a9,_0x10b3e2){_0x134095[_0x71ae('0xd')]=(_0x1479a9?module['exports'][_0x71ae('0xb')]:_0x10b3e2[_0x71ae('0xd')])||_0x71ae('0x10');return _0x59449f['status'](0xc8)['json'](_0x134095);});}else{return _0x59449f[_0x71ae('0x11')](0xc8)[_0x71ae('0x12')](_0x134095);}};exports['fetch']=function(_0x1f8fdb,_0x1778f9){return git[_0x71ae('0xe')]([_0x71ae('0x13'),_0x71ae('0x14')],function(_0x7094e5){if(_0x7094e5){logger[_0x71ae('0x15')](_0x7094e5);return _0x1778f9['status'](0x1f4)['json'](_0x7094e5);}logger[_0x71ae('0x16')](_0x71ae('0x17'));return _0x1778f9[_0x71ae('0x11')](0xc8)[_0x71ae('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x71ae('0x18')]=function(_0x1f294b,_0xae5e50){return git['reset'](['--hard',_0x71ae('0x19')],function(_0x55ec57){if(_0x55ec57){logger['error'](_0x55ec57);return _0xae5e50[_0x71ae('0x11')](0x1f4)[_0x71ae('0x12')](_0x55ec57);}logger['info'](_0x71ae('0x1a'));return _0xae5e50[_0x71ae('0x11')](0xc8)[_0x71ae('0x12')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x2bf133,_0x4baee1){exec('npm\x20install\x20--production',function(_0x1542b0,_0x442f4f,_0x3e990f){logger[_0x71ae('0x16')](_0x442f4f);logger['info'](_0x3e990f);if(_0x1542b0){logger[_0x71ae('0x15')](_0x1542b0);return _0x4baee1[_0x71ae('0x11')](0x1f4)[_0x71ae('0x12')](_0x1542b0);}return _0x4baee1['status'](0xc8)[_0x71ae('0x12')]({'output':_0x442f4f});});};exports['restart']=function(_0x92075d,_0x1a6330){return pm2['restart']('motion2')[_0x71ae('0x1b')](function(_0x53a9c1){logger['info'](_0x71ae('0x1c'),_0x53a9c1);return _0x1a6330['status'](0xc8)[_0x71ae('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x71ae('0x1d')](function(_0x345338){logger[_0x71ae('0x15')](_0x345338);return _0x1a6330['status'](0x1f4)['json'](_0x345338);});};exports[_0x71ae('0x1e')]=function(_0x334691,_0x20e6dd){var _0x288193=fs['readdirSync'](path[_0x71ae('0x1f')](config['root'],'server',_0x71ae('0x1e')));var _0x42b663=[];for(var _0x28322a=0x0;_0x28322a<_0x288193[_0x71ae('0x20')];_0x28322a++){var _0x4a0486=_0x288193[_0x28322a][_0x71ae('0x21')](_0x71ae('0x22'),'');if(compareVersions(module[_0x71ae('0xa')][_0x71ae('0xb')],_0x4a0486)===-0x1){_0x42b663[_0x71ae('0x23')](_0x4a0486);}}if(_0x42b663['length']){var _0xf851f9=_0x42b663['sort'](compareVersions);var _0x2af475=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x71ae('0x24')],'modelName':_0x71ae('0x24'),'columnName':_0x71ae('0xb')},'migrations':{'params':[db[_0x71ae('0x25')][_0x71ae('0x26')](),db[_0x71ae('0x25')][_0x71ae('0x27')],function(){throw new Error(_0x71ae('0x28'));}],'path':path['join'](config['root'],_0x71ae('0x29'),'migrations'),'pattern':/\.js$/}});_0x2af475['up']({'migrations':_['map'](_0xf851f9,function(_0x4419c6){return _0x4419c6+'.js';})})['then'](function(){return _0x20e6dd[_0x71ae('0x11')](0xc8)[_0x71ae('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports']['version']+_0x71ae('0x2a')+_[_0x71ae('0x2b')](_0xf851f9),'migrations':_['join'](_0xf851f9)});})[_0x71ae('0x1d')](function(_0x242c8c){if(_0x242c8c instanceof db[_0x71ae('0x25')][_0x71ae('0x2c')]){return _0x20e6dd[_0x71ae('0x11')](0xc8)[_0x71ae('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x20e6dd['status'](0x1f4)['json'](_0x242c8c);}});}else{return _0x20e6dd[_0x71ae('0x11')](0xc8)['json']({'output':_0x71ae('0x2d')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 5548543..d231bcd 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 _0x0593=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0593,0x1d1));var _0x3059=function(_0x25e4af,_0x9603c5){_0x25e4af=_0x25e4af-0x0;var _0x456dc2=_0x0593[_0x25e4af];return _0x456dc2;};'use strict';var multer=require(_0x3059('0x0'));var util=require(_0x3059('0x1'));var path=require(_0x3059('0x2'));var timeout=require(_0x3059('0x3'));var express=require(_0x3059('0x4'));var router=express[_0x3059('0x5')]();var fs_extra=require(_0x3059('0x6'));var auth=require(_0x3059('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3059('0x8'));var controller=require(_0x3059('0x9'));router[_0x3059('0xa')]('/',auth[_0x3059('0xb')](),controller[_0x3059('0xc')]);router[_0x3059('0xa')](_0x3059('0xd'),auth['isAuthenticated'](),controller[_0x3059('0xe')]);router[_0x3059('0xa')](_0x3059('0xf'),auth[_0x3059('0xb')](),controller[_0x3059('0x10')]);router[_0x3059('0x11')]('/',auth[_0x3059('0xb')](),controller[_0x3059('0x12')]);router[_0x3059('0x13')]('/:id',auth[_0x3059('0xb')](),controller[_0x3059('0x14')]);router[_0x3059('0x15')]('/:id',auth[_0x3059('0xb')](),controller[_0x3059('0x16')]);module[_0x3059('0x17')]=router; \ No newline at end of file +var _0xd202=['fs-extra','../../components/auth/service','./voiceAgentReport.controller','get','index','/describe','describe','/:id','post','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xd202,0x18b));var _0x2d20=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xd202[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0x2d20('0x0'));var util=require(_0x2d20('0x1'));var path=require(_0x2d20('0x2'));var timeout=require(_0x2d20('0x3'));var express=require(_0x2d20('0x4'));var router=express['Router']();var fs_extra=require(_0x2d20('0x5'));var auth=require(_0x2d20('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2d20('0x7'));router[_0x2d20('0x8')]('/',auth['isAuthenticated'](),controller[_0x2d20('0x9')]);router[_0x2d20('0x8')](_0x2d20('0xa'),auth['isAuthenticated'](),controller[_0x2d20('0xb')]);router[_0x2d20('0x8')](_0x2d20('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2d20('0xd')]('/',auth[_0x2d20('0xe')](),controller[_0x2d20('0xf')]);router[_0x2d20('0x10')](_0x2d20('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x2d20('0x11')]('/:id',auth[_0x2d20('0xe')](),controller[_0x2d20('0x12')]);module[_0x2d20('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index f845e70..fca5d32 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 _0x5f2f=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x2dd1a7,_0x4b598d){var _0x3523cc=function(_0xb2bd38){while(--_0xb2bd38){_0x2dd1a7['push'](_0x2dd1a7['shift']());}};_0x3523cc(++_0x4b598d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x313675,_0x23c8b2){_0x313675=_0x313675-0x0;var _0x4051fd=_0x5f2f[_0x313675];return _0x4051fd;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'type':{'type':Sequelize[_0xf5f2('0x2')]},'uniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'calleridnum':{'type':Sequelize[_0xf5f2('0x2')]},'calleridname':{'type':Sequelize[_0xf5f2('0x2')]},'queue':{'type':Sequelize[_0xf5f2('0x2')]},'interface':{'type':Sequelize[_0xf5f2('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf5f2('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xf5f2('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xf5f2('0x3')]},'agentdumpAt':{'type':Sequelize[_0xf5f2('0x3')]},'holdtime':{'type':Sequelize[_0xf5f2('0x4')]},'agentcomplete':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf5f2('0x4')]},'agentacw':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf5f2('0x2')]},'lastevent':{'type':Sequelize[_0xf5f2('0x2')]},'channel':{'type':Sequelize[_0xf5f2('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf5f2('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf5f2('0x2')]},'accountcode':{'type':Sequelize[_0xf5f2('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf5f2('0x2')]},'priority':{'type':Sequelize[_0xf5f2('0x2')]},'destchannel':{'type':Sequelize[_0xf5f2('0x2')]},'destchannelstate':{'type':Sequelize[_0xf5f2('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xf5f2('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf5f2('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xf5f2('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf5f2('0x2')]},'destlanguage':{'type':Sequelize[_0xf5f2('0x2')]},'destaccountcode':{'type':Sequelize[_0xf5f2('0x2')]},'destcontext':{'type':Sequelize[_0xf5f2('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xf5f2('0x2')]},'destuniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xf5f2('0x2')]},'transfer':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf5f2('0x2')],'comment':_0xf5f2('0x6')},'transferexten':{'type':Sequelize[_0xf5f2('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf5f2('0x2')]},'agententerreason':{'type':Sequelize[_0xf5f2('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c1d=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x219483,_0x552f66){var _0x334fd8=function(_0x3fdb67){while(--_0x3fdb67){_0x219483['push'](_0x219483['shift']());}};_0x334fd8(++_0x552f66);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x519327,_0x568002){_0x519327=_0x519327-0x0;var _0x221014=_0x9c1d[_0x519327];return _0x221014;};'use strict';var Sequelize=require(_0xd9c1('0x0'));module[_0xd9c1('0x1')]={'type':{'type':Sequelize[_0xd9c1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd9c1('0x2')]},'calleridname':{'type':Sequelize[_0xd9c1('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd9c1('0x2')]},'membername':{'type':Sequelize[_0xd9c1('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xd9c1('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd9c1('0x3')]},'holdtime':{'type':Sequelize[_0xd9c1('0x4')]},'agentcomplete':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd9c1('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd9c1('0x4')]},'reason':{'type':Sequelize[_0xd9c1('0x2')]},'lastevent':{'type':Sequelize[_0xd9c1('0x2')]},'channel':{'type':Sequelize[_0xd9c1('0x2')]},'channelstate':{'type':Sequelize[_0xd9c1('0x4')]},'channelstatedesc':{'type':Sequelize[_0xd9c1('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd9c1('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd9c1('0x2')]},'accountcode':{'type':Sequelize[_0xd9c1('0x2')]},'context':{'type':Sequelize[_0xd9c1('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd9c1('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd9c1('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd9c1('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd9c1('0x2')]},'destcalleridname':{'type':Sequelize[_0xd9c1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd9c1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd9c1('0x2')]},'destlanguage':{'type':Sequelize[_0xd9c1('0x2')]},'destaccountcode':{'type':Sequelize[_0xd9c1('0x2')]},'destcontext':{'type':Sequelize[_0xd9c1('0x2')]},'destexten':{'type':Sequelize[_0xd9c1('0x2')]},'destpriority':{'type':Sequelize[_0xd9c1('0x2')]},'destuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xd9c1('0x2')]},'transfer':{'type':Sequelize[_0xd9c1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd9c1('0x2')]},'transferuniqueid':{'type':Sequelize[_0xd9c1('0x2')]},'agententerreason':{'type':Sequelize[_0xd9c1('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 29bdff8..c3626f3 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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 3d1415a..20edce5 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 _0x950a=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','uniqueid','destuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x950a,0x111));var _0xa950=function(_0xa2c2e2,_0x535d90){_0xa2c2e2=_0xa2c2e2-0x0;var _0x3d7867=_0x950a[_0xa2c2e2];return _0x3d7867;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var logger=require(_0xa950('0x2'))(_0xa950('0x3'));var moment=require('moment');var BPromise=require(_0xa950('0x4'));var rp=require(_0xa950('0x5'));var fs=require('fs');var path=require(_0xa950('0x6'));var rimraf=require(_0xa950('0x7'));var config=require('../../config/environment');var attributes=require(_0xa950('0x8'));module[_0xa950('0x9')]=function(_0x512c0e,_0x14b4ac){return _0x512c0e[_0xa950('0xa')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xa950('0xb'),_0xa950('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9649=['util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash'];(function(_0x1214dd,_0x19090b){var _0x2cfd8a=function(_0x477d32){while(--_0x477d32){_0x1214dd['push'](_0x1214dd['shift']());}};_0x2cfd8a(++_0x19090b);}(_0x9649,0x19f));var _0x9964=function(_0x197e7e,_0x1c1bf0){_0x197e7e=_0x197e7e-0x0;var _0x48ecf2=_0x9649[_0x197e7e];return _0x48ecf2;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var logger=require(_0x9964('0x2'))(_0x9964('0x3'));var moment=require('moment');var BPromise=require(_0x9964('0x4'));var rp=require(_0x9964('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9964('0x6'));var config=require('../../config/environment');var attributes=require(_0x9964('0x7'));module[_0x9964('0x8')]=function(_0x12dd14,_0x74bec9){return _0x12dd14[_0x9964('0x9')](_0x9964('0xa'),attributes,{'tableName':_0x9964('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x9964('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 845fc8d..ee6b3d1 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 _0x579c=['request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result','VoiceAgentReport','create','options','raw','then','CreateVoiceAgentReport','stringify','catch','body','attributes','limit','UpdateVoiceAgentReport','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x296e35,_0xd0ceaf){var _0x2dbdeb=function(_0x5b27cd){while(--_0x5b27cd){_0x296e35['push'](_0x296e35['shift']());}};_0x2dbdeb(++_0xd0ceaf);}(_0x579c,0x175));var _0xc579=function(_0x1222ac,_0x10efcc){_0x1222ac=_0x1222ac-0x0;var _0x147e72=_0x579c[_0x1222ac];return _0x147e72;};'use strict';var _=require(_0xc579('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc579('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc579('0x2'));var db=require(_0xc579('0x3'))['db'];var utils=require(_0xc579('0x4'));var logger=require(_0xc579('0x5'))(_0xc579('0x6'));var config=require(_0xc579('0x7'));var jayson=require(_0xc579('0x8'));var client=jayson[_0xc579('0x9')][_0xc579('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe60a41,_0x1fe2cd,_0xdd68b4){return new BPromise(function(_0x5e3ad8,_0x2ac526){return client[_0xc579('0xb')](_0xe60a41,_0xdd68b4)['then'](function(_0x47441c){logger[_0xc579('0xc')](_0xc579('0xd'),_0x1fe2cd,_0xc579('0xe'));logger[_0xc579('0xf')](_0xc579('0x10'),_0x1fe2cd,'request\x20sent',JSON['stringify'](_0x47441c));if(_0x47441c[_0xc579('0x11')]){if(_0x47441c[_0xc579('0x11')]['code']===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x1fe2cd,_0x47441c['error'][_0xc579('0x12')]);return _0x2ac526(_0x47441c[_0xc579('0x11')]['message']);}logger[_0xc579('0x11')](_0xc579('0xd'),_0x1fe2cd,_0x47441c[_0xc579('0x11')][_0xc579('0x12')]);return _0x5e3ad8(_0x47441c[_0xc579('0x11')][_0xc579('0x12')]);}else{logger[_0xc579('0xc')](_0xc579('0xd'),_0x1fe2cd,'request\x20sent');_0x5e3ad8(_0x47441c[_0xc579('0x13')][_0xc579('0x12')]);}})['catch'](function(_0x413dfb){logger['error'](_0xc579('0xd'),_0x1fe2cd,_0x413dfb);_0x2ac526(_0x413dfb);});});}exports['CreateVoiceAgentReport']=function(_0x2fac18){var _0x137f8d=this;return new Promise(function(_0x193c01,_0x1381d9){return db[_0xc579('0x14')][_0xc579('0x15')](_0x2fac18['body'],{'raw':_0x2fac18[_0xc579('0x16')]?_0x2fac18[_0xc579('0x16')][_0xc579('0x17')]===undefined?!![]:![]:!![]})[_0xc579('0x18')](function(_0x4b6ff5){logger[_0xc579('0xc')](_0xc579('0x19'),_0x2fac18);logger[_0xc579('0xf')]('CreateVoiceAgentReport',_0x2fac18,JSON[_0xc579('0x1a')](_0x4b6ff5));_0x193c01(_0x4b6ff5);})[_0xc579('0x1b')](function(_0x40f019){logger[_0xc579('0x11')](_0xc579('0x19'),_0x40f019[_0xc579('0x12')],_0x2fac18);_0x1381d9(_0x137f8d['error'](0x1f4,_0x40f019['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x872bb4){var _0x2c75d9=this;return new Promise(function(_0xcc45d8,_0x5aeee8){return db[_0xc579('0x14')]['update'](_0x872bb4[_0xc579('0x1c')],{'raw':_0x872bb4[_0xc579('0x16')]?_0x872bb4['options'][_0xc579('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x872bb4[_0xc579('0x16')]?_0x872bb4[_0xc579('0x16')]['where']||null:null,'attributes':_0x872bb4['options']?_0x872bb4[_0xc579('0x16')][_0xc579('0x1d')]||null:null,'limit':_0x872bb4[_0xc579('0x16')]?_0x872bb4[_0xc579('0x16')][_0xc579('0x1e')]||null:null})['then'](function(_0x6fc281){logger['info']('UpdateVoiceAgentReport',_0x872bb4);logger[_0xc579('0xf')]('UpdateVoiceAgentReport',_0x872bb4,JSON['stringify'](_0x6fc281));_0xcc45d8(_0x6fc281);})[_0xc579('0x1b')](function(_0x5cdc00){logger[_0xc579('0x11')](_0xc579('0x1f'),_0x5cdc00[_0xc579('0x12')],_0x872bb4);_0x5aeee8(_0x2c75d9['error'](0x1f4,_0x5cdc00[_0xc579('0x12')]));});});}; \ No newline at end of file +var _0x02a3=['where','attributes','limit','UpdateVoiceAgentReport','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','VoiceAgentReport','create','options','raw','CreateVoiceAgentReport','body'];(function(_0x185c4c,_0x3f9923){var _0x584882=function(_0x3bf6ff){while(--_0x3bf6ff){_0x185c4c['push'](_0x185c4c['shift']());}};_0x584882(++_0x3f9923);}(_0x02a3,0x1a9));var _0x302a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x02a3[_0x4d613c];return _0x301fe3;};'use strict';var _=require('lodash');var util=require(_0x302a('0x0'));var moment=require(_0x302a('0x1'));var BPromise=require(_0x302a('0x2'));var rs=require(_0x302a('0x3'));var fs=require('fs');var Redis=require(_0x302a('0x4'));var db=require(_0x302a('0x5'))['db'];var utils=require(_0x302a('0x6'));var logger=require(_0x302a('0x7'))(_0x302a('0x8'));var config=require('../../config/environment');var jayson=require(_0x302a('0x9'));var client=jayson[_0x302a('0xa')][_0x302a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35f5e2,_0x418879,_0x445989){return new BPromise(function(_0x328db4,_0x2a54f8){return client[_0x302a('0xc')](_0x35f5e2,_0x445989)[_0x302a('0xd')](function(_0x5d8056){logger[_0x302a('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x418879,_0x302a('0xf'));logger[_0x302a('0x10')](_0x302a('0x11'),_0x418879,_0x302a('0xf'),JSON['stringify'](_0x5d8056));if(_0x5d8056[_0x302a('0x12')]){if(_0x5d8056[_0x302a('0x12')][_0x302a('0x13')]===0x1f4){logger[_0x302a('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x418879,_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);return _0x2a54f8(_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);}logger[_0x302a('0x12')](_0x302a('0x15'),_0x418879,_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);return _0x328db4(_0x5d8056[_0x302a('0x12')][_0x302a('0x14')]);}else{logger[_0x302a('0xe')](_0x302a('0x15'),_0x418879,'request\x20sent');_0x328db4(_0x5d8056[_0x302a('0x16')][_0x302a('0x14')]);}})[_0x302a('0x17')](function(_0x3fc4d7){logger['error'](_0x302a('0x15'),_0x418879,_0x3fc4d7);_0x2a54f8(_0x3fc4d7);});});}exports['CreateVoiceAgentReport']=function(_0x27d7a6){var _0x2aefe6=this;return new Promise(function(_0x2a763e,_0x1cef13){return db[_0x302a('0x18')][_0x302a('0x19')](_0x27d7a6['body'],{'raw':_0x27d7a6['options']?_0x27d7a6[_0x302a('0x1a')][_0x302a('0x1b')]===undefined?!![]:![]:!![]})[_0x302a('0xd')](function(_0x3b7542){logger[_0x302a('0xe')](_0x302a('0x1c'),_0x27d7a6);logger['debug'](_0x302a('0x1c'),_0x27d7a6,JSON['stringify'](_0x3b7542));_0x2a763e(_0x3b7542);})[_0x302a('0x17')](function(_0x405339){logger[_0x302a('0x12')](_0x302a('0x1c'),_0x405339[_0x302a('0x14')],_0x27d7a6);_0x1cef13(_0x2aefe6['error'](0x1f4,_0x405339[_0x302a('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x41d0b5){var _0x48577f=this;return new Promise(function(_0x324041,_0x5d62f8){return db[_0x302a('0x18')]['update'](_0x41d0b5[_0x302a('0x1d')],{'raw':_0x41d0b5['options']?_0x41d0b5[_0x302a('0x1a')][_0x302a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41d0b5[_0x302a('0x1a')]?_0x41d0b5['options'][_0x302a('0x1e')]||null:null,'attributes':_0x41d0b5['options']?_0x41d0b5[_0x302a('0x1a')][_0x302a('0x1f')]||null:null,'limit':_0x41d0b5['options']?_0x41d0b5['options'][_0x302a('0x20')]||null:null})[_0x302a('0xd')](function(_0x1d3a29){logger[_0x302a('0xe')](_0x302a('0x21'),_0x41d0b5);logger[_0x302a('0x10')]('UpdateVoiceAgentReport',_0x41d0b5,JSON[_0x302a('0x22')](_0x1d3a29));_0x324041(_0x1d3a29);})[_0x302a('0x17')](function(_0x20ef7b){logger[_0x302a('0x12')](_0x302a('0x21'),_0x20ef7b[_0x302a('0x14')],_0x41d0b5);_0x5d62f8(_0x48577f[_0x302a('0x12')](0x1f4,_0x20ef7b[_0x302a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index d750022..e8e6545 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 _0xe14b=['delete','destroy','exports','multer','util','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','show','post','/:id'];(function(_0x2f0c62,_0x56a49){var _0x430a79=function(_0x5c5458){while(--_0x5c5458){_0x2f0c62['push'](_0x2f0c62['shift']());}};_0x430a79(++_0x56a49);}(_0xe14b,0x93));var _0xbe14=function(_0x30ec29,_0x1456f3){_0x30ec29=_0x30ec29-0x0;var _0xaedd9a=_0xe14b[_0x30ec29];return _0xaedd9a;};'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('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xd')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xe')]);module[_0xbe14('0xf')]=router; \ No newline at end of file +var _0xc3b5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports','path','connect-timeout','express'];(function(_0x2be187,_0x4abbf0){var _0x5bf334=function(_0xfe9ae6){while(--_0xfe9ae6){_0x2be187['push'](_0x2be187['shift']());}};_0x5bf334(++_0x4abbf0);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x40bc31,_0x48a243){_0x40bc31=_0x40bc31-0x0;var _0x30f10e=_0xc3b5[_0x40bc31];return _0x30f10e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require(_0x5c3b('0x2'));var router=express[_0x5c3b('0x3')]();var fs_extra=require(_0x5c3b('0x4'));var auth=require(_0x5c3b('0x5'));var interaction=require(_0x5c3b('0x6'));var config=require(_0x5c3b('0x7'));var controller=require('./voiceCallReport.controller');router[_0x5c3b('0x8')]('/',auth[_0x5c3b('0x9')](),controller['index']);router[_0x5c3b('0x8')](_0x5c3b('0xa'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xb')]);router['get'](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0xd')]);router[_0x5c3b('0xe')]('/',auth['isAuthenticated'](),controller[_0x5c3b('0xf')]);router[_0x5c3b('0x10')](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller[_0x5c3b('0x11')]);router['delete'](_0x5c3b('0xc'),auth[_0x5c3b('0x9')](),controller['destroy']);module[_0x5c3b('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b33224c..9ccf59f 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 _0x94c9=['dialer','DATE','INTEGER','sequelize','exports','STRING','inbound','outbound','inbound-fax','outbound-fax'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x94c9,0x1a7));var _0x994c=function(_0x353e63,_0x5f3e65){_0x353e63=_0x353e63-0x0;var _0x283819=_0x94c9[_0x353e63];return _0x283819;};'use strict';var Sequelize=require(_0x994c('0x0'));module[_0x994c('0x1')]={'uniqueid':{'type':Sequelize[_0x994c('0x2')]},'type':{'type':Sequelize['ENUM'](_0x994c('0x3'),'internal',_0x994c('0x4'),_0x994c('0x5'),_0x994c('0x6'),_0x994c('0x7'))},'tag':{'type':Sequelize[_0x994c('0x2')]},'accountcode':{'type':Sequelize[_0x994c('0x2')]},'source':{'type':Sequelize[_0x994c('0x2')]},'destination':{'type':Sequelize[_0x994c('0x2')]},'destinationcontext':{'type':Sequelize[_0x994c('0x2')]},'callerid':{'type':Sequelize[_0x994c('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x994c('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x994c('0x8')]},'answertime':{'type':Sequelize[_0x994c('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x994c('0x9')]},'billableseconds':{'type':Sequelize[_0x994c('0x9')]},'mohtime':{'type':Sequelize[_0x994c('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x994c('0x2')]},'amaflags':{'type':Sequelize[_0x994c('0x2')]},'userfield':{'type':Sequelize[_0x994c('0x2')]},'userDisposition':{'type':Sequelize[_0x994c('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x994c('0x2')]},'note':{'type':Sequelize[_0x994c('0x2')]},'prefix':{'type':Sequelize[_0x994c('0x2')]},'routeid':{'type':Sequelize[_0x994c('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe8f9=['inbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING','ENUM','inbound','internal','outbound'];(function(_0x15b75c,_0x52f837){var _0x1fb570=function(_0x176eec){while(--_0x176eec){_0x15b75c['push'](_0x15b75c['shift']());}};_0x1fb570(++_0x52f837);}(_0xe8f9,0x73));var _0x9e8f=function(_0x43afda,_0x432a32){_0x43afda=_0x43afda-0x0;var _0x20e8e5=_0xe8f9[_0x43afda];return _0x20e8e5;};'use strict';var Sequelize=require('sequelize');module[_0x9e8f('0x0')]={'uniqueid':{'type':Sequelize[_0x9e8f('0x1')]},'type':{'type':Sequelize[_0x9e8f('0x2')](_0x9e8f('0x3'),_0x9e8f('0x4'),_0x9e8f('0x5'),_0x9e8f('0x6'),'outbound-fax',_0x9e8f('0x7'))},'tag':{'type':Sequelize[_0x9e8f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x9e8f('0x1')]},'destination':{'type':Sequelize[_0x9e8f('0x1')]},'destinationcontext':{'type':Sequelize[_0x9e8f('0x1')]},'callerid':{'type':Sequelize[_0x9e8f('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x9e8f('0x1')]},'lastapplication':{'type':Sequelize[_0x9e8f('0x1')]},'lastdata':{'type':Sequelize[_0x9e8f('0x8')]},'starttime':{'type':Sequelize[_0x9e8f('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9e8f('0x9')]},'endtime':{'type':Sequelize[_0x9e8f('0x9')]},'duration':{'type':Sequelize[_0x9e8f('0xa')]},'billableseconds':{'type':Sequelize[_0x9e8f('0xa')]},'mohtime':{'type':Sequelize[_0x9e8f('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9e8f('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9e8f('0x1')]},'userDisposition':{'type':Sequelize[_0x9e8f('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x9e8f('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x9e8f('0x1')]},'note':{'type':Sequelize[_0x9e8f('0x1')]},'prefix':{'type':Sequelize[_0x9e8f('0x1')]},'routeid':{'type':Sequelize[_0x9e8f('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b889766..0fb89a6 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0x2ef3,0xba));var _0x32ef=function(_0x5b7be4,_0x2ee709){_0x5b7be4=_0x5b7be4-0x0;var _0x49f161=_0x2ef3[_0x5b7be4];return _0x49f161;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x5ebf44,_0x4e543e){var _0x2fef12=function(_0x59d629){while(--_0x59d629){_0x5ebf44['push'](_0x5ebf44['shift']());}};_0x2fef12(++_0x4e543e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x179388,_0x4c4ce3){_0x179388=_0x179388-0x0;var _0xaa9a2f=_0x5f2f[_0x179388];return _0xaa9a2f;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c12197b..1782e56 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 _0xf9db=['VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf9db,0x189));var _0xbf9d=function(_0x4d9fb0,_0x447fd0){_0x4d9fb0=_0x4d9fb0-0x0;var _0x5240f3=_0xf9db[_0x4d9fb0];return _0x5240f3;};'use strict';var _=require(_0xbf9d('0x0'));var util=require(_0xbf9d('0x1'));var logger=require(_0xbf9d('0x2'))(_0xbf9d('0x3'));var moment=require(_0xbf9d('0x4'));var BPromise=require(_0xbf9d('0x5'));var rp=require(_0xbf9d('0x6'));var fs=require('fs');var path=require(_0xbf9d('0x7'));var rimraf=require(_0xbf9d('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf9d('0x9'));module[_0xbf9d('0xa')]=function(_0x3aba8d,_0x39c670){return _0x3aba8d[_0xbf9d('0xb')](_0xbf9d('0xc'),attributes,{'tableName':_0xbf9d('0xd'),'paranoid':![],'indexes':[{'fields':[_0xbf9d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e16=['VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4e16,0x1ee));var _0x64e1=function(_0x5b3e50,_0xa7a3cb){_0x5b3e50=_0x5b3e50-0x0;var _0x89a0c9=_0x4e16[_0x5b3e50];return _0x89a0c9;};'use strict';var _=require(_0x64e1('0x0'));var util=require(_0x64e1('0x1'));var logger=require(_0x64e1('0x2'))(_0x64e1('0x3'));var moment=require(_0x64e1('0x4'));var BPromise=require('bluebird');var rp=require(_0x64e1('0x5'));var fs=require('fs');var path=require(_0x64e1('0x6'));var rimraf=require(_0x64e1('0x7'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x64e1('0x8')]=function(_0x58dad6,_0x4f05ae){return _0x58dad6[_0x64e1('0x9')](_0x64e1('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x64e1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index f67051f..a688b4b 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 _0xef62=['http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','GetVoiceCallReport','options','raw','attributes','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','stringify','UpdateVoiceCallReport','update','body','where','limit','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x414124,_0x379e77){var _0x21b891=function(_0x3101cf){while(--_0x3101cf){_0x414124['push'](_0x414124['shift']());}};_0x21b891(++_0x379e77);}(_0xef62,0x1b3));var _0x2ef6=function(_0x5c7798,_0x5327af){_0x5c7798=_0x5c7798-0x0;var _0x154a57=_0xef62[_0x5c7798];return _0x154a57;};'use strict';var _=require(_0x2ef6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ef6('0x1'));var db=require(_0x2ef6('0x2'))['db'];var utils=require(_0x2ef6('0x3'));var logger=require(_0x2ef6('0x4'))('rpc');var config=require(_0x2ef6('0x5'));var jayson=require(_0x2ef6('0x6'));var client=jayson['client'][_0x2ef6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x46b0a6,_0x434314,_0x358044){return new BPromise(function(_0x25570a,_0x2202a3){return client[_0x2ef6('0x8')](_0x46b0a6,_0x358044)[_0x2ef6('0x9')](function(_0x585eab){logger[_0x2ef6('0xa')](_0x2ef6('0xb'),_0x434314,'request\x20sent');logger[_0x2ef6('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x434314,_0x2ef6('0xd'),JSON['stringify'](_0x585eab));if(_0x585eab[_0x2ef6('0xe')]){if(_0x585eab['error']['code']===0x1f4){logger['error'](_0x2ef6('0xb'),_0x434314,_0x585eab[_0x2ef6('0xe')]['message']);return _0x2202a3(_0x585eab[_0x2ef6('0xe')][_0x2ef6('0xf')]);}logger[_0x2ef6('0xe')](_0x2ef6('0xb'),_0x434314,_0x585eab['error'][_0x2ef6('0xf')]);return _0x25570a(_0x585eab[_0x2ef6('0xe')][_0x2ef6('0xf')]);}else{logger['info'](_0x2ef6('0xb'),_0x434314,_0x2ef6('0xd'));_0x25570a(_0x585eab[_0x2ef6('0x10')]['message']);}})[_0x2ef6('0x11')](function(_0x387ee4){logger[_0x2ef6('0xe')](_0x2ef6('0xb'),_0x434314,_0x387ee4);_0x2202a3(_0x387ee4);});});}exports[_0x2ef6('0x12')]=function(_0x25c3b0){var _0x1d6dfc=this;return new Promise(function(_0x469afe,_0x498e0b){return db['VoiceCallReport']['findAll']({'raw':_0x25c3b0['options']?_0x25c3b0[_0x2ef6('0x13')][_0x2ef6('0x14')]===undefined?!![]:![]:!![],'where':_0x25c3b0[_0x2ef6('0x13')]?_0x25c3b0[_0x2ef6('0x13')]['where']||null:null,'attributes':_0x25c3b0[_0x2ef6('0x13')]?_0x25c3b0['options'][_0x2ef6('0x15')]||null:null,'limit':_0x25c3b0[_0x2ef6('0x13')]?_0x25c3b0[_0x2ef6('0x13')]['limit']||null:null,'include':_0x25c3b0[_0x2ef6('0x13')]?_0x25c3b0[_0x2ef6('0x13')][_0x2ef6('0x16')]?_[_0x2ef6('0x17')](_0x25c3b0[_0x2ef6('0x13')][_0x2ef6('0x16')],function(_0x42594b){return{'model':db[_0x42594b[_0x2ef6('0x18')]],'as':_0x42594b['as'],'attributes':_0x42594b[_0x2ef6('0x15')],'include':_0x42594b['include']?_[_0x2ef6('0x17')](_0x42594b[_0x2ef6('0x16')],function(_0x1309e1){return{'model':db[_0x1309e1[_0x2ef6('0x18')]],'as':_0x1309e1['as'],'attributes':_0x1309e1[_0x2ef6('0x15')],'include':_0x1309e1[_0x2ef6('0x16')]?_[_0x2ef6('0x17')](_0x1309e1[_0x2ef6('0x16')],function(_0x213b46){return{'model':db[_0x213b46['model']],'as':_0x213b46['as'],'attributes':_0x213b46['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ef6('0x9')](function(_0x36d149){logger[_0x2ef6('0xa')](_0x2ef6('0x12'),_0x25c3b0);logger['debug'](_0x2ef6('0x12'),_0x25c3b0,JSON['stringify'](_0x36d149));_0x469afe(_0x36d149);})['catch'](function(_0x36f104){logger[_0x2ef6('0xe')]('GetVoiceCallReport',_0x36f104[_0x2ef6('0xf')],_0x25c3b0);_0x498e0b(_0x1d6dfc[_0x2ef6('0xe')](0x1f4,_0x36f104[_0x2ef6('0xf')]));});});};exports[_0x2ef6('0x19')]=function(_0xe831fa){var _0x52a8a6=this;return new Promise(function(_0x3bdc88,_0x3f462a){return db[_0x2ef6('0x1a')][_0x2ef6('0x1b')](_0xe831fa['body'],{'raw':_0xe831fa['options']?_0xe831fa[_0x2ef6('0x13')][_0x2ef6('0x14')]===undefined?!![]:![]:!![]})[_0x2ef6('0x9')](function(_0x486cb5){logger[_0x2ef6('0xa')](_0x2ef6('0x19'),_0xe831fa);logger[_0x2ef6('0xc')]('CreateVoiceCallReport',_0xe831fa,JSON[_0x2ef6('0x1c')](_0x486cb5));_0x3bdc88(_0x486cb5);})[_0x2ef6('0x11')](function(_0x4faa3e){logger['error']('CreateVoiceCallReport',_0x4faa3e['message'],_0xe831fa);_0x3f462a(_0x52a8a6['error'](0x1f4,_0x4faa3e['message']));});});};exports[_0x2ef6('0x1d')]=function(_0x51cfc8){var _0x1a586b=this;return new Promise(function(_0x48ed1c,_0x1e39f9){return db[_0x2ef6('0x1a')][_0x2ef6('0x1e')](_0x51cfc8[_0x2ef6('0x1f')],{'raw':_0x51cfc8[_0x2ef6('0x13')]?_0x51cfc8[_0x2ef6('0x13')][_0x2ef6('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51cfc8[_0x2ef6('0x13')]?_0x51cfc8[_0x2ef6('0x13')][_0x2ef6('0x20')]||null:null,'attributes':_0x51cfc8[_0x2ef6('0x13')]?_0x51cfc8['options'][_0x2ef6('0x15')]||null:null,'limit':_0x51cfc8[_0x2ef6('0x13')]?_0x51cfc8['options'][_0x2ef6('0x21')]||null:null})[_0x2ef6('0x9')](function(_0x3d68a0){logger['info']('UpdateVoiceCallReport',_0x51cfc8);logger[_0x2ef6('0xc')](_0x2ef6('0x1d'),_0x51cfc8,JSON[_0x2ef6('0x1c')](_0x3d68a0));_0x48ed1c(_0x3d68a0);})[_0x2ef6('0x11')](function(_0xd7818d){logger[_0x2ef6('0xe')](_0x2ef6('0x1d'),_0xd7818d[_0x2ef6('0xf')],_0x51cfc8);_0x1e39f9(_0x1a586b[_0x2ef6('0xe')](0x1f4,_0xd7818d[_0x2ef6('0xf')]));});});}; \ No newline at end of file +var _0x4094=['../../config/environment','http','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','include','model','attributes','map','CreateVoiceCallReport','create','update','body','UpdateVoiceCallReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3f2981,_0x5d9e82){var _0x4ae493=function(_0x53537c){while(--_0x53537c){_0x3f2981['push'](_0x3f2981['shift']());}};_0x4ae493(++_0x5d9e82);}(_0x4094,0x174));var _0x4409=function(_0x1086ef,_0x5cc2c9){_0x1086ef=_0x1086ef-0x0;var _0x56a797=_0x4094[_0x1086ef];return _0x56a797;};'use strict';var _=require(_0x4409('0x0'));var util=require(_0x4409('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4409('0x2'));var fs=require('fs');var Redis=require(_0x4409('0x3'));var db=require(_0x4409('0x4'))['db'];var utils=require(_0x4409('0x5'));var logger=require(_0x4409('0x6'))(_0x4409('0x7'));var config=require(_0x4409('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4409('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fc53e,_0x35cbb0,_0x40e6fc){return new BPromise(function(_0x2962e3,_0x4e862a){return client['request'](_0x1fc53e,_0x40e6fc)[_0x4409('0xa')](function(_0x18436b){logger[_0x4409('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x35cbb0,'request\x20sent');logger[_0x4409('0xc')](_0x4409('0xd'),_0x35cbb0,'request\x20sent',JSON[_0x4409('0xe')](_0x18436b));if(_0x18436b['error']){if(_0x18436b[_0x4409('0xf')][_0x4409('0x10')]===0x1f4){logger[_0x4409('0xf')](_0x4409('0x11'),_0x35cbb0,_0x18436b['error'][_0x4409('0x12')]);return _0x4e862a(_0x18436b[_0x4409('0xf')][_0x4409('0x12')]);}logger[_0x4409('0xf')](_0x4409('0x11'),_0x35cbb0,_0x18436b[_0x4409('0xf')][_0x4409('0x12')]);return _0x2962e3(_0x18436b[_0x4409('0xf')][_0x4409('0x12')]);}else{logger['info'](_0x4409('0x11'),_0x35cbb0,_0x4409('0x13'));_0x2962e3(_0x18436b[_0x4409('0x14')][_0x4409('0x12')]);}})[_0x4409('0x15')](function(_0x4a937d){logger['error'](_0x4409('0x11'),_0x35cbb0,_0x4a937d);_0x4e862a(_0x4a937d);});});}exports[_0x4409('0x16')]=function(_0x6b893f){var _0xfb12f9=this;return new Promise(function(_0x24acf7,_0x4aa909){return db[_0x4409('0x17')][_0x4409('0x18')]({'raw':_0x6b893f[_0x4409('0x19')]?_0x6b893f['options'][_0x4409('0x1a')]===undefined?!![]:![]:!![],'where':_0x6b893f[_0x4409('0x19')]?_0x6b893f[_0x4409('0x19')][_0x4409('0x1b')]||null:null,'attributes':_0x6b893f[_0x4409('0x19')]?_0x6b893f[_0x4409('0x19')]['attributes']||null:null,'limit':_0x6b893f['options']?_0x6b893f[_0x4409('0x19')][_0x4409('0x1c')]||null:null,'include':_0x6b893f[_0x4409('0x19')]?_0x6b893f[_0x4409('0x19')][_0x4409('0x1d')]?_['map'](_0x6b893f[_0x4409('0x19')][_0x4409('0x1d')],function(_0x1dc713){return{'model':db[_0x1dc713['model']],'as':_0x1dc713['as'],'attributes':_0x1dc713['attributes'],'include':_0x1dc713[_0x4409('0x1d')]?_['map'](_0x1dc713[_0x4409('0x1d')],function(_0x5acb31){return{'model':db[_0x5acb31[_0x4409('0x1e')]],'as':_0x5acb31['as'],'attributes':_0x5acb31[_0x4409('0x1f')],'include':_0x5acb31[_0x4409('0x1d')]?_[_0x4409('0x20')](_0x5acb31[_0x4409('0x1d')],function(_0x559fe3){return{'model':db[_0x559fe3[_0x4409('0x1e')]],'as':_0x559fe3['as'],'attributes':_0x559fe3[_0x4409('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x196ec8){logger['info'](_0x4409('0x16'),_0x6b893f);logger[_0x4409('0xc')]('GetVoiceCallReport',_0x6b893f,JSON[_0x4409('0xe')](_0x196ec8));_0x24acf7(_0x196ec8);})['catch'](function(_0x19f800){logger[_0x4409('0xf')](_0x4409('0x16'),_0x19f800['message'],_0x6b893f);_0x4aa909(_0xfb12f9[_0x4409('0xf')](0x1f4,_0x19f800[_0x4409('0x12')]));});});};exports[_0x4409('0x21')]=function(_0x493ec9){var _0x531632=this;return new Promise(function(_0x5d44d4,_0x108aef){return db[_0x4409('0x17')][_0x4409('0x22')](_0x493ec9['body'],{'raw':_0x493ec9[_0x4409('0x19')]?_0x493ec9[_0x4409('0x19')][_0x4409('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xcdf71){logger[_0x4409('0xb')]('CreateVoiceCallReport',_0x493ec9);logger[_0x4409('0xc')](_0x4409('0x21'),_0x493ec9,JSON[_0x4409('0xe')](_0xcdf71));_0x5d44d4(_0xcdf71);})[_0x4409('0x15')](function(_0xb5999e){logger['error']('CreateVoiceCallReport',_0xb5999e['message'],_0x493ec9);_0x108aef(_0x531632[_0x4409('0xf')](0x1f4,_0xb5999e[_0x4409('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x4e6b2d){var _0x50ef85=this;return new Promise(function(_0x138c16,_0x2051d0){return db[_0x4409('0x17')][_0x4409('0x23')](_0x4e6b2d[_0x4409('0x24')],{'raw':_0x4e6b2d[_0x4409('0x19')]?_0x4e6b2d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e6b2d[_0x4409('0x19')]?_0x4e6b2d[_0x4409('0x19')][_0x4409('0x1b')]||null:null,'attributes':_0x4e6b2d['options']?_0x4e6b2d['options'][_0x4409('0x1f')]||null:null,'limit':_0x4e6b2d[_0x4409('0x19')]?_0x4e6b2d['options'][_0x4409('0x1c')]||null:null})[_0x4409('0xa')](function(_0x4f7be3){logger[_0x4409('0xb')](_0x4409('0x25'),_0x4e6b2d);logger[_0x4409('0xc')](_0x4409('0x25'),_0x4e6b2d,JSON[_0x4409('0xe')](_0x4f7be3));_0x138c16(_0x4f7be3);})[_0x4409('0x15')](function(_0x57617c){logger[_0x4409('0xf')](_0x4409('0x25'),_0x57617c[_0x4409('0x12')],_0x4e6b2d);_0x2051d0(_0x50ef85[_0x4409('0xf')](0x1f4,_0x57617c[_0x4409('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 901fc75..c183284 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 _0x2004=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x10dfdf,_0x36b623){var _0x4d857d=function(_0x4683ee){while(--_0x4683ee){_0x10dfdf['push'](_0x10dfdf['shift']());}};_0x4d857d(++_0x36b623);}(_0x2004,0x13f));var _0x4200=function(_0xda9464,_0x5a65fd){_0xda9464=_0xda9464-0x0;var _0x83dc5e=_0x2004[_0xda9464];return _0x83dc5e;};'use strict';var multer=require(_0x4200('0x0'));var util=require(_0x4200('0x1'));var path=require(_0x4200('0x2'));var timeout=require(_0x4200('0x3'));var express=require(_0x4200('0x4'));var router=express[_0x4200('0x5')]();var fs_extra=require(_0x4200('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4200('0x7'));var config=require(_0x4200('0x8'));var controller=require(_0x4200('0x9'));router['get']('/',auth[_0x4200('0xa')](),controller[_0x4200('0xb')]);router[_0x4200('0xc')](_0x4200('0xd'),auth[_0x4200('0xa')](),controller[_0x4200('0xe')]);router[_0x4200('0xf')]('/',auth[_0x4200('0xa')](),controller[_0x4200('0x10')]);router[_0x4200('0x11')](_0x4200('0xd'),auth[_0x4200('0xa')](),controller[_0x4200('0x12')]);router[_0x4200('0x13')](_0x4200('0xd'),auth[_0x4200('0xa')](),controller['destroy']);module[_0x4200('0x14')]=router; \ No newline at end of file +var _0xcdd0=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','put','update','delete'];(function(_0x12c914,_0x662ecc){var _0x10700d=function(_0x162178){while(--_0x162178){_0x12c914['push'](_0x12c914['shift']());}};_0x10700d(++_0x662ecc);}(_0xcdd0,0x88));var _0x0cdd=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xcdd0[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var path=require('path');var timeout=require(_0x0cdd('0x2'));var express=require(_0x0cdd('0x3'));var router=express[_0x0cdd('0x4')]();var fs_extra=require(_0x0cdd('0x5'));var auth=require(_0x0cdd('0x6'));var interaction=require(_0x0cdd('0x7'));var config=require('../../config/environment');var controller=require(_0x0cdd('0x8'));router[_0x0cdd('0x9')]('/',auth[_0x0cdd('0xa')](),controller[_0x0cdd('0xb')]);router[_0x0cdd('0x9')](_0x0cdd('0xc'),auth[_0x0cdd('0xa')](),controller[_0x0cdd('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0cdd('0xe')](_0x0cdd('0xc'),auth[_0x0cdd('0xa')](),controller[_0x0cdd('0xf')]);router[_0x0cdd('0x10')](_0x0cdd('0xc'),auth[_0x0cdd('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 129b449..2a37529 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 _0xc66a=['BOOLEAN','exports','STRING','options','getDataValue','split'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0xc66a,0xeb));var _0xac66=function(_0x28b1c9,_0x39a7ee){_0x28b1c9=_0x28b1c9-0x0;var _0x19fb13=_0xc66a[_0x28b1c9];return _0x19fb13;};'use strict';var Sequelize=require('sequelize');module[_0xac66('0x0')]={'name':{'type':Sequelize[_0xac66('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xac66('0x1')],'set':function(_0x2e2f4c){this['setDataValue'](_0xac66('0x2'),_0x2e2f4c?_0x2e2f4c['join'](''):[]);},'get':function(){return this[_0xac66('0x3')](_0xac66('0x2'))?this[_0xac66('0x3')](_0xac66('0x2'))[_0xac66('0x4')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xac66('0x1')]},'record':{'type':Sequelize[_0xac66('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa3c4=['options','BOOLEAN','exports','STRING','setDataValue','join','getDataValue'];(function(_0x25a08b,_0x3df98d){var _0x2bf414=function(_0x1d39f2){while(--_0x1d39f2){_0x25a08b['push'](_0x25a08b['shift']());}};_0x2bf414(++_0x3df98d);}(_0xa3c4,0x152));var _0x4a3c=function(_0xb1378c,_0x5947){_0xb1378c=_0xb1378c-0x0;var _0x3a3d2a=_0xa3c4[_0xb1378c];return _0x3a3d2a;};'use strict';var Sequelize=require('sequelize');module[_0x4a3c('0x0')]={'name':{'type':Sequelize[_0x4a3c('0x1')]},'prefix':{'type':Sequelize[_0x4a3c('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x4a3c('0x1')],'set':function(_0x3325e8){this[_0x4a3c('0x2')]('options',_0x3325e8?_0x3325e8[_0x4a3c('0x3')](''):[]);},'get':function(){return this[_0x4a3c('0x4')](_0x4a3c('0x5'))?this[_0x4a3c('0x4')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x4a3c('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x4a3c('0x1')]},'record':{'type':Sequelize[_0x4a3c('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4a3c('0x1')]},'description':{'type':Sequelize[_0x4a3c('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 75b25ae..e795b1d 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 _0x12c9=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ChanSpies','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise'];(function(_0x2d9e15,_0xb31a54){var _0x365289=function(_0x3d3b10){while(--_0x3d3b10){_0x2d9e15['push'](_0x2d9e15['shift']());}};_0x365289(++_0xb31a54);}(_0x12c9,0x9f));var _0x912c=function(_0x4c2ec5,_0x5db075){_0x4c2ec5=_0x4c2ec5-0x0;var _0x1494a0=_0x12c9[_0x4c2ec5];return _0x1494a0;};'use strict';var emlformat=require(_0x912c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x912c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x912c('0x2'));var moment=require('moment');var BPromise=require(_0x912c('0x3'));var Mustache=require(_0x912c('0x4'));var util=require(_0x912c('0x5'));var path=require(_0x912c('0x6'));var sox=require(_0x912c('0x7'));var csv=require(_0x912c('0x8'));var ejs=require(_0x912c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x912c('0xa'));var squel=require(_0x912c('0xb'));var crypto=require(_0x912c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x912c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x912c('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x912c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x912c('0x10'))(_0x912c('0x11'));var utils=require(_0x912c('0x12'));var config=require(_0x912c('0x13'));var licenseUtil=require(_0x912c('0x14'));var db=require(_0x912c('0x15'))['db'];function respondWithStatusCode(_0x23b282,_0x5644a5){_0x5644a5=_0x5644a5||0xcc;return function(_0x268b42){if(_0x268b42){return _0x23b282[_0x912c('0x16')](_0x5644a5);}return _0x23b282[_0x912c('0x17')](_0x5644a5)['end']();};}function respondWithResult(_0x48b041,_0x1cd77b){_0x1cd77b=_0x1cd77b||0xc8;return function(_0x28142d){if(_0x28142d){return _0x48b041['status'](_0x1cd77b)[_0x912c('0x18')](_0x28142d);}};}function respondWithFilteredResult(_0x2c2232,_0x55ae08){return function(_0x4f0c33){if(_0x4f0c33){var _0x114cf=typeof _0x55ae08[_0x912c('0x19')]===_0x912c('0x1a')&&typeof _0x55ae08['limit']===_0x912c('0x1a');var _0x468ad2=_0x4f0c33[_0x912c('0x1b')];var _0x25b3d6=_0x114cf?0x0:_0x55ae08['offset'];var _0x46d34c=_0x114cf?_0x4f0c33[_0x912c('0x1b')]:_0x55ae08[_0x912c('0x19')]+_0x55ae08[_0x912c('0x1c')];var _0x562156;if(_0x46d34c>=_0x468ad2){_0x46d34c=_0x468ad2;_0x562156=0xc8;}else{_0x562156=0xce;}_0x2c2232[_0x912c('0x17')](_0x562156);return _0x2c2232[_0x912c('0x1d')](_0x912c('0x1e'),_0x25b3d6+'-'+_0x46d34c+'/'+_0x468ad2)[_0x912c('0x18')](_0x4f0c33);}return null;};}function patchUpdates(_0x551576){return function(_0x2a41a2){try{jsonpatch[_0x912c('0x1f')](_0x2a41a2,_0x551576,!![]);}catch(_0xbca0af){return BPromise[_0x912c('0x20')](_0xbca0af);}return _0x2a41a2['save']();};}function saveUpdates(_0x4f6272,_0x27f644){return function(_0x2eb96b){if(_0x2eb96b){return _0x2eb96b[_0x912c('0x21')](_0x4f6272)[_0x912c('0x22')](function(_0x534cd2){return _0x534cd2;});}return null;};}function removeEntity(_0x35d2f3,_0x16bf68){return function(_0x4e79ba){if(_0x4e79ba){return _0x4e79ba[_0x912c('0x23')]()[_0x912c('0x22')](function(){var _0x5e2bea=_0x4e79ba[_0x912c('0x24')]({'plain':!![]});var _0x59a7a2='ChanSpies';return db[_0x912c('0x25')][_0x912c('0x23')]({'where':{'type':_0x59a7a2,'resourceId':_0x5e2bea['id']}})['then'](function(){return _0x4e79ba;});})['then'](function(){_0x35d2f3[_0x912c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b614,_0x269283){return function(_0xd46b89){if(!_0xd46b89){_0x46b614[_0x912c('0x16')](0x194);}return _0xd46b89;};}function handleError(_0x8746a7,_0xb626a){_0xb626a=_0xb626a||0x1f4;return function(_0x344e6d){logger[_0x912c('0x26')](_0x344e6d[_0x912c('0x27')]);if(_0x344e6d['name']){delete _0x344e6d[_0x912c('0x28')];}_0x8746a7[_0x912c('0x17')](_0xb626a)[_0x912c('0x29')](_0x344e6d);};}exports[_0x912c('0x2a')]=function(_0xccb6c0,_0x4f1eed){var _0x49164e={},_0x5b4740={},_0xe08372={'count':0x0,'rows':[]};var _0x3f21fd=_['map'](db[_0x912c('0x2b')][_0x912c('0x2c')],function(_0x43b16d){return{'name':_0x43b16d['fieldName'],'type':_0x43b16d[_0x912c('0x2d')][_0x912c('0x2e')]};});_0x5b4740[_0x912c('0x2f')]=_[_0x912c('0x30')](_0x3f21fd,_0x912c('0x28'));_0x5b4740[_0x912c('0x31')]=_[_0x912c('0x32')](_0xccb6c0['query']);_0x5b4740[_0x912c('0x33')]=_[_0x912c('0x34')](_0x5b4740['model'],_0x5b4740['query']);_0x49164e[_0x912c('0x35')]=_['intersection'](_0x5b4740[_0x912c('0x2f')],qs['fields'](_0xccb6c0[_0x912c('0x31')][_0x912c('0x36')]));_0x49164e[_0x912c('0x35')]=_0x49164e[_0x912c('0x35')][_0x912c('0x37')]?_0x49164e[_0x912c('0x35')]:_0x5b4740[_0x912c('0x2f')];if(!_0xccb6c0[_0x912c('0x31')][_0x912c('0x38')]('nolimit')){_0x49164e[_0x912c('0x1c')]=qs[_0x912c('0x1c')](_0xccb6c0['query'][_0x912c('0x1c')]);_0x49164e[_0x912c('0x19')]=qs[_0x912c('0x19')](_0xccb6c0[_0x912c('0x31')]['offset']);}_0x49164e[_0x912c('0x39')]=qs['sort'](_0xccb6c0[_0x912c('0x31')][_0x912c('0x3a')]);_0x49164e[_0x912c('0x3b')]=qs['filters'](_[_0x912c('0x3c')](_0xccb6c0[_0x912c('0x31')],_0x5b4740[_0x912c('0x33')]),_0x3f21fd);if(_0xccb6c0[_0x912c('0x31')][_0x912c('0x3d')]){_0x49164e[_0x912c('0x3b')]=_[_0x912c('0x3e')](_0x49164e[_0x912c('0x3b')],{'$or':_[_0x912c('0x30')](_0x3f21fd,function(_0x49a168){if(_0x49a168[_0x912c('0x2d')]!==_0x912c('0x3f')){var _0x105905={};_0x105905[_0x49a168['name']]={'$like':'%'+_0xccb6c0[_0x912c('0x31')][_0x912c('0x3d')]+'%'};return _0x105905;}})});}_0x49164e=_[_0x912c('0x3e')]({},_0x49164e,_0xccb6c0[_0x912c('0x40')]);var _0x5e209b={'where':_0x49164e[_0x912c('0x3b')]};return db['VoiceChanSpy'][_0x912c('0x1b')](_0x5e209b)[_0x912c('0x22')](function(_0x544da1){_0xe08372[_0x912c('0x1b')]=_0x544da1;if(_0xccb6c0['query'][_0x912c('0x41')]){_0x49164e[_0x912c('0x42')]=[{'all':!![]}];}return db[_0x912c('0x2b')][_0x912c('0x43')](_0x49164e);})['then'](function(_0x320585){_0xe08372[_0x912c('0x44')]=_0x320585;return _0xe08372;})[_0x912c('0x22')](respondWithFilteredResult(_0x4f1eed,_0x49164e))[_0x912c('0x45')](handleError(_0x4f1eed,null));};exports[_0x912c('0x46')]=function(_0x201b30,_0x18b4e5){var _0x1b9c5c={'raw':![],'where':{'id':_0x201b30[_0x912c('0x47')]['id']}},_0x309d3f={};_0x309d3f[_0x912c('0x2f')]=_[_0x912c('0x32')](db[_0x912c('0x2b')][_0x912c('0x2c')]);_0x309d3f['query']=_[_0x912c('0x32')](_0x201b30[_0x912c('0x31')]);_0x309d3f[_0x912c('0x33')]=_['intersection'](_0x309d3f['model'],_0x309d3f[_0x912c('0x31')]);_0x1b9c5c['attributes']=_['intersection'](_0x309d3f[_0x912c('0x2f')],qs[_0x912c('0x36')](_0x201b30[_0x912c('0x31')][_0x912c('0x36')]));_0x1b9c5c['attributes']=_0x1b9c5c[_0x912c('0x35')][_0x912c('0x37')]?_0x1b9c5c[_0x912c('0x35')]:_0x309d3f[_0x912c('0x2f')];if(_0x201b30['query'][_0x912c('0x41')]){_0x1b9c5c[_0x912c('0x42')]=[{'all':!![]}];}_0x1b9c5c=_[_0x912c('0x3e')]({},_0x1b9c5c,_0x201b30['options']);return db[_0x912c('0x2b')][_0x912c('0x48')](_0x1b9c5c)[_0x912c('0x22')](handleEntityNotFound(_0x18b4e5,null))['then'](respondWithResult(_0x18b4e5,null))[_0x912c('0x45')](handleError(_0x18b4e5,null));};exports[_0x912c('0x49')]=function(_0x56bd1d,_0x31b145){return db[_0x912c('0x2b')]['create'](_0x56bd1d[_0x912c('0x4a')],{})[_0x912c('0x22')](function(_0x3b1b0e){var _0x3a7acd=_0x56bd1d['user'][_0x912c('0x24')]({'plain':!![]});if(!_0x3a7acd)throw new Error(_0x912c('0x4b'));if(_0x3a7acd['role']===_0x912c('0x4c')){var _0x5388c0=_0x3b1b0e[_0x912c('0x24')]({'plain':!![]});var _0x57ff91=_0x912c('0x4d');return db['UserProfileSection'][_0x912c('0x48')]({'where':{'name':_0x57ff91,'userProfileId':_0x3a7acd[_0x912c('0x4e')]},'raw':!![]})['then'](function(_0x5a4b0c){if(_0x5a4b0c&&_0x5a4b0c[_0x912c('0x4f')]===0x0){return db['UserProfileResource'][_0x912c('0x49')]({'name':_0x5388c0[_0x912c('0x28')],'resourceId':_0x5388c0['id'],'type':_0x5a4b0c[_0x912c('0x28')],'sectionId':_0x5a4b0c['id']},{})[_0x912c('0x22')](function(){return _0x3b1b0e;});}else{return _0x3b1b0e;}})[_0x912c('0x45')](function(_0x565f31){logger[_0x912c('0x26')](_0x912c('0x50'),_0x565f31);throw _0x565f31;});}return _0x3b1b0e;})[_0x912c('0x22')](respondWithResult(_0x31b145,0xc9))[_0x912c('0x45')](handleError(_0x31b145,null));};exports[_0x912c('0x21')]=function(_0x48379a,_0x1e92c8){if(_0x48379a[_0x912c('0x4a')]['id']){delete _0x48379a[_0x912c('0x4a')]['id'];}return db['VoiceChanSpy'][_0x912c('0x48')]({'where':{'id':_0x48379a['params']['id']}})[_0x912c('0x22')](handleEntityNotFound(_0x1e92c8,null))[_0x912c('0x22')](saveUpdates(_0x48379a['body'],null))[_0x912c('0x22')](respondWithResult(_0x1e92c8,null))[_0x912c('0x45')](handleError(_0x1e92c8,null));};exports['destroy']=function(_0x1a5918,_0x102c7e){return db['VoiceChanSpy']['find']({'where':{'id':_0x1a5918[_0x912c('0x47')]['id']}})[_0x912c('0x22')](handleEntityNotFound(_0x102c7e,null))[_0x912c('0x22')](removeEntity(_0x102c7e,null))[_0x912c('0x45')](handleError(_0x102c7e,null));}; \ No newline at end of file +var _0x0bb5=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','ChanSpies','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0xdc506b,_0x133ab6){var _0x504d53=function(_0x1f1c7c){while(--_0x1f1c7c){_0xdc506b['push'](_0xdc506b['shift']());}};_0x504d53(++_0x133ab6);}(_0x0bb5,0x148));var _0x50bb=function(_0x40e39c,_0x1e5048){_0x40e39c=_0x40e39c-0x0;var _0xd7417e=_0x0bb5[_0x40e39c];return _0xd7417e;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){var _0xad17ac=_0x846311[_0x50bb('0x26')]({'plain':!![]});var _0x284a76=_0x50bb('0x27');return db['UserProfileResource'][_0x50bb('0x25')]({'where':{'type':_0x284a76,'resourceId':_0xad17ac['id']}})['then'](function(){return _0x846311;});})['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cfe4b,_0x41fd89){return function(_0x12ee2c){if(!_0x12ee2c){_0x5cfe4b[_0x50bb('0x19')](0x194);}return _0x12ee2c;};}function handleError(_0x1b74f9,_0x17c158){_0x17c158=_0x17c158||0x1f4;return function(_0x269479){logger[_0x50bb('0x28')](_0x269479[_0x50bb('0x29')]);if(_0x269479['name']){delete _0x269479[_0x50bb('0x2a')];}_0x1b74f9[_0x50bb('0x1a')](_0x17c158)[_0x50bb('0x2b')](_0x269479);};}exports[_0x50bb('0x2c')]=function(_0x560b07,_0x13dc3c){var _0x1a62fb={},_0xc38da5={},_0xb3c3ba={'count':0x0,'rows':[]};var _0x3fd5f6=_[_0x50bb('0x2d')](db[_0x50bb('0x2e')][_0x50bb('0x2f')],function(_0x5cfdd5){return{'name':_0x5cfdd5[_0x50bb('0x30')],'type':_0x5cfdd5[_0x50bb('0x31')][_0x50bb('0x32')]};});_0xc38da5['model']=_[_0x50bb('0x2d')](_0x3fd5f6,_0x50bb('0x2a'));_0xc38da5[_0x50bb('0x33')]=_[_0x50bb('0x34')](_0x560b07[_0x50bb('0x33')]);_0xc38da5[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0xc38da5[_0x50bb('0x37')],_0xc38da5[_0x50bb('0x33')]);_0x1a62fb[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0xc38da5['model'],qs[_0x50bb('0x39')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x39')]));_0x1a62fb[_0x50bb('0x38')]=_0x1a62fb[_0x50bb('0x38')][_0x50bb('0x3a')]?_0x1a62fb['attributes']:_0xc38da5['model'];if(!_0x560b07[_0x50bb('0x33')]['hasOwnProperty'](_0x50bb('0x3b'))){_0x1a62fb[_0x50bb('0x3c')]=qs[_0x50bb('0x3c')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x3c')]);_0x1a62fb['offset']=qs[_0x50bb('0x1c')](_0x560b07['query'][_0x50bb('0x1c')]);}_0x1a62fb[_0x50bb('0x3d')]=qs[_0x50bb('0x3e')](_0x560b07['query']['sort']);_0x1a62fb[_0x50bb('0x3f')]=qs[_0x50bb('0x35')](_[_0x50bb('0x40')](_0x560b07[_0x50bb('0x33')],_0xc38da5['filters']),_0x3fd5f6);if(_0x560b07[_0x50bb('0x33')]['filter']){_0x1a62fb['where']=_[_0x50bb('0x41')](_0x1a62fb['where'],{'$or':_[_0x50bb('0x2d')](_0x3fd5f6,function(_0x3d94b8){if(_0x3d94b8[_0x50bb('0x31')]!==_0x50bb('0x42')){var _0x3a9fe4={};_0x3a9fe4[_0x3d94b8[_0x50bb('0x2a')]]={'$like':'%'+_0x560b07[_0x50bb('0x33')][_0x50bb('0x43')]+'%'};return _0x3a9fe4;}})});}_0x1a62fb=_[_0x50bb('0x41')]({},_0x1a62fb,_0x560b07[_0x50bb('0x44')]);var _0x594f16={'where':_0x1a62fb['where']};return db[_0x50bb('0x2e')][_0x50bb('0x1e')](_0x594f16)[_0x50bb('0x24')](function(_0x1d929d){_0xb3c3ba['count']=_0x1d929d;if(_0x560b07[_0x50bb('0x33')]['includeAll']){_0x1a62fb[_0x50bb('0x45')]=[{'all':!![]}];}return db[_0x50bb('0x2e')][_0x50bb('0x46')](_0x1a62fb);})[_0x50bb('0x24')](function(_0x1c438b){_0xb3c3ba[_0x50bb('0x47')]=_0x1c438b;return _0xb3c3ba;})[_0x50bb('0x24')](respondWithFilteredResult(_0x13dc3c,_0x1a62fb))[_0x50bb('0x48')](handleError(_0x13dc3c,null));};exports[_0x50bb('0x49')]=function(_0x46c1c3,_0x349474){var _0x24e375={'raw':![],'where':{'id':_0x46c1c3[_0x50bb('0x4a')]['id']}},_0x85b0ff={};_0x85b0ff[_0x50bb('0x37')]=_[_0x50bb('0x34')](db['VoiceChanSpy'][_0x50bb('0x2f')]);_0x85b0ff['query']=_[_0x50bb('0x34')](_0x46c1c3[_0x50bb('0x33')]);_0x85b0ff[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],_0x85b0ff[_0x50bb('0x33')]);_0x24e375[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],qs[_0x50bb('0x39')](_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x39')]));_0x24e375[_0x50bb('0x38')]=_0x24e375[_0x50bb('0x38')]['length']?_0x24e375[_0x50bb('0x38')]:_0x85b0ff['model'];if(_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x4b')]){_0x24e375[_0x50bb('0x45')]=[{'all':!![]}];}_0x24e375=_[_0x50bb('0x41')]({},_0x24e375,_0x46c1c3[_0x50bb('0x44')]);return db[_0x50bb('0x2e')][_0x50bb('0x4c')](_0x24e375)[_0x50bb('0x24')](handleEntityNotFound(_0x349474,null))['then'](respondWithResult(_0x349474,null))[_0x50bb('0x48')](handleError(_0x349474,null));};exports[_0x50bb('0x4d')]=function(_0xf52a22,_0x13afe2){return db[_0x50bb('0x2e')]['create'](_0xf52a22[_0x50bb('0x4e')],{})[_0x50bb('0x24')](function(_0x2a411d){var _0x154ff8=_0xf52a22[_0x50bb('0x4f')]['get']({'plain':!![]});if(!_0x154ff8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x154ff8[_0x50bb('0x50')]==='user'){var _0x357d08=_0x2a411d['get']({'plain':!![]});var _0x4316e4=_0x50bb('0x27');return db[_0x50bb('0x51')]['find']({'where':{'name':_0x4316e4,'userProfileId':_0x154ff8[_0x50bb('0x52')]},'raw':!![]})[_0x50bb('0x24')](function(_0x588dfe){if(_0x588dfe&&_0x588dfe[_0x50bb('0x53')]===0x0){return db[_0x50bb('0x54')][_0x50bb('0x4d')]({'name':_0x357d08[_0x50bb('0x2a')],'resourceId':_0x357d08['id'],'type':_0x588dfe['name'],'sectionId':_0x588dfe['id']},{})[_0x50bb('0x24')](function(){return _0x2a411d;});}else{return _0x2a411d;}})[_0x50bb('0x48')](function(_0x2e0032){logger[_0x50bb('0x28')](_0x50bb('0x55'),_0x2e0032);throw _0x2e0032;});}return _0x2a411d;})['then'](respondWithResult(_0x13afe2,0xc9))[_0x50bb('0x48')](handleError(_0x13afe2,null));};exports['update']=function(_0x38a775,_0x50216f){if(_0x38a775['body']['id']){delete _0x38a775[_0x50bb('0x4e')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x38a775[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x50216f,null))[_0x50bb('0x24')](saveUpdates(_0x38a775[_0x50bb('0x4e')],null))[_0x50bb('0x24')](respondWithResult(_0x50216f,null))[_0x50bb('0x48')](handleError(_0x50216f,null));};exports[_0x50bb('0x25')]=function(_0x1408fa,_0x57d749){return db['VoiceChanSpy'][_0x50bb('0x4c')]({'where':{'id':_0x1408fa[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x57d749,null))[_0x50bb('0x24')](removeEntity(_0x57d749,null))[_0x50bb('0x48')](handleError(_0x57d749,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 418d910..8f8c2d0 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 _0x393b=['push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','concat','internal','User','findAll','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','length','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system'];(function(_0x2d86f2,_0x5e1b5c){var _0x4d2124=function(_0x4b6c2f){while(--_0x4b6c2f){_0x2d86f2['push'](_0x2d86f2['shift']());}};_0x4d2124(++_0x5e1b5c);}(_0x393b,0xed));var _0xb393=function(_0x1416fc,_0x72e155){_0x1416fc=_0x1416fc-0x0;var _0x3a4b34=_0x393b[_0x1416fc];return _0x3a4b34;};'use strict';var _=require(_0xb393('0x0'));var util=require(_0xb393('0x1'));var BPromise=require(_0xb393('0x2'));var attributes=require(_0xb393('0x3'));var getUserApplications=function(_0x561d0f,_0x10d45e,_0xe9144b){var _0x1cb6ed=0x1;var _0x568266=[];var _0x3ea1c0={'context':_0x10d45e['context']||_0xb393('0x4'),'exten':util[_0xb393('0x5')](_0xb393('0x6'),_0x561d0f[_0xb393('0x7')],_0xe9144b),'type':_0xb393('0x8'),'isApp':![],'ChanSpyId':_0x561d0f['id'],'UserId':_0x10d45e['id']};_0x568266[_0xb393('0x9')](_[_0xb393('0xa')]({'app':_0xb393('0xb'),'appdata':util[_0xb393('0x5')](_0xb393('0xc'),_0xb393('0xd')),'priority':_0x1cb6ed++},_0x3ea1c0));if(_0x561d0f[_0xb393('0xe')]){_0x568266['push'](_[_0xb393('0xa')]({'app':_0xb393('0xf'),'appdata':util[_0xb393('0x5')](_0xb393('0x10'),_0x561d0f[_0xb393('0x11')]),'priority':_0x1cb6ed++},_0x3ea1c0));}if(_0x561d0f[_0xb393('0x12')]){_0x568266[_0xb393('0x9')](_['merge']({'app':_0xb393('0x13'),'appdata':_0x561d0f[_0xb393('0x14')],'priority':_0x1cb6ed++},_0x3ea1c0));}_0x568266[_0xb393('0x9')](_[_0xb393('0xa')]({'app':_0xb393('0x15'),'appdata':util['format'](_0xb393('0x16'),_0x10d45e[_0xb393('0x17')],_0x561d0f['options']?_0x561d0f[_0xb393('0x18')][_0xb393('0x19')](''):''),'priority':_0x1cb6ed++},_0x3ea1c0));if(_0x561d0f['record']){_0x568266[_0xb393('0x9')](_[_0xb393('0xa')]({'app':'StopMixMonitor','priority':_0x1cb6ed++},_0x3ea1c0));}return _0x568266;};var getChanSpyApplications=function(_0x5d230b,_0x167551){var _0x52ca03=[];for(var _0x206b88=0x0,_0x12e1df=0x1;_0x206b88<_0x167551['length'];_0x206b88++,_0x12e1df=0x1){_0x52ca03=_0x52ca03[_0xb393('0x1a')](getUserApplications(_0x5d230b,_0x167551[_0x206b88],_0x167551[_0x206b88][_0xb393('0x1b')]));if(_0x167551[_0x206b88][_0xb393('0x1b')]!=_0x167551[_0x206b88][_0xb393('0x17')]){_0x52ca03=_0x52ca03[_0xb393('0x1a')](getUserApplications(_0x5d230b,_0x167551[_0x206b88],_0x167551[_0x206b88]['name']));}}return _0x52ca03;};var getChanSpyPromise=function(_0x49f713,_0x1919fc){return new BPromise(function(_0x153f55,_0x4fb89c){return _0x49f713[_0xb393('0x1c')][_0xb393('0x1d')]({'attributes':['id',_0xb393('0x17'),_0xb393('0x1b')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xb393('0x1e')](function(_0x2aadbe){if(_0x2aadbe){return _0x153f55(getChanSpyApplications(_0x1919fc,_0x2aadbe));}return _0x153f55([]);})[_0xb393('0x1f')](function(_0x3dbb4f){_0x4fb89c(_0x3dbb4f);});});};module[_0xb393('0x20')]=function(_0x1c5a6b,_0x5e51a3){var _0x3fdb71=_0x1c5a6b[_0xb393('0x21')];return _0x1c5a6b[_0xb393('0x22')](_0xb393('0x23'),attributes,{'tableName':_0xb393('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3add5c,_0x7532f,_0x405721){return getChanSpyPromise(_0x3fdb71,_0x3add5c)[_0xb393('0x1e')](function(_0x28e3c8){if(_0x28e3c8&&_0x28e3c8['length']){return _0x3fdb71[_0xb393('0x25')][_0xb393('0x26')](_0x28e3c8);}})['then'](function(){_0x405721();})['catch'](function(_0x4557d8){_0x405721(_0x4557d8);});},'afterUpdate':function(_0x510908,_0x3c5f6b,_0x366215){return _0x3fdb71['VoiceExtension'][_0xb393('0x27')]({'where':{'ChanSpyId':_0x510908['id']}})[_0xb393('0x1e')](function(){return getChanSpyPromise(_0x3fdb71,_0x510908);})[_0xb393('0x1e')](function(_0x4527df){if(_0x4527df&&_0x4527df[_0xb393('0x28')]){return _0x3fdb71[_0xb393('0x25')][_0xb393('0x26')](_0x4527df);}})[_0xb393('0x1e')](function(){_0x366215();})[_0xb393('0x1f')](function(_0x232a5f){_0x366215(_0x232a5f);});},'afterDestroy':function(_0x452d84,_0x377cad,_0xd2f568){return _0x3fdb71[_0xb393('0x25')]['destroy']({'where':{'ChanSpyId':_0x452d84['id']}})['then'](function(){_0xd2f568();})[_0xb393('0x1f')](function(_0x68978){_0xd2f568(_0x68978);});}}});}; \ No newline at end of file +var _0x9050=['lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','merge','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','User','findAll','agent','catch','exports','models','define','voice_chanspy','then','VoiceExtension','destroy','bulkCreate'];(function(_0x5185c6,_0x4e7c65){var _0x1a9c19=function(_0x4b882b){while(--_0x4b882b){_0x5185c6['push'](_0x5185c6['shift']());}};_0x1a9c19(++_0x4e7c65);}(_0x9050,0x1e0));var _0x0905=function(_0x2b0c4e,_0x3233b2){_0x2b0c4e=_0x2b0c4e-0x0;var _0x2769d6=_0x9050[_0x2b0c4e];return _0x2769d6;};'use strict';var _=require(_0x0905('0x0'));var util=require(_0x0905('0x1'));var BPromise=require(_0x0905('0x2'));var attributes=require(_0x0905('0x3'));var getUserApplications=function(_0x4f599c,_0xb98eea,_0x2966d0){var _0x5caf91=0x1;var _0x344b1d=[];var _0x2c11c9={'context':_0xb98eea[_0x0905('0x4')]||_0x0905('0x5'),'exten':util[_0x0905('0x6')](_0x0905('0x7'),_0x4f599c[_0x0905('0x8')],_0x2966d0),'type':_0x0905('0x9'),'isApp':![],'ChanSpyId':_0x4f599c['id'],'UserId':_0xb98eea['id']};_0x344b1d[_0x0905('0xa')](_['merge']({'app':_0x0905('0xb'),'appdata':util['format'](_0x0905('0xc'),'chanspy'),'priority':_0x5caf91++},_0x2c11c9));if(_0x4f599c[_0x0905('0xd')]){_0x344b1d[_0x0905('0xa')](_['merge']({'app':_0x0905('0xe'),'appdata':util['format'](_0x0905('0xf'),_0x4f599c[_0x0905('0x10')]),'priority':_0x5caf91++},_0x2c11c9));}if(_0x4f599c['auth']){_0x344b1d['push'](_[_0x0905('0x11')]({'app':_0x0905('0x12'),'appdata':_0x4f599c[_0x0905('0x13')],'priority':_0x5caf91++},_0x2c11c9));}_0x344b1d[_0x0905('0xa')](_['merge']({'app':_0x0905('0x14'),'appdata':util['format'](_0x0905('0x15'),_0xb98eea[_0x0905('0x16')],_0x4f599c[_0x0905('0x17')]?_0x4f599c[_0x0905('0x17')][_0x0905('0x18')](''):''),'priority':_0x5caf91++},_0x2c11c9));if(_0x4f599c[_0x0905('0xd')]){_0x344b1d[_0x0905('0xa')](_[_0x0905('0x11')]({'app':_0x0905('0x19'),'priority':_0x5caf91++},_0x2c11c9));}return _0x344b1d;};var getChanSpyApplications=function(_0x351ff8,_0x2fe6e5){var _0x14d390=[];for(var _0x40c3b6=0x0,_0x3cffd7=0x1;_0x40c3b6<_0x2fe6e5[_0x0905('0x1a')];_0x40c3b6++,_0x3cffd7=0x1){_0x14d390=_0x14d390[_0x0905('0x1b')](getUserApplications(_0x351ff8,_0x2fe6e5[_0x40c3b6],_0x2fe6e5[_0x40c3b6]['internal']));if(_0x2fe6e5[_0x40c3b6]['internal']!=_0x2fe6e5[_0x40c3b6][_0x0905('0x16')]){_0x14d390=_0x14d390[_0x0905('0x1b')](getUserApplications(_0x351ff8,_0x2fe6e5[_0x40c3b6],_0x2fe6e5[_0x40c3b6][_0x0905('0x16')]));}}return _0x14d390;};var getChanSpyPromise=function(_0x285a2f,_0x57bf89){return new BPromise(function(_0x113d01,_0x5921c7){return _0x285a2f[_0x0905('0x1c')][_0x0905('0x1d')]({'attributes':['id',_0x0905('0x16'),'internal'],'where':{'role':_0x0905('0x1e'),'chanspy':!![]},'raw':!![]})['then'](function(_0x20609b){if(_0x20609b){return _0x113d01(getChanSpyApplications(_0x57bf89,_0x20609b));}return _0x113d01([]);})[_0x0905('0x1f')](function(_0x8f759d){_0x5921c7(_0x8f759d);});});};module[_0x0905('0x20')]=function(_0x1f951f,_0x31a002){var _0x498445=_0x1f951f[_0x0905('0x21')];return _0x1f951f[_0x0905('0x22')]('VoiceChanSpy',attributes,{'tableName':_0x0905('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x431aed,_0x25c5c9,_0x1836f5){return getChanSpyPromise(_0x498445,_0x431aed)[_0x0905('0x24')](function(_0x2b2eae){if(_0x2b2eae&&_0x2b2eae['length']){return _0x498445[_0x0905('0x25')]['bulkCreate'](_0x2b2eae);}})[_0x0905('0x24')](function(){_0x1836f5();})[_0x0905('0x1f')](function(_0x5be9c7){_0x1836f5(_0x5be9c7);});},'afterUpdate':function(_0x2e56da,_0x1dde35,_0x13ee08){return _0x498445[_0x0905('0x25')][_0x0905('0x26')]({'where':{'ChanSpyId':_0x2e56da['id']}})[_0x0905('0x24')](function(){return getChanSpyPromise(_0x498445,_0x2e56da);})[_0x0905('0x24')](function(_0x49f753){if(_0x49f753&&_0x49f753[_0x0905('0x1a')]){return _0x498445['VoiceExtension'][_0x0905('0x27')](_0x49f753);}})[_0x0905('0x24')](function(){_0x13ee08();})['catch'](function(_0x2e5541){_0x13ee08(_0x2e5541);});},'afterDestroy':function(_0x5e2cc2,_0x2169fa,_0x5ce2d8){return _0x498445[_0x0905('0x25')][_0x0905('0x26')]({'where':{'ChanSpyId':_0x5e2cc2['id']}})[_0x0905('0x24')](function(){_0x5ce2d8();})[_0x0905('0x1f')](function(_0x257a41){_0x5ce2d8(_0x257a41);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 419945b..c351cc5 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 _0x7072=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x300a0a,_0x1653d4){var _0x28b718=function(_0x1100ce){while(--_0x1100ce){_0x300a0a['push'](_0x300a0a['shift']());}};_0x28b718(++_0x1653d4);}(_0x7072,0x138));var _0x2707=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x7072[_0x2261ce];return _0x524640;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});} \ No newline at end of file +var _0x55ea=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x40c552,_0x5b8889){var _0x35b192=function(_0x84de3f){while(--_0x84de3f){_0x40c552['push'](_0x40c552['shift']());}};_0x35b192(++_0x5b8889);}(_0x55ea,0xc9));var _0xa55e=function(_0x4c1b17,_0x211dff){_0x4c1b17=_0x4c1b17-0x0;var _0x412454=_0x55ea[_0x4c1b17];return _0x412454;};'use strict';var _=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var moment=require(_0xa55e('0x2'));var BPromise=require('bluebird');var rs=require(_0xa55e('0x3'));var fs=require('fs');var Redis=require(_0xa55e('0x4'));var db=require(_0xa55e('0x5'))['db'];var utils=require(_0xa55e('0x6'));var logger=require(_0xa55e('0x7'))('rpc');var config=require(_0xa55e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a009c,_0x38378e,_0x20f2ac){return new BPromise(function(_0x30b885,_0xca9526){return client[_0xa55e('0x9')](_0x5a009c,_0x20f2ac)[_0xa55e('0xa')](function(_0x32f6f7){logger[_0xa55e('0xb')](_0xa55e('0xc'),_0x38378e,'request\x20sent');logger['debug'](_0xa55e('0xd'),_0x38378e,_0xa55e('0xe'),JSON[_0xa55e('0xf')](_0x32f6f7));if(_0x32f6f7[_0xa55e('0x10')]){if(_0x32f6f7[_0xa55e('0x10')]['code']===0x1f4){logger[_0xa55e('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x38378e,_0x32f6f7[_0xa55e('0x10')][_0xa55e('0x11')]);return _0xca9526(_0x32f6f7[_0xa55e('0x10')][_0xa55e('0x11')]);}logger[_0xa55e('0x10')](_0xa55e('0xc'),_0x38378e,_0x32f6f7[_0xa55e('0x10')][_0xa55e('0x11')]);return _0x30b885(_0x32f6f7[_0xa55e('0x10')]['message']);}else{logger[_0xa55e('0xb')](_0xa55e('0xc'),_0x38378e,_0xa55e('0xe'));_0x30b885(_0x32f6f7[_0xa55e('0x12')][_0xa55e('0x11')]);}})[_0xa55e('0x13')](function(_0x585d3a){logger[_0xa55e('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x38378e,_0x585d3a);_0xca9526(_0x585d3a);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 0150d79..2870fb8 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 _0x1880=['create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceContext.controller','get','isAuthenticated','post'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0x1880,0xc2));var _0x0188=function(_0x282320,_0x379ad6){_0x282320=_0x282320-0x0;var _0x271d54=_0x1880[_0x282320];return _0x271d54;};'use strict';var multer=require('multer');var util=require(_0x0188('0x0'));var path=require(_0x0188('0x1'));var timeout=require(_0x0188('0x2'));var express=require(_0x0188('0x3'));var router=express['Router']();var fs_extra=require(_0x0188('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0188('0x5'));var controller=require(_0x0188('0x6'));router[_0x0188('0x7')]('/',auth[_0x0188('0x8')](),controller['index']);router[_0x0188('0x7')]('/:id',auth[_0x0188('0x8')](),controller['show']);router[_0x0188('0x9')]('/',auth['isAuthenticated'](),controller[_0x0188('0xa')]);router[_0x0188('0xb')]('/:id',auth[_0x0188('0x8')](),controller[_0x0188('0xc')]);router[_0x0188('0xd')](_0x0188('0xe'),auth[_0x0188('0x8')](),controller[_0x0188('0xf')]);module[_0x0188('0x10')]=router; \ No newline at end of file +var _0xc803=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x2c60c9,_0x2c6e0d){var _0x564f3f=function(_0x3a06f6){while(--_0x3a06f6){_0x2c60c9['push'](_0x2c60c9['shift']());}};_0x564f3f(++_0x2c6e0d);}(_0xc803,0x1e2));var _0x3c80=function(_0x5671c6,_0x3a0619){_0x5671c6=_0x5671c6-0x0;var _0x4e86c8=_0xc803[_0x5671c6];return _0x4e86c8;};'use strict';var multer=require('multer');var util=require(_0x3c80('0x0'));var path=require(_0x3c80('0x1'));var timeout=require(_0x3c80('0x2'));var express=require(_0x3c80('0x3'));var router=express['Router']();var fs_extra=require(_0x3c80('0x4'));var auth=require(_0x3c80('0x5'));var interaction=require(_0x3c80('0x6'));var config=require(_0x3c80('0x7'));var controller=require(_0x3c80('0x8'));router[_0x3c80('0x9')]('/',auth[_0x3c80('0xa')](),controller[_0x3c80('0xb')]);router[_0x3c80('0x9')](_0x3c80('0xc'),auth[_0x3c80('0xa')](),controller[_0x3c80('0xd')]);router[_0x3c80('0xe')]('/',auth[_0x3c80('0xa')](),controller['create']);router[_0x3c80('0xf')]('/:id',auth[_0x3c80('0xa')](),controller[_0x3c80('0x10')]);router[_0x3c80('0x11')](_0x3c80('0xc'),auth[_0x3c80('0xa')](),controller[_0x3c80('0x12')]);module[_0x3c80('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f7bb233..bee9e21 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 _0xbf2b=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x4a9650,_0x743543){var _0x28b475=function(_0x557404){while(--_0x557404){_0x4a9650['push'](_0x4a9650['shift']());}};_0x28b475(++_0x743543);}(_0xbf2b,0x12f));var _0xbbf2=function(_0xbc07fb,_0x6c7b3f){_0xbc07fb=_0xbc07fb-0x0;var _0x26a009=_0xbf2b[_0xbc07fb];return _0x26a009;};'use strict';var Sequelize=require(_0xbbf2('0x0'));module[_0xbbf2('0x1')]={'name':{'type':Sequelize[_0xbbf2('0x2')],'unique':_0xbbf2('0x3')},'description':{'type':Sequelize[_0xbbf2('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbbf2('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe776=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x3450f5,_0x5780b2){var _0xfa84f0=function(_0x43b515){while(--_0x43b515){_0x3450f5['push'](_0x3450f5['shift']());}};_0xfa84f0(++_0x5780b2);}(_0xe776,0xfe));var _0x6e77=function(_0x290c92,_0x109b6f){_0x290c92=_0x290c92-0x0;var _0x104d47=_0xe776[_0x290c92];return _0x104d47;};'use strict';var Sequelize=require(_0x6e77('0x0'));module[_0x6e77('0x1')]={'name':{'type':Sequelize[_0x6e77('0x2')],'unique':_0x6e77('0x3')},'description':{'type':Sequelize[_0x6e77('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6e77('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 36902d3..c8b9c0b 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 _0xfb12=['merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','create','body','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','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','http','request','then','VoiceContext,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','get','Contexts','destroy','sendStatus','stack','name','send','map','VoiceContext','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters'];(function(_0x4529a6,_0xcf5c91){var _0x1f63df=function(_0x710e0c){while(--_0x710e0c){_0x4529a6['push'](_0x4529a6['shift']());}};_0x1f63df(++_0xcf5c91);}(_0xfb12,0xf1));var _0x2fb1=function(_0x55ee39,_0x4ee949){_0x55ee39=_0x55ee39-0x0;var _0x51ec97=_0xfb12[_0x55ee39];return _0x51ec97;};'use strict';var emlformat=require(_0x2fb1('0x0'));var rimraf=require(_0x2fb1('0x1'));var zipdir=require(_0x2fb1('0x2'));var jsonpatch=require(_0x2fb1('0x3'));var rp=require(_0x2fb1('0x4'));var moment=require(_0x2fb1('0x5'));var BPromise=require(_0x2fb1('0x6'));var Mustache=require('mustache');var util=require(_0x2fb1('0x7'));var path=require('path');var sox=require(_0x2fb1('0x8'));var csv=require('to-csv');var ejs=require(_0x2fb1('0x9'));var fs=require('fs');var fs_extra=require(_0x2fb1('0xa'));var _=require('lodash');var squel=require(_0x2fb1('0xb'));var crypto=require('crypto');var jsforce=require(_0x2fb1('0xc'));var deskjs=require(_0x2fb1('0xd'));var toCsv=require(_0x2fb1('0xe'));var querystring=require(_0x2fb1('0xf'));var Papa=require(_0x2fb1('0x10'));var Redis=require('ioredis');var authService=require(_0x2fb1('0x11'));var qs=require(_0x2fb1('0x12'));var as=require(_0x2fb1('0x13'));var hardwareService=require(_0x2fb1('0x14'));var logger=require(_0x2fb1('0x15'))(_0x2fb1('0x16'));var utils=require(_0x2fb1('0x17'));var config=require(_0x2fb1('0x18'));var licenseUtil=require(_0x2fb1('0x19'));var db=require(_0x2fb1('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x2fb1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x37f1b1,_0x231e0b,_0x2471db,_0x1df6c0){return new BPromise(function(_0x5947c7,_0xad6630){var _0x1142e7=_0x1df6c0||client;return _0x1142e7[_0x2fb1('0x1c')](_0x37f1b1,_0x2471db)[_0x2fb1('0x1d')](function(_0x3c5edd){logger['info'](_0x2fb1('0x1e'),_0x231e0b,'request\x20sent');logger[_0x2fb1('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x231e0b,'request\x20sent',JSON[_0x2fb1('0x20')](_0x3c5edd));if(_0x3c5edd[_0x2fb1('0x21')]){if(_0x3c5edd['error'][_0x2fb1('0x22')]===0x1f4){logger['error'](_0x2fb1('0x1e'),_0x231e0b,_0x3c5edd[_0x2fb1('0x21')]['message']);return _0xad6630(_0x3c5edd[_0x2fb1('0x21')][_0x2fb1('0x23')]);}logger[_0x2fb1('0x21')](_0x2fb1('0x1e'),_0x231e0b,_0x3c5edd[_0x2fb1('0x21')]['message']);return _0x5947c7(_0x3c5edd['error'][_0x2fb1('0x23')]);}else{logger[_0x2fb1('0x24')](_0x2fb1('0x1e'),_0x231e0b,_0x2fb1('0x25'));_0x5947c7(_0x3c5edd[_0x2fb1('0x26')][_0x2fb1('0x23')]);}})[_0x2fb1('0x27')](function(_0x1fca27){logger[_0x2fb1('0x21')]('VoiceContext,\x20%s,\x20%s',_0x231e0b,_0x1fca27);_0xad6630(_0x1fca27);});});}function respondWithStatusCode(_0x1aebea,_0x480799){_0x480799=_0x480799||0xcc;return function(_0x2d953e){if(_0x2d953e){return _0x1aebea['sendStatus'](_0x480799);}return _0x1aebea['status'](_0x480799)[_0x2fb1('0x28')]();};}function respondWithResult(_0x3038c7,_0x196420){_0x196420=_0x196420||0xc8;return function(_0x4a386b){if(_0x4a386b){return _0x3038c7[_0x2fb1('0x29')](_0x196420)[_0x2fb1('0x2a')](_0x4a386b);}};}function respondWithFilteredResult(_0x59cc5a,_0x2faf1e){return function(_0x5cf4b4){if(_0x5cf4b4){var _0x49d694=typeof _0x2faf1e[_0x2fb1('0x2b')]===_0x2fb1('0x2c')&&typeof _0x2faf1e[_0x2fb1('0x2d')]===_0x2fb1('0x2c');var _0x6cbdb5=_0x5cf4b4[_0x2fb1('0x2e')];var _0x29ea32=_0x49d694?0x0:_0x2faf1e['offset'];var _0x3e87dd=_0x49d694?_0x5cf4b4[_0x2fb1('0x2e')]:_0x2faf1e[_0x2fb1('0x2b')]+_0x2faf1e[_0x2fb1('0x2d')];var _0x254c3a;if(_0x3e87dd>=_0x6cbdb5){_0x3e87dd=_0x6cbdb5;_0x254c3a=0xc8;}else{_0x254c3a=0xce;}_0x59cc5a[_0x2fb1('0x29')](_0x254c3a);return _0x59cc5a['set'](_0x2fb1('0x2f'),_0x29ea32+'-'+_0x3e87dd+'/'+_0x6cbdb5)[_0x2fb1('0x2a')](_0x5cf4b4);}return null;};}function patchUpdates(_0x1ae889){return function(_0x4e4c08){try{jsonpatch[_0x2fb1('0x30')](_0x4e4c08,_0x1ae889,!![]);}catch(_0x118454){return BPromise[_0x2fb1('0x31')](_0x118454);}return _0x4e4c08[_0x2fb1('0x32')]();};}function saveUpdates(_0x13fe55,_0x4d36f7){return function(_0x262925){if(_0x262925){return _0x262925[_0x2fb1('0x33')](_0x13fe55)['then'](function(_0x5903d0){return _0x5903d0;});}return null;};}function removeEntity(_0x1f0dc8,_0x58bfee){return function(_0xf419de){if(_0xf419de){return _0xf419de['destroy']()[_0x2fb1('0x1d')](function(){var _0x471b9d=_0xf419de[_0x2fb1('0x34')]({'plain':!![]});var _0x570d07=_0x2fb1('0x35');return db['UserProfileResource'][_0x2fb1('0x36')]({'where':{'type':_0x570d07,'resourceId':_0x471b9d['id']}})[_0x2fb1('0x1d')](function(){return _0xf419de;});})[_0x2fb1('0x1d')](function(){_0x1f0dc8[_0x2fb1('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a1b33,_0x35f8f0){return function(_0x46de5f){if(!_0x46de5f){_0x3a1b33[_0x2fb1('0x37')](0x194);}return _0x46de5f;};}function handleError(_0x6544ed,_0x263791){_0x263791=_0x263791||0x1f4;return function(_0x4550ab){logger[_0x2fb1('0x21')](_0x4550ab[_0x2fb1('0x38')]);if(_0x4550ab[_0x2fb1('0x39')]){delete _0x4550ab[_0x2fb1('0x39')];}_0x6544ed[_0x2fb1('0x29')](_0x263791)[_0x2fb1('0x3a')](_0x4550ab);};}exports['index']=function(_0x3a9637,_0x203b05){var _0x31f7b9={},_0x48a924={},_0x7928b0={'count':0x0,'rows':[]};var _0x4855d2=_[_0x2fb1('0x3b')](db[_0x2fb1('0x3c')][_0x2fb1('0x3d')],function(_0x5a5a97){return{'name':_0x5a5a97['fieldName'],'type':_0x5a5a97[_0x2fb1('0x3e')][_0x2fb1('0x3f')]};});_0x48a924[_0x2fb1('0x40')]=_[_0x2fb1('0x3b')](_0x4855d2,_0x2fb1('0x39'));_0x48a924[_0x2fb1('0x41')]=_[_0x2fb1('0x42')](_0x3a9637[_0x2fb1('0x41')]);_0x48a924['filters']=_[_0x2fb1('0x43')](_0x48a924[_0x2fb1('0x40')],_0x48a924[_0x2fb1('0x41')]);_0x31f7b9['attributes']=_[_0x2fb1('0x43')](_0x48a924[_0x2fb1('0x40')],qs[_0x2fb1('0x44')](_0x3a9637[_0x2fb1('0x41')]['fields']));_0x31f7b9['attributes']=_0x31f7b9[_0x2fb1('0x45')]['length']?_0x31f7b9[_0x2fb1('0x45')]:_0x48a924['model'];if(!_0x3a9637[_0x2fb1('0x41')][_0x2fb1('0x46')](_0x2fb1('0x47'))){_0x31f7b9['limit']=qs[_0x2fb1('0x2d')](_0x3a9637['query']['limit']);_0x31f7b9[_0x2fb1('0x2b')]=qs[_0x2fb1('0x2b')](_0x3a9637[_0x2fb1('0x41')]['offset']);}_0x31f7b9['order']=qs[_0x2fb1('0x48')](_0x3a9637[_0x2fb1('0x41')]['sort']);_0x31f7b9['where']=qs[_0x2fb1('0x49')](_['pick'](_0x3a9637[_0x2fb1('0x41')],_0x48a924[_0x2fb1('0x49')]),_0x4855d2);if(_0x3a9637[_0x2fb1('0x41')]['filter']){_0x31f7b9['where']=_[_0x2fb1('0x4a')](_0x31f7b9[_0x2fb1('0x4b')],{'$or':_[_0x2fb1('0x3b')](_0x4855d2,function(_0xd21cd1){if(_0xd21cd1[_0x2fb1('0x3e')]!==_0x2fb1('0x4c')){var _0x1cf59d={};_0x1cf59d[_0xd21cd1[_0x2fb1('0x39')]]={'$like':'%'+_0x3a9637['query'][_0x2fb1('0x4d')]+'%'};return _0x1cf59d;}})});}_0x31f7b9=_['merge']({},_0x31f7b9,_0x3a9637[_0x2fb1('0x4e')]);var _0x4e61ec={'where':_0x31f7b9[_0x2fb1('0x4b')]};return db['VoiceContext'][_0x2fb1('0x2e')](_0x4e61ec)['then'](function(_0x1c2c2f){_0x7928b0[_0x2fb1('0x2e')]=_0x1c2c2f;if(_0x3a9637[_0x2fb1('0x41')][_0x2fb1('0x4f')]){_0x31f7b9[_0x2fb1('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0x2fb1('0x51')](_0x31f7b9);})[_0x2fb1('0x1d')](function(_0x3c4430){_0x7928b0[_0x2fb1('0x52')]=_0x3c4430;return _0x7928b0;})[_0x2fb1('0x1d')](respondWithFilteredResult(_0x203b05,_0x31f7b9))[_0x2fb1('0x27')](handleError(_0x203b05,null));};exports[_0x2fb1('0x53')]=function(_0x112e9b,_0x49c6f6){var _0x172494={'raw':![],'where':{'id':_0x112e9b[_0x2fb1('0x54')]['id']}},_0x4027bd={};_0x4027bd[_0x2fb1('0x40')]=_['keys'](db['VoiceContext'][_0x2fb1('0x3d')]);_0x4027bd[_0x2fb1('0x41')]=_[_0x2fb1('0x42')](_0x112e9b[_0x2fb1('0x41')]);_0x4027bd[_0x2fb1('0x49')]=_[_0x2fb1('0x43')](_0x4027bd[_0x2fb1('0x40')],_0x4027bd[_0x2fb1('0x41')]);_0x172494[_0x2fb1('0x45')]=_[_0x2fb1('0x43')](_0x4027bd['model'],qs[_0x2fb1('0x44')](_0x112e9b['query'][_0x2fb1('0x44')]));_0x172494[_0x2fb1('0x45')]=_0x172494[_0x2fb1('0x45')][_0x2fb1('0x55')]?_0x172494[_0x2fb1('0x45')]:_0x4027bd['model'];if(_0x112e9b[_0x2fb1('0x41')]['includeAll']){_0x172494[_0x2fb1('0x50')]=[{'all':!![]}];}_0x172494=_[_0x2fb1('0x4a')]({},_0x172494,_0x112e9b[_0x2fb1('0x4e')]);return db[_0x2fb1('0x3c')]['find'](_0x172494)[_0x2fb1('0x1d')](handleEntityNotFound(_0x49c6f6,null))[_0x2fb1('0x1d')](respondWithResult(_0x49c6f6,null))['catch'](handleError(_0x49c6f6,null));};exports[_0x2fb1('0x56')]=function(_0x1ba7f8,_0x4a73d5,_0x3a757a){var _0x44b29b;return db[_0x2fb1('0x3c')]['create'](_0x1ba7f8[_0x2fb1('0x57')],{'raw':!![]})[_0x2fb1('0x1d')](function(_0x47a22b){_0x44b29b=_0x47a22b;return db['VoiceContext'][_0x2fb1('0x51')]({'raw':!![]});})[_0x2fb1('0x1d')](function(_0x142263){var _0x28dde9=fs['readFileSync'](path[_0x2fb1('0x58')](config[_0x2fb1('0x59')],_0x2fb1('0x5a')),_0x2fb1('0x5b'));var _0x1024fb=ejs[_0x2fb1('0x5c')](_0x28dde9,{'contexts':_0x142263||[]});fs['writeFileSync'](_0x2fb1('0x5d'),_0x1024fb);})[_0x2fb1('0x1d')](function(){return respondWithRpcPromise(_0x2fb1('0x5e'),'create',{'module':_0x2fb1('0x5f')});})[_0x2fb1('0x1d')](function(){var _0x271c64=_0x1ba7f8[_0x2fb1('0x60')][_0x2fb1('0x34')]({'plain':!![]});if(!_0x271c64)throw new Error(_0x2fb1('0x61'));if(_0x271c64[_0x2fb1('0x62')]==='user'){var _0x508e16=_0x44b29b[_0x2fb1('0x34')]({'plain':!![]});return db[_0x2fb1('0x63')][_0x2fb1('0x64')]({'where':{'name':'Contexts','userProfileId':_0x271c64['userProfileId']},'raw':!![]})[_0x2fb1('0x1d')](function(_0x3fa8de){if(_0x3fa8de&&_0x3fa8de[_0x2fb1('0x65')]===0x0){return db['UserProfileResource']['create']({'name':_0x508e16[_0x2fb1('0x39')],'resourceId':_0x508e16['id'],'type':_0x3fa8de[_0x2fb1('0x39')],'sectionId':_0x3fa8de['id']},{})[_0x2fb1('0x1d')](function(){return _0x44b29b;});}else{return _0x44b29b;}})['catch'](function(_0x4dda8c){logger[_0x2fb1('0x21')](_0x2fb1('0x66'),_0x4dda8c);throw _0x4dda8c;});}return _0x44b29b;})['then'](respondWithResult(_0x4a73d5,0xc9))['catch'](handleError(_0x4a73d5,null));};exports['update']=function(_0xd2806c,_0x4c40a9,_0x6e3ac8){var _0x1dce89;return db[_0x2fb1('0x3c')][_0x2fb1('0x64')]({'where':{'id':_0xd2806c[_0x2fb1('0x54')]['id']}})[_0x2fb1('0x1d')](handleEntityNotFound(_0x4c40a9,null))['then'](saveUpdates(_0xd2806c[_0x2fb1('0x57')],null))[_0x2fb1('0x1d')](function(_0x45a72b){if(_0x45a72b){_0x1dce89=_0x45a72b;return db[_0x2fb1('0x3c')]['findAll']({'raw':!![]});}})[_0x2fb1('0x1d')](function(_0x56f7c7){var _0x41fb9e=fs[_0x2fb1('0x67')](path[_0x2fb1('0x58')](config['root'],_0x2fb1('0x5a')),_0x2fb1('0x5b'));var _0x4d6855=ejs[_0x2fb1('0x5c')](_0x41fb9e,{'contexts':_0x56f7c7||[]});fs['writeFileSync'](_0x2fb1('0x5d'),_0x4d6855);})['then'](function(){return respondWithRpcPromise(_0x2fb1('0x5e'),_0x2fb1('0x33'),{'module':_0x2fb1('0x5f')});})['then'](function(){return _0x1dce89;})[_0x2fb1('0x1d')](respondWithResult(_0x4c40a9,null))['catch'](handleError(_0x4c40a9,null));};exports['destroy']=function(_0x3a24b0,_0x925220,_0x2e0238){var _0xf4a1e3;return db['VoiceContext'][_0x2fb1('0x64')]({'where':{'id':_0x3a24b0['params']['id']}})[_0x2fb1('0x1d')](handleEntityNotFound(_0x925220,null))[_0x2fb1('0x1d')](removeEntity(_0x925220,null))['then'](function(){return db[_0x2fb1('0x3c')][_0x2fb1('0x51')]({'raw':!![]});})[_0x2fb1('0x1d')](function(_0x5fc6c){var _0x349568=fs[_0x2fb1('0x67')](path[_0x2fb1('0x58')](config[_0x2fb1('0x59')],_0x2fb1('0x5a')),_0x2fb1('0x5b'));var _0x20086b=ejs['render'](_0x349568,{'contexts':_0x5fc6c});fs[_0x2fb1('0x68')](_0x2fb1('0x5d'),_0x20086b);return respondWithRpcPromise(_0x2fb1('0x5e'),_0x2fb1('0x36'),{'module':_0x2fb1('0x5f')});})[_0x2fb1('0x27')](handleError(_0x925220,null));}; \ No newline at end of file +var _0x8b0d=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Contexts','UserProfileResource','destroy','end','name','map','VoiceContext','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','show','params','length','find','create','body','findAll','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','join','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x8b0d,0xbe));var _0xd8b0=function(_0x12f676,_0x295f00){_0x12f676=_0x12f676-0x0;var _0x218338=_0x8b0d[_0x12f676];return _0x218338;};'use strict';var emlformat=require(_0xd8b0('0x0'));var rimraf=require(_0xd8b0('0x1'));var zipdir=require(_0xd8b0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd8b0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd8b0('0x4'));var util=require(_0xd8b0('0x5'));var path=require(_0xd8b0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8b0('0x7'));var fs=require('fs');var fs_extra=require(_0xd8b0('0x8'));var _=require(_0xd8b0('0x9'));var squel=require(_0xd8b0('0xa'));var crypto=require(_0xd8b0('0xb'));var jsforce=require(_0xd8b0('0xc'));var deskjs=require(_0xd8b0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd8b0('0xe'));var Redis=require(_0xd8b0('0xf'));var authService=require(_0xd8b0('0x10'));var qs=require(_0xd8b0('0x11'));var as=require(_0xd8b0('0x12'));var hardwareService=require(_0xd8b0('0x13'));var logger=require(_0xd8b0('0x14'))(_0xd8b0('0x15'));var utils=require(_0xd8b0('0x16'));var config=require(_0xd8b0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8b0('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd8b0('0x19')][_0xd8b0('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x536dc0,_0x5583f1,_0x522d94,_0xcaebf1){return new BPromise(function(_0xcc3d73,_0x3631a8){var _0x50c141=_0xcaebf1||client;return _0x50c141[_0xd8b0('0x1b')](_0x536dc0,_0x522d94)['then'](function(_0xc4ee75){logger[_0xd8b0('0x1c')](_0xd8b0('0x1d'),_0x5583f1,_0xd8b0('0x1e'));logger[_0xd8b0('0x1f')](_0xd8b0('0x20'),_0x5583f1,'request\x20sent',JSON[_0xd8b0('0x21')](_0xc4ee75));if(_0xc4ee75['error']){if(_0xc4ee75['error'][_0xd8b0('0x22')]===0x1f4){logger[_0xd8b0('0x23')](_0xd8b0('0x1d'),_0x5583f1,_0xc4ee75[_0xd8b0('0x23')][_0xd8b0('0x24')]);return _0x3631a8(_0xc4ee75[_0xd8b0('0x23')][_0xd8b0('0x24')]);}logger['error'](_0xd8b0('0x1d'),_0x5583f1,_0xc4ee75[_0xd8b0('0x23')][_0xd8b0('0x24')]);return _0xcc3d73(_0xc4ee75[_0xd8b0('0x23')][_0xd8b0('0x24')]);}else{logger[_0xd8b0('0x1c')](_0xd8b0('0x1d'),_0x5583f1,_0xd8b0('0x1e'));_0xcc3d73(_0xc4ee75[_0xd8b0('0x25')][_0xd8b0('0x24')]);}})[_0xd8b0('0x26')](function(_0x592367){logger['error'](_0xd8b0('0x1d'),_0x5583f1,_0x592367);_0x3631a8(_0x592367);});});}function respondWithStatusCode(_0x455488,_0x324697){_0x324697=_0x324697||0xcc;return function(_0x3dc2d2){if(_0x3dc2d2){return _0x455488[_0xd8b0('0x27')](_0x324697);}return _0x455488[_0xd8b0('0x28')](_0x324697)['end']();};}function respondWithResult(_0x26a062,_0x131d79){_0x131d79=_0x131d79||0xc8;return function(_0x4bf7bf){if(_0x4bf7bf){return _0x26a062[_0xd8b0('0x28')](_0x131d79)[_0xd8b0('0x29')](_0x4bf7bf);}};}function respondWithFilteredResult(_0x5c3501,_0x1cc160){return function(_0x34ed96){if(_0x34ed96){var _0x2bd31b=typeof _0x1cc160[_0xd8b0('0x2a')]===_0xd8b0('0x2b')&&typeof _0x1cc160[_0xd8b0('0x2c')]===_0xd8b0('0x2b');var _0x282ff5=_0x34ed96[_0xd8b0('0x2d')];var _0x2c24cf=_0x2bd31b?0x0:_0x1cc160[_0xd8b0('0x2a')];var _0x28d48e=_0x2bd31b?_0x34ed96[_0xd8b0('0x2d')]:_0x1cc160[_0xd8b0('0x2a')]+_0x1cc160[_0xd8b0('0x2c')];var _0x2a6b79;if(_0x28d48e>=_0x282ff5){_0x28d48e=_0x282ff5;_0x2a6b79=0xc8;}else{_0x2a6b79=0xce;}_0x5c3501[_0xd8b0('0x28')](_0x2a6b79);return _0x5c3501[_0xd8b0('0x2e')](_0xd8b0('0x2f'),_0x2c24cf+'-'+_0x28d48e+'/'+_0x282ff5)[_0xd8b0('0x29')](_0x34ed96);}return null;};}function patchUpdates(_0x5b957a){return function(_0x4eb958){try{jsonpatch[_0xd8b0('0x30')](_0x4eb958,_0x5b957a,!![]);}catch(_0x8d64da){return BPromise['reject'](_0x8d64da);}return _0x4eb958[_0xd8b0('0x31')]();};}function saveUpdates(_0x3ebbcb,_0x5a133d){return function(_0x190c3d){if(_0x190c3d){return _0x190c3d[_0xd8b0('0x32')](_0x3ebbcb)[_0xd8b0('0x33')](function(_0x43912b){return _0x43912b;});}return null;};}function removeEntity(_0x11b614,_0x349cec){return function(_0x2f89c7){if(_0x2f89c7){return _0x2f89c7['destroy']()[_0xd8b0('0x33')](function(){var _0x3c94e1=_0x2f89c7[_0xd8b0('0x34')]({'plain':!![]});var _0x436568=_0xd8b0('0x35');return db[_0xd8b0('0x36')][_0xd8b0('0x37')]({'where':{'type':_0x436568,'resourceId':_0x3c94e1['id']}})[_0xd8b0('0x33')](function(){return _0x2f89c7;});})[_0xd8b0('0x33')](function(){_0x11b614['status'](0xcc)[_0xd8b0('0x38')]();});}};}function handleEntityNotFound(_0x1feb5e,_0x193ad3){return function(_0xe92560){if(!_0xe92560){_0x1feb5e[_0xd8b0('0x27')](0x194);}return _0xe92560;};}function handleError(_0xe3a697,_0x56ba5c){_0x56ba5c=_0x56ba5c||0x1f4;return function(_0x44aba3){logger[_0xd8b0('0x23')](_0x44aba3['stack']);if(_0x44aba3[_0xd8b0('0x39')]){delete _0x44aba3[_0xd8b0('0x39')];}_0xe3a697[_0xd8b0('0x28')](_0x56ba5c)['send'](_0x44aba3);};}exports['index']=function(_0x3dfbb1,_0x1cf9b3){var _0x841d5a={},_0x1c6335={},_0x55a306={'count':0x0,'rows':[]};var _0xa3574a=_[_0xd8b0('0x3a')](db[_0xd8b0('0x3b')][_0xd8b0('0x3c')],function(_0x24a4be){return{'name':_0x24a4be[_0xd8b0('0x3d')],'type':_0x24a4be[_0xd8b0('0x3e')][_0xd8b0('0x3f')]};});_0x1c6335['model']=_[_0xd8b0('0x3a')](_0xa3574a,_0xd8b0('0x39'));_0x1c6335[_0xd8b0('0x40')]=_[_0xd8b0('0x41')](_0x3dfbb1[_0xd8b0('0x40')]);_0x1c6335[_0xd8b0('0x42')]=_[_0xd8b0('0x43')](_0x1c6335['model'],_0x1c6335[_0xd8b0('0x40')]);_0x841d5a[_0xd8b0('0x44')]=_[_0xd8b0('0x43')](_0x1c6335[_0xd8b0('0x45')],qs[_0xd8b0('0x46')](_0x3dfbb1[_0xd8b0('0x40')][_0xd8b0('0x46')]));_0x841d5a['attributes']=_0x841d5a['attributes']['length']?_0x841d5a[_0xd8b0('0x44')]:_0x1c6335['model'];if(!_0x3dfbb1['query']['hasOwnProperty'](_0xd8b0('0x47'))){_0x841d5a['limit']=qs[_0xd8b0('0x2c')](_0x3dfbb1[_0xd8b0('0x40')][_0xd8b0('0x2c')]);_0x841d5a[_0xd8b0('0x2a')]=qs['offset'](_0x3dfbb1[_0xd8b0('0x40')][_0xd8b0('0x2a')]);}_0x841d5a['order']=qs[_0xd8b0('0x48')](_0x3dfbb1[_0xd8b0('0x40')]['sort']);_0x841d5a[_0xd8b0('0x49')]=qs[_0xd8b0('0x42')](_[_0xd8b0('0x4a')](_0x3dfbb1[_0xd8b0('0x40')],_0x1c6335['filters']),_0xa3574a);if(_0x3dfbb1['query']['filter']){_0x841d5a[_0xd8b0('0x49')]=_[_0xd8b0('0x4b')](_0x841d5a[_0xd8b0('0x49')],{'$or':_[_0xd8b0('0x3a')](_0xa3574a,function(_0x18ab34){if(_0x18ab34[_0xd8b0('0x3e')]!==_0xd8b0('0x4c')){var _0x43fd9a={};_0x43fd9a[_0x18ab34[_0xd8b0('0x39')]]={'$like':'%'+_0x3dfbb1[_0xd8b0('0x40')][_0xd8b0('0x4d')]+'%'};return _0x43fd9a;}})});}_0x841d5a=_[_0xd8b0('0x4b')]({},_0x841d5a,_0x3dfbb1[_0xd8b0('0x4e')]);var _0x1addff={'where':_0x841d5a[_0xd8b0('0x49')]};return db[_0xd8b0('0x3b')][_0xd8b0('0x2d')](_0x1addff)[_0xd8b0('0x33')](function(_0x2adb63){_0x55a306[_0xd8b0('0x2d')]=_0x2adb63;if(_0x3dfbb1[_0xd8b0('0x40')][_0xd8b0('0x4f')]){_0x841d5a[_0xd8b0('0x50')]=[{'all':!![]}];}return db[_0xd8b0('0x3b')]['findAll'](_0x841d5a);})[_0xd8b0('0x33')](function(_0x3d229c){_0x55a306['rows']=_0x3d229c;return _0x55a306;})[_0xd8b0('0x33')](respondWithFilteredResult(_0x1cf9b3,_0x841d5a))[_0xd8b0('0x26')](handleError(_0x1cf9b3,null));};exports[_0xd8b0('0x51')]=function(_0x310ac1,_0xb26493){var _0x5453b9={'raw':![],'where':{'id':_0x310ac1[_0xd8b0('0x52')]['id']}},_0x384ef2={};_0x384ef2[_0xd8b0('0x45')]=_[_0xd8b0('0x41')](db[_0xd8b0('0x3b')][_0xd8b0('0x3c')]);_0x384ef2[_0xd8b0('0x40')]=_[_0xd8b0('0x41')](_0x310ac1['query']);_0x384ef2[_0xd8b0('0x42')]=_[_0xd8b0('0x43')](_0x384ef2[_0xd8b0('0x45')],_0x384ef2['query']);_0x5453b9['attributes']=_[_0xd8b0('0x43')](_0x384ef2[_0xd8b0('0x45')],qs[_0xd8b0('0x46')](_0x310ac1[_0xd8b0('0x40')][_0xd8b0('0x46')]));_0x5453b9[_0xd8b0('0x44')]=_0x5453b9[_0xd8b0('0x44')][_0xd8b0('0x53')]?_0x5453b9['attributes']:_0x384ef2[_0xd8b0('0x45')];if(_0x310ac1['query'][_0xd8b0('0x4f')]){_0x5453b9[_0xd8b0('0x50')]=[{'all':!![]}];}_0x5453b9=_[_0xd8b0('0x4b')]({},_0x5453b9,_0x310ac1[_0xd8b0('0x4e')]);return db[_0xd8b0('0x3b')][_0xd8b0('0x54')](_0x5453b9)[_0xd8b0('0x33')](handleEntityNotFound(_0xb26493,null))[_0xd8b0('0x33')](respondWithResult(_0xb26493,null))[_0xd8b0('0x26')](handleError(_0xb26493,null));};exports[_0xd8b0('0x55')]=function(_0x38d57a,_0xcd6968,_0x526a80){var _0x41f2e8;return db['VoiceContext'][_0xd8b0('0x55')](_0x38d57a[_0xd8b0('0x56')],{'raw':!![]})[_0xd8b0('0x33')](function(_0x5bfe11){_0x41f2e8=_0x5bfe11;return db[_0xd8b0('0x3b')][_0xd8b0('0x57')]({'raw':!![]});})[_0xd8b0('0x33')](function(_0x5da0f6){var _0x15a1e5=fs[_0xd8b0('0x58')](path['join'](config[_0xd8b0('0x59')],'server/files/templates/context.ejs'),_0xd8b0('0x5a'));var _0x373eb0=ejs[_0xd8b0('0x5b')](_0x15a1e5,{'contexts':_0x5da0f6||[]});fs[_0xd8b0('0x5c')](_0xd8b0('0x5d'),_0x373eb0);})['then'](function(){return respondWithRpcPromise(_0xd8b0('0x5e'),_0xd8b0('0x55'),{'module':_0xd8b0('0x5f')});})[_0xd8b0('0x33')](function(){var _0x268de0=_0x38d57a['user'][_0xd8b0('0x34')]({'plain':!![]});if(!_0x268de0)throw new Error(_0xd8b0('0x60'));if(_0x268de0[_0xd8b0('0x61')]===_0xd8b0('0x62')){var _0x20f30d=_0x41f2e8['get']({'plain':!![]});return db[_0xd8b0('0x63')][_0xd8b0('0x54')]({'where':{'name':_0xd8b0('0x35'),'userProfileId':_0x268de0[_0xd8b0('0x64')]},'raw':!![]})[_0xd8b0('0x33')](function(_0x48052d){if(_0x48052d&&_0x48052d['autoAssociation']===0x0){return db[_0xd8b0('0x36')]['create']({'name':_0x20f30d[_0xd8b0('0x39')],'resourceId':_0x20f30d['id'],'type':_0x48052d[_0xd8b0('0x39')],'sectionId':_0x48052d['id']},{})[_0xd8b0('0x33')](function(){return _0x41f2e8;});}else{return _0x41f2e8;}})['catch'](function(_0x23ee8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23ee8e);throw _0x23ee8e;});}return _0x41f2e8;})['then'](respondWithResult(_0xcd6968,0xc9))[_0xd8b0('0x26')](handleError(_0xcd6968,null));};exports[_0xd8b0('0x32')]=function(_0x79035,_0x26d7a3,_0x5b94dc){var _0xb1cb73;return db[_0xd8b0('0x3b')][_0xd8b0('0x54')]({'where':{'id':_0x79035['params']['id']}})['then'](handleEntityNotFound(_0x26d7a3,null))[_0xd8b0('0x33')](saveUpdates(_0x79035['body'],null))['then'](function(_0x130b8e){if(_0x130b8e){_0xb1cb73=_0x130b8e;return db['VoiceContext'][_0xd8b0('0x57')]({'raw':!![]});}})['then'](function(_0x5ac99d){var _0x2376cc=fs[_0xd8b0('0x58')](path[_0xd8b0('0x65')](config[_0xd8b0('0x59')],_0xd8b0('0x66')),_0xd8b0('0x5a'));var _0x6c6728=ejs[_0xd8b0('0x5b')](_0x2376cc,{'contexts':_0x5ac99d||[]});fs[_0xd8b0('0x5c')](_0xd8b0('0x5d'),_0x6c6728);})[_0xd8b0('0x33')](function(){return respondWithRpcPromise(_0xd8b0('0x5e'),_0xd8b0('0x32'),{'module':_0xd8b0('0x5f')});})[_0xd8b0('0x33')](function(){return _0xb1cb73;})[_0xd8b0('0x33')](respondWithResult(_0x26d7a3,null))[_0xd8b0('0x26')](handleError(_0x26d7a3,null));};exports[_0xd8b0('0x37')]=function(_0x453c00,_0x3dcdde,_0x4a1341){var _0x1ddaef;return db['VoiceContext'][_0xd8b0('0x54')]({'where':{'id':_0x453c00['params']['id']}})[_0xd8b0('0x33')](handleEntityNotFound(_0x3dcdde,null))[_0xd8b0('0x33')](removeEntity(_0x3dcdde,null))['then'](function(){return db[_0xd8b0('0x3b')][_0xd8b0('0x57')]({'raw':!![]});})[_0xd8b0('0x33')](function(_0x594e33){var _0x2940ce=fs['readFileSync'](path[_0xd8b0('0x65')](config[_0xd8b0('0x59')],_0xd8b0('0x66')),'utf8');var _0xc190e3=ejs[_0xd8b0('0x5b')](_0x2940ce,{'contexts':_0x594e33});fs[_0xd8b0('0x5c')](_0xd8b0('0x5d'),_0xc190e3);return respondWithRpcPromise(_0xd8b0('0x5e'),_0xd8b0('0x37'),{'module':_0xd8b0('0x5f')});})[_0xd8b0('0x26')](handleError(_0x3dcdde,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 54da842..087d45d 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 _0xaa03=['./voiceContext.attributes','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa03,0xdf));var _0x3aa0=function(_0x59acf5,_0x576bb3){_0x59acf5=_0x59acf5-0x0;var _0x21f1df=_0xaa03[_0x59acf5];return _0x21f1df;};'use strict';var _=require(_0x3aa0('0x0'));var util=require(_0x3aa0('0x1'));var logger=require(_0x3aa0('0x2'))(_0x3aa0('0x3'));var moment=require(_0x3aa0('0x4'));var BPromise=require(_0x3aa0('0x5'));var rp=require(_0x3aa0('0x6'));var fs=require('fs');var path=require(_0x3aa0('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3aa0('0x8'));module['exports']=function(_0x435d4a,_0x5b5b32){return _0x435d4a['define'](_0x3aa0('0x9'),attributes,{'tableName':_0x3aa0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa108=['voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0xa108,0xc4));var _0x8a10=function(_0x224077,_0xeffd6b){_0x224077=_0x224077-0x0;var _0xf36f81=_0xa108[_0x224077];return _0xf36f81;};'use strict';var _=require(_0x8a10('0x0'));var util=require(_0x8a10('0x1'));var logger=require(_0x8a10('0x2'))(_0x8a10('0x3'));var moment=require(_0x8a10('0x4'));var BPromise=require(_0x8a10('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a10('0x6'));var rimraf=require(_0x8a10('0x7'));var config=require(_0x8a10('0x8'));var attributes=require(_0x8a10('0x9'));module['exports']=function(_0x112f33,_0x425989){return _0x112f33[_0x8a10('0xa')](_0x8a10('0xb'),attributes,{'tableName':_0x8a10('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 427494d..fc0a7e7 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 _0x6c9f=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3019ec,_0x378b8b){var _0x3db9c1=function(_0x3637ca){while(--_0x3637ca){_0x3019ec['push'](_0x3019ec['shift']());}};_0x3db9c1(++_0x378b8b);}(_0x6c9f,0x16a));var _0xf6c9=function(_0x5a866a,_0x3e83a5){_0x5a866a=_0x5a866a-0x0;var _0x5d281c=_0x6c9f[_0x5a866a];return _0x5d281c;};'use strict';var _=require(_0xf6c9('0x0'));var util=require('util');var moment=require(_0xf6c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xf6c9('0x2'));var fs=require('fs');var Redis=require(_0xf6c9('0x3'));var db=require(_0xf6c9('0x4'))['db'];var utils=require(_0xf6c9('0x5'));var logger=require(_0xf6c9('0x6'))(_0xf6c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xf6c9('0x8'));var client=jayson[_0xf6c9('0x9')][_0xf6c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2abc04,_0x151322,_0x3d8579){return new BPromise(function(_0x24901b,_0x105f16){return client[_0xf6c9('0xb')](_0x2abc04,_0x3d8579)['then'](function(_0x3d93f7){logger[_0xf6c9('0xc')](_0xf6c9('0xd'),_0x151322,_0xf6c9('0xe'));logger[_0xf6c9('0xf')](_0xf6c9('0x10'),_0x151322,_0xf6c9('0xe'),JSON[_0xf6c9('0x11')](_0x3d93f7));if(_0x3d93f7[_0xf6c9('0x12')]){if(_0x3d93f7['error'][_0xf6c9('0x13')]===0x1f4){logger[_0xf6c9('0x12')](_0xf6c9('0xd'),_0x151322,_0x3d93f7[_0xf6c9('0x12')]['message']);return _0x105f16(_0x3d93f7['error'][_0xf6c9('0x14')]);}logger[_0xf6c9('0x12')](_0xf6c9('0xd'),_0x151322,_0x3d93f7[_0xf6c9('0x12')][_0xf6c9('0x14')]);return _0x24901b(_0x3d93f7[_0xf6c9('0x12')]['message']);}else{logger['info'](_0xf6c9('0xd'),_0x151322,_0xf6c9('0xe'));_0x24901b(_0x3d93f7['result'][_0xf6c9('0x14')]);}})[_0xf6c9('0x15')](function(_0x276b26){logger[_0xf6c9('0x12')](_0xf6c9('0xd'),_0x151322,_0x276b26);_0x105f16(_0x276b26);});});} \ No newline at end of file +var _0xc87b=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x460b3e,_0x44e1d7){var _0x4a85c8=function(_0x1dc185){while(--_0x1dc185){_0x460b3e['push'](_0x460b3e['shift']());}};_0x4a85c8(++_0x44e1d7);}(_0xc87b,0xb2));var _0xbc87=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xc87b[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0xbc87('0x0'));var util=require(_0xbc87('0x1'));var moment=require(_0xbc87('0x2'));var BPromise=require(_0xbc87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc87('0x4'));var db=require(_0xbc87('0x5'))['db'];var utils=require(_0xbc87('0x6'));var logger=require('../../config/logger')(_0xbc87('0x7'));var config=require(_0xbc87('0x8'));var jayson=require(_0xbc87('0x9'));var client=jayson[_0xbc87('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444000,_0x2efa9f,_0x51d5ed){return new BPromise(function(_0x2946bc,_0x1cc8d6){return client[_0xbc87('0xb')](_0x444000,_0x51d5ed)[_0xbc87('0xc')](function(_0x284f80){logger[_0xbc87('0xd')](_0xbc87('0xe'),_0x2efa9f,_0xbc87('0xf'));logger['debug'](_0xbc87('0x10'),_0x2efa9f,'request\x20sent',JSON[_0xbc87('0x11')](_0x284f80));if(_0x284f80[_0xbc87('0x12')]){if(_0x284f80[_0xbc87('0x12')]['code']===0x1f4){logger[_0xbc87('0x12')](_0xbc87('0xe'),_0x2efa9f,_0x284f80[_0xbc87('0x12')][_0xbc87('0x13')]);return _0x1cc8d6(_0x284f80[_0xbc87('0x12')]['message']);}logger[_0xbc87('0x12')](_0xbc87('0xe'),_0x2efa9f,_0x284f80['error'][_0xbc87('0x13')]);return _0x2946bc(_0x284f80[_0xbc87('0x12')][_0xbc87('0x13')]);}else{logger[_0xbc87('0xd')](_0xbc87('0xe'),_0x2efa9f,_0xbc87('0xf'));_0x2946bc(_0x284f80[_0xbc87('0x14')]['message']);}})[_0xbc87('0x15')](function(_0xa0de3d){logger[_0xbc87('0x12')](_0xbc87('0xe'),_0x2efa9f,_0xa0de3d);_0x1cc8d6(_0xa0de3d);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 908a777..b961b5e 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 _0x1f7f=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','create','put','update','destroy','exports','multer'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x1f7f,0xbd));var _0xf1f7=function(_0x66808a,_0x60f3bd){_0x66808a=_0x66808a-0x0;var _0x760006=_0x1f7f[_0x66808a];return _0x760006;};'use strict';var multer=require(_0xf1f7('0x0'));var util=require(_0xf1f7('0x1'));var path=require(_0xf1f7('0x2'));var timeout=require('connect-timeout');var express=require(_0xf1f7('0x3'));var router=express[_0xf1f7('0x4')]();var fs_extra=require(_0xf1f7('0x5'));var auth=require(_0xf1f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf1f7('0x7'));var controller=require(_0xf1f7('0x8'));router[_0xf1f7('0x9')]('/',auth[_0xf1f7('0xa')](),controller[_0xf1f7('0xb')]);router[_0xf1f7('0x9')]('/describe',auth[_0xf1f7('0xa')](),controller[_0xf1f7('0xc')]);router[_0xf1f7('0x9')](_0xf1f7('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf1f7('0xa')](),controller[_0xf1f7('0xe')]);router[_0xf1f7('0xf')](_0xf1f7('0xd'),auth[_0xf1f7('0xa')](),controller[_0xf1f7('0x10')]);router['delete'](_0xf1f7('0xd'),auth[_0xf1f7('0xa')](),controller[_0xf1f7('0x11')]);module[_0xf1f7('0x12')]=router; \ No newline at end of file +var _0xd6be=['put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x262db8,_0x551bb2){var _0x1d8323=function(_0x5dfbb3){while(--_0x5dfbb3){_0x262db8['push'](_0x262db8['shift']());}};_0x1d8323(++_0x551bb2);}(_0xd6be,0x1bd));var _0xed6b=function(_0x189c87,_0x5f4abd){_0x189c87=_0x189c87-0x0;var _0x494842=_0xd6be[_0x189c87];return _0x494842;};'use strict';var multer=require(_0xed6b('0x0'));var util=require(_0xed6b('0x1'));var path=require('path');var timeout=require(_0xed6b('0x2'));var express=require(_0xed6b('0x3'));var router=express['Router']();var fs_extra=require(_0xed6b('0x4'));var auth=require(_0xed6b('0x5'));var interaction=require(_0xed6b('0x6'));var config=require(_0xed6b('0x7'));var controller=require(_0xed6b('0x8'));router[_0xed6b('0x9')]('/',auth[_0xed6b('0xa')](),controller['index']);router['get'](_0xed6b('0xb'),auth[_0xed6b('0xa')](),controller[_0xed6b('0xc')]);router[_0xed6b('0x9')](_0xed6b('0xd'),auth[_0xed6b('0xa')](),controller[_0xed6b('0xe')]);router[_0xed6b('0xf')]('/',auth['isAuthenticated'](),controller[_0xed6b('0x10')]);router[_0xed6b('0x11')]('/:id',auth[_0xed6b('0xa')](),controller[_0xed6b('0x12')]);router[_0xed6b('0x13')](_0xed6b('0xd'),auth[_0xed6b('0xa')](),controller[_0xed6b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index de9e358..b59f4e6 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 _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0x7a5535,_0x42e99f){var _0x580250=function(_0x2a9d76){while(--_0x2a9d76){_0x7a5535['push'](_0x7a5535['shift']());}};_0x580250(++_0x42e99f);}(_0x425d,0x1e0));var _0xd425=function(_0x5d4390,_0x21b7d8){_0x5d4390=_0x5d4390-0x0;var _0x4f3e01=_0x425d[_0x5d4390];return _0x4f3e01;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x2')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize[_0xd425('0x1')]},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x2')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'destlinkedid':{'type':Sequelize[_0xd425('0x1')]},'dialstring':{'type':Sequelize[_0xd425('0x1')]},'dialstatus':{'type':Sequelize[_0xd425('0x1')]},'starttime':{'type':Sequelize[_0xd425('0x3')]},'answertime':{'type':Sequelize[_0xd425('0x3')]},'endtime':{'type':Sequelize[_0xd425('0x3')]},'lastevent':{'type':Sequelize[_0xd425('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd425('0x2')]},'duration':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x008c=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0xc2917e,_0x3903ed){var _0x11e716=function(_0x38da18){while(--_0x38da18){_0xc2917e['push'](_0xc2917e['shift']());}};_0x11e716(++_0x3903ed);}(_0x008c,0x188));var _0xc008=function(_0x7e1b6b,_0x4ad71d){_0x7e1b6b=_0x7e1b6b-0x0;var _0x2b086f=_0x008c[_0x7e1b6b];return _0x2b086f;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'privilege':{'type':Sequelize[_0xc008('0x2')]},'channel':{'type':Sequelize[_0xc008('0x2')]},'channelstate':{'type':Sequelize[_0xc008('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc008('0x2')]},'calleridname':{'type':Sequelize[_0xc008('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'connectedlinename':{'type':Sequelize[_0xc008('0x2')]},'language':{'type':Sequelize[_0xc008('0x2')]},'accountcode':{'type':Sequelize[_0xc008('0x2')]},'context':{'type':Sequelize[_0xc008('0x2')]},'exten':{'type':Sequelize[_0xc008('0x2')]},'priority':{'type':Sequelize[_0xc008('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xc008('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc008('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc008('0x2')]},'destexten':{'type':Sequelize[_0xc008('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xc008('0x2')]},'destlinkedid':{'type':Sequelize[_0xc008('0x2')]},'dialstring':{'type':Sequelize[_0xc008('0x2')]},'dialstatus':{'type':Sequelize[_0xc008('0x2')]},'starttime':{'type':Sequelize[_0xc008('0x4')]},'answertime':{'type':Sequelize[_0xc008('0x4')]},'endtime':{'type':Sequelize[_0xc008('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xc008('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xc008('0x3')]},'billableseconds':{'type':Sequelize[_0xc008('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 52ae0a0..3e97958 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 _0xbb27=['nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','VoiceDialReport','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','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','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x3e336c,_0x44bcc6){var _0x5bebef=function(_0x3c04bd){while(--_0x3c04bd){_0x3e336c['push'](_0x3e336c['shift']());}};_0x5bebef(++_0x44bcc6);}(_0xbb27,0x1da));var _0x7bb2=function(_0x3421ab,_0x227d8c){_0x3421ab=_0x3421ab-0x0;var _0x3b3066=_0xbb27[_0x3421ab];return _0x3b3066;};'use strict';var emlformat=require(_0x7bb2('0x0'));var rimraf=require(_0x7bb2('0x1'));var zipdir=require(_0x7bb2('0x2'));var jsonpatch=require(_0x7bb2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7bb2('0x4'));var Mustache=require(_0x7bb2('0x5'));var util=require(_0x7bb2('0x6'));var path=require('path');var sox=require(_0x7bb2('0x7'));var csv=require('to-csv');var ejs=require(_0x7bb2('0x8'));var fs=require('fs');var fs_extra=require(_0x7bb2('0x9'));var _=require(_0x7bb2('0xa'));var squel=require(_0x7bb2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7bb2('0xc'));var toCsv=require(_0x7bb2('0xd'));var querystring=require(_0x7bb2('0xe'));var Papa=require(_0x7bb2('0xf'));var Redis=require(_0x7bb2('0x10'));var authService=require(_0x7bb2('0x11'));var qs=require(_0x7bb2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bb2('0x13'));var logger=require(_0x7bb2('0x14'))(_0x7bb2('0x15'));var utils=require(_0x7bb2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bb2('0x17'))['db'];function respondWithStatusCode(_0x585f88,_0x424594){_0x424594=_0x424594||0xcc;return function(_0x261939){if(_0x261939){return _0x585f88[_0x7bb2('0x18')](_0x424594);}return _0x585f88[_0x7bb2('0x19')](_0x424594)[_0x7bb2('0x1a')]();};}function respondWithResult(_0x374ce5,_0x3033f2){_0x3033f2=_0x3033f2||0xc8;return function(_0x4b4aa4){if(_0x4b4aa4){return _0x374ce5['status'](_0x3033f2)[_0x7bb2('0x1b')](_0x4b4aa4);}};}function respondWithFilteredResult(_0x53ffd0,_0x1a9ab6){return function(_0x3999f2){if(_0x3999f2){var _0x52e9c8=typeof _0x1a9ab6[_0x7bb2('0x1c')]===_0x7bb2('0x1d')&&typeof _0x1a9ab6[_0x7bb2('0x1e')]==='undefined';var _0xed1b0e=_0x3999f2['count'];var _0x46b3c1=_0x52e9c8?0x0:_0x1a9ab6[_0x7bb2('0x1c')];var _0x2b749d=_0x52e9c8?_0x3999f2[_0x7bb2('0x1f')]:_0x1a9ab6[_0x7bb2('0x1c')]+_0x1a9ab6['limit'];var _0x4b7c7a;if(_0x2b749d>=_0xed1b0e){_0x2b749d=_0xed1b0e;_0x4b7c7a=0xc8;}else{_0x4b7c7a=0xce;}_0x53ffd0[_0x7bb2('0x19')](_0x4b7c7a);return _0x53ffd0['set'](_0x7bb2('0x20'),_0x46b3c1+'-'+_0x2b749d+'/'+_0xed1b0e)[_0x7bb2('0x1b')](_0x3999f2);}return null;};}function patchUpdates(_0x178c3f){return function(_0x424569){try{jsonpatch[_0x7bb2('0x21')](_0x424569,_0x178c3f,!![]);}catch(_0xdcdb32){return BPromise[_0x7bb2('0x22')](_0xdcdb32);}return _0x424569[_0x7bb2('0x23')]();};}function saveUpdates(_0x3d7f72,_0x3f9ae7){return function(_0x1c3a5e){if(_0x1c3a5e){return _0x1c3a5e[_0x7bb2('0x24')](_0x3d7f72)[_0x7bb2('0x25')](function(_0x5c57e1){return _0x5c57e1;});}return null;};}function removeEntity(_0x56adb9,_0x18fd3f){return function(_0x2a456d){if(_0x2a456d){return _0x2a456d[_0x7bb2('0x26')]()[_0x7bb2('0x25')](function(){_0x56adb9[_0x7bb2('0x19')](0xcc)[_0x7bb2('0x1a')]();});}};}function handleEntityNotFound(_0x164113,_0x57c99c){return function(_0x169d1e){if(!_0x169d1e){_0x164113[_0x7bb2('0x18')](0x194);}return _0x169d1e;};}function handleError(_0x4ecb7e,_0x1e0247){_0x1e0247=_0x1e0247||0x1f4;return function(_0x1c6d7e){logger[_0x7bb2('0x27')](_0x1c6d7e[_0x7bb2('0x28')]);if(_0x1c6d7e['name']){delete _0x1c6d7e[_0x7bb2('0x29')];}_0x4ecb7e[_0x7bb2('0x19')](_0x1e0247)[_0x7bb2('0x2a')](_0x1c6d7e);};}exports[_0x7bb2('0x2b')]=function(_0x55f33d,_0x92e5b0){var _0x3e725b={},_0x449ad0={},_0x372187={'count':0x0,'rows':[]};var _0xacf12=_[_0x7bb2('0x2c')](db['VoiceDialReport'][_0x7bb2('0x2d')],function(_0x364516){return{'name':_0x364516[_0x7bb2('0x2e')],'type':_0x364516[_0x7bb2('0x2f')][_0x7bb2('0x30')]};});_0x449ad0[_0x7bb2('0x31')]=_[_0x7bb2('0x2c')](_0xacf12,_0x7bb2('0x29'));_0x449ad0[_0x7bb2('0x32')]=_[_0x7bb2('0x33')](_0x55f33d[_0x7bb2('0x32')]);_0x449ad0[_0x7bb2('0x34')]=_[_0x7bb2('0x35')](_0x449ad0[_0x7bb2('0x31')],_0x449ad0['query']);_0x3e725b[_0x7bb2('0x36')]=_[_0x7bb2('0x35')](_0x449ad0[_0x7bb2('0x31')],qs[_0x7bb2('0x37')](_0x55f33d['query'][_0x7bb2('0x37')]));_0x3e725b['attributes']=_0x3e725b['attributes'][_0x7bb2('0x38')]?_0x3e725b[_0x7bb2('0x36')]:_0x449ad0[_0x7bb2('0x31')];if(!_0x55f33d[_0x7bb2('0x32')][_0x7bb2('0x39')](_0x7bb2('0x3a'))){_0x3e725b[_0x7bb2('0x1e')]=qs[_0x7bb2('0x1e')](_0x55f33d[_0x7bb2('0x32')][_0x7bb2('0x1e')]);_0x3e725b[_0x7bb2('0x1c')]=qs[_0x7bb2('0x1c')](_0x55f33d['query']['offset']);}_0x3e725b[_0x7bb2('0x3b')]=qs['sort'](_0x55f33d[_0x7bb2('0x32')][_0x7bb2('0x3c')]);_0x3e725b['where']=qs[_0x7bb2('0x34')](_['pick'](_0x55f33d[_0x7bb2('0x32')],_0x449ad0[_0x7bb2('0x34')]),_0xacf12);if(_0x55f33d['query'][_0x7bb2('0x3d')]){_0x3e725b['where']=_[_0x7bb2('0x3e')](_0x3e725b[_0x7bb2('0x3f')],{'$or':_[_0x7bb2('0x2c')](_0xacf12,function(_0x159679){if(_0x159679[_0x7bb2('0x2f')]!==_0x7bb2('0x40')){var _0xd3b4fd={};_0xd3b4fd[_0x159679['name']]={'$like':'%'+_0x55f33d['query']['filter']+'%'};return _0xd3b4fd;}})});}_0x3e725b=_['merge']({},_0x3e725b,_0x55f33d[_0x7bb2('0x41')]);var _0x43a6b4={'where':_0x3e725b[_0x7bb2('0x3f')]};return db['VoiceDialReport'][_0x7bb2('0x1f')](_0x43a6b4)[_0x7bb2('0x25')](function(_0x3f1f66){_0x372187[_0x7bb2('0x1f')]=_0x3f1f66;if(_0x55f33d[_0x7bb2('0x32')][_0x7bb2('0x42')]){_0x3e725b[_0x7bb2('0x43')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x3e725b);})[_0x7bb2('0x25')](function(_0x1ee8ff){_0x372187[_0x7bb2('0x44')]=_0x1ee8ff;return _0x372187;})['then'](respondWithFilteredResult(_0x92e5b0,_0x3e725b))['catch'](handleError(_0x92e5b0,null));};exports[_0x7bb2('0x45')]=function(_0x3d7cb8,_0x2b44ca){var _0xec670b={'raw':!![],'where':{'id':_0x3d7cb8['params']['id']}},_0x1d0e79={};_0x1d0e79[_0x7bb2('0x31')]=_['keys'](db[_0x7bb2('0x46')]['rawAttributes']);_0x1d0e79['query']=_[_0x7bb2('0x33')](_0x3d7cb8[_0x7bb2('0x32')]);_0x1d0e79['filters']=_[_0x7bb2('0x35')](_0x1d0e79[_0x7bb2('0x31')],_0x1d0e79[_0x7bb2('0x32')]);_0xec670b[_0x7bb2('0x36')]=_[_0x7bb2('0x35')](_0x1d0e79[_0x7bb2('0x31')],qs[_0x7bb2('0x37')](_0x3d7cb8[_0x7bb2('0x32')][_0x7bb2('0x37')]));_0xec670b[_0x7bb2('0x36')]=_0xec670b[_0x7bb2('0x36')][_0x7bb2('0x38')]?_0xec670b['attributes']:_0x1d0e79[_0x7bb2('0x31')];if(_0x3d7cb8['query']['includeAll']){_0xec670b['include']=[{'all':!![]}];}_0xec670b=_['merge']({},_0xec670b,_0x3d7cb8[_0x7bb2('0x41')]);return db[_0x7bb2('0x46')]['find'](_0xec670b)[_0x7bb2('0x25')](handleEntityNotFound(_0x2b44ca,null))[_0x7bb2('0x25')](respondWithResult(_0x2b44ca,null))[_0x7bb2('0x47')](handleError(_0x2b44ca,null));};exports[_0x7bb2('0x48')]=function(_0x2d0372,_0x57bfc2){return db['VoiceDialReport']['create'](_0x2d0372[_0x7bb2('0x49')],{})[_0x7bb2('0x25')](respondWithResult(_0x57bfc2,0xc9))[_0x7bb2('0x47')](handleError(_0x57bfc2,null));};exports[_0x7bb2('0x24')]=function(_0x5524f5,_0x236a20){if(_0x5524f5[_0x7bb2('0x49')]['id']){delete _0x5524f5[_0x7bb2('0x49')]['id'];}return db[_0x7bb2('0x46')]['find']({'where':{'id':_0x5524f5[_0x7bb2('0x4a')]['id']}})[_0x7bb2('0x25')](handleEntityNotFound(_0x236a20,null))[_0x7bb2('0x25')](saveUpdates(_0x5524f5[_0x7bb2('0x49')],null))[_0x7bb2('0x25')](respondWithResult(_0x236a20,null))['catch'](handleError(_0x236a20,null));};exports[_0x7bb2('0x26')]=function(_0xf6a148,_0x1153d1){return db[_0x7bb2('0x46')]['find']({'where':{'id':_0xf6a148[_0x7bb2('0x4a')]['id']}})[_0x7bb2('0x25')](handleEntityNotFound(_0x1153d1,null))['then'](removeEntity(_0x1153d1,null))[_0x7bb2('0x47')](handleError(_0x1153d1,null));};exports[_0x7bb2('0x4b')]=function(_0x5a9c10,_0x2b83a6){return db[_0x7bb2('0x46')][_0x7bb2('0x4b')]()[_0x7bb2('0x25')](respondWithResult(_0x2b83a6,null))[_0x7bb2('0x47')](handleError(_0x2b83a6,null));}; \ No newline at end of file +var _0x993f=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','VoiceDialReport','rawAttributes','type','key','model','query','keys'];(function(_0x35b63e,_0xf8ded2){var _0x2dc057=function(_0x3555eb){while(--_0x3555eb){_0x35b63e['push'](_0x35b63e['shift']());}};_0x2dc057(++_0xf8ded2);}(_0x993f,0x18f));var _0xf993=function(_0x77411d,_0x4610fa){_0x77411d=_0x77411d-0x0;var _0x20133d=_0x993f[_0x77411d];return _0x20133d;};'use strict';var emlformat=require(_0xf993('0x0'));var rimraf=require(_0xf993('0x1'));var zipdir=require(_0xf993('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf993('0x3'));var moment=require(_0xf993('0x4'));var BPromise=require(_0xf993('0x5'));var Mustache=require(_0xf993('0x6'));var util=require(_0xf993('0x7'));var path=require(_0xf993('0x8'));var sox=require(_0xf993('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf993('0xa'));var _=require('lodash');var squel=require(_0xf993('0xb'));var crypto=require(_0xf993('0xc'));var jsforce=require(_0xf993('0xd'));var deskjs=require(_0xf993('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf993('0xf'));var Papa=require(_0xf993('0x10'));var Redis=require(_0xf993('0x11'));var authService=require(_0xf993('0x12'));var qs=require(_0xf993('0x13'));var as=require(_0xf993('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf993('0x15'))(_0xf993('0x16'));var utils=require('../../config/utils');var config=require(_0xf993('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf993('0x18'))['db'];function respondWithStatusCode(_0x27233d,_0x2c4765){_0x2c4765=_0x2c4765||0xcc;return function(_0x484b03){if(_0x484b03){return _0x27233d[_0xf993('0x19')](_0x2c4765);}return _0x27233d[_0xf993('0x1a')](_0x2c4765)[_0xf993('0x1b')]();};}function respondWithResult(_0x27b174,_0x459db4){_0x459db4=_0x459db4||0xc8;return function(_0x6d0dab){if(_0x6d0dab){return _0x27b174[_0xf993('0x1a')](_0x459db4)[_0xf993('0x1c')](_0x6d0dab);}};}function respondWithFilteredResult(_0x7f3295,_0x5b46de){return function(_0x2ca771){if(_0x2ca771){var _0x2be395=typeof _0x5b46de[_0xf993('0x1d')]===_0xf993('0x1e')&&typeof _0x5b46de[_0xf993('0x1f')]===_0xf993('0x1e');var _0x2be869=_0x2ca771[_0xf993('0x20')];var _0x585293=_0x2be395?0x0:_0x5b46de[_0xf993('0x1d')];var _0x35b475=_0x2be395?_0x2ca771[_0xf993('0x20')]:_0x5b46de[_0xf993('0x1d')]+_0x5b46de['limit'];var _0xd19d57;if(_0x35b475>=_0x2be869){_0x35b475=_0x2be869;_0xd19d57=0xc8;}else{_0xd19d57=0xce;}_0x7f3295[_0xf993('0x1a')](_0xd19d57);return _0x7f3295[_0xf993('0x21')](_0xf993('0x22'),_0x585293+'-'+_0x35b475+'/'+_0x2be869)[_0xf993('0x1c')](_0x2ca771);}return null;};}function patchUpdates(_0x51ca27){return function(_0x13f32f){try{jsonpatch[_0xf993('0x23')](_0x13f32f,_0x51ca27,!![]);}catch(_0x236958){return BPromise[_0xf993('0x24')](_0x236958);}return _0x13f32f[_0xf993('0x25')]();};}function saveUpdates(_0x45c3d3,_0x5a0022){return function(_0x46ec48){if(_0x46ec48){return _0x46ec48[_0xf993('0x26')](_0x45c3d3)[_0xf993('0x27')](function(_0x406d16){return _0x406d16;});}return null;};}function removeEntity(_0x1866f7,_0x208bbb){return function(_0x153553){if(_0x153553){return _0x153553['destroy']()['then'](function(){_0x1866f7[_0xf993('0x1a')](0xcc)[_0xf993('0x1b')]();});}};}function handleEntityNotFound(_0x4b6d21,_0x5083e5){return function(_0x438a38){if(!_0x438a38){_0x4b6d21[_0xf993('0x19')](0x194);}return _0x438a38;};}function handleError(_0x2906d6,_0x538af3){_0x538af3=_0x538af3||0x1f4;return function(_0x2c26d3){logger['error'](_0x2c26d3[_0xf993('0x28')]);if(_0x2c26d3[_0xf993('0x29')]){delete _0x2c26d3[_0xf993('0x29')];}_0x2906d6[_0xf993('0x1a')](_0x538af3)[_0xf993('0x2a')](_0x2c26d3);};}exports['index']=function(_0x419f6,_0x560b5){var _0x343b7a={},_0x2292d6={},_0x185a05={'count':0x0,'rows':[]};var _0x2ca280=_[_0xf993('0x2b')](db[_0xf993('0x2c')][_0xf993('0x2d')],function(_0x3649df){return{'name':_0x3649df['fieldName'],'type':_0x3649df[_0xf993('0x2e')][_0xf993('0x2f')]};});_0x2292d6[_0xf993('0x30')]=_['map'](_0x2ca280,_0xf993('0x29'));_0x2292d6[_0xf993('0x31')]=_[_0xf993('0x32')](_0x419f6[_0xf993('0x31')]);_0x2292d6[_0xf993('0x33')]=_[_0xf993('0x34')](_0x2292d6[_0xf993('0x30')],_0x2292d6[_0xf993('0x31')]);_0x343b7a[_0xf993('0x35')]=_[_0xf993('0x34')](_0x2292d6[_0xf993('0x30')],qs[_0xf993('0x36')](_0x419f6[_0xf993('0x31')][_0xf993('0x36')]));_0x343b7a[_0xf993('0x35')]=_0x343b7a[_0xf993('0x35')]['length']?_0x343b7a[_0xf993('0x35')]:_0x2292d6[_0xf993('0x30')];if(!_0x419f6['query'][_0xf993('0x37')](_0xf993('0x38'))){_0x343b7a[_0xf993('0x1f')]=qs['limit'](_0x419f6[_0xf993('0x31')][_0xf993('0x1f')]);_0x343b7a[_0xf993('0x1d')]=qs[_0xf993('0x1d')](_0x419f6[_0xf993('0x31')]['offset']);}_0x343b7a[_0xf993('0x39')]=qs[_0xf993('0x3a')](_0x419f6[_0xf993('0x31')][_0xf993('0x3a')]);_0x343b7a[_0xf993('0x3b')]=qs['filters'](_[_0xf993('0x3c')](_0x419f6[_0xf993('0x31')],_0x2292d6[_0xf993('0x33')]),_0x2ca280);if(_0x419f6[_0xf993('0x31')]['filter']){_0x343b7a[_0xf993('0x3b')]=_[_0xf993('0x3d')](_0x343b7a[_0xf993('0x3b')],{'$or':_[_0xf993('0x2b')](_0x2ca280,function(_0x33a264){if(_0x33a264['type']!==_0xf993('0x3e')){var _0x1ad055={};_0x1ad055[_0x33a264[_0xf993('0x29')]]={'$like':'%'+_0x419f6[_0xf993('0x31')]['filter']+'%'};return _0x1ad055;}})});}_0x343b7a=_[_0xf993('0x3d')]({},_0x343b7a,_0x419f6[_0xf993('0x3f')]);var _0x3fb298={'where':_0x343b7a[_0xf993('0x3b')]};return db[_0xf993('0x2c')]['count'](_0x3fb298)['then'](function(_0x1b72be){_0x185a05[_0xf993('0x20')]=_0x1b72be;if(_0x419f6[_0xf993('0x31')][_0xf993('0x40')]){_0x343b7a[_0xf993('0x41')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xf993('0x42')](_0x343b7a);})['then'](function(_0x2a84b6){_0x185a05['rows']=_0x2a84b6;return _0x185a05;})['then'](respondWithFilteredResult(_0x560b5,_0x343b7a))[_0xf993('0x43')](handleError(_0x560b5,null));};exports[_0xf993('0x44')]=function(_0x7c1c1c,_0x18c2c7){var _0x4a90ac={'raw':!![],'where':{'id':_0x7c1c1c[_0xf993('0x45')]['id']}},_0xeb5a65={};_0xeb5a65[_0xf993('0x30')]=_[_0xf993('0x32')](db[_0xf993('0x2c')]['rawAttributes']);_0xeb5a65[_0xf993('0x31')]=_[_0xf993('0x32')](_0x7c1c1c[_0xf993('0x31')]);_0xeb5a65[_0xf993('0x33')]=_[_0xf993('0x34')](_0xeb5a65[_0xf993('0x30')],_0xeb5a65['query']);_0x4a90ac[_0xf993('0x35')]=_[_0xf993('0x34')](_0xeb5a65[_0xf993('0x30')],qs[_0xf993('0x36')](_0x7c1c1c[_0xf993('0x31')][_0xf993('0x36')]));_0x4a90ac[_0xf993('0x35')]=_0x4a90ac[_0xf993('0x35')]['length']?_0x4a90ac[_0xf993('0x35')]:_0xeb5a65[_0xf993('0x30')];if(_0x7c1c1c[_0xf993('0x31')][_0xf993('0x40')]){_0x4a90ac[_0xf993('0x41')]=[{'all':!![]}];}_0x4a90ac=_['merge']({},_0x4a90ac,_0x7c1c1c[_0xf993('0x3f')]);return db[_0xf993('0x2c')]['find'](_0x4a90ac)[_0xf993('0x27')](handleEntityNotFound(_0x18c2c7,null))[_0xf993('0x27')](respondWithResult(_0x18c2c7,null))[_0xf993('0x43')](handleError(_0x18c2c7,null));};exports[_0xf993('0x46')]=function(_0x1d64ac,_0x1ee372){return db[_0xf993('0x2c')][_0xf993('0x46')](_0x1d64ac[_0xf993('0x47')],{})['then'](respondWithResult(_0x1ee372,0xc9))['catch'](handleError(_0x1ee372,null));};exports['update']=function(_0x1de410,_0x58c169){if(_0x1de410['body']['id']){delete _0x1de410[_0xf993('0x47')]['id'];}return db[_0xf993('0x2c')][_0xf993('0x48')]({'where':{'id':_0x1de410[_0xf993('0x45')]['id']}})['then'](handleEntityNotFound(_0x58c169,null))[_0xf993('0x27')](saveUpdates(_0x1de410['body'],null))[_0xf993('0x27')](respondWithResult(_0x58c169,null))[_0xf993('0x43')](handleError(_0x58c169,null));};exports[_0xf993('0x49')]=function(_0x3e6ffb,_0x37ae0e){return db[_0xf993('0x2c')]['find']({'where':{'id':_0x3e6ffb[_0xf993('0x45')]['id']}})[_0xf993('0x27')](handleEntityNotFound(_0x37ae0e,null))[_0xf993('0x27')](removeEntity(_0x37ae0e,null))[_0xf993('0x43')](handleError(_0x37ae0e,null));};exports[_0xf993('0x4a')]=function(_0x24c80e,_0x47414a){return db[_0xf993('0x2c')][_0xf993('0x4a')]()[_0xf993('0x27')](respondWithResult(_0x47414a,null))[_0xf993('0x43')](handleError(_0x47414a,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 1d8b312..ecb707b 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 _0xc96c=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','uniqueid'];(function(_0x2f1101,_0xfbafa6){var _0x3decca=function(_0x181ce0){while(--_0x181ce0){_0x2f1101['push'](_0x2f1101['shift']());}};_0x3decca(++_0xfbafa6);}(_0xc96c,0x14a));var _0xcc96=function(_0x43e3f1,_0xbb0bfa){_0x43e3f1=_0x43e3f1-0x0;var _0x220cc5=_0xc96c[_0x43e3f1];return _0x220cc5;};'use strict';var _=require('lodash');var util=require(_0xcc96('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcc96('0x1'));var BPromise=require(_0xcc96('0x2'));var rp=require(_0xcc96('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc96('0x4'));var config=require(_0xcc96('0x5'));var attributes=require(_0xcc96('0x6'));module[_0xcc96('0x7')]=function(_0x32cba9,_0x5e3ce3){return _0x32cba9['define'](_0xcc96('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xcc96('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5ad=['moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2e6dee,_0x1a61b0){var _0x47706=function(_0x365546){while(--_0x365546){_0x2e6dee['push'](_0x2e6dee['shift']());}};_0x47706(++_0x1a61b0);}(_0xc5ad,0xea));var _0xdc5a=function(_0x28068c,_0x2e0454){_0x28068c=_0x28068c-0x0;var _0x13559a=_0xc5ad[_0x28068c];return _0x13559a;};'use strict';var _=require(_0xdc5a('0x0'));var util=require(_0xdc5a('0x1'));var logger=require(_0xdc5a('0x2'))(_0xdc5a('0x3'));var moment=require(_0xdc5a('0x4'));var BPromise=require(_0xdc5a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc5a('0x6'));var rimraf=require(_0xdc5a('0x7'));var config=require(_0xdc5a('0x8'));var attributes=require(_0xdc5a('0x9'));module[_0xdc5a('0xa')]=function(_0x51544e,_0x5a71f1){return _0x51544e[_0xdc5a('0xb')]('VoiceDialReport',attributes,{'tableName':_0xdc5a('0xc'),'paranoid':![],'indexes':[{'fields':[_0xdc5a('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 e0cee88..2939383 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 _0xbaaf=['then','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','VoiceDialReport','body','options','raw','info','CreateVoiceDialReport','UpdateVoiceDialReport','update','attributes','lodash','util','moment','../../mysqldb','rpc','../../config/environment','client','request'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xbaaf,0x1cc));var _0xfbaa=function(_0x13269,_0x258e86){_0x13269=_0x13269-0x0;var _0x2145ca=_0xbaaf[_0x13269];return _0x2145ca;};'use strict';var _=require(_0xfbaa('0x0'));var util=require(_0xfbaa('0x1'));var moment=require(_0xfbaa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbaa('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfbaa('0x4'));var config=require(_0xfbaa('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xfbaa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e3187,_0x30e425,_0x2a7154){return new BPromise(function(_0x9184ea,_0x45512b){return client[_0xfbaa('0x7')](_0x4e3187,_0x2a7154)[_0xfbaa('0x8')](function(_0x493303){logger['info'](_0xfbaa('0x9'),_0x30e425,'request\x20sent');logger[_0xfbaa('0xa')](_0xfbaa('0xb'),_0x30e425,'request\x20sent',JSON[_0xfbaa('0xc')](_0x493303));if(_0x493303[_0xfbaa('0xd')]){if(_0x493303[_0xfbaa('0xd')]['code']===0x1f4){logger[_0xfbaa('0xd')](_0xfbaa('0x9'),_0x30e425,_0x493303[_0xfbaa('0xd')][_0xfbaa('0xe')]);return _0x45512b(_0x493303['error'][_0xfbaa('0xe')]);}logger[_0xfbaa('0xd')](_0xfbaa('0x9'),_0x30e425,_0x493303[_0xfbaa('0xd')][_0xfbaa('0xe')]);return _0x9184ea(_0x493303[_0xfbaa('0xd')][_0xfbaa('0xe')]);}else{logger['info'](_0xfbaa('0x9'),_0x30e425,_0xfbaa('0xf'));_0x9184ea(_0x493303['result']['message']);}})[_0xfbaa('0x10')](function(_0x44e9f1){logger[_0xfbaa('0xd')](_0xfbaa('0x9'),_0x30e425,_0x44e9f1);_0x45512b(_0x44e9f1);});});}exports['CreateVoiceDialReport']=function(_0x2606aa){var _0x5b9452=this;return new Promise(function(_0x40bb61,_0x4a1cc3){return db[_0xfbaa('0x11')]['create'](_0x2606aa[_0xfbaa('0x12')],{'raw':_0x2606aa[_0xfbaa('0x13')]?_0x2606aa[_0xfbaa('0x13')][_0xfbaa('0x14')]===undefined?!![]:![]:!![]})[_0xfbaa('0x8')](function(_0x15479f){logger[_0xfbaa('0x15')](_0xfbaa('0x16'),_0x2606aa);logger[_0xfbaa('0xa')](_0xfbaa('0x16'),_0x2606aa,JSON[_0xfbaa('0xc')](_0x15479f));_0x40bb61(_0x15479f);})['catch'](function(_0x2d60b2){logger[_0xfbaa('0xd')](_0xfbaa('0x16'),_0x2d60b2['message'],_0x2606aa);_0x4a1cc3(_0x5b9452[_0xfbaa('0xd')](0x1f4,_0x2d60b2[_0xfbaa('0xe')]));});});};exports[_0xfbaa('0x17')]=function(_0x1038c8){var _0x46d6d7=this;return new Promise(function(_0xb00db2,_0x43b2e9){return db[_0xfbaa('0x11')][_0xfbaa('0x18')](_0x1038c8[_0xfbaa('0x12')],{'raw':_0x1038c8[_0xfbaa('0x13')]?_0x1038c8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1038c8[_0xfbaa('0x13')]?_0x1038c8['options']['where']||null:null,'attributes':_0x1038c8[_0xfbaa('0x13')]?_0x1038c8[_0xfbaa('0x13')][_0xfbaa('0x19')]||null:null,'limit':_0x1038c8[_0xfbaa('0x13')]?_0x1038c8['options']['limit']||null:null})['then'](function(_0x1137f7){logger[_0xfbaa('0x15')](_0xfbaa('0x17'),_0x1038c8);logger['debug'](_0xfbaa('0x17'),_0x1038c8,JSON['stringify'](_0x1137f7));_0xb00db2(_0x1137f7);})['catch'](function(_0x425069){logger['error'](_0xfbaa('0x17'),_0x425069['message'],_0x1038c8);_0x43b2e9(_0x46d6d7[_0xfbaa('0xd')](0x1f4,_0x425069['message']));});});}; \ No newline at end of file +var _0xdb9e=['UpdateVoiceDialReport','where','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport'];(function(_0x4cd696,_0x74c45f){var _0x4c7dec=function(_0x374a73){while(--_0x374a73){_0x4cd696['push'](_0x4cd696['shift']());}};_0x4c7dec(++_0x74c45f);}(_0xdb9e,0x197));var _0xedb9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdb9e[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xedb9('0x0'));var BPromise=require(_0xedb9('0x1'));var rs=require(_0xedb9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedb9('0x3'))['db'];var utils=require(_0xedb9('0x4'));var logger=require('../../config/logger')(_0xedb9('0x5'));var config=require(_0xedb9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xedb9('0x7')][_0xedb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4de0b9,_0x2e3284,_0x4d6779){return new BPromise(function(_0xdc8dd0,_0x4d1ed1){return client[_0xedb9('0x9')](_0x4de0b9,_0x4d6779)[_0xedb9('0xa')](function(_0x3f2360){logger[_0xedb9('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x2e3284,_0xedb9('0xc'));logger[_0xedb9('0xd')](_0xedb9('0xe'),_0x2e3284,'request\x20sent',JSON[_0xedb9('0xf')](_0x3f2360));if(_0x3f2360[_0xedb9('0x10')]){if(_0x3f2360['error'][_0xedb9('0x11')]===0x1f4){logger[_0xedb9('0x10')](_0xedb9('0x12'),_0x2e3284,_0x3f2360[_0xedb9('0x10')][_0xedb9('0x13')]);return _0x4d1ed1(_0x3f2360[_0xedb9('0x10')][_0xedb9('0x13')]);}logger[_0xedb9('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x2e3284,_0x3f2360[_0xedb9('0x10')][_0xedb9('0x13')]);return _0xdc8dd0(_0x3f2360[_0xedb9('0x10')][_0xedb9('0x13')]);}else{logger[_0xedb9('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x2e3284,_0xedb9('0xc'));_0xdc8dd0(_0x3f2360['result'][_0xedb9('0x13')]);}})[_0xedb9('0x14')](function(_0x2f3fa5){logger[_0xedb9('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x2e3284,_0x2f3fa5);_0x4d1ed1(_0x2f3fa5);});});}exports['CreateVoiceDialReport']=function(_0x557cfe){var _0x43d88c=this;return new Promise(function(_0x3f8e9b,_0x190de7){return db[_0xedb9('0x15')][_0xedb9('0x16')](_0x557cfe[_0xedb9('0x17')],{'raw':_0x557cfe[_0xedb9('0x18')]?_0x557cfe[_0xedb9('0x18')][_0xedb9('0x19')]===undefined?!![]:![]:!![]})[_0xedb9('0xa')](function(_0x3503a3){logger['info'](_0xedb9('0x1a'),_0x557cfe);logger[_0xedb9('0xd')](_0xedb9('0x1a'),_0x557cfe,JSON[_0xedb9('0xf')](_0x3503a3));_0x3f8e9b(_0x3503a3);})['catch'](function(_0x2798d8){logger[_0xedb9('0x10')](_0xedb9('0x1a'),_0x2798d8['message'],_0x557cfe);_0x190de7(_0x43d88c[_0xedb9('0x10')](0x1f4,_0x2798d8[_0xedb9('0x13')]));});});};exports[_0xedb9('0x1b')]=function(_0x42dbd5){var _0x136214=this;return new Promise(function(_0x318473,_0x23472e){return db[_0xedb9('0x15')]['update'](_0x42dbd5[_0xedb9('0x17')],{'raw':_0x42dbd5[_0xedb9('0x18')]?_0x42dbd5[_0xedb9('0x18')][_0xedb9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42dbd5['options']?_0x42dbd5[_0xedb9('0x18')][_0xedb9('0x1c')]||null:null,'attributes':_0x42dbd5[_0xedb9('0x18')]?_0x42dbd5[_0xedb9('0x18')][_0xedb9('0x1d')]||null:null,'limit':_0x42dbd5[_0xedb9('0x18')]?_0x42dbd5[_0xedb9('0x18')][_0xedb9('0x1e')]||null:null})['then'](function(_0x14a54b){logger[_0xedb9('0xb')](_0xedb9('0x1b'),_0x42dbd5);logger[_0xedb9('0xd')](_0xedb9('0x1b'),_0x42dbd5,JSON[_0xedb9('0xf')](_0x14a54b));_0x318473(_0x14a54b);})['catch'](function(_0x3b776e){logger[_0xedb9('0x10')](_0xedb9('0x1b'),_0x3b776e[_0xedb9('0x13')],_0x42dbd5);_0x23472e(_0x136214[_0xedb9('0x10')](0x1f4,_0x3b776e[_0xedb9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f4f16f6..bbac64c 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 _0x4f9f=['create','post','/:id/applications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x4f9f,0xb0));var _0xf4f9=function(_0x958e79,_0x2f3ffa){_0x958e79=_0x958e79-0x0;var _0x3ae692=_0x4f9f[_0x958e79];return _0x3ae692;};'use strict';var multer=require(_0xf4f9('0x0'));var util=require(_0xf4f9('0x1'));var path=require(_0xf4f9('0x2'));var timeout=require(_0xf4f9('0x3'));var express=require(_0xf4f9('0x4'));var router=express[_0xf4f9('0x5')]();var fs_extra=require(_0xf4f9('0x6'));var auth=require(_0xf4f9('0x7'));var interaction=require(_0xf4f9('0x8'));var config=require(_0xf4f9('0x9'));var controller=require('./voiceExtension.controller');router[_0xf4f9('0xa')]('/',auth[_0xf4f9('0xb')](),controller['index']);router['get'](_0xf4f9('0xc'),auth[_0xf4f9('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf4f9('0xd')]);router[_0xf4f9('0xe')](_0xf4f9('0xf'),auth[_0xf4f9('0xb')](),controller['addApplications']);router[_0xf4f9('0x10')]('/:id',auth[_0xf4f9('0xb')](),controller[_0xf4f9('0x11')]);router[_0xf4f9('0x12')](_0xf4f9('0xc'),auth['isAuthenticated'](),controller[_0xf4f9('0x13')]);module[_0xf4f9('0x14')]=router; \ No newline at end of file +var _0xa2f5=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4725d6,_0x3506b9){var _0x4c7391=function(_0x5bdebe){while(--_0x5bdebe){_0x4725d6['push'](_0x4725d6['shift']());}};_0x4c7391(++_0x3506b9);}(_0xa2f5,0x188));var _0x5a2f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xa2f5[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x5a2f('0x0'));var util=require(_0x5a2f('0x1'));var path=require(_0x5a2f('0x2'));var timeout=require(_0x5a2f('0x3'));var express=require(_0x5a2f('0x4'));var router=express[_0x5a2f('0x5')]();var fs_extra=require(_0x5a2f('0x6'));var auth=require(_0x5a2f('0x7'));var interaction=require(_0x5a2f('0x8'));var config=require(_0x5a2f('0x9'));var controller=require('./voiceExtension.controller');router[_0x5a2f('0xa')]('/',auth['isAuthenticated'](),controller[_0x5a2f('0xb')]);router['get'](_0x5a2f('0xc'),auth[_0x5a2f('0xd')](),controller['show']);router[_0x5a2f('0xe')]('/',auth['isAuthenticated'](),controller[_0x5a2f('0xf')]);router['post']('/:id/applications',auth[_0x5a2f('0xd')](),controller[_0x5a2f('0x10')]);router[_0x5a2f('0x11')]('/:id',auth[_0x5a2f('0xd')](),controller[_0x5a2f('0x12')]);router[_0x5a2f('0x13')](_0x5a2f('0xc'),auth['isAuthenticated'](),controller[_0x5a2f('0x14')]);module[_0x5a2f('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index ee158be..8400cf5 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 _0xea13=['internal','system','INTEGER','BOOLEAN','getDataValue','STRING','ENUM','inbound','outbound'];(function(_0x286262,_0x4dbe62){var _0x133aa3=function(_0x3f91e3){while(--_0x3f91e3){_0x286262['push'](_0x286262['shift']());}};_0x133aa3(++_0x4dbe62);}(_0xea13,0x1f4));var _0x3ea1=function(_0x1a8e49,_0x5d0657){_0x1a8e49=_0x1a8e49-0x0;var _0x4b72e9=_0xea13[_0x1a8e49];return _0x4b72e9;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3ea1('0x0')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3ea1('0x0')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x3ea1('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3ea1('0x0')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x3ea1('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3ea1('0x1')](_0x3ea1('0x2'),_0x3ea1('0x3'),_0x3ea1('0x4'),'inbound-fax','outbound-fax',_0x3ea1('0x5'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x3ea1('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x3ea1('0x6')]},'isApp':{'type':Sequelize[_0x3ea1('0x7')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3ea1('0x6')]},'recordingFormat':{'type':Sequelize[_0x3ea1('0x0')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x3ea1('0x7')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x27d698){return this[_0x3ea1('0x8')]('exten');}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x6084=['exten','STRING','compositeIndex','NoOp','ENUM','inbound','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x6084,0xfd));var _0x4608=function(_0x16a857,_0x1ba2d5){_0x16a857=_0x16a857-0x0;var _0x375377=_0x6084[_0x16a857];return _0x375377;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x4608('0x0')],'allowNull':![],'unique':_0x4608('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4608('0x0')],'allowNull':![],'unique':_0x4608('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x4608('0x1')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4608('0x2')},'appdata':{'type':Sequelize[_0x4608('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4608('0x3')](_0x4608('0x4'),'outbound','internal',_0x4608('0x5'),'outbound-fax',_0x4608('0x6'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x4608('0x0')]},'interval':{'type':Sequelize[_0x4608('0x0')],'allowNull':![],'defaultValue':_0x4608('0x7')},'IntervalId':{'type':Sequelize[_0x4608('0x8')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4608('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4608('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0x4608('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x4608('0x0')],'defaultValue':_0x4608('0xa')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3cf309){return this['getDataValue'](_0x4608('0xb'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index c1dc16d..d2dedae 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 _0x6040=['stack','finally','ioredis','api','../../config/environment','../../mysqldb','redis','register','sendStatus','status','json','offset','limit','undefined','set','destroy','then','get','InboundRoutes','OutboundRoutes','internal','filter','map','value','type','find','UserProfileResource','end','name','send','index','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','options','count','includeAll','include','rows','catch','show','params','VoiceExtension','create','body','outbound','startsWith','exten','role','inbound','InternalRoutes','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','bulkCreate','cast(priority\x20as\x20unsigned)'];(function(_0x14e3d1,_0x5e37a5){var _0x5baa3b=function(_0x161ae6){while(--_0x161ae6){_0x14e3d1['push'](_0x14e3d1['shift']());}};_0x5baa3b(++_0x5e37a5);}(_0x6040,0x1f4));var _0x0604=function(_0x1e1965,_0x55785c){_0x1e1965=_0x1e1965-0x0;var _0x1a2e96=_0x6040[_0x1e1965];return _0x1a2e96;};'use strict';var _=require('lodash');var Redis=require(_0x0604('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x0604('0x1'));var config=require(_0x0604('0x2'));var db=require(_0x0604('0x3'))['db'];config[_0x0604('0x4')]=_['defaults'](config[_0x0604('0x4')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0604('0x4')]));require('./voiceExtension.socket')[_0x0604('0x5')](socket);function respondWithStatusCode(_0x5d7b3a,_0x1d15b9){_0x1d15b9=_0x1d15b9||0xcc;return function(_0x16f18e){if(_0x16f18e){return _0x5d7b3a[_0x0604('0x6')](_0x1d15b9);}return _0x5d7b3a[_0x0604('0x7')](_0x1d15b9)['end']();};}function respondWithResult(_0x116e20,_0x5b9ec9){_0x5b9ec9=_0x5b9ec9||0xc8;return function(_0xa4a336){if(_0xa4a336){return _0x116e20['status'](_0x5b9ec9)[_0x0604('0x8')](_0xa4a336);}};}function respondWithFilteredResult(_0x150123,_0x1d1d30){return function(_0x1ea448){if(_0x1ea448){var _0x10e196=typeof _0x1d1d30[_0x0604('0x9')]==='undefined'&&typeof _0x1d1d30[_0x0604('0xa')]===_0x0604('0xb');var _0x18c29b=_0x1ea448['count'];var _0xd71b93=_0x10e196?0x0:_0x1d1d30['offset'];var _0x5b0b5e=_0x10e196?_0x1ea448['count']:_0x1d1d30[_0x0604('0x9')]+_0x1d1d30['limit'];var _0x15649d;if(_0x5b0b5e>=_0x18c29b){_0x5b0b5e=_0x18c29b;_0x15649d=0xc8;}else{_0x15649d=0xce;}_0x150123[_0x0604('0x7')](_0x15649d);return _0x150123[_0x0604('0xc')]('Content-Range',_0xd71b93+'-'+_0x5b0b5e+'/'+_0x18c29b)[_0x0604('0x8')](_0x1ea448);}return null;};}function removeEntity(_0x171ae9){return function(_0x410ed9){if(_0x410ed9){return _0x410ed9[_0x0604('0xd')]()[_0x0604('0xe')](function(){var _0x1cea67=_0x410ed9[_0x0604('0xf')]({'plain':!![]});var _0x53a8e=[{'name':_0x0604('0x10'),'value':'inbound','ignore':![]},{'name':_0x0604('0x11'),'value':'outbound','ignore':![]},{'name':'InternalRoutes','value':_0x0604('0x12'),'ignore':![]}];var _0x48d211=_(_0x53a8e)[_0x0604('0x13')]('ignore')[_0x0604('0x14')]('value')[_0x0604('0x15')]();if(_['includes'](_0x48d211,_0x1cea67[_0x0604('0x16')])){return;}var _0x545e90=_[_0x0604('0x17')](_0x53a8e,[_0x0604('0x15'),_0x1cea67[_0x0604('0x16')]])['name'];return db[_0x0604('0x18')]['destroy']({'where':{'type':_0x545e90,'resourceId':_0x1cea67['id']}})[_0x0604('0xe')](function(){return _0x410ed9;});})[_0x0604('0xe')](function(){_0x171ae9[_0x0604('0x7')](0xcc)[_0x0604('0x19')]();});}};}function handleEntityNotFound(_0x412f9d){return function(_0x1f50ff){if(!_0x1f50ff){_0x412f9d[_0x0604('0x6')](0x194);}return _0x1f50ff;};}function handleError(_0x48acec,_0x34e450){_0x34e450=_0x34e450||0x1f4;return function(_0x3adec6){logger['error'](_0x3adec6['stack']);if(_0x3adec6['name']){delete _0x3adec6[_0x0604('0x1a')];}_0x48acec[_0x0604('0x7')](_0x34e450)[_0x0604('0x1b')](_0x3adec6);};}exports[_0x0604('0x1c')]=function(_0x3f018d,_0x25828a){var _0x5d3651={},_0x3dc8e3={},_0x1de09e={'count':0x0,'rows':[]};var _0x350d09=_['map'](db['VoiceExtension']['rawAttributes'],function(_0x1a93bb){return{'name':_0x1a93bb[_0x0604('0x1d')],'type':_0x1a93bb['type'][_0x0604('0x1e')]};});_0x3dc8e3[_0x0604('0x1f')]=_[_0x0604('0x14')](_0x350d09,_0x0604('0x1a'));_0x3dc8e3[_0x0604('0x20')]=_[_0x0604('0x21')](_0x3f018d['query']);_0x3dc8e3[_0x0604('0x22')]=_[_0x0604('0x23')](_0x3dc8e3['model'],_0x3dc8e3[_0x0604('0x20')]);_0x5d3651[_0x0604('0x24')]=_[_0x0604('0x23')](_0x3dc8e3[_0x0604('0x1f')],qs[_0x0604('0x25')](_0x3f018d[_0x0604('0x20')][_0x0604('0x25')]));_0x5d3651['attributes']=_0x5d3651[_0x0604('0x24')][_0x0604('0x26')]?_0x5d3651[_0x0604('0x24')]:_0x3dc8e3[_0x0604('0x1f')];if(!_0x3f018d[_0x0604('0x20')][_0x0604('0x27')](_0x0604('0x28'))){_0x5d3651['limit']=qs[_0x0604('0xa')](_0x3f018d[_0x0604('0x20')]['limit']);_0x5d3651[_0x0604('0x9')]=qs[_0x0604('0x9')](_0x3f018d[_0x0604('0x20')][_0x0604('0x9')]);}_0x5d3651['order']=qs['sort'](_0x3f018d[_0x0604('0x20')][_0x0604('0x29')]);_0x5d3651['where']=qs[_0x0604('0x22')](_[_0x0604('0x2a')](_0x3f018d[_0x0604('0x20')],_0x3dc8e3['filters']),_0x350d09);if(_0x3f018d[_0x0604('0x20')][_0x0604('0x13')]){_0x5d3651[_0x0604('0x2b')]=_[_0x0604('0x2c')](_0x5d3651[_0x0604('0x2b')],{'$or':_[_0x0604('0x14')](_0x350d09,function(_0x42053f){if(_0x42053f[_0x0604('0x16')]!=='VIRTUAL'){var _0x551260={};_0x551260[_0x42053f[_0x0604('0x1a')]]={'$like':'%'+_0x3f018d[_0x0604('0x20')]['filter']+'%'};return _0x551260;}})});}_0x5d3651=_[_0x0604('0x2c')]({},_0x5d3651,_0x3f018d[_0x0604('0x2d')]);var _0x5aecb4={'where':_0x5d3651[_0x0604('0x2b')]};return db['VoiceExtension'][_0x0604('0x2e')](_0x5aecb4)[_0x0604('0xe')](function(_0x184db9){_0x1de09e[_0x0604('0x2e')]=_0x184db9;if(_0x3f018d[_0x0604('0x20')][_0x0604('0x2f')]){_0x5d3651[_0x0604('0x30')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x5d3651);})[_0x0604('0xe')](function(_0x3137be){_0x1de09e[_0x0604('0x31')]=_0x3137be;return _0x1de09e;})[_0x0604('0xe')](respondWithFilteredResult(_0x25828a,_0x5d3651))[_0x0604('0x32')](handleError(_0x25828a,null));};exports[_0x0604('0x33')]=function(_0x22d24c,_0xc88b32){var _0x23eef4={'raw':![],'where':{'id':_0x22d24c[_0x0604('0x34')]['id']}},_0x2b9788={};_0x2b9788[_0x0604('0x1f')]=_[_0x0604('0x21')](db[_0x0604('0x35')]['rawAttributes']);_0x2b9788['query']=_[_0x0604('0x21')](_0x22d24c['query']);_0x2b9788['filters']=_['intersection'](_0x2b9788[_0x0604('0x1f')],_0x2b9788[_0x0604('0x20')]);_0x23eef4['attributes']=_['intersection'](_0x2b9788[_0x0604('0x1f')],qs[_0x0604('0x25')](_0x22d24c['query'][_0x0604('0x25')]));_0x23eef4[_0x0604('0x24')]=_0x23eef4[_0x0604('0x24')][_0x0604('0x26')]?_0x23eef4[_0x0604('0x24')]:_0x2b9788[_0x0604('0x1f')];if(_0x22d24c[_0x0604('0x20')]['includeAll']){_0x23eef4[_0x0604('0x30')]=[{'all':!![]}];}_0x23eef4=_[_0x0604('0x2c')]({},_0x23eef4,_0x22d24c['options']);return db[_0x0604('0x35')]['find'](_0x23eef4)[_0x0604('0xe')](handleEntityNotFound(_0xc88b32,null))[_0x0604('0xe')](respondWithResult(_0xc88b32,null))[_0x0604('0x32')](handleError(_0xc88b32,null));};exports[_0x0604('0xd')]=function(_0x54f183,_0x119c45){return db[_0x0604('0x35')][_0x0604('0x17')]({'where':{'id':_0x54f183[_0x0604('0x34')]['id']}})[_0x0604('0xe')](handleEntityNotFound(_0x119c45,null))[_0x0604('0xe')](removeEntity(_0x119c45,null))[_0x0604('0x32')](handleError(_0x119c45,null));};exports[_0x0604('0x36')]=function(_0x5c5339,_0x100408){if(_0x5c5339[_0x0604('0x37')]['type']===_0x0604('0x38')&&!_[_0x0604('0x39')](_0x5c5339[_0x0604('0x37')][_0x0604('0x3a')],'_')){_0x5c5339['body'][_0x0604('0x3a')]='_'['concat'](_0x5c5339[_0x0604('0x37')][_0x0604('0x3a')]);}return db[_0x0604('0x35')][_0x0604('0x36')](_0x5c5339[_0x0604('0x37')],{'raw':![]})[_0x0604('0xe')](function(_0x554635){var _0x10a0e7=_0x5c5339['user'][_0x0604('0xf')]({'plain':!![]});if(!_0x10a0e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10a0e7[_0x0604('0x3b')]==='user'){var _0x904ce5=_0x554635[_0x0604('0xf')]({'plain':!![]});var _0x567bad=[{'name':_0x0604('0x10'),'value':_0x0604('0x3c')},{'name':_0x0604('0x11'),'value':_0x0604('0x38')},{'name':_0x0604('0x3d'),'value':_0x0604('0x12')}];var _0xb48bf5=_[_0x0604('0x17')](_0x567bad,['value',_0x904ce5['type']])['name'];return db['UserProfileSection']['find']({'where':{'name':_0xb48bf5,'userProfileId':_0x10a0e7[_0x0604('0x3e')]},'raw':!![]})[_0x0604('0xe')](function(_0x551d0f){if(_0x551d0f&&_0x551d0f[_0x0604('0x3f')]===0x0){return db[_0x0604('0x18')]['create']({'name':_0x904ce5['name'],'resourceId':_0x904ce5['id'],'type':_0x551d0f[_0x0604('0x1a')],'sectionId':_0x551d0f['id']},{})[_0x0604('0xe')](function(){return _0x554635;});}else{return _0x554635;}})[_0x0604('0x32')](function(_0x1ba3d1){logger[_0x0604('0x40')](_0x0604('0x41'),_0x1ba3d1);throw _0x1ba3d1;});}return _0x554635;})[_0x0604('0xe')](respondWithResult(_0x100408,0xc9))['catch'](handleError(_0x100408,null));};exports[_0x0604('0x42')]=function(_0x40d83a,_0x1b04de){if(_0x40d83a[_0x0604('0x37')]['id']){delete _0x40d83a[_0x0604('0x37')]['id'];}return db['VoiceExtension'][_0x0604('0x17')]({'where':{'id':_0x40d83a[_0x0604('0x34')]['id']}})[_0x0604('0xe')](handleEntityNotFound(_0x1b04de,null))[_0x0604('0xe')](function(_0x404e7c){if(_0x404e7c){return db[_0x0604('0x35')][_0x0604('0x42')](_[_0x0604('0x2a')](_0x40d83a[_0x0604('0x37')],[_0x0604('0x3a'),'context',_0x0604('0x43'),_0x0604('0x44'),_0x0604('0x45'),_0x0604('0x46'),_0x0604('0x47')]),{'where':{'context':_0x404e7c[_0x0604('0x48')],'exten':_0x404e7c['exten']},'individualHooks':!![]})[_0x0604('0xe')](function(_0x2b1f84){return _0x2b1f84;});}return null;})[_0x0604('0xe')](respondWithStatusCode(_0x1b04de,null))[_0x0604('0x32')](handleError(_0x1b04de,null));};exports['addApplications']=function(_0x39e634,_0x348323){var _0x227754=_0x39e634[_0x0604('0x34')]['id'];var _0x325802=_0x39e634['body'];var _0x40e669=0xc8;var _0x498040=null;return db[_0x0604('0x49')][_0x0604('0x4a')]({'isolationLevel':db[_0x0604('0x49')]['Transaction'][_0x0604('0x4b')][_0x0604('0x4c')]},function(_0x1fd31f){return db[_0x0604('0x35')]['findOne']({'where':{'id':_0x227754},'transaction':_0x1fd31f})['then'](function(_0x276246){if(_0x276246){return db[_0x0604('0x35')][_0x0604('0xd')]({'where':{'VoiceExtensionId':_0x227754},'transaction':_0x1fd31f})[_0x0604('0xe')](function(){var _0x3e7192=_[_0x0604('0x14')](_0x325802,function(_0x1b607c){_0x1b607c[_0x0604('0x4d')]=_0x227754;_0x1b607c[_0x0604('0x4e')]=!![];return _0x1b607c;});return _0x276246['createRouting'](_0x3e7192);})[_0x0604('0xe')](function(_0x41e021){return db[_0x0604('0x35')][_0x0604('0x4f')](_0x41e021,{'transaction':_0x1fd31f});});}else{_0x40e669=0x194;_0x498040=[];}});})[_0x0604('0xe')](function(){if(_0x40e669!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x227754},'order':_0x0604('0x50')})[_0x0604('0xe')](function(_0x1cdbb7){_0x498040=_0x1cdbb7;});}})[_0x0604('0x32')](function(_0x36024e){_0x40e669=0x1f4;logger[_0x0604('0x40')](_0x36024e[_0x0604('0x51')]);if(_0x36024e['name']){delete _0x36024e[_0x0604('0x1a')];}_0x498040=_0x36024e;})[_0x0604('0x52')](function(){if(_0x498040===null){_0x348323['sendStatus'](_0x40e669);}else{if(_0x40e669===0x1f4){_0x348323['status'](_0x40e669)[_0x0604('0x1b')](_0x498040);}else{_0x348323[_0x0604('0x7')](_0x40e669)[_0x0604('0x8')](_0x498040);}}});}; \ No newline at end of file +var _0xd171=['socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','destroy','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','UserProfileResource','then','error','stack','send','index','VoiceExtension','rawAttributes','key','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','body','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','context','description','recordingFormat','cutdigits','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults'];(function(_0xe68e5b,_0x399915){var _0x155d7a=function(_0x3ef1d3){while(--_0x3ef1d3){_0xe68e5b['push'](_0xe68e5b['shift']());}};_0x155d7a(++_0x399915);}(_0xd171,0xfc));var _0x1d17=function(_0xabbfc7,_0x33d449){_0xabbfc7=_0xabbfc7-0x0;var _0x2a2a62=_0xd171[_0xabbfc7];return _0x2a2a62;};'use strict';var _=require(_0x1d17('0x0'));var Redis=require(_0x1d17('0x1'));var qs=require(_0x1d17('0x2'));var logger=require(_0x1d17('0x3'))(_0x1d17('0x4'));var config=require(_0x1d17('0x5'));var db=require(_0x1d17('0x6'))['db'];config[_0x1d17('0x7')]=_[_0x1d17('0x8')](config[_0x1d17('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x1d17('0x9'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x1d17('0xa')](socket);function respondWithStatusCode(_0x2456d4,_0x583a97){_0x583a97=_0x583a97||0xcc;return function(_0x46e777){if(_0x46e777){return _0x2456d4[_0x1d17('0xb')](_0x583a97);}return _0x2456d4['status'](_0x583a97)['end']();};}function respondWithResult(_0xa35312,_0x3d5cc7){_0x3d5cc7=_0x3d5cc7||0xc8;return function(_0x461aac){if(_0x461aac){return _0xa35312[_0x1d17('0xc')](_0x3d5cc7)[_0x1d17('0xd')](_0x461aac);}};}function respondWithFilteredResult(_0x349d09,_0x131857){return function(_0x67e6b4){if(_0x67e6b4){var _0xd1789d=typeof _0x131857[_0x1d17('0xe')]===_0x1d17('0xf')&&typeof _0x131857['limit']==='undefined';var _0x2f7280=_0x67e6b4[_0x1d17('0x10')];var _0x2f3822=_0xd1789d?0x0:_0x131857[_0x1d17('0xe')];var _0x57e49d=_0xd1789d?_0x67e6b4[_0x1d17('0x10')]:_0x131857[_0x1d17('0xe')]+_0x131857[_0x1d17('0x11')];var _0x13548a;if(_0x57e49d>=_0x2f7280){_0x57e49d=_0x2f7280;_0x13548a=0xc8;}else{_0x13548a=0xce;}_0x349d09[_0x1d17('0xc')](_0x13548a);return _0x349d09[_0x1d17('0x12')](_0x1d17('0x13'),_0x2f3822+'-'+_0x57e49d+'/'+_0x2f7280)[_0x1d17('0xd')](_0x67e6b4);}return null;};}function removeEntity(_0x2ebe53){return function(_0x113f81){if(_0x113f81){return _0x113f81[_0x1d17('0x14')]()['then'](function(){var _0x490c0e=_0x113f81['get']({'plain':!![]});var _0x414dfc=[{'name':_0x1d17('0x15'),'value':_0x1d17('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':_0x1d17('0x17'),'ignore':![]},{'name':_0x1d17('0x18'),'value':_0x1d17('0x19'),'ignore':![]}];var _0x4f4a52=_(_0x414dfc)[_0x1d17('0x1a')]('ignore')[_0x1d17('0x1b')]('value')[_0x1d17('0x1c')]();if(_[_0x1d17('0x1d')](_0x4f4a52,_0x490c0e[_0x1d17('0x1e')])){return;}var _0x488c6d=_[_0x1d17('0x1f')](_0x414dfc,['value',_0x490c0e[_0x1d17('0x1e')]])[_0x1d17('0x20')];return db[_0x1d17('0x21')][_0x1d17('0x14')]({'where':{'type':_0x488c6d,'resourceId':_0x490c0e['id']}})[_0x1d17('0x22')](function(){return _0x113f81;});})['then'](function(){_0x2ebe53[_0x1d17('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ff1f3){return function(_0x37230d){if(!_0x37230d){_0x2ff1f3[_0x1d17('0xb')](0x194);}return _0x37230d;};}function handleError(_0x709d0a,_0x21d3e0){_0x21d3e0=_0x21d3e0||0x1f4;return function(_0x49c9ae){logger[_0x1d17('0x23')](_0x49c9ae[_0x1d17('0x24')]);if(_0x49c9ae[_0x1d17('0x20')]){delete _0x49c9ae[_0x1d17('0x20')];}_0x709d0a[_0x1d17('0xc')](_0x21d3e0)[_0x1d17('0x25')](_0x49c9ae);};}exports[_0x1d17('0x26')]=function(_0xec81ef,_0x1a9cdc){var _0x4aa6c8={},_0x43dd96={},_0x2ad8fa={'count':0x0,'rows':[]};var _0x218e27=_[_0x1d17('0x1b')](db[_0x1d17('0x27')][_0x1d17('0x28')],function(_0x3e4dbe){return{'name':_0x3e4dbe['fieldName'],'type':_0x3e4dbe['type'][_0x1d17('0x29')]};});_0x43dd96['model']=_[_0x1d17('0x1b')](_0x218e27,_0x1d17('0x20'));_0x43dd96['query']=_[_0x1d17('0x2a')](_0xec81ef[_0x1d17('0x2b')]);_0x43dd96['filters']=_[_0x1d17('0x2c')](_0x43dd96[_0x1d17('0x2d')],_0x43dd96[_0x1d17('0x2b')]);_0x4aa6c8['attributes']=_[_0x1d17('0x2c')](_0x43dd96[_0x1d17('0x2d')],qs[_0x1d17('0x2e')](_0xec81ef[_0x1d17('0x2b')][_0x1d17('0x2e')]));_0x4aa6c8[_0x1d17('0x2f')]=_0x4aa6c8[_0x1d17('0x2f')][_0x1d17('0x30')]?_0x4aa6c8[_0x1d17('0x2f')]:_0x43dd96['model'];if(!_0xec81ef[_0x1d17('0x2b')]['hasOwnProperty'](_0x1d17('0x31'))){_0x4aa6c8[_0x1d17('0x11')]=qs[_0x1d17('0x11')](_0xec81ef['query'][_0x1d17('0x11')]);_0x4aa6c8['offset']=qs['offset'](_0xec81ef[_0x1d17('0x2b')][_0x1d17('0xe')]);}_0x4aa6c8[_0x1d17('0x32')]=qs['sort'](_0xec81ef[_0x1d17('0x2b')][_0x1d17('0x33')]);_0x4aa6c8[_0x1d17('0x34')]=qs['filters'](_[_0x1d17('0x35')](_0xec81ef[_0x1d17('0x2b')],_0x43dd96['filters']),_0x218e27);if(_0xec81ef[_0x1d17('0x2b')][_0x1d17('0x1a')]){_0x4aa6c8[_0x1d17('0x34')]=_[_0x1d17('0x36')](_0x4aa6c8[_0x1d17('0x34')],{'$or':_[_0x1d17('0x1b')](_0x218e27,function(_0x1898bb){if(_0x1898bb[_0x1d17('0x1e')]!==_0x1d17('0x37')){var _0x302a91={};_0x302a91[_0x1898bb[_0x1d17('0x20')]]={'$like':'%'+_0xec81ef['query'][_0x1d17('0x1a')]+'%'};return _0x302a91;}})});}_0x4aa6c8=_[_0x1d17('0x36')]({},_0x4aa6c8,_0xec81ef[_0x1d17('0x38')]);var _0x12f499={'where':_0x4aa6c8['where']};return db['VoiceExtension'][_0x1d17('0x10')](_0x12f499)[_0x1d17('0x22')](function(_0x28251a){_0x2ad8fa[_0x1d17('0x10')]=_0x28251a;if(_0xec81ef['query'][_0x1d17('0x39')]){_0x4aa6c8[_0x1d17('0x3a')]=[{'all':!![]}];}return db[_0x1d17('0x27')][_0x1d17('0x3b')](_0x4aa6c8);})[_0x1d17('0x22')](function(_0x2fe0ab){_0x2ad8fa[_0x1d17('0x3c')]=_0x2fe0ab;return _0x2ad8fa;})[_0x1d17('0x22')](respondWithFilteredResult(_0x1a9cdc,_0x4aa6c8))[_0x1d17('0x3d')](handleError(_0x1a9cdc,null));};exports['show']=function(_0x2b6f7f,_0x422d5f){var _0x3951e4={'raw':![],'where':{'id':_0x2b6f7f['params']['id']}},_0x28a64b={};_0x28a64b[_0x1d17('0x2d')]=_[_0x1d17('0x2a')](db[_0x1d17('0x27')][_0x1d17('0x28')]);_0x28a64b['query']=_[_0x1d17('0x2a')](_0x2b6f7f['query']);_0x28a64b['filters']=_['intersection'](_0x28a64b[_0x1d17('0x2d')],_0x28a64b[_0x1d17('0x2b')]);_0x3951e4['attributes']=_['intersection'](_0x28a64b[_0x1d17('0x2d')],qs[_0x1d17('0x2e')](_0x2b6f7f[_0x1d17('0x2b')][_0x1d17('0x2e')]));_0x3951e4['attributes']=_0x3951e4[_0x1d17('0x2f')][_0x1d17('0x30')]?_0x3951e4['attributes']:_0x28a64b[_0x1d17('0x2d')];if(_0x2b6f7f[_0x1d17('0x2b')][_0x1d17('0x39')]){_0x3951e4[_0x1d17('0x3a')]=[{'all':!![]}];}_0x3951e4=_[_0x1d17('0x36')]({},_0x3951e4,_0x2b6f7f[_0x1d17('0x38')]);return db[_0x1d17('0x27')][_0x1d17('0x1f')](_0x3951e4)[_0x1d17('0x22')](handleEntityNotFound(_0x422d5f,null))[_0x1d17('0x22')](respondWithResult(_0x422d5f,null))[_0x1d17('0x3d')](handleError(_0x422d5f,null));};exports[_0x1d17('0x14')]=function(_0x358639,_0xfc6222){return db[_0x1d17('0x27')][_0x1d17('0x1f')]({'where':{'id':_0x358639[_0x1d17('0x3e')]['id']}})['then'](handleEntityNotFound(_0xfc6222,null))[_0x1d17('0x22')](removeEntity(_0xfc6222,null))['catch'](handleError(_0xfc6222,null));};exports['create']=function(_0x2c1a16,_0x423661){if(_0x2c1a16[_0x1d17('0x3f')][_0x1d17('0x1e')]==='outbound'&&!_['startsWith'](_0x2c1a16[_0x1d17('0x3f')][_0x1d17('0x40')],'_')){_0x2c1a16['body']['exten']='_'[_0x1d17('0x41')](_0x2c1a16['body']['exten']);}return db['VoiceExtension'][_0x1d17('0x42')](_0x2c1a16['body'],{'raw':![]})[_0x1d17('0x22')](function(_0x1c4f36){var _0x4e981c=_0x2c1a16[_0x1d17('0x43')][_0x1d17('0x44')]({'plain':!![]});if(!_0x4e981c)throw new Error(_0x1d17('0x45'));if(_0x4e981c[_0x1d17('0x46')]==='user'){var _0x864731=_0x1c4f36[_0x1d17('0x44')]({'plain':!![]});var _0x42d079=[{'name':_0x1d17('0x15'),'value':_0x1d17('0x16')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x1d17('0x18'),'value':_0x1d17('0x19')}];var _0xf04e94=_[_0x1d17('0x1f')](_0x42d079,[_0x1d17('0x1c'),_0x864731[_0x1d17('0x1e')]])['name'];return db['UserProfileSection'][_0x1d17('0x1f')]({'where':{'name':_0xf04e94,'userProfileId':_0x4e981c[_0x1d17('0x47')]},'raw':!![]})[_0x1d17('0x22')](function(_0x30117e){if(_0x30117e&&_0x30117e['autoAssociation']===0x0){return db[_0x1d17('0x21')][_0x1d17('0x42')]({'name':_0x864731[_0x1d17('0x20')],'resourceId':_0x864731['id'],'type':_0x30117e[_0x1d17('0x20')],'sectionId':_0x30117e['id']},{})[_0x1d17('0x22')](function(){return _0x1c4f36;});}else{return _0x1c4f36;}})[_0x1d17('0x3d')](function(_0x76423a){logger[_0x1d17('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x76423a);throw _0x76423a;});}return _0x1c4f36;})[_0x1d17('0x22')](respondWithResult(_0x423661,0xc9))[_0x1d17('0x3d')](handleError(_0x423661,null));};exports['update']=function(_0x5df21d,_0xb66cb7){if(_0x5df21d[_0x1d17('0x3f')]['id']){delete _0x5df21d[_0x1d17('0x3f')]['id'];}return db['VoiceExtension'][_0x1d17('0x1f')]({'where':{'id':_0x5df21d[_0x1d17('0x3e')]['id']}})[_0x1d17('0x22')](handleEntityNotFound(_0xb66cb7,null))[_0x1d17('0x22')](function(_0x5ef75e){if(_0x5ef75e){return db['VoiceExtension'][_0x1d17('0x48')](_[_0x1d17('0x35')](_0x5df21d[_0x1d17('0x3f')],[_0x1d17('0x40'),_0x1d17('0x49'),_0x1d17('0x4a'),_0x1d17('0x4b'),_0x1d17('0x4c'),'mandatoryDisposition','alias']),{'where':{'context':_0x5ef75e[_0x1d17('0x49')],'exten':_0x5ef75e[_0x1d17('0x40')]},'individualHooks':!![]})[_0x1d17('0x22')](function(_0x377dcb){return _0x377dcb;});}return null;})[_0x1d17('0x22')](respondWithStatusCode(_0xb66cb7,null))[_0x1d17('0x3d')](handleError(_0xb66cb7,null));};exports['addApplications']=function(_0x4ac2a2,_0x15f855){var _0x44c3c8=_0x4ac2a2[_0x1d17('0x3e')]['id'];var _0x8f455b=_0x4ac2a2[_0x1d17('0x3f')];var _0x558d54=0xc8;var _0x697104=null;return db[_0x1d17('0x4d')][_0x1d17('0x4e')]({'isolationLevel':db[_0x1d17('0x4d')]['Transaction'][_0x1d17('0x4f')][_0x1d17('0x50')]},function(_0x25e233){return db[_0x1d17('0x27')]['findOne']({'where':{'id':_0x44c3c8},'transaction':_0x25e233})[_0x1d17('0x22')](function(_0x3fa358){if(_0x3fa358){return db[_0x1d17('0x27')][_0x1d17('0x14')]({'where':{'VoiceExtensionId':_0x44c3c8},'transaction':_0x25e233})[_0x1d17('0x22')](function(){var _0x281c22=_[_0x1d17('0x1b')](_0x8f455b,function(_0x1628fe){_0x1628fe['VoiceExtensionId']=_0x44c3c8;_0x1628fe[_0x1d17('0x51')]=!![];return _0x1628fe;});return _0x3fa358[_0x1d17('0x52')](_0x281c22);})[_0x1d17('0x22')](function(_0xbbafa5){return db['VoiceExtension'][_0x1d17('0x53')](_0xbbafa5,{'transaction':_0x25e233});});}else{_0x558d54=0x194;_0x697104=[];}});})[_0x1d17('0x22')](function(){if(_0x558d54!==0x194){return db[_0x1d17('0x27')][_0x1d17('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x44c3c8},'order':_0x1d17('0x55')})[_0x1d17('0x22')](function(_0x5eaa40){_0x697104=_0x5eaa40;});}})['catch'](function(_0xc5169d){_0x558d54=0x1f4;logger[_0x1d17('0x23')](_0xc5169d['stack']);if(_0xc5169d['name']){delete _0xc5169d[_0x1d17('0x20')];}_0x697104=_0xc5169d;})[_0x1d17('0x56')](function(){if(_0x697104===null){_0x15f855[_0x1d17('0xb')](_0x558d54);}else{if(_0x558d54===0x1f4){_0x15f855['status'](_0x558d54)[_0x1d17('0x25')](_0x697104);}else{_0x15f855[_0x1d17('0xc')](_0x558d54)[_0x1d17('0xd')](_0x697104);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f817104..837d84b 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 _0x43ca=['events','../../mysqldb','VoiceExtension','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x43ca,0x195));var _0xa43c=function(_0x3f0f2e,_0xf2b92d){_0x3f0f2e=_0x3f0f2e-0x0;var _0x49fc6f=_0x43ca[_0x3f0f2e];return _0x49fc6f;};'use strict';var EventEmitter=require(_0xa43c('0x0'));var VoiceExtension=require(_0xa43c('0x1'))['db'][_0xa43c('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa43c('0x3'),'afterUpdate':_0xa43c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x37f01c){return function(_0x550d2b,_0x213e8e,_0x380459){VoiceExtensionEvents[_0xa43c('0x5')](_0x37f01c+':'+_0x550d2b['id'],_0x550d2b);VoiceExtensionEvents[_0xa43c('0x5')](_0x37f01c,_0x550d2b);_0x380459(null);};}for(var e in events){if(events[_0xa43c('0x6')](e)){var event=events[e];VoiceExtension[_0xa43c('0x7')](e,emitEvent(event));}}module[_0xa43c('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x370d=['events','../../mysqldb','VoiceExtension','update','remove','hasOwnProperty'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0x370d,0x144));var _0xd370=function(_0x10a21f,_0x414459){_0x10a21f=_0x10a21f-0x0;var _0x489175=_0x370d[_0x10a21f];return _0x489175;};'use strict';var EventEmitter=require(_0xd370('0x0'));var VoiceExtension=require(_0xd370('0x1'))['db'][_0xd370('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd370('0x3'),'afterDestroy':_0xd370('0x4')};function emitEvent(_0x145598){return function(_0xdb3e0d,_0x5dbad3,_0x808761){VoiceExtensionEvents['emit'](_0x145598+':'+_0xdb3e0d['id'],_0xdb3e0d);VoiceExtensionEvents['emit'](_0x145598,_0xdb3e0d);_0x808761(null);};}for(var e in events){if(events[_0xd370('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 77b2e82..99bc37d 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 _0x081e=['priority','concat','define','VoiceExtension','voice_extensions','get','last','Hangup','lodash','exports','type','Set','CDR(type)=','context','exten','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','param','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','agi'];(function(_0x304608,_0x303dd1){var _0x17091a=function(_0x3f6eca){while(--_0x3f6eca){_0x304608['push'](_0x304608['shift']());}};_0x17091a(++_0x303dd1);}(_0x081e,0x160));var _0xe081=function(_0x39887a,_0x5835ca){_0x39887a=_0x39887a-0x0;var _0x1f8468=_0x081e[_0x39887a];return _0x1f8468;};'use strict';var _=require(_0xe081('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xe081('0x1')]=function(_0x3c3812){var _0x3192ba=_0x3c3812['models'];function _0x1e6138(_0x918a10){var _0x4de4f0=0x2;var _0x3e306a=[{'type':_0x918a10[_0xe081('0x2')],'app':_0xe081('0x3'),'appdata':_0xe081('0x4')+_0x918a10[_0xe081('0x2')],'context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']},{'type':_0x918a10[_0xe081('0x2')],'app':_0x918a10['alias']?_0xe081('0x3'):_0xe081('0x7'),'appdata':_0x918a10['alias']?_0xe081('0x8')+_0x918a10[_0xe081('0x9')]:_0xe081('0xa'),'context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']}];if(_0x918a10[_0xe081('0x2')]===_0xe081('0xb')){_0x3e306a[_0xe081('0xc')]({'type':_0xe081('0xb'),'app':_0xe081('0x3'),'appdata':_0xe081('0xd')+_0x918a10['id'],'context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']});}_0x3e306a[_0xe081('0xc')]({'type':_0x918a10[_0xe081('0x2')],'app':_0xe081('0x3'),'appdata':_0xe081('0xe'),'context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']},{'type':_0x918a10[_0xe081('0x2')],'app':_0xe081('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']},{'type':_0x918a10[_0xe081('0x2')],'app':_0xe081('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x918a10[_0xe081('0x5')],'exten':_0x918a10[_0xe081('0x6')],'priority':_0x4de4f0++,'VoiceExtensionId':_0x918a10['id']});return _0x3e306a;}function _0x143a82(_0x5465c7){var _0x3dd655=0x2;var _0x5e05d0=[{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':_0xe081('0x10'),'context':_0x5465c7['context'],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0x5465c7['alias']?_0xe081('0x3'):_0xe081('0x7'),'appdata':_0x5465c7['alias']?_0xe081('0x8')+_0x5465c7['alias']:_0xe081('0xa'),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7['exten'],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':_0xe081('0x11')+(_0x5465c7[_0xe081('0x12')]?_0xe081('0x13')+_0x5465c7[_0xe081('0x12')]+'}':_0xe081('0x14')),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':'CDR(routeid)='+_0x5465c7['id'],'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7['exten'],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x15'),'appdata':_0xe081('0x16')+(_0x3dd655+0x2)+_0xe081('0x17')+(_0x3dd655+0x1)+')','context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':'Set','appdata':_0x5465c7[_0xe081('0x12')]?_0xe081('0x18')+_0x5465c7[_0xe081('0x12')]+'}':'CDR(prefix)=noprefix','context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7['exten'],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':'outbound','app':_0xe081('0x3'),'appdata':_0xe081('0xe'),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':_0xe081('0x19'),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':'outbound','app':_0xe081('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':_0xe081('0x1a')+_0x5465c7['id'],'context':_0x5465c7['context'],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']}];if(_0x5465c7[_0xe081('0x1b')](_0xe081('0x1c'))&&_0x5465c7[_0xe081('0x1c')]!==_0xe081('0x1d')){_0x5e05d0[_0xe081('0xc')]({'type':'outbound','app':_0xe081('0x3'),'appdata':_0xe081('0x1e'),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7[_0xe081('0x6')],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']},{'type':_0xe081('0xf'),'app':_0xe081('0x3'),'appdata':_0xe081('0x1f')+_0x5465c7[_0xe081('0x1c')]||_0xe081('0x20'),'context':_0x5465c7[_0xe081('0x5')],'exten':_0x5465c7['exten'],'priority':_0x3dd655++,'VoiceExtensionId':_0x5465c7['id']});}return _0x5e05d0;}function _0x677e5f(_0x4d9643,_0x519a1e){var _0x17457b=[{'name':_0xe081('0x21'),'param':0x0},{'name':_0xe081('0x22'),'param':0x1},{'name':_0xe081('0x23'),'param':0x2},{'name':_0xe081('0x24'),'param':0x3}];var _0x450e20={};var _0x24a994=_0x519a1e[_0xe081('0x25')](',');var _0x2095d4=[];for(var _0x372bf7=0x0;_0x372bf7<_0x17457b['length'];_0x372bf7++){switch(_0x17457b[_0x372bf7][_0xe081('0x26')]){case _0xe081('0x21'):_0x450e20[_0xe081('0x21')]=_0x24a994[_0x17457b[_0x372bf7][_0xe081('0x27')]]['split']('/')[0x1];_0x450e20['phone']=_0x24a994[_0x17457b[_0x372bf7][_0xe081('0x27')]][_0xe081('0x25')]('/')[0x2];_0x450e20[_0xe081('0x28')]=_0x450e20[_0xe081('0x29')]?_0x450e20['phone'][_0xe081('0x25')]('$')[0x0]:undefined;_0x450e20[_0xe081('0x29')]=_0x4d9643[_0xe081('0x12')]?(_0x450e20[_0xe081('0x28')]||'')+'${EXTEN:'+_0x4d9643[_0xe081('0x12')]+'}':(_0x450e20[_0xe081('0x28')]||'')+_0xe081('0x14');_0x2095d4[_0x17457b[_0x372bf7][_0xe081('0x27')]]=[_0xe081('0x2a'),_0x450e20[_0xe081('0x21')],_0x450e20[_0xe081('0x29')]][_0xe081('0x2b')]('/');break;case'options':_0x450e20[_0xe081('0x23')]=_0x24a994[_0x17457b[_0x372bf7]['param']];if(_0x4d9643['recordingFormat']!==_0xe081('0x1d')){if(_0x450e20[_0xe081('0x23')][_0xe081('0x2c')](_0xe081('0x2d'))<0x0){_0x450e20[_0xe081('0x23')]+='U(xcally-mixmonitor-context)';}}else{_0x450e20[_0xe081('0x23')]=_0x450e20[_0xe081('0x23')]['replace']('U(xcally-mixmonitor-context)','');}_0x2095d4[_0x17457b[_0x372bf7][_0xe081('0x27')]]=_0x450e20['options'];break;default:_0x2095d4[_0x17457b[_0x372bf7][_0xe081('0x27')]]=_0x24a994[_0x17457b[_0x372bf7][_0xe081('0x27')]];}}return _0x2095d4[_0xe081('0x2b')](',');}function _0x47d806(_0x2486a1,_0x4f9004,_0xa1e130){return new Promise(function(_0xe38ff5,_0x23567a){var _0x3968d7=[];if(_[_0xe081('0x2e')](_0x4f9004))return _0xe38ff5(_0x3968d7);_0x3192ba[_0xe081('0x2f')][_0xe081('0x30')]({'attributes':['id',_0xe081('0x31'),_0xe081('0x32')],'raw':!![]})[_0xe081('0x33')](function(_0x4b750a){for(var _0x3a16cd=0x0,_0x3561df=0x0;_0x3a16cd<_0x4f9004[_0xe081('0x34')];_0x3a16cd++,_0x3561df=0x0){var _0x2d2a64=_0x4f9004[_0x3a16cd];var _0x320677=[];var _0x376b87=[];delete _0x2d2a64['id'];if(_0x2d2a64[_0xe081('0x31')]!==_0xe081('0x35')){_0x2d2a64['intervals']=[_0x2d2a64[_0xe081('0x31')]];}else{_0x2d2a64[_0xe081('0x36')]=_0x2d2a64['IntervalId']?_[_0xe081('0x37')](_[_0xe081('0x38')](_0x4b750a,{'IntervalId':_0x2d2a64[_0xe081('0x32')]}),_0xe081('0x31')):[];}_0x2d2a64['context']=_0x2486a1[_0xe081('0x5')];_0x2d2a64[_0xe081('0x6')]=_0x2486a1['exten'];if(_0x2d2a64[_0xe081('0x2')])_0x2d2a64[_0xe081('0x2')]=_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')]();if(_0x2486a1[_0xe081('0x2')]===_0xe081('0xf')){if(_0x2d2a64[_0xe081('0x1b')](_0xe081('0x3a'))&&_0x2d2a64['tag']&&_0x2d2a64[_0xe081('0x3a')]!=='--'){_0x320677[_0xe081('0xc')]({'type':_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')](),'app':_0xe081('0x3'),'appdata':_0xe081('0x3b')+_0x2d2a64[_0xe081('0x3a')],'context':_0x2486a1['context'],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64['intervals'][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});}_0x320677[_0xe081('0xc')]({'type':_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')](),'app':_0xe081('0x15'),'appdata':_0xe081('0x3c')+(_0x2d2a64[_0xe081('0x3d')]?_0xe081('0x3e')+_0x2d2a64[_0xe081('0x3d')]+')':_0xe081('0x3f')),'context':_0x2486a1[_0xe081('0x5')],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64[_0xe081('0x36')][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});}else{if(_0x2d2a64[_0xe081('0x1b')](_0xe081('0x40'))){if([_0xe081('0x41'),_0xe081('0x42')]['includes'](_0x2d2a64[_0xe081('0x43')][_0xe081('0x39')]())&&_0x2d2a64['appType']!==_0xe081('0x44')){if(_0x2d2a64[_0xe081('0x40')]){_0x320677[_0xe081('0xc')]({'type':_0x2d2a64['type'][_0xe081('0x39')](),'app':_0xe081('0x15'),'appdata':_0xe081('0x45'),'context':_0x2486a1['context'],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64['intervals']['length']+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});_0x320677[_0xe081('0xc')]({'type':_0x2d2a64['type']['toLowerCase'](),'app':_0xe081('0x3'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2486a1[_0xe081('0x5')],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64[_0xe081('0x36')][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});}else{_0x320677[_0xe081('0xc')]({'type':_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')](),'app':_0xe081('0x15'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2486a1[_0xe081('0x5')],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64[_0xe081('0x36')][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});_0x320677[_0xe081('0xc')]({'type':_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')](),'app':_0xe081('0x3'),'appdata':_0xe081('0x46'),'context':_0x2486a1[_0xe081('0x5')],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64['intervals'][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});}}}}for(var _0x3d8923=0x0;_0x3d8923<_0x2d2a64[_0xe081('0x36')][_0xe081('0x34')];_0x3d8923++){var _0xcdab9=_0xa1e130+_0x2d2a64['intervals'][_0xe081('0x34')];var _0x4aa6db=_0x3d8923===_0x2d2a64['intervals'][_0xe081('0x34')]-0x1?_0xa1e130+_0x320677['length']+_0x376b87[_0xe081('0x34')]+0x2:_0xa1e130+_0x3d8923+0x1;_0x320677[_0xe081('0x47')](_0x3d8923,0x0,{'type':_0x2486a1[_0xe081('0x2')],'app':_0xe081('0x48'),'appdata':_0x2d2a64['intervals'][_0x3d8923]+'?'+_0x2486a1[_0xe081('0x5')]+_0xe081('0x49')+_0xcdab9+':'+_0x2486a1[_0xe081('0x5')]+',${EXTEN},'+_0x4aa6db,'exten':_0x2486a1[_0xe081('0x6')],'context':_0x2486a1[_0xe081('0x5')],'priority':_0xa1e130+_0x3d8923,'VoiceExtensionId':_0x2486a1['id']});}if(_0x2d2a64[_0xe081('0x4a')]===_0xe081('0x4b')){_0x2d2a64[_0xe081('0x4c')]=_0x677e5f(_0x2486a1,_0x2d2a64[_0xe081('0x4c')]);}if(_0x2d2a64[_0xe081('0x4a')]===_0xe081('0x4d')){_0x320677[_0xe081('0xc')]({'type':_0x2d2a64[_0xe081('0x2')][_0xe081('0x39')](),'app':_0xe081('0x3'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x2486a1[_0xe081('0x5')],'exten':_0x2486a1[_0xe081('0x6')],'priority':_0x2d2a64['intervals'][_0xe081('0x34')]+_0xa1e130+_0x3561df++,'VoiceExtensionId':_0x2486a1['id']});}_0x2d2a64['priority']=_0x320677[_0xe081('0x34')]?_['last'](_0x320677)[_0xe081('0x4e')]+0x1:_0xa1e130;_0x3968d7=_[_0xe081('0x4f')](_0x3968d7,_0x320677,[_0x2d2a64],_0x376b87);_0xa1e130=_['last'](_0x3968d7)[_0xe081('0x4e')]+0x1;}return _0xe38ff5(_0x3968d7);})['catch'](function(_0x923cce){_0x23567a(_0x923cce);});});}return _0x3c3812[_0xe081('0x50')](_0xe081('0x51'),attributes,{'tableName':_0xe081('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1996f3){var _0x54cfd7=this[_0xe081('0x53')]({'plain':!![]});var _0x5af78b=_0x54cfd7['type']===_0xe081('0xf')?_0x143a82(_0x54cfd7):_0x1e6138(_0x54cfd7);return _0x47d806(_0x54cfd7,_0x1996f3,_[_0xe081('0x54')](_0x5af78b)[_0xe081('0x4e')]+0x1)['then'](function(_0xee4b86){var _0x37486b=_[_0xe081('0x4f')](_0x5af78b,_0xee4b86);_0x37486b[_0xe081('0xc')]({'type':_0x54cfd7['type'],'app':_0xe081('0x55'),'exten':_0x54cfd7[_0xe081('0x6')],'context':_0x54cfd7[_0xe081('0x5')],'priority':_['last'](_0x37486b)[_0xe081('0x4e')]+0x1,'VoiceExtensionId':_0x54cfd7['id']});return _0x37486b;});}}});}; \ No newline at end of file +var _0x2c22=['length','name','trunk','phone','param','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','appdata','agi','priority','last','concat','catch','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type','context','exten','alias','Set','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url','split'];(function(_0x43800e,_0x3c2920){var _0x4789e1=function(_0x1e3bd1){while(--_0x1e3bd1){_0x43800e['push'](_0x43800e['shift']());}};_0x4789e1(++_0x3c2920);}(_0x2c22,0x1cc));var _0x22c2=function(_0x3d4ed3,_0x5e06e){_0x3d4ed3=_0x3d4ed3-0x0;var _0x9e519a=_0x2c22[_0x3d4ed3];return _0x9e519a;};'use strict';var _=require('lodash');var attributes=require(_0x22c2('0x0'));module[_0x22c2('0x1')]=function(_0x4515a4){var _0x335d72=_0x4515a4[_0x22c2('0x2')];function _0xd2f998(_0xdf02f4){var _0x342db9=0x2;var _0x195a47=[{'type':_0xdf02f4[_0x22c2('0x3')],'app':'Set','appdata':'CDR(type)='+_0xdf02f4['type'],'context':_0xdf02f4[_0x22c2('0x4')],'exten':_0xdf02f4[_0x22c2('0x5')],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']},{'type':_0xdf02f4[_0x22c2('0x3')],'app':_0xdf02f4[_0x22c2('0x6')]?_0x22c2('0x7'):'NoOp','appdata':_0xdf02f4[_0x22c2('0x6')]?_0x22c2('0x8')+_0xdf02f4[_0x22c2('0x6')]:_0x22c2('0x9'),'context':_0xdf02f4[_0x22c2('0x4')],'exten':_0xdf02f4[_0x22c2('0x5')],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']}];if(_0xdf02f4[_0x22c2('0x3')]===_0x22c2('0xa')){_0x195a47[_0x22c2('0xb')]({'type':_0x22c2('0xa'),'app':'Set','appdata':_0x22c2('0xc')+_0xdf02f4['id'],'context':_0xdf02f4[_0x22c2('0x4')],'exten':_0xdf02f4['exten'],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']});}_0x195a47[_0x22c2('0xb')]({'type':_0xdf02f4[_0x22c2('0x3')],'app':_0x22c2('0x7'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xdf02f4[_0x22c2('0x4')],'exten':_0xdf02f4['exten'],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']},{'type':_0xdf02f4[_0x22c2('0x3')],'app':'Set','appdata':_0x22c2('0xd'),'context':_0xdf02f4[_0x22c2('0x4')],'exten':_0xdf02f4[_0x22c2('0x5')],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']},{'type':_0xdf02f4[_0x22c2('0x3')],'app':'Set','appdata':_0x22c2('0xe'),'context':_0xdf02f4['context'],'exten':_0xdf02f4[_0x22c2('0x5')],'priority':_0x342db9++,'VoiceExtensionId':_0xdf02f4['id']});return _0x195a47;}function _0x13c771(_0x1b28b7){var _0x376268=0x2;var _0x30b164=[{'type':_0x22c2('0xf'),'app':'Set','appdata':_0x22c2('0x10'),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x1b28b7[_0x22c2('0x6')]?'Set':_0x22c2('0x11'),'appdata':_0x1b28b7[_0x22c2('0x6')]?_0x22c2('0x8')+_0x1b28b7[_0x22c2('0x6')]:'No\x20alias\x20set','context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x12')+(_0x1b28b7[_0x22c2('0x13')]?_0x22c2('0x14')+_0x1b28b7[_0x22c2('0x13')]+'}':_0x22c2('0x15')),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':'CDR(routeid)='+_0x1b28b7['id'],'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7['exten'],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':'outbound','app':_0x22c2('0x16'),'appdata':_0x22c2('0x17')+(_0x376268+0x2)+_0x22c2('0x18')+(_0x376268+0x1)+')','context':_0x1b28b7['context'],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':_0x1b28b7[_0x22c2('0x13')]?_0x22c2('0x19')+_0x1b28b7[_0x22c2('0x13')]+'}':_0x22c2('0x1a'),'context':_0x1b28b7['context'],'exten':_0x1b28b7['exten'],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x1b'),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':'Set','appdata':_0x22c2('0xd'),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':'Set','appdata':_0x22c2('0xe'),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':'outbound','app':_0x22c2('0x7'),'appdata':_0x22c2('0x1c')+_0x1b28b7['id'],'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']}];if(_0x1b28b7[_0x22c2('0x1d')]('recordingFormat')&&_0x1b28b7[_0x22c2('0x1e')]!=='none'){_0x30b164[_0x22c2('0xb')]({'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x1f'),'context':_0x1b28b7[_0x22c2('0x4')],'exten':_0x1b28b7[_0x22c2('0x5')],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']},{'type':_0x22c2('0xf'),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x20')+_0x1b28b7['recordingFormat']||_0x22c2('0x21'),'context':_0x1b28b7['context'],'exten':_0x1b28b7['exten'],'priority':_0x376268++,'VoiceExtensionId':_0x1b28b7['id']});}return _0x30b164;}function _0x1997b3(_0xdf9a86,_0x33cc06){var _0x3495ed=[{'name':'trunk','param':0x0},{'name':_0x22c2('0x22'),'param':0x1},{'name':_0x22c2('0x23'),'param':0x2},{'name':_0x22c2('0x24'),'param':0x3}];var _0x51ce76={};var _0x54a41c=_0x33cc06[_0x22c2('0x25')](',');var _0x695217=[];for(var _0x2f6c99=0x0;_0x2f6c99<_0x3495ed[_0x22c2('0x26')];_0x2f6c99++){switch(_0x3495ed[_0x2f6c99][_0x22c2('0x27')]){case _0x22c2('0x28'):_0x51ce76[_0x22c2('0x28')]=_0x54a41c[_0x3495ed[_0x2f6c99]['param']]['split']('/')[0x1];_0x51ce76[_0x22c2('0x29')]=_0x54a41c[_0x3495ed[_0x2f6c99][_0x22c2('0x2a')]][_0x22c2('0x25')]('/')[0x2];_0x51ce76[_0x22c2('0x2b')]=_0x51ce76['phone']?_0x51ce76[_0x22c2('0x29')][_0x22c2('0x25')]('$')[0x0]:undefined;_0x51ce76[_0x22c2('0x29')]=_0xdf9a86['cutdigits']?(_0x51ce76[_0x22c2('0x2b')]||'')+_0x22c2('0x14')+_0xdf9a86['cutdigits']+'}':(_0x51ce76[_0x22c2('0x2b')]||'')+_0x22c2('0x15');_0x695217[_0x3495ed[_0x2f6c99][_0x22c2('0x2a')]]=[_0x22c2('0x2c'),_0x51ce76[_0x22c2('0x28')],_0x51ce76[_0x22c2('0x29')]][_0x22c2('0x2d')]('/');break;case _0x22c2('0x23'):_0x51ce76[_0x22c2('0x23')]=_0x54a41c[_0x3495ed[_0x2f6c99][_0x22c2('0x2a')]];if(_0xdf9a86[_0x22c2('0x1e')]!==_0x22c2('0x2e')){if(_0x51ce76['options'][_0x22c2('0x2f')](_0x22c2('0x30'))<0x0){_0x51ce76[_0x22c2('0x23')]+=_0x22c2('0x30');}}else{_0x51ce76['options']=_0x51ce76[_0x22c2('0x23')][_0x22c2('0x31')]('U(xcally-mixmonitor-context)','');}_0x695217[_0x3495ed[_0x2f6c99][_0x22c2('0x2a')]]=_0x51ce76[_0x22c2('0x23')];break;default:_0x695217[_0x3495ed[_0x2f6c99][_0x22c2('0x2a')]]=_0x54a41c[_0x3495ed[_0x2f6c99]['param']];}}return _0x695217[_0x22c2('0x2d')](',');}function _0x561b7d(_0x433153,_0xd5e272,_0x56fac0){return new Promise(function(_0x278dd2,_0x58e1f3){var _0x2df9df=[];if(_['isEmpty'](_0xd5e272))return _0x278dd2(_0x2df9df);_0x335d72['Interval'][_0x22c2('0x32')]({'attributes':['id',_0x22c2('0x33'),_0x22c2('0x34')],'raw':!![]})[_0x22c2('0x35')](function(_0x1a5e3){for(var _0x160244=0x0,_0x1462eb=0x0;_0x160244<_0xd5e272[_0x22c2('0x26')];_0x160244++,_0x1462eb=0x0){var _0x32c082=_0xd5e272[_0x160244];var _0x238a76=[];var _0x6ff0e8=[];delete _0x32c082['id'];if(_0x32c082[_0x22c2('0x33')]!=='*,*,*,*'){_0x32c082[_0x22c2('0x36')]=[_0x32c082[_0x22c2('0x33')]];}else{_0x32c082['intervals']=_0x32c082[_0x22c2('0x34')]?_[_0x22c2('0x37')](_[_0x22c2('0x38')](_0x1a5e3,{'IntervalId':_0x32c082[_0x22c2('0x34')]}),_0x22c2('0x33')):[];}_0x32c082[_0x22c2('0x4')]=_0x433153[_0x22c2('0x4')];_0x32c082['exten']=_0x433153[_0x22c2('0x5')];if(_0x32c082[_0x22c2('0x3')])_0x32c082['type']=_0x32c082['type'][_0x22c2('0x39')]();if(_0x433153[_0x22c2('0x3')]==='outbound'){if(_0x32c082[_0x22c2('0x1d')](_0x22c2('0x3a'))&&_0x32c082['tag']&&_0x32c082[_0x22c2('0x3a')]!=='--'){_0x238a76[_0x22c2('0xb')]({'type':_0x32c082['type'][_0x22c2('0x39')](),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x3b')+_0x32c082['tag'],'context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082[_0x22c2('0x36')]['length']+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});}_0x238a76[_0x22c2('0xb')]({'type':_0x32c082[_0x22c2('0x3')][_0x22c2('0x39')](),'app':'ExecIf','appdata':_0x22c2('0x3c')+(_0x32c082['callerID']?_0x22c2('0x3d')+_0x32c082[_0x22c2('0x3e')]+')':_0x22c2('0x3f')),'context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082[_0x22c2('0x36')]['length']+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});}else{if(_0x32c082[_0x22c2('0x1d')](_0x22c2('0x40'))){if([_0x22c2('0x41'),'playback'][_0x22c2('0x42')](_0x32c082[_0x22c2('0x43')][_0x22c2('0x39')]())&&_0x32c082[_0x22c2('0x44')]!==_0x22c2('0x45')){if(_0x32c082['answer']){_0x238a76[_0x22c2('0xb')]({'type':_0x32c082[_0x22c2('0x3')][_0x22c2('0x39')](),'app':_0x22c2('0x16'),'appdata':_0x22c2('0x46'),'context':_0x433153['context'],'exten':_0x433153['exten'],'priority':_0x32c082['intervals'][_0x22c2('0x26')]+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});_0x238a76[_0x22c2('0xb')]({'type':_0x32c082['type'][_0x22c2('0x39')](),'app':_0x22c2('0x7'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082['intervals'][_0x22c2('0x26')]+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});}else{_0x238a76[_0x22c2('0xb')]({'type':_0x32c082[_0x22c2('0x3')][_0x22c2('0x39')](),'app':_0x22c2('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082['intervals']['length']+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});_0x238a76[_0x22c2('0xb')]({'type':_0x32c082[_0x22c2('0x3')][_0x22c2('0x39')](),'app':_0x22c2('0x7'),'appdata':_0x22c2('0x47'),'context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082[_0x22c2('0x36')][_0x22c2('0x26')]+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});}}}}for(var _0x513d64=0x0;_0x513d64<_0x32c082[_0x22c2('0x36')]['length'];_0x513d64++){var _0x1aa175=_0x56fac0+_0x32c082[_0x22c2('0x36')][_0x22c2('0x26')];var _0x202c3a=_0x513d64===_0x32c082[_0x22c2('0x36')][_0x22c2('0x26')]-0x1?_0x56fac0+_0x238a76['length']+_0x6ff0e8[_0x22c2('0x26')]+0x2:_0x56fac0+_0x513d64+0x1;_0x238a76['splice'](_0x513d64,0x0,{'type':_0x433153['type'],'app':'GotoIfTime','appdata':_0x32c082[_0x22c2('0x36')][_0x513d64]+'?'+_0x433153['context']+',${EXTEN},'+_0x1aa175+':'+_0x433153['context']+_0x22c2('0x48')+_0x202c3a,'exten':_0x433153[_0x22c2('0x5')],'context':_0x433153[_0x22c2('0x4')],'priority':_0x56fac0+_0x513d64,'VoiceExtensionId':_0x433153['id']});}if(_0x32c082[_0x22c2('0x44')]===_0x22c2('0x49')){_0x32c082[_0x22c2('0x4a')]=_0x1997b3(_0x433153,_0x32c082['appdata']);}if(_0x32c082[_0x22c2('0x44')]===_0x22c2('0x4b')){_0x238a76['push']({'type':_0x32c082[_0x22c2('0x3')][_0x22c2('0x39')](),'app':'Set','appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x433153[_0x22c2('0x4')],'exten':_0x433153[_0x22c2('0x5')],'priority':_0x32c082['intervals'][_0x22c2('0x26')]+_0x56fac0+_0x1462eb++,'VoiceExtensionId':_0x433153['id']});}_0x32c082[_0x22c2('0x4c')]=_0x238a76[_0x22c2('0x26')]?_[_0x22c2('0x4d')](_0x238a76)['priority']+0x1:_0x56fac0;_0x2df9df=_[_0x22c2('0x4e')](_0x2df9df,_0x238a76,[_0x32c082],_0x6ff0e8);_0x56fac0=_[_0x22c2('0x4d')](_0x2df9df)['priority']+0x1;}return _0x278dd2(_0x2df9df);})[_0x22c2('0x4f')](function(_0x25610e){_0x58e1f3(_0x25610e);});});}return _0x4515a4['define']('VoiceExtension',attributes,{'tableName':_0x22c2('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x543eb3){var _0x54e1e0=this[_0x22c2('0x51')]({'plain':!![]});var _0x58761a=_0x54e1e0['type']===_0x22c2('0xf')?_0x13c771(_0x54e1e0):_0xd2f998(_0x54e1e0);return _0x561b7d(_0x54e1e0,_0x543eb3,_[_0x22c2('0x4d')](_0x58761a)[_0x22c2('0x4c')]+0x1)['then'](function(_0x1bf293){var _0x17924d=_[_0x22c2('0x4e')](_0x58761a,_0x1bf293);_0x17924d[_0x22c2('0xb')]({'type':_0x54e1e0['type'],'app':_0x22c2('0x52'),'exten':_0x54e1e0[_0x22c2('0x5')],'context':_0x54e1e0['context'],'priority':_[_0x22c2('0x4d')](_0x17924d)[_0x22c2('0x4c')]+0x1,'VoiceExtensionId':_0x54e1e0['id']});return _0x17924d;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 44909eb..0e14ac0 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 _0xe2bc=['../../config/environment','jayson/promise','client','http','redis','localhost','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xe2bc[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xce2b('0x0'));var util=require('util');var moment=require(_0xce2b('0x1'));var BPromise=require('bluebird');var rs=require(_0xce2b('0x2'));var fs=require('fs');var Redis=require(_0xce2b('0x3'));var db=require(_0xce2b('0x4'))['db'];var utils=require(_0xce2b('0x5'));var logger=require(_0xce2b('0x6'))('rpc');var config=require(_0xce2b('0x7'));var jayson=require(_0xce2b('0x8'));var client=jayson[_0xce2b('0x9')][_0xce2b('0xa')]({'port':0x232a});config[_0xce2b('0xb')]=_['defaults'](config[_0xce2b('0xb')],{'host':_0xce2b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xce2b('0xb')]));require(_0xce2b('0xd'))[_0xce2b('0xe')](socket);function respondWithRpcPromise(_0x3786aa,_0x1e5036,_0xc6cdb){return new BPromise(function(_0x3eae6d,_0xa7941){return client[_0xce2b('0xf')](_0x3786aa,_0xc6cdb)[_0xce2b('0x10')](function(_0x47a597){logger[_0xce2b('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x1e5036,_0xce2b('0x12'));logger[_0xce2b('0x13')](_0xce2b('0x14'),_0x1e5036,_0xce2b('0x12'),JSON[_0xce2b('0x15')](_0x47a597));if(_0x47a597[_0xce2b('0x16')]){if(_0x47a597[_0xce2b('0x16')][_0xce2b('0x17')]===0x1f4){logger['error'](_0xce2b('0x18'),_0x1e5036,_0x47a597[_0xce2b('0x16')]['message']);return _0xa7941(_0x47a597['error']['message']);}logger[_0xce2b('0x16')](_0xce2b('0x18'),_0x1e5036,_0x47a597[_0xce2b('0x16')]['message']);return _0x3eae6d(_0x47a597['error'][_0xce2b('0x19')]);}else{logger[_0xce2b('0x11')](_0xce2b('0x18'),_0x1e5036,_0xce2b('0x12'));_0x3eae6d(_0x47a597[_0xce2b('0x1a')][_0xce2b('0x19')]);}})[_0xce2b('0x1b')](function(_0x31316d){logger[_0xce2b('0x16')](_0xce2b('0x18'),_0x1e5036,_0x31316d);_0xa7941(_0x31316d);});});}exports['GetVoiceExtension']=function(_0x192002){var _0x1d888c=this;return new Promise(function(_0x167e55,_0x44c2af){return db[_0xce2b('0x1c')][_0xce2b('0x1d')]({'raw':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x1f')]===undefined?!![]:![]:!![],'where':_0x192002[_0xce2b('0x1e')]?_0x192002['options'][_0xce2b('0x20')]||null:null,'attributes':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x21')]||null:null,'limit':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x22')]||null:null,'include':_0x192002[_0xce2b('0x1e')]?_0x192002[_0xce2b('0x1e')][_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x192002['options']['include'],function(_0x527b03){return{'model':db[_0x527b03[_0xce2b('0x25')]],'as':_0x527b03['as'],'attributes':_0x527b03['attributes'],'include':_0x527b03[_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x527b03['include'],function(_0x60eca0){return{'model':db[_0x60eca0[_0xce2b('0x25')]],'as':_0x60eca0['as'],'attributes':_0x60eca0['attributes'],'include':_0x60eca0[_0xce2b('0x23')]?_[_0xce2b('0x24')](_0x60eca0[_0xce2b('0x23')],function(_0x50a62f){return{'model':db[_0x50a62f['model']],'as':_0x50a62f['as'],'attributes':_0x50a62f[_0xce2b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xce2b('0x10')](function(_0x211b88){logger['info']('GetVoiceExtension',_0x192002);logger[_0xce2b('0x13')](_0xce2b('0x26'),_0x192002,JSON[_0xce2b('0x15')](_0x211b88));_0x167e55(_0x211b88);})['catch'](function(_0x3a8c00){logger[_0xce2b('0x16')](_0xce2b('0x26'),_0x3a8c00[_0xce2b('0x19')],_0x192002);_0x44c2af(_0x1d888c[_0xce2b('0x16')](0x1f4,_0x3a8c00[_0xce2b('0x19')]));});});}; \ No newline at end of file +var _0xf8af=['VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','model','attributes','map','info','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x144d9e,_0x513680){var _0x242e7f=function(_0x58795b){while(--_0x58795b){_0x144d9e['push'](_0x144d9e['shift']());}};_0x242e7f(++_0x513680);}(_0xf8af,0x8b));var _0xff8a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf8af[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xff8a('0x0'));var util=require('util');var moment=require(_0xff8a('0x1'));var BPromise=require(_0xff8a('0x2'));var rs=require(_0xff8a('0x3'));var fs=require('fs');var Redis=require(_0xff8a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xff8a('0x5'));var logger=require(_0xff8a('0x6'))(_0xff8a('0x7'));var config=require(_0xff8a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xff8a('0x9')]({'port':0x232a});config['redis']=_[_0xff8a('0xa')](config[_0xff8a('0xb')],{'host':_0xff8a('0xc'),'port':0x18eb});var socket=require(_0xff8a('0xd'))(new Redis(config[_0xff8a('0xb')]));require(_0xff8a('0xe'))[_0xff8a('0xf')](socket);function respondWithRpcPromise(_0x7442d6,_0x3bb1ba,_0xb8cb56){return new BPromise(function(_0x2c2e5d,_0x5a31cb){return client[_0xff8a('0x10')](_0x7442d6,_0xb8cb56)[_0xff8a('0x11')](function(_0x3f12b5){logger['info'](_0xff8a('0x12'),_0x3bb1ba,_0xff8a('0x13'));logger[_0xff8a('0x14')](_0xff8a('0x15'),_0x3bb1ba,_0xff8a('0x13'),JSON['stringify'](_0x3f12b5));if(_0x3f12b5[_0xff8a('0x16')]){if(_0x3f12b5[_0xff8a('0x16')][_0xff8a('0x17')]===0x1f4){logger[_0xff8a('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x3bb1ba,_0x3f12b5['error']['message']);return _0x5a31cb(_0x3f12b5['error'][_0xff8a('0x18')]);}logger['error'](_0xff8a('0x12'),_0x3bb1ba,_0x3f12b5[_0xff8a('0x16')]['message']);return _0x2c2e5d(_0x3f12b5[_0xff8a('0x16')]['message']);}else{logger['info'](_0xff8a('0x12'),_0x3bb1ba,_0xff8a('0x13'));_0x2c2e5d(_0x3f12b5[_0xff8a('0x19')]['message']);}})[_0xff8a('0x1a')](function(_0x5c4349){logger[_0xff8a('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x3bb1ba,_0x5c4349);_0x5a31cb(_0x5c4349);});});}exports[_0xff8a('0x1b')]=function(_0x1b4272){var _0x794015=this;return new Promise(function(_0xdb1027,_0x145d95){return db[_0xff8a('0x1c')][_0xff8a('0x1d')]({'raw':_0x1b4272[_0xff8a('0x1e')]?_0x1b4272[_0xff8a('0x1e')][_0xff8a('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b4272[_0xff8a('0x1e')]?_0x1b4272[_0xff8a('0x1e')][_0xff8a('0x20')]||null:null,'attributes':_0x1b4272[_0xff8a('0x1e')]?_0x1b4272[_0xff8a('0x1e')]['attributes']||null:null,'limit':_0x1b4272[_0xff8a('0x1e')]?_0x1b4272[_0xff8a('0x1e')][_0xff8a('0x21')]||null:null,'include':_0x1b4272[_0xff8a('0x1e')]?_0x1b4272['options'][_0xff8a('0x22')]?_['map'](_0x1b4272[_0xff8a('0x1e')][_0xff8a('0x22')],function(_0x2c67c2){return{'model':db[_0x2c67c2[_0xff8a('0x23')]],'as':_0x2c67c2['as'],'attributes':_0x2c67c2[_0xff8a('0x24')],'include':_0x2c67c2['include']?_[_0xff8a('0x25')](_0x2c67c2[_0xff8a('0x22')],function(_0x3063b1){return{'model':db[_0x3063b1['model']],'as':_0x3063b1['as'],'attributes':_0x3063b1[_0xff8a('0x24')],'include':_0x3063b1[_0xff8a('0x22')]?_[_0xff8a('0x25')](_0x3063b1[_0xff8a('0x22')],function(_0x38188f){return{'model':db[_0x38188f[_0xff8a('0x23')]],'as':_0x38188f['as'],'attributes':_0x38188f[_0xff8a('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ca17e){logger[_0xff8a('0x26')](_0xff8a('0x1b'),_0x1b4272);logger[_0xff8a('0x14')](_0xff8a('0x1b'),_0x1b4272,JSON[_0xff8a('0x27')](_0x4ca17e));_0xdb1027(_0x4ca17e);})[_0xff8a('0x1a')](function(_0x50cb0f){logger[_0xff8a('0x16')](_0xff8a('0x1b'),_0x50cb0f['message'],_0x1b4272);_0x145d95(_0x794015[_0xff8a('0x16')](0x1f4,_0x50cb0f[_0xff8a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 4a0d285..f4e7d82 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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x32928c,_0x6a0bf7){var _0xace309=function(_0x4be298){while(--_0x4be298){_0x32928c['push'](_0x32928c['shift']());}};_0xace309(++_0x6a0bf7);}(_0x4975,0x86));var _0x5497=function(_0x38fe35,_0x204d8c){_0x38fe35=_0x38fe35-0x0;var _0xafd33e=_0x4975[_0x38fe35];return _0xafd33e;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x4ad395,_0x2ab982){var _0x26313d=function(_0x5174be){while(--_0x5174be){_0x4ad395['push'](_0x4ad395['shift']());}};_0x26313d(++_0x2ab982);}(_0x7a54,0x106));var _0x47a5=function(_0x13399e,_0x378626){_0x13399e=_0x13399e-0x0;var _0x3b3f96=_0x7a54[_0x13399e];return _0x3b3f96;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 0261bf5..aac0f40 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 _0x1893=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','update'];(function(_0x4b651b,_0x400809){var _0x9879e1=function(_0xb51c02){while(--_0xb51c02){_0x4b651b['push'](_0x4b651b['shift']());}};_0x9879e1(++_0x400809);}(_0x1893,0xa2));var _0x3189=function(_0x555569,_0x15669b){_0x555569=_0x555569-0x0;var _0x2541ff=_0x1893[_0x555569];return _0x2541ff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3189('0x0'));var timeout=require(_0x3189('0x1'));var express=require(_0x3189('0x2'));var router=express[_0x3189('0x3')]();var fs_extra=require(_0x3189('0x4'));var auth=require(_0x3189('0x5'));var interaction=require(_0x3189('0x6'));var config=require('../../config/environment');var controller=require(_0x3189('0x7'));router[_0x3189('0x8')]('/',auth[_0x3189('0x9')](),controller[_0x3189('0xa')]);router[_0x3189('0x8')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0xc')]);router['get'](_0x3189('0xd'),auth['isAuthenticated'](),controller[_0x3189('0xe')]);router['post']('/',auth[_0x3189('0x9')](),controller[_0x3189('0xf')]);router[_0x3189('0x10')](_0x3189('0xb'),auth['isAuthenticated'](),controller[_0x3189('0x11')]);router[_0x3189('0x12')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0x13')]);module['exports']=router; \ No newline at end of file +var _0x627e=['show','/:id/messages','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x2e53ec,_0x3fdd41){var _0x3a5d88=function(_0xf91da7){while(--_0xf91da7){_0x2e53ec['push'](_0x2e53ec['shift']());}};_0x3a5d88(++_0x3fdd41);}(_0x627e,0x14a));var _0xe627=function(_0xa79fc3,_0x3b93fa){_0xa79fc3=_0xa79fc3-0x0;var _0x541d8d=_0x627e[_0xa79fc3];return _0x541d8d;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0xe627('0xe')]('/',auth[_0xe627('0x8')](),controller['create']);router['put'](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xf')]);router[_0xe627('0x10')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0x11')]);module[_0xe627('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 e10bc98..41b5271 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 _0x1947=['from-voicemail','contest_mailbox','setDataValue','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','STRING'];(function(_0x2f9a69,_0x14874a){var _0x343a80=function(_0x541e3e){while(--_0x541e3e){_0x2f9a69['push'](_0x2f9a69['shift']());}};_0x343a80(++_0x14874a);}(_0x1947,0x124));var _0x7194=function(_0x281187,_0x32ddf2){_0x281187=_0x281187-0x0;var _0x32b7a1=_0x1947[_0x281187];return _0x32b7a1;};'use strict';var Sequelize=require(_0x7194('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x7194('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x7194('0x2'),'unique':_0x7194('0x3')},'mailbox':{'type':Sequelize[_0x7194('0x1')],'defaultValue':'','allowNull':![],'unique':_0x7194('0x3')},'password':{'type':Sequelize[_0x7194('0x1')]},'fullname':{'type':Sequelize[_0x7194('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2125dc){this[_0x7194('0x4')]('email',typeof _0x2125dc==='string'&&_0x2125dc[_0x7194('0x5')]()?_0x2125dc[_0x7194('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x7194('0x1')],'defaultValue':_0x7194('0x6')},'attach':{'type':Sequelize[_0x7194('0x7')](_0x7194('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x7194('0x7')]('yes','no'),'defaultValue':_0x7194('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7194('0x1')]},'callback':{'type':Sequelize[_0x7194('0x1')]},'review':{'type':Sequelize[_0x7194('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7194('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7194('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7194('0x7')](_0x7194('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7194('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7194('0x7')](_0x7194('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7194('0x7')](_0x7194('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x7194('0x8'),'no'),'defaultValue':_0x7194('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7194('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x7194('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7194('0x7')](_0x7194('0x8'),'no'),'defaultValue':_0x7194('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x7194('0x1')]},'emailbody':{'type':Sequelize[_0x7194('0x1')]},'maxsecs':{'type':Sequelize[_0x7194('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7194('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7194('0xb')],'get':function(){return this[_0x7194('0xc')]('fullname')+'\x20-\x20'+this[_0x7194('0xc')](_0x7194('0xd'));}}}; \ No newline at end of file +var _0x89b1=['sequelize','exports','STRING','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','mailbox'];(function(_0x23b27c,_0x5cc227){var _0x63413c=function(_0x1b831e){while(--_0x1b831e){_0x23b27c['push'](_0x23b27c['shift']());}};_0x63413c(++_0x5cc227);}(_0x89b1,0x1c2));var _0x189b=function(_0x284288,_0xee6ca9){_0x284288=_0x284288-0x0;var _0x18ca41=_0x89b1[_0x284288];return _0x18ca41;};'use strict';var Sequelize=require(_0x189b('0x0'));module[_0x189b('0x1')]={'customer_id':{'type':Sequelize[_0x189b('0x2')]},'context':{'type':Sequelize[_0x189b('0x2')],'defaultValue':'from-voicemail','unique':_0x189b('0x3')},'mailbox':{'type':Sequelize[_0x189b('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x189b('0x2')]},'fullname':{'type':Sequelize[_0x189b('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0xbdfc1){this[_0x189b('0x4')](_0x189b('0x5'),typeof _0xbdfc1==='string'&&_0xbdfc1[_0x189b('0x6')]()?_0xbdfc1[_0x189b('0x6')]():null);}},'pager':{'type':Sequelize[_0x189b('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x189b('0x7')},'attach':{'type':Sequelize[_0x189b('0x8')]('yes','no'),'defaultValue':_0x189b('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x189b('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x189b('0x2')]},'callback':{'type':Sequelize[_0x189b('0x2')]},'review':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x189b('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':_0x189b('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x189b('0x8')](_0x189b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x189b('0x8')]('yes','no'),'defaultValue':_0x189b('0x9'),'allowNull':![]},'stamp':{'type':_0x189b('0xa')},'emailsubject':{'type':Sequelize[_0x189b('0x2')]},'emailbody':{'type':Sequelize[_0x189b('0x2')]},'maxsecs':{'type':Sequelize[_0x189b('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x189b('0xc')],'get':function(){return this['getDataValue']('fullname')+_0x189b('0xd')+this['getDataValue'](_0x189b('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 661c1cc..5de7001 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 _0x0bb5=['error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails'];(function(_0x49c8a2,_0x58dcff){var _0xe46e67=function(_0x547e69){while(--_0x547e69){_0x49c8a2['push'](_0x49c8a2['shift']());}};_0xe46e67(++_0x58dcff);}(_0x0bb5,0x148));var _0x50bb=function(_0x2cb0f3,_0xf73a5c){_0x2cb0f3=_0x2cb0f3-0x0;var _0xa44f94=_0x0bb5[_0x2cb0f3];return _0xa44f94;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){var _0xad17ac=_0x846311[_0x50bb('0x26')]({'plain':!![]});var _0x284a76=_0x50bb('0x27');return db['UserProfileResource'][_0x50bb('0x25')]({'where':{'type':_0x284a76,'resourceId':_0xad17ac['id']}})['then'](function(){return _0x846311;});})['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cfe4b,_0x41fd89){return function(_0x12ee2c){if(!_0x12ee2c){_0x5cfe4b[_0x50bb('0x19')](0x194);}return _0x12ee2c;};}function handleError(_0x1b74f9,_0x17c158){_0x17c158=_0x17c158||0x1f4;return function(_0x269479){logger[_0x50bb('0x28')](_0x269479[_0x50bb('0x29')]);if(_0x269479['name']){delete _0x269479[_0x50bb('0x2a')];}_0x1b74f9[_0x50bb('0x1a')](_0x17c158)[_0x50bb('0x2b')](_0x269479);};}exports[_0x50bb('0x2c')]=function(_0x560b07,_0x13dc3c){var _0x1a62fb={},_0xc38da5={},_0xb3c3ba={'count':0x0,'rows':[]};var _0x3fd5f6=_[_0x50bb('0x2d')](db[_0x50bb('0x2e')][_0x50bb('0x2f')],function(_0x5cfdd5){return{'name':_0x5cfdd5[_0x50bb('0x30')],'type':_0x5cfdd5[_0x50bb('0x31')][_0x50bb('0x32')]};});_0xc38da5['model']=_[_0x50bb('0x2d')](_0x3fd5f6,_0x50bb('0x2a'));_0xc38da5[_0x50bb('0x33')]=_[_0x50bb('0x34')](_0x560b07[_0x50bb('0x33')]);_0xc38da5[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0xc38da5[_0x50bb('0x37')],_0xc38da5[_0x50bb('0x33')]);_0x1a62fb[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0xc38da5['model'],qs[_0x50bb('0x39')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x39')]));_0x1a62fb[_0x50bb('0x38')]=_0x1a62fb[_0x50bb('0x38')][_0x50bb('0x3a')]?_0x1a62fb['attributes']:_0xc38da5['model'];if(!_0x560b07[_0x50bb('0x33')]['hasOwnProperty'](_0x50bb('0x3b'))){_0x1a62fb[_0x50bb('0x3c')]=qs[_0x50bb('0x3c')](_0x560b07[_0x50bb('0x33')][_0x50bb('0x3c')]);_0x1a62fb['offset']=qs[_0x50bb('0x1c')](_0x560b07['query'][_0x50bb('0x1c')]);}_0x1a62fb[_0x50bb('0x3d')]=qs[_0x50bb('0x3e')](_0x560b07['query']['sort']);_0x1a62fb[_0x50bb('0x3f')]=qs[_0x50bb('0x35')](_[_0x50bb('0x40')](_0x560b07[_0x50bb('0x33')],_0xc38da5['filters']),_0x3fd5f6);if(_0x560b07[_0x50bb('0x33')]['filter']){_0x1a62fb['where']=_[_0x50bb('0x41')](_0x1a62fb['where'],{'$or':_[_0x50bb('0x2d')](_0x3fd5f6,function(_0x3d94b8){if(_0x3d94b8[_0x50bb('0x31')]!==_0x50bb('0x42')){var _0x3a9fe4={};_0x3a9fe4[_0x3d94b8[_0x50bb('0x2a')]]={'$like':'%'+_0x560b07[_0x50bb('0x33')][_0x50bb('0x43')]+'%'};return _0x3a9fe4;}})});}_0x1a62fb=_[_0x50bb('0x41')]({},_0x1a62fb,_0x560b07[_0x50bb('0x44')]);var _0x594f16={'where':_0x1a62fb['where']};return db[_0x50bb('0x2e')][_0x50bb('0x1e')](_0x594f16)[_0x50bb('0x24')](function(_0x1d929d){_0xb3c3ba['count']=_0x1d929d;if(_0x560b07[_0x50bb('0x33')]['includeAll']){_0x1a62fb[_0x50bb('0x45')]=[{'all':!![]}];}return db[_0x50bb('0x2e')][_0x50bb('0x46')](_0x1a62fb);})[_0x50bb('0x24')](function(_0x1c438b){_0xb3c3ba[_0x50bb('0x47')]=_0x1c438b;return _0xb3c3ba;})[_0x50bb('0x24')](respondWithFilteredResult(_0x13dc3c,_0x1a62fb))[_0x50bb('0x48')](handleError(_0x13dc3c,null));};exports[_0x50bb('0x49')]=function(_0x46c1c3,_0x349474){var _0x24e375={'raw':!![],'where':{'id':_0x46c1c3[_0x50bb('0x4a')]['id']}},_0x85b0ff={};_0x85b0ff[_0x50bb('0x37')]=_[_0x50bb('0x34')](db['VoiceMail'][_0x50bb('0x2f')]);_0x85b0ff['query']=_[_0x50bb('0x34')](_0x46c1c3[_0x50bb('0x33')]);_0x85b0ff[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],_0x85b0ff[_0x50bb('0x33')]);_0x24e375[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0x85b0ff[_0x50bb('0x37')],qs[_0x50bb('0x39')](_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x39')]));_0x24e375[_0x50bb('0x38')]=_0x24e375[_0x50bb('0x38')]['length']?_0x24e375[_0x50bb('0x38')]:_0x85b0ff['model'];if(_0x46c1c3[_0x50bb('0x33')][_0x50bb('0x4b')]){_0x24e375[_0x50bb('0x45')]=[{'all':!![]}];}_0x24e375=_[_0x50bb('0x41')]({},_0x24e375,_0x46c1c3[_0x50bb('0x44')]);return db[_0x50bb('0x2e')][_0x50bb('0x4c')](_0x24e375)[_0x50bb('0x24')](handleEntityNotFound(_0x349474,null))['then'](respondWithResult(_0x349474,null))[_0x50bb('0x48')](handleError(_0x349474,null));};exports[_0x50bb('0x4d')]=function(_0xf52a22,_0x13afe2){return db[_0x50bb('0x2e')]['create'](_0xf52a22[_0x50bb('0x4e')],{})[_0x50bb('0x24')](function(_0x2a411d){var _0x154ff8=_0xf52a22[_0x50bb('0x4f')]['get']({'plain':!![]});if(!_0x154ff8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x154ff8[_0x50bb('0x50')]==='user'){var _0x357d08=_0x2a411d['get']({'plain':!![]});var _0x4316e4=_0x50bb('0x27');return db[_0x50bb('0x51')]['find']({'where':{'name':_0x4316e4,'userProfileId':_0x154ff8[_0x50bb('0x52')]},'raw':!![]})[_0x50bb('0x24')](function(_0x588dfe){if(_0x588dfe&&_0x588dfe[_0x50bb('0x53')]===0x0){return db[_0x50bb('0x54')][_0x50bb('0x4d')]({'name':_0x357d08[_0x50bb('0x2a')],'resourceId':_0x357d08['id'],'type':_0x588dfe['name'],'sectionId':_0x588dfe['id']},{})[_0x50bb('0x24')](function(){return _0x2a411d;});}else{return _0x2a411d;}})[_0x50bb('0x48')](function(_0x2e0032){logger[_0x50bb('0x28')](_0x50bb('0x55'),_0x2e0032);throw _0x2e0032;});}return _0x2a411d;})['then'](respondWithResult(_0x13afe2,0xc9))[_0x50bb('0x48')](handleError(_0x13afe2,null));};exports['update']=function(_0x38a775,_0x50216f){if(_0x38a775['body']['id']){delete _0x38a775[_0x50bb('0x4e')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x38a775[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x50216f,null))[_0x50bb('0x24')](saveUpdates(_0x38a775[_0x50bb('0x4e')],null))[_0x50bb('0x24')](respondWithResult(_0x50216f,null))[_0x50bb('0x48')](handleError(_0x50216f,null));};exports[_0x50bb('0x25')]=function(_0x1408fa,_0x57d749){return db['VoiceMail'][_0x50bb('0x4c')]({'where':{'id':_0x1408fa[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x57d749,null))[_0x50bb('0x24')](removeEntity(_0x57d749,null))[_0x50bb('0x48')](handleError(_0x57d749,null));};exports[_0x50bb('0x56')]=function(_0x287bc7,_0x4bf426,_0x3be83b){return db[_0x50bb('0x2e')][_0x50bb('0x57')]({'where':{'id':_0x287bc7[_0x50bb('0x4a')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x4bf426,null))['then'](function(_0x33ebe6){var _0x1d8b85;var _0x1da5cd={},_0x507f26={};_0x507f26[_0x50bb('0x37')]=_['keys'](db[_0x50bb('0x58')]['rawAttributes']);_0x507f26['query']=_[_0x50bb('0x34')](_0x287bc7[_0x50bb('0x33')]);_0x507f26[_0x50bb('0x35')]=_[_0x50bb('0x36')](_0x507f26[_0x50bb('0x37')],_0x507f26[_0x50bb('0x33')]);_0x1da5cd[_0x50bb('0x38')]=_[_0x50bb('0x36')](_0x507f26[_0x50bb('0x37')],qs[_0x50bb('0x39')](_0x287bc7[_0x50bb('0x33')]['fields']));_0x1da5cd[_0x50bb('0x38')]=_0x1da5cd['attributes'][_0x50bb('0x3a')]?_0x1da5cd[_0x50bb('0x38')]:_0x507f26['model'];if(!_0x287bc7[_0x50bb('0x33')][_0x50bb('0x59')](_0x50bb('0x3b'))){_0x1da5cd[_0x50bb('0x3c')]=qs[_0x50bb('0x3c')](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x3c')]);_0x1da5cd[_0x50bb('0x1c')]=qs['offset'](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x1c')]);}_0x1da5cd[_0x50bb('0x3d')]=qs['sort'](_0x287bc7[_0x50bb('0x33')][_0x50bb('0x3e')]);_0x1da5cd[_0x50bb('0x3f')]=qs[_0x50bb('0x35')](_[_0x50bb('0x40')](_0x287bc7[_0x50bb('0x33')],_0x507f26['filters']));if(_0x287bc7[_0x50bb('0x33')][_0x50bb('0x43')]){_0x1da5cd[_0x50bb('0x3f')]=_[_0x50bb('0x41')](_0x1da5cd[_0x50bb('0x3f')],{'$or':_[_0x50bb('0x2d')](_0x1da5cd['attributes'],function(_0x40257b){var _0xa85833={};_0xa85833[_0x40257b]={'$like':'%'+_0x287bc7[_0x50bb('0x33')][_0x50bb('0x43')]+'%'};return _0xa85833;})});}_0x1da5cd[_0x50bb('0x3f')]=_[_0x50bb('0x41')](_0x1da5cd[_0x50bb('0x3f')],{'mailboxuser':_0x33ebe6[_0x50bb('0x5a')]});_0x1da5cd=_[_0x50bb('0x41')]({},_0x1da5cd,_0x287bc7['options']);return db[_0x50bb('0x58')][_0x50bb('0x5b')](_0x1da5cd)[_0x50bb('0x24')](respondWithFilteredResult(_0x4bf426,_0x1da5cd));})[_0x50bb('0x48')](handleError(_0x4bf426,null));}; \ No newline at end of file +var _0x4483=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','Voicemails','UserProfileResource','error','name','index','VoiceMail','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','find','getMessages','findOne','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4e07c6,_0x5d8c10){var _0x37023e=function(_0x339588){while(--_0x339588){_0x4e07c6['push'](_0x4e07c6['shift']());}};_0x37023e(++_0x5d8c10);}(_0x4483,0x1a3));var _0x3448=function(_0x5b8ab9,_0x2ca073){_0x5b8ab9=_0x5b8ab9-0x0;var _0x5a2e9f=_0x4483[_0x5b8ab9];return _0x5a2e9f;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x298ae6,_0x38fbb1){_0x38fbb1=_0x38fbb1||0xcc;return function(_0x5f52bd){if(_0x5f52bd){return _0x298ae6[_0x3448('0x1b')](_0x38fbb1);}return _0x298ae6[_0x3448('0x1c')](_0x38fbb1)[_0x3448('0x1d')]();};}function respondWithResult(_0x549306,_0x14104c){_0x14104c=_0x14104c||0xc8;return function(_0x2952a6){if(_0x2952a6){return _0x549306['status'](_0x14104c)[_0x3448('0x1e')](_0x2952a6);}};}function respondWithFilteredResult(_0x2c2da6,_0x46784f){return function(_0x4fc70f){if(_0x4fc70f){var _0x472518=typeof _0x46784f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x46784f[_0x3448('0x21')]===_0x3448('0x20');var _0x1b2081=_0x4fc70f[_0x3448('0x22')];var _0x425514=_0x472518?0x0:_0x46784f['offset'];var _0x1658cd=_0x472518?_0x4fc70f['count']:_0x46784f['offset']+_0x46784f['limit'];var _0x1e9774;if(_0x1658cd>=_0x1b2081){_0x1658cd=_0x1b2081;_0x1e9774=0xc8;}else{_0x1e9774=0xce;}_0x2c2da6[_0x3448('0x1c')](_0x1e9774);return _0x2c2da6[_0x3448('0x23')]('Content-Range',_0x425514+'-'+_0x1658cd+'/'+_0x1b2081)[_0x3448('0x1e')](_0x4fc70f);}return null;};}function patchUpdates(_0x392c8d){return function(_0x317de6){try{jsonpatch[_0x3448('0x24')](_0x317de6,_0x392c8d,!![]);}catch(_0x29a15a){return BPromise[_0x3448('0x25')](_0x29a15a);}return _0x317de6['save']();};}function saveUpdates(_0x54c7ee,_0x4e6716){return function(_0x1b3d5a){if(_0x1b3d5a){return _0x1b3d5a[_0x3448('0x26')](_0x54c7ee)['then'](function(_0x5b1f7c){return _0x5b1f7c;});}return null;};}function removeEntity(_0x2dcd40,_0x4371d6){return function(_0x22ad5c){if(_0x22ad5c){return _0x22ad5c[_0x3448('0x27')]()[_0x3448('0x28')](function(){var _0x566ff5=_0x22ad5c[_0x3448('0x29')]({'plain':!![]});var _0x1b5c49=_0x3448('0x2a');return db[_0x3448('0x2b')][_0x3448('0x27')]({'where':{'type':_0x1b5c49,'resourceId':_0x566ff5['id']}})['then'](function(){return _0x22ad5c;});})[_0x3448('0x28')](function(){_0x2dcd40[_0x3448('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a479,_0x12c22d){return function(_0x310912){if(!_0x310912){_0x19a479[_0x3448('0x1b')](0x194);}return _0x310912;};}function handleError(_0x38fab2,_0x35f026){_0x35f026=_0x35f026||0x1f4;return function(_0x31be64){logger[_0x3448('0x2c')](_0x31be64['stack']);if(_0x31be64[_0x3448('0x2d')]){delete _0x31be64[_0x3448('0x2d')];}_0x38fab2[_0x3448('0x1c')](_0x35f026)['send'](_0x31be64);};}exports[_0x3448('0x2e')]=function(_0x5dfdf7,_0x486f2c){var _0x493898={},_0x52fb48={},_0xff6513={'count':0x0,'rows':[]};var _0x5e96f0=_['map'](db[_0x3448('0x2f')][_0x3448('0x30')],function(_0x32121c){return{'name':_0x32121c[_0x3448('0x31')],'type':_0x32121c['type'][_0x3448('0x32')]};});_0x52fb48[_0x3448('0x33')]=_[_0x3448('0x34')](_0x5e96f0,'name');_0x52fb48[_0x3448('0x35')]=_[_0x3448('0x36')](_0x5dfdf7['query']);_0x52fb48['filters']=_[_0x3448('0x37')](_0x52fb48[_0x3448('0x33')],_0x52fb48[_0x3448('0x35')]);_0x493898[_0x3448('0x38')]=_['intersection'](_0x52fb48[_0x3448('0x33')],qs[_0x3448('0x39')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x39')]));_0x493898['attributes']=_0x493898[_0x3448('0x38')][_0x3448('0x3a')]?_0x493898['attributes']:_0x52fb48[_0x3448('0x33')];if(!_0x5dfdf7[_0x3448('0x35')][_0x3448('0x3b')](_0x3448('0x3c'))){_0x493898[_0x3448('0x21')]=qs[_0x3448('0x21')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x21')]);_0x493898[_0x3448('0x1f')]=qs['offset'](_0x5dfdf7['query'][_0x3448('0x1f')]);}_0x493898['order']=qs[_0x3448('0x3d')](_0x5dfdf7[_0x3448('0x35')][_0x3448('0x3d')]);_0x493898[_0x3448('0x3e')]=qs['filters'](_[_0x3448('0x3f')](_0x5dfdf7[_0x3448('0x35')],_0x52fb48[_0x3448('0x40')]),_0x5e96f0);if(_0x5dfdf7[_0x3448('0x35')][_0x3448('0x41')]){_0x493898[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x493898[_0x3448('0x3e')],{'$or':_[_0x3448('0x34')](_0x5e96f0,function(_0x5a58c5){if(_0x5a58c5[_0x3448('0x43')]!==_0x3448('0x44')){var _0x322b46={};_0x322b46[_0x5a58c5[_0x3448('0x2d')]]={'$like':'%'+_0x5dfdf7[_0x3448('0x35')]['filter']+'%'};return _0x322b46;}})});}_0x493898=_[_0x3448('0x42')]({},_0x493898,_0x5dfdf7[_0x3448('0x45')]);var _0x4a6e5={'where':_0x493898[_0x3448('0x3e')]};return db[_0x3448('0x2f')][_0x3448('0x22')](_0x4a6e5)[_0x3448('0x28')](function(_0x3db5f1){_0xff6513['count']=_0x3db5f1;if(_0x5dfdf7[_0x3448('0x35')][_0x3448('0x46')]){_0x493898[_0x3448('0x47')]=[{'all':!![]}];}return db['VoiceMail'][_0x3448('0x48')](_0x493898);})[_0x3448('0x28')](function(_0x21f989){_0xff6513[_0x3448('0x49')]=_0x21f989;return _0xff6513;})[_0x3448('0x28')](respondWithFilteredResult(_0x486f2c,_0x493898))[_0x3448('0x4a')](handleError(_0x486f2c,null));};exports[_0x3448('0x4b')]=function(_0x4f54e7,_0x2165c7){var _0x46b172={'raw':!![],'where':{'id':_0x4f54e7[_0x3448('0x4c')]['id']}},_0x1e7fb7={};_0x1e7fb7[_0x3448('0x33')]=_[_0x3448('0x36')](db['VoiceMail'][_0x3448('0x30')]);_0x1e7fb7['query']=_['keys'](_0x4f54e7[_0x3448('0x35')]);_0x1e7fb7[_0x3448('0x40')]=_['intersection'](_0x1e7fb7[_0x3448('0x33')],_0x1e7fb7[_0x3448('0x35')]);_0x46b172['attributes']=_[_0x3448('0x37')](_0x1e7fb7[_0x3448('0x33')],qs['fields'](_0x4f54e7[_0x3448('0x35')][_0x3448('0x39')]));_0x46b172[_0x3448('0x38')]=_0x46b172[_0x3448('0x38')][_0x3448('0x3a')]?_0x46b172[_0x3448('0x38')]:_0x1e7fb7[_0x3448('0x33')];if(_0x4f54e7['query']['includeAll']){_0x46b172[_0x3448('0x47')]=[{'all':!![]}];}_0x46b172=_[_0x3448('0x42')]({},_0x46b172,_0x4f54e7[_0x3448('0x45')]);return db[_0x3448('0x2f')]['find'](_0x46b172)[_0x3448('0x28')](handleEntityNotFound(_0x2165c7,null))[_0x3448('0x28')](respondWithResult(_0x2165c7,null))[_0x3448('0x4a')](handleError(_0x2165c7,null));};exports[_0x3448('0x4d')]=function(_0x363374,_0x5d942b){return db[_0x3448('0x2f')]['create'](_0x363374[_0x3448('0x4e')],{})[_0x3448('0x28')](function(_0x5c8e42){var _0x479b79=_0x363374[_0x3448('0x4f')][_0x3448('0x29')]({'plain':!![]});if(!_0x479b79)throw new Error(_0x3448('0x50'));if(_0x479b79[_0x3448('0x51')]===_0x3448('0x4f')){var _0xc769e1=_0x5c8e42['get']({'plain':!![]});var _0x23dbda=_0x3448('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x23dbda,'userProfileId':_0x479b79[_0x3448('0x52')]},'raw':!![]})[_0x3448('0x28')](function(_0x4d20ba){if(_0x4d20ba&&_0x4d20ba['autoAssociation']===0x0){return db[_0x3448('0x2b')][_0x3448('0x4d')]({'name':_0xc769e1[_0x3448('0x2d')],'resourceId':_0xc769e1['id'],'type':_0x4d20ba[_0x3448('0x2d')],'sectionId':_0x4d20ba['id']},{})[_0x3448('0x28')](function(){return _0x5c8e42;});}else{return _0x5c8e42;}})[_0x3448('0x4a')](function(_0x2aea70){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2aea70);throw _0x2aea70;});}return _0x5c8e42;})['then'](respondWithResult(_0x5d942b,0xc9))[_0x3448('0x4a')](handleError(_0x5d942b,null));};exports[_0x3448('0x26')]=function(_0x5cf3fe,_0x35ce1d){if(_0x5cf3fe[_0x3448('0x4e')]['id']){delete _0x5cf3fe['body']['id'];}return db[_0x3448('0x2f')][_0x3448('0x53')]({'where':{'id':_0x5cf3fe['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x35ce1d,null))[_0x3448('0x28')](saveUpdates(_0x5cf3fe[_0x3448('0x4e')],null))[_0x3448('0x28')](respondWithResult(_0x35ce1d,null))[_0x3448('0x4a')](handleError(_0x35ce1d,null));};exports[_0x3448('0x27')]=function(_0xeda861,_0x1b7d87){return db[_0x3448('0x2f')]['find']({'where':{'id':_0xeda861[_0x3448('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b7d87,null))[_0x3448('0x28')](removeEntity(_0x1b7d87,null))[_0x3448('0x4a')](handleError(_0x1b7d87,null));};exports[_0x3448('0x54')]=function(_0x58422,_0x1cbeae,_0x332e02){return db['VoiceMail'][_0x3448('0x55')]({'where':{'id':_0x58422['params']['id']}})[_0x3448('0x28')](handleEntityNotFound(_0x1cbeae,null))[_0x3448('0x28')](function(_0x3bf4d2){var _0x5c9320;var _0x3ead11={},_0x4e381f={};_0x4e381f['model']=_[_0x3448('0x36')](db[_0x3448('0x56')][_0x3448('0x30')]);_0x4e381f['query']=_[_0x3448('0x36')](_0x58422[_0x3448('0x35')]);_0x4e381f[_0x3448('0x40')]=_[_0x3448('0x37')](_0x4e381f[_0x3448('0x33')],_0x4e381f[_0x3448('0x35')]);_0x3ead11[_0x3448('0x38')]=_[_0x3448('0x37')](_0x4e381f[_0x3448('0x33')],qs[_0x3448('0x39')](_0x58422[_0x3448('0x35')][_0x3448('0x39')]));_0x3ead11[_0x3448('0x38')]=_0x3ead11[_0x3448('0x38')][_0x3448('0x3a')]?_0x3ead11[_0x3448('0x38')]:_0x4e381f[_0x3448('0x33')];if(!_0x58422[_0x3448('0x35')]['hasOwnProperty'](_0x3448('0x3c'))){_0x3ead11['limit']=qs[_0x3448('0x21')](_0x58422['query'][_0x3448('0x21')]);_0x3ead11[_0x3448('0x1f')]=qs['offset'](_0x58422[_0x3448('0x35')][_0x3448('0x1f')]);}_0x3ead11['order']=qs['sort'](_0x58422[_0x3448('0x35')]['sort']);_0x3ead11['where']=qs[_0x3448('0x40')](_[_0x3448('0x3f')](_0x58422['query'],_0x4e381f['filters']));if(_0x58422[_0x3448('0x35')][_0x3448('0x41')]){_0x3ead11[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x3ead11[_0x3448('0x3e')],{'$or':_[_0x3448('0x34')](_0x3ead11[_0x3448('0x38')],function(_0x10749d){var _0x2cf3ef={};_0x2cf3ef[_0x10749d]={'$like':'%'+_0x58422[_0x3448('0x35')][_0x3448('0x41')]+'%'};return _0x2cf3ef;})});}_0x3ead11[_0x3448('0x3e')]=_[_0x3448('0x42')](_0x3ead11[_0x3448('0x3e')],{'mailboxuser':_0x3bf4d2['mailbox']});_0x3ead11=_[_0x3448('0x42')]({},_0x3ead11,_0x58422[_0x3448('0x45')]);return db['VoiceMailMessage'][_0x3448('0x57')](_0x3ead11)[_0x3448('0x28')](respondWithFilteredResult(_0x1cbeae,_0x3ead11));})['catch'](handleError(_0x1cbeae,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 7f7b438..4ee16fa 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 _0x20dc=['path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','lodash','util','moment','bluebird','request-promise'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x20dc,0x1bb));var _0xc20d=function(_0x596e95,_0x489b4c){_0x596e95=_0x596e95-0x0;var _0xbf179d=_0x20dc[_0x596e95];return _0xbf179d;};'use strict';var _=require(_0xc20d('0x0'));var util=require(_0xc20d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc20d('0x2'));var BPromise=require(_0xc20d('0x3'));var rp=require(_0xc20d('0x4'));var fs=require('fs');var path=require(_0xc20d('0x5'));var rimraf=require(_0xc20d('0x6'));var config=require(_0xc20d('0x7'));var attributes=require(_0xc20d('0x8'));module[_0xc20d('0x9')]=function(_0x192874,_0x5753fa){return _0x192874[_0xc20d('0xa')](_0xc20d('0xb'),attributes,{'tableName':_0xc20d('0xc'),'paranoid':![],'indexes':[{'name':_0xc20d('0xd'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x80b5=['./voiceMail.attributes','exports','VoiceMail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x330a8c,_0x5833c8){var _0x74cd01=function(_0x38c7b6){while(--_0x38c7b6){_0x330a8c['push'](_0x330a8c['shift']());}};_0x74cd01(++_0x5833c8);}(_0x80b5,0x1d6));var _0x580b=function(_0x481df5,_0x216652){_0x481df5=_0x481df5-0x0;var _0x32726e=_0x80b5[_0x481df5];return _0x32726e;};'use strict';var _=require(_0x580b('0x0'));var util=require(_0x580b('0x1'));var logger=require(_0x580b('0x2'))(_0x580b('0x3'));var moment=require(_0x580b('0x4'));var BPromise=require(_0x580b('0x5'));var rp=require(_0x580b('0x6'));var fs=require('fs');var path=require(_0x580b('0x7'));var rimraf=require(_0x580b('0x8'));var config=require(_0x580b('0x9'));var attributes=require(_0x580b('0xa'));module[_0x580b('0xb')]=function(_0x41d66b,_0x525d85){return _0x41d66b['define'](_0x580b('0xc'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x580b('0xd'),'fields':[_0x580b('0xe'),_0x580b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index b301eea..9f23a04 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 _0x21bf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','VoiceMail,\x20%s,\x20%s','catch','lodash','util'];(function(_0x386a70,_0x53478b){var _0xe9b1dc=function(_0x363f09){while(--_0x363f09){_0x386a70['push'](_0x386a70['shift']());}};_0xe9b1dc(++_0x53478b);}(_0x21bf,0xbb));var _0xf21b=function(_0xe2b013,_0x5790ce){_0xe2b013=_0xe2b013-0x0;var _0x37e2cc=_0x21bf[_0xe2b013];return _0x37e2cc;};'use strict';var _=require(_0xf21b('0x0'));var util=require(_0xf21b('0x1'));var moment=require(_0xf21b('0x2'));var BPromise=require(_0xf21b('0x3'));var rs=require(_0xf21b('0x4'));var fs=require('fs');var Redis=require(_0xf21b('0x5'));var db=require(_0xf21b('0x6'))['db'];var utils=require(_0xf21b('0x7'));var logger=require(_0xf21b('0x8'))('rpc');var config=require(_0xf21b('0x9'));var jayson=require(_0xf21b('0xa'));var client=jayson[_0xf21b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31c613,_0x334315,_0x1d95c3){return new BPromise(function(_0x5c3f50,_0x123ce5){return client[_0xf21b('0xc')](_0x31c613,_0x1d95c3)['then'](function(_0x34c2d3){logger[_0xf21b('0xd')]('VoiceMail,\x20%s,\x20%s',_0x334315,_0xf21b('0xe'));logger['debug'](_0xf21b('0xf'),_0x334315,_0xf21b('0xe'),JSON['stringify'](_0x34c2d3));if(_0x34c2d3[_0xf21b('0x10')]){if(_0x34c2d3['error'][_0xf21b('0x11')]===0x1f4){logger[_0xf21b('0x10')]('VoiceMail,\x20%s,\x20%s',_0x334315,_0x34c2d3[_0xf21b('0x10')][_0xf21b('0x12')]);return _0x123ce5(_0x34c2d3[_0xf21b('0x10')][_0xf21b('0x12')]);}logger['error'](_0xf21b('0x13'),_0x334315,_0x34c2d3[_0xf21b('0x10')][_0xf21b('0x12')]);return _0x5c3f50(_0x34c2d3[_0xf21b('0x10')][_0xf21b('0x12')]);}else{logger[_0xf21b('0xd')](_0xf21b('0x13'),_0x334315,_0xf21b('0xe'));_0x5c3f50(_0x34c2d3['result'][_0xf21b('0x12')]);}})[_0xf21b('0x14')](function(_0x161fd8){logger[_0xf21b('0x10')](_0xf21b('0x13'),_0x334315,_0x161fd8);_0x123ce5(_0x161fd8);});});} \ No newline at end of file +var _0xf52d=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash'];(function(_0x207d3d,_0x4b2103){var _0x8c2e5d=function(_0x56784b){while(--_0x56784b){_0x207d3d['push'](_0x207d3d['shift']());}};_0x8c2e5d(++_0x4b2103);}(_0xf52d,0xd1));var _0xdf52=function(_0x4e0148,_0x5021b4){_0x4e0148=_0x4e0148-0x0;var _0x3f3e5e=_0xf52d[_0x4e0148];return _0x3f3e5e;};'use strict';var _=require(_0xdf52('0x0'));var util=require(_0xdf52('0x1'));var moment=require(_0xdf52('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf52('0x3'));var fs=require('fs');var Redis=require(_0xdf52('0x4'));var db=require(_0xdf52('0x5'))['db'];var utils=require(_0xdf52('0x6'));var logger=require('../../config/logger')(_0xdf52('0x7'));var config=require(_0xdf52('0x8'));var jayson=require(_0xdf52('0x9'));var client=jayson['client'][_0xdf52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe43033,_0x417b98,_0x2efde6){return new BPromise(function(_0x193b5f,_0x4fc263){return client['request'](_0xe43033,_0x2efde6)[_0xdf52('0xb')](function(_0x4031df){logger['info'](_0xdf52('0xc'),_0x417b98,_0xdf52('0xd'));logger[_0xdf52('0xe')](_0xdf52('0xf'),_0x417b98,_0xdf52('0xd'),JSON[_0xdf52('0x10')](_0x4031df));if(_0x4031df[_0xdf52('0x11')]){if(_0x4031df['error']['code']===0x1f4){logger[_0xdf52('0x11')](_0xdf52('0xc'),_0x417b98,_0x4031df['error'][_0xdf52('0x12')]);return _0x4fc263(_0x4031df['error'][_0xdf52('0x12')]);}logger['error'](_0xdf52('0xc'),_0x417b98,_0x4031df[_0xdf52('0x11')][_0xdf52('0x12')]);return _0x193b5f(_0x4031df[_0xdf52('0x11')][_0xdf52('0x12')]);}else{logger[_0xdf52('0x13')]('VoiceMail,\x20%s,\x20%s',_0x417b98,_0xdf52('0xd'));_0x193b5f(_0x4031df[_0xdf52('0x14')]['message']);}})['catch'](function(_0x4fd3d1){logger[_0xdf52('0x11')]('VoiceMail,\x20%s,\x20%s',_0x417b98,_0x4fd3d1);_0x4fc263(_0x4fd3d1);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 2bd80f1..1de0e31 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 _0x02e5=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','show','download','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x98e242,_0x1d25a0){var _0x592809=function(_0xebab3a){while(--_0xebab3a){_0x98e242['push'](_0x98e242['shift']());}};_0x592809(++_0x1d25a0);}(_0x02e5,0xe3));var _0x502e=function(_0x5999f3,_0x2cd0bc){_0x5999f3=_0x5999f3-0x0;var _0x341f51=_0x02e5[_0x5999f3];return _0x341f51;};'use strict';var multer=require(_0x502e('0x0'));var util=require(_0x502e('0x1'));var path=require('path');var timeout=require(_0x502e('0x2'));var express=require(_0x502e('0x3'));var router=express[_0x502e('0x4')]();var fs_extra=require(_0x502e('0x5'));var auth=require(_0x502e('0x6'));var interaction=require(_0x502e('0x7'));var config=require(_0x502e('0x8'));var controller=require(_0x502e('0x9'));router[_0x502e('0xa')]('/',auth[_0x502e('0xb')](),controller['index']);router[_0x502e('0xa')]('/:id',auth[_0x502e('0xb')](),controller[_0x502e('0xc')]);router[_0x502e('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x502e('0xd')]);router[_0x502e('0xe')]('/',auth['isAuthenticated'](),controller[_0x502e('0xf')]);router[_0x502e('0x10')](_0x502e('0x11'),auth[_0x502e('0xb')](),controller[_0x502e('0x12')]);router[_0x502e('0x13')](_0x502e('0x11'),auth[_0x502e('0xb')](),controller[_0x502e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x04dc=['delete','destroy','multer','util','path','Router','fs-extra','get','index','show','isAuthenticated','download','post','put','/:id','update'];(function(_0xeb7891,_0x4771f7){var _0x11cc19=function(_0x768961){while(--_0x768961){_0xeb7891['push'](_0xeb7891['shift']());}};_0x11cc19(++_0x4771f7);}(_0x04dc,0x1b2));var _0xc04d=function(_0x1a4c27,_0x5a4b45){_0x1a4c27=_0x1a4c27-0x0;var _0x578d9=_0x04dc[_0x1a4c27];return _0x578d9;};'use strict';var multer=require(_0xc04d('0x0'));var util=require(_0xc04d('0x1'));var path=require(_0xc04d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc04d('0x3')]();var fs_extra=require(_0xc04d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xc04d('0x5')]('/',auth['isAuthenticated'](),controller[_0xc04d('0x6')]);router[_0xc04d('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xc04d('0x7')]);router[_0xc04d('0x5')]('/:id/download',auth[_0xc04d('0x8')](),controller[_0xc04d('0x9')]);router[_0xc04d('0xa')]('/',auth[_0xc04d('0x8')](),controller['create']);router[_0xc04d('0xb')](_0xc04d('0xc'),auth[_0xc04d('0x8')](),controller[_0xc04d('0xd')]);router[_0xc04d('0xe')]('/:id',auth[_0xc04d('0x8')](),controller[_0xc04d('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 956b06d..a52f3f3 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 _0x9269=['VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal','sequelize','exports'];(function(_0x1e1800,_0x481d01){var _0x11dcea=function(_0x2d0436){while(--_0x2d0436){_0x1e1800['push'](_0x1e1800['shift']());}};_0x11dcea(++_0x481d01);}(_0x9269,0x1c9));var _0x9926=function(_0x40750d,_0x593094){_0x40750d=_0x40750d-0x0;var _0x42d026=_0x9269[_0x40750d];return _0x42d026;};'use strict';var Sequelize=require(_0x9926('0x0'));module[_0x9926('0x1')]={'name':{'type':Sequelize[_0x9926('0x2')],'get':function(_0x32cfc0){return this[_0x9926('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x9926('0x5')](_0x9926('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x9926('0x4')],'defaultValue':''},'stamp':{'type':_0x9926('0x7'),'defaultValue':Sequelize[_0x9926('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x598f=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal'];(function(_0x53a51b,_0x4c164d){var _0x17b065=function(_0xabc64e){while(--_0xabc64e){_0x53a51b['push'](_0x53a51b['shift']());}};_0x17b065(++_0x4c164d);}(_0x598f,0x10f));var _0xf598=function(_0x1ecd32,_0x507695){_0x1ecd32=_0x1ecd32-0x0;var _0x3fcbe5=_0x598f[_0x1ecd32];return _0x3fcbe5;};'use strict';var Sequelize=require(_0xf598('0x0'));module['exports']={'name':{'type':Sequelize[_0xf598('0x1')],'get':function(_0x44828e){return this[_0xf598('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xf598('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xf598('0x5')](_0xf598('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf598('0x4')],'defaultValue':''},'stamp':{'type':_0xf598('0x7'),'defaultValue':Sequelize[_0xf598('0x8')](_0xf598('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index e8b9cc9..ba25c50 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 _0x5222=['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/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','show','params','keys','options','find','create','body','catch','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x355c8b,_0x51ecf6){var _0x1bd1ac=function(_0x24e7f2){while(--_0x24e7f2){_0x355c8b['push'](_0x355c8b['shift']());}};_0x1bd1ac(++_0x51ecf6);}(_0x5222,0x14c));var _0x2522=function(_0x641f18,_0x2919e8){_0x641f18=_0x641f18-0x0;var _0x16eefe=_0x5222[_0x641f18];return _0x16eefe;};'use strict';var emlformat=require(_0x2522('0x0'));var rimraf=require(_0x2522('0x1'));var zipdir=require(_0x2522('0x2'));var jsonpatch=require(_0x2522('0x3'));var rp=require(_0x2522('0x4'));var moment=require(_0x2522('0x5'));var BPromise=require(_0x2522('0x6'));var Mustache=require(_0x2522('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2522('0x8'));var csv=require(_0x2522('0x9'));var ejs=require(_0x2522('0xa'));var fs=require('fs');var fs_extra=require(_0x2522('0xb'));var _=require(_0x2522('0xc'));var squel=require(_0x2522('0xd'));var crypto=require(_0x2522('0xe'));var jsforce=require(_0x2522('0xf'));var deskjs=require(_0x2522('0x10'));var toCsv=require(_0x2522('0x9'));var querystring=require(_0x2522('0x11'));var Papa=require(_0x2522('0x12'));var Redis=require(_0x2522('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2522('0x14'));var hardwareService=require(_0x2522('0x15'));var logger=require(_0x2522('0x16'))('api');var utils=require(_0x2522('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2522('0x18'));var db=require(_0x2522('0x19'))['db'];function respondWithStatusCode(_0xf3dbf8,_0x528b7c){_0x528b7c=_0x528b7c||0xcc;return function(_0x5cf5bf){if(_0x5cf5bf){return _0xf3dbf8[_0x2522('0x1a')](_0x528b7c);}return _0xf3dbf8[_0x2522('0x1b')](_0x528b7c)[_0x2522('0x1c')]();};}function respondWithResult(_0x75dd36,_0x32c0d5){_0x32c0d5=_0x32c0d5||0xc8;return function(_0x1466b1){if(_0x1466b1){return _0x75dd36[_0x2522('0x1b')](_0x32c0d5)['json'](_0x1466b1);}};}function respondWithFilteredResult(_0x548d4a,_0x4f6a87){return function(_0x1885e3){if(_0x1885e3){var _0x88fe30=typeof _0x4f6a87[_0x2522('0x1d')]===_0x2522('0x1e')&&typeof _0x4f6a87[_0x2522('0x1f')]===_0x2522('0x1e');var _0x346650=_0x1885e3[_0x2522('0x20')];var _0x3524f1=_0x88fe30?0x0:_0x4f6a87[_0x2522('0x1d')];var _0x4e35ef=_0x88fe30?_0x1885e3[_0x2522('0x20')]:_0x4f6a87['offset']+_0x4f6a87[_0x2522('0x1f')];var _0x3be932;if(_0x4e35ef>=_0x346650){_0x4e35ef=_0x346650;_0x3be932=0xc8;}else{_0x3be932=0xce;}_0x548d4a[_0x2522('0x1b')](_0x3be932);return _0x548d4a[_0x2522('0x21')](_0x2522('0x22'),_0x3524f1+'-'+_0x4e35ef+'/'+_0x346650)[_0x2522('0x23')](_0x1885e3);}return null;};}function patchUpdates(_0x36697f){return function(_0x53c0d6){try{jsonpatch['apply'](_0x53c0d6,_0x36697f,!![]);}catch(_0x190f11){return BPromise[_0x2522('0x24')](_0x190f11);}return _0x53c0d6[_0x2522('0x25')]();};}function saveUpdates(_0x10a399,_0x3a4aad){return function(_0x13d626){if(_0x13d626){return _0x13d626[_0x2522('0x26')](_0x10a399)[_0x2522('0x27')](function(_0x55f8ad){return _0x55f8ad;});}return null;};}function removeEntity(_0x323dc3,_0x386c9f){return function(_0x327281){if(_0x327281){return _0x327281[_0x2522('0x28')]()['then'](function(){_0x323dc3[_0x2522('0x1b')](0xcc)[_0x2522('0x1c')]();});}};}function handleEntityNotFound(_0x4f2cd1,_0x1e4deb){return function(_0x1c48ac){if(!_0x1c48ac){_0x4f2cd1['sendStatus'](0x194);}return _0x1c48ac;};}function handleError(_0x28e829,_0xf4c0d3){_0xf4c0d3=_0xf4c0d3||0x1f4;return function(_0x2669af){logger[_0x2522('0x29')](_0x2669af['stack']);if(_0x2669af[_0x2522('0x2a')]){delete _0x2669af[_0x2522('0x2a')];}_0x28e829[_0x2522('0x1b')](_0xf4c0d3)[_0x2522('0x2b')](_0x2669af);};}exports['index']=function(_0xaf0b5b,_0x25a555){var _0x50756b={},_0x1b67ef={},_0x16f944={'count':0x0,'rows':[]};var _0x5f0319=_[_0x2522('0x2c')](db[_0x2522('0x2d')][_0x2522('0x2e')],function(_0xb8c2e5){return{'name':_0xb8c2e5[_0x2522('0x2f')],'type':_0xb8c2e5[_0x2522('0x30')][_0x2522('0x31')]};});_0x1b67ef[_0x2522('0x32')]=_[_0x2522('0x33')](_[_0x2522('0x2c')](_0x5f0319,'name'),[_0x2522('0x2a')]);_0x1b67ef['query']=_['keys'](_0xaf0b5b[_0x2522('0x34')]);_0x1b67ef['filters']=_[_0x2522('0x35')](_0x1b67ef[_0x2522('0x32')],_0x1b67ef['query']);_0x50756b[_0x2522('0x36')]=_[_0x2522('0x35')](_0x1b67ef[_0x2522('0x32')],qs[_0x2522('0x37')](_0xaf0b5b[_0x2522('0x34')][_0x2522('0x37')]));_0x50756b[_0x2522('0x36')]=_0x50756b[_0x2522('0x36')][_0x2522('0x38')]?_0x50756b[_0x2522('0x36')]:_0x1b67ef[_0x2522('0x32')];if(!_0xaf0b5b[_0x2522('0x34')][_0x2522('0x39')]('nolimit')){_0x50756b[_0x2522('0x1f')]=qs[_0x2522('0x1f')](_0xaf0b5b[_0x2522('0x34')][_0x2522('0x1f')]);_0x50756b[_0x2522('0x1d')]=qs[_0x2522('0x1d')](_0xaf0b5b[_0x2522('0x34')][_0x2522('0x1d')]);}_0x50756b[_0x2522('0x3a')]=qs[_0x2522('0x3b')](_0xaf0b5b[_0x2522('0x34')][_0x2522('0x3b')]);_0x50756b[_0x2522('0x3c')]=qs[_0x2522('0x3d')](_['pick'](_0xaf0b5b[_0x2522('0x34')],_0x1b67ef[_0x2522('0x3d')]),_0x5f0319);if(_0xaf0b5b[_0x2522('0x34')][_0x2522('0x3e')]){_0x50756b[_0x2522('0x3c')]=_['merge'](_0x50756b[_0x2522('0x3c')],{'$or':_[_0x2522('0x2c')](_0x5f0319,function(_0x36c138){if(_0x36c138['type']!==_0x2522('0x3f')){var _0x58714b={};_0x58714b[_0x36c138[_0x2522('0x2a')]]={'$like':'%'+_0xaf0b5b['query'][_0x2522('0x3e')]+'%'};return _0x58714b;}})});}_0x50756b=_[_0x2522('0x40')]({},_0x50756b,_0xaf0b5b['options']);var _0x3351bd={'where':_0x50756b[_0x2522('0x3c')]};return db[_0x2522('0x2d')]['count'](_0x3351bd)['then'](function(_0x327b68){_0x16f944[_0x2522('0x20')]=_0x327b68;if(_0xaf0b5b['query'][_0x2522('0x41')]){_0x50756b[_0x2522('0x42')]=[{'all':!![]}];}return db[_0x2522('0x2d')][_0x2522('0x43')](_0x50756b);})[_0x2522('0x27')](function(_0x2fa3a4){_0x16f944['rows']=_0x2fa3a4;return _0x16f944;})[_0x2522('0x27')](respondWithFilteredResult(_0x25a555,_0x50756b))['catch'](handleError(_0x25a555,null));};exports[_0x2522('0x44')]=function(_0x5ebdc9,_0x14ad22){var _0x3b24e1={'raw':!![],'where':{'id':_0x5ebdc9[_0x2522('0x45')]['id']}},_0x5b70aa={};_0x5b70aa[_0x2522('0x32')]=_[_0x2522('0x46')](db[_0x2522('0x2d')]['rawAttributes']);_0x5b70aa[_0x2522('0x34')]=_[_0x2522('0x46')](_0x5ebdc9[_0x2522('0x34')]);_0x5b70aa['filters']=_[_0x2522('0x35')](_0x5b70aa['model'],_0x5b70aa[_0x2522('0x34')]);_0x3b24e1['attributes']=_[_0x2522('0x35')](_0x5b70aa['model'],qs[_0x2522('0x37')](_0x5ebdc9['query']['fields']));_0x3b24e1[_0x2522('0x36')]=_0x3b24e1[_0x2522('0x36')]['length']?_0x3b24e1[_0x2522('0x36')]:_0x5b70aa[_0x2522('0x32')];if(_0x5ebdc9[_0x2522('0x34')][_0x2522('0x41')]){_0x3b24e1['include']=[{'all':!![]}];}_0x3b24e1=_[_0x2522('0x40')]({},_0x3b24e1,_0x5ebdc9[_0x2522('0x47')]);return db[_0x2522('0x2d')][_0x2522('0x48')](_0x3b24e1)['then'](handleEntityNotFound(_0x14ad22,null))[_0x2522('0x27')](respondWithResult(_0x14ad22,null))['catch'](handleError(_0x14ad22,null));};exports[_0x2522('0x49')]=function(_0x59c37c,_0x3fcc71){return db[_0x2522('0x2d')][_0x2522('0x49')](_0x59c37c[_0x2522('0x4a')],{})[_0x2522('0x27')](respondWithResult(_0x3fcc71,0xc9))[_0x2522('0x4b')](handleError(_0x3fcc71,null));};exports['update']=function(_0x27c990,_0x383953){if(_0x27c990[_0x2522('0x4a')]['id']){delete _0x27c990['body']['id'];}return db[_0x2522('0x2d')][_0x2522('0x48')]({'where':{'id':_0x27c990['params']['id']}})[_0x2522('0x27')](handleEntityNotFound(_0x383953,null))[_0x2522('0x27')](saveUpdates(_0x27c990[_0x2522('0x4a')],null))[_0x2522('0x27')](respondWithResult(_0x383953,null))['catch'](handleError(_0x383953,null));};exports[_0x2522('0x28')]=function(_0x90948b,_0x232359){return db[_0x2522('0x2d')]['find']({'where':{'id':_0x90948b[_0x2522('0x45')]['id']}})[_0x2522('0x27')](handleEntityNotFound(_0x232359,null))[_0x2522('0x27')](removeEntity(_0x232359,null))['catch'](handleError(_0x232359,null));};exports[_0x2522('0x4c')]=function(_0x40420c,_0x5c1e06,_0x8b2e5b){return db['VoiceMailMessage'][_0x2522('0x48')]({'where':{'id':_0x40420c[_0x2522('0x45')]['id']},'attributes':['id',_0x2522('0x4d'),_0x2522('0x4e')]})['then'](handleEntityNotFound(_0x5c1e06,null))[_0x2522('0x27')](function(_0x7b126d){if(_0x7b126d){if(!_0x7b126d['recording']){throw new db[(_0x2522('0x4f'))]['ValidationError'](_0x2522('0x50'));}var _0xdfc977={'Content-Type':_0x2522('0x51'),'Content-Disposition':_0x2522('0x52')};if(_0x7b126d[_0x2522('0x4e')]){_0xdfc977[_0x2522('0x53')]=_0x2522('0x54')+_0x7b126d[_0x2522('0x4e')]+'.wav\x22';}_0x5c1e06['set'](_0xdfc977);return _0x5c1e06[_0x2522('0x2b')](new Buffer(_0x7b126d[_0x2522('0x4d')]));}})[_0x2522('0x4b')](handleError(_0x5c1e06,null));}; \ No newline at end of file +var _0x50b0=['find','catch','create','body','update','msg_id','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','name','send','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params'];(function(_0x262f5d,_0x4a6c15){var _0x376624=function(_0x9c534b){while(--_0x9c534b){_0x262f5d['push'](_0x262f5d['shift']());}};_0x376624(++_0x4a6c15);}(_0x50b0,0xf7));var _0x050b=function(_0x29d6f6,_0x2d20de){_0x29d6f6=_0x29d6f6-0x0;var _0x128722=_0x50b0[_0x29d6f6];return _0x128722;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x050b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x050b('0x1'));var moment=require(_0x050b('0x2'));var BPromise=require(_0x050b('0x3'));var Mustache=require('mustache');var util=require(_0x050b('0x4'));var path=require(_0x050b('0x5'));var sox=require('sox');var csv=require(_0x050b('0x6'));var ejs=require(_0x050b('0x7'));var fs=require('fs');var fs_extra=require(_0x050b('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x050b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x050b('0xa'));var toCsv=require(_0x050b('0x6'));var querystring=require(_0x050b('0xb'));var Papa=require(_0x050b('0xc'));var Redis=require(_0x050b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x050b('0xe'));var as=require(_0x050b('0xf'));var hardwareService=require(_0x050b('0x10'));var logger=require(_0x050b('0x11'))(_0x050b('0x12'));var utils=require(_0x050b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x050b('0x14'))['db'];function respondWithStatusCode(_0x52c6dc,_0x4ce32d){_0x4ce32d=_0x4ce32d||0xcc;return function(_0x2b6c69){if(_0x2b6c69){return _0x52c6dc['sendStatus'](_0x4ce32d);}return _0x52c6dc[_0x050b('0x15')](_0x4ce32d)['end']();};}function respondWithResult(_0xa4e155,_0x535d7c){_0x535d7c=_0x535d7c||0xc8;return function(_0x82a351){if(_0x82a351){return _0xa4e155[_0x050b('0x15')](_0x535d7c)[_0x050b('0x16')](_0x82a351);}};}function respondWithFilteredResult(_0x43a857,_0x28ccb0){return function(_0x2a6c9f){if(_0x2a6c9f){var _0x533cc3=typeof _0x28ccb0['offset']==='undefined'&&typeof _0x28ccb0['limit']===_0x050b('0x17');var _0x36ea9a=_0x2a6c9f[_0x050b('0x18')];var _0x465ace=_0x533cc3?0x0:_0x28ccb0[_0x050b('0x19')];var _0x4f8ba3=_0x533cc3?_0x2a6c9f[_0x050b('0x18')]:_0x28ccb0[_0x050b('0x19')]+_0x28ccb0[_0x050b('0x1a')];var _0x4d17a0;if(_0x4f8ba3>=_0x36ea9a){_0x4f8ba3=_0x36ea9a;_0x4d17a0=0xc8;}else{_0x4d17a0=0xce;}_0x43a857['status'](_0x4d17a0);return _0x43a857[_0x050b('0x1b')](_0x050b('0x1c'),_0x465ace+'-'+_0x4f8ba3+'/'+_0x36ea9a)[_0x050b('0x16')](_0x2a6c9f);}return null;};}function patchUpdates(_0x48ad25){return function(_0x5a9828){try{jsonpatch[_0x050b('0x1d')](_0x5a9828,_0x48ad25,!![]);}catch(_0x1b1c5f){return BPromise[_0x050b('0x1e')](_0x1b1c5f);}return _0x5a9828[_0x050b('0x1f')]();};}function saveUpdates(_0x3c5bc0,_0x595910){return function(_0x49c637){if(_0x49c637){return _0x49c637['update'](_0x3c5bc0)[_0x050b('0x20')](function(_0x8a2ea9){return _0x8a2ea9;});}return null;};}function removeEntity(_0x3d6e56,_0x48f084){return function(_0x5a3eca){if(_0x5a3eca){return _0x5a3eca[_0x050b('0x21')]()[_0x050b('0x20')](function(){_0x3d6e56[_0x050b('0x15')](0xcc)[_0x050b('0x22')]();});}};}function handleEntityNotFound(_0x4d8265,_0x5dcb4e){return function(_0x2262c9){if(!_0x2262c9){_0x4d8265[_0x050b('0x23')](0x194);}return _0x2262c9;};}function handleError(_0x55ed60,_0x5a96ca){_0x5a96ca=_0x5a96ca||0x1f4;return function(_0x49ffe4){logger['error'](_0x49ffe4['stack']);if(_0x49ffe4[_0x050b('0x24')]){delete _0x49ffe4[_0x050b('0x24')];}_0x55ed60['status'](_0x5a96ca)[_0x050b('0x25')](_0x49ffe4);};}exports['index']=function(_0x53d358,_0x3459f6){var _0x4825f1={},_0x4e0709={},_0x42629c={'count':0x0,'rows':[]};var _0x1ec305=_[_0x050b('0x26')](db[_0x050b('0x27')][_0x050b('0x28')],function(_0x369723){return{'name':_0x369723['fieldName'],'type':_0x369723[_0x050b('0x29')][_0x050b('0x2a')]};});_0x4e0709[_0x050b('0x2b')]=_[_0x050b('0x2c')](_[_0x050b('0x26')](_0x1ec305,_0x050b('0x24')),[_0x050b('0x24')]);_0x4e0709[_0x050b('0x2d')]=_[_0x050b('0x2e')](_0x53d358[_0x050b('0x2d')]);_0x4e0709[_0x050b('0x2f')]=_[_0x050b('0x30')](_0x4e0709[_0x050b('0x2b')],_0x4e0709[_0x050b('0x2d')]);_0x4825f1[_0x050b('0x31')]=_[_0x050b('0x30')](_0x4e0709['model'],qs[_0x050b('0x32')](_0x53d358['query']['fields']));_0x4825f1[_0x050b('0x31')]=_0x4825f1[_0x050b('0x31')][_0x050b('0x33')]?_0x4825f1[_0x050b('0x31')]:_0x4e0709[_0x050b('0x2b')];if(!_0x53d358[_0x050b('0x2d')][_0x050b('0x34')]('nolimit')){_0x4825f1[_0x050b('0x1a')]=qs[_0x050b('0x1a')](_0x53d358[_0x050b('0x2d')][_0x050b('0x1a')]);_0x4825f1['offset']=qs[_0x050b('0x19')](_0x53d358[_0x050b('0x2d')][_0x050b('0x19')]);}_0x4825f1['order']=qs[_0x050b('0x35')](_0x53d358[_0x050b('0x2d')][_0x050b('0x35')]);_0x4825f1[_0x050b('0x36')]=qs[_0x050b('0x2f')](_['pick'](_0x53d358[_0x050b('0x2d')],_0x4e0709[_0x050b('0x2f')]),_0x1ec305);if(_0x53d358[_0x050b('0x2d')][_0x050b('0x37')]){_0x4825f1[_0x050b('0x36')]=_[_0x050b('0x38')](_0x4825f1[_0x050b('0x36')],{'$or':_[_0x050b('0x26')](_0x1ec305,function(_0x55901c){if(_0x55901c['type']!==_0x050b('0x39')){var _0x184ad2={};_0x184ad2[_0x55901c[_0x050b('0x24')]]={'$like':'%'+_0x53d358[_0x050b('0x2d')][_0x050b('0x37')]+'%'};return _0x184ad2;}})});}_0x4825f1=_[_0x050b('0x38')]({},_0x4825f1,_0x53d358[_0x050b('0x3a')]);var _0x1a2a37={'where':_0x4825f1[_0x050b('0x36')]};return db[_0x050b('0x27')][_0x050b('0x18')](_0x1a2a37)['then'](function(_0x1832fa){_0x42629c[_0x050b('0x18')]=_0x1832fa;if(_0x53d358[_0x050b('0x2d')][_0x050b('0x3b')]){_0x4825f1[_0x050b('0x3c')]=[{'all':!![]}];}return db[_0x050b('0x27')][_0x050b('0x3d')](_0x4825f1);})[_0x050b('0x20')](function(_0x2bddb6){_0x42629c[_0x050b('0x3e')]=_0x2bddb6;return _0x42629c;})['then'](respondWithFilteredResult(_0x3459f6,_0x4825f1))['catch'](handleError(_0x3459f6,null));};exports[_0x050b('0x3f')]=function(_0x36f1cc,_0x450801){var _0x2f7d45={'raw':!![],'where':{'id':_0x36f1cc[_0x050b('0x40')]['id']}},_0x3c5abf={};_0x3c5abf[_0x050b('0x2b')]=_[_0x050b('0x2e')](db[_0x050b('0x27')][_0x050b('0x28')]);_0x3c5abf[_0x050b('0x2d')]=_[_0x050b('0x2e')](_0x36f1cc[_0x050b('0x2d')]);_0x3c5abf[_0x050b('0x2f')]=_[_0x050b('0x30')](_0x3c5abf['model'],_0x3c5abf[_0x050b('0x2d')]);_0x2f7d45[_0x050b('0x31')]=_[_0x050b('0x30')](_0x3c5abf[_0x050b('0x2b')],qs[_0x050b('0x32')](_0x36f1cc[_0x050b('0x2d')]['fields']));_0x2f7d45[_0x050b('0x31')]=_0x2f7d45[_0x050b('0x31')][_0x050b('0x33')]?_0x2f7d45[_0x050b('0x31')]:_0x3c5abf['model'];if(_0x36f1cc[_0x050b('0x2d')][_0x050b('0x3b')]){_0x2f7d45[_0x050b('0x3c')]=[{'all':!![]}];}_0x2f7d45=_[_0x050b('0x38')]({},_0x2f7d45,_0x36f1cc[_0x050b('0x3a')]);return db[_0x050b('0x27')][_0x050b('0x41')](_0x2f7d45)['then'](handleEntityNotFound(_0x450801,null))[_0x050b('0x20')](respondWithResult(_0x450801,null))[_0x050b('0x42')](handleError(_0x450801,null));};exports[_0x050b('0x43')]=function(_0x568339,_0x184bee){return db[_0x050b('0x27')][_0x050b('0x43')](_0x568339[_0x050b('0x44')],{})[_0x050b('0x20')](respondWithResult(_0x184bee,0xc9))[_0x050b('0x42')](handleError(_0x184bee,null));};exports[_0x050b('0x45')]=function(_0x14a2fa,_0x332650){if(_0x14a2fa[_0x050b('0x44')]['id']){delete _0x14a2fa['body']['id'];}return db[_0x050b('0x27')][_0x050b('0x41')]({'where':{'id':_0x14a2fa[_0x050b('0x40')]['id']}})[_0x050b('0x20')](handleEntityNotFound(_0x332650,null))[_0x050b('0x20')](saveUpdates(_0x14a2fa[_0x050b('0x44')],null))[_0x050b('0x20')](respondWithResult(_0x332650,null))[_0x050b('0x42')](handleError(_0x332650,null));};exports['destroy']=function(_0x49fe8b,_0x1558ae){return db[_0x050b('0x27')][_0x050b('0x41')]({'where':{'id':_0x49fe8b[_0x050b('0x40')]['id']}})['then'](handleEntityNotFound(_0x1558ae,null))['then'](removeEntity(_0x1558ae,null))[_0x050b('0x42')](handleError(_0x1558ae,null));};exports['download']=function(_0xa0ff7c,_0x10cef2,_0x4d1397){return db['VoiceMailMessage'][_0x050b('0x41')]({'where':{'id':_0xa0ff7c['params']['id']},'attributes':['id','recording',_0x050b('0x46')]})[_0x050b('0x20')](handleEntityNotFound(_0x10cef2,null))[_0x050b('0x20')](function(_0x426fea){if(_0x426fea){if(!_0x426fea[_0x050b('0x47')]){throw new db[(_0x050b('0x48'))]['ValidationError'](_0x050b('0x49'));}var _0x41016={'Content-Type':_0x050b('0x4a'),'Content-Disposition':_0x050b('0x4b')};if(_0x426fea['msg_id']){_0x41016[_0x050b('0x4c')]=_0x050b('0x4d')+_0x426fea[_0x050b('0x46')]+'.wav\x22';}_0x10cef2['set'](_0x41016);return _0x10cef2['send'](new Buffer(_0x426fea[_0x050b('0x47')]));}})[_0x050b('0x42')](handleError(_0x10cef2,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 483f1b8..14cfdbc 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 _0xda2d=['dir','lodash','util','../../config/logger','api','bluebird','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages'];(function(_0x231aa1,_0x261fb8){var _0x1de20b=function(_0x528fde){while(--_0x528fde){_0x231aa1['push'](_0x231aa1['shift']());}};_0x1de20b(++_0x261fb8);}(_0xda2d,0x196));var _0xdda2=function(_0x192d85,_0x3fe395){_0x192d85=_0x192d85-0x0;var _0x56f550=_0xda2d[_0x192d85];return _0x56f550;};'use strict';var _=require(_0xdda2('0x0'));var util=require(_0xdda2('0x1'));var logger=require(_0xdda2('0x2'))(_0xdda2('0x3'));var moment=require('moment');var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdda2('0x5'));module['exports']=function(_0x502271,_0x2d6124){return _0x502271['define'](_0xdda2('0x6'),attributes,{'tableName':_0xdda2('0x7'),'paranoid':![],'indexes':[{'name':_0xdda2('0x8'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x53e2=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1fd155,_0x340af9){var _0x250e2f=function(_0x3cef99){while(--_0x3cef99){_0x1fd155['push'](_0x1fd155['shift']());}};_0x250e2f(++_0x340af9);}(_0x53e2,0x11f));var _0x253e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x53e2[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x253e('0x0'));var util=require(_0x253e('0x1'));var logger=require(_0x253e('0x2'))(_0x253e('0x3'));var moment=require(_0x253e('0x4'));var BPromise=require(_0x253e('0x5'));var rp=require(_0x253e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x253e('0x7'));var config=require(_0x253e('0x8'));var attributes=require(_0x253e('0x9'));module[_0x253e('0xa')]=function(_0x1fd622,_0x3d4c4a){return _0x1fd622[_0x253e('0xb')](_0x253e('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x253e('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 1679e6e..17dda7f 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 _0x8172=['client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x26e376,_0x580262){var _0x69a251=function(_0x598451){while(--_0x598451){_0x26e376['push'](_0x26e376['shift']());}};_0x69a251(++_0x580262);}(_0x8172,0xb4));var _0x2817=function(_0x2d9db2,_0x2a2f35){_0x2d9db2=_0x2d9db2-0x0;var _0x20ac01=_0x8172[_0x2d9db2];return _0x20ac01;};'use strict';var _=require(_0x2817('0x0'));var util=require('util');var moment=require(_0x2817('0x1'));var BPromise=require(_0x2817('0x2'));var rs=require(_0x2817('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2817('0x4'))['db'];var utils=require(_0x2817('0x5'));var logger=require(_0x2817('0x6'))('rpc');var config=require(_0x2817('0x7'));var jayson=require(_0x2817('0x8'));var client=jayson[_0x2817('0x9')][_0x2817('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1233ef,_0x2a2593,_0x5e114a){return new BPromise(function(_0xb0a87a,_0x2db4ed){return client[_0x2817('0xb')](_0x1233ef,_0x5e114a)[_0x2817('0xc')](function(_0x38b896){logger[_0x2817('0xd')](_0x2817('0xe'),_0x2a2593,_0x2817('0xf'));logger[_0x2817('0x10')](_0x2817('0x11'),_0x2a2593,'request\x20sent',JSON[_0x2817('0x12')](_0x38b896));if(_0x38b896['error']){if(_0x38b896[_0x2817('0x13')]['code']===0x1f4){logger[_0x2817('0x13')](_0x2817('0xe'),_0x2a2593,_0x38b896['error']['message']);return _0x2db4ed(_0x38b896['error'][_0x2817('0x14')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2a2593,_0x38b896['error']['message']);return _0xb0a87a(_0x38b896[_0x2817('0x13')][_0x2817('0x14')]);}else{logger[_0x2817('0xd')](_0x2817('0xe'),_0x2a2593,_0x2817('0xf'));_0xb0a87a(_0x38b896['result']['message']);}})['catch'](function(_0x5b221b){logger[_0x2817('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x2a2593,_0x5b221b);_0x2db4ed(_0x5b221b);});});} \ No newline at end of file +var _0x2534=['ioredis','../../mysqldb','../../config/utils','client','http','request','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x1740ae,_0x5889d2){var _0x2eddc6=function(_0x228c0f){while(--_0x228c0f){_0x1740ae['push'](_0x1740ae['shift']());}};_0x2eddc6(++_0x5889d2);}(_0x2534,0x84));var _0x4253=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0x2534[_0x179c4a];return _0x5d1879;};'use strict';var _=require(_0x4253('0x0'));var util=require(_0x4253('0x1'));var moment=require('moment');var BPromise=require(_0x4253('0x2'));var rs=require(_0x4253('0x3'));var fs=require('fs');var Redis=require(_0x4253('0x4'));var db=require(_0x4253('0x5'))['db'];var utils=require(_0x4253('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4253('0x7')][_0x4253('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x216e46,_0x1392ca,_0x136a34){return new BPromise(function(_0x2b0685,_0x4dd89c){return client[_0x4253('0x9')](_0x216e46,_0x136a34)['then'](function(_0x1aabba){logger['info'](_0x4253('0xa'),_0x1392ca,_0x4253('0xb'));logger['debug'](_0x4253('0xc'),_0x1392ca,_0x4253('0xb'),JSON['stringify'](_0x1aabba));if(_0x1aabba[_0x4253('0xd')]){if(_0x1aabba[_0x4253('0xd')]['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x1392ca,_0x1aabba[_0x4253('0xd')][_0x4253('0xe')]);return _0x4dd89c(_0x1aabba['error'][_0x4253('0xe')]);}logger['error'](_0x4253('0xa'),_0x1392ca,_0x1aabba[_0x4253('0xd')][_0x4253('0xe')]);return _0x2b0685(_0x1aabba[_0x4253('0xd')][_0x4253('0xe')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x1392ca,_0x4253('0xb'));_0x2b0685(_0x1aabba[_0x4253('0xf')]['message']);}})[_0x4253('0x10')](function(_0x50cc7f){logger[_0x4253('0xd')](_0x4253('0xa'),_0x1392ca,_0x50cc7f);_0x4dd89c(_0x50cc7f);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b6f5970..4cb2f8f 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 _0x7168=['get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','update','delete','/:id/sounds/:id2','multer','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x16afe5,_0x129d87){var _0x123fff=function(_0x5db4d6){while(--_0x5db4d6){_0x16afe5['push'](_0x16afe5['shift']());}};_0x123fff(++_0x129d87);}(_0x7168,0x199));var _0x8716=function(_0x4c1cde,_0x553b85){_0x4c1cde=_0x4c1cde-0x0;var _0x392202=_0x7168[_0x4c1cde];return _0x392202;};'use strict';var multer=require(_0x8716('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8716('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x8716('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x8716('0x3'));var controller=require(_0x8716('0x4'));router[_0x8716('0x5')]('/',auth[_0x8716('0x6')](),controller[_0x8716('0x7')]);router[_0x8716('0x5')](_0x8716('0x8'),auth[_0x8716('0x6')](),controller[_0x8716('0x9')]);router[_0x8716('0x5')](_0x8716('0xa'),auth['isAuthenticated'](),controller[_0x8716('0xb')]);router[_0x8716('0xc')]('/',auth[_0x8716('0x6')](),controller[_0x8716('0xd')]);router['post'](_0x8716('0xa'),auth[_0x8716('0x6')](),controller[_0x8716('0xe')]);router['put'](_0x8716('0x8'),auth['isAuthenticated'](),controller[_0x8716('0xf')]);router[_0x8716('0x10')]('/:id',auth[_0x8716('0x6')](),controller['destroy']);router['delete'](_0x8716('0x11'),auth[_0x8716('0x6')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0xc71d=['../../config/environment','get','isAuthenticated','show','/:id/sounds','getSounds','create','post','put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ad694,_0x4d9361){var _0x52647b=function(_0x572b2c){while(--_0x572b2c){_0x3ad694['push'](_0x3ad694['shift']());}};_0x52647b(++_0x4d9361);}(_0xc71d,0x160));var _0xdc71=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0xc71d[_0x52096b];return _0x2b1cc7;};'use strict';var multer=require(_0xdc71('0x0'));var util=require(_0xdc71('0x1'));var path=require('path');var timeout=require(_0xdc71('0x2'));var express=require(_0xdc71('0x3'));var router=express[_0xdc71('0x4')]();var fs_extra=require(_0xdc71('0x5'));var auth=require(_0xdc71('0x6'));var interaction=require(_0xdc71('0x7'));var config=require(_0xdc71('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0xdc71('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdc71('0x9')]('/:id',auth[_0xdc71('0xa')](),controller[_0xdc71('0xb')]);router['get'](_0xdc71('0xc'),auth[_0xdc71('0xa')](),controller[_0xdc71('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdc71('0xe')]);router[_0xdc71('0xf')]('/:id/sounds',auth[_0xdc71('0xa')](),controller['addSound']);router[_0xdc71('0x10')](_0xdc71('0x11'),auth[_0xdc71('0xa')](),controller[_0xdc71('0x12')]);router[_0xdc71('0x13')]('/:id',auth[_0xdc71('0xa')](),controller[_0xdc71('0x14')]);router[_0xdc71('0x13')](_0xdc71('0x15'),auth['isAuthenticated'](),controller[_0xdc71('0x16')]);module[_0xdc71('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 0107d3c..755f81e 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 _0xcc7c=['custom','files','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','name','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc7c,0x81));var _0xccc7=function(_0x448c22,_0x4bd296){_0x448c22=_0x448c22-0x0;var _0x57d486=_0xcc7c[_0x448c22];return _0x57d486;};'use strict';var Sequelize=require(_0xccc7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xccc7('0x1')},'mode':{'type':Sequelize[_0xccc7('0x2')](_0xccc7('0x3'),_0xccc7('0x4'),'mp3nb',_0xccc7('0x5'),_0xccc7('0x6'),_0xccc7('0x7')),'allowNull':!![],'defaultValue':_0xccc7('0x4')},'directory':{'type':Sequelize[_0xccc7('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xccc7('0x8')],'allowNull':!![],'defaultValue':_0xccc7('0x9')},'format':{'type':Sequelize[_0xccc7('0x8')],'allowNull':!![]},'stamp':{'type':_0xccc7('0xa')},'defaultEntry':{'type':Sequelize[_0xccc7('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8b3a=['quietmp3nb','mp3','files','alpha','sequelize','exports','STRING','name','ENUM','custom','mp3nb'];(function(_0x154a2e,_0x185c6e){var _0x3369c4=function(_0x4f918a){while(--_0x4f918a){_0x154a2e['push'](_0x154a2e['shift']());}};_0x3369c4(++_0x185c6e);}(_0x8b3a,0x1f3));var _0xa8b3=function(_0x5b13c3,_0x378e0a){_0x5b13c3=_0x5b13c3-0x0;var _0x3d6780=_0x8b3a[_0x5b13c3];return _0x3d6780;};'use strict';var Sequelize=require(_0xa8b3('0x0'));module[_0xa8b3('0x1')]={'name':{'type':Sequelize[_0xa8b3('0x2')],'allowNull':![],'unique':_0xa8b3('0x3')},'mode':{'type':Sequelize[_0xa8b3('0x4')](_0xa8b3('0x5'),'files',_0xa8b3('0x6'),_0xa8b3('0x7'),'quietmp3',_0xa8b3('0x8')),'allowNull':!![],'defaultValue':_0xa8b3('0x9')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa8b3('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index c119bf7..4abcb6c 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 _0x93de=['params','rawAttributes','intersection','find','body','create','sequelize','transaction','mode','files','directory','join','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','rmdirSync','ValidationError','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','%s.%s','basename','extname','server/files/moh','format','symlinkSync','Sequelize','message','id2','getSounds','nolimit','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','name','send','index','map','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','findAll','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x93de,0x167));var _0xe93d=function(_0x45cae4,_0x10d727){_0x45cae4=_0x45cae4-0x0;var _0x37ed37=_0x93de[_0x45cae4];return _0x37ed37;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe93d('0x0'));var jsonpatch=require(_0xe93d('0x1'));var rp=require(_0xe93d('0x2'));var moment=require('moment');var BPromise=require(_0xe93d('0x3'));var Mustache=require(_0xe93d('0x4'));var util=require(_0xe93d('0x5'));var path=require('path');var sox=require(_0xe93d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe93d('0x7'));var _=require(_0xe93d('0x8'));var squel=require('squel');var crypto=require(_0xe93d('0x9'));var jsforce=require(_0xe93d('0xa'));var deskjs=require(_0xe93d('0xb'));var toCsv=require(_0xe93d('0xc'));var querystring=require(_0xe93d('0xd'));var Papa=require(_0xe93d('0xe'));var Redis=require('ioredis');var authService=require(_0xe93d('0xf'));var qs=require(_0xe93d('0x10'));var as=require(_0xe93d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe93d('0x12'))(_0xe93d('0x13'));var utils=require(_0xe93d('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe93d('0x15'))['db'];function respondWithStatusCode(_0x184729,_0x235ab4){_0x235ab4=_0x235ab4||0xcc;return function(_0x217980){if(_0x217980){return _0x184729[_0xe93d('0x16')](_0x235ab4);}return _0x184729[_0xe93d('0x17')](_0x235ab4)[_0xe93d('0x18')]();};}function respondWithResult(_0x20e1df,_0xc2e477){_0xc2e477=_0xc2e477||0xc8;return function(_0x431bda){if(_0x431bda){return _0x20e1df[_0xe93d('0x17')](_0xc2e477)[_0xe93d('0x19')](_0x431bda);}};}function respondWithFilteredResult(_0x22251f,_0xe01645){return function(_0x188f57){if(_0x188f57){var _0x276c00=typeof _0xe01645[_0xe93d('0x1a')]===_0xe93d('0x1b')&&typeof _0xe01645[_0xe93d('0x1c')]===_0xe93d('0x1b');var _0x3d1701=_0x188f57['count'];var _0x493541=_0x276c00?0x0:_0xe01645[_0xe93d('0x1a')];var _0x202385=_0x276c00?_0x188f57[_0xe93d('0x1d')]:_0xe01645[_0xe93d('0x1a')]+_0xe01645['limit'];var _0x18c8b9;if(_0x202385>=_0x3d1701){_0x202385=_0x3d1701;_0x18c8b9=0xc8;}else{_0x18c8b9=0xce;}_0x22251f[_0xe93d('0x17')](_0x18c8b9);return _0x22251f[_0xe93d('0x1e')]('Content-Range',_0x493541+'-'+_0x202385+'/'+_0x3d1701)[_0xe93d('0x19')](_0x188f57);}return null;};}function patchUpdates(_0x19ad21){return function(_0x356da6){try{jsonpatch[_0xe93d('0x1f')](_0x356da6,_0x19ad21,!![]);}catch(_0x2725b9){return BPromise['reject'](_0x2725b9);}return _0x356da6[_0xe93d('0x20')]();};}function saveUpdates(_0x22eac1,_0x25a309){return function(_0x4164f3){if(_0x4164f3){return _0x4164f3[_0xe93d('0x21')](_0x22eac1)[_0xe93d('0x22')](function(_0x12d69c){return _0x12d69c;});}return null;};}function removeEntity(_0x1f9f3a,_0x1ac451){return function(_0x57782c){if(_0x57782c){return _0x57782c[_0xe93d('0x23')]()[_0xe93d('0x22')](function(){var _0x5d5948=_0x57782c[_0xe93d('0x24')]({'plain':!![]});var _0x5f1260=_0xe93d('0x25');return db[_0xe93d('0x26')][_0xe93d('0x23')]({'where':{'type':_0x5f1260,'resourceId':_0x5d5948['id']}})[_0xe93d('0x22')](function(){return _0x57782c;});})[_0xe93d('0x22')](function(){_0x1f9f3a[_0xe93d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd9c5,_0x44669d){return function(_0x41be07){if(!_0x41be07){_0x5cd9c5[_0xe93d('0x16')](0x194);}return _0x41be07;};}function handleError(_0x5760e3,_0x2c1cc1){_0x2c1cc1=_0x2c1cc1||0x1f4;return function(_0x12a047){logger['error'](_0x12a047['stack']);if(_0x12a047['name']){delete _0x12a047[_0xe93d('0x27')];}_0x5760e3[_0xe93d('0x17')](_0x2c1cc1)[_0xe93d('0x28')](_0x12a047);};}exports[_0xe93d('0x29')]=function(_0x879d12,_0x417e2c){var _0x1b7001={},_0x3976d7={},_0x1ab972={'count':0x0,'rows':[]};var _0x4b49ad=_[_0xe93d('0x2a')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x4a999c){return{'name':_0x4a999c['fieldName'],'type':_0x4a999c['type'][_0xe93d('0x2b')]};});_0x3976d7[_0xe93d('0x2c')]=_[_0xe93d('0x2a')](_0x4b49ad,_0xe93d('0x27'));_0x3976d7[_0xe93d('0x2d')]=_[_0xe93d('0x2e')](_0x879d12['query']);_0x3976d7[_0xe93d('0x2f')]=_['intersection'](_0x3976d7[_0xe93d('0x2c')],_0x3976d7[_0xe93d('0x2d')]);_0x1b7001['attributes']=_['intersection'](_0x3976d7[_0xe93d('0x2c')],qs['fields'](_0x879d12['query'][_0xe93d('0x30')]));_0x1b7001[_0xe93d('0x31')]=_0x1b7001[_0xe93d('0x31')][_0xe93d('0x32')]?_0x1b7001[_0xe93d('0x31')]:_0x3976d7[_0xe93d('0x2c')];if(!_0x879d12[_0xe93d('0x2d')][_0xe93d('0x33')]('nolimit')){_0x1b7001[_0xe93d('0x1c')]=qs['limit'](_0x879d12['query'][_0xe93d('0x1c')]);_0x1b7001['offset']=qs[_0xe93d('0x1a')](_0x879d12['query'][_0xe93d('0x1a')]);}_0x1b7001[_0xe93d('0x34')]=qs[_0xe93d('0x35')](_0x879d12[_0xe93d('0x2d')][_0xe93d('0x35')]);delete _0x879d12[_0xe93d('0x2d')]['sort'];_0x1b7001[_0xe93d('0x36')]=qs['filters'](_[_0xe93d('0x37')](_0x879d12[_0xe93d('0x2d')],_0x3976d7['filters']),_0x4b49ad);if(_0x879d12['query'][_0xe93d('0x38')]){_0x1b7001['where']=_[_0xe93d('0x39')](_0x1b7001['where'],{'$or':_[_0xe93d('0x2a')](_0x4b49ad,function(_0x17a973){if(_0x17a973['type']!==_0xe93d('0x3a')){var _0x3ae986={};_0x3ae986[_0x17a973[_0xe93d('0x27')]]={'$like':'%'+_0x879d12['query'][_0xe93d('0x38')]+'%'};return _0x3ae986;}})});}_0x1b7001=_[_0xe93d('0x39')]({},_0x1b7001,_0x879d12[_0xe93d('0x3b')]);var _0x1b7626={'where':_0x1b7001[_0xe93d('0x36')]};return db[_0xe93d('0x3c')][_0xe93d('0x1d')](_0x1b7626)['then'](function(_0x56dfb0){_0x1ab972[_0xe93d('0x1d')]=_0x56dfb0;if(_0x879d12['query'][_0xe93d('0x3d')]){_0x1b7001[_0xe93d('0x3e')]=[{'all':!![]}];}return db[_0xe93d('0x3c')][_0xe93d('0x3f')](_0x1b7001);})[_0xe93d('0x22')](function(_0x413c87){_0x1ab972['rows']=_0x413c87;return _0x1ab972;})[_0xe93d('0x22')](respondWithFilteredResult(_0x417e2c,_0x1b7001))[_0xe93d('0x40')](handleError(_0x417e2c,null));};exports['show']=function(_0x1936a4,_0x3b62f5){var _0x1eee04={'raw':![],'where':{'id':_0x1936a4[_0xe93d('0x41')]['id']}},_0x30ec54={};_0x30ec54['model']=_[_0xe93d('0x2e')](db[_0xe93d('0x3c')][_0xe93d('0x42')]);_0x30ec54[_0xe93d('0x2d')]=_[_0xe93d('0x2e')](_0x1936a4[_0xe93d('0x2d')]);_0x30ec54[_0xe93d('0x2f')]=_[_0xe93d('0x43')](_0x30ec54['model'],_0x30ec54[_0xe93d('0x2d')]);_0x1eee04['attributes']=_[_0xe93d('0x43')](_0x30ec54[_0xe93d('0x2c')],qs[_0xe93d('0x30')](_0x1936a4['query'][_0xe93d('0x30')]));_0x1eee04[_0xe93d('0x31')]=_0x1eee04[_0xe93d('0x31')][_0xe93d('0x32')]?_0x1eee04[_0xe93d('0x31')]:_0x30ec54[_0xe93d('0x2c')];if(_0x1936a4[_0xe93d('0x2d')][_0xe93d('0x3d')]){_0x1eee04[_0xe93d('0x3e')]=[{'all':!![]}];}_0x1eee04=_[_0xe93d('0x39')]({},_0x1eee04,_0x1936a4[_0xe93d('0x3b')]);return db[_0xe93d('0x3c')][_0xe93d('0x44')](_0x1eee04)[_0xe93d('0x22')](handleEntityNotFound(_0x3b62f5,null))[_0xe93d('0x22')](respondWithResult(_0x3b62f5,null))[_0xe93d('0x40')](handleError(_0x3b62f5,null));};exports[_0xe93d('0x21')]=function(_0xb448d9,_0x1b78e0){if(_0xb448d9['body']['id']){delete _0xb448d9[_0xe93d('0x45')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0xb448d9['params']['id']}})['then'](handleEntityNotFound(_0x1b78e0,null))['then'](saveUpdates(_0xb448d9[_0xe93d('0x45')],null))[_0xe93d('0x22')](respondWithResult(_0x1b78e0,null))[_0xe93d('0x40')](handleError(_0x1b78e0,null));};exports[_0xe93d('0x46')]=function(_0x333cb8,_0x15f6dc,_0x49854f){return db[_0xe93d('0x47')][_0xe93d('0x48')](function(_0xcff536){if(_0x333cb8[_0xe93d('0x45')][_0xe93d('0x49')]===_0xe93d('0x4a')){_0x333cb8[_0xe93d('0x45')][_0xe93d('0x4b')]=path[_0xe93d('0x4c')](config['root'],'server/files/moh',_0x333cb8[_0xe93d('0x45')][_0xe93d('0x27')]);}return db[_0xe93d('0x3c')][_0xe93d('0x46')](_0x333cb8[_0xe93d('0x45')],{'transaction':_0xcff536})[_0xe93d('0x22')](function(_0x429c9c){if(_0x333cb8[_0xe93d('0x45')][_0xe93d('0x49')]==='files'){fs[_0xe93d('0x4d')](_0x429c9c['directory'],parseInt(_0xe93d('0x4e'),0x8));}var _0x4edb73=_0x333cb8[_0xe93d('0x4f')]['get']({'plain':!![]});if(!_0x4edb73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4edb73[_0xe93d('0x50')]===_0xe93d('0x4f')){var _0x4d24d6=_0x429c9c[_0xe93d('0x24')]({'plain':!![]});return db[_0xe93d('0x51')][_0xe93d('0x44')]({'where':{'name':_0xe93d('0x25'),'userProfileId':_0x4edb73[_0xe93d('0x52')]},'raw':!![]})['then'](function(_0x2b7c){if(_0x2b7c&&_0x2b7c[_0xe93d('0x53')]===0x0){return db[_0xe93d('0x26')][_0xe93d('0x46')]({'name':_0x4d24d6[_0xe93d('0x27')],'resourceId':_0x4d24d6['id'],'type':_0x2b7c[_0xe93d('0x27')],'sectionId':_0x2b7c['id']},{})[_0xe93d('0x22')](function(){return _0x429c9c;});}else{return _0x429c9c;}})[_0xe93d('0x40')](function(_0x2de195){logger['error'](_0xe93d('0x54'),_0x2de195);});}return _0x429c9c;});})[_0xe93d('0x22')](respondWithResult(_0x15f6dc,0xc9))[_0xe93d('0x40')](handleError(_0x15f6dc,null));};exports[_0xe93d('0x23')]=function(_0x295733,_0x5082a0,_0x1d9f13){var _0x3a486d;return db[_0xe93d('0x3c')][_0xe93d('0x44')]({'where':{'id':_0x295733[_0xe93d('0x41')]['id']}})[_0xe93d('0x22')](function(_0x296a8b){if(_0x296a8b){return db[_0xe93d('0x47')][_0xe93d('0x48')](function(_0x116871){return _0x296a8b['destroy']({'transaction':_0x116871,'raw':!![]})[_0xe93d('0x22')](function(_0x59c0ad){if(_0x59c0ad[_0xe93d('0x4b')]){fs['readdirSync'](_0x59c0ad[_0xe93d('0x4b')])[_0xe93d('0x55')](function(_0x2c387b){fs['unlinkSync'](path['join'](_0x59c0ad[_0xe93d('0x4b')],_0x2c387b));});fs[_0xe93d('0x56')](_0x59c0ad[_0xe93d('0x4b')]);}return _0x59c0ad;});})[_0xe93d('0x40')](function(_0x4cc0c3){throw new db['Sequelize'][(_0xe93d('0x57'))](_0x4cc0c3['message']);});}})['then'](handleEntityNotFound(_0x5082a0,null))['then'](removeEntity(_0x5082a0,null))[_0xe93d('0x40')](handleError(_0x5082a0,null));};exports[_0xe93d('0x58')]=function(_0x34b746,_0x399fc2,_0x191e99){return db[_0xe93d('0x47')][_0xe93d('0x48')](function(_0x4d8536){var _0x5a708e;return db[_0xe93d('0x3c')]['find']({'where':{'id':_0x34b746[_0xe93d('0x41')]['id']}})[_0xe93d('0x22')](function(_0x934a8e){if(_0x934a8e){_0x5a708e=_0x934a8e;return _0x934a8e[_0xe93d('0x58')](_0x34b746['body']['id'],{'transaction':_0x4d8536});}})[_0xe93d('0x22')](function(_0x5debcf){if(_0x5debcf){return db[_0xe93d('0x59')][_0xe93d('0x5a')]({'where':{'id':_0x34b746[_0xe93d('0x45')]['id']},'attributes':['id',_0xe93d('0x27'),_0xe93d('0x5b'),_0xe93d('0x5c'),'createdAt'],'raw':!![]});}})[_0xe93d('0x22')](function(_0xd7e76a){if(_0xd7e76a){var _0x13e8cd=path[_0xe93d('0x4c')](config[_0xe93d('0x5d')],_0xe93d('0x5e'),util['format'](_0xe93d('0x5f'),path[_0xe93d('0x60')](_0xd7e76a[_0xe93d('0x5b')],path[_0xe93d('0x61')](_0xd7e76a[_0xe93d('0x5b')])),_0xd7e76a[_0xe93d('0x5c')]));var _0x41eb77=path['join'](config[_0xe93d('0x5d')],_0xe93d('0x62'),_0x5a708e['name'],util[_0xe93d('0x63')]('%s.%s',_0xd7e76a[_0xe93d('0x27')],_0xd7e76a[_0xe93d('0x5c')]));fs[_0xe93d('0x64')](_0x13e8cd,_0x41eb77);return _0xd7e76a;}})[_0xe93d('0x40')](function(_0xf61ebe){throw new db[(_0xe93d('0x65'))]['ValidationError'](_0xf61ebe[_0xe93d('0x66')]);});})[_0xe93d('0x22')](handleEntityNotFound(_0x399fc2,null))['then'](respondWithResult(_0x399fc2,0xc9))[_0xe93d('0x40')](handleError(_0x399fc2,null));};exports['removeSound']=function(_0x3c9c30,_0x3ff5b,_0x4c712b){return db[_0xe93d('0x47')][_0xe93d('0x48')](function(_0xf3b3b0){var _0x1e9f5b;return db['VoiceMusicOnHold'][_0xe93d('0x5a')]({'where':{'id':_0x3c9c30[_0xe93d('0x41')]['id']}})[_0xe93d('0x22')](handleEntityNotFound(_0x3ff5b,null))[_0xe93d('0x22')](function(_0x2df8bd){if(_0x2df8bd){_0x1e9f5b=_0x2df8bd;return _0x2df8bd['removeSound'](_0x3c9c30[_0xe93d('0x41')][_0xe93d('0x67')]);}})[_0xe93d('0x22')](function(_0x4d1d81){if(_0x4d1d81){return db[_0xe93d('0x59')]['findOne']({'where':{'id':_0x3c9c30[_0xe93d('0x41')]['id2']},'attributes':['id','name',_0xe93d('0x5b'),'converted_format','createdAt'],'raw':!![]});}})[_0xe93d('0x22')](function(_0x5562c6){if(_0x5562c6){fs['unlinkSync'](path[_0xe93d('0x4c')](_0x1e9f5b['directory'],util[_0xe93d('0x63')](_0xe93d('0x5f'),_0x5562c6[_0xe93d('0x27')],_0x5562c6[_0xe93d('0x5c')])));return _0x5562c6;}})['catch'](function(_0x2007c0){throw new db['Sequelize']['ValidationError'](_0x2007c0['message']);});})[_0xe93d('0x22')](handleEntityNotFound(_0x3ff5b,null))[_0xe93d('0x22')](respondWithStatusCode(_0x3ff5b,0xcc))[_0xe93d('0x40')](handleError(_0x3ff5b,null));};exports[_0xe93d('0x68')]=function(_0x4eaf35,_0x51f4c3,_0x377d44){var _0x508a5b={};var _0x11d43f={};var _0x1603db;var _0x5709d5;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x4eaf35[_0xe93d('0x41')]['id']}})[_0xe93d('0x22')](handleEntityNotFound(_0x51f4c3,null))['then'](function(_0x38daaa){if(_0x38daaa){_0x1603db=_0x38daaa;_0x11d43f['model']=_[_0xe93d('0x2e')](db['Sound'][_0xe93d('0x42')]);_0x11d43f[_0xe93d('0x2d')]=_[_0xe93d('0x2e')](_0x4eaf35[_0xe93d('0x2d')]);_0x11d43f[_0xe93d('0x2f')]=_[_0xe93d('0x43')](_0x11d43f['model'],_0x11d43f[_0xe93d('0x2d')]);_0x508a5b[_0xe93d('0x31')]=_['intersection'](_0x11d43f[_0xe93d('0x2c')],qs[_0xe93d('0x30')](_0x4eaf35[_0xe93d('0x2d')][_0xe93d('0x30')]));_0x508a5b['attributes']=_0x508a5b[_0xe93d('0x31')][_0xe93d('0x32')]?_0x508a5b['attributes']:_0x11d43f[_0xe93d('0x2c')];_0x508a5b['order']=qs[_0xe93d('0x35')](_0x4eaf35[_0xe93d('0x2d')]['sort']);_0x508a5b[_0xe93d('0x36')]=qs[_0xe93d('0x2f')](_[_0xe93d('0x37')](_0x4eaf35['query'],_0x11d43f[_0xe93d('0x2f')]));if(_0x4eaf35['query']['filter']){_0x508a5b['where']=_[_0xe93d('0x39')](_0x508a5b[_0xe93d('0x36')],{'$or':_[_0xe93d('0x2a')](_0x508a5b['attributes'],function(_0x2c4893){var _0x5d20aa={};_0x5d20aa[_0x2c4893]={'$like':'%'+_0x4eaf35[_0xe93d('0x2d')][_0xe93d('0x38')]+'%'};return _0x5d20aa;})});}_0x508a5b=_[_0xe93d('0x39')]({},_0x508a5b,_0x4eaf35[_0xe93d('0x3b')]);return _0x1603db[_0xe93d('0x68')](_0x508a5b);}})['then'](function(_0x27da4d){if(_0x27da4d){_0x5709d5=_0x27da4d[_0xe93d('0x32')];if(!_0x4eaf35[_0xe93d('0x2d')][_0xe93d('0x33')](_0xe93d('0x69'))){_0x508a5b[_0xe93d('0x1c')]=qs[_0xe93d('0x1c')](_0x4eaf35[_0xe93d('0x2d')][_0xe93d('0x1c')]);_0x508a5b[_0xe93d('0x1a')]=qs[_0xe93d('0x1a')](_0x4eaf35[_0xe93d('0x2d')][_0xe93d('0x1a')]);}return _0x1603db['getSounds'](_0x508a5b);}})['then'](function(_0x5d35c8){if(_0x5d35c8){return _0x5d35c8?{'count':_0x5709d5,'rows':_0x5d35c8}:null;}})[_0xe93d('0x22')](respondWithResult(_0x51f4c3,null))[_0xe93d('0x40')](handleError(_0x51f4c3,null));}; \ No newline at end of file +var _0xeaaa=['symlinkSync','removeSound','findOne','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','MusicOnHolds','stack','index','map','VoiceMusicOnHold','rawAttributes','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','body','find','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','Sound','save_name','converted_format','createdAt','format','%s.%s','basename','extname'];(function(_0x4f74a5,_0x1fd979){var _0x5be8b2=function(_0x3bb233){while(--_0x3bb233){_0x4f74a5['push'](_0x4f74a5['shift']());}};_0x5be8b2(++_0x1fd979);}(_0xeaaa,0x149));var _0xaeaa=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xeaaa[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xaeaa('0x0'));var rimraf=require(_0xaeaa('0x1'));var zipdir=require(_0xaeaa('0x2'));var jsonpatch=require(_0xaeaa('0x3'));var rp=require(_0xaeaa('0x4'));var moment=require(_0xaeaa('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xaeaa('0x6'));var sox=require(_0xaeaa('0x7'));var csv=require(_0xaeaa('0x8'));var ejs=require(_0xaeaa('0x9'));var fs=require('fs');var fs_extra=require(_0xaeaa('0xa'));var _=require(_0xaeaa('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaeaa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xaeaa('0x8'));var querystring=require(_0xaeaa('0xd'));var Papa=require(_0xaeaa('0xe'));var Redis=require('ioredis');var authService=require(_0xaeaa('0xf'));var qs=require(_0xaeaa('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaeaa('0x11'))(_0xaeaa('0x12'));var utils=require(_0xaeaa('0x13'));var config=require(_0xaeaa('0x14'));var licenseUtil=require(_0xaeaa('0x15'));var db=require(_0xaeaa('0x16'))['db'];function respondWithStatusCode(_0x3c06bb,_0x5ccc8d){_0x5ccc8d=_0x5ccc8d||0xcc;return function(_0x4e82d3){if(_0x4e82d3){return _0x3c06bb[_0xaeaa('0x17')](_0x5ccc8d);}return _0x3c06bb[_0xaeaa('0x18')](_0x5ccc8d)['end']();};}function respondWithResult(_0x3df176,_0x4647c6){_0x4647c6=_0x4647c6||0xc8;return function(_0x8bc954){if(_0x8bc954){return _0x3df176[_0xaeaa('0x18')](_0x4647c6)[_0xaeaa('0x19')](_0x8bc954);}};}function respondWithFilteredResult(_0x591ed8,_0x3c3c6a){return function(_0xc1a7ea){if(_0xc1a7ea){var _0x39773d=typeof _0x3c3c6a[_0xaeaa('0x1a')]===_0xaeaa('0x1b')&&typeof _0x3c3c6a[_0xaeaa('0x1c')]===_0xaeaa('0x1b');var _0x233cdd=_0xc1a7ea[_0xaeaa('0x1d')];var _0x2a59ec=_0x39773d?0x0:_0x3c3c6a[_0xaeaa('0x1a')];var _0x3f4908=_0x39773d?_0xc1a7ea[_0xaeaa('0x1d')]:_0x3c3c6a[_0xaeaa('0x1a')]+_0x3c3c6a['limit'];var _0x36f39e;if(_0x3f4908>=_0x233cdd){_0x3f4908=_0x233cdd;_0x36f39e=0xc8;}else{_0x36f39e=0xce;}_0x591ed8[_0xaeaa('0x18')](_0x36f39e);return _0x591ed8[_0xaeaa('0x1e')]('Content-Range',_0x2a59ec+'-'+_0x3f4908+'/'+_0x233cdd)[_0xaeaa('0x19')](_0xc1a7ea);}return null;};}function patchUpdates(_0x499572){return function(_0x1ef51b){try{jsonpatch[_0xaeaa('0x1f')](_0x1ef51b,_0x499572,!![]);}catch(_0x193a36){return BPromise[_0xaeaa('0x20')](_0x193a36);}return _0x1ef51b['save']();};}function saveUpdates(_0x1375c0,_0x3b772c){return function(_0x2011f5){if(_0x2011f5){return _0x2011f5[_0xaeaa('0x21')](_0x1375c0)['then'](function(_0x19c96e){return _0x19c96e;});}return null;};}function removeEntity(_0x4556db,_0x25736a){return function(_0x5547eb){if(_0x5547eb){return _0x5547eb[_0xaeaa('0x22')]()[_0xaeaa('0x23')](function(){var _0xab4f17=_0x5547eb[_0xaeaa('0x24')]({'plain':!![]});var _0x1d1fac=_0xaeaa('0x25');return db['UserProfileResource'][_0xaeaa('0x22')]({'where':{'type':_0x1d1fac,'resourceId':_0xab4f17['id']}})['then'](function(){return _0x5547eb;});})[_0xaeaa('0x23')](function(){_0x4556db[_0xaeaa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x273277,_0x2fd303){return function(_0x17805e){if(!_0x17805e){_0x273277[_0xaeaa('0x17')](0x194);}return _0x17805e;};}function handleError(_0x4f5a0e,_0x70152c){_0x70152c=_0x70152c||0x1f4;return function(_0x3dd8c7){logger['error'](_0x3dd8c7[_0xaeaa('0x26')]);if(_0x3dd8c7['name']){delete _0x3dd8c7['name'];}_0x4f5a0e[_0xaeaa('0x18')](_0x70152c)['send'](_0x3dd8c7);};}exports[_0xaeaa('0x27')]=function(_0x43a125,_0x5a98c8){var _0x43907e={},_0x17ebd5={},_0x38644c={'count':0x0,'rows':[]};var _0x5703af=_[_0xaeaa('0x28')](db[_0xaeaa('0x29')][_0xaeaa('0x2a')],function(_0x584263){return{'name':_0x584263['fieldName'],'type':_0x584263['type']['key']};});_0x17ebd5[_0xaeaa('0x2b')]=_[_0xaeaa('0x28')](_0x5703af,_0xaeaa('0x2c'));_0x17ebd5[_0xaeaa('0x2d')]=_[_0xaeaa('0x2e')](_0x43a125[_0xaeaa('0x2d')]);_0x17ebd5[_0xaeaa('0x2f')]=_[_0xaeaa('0x30')](_0x17ebd5['model'],_0x17ebd5[_0xaeaa('0x2d')]);_0x43907e['attributes']=_[_0xaeaa('0x30')](_0x17ebd5[_0xaeaa('0x2b')],qs[_0xaeaa('0x31')](_0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x31')]));_0x43907e[_0xaeaa('0x32')]=_0x43907e[_0xaeaa('0x32')][_0xaeaa('0x33')]?_0x43907e[_0xaeaa('0x32')]:_0x17ebd5[_0xaeaa('0x2b')];if(!_0x43a125['query']['hasOwnProperty'](_0xaeaa('0x34'))){_0x43907e[_0xaeaa('0x1c')]=qs[_0xaeaa('0x1c')](_0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x1c')]);_0x43907e[_0xaeaa('0x1a')]=qs['offset'](_0x43a125[_0xaeaa('0x2d')]['offset']);}_0x43907e[_0xaeaa('0x35')]=qs[_0xaeaa('0x36')](_0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x36')]);delete _0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x36')];_0x43907e[_0xaeaa('0x37')]=qs['filters'](_[_0xaeaa('0x38')](_0x43a125[_0xaeaa('0x2d')],_0x17ebd5['filters']),_0x5703af);if(_0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x39')]){_0x43907e[_0xaeaa('0x37')]=_[_0xaeaa('0x3a')](_0x43907e['where'],{'$or':_['map'](_0x5703af,function(_0x259ed7){if(_0x259ed7[_0xaeaa('0x3b')]!==_0xaeaa('0x3c')){var _0x36d1fd={};_0x36d1fd[_0x259ed7[_0xaeaa('0x2c')]]={'$like':'%'+_0x43a125[_0xaeaa('0x2d')][_0xaeaa('0x39')]+'%'};return _0x36d1fd;}})});}_0x43907e=_[_0xaeaa('0x3a')]({},_0x43907e,_0x43a125[_0xaeaa('0x3d')]);var _0x345eab={'where':_0x43907e[_0xaeaa('0x37')]};return db[_0xaeaa('0x29')][_0xaeaa('0x1d')](_0x345eab)[_0xaeaa('0x23')](function(_0x13933b){_0x38644c[_0xaeaa('0x1d')]=_0x13933b;if(_0x43a125[_0xaeaa('0x2d')]['includeAll']){_0x43907e[_0xaeaa('0x3e')]=[{'all':!![]}];}return db[_0xaeaa('0x29')][_0xaeaa('0x3f')](_0x43907e);})[_0xaeaa('0x23')](function(_0x454486){_0x38644c[_0xaeaa('0x40')]=_0x454486;return _0x38644c;})['then'](respondWithFilteredResult(_0x5a98c8,_0x43907e))[_0xaeaa('0x41')](handleError(_0x5a98c8,null));};exports[_0xaeaa('0x42')]=function(_0x463b16,_0x18b1dd){var _0x3dfb61={'raw':![],'where':{'id':_0x463b16[_0xaeaa('0x43')]['id']}},_0x30968f={};_0x30968f[_0xaeaa('0x2b')]=_[_0xaeaa('0x2e')](db[_0xaeaa('0x29')][_0xaeaa('0x2a')]);_0x30968f[_0xaeaa('0x2d')]=_[_0xaeaa('0x2e')](_0x463b16[_0xaeaa('0x2d')]);_0x30968f[_0xaeaa('0x2f')]=_['intersection'](_0x30968f[_0xaeaa('0x2b')],_0x30968f[_0xaeaa('0x2d')]);_0x3dfb61[_0xaeaa('0x32')]=_[_0xaeaa('0x30')](_0x30968f[_0xaeaa('0x2b')],qs['fields'](_0x463b16[_0xaeaa('0x2d')]['fields']));_0x3dfb61[_0xaeaa('0x32')]=_0x3dfb61['attributes'][_0xaeaa('0x33')]?_0x3dfb61[_0xaeaa('0x32')]:_0x30968f[_0xaeaa('0x2b')];if(_0x463b16['query'][_0xaeaa('0x44')]){_0x3dfb61[_0xaeaa('0x3e')]=[{'all':!![]}];}_0x3dfb61=_[_0xaeaa('0x3a')]({},_0x3dfb61,_0x463b16[_0xaeaa('0x3d')]);return db[_0xaeaa('0x29')]['find'](_0x3dfb61)[_0xaeaa('0x23')](handleEntityNotFound(_0x18b1dd,null))[_0xaeaa('0x23')](respondWithResult(_0x18b1dd,null))[_0xaeaa('0x41')](handleError(_0x18b1dd,null));};exports[_0xaeaa('0x21')]=function(_0x352d5b,_0x123b4b){if(_0x352d5b[_0xaeaa('0x45')]['id']){delete _0x352d5b['body']['id'];}return db[_0xaeaa('0x29')][_0xaeaa('0x46')]({'where':{'id':_0x352d5b[_0xaeaa('0x43')]['id']}})[_0xaeaa('0x23')](handleEntityNotFound(_0x123b4b,null))[_0xaeaa('0x23')](saveUpdates(_0x352d5b[_0xaeaa('0x45')],null))[_0xaeaa('0x23')](respondWithResult(_0x123b4b,null))[_0xaeaa('0x41')](handleError(_0x123b4b,null));};exports[_0xaeaa('0x47')]=function(_0x177471,_0x1e579d,_0x5f4055){return db[_0xaeaa('0x48')][_0xaeaa('0x49')](function(_0x28eb08){if(_0x177471['body'][_0xaeaa('0x4a')]===_0xaeaa('0x4b')){_0x177471[_0xaeaa('0x45')]['directory']=path[_0xaeaa('0x4c')](config[_0xaeaa('0x4d')],_0xaeaa('0x4e'),_0x177471[_0xaeaa('0x45')][_0xaeaa('0x2c')]);}return db[_0xaeaa('0x29')]['create'](_0x177471[_0xaeaa('0x45')],{'transaction':_0x28eb08})[_0xaeaa('0x23')](function(_0x352934){if(_0x177471[_0xaeaa('0x45')][_0xaeaa('0x4a')]==='files'){fs[_0xaeaa('0x4f')](_0x352934[_0xaeaa('0x50')],parseInt(_0xaeaa('0x51'),0x8));}var _0x474731=_0x177471['user'][_0xaeaa('0x24')]({'plain':!![]});if(!_0x474731)throw new Error(_0xaeaa('0x52'));if(_0x474731[_0xaeaa('0x53')]===_0xaeaa('0x54')){var _0xbde79f=_0x352934[_0xaeaa('0x24')]({'plain':!![]});return db[_0xaeaa('0x55')][_0xaeaa('0x46')]({'where':{'name':_0xaeaa('0x25'),'userProfileId':_0x474731[_0xaeaa('0x56')]},'raw':!![]})[_0xaeaa('0x23')](function(_0x4e4ff7){if(_0x4e4ff7&&_0x4e4ff7[_0xaeaa('0x57')]===0x0){return db[_0xaeaa('0x58')][_0xaeaa('0x47')]({'name':_0xbde79f[_0xaeaa('0x2c')],'resourceId':_0xbde79f['id'],'type':_0x4e4ff7['name'],'sectionId':_0x4e4ff7['id']},{})[_0xaeaa('0x23')](function(){return _0x352934;});}else{return _0x352934;}})[_0xaeaa('0x41')](function(_0x2886db){logger['error'](_0xaeaa('0x59'),_0x2886db);});}return _0x352934;});})[_0xaeaa('0x23')](respondWithResult(_0x1e579d,0xc9))[_0xaeaa('0x41')](handleError(_0x1e579d,null));};exports[_0xaeaa('0x22')]=function(_0x1c1115,_0x448572,_0x56712e){var _0x41f83b;return db[_0xaeaa('0x29')]['find']({'where':{'id':_0x1c1115['params']['id']}})[_0xaeaa('0x23')](function(_0x87fa0e){if(_0x87fa0e){return db[_0xaeaa('0x48')][_0xaeaa('0x49')](function(_0x36677d){return _0x87fa0e[_0xaeaa('0x22')]({'transaction':_0x36677d,'raw':!![]})[_0xaeaa('0x23')](function(_0x2721eb){if(_0x2721eb['directory']){fs[_0xaeaa('0x5a')](_0x2721eb['directory'])[_0xaeaa('0x5b')](function(_0x1cb9c2){fs['unlinkSync'](path[_0xaeaa('0x4c')](_0x2721eb['directory'],_0x1cb9c2));});fs[_0xaeaa('0x5c')](_0x2721eb[_0xaeaa('0x50')]);}return _0x2721eb;});})[_0xaeaa('0x41')](function(_0x437e3d){throw new db[(_0xaeaa('0x5d'))][(_0xaeaa('0x5e'))](_0x437e3d['message']);});}})[_0xaeaa('0x23')](handleEntityNotFound(_0x448572,null))[_0xaeaa('0x23')](removeEntity(_0x448572,null))['catch'](handleError(_0x448572,null));};exports['addSound']=function(_0xdce06a,_0x507596,_0x53ea7a){return db[_0xaeaa('0x48')][_0xaeaa('0x49')](function(_0x376618){var _0x37f0b9;return db[_0xaeaa('0x29')][_0xaeaa('0x46')]({'where':{'id':_0xdce06a['params']['id']}})[_0xaeaa('0x23')](function(_0x4b5831){if(_0x4b5831){_0x37f0b9=_0x4b5831;return _0x4b5831['addSound'](_0xdce06a['body']['id'],{'transaction':_0x376618});}})[_0xaeaa('0x23')](function(_0x24174b){if(_0x24174b){return db[_0xaeaa('0x5f')]['findOne']({'where':{'id':_0xdce06a[_0xaeaa('0x45')]['id']},'attributes':['id',_0xaeaa('0x2c'),_0xaeaa('0x60'),_0xaeaa('0x61'),_0xaeaa('0x62')],'raw':!![]});}})[_0xaeaa('0x23')](function(_0x396256){if(_0x396256){var _0x2563d2=path[_0xaeaa('0x4c')](config[_0xaeaa('0x4d')],'server/files/sounds/converted',util[_0xaeaa('0x63')](_0xaeaa('0x64'),path[_0xaeaa('0x65')](_0x396256[_0xaeaa('0x60')],path[_0xaeaa('0x66')](_0x396256[_0xaeaa('0x60')])),_0x396256['converted_format']));var _0x11714e=path['join'](config[_0xaeaa('0x4d')],_0xaeaa('0x4e'),_0x37f0b9[_0xaeaa('0x2c')],util[_0xaeaa('0x63')](_0xaeaa('0x64'),_0x396256[_0xaeaa('0x2c')],_0x396256['converted_format']));fs[_0xaeaa('0x67')](_0x2563d2,_0x11714e);return _0x396256;}})[_0xaeaa('0x41')](function(_0x11c41f){throw new db[(_0xaeaa('0x5d'))][(_0xaeaa('0x5e'))](_0x11c41f['message']);});})[_0xaeaa('0x23')](handleEntityNotFound(_0x507596,null))[_0xaeaa('0x23')](respondWithResult(_0x507596,0xc9))[_0xaeaa('0x41')](handleError(_0x507596,null));};exports[_0xaeaa('0x68')]=function(_0x36cc21,_0x410440,_0x21b416){return db['sequelize']['transaction'](function(_0x387c58){var _0x41ab3f;return db[_0xaeaa('0x29')][_0xaeaa('0x69')]({'where':{'id':_0x36cc21[_0xaeaa('0x43')]['id']}})[_0xaeaa('0x23')](handleEntityNotFound(_0x410440,null))[_0xaeaa('0x23')](function(_0x5847e1){if(_0x5847e1){_0x41ab3f=_0x5847e1;return _0x5847e1[_0xaeaa('0x68')](_0x36cc21['params'][_0xaeaa('0x6a')]);}})[_0xaeaa('0x23')](function(_0x4c8d72){if(_0x4c8d72){return db[_0xaeaa('0x5f')][_0xaeaa('0x69')]({'where':{'id':_0x36cc21[_0xaeaa('0x43')][_0xaeaa('0x6a')]},'attributes':['id',_0xaeaa('0x2c'),'save_name','converted_format',_0xaeaa('0x62')],'raw':!![]});}})[_0xaeaa('0x23')](function(_0x4e7f2a){if(_0x4e7f2a){fs['unlinkSync'](path[_0xaeaa('0x4c')](_0x41ab3f['directory'],util[_0xaeaa('0x63')](_0xaeaa('0x64'),_0x4e7f2a[_0xaeaa('0x2c')],_0x4e7f2a[_0xaeaa('0x61')])));return _0x4e7f2a;}})[_0xaeaa('0x41')](function(_0x5a1fc8){throw new db['Sequelize'][(_0xaeaa('0x5e'))](_0x5a1fc8['message']);});})[_0xaeaa('0x23')](handleEntityNotFound(_0x410440,null))[_0xaeaa('0x23')](respondWithStatusCode(_0x410440,0xcc))[_0xaeaa('0x41')](handleError(_0x410440,null));};exports[_0xaeaa('0x6b')]=function(_0x12bd3f,_0x3f0a3c,_0x43ce57){var _0x255e88={};var _0x35178d={};var _0x49dd09;var _0x4461ed;return db[_0xaeaa('0x29')][_0xaeaa('0x69')]({'where':{'id':_0x12bd3f['params']['id']}})[_0xaeaa('0x23')](handleEntityNotFound(_0x3f0a3c,null))['then'](function(_0x377edd){if(_0x377edd){_0x49dd09=_0x377edd;_0x35178d['model']=_[_0xaeaa('0x2e')](db['Sound'][_0xaeaa('0x2a')]);_0x35178d['query']=_[_0xaeaa('0x2e')](_0x12bd3f[_0xaeaa('0x2d')]);_0x35178d[_0xaeaa('0x2f')]=_['intersection'](_0x35178d['model'],_0x35178d[_0xaeaa('0x2d')]);_0x255e88[_0xaeaa('0x32')]=_['intersection'](_0x35178d['model'],qs[_0xaeaa('0x31')](_0x12bd3f[_0xaeaa('0x2d')][_0xaeaa('0x31')]));_0x255e88[_0xaeaa('0x32')]=_0x255e88['attributes'][_0xaeaa('0x33')]?_0x255e88[_0xaeaa('0x32')]:_0x35178d[_0xaeaa('0x2b')];_0x255e88['order']=qs['sort'](_0x12bd3f['query'][_0xaeaa('0x36')]);_0x255e88[_0xaeaa('0x37')]=qs['filters'](_[_0xaeaa('0x38')](_0x12bd3f['query'],_0x35178d[_0xaeaa('0x2f')]));if(_0x12bd3f[_0xaeaa('0x2d')]['filter']){_0x255e88[_0xaeaa('0x37')]=_['merge'](_0x255e88[_0xaeaa('0x37')],{'$or':_[_0xaeaa('0x28')](_0x255e88['attributes'],function(_0x9c0a24){var _0x5596a1={};_0x5596a1[_0x9c0a24]={'$like':'%'+_0x12bd3f[_0xaeaa('0x2d')][_0xaeaa('0x39')]+'%'};return _0x5596a1;})});}_0x255e88=_[_0xaeaa('0x3a')]({},_0x255e88,_0x12bd3f['options']);return _0x49dd09['getSounds'](_0x255e88);}})[_0xaeaa('0x23')](function(_0xdd7cf7){if(_0xdd7cf7){_0x4461ed=_0xdd7cf7[_0xaeaa('0x33')];if(!_0x12bd3f[_0xaeaa('0x2d')]['hasOwnProperty'](_0xaeaa('0x34'))){_0x255e88[_0xaeaa('0x1c')]=qs[_0xaeaa('0x1c')](_0x12bd3f[_0xaeaa('0x2d')][_0xaeaa('0x1c')]);_0x255e88['offset']=qs[_0xaeaa('0x1a')](_0x12bd3f[_0xaeaa('0x2d')][_0xaeaa('0x1a')]);}return _0x49dd09[_0xaeaa('0x6b')](_0x255e88);}})[_0xaeaa('0x23')](function(_0x21823e){if(_0x21823e){return _0x21823e?{'count':_0x4461ed,'rows':_0x21823e}:null;}})[_0xaeaa('0x23')](respondWithResult(_0x3f0a3c,null))[_0xaeaa('0x41')](handleError(_0x3f0a3c,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 5331501..7684afb 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 _0xa763=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4c236b,_0x58a997){var _0x2b5789=function(_0x503dbb){while(--_0x503dbb){_0x4c236b['push'](_0x4c236b['shift']());}};_0x2b5789(++_0x58a997);}(_0xa763,0xe2));var _0x3a76=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xa763[_0x67f95e];return _0x538f5a;};'use strict';var _=require(_0x3a76('0x0'));var util=require(_0x3a76('0x1'));var logger=require(_0x3a76('0x2'))(_0x3a76('0x3'));var moment=require(_0x3a76('0x4'));var BPromise=require(_0x3a76('0x5'));var rp=require(_0x3a76('0x6'));var fs=require('fs');var path=require(_0x3a76('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3a76('0x8'));module[_0x3a76('0x9')]=function(_0x1015c,_0x521c9f){return _0x1015c[_0x3a76('0xa')](_0x3a76('0xb'),attributes,{'tableName':_0x3a76('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f70=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash'];(function(_0x405d5b,_0x3c8a7a){var _0x4922dc=function(_0xd73c10){while(--_0xd73c10){_0x405d5b['push'](_0x405d5b['shift']());}};_0x4922dc(++_0x3c8a7a);}(_0x7f70,0x11d));var _0x07f7=function(_0x2741a3,_0x4792d3){_0x2741a3=_0x2741a3-0x0;var _0x31e9ac=_0x7f70[_0x2741a3];return _0x31e9ac;};'use strict';var _=require(_0x07f7('0x0'));var util=require(_0x07f7('0x1'));var logger=require(_0x07f7('0x2'))('api');var moment=require(_0x07f7('0x3'));var BPromise=require(_0x07f7('0x4'));var rp=require(_0x07f7('0x5'));var fs=require('fs');var path=require(_0x07f7('0x6'));var rimraf=require(_0x07f7('0x7'));var config=require(_0x07f7('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x07f7('0x9')]=function(_0x36c679,_0x2660a9){return _0x36c679[_0x07f7('0xa')](_0x07f7('0xb'),attributes,{'tableName':_0x07f7('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 937085b..0a2fd4b 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4d7219,_0x144cff){var _0x258c71=function(_0x5e11fb){while(--_0x5e11fb){_0x4d7219['push'](_0x4d7219['shift']());}};_0x258c71(++_0x144cff);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x454024,_0x1bf2fc){var _0x33f072=function(_0x5fa315){while(--_0x5fa315){_0x454024['push'](_0x454024['shift']());}};_0x33f072(++_0x1bf2fc);}(_0x34e8,0x12c));var _0x834e=function(_0x554cce,_0x4b35a4){_0x554cce=_0x554cce-0x0;var _0x846906=_0x34e8[_0x554cce];return _0x846906;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e539e0b..ae870a5 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 _0x0560=['/:id','destroy','removeAgents','removeTeams','exports','multer','path','connect-timeout','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','update','delete'];(function(_0x2c8978,_0x91982a){var _0x58a356=function(_0x1c9e57){while(--_0x1c9e57){_0x2c8978['push'](_0x2c8978['shift']());}};_0x58a356(++_0x91982a);}(_0x0560,0x95));var _0x0056=function(_0x5c9c08,_0x2a4d90){_0x5c9c08=_0x5c9c08-0x0;var _0x55d5ed=_0x0560[_0x5c9c08];return _0x55d5ed;};'use strict';var multer=require(_0x0056('0x0'));var util=require('util');var path=require(_0x0056('0x1'));var timeout=require(_0x0056('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0056('0x3'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x0056('0x4')]('/',auth[_0x0056('0x5')](),controller[_0x0056('0x6')]);router['get'](_0x0056('0x7'),auth[_0x0056('0x5')](),controller[_0x0056('0x8')]);router[_0x0056('0x4')]('/:id',auth[_0x0056('0x5')](),controller[_0x0056('0x9')]);router[_0x0056('0x4')](_0x0056('0xa'),auth[_0x0056('0x5')](),controller[_0x0056('0xb')]);router['get'](_0x0056('0xc'),auth[_0x0056('0x5')](),controller[_0x0056('0xd')]);router[_0x0056('0xe')]('/',auth['isAuthenticated'](),controller[_0x0056('0xf')]);router[_0x0056('0xe')](_0x0056('0xa'),auth[_0x0056('0x5')](),controller[_0x0056('0x10')]);router[_0x0056('0xe')](_0x0056('0xc'),auth[_0x0056('0x5')](),controller['addTeams']);router['put']('/:id',auth[_0x0056('0x5')](),controller[_0x0056('0x11')]);router[_0x0056('0x12')](_0x0056('0x13'),auth[_0x0056('0x5')](),controller[_0x0056('0x14')]);router[_0x0056('0x12')](_0x0056('0xa'),auth['isAuthenticated'](),controller[_0x0056('0x15')]);router[_0x0056('0x12')](_0x0056('0xc'),auth[_0x0056('0x5')](),controller[_0x0056('0x16')]);module[_0x0056('0x17')]=router; \ No newline at end of file +var _0x0298=['../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/users','/:id/teams','post','create','addAgents','addTeams','put','destroy','delete','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5426d5,_0x2516e3){var _0xc70f20=function(_0x137027){while(--_0x137027){_0x5426d5['push'](_0x5426d5['shift']());}};_0xc70f20(++_0x2516e3);}(_0x0298,0x95));var _0x8029=function(_0x4c5de1,_0x31e913){_0x4c5de1=_0x4c5de1-0x0;var _0x10114a=_0x0298[_0x4c5de1];return _0x10114a;};'use strict';var multer=require(_0x8029('0x0'));var util=require('util');var path=require(_0x8029('0x1'));var timeout=require(_0x8029('0x2'));var express=require(_0x8029('0x3'));var router=express[_0x8029('0x4')]();var fs_extra=require(_0x8029('0x5'));var auth=require(_0x8029('0x6'));var interaction=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var controller=require(_0x8029('0x9'));router['get']('/',auth[_0x8029('0xa')](),controller[_0x8029('0xb')]);router['get'](_0x8029('0xc'),auth[_0x8029('0xa')](),controller[_0x8029('0xd')]);router[_0x8029('0xe')](_0x8029('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x8029('0xe')](_0x8029('0x10'),auth[_0x8029('0xa')](),controller['getAgents']);router['get'](_0x8029('0x11'),auth[_0x8029('0xa')](),controller['getTeams']);router[_0x8029('0x12')]('/',auth['isAuthenticated'](),controller[_0x8029('0x13')]);router[_0x8029('0x12')](_0x8029('0x10'),auth[_0x8029('0xa')](),controller[_0x8029('0x14')]);router[_0x8029('0x12')]('/:id/teams',auth[_0x8029('0xa')](),controller[_0x8029('0x15')]);router[_0x8029('0x16')](_0x8029('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8029('0xf'),auth[_0x8029('0xa')](),controller[_0x8029('0x17')]);router[_0x8029('0x18')](_0x8029('0x10'),auth[_0x8029('0xa')](),controller['removeAgents']);router[_0x8029('0x18')](_0x8029('0x11'),auth[_0x8029('0xa')](),controller[_0x8029('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 1c2471c..4f27bc5 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 _0x197a=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x52a167,_0xd2e437){var _0x2ab33a=function(_0xa5dab1){while(--_0xa5dab1){_0x52a167['push'](_0x52a167['shift']());}};_0x2ab33a(++_0xd2e437);}(_0x197a,0x1c8));var _0xa197=function(_0x134d5e,_0x2a47d8){_0x134d5e=_0x134d5e-0x0;var _0x1e166a=_0x197a[_0x134d5e];return _0x1e166a;};'use strict';var Sequelize=require(_0xa197('0x0'));module[_0xa197('0x1')]={'name':{'type':Sequelize[_0xa197('0x2')],'allowNull':![],'unique':_0xa197('0x3')},'prefix':{'type':Sequelize[_0xa197('0x4')],'get':function(_0x27ad38){return _0xa197('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xa197('0x2')]},'callerIdAll':{'type':Sequelize[_0xa197('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xa197('0x6')]}}; \ No newline at end of file +var _0x18e4=['sequelize','exports','STRING','name'];(function(_0x516e19,_0x592a77){var _0x46855e=function(_0x5df0c3){while(--_0x5df0c3){_0x516e19['push'](_0x516e19['shift']());}};_0x46855e(++_0x592a77);}(_0x18e4,0x140));var _0x418e=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x18e4[_0x4d8666];return _0x37175b;};'use strict';var Sequelize=require(_0x418e('0x0'));module[_0x418e('0x1')]={'name':{'type':Sequelize[_0x418e('0x2')],'allowNull':![],'unique':_0x418e('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x466ce3){return'system-'+this['getDataValue'](_0x418e('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x418e('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f8c827c..d25ccb3 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 _0xb03e=['from','team_has_voice_prefixes','join','user_has_teams','clone','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','index','VoicePrefix','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','keys','fields','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','VoicePrefixId','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','online','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId'];(function(_0x42eb0c,_0x28f7fc){var _0xbf441c=function(_0x474d0c){while(--_0x474d0c){_0x42eb0c['push'](_0x42eb0c['shift']());}};_0xbf441c(++_0x28f7fc);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1e6c14,_0x2b3fbc){_0x1e6c14=_0x1e6c14-0x0;var _0x4af44e=_0xb03e[_0x1e6c14];return _0x4af44e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb03('0x0'));var zipdir=require(_0xeb03('0x1'));var jsonpatch=require(_0xeb03('0x2'));var rp=require(_0xeb03('0x3'));var moment=require(_0xeb03('0x4'));var BPromise=require(_0xeb03('0x5'));var Mustache=require(_0xeb03('0x6'));var util=require(_0xeb03('0x7'));var path=require(_0xeb03('0x8'));var sox=require(_0xeb03('0x9'));var csv=require(_0xeb03('0xa'));var ejs=require(_0xeb03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb03('0xc'));var squel=require(_0xeb03('0xd'));var crypto=require(_0xeb03('0xe'));var jsforce=require(_0xeb03('0xf'));var deskjs=require(_0xeb03('0x10'));var toCsv=require(_0xeb03('0xa'));var querystring=require('querystring');var Papa=require(_0xeb03('0x11'));var Redis=require(_0xeb03('0x12'));var authService=require(_0xeb03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb03('0x15'))(_0xeb03('0x16'));var utils=require(_0xeb03('0x17'));var config=require(_0xeb03('0x18'));var licenseUtil=require(_0xeb03('0x19'));var db=require(_0xeb03('0x1a'))['db'];config[_0xeb03('0x1b')]=_[_0xeb03('0x1c')](config[_0xeb03('0x1b')],{'host':_0xeb03('0x1d'),'port':0x18eb});var socket=require(_0xeb03('0x1e'))(new Redis(config[_0xeb03('0x1b')]));require('./voicePrefix.socket')[_0xeb03('0x1f')](socket);function respondWithStatusCode(_0x100bef,_0x372c71){_0x372c71=_0x372c71||0xcc;return function(_0x33f9ba){if(_0x33f9ba){return _0x100bef['sendStatus'](_0x372c71);}return _0x100bef[_0xeb03('0x20')](_0x372c71)[_0xeb03('0x21')]();};}function respondWithResult(_0x3f26ef,_0x478989){_0x478989=_0x478989||0xc8;return function(_0x7ce874){if(_0x7ce874){return _0x3f26ef[_0xeb03('0x20')](_0x478989)[_0xeb03('0x22')](_0x7ce874);}};}function respondWithFilteredResult(_0x44716c,_0x42fa4e){return function(_0x1b4cbd){if(_0x1b4cbd){var _0x167a33=typeof _0x42fa4e[_0xeb03('0x23')]===_0xeb03('0x24')&&typeof _0x42fa4e[_0xeb03('0x25')]===_0xeb03('0x24');var _0x2c238d=_0x1b4cbd[_0xeb03('0x26')];var _0x19bddf=_0x167a33?0x0:_0x42fa4e['offset'];var _0x1bea3f=_0x167a33?_0x1b4cbd[_0xeb03('0x26')]:_0x42fa4e[_0xeb03('0x23')]+_0x42fa4e[_0xeb03('0x25')];var _0xe5a1c2;if(_0x1bea3f>=_0x2c238d){_0x1bea3f=_0x2c238d;_0xe5a1c2=0xc8;}else{_0xe5a1c2=0xce;}_0x44716c[_0xeb03('0x20')](_0xe5a1c2);return _0x44716c[_0xeb03('0x27')](_0xeb03('0x28'),_0x19bddf+'-'+_0x1bea3f+'/'+_0x2c238d)[_0xeb03('0x22')](_0x1b4cbd);}return null;};}function patchUpdates(_0x5a704b){return function(_0x712ac2){try{jsonpatch[_0xeb03('0x29')](_0x712ac2,_0x5a704b,!![]);}catch(_0x11ea85){return BPromise[_0xeb03('0x2a')](_0x11ea85);}return _0x712ac2[_0xeb03('0x2b')]();};}function saveUpdates(_0x5dcda3,_0x638353){return function(_0x406864){if(_0x406864){return _0x406864[_0xeb03('0x2c')](_0x5dcda3)[_0xeb03('0x2d')](function(_0x3f276a){return _0x3f276a;});}return null;};}function removeEntity(_0x119697,_0xb04f34){return function(_0x3f68f3){if(_0x3f68f3){return _0x3f68f3[_0xeb03('0x2e')]()['then'](function(){var _0x832372=_0x3f68f3[_0xeb03('0x2f')]({'plain':!![]});var _0x2683f9=_0xeb03('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0x2683f9,'resourceId':_0x832372['id']}})[_0xeb03('0x2d')](function(){return _0x3f68f3;});})['then'](function(){_0x119697[_0xeb03('0x20')](0xcc)[_0xeb03('0x21')]();});}};}function handleEntityNotFound(_0x160a37,_0x5db8bb){return function(_0xd4c8ec){if(!_0xd4c8ec){_0x160a37['sendStatus'](0x194);}return _0xd4c8ec;};}function handleError(_0x5cb729,_0x49e316){_0x49e316=_0x49e316||0x1f4;return function(_0x538d19){logger[_0xeb03('0x31')](_0x538d19[_0xeb03('0x32')]);if(_0x538d19['name']){delete _0x538d19['name'];}_0x5cb729['status'](_0x49e316)['send'](_0x538d19);};}exports[_0xeb03('0x33')]=function(_0x3655c3,_0x32aff7){var _0x2d2ddd={},_0x19fa35={},_0x5234dc={'count':0x0,'rows':[]};var _0x13efc6=_['map'](db[_0xeb03('0x34')][_0xeb03('0x35')],function(_0x19ceae){return{'name':_0x19ceae[_0xeb03('0x36')],'type':_0x19ceae[_0xeb03('0x37')][_0xeb03('0x38')]};});_0x19fa35[_0xeb03('0x39')]=_[_0xeb03('0x3a')](_0x13efc6,'name');_0x19fa35[_0xeb03('0x3b')]=_['keys'](_0x3655c3[_0xeb03('0x3b')]);_0x19fa35[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x19fa35[_0xeb03('0x39')],_0x19fa35[_0xeb03('0x3b')]);_0x2d2ddd[_0xeb03('0x3e')]=_['intersection'](_0x19fa35[_0xeb03('0x39')],qs['fields'](_0x3655c3['query']['fields']));_0x2d2ddd[_0xeb03('0x3e')]=_0x2d2ddd[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x2d2ddd[_0xeb03('0x3e')]:_0x19fa35[_0xeb03('0x39')];if(!_0x3655c3['query'][_0xeb03('0x40')](_0xeb03('0x41'))){_0x2d2ddd[_0xeb03('0x25')]=qs['limit'](_0x3655c3['query'][_0xeb03('0x25')]);_0x2d2ddd[_0xeb03('0x23')]=qs[_0xeb03('0x23')](_0x3655c3['query'][_0xeb03('0x23')]);}_0x2d2ddd[_0xeb03('0x42')]=qs['sort'](_0x3655c3['query'][_0xeb03('0x43')]);_0x2d2ddd[_0xeb03('0x44')]=qs['filters'](_[_0xeb03('0x45')](_0x3655c3[_0xeb03('0x3b')],_0x19fa35[_0xeb03('0x3c')]),_0x13efc6);if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x2d2ddd[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x2d2ddd[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x13efc6,function(_0x286f48){if(_0x286f48[_0xeb03('0x37')]!==_0xeb03('0x48')){var _0x2a9348={};_0x2a9348[_0x286f48[_0xeb03('0x49')]]={'$like':'%'+_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x46')]+'%'};return _0x2a9348;}})});}_0x2d2ddd=_[_0xeb03('0x47')]({},_0x2d2ddd,_0x3655c3[_0xeb03('0x4a')]);var _0x35e53d={'where':_0x2d2ddd[_0xeb03('0x44')]};return db[_0xeb03('0x34')][_0xeb03('0x26')](_0x35e53d)[_0xeb03('0x2d')](function(_0x5bb7d9){_0x5234dc['count']=_0x5bb7d9;if(_0x3655c3[_0xeb03('0x3b')][_0xeb03('0x4b')]){_0x2d2ddd[_0xeb03('0x4c')]=[{'all':!![]}];}return db[_0xeb03('0x34')][_0xeb03('0x4d')](_0x2d2ddd);})[_0xeb03('0x2d')](function(_0x103c78){_0x5234dc[_0xeb03('0x4e')]=_0x103c78;return _0x5234dc;})['then'](respondWithFilteredResult(_0x32aff7,_0x2d2ddd))[_0xeb03('0x4f')](handleError(_0x32aff7,null));};exports[_0xeb03('0x50')]=function(_0x275d4d,_0xe9dcb0){var _0x528c0f={'raw':![],'where':{'id':_0x275d4d['params']['id']}},_0x57f59e={};_0x57f59e[_0xeb03('0x39')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x57f59e[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x275d4d[_0xeb03('0x3b')]);_0x57f59e[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x57f59e[_0xeb03('0x39')],_0x57f59e['query']);_0x528c0f[_0xeb03('0x3e')]=_['intersection'](_0x57f59e['model'],qs[_0xeb03('0x52')](_0x275d4d[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x528c0f['attributes']=_0x528c0f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x528c0f[_0xeb03('0x3e')]:_0x57f59e[_0xeb03('0x39')];if(_0x275d4d[_0xeb03('0x3b')]['includeAll']){_0x528c0f[_0xeb03('0x4c')]=[{'all':!![]}];}_0x528c0f=_['merge']({},_0x528c0f,_0x275d4d[_0xeb03('0x4a')]);return db[_0xeb03('0x34')][_0xeb03('0x53')](_0x528c0f)[_0xeb03('0x2d')](handleEntityNotFound(_0xe9dcb0,null))[_0xeb03('0x2d')](respondWithResult(_0xe9dcb0,null))[_0xeb03('0x4f')](handleError(_0xe9dcb0,null));};exports[_0xeb03('0x2e')]=function(_0x292319,_0x38c993){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x292319[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x38c993,null))[_0xeb03('0x2d')](removeEntity(_0x38c993,null))[_0xeb03('0x4f')](handleError(_0x38c993,null));};exports[_0xeb03('0x55')]=function(_0xf5c1ab,_0x79b7c6){return db[_0xeb03('0x34')][_0xeb03('0x55')]()[_0xeb03('0x2d')](respondWithResult(_0x79b7c6,null))[_0xeb03('0x4f')](handleError(_0x79b7c6,null));};exports[_0xeb03('0x56')]=function(_0x365520,_0x509d79){var _0x17112e;return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0x5405b4){return db[_0xeb03('0x34')][_0xeb03('0x56')](_0x365520[_0xeb03('0x59')],{'transaction':_0x5405b4})[_0xeb03('0x2d')](function(_0x103da5){_0x17112e=_0x103da5[_0xeb03('0x2f')]({'plain':!![]});return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x17112e[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x46f52e){return createVoicePrefixExtensions(_0x17112e,_0x46f52e,_0x5405b4);});});})[_0xeb03('0x2d')](function(){var _0xf9beaf=_0x365520[_0xeb03('0x5c')]['get']({'plain':!![]});if(!_0xf9beaf)throw new Error(_0xeb03('0x5d'));if(_0xf9beaf[_0xeb03('0x5e')]===_0xeb03('0x5c')){var _0x259db7=_0x17112e;return db[_0xeb03('0x5f')][_0xeb03('0x53')]({'where':{'name':_0xeb03('0x30'),'userProfileId':_0xf9beaf[_0xeb03('0x60')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x23406a){if(_0x23406a&&_0x23406a['autoAssociation']===0x0){return db[_0xeb03('0x61')][_0xeb03('0x56')]({'name':_0x259db7[_0xeb03('0x49')],'resourceId':_0x259db7['id'],'type':_0x23406a[_0xeb03('0x49')],'sectionId':_0x23406a['id']},{})['then'](function(){return _0x17112e;});}else{return _0x17112e;}})[_0xeb03('0x4f')](function(_0x68e1b7){logger[_0xeb03('0x31')](_0xeb03('0x62'),_0x68e1b7);throw _0x68e1b7;});}return _0x17112e;})[_0xeb03('0x2d')](respondWithResult(_0x509d79,null))['catch'](handleError(_0x509d79,null));};function Extension(_0x43efc3,_0x10beeb,_0x28e488,_0x5e1361){this[_0xeb03('0x63')]=_0xeb03('0x64');this['exten']=_0x43efc3;this[_0xeb03('0x65')]=_0x28e488;this[_0xeb03('0x37')]=_0xeb03('0x66');this['description']=_0xeb03('0x67');this[_0xeb03('0x68')]=_0x10beeb;this['appdata']=_0x5e1361;}function createVoicePrefixExtensions(_0x3eb482,_0xfeb8e2,_0x1972fb){return new BPromise(function(_0x3ac2de,_0x3963a7){var _0x38618e=new Extension(formatPrefixName(_0x3eb482[_0xeb03('0x69')]),0x1,_0xeb03('0x6a'),'Voice\x20Prefix');_0x38618e[_0xeb03('0x6b')]=_0x3eb482['id'];return db['VoiceExtension'][_0xeb03('0x56')](_0x38618e,{'transaction':_0x1972fb})[_0xeb03('0x2d')](function(_0x3a9518){var _0x59d0c7=_0x3a9518[_0xeb03('0x2f')]({'plain':!![]});var _0x1508f6=_[_0xeb03('0x3a')](addVoicePrefixExtensions(_0x3eb482,_0xfeb8e2),function(_0x467a9d){_0x467a9d['VoiceExtensionId']=_0x59d0c7['id'];_0x467a9d[_0xeb03('0x6b')]=_0x3eb482['id'];return _0x467a9d;});return db[_0xeb03('0x5a')]['bulkCreate'](_0x1508f6,{'transaction':_0x1972fb})['then'](function(_0x583518){if(!_0x583518){return _0x3963a7(_0xeb03('0x6c'));}else{return _0x3ac2de(_0x583518);}})[_0xeb03('0x4f')](function(_0x9148a6){return _0x3963a7(_0x9148a6);});});;});};function addVoicePrefixExtensions(_0x16ad3a,_0x3da5f4){var _0x461777=[];var _0x443fc9=formatPrefixName(_0x16ad3a[_0xeb03('0x69')]);_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x2,'Set','CDR(prefix)='+_0x16ad3a[_0xeb03('0x49')]));if(_0x16ad3a[_0xeb03('0x6e')]){_0x461777['push'](new Extension(_0x443fc9,0x3,_0xeb03('0x6f'),_0xeb03('0x70')+_0x16ad3a[_0xeb03('0x6e')]));}else{_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x3,'NoOp','No\x20callerid\x20available'));}_0x461777[_0xeb03('0x6d')](new Extension(_0x443fc9,0x4,_0xeb03('0x71'),_0x3da5f4[_0xeb03('0x63')]+','+_0xeb03('0x72')+(0x8+_0x16ad3a[_0xeb03('0x49')][_0xeb03('0x3f')])+'}'+','+0x1));return _0x461777;}function formatPrefixName(_0x1a8057){var _0x2ee5c1='_';for(var _0x2e67a4=0x0;_0x2e67a4<_0x1a8057[_0xeb03('0x3f')];_0x2e67a4++){if(_0x1a8057[_0xeb03('0x73')](_0x2e67a4)=='-'){_0x2ee5c1+=_0x1a8057['charAt'](_0x2e67a4);}else{_0x2ee5c1+='['+_0x1a8057['charAt'](_0x2e67a4)+']';}}_0x2ee5c1+='.';return _0x2ee5c1;}exports[_0xeb03('0x2c')]=function(_0x4e52a4,_0x1099ff,_0x4cf4f1){var _0x30623a=_0x4e52a4['body'];_0x30623a[_0xeb03('0x69')]=_0xeb03('0x74')+_0x30623a['name']+'-';return db[_0xeb03('0x57')]['transaction'](function(_0x45f0aa){return db['VoicePrefix'][_0xeb03('0x2c')](_0x30623a,{'where':{'id':_0x30623a['id']},'transaction':_0x45f0aa})['then'](function(){return db['VoiceExtension'][_0xeb03('0x2e')]({'where':{'VoicePrefixId':_0x30623a['id']},'transaction':_0x45f0aa})[_0xeb03('0x2d')](function(){return db[_0xeb03('0x5a')][_0xeb03('0x53')]({'where':{'id':_0x30623a[_0xeb03('0x5b')]},'raw':!![]})[_0xeb03('0x2d')](function(_0x39c15d){return createVoicePrefixExtensions(_0x30623a,_0x39c15d,_0x45f0aa);});});});})['then'](function(){return db[_0xeb03('0x34')][_0xeb03('0x75')](_0x30623a['id']);})[_0xeb03('0x2d')](respondWithResult(_0x1099ff,null))[_0xeb03('0x4f')](handleError(_0x1099ff,null));};exports[_0xeb03('0x76')]=function(_0x126a7f,_0x137a98,_0x4fff6e){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x126a7f[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x137a98,null))[_0xeb03('0x2d')](function(_0xcd7ab1){if(_0xcd7ab1){return _0xcd7ab1[_0xeb03('0x76')](_0x126a7f[_0xeb03('0x59')]['ids'],_[_0xeb03('0x77')](_0x126a7f[_0xeb03('0x59')],[_0xeb03('0x78'),'id'])||{})[_0xeb03('0x79')](function(_0x17c010){for(var _0x5ace77=0x0;_0x5ace77<_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0xeb03('0x3f')];_0x5ace77+=0x1){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':Number(_0x126a7f[_0xeb03('0x59')][_0xeb03('0x78')][_0x5ace77]),'VoicePrefixId':Number(_0x126a7f['params']['id'])});}return _0x17c010;});}})[_0xeb03('0x2d')](respondWithResult(_0x137a98,null))[_0xeb03('0x4f')](handleError(_0x137a98,null));};exports[_0xeb03('0x7c')]=function(_0x21dfab,_0x396329,_0x48dc21){return db[_0xeb03('0x34')][_0xeb03('0x53')]({'where':{'id':_0x21dfab[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0x396329,null))[_0xeb03('0x2d')](function(_0x215759){if(_0x215759){return _0x215759[_0xeb03('0x7c')](_0x21dfab['query'][_0xeb03('0x78')])[_0xeb03('0x2d')](function(){if(_[_0xeb03('0x7d')](_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')])){for(var _0x388fbd=0x0;_0x388fbd<_0x21dfab['query'][_0xeb03('0x78')][_0xeb03('0x3f')];_0x388fbd+=0x1){socket[_0xeb03('0x7a')]('userVoicePrefix:remove',{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')][_0x388fbd]),'VoicePrefixId':Number(_0x21dfab[_0xeb03('0x54')]['id'])});}}else{socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':Number(_0x21dfab[_0xeb03('0x3b')][_0xeb03('0x78')]),'VoicePrefixId':Number(_0x21dfab['params']['id'])});}});}})['then'](respondWithStatusCode(_0x396329,null))[_0xeb03('0x4f')](handleError(_0x396329,null));};exports[_0xeb03('0x7f')]=function(_0x3630a7,_0xe55200,_0x511e5a){var _0x8ba377={};var _0x42c477={};var _0x5b60a4;var _0x45fd83;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x3630a7[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](handleEntityNotFound(_0xe55200,null))[_0xeb03('0x2d')](function(_0x5ea593){if(_0x5ea593){_0x5b60a4=_0x5ea593;_0x42c477[_0xeb03('0x39')]=_[_0xeb03('0x51')](db[_0xeb03('0x81')][_0xeb03('0x35')]);_0x42c477[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x3630a7[_0xeb03('0x3b')]);_0x42c477[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x42c477[_0xeb03('0x39')],_0x42c477['query']);_0x8ba377[_0xeb03('0x3e')]=_[_0xeb03('0x3d')](_0x42c477['model'],qs[_0xeb03('0x52')](_0x3630a7[_0xeb03('0x3b')]['fields']));_0x8ba377[_0xeb03('0x3e')]=_0x8ba377[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x8ba377[_0xeb03('0x3e')]:_0x42c477[_0xeb03('0x39')];_0x8ba377['order']=qs['sort'](_0x3630a7['query'][_0xeb03('0x43')]);_0x8ba377['where']=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x3630a7[_0xeb03('0x3b')],_0x42c477[_0xeb03('0x3c')]));if(_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x8ba377[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x8ba377[_0xeb03('0x44')],{'$or':_[_0xeb03('0x3a')](_0x8ba377[_0xeb03('0x3e')],function(_0x27a388){var _0x4ec45c={};_0x4ec45c[_0x27a388]={'$like':'%'+_0x3630a7['query'][_0xeb03('0x46')]+'%'};return _0x4ec45c;})});}_0x8ba377=_['merge']({},_0x8ba377,_0x3630a7['options']);return _0x5b60a4[_0xeb03('0x7f')](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x502b25){if(_0x502b25){_0x45fd83=_0x502b25['length'];if(!_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x40')]('nolimit')){_0x8ba377[_0xeb03('0x25')]=qs[_0xeb03('0x25')](_0x3630a7[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x8ba377[_0xeb03('0x23')]=qs['offset'](_0x3630a7[_0xeb03('0x3b')]['offset']);}return _0x5b60a4['getAgents'](_0x8ba377);}})[_0xeb03('0x2d')](function(_0x2d12eb){if(_0x2d12eb){return _0x2d12eb?{'count':_0x45fd83,'rows':_0x2d12eb}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xe55200,null))[_0xeb03('0x4f')](handleError(_0xe55200,null));};exports['getTeams']=function(_0x4b59f4,_0xf9f2d3,_0x847253){var _0x70343f={};var _0x2d6225={};var _0x388642;var _0x3dc483;return db[_0xeb03('0x34')][_0xeb03('0x80')]({'where':{'id':_0x4b59f4['params']['id']}})['then'](handleEntityNotFound(_0xf9f2d3,null))[_0xeb03('0x2d')](function(_0x5741d4){if(_0x5741d4){_0x388642=_0x5741d4;_0x2d6225[_0xeb03('0x39')]=_['keys'](db[_0xeb03('0x82')][_0xeb03('0x35')]);_0x2d6225[_0xeb03('0x3b')]=_[_0xeb03('0x51')](_0x4b59f4[_0xeb03('0x3b')]);_0x2d6225[_0xeb03('0x3c')]=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],_0x2d6225['query']);_0x70343f['attributes']=_[_0xeb03('0x3d')](_0x2d6225[_0xeb03('0x39')],qs[_0xeb03('0x52')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x52')]));_0x70343f['attributes']=_0x70343f[_0xeb03('0x3e')][_0xeb03('0x3f')]?_0x70343f['attributes']:_0x2d6225[_0xeb03('0x39')];_0x70343f[_0xeb03('0x42')]=qs[_0xeb03('0x43')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x43')]);_0x70343f[_0xeb03('0x44')]=qs[_0xeb03('0x3c')](_[_0xeb03('0x45')](_0x4b59f4[_0xeb03('0x3b')],_0x2d6225[_0xeb03('0x3c')]));if(_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x46')]){_0x70343f[_0xeb03('0x44')]=_[_0xeb03('0x47')](_0x70343f['where'],{'$or':_[_0xeb03('0x3a')](_0x70343f[_0xeb03('0x3e')],function(_0x4c6b85){var _0x1f3ee1={};_0x1f3ee1[_0x4c6b85]={'$like':'%'+_0x4b59f4['query'][_0xeb03('0x46')]+'%'};return _0x1f3ee1;})});}_0x70343f=_['merge']({},_0x70343f,_0x4b59f4[_0xeb03('0x4a')]);return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x1df994){if(_0x1df994){_0x3dc483=_0x1df994[_0xeb03('0x3f')];if(!_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x40')](_0xeb03('0x41'))){_0x70343f['limit']=qs[_0xeb03('0x25')](_0x4b59f4[_0xeb03('0x3b')][_0xeb03('0x25')]);_0x70343f[_0xeb03('0x23')]=qs['offset'](_0x4b59f4[_0xeb03('0x3b')]['offset']);}return _0x388642[_0xeb03('0x83')](_0x70343f);}})[_0xeb03('0x2d')](function(_0x423ddd){if(_0x423ddd){return _0x423ddd?{'count':_0x3dc483,'rows':_0x423ddd}:null;}})[_0xeb03('0x2d')](respondWithResult(_0xf9f2d3,null))['catch'](handleError(_0xf9f2d3,null));};exports[_0xeb03('0x84')]=function(_0x473d63,_0x1fc15a,_0x45f4d3){var _0x5095a6=_0x473d63[_0xeb03('0x59')]['ids'];var _0x4e0fd8;return db['Team'][_0xeb03('0x4d')]({'where':{'id':_0x5095a6},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeb03('0x85'),'attributes':['id',_0xeb03('0x49'),_0xeb03('0x86'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x50b2c5){if(_0x50b2c5){_0x4e0fd8=_0x50b2c5;var _0x5c7f6e=_[_0xeb03('0x87')](_0x50b2c5,function(_0x392aaa){var _0x117c5e=_0x392aaa[_0xeb03('0x2f')]({'plain':!![]});return _0x117c5e[_0xeb03('0x85')];});return db[_0xeb03('0x34')]['find']({'where':{'id':_0x473d63[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x2d8bca){return db[_0xeb03('0x57')]['transaction'](function(_0x5c49c9){return _0x2d8bca[_0xeb03('0x84')](_0x5095a6,{'transaction':_0x5c49c9})[_0xeb03('0x2d')](function(){return BPromise['each'](_0x4e0fd8,function(_0xc7a504){return db[_0xeb03('0x88')][_0xeb03('0x89')]({'TeamId':_0xc7a504['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},{'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){return BPromise[_0xeb03('0x8a')](_0x5c7f6e,function(_0x11cc99){return db['UserVoicePrefix'][_0xeb03('0x8b')]({'where':{'UserId':_0x11cc99['id'],'VoicePrefixId':_0x473d63[_0xeb03('0x54')]['id']},'transaction':_0x5c49c9});});})[_0xeb03('0x2d')](function(){_0x5c7f6e[_0xeb03('0x8c')](function(_0x1f2ebe){socket[_0xeb03('0x7a')](_0xeb03('0x7b'),{'UserId':_0x1f2ebe['id'],'VoicePrefixId':_0x2d8bca['id']});});});});});}})[_0xeb03('0x2d')](respondWithStatusCode(_0x1fc15a,null))['catch'](handleError(_0x1fc15a,null));};exports[_0xeb03('0x8d')]=function(_0x5e0e2b,_0x497a5b,_0x188d39){return db[_0xeb03('0x82')]['findAll']({'where':{'id':_0x5e0e2b[_0xeb03('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xeb03('0x81')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xeb03('0x2d')](handleEntityNotFound(_0x497a5b,null))[_0xeb03('0x2d')](function(_0xd6f37b){var _0x1522d4=_[_0xeb03('0x3a')](_0xd6f37b,'id');var _0x47b648=[];var _0x15a726=[];var _0x226569=squel[_0xeb03('0x8e')]();_0x226569[_0xeb03('0x8f')](_0xeb03('0x90'))[_0xeb03('0x91')](_0xeb03('0x92'),'tq')[_0xeb03('0x93')](_0xeb03('0x94'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('VoicePrefixId\x20=\x20?',_0x5e0e2b[_0xeb03('0x54')]['id']);for(var _0x40a6ce=0x0;_0x40a6ce<_0xd6f37b[_0xeb03('0x3f')];_0x40a6ce+=0x1){let _0x2f640d=_0xd6f37b[_0x40a6ce];for(var _0x546ebe=0x0;_0x546ebe<_0x2f640d['Agents']['length'];_0x546ebe+=0x1){let _0x3d861f=_0x2f640d[_0xeb03('0x85')][_0x546ebe];var _0x2c89c4=_0x226569[_0xeb03('0x95')]();_0x2c89c4[_0xeb03('0x44')]('ut.UserId\x20=\x20?',_0x3d861f['id']);_0x15a726[_0xeb03('0x6d')](db[_0xeb03('0x57')]['query'](_0x2c89c4[_0xeb03('0x96')](),{'type':db['sequelize']['QueryTypes'][_0xeb03('0x97')]})[_0xeb03('0x2d')](function(_0x123742){if(_0x123742['length']===0x1){return _0x3d861f['id'];}else{var _0x243689=_[_0xeb03('0x98')](_['map'](_0x123742,_0xeb03('0x99')),function(_0x5eb15a){return _['includes'](_0x1522d4,_0x5eb15a);});if(_0x243689){return _0x3d861f['id'];}}}));}}return BPromise[_0xeb03('0x9a')](_0x15a726)[_0xeb03('0x2d')](function(_0x366054){_0x47b648=_(_0x47b648)[_0xeb03('0x9b')](_0x366054)[_0xeb03('0x9c')]()[_0xeb03('0x9d')]();return db['VoicePrefix'][_0xeb03('0x53')]({'where':{'id':_0x5e0e2b[_0xeb03('0x54')]['id']}})[_0xeb03('0x2d')](function(_0x1f0387){return db[_0xeb03('0x57')][_0xeb03('0x58')](function(_0xf0d912){return _0x1f0387[_0xeb03('0x8d')](_0x5e0e2b[_0xeb03('0x3b')][_0xeb03('0x78')],{'transaction':_0xf0d912})[_0xeb03('0x2d')](function(){if(!_[_0xeb03('0x9e')](_0x47b648)){return _0x1f0387[_0xeb03('0x7c')](_0x47b648,{'transaction':_0xf0d912});}})[_0xeb03('0x2d')](function(){_0x47b648[_0xeb03('0x8c')](function(_0x1a0bb5){socket[_0xeb03('0x7a')](_0xeb03('0x7e'),{'UserId':_0x1a0bb5,'VoicePrefixId':_0x1f0387['id']});});});});});});})[_0xeb03('0x2d')](respondWithStatusCode(_0x497a5b,null))[_0xeb03('0x4f')](handleError(_0x497a5b,null));}; \ No newline at end of file +var _0x4991=['VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','describe','create','transaction','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','NoOp','goto','context','charAt','system-','findById','addAgents','ids','omit','emit','isArray','userVoicePrefix:remove','getAgents','findOne','pick','getTeams','Team','findAll','User','interface','Agents','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','every','includes','all','union','compact','value','isEmpty','removeAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','map'];(function(_0x5887ec,_0x504c12){var _0x23b637=function(_0x3f720f){while(--_0x3f720f){_0x5887ec['push'](_0x5887ec['shift']());}};_0x23b637(++_0x504c12);}(_0x4991,0xf7));var _0x1499=function(_0x32e97b,_0x173b20){_0x32e97b=_0x32e97b-0x0;var _0x30132d=_0x4991[_0x32e97b];return _0x30132d;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1499('0x17')]=_[_0x1499('0x18')](config[_0x1499('0x17')],{'host':_0x1499('0x19'),'port':0x18eb});var socket=require(_0x1499('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x1499('0x1b')](socket);function respondWithStatusCode(_0x4e5195,_0x37d99e){_0x37d99e=_0x37d99e||0xcc;return function(_0x12cde0){if(_0x12cde0){return _0x4e5195[_0x1499('0x1c')](_0x37d99e);}return _0x4e5195[_0x1499('0x1d')](_0x37d99e)['end']();};}function respondWithResult(_0x1ed43b,_0x373f57){_0x373f57=_0x373f57||0xc8;return function(_0x592c27){if(_0x592c27){return _0x1ed43b[_0x1499('0x1d')](_0x373f57)[_0x1499('0x1e')](_0x592c27);}};}function respondWithFilteredResult(_0x46b364,_0xc92272){return function(_0x1e45a9){if(_0x1e45a9){var _0x27e533=typeof _0xc92272['offset']==='undefined'&&typeof _0xc92272['limit']===_0x1499('0x1f');var _0xad534b=_0x1e45a9['count'];var _0x351da9=_0x27e533?0x0:_0xc92272[_0x1499('0x20')];var _0x28dff3=_0x27e533?_0x1e45a9[_0x1499('0x21')]:_0xc92272[_0x1499('0x20')]+_0xc92272[_0x1499('0x22')];var _0x2b0458;if(_0x28dff3>=_0xad534b){_0x28dff3=_0xad534b;_0x2b0458=0xc8;}else{_0x2b0458=0xce;}_0x46b364[_0x1499('0x1d')](_0x2b0458);return _0x46b364[_0x1499('0x23')](_0x1499('0x24'),_0x351da9+'-'+_0x28dff3+'/'+_0xad534b)[_0x1499('0x1e')](_0x1e45a9);}return null;};}function patchUpdates(_0x836081){return function(_0x223f4c){try{jsonpatch[_0x1499('0x25')](_0x223f4c,_0x836081,!![]);}catch(_0x4ec57a){return BPromise[_0x1499('0x26')](_0x4ec57a);}return _0x223f4c[_0x1499('0x27')]();};}function saveUpdates(_0x5615b4,_0x258e9c){return function(_0xc79f69){if(_0xc79f69){return _0xc79f69[_0x1499('0x28')](_0x5615b4)[_0x1499('0x29')](function(_0x3968e0){return _0x3968e0;});}return null;};}function removeEntity(_0x16d036,_0x54f3c2){return function(_0x501c0d){if(_0x501c0d){return _0x501c0d[_0x1499('0x2a')]()[_0x1499('0x29')](function(){var _0x3b9259=_0x501c0d[_0x1499('0x2b')]({'plain':!![]});var _0x32782a='VoicePrefixes';return db[_0x1499('0x2c')]['destroy']({'where':{'type':_0x32782a,'resourceId':_0x3b9259['id']}})['then'](function(){return _0x501c0d;});})['then'](function(){_0x16d036[_0x1499('0x1d')](0xcc)[_0x1499('0x2d')]();});}};}function handleEntityNotFound(_0x40932a,_0x1b460b){return function(_0x3dad86){if(!_0x3dad86){_0x40932a[_0x1499('0x1c')](0x194);}return _0x3dad86;};}function handleError(_0x3dd534,_0x5d3ec5){_0x5d3ec5=_0x5d3ec5||0x1f4;return function(_0x180171){logger[_0x1499('0x2e')](_0x180171[_0x1499('0x2f')]);if(_0x180171['name']){delete _0x180171[_0x1499('0x30')];}_0x3dd534[_0x1499('0x1d')](_0x5d3ec5)['send'](_0x180171);};}exports[_0x1499('0x31')]=function(_0x72ad,_0x497efd){var _0x464c5a={},_0x2eda80={},_0x15cc57={'count':0x0,'rows':[]};var _0x39f74f=_[_0x1499('0x32')](db[_0x1499('0x33')][_0x1499('0x34')],function(_0x18b662){return{'name':_0x18b662[_0x1499('0x35')],'type':_0x18b662[_0x1499('0x36')][_0x1499('0x37')]};});_0x2eda80[_0x1499('0x38')]=_[_0x1499('0x32')](_0x39f74f,_0x1499('0x30'));_0x2eda80[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x72ad[_0x1499('0x39')]);_0x2eda80[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],_0x2eda80['query']);_0x464c5a[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],qs[_0x1499('0x3e')](_0x72ad[_0x1499('0x39')][_0x1499('0x3e')]));_0x464c5a[_0x1499('0x3d')]=_0x464c5a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x464c5a[_0x1499('0x3d')]:_0x2eda80[_0x1499('0x38')];if(!_0x72ad['query']['hasOwnProperty'](_0x1499('0x40'))){_0x464c5a['limit']=qs[_0x1499('0x22')](_0x72ad['query'][_0x1499('0x22')]);_0x464c5a[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x72ad[_0x1499('0x39')]['offset']);}_0x464c5a[_0x1499('0x41')]=qs['sort'](_0x72ad[_0x1499('0x39')][_0x1499('0x42')]);_0x464c5a[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x72ad[_0x1499('0x39')],_0x2eda80[_0x1499('0x3b')]),_0x39f74f);if(_0x72ad[_0x1499('0x39')][_0x1499('0x44')]){_0x464c5a['where']=_[_0x1499('0x45')](_0x464c5a['where'],{'$or':_[_0x1499('0x32')](_0x39f74f,function(_0x38f449){if(_0x38f449[_0x1499('0x36')]!==_0x1499('0x46')){var _0x3ed978={};_0x3ed978[_0x38f449[_0x1499('0x30')]]={'$like':'%'+_0x72ad[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x3ed978;}})});}_0x464c5a=_[_0x1499('0x45')]({},_0x464c5a,_0x72ad[_0x1499('0x47')]);var _0x5ab521={'where':_0x464c5a[_0x1499('0x43')]};return db['VoicePrefix'][_0x1499('0x21')](_0x5ab521)[_0x1499('0x29')](function(_0x5646cf){_0x15cc57[_0x1499('0x21')]=_0x5646cf;if(_0x72ad[_0x1499('0x39')][_0x1499('0x48')]){_0x464c5a[_0x1499('0x49')]=[{'all':!![]}];}return db[_0x1499('0x33')]['findAll'](_0x464c5a);})['then'](function(_0x368fdb){_0x15cc57[_0x1499('0x4a')]=_0x368fdb;return _0x15cc57;})['then'](respondWithFilteredResult(_0x497efd,_0x464c5a))[_0x1499('0x4b')](handleError(_0x497efd,null));};exports[_0x1499('0x4c')]=function(_0x4a5529,_0x5de9b6){var _0x3814aa={'raw':![],'where':{'id':_0x4a5529[_0x1499('0x4d')]['id']}},_0x177147={};_0x177147['model']=_[_0x1499('0x3a')](db[_0x1499('0x33')][_0x1499('0x34')]);_0x177147[_0x1499('0x39')]=_['keys'](_0x4a5529[_0x1499('0x39')]);_0x177147[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],_0x177147['query']);_0x3814aa[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],qs['fields'](_0x4a5529['query'][_0x1499('0x3e')]));_0x3814aa['attributes']=_0x3814aa[_0x1499('0x3d')][_0x1499('0x3f')]?_0x3814aa[_0x1499('0x3d')]:_0x177147[_0x1499('0x38')];if(_0x4a5529[_0x1499('0x39')][_0x1499('0x48')]){_0x3814aa[_0x1499('0x49')]=[{'all':!![]}];}_0x3814aa=_['merge']({},_0x3814aa,_0x4a5529[_0x1499('0x47')]);return db['VoicePrefix'][_0x1499('0x4e')](_0x3814aa)[_0x1499('0x29')](handleEntityNotFound(_0x5de9b6,null))['then'](respondWithResult(_0x5de9b6,null))[_0x1499('0x4b')](handleError(_0x5de9b6,null));};exports[_0x1499('0x2a')]=function(_0x3de674,_0x4d1d24){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x3de674[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x4d1d24,null))[_0x1499('0x29')](removeEntity(_0x4d1d24,null))[_0x1499('0x4b')](handleError(_0x4d1d24,null));};exports[_0x1499('0x4f')]=function(_0x3b7a6b,_0x28822a){return db[_0x1499('0x33')]['describe']()[_0x1499('0x29')](respondWithResult(_0x28822a,null))[_0x1499('0x4b')](handleError(_0x28822a,null));};exports[_0x1499('0x50')]=function(_0x4dc648,_0x339471){var _0x2a7614;return db['sequelize'][_0x1499('0x51')](function(_0x162ddb){return db['VoicePrefix'][_0x1499('0x50')](_0x4dc648[_0x1499('0x52')],{'transaction':_0x162ddb})[_0x1499('0x29')](function(_0x30b27b){_0x2a7614=_0x30b27b[_0x1499('0x2b')]({'plain':!![]});return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x2a7614['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x2a9f23){return createVoicePrefixExtensions(_0x2a7614,_0x2a9f23,_0x162ddb);});});})[_0x1499('0x29')](function(){var _0x175b8d=_0x4dc648['user']['get']({'plain':!![]});if(!_0x175b8d)throw new Error(_0x1499('0x54'));if(_0x175b8d[_0x1499('0x55')]==='user'){var _0x3c3a20=_0x2a7614;return db[_0x1499('0x56')][_0x1499('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x175b8d['userProfileId']},'raw':!![]})['then'](function(_0x308ce2){if(_0x308ce2&&_0x308ce2[_0x1499('0x57')]===0x0){return db[_0x1499('0x2c')]['create']({'name':_0x3c3a20[_0x1499('0x30')],'resourceId':_0x3c3a20['id'],'type':_0x308ce2['name'],'sectionId':_0x308ce2['id']},{})[_0x1499('0x29')](function(){return _0x2a7614;});}else{return _0x2a7614;}})[_0x1499('0x4b')](function(_0x2fc6f9){logger[_0x1499('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fc6f9);throw _0x2fc6f9;});}return _0x2a7614;})['then'](respondWithResult(_0x339471,null))['catch'](handleError(_0x339471,null));};function Extension(_0x403832,_0x42629d,_0x1e9261,_0x28866f){this['context']=_0x1499('0x58');this[_0x1499('0x59')]=_0x403832;this['app']=_0x1e9261;this[_0x1499('0x36')]='system';this[_0x1499('0x5a')]=_0x1499('0x5b');this[_0x1499('0x5c')]=_0x42629d;this['appdata']=_0x28866f;}function createVoicePrefixExtensions(_0x739e63,_0xca5326,_0x253706){return new BPromise(function(_0x5b2dab,_0x761610){var _0x3ff1ce=new Extension(formatPrefixName(_0x739e63[_0x1499('0x5d')]),0x1,'NoOp',_0x1499('0x5e'));_0x3ff1ce[_0x1499('0x5f')]=_0x739e63['id'];return db[_0x1499('0x53')][_0x1499('0x50')](_0x3ff1ce,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x96a0ed){var _0x5c61dc=_0x96a0ed[_0x1499('0x2b')]({'plain':!![]});var _0x10b49f=_['map'](addVoicePrefixExtensions(_0x739e63,_0xca5326),function(_0x3839da){_0x3839da[_0x1499('0x60')]=_0x5c61dc['id'];_0x3839da[_0x1499('0x5f')]=_0x739e63['id'];return _0x3839da;});return db[_0x1499('0x53')][_0x1499('0x61')](_0x10b49f,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x5e5ee4){if(!_0x5e5ee4){return _0x761610(_0x1499('0x62'));}else{return _0x5b2dab(_0x5e5ee4);}})[_0x1499('0x4b')](function(_0x4eec83){return _0x761610(_0x4eec83);});});;});};function addVoicePrefixExtensions(_0x4a0487,_0x1ff29d){var _0x314d88=[];var _0x502474=formatPrefixName(_0x4a0487[_0x1499('0x5d')]);_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x2,_0x1499('0x64'),_0x1499('0x65')+_0x4a0487[_0x1499('0x30')]));if(_0x4a0487['callerIdAll']){_0x314d88['push'](new Extension(_0x502474,0x3,_0x1499('0x64'),'PREFIX-CALLERIDALL='+_0x4a0487['callerIdAll']));}else{_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x3,_0x1499('0x66'),'No\x20callerid\x20available'));}_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x4,_0x1499('0x67'),_0x1ff29d[_0x1499('0x68')]+','+'${EXTEN:'+(0x8+_0x4a0487['name'][_0x1499('0x3f')])+'}'+','+0x1));return _0x314d88;}function formatPrefixName(_0x2f3a3a){var _0x256893='_';for(var _0x392f6f=0x0;_0x392f6f<_0x2f3a3a[_0x1499('0x3f')];_0x392f6f++){if(_0x2f3a3a['charAt'](_0x392f6f)=='-'){_0x256893+=_0x2f3a3a[_0x1499('0x69')](_0x392f6f);}else{_0x256893+='['+_0x2f3a3a[_0x1499('0x69')](_0x392f6f)+']';}}_0x256893+='.';return _0x256893;}exports['update']=function(_0x358a76,_0x20e5f3,_0x44d970){var _0x5741e5=_0x358a76[_0x1499('0x52')];_0x5741e5[_0x1499('0x5d')]=_0x1499('0x6a')+_0x5741e5[_0x1499('0x30')]+'-';return db['sequelize'][_0x1499('0x51')](function(_0x74e09b){return db[_0x1499('0x33')]['update'](_0x5741e5,{'where':{'id':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x2a')]({'where':{'VoicePrefixId':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x5741e5['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x57e25b){return createVoicePrefixExtensions(_0x5741e5,_0x57e25b,_0x74e09b);});});});})['then'](function(){return db[_0x1499('0x33')][_0x1499('0x6b')](_0x5741e5['id']);})[_0x1499('0x29')](respondWithResult(_0x20e5f3,null))['catch'](handleError(_0x20e5f3,null));};exports['addAgents']=function(_0x320654,_0xb4a84b,_0x494d88){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x320654[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0xb4a84b,null))[_0x1499('0x29')](function(_0x3f6f36){if(_0x3f6f36){return _0x3f6f36[_0x1499('0x6c')](_0x320654['body'][_0x1499('0x6d')],_[_0x1499('0x6e')](_0x320654['body'],[_0x1499('0x6d'),'id'])||{})['spread'](function(_0x25a8c4){for(var _0x375576=0x0;_0x375576<_0x320654[_0x1499('0x52')][_0x1499('0x6d')]['length'];_0x375576+=0x1){socket[_0x1499('0x6f')]('userVoicePrefix:save',{'UserId':Number(_0x320654[_0x1499('0x52')]['ids'][_0x375576]),'VoicePrefixId':Number(_0x320654[_0x1499('0x4d')]['id'])});}return _0x25a8c4;});}})[_0x1499('0x29')](respondWithResult(_0xb4a84b,null))[_0x1499('0x4b')](handleError(_0xb4a84b,null));};exports['removeAgents']=function(_0x2349d7,_0x44511c,_0x585fe8){return db['VoicePrefix'][_0x1499('0x4e')]({'where':{'id':_0x2349d7['params']['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x44511c,null))['then'](function(_0x917508){if(_0x917508){return _0x917508['removeAgents'](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])[_0x1499('0x29')](function(){if(_[_0x1499('0x70')](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])){for(var _0x114aea=0x0;_0x114aea<_0x2349d7[_0x1499('0x39')]['ids'][_0x1499('0x3f')];_0x114aea+=0x1){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':Number(_0x2349d7['query'][_0x1499('0x6d')][_0x114aea]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}}else{socket['emit'](_0x1499('0x71'),{'UserId':Number(_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}});}})[_0x1499('0x29')](respondWithStatusCode(_0x44511c,null))['catch'](handleError(_0x44511c,null));};exports[_0x1499('0x72')]=function(_0x53700c,_0x5ed058,_0x5cc567){var _0x2a0525={};var _0x362d8c={};var _0x419d9a;var _0x23dfc0;return db[_0x1499('0x33')][_0x1499('0x73')]({'where':{'id':_0x53700c['params']['id']}})['then'](handleEntityNotFound(_0x5ed058,null))[_0x1499('0x29')](function(_0x20e0d7){if(_0x20e0d7){_0x419d9a=_0x20e0d7;_0x362d8c['model']=_[_0x1499('0x3a')](db['User'][_0x1499('0x34')]);_0x362d8c['query']=_[_0x1499('0x3a')](_0x53700c['query']);_0x362d8c[_0x1499('0x3b')]=_['intersection'](_0x362d8c[_0x1499('0x38')],_0x362d8c[_0x1499('0x39')]);_0x2a0525['attributes']=_[_0x1499('0x3c')](_0x362d8c[_0x1499('0x38')],qs['fields'](_0x53700c[_0x1499('0x39')][_0x1499('0x3e')]));_0x2a0525[_0x1499('0x3d')]=_0x2a0525[_0x1499('0x3d')][_0x1499('0x3f')]?_0x2a0525[_0x1499('0x3d')]:_0x362d8c[_0x1499('0x38')];_0x2a0525['order']=qs[_0x1499('0x42')](_0x53700c[_0x1499('0x39')]['sort']);_0x2a0525[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x53700c[_0x1499('0x39')],_0x362d8c[_0x1499('0x3b')]));if(_0x53700c['query'][_0x1499('0x44')]){_0x2a0525[_0x1499('0x43')]=_[_0x1499('0x45')](_0x2a0525[_0x1499('0x43')],{'$or':_[_0x1499('0x32')](_0x2a0525[_0x1499('0x3d')],function(_0x1f4794){var _0x43b74b={};_0x43b74b[_0x1f4794]={'$like':'%'+_0x53700c['query'][_0x1499('0x44')]+'%'};return _0x43b74b;})});}_0x2a0525=_[_0x1499('0x45')]({},_0x2a0525,_0x53700c[_0x1499('0x47')]);return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x3fa3a4){if(_0x3fa3a4){_0x23dfc0=_0x3fa3a4['length'];if(!_0x53700c['query']['hasOwnProperty'](_0x1499('0x40'))){_0x2a0525[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x53700c[_0x1499('0x39')][_0x1499('0x22')]);_0x2a0525[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x53700c[_0x1499('0x39')]['offset']);}return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x59a12f){if(_0x59a12f){return _0x59a12f?{'count':_0x23dfc0,'rows':_0x59a12f}:null;}})['then'](respondWithResult(_0x5ed058,null))[_0x1499('0x4b')](handleError(_0x5ed058,null));};exports['getTeams']=function(_0x52282e,_0x5666f5,_0x63c7b3){var _0x118d7a={};var _0x23fd46={};var _0x30ba76;var _0x3c91d2;return db['VoicePrefix']['findOne']({'where':{'id':_0x52282e[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x5666f5,null))[_0x1499('0x29')](function(_0x497619){if(_0x497619){_0x30ba76=_0x497619;_0x23fd46[_0x1499('0x38')]=_['keys'](db['Team'][_0x1499('0x34')]);_0x23fd46['query']=_[_0x1499('0x3a')](_0x52282e['query']);_0x23fd46[_0x1499('0x3b')]=_['intersection'](_0x23fd46[_0x1499('0x38')],_0x23fd46[_0x1499('0x39')]);_0x118d7a['attributes']=_[_0x1499('0x3c')](_0x23fd46['model'],qs[_0x1499('0x3e')](_0x52282e[_0x1499('0x39')][_0x1499('0x3e')]));_0x118d7a[_0x1499('0x3d')]=_0x118d7a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x118d7a[_0x1499('0x3d')]:_0x23fd46[_0x1499('0x38')];_0x118d7a[_0x1499('0x41')]=qs[_0x1499('0x42')](_0x52282e[_0x1499('0x39')][_0x1499('0x42')]);_0x118d7a[_0x1499('0x43')]=qs['filters'](_[_0x1499('0x74')](_0x52282e[_0x1499('0x39')],_0x23fd46[_0x1499('0x3b')]));if(_0x52282e[_0x1499('0x39')]['filter']){_0x118d7a[_0x1499('0x43')]=_[_0x1499('0x45')](_0x118d7a['where'],{'$or':_['map'](_0x118d7a[_0x1499('0x3d')],function(_0x1fbf21){var _0x2d4e5a={};_0x2d4e5a[_0x1fbf21]={'$like':'%'+_0x52282e[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x2d4e5a;})});}_0x118d7a=_[_0x1499('0x45')]({},_0x118d7a,_0x52282e[_0x1499('0x47')]);return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})[_0x1499('0x29')](function(_0x2dd404){if(_0x2dd404){_0x3c91d2=_0x2dd404['length'];if(!_0x52282e['query']['hasOwnProperty'](_0x1499('0x40'))){_0x118d7a[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x52282e[_0x1499('0x39')][_0x1499('0x22')]);_0x118d7a[_0x1499('0x20')]=qs['offset'](_0x52282e[_0x1499('0x39')][_0x1499('0x20')]);}return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})['then'](function(_0x4a11e4){if(_0x4a11e4){return _0x4a11e4?{'count':_0x3c91d2,'rows':_0x4a11e4}:null;}})[_0x1499('0x29')](respondWithResult(_0x5666f5,null))[_0x1499('0x4b')](handleError(_0x5666f5,null));};exports['addTeams']=function(_0x47f7e8,_0x4e5f60,_0x2f9c93){var _0x23e2c6=_0x47f7e8['body'][_0x1499('0x6d')];var _0x7dd273;return db[_0x1499('0x76')][_0x1499('0x77')]({'where':{'id':_0x23e2c6},'attributes':['id'],'include':[{'model':db[_0x1499('0x78')],'as':'Agents','attributes':['id','name','online','voicePause',_0x1499('0x79')],'raw':!![]}]})[_0x1499('0x29')](function(_0x14e4e8){if(_0x14e4e8){_0x7dd273=_0x14e4e8;var _0x5a675b=_['flatMap'](_0x14e4e8,function(_0x479936){var _0x2add75=_0x479936[_0x1499('0x2b')]({'plain':!![]});return _0x2add75[_0x1499('0x7a')];});return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x47f7e8[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](function(_0x420576){return db[_0x1499('0x7b')]['transaction'](function(_0x3f5aab){return _0x420576['addTeams'](_0x23e2c6,{'transaction':_0x3f5aab})[_0x1499('0x29')](function(){return BPromise[_0x1499('0x7c')](_0x7dd273,function(_0x425dac){return db[_0x1499('0x7d')][_0x1499('0x7e')]({'TeamId':_0x425dac['id'],'VoicePrefixId':_0x47f7e8[_0x1499('0x4d')]['id']},{'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){return BPromise['each'](_0x5a675b,function(_0x56507a){return db[_0x1499('0x7f')][_0x1499('0x80')]({'where':{'UserId':_0x56507a['id'],'VoicePrefixId':_0x47f7e8['params']['id']},'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){_0x5a675b[_0x1499('0x81')](function(_0x477bb9){socket['emit']('userVoicePrefix:save',{'UserId':_0x477bb9['id'],'VoicePrefixId':_0x420576['id']});});});});});}})[_0x1499('0x29')](respondWithStatusCode(_0x4e5f60,null))['catch'](handleError(_0x4e5f60,null));};exports[_0x1499('0x82')]=function(_0x3f366a,_0x11ef6,_0x548faf){return db['Team']['findAll']({'where':{'id':_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1499('0x7a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x11ef6,null))['then'](function(_0x10f4cf){var _0x5d1170=_['map'](_0x10f4cf,'id');var _0x52de11=[];var _0x2e39ac=[];var _0x4a9e81=squel[_0x1499('0x83')]();_0x4a9e81[_0x1499('0x84')](_0x1499('0x85'))[_0x1499('0x86')](_0x1499('0x87'),'tq')['join'](_0x1499('0x88'),'ut',_0x1499('0x89'))[_0x1499('0x43')]('VoicePrefixId\x20=\x20?',_0x3f366a[_0x1499('0x4d')]['id']);for(var _0x772b0c=0x0;_0x772b0c<_0x10f4cf[_0x1499('0x3f')];_0x772b0c+=0x1){let _0x27135a=_0x10f4cf[_0x772b0c];for(var _0x1e9c28=0x0;_0x1e9c28<_0x27135a[_0x1499('0x7a')][_0x1499('0x3f')];_0x1e9c28+=0x1){let _0x2c1793=_0x27135a['Agents'][_0x1e9c28];var _0x39d6a9=_0x4a9e81[_0x1499('0x8a')]();_0x39d6a9[_0x1499('0x43')]('ut.UserId\x20=\x20?',_0x2c1793['id']);_0x2e39ac[_0x1499('0x63')](db[_0x1499('0x7b')][_0x1499('0x39')](_0x39d6a9[_0x1499('0x8b')](),{'type':db[_0x1499('0x7b')][_0x1499('0x8c')]['SELECT']})[_0x1499('0x29')](function(_0x18d9bc){if(_0x18d9bc['length']===0x1){return _0x2c1793['id'];}else{var _0x271d85=_[_0x1499('0x8d')](_[_0x1499('0x32')](_0x18d9bc,'TeamId'),function(_0x53659b){return _[_0x1499('0x8e')](_0x5d1170,_0x53659b);});if(_0x271d85){return _0x2c1793['id'];}}}));}}return BPromise[_0x1499('0x8f')](_0x2e39ac)[_0x1499('0x29')](function(_0x6478eb){_0x52de11=_(_0x52de11)[_0x1499('0x90')](_0x6478eb)[_0x1499('0x91')]()[_0x1499('0x92')]();return db[_0x1499('0x33')]['find']({'where':{'id':_0x3f366a['params']['id']}})['then'](function(_0x335af4){return db[_0x1499('0x7b')]['transaction'](function(_0x2c5702){return _0x335af4['removeTeams'](_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')],{'transaction':_0x2c5702})['then'](function(){if(!_[_0x1499('0x93')](_0x52de11)){return _0x335af4[_0x1499('0x94')](_0x52de11,{'transaction':_0x2c5702});}})[_0x1499('0x29')](function(){_0x52de11['forEach'](function(_0x3e7f29){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':_0x3e7f29,'VoicePrefixId':_0x335af4['id']});});});});});});})[_0x1499('0x29')](respondWithStatusCode(_0x11ef6,null))[_0x1499('0x4b')](handleError(_0x11ef6,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 89bb9c5..43b9e0c 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 _0xe5d9=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit'];(function(_0x47aca7,_0x146518){var _0x524aef=function(_0x3ddac1){while(--_0x3ddac1){_0x47aca7['push'](_0x47aca7['shift']());}};_0x524aef(++_0x146518);}(_0xe5d9,0x192));var _0x9e5d=function(_0x46c865,_0x154b2f){_0x46c865=_0x46c865-0x0;var _0x200973=_0xe5d9[_0x46c865];return _0x200973;};'use strict';var EventEmitter=require(_0x9e5d('0x0'));var VoicePrefix=require(_0x9e5d('0x1'))['db'][_0x9e5d('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9e5d('0x3')](0x0);var events={'afterCreate':_0x9e5d('0x4'),'afterUpdate':_0x9e5d('0x5'),'afterDestroy':_0x9e5d('0x6')};function emitEvent(_0x1d53e2){return function(_0x187318,_0x334bf0,_0x408954){VoicePrefixEvents[_0x9e5d('0x7')](_0x1d53e2+':'+_0x187318['id'],_0x187318);VoicePrefixEvents[_0x9e5d('0x7')](_0x1d53e2,_0x187318);_0x408954(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x9e5d('0x8')](e,emitEvent(event));}}module[_0x9e5d('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x60f1=['emit','hook','exports','events','VoicePrefix','save','update','remove'];(function(_0x1872b9,_0x32d5b8){var _0x2a2eb6=function(_0x1bbc58){while(--_0x1bbc58){_0x1872b9['push'](_0x1872b9['shift']());}};_0x2a2eb6(++_0x32d5b8);}(_0x60f1,0x6b));var _0x160f=function(_0x3a2deb,_0x2f8c2d){_0x3a2deb=_0x3a2deb-0x0;var _0x203ab0=_0x60f1[_0x3a2deb];return _0x203ab0;};'use strict';var EventEmitter=require(_0x160f('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x160f('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x160f('0x2'),'afterUpdate':_0x160f('0x3'),'afterDestroy':_0x160f('0x4')};function emitEvent(_0x53af72){return function(_0x25df29,_0x1f7d8c,_0x15cb0c){VoicePrefixEvents[_0x160f('0x5')](_0x53af72+':'+_0x25df29['id'],_0x25df29);VoicePrefixEvents[_0x160f('0x5')](_0x53af72,_0x25df29);_0x15cb0c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x160f('0x6')](e,emitEvent(event));}}module[_0x160f('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 6bbc884..d8a4641 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 _0xb67c=['api','moment','bluebird','path','rimraf','exports','VoicePrefix','voice_prefixes','util'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xb67c,0x155));var _0xcb67=function(_0x35a0e2,_0x302ad1){_0x35a0e2=_0x35a0e2-0x0;var _0x31ea9a=_0xb67c[_0x35a0e2];return _0x31ea9a;};'use strict';var _=require('lodash');var util=require(_0xcb67('0x0'));var logger=require('../../config/logger')(_0xcb67('0x1'));var moment=require(_0xcb67('0x2'));var BPromise=require(_0xcb67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb67('0x4'));var rimraf=require(_0xcb67('0x5'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0xcb67('0x6')]=function(_0x5d87f3,_0x130f24){return _0x5d87f3['define'](_0xcb67('0x7'),attributes,{'tableName':_0xcb67('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf903=['define','voice_prefixes','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x173f13,_0x4ea3cf){var _0x585942=function(_0x96d7d5){while(--_0x96d7d5){_0x173f13['push'](_0x173f13['shift']());}};_0x585942(++_0x4ea3cf);}(_0xf903,0x12b));var _0x3f90=function(_0x548c1d,_0x4e6a09){_0x548c1d=_0x548c1d-0x0;var _0x21ce9f=_0xf903[_0x548c1d];return _0x21ce9f;};'use strict';var _=require(_0x3f90('0x0'));var util=require(_0x3f90('0x1'));var logger=require(_0x3f90('0x2'))('api');var moment=require(_0x3f90('0x3'));var BPromise=require(_0x3f90('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f90('0x5'));var rimraf=require('rimraf');var config=require(_0x3f90('0x6'));var attributes=require(_0x3f90('0x7'));module[_0x3f90('0x8')]=function(_0x4f9510,_0x5f00b3){return _0x4f9510[_0x3f90('0x9')]('VoicePrefix',attributes,{'tableName':_0x3f90('0xa'),'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 7bfdf7a..ea27be4 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 _0x6144=['register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x141fba,_0x5d3b47){var _0x54568e=function(_0x2b79cf){while(--_0x2b79cf){_0x141fba['push'](_0x141fba['shift']());}};_0x54568e(++_0x5d3b47);}(_0x6144,0x99));var _0x4614=function(_0x4b69f9,_0x352ea9){_0x4b69f9=_0x4b69f9-0x0;var _0x1c1a47=_0x6144[_0x4b69f9];return _0x1c1a47;};'use strict';var _=require(_0x4614('0x0'));var util=require(_0x4614('0x1'));var moment=require(_0x4614('0x2'));var BPromise=require(_0x4614('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4614('0x4'));var db=require(_0x4614('0x5'))['db'];var utils=require(_0x4614('0x6'));var logger=require(_0x4614('0x7'))('rpc');var config=require(_0x4614('0x8'));var jayson=require(_0x4614('0x9'));var client=jayson[_0x4614('0xa')][_0x4614('0xb')]({'port':0x232a});config[_0x4614('0xc')]=_['defaults'](config[_0x4614('0xc')],{'host':_0x4614('0xd'),'port':0x18eb});var socket=require(_0x4614('0xe'))(new Redis(config[_0x4614('0xc')]));require('./voicePrefix.socket')[_0x4614('0xf')](socket);function respondWithRpcPromise(_0x3953bd,_0x7df8c,_0x3c339c){return new BPromise(function(_0x270e8d,_0x2b0439){return client[_0x4614('0x10')](_0x3953bd,_0x3c339c)['then'](function(_0x3f4202){logger[_0x4614('0x11')](_0x4614('0x12'),_0x7df8c,_0x4614('0x13'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x7df8c,_0x4614('0x13'),JSON[_0x4614('0x14')](_0x3f4202));if(_0x3f4202[_0x4614('0x15')]){if(_0x3f4202['error']['code']===0x1f4){logger['error'](_0x4614('0x12'),_0x7df8c,_0x3f4202[_0x4614('0x15')]['message']);return _0x2b0439(_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);}logger[_0x4614('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x7df8c,_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);return _0x270e8d(_0x3f4202[_0x4614('0x15')][_0x4614('0x16')]);}else{logger[_0x4614('0x11')](_0x4614('0x12'),_0x7df8c,'request\x20sent');_0x270e8d(_0x3f4202[_0x4614('0x17')][_0x4614('0x16')]);}})['catch'](function(_0xb8c6fd){logger[_0x4614('0x15')](_0x4614('0x12'),_0x7df8c,_0xb8c6fd);_0x2b0439(_0xb8c6fd);});});} \ No newline at end of file +var _0x81c6=['VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','then'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x81c6,0x1d5));var _0x681c=function(_0x21dd50,_0x921f70){_0x21dd50=_0x21dd50-0x0;var _0x1b7d5e=_0x81c6[_0x21dd50];return _0x1b7d5e;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});config[_0x681c('0x8')]=_[_0x681c('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x681c('0xa'))(new Redis(config[_0x681c('0x8')]));require(_0x681c('0xb'))['register'](socket);function respondWithRpcPromise(_0x4f0228,_0x3e3770,_0x4ff60b){return new BPromise(function(_0x82b6ad,_0x83927a){return client[_0x681c('0xc')](_0x4f0228,_0x4ff60b)[_0x681c('0xd')](function(_0x48dc05){logger['info'](_0x681c('0xe'),_0x3e3770,_0x681c('0xf'));logger[_0x681c('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3e3770,_0x681c('0xf'),JSON['stringify'](_0x48dc05));if(_0x48dc05[_0x681c('0x11')]){if(_0x48dc05['error'][_0x681c('0x12')]===0x1f4){logger[_0x681c('0x11')](_0x681c('0xe'),_0x3e3770,_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);return _0x83927a(_0x48dc05[_0x681c('0x11')]['message']);}logger[_0x681c('0x11')](_0x681c('0xe'),_0x3e3770,_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);return _0x82b6ad(_0x48dc05[_0x681c('0x11')][_0x681c('0x13')]);}else{logger['info'](_0x681c('0xe'),_0x3e3770,_0x681c('0xf'));_0x82b6ad(_0x48dc05[_0x681c('0x14')][_0x681c('0x13')]);}})['catch'](function(_0x22e608){logger[_0x681c('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x3e3770,_0x22e608);_0x83927a(_0x22e608);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 28a0526..b15c7c8 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 _0x65f4=['length','voicePrefix:','remove','update','emit','register'];(function(_0x12b507,_0x4aa32c){var _0x4660e3=function(_0x2d1196){while(--_0x2d1196){_0x12b507['push'](_0x12b507['shift']());}};_0x4660e3(++_0x4aa32c);}(_0x65f4,0x19a));var _0x465f=function(_0x2fe705,_0x576f74){_0x2fe705=_0x2fe705-0x0;var _0x4e85f3=_0x65f4[_0x2fe705];return _0x4e85f3;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x465f('0x0'),_0x465f('0x1')];function createListener(_0x34f1ce,_0x59c7cb){return function(_0x584451){_0x59c7cb[_0x465f('0x2')](_0x34f1ce,_0x584451);};}function removeListener(_0x3bf967,_0x307a2b){return function(){VoicePrefixEvents['removeListener'](_0x3bf967,_0x307a2b);};}exports[_0x465f('0x3')]=function(_0xe5a9bd){for(var _0x44d697=0x0,_0x553ce9=events[_0x465f('0x4')];_0x44d697<_0x553ce9;_0x44d697++){var _0x5e26ea=events[_0x44d697];var _0x523ca1=createListener(_0x465f('0x5')+_0x5e26ea,_0xe5a9bd);VoicePrefixEvents['on'](_0x5e26ea,_0x523ca1);}}; \ No newline at end of file +var _0x05b0=['remove','update','register','length'];(function(_0x56cfa2,_0x19806b){var _0xc153f2=function(_0x4049ef){while(--_0x4049ef){_0x56cfa2['push'](_0x56cfa2['shift']());}};_0xc153f2(++_0x19806b);}(_0x05b0,0x188));var _0x005b=function(_0x4ccdd9,_0x3f12c2){_0x4ccdd9=_0x4ccdd9-0x0;var _0x551bb7=_0x05b0[_0x4ccdd9];return _0x551bb7;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x005b('0x0'),_0x005b('0x1')];function createListener(_0x4c8e5f,_0xbc782b){return function(_0x2f5c09){_0xbc782b['emit'](_0x4c8e5f,_0x2f5c09);};}function removeListener(_0x342d08,_0x2849ed){return function(){VoicePrefixEvents['removeListener'](_0x342d08,_0x2849ed);};}exports[_0x005b('0x2')]=function(_0x18fb51){for(var _0x31fe01=0x0,_0x98e71c=events[_0x005b('0x3')];_0x31fe01<_0x98e71c;_0x31fe01++){var _0x35998d=events[_0x31fe01];var _0x263bc9=createListener('voicePrefix:'+_0x35998d,_0x18fb51);VoicePrefixEvents['on'](_0x35998d,_0x263bc9);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index ad1f2b2..acb3221 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x572be5,_0x2b75d5){var _0xe63e21=function(_0x3aeff4){while(--_0x3aeff4){_0x572be5['push'](_0x572be5['shift']());}};_0xe63e21(++_0x2b75d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0xb10b,0x12a));var _0xbb10=function(_0x59cda9,_0x47d4c4){_0x59cda9=_0x59cda9-0x0;var _0x26c18f=_0xb10b[_0x59cda9];return _0x26c18f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index d5e2437..480a5ba 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 _0x3781=['progressive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','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)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','type','getDataValue','preview','booked','roundrobin','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime'];(function(_0x428c7d,_0x218ceb){var _0x1b565a=function(_0x2d4a7d){while(--_0x2d4a7d){_0x428c7d['push'](_0x428c7d['shift']());}};_0x1b565a(++_0x218ceb);}(_0x3781,0x1f4));var _0x1378=function(_0x2be33d,_0x3fc0af){_0x2be33d=_0x2be33d-0x0;var _0x2daa6a=_0x3781[_0x2be33d];return _0x2daa6a;};'use strict';var Sequelize=require(_0x1378('0x0'));module['exports']={'name':{'type':Sequelize[_0x1378('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1378('0x2')]('inbound',_0x1378('0x3')),'allowNull':![],'defaultValue':_0x1378('0x4')},'musiconhold':{'type':Sequelize[_0x1378('0x1')],'defaultValue':_0x1378('0x5')},'announce':{'type':Sequelize[_0x1378('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x1378('0x2')]('rr',_0x1378('0x6'),_0x1378('0x7'),_0x1378('0x8'),_0x1378('0x9'),_0x1378('0xa'),_0x1378('0xb'),_0x1378('0xc'),_0x1378('0xd')),'allowNull':![],'defaultValue':_0x1378('0x6'),'set':function(_0x33a5d6){this[_0x1378('0xe')]('strategy',_0x33a5d6?_0x33a5d6:'rrmemory');},'get':function(){var _0x21c0b7=this['getDataValue'](_0x1378('0xf'));var _0x1a34e2=this['getDataValue']('dialMethod');var _0x5b196c=this[_0x1378('0x10')]('strategy');if(_0x21c0b7===_0x1378('0x3')){if(_0x1a34e2===_0x1378('0x11')){return null;}if(_0x1a34e2===_0x1378('0x12')&&![_0x1378('0xa'),_0x1378('0x13')]['includes'](_0x5b196c)){this[_0x1378('0xe')]('strategy',_0x1378('0xa'));}}return _0x5b196c;}},'servicelevel':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1378('0x14')](0xb)},'timeout':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1378('0x1')]},'weight':{'type':Sequelize[_0x1378('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':_0x1378('0x15')},'autopause':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no',_0x1378('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1378('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1378('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1378('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1378('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1378('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':_0x1378('0x15')},'announce_holdtime':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no',_0x1378('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1378('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1378('0x2')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x1378('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1378('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1378('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x1378('0x1')]},'queue_quantity2':{'type':Sequelize[_0x1378('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x1378('0x1')]},'periodic_announce':{'type':Sequelize[_0x1378('0x18')],'set':function(_0x54983d){this[_0x1378('0xe')]('periodic_announce',_0x54983d?_0x54983d[_0x1378('0x19')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x1378('0x10')](_0x1378('0x1a'))[_0x1378('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x1378('0x1')],'defaultValue':_0x1378('0x15'),'set':function(_0x421107){this[_0x1378('0xe')]('joinempty',_0x421107?_0x421107['join'](','):undefined);},'get':function(){return this[_0x1378('0x10')](_0x1378('0x1c'))?this['getDataValue'](_0x1378('0x1c'))[_0x1378('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1378('0x1')],'defaultValue':'no','set':function(_0x615c09){this['setDataValue']('leavewhenempty',_0x615c09?_0x615c09['join'](','):undefined);},'get':function(){return this[_0x1378('0x10')](_0x1378('0x1d'))?this[_0x1378('0x10')](_0x1378('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1378('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1378('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1378('0x2')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1378('0x1')]},'description':{'type':Sequelize[_0x1378('0x1')]},'acw':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':0x0,'set':function(_0x1cac4e){this[_0x1378('0xe')]('acw',_0x1cac4e);if(_0x1cac4e){if(this[_0x1378('0x10')](_0x1378('0x1f'))<0x2){this[_0x1378('0xe')](_0x1378('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x1378('0x11'),_0x1378('0x20'),'power','predictive',_0x1378('0x12')),'defaultValue':'progressive','comment':_0x1378('0x21')},'dialLimitChannel':{'type':Sequelize[_0x1378('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1378('0x22')},'dialLimitQueue':{'type':Sequelize[_0x1378('0x14')](0x4)[_0x1378('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1378('0x24')},'dialPowerLevel':{'type':Sequelize[_0x1378('0x25')](0x2)[_0x1378('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x1378('0x26')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x1378('0x27'),_0x1378('0x28')),'defaultValue':'dropRate','comment':_0x1378('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1378('0x25')](0x2)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1378('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x1378('0x1')],'defaultValue':_0x1378('0x2c'),'comment':_0x1378('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x2e')},'dialQueueProject':{'type':Sequelize[_0x1378('0x1')],'comment':_0x1378('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1378('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x32')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1378('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1378('0x14')](0x5)[_0x1378('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1378('0x35')},'dialTimezone':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1378('0x1')],'defaultValue':_0x1378('0x36')},'dialPrefix':{'type':Sequelize[_0x1378('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x37'),'never',_0x1378('0x38')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':0x0,'comment':_0x1378('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x1378('0x14')](0x9)[_0x1378('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1378('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1378('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1378('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1378('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1378('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1378('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1378('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1378('0x14')](0x9)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1378('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1378('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1378('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1378('0x14')](0x9)[_0x1378('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1378('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x1378('0x14')](0x5)[_0x1378('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x1378('0x2')](_0x1378('0x40'),'ASC'),'defaultValue':_0x1378('0x40')},'dialQueueProject2':{'type':Sequelize[_0x1378('0x1')],'comment':_0x1378('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1378('0x41')},'dialCutDigit':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1378('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x42')},'dialDropMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1378('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x43')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1378('0x14')](0x5)[_0x1378('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1378('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1378('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1378('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1378('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1378('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1378('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x373743){if(!_0x373743)this['setDataValue'](_0x1378('0x4a'),null);this[_0x1378('0xe')](_0x1378('0x4b'),_0x373743);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1378('0x14')](0x3)[_0x1378('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1378('0x14')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1378('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0xb8a1=['strategy','getDataValue','dialMethod','preview','roundrobin','includes','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#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','Active/Disactive\x20Recall\x20In\x20Queue','DESC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','ENUM','inbound','outbound','STRING','default','leastrecent','random','rrmemory','linear','wrandom','setDataValue'];(function(_0x2af160,_0x765b1){var _0x439d67=function(_0x4d26af){while(--_0x4d26af){_0x2af160['push'](_0x2af160['shift']());}};_0x439d67(++_0x765b1);}(_0xb8a1,0x123));var _0x1b8a=function(_0x225524,_0x36a0c7){_0x225524=_0x225524-0x0;var _0x4506c3=_0xb8a1[_0x225524];return _0x4506c3;};'use strict';var Sequelize=require(_0x1b8a('0x0'));module[_0x1b8a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x3'),_0x1b8a('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':_0x1b8a('0x6')},'announce':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x1b8a('0x7'),'fewestcalls',_0x1b8a('0x8'),_0x1b8a('0x9'),_0x1b8a('0xa'),_0x1b8a('0xb'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x597818){this[_0x1b8a('0xc')](_0x1b8a('0xd'),_0x597818?_0x597818:'rrmemory');},'get':function(){var _0x24bbd7=this['getDataValue']('type');var _0x272c80=this[_0x1b8a('0xe')](_0x1b8a('0xf'));var _0x1e4d0f=this[_0x1b8a('0xe')](_0x1b8a('0xd'));if(_0x24bbd7===_0x1b8a('0x4')){if(_0x272c80===_0x1b8a('0x10')){return null;}if(_0x272c80==='booked'&&![_0x1b8a('0x9'),_0x1b8a('0x11')][_0x1b8a('0x12')](_0x1e4d0f)){this['setDataValue'](_0x1b8a('0xd'),'rrmemory');}}return _0x1e4d0f;}},'servicelevel':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x1b8a('0x13')](0xb)},'timeout':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1b8a('0x5')]},'weight':{'type':Sequelize[_0x1b8a('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x1b8a('0x2')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1b8a('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1b8a('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':_0x1b8a('0x14')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x1b8a('0x14'),'no',_0x1b8a('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x1b8a('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x1b8a('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1b8a('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x1b8a('0x5')]},'queue_youarenext':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x1b8a('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x1b8a('0x5')]},'queue_quantity1':{'type':Sequelize[_0x1b8a('0x5')]},'queue_quantity2':{'type':Sequelize[_0x1b8a('0x5')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x1b8a('0x5')]},'periodic_announce':{'type':Sequelize[_0x1b8a('0x16')],'set':function(_0x309512){this[_0x1b8a('0xc')](_0x1b8a('0x17'),_0x309512?_0x309512[_0x1b8a('0x18')](','):[]);},'get':function(){return this[_0x1b8a('0xe')](_0x1b8a('0x17'))?this['getDataValue'](_0x1b8a('0x17'))[_0x1b8a('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':_0x1b8a('0x14'),'set':function(_0x397af3){this[_0x1b8a('0xc')](_0x1b8a('0x1a'),_0x397af3?_0x397af3['join'](','):undefined);},'get':function(){return this[_0x1b8a('0xe')](_0x1b8a('0x1a'))?this[_0x1b8a('0xe')](_0x1b8a('0x1a'))[_0x1b8a('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x2dad7f){this[_0x1b8a('0xc')]('leavewhenempty',_0x2dad7f?_0x2dad7f['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x1b8a('0x1b'))?this[_0x1b8a('0xe')](_0x1b8a('0x1b'))[_0x1b8a('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1b8a('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1b8a('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1b8a('0x5')]},'description':{'type':Sequelize[_0x1b8a('0x5')]},'acw':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':0x0,'set':function(_0x4d8560){this[_0x1b8a('0xc')](_0x1b8a('0x1d'),_0x4d8560);if(_0x4d8560){if(this[_0x1b8a('0xe')](_0x1b8a('0x1e'))<0x2){this[_0x1b8a('0xc')](_0x1b8a('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':0x0,'comment':_0x1b8a('0x1f')},'dialMethod':{'type':Sequelize[_0x1b8a('0x2')]('preview','progressive',_0x1b8a('0x20'),_0x1b8a('0x21'),'booked'),'defaultValue':_0x1b8a('0x22'),'comment':_0x1b8a('0x23')},'dialLimitChannel':{'type':Sequelize[_0x1b8a('0x13')](0x4)[_0x1b8a('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x1b8a('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1b8a('0x25')},'dialPowerLevel':{'type':Sequelize[_0x1b8a('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x1b8a('0x2')](_0x1b8a('0x27'),_0x1b8a('0x28')),'defaultValue':_0x1b8a('0x28'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x1b8a('0x26')](0x2)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1b8a('0x29')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':_0x1b8a('0x2b'),'comment':_0x1b8a('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x1b8a('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x2d')},'dialQueueProject':{'type':Sequelize[_0x1b8a('0x5')],'comment':_0x1b8a('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1b8a('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':_0x1b8a('0x34')},'dialPrefix':{'type':Sequelize[_0x1b8a('0x5')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1b8a('0x35'),_0x1b8a('0x36'),_0x1b8a('0x37')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1b8a('0x13')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1b8a('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1b8a('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1b8a('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1b8a('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1b8a('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1b8a('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1b8a('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1b8a('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1b8a('0x13')](0x9)[_0x1b8a('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1b8a('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':0x0,'comment':_0x1b8a('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1b8a('0x2')]('DESC','ASC'),'defaultValue':_0x1b8a('0x41')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x1b8a('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x43')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x44')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1b8a('0x13')](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1b8a('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1b8a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1b8a('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x1b8a('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x22096b){if(!_0x22096b)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x1b8a('0xc')](_0x1b8a('0x4b'),_0x22096b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x1b8a('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1b8a('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1b8a('0x13')](0x3)[_0x1b8a('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1b8a('0x1c')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index d24feba..405b104 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 _0x7217=['toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','emit','userVoiceQueue:remove','addAgents','isEmpty','removeAgents','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','fromQuery','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','type','find','name','UserProfileResource','end','error','send','index','VoiceQueue','fieldName','getOptions','where','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','options','create','user','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','body','merge','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','pick','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','online','flatMap','penalty','sequelize','transaction','addTeams','upsert','each','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','forEach','userVoiceQueue:save','removeTeams','Agents','select','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push'];(function(_0xcfc44,_0x179bc1){var _0x307a25=function(_0x2b64de){while(--_0x2b64de){_0xcfc44['push'](_0xcfc44['shift']());}};_0x307a25(++_0x179bc1);}(_0x7217,0x19e));var _0x7721=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7217[_0x6131cd];return _0x47e916;};'use strict';var moment=require(_0x7721('0x0'));var BPromise=require('bluebird');var util=require(_0x7721('0x1'));var _=require(_0x7721('0x2'));var squel=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var qs=require(_0x7721('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x7721('0x6'));var db=require(_0x7721('0x7'))['db'];config[_0x7721('0x8')]=_[_0x7721('0x9')](config[_0x7721('0x8')],{'host':_0x7721('0xa'),'port':0x18eb});var socket=require(_0x7721('0xb'))(new Redis(config[_0x7721('0x8')]));require(_0x7721('0xc'))[_0x7721('0xd')](socket);function respondWithStatusCode(_0x3e6368,_0x2a66cb){_0x2a66cb=_0x2a66cb||0xcc;return function(_0xfa8835){if(_0xfa8835){return _0x3e6368[_0x7721('0xe')](_0x2a66cb);}return _0x3e6368[_0x7721('0xf')](_0x2a66cb)['end']();};}function respondWithResult(_0x461d1a,_0x29bc8f){_0x29bc8f=_0x29bc8f||0xc8;return function(_0x8729a6){if(_0x8729a6){return _0x461d1a[_0x7721('0xf')](_0x29bc8f)[_0x7721('0x10')](_0x8729a6);}};}function respondWithFilteredResult(_0x409b37,_0x1e7fd7){return function(_0x27b36b){if(_0x27b36b){var _0x55b4ca=typeof _0x1e7fd7[_0x7721('0x11')]===_0x7721('0x12')&&typeof _0x1e7fd7['limit']===_0x7721('0x12');var _0x30da54=_0x27b36b[_0x7721('0x13')];var _0x2e9752=_0x55b4ca?0x0:_0x1e7fd7['offset'];var _0x3cbce8=_0x55b4ca?_0x27b36b[_0x7721('0x13')]:_0x1e7fd7['offset']+_0x1e7fd7['limit'];var _0x4b183e;if(_0x3cbce8>=_0x30da54){_0x3cbce8=_0x30da54;_0x4b183e=0xc8;}else{_0x4b183e=0xce;}_0x409b37[_0x7721('0xf')](_0x4b183e);return _0x409b37[_0x7721('0x14')](_0x7721('0x15'),_0x2e9752+'-'+_0x3cbce8+'/'+_0x30da54)[_0x7721('0x10')](_0x27b36b);}return null;};}function saveUpdates(_0x5ed94b){return function(_0x20f669){if(_0x20f669){return _0x20f669['update'](_0x5ed94b)[_0x7721('0x16')](function(_0x5cb0e6){return _0x5cb0e6;});}return null;};}function removeEntity(_0xfec626){return function(_0x4e96fb){if(_0x4e96fb){return _0x4e96fb[_0x7721('0x17')]()[_0x7721('0x16')](function(){var _0x2286e5=_0x4e96fb[_0x7721('0x18')]({'plain':!![]});var _0x402820=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a'),'ignore':![]},{'name':_0x7721('0x1b'),'value':'outbound','ignore':![]}];var _0x288f7e=_(_0x402820)[_0x7721('0x1c')](_0x7721('0x1d'))[_0x7721('0x1e')]('value')[_0x7721('0x1f')]();if(_['includes'](_0x288f7e,_0x2286e5[_0x7721('0x20')])){return;}var _0x288e3a=_[_0x7721('0x21')](_0x402820,[_0x7721('0x1f'),_0x2286e5[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x23')]['destroy']({'where':{'type':_0x288e3a,'resourceId':_0x2286e5['id']}})[_0x7721('0x16')](function(){return _0x4e96fb;});})[_0x7721('0x16')](function(){_0xfec626[_0x7721('0xf')](0xcc)[_0x7721('0x24')]();});}};}function handleEntityNotFound(_0x40d550){return function(_0x16355a){if(!_0x16355a){_0x40d550[_0x7721('0xe')](0x194);}return _0x16355a;};}function handleError(_0xf753f1,_0x40f367){_0x40f367=_0x40f367||0x1f4;return function(_0x52316e){logger[_0x7721('0x25')](_0x52316e['stack']);if(_0x52316e['name']){delete _0x52316e[_0x7721('0x22')];}_0xf753f1[_0x7721('0xf')](_0x40f367)[_0x7721('0x26')](_0x52316e);};}exports[_0x7721('0x27')]=function(_0x1ea4d,_0x37b9f0){var _0xd7d703={};var _0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x1e')](db[_0x7721('0x28')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x29')],'type':_0x4a25c9[_0x7721('0x20')]['key']};});_0xd7d703=qs[_0x7721('0x2a')](_0x5c54f0,_0x1ea4d);var _0x4651b5={'where':_0xd7d703[_0x7721('0x2b')]};return db['VoiceQueue'][_0x7721('0x13')](_0x4651b5)[_0x7721('0x16')](function(_0x1492d4){_0x1da2d8[_0x7721('0x13')]=_0x1492d4;_0xd7d703[_0x7721('0x2c')]=qs['include'](_0x1ea4d[_0x7721('0x2d')]);return db[_0x7721('0x28')][_0x7721('0x2e')](_0xd7d703);})['then'](function(_0x35de7a){_0x1da2d8[_0x7721('0x2f')]=_0x35de7a;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x37b9f0,_0xd7d703))[_0x7721('0x30')](handleError(_0x37b9f0,null));};exports['show']=function(_0x2d6ba0,_0x326c50){var _0x19d082={'raw':![],'where':{'id':_0x2d6ba0[_0x7721('0x31')]['id']}},_0x1d894b={};_0x1d894b[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x28')][_0x7721('0x34')]);_0x1d894b[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x2d6ba0['query']);_0x1d894b[_0x7721('0x35')]=_['intersection'](_0x1d894b[_0x7721('0x32')],_0x1d894b[_0x7721('0x2d')]);_0x19d082[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1d894b[_0x7721('0x32')],qs[_0x7721('0x38')](_0x2d6ba0['query']['fields']));_0x19d082['attributes']=_0x19d082['attributes'][_0x7721('0x39')]?_0x19d082[_0x7721('0x36')]:_0x1d894b[_0x7721('0x32')];if(_0x2d6ba0[_0x7721('0x2d')]['includeAll']){_0x19d082[_0x7721('0x2c')]=[{'all':!![]}];}_0x19d082=_['merge']({},_0x19d082,_0x2d6ba0[_0x7721('0x3a')]);return db[_0x7721('0x28')]['find'](_0x19d082)[_0x7721('0x16')](handleEntityNotFound(_0x326c50,null))[_0x7721('0x16')](respondWithResult(_0x326c50,null))['catch'](handleError(_0x326c50,null));};exports['create']=function(_0x3d84d3,_0xfc4dc4){return db[_0x7721('0x28')][_0x7721('0x3b')](_0x3d84d3['body'],{})[_0x7721('0x16')](function(_0x120de9){var _0x40ce8c=_0x3d84d3[_0x7721('0x3c')][_0x7721('0x18')]({'plain':!![]});if(!_0x40ce8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40ce8c[_0x7721('0x3d')]==='user'){var _0xaa3216=_0x120de9['get']({'plain':!![]});var _0x2333b8=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':'QueueCampaigns','value':_0x7721('0x3e')}];var _0x11d853=_[_0x7721('0x21')](_0x2333b8,['value',_0xaa3216[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x11d853,'userProfileId':_0x40ce8c[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x463ccc){if(_0x463ccc&&_0x463ccc['autoAssociation']===0x0){return db['UserProfileResource'][_0x7721('0x3b')]({'name':_0xaa3216[_0x7721('0x22')],'resourceId':_0xaa3216['id'],'type':_0x463ccc[_0x7721('0x22')],'sectionId':_0x463ccc['id']},{})[_0x7721('0x16')](function(){return _0x120de9;});}else{return _0x120de9;}})[_0x7721('0x30')](function(_0x15181b){logger[_0x7721('0x25')](_0x7721('0x41'),_0x15181b);throw _0x15181b;});}return _0x120de9;})[_0x7721('0x16')](respondWithResult(_0xfc4dc4,0xc9))[_0x7721('0x30')](handleError(_0xfc4dc4,null));};exports['clone']=function(_0x578867,_0x5ed70d){var _0x6a4664={'where':{'id':_0x578867[_0x7721('0x31')]['id']}},_0x151f69={};_0x151f69['model']=_[_0x7721('0x33')](db[_0x7721('0x28')]['rawAttributes']);_0x6a4664[_0x7721('0x36')]=_['intersection'](_0x151f69[_0x7721('0x32')],qs['fields'](_0x578867[_0x7721('0x2d')][_0x7721('0x38')]));_0x6a4664[_0x7721('0x36')]=_0x6a4664['attributes'][_0x7721('0x39')]?_0x6a4664[_0x7721('0x36')]:_0x151f69['model'];if(_0x578867[_0x7721('0x2d')][_0x7721('0x42')]){_0x6a4664[_0x7721('0x2c')]=[{'all':!![]}];}_0x6a4664=_['merge']({},_0x6a4664,_0x578867[_0x7721('0x3a')]);return db['VoiceQueue'][_0x7721('0x21')](_0x6a4664)[_0x7721('0x16')](handleEntityNotFound(_0x5ed70d,null))[_0x7721('0x16')](function(_0x443503){if(_0x443503){var _0x1c95d8=_0x443503[_0x7721('0x18')]({'plain':!![]});_0x1c95d8=qs[_0x7721('0x43')](_0x1c95d8,['id',_0x7721('0x44'),_0x7721('0x45')]);_0x578867[_0x7721('0x46')]=_[_0x7721('0x43')](_0x578867[_0x7721('0x46')],['id',_0x7721('0x44'),_0x7721('0x45')]);return db[_0x7721('0x28')]['create'](_[_0x7721('0x47')](_0x1c95d8,_0x578867[_0x7721('0x46')]),{'include':_0x578867[_0x7721('0x2d')][_0x7721('0x42')]?[{'all':!![]}]:undefined})[_0x7721('0x16')](function(_0x315127){var _0x267f5e=_0x578867['user'][_0x7721('0x18')]({'plain':!![]});if(!_0x267f5e)throw new Error(_0x7721('0x48'));if(_0x267f5e[_0x7721('0x3d')]===_0x7721('0x3c')){var _0x1f1e84=_0x315127[_0x7721('0x18')]({'plain':!![]});var _0x7fbd6c=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':_0x7721('0x1b'),'value':_0x7721('0x3e')}];var _0x52e870=_[_0x7721('0x21')](_0x7fbd6c,[_0x7721('0x1f'),_0x1f1e84[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x52e870,'userProfileId':_0x267f5e[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x360882){if(_0x360882&&_0x360882[_0x7721('0x49')]===0x0){return db[_0x7721('0x23')][_0x7721('0x3b')]({'name':_0x1f1e84[_0x7721('0x22')],'resourceId':_0x1f1e84['id'],'type':_0x360882[_0x7721('0x22')],'sectionId':_0x360882['id']},{})[_0x7721('0x16')](function(){return _0x315127;});}else{return _0x315127;}})['catch'](function(_0x50e9e9){logger['error'](_0x7721('0x41'),_0x50e9e9);throw _0x50e9e9;});}return _0x315127;});}})['then'](respondWithResult(_0x5ed70d,0xc9))['catch'](handleError(_0x5ed70d,null));};exports['update']=function(_0x5d7036,_0x47925a){if(_0x5d7036[_0x7721('0x46')]['id']){delete _0x5d7036[_0x7721('0x46')]['id'];}return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x5d7036['params']['id']}})['then'](handleEntityNotFound(_0x47925a,null))['then'](saveUpdates(_0x5d7036[_0x7721('0x46')],null))['then'](respondWithResult(_0x47925a,null))['catch'](handleError(_0x47925a,null));};exports['destroy']=function(_0x160292,_0x2e9155){return db[_0x7721('0x28')]['find']({'where':{'id':_0x160292[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x2e9155,null))[_0x7721('0x16')](removeEntity(_0x2e9155,null))[_0x7721('0x30')](handleError(_0x2e9155,null));};exports[_0x7721('0x4a')]=function(_0x16e80b,_0xad43ce){var _0x3e3301={'raw':![],'where':{}};var _0x127f46={};var _0x197b73={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16e80b[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0xad43ce,null))[_0x7721('0x16')](function(_0x4cbd28){if(_0x4cbd28){_0x127f46[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x4c')][_0x7721('0x34')]);_0x127f46['query']=_[_0x7721('0x33')](_0x16e80b[_0x7721('0x2d')]);_0x127f46['filters']=_[_0x7721('0x37')](_0x127f46['model'],_0x127f46[_0x7721('0x2d')]);_0x3e3301[_0x7721('0x36')]=_[_0x7721('0x37')](_0x127f46[_0x7721('0x32')],qs[_0x7721('0x38')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x38')]));_0x3e3301[_0x7721('0x36')]=_0x3e3301[_0x7721('0x36')]['length']?_0x3e3301[_0x7721('0x36')]:_0x127f46[_0x7721('0x32')];if(!_0x16e80b[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x3e3301[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16e80b['query'][_0x7721('0x4f')]);_0x3e3301[_0x7721('0x11')]=qs['offset'](_0x16e80b[_0x7721('0x2d')]['offset']);}_0x3e3301[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x51')]);_0x3e3301[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x16e80b['query'],_0x127f46[_0x7721('0x35')]));_0x3e3301[_0x7721('0x2b')][_0x7721('0x53')]=_0x4cbd28['id'];if(_0x16e80b['query']['filter']){_0x3e3301['where']=_['merge'](_0x3e3301['where'],{'$or':_[_0x7721('0x1e')](_0x3e3301[_0x7721('0x36')],function(_0x580473){var _0x2d4b3a={};_0x2d4b3a[_0x580473]={'$like':'%'+_0x16e80b[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x2d4b3a;})});}_0x3e3301=_[_0x7721('0x47')]({},_0x3e3301,_0x16e80b['options']);return db[_0x7721('0x4c')][_0x7721('0x13')]({'where':_0x3e3301[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0x3cf3fd){_0x197b73['count']=_0x3cf3fd;if(_0x16e80b[_0x7721('0x2d')][_0x7721('0x42')]){_0x3e3301[_0x7721('0x2c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3e3301);})[_0x7721('0x16')](function(_0x752564){_0x197b73[_0x7721('0x2f')]=_0x752564;return _0x197b73;});}})[_0x7721('0x16')](respondWithFilteredResult(_0xad43ce,_0x3e3301))[_0x7721('0x30')](handleError(_0xad43ce,null));};exports['getHopperHistories']=function(_0x4ba35e,_0x263070){var _0x1bd97e={'raw':!![],'where':{}};var _0x68de4={};var _0x3c66b3={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x4ba35e[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x263070,null))[_0x7721('0x16')](function(_0x413185){if(_0x413185){_0x68de4[_0x7721('0x32')]=_['keys'](db[_0x7721('0x54')][_0x7721('0x34')]);_0x68de4[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x4ba35e['query']);_0x68de4['filters']=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],_0x68de4[_0x7721('0x2d')]);_0x1bd97e[_0x7721('0x36')]=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],qs['fields'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x38')]));_0x1bd97e[_0x7721('0x36')]=_0x1bd97e['attributes'][_0x7721('0x39')]?_0x1bd97e[_0x7721('0x36')]:_0x68de4[_0x7721('0x32')];if(!_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x1bd97e[_0x7721('0x4f')]=qs['limit'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1bd97e[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x11')]);}_0x1bd97e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x51')]);_0x1bd97e[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0x4ba35e[_0x7721('0x2d')],_0x68de4[_0x7721('0x35')]));_0x1bd97e['where'][_0x7721('0x53')]=_0x413185['id'];if(_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1bd97e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x1bd97e['where'],{'$or':_[_0x7721('0x1e')](_0x1bd97e[_0x7721('0x36')],function(_0x44326d){var _0x21b365={};_0x21b365[_0x44326d]={'$like':'%'+_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x21b365;})});}_0x1bd97e=_['merge']({},_0x1bd97e,_0x4ba35e[_0x7721('0x3a')]);return db[_0x7721('0x54')]['count']({'where':_0x1bd97e[_0x7721('0x2b')]})['then'](function(_0x453792){_0x3c66b3[_0x7721('0x13')]=_0x453792;if(_0x4ba35e['query'][_0x7721('0x42')]){_0x1bd97e['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1bd97e);})[_0x7721('0x16')](function(_0x20f12e){_0x3c66b3[_0x7721('0x2f')]=_0x20f12e;return _0x3c66b3;});}})['then'](respondWithFilteredResult(_0x263070,_0x1bd97e))['catch'](handleError(_0x263070,null));};exports['getHopperFinals']=function(_0x355aa8,_0x3f7923){var _0x3c9334={'raw':!![],'where':{}};var _0x4220cf={};var _0x3b02d7={'count':0x0,'rows':[]};return db[_0x7721('0x28')]['findOne']({'where':{'id':_0x355aa8[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3f7923,null))[_0x7721('0x16')](function(_0xcf5304){if(_0xcf5304){_0x4220cf[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x55')][_0x7721('0x34')]);_0x4220cf[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x355aa8[_0x7721('0x2d')]);_0x4220cf[_0x7721('0x35')]=_['intersection'](_0x4220cf['model'],_0x4220cf[_0x7721('0x2d')]);_0x3c9334[_0x7721('0x36')]=_['intersection'](_0x4220cf[_0x7721('0x32')],qs['fields'](_0x355aa8['query'][_0x7721('0x38')]));_0x3c9334['attributes']=_0x3c9334['attributes'][_0x7721('0x39')]?_0x3c9334[_0x7721('0x36')]:_0x4220cf[_0x7721('0x32')];if(!_0x355aa8[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x3c9334[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x355aa8[_0x7721('0x2d')][_0x7721('0x4f')]);_0x3c9334['offset']=qs['offset'](_0x355aa8[_0x7721('0x2d')][_0x7721('0x11')]);}_0x3c9334['order']=qs[_0x7721('0x51')](_0x355aa8[_0x7721('0x2d')]['sort']);_0x3c9334['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x355aa8[_0x7721('0x2d')],_0x4220cf[_0x7721('0x35')]));_0x3c9334[_0x7721('0x2b')][_0x7721('0x53')]=_0xcf5304['id'];if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x1c')]){_0x3c9334['where']=_[_0x7721('0x47')](_0x3c9334[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x3c9334[_0x7721('0x36')],function(_0xe1c795){var _0x9b5f60={};_0x9b5f60[_0xe1c795]={'$like':'%'+_0x355aa8[_0x7721('0x2d')]['filter']+'%'};return _0x9b5f60;})});}_0x3c9334=_[_0x7721('0x47')]({},_0x3c9334,_0x355aa8[_0x7721('0x3a')]);return db['CmHopperFinal'][_0x7721('0x13')]({'where':_0x3c9334[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0xb8547a){_0x3b02d7[_0x7721('0x13')]=_0xb8547a;if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x42')]){_0x3c9334[_0x7721('0x2c')]=[{'all':!![]}];}return db[_0x7721('0x55')][_0x7721('0x2e')](_0x3c9334);})['then'](function(_0x418954){_0x3b02d7[_0x7721('0x2f')]=_0x418954;return _0x3b02d7;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x3f7923,_0x3c9334))[_0x7721('0x30')](handleError(_0x3f7923,null));};exports[_0x7721('0x56')]=function(_0x47653d,_0x12869b){var _0x1cfee2={'raw':!![],'where':{}};var _0x425327={};var _0x42ee11={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x47653d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12869b,null))[_0x7721('0x16')](function(_0x461938){if(_0x461938){_0x425327[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x57')][_0x7721('0x34')]);_0x425327['query']=_[_0x7721('0x33')](_0x47653d['query']);_0x425327[_0x7721('0x35')]=_[_0x7721('0x37')](_0x425327[_0x7721('0x32')],_0x425327[_0x7721('0x2d')]);_0x1cfee2[_0x7721('0x36')]=_['intersection'](_0x425327['model'],qs['fields'](_0x47653d['query'][_0x7721('0x38')]));_0x1cfee2[_0x7721('0x36')]=_0x1cfee2[_0x7721('0x36')][_0x7721('0x39')]?_0x1cfee2[_0x7721('0x36')]:_0x425327['model'];if(!_0x47653d[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x1cfee2[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x47653d[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1cfee2[_0x7721('0x11')]=qs['offset'](_0x47653d[_0x7721('0x2d')]['offset']);}_0x1cfee2['order']=qs[_0x7721('0x51')](_0x47653d[_0x7721('0x2d')][_0x7721('0x51')]);_0x1cfee2[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x47653d[_0x7721('0x2d')],_0x425327[_0x7721('0x35')]));_0x1cfee2[_0x7721('0x2b')][_0x7721('0x53')]=_0x461938['id'];if(_0x47653d[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1cfee2[_0x7721('0x2b')]=_['merge'](_0x1cfee2[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x1cfee2[_0x7721('0x36')],function(_0x193326){var _0x1dbf47={};_0x1dbf47[_0x193326]={'$like':'%'+_0x47653d['query'][_0x7721('0x1c')]+'%'};return _0x1dbf47;})});}_0x1cfee2=_[_0x7721('0x47')]({},_0x1cfee2,_0x47653d[_0x7721('0x3a')]);return db['CmHopperBlack'][_0x7721('0x13')]({'where':_0x1cfee2[_0x7721('0x2b')]})['then'](function(_0x29403d){_0x42ee11[_0x7721('0x13')]=_0x29403d;if(_0x47653d[_0x7721('0x2d')][_0x7721('0x42')]){_0x1cfee2['include']=[{'all':!![]}];}return db[_0x7721('0x57')]['findAll'](_0x1cfee2);})[_0x7721('0x16')](function(_0x1c50c2){_0x42ee11['rows']=_0x1c50c2;return _0x42ee11;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x12869b,_0x1cfee2))[_0x7721('0x30')](handleError(_0x12869b,null));};exports['getTeams']=function(_0x29968c,_0x11733f){var _0x5e3816={};var _0x7fd3e8={};var _0x52e8b1;var _0x240b0a;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x29968c['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x11733f,null))['then'](function(_0x5a00be){if(_0x5a00be){_0x52e8b1=_0x5a00be;_0x7fd3e8[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x58')][_0x7721('0x34')]);_0x7fd3e8[_0x7721('0x2d')]=_['keys'](_0x29968c[_0x7721('0x2d')]);_0x7fd3e8[_0x7721('0x35')]=_[_0x7721('0x37')](_0x7fd3e8[_0x7721('0x32')],_0x7fd3e8[_0x7721('0x2d')]);_0x5e3816['attributes']=_[_0x7721('0x37')](_0x7fd3e8['model'],qs[_0x7721('0x38')](_0x29968c['query']['fields']));_0x5e3816[_0x7721('0x36')]=_0x5e3816['attributes']['length']?_0x5e3816[_0x7721('0x36')]:_0x7fd3e8[_0x7721('0x32')];_0x5e3816[_0x7721('0x50')]=qs['sort'](_0x29968c[_0x7721('0x2d')]['sort']);_0x5e3816['where']=qs['filters'](_[_0x7721('0x52')](_0x29968c[_0x7721('0x2d')],_0x7fd3e8[_0x7721('0x35')]));if(_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]){_0x5e3816[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x5e3816[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x5e3816[_0x7721('0x36')],function(_0x25bf32){var _0x4ec3c6={};_0x4ec3c6[_0x25bf32]={'$like':'%'+_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x4ec3c6;})});}_0x5e3816=_[_0x7721('0x47')]({},_0x5e3816,_0x29968c[_0x7721('0x3a')]);return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0xc7e4e9){if(_0xc7e4e9){_0x240b0a=_0xc7e4e9['length'];if(!_0x29968c['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x5e3816[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x29968c['query'][_0x7721('0x4f')]);_0x5e3816['offset']=qs[_0x7721('0x11')](_0x29968c['query'][_0x7721('0x11')]);}return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0x249a5b){if(_0x249a5b){return _0x249a5b?{'count':_0x240b0a,'rows':_0x249a5b}:null;}})[_0x7721('0x16')](respondWithResult(_0x11733f,null))[_0x7721('0x30')](handleError(_0x11733f,null));};exports['addTeams']=function(_0x509f2d,_0x4d2644){var _0x2b0968=_0x509f2d['body'][_0x7721('0x5a')];var _0x186ada=_['map'](_0x2b0968,'id');return db[_0x7721('0x58')][_0x7721('0x2e')]({'where':{'id':_0x186ada},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':'Agents','attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),'voicePause','interface'],'raw':!![]}]})[_0x7721('0x16')](function(_0xc85b9){if(_0xc85b9){var _0x58be49=_[_0x7721('0x5d')](_0xc85b9,function(_0x283716){var _0x4cd26e=_0x283716['get']({'plain':!![]});_0x4cd26e['Agents']['forEach'](function(_0x19be6b){_0x19be6b[_0x7721('0x5e')]=_[_0x7721('0x21')](_0x2b0968,{'id':_0x4cd26e['id']})['penalty'];});return _0x4cd26e['Agents'];});return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x509f2d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x14711c){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0x435455){return _0x14711c[_0x7721('0x61')](_0x186ada,{'transaction':_0x435455})['then'](function(){return BPromise['each'](_0x2b0968,function(_0x415445){return db['TeamVoiceQueue'][_0x7721('0x62')]({'TeamId':_0x415445['id'],'VoiceQueueId':_0x509f2d['params']['id'],'penalty':_0x415445[_0x7721('0x5e')]},{'transaction':_0x435455});});})['then'](function(){return BPromise[_0x7721('0x63')](_0x58be49,function(_0x14341e){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x14341e['id'],'VoiceQueueId':_0x509f2d[_0x7721('0x31')]['id']},'defaults':{'penalty':_0x14341e[_0x7721('0x5e')]},'transaction':_0x435455});});})[_0x7721('0x16')](function(){return BPromise[_0x7721('0x63')](_[_0x7721('0x1c')](_0x58be49,{'online':!![]}),function(_0x5e69d7){return db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x5e69d7[_0x7721('0x22')],'UserId':_0x5e69d7['id'],'queue_name':_0x14711c['name'],'VoiceQueueId':_0x14711c['id'],'interface':_[_0x7721('0x65')](_0x5e69d7[_0x7721('0x66')])?util[_0x7721('0x67')](_0x7721('0x68'),_0x5e69d7[_0x7721('0x22')]):_0x5e69d7[_0x7721('0x66')],'paused':_0x5e69d7[_0x7721('0x69')]||![],'penalty':_0x5e69d7[_0x7721('0x5e')]},{'transaction':_0x435455});});})[_0x7721('0x16')](function(){_0x58be49[_0x7721('0x6a')](function(_0x2a2d8a){socket['emit'](_0x7721('0x6b'),{'UserId':_0x2a2d8a['id'],'VoiceQueueId':_0x14711c['id']});});});});});}})[_0x7721('0x16')](respondWithStatusCode(_0x4d2644,null))[_0x7721('0x30')](handleError(_0x4d2644,null));};exports[_0x7721('0x6c')]=function(_0xcb843e,_0x35d3f1){return db[_0x7721('0x58')]['findAll']({'where':{'id':_0xcb843e[_0x7721('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':_0x7721('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x7721('0x16')](handleEntityNotFound(_0x35d3f1,null))[_0x7721('0x16')](function(_0x37b607){var _0x3d6d41=_['map'](_0x37b607,'id');var _0xbce1b=[];var _0x4d3ad1=[];var _0x4028fa=squel[_0x7721('0x6e')]();_0x4028fa[_0x7721('0x6f')]('tq.TeamId')[_0x7721('0x70')](_0x7721('0x71'),'tq')[_0x7721('0x72')](_0x7721('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7721('0x2b')](_0x7721('0x74'),_0xcb843e[_0x7721('0x31')]['id']);for(var _0x980f26=0x0;_0x980f26<_0x37b607['length'];_0x980f26+=0x1){let _0x40dd5e=_0x37b607[_0x980f26];for(var _0x3d143a=0x0;_0x3d143a<_0x40dd5e[_0x7721('0x6d')][_0x7721('0x39')];_0x3d143a+=0x1){let _0x53fa66=_0x40dd5e[_0x7721('0x6d')][_0x3d143a];var _0x1a95e6=_0x4028fa[_0x7721('0x75')]();_0x1a95e6[_0x7721('0x2b')](_0x7721('0x76'),_0x53fa66['id']);_0x4d3ad1[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x1a95e6[_0x7721('0x78')](),{'type':db['sequelize'][_0x7721('0x79')][_0x7721('0x7a')]})[_0x7721('0x16')](function(_0x1c246b){if(_0x1c246b[_0x7721('0x39')]===0x1){return _0x53fa66['id'];}else{var _0x31447d=_[_0x7721('0x7b')](_[_0x7721('0x1e')](_0x1c246b,_0x7721('0x7c')),function(_0x14fd97){return _[_0x7721('0x7d')](_0x3d6d41,_0x14fd97);});if(_0x31447d){return _0x53fa66['id'];}}}));}}return BPromise[_0x7721('0x7e')](_0x4d3ad1)[_0x7721('0x16')](function(_0x18ccdf){_0xbce1b=_(_0xbce1b)[_0x7721('0x7f')](_0x18ccdf)[_0x7721('0x80')]()['value']();return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xcb843e[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x157310){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0xdd0e7a){return _0x157310[_0x7721('0x6c')](_0xcb843e[_0x7721('0x2d')][_0x7721('0x81')],{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){if(!_['isEmpty'](_0xbce1b)){return _0x157310['removeAgents'](_0xbce1b,{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0xcb843e[_0x7721('0x31')]['id'],'UserId':_0xbce1b},'transaction':_0xdd0e7a});});}})[_0x7721('0x16')](function(){_0xbce1b['forEach'](function(_0x1ebc86){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':_0x1ebc86,'VoiceQueueId':_0x157310['id']});});});});});});})[_0x7721('0x16')](respondWithStatusCode(_0x35d3f1,null))[_0x7721('0x30')](handleError(_0x35d3f1,null));};exports[_0x7721('0x84')]=function(_0xc0f448,_0x3dc688){var _0x298aca,_0x45b430;return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xc0f448['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3dc688,null))[_0x7721('0x16')](function(_0x16e0cd){if(_0x16e0cd){_0x45b430=_0x16e0cd;return _0x16e0cd['addAgents'](_0xc0f448[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xc0f448['body'],[_0x7721('0x81'),'id'])||{})['spread'](function(_0x5f3dd2){for(var _0xa73193=0x0;_0xa73193<_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0x7721('0x39')];_0xa73193+=0x1){socket['emit'](_0x7721('0x6b'),{'UserId':Number(_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0xa73193]),'VoiceQueueId':Number(_0xc0f448[_0x7721('0x31')]['id'])});}return _0x5f3dd2;});}})[_0x7721('0x16')](function(_0x5b12c7){_0x298aca=_0x5b12c7||[];if(_0x45b430){return db[_0x7721('0x5b')][_0x7721('0x2e')]({'where':{'id':_0xc0f448[_0x7721('0x46')][_0x7721('0x81')]},'attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),_0x7721('0x69'),_0x7721('0x66')],'raw':!![]});}})[_0x7721('0x16')](function(_0x385c86){if(!_[_0x7721('0x85')](_0x385c86)){var _0xc18d1a=[];for(var _0x9575b3=0x0;_0x9575b3<_0x385c86[_0x7721('0x39')];_0x9575b3++){if(_0x385c86[_0x9575b3][_0x7721('0x5c')]){_0xc18d1a[_0x7721('0x77')](db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x385c86[_0x9575b3][_0x7721('0x22')],'UserId':_0x385c86[_0x9575b3]['id'],'queue_name':_0x45b430[_0x7721('0x22')],'VoiceQueueId':_0x45b430['id'],'interface':_[_0x7721('0x65')](_0x385c86[_0x9575b3][_0x7721('0x66')])?util['format'](_0x7721('0x68'),_0x385c86[_0x9575b3]['name']):_0x385c86[_0x9575b3][_0x7721('0x66')],'paused':_0x385c86[_0x9575b3][_0x7721('0x69')]||![],'penalty':_0xc0f448[_0x7721('0x46')][_0x7721('0x5e')]||0x0}));}}return BPromise['all'](_0xc18d1a);}})[_0x7721('0x16')](function(){return _0x298aca;})[_0x7721('0x16')](respondWithResult(_0x3dc688,null))['catch'](handleError(_0x3dc688,null));};exports[_0x7721('0x86')]=function(_0x3a8f89,_0x52aae1){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x3a8f89[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x52aae1,null))[_0x7721('0x16')](function(_0x55c43c){if(_0x55c43c){return _0x55c43c['removeAgents'](_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')])['then'](function(){if(_['isArray'](_0x3a8f89[_0x7721('0x2d')]['ids'])){for(var _0x1c23e3=0x0;_0x1c23e3<_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]['length'];_0x1c23e3+=0x1){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')][_0x1c23e3]),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}}else{socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')]['ids']),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}});}})[_0x7721('0x16')](function(_0x3c3c7e){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0x3a8f89['params']['id'],'UserId':_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]}})[_0x7721('0x16')](function(){return _0x3c3c7e;});})[_0x7721('0x16')](respondWithStatusCode(_0x52aae1,null))[_0x7721('0x30')](handleError(_0x52aae1,null));};exports[_0x7721('0x87')]=function(_0x16b110,_0x366323){var _0x14b49e={};var _0x12f568={};var _0x259640;var _0x4a0e50;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16b110[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x366323,null))[_0x7721('0x16')](function(_0x25e4db){if(_0x25e4db){_0x259640=_0x25e4db;_0x12f568[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x5b')][_0x7721('0x34')]);_0x12f568[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x16b110[_0x7721('0x2d')]);_0x12f568[_0x7721('0x35')]=_[_0x7721('0x37')](_0x12f568['model'],_0x12f568[_0x7721('0x2d')]);_0x14b49e['attributes']=_['intersection'](_0x12f568[_0x7721('0x32')],qs['fields'](_0x16b110[_0x7721('0x2d')][_0x7721('0x38')]));_0x14b49e[_0x7721('0x36')]=_0x14b49e[_0x7721('0x36')]['length']?_0x14b49e['attributes']:_0x12f568[_0x7721('0x32')];_0x14b49e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16b110[_0x7721('0x2d')][_0x7721('0x51')]);_0x14b49e[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x16b110[_0x7721('0x2d')],_0x12f568['filters']));if(_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]){_0x14b49e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x14b49e[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x14b49e[_0x7721('0x36')],function(_0x184f1b){var _0xa257a0={};_0xa257a0[_0x184f1b]={'$like':'%'+_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0xa257a0;})});}_0x14b49e=_[_0x7721('0x47')]({},_0x14b49e,_0x16b110[_0x7721('0x3a')]);return _0x259640[_0x7721('0x87')](_0x14b49e);}})[_0x7721('0x16')](function(_0x1ee0c1){if(_0x1ee0c1){_0x4a0e50=_0x1ee0c1[_0x7721('0x39')];if(!_0x16b110[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x14b49e[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16b110[_0x7721('0x2d')][_0x7721('0x4f')]);_0x14b49e[_0x7721('0x11')]=qs['offset'](_0x16b110[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x259640[_0x7721('0x87')](_0x14b49e);}})['then'](function(_0x1bdadb){if(_0x1bdadb){return _0x1bdadb?{'count':_0x4a0e50,'rows':_0x1bdadb}:null;}})['then'](respondWithResult(_0x366323,null))[_0x7721('0x30')](handleError(_0x366323,null));};exports['getMembers']=function(_0xe5e55f,_0x17ce3b){var _0xbc0a80={};var _0xf2dc08={};var _0x5b493a;var _0x45024c;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0xe5e55f[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x17ce3b,null))['then'](function(_0x12b255){if(_0x12b255){_0x5b493a=_0x12b255;_0xf2dc08['model']=_[_0x7721('0x33')](db[_0x7721('0x64')][_0x7721('0x34')]);_0xf2dc08[_0x7721('0x2d')]=_[_0x7721('0x33')](_0xe5e55f[_0x7721('0x2d')]);_0xf2dc08[_0x7721('0x35')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],_0xf2dc08['query']);_0xbc0a80[_0x7721('0x36')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],qs['fields'](_0xe5e55f['query'][_0x7721('0x38')]));_0xbc0a80[_0x7721('0x36')]=_0xbc0a80[_0x7721('0x36')][_0x7721('0x39')]?_0xbc0a80[_0x7721('0x36')]:_0xf2dc08[_0x7721('0x32')];_0xbc0a80['order']=qs[_0x7721('0x51')](_0xe5e55f[_0x7721('0x2d')]['sort']);_0xbc0a80[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0xe5e55f['query'],_0xf2dc08[_0x7721('0x35')]));if(_0xe5e55f['query']['filter']){_0xbc0a80['where']=_[_0x7721('0x47')](_0xbc0a80['where'],{'$or':_['map'](_0xbc0a80['attributes'],function(_0x52a1ee){var _0x41c991={};_0x41c991[_0x52a1ee]={'$like':'%'+_0xe5e55f[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x41c991;})});}_0xbc0a80=_[_0x7721('0x47')]({},_0xbc0a80,_0xe5e55f[_0x7721('0x3a')]);return _0x5b493a['getMembers'](_0xbc0a80);}})[_0x7721('0x16')](function(_0x22d4e0){if(_0x22d4e0){_0x45024c=_0x22d4e0['length'];if(!_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0xbc0a80[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4f')]);_0xbc0a80[_0x7721('0x11')]=qs['offset'](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x5b493a[_0x7721('0x88')](_0xbc0a80);}})[_0x7721('0x16')](function(_0x2fbb00){return _0x2fbb00?{'count':_0x45024c,'rows':_0x2fbb00}:null;})[_0x7721('0x16')](respondWithResult(_0x17ce3b,null))[_0x7721('0x30')](handleError(_0x17ce3b,null));};exports[_0x7721('0x89')]=function(_0x561235,_0x12ad4d){var _0x226081={};var _0x17c3e7={};var _0x250cbf;var _0x255b22;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x561235[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12ad4d,null))[_0x7721('0x16')](function(_0x396880){if(_0x396880){_0x250cbf=_0x396880;_0x17c3e7['model']=_[_0x7721('0x33')](db[_0x7721('0x8a')]['rawAttributes']);_0x17c3e7[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x561235[_0x7721('0x2d')]);_0x17c3e7[_0x7721('0x35')]=_[_0x7721('0x37')](_0x17c3e7['model'],_0x17c3e7[_0x7721('0x2d')]);_0x226081[_0x7721('0x36')]=_['intersection'](_0x17c3e7['model'],qs[_0x7721('0x38')](_0x561235[_0x7721('0x2d')][_0x7721('0x38')]));_0x226081['attributes']=_0x226081[_0x7721('0x36')]['length']?_0x226081['attributes']:_0x17c3e7[_0x7721('0x32')];_0x226081[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x561235[_0x7721('0x2d')][_0x7721('0x51')]);_0x226081['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x561235[_0x7721('0x2d')],_0x17c3e7[_0x7721('0x35')]));if(_0x561235[_0x7721('0x2d')]['filter']){_0x226081[_0x7721('0x2b')]=_['merge'](_0x226081[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x226081[_0x7721('0x36')],function(_0x5209ff){var _0x2583c1={};_0x2583c1[_0x5209ff]={'$like':'%'+_0x561235['query'][_0x7721('0x1c')]+'%'};return _0x2583c1;})});}_0x226081=_[_0x7721('0x47')]({},_0x226081,_0x561235[_0x7721('0x3a')]);return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x3235d8){if(_0x3235d8){_0x255b22=_0x3235d8[_0x7721('0x39')];if(!_0x561235[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x226081['limit']=qs[_0x7721('0x4f')](_0x561235[_0x7721('0x2d')][_0x7721('0x4f')]);_0x226081[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x561235['query'][_0x7721('0x11')]);}return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x501e31){if(_0x501e31){return _0x501e31?{'count':_0x255b22,'rows':_0x501e31}:null;}})[_0x7721('0x16')](respondWithResult(_0x12ad4d,null))[_0x7721('0x30')](handleError(_0x12ad4d,null));};exports[_0x7721('0x8b')]=function(_0xe325e1,_0x1aa1fc){var _0x560be6=moment()[_0x7721('0x67')](_0x7721('0x8c'));var _0x1bd066,_0xaa15c5;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xe325e1[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x1aa1fc,null))[_0x7721('0x16')](function(_0x42ffff){if(_0x42ffff){_0xaa15c5=_0x42ffff;return _0x42ffff[_0x7721('0x8b')](_0xe325e1[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xe325e1[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x3f19f5){var _0x28f11a;_0x1bd066=_0x3f19f5||[];var _0x3bc8f3=[];if(_0x3f19f5){for(var _0x26cea3=0x0;_0x26cea3<_0x3f19f5[_0x7721('0x39')];_0x26cea3+=0x1){var _0x57e928=_0x3f19f5[_0x26cea3]['get']({'plain':!![]});_0xaa15c5[_0x7721('0x8e')]=_0xe325e1[_0x7721('0x46')][_0x7721('0x8e')]?_0xe325e1[_0x7721('0x46')]['dialCheckDuplicateType']:_0xaa15c5[_0x7721('0x8e')];switch(_0xaa15c5['dialCheckDuplicateType']){case _0x7721('0x8f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')['fromQuery'](['phone',_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),'updatedAt'],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),'ListId')[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','updatedAt')['from'](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928['CmListId'][_0x7721('0x78')]())[_0x7721('0x2b')](_0x7721('0x9a'))[_0x7721('0x2b')](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9c'))[_0x7721('0x70')](_0x7721('0x9d'))['where'](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id']['toString']()))[_0x7721('0x2b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7721('0x6e')]()['field'](_0x7721('0x9e'))['from']('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0xe325e1[_0x7721('0x31')]['id']['toString']())))[_0x7721('0x78')]();break;case _0x7721('0x9f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')](_0x7721('0xa0'))[_0x7721('0xa1')](['phone',_0x7721('0x92'),_0x7721('0x93'),'ListId','VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field']('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))['from'](_0x7721('0x97'))['where']('deletedAt\x20IS\x20NULL')[_0x7721('0x2b')]('ListId\x20=\x20?',_0x57e928[_0x7721('0x96')]['toString']())[_0x7721('0x2b')](_0x7721('0x9a'))['where'](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9e'))[_0x7721('0x70')]('cm_hopper')[_0x7721('0x2b')](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')]())))[_0x7721('0x78')]();break;default:_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')[_0x7721('0xa1')]([_0x7721('0x95'),_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),'VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id',_0x7721('0x93'))['field'](_0x57e928['CmListId'][_0x7721('0x78')](),'ListId')['field'](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x44'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928[_0x7721('0x96')][_0x7721('0x78')]())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();}_0x3bc8f3[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x28f11a));}return BPromise[_0x7721('0x7e')](_0x3bc8f3);}})[_0x7721('0x16')](function(){var _0x5f53b3=[];var _0x8fc283=squel[_0x7721('0x90')]()['into'](_0x7721('0xa2'))['fromQuery']([_0x7721('0xa3'),_0x7721('0x95'),_0x7721('0xa4'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0xa5'))[_0x7721('0x6f')](_0x7721('0xa6'))[_0x7721('0x6f')](_0x7721('0xa7'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0xa8'),'ci')[_0x7721('0x72')](_0x7721('0xa0'),'h',_0x7721('0xa9'))['where'](_0x7721('0xaa'),_0x560be6)[_0x7721('0x2b')](_0x7721('0xab'),'PHONE'))[_0x7721('0x78')]();_0x5f53b3['push'](db['sequelize'][_0x7721('0x2d')](_0x8fc283));return BPromise[_0x7721('0x7e')](_0x5f53b3);})['then'](function(){return _0x1bd066;})[_0x7721('0x16')](respondWithResult(_0x1aa1fc,null))[_0x7721('0x30')](handleError(_0x1aa1fc,null));};exports[_0x7721('0xac')]=function(_0xbc4f13,_0x50f4bd){return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xbc4f13['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x50f4bd,null))[_0x7721('0x16')](function(_0x537831){if(_0x537831){return _0x537831[_0x7721('0xac')](_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')]);}})[_0x7721('0x16')](function(_0x49548e){if(_0x49548e){return db['CmHopper'][_0x7721('0x17')]({'where':{'ListId':_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0xbc4f13[_0x7721('0x31')]['id']}})['then'](function(){return _0x49548e;});}})['then'](respondWithStatusCode(_0x50f4bd,null))[_0x7721('0x30')](handleError(_0x50f4bd,null));};exports[_0x7721('0xad')]=function(_0x4ea8ac,_0x226556){var _0x4bd023={};var _0x50de45={};var _0x51ac8f;var _0x27ed5e;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x4ea8ac[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x226556,null))['then'](function(_0x4893c0){if(_0x4893c0){_0x51ac8f=_0x4893c0;_0x50de45[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x8a')][_0x7721('0x34')]);_0x50de45[_0x7721('0x2d')]=_['keys'](_0x4ea8ac[_0x7721('0x2d')]);_0x50de45[_0x7721('0x35')]=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],_0x50de45[_0x7721('0x2d')]);_0x4bd023['attributes']=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],qs[_0x7721('0x38')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x38')]));_0x4bd023[_0x7721('0x36')]=_0x4bd023['attributes']['length']?_0x4bd023[_0x7721('0x36')]:_0x50de45[_0x7721('0x32')];_0x4bd023[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x51')]);_0x4bd023[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x4ea8ac[_0x7721('0x2d')],_0x50de45[_0x7721('0x35')]));if(_0x4ea8ac['query'][_0x7721('0x1c')]){_0x4bd023[_0x7721('0x2b')]=_['merge'](_0x4bd023[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x4bd023[_0x7721('0x36')],function(_0x400273){var _0x42c438={};_0x42c438[_0x400273]={'$like':'%'+_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x42c438;})});}_0x4bd023=_[_0x7721('0x47')]({},_0x4bd023,_0x4ea8ac[_0x7721('0x3a')]);return _0x51ac8f[_0x7721('0xad')](_0x4bd023);}})[_0x7721('0x16')](function(_0x1192a8){if(_0x1192a8){_0x27ed5e=_0x1192a8[_0x7721('0x39')];if(!_0x4ea8ac['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x4bd023['limit']=qs[_0x7721('0x4f')](_0x4ea8ac['query'][_0x7721('0x4f')]);_0x4bd023[_0x7721('0x11')]=qs['offset'](_0x4ea8ac['query'][_0x7721('0x11')]);}return _0x51ac8f['getBlackLists'](_0x4bd023);}})[_0x7721('0x16')](function(_0x2f7067){if(_0x2f7067){return _0x2f7067?{'count':_0x27ed5e,'rows':_0x2f7067}:null;}})[_0x7721('0x16')](respondWithResult(_0x226556,null))[_0x7721('0x30')](handleError(_0x226556,null));};exports[_0x7721('0xae')]=function(_0x376f37,_0x5b157e){var _0x4b84b9;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x376f37[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x5b157e,null))[_0x7721('0x16')](function(_0x39d43b){if(_0x39d43b){return _0x39d43b['addBlackLists'](_0x376f37['body'][_0x7721('0x81')],_[_0x7721('0x43')](_0x376f37[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x430304){var _0x469b6b;_0x4b84b9=_0x430304||[];var _0x6766c6=[];if(_0x430304){for(var _0x37877c=0x0;_0x37877c<_0x430304['length'];_0x37877c+=0x1){var _0x259eaa=_0x430304[_0x37877c][_0x7721('0x18')]({'plain':!![]});_0x469b6b=squel['insert']()['into'](_0x7721('0xaf'))[_0x7721('0xa1')]([_0x7721('0x95'),'ContactId',_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x259eaa['CmListId'][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0x376f37[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field'](_0x7721('0xb0'),_0x7721('0x44'))[_0x7721('0x6f')](_0x7721('0xb0'),'updatedAt')[_0x7721('0x70')](_0x7721('0x97'))['where'](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x259eaa['CmListId']['toString']())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();_0x6766c6[_0x7721('0x77')](db['sequelize'][_0x7721('0x2d')](_0x469b6b));}return BPromise[_0x7721('0x7e')](_0x6766c6);}})['then'](function(){return _0x4b84b9;})[_0x7721('0x16')](respondWithResult(_0x5b157e,null))[_0x7721('0x30')](handleError(_0x5b157e,null));};exports[_0x7721('0xb1')]=function(_0x37da70,_0x54616a){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x37da70[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x54616a,null))[_0x7721('0x16')](function(_0x174e79){if(_0x174e79){return _0x174e79['removeBlackLists'](_0x37da70[_0x7721('0x2d')]['ids']);}})[_0x7721('0x16')](function(_0x4c1b63){if(_0x4c1b63){return db[_0x7721('0x57')][_0x7721('0x17')]({'where':{'ListId':_0x37da70[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0x37da70[_0x7721('0x31')]['id']}})['then'](function(){return _0x4c1b63;});}})[_0x7721('0x16')](respondWithStatusCode(_0x54616a,null))[_0x7721('0x30')](handleError(_0x54616a,null));}; \ No newline at end of file +var _0xa41a=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','ids','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./voiceQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','key','where','include','VoiceQueue','findAll','rows','catch','params','model','query','keys','attributes','intersection','fields','length','merge','options','create','body','user','role','VoiceQueues','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit'];(function(_0x1cdab6,_0x6ff98f){var _0x304aa1=function(_0x2583c8){while(--_0x2583c8){_0x1cdab6['push'](_0x1cdab6['shift']());}};_0x304aa1(++_0x6ff98f);}(_0xa41a,0x6b));var _0xaa41=function(_0x2c133e,_0x4df72c){_0x2c133e=_0x2c133e-0x0;var _0x46b891=_0xa41a[_0x2c133e];return _0x46b891;};'use strict';var moment=require(_0xaa41('0x0'));var BPromise=require(_0xaa41('0x1'));var util=require('util');var _=require(_0xaa41('0x2'));var squel=require(_0xaa41('0x3'));var Redis=require(_0xaa41('0x4'));var qs=require(_0xaa41('0x5'));var logger=require(_0xaa41('0x6'))(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var db=require(_0xaa41('0x9'))['db'];config['redis']=_[_0xaa41('0xa')](config[_0xaa41('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa41('0xb')]));require(_0xaa41('0xc'))['register'](socket);function respondWithStatusCode(_0x31df43,_0x33f66b){_0x33f66b=_0x33f66b||0xcc;return function(_0x409dab){if(_0x409dab){return _0x31df43[_0xaa41('0xd')](_0x33f66b);}return _0x31df43[_0xaa41('0xe')](_0x33f66b)[_0xaa41('0xf')]();};}function respondWithResult(_0x806f08,_0x423a19){_0x423a19=_0x423a19||0xc8;return function(_0x1c291e){if(_0x1c291e){return _0x806f08['status'](_0x423a19)[_0xaa41('0x10')](_0x1c291e);}};}function respondWithFilteredResult(_0x10cda9,_0x524cab){return function(_0x54827c){if(_0x54827c){var _0x1d0a54=typeof _0x524cab['offset']===_0xaa41('0x11')&&typeof _0x524cab[_0xaa41('0x12')]===_0xaa41('0x11');var _0x889d44=_0x54827c[_0xaa41('0x13')];var _0x4eaf81=_0x1d0a54?0x0:_0x524cab[_0xaa41('0x14')];var _0x178170=_0x1d0a54?_0x54827c[_0xaa41('0x13')]:_0x524cab[_0xaa41('0x14')]+_0x524cab[_0xaa41('0x12')];var _0x2005ae;if(_0x178170>=_0x889d44){_0x178170=_0x889d44;_0x2005ae=0xc8;}else{_0x2005ae=0xce;}_0x10cda9[_0xaa41('0xe')](_0x2005ae);return _0x10cda9['set'](_0xaa41('0x15'),_0x4eaf81+'-'+_0x178170+'/'+_0x889d44)[_0xaa41('0x10')](_0x54827c);}return null;};}function saveUpdates(_0x4210fa){return function(_0x391b01){if(_0x391b01){return _0x391b01[_0xaa41('0x16')](_0x4210fa)[_0xaa41('0x17')](function(_0x29efe5){return _0x29efe5;});}return null;};}function removeEntity(_0x46e6d3){return function(_0x150ddf){if(_0x150ddf){return _0x150ddf['destroy']()['then'](function(){var _0x1f502a=_0x150ddf[_0xaa41('0x18')]({'plain':!![]});var _0x35c753=[{'name':'VoiceQueues','value':_0xaa41('0x19'),'ignore':![]},{'name':_0xaa41('0x1a'),'value':'outbound','ignore':![]}];var _0x513c61=_(_0x35c753)[_0xaa41('0x1b')]('ignore')[_0xaa41('0x1c')](_0xaa41('0x1d'))[_0xaa41('0x1d')]();if(_[_0xaa41('0x1e')](_0x513c61,_0x1f502a[_0xaa41('0x1f')])){return;}var _0x4eb01f=_[_0xaa41('0x20')](_0x35c753,[_0xaa41('0x1d'),_0x1f502a[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x22')][_0xaa41('0x23')]({'where':{'type':_0x4eb01f,'resourceId':_0x1f502a['id']}})['then'](function(){return _0x150ddf;});})['then'](function(){_0x46e6d3[_0xaa41('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x493a10){return function(_0x12e362){if(!_0x12e362){_0x493a10['sendStatus'](0x194);}return _0x12e362;};}function handleError(_0x536bed,_0x2d0ac0){_0x2d0ac0=_0x2d0ac0||0x1f4;return function(_0x9c8c21){logger[_0xaa41('0x24')](_0x9c8c21[_0xaa41('0x25')]);if(_0x9c8c21[_0xaa41('0x21')]){delete _0x9c8c21[_0xaa41('0x21')];}_0x536bed['status'](_0x2d0ac0)[_0xaa41('0x26')](_0x9c8c21);};}exports[_0xaa41('0x27')]=function(_0x63c18c,_0x9a16e3){var _0x1d8c2b={};var _0x4466a3={'count':0x0,'rows':[]};var _0x30f88e=_[_0xaa41('0x1c')](db['VoiceQueue'][_0xaa41('0x28')],function(_0x48b48b){return{'name':_0x48b48b['fieldName'],'type':_0x48b48b[_0xaa41('0x1f')][_0xaa41('0x29')]};});_0x1d8c2b=qs['getOptions'](_0x30f88e,_0x63c18c);var _0x392b5d={'where':_0x1d8c2b[_0xaa41('0x2a')]};return db['VoiceQueue']['count'](_0x392b5d)['then'](function(_0x1cf3da){_0x4466a3[_0xaa41('0x13')]=_0x1cf3da;_0x1d8c2b[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x63c18c['query']);return db[_0xaa41('0x2c')][_0xaa41('0x2d')](_0x1d8c2b);})[_0xaa41('0x17')](function(_0x4de770){_0x4466a3[_0xaa41('0x2e')]=_0x4de770;return _0x4466a3;})[_0xaa41('0x17')](respondWithFilteredResult(_0x9a16e3,_0x1d8c2b))[_0xaa41('0x2f')](handleError(_0x9a16e3,null));};exports['show']=function(_0x252c62,_0x374117){var _0x57fe1d={'raw':![],'where':{'id':_0x252c62[_0xaa41('0x30')]['id']}},_0x23eb50={};_0x23eb50[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x2c')]['rawAttributes']);_0x23eb50[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x252c62[_0xaa41('0x32')]);_0x23eb50['filters']=_['intersection'](_0x23eb50['model'],_0x23eb50[_0xaa41('0x32')]);_0x57fe1d[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x23eb50[_0xaa41('0x31')],qs['fields'](_0x252c62['query'][_0xaa41('0x36')]));_0x57fe1d[_0xaa41('0x34')]=_0x57fe1d[_0xaa41('0x34')][_0xaa41('0x37')]?_0x57fe1d[_0xaa41('0x34')]:_0x23eb50[_0xaa41('0x31')];if(_0x252c62[_0xaa41('0x32')]['includeAll']){_0x57fe1d[_0xaa41('0x2b')]=[{'all':!![]}];}_0x57fe1d=_[_0xaa41('0x38')]({},_0x57fe1d,_0x252c62[_0xaa41('0x39')]);return db[_0xaa41('0x2c')]['find'](_0x57fe1d)['then'](handleEntityNotFound(_0x374117,null))[_0xaa41('0x17')](respondWithResult(_0x374117,null))[_0xaa41('0x2f')](handleError(_0x374117,null));};exports['create']=function(_0x4101ab,_0x563687){return db[_0xaa41('0x2c')][_0xaa41('0x3a')](_0x4101ab[_0xaa41('0x3b')],{})[_0xaa41('0x17')](function(_0x3e6cac){var _0x12ba1a=_0x4101ab[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x12ba1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12ba1a[_0xaa41('0x3d')]===_0xaa41('0x3c')){var _0x35c685=_0x3e6cac[_0xaa41('0x18')]({'plain':!![]});var _0xc84fb8=[{'name':_0xaa41('0x3e'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0x4f9086=_[_0xaa41('0x20')](_0xc84fb8,[_0xaa41('0x1d'),_0x35c685[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db[_0xaa41('0x40')][_0xaa41('0x20')]({'where':{'name':_0x4f9086,'userProfileId':_0x12ba1a[_0xaa41('0x41')]},'raw':!![]})['then'](function(_0x124992){if(_0x124992&&_0x124992['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x3a')]({'name':_0x35c685['name'],'resourceId':_0x35c685['id'],'type':_0x124992['name'],'sectionId':_0x124992['id']},{})['then'](function(){return _0x3e6cac;});}else{return _0x3e6cac;}})[_0xaa41('0x2f')](function(_0x525b09){logger[_0xaa41('0x24')](_0xaa41('0x42'),_0x525b09);throw _0x525b09;});}return _0x3e6cac;})['then'](respondWithResult(_0x563687,0xc9))['catch'](handleError(_0x563687,null));};exports[_0xaa41('0x43')]=function(_0x1b7b97,_0x1bb973){var _0x2af8ba={'where':{'id':_0x1b7b97[_0xaa41('0x30')]['id']}},_0x3fe1a9={};_0x3fe1a9[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x2c')]['rawAttributes']);_0x2af8ba[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x3fe1a9[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x36')]));_0x2af8ba['attributes']=_0x2af8ba[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2af8ba[_0xaa41('0x34')]:_0x3fe1a9[_0xaa41('0x31')];if(_0x1b7b97['query'][_0xaa41('0x44')]){_0x2af8ba['include']=[{'all':!![]}];}_0x2af8ba=_['merge']({},_0x2af8ba,_0x1b7b97[_0xaa41('0x39')]);return db[_0xaa41('0x2c')][_0xaa41('0x20')](_0x2af8ba)['then'](handleEntityNotFound(_0x1bb973,null))[_0xaa41('0x17')](function(_0x3e1a73){if(_0x3e1a73){var _0x853ccb=_0x3e1a73['get']({'plain':!![]});_0x853ccb=qs[_0xaa41('0x45')](_0x853ccb,['id',_0xaa41('0x46'),_0xaa41('0x47')]);_0x1b7b97[_0xaa41('0x3b')]=_[_0xaa41('0x45')](_0x1b7b97[_0xaa41('0x3b')],['id',_0xaa41('0x46'),_0xaa41('0x47')]);return db['VoiceQueue'][_0xaa41('0x3a')](_['merge'](_0x853ccb,_0x1b7b97['body']),{'include':_0x1b7b97[_0xaa41('0x32')][_0xaa41('0x44')]?[{'all':!![]}]:undefined})[_0xaa41('0x17')](function(_0x11f7d9){var _0x14aab0=_0x1b7b97[_0xaa41('0x3c')][_0xaa41('0x18')]({'plain':!![]});if(!_0x14aab0)throw new Error(_0xaa41('0x48'));if(_0x14aab0['role']===_0xaa41('0x3c')){var _0x14b0f0=_0x11f7d9[_0xaa41('0x18')]({'plain':!![]});var _0x4f9e92=[{'name':_0xaa41('0x3e'),'value':_0xaa41('0x19')},{'name':'QueueCampaigns','value':_0xaa41('0x3f')}];var _0xd36d1a=_[_0xaa41('0x20')](_0x4f9e92,['value',_0x14b0f0[_0xaa41('0x1f')]])[_0xaa41('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0xd36d1a,'userProfileId':_0x14aab0[_0xaa41('0x41')]},'raw':!![]})[_0xaa41('0x17')](function(_0x3a29d2){if(_0x3a29d2&&_0x3a29d2['autoAssociation']===0x0){return db[_0xaa41('0x22')][_0xaa41('0x3a')]({'name':_0x14b0f0[_0xaa41('0x21')],'resourceId':_0x14b0f0['id'],'type':_0x3a29d2[_0xaa41('0x21')],'sectionId':_0x3a29d2['id']},{})[_0xaa41('0x17')](function(){return _0x11f7d9;});}else{return _0x11f7d9;}})['catch'](function(_0x2ae70c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ae70c);throw _0x2ae70c;});}return _0x11f7d9;});}})[_0xaa41('0x17')](respondWithResult(_0x1bb973,0xc9))['catch'](handleError(_0x1bb973,null));};exports[_0xaa41('0x16')]=function(_0xbbf261,_0x169ddf){if(_0xbbf261['body']['id']){delete _0xbbf261[_0xaa41('0x3b')]['id'];}return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0xbbf261[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x169ddf,null))[_0xaa41('0x17')](saveUpdates(_0xbbf261[_0xaa41('0x3b')],null))[_0xaa41('0x17')](respondWithResult(_0x169ddf,null))[_0xaa41('0x2f')](handleError(_0x169ddf,null));};exports['destroy']=function(_0x35a09e,_0x40cdfc){return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x35a09e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x40cdfc,null))[_0xaa41('0x17')](removeEntity(_0x40cdfc,null))[_0xaa41('0x2f')](handleError(_0x40cdfc,null));};exports[_0xaa41('0x49')]=function(_0xfbe748,_0x320ce7){var _0x5ea056={'raw':![],'where':{}};var _0x55a85c={};var _0x5cb34d={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xfbe748['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x320ce7,null))['then'](function(_0x576e6e){if(_0x576e6e){_0x55a85c[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x4a')][_0xaa41('0x28')]);_0x55a85c['query']=_[_0xaa41('0x33')](_0xfbe748[_0xaa41('0x32')]);_0x55a85c[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],_0x55a85c[_0xaa41('0x32')]);_0x5ea056[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x55a85c[_0xaa41('0x31')],qs['fields'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5ea056['attributes']=_0x5ea056['attributes']['length']?_0x5ea056[_0xaa41('0x34')]:_0x55a85c['model'];if(!_0xfbe748[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x5ea056[_0xaa41('0x12')]=qs['limit'](_0xfbe748[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5ea056[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xfbe748['query']['offset']);}_0x5ea056[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfbe748['query']['sort']);_0x5ea056[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfbe748[_0xaa41('0x32')],_0x55a85c[_0xaa41('0x4b')]));_0x5ea056['where'][_0xaa41('0x50')]=_0x576e6e['id'];if(_0xfbe748['query']['filter']){_0x5ea056['where']=_[_0xaa41('0x38')](_0x5ea056[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5ea056['attributes'],function(_0x229297){var _0x2adf93={};_0x2adf93[_0x229297]={'$like':'%'+_0xfbe748[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x2adf93;})});}_0x5ea056=_[_0xaa41('0x38')]({},_0x5ea056,_0xfbe748[_0xaa41('0x39')]);return db[_0xaa41('0x4a')]['count']({'where':_0x5ea056[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x40b47c){_0x5cb34d[_0xaa41('0x13')]=_0x40b47c;if(_0xfbe748['query'][_0xaa41('0x44')]){_0x5ea056['include']=[{'all':!![]}];}return db[_0xaa41('0x4a')][_0xaa41('0x2d')](_0x5ea056);})[_0xaa41('0x17')](function(_0x143ef0){_0x5cb34d['rows']=_0x143ef0;return _0x5cb34d;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x320ce7,_0x5ea056))[_0xaa41('0x2f')](handleError(_0x320ce7,null));};exports[_0xaa41('0x51')]=function(_0x304aad,_0x59052d){var _0x140d78={'raw':!![],'where':{}};var _0x50197b={};var _0x55d380={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x304aad[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x59052d,null))[_0xaa41('0x17')](function(_0x582d79){if(_0x582d79){_0x50197b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x52')][_0xaa41('0x28')]);_0x50197b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x304aad[_0xaa41('0x32')]);_0x50197b['filters']=_[_0xaa41('0x35')](_0x50197b[_0xaa41('0x31')],_0x50197b[_0xaa41('0x32')]);_0x140d78['attributes']=_['intersection'](_0x50197b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x304aad['query'][_0xaa41('0x36')]));_0x140d78[_0xaa41('0x34')]=_0x140d78['attributes'][_0xaa41('0x37')]?_0x140d78[_0xaa41('0x34')]:_0x50197b[_0xaa41('0x31')];if(!_0x304aad[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x140d78[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x304aad['query']['limit']);_0x140d78[_0xaa41('0x14')]=qs['offset'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x140d78[_0xaa41('0x4d')]=qs['sort'](_0x304aad[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x140d78[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x304aad[_0xaa41('0x32')],_0x50197b['filters']));_0x140d78[_0xaa41('0x2a')]['VoiceQueueId']=_0x582d79['id'];if(_0x304aad['query'][_0xaa41('0x1b')]){_0x140d78[_0xaa41('0x2a')]=_['merge'](_0x140d78['where'],{'$or':_[_0xaa41('0x1c')](_0x140d78[_0xaa41('0x34')],function(_0x3c189d){var _0x447183={};_0x447183[_0x3c189d]={'$like':'%'+_0x304aad['query'][_0xaa41('0x1b')]+'%'};return _0x447183;})});}_0x140d78=_[_0xaa41('0x38')]({},_0x140d78,_0x304aad[_0xaa41('0x39')]);return db['CmHopperHistory'][_0xaa41('0x13')]({'where':_0x140d78[_0xaa41('0x2a')]})[_0xaa41('0x17')](function(_0x5697b6){_0x55d380[_0xaa41('0x13')]=_0x5697b6;if(_0x304aad['query']['includeAll']){_0x140d78[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x52')]['findAll'](_0x140d78);})[_0xaa41('0x17')](function(_0x9e8ebb){_0x55d380[_0xaa41('0x2e')]=_0x9e8ebb;return _0x55d380;});}})['then'](respondWithFilteredResult(_0x59052d,_0x140d78))[_0xaa41('0x2f')](handleError(_0x59052d,null));};exports[_0xaa41('0x54')]=function(_0x1a2deb,_0x16dcac){var _0x38f5d0={'raw':!![],'where':{}};var _0x4e087d={};var _0x24eb2e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x1a2deb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x16dcac,null))[_0xaa41('0x17')](function(_0x33ec81){if(_0x33ec81){_0x4e087d[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x56')][_0xaa41('0x28')]);_0x4e087d[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x1a2deb['query']);_0x4e087d[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x4e087d['model'],_0x4e087d[_0xaa41('0x32')]);_0x38f5d0['attributes']=_[_0xaa41('0x35')](_0x4e087d[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x36')]));_0x38f5d0[_0xaa41('0x34')]=_0x38f5d0[_0xaa41('0x34')]['length']?_0x38f5d0[_0xaa41('0x34')]:_0x4e087d[_0xaa41('0x31')];if(!_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x38f5d0[_0xaa41('0x12')]=qs['limit'](_0x1a2deb[_0xaa41('0x32')][_0xaa41('0x12')]);_0x38f5d0[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x1a2deb[_0xaa41('0x32')]['offset']);}_0x38f5d0[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x1a2deb['query'][_0xaa41('0x4e')]);_0x38f5d0[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x1a2deb[_0xaa41('0x32')],_0x4e087d[_0xaa41('0x4b')]));_0x38f5d0[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x33ec81['id'];if(_0x1a2deb['query'][_0xaa41('0x1b')]){_0x38f5d0[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x38f5d0[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x38f5d0[_0xaa41('0x34')],function(_0x5489be){var _0x56f5ff={};_0x56f5ff[_0x5489be]={'$like':'%'+_0x1a2deb['query'][_0xaa41('0x1b')]+'%'};return _0x56f5ff;})});}_0x38f5d0=_[_0xaa41('0x38')]({},_0x38f5d0,_0x1a2deb['options']);return db[_0xaa41('0x56')][_0xaa41('0x13')]({'where':_0x38f5d0['where']})[_0xaa41('0x17')](function(_0x1da898){_0x24eb2e[_0xaa41('0x13')]=_0x1da898;if(_0x1a2deb[_0xaa41('0x32')]['includeAll']){_0x38f5d0[_0xaa41('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xaa41('0x2d')](_0x38f5d0);})[_0xaa41('0x17')](function(_0x374873){_0x24eb2e[_0xaa41('0x2e')]=_0x374873;return _0x24eb2e;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x16dcac,_0x38f5d0))[_0xaa41('0x2f')](handleError(_0x16dcac,null));};exports[_0xaa41('0x57')]=function(_0x27363e,_0x25cac8){var _0x5381d5={'raw':!![],'where':{}};var _0x276013={};var _0x3135c3={'count':0x0,'rows':[]};return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0x27363e[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25cac8,null))[_0xaa41('0x17')](function(_0x408d95){if(_0x408d95){_0x276013[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x58')][_0xaa41('0x28')]);_0x276013[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x27363e[_0xaa41('0x32')]);_0x276013['filters']=_[_0xaa41('0x35')](_0x276013[_0xaa41('0x31')],_0x276013[_0xaa41('0x32')]);_0x5381d5[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x276013['model'],qs['fields'](_0x27363e[_0xaa41('0x32')][_0xaa41('0x36')]));_0x5381d5['attributes']=_0x5381d5[_0xaa41('0x34')][_0xaa41('0x37')]?_0x5381d5['attributes']:_0x276013['model'];if(!_0x27363e['query'][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x5381d5[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x12')]);_0x5381d5[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x27363e[_0xaa41('0x32')][_0xaa41('0x14')]);}_0x5381d5[_0xaa41('0x4d')]=qs['sort'](_0x27363e['query'][_0xaa41('0x4e')]);_0x5381d5[_0xaa41('0x2a')]=qs['filters'](_[_0xaa41('0x4f')](_0x27363e['query'],_0x276013[_0xaa41('0x4b')]));_0x5381d5[_0xaa41('0x2a')][_0xaa41('0x50')]=_0x408d95['id'];if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x5381d5[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x5381d5[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x5381d5['attributes'],function(_0x56bd21){var _0x56661a={};_0x56661a[_0x56bd21]={'$like':'%'+_0x27363e[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x56661a;})});}_0x5381d5=_['merge']({},_0x5381d5,_0x27363e['options']);return db[_0xaa41('0x58')][_0xaa41('0x13')]({'where':_0x5381d5['where']})['then'](function(_0xf651b7){_0x3135c3['count']=_0xf651b7;if(_0x27363e[_0xaa41('0x32')][_0xaa41('0x44')]){_0x5381d5[_0xaa41('0x2b')]=[{'all':!![]}];}return db[_0xaa41('0x58')][_0xaa41('0x2d')](_0x5381d5);})[_0xaa41('0x17')](function(_0x211455){_0x3135c3[_0xaa41('0x2e')]=_0x211455;return _0x3135c3;});}})[_0xaa41('0x17')](respondWithFilteredResult(_0x25cac8,_0x5381d5))['catch'](handleError(_0x25cac8,null));};exports['getTeams']=function(_0x38884d,_0x25d938){var _0x337655={};var _0x415705={};var _0x3efb43;var _0xae746;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x38884d[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x25d938,null))[_0xaa41('0x17')](function(_0x17442e){if(_0x17442e){_0x3efb43=_0x17442e;_0x415705[_0xaa41('0x31')]=_[_0xaa41('0x33')](db[_0xaa41('0x59')]['rawAttributes']);_0x415705[_0xaa41('0x32')]=_['keys'](_0x38884d[_0xaa41('0x32')]);_0x415705[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],_0x415705[_0xaa41('0x32')]);_0x337655[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x415705[_0xaa41('0x31')],qs['fields'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x36')]));_0x337655[_0xaa41('0x34')]=_0x337655[_0xaa41('0x34')][_0xaa41('0x37')]?_0x337655[_0xaa41('0x34')]:_0x415705[_0xaa41('0x31')];_0x337655[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x38884d[_0xaa41('0x32')]['sort']);_0x337655['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x38884d[_0xaa41('0x32')],_0x415705[_0xaa41('0x4b')]));if(_0x38884d[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x337655[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x337655[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x337655['attributes'],function(_0x49b468){var _0x17018e={};_0x17018e[_0x49b468]={'$like':'%'+_0x38884d[_0xaa41('0x32')]['filter']+'%'};return _0x17018e;})});}_0x337655=_[_0xaa41('0x38')]({},_0x337655,_0x38884d['options']);return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x50e03d){if(_0x50e03d){_0xae746=_0x50e03d['length'];if(!_0x38884d[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x337655['limit']=qs['limit'](_0x38884d[_0xaa41('0x32')]['limit']);_0x337655[_0xaa41('0x14')]=qs['offset'](_0x38884d[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x3efb43[_0xaa41('0x5a')](_0x337655);}})[_0xaa41('0x17')](function(_0x182b0b){if(_0x182b0b){return _0x182b0b?{'count':_0xae746,'rows':_0x182b0b}:null;}})[_0xaa41('0x17')](respondWithResult(_0x25d938,null))[_0xaa41('0x2f')](handleError(_0x25d938,null));};exports['addTeams']=function(_0x4363b5,_0x1fa1f5){var _0x50883c=_0x4363b5[_0xaa41('0x3b')][_0xaa41('0x5b')];var _0x1c3d7f=_[_0xaa41('0x1c')](_0x50883c,'id');return db['Team'][_0xaa41('0x2d')]({'where':{'id':_0x1c3d7f},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]}]})[_0xaa41('0x17')](function(_0xe2574a){if(_0xe2574a){var _0x4d83ce=_['flatMap'](_0xe2574a,function(_0x214ebe){var _0x2df75c=_0x214ebe[_0xaa41('0x18')]({'plain':!![]});_0x2df75c[_0xaa41('0x5d')][_0xaa41('0x61')](function(_0x401586){_0x401586['penalty']=_[_0xaa41('0x20')](_0x50883c,{'id':_0x2df75c['id']})[_0xaa41('0x62')];});return _0x2df75c[_0xaa41('0x5d')];});return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x4363b5[_0xaa41('0x30')]['id']}})['then'](function(_0xe8076e){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4cf0c5){return _0xe8076e[_0xaa41('0x65')](_0x1c3d7f,{'transaction':_0x4cf0c5})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x50883c,function(_0x255e76){return db[_0xaa41('0x67')][_0xaa41('0x68')]({'TeamId':_0x255e76['id'],'VoiceQueueId':_0x4363b5[_0xaa41('0x30')]['id'],'penalty':_0x255e76[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_0x4d83ce,function(_0x19a42c){return db[_0xaa41('0x69')][_0xaa41('0x6a')]({'where':{'UserId':_0x19a42c['id'],'VoiceQueueId':_0x4363b5['params']['id']},'defaults':{'penalty':_0x19a42c['penalty']},'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){return BPromise[_0xaa41('0x66')](_[_0xaa41('0x1b')](_0x4d83ce,{'online':!![]}),function(_0x2c4595){return db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x2c4595[_0xaa41('0x21')],'UserId':_0x2c4595['id'],'queue_name':_0xe8076e['name'],'VoiceQueueId':_0xe8076e['id'],'interface':_[_0xaa41('0x6c')](_0x2c4595[_0xaa41('0x60')])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x2c4595[_0xaa41('0x21')]):_0x2c4595[_0xaa41('0x60')],'paused':_0x2c4595[_0xaa41('0x5f')]||![],'penalty':_0x2c4595[_0xaa41('0x62')]},{'transaction':_0x4cf0c5});});})[_0xaa41('0x17')](function(){_0x4d83ce[_0xaa41('0x61')](function(_0x3f2dbb){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':_0x3f2dbb['id'],'VoiceQueueId':_0xe8076e['id']});});});});});}})[_0xaa41('0x17')](respondWithStatusCode(_0x1fa1f5,null))[_0xaa41('0x2f')](handleError(_0x1fa1f5,null));};exports['removeTeams']=function(_0x33f008,_0x1489fe){return db[_0xaa41('0x59')][_0xaa41('0x2d')]({'where':{'id':_0x33f008['query'][_0xaa41('0x70')]},'attributes':['id'],'include':[{'model':db[_0xaa41('0x5c')],'as':_0xaa41('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xaa41('0x17')](handleEntityNotFound(_0x1489fe,null))[_0xaa41('0x17')](function(_0x4baae3){var _0xc59a12=_['map'](_0x4baae3,'id');var _0x50a526=[];var _0x3dd3fa=[];var _0x552493=squel['select']();_0x552493[_0xaa41('0x71')](_0xaa41('0x72'))[_0xaa41('0x73')]('team_has_voice_queues','tq')[_0xaa41('0x74')](_0xaa41('0x75'),'ut',_0xaa41('0x76'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x33f008[_0xaa41('0x30')]['id']);for(var _0x29d34a=0x0;_0x29d34a<_0x4baae3[_0xaa41('0x37')];_0x29d34a+=0x1){let _0x48e2cf=_0x4baae3[_0x29d34a];for(var _0x410d6e=0x0;_0x410d6e<_0x48e2cf[_0xaa41('0x5d')][_0xaa41('0x37')];_0x410d6e+=0x1){let _0x3361f5=_0x48e2cf[_0xaa41('0x5d')][_0x410d6e];var _0x4f1bcb=_0x552493['clone']();_0x4f1bcb[_0xaa41('0x2a')](_0xaa41('0x78'),_0x3361f5['id']);_0x3dd3fa[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x4f1bcb[_0xaa41('0x7a')](),{'type':db['sequelize'][_0xaa41('0x7b')][_0xaa41('0x7c')]})['then'](function(_0x40f4ce){if(_0x40f4ce[_0xaa41('0x37')]===0x1){return _0x3361f5['id'];}else{var _0x95300a=_[_0xaa41('0x7d')](_[_0xaa41('0x1c')](_0x40f4ce,_0xaa41('0x7e')),function(_0x1926bd){return _['includes'](_0xc59a12,_0x1926bd);});if(_0x95300a){return _0x3361f5['id'];}}}));}}return BPromise[_0xaa41('0x7f')](_0x3dd3fa)[_0xaa41('0x17')](function(_0x5404cd){_0x50a526=_(_0x50a526)[_0xaa41('0x80')](_0x5404cd)[_0xaa41('0x81')]()[_0xaa41('0x1d')]();return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x33f008[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(_0x339537){return db[_0xaa41('0x63')][_0xaa41('0x64')](function(_0x4b84bc){return _0x339537[_0xaa41('0x82')](_0x33f008[_0xaa41('0x32')]['ids'],{'transaction':_0x4b84bc})['then'](function(){if(!_[_0xaa41('0x83')](_0x50a526)){return _0x339537[_0xaa41('0x84')](_0x50a526,{'transaction':_0x4b84bc})[_0xaa41('0x17')](function(){return db[_0xaa41('0x6b')][_0xaa41('0x23')]({'where':{'VoiceQueueId':_0x33f008[_0xaa41('0x30')]['id'],'UserId':_0x50a526},'transaction':_0x4b84bc});});}})['then'](function(){_0x50a526['forEach'](function(_0x395323){socket[_0xaa41('0x6f')]('userVoiceQueue:remove',{'UserId':_0x395323,'VoiceQueueId':_0x339537['id']});});});});});});})['then'](respondWithStatusCode(_0x1489fe,null))[_0xaa41('0x2f')](handleError(_0x1489fe,null));};exports[_0xaa41('0x85')]=function(_0x2fe50f,_0x520b50){var _0x50122d,_0x1d609e;return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2fe50f['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x520b50,null))[_0xaa41('0x17')](function(_0x5a0791){if(_0x5a0791){_0x1d609e=_0x5a0791;return _0x5a0791['addAgents'](_0x2fe50f[_0xaa41('0x3b')]['ids'],_[_0xaa41('0x45')](_0x2fe50f[_0xaa41('0x3b')],[_0xaa41('0x70'),'id'])||{})[_0xaa41('0x86')](function(_0x1d7c2e){for(var _0xdc0493=0x0;_0xdc0493<_0x2fe50f[_0xaa41('0x3b')]['ids'][_0xaa41('0x37')];_0xdc0493+=0x1){socket[_0xaa41('0x6f')]('userVoiceQueue:save',{'UserId':Number(_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')][_0xdc0493]),'VoiceQueueId':Number(_0x2fe50f[_0xaa41('0x30')]['id'])});}return _0x1d7c2e;});}})[_0xaa41('0x17')](function(_0x2af16e){_0x50122d=_0x2af16e||[];if(_0x1d609e){return db[_0xaa41('0x5c')]['findAll']({'where':{'id':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x70')]},'attributes':['id',_0xaa41('0x21'),_0xaa41('0x5e'),_0xaa41('0x5f'),_0xaa41('0x60')],'raw':!![]});}})[_0xaa41('0x17')](function(_0x5083ff){if(!_[_0xaa41('0x83')](_0x5083ff)){var _0x3c4e89=[];for(var _0x415acc=0x0;_0x415acc<_0x5083ff['length'];_0x415acc++){if(_0x5083ff[_0x415acc]['online']){_0x3c4e89['push'](db[_0xaa41('0x6b')][_0xaa41('0x68')]({'membername':_0x5083ff[_0x415acc][_0xaa41('0x21')],'UserId':_0x5083ff[_0x415acc]['id'],'queue_name':_0x1d609e[_0xaa41('0x21')],'VoiceQueueId':_0x1d609e['id'],'interface':_[_0xaa41('0x6c')](_0x5083ff[_0x415acc]['interface'])?util[_0xaa41('0x6d')](_0xaa41('0x6e'),_0x5083ff[_0x415acc][_0xaa41('0x21')]):_0x5083ff[_0x415acc][_0xaa41('0x60')],'paused':_0x5083ff[_0x415acc][_0xaa41('0x5f')]||![],'penalty':_0x2fe50f[_0xaa41('0x3b')][_0xaa41('0x62')]||0x0}));}}return BPromise['all'](_0x3c4e89);}})[_0xaa41('0x17')](function(){return _0x50122d;})[_0xaa41('0x17')](respondWithResult(_0x520b50,null))[_0xaa41('0x2f')](handleError(_0x520b50,null));};exports['removeAgents']=function(_0x16a173,_0x53a519){return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x16a173['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x53a519,null))[_0xaa41('0x17')](function(_0x366705){if(_0x366705){return _0x366705[_0xaa41('0x84')](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])[_0xaa41('0x17')](function(){if(_['isArray'](_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')])){for(var _0x3ee9e3=0x0;_0x3ee9e3<_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0xaa41('0x37')];_0x3ee9e3+=0x1){socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')][_0x3ee9e3]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}}else{socket[_0xaa41('0x6f')](_0xaa41('0x87'),{'UserId':Number(_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]),'VoiceQueueId':Number(_0x16a173[_0xaa41('0x30')]['id'])});}});}})['then'](function(_0x29b27e){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x16a173['params']['id'],'UserId':_0x16a173[_0xaa41('0x32')][_0xaa41('0x70')]}})['then'](function(){return _0x29b27e;});})[_0xaa41('0x17')](respondWithStatusCode(_0x53a519,null))[_0xaa41('0x2f')](handleError(_0x53a519,null));};exports[_0xaa41('0x88')]=function(_0x15bb60,_0x232732){var _0x34d857={};var _0x239f1b={};var _0x445925;var _0x1e8591;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0x15bb60[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x232732,null))[_0xaa41('0x17')](function(_0x7bae82){if(_0x7bae82){_0x445925=_0x7bae82;_0x239f1b[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['User'][_0xaa41('0x28')]);_0x239f1b[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x15bb60[_0xaa41('0x32')]);_0x239f1b['filters']=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],_0x239f1b['query']);_0x34d857[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x239f1b[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x36')]));_0x34d857[_0xaa41('0x34')]=_0x34d857[_0xaa41('0x34')][_0xaa41('0x37')]?_0x34d857[_0xaa41('0x34')]:_0x239f1b['model'];_0x34d857[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x15bb60[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x34d857[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_['pick'](_0x15bb60[_0xaa41('0x32')],_0x239f1b['filters']));if(_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x34d857[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0x34d857[_0xaa41('0x2a')],{'$or':_['map'](_0x34d857[_0xaa41('0x34')],function(_0x345002){var _0x5f39b4={};_0x5f39b4[_0x345002]={'$like':'%'+_0x15bb60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x5f39b4;})});}_0x34d857=_[_0xaa41('0x38')]({},_0x34d857,_0x15bb60[_0xaa41('0x39')]);return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0x38b3be){if(_0x38b3be){_0x1e8591=_0x38b3be[_0xaa41('0x37')];if(!_0x15bb60[_0xaa41('0x32')][_0xaa41('0x53')]('nolimit')){_0x34d857[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0x15bb60[_0xaa41('0x32')]['limit']);_0x34d857['offset']=qs[_0xaa41('0x14')](_0x15bb60['query']['offset']);}return _0x445925[_0xaa41('0x88')](_0x34d857);}})[_0xaa41('0x17')](function(_0xa4dbd3){if(_0xa4dbd3){return _0xa4dbd3?{'count':_0x1e8591,'rows':_0xa4dbd3}:null;}})[_0xaa41('0x17')](respondWithResult(_0x232732,null))['catch'](handleError(_0x232732,null));};exports['getMembers']=function(_0xa63e60,_0xf4f13f){var _0xef0e44={};var _0x46d37f={};var _0x6a6081;var _0x5e3bb2;return db[_0xaa41('0x2c')][_0xaa41('0x55')]({'where':{'id':_0xa63e60['params']['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0xf4f13f,null))[_0xaa41('0x17')](function(_0x4b4a4a){if(_0x4b4a4a){_0x6a6081=_0x4b4a4a;_0x46d37f[_0xaa41('0x31')]=_[_0xaa41('0x33')](db['UserVoiceQueueRt'][_0xaa41('0x28')]);_0x46d37f[_0xaa41('0x32')]=_['keys'](_0xa63e60[_0xaa41('0x32')]);_0x46d37f['filters']=_['intersection'](_0x46d37f[_0xaa41('0x31')],_0x46d37f[_0xaa41('0x32')]);_0xef0e44[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x46d37f[_0xaa41('0x31')],qs['fields'](_0xa63e60[_0xaa41('0x32')]['fields']));_0xef0e44['attributes']=_0xef0e44[_0xaa41('0x34')][_0xaa41('0x37')]?_0xef0e44[_0xaa41('0x34')]:_0x46d37f[_0xaa41('0x31')];_0xef0e44[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xa63e60[_0xaa41('0x32')]['sort']);_0xef0e44[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xa63e60[_0xaa41('0x32')],_0x46d37f[_0xaa41('0x4b')]));if(_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]){_0xef0e44[_0xaa41('0x2a')]=_[_0xaa41('0x38')](_0xef0e44[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0xef0e44[_0xaa41('0x34')],function(_0x5a2ba0){var _0x4fc7d6={};_0x4fc7d6[_0x5a2ba0]={'$like':'%'+_0xa63e60[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x4fc7d6;})});}_0xef0e44=_[_0xaa41('0x38')]({},_0xef0e44,_0xa63e60['options']);return _0x6a6081[_0xaa41('0x89')](_0xef0e44);}})[_0xaa41('0x17')](function(_0x15bc15){if(_0x15bc15){_0x5e3bb2=_0x15bc15[_0xaa41('0x37')];if(!_0xa63e60[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0xef0e44[_0xaa41('0x12')]=qs[_0xaa41('0x12')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x12')]);_0xef0e44[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0xa63e60[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x6a6081['getMembers'](_0xef0e44);}})[_0xaa41('0x17')](function(_0x28c109){return _0x28c109?{'count':_0x5e3bb2,'rows':_0x28c109}:null;})[_0xaa41('0x17')](respondWithResult(_0xf4f13f,null))['catch'](handleError(_0xf4f13f,null));};exports[_0xaa41('0x8a')]=function(_0xfc1e24,_0x35c48f){var _0x2b0bf9={};var _0x21c0c6={};var _0x1138d0;var _0x394987;return db[_0xaa41('0x2c')]['findOne']({'where':{'id':_0xfc1e24[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x35c48f,null))[_0xaa41('0x17')](function(_0x2fc4b1){if(_0x2fc4b1){_0x1138d0=_0x2fc4b1;_0x21c0c6[_0xaa41('0x31')]=_['keys'](db[_0xaa41('0x8b')]['rawAttributes']);_0x21c0c6[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0xfc1e24[_0xaa41('0x32')]);_0x21c0c6[_0xaa41('0x4b')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],_0x21c0c6[_0xaa41('0x32')]);_0x2b0bf9[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x21c0c6[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0xfc1e24[_0xaa41('0x32')]['fields']));_0x2b0bf9['attributes']=_0x2b0bf9[_0xaa41('0x34')][_0xaa41('0x37')]?_0x2b0bf9[_0xaa41('0x34')]:_0x21c0c6[_0xaa41('0x31')];_0x2b0bf9[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0xfc1e24['query'][_0xaa41('0x4e')]);_0x2b0bf9['where']=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0xfc1e24[_0xaa41('0x32')],_0x21c0c6[_0xaa41('0x4b')]));if(_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]){_0x2b0bf9['where']=_['merge'](_0x2b0bf9[_0xaa41('0x2a')],{'$or':_['map'](_0x2b0bf9[_0xaa41('0x34')],function(_0x3f8296){var _0x438fcf={};_0x438fcf[_0x3f8296]={'$like':'%'+_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x438fcf;})});}_0x2b0bf9=_[_0xaa41('0x38')]({},_0x2b0bf9,_0xfc1e24[_0xaa41('0x39')]);return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x2667bd){if(_0x2667bd){_0x394987=_0x2667bd[_0xaa41('0x37')];if(!_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x53')](_0xaa41('0x4c'))){_0x2b0bf9['limit']=qs[_0xaa41('0x12')](_0xfc1e24['query'][_0xaa41('0x12')]);_0x2b0bf9['offset']=qs[_0xaa41('0x14')](_0xfc1e24[_0xaa41('0x32')][_0xaa41('0x14')]);}return _0x1138d0[_0xaa41('0x8a')](_0x2b0bf9);}})[_0xaa41('0x17')](function(_0x3dafc6){if(_0x3dafc6){return _0x3dafc6?{'count':_0x394987,'rows':_0x3dafc6}:null;}})[_0xaa41('0x17')](respondWithResult(_0x35c48f,null))['catch'](handleError(_0x35c48f,null));};exports[_0xaa41('0x8c')]=function(_0x533f4b,_0x47ca9d){var _0xd1f9ba=moment()[_0xaa41('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c4930,_0x1285ed;return db['VoiceQueue'][_0xaa41('0x20')]({'where':{'id':_0x533f4b[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x47ca9d,null))['then'](function(_0x3ecde6){if(_0x3ecde6){_0x1285ed=_0x3ecde6;return _0x3ecde6['addLists'](_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x533f4b[_0xaa41('0x3b')],['ids','id'])||{});}return null;})[_0xaa41('0x86')](function(_0x32a07e){var _0x2b8b73;_0x2c4930=_0x32a07e||[];var _0x49e4a5=[];if(_0x32a07e){for(var _0xda8e73=0x0;_0xda8e73<_0x32a07e[_0xaa41('0x37')];_0xda8e73+=0x1){var _0x25f5ba=_0x32a07e[_0xda8e73][_0xaa41('0x18')]({'plain':!![]});_0x1285ed[_0xaa41('0x8d')]=_0x533f4b[_0xaa41('0x3b')][_0xaa41('0x8d')]?_0x533f4b[_0xaa41('0x3b')]['dialCheckDuplicateType']:_0x1285ed[_0xaa41('0x8d')];switch(_0x1285ed['dialCheckDuplicateType']){case _0xaa41('0x8e'):_0x2b8b73=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0x91'))[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),'ListId')[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')]['toString']())[_0xaa41('0x2a')](_0xaa41('0x9b'))['where'](_0xaa41('0x9c'),squel['select']()[_0xaa41('0x71')](_0xaa41('0x9d'))[_0xaa41('0x73')](_0xaa41('0x9e'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]()))[_0xaa41('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xaa41('0x71')](_0xaa41('0x9f'))['from'](_0xaa41('0x91'))[_0xaa41('0x2a')](_0xaa41('0x77'),_0x533f4b['params']['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;case _0xaa41('0xa0'):_0x2b8b73=squel['insert']()[_0xaa41('0x90')](_0xaa41('0x91'))['fromQuery'](['phone',_0xaa41('0x94'),_0xaa41('0x95'),_0xaa41('0x96'),_0xaa41('0x50'),'createdAt',_0xaa41('0x47')],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))['field']('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27','createdAt')[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')]('deletedAt\x20IS\x20NULL')[_0xaa41('0x2a')]('ListId\x20=\x20?',_0x25f5ba[_0xaa41('0x98')]['toString']())['where'](_0xaa41('0x9b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xaa41('0x97')]()[_0xaa41('0x71')](_0xaa41('0x9f'))[_0xaa41('0x73')](_0xaa41('0x91'))[_0xaa41('0x2a')]('VoiceQueueId\x20=\x20?',_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')]())))[_0xaa41('0x7a')]();break;default:_0x2b8b73=squel['insert']()[_0xaa41('0x90')]('cm_hopper')[_0xaa41('0x92')]([_0xaa41('0x93'),_0xaa41('0x94'),_0xaa41('0x95'),'ListId','VoiceQueueId',_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x94'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x25f5ba[_0xaa41('0x98')]['toString'](),_0xaa41('0x96'))[_0xaa41('0x71')](_0x533f4b[_0xaa41('0x30')]['id'][_0xaa41('0x7a')](),_0xaa41('0x50'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x47'))['from'](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))['where'](_0xaa41('0x9a'),_0x25f5ba[_0xaa41('0x98')][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))[_0xaa41('0x7a')]();}_0x49e4a5[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x2b8b73));}return BPromise[_0xaa41('0x7f')](_0x49e4a5);}})['then'](function(){var _0x58f009=[];var _0x405eba=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')]('cm_hopper_additional_phones')[_0xaa41('0x92')]([_0xaa41('0xa2'),_0xaa41('0x93'),_0xaa41('0xa3'),_0xaa41('0x46'),_0xaa41('0x47')],squel['select']()[_0xaa41('0x71')](_0xaa41('0xa4'))[_0xaa41('0x71')](_0xaa41('0xa5'))['field'](_0xaa41('0xa6'))[_0xaa41('0x71')]('\x27'+_0xd1f9ba+'\x27',_0xaa41('0x46'))['field']('\x27'+_0xd1f9ba+'\x27','updatedAt')[_0xaa41('0x73')](_0xaa41('0xa7'),'ci')[_0xaa41('0x74')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xaa41('0x2a')](_0xaa41('0xa8'),_0xd1f9ba)[_0xaa41('0x2a')](_0xaa41('0xa9'),_0xaa41('0xaa')))[_0xaa41('0x7a')]();_0x58f009['push'](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x405eba));return BPromise[_0xaa41('0x7f')](_0x58f009);})[_0xaa41('0x17')](function(){return _0x2c4930;})[_0xaa41('0x17')](respondWithResult(_0x47ca9d,null))[_0xaa41('0x2f')](handleError(_0x47ca9d,null));};exports[_0xaa41('0xab')]=function(_0x718a84,_0x151c5f){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x718a84['params']['id']}})['then'](handleEntityNotFound(_0x151c5f,null))[_0xaa41('0x17')](function(_0x293a1d){if(_0x293a1d){return _0x293a1d['removeLists'](_0x718a84[_0xaa41('0x32')][_0xaa41('0x70')]);}})['then'](function(_0x490a6c){if(_0x490a6c){return db[_0xaa41('0x4a')][_0xaa41('0x23')]({'where':{'ListId':_0x718a84[_0xaa41('0x32')]['ids'],'VoiceQueueId':_0x718a84[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x490a6c;});}})['then'](respondWithStatusCode(_0x151c5f,null))[_0xaa41('0x2f')](handleError(_0x151c5f,null));};exports[_0xaa41('0xac')]=function(_0x536cdb,_0x431b75){var _0x18499f={};var _0x49cbd7={};var _0x515f91;var _0x4b5953;return db['VoiceQueue'][_0xaa41('0x55')]({'where':{'id':_0x536cdb[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x431b75,null))[_0xaa41('0x17')](function(_0x4ca8f7){if(_0x4ca8f7){_0x515f91=_0x4ca8f7;_0x49cbd7['model']=_[_0xaa41('0x33')](db['CmList'][_0xaa41('0x28')]);_0x49cbd7[_0xaa41('0x32')]=_[_0xaa41('0x33')](_0x536cdb[_0xaa41('0x32')]);_0x49cbd7['filters']=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],_0x49cbd7[_0xaa41('0x32')]);_0x18499f[_0xaa41('0x34')]=_[_0xaa41('0x35')](_0x49cbd7[_0xaa41('0x31')],qs[_0xaa41('0x36')](_0x536cdb[_0xaa41('0x32')]['fields']));_0x18499f['attributes']=_0x18499f[_0xaa41('0x34')][_0xaa41('0x37')]?_0x18499f[_0xaa41('0x34')]:_0x49cbd7[_0xaa41('0x31')];_0x18499f[_0xaa41('0x4d')]=qs[_0xaa41('0x4e')](_0x536cdb[_0xaa41('0x32')][_0xaa41('0x4e')]);_0x18499f[_0xaa41('0x2a')]=qs[_0xaa41('0x4b')](_[_0xaa41('0x4f')](_0x536cdb[_0xaa41('0x32')],_0x49cbd7[_0xaa41('0x4b')]));if(_0x536cdb['query'][_0xaa41('0x1b')]){_0x18499f[_0xaa41('0x2a')]=_['merge'](_0x18499f[_0xaa41('0x2a')],{'$or':_[_0xaa41('0x1c')](_0x18499f[_0xaa41('0x34')],function(_0x5cd79d){var _0x558583={};_0x558583[_0x5cd79d]={'$like':'%'+_0x536cdb[_0xaa41('0x32')][_0xaa41('0x1b')]+'%'};return _0x558583;})});}_0x18499f=_['merge']({},_0x18499f,_0x536cdb['options']);return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x117841){if(_0x117841){_0x4b5953=_0x117841[_0xaa41('0x37')];if(!_0x536cdb[_0xaa41('0x32')]['hasOwnProperty'](_0xaa41('0x4c'))){_0x18499f[_0xaa41('0x12')]=qs['limit'](_0x536cdb['query'][_0xaa41('0x12')]);_0x18499f[_0xaa41('0x14')]=qs[_0xaa41('0x14')](_0x536cdb[_0xaa41('0x32')]['offset']);}return _0x515f91[_0xaa41('0xac')](_0x18499f);}})[_0xaa41('0x17')](function(_0x1be3c1){if(_0x1be3c1){return _0x1be3c1?{'count':_0x4b5953,'rows':_0x1be3c1}:null;}})[_0xaa41('0x17')](respondWithResult(_0x431b75,null))[_0xaa41('0x2f')](handleError(_0x431b75,null));};exports[_0xaa41('0xad')]=function(_0x42ae0c,_0x4fa4ca){var _0x1e41b5;return db[_0xaa41('0x2c')]['find']({'where':{'id':_0x42ae0c[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4fa4ca,null))[_0xaa41('0x17')](function(_0x135f31){if(_0x135f31){return _0x135f31[_0xaa41('0xad')](_0x42ae0c[_0xaa41('0x3b')][_0xaa41('0x70')],_[_0xaa41('0x45')](_0x42ae0c['body'],[_0xaa41('0x70'),'id'])||{});}return null;})['spread'](function(_0x5eac30){var _0x3e28b7;_0x1e41b5=_0x5eac30||[];var _0x1ac854=[];if(_0x5eac30){for(var _0x187bf9=0x0;_0x187bf9<_0x5eac30['length'];_0x187bf9+=0x1){var _0x50fa22=_0x5eac30[_0x187bf9][_0xaa41('0x18')]({'plain':!![]});_0x3e28b7=squel[_0xaa41('0x8f')]()[_0xaa41('0x90')](_0xaa41('0xae'))['fromQuery']([_0xaa41('0x93'),'ContactId',_0xaa41('0x96'),_0xaa41('0x50'),_0xaa41('0x46'),'updatedAt'],squel[_0xaa41('0x97')]()['field'](_0xaa41('0x93'),_0xaa41('0x93'))[_0xaa41('0x71')]('id',_0xaa41('0x95'))[_0xaa41('0x71')](_0x50fa22['CmListId'][_0xaa41('0x7a')](),'ListId')['field'](_0x42ae0c['params']['id'][_0xaa41('0x7a')](),'VoiceQueueId')[_0xaa41('0x71')]('NOW()','createdAt')[_0xaa41('0x71')](_0xaa41('0xaf'),_0xaa41('0x47'))[_0xaa41('0x73')](_0xaa41('0x99'))[_0xaa41('0x2a')](_0xaa41('0xa1'))[_0xaa41('0x2a')](_0xaa41('0x9a'),_0x50fa22['CmListId'][_0xaa41('0x7a')]())[_0xaa41('0x2a')](_0xaa41('0x9b')))['toString']();_0x1ac854[_0xaa41('0x79')](db[_0xaa41('0x63')][_0xaa41('0x32')](_0x3e28b7));}return BPromise['all'](_0x1ac854);}})[_0xaa41('0x17')](function(){return _0x1e41b5;})[_0xaa41('0x17')](respondWithResult(_0x4fa4ca,null))['catch'](handleError(_0x4fa4ca,null));};exports[_0xaa41('0xb0')]=function(_0x2edb93,_0x4e34c2){return db[_0xaa41('0x2c')][_0xaa41('0x20')]({'where':{'id':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](handleEntityNotFound(_0x4e34c2,null))[_0xaa41('0x17')](function(_0x17b359){if(_0x17b359){return _0x17b359['removeBlackLists'](_0x2edb93['query']['ids']);}})['then'](function(_0x5b820b){if(_0x5b820b){return db[_0xaa41('0x58')][_0xaa41('0x23')]({'where':{'ListId':_0x2edb93[_0xaa41('0x32')][_0xaa41('0x70')],'VoiceQueueId':_0x2edb93[_0xaa41('0x30')]['id']}})[_0xaa41('0x17')](function(){return _0x5b820b;});}})[_0xaa41('0x17')](respondWithStatusCode(_0x4e34c2,null))[_0xaa41('0x2f')](handleError(_0x4e34c2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index c13daf3..90a9624 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 _0x15f4=['../../mysqldb','VoiceQueue','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x46d616,_0x315082){var _0x4fd0ce=function(_0x2ff11e){while(--_0x2ff11e){_0x46d616['push'](_0x46d616['shift']());}};_0x4fd0ce(++_0x315082);}(_0x15f4,0x1b8));var _0x415f=function(_0x43f0ca,_0xfc9e5a){_0x43f0ca=_0x43f0ca-0x0;var _0x4d2b1d=_0x15f4[_0x43f0ca];return _0x4d2b1d;};'use strict';var EventEmitter=require(_0x415f('0x0'));var VoiceQueue=require(_0x415f('0x1'))['db'][_0x415f('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x415f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x415f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a3c44){return function(_0x258368,_0x474fe7,_0x3a61e4){VoiceQueueEvents[_0x415f('0x5')](_0x2a3c44+':'+_0x258368['id'],_0x258368);VoiceQueueEvents[_0x415f('0x5')](_0x2a3c44,_0x258368);_0x3a61e4(null);};}for(var e in events){if(events[_0x415f('0x6')](e)){var event=events[e];VoiceQueue[_0x415f('0x7')](e,emitEvent(event));}}module[_0x415f('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x6339=['hook','events','../../mysqldb','VoiceQueue','update','remove','emit','hasOwnProperty'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x6339,0xa1));var _0x9633=function(_0x22f235,_0x51e8fb){_0x22f235=_0x22f235-0x0;var _0x4d456b=_0x6339[_0x22f235];return _0x4d456b;};'use strict';var EventEmitter=require(_0x9633('0x0'));var VoiceQueue=require(_0x9633('0x1'))['db'][_0x9633('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9633('0x3'),'afterDestroy':_0x9633('0x4')};function emitEvent(_0x3cd32d){return function(_0x30bbeb,_0x4ee4,_0x4efe61){VoiceQueueEvents[_0x9633('0x5')](_0x3cd32d+':'+_0x30bbeb['id'],_0x30bbeb);VoiceQueueEvents[_0x9633('0x5')](_0x3cd32d,_0x30bbeb);_0x4efe61(null);};}for(var e in events){if(events[_0x9633('0x6')](e)){var event=events[e];VoiceQueue[_0x9633('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index f3b4399..3f68c26 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x39d9ec,_0x4ed6e5){var _0x499ff0=function(_0x565eaf){while(--_0x565eaf){_0x39d9ec['push'](_0x39d9ec['shift']());}};_0x499ff0(++_0x4ed6e5);}(_0x3e74,0x175));var _0x43e7=function(_0x37d005,_0x40414a){_0x37d005=_0x37d005-0x0;var _0x202b00=_0x3e74[_0x37d005];return _0x202b00;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x2ce5e3,_0x429426){var _0xe1e73c=function(_0x4a1c38){while(--_0x4a1c38){_0x2ce5e3['push'](_0x2ce5e3['shift']());}};_0xe1e73c(++_0x429426);}(_0x70e0,0x17b));var _0x070e=function(_0x6713a4,_0x54aca3){_0x6713a4=_0x6713a4-0x0;var _0x456c23=_0x70e0[_0x6713a4];return _0x456c23;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'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 de75efc..f0898c1 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 _0x6f17=['then','ShowVoiceQueue','VoiceQueue','find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','localhost','redis','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x6f17,0x7c));var _0x76f1=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x6f17[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x76f1('0x0'));var util=require(_0x76f1('0x1'));var moment=require(_0x76f1('0x2'));var BPromise=require('bluebird');var rs=require(_0x76f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x76f1('0x4'));var logger=require(_0x76f1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x76f1('0x6'));var client=jayson[_0x76f1('0x7')][_0x76f1('0x8')]({'port':0x232a});config['redis']=_[_0x76f1('0x9')](config['redis'],{'host':_0x76f1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x76f1('0xb')]));require(_0x76f1('0xc'))[_0x76f1('0xd')](socket);function respondWithRpcPromise(_0x260f58,_0x429d44,_0x36bf09){return new BPromise(function(_0x40a023,_0x3d0171){return client[_0x76f1('0xe')](_0x260f58,_0x36bf09)['then'](function(_0x47a88b){logger['info'](_0x76f1('0xf'),_0x429d44,'request\x20sent');logger[_0x76f1('0x10')](_0x76f1('0x11'),_0x429d44,_0x76f1('0x12'),JSON[_0x76f1('0x13')](_0x47a88b));if(_0x47a88b[_0x76f1('0x14')]){if(_0x47a88b[_0x76f1('0x14')][_0x76f1('0x15')]===0x1f4){logger[_0x76f1('0x14')](_0x76f1('0xf'),_0x429d44,_0x47a88b[_0x76f1('0x14')][_0x76f1('0x16')]);return _0x3d0171(_0x47a88b[_0x76f1('0x14')][_0x76f1('0x16')]);}logger['error'](_0x76f1('0xf'),_0x429d44,_0x47a88b[_0x76f1('0x14')][_0x76f1('0x16')]);return _0x40a023(_0x47a88b['error']['message']);}else{logger[_0x76f1('0x17')](_0x76f1('0xf'),_0x429d44,'request\x20sent');_0x40a023(_0x47a88b[_0x76f1('0x18')]['message']);}})[_0x76f1('0x19')](function(_0x2abbdb){logger[_0x76f1('0x14')](_0x76f1('0xf'),_0x429d44,_0x2abbdb);_0x3d0171(_0x2abbdb);});});}exports[_0x76f1('0x1a')]=function(_0x306757){var _0x1f20b0=this;return new Promise(function(_0x343fc8,_0x4d68e1){return db['VoiceQueue'][_0x76f1('0x1b')]({'raw':_0x306757[_0x76f1('0x1c')]?_0x306757[_0x76f1('0x1c')][_0x76f1('0x1d')]===undefined?!![]:![]:!![],'where':_0x306757[_0x76f1('0x1c')]?_0x306757['options'][_0x76f1('0x1e')]||null:null,'attributes':_0x306757[_0x76f1('0x1c')]?_0x306757[_0x76f1('0x1c')][_0x76f1('0x1f')]||null:null,'limit':_0x306757[_0x76f1('0x1c')]?_0x306757[_0x76f1('0x1c')][_0x76f1('0x20')]||null:null,'include':_0x306757[_0x76f1('0x1c')]?_0x306757[_0x76f1('0x1c')][_0x76f1('0x21')]?_[_0x76f1('0x22')](_0x306757['options'][_0x76f1('0x21')],function(_0x53feb9){return{'model':db[_0x53feb9[_0x76f1('0x23')]],'as':_0x53feb9['as'],'attributes':_0x53feb9[_0x76f1('0x1f')],'include':_0x53feb9[_0x76f1('0x21')]?_[_0x76f1('0x22')](_0x53feb9[_0x76f1('0x21')],function(_0x34da7f){return{'model':db[_0x34da7f[_0x76f1('0x23')]],'as':_0x34da7f['as'],'attributes':_0x34da7f['attributes'],'include':_0x34da7f[_0x76f1('0x21')]?_['map'](_0x34da7f[_0x76f1('0x21')],function(_0x2c9198){return{'model':db[_0x2c9198['model']],'as':_0x2c9198['as'],'attributes':_0x2c9198['attributes']};}):[]};}):[]};}):[]:[]})[_0x76f1('0x24')](function(_0x50eb4e){logger[_0x76f1('0x17')]('GetVoiceQueue',_0x306757);logger['debug']('GetVoiceQueue',_0x306757,JSON[_0x76f1('0x13')](_0x50eb4e));_0x343fc8(_0x50eb4e);})[_0x76f1('0x19')](function(_0x5eda8a){logger[_0x76f1('0x14')](_0x76f1('0x1a'),_0x5eda8a['message'],_0x306757);_0x4d68e1(_0x1f20b0[_0x76f1('0x14')](0x1f4,_0x5eda8a['message']));});});};exports[_0x76f1('0x25')]=function(_0x33d4ae){var _0x134ac9=this;return new Promise(function(_0x5887e9,_0x1f387a){return db[_0x76f1('0x26')][_0x76f1('0x27')]({'raw':_0x33d4ae[_0x76f1('0x1c')]?_0x33d4ae['options'][_0x76f1('0x1d')]===undefined?!![]:![]:!![],'where':_0x33d4ae[_0x76f1('0x1c')]?_0x33d4ae[_0x76f1('0x1c')]['where']||null:null,'attributes':_0x33d4ae[_0x76f1('0x1c')]?_0x33d4ae[_0x76f1('0x1c')]['attributes']||null:null,'include':_0x33d4ae[_0x76f1('0x1c')]?_0x33d4ae[_0x76f1('0x1c')][_0x76f1('0x21')]?_[_0x76f1('0x22')](_0x33d4ae['options'][_0x76f1('0x21')],function(_0x4cbb46){return{'model':db[_0x4cbb46[_0x76f1('0x23')]],'as':_0x4cbb46['as'],'attributes':_0x4cbb46['attributes'],'include':_0x4cbb46[_0x76f1('0x21')]?_['map'](_0x4cbb46['include'],function(_0x1a610f){return{'model':db[_0x1a610f['model']],'as':_0x1a610f['as'],'attributes':_0x1a610f['attributes'],'include':_0x1a610f[_0x76f1('0x21')]?_['map'](_0x1a610f[_0x76f1('0x21')],function(_0x45969e){return{'model':db[_0x45969e['model']],'as':_0x45969e['as'],'attributes':_0x45969e[_0x76f1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x76f1('0x24')](function(_0x3ed309){logger[_0x76f1('0x17')]('ShowVoiceQueue',_0x33d4ae);logger['debug'](_0x76f1('0x25'),_0x33d4ae,JSON[_0x76f1('0x13')](_0x3ed309));_0x5887e9(_0x3ed309);})[_0x76f1('0x19')](function(_0x1fd532){logger[_0x76f1('0x14')]('ShowVoiceQueue',_0x1fd532[_0x76f1('0x16')],_0x33d4ae);_0x1f387a(_0x134ac9[_0x76f1('0x14')](0x1f4,_0x1fd532['message']));});});}; \ No newline at end of file +var _0xf844=['limit','map','include','model','ShowVoiceQueue','find','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','GetVoiceQueue','VoiceQueue','options','raw','where','attributes'];(function(_0x57372a,_0x177ba7){var _0x54c7a2=function(_0x177609){while(--_0x177609){_0x57372a['push'](_0x57372a['shift']());}};_0x54c7a2(++_0x177ba7);}(_0xf844,0x79));var _0x4f84=function(_0xe326ae,_0x49dd64){_0xe326ae=_0xe326ae-0x0;var _0x2bde3c=_0xf844[_0xe326ae];return _0x2bde3c;};'use strict';var _=require(_0x4f84('0x0'));var util=require(_0x4f84('0x1'));var moment=require(_0x4f84('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f84('0x3'));var db=require(_0x4f84('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f84('0x5'))('rpc');var config=require(_0x4f84('0x6'));var jayson=require(_0x4f84('0x7'));var client=jayson[_0x4f84('0x8')][_0x4f84('0x9')]({'port':0x232a});config['redis']=_[_0x4f84('0xa')](config['redis'],{'host':_0x4f84('0xb'),'port':0x18eb});var socket=require(_0x4f84('0xc'))(new Redis(config['redis']));require(_0x4f84('0xd'))[_0x4f84('0xe')](socket);function respondWithRpcPromise(_0x3b0dd2,_0x1ab862,_0x2471f8){return new BPromise(function(_0x2f1c34,_0x22a82d){return client['request'](_0x3b0dd2,_0x2471f8)[_0x4f84('0xf')](function(_0x3aa569){logger[_0x4f84('0x10')](_0x4f84('0x11'),_0x1ab862,_0x4f84('0x12'));logger[_0x4f84('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1ab862,'request\x20sent',JSON[_0x4f84('0x14')](_0x3aa569));if(_0x3aa569['error']){if(_0x3aa569['error'][_0x4f84('0x15')]===0x1f4){logger[_0x4f84('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x1ab862,_0x3aa569[_0x4f84('0x16')][_0x4f84('0x17')]);return _0x22a82d(_0x3aa569[_0x4f84('0x16')][_0x4f84('0x17')]);}logger[_0x4f84('0x16')](_0x4f84('0x11'),_0x1ab862,_0x3aa569[_0x4f84('0x16')][_0x4f84('0x17')]);return _0x2f1c34(_0x3aa569[_0x4f84('0x16')][_0x4f84('0x17')]);}else{logger[_0x4f84('0x10')](_0x4f84('0x11'),_0x1ab862,'request\x20sent');_0x2f1c34(_0x3aa569[_0x4f84('0x18')]['message']);}})['catch'](function(_0x1945a2){logger[_0x4f84('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x1ab862,_0x1945a2);_0x22a82d(_0x1945a2);});});}exports[_0x4f84('0x19')]=function(_0x5b62cd){var _0x362217=this;return new Promise(function(_0x13363d,_0x252c06){return db[_0x4f84('0x1a')]['findAll']({'raw':_0x5b62cd[_0x4f84('0x1b')]?_0x5b62cd[_0x4f84('0x1b')][_0x4f84('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b62cd[_0x4f84('0x1b')]?_0x5b62cd[_0x4f84('0x1b')][_0x4f84('0x1d')]||null:null,'attributes':_0x5b62cd[_0x4f84('0x1b')]?_0x5b62cd['options'][_0x4f84('0x1e')]||null:null,'limit':_0x5b62cd[_0x4f84('0x1b')]?_0x5b62cd[_0x4f84('0x1b')][_0x4f84('0x1f')]||null:null,'include':_0x5b62cd[_0x4f84('0x1b')]?_0x5b62cd[_0x4f84('0x1b')]['include']?_[_0x4f84('0x20')](_0x5b62cd[_0x4f84('0x1b')][_0x4f84('0x21')],function(_0x409149){return{'model':db[_0x409149[_0x4f84('0x22')]],'as':_0x409149['as'],'attributes':_0x409149[_0x4f84('0x1e')],'include':_0x409149['include']?_['map'](_0x409149[_0x4f84('0x21')],function(_0x4b76c3){return{'model':db[_0x4b76c3['model']],'as':_0x4b76c3['as'],'attributes':_0x4b76c3[_0x4f84('0x1e')],'include':_0x4b76c3['include']?_[_0x4f84('0x20')](_0x4b76c3[_0x4f84('0x21')],function(_0x2218ca){return{'model':db[_0x2218ca['model']],'as':_0x2218ca['as'],'attributes':_0x2218ca[_0x4f84('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f84('0xf')](function(_0x5b2a35){logger[_0x4f84('0x10')]('GetVoiceQueue',_0x5b62cd);logger[_0x4f84('0x13')](_0x4f84('0x19'),_0x5b62cd,JSON[_0x4f84('0x14')](_0x5b2a35));_0x13363d(_0x5b2a35);})['catch'](function(_0xaf8597){logger[_0x4f84('0x16')]('GetVoiceQueue',_0xaf8597[_0x4f84('0x17')],_0x5b62cd);_0x252c06(_0x362217[_0x4f84('0x16')](0x1f4,_0xaf8597[_0x4f84('0x17')]));});});};exports[_0x4f84('0x23')]=function(_0x2001f4){var _0x2e55a8=this;return new Promise(function(_0x57a7a9,_0x198641){return db[_0x4f84('0x1a')][_0x4f84('0x24')]({'raw':_0x2001f4['options']?_0x2001f4['options'][_0x4f84('0x1c')]===undefined?!![]:![]:!![],'where':_0x2001f4[_0x4f84('0x1b')]?_0x2001f4[_0x4f84('0x1b')]['where']||null:null,'attributes':_0x2001f4['options']?_0x2001f4[_0x4f84('0x1b')][_0x4f84('0x1e')]||null:null,'include':_0x2001f4[_0x4f84('0x1b')]?_0x2001f4[_0x4f84('0x1b')]['include']?_[_0x4f84('0x20')](_0x2001f4['options']['include'],function(_0x13093e){return{'model':db[_0x13093e[_0x4f84('0x22')]],'as':_0x13093e['as'],'attributes':_0x13093e[_0x4f84('0x1e')],'include':_0x13093e['include']?_['map'](_0x13093e[_0x4f84('0x21')],function(_0x1ccbc7){return{'model':db[_0x1ccbc7[_0x4f84('0x22')]],'as':_0x1ccbc7['as'],'attributes':_0x1ccbc7[_0x4f84('0x1e')],'include':_0x1ccbc7[_0x4f84('0x21')]?_['map'](_0x1ccbc7[_0x4f84('0x21')],function(_0x3891de){return{'model':db[_0x3891de[_0x4f84('0x22')]],'as':_0x3891de['as'],'attributes':_0x3891de[_0x4f84('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f84('0xf')](function(_0x2b112d){logger[_0x4f84('0x10')](_0x4f84('0x23'),_0x2001f4);logger[_0x4f84('0x13')](_0x4f84('0x23'),_0x2001f4,JSON[_0x4f84('0x14')](_0x2b112d));_0x57a7a9(_0x2b112d);})[_0x4f84('0x25')](function(_0x45460f){logger[_0x4f84('0x16')](_0x4f84('0x23'),_0x45460f['message'],_0x2001f4);_0x198641(_0x2e55a8[_0x4f84('0x16')](0x1f4,_0x45460f[_0x4f84('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6bed592..763f8e4 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 _0xceac=['emit','removeListener','length','./voiceQueue.events','save','update'];(function(_0x33de83,_0x4a2401){var _0x2c18dd=function(_0x15dff5){while(--_0x15dff5){_0x33de83['push'](_0x33de83['shift']());}};_0x2c18dd(++_0x4a2401);}(_0xceac,0x153));var _0xccea=function(_0x4d9798,_0x4f0807){_0x4d9798=_0x4d9798-0x0;var _0x48975f=_0xceac[_0x4d9798];return _0x48975f;};'use strict';var VoiceQueueEvents=require(_0xccea('0x0'));var events=[_0xccea('0x1'),'remove',_0xccea('0x2')];function createListener(_0x5f2892,_0x11d92d){return function(_0x10a035){_0x11d92d[_0xccea('0x3')](_0x5f2892,_0x10a035);};}function removeListener(_0x1a6108,_0x3220f1){return function(){VoiceQueueEvents[_0xccea('0x4')](_0x1a6108,_0x3220f1);};}exports['register']=function(_0x464fee){for(var _0x49ffd7=0x0,_0x22c9a6=events[_0xccea('0x5')];_0x49ffd7<_0x22c9a6;_0x49ffd7++){var _0x1c2abd=events[_0x49ffd7];var _0x5d6497=createListener('voiceQueue:'+_0x1c2abd,_0x464fee);VoiceQueueEvents['on'](_0x1c2abd,_0x5d6497);}}; \ No newline at end of file +var _0x1c5c=['./voiceQueue.events','remove','emit','removeListener','register','length'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1c5c,0x8a));var _0xc1c5=function(_0x9b6096,_0xb69645){_0x9b6096=_0x9b6096-0x0;var _0xce8ca7=_0x1c5c[_0x9b6096];return _0xce8ca7;};'use strict';var VoiceQueueEvents=require(_0xc1c5('0x0'));var events=['save',_0xc1c5('0x1'),'update'];function createListener(_0x153656,_0x5b03cd){return function(_0x1d0894){_0x5b03cd[_0xc1c5('0x2')](_0x153656,_0x1d0894);};}function removeListener(_0xcbc3e,_0x4ffa99){return function(){VoiceQueueEvents[_0xc1c5('0x3')](_0xcbc3e,_0x4ffa99);};}exports[_0xc1c5('0x4')]=function(_0x3a19f7){for(var _0x449df5=0x0,_0x2dafb2=events[_0xc1c5('0x5')];_0x449df5<_0x2dafb2;_0x449df5++){var _0x40d2d2=events[_0x449df5];var _0x417267=createListener('voiceQueue:'+_0x40d2d2,_0x3a19f7);VoiceQueueEvents['on'](_0x40d2d2,_0x417267);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 5027eea..fe0dcda 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 _0x98d9=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','/describe','get','/index','/:id','show','post','create','put','update','exports','multer'];(function(_0x30dbe1,_0xccce9f){var _0x571790=function(_0x2b8f6c){while(--_0x2b8f6c){_0x30dbe1['push'](_0x30dbe1['shift']());}};_0x571790(++_0xccce9f);}(_0x98d9,0x7d));var _0x998d=function(_0x507fe4,_0x5c02e0){_0x507fe4=_0x507fe4-0x0;var _0x395703=_0x98d9[_0x507fe4];return _0x395703;};'use strict';var multer=require(_0x998d('0x0'));var util=require(_0x998d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x998d('0x2'));var router=express[_0x998d('0x3')]();var fs_extra=require(_0x998d('0x4'));var auth=require(_0x998d('0x5'));var interaction=require(_0x998d('0x6'));var config=require(_0x998d('0x7'));var controller=require(_0x998d('0x8'));router['get']('/',auth[_0x998d('0x9')](),controller[_0x998d('0xa')]);router['get'](_0x998d('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x998d('0xc')](_0x998d('0xd'),auth[_0x998d('0x9')](),controller['getVoiceQueuesReport']);router[_0x998d('0xc')](_0x998d('0xe'),auth[_0x998d('0x9')](),controller[_0x998d('0xf')]);router[_0x998d('0x10')]('/',auth[_0x998d('0x9')](),controller[_0x998d('0x11')]);router[_0x998d('0x12')](_0x998d('0xe'),auth[_0x998d('0x9')](),controller[_0x998d('0x13')]);router['delete'](_0x998d('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x998d('0x14')]=router; \ No newline at end of file +var _0x0d2b=['create','put','update','delete','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','/index','/:id','show','post'];(function(_0x5764d9,_0x2bb4c6){var _0x1edfcf=function(_0x28f679){while(--_0x28f679){_0x5764d9['push'](_0x5764d9['shift']());}};_0x1edfcf(++_0x2bb4c6);}(_0x0d2b,0x155));var _0xb0d2=function(_0x2ecd37,_0x45dd91){_0x2ecd37=_0x2ecd37-0x0;var _0x3557b7=_0x0d2b[_0x2ecd37];return _0x3557b7;};'use strict';var multer=require(_0xb0d2('0x0'));var util=require('util');var path=require(_0xb0d2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb0d2('0x2')]();var fs_extra=require(_0xb0d2('0x3'));var auth=require(_0xb0d2('0x4'));var interaction=require(_0xb0d2('0x5'));var config=require(_0xb0d2('0x6'));var controller=require(_0xb0d2('0x7'));router[_0xb0d2('0x8')]('/',auth['isAuthenticated'](),controller[_0xb0d2('0x9')]);router[_0xb0d2('0x8')](_0xb0d2('0xa'),auth[_0xb0d2('0xb')](),controller['describe']);router[_0xb0d2('0x8')](_0xb0d2('0xc'),auth[_0xb0d2('0xb')](),controller['getVoiceQueuesReport']);router['get'](_0xb0d2('0xd'),auth['isAuthenticated'](),controller[_0xb0d2('0xe')]);router[_0xb0d2('0xf')]('/',auth[_0xb0d2('0xb')](),controller[_0xb0d2('0x10')]);router[_0xb0d2('0x11')](_0xb0d2('0xd'),auth[_0xb0d2('0xb')](),controller[_0xb0d2('0x12')]);router[_0xb0d2('0x13')](_0xb0d2('0xd'),auth[_0xb0d2('0xb')](),controller['destroy']);module[_0xb0d2('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index f7c8982..af04f71 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 _0x0d75=['moment','exports','STRING','DATE','format','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x21b47b,_0x1c6661){var _0x14f183=function(_0x2a03fe){while(--_0x2a03fe){_0x21b47b['push'](_0x21b47b['shift']());}};_0x14f183(++_0x1c6661);}(_0x0d75,0xd1));var _0x50d7=function(_0xbf4f64,_0x19442c){_0xbf4f64=_0xbf4f64-0x0;var _0x2db797=_0x0d75[_0xbf4f64];return _0x2db797;};'use strict';var Sequelize=require(_0x50d7('0x0'));var moment=require(_0x50d7('0x1'));module[_0x50d7('0x2')]={'type':{'type':Sequelize[_0x50d7('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x50d7('0x3')]},'calleridname':{'type':Sequelize[_0x50d7('0x3')]},'queue':{'type':Sequelize[_0x50d7('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x50d7('0x4')],'set':function(_0x33564d){var _0x5a92dc=moment(_0x33564d);var _0x2d7379=moment(this['getDataValue']('queuecallerjoinAt'))[_0x50d7('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x9d1065=_0x5a92dc['diff'](_0x2d7379,_0x50d7('0x6'));this['setDataValue'](_0x50d7('0x7'),_0x33564d);this[_0x50d7('0x8')](_0x50d7('0x9'),_0x9d1065||null);}},'position':{'type':Sequelize[_0x50d7('0xa')]},'count':{'type':Sequelize[_0x50d7('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x50d7('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x50d7('0x4')]},'queuecallerexit':{'type':Sequelize[_0x50d7('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x50d7('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x50d7('0x3')],'comment':_0x50d7('0xc')},'originalposition':{'type':Sequelize[_0x50d7('0xa')]},'channel':{'type':Sequelize[_0x50d7('0x3')]},'connectedlinenum':{'type':Sequelize[_0x50d7('0x3')]},'connectedlinename':{'type':Sequelize[_0x50d7('0x3')]},'accountcode':{'type':Sequelize[_0x50d7('0x3')]},'context':{'type':Sequelize[_0x50d7('0x3')]},'exten':{'type':Sequelize[_0x50d7('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x50d7('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x50d7('0x3')]},'transfer':{'type':Sequelize[_0x50d7('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x50d7('0x3')],'comment':_0x50d7('0xd')},'transferexten':{'type':Sequelize[_0x50d7('0x3')]},'transferuniqueid':{'type':Sequelize[_0x50d7('0x3')]},'disposition':{'type':Sequelize[_0x50d7('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x50d7('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x50d7('0x3')]}}; \ No newline at end of file +var _0x5591=['queuecallerjoinAt','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x5591,0x1dc));var _0x1559=function(_0x378830,_0xb532d7){_0x378830=_0x378830-0x0;var _0x4e4348=_0x5591[_0x378830];return _0x4e4348;};'use strict';var Sequelize=require(_0x1559('0x0'));var moment=require(_0x1559('0x1'));module[_0x1559('0x2')]={'type':{'type':Sequelize[_0x1559('0x3')]},'uniqueid':{'type':Sequelize[_0x1559('0x3')]},'calleridnum':{'type':Sequelize[_0x1559('0x3')]},'calleridname':{'type':Sequelize[_0x1559('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x1559('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x1559('0x4')],'set':function(_0x4b2cbd){var _0x40b350=moment(_0x4b2cbd);var _0x405726=moment(this['getDataValue'](_0x1559('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x5e74ec=_0x40b350['diff'](_0x405726,'seconds');this[_0x1559('0x6')](_0x1559('0x7'),_0x4b2cbd);this[_0x1559('0x6')](_0x1559('0x8'),_0x5e74ec||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x1559('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1559('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1559('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1559('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x1559('0x3')],'comment':_0x1559('0xa')},'originalposition':{'type':Sequelize[_0x1559('0xb')]},'channel':{'type':Sequelize[_0x1559('0x3')]},'connectedlinenum':{'type':Sequelize[_0x1559('0x3')]},'connectedlinename':{'type':Sequelize[_0x1559('0x3')]},'accountcode':{'type':Sequelize[_0x1559('0x3')]},'context':{'type':Sequelize[_0x1559('0x3')]},'exten':{'type':Sequelize[_0x1559('0x3')]},'priority':{'type':Sequelize[_0x1559('0x3')]},'holdtime':{'type':Sequelize[_0x1559('0xb')]},'mohtime':{'type':Sequelize[_0x1559('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1559('0x3')]},'transfer':{'type':Sequelize[_0x1559('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x1559('0xc')},'transferexten':{'type':Sequelize[_0x1559('0x3')]},'transferuniqueid':{'type':Sequelize[_0x1559('0x3')]},'disposition':{'type':Sequelize[_0x1559('0x3')]},'secondDisposition':{'type':Sequelize[_0x1559('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1559('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x1559('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x1559('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 819d6d6..a8f459d 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 _0xbcc2=['end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','VoiceQueueReport','rows','catch','show','params','fields','options','find','create','body','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./voiceQueueReport.socket'];(function(_0xe0246a,_0x1831c6){var _0x438e91=function(_0x5f2486){while(--_0x5f2486){_0xe0246a['push'](_0xe0246a['shift']());}};_0x438e91(++_0x1831c6);}(_0xbcc2,0x17d));var _0x2bcc=function(_0x6c48d2,_0x26164e){_0x6c48d2=_0x6c48d2-0x0;var _0x577eef=_0xbcc2[_0x6c48d2];return _0x577eef;};'use strict';var emlformat=require(_0x2bcc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2bcc('0x1'));var jsonpatch=require(_0x2bcc('0x2'));var rp=require(_0x2bcc('0x3'));var moment=require(_0x2bcc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2bcc('0x5'));var util=require('util');var path=require(_0x2bcc('0x6'));var sox=require(_0x2bcc('0x7'));var csv=require(_0x2bcc('0x8'));var ejs=require(_0x2bcc('0x9'));var fs=require('fs');var fs_extra=require(_0x2bcc('0xa'));var _=require(_0x2bcc('0xb'));var squel=require(_0x2bcc('0xc'));var crypto=require(_0x2bcc('0xd'));var jsforce=require(_0x2bcc('0xe'));var deskjs=require(_0x2bcc('0xf'));var toCsv=require(_0x2bcc('0x8'));var querystring=require(_0x2bcc('0x10'));var Papa=require(_0x2bcc('0x11'));var Redis=require('ioredis');var authService=require(_0x2bcc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2bcc('0x13'));var hardwareService=require(_0x2bcc('0x14'));var logger=require(_0x2bcc('0x15'))('api');var utils=require(_0x2bcc('0x16'));var config=require(_0x2bcc('0x17'));var licenseUtil=require(_0x2bcc('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2bcc('0x19')](config[_0x2bcc('0x1a')],{'host':_0x2bcc('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2bcc('0x1a')]));require(_0x2bcc('0x1c'))['register'](socket);function respondWithStatusCode(_0x5150eb,_0x1532ce){_0x1532ce=_0x1532ce||0xcc;return function(_0x12dc9f){if(_0x12dc9f){return _0x5150eb['sendStatus'](_0x1532ce);}return _0x5150eb['status'](_0x1532ce)[_0x2bcc('0x1d')]();};}function respondWithResult(_0x1913ae,_0x312d78){_0x312d78=_0x312d78||0xc8;return function(_0x1af9b9){if(_0x1af9b9){return _0x1913ae[_0x2bcc('0x1e')](_0x312d78)['json'](_0x1af9b9);}};}function respondWithFilteredResult(_0x38b43d,_0x4a1a41){return function(_0x41705b){if(_0x41705b){var _0x2406eb=typeof _0x4a1a41[_0x2bcc('0x1f')]===_0x2bcc('0x20')&&typeof _0x4a1a41['limit']===_0x2bcc('0x20');var _0x899083=_0x41705b[_0x2bcc('0x21')];var _0x5c6596=_0x2406eb?0x0:_0x4a1a41['offset'];var _0x137cbb=_0x2406eb?_0x41705b[_0x2bcc('0x21')]:_0x4a1a41[_0x2bcc('0x1f')]+_0x4a1a41['limit'];var _0x43f86e;if(_0x137cbb>=_0x899083){_0x137cbb=_0x899083;_0x43f86e=0xc8;}else{_0x43f86e=0xce;}_0x38b43d[_0x2bcc('0x1e')](_0x43f86e);return _0x38b43d[_0x2bcc('0x22')](_0x2bcc('0x23'),_0x5c6596+'-'+_0x137cbb+'/'+_0x899083)[_0x2bcc('0x24')](_0x41705b);}return null;};}function patchUpdates(_0x4458b8){return function(_0x32890f){try{jsonpatch[_0x2bcc('0x25')](_0x32890f,_0x4458b8,!![]);}catch(_0x4f1508){return BPromise[_0x2bcc('0x26')](_0x4f1508);}return _0x32890f[_0x2bcc('0x27')]();};}function saveUpdates(_0x5c70fe,_0x2a4d48){return function(_0x45260e){if(_0x45260e){return _0x45260e[_0x2bcc('0x28')](_0x5c70fe)[_0x2bcc('0x29')](function(_0x29ca82){return _0x29ca82;});}return null;};}function removeEntity(_0x39557c,_0x138186){return function(_0x1e5215){if(_0x1e5215){return _0x1e5215[_0x2bcc('0x2a')]()[_0x2bcc('0x29')](function(){_0x39557c[_0x2bcc('0x1e')](0xcc)[_0x2bcc('0x1d')]();});}};}function handleEntityNotFound(_0x56ead7,_0xea83b8){return function(_0x5e60e4){if(!_0x5e60e4){_0x56ead7['sendStatus'](0x194);}return _0x5e60e4;};}function handleError(_0x3a4bef,_0x25058a){_0x25058a=_0x25058a||0x1f4;return function(_0x4262ec){logger[_0x2bcc('0x2b')](_0x4262ec[_0x2bcc('0x2c')]);if(_0x4262ec[_0x2bcc('0x2d')]){delete _0x4262ec[_0x2bcc('0x2d')];}_0x3a4bef['status'](_0x25058a)[_0x2bcc('0x2e')](_0x4262ec);};}exports['index']=function(_0x439b75,_0x558b3b){var _0x260020={},_0x308c0c={},_0x472c5e={'count':0x0,'rows':[]};var _0x37e2d9=_['map'](db['VoiceQueueReport'][_0x2bcc('0x2f')],function(_0x3a4904){return{'name':_0x3a4904[_0x2bcc('0x30')],'type':_0x3a4904[_0x2bcc('0x31')][_0x2bcc('0x32')]};});_0x308c0c[_0x2bcc('0x33')]=_[_0x2bcc('0x34')](_0x37e2d9,_0x2bcc('0x2d'));_0x308c0c[_0x2bcc('0x35')]=_[_0x2bcc('0x36')](_0x439b75[_0x2bcc('0x35')]);_0x308c0c[_0x2bcc('0x37')]=_[_0x2bcc('0x38')](_0x308c0c[_0x2bcc('0x33')],_0x308c0c[_0x2bcc('0x35')]);_0x260020[_0x2bcc('0x39')]=_['intersection'](_0x308c0c[_0x2bcc('0x33')],qs['fields'](_0x439b75[_0x2bcc('0x35')]['fields']));_0x260020[_0x2bcc('0x39')]=_0x260020[_0x2bcc('0x39')][_0x2bcc('0x3a')]?_0x260020[_0x2bcc('0x39')]:_0x308c0c[_0x2bcc('0x33')];if(!_0x439b75[_0x2bcc('0x35')][_0x2bcc('0x3b')](_0x2bcc('0x3c'))){_0x260020['limit']=qs['limit'](_0x439b75['query'][_0x2bcc('0x3d')]);_0x260020[_0x2bcc('0x1f')]=qs[_0x2bcc('0x1f')](_0x439b75[_0x2bcc('0x35')][_0x2bcc('0x1f')]);}_0x260020[_0x2bcc('0x3e')]=qs['sort'](_0x439b75['query'][_0x2bcc('0x3f')]);_0x260020[_0x2bcc('0x40')]=qs[_0x2bcc('0x37')](_[_0x2bcc('0x41')](_0x439b75[_0x2bcc('0x35')],_0x308c0c[_0x2bcc('0x37')]),_0x37e2d9);if(_0x439b75[_0x2bcc('0x35')][_0x2bcc('0x42')]){_0x260020[_0x2bcc('0x40')]=_['merge'](_0x260020['where'],{'$or':_['map'](_0x37e2d9,function(_0x482977){if(_0x482977['type']!==_0x2bcc('0x43')){var _0x2f0bbb={};_0x2f0bbb[_0x482977[_0x2bcc('0x2d')]]={'$like':'%'+_0x439b75[_0x2bcc('0x35')]['filter']+'%'};return _0x2f0bbb;}})});}_0x260020=_[_0x2bcc('0x44')]({},_0x260020,_0x439b75['options']);var _0x326fb7={'where':_0x260020[_0x2bcc('0x40')]};return db['VoiceQueueReport']['count'](_0x326fb7)[_0x2bcc('0x29')](function(_0x5770de){_0x472c5e[_0x2bcc('0x21')]=_0x5770de;if(_0x439b75[_0x2bcc('0x35')][_0x2bcc('0x45')]){_0x260020[_0x2bcc('0x46')]=[{'all':!![]}];}return db[_0x2bcc('0x47')]['findAll'](_0x260020);})['then'](function(_0x778933){_0x472c5e[_0x2bcc('0x48')]=_0x778933;return _0x472c5e;})[_0x2bcc('0x29')](respondWithFilteredResult(_0x558b3b,_0x260020))[_0x2bcc('0x49')](handleError(_0x558b3b,null));};exports[_0x2bcc('0x4a')]=function(_0x3db7bc,_0x4d77ef){var _0x275153={'raw':![],'where':{'id':_0x3db7bc[_0x2bcc('0x4b')]['id']}},_0x291401={};_0x291401['model']=_[_0x2bcc('0x36')](db['VoiceQueueReport'][_0x2bcc('0x2f')]);_0x291401[_0x2bcc('0x35')]=_[_0x2bcc('0x36')](_0x3db7bc[_0x2bcc('0x35')]);_0x291401['filters']=_[_0x2bcc('0x38')](_0x291401[_0x2bcc('0x33')],_0x291401[_0x2bcc('0x35')]);_0x275153[_0x2bcc('0x39')]=_[_0x2bcc('0x38')](_0x291401[_0x2bcc('0x33')],qs[_0x2bcc('0x4c')](_0x3db7bc[_0x2bcc('0x35')]['fields']));_0x275153[_0x2bcc('0x39')]=_0x275153[_0x2bcc('0x39')][_0x2bcc('0x3a')]?_0x275153[_0x2bcc('0x39')]:_0x291401[_0x2bcc('0x33')];if(_0x3db7bc[_0x2bcc('0x35')][_0x2bcc('0x45')]){_0x275153[_0x2bcc('0x46')]=[{'all':!![]}];}_0x275153=_[_0x2bcc('0x44')]({},_0x275153,_0x3db7bc[_0x2bcc('0x4d')]);return db[_0x2bcc('0x47')][_0x2bcc('0x4e')](_0x275153)[_0x2bcc('0x29')](handleEntityNotFound(_0x4d77ef,null))[_0x2bcc('0x29')](respondWithResult(_0x4d77ef,null))[_0x2bcc('0x49')](handleError(_0x4d77ef,null));};exports[_0x2bcc('0x4f')]=function(_0x1eace0,_0x4a0acb){return db[_0x2bcc('0x47')][_0x2bcc('0x4f')](_0x1eace0[_0x2bcc('0x50')],{})[_0x2bcc('0x29')](respondWithResult(_0x4a0acb,0xc9))[_0x2bcc('0x49')](handleError(_0x4a0acb,null));};exports[_0x2bcc('0x28')]=function(_0x23306b,_0x179a2a){if(_0x23306b[_0x2bcc('0x50')]['id']){delete _0x23306b[_0x2bcc('0x50')]['id'];}return db[_0x2bcc('0x47')][_0x2bcc('0x4e')]({'where':{'id':_0x23306b[_0x2bcc('0x4b')]['id']}})[_0x2bcc('0x29')](handleEntityNotFound(_0x179a2a,null))[_0x2bcc('0x29')](saveUpdates(_0x23306b[_0x2bcc('0x50')],null))[_0x2bcc('0x29')](respondWithResult(_0x179a2a,null))[_0x2bcc('0x49')](handleError(_0x179a2a,null));};exports[_0x2bcc('0x2a')]=function(_0x2bfa4d,_0x575ea0){return db['VoiceQueueReport'][_0x2bcc('0x4e')]({'where':{'id':_0x2bfa4d[_0x2bcc('0x4b')]['id']}})[_0x2bcc('0x29')](handleEntityNotFound(_0x575ea0,null))[_0x2bcc('0x29')](removeEntity(_0x575ea0,null))[_0x2bcc('0x49')](handleError(_0x575ea0,null));};exports['describe']=function(_0x3e1b7e,_0x5b77d4){return db[_0x2bcc('0x47')]['describe']()[_0x2bcc('0x29')](respondWithResult(_0x5b77d4,null))[_0x2bcc('0x49')](handleError(_0x5b77d4,null));};exports['getVoiceQueuesReport']=function(_0x251639,_0x31317b){var _0x47dcca={},_0xd097bc={},_0x12409c={'count':0x0,'rows':[]};_0xd097bc[_0x2bcc('0x33')]=_[_0x2bcc('0x36')](db[_0x2bcc('0x47')][_0x2bcc('0x2f')]);_0xd097bc['query']=_['keys'](_0x251639['query']);_0xd097bc[_0x2bcc('0x37')]=_[_0x2bcc('0x38')](_0xd097bc['model'],_0xd097bc[_0x2bcc('0x35')]);_0x47dcca['attributes']=_['intersection'](_0xd097bc[_0x2bcc('0x33')],qs[_0x2bcc('0x4c')](_0x251639[_0x2bcc('0x35')][_0x2bcc('0x4c')]));_0x47dcca[_0x2bcc('0x39')]=_0x47dcca[_0x2bcc('0x39')]['length']?_0x47dcca[_0x2bcc('0x39')]:_0xd097bc[_0x2bcc('0x33')];if(!_0x251639[_0x2bcc('0x35')][_0x2bcc('0x3b')](_0x2bcc('0x3c'))){_0x47dcca[_0x2bcc('0x3d')]=qs[_0x2bcc('0x3d')](_0x251639['query'][_0x2bcc('0x3d')]);_0x47dcca[_0x2bcc('0x1f')]=qs['offset'](_0x251639[_0x2bcc('0x35')][_0x2bcc('0x1f')]);}_0x47dcca[_0x2bcc('0x3e')]=qs[_0x2bcc('0x3f')](_0x251639[_0x2bcc('0x35')][_0x2bcc('0x3f')]);_0x47dcca['where']=qs['filters'](_[_0x2bcc('0x41')](_0x251639[_0x2bcc('0x35')],_0xd097bc[_0x2bcc('0x37')]));if(_0x251639[_0x2bcc('0x35')]['filter']){_0x47dcca[_0x2bcc('0x40')]=_[_0x2bcc('0x44')](_0x47dcca[_0x2bcc('0x40')],{'$or':_[_0x2bcc('0x34')](_0x47dcca[_0x2bcc('0x39')],function(_0x517de0){var _0x5c3b23={};_0x5c3b23[_0x517de0]={'$like':'%'+_0x251639[_0x2bcc('0x35')][_0x2bcc('0x42')]+'%'};return _0x5c3b23;})});}_0x47dcca=_[_0x2bcc('0x44')]({},_0x47dcca,_0x251639[_0x2bcc('0x4d')]);var _0x26a7c3={'where':_0x47dcca[_0x2bcc('0x40')]};return db[_0x2bcc('0x47')][_0x2bcc('0x21')](_0x26a7c3)[_0x2bcc('0x29')](function(_0x2fb1fb){_0x12409c[_0x2bcc('0x21')]=_0x2fb1fb;if(_0x251639[_0x2bcc('0x35')]['includeAll']){_0x47dcca['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x47dcca);})[_0x2bcc('0x29')](function(_0x31d7c9){_0x12409c[_0x2bcc('0x48')]=_0x31d7c9;return _0x12409c;})['then'](respondWithFilteredResult(_0x31317b,_0x47dcca,_0x2bcc('0x51')))[_0x2bcc('0x49')](handleError(_0x31317b,null,_0x2bcc('0x51')));}; \ No newline at end of file +var _0x6a04=['type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','VoiceQueueReport','findAll','rows','catch','show','rawAttributes','create','body','update','find','params','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','save','then','destroy','error','stack','name','send','map','fieldName'];(function(_0x2046d4,_0x294ed9){var _0x4ca7eb=function(_0x4cb79d){while(--_0x4cb79d){_0x2046d4['push'](_0x2046d4['shift']());}};_0x4ca7eb(++_0x294ed9);}(_0x6a04,0x115));var _0x46a0=function(_0x511111,_0x4c7792){_0x511111=_0x511111-0x0;var _0x1386f2=_0x6a04[_0x511111];return _0x1386f2;};'use strict';var emlformat=require(_0x46a0('0x0'));var rimraf=require(_0x46a0('0x1'));var zipdir=require(_0x46a0('0x2'));var jsonpatch=require(_0x46a0('0x3'));var rp=require(_0x46a0('0x4'));var moment=require(_0x46a0('0x5'));var BPromise=require(_0x46a0('0x6'));var Mustache=require(_0x46a0('0x7'));var util=require('util');var path=require(_0x46a0('0x8'));var sox=require(_0x46a0('0x9'));var csv=require(_0x46a0('0xa'));var ejs=require(_0x46a0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46a0('0xc'));var squel=require(_0x46a0('0xd'));var crypto=require(_0x46a0('0xe'));var jsforce=require(_0x46a0('0xf'));var deskjs=require(_0x46a0('0x10'));var toCsv=require(_0x46a0('0xa'));var querystring=require(_0x46a0('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x46a0('0x12'));var qs=require(_0x46a0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x46a0('0x14'))(_0x46a0('0x15'));var utils=require(_0x46a0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x46a0('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x46a0('0x18')](config['redis'],{'host':_0x46a0('0x19'),'port':0x18eb});var socket=require(_0x46a0('0x1a'))(new Redis(config[_0x46a0('0x1b')]));require(_0x46a0('0x1c'))['register'](socket);function respondWithStatusCode(_0xe2ca6e,_0x3297c4){_0x3297c4=_0x3297c4||0xcc;return function(_0x3eba61){if(_0x3eba61){return _0xe2ca6e[_0x46a0('0x1d')](_0x3297c4);}return _0xe2ca6e[_0x46a0('0x1e')](_0x3297c4)[_0x46a0('0x1f')]();};}function respondWithResult(_0x118d80,_0x500183){_0x500183=_0x500183||0xc8;return function(_0x5af334){if(_0x5af334){return _0x118d80[_0x46a0('0x1e')](_0x500183)['json'](_0x5af334);}};}function respondWithFilteredResult(_0x4236b2,_0xd73444){return function(_0x27d540){if(_0x27d540){var _0x282a81=typeof _0xd73444[_0x46a0('0x20')]===_0x46a0('0x21')&&typeof _0xd73444['limit']===_0x46a0('0x21');var _0x365ed3=_0x27d540[_0x46a0('0x22')];var _0x502762=_0x282a81?0x0:_0xd73444['offset'];var _0x1444af=_0x282a81?_0x27d540[_0x46a0('0x22')]:_0xd73444['offset']+_0xd73444['limit'];var _0x5f293e;if(_0x1444af>=_0x365ed3){_0x1444af=_0x365ed3;_0x5f293e=0xc8;}else{_0x5f293e=0xce;}_0x4236b2[_0x46a0('0x1e')](_0x5f293e);return _0x4236b2[_0x46a0('0x23')](_0x46a0('0x24'),_0x502762+'-'+_0x1444af+'/'+_0x365ed3)[_0x46a0('0x25')](_0x27d540);}return null;};}function patchUpdates(_0x518c4e){return function(_0x92e8b1){try{jsonpatch['apply'](_0x92e8b1,_0x518c4e,!![]);}catch(_0x4892ab){return BPromise['reject'](_0x4892ab);}return _0x92e8b1[_0x46a0('0x26')]();};}function saveUpdates(_0x2bd65c,_0x2f5358){return function(_0x1b6ea1){if(_0x1b6ea1){return _0x1b6ea1['update'](_0x2bd65c)[_0x46a0('0x27')](function(_0x4dda39){return _0x4dda39;});}return null;};}function removeEntity(_0xde924e,_0x13225a){return function(_0x4cebcd){if(_0x4cebcd){return _0x4cebcd[_0x46a0('0x28')]()[_0x46a0('0x27')](function(){_0xde924e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fdfe9,_0x22479f){return function(_0x1d260e){if(!_0x1d260e){_0x2fdfe9[_0x46a0('0x1d')](0x194);}return _0x1d260e;};}function handleError(_0x5754e1,_0x2cf32f){_0x2cf32f=_0x2cf32f||0x1f4;return function(_0xe5b9bd){logger[_0x46a0('0x29')](_0xe5b9bd[_0x46a0('0x2a')]);if(_0xe5b9bd[_0x46a0('0x2b')]){delete _0xe5b9bd[_0x46a0('0x2b')];}_0x5754e1[_0x46a0('0x1e')](_0x2cf32f)[_0x46a0('0x2c')](_0xe5b9bd);};}exports['index']=function(_0x54e80e,_0x4d552b){var _0x2726d6={},_0x1c5b18={},_0x751b2e={'count':0x0,'rows':[]};var _0x5c3949=_[_0x46a0('0x2d')](db['VoiceQueueReport']['rawAttributes'],function(_0x17f485){return{'name':_0x17f485[_0x46a0('0x2e')],'type':_0x17f485[_0x46a0('0x2f')]['key']};});_0x1c5b18['model']=_[_0x46a0('0x2d')](_0x5c3949,_0x46a0('0x2b'));_0x1c5b18[_0x46a0('0x30')]=_[_0x46a0('0x31')](_0x54e80e[_0x46a0('0x30')]);_0x1c5b18[_0x46a0('0x32')]=_['intersection'](_0x1c5b18[_0x46a0('0x33')],_0x1c5b18['query']);_0x2726d6['attributes']=_[_0x46a0('0x34')](_0x1c5b18[_0x46a0('0x33')],qs['fields'](_0x54e80e[_0x46a0('0x30')][_0x46a0('0x35')]));_0x2726d6[_0x46a0('0x36')]=_0x2726d6[_0x46a0('0x36')][_0x46a0('0x37')]?_0x2726d6[_0x46a0('0x36')]:_0x1c5b18[_0x46a0('0x33')];if(!_0x54e80e[_0x46a0('0x30')][_0x46a0('0x38')](_0x46a0('0x39'))){_0x2726d6[_0x46a0('0x3a')]=qs['limit'](_0x54e80e[_0x46a0('0x30')][_0x46a0('0x3a')]);_0x2726d6[_0x46a0('0x20')]=qs[_0x46a0('0x20')](_0x54e80e[_0x46a0('0x30')][_0x46a0('0x20')]);}_0x2726d6[_0x46a0('0x3b')]=qs[_0x46a0('0x3c')](_0x54e80e[_0x46a0('0x30')][_0x46a0('0x3c')]);_0x2726d6[_0x46a0('0x3d')]=qs['filters'](_[_0x46a0('0x3e')](_0x54e80e[_0x46a0('0x30')],_0x1c5b18[_0x46a0('0x32')]),_0x5c3949);if(_0x54e80e[_0x46a0('0x30')][_0x46a0('0x3f')]){_0x2726d6[_0x46a0('0x3d')]=_[_0x46a0('0x40')](_0x2726d6[_0x46a0('0x3d')],{'$or':_['map'](_0x5c3949,function(_0x468ad6){if(_0x468ad6[_0x46a0('0x2f')]!==_0x46a0('0x41')){var _0x2616e8={};_0x2616e8[_0x468ad6['name']]={'$like':'%'+_0x54e80e[_0x46a0('0x30')]['filter']+'%'};return _0x2616e8;}})});}_0x2726d6=_[_0x46a0('0x40')]({},_0x2726d6,_0x54e80e['options']);var _0x57d636={'where':_0x2726d6['where']};return db['VoiceQueueReport']['count'](_0x57d636)[_0x46a0('0x27')](function(_0x6e0615){_0x751b2e[_0x46a0('0x22')]=_0x6e0615;if(_0x54e80e[_0x46a0('0x30')][_0x46a0('0x42')]){_0x2726d6[_0x46a0('0x43')]=[{'all':!![]}];}return db[_0x46a0('0x44')][_0x46a0('0x45')](_0x2726d6);})[_0x46a0('0x27')](function(_0x2d0f7b){_0x751b2e[_0x46a0('0x46')]=_0x2d0f7b;return _0x751b2e;})['then'](respondWithFilteredResult(_0x4d552b,_0x2726d6))[_0x46a0('0x47')](handleError(_0x4d552b,null));};exports[_0x46a0('0x48')]=function(_0x3340a9,_0x557eac){var _0x5584c2={'raw':![],'where':{'id':_0x3340a9['params']['id']}},_0x223b24={};_0x223b24['model']=_['keys'](db['VoiceQueueReport'][_0x46a0('0x49')]);_0x223b24[_0x46a0('0x30')]=_[_0x46a0('0x31')](_0x3340a9[_0x46a0('0x30')]);_0x223b24[_0x46a0('0x32')]=_[_0x46a0('0x34')](_0x223b24[_0x46a0('0x33')],_0x223b24[_0x46a0('0x30')]);_0x5584c2['attributes']=_[_0x46a0('0x34')](_0x223b24['model'],qs[_0x46a0('0x35')](_0x3340a9[_0x46a0('0x30')][_0x46a0('0x35')]));_0x5584c2[_0x46a0('0x36')]=_0x5584c2[_0x46a0('0x36')][_0x46a0('0x37')]?_0x5584c2['attributes']:_0x223b24[_0x46a0('0x33')];if(_0x3340a9['query'][_0x46a0('0x42')]){_0x5584c2[_0x46a0('0x43')]=[{'all':!![]}];}_0x5584c2=_[_0x46a0('0x40')]({},_0x5584c2,_0x3340a9['options']);return db[_0x46a0('0x44')]['find'](_0x5584c2)['then'](handleEntityNotFound(_0x557eac,null))[_0x46a0('0x27')](respondWithResult(_0x557eac,null))['catch'](handleError(_0x557eac,null));};exports[_0x46a0('0x4a')]=function(_0x37b4de,_0x40b5ef){return db[_0x46a0('0x44')][_0x46a0('0x4a')](_0x37b4de[_0x46a0('0x4b')],{})[_0x46a0('0x27')](respondWithResult(_0x40b5ef,0xc9))[_0x46a0('0x47')](handleError(_0x40b5ef,null));};exports[_0x46a0('0x4c')]=function(_0x18a5d4,_0x6b7dd7){if(_0x18a5d4[_0x46a0('0x4b')]['id']){delete _0x18a5d4[_0x46a0('0x4b')]['id'];}return db['VoiceQueueReport'][_0x46a0('0x4d')]({'where':{'id':_0x18a5d4['params']['id']}})[_0x46a0('0x27')](handleEntityNotFound(_0x6b7dd7,null))['then'](saveUpdates(_0x18a5d4[_0x46a0('0x4b')],null))['then'](respondWithResult(_0x6b7dd7,null))[_0x46a0('0x47')](handleError(_0x6b7dd7,null));};exports[_0x46a0('0x28')]=function(_0x2c4f19,_0x42da07){return db[_0x46a0('0x44')][_0x46a0('0x4d')]({'where':{'id':_0x2c4f19[_0x46a0('0x4e')]['id']}})[_0x46a0('0x27')](handleEntityNotFound(_0x42da07,null))['then'](removeEntity(_0x42da07,null))[_0x46a0('0x47')](handleError(_0x42da07,null));};exports[_0x46a0('0x4f')]=function(_0x4f4cf5,_0x298e04){return db[_0x46a0('0x44')][_0x46a0('0x4f')]()[_0x46a0('0x27')](respondWithResult(_0x298e04,null))[_0x46a0('0x47')](handleError(_0x298e04,null));};exports[_0x46a0('0x50')]=function(_0x563360,_0x57a1f8){var _0x3c40d3={},_0x7bae4c={},_0x14e097={'count':0x0,'rows':[]};_0x7bae4c[_0x46a0('0x33')]=_[_0x46a0('0x31')](db[_0x46a0('0x44')]['rawAttributes']);_0x7bae4c[_0x46a0('0x30')]=_['keys'](_0x563360[_0x46a0('0x30')]);_0x7bae4c[_0x46a0('0x32')]=_[_0x46a0('0x34')](_0x7bae4c[_0x46a0('0x33')],_0x7bae4c[_0x46a0('0x30')]);_0x3c40d3['attributes']=_[_0x46a0('0x34')](_0x7bae4c[_0x46a0('0x33')],qs[_0x46a0('0x35')](_0x563360['query']['fields']));_0x3c40d3[_0x46a0('0x36')]=_0x3c40d3['attributes'][_0x46a0('0x37')]?_0x3c40d3[_0x46a0('0x36')]:_0x7bae4c['model'];if(!_0x563360[_0x46a0('0x30')]['hasOwnProperty'](_0x46a0('0x39'))){_0x3c40d3[_0x46a0('0x3a')]=qs[_0x46a0('0x3a')](_0x563360[_0x46a0('0x30')][_0x46a0('0x3a')]);_0x3c40d3['offset']=qs[_0x46a0('0x20')](_0x563360[_0x46a0('0x30')]['offset']);}_0x3c40d3[_0x46a0('0x3b')]=qs[_0x46a0('0x3c')](_0x563360['query']['sort']);_0x3c40d3[_0x46a0('0x3d')]=qs[_0x46a0('0x32')](_[_0x46a0('0x3e')](_0x563360['query'],_0x7bae4c[_0x46a0('0x32')]));if(_0x563360[_0x46a0('0x30')]['filter']){_0x3c40d3[_0x46a0('0x3d')]=_[_0x46a0('0x40')](_0x3c40d3[_0x46a0('0x3d')],{'$or':_[_0x46a0('0x2d')](_0x3c40d3[_0x46a0('0x36')],function(_0x267aca){var _0x2d77b4={};_0x2d77b4[_0x267aca]={'$like':'%'+_0x563360[_0x46a0('0x30')][_0x46a0('0x3f')]+'%'};return _0x2d77b4;})});}_0x3c40d3=_['merge']({},_0x3c40d3,_0x563360['options']);var _0x27f54e={'where':_0x3c40d3[_0x46a0('0x3d')]};return db[_0x46a0('0x44')][_0x46a0('0x22')](_0x27f54e)['then'](function(_0x5896bb){_0x14e097['count']=_0x5896bb;if(_0x563360['query'][_0x46a0('0x42')]){_0x3c40d3[_0x46a0('0x43')]=[{'all':!![]}];}return db[_0x46a0('0x44')][_0x46a0('0x45')](_0x3c40d3);})[_0x46a0('0x27')](function(_0x158251){_0x14e097[_0x46a0('0x46')]=_0x158251;return _0x14e097;})[_0x46a0('0x27')](respondWithFilteredResult(_0x57a1f8,_0x3c40d3,_0x46a0('0x50')))[_0x46a0('0x47')](handleError(_0x57a1f8,null,_0x46a0('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 39146d9..3a351ad 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 _0x78bf=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1ae382,_0x3b64e4){var _0x464502=function(_0x2ddd13){while(--_0x2ddd13){_0x1ae382['push'](_0x1ae382['shift']());}};_0x464502(++_0x3b64e4);}(_0x78bf,0x1f4));var _0xf78b=function(_0x31520d,_0x50046a){_0x31520d=_0x31520d-0x0;var _0x4d0d26=_0x78bf[_0x31520d];return _0x4d0d26;};'use strict';var EventEmitter=require(_0xf78b('0x0'));var VoiceQueueReport=require(_0xf78b('0x1'))['db'][_0xf78b('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf78b('0x3')](0x0);var events={'afterCreate':_0xf78b('0x4'),'afterUpdate':'update','afterDestroy':_0xf78b('0x5')};function emitEvent(_0x2eaa74){return function(_0x150b3b,_0x14e78e,_0x29eed2){VoiceQueueReportEvents[_0xf78b('0x6')](_0x2eaa74+':'+_0x150b3b['id'],_0x150b3b);VoiceQueueReportEvents[_0xf78b('0x6')](_0x2eaa74,_0x150b3b);_0x29eed2(null);};}for(var e in events){if(events[_0xf78b('0x7')](e)){var event=events[e];VoiceQueueReport[_0xf78b('0x8')](e,emitEvent(event));}}module[_0xf78b('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xda6b=['remove','emit','hook','../../mysqldb','VoiceQueueReport','save'];(function(_0x1ad11f,_0x4558d0){var _0x349f3a=function(_0x939d84){while(--_0x939d84){_0x1ad11f['push'](_0x1ad11f['shift']());}};_0x349f3a(++_0x4558d0);}(_0xda6b,0x141));var _0xbda6=function(_0x3f3e4c,_0xa1cb65){_0x3f3e4c=_0x3f3e4c-0x0;var _0x33925f=_0xda6b[_0x3f3e4c];return _0x33925f;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xbda6('0x0'))['db'][_0xbda6('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbda6('0x2'),'afterUpdate':'update','afterDestroy':_0xbda6('0x3')};function emitEvent(_0xb0ce56){return function(_0x118f90,_0x5a8b4e,_0x4a66db){VoiceQueueReportEvents[_0xbda6('0x4')](_0xb0ce56+':'+_0x118f90['id'],_0x118f90);VoiceQueueReportEvents['emit'](_0xb0ce56,_0x118f90);_0x4a66db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xbda6('0x5')](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 431ea8d..708f653 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 _0x8524=['VoiceQueueReport','report_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','define'];(function(_0x45633f,_0x4326ba){var _0x3531bc=function(_0x51c7e0){while(--_0x51c7e0){_0x45633f['push'](_0x45633f['shift']());}};_0x3531bc(++_0x4326ba);}(_0x8524,0x1d4));var _0x4852=function(_0x448aa0,_0x3648f2){_0x448aa0=_0x448aa0-0x0;var _0x399a6e=_0x8524[_0x448aa0];return _0x399a6e;};'use strict';var _=require(_0x4852('0x0'));var util=require(_0x4852('0x1'));var logger=require(_0x4852('0x2'))(_0x4852('0x3'));var moment=require(_0x4852('0x4'));var BPromise=require(_0x4852('0x5'));var rp=require(_0x4852('0x6'));var fs=require('fs');var path=require(_0x4852('0x7'));var rimraf=require(_0x4852('0x8'));var config=require(_0x4852('0x9'));var attributes=require(_0x4852('0xa'));module['exports']=function(_0x45089f,_0x3f70eb){return _0x45089f[_0x4852('0xb')](_0x4852('0xc'),attributes,{'tableName':_0x4852('0xd'),'paranoid':![],'indexes':[{'fields':[_0x4852('0xe')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfbe=['util','api','bluebird','request-promise','path','rimraf','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash'];(function(_0x2c6d5a,_0x51903f){var _0x5ec196=function(_0x52e45a){while(--_0x52e45a){_0x2c6d5a['push'](_0x2c6d5a['shift']());}};_0x5ec196(++_0x51903f);}(_0xbfbe,0x143));var _0xebfb=function(_0x3dd0b9,_0x1d6c92){_0x3dd0b9=_0x3dd0b9-0x0;var _0x4c0351=_0xbfbe[_0x3dd0b9];return _0x4c0351;};'use strict';var _=require(_0xebfb('0x0'));var util=require(_0xebfb('0x1'));var logger=require('../../config/logger')(_0xebfb('0x2'));var moment=require('moment');var BPromise=require(_0xebfb('0x3'));var rp=require(_0xebfb('0x4'));var fs=require('fs');var path=require(_0xebfb('0x5'));var rimraf=require(_0xebfb('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xebfb('0x7')]=function(_0x589b78,_0x24be33){return _0x589b78[_0xebfb('0x8')](_0xebfb('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xebfb('0xa')]},{'fields':[_0xebfb('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 4bbf07f..6ede615 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 _0xbc80=['debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','limit','map','model','attributes','include','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x295c5a,_0x154dad){var _0x334e9a=function(_0x482e62){while(--_0x482e62){_0x295c5a['push'](_0x295c5a['shift']());}};_0x334e9a(++_0x154dad);}(_0xbc80,0x15e));var _0x0bc8=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0xbc80[_0xcfeda9];return _0x4826c7;};'use strict';var _=require(_0x0bc8('0x0'));var util=require(_0x0bc8('0x1'));var moment=require(_0x0bc8('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bc8('0x3'));var fs=require('fs');var Redis=require(_0x0bc8('0x4'));var db=require(_0x0bc8('0x5'))['db'];var utils=require(_0x0bc8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0bc8('0x7'));var jayson=require(_0x0bc8('0x8'));var client=jayson[_0x0bc8('0x9')][_0x0bc8('0xa')]({'port':0x232a});config[_0x0bc8('0xb')]=_[_0x0bc8('0xc')](config[_0x0bc8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0bc8('0xd'))(new Redis(config[_0x0bc8('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x14add6,_0x53c2f8,_0x34298f){return new BPromise(function(_0x19584e,_0x1fdd0b){return client[_0x0bc8('0xe')](_0x14add6,_0x34298f)[_0x0bc8('0xf')](function(_0x272051){logger[_0x0bc8('0x10')](_0x0bc8('0x11'),_0x53c2f8,_0x0bc8('0x12'));logger[_0x0bc8('0x13')](_0x0bc8('0x14'),_0x53c2f8,'request\x20sent',JSON[_0x0bc8('0x15')](_0x272051));if(_0x272051[_0x0bc8('0x16')]){if(_0x272051[_0x0bc8('0x16')]['code']===0x1f4){logger[_0x0bc8('0x16')](_0x0bc8('0x11'),_0x53c2f8,_0x272051[_0x0bc8('0x16')]['message']);return _0x1fdd0b(_0x272051[_0x0bc8('0x16')]['message']);}logger[_0x0bc8('0x16')](_0x0bc8('0x11'),_0x53c2f8,_0x272051[_0x0bc8('0x16')][_0x0bc8('0x17')]);return _0x19584e(_0x272051[_0x0bc8('0x16')][_0x0bc8('0x17')]);}else{logger[_0x0bc8('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x53c2f8,'request\x20sent');_0x19584e(_0x272051[_0x0bc8('0x18')][_0x0bc8('0x17')]);}})[_0x0bc8('0x19')](function(_0x180ff1){logger['error'](_0x0bc8('0x11'),_0x53c2f8,_0x180ff1);_0x1fdd0b(_0x180ff1);});});}exports[_0x0bc8('0x1a')]=function(_0x34aa24){var _0x3ea509=this;return new Promise(function(_0x42b678,_0x253f45){return db[_0x0bc8('0x1b')]['findAll']({'raw':_0x34aa24[_0x0bc8('0x1c')]?_0x34aa24[_0x0bc8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x34aa24[_0x0bc8('0x1c')]?_0x34aa24['options']['where']||null:null,'attributes':_0x34aa24[_0x0bc8('0x1c')]?_0x34aa24[_0x0bc8('0x1c')]['attributes']||null:null,'limit':_0x34aa24[_0x0bc8('0x1c')]?_0x34aa24[_0x0bc8('0x1c')][_0x0bc8('0x1d')]||null:null,'include':_0x34aa24['options']?_0x34aa24[_0x0bc8('0x1c')]['include']?_[_0x0bc8('0x1e')](_0x34aa24['options']['include'],function(_0x55262e){return{'model':db[_0x55262e[_0x0bc8('0x1f')]],'as':_0x55262e['as'],'attributes':_0x55262e[_0x0bc8('0x20')],'include':_0x55262e[_0x0bc8('0x21')]?_['map'](_0x55262e[_0x0bc8('0x21')],function(_0x559b98){return{'model':db[_0x559b98['model']],'as':_0x559b98['as'],'attributes':_0x559b98['attributes'],'include':_0x559b98[_0x0bc8('0x21')]?_[_0x0bc8('0x1e')](_0x559b98[_0x0bc8('0x21')],function(_0x39d778){return{'model':db[_0x39d778['model']],'as':_0x39d778['as'],'attributes':_0x39d778[_0x0bc8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f4ae0){logger[_0x0bc8('0x10')]('GetVoiceQueueReport',_0x34aa24);logger[_0x0bc8('0x13')](_0x0bc8('0x1a'),_0x34aa24,JSON['stringify'](_0x1f4ae0));_0x42b678(_0x1f4ae0);})[_0x0bc8('0x19')](function(_0x1e1046){logger[_0x0bc8('0x16')](_0x0bc8('0x1a'),_0x1e1046[_0x0bc8('0x17')],_0x34aa24);_0x253f45(_0x3ea509[_0x0bc8('0x16')](0x1f4,_0x1e1046[_0x0bc8('0x17')]));});});};exports[_0x0bc8('0x22')]=function(_0x2b061b){var _0x543c5d=this;return new Promise(function(_0x4d5f95,_0x58a2e3){return db[_0x0bc8('0x1b')][_0x0bc8('0x23')](_0x2b061b[_0x0bc8('0x24')],{'raw':_0x2b061b[_0x0bc8('0x1c')]?_0x2b061b['options']['raw']===undefined?!![]:![]:!![]})[_0x0bc8('0xf')](function(_0xf6225f){logger[_0x0bc8('0x10')](_0x0bc8('0x22'),_0x2b061b);logger[_0x0bc8('0x13')](_0x0bc8('0x22'),_0x2b061b,JSON['stringify'](_0xf6225f));_0x4d5f95(_0xf6225f);})[_0x0bc8('0x19')](function(_0x4ed34f){logger[_0x0bc8('0x16')]('CreateVoiceQueueReport',_0x4ed34f[_0x0bc8('0x17')],_0x2b061b);_0x58a2e3(_0x543c5d[_0x0bc8('0x16')](0x1f4,_0x4ed34f[_0x0bc8('0x17')]));});});};exports[_0x0bc8('0x25')]=function(_0x6ca4ce){var _0x3ecb6a=this;return new Promise(function(_0xa1e311,_0x28019b){return db['VoiceQueueReport'][_0x0bc8('0x26')](_0x6ca4ce[_0x0bc8('0x24')],{'raw':_0x6ca4ce['options']?_0x6ca4ce[_0x0bc8('0x1c')][_0x0bc8('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6ca4ce[_0x0bc8('0x1c')]?_0x6ca4ce[_0x0bc8('0x1c')][_0x0bc8('0x28')]||null:null,'attributes':_0x6ca4ce['options']?_0x6ca4ce[_0x0bc8('0x1c')]['attributes']||null:null,'limit':_0x6ca4ce[_0x0bc8('0x1c')]?_0x6ca4ce['options'][_0x0bc8('0x1d')]||null:null})['then'](function(_0x4768bb){logger[_0x0bc8('0x10')](_0x0bc8('0x25'),_0x6ca4ce);logger[_0x0bc8('0x13')](_0x0bc8('0x25'),_0x6ca4ce,JSON[_0x0bc8('0x15')](_0x4768bb));_0xa1e311(_0x4768bb);})[_0x0bc8('0x19')](function(_0x43ca1f){logger[_0x0bc8('0x16')]('UpdateVoiceQueueReport',_0x43ca1f[_0x0bc8('0x17')],_0x6ca4ce);_0x28019b(_0x3ecb6a[_0x0bc8('0x16')](0x1f4,_0x43ca1f['message']));});});}; \ No newline at end of file +var _0xfc17=['raw','where','attributes','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceQueueReport','findAll','options'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0xfc17,0x10e));var _0x7fc1=function(_0x2ee202,_0x449507){_0x2ee202=_0x2ee202-0x0;var _0x36c32a=_0xfc17[_0x2ee202];return _0x36c32a;};'use strict';var _=require(_0x7fc1('0x0'));var util=require('util');var moment=require(_0x7fc1('0x1'));var BPromise=require(_0x7fc1('0x2'));var rs=require(_0x7fc1('0x3'));var fs=require('fs');var Redis=require(_0x7fc1('0x4'));var db=require(_0x7fc1('0x5'))['db'];var utils=require(_0x7fc1('0x6'));var logger=require(_0x7fc1('0x7'))(_0x7fc1('0x8'));var config=require(_0x7fc1('0x9'));var jayson=require(_0x7fc1('0xa'));var client=jayson['client'][_0x7fc1('0xb')]({'port':0x232a});config[_0x7fc1('0xc')]=_['defaults'](config[_0x7fc1('0xc')],{'host':_0x7fc1('0xd'),'port':0x18eb});var socket=require(_0x7fc1('0xe'))(new Redis(config[_0x7fc1('0xc')]));require(_0x7fc1('0xf'))[_0x7fc1('0x10')](socket);function respondWithRpcPromise(_0x594ff7,_0x36f7c4,_0xe3bba){return new BPromise(function(_0x5f0298,_0x5c92a8){return client['request'](_0x594ff7,_0xe3bba)[_0x7fc1('0x11')](function(_0x52d173){logger[_0x7fc1('0x12')](_0x7fc1('0x13'),_0x36f7c4,_0x7fc1('0x14'));logger[_0x7fc1('0x15')](_0x7fc1('0x16'),_0x36f7c4,_0x7fc1('0x14'),JSON[_0x7fc1('0x17')](_0x52d173));if(_0x52d173[_0x7fc1('0x18')]){if(_0x52d173['error']['code']===0x1f4){logger[_0x7fc1('0x18')](_0x7fc1('0x13'),_0x36f7c4,_0x52d173[_0x7fc1('0x18')][_0x7fc1('0x19')]);return _0x5c92a8(_0x52d173['error'][_0x7fc1('0x19')]);}logger[_0x7fc1('0x18')](_0x7fc1('0x13'),_0x36f7c4,_0x52d173[_0x7fc1('0x18')][_0x7fc1('0x19')]);return _0x5f0298(_0x52d173[_0x7fc1('0x18')]['message']);}else{logger[_0x7fc1('0x12')](_0x7fc1('0x13'),_0x36f7c4,_0x7fc1('0x14'));_0x5f0298(_0x52d173[_0x7fc1('0x1a')][_0x7fc1('0x19')]);}})[_0x7fc1('0x1b')](function(_0x2f330){logger[_0x7fc1('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x36f7c4,_0x2f330);_0x5c92a8(_0x2f330);});});}exports['GetVoiceQueueReport']=function(_0x7fce05){var _0x46f6bf=this;return new Promise(function(_0x3da554,_0x59f047){return db[_0x7fc1('0x1c')][_0x7fc1('0x1d')]({'raw':_0x7fce05[_0x7fc1('0x1e')]?_0x7fce05[_0x7fc1('0x1e')][_0x7fc1('0x1f')]===undefined?!![]:![]:!![],'where':_0x7fce05['options']?_0x7fce05[_0x7fc1('0x1e')][_0x7fc1('0x20')]||null:null,'attributes':_0x7fce05[_0x7fc1('0x1e')]?_0x7fce05[_0x7fc1('0x1e')][_0x7fc1('0x21')]||null:null,'limit':_0x7fce05[_0x7fc1('0x1e')]?_0x7fce05[_0x7fc1('0x1e')]['limit']||null:null,'include':_0x7fce05[_0x7fc1('0x1e')]?_0x7fce05['options'][_0x7fc1('0x22')]?_[_0x7fc1('0x23')](_0x7fce05['options'][_0x7fc1('0x22')],function(_0x496ed5){return{'model':db[_0x496ed5[_0x7fc1('0x24')]],'as':_0x496ed5['as'],'attributes':_0x496ed5['attributes'],'include':_0x496ed5[_0x7fc1('0x22')]?_[_0x7fc1('0x23')](_0x496ed5[_0x7fc1('0x22')],function(_0x4b1776){return{'model':db[_0x4b1776['model']],'as':_0x4b1776['as'],'attributes':_0x4b1776['attributes'],'include':_0x4b1776[_0x7fc1('0x22')]?_[_0x7fc1('0x23')](_0x4b1776[_0x7fc1('0x22')],function(_0x27bba0){return{'model':db[_0x27bba0[_0x7fc1('0x24')]],'as':_0x27bba0['as'],'attributes':_0x27bba0[_0x7fc1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7fc1('0x11')](function(_0x1eb9e0){logger[_0x7fc1('0x12')](_0x7fc1('0x25'),_0x7fce05);logger[_0x7fc1('0x15')]('GetVoiceQueueReport',_0x7fce05,JSON[_0x7fc1('0x17')](_0x1eb9e0));_0x3da554(_0x1eb9e0);})['catch'](function(_0x23aa80){logger[_0x7fc1('0x18')](_0x7fc1('0x25'),_0x23aa80[_0x7fc1('0x19')],_0x7fce05);_0x59f047(_0x46f6bf[_0x7fc1('0x18')](0x1f4,_0x23aa80[_0x7fc1('0x19')]));});});};exports[_0x7fc1('0x26')]=function(_0x502ca8){var _0x333393=this;return new Promise(function(_0xf81302,_0x586bae){return db['VoiceQueueReport']['create'](_0x502ca8[_0x7fc1('0x27')],{'raw':_0x502ca8[_0x7fc1('0x1e')]?_0x502ca8[_0x7fc1('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x7fc1('0x11')](function(_0x25bcc3){logger[_0x7fc1('0x12')](_0x7fc1('0x26'),_0x502ca8);logger[_0x7fc1('0x15')](_0x7fc1('0x26'),_0x502ca8,JSON[_0x7fc1('0x17')](_0x25bcc3));_0xf81302(_0x25bcc3);})[_0x7fc1('0x1b')](function(_0x3fe87c){logger[_0x7fc1('0x18')]('CreateVoiceQueueReport',_0x3fe87c['message'],_0x502ca8);_0x586bae(_0x333393['error'](0x1f4,_0x3fe87c[_0x7fc1('0x19')]));});});};exports[_0x7fc1('0x28')]=function(_0x3488f3){var _0x56112f=this;return new Promise(function(_0x4a29b2,_0x518e40){return db[_0x7fc1('0x1c')][_0x7fc1('0x29')](_0x3488f3[_0x7fc1('0x27')],{'raw':_0x3488f3[_0x7fc1('0x1e')]?_0x3488f3[_0x7fc1('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3488f3['options']?_0x3488f3[_0x7fc1('0x1e')]['where']||null:null,'attributes':_0x3488f3[_0x7fc1('0x1e')]?_0x3488f3['options'][_0x7fc1('0x21')]||null:null,'limit':_0x3488f3['options']?_0x3488f3['options'][_0x7fc1('0x2a')]||null:null})[_0x7fc1('0x11')](function(_0x7e0c0b){logger[_0x7fc1('0x12')](_0x7fc1('0x28'),_0x3488f3);logger[_0x7fc1('0x15')](_0x7fc1('0x28'),_0x3488f3,JSON[_0x7fc1('0x17')](_0x7e0c0b));_0x4a29b2(_0x7e0c0b);})[_0x7fc1('0x1b')](function(_0x2c8e68){logger[_0x7fc1('0x18')](_0x7fc1('0x28'),_0x2c8e68['message'],_0x3488f3);_0x518e40(_0x56112f[_0x7fc1('0x18')](0x1f4,_0x2c8e68[_0x7fc1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 2b167dd..905705e 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 _0x85d3=['remove','update','emit','removeListener','voiceQueueReport:','save'];(function(_0x137941,_0xdafeb7){var _0x2426b3=function(_0x19edc2){while(--_0x19edc2){_0x137941['push'](_0x137941['shift']());}};_0x2426b3(++_0xdafeb7);}(_0x85d3,0x1a9));var _0x385d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x85d3[_0x501510];return _0x1e6ee5;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x385d('0x0'),_0x385d('0x1'),_0x385d('0x2')];function createListener(_0x4a60cb,_0x5df85c){return function(_0x292155){_0x5df85c[_0x385d('0x3')](_0x4a60cb,_0x292155);};}function removeListener(_0x1c70e9,_0x586d7c){return function(){VoiceQueueReportEvents[_0x385d('0x4')](_0x1c70e9,_0x586d7c);};}exports['register']=function(_0x554c8d){for(var _0x59938d=0x0,_0x1b84d9=events['length'];_0x59938d<_0x1b84d9;_0x59938d++){var _0x2ea3b1=events[_0x59938d];var _0x5494d1=createListener(_0x385d('0x5')+_0x2ea3b1,_0x554c8d);VoiceQueueReportEvents['on'](_0x2ea3b1,_0x5494d1);}}; \ No newline at end of file +var _0xc8e9=['register','length','voiceQueueReport:','save','remove','update','emit'];(function(_0xbd77c1,_0x50b969){var _0x47fa83=function(_0x38dac1){while(--_0x38dac1){_0xbd77c1['push'](_0xbd77c1['shift']());}};_0x47fa83(++_0x50b969);}(_0xc8e9,0x1f4));var _0x9c8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc8e9[_0x14add3];return _0x4a174f;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x9c8e('0x0'),_0x9c8e('0x1'),_0x9c8e('0x2')];function createListener(_0x4fc891,_0x5b9e9a){return function(_0x703475){_0x5b9e9a[_0x9c8e('0x3')](_0x4fc891,_0x703475);};}function removeListener(_0x1cb493,_0x147e2b){return function(){VoiceQueueReportEvents['removeListener'](_0x1cb493,_0x147e2b);};}exports[_0x9c8e('0x4')]=function(_0x38c013){for(var _0x241bea=0x0,_0x431c51=events[_0x9c8e('0x5')];_0x241bea<_0x431c51;_0x241bea++){var _0x1d7de1=events[_0x241bea];var _0x3864c8=createListener(_0x9c8e('0x6')+_0x1d7de1,_0x38c013);VoiceQueueReportEvents['on'](_0x1d7de1,_0x3864c8);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index a4c6a3d..3180178 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 _0x46fc=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x37aeb6,_0x24bd14){var _0xdbe448=function(_0x640944){while(--_0x640944){_0x37aeb6['push'](_0x37aeb6['shift']());}};_0xdbe448(++_0x24bd14);}(_0x46fc,0x103));var _0xc46f=function(_0x211f4e,_0x5126c4){_0x211f4e=_0x211f4e-0x0;var _0x440a89=_0x46fc[_0x211f4e];return _0x440a89;};'use strict';var multer=require(_0xc46f('0x0'));var util=require(_0xc46f('0x1'));var path=require(_0xc46f('0x2'));var timeout=require(_0xc46f('0x3'));var express=require(_0xc46f('0x4'));var router=express[_0xc46f('0x5')]();var fs_extra=require(_0xc46f('0x6'));var auth=require(_0xc46f('0x7'));var interaction=require(_0xc46f('0x8'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0xc46f('0x9')]('/',auth[_0xc46f('0xa')](),controller[_0xc46f('0xb')]);router[_0xc46f('0x9')](_0xc46f('0xc'),auth[_0xc46f('0xa')](),controller[_0xc46f('0xd')]);router[_0xc46f('0xe')]('/',auth[_0xc46f('0xa')](),controller[_0xc46f('0xf')]);router[_0xc46f('0x10')](_0xc46f('0xc'),auth[_0xc46f('0xa')](),controller[_0xc46f('0x11')]);router['delete'](_0xc46f('0xc'),auth[_0xc46f('0xa')](),controller[_0xc46f('0x12')]);module[_0xc46f('0x13')]=router; \ No newline at end of file +var _0xc092=['delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put'];(function(_0xe74768,_0x4c0bf9){var _0x302e8a=function(_0x5ba5c8){while(--_0x5ba5c8){_0xe74768['push'](_0xe74768['shift']());}};_0x302e8a(++_0x4c0bf9);}(_0xc092,0x122));var _0x2c09=function(_0x1b96ea,_0x20fa69){_0x1b96ea=_0x1b96ea-0x0;var _0x2a0d86=_0xc092[_0x1b96ea];return _0x2a0d86;};'use strict';var multer=require(_0x2c09('0x0'));var util=require(_0x2c09('0x1'));var path=require(_0x2c09('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2c09('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2c09('0x4'));var interaction=require(_0x2c09('0x5'));var config=require(_0x2c09('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x2c09('0x7')]('/',auth[_0x2c09('0x8')](),controller[_0x2c09('0x9')]);router[_0x2c09('0x7')](_0x2c09('0xa'),auth[_0x2c09('0x8')](),controller[_0x2c09('0xb')]);router[_0x2c09('0xc')]('/',auth[_0x2c09('0x8')](),controller['create']);router[_0x2c09('0xd')](_0x2c09('0xa'),auth[_0x2c09('0x8')](),controller['update']);router[_0x2c09('0xe')](_0x2c09('0xa'),auth[_0x2c09('0x8')](),controller[_0x2c09('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index bd03d46..9f80ca3 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 _0x5eb9=['sequelize','exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x59a8c5,_0x498465){var _0x13b90d=function(_0x58d79c){while(--_0x58d79c){_0x59a8c5['push'](_0x59a8c5['shift']());}};_0x13b90d(++_0x498465);}(_0x5eb9,0x1d1));var _0x95eb=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x5eb9[_0x3e44fa];return _0x2a0aba;};'use strict';var Sequelize=require(_0x95eb('0x0'));var moment=require('moment');module[_0x95eb('0x1')]={'time':{'type':Sequelize[_0x95eb('0x2')]},'callid':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x95eb('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x95eb('0x3')](_0x95eb('0x4'))}}; \ No newline at end of file +var _0x47ea=['moment','exports','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x58f678,_0x18b3cc){var _0x238aef=function(_0x339e5d){while(--_0x339e5d){_0x58f678['push'](_0x58f678['shift']());}};_0x238aef(++_0x18b3cc);}(_0x47ea,0xd7));var _0xa47e=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x47ea[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0xa47e('0x0'));var moment=require(_0xa47e('0x1'));module[_0xa47e('0x2')]={'time':{'type':Sequelize[_0xa47e('0x3')]},'callid':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa47e('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xa47e('0x4')](_0xa47e('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a88a58c..118e14e 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 _0x73d6=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x509081,_0x144a1c){var _0x516423=function(_0x31b98e){while(--_0x31b98e){_0x509081['push'](_0x509081['shift']());}};_0x516423(++_0x144a1c);}(_0x73d6,0x1aa));var _0x673d=function(_0x1d8fa1,_0x18d00f){_0x1d8fa1=_0x1d8fa1-0x0;var _0x528467=_0x73d6[_0x1d8fa1];return _0x528467;};'use strict';var emlformat=require(_0x673d('0x0'));var rimraf=require(_0x673d('0x1'));var zipdir=require(_0x673d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x673d('0x3'));var moment=require(_0x673d('0x4'));var BPromise=require(_0x673d('0x5'));var Mustache=require(_0x673d('0x6'));var util=require(_0x673d('0x7'));var path=require(_0x673d('0x8'));var sox=require(_0x673d('0x9'));var csv=require(_0x673d('0xa'));var ejs=require(_0x673d('0xb'));var fs=require('fs');var fs_extra=require(_0x673d('0xc'));var _=require(_0x673d('0xd'));var squel=require(_0x673d('0xe'));var crypto=require(_0x673d('0xf'));var jsforce=require(_0x673d('0x10'));var deskjs=require(_0x673d('0x11'));var toCsv=require(_0x673d('0xa'));var querystring=require('querystring');var Papa=require(_0x673d('0x12'));var Redis=require(_0x673d('0x13'));var authService=require(_0x673d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x673d('0x15'));var hardwareService=require(_0x673d('0x16'));var logger=require('../../config/logger')(_0x673d('0x17'));var utils=require(_0x673d('0x18'));var config=require(_0x673d('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17ee48,_0x48d891){_0x48d891=_0x48d891||0xcc;return function(_0x45dd7b){if(_0x45dd7b){return _0x17ee48[_0x673d('0x1a')](_0x48d891);}return _0x17ee48[_0x673d('0x1b')](_0x48d891)[_0x673d('0x1c')]();};}function respondWithResult(_0x2ce333,_0x3d2cbf){_0x3d2cbf=_0x3d2cbf||0xc8;return function(_0x1cd596){if(_0x1cd596){return _0x2ce333[_0x673d('0x1b')](_0x3d2cbf)['json'](_0x1cd596);}};}function respondWithFilteredResult(_0x50e860,_0x93f5cc){return function(_0x2d7811){if(_0x2d7811){var _0x5d50c6=typeof _0x93f5cc['offset']===_0x673d('0x1d')&&typeof _0x93f5cc[_0x673d('0x1e')]==='undefined';var _0x4bc7e1=_0x2d7811[_0x673d('0x1f')];var _0x8e48a0=_0x5d50c6?0x0:_0x93f5cc[_0x673d('0x20')];var _0x1834fc=_0x5d50c6?_0x2d7811[_0x673d('0x1f')]:_0x93f5cc[_0x673d('0x20')]+_0x93f5cc[_0x673d('0x1e')];var _0x565bcc;if(_0x1834fc>=_0x4bc7e1){_0x1834fc=_0x4bc7e1;_0x565bcc=0xc8;}else{_0x565bcc=0xce;}_0x50e860[_0x673d('0x1b')](_0x565bcc);return _0x50e860[_0x673d('0x21')](_0x673d('0x22'),_0x8e48a0+'-'+_0x1834fc+'/'+_0x4bc7e1)[_0x673d('0x23')](_0x2d7811);}return null;};}function patchUpdates(_0x13d098){return function(_0x149cbd){try{jsonpatch[_0x673d('0x24')](_0x149cbd,_0x13d098,!![]);}catch(_0x8e9ab2){return BPromise[_0x673d('0x25')](_0x8e9ab2);}return _0x149cbd['save']();};}function saveUpdates(_0x824cb9,_0x58c39a){return function(_0x329263){if(_0x329263){return _0x329263[_0x673d('0x26')](_0x824cb9)[_0x673d('0x27')](function(_0x51582f){return _0x51582f;});}return null;};}function removeEntity(_0x89fbf8,_0x5e1cff){return function(_0x2d48c0){if(_0x2d48c0){return _0x2d48c0['destroy']()['then'](function(){_0x89fbf8['status'](0xcc)[_0x673d('0x1c')]();});}};}function handleEntityNotFound(_0x4934da,_0x3d617d){return function(_0x49be15){if(!_0x49be15){_0x4934da['sendStatus'](0x194);}return _0x49be15;};}function handleError(_0x2463d8,_0x5e4e2c){_0x5e4e2c=_0x5e4e2c||0x1f4;return function(_0x1db0ea){logger['error'](_0x1db0ea[_0x673d('0x28')]);if(_0x1db0ea['name']){delete _0x1db0ea[_0x673d('0x29')];}_0x2463d8['status'](_0x5e4e2c)[_0x673d('0x2a')](_0x1db0ea);};}exports[_0x673d('0x2b')]=function(_0x2a215c,_0x1e30e8){var _0x1ee9b3={},_0x41dbcc={},_0x39f5e2={'count':0x0,'rows':[]};var _0xcfcd4d=_[_0x673d('0x2c')](db[_0x673d('0x2d')][_0x673d('0x2e')],function(_0x31aea7){return{'name':_0x31aea7[_0x673d('0x2f')],'type':_0x31aea7[_0x673d('0x30')][_0x673d('0x31')]};});_0x41dbcc['model']=_[_0x673d('0x2c')](_0xcfcd4d,_0x673d('0x29'));_0x41dbcc['query']=_[_0x673d('0x32')](_0x2a215c[_0x673d('0x33')]);_0x41dbcc[_0x673d('0x34')]=_[_0x673d('0x35')](_0x41dbcc[_0x673d('0x36')],_0x41dbcc[_0x673d('0x33')]);_0x1ee9b3[_0x673d('0x37')]=_[_0x673d('0x35')](_0x41dbcc['model'],qs['fields'](_0x2a215c[_0x673d('0x33')][_0x673d('0x38')]));_0x1ee9b3['attributes']=_0x1ee9b3[_0x673d('0x37')]['length']?_0x1ee9b3[_0x673d('0x37')]:_0x41dbcc[_0x673d('0x36')];if(!_0x2a215c[_0x673d('0x33')]['hasOwnProperty'](_0x673d('0x39'))){_0x1ee9b3['limit']=qs[_0x673d('0x1e')](_0x2a215c[_0x673d('0x33')][_0x673d('0x1e')]);_0x1ee9b3['offset']=qs[_0x673d('0x20')](_0x2a215c[_0x673d('0x33')]['offset']);}_0x1ee9b3[_0x673d('0x3a')]=qs[_0x673d('0x3b')](_0x2a215c[_0x673d('0x33')][_0x673d('0x3b')]);_0x1ee9b3[_0x673d('0x3c')]=qs[_0x673d('0x34')](_['pick'](_0x2a215c[_0x673d('0x33')],_0x41dbcc['filters']),_0xcfcd4d);if(_0x2a215c['query'][_0x673d('0x3d')]){_0x1ee9b3['where']=_[_0x673d('0x3e')](_0x1ee9b3['where'],{'$or':_[_0x673d('0x2c')](_0xcfcd4d,function(_0x336777){if(_0x336777['type']!=='VIRTUAL'){var _0x4543c3={};_0x4543c3[_0x336777['name']]={'$like':'%'+_0x2a215c[_0x673d('0x33')][_0x673d('0x3d')]+'%'};return _0x4543c3;}})});}_0x1ee9b3=_[_0x673d('0x3e')]({},_0x1ee9b3,_0x2a215c[_0x673d('0x3f')]);var _0x40461f={'where':_0x1ee9b3[_0x673d('0x3c')]};return db['VoiceQueuesLog'][_0x673d('0x1f')](_0x40461f)[_0x673d('0x27')](function(_0x5cc970){_0x39f5e2[_0x673d('0x1f')]=_0x5cc970;if(_0x2a215c['query'][_0x673d('0x40')]){_0x1ee9b3[_0x673d('0x41')]=[{'all':!![]}];}return db[_0x673d('0x2d')]['findAll'](_0x1ee9b3);})[_0x673d('0x27')](function(_0x3ea3ce){_0x39f5e2[_0x673d('0x42')]=_0x3ea3ce;return _0x39f5e2;})['then'](respondWithFilteredResult(_0x1e30e8,_0x1ee9b3))[_0x673d('0x43')](handleError(_0x1e30e8,null));};exports['show']=function(_0xc1781c,_0xc88e72){var _0x305d72={'raw':!![],'where':{'id':_0xc1781c[_0x673d('0x44')]['id']}},_0x105f3b={};_0x105f3b['model']=_[_0x673d('0x32')](db['VoiceQueuesLog']['rawAttributes']);_0x105f3b[_0x673d('0x33')]=_[_0x673d('0x32')](_0xc1781c[_0x673d('0x33')]);_0x105f3b[_0x673d('0x34')]=_[_0x673d('0x35')](_0x105f3b[_0x673d('0x36')],_0x105f3b['query']);_0x305d72['attributes']=_['intersection'](_0x105f3b['model'],qs[_0x673d('0x38')](_0xc1781c[_0x673d('0x33')]['fields']));_0x305d72[_0x673d('0x37')]=_0x305d72[_0x673d('0x37')][_0x673d('0x45')]?_0x305d72[_0x673d('0x37')]:_0x105f3b[_0x673d('0x36')];if(_0xc1781c[_0x673d('0x33')]['includeAll']){_0x305d72['include']=[{'all':!![]}];}_0x305d72=_[_0x673d('0x3e')]({},_0x305d72,_0xc1781c[_0x673d('0x3f')]);return db['VoiceQueuesLog'][_0x673d('0x46')](_0x305d72)[_0x673d('0x27')](handleEntityNotFound(_0xc88e72,null))['then'](respondWithResult(_0xc88e72,null))[_0x673d('0x43')](handleError(_0xc88e72,null));};exports[_0x673d('0x47')]=function(_0x4e7fd9,_0x1c64b2){return db['VoiceQueuesLog'][_0x673d('0x47')](_0x4e7fd9[_0x673d('0x48')],{})[_0x673d('0x27')](respondWithResult(_0x1c64b2,0xc9))['catch'](handleError(_0x1c64b2,null));};exports['update']=function(_0x832504,_0x4aed49){if(_0x832504[_0x673d('0x48')]['id']){delete _0x832504[_0x673d('0x48')]['id'];}return db['VoiceQueuesLog'][_0x673d('0x46')]({'where':{'id':_0x832504[_0x673d('0x44')]['id']}})[_0x673d('0x27')](handleEntityNotFound(_0x4aed49,null))[_0x673d('0x27')](saveUpdates(_0x832504[_0x673d('0x48')],null))[_0x673d('0x27')](respondWithResult(_0x4aed49,null))[_0x673d('0x43')](handleError(_0x4aed49,null));};exports[_0x673d('0x49')]=function(_0x19dec1,_0x131fe4){return db[_0x673d('0x2d')]['find']({'where':{'id':_0x19dec1['params']['id']}})[_0x673d('0x27')](handleEntityNotFound(_0x131fe4,null))[_0x673d('0x27')](removeEntity(_0x131fe4,null))[_0x673d('0x43')](handleError(_0x131fe4,null));}; \ No newline at end of file +var _0x80f3=['then','error','name','send','index','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','include','VoiceQueuesLog','rows','catch','keys','includeAll','options','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save'];(function(_0x22cf20,_0x2811b5){var _0x2909b1=function(_0x367b24){while(--_0x367b24){_0x22cf20['push'](_0x22cf20['shift']());}};_0x2909b1(++_0x2811b5);}(_0x80f3,0x1cd));var _0x380f=function(_0x1f6691,_0x3a3d46){_0x1f6691=_0x1f6691-0x0;var _0xf786b6=_0x80f3[_0x1f6691];return _0xf786b6;};'use strict';var emlformat=require(_0x380f('0x0'));var rimraf=require(_0x380f('0x1'));var zipdir=require(_0x380f('0x2'));var jsonpatch=require(_0x380f('0x3'));var rp=require(_0x380f('0x4'));var moment=require(_0x380f('0x5'));var BPromise=require(_0x380f('0x6'));var Mustache=require(_0x380f('0x7'));var util=require(_0x380f('0x8'));var path=require('path');var sox=require(_0x380f('0x9'));var csv=require(_0x380f('0xa'));var ejs=require(_0x380f('0xb'));var fs=require('fs');var fs_extra=require(_0x380f('0xc'));var _=require(_0x380f('0xd'));var squel=require(_0x380f('0xe'));var crypto=require(_0x380f('0xf'));var jsforce=require(_0x380f('0x10'));var deskjs=require(_0x380f('0x11'));var toCsv=require(_0x380f('0xa'));var querystring=require(_0x380f('0x12'));var Papa=require(_0x380f('0x13'));var Redis=require(_0x380f('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x380f('0x15'));var logger=require('../../config/logger')(_0x380f('0x16'));var utils=require('../../config/utils');var config=require(_0x380f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x380f('0x18'))['db'];function respondWithStatusCode(_0x1a8d81,_0x42c990){_0x42c990=_0x42c990||0xcc;return function(_0x4994ce){if(_0x4994ce){return _0x1a8d81[_0x380f('0x19')](_0x42c990);}return _0x1a8d81[_0x380f('0x1a')](_0x42c990)[_0x380f('0x1b')]();};}function respondWithResult(_0x45aa62,_0x100120){_0x100120=_0x100120||0xc8;return function(_0x29ae62){if(_0x29ae62){return _0x45aa62[_0x380f('0x1a')](_0x100120)[_0x380f('0x1c')](_0x29ae62);}};}function respondWithFilteredResult(_0x14e849,_0x5e6caf){return function(_0x5ae05e){if(_0x5ae05e){var _0x5ae522=typeof _0x5e6caf[_0x380f('0x1d')]===_0x380f('0x1e')&&typeof _0x5e6caf[_0x380f('0x1f')]===_0x380f('0x1e');var _0x569619=_0x5ae05e[_0x380f('0x20')];var _0x3ba46f=_0x5ae522?0x0:_0x5e6caf[_0x380f('0x1d')];var _0x13b0ac=_0x5ae522?_0x5ae05e['count']:_0x5e6caf[_0x380f('0x1d')]+_0x5e6caf[_0x380f('0x1f')];var _0x516ade;if(_0x13b0ac>=_0x569619){_0x13b0ac=_0x569619;_0x516ade=0xc8;}else{_0x516ade=0xce;}_0x14e849[_0x380f('0x1a')](_0x516ade);return _0x14e849[_0x380f('0x21')](_0x380f('0x22'),_0x3ba46f+'-'+_0x13b0ac+'/'+_0x569619)[_0x380f('0x1c')](_0x5ae05e);}return null;};}function patchUpdates(_0x4a989b){return function(_0x52be9d){try{jsonpatch['apply'](_0x52be9d,_0x4a989b,!![]);}catch(_0x34f749){return BPromise['reject'](_0x34f749);}return _0x52be9d[_0x380f('0x23')]();};}function saveUpdates(_0x345524,_0x552190){return function(_0x52d82b){if(_0x52d82b){return _0x52d82b['update'](_0x345524)['then'](function(_0x2abb7f){return _0x2abb7f;});}return null;};}function removeEntity(_0x170055,_0x5ec35a){return function(_0x4ccc39){if(_0x4ccc39){return _0x4ccc39['destroy']()[_0x380f('0x24')](function(){_0x170055[_0x380f('0x1a')](0xcc)[_0x380f('0x1b')]();});}};}function handleEntityNotFound(_0x5352f7,_0x43e10e){return function(_0x49b61b){if(!_0x49b61b){_0x5352f7['sendStatus'](0x194);}return _0x49b61b;};}function handleError(_0x35443b,_0x24a084){_0x24a084=_0x24a084||0x1f4;return function(_0x47bab2){logger[_0x380f('0x25')](_0x47bab2['stack']);if(_0x47bab2[_0x380f('0x26')]){delete _0x47bab2[_0x380f('0x26')];}_0x35443b['status'](_0x24a084)[_0x380f('0x27')](_0x47bab2);};}exports[_0x380f('0x28')]=function(_0x31f025,_0x3ba8aa){var _0x1c5800={},_0x62c4e3={},_0x22e212={'count':0x0,'rows':[]};var _0x5b1e0e=_[_0x380f('0x29')](db['VoiceQueuesLog'][_0x380f('0x2a')],function(_0x432c8c){return{'name':_0x432c8c['fieldName'],'type':_0x432c8c[_0x380f('0x2b')]['key']};});_0x62c4e3[_0x380f('0x2c')]=_[_0x380f('0x29')](_0x5b1e0e,'name');_0x62c4e3[_0x380f('0x2d')]=_['keys'](_0x31f025[_0x380f('0x2d')]);_0x62c4e3[_0x380f('0x2e')]=_[_0x380f('0x2f')](_0x62c4e3[_0x380f('0x2c')],_0x62c4e3[_0x380f('0x2d')]);_0x1c5800['attributes']=_['intersection'](_0x62c4e3[_0x380f('0x2c')],qs[_0x380f('0x30')](_0x31f025[_0x380f('0x2d')][_0x380f('0x30')]));_0x1c5800[_0x380f('0x31')]=_0x1c5800[_0x380f('0x31')][_0x380f('0x32')]?_0x1c5800[_0x380f('0x31')]:_0x62c4e3[_0x380f('0x2c')];if(!_0x31f025[_0x380f('0x2d')][_0x380f('0x33')]('nolimit')){_0x1c5800[_0x380f('0x1f')]=qs[_0x380f('0x1f')](_0x31f025[_0x380f('0x2d')][_0x380f('0x1f')]);_0x1c5800['offset']=qs[_0x380f('0x1d')](_0x31f025[_0x380f('0x2d')][_0x380f('0x1d')]);}_0x1c5800[_0x380f('0x34')]=qs['sort'](_0x31f025[_0x380f('0x2d')][_0x380f('0x35')]);_0x1c5800[_0x380f('0x36')]=qs['filters'](_['pick'](_0x31f025['query'],_0x62c4e3[_0x380f('0x2e')]),_0x5b1e0e);if(_0x31f025[_0x380f('0x2d')][_0x380f('0x37')]){_0x1c5800[_0x380f('0x36')]=_[_0x380f('0x38')](_0x1c5800['where'],{'$or':_[_0x380f('0x29')](_0x5b1e0e,function(_0xc5b094){if(_0xc5b094[_0x380f('0x2b')]!==_0x380f('0x39')){var _0xe5e013={};_0xe5e013[_0xc5b094[_0x380f('0x26')]]={'$like':'%'+_0x31f025[_0x380f('0x2d')][_0x380f('0x37')]+'%'};return _0xe5e013;}})});}_0x1c5800=_[_0x380f('0x38')]({},_0x1c5800,_0x31f025['options']);var _0x46b77c={'where':_0x1c5800['where']};return db['VoiceQueuesLog'][_0x380f('0x20')](_0x46b77c)['then'](function(_0x3c1984){_0x22e212['count']=_0x3c1984;if(_0x31f025['query']['includeAll']){_0x1c5800[_0x380f('0x3a')]=[{'all':!![]}];}return db[_0x380f('0x3b')]['findAll'](_0x1c5800);})['then'](function(_0x54773a){_0x22e212[_0x380f('0x3c')]=_0x54773a;return _0x22e212;})[_0x380f('0x24')](respondWithFilteredResult(_0x3ba8aa,_0x1c5800))[_0x380f('0x3d')](handleError(_0x3ba8aa,null));};exports['show']=function(_0x2a2ebb,_0x762fa8){var _0xf3b9d3={'raw':!![],'where':{'id':_0x2a2ebb['params']['id']}},_0x1950ff={};_0x1950ff[_0x380f('0x2c')]=_[_0x380f('0x3e')](db['VoiceQueuesLog'][_0x380f('0x2a')]);_0x1950ff['query']=_[_0x380f('0x3e')](_0x2a2ebb[_0x380f('0x2d')]);_0x1950ff[_0x380f('0x2e')]=_[_0x380f('0x2f')](_0x1950ff[_0x380f('0x2c')],_0x1950ff[_0x380f('0x2d')]);_0xf3b9d3[_0x380f('0x31')]=_['intersection'](_0x1950ff[_0x380f('0x2c')],qs[_0x380f('0x30')](_0x2a2ebb[_0x380f('0x2d')][_0x380f('0x30')]));_0xf3b9d3[_0x380f('0x31')]=_0xf3b9d3[_0x380f('0x31')][_0x380f('0x32')]?_0xf3b9d3[_0x380f('0x31')]:_0x1950ff[_0x380f('0x2c')];if(_0x2a2ebb[_0x380f('0x2d')][_0x380f('0x3f')]){_0xf3b9d3[_0x380f('0x3a')]=[{'all':!![]}];}_0xf3b9d3=_[_0x380f('0x38')]({},_0xf3b9d3,_0x2a2ebb[_0x380f('0x40')]);return db[_0x380f('0x3b')][_0x380f('0x41')](_0xf3b9d3)[_0x380f('0x24')](handleEntityNotFound(_0x762fa8,null))[_0x380f('0x24')](respondWithResult(_0x762fa8,null))[_0x380f('0x3d')](handleError(_0x762fa8,null));};exports['create']=function(_0x4f0a0a,_0x9a2d62){return db['VoiceQueuesLog'][_0x380f('0x42')](_0x4f0a0a[_0x380f('0x43')],{})['then'](respondWithResult(_0x9a2d62,0xc9))['catch'](handleError(_0x9a2d62,null));};exports[_0x380f('0x44')]=function(_0x5af433,_0x374194){if(_0x5af433['body']['id']){delete _0x5af433[_0x380f('0x43')]['id'];}return db['VoiceQueuesLog'][_0x380f('0x41')]({'where':{'id':_0x5af433[_0x380f('0x45')]['id']}})['then'](handleEntityNotFound(_0x374194,null))[_0x380f('0x24')](saveUpdates(_0x5af433['body'],null))[_0x380f('0x24')](respondWithResult(_0x374194,null))[_0x380f('0x3d')](handleError(_0x374194,null));};exports[_0x380f('0x46')]=function(_0x3a0e80,_0x1b00a7){return db['VoiceQueuesLog'][_0x380f('0x41')]({'where':{'id':_0x3a0e80['params']['id']}})[_0x380f('0x24')](handleEntityNotFound(_0x1b00a7,null))[_0x380f('0x24')](removeEntity(_0x1b00a7,null))[_0x380f('0x3d')](handleError(_0x1b00a7,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d3d323e..49827a6 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 _0x44b4=['path','rimraf','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x7c9a91,_0x206c39){var _0x1c0e61=function(_0xd9dfac){while(--_0xd9dfac){_0x7c9a91['push'](_0x7c9a91['shift']());}};_0x1c0e61(++_0x206c39);}(_0x44b4,0x143));var _0x444b=function(_0x532db6,_0x1ec16b){_0x532db6=_0x532db6-0x0;var _0x5a0b8b=_0x44b4[_0x532db6];return _0x5a0b8b;};'use strict';var _=require(_0x444b('0x0'));var util=require(_0x444b('0x1'));var logger=require(_0x444b('0x2'))(_0x444b('0x3'));var moment=require(_0x444b('0x4'));var BPromise=require(_0x444b('0x5'));var rp=require(_0x444b('0x6'));var fs=require('fs');var path=require(_0x444b('0x7'));var rimraf=require(_0x444b('0x8'));var config=require('../../config/environment');var attributes=require('./voiceQueuesLog.attributes');module[_0x444b('0x9')]=function(_0x1bd97f,_0x1b064e){return _0x1bd97f[_0x444b('0xa')](_0x444b('0xb'),attributes,{'tableName':_0x444b('0xc'),'paranoid':![],'indexes':[{'name':_0x444b('0xd'),'fields':[_0x444b('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x68c0=['define','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','api','moment','bluebird','request-promise','path','./voiceQueuesLog.attributes','exports'];(function(_0x3425f9,_0x2358ca){var _0x814f39=function(_0x4cb267){while(--_0x4cb267){_0x3425f9['push'](_0x3425f9['shift']());}};_0x814f39(++_0x2358ca);}(_0x68c0,0x1c5));var _0x068c=function(_0x10b304,_0x3f188e){_0x10b304=_0x10b304-0x0;var _0x10fb78=_0x68c0[_0x10b304];return _0x10fb78;};'use strict';var _=require(_0x068c('0x0'));var util=require(_0x068c('0x1'));var logger=require('../../config/logger')(_0x068c('0x2'));var moment=require(_0x068c('0x3'));var BPromise=require(_0x068c('0x4'));var rp=require(_0x068c('0x5'));var fs=require('fs');var path=require(_0x068c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x068c('0x7'));module[_0x068c('0x8')]=function(_0x18e855,_0x1681b8){return _0x18e855[_0x068c('0x9')](_0x068c('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x068c('0xb'),'fields':[_0x068c('0xc'),_0x068c('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 04329f5..42fca23 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 _0x0b40=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info'];(function(_0x524b44,_0x50fcac){var _0x2edf85=function(_0x574892){while(--_0x574892){_0x524b44['push'](_0x524b44['shift']());}};_0x2edf85(++_0x50fcac);}(_0x0b40,0xba));var _0x00b4=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x0b40[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0x00b4('0x0'));var moment=require(_0x00b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x00b4('0x2'));var fs=require('fs');var Redis=require(_0x00b4('0x3'));var db=require(_0x00b4('0x4'))['db'];var utils=require(_0x00b4('0x5'));var logger=require(_0x00b4('0x6'))(_0x00b4('0x7'));var config=require('../../config/environment');var jayson=require(_0x00b4('0x8'));var client=jayson[_0x00b4('0x9')][_0x00b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x120157,_0x5684ec,_0x445536){return new BPromise(function(_0x20c810,_0x3f6285){return client['request'](_0x120157,_0x445536)[_0x00b4('0xb')](function(_0x144611){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x5684ec,_0x00b4('0xc'));logger[_0x00b4('0xd')](_0x00b4('0xe'),_0x5684ec,_0x00b4('0xc'),JSON[_0x00b4('0xf')](_0x144611));if(_0x144611[_0x00b4('0x10')]){if(_0x144611[_0x00b4('0x10')][_0x00b4('0x11')]===0x1f4){logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x144611[_0x00b4('0x10')][_0x00b4('0x13')]);return _0x3f6285(_0x144611['error']['message']);}logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x144611[_0x00b4('0x10')][_0x00b4('0x13')]);return _0x20c810(_0x144611['error'][_0x00b4('0x13')]);}else{logger[_0x00b4('0x14')](_0x00b4('0x12'),_0x5684ec,_0x00b4('0xc'));_0x20c810(_0x144611[_0x00b4('0x15')][_0x00b4('0x13')]);}})[_0x00b4('0x16')](function(_0x56e54c){logger[_0x00b4('0x10')](_0x00b4('0x12'),_0x5684ec,_0x56e54c);_0x3f6285(_0x56e54c);});});} \ No newline at end of file +var _0xd517=['../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x29415e,_0x4793d4){var _0x4158c2=function(_0x59a9fe){while(--_0x59a9fe){_0x29415e['push'](_0x29415e['shift']());}};_0x4158c2(++_0x4793d4);}(_0xd517,0x1dd));var _0x7d51=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0xd517[_0x35181c];return _0xe14bf9;};'use strict';var _=require(_0x7d51('0x0'));var util=require(_0x7d51('0x1'));var moment=require(_0x7d51('0x2'));var BPromise=require(_0x7d51('0x3'));var rs=require(_0x7d51('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d51('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d51('0x6'));var config=require(_0x7d51('0x7'));var jayson=require(_0x7d51('0x8'));var client=jayson[_0x7d51('0x9')][_0x7d51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6f4a46,_0x2c50de,_0x23bcf1){return new BPromise(function(_0x474aca,_0x55d39b){return client['request'](_0x6f4a46,_0x23bcf1)[_0x7d51('0xb')](function(_0x446261){logger[_0x7d51('0xc')](_0x7d51('0xd'),_0x2c50de,'request\x20sent');logger['debug'](_0x7d51('0xe'),_0x2c50de,_0x7d51('0xf'),JSON[_0x7d51('0x10')](_0x446261));if(_0x446261['error']){if(_0x446261[_0x7d51('0x11')][_0x7d51('0x12')]===0x1f4){logger['error'](_0x7d51('0xd'),_0x2c50de,_0x446261['error'][_0x7d51('0x13')]);return _0x55d39b(_0x446261[_0x7d51('0x11')]['message']);}logger['error'](_0x7d51('0xd'),_0x2c50de,_0x446261[_0x7d51('0x11')][_0x7d51('0x13')]);return _0x474aca(_0x446261['error']['message']);}else{logger[_0x7d51('0xc')](_0x7d51('0xd'),_0x2c50de,_0x7d51('0xf'));_0x474aca(_0x446261[_0x7d51('0x14')]['message']);}})[_0x7d51('0x15')](function(_0x1116be){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x2c50de,_0x1116be);_0x55d39b(_0x1116be);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index a985775..4fec3bd 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 _0x149e=['exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','download','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','delete','destroy'];(function(_0x2b22a2,_0x55e449){var _0x2e8440=function(_0x14a068){while(--_0x14a068){_0x2b22a2['push'](_0x2b22a2['shift']());}};_0x2e8440(++_0x55e449);}(_0x149e,0x1cd));var _0xe149=function(_0x30056e,_0x5362da){_0x30056e=_0x30056e-0x0;var _0x2d0556=_0x149e[_0x30056e];return _0x2d0556;};'use strict';var multer=require('multer');var util=require(_0xe149('0x0'));var path=require(_0xe149('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe149('0x2')]();var fs_extra=require(_0xe149('0x3'));var auth=require(_0xe149('0x4'));var interaction=require(_0xe149('0x5'));var config=require(_0xe149('0x6'));var controller=require('./voiceRecording.controller');router[_0xe149('0x7')]('/',auth[_0xe149('0x8')](),controller[_0xe149('0x9')]);router[_0xe149('0x7')](_0xe149('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xe149('0x7')](_0xe149('0xb'),auth['isAuthenticated'](),controller[_0xe149('0xc')]);router[_0xe149('0x7')]('/:id/download',auth[_0xe149('0x8')](),controller[_0xe149('0xd')]);router['get']('/:id/downloads',controller[_0xe149('0xe')]);router['get'](_0xe149('0xf'),auth[_0xe149('0x8')](),controller[_0xe149('0x10')]);router[_0xe149('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe149('0x11')](_0xe149('0xf'),auth['isAuthenticated'](),controller[_0xe149('0x12')]);router['put'](_0xe149('0xb'),auth[_0xe149('0x8')](),controller[_0xe149('0x13')]);router[_0xe149('0x14')](_0xe149('0xb'),auth[_0xe149('0x8')](),controller[_0xe149('0x15')]);module[_0xe149('0x16')]=router; \ No newline at end of file +var _0xe7c1=['describe','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','exports','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','/describe'];(function(_0x2594dc,_0x33b3d0){var _0x4c4506=function(_0x1856a4){while(--_0x1856a4){_0x2594dc['push'](_0x2594dc['shift']());}};_0x4c4506(++_0x33b3d0);}(_0xe7c1,0xc6));var _0x1e7c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe7c1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1e7c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e7c('0x1')]();var fs_extra=require(_0x1e7c('0x2'));var auth=require(_0x1e7c('0x3'));var interaction=require(_0x1e7c('0x4'));var config=require('../../config/environment');var controller=require(_0x1e7c('0x5'));router[_0x1e7c('0x6')]('/',auth[_0x1e7c('0x7')](),controller['index']);router[_0x1e7c('0x6')](_0x1e7c('0x8'),auth[_0x1e7c('0x7')](),controller[_0x1e7c('0x9')]);router[_0x1e7c('0x6')]('/:id',auth[_0x1e7c('0x7')](),controller[_0x1e7c('0xa')]);router[_0x1e7c('0x6')]('/:id/download',auth[_0x1e7c('0x7')](),controller[_0x1e7c('0xb')]);router[_0x1e7c('0x6')](_0x1e7c('0xc'),controller[_0x1e7c('0xd')]);router[_0x1e7c('0x6')](_0x1e7c('0xe'),auth[_0x1e7c('0x7')](),controller[_0x1e7c('0xf')]);router[_0x1e7c('0x10')]('/',auth['isAuthenticated'](),controller[_0x1e7c('0x11')]);router[_0x1e7c('0x10')](_0x1e7c('0xe'),auth[_0x1e7c('0x7')](),controller[_0x1e7c('0x12')]);router[_0x1e7c('0x13')](_0x1e7c('0x14'),auth['isAuthenticated'](),controller[_0x1e7c('0x15')]);router['delete'](_0x1e7c('0x14'),auth[_0x1e7c('0x7')](),controller['destroy']);module[_0x1e7c('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 7cc7d70..c208431 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(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 184a279..71a5cb9 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 _0x0703=['File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','uuid/v4','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','json','count','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','format','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','keys','include','create','body','find','describe','uniqueid','params','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','token','$and','push','destroy','isNil','Entity\x20not\x20found','info'];(function(_0x383005,_0x308d94){var _0x53b88e=function(_0x411128){while(--_0x411128){_0x383005['push'](_0x383005['shift']());}};_0x53b88e(++_0x308d94);}(_0x0703,0xcb));var _0x3070=function(_0x3ca829,_0xc55f17){_0x3ca829=_0x3ca829-0x0;var _0x3b416b=_0x0703[_0x3ca829];return _0x3b416b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3070('0x0'));var zipdir=require(_0x3070('0x1'));var jsonpatch=require(_0x3070('0x2'));var rp=require(_0x3070('0x3'));var moment=require(_0x3070('0x4'));var BPromise=require(_0x3070('0x5'));var Mustache=require(_0x3070('0x6'));var util=require('util');var path=require(_0x3070('0x7'));var sox=require('sox');var csv=require(_0x3070('0x8'));var ejs=require(_0x3070('0x9'));var fs=require('fs');var fs_extra=require(_0x3070('0xa'));var _=require(_0x3070('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3070('0xc'));var toCsv=require(_0x3070('0x8'));var querystring=require(_0x3070('0xd'));var Papa=require(_0x3070('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0x3070('0xf'));var Redis=require(_0x3070('0x10'));var authService=require(_0x3070('0x11'));var qs=require(_0x3070('0x12'));var as=require(_0x3070('0x13'));var hardwareService=require(_0x3070('0x14'));var logger=require(_0x3070('0x15'))('api');var utils=require(_0x3070('0x16'));var config=require(_0x3070('0x17'));var licenseUtil=require(_0x3070('0x18'));var db=require(_0x3070('0x19'))['db'];function respondWithStatusCode(_0x55f949,_0x467b0b){_0x467b0b=_0x467b0b||0xcc;return function(_0x112b6c){if(_0x112b6c){return _0x55f949[_0x3070('0x1a')](_0x467b0b);}return _0x55f949['status'](_0x467b0b)['end']();};}function respondWithResult(_0x2c5d6c,_0x4ba763){_0x4ba763=_0x4ba763||0xc8;return function(_0x862cd5){if(_0x862cd5){return _0x2c5d6c[_0x3070('0x1b')](_0x4ba763)[_0x3070('0x1c')](_0x862cd5);}};}function respondWithFilteredResult(_0x22dd3a,_0x2c7c49){return function(_0x1132a1){if(_0x1132a1){var _0xbc0293=typeof _0x2c7c49['offset']==='undefined'&&typeof _0x2c7c49['limit']==='undefined';var _0x53fc17=_0x1132a1[_0x3070('0x1d')];var _0x21b19c=_0xbc0293?0x0:_0x2c7c49[_0x3070('0x1e')];var _0x3ef1b8=_0xbc0293?_0x1132a1[_0x3070('0x1d')]:_0x2c7c49[_0x3070('0x1e')]+_0x2c7c49[_0x3070('0x1f')];var _0x456bc6;if(_0x3ef1b8>=_0x53fc17){_0x3ef1b8=_0x53fc17;_0x456bc6=0xc8;}else{_0x456bc6=0xce;}_0x22dd3a['status'](_0x456bc6);return _0x22dd3a[_0x3070('0x20')](_0x3070('0x21'),_0x21b19c+'-'+_0x3ef1b8+'/'+_0x53fc17)[_0x3070('0x1c')](_0x1132a1);}return null;};}function patchUpdates(_0x448a3d){return function(_0x5d9cf3){try{jsonpatch['apply'](_0x5d9cf3,_0x448a3d,!![]);}catch(_0x475ecd){return BPromise[_0x3070('0x22')](_0x475ecd);}return _0x5d9cf3[_0x3070('0x23')]();};}function saveUpdates(_0x3f5270,_0x36d574){return function(_0x1ded31){if(_0x1ded31){return _0x1ded31[_0x3070('0x24')](_0x3f5270)[_0x3070('0x25')](function(_0x5842d0){return _0x5842d0;});}return null;};}function removeEntity(_0x433577,_0x535ab3){return function(_0x33d6b2){if(_0x33d6b2){return _0x33d6b2['destroy']()[_0x3070('0x25')](function(){_0x433577['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x163d0a,_0x3731be){return function(_0x2a1fd2){if(!_0x2a1fd2){_0x163d0a[_0x3070('0x1a')](0x194);}return _0x2a1fd2;};}function handleError(_0x5a863c,_0x3d6eb2){_0x3d6eb2=_0x3d6eb2||0x1f4;return function(_0x44d695){logger['error'](_0x44d695[_0x3070('0x26')]);if(_0x44d695[_0x3070('0x27')]){delete _0x44d695['name'];}_0x5a863c['status'](_0x3d6eb2)[_0x3070('0x28')](_0x44d695);};}exports[_0x3070('0x29')]=function(_0x14aec0,_0x179bfe){var _0x1877f3={},_0x1455e3={},_0x4d1caf={'count':0x0,'rows':[]};var _0x5636cc=_[_0x3070('0x2a')](db[_0x3070('0x2b')][_0x3070('0x2c')],function(_0x53bc8e){return{'name':_0x53bc8e[_0x3070('0x2d')],'type':_0x53bc8e[_0x3070('0x2e')][_0x3070('0x2f')]};});_0x1455e3['model']=_['differenceBy'](_[_0x3070('0x2a')](_0x5636cc,'name'),[_0x3070('0x30')]);_0x1455e3[_0x3070('0x31')]=_['keys'](_0x14aec0[_0x3070('0x31')]);_0x1455e3[_0x3070('0x32')]=_[_0x3070('0x33')](_0x1455e3[_0x3070('0x34')],_0x1455e3['query']);_0x1877f3[_0x3070('0x35')]=_[_0x3070('0x33')](_0x1455e3[_0x3070('0x34')],qs[_0x3070('0x36')](_0x14aec0[_0x3070('0x31')][_0x3070('0x36')]));_0x1877f3[_0x3070('0x35')]=_0x1877f3[_0x3070('0x35')][_0x3070('0x37')]?_0x1877f3[_0x3070('0x35')]:_0x1455e3['model'];if(!_0x14aec0[_0x3070('0x31')][_0x3070('0x38')](_0x3070('0x39'))){_0x1877f3[_0x3070('0x1f')]=qs[_0x3070('0x1f')](_0x14aec0[_0x3070('0x31')][_0x3070('0x1f')]);_0x1877f3[_0x3070('0x1e')]=qs['offset'](_0x14aec0[_0x3070('0x31')][_0x3070('0x1e')]);}_0x1877f3['order']=qs[_0x3070('0x3a')](_0x14aec0['query'][_0x3070('0x3a')]);_0x1877f3[_0x3070('0x3b')]=qs[_0x3070('0x32')](_['pick'](_0x14aec0[_0x3070('0x31')],_0x1455e3[_0x3070('0x32')]),_0x5636cc);if(_0x14aec0[_0x3070('0x31')][_0x3070('0x3c')]){_0x1877f3[_0x3070('0x3b')]=_[_0x3070('0x3d')](_0x1877f3[_0x3070('0x3b')],{'$or':_[_0x3070('0x2a')](_0x5636cc,function(_0x39a07f){if(_0x39a07f[_0x3070('0x2e')]!==_0x3070('0x3e')){var _0x4a675f={};_0x4a675f[_0x39a07f[_0x3070('0x27')]]={'$like':'%'+_0x14aec0['query'][_0x3070('0x3c')]+'%'};return _0x4a675f;}})});}_0x1877f3=_[_0x3070('0x3d')]({},_0x1877f3,_0x14aec0[_0x3070('0x3f')]);var _0x2a947f={'where':_0x1877f3[_0x3070('0x3b')]};return db[_0x3070('0x2b')][_0x3070('0x1d')](_0x2a947f)[_0x3070('0x25')](function(_0x1be995){_0x4d1caf[_0x3070('0x1d')]=_0x1be995;if(_0x14aec0[_0x3070('0x31')]['includeAll']){_0x1877f3['include']=[{'all':!![]}];}return db[_0x3070('0x2b')][_0x3070('0x40')](_0x1877f3);})[_0x3070('0x25')](function(_0x126ed5){_0x4d1caf[_0x3070('0x41')]=_0x126ed5;return _0x4d1caf;})[_0x3070('0x25')](respondWithFilteredResult(_0x179bfe,_0x1877f3))[_0x3070('0x42')](handleError(_0x179bfe,null));};exports[_0x3070('0x43')]=function(_0x103389,_0x35f2a6){var _0x19b0a8={'raw':![],'where':{'id':_0x103389['params']['id']}},_0x158b64={};_0x158b64[_0x3070('0x34')]=_[_0x3070('0x44')](db[_0x3070('0x2b')][_0x3070('0x2c')]);_0x158b64[_0x3070('0x31')]=_[_0x3070('0x44')](_0x103389[_0x3070('0x31')]);_0x158b64['filters']=_[_0x3070('0x33')](_0x158b64[_0x3070('0x34')],_0x158b64[_0x3070('0x31')]);_0x19b0a8['attributes']=_[_0x3070('0x33')](_0x158b64[_0x3070('0x34')],qs[_0x3070('0x36')](_0x103389[_0x3070('0x31')][_0x3070('0x36')]));_0x19b0a8['attributes']=_0x19b0a8['attributes'][_0x3070('0x37')]?_0x19b0a8[_0x3070('0x35')]:_0x158b64[_0x3070('0x34')];if(_0x103389[_0x3070('0x31')]['includeAll']){_0x19b0a8[_0x3070('0x45')]=[{'all':!![]}];}_0x19b0a8=_[_0x3070('0x3d')]({},_0x19b0a8,_0x103389[_0x3070('0x3f')]);return db[_0x3070('0x2b')]['find'](_0x19b0a8)[_0x3070('0x25')](handleEntityNotFound(_0x35f2a6,null))[_0x3070('0x25')](respondWithResult(_0x35f2a6,null))[_0x3070('0x42')](handleError(_0x35f2a6,null));};exports[_0x3070('0x46')]=function(_0x427518,_0x5b08d2){return db[_0x3070('0x2b')][_0x3070('0x46')](_0x427518[_0x3070('0x47')],{})[_0x3070('0x25')](respondWithResult(_0x5b08d2,0xc9))[_0x3070('0x42')](handleError(_0x5b08d2,null));};exports[_0x3070('0x24')]=function(_0x11b663,_0x438056){if(_0x11b663[_0x3070('0x47')]['id']){delete _0x11b663[_0x3070('0x47')]['id'];}return db[_0x3070('0x2b')][_0x3070('0x48')]({'where':{'id':_0x11b663['params']['id']}})[_0x3070('0x25')](handleEntityNotFound(_0x438056,null))[_0x3070('0x25')](saveUpdates(_0x11b663[_0x3070('0x47')],null))[_0x3070('0x25')](respondWithResult(_0x438056,null))[_0x3070('0x42')](handleError(_0x438056,null));};exports[_0x3070('0x49')]=function(_0x12c65d,_0x4a516b){return db[_0x3070('0x2b')][_0x3070('0x49')]()[_0x3070('0x25')](respondWithResult(_0x4a516b,null))[_0x3070('0x42')](handleError(_0x4a516b,null));};exports['download']=function(_0x2b9e3b,_0x49c5b6,_0xbf541d){var _0x37308e=require('../../components/encryptor');var _0x41743c=![];var _0x41736f={};if(_0x2b9e3b[_0x3070('0x31')][_0x3070('0x2e')]&&_0x2b9e3b[_0x3070('0x31')]['type']===_0x3070('0x4a')){_0x41736f[_0x3070('0x4a')]=_0x2b9e3b[_0x3070('0x4b')]['id'];}else{_0x41736f['id']=_0x2b9e3b['params']['id'];}return db[_0x3070('0x2b')][_0x3070('0x48')]({'where':_0x41736f,'attributes':['id',_0x3070('0x4c')],'raw':!![]})[_0x3070('0x25')](handleEntityNotFound(_0x49c5b6,null))[_0x3070('0x25')](function(_0x3bb7b6){if(_0x3bb7b6){var _0x418b6f=_0x3bb7b6[_0x3070('0x4c')];var _0x52f857=util['format'](_0x3070('0x4d'),_0x418b6f);if(fs['existsSync'](_0x52f857)){_0x41743c=!![];return _0x37308e[_0x3070('0x4e')](_0x52f857,_0x418b6f,config[_0x3070('0x4f')][_0x3070('0x50')])[_0x3070('0x25')](function(){return _0x3bb7b6;});}return _0x3bb7b6;}})['then'](function(_0x5ac69f){if(_0x5ac69f){var _0x5c08d5=_0x5ac69f[_0x3070('0x4c')];if(!fs[_0x3070('0x51')](_0x5c08d5)){throw new db[(_0x3070('0x52'))][(_0x3070('0x53'))](_0x3070('0x54'));}if(_0x5ac69f[_0x3070('0x55')]){return _0x49c5b6[_0x3070('0x56')](_0x5c08d5,_0x5ac69f['filename']+path['extname'](_0x5c08d5),function(){if(_0x41743c){fs[_0x3070('0x57')](_0x5c08d5);}});}else{return _0x49c5b6[_0x3070('0x56')](_0x5c08d5,function(_0x10d698){if(_0x41743c){fs[_0x3070('0x57')](_0x5c08d5);}});}}})[_0x3070('0x42')](function(_0x206d05){if(_0x206d05[_0x3070('0x58')]===_0x3070('0x54')){_0x49c5b6[_0x3070('0x1b')](0x194)[_0x3070('0x28')](_0x3070('0x59'));}else{return handleError(_0x49c5b6,null);}});};exports[_0x3070('0x5a')]=function(_0x32e89b,_0x55f95a,_0x5e7916){var _0xead13f=require(_0x3070('0x5b'));var _0x40755c=![];var _0x5eadbb={'$and':[db[_0x3070('0x5c')]['where'](db[_0x3070('0x5c')]['fn'](_0x3070('0x5d'),db['sequelize']['col']('uniqueid')),_0x32e89b[_0x3070('0x31')][_0x3070('0x5e')])]};if(_0x32e89b['query'][_0x3070('0x2e')]&&_0x32e89b[_0x3070('0x31')]['type']==='uniqueid'){_0x5eadbb[_0x3070('0x5f')][_0x3070('0x60')]({'uniqueid':_0x32e89b[_0x3070('0x4b')]['id']});}else{_0x5eadbb[_0x3070('0x5f')][_0x3070('0x60')]({'id':_0x32e89b['params']['id']});}return db[_0x3070('0x2b')]['find']({'where':_0x5eadbb,'attributes':['id',_0x3070('0x4c')],'raw':!![]})[_0x3070('0x25')](handleEntityNotFound(_0x55f95a,null))[_0x3070('0x25')](function(_0xec2c34){if(_0xec2c34){var _0xe26e20=util['format'](_0x3070('0x4d'),_0xec2c34[_0x3070('0x4c')]);if(fs[_0x3070('0x51')](_0xe26e20)){_0x40755c=!![];return _0xead13f[_0x3070('0x4e')](_0xe26e20,_0xec2c34[_0x3070('0x4c')],config[_0x3070('0x4f')][_0x3070('0x50')])['then'](function(){return _0xec2c34;});}return _0xec2c34;}})[_0x3070('0x25')](function(_0xedb622){if(_0xedb622){if(!fs['existsSync'](_0xedb622['value'])){throw new db[(_0x3070('0x52'))][(_0x3070('0x53'))](_0x3070('0x54'));}if(_0xedb622[_0x3070('0x55')]){return _0x55f95a[_0x3070('0x56')](_0xedb622[_0x3070('0x4c')],_0xedb622[_0x3070('0x55')]+path['extname'](_0xedb622['value']),function(){if(_0x40755c){fs['unlink'](_0xedb622['value']);}});}else{return _0x55f95a[_0x3070('0x56')](_0xedb622[_0x3070('0x4c')],function(_0x5f1606){if(_0x40755c){fs[_0x3070('0x57')](_0xedb622[_0x3070('0x4c')]);}});}}})['catch'](handleError(_0x55f95a,null));};exports[_0x3070('0x61')]=function(_0x131fd0,_0x29955c){return db[_0x3070('0x2b')][_0x3070('0x48')]({'where':{'id':_0x131fd0[_0x3070('0x4b')]['id']}})[_0x3070('0x25')](function(_0x59c030){if(_[_0x3070('0x62')](_0x59c030)){throw new ReferenceError(_0x3070('0x63'));}return _0x59c030;})[_0x3070('0x25')](function(_0x1b502f){var _0x1fb388=_0x1b502f[_0x3070('0x4c')];logger[_0x3070('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x1fb388);if(!_[_0x3070('0x62')](_0x1b502f[_0x3070('0x4c')])&&fs[_0x3070('0x51')](_0x1fb388)){logger[_0x3070('0x64')](_0x3070('0x65')+_0x1fb388+_0x3070('0x66'));fs[_0x3070('0x67')](_0x1fb388);}_0x1fb388=_0x1fb388+_0x3070('0x68');if(!_[_0x3070('0x62')](_0x1b502f['value'])&&fs[_0x3070('0x51')](_0x1fb388)){logger[_0x3070('0x64')](_0x3070('0x65')+_0x1fb388+_0x3070('0x66'));fs['unlinkSync'](_0x1fb388);}return _0x1b502f;})[_0x3070('0x25')](function(_0x5d99c0){if(!_0x5d99c0)throw new InternalError();return _0x5d99c0[_0x3070('0x61')]();})['then'](function(){_0x29955c[_0x3070('0x1b')](0xcc)[_0x3070('0x69')]();})[_0x3070('0x42')](handleError(_0x29955c,null));};function getBucketslist(_0x2bf81e,_0x5d9469,_0x503b8b){return new Promise(function(_0x5ada7b,_0x2aba83){var _0x52de8a=new AWS['S3']({'accessKeyId':_0x5d9469,'secretAccessKey':_0x2bf81e,'region':_0x503b8b});_0x52de8a[_0x3070('0x6a')]({},function(_0x30fcf2,_0x21c2be){if(_0x30fcf2){return _0x2aba83(_0x30fcf2);}else{return _0x5ada7b(_0x21c2be);}});});}function createBucket(_0x59eb73,_0x23477e,_0x2e6bda,_0x4ba5a1){return new Promise(function(_0x41b590,_0x1b48fb){var _0x2a942e=new AWS['S3']({'accessKeyId':_0x23477e,'secretAccessKey':_0x59eb73,'region':_0x2e6bda});_0x2a942e[_0x3070('0x6b')]({'Bucket':_0x4ba5a1},function(_0x41029a,_0x438b88){if(_0x41029a){return _0x1b48fb(_0x41029a);}else{return _0x41b590(_0x438b88);}});});}function uploadFile(_0x4e15b7,_0xb4f8ad,_0x9c220,_0x47b31b,_0x5715d0,_0x579af5){return new Promise(function(_0x65e265,_0x43b2b7){var _0x50901d=new AWS['S3']({'accessKeyId':_0xb4f8ad,'secretAccessKey':_0x4e15b7,'region':_0x9c220});_0x50901d[_0x3070('0x6c')]({'Bucket':_0x47b31b,'Key':_0x5715d0,'Body':_0x579af5},function(_0x5ba3d0,_0x466109){if(_0x5ba3d0){return _0x43b2b7(_0x5ba3d0);}else{return _0x65e265(_0x466109);}});});}function startTranscribe(_0x5efd02,_0x2f6fc3,_0x145115,_0x2ade76,_0x5e3227,_0x3ee022){return new Promise(function(_0x1b3f2c,_0x484636){var _0x493e13=new AWS[(_0x3070('0x6d'))]({'accessKeyId':_0x2f6fc3,'secretAccessKey':_0x5efd02,'region':_0x145115});_0x493e13[_0x3070('0x6e')]({'TranscriptionJobName':_0x2ade76,'LanguageCode':_0x5e3227,'Media':{'MediaFileUri':_0x3ee022}},function(_0x1f80cd,_0x1c6bc4){if(_0x1f80cd){return _0x484636(_0x1f80cd);}else{return _0x1b3f2c(_0x1c6bc4);}});});}function transcribe(_0x198e30,_0x5cd90e,_0x2302e7,_0x24353e,_0x45c8a4,_0x34d6a7,_0x7f45b1){return new Promise(function(_0x58aca8,_0x1195b6){var _0x56a4ed={};logger['info'](util[_0x3070('0x30')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x198e30,_0x45c8a4));return uploadFile(_0x5cd90e,_0x2302e7,_0x24353e,_0x45c8a4,path['basename'](_0x34d6a7),fs['readFileSync'](_0x34d6a7))[_0x3070('0x25')](function(_0x56f532){logger[_0x3070('0x64')](util[_0x3070('0x30')](_0x3070('0x6f'),_0x198e30,_0x45c8a4,_0x56f532[_0x3070('0x70')]));_0x56a4ed[_0x3070('0x71')]=_0x56f532['Bucket'];_0x56a4ed[_0x3070('0x72')]=_0x56f532[_0x3070('0x70')];logger[_0x3070('0x64')](util[_0x3070('0x30')](_0x3070('0x73'),_0x198e30));return startTranscribe(_0x5cd90e,_0x2302e7,_0x24353e,uuidv4(),_0x7f45b1,_0x56f532['Location']);})['then'](function(_0x5b5ab8){logger[_0x3070('0x64')](util[_0x3070('0x30')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x198e30,_0x5b5ab8[_0x3070('0x74')][_0x3070('0x75')]));_0x56a4ed[_0x3070('0x76')]=_0x5b5ab8['TranscriptionJob'][_0x3070('0x75')];_0x56a4ed[_0x3070('0x77')]=_0x5b5ab8['TranscriptionJob'][_0x3070('0x78')];return _0x58aca8(_0x56a4ed);})[_0x3070('0x42')](function(_0x191e4b){return _0x1195b6(_0x191e4b);});});}exports[_0x3070('0x79')]=function(_0xf14330,_0x4fe530,_0x3e028d){var _0x4ed915;var _0x22597d;var _0x1c302e;var _0x1a05b5=require(_0x3070('0x5b'));return db[_0x3070('0x2b')]['findOne']({'where':{'id':_0xf14330['params']['id']}})[_0x3070('0x25')](function(_0x3242d5){if(_0x3242d5){var _0x2de60a=util['format']('%s.cypher',_0x3242d5[_0x3070('0x4c')]);if(fs[_0x3070('0x51')](_0x2de60a)){cypher=!![];return _0x1a05b5[_0x3070('0x4e')](_0x2de60a,_0x3242d5[_0x3070('0x4c')],config[_0x3070('0x4f')]['recording'])[_0x3070('0x25')](function(){return _0x3242d5;});}return _0x3242d5;}})[_0x3070('0x25')](function(_0x5159c5){if(!_0x5159c5){throw new db[(_0x3070('0x52'))]['ValidationError'](_0x3070('0x7a'));}_0x22597d=_0x5159c5;return db['Setting'][_0x3070('0x7b')]({'where':{'id':0x1}});})[_0x3070('0x25')](handleEntityNotFound(_0x4fe530,null))['then'](function(_0x4ebac7){if(_0x4ebac7){_0x4ed915=_0x4ebac7;if(!_0x4ed915[_0x3070('0x7c')]||!_0x4ed915['transcribeAccountId']||!_0x4ed915[_0x3070('0x7d')]||!_0x4ed915[_0x3070('0x7e')]||!_0x4ed915[_0x3070('0x71')]){throw new db[(_0x3070('0x52'))][(_0x3070('0x53'))](_0x3070('0x7f'));}if(_0xf14330[_0x3070('0x47')][_0x3070('0x80')]&&(!_0x4ed915[_0x3070('0x81')]||!_0x4ed915[_0x3070('0x82')]||!_0x4ed915[_0x3070('0x83')]||!_0x4ed915[_0x3070('0x7e')]||!_0x4ed915['bucket'])){throw new db[(_0x3070('0x52'))][(_0x3070('0x53'))](_0x3070('0x84'));}return db[_0x3070('0x85')][_0x3070('0x7b')]({'where':{'id':_0x4ed915[_0x3070('0x86')]}});}})[_0x3070('0x25')](function(_0x140a88){if(!_0x140a88){throw new db['Sequelize'][(_0x3070('0x53'))](_0x3070('0x87'));}if(!_0x140a88[_0x3070('0x88')]||!_0x140a88[_0x3070('0x89')]){throw new db[(_0x3070('0x52'))][(_0x3070('0x53'))](_0x3070('0x8a'));}_0x1c302e=_0x140a88;return getBucketslist(_0x1c302e['data1'],_0x1c302e[_0x3070('0x89')],_0x4ed915[_0x3070('0x7d')]);})['then'](function(_0x2738e6){if(_0x2738e6&&_0x2738e6[_0x3070('0x8b')]){var _0x1badb3=_[_0x3070('0x48')](_0x2738e6[_0x3070('0x8b')],function(_0x5b8124){return _0x5b8124['Name']===_0x4ed915['bucket'];});if(!_0x1badb3){logger[_0x3070('0x64')](util[_0x3070('0x30')](_0x3070('0x8c'),_0xf14330[_0x3070('0x4b')]['id'],_0x4ed915[_0x3070('0x71')]));return createBucket(_0x1c302e['data1'],_0x1c302e['data2'],_0x4ed915['transcribeRegion'],_0x4ed915[_0x3070('0x71')]);}logger[_0x3070('0x64')](util[_0x3070('0x30')](_0x3070('0x8d'),_0xf14330[_0x3070('0x4b')]['id'],_0x4ed915[_0x3070('0x71')]));return;}})[_0x3070('0x25')](function(_0x257cc0){if(_0x22597d[_0x3070('0x77')]===_0x3070('0x8e')){return transcribe(_0xf14330[_0x3070('0x4b')]['id'],_0x1c302e[_0x3070('0x88')],_0x1c302e[_0x3070('0x89')],_0x4ed915[_0x3070('0x7d')],_0x4ed915[_0x3070('0x71')],_0x22597d[_0x3070('0x4c')],_0x4ed915[_0x3070('0x7e')]);}else{logger[_0x3070('0x64')](util[_0x3070('0x30')](_0x3070('0x8f'),_0xf14330['params']['id']));return{'transcribeStatus':_0x3070('0x90')};}})[_0x3070('0x25')](function(_0x66d97e){if(_0x66d97e){_0x66d97e[_0x3070('0x91')]=_0xf14330[_0x3070('0x47')][_0x3070('0x80')];return _0x22597d[_0x3070('0x92')](_0x66d97e);}})[_0x3070('0x25')](respondWithResult(_0x4fe530,null))[_0x3070('0x42')](handleError(_0x4fe530,null));};function writeFile(_0xf491ea,_0x5a6362){return new Promise(function(_0x3d1100,_0x46f1a8){fs[_0x3070('0x93')](_0x5a6362,_0xf491ea,function(_0x50148a,_0x17cc31){if(_0x50148a){return _0x46f1a8(_0x50148a);}else{return _0x3d1100(_0x17cc31);}});});}exports['downloadTranscribe']=function(_0x109ce4,_0x3b2ffa,_0x3ff5b9){return db[_0x3070('0x2b')][_0x3070('0x7b')]({'where':{'id':_0x109ce4['params']['id']}})['then'](handleEntityNotFound(_0x3b2ffa))[_0x3070('0x25')](function(_0x2b71c6){if(_0x2b71c6&&_0x2b71c6[_0x3070('0x94')]){var _0x426ad8=_0x2b71c6[_0x3070('0x94')];var _0x44d191=config[_0x3070('0x95')]+_0x3070('0x96')+_0x2b71c6['id']+_0x3070('0x97');if(fs['existsSync'](_0x44d191)){return _0x44d191;}return writeFile(_0x426ad8,_0x44d191)[_0x3070('0x25')](function(){return _0x44d191;});}else{throw new db['Sequelize'][(_0x3070('0x53'))]('Transcript\x20not\x20available');}})[_0x3070('0x25')](function(_0xf859d3){return _0x3b2ffa[_0x3070('0x56')](_0xf859d3);})[_0x3070('0x42')](handleError(_0x3b2ffa));}; \ No newline at end of file +var _0x39d3=['%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','token','push','$and','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','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)','bucket','Bucket','Location','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','CloudProvider','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','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','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','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','send','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','describe','download','../../components/encryptor','uniqueid','value'];(function(_0x3b1f5d,_0xeec4bd){var _0x114974=function(_0x2cda6d){while(--_0x2cda6d){_0x3b1f5d['push'](_0x3b1f5d['shift']());}};_0x114974(++_0xeec4bd);}(_0x39d3,0xdd));var _0x339d=function(_0x46a50e,_0x49f0f4){_0x46a50e=_0x46a50e-0x0;var _0x4e5b41=_0x39d3[_0x46a50e];return _0x4e5b41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x339d('0x0'));var zipdir=require(_0x339d('0x1'));var jsonpatch=require(_0x339d('0x2'));var rp=require(_0x339d('0x3'));var moment=require(_0x339d('0x4'));var BPromise=require(_0x339d('0x5'));var Mustache=require(_0x339d('0x6'));var util=require(_0x339d('0x7'));var path=require(_0x339d('0x8'));var sox=require(_0x339d('0x9'));var csv=require('to-csv');var ejs=require(_0x339d('0xa'));var fs=require('fs');var fs_extra=require(_0x339d('0xb'));var _=require(_0x339d('0xc'));var squel=require(_0x339d('0xd'));var crypto=require(_0x339d('0xe'));var jsforce=require(_0x339d('0xf'));var deskjs=require(_0x339d('0x10'));var toCsv=require(_0x339d('0x11'));var querystring=require(_0x339d('0x12'));var Papa=require('papaparse');var AWS=require(_0x339d('0x13'));var uuidv4=require(_0x339d('0x14'));var Redis=require(_0x339d('0x15'));var authService=require(_0x339d('0x16'));var qs=require(_0x339d('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x339d('0x18'));var logger=require(_0x339d('0x19'))(_0x339d('0x1a'));var utils=require(_0x339d('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x339d('0x1c'));var db=require(_0x339d('0x1d'))['db'];function respondWithStatusCode(_0x216c8b,_0x341287){_0x341287=_0x341287||0xcc;return function(_0x33c04b){if(_0x33c04b){return _0x216c8b['sendStatus'](_0x341287);}return _0x216c8b[_0x339d('0x1e')](_0x341287)[_0x339d('0x1f')]();};}function respondWithResult(_0x20527c,_0x4435f8){_0x4435f8=_0x4435f8||0xc8;return function(_0x3e6d73){if(_0x3e6d73){return _0x20527c['status'](_0x4435f8)['json'](_0x3e6d73);}};}function respondWithFilteredResult(_0x5a5de7,_0x598f5d){return function(_0x551652){if(_0x551652){var _0x840bb=typeof _0x598f5d[_0x339d('0x20')]===_0x339d('0x21')&&typeof _0x598f5d[_0x339d('0x22')]===_0x339d('0x21');var _0x2e0f17=_0x551652['count'];var _0x29b05b=_0x840bb?0x0:_0x598f5d[_0x339d('0x20')];var _0x3c64cd=_0x840bb?_0x551652[_0x339d('0x23')]:_0x598f5d[_0x339d('0x20')]+_0x598f5d['limit'];var _0x21cf41;if(_0x3c64cd>=_0x2e0f17){_0x3c64cd=_0x2e0f17;_0x21cf41=0xc8;}else{_0x21cf41=0xce;}_0x5a5de7['status'](_0x21cf41);return _0x5a5de7[_0x339d('0x24')](_0x339d('0x25'),_0x29b05b+'-'+_0x3c64cd+'/'+_0x2e0f17)[_0x339d('0x26')](_0x551652);}return null;};}function patchUpdates(_0x57e005){return function(_0x14be8f){try{jsonpatch[_0x339d('0x27')](_0x14be8f,_0x57e005,!![]);}catch(_0x2ef015){return BPromise[_0x339d('0x28')](_0x2ef015);}return _0x14be8f[_0x339d('0x29')]();};}function saveUpdates(_0x1c8cfe,_0x50dd52){return function(_0x13c4fc){if(_0x13c4fc){return _0x13c4fc[_0x339d('0x2a')](_0x1c8cfe)[_0x339d('0x2b')](function(_0x276a7c){return _0x276a7c;});}return null;};}function removeEntity(_0x578366,_0x4f1deb){return function(_0x125a2a){if(_0x125a2a){return _0x125a2a['destroy']()[_0x339d('0x2b')](function(){_0x578366[_0x339d('0x1e')](0xcc)[_0x339d('0x1f')]();});}};}function handleEntityNotFound(_0x2dd2e3,_0x495dc1){return function(_0x4e6007){if(!_0x4e6007){_0x2dd2e3[_0x339d('0x2c')](0x194);}return _0x4e6007;};}function handleError(_0x5bbde5,_0x2c64a7){_0x2c64a7=_0x2c64a7||0x1f4;return function(_0x588550){logger[_0x339d('0x2d')](_0x588550['stack']);if(_0x588550[_0x339d('0x2e')]){delete _0x588550[_0x339d('0x2e')];}_0x5bbde5['status'](_0x2c64a7)[_0x339d('0x2f')](_0x588550);};}exports['index']=function(_0x38f06c,_0x3d42d0){var _0x5264db={},_0x43c82d={},_0x2df1d5={'count':0x0,'rows':[]};var _0x3eea78=_['map'](db[_0x339d('0x30')][_0x339d('0x31')],function(_0x5413da){return{'name':_0x5413da[_0x339d('0x32')],'type':_0x5413da[_0x339d('0x33')][_0x339d('0x34')]};});_0x43c82d[_0x339d('0x35')]=_[_0x339d('0x36')](_[_0x339d('0x37')](_0x3eea78,_0x339d('0x2e')),[_0x339d('0x38')]);_0x43c82d[_0x339d('0x39')]=_[_0x339d('0x3a')](_0x38f06c['query']);_0x43c82d['filters']=_['intersection'](_0x43c82d[_0x339d('0x35')],_0x43c82d[_0x339d('0x39')]);_0x5264db[_0x339d('0x3b')]=_[_0x339d('0x3c')](_0x43c82d[_0x339d('0x35')],qs['fields'](_0x38f06c[_0x339d('0x39')][_0x339d('0x3d')]));_0x5264db[_0x339d('0x3b')]=_0x5264db[_0x339d('0x3b')]['length']?_0x5264db[_0x339d('0x3b')]:_0x43c82d['model'];if(!_0x38f06c['query'][_0x339d('0x3e')](_0x339d('0x3f'))){_0x5264db[_0x339d('0x22')]=qs[_0x339d('0x22')](_0x38f06c['query'][_0x339d('0x22')]);_0x5264db[_0x339d('0x20')]=qs['offset'](_0x38f06c[_0x339d('0x39')][_0x339d('0x20')]);}_0x5264db[_0x339d('0x40')]=qs[_0x339d('0x41')](_0x38f06c[_0x339d('0x39')]['sort']);_0x5264db[_0x339d('0x42')]=qs[_0x339d('0x43')](_[_0x339d('0x44')](_0x38f06c[_0x339d('0x39')],_0x43c82d[_0x339d('0x43')]),_0x3eea78);if(_0x38f06c[_0x339d('0x39')][_0x339d('0x45')]){_0x5264db[_0x339d('0x42')]=_[_0x339d('0x46')](_0x5264db[_0x339d('0x42')],{'$or':_[_0x339d('0x37')](_0x3eea78,function(_0x471f9e){if(_0x471f9e[_0x339d('0x33')]!==_0x339d('0x47')){var _0x875295={};_0x875295[_0x471f9e[_0x339d('0x2e')]]={'$like':'%'+_0x38f06c[_0x339d('0x39')][_0x339d('0x45')]+'%'};return _0x875295;}})});}_0x5264db=_['merge']({},_0x5264db,_0x38f06c['options']);var _0x20fd9b={'where':_0x5264db[_0x339d('0x42')]};return db[_0x339d('0x30')][_0x339d('0x23')](_0x20fd9b)[_0x339d('0x2b')](function(_0x50e4ca){_0x2df1d5[_0x339d('0x23')]=_0x50e4ca;if(_0x38f06c['query'][_0x339d('0x48')]){_0x5264db[_0x339d('0x49')]=[{'all':!![]}];}return db[_0x339d('0x30')][_0x339d('0x4a')](_0x5264db);})['then'](function(_0x434b01){_0x2df1d5[_0x339d('0x4b')]=_0x434b01;return _0x2df1d5;})[_0x339d('0x2b')](respondWithFilteredResult(_0x3d42d0,_0x5264db))[_0x339d('0x4c')](handleError(_0x3d42d0,null));};exports[_0x339d('0x4d')]=function(_0x503e19,_0x340da8){var _0x3aaaf9={'raw':![],'where':{'id':_0x503e19[_0x339d('0x4e')]['id']}},_0x29c17e={};_0x29c17e['model']=_[_0x339d('0x3a')](db['VoiceRecording'][_0x339d('0x31')]);_0x29c17e[_0x339d('0x39')]=_[_0x339d('0x3a')](_0x503e19[_0x339d('0x39')]);_0x29c17e[_0x339d('0x43')]=_[_0x339d('0x3c')](_0x29c17e[_0x339d('0x35')],_0x29c17e[_0x339d('0x39')]);_0x3aaaf9[_0x339d('0x3b')]=_[_0x339d('0x3c')](_0x29c17e['model'],qs[_0x339d('0x3d')](_0x503e19[_0x339d('0x39')]['fields']));_0x3aaaf9[_0x339d('0x3b')]=_0x3aaaf9[_0x339d('0x3b')][_0x339d('0x4f')]?_0x3aaaf9[_0x339d('0x3b')]:_0x29c17e['model'];if(_0x503e19['query'][_0x339d('0x48')]){_0x3aaaf9[_0x339d('0x49')]=[{'all':!![]}];}_0x3aaaf9=_[_0x339d('0x46')]({},_0x3aaaf9,_0x503e19[_0x339d('0x50')]);return db[_0x339d('0x30')]['find'](_0x3aaaf9)[_0x339d('0x2b')](handleEntityNotFound(_0x340da8,null))[_0x339d('0x2b')](respondWithResult(_0x340da8,null))['catch'](handleError(_0x340da8,null));};exports[_0x339d('0x51')]=function(_0x4acd6f,_0xa47e95){return db[_0x339d('0x30')][_0x339d('0x51')](_0x4acd6f['body'],{})[_0x339d('0x2b')](respondWithResult(_0xa47e95,0xc9))['catch'](handleError(_0xa47e95,null));};exports[_0x339d('0x2a')]=function(_0x5bfdfb,_0x3a98d2){if(_0x5bfdfb['body']['id']){delete _0x5bfdfb[_0x339d('0x52')]['id'];}return db[_0x339d('0x30')][_0x339d('0x53')]({'where':{'id':_0x5bfdfb[_0x339d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a98d2,null))[_0x339d('0x2b')](saveUpdates(_0x5bfdfb['body'],null))[_0x339d('0x2b')](respondWithResult(_0x3a98d2,null))[_0x339d('0x4c')](handleError(_0x3a98d2,null));};exports['describe']=function(_0x4037d0,_0x2df497){return db[_0x339d('0x30')][_0x339d('0x54')]()['then'](respondWithResult(_0x2df497,null))[_0x339d('0x4c')](handleError(_0x2df497,null));};exports[_0x339d('0x55')]=function(_0x26fb3d,_0x3c82d7,_0x4e324a){var _0x3a30f1=require(_0x339d('0x56'));var _0x19c286=![];var _0x3ddae5={};if(_0x26fb3d[_0x339d('0x39')][_0x339d('0x33')]&&_0x26fb3d[_0x339d('0x39')][_0x339d('0x33')]===_0x339d('0x57')){_0x3ddae5[_0x339d('0x57')]=_0x26fb3d[_0x339d('0x4e')]['id'];}else{_0x3ddae5['id']=_0x26fb3d[_0x339d('0x4e')]['id'];}return db[_0x339d('0x30')][_0x339d('0x53')]({'where':_0x3ddae5,'attributes':['id',_0x339d('0x58')],'raw':!![]})['then'](handleEntityNotFound(_0x3c82d7,null))['then'](function(_0x3c08b3){if(_0x3c08b3){var _0x29711f=_0x3c08b3[_0x339d('0x58')];var _0x4d081c=util[_0x339d('0x38')](_0x339d('0x59'),_0x29711f);if(fs[_0x339d('0x5a')](_0x4d081c)){_0x19c286=!![];return _0x3a30f1[_0x339d('0x5b')](_0x4d081c,_0x29711f,config[_0x339d('0x5c')][_0x339d('0x5d')])['then'](function(){return _0x3c08b3;});}return _0x3c08b3;}})['then'](function(_0x5ce181){if(_0x5ce181){var _0x374587=_0x5ce181[_0x339d('0x58')];if(!fs['existsSync'](_0x374587)){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))](_0x339d('0x60'));}if(_0x5ce181[_0x339d('0x61')]){return _0x3c82d7['download'](_0x374587,_0x5ce181['filename']+path[_0x339d('0x62')](_0x374587),function(){if(_0x19c286){fs[_0x339d('0x63')](_0x374587);}});}else{return _0x3c82d7[_0x339d('0x55')](_0x374587,function(_0x39c7cf){if(_0x19c286){fs[_0x339d('0x63')](_0x374587);}});}}})['catch'](function(_0x9a510){if(_0x9a510[_0x339d('0x64')]===_0x339d('0x60')){_0x3c82d7['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x3c82d7,null);}});};exports[_0x339d('0x65')]=function(_0x4363b8,_0x122c69,_0x5f3364){var _0x5816e2=require('../../components/encryptor');var _0x11b1ec=![];var _0xd15e67={'$and':[db[_0x339d('0x66')][_0x339d('0x42')](db[_0x339d('0x66')]['fn']('MD5',db[_0x339d('0x66')]['col'](_0x339d('0x57'))),_0x4363b8['query'][_0x339d('0x67')])]};if(_0x4363b8[_0x339d('0x39')][_0x339d('0x33')]&&_0x4363b8[_0x339d('0x39')]['type']===_0x339d('0x57')){_0xd15e67['$and'][_0x339d('0x68')]({'uniqueid':_0x4363b8[_0x339d('0x4e')]['id']});}else{_0xd15e67[_0x339d('0x69')]['push']({'id':_0x4363b8[_0x339d('0x4e')]['id']});}return db[_0x339d('0x30')][_0x339d('0x53')]({'where':_0xd15e67,'attributes':['id','value'],'raw':!![]})[_0x339d('0x2b')](handleEntityNotFound(_0x122c69,null))[_0x339d('0x2b')](function(_0x46bc3c){if(_0x46bc3c){var _0x402167=util['format'](_0x339d('0x59'),_0x46bc3c[_0x339d('0x58')]);if(fs[_0x339d('0x5a')](_0x402167)){_0x11b1ec=!![];return _0x5816e2['decryptFile'](_0x402167,_0x46bc3c[_0x339d('0x58')],config[_0x339d('0x5c')]['recording'])[_0x339d('0x2b')](function(){return _0x46bc3c;});}return _0x46bc3c;}})['then'](function(_0x4bca08){if(_0x4bca08){if(!fs[_0x339d('0x5a')](_0x4bca08['value'])){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))](_0x339d('0x60'));}if(_0x4bca08[_0x339d('0x61')]){return _0x122c69[_0x339d('0x55')](_0x4bca08[_0x339d('0x58')],_0x4bca08[_0x339d('0x61')]+path[_0x339d('0x62')](_0x4bca08['value']),function(){if(_0x11b1ec){fs[_0x339d('0x63')](_0x4bca08[_0x339d('0x58')]);}});}else{return _0x122c69[_0x339d('0x55')](_0x4bca08['value'],function(_0x6b6c74){if(_0x11b1ec){fs[_0x339d('0x63')](_0x4bca08[_0x339d('0x58')]);}});}}})[_0x339d('0x4c')](handleError(_0x122c69,null));};exports['destroy']=function(_0xdf6772,_0x24e0f3){return db[_0x339d('0x30')][_0x339d('0x53')]({'where':{'id':_0xdf6772[_0x339d('0x4e')]['id']}})[_0x339d('0x2b')](function(_0x49d794){if(_[_0x339d('0x6a')](_0x49d794)){throw new ReferenceError('Entity\x20not\x20found');}return _0x49d794;})[_0x339d('0x2b')](function(_0x49e412){var _0x531947=_0x49e412[_0x339d('0x58')];logger['info'](_0x339d('0x6b'),_0x531947);if(!_['isNil'](_0x49e412[_0x339d('0x58')])&&fs[_0x339d('0x5a')](_0x531947)){logger[_0x339d('0x6c')](_0x339d('0x6d')+_0x531947+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x339d('0x6e')](_0x531947);}_0x531947=_0x531947+'.cypher';if(!_['isNil'](_0x49e412[_0x339d('0x58')])&&fs[_0x339d('0x5a')](_0x531947)){logger['info'](_0x339d('0x6d')+_0x531947+_0x339d('0x6f'));fs[_0x339d('0x6e')](_0x531947);}return _0x49e412;})[_0x339d('0x2b')](function(_0x2958be){if(!_0x2958be)throw new InternalError();return _0x2958be['destroy']();})[_0x339d('0x2b')](function(){_0x24e0f3[_0x339d('0x1e')](0xcc)[_0x339d('0x1f')]();})[_0x339d('0x4c')](handleError(_0x24e0f3,null));};function getBucketslist(_0x4950cc,_0x5690b6,_0x3ffc7d){return new Promise(function(_0x65ddcc,_0xc6329a){var _0x3adeff=new AWS['S3']({'accessKeyId':_0x5690b6,'secretAccessKey':_0x4950cc,'region':_0x3ffc7d});_0x3adeff[_0x339d('0x70')]({},function(_0x12a024,_0x126ef1){if(_0x12a024){return _0xc6329a(_0x12a024);}else{return _0x65ddcc(_0x126ef1);}});});}function createBucket(_0x15eefc,_0x56970c,_0x55a055,_0x2a106c){return new Promise(function(_0x479188,_0x4ba8e2){var _0x5c74d1=new AWS['S3']({'accessKeyId':_0x56970c,'secretAccessKey':_0x15eefc,'region':_0x55a055});_0x5c74d1['createBucket']({'Bucket':_0x2a106c},function(_0x498290,_0xf9a133){if(_0x498290){return _0x4ba8e2(_0x498290);}else{return _0x479188(_0xf9a133);}});});}function uploadFile(_0x18d977,_0x101f01,_0x595519,_0x32e815,_0x2bc368,_0x1143f2){return new Promise(function(_0x39642b,_0x55bd8c){var _0xc30431=new AWS['S3']({'accessKeyId':_0x101f01,'secretAccessKey':_0x18d977,'region':_0x595519});_0xc30431['upload']({'Bucket':_0x32e815,'Key':_0x2bc368,'Body':_0x1143f2},function(_0x5977a9,_0x96022b){if(_0x5977a9){return _0x55bd8c(_0x5977a9);}else{return _0x39642b(_0x96022b);}});});}function startTranscribe(_0x282356,_0x3a16ac,_0x3fdfa9,_0x526430,_0x25dffd,_0x5a5307){return new Promise(function(_0x519130,_0x48219d){var _0x1ce6a3=new AWS[(_0x339d('0x71'))]({'accessKeyId':_0x3a16ac,'secretAccessKey':_0x282356,'region':_0x3fdfa9});_0x1ce6a3[_0x339d('0x72')]({'TranscriptionJobName':_0x526430,'LanguageCode':_0x25dffd,'Media':{'MediaFileUri':_0x5a5307}},function(_0x3280bc,_0x4b47ad){if(_0x3280bc){return _0x48219d(_0x3280bc);}else{return _0x519130(_0x4b47ad);}});});}function transcribe(_0x5395c0,_0x21d901,_0x343473,_0x2339b1,_0x5e339e,_0x33e2f2,_0x4122f6){return new Promise(function(_0xcfaa7d,_0x459655){var _0x2c6113={};logger['info'](util[_0x339d('0x38')](_0x339d('0x73'),_0x5395c0,_0x5e339e));return uploadFile(_0x21d901,_0x343473,_0x2339b1,_0x5e339e,path[_0x339d('0x74')](_0x33e2f2),fs[_0x339d('0x75')](_0x33e2f2))[_0x339d('0x2b')](function(_0x2c0580){logger['info'](util[_0x339d('0x38')](_0x339d('0x76'),_0x5395c0,_0x5e339e,_0x2c0580['Location']));_0x2c6113[_0x339d('0x77')]=_0x2c0580[_0x339d('0x78')];_0x2c6113['location']=_0x2c0580[_0x339d('0x79')];logger[_0x339d('0x6c')](util[_0x339d('0x38')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x5395c0));return startTranscribe(_0x21d901,_0x343473,_0x2339b1,uuidv4(),_0x4122f6,_0x2c0580[_0x339d('0x79')]);})[_0x339d('0x2b')](function(_0x56b0e7){logger[_0x339d('0x6c')](util[_0x339d('0x38')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x5395c0,_0x56b0e7[_0x339d('0x7a')][_0x339d('0x7b')]));_0x2c6113['transcribeName']=_0x56b0e7[_0x339d('0x7a')][_0x339d('0x7b')];_0x2c6113[_0x339d('0x7c')]=_0x56b0e7['TranscriptionJob'][_0x339d('0x7d')];return _0xcfaa7d(_0x2c6113);})[_0x339d('0x4c')](function(_0x18deed){return _0x459655(_0x18deed);});});}exports[_0x339d('0x7e')]=function(_0x4bcb3e,_0x49ca83,_0x54c183){var _0x52a4c9;var _0x4cd27f;var _0x467d13;var _0xcb747=require(_0x339d('0x56'));return db[_0x339d('0x30')][_0x339d('0x7f')]({'where':{'id':_0x4bcb3e[_0x339d('0x4e')]['id']}})[_0x339d('0x2b')](function(_0xc41d7f){if(_0xc41d7f){var _0x59320=util[_0x339d('0x38')](_0x339d('0x59'),_0xc41d7f['value']);if(fs['existsSync'](_0x59320)){cypher=!![];return _0xcb747[_0x339d('0x5b')](_0x59320,_0xc41d7f[_0x339d('0x58')],config['secrets'][_0x339d('0x5d')])[_0x339d('0x2b')](function(){return _0xc41d7f;});}return _0xc41d7f;}})[_0x339d('0x2b')](function(_0x57bedf){if(!_0x57bedf){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))]('Voice\x20Recording\x20not\x20found');}_0x4cd27f=_0x57bedf;return db[_0x339d('0x80')][_0x339d('0x7f')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x49ca83,null))[_0x339d('0x2b')](function(_0x3b92fa){if(_0x3b92fa){_0x52a4c9=_0x3b92fa;if(!_0x52a4c9[_0x339d('0x81')]||!_0x52a4c9[_0x339d('0x82')]||!_0x52a4c9[_0x339d('0x83')]||!_0x52a4c9[_0x339d('0x84')]||!_0x52a4c9[_0x339d('0x77')]){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))](_0x339d('0x85'));}if(_0x4bcb3e[_0x339d('0x52')][_0x339d('0x86')]&&(!_0x52a4c9[_0x339d('0x87')]||!_0x52a4c9['sentimentAccountId']||!_0x52a4c9[_0x339d('0x88')]||!_0x52a4c9['language']||!_0x52a4c9['bucket'])){throw new db[(_0x339d('0x5e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x339d('0x89')][_0x339d('0x7f')]({'where':{'id':_0x52a4c9[_0x339d('0x82')]}});}})[_0x339d('0x2b')](function(_0x360685){if(!_0x360685){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x360685[_0x339d('0x8a')]||!_0x360685[_0x339d('0x8b')]){throw new db[(_0x339d('0x5e'))][(_0x339d('0x5f'))](_0x339d('0x8c'));}_0x467d13=_0x360685;return getBucketslist(_0x467d13[_0x339d('0x8a')],_0x467d13[_0x339d('0x8b')],_0x52a4c9[_0x339d('0x83')]);})[_0x339d('0x2b')](function(_0x5f2958){if(_0x5f2958&&_0x5f2958[_0x339d('0x8d')]){var _0x2a8b14=_[_0x339d('0x53')](_0x5f2958['Buckets'],function(_0x455fd6){return _0x455fd6[_0x339d('0x8e')]===_0x52a4c9[_0x339d('0x77')];});if(!_0x2a8b14){logger['info'](util['format'](_0x339d('0x8f'),_0x4bcb3e[_0x339d('0x4e')]['id'],_0x52a4c9[_0x339d('0x77')]));return createBucket(_0x467d13[_0x339d('0x8a')],_0x467d13[_0x339d('0x8b')],_0x52a4c9[_0x339d('0x83')],_0x52a4c9['bucket']);}logger['info'](util[_0x339d('0x38')](_0x339d('0x90'),_0x4bcb3e[_0x339d('0x4e')]['id'],_0x52a4c9['bucket']));return;}})[_0x339d('0x2b')](function(_0x2e148e){if(_0x4cd27f['transcribeStatus']===_0x339d('0x91')){return transcribe(_0x4bcb3e[_0x339d('0x4e')]['id'],_0x467d13['data1'],_0x467d13[_0x339d('0x8b')],_0x52a4c9[_0x339d('0x83')],_0x52a4c9[_0x339d('0x77')],_0x4cd27f[_0x339d('0x58')],_0x52a4c9['language']);}else{logger[_0x339d('0x6c')](util[_0x339d('0x38')](_0x339d('0x92'),_0x4bcb3e['params']['id']));return{'transcribeStatus':_0x339d('0x93')};}})[_0x339d('0x2b')](function(_0x117e02){if(_0x117e02){_0x117e02[_0x339d('0x94')]=_0x4bcb3e[_0x339d('0x52')][_0x339d('0x86')];return _0x4cd27f['updateAttributes'](_0x117e02);}})[_0x339d('0x2b')](respondWithResult(_0x49ca83,null))[_0x339d('0x4c')](handleError(_0x49ca83,null));};function writeFile(_0x465732,_0x2727ff){return new Promise(function(_0x6b7435,_0x36b4ad){fs[_0x339d('0x95')](_0x2727ff,_0x465732,function(_0x1bcceb,_0x218a67){if(_0x1bcceb){return _0x36b4ad(_0x1bcceb);}else{return _0x6b7435(_0x218a67);}});});}exports[_0x339d('0x96')]=function(_0x100ade,_0xf519c6,_0x10d22e){return db[_0x339d('0x30')][_0x339d('0x7f')]({'where':{'id':_0x100ade['params']['id']}})['then'](handleEntityNotFound(_0xf519c6))[_0x339d('0x2b')](function(_0x424643){if(_0x424643&&_0x424643[_0x339d('0x97')]){var _0x3299b4=_0x424643[_0x339d('0x97')];var _0x18e09e=config[_0x339d('0x98')]+_0x339d('0x99')+_0x424643['id']+'.txt';if(fs['existsSync'](_0x18e09e)){return _0x18e09e;}return writeFile(_0x3299b4,_0x18e09e)['then'](function(){return _0x18e09e;});}else{throw new db['Sequelize'][(_0x339d('0x5f'))](_0x339d('0x9a'));}})['then'](function(_0x1f2a46){return _0xf519c6[_0x339d('0x55')](_0x1f2a46);})[_0x339d('0x4c')](handleError(_0xf519c6));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 714f87c..d6f7a45 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 _0xe58a=['exports','define','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x3ccda4,_0x3b097b){var _0x4c68d6=function(_0x13753f){while(--_0x13753f){_0x3ccda4['push'](_0x3ccda4['shift']());}};_0x4c68d6(++_0x3b097b);}(_0xe58a,0x9f));var _0xae58=function(_0x316c48,_0x4d669f){_0x316c48=_0x316c48-0x0;var _0x3d7c68=_0xe58a[_0x316c48];return _0x3d7c68;};'use strict';var attributes=require(_0xae58('0x0'));module[_0xae58('0x1')]=function(_0x3adf03,_0x56bff5){return _0x3adf03[_0xae58('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xae58('0x3'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':[_0xae58('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84e1=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0xa39ba1,_0x291066){var _0x296408=function(_0x3e16bd){while(--_0x3e16bd){_0xa39ba1['push'](_0xa39ba1['shift']());}};_0x296408(++_0x291066);}(_0x84e1,0x1dc));var _0x184e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x84e1[_0xfae23b];return _0x200640;};'use strict';var attributes=require(_0x184e('0x0'));module[_0x184e('0x1')]=function(_0x1cb42b,_0x1e7e1f){return _0x1cb42b[_0x184e('0x2')](_0x184e('0x3'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x184e('0x4'),'fields':[_0x184e('0x4')]},{'name':_0x184e('0x5'),'fields':[_0x184e('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 4966bde..8be652d 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 _0xc1c6=['format','%s.cypher','value','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','update','options','raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','callRecordingEncryption','VoiceRecording','create','existsSync'];(function(_0x43d4f8,_0x1afb74){var _0x1f6c87=function(_0x289353){while(--_0x289353){_0x43d4f8['push'](_0x43d4f8['shift']());}};_0x1f6c87(++_0x1afb74);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2915cb,_0x44baf7){_0x2915cb=_0x2915cb-0x0;var _0x367276=_0xc1c6[_0x2915cb];return _0x367276;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});}exports['UpdateVoiceRecording']=function(_0x137770){var _0x4ede06=this;return new Promise(function(_0x338dc2,_0x1a0ab9){return db['VoiceRecording'][_0x6c1c('0x13')](_0x137770['body'],{'raw':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x16')]||null:null,'attributes':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x17')]||null:null,'limit':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x18')]||null:null})[_0x6c1c('0x9')](function(_0x9c6c55){logger[_0x6c1c('0x11')](_0x6c1c('0x19'),_0x137770);logger[_0x6c1c('0xc')](_0x6c1c('0x19'),_0x137770,JSON[_0x6c1c('0xe')](_0x9c6c55));_0x338dc2(_0x9c6c55);})[_0x6c1c('0x12')](function(_0x96046a){logger[_0x6c1c('0xf')](_0x6c1c('0x19'),_0x96046a[_0x6c1c('0x10')],_0x137770);_0x1a0ab9(_0x4ede06[_0x6c1c('0xf')](0x1f4,_0x96046a[_0x6c1c('0x10')]));});});};exports[_0x6c1c('0x1a')]=function(_0x1b9d7d){var _0x2feaf4=this;return new Promise(function(_0x5f4568,_0x2595c3){var _0x4d73aa=require(_0x6c1c('0x1b'));var _0x4c23f8;return db[_0x6c1c('0x1c')]['findOne']({'attributes':['id',_0x6c1c('0x1d')],'where':{'id':0x1},'raw':!![]})[_0x6c1c('0x9')](function(_0x504348){_0x4c23f8=_0x504348;return db[_0x6c1c('0x1e')][_0x6c1c('0x1f')](_0x1b9d7d['body']);})[_0x6c1c('0x9')](function(_0x19a8f1){if(_0x4c23f8[_0x6c1c('0x1d')]&&fs[_0x6c1c('0x20')](_0x19a8f1['value'])){var _0x52c036=util[_0x6c1c('0x21')](_0x6c1c('0x22'),_0x19a8f1[_0x6c1c('0x23')]);return _0x4d73aa[_0x6c1c('0x24')](_0x19a8f1[_0x6c1c('0x23')],_0x52c036,config[_0x6c1c('0x25')]['recording'])[_0x6c1c('0x9')](function(){fs[_0x6c1c('0x26')](_0x19a8f1['value']);logger[_0x6c1c('0x11')](_0x6c1c('0x27'));return _0x19a8f1;});}return _0x19a8f1;})[_0x6c1c('0x9')](function(_0x15b6d2){logger['info'](_0x6c1c('0x1a'),_0x1b9d7d);logger[_0x6c1c('0xc')](_0x6c1c('0x1a'),_0x1b9d7d,JSON['stringify'](_0x15b6d2));_0x5f4568(_0x15b6d2);})[_0x6c1c('0x12')](function(_0x4e5767){logger[_0x6c1c('0xf')]('CreateVoiceRecording',_0x4e5767[_0x6c1c('0x10')],_0x1b9d7d);_0x2595c3(_0x2feaf4[_0x6c1c('0xf')](0x1f4,_0x4e5767[_0x6c1c('0x10')]));});});}; \ No newline at end of file +var _0x524e=['UpdateVoiceRecording','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','%s.cypher','recording','unlink','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording','update','options','where','attributes','limit'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x524e,0x15e));var _0xe524=function(_0xae88fb,_0x2d2b34){_0xae88fb=_0xae88fb-0x0;var _0x446d8d=_0x524e[_0xae88fb];return _0x446d8d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});}exports['UpdateVoiceRecording']=function(_0x3a4027){var _0x4f1dfb=this;return new Promise(function(_0x11b2a1,_0x238f8f){return db[_0xe524('0x16')][_0xe524('0x17')](_0x3a4027['body'],{'raw':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x19')]||null:null,'attributes':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1a')]||null:null,'limit':_0x3a4027[_0xe524('0x18')]?_0x3a4027[_0xe524('0x18')][_0xe524('0x1b')]||null:null})['then'](function(_0x7d1f92){logger['info']('UpdateVoiceRecording',_0x3a4027);logger[_0xe524('0x10')](_0xe524('0x1c'),_0x3a4027,JSON[_0xe524('0x12')](_0x7d1f92));_0x11b2a1(_0x7d1f92);})[_0xe524('0x1d')](function(_0x599d5d){logger[_0xe524('0x13')]('UpdateVoiceRecording',_0x599d5d[_0xe524('0x15')],_0x3a4027);_0x238f8f(_0x4f1dfb[_0xe524('0x13')](0x1f4,_0x599d5d[_0xe524('0x15')]));});});};exports[_0xe524('0x1e')]=function(_0x4102d9){var _0xfd5965=this;return new Promise(function(_0x2141db,_0x583cc3){var _0x58a896=require(_0xe524('0x1f'));var _0x45abad;return db[_0xe524('0x20')][_0xe524('0x21')]({'attributes':['id',_0xe524('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x52f140){_0x45abad=_0x52f140;return db[_0xe524('0x16')][_0xe524('0x23')](_0x4102d9[_0xe524('0x24')]);})[_0xe524('0xc')](function(_0x25c0a1){if(_0x45abad['callRecordingEncryption']&&fs[_0xe524('0x25')](_0x25c0a1[_0xe524('0x26')])){var _0x4a4e15=util['format'](_0xe524('0x27'),_0x25c0a1[_0xe524('0x26')]);return _0x58a896['encryptFile'](_0x25c0a1[_0xe524('0x26')],_0x4a4e15,config['secrets'][_0xe524('0x28')])['then'](function(){fs[_0xe524('0x29')](_0x25c0a1[_0xe524('0x26')]);logger[_0xe524('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x25c0a1;});}return _0x25c0a1;})[_0xe524('0xc')](function(_0x5238c9){logger[_0xe524('0xd')](_0xe524('0x1e'),_0x4102d9);logger[_0xe524('0x10')]('CreateVoiceRecording',_0x4102d9,JSON[_0xe524('0x12')](_0x5238c9));_0x2141db(_0x5238c9);})[_0xe524('0x1d')](function(_0x49c43e){logger[_0xe524('0x13')](_0xe524('0x1e'),_0x49c43e[_0xe524('0x15')],_0x4102d9);_0x583cc3(_0xfd5965[_0xe524('0x13')](0x1f4,_0x49c43e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index d78eb40..945ee14 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 _0x3f8c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2ebff5,_0x4c744b){var _0x21241b=function(_0x4d8e6b){while(--_0x4d8e6b){_0x2ebff5['push'](_0x2ebff5['shift']());}};_0x21241b(++_0x4c744b);}(_0x3f8c,0x90));var _0xc3f8=function(_0x1c4675,_0x5b4437){_0x1c4675=_0x1c4675-0x0;var _0x3ea5ea=_0x3f8c[_0x1c4675];return _0x3ea5ea;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc3f8('0x0'));var router=express[_0xc3f8('0x1')]();var fs_extra=require(_0xc3f8('0x2'));var auth=require(_0xc3f8('0x3'));var interaction=require(_0xc3f8('0x4'));var config=require(_0xc3f8('0x5'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0xc3f8('0x6')](),controller[_0xc3f8('0x7')]);router[_0xc3f8('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xc3f8('0x9')]);router['get'](_0xc3f8('0xa'),auth['isAuthenticated'](),controller[_0xc3f8('0xb')]);router[_0xc3f8('0xc')]('/',auth[_0xc3f8('0x6')](),controller[_0xc3f8('0xd')]);router[_0xc3f8('0xe')](_0xc3f8('0xa'),auth[_0xc3f8('0x6')](),controller[_0xc3f8('0xf')]);router[_0xc3f8('0x10')](_0xc3f8('0xa'),auth[_0xc3f8('0x6')](),controller[_0xc3f8('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2ea9=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x397127,_0x31429d){var _0x1d5516=function(_0x5c557f){while(--_0x5c557f){_0x397127['push'](_0x397127['shift']());}};_0x1d5516(++_0x31429d);}(_0x2ea9,0x94));var _0x92ea=function(_0x375dd4,_0x44213e){_0x375dd4=_0x375dd4-0x0;var _0x5c2006=_0x2ea9[_0x375dd4];return _0x5c2006;};'use strict';var multer=require('multer');var util=require(_0x92ea('0x0'));var path=require('path');var timeout=require(_0x92ea('0x1'));var express=require(_0x92ea('0x2'));var router=express[_0x92ea('0x3')]();var fs_extra=require(_0x92ea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92ea('0x5'));var config=require(_0x92ea('0x6'));var controller=require('./voiceTransferReport.controller');router[_0x92ea('0x7')]('/',auth[_0x92ea('0x8')](),controller[_0x92ea('0x9')]);router[_0x92ea('0x7')]('/describe',auth[_0x92ea('0x8')](),controller[_0x92ea('0xa')]);router[_0x92ea('0x7')](_0x92ea('0xb'),auth[_0x92ea('0x8')](),controller['show']);router[_0x92ea('0xc')]('/',auth[_0x92ea('0x8')](),controller['create']);router[_0x92ea('0xd')](_0x92ea('0xb'),auth[_0x92ea('0x8')](),controller[_0x92ea('0xe')]);router['delete'](_0x92ea('0xb'),auth['isAuthenticated'](),controller[_0x92ea('0xf')]);module[_0x92ea('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index e51ae33..20c8b43 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 _0x743f=['ENUM','blind','attended','STRING','moment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x743f,0xfa));var _0xf743=function(_0x5674a4,_0x21848d){_0x5674a4=_0x5674a4-0x0;var _0x55f742=_0x743f[_0x5674a4];return _0x55f742;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf743('0x0'));module[_0xf743('0x1')]={'type':{'type':Sequelize[_0xf743('0x2')](_0xf743('0x3'),_0xf743('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xf743('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xf743('0x5')]},'transfererexten':{'type':Sequelize[_0xf743('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xf743('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xf743('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf743('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xf743('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xf743('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xf743('0x5')]},'isexternal':{'type':Sequelize[_0xf743('0x2')]('Yes','No')},'context':{'type':Sequelize[_0xf743('0x5')]},'extension':{'type':Sequelize[_0xf743('0x5')]}}; \ No newline at end of file +var _0xd101=['exports','ENUM','STRING','Yes','sequelize','moment'];(function(_0x302533,_0x4e7e6a){var _0x1995f3=function(_0x1e5100){while(--_0x1e5100){_0x302533['push'](_0x302533['shift']());}};_0x1995f3(++_0x4e7e6a);}(_0xd101,0x1d2));var _0x1d10=function(_0x52cfe8,_0x312809){_0x52cfe8=_0x52cfe8-0x0;var _0x486e32=_0xd101[_0x52cfe8];return _0x486e32;};'use strict';var Sequelize=require(_0x1d10('0x0'));var moment=require(_0x1d10('0x1'));module[_0x1d10('0x2')]={'type':{'type':Sequelize[_0x1d10('0x3')]('blind','attended')},'result':{'type':Sequelize[_0x1d10('0x4')]},'transfererchannel':{'type':Sequelize[_0x1d10('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x1d10('0x4')]},'transferercalleridname':{'type':Sequelize[_0x1d10('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1d10('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x1d10('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x1d10('0x4')]},'transferercontext':{'type':Sequelize[_0x1d10('0x4')]},'transfererexten':{'type':Sequelize[_0x1d10('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x1d10('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x1d10('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x1d10('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1d10('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x1d10('0x4')]},'transfereecontext':{'type':Sequelize[_0x1d10('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x1d10('0x4')]},'isexternal':{'type':Sequelize[_0x1d10('0x3')](_0x1d10('0x5'),'No')},'context':{'type':Sequelize[_0x1d10('0x4')]},'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 aaffa7e..1c6f958 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 _0x68ca=['util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','show','length','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x29e8f0,_0x912eb8){var _0x37d0d9=function(_0x12e240){while(--_0x12e240){_0x29e8f0['push'](_0x29e8f0['shift']());}};_0x37d0d9(++_0x912eb8);}(_0x68ca,0x1cc));var _0xa68c=function(_0x1d28c6,_0x3c9cb6){_0x1d28c6=_0x1d28c6-0x0;var _0x465e3a=_0x68ca[_0x1d28c6];return _0x465e3a;};'use strict';var emlformat=require(_0xa68c('0x0'));var rimraf=require(_0xa68c('0x1'));var zipdir=require(_0xa68c('0x2'));var jsonpatch=require(_0xa68c('0x3'));var rp=require(_0xa68c('0x4'));var moment=require(_0xa68c('0x5'));var BPromise=require(_0xa68c('0x6'));var Mustache=require(_0xa68c('0x7'));var util=require(_0xa68c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa68c('0x9'));var ejs=require(_0xa68c('0xa'));var fs=require('fs');var fs_extra=require(_0xa68c('0xb'));var _=require(_0xa68c('0xc'));var squel=require(_0xa68c('0xd'));var crypto=require(_0xa68c('0xe'));var jsforce=require(_0xa68c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa68c('0x10'));var Papa=require(_0xa68c('0x11'));var Redis=require(_0xa68c('0x12'));var authService=require(_0xa68c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa68c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa68c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa68c('0x16'));var licenseUtil=require(_0xa68c('0x17'));var db=require(_0xa68c('0x18'))['db'];function respondWithStatusCode(_0x40fc09,_0x48b644){_0x48b644=_0x48b644||0xcc;return function(_0x29843e){if(_0x29843e){return _0x40fc09['sendStatus'](_0x48b644);}return _0x40fc09['status'](_0x48b644)['end']();};}function respondWithResult(_0x5ba983,_0x614dcc){_0x614dcc=_0x614dcc||0xc8;return function(_0x18f631){if(_0x18f631){return _0x5ba983[_0xa68c('0x19')](_0x614dcc)['json'](_0x18f631);}};}function respondWithFilteredResult(_0x5d8a1c,_0x2656e2){return function(_0x9b5b0d){if(_0x9b5b0d){var _0x23a0af=typeof _0x2656e2[_0xa68c('0x1a')]===_0xa68c('0x1b')&&typeof _0x2656e2[_0xa68c('0x1c')]===_0xa68c('0x1b');var _0x546671=_0x9b5b0d[_0xa68c('0x1d')];var _0x609c0c=_0x23a0af?0x0:_0x2656e2['offset'];var _0x3faf27=_0x23a0af?_0x9b5b0d['count']:_0x2656e2['offset']+_0x2656e2[_0xa68c('0x1c')];var _0x4f2518;if(_0x3faf27>=_0x546671){_0x3faf27=_0x546671;_0x4f2518=0xc8;}else{_0x4f2518=0xce;}_0x5d8a1c[_0xa68c('0x19')](_0x4f2518);return _0x5d8a1c[_0xa68c('0x1e')](_0xa68c('0x1f'),_0x609c0c+'-'+_0x3faf27+'/'+_0x546671)['json'](_0x9b5b0d);}return null;};}function patchUpdates(_0x593071){return function(_0x3dd8fe){try{jsonpatch[_0xa68c('0x20')](_0x3dd8fe,_0x593071,!![]);}catch(_0x8b3582){return BPromise['reject'](_0x8b3582);}return _0x3dd8fe[_0xa68c('0x21')]();};}function saveUpdates(_0x3a61ca,_0x1a9b24){return function(_0x4770d1){if(_0x4770d1){return _0x4770d1[_0xa68c('0x22')](_0x3a61ca)['then'](function(_0x536882){return _0x536882;});}return null;};}function removeEntity(_0x11037a,_0x1e6073){return function(_0x385ed5){if(_0x385ed5){return _0x385ed5[_0xa68c('0x23')]()[_0xa68c('0x24')](function(){_0x11037a[_0xa68c('0x19')](0xcc)[_0xa68c('0x25')]();});}};}function handleEntityNotFound(_0x1b8e78,_0x329f04){return function(_0x33ef98){if(!_0x33ef98){_0x1b8e78[_0xa68c('0x26')](0x194);}return _0x33ef98;};}function handleError(_0x594376,_0x160e7d){_0x160e7d=_0x160e7d||0x1f4;return function(_0x614443){logger[_0xa68c('0x27')](_0x614443[_0xa68c('0x28')]);if(_0x614443[_0xa68c('0x29')]){delete _0x614443[_0xa68c('0x29')];}_0x594376[_0xa68c('0x19')](_0x160e7d)[_0xa68c('0x2a')](_0x614443);};}exports[_0xa68c('0x2b')]=function(_0x4eea9e,_0x4696e5){var _0x3ac127={},_0xbf9c52={},_0x500fc0={'count':0x0,'rows':[]};var _0x402767=_[_0xa68c('0x2c')](db['VoiceTransferReport'][_0xa68c('0x2d')],function(_0x356b45){return{'name':_0x356b45['fieldName'],'type':_0x356b45['type'][_0xa68c('0x2e')]};});_0xbf9c52[_0xa68c('0x2f')]=_[_0xa68c('0x2c')](_0x402767,_0xa68c('0x29'));_0xbf9c52[_0xa68c('0x30')]=_[_0xa68c('0x31')](_0x4eea9e['query']);_0xbf9c52[_0xa68c('0x32')]=_['intersection'](_0xbf9c52[_0xa68c('0x2f')],_0xbf9c52[_0xa68c('0x30')]);_0x3ac127[_0xa68c('0x33')]=_[_0xa68c('0x34')](_0xbf9c52[_0xa68c('0x2f')],qs[_0xa68c('0x35')](_0x4eea9e[_0xa68c('0x30')]['fields']));_0x3ac127['attributes']=_0x3ac127['attributes']['length']?_0x3ac127['attributes']:_0xbf9c52['model'];if(!_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x36')](_0xa68c('0x37'))){_0x3ac127[_0xa68c('0x1c')]=qs[_0xa68c('0x1c')](_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x1c')]);_0x3ac127[_0xa68c('0x1a')]=qs['offset'](_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x1a')]);}_0x3ac127[_0xa68c('0x38')]=qs['sort'](_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x39')]);_0x3ac127[_0xa68c('0x3a')]=qs[_0xa68c('0x32')](_[_0xa68c('0x3b')](_0x4eea9e['query'],_0xbf9c52['filters']),_0x402767);if(_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x3c')]){_0x3ac127['where']=_[_0xa68c('0x3d')](_0x3ac127[_0xa68c('0x3a')],{'$or':_[_0xa68c('0x2c')](_0x402767,function(_0x2ad43d){if(_0x2ad43d[_0xa68c('0x3e')]!==_0xa68c('0x3f')){var _0x1ab0c7={};_0x1ab0c7[_0x2ad43d['name']]={'$like':'%'+_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x3c')]+'%'};return _0x1ab0c7;}})});}_0x3ac127=_[_0xa68c('0x3d')]({},_0x3ac127,_0x4eea9e[_0xa68c('0x40')]);var _0x201c95={'where':_0x3ac127[_0xa68c('0x3a')]};return db[_0xa68c('0x41')][_0xa68c('0x1d')](_0x201c95)[_0xa68c('0x24')](function(_0x44ecf0){_0x500fc0['count']=_0x44ecf0;if(_0x4eea9e[_0xa68c('0x30')][_0xa68c('0x42')]){_0x3ac127[_0xa68c('0x43')]=[{'all':!![]}];}return db[_0xa68c('0x41')][_0xa68c('0x44')](_0x3ac127);})[_0xa68c('0x24')](function(_0x401ca4){_0x500fc0[_0xa68c('0x45')]=_0x401ca4;return _0x500fc0;})[_0xa68c('0x24')](respondWithFilteredResult(_0x4696e5,_0x3ac127))['catch'](handleError(_0x4696e5,null));};exports[_0xa68c('0x46')]=function(_0x2ca1ab,_0xb77521){var _0x4e39cb={'raw':!![],'where':{'id':_0x2ca1ab['params']['id']}},_0x1012f7={};_0x1012f7[_0xa68c('0x2f')]=_[_0xa68c('0x31')](db['VoiceTransferReport']['rawAttributes']);_0x1012f7[_0xa68c('0x30')]=_['keys'](_0x2ca1ab[_0xa68c('0x30')]);_0x1012f7[_0xa68c('0x32')]=_[_0xa68c('0x34')](_0x1012f7[_0xa68c('0x2f')],_0x1012f7[_0xa68c('0x30')]);_0x4e39cb[_0xa68c('0x33')]=_[_0xa68c('0x34')](_0x1012f7[_0xa68c('0x2f')],qs['fields'](_0x2ca1ab[_0xa68c('0x30')][_0xa68c('0x35')]));_0x4e39cb[_0xa68c('0x33')]=_0x4e39cb[_0xa68c('0x33')][_0xa68c('0x47')]?_0x4e39cb[_0xa68c('0x33')]:_0x1012f7['model'];if(_0x2ca1ab[_0xa68c('0x30')][_0xa68c('0x42')]){_0x4e39cb[_0xa68c('0x43')]=[{'all':!![]}];}_0x4e39cb=_['merge']({},_0x4e39cb,_0x2ca1ab['options']);return db[_0xa68c('0x41')]['find'](_0x4e39cb)['then'](handleEntityNotFound(_0xb77521,null))[_0xa68c('0x24')](respondWithResult(_0xb77521,null))[_0xa68c('0x48')](handleError(_0xb77521,null));};exports['create']=function(_0x25215b,_0x1de2dc){return db[_0xa68c('0x41')][_0xa68c('0x49')](_0x25215b[_0xa68c('0x4a')],{})[_0xa68c('0x24')](respondWithResult(_0x1de2dc,0xc9))[_0xa68c('0x48')](handleError(_0x1de2dc,null));};exports[_0xa68c('0x22')]=function(_0x1e7a44,_0x3a5292){if(_0x1e7a44[_0xa68c('0x4a')]['id']){delete _0x1e7a44[_0xa68c('0x4a')]['id'];}return db[_0xa68c('0x41')][_0xa68c('0x4b')]({'where':{'id':_0x1e7a44[_0xa68c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3a5292,null))[_0xa68c('0x24')](saveUpdates(_0x1e7a44[_0xa68c('0x4a')],null))[_0xa68c('0x24')](respondWithResult(_0x3a5292,null))[_0xa68c('0x48')](handleError(_0x3a5292,null));};exports[_0xa68c('0x23')]=function(_0xf1c6f9,_0x4700fa){return db[_0xa68c('0x41')][_0xa68c('0x4b')]({'where':{'id':_0xf1c6f9['params']['id']}})[_0xa68c('0x24')](handleEntityNotFound(_0x4700fa,null))[_0xa68c('0x24')](removeEntity(_0x4700fa,null))[_0xa68c('0x48')](handleError(_0x4700fa,null));};exports[_0xa68c('0x4d')]=function(_0x28fc81,_0x3ea59e){return db['VoiceTransferReport'][_0xa68c('0x4d')]()[_0xa68c('0x24')](respondWithResult(_0x3ea59e,null))[_0xa68c('0x48')](handleError(_0x3ea59e,null));}; \ No newline at end of file +var _0x95cf=['keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','include','find','create','body','params','describe','eml-format','moment','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','reject','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','model'];(function(_0x103a30,_0x3a0154){var _0x182dad=function(_0x7afd45){while(--_0x7afd45){_0x103a30['push'](_0x103a30['shift']());}};_0x182dad(++_0x3a0154);}(_0x95cf,0x169));var _0xf95c=function(_0x5a0078,_0x2505ac){_0x5a0078=_0x5a0078-0x0;var _0x92d5c2=_0x95cf[_0x5a0078];return _0x92d5c2;};'use strict';var emlformat=require(_0xf95c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf95c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xf95c('0x2'));var util=require('util');var path=require(_0xf95c('0x3'));var sox=require('sox');var csv=require(_0xf95c('0x4'));var ejs=require(_0xf95c('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf95c('0x6'));var crypto=require(_0xf95c('0x7'));var jsforce=require(_0xf95c('0x8'));var deskjs=require(_0xf95c('0x9'));var toCsv=require(_0xf95c('0x4'));var querystring=require(_0xf95c('0xa'));var Papa=require(_0xf95c('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf95c('0xc'));var as=require(_0xf95c('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf95c('0xe'))(_0xf95c('0xf'));var utils=require(_0xf95c('0x10'));var config=require(_0xf95c('0x11'));var licenseUtil=require(_0xf95c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x373857,_0x22badf){_0x22badf=_0x22badf||0xcc;return function(_0x2cfd28){if(_0x2cfd28){return _0x373857[_0xf95c('0x13')](_0x22badf);}return _0x373857[_0xf95c('0x14')](_0x22badf)[_0xf95c('0x15')]();};}function respondWithResult(_0x28f374,_0x1877ee){_0x1877ee=_0x1877ee||0xc8;return function(_0x3abd68){if(_0x3abd68){return _0x28f374[_0xf95c('0x14')](_0x1877ee)['json'](_0x3abd68);}};}function respondWithFilteredResult(_0x508189,_0x98e46c){return function(_0xda686a){if(_0xda686a){var _0x4c3036=typeof _0x98e46c[_0xf95c('0x16')]===_0xf95c('0x17')&&typeof _0x98e46c[_0xf95c('0x18')]===_0xf95c('0x17');var _0x31afde=_0xda686a[_0xf95c('0x19')];var _0x31271b=_0x4c3036?0x0:_0x98e46c[_0xf95c('0x16')];var _0x484683=_0x4c3036?_0xda686a[_0xf95c('0x19')]:_0x98e46c[_0xf95c('0x16')]+_0x98e46c[_0xf95c('0x18')];var _0x2ae836;if(_0x484683>=_0x31afde){_0x484683=_0x31afde;_0x2ae836=0xc8;}else{_0x2ae836=0xce;}_0x508189[_0xf95c('0x14')](_0x2ae836);return _0x508189[_0xf95c('0x1a')]('Content-Range',_0x31271b+'-'+_0x484683+'/'+_0x31afde)['json'](_0xda686a);}return null;};}function patchUpdates(_0x3b55e5){return function(_0xd8244c){try{jsonpatch['apply'](_0xd8244c,_0x3b55e5,!![]);}catch(_0x3c071b){return BPromise[_0xf95c('0x1b')](_0x3c071b);}return _0xd8244c['save']();};}function saveUpdates(_0x117117,_0x11d6e3){return function(_0x392bfc){if(_0x392bfc){return _0x392bfc['update'](_0x117117)[_0xf95c('0x1c')](function(_0x27891e){return _0x27891e;});}return null;};}function removeEntity(_0x58cc97,_0x53e4b0){return function(_0x52593b){if(_0x52593b){return _0x52593b[_0xf95c('0x1d')]()[_0xf95c('0x1c')](function(){_0x58cc97[_0xf95c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x551971,_0x2b16ff){return function(_0x1ffd80){if(!_0x1ffd80){_0x551971['sendStatus'](0x194);}return _0x1ffd80;};}function handleError(_0x4cc9d2,_0x1a4ef0){_0x1a4ef0=_0x1a4ef0||0x1f4;return function(_0x345aeb){logger[_0xf95c('0x1e')](_0x345aeb[_0xf95c('0x1f')]);if(_0x345aeb['name']){delete _0x345aeb[_0xf95c('0x20')];}_0x4cc9d2[_0xf95c('0x14')](_0x1a4ef0)[_0xf95c('0x21')](_0x345aeb);};}exports[_0xf95c('0x22')]=function(_0x3ee7b0,_0x3f236c){var _0x52cdb5={},_0x561ae2={},_0x1d6794={'count':0x0,'rows':[]};var _0x1d0f98=_[_0xf95c('0x23')](db[_0xf95c('0x24')][_0xf95c('0x25')],function(_0x56a821){return{'name':_0x56a821['fieldName'],'type':_0x56a821[_0xf95c('0x26')][_0xf95c('0x27')]};});_0x561ae2[_0xf95c('0x28')]=_[_0xf95c('0x23')](_0x1d0f98,_0xf95c('0x20'));_0x561ae2['query']=_[_0xf95c('0x29')](_0x3ee7b0['query']);_0x561ae2[_0xf95c('0x2a')]=_[_0xf95c('0x2b')](_0x561ae2['model'],_0x561ae2[_0xf95c('0x2c')]);_0x52cdb5[_0xf95c('0x2d')]=_[_0xf95c('0x2b')](_0x561ae2['model'],qs['fields'](_0x3ee7b0[_0xf95c('0x2c')][_0xf95c('0x2e')]));_0x52cdb5[_0xf95c('0x2d')]=_0x52cdb5[_0xf95c('0x2d')][_0xf95c('0x2f')]?_0x52cdb5['attributes']:_0x561ae2[_0xf95c('0x28')];if(!_0x3ee7b0[_0xf95c('0x2c')][_0xf95c('0x30')](_0xf95c('0x31'))){_0x52cdb5[_0xf95c('0x18')]=qs[_0xf95c('0x18')](_0x3ee7b0['query'][_0xf95c('0x18')]);_0x52cdb5[_0xf95c('0x16')]=qs[_0xf95c('0x16')](_0x3ee7b0['query'][_0xf95c('0x16')]);}_0x52cdb5[_0xf95c('0x32')]=qs[_0xf95c('0x33')](_0x3ee7b0[_0xf95c('0x2c')]['sort']);_0x52cdb5[_0xf95c('0x34')]=qs[_0xf95c('0x2a')](_[_0xf95c('0x35')](_0x3ee7b0[_0xf95c('0x2c')],_0x561ae2[_0xf95c('0x2a')]),_0x1d0f98);if(_0x3ee7b0[_0xf95c('0x2c')][_0xf95c('0x36')]){_0x52cdb5['where']=_[_0xf95c('0x37')](_0x52cdb5[_0xf95c('0x34')],{'$or':_[_0xf95c('0x23')](_0x1d0f98,function(_0x1ad59a){if(_0x1ad59a[_0xf95c('0x26')]!==_0xf95c('0x38')){var _0x9c3544={};_0x9c3544[_0x1ad59a[_0xf95c('0x20')]]={'$like':'%'+_0x3ee7b0['query'][_0xf95c('0x36')]+'%'};return _0x9c3544;}})});}_0x52cdb5=_['merge']({},_0x52cdb5,_0x3ee7b0[_0xf95c('0x39')]);var _0x18630c={'where':_0x52cdb5['where']};return db['VoiceTransferReport'][_0xf95c('0x19')](_0x18630c)['then'](function(_0x115430){_0x1d6794[_0xf95c('0x19')]=_0x115430;if(_0x3ee7b0['query'][_0xf95c('0x3a')]){_0x52cdb5['include']=[{'all':!![]}];}return db[_0xf95c('0x24')]['findAll'](_0x52cdb5);})[_0xf95c('0x1c')](function(_0x46b978){_0x1d6794[_0xf95c('0x3b')]=_0x46b978;return _0x1d6794;})[_0xf95c('0x1c')](respondWithFilteredResult(_0x3f236c,_0x52cdb5))[_0xf95c('0x3c')](handleError(_0x3f236c,null));};exports['show']=function(_0x795116,_0x52c39c){var _0x2827ca={'raw':!![],'where':{'id':_0x795116['params']['id']}},_0x23db22={};_0x23db22[_0xf95c('0x28')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x23db22['query']=_[_0xf95c('0x29')](_0x795116[_0xf95c('0x2c')]);_0x23db22[_0xf95c('0x2a')]=_[_0xf95c('0x2b')](_0x23db22[_0xf95c('0x28')],_0x23db22[_0xf95c('0x2c')]);_0x2827ca[_0xf95c('0x2d')]=_[_0xf95c('0x2b')](_0x23db22[_0xf95c('0x28')],qs[_0xf95c('0x2e')](_0x795116['query']['fields']));_0x2827ca[_0xf95c('0x2d')]=_0x2827ca[_0xf95c('0x2d')]['length']?_0x2827ca['attributes']:_0x23db22[_0xf95c('0x28')];if(_0x795116[_0xf95c('0x2c')][_0xf95c('0x3a')]){_0x2827ca[_0xf95c('0x3d')]=[{'all':!![]}];}_0x2827ca=_[_0xf95c('0x37')]({},_0x2827ca,_0x795116[_0xf95c('0x39')]);return db['VoiceTransferReport'][_0xf95c('0x3e')](_0x2827ca)[_0xf95c('0x1c')](handleEntityNotFound(_0x52c39c,null))[_0xf95c('0x1c')](respondWithResult(_0x52c39c,null))[_0xf95c('0x3c')](handleError(_0x52c39c,null));};exports[_0xf95c('0x3f')]=function(_0x5ba327,_0x2dce59){return db[_0xf95c('0x24')][_0xf95c('0x3f')](_0x5ba327[_0xf95c('0x40')],{})[_0xf95c('0x1c')](respondWithResult(_0x2dce59,0xc9))[_0xf95c('0x3c')](handleError(_0x2dce59,null));};exports['update']=function(_0x28f2b8,_0x3a659e){if(_0x28f2b8[_0xf95c('0x40')]['id']){delete _0x28f2b8[_0xf95c('0x40')]['id'];}return db[_0xf95c('0x24')][_0xf95c('0x3e')]({'where':{'id':_0x28f2b8[_0xf95c('0x41')]['id']}})[_0xf95c('0x1c')](handleEntityNotFound(_0x3a659e,null))[_0xf95c('0x1c')](saveUpdates(_0x28f2b8['body'],null))[_0xf95c('0x1c')](respondWithResult(_0x3a659e,null))[_0xf95c('0x3c')](handleError(_0x3a659e,null));};exports['destroy']=function(_0x4b3af6,_0x1a47d9){return db[_0xf95c('0x24')][_0xf95c('0x3e')]({'where':{'id':_0x4b3af6[_0xf95c('0x41')]['id']}})[_0xf95c('0x1c')](handleEntityNotFound(_0x1a47d9,null))['then'](removeEntity(_0x1a47d9,null))[_0xf95c('0x3c')](handleError(_0x1a47d9,null));};exports[_0xf95c('0x42')]=function(_0x497cf5,_0x614c15){return db[_0xf95c('0x24')][_0xf95c('0x42')]()[_0xf95c('0x1c')](respondWithResult(_0x614c15,null))[_0xf95c('0x3c')](handleError(_0x614c15,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 28d2f80..79b383c 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 _0x6347=['bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util','../../config/logger','api'];(function(_0x1c05c7,_0x3eeb38){var _0x16e1e7=function(_0x5e790f){while(--_0x5e790f){_0x1c05c7['push'](_0x1c05c7['shift']());}};_0x16e1e7(++_0x3eeb38);}(_0x6347,0xec));var _0x7634=function(_0xd9a7cd,_0x77c637){_0xd9a7cd=_0xd9a7cd-0x0;var _0xf17af7=_0x6347[_0xd9a7cd];return _0xf17af7;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var logger=require(_0x7634('0x2'))(_0x7634('0x3'));var moment=require('moment');var BPromise=require(_0x7634('0x4'));var rp=require(_0x7634('0x5'));var fs=require('fs');var path=require(_0x7634('0x6'));var rimraf=require('rimraf');var config=require(_0x7634('0x7'));var attributes=require(_0x7634('0x8'));module[_0x7634('0x9')]=function(_0x213b0d,_0x1dce3c){return _0x213b0d[_0x7634('0xa')]('VoiceTransferReport',attributes,{'tableName':_0x7634('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6efd=['util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0x6efd,0x1af));var _0xd6ef=function(_0x333bb4,_0x48ab05){_0x333bb4=_0x333bb4-0x0;var _0x56f499=_0x6efd[_0x333bb4];return _0x56f499;};'use strict';var _=require(_0xd6ef('0x0'));var util=require(_0xd6ef('0x1'));var logger=require(_0xd6ef('0x2'))(_0xd6ef('0x3'));var moment=require(_0xd6ef('0x4'));var BPromise=require('bluebird');var rp=require(_0xd6ef('0x5'));var fs=require('fs');var path=require(_0xd6ef('0x6'));var rimraf=require(_0xd6ef('0x7'));var config=require('../../config/environment');var attributes=require(_0xd6ef('0x8'));module[_0xd6ef('0x9')]=function(_0x5dc81a,_0x39a3dd){return _0x5dc81a[_0xd6ef('0xa')](_0xd6ef('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 0955af0..060c651 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 _0xb59e=['then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x414c00,_0x37a5b7){var _0x3a5018=function(_0x16563c){while(--_0x16563c){_0x414c00['push'](_0x414c00['shift']());}};_0x3a5018(++_0x37a5b7);}(_0xb59e,0x1e3));var _0xeb59=function(_0x18341f,_0x4dc568){_0x18341f=_0x18341f-0x0;var _0x49f61b=_0xb59e[_0x18341f];return _0x49f61b;};'use strict';var _=require(_0xeb59('0x0'));var util=require(_0xeb59('0x1'));var moment=require(_0xeb59('0x2'));var BPromise=require(_0xeb59('0x3'));var rs=require(_0xeb59('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb59('0x5'))['db'];var utils=require(_0xeb59('0x6'));var logger=require('../../config/logger')(_0xeb59('0x7'));var config=require(_0xeb59('0x8'));var jayson=require(_0xeb59('0x9'));var client=jayson[_0xeb59('0xa')][_0xeb59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x504879,_0x2c1b8c,_0x10949a){return new BPromise(function(_0x338ab8,_0x312078){return client[_0xeb59('0xc')](_0x504879,_0x10949a)[_0xeb59('0xd')](function(_0x5d3a7f){logger['info'](_0xeb59('0xe'),_0x2c1b8c,_0xeb59('0xf'));logger[_0xeb59('0x10')](_0xeb59('0x11'),_0x2c1b8c,_0xeb59('0xf'),JSON[_0xeb59('0x12')](_0x5d3a7f));if(_0x5d3a7f[_0xeb59('0x13')]){if(_0x5d3a7f[_0xeb59('0x13')][_0xeb59('0x14')]===0x1f4){logger['error'](_0xeb59('0xe'),_0x2c1b8c,_0x5d3a7f[_0xeb59('0x13')][_0xeb59('0x15')]);return _0x312078(_0x5d3a7f['error']['message']);}logger[_0xeb59('0x13')](_0xeb59('0xe'),_0x2c1b8c,_0x5d3a7f[_0xeb59('0x13')][_0xeb59('0x15')]);return _0x338ab8(_0x5d3a7f[_0xeb59('0x13')][_0xeb59('0x15')]);}else{logger[_0xeb59('0x16')]('VoiceTransferReport,\x20%s,\x20%s',_0x2c1b8c,_0xeb59('0xf'));_0x338ab8(_0x5d3a7f[_0xeb59('0x17')]['message']);}})[_0xeb59('0x18')](function(_0x49ee2f){logger[_0xeb59('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x2c1b8c,_0x49ee2f);_0x312078(_0x49ee2f);});});}exports['CreateVoiceTransferReport']=function(_0x4bafd7){var _0x105a73=this;return new Promise(function(_0x14b162,_0x5d6526){return db[_0xeb59('0x19')][_0xeb59('0x1a')](_0x4bafd7[_0xeb59('0x1b')],{'raw':_0x4bafd7[_0xeb59('0x1c')]?_0x4bafd7[_0xeb59('0x1c')][_0xeb59('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0xf12b72){logger[_0xeb59('0x16')](_0xeb59('0x1e'),_0x4bafd7);logger['debug'](_0xeb59('0x1e'),_0x4bafd7,JSON['stringify'](_0xf12b72));_0x14b162(_0xf12b72);})[_0xeb59('0x18')](function(_0x34575d){logger[_0xeb59('0x13')]('CreateVoiceTransferReport',_0x34575d['message'],_0x4bafd7);_0x5d6526(_0x105a73[_0xeb59('0x13')](0x1f4,_0x34575d[_0xeb59('0x15')]));});});}; \ No newline at end of file +var _0x742c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','VoiceTransferReport','create','body','raw','CreateVoiceTransferReport','lodash'];(function(_0x558849,_0x113740){var _0x4149cd=function(_0x4779e6){while(--_0x4779e6){_0x558849['push'](_0x558849['shift']());}};_0x4149cd(++_0x113740);}(_0x742c,0x197));var _0xc742=function(_0x473738,_0x15ea31){_0x473738=_0x473738-0x0;var _0x1df4ae=_0x742c[_0x473738];return _0x1df4ae;};'use strict';var _=require(_0xc742('0x0'));var util=require('util');var moment=require(_0xc742('0x1'));var BPromise=require(_0xc742('0x2'));var rs=require(_0xc742('0x3'));var fs=require('fs');var Redis=require(_0xc742('0x4'));var db=require(_0xc742('0x5'))['db'];var utils=require(_0xc742('0x6'));var logger=require('../../config/logger')(_0xc742('0x7'));var config=require(_0xc742('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1211b5,_0x384a4f,_0xfd4a9d){return new BPromise(function(_0x25852d,_0x2d8219){return client[_0xc742('0x9')](_0x1211b5,_0xfd4a9d)[_0xc742('0xa')](function(_0x132f97){logger[_0xc742('0xb')](_0xc742('0xc'),_0x384a4f,'request\x20sent');logger[_0xc742('0xd')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x384a4f,_0xc742('0xe'),JSON['stringify'](_0x132f97));if(_0x132f97['error']){if(_0x132f97[_0xc742('0xf')]['code']===0x1f4){logger[_0xc742('0xf')](_0xc742('0xc'),_0x384a4f,_0x132f97[_0xc742('0xf')][_0xc742('0x10')]);return _0x2d8219(_0x132f97[_0xc742('0xf')][_0xc742('0x10')]);}logger[_0xc742('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x384a4f,_0x132f97[_0xc742('0xf')][_0xc742('0x10')]);return _0x25852d(_0x132f97['error'][_0xc742('0x10')]);}else{logger[_0xc742('0xb')](_0xc742('0xc'),_0x384a4f,_0xc742('0xe'));_0x25852d(_0x132f97[_0xc742('0x11')]['message']);}})[_0xc742('0x12')](function(_0x47fb72){logger[_0xc742('0xf')](_0xc742('0xc'),_0x384a4f,_0x47fb72);_0x2d8219(_0x47fb72);});});}exports['CreateVoiceTransferReport']=function(_0x1bb447){var _0x418b95=this;return new Promise(function(_0x3a5642,_0x1b2b47){return db[_0xc742('0x13')][_0xc742('0x14')](_0x1bb447[_0xc742('0x15')],{'raw':_0x1bb447['options']?_0x1bb447['options'][_0xc742('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x536f78){logger[_0xc742('0xb')](_0xc742('0x17'),_0x1bb447);logger['debug']('CreateVoiceTransferReport',_0x1bb447,JSON['stringify'](_0x536f78));_0x3a5642(_0x536f78);})[_0xc742('0x12')](function(_0xddedc7){logger[_0xc742('0xf')](_0xc742('0x17'),_0xddedc7['message'],_0x1bb447);_0x1b2b47(_0x418b95['error'](0x1f4,_0xddedc7[_0xc742('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 7248b06..ef7ce66 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 _0x70e0=['unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','answer','post','/hold','/unhold'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x70e0,0x17b));var _0x070e=function(_0x4a8718,_0x50de2c){_0x4a8718=_0x4a8718-0x0;var _0x4a0c6d=_0x70e0[_0x4a8718];return _0x4a0c6d;};'use strict';var express=require(_0x070e('0x0'));var router=express[_0x070e('0x1')]();var auth=require(_0x070e('0x2'));var controller=require('./webbar.controller');router['post'](_0x070e('0x3'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x6')]);router['post'](_0x070e('0x7'),auth['isAuthenticated'](),auth[_0x070e('0x5')](),controller['hangup']);router['post']('/answer',auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x8')]);router[_0x070e('0x9')](_0x070e('0xa'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller['hold']);router['post'](_0x070e('0xb'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xc')]);router[_0x070e('0x9')](_0x070e('0xd'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xe')]);router[_0x070e('0x9')](_0x070e('0xf'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x070e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb43b,0x1b2));var _0xbb43=function(_0x301f1a,_0x3aebe3){_0x301f1a=_0x301f1a-0x0;var _0x18595a=_0xb43b[_0x301f1a];return _0x18595a;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b15e094..b5182dd 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 _0xe5b3=['string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','UserId','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','socket.io-emitter','validate','number','callNumber\x20is\x20required'];(function(_0x4160c2,_0x517b9b){var _0x473c62=function(_0x46f5fd){while(--_0x46f5fd){_0x4160c2['push'](_0x4160c2['shift']());}};_0x473c62(++_0x517b9b);}(_0xe5b3,0x133));var _0x3e5b=function(_0xfbcec7,_0x24d860){_0xfbcec7=_0xfbcec7-0x0;var _0x1d8626=_0xe5b3[_0xfbcec7];return _0x1d8626;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x3e5b('0x0'));var db=require(_0x3e5b('0x1'))['db'];var config=require(_0x3e5b('0x2'));var util=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var jayson=require(_0x3e5b('0x5'));var amiClient=jayson[_0x3e5b('0x6')][_0x3e5b('0x7')]({'port':0x232a});var logger=require(_0x3e5b('0x8'))(_0x3e5b('0x9'));var Redis=require(_0x3e5b('0xa'));config['redis']=_[_0x3e5b('0xb')](config[_0x3e5b('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x3e5b('0xd'))(new Redis(config[_0x3e5b('0xc')]));var Schema=require(_0x3e5b('0xe'));var originateValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x3e5b('0x10')]},'callerId':{'type':_0x3e5b('0x11')},'callbackUrl':{'type':_0x3e5b('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e5b('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':_0x3e5b('0x11'),'required':[!![],_0x3e5b('0x13')]},'transferNumber':{'type':_0x3e5b('0x11'),'required':[!![],_0x3e5b('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e5b('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e5b('0x12')]}});function emit(_0x59ddc0,_0x56a453,_0x258d6a){logger[_0x3e5b('0x15')](_0x59ddc0,_0x56a453,JSON['stringify'](_0x258d6a));io['to'](_0x59ddc0)[_0x3e5b('0x16')](_0x56a453,_0x258d6a);}function handleError(_0x143040){return function(_0x555002){console[_0x3e5b('0x17')](_0x3e5b('0x18'),_0x555002,_0x555002 instanceof RangeError);logger['error'](_0x555002['stack']);if(_0x555002 instanceof RangeError){if(_0x555002[_0x3e5b('0x19')]){delete _0x555002[_0x3e5b('0x19')];}_0x143040[_0x3e5b('0x1a')](0x194)[_0x3e5b('0x1b')](_0x555002);}else{if(_0x555002[_0x3e5b('0x19')]){delete _0x555002[_0x3e5b('0x19')];}_0x143040[_0x3e5b('0x1a')](0x1f4)[_0x3e5b('0x1b')](_0x555002);}};}function checkError(){return function(_0x36c988){if(!_0x36c988){throw new RangeError(_0x3e5b('0x1c'));}return _0x36c988;};}function respondWithRpcPromise(_0x2b977c,_0x11e5cf){return new BPromise(function(_0x2d77cc,_0x402873){var _0x5b46d4=amiClient;return _0x5b46d4[_0x3e5b('0x1d')](_0x2b977c,_0x11e5cf)[_0x3e5b('0x1e')](function(_0x2146d4){if(_0x2146d4[_0x3e5b('0x1f')]){if(_0x2146d4['error'][_0x3e5b('0x20')]===0x1f4){return _0x402873(_0x2146d4['error'][_0x3e5b('0x21')]);}return _0x2d77cc(_0x2146d4[_0x3e5b('0x1f')]['message']);}else{_0x2d77cc(_0x2146d4[_0x3e5b('0x22')]);}})[_0x3e5b('0x23')](function(_0x42d7e9){_0x402873(_0x42d7e9);});});}function getAgent(_0x3c8965){return db[_0x3e5b('0x24')][_0x3e5b('0x25')]({'where':{'id':_0x3c8965,'role':_0x3e5b('0x26')}})[_0x3e5b('0x1e')](checkError());}function getAgentCheckSession(_0x4c4b89,_0x1c7278){return new BPromise(function(_0x505f40,_0xb70ab4){var _0x4fd64b=respondWithRpcPromise(_0x3e5b('0x27'));var _0x1f6473=getAgent(_0x4c4b89);Promise[_0x3e5b('0x28')]([_0x4fd64b,_0x1f6473])[_0x3e5b('0x1e')](function(_0x10d2ed){var _0x3cfaf6=_0x10d2ed[0x0];var _0x307091=_0x10d2ed[0x1];var _0x9c2123=_[_0x3e5b('0x29')](_0x3cfaf6[_0x3e5b('0x2a')],function(_0x1e1565){return _0x1e1565['UserId']==_0x307091['id']&&_0x1e1565[_0x3e5b('0x2b')]==_0x1c7278;});if(_0x9c2123[_0x3e5b('0x2c')]==0x1){_0x505f40(_0x307091);}else{_0xb70ab4(new RangeError(_0x3e5b('0x2d')+_0x1c7278+_0x3e5b('0x2e')));}});});}exports[_0x3e5b('0x2f')]=function(_0x31e9f9,_0x345927){logger['info'](_0x3e5b('0x30'),_0x31e9f9['body']);var _0x5b9ba3=originateValidation[_0x3e5b('0xe')](_0x31e9f9[_0x3e5b('0x31')]);if(_0x5b9ba3['length']>0x0){return _0x345927[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x5b9ba3);}var _0x9d01c4=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x26f842=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x34')];var _0x2450c0=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x35')];var _0x1506f5=_0x31e9f9['body'][_0x3e5b('0x36')];return getAgent(_0x9d01c4)[_0x3e5b('0x1e')](function(_0x53caa2){logger['info'](_0x3e5b('0x37'),_0x53caa2['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x53caa2[_0x3e5b('0x19')]),_0x3e5b('0x3a'),{'callNumber':_0x26f842,'callerId':_0x2450c0,'callbackUrl':_0x1506f5});return _0x345927['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':'originate\x20executed!'});})[_0x3e5b('0x23')](handleError(_0x345927));};exports['hangup']=function(_0x47f7c8,_0x48f414){logger[_0x3e5b('0x15')](_0x3e5b('0x3b'),_0x47f7c8[_0x3e5b('0x31')]);var _0x35cfcd=hangupValidation[_0x3e5b('0xe')](_0x47f7c8[_0x3e5b('0x31')]);if(_0x35cfcd['length']>0x0){return _0x48f414['status'](0x190)['json'](_0x35cfcd);}var _0x565319=_0x47f7c8['body']['userId'];var _0x5aad1d=_0x47f7c8[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x565319)[_0x3e5b('0x1e')](function(_0x1aafd5){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x1aafd5[_0x3e5b('0x19')]);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x1aafd5[_0x3e5b('0x19')]),_0x3e5b('0x3c'),{'sessionId':_0x5aad1d});return _0x48f414['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x3d')});})[_0x3e5b('0x23')](handleError(_0x48f414));};exports[_0x3e5b('0x3e')]=function(_0xa262e0,_0xc69499){logger[_0x3e5b('0x15')](_0x3e5b('0x3f'),_0xa262e0[_0x3e5b('0x31')]);var _0x39da3f=answerValidation[_0x3e5b('0xe')](_0xa262e0['body']);if(_0x39da3f['length']>0x0){return _0xc69499['status'](0x190)['json'](_0x39da3f);}var _0xa99d75=_0xa262e0[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x24c416=_0xa262e0[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0xa99d75)[_0x3e5b('0x1e')](function(_0x158518){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x158518['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x158518[_0x3e5b('0x19')]),_0x3e5b('0x40'),{'sessionId':_0x24c416});return _0xc69499[_0x3e5b('0x1a')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0xc69499));};exports[_0x3e5b('0x41')]=function(_0x20af6a,_0x3b2319){logger['info']('hold\x20fired:',_0x20af6a[_0x3e5b('0x31')]);var _0x313c51=holdValidation[_0x3e5b('0xe')](_0x20af6a['body']);if(_0x313c51['length']>0x0){return _0x3b2319[_0x3e5b('0x1a')](0x190)['json'](_0x313c51);}var _0x14b62a=_0x20af6a[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x36abab=_0x20af6a[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x14b62a)[_0x3e5b('0x1e')](function(_0x3ea5aa){logger[_0x3e5b('0x15')]('entityFound:',_0x3ea5aa[_0x3e5b('0x19')]);emit(util['format'](_0x3e5b('0x39'),_0x3ea5aa[_0x3e5b('0x19')]),_0x3e5b('0x42'),{'sessionId':_0x36abab});return _0x3b2319[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x43')});})[_0x3e5b('0x23')](handleError(_0x3b2319));};exports[_0x3e5b('0x44')]=function(_0x2b5d3d,_0x371655){logger[_0x3e5b('0x15')](_0x3e5b('0x45'),_0x2b5d3d[_0x3e5b('0x31')]);var _0x59d311=unholdValidation[_0x3e5b('0xe')](_0x2b5d3d[_0x3e5b('0x31')]);if(_0x59d311[_0x3e5b('0x2c')]>0x0){return _0x371655[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x59d311);}var _0x2cecd3=_0x2b5d3d['body'][_0x3e5b('0x33')];var _0x1cbdf7=_0x2b5d3d[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x2cecd3)[_0x3e5b('0x1e')](function(_0x449d0f){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x449d0f['name']);emit(util[_0x3e5b('0x38')]('user:%s',_0x449d0f['name']),_0x3e5b('0x46'),{'sessionId':_0x1cbdf7});return _0x371655['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x47')});})[_0x3e5b('0x23')](handleError(_0x371655));};exports[_0x3e5b('0x48')]=function(_0x4a492b,_0x5ddeee){logger['info']('calls\x20fired:',_0x5ddeee[_0x3e5b('0x31')]);var _0x999518=callsValidation[_0x3e5b('0xe')](_0x4a492b[_0x3e5b('0x31')]);if(_0x999518[_0x3e5b('0x2c')]>0x0){return _0x5ddeee['status'](0x190)['json'](_0x999518);}var _0xa0a18d=_0x4a492b[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x325f7b=respondWithRpcPromise(_0x3e5b('0x27'));var _0x51efbd=getAgent(_0xa0a18d);return Promise['all']([_0x325f7b,_0x51efbd])['then'](function(_0x4eaa6e){var _0x3563b0=_0x4eaa6e[0x0];var _0x3e3115=_0x4eaa6e[0x1];var _0x3088d4=_[_0x3e5b('0x29')](_0x3563b0[_0x3e5b('0x2a')],function(_0x24087b){return _0x24087b[_0x3e5b('0x49')]==_0x3e3115['id'];});return _0x5ddeee[_0x3e5b('0x1a')](0xc8)['json']({'count':_0x3088d4[_0x3e5b('0x2c')],'rows':_0x3088d4});})[_0x3e5b('0x23')](handleError(_0x5ddeee));};exports[_0x3e5b('0x4a')]=function(_0x3e784a,_0x2d2c1e){logger['info'](_0x3e5b('0x4b'),_0x3e784a['body']);var _0x45ca16=conferenceValidation[_0x3e5b('0xe')](_0x3e784a['body']);if(_0x45ca16['length']>0x0){return _0x2d2c1e['status'](0x190)[_0x3e5b('0x32')](_0x45ca16);}var _0x50f5b4=_0x3e784a[_0x3e5b('0x31')][_0x3e5b('0x33')];return getAgent(_0x50f5b4)[_0x3e5b('0x1e')](function(_0x40197c){logger[_0x3e5b('0x15')]('entityFound:',_0x40197c['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x40197c[_0x3e5b('0x19')]),'webbar:conference');return _0x2d2c1e[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x4c')});})[_0x3e5b('0x23')](handleError(_0x2d2c1e));};exports[_0x3e5b('0x4d')]=function(_0x198316,_0x455594){logger[_0x3e5b('0x15')](_0x3e5b('0x4e'),_0x198316[_0x3e5b('0x31')]);var _0x4eb336=transferValidation[_0x3e5b('0xe')](_0x198316[_0x3e5b('0x31')]);if(_0x4eb336[_0x3e5b('0x2c')]>0x0){return _0x455594[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x4eb336);}var _0x39f1f2=_0x198316[_0x3e5b('0x31')]['userId'];var _0xe5d4c5=_0x198316[_0x3e5b('0x31')]['sessionId'];var _0x177144=_0x198316[_0x3e5b('0x31')]['transferNumber'];return getAgent(_0x39f1f2)['then'](function(_0x4f67d1){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x4f67d1['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x4f67d1['name']),_0x3e5b('0x4f'),{'sessionId':_0xe5d4c5,'transferNumber':_0x177144});return _0x455594[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x50')});})[_0x3e5b('0x23')](handleError(_0x455594));}; \ No newline at end of file +var _0x19ea=['format','user:%s','originate\x20executed!','catch','hangup','hangup\x20fired:','sessionId','entityFound:','webbar:hangup','json','hangup\x20executed!','answer\x20fired:','webbar:answer','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','../../config/environment','bluebird','jayson/promise','client','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','info','stringify','emit','log','error','name','send','status','NotFound','request','then','message','result','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callerId','callbackUrl'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x19ea,0xfe));var _0xa19e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x19ea[_0x2a6809];return _0x11c371;};'use strict';var path=require(_0xa19e('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xa19e('0x1'));var util=require('util');var BPromise=require(_0xa19e('0x2'));var jayson=require(_0xa19e('0x3'));var amiClient=jayson[_0xa19e('0x4')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0xa19e('0x5'));var Redis=require(_0xa19e('0x6'));config[_0xa19e('0x7')]=_[_0xa19e('0x8')](config[_0xa19e('0x7')],{'host':_0xa19e('0x9'),'port':0x18eb});var io=require(_0xa19e('0xa'))(new Redis(config[_0xa19e('0x7')]));var Schema=require(_0xa19e('0xb'));var originateValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]},'callNumber':{'type':'string','required':[!![],_0xa19e('0xe')]},'callerId':{'type':_0xa19e('0xf')},'callbackUrl':{'type':_0xa19e('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa19e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]},'sessionId':{'type':_0xa19e('0xf'),'required':[!![],_0xa19e('0x10')]},'transferNumber':{'type':_0xa19e('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]},'sessionId':{'type':_0xa19e('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]},'sessionId':{'type':_0xa19e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa19e('0xc'),'required':[!![],_0xa19e('0xd')]}});function emit(_0x2598f5,_0x48530c,_0x28fd37){logger[_0xa19e('0x11')](_0x2598f5,_0x48530c,JSON[_0xa19e('0x12')](_0x28fd37));io['to'](_0x2598f5)[_0xa19e('0x13')](_0x48530c,_0x28fd37);}function handleError(_0x3acfae){return function(_0x38e398){console[_0xa19e('0x14')]('handleError:',_0x38e398,_0x38e398 instanceof RangeError);logger[_0xa19e('0x15')](_0x38e398['stack']);if(_0x38e398 instanceof RangeError){if(_0x38e398[_0xa19e('0x16')]){delete _0x38e398['name'];}_0x3acfae['status'](0x194)[_0xa19e('0x17')](_0x38e398);}else{if(_0x38e398[_0xa19e('0x16')]){delete _0x38e398['name'];}_0x3acfae[_0xa19e('0x18')](0x1f4)[_0xa19e('0x17')](_0x38e398);}};}function checkError(){return function(_0x3c11d5){if(!_0x3c11d5){throw new RangeError(_0xa19e('0x19'));}return _0x3c11d5;};}function respondWithRpcPromise(_0x5869c8,_0x41ad6b){return new BPromise(function(_0x33b588,_0x105874){var _0x301f6d=amiClient;return _0x301f6d[_0xa19e('0x1a')](_0x5869c8,_0x41ad6b)[_0xa19e('0x1b')](function(_0x2a416e){if(_0x2a416e[_0xa19e('0x15')]){if(_0x2a416e[_0xa19e('0x15')]['code']===0x1f4){return _0x105874(_0x2a416e[_0xa19e('0x15')][_0xa19e('0x1c')]);}return _0x33b588(_0x2a416e['error'][_0xa19e('0x1c')]);}else{_0x33b588(_0x2a416e[_0xa19e('0x1d')]);}})['catch'](function(_0x20b05c){_0x105874(_0x20b05c);});});}function getAgent(_0x389f2f){return db['User'][_0xa19e('0x1e')]({'where':{'id':_0x389f2f,'role':_0xa19e('0x1f')}})[_0xa19e('0x1b')](checkError());}function getAgentCheckSession(_0x21c9ca,_0x2076c5){return new BPromise(function(_0x180407,_0x23c0cc){var _0x3f5ac6=respondWithRpcPromise(_0xa19e('0x20'));var _0x24dd51=getAgent(_0x21c9ca);Promise[_0xa19e('0x21')]([_0x3f5ac6,_0x24dd51])[_0xa19e('0x1b')](function(_0x1ce643){var _0x475a26=_0x1ce643[0x0];var _0xdf0b20=_0x1ce643[0x1];var _0x4613c3=_[_0xa19e('0x22')](_0x475a26[_0xa19e('0x23')],function(_0x3dcd74){return _0x3dcd74[_0xa19e('0x24')]==_0xdf0b20['id']&&_0x3dcd74['sessionId']==_0x2076c5;});if(_0x4613c3[_0xa19e('0x25')]==0x1){_0x180407(_0xdf0b20);}else{_0x23c0cc(new RangeError(_0xa19e('0x26')+_0x2076c5+_0xa19e('0x27')));}});});}exports[_0xa19e('0x28')]=function(_0x13d6c4,_0x355fd9){logger['info'](_0xa19e('0x29'),_0x13d6c4[_0xa19e('0x2a')]);var _0x543ae5=originateValidation[_0xa19e('0xb')](_0x13d6c4['body']);if(_0x543ae5['length']>0x0){return _0x355fd9[_0xa19e('0x18')](0x190)['json'](_0x543ae5);}var _0x5a42c9=_0x13d6c4['body'][_0xa19e('0x2b')];var _0x177e4b=_0x13d6c4[_0xa19e('0x2a')]['callNumber'];var _0x1ec065=_0x13d6c4[_0xa19e('0x2a')][_0xa19e('0x2c')];var _0x288a41=_0x13d6c4[_0xa19e('0x2a')][_0xa19e('0x2d')];return getAgent(_0x5a42c9)['then'](function(_0x3e1e62){logger[_0xa19e('0x11')]('entityFound:',_0x3e1e62[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x3e1e62['name']),'webbar:originate',{'callNumber':_0x177e4b,'callerId':_0x1ec065,'callbackUrl':_0x288a41});return _0x355fd9[_0xa19e('0x18')](0xc8)['json']({'error':![],'message':_0xa19e('0x30')});})[_0xa19e('0x31')](handleError(_0x355fd9));};exports[_0xa19e('0x32')]=function(_0x18c54a,_0x4f7e80){logger[_0xa19e('0x11')](_0xa19e('0x33'),_0x18c54a['body']);var _0x438e5a=hangupValidation['validate'](_0x18c54a[_0xa19e('0x2a')]);if(_0x438e5a[_0xa19e('0x25')]>0x0){return _0x4f7e80[_0xa19e('0x18')](0x190)['json'](_0x438e5a);}var _0x45ee6f=_0x18c54a[_0xa19e('0x2a')][_0xa19e('0x2b')];var _0x4c3554=_0x18c54a[_0xa19e('0x2a')][_0xa19e('0x34')];return getAgent(_0x45ee6f)['then'](function(_0x561608){logger[_0xa19e('0x11')](_0xa19e('0x35'),_0x561608['name']);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x561608['name']),_0xa19e('0x36'),{'sessionId':_0x4c3554});return _0x4f7e80[_0xa19e('0x18')](0xc8)[_0xa19e('0x37')]({'error':![],'message':_0xa19e('0x38')});})[_0xa19e('0x31')](handleError(_0x4f7e80));};exports['answer']=function(_0x2acd9b,_0x26b0fd){logger[_0xa19e('0x11')](_0xa19e('0x39'),_0x2acd9b[_0xa19e('0x2a')]);var _0x51f0f4=answerValidation[_0xa19e('0xb')](_0x2acd9b['body']);if(_0x51f0f4[_0xa19e('0x25')]>0x0){return _0x26b0fd[_0xa19e('0x18')](0x190)['json'](_0x51f0f4);}var _0x8dfa7e=_0x2acd9b[_0xa19e('0x2a')]['userId'];var _0x41d7ae=_0x2acd9b['body'][_0xa19e('0x34')];return getAgent(_0x8dfa7e)[_0xa19e('0x1b')](function(_0x3572b2){logger[_0xa19e('0x11')](_0xa19e('0x35'),_0x3572b2[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x3572b2['name']),_0xa19e('0x3a'),{'sessionId':_0x41d7ae});return _0x26b0fd[_0xa19e('0x18')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})[_0xa19e('0x31')](handleError(_0x26b0fd));};exports[_0xa19e('0x3b')]=function(_0x3cbc3b,_0x5a865d){logger[_0xa19e('0x11')](_0xa19e('0x3c'),_0x3cbc3b['body']);var _0x1b7f8b=holdValidation[_0xa19e('0xb')](_0x3cbc3b[_0xa19e('0x2a')]);if(_0x1b7f8b['length']>0x0){return _0x5a865d[_0xa19e('0x18')](0x190)['json'](_0x1b7f8b);}var _0x349543=_0x3cbc3b[_0xa19e('0x2a')][_0xa19e('0x2b')];var _0x3c3b3a=_0x3cbc3b[_0xa19e('0x2a')]['sessionId'];return getAgent(_0x349543)[_0xa19e('0x1b')](function(_0x4c90fe){logger[_0xa19e('0x11')]('entityFound:',_0x4c90fe[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x4c90fe[_0xa19e('0x16')]),'webbar:hold',{'sessionId':_0x3c3b3a});return _0x5a865d[_0xa19e('0x18')](0xc8)[_0xa19e('0x37')]({'error':![],'message':_0xa19e('0x3d')});})[_0xa19e('0x31')](handleError(_0x5a865d));};exports['unhold']=function(_0x454c9f,_0x5ae431){logger[_0xa19e('0x11')](_0xa19e('0x3e'),_0x454c9f[_0xa19e('0x2a')]);var _0x501dea=unholdValidation[_0xa19e('0xb')](_0x454c9f[_0xa19e('0x2a')]);if(_0x501dea['length']>0x0){return _0x5ae431[_0xa19e('0x18')](0x190)[_0xa19e('0x37')](_0x501dea);}var _0x33b6b0=_0x454c9f[_0xa19e('0x2a')]['userId'];var _0x51d10a=_0x454c9f[_0xa19e('0x2a')][_0xa19e('0x34')];return getAgent(_0x33b6b0)['then'](function(_0x18f219){logger[_0xa19e('0x11')]('entityFound:',_0x18f219[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x18f219[_0xa19e('0x16')]),_0xa19e('0x3f'),{'sessionId':_0x51d10a});return _0x5ae431[_0xa19e('0x18')](0xc8)[_0xa19e('0x37')]({'error':![],'message':_0xa19e('0x40')});})[_0xa19e('0x31')](handleError(_0x5ae431));};exports[_0xa19e('0x41')]=function(_0x39eb06,_0x479b09){logger['info'](_0xa19e('0x42'),_0x479b09[_0xa19e('0x2a')]);var _0x17ac29=callsValidation['validate'](_0x39eb06['body']);if(_0x17ac29['length']>0x0){return _0x479b09[_0xa19e('0x18')](0x190)['json'](_0x17ac29);}var _0x3ce686=_0x39eb06[_0xa19e('0x2a')][_0xa19e('0x2b')];var _0xdf2b29=respondWithRpcPromise('VoiceChannels');var _0x966a23=getAgent(_0x3ce686);return Promise[_0xa19e('0x21')]([_0xdf2b29,_0x966a23])[_0xa19e('0x1b')](function(_0xfe4a4){var _0x2cc680=_0xfe4a4[0x0];var _0x12064e=_0xfe4a4[0x1];var _0x1eb008=_[_0xa19e('0x22')](_0x2cc680[_0xa19e('0x23')],function(_0x43ed0f){return _0x43ed0f[_0xa19e('0x24')]==_0x12064e['id'];});return _0x479b09[_0xa19e('0x18')](0xc8)[_0xa19e('0x37')]({'count':_0x1eb008[_0xa19e('0x25')],'rows':_0x1eb008});})[_0xa19e('0x31')](handleError(_0x479b09));};exports[_0xa19e('0x43')]=function(_0x45f7ee,_0x5ad478){logger[_0xa19e('0x11')](_0xa19e('0x44'),_0x45f7ee['body']);var _0x14483e=conferenceValidation['validate'](_0x45f7ee['body']);if(_0x14483e[_0xa19e('0x25')]>0x0){return _0x5ad478[_0xa19e('0x18')](0x190)[_0xa19e('0x37')](_0x14483e);}var _0x5d85f2=_0x45f7ee[_0xa19e('0x2a')]['userId'];return getAgent(_0x5d85f2)[_0xa19e('0x1b')](function(_0x5afd28){logger[_0xa19e('0x11')](_0xa19e('0x35'),_0x5afd28[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0x5afd28['name']),_0xa19e('0x45'));return _0x5ad478['status'](0xc8)[_0xa19e('0x37')]({'error':![],'message':_0xa19e('0x46')});})[_0xa19e('0x31')](handleError(_0x5ad478));};exports[_0xa19e('0x47')]=function(_0x1982b6,_0x2b625c){logger[_0xa19e('0x11')](_0xa19e('0x48'),_0x1982b6[_0xa19e('0x2a')]);var _0x3f6bf7=transferValidation[_0xa19e('0xb')](_0x1982b6[_0xa19e('0x2a')]);if(_0x3f6bf7['length']>0x0){return _0x2b625c[_0xa19e('0x18')](0x190)[_0xa19e('0x37')](_0x3f6bf7);}var _0x5ca466=_0x1982b6[_0xa19e('0x2a')]['userId'];var _0x1d991d=_0x1982b6['body'][_0xa19e('0x34')];var _0x45f260=_0x1982b6['body'][_0xa19e('0x49')];return getAgent(_0x5ca466)['then'](function(_0xbb6170){logger[_0xa19e('0x11')](_0xa19e('0x35'),_0xbb6170[_0xa19e('0x16')]);emit(util[_0xa19e('0x2e')](_0xa19e('0x2f'),_0xbb6170['name']),_0xa19e('0x4a'),{'sessionId':_0x1d991d,'transferNumber':_0x45f260});return _0x2b625c[_0xa19e('0x18')](0xc8)[_0xa19e('0x37')]({'error':![],'message':'transfer\x20executed!'});})[_0xa19e('0x31')](handleError(_0x2b625c));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ca6857e..481c453 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 _0x720e=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','getAgents','/:id/applications','post','create','addDisposition','/:id/canned_answers','/:id/users','addAgents','addApplications','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','util','path'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x720e,0x18a));var _0xe720=function(_0x21cf80,_0x1fb0a1){_0x21cf80=_0x21cf80-0x0;var _0x5c6bed=_0x720e[_0x21cf80];return _0x5c6bed;};'use strict';var multer=require('multer');var util=require(_0xe720('0x0'));var path=require(_0xe720('0x1'));var timeout=require(_0xe720('0x2'));var express=require(_0xe720('0x3'));var router=express[_0xe720('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe720('0x5'));var config=require(_0xe720('0x6'));var controller=require(_0xe720('0x7'));router[_0xe720('0x8')]('/',auth[_0xe720('0x9')](),controller[_0xe720('0xa')]);router['get']('/describe',auth[_0xe720('0x9')](),controller[_0xe720('0xb')]);router[_0xe720('0x8')](_0xe720('0xc'),auth[_0xe720('0x9')](),controller['show']);router[_0xe720('0x8')](_0xe720('0xd'),auth['isAuthenticated'](),controller[_0xe720('0xe')]);router[_0xe720('0x8')]('/:id/canned_answers',auth[_0xe720('0x9')](),controller['getAnswers']);router[_0xe720('0x8')]('/:id/users',auth[_0xe720('0x9')](),controller[_0xe720('0xf')]);router[_0xe720('0x8')](_0xe720('0x10'),auth[_0xe720('0x9')](),controller['getApplications']);router[_0xe720('0x11')]('/',auth['isAuthenticated'](),controller[_0xe720('0x12')]);router[_0xe720('0x11')]('/:id/dispositions',auth[_0xe720('0x9')](),controller[_0xe720('0x13')]);router[_0xe720('0x11')](_0xe720('0x14'),auth[_0xe720('0x9')](),controller['addAnswer']);router[_0xe720('0x11')](_0xe720('0x15'),auth[_0xe720('0x9')](),controller[_0xe720('0x16')]);router[_0xe720('0x11')](_0xe720('0x10'),auth[_0xe720('0x9')](),controller[_0xe720('0x17')]);router[_0xe720('0x11')]('/:id/notify',controller['notify']);router['post'](_0xe720('0x18'),auth['isAuthenticated'](),controller[_0xe720('0x19')]);router[_0xe720('0x1a')](_0xe720('0xc'),auth['isAuthenticated'](),controller[_0xe720('0x1b')]);router['delete'](_0xe720('0xc'),auth[_0xe720('0x9')](),controller[_0xe720('0x1c')]);router[_0xe720('0x1d')](_0xe720('0xd'),auth[_0xe720('0x9')](),controller[_0xe720('0x1e')]);router['delete'](_0xe720('0x14'),auth['isAuthenticated'](),controller[_0xe720('0x1f')]);router[_0xe720('0x1d')]('/:id/users',auth[_0xe720('0x9')](),controller[_0xe720('0x20')]);module['exports']=router; \ No newline at end of file +var _0xea26=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','/:id/users','/:id/applications','getApplications','post','/:id/dispositions','addDisposition','addAgents','addApplications','notify','/:id/send','put','update','destroy','delete','removeAgents','exports','multer','util','connect-timeout'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0xea26,0xc3));var _0x6ea2=function(_0x54de7d,_0x431a61){_0x54de7d=_0x54de7d-0x0;var _0x5388d3=_0xea26[_0x54de7d];return _0x5388d3;};'use strict';var multer=require(_0x6ea2('0x0'));var util=require(_0x6ea2('0x1'));var path=require('path');var timeout=require(_0x6ea2('0x2'));var express=require(_0x6ea2('0x3'));var router=express[_0x6ea2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ea2('0x5'));var interaction=require(_0x6ea2('0x6'));var config=require(_0x6ea2('0x7'));var controller=require(_0x6ea2('0x8'));router[_0x6ea2('0x9')]('/',auth[_0x6ea2('0xa')](),controller[_0x6ea2('0xb')]);router[_0x6ea2('0x9')](_0x6ea2('0xc'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0xd')]);router[_0x6ea2('0x9')](_0x6ea2('0xe'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0xf')]);router[_0x6ea2('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x6ea2('0x9')](_0x6ea2('0x10'),auth[_0x6ea2('0xa')](),controller['getAnswers']);router[_0x6ea2('0x9')](_0x6ea2('0x11'),auth[_0x6ea2('0xa')](),controller['getAgents']);router[_0x6ea2('0x9')](_0x6ea2('0x12'),auth['isAuthenticated'](),controller[_0x6ea2('0x13')]);router[_0x6ea2('0x14')]('/',auth[_0x6ea2('0xa')](),controller['create']);router[_0x6ea2('0x14')](_0x6ea2('0x15'),auth['isAuthenticated'](),controller[_0x6ea2('0x16')]);router[_0x6ea2('0x14')](_0x6ea2('0x10'),auth[_0x6ea2('0xa')](),controller['addAnswer']);router[_0x6ea2('0x14')](_0x6ea2('0x11'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0x17')]);router[_0x6ea2('0x14')](_0x6ea2('0x12'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0x18')]);router[_0x6ea2('0x14')]('/:id/notify',controller[_0x6ea2('0x19')]);router[_0x6ea2('0x14')](_0x6ea2('0x1a'),auth[_0x6ea2('0xa')](),controller['send']);router[_0x6ea2('0x1b')](_0x6ea2('0xe'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0x1c')]);router['delete'](_0x6ea2('0xe'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0x1d')]);router[_0x6ea2('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x6ea2('0x1e')](_0x6ea2('0x10'),auth[_0x6ea2('0xa')](),controller['removeAnswers']);router[_0x6ea2('0x1e')](_0x6ea2('0x11'),auth[_0x6ea2('0xa')](),controller[_0x6ea2('0x1f')]);module[_0x6ea2('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 0335c2f..bc01aa6 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 _0x0f36=['generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x22f9c0,_0x35410c){var _0x1883fe=function(_0x5a5601){while(--_0x5a5601){_0x22f9c0['push'](_0x22f9c0['shift']());}};_0x1883fe(++_0x35410c);}(_0x0f36,0x8b));var _0x60f3=function(_0x449b81,_0x4b2a6f){_0x449b81=_0x449b81-0x0;var _0xb9b60c=_0x0f36[_0x449b81];return _0xb9b60c;};'use strict';var Sequelize=require(_0x60f3('0x0'));var rs=require(_0x60f3('0x1'));module[_0x60f3('0x2')]={'name':{'type':Sequelize[_0x60f3('0x3')],'unique':_0x60f3('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x60f3('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x60f3('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x60f3('0x3')],'defaultValue':function(){return rs[_0x60f3('0x5')]();}},'phone':{'type':Sequelize[_0x60f3('0x3')]},'type':{'type':Sequelize[_0x60f3('0x6')](_0x60f3('0x7'),_0x60f3('0x8'))},'accountSid':{'type':Sequelize[_0x60f3('0x3')]},'baseUrl':{'type':Sequelize[_0x60f3('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x60f3('0x9')],'defaultValue':function(){return _0x60f3('0xa');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x60f3('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x60f3('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x60f3('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x60f3('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x60f3('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x60f3('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x60f3('0xc')],'comment':_0x60f3('0xd')},'mandatoryDisposition':{'type':Sequelize[_0x60f3('0xb')],'defaultValue':![],'comment':_0x60f3('0xe'),'set':function(_0x327446){if(!_0x327446){this['setDataValue'](_0x60f3('0xf'),null);}this[_0x60f3('0x10')](_0x60f3('0x11'),_0x327446);}},'description':{'type':Sequelize[_0x60f3('0x3')]}}; \ No newline at end of file +var _0x21e9=['ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','name','STRING','generate'];(function(_0x26973e,_0x4d1d08){var _0x26893c=function(_0x55b60d){while(--_0x55b60d){_0x26973e['push'](_0x26973e['shift']());}};_0x26893c(++_0x4d1d08);}(_0x21e9,0x164));var _0x921e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x21e9[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x921e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x921e('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x921e('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x921e('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x921e('0x3')]();}},'phone':{'type':Sequelize[_0x921e('0x2')]},'type':{'type':Sequelize[_0x921e('0x4')](_0x921e('0x5'),_0x921e('0x6'))},'accountSid':{'type':Sequelize[_0x921e('0x2')]},'baseUrl':{'type':Sequelize[_0x921e('0x2')]},'authToken':{'type':Sequelize[_0x921e('0x2')]},'notificationTemplate':{'type':Sequelize[_0x921e('0x7')],'defaultValue':function(){return _0x921e('0x8');}},'notificationSound':{'type':Sequelize[_0x921e('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x921e('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x921e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x921e('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x921e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x921e('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x921e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x921e('0xa')],'comment':_0x921e('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x921e('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x12d97c){if(!_0x12d97c){this[_0x921e('0xc')](_0x921e('0xd'),null);}this['setDataValue'](_0x921e('0xe'),_0x12d97c);}},'description':{'type':Sequelize[_0x921e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8d0e2aa..eb169f2 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 _0x8d23=['include','find','create','user','role','userProfileId','autoAssociation','UserProfileResource','body','params','describe','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','register','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','get','WhatsappAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappAccount','includeAll','findAll','rows'];(function(_0x9a7d5b,_0x50327f){var _0xe2a5b3=function(_0x98ad8d){while(--_0x98ad8d){_0x9a7d5b['push'](_0x9a7d5b['shift']());}};_0xe2a5b3(++_0x50327f);}(_0x8d23,0x133));var _0x38d2=function(_0x7a679d,_0x54ad5b){_0x7a679d=_0x7a679d-0x0;var _0x23ed76=_0x8d23[_0x7a679d];return _0x23ed76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38d2('0x0'));var zipdir=require(_0x38d2('0x1'));var jsonpatch=require(_0x38d2('0x2'));var rp=require(_0x38d2('0x3'));var moment=require(_0x38d2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x38d2('0x5'));var util=require(_0x38d2('0x6'));var path=require(_0x38d2('0x7'));var sox=require(_0x38d2('0x8'));var csv=require(_0x38d2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38d2('0xa'));var _=require(_0x38d2('0xb'));var squel=require(_0x38d2('0xc'));var crypto=require(_0x38d2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x38d2('0xe'));var toCsv=require(_0x38d2('0x9'));var querystring=require(_0x38d2('0xf'));var Papa=require('papaparse');var Redis=require(_0x38d2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x38d2('0x11'));var as=require(_0x38d2('0x12'));var hardwareService=require(_0x38d2('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x38d2('0x14'));var db=require(_0x38d2('0x15'))['db'];config[_0x38d2('0x16')]=_[_0x38d2('0x17')](config[_0x38d2('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38d2('0x16')]));require('./whatsappAccount.socket')[_0x38d2('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x38d2('0x19')][_0x38d2('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x3a4a94,_0x534662,_0x4b71ee,_0x5e1799){return new BPromise(function(_0x58fccd,_0x15cee9){var _0x2bc86c=_0x5e1799||client;return _0x2bc86c['request'](_0x3a4a94,_0x4b71ee)[_0x38d2('0x1b')](function(_0x3fe0c9){logger[_0x38d2('0x1c')](_0x38d2('0x1d'),_0x534662,_0x38d2('0x1e'));logger[_0x38d2('0x1f')](_0x38d2('0x20'),_0x534662,_0x38d2('0x1e'),JSON[_0x38d2('0x21')](_0x3fe0c9));if(_0x3fe0c9[_0x38d2('0x22')]){if(_0x3fe0c9[_0x38d2('0x22')][_0x38d2('0x23')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x534662,_0x3fe0c9[_0x38d2('0x22')][_0x38d2('0x24')]);return _0x15cee9(_0x3fe0c9[_0x38d2('0x22')]['message']);}logger[_0x38d2('0x22')](_0x38d2('0x1d'),_0x534662,_0x3fe0c9[_0x38d2('0x22')][_0x38d2('0x24')]);return _0x58fccd(_0x3fe0c9['error'][_0x38d2('0x24')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x534662,_0x38d2('0x1e'));_0x58fccd(_0x3fe0c9[_0x38d2('0x25')][_0x38d2('0x24')]);}})[_0x38d2('0x26')](function(_0x1106ae){logger[_0x38d2('0x22')](_0x38d2('0x1d'),_0x534662,_0x1106ae);_0x15cee9(_0x1106ae);});});}function respondWithStatusCode(_0x15a943,_0x1c9a7d){_0x1c9a7d=_0x1c9a7d||0xcc;return function(_0x54e15a){if(_0x54e15a){return _0x15a943[_0x38d2('0x27')](_0x1c9a7d);}return _0x15a943['status'](_0x1c9a7d)[_0x38d2('0x28')]();};}function respondWithResult(_0x596e16,_0x417899){_0x417899=_0x417899||0xc8;return function(_0xe38a56){if(_0xe38a56){return _0x596e16['status'](_0x417899)['json'](_0xe38a56);}};}function respondWithFilteredResult(_0x272439,_0x336999){return function(_0x4bd05e){if(_0x4bd05e){var _0x183aa5=typeof _0x336999[_0x38d2('0x29')]===_0x38d2('0x2a')&&typeof _0x336999[_0x38d2('0x2b')]==='undefined';var _0x3adb64=_0x4bd05e['count'];var _0x289b99=_0x183aa5?0x0:_0x336999[_0x38d2('0x29')];var _0x454c2e=_0x183aa5?_0x4bd05e[_0x38d2('0x2c')]:_0x336999['offset']+_0x336999['limit'];var _0x1f39f6;if(_0x454c2e>=_0x3adb64){_0x454c2e=_0x3adb64;_0x1f39f6=0xc8;}else{_0x1f39f6=0xce;}_0x272439[_0x38d2('0x2d')](_0x1f39f6);return _0x272439[_0x38d2('0x2e')](_0x38d2('0x2f'),_0x289b99+'-'+_0x454c2e+'/'+_0x3adb64)[_0x38d2('0x30')](_0x4bd05e);}return null;};}function patchUpdates(_0x4de2c2){return function(_0x489024){try{jsonpatch[_0x38d2('0x31')](_0x489024,_0x4de2c2,!![]);}catch(_0xb2a9f6){return BPromise['reject'](_0xb2a9f6);}return _0x489024[_0x38d2('0x32')]();};}function saveUpdates(_0xa170ad,_0x337add){return function(_0x107544){if(_0x107544){return _0x107544[_0x38d2('0x33')](_0xa170ad)[_0x38d2('0x1b')](function(_0x266fdb){return _0x266fdb;});}return null;};}function removeEntity(_0x291c75,_0x45d5d9){return function(_0x1ade51){if(_0x1ade51){return _0x1ade51['destroy']()[_0x38d2('0x1b')](function(){var _0x5a989e=_0x1ade51[_0x38d2('0x34')]({'plain':!![]});var _0x188934=_0x38d2('0x35');return db['UserProfileResource'][_0x38d2('0x36')]({'where':{'type':_0x188934,'resourceId':_0x5a989e['id']}})[_0x38d2('0x1b')](function(){return _0x1ade51;});})['then'](function(){_0x291c75['status'](0xcc)[_0x38d2('0x28')]();});}};}function handleEntityNotFound(_0x2b23dc,_0x441c6b){return function(_0x122151){if(!_0x122151){_0x2b23dc[_0x38d2('0x27')](0x194);}return _0x122151;};}function handleError(_0x327c3d,_0x409dd3){_0x409dd3=_0x409dd3||0x1f4;return function(_0x3f3856){logger[_0x38d2('0x22')](_0x3f3856[_0x38d2('0x37')]);if(_0x3f3856[_0x38d2('0x38')]){delete _0x3f3856['name'];}_0x327c3d[_0x38d2('0x2d')](_0x409dd3)[_0x38d2('0x39')](_0x3f3856);};}exports[_0x38d2('0x3a')]=function(_0x174c0b,_0x23366c){var _0x20a141={'include':[{'model':db[_0x38d2('0x3b')],'as':_0x38d2('0x3c')}]},_0x4b7271={},_0x429982={'count':0x0,'rows':[]};var _0xe4ea00=_[_0x38d2('0x3d')](db['WhatsappAccount'][_0x38d2('0x3e')],function(_0x2488ca){return{'name':_0x2488ca['fieldName'],'type':_0x2488ca[_0x38d2('0x3f')][_0x38d2('0x40')]};});_0x4b7271['model']=_['map'](_0xe4ea00,_0x38d2('0x38'));_0x4b7271['query']=_[_0x38d2('0x41')](_0x174c0b[_0x38d2('0x42')]);_0x4b7271[_0x38d2('0x43')]=_[_0x38d2('0x44')](_0x4b7271[_0x38d2('0x45')],_0x4b7271[_0x38d2('0x42')]);_0x20a141[_0x38d2('0x46')]=_['intersection'](_0x4b7271[_0x38d2('0x45')],qs['fields'](_0x174c0b[_0x38d2('0x42')][_0x38d2('0x47')]));_0x20a141[_0x38d2('0x46')]=_0x20a141[_0x38d2('0x46')][_0x38d2('0x48')]?_0x20a141[_0x38d2('0x46')]:_0x4b7271[_0x38d2('0x45')];if(!_0x174c0b[_0x38d2('0x42')][_0x38d2('0x49')](_0x38d2('0x4a'))){_0x20a141[_0x38d2('0x2b')]=qs[_0x38d2('0x2b')](_0x174c0b['query'][_0x38d2('0x2b')]);_0x20a141['offset']=qs['offset'](_0x174c0b[_0x38d2('0x42')][_0x38d2('0x29')]);}_0x20a141[_0x38d2('0x4b')]=qs['sort'](_0x174c0b[_0x38d2('0x42')][_0x38d2('0x4c')]);_0x20a141[_0x38d2('0x4d')]=qs[_0x38d2('0x43')](_[_0x38d2('0x4e')](_0x174c0b[_0x38d2('0x42')],_0x4b7271['filters']),_0xe4ea00);if(_0x174c0b[_0x38d2('0x42')][_0x38d2('0x4f')]){_0x20a141['where']=_['merge'](_0x20a141[_0x38d2('0x4d')],{'$or':_['map'](_0xe4ea00,function(_0x21f0e3){if(_0x21f0e3[_0x38d2('0x3f')]!==_0x38d2('0x50')){var _0x3a3827={};_0x3a3827[_0x21f0e3[_0x38d2('0x38')]]={'$like':'%'+_0x174c0b[_0x38d2('0x42')][_0x38d2('0x4f')]+'%'};return _0x3a3827;}})});}_0x20a141=_[_0x38d2('0x51')]({},_0x20a141,_0x174c0b[_0x38d2('0x52')]);var _0x47f0ac={'where':_0x20a141[_0x38d2('0x4d')]};return db[_0x38d2('0x53')][_0x38d2('0x2c')](_0x47f0ac)[_0x38d2('0x1b')](function(_0x96c6e){_0x429982['count']=_0x96c6e;if(_0x174c0b['query'][_0x38d2('0x54')]){_0x20a141['include']=[{'all':!![]}];}return db[_0x38d2('0x53')][_0x38d2('0x55')](_0x20a141);})[_0x38d2('0x1b')](function(_0x4d8067){_0x429982[_0x38d2('0x56')]=_0x4d8067;return _0x429982;})[_0x38d2('0x1b')](respondWithFilteredResult(_0x23366c,_0x20a141))['catch'](handleError(_0x23366c,null));};exports['show']=function(_0x3cabb0,_0x462184){var _0xe01910={'raw':![],'where':{'id':_0x3cabb0['params']['id']},'include':[{'model':db[_0x38d2('0x3b')],'as':_0x38d2('0x3c')}]},_0x4f9dfe={};_0x4f9dfe[_0x38d2('0x45')]=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x4f9dfe['query']=_[_0x38d2('0x41')](_0x3cabb0['query']);_0x4f9dfe[_0x38d2('0x43')]=_['intersection'](_0x4f9dfe['model'],_0x4f9dfe['query']);_0xe01910[_0x38d2('0x46')]=_[_0x38d2('0x44')](_0x4f9dfe[_0x38d2('0x45')],qs[_0x38d2('0x47')](_0x3cabb0[_0x38d2('0x42')]['fields']));_0xe01910[_0x38d2('0x46')]=_0xe01910[_0x38d2('0x46')][_0x38d2('0x48')]?_0xe01910[_0x38d2('0x46')]:_0x4f9dfe[_0x38d2('0x45')];if(_0x3cabb0[_0x38d2('0x42')][_0x38d2('0x54')]){_0xe01910[_0x38d2('0x57')]=[{'all':!![]}];}_0xe01910=_[_0x38d2('0x51')]({},_0xe01910,_0x3cabb0[_0x38d2('0x52')]);return db[_0x38d2('0x53')][_0x38d2('0x58')](_0xe01910)[_0x38d2('0x1b')](handleEntityNotFound(_0x462184,null))[_0x38d2('0x1b')](respondWithResult(_0x462184,null))['catch'](handleError(_0x462184,null));};exports['create']=function(_0x4c4d1d,_0x5b78ea){return db[_0x38d2('0x53')][_0x38d2('0x59')](_0x4c4d1d['body'],{})[_0x38d2('0x1b')](function(_0x2daaab){var _0x1c63cc=_0x4c4d1d[_0x38d2('0x5a')][_0x38d2('0x34')]({'plain':!![]});if(!_0x1c63cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c63cc[_0x38d2('0x5b')]===_0x38d2('0x5a')){var _0x219152=_0x2daaab[_0x38d2('0x34')]({'plain':!![]});var _0x35dc0c=_0x38d2('0x35');return db['UserProfileSection'][_0x38d2('0x58')]({'where':{'name':_0x35dc0c,'userProfileId':_0x1c63cc[_0x38d2('0x5c')]},'raw':!![]})['then'](function(_0xec6a9){if(_0xec6a9&&_0xec6a9[_0x38d2('0x5d')]===0x0){return db[_0x38d2('0x5e')][_0x38d2('0x59')]({'name':_0x219152['name'],'resourceId':_0x219152['id'],'type':_0xec6a9[_0x38d2('0x38')],'sectionId':_0xec6a9['id']},{})[_0x38d2('0x1b')](function(){return _0x2daaab;});}else{return _0x2daaab;}})[_0x38d2('0x26')](function(_0x4dc0e8){logger[_0x38d2('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dc0e8);throw _0x4dc0e8;});}return _0x2daaab;})[_0x38d2('0x1b')](respondWithResult(_0x5b78ea,0xc9))['catch'](handleError(_0x5b78ea,null));};exports[_0x38d2('0x33')]=function(_0xf5f165,_0x5d0a13){if(_0xf5f165[_0x38d2('0x5f')]['id']){delete _0xf5f165[_0x38d2('0x5f')]['id'];}return db[_0x38d2('0x53')][_0x38d2('0x58')]({'where':{'id':_0xf5f165[_0x38d2('0x60')]['id']},'include':[{'model':db[_0x38d2('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x38d2('0x1b')](handleEntityNotFound(_0x5d0a13,null))['then'](saveUpdates(_0xf5f165[_0x38d2('0x5f')],null))[_0x38d2('0x1b')](respondWithResult(_0x5d0a13,null))[_0x38d2('0x26')](handleError(_0x5d0a13,null));};exports['destroy']=function(_0x2f0064,_0x464eee){return db['WhatsappAccount'][_0x38d2('0x58')]({'where':{'id':_0x2f0064[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x464eee,null))['then'](removeEntity(_0x464eee,null))['catch'](handleError(_0x464eee,null));};exports['describe']=function(_0x454a6a,_0x2dcf27){return db['WhatsappAccount'][_0x38d2('0x61')]()[_0x38d2('0x1b')](respondWithResult(_0x2dcf27,null))[_0x38d2('0x26')](handleError(_0x2dcf27,null));};exports['addDisposition']=function(_0x590b58,_0x1b93d,_0x15ceed){if(_0x590b58[_0x38d2('0x5f')]['id']){delete _0x590b58[_0x38d2('0x5f')]['id'];}return db[_0x38d2('0x53')]['find']({'where':{'id':_0x590b58[_0x38d2('0x60')]['id']}})['then'](handleEntityNotFound(_0x1b93d,null))['then'](function(_0x4ad1b4){if(_0x4ad1b4){_0x590b58[_0x38d2('0x5f')][_0x38d2('0x62')]=_0x4ad1b4['id'];return db['Disposition'][_0x38d2('0x59')](_0x590b58[_0x38d2('0x5f')]);}})['then'](respondWithResult(_0x1b93d,null))['catch'](handleError(_0x1b93d,null));};exports[_0x38d2('0x63')]=function(_0x518b93,_0x5768f9,_0x1f1b79){var _0x2f8000={'raw':![],'where':{}};var _0x20305a={};var _0x3799a3={'count':0x0,'rows':[]};return db[_0x38d2('0x53')][_0x38d2('0x64')]({'where':{'id':_0x518b93[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x5768f9,null))[_0x38d2('0x1b')](function(_0x574485){if(_0x574485){_0x20305a[_0x38d2('0x45')]=_[_0x38d2('0x41')](db['Disposition'][_0x38d2('0x3e')]);_0x20305a['query']=_[_0x38d2('0x41')](_0x518b93[_0x38d2('0x42')]);_0x20305a['filters']=_[_0x38d2('0x44')](_0x20305a[_0x38d2('0x45')],_0x20305a[_0x38d2('0x42')]);_0x2f8000[_0x38d2('0x46')]=_[_0x38d2('0x44')](_0x20305a[_0x38d2('0x45')],qs[_0x38d2('0x47')](_0x518b93[_0x38d2('0x42')][_0x38d2('0x47')]));_0x2f8000[_0x38d2('0x46')]=_0x2f8000[_0x38d2('0x46')][_0x38d2('0x48')]?_0x2f8000[_0x38d2('0x46')]:_0x20305a[_0x38d2('0x45')];if(!_0x518b93[_0x38d2('0x42')][_0x38d2('0x49')]('nolimit')){_0x2f8000[_0x38d2('0x2b')]=qs[_0x38d2('0x2b')](_0x518b93[_0x38d2('0x42')]['limit']);_0x2f8000[_0x38d2('0x29')]=qs[_0x38d2('0x29')](_0x518b93['query'][_0x38d2('0x29')]);}_0x2f8000[_0x38d2('0x4b')]=qs[_0x38d2('0x4c')](_0x518b93[_0x38d2('0x42')]['sort']);_0x2f8000['where']=qs['filters'](_[_0x38d2('0x4e')](_0x518b93[_0x38d2('0x42')],_0x20305a['filters']));_0x2f8000[_0x38d2('0x4d')][_0x38d2('0x62')]=_0x574485['id'];if(_0x518b93[_0x38d2('0x42')][_0x38d2('0x4f')]){_0x2f8000[_0x38d2('0x4d')]=_['merge'](_0x2f8000['where'],{'$or':_[_0x38d2('0x3d')](_0x2f8000[_0x38d2('0x46')],function(_0x2fba8e){var _0x524e79={};_0x524e79[_0x2fba8e]={'$like':'%'+_0x518b93[_0x38d2('0x42')][_0x38d2('0x4f')]+'%'};return _0x524e79;})});}_0x2f8000=_[_0x38d2('0x51')]({},_0x2f8000,_0x518b93[_0x38d2('0x52')]);return db[_0x38d2('0x65')][_0x38d2('0x2c')]({'where':_0x2f8000[_0x38d2('0x4d')]})[_0x38d2('0x1b')](function(_0x3d44e1){_0x3799a3[_0x38d2('0x2c')]=_0x3d44e1;if(_0x518b93[_0x38d2('0x42')][_0x38d2('0x54')]){_0x2f8000['include']=[{'all':!![]}];}return db[_0x38d2('0x65')][_0x38d2('0x55')](_0x2f8000);})[_0x38d2('0x1b')](function(_0x50f5d6){_0x3799a3[_0x38d2('0x56')]=_0x50f5d6;return _0x3799a3;});}})[_0x38d2('0x1b')](respondWithFilteredResult(_0x5768f9,_0x2f8000))['catch'](handleError(_0x5768f9,null));};exports[_0x38d2('0x66')]=function(_0xec3c51,_0x183a3f,_0x5aafa7){return db[_0x38d2('0x53')]['find']({'where':{'id':_0xec3c51[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x183a3f,null))['then'](function(_0x515d1b){if(_0x515d1b){return _0x515d1b[_0x38d2('0x66')](_0xec3c51[_0x38d2('0x42')][_0x38d2('0x67')]);}})[_0x38d2('0x1b')](respondWithStatusCode(_0x183a3f,null))[_0x38d2('0x26')](handleError(_0x183a3f,null));};exports[_0x38d2('0x68')]=function(_0x9d6c18,_0x8b52c4,_0x3c4c21){if(_0x9d6c18[_0x38d2('0x5f')]['id']){delete _0x9d6c18[_0x38d2('0x5f')]['id'];}return db[_0x38d2('0x53')][_0x38d2('0x58')]({'where':{'id':_0x9d6c18[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x8b52c4,null))[_0x38d2('0x1b')](function(_0x292499){if(_0x292499){_0x9d6c18['body']['WhatsappAccountId']=_0x292499['id'];return db[_0x38d2('0x69')][_0x38d2('0x59')](_0x9d6c18['body']);}})['then'](respondWithResult(_0x8b52c4,null))[_0x38d2('0x26')](handleError(_0x8b52c4,null));};exports[_0x38d2('0x6a')]=function(_0x40c3ac,_0x393621,_0x351ed3){var _0x2517c7={'raw':![],'where':{}};var _0x15e946={};var _0x3e781a={'count':0x0,'rows':[]};return db[_0x38d2('0x53')][_0x38d2('0x64')]({'where':{'id':_0x40c3ac[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x393621,null))['then'](function(_0x27ee34){if(_0x27ee34){_0x15e946[_0x38d2('0x45')]=_[_0x38d2('0x41')](db['CannedAnswer']['rawAttributes']);_0x15e946['query']=_['keys'](_0x40c3ac[_0x38d2('0x42')]);_0x15e946[_0x38d2('0x43')]=_[_0x38d2('0x44')](_0x15e946[_0x38d2('0x45')],_0x15e946[_0x38d2('0x42')]);_0x2517c7[_0x38d2('0x46')]=_[_0x38d2('0x44')](_0x15e946[_0x38d2('0x45')],qs[_0x38d2('0x47')](_0x40c3ac['query']['fields']));_0x2517c7['attributes']=_0x2517c7[_0x38d2('0x46')][_0x38d2('0x48')]?_0x2517c7['attributes']:_0x15e946['model'];if(!_0x40c3ac[_0x38d2('0x42')]['hasOwnProperty']('nolimit')){_0x2517c7[_0x38d2('0x2b')]=qs[_0x38d2('0x2b')](_0x40c3ac[_0x38d2('0x42')][_0x38d2('0x2b')]);_0x2517c7['offset']=qs[_0x38d2('0x29')](_0x40c3ac['query'][_0x38d2('0x29')]);}_0x2517c7[_0x38d2('0x4b')]=qs[_0x38d2('0x4c')](_0x40c3ac[_0x38d2('0x42')][_0x38d2('0x4c')]);_0x2517c7[_0x38d2('0x4d')]=qs[_0x38d2('0x43')](_['pick'](_0x40c3ac[_0x38d2('0x42')],_0x15e946['filters']));_0x2517c7['where'][_0x38d2('0x62')]=_0x27ee34['id'];if(_0x40c3ac[_0x38d2('0x42')][_0x38d2('0x4f')]){_0x2517c7[_0x38d2('0x4d')]=_[_0x38d2('0x51')](_0x2517c7[_0x38d2('0x4d')],{'$or':_[_0x38d2('0x3d')](_0x2517c7[_0x38d2('0x46')],function(_0x3f3e95){var _0x2b6a0e={};_0x2b6a0e[_0x3f3e95]={'$like':'%'+_0x40c3ac[_0x38d2('0x42')][_0x38d2('0x4f')]+'%'};return _0x2b6a0e;})});}_0x2517c7=_[_0x38d2('0x51')]({},_0x2517c7,_0x40c3ac[_0x38d2('0x52')]);return db[_0x38d2('0x69')][_0x38d2('0x2c')]({'where':_0x2517c7['where']})[_0x38d2('0x1b')](function(_0x4cd50f){_0x3e781a[_0x38d2('0x2c')]=_0x4cd50f;if(_0x40c3ac[_0x38d2('0x42')][_0x38d2('0x54')]){_0x2517c7[_0x38d2('0x57')]=[{'all':!![]}];}return db[_0x38d2('0x69')][_0x38d2('0x55')](_0x2517c7);})['then'](function(_0x270531){_0x3e781a[_0x38d2('0x56')]=_0x270531;return _0x3e781a;});}})[_0x38d2('0x1b')](respondWithFilteredResult(_0x393621,_0x2517c7))['catch'](handleError(_0x393621,null));};exports[_0x38d2('0x6b')]=function(_0x390005,_0x3d25ef,_0x3d8383){return db[_0x38d2('0x53')][_0x38d2('0x58')]({'where':{'id':_0x390005[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x3d25ef,null))[_0x38d2('0x1b')](function(_0x2ba11e){if(_0x2ba11e){return _0x2ba11e[_0x38d2('0x6b')](_0x390005[_0x38d2('0x42')]['ids']);}})[_0x38d2('0x1b')](respondWithStatusCode(_0x3d25ef,null))[_0x38d2('0x26')](handleError(_0x3d25ef,null));};exports[_0x38d2('0x6c')]=function(_0xefade6,_0x34d426,_0xa70a4){return db[_0x38d2('0x53')][_0x38d2('0x58')]({'where':{'id':_0xefade6[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0x34d426,null))[_0x38d2('0x1b')](function(_0x2464bc){if(_0x2464bc){return _0x2464bc[_0x38d2('0x6c')](_0xefade6[_0x38d2('0x5f')][_0x38d2('0x67')],_[_0x38d2('0x6d')](_0xefade6[_0x38d2('0x5f')],['ids','id'])||{})['spread'](function(_0x541fcb){for(var _0x4fe682=0x0;_0x4fe682<_0xefade6[_0x38d2('0x5f')][_0x38d2('0x67')][_0x38d2('0x48')];_0x4fe682+=0x1){socket[_0x38d2('0x6e')](_0x38d2('0x6f'),{'UserId':Number(_0xefade6[_0x38d2('0x5f')][_0x38d2('0x67')][_0x4fe682]),'WhatsappAccountId':Number(_0xefade6[_0x38d2('0x60')]['id'])});}return _0x541fcb;});}})[_0x38d2('0x1b')](respondWithResult(_0x34d426,null))[_0x38d2('0x26')](handleError(_0x34d426,null));};exports[_0x38d2('0x70')]=function(_0x276e42,_0xfa5ed1,_0x6c1b64){return db['WhatsappAccount'][_0x38d2('0x58')]({'where':{'id':_0x276e42[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0xfa5ed1,null))[_0x38d2('0x1b')](function(_0x204359){if(_0x204359){return _0x204359[_0x38d2('0x70')](_0x276e42[_0x38d2('0x42')][_0x38d2('0x67')])['then'](function(){if(_[_0x38d2('0x71')](_0x276e42['query']['ids'])){for(var _0x153655=0x0;_0x153655<_0x276e42[_0x38d2('0x42')]['ids'][_0x38d2('0x48')];_0x153655+=0x1){socket[_0x38d2('0x6e')](_0x38d2('0x72'),{'UserId':Number(_0x276e42['query'][_0x38d2('0x67')][_0x153655]),'WhatsappAccountId':Number(_0x276e42[_0x38d2('0x60')]['id'])});}}else{socket[_0x38d2('0x6e')](_0x38d2('0x72'),{'UserId':Number(_0x276e42[_0x38d2('0x42')][_0x38d2('0x67')]),'WhatsappAccountId':Number(_0x276e42['params']['id'])});}});}})[_0x38d2('0x1b')](respondWithStatusCode(_0xfa5ed1,null))[_0x38d2('0x26')](handleError(_0xfa5ed1,null));};exports['getAgents']=function(_0x2b1871,_0xd4a4a2,_0x231fe6){var _0x46a184={};var _0x3526cb={};var _0x346cf9;var _0x490106;return db[_0x38d2('0x53')][_0x38d2('0x64')]({'where':{'id':_0x2b1871[_0x38d2('0x60')]['id']}})[_0x38d2('0x1b')](handleEntityNotFound(_0xd4a4a2,null))[_0x38d2('0x1b')](function(_0x5140bb){if(_0x5140bb){_0x346cf9=_0x5140bb;_0x3526cb[_0x38d2('0x45')]=_['keys'](db[_0x38d2('0x73')][_0x38d2('0x3e')]);_0x3526cb[_0x38d2('0x42')]=_[_0x38d2('0x41')](_0x2b1871[_0x38d2('0x42')]);_0x3526cb[_0x38d2('0x43')]=_[_0x38d2('0x44')](_0x3526cb[_0x38d2('0x45')],_0x3526cb[_0x38d2('0x42')]);_0x46a184[_0x38d2('0x46')]=_['intersection'](_0x3526cb[_0x38d2('0x45')],qs[_0x38d2('0x47')](_0x2b1871[_0x38d2('0x42')][_0x38d2('0x47')]));_0x46a184[_0x38d2('0x46')]=_0x46a184['attributes']['length']?_0x46a184[_0x38d2('0x46')]:_0x3526cb[_0x38d2('0x45')];_0x46a184[_0x38d2('0x4b')]=qs[_0x38d2('0x4c')](_0x2b1871[_0x38d2('0x42')][_0x38d2('0x4c')]);_0x46a184['where']=qs['filters'](_['pick'](_0x2b1871[_0x38d2('0x42')],_0x3526cb['filters']));if(_0x2b1871[_0x38d2('0x42')]['filter']){_0x46a184['where']=_[_0x38d2('0x51')](_0x46a184[_0x38d2('0x4d')],{'$or':_[_0x38d2('0x3d')](_0x46a184['attributes'],function(_0x31a995){var _0x119ab5={};_0x119ab5[_0x31a995]={'$like':'%'+_0x2b1871[_0x38d2('0x42')][_0x38d2('0x4f')]+'%'};return _0x119ab5;})});}_0x46a184=_[_0x38d2('0x51')]({},_0x46a184,_0x2b1871[_0x38d2('0x52')]);return _0x346cf9[_0x38d2('0x74')](_0x46a184);}})['then'](function(_0x3f0815){if(_0x3f0815){_0x490106=_0x3f0815[_0x38d2('0x48')];if(!_0x2b1871['query'][_0x38d2('0x49')](_0x38d2('0x4a'))){_0x46a184[_0x38d2('0x2b')]=qs[_0x38d2('0x2b')](_0x2b1871['query'][_0x38d2('0x2b')]);_0x46a184['offset']=qs[_0x38d2('0x29')](_0x2b1871['query'][_0x38d2('0x29')]);}return _0x346cf9[_0x38d2('0x74')](_0x46a184);}})[_0x38d2('0x1b')](function(_0x5f601d){if(_0x5f601d){return _0x5f601d?{'count':_0x490106,'rows':_0x5f601d}:null;}})[_0x38d2('0x1b')](respondWithResult(_0xd4a4a2,null))[_0x38d2('0x26')](handleError(_0xd4a4a2,null));};exports[_0x38d2('0x75')]=function(_0x47680b,_0xc9704f){var _0x7e72c=_0x47680b[_0x38d2('0x60')]['id'];var _0x345b7e=_0x47680b[_0x38d2('0x5f')];var _0x5ccda5=0xc8;var _0x1c31d8=null;return db['sequelize'][_0x38d2('0x76')]({'isolationLevel':db[_0x38d2('0x77')]['Transaction'][_0x38d2('0x78')][_0x38d2('0x79')]},function(_0x4fe28b){return db[_0x38d2('0x53')][_0x38d2('0x64')]({'where':{'id':_0x7e72c},'transaction':_0x4fe28b})[_0x38d2('0x1b')](function(_0x11dec6){if(_0x11dec6){return db[_0x38d2('0x7a')][_0x38d2('0x36')]({'where':{'WhatsappAccountId':_0x7e72c},'transaction':_0x4fe28b})[_0x38d2('0x1b')](function(){var _0x8f4232=_[_0x38d2('0x3d')](_0x345b7e,function(_0x106e61){_0x106e61[_0x38d2('0x62')]=_0x7e72c;return _0x106e61;});return db['WhatsappApplication'][_0x38d2('0x7b')](_0x8f4232,{'transaction':_0x4fe28b});});}else{_0x5ccda5=0x194;_0x1c31d8=[];}});})[_0x38d2('0x1b')](function(){if(_0x5ccda5!==0x194){return db[_0x38d2('0x7a')][_0x38d2('0x7c')]({'where':{'WhatsappAccountId':_0x7e72c},'order':_0x38d2('0x7d')})[_0x38d2('0x1b')](function(_0x34dd21){_0x1c31d8=_0x34dd21;});}})[_0x38d2('0x26')](function(_0x3268d8){_0x5ccda5=0x1f4;logger[_0x38d2('0x22')](_0x3268d8[_0x38d2('0x37')]);if(_0x3268d8[_0x38d2('0x38')]){delete _0x3268d8['name'];}_0x1c31d8=_0x3268d8;})['finally'](function(){if(_0x1c31d8===null){_0xc9704f[_0x38d2('0x27')](_0x5ccda5);}else{if(_0x5ccda5===0x1f4){_0xc9704f[_0x38d2('0x2d')](_0x5ccda5)[_0x38d2('0x39')](_0x1c31d8);}else{_0xc9704f[_0x38d2('0x2d')](_0x5ccda5)[_0x38d2('0x30')](_0x1c31d8);}}});};exports[_0x38d2('0x7e')]=function(_0x288f12,_0x1a24bf,_0x486b31){var _0x51a779={};var _0x36c0e7={};var _0x20fbdc;var _0x2cc182;return db[_0x38d2('0x53')][_0x38d2('0x64')]({'where':{'id':_0x288f12[_0x38d2('0x60')]['id']}})['then'](handleEntityNotFound(_0x1a24bf,null))['then'](function(_0x4a5119){if(_0x4a5119){_0x20fbdc=_0x4a5119;_0x36c0e7[_0x38d2('0x45')]=_[_0x38d2('0x41')](db[_0x38d2('0x7a')][_0x38d2('0x3e')]);_0x36c0e7[_0x38d2('0x42')]=_[_0x38d2('0x41')](_0x288f12[_0x38d2('0x42')]);_0x36c0e7['filters']=_[_0x38d2('0x44')](_0x36c0e7[_0x38d2('0x45')],_0x36c0e7[_0x38d2('0x42')]);_0x51a779[_0x38d2('0x46')]=_[_0x38d2('0x44')](_0x36c0e7['model'],qs[_0x38d2('0x47')](_0x288f12[_0x38d2('0x42')]['fields']));_0x51a779[_0x38d2('0x46')]=_0x51a779[_0x38d2('0x46')][_0x38d2('0x48')]?_0x51a779[_0x38d2('0x46')]:_0x36c0e7[_0x38d2('0x45')];_0x51a779['order']=qs[_0x38d2('0x4c')](_0x288f12[_0x38d2('0x42')][_0x38d2('0x4c')]);_0x51a779['where']=qs[_0x38d2('0x43')](_['pick'](_0x288f12['query'],_0x36c0e7['filters']));if(_0x288f12[_0x38d2('0x42')][_0x38d2('0x4f')]){_0x51a779[_0x38d2('0x4d')]=_[_0x38d2('0x51')](_0x51a779[_0x38d2('0x4d')],{'$or':_[_0x38d2('0x3d')](_0x51a779[_0x38d2('0x46')],function(_0x164355){var _0x1b7bd1={};_0x1b7bd1[_0x164355]={'$like':'%'+_0x288f12[_0x38d2('0x42')]['filter']+'%'};return _0x1b7bd1;})});}_0x51a779=_['merge']({},_0x51a779,_0x288f12[_0x38d2('0x52')]);return _0x20fbdc['getApplications'](_0x51a779);}})['then'](function(_0x2deade){if(_0x2deade){_0x2cc182=_0x2deade[_0x38d2('0x48')];if(!_0x288f12[_0x38d2('0x42')][_0x38d2('0x49')](_0x38d2('0x4a'))){_0x51a779[_0x38d2('0x2b')]=qs[_0x38d2('0x2b')](_0x288f12[_0x38d2('0x42')][_0x38d2('0x2b')]);_0x51a779[_0x38d2('0x29')]=qs['offset'](_0x288f12[_0x38d2('0x42')][_0x38d2('0x29')]);}return _0x20fbdc[_0x38d2('0x7e')](_0x51a779);}})['then'](function(_0x48b825){if(_0x48b825){return _0x48b825?{'count':_0x2cc182,'rows':_0x48b825}:null;}})[_0x38d2('0x1b')](respondWithResult(_0x1a24bf,null))['catch'](handleError(_0x1a24bf,null));};exports['notify']=function(_0x439dd0,_0x547244,_0x1f974d){var _0x268eac={'channel':_0x38d2('0x7f')};var _0x37e449=[];var _0x4de41d=[];var _0x18a14b={};return db[_0x38d2('0x53')][_0x38d2('0x58')]({'where':{'id':_0x439dd0[_0x38d2('0x60')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x38d2('0x80')}]})[_0x38d2('0x1b')](handleEntityNotFound(_0x547244,null))[_0x38d2('0x1b')](function(_0x40d8b5){_0x268eac[_0x38d2('0x81')]=_0x40d8b5;if(_0x268eac[_0x38d2('0x81')]&&_0x268eac['account'][_0x38d2('0x3f')]===_0x38d2('0x82')&&_0x439dd0['body'][_0x38d2('0x83')]){if(_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x83')]['length']===0x0)return;if(_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x83')][0x0][_0x38d2('0x84')]!==_0x38d2('0x85'))return;return db[_0x38d2('0x86')][_0x38d2('0x33')]({'read':!![],'readAt':_0x439dd0['body']['statuses'][0x0][_0x38d2('0x87')]},{'where':{'messageId':_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x83')][0x0][_0x38d2('0x88')]},'individualHooks':!![]})['then'](function(_0x356827){return _0x547244[_0x38d2('0x2d')](0xc8)[_0x38d2('0x30')](_0x356827);});}_0x268eac[_0x38d2('0x89')]=_['orderBy'](_0x40d8b5[_0x38d2('0x80')],[_0x38d2('0x7d')],[_0x38d2('0x8a')]);if(_0x268eac[_0x38d2('0x81')][_0x38d2('0x80')]){delete _0x268eac[_0x38d2('0x81')][_0x38d2('0x80')];}return db[_0x38d2('0x8b')]['describe']()[_0x38d2('0x1b')](function(_0x1a74d7){if(!_0x1a74d7){throw new db[(_0x38d2('0x8c'))][(_0x38d2('0x8d'))]('no\x20available\x20attributes');}_0x37e449=_[_0x38d2('0x8e')](_['keys'](_0x1a74d7),[_0x38d2('0x8f'),_0x38d2('0x90')]);_0x4de41d=_[_0x38d2('0x8e')](_['keys'](_0x1a74d7),[_0x38d2('0x8f'),'updatedAt',_0x38d2('0x91'),_0x38d2('0x92')]);_0x268eac[_0x38d2('0x5f')]={'mapKey':_0x38d2('0x93')};if(_0x268eac['account']&&_0x268eac[_0x38d2('0x81')][_0x38d2('0x3f')]==='twilio'){_0x268eac['body'][_0x38d2('0x94')]=_0x439dd0['body'][_0x38d2('0x95')][_0x38d2('0x96')](_0x38d2('0x97'),'');_0x268eac[_0x38d2('0x5f')][_0x38d2('0x5f')]=_0x439dd0['body'][_0x38d2('0x98')];_0x268eac[_0x38d2('0x5f')][_0x38d2('0x99')]=_0x439dd0[_0x38d2('0x5f')]['MessageSid'];}if(_0x268eac[_0x38d2('0x81')]&&_0x268eac[_0x38d2('0x81')][_0x38d2('0x3f')]===_0x38d2('0x82')){_0x268eac[_0x38d2('0x5f')][_0x38d2('0x94')]=_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x9a')][0x0][_0x38d2('0x94')];_0x268eac[_0x38d2('0x5f')][_0x38d2('0x5f')]=_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x9a')][0x0]['message'][_0x38d2('0x5f')];_0x268eac['body'][_0x38d2('0x99')]=_0x439dd0[_0x38d2('0x5f')][_0x38d2('0x9a')][0x0][_0x38d2('0x88')];}if(_0x268eac[_0x38d2('0x5f')]['id']){delete _0x268eac['body']['id'];}if(_[_0x38d2('0x9b')](_0x268eac[_0x38d2('0x5f')][_0x38d2('0x94')])){throw new db[(_0x38d2('0x8c'))]['ValidationError'](_0x38d2('0x9c'));}if(_[_0x38d2('0x9b')](_0x268eac['body']['body'])||_0x268eac[_0x38d2('0x5f')][_0x38d2('0x5f')]===''){throw new db[(_0x38d2('0x8c'))][(_0x38d2('0x8d'))](_0x38d2('0x9d'));}if(_['isNil'](_0x268eac['body'][_0x38d2('0x9e')])){throw new db[(_0x38d2('0x8c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4de41d);}if(!_[_0x38d2('0x9f')](_0x4de41d,_0x268eac[_0x38d2('0x5f')][_0x38d2('0x9e')])){throw new db[(_0x38d2('0x8c'))][(_0x38d2('0x8d'))](_0x38d2('0xa0')+_0x4de41d);}_0x18a14b[_0x268eac[_0x38d2('0x5f')][_0x38d2('0x9e')]]=_0x268eac[_0x38d2('0x5f')]['from'];return db[_0x38d2('0xa1')]['find']({'where':{'id':_0x268eac['account']['ListId']},'include':[{'model':db[_0x38d2('0x8b')],'as':_0x38d2('0xa2'),'where':_0x18a14b,'limit':0x1,'order':[[_0x38d2('0x90'),_0x38d2('0xa3')]]}]});})[_0x38d2('0x1b')](handleEntityNotFound(_0x547244,null))[_0x38d2('0x1b')](function(_0x3110a6){if(_0x3110a6){_0x268eac[_0x38d2('0xa4')]=_['omit'](_0x3110a6,['Contacts']);if(_0x3110a6[_0x38d2('0xa2')][_0x38d2('0x48')]){return _0x3110a6[_0x38d2('0xa2')][0x0];}var _0x27f2f6=_['defaults'](_0x268eac[_0x38d2('0x5f')],{'firstName':_0x268eac[_0x38d2('0x5f')][_0x38d2('0x94')],'ListId':_0x3110a6['id']});_0x27f2f6[_0x268eac[_0x38d2('0x5f')][_0x38d2('0x9e')]]=_0x268eac[_0x38d2('0x5f')]['from'];return db[_0x38d2('0x8b')][_0x38d2('0x59')](_0x27f2f6,{'fields':_0x37e449,'raw':!![]});}})[_0x38d2('0x1b')](handleEntityNotFound(_0x547244,null))[_0x38d2('0x1b')](function(_0x267014){if(_0x267014){_0x268eac[_0x38d2('0xa5')]=_0x267014;var _0x1a2daf={'ContactId':_0x267014['id'],'phone':_0x268eac[_0x38d2('0x5f')][_0x38d2('0x94')],'WhatsappAccountId':_0x439dd0[_0x38d2('0x60')]['id']};var _0x3b2187={'ContactId':_0x267014['id'],'WhatsappAccountId':_0x439dd0[_0x38d2('0x60')]['id'],'closed':![]};return db[_0x38d2('0xa6')][_0x38d2('0x58')]({'where':_0x3b2187})[_0x38d2('0x1b')](function(_0x5f2e61){if(_0x5f2e61){return[_0x5f2e61,![]];}return db[_0x38d2('0xa6')][_0x38d2('0x59')](_0x1a2daf)[_0x38d2('0x1b')](function(_0x9415ef){return[_0x9415ef,!![]];});});}})[_0x38d2('0xa7')](function(_0x3b27d4,_0x135d5a){_0x268eac[_0x38d2('0xa8')]=_0x3b27d4[_0x38d2('0x34')]({'plain':!![]});_0x268eac[_0x38d2('0xa8')][_0x38d2('0xa9')]=![];if(_0x135d5a){if(_0x268eac['account']['autoclose']){_0x268eac[_0x38d2('0x89')][_0x38d2('0xaa')]({'id':0x0,'priority':_0x268eac[_0x38d2('0x89')]['length']+0x1,'app':_0x38d2('0xab'),'appdata':_0x38d2('0xac'),'interval':_0x38d2('0xad')});}_0x268eac[_0x38d2('0xa8')][_0x38d2('0xa9')]=!![];}return db[_0x38d2('0x86')][_0x38d2('0x59')]({'phone':_0x268eac['body'][_0x38d2('0x94')],'messageId':_0x268eac[_0x38d2('0x5f')][_0x38d2('0x99')],'body':_0x268eac[_0x38d2('0x5f')][_0x38d2('0x5f')],'WhatsappAccountId':_0x439dd0[_0x38d2('0x60')]['id'],'WhatsappInteractionId':_0x3b27d4['id'],'direction':'in','ContactId':_0x3b27d4[_0x38d2('0xae')],'AttachmentId':_0x268eac[_0x38d2('0x5f')][_0x38d2('0xaf')]});})[_0x38d2('0x1b')](function(_0x4522ba){_0x268eac[_0x38d2('0x24')]=_0x4522ba;if(!_0x268eac[_0x38d2('0xa8')]['UserId'])return;return db['User'][_0x38d2('0x58')]({'attributes':['id',_0x38d2('0x38')],'where':{'id':_0x268eac[_0x38d2('0xa8')][_0x38d2('0xb0')]}});})['then'](function(_0x50e031){if(_0x50e031){_0x268eac[_0x38d2('0x89')][_0x38d2('0xb1')]({'id':0x0,'priority':0x0,'app':_0x38d2('0xb2'),'appdata':_0x50e031[_0x38d2('0x38')]+','+(_0x268eac[_0x38d2('0x81')][_0x38d2('0xb3')]||0xa),'interval':_0x38d2('0xad')});}if(!_0x268eac[_0x38d2('0xa8')][_0x38d2('0xb4')])return;return db[_0x38d2('0xb5')][_0x38d2('0x58')]({'attributes':['id',_0x38d2('0x38')],'where':{'id':_0x268eac[_0x38d2('0xa8')][_0x38d2('0xb4')]}});})[_0x38d2('0x1b')](function(_0x1bc44d){if(_0x1bc44d){_0x268eac[_0x38d2('0x89')][_0x38d2('0xb1')]({'id':0x0,'priority':0x1,'app':_0x38d2('0xb6'),'appdata':_0x1bc44d[_0x38d2('0x38')]+','+(_0x268eac[_0x38d2('0x81')][_0x38d2('0xb7')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x38d2('0xb8'),'startRouting',_0x268eac);})['then'](function(_0x1f5a7f){if(_0x1f5a7f){var _0x27439d=0xc8;var _0x3876dd=_0x38d2('0xb9');logger[_0x38d2('0x1c')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3876dd,_0x27439d,_0x38d2('0xba'));logger[_0x38d2('0x1f')](_0x38d2('0xbb'),_0x3876dd,_0x27439d,_0x38d2('0xba'),JSON[_0x38d2('0x21')](_0x1f5a7f));if(_0x268eac[_0x38d2('0x81')]['type']===_0x38d2('0xbc')){return _0x547244[_0x38d2('0x2d')](_0x27439d)[_0x38d2('0x2e')](_0x38d2('0xbd'),_0x38d2('0xbe'))[_0x38d2('0x39')](_0x38d2('0xbf'));}else{return _0x547244[_0x38d2('0x2d')](_0x27439d)['json'](_0x1f5a7f);}}});})[_0x38d2('0x26')](handleError(_0x547244,null));};exports[_0x38d2('0x39')]=function(_0x1bcdba,_0x30b47d,_0x56f2a2){var _0x12d76b,_0x17294f,_0x373907;if(_['isNil'](_0x1bcdba[_0x38d2('0x5f')][_0x38d2('0x5f')])||_0x1bcdba[_0x38d2('0x5f')][_0x38d2('0x5f')]===''){throw new db[(_0x38d2('0x8c'))][(_0x38d2('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x38d2('0x9b')](_0x1bcdba[_0x38d2('0x5f')]['to'])){throw new db[(_0x38d2('0x8c'))][(_0x38d2('0x8d'))](_0x38d2('0xc0'));}_0x12d76b=_0x1bcdba[_0x38d2('0x5f')]['to'];return db[_0x38d2('0x53')]['find']({'where':{'id':_0x1bcdba[_0x38d2('0x60')]['id']},'include':[{'model':db[_0x38d2('0xa1')],'as':'List','include':[{'model':db[_0x38d2('0x8b')],'as':_0x38d2('0xa2'),'where':{'mobile':_0x12d76b},'limit':0x1,'order':[['updatedAt',_0x38d2('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x30b47d,null))[_0x38d2('0x1b')](function(_0x536d8b){if(_0x536d8b&&_0x536d8b[_0x38d2('0xc1')]){_0x17294f=_0x536d8b[_0x38d2('0x34')]({'plain':!![]});if(_0x17294f[_0x38d2('0xc1')]&&_0x17294f[_0x38d2('0xc1')][_0x38d2('0xa2')][_0x38d2('0x48')]){return _0x17294f[_0x38d2('0xc1')][_0x38d2('0xa2')][0x0];}return db[_0x38d2('0x8b')][_0x38d2('0x59')](_[_0x38d2('0x17')](_0x1bcdba[_0x38d2('0x5f')],{'firstName':_0x12d76b,'mobile':_0x12d76b,'phone':_0x12d76b,'ListId':_0x17294f['ListId']}));}})[_0x38d2('0x1b')](handleEntityNotFound(_0x30b47d,null))[_0x38d2('0x1b')](function(_0x2994b0){if(_0x2994b0){_0x373907=_0x2994b0;return db[_0x38d2('0xa6')][_0x38d2('0x58')]({'where':{'ContactId':_0x373907['id'],'closed':![],'WhatsappAccountId':_0x17294f['id']}})[_0x38d2('0x1b')](function(_0x3be2a5){if(_0x3be2a5){return[_0x3be2a5,![]];}return db[_0x38d2('0xa6')][_0x38d2('0x59')]({'UserId':_0x1bcdba['user']['id'],'ContactId':_0x373907['id'],'WhatsappAccountId':_0x17294f['id'],'phone':_0x12d76b,'firstMsgDirection':_0x38d2('0xc2'),'Messages':[_['merge'](_0x1bcdba['body'],{'read':![],'body':_0x1bcdba[_0x38d2('0x5f')]['body'],'phone':_0x12d76b,'WhatsappAccountId':_0x17294f['id'],'UserId':_0x1bcdba[_0x38d2('0x5a')]['id'],'ContactId':_0x373907['id']})]},{'include':[{'model':db[_0x38d2('0x86')],'as':_0x38d2('0xc3')}]})[_0x38d2('0x1b')](function(_0x3869d5){return[_0x3869d5,!![]];});});}})[_0x38d2('0xa7')](function(_0x1fde42,_0xdbab87){if(_0xdbab87){return _0x1fde42;}return db[_0x38d2('0x86')][_0x38d2('0x59')](_[_0x38d2('0x51')](_0x1bcdba[_0x38d2('0x5f')],{'read':![],'body':_0x1bcdba[_0x38d2('0x5f')]['body'],'phone':_0x12d76b,'WhatsappAccountId':_0x17294f['id'],'WhatsappInteractionId':_0x1fde42['id'],'UserId':_0x1bcdba[_0x38d2('0x5a')]['id'],'ContactId':_0x373907['id']}))[_0x38d2('0x1b')](function(_0x561df6){_0x1fde42[_0x38d2('0xc4')]['Messages']=[];_0x1fde42[_0x38d2('0xc4')][_0x38d2('0xc3')][_0x38d2('0xaa')](_0x561df6[_0x38d2('0xc4')]);return _0x1fde42;});})['then'](respondWithResult(_0x30b47d,null))['catch'](handleError(_0x30b47d,null));}; \ No newline at end of file +var _0x02a4=['queueId','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','stringify','text/xml','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','getAgents','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','read','timestamp','message_id','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','twilio','replace','whatsapp:','Body','MessageSid','notifications','from','messageId','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','autoclose','applications','push','unmanaged','created','WhatsappMessage','ContactId','AttachmentId','unshift','agent','waitForTheAssignedAgent'];(function(_0x2ad003,_0x2d4962){var _0x4cdf67=function(_0x3159e0){while(--_0x3159e0){_0x2ad003['push'](_0x2ad003['shift']());}};_0x4cdf67(++_0x2d4962);}(_0x02a4,0x19d));var _0x402a=function(_0x1fe5d7,_0x263feb){_0x1fe5d7=_0x1fe5d7-0x0;var _0x4873f4=_0x02a4[_0x1fe5d7];return _0x4873f4;};'use strict';var emlformat=require(_0x402a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x402a('0x1'));var rp=require(_0x402a('0x2'));var moment=require(_0x402a('0x3'));var BPromise=require(_0x402a('0x4'));var Mustache=require(_0x402a('0x5'));var util=require('util');var path=require(_0x402a('0x6'));var sox=require(_0x402a('0x7'));var csv=require(_0x402a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x402a('0x9'));var _=require(_0x402a('0xa'));var squel=require(_0x402a('0xb'));var crypto=require('crypto');var jsforce=require(_0x402a('0xc'));var deskjs=require(_0x402a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x402a('0xe'));var Papa=require(_0x402a('0xf'));var Redis=require(_0x402a('0x10'));var authService=require(_0x402a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x402a('0x12'))(_0x402a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x402a('0x14'));var db=require(_0x402a('0x15'))['db'];config['redis']=_[_0x402a('0x16')](config[_0x402a('0x17')],{'host':_0x402a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x402a('0x19'))[_0x402a('0x1a')](socket);var jayson=require(_0x402a('0x1b'));var client=jayson[_0x402a('0x1c')][_0x402a('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x4dd0e9,_0x4897dc,_0x1ef004,_0x5dc2ae){return new BPromise(function(_0x36781e,_0x175017){var _0x387ab8=_0x5dc2ae||client;return _0x387ab8[_0x402a('0x1e')](_0x4dd0e9,_0x1ef004)['then'](function(_0x41f368){logger['info'](_0x402a('0x1f'),_0x4897dc,_0x402a('0x20'));logger[_0x402a('0x21')](_0x402a('0x22'),_0x4897dc,_0x402a('0x20'),JSON['stringify'](_0x41f368));if(_0x41f368['error']){if(_0x41f368['error']['code']===0x1f4){logger['error'](_0x402a('0x1f'),_0x4897dc,_0x41f368[_0x402a('0x23')][_0x402a('0x24')]);return _0x175017(_0x41f368['error'][_0x402a('0x24')]);}logger[_0x402a('0x23')](_0x402a('0x1f'),_0x4897dc,_0x41f368[_0x402a('0x23')]['message']);return _0x36781e(_0x41f368[_0x402a('0x23')]['message']);}else{logger[_0x402a('0x25')](_0x402a('0x1f'),_0x4897dc,_0x402a('0x20'));_0x36781e(_0x41f368[_0x402a('0x26')][_0x402a('0x24')]);}})['catch'](function(_0x34445e){logger[_0x402a('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x4897dc,_0x34445e);_0x175017(_0x34445e);});});}function respondWithStatusCode(_0x1eb8ad,_0x5f2aa2){_0x5f2aa2=_0x5f2aa2||0xcc;return function(_0x53ad68){if(_0x53ad68){return _0x1eb8ad[_0x402a('0x27')](_0x5f2aa2);}return _0x1eb8ad['status'](_0x5f2aa2)['end']();};}function respondWithResult(_0x2c2583,_0x4910fa){_0x4910fa=_0x4910fa||0xc8;return function(_0x3ed63d){if(_0x3ed63d){return _0x2c2583['status'](_0x4910fa)[_0x402a('0x28')](_0x3ed63d);}};}function respondWithFilteredResult(_0x4c82d3,_0x1fcba1){return function(_0x4d4e96){if(_0x4d4e96){var _0x4cd228=typeof _0x1fcba1[_0x402a('0x29')]==='undefined'&&typeof _0x1fcba1[_0x402a('0x2a')]===_0x402a('0x2b');var _0x5dfafb=_0x4d4e96[_0x402a('0x2c')];var _0x6ac4fa=_0x4cd228?0x0:_0x1fcba1[_0x402a('0x29')];var _0x441536=_0x4cd228?_0x4d4e96[_0x402a('0x2c')]:_0x1fcba1[_0x402a('0x29')]+_0x1fcba1[_0x402a('0x2a')];var _0x5b2d72;if(_0x441536>=_0x5dfafb){_0x441536=_0x5dfafb;_0x5b2d72=0xc8;}else{_0x5b2d72=0xce;}_0x4c82d3[_0x402a('0x2d')](_0x5b2d72);return _0x4c82d3[_0x402a('0x2e')](_0x402a('0x2f'),_0x6ac4fa+'-'+_0x441536+'/'+_0x5dfafb)[_0x402a('0x28')](_0x4d4e96);}return null;};}function patchUpdates(_0x1d8fd5){return function(_0x4e9228){try{jsonpatch[_0x402a('0x30')](_0x4e9228,_0x1d8fd5,!![]);}catch(_0x4e6f94){return BPromise[_0x402a('0x31')](_0x4e6f94);}return _0x4e9228[_0x402a('0x32')]();};}function saveUpdates(_0x5eb908,_0x3fdc94){return function(_0x201aac){if(_0x201aac){return _0x201aac['update'](_0x5eb908)[_0x402a('0x33')](function(_0x561198){return _0x561198;});}return null;};}function removeEntity(_0x52b709,_0x570379){return function(_0x7fc1bb){if(_0x7fc1bb){return _0x7fc1bb[_0x402a('0x34')]()['then'](function(){var _0x2427e3=_0x7fc1bb[_0x402a('0x35')]({'plain':!![]});var _0x51c15b='WhatsappAccounts';return db[_0x402a('0x36')][_0x402a('0x34')]({'where':{'type':_0x51c15b,'resourceId':_0x2427e3['id']}})[_0x402a('0x33')](function(){return _0x7fc1bb;});})[_0x402a('0x33')](function(){_0x52b709['status'](0xcc)[_0x402a('0x37')]();});}};}function handleEntityNotFound(_0x33ec84,_0x11bc4b){return function(_0x173a00){if(!_0x173a00){_0x33ec84[_0x402a('0x27')](0x194);}return _0x173a00;};}function handleError(_0x4b260f,_0x4c7a1b){_0x4c7a1b=_0x4c7a1b||0x1f4;return function(_0x27788b){logger[_0x402a('0x23')](_0x27788b[_0x402a('0x38')]);if(_0x27788b[_0x402a('0x39')]){delete _0x27788b[_0x402a('0x39')];}_0x4b260f[_0x402a('0x2d')](_0x4c7a1b)[_0x402a('0x3a')](_0x27788b);};}exports[_0x402a('0x3b')]=function(_0x2ec78c,_0x56b35f){var _0x479202={'include':[{'model':db[_0x402a('0x3c')],'as':_0x402a('0x3d')}]},_0x58af7a={},_0x448797={'count':0x0,'rows':[]};var _0x39c974=_[_0x402a('0x3e')](db[_0x402a('0x3f')][_0x402a('0x40')],function(_0x58d36e){return{'name':_0x58d36e[_0x402a('0x41')],'type':_0x58d36e[_0x402a('0x42')]['key']};});_0x58af7a['model']=_[_0x402a('0x3e')](_0x39c974,'name');_0x58af7a[_0x402a('0x43')]=_[_0x402a('0x44')](_0x2ec78c[_0x402a('0x43')]);_0x58af7a[_0x402a('0x45')]=_[_0x402a('0x46')](_0x58af7a[_0x402a('0x47')],_0x58af7a[_0x402a('0x43')]);_0x479202[_0x402a('0x48')]=_['intersection'](_0x58af7a[_0x402a('0x47')],qs['fields'](_0x2ec78c[_0x402a('0x43')][_0x402a('0x49')]));_0x479202[_0x402a('0x48')]=_0x479202[_0x402a('0x48')][_0x402a('0x4a')]?_0x479202[_0x402a('0x48')]:_0x58af7a[_0x402a('0x47')];if(!_0x2ec78c[_0x402a('0x43')][_0x402a('0x4b')](_0x402a('0x4c'))){_0x479202[_0x402a('0x2a')]=qs[_0x402a('0x2a')](_0x2ec78c['query']['limit']);_0x479202[_0x402a('0x29')]=qs[_0x402a('0x29')](_0x2ec78c['query'][_0x402a('0x29')]);}_0x479202[_0x402a('0x4d')]=qs[_0x402a('0x4e')](_0x2ec78c[_0x402a('0x43')][_0x402a('0x4e')]);_0x479202['where']=qs['filters'](_[_0x402a('0x4f')](_0x2ec78c['query'],_0x58af7a[_0x402a('0x45')]),_0x39c974);if(_0x2ec78c[_0x402a('0x43')][_0x402a('0x50')]){_0x479202['where']=_[_0x402a('0x51')](_0x479202[_0x402a('0x52')],{'$or':_['map'](_0x39c974,function(_0x19d793){if(_0x19d793['type']!==_0x402a('0x53')){var _0x58899b={};_0x58899b[_0x19d793[_0x402a('0x39')]]={'$like':'%'+_0x2ec78c[_0x402a('0x43')]['filter']+'%'};return _0x58899b;}})});}_0x479202=_['merge']({},_0x479202,_0x2ec78c[_0x402a('0x54')]);var _0xe1ebda={'where':_0x479202[_0x402a('0x52')]};return db[_0x402a('0x3f')]['count'](_0xe1ebda)[_0x402a('0x33')](function(_0x3dc757){_0x448797[_0x402a('0x2c')]=_0x3dc757;if(_0x2ec78c[_0x402a('0x43')][_0x402a('0x55')]){_0x479202[_0x402a('0x56')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x402a('0x57')](_0x479202);})[_0x402a('0x33')](function(_0x2c68ce){_0x448797[_0x402a('0x58')]=_0x2c68ce;return _0x448797;})['then'](respondWithFilteredResult(_0x56b35f,_0x479202))[_0x402a('0x59')](handleError(_0x56b35f,null));};exports[_0x402a('0x5a')]=function(_0x693c3c,_0x565ee5){var _0x44f682={'raw':![],'where':{'id':_0x693c3c[_0x402a('0x5b')]['id']},'include':[{'model':db[_0x402a('0x3c')],'as':'mandatoryDispositionPause'}]},_0x537abc={};_0x537abc['model']=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x537abc['query']=_[_0x402a('0x44')](_0x693c3c[_0x402a('0x43')]);_0x537abc[_0x402a('0x45')]=_['intersection'](_0x537abc[_0x402a('0x47')],_0x537abc['query']);_0x44f682[_0x402a('0x48')]=_[_0x402a('0x46')](_0x537abc[_0x402a('0x47')],qs[_0x402a('0x49')](_0x693c3c['query'][_0x402a('0x49')]));_0x44f682['attributes']=_0x44f682[_0x402a('0x48')]['length']?_0x44f682['attributes']:_0x537abc[_0x402a('0x47')];if(_0x693c3c['query']['includeAll']){_0x44f682['include']=[{'all':!![]}];}_0x44f682=_[_0x402a('0x51')]({},_0x44f682,_0x693c3c[_0x402a('0x54')]);return db['WhatsappAccount']['find'](_0x44f682)[_0x402a('0x33')](handleEntityNotFound(_0x565ee5,null))[_0x402a('0x33')](respondWithResult(_0x565ee5,null))[_0x402a('0x59')](handleError(_0x565ee5,null));};exports[_0x402a('0x5c')]=function(_0x569cba,_0x40d94f){return db[_0x402a('0x3f')]['create'](_0x569cba[_0x402a('0x5d')],{})[_0x402a('0x33')](function(_0x2b5528){var _0x4e64fc=_0x569cba[_0x402a('0x5e')][_0x402a('0x35')]({'plain':!![]});if(!_0x4e64fc)throw new Error(_0x402a('0x5f'));if(_0x4e64fc['role']===_0x402a('0x5e')){var _0x470638=_0x2b5528[_0x402a('0x35')]({'plain':!![]});var _0x37aae0=_0x402a('0x60');return db[_0x402a('0x61')][_0x402a('0x62')]({'where':{'name':_0x37aae0,'userProfileId':_0x4e64fc[_0x402a('0x63')]},'raw':!![]})[_0x402a('0x33')](function(_0x4650d2){if(_0x4650d2&&_0x4650d2['autoAssociation']===0x0){return db[_0x402a('0x36')][_0x402a('0x5c')]({'name':_0x470638[_0x402a('0x39')],'resourceId':_0x470638['id'],'type':_0x4650d2['name'],'sectionId':_0x4650d2['id']},{})['then'](function(){return _0x2b5528;});}else{return _0x2b5528;}})[_0x402a('0x59')](function(_0x44cf3e){logger[_0x402a('0x23')](_0x402a('0x64'),_0x44cf3e);throw _0x44cf3e;});}return _0x2b5528;})[_0x402a('0x33')](respondWithResult(_0x40d94f,0xc9))['catch'](handleError(_0x40d94f,null));};exports[_0x402a('0x65')]=function(_0x547b71,_0x3bb646){if(_0x547b71[_0x402a('0x5d')]['id']){delete _0x547b71['body']['id'];}return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x547b71[_0x402a('0x5b')]['id']},'include':[{'model':db[_0x402a('0x3c')],'as':_0x402a('0x3d')}]})['then'](handleEntityNotFound(_0x3bb646,null))[_0x402a('0x33')](saveUpdates(_0x547b71[_0x402a('0x5d')],null))[_0x402a('0x33')](respondWithResult(_0x3bb646,null))[_0x402a('0x59')](handleError(_0x3bb646,null));};exports[_0x402a('0x34')]=function(_0x4650bd,_0x223882){return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x4650bd[_0x402a('0x5b')]['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x223882,null))['then'](removeEntity(_0x223882,null))['catch'](handleError(_0x223882,null));};exports[_0x402a('0x66')]=function(_0x4a3681,_0x2ea641){return db[_0x402a('0x3f')]['describe']()[_0x402a('0x33')](respondWithResult(_0x2ea641,null))[_0x402a('0x59')](handleError(_0x2ea641,null));};exports[_0x402a('0x67')]=function(_0x4edefe,_0x28f572,_0x1b2dde){if(_0x4edefe['body']['id']){delete _0x4edefe[_0x402a('0x5d')]['id'];}return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x4edefe[_0x402a('0x5b')]['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x28f572,null))[_0x402a('0x33')](function(_0x31440a){if(_0x31440a){_0x4edefe[_0x402a('0x5d')]['WhatsappAccountId']=_0x31440a['id'];return db[_0x402a('0x68')][_0x402a('0x5c')](_0x4edefe[_0x402a('0x5d')]);}})[_0x402a('0x33')](respondWithResult(_0x28f572,null))[_0x402a('0x59')](handleError(_0x28f572,null));};exports[_0x402a('0x69')]=function(_0x554345,_0x587708,_0x26ce44){var _0x5db717={'raw':![],'where':{}};var _0x31c575={};var _0x1075dd={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x402a('0x6a')]({'where':{'id':_0x554345[_0x402a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x587708,null))[_0x402a('0x33')](function(_0x544a75){if(_0x544a75){_0x31c575['model']=_[_0x402a('0x44')](db[_0x402a('0x68')][_0x402a('0x40')]);_0x31c575[_0x402a('0x43')]=_[_0x402a('0x44')](_0x554345['query']);_0x31c575[_0x402a('0x45')]=_['intersection'](_0x31c575['model'],_0x31c575[_0x402a('0x43')]);_0x5db717['attributes']=_[_0x402a('0x46')](_0x31c575['model'],qs['fields'](_0x554345['query']['fields']));_0x5db717['attributes']=_0x5db717[_0x402a('0x48')]['length']?_0x5db717['attributes']:_0x31c575['model'];if(!_0x554345[_0x402a('0x43')][_0x402a('0x4b')]('nolimit')){_0x5db717[_0x402a('0x2a')]=qs['limit'](_0x554345[_0x402a('0x43')][_0x402a('0x2a')]);_0x5db717[_0x402a('0x29')]=qs[_0x402a('0x29')](_0x554345['query']['offset']);}_0x5db717[_0x402a('0x4d')]=qs[_0x402a('0x4e')](_0x554345['query']['sort']);_0x5db717[_0x402a('0x52')]=qs[_0x402a('0x45')](_['pick'](_0x554345['query'],_0x31c575[_0x402a('0x45')]));_0x5db717[_0x402a('0x52')][_0x402a('0x6b')]=_0x544a75['id'];if(_0x554345[_0x402a('0x43')][_0x402a('0x50')]){_0x5db717[_0x402a('0x52')]=_[_0x402a('0x51')](_0x5db717[_0x402a('0x52')],{'$or':_[_0x402a('0x3e')](_0x5db717[_0x402a('0x48')],function(_0x5aae4e){var _0x427b3a={};_0x427b3a[_0x5aae4e]={'$like':'%'+_0x554345[_0x402a('0x43')]['filter']+'%'};return _0x427b3a;})});}_0x5db717=_[_0x402a('0x51')]({},_0x5db717,_0x554345[_0x402a('0x54')]);return db['Disposition']['count']({'where':_0x5db717['where']})[_0x402a('0x33')](function(_0x2dfb32){_0x1075dd[_0x402a('0x2c')]=_0x2dfb32;if(_0x554345[_0x402a('0x43')][_0x402a('0x55')]){_0x5db717[_0x402a('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x402a('0x57')](_0x5db717);})[_0x402a('0x33')](function(_0x4e0ab0){_0x1075dd[_0x402a('0x58')]=_0x4e0ab0;return _0x1075dd;});}})['then'](respondWithFilteredResult(_0x587708,_0x5db717))[_0x402a('0x59')](handleError(_0x587708,null));};exports[_0x402a('0x6c')]=function(_0x4378c0,_0x374c56,_0x855bfc){return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x4378c0[_0x402a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x374c56,null))['then'](function(_0xa45289){if(_0xa45289){return _0xa45289[_0x402a('0x6c')](_0x4378c0[_0x402a('0x43')][_0x402a('0x6d')]);}})['then'](respondWithStatusCode(_0x374c56,null))[_0x402a('0x59')](handleError(_0x374c56,null));};exports[_0x402a('0x6e')]=function(_0x538ac6,_0x478e17,_0x1e1b0d){if(_0x538ac6['body']['id']){delete _0x538ac6[_0x402a('0x5d')]['id'];}return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x538ac6['params']['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x478e17,null))[_0x402a('0x33')](function(_0x5cc264){if(_0x5cc264){_0x538ac6[_0x402a('0x5d')][_0x402a('0x6b')]=_0x5cc264['id'];return db[_0x402a('0x6f')]['create'](_0x538ac6['body']);}})[_0x402a('0x33')](respondWithResult(_0x478e17,null))['catch'](handleError(_0x478e17,null));};exports['getAnswers']=function(_0x5bf82f,_0x56a441,_0x161259){var _0x4540b4={'raw':![],'where':{}};var _0x1c06cc={};var _0x5cdc1c={'count':0x0,'rows':[]};return db[_0x402a('0x3f')]['findOne']({'where':{'id':_0x5bf82f[_0x402a('0x5b')]['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x56a441,null))['then'](function(_0x3a7220){if(_0x3a7220){_0x1c06cc[_0x402a('0x47')]=_[_0x402a('0x44')](db[_0x402a('0x6f')][_0x402a('0x40')]);_0x1c06cc['query']=_[_0x402a('0x44')](_0x5bf82f[_0x402a('0x43')]);_0x1c06cc[_0x402a('0x45')]=_[_0x402a('0x46')](_0x1c06cc['model'],_0x1c06cc[_0x402a('0x43')]);_0x4540b4[_0x402a('0x48')]=_['intersection'](_0x1c06cc['model'],qs['fields'](_0x5bf82f['query'][_0x402a('0x49')]));_0x4540b4[_0x402a('0x48')]=_0x4540b4[_0x402a('0x48')][_0x402a('0x4a')]?_0x4540b4[_0x402a('0x48')]:_0x1c06cc['model'];if(!_0x5bf82f[_0x402a('0x43')][_0x402a('0x4b')](_0x402a('0x4c'))){_0x4540b4[_0x402a('0x2a')]=qs[_0x402a('0x2a')](_0x5bf82f[_0x402a('0x43')][_0x402a('0x2a')]);_0x4540b4[_0x402a('0x29')]=qs[_0x402a('0x29')](_0x5bf82f['query'][_0x402a('0x29')]);}_0x4540b4[_0x402a('0x4d')]=qs[_0x402a('0x4e')](_0x5bf82f[_0x402a('0x43')][_0x402a('0x4e')]);_0x4540b4['where']=qs['filters'](_[_0x402a('0x4f')](_0x5bf82f[_0x402a('0x43')],_0x1c06cc[_0x402a('0x45')]));_0x4540b4['where']['WhatsappAccountId']=_0x3a7220['id'];if(_0x5bf82f[_0x402a('0x43')]['filter']){_0x4540b4[_0x402a('0x52')]=_[_0x402a('0x51')](_0x4540b4[_0x402a('0x52')],{'$or':_[_0x402a('0x3e')](_0x4540b4[_0x402a('0x48')],function(_0x1f32fd){var _0x703881={};_0x703881[_0x1f32fd]={'$like':'%'+_0x5bf82f['query']['filter']+'%'};return _0x703881;})});}_0x4540b4=_[_0x402a('0x51')]({},_0x4540b4,_0x5bf82f[_0x402a('0x54')]);return db[_0x402a('0x6f')][_0x402a('0x2c')]({'where':_0x4540b4[_0x402a('0x52')]})[_0x402a('0x33')](function(_0x5887a7){_0x5cdc1c[_0x402a('0x2c')]=_0x5887a7;if(_0x5bf82f[_0x402a('0x43')][_0x402a('0x55')]){_0x4540b4[_0x402a('0x56')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4540b4);})['then'](function(_0x250fb7){_0x5cdc1c['rows']=_0x250fb7;return _0x5cdc1c;});}})[_0x402a('0x33')](respondWithFilteredResult(_0x56a441,_0x4540b4))['catch'](handleError(_0x56a441,null));};exports[_0x402a('0x70')]=function(_0x37cecd,_0x5b7ce7,_0x502138){return db['WhatsappAccount']['find']({'where':{'id':_0x37cecd[_0x402a('0x5b')]['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x5b7ce7,null))[_0x402a('0x33')](function(_0x46abf5){if(_0x46abf5){return _0x46abf5[_0x402a('0x70')](_0x37cecd[_0x402a('0x43')][_0x402a('0x6d')]);}})[_0x402a('0x33')](respondWithStatusCode(_0x5b7ce7,null))[_0x402a('0x59')](handleError(_0x5b7ce7,null));};exports['addAgents']=function(_0x1aca12,_0x401641,_0x448523){return db['WhatsappAccount'][_0x402a('0x62')]({'where':{'id':_0x1aca12[_0x402a('0x5b')]['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x401641,null))['then'](function(_0x26db94){if(_0x26db94){return _0x26db94[_0x402a('0x71')](_0x1aca12['body'][_0x402a('0x6d')],_[_0x402a('0x72')](_0x1aca12['body'],[_0x402a('0x6d'),'id'])||{})[_0x402a('0x73')](function(_0x2b1e20){for(var _0x3e032e=0x0;_0x3e032e<_0x1aca12[_0x402a('0x5d')]['ids'][_0x402a('0x4a')];_0x3e032e+=0x1){socket[_0x402a('0x74')](_0x402a('0x75'),{'UserId':Number(_0x1aca12['body']['ids'][_0x3e032e]),'WhatsappAccountId':Number(_0x1aca12['params']['id'])});}return _0x2b1e20;});}})[_0x402a('0x33')](respondWithResult(_0x401641,null))[_0x402a('0x59')](handleError(_0x401641,null));};exports[_0x402a('0x76')]=function(_0x6d6dbc,_0x11a698,_0x20501d){return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x6d6dbc['params']['id']}})[_0x402a('0x33')](handleEntityNotFound(_0x11a698,null))[_0x402a('0x33')](function(_0x44a0e5){if(_0x44a0e5){return _0x44a0e5[_0x402a('0x76')](_0x6d6dbc[_0x402a('0x43')][_0x402a('0x6d')])['then'](function(){if(_[_0x402a('0x77')](_0x6d6dbc[_0x402a('0x43')][_0x402a('0x6d')])){for(var _0x2cf7d5=0x0;_0x2cf7d5<_0x6d6dbc[_0x402a('0x43')][_0x402a('0x6d')][_0x402a('0x4a')];_0x2cf7d5+=0x1){socket[_0x402a('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x6d6dbc[_0x402a('0x43')][_0x402a('0x6d')][_0x2cf7d5]),'WhatsappAccountId':Number(_0x6d6dbc[_0x402a('0x5b')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x6d6dbc[_0x402a('0x43')][_0x402a('0x6d')]),'WhatsappAccountId':Number(_0x6d6dbc['params']['id'])});}});}})['then'](respondWithStatusCode(_0x11a698,null))[_0x402a('0x59')](handleError(_0x11a698,null));};exports[_0x402a('0x78')]=function(_0xea021a,_0x43476d,_0x1bd37d){var _0x119bef={};var _0xc2d3a8={};var _0x176ba0;var _0x13f3ab;return db[_0x402a('0x3f')][_0x402a('0x6a')]({'where':{'id':_0xea021a[_0x402a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x43476d,null))['then'](function(_0x479ba5){if(_0x479ba5){_0x176ba0=_0x479ba5;_0xc2d3a8[_0x402a('0x47')]=_[_0x402a('0x44')](db['User'][_0x402a('0x40')]);_0xc2d3a8[_0x402a('0x43')]=_[_0x402a('0x44')](_0xea021a[_0x402a('0x43')]);_0xc2d3a8[_0x402a('0x45')]=_[_0x402a('0x46')](_0xc2d3a8[_0x402a('0x47')],_0xc2d3a8[_0x402a('0x43')]);_0x119bef[_0x402a('0x48')]=_[_0x402a('0x46')](_0xc2d3a8['model'],qs[_0x402a('0x49')](_0xea021a[_0x402a('0x43')]['fields']));_0x119bef[_0x402a('0x48')]=_0x119bef[_0x402a('0x48')][_0x402a('0x4a')]?_0x119bef[_0x402a('0x48')]:_0xc2d3a8[_0x402a('0x47')];_0x119bef[_0x402a('0x4d')]=qs[_0x402a('0x4e')](_0xea021a['query'][_0x402a('0x4e')]);_0x119bef[_0x402a('0x52')]=qs[_0x402a('0x45')](_['pick'](_0xea021a[_0x402a('0x43')],_0xc2d3a8['filters']));if(_0xea021a[_0x402a('0x43')][_0x402a('0x50')]){_0x119bef['where']=_[_0x402a('0x51')](_0x119bef[_0x402a('0x52')],{'$or':_[_0x402a('0x3e')](_0x119bef[_0x402a('0x48')],function(_0x520fd3){var _0x2c7ede={};_0x2c7ede[_0x520fd3]={'$like':'%'+_0xea021a['query'][_0x402a('0x50')]+'%'};return _0x2c7ede;})});}_0x119bef=_[_0x402a('0x51')]({},_0x119bef,_0xea021a[_0x402a('0x54')]);return _0x176ba0['getAgents'](_0x119bef);}})['then'](function(_0xf427c1){if(_0xf427c1){_0x13f3ab=_0xf427c1['length'];if(!_0xea021a[_0x402a('0x43')][_0x402a('0x4b')](_0x402a('0x4c'))){_0x119bef['limit']=qs[_0x402a('0x2a')](_0xea021a[_0x402a('0x43')][_0x402a('0x2a')]);_0x119bef['offset']=qs[_0x402a('0x29')](_0xea021a[_0x402a('0x43')][_0x402a('0x29')]);}return _0x176ba0[_0x402a('0x78')](_0x119bef);}})['then'](function(_0x57a8e6){if(_0x57a8e6){return _0x57a8e6?{'count':_0x13f3ab,'rows':_0x57a8e6}:null;}})[_0x402a('0x33')](respondWithResult(_0x43476d,null))[_0x402a('0x59')](handleError(_0x43476d,null));};exports[_0x402a('0x79')]=function(_0x45e66c,_0x6423bf){var _0x31f3d8=_0x45e66c[_0x402a('0x5b')]['id'];var _0x14a942=_0x45e66c['body'];var _0xf0a915=0xc8;var _0x24f753=null;return db['sequelize'][_0x402a('0x7a')]({'isolationLevel':db[_0x402a('0x7b')][_0x402a('0x7c')][_0x402a('0x7d')][_0x402a('0x7e')]},function(_0x19fc88){return db[_0x402a('0x3f')][_0x402a('0x6a')]({'where':{'id':_0x31f3d8},'transaction':_0x19fc88})['then'](function(_0xe30c18){if(_0xe30c18){return db['WhatsappApplication'][_0x402a('0x34')]({'where':{'WhatsappAccountId':_0x31f3d8},'transaction':_0x19fc88})[_0x402a('0x33')](function(){var _0x5259af=_['map'](_0x14a942,function(_0x86e07c){_0x86e07c[_0x402a('0x6b')]=_0x31f3d8;return _0x86e07c;});return db['WhatsappApplication'][_0x402a('0x7f')](_0x5259af,{'transaction':_0x19fc88});});}else{_0xf0a915=0x194;_0x24f753=[];}});})[_0x402a('0x33')](function(){if(_0xf0a915!==0x194){return db[_0x402a('0x80')][_0x402a('0x81')]({'where':{'WhatsappAccountId':_0x31f3d8},'order':_0x402a('0x82')})[_0x402a('0x33')](function(_0x59bd52){_0x24f753=_0x59bd52;});}})['catch'](function(_0x2c7bf2){_0xf0a915=0x1f4;logger[_0x402a('0x23')](_0x2c7bf2[_0x402a('0x38')]);if(_0x2c7bf2['name']){delete _0x2c7bf2[_0x402a('0x39')];}_0x24f753=_0x2c7bf2;})[_0x402a('0x83')](function(){if(_0x24f753===null){_0x6423bf[_0x402a('0x27')](_0xf0a915);}else{if(_0xf0a915===0x1f4){_0x6423bf[_0x402a('0x2d')](_0xf0a915)[_0x402a('0x3a')](_0x24f753);}else{_0x6423bf[_0x402a('0x2d')](_0xf0a915)['json'](_0x24f753);}}});};exports[_0x402a('0x84')]=function(_0x21461c,_0xc8a3c2,_0x31f442){var _0x1f92f7={};var _0x24c5ac={};var _0x4a41c0;var _0x3b5e64;return db['WhatsappAccount'][_0x402a('0x6a')]({'where':{'id':_0x21461c['params']['id']}})[_0x402a('0x33')](handleEntityNotFound(_0xc8a3c2,null))[_0x402a('0x33')](function(_0x4744dd){if(_0x4744dd){_0x4a41c0=_0x4744dd;_0x24c5ac[_0x402a('0x47')]=_['keys'](db[_0x402a('0x80')][_0x402a('0x40')]);_0x24c5ac[_0x402a('0x43')]=_[_0x402a('0x44')](_0x21461c[_0x402a('0x43')]);_0x24c5ac[_0x402a('0x45')]=_[_0x402a('0x46')](_0x24c5ac[_0x402a('0x47')],_0x24c5ac[_0x402a('0x43')]);_0x1f92f7[_0x402a('0x48')]=_['intersection'](_0x24c5ac[_0x402a('0x47')],qs['fields'](_0x21461c[_0x402a('0x43')][_0x402a('0x49')]));_0x1f92f7[_0x402a('0x48')]=_0x1f92f7[_0x402a('0x48')][_0x402a('0x4a')]?_0x1f92f7[_0x402a('0x48')]:_0x24c5ac[_0x402a('0x47')];_0x1f92f7['order']=qs[_0x402a('0x4e')](_0x21461c[_0x402a('0x43')]['sort']);_0x1f92f7['where']=qs['filters'](_['pick'](_0x21461c[_0x402a('0x43')],_0x24c5ac['filters']));if(_0x21461c['query'][_0x402a('0x50')]){_0x1f92f7[_0x402a('0x52')]=_[_0x402a('0x51')](_0x1f92f7[_0x402a('0x52')],{'$or':_[_0x402a('0x3e')](_0x1f92f7[_0x402a('0x48')],function(_0x4e2f1f){var _0x3d65e={};_0x3d65e[_0x4e2f1f]={'$like':'%'+_0x21461c[_0x402a('0x43')][_0x402a('0x50')]+'%'};return _0x3d65e;})});}_0x1f92f7=_['merge']({},_0x1f92f7,_0x21461c[_0x402a('0x54')]);return _0x4a41c0[_0x402a('0x84')](_0x1f92f7);}})[_0x402a('0x33')](function(_0x5dea07){if(_0x5dea07){_0x3b5e64=_0x5dea07[_0x402a('0x4a')];if(!_0x21461c[_0x402a('0x43')][_0x402a('0x4b')](_0x402a('0x4c'))){_0x1f92f7[_0x402a('0x2a')]=qs[_0x402a('0x2a')](_0x21461c[_0x402a('0x43')][_0x402a('0x2a')]);_0x1f92f7[_0x402a('0x29')]=qs[_0x402a('0x29')](_0x21461c['query']['offset']);}return _0x4a41c0[_0x402a('0x84')](_0x1f92f7);}})[_0x402a('0x33')](function(_0x2c3dd6){if(_0x2c3dd6){return _0x2c3dd6?{'count':_0x3b5e64,'rows':_0x2c3dd6}:null;}})[_0x402a('0x33')](respondWithResult(_0xc8a3c2,null))['catch'](handleError(_0xc8a3c2,null));};exports[_0x402a('0x85')]=function(_0x4af33d,_0x4311d5,_0x2ad21e){var _0x326824={'channel':_0x402a('0x86')};var _0x2e8bf6=[];var _0x1886ad=[];var _0x2181c0={};return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x4af33d[_0x402a('0x5b')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x4311d5,null))[_0x402a('0x33')](function(_0x1c00aa){_0x326824[_0x402a('0x87')]=_0x1c00aa;if(_0x326824[_0x402a('0x87')]&&_0x326824[_0x402a('0x87')][_0x402a('0x42')]===_0x402a('0x88')&&_0x4af33d[_0x402a('0x5d')][_0x402a('0x89')]){if(_0x4af33d['body'][_0x402a('0x89')]['length']===0x0)return;if(_0x4af33d[_0x402a('0x5d')][_0x402a('0x89')][0x0]['state']!==_0x402a('0x8a'))return;return db['WhatsappMessage'][_0x402a('0x65')]({'read':!![],'readAt':_0x4af33d['body'][_0x402a('0x89')][0x0][_0x402a('0x8b')]},{'where':{'messageId':_0x4af33d[_0x402a('0x5d')][_0x402a('0x89')][0x0][_0x402a('0x8c')]},'individualHooks':!![]})['then'](function(_0x1c5f52){return _0x4311d5['status'](0xc8)[_0x402a('0x28')](_0x1c5f52);});}_0x326824['applications']=_[_0x402a('0x8d')](_0x1c00aa[_0x402a('0x8e')],[_0x402a('0x82')],[_0x402a('0x8f')]);if(_0x326824[_0x402a('0x87')][_0x402a('0x8e')]){delete _0x326824[_0x402a('0x87')][_0x402a('0x8e')];}return db[_0x402a('0x90')][_0x402a('0x66')]()['then'](function(_0x37a362){if(!_0x37a362){throw new db[(_0x402a('0x91'))]['ValidationError'](_0x402a('0x92'));}_0x2e8bf6=_[_0x402a('0x93')](_[_0x402a('0x44')](_0x37a362),['createdAt',_0x402a('0x94')]);_0x1886ad=_[_0x402a('0x93')](_[_0x402a('0x44')](_0x37a362),[_0x402a('0x95'),_0x402a('0x94'),_0x402a('0x96'),_0x402a('0x97')]);_0x326824[_0x402a('0x5d')]={'mapKey':'mobile'};if(_0x326824[_0x402a('0x87')]&&_0x326824[_0x402a('0x87')]['type']===_0x402a('0x98')){_0x326824[_0x402a('0x5d')]['from']=_0x4af33d[_0x402a('0x5d')]['From'][_0x402a('0x99')](_0x402a('0x9a'),'');_0x326824['body']['body']=_0x4af33d[_0x402a('0x5d')][_0x402a('0x9b')];_0x326824[_0x402a('0x5d')]['messageId']=_0x4af33d[_0x402a('0x5d')][_0x402a('0x9c')];}if(_0x326824[_0x402a('0x87')]&&_0x326824['account']['type']===_0x402a('0x88')){_0x326824[_0x402a('0x5d')]['from']=_0x4af33d[_0x402a('0x5d')][_0x402a('0x9d')][0x0][_0x402a('0x9e')];_0x326824[_0x402a('0x5d')][_0x402a('0x5d')]=_0x4af33d[_0x402a('0x5d')][_0x402a('0x9d')][0x0][_0x402a('0x24')][_0x402a('0x5d')];_0x326824[_0x402a('0x5d')][_0x402a('0x9f')]=_0x4af33d[_0x402a('0x5d')][_0x402a('0x9d')][0x0][_0x402a('0x8c')];}if(_0x326824['body']['id']){delete _0x326824['body']['id'];}if(_[_0x402a('0xa0')](_0x326824[_0x402a('0x5d')]['from'])){throw new db[(_0x402a('0x91'))]['ValidationError'](_0x402a('0xa1'));}if(_['isNil'](_0x326824[_0x402a('0x5d')]['body'])||_0x326824[_0x402a('0x5d')][_0x402a('0x5d')]===''){throw new db[(_0x402a('0x91'))][(_0x402a('0xa2'))](_0x402a('0xa3'));}if(_['isNil'](_0x326824[_0x402a('0x5d')][_0x402a('0xa4')])){throw new db['Sequelize'][(_0x402a('0xa2'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1886ad);}if(!_[_0x402a('0xa5')](_0x1886ad,_0x326824[_0x402a('0x5d')][_0x402a('0xa4')])){throw new db['Sequelize'][(_0x402a('0xa2'))](_0x402a('0xa6')+_0x1886ad);}_0x2181c0[_0x326824['body'][_0x402a('0xa4')]]=_0x326824[_0x402a('0x5d')][_0x402a('0x9e')];return db[_0x402a('0xa7')][_0x402a('0x62')]({'where':{'id':_0x326824[_0x402a('0x87')]['ListId']},'include':[{'model':db[_0x402a('0x90')],'as':_0x402a('0xa8'),'where':_0x2181c0,'limit':0x1,'order':[[_0x402a('0x94'),_0x402a('0xa9')]]}]});})[_0x402a('0x33')](handleEntityNotFound(_0x4311d5,null))[_0x402a('0x33')](function(_0x97138e){if(_0x97138e){_0x326824['list']=_[_0x402a('0x72')](_0x97138e,[_0x402a('0xa8')]);if(_0x97138e[_0x402a('0xa8')][_0x402a('0x4a')]){return _0x97138e['Contacts'][0x0];}var _0x73f6d4=_['defaults'](_0x326824[_0x402a('0x5d')],{'firstName':_0x326824[_0x402a('0x5d')][_0x402a('0x9e')],'ListId':_0x97138e['id']});_0x73f6d4[_0x326824[_0x402a('0x5d')][_0x402a('0xa4')]]=_0x326824[_0x402a('0x5d')][_0x402a('0x9e')];return db[_0x402a('0x90')][_0x402a('0x5c')](_0x73f6d4,{'fields':_0x2e8bf6,'raw':!![]});}})['then'](handleEntityNotFound(_0x4311d5,null))[_0x402a('0x33')](function(_0x329bb1){if(_0x329bb1){_0x326824[_0x402a('0xaa')]=_0x329bb1;var _0x5a8f2b={'ContactId':_0x329bb1['id'],'phone':_0x326824['body'][_0x402a('0x9e')],'WhatsappAccountId':_0x4af33d[_0x402a('0x5b')]['id']};var _0x5a75c7={'ContactId':_0x329bb1['id'],'WhatsappAccountId':_0x4af33d[_0x402a('0x5b')]['id'],'closed':![]};return db[_0x402a('0xab')][_0x402a('0x62')]({'where':_0x5a75c7})['then'](function(_0x2a7562){if(_0x2a7562){return[_0x2a7562,![]];}return db[_0x402a('0xab')][_0x402a('0x5c')](_0x5a8f2b)[_0x402a('0x33')](function(_0x2cff23){return[_0x2cff23,!![]];});});}})[_0x402a('0x73')](function(_0x4cf7f3,_0x27c8b5){_0x326824['interaction']=_0x4cf7f3['get']({'plain':!![]});_0x326824[_0x402a('0xac')]['created']=![];if(_0x27c8b5){if(_0x326824['account'][_0x402a('0xad')]){_0x326824[_0x402a('0xae')][_0x402a('0xaf')]({'id':0x0,'priority':_0x326824['applications'][_0x402a('0x4a')]+0x1,'app':'close','appdata':_0x402a('0xb0'),'interval':'*,*,*,*'});}_0x326824[_0x402a('0xac')][_0x402a('0xb1')]=!![];}return db[_0x402a('0xb2')][_0x402a('0x5c')]({'phone':_0x326824[_0x402a('0x5d')][_0x402a('0x9e')],'messageId':_0x326824[_0x402a('0x5d')][_0x402a('0x9f')],'body':_0x326824['body'][_0x402a('0x5d')],'WhatsappAccountId':_0x4af33d['params']['id'],'WhatsappInteractionId':_0x4cf7f3['id'],'direction':'in','ContactId':_0x4cf7f3[_0x402a('0xb3')],'AttachmentId':_0x326824['body'][_0x402a('0xb4')]});})['then'](function(_0x549ae0){_0x326824[_0x402a('0x24')]=_0x549ae0;if(!_0x326824[_0x402a('0xac')]['UserId'])return;return db['User'][_0x402a('0x62')]({'attributes':['id','name'],'where':{'id':_0x326824[_0x402a('0xac')]['UserId']}});})[_0x402a('0x33')](function(_0x15872b){if(_0x15872b){_0x326824[_0x402a('0xae')][_0x402a('0xb5')]({'id':0x0,'priority':0x0,'app':_0x402a('0xb6'),'appdata':_0x15872b[_0x402a('0x39')]+','+(_0x326824[_0x402a('0x87')][_0x402a('0xb7')]||0xa),'interval':'*,*,*,*'});}if(!_0x326824['interaction']['queueId'])return;return db['WhatsappQueue']['find']({'attributes':['id',_0x402a('0x39')],'where':{'id':_0x326824['interaction'][_0x402a('0xb8')]}});})[_0x402a('0x33')](function(_0x53a003){if(_0x53a003){_0x326824[_0x402a('0xae')][_0x402a('0xb5')]({'id':0x0,'priority':0x1,'app':_0x402a('0xb9'),'appdata':_0x53a003['name']+','+(_0x326824[_0x402a('0x87')][_0x402a('0xba')]||0x12c),'interval':_0x402a('0xbb')});}return respondWithRpcPromise(_0x402a('0xbc'),_0x402a('0xbd'),_0x326824);})[_0x402a('0x33')](function(_0x56b2f3){if(_0x56b2f3){var _0x2a675e=0xc8;var _0x46ec97=_0x402a('0xbe');logger[_0x402a('0x25')](_0x402a('0x22'),_0x46ec97,_0x2a675e,_0x402a('0xbf'));logger[_0x402a('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x46ec97,_0x2a675e,_0x402a('0xbf'),JSON[_0x402a('0xc0')](_0x56b2f3));if(_0x326824[_0x402a('0x87')]['type']===_0x402a('0x98')){return _0x4311d5[_0x402a('0x2d')](_0x2a675e)['set']('Content-Type',_0x402a('0xc1'))[_0x402a('0x3a')]('\x0a');}else{return _0x4311d5['status'](_0x2a675e)[_0x402a('0x28')](_0x56b2f3);}}});})[_0x402a('0x59')](handleError(_0x4311d5,null));};exports['send']=function(_0x2c623f,_0x3b5ead,_0x175dc8){var _0x3c00e5,_0x1385f7,_0x48c12b;if(_[_0x402a('0xa0')](_0x2c623f[_0x402a('0x5d')][_0x402a('0x5d')])||_0x2c623f[_0x402a('0x5d')][_0x402a('0x5d')]===''){throw new db[(_0x402a('0x91'))][(_0x402a('0xa2'))](_0x402a('0xa3'));}if(_[_0x402a('0xa0')](_0x2c623f[_0x402a('0x5d')]['to'])){throw new db[(_0x402a('0x91'))][(_0x402a('0xa2'))](_0x402a('0xc2'));}_0x3c00e5=_0x2c623f['body']['to'];return db[_0x402a('0x3f')][_0x402a('0x62')]({'where':{'id':_0x2c623f['params']['id']},'include':[{'model':db[_0x402a('0xa7')],'as':_0x402a('0xc3'),'include':[{'model':db['CmContact'],'as':_0x402a('0xa8'),'where':{'mobile':_0x3c00e5},'limit':0x1,'order':[['updatedAt',_0x402a('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x3b5ead,null))[_0x402a('0x33')](function(_0x2a1088){if(_0x2a1088&&_0x2a1088[_0x402a('0xc3')]){_0x1385f7=_0x2a1088[_0x402a('0x35')]({'plain':!![]});if(_0x1385f7[_0x402a('0xc3')]&&_0x1385f7[_0x402a('0xc3')][_0x402a('0xa8')][_0x402a('0x4a')]){return _0x1385f7[_0x402a('0xc3')][_0x402a('0xa8')][0x0];}return db[_0x402a('0x90')][_0x402a('0x5c')](_['defaults'](_0x2c623f[_0x402a('0x5d')],{'firstName':_0x3c00e5,'mobile':_0x3c00e5,'phone':_0x3c00e5,'ListId':_0x1385f7[_0x402a('0x97')]}));}})[_0x402a('0x33')](handleEntityNotFound(_0x3b5ead,null))[_0x402a('0x33')](function(_0x4a9622){if(_0x4a9622){_0x48c12b=_0x4a9622;return db[_0x402a('0xab')][_0x402a('0x62')]({'where':{'ContactId':_0x48c12b['id'],'closed':![],'WhatsappAccountId':_0x1385f7['id']}})[_0x402a('0x33')](function(_0x4b614d){if(_0x4b614d){return[_0x4b614d,![]];}return db[_0x402a('0xab')][_0x402a('0x5c')]({'UserId':_0x2c623f['user']['id'],'ContactId':_0x48c12b['id'],'WhatsappAccountId':_0x1385f7['id'],'phone':_0x3c00e5,'firstMsgDirection':_0x402a('0xc4'),'Messages':[_[_0x402a('0x51')](_0x2c623f[_0x402a('0x5d')],{'read':![],'body':_0x2c623f[_0x402a('0x5d')][_0x402a('0x5d')],'phone':_0x3c00e5,'WhatsappAccountId':_0x1385f7['id'],'UserId':_0x2c623f[_0x402a('0x5e')]['id'],'ContactId':_0x48c12b['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x432ab5){return[_0x432ab5,!![]];});});}})['spread'](function(_0x152550,_0x19f492){if(_0x19f492){return _0x152550;}return db['WhatsappMessage']['create'](_['merge'](_0x2c623f['body'],{'read':![],'body':_0x2c623f[_0x402a('0x5d')]['body'],'phone':_0x3c00e5,'WhatsappAccountId':_0x1385f7['id'],'WhatsappInteractionId':_0x152550['id'],'UserId':_0x2c623f[_0x402a('0x5e')]['id'],'ContactId':_0x48c12b['id']}))[_0x402a('0x33')](function(_0x425ad1){_0x152550['dataValues']['Messages']=[];_0x152550[_0x402a('0xc5')][_0x402a('0xc6')][_0x402a('0xaf')](_0x425ad1['dataValues']);return _0x152550;});})['then'](respondWithResult(_0x3b5ead,null))[_0x402a('0x59')](handleError(_0x3b5ead,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 4cedfbe..2ed70ba 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 _0x2d74=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x498f45,_0x33a0d7){var _0x5dedf1=function(_0x224849){while(--_0x224849){_0x498f45['push'](_0x498f45['shift']());}};_0x5dedf1(++_0x33a0d7);}(_0x2d74,0xd9));var _0x42d7=function(_0x507303,_0x5bba97){_0x507303=_0x507303-0x0;var _0x57c49b=_0x2d74[_0x507303];return _0x57c49b;};'use strict';var EventEmitter=require(_0x42d7('0x0'));var WhatsappAccount=require(_0x42d7('0x1'))['db'][_0x42d7('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x42d7('0x3')](0x0);var events={'afterCreate':_0x42d7('0x4'),'afterUpdate':_0x42d7('0x5'),'afterDestroy':_0x42d7('0x6')};function emitEvent(_0xf39c04){return function(_0x5a1dfd,_0x45942a,_0xe562de){WhatsappAccountEvents[_0x42d7('0x7')](_0xf39c04+':'+_0x5a1dfd['id'],_0x5a1dfd);WhatsappAccountEvents[_0x42d7('0x7')](_0xf39c04,_0x5a1dfd);_0xe562de(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x42d7('0x8')](e,emitEvent(event));}}module[_0x42d7('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xb51e=['update','remove','emit','hook','exports','WhatsappAccount','setMaxListeners','save'];(function(_0x69b218,_0x29e70c){var _0xc986ef=function(_0x644821){while(--_0x644821){_0x69b218['push'](_0x69b218['shift']());}};_0xc986ef(++_0x29e70c);}(_0xb51e,0x1d5));var _0xeb51=function(_0x411514,_0x4e9c5f){_0x411514=_0x411514-0x0;var _0x58db58=_0xb51e[_0x411514];return _0x58db58;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0xeb51('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xeb51('0x1')](0x0);var events={'afterCreate':_0xeb51('0x2'),'afterUpdate':_0xeb51('0x3'),'afterDestroy':_0xeb51('0x4')};function emitEvent(_0x300038){return function(_0x485c14,_0x20b874,_0x38fde8){WhatsappAccountEvents[_0xeb51('0x5')](_0x300038+':'+_0x485c14['id'],_0x485c14);WhatsappAccountEvents['emit'](_0x300038,_0x485c14);_0x38fde8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xeb51('0x6')](e,emitEvent(event));}}module[_0xeb51('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 9d55d34..e729a2f 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 _0x3b0d=['../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xd4adad,_0x1f3b36){var _0x2d8f88=function(_0x20d0de){while(--_0x20d0de){_0xd4adad['push'](_0xd4adad['shift']());}};_0x2d8f88(++_0x1f3b36);}(_0x3b0d,0x1d9));var _0xd3b0=function(_0x3ef031,_0x3d8cbf){_0x3ef031=_0x3ef031-0x0;var _0x49e70d=_0x3b0d[_0x3ef031];return _0x49e70d;};'use strict';var _=require(_0xd3b0('0x0'));var util=require(_0xd3b0('0x1'));var logger=require(_0xd3b0('0x2'))('api');var moment=require(_0xd3b0('0x3'));var BPromise=require(_0xd3b0('0x4'));var rp=require(_0xd3b0('0x5'));var fs=require('fs');var path=require(_0xd3b0('0x6'));var rimraf=require('rimraf');var config=require(_0xd3b0('0x7'));var attributes=require(_0xd3b0('0x8'));module['exports']=function(_0x5a6d64,_0x3531d1){return _0x5a6d64[_0xd3b0('0x9')](_0xd3b0('0xa'),attributes,{'tableName':_0xd3b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x817e=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x19744e,_0x4d9e08){var _0x5608ec=function(_0x5e159d){while(--_0x5e159d){_0x19744e['push'](_0x19744e['shift']());}};_0x5608ec(++_0x4d9e08);}(_0x817e,0x14e));var _0xe817=function(_0x1471f4,_0x426e10){_0x1471f4=_0x1471f4-0x0;var _0x128c00=_0x817e[_0x1471f4];return _0x128c00;};'use strict';var _=require(_0xe817('0x0'));var util=require(_0xe817('0x1'));var logger=require(_0xe817('0x2'))('api');var moment=require(_0xe817('0x3'));var BPromise=require(_0xe817('0x4'));var rp=require(_0xe817('0x5'));var fs=require('fs');var path=require(_0xe817('0x6'));var rimraf=require(_0xe817('0x7'));var config=require(_0xe817('0x8'));var attributes=require(_0xe817('0x9'));module[_0xe817('0xa')]=function(_0x3348d5,_0x5e89a5){return _0x3348d5[_0xe817('0xb')](_0xe817('0xc'),attributes,{'tableName':_0xe817('0xd'),'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 03236d6..22c190c 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 _0x96ff=['error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','map','include','attributes','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c706c,_0x57ebb7){var _0x1d8dc7=function(_0x50a0f3){while(--_0x50a0f3){_0x4c706c['push'](_0x4c706c['shift']());}};_0x1d8dc7(++_0x57ebb7);}(_0x96ff,0xd8));var _0xf96f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x96ff[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf96f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf96f('0x1'));var db=require(_0xf96f('0x2'))['db'];var utils=require(_0xf96f('0x3'));var logger=require(_0xf96f('0x4'))(_0xf96f('0x5'));var config=require(_0xf96f('0x6'));var jayson=require(_0xf96f('0x7'));var client=jayson[_0xf96f('0x8')][_0xf96f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf96f('0xa')],{'host':_0xf96f('0xb'),'port':0x18eb});var socket=require(_0xf96f('0xc'))(new Redis(config['redis']));require(_0xf96f('0xd'))[_0xf96f('0xe')](socket);function respondWithRpcPromise(_0x22dc88,_0x40de4c,_0xed4cda){return new BPromise(function(_0x2d40a7,_0x1314ba){return client['request'](_0x22dc88,_0xed4cda)[_0xf96f('0xf')](function(_0x5c34da){logger[_0xf96f('0x10')](_0xf96f('0x11'),_0x40de4c,_0xf96f('0x12'));logger[_0xf96f('0x13')](_0xf96f('0x14'),_0x40de4c,'request\x20sent',JSON[_0xf96f('0x15')](_0x5c34da));if(_0x5c34da[_0xf96f('0x16')]){if(_0x5c34da[_0xf96f('0x16')]['code']===0x1f4){logger['error'](_0xf96f('0x11'),_0x40de4c,_0x5c34da['error'][_0xf96f('0x17')]);return _0x1314ba(_0x5c34da[_0xf96f('0x16')][_0xf96f('0x17')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x40de4c,_0x5c34da[_0xf96f('0x16')][_0xf96f('0x17')]);return _0x2d40a7(_0x5c34da['error']['message']);}else{logger[_0xf96f('0x10')](_0xf96f('0x11'),_0x40de4c,_0xf96f('0x12'));_0x2d40a7(_0x5c34da[_0xf96f('0x18')][_0xf96f('0x17')]);}})[_0xf96f('0x19')](function(_0x33a4b8){logger['error'](_0xf96f('0x11'),_0x40de4c,_0x33a4b8);_0x1314ba(_0x33a4b8);});});}exports[_0xf96f('0x1a')]=function(_0x3ec023){var _0x57b902=this;return new Promise(function(_0x1f54d8,_0x419402){return db[_0xf96f('0x1b')][_0xf96f('0x1c')]({'raw':_0x3ec023['options']?_0x3ec023[_0xf96f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3ec023[_0xf96f('0x1d')]?_0x3ec023[_0xf96f('0x1d')][_0xf96f('0x1e')]||null:null,'attributes':_0x3ec023[_0xf96f('0x1d')]?_0x3ec023[_0xf96f('0x1d')]['attributes']||null:null,'include':_0x3ec023[_0xf96f('0x1d')]?_0x3ec023[_0xf96f('0x1d')]['include']?_[_0xf96f('0x1f')](_0x3ec023[_0xf96f('0x1d')][_0xf96f('0x20')],function(_0x1d1238){return{'model':db[_0x1d1238['model']],'as':_0x1d1238['as'],'attributes':_0x1d1238[_0xf96f('0x21')],'include':_0x1d1238[_0xf96f('0x20')]?_[_0xf96f('0x1f')](_0x1d1238['include'],function(_0x3c1be4){return{'model':db[_0x3c1be4['model']],'as':_0x3c1be4['as'],'attributes':_0x3c1be4[_0xf96f('0x21')],'include':_0x3c1be4['include']?_['map'](_0x3c1be4[_0xf96f('0x20')],function(_0x66edc0){return{'model':db[_0x66edc0['model']],'as':_0x66edc0['as'],'attributes':_0x66edc0[_0xf96f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf96f('0xf')](function(_0x515405){logger[_0xf96f('0x10')](_0xf96f('0x1a'),_0x3ec023);logger['debug'](_0xf96f('0x1a'),_0x3ec023,JSON[_0xf96f('0x15')](_0x515405));_0x1f54d8(_0x515405);})[_0xf96f('0x19')](function(_0x42c516){logger['error']('ShowWhatsappAccount',_0x42c516[_0xf96f('0x17')],_0x3ec023);_0x419402(_0x57b902[_0xf96f('0x16')](0x1f4,_0x42c516[_0xf96f('0x17')]));});});}; \ No newline at end of file +var _0x37e9=['options','raw','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','request\x20sent','debug','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount'];(function(_0x29e397,_0x4c8f1b){var _0x3c7af6=function(_0x2013a7){while(--_0x2013a7){_0x29e397['push'](_0x29e397['shift']());}};_0x3c7af6(++_0x4c8f1b);}(_0x37e9,0x1e7));var _0x937e=function(_0x229bc4,_0x4dca0a){_0x229bc4=_0x229bc4-0x0;var _0x29b4a2=_0x37e9[_0x229bc4];return _0x29b4a2;};'use strict';var _=require(_0x937e('0x0'));var util=require(_0x937e('0x1'));var moment=require(_0x937e('0x2'));var BPromise=require(_0x937e('0x3'));var rs=require(_0x937e('0x4'));var fs=require('fs');var Redis=require(_0x937e('0x5'));var db=require(_0x937e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x937e('0x7'))(_0x937e('0x8'));var config=require(_0x937e('0x9'));var jayson=require(_0x937e('0xa'));var client=jayson[_0x937e('0xb')][_0x937e('0xc')]({'port':0x232a});config['redis']=_[_0x937e('0xd')](config[_0x937e('0xe')],{'host':_0x937e('0xf'),'port':0x18eb});var socket=require(_0x937e('0x10'))(new Redis(config[_0x937e('0xe')]));require(_0x937e('0x11'))['register'](socket);function respondWithRpcPromise(_0x4b9059,_0x359f09,_0x1c3a8c){return new BPromise(function(_0x32f562,_0x2f71ed){return client[_0x937e('0x12')](_0x4b9059,_0x1c3a8c)[_0x937e('0x13')](function(_0x490e42){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x359f09,_0x937e('0x14'));logger[_0x937e('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x359f09,_0x937e('0x14'),JSON[_0x937e('0x16')](_0x490e42));if(_0x490e42[_0x937e('0x17')]){if(_0x490e42[_0x937e('0x17')]['code']===0x1f4){logger[_0x937e('0x17')](_0x937e('0x18'),_0x359f09,_0x490e42[_0x937e('0x17')][_0x937e('0x19')]);return _0x2f71ed(_0x490e42['error'][_0x937e('0x19')]);}logger[_0x937e('0x17')](_0x937e('0x18'),_0x359f09,_0x490e42[_0x937e('0x17')][_0x937e('0x19')]);return _0x32f562(_0x490e42[_0x937e('0x17')][_0x937e('0x19')]);}else{logger[_0x937e('0x1a')]('WhatsappAccount,\x20%s,\x20%s',_0x359f09,'request\x20sent');_0x32f562(_0x490e42[_0x937e('0x1b')][_0x937e('0x19')]);}})[_0x937e('0x1c')](function(_0x2c0420){logger[_0x937e('0x17')](_0x937e('0x18'),_0x359f09,_0x2c0420);_0x2f71ed(_0x2c0420);});});}exports[_0x937e('0x1d')]=function(_0x244109){var _0x456533=this;return new Promise(function(_0x5a8903,_0x25c1e3){return db[_0x937e('0x1e')]['find']({'raw':_0x244109['options']?_0x244109[_0x937e('0x1f')][_0x937e('0x20')]===undefined?!![]:![]:!![],'where':_0x244109['options']?_0x244109[_0x937e('0x1f')]['where']||null:null,'attributes':_0x244109[_0x937e('0x1f')]?_0x244109[_0x937e('0x1f')][_0x937e('0x21')]||null:null,'include':_0x244109[_0x937e('0x1f')]?_0x244109[_0x937e('0x1f')]['include']?_[_0x937e('0x22')](_0x244109[_0x937e('0x1f')][_0x937e('0x23')],function(_0xecae9){return{'model':db[_0xecae9[_0x937e('0x24')]],'as':_0xecae9['as'],'attributes':_0xecae9[_0x937e('0x21')],'include':_0xecae9['include']?_[_0x937e('0x22')](_0xecae9[_0x937e('0x23')],function(_0x2ee185){return{'model':db[_0x2ee185[_0x937e('0x24')]],'as':_0x2ee185['as'],'attributes':_0x2ee185['attributes'],'include':_0x2ee185[_0x937e('0x23')]?_[_0x937e('0x22')](_0x2ee185[_0x937e('0x23')],function(_0x3db336){return{'model':db[_0x3db336[_0x937e('0x24')]],'as':_0x3db336['as'],'attributes':_0x3db336['attributes']};}):[]};}):[]};}):[]:[]})[_0x937e('0x13')](function(_0x380999){logger['info'](_0x937e('0x1d'),_0x244109);logger[_0x937e('0x15')](_0x937e('0x1d'),_0x244109,JSON['stringify'](_0x380999));_0x5a8903(_0x380999);})[_0x937e('0x1c')](function(_0x3f8ac7){logger[_0x937e('0x17')](_0x937e('0x1d'),_0x3f8ac7[_0x937e('0x19')],_0x244109);_0x25c1e3(_0x456533[_0x937e('0x17')](0x1f4,_0x3f8ac7[_0x937e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3318210..0917fa4 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 _0x28bf=['length','whatsappAccount:','./whatsappAccount.events','remove','update','removeListener'];(function(_0x4003c5,_0x54bfbf){var _0x2f5972=function(_0x2dfcf4){while(--_0x2dfcf4){_0x4003c5['push'](_0x4003c5['shift']());}};_0x2f5972(++_0x54bfbf);}(_0x28bf,0x1ac));var _0xf28b=function(_0x76d02c,_0x202df1){_0x76d02c=_0x76d02c-0x0;var _0x25cc97=_0x28bf[_0x76d02c];return _0x25cc97;};'use strict';var WhatsappAccountEvents=require(_0xf28b('0x0'));var events=['save',_0xf28b('0x1'),_0xf28b('0x2')];function createListener(_0xd65f8e,_0x1ebbd3){return function(_0x243c79){_0x1ebbd3['emit'](_0xd65f8e,_0x243c79);};}function removeListener(_0x2b278a,_0x5c68cc){return function(){WhatsappAccountEvents[_0xf28b('0x3')](_0x2b278a,_0x5c68cc);};}exports['register']=function(_0x4f3dbb){for(var _0x5ab75f=0x0,_0x5177ce=events[_0xf28b('0x4')];_0x5ab75f<_0x5177ce;_0x5ab75f++){var _0x1276a7=events[_0x5ab75f];var _0x178edc=createListener(_0xf28b('0x5')+_0x1276a7,_0x4f3dbb);WhatsappAccountEvents['on'](_0x1276a7,_0x178edc);}}; \ No newline at end of file +var _0xc361=['register','length','./whatsappAccount.events','save','remove','update','removeListener'];(function(_0x4ca375,_0x18c0fa){var _0x2ae445=function(_0x43b775){while(--_0x43b775){_0x4ca375['push'](_0x4ca375['shift']());}};_0x2ae445(++_0x18c0fa);}(_0xc361,0x113));var _0x1c36=function(_0x3fb875,_0x5b6071){_0x3fb875=_0x3fb875-0x0;var _0x58d97e=_0xc361[_0x3fb875];return _0x58d97e;};'use strict';var WhatsappAccountEvents=require(_0x1c36('0x0'));var events=[_0x1c36('0x1'),_0x1c36('0x2'),_0x1c36('0x3')];function createListener(_0x176c32,_0x238c10){return function(_0x4aff62){_0x238c10['emit'](_0x176c32,_0x4aff62);};}function removeListener(_0x6bfa27,_0x5b508f){return function(){WhatsappAccountEvents[_0x1c36('0x4')](_0x6bfa27,_0x5b508f);};}exports[_0x1c36('0x5')]=function(_0x3e6f0f){for(var _0x81779a=0x0,_0x55e364=events[_0x1c36('0x6')];_0x81779a<_0x55e364;_0x81779a++){var _0xdb4402=events[_0x81779a];var _0x186757=createListener('whatsappAccount:'+_0xdb4402,_0x3e6f0f);WhatsappAccountEvents['on'](_0xdb4402,_0x186757);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e2d0f6b..58cfe39 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 _0x4fd5=['show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','/:id','isAuthenticated'];(function(_0x1cd585,_0x54276b){var _0x3ca87f=function(_0x224de8){while(--_0x224de8){_0x1cd585['push'](_0x1cd585['shift']());}};_0x3ca87f(++_0x54276b);}(_0x4fd5,0x102));var _0x54fd=function(_0x305d8d,_0x2c2d2d){_0x305d8d=_0x305d8d-0x0;var _0x439619=_0x4fd5[_0x305d8d];return _0x439619;};'use strict';var multer=require(_0x54fd('0x0'));var util=require(_0x54fd('0x1'));var path=require(_0x54fd('0x2'));var timeout=require(_0x54fd('0x3'));var express=require(_0x54fd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x54fd('0x5'));var interaction=require(_0x54fd('0x6'));var config=require(_0x54fd('0x7'));var controller=require(_0x54fd('0x8'));router[_0x54fd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x54fd('0x9')](_0x54fd('0xa'),auth[_0x54fd('0xb')](),controller[_0x54fd('0xc')]);router[_0x54fd('0xd')]('/',auth[_0x54fd('0xb')](),controller[_0x54fd('0xe')]);router['put'](_0x54fd('0xa'),auth[_0x54fd('0xb')](),controller[_0x54fd('0xf')]);router['delete'](_0x54fd('0xa'),auth[_0x54fd('0xb')](),controller[_0x54fd('0x10')]);module[_0x54fd('0x11')]=router; \ No newline at end of file +var _0x120d=['isAuthenticated','index','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x1d1d09,_0x504d77){var _0x8827e=function(_0x4f3128){while(--_0x4f3128){_0x1d1d09['push'](_0x1d1d09['shift']());}};_0x8827e(++_0x504d77);}(_0x120d,0x1e8));var _0xd120=function(_0x2cbd58,_0x278e75){_0x2cbd58=_0x2cbd58-0x0;var _0x42ef2a=_0x120d[_0x2cbd58];return _0x42ef2a;};'use strict';var multer=require(_0xd120('0x0'));var util=require(_0xd120('0x1'));var path=require(_0xd120('0x2'));var timeout=require(_0xd120('0x3'));var express=require(_0xd120('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd120('0x5'));var config=require(_0xd120('0x6'));var controller=require('./whatsappApplication.controller');router[_0xd120('0x7')]('/',auth[_0xd120('0x8')](),controller[_0xd120('0x9')]);router[_0xd120('0x7')](_0xd120('0xa'),auth[_0xd120('0x8')](),controller[_0xd120('0xb')]);router['post']('/',auth[_0xd120('0x8')](),controller[_0xd120('0xc')]);router['put'](_0xd120('0xa'),auth[_0xd120('0x8')](),controller['update']);router[_0xd120('0xd')](_0xd120('0xa'),auth['isAuthenticated'](),controller[_0xd120('0xe')]);module[_0xd120('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index d86f131..64b4ec1 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 _0x268e=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x268e,0xf2));var _0xe268=function(_0x4ca026,_0x3ea042){_0x4ca026=_0x4ca026-0x0;var _0x5f4bff=_0x268e[_0x4ca026];return _0x5f4bff;};'use strict';var Sequelize=require(_0xe268('0x0'));module[_0xe268('0x1')]={'priority':{'type':Sequelize[_0xe268('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe268('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe268('0x3')]},'interval':{'type':Sequelize[_0xe268('0x3')],'defaultValue':_0xe268('0x4')}}; \ No newline at end of file +var _0x6318=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1ebd5d,_0x416fc7){var _0x3035e6=function(_0x430098){while(--_0x430098){_0x1ebd5d['push'](_0x1ebd5d['shift']());}};_0x3035e6(++_0x416fc7);}(_0x6318,0x106));var _0x8631=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6318[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x8631('0x0'));module[_0x8631('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8631('0x2')],'allowNull':![],'defaultValue':_0x8631('0x3')},'appdata':{'type':Sequelize[_0x8631('0x4')]()},'description':{'type':Sequelize[_0x8631('0x2')]},'interval':{'type':Sequelize[_0x8631('0x2')],'defaultValue':_0x8631('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 4593ed4..d6fc550 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 _0xc1d3=['rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll'];(function(_0x3320f4,_0x5c1e63){var _0x2fd1eb=function(_0x5e7b99){while(--_0x5e7b99){_0x3320f4['push'](_0x3320f4['shift']());}};_0x2fd1eb(++_0x5c1e63);}(_0xc1d3,0x147));var _0x3c1d=function(_0x223df0,_0x3d48dd){_0x223df0=_0x223df0-0x0;var _0x1d733a=_0xc1d3[_0x223df0];return _0x1d733a;};'use strict';var emlformat=require(_0x3c1d('0x0'));var rimraf=require(_0x3c1d('0x1'));var zipdir=require(_0x3c1d('0x2'));var jsonpatch=require(_0x3c1d('0x3'));var rp=require(_0x3c1d('0x4'));var moment=require(_0x3c1d('0x5'));var BPromise=require(_0x3c1d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3c1d('0x7'));var sox=require(_0x3c1d('0x8'));var csv=require(_0x3c1d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c1d('0xa'));var _=require(_0x3c1d('0xb'));var squel=require(_0x3c1d('0xc'));var crypto=require(_0x3c1d('0xd'));var jsforce=require(_0x3c1d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3c1d('0x9'));var querystring=require(_0x3c1d('0xf'));var Papa=require(_0x3c1d('0x10'));var Redis=require(_0x3c1d('0x11'));var authService=require(_0x3c1d('0x12'));var qs=require(_0x3c1d('0x13'));var as=require(_0x3c1d('0x14'));var hardwareService=require(_0x3c1d('0x15'));var logger=require('../../config/logger')(_0x3c1d('0x16'));var utils=require(_0x3c1d('0x17'));var config=require(_0x3c1d('0x18'));var licenseUtil=require(_0x3c1d('0x19'));var db=require(_0x3c1d('0x1a'))['db'];function respondWithStatusCode(_0x5a2402,_0xf3cd6d){_0xf3cd6d=_0xf3cd6d||0xcc;return function(_0x209b55){if(_0x209b55){return _0x5a2402['sendStatus'](_0xf3cd6d);}return _0x5a2402[_0x3c1d('0x1b')](_0xf3cd6d)['end']();};}function respondWithResult(_0x4ed530,_0x4b941d){_0x4b941d=_0x4b941d||0xc8;return function(_0x2875a9){if(_0x2875a9){return _0x4ed530[_0x3c1d('0x1b')](_0x4b941d)[_0x3c1d('0x1c')](_0x2875a9);}};}function respondWithFilteredResult(_0x434dbc,_0x2ed7af){return function(_0x2c0b83){if(_0x2c0b83){var _0x4e6157=typeof _0x2ed7af['offset']===_0x3c1d('0x1d')&&typeof _0x2ed7af['limit']===_0x3c1d('0x1d');var _0x295467=_0x2c0b83['count'];var _0x4a7e42=_0x4e6157?0x0:_0x2ed7af['offset'];var _0x33637d=_0x4e6157?_0x2c0b83[_0x3c1d('0x1e')]:_0x2ed7af[_0x3c1d('0x1f')]+_0x2ed7af[_0x3c1d('0x20')];var _0x9dce85;if(_0x33637d>=_0x295467){_0x33637d=_0x295467;_0x9dce85=0xc8;}else{_0x9dce85=0xce;}_0x434dbc['status'](_0x9dce85);return _0x434dbc['set'](_0x3c1d('0x21'),_0x4a7e42+'-'+_0x33637d+'/'+_0x295467)[_0x3c1d('0x1c')](_0x2c0b83);}return null;};}function patchUpdates(_0x3c7455){return function(_0x233dff){try{jsonpatch[_0x3c1d('0x22')](_0x233dff,_0x3c7455,!![]);}catch(_0x5b2720){return BPromise[_0x3c1d('0x23')](_0x5b2720);}return _0x233dff[_0x3c1d('0x24')]();};}function saveUpdates(_0xa5fd81,_0x5211d7){return function(_0x129497){if(_0x129497){return _0x129497[_0x3c1d('0x25')](_0xa5fd81)[_0x3c1d('0x26')](function(_0x210e9c){return _0x210e9c;});}return null;};}function removeEntity(_0x2e1af4,_0x1a853d){return function(_0x41a683){if(_0x41a683){return _0x41a683[_0x3c1d('0x27')]()[_0x3c1d('0x26')](function(){_0x2e1af4['status'](0xcc)[_0x3c1d('0x28')]();});}};}function handleEntityNotFound(_0x2a8854,_0x2078d5){return function(_0x4f7cd8){if(!_0x4f7cd8){_0x2a8854[_0x3c1d('0x29')](0x194);}return _0x4f7cd8;};}function handleError(_0x3bde45,_0x4e1f79){_0x4e1f79=_0x4e1f79||0x1f4;return function(_0x392bb1){logger[_0x3c1d('0x2a')](_0x392bb1[_0x3c1d('0x2b')]);if(_0x392bb1['name']){delete _0x392bb1[_0x3c1d('0x2c')];}_0x3bde45['status'](_0x4e1f79)[_0x3c1d('0x2d')](_0x392bb1);};}exports[_0x3c1d('0x2e')]=function(_0x59db0a,_0x4ff12a){var _0x356f61={},_0x2f7af9={},_0x93a3b1={'count':0x0,'rows':[]};var _0x52ab2b=_[_0x3c1d('0x2f')](db['WhatsappApplication'][_0x3c1d('0x30')],function(_0x438b09){return{'name':_0x438b09[_0x3c1d('0x31')],'type':_0x438b09['type'][_0x3c1d('0x32')]};});_0x2f7af9[_0x3c1d('0x33')]=_[_0x3c1d('0x2f')](_0x52ab2b,_0x3c1d('0x2c'));_0x2f7af9[_0x3c1d('0x34')]=_[_0x3c1d('0x35')](_0x59db0a[_0x3c1d('0x34')]);_0x2f7af9[_0x3c1d('0x36')]=_[_0x3c1d('0x37')](_0x2f7af9['model'],_0x2f7af9['query']);_0x356f61[_0x3c1d('0x38')]=_['intersection'](_0x2f7af9[_0x3c1d('0x33')],qs[_0x3c1d('0x39')](_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x39')]));_0x356f61[_0x3c1d('0x38')]=_0x356f61['attributes'][_0x3c1d('0x3a')]?_0x356f61[_0x3c1d('0x38')]:_0x2f7af9['model'];if(!_0x59db0a['query'][_0x3c1d('0x3b')](_0x3c1d('0x3c'))){_0x356f61[_0x3c1d('0x20')]=qs[_0x3c1d('0x20')](_0x59db0a[_0x3c1d('0x34')]['limit']);_0x356f61[_0x3c1d('0x1f')]=qs[_0x3c1d('0x1f')](_0x59db0a['query']['offset']);}_0x356f61['order']=qs[_0x3c1d('0x3d')](_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x3d')]);_0x356f61[_0x3c1d('0x3e')]=qs['filters'](_[_0x3c1d('0x3f')](_0x59db0a['query'],_0x2f7af9[_0x3c1d('0x36')]),_0x52ab2b);if(_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x40')]){_0x356f61[_0x3c1d('0x3e')]=_[_0x3c1d('0x41')](_0x356f61['where'],{'$or':_[_0x3c1d('0x2f')](_0x52ab2b,function(_0x28c575){if(_0x28c575[_0x3c1d('0x42')]!==_0x3c1d('0x43')){var _0x59c8fb={};_0x59c8fb[_0x28c575[_0x3c1d('0x2c')]]={'$like':'%'+_0x59db0a['query']['filter']+'%'};return _0x59c8fb;}})});}_0x356f61=_[_0x3c1d('0x41')]({},_0x356f61,_0x59db0a[_0x3c1d('0x44')]);var _0x58c490={'where':_0x356f61['where']};return db[_0x3c1d('0x45')][_0x3c1d('0x1e')](_0x58c490)['then'](function(_0x4f07d6){_0x93a3b1[_0x3c1d('0x1e')]=_0x4f07d6;if(_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x46')]){_0x356f61[_0x3c1d('0x47')]=[{'all':!![]}];}return db[_0x3c1d('0x45')][_0x3c1d('0x48')](_0x356f61);})[_0x3c1d('0x26')](function(_0x11bca2){_0x93a3b1[_0x3c1d('0x49')]=_0x11bca2;return _0x93a3b1;})[_0x3c1d('0x26')](respondWithFilteredResult(_0x4ff12a,_0x356f61))[_0x3c1d('0x4a')](handleError(_0x4ff12a,null));};exports[_0x3c1d('0x4b')]=function(_0x4b0f40,_0x21dbef){var _0x5ca02c={'raw':!![],'where':{'id':_0x4b0f40['params']['id']}},_0x415a61={};_0x415a61[_0x3c1d('0x33')]=_['keys'](db[_0x3c1d('0x45')][_0x3c1d('0x30')]);_0x415a61[_0x3c1d('0x34')]=_[_0x3c1d('0x35')](_0x4b0f40['query']);_0x415a61[_0x3c1d('0x36')]=_['intersection'](_0x415a61[_0x3c1d('0x33')],_0x415a61[_0x3c1d('0x34')]);_0x5ca02c[_0x3c1d('0x38')]=_[_0x3c1d('0x37')](_0x415a61['model'],qs[_0x3c1d('0x39')](_0x4b0f40[_0x3c1d('0x34')][_0x3c1d('0x39')]));_0x5ca02c[_0x3c1d('0x38')]=_0x5ca02c[_0x3c1d('0x38')]['length']?_0x5ca02c[_0x3c1d('0x38')]:_0x415a61[_0x3c1d('0x33')];if(_0x4b0f40[_0x3c1d('0x34')]['includeAll']){_0x5ca02c['include']=[{'all':!![]}];}_0x5ca02c=_[_0x3c1d('0x41')]({},_0x5ca02c,_0x4b0f40[_0x3c1d('0x44')]);return db[_0x3c1d('0x45')][_0x3c1d('0x4c')](_0x5ca02c)[_0x3c1d('0x26')](handleEntityNotFound(_0x21dbef,null))[_0x3c1d('0x26')](respondWithResult(_0x21dbef,null))['catch'](handleError(_0x21dbef,null));};exports[_0x3c1d('0x4d')]=function(_0x4c533e,_0x34ad3a){return db[_0x3c1d('0x45')][_0x3c1d('0x4d')](_0x4c533e[_0x3c1d('0x4e')],{})[_0x3c1d('0x26')](respondWithResult(_0x34ad3a,0xc9))[_0x3c1d('0x4a')](handleError(_0x34ad3a,null));};exports[_0x3c1d('0x25')]=function(_0x4f0b44,_0x576552){if(_0x4f0b44['body']['id']){delete _0x4f0b44[_0x3c1d('0x4e')]['id'];}return db[_0x3c1d('0x45')][_0x3c1d('0x4c')]({'where':{'id':_0x4f0b44[_0x3c1d('0x4f')]['id']}})[_0x3c1d('0x26')](handleEntityNotFound(_0x576552,null))[_0x3c1d('0x26')](saveUpdates(_0x4f0b44['body'],null))[_0x3c1d('0x26')](respondWithResult(_0x576552,null))[_0x3c1d('0x4a')](handleError(_0x576552,null));};exports['destroy']=function(_0x4bc4ac,_0x4302f3){return db[_0x3c1d('0x45')][_0x3c1d('0x4c')]({'where':{'id':_0x4bc4ac[_0x3c1d('0x4f')]['id']}})[_0x3c1d('0x26')](handleEntityNotFound(_0x4302f3,null))[_0x3c1d('0x26')](removeEntity(_0x4302f3,null))[_0x3c1d('0x4a')](handleError(_0x4302f3,null));}; \ No newline at end of file +var _0x160c=['limit','set','apply','save','update','then','error','stack','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','length','sort','where','filter','merge','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','fs-extra','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','sendStatus','status','end','json','offset','undefined','count'];(function(_0x27fccc,_0x4ffbdc){var _0x14598d=function(_0x45943c){while(--_0x45943c){_0x27fccc['push'](_0x27fccc['shift']());}};_0x14598d(++_0x4ffbdc);}(_0x160c,0x181));var _0xc160=function(_0x1cdf40,_0xd24a9e){_0x1cdf40=_0x1cdf40-0x0;var _0x1af53b=_0x160c[_0x1cdf40];return _0x1af53b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc160('0x0'));var zipdir=require(_0xc160('0x1'));var jsonpatch=require(_0xc160('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc160('0x3'));var util=require('util');var path=require(_0xc160('0x4'));var sox=require(_0xc160('0x5'));var csv=require(_0xc160('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc160('0x7'));var _=require('lodash');var squel=require(_0xc160('0x8'));var crypto=require('crypto');var jsforce=require(_0xc160('0x9'));var deskjs=require(_0xc160('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc160('0xb'));var Papa=require(_0xc160('0xc'));var Redis=require('ioredis');var authService=require(_0xc160('0xd'));var qs=require(_0xc160('0xe'));var as=require(_0xc160('0xf'));var hardwareService=require(_0xc160('0x10'));var logger=require(_0xc160('0x11'))(_0xc160('0x12'));var utils=require(_0xc160('0x13'));var config=require(_0xc160('0x14'));var licenseUtil=require(_0xc160('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58f7be,_0x363817){_0x363817=_0x363817||0xcc;return function(_0x5946ab){if(_0x5946ab){return _0x58f7be[_0xc160('0x16')](_0x363817);}return _0x58f7be[_0xc160('0x17')](_0x363817)[_0xc160('0x18')]();};}function respondWithResult(_0x548660,_0x1c3110){_0x1c3110=_0x1c3110||0xc8;return function(_0x5e1aa7){if(_0x5e1aa7){return _0x548660[_0xc160('0x17')](_0x1c3110)[_0xc160('0x19')](_0x5e1aa7);}};}function respondWithFilteredResult(_0x4c7561,_0x382227){return function(_0x5eb209){if(_0x5eb209){var _0x35f233=typeof _0x382227[_0xc160('0x1a')]===_0xc160('0x1b')&&typeof _0x382227['limit']==='undefined';var _0x1c320d=_0x5eb209[_0xc160('0x1c')];var _0x6120d5=_0x35f233?0x0:_0x382227['offset'];var _0x3b7b55=_0x35f233?_0x5eb209[_0xc160('0x1c')]:_0x382227[_0xc160('0x1a')]+_0x382227[_0xc160('0x1d')];var _0x4cf313;if(_0x3b7b55>=_0x1c320d){_0x3b7b55=_0x1c320d;_0x4cf313=0xc8;}else{_0x4cf313=0xce;}_0x4c7561[_0xc160('0x17')](_0x4cf313);return _0x4c7561[_0xc160('0x1e')]('Content-Range',_0x6120d5+'-'+_0x3b7b55+'/'+_0x1c320d)[_0xc160('0x19')](_0x5eb209);}return null;};}function patchUpdates(_0x3544cb){return function(_0x714d70){try{jsonpatch[_0xc160('0x1f')](_0x714d70,_0x3544cb,!![]);}catch(_0x41bb1e){return BPromise['reject'](_0x41bb1e);}return _0x714d70[_0xc160('0x20')]();};}function saveUpdates(_0x25f5cf,_0x2c99b8){return function(_0x143c18){if(_0x143c18){return _0x143c18[_0xc160('0x21')](_0x25f5cf)[_0xc160('0x22')](function(_0x2804ad){return _0x2804ad;});}return null;};}function removeEntity(_0x11f8c8,_0x417ac1){return function(_0x432a48){if(_0x432a48){return _0x432a48['destroy']()['then'](function(){_0x11f8c8[_0xc160('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d235e,_0x63d33d){return function(_0x2d5d3f){if(!_0x2d5d3f){_0x7d235e['sendStatus'](0x194);}return _0x2d5d3f;};}function handleError(_0x46e33f,_0xda5e6d){_0xda5e6d=_0xda5e6d||0x1f4;return function(_0x2542f1){logger[_0xc160('0x23')](_0x2542f1[_0xc160('0x24')]);if(_0x2542f1['name']){delete _0x2542f1[_0xc160('0x25')];}_0x46e33f[_0xc160('0x17')](_0xda5e6d)[_0xc160('0x26')](_0x2542f1);};}exports[_0xc160('0x27')]=function(_0xa10de0,_0x33a490){var _0x2e16ad={},_0x56a004={},_0xd1aab9={'count':0x0,'rows':[]};var _0x395857=_[_0xc160('0x28')](db['WhatsappApplication']['rawAttributes'],function(_0x44930d){return{'name':_0x44930d['fieldName'],'type':_0x44930d[_0xc160('0x29')][_0xc160('0x2a')]};});_0x56a004[_0xc160('0x2b')]=_['map'](_0x395857,'name');_0x56a004['query']=_['keys'](_0xa10de0[_0xc160('0x2c')]);_0x56a004[_0xc160('0x2d')]=_[_0xc160('0x2e')](_0x56a004['model'],_0x56a004[_0xc160('0x2c')]);_0x2e16ad['attributes']=_['intersection'](_0x56a004[_0xc160('0x2b')],qs[_0xc160('0x2f')](_0xa10de0['query'][_0xc160('0x2f')]));_0x2e16ad[_0xc160('0x30')]=_0x2e16ad[_0xc160('0x30')][_0xc160('0x31')]?_0x2e16ad[_0xc160('0x30')]:_0x56a004[_0xc160('0x2b')];if(!_0xa10de0[_0xc160('0x2c')]['hasOwnProperty']('nolimit')){_0x2e16ad[_0xc160('0x1d')]=qs['limit'](_0xa10de0[_0xc160('0x2c')][_0xc160('0x1d')]);_0x2e16ad[_0xc160('0x1a')]=qs[_0xc160('0x1a')](_0xa10de0[_0xc160('0x2c')]['offset']);}_0x2e16ad['order']=qs[_0xc160('0x32')](_0xa10de0[_0xc160('0x2c')][_0xc160('0x32')]);_0x2e16ad[_0xc160('0x33')]=qs['filters'](_['pick'](_0xa10de0['query'],_0x56a004[_0xc160('0x2d')]),_0x395857);if(_0xa10de0[_0xc160('0x2c')][_0xc160('0x34')]){_0x2e16ad[_0xc160('0x33')]=_['merge'](_0x2e16ad[_0xc160('0x33')],{'$or':_[_0xc160('0x28')](_0x395857,function(_0x503824){if(_0x503824[_0xc160('0x29')]!=='VIRTUAL'){var _0x1b6371={};_0x1b6371[_0x503824['name']]={'$like':'%'+_0xa10de0[_0xc160('0x2c')][_0xc160('0x34')]+'%'};return _0x1b6371;}})});}_0x2e16ad=_[_0xc160('0x35')]({},_0x2e16ad,_0xa10de0[_0xc160('0x36')]);var _0xa11aab={'where':_0x2e16ad['where']};return db[_0xc160('0x37')][_0xc160('0x1c')](_0xa11aab)[_0xc160('0x22')](function(_0x38fb34){_0xd1aab9[_0xc160('0x1c')]=_0x38fb34;if(_0xa10de0[_0xc160('0x2c')][_0xc160('0x38')]){_0x2e16ad[_0xc160('0x39')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xc160('0x3a')](_0x2e16ad);})[_0xc160('0x22')](function(_0x5c3c26){_0xd1aab9[_0xc160('0x3b')]=_0x5c3c26;return _0xd1aab9;})[_0xc160('0x22')](respondWithFilteredResult(_0x33a490,_0x2e16ad))[_0xc160('0x3c')](handleError(_0x33a490,null));};exports[_0xc160('0x3d')]=function(_0x38387f,_0x22bcbc){var _0x2b8727={'raw':!![],'where':{'id':_0x38387f[_0xc160('0x3e')]['id']}},_0x499d70={};_0x499d70[_0xc160('0x2b')]=_[_0xc160('0x3f')](db[_0xc160('0x37')][_0xc160('0x40')]);_0x499d70['query']=_['keys'](_0x38387f[_0xc160('0x2c')]);_0x499d70[_0xc160('0x2d')]=_['intersection'](_0x499d70['model'],_0x499d70[_0xc160('0x2c')]);_0x2b8727[_0xc160('0x30')]=_['intersection'](_0x499d70[_0xc160('0x2b')],qs[_0xc160('0x2f')](_0x38387f[_0xc160('0x2c')][_0xc160('0x2f')]));_0x2b8727['attributes']=_0x2b8727[_0xc160('0x30')][_0xc160('0x31')]?_0x2b8727[_0xc160('0x30')]:_0x499d70[_0xc160('0x2b')];if(_0x38387f[_0xc160('0x2c')]['includeAll']){_0x2b8727['include']=[{'all':!![]}];}_0x2b8727=_[_0xc160('0x35')]({},_0x2b8727,_0x38387f[_0xc160('0x36')]);return db[_0xc160('0x37')][_0xc160('0x41')](_0x2b8727)[_0xc160('0x22')](handleEntityNotFound(_0x22bcbc,null))['then'](respondWithResult(_0x22bcbc,null))['catch'](handleError(_0x22bcbc,null));};exports[_0xc160('0x42')]=function(_0x38d6d9,_0x188b24){return db[_0xc160('0x37')][_0xc160('0x42')](_0x38d6d9[_0xc160('0x43')],{})[_0xc160('0x22')](respondWithResult(_0x188b24,0xc9))['catch'](handleError(_0x188b24,null));};exports[_0xc160('0x21')]=function(_0x3fa809,_0x254d3b){if(_0x3fa809[_0xc160('0x43')]['id']){delete _0x3fa809[_0xc160('0x43')]['id'];}return db['WhatsappApplication'][_0xc160('0x41')]({'where':{'id':_0x3fa809['params']['id']}})[_0xc160('0x22')](handleEntityNotFound(_0x254d3b,null))[_0xc160('0x22')](saveUpdates(_0x3fa809[_0xc160('0x43')],null))['then'](respondWithResult(_0x254d3b,null))['catch'](handleError(_0x254d3b,null));};exports[_0xc160('0x44')]=function(_0x2b1af5,_0x3be62e){return db[_0xc160('0x37')][_0xc160('0x41')]({'where':{'id':_0x2b1af5[_0xc160('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3be62e,null))[_0xc160('0x22')](removeEntity(_0x3be62e,null))[_0xc160('0x3c')](handleError(_0x3be62e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 9768abc..9aaf784 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 _0x34f8=['moment','path','rimraf','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x3fc017,_0x288faf){var _0x542e8c=function(_0x42438c){while(--_0x42438c){_0x3fc017['push'](_0x3fc017['shift']());}};_0x542e8c(++_0x288faf);}(_0x34f8,0x80));var _0x834f=function(_0x18fb80,_0x29869f){_0x18fb80=_0x18fb80-0x0;var _0x92aba1=_0x34f8[_0x18fb80];return _0x92aba1;};'use strict';var _=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var logger=require(_0x834f('0x2'))(_0x834f('0x3'));var moment=require(_0x834f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x834f('0x5'));var rimraf=require(_0x834f('0x6'));var config=require('../../config/environment');var attributes=require(_0x834f('0x7'));module[_0x834f('0x8')]=function(_0x9e052f,_0x3498dd){return _0x9e052f['define']('WhatsappApplication',attributes,{'tableName':_0x834f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x834f('0xa'),'collate':_0x834f('0xb')});}; \ No newline at end of file +var _0xc73e=['util','api','moment','rimraf','../../config/environment','exports','define','whatsapp_applications','utf8mb4_unicode_ci','lodash'];(function(_0x339781,_0xe299e9){var _0x5cfb6a=function(_0x37f3de){while(--_0x37f3de){_0x339781['push'](_0x339781['shift']());}};_0x5cfb6a(++_0xe299e9);}(_0xc73e,0x1e9));var _0xec73=function(_0x2e028d,_0x5dcc0f){_0x2e028d=_0x2e028d-0x0;var _0x5c88b3=_0xc73e[_0x2e028d];return _0x5c88b3;};'use strict';var _=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var logger=require('../../config/logger')(_0xec73('0x2'));var moment=require(_0xec73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xec73('0x4'));var config=require(_0xec73('0x5'));var attributes=require('./whatsappApplication.attributes');module[_0xec73('0x6')]=function(_0x26598a,_0x3bd154){return _0x26598a[_0xec73('0x7')]('WhatsappApplication',attributes,{'tableName':_0xec73('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xec73('0x9')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ac51230..ca7265c 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 _0xed1f=['request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5f0d29,_0x4f7b80){var _0x1b7aec=function(_0x1da8c5){while(--_0x1da8c5){_0x5f0d29['push'](_0x5f0d29['shift']());}};_0x1b7aec(++_0x4f7b80);}(_0xed1f,0x6a));var _0xfed1=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xed1f[_0x1b6186];return _0x186121;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file +var _0xd0bb=['debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x4860e7,_0xf0b5a){var _0x242420=function(_0x199991){while(--_0x199991){_0x4860e7['push'](_0x4860e7['shift']());}};_0x242420(++_0xf0b5a);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x24e7b0,_0x23104f){_0x24e7b0=_0x24e7b0-0x0;var _0x1b09a1=_0xd0bb[_0x24e7b0];return _0x1b09a1;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2960f65..1e84273 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 _0xdb8b=['delete','whatsappinteraction:destroy','removeTags','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x4b37b6,_0x1a2fe6){var _0x5a9782=function(_0x126d59){while(--_0x126d59){_0x4b37b6['push'](_0x4b37b6['shift']());}};_0x5a9782(++_0x1a2fe6);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x4a92bf,_0x391651){_0x4a92bf=_0x4a92bf-0x0;var _0x537b38=_0xdb8b[_0x4a92bf];return _0x537b38;};'use strict';var multer=require('multer');var util=require(_0xbdb8('0x0'));var path=require(_0xbdb8('0x1'));var timeout=require(_0xbdb8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbdb8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbdb8('0x4'));var config=require(_0xbdb8('0x5'));var controller=require(_0xbdb8('0x6'));router[_0xbdb8('0x7')]('/',auth['isAuthenticated'](),controller[_0xbdb8('0x8')]);router['get'](_0xbdb8('0x9'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xb')]);router[_0xbdb8('0x7')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),controller['show']);router[_0xbdb8('0x7')](_0xbdb8('0xd'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xe')]);router[_0xbdb8('0x7')](_0xbdb8('0xf'),auth[_0xbdb8('0xa')](),controller['download']);router['post']('/',auth[_0xbdb8('0xa')](),controller['create']);router[_0xbdb8('0x10')]('/:id/messages',auth[_0xbdb8('0xa')](),controller['addMessage']);router[_0xbdb8('0x10')](_0xbdb8('0x11'),auth[_0xbdb8('0xa')](),interaction[_0xbdb8('0x12')](_0xbdb8('0x13'),_0xbdb8('0x14')),controller[_0xbdb8('0x15')]);router[_0xbdb8('0x16')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),interaction[_0xbdb8('0x12')](_0xbdb8('0x13'),_0xbdb8('0x17')),controller['update']);router[_0xbdb8('0x18')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),interaction['tracked']('whatsapp',_0xbdb8('0x19')),controller['destroy']);router[_0xbdb8('0x18')](_0xbdb8('0x11'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x1a')]);module[_0xbdb8('0x1b')]=router; \ No newline at end of file +var _0xe944=['whatsapp','whatsappinteraction:addtags','addTags','put','tracked','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','fs-extra','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0xe944,0x174));var _0x4e94=function(_0x4a51aa,_0x54acad){_0x4a51aa=_0x4a51aa-0x0;var _0x9ddd5b=_0xe944[_0x4a51aa];return _0x9ddd5b;};'use strict';var multer=require(_0x4e94('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4e94('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4e94('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e94('0x3'));var controller=require(_0x4e94('0x4'));router[_0x4e94('0x5')]('/',auth[_0x4e94('0x6')](),controller['index']);router[_0x4e94('0x5')](_0x4e94('0x7'),auth[_0x4e94('0x6')](),controller[_0x4e94('0x8')]);router['get'](_0x4e94('0x9'),auth['isAuthenticated'](),controller[_0x4e94('0xa')]);router[_0x4e94('0x5')](_0x4e94('0xb'),auth[_0x4e94('0x6')](),controller['getMessages']);router[_0x4e94('0x5')](_0x4e94('0xc'),auth[_0x4e94('0x6')](),controller[_0x4e94('0xd')]);router[_0x4e94('0xe')]('/',auth[_0x4e94('0x6')](),controller[_0x4e94('0xf')]);router['post']('/:id/messages',auth[_0x4e94('0x6')](),controller[_0x4e94('0x10')]);router[_0x4e94('0xe')](_0x4e94('0x11'),auth[_0x4e94('0x6')](),interaction['tracked'](_0x4e94('0x12'),_0x4e94('0x13')),controller[_0x4e94('0x14')]);router[_0x4e94('0x15')](_0x4e94('0x9'),auth[_0x4e94('0x6')](),interaction[_0x4e94('0x16')](_0x4e94('0x12'),_0x4e94('0x17')),controller[_0x4e94('0x18')]);router[_0x4e94('0x19')](_0x4e94('0x9'),auth['isAuthenticated'](),interaction['tracked'](_0x4e94('0x12'),_0x4e94('0x1a')),controller[_0x4e94('0x1b')]);router[_0x4e94('0x19')](_0x4e94('0x11'),auth['isAuthenticated'](),controller[_0x4e94('0x1c')]);module[_0x4e94('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 4dd2ab4..5140128 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 _0x58c9=['ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x6ea62b,_0x2802a7){var _0x581b2e=function(_0x3ee0da){while(--_0x3ee0da){_0x6ea62b['push'](_0x6ea62b['shift']());}};_0x581b2e(++_0x2802a7);}(_0x58c9,0x1bc));var _0x958c=function(_0x248177,_0x5df653){_0x248177=_0x248177-0x0;var _0x44c530=_0x58c9[_0x248177];return _0x44c530;};'use strict';var Sequelize=require(_0x958c('0x0'));var moment=require(_0x958c('0x1'));module[_0x958c('0x2')]={'closed':{'type':Sequelize[_0x958c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x958c('0x4')]},'disposition':{'type':Sequelize[_0x958c('0x5')]},'secondDisposition':{'type':Sequelize[_0x958c('0x5')]},'thirdDisposition':{'type':Sequelize[_0x958c('0x5')]},'note':{'type':Sequelize[_0x958c('0x5')]},'phone':{'type':Sequelize[_0x958c('0x5')]},'read1stAt':{'type':Sequelize[_0x958c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x958c('0x6')]('in',_0x958c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x958c('0x6')]('in',_0x958c('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x958c('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x958c('0x8')]}}; \ No newline at end of file +var _0x1b0e=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x1b0e,0x132));var _0xe1b0=function(_0x5397c5,_0x290189){_0x5397c5=_0x5397c5-0x0;var _0x324589=_0x1b0e[_0x5397c5];return _0x324589;};'use strict';var Sequelize=require(_0xe1b0('0x0'));var moment=require(_0xe1b0('0x1'));module[_0xe1b0('0x2')]={'closed':{'type':Sequelize[_0xe1b0('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe1b0('0x4')]},'disposition':{'type':Sequelize[_0xe1b0('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe1b0('0x5')]},'phone':{'type':Sequelize[_0xe1b0('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe1b0('0x6')]('in',_0xe1b0('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe1b0('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe1b0('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe1b0('0x3')],'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 fb4ab05..cece9bb 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 _0xb52a=['lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','name','send','fieldName','key','getOptions','whatsapp','query','user','catch','params','model','WhatsappInteraction','rawAttributes','intersection','attributes','fields','length','includeAll','include','merge','find','create','update','body','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','keys','hasOwnProperty','nolimit','order','where','WhatsappInteractionId','map','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','read','get','mkdirSync','Whatsapp','Owner','N.A.','toString','closed','basename','createReadStream','pipe','createWriteStream','out','System','firstName','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','zip-dir','moment','path','ejs'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xb52a,0x76));var _0xab52=function(_0x2002b3,_0x11e91c){_0x2002b3=_0x2002b3-0x0;var _0x2756f0=_0xb52a[_0x2002b3];return _0x2756f0;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xab52('0x0'));var moment=require(_0xab52('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xab52('0x2'));var ejs=require(_0xab52('0x3'));var fs=require('fs');var _=require(_0xab52('0x4'));var Redis=require(_0xab52('0x5'));var interaction=require(_0xab52('0x6'));var qs=require(_0xab52('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xab52('0x8'))(_0xab52('0x9'));var config=require(_0xab52('0xa'));var db=require('../../mysqldb')['db'];config[_0xab52('0xb')]=_[_0xab52('0xc')](config[_0xab52('0xb')],{'host':_0xab52('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab52('0xb')]));require(_0xab52('0xe'))['register'](socket);function respondWithStatusCode(_0x239cb1,_0x13dae1){_0x13dae1=_0x13dae1||0xcc;return function(_0x86e136){if(_0x86e136){return _0x239cb1[_0xab52('0xf')](_0x13dae1);}return _0x239cb1[_0xab52('0x10')](_0x13dae1)[_0xab52('0x11')]();};}function respondWithResult(_0x497298,_0x35c107){_0x35c107=_0x35c107||0xc8;return function(_0x2d3b87){if(_0x2d3b87){return _0x497298[_0xab52('0x10')](_0x35c107)[_0xab52('0x12')](_0x2d3b87);}};}function respondWithFilteredResult(_0x2c0845,_0xd59315){return function(_0x51fe2c){if(_0x51fe2c){var _0x3d4209=typeof _0xd59315[_0xab52('0x13')]===_0xab52('0x14')&&typeof _0xd59315[_0xab52('0x15')]===_0xab52('0x14');var _0x1d503b=_0x51fe2c[_0xab52('0x16')];var _0x19f40c=_0x3d4209?0x0:_0xd59315[_0xab52('0x13')];var _0xd82521=_0x3d4209?_0x51fe2c[_0xab52('0x16')]:_0xd59315[_0xab52('0x13')]+_0xd59315[_0xab52('0x15')];var _0x4ffdf9;if(_0xd82521>=_0x1d503b){_0xd82521=_0x1d503b;_0x4ffdf9=0xc8;}else{_0x4ffdf9=0xce;}_0x2c0845[_0xab52('0x10')](_0x4ffdf9);return _0x2c0845[_0xab52('0x17')](_0xab52('0x18'),_0x19f40c+'-'+_0xd82521+'/'+_0x1d503b)[_0xab52('0x12')](_0x51fe2c);}return null;};}function saveUpdates(_0x31d8fe){return function(_0x547a9d){if(_0x547a9d){return _0x547a9d['update'](_0x31d8fe)[_0xab52('0x19')](function(_0x237312){return _0x237312;});}return null;};}function removeEntity(_0x2e06c9){return function(_0x473bd8){if(_0x473bd8){return _0x473bd8[_0xab52('0x1a')]()[_0xab52('0x19')](function(){_0x2e06c9[_0xab52('0x10')](0xcc)[_0xab52('0x11')]();});}};}function handleEntityNotFound(_0x5824a1){return function(_0x1e5b95){if(!_0x1e5b95){_0x5824a1['sendStatus'](0x194);}return _0x1e5b95;};}function handleError(_0x10a704,_0x14986f){_0x14986f=_0x14986f||0x1f4;return function(_0x2c5f79){logger[_0xab52('0x1b')](_0x2c5f79['stack']);if(_0x2c5f79[_0xab52('0x1c')]){delete _0x2c5f79[_0xab52('0x1c')];}_0x10a704[_0xab52('0x10')](_0x14986f)[_0xab52('0x1d')](_0x2c5f79);};}exports['index']=function(_0x1e6af7,_0x377b08){var _0x439d6e={};var _0xf2ca8a=_['map'](db['WhatsappInteraction']['rawAttributes'],function(_0x1c0c59){return{'name':_0x1c0c59[_0xab52('0x1e')],'type':_0x1c0c59['type'][_0xab52('0x1f')]};});_0x439d6e=qs[_0xab52('0x20')](_0xf2ca8a,_0x1e6af7);return interaction['findAll'](_0xab52('0x21'),_0x1e6af7[_0xab52('0x22')],_0x1e6af7[_0xab52('0x23')],_0x439d6e,_0xf2ca8a)[_0xab52('0x19')](respondWithFilteredResult(_0x377b08,_0x439d6e))[_0xab52('0x24')](handleError(_0x377b08,null));};exports['show']=function(_0x4e4b3c,_0x427039){var _0x224b1={'raw':![],'where':{'id':_0x4e4b3c[_0xab52('0x25')]['id']}},_0x329c8d={};_0x329c8d[_0xab52('0x26')]=_['keys'](db[_0xab52('0x27')][_0xab52('0x28')]);_0x329c8d[_0xab52('0x22')]=_['keys'](_0x4e4b3c[_0xab52('0x22')]);_0x329c8d['filters']=_[_0xab52('0x29')](_0x329c8d['model'],_0x329c8d[_0xab52('0x22')]);_0x224b1[_0xab52('0x2a')]=_[_0xab52('0x29')](_0x329c8d[_0xab52('0x26')],qs[_0xab52('0x2b')](_0x4e4b3c['query'][_0xab52('0x2b')]));_0x224b1['attributes']=_0x224b1[_0xab52('0x2a')][_0xab52('0x2c')]?_0x224b1['attributes']:_0x329c8d[_0xab52('0x26')];if(_0x4e4b3c[_0xab52('0x22')][_0xab52('0x2d')]){_0x224b1[_0xab52('0x2e')]=[{'all':!![]}];}_0x224b1=_[_0xab52('0x2f')]({},_0x224b1,_0x4e4b3c['options']);return db['WhatsappInteraction'][_0xab52('0x30')](_0x224b1)[_0xab52('0x19')](handleEntityNotFound(_0x427039,null))[_0xab52('0x19')](respondWithResult(_0x427039,null))[_0xab52('0x24')](handleError(_0x427039,null));};exports['create']=function(_0x3ad479,_0x1522b3){return db[_0xab52('0x27')][_0xab52('0x31')](_0x3ad479['body'],{})[_0xab52('0x19')](respondWithResult(_0x1522b3,0xc9))['catch'](handleError(_0x1522b3,null));};exports[_0xab52('0x32')]=function(_0x54067f,_0x3b0d1a){if(_0x54067f['body']['id']){delete _0x54067f[_0xab52('0x33')]['id'];}return db[_0xab52('0x27')][_0xab52('0x30')]({'where':{'id':_0x54067f[_0xab52('0x25')]['id']}})[_0xab52('0x19')](handleEntityNotFound(_0x3b0d1a,null))[_0xab52('0x19')](saveUpdates(_0x54067f[_0xab52('0x33')],null))[_0xab52('0x19')](respondWithResult(_0x3b0d1a,null))[_0xab52('0x24')](handleError(_0x3b0d1a,null));};exports['destroy']=function(_0x16a4ae,_0x59e97c){return db['WhatsappInteraction']['find']({'where':{'id':_0x16a4ae['params']['id']}})[_0xab52('0x19')](handleEntityNotFound(_0x59e97c,null))[_0xab52('0x19')](removeEntity(_0x59e97c,null))['catch'](handleError(_0x59e97c,null));};exports[_0xab52('0x34')]=function(_0x449550,_0x1d7b6d){return db[_0xab52('0x27')][_0xab52('0x34')]()['then'](respondWithResult(_0x1d7b6d,null))[_0xab52('0x24')](handleError(_0x1d7b6d,null));};exports['addMessage']=function(_0x3e4272,_0x31b651){return db[_0xab52('0x35')][_0xab52('0x30')]({'where':{'id':_0x3e4272[_0xab52('0x25')]['id']}})[_0xab52('0x19')](handleEntityNotFound(_0x31b651,null))['then'](function(_0x12ac4e){if(_0x12ac4e){return _0x12ac4e[_0xab52('0x36')](_0x3e4272[_0xab52('0x33')][_0xab52('0x37')],_[_0xab52('0x38')](_0x3e4272['body'],[_0xab52('0x37'),'id'])||{});}})[_0xab52('0x19')](respondWithResult(_0x31b651,null))[_0xab52('0x24')](handleError(_0x31b651,null));};exports[_0xab52('0x39')]=function(_0x4bb85b,_0x439951){var _0x2e9ec1={'raw':![],'where':{}};var _0x3cc0bc={};var _0xeefdec={'count':0x0,'rows':[]};return db[_0xab52('0x27')][_0xab52('0x3a')]({'where':{'id':_0x4bb85b['params']['id']}})[_0xab52('0x19')](handleEntityNotFound(_0x439951,null))[_0xab52('0x19')](function(_0x2f9042){if(_0x2f9042){_0x3cc0bc[_0xab52('0x26')]=_[_0xab52('0x3b')](db['WhatsappMessage'][_0xab52('0x28')]);_0x3cc0bc[_0xab52('0x22')]=_[_0xab52('0x3b')](_0x4bb85b[_0xab52('0x22')]);_0x3cc0bc['filters']=_[_0xab52('0x29')](_0x3cc0bc[_0xab52('0x26')],_0x3cc0bc[_0xab52('0x22')]);_0x2e9ec1['attributes']=_['intersection'](_0x3cc0bc[_0xab52('0x26')],qs[_0xab52('0x2b')](_0x4bb85b[_0xab52('0x22')]['fields']));_0x2e9ec1[_0xab52('0x2a')]=_0x2e9ec1[_0xab52('0x2a')]['length']?_0x2e9ec1[_0xab52('0x2a')]:_0x3cc0bc[_0xab52('0x26')];if(!_0x4bb85b[_0xab52('0x22')][_0xab52('0x3c')](_0xab52('0x3d'))){_0x2e9ec1[_0xab52('0x15')]=qs[_0xab52('0x15')](_0x4bb85b[_0xab52('0x22')]['limit']);_0x2e9ec1[_0xab52('0x13')]=qs[_0xab52('0x13')](_0x4bb85b['query'][_0xab52('0x13')]);}_0x2e9ec1[_0xab52('0x3e')]=qs['sort'](_0x4bb85b['query']['sort']);_0x2e9ec1[_0xab52('0x3f')]=qs['filters'](_['pick'](_0x4bb85b[_0xab52('0x22')],_0x3cc0bc['filters']));_0x2e9ec1[_0xab52('0x3f')][_0xab52('0x40')]=_0x2f9042['id'];if(_0x4bb85b[_0xab52('0x22')]['filter']){_0x2e9ec1[_0xab52('0x3f')]=_[_0xab52('0x2f')](_0x2e9ec1[_0xab52('0x3f')],{'$or':_[_0xab52('0x41')](_0x2e9ec1['attributes'],function(_0x42ab70){var _0x3fe201={};_0x3fe201[_0x42ab70]={'$like':'%'+_0x4bb85b['query'][_0xab52('0x42')]+'%'};return _0x3fe201;})});}if(_0x4bb85b[_0xab52('0x22')]['$gte']){var _0x412add=_0x4bb85b[_0xab52('0x22')][_0xab52('0x43')][_0xab52('0x44')](',');var _0x547489={};_0x547489[_0x412add[0x0]]={'$gte':moment(_0x412add[0x1])['format'](_0xab52('0x45'))};_0x2e9ec1[_0xab52('0x3f')]=_[_0xab52('0x2f')](_0x2e9ec1[_0xab52('0x3f')],_0x547489);}_0x2e9ec1=_[_0xab52('0x2f')]({},_0x2e9ec1,_0x4bb85b[_0xab52('0x46')]);return db['WhatsappMessage'][_0xab52('0x16')]({'where':_0x2e9ec1['where']})['then'](function(_0x53162e){_0xeefdec[_0xab52('0x16')]=_0x53162e;if(_0x4bb85b[_0xab52('0x22')][_0xab52('0x2d')]){_0x2e9ec1['include']=[{'all':!![]}];}return db[_0xab52('0x35')][_0xab52('0x47')](_0x2e9ec1);})[_0xab52('0x19')](function(_0x1ae9d2){_0xeefdec[_0xab52('0x48')]=_0x1ae9d2;return _0xeefdec;});}})['then'](respondWithFilteredResult(_0x439951,_0x2e9ec1))['catch'](handleError(_0x439951,null));};exports['addTags']=function(_0x340bbd,_0x422500){return db[_0xab52('0x27')][_0xab52('0x30')]({'where':{'id':_0x340bbd[_0xab52('0x25')]['id']}})[_0xab52('0x19')](handleEntityNotFound(_0x422500,null))[_0xab52('0x19')](function(_0x196388){if(_0x196388){return _0x196388[_0xab52('0x49')](_0x340bbd[_0xab52('0x33')]['ids'],_['omit'](_0x340bbd[_0xab52('0x33')],[_0xab52('0x37'),'id'])||{})[_0xab52('0x4a')](function(){return db['Tag'][_0xab52('0x47')]({'attributes':['id',_0xab52('0x1c'),_0xab52('0x4b')],'where':{'id':_0x340bbd[_0xab52('0x33')][_0xab52('0x37')]}});})[_0xab52('0x19')](function(_0x26af4d){socket[_0xab52('0x4c')](_0xab52('0x4d'),{'id':Number(_0x340bbd['params']['id']),'tags':_0x26af4d||[]});return{'id':Number(_0x340bbd[_0xab52('0x25')]['id']),'tags':_0x26af4d||[]};});}})[_0xab52('0x19')](respondWithResult(_0x422500,null))[_0xab52('0x24')](handleError(_0x422500,null));};exports[_0xab52('0x4e')]=function(_0x4377b7,_0x32b550){return db['WhatsappInteraction']['find']({'where':{'id':_0x4377b7[_0xab52('0x25')]['id']}})['then'](handleEntityNotFound(_0x32b550,null))[_0xab52('0x19')](function(_0x2a627a){if(_0x2a627a){return _0x2a627a[_0xab52('0x4e')](_0x4377b7['query']['ids']);}})['then'](respondWithStatusCode(_0x32b550,null))['catch'](handleError(_0x32b550,null));};exports[_0xab52('0x4f')]=function(_0x41a53d,_0x4385aa){var _0x27f9f1=moment()[_0xab52('0x50')]()['toString']();var _0x1782d4=path[_0xab52('0x51')](config[_0xab52('0x52')],_0xab52('0x53'),_0xab52('0x54'),_0xab52('0x55'));var _0x5686cc=path[_0xab52('0x51')](config[_0xab52('0x52')],'server',_0xab52('0x54'),_0xab52('0x56'));var _0x4291ca=path[_0xab52('0x51')](_0x1782d4,_0x27f9f1);var _0x542922=util[_0xab52('0x57')](_0xab52('0x58'),_0x41a53d['params']['id'],_0x27f9f1);var _0x214cdf=path['join'](_0x1782d4,_0x542922);var _0x4533ac=[];_0x4533ac[_0xab52('0x59')]({'model':db['User'],'as':_0xab52('0x5a'),'attributes':['id',_0xab52('0x5b')],'raw':!![]});_0x4533ac['push']({'model':db[_0xab52('0x5c')],'as':_0xab52('0x5d'),'attributes':['id','firstName',_0xab52('0x5e')],'raw':!![]});if(_0x41a53d[_0xab52('0x22')][_0xab52('0x56')]){_0x4533ac[_0xab52('0x59')]({'model':db[_0xab52('0x5f')],'as':_0xab52('0x5f'),'raw':!![]});}var _0x25e750=[{'model':db['WhatsappMessage'],'as':_0xab52('0x60'),'attributes':['id',_0xab52('0x33'),_0xab52('0x61'),_0xab52('0x62'),_0xab52('0x63'),_0xab52('0x64')],'include':_0x4533ac}];_0x25e750[_0xab52('0x59')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id','name']});_0x25e750[_0xab52('0x59')]({'model':db['User'],'as':'Owner','attributes':['id',_0xab52('0x5b')]});return db[_0xab52('0x27')][_0xab52('0x30')]({'where':{'id':_0x41a53d[_0xab52('0x25')]['id']},'include':_0x25e750})[_0xab52('0x19')](handleEntityNotFound(_0x4385aa,null))['then'](function(_0x4609af){if(_0x4609af){var _0xe00ffb=_0x4609af[_0xab52('0x65')]({'plain':!![]});fs[_0xab52('0x66')](_0x4291ca);var _0x2e78f5={'channel':_0xab52('0x67'),'account':_0xe00ffb['Account'][_0xab52('0x1c')],'agent':_0xe00ffb['Owner']?_0xe00ffb[_0xab52('0x68')]['fullname']:_0xab52('0x69'),'createdAt':moment(_0xe00ffb[_0xab52('0x61')])[_0xab52('0x57')](_0xab52('0x45'))[_0xab52('0x6a')](),'closedAt':_0xe00ffb[_0xab52('0x6b')]?moment(_0xe00ffb['closedAt'])[_0xab52('0x57')](_0xab52('0x45'))[_0xab52('0x6a')]():'','disposition':_0xe00ffb['disposition'],'messages':_(_0xe00ffb[_0xab52('0x60')])['filter']({'secret':![]})[_0xab52('0x41')](function(_0x3f90d1){if(_0x3f90d1[_0xab52('0x5f')]){var _0xec0653=path[_0xab52('0x51')](_0x5686cc,_0x3f90d1['Attachment'][_0xab52('0x6c')]);if(fs['existsSync'](_0xec0653)){fs[_0xab52('0x6d')](_0xec0653)[_0xab52('0x6e')](fs[_0xab52('0x6f')](path['join'](_0x4291ca,_0x3f90d1[_0xab52('0x5f')][_0xab52('0x6c')])));}}return{'date':moment(_0x3f90d1['createdAt'])[_0xab52('0x57')](_0xab52('0x45'))[_0xab52('0x6a')](),'sender':_0x3f90d1[_0xab52('0x62')]===_0xab52('0x70')?_0x3f90d1[_0xab52('0x5a')]?_0x3f90d1['User'][_0xab52('0x5b')]:_0xab52('0x71'):_0x3f90d1[_0xab52('0x5d')][_0xab52('0x72')]+(_0x3f90d1[_0xab52('0x5d')][_0xab52('0x5e')]?'\x20'+_0x3f90d1['Contact'][_0xab52('0x5e')]:''),'body':_0x3f90d1[_0xab52('0x5f')]?_0x3f90d1['Attachment'][_0xab52('0x6c')]:_0x3f90d1[_0xab52('0x33')],'direction':_0x3f90d1[_0xab52('0x62')]===_0xab52('0x70')?'A':'C','secret':_0x3f90d1[_0xab52('0x63')],'read':_0x3f90d1[_0xab52('0x64')],'attachment':_0x3f90d1[_0xab52('0x5f')]};})[_0xab52('0x73')]()};return ejs[_0xab52('0x74')](path[_0xab52('0x51')](config[_0xab52('0x52')],_0xab52('0x53'),'views',_0xab52('0x75')),{'interaction':_0x2e78f5})[_0xab52('0x19')](function(_0x3bb6c8){var _0xa81435=path[_0xab52('0x51')](_0x4291ca,_0xab52('0x76')+_0xe00ffb['id']+'-'+_0x27f9f1+_0xab52('0x77'));var _0x2e0600={'path':_0xa81435,'channel':_0xab52('0x67'),'interactionId':_0xe00ffb['id']};return pdf[_0xab52('0x78')](_0x3bb6c8,_0x2e0600);})['then'](function(){return new BPromise(function(_0x10f05b,_0x3b4a28){zipdir(_0x4291ca,{'saveTo':_0x214cdf},function(_0x3f3e6c,_0x47fe6f){if(_0x3f3e6c)return _0x3b4a28(_0x3f3e6c);return _0x10f05b(_0x47fe6f);});})[_0xab52('0x19')](function(){return new BPromise(function(_0x476e28,_0x4caeb1){rimraf(_0x4291ca,function(_0x1c6837){if(_0x1c6837)_0x4caeb1(_0x1c6837);return _0x476e28();});});})['then'](function(){return _0x4385aa[_0xab52('0x4f')](_0x214cdf,_0x542922,function(_0x3ec973){if(_0x3ec973){console[_0xab52('0x79')]('err',_0x3ec973);}else{fs['unlinkSync'](_0x214cdf);}});});});}else{return _0x4385aa[_0xab52('0xf')](0xc8);}})[_0xab52('0x24')](handleError(_0x4385aa,null));}; \ No newline at end of file +var _0x82a1=['files','tmp','join','server','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','read','WhatsappAccount','Owner','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','basename','existsSync','createReadStream','out','System','secret','value','renderFile','views','.pdf','Whatsapp','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','fieldName','type','key','findAll','whatsapp','query','user','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','merge','options','find','body','describe','WhatsappMessage','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','includeAll','include','rows','addTags','setTags','omit','spread','Tag','emit','whatsappInteractionTags:save','download','unix','toString','root'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x82a1,0xa3));var _0x182a=function(_0x4f6141,_0x22930f){_0x4f6141=_0x4f6141-0x0;var _0x15f73c=_0x82a1[_0x4f6141];return _0x15f73c;};'use strict';var rimraf=require(_0x182a('0x0'));var zipdir=require(_0x182a('0x1'));var moment=require(_0x182a('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x182a('0x3'));var ejs=require(_0x182a('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x182a('0x5'));var qs=require(_0x182a('0x6'));var pdf=require(_0x182a('0x7'));var logger=require(_0x182a('0x8'))('api');var config=require('../../config/environment');var db=require(_0x182a('0x9'))['db'];config[_0x182a('0xa')]=_[_0x182a('0xb')](config[_0x182a('0xa')],{'host':_0x182a('0xc'),'port':0x18eb});var socket=require(_0x182a('0xd'))(new Redis(config[_0x182a('0xa')]));require('./whatsappInteraction.socket')[_0x182a('0xe')](socket);function respondWithStatusCode(_0x28b18f,_0x200662){_0x200662=_0x200662||0xcc;return function(_0x157b29){if(_0x157b29){return _0x28b18f[_0x182a('0xf')](_0x200662);}return _0x28b18f[_0x182a('0x10')](_0x200662)[_0x182a('0x11')]();};}function respondWithResult(_0x3fd410,_0x966034){_0x966034=_0x966034||0xc8;return function(_0x5d2804){if(_0x5d2804){return _0x3fd410[_0x182a('0x10')](_0x966034)['json'](_0x5d2804);}};}function respondWithFilteredResult(_0x29a694,_0x132cb0){return function(_0x1e1a75){if(_0x1e1a75){var _0xe3b597=typeof _0x132cb0[_0x182a('0x12')]===_0x182a('0x13')&&typeof _0x132cb0[_0x182a('0x14')]==='undefined';var _0x1ac1da=_0x1e1a75[_0x182a('0x15')];var _0x385a22=_0xe3b597?0x0:_0x132cb0[_0x182a('0x12')];var _0x530939=_0xe3b597?_0x1e1a75[_0x182a('0x15')]:_0x132cb0['offset']+_0x132cb0['limit'];var _0x3e7c73;if(_0x530939>=_0x1ac1da){_0x530939=_0x1ac1da;_0x3e7c73=0xc8;}else{_0x3e7c73=0xce;}_0x29a694[_0x182a('0x10')](_0x3e7c73);return _0x29a694['set'](_0x182a('0x16'),_0x385a22+'-'+_0x530939+'/'+_0x1ac1da)[_0x182a('0x17')](_0x1e1a75);}return null;};}function saveUpdates(_0x243743){return function(_0x4853f8){if(_0x4853f8){return _0x4853f8[_0x182a('0x18')](_0x243743)[_0x182a('0x19')](function(_0x4b3233){return _0x4b3233;});}return null;};}function removeEntity(_0xf7a40){return function(_0x21b50f){if(_0x21b50f){return _0x21b50f[_0x182a('0x1a')]()[_0x182a('0x19')](function(){_0xf7a40['status'](0xcc)[_0x182a('0x11')]();});}};}function handleEntityNotFound(_0x4e41fb){return function(_0xf63702){if(!_0xf63702){_0x4e41fb['sendStatus'](0x194);}return _0xf63702;};}function handleError(_0x2bf3f8,_0x4378c4){_0x4378c4=_0x4378c4||0x1f4;return function(_0x3012ab){logger[_0x182a('0x1b')](_0x3012ab[_0x182a('0x1c')]);if(_0x3012ab[_0x182a('0x1d')]){delete _0x3012ab[_0x182a('0x1d')];}_0x2bf3f8[_0x182a('0x10')](_0x4378c4)[_0x182a('0x1e')](_0x3012ab);};}exports[_0x182a('0x1f')]=function(_0xf5e624,_0x2b33f8){var _0x5ed13f={};var _0x4ace1b=_[_0x182a('0x20')](db[_0x182a('0x21')]['rawAttributes'],function(_0x1bbda8){return{'name':_0x1bbda8[_0x182a('0x22')],'type':_0x1bbda8[_0x182a('0x23')][_0x182a('0x24')]};});_0x5ed13f=qs['getOptions'](_0x4ace1b,_0xf5e624);return interaction[_0x182a('0x25')](_0x182a('0x26'),_0xf5e624[_0x182a('0x27')],_0xf5e624[_0x182a('0x28')],_0x5ed13f,_0x4ace1b)[_0x182a('0x19')](respondWithFilteredResult(_0x2b33f8,_0x5ed13f))[_0x182a('0x29')](handleError(_0x2b33f8,null));};exports['show']=function(_0x3495cf,_0x5eab81){var _0x5f2eef={'raw':![],'where':{'id':_0x3495cf[_0x182a('0x2a')]['id']}},_0x29acdc={};_0x29acdc[_0x182a('0x2b')]=_[_0x182a('0x2c')](db['WhatsappInteraction'][_0x182a('0x2d')]);_0x29acdc['query']=_[_0x182a('0x2c')](_0x3495cf[_0x182a('0x27')]);_0x29acdc[_0x182a('0x2e')]=_[_0x182a('0x2f')](_0x29acdc[_0x182a('0x2b')],_0x29acdc['query']);_0x5f2eef[_0x182a('0x30')]=_[_0x182a('0x2f')](_0x29acdc[_0x182a('0x2b')],qs[_0x182a('0x31')](_0x3495cf[_0x182a('0x27')][_0x182a('0x31')]));_0x5f2eef[_0x182a('0x30')]=_0x5f2eef[_0x182a('0x30')][_0x182a('0x32')]?_0x5f2eef['attributes']:_0x29acdc[_0x182a('0x2b')];if(_0x3495cf[_0x182a('0x27')]['includeAll']){_0x5f2eef['include']=[{'all':!![]}];}_0x5f2eef=_[_0x182a('0x33')]({},_0x5f2eef,_0x3495cf[_0x182a('0x34')]);return db[_0x182a('0x21')][_0x182a('0x35')](_0x5f2eef)[_0x182a('0x19')](handleEntityNotFound(_0x5eab81,null))[_0x182a('0x19')](respondWithResult(_0x5eab81,null))[_0x182a('0x29')](handleError(_0x5eab81,null));};exports['create']=function(_0x4e7f3f,_0x3e80b6){return db[_0x182a('0x21')]['create'](_0x4e7f3f['body'],{})[_0x182a('0x19')](respondWithResult(_0x3e80b6,0xc9))['catch'](handleError(_0x3e80b6,null));};exports[_0x182a('0x18')]=function(_0x34605c,_0x194198){if(_0x34605c[_0x182a('0x36')]['id']){delete _0x34605c[_0x182a('0x36')]['id'];}return db['WhatsappInteraction'][_0x182a('0x35')]({'where':{'id':_0x34605c['params']['id']}})[_0x182a('0x19')](handleEntityNotFound(_0x194198,null))[_0x182a('0x19')](saveUpdates(_0x34605c[_0x182a('0x36')],null))['then'](respondWithResult(_0x194198,null))[_0x182a('0x29')](handleError(_0x194198,null));};exports['destroy']=function(_0x2bdef0,_0x104174){return db[_0x182a('0x21')]['find']({'where':{'id':_0x2bdef0[_0x182a('0x2a')]['id']}})[_0x182a('0x19')](handleEntityNotFound(_0x104174,null))[_0x182a('0x19')](removeEntity(_0x104174,null))[_0x182a('0x29')](handleError(_0x104174,null));};exports[_0x182a('0x37')]=function(_0x38b050,_0x5a8ab3){return db['WhatsappInteraction'][_0x182a('0x37')]()[_0x182a('0x19')](respondWithResult(_0x5a8ab3,null))[_0x182a('0x29')](handleError(_0x5a8ab3,null));};exports['addMessage']=function(_0x583ce3,_0x420ed0){return db[_0x182a('0x38')][_0x182a('0x35')]({'where':{'id':_0x583ce3[_0x182a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x420ed0,null))[_0x182a('0x19')](function(_0x5ab8ef){if(_0x5ab8ef){return _0x5ab8ef[_0x182a('0x39')](_0x583ce3[_0x182a('0x36')][_0x182a('0x3a')],_['omit'](_0x583ce3['body'],[_0x182a('0x3a'),'id'])||{});}})[_0x182a('0x19')](respondWithResult(_0x420ed0,null))[_0x182a('0x29')](handleError(_0x420ed0,null));};exports[_0x182a('0x3b')]=function(_0x4f8cfe,_0x3acb96){var _0x259100={'raw':![],'where':{}};var _0x2ebfe9={};var _0x42f218={'count':0x0,'rows':[]};return db[_0x182a('0x21')]['findOne']({'where':{'id':_0x4f8cfe[_0x182a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3acb96,null))[_0x182a('0x19')](function(_0xac715d){if(_0xac715d){_0x2ebfe9[_0x182a('0x2b')]=_['keys'](db[_0x182a('0x38')]['rawAttributes']);_0x2ebfe9[_0x182a('0x27')]=_[_0x182a('0x2c')](_0x4f8cfe[_0x182a('0x27')]);_0x2ebfe9[_0x182a('0x2e')]=_[_0x182a('0x2f')](_0x2ebfe9[_0x182a('0x2b')],_0x2ebfe9[_0x182a('0x27')]);_0x259100[_0x182a('0x30')]=_[_0x182a('0x2f')](_0x2ebfe9[_0x182a('0x2b')],qs[_0x182a('0x31')](_0x4f8cfe[_0x182a('0x27')][_0x182a('0x31')]));_0x259100[_0x182a('0x30')]=_0x259100[_0x182a('0x30')][_0x182a('0x32')]?_0x259100['attributes']:_0x2ebfe9[_0x182a('0x2b')];if(!_0x4f8cfe[_0x182a('0x27')][_0x182a('0x3c')](_0x182a('0x3d'))){_0x259100['limit']=qs['limit'](_0x4f8cfe[_0x182a('0x27')][_0x182a('0x14')]);_0x259100['offset']=qs[_0x182a('0x12')](_0x4f8cfe[_0x182a('0x27')][_0x182a('0x12')]);}_0x259100[_0x182a('0x3e')]=qs[_0x182a('0x3f')](_0x4f8cfe[_0x182a('0x27')][_0x182a('0x3f')]);_0x259100[_0x182a('0x40')]=qs[_0x182a('0x2e')](_[_0x182a('0x41')](_0x4f8cfe[_0x182a('0x27')],_0x2ebfe9[_0x182a('0x2e')]));_0x259100[_0x182a('0x40')]['WhatsappInteractionId']=_0xac715d['id'];if(_0x4f8cfe['query']['filter']){_0x259100[_0x182a('0x40')]=_[_0x182a('0x33')](_0x259100['where'],{'$or':_['map'](_0x259100[_0x182a('0x30')],function(_0x58e84e){var _0x22ea85={};_0x22ea85[_0x58e84e]={'$like':'%'+_0x4f8cfe[_0x182a('0x27')][_0x182a('0x42')]+'%'};return _0x22ea85;})});}if(_0x4f8cfe[_0x182a('0x27')]['$gte']){var _0x7d63ff=_0x4f8cfe[_0x182a('0x27')][_0x182a('0x43')][_0x182a('0x44')](',');var _0x19b6c4={};_0x19b6c4[_0x7d63ff[0x0]]={'$gte':moment(_0x7d63ff[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x259100[_0x182a('0x40')]=_[_0x182a('0x33')](_0x259100[_0x182a('0x40')],_0x19b6c4);}_0x259100=_[_0x182a('0x33')]({},_0x259100,_0x4f8cfe[_0x182a('0x34')]);return db[_0x182a('0x38')][_0x182a('0x15')]({'where':_0x259100[_0x182a('0x40')]})['then'](function(_0x4cf2a9){_0x42f218[_0x182a('0x15')]=_0x4cf2a9;if(_0x4f8cfe[_0x182a('0x27')][_0x182a('0x45')]){_0x259100[_0x182a('0x46')]=[{'all':!![]}];}return db[_0x182a('0x38')]['findAll'](_0x259100);})[_0x182a('0x19')](function(_0x3c08ca){_0x42f218[_0x182a('0x47')]=_0x3c08ca;return _0x42f218;});}})['then'](respondWithFilteredResult(_0x3acb96,_0x259100))[_0x182a('0x29')](handleError(_0x3acb96,null));};exports[_0x182a('0x48')]=function(_0x308fb0,_0xb5106f){return db[_0x182a('0x21')][_0x182a('0x35')]({'where':{'id':_0x308fb0['params']['id']}})[_0x182a('0x19')](handleEntityNotFound(_0xb5106f,null))[_0x182a('0x19')](function(_0x4df351){if(_0x4df351){return _0x4df351[_0x182a('0x49')](_0x308fb0['body'][_0x182a('0x3a')],_[_0x182a('0x4a')](_0x308fb0[_0x182a('0x36')],['ids','id'])||{})[_0x182a('0x4b')](function(){return db[_0x182a('0x4c')][_0x182a('0x25')]({'attributes':['id',_0x182a('0x1d'),'color'],'where':{'id':_0x308fb0[_0x182a('0x36')][_0x182a('0x3a')]}});})[_0x182a('0x19')](function(_0x2cf03f){socket[_0x182a('0x4d')](_0x182a('0x4e'),{'id':Number(_0x308fb0['params']['id']),'tags':_0x2cf03f||[]});return{'id':Number(_0x308fb0['params']['id']),'tags':_0x2cf03f||[]};});}})[_0x182a('0x19')](respondWithResult(_0xb5106f,null))[_0x182a('0x29')](handleError(_0xb5106f,null));};exports['removeTags']=function(_0x1b1242,_0x5e5ff8){return db['WhatsappInteraction'][_0x182a('0x35')]({'where':{'id':_0x1b1242[_0x182a('0x2a')]['id']}})[_0x182a('0x19')](handleEntityNotFound(_0x5e5ff8,null))[_0x182a('0x19')](function(_0x5d4322){if(_0x5d4322){return _0x5d4322['removeTags'](_0x1b1242[_0x182a('0x27')][_0x182a('0x3a')]);}})['then'](respondWithStatusCode(_0x5e5ff8,null))[_0x182a('0x29')](handleError(_0x5e5ff8,null));};exports[_0x182a('0x4f')]=function(_0x51cfe5,_0x4d2943){var _0x37bdd5=moment()[_0x182a('0x50')]()[_0x182a('0x51')]();var _0xa1d111=path['join'](config[_0x182a('0x52')],'server',_0x182a('0x53'),_0x182a('0x54'));var _0x276416=path[_0x182a('0x55')](config[_0x182a('0x52')],_0x182a('0x56'),_0x182a('0x53'),_0x182a('0x57'));var _0x1a844a=path[_0x182a('0x55')](_0xa1d111,_0x37bdd5);var _0x3500db=util[_0x182a('0x58')](_0x182a('0x59'),_0x51cfe5[_0x182a('0x2a')]['id'],_0x37bdd5);var _0x30af6e=path[_0x182a('0x55')](_0xa1d111,_0x3500db);var _0x505792=[];_0x505792[_0x182a('0x5a')]({'model':db[_0x182a('0x5b')],'as':_0x182a('0x5b'),'attributes':['id',_0x182a('0x5c')],'raw':!![]});_0x505792[_0x182a('0x5a')]({'model':db[_0x182a('0x5d')],'as':_0x182a('0x5e'),'attributes':['id',_0x182a('0x5f'),_0x182a('0x60')],'raw':!![]});if(_0x51cfe5[_0x182a('0x27')][_0x182a('0x57')]){_0x505792[_0x182a('0x5a')]({'model':db[_0x182a('0x61')],'as':'Attachment','raw':!![]});}var _0x1fa0ac=[{'model':db[_0x182a('0x38')],'as':_0x182a('0x62'),'attributes':['id','body',_0x182a('0x63'),_0x182a('0x64'),'secret',_0x182a('0x65')],'include':_0x505792}];_0x1fa0ac['push']({'model':db[_0x182a('0x66')],'as':'Account','attributes':['id','name']});_0x1fa0ac['push']({'model':db[_0x182a('0x5b')],'as':_0x182a('0x67'),'attributes':['id','fullname']});return db[_0x182a('0x21')]['find']({'where':{'id':_0x51cfe5['params']['id']},'include':_0x1fa0ac})[_0x182a('0x19')](handleEntityNotFound(_0x4d2943,null))[_0x182a('0x19')](function(_0x2dad21){if(_0x2dad21){var _0x451c95=_0x2dad21['get']({'plain':!![]});fs['mkdirSync'](_0x1a844a);var _0x37a6d6={'channel':'Whatsapp','account':_0x451c95[_0x182a('0x68')]['name'],'agent':_0x451c95['Owner']?_0x451c95[_0x182a('0x67')]['fullname']:_0x182a('0x69'),'createdAt':moment(_0x451c95['createdAt'])[_0x182a('0x58')](_0x182a('0x6a'))[_0x182a('0x51')](),'closedAt':_0x451c95[_0x182a('0x6b')]?moment(_0x451c95[_0x182a('0x6c')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x182a('0x51')]():'','disposition':_0x451c95['disposition'],'messages':_(_0x451c95[_0x182a('0x62')])[_0x182a('0x42')]({'secret':![]})[_0x182a('0x20')](function(_0x3045b1){if(_0x3045b1[_0x182a('0x61')]){var _0x5467d1=path[_0x182a('0x55')](_0x276416,_0x3045b1['Attachment'][_0x182a('0x6d')]);if(fs[_0x182a('0x6e')](_0x5467d1)){fs[_0x182a('0x6f')](_0x5467d1)['pipe'](fs['createWriteStream'](path[_0x182a('0x55')](_0x1a844a,_0x3045b1[_0x182a('0x61')]['basename'])));}}return{'date':moment(_0x3045b1[_0x182a('0x63')])[_0x182a('0x58')](_0x182a('0x6a'))[_0x182a('0x51')](),'sender':_0x3045b1[_0x182a('0x64')]===_0x182a('0x70')?_0x3045b1[_0x182a('0x5b')]?_0x3045b1['User'][_0x182a('0x5c')]:_0x182a('0x71'):_0x3045b1['Contact'][_0x182a('0x5f')]+(_0x3045b1['Contact'][_0x182a('0x60')]?'\x20'+_0x3045b1[_0x182a('0x5e')]['lastName']:''),'body':_0x3045b1[_0x182a('0x61')]?_0x3045b1[_0x182a('0x61')][_0x182a('0x6d')]:_0x3045b1['body'],'direction':_0x3045b1['direction']===_0x182a('0x70')?'A':'C','secret':_0x3045b1[_0x182a('0x72')],'read':_0x3045b1[_0x182a('0x65')],'attachment':_0x3045b1[_0x182a('0x61')]};})[_0x182a('0x73')]()};return ejs[_0x182a('0x74')](path[_0x182a('0x55')](config[_0x182a('0x52')],_0x182a('0x56'),_0x182a('0x75'),'downloadInteraction.ejs'),{'interaction':_0x37a6d6})['then'](function(_0x2db1ca){var _0x4c035c=path[_0x182a('0x55')](_0x1a844a,'transcript-'+_0x451c95['id']+'-'+_0x37bdd5+_0x182a('0x76'));var _0x1d91b1={'path':_0x4c035c,'channel':_0x182a('0x77'),'interactionId':_0x451c95['id']};return pdf[_0x182a('0x78')](_0x2db1ca,_0x1d91b1);})[_0x182a('0x19')](function(){return new BPromise(function(_0x1a80ab,_0x7936d9){zipdir(_0x1a844a,{'saveTo':_0x30af6e},function(_0x406960,_0x3ba60a){if(_0x406960)return _0x7936d9(_0x406960);return _0x1a80ab(_0x3ba60a);});})[_0x182a('0x19')](function(){return new BPromise(function(_0x4a7c73,_0x3e6f08){rimraf(_0x1a844a,function(_0x2c0a62){if(_0x2c0a62)_0x3e6f08(_0x2c0a62);return _0x4a7c73();});});})[_0x182a('0x19')](function(){return _0x4d2943[_0x182a('0x4f')](_0x30af6e,_0x3500db,function(_0x3158a2){if(_0x3158a2){console[_0x182a('0x79')]('err',_0x3158a2);}else{fs[_0x182a('0x7a')](_0x30af6e);}});});});}else{return _0x4d2943[_0x182a('0xf')](0xc8);}})[_0x182a('0x29')](handleError(_0x4d2943,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 93af9be..08f9762 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 _0x2242=['remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update'];(function(_0xec9322,_0x2d5b87){var _0x39d576=function(_0x542056){while(--_0x542056){_0xec9322['push'](_0xec9322['shift']());}};_0x39d576(++_0x2d5b87);}(_0x2242,0x1a3));var _0x2224=function(_0x5a2b39,_0x7684a1){_0x5a2b39=_0x5a2b39-0x0;var _0x4bfc96=_0x2242[_0x5a2b39];return _0x4bfc96;};'use strict';var EventEmitter=require(_0x2224('0x0'));var WhatsappInteraction=require(_0x2224('0x1'))['db'][_0x2224('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x2224('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x2224('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2224('0x5'),'afterDestroy':_0x2224('0x6')};function emitEvent(_0x4b2099){return function(_0x272e58,_0x1ba850,_0x23a873){_0x272e58['getUsers']({'attributes':['id'],'raw':!![]})[_0x2224('0x7')](function(_0x16893c){_0x272e58[_0x2224('0x8')](_0x2224('0x9'),_0x16893c[_0x2224('0xa')](function(_0x1d3c0e){return{'id':_0x1d3c0e['id']};}));return WhatsappMessage[_0x2224('0xb')]({'where':{'WhatsappInteractionId':_0x272e58['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2224('0x7')](function(_0x359fe8){_0x272e58[_0x2224('0x8')](_0x2224('0xc'),_0x359fe8[_0x2224('0xd')]);WhatsappInteractionEvents[_0x2224('0xe')](_0x4b2099+':'+_0x272e58['id'],_0x272e58);WhatsappInteractionEvents[_0x2224('0xe')](_0x4b2099,_0x272e58);_0x23a873(null);})[_0x2224('0xf')](_0x23a873(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x2224('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x94d2=['save','getUsers','setDataValue','Users','map','findAll','length','emit','hasOwnProperty','hook','exports','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x152999,_0x1dd83b){var _0x32ef67=function(_0xe8dc18){while(--_0xe8dc18){_0x152999['push'](_0x152999['shift']());}};_0x32ef67(++_0x1dd83b);}(_0x94d2,0x1cd));var _0x294d=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x94d2[_0x23be51];return _0x47a26d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x294d('0x0')];var WhatsappMessage=require(_0x294d('0x1'))['db'][_0x294d('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x294d('0x3')](0x0);var events={'afterCreate':_0x294d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f2fc8){return function(_0x393430,_0xb2c63a,_0x234700){_0x393430[_0x294d('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5c3d7c){_0x393430[_0x294d('0x6')](_0x294d('0x7'),_0x5c3d7c[_0x294d('0x8')](function(_0x3066ae){return{'id':_0x3066ae['id']};}));return WhatsappMessage[_0x294d('0x9')]({'where':{'WhatsappInteractionId':_0x393430['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x7931bb){_0x393430[_0x294d('0x6')]('unreadMessages',_0x7931bb[_0x294d('0xa')]);WhatsappInteractionEvents[_0x294d('0xb')](_0x2f2fc8+':'+_0x393430['id'],_0x393430);WhatsappInteractionEvents['emit'](_0x2f2fc8,_0x393430);_0x234700(null);})['catch'](_0x234700(null));};}for(var e in events){if(events[_0x294d('0xc')](e)){var event=events[e];WhatsappInteraction[_0x294d('0xd')](e,emitEvent(event));}}module[_0x294d('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 85171e7..2b834ca 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 _0x2e91=['bluebird','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closed','closedAt','lodash','util','api','moment'];(function(_0x2577b4,_0x299f5d){var _0x2c089b=function(_0x488448){while(--_0x488448){_0x2577b4['push'](_0x2577b4['shift']());}};_0x2c089b(++_0x299f5d);}(_0x2e91,0x158));var _0x12e9=function(_0x51fcb8,_0x488303){_0x51fcb8=_0x51fcb8-0x0;var _0x4ddc02=_0x2e91[_0x51fcb8];return _0x4ddc02;};'use strict';var _=require(_0x12e9('0x0'));var util=require(_0x12e9('0x1'));var logger=require('../../config/logger')(_0x12e9('0x2'));var moment=require(_0x12e9('0x3'));var BPromise=require(_0x12e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x12e9('0x5'));module[_0x12e9('0x6')]=function(_0x5aa715,_0x28addd){return _0x5aa715[_0x12e9('0x7')]('WhatsappInteraction',attributes,{'tableName':_0x12e9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5353a8,_0x4877c9,_0xb32523){if(_0x5353a8[_0x12e9('0x9')](_0x12e9('0xa'))){_0x5353a8[_0x12e9('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xb32523(null,_0x5353a8);}}});}; \ No newline at end of file +var _0x8bea=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2b3062,_0x1f4d35){var _0x528b16=function(_0x3d736b){while(--_0x3d736b){_0x2b3062['push'](_0x2b3062['shift']());}};_0x528b16(++_0x1f4d35);}(_0x8bea,0x96));var _0xa8be=function(_0x45ff50,_0x71f810){_0x45ff50=_0x45ff50-0x0;var _0x143a4d=_0x8bea[_0x45ff50];return _0x143a4d;};'use strict';var _=require(_0xa8be('0x0'));var util=require(_0xa8be('0x1'));var logger=require(_0xa8be('0x2'))(_0xa8be('0x3'));var moment=require('moment');var BPromise=require(_0xa8be('0x4'));var rp=require(_0xa8be('0x5'));var fs=require('fs');var path=require(_0xa8be('0x6'));var rimraf=require(_0xa8be('0x7'));var config=require('../../config/environment');var attributes=require(_0xa8be('0x8'));module[_0xa8be('0x9')]=function(_0x2a3d5d,_0x4d31ca){return _0x2a3d5d['define'](_0xa8be('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35749d,_0x437ccb,_0x3d19db){if(_0x35749d[_0xa8be('0xb')]('closed')){_0x35749d[_0xa8be('0xc')]=moment()[_0xa8be('0xd')](_0xa8be('0xe'));}_0x3d19db(null,_0x35749d);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 9b0d3d3..e212c5c 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 _0x25a9=['defaults','redis','localhost','./whatsappInteraction.socket','register','request','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','limit','find','where','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x140fe6,_0x56dbfb){var _0x244f22=function(_0x575aee){while(--_0x575aee){_0x140fe6['push'](_0x140fe6['shift']());}};_0x244f22(++_0x56dbfb);}(_0x25a9,0x173));var _0x925a=function(_0x125106,_0x1a5f5d){_0x125106=_0x125106-0x0;var _0xc1ffd5=_0x25a9[_0x125106];return _0xc1ffd5;};'use strict';var _=require(_0x925a('0x0'));var util=require('util');var moment=require(_0x925a('0x1'));var BPromise=require(_0x925a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x925a('0x3'));var db=require(_0x925a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x925a('0x5'));var config=require('../../config/environment');var jayson=require(_0x925a('0x6'));var client=jayson[_0x925a('0x7')][_0x925a('0x8')]({'port':0x232a});config['redis']=_[_0x925a('0x9')](config[_0x925a('0xa')],{'host':_0x925a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x925a('0xc'))[_0x925a('0xd')](socket);function respondWithRpcPromise(_0x32dae8,_0x5acfc8,_0x461a0e){return new BPromise(function(_0x559c65,_0x30db53){return client[_0x925a('0xe')](_0x32dae8,_0x461a0e)[_0x925a('0xf')](function(_0x22d85c){logger[_0x925a('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x5acfc8,'request\x20sent');logger[_0x925a('0x11')](_0x925a('0x12'),_0x5acfc8,_0x925a('0x13'),JSON[_0x925a('0x14')](_0x22d85c));if(_0x22d85c['error']){if(_0x22d85c[_0x925a('0x15')]['code']===0x1f4){logger[_0x925a('0x15')](_0x925a('0x16'),_0x5acfc8,_0x22d85c[_0x925a('0x15')]['message']);return _0x30db53(_0x22d85c[_0x925a('0x15')]['message']);}logger[_0x925a('0x15')](_0x925a('0x16'),_0x5acfc8,_0x22d85c[_0x925a('0x15')][_0x925a('0x17')]);return _0x559c65(_0x22d85c[_0x925a('0x15')][_0x925a('0x17')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x5acfc8,_0x925a('0x13'));_0x559c65(_0x22d85c['result']['message']);}})[_0x925a('0x18')](function(_0x3e9810){logger[_0x925a('0x15')](_0x925a('0x16'),_0x5acfc8,_0x3e9810);_0x30db53(_0x3e9810);});});}exports[_0x925a('0x19')]=function(_0x534327){var _0x4d7c0c=this;return new Promise(function(_0x316d69,_0x4e93ac){return db[_0x925a('0x1a')][_0x925a('0x1b')](_0x534327[_0x925a('0x1c')],{'raw':_0x534327[_0x925a('0x1d')]?_0x534327['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x534327[_0x925a('0x1d')]?_0x534327[_0x925a('0x1d')]['where']||null:null,'attributes':_0x534327[_0x925a('0x1d')]?_0x534327[_0x925a('0x1d')]['attributes']||null:null,'limit':_0x534327[_0x925a('0x1d')]?_0x534327[_0x925a('0x1d')][_0x925a('0x1e')]||null:null})['then'](function(_0x176d57){logger[_0x925a('0x10')](_0x925a('0x19'),_0x534327);logger[_0x925a('0x11')](_0x925a('0x19'),_0x534327,JSON['stringify'](_0x176d57));_0x316d69(_0x176d57);})[_0x925a('0x18')](function(_0x5445a4){logger['error'](_0x925a('0x19'),_0x5445a4[_0x925a('0x17')],_0x534327);_0x4e93ac(_0x4d7c0c[_0x925a('0x15')](0x1f4,_0x5445a4['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x516261){return new Promise(function(_0x541145,_0x374a82){return db['WhatsappInteraction'][_0x925a('0x1f')]({'where':_0x516261['options']?_0x516261[_0x925a('0x1d')][_0x925a('0x20')]||null:null})[_0x925a('0xf')](function(_0x157a16){if(_0x157a16){return _0x157a16[_0x925a('0x21')](_0x516261[_0x925a('0x1c')][_0x925a('0x22')],_[_0x925a('0x23')](_0x516261['body'],[_0x925a('0x22'),'id'])||{});}})[_0x925a('0x24')](function(_0x44a869){logger[_0x925a('0x10')](_0x925a('0x25'),_0x516261);logger[_0x925a('0x11')](_0x925a('0x25'),_0x516261,JSON[_0x925a('0x14')](_0x44a869));_0x541145(_0x44a869);})[_0x925a('0x18')](function(_0x597891){logger[_0x925a('0x15')](_0x925a('0x25'),_0x597891[_0x925a('0x17')],_0x516261);_0x374a82(_this['error'](0x1f4,_0x597891[_0x925a('0x17')]));});});}; \ No newline at end of file +var _0x2513=['update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction'];(function(_0x2e36a0,_0x3b5978){var _0x547ffb=function(_0x4ecab4){while(--_0x4ecab4){_0x2e36a0['push'](_0x2e36a0['shift']());}};_0x547ffb(++_0x3b5978);}(_0x2513,0xb5));var _0x3251=function(_0x5bc0af,_0x63a853){_0x5bc0af=_0x5bc0af-0x0;var _0xfb1af=_0x2513[_0x5bc0af];return _0xfb1af;};'use strict';var _=require(_0x3251('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3251('0x1'));var rs=require(_0x3251('0x2'));var fs=require('fs');var Redis=require(_0x3251('0x3'));var db=require(_0x3251('0x4'))['db'];var utils=require(_0x3251('0x5'));var logger=require(_0x3251('0x6'))('rpc');var config=require(_0x3251('0x7'));var jayson=require(_0x3251('0x8'));var client=jayson[_0x3251('0x9')]['http']({'port':0x232a});config[_0x3251('0xa')]=_[_0x3251('0xb')](config[_0x3251('0xa')],{'host':_0x3251('0xc'),'port':0x18eb});var socket=require(_0x3251('0xd'))(new Redis(config['redis']));require(_0x3251('0xe'))['register'](socket);function respondWithRpcPromise(_0x178396,_0x9c7834,_0x23838e){return new BPromise(function(_0x2a7575,_0x506594){return client[_0x3251('0xf')](_0x178396,_0x23838e)[_0x3251('0x10')](function(_0x4f6030){logger[_0x3251('0x11')](_0x3251('0x12'),_0x9c7834,_0x3251('0x13'));logger[_0x3251('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x9c7834,_0x3251('0x13'),JSON[_0x3251('0x15')](_0x4f6030));if(_0x4f6030[_0x3251('0x16')]){if(_0x4f6030['error'][_0x3251('0x17')]===0x1f4){logger[_0x3251('0x16')](_0x3251('0x12'),_0x9c7834,_0x4f6030[_0x3251('0x16')][_0x3251('0x18')]);return _0x506594(_0x4f6030[_0x3251('0x16')]['message']);}logger[_0x3251('0x16')](_0x3251('0x12'),_0x9c7834,_0x4f6030[_0x3251('0x16')][_0x3251('0x18')]);return _0x2a7575(_0x4f6030[_0x3251('0x16')][_0x3251('0x18')]);}else{logger[_0x3251('0x11')](_0x3251('0x12'),_0x9c7834,_0x3251('0x13'));_0x2a7575(_0x4f6030[_0x3251('0x19')][_0x3251('0x18')]);}})[_0x3251('0x1a')](function(_0x5c5232){logger[_0x3251('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x9c7834,_0x5c5232);_0x506594(_0x5c5232);});});}exports[_0x3251('0x1b')]=function(_0xe9e532){var _0x341674=this;return new Promise(function(_0xd084c,_0x144de3){return db[_0x3251('0x1c')][_0x3251('0x1d')](_0xe9e532[_0x3251('0x1e')],{'raw':_0xe9e532[_0x3251('0x1f')]?_0xe9e532[_0x3251('0x1f')][_0x3251('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe9e532[_0x3251('0x1f')]?_0xe9e532[_0x3251('0x1f')][_0x3251('0x21')]||null:null,'attributes':_0xe9e532['options']?_0xe9e532[_0x3251('0x1f')][_0x3251('0x22')]||null:null,'limit':_0xe9e532[_0x3251('0x1f')]?_0xe9e532[_0x3251('0x1f')][_0x3251('0x23')]||null:null})['then'](function(_0x192bf7){logger[_0x3251('0x11')](_0x3251('0x1b'),_0xe9e532);logger[_0x3251('0x14')](_0x3251('0x1b'),_0xe9e532,JSON[_0x3251('0x15')](_0x192bf7));_0xd084c(_0x192bf7);})[_0x3251('0x1a')](function(_0x2f0b5c){logger['error'](_0x3251('0x1b'),_0x2f0b5c[_0x3251('0x18')],_0xe9e532);_0x144de3(_0x341674[_0x3251('0x16')](0x1f4,_0x2f0b5c[_0x3251('0x18')]));});});};exports[_0x3251('0x24')]=function(_0x52d025){return new Promise(function(_0x25ecfc,_0x3ba774){return db[_0x3251('0x1c')][_0x3251('0x25')]({'where':_0x52d025[_0x3251('0x1f')]?_0x52d025[_0x3251('0x1f')]['where']||null:null})[_0x3251('0x10')](function(_0x20e4a2){if(_0x20e4a2){return _0x20e4a2['addTags'](_0x52d025[_0x3251('0x1e')][_0x3251('0x26')],_[_0x3251('0x27')](_0x52d025[_0x3251('0x1e')],[_0x3251('0x26'),'id'])||{});}})[_0x3251('0x28')](function(_0x1ecbfc){logger[_0x3251('0x11')](_0x3251('0x29'),_0x52d025);logger[_0x3251('0x14')](_0x3251('0x29'),_0x52d025,JSON['stringify'](_0x1ecbfc));_0x25ecfc(_0x1ecbfc);})[_0x3251('0x1a')](function(_0x52afc3){logger[_0x3251('0x16')](_0x3251('0x29'),_0x52afc3['message'],_0x52d025);_0x3ba774(_this[_0x3251('0x16')](0x1f4,_0x52afc3[_0x3251('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d8bc9e0..1f98bea 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 _0x6c77=['length','whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener','register'];(function(_0x28e96c,_0x2d75ed){var _0x1db3d5=function(_0x101ebd){while(--_0x101ebd){_0x28e96c['push'](_0x28e96c['shift']());}};_0x1db3d5(++_0x2d75ed);}(_0x6c77,0x152));var _0x76c7=function(_0x120900,_0x1b16c7){_0x120900=_0x120900-0x0;var _0x356528=_0x6c77[_0x120900];return _0x356528;};'use strict';var WhatsappInteractionEvents=require(_0x76c7('0x0'));var events=['save',_0x76c7('0x1'),_0x76c7('0x2')];function createListener(_0x348df4,_0x4fca3f){return function(_0x5136a0){_0x4fca3f[_0x76c7('0x3')](_0x348df4,_0x5136a0);};}function removeListener(_0x245ffa,_0x5ee312){return function(){WhatsappInteractionEvents[_0x76c7('0x4')](_0x245ffa,_0x5ee312);};}exports[_0x76c7('0x5')]=function(_0x50fd8b){for(var _0x18fde8=0x0,_0x2cba45=events[_0x76c7('0x6')];_0x18fde8<_0x2cba45;_0x18fde8++){var _0x5eccf9=events[_0x18fde8];var _0x46d30c=createListener(_0x76c7('0x7')+_0x5eccf9,_0x50fd8b);WhatsappInteractionEvents['on'](_0x5eccf9,_0x46d30c);}}; \ No newline at end of file +var _0x50bf=['whatsappInteraction:','./whatsappInteraction.events','emit','register','length'];(function(_0x4a1a9b,_0x40391f){var _0x237338=function(_0x32c2d0){while(--_0x32c2d0){_0x4a1a9b['push'](_0x4a1a9b['shift']());}};_0x237338(++_0x40391f);}(_0x50bf,0x1a0));var _0xf50b=function(_0xe15cc5,_0x551056){_0xe15cc5=_0xe15cc5-0x0;var _0x4e5124=_0x50bf[_0xe15cc5];return _0x4e5124;};'use strict';var WhatsappInteractionEvents=require(_0xf50b('0x0'));var events=['save','remove','update'];function createListener(_0x4912f4,_0x5a6c16){return function(_0x1d0079){_0x5a6c16[_0xf50b('0x1')](_0x4912f4,_0x1d0079);};}function removeListener(_0x6e23f1,_0x24316b){return function(){WhatsappInteractionEvents['removeListener'](_0x6e23f1,_0x24316b);};}exports[_0xf50b('0x2')]=function(_0x3f73e0){for(var _0x114dd3=0x0,_0x919837=events[_0xf50b('0x3')];_0x114dd3<_0x919837;_0x114dd3++){var _0x5f5207=events[_0x114dd3];var _0x1ac636=createListener(_0xf50b('0x4')+_0x5f5207,_0x3f73e0);WhatsappInteractionEvents['on'](_0x5f5207,_0x1ac636);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 82f29db..c3acda3 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 _0x7fd0=['/:id','show','whatsapp','create','post','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x43685c,_0x4616ff){var _0x4264c1=function(_0x186d8d){while(--_0x186d8d){_0x43685c['push'](_0x43685c['shift']());}};_0x4264c1(++_0x4616ff);}(_0x7fd0,0xa9));var _0x07fd=function(_0x10f98d,_0x7658d3){_0x10f98d=_0x10f98d-0x0;var _0x11befb=_0x7fd0[_0x10f98d];return _0x11befb;};'use strict';var multer=require(_0x07fd('0x0'));var util=require(_0x07fd('0x1'));var path=require(_0x07fd('0x2'));var timeout=require('connect-timeout');var express=require(_0x07fd('0x3'));var router=express['Router']();var fs_extra=require(_0x07fd('0x4'));var auth=require(_0x07fd('0x5'));var interaction=require(_0x07fd('0x6'));var config=require('../../config/environment');var controller=require(_0x07fd('0x7'));router[_0x07fd('0x8')]('/',auth[_0x07fd('0x9')](),controller[_0x07fd('0xa')]);router[_0x07fd('0x8')](_0x07fd('0xb'),auth[_0x07fd('0x9')](),controller[_0x07fd('0xc')]);router[_0x07fd('0x8')](_0x07fd('0xd'),auth['isAuthenticated'](),controller[_0x07fd('0xe')]);router['post']('/',auth[_0x07fd('0x9')](),interaction['tracked'](_0x07fd('0xf'),'whatsappmessage:create'),controller[_0x07fd('0x10')]);router[_0x07fd('0x11')]('/:id/status',controller[_0x07fd('0x12')]);router[_0x07fd('0x13')](_0x07fd('0xd'),auth[_0x07fd('0x9')](),controller[_0x07fd('0x14')]);router[_0x07fd('0x13')](_0x07fd('0x15'),auth[_0x07fd('0x9')](),controller[_0x07fd('0x16')]);router[_0x07fd('0x13')](_0x07fd('0x17'),auth['isAuthenticated'](),controller[_0x07fd('0x18')]);router['delete'](_0x07fd('0xd'),auth[_0x07fd('0x9')](),controller[_0x07fd('0x19')]);module['exports']=router; \ No newline at end of file +var _0xb5c7=['index','/:id','show','tracked','whatsappmessage:create','create','post','/:id/status','status','update','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x1fcaaa,_0x4f9e3c){var _0x16606e=function(_0x3ad5d3){while(--_0x3ad5d3){_0x1fcaaa['push'](_0x1fcaaa['shift']());}};_0x16606e(++_0x4f9e3c);}(_0xb5c7,0x68));var _0x7b5c=function(_0x28915d,_0x1ea8d0){_0x28915d=_0x28915d-0x0;var _0x5ee220=_0xb5c7[_0x28915d];return _0x5ee220;};'use strict';var multer=require(_0x7b5c('0x0'));var util=require(_0x7b5c('0x1'));var path=require(_0x7b5c('0x2'));var timeout=require(_0x7b5c('0x3'));var express=require(_0x7b5c('0x4'));var router=express[_0x7b5c('0x5')]();var fs_extra=require(_0x7b5c('0x6'));var auth=require(_0x7b5c('0x7'));var interaction=require(_0x7b5c('0x8'));var config=require('../../config/environment');var controller=require(_0x7b5c('0x9'));router[_0x7b5c('0xa')]('/',auth[_0x7b5c('0xb')](),controller[_0x7b5c('0xc')]);router['get']('/describe',auth[_0x7b5c('0xb')](),controller['describe']);router[_0x7b5c('0xa')](_0x7b5c('0xd'),auth[_0x7b5c('0xb')](),controller[_0x7b5c('0xe')]);router['post']('/',auth[_0x7b5c('0xb')](),interaction[_0x7b5c('0xf')]('whatsapp',_0x7b5c('0x10')),controller[_0x7b5c('0x11')]);router[_0x7b5c('0x12')](_0x7b5c('0x13'),controller[_0x7b5c('0x14')]);router['put']('/:id',auth[_0x7b5c('0xb')](),controller[_0x7b5c('0x15')]);router[_0x7b5c('0x16')](_0x7b5c('0x17'),auth['isAuthenticated'](),controller[_0x7b5c('0x18')]);router[_0x7b5c('0x16')]('/:id/reject',auth[_0x7b5c('0xb')](),controller[_0x7b5c('0x19')]);router[_0x7b5c('0x1a')](_0x7b5c('0xd'),auth[_0x7b5c('0xb')](),controller[_0x7b5c('0x1b')]);module[_0x7b5c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 5721fba..647eeef 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 _0x06fe=['ENUM','out','STRING','sequelize','TEXT','BOOLEAN'];(function(_0x4268c4,_0x1722af){var _0x2cd6c9=function(_0x43fd2b){while(--_0x43fd2b){_0x4268c4['push'](_0x4268c4['shift']());}};_0x2cd6c9(++_0x1722af);}(_0x06fe,0xff));var _0xe06f=function(_0x3879f5,_0x5b4fe8){_0x3879f5=_0x3879f5-0x0;var _0x27ee90=_0x06fe[_0x3879f5];return _0x27ee90;};'use strict';var Sequelize=require(_0xe06f('0x0'));module['exports']={'body':{'type':Sequelize[_0xe06f('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe06f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe06f('0x3')]('in','out'),'defaultValue':_0xe06f('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe06f('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe06f('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe06f('0x5')]},'providerResponse':{'type':Sequelize[_0xe06f('0x1')]}}; \ No newline at end of file +var _0x5bac=['STRING','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0x5bac,0x19f));var _0xc5ba=function(_0x43fc6e,_0x41ac6b){_0x43fc6e=_0x43fc6e-0x0;var _0x3ca5c5=_0x5bac[_0x43fc6e];return _0x3ca5c5;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xc5ba('0x0')](_0xc5ba('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc5ba('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc5ba('0x3')]('in','out'),'defaultValue':_0xc5ba('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc5ba('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xc5ba('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc5ba('0x5')]},'providerResponse':{'type':Sequelize[_0xc5ba('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9635490..93df965 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 _0xf737=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','end','status','json','offset','undefined','limit','count','set','apply','reject','update','sendStatus','stack','name','send','index','WhatsappMessage','rawAttributes','type','key','map','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','params','keys','include','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','fullname','internal','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/parsers/qs'];(function(_0x481cde,_0x11c1d1){var _0x41b368=function(_0x2e34ea){while(--_0x2e34ea){_0x481cde['push'](_0x481cde['shift']());}};_0x41b368(++_0x11c1d1);}(_0xf737,0x102));var _0x7f73=function(_0x1819be,_0x19ba61){_0x1819be=_0x1819be-0x0;var _0x1d1dea=_0xf737[_0x1819be];return _0x1d1dea;};'use strict';var emlformat=require(_0x7f73('0x0'));var rimraf=require(_0x7f73('0x1'));var zipdir=require(_0x7f73('0x2'));var jsonpatch=require(_0x7f73('0x3'));var rp=require(_0x7f73('0x4'));var moment=require('moment');var BPromise=require(_0x7f73('0x5'));var Mustache=require(_0x7f73('0x6'));var util=require(_0x7f73('0x7'));var path=require(_0x7f73('0x8'));var sox=require('sox');var csv=require(_0x7f73('0x9'));var ejs=require(_0x7f73('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f73('0xb'));var squel=require('squel');var crypto=require(_0x7f73('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7f73('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7f73('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f73('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f73('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x7f73('0x11'));var config=require(_0x7f73('0x12'));var licenseUtil=require(_0x7f73('0x13'));var db=require(_0x7f73('0x14'))['db'];config[_0x7f73('0x15')]=_[_0x7f73('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7f73('0x17'))(new Redis(config['redis']));require(_0x7f73('0x18'))[_0x7f73('0x19')](socket);var jayson=require(_0x7f73('0x1a'));var client=jayson[_0x7f73('0x1b')][_0x7f73('0x1c')]({'port':0x232c});var client9002=jayson[_0x7f73('0x1b')][_0x7f73('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2c2055,_0x2d5e12,_0x45a309,_0x4d9166){return new BPromise(function(_0x501368,_0x369205){var _0x34ccb4=_0x4d9166||client;return _0x34ccb4[_0x7f73('0x1d')](_0x2c2055,_0x45a309)[_0x7f73('0x1e')](function(_0x1303a9){logger[_0x7f73('0x1f')](_0x7f73('0x20'),_0x2d5e12,_0x7f73('0x21'));logger['debug'](_0x7f73('0x22'),_0x2d5e12,_0x7f73('0x21'),JSON[_0x7f73('0x23')](_0x1303a9));if(_0x1303a9[_0x7f73('0x24')]){if(_0x1303a9[_0x7f73('0x24')]['code']===0x1f4){logger[_0x7f73('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x2d5e12,_0x1303a9['error']['message']);return _0x369205(_0x1303a9[_0x7f73('0x24')][_0x7f73('0x25')]);}logger[_0x7f73('0x24')](_0x7f73('0x20'),_0x2d5e12,_0x1303a9[_0x7f73('0x24')][_0x7f73('0x25')]);return _0x501368(_0x1303a9['error'][_0x7f73('0x25')]);}else{logger[_0x7f73('0x1f')](_0x7f73('0x20'),_0x2d5e12,'request\x20sent');_0x501368(_0x1303a9['result'][_0x7f73('0x25')]);}})[_0x7f73('0x26')](function(_0x2099b0){logger[_0x7f73('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x2d5e12,_0x2099b0);_0x369205(_0x2099b0);});});}function respondWithStatusCode(_0x1c84c5,_0xf3cbb){_0xf3cbb=_0xf3cbb||0xcc;return function(_0x2d2bb0){if(_0x2d2bb0){return _0x1c84c5['sendStatus'](_0xf3cbb);}return _0x1c84c5['status'](_0xf3cbb)[_0x7f73('0x27')]();};}function respondWithResult(_0x7a6f1d,_0x3e0f02){_0x3e0f02=_0x3e0f02||0xc8;return function(_0x54eec6){if(_0x54eec6){return _0x7a6f1d[_0x7f73('0x28')](_0x3e0f02)[_0x7f73('0x29')](_0x54eec6);}};}function respondWithFilteredResult(_0x191c3b,_0x24d8f6){return function(_0x1974da){if(_0x1974da){var _0x3cef37=typeof _0x24d8f6[_0x7f73('0x2a')]===_0x7f73('0x2b')&&typeof _0x24d8f6[_0x7f73('0x2c')]===_0x7f73('0x2b');var _0x170406=_0x1974da['count'];var _0x2e913f=_0x3cef37?0x0:_0x24d8f6['offset'];var _0x57be5f=_0x3cef37?_0x1974da[_0x7f73('0x2d')]:_0x24d8f6[_0x7f73('0x2a')]+_0x24d8f6[_0x7f73('0x2c')];var _0x32fbb8;if(_0x57be5f>=_0x170406){_0x57be5f=_0x170406;_0x32fbb8=0xc8;}else{_0x32fbb8=0xce;}_0x191c3b[_0x7f73('0x28')](_0x32fbb8);return _0x191c3b[_0x7f73('0x2e')]('Content-Range',_0x2e913f+'-'+_0x57be5f+'/'+_0x170406)['json'](_0x1974da);}return null;};}function patchUpdates(_0x31c850){return function(_0x32d068){try{jsonpatch[_0x7f73('0x2f')](_0x32d068,_0x31c850,!![]);}catch(_0x399367){return BPromise[_0x7f73('0x30')](_0x399367);}return _0x32d068['save']();};}function saveUpdates(_0x3c4f89,_0x333030){return function(_0x426abc){if(_0x426abc){return _0x426abc[_0x7f73('0x31')](_0x3c4f89)[_0x7f73('0x1e')](function(_0x15e900){return _0x15e900;});}return null;};}function removeEntity(_0x4fac3a,_0x26bdd9){return function(_0x1393e9){if(_0x1393e9){return _0x1393e9['destroy']()[_0x7f73('0x1e')](function(){_0x4fac3a[_0x7f73('0x28')](0xcc)[_0x7f73('0x27')]();});}};}function handleEntityNotFound(_0x42f534,_0x175a95){return function(_0x1927fc){if(!_0x1927fc){_0x42f534[_0x7f73('0x32')](0x194);}return _0x1927fc;};}function handleError(_0x12281a,_0x54461a){_0x54461a=_0x54461a||0x1f4;return function(_0x2710d1){logger[_0x7f73('0x24')](_0x2710d1[_0x7f73('0x33')]);if(_0x2710d1[_0x7f73('0x34')]){delete _0x2710d1['name'];}_0x12281a[_0x7f73('0x28')](_0x54461a)[_0x7f73('0x35')](_0x2710d1);};}exports[_0x7f73('0x36')]=function(_0x50a5ee,_0x1b09e5){var _0x586d78={},_0x565af0={},_0x2400a1={'count':0x0,'rows':[]};var _0x2f33cb=_['map'](db[_0x7f73('0x37')][_0x7f73('0x38')],function(_0x5c047d){return{'name':_0x5c047d['fieldName'],'type':_0x5c047d[_0x7f73('0x39')][_0x7f73('0x3a')]};});_0x565af0['model']=_[_0x7f73('0x3b')](_0x2f33cb,_0x7f73('0x34'));_0x565af0[_0x7f73('0x3c')]=_['keys'](_0x50a5ee['query']);_0x565af0[_0x7f73('0x3d')]=_['intersection'](_0x565af0[_0x7f73('0x3e')],_0x565af0[_0x7f73('0x3c')]);_0x586d78[_0x7f73('0x3f')]=_[_0x7f73('0x40')](_0x565af0[_0x7f73('0x3e')],qs['fields'](_0x50a5ee[_0x7f73('0x3c')][_0x7f73('0x41')]));_0x586d78[_0x7f73('0x3f')]=_0x586d78[_0x7f73('0x3f')][_0x7f73('0x42')]?_0x586d78['attributes']:_0x565af0[_0x7f73('0x3e')];if(!_0x50a5ee[_0x7f73('0x3c')]['hasOwnProperty'](_0x7f73('0x43'))){_0x586d78[_0x7f73('0x2c')]=qs[_0x7f73('0x2c')](_0x50a5ee['query'][_0x7f73('0x2c')]);_0x586d78[_0x7f73('0x2a')]=qs[_0x7f73('0x2a')](_0x50a5ee[_0x7f73('0x3c')][_0x7f73('0x2a')]);}_0x586d78['order']=qs['sort'](_0x50a5ee[_0x7f73('0x3c')][_0x7f73('0x44')]);_0x586d78[_0x7f73('0x45')]=qs[_0x7f73('0x3d')](_[_0x7f73('0x46')](_0x50a5ee[_0x7f73('0x3c')],_0x565af0[_0x7f73('0x3d')]),_0x2f33cb);if(_0x50a5ee[_0x7f73('0x3c')][_0x7f73('0x47')]){_0x586d78['where']=_[_0x7f73('0x48')](_0x586d78[_0x7f73('0x45')],{'$or':_['map'](_0x2f33cb,function(_0x2a45a2){if(_0x2a45a2[_0x7f73('0x39')]!==_0x7f73('0x49')){var _0x3faa2e={};_0x3faa2e[_0x2a45a2[_0x7f73('0x34')]]={'$like':'%'+_0x50a5ee['query'][_0x7f73('0x47')]+'%'};return _0x3faa2e;}})});}_0x586d78=_[_0x7f73('0x48')]({},_0x586d78,_0x50a5ee['options']);var _0x4495b3={'where':_0x586d78[_0x7f73('0x45')]};return db[_0x7f73('0x37')][_0x7f73('0x2d')](_0x4495b3)[_0x7f73('0x1e')](function(_0x447015){_0x2400a1[_0x7f73('0x2d')]=_0x447015;if(_0x50a5ee[_0x7f73('0x3c')][_0x7f73('0x4a')]){_0x586d78['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x7f73('0x4b')](_0x586d78);})[_0x7f73('0x1e')](function(_0x37553c){_0x2400a1['rows']=_0x37553c;return _0x2400a1;})[_0x7f73('0x1e')](respondWithFilteredResult(_0x1b09e5,_0x586d78))[_0x7f73('0x26')](handleError(_0x1b09e5,null));};exports[_0x7f73('0x4c')]=function(_0x3e3bff,_0xd47823){var _0x4c8d18={'raw':!![],'where':{'id':_0x3e3bff[_0x7f73('0x4d')]['id']}},_0xf5cd91={};_0xf5cd91[_0x7f73('0x3e')]=_[_0x7f73('0x4e')](db[_0x7f73('0x37')][_0x7f73('0x38')]);_0xf5cd91[_0x7f73('0x3c')]=_['keys'](_0x3e3bff[_0x7f73('0x3c')]);_0xf5cd91[_0x7f73('0x3d')]=_[_0x7f73('0x40')](_0xf5cd91[_0x7f73('0x3e')],_0xf5cd91[_0x7f73('0x3c')]);_0x4c8d18[_0x7f73('0x3f')]=_[_0x7f73('0x40')](_0xf5cd91[_0x7f73('0x3e')],qs[_0x7f73('0x41')](_0x3e3bff[_0x7f73('0x3c')]['fields']));_0x4c8d18['attributes']=_0x4c8d18[_0x7f73('0x3f')]['length']?_0x4c8d18[_0x7f73('0x3f')]:_0xf5cd91[_0x7f73('0x3e')];if(_0x3e3bff['query'][_0x7f73('0x4a')]){_0x4c8d18[_0x7f73('0x4f')]=[{'all':!![]}];}_0x4c8d18=_['merge']({},_0x4c8d18,_0x3e3bff['options']);return db[_0x7f73('0x37')][_0x7f73('0x50')](_0x4c8d18)[_0x7f73('0x1e')](handleEntityNotFound(_0xd47823,null))['then'](respondWithResult(_0xd47823,null))[_0x7f73('0x26')](handleError(_0xd47823,null));};exports[_0x7f73('0x51')]=function(_0xef0b05,_0xad674e){return db[_0x7f73('0x37')]['create'](_0xef0b05[_0x7f73('0x52')],{})['then'](respondWithResult(_0xad674e,0xc9))['catch'](handleError(_0xad674e,null));};exports['update']=function(_0x27b8db,_0x6f3b72){if(_0x27b8db[_0x7f73('0x52')]['id']){delete _0x27b8db[_0x7f73('0x52')]['id'];}return db[_0x7f73('0x37')][_0x7f73('0x50')]({'where':{'id':_0x27b8db[_0x7f73('0x4d')]['id']}})[_0x7f73('0x1e')](handleEntityNotFound(_0x6f3b72,null))[_0x7f73('0x1e')](saveUpdates(_0x27b8db[_0x7f73('0x52')],null))[_0x7f73('0x1e')](respondWithResult(_0x6f3b72,null))[_0x7f73('0x26')](handleError(_0x6f3b72,null));};exports[_0x7f73('0x53')]=function(_0x2352d1,_0x33d367){return db[_0x7f73('0x37')][_0x7f73('0x50')]({'where':{'id':_0x2352d1[_0x7f73('0x4d')]['id']}})[_0x7f73('0x1e')](handleEntityNotFound(_0x33d367,null))[_0x7f73('0x1e')](removeEntity(_0x33d367,null))[_0x7f73('0x26')](handleError(_0x33d367,null));};exports[_0x7f73('0x54')]=function(_0x3e5283,_0x4b95cf){return db['WhatsappMessage'][_0x7f73('0x54')]()[_0x7f73('0x1e')](respondWithResult(_0x4b95cf,null))['catch'](handleError(_0x4b95cf,null));};var interaction_log=require('../../config/logger')(_0x7f73('0x55'));exports[_0x7f73('0x56')]=function(_0x1f7e0e,_0x2ffe56,_0x5c7088){var _0xdafb5d={'agent':{},'channel':_0x7f73('0x57')};if(_0x1f7e0e[_0x7f73('0x52')]['id']){delete _0x1f7e0e[_0x7f73('0x52')]['id'];}_0x1f7e0e[_0x7f73('0x52')]['read']=!![];_0x1f7e0e[_0x7f73('0x52')]['readAt']=moment()[_0x7f73('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f7e0e['body']['UserId']=_0x1f7e0e['body'][_0x7f73('0x59')]||_0x1f7e0e[_0x7f73('0x5a')]['id'];_0xdafb5d[_0x7f73('0x5b')]['id']=_0x1f7e0e[_0x7f73('0x52')][_0x7f73('0x59')];return db[_0x7f73('0x37')][_0x7f73('0x50')]({'where':{'id':_0x1f7e0e[_0x7f73('0x4d')]['id'],'UserId':null}})[_0x7f73('0x1e')](handleEntityNotFound(_0x2ffe56,null))[_0x7f73('0x1e')](saveUpdates(_0x1f7e0e['body'],null))['then'](function(_0x3d4163){if(_0x3d4163){_0xdafb5d['message']=_0x3d4163[_0x7f73('0x5c')]({'plain':!![]});return db[_0x7f73('0x5d')]['find']({'where':{'id':_0x3d4163[_0x7f73('0x5e')]}});}return null;})[_0x7f73('0x1e')](handleEntityNotFound(_0x2ffe56,null))[_0x7f73('0x1e')](function(_0x161e3a){if(_0x161e3a){return _0x161e3a[_0x7f73('0x31')]({'UserId':_0x1f7e0e[_0x7f73('0x52')]['UserId'],'read1stAt':_['isNil'](_0x161e3a[_0x7f73('0x5f')])?moment()['format'](_0x7f73('0x60')):undefined});}return null;})[_0x7f73('0x1e')](function(_0x32faf7){if(_0x32faf7){_0xdafb5d[_0x7f73('0x61')]=_0x32faf7[_0x7f73('0x5c')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f7e0e[_0x7f73('0x5a')]['id'],_0x1f7e0e['user']['name'],_0x1f7e0e[_0x7f73('0x5a')]['role'],_0xdafb5d[_0x7f73('0x61')]['id'],_0x1f7e0e[_0x7f73('0x52')]?JSON[_0x7f73('0x23')](_0x1f7e0e[_0x7f73('0x52')]):_0x7f73('0x62'));return respondWithRpcPromise(_0x7f73('0x63'),_0x7f73('0x64'),_0xdafb5d);}return null;})['then'](function(_0x1ac05b){var _0x2c2dd7=_0x7f73('0x65')+_0x1ac05b[_0x7f73('0x25')]['ContactId'];return db[_0x7f73('0x66')]['query'](_0x2c2dd7,{'type':db[_0x7f73('0x67')][_0x7f73('0x68')][_0x7f73('0x69')],'raw':!![]})[_0x7f73('0x1e')](function(_0x507ede){return _0x507ede;});})[_0x7f73('0x1e')](function(_0x4a4b62){if(_0x4a4b62){_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x6a')]=_0x4a4b62[0x0];if(!_0x1f7e0e[_0x7f73('0x52')]['UserId'])return;return db[_0x7f73('0x6b')][_0x7f73('0x50')]({'where':{'id':_0x1f7e0e[_0x7f73('0x52')]['UserId'],'role':'agent'},'attributes':['id',_0x7f73('0x34'),'fullname',_0x7f73('0x6c'),'internal'],'raw':!![]});}return null;})[_0x7f73('0x1e')](function(_0x324665){if(!_0x324665)return null;_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x5b')]=_0x324665;return _0xdafb5d;})[_0x7f73('0x1e')](function(_0x2e60a8){if(_0x2e60a8){if(_0x1f7e0e[_0x7f73('0x52')][_0x7f73('0x6d')]){_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x6e')]=util['format'](_0x7f73('0x6f'),_0x1f7e0e[_0x7f73('0x5a')][_0x7f73('0x34')]);_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x70')]=_0xdafb5d[_0x7f73('0x70')];_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x71')]=_0xdafb5d[_0x7f73('0x70')];_0xdafb5d[_0x7f73('0x25')][_0x7f73('0x72')]='accept';return respondWithRpcPromise(_0x7f73('0x73'),_0x7f73('0x73'),{'event':_0x7f73('0x74'),'message':_0xdafb5d[_0x7f73('0x25')]},client9002)['then'](function(){return _0xdafb5d;});}return _0xdafb5d;}return null;})[_0x7f73('0x1e')](respondWithResult(_0x2ffe56,null))[_0x7f73('0x26')](handleError(_0x2ffe56,null));};var interaction_log=require(_0x7f73('0x75'))(_0x7f73('0x55'));exports['reject']=function(_0x3a643f,_0xf21438,_0x71b2f){var _0x13e39f={'agent':{},'channel':_0x7f73('0x57')};if(_0x3a643f[_0x7f73('0x52')]['id']){delete _0x3a643f[_0x7f73('0x52')]['id'];}_0x3a643f[_0x7f73('0x52')]['UserId']=_0x3a643f[_0x7f73('0x52')]['UserId']||_0x3a643f['user']['id'];_0x13e39f['agent']['id']=_0x3a643f[_0x7f73('0x52')][_0x7f73('0x59')];return db[_0x7f73('0x37')][_0x7f73('0x50')]({'where':{'id':_0x3a643f[_0x7f73('0x4d')]['id'],'UserId':null}})[_0x7f73('0x1e')](handleEntityNotFound(_0xf21438,null))[_0x7f73('0x1e')](function(_0x46785f){if(_0x46785f){_0x13e39f[_0x7f73('0x25')]=_0x46785f[_0x7f73('0x5c')]({'plain':!![]});return db['WhatsappInteraction'][_0x7f73('0x50')]({'where':{'id':_0x46785f[_0x7f73('0x5e')]}});}return null;})[_0x7f73('0x1e')](handleEntityNotFound(_0xf21438,null))[_0x7f73('0x1e')](function(_0x9ea71){if(_0x9ea71){_0x13e39f['interaction']=_0x9ea71[_0x7f73('0x5c')]({'plain':!![]});interaction_log['info'](_0x7f73('0x76'),_0x3a643f['user']['id'],_0x3a643f[_0x7f73('0x5a')]['name'],_0x3a643f['user'][_0x7f73('0x77')],_0x13e39f['interaction']['id'],_0x3a643f[_0x7f73('0x52')]?JSON[_0x7f73('0x23')](_0x3a643f['body']):_0x7f73('0x62'));return respondWithRpcPromise(_0x7f73('0x78'),_0x7f73('0x79'),_0x13e39f);}return null;})[_0x7f73('0x1e')](function(_0x42d584){var _0x13c563=_0x7f73('0x65')+_0x42d584[_0x7f73('0x25')][_0x7f73('0x7a')];return db[_0x7f73('0x66')]['query'](_0x13c563,{'type':db['Sequelize'][_0x7f73('0x68')][_0x7f73('0x69')],'raw':!![]})[_0x7f73('0x1e')](function(_0x56ebbc){return _0x56ebbc;});})[_0x7f73('0x1e')](function(_0x3fc758){if(_0x3fc758){_0x13e39f[_0x7f73('0x25')]['contact']=_0x3fc758[0x0];if(!_0x3a643f['body'][_0x7f73('0x59')])return;return db['User'][_0x7f73('0x50')]({'where':{'id':_0x3a643f[_0x7f73('0x52')][_0x7f73('0x59')],'role':_0x7f73('0x5b')},'attributes':['id',_0x7f73('0x34'),_0x7f73('0x7b'),_0x7f73('0x6c'),_0x7f73('0x7c')],'raw':!![]});}return null;})[_0x7f73('0x1e')](function(_0x4541e9){if(!_0x4541e9)return null;_0x13e39f[_0x7f73('0x25')][_0x7f73('0x5b')]=_0x4541e9;return _0x13e39f;})[_0x7f73('0x1e')](function(_0x5442e7){if(_0x5442e7){_0x5442e7['message']['interface']=util['format']('SIP/%s',_0x3a643f[_0x7f73('0x5a')][_0x7f73('0x34')]);_0x5442e7['message']['channel']=_0x13e39f[_0x7f73('0x70')];_0x5442e7[_0x7f73('0x25')][_0x7f73('0x71')]=_0x13e39f[_0x7f73('0x70')];_0x5442e7[_0x7f73('0x25')]['event']=_0x7f73('0x30');respondWithRpcPromise(_0x7f73('0x73'),_0x7f73('0x73'),{'event':'rejectmessage','message':_0x5442e7[_0x7f73('0x25')]},client9002);return _0x13e39f;}return null;})[_0x7f73('0x1e')](respondWithResult(_0xf21438,null))[_0x7f73('0x26')](handleError(_0xf21438,null));};exports[_0x7f73('0x28')]=function(_0xbf2d70,_0x3fc6e6,_0x1a1d19){if(_0xbf2d70[_0x7f73('0x52')]['id']){delete _0xbf2d70[_0x7f73('0x52')]['id'];}var _0x3d0723;return db['WhatsappMessage'][_0x7f73('0x50')]({'where':{'id':_0xbf2d70[_0x7f73('0x4d')]['id']}})[_0x7f73('0x1e')](handleEntityNotFound(_0x3fc6e6,null))['then'](function(_0x2468d4){if(_0x2468d4){_0x3d0723=_0x2468d4;return db[_0x7f73('0x7d')][_0x7f73('0x50')]({'where':{'id':_0x2468d4[_0x7f73('0x7e')]}});}})['then'](handleEntityNotFound(_0x3fc6e6,null))[_0x7f73('0x1e')](function(_0x2f904f){if(_0x2f904f){logger[_0x7f73('0x7f')](_0x7f73('0x80'),_0x7f73('0x28'),_0x7f73('0x81'),_0x2f904f[_0x7f73('0x39')],util[_0x7f73('0x82')](_0xbf2d70[_0x7f73('0x52')],{'showHidden':![],'depth':null}));switch(_0x2f904f[_0x7f73('0x39')]){case _0x7f73('0x83'):if(_0xbf2d70[_0x7f73('0x52')]['MessageSid']&&_0xbf2d70[_0x7f73('0x52')][_0x7f73('0x84')]===_0x3d0723[_0x7f73('0x85')]&&_0xbf2d70[_0x7f73('0x52')]['MessageStatus']&&_0xbf2d70[_0x7f73('0x52')][_0x7f73('0x86')]===_0x7f73('0x87')){return _0x3d0723[_0x7f73('0x31')]({'read':!![]});}else{logger[_0x7f73('0x24')](_0x7f73('0x88'),_0x7f73('0x28'),_0x7f73('0x83'),util[_0x7f73('0x82')](_0xbf2d70[_0x7f73('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x3d0723;}})[_0x7f73('0x1e')](respondWithResult(_0x3fc6e6,null))[_0x7f73('0x26')](handleError(_0x3fc6e6,null));}; \ No newline at end of file +var _0x0792=['localhost','socket.io-emitter','jayson/promise','http','client','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','WhatsappMessage','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','../../config/logger','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','user','UserId','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','agent','manual','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','email','interface','SIP/%s','reject','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x0792,0x74));var _0x2079=function(_0x1c3375,_0x29cf53){_0x1c3375=_0x1c3375-0x0;var _0x179181=_0x0792[_0x1c3375];return _0x179181;};'use strict';var emlformat=require(_0x2079('0x0'));var rimraf=require(_0x2079('0x1'));var zipdir=require(_0x2079('0x2'));var jsonpatch=require(_0x2079('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2079('0x4'));var util=require(_0x2079('0x5'));var path=require(_0x2079('0x6'));var sox=require(_0x2079('0x7'));var csv=require(_0x2079('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2079('0x9'));var _=require('lodash');var squel=require(_0x2079('0xa'));var crypto=require(_0x2079('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2079('0xc'));var toCsv=require(_0x2079('0x8'));var querystring=require(_0x2079('0xd'));var Papa=require(_0x2079('0xe'));var Redis=require(_0x2079('0xf'));var authService=require(_0x2079('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2079('0x11'));var hardwareService=require(_0x2079('0x12'));var logger=require('../../config/logger')(_0x2079('0x13'));var utils=require(_0x2079('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2079('0x15'));var db=require(_0x2079('0x16'))['db'];config[_0x2079('0x17')]=_[_0x2079('0x18')](config[_0x2079('0x17')],{'host':_0x2079('0x19'),'port':0x18eb});var socket=require(_0x2079('0x1a'))(new Redis(config[_0x2079('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x2079('0x1b'));var client=jayson['client'][_0x2079('0x1c')]({'port':0x232c});var client9002=jayson[_0x2079('0x1d')][_0x2079('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x329db4,_0x31b4ea,_0x4b38a1,_0xa70f8c){return new BPromise(function(_0x472bce,_0x3714cc){var _0xd1a721=_0xa70f8c||client;return _0xd1a721['request'](_0x329db4,_0x4b38a1)[_0x2079('0x1e')](function(_0x71993){logger[_0x2079('0x1f')](_0x2079('0x20'),_0x31b4ea,_0x2079('0x21'));logger[_0x2079('0x22')](_0x2079('0x23'),_0x31b4ea,_0x2079('0x21'),JSON[_0x2079('0x24')](_0x71993));if(_0x71993[_0x2079('0x25')]){if(_0x71993[_0x2079('0x25')][_0x2079('0x26')]===0x1f4){logger['error'](_0x2079('0x20'),_0x31b4ea,_0x71993[_0x2079('0x25')][_0x2079('0x27')]);return _0x3714cc(_0x71993[_0x2079('0x25')][_0x2079('0x27')]);}logger[_0x2079('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x31b4ea,_0x71993[_0x2079('0x25')][_0x2079('0x27')]);return _0x472bce(_0x71993[_0x2079('0x25')][_0x2079('0x27')]);}else{logger[_0x2079('0x1f')]('WhatsappMessage,\x20%s,\x20%s',_0x31b4ea,_0x2079('0x21'));_0x472bce(_0x71993['result']['message']);}})['catch'](function(_0x2d7c47){logger[_0x2079('0x25')](_0x2079('0x20'),_0x31b4ea,_0x2d7c47);_0x3714cc(_0x2d7c47);});});}function respondWithStatusCode(_0x498190,_0x5705d0){_0x5705d0=_0x5705d0||0xcc;return function(_0x4fa561){if(_0x4fa561){return _0x498190[_0x2079('0x28')](_0x5705d0);}return _0x498190[_0x2079('0x29')](_0x5705d0)[_0x2079('0x2a')]();};}function respondWithResult(_0x5eeaa6,_0x306b9b){_0x306b9b=_0x306b9b||0xc8;return function(_0x2b77e1){if(_0x2b77e1){return _0x5eeaa6[_0x2079('0x29')](_0x306b9b)[_0x2079('0x2b')](_0x2b77e1);}};}function respondWithFilteredResult(_0x793004,_0x5ab48a){return function(_0x2e8301){if(_0x2e8301){var _0x1018c1=typeof _0x5ab48a[_0x2079('0x2c')]===_0x2079('0x2d')&&typeof _0x5ab48a[_0x2079('0x2e')]===_0x2079('0x2d');var _0x45fbde=_0x2e8301[_0x2079('0x2f')];var _0x5e1884=_0x1018c1?0x0:_0x5ab48a[_0x2079('0x2c')];var _0x5c5876=_0x1018c1?_0x2e8301[_0x2079('0x2f')]:_0x5ab48a[_0x2079('0x2c')]+_0x5ab48a[_0x2079('0x2e')];var _0x2e02a1;if(_0x5c5876>=_0x45fbde){_0x5c5876=_0x45fbde;_0x2e02a1=0xc8;}else{_0x2e02a1=0xce;}_0x793004[_0x2079('0x29')](_0x2e02a1);return _0x793004[_0x2079('0x30')](_0x2079('0x31'),_0x5e1884+'-'+_0x5c5876+'/'+_0x45fbde)[_0x2079('0x2b')](_0x2e8301);}return null;};}function patchUpdates(_0x55bdfa){return function(_0x358067){try{jsonpatch[_0x2079('0x32')](_0x358067,_0x55bdfa,!![]);}catch(_0x41a844){return BPromise['reject'](_0x41a844);}return _0x358067[_0x2079('0x33')]();};}function saveUpdates(_0x469af3,_0x5ba5de){return function(_0x2417d5){if(_0x2417d5){return _0x2417d5[_0x2079('0x34')](_0x469af3)[_0x2079('0x1e')](function(_0x57fea4){return _0x57fea4;});}return null;};}function removeEntity(_0xd10ec0,_0x5cc578){return function(_0x41a831){if(_0x41a831){return _0x41a831[_0x2079('0x35')]()[_0x2079('0x1e')](function(){_0xd10ec0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x278859,_0x15c34f){return function(_0x31d53c){if(!_0x31d53c){_0x278859[_0x2079('0x28')](0x194);}return _0x31d53c;};}function handleError(_0x50fc05,_0x4a48c0){_0x4a48c0=_0x4a48c0||0x1f4;return function(_0x23756f){logger[_0x2079('0x25')](_0x23756f[_0x2079('0x36')]);if(_0x23756f['name']){delete _0x23756f['name'];}_0x50fc05[_0x2079('0x29')](_0x4a48c0)[_0x2079('0x37')](_0x23756f);};}exports[_0x2079('0x38')]=function(_0x55c1a2,_0x129d44){var _0x358ccb={},_0x391225={},_0xbf7bcb={'count':0x0,'rows':[]};var _0x430023=_[_0x2079('0x39')](db['WhatsappMessage'][_0x2079('0x3a')],function(_0x57838b){return{'name':_0x57838b[_0x2079('0x3b')],'type':_0x57838b[_0x2079('0x3c')][_0x2079('0x3d')]};});_0x391225[_0x2079('0x3e')]=_[_0x2079('0x39')](_0x430023,_0x2079('0x3f'));_0x391225[_0x2079('0x40')]=_[_0x2079('0x41')](_0x55c1a2[_0x2079('0x40')]);_0x391225[_0x2079('0x42')]=_[_0x2079('0x43')](_0x391225['model'],_0x391225[_0x2079('0x40')]);_0x358ccb[_0x2079('0x44')]=_[_0x2079('0x43')](_0x391225[_0x2079('0x3e')],qs['fields'](_0x55c1a2[_0x2079('0x40')][_0x2079('0x45')]));_0x358ccb[_0x2079('0x44')]=_0x358ccb[_0x2079('0x44')]['length']?_0x358ccb[_0x2079('0x44')]:_0x391225[_0x2079('0x3e')];if(!_0x55c1a2[_0x2079('0x40')]['hasOwnProperty'](_0x2079('0x46'))){_0x358ccb[_0x2079('0x2e')]=qs[_0x2079('0x2e')](_0x55c1a2[_0x2079('0x40')][_0x2079('0x2e')]);_0x358ccb[_0x2079('0x2c')]=qs[_0x2079('0x2c')](_0x55c1a2[_0x2079('0x40')]['offset']);}_0x358ccb[_0x2079('0x47')]=qs[_0x2079('0x48')](_0x55c1a2['query'][_0x2079('0x48')]);_0x358ccb['where']=qs[_0x2079('0x42')](_[_0x2079('0x49')](_0x55c1a2['query'],_0x391225[_0x2079('0x42')]),_0x430023);if(_0x55c1a2[_0x2079('0x40')][_0x2079('0x4a')]){_0x358ccb[_0x2079('0x4b')]=_['merge'](_0x358ccb[_0x2079('0x4b')],{'$or':_[_0x2079('0x39')](_0x430023,function(_0xb7c65a){if(_0xb7c65a[_0x2079('0x3c')]!==_0x2079('0x4c')){var _0x845643={};_0x845643[_0xb7c65a[_0x2079('0x3f')]]={'$like':'%'+_0x55c1a2[_0x2079('0x40')]['filter']+'%'};return _0x845643;}})});}_0x358ccb=_[_0x2079('0x4d')]({},_0x358ccb,_0x55c1a2['options']);var _0x302ca3={'where':_0x358ccb[_0x2079('0x4b')]};return db[_0x2079('0x4e')]['count'](_0x302ca3)[_0x2079('0x1e')](function(_0x50cc77){_0xbf7bcb[_0x2079('0x2f')]=_0x50cc77;if(_0x55c1a2['query'][_0x2079('0x4f')]){_0x358ccb[_0x2079('0x50')]=[{'all':!![]}];}return db[_0x2079('0x4e')][_0x2079('0x51')](_0x358ccb);})[_0x2079('0x1e')](function(_0x23b1b6){_0xbf7bcb[_0x2079('0x52')]=_0x23b1b6;return _0xbf7bcb;})[_0x2079('0x1e')](respondWithFilteredResult(_0x129d44,_0x358ccb))[_0x2079('0x53')](handleError(_0x129d44,null));};exports['show']=function(_0x1f6b86,_0x368e50){var _0x2a1bdf={'raw':!![],'where':{'id':_0x1f6b86[_0x2079('0x54')]['id']}},_0x33d4c1={};_0x33d4c1[_0x2079('0x3e')]=_['keys'](db[_0x2079('0x4e')][_0x2079('0x3a')]);_0x33d4c1[_0x2079('0x40')]=_[_0x2079('0x41')](_0x1f6b86[_0x2079('0x40')]);_0x33d4c1[_0x2079('0x42')]=_['intersection'](_0x33d4c1[_0x2079('0x3e')],_0x33d4c1[_0x2079('0x40')]);_0x2a1bdf[_0x2079('0x44')]=_['intersection'](_0x33d4c1[_0x2079('0x3e')],qs[_0x2079('0x45')](_0x1f6b86[_0x2079('0x40')]['fields']));_0x2a1bdf[_0x2079('0x44')]=_0x2a1bdf[_0x2079('0x44')][_0x2079('0x55')]?_0x2a1bdf['attributes']:_0x33d4c1[_0x2079('0x3e')];if(_0x1f6b86[_0x2079('0x40')][_0x2079('0x4f')]){_0x2a1bdf[_0x2079('0x50')]=[{'all':!![]}];}_0x2a1bdf=_[_0x2079('0x4d')]({},_0x2a1bdf,_0x1f6b86['options']);return db[_0x2079('0x4e')][_0x2079('0x56')](_0x2a1bdf)[_0x2079('0x1e')](handleEntityNotFound(_0x368e50,null))[_0x2079('0x1e')](respondWithResult(_0x368e50,null))[_0x2079('0x53')](handleError(_0x368e50,null));};exports[_0x2079('0x57')]=function(_0x539bab,_0x21d721){return db[_0x2079('0x4e')]['create'](_0x539bab[_0x2079('0x58')],{})[_0x2079('0x1e')](respondWithResult(_0x21d721,0xc9))[_0x2079('0x53')](handleError(_0x21d721,null));};exports[_0x2079('0x34')]=function(_0x3dbb2d,_0x43ae5d){if(_0x3dbb2d[_0x2079('0x58')]['id']){delete _0x3dbb2d[_0x2079('0x58')]['id'];}return db[_0x2079('0x4e')][_0x2079('0x56')]({'where':{'id':_0x3dbb2d['params']['id']}})[_0x2079('0x1e')](handleEntityNotFound(_0x43ae5d,null))[_0x2079('0x1e')](saveUpdates(_0x3dbb2d[_0x2079('0x58')],null))['then'](respondWithResult(_0x43ae5d,null))[_0x2079('0x53')](handleError(_0x43ae5d,null));};exports[_0x2079('0x35')]=function(_0x569492,_0x5e2fde){return db['WhatsappMessage'][_0x2079('0x56')]({'where':{'id':_0x569492[_0x2079('0x54')]['id']}})[_0x2079('0x1e')](handleEntityNotFound(_0x5e2fde,null))[_0x2079('0x1e')](removeEntity(_0x5e2fde,null))[_0x2079('0x53')](handleError(_0x5e2fde,null));};exports[_0x2079('0x59')]=function(_0x1c2541,_0x911dcb){return db[_0x2079('0x4e')][_0x2079('0x59')]()[_0x2079('0x1e')](respondWithResult(_0x911dcb,null))['catch'](handleError(_0x911dcb,null));};var interaction_log=require(_0x2079('0x5a'))('whatsapp-interactions');exports['accept']=function(_0xf8d3e2,_0x26487f,_0x5ed98d){var _0xf4634c={'agent':{},'channel':_0x2079('0x5b')};if(_0xf8d3e2['body']['id']){delete _0xf8d3e2[_0x2079('0x58')]['id'];}_0xf8d3e2[_0x2079('0x58')][_0x2079('0x5c')]=!![];_0xf8d3e2[_0x2079('0x58')]['readAt']=moment()[_0x2079('0x5d')](_0x2079('0x5e'));_0xf8d3e2[_0x2079('0x58')]['UserId']=_0xf8d3e2['body']['UserId']||_0xf8d3e2[_0x2079('0x5f')]['id'];_0xf4634c['agent']['id']=_0xf8d3e2['body'][_0x2079('0x60')];return db['WhatsappMessage'][_0x2079('0x56')]({'where':{'id':_0xf8d3e2['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x26487f,null))['then'](saveUpdates(_0xf8d3e2[_0x2079('0x58')],null))[_0x2079('0x1e')](function(_0x12dad0){if(_0x12dad0){_0xf4634c[_0x2079('0x27')]=_0x12dad0[_0x2079('0x61')]({'plain':!![]});return db[_0x2079('0x62')][_0x2079('0x56')]({'where':{'id':_0x12dad0[_0x2079('0x63')]}});}return null;})[_0x2079('0x1e')](handleEntityNotFound(_0x26487f,null))[_0x2079('0x1e')](function(_0x35429f){if(_0x35429f){return _0x35429f[_0x2079('0x34')]({'UserId':_0xf8d3e2['body']['UserId'],'read1stAt':_['isNil'](_0x35429f[_0x2079('0x64')])?moment()['format'](_0x2079('0x5e')):undefined});}return null;})[_0x2079('0x1e')](function(_0x13c961){if(_0x13c961){_0xf4634c['interaction']=_0x13c961[_0x2079('0x61')]({'plain':!![]});interaction_log[_0x2079('0x1f')](_0x2079('0x65'),_0xf8d3e2['user']['id'],_0xf8d3e2[_0x2079('0x5f')][_0x2079('0x3f')],_0xf8d3e2[_0x2079('0x5f')][_0x2079('0x66')],_0xf4634c[_0x2079('0x67')]['id'],_0xf8d3e2['body']?JSON[_0x2079('0x24')](_0xf8d3e2[_0x2079('0x58')]):_0x2079('0x68'));return respondWithRpcPromise(_0x2079('0x69'),_0x2079('0x6a'),_0xf4634c);}return null;})[_0x2079('0x1e')](function(_0x4f7d9a){var _0x280f5b=_0x2079('0x6b')+_0x4f7d9a['message'][_0x2079('0x6c')];return db[_0x2079('0x6d')][_0x2079('0x40')](_0x280f5b,{'type':db[_0x2079('0x6e')][_0x2079('0x6f')][_0x2079('0x70')],'raw':!![]})[_0x2079('0x1e')](function(_0x5ba39b){return _0x5ba39b;});})[_0x2079('0x1e')](function(_0x5ecee9){if(_0x5ecee9){_0xf4634c['message'][_0x2079('0x71')]=_0x5ecee9[0x0];if(!_0xf8d3e2[_0x2079('0x58')][_0x2079('0x60')])return;return db[_0x2079('0x72')][_0x2079('0x56')]({'where':{'id':_0xf8d3e2['body'][_0x2079('0x60')],'role':'agent'},'attributes':['id',_0x2079('0x3f'),'fullname','email',_0x2079('0x73')],'raw':!![]});}return null;})[_0x2079('0x1e')](function(_0x4026d6){if(!_0x4026d6)return null;_0xf4634c['message'][_0x2079('0x74')]=_0x4026d6;return _0xf4634c;})[_0x2079('0x1e')](function(_0xf56311){if(_0xf56311){if(_0xf8d3e2['body'][_0x2079('0x75')]){_0xf4634c[_0x2079('0x27')]['interface']=util['format']('SIP/%s',_0xf8d3e2[_0x2079('0x5f')]['name']);_0xf4634c[_0x2079('0x27')][_0x2079('0x76')]=_0xf4634c[_0x2079('0x76')];_0xf4634c[_0x2079('0x27')]['motionChannel']=_0xf4634c[_0x2079('0x76')];_0xf4634c[_0x2079('0x27')][_0x2079('0x77')]=_0x2079('0x78');return respondWithRpcPromise(_0x2079('0x79'),'EventManager',{'event':_0x2079('0x7a'),'message':_0xf4634c[_0x2079('0x27')]},client9002)[_0x2079('0x1e')](function(){return _0xf4634c;});}return _0xf4634c;}return null;})[_0x2079('0x1e')](respondWithResult(_0x26487f,null))[_0x2079('0x53')](handleError(_0x26487f,null));};var interaction_log=require(_0x2079('0x5a'))(_0x2079('0x7b'));exports['reject']=function(_0x3933ca,_0x4febb1,_0x530c2f){var _0x46e6d7={'agent':{},'channel':_0x2079('0x5b')};if(_0x3933ca[_0x2079('0x58')]['id']){delete _0x3933ca['body']['id'];}_0x3933ca[_0x2079('0x58')][_0x2079('0x60')]=_0x3933ca['body']['UserId']||_0x3933ca[_0x2079('0x5f')]['id'];_0x46e6d7[_0x2079('0x74')]['id']=_0x3933ca[_0x2079('0x58')]['UserId'];return db[_0x2079('0x4e')]['find']({'where':{'id':_0x3933ca[_0x2079('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4febb1,null))[_0x2079('0x1e')](function(_0x2f3100){if(_0x2f3100){_0x46e6d7['message']=_0x2f3100[_0x2079('0x61')]({'plain':!![]});return db[_0x2079('0x62')][_0x2079('0x56')]({'where':{'id':_0x2f3100[_0x2079('0x63')]}});}return null;})[_0x2079('0x1e')](handleEntityNotFound(_0x4febb1,null))['then'](function(_0x644249){if(_0x644249){_0x46e6d7['interaction']=_0x644249[_0x2079('0x61')]({'plain':!![]});interaction_log[_0x2079('0x1f')](_0x2079('0x7c'),_0x3933ca['user']['id'],_0x3933ca[_0x2079('0x5f')][_0x2079('0x3f')],_0x3933ca[_0x2079('0x5f')][_0x2079('0x66')],_0x46e6d7['interaction']['id'],_0x3933ca[_0x2079('0x58')]?JSON[_0x2079('0x24')](_0x3933ca[_0x2079('0x58')]):_0x2079('0x68'));return respondWithRpcPromise(_0x2079('0x7d'),_0x2079('0x7e'),_0x46e6d7);}return null;})[_0x2079('0x1e')](function(_0x84f28d){var _0x407107=_0x2079('0x6b')+_0x84f28d[_0x2079('0x27')][_0x2079('0x6c')];return db['sequelize'][_0x2079('0x40')](_0x407107,{'type':db[_0x2079('0x6e')][_0x2079('0x6f')][_0x2079('0x70')],'raw':!![]})[_0x2079('0x1e')](function(_0x2c7468){return _0x2c7468;});})[_0x2079('0x1e')](function(_0x316da5){if(_0x316da5){_0x46e6d7['message'][_0x2079('0x71')]=_0x316da5[0x0];if(!_0x3933ca[_0x2079('0x58')][_0x2079('0x60')])return;return db['User'][_0x2079('0x56')]({'where':{'id':_0x3933ca[_0x2079('0x58')][_0x2079('0x60')],'role':_0x2079('0x74')},'attributes':['id',_0x2079('0x3f'),_0x2079('0x7f'),_0x2079('0x80'),_0x2079('0x73')],'raw':!![]});}return null;})[_0x2079('0x1e')](function(_0x5c14a0){if(!_0x5c14a0)return null;_0x46e6d7['message'][_0x2079('0x74')]=_0x5c14a0;return _0x46e6d7;})['then'](function(_0x2f5c9b){if(_0x2f5c9b){_0x2f5c9b[_0x2079('0x27')][_0x2079('0x81')]=util[_0x2079('0x5d')](_0x2079('0x82'),_0x3933ca['user'][_0x2079('0x3f')]);_0x2f5c9b[_0x2079('0x27')][_0x2079('0x76')]=_0x46e6d7[_0x2079('0x76')];_0x2f5c9b[_0x2079('0x27')]['motionChannel']=_0x46e6d7[_0x2079('0x76')];_0x2f5c9b['message']['event']=_0x2079('0x83');respondWithRpcPromise(_0x2079('0x79'),_0x2079('0x79'),{'event':'rejectmessage','message':_0x2f5c9b['message']},client9002);return _0x46e6d7;}return null;})[_0x2079('0x1e')](respondWithResult(_0x4febb1,null))['catch'](handleError(_0x4febb1,null));};exports[_0x2079('0x29')]=function(_0x196c07,_0x8b8f5c,_0x44c8c0){if(_0x196c07[_0x2079('0x58')]['id']){delete _0x196c07[_0x2079('0x58')]['id'];}var _0x32f0d3;return db[_0x2079('0x4e')]['find']({'where':{'id':_0x196c07[_0x2079('0x54')]['id']}})[_0x2079('0x1e')](handleEntityNotFound(_0x8b8f5c,null))[_0x2079('0x1e')](function(_0x2d923d){if(_0x2d923d){_0x32f0d3=_0x2d923d;return db[_0x2079('0x84')][_0x2079('0x56')]({'where':{'id':_0x2d923d[_0x2079('0x85')]}});}})[_0x2079('0x1e')](handleEntityNotFound(_0x8b8f5c,null))['then'](function(_0x43321a){if(_0x43321a){logger[_0x2079('0x22')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x2079('0x86'),_0x43321a['type'],util[_0x2079('0x87')](_0x196c07[_0x2079('0x58')],{'showHidden':![],'depth':null}));switch(_0x43321a[_0x2079('0x3c')]){case _0x2079('0x88'):if(_0x196c07['body'][_0x2079('0x89')]&&_0x196c07['body'][_0x2079('0x89')]===_0x32f0d3[_0x2079('0x8a')]&&_0x196c07[_0x2079('0x58')][_0x2079('0x8b')]&&_0x196c07[_0x2079('0x58')][_0x2079('0x8b')]===_0x2079('0x5c')){return _0x32f0d3[_0x2079('0x34')]({'read':!![]});}else{logger['error'](_0x2079('0x8c'),_0x2079('0x29'),_0x2079('0x88'),util[_0x2079('0x87')](_0x196c07['body'],{'showHidden':![],'depth':null}));}break;}return _0x32f0d3;}})[_0x2079('0x1e')](respondWithResult(_0x8b8f5c,null))[_0x2079('0x53')](handleError(_0x8b8f5c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 43435a9..a8bc0e0 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 _0xf4eb=['hook','events','update','emit','hasOwnProperty'];(function(_0x143e76,_0x48e958){var _0x52c0ac=function(_0x21b0a3){while(--_0x21b0a3){_0x143e76['push'](_0x143e76['shift']());}};_0x52c0ac(++_0x48e958);}(_0xf4eb,0xec));var _0xbf4e=function(_0xecdad6,_0x5e232f){_0xecdad6=_0xecdad6-0x0;var _0xd2a390=_0xf4eb[_0xecdad6];return _0xd2a390;};'use strict';var EventEmitter=require(_0xbf4e('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf4e('0x1'),'afterDestroy':'remove'};function emitEvent(_0x4e7fa7){return function(_0x2e3070,_0x1c7606,_0x32d1d7){WhatsappMessageEvents[_0xbf4e('0x2')](_0x4e7fa7+':'+_0x2e3070['id'],_0x2e3070);WhatsappMessageEvents[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070);_0x32d1d7(null);};}for(var e in events){if(events[_0xbf4e('0x3')](e)){var event=events[e];WhatsappMessage[_0xbf4e('0x4')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x765e=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x5d44cc,_0x2a6fbc){var _0xf1346e=function(_0x3ba106){while(--_0x3ba106){_0x5d44cc['push'](_0x5d44cc['shift']());}};_0xf1346e(++_0x2a6fbc);}(_0x765e,0x131));var _0xe765=function(_0x55ef97,_0x153c0d){_0x55ef97=_0x55ef97-0x0;var _0x9b4ed9=_0x765e[_0x55ef97];return _0x9b4ed9;};'use strict';var EventEmitter=require(_0xe765('0x0'));var WhatsappMessage=require(_0xe765('0x1'))['db'][_0xe765('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xe765('0x3')](0x0);var events={'afterCreate':_0xe765('0x4'),'afterUpdate':_0xe765('0x5'),'afterDestroy':_0xe765('0x6')};function emitEvent(_0x38d6d2){return function(_0x30703f,_0xd2e232,_0x9559d4){WhatsappMessageEvents[_0xe765('0x7')](_0x38d6d2+':'+_0x30703f['id'],_0x30703f);WhatsappMessageEvents[_0xe765('0x7')](_0x38d6d2,_0x30703f);_0x9559d4(null);};}for(var e in events){if(events[_0xe765('0x8')](e)){var event=events[e];WhatsappMessage[_0xe765('0x9')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index e41e8a8..8e8b33f 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 _0xebe7=['POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text'];(function(_0x49dff6,_0xbc89cf){var _0x333c98=function(_0x3c1865){while(--_0x3c1865){_0x49dff6['push'](_0x49dff6['shift']());}};_0x333c98(++_0xbc89cf);}(_0xebe7,0x165));var _0x7ebe=function(_0x534829,_0x58695a){_0x534829=_0x534829-0x0;var _0x531339=_0xebe7[_0x534829];return _0x531339;};'use strict';var _=require(_0x7ebe('0x0'));var util=require(_0x7ebe('0x1'));var logger=require(_0x7ebe('0x2'))('api');var moment=require(_0x7ebe('0x3'));var BPromise=require(_0x7ebe('0x4'));var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x7ebe('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7ebe('0x6'));module['exports']=function(_0xbd6236,_0x242475){return _0xbd6236['define'](_0x7ebe('0x7'),attributes,{'tableName':_0x7ebe('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7ebe('0x9')]},{'name':_0x7ebe('0xa'),'fields':[_0x7ebe('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46e234,_0x497142,_0x502dcc){var _0x12b07f=_0xbd6236[_0x7ebe('0xc')];var _0x5f2f0e=_0x46e234[_0x7ebe('0xd')]({'plain':!![]});if(_0x5f2f0e[_0x7ebe('0xe')][_0x7ebe('0xf')]()==='in'||_0x5f2f0e[_0x7ebe('0xe')][_0x7ebe('0xf')]()===_0x7ebe('0x10')&&!_0x5f2f0e[_0x7ebe('0x11')]&&!_[_0x7ebe('0x12')](_0x5f2f0e[_0x7ebe('0x13')])){_0x12b07f[_0x7ebe('0x14')][_0x7ebe('0x15')]({'where':{'id':_0x5f2f0e['WhatsappInteractionId']}})[_0x7ebe('0x16')](function(_0x3f24bd){if(_0x3f24bd){_0x3f24bd[_0x7ebe('0x17')]({'lastMsgAt':_0x5f2f0e[_0x7ebe('0x18')],'lastMsgDirection':_0x5f2f0e[_0x7ebe('0xe')][_0x7ebe('0xf')]()});}})[_0x7ebe('0x19')](function(_0x21660a){console[_0x7ebe('0x1a')](_0x21660a);});}if(_0x5f2f0e[_0x7ebe('0xe')]===_0x7ebe('0x10')&&!_0x5f2f0e[_0x7ebe('0x11')]){var _0x6b9977;_0x12b07f[_0x7ebe('0x1b')][_0x7ebe('0x1c')]({'where':{'id':_0x5f2f0e[_0x7ebe('0x1d')]},'raw':!![]})[_0x7ebe('0x16')](function(_0x4de664){_0x6b9977=_0x4de664;if(_0x6b9977&&_0x6b9977['type']){switch(_0x6b9977[_0x7ebe('0x1e')]){case _0x7ebe('0x1f'):var _0x4d5ef1=require('twilio');if(_0x6b9977[_0x7ebe('0x20')]&&_0x6b9977[_0x7ebe('0x21')]&&_0x6b9977['phone']){var _0x35e012=new _0x4d5ef1(_0x6b9977[_0x7ebe('0x20')],_0x6b9977['authToken']);_0x35e012[_0x7ebe('0x22')][_0x7ebe('0x23')]({'body':_0x5f2f0e[_0x7ebe('0xb')],'to':_0x7ebe('0x24')+_0x5f2f0e[_0x7ebe('0x25')],'from':'whatsapp:'+_0x6b9977[_0x7ebe('0x25')],'statusCallback':_0x6b9977[_0x7ebe('0x26')]+_0x7ebe('0x27')+_0x5f2f0e['id']+_0x7ebe('0x28')+_0x6b9977['token']})['then'](function(_0x18e566){if(_0x18e566[_0x7ebe('0x29')]){return _0x46e234[_0x7ebe('0x17')]({'messageId':_0x18e566['sid']});}})['catch'](function(_0x48e911){logger[_0x7ebe('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7ebe('0x2a'),_0x7ebe('0x1f'),util['inspect'](_0x48e911,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7ebe('0x2a'),'twilio',_0x7ebe('0x2b'));}break;case _0x7ebe('0x2c'):var _0x4aa17f=_0x6b9977[_0x7ebe('0x20')];var _0x3db968=_0x6b9977[_0x7ebe('0x21')];var _0x5aecf6=_0x6b9977[_0x7ebe('0x2d')]+_0x7ebe('0x2e')+_0x4aa17f+_0x7ebe('0x2f');var _0x560597={'to':[_0x5f2f0e[_0x7ebe('0x25')]],'message':{'type':_0x7ebe('0x30'),'text':_0x5f2f0e['body']}};var _0x5dae6b={'method':_0x7ebe('0x31'),'uri':_0x5aecf6,'headers':{'Authorization':_0x7ebe('0x32')+_0x3db968,'Content-Type':_0x7ebe('0x33')},'body':_0x560597,'json':!![]};rp(_0x5dae6b)[_0x7ebe('0x16')](function(_0x1270b7){if(_0x1270b7[_0x7ebe('0x34')][0x0][_0x7ebe('0x35')]){return _0x46e234[_0x7ebe('0x17')]({'messageId':_0x1270b7[_0x7ebe('0x34')][0x0]['message_id']});}})['catch'](function(_0x43c2a9){logger[_0x7ebe('0x36')](_0x7ebe('0x37'),_0x43c2a9);});break;}}})['finally'](function(){_0x502dcc();});}else{_0x502dcc();}}},'charset':_0x7ebe('0x38'),'collate':_0x7ebe('0x39')});}; \ No newline at end of file +var _0x7ad3=['update','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','authToken','baseUrl','/messages/','text','POST','Bearer\x20','message_id','statuses','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','phone','messages','create','body','whatsapp:','/api/whatsapp/messages/','sid'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7ad3,0x13e));var _0x37ad=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7ad3[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x37ad('0x0'));var util=require('util');var logger=require(_0x37ad('0x1'))(_0x37ad('0x2'));var moment=require(_0x37ad('0x3'));var BPromise=require(_0x37ad('0x4'));var rp=require(_0x37ad('0x5'));var fetch=require(_0x37ad('0x6'));var fs=require('fs');var path=require(_0x37ad('0x7'));var rimraf=require(_0x37ad('0x8'));var config=require(_0x37ad('0x9'));var attributes=require(_0x37ad('0xa'));module[_0x37ad('0xb')]=function(_0x5d7058,_0xe6953f){return _0x5d7058[_0x37ad('0xc')](_0x37ad('0xd'),attributes,{'tableName':_0x37ad('0xe'),'paranoid':![],'indexes':[{'name':_0x37ad('0xf'),'fields':[_0x37ad('0xf')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x37ad('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x864e54,_0x335a83,_0x1dfcc7){var _0x587096=_0x5d7058[_0x37ad('0x11')];var _0x20041d=_0x864e54['get']({'plain':!![]});if(_0x20041d['direction']['toLowerCase']()==='in'||_0x20041d[_0x37ad('0x12')][_0x37ad('0x13')]()===_0x37ad('0x14')&&!_0x20041d[_0x37ad('0x15')]&&!_[_0x37ad('0x16')](_0x20041d[_0x37ad('0x17')])){_0x587096['WhatsappInteraction'][_0x37ad('0x18')]({'where':{'id':_0x20041d[_0x37ad('0x19')]}})[_0x37ad('0x1a')](function(_0xcf4d23){if(_0xcf4d23){_0xcf4d23['update']({'lastMsgAt':_0x20041d[_0x37ad('0x1b')],'lastMsgDirection':_0x20041d[_0x37ad('0x12')][_0x37ad('0x13')]()});}})[_0x37ad('0x1c')](function(_0x38ccee){console[_0x37ad('0x1d')](_0x38ccee);});}if(_0x20041d[_0x37ad('0x12')]===_0x37ad('0x14')&&!_0x20041d[_0x37ad('0x15')]){var _0x35b03f;_0x587096[_0x37ad('0x1e')][_0x37ad('0x1f')]({'where':{'id':_0x20041d['WhatsappAccountId']},'raw':!![]})[_0x37ad('0x1a')](function(_0x47db43){_0x35b03f=_0x47db43;if(_0x35b03f&&_0x35b03f[_0x37ad('0x20')]){switch(_0x35b03f[_0x37ad('0x20')]){case _0x37ad('0x21'):var _0x421f48=require(_0x37ad('0x21'));if(_0x35b03f[_0x37ad('0x22')]&&_0x35b03f['authToken']&&_0x35b03f[_0x37ad('0x23')]){var _0x1b4211=new _0x421f48(_0x35b03f[_0x37ad('0x22')],_0x35b03f['authToken']);_0x1b4211[_0x37ad('0x24')][_0x37ad('0x25')]({'body':_0x20041d[_0x37ad('0x26')],'to':_0x37ad('0x27')+_0x20041d[_0x37ad('0x23')],'from':_0x37ad('0x27')+_0x35b03f['phone'],'statusCallback':_0x35b03f['remote']+_0x37ad('0x28')+_0x20041d['id']+'/status?token='+_0x35b03f['token']})[_0x37ad('0x1a')](function(_0x87cefa){if(_0x87cefa[_0x37ad('0x29')]){return _0x864e54[_0x37ad('0x2a')]({'messageId':_0x87cefa[_0x37ad('0x29')]});}})[_0x37ad('0x1c')](function(_0x176230){logger['error'](_0x37ad('0x2b'),'afterCreate',_0x37ad('0x21'),util[_0x37ad('0x2c')](_0x176230,{'showHidden':![],'depth':null}));});}else{logger[_0x37ad('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x37ad('0x2d'),_0x37ad('0x21'),_0x37ad('0x2e'));}break;case _0x37ad('0x2f'):var _0x4aef66=_0x35b03f['accountSid'];var _0x4a5176=_0x35b03f[_0x37ad('0x30')];var _0x29e6f2=_0x35b03f[_0x37ad('0x31')]+'/whatsapp/v1/'+_0x4aef66+_0x37ad('0x32');var _0xe944cb={'to':[_0x20041d['phone']],'message':{'type':_0x37ad('0x33'),'text':_0x20041d[_0x37ad('0x26')]}};var _0x27293a={'method':_0x37ad('0x34'),'uri':_0x29e6f2,'headers':{'Authorization':_0x37ad('0x35')+_0x4a5176,'Content-Type':'application/json'},'body':_0xe944cb,'json':!![]};rp(_0x27293a)[_0x37ad('0x1a')](function(_0x336621){if(_0x336621['statuses'][0x0][_0x37ad('0x36')]){return _0x864e54[_0x37ad('0x2a')]({'messageId':_0x336621[_0x37ad('0x37')][0x0][_0x37ad('0x36')]});}})['catch'](function(_0x37e12e){logger['err'](_0x37ad('0x38'),_0x37e12e);});break;}}})[_0x37ad('0x39')](function(){_0x1dfcc7();});}else{_0x1dfcc7();}}},'charset':_0x37ad('0x3a'),'collate':_0x37ad('0x3b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 2b1e336..5ba02cb 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 _0x6702=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6702,0x1eb));var _0x2670=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x6702[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x2670('0x0'));var util=require(_0x2670('0x1'));var moment=require('moment');var BPromise=require(_0x2670('0x2'));var rs=require(_0x2670('0x3'));var fs=require('fs');var Redis=require(_0x2670('0x4'));var db=require(_0x2670('0x5'))['db'];var utils=require(_0x2670('0x6'));var logger=require(_0x2670('0x7'))(_0x2670('0x8'));var config=require('../../config/environment');var jayson=require(_0x2670('0x9'));var client=jayson[_0x2670('0xa')][_0x2670('0xb')]({'port':0x232a});config[_0x2670('0xc')]=_[_0x2670('0xd')](config[_0x2670('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2670('0xc')]));require('./whatsappMessage.socket')[_0x2670('0xe')](socket);function respondWithRpcPromise(_0x3e0795,_0x5d2982,_0x1952e6){return new BPromise(function(_0x508e85,_0x575fad){return client[_0x2670('0xf')](_0x3e0795,_0x1952e6)[_0x2670('0x10')](function(_0x8c315c){logger[_0x2670('0x11')](_0x2670('0x12'),_0x5d2982,_0x2670('0x13'));logger[_0x2670('0x14')](_0x2670('0x15'),_0x5d2982,'request\x20sent',JSON[_0x2670('0x16')](_0x8c315c));if(_0x8c315c['error']){if(_0x8c315c['error']['code']===0x1f4){logger[_0x2670('0x17')](_0x2670('0x12'),_0x5d2982,_0x8c315c[_0x2670('0x17')][_0x2670('0x18')]);return _0x575fad(_0x8c315c[_0x2670('0x17')]['message']);}logger[_0x2670('0x17')](_0x2670('0x12'),_0x5d2982,_0x8c315c[_0x2670('0x17')][_0x2670('0x18')]);return _0x508e85(_0x8c315c['error'][_0x2670('0x18')]);}else{logger[_0x2670('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x5d2982,_0x2670('0x13'));_0x508e85(_0x8c315c['result'][_0x2670('0x18')]);}})[_0x2670('0x19')](function(_0x1f515d){logger[_0x2670('0x17')](_0x2670('0x12'),_0x5d2982,_0x1f515d);_0x575fad(_0x1f515d);});});}exports[_0x2670('0x1a')]=function(_0x44a193){var _0x3e55f1=this;return new Promise(function(_0xa63f13,_0x4a3f41){return db[_0x2670('0x1b')][_0x2670('0x1c')](_0x44a193[_0x2670('0x1d')],{'raw':_0x44a193[_0x2670('0x1e')]?_0x44a193[_0x2670('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x2670('0x10')](function(_0x3d6941){logger[_0x2670('0x11')](_0x2670('0x1a'),_0x44a193);logger[_0x2670('0x14')](_0x2670('0x1a'),_0x44a193,JSON[_0x2670('0x16')](_0x3d6941));_0xa63f13(_0x3d6941);})[_0x2670('0x19')](function(_0x5a7d52){logger[_0x2670('0x17')](_0x2670('0x1a'),_0x5a7d52[_0x2670('0x18')],_0x44a193);_0x4a3f41(_0x3e55f1[_0x2670('0x17')](0x1f4,_0x5a7d52[_0x2670('0x18')]));});});}; \ No newline at end of file +var _0x0a72=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','options','raw','CreateWhatsappMessage','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc'];(function(_0x29ddd4,_0x4a42e3){var _0x49627a=function(_0x350b3d){while(--_0x350b3d){_0x29ddd4['push'](_0x29ddd4['shift']());}};_0x49627a(++_0x4a42e3);}(_0x0a72,0x125));var _0x20a7=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x0a72[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x20a7('0x0'));var util=require(_0x20a7('0x1'));var moment=require(_0x20a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x20a7('0x3'));var fs=require('fs');var Redis=require(_0x20a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20a7('0x5'));var logger=require('../../config/logger')(_0x20a7('0x6'));var config=require('../../config/environment');var jayson=require(_0x20a7('0x7'));var client=jayson[_0x20a7('0x8')][_0x20a7('0x9')]({'port':0x232a});config[_0x20a7('0xa')]=_[_0x20a7('0xb')](config['redis'],{'host':_0x20a7('0xc'),'port':0x18eb});var socket=require(_0x20a7('0xd'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x20a7('0xe')](socket);function respondWithRpcPromise(_0x30f350,_0x2a4477,_0x3b9ae1){return new BPromise(function(_0x1fa818,_0x493ae0){return client[_0x20a7('0xf')](_0x30f350,_0x3b9ae1)[_0x20a7('0x10')](function(_0x343ee8){logger[_0x20a7('0x11')](_0x20a7('0x12'),_0x2a4477,_0x20a7('0x13'));logger['debug'](_0x20a7('0x14'),_0x2a4477,_0x20a7('0x13'),JSON[_0x20a7('0x15')](_0x343ee8));if(_0x343ee8[_0x20a7('0x16')]){if(_0x343ee8[_0x20a7('0x16')]['code']===0x1f4){logger[_0x20a7('0x16')](_0x20a7('0x12'),_0x2a4477,_0x343ee8['error'][_0x20a7('0x17')]);return _0x493ae0(_0x343ee8[_0x20a7('0x16')]['message']);}logger[_0x20a7('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x2a4477,_0x343ee8[_0x20a7('0x16')][_0x20a7('0x17')]);return _0x1fa818(_0x343ee8[_0x20a7('0x16')][_0x20a7('0x17')]);}else{logger[_0x20a7('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x2a4477,_0x20a7('0x13'));_0x1fa818(_0x343ee8[_0x20a7('0x18')][_0x20a7('0x17')]);}})[_0x20a7('0x19')](function(_0x23bddc){logger[_0x20a7('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x2a4477,_0x23bddc);_0x493ae0(_0x23bddc);});});}exports['CreateWhatsappMessage']=function(_0x3ba887){var _0x57b468=this;return new Promise(function(_0x4e31e9,_0x1d5cae){return db['WhatsappMessage'][_0x20a7('0x1a')](_0x3ba887['body'],{'raw':_0x3ba887[_0x20a7('0x1b')]?_0x3ba887[_0x20a7('0x1b')][_0x20a7('0x1c')]===undefined?!![]:![]:!![]})[_0x20a7('0x10')](function(_0x5740d9){logger[_0x20a7('0x11')]('CreateWhatsappMessage',_0x3ba887);logger['debug'](_0x20a7('0x1d'),_0x3ba887,JSON[_0x20a7('0x15')](_0x5740d9));_0x4e31e9(_0x5740d9);})[_0x20a7('0x19')](function(_0x1b46c0){logger[_0x20a7('0x16')]('CreateWhatsappMessage',_0x1b46c0['message'],_0x3ba887);_0x1d5cae(_0x57b468['error'](0x1f4,_0x1b46c0[_0x20a7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 61bd172..de8d6ac 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 _0x0608=['emit','register','length','whatsappMessage:','remove','update'];(function(_0x1fcd0a,_0x129511){var _0x33fa68=function(_0x3164a5){while(--_0x3164a5){_0x1fcd0a['push'](_0x1fcd0a['shift']());}};_0x33fa68(++_0x129511);}(_0x0608,0x8e));var _0x8060=function(_0xd9b681,_0x1a85ce){_0xd9b681=_0xd9b681-0x0;var _0x574d99=_0x0608[_0xd9b681];return _0x574d99;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x8060('0x0'),_0x8060('0x1')];function createListener(_0x434377,_0x204671){return function(_0x3ddd73){_0x204671[_0x8060('0x2')](_0x434377,_0x3ddd73);};}function removeListener(_0x314fac,_0x9e49d4){return function(){WhatsappMessageEvents['removeListener'](_0x314fac,_0x9e49d4);};}exports[_0x8060('0x3')]=function(_0xb4d78c){for(var _0x3b8714=0x0,_0xcb58e=events[_0x8060('0x4')];_0x3b8714<_0xcb58e;_0x3b8714++){var _0x43f6a1=events[_0x3b8714];var _0x54448d=createListener(_0x8060('0x5')+_0x43f6a1,_0xb4d78c);WhatsappMessageEvents['on'](_0x43f6a1,_0x54448d);}}; \ No newline at end of file +var _0x7e8a=['emit','register','length','./whatsappMessage.events','save','remove'];(function(_0x20da96,_0x46fed5){var _0x2cdc39=function(_0x495103){while(--_0x495103){_0x20da96['push'](_0x20da96['shift']());}};_0x2cdc39(++_0x46fed5);}(_0x7e8a,0x1b3));var _0xa7e8=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x7e8a[_0x24f31b];return _0x488401;};'use strict';var WhatsappMessageEvents=require(_0xa7e8('0x0'));var events=[_0xa7e8('0x1'),_0xa7e8('0x2'),'update'];function createListener(_0x315cf9,_0xa2fdaa){return function(_0x4333ff){_0xa2fdaa[_0xa7e8('0x3')](_0x315cf9,_0x4333ff);};}function removeListener(_0x448f63,_0x1635ab){return function(){WhatsappMessageEvents['removeListener'](_0x448f63,_0x1635ab);};}exports[_0xa7e8('0x4')]=function(_0xc1ee95){for(var _0x28e954=0x0,_0x17a876=events[_0xa7e8('0x5')];_0x28e954<_0x17a876;_0x28e954++){var _0x3032e8=events[_0x28e954];var _0x21d734=createListener('whatsappMessage:'+_0x3032e8,_0xc1ee95);WhatsappMessageEvents['on'](_0x3032e8,_0x21d734);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index a2242f2..ddc7250 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 _0x6aba=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6aba,0x188));var _0xa6ab=function(_0xdf99c5,_0x3ec8dd){_0xdf99c5=_0xdf99c5-0x0;var _0x4cf43a=_0x6aba[_0xdf99c5];return _0x4cf43a;};'use strict';var multer=require(_0xa6ab('0x0'));var util=require('util');var path=require(_0xa6ab('0x1'));var timeout=require(_0xa6ab('0x2'));var express=require(_0xa6ab('0x3'));var router=express[_0xa6ab('0x4')]();var fs_extra=require(_0xa6ab('0x5'));var auth=require(_0xa6ab('0x6'));var interaction=require(_0xa6ab('0x7'));var config=require(_0xa6ab('0x8'));var controller=require('./whatsappQueue.controller');router[_0xa6ab('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa6ab('0x9')](_0xa6ab('0xa'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0xc')]);router[_0xa6ab('0x9')](_0xa6ab('0xd'),auth[_0xa6ab('0xb')](),controller['show']);router[_0xa6ab('0x9')](_0xa6ab('0xe'),auth['isAuthenticated'](),controller[_0xa6ab('0xf')]);router[_0xa6ab('0x9')]('/:id/teams',auth[_0xa6ab('0xb')](),controller['getTeams']);router[_0xa6ab('0x9')](_0xa6ab('0x10'),auth[_0xa6ab('0xb')](),controller['getAgents']);router[_0xa6ab('0x11')]('/',auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x12')]);router[_0xa6ab('0x11')](_0xa6ab('0x13'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x14')]);router[_0xa6ab('0x11')](_0xa6ab('0x10'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x15')]);router[_0xa6ab('0x16')](_0xa6ab('0xd'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x17')]);router[_0xa6ab('0x18')](_0xa6ab('0xd'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x19')]);router['delete'](_0xa6ab('0x13'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x1a')]);router[_0xa6ab('0x18')](_0xa6ab('0x10'),auth[_0xa6ab('0xb')](),controller['removeAgents']);module[_0xa6ab('0x1b')]=router; \ No newline at end of file +var _0x9f10=['../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','get','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','put','update','destroy','delete','removeTeams','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9f10,0x72));var _0x09f1=function(_0xff55fc,_0xab4d88){_0xff55fc=_0xff55fc-0x0;var _0x157926=_0x9f10[_0xff55fc];return _0x157926;};'use strict';var multer=require('multer');var util=require(_0x09f1('0x0'));var path=require(_0x09f1('0x1'));var timeout=require(_0x09f1('0x2'));var express=require(_0x09f1('0x3'));var router=express['Router']();var fs_extra=require(_0x09f1('0x4'));var auth=require(_0x09f1('0x5'));var interaction=require(_0x09f1('0x6'));var config=require(_0x09f1('0x7'));var controller=require(_0x09f1('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x09f1('0x9')](),controller['describe']);router[_0x09f1('0xa')](_0x09f1('0xb'),auth[_0x09f1('0x9')](),controller[_0x09f1('0xc')]);router[_0x09f1('0xa')]('/:id/members',auth[_0x09f1('0x9')](),controller[_0x09f1('0xd')]);router[_0x09f1('0xa')](_0x09f1('0xe'),auth[_0x09f1('0x9')](),controller['getTeams']);router[_0x09f1('0xa')](_0x09f1('0xf'),auth['isAuthenticated'](),controller[_0x09f1('0x10')]);router['post']('/',auth[_0x09f1('0x9')](),controller['create']);router[_0x09f1('0x11')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x09f1('0x11')](_0x09f1('0xf'),auth[_0x09f1('0x9')](),controller['addAgents']);router[_0x09f1('0x12')](_0x09f1('0xb'),auth['isAuthenticated'](),controller[_0x09f1('0x13')]);router['delete'](_0x09f1('0xb'),auth[_0x09f1('0x9')](),controller[_0x09f1('0x14')]);router[_0x09f1('0x15')](_0x09f1('0xe'),auth[_0x09f1('0x9')](),controller[_0x09f1('0x16')]);router[_0x09f1('0x15')](_0x09f1('0xf'),auth[_0x09f1('0x9')](),controller['removeAgents']);module[_0x09f1('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 723bf5f..879c622 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 _0x3140=['sequelize','exports','STRING','name','rrmemory','beepall','roundrobin'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0x3140,0xaf));var _0x0314=function(_0x1f14a8,_0x11de2f){_0x1f14a8=_0x1f14a8-0x0;var _0x4f5581=_0x3140[_0x1f14a8];return _0x4f5581;};'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 +var _0x87f8=['rrmemory','roundrobin','STRING','name','INTEGER'];(function(_0x45982a,_0x1f2be4){var _0x59a372=function(_0x1f8ab2){while(--_0x1f8ab2){_0x45982a['push'](_0x45982a['shift']());}};_0x59a372(++_0x1f2be4);}(_0x87f8,0x152));var _0x887f=function(_0x19c249,_0x5f3cca){_0x19c249=_0x19c249-0x0;var _0x193b0e=_0x87f8[_0x19c249];return _0x193b0e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x887f('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x887f('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x887f('0x2'),'beepall',_0x887f('0x3'))},'description':{'type':Sequelize[_0x887f('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 8703b70..3699493 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 _0x8c31=['flatMap','sequelize','transaction','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','findOne','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','type','key','getOptions','where','include','query','findAll','rows','show','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','options','body','user','role','find','autoAssociation','create','catch','describe','getMembers','UserWhatsappQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','pick','filter','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface'];(function(_0x11cdd5,_0x3b8fbc){var _0x26cdf1=function(_0x2069bc){while(--_0x2069bc){_0x11cdd5['push'](_0x11cdd5['shift']());}};_0x26cdf1(++_0x3b8fbc);}(_0x8c31,0x98));var _0x18c3=function(_0x1dd378,_0x54081d){_0x1dd378=_0x1dd378-0x0;var _0x5a304e=_0x8c31[_0x1dd378];return _0x5a304e;};'use strict';var BPromise=require('bluebird');var util=require(_0x18c3('0x0'));var _=require('lodash');var squel=require(_0x18c3('0x1'));var Redis=require(_0x18c3('0x2'));var qs=require(_0x18c3('0x3'));var logger=require(_0x18c3('0x4'))(_0x18c3('0x5'));var config=require('../../config/environment');var db=require(_0x18c3('0x6'))['db'];config['redis']=_[_0x18c3('0x7')](config[_0x18c3('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x18c3('0x9'))(new Redis(config[_0x18c3('0x8')]));require(_0x18c3('0xa'))[_0x18c3('0xb')](socket);function respondWithStatusCode(_0x175161,_0x3af714){_0x3af714=_0x3af714||0xcc;return function(_0x1f2a66){if(_0x1f2a66){return _0x175161[_0x18c3('0xc')](_0x3af714);}return _0x175161['status'](_0x3af714)[_0x18c3('0xd')]();};}function respondWithResult(_0x4a210c,_0x9205be){_0x9205be=_0x9205be||0xc8;return function(_0x243cb7){if(_0x243cb7){return _0x4a210c['status'](_0x9205be)['json'](_0x243cb7);}};}function respondWithFilteredResult(_0x1491ac,_0x122916){return function(_0x39a8ce){if(_0x39a8ce){var _0x4cad1a=typeof _0x122916[_0x18c3('0xe')]===_0x18c3('0xf')&&typeof _0x122916[_0x18c3('0x10')]===_0x18c3('0xf');var _0x25e196=_0x39a8ce[_0x18c3('0x11')];var _0x5332f0=_0x4cad1a?0x0:_0x122916[_0x18c3('0xe')];var _0x37bb27=_0x4cad1a?_0x39a8ce[_0x18c3('0x11')]:_0x122916[_0x18c3('0xe')]+_0x122916[_0x18c3('0x10')];var _0x2a6ba9;if(_0x37bb27>=_0x25e196){_0x37bb27=_0x25e196;_0x2a6ba9=0xc8;}else{_0x2a6ba9=0xce;}_0x1491ac[_0x18c3('0x12')](_0x2a6ba9);return _0x1491ac[_0x18c3('0x13')](_0x18c3('0x14'),_0x5332f0+'-'+_0x37bb27+'/'+_0x25e196)[_0x18c3('0x15')](_0x39a8ce);}return null;};}function saveUpdates(_0xdc9953){return function(_0x27a2d3){if(_0x27a2d3){return _0x27a2d3[_0x18c3('0x16')](_0xdc9953)[_0x18c3('0x17')](function(_0x358894){return _0x358894;});}return null;};}function removeEntity(_0x2ca0b4){return function(_0x11edf9){if(_0x11edf9){return _0x11edf9[_0x18c3('0x18')]()['then'](function(){var _0x432553=_0x11edf9[_0x18c3('0x19')]({'plain':!![]});var _0xc6d2ed=_0x18c3('0x1a');return db[_0x18c3('0x1b')][_0x18c3('0x18')]({'where':{'type':_0xc6d2ed,'resourceId':_0x432553['id']}})['then'](function(){return _0x11edf9;});})['then'](function(){_0x2ca0b4[_0x18c3('0x12')](0xcc)[_0x18c3('0xd')]();});}};}function handleEntityNotFound(_0x31f6b1){return function(_0x1c5d20){if(!_0x1c5d20){_0x31f6b1[_0x18c3('0xc')](0x194);}return _0x1c5d20;};}function handleError(_0x5518b3,_0x5a3526){_0x5a3526=_0x5a3526||0x1f4;return function(_0x290a0f){logger[_0x18c3('0x1c')](_0x290a0f[_0x18c3('0x1d')]);if(_0x290a0f[_0x18c3('0x1e')]){delete _0x290a0f[_0x18c3('0x1e')];}_0x5518b3[_0x18c3('0x12')](_0x5a3526)[_0x18c3('0x1f')](_0x290a0f);};}exports[_0x18c3('0x20')]=function(_0xb0c303,_0x56d9dc){var _0x2d760d={};var _0x1ab1e9={'count':0x0,'rows':[]};var _0x1148f9=_[_0x18c3('0x21')](db[_0x18c3('0x22')]['rawAttributes'],function(_0x2d7dbf){return{'name':_0x2d7dbf['fieldName'],'type':_0x2d7dbf[_0x18c3('0x23')][_0x18c3('0x24')]};});_0x2d760d=qs[_0x18c3('0x25')](_0x1148f9,_0xb0c303);var _0x387f03={'where':_0x2d760d[_0x18c3('0x26')]};return db['WhatsappQueue'][_0x18c3('0x11')](_0x387f03)[_0x18c3('0x17')](function(_0x21fe48){_0x1ab1e9[_0x18c3('0x11')]=_0x21fe48;_0x2d760d[_0x18c3('0x27')]=qs[_0x18c3('0x27')](_0xb0c303[_0x18c3('0x28')]);return db['WhatsappQueue'][_0x18c3('0x29')](_0x2d760d);})[_0x18c3('0x17')](function(_0x11c56f){_0x1ab1e9[_0x18c3('0x2a')]=_0x11c56f;return _0x1ab1e9;})[_0x18c3('0x17')](respondWithFilteredResult(_0x56d9dc,_0x2d760d))['catch'](handleError(_0x56d9dc,null));};exports[_0x18c3('0x2b')]=function(_0x454335,_0x3693be){var _0x15fcb4={'raw':!![],'where':{'id':_0x454335[_0x18c3('0x2c')]['id']}},_0x317c9b={};_0x317c9b['model']=_[_0x18c3('0x2d')](db[_0x18c3('0x22')]['rawAttributes']);_0x317c9b[_0x18c3('0x28')]=_['keys'](_0x454335[_0x18c3('0x28')]);_0x317c9b[_0x18c3('0x2e')]=_[_0x18c3('0x2f')](_0x317c9b['model'],_0x317c9b[_0x18c3('0x28')]);_0x15fcb4[_0x18c3('0x30')]=_['intersection'](_0x317c9b[_0x18c3('0x31')],qs[_0x18c3('0x32')](_0x454335[_0x18c3('0x28')]['fields']));_0x15fcb4[_0x18c3('0x30')]=_0x15fcb4['attributes'][_0x18c3('0x33')]?_0x15fcb4['attributes']:_0x317c9b['model'];if(_0x454335[_0x18c3('0x28')][_0x18c3('0x34')]){_0x15fcb4[_0x18c3('0x27')]=[{'all':!![]}];}_0x15fcb4=_[_0x18c3('0x35')]({},_0x15fcb4,_0x454335[_0x18c3('0x36')]);return db['WhatsappQueue']['find'](_0x15fcb4)[_0x18c3('0x17')](handleEntityNotFound(_0x3693be,null))[_0x18c3('0x17')](respondWithResult(_0x3693be,null))['catch'](handleError(_0x3693be,null));};exports['create']=function(_0x4afc36,_0x3491e9){return db[_0x18c3('0x22')]['create'](_0x4afc36[_0x18c3('0x37')],{})[_0x18c3('0x17')](function(_0x21b4ff){var _0x455a70=_0x4afc36[_0x18c3('0x38')][_0x18c3('0x19')]({'plain':!![]});if(!_0x455a70)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x455a70[_0x18c3('0x39')]===_0x18c3('0x38')){var _0x143c54=_0x21b4ff[_0x18c3('0x19')]({'plain':!![]});var _0x4e4475=_0x18c3('0x1a');return db['UserProfileSection'][_0x18c3('0x3a')]({'where':{'name':_0x4e4475,'userProfileId':_0x455a70['userProfileId']},'raw':!![]})[_0x18c3('0x17')](function(_0x3bb880){if(_0x3bb880&&_0x3bb880[_0x18c3('0x3b')]===0x0){return db['UserProfileResource'][_0x18c3('0x3c')]({'name':_0x143c54[_0x18c3('0x1e')],'resourceId':_0x143c54['id'],'type':_0x3bb880[_0x18c3('0x1e')],'sectionId':_0x3bb880['id']},{})[_0x18c3('0x17')](function(){return _0x21b4ff;});}else{return _0x21b4ff;}})[_0x18c3('0x3d')](function(_0x4d38d2){logger[_0x18c3('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d38d2);throw _0x4d38d2;});}return _0x21b4ff;})['then'](respondWithResult(_0x3491e9,0xc9))[_0x18c3('0x3d')](handleError(_0x3491e9,null));};exports[_0x18c3('0x16')]=function(_0x52e4a8,_0x3e8681){if(_0x52e4a8[_0x18c3('0x37')]['id']){delete _0x52e4a8[_0x18c3('0x37')]['id'];}return db[_0x18c3('0x22')][_0x18c3('0x3a')]({'where':{'id':_0x52e4a8[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0x3e8681,null))[_0x18c3('0x17')](saveUpdates(_0x52e4a8[_0x18c3('0x37')],null))[_0x18c3('0x17')](respondWithResult(_0x3e8681,null))[_0x18c3('0x3d')](handleError(_0x3e8681,null));};exports[_0x18c3('0x18')]=function(_0x305f4e,_0x3a4dc2){return db['WhatsappQueue'][_0x18c3('0x3a')]({'where':{'id':_0x305f4e[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0x3a4dc2,null))[_0x18c3('0x17')](removeEntity(_0x3a4dc2,null))['catch'](handleError(_0x3a4dc2,null));};exports[_0x18c3('0x3e')]=function(_0x4cd84a,_0x5c71dc){return db[_0x18c3('0x22')]['describe']()[_0x18c3('0x17')](respondWithResult(_0x5c71dc,null))['catch'](handleError(_0x5c71dc,null));};exports[_0x18c3('0x3f')]=function(_0x5dde0b,_0x56a698){var _0xa4587a={'raw':!![],'where':{}},_0xb636d={},_0x5df696;return db[_0x18c3('0x22')]['findOne']({'where':{'id':_0x5dde0b[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0x56a698,null))[_0x18c3('0x17')](function(_0x476d75){if(_0x476d75){_0x5df696=_0x476d75['get']({'plain':!![]});_0xb636d['model']=_[_0x18c3('0x2d')](db[_0x18c3('0x40')][_0x18c3('0x41')]);_0xb636d[_0x18c3('0x28')]=_[_0x18c3('0x2d')](_0x5dde0b[_0x18c3('0x28')]);_0xb636d[_0x18c3('0x2e')]=_[_0x18c3('0x2f')](_0xb636d['model'],_0xb636d[_0x18c3('0x28')]);_0xa4587a[_0x18c3('0x30')]=_[_0x18c3('0x2f')](_0xb636d[_0x18c3('0x31')],qs[_0x18c3('0x32')](_0x5dde0b[_0x18c3('0x28')][_0x18c3('0x32')]));_0xa4587a[_0x18c3('0x30')]=_0xa4587a[_0x18c3('0x30')][_0x18c3('0x33')]?_0xa4587a[_0x18c3('0x30')]:_0xb636d['model'];if(!_0x5dde0b[_0x18c3('0x28')][_0x18c3('0x42')](_0x18c3('0x43'))){_0xa4587a[_0x18c3('0x10')]=qs[_0x18c3('0x10')](_0x5dde0b[_0x18c3('0x28')][_0x18c3('0x10')]);_0xa4587a[_0x18c3('0xe')]=qs[_0x18c3('0xe')](_0x5dde0b[_0x18c3('0x28')][_0x18c3('0xe')]);}_0xa4587a[_0x18c3('0x44')]=qs[_0x18c3('0x45')](_0x5dde0b[_0x18c3('0x28')][_0x18c3('0x45')]);_0xa4587a[_0x18c3('0x26')]=qs[_0x18c3('0x2e')](_[_0x18c3('0x46')](_0x5dde0b['query'],_0xb636d[_0x18c3('0x2e')]));_0xa4587a[_0x18c3('0x26')]['WhatsappQueueId']=_0x476d75['id'];if(_0x5dde0b[_0x18c3('0x28')][_0x18c3('0x47')]){_0xa4587a[_0x18c3('0x26')]=_['merge'](_0xa4587a[_0x18c3('0x26')],{'$or':_[_0x18c3('0x21')](_0xa4587a[_0x18c3('0x30')],function(_0x4b8ce1){var _0x3aaf75={};_0x3aaf75[_0x4b8ce1]={'$like':'%'+_0x5dde0b['query'][_0x18c3('0x47')]+'%'};return _0x3aaf75;})});}_0xa4587a=_[_0x18c3('0x35')]({},_0xa4587a,_0x5dde0b['options']);return db[_0x18c3('0x40')][_0x18c3('0x29')](_0xa4587a);}})[_0x18c3('0x17')](function(_0xda4817){if(_0xda4817){return db[_0x18c3('0x48')][_0x18c3('0x49')]({'where':{'id':_[_0x18c3('0x21')](_0xda4817,'UserId'),'role':_0x18c3('0x4a')},'attributes':['id',_0x18c3('0x1e'),_0x18c3('0x4b'),_0x18c3('0x4c'),_0x18c3('0x4d')]});}})[_0x18c3('0x17')](function(_0x52da59){if(_0x52da59){return{'count':_0x52da59[_0x18c3('0x11')],'rows':_['map'](_0x52da59[_0x18c3('0x2a')],function(_0x2856c7){return{'membername':_0x2856c7[_0x18c3('0x1e')],'UserId':_0x2856c7['id'],'queue_name':_0x5df696[_0x18c3('0x1e')],'WhatsappQueueId':_0x5df696['id'],'interface':util[_0x18c3('0x4e')]('%s/%s',_0x18c3('0x4f'),_0x2856c7['name']),'penalty':0x0,'paused':_0x2856c7[_0x18c3('0x4b')],'createdAt':_0x2856c7[_0x18c3('0x4d')],'updatedAt':_0x2856c7[_0x18c3('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x18c3('0x17')](respondWithFilteredResult(_0x56a698,_0xa4587a))[_0x18c3('0x3d')](handleError(_0x56a698,null));};exports[_0x18c3('0x50')]=function(_0x22621f,_0x37f47d){var _0x4a81e4={};var _0x4fa926={};var _0x2943f0;var _0x1da343;return db[_0x18c3('0x22')]['findOne']({'where':{'id':_0x22621f['params']['id']}})['then'](handleEntityNotFound(_0x37f47d,null))[_0x18c3('0x17')](function(_0x54fca4){if(_0x54fca4){_0x2943f0=_0x54fca4;_0x4fa926[_0x18c3('0x31')]=_['keys'](db[_0x18c3('0x51')][_0x18c3('0x41')]);_0x4fa926[_0x18c3('0x28')]=_[_0x18c3('0x2d')](_0x22621f['query']);_0x4fa926['filters']=_[_0x18c3('0x2f')](_0x4fa926[_0x18c3('0x31')],_0x4fa926['query']);_0x4a81e4[_0x18c3('0x30')]=_[_0x18c3('0x2f')](_0x4fa926[_0x18c3('0x31')],qs[_0x18c3('0x32')](_0x22621f['query'][_0x18c3('0x32')]));_0x4a81e4[_0x18c3('0x30')]=_0x4a81e4[_0x18c3('0x30')][_0x18c3('0x33')]?_0x4a81e4[_0x18c3('0x30')]:_0x4fa926[_0x18c3('0x31')];_0x4a81e4[_0x18c3('0x44')]=qs['sort'](_0x22621f[_0x18c3('0x28')][_0x18c3('0x45')]);_0x4a81e4['where']=qs[_0x18c3('0x2e')](_['pick'](_0x22621f['query'],_0x4fa926[_0x18c3('0x2e')]));if(_0x22621f['query'][_0x18c3('0x47')]){_0x4a81e4['where']=_[_0x18c3('0x35')](_0x4a81e4[_0x18c3('0x26')],{'$or':_[_0x18c3('0x21')](_0x4a81e4[_0x18c3('0x30')],function(_0x150764){var _0x18e050={};_0x18e050[_0x150764]={'$like':'%'+_0x22621f[_0x18c3('0x28')][_0x18c3('0x47')]+'%'};return _0x18e050;})});}_0x4a81e4=_[_0x18c3('0x35')]({},_0x4a81e4,_0x22621f[_0x18c3('0x36')]);return _0x2943f0[_0x18c3('0x50')](_0x4a81e4);}})[_0x18c3('0x17')](function(_0xf710d5){if(_0xf710d5){_0x1da343=_0xf710d5[_0x18c3('0x33')];if(!_0x22621f['query']['hasOwnProperty'](_0x18c3('0x43'))){_0x4a81e4[_0x18c3('0x10')]=qs[_0x18c3('0x10')](_0x22621f[_0x18c3('0x28')][_0x18c3('0x10')]);_0x4a81e4[_0x18c3('0xe')]=qs[_0x18c3('0xe')](_0x22621f[_0x18c3('0x28')][_0x18c3('0xe')]);}return _0x2943f0['getTeams'](_0x4a81e4);}})[_0x18c3('0x17')](function(_0x489568){if(_0x489568){return _0x489568?{'count':_0x1da343,'rows':_0x489568}:null;}})[_0x18c3('0x17')](respondWithResult(_0x37f47d,null))[_0x18c3('0x3d')](handleError(_0x37f47d,null));};exports[_0x18c3('0x52')]=function(_0x3beec6,_0x5b03a5){var _0x31bd99=_0x3beec6[_0x18c3('0x37')][_0x18c3('0x53')];return db[_0x18c3('0x51')][_0x18c3('0x29')]({'where':{'id':_0x31bd99},'attributes':['id'],'include':[{'model':db[_0x18c3('0x48')],'as':_0x18c3('0x54'),'attributes':['id',_0x18c3('0x1e'),_0x18c3('0x55'),_0x18c3('0x56'),_0x18c3('0x57')],'raw':!![]}]})[_0x18c3('0x17')](function(_0x59aff2){if(_0x59aff2){var _0x38fd2c=_[_0x18c3('0x58')](_0x59aff2,function(_0x1262d9){var _0x166d74=_0x1262d9[_0x18c3('0x19')]({'plain':!![]});return _0x166d74[_0x18c3('0x54')];});return db['WhatsappQueue'][_0x18c3('0x3a')]({'where':{'id':_0x3beec6[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](function(_0x456469){return db[_0x18c3('0x59')][_0x18c3('0x5a')](function(_0x415637){return _0x456469[_0x18c3('0x52')](_0x31bd99,{'transaction':_0x415637})[_0x18c3('0x17')](function(){return BPromise['each'](_0x38fd2c,function(_0x53ea19){return db[_0x18c3('0x40')][_0x18c3('0x5b')]({'where':{'UserId':_0x53ea19['id'],'WhatsappQueueId':_0x3beec6[_0x18c3('0x2c')]['id']},'transaction':_0x415637});});})[_0x18c3('0x17')](function(){_0x38fd2c[_0x18c3('0x5c')](function(_0x5dc01e){socket['emit'](_0x18c3('0x5d'),{'UserId':_0x5dc01e['id'],'WhatsappQueueId':_0x456469['id']});});});});});}})[_0x18c3('0x17')](respondWithStatusCode(_0x5b03a5,null))[_0x18c3('0x3d')](handleError(_0x5b03a5,null));};exports[_0x18c3('0x5e')]=function(_0x441e24,_0x5dd1da){return db[_0x18c3('0x51')][_0x18c3('0x29')]({'where':{'id':_0x441e24[_0x18c3('0x28')][_0x18c3('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x18c3('0x54'),'attributes':['id'],'raw':!![]}]})[_0x18c3('0x17')](handleEntityNotFound(_0x5dd1da,null))[_0x18c3('0x17')](function(_0x916e44){var _0x18a819=_[_0x18c3('0x21')](_0x916e44,'id');var _0x4a047c=[];var _0x590144=[];var _0x58a68b=squel[_0x18c3('0x5f')]();_0x58a68b[_0x18c3('0x60')](_0x18c3('0x61'))[_0x18c3('0x62')](_0x18c3('0x63'),'tq')['join'](_0x18c3('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x18c3('0x26')]('WhatsappQueueId\x20=\x20?',_0x441e24['params']['id']);for(var _0x4afc76=0x0;_0x4afc76<_0x916e44[_0x18c3('0x33')];_0x4afc76+=0x1){let _0x8c23c6=_0x916e44[_0x4afc76];for(var _0x359787=0x0;_0x359787<_0x8c23c6[_0x18c3('0x54')]['length'];_0x359787+=0x1){let _0x400d38=_0x8c23c6[_0x18c3('0x54')][_0x359787];var _0x3d93f2=_0x58a68b['clone']();_0x3d93f2[_0x18c3('0x26')](_0x18c3('0x65'),_0x400d38['id']);_0x590144[_0x18c3('0x66')](db[_0x18c3('0x59')]['query'](_0x3d93f2[_0x18c3('0x67')](),{'type':db[_0x18c3('0x59')][_0x18c3('0x68')]['SELECT']})[_0x18c3('0x17')](function(_0x16e5e0){if(_0x16e5e0[_0x18c3('0x33')]===0x1){return _0x400d38['id'];}else{var _0x25fa18=_['every'](_[_0x18c3('0x21')](_0x16e5e0,_0x18c3('0x69')),function(_0x43d48e){return _[_0x18c3('0x6a')](_0x18a819,_0x43d48e);});if(_0x25fa18){return _0x400d38['id'];}}}));}}return BPromise['all'](_0x590144)[_0x18c3('0x17')](function(_0x288898){_0x4a047c=_(_0x4a047c)[_0x18c3('0x6b')](_0x288898)[_0x18c3('0x6c')]()[_0x18c3('0x6d')]();return db['WhatsappQueue'][_0x18c3('0x3a')]({'where':{'id':_0x441e24[_0x18c3('0x2c')]['id']}})['then'](function(_0x21bc2d){return db[_0x18c3('0x59')][_0x18c3('0x5a')](function(_0x16f3c9){return _0x21bc2d[_0x18c3('0x5e')](_0x441e24[_0x18c3('0x28')][_0x18c3('0x53')],{'transaction':_0x16f3c9})[_0x18c3('0x17')](function(){if(!_[_0x18c3('0x6e')](_0x4a047c)){return _0x21bc2d[_0x18c3('0x6f')](_0x4a047c,{'transaction':_0x16f3c9});}})[_0x18c3('0x17')](function(){_0x4a047c['forEach'](function(_0x4b2934){socket['emit'](_0x18c3('0x70'),{'UserId':_0x4b2934,'WhatsappQueueId':_0x21bc2d['id']});});});});});});})[_0x18c3('0x17')](respondWithStatusCode(_0x5dd1da,null))[_0x18c3('0x3d')](handleError(_0x5dd1da,null));};exports[_0x18c3('0x71')]=function(_0x492932,_0xcc7f71){return db[_0x18c3('0x22')][_0x18c3('0x3a')]({'where':{'id':_0x492932[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0xcc7f71,null))[_0x18c3('0x17')](function(_0x549f76){if(_0x549f76){return _0x549f76[_0x18c3('0x71')](_0x492932[_0x18c3('0x37')][_0x18c3('0x53')],_[_0x18c3('0x72')](_0x492932[_0x18c3('0x37')],['ids','id'])||{})[_0x18c3('0x73')](function(_0x2368ed){for(var _0x1b9917=0x0;_0x1b9917<_0x492932[_0x18c3('0x37')][_0x18c3('0x53')][_0x18c3('0x33')];_0x1b9917+=0x1){socket[_0x18c3('0x74')]('userWhatsappQueue:save',{'UserId':Number(_0x492932[_0x18c3('0x37')][_0x18c3('0x53')][_0x1b9917]),'WhatsappQueueId':Number(_0x492932[_0x18c3('0x2c')]['id'])});}return _0x2368ed;});}})['then'](respondWithResult(_0xcc7f71,null))['catch'](handleError(_0xcc7f71,null));};exports[_0x18c3('0x6f')]=function(_0x4d32ad,_0x1af259){return db[_0x18c3('0x22')][_0x18c3('0x3a')]({'where':{'id':_0x4d32ad[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0x1af259,null))[_0x18c3('0x17')](function(_0x57ae38){if(_0x57ae38){return _0x57ae38[_0x18c3('0x6f')](_0x4d32ad[_0x18c3('0x28')][_0x18c3('0x53')])['then'](function(){if(_[_0x18c3('0x75')](_0x4d32ad[_0x18c3('0x28')][_0x18c3('0x53')])){for(var _0x299280=0x0;_0x299280<_0x4d32ad[_0x18c3('0x28')]['ids']['length'];_0x299280+=0x1){socket[_0x18c3('0x74')](_0x18c3('0x70'),{'UserId':Number(_0x4d32ad[_0x18c3('0x28')][_0x18c3('0x53')][_0x299280]),'WhatsappQueueId':Number(_0x4d32ad[_0x18c3('0x2c')]['id'])});}}else{socket[_0x18c3('0x74')](_0x18c3('0x70'),{'UserId':Number(_0x4d32ad['query'][_0x18c3('0x53')]),'WhatsappQueueId':Number(_0x4d32ad[_0x18c3('0x2c')]['id'])});}});}})[_0x18c3('0x17')](respondWithStatusCode(_0x1af259,null))[_0x18c3('0x3d')](handleError(_0x1af259,null));};exports[_0x18c3('0x76')]=function(_0x47ad91,_0x44bfc5){var _0xd99314={};var _0x431af8={};var _0x50c6b9;var _0x4e02de;return db[_0x18c3('0x22')][_0x18c3('0x77')]({'where':{'id':_0x47ad91[_0x18c3('0x2c')]['id']}})[_0x18c3('0x17')](handleEntityNotFound(_0x44bfc5,null))[_0x18c3('0x17')](function(_0x528219){if(_0x528219){_0x50c6b9=_0x528219;_0x431af8[_0x18c3('0x31')]=_['keys'](db[_0x18c3('0x48')][_0x18c3('0x41')]);_0x431af8[_0x18c3('0x28')]=_[_0x18c3('0x2d')](_0x47ad91[_0x18c3('0x28')]);_0x431af8[_0x18c3('0x2e')]=_[_0x18c3('0x2f')](_0x431af8[_0x18c3('0x31')],_0x431af8[_0x18c3('0x28')]);_0xd99314[_0x18c3('0x30')]=_[_0x18c3('0x2f')](_0x431af8[_0x18c3('0x31')],qs[_0x18c3('0x32')](_0x47ad91[_0x18c3('0x28')]['fields']));_0xd99314[_0x18c3('0x30')]=_0xd99314['attributes']['length']?_0xd99314['attributes']:_0x431af8[_0x18c3('0x31')];_0xd99314[_0x18c3('0x44')]=qs[_0x18c3('0x45')](_0x47ad91[_0x18c3('0x28')][_0x18c3('0x45')]);_0xd99314[_0x18c3('0x26')]=qs[_0x18c3('0x2e')](_[_0x18c3('0x46')](_0x47ad91['query'],_0x431af8[_0x18c3('0x2e')]));if(_0x47ad91[_0x18c3('0x28')]['filter']){_0xd99314[_0x18c3('0x26')]=_[_0x18c3('0x35')](_0xd99314[_0x18c3('0x26')],{'$or':_[_0x18c3('0x21')](_0xd99314[_0x18c3('0x30')],function(_0x15fb45){var _0x56bb94={};_0x56bb94[_0x15fb45]={'$like':'%'+_0x47ad91[_0x18c3('0x28')][_0x18c3('0x47')]+'%'};return _0x56bb94;})});}_0xd99314=_[_0x18c3('0x35')]({},_0xd99314,_0x47ad91[_0x18c3('0x36')]);return _0x50c6b9[_0x18c3('0x76')](_0xd99314);}})[_0x18c3('0x17')](function(_0x79e515){if(_0x79e515){_0x4e02de=_0x79e515[_0x18c3('0x33')];if(!_0x47ad91['query'][_0x18c3('0x42')]('nolimit')){_0xd99314[_0x18c3('0x10')]=qs['limit'](_0x47ad91[_0x18c3('0x28')][_0x18c3('0x10')]);_0xd99314['offset']=qs[_0x18c3('0xe')](_0x47ad91['query'][_0x18c3('0xe')]);}return _0x50c6b9['getAgents'](_0xd99314);}})['then'](function(_0x264ec5){if(_0x264ec5){return _0x264ec5?{'count':_0x4e02de,'rows':_0x264ec5}:null;}})[_0x18c3('0x17')](respondWithResult(_0x44bfc5,null))[_0x18c3('0x3d')](handleError(_0x44bfc5,null));}; \ No newline at end of file +var _0x0860=['UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','getOptions','where','include','query','WhatsappQueue','findAll','rows','show','params','model','keys','attributes','intersection','fields','length','includeAll','merge','options','find','user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserWhatsappQueue','filters','hasOwnProperty','sort','pick','filter','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','findOne','Team','order','getTeams','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','nolimit','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','destroy','then','get'];(function(_0x4ad6b2,_0x5158d3){var _0x4cc8ae=function(_0x47e001){while(--_0x47e001){_0x4ad6b2['push'](_0x4ad6b2['shift']());}};_0x4cc8ae(++_0x5158d3);}(_0x0860,0xda));var _0x0086=function(_0x24d3d4,_0x1f5294){_0x24d3d4=_0x24d3d4-0x0;var _0x24603f=_0x0860[_0x24d3d4];return _0x24603f;};'use strict';var BPromise=require('bluebird');var util=require(_0x0086('0x0'));var _=require(_0x0086('0x1'));var squel=require(_0x0086('0x2'));var Redis=require(_0x0086('0x3'));var qs=require(_0x0086('0x4'));var logger=require('../../config/logger')(_0x0086('0x5'));var config=require(_0x0086('0x6'));var db=require(_0x0086('0x7'))['db'];config[_0x0086('0x8')]=_[_0x0086('0x9')](config[_0x0086('0x8')],{'host':_0x0086('0xa'),'port':0x18eb});var socket=require(_0x0086('0xb'))(new Redis(config[_0x0086('0x8')]));require('./whatsappQueue.socket')[_0x0086('0xc')](socket);function respondWithStatusCode(_0x3b1cc7,_0x257979){_0x257979=_0x257979||0xcc;return function(_0x6150a7){if(_0x6150a7){return _0x3b1cc7[_0x0086('0xd')](_0x257979);}return _0x3b1cc7[_0x0086('0xe')](_0x257979)[_0x0086('0xf')]();};}function respondWithResult(_0xc55f41,_0x2f4a9a){_0x2f4a9a=_0x2f4a9a||0xc8;return function(_0x4b319a){if(_0x4b319a){return _0xc55f41[_0x0086('0xe')](_0x2f4a9a)[_0x0086('0x10')](_0x4b319a);}};}function respondWithFilteredResult(_0x1b9931,_0x1fcc34){return function(_0x1d48a5){if(_0x1d48a5){var _0x8ac967=typeof _0x1fcc34['offset']==='undefined'&&typeof _0x1fcc34[_0x0086('0x11')]===_0x0086('0x12');var _0x1d5cae=_0x1d48a5['count'];var _0x33520e=_0x8ac967?0x0:_0x1fcc34[_0x0086('0x13')];var _0xf2af7=_0x8ac967?_0x1d48a5[_0x0086('0x14')]:_0x1fcc34[_0x0086('0x13')]+_0x1fcc34[_0x0086('0x11')];var _0x2dad9f;if(_0xf2af7>=_0x1d5cae){_0xf2af7=_0x1d5cae;_0x2dad9f=0xc8;}else{_0x2dad9f=0xce;}_0x1b9931['status'](_0x2dad9f);return _0x1b9931[_0x0086('0x15')](_0x0086('0x16'),_0x33520e+'-'+_0xf2af7+'/'+_0x1d5cae)[_0x0086('0x10')](_0x1d48a5);}return null;};}function saveUpdates(_0x37ad1b){return function(_0x1b55de){if(_0x1b55de){return _0x1b55de['update'](_0x37ad1b)['then'](function(_0x2b2736){return _0x2b2736;});}return null;};}function removeEntity(_0x5b6bbd){return function(_0x58408f){if(_0x58408f){return _0x58408f[_0x0086('0x17')]()[_0x0086('0x18')](function(){var _0x3c9055=_0x58408f[_0x0086('0x19')]({'plain':!![]});var _0x39c774='WhatsappQueues';return db[_0x0086('0x1a')][_0x0086('0x17')]({'where':{'type':_0x39c774,'resourceId':_0x3c9055['id']}})[_0x0086('0x18')](function(){return _0x58408f;});})['then'](function(){_0x5b6bbd['status'](0xcc)[_0x0086('0xf')]();});}};}function handleEntityNotFound(_0x10d4aa){return function(_0x3d0541){if(!_0x3d0541){_0x10d4aa['sendStatus'](0x194);}return _0x3d0541;};}function handleError(_0x61cb84,_0x36cd09){_0x36cd09=_0x36cd09||0x1f4;return function(_0x30699b){logger[_0x0086('0x1b')](_0x30699b[_0x0086('0x1c')]);if(_0x30699b['name']){delete _0x30699b[_0x0086('0x1d')];}_0x61cb84[_0x0086('0xe')](_0x36cd09)[_0x0086('0x1e')](_0x30699b);};}exports[_0x0086('0x1f')]=function(_0x541cf8,_0x44953c){var _0xa49445={};var _0x1641d1={'count':0x0,'rows':[]};var _0x281b8c=_[_0x0086('0x20')](db['WhatsappQueue'][_0x0086('0x21')],function(_0x2203d0){return{'name':_0x2203d0[_0x0086('0x22')],'type':_0x2203d0['type']['key']};});_0xa49445=qs[_0x0086('0x23')](_0x281b8c,_0x541cf8);var _0x5b41ad={'where':_0xa49445[_0x0086('0x24')]};return db['WhatsappQueue'][_0x0086('0x14')](_0x5b41ad)[_0x0086('0x18')](function(_0x48b702){_0x1641d1[_0x0086('0x14')]=_0x48b702;_0xa49445[_0x0086('0x25')]=qs[_0x0086('0x25')](_0x541cf8[_0x0086('0x26')]);return db[_0x0086('0x27')][_0x0086('0x28')](_0xa49445);})['then'](function(_0x15d856){_0x1641d1[_0x0086('0x29')]=_0x15d856;return _0x1641d1;})['then'](respondWithFilteredResult(_0x44953c,_0xa49445))['catch'](handleError(_0x44953c,null));};exports[_0x0086('0x2a')]=function(_0x357fd0,_0x554b17){var _0x3a41d1={'raw':!![],'where':{'id':_0x357fd0[_0x0086('0x2b')]['id']}},_0x53e6e1={};_0x53e6e1[_0x0086('0x2c')]=_[_0x0086('0x2d')](db['WhatsappQueue']['rawAttributes']);_0x53e6e1[_0x0086('0x26')]=_[_0x0086('0x2d')](_0x357fd0[_0x0086('0x26')]);_0x53e6e1['filters']=_['intersection'](_0x53e6e1[_0x0086('0x2c')],_0x53e6e1[_0x0086('0x26')]);_0x3a41d1[_0x0086('0x2e')]=_[_0x0086('0x2f')](_0x53e6e1[_0x0086('0x2c')],qs['fields'](_0x357fd0[_0x0086('0x26')][_0x0086('0x30')]));_0x3a41d1[_0x0086('0x2e')]=_0x3a41d1[_0x0086('0x2e')][_0x0086('0x31')]?_0x3a41d1['attributes']:_0x53e6e1['model'];if(_0x357fd0[_0x0086('0x26')][_0x0086('0x32')]){_0x3a41d1[_0x0086('0x25')]=[{'all':!![]}];}_0x3a41d1=_[_0x0086('0x33')]({},_0x3a41d1,_0x357fd0[_0x0086('0x34')]);return db[_0x0086('0x27')][_0x0086('0x35')](_0x3a41d1)['then'](handleEntityNotFound(_0x554b17,null))['then'](respondWithResult(_0x554b17,null))['catch'](handleError(_0x554b17,null));};exports['create']=function(_0x18f9fb,_0x49fb4b){return db[_0x0086('0x27')]['create'](_0x18f9fb['body'],{})[_0x0086('0x18')](function(_0x484823){var _0x2dc019=_0x18f9fb[_0x0086('0x36')][_0x0086('0x19')]({'plain':!![]});if(!_0x2dc019)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2dc019[_0x0086('0x37')]==='user'){var _0x282bfa=_0x484823[_0x0086('0x19')]({'plain':!![]});var _0xe88248=_0x0086('0x38');return db[_0x0086('0x39')][_0x0086('0x35')]({'where':{'name':_0xe88248,'userProfileId':_0x2dc019[_0x0086('0x3a')]},'raw':!![]})['then'](function(_0x1c0d22){if(_0x1c0d22&&_0x1c0d22[_0x0086('0x3b')]===0x0){return db[_0x0086('0x1a')]['create']({'name':_0x282bfa['name'],'resourceId':_0x282bfa['id'],'type':_0x1c0d22[_0x0086('0x1d')],'sectionId':_0x1c0d22['id']},{})[_0x0086('0x18')](function(){return _0x484823;});}else{return _0x484823;}})[_0x0086('0x3c')](function(_0x1c8d4e){logger[_0x0086('0x1b')](_0x0086('0x3d'),_0x1c8d4e);throw _0x1c8d4e;});}return _0x484823;})['then'](respondWithResult(_0x49fb4b,0xc9))[_0x0086('0x3c')](handleError(_0x49fb4b,null));};exports[_0x0086('0x3e')]=function(_0xb11585,_0x29b83c){if(_0xb11585[_0x0086('0x3f')]['id']){delete _0xb11585[_0x0086('0x3f')]['id'];}return db[_0x0086('0x27')][_0x0086('0x35')]({'where':{'id':_0xb11585['params']['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x29b83c,null))[_0x0086('0x18')](saveUpdates(_0xb11585[_0x0086('0x3f')],null))[_0x0086('0x18')](respondWithResult(_0x29b83c,null))[_0x0086('0x3c')](handleError(_0x29b83c,null));};exports['destroy']=function(_0x22bf70,_0xacc716){return db[_0x0086('0x27')]['find']({'where':{'id':_0x22bf70[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](handleEntityNotFound(_0xacc716,null))[_0x0086('0x18')](removeEntity(_0xacc716,null))[_0x0086('0x3c')](handleError(_0xacc716,null));};exports['describe']=function(_0x57a92a,_0x3a467c){return db[_0x0086('0x27')][_0x0086('0x40')]()[_0x0086('0x18')](respondWithResult(_0x3a467c,null))[_0x0086('0x3c')](handleError(_0x3a467c,null));};exports[_0x0086('0x41')]=function(_0x543863,_0x5726b6){var _0x59d9bb={'raw':!![],'where':{}},_0x5105e3={},_0x431a8b;return db[_0x0086('0x27')]['findOne']({'where':{'id':_0x543863[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x5726b6,null))[_0x0086('0x18')](function(_0x114458){if(_0x114458){_0x431a8b=_0x114458[_0x0086('0x19')]({'plain':!![]});_0x5105e3['model']=_[_0x0086('0x2d')](db[_0x0086('0x42')][_0x0086('0x21')]);_0x5105e3[_0x0086('0x26')]=_['keys'](_0x543863[_0x0086('0x26')]);_0x5105e3[_0x0086('0x43')]=_[_0x0086('0x2f')](_0x5105e3[_0x0086('0x2c')],_0x5105e3['query']);_0x59d9bb[_0x0086('0x2e')]=_[_0x0086('0x2f')](_0x5105e3[_0x0086('0x2c')],qs[_0x0086('0x30')](_0x543863[_0x0086('0x26')][_0x0086('0x30')]));_0x59d9bb['attributes']=_0x59d9bb['attributes'][_0x0086('0x31')]?_0x59d9bb[_0x0086('0x2e')]:_0x5105e3[_0x0086('0x2c')];if(!_0x543863[_0x0086('0x26')][_0x0086('0x44')]('nolimit')){_0x59d9bb['limit']=qs[_0x0086('0x11')](_0x543863[_0x0086('0x26')]['limit']);_0x59d9bb[_0x0086('0x13')]=qs[_0x0086('0x13')](_0x543863[_0x0086('0x26')]['offset']);}_0x59d9bb['order']=qs[_0x0086('0x45')](_0x543863[_0x0086('0x26')][_0x0086('0x45')]);_0x59d9bb['where']=qs['filters'](_[_0x0086('0x46')](_0x543863[_0x0086('0x26')],_0x5105e3[_0x0086('0x43')]));_0x59d9bb[_0x0086('0x24')]['WhatsappQueueId']=_0x114458['id'];if(_0x543863[_0x0086('0x26')][_0x0086('0x47')]){_0x59d9bb[_0x0086('0x24')]=_[_0x0086('0x33')](_0x59d9bb[_0x0086('0x24')],{'$or':_[_0x0086('0x20')](_0x59d9bb[_0x0086('0x2e')],function(_0x14c19a){var _0x49e2ad={};_0x49e2ad[_0x14c19a]={'$like':'%'+_0x543863[_0x0086('0x26')][_0x0086('0x47')]+'%'};return _0x49e2ad;})});}_0x59d9bb=_[_0x0086('0x33')]({},_0x59d9bb,_0x543863[_0x0086('0x34')]);return db['UserWhatsappQueue'][_0x0086('0x28')](_0x59d9bb);}})['then'](function(_0x10826c){if(_0x10826c){return db['User'][_0x0086('0x48')]({'where':{'id':_[_0x0086('0x20')](_0x10826c,_0x0086('0x49')),'role':_0x0086('0x4a')},'attributes':['id',_0x0086('0x1d'),_0x0086('0x4b'),_0x0086('0x4c'),_0x0086('0x4d')]});}})[_0x0086('0x18')](function(_0x254720){if(_0x254720){return{'count':_0x254720['count'],'rows':_['map'](_0x254720['rows'],function(_0x44ee88){return{'membername':_0x44ee88[_0x0086('0x1d')],'UserId':_0x44ee88['id'],'queue_name':_0x431a8b[_0x0086('0x1d')],'WhatsappQueueId':_0x431a8b['id'],'interface':util['format']('%s/%s','SIP',_0x44ee88['name']),'penalty':0x0,'paused':_0x44ee88[_0x0086('0x4b')],'createdAt':_0x44ee88[_0x0086('0x4d')],'updatedAt':_0x44ee88[_0x0086('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0086('0x18')](respondWithFilteredResult(_0x5726b6,_0x59d9bb))[_0x0086('0x3c')](handleError(_0x5726b6,null));};exports['getTeams']=function(_0x2fc28b,_0x13f175){var _0x40fcc1={};var _0x577fe9={};var _0x4ccb55;var _0x2d25e6;return db['WhatsappQueue'][_0x0086('0x4e')]({'where':{'id':_0x2fc28b[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x13f175,null))['then'](function(_0x43b1d9){if(_0x43b1d9){_0x4ccb55=_0x43b1d9;_0x577fe9[_0x0086('0x2c')]=_[_0x0086('0x2d')](db[_0x0086('0x4f')][_0x0086('0x21')]);_0x577fe9[_0x0086('0x26')]=_[_0x0086('0x2d')](_0x2fc28b['query']);_0x577fe9[_0x0086('0x43')]=_[_0x0086('0x2f')](_0x577fe9['model'],_0x577fe9[_0x0086('0x26')]);_0x40fcc1[_0x0086('0x2e')]=_[_0x0086('0x2f')](_0x577fe9[_0x0086('0x2c')],qs[_0x0086('0x30')](_0x2fc28b[_0x0086('0x26')][_0x0086('0x30')]));_0x40fcc1['attributes']=_0x40fcc1[_0x0086('0x2e')]['length']?_0x40fcc1['attributes']:_0x577fe9['model'];_0x40fcc1[_0x0086('0x50')]=qs[_0x0086('0x45')](_0x2fc28b[_0x0086('0x26')]['sort']);_0x40fcc1[_0x0086('0x24')]=qs[_0x0086('0x43')](_[_0x0086('0x46')](_0x2fc28b['query'],_0x577fe9['filters']));if(_0x2fc28b['query'][_0x0086('0x47')]){_0x40fcc1[_0x0086('0x24')]=_[_0x0086('0x33')](_0x40fcc1[_0x0086('0x24')],{'$or':_[_0x0086('0x20')](_0x40fcc1[_0x0086('0x2e')],function(_0x43ac1b){var _0x4b9f63={};_0x4b9f63[_0x43ac1b]={'$like':'%'+_0x2fc28b[_0x0086('0x26')][_0x0086('0x47')]+'%'};return _0x4b9f63;})});}_0x40fcc1=_['merge']({},_0x40fcc1,_0x2fc28b[_0x0086('0x34')]);return _0x4ccb55['getTeams'](_0x40fcc1);}})[_0x0086('0x18')](function(_0x6a2f42){if(_0x6a2f42){_0x2d25e6=_0x6a2f42[_0x0086('0x31')];if(!_0x2fc28b[_0x0086('0x26')]['hasOwnProperty']('nolimit')){_0x40fcc1[_0x0086('0x11')]=qs['limit'](_0x2fc28b['query'][_0x0086('0x11')]);_0x40fcc1[_0x0086('0x13')]=qs['offset'](_0x2fc28b[_0x0086('0x26')][_0x0086('0x13')]);}return _0x4ccb55[_0x0086('0x51')](_0x40fcc1);}})[_0x0086('0x18')](function(_0x1ed771){if(_0x1ed771){return _0x1ed771?{'count':_0x2d25e6,'rows':_0x1ed771}:null;}})[_0x0086('0x18')](respondWithResult(_0x13f175,null))[_0x0086('0x3c')](handleError(_0x13f175,null));};exports[_0x0086('0x52')]=function(_0x53742b,_0x53f29f){var _0x16e7cf=_0x53742b[_0x0086('0x3f')][_0x0086('0x53')];return db['Team'][_0x0086('0x28')]({'where':{'id':_0x16e7cf},'attributes':['id'],'include':[{'model':db[_0x0086('0x54')],'as':'Agents','attributes':['id',_0x0086('0x1d'),_0x0086('0x55'),_0x0086('0x56'),_0x0086('0x57')],'raw':!![]}]})['then'](function(_0x193e02){if(_0x193e02){var _0x1cfc90=_[_0x0086('0x58')](_0x193e02,function(_0x58edfa){var _0x2554e7=_0x58edfa['get']({'plain':!![]});return _0x2554e7[_0x0086('0x59')];});return db['WhatsappQueue'][_0x0086('0x35')]({'where':{'id':_0x53742b[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](function(_0x2b33cb){return db[_0x0086('0x5a')][_0x0086('0x5b')](function(_0x4efd9b){return _0x2b33cb[_0x0086('0x52')](_0x16e7cf,{'transaction':_0x4efd9b})[_0x0086('0x18')](function(){return BPromise[_0x0086('0x5c')](_0x1cfc90,function(_0x43df93){return db[_0x0086('0x42')]['findOrCreate']({'where':{'UserId':_0x43df93['id'],'WhatsappQueueId':_0x53742b[_0x0086('0x2b')]['id']},'transaction':_0x4efd9b});});})['then'](function(){_0x1cfc90[_0x0086('0x5d')](function(_0x469269){socket['emit'](_0x0086('0x5e'),{'UserId':_0x469269['id'],'WhatsappQueueId':_0x2b33cb['id']});});});});});}})['then'](respondWithStatusCode(_0x53f29f,null))[_0x0086('0x3c')](handleError(_0x53f29f,null));};exports[_0x0086('0x5f')]=function(_0x255972,_0x30d303){return db[_0x0086('0x4f')][_0x0086('0x28')]({'where':{'id':_0x255972['query'][_0x0086('0x53')]},'attributes':['id'],'include':[{'model':db[_0x0086('0x54')],'as':_0x0086('0x59'),'attributes':['id'],'raw':!![]}]})[_0x0086('0x18')](handleEntityNotFound(_0x30d303,null))[_0x0086('0x18')](function(_0x55a96a){var _0x320619=_[_0x0086('0x20')](_0x55a96a,'id');var _0x5852be=[];var _0x127a31=[];var _0x5416d4=squel[_0x0086('0x60')]();_0x5416d4[_0x0086('0x61')]('tq.TeamId')[_0x0086('0x62')](_0x0086('0x63'),'tq')['join'](_0x0086('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x0086('0x65'),_0x255972[_0x0086('0x2b')]['id']);for(var _0x1783da=0x0;_0x1783da<_0x55a96a[_0x0086('0x31')];_0x1783da+=0x1){let _0x34a2bf=_0x55a96a[_0x1783da];for(var _0x42ee39=0x0;_0x42ee39<_0x34a2bf[_0x0086('0x59')]['length'];_0x42ee39+=0x1){let _0x562445=_0x34a2bf[_0x0086('0x59')][_0x42ee39];var _0x56dc1e=_0x5416d4['clone']();_0x56dc1e['where'](_0x0086('0x66'),_0x562445['id']);_0x127a31[_0x0086('0x67')](db['sequelize'][_0x0086('0x26')](_0x56dc1e[_0x0086('0x68')](),{'type':db[_0x0086('0x5a')][_0x0086('0x69')]['SELECT']})[_0x0086('0x18')](function(_0x54b32d){if(_0x54b32d[_0x0086('0x31')]===0x1){return _0x562445['id'];}else{var _0x4f4ea1=_[_0x0086('0x6a')](_[_0x0086('0x20')](_0x54b32d,_0x0086('0x6b')),function(_0x535764){return _[_0x0086('0x6c')](_0x320619,_0x535764);});if(_0x4f4ea1){return _0x562445['id'];}}}));}}return BPromise[_0x0086('0x6d')](_0x127a31)[_0x0086('0x18')](function(_0x34d33a){_0x5852be=_(_0x5852be)['union'](_0x34d33a)[_0x0086('0x6e')]()[_0x0086('0x6f')]();return db[_0x0086('0x27')]['find']({'where':{'id':_0x255972['params']['id']}})[_0x0086('0x18')](function(_0x1411e3){return db[_0x0086('0x5a')]['transaction'](function(_0x3cea2b){return _0x1411e3[_0x0086('0x5f')](_0x255972['query']['ids'],{'transaction':_0x3cea2b})[_0x0086('0x18')](function(){if(!_[_0x0086('0x70')](_0x5852be)){return _0x1411e3[_0x0086('0x71')](_0x5852be,{'transaction':_0x3cea2b});}})['then'](function(){_0x5852be[_0x0086('0x5d')](function(_0x26ec02){socket[_0x0086('0x72')](_0x0086('0x73'),{'UserId':_0x26ec02,'WhatsappQueueId':_0x1411e3['id']});});});});});});})['then'](respondWithStatusCode(_0x30d303,null))[_0x0086('0x3c')](handleError(_0x30d303,null));};exports['addAgents']=function(_0x540db9,_0x4dba56){return db[_0x0086('0x27')][_0x0086('0x35')]({'where':{'id':_0x540db9[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x4dba56,null))[_0x0086('0x18')](function(_0x16c853){if(_0x16c853){return _0x16c853[_0x0086('0x74')](_0x540db9[_0x0086('0x3f')][_0x0086('0x53')],_[_0x0086('0x75')](_0x540db9[_0x0086('0x3f')],['ids','id'])||{})[_0x0086('0x76')](function(_0x3ae531){for(var _0x2837d9=0x0;_0x2837d9<_0x540db9['body']['ids']['length'];_0x2837d9+=0x1){socket[_0x0086('0x72')](_0x0086('0x5e'),{'UserId':Number(_0x540db9[_0x0086('0x3f')][_0x0086('0x53')][_0x2837d9]),'WhatsappQueueId':Number(_0x540db9[_0x0086('0x2b')]['id'])});}return _0x3ae531;});}})[_0x0086('0x18')](respondWithResult(_0x4dba56,null))[_0x0086('0x3c')](handleError(_0x4dba56,null));};exports[_0x0086('0x71')]=function(_0x36ccfd,_0x1c122f){return db[_0x0086('0x27')]['find']({'where':{'id':_0x36ccfd[_0x0086('0x2b')]['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x1c122f,null))[_0x0086('0x18')](function(_0xabebc1){if(_0xabebc1){return _0xabebc1[_0x0086('0x71')](_0x36ccfd[_0x0086('0x26')][_0x0086('0x53')])[_0x0086('0x18')](function(){if(_[_0x0086('0x77')](_0x36ccfd['query']['ids'])){for(var _0x3c2307=0x0;_0x3c2307<_0x36ccfd[_0x0086('0x26')]['ids']['length'];_0x3c2307+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x36ccfd[_0x0086('0x26')][_0x0086('0x53')][_0x3c2307]),'WhatsappQueueId':Number(_0x36ccfd[_0x0086('0x2b')]['id'])});}}else{socket[_0x0086('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x36ccfd['query']['ids']),'WhatsappQueueId':Number(_0x36ccfd[_0x0086('0x2b')]['id'])});}});}})[_0x0086('0x18')](respondWithStatusCode(_0x1c122f,null))['catch'](handleError(_0x1c122f,null));};exports[_0x0086('0x78')]=function(_0x35b51d,_0x2bc3d1){var _0x2e1da3={};var _0x6d61ef={};var _0x3d0213;var _0x338070;return db[_0x0086('0x27')][_0x0086('0x4e')]({'where':{'id':_0x35b51d['params']['id']}})[_0x0086('0x18')](handleEntityNotFound(_0x2bc3d1,null))[_0x0086('0x18')](function(_0x329c41){if(_0x329c41){_0x3d0213=_0x329c41;_0x6d61ef['model']=_[_0x0086('0x2d')](db['User'][_0x0086('0x21')]);_0x6d61ef[_0x0086('0x26')]=_[_0x0086('0x2d')](_0x35b51d['query']);_0x6d61ef[_0x0086('0x43')]=_[_0x0086('0x2f')](_0x6d61ef[_0x0086('0x2c')],_0x6d61ef[_0x0086('0x26')]);_0x2e1da3[_0x0086('0x2e')]=_['intersection'](_0x6d61ef[_0x0086('0x2c')],qs['fields'](_0x35b51d[_0x0086('0x26')][_0x0086('0x30')]));_0x2e1da3[_0x0086('0x2e')]=_0x2e1da3[_0x0086('0x2e')][_0x0086('0x31')]?_0x2e1da3[_0x0086('0x2e')]:_0x6d61ef['model'];_0x2e1da3[_0x0086('0x50')]=qs[_0x0086('0x45')](_0x35b51d['query'][_0x0086('0x45')]);_0x2e1da3[_0x0086('0x24')]=qs[_0x0086('0x43')](_[_0x0086('0x46')](_0x35b51d[_0x0086('0x26')],_0x6d61ef[_0x0086('0x43')]));if(_0x35b51d[_0x0086('0x26')][_0x0086('0x47')]){_0x2e1da3[_0x0086('0x24')]=_[_0x0086('0x33')](_0x2e1da3[_0x0086('0x24')],{'$or':_['map'](_0x2e1da3['attributes'],function(_0x4b0691){var _0x1301c5={};_0x1301c5[_0x4b0691]={'$like':'%'+_0x35b51d[_0x0086('0x26')][_0x0086('0x47')]+'%'};return _0x1301c5;})});}_0x2e1da3=_[_0x0086('0x33')]({},_0x2e1da3,_0x35b51d[_0x0086('0x34')]);return _0x3d0213['getAgents'](_0x2e1da3);}})['then'](function(_0x57ac81){if(_0x57ac81){_0x338070=_0x57ac81['length'];if(!_0x35b51d[_0x0086('0x26')][_0x0086('0x44')](_0x0086('0x79'))){_0x2e1da3[_0x0086('0x11')]=qs[_0x0086('0x11')](_0x35b51d[_0x0086('0x26')][_0x0086('0x11')]);_0x2e1da3[_0x0086('0x13')]=qs[_0x0086('0x13')](_0x35b51d['query'][_0x0086('0x13')]);}return _0x3d0213[_0x0086('0x78')](_0x2e1da3);}})['then'](function(_0x1a8841){if(_0x1a8841){return _0x1a8841?{'count':_0x338070,'rows':_0x1a8841}:null;}})[_0x0086('0x18')](respondWithResult(_0x2bc3d1,null))[_0x0086('0x3c')](handleError(_0x2bc3d1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 7e04b3c..4d8c08d 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 _0x205c=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','save'];(function(_0x18c08a,_0x46e340){var _0x388429=function(_0x27d239){while(--_0x27d239){_0x18c08a['push'](_0x18c08a['shift']());}};_0x388429(++_0x46e340);}(_0x205c,0x7e));var _0xc205=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x205c[_0x6cf19c];return _0xce14f3;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xc205('0x0'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc205('0x1'),'afterUpdate':_0xc205('0x2'),'afterDestroy':_0xc205('0x3')};function emitEvent(_0x7355a5){return function(_0x2c80de,_0x58ba54,_0x41d662){WhatsappQueueEvents[_0xc205('0x4')](_0x7355a5+':'+_0x2c80de['id'],_0x2c80de);WhatsappQueueEvents[_0xc205('0x4')](_0x7355a5,_0x2c80de);_0x41d662(null);};}for(var e in events){if(events[_0xc205('0x5')](e)){var event=events[e];WhatsappQueue[_0xc205('0x6')](e,emitEvent(event));}}module[_0xc205('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xde8d=['emit','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x4a4e0f,_0x2b0f10){var _0x33f9df=function(_0x3bce7e){while(--_0x3bce7e){_0x4a4e0f['push'](_0x4a4e0f['shift']());}};_0x33f9df(++_0x2b0f10);}(_0xde8d,0x9d));var _0xdde8=function(_0x3f01,_0x259caa){_0x3f01=_0x3f01-0x0;var _0x1d1655=_0xde8d[_0x3f01];return _0x1d1655;};'use strict';var EventEmitter=require(_0xdde8('0x0'));var WhatsappQueue=require(_0xdde8('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xdde8('0x2')](0x0);var events={'afterCreate':_0xdde8('0x3'),'afterUpdate':'update','afterDestroy':_0xdde8('0x4')};function emitEvent(_0x1ef29d){return function(_0x345e3e,_0x279579,_0x4b1b1f){WhatsappQueueEvents[_0xdde8('0x5')](_0x1ef29d+':'+_0x345e3e['id'],_0x345e3e);WhatsappQueueEvents[_0xdde8('0x5')](_0x1ef29d,_0x345e3e);_0x4b1b1f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 9c4d081..4e84336 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 _0xe1e1=['exports','define','whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x27d9e4,_0x3ddf3a){var _0x4a60f9=function(_0x6cd9a2){while(--_0x6cd9a2){_0x27d9e4['push'](_0x27d9e4['shift']());}};_0x4a60f9(++_0x3ddf3a);}(_0xe1e1,0xdf));var _0x1e1e=function(_0x145904,_0x279ca6){_0x145904=_0x145904-0x0;var _0x3a68b6=_0xe1e1[_0x145904];return _0x3a68b6;};'use strict';var _=require(_0x1e1e('0x0'));var util=require(_0x1e1e('0x1'));var logger=require(_0x1e1e('0x2'))(_0x1e1e('0x3'));var moment=require(_0x1e1e('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e1e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1e1e('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0x1e1e('0x7')]=function(_0x38bb57,_0x704627){return _0x38bb57[_0x1e1e('0x8')]('WhatsappQueue',attributes,{'tableName':_0x1e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b8e=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x5b8e,0xc6));var _0xe5b8=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0x5b8e[_0x4d180c];return _0x49b57e;};'use strict';var _=require(_0xe5b8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe5b8('0x1'));var moment=require(_0xe5b8('0x2'));var BPromise=require(_0xe5b8('0x3'));var rp=require(_0xe5b8('0x4'));var fs=require('fs');var path=require(_0xe5b8('0x5'));var rimraf=require('rimraf');var config=require(_0xe5b8('0x6'));var attributes=require(_0xe5b8('0x7'));module[_0xe5b8('0x8')]=function(_0xede3c,_0x2ca6e5){return _0xede3c['define'](_0xe5b8('0x9'),attributes,{'tableName':_0xe5b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 534a446..6f3e5de 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 _0xafb0=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','raw','options','limit','include','map','model','attributes','then','debug','find','ShowWhatsappQueue','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x194618,_0x2b8535){var _0x3a6638=function(_0x3853f6){while(--_0x3853f6){_0x194618['push'](_0x194618['shift']());}};_0x3a6638(++_0x2b8535);}(_0xafb0,0x1db));var _0x0afb=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xafb0[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0x0afb('0x0'));var util=require('util');var moment=require(_0x0afb('0x1'));var BPromise=require(_0x0afb('0x2'));var rs=require(_0x0afb('0x3'));var fs=require('fs');var Redis=require(_0x0afb('0x4'));var db=require(_0x0afb('0x5'))['db'];var utils=require(_0x0afb('0x6'));var logger=require(_0x0afb('0x7'))(_0x0afb('0x8'));var config=require('../../config/environment');var jayson=require(_0x0afb('0x9'));var client=jayson['client'][_0x0afb('0xa')]({'port':0x232a});config[_0x0afb('0xb')]=_[_0x0afb('0xc')](config[_0x0afb('0xb')],{'host':_0x0afb('0xd'),'port':0x18eb});var socket=require(_0x0afb('0xe'))(new Redis(config[_0x0afb('0xb')]));require(_0x0afb('0xf'))[_0x0afb('0x10')](socket);function respondWithRpcPromise(_0x1c27d4,_0xe162b6,_0x3566cd){return new BPromise(function(_0x4d78f8,_0x24acaa){return client['request'](_0x1c27d4,_0x3566cd)['then'](function(_0x58fb1e){logger[_0x0afb('0x11')](_0x0afb('0x12'),_0xe162b6,_0x0afb('0x13'));logger['debug'](_0x0afb('0x14'),_0xe162b6,_0x0afb('0x13'),JSON[_0x0afb('0x15')](_0x58fb1e));if(_0x58fb1e[_0x0afb('0x16')]){if(_0x58fb1e['error'][_0x0afb('0x17')]===0x1f4){logger[_0x0afb('0x16')](_0x0afb('0x12'),_0xe162b6,_0x58fb1e[_0x0afb('0x16')]['message']);return _0x24acaa(_0x58fb1e[_0x0afb('0x16')][_0x0afb('0x18')]);}logger[_0x0afb('0x16')](_0x0afb('0x12'),_0xe162b6,_0x58fb1e[_0x0afb('0x16')][_0x0afb('0x18')]);return _0x4d78f8(_0x58fb1e[_0x0afb('0x16')][_0x0afb('0x18')]);}else{logger['info'](_0x0afb('0x12'),_0xe162b6,_0x0afb('0x13'));_0x4d78f8(_0x58fb1e['result'][_0x0afb('0x18')]);}})[_0x0afb('0x19')](function(_0x2e538f){logger[_0x0afb('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0xe162b6,_0x2e538f);_0x24acaa(_0x2e538f);});});}exports[_0x0afb('0x1a')]=function(_0x19ada3){var _0x2331db=this;return new Promise(function(_0x44e0c5,_0x3a9593){return db[_0x0afb('0x1b')][_0x0afb('0x1c')]({'raw':_0x19ada3['options']?_0x19ada3['options'][_0x0afb('0x1d')]===undefined?!![]:![]:!![],'where':_0x19ada3[_0x0afb('0x1e')]?_0x19ada3[_0x0afb('0x1e')]['where']||null:null,'attributes':_0x19ada3['options']?_0x19ada3[_0x0afb('0x1e')]['attributes']||null:null,'limit':_0x19ada3['options']?_0x19ada3[_0x0afb('0x1e')][_0x0afb('0x1f')]||null:null,'include':_0x19ada3[_0x0afb('0x1e')]?_0x19ada3[_0x0afb('0x1e')][_0x0afb('0x20')]?_[_0x0afb('0x21')](_0x19ada3[_0x0afb('0x1e')][_0x0afb('0x20')],function(_0x53f633){return{'model':db[_0x53f633[_0x0afb('0x22')]],'as':_0x53f633['as'],'attributes':_0x53f633[_0x0afb('0x23')],'include':_0x53f633['include']?_['map'](_0x53f633[_0x0afb('0x20')],function(_0x20c111){return{'model':db[_0x20c111[_0x0afb('0x22')]],'as':_0x20c111['as'],'attributes':_0x20c111['attributes'],'include':_0x20c111[_0x0afb('0x20')]?_['map'](_0x20c111['include'],function(_0x19b8a5){return{'model':db[_0x19b8a5['model']],'as':_0x19b8a5['as'],'attributes':_0x19b8a5[_0x0afb('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0afb('0x24')](function(_0x40f18f){logger[_0x0afb('0x11')]('GetWhatsappQueue',_0x19ada3);logger[_0x0afb('0x25')]('GetWhatsappQueue',_0x19ada3,JSON[_0x0afb('0x15')](_0x40f18f));_0x44e0c5(_0x40f18f);})[_0x0afb('0x19')](function(_0x445c52){logger[_0x0afb('0x16')](_0x0afb('0x1a'),_0x445c52[_0x0afb('0x18')],_0x19ada3);_0x3a9593(_0x2331db[_0x0afb('0x16')](0x1f4,_0x445c52[_0x0afb('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x3d32e6){var _0x1eca57=this;return new Promise(function(_0x1db3a2,_0x1d8677){return db[_0x0afb('0x1b')][_0x0afb('0x26')]({'raw':_0x3d32e6[_0x0afb('0x1e')]?_0x3d32e6['options'][_0x0afb('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d32e6['options']?_0x3d32e6[_0x0afb('0x1e')]['where']||null:null,'attributes':_0x3d32e6[_0x0afb('0x1e')]?_0x3d32e6[_0x0afb('0x1e')][_0x0afb('0x23')]||null:null,'include':_0x3d32e6[_0x0afb('0x1e')]?_0x3d32e6['options'][_0x0afb('0x20')]?_[_0x0afb('0x21')](_0x3d32e6[_0x0afb('0x1e')][_0x0afb('0x20')],function(_0x136c3e){return{'model':db[_0x136c3e[_0x0afb('0x22')]],'as':_0x136c3e['as'],'attributes':_0x136c3e[_0x0afb('0x23')],'include':_0x136c3e[_0x0afb('0x20')]?_['map'](_0x136c3e['include'],function(_0x5c0fd4){return{'model':db[_0x5c0fd4[_0x0afb('0x22')]],'as':_0x5c0fd4['as'],'attributes':_0x5c0fd4[_0x0afb('0x23')],'include':_0x5c0fd4[_0x0afb('0x20')]?_[_0x0afb('0x21')](_0x5c0fd4['include'],function(_0x3315c8){return{'model':db[_0x3315c8[_0x0afb('0x22')]],'as':_0x3315c8['as'],'attributes':_0x3315c8[_0x0afb('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0afb('0x24')](function(_0x46f169){logger[_0x0afb('0x11')](_0x0afb('0x27'),_0x3d32e6);logger['debug'](_0x0afb('0x27'),_0x3d32e6,JSON[_0x0afb('0x15')](_0x46f169));_0x1db3a2(_0x46f169);})[_0x0afb('0x19')](function(_0x33a549){logger[_0x0afb('0x16')](_0x0afb('0x27'),_0x33a549[_0x0afb('0x18')],_0x3d32e6);_0x1d8677(_0x1eca57[_0x0afb('0x16')](0x1f4,_0x33a549[_0x0afb('0x18')]));});});}; \ No newline at end of file +var _0x3e77=['include','model','then','GetWhatsappQueue','catch','ShowWhatsappQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','options','where','attributes','map'];(function(_0x43a65b,_0x20f7c9){var _0x3af010=function(_0x274b06){while(--_0x274b06){_0x43a65b['push'](_0x43a65b['shift']());}};_0x3af010(++_0x20f7c9);}(_0x3e77,0x1a2));var _0x73e7=function(_0x3e7555,_0x442ce2){_0x3e7555=_0x3e7555-0x0;var _0x3719e9=_0x3e77[_0x3e7555];return _0x3719e9;};'use strict';var _=require(_0x73e7('0x0'));var util=require(_0x73e7('0x1'));var moment=require(_0x73e7('0x2'));var BPromise=require(_0x73e7('0x3'));var rs=require(_0x73e7('0x4'));var fs=require('fs');var Redis=require(_0x73e7('0x5'));var db=require(_0x73e7('0x6'))['db'];var utils=require(_0x73e7('0x7'));var logger=require(_0x73e7('0x8'))('rpc');var config=require(_0x73e7('0x9'));var jayson=require(_0x73e7('0xa'));var client=jayson[_0x73e7('0xb')][_0x73e7('0xc')]({'port':0x232a});config[_0x73e7('0xd')]=_[_0x73e7('0xe')](config[_0x73e7('0xd')],{'host':_0x73e7('0xf'),'port':0x18eb});var socket=require(_0x73e7('0x10'))(new Redis(config['redis']));require(_0x73e7('0x11'))[_0x73e7('0x12')](socket);function respondWithRpcPromise(_0x262904,_0x8b1a8,_0x4d0231){return new BPromise(function(_0x2d6224,_0x5bcca8){return client[_0x73e7('0x13')](_0x262904,_0x4d0231)['then'](function(_0x4dedb7){logger['info'](_0x73e7('0x14'),_0x8b1a8,_0x73e7('0x15'));logger[_0x73e7('0x16')](_0x73e7('0x17'),_0x8b1a8,'request\x20sent',JSON[_0x73e7('0x18')](_0x4dedb7));if(_0x4dedb7[_0x73e7('0x19')]){if(_0x4dedb7[_0x73e7('0x19')][_0x73e7('0x1a')]===0x1f4){logger[_0x73e7('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x8b1a8,_0x4dedb7['error'][_0x73e7('0x1b')]);return _0x5bcca8(_0x4dedb7[_0x73e7('0x19')][_0x73e7('0x1b')]);}logger['error'](_0x73e7('0x14'),_0x8b1a8,_0x4dedb7[_0x73e7('0x19')][_0x73e7('0x1b')]);return _0x2d6224(_0x4dedb7[_0x73e7('0x19')][_0x73e7('0x1b')]);}else{logger[_0x73e7('0x1c')](_0x73e7('0x14'),_0x8b1a8,_0x73e7('0x15'));_0x2d6224(_0x4dedb7['result'][_0x73e7('0x1b')]);}})['catch'](function(_0x3ea8c9){logger[_0x73e7('0x19')](_0x73e7('0x14'),_0x8b1a8,_0x3ea8c9);_0x5bcca8(_0x3ea8c9);});});}exports['GetWhatsappQueue']=function(_0x3814a4){var _0x49acc0=this;return new Promise(function(_0x73a4ee,_0x4741d2){return db['WhatsappQueue']['findAll']({'raw':_0x3814a4['options']?_0x3814a4[_0x73e7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3814a4[_0x73e7('0x1d')]?_0x3814a4[_0x73e7('0x1d')][_0x73e7('0x1e')]||null:null,'attributes':_0x3814a4[_0x73e7('0x1d')]?_0x3814a4[_0x73e7('0x1d')][_0x73e7('0x1f')]||null:null,'limit':_0x3814a4[_0x73e7('0x1d')]?_0x3814a4[_0x73e7('0x1d')]['limit']||null:null,'include':_0x3814a4[_0x73e7('0x1d')]?_0x3814a4[_0x73e7('0x1d')]['include']?_[_0x73e7('0x20')](_0x3814a4[_0x73e7('0x1d')][_0x73e7('0x21')],function(_0x640880){return{'model':db[_0x640880[_0x73e7('0x22')]],'as':_0x640880['as'],'attributes':_0x640880[_0x73e7('0x1f')],'include':_0x640880[_0x73e7('0x21')]?_['map'](_0x640880['include'],function(_0x232bb7){return{'model':db[_0x232bb7[_0x73e7('0x22')]],'as':_0x232bb7['as'],'attributes':_0x232bb7[_0x73e7('0x1f')],'include':_0x232bb7[_0x73e7('0x21')]?_[_0x73e7('0x20')](_0x232bb7['include'],function(_0x3da0e7){return{'model':db[_0x3da0e7[_0x73e7('0x22')]],'as':_0x3da0e7['as'],'attributes':_0x3da0e7[_0x73e7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x73e7('0x23')](function(_0x91310){logger[_0x73e7('0x1c')](_0x73e7('0x24'),_0x3814a4);logger[_0x73e7('0x16')](_0x73e7('0x24'),_0x3814a4,JSON[_0x73e7('0x18')](_0x91310));_0x73a4ee(_0x91310);})[_0x73e7('0x25')](function(_0x5cf9e0){logger['error'](_0x73e7('0x24'),_0x5cf9e0[_0x73e7('0x1b')],_0x3814a4);_0x4741d2(_0x49acc0['error'](0x1f4,_0x5cf9e0[_0x73e7('0x1b')]));});});};exports[_0x73e7('0x26')]=function(_0x329cf4){var _0xfbfaea=this;return new Promise(function(_0x3b0cde,_0x34514b){return db['WhatsappQueue'][_0x73e7('0x27')]({'raw':_0x329cf4['options']?_0x329cf4[_0x73e7('0x1d')][_0x73e7('0x28')]===undefined?!![]:![]:!![],'where':_0x329cf4[_0x73e7('0x1d')]?_0x329cf4[_0x73e7('0x1d')][_0x73e7('0x1e')]||null:null,'attributes':_0x329cf4[_0x73e7('0x1d')]?_0x329cf4[_0x73e7('0x1d')][_0x73e7('0x1f')]||null:null,'include':_0x329cf4['options']?_0x329cf4[_0x73e7('0x1d')][_0x73e7('0x21')]?_['map'](_0x329cf4[_0x73e7('0x1d')]['include'],function(_0x2cc711){return{'model':db[_0x2cc711[_0x73e7('0x22')]],'as':_0x2cc711['as'],'attributes':_0x2cc711[_0x73e7('0x1f')],'include':_0x2cc711[_0x73e7('0x21')]?_[_0x73e7('0x20')](_0x2cc711[_0x73e7('0x21')],function(_0x4b39f2){return{'model':db[_0x4b39f2[_0x73e7('0x22')]],'as':_0x4b39f2['as'],'attributes':_0x4b39f2['attributes'],'include':_0x4b39f2['include']?_[_0x73e7('0x20')](_0x4b39f2[_0x73e7('0x21')],function(_0x43024a){return{'model':db[_0x43024a[_0x73e7('0x22')]],'as':_0x43024a['as'],'attributes':_0x43024a[_0x73e7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2810e9){logger[_0x73e7('0x1c')](_0x73e7('0x26'),_0x329cf4);logger[_0x73e7('0x16')]('ShowWhatsappQueue',_0x329cf4,JSON[_0x73e7('0x18')](_0x2810e9));_0x3b0cde(_0x2810e9);})[_0x73e7('0x25')](function(_0x267b35){logger[_0x73e7('0x19')](_0x73e7('0x26'),_0x267b35[_0x73e7('0x1b')],_0x329cf4);_0x34514b(_0xfbfaea[_0x73e7('0x19')](0x1f4,_0x267b35[_0x73e7('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 3c3c58b..d3324cd 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 _0xd50e=['register','length','whatsappQueue:','./whatsappQueue.events','save','update','removeListener'];(function(_0x2c68ed,_0x37cfdc){var _0x161061=function(_0x16ed09){while(--_0x16ed09){_0x2c68ed['push'](_0x2c68ed['shift']());}};_0x161061(++_0x37cfdc);}(_0xd50e,0x6c));var _0xed50=function(_0xf741a,_0xf50784){_0xf741a=_0xf741a-0x0;var _0x9240ab=_0xd50e[_0xf741a];return _0x9240ab;};'use strict';var WhatsappQueueEvents=require(_0xed50('0x0'));var events=[_0xed50('0x1'),'remove',_0xed50('0x2')];function createListener(_0x482315,_0x1daaf5){return function(_0x3ee7bb){_0x1daaf5['emit'](_0x482315,_0x3ee7bb);};}function removeListener(_0x4a375f,_0xb0e654){return function(){WhatsappQueueEvents[_0xed50('0x3')](_0x4a375f,_0xb0e654);};}exports[_0xed50('0x4')]=function(_0xed01bf){for(var _0x25c109=0x0,_0x1255f0=events[_0xed50('0x5')];_0x25c109<_0x1255f0;_0x25c109++){var _0x17ed47=events[_0x25c109];var _0x4fe75f=createListener(_0xed50('0x6')+_0x17ed47,_0xed01bf);WhatsappQueueEvents['on'](_0x17ed47,_0x4fe75f);}}; \ No newline at end of file +var _0x502e=['./whatsappQueue.events','remove','update','register','length'];(function(_0x2ab14d,_0x2fc77e){var _0x5e2744=function(_0x241415){while(--_0x241415){_0x2ab14d['push'](_0x2ab14d['shift']());}};_0x5e2744(++_0x2fc77e);}(_0x502e,0x69));var _0xe502=function(_0x10ad65,_0x916609){_0x10ad65=_0x10ad65-0x0;var _0x2f1bcb=_0x502e[_0x10ad65];return _0x2f1bcb;};'use strict';var WhatsappQueueEvents=require(_0xe502('0x0'));var events=['save',_0xe502('0x1'),_0xe502('0x2')];function createListener(_0x3f9789,_0x525663){return function(_0x3b0070){_0x525663['emit'](_0x3f9789,_0x3b0070);};}function removeListener(_0x2c5bb1,_0x3287b2){return function(){WhatsappQueueEvents['removeListener'](_0x2c5bb1,_0x3287b2);};}exports[_0xe502('0x3')]=function(_0x527ec4){for(var _0x36ec9b=0x0,_0x454dbc=events[_0xe502('0x4')];_0x36ec9b<_0x454dbc;_0x36ec9b++){var _0x1eafa5=events[_0x36ec9b];var _0x4dc5df=createListener('whatsappQueue:'+_0x1eafa5,_0x527ec4);WhatsappQueueEvents['on'](_0x1eafa5,_0x4dc5df);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 52f00b2..bdc9e17 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 _0x8a28=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','index','/describe','isAuthenticated','get','/:id','show','post','create','put','delete','destroy'];(function(_0x3a9e62,_0x4934fb){var _0x280fd3=function(_0x337cf9){while(--_0x337cf9){_0x3a9e62['push'](_0x3a9e62['shift']());}};_0x280fd3(++_0x4934fb);}(_0x8a28,0x1cf));var _0x88a2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8a28[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x88a2('0x0'));var path=require(_0x88a2('0x1'));var timeout=require(_0x88a2('0x2'));var express=require('express');var router=express[_0x88a2('0x3')]();var fs_extra=require(_0x88a2('0x4'));var auth=require(_0x88a2('0x5'));var interaction=require(_0x88a2('0x6'));var config=require(_0x88a2('0x7'));var controller=require(_0x88a2('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x88a2('0x9')]);router['get'](_0x88a2('0xa'),auth[_0x88a2('0xb')](),controller['describe']);router[_0x88a2('0xc')](_0x88a2('0xd'),auth[_0x88a2('0xb')](),controller[_0x88a2('0xe')]);router[_0x88a2('0xf')]('/',auth['isAuthenticated'](),controller[_0x88a2('0x10')]);router[_0x88a2('0x11')]('/:id',auth[_0x88a2('0xb')](),controller['update']);router[_0x88a2('0x12')](_0x88a2('0xd'),auth['isAuthenticated'](),controller[_0x88a2('0x13')]);module[_0x88a2('0x14')]=router; \ No newline at end of file +var _0x59fe=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','describe','get','/:id','show','create'];(function(_0x4fcb6c,_0xc5b404){var _0x75ac60=function(_0x1bcc31){while(--_0x1bcc31){_0x4fcb6c['push'](_0x4fcb6c['shift']());}};_0x75ac60(++_0xc5b404);}(_0x59fe,0x146));var _0xe59f=function(_0x52c9ff,_0x5d9894){_0x52c9ff=_0x52c9ff-0x0;var _0xa05b58=_0x59fe[_0x52c9ff];return _0xa05b58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe59f('0x0'));var timeout=require(_0xe59f('0x1'));var express=require(_0xe59f('0x2'));var router=express[_0xe59f('0x3')]();var fs_extra=require(_0xe59f('0x4'));var auth=require(_0xe59f('0x5'));var interaction=require(_0xe59f('0x6'));var config=require(_0xe59f('0x7'));var controller=require(_0xe59f('0x8'));router['get']('/',auth[_0xe59f('0x9')](),controller[_0xe59f('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe59f('0xb')]);router[_0xe59f('0xc')](_0xe59f('0xd'),auth['isAuthenticated'](),controller[_0xe59f('0xe')]);router['post']('/',auth[_0xe59f('0x9')](),controller[_0xe59f('0xf')]);router['put'](_0xe59f('0xd'),auth[_0xe59f('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe59f('0x10')]);module[_0xe59f('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 72d5272..d3900c2 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(_0xaa4fb7,_0x44f417){var _0x15215b=function(_0x2fca13){while(--_0x2fca13){_0xaa4fb7['push'](_0xaa4fb7['shift']());}};_0x15215b(++_0x44f417);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x3bffc5,_0x1ce069){var _0x2f2023=function(_0x1f4fc2){while(--_0x1f4fc2){_0x3bffc5['push'](_0x3bffc5['shift']());}};_0x2f2023(++_0x1ce069);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 0618425..b9d4172 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 _0xbfcc=['destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','offset','count','set','Content-Range','json','reject','then'];(function(_0x258270,_0x2d718c){var _0x4e8d3e=function(_0x59a1a5){while(--_0x59a1a5){_0x258270['push'](_0x258270['shift']());}};_0x4e8d3e(++_0x2d718c);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0xbfcc[_0x4b2cc6];return _0x3e0b08;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbfc('0x1'));var rp=require(_0xcbfc('0x2'));var moment=require(_0xcbfc('0x3'));var BPromise=require(_0xcbfc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbfc('0x5'));var ejs=require(_0xcbfc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x5'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var licenseUtil=require(_0xcbfc('0x14'));var db=require(_0xcbfc('0x15'))['db'];function respondWithStatusCode(_0x4e8b34,_0x3bfd05){_0x3bfd05=_0x3bfd05||0xcc;return function(_0x86f67c){if(_0x86f67c){return _0x4e8b34[_0xcbfc('0x16')](_0x3bfd05);}return _0x4e8b34['status'](_0x3bfd05)[_0xcbfc('0x17')]();};}function respondWithResult(_0x3ec338,_0x2f2bdd){_0x2f2bdd=_0x2f2bdd||0xc8;return function(_0x45a5cc){if(_0x45a5cc){return _0x3ec338[_0xcbfc('0x18')](_0x2f2bdd)['json'](_0x45a5cc);}};}function respondWithFilteredResult(_0x3c69ed,_0x1963de){return function(_0x1ec8c4){if(_0x1ec8c4){var _0x4317e4=typeof _0x1963de['offset']==='undefined'&&typeof _0x1963de[_0xcbfc('0x19')]===_0xcbfc('0x1a');var _0xa65368=_0x1ec8c4['count'];var _0x5b078f=_0x4317e4?0x0:_0x1963de[_0xcbfc('0x1b')];var _0x99b59d=_0x4317e4?_0x1ec8c4[_0xcbfc('0x1c')]:_0x1963de['offset']+_0x1963de[_0xcbfc('0x19')];var _0x552777;if(_0x99b59d>=_0xa65368){_0x99b59d=_0xa65368;_0x552777=0xc8;}else{_0x552777=0xce;}_0x3c69ed[_0xcbfc('0x18')](_0x552777);return _0x3c69ed[_0xcbfc('0x1d')](_0xcbfc('0x1e'),_0x5b078f+'-'+_0x99b59d+'/'+_0xa65368)[_0xcbfc('0x1f')](_0x1ec8c4);}return null;};}function patchUpdates(_0x25c167){return function(_0x2653b1){try{jsonpatch['apply'](_0x2653b1,_0x25c167,!![]);}catch(_0x9c79da){return BPromise[_0xcbfc('0x20')](_0x9c79da);}return _0x2653b1['save']();};}function saveUpdates(_0x1da958,_0x5a449b){return function(_0x4cc8b3){if(_0x4cc8b3){return _0x4cc8b3['update'](_0x1da958)[_0xcbfc('0x21')](function(_0x4a0fcb){return _0x4a0fcb;});}return null;};}function removeEntity(_0x4a1915,_0x1b3e42){return function(_0x34cffa){if(_0x34cffa){return _0x34cffa[_0xcbfc('0x22')]()[_0xcbfc('0x21')](function(){_0x4a1915['status'](0xcc)[_0xcbfc('0x17')]();});}};}function handleEntityNotFound(_0x51284a,_0x280b78){return function(_0x75bca0){if(!_0x75bca0){_0x51284a['sendStatus'](0x194);}return _0x75bca0;};}function handleError(_0x28bdcf,_0x3b73a3){_0x3b73a3=_0x3b73a3||0x1f4;return function(_0x4ab48e){logger[_0xcbfc('0x23')](_0x4ab48e[_0xcbfc('0x24')]);if(_0x4ab48e[_0xcbfc('0x25')]){delete _0x4ab48e[_0xcbfc('0x25')];}_0x28bdcf['status'](_0x3b73a3)[_0xcbfc('0x26')](_0x4ab48e);};}exports[_0xcbfc('0x27')]=function(_0x4f632a,_0x1f6a14){var _0x26463f={},_0x7cbdfa={},_0x388d41={'count':0x0,'rows':[]};var _0x2b4286=_[_0xcbfc('0x28')](db[_0xcbfc('0x29')]['rawAttributes'],function(_0x41b68b){return{'name':_0x41b68b[_0xcbfc('0x2a')],'type':_0x41b68b[_0xcbfc('0x2b')][_0xcbfc('0x2c')]};});_0x7cbdfa['model']=_[_0xcbfc('0x28')](_0x2b4286,_0xcbfc('0x25'));_0x7cbdfa[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x4f632a[_0xcbfc('0x2d')]);_0x7cbdfa[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x7cbdfa['model'],_0x7cbdfa[_0xcbfc('0x2d')]);_0x26463f[_0xcbfc('0x31')]=_['intersection'](_0x7cbdfa[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x4f632a[_0xcbfc('0x2d')]['fields']));_0x26463f['attributes']=_0x26463f['attributes'][_0xcbfc('0x34')]?_0x26463f[_0xcbfc('0x31')]:_0x7cbdfa[_0xcbfc('0x32')];if(!_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x35')](_0xcbfc('0x36'))){_0x26463f[_0xcbfc('0x19')]=qs[_0xcbfc('0x19')](_0x4f632a['query'][_0xcbfc('0x19')]);_0x26463f[_0xcbfc('0x1b')]=qs['offset'](_0x4f632a[_0xcbfc('0x2d')]['offset']);}_0x26463f[_0xcbfc('0x37')]=qs[_0xcbfc('0x38')](_0x4f632a[_0xcbfc('0x2d')]['sort']);_0x26463f[_0xcbfc('0x39')]=qs['filters'](_['pick'](_0x4f632a[_0xcbfc('0x2d')],_0x7cbdfa[_0xcbfc('0x2f')]),_0x2b4286);if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]){_0x26463f[_0xcbfc('0x39')]=_[_0xcbfc('0x3b')](_0x26463f[_0xcbfc('0x39')],{'$or':_[_0xcbfc('0x28')](_0x2b4286,function(_0x5cf4fa){if(_0x5cf4fa[_0xcbfc('0x2b')]!=='VIRTUAL'){var _0x15a5c4={};_0x15a5c4[_0x5cf4fa[_0xcbfc('0x25')]]={'$like':'%'+_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3a')]+'%'};return _0x15a5c4;}})});}_0x26463f=_['merge']({},_0x26463f,_0x4f632a['options']);var _0x236b66={'where':_0x26463f[_0xcbfc('0x39')]};return db[_0xcbfc('0x29')][_0xcbfc('0x1c')](_0x236b66)[_0xcbfc('0x21')](function(_0x4aa189){_0x388d41[_0xcbfc('0x1c')]=_0x4aa189;if(_0x4f632a[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x26463f['include']=[{'all':!![]}];}return db[_0xcbfc('0x29')][_0xcbfc('0x3d')](_0x26463f);})[_0xcbfc('0x21')](function(_0x4ca55c){_0x388d41[_0xcbfc('0x3e')]=_0x4ca55c;return _0x388d41;})[_0xcbfc('0x21')](respondWithFilteredResult(_0x1f6a14,_0x26463f))[_0xcbfc('0x3f')](handleError(_0x1f6a14,null));};exports[_0xcbfc('0x40')]=function(_0x102f4f,_0x28447a){var _0x1e14bb={'raw':!![],'where':{'id':_0x102f4f[_0xcbfc('0x41')]['id']}},_0x561544={};_0x561544[_0xcbfc('0x32')]=_['keys'](db[_0xcbfc('0x29')][_0xcbfc('0x42')]);_0x561544[_0xcbfc('0x2d')]=_[_0xcbfc('0x2e')](_0x102f4f[_0xcbfc('0x2d')]);_0x561544[_0xcbfc('0x2f')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],_0x561544['query']);_0x1e14bb[_0xcbfc('0x31')]=_[_0xcbfc('0x30')](_0x561544[_0xcbfc('0x32')],qs[_0xcbfc('0x33')](_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x33')]));_0x1e14bb[_0xcbfc('0x31')]=_0x1e14bb['attributes'][_0xcbfc('0x34')]?_0x1e14bb[_0xcbfc('0x31')]:_0x561544['model'];if(_0x102f4f[_0xcbfc('0x2d')][_0xcbfc('0x3c')]){_0x1e14bb[_0xcbfc('0x43')]=[{'all':!![]}];}_0x1e14bb=_['merge']({},_0x1e14bb,_0x102f4f[_0xcbfc('0x44')]);return db[_0xcbfc('0x29')][_0xcbfc('0x45')](_0x1e14bb)[_0xcbfc('0x21')](handleEntityNotFound(_0x28447a,null))[_0xcbfc('0x21')](respondWithResult(_0x28447a,null))[_0xcbfc('0x3f')](handleError(_0x28447a,null));};exports[_0xcbfc('0x46')]=function(_0x55fc0b,_0x5a87b6){return db[_0xcbfc('0x29')][_0xcbfc('0x46')](_0x55fc0b[_0xcbfc('0x47')],{})[_0xcbfc('0x21')](respondWithResult(_0x5a87b6,0xc9))['catch'](handleError(_0x5a87b6,null));};exports['update']=function(_0x2e89bf,_0xe5c5ef){if(_0x2e89bf[_0xcbfc('0x47')]['id']){delete _0x2e89bf['body']['id'];}return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0x2e89bf[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0xe5c5ef,null))[_0xcbfc('0x21')](saveUpdates(_0x2e89bf[_0xcbfc('0x47')],null))[_0xcbfc('0x21')](respondWithResult(_0xe5c5ef,null))[_0xcbfc('0x3f')](handleError(_0xe5c5ef,null));};exports[_0xcbfc('0x22')]=function(_0xd9976d,_0x222b58){return db[_0xcbfc('0x29')][_0xcbfc('0x45')]({'where':{'id':_0xd9976d[_0xcbfc('0x41')]['id']}})['then'](handleEntityNotFound(_0x222b58,null))[_0xcbfc('0x21')](removeEntity(_0x222b58,null))[_0xcbfc('0x3f')](handleError(_0x222b58,null));};exports[_0xcbfc('0x48')]=function(_0x5c2ad9,_0x28ae7f){return db[_0xcbfc('0x29')]['describe']()[_0xcbfc('0x21')](respondWithResult(_0x28ae7f,null))[_0xcbfc('0x3f')](handleError(_0x28ae7f,null));}; \ No newline at end of file +var _0xe511=['destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','then','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','WhatsappQueueReport','findAll','catch','show','params','rawAttributes','find','create','body'];(function(_0x3ecfab,_0x43003e){var _0x32e547=function(_0xfa1bf1){while(--_0xfa1bf1){_0x3ecfab['push'](_0x3ecfab['shift']());}};_0x32e547(++_0x43003e);}(_0xe511,0x16f));var _0x1e51=function(_0x4ac6a0,_0x4d28f9){_0x4ac6a0=_0x4ac6a0-0x0;var _0x1d9a5e=_0xe511[_0x4ac6a0];return _0x1d9a5e;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x2e42b1,_0x1386db){return function(_0x505d79){if(!_0x505d79){_0x2e42b1['sendStatus'](0x194);}return _0x505d79;};}function handleError(_0x486ad6,_0x1eb83f){_0x1eb83f=_0x1eb83f||0x1f4;return function(_0x2a1561){logger[_0x1e51('0x24')](_0x2a1561['stack']);if(_0x2a1561[_0x1e51('0x25')]){delete _0x2a1561['name'];}_0x486ad6['status'](_0x1eb83f)[_0x1e51('0x26')](_0x2a1561);};}exports['index']=function(_0x170ec6,_0x1eb79f){var _0x56722f={},_0x3e6ef2={},_0x10ee23={'count':0x0,'rows':[]};var _0x71c7af=_[_0x1e51('0x27')](db['WhatsappQueueReport']['rawAttributes'],function(_0x4f67d3){return{'name':_0x4f67d3[_0x1e51('0x28')],'type':_0x4f67d3[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x3e6ef2[_0x1e51('0x2b')]=_[_0x1e51('0x27')](_0x71c7af,_0x1e51('0x25'));_0x3e6ef2[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x170ec6[_0x1e51('0x2c')]);_0x3e6ef2[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x3e6ef2['model'],_0x3e6ef2[_0x1e51('0x2c')]);_0x56722f[_0x1e51('0x30')]=_[_0x1e51('0x2f')](_0x3e6ef2[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x170ec6['query'][_0x1e51('0x31')]));_0x56722f['attributes']=_0x56722f[_0x1e51('0x30')][_0x1e51('0x32')]?_0x56722f[_0x1e51('0x30')]:_0x3e6ef2['model'];if(!_0x170ec6[_0x1e51('0x2c')]['hasOwnProperty'](_0x1e51('0x33'))){_0x56722f['limit']=qs['limit'](_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x1d')]);_0x56722f[_0x1e51('0x1c')]=qs['offset'](_0x170ec6[_0x1e51('0x2c')]['offset']);}_0x56722f[_0x1e51('0x34')]=qs[_0x1e51('0x35')](_0x170ec6['query'][_0x1e51('0x35')]);_0x56722f[_0x1e51('0x36')]=qs[_0x1e51('0x2e')](_[_0x1e51('0x37')](_0x170ec6[_0x1e51('0x2c')],_0x3e6ef2[_0x1e51('0x2e')]),_0x71c7af);if(_0x170ec6['query']['filter']){_0x56722f[_0x1e51('0x36')]=_['merge'](_0x56722f[_0x1e51('0x36')],{'$or':_[_0x1e51('0x27')](_0x71c7af,function(_0x32c41b){if(_0x32c41b[_0x1e51('0x29')]!==_0x1e51('0x38')){var _0x174a24={};_0x174a24[_0x32c41b[_0x1e51('0x25')]]={'$like':'%'+_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x39')]+'%'};return _0x174a24;}})});}_0x56722f=_[_0x1e51('0x3a')]({},_0x56722f,_0x170ec6[_0x1e51('0x3b')]);var _0x5360b3={'where':_0x56722f[_0x1e51('0x36')]};return db['WhatsappQueueReport'][_0x1e51('0x1e')](_0x5360b3)[_0x1e51('0x23')](function(_0x2b287e){_0x10ee23[_0x1e51('0x1e')]=_0x2b287e;if(_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x56722f[_0x1e51('0x3d')]=[{'all':!![]}];}return db[_0x1e51('0x3e')][_0x1e51('0x3f')](_0x56722f);})[_0x1e51('0x23')](function(_0xc40fce){_0x10ee23['rows']=_0xc40fce;return _0x10ee23;})['then'](respondWithFilteredResult(_0x1eb79f,_0x56722f))[_0x1e51('0x40')](handleError(_0x1eb79f,null));};exports[_0x1e51('0x41')]=function(_0x3be495,_0x4650e4){var _0x1ef3d3={'raw':!![],'where':{'id':_0x3be495[_0x1e51('0x42')]['id']}},_0x1a9e0d={};_0x1a9e0d[_0x1e51('0x2b')]=_['keys'](db[_0x1e51('0x3e')][_0x1e51('0x43')]);_0x1a9e0d[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x3be495[_0x1e51('0x2c')]);_0x1a9e0d[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1a9e0d['model'],_0x1a9e0d[_0x1e51('0x2c')]);_0x1ef3d3[_0x1e51('0x30')]=_['intersection'](_0x1a9e0d[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x3be495[_0x1e51('0x2c')]['fields']));_0x1ef3d3[_0x1e51('0x30')]=_0x1ef3d3[_0x1e51('0x30')][_0x1e51('0x32')]?_0x1ef3d3[_0x1e51('0x30')]:_0x1a9e0d[_0x1e51('0x2b')];if(_0x3be495[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x1ef3d3[_0x1e51('0x3d')]=[{'all':!![]}];}_0x1ef3d3=_[_0x1e51('0x3a')]({},_0x1ef3d3,_0x3be495['options']);return db[_0x1e51('0x3e')][_0x1e51('0x44')](_0x1ef3d3)['then'](handleEntityNotFound(_0x4650e4,null))[_0x1e51('0x23')](respondWithResult(_0x4650e4,null))[_0x1e51('0x40')](handleError(_0x4650e4,null));};exports[_0x1e51('0x45')]=function(_0x4f6405,_0x44468a){return db[_0x1e51('0x3e')][_0x1e51('0x45')](_0x4f6405['body'],{})[_0x1e51('0x23')](respondWithResult(_0x44468a,0xc9))['catch'](handleError(_0x44468a,null));};exports['update']=function(_0x54688b,_0x169e6c){if(_0x54688b[_0x1e51('0x46')]['id']){delete _0x54688b['body']['id'];}return db['WhatsappQueueReport'][_0x1e51('0x44')]({'where':{'id':_0x54688b[_0x1e51('0x42')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x169e6c,null))[_0x1e51('0x23')](saveUpdates(_0x54688b[_0x1e51('0x46')],null))[_0x1e51('0x23')](respondWithResult(_0x169e6c,null))['catch'](handleError(_0x169e6c,null));};exports[_0x1e51('0x47')]=function(_0x48a2d0,_0xf6bd35){return db[_0x1e51('0x3e')]['find']({'where':{'id':_0x48a2d0['params']['id']}})['then'](handleEntityNotFound(_0xf6bd35,null))[_0x1e51('0x23')](removeEntity(_0xf6bd35,null))[_0x1e51('0x40')](handleError(_0xf6bd35,null));};exports[_0x1e51('0x48')]=function(_0x4cdfe3,_0x2fdee1){return db[_0x1e51('0x3e')][_0x1e51('0x48')]()[_0x1e51('0x23')](respondWithResult(_0x2fdee1,null))[_0x1e51('0x40')](handleError(_0x2fdee1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3392009..eed814a 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 _0x3eb0=['define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x528497,_0x147e87){var _0x392d59=function(_0x47d9ec){while(--_0x47d9ec){_0x528497['push'](_0x528497['shift']());}};_0x392d59(++_0x147e87);}(_0x3eb0,0x11b));var _0x03eb=function(_0x32f2d0,_0x2a3bc5){_0x32f2d0=_0x32f2d0-0x0;var _0x6354fe=_0x3eb0[_0x32f2d0];return _0x6354fe;};'use strict';var _=require(_0x03eb('0x0'));var util=require(_0x03eb('0x1'));var logger=require(_0x03eb('0x2'))(_0x03eb('0x3'));var moment=require(_0x03eb('0x4'));var BPromise=require(_0x03eb('0x5'));var rp=require(_0x03eb('0x6'));var fs=require('fs');var path=require(_0x03eb('0x7'));var rimraf=require(_0x03eb('0x8'));var config=require(_0x03eb('0x9'));var attributes=require(_0x03eb('0xa'));module['exports']=function(_0x8140ab,_0x57ea6e){return _0x8140ab[_0x03eb('0xb')](_0x03eb('0xc'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x03eb('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b04=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x4244b3,_0x560e9c){var _0x40fe4d=function(_0x23b96a){while(--_0x23b96a){_0x4244b3['push'](_0x4244b3['shift']());}};_0x40fe4d(++_0x560e9c);}(_0x2b04,0x1a2));var _0x42b0=function(_0xd36577,_0x20c8e3){_0xd36577=_0xd36577-0x0;var _0x5eecd6=_0x2b04[_0xd36577];return _0x5eecd6;};'use strict';var _=require(_0x42b0('0x0'));var util=require(_0x42b0('0x1'));var logger=require(_0x42b0('0x2'))('api');var moment=require(_0x42b0('0x3'));var BPromise=require(_0x42b0('0x4'));var rp=require(_0x42b0('0x5'));var fs=require('fs');var path=require(_0x42b0('0x6'));var rimraf=require(_0x42b0('0x7'));var config=require(_0x42b0('0x8'));var attributes=require(_0x42b0('0x9'));module['exports']=function(_0x2bb323,_0x574f63){return _0x2bb323[_0x42b0('0xa')](_0x42b0('0xb'),attributes,{'tableName':_0x42b0('0xc'),'paranoid':![],'indexes':[{'name':_0x42b0('0xd'),'fields':[_0x42b0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 119e0ac..958cc93 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 _0x16b5=['then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw','debug','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2ed1bf,_0x3d8d02){var _0xe0d8df=function(_0x333048){while(--_0x333048){_0x2ed1bf['push'](_0x2ed1bf['shift']());}};_0xe0d8df(++_0x3d8d02);}(_0x16b5,0x1c4));var _0x516b=function(_0x175cf5,_0x34d222){_0x175cf5=_0x175cf5-0x0;var _0x5d9155=_0x16b5[_0x175cf5];return _0x5d9155;};'use strict';var _=require('lodash');var util=require(_0x516b('0x0'));var moment=require(_0x516b('0x1'));var BPromise=require(_0x516b('0x2'));var rs=require(_0x516b('0x3'));var fs=require('fs');var Redis=require(_0x516b('0x4'));var db=require(_0x516b('0x5'))['db'];var utils=require(_0x516b('0x6'));var logger=require('../../config/logger')(_0x516b('0x7'));var config=require(_0x516b('0x8'));var jayson=require(_0x516b('0x9'));var client=jayson[_0x516b('0xa')][_0x516b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38607e,_0x31de98,_0x485f16){return new BPromise(function(_0x1b10cf,_0x64486c){return client[_0x516b('0xc')](_0x38607e,_0x485f16)[_0x516b('0xd')](function(_0x6e48b0){logger[_0x516b('0xe')](_0x516b('0xf'),_0x31de98,'request\x20sent');logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x31de98,_0x516b('0x10'),JSON[_0x516b('0x11')](_0x6e48b0));if(_0x6e48b0[_0x516b('0x12')]){if(_0x6e48b0['error'][_0x516b('0x13')]===0x1f4){logger[_0x516b('0x12')](_0x516b('0xf'),_0x31de98,_0x6e48b0[_0x516b('0x12')][_0x516b('0x14')]);return _0x64486c(_0x6e48b0['error'][_0x516b('0x14')]);}logger[_0x516b('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x31de98,_0x6e48b0[_0x516b('0x12')][_0x516b('0x14')]);return _0x1b10cf(_0x6e48b0[_0x516b('0x12')]['message']);}else{logger[_0x516b('0xe')](_0x516b('0xf'),_0x31de98,_0x516b('0x10'));_0x1b10cf(_0x6e48b0[_0x516b('0x15')][_0x516b('0x14')]);}})[_0x516b('0x16')](function(_0x5c48ab){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x31de98,_0x5c48ab);_0x64486c(_0x5c48ab);});});}exports['CreateWhatsappQueueReport']=function(_0x36fae9){var _0x379746=this;return new Promise(function(_0x443804,_0x16e28c){return db['WhatsappQueueReport'][_0x516b('0x17')](_0x36fae9[_0x516b('0x18')],{'raw':_0x36fae9[_0x516b('0x19')]?_0x36fae9[_0x516b('0x19')][_0x516b('0x1a')]===undefined?!![]:![]:!![]})[_0x516b('0xd')](function(_0x318933){logger[_0x516b('0xe')]('CreateWhatsappQueueReport',_0x36fae9);logger[_0x516b('0x1b')](_0x516b('0x1c'),_0x36fae9,JSON[_0x516b('0x11')](_0x318933));_0x443804(_0x318933);})['catch'](function(_0x18df22){logger[_0x516b('0x12')](_0x516b('0x1c'),_0x18df22[_0x516b('0x14')],_0x36fae9);_0x16e28c(_0x379746[_0x516b('0x12')](0x1f4,_0x18df22[_0x516b('0x14')]));});});};exports[_0x516b('0x1d')]=function(_0x2a38d2){var _0xa26a71=this;return new Promise(function(_0x4b4fd6,_0x97d9bf){return db['WhatsappQueueReport'][_0x516b('0x1e')](_0x2a38d2[_0x516b('0x18')],{'raw':_0x2a38d2[_0x516b('0x19')]?_0x2a38d2[_0x516b('0x19')][_0x516b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a38d2[_0x516b('0x19')]?_0x2a38d2[_0x516b('0x19')]['where']||null:null,'attributes':_0x2a38d2['options']?_0x2a38d2['options']['attributes']||null:null,'limit':_0x2a38d2[_0x516b('0x19')]?_0x2a38d2['options']['limit']||null:null})[_0x516b('0xd')](function(_0x5c256e){logger[_0x516b('0xe')](_0x516b('0x1d'),_0x2a38d2);logger[_0x516b('0x1b')]('UpdateWhatsappQueueReport',_0x2a38d2,JSON['stringify'](_0x5c256e));_0x4b4fd6(_0x5c256e);})[_0x516b('0x16')](function(_0x37f74c){logger[_0x516b('0x12')]('UpdateWhatsappQueueReport',_0x37f74c[_0x516b('0x14')],_0x2a38d2);_0x97d9bf(_0xa26a71[_0x516b('0x12')](0x1f4,_0x37f74c[_0x516b('0x14')]));});});}; \ No newline at end of file +var _0xe203=['catch','CreateWhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','info','result'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe203,0x1b8));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e20('0x0'));var util=require('util');var moment=require(_0x3e20('0x1'));var BPromise=require(_0x3e20('0x2'));var rs=require(_0x3e20('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e20('0x4'));var logger=require('../../config/logger')(_0x3e20('0x5'));var config=require(_0x3e20('0x6'));var jayson=require(_0x3e20('0x7'));var client=jayson[_0x3e20('0x8')][_0x3e20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x347f10,_0x26ea38,_0x1c3a2e){return new BPromise(function(_0x34718f,_0x3244f5){return client[_0x3e20('0xa')](_0x347f10,_0x1c3a2e)[_0x3e20('0xb')](function(_0x365e30){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x26ea38,_0x3e20('0xc'));logger[_0x3e20('0xd')](_0x3e20('0xe'),_0x26ea38,_0x3e20('0xc'),JSON[_0x3e20('0xf')](_0x365e30));if(_0x365e30[_0x3e20('0x10')]){if(_0x365e30['error'][_0x3e20('0x11')]===0x1f4){logger[_0x3e20('0x10')](_0x3e20('0x12'),_0x26ea38,_0x365e30[_0x3e20('0x10')][_0x3e20('0x13')]);return _0x3244f5(_0x365e30['error']['message']);}logger[_0x3e20('0x10')](_0x3e20('0x12'),_0x26ea38,_0x365e30[_0x3e20('0x10')][_0x3e20('0x13')]);return _0x34718f(_0x365e30[_0x3e20('0x10')][_0x3e20('0x13')]);}else{logger[_0x3e20('0x14')](_0x3e20('0x12'),_0x26ea38,_0x3e20('0xc'));_0x34718f(_0x365e30[_0x3e20('0x15')][_0x3e20('0x13')]);}})[_0x3e20('0x16')](function(_0x182f1f){logger[_0x3e20('0x10')](_0x3e20('0x12'),_0x26ea38,_0x182f1f);_0x3244f5(_0x182f1f);});});}exports[_0x3e20('0x17')]=function(_0x311cb5){var _0x17a2e0=this;return new Promise(function(_0x2989df,_0x450b42){return db['WhatsappQueueReport']['create'](_0x311cb5[_0x3e20('0x18')],{'raw':_0x311cb5[_0x3e20('0x19')]?_0x311cb5[_0x3e20('0x19')][_0x3e20('0x1a')]===undefined?!![]:![]:!![]})[_0x3e20('0xb')](function(_0x78d91c){logger[_0x3e20('0x14')](_0x3e20('0x17'),_0x311cb5);logger[_0x3e20('0xd')](_0x3e20('0x17'),_0x311cb5,JSON['stringify'](_0x78d91c));_0x2989df(_0x78d91c);})['catch'](function(_0x1b1b5b){logger[_0x3e20('0x10')]('CreateWhatsappQueueReport',_0x1b1b5b['message'],_0x311cb5);_0x450b42(_0x17a2e0[_0x3e20('0x10')](0x1f4,_0x1b1b5b[_0x3e20('0x13')]));});});};exports[_0x3e20('0x1b')]=function(_0x4fe401){var _0x219e77=this;return new Promise(function(_0x169cbf,_0x177c5e){return db[_0x3e20('0x1c')][_0x3e20('0x1d')](_0x4fe401[_0x3e20('0x18')],{'raw':_0x4fe401[_0x3e20('0x19')]?_0x4fe401[_0x3e20('0x19')][_0x3e20('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fe401[_0x3e20('0x19')]?_0x4fe401[_0x3e20('0x19')][_0x3e20('0x1e')]||null:null,'attributes':_0x4fe401['options']?_0x4fe401[_0x3e20('0x19')][_0x3e20('0x1f')]||null:null,'limit':_0x4fe401[_0x3e20('0x19')]?_0x4fe401['options'][_0x3e20('0x20')]||null:null})[_0x3e20('0xb')](function(_0x1f076d){logger[_0x3e20('0x14')]('UpdateWhatsappQueueReport',_0x4fe401);logger[_0x3e20('0xd')](_0x3e20('0x1b'),_0x4fe401,JSON[_0x3e20('0xf')](_0x1f076d));_0x169cbf(_0x1f076d);})['catch'](function(_0x3870e2){logger[_0x3e20('0x10')](_0x3e20('0x1b'),_0x3870e2[_0x3e20('0x13')],_0x4fe401);_0x177c5e(_0x219e77['error'](0x1f4,_0x3870e2[_0x3e20('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index b1ebf39..e9166e8 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 _0x82c7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','express'];(function(_0x3ef999,_0x377005){var _0x156517=function(_0x5eb8dc){while(--_0x5eb8dc){_0x3ef999['push'](_0x3ef999['shift']());}};_0x156517(++_0x377005);}(_0x82c7,0x6f));var _0x782c=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x82c7[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x782c('0x0'));var util=require(_0x782c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x782c('0x2'));var router=express['Router']();var fs_extra=require(_0x782c('0x3'));var auth=require(_0x782c('0x4'));var interaction=require(_0x782c('0x5'));var config=require(_0x782c('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x782c('0x7')]('/',auth[_0x782c('0x8')](),controller[_0x782c('0x9')]);router['get'](_0x782c('0xa'),auth[_0x782c('0x8')](),controller['describe']);router[_0x782c('0x7')]('/:id',auth[_0x782c('0x8')](),controller[_0x782c('0xb')]);router['post']('/',auth[_0x782c('0x8')](),controller[_0x782c('0xc')]);router[_0x782c('0xd')](_0x782c('0xe'),auth[_0x782c('0x8')](),controller[_0x782c('0xf')]);router[_0x782c('0x10')](_0x782c('0xe'),auth['isAuthenticated'](),controller[_0x782c('0x11')]);module[_0x782c('0x12')]=router; \ No newline at end of file +var _0x64c7=['/:id','isAuthenticated','post','create','put','update','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe'];(function(_0x3054fd,_0x2b37a7){var _0x258fd2=function(_0x482978){while(--_0x482978){_0x3054fd['push'](_0x3054fd['shift']());}};_0x258fd2(++_0x2b37a7);}(_0x64c7,0x1a5));var _0x764c=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0x64c7[_0x142020];return _0x40da8f;};'use strict';var multer=require('multer');var util=require(_0x764c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x764c('0x1'));var router=express[_0x764c('0x2')]();var fs_extra=require(_0x764c('0x3'));var auth=require(_0x764c('0x4'));var interaction=require(_0x764c('0x5'));var config=require(_0x764c('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0x764c('0x7')]('/',auth['isAuthenticated'](),controller[_0x764c('0x8')]);router[_0x764c('0x7')](_0x764c('0x9'),auth['isAuthenticated'](),controller[_0x764c('0xa')]);router[_0x764c('0x7')](_0x764c('0xb'),auth[_0x764c('0xc')](),controller['show']);router[_0x764c('0xd')]('/',auth['isAuthenticated'](),controller[_0x764c('0xe')]);router[_0x764c('0xf')](_0x764c('0xb'),auth[_0x764c('0xc')](),controller[_0x764c('0x10')]);router['delete'](_0x764c('0xb'),auth[_0x764c('0xc')](),controller[_0x764c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 731dc98..4284f87 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 _0x153c=['sequelize','exports','STRING','ENUM','agent','queue','DATE'];(function(_0x7e7876,_0x2e3181){var _0x1273f5=function(_0xcf4505){while(--_0xcf4505){_0x7e7876['push'](_0x7e7876['shift']());}};_0x1273f5(++_0x2e3181);}(_0x153c,0x8c));var _0xc153=function(_0x1692ee,_0x416db8){_0x1692ee=_0x1692ee-0x0;var _0x134915=_0x153c[_0x1692ee];return _0x134915;};'use strict';var Sequelize=require(_0xc153('0x0'));module[_0xc153('0x1')]={'uniqueid':{'type':Sequelize[_0xc153('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc153('0x3')]('account',_0xc153('0x4'),_0xc153('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc153('0x6')]}}; \ No newline at end of file +var _0x49f8=['ENUM','account','queue','sequelize'];(function(_0x2442e3,_0x266653){var _0x3a718b=function(_0x592b18){while(--_0x592b18){_0x2442e3['push'](_0x2442e3['shift']());}};_0x3a718b(++_0x266653);}(_0x49f8,0xff));var _0x849f=function(_0xa5fdf4,_0x553bc8){_0xa5fdf4=_0xa5fdf4-0x0;var _0x45a73d=_0x49f8[_0xa5fdf4];return _0x45a73d;};'use strict';var Sequelize=require(_0x849f('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x849f('0x1')](_0x849f('0x2'),'agent',_0x849f('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index f3cc680..80f568e 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 _0x66d8=['undefined','limit','count','offset','set','json','apply','reject','update','then','destroy','end','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','filters','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x66d8,0x1c1));var _0x866d=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x66d8[_0x3cc9d9];return _0x1a425d;};'use strict';var emlformat=require(_0x866d('0x0'));var rimraf=require(_0x866d('0x1'));var zipdir=require(_0x866d('0x2'));var jsonpatch=require(_0x866d('0x3'));var rp=require(_0x866d('0x4'));var moment=require(_0x866d('0x5'));var BPromise=require(_0x866d('0x6'));var Mustache=require('mustache');var util=require(_0x866d('0x7'));var path=require(_0x866d('0x8'));var sox=require(_0x866d('0x9'));var csv=require('to-csv');var ejs=require(_0x866d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x866d('0xb'));var squel=require(_0x866d('0xc'));var crypto=require(_0x866d('0xd'));var jsforce=require(_0x866d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x866d('0xf'));var querystring=require(_0x866d('0x10'));var Papa=require(_0x866d('0x11'));var Redis=require(_0x866d('0x12'));var authService=require(_0x866d('0x13'));var qs=require(_0x866d('0x14'));var as=require(_0x866d('0x15'));var hardwareService=require(_0x866d('0x16'));var logger=require(_0x866d('0x17'))(_0x866d('0x18'));var utils=require(_0x866d('0x19'));var config=require(_0x866d('0x1a'));var licenseUtil=require(_0x866d('0x1b'));var db=require(_0x866d('0x1c'))['db'];function respondWithStatusCode(_0x501e56,_0x109fc4){_0x109fc4=_0x109fc4||0xcc;return function(_0x4abe88){if(_0x4abe88){return _0x501e56[_0x866d('0x1d')](_0x109fc4);}return _0x501e56[_0x866d('0x1e')](_0x109fc4)['end']();};}function respondWithResult(_0x3de8a3,_0x4381f0){_0x4381f0=_0x4381f0||0xc8;return function(_0x3b9a2d){if(_0x3b9a2d){return _0x3de8a3['status'](_0x4381f0)['json'](_0x3b9a2d);}};}function respondWithFilteredResult(_0x45727f,_0x2f52f8){return function(_0x229412){if(_0x229412){var _0x44865e=typeof _0x2f52f8['offset']===_0x866d('0x1f')&&typeof _0x2f52f8[_0x866d('0x20')]===_0x866d('0x1f');var _0x1e04db=_0x229412[_0x866d('0x21')];var _0x5d7781=_0x44865e?0x0:_0x2f52f8[_0x866d('0x22')];var _0x56b0c4=_0x44865e?_0x229412[_0x866d('0x21')]:_0x2f52f8[_0x866d('0x22')]+_0x2f52f8[_0x866d('0x20')];var _0x470b7e;if(_0x56b0c4>=_0x1e04db){_0x56b0c4=_0x1e04db;_0x470b7e=0xc8;}else{_0x470b7e=0xce;}_0x45727f[_0x866d('0x1e')](_0x470b7e);return _0x45727f[_0x866d('0x23')]('Content-Range',_0x5d7781+'-'+_0x56b0c4+'/'+_0x1e04db)[_0x866d('0x24')](_0x229412);}return null;};}function patchUpdates(_0x8ed7f6){return function(_0x1e8af7){try{jsonpatch[_0x866d('0x25')](_0x1e8af7,_0x8ed7f6,!![]);}catch(_0x599614){return BPromise[_0x866d('0x26')](_0x599614);}return _0x1e8af7['save']();};}function saveUpdates(_0x1dce8d,_0x2dee31){return function(_0x29da4b){if(_0x29da4b){return _0x29da4b[_0x866d('0x27')](_0x1dce8d)[_0x866d('0x28')](function(_0x44acbf){return _0x44acbf;});}return null;};}function removeEntity(_0xfef6db,_0x371f90){return function(_0x2cb952){if(_0x2cb952){return _0x2cb952[_0x866d('0x29')]()[_0x866d('0x28')](function(){_0xfef6db[_0x866d('0x1e')](0xcc)[_0x866d('0x2a')]();});}};}function handleEntityNotFound(_0x418119,_0x54171a){return function(_0x29244c){if(!_0x29244c){_0x418119[_0x866d('0x1d')](0x194);}return _0x29244c;};}function handleError(_0x41e7a0,_0x4907cf){_0x4907cf=_0x4907cf||0x1f4;return function(_0x2e2454){logger['error'](_0x2e2454[_0x866d('0x2b')]);if(_0x2e2454[_0x866d('0x2c')]){delete _0x2e2454['name'];}_0x41e7a0[_0x866d('0x1e')](_0x4907cf)[_0x866d('0x2d')](_0x2e2454);};}exports[_0x866d('0x2e')]=function(_0x57f133,_0x2ccc54){var _0x1ac4f0={},_0x2fffa1={},_0x54b296={'count':0x0,'rows':[]};var _0x5ce05f=_[_0x866d('0x2f')](db[_0x866d('0x30')][_0x866d('0x31')],function(_0x48181e){return{'name':_0x48181e[_0x866d('0x32')],'type':_0x48181e[_0x866d('0x33')][_0x866d('0x34')]};});_0x2fffa1['model']=_['map'](_0x5ce05f,_0x866d('0x2c'));_0x2fffa1['query']=_['keys'](_0x57f133['query']);_0x2fffa1[_0x866d('0x35')]=_['intersection'](_0x2fffa1[_0x866d('0x36')],_0x2fffa1[_0x866d('0x37')]);_0x1ac4f0[_0x866d('0x38')]=_[_0x866d('0x39')](_0x2fffa1['model'],qs[_0x866d('0x3a')](_0x57f133['query'][_0x866d('0x3a')]));_0x1ac4f0[_0x866d('0x38')]=_0x1ac4f0[_0x866d('0x38')][_0x866d('0x3b')]?_0x1ac4f0['attributes']:_0x2fffa1[_0x866d('0x36')];if(!_0x57f133[_0x866d('0x37')]['hasOwnProperty'](_0x866d('0x3c'))){_0x1ac4f0[_0x866d('0x20')]=qs[_0x866d('0x20')](_0x57f133[_0x866d('0x37')][_0x866d('0x20')]);_0x1ac4f0['offset']=qs[_0x866d('0x22')](_0x57f133[_0x866d('0x37')][_0x866d('0x22')]);}_0x1ac4f0[_0x866d('0x3d')]=qs[_0x866d('0x3e')](_0x57f133[_0x866d('0x37')][_0x866d('0x3e')]);_0x1ac4f0[_0x866d('0x3f')]=qs[_0x866d('0x35')](_[_0x866d('0x40')](_0x57f133[_0x866d('0x37')],_0x2fffa1[_0x866d('0x35')]),_0x5ce05f);if(_0x57f133[_0x866d('0x37')]['filter']){_0x1ac4f0[_0x866d('0x3f')]=_[_0x866d('0x41')](_0x1ac4f0[_0x866d('0x3f')],{'$or':_[_0x866d('0x2f')](_0x5ce05f,function(_0x3257d1){if(_0x3257d1[_0x866d('0x33')]!==_0x866d('0x42')){var _0x45a4cc={};_0x45a4cc[_0x3257d1[_0x866d('0x2c')]]={'$like':'%'+_0x57f133['query']['filter']+'%'};return _0x45a4cc;}})});}_0x1ac4f0=_['merge']({},_0x1ac4f0,_0x57f133[_0x866d('0x43')]);var _0x144f5c={'where':_0x1ac4f0['where']};return db[_0x866d('0x30')]['count'](_0x144f5c)[_0x866d('0x28')](function(_0x57bd1a){_0x54b296[_0x866d('0x21')]=_0x57bd1a;if(_0x57f133[_0x866d('0x37')]['includeAll']){_0x1ac4f0[_0x866d('0x44')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x866d('0x45')](_0x1ac4f0);})['then'](function(_0xf7d351){_0x54b296[_0x866d('0x46')]=_0xf7d351;return _0x54b296;})[_0x866d('0x28')](respondWithFilteredResult(_0x2ccc54,_0x1ac4f0))['catch'](handleError(_0x2ccc54,null));};exports[_0x866d('0x47')]=function(_0x39306a,_0x1ebbab){var _0x5a23fc={'raw':!![],'where':{'id':_0x39306a[_0x866d('0x48')]['id']}},_0x2e9988={};_0x2e9988[_0x866d('0x36')]=_[_0x866d('0x49')](db[_0x866d('0x30')]['rawAttributes']);_0x2e9988[_0x866d('0x37')]=_[_0x866d('0x49')](_0x39306a['query']);_0x2e9988[_0x866d('0x35')]=_[_0x866d('0x39')](_0x2e9988[_0x866d('0x36')],_0x2e9988[_0x866d('0x37')]);_0x5a23fc[_0x866d('0x38')]=_[_0x866d('0x39')](_0x2e9988[_0x866d('0x36')],qs[_0x866d('0x3a')](_0x39306a[_0x866d('0x37')][_0x866d('0x3a')]));_0x5a23fc[_0x866d('0x38')]=_0x5a23fc[_0x866d('0x38')][_0x866d('0x3b')]?_0x5a23fc['attributes']:_0x2e9988[_0x866d('0x36')];if(_0x39306a[_0x866d('0x37')][_0x866d('0x4a')]){_0x5a23fc[_0x866d('0x44')]=[{'all':!![]}];}_0x5a23fc=_[_0x866d('0x41')]({},_0x5a23fc,_0x39306a[_0x866d('0x43')]);return db[_0x866d('0x30')][_0x866d('0x4b')](_0x5a23fc)['then'](handleEntityNotFound(_0x1ebbab,null))[_0x866d('0x28')](respondWithResult(_0x1ebbab,null))[_0x866d('0x4c')](handleError(_0x1ebbab,null));};exports['create']=function(_0x4a52ca,_0xd63f4){return db['WhatsappTransferReport'][_0x866d('0x4d')](_0x4a52ca[_0x866d('0x4e')],{})[_0x866d('0x28')](respondWithResult(_0xd63f4,0xc9))[_0x866d('0x4c')](handleError(_0xd63f4,null));};exports[_0x866d('0x27')]=function(_0x4f7ef0,_0x392458){if(_0x4f7ef0[_0x866d('0x4e')]['id']){delete _0x4f7ef0['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x4f7ef0[_0x866d('0x48')]['id']}})[_0x866d('0x28')](handleEntityNotFound(_0x392458,null))['then'](saveUpdates(_0x4f7ef0[_0x866d('0x4e')],null))['then'](respondWithResult(_0x392458,null))[_0x866d('0x4c')](handleError(_0x392458,null));};exports[_0x866d('0x29')]=function(_0x2bd0ec,_0x10a93b){return db[_0x866d('0x30')][_0x866d('0x4b')]({'where':{'id':_0x2bd0ec[_0x866d('0x48')]['id']}})[_0x866d('0x28')](handleEntityNotFound(_0x10a93b,null))[_0x866d('0x28')](removeEntity(_0x10a93b,null))['catch'](handleError(_0x10a93b,null));};exports[_0x866d('0x4f')]=function(_0x5e0a03,_0x17b442){return db['WhatsappTransferReport']['describe']()[_0x866d('0x28')](respondWithResult(_0x17b442,null))['catch'](handleError(_0x17b442,null));}; \ No newline at end of file +var _0xaea8=['type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName'];(function(_0x54384e,_0x3bb484){var _0x5da9f1=function(_0x1511a4){while(--_0x1511a4){_0x54384e['push'](_0x54384e['shift']());}};_0x5da9f1(++_0x3bb484);}(_0xaea8,0x1d1));var _0x8aea=function(_0x45266b,_0x51552f){_0x45266b=_0x45266b-0x0;var _0x3ed876=_0xaea8[_0x45266b];return _0x3ed876;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8aea('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8aea('0x1'));var rp=require('request-promise');var moment=require(_0x8aea('0x2'));var BPromise=require(_0x8aea('0x3'));var Mustache=require(_0x8aea('0x4'));var util=require(_0x8aea('0x5'));var path=require(_0x8aea('0x6'));var sox=require(_0x8aea('0x7'));var csv=require(_0x8aea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aea('0x9'));var _=require(_0x8aea('0xa'));var squel=require(_0x8aea('0xb'));var crypto=require(_0x8aea('0xc'));var jsforce=require(_0x8aea('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8aea('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8aea('0xf'));var as=require(_0x8aea('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8aea('0x11'))(_0x8aea('0x12'));var utils=require(_0x8aea('0x13'));var config=require(_0x8aea('0x14'));var licenseUtil=require(_0x8aea('0x15'));var db=require(_0x8aea('0x16'))['db'];function respondWithStatusCode(_0x3bd0c1,_0x40a763){_0x40a763=_0x40a763||0xcc;return function(_0x50fa20){if(_0x50fa20){return _0x3bd0c1['sendStatus'](_0x40a763);}return _0x3bd0c1['status'](_0x40a763)['end']();};}function respondWithResult(_0x15630e,_0x30e054){_0x30e054=_0x30e054||0xc8;return function(_0x33f386){if(_0x33f386){return _0x15630e[_0x8aea('0x17')](_0x30e054)[_0x8aea('0x18')](_0x33f386);}};}function respondWithFilteredResult(_0x13d3cf,_0x4e9821){return function(_0x23639a){if(_0x23639a){var _0x5275eb=typeof _0x4e9821[_0x8aea('0x19')]==='undefined'&&typeof _0x4e9821[_0x8aea('0x1a')]===_0x8aea('0x1b');var _0x331b98=_0x23639a[_0x8aea('0x1c')];var _0x253e8e=_0x5275eb?0x0:_0x4e9821[_0x8aea('0x19')];var _0x297228=_0x5275eb?_0x23639a[_0x8aea('0x1c')]:_0x4e9821['offset']+_0x4e9821[_0x8aea('0x1a')];var _0x59b412;if(_0x297228>=_0x331b98){_0x297228=_0x331b98;_0x59b412=0xc8;}else{_0x59b412=0xce;}_0x13d3cf[_0x8aea('0x17')](_0x59b412);return _0x13d3cf[_0x8aea('0x1d')](_0x8aea('0x1e'),_0x253e8e+'-'+_0x297228+'/'+_0x331b98)['json'](_0x23639a);}return null;};}function patchUpdates(_0x1e69ce){return function(_0x1c72a9){try{jsonpatch[_0x8aea('0x1f')](_0x1c72a9,_0x1e69ce,!![]);}catch(_0x7dbcb8){return BPromise[_0x8aea('0x20')](_0x7dbcb8);}return _0x1c72a9['save']();};}function saveUpdates(_0xb367c0,_0x4453d2){return function(_0x18388d){if(_0x18388d){return _0x18388d[_0x8aea('0x21')](_0xb367c0)[_0x8aea('0x22')](function(_0x3e76bf){return _0x3e76bf;});}return null;};}function removeEntity(_0x4a1421,_0x387638){return function(_0x266e2b){if(_0x266e2b){return _0x266e2b[_0x8aea('0x23')]()[_0x8aea('0x22')](function(){_0x4a1421['status'](0xcc)[_0x8aea('0x24')]();});}};}function handleEntityNotFound(_0x482ba6,_0x49e7f2){return function(_0x3e786e){if(!_0x3e786e){_0x482ba6[_0x8aea('0x25')](0x194);}return _0x3e786e;};}function handleError(_0x3a29cd,_0x2b5fb3){_0x2b5fb3=_0x2b5fb3||0x1f4;return function(_0x5c8362){logger[_0x8aea('0x26')](_0x5c8362['stack']);if(_0x5c8362[_0x8aea('0x27')]){delete _0x5c8362[_0x8aea('0x27')];}_0x3a29cd['status'](_0x2b5fb3)[_0x8aea('0x28')](_0x5c8362);};}exports[_0x8aea('0x29')]=function(_0x1afdc3,_0x1ffc93){var _0x5850bb={},_0x6f151e={},_0x24c3b4={'count':0x0,'rows':[]};var _0x1e5a8c=_[_0x8aea('0x2a')](db[_0x8aea('0x2b')][_0x8aea('0x2c')],function(_0x175c14){return{'name':_0x175c14[_0x8aea('0x2d')],'type':_0x175c14[_0x8aea('0x2e')][_0x8aea('0x2f')]};});_0x6f151e[_0x8aea('0x30')]=_[_0x8aea('0x2a')](_0x1e5a8c,_0x8aea('0x27'));_0x6f151e[_0x8aea('0x31')]=_[_0x8aea('0x32')](_0x1afdc3['query']);_0x6f151e[_0x8aea('0x33')]=_[_0x8aea('0x34')](_0x6f151e[_0x8aea('0x30')],_0x6f151e[_0x8aea('0x31')]);_0x5850bb[_0x8aea('0x35')]=_[_0x8aea('0x34')](_0x6f151e[_0x8aea('0x30')],qs['fields'](_0x1afdc3[_0x8aea('0x31')][_0x8aea('0x36')]));_0x5850bb[_0x8aea('0x35')]=_0x5850bb[_0x8aea('0x35')][_0x8aea('0x37')]?_0x5850bb['attributes']:_0x6f151e[_0x8aea('0x30')];if(!_0x1afdc3[_0x8aea('0x31')]['hasOwnProperty']('nolimit')){_0x5850bb['limit']=qs[_0x8aea('0x1a')](_0x1afdc3['query'][_0x8aea('0x1a')]);_0x5850bb[_0x8aea('0x19')]=qs[_0x8aea('0x19')](_0x1afdc3['query'][_0x8aea('0x19')]);}_0x5850bb['order']=qs[_0x8aea('0x38')](_0x1afdc3[_0x8aea('0x31')]['sort']);_0x5850bb[_0x8aea('0x39')]=qs[_0x8aea('0x33')](_[_0x8aea('0x3a')](_0x1afdc3[_0x8aea('0x31')],_0x6f151e[_0x8aea('0x33')]),_0x1e5a8c);if(_0x1afdc3[_0x8aea('0x31')]['filter']){_0x5850bb[_0x8aea('0x39')]=_[_0x8aea('0x3b')](_0x5850bb['where'],{'$or':_[_0x8aea('0x2a')](_0x1e5a8c,function(_0x98b326){if(_0x98b326[_0x8aea('0x2e')]!==_0x8aea('0x3c')){var _0x93330c={};_0x93330c[_0x98b326[_0x8aea('0x27')]]={'$like':'%'+_0x1afdc3[_0x8aea('0x31')]['filter']+'%'};return _0x93330c;}})});}_0x5850bb=_[_0x8aea('0x3b')]({},_0x5850bb,_0x1afdc3[_0x8aea('0x3d')]);var _0x529e2d={'where':_0x5850bb[_0x8aea('0x39')]};return db[_0x8aea('0x2b')][_0x8aea('0x1c')](_0x529e2d)[_0x8aea('0x22')](function(_0x540110){_0x24c3b4[_0x8aea('0x1c')]=_0x540110;if(_0x1afdc3[_0x8aea('0x31')][_0x8aea('0x3e')]){_0x5850bb['include']=[{'all':!![]}];}return db[_0x8aea('0x2b')][_0x8aea('0x3f')](_0x5850bb);})['then'](function(_0x4fbd3f){_0x24c3b4[_0x8aea('0x40')]=_0x4fbd3f;return _0x24c3b4;})[_0x8aea('0x22')](respondWithFilteredResult(_0x1ffc93,_0x5850bb))[_0x8aea('0x41')](handleError(_0x1ffc93,null));};exports[_0x8aea('0x42')]=function(_0x503ea5,_0x334dfb){var _0x157ce4={'raw':!![],'where':{'id':_0x503ea5[_0x8aea('0x43')]['id']}},_0x5e9756={};_0x5e9756[_0x8aea('0x30')]=_[_0x8aea('0x32')](db[_0x8aea('0x2b')][_0x8aea('0x2c')]);_0x5e9756['query']=_[_0x8aea('0x32')](_0x503ea5['query']);_0x5e9756[_0x8aea('0x33')]=_[_0x8aea('0x34')](_0x5e9756[_0x8aea('0x30')],_0x5e9756[_0x8aea('0x31')]);_0x157ce4['attributes']=_[_0x8aea('0x34')](_0x5e9756[_0x8aea('0x30')],qs[_0x8aea('0x36')](_0x503ea5[_0x8aea('0x31')]['fields']));_0x157ce4[_0x8aea('0x35')]=_0x157ce4[_0x8aea('0x35')][_0x8aea('0x37')]?_0x157ce4['attributes']:_0x5e9756[_0x8aea('0x30')];if(_0x503ea5['query'][_0x8aea('0x3e')]){_0x157ce4[_0x8aea('0x44')]=[{'all':!![]}];}_0x157ce4=_[_0x8aea('0x3b')]({},_0x157ce4,_0x503ea5['options']);return db[_0x8aea('0x2b')][_0x8aea('0x45')](_0x157ce4)[_0x8aea('0x22')](handleEntityNotFound(_0x334dfb,null))['then'](respondWithResult(_0x334dfb,null))['catch'](handleError(_0x334dfb,null));};exports[_0x8aea('0x46')]=function(_0x5abaaf,_0x250fad){return db[_0x8aea('0x2b')][_0x8aea('0x46')](_0x5abaaf['body'],{})[_0x8aea('0x22')](respondWithResult(_0x250fad,0xc9))[_0x8aea('0x41')](handleError(_0x250fad,null));};exports['update']=function(_0x4a0122,_0x1ef24f){if(_0x4a0122['body']['id']){delete _0x4a0122[_0x8aea('0x47')]['id'];}return db[_0x8aea('0x2b')][_0x8aea('0x45')]({'where':{'id':_0x4a0122['params']['id']}})[_0x8aea('0x22')](handleEntityNotFound(_0x1ef24f,null))[_0x8aea('0x22')](saveUpdates(_0x4a0122[_0x8aea('0x47')],null))['then'](respondWithResult(_0x1ef24f,null))[_0x8aea('0x41')](handleError(_0x1ef24f,null));};exports['destroy']=function(_0x25855b,_0x533d1f){return db[_0x8aea('0x2b')][_0x8aea('0x45')]({'where':{'id':_0x25855b['params']['id']}})[_0x8aea('0x22')](handleEntityNotFound(_0x533d1f,null))[_0x8aea('0x22')](removeEntity(_0x533d1f,null))[_0x8aea('0x41')](handleError(_0x533d1f,null));};exports[_0x8aea('0x48')]=function(_0x13dc98,_0x1fb98e){return db['WhatsappTransferReport'][_0x8aea('0x48')]()[_0x8aea('0x22')](respondWithResult(_0x1fb98e,null))[_0x8aea('0x41')](handleError(_0x1fb98e,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 170f2d8..9fde065 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 _0x529d=['uniqueid','util','api','moment','bluebird','request-promise','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x14b883,_0x39cd7d){var _0x31325f=function(_0x6d9c8e){while(--_0x6d9c8e){_0x14b883['push'](_0x14b883['shift']());}};_0x31325f(++_0x39cd7d);}(_0x529d,0x1c4));var _0xd529=function(_0x1e93ce,_0x56a18f){_0x1e93ce=_0x1e93ce-0x0;var _0x35f4a4=_0x529d[_0x1e93ce];return _0x35f4a4;};'use strict';var _=require('lodash');var util=require(_0xd529('0x0'));var logger=require('../../config/logger')(_0xd529('0x1'));var moment=require(_0xd529('0x2'));var BPromise=require(_0xd529('0x3'));var rp=require(_0xd529('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd529('0x5'));module[_0xd529('0x6')]=function(_0x172f5f,_0x184b0f){return _0x172f5f[_0xd529('0x7')](_0xd529('0x8'),attributes,{'tableName':_0xd529('0x9'),'paranoid':![],'indexes':[{'name':_0xd529('0xa'),'fields':[_0xd529('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a78=['path','rimraf','../../config/environment','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x0a78,0xcc));var _0x80a7=function(_0x1450ec,_0x22717b){_0x1450ec=_0x1450ec-0x0;var _0x2dc025=_0x0a78[_0x1450ec];return _0x2dc025;};'use strict';var _=require(_0x80a7('0x0'));var util=require(_0x80a7('0x1'));var logger=require(_0x80a7('0x2'))(_0x80a7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x80a7('0x4'));var fs=require('fs');var path=require(_0x80a7('0x5'));var rimraf=require(_0x80a7('0x6'));var config=require(_0x80a7('0x7'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x216320,_0x4682c9){return _0x216320['define'](_0x80a7('0x8'),attributes,{'tableName':_0x80a7('0x9'),'paranoid':![],'indexes':[{'name':_0x80a7('0xa'),'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 c9d7511..202db55 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 _0xc05b=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2b763e,_0x4b9869){var _0x5540cc=function(_0x183408){while(--_0x183408){_0x2b763e['push'](_0x2b763e['shift']());}};_0x5540cc(++_0x4b9869);}(_0xc05b,0x156));var _0xbc05=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0xc05b[_0x4ce028];return _0x583d0c;};'use strict';var _=require(_0xbc05('0x0'));var util=require(_0xbc05('0x1'));var moment=require(_0xbc05('0x2'));var BPromise=require(_0xbc05('0x3'));var rs=require(_0xbc05('0x4'));var fs=require('fs');var Redis=require(_0xbc05('0x5'));var db=require(_0xbc05('0x6'))['db'];var utils=require(_0xbc05('0x7'));var logger=require(_0xbc05('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc05('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a15b9,_0x46731d,_0x36724d){return new BPromise(function(_0x731196,_0x3515bd){return client[_0xbc05('0xa')](_0x3a15b9,_0x36724d)['then'](function(_0x5e14b1){logger[_0xbc05('0xb')](_0xbc05('0xc'),_0x46731d,_0xbc05('0xd'));logger[_0xbc05('0xe')](_0xbc05('0xf'),_0x46731d,_0xbc05('0xd'),JSON['stringify'](_0x5e14b1));if(_0x5e14b1[_0xbc05('0x10')]){if(_0x5e14b1['error'][_0xbc05('0x11')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x46731d,_0x5e14b1['error'][_0xbc05('0x12')]);return _0x3515bd(_0x5e14b1[_0xbc05('0x10')][_0xbc05('0x12')]);}logger[_0xbc05('0x10')](_0xbc05('0xc'),_0x46731d,_0x5e14b1['error'][_0xbc05('0x12')]);return _0x731196(_0x5e14b1[_0xbc05('0x10')]['message']);}else{logger[_0xbc05('0xb')](_0xbc05('0xc'),_0x46731d,_0xbc05('0xd'));_0x731196(_0x5e14b1[_0xbc05('0x13')][_0xbc05('0x12')]);}})[_0xbc05('0x14')](function(_0xbdc256){logger[_0xbc05('0x10')](_0xbc05('0xc'),_0x46731d,_0xbdc256);_0x3515bd(_0xbdc256);});});} \ No newline at end of file +var _0x4658=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x55b460,_0x497077){var _0x3ac537=function(_0xd709b3){while(--_0xd709b3){_0x55b460['push'](_0x55b460['shift']());}};_0x3ac537(++_0x497077);}(_0x4658,0xe7));var _0x8465=function(_0xc3c3e,_0x4e9fe0){_0xc3c3e=_0xc3c3e-0x0;var _0xc2d1f4=_0x4658[_0xc3c3e];return _0xc2d1f4;};'use strict';var _=require(_0x8465('0x0'));var util=require(_0x8465('0x1'));var moment=require(_0x8465('0x2'));var BPromise=require(_0x8465('0x3'));var rs=require(_0x8465('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8465('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8465('0x6'))('rpc');var config=require(_0x8465('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8465('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x372748,_0x4cac16,_0x4dd64f){return new BPromise(function(_0x5a1d7c,_0x3b009d){return client[_0x8465('0x9')](_0x372748,_0x4dd64f)[_0x8465('0xa')](function(_0x24724d){logger[_0x8465('0xb')](_0x8465('0xc'),_0x4cac16,'request\x20sent');logger['debug'](_0x8465('0xd'),_0x4cac16,'request\x20sent',JSON[_0x8465('0xe')](_0x24724d));if(_0x24724d[_0x8465('0xf')]){if(_0x24724d[_0x8465('0xf')][_0x8465('0x10')]===0x1f4){logger[_0x8465('0xf')](_0x8465('0xc'),_0x4cac16,_0x24724d['error'][_0x8465('0x11')]);return _0x3b009d(_0x24724d[_0x8465('0xf')]['message']);}logger[_0x8465('0xf')](_0x8465('0xc'),_0x4cac16,_0x24724d[_0x8465('0xf')][_0x8465('0x11')]);return _0x5a1d7c(_0x24724d['error'][_0x8465('0x11')]);}else{logger[_0x8465('0xb')](_0x8465('0xc'),_0x4cac16,_0x8465('0x12'));_0x5a1d7c(_0x24724d[_0x8465('0x13')][_0x8465('0x11')]);}})[_0x8465('0x14')](function(_0x57f13e){logger[_0x8465('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4cac16,_0x57f13e);_0x3b009d(_0x57f13e);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 7adf113..7fcced0 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9432=['None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/license','./rpc','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','number','length','name','Online\x20apps:','map','join','Offline\x20apps:','online'];(function(_0x74c31d,_0x2ff936){var _0x25ac61=function(_0x4a0839){while(--_0x4a0839){_0x74c31d['push'](_0x74c31d['shift']());}};_0x25ac61(++_0x2ff936);}(_0x9432,0x1e3));var _0x2943=function(_0x38f3ae,_0x1d52b9){_0x38f3ae=_0x38f3ae-0x0;var _0x140afa=_0x9432[_0x38f3ae];return _0x140afa;};'use strict';var _=require(_0x2943('0x0'));var db=require(_0x2943('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x2943('0x2'));var rpc=require(_0x2943('0x3'));var config=require('./config/environment');var logger=require(_0x2943('0x4'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x2943('0x5'));var schedule=require(_0x2943('0x6'));var chat=require(_0x2943('0x7'));var whatsapp=require(_0x2943('0x8'));var transcribe=require(_0x2943('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x2943('0xa')][_0x2943('0xb')]()[_0x2943('0xc')](function(){if(config[_0x2943('0xd')]){return seedDb['default']();}})[_0x2943('0xc')](function(){return checkLicense[_0x2943('0xe')]();})[_0x2943('0xc')](function(){return rpc['listen']();})[_0x2943('0xc')](function(_0x4f0262){logger[_0x2943('0xf')](_0x4f0262);return chat[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return whatsapp[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return schedule[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return transcribe[_0x2943('0x10')]();})[_0x2943('0xc')](function(){return provider[_0x2943('0x10')]();})[_0x2943('0xc')](function(_0x1a246c){logger[_0x2943('0xf')](_0x1a246c);return pm2['start'](pm2Config);})[_0x2943('0xc')](function(_0x32b897){var _0x19bbfd=_0x32b897[_0x2943('0x11')](function(_0x11a622){return typeof _0x11a622[_0x2943('0x12')]===_0x2943('0x13')&&_0x11a622['exitCode']>=0x0;});if(_0x19bbfd['length']>0x0){throw new Error(_0x19bbfd[_0x2943('0x14')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x19bbfd,function(_0x10f6bc){return'\x22'+_0x10f6bc['pm2_env'][_0x2943('0x15')]+'\x22';}));}logger['info'](_0x2943('0x16'),_[_0x2943('0x17')](_[_0x2943('0x11')](_0x32b897,{'status':'online'}),_0x2943('0x15'))[_0x2943('0x18')]());logger['info'](_0x2943('0x19'),_[_0x2943('0x17')](_[_0x2943('0x11')](_0x32b897,function(_0x1a107a){return _0x1a107a['status']!==_0x2943('0x1a');}),_0x2943('0x15'))['join']()||_0x2943('0x1b'));console[_0x2943('0x1c')](_0x2943('0x1d'));})[_0x2943('0x1e')](function(_0x4fcdc3){console[_0x2943('0x1c')](_0x2943('0x1f'),_0x4fcdc3);logger[_0x2943('0x20')](_0x2943('0x21'),_0x4fcdc3);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x34aa=['join','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/seedDB','./config/license','./rpc','./config/environment','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','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','Offline\x20apps:','status'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x34aa,0x171));var _0xa34a=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x34aa[_0x456a4b];return _0x42957c;};'use strict';var _=require(_0xa34a('0x0'));var db=require('./mysqldb')['db'];var seedDb=require(_0xa34a('0x1'));var checkLicense=require(_0xa34a('0x2'));var rpc=require(_0xa34a('0x3'));var config=require(_0xa34a('0x4'));var logger=require('./config/logger')(_0xa34a('0x5'));var pm2=require(_0xa34a('0x6'));var pm2Config=require(_0xa34a('0x7'));var schedule=require(_0xa34a('0x8'));var chat=require(_0xa34a('0x9'));var whatsapp=require(_0xa34a('0xa'));var transcribe=require(_0xa34a('0xb'));var provider=require(_0xa34a('0xc'));function main(){return db[_0xa34a('0xd')][_0xa34a('0xe')]()[_0xa34a('0xf')](function(){if(config['seedDB']){return seedDb[_0xa34a('0x10')]();}})[_0xa34a('0xf')](function(){return checkLicense[_0xa34a('0x10')]();})[_0xa34a('0xf')](function(){return rpc[_0xa34a('0x11')]();})['then'](function(_0x864029){logger[_0xa34a('0x12')](_0x864029);return chat[_0xa34a('0x13')]();})[_0xa34a('0xf')](function(){return whatsapp[_0xa34a('0x13')]();})[_0xa34a('0xf')](function(){return schedule[_0xa34a('0x13')]();})['then'](function(){return transcribe[_0xa34a('0x13')]();})[_0xa34a('0xf')](function(){return provider[_0xa34a('0x13')]();})['then'](function(_0xc08e6){logger[_0xa34a('0x12')](_0xc08e6);return pm2['start'](pm2Config);})[_0xa34a('0xf')](function(_0x3d5926){var _0x5af32c=_0x3d5926[_0xa34a('0x14')](function(_0x7ac9a2){return typeof _0x7ac9a2[_0xa34a('0x15')]===_0xa34a('0x16')&&_0x7ac9a2[_0xa34a('0x15')]>=0x0;});if(_0x5af32c['length']>0x0){throw new Error(_0x5af32c[_0xa34a('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xa34a('0x18')](_0x5af32c,function(_0x14837d){return'\x22'+_0x14837d[_0xa34a('0x19')][_0xa34a('0x1a')]+'\x22';}));}logger['info'](_0xa34a('0x1b'),_[_0xa34a('0x18')](_[_0xa34a('0x14')](_0x3d5926,{'status':_0xa34a('0x1c')}),_0xa34a('0x1a'))['join']());logger[_0xa34a('0x12')](_0xa34a('0x1d'),_[_0xa34a('0x18')](_['filter'](_0x3d5926,function(_0x14a18b){return _0x14a18b[_0xa34a('0x1e')]!==_0xa34a('0x1c');}),_0xa34a('0x1a'))[_0xa34a('0x1f')]()||_0xa34a('0x20'));console['log'](_0xa34a('0x21'));})[_0xa34a('0x22')](function(_0x5f030c){console[_0xa34a('0x23')](_0xa34a('0x24'),_0x5f030c);logger[_0xa34a('0x25')](_0xa34a('0x26'),_0x5f030c);process[_0xa34a('0x27')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 7a5bcca..3df3cf1 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 _0x0972=['allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','hotdesk','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isAuthenticated','use','user','findOne','closed','disposition','then','status','json','unmanaged','Forbidden.','catch','authorization','startsWith','Basic','User','find','authenticate','Wrong\x20credentials.','headers','Unknown\x20authorization\x20format','apikey','getUuid','sub','allowedLoginAttempts','blockDuration','isEqual','nonce','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','canUpdate','update','Forbidden','webrtc','signToken','cookie','motion.token','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','session','payload','randomBytes','floor','now','toString','HS512','../../config/environment','../../config/license/util','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x0972,0x64));var _0x2097=function(_0x3e6b76,_0x1f94d7){_0x3e6b76=_0x3e6b76-0x0;var _0x47465f=_0x0972[_0x3e6b76];return _0x47465f;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x2097('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x2097('0x1'));var encryptor=require('../encryptor');var _=require(_0x2097('0x2'));var jwt=require(_0x2097('0x3'));var expressJwt=require('express-jwt');var compose=require(_0x2097('0x4'));var basicAuth=require(_0x2097('0x5'));var crypto=require(_0x2097('0x6'));var BPromise=require(_0x2097('0x7'));var util=require(_0x2097('0x8'));var moment=require(_0x2097('0x9'));var validateJwt=expressJwt({'secret':config[_0x2097('0xa')]['session']});var userAttributes=['id',_0x2097('0xb'),_0x2097('0xc'),_0x2097('0xd'),_0x2097('0xe'),_0x2097('0xf'),'userpic',_0x2097('0x10'),_0x2097('0x11'),_0x2097('0x12'),_0x2097('0x13'),_0x2097('0x14'),_0x2097('0x15'),_0x2097('0x16'),_0x2097('0x17'),_0x2097('0x18'),_0x2097('0x19'),_0x2097('0x1a'),_0x2097('0x1b'),_0x2097('0x1c'),_0x2097('0x1d'),_0x2097('0x1e'),_0x2097('0x1f'),_0x2097('0x20'),_0x2097('0x21'),_0x2097('0x22'),_0x2097('0x23'),'phoneBarEnableDtmfTone',_0x2097('0x24'),_0x2097('0x25'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0x2097('0x26'),'interface',_0x2097('0x27'),_0x2097('0x28'),_0x2097('0x29'),_0x2097('0x2a'),_0x2097('0x2b'),'downloadOmnichannelInteractions',_0x2097('0x2c'),_0x2097('0x2d'),_0x2097('0x2e'),_0x2097('0x2f'),_0x2097('0x30'),_0x2097('0x31'),_0x2097('0x32'),_0x2097('0x33'),'smsAutoanswerDelay','openchannelAutoanswer',_0x2097('0x34'),'faxAutoanswer',_0x2097('0x35'),_0x2097('0x36'),'whatsappAutoanswerDelay',_0x2097('0x37')];exports['isChatInteractionAuthorized']=function(){return this[_0x2097('0x38')](!![])[_0x2097('0x39')](function(_0x36189e,_0x20b93a,_0x36b15e){if(_0x36189e[_0x2097('0x3a')]){_0x36b15e();}else{return db['ChatInteraction'][_0x2097('0x3b')]({'where':{'id':_0x36189e['params']['id']},'attributes':['id',_0x2097('0x3c'),_0x2097('0x3d')],'raw':!![]})[_0x2097('0x3e')](function(_0x9f59bc){if(_0x9f59bc&&_0x9f59bc['closed']){return _0x20b93a[_0x2097('0x3f')](_0x9f59bc[_0x2097('0x3d')]==='unmanaged'?0x195:0x193)[_0x2097('0x40')]({'message':_0x9f59bc['disposition']===_0x2097('0x41')?'Unmanaged.':_0x2097('0x42')});}else{_0x36b15e();}})[_0x2097('0x43')](function(_0x407a2a){_0x36b15e(_0x407a2a);});}});};exports[_0x2097('0x38')]=function isAuthenticated(_0x410afa){return compose()[_0x2097('0x39')](function(_0x450e0b,_0x4b443d,_0x11242f){var _0x14d964;if(_0x450e0b['headers'][_0x2097('0x44')]){if(_[_0x2097('0x45')](_0x450e0b['headers']['authorization'],_0x2097('0x46'))){var _0x11b051=basicAuth(_0x450e0b);db[_0x2097('0x47')][_0x2097('0x48')]({'where':{'name':_0x11b051[_0x2097('0xd')]}})[_0x2097('0x3e')](function(_0x56c538){if(!_0x56c538||!_0x56c538[_0x2097('0x49')](_0x11b051['pass'])){return _0x4b443d[_0x2097('0x3f')](0x191)[_0x2097('0x40')]({'message':_0x2097('0x4a')});}_0x450e0b[_0x2097('0x3a')]={'id':_0x56c538['id']};_0x11242f();})[_0x2097('0x43')](function(_0x395d9f){_0x11242f(_0x395d9f);});}else if(_[_0x2097('0x45')](_0x450e0b[_0x2097('0x4b')][_0x2097('0x44')],'Bearer')){validateJwt(_0x450e0b,_0x4b443d,_0x11242f);}else{if(_0x410afa){_0x11242f();}else{return _0x4b443d[_0x2097('0x3f')](0x193)[_0x2097('0x40')]({'message':_0x2097('0x4c')});}}}else if(_0x450e0b['query'][_0x2097('0x4d')]){try{var _0x3bda50={'audience':hardwareConf[_0x2097('0x4e')](),'issuer':hardwareConf[_0x2097('0x4e')]()};verifyJwt(_0x450e0b['query']['apikey'],_0x3bda50)['then'](function(_0x3484ff){return db[_0x2097('0x47')][_0x2097('0x48')]({'where':{'id':_0x3484ff[_0x2097('0x4f')]}})[_0x2097('0x3e')](function(_0x296281){_0x14d964=_0x296281;return db['Setting'][_0x2097('0x3b')]({'where':{'id':0x1},'attributes':[_0x2097('0x50'),_0x2097('0x51')],'raw':!![]});})[_0x2097('0x3e')](function(_0x25375f){if(!_0x14d964||!_[_0x2097('0x52')](_0x14d964['apiKeyNonce'],_0x3484ff[_0x2097('0x53')])){return _0x4b443d[_0x2097('0x3f')](0x191)[_0x2097('0x40')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x14d964['disabled']){return _0x4b443d[_0x2097('0x3f')](0x191)[_0x2097('0x40')]({'message':_0x2097('0x54')});}if(_0x14d964[_0x2097('0x55')]){if(_0x25375f[_0x2097('0x51')]>0x0){if(moment(_0x14d964[_0x2097('0x56')])[_0x2097('0x57')](_0x25375f[_0x2097('0x51')],_0x2097('0x58'))>moment()){return _0x4b443d[_0x2097('0x3f')](0x191)[_0x2097('0x40')]({'message':_0x2097('0x54')});}}else{return _0x4b443d['status'](0x191)[_0x2097('0x40')]({'message':_0x2097('0x54')});}}_0x450e0b[_0x2097('0x3a')]={'id':_0x14d964['id']};_0x11242f();});})['catch'](function(){return _0x4b443d[_0x2097('0x3f')](0x191)[_0x2097('0x40')]({'message':_0x2097('0x54')});});}catch(_0xf9fba7){_0x11242f(_0xf9fba7);}}else if(_0x410afa){_0x11242f();}else{return _0x4b443d[_0x2097('0x3f')](0x193)[_0x2097('0x40')]({'message':_0x2097('0x4c')});}})[_0x2097('0x39')](function(_0x5ab893,_0x11c825,_0x283adc){if(_0x5ab893[_0x2097('0x3a')]){db[_0x2097('0x47')][_0x2097('0x48')]({'where':{'id':_0x5ab893[_0x2097('0x3a')]['id']},'attributes':userAttributes})[_0x2097('0x3e')](function(_0x280ecd){if(!_0x280ecd){return _0x11c825['status'](0x194)[_0x2097('0x40')]({'message':'User\x20not\x20found.'});}_0x5ab893[_0x2097('0x3a')]=_0x280ecd;_0x283adc();})[_0x2097('0x43')](function(_0x370cc6){_0x283adc(_0x370cc6);});}else if(_0x410afa){_0x283adc();}else{return _0x11c825[_0x2097('0x3f')](0x194)[_0x2097('0x40')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x2097('0x59')]=function canUpdate(){return compose()[_0x2097('0x39')](function(_0x113c3b,_0x39e0a4,_0x1e04f8){return licenseUtil['getLicense']()[_0x2097('0x3e')](function(_0x37cdb9){if(_0x37cdb9[_0x2097('0x5a')]){_0x1e04f8();}else{return _0x39e0a4[_0x2097('0x3f')](0x193)[_0x2097('0x40')]({'message':_0x2097('0x5b')});}})[_0x2097('0x43')](function(_0x40ec03){_0x1e04f8(_0x40ec03);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x2097('0x39')](function(_0x594804,_0x305657,_0xfe13c8){return licenseUtil['getLicense']()['then'](function(_0x4b6331){if(_0x4b6331[_0x2097('0x5c')]){_0xfe13c8();}else{return _0x305657[_0x2097('0x3f')](0x193)['json']({'message':_0x2097('0x5b')});}})[_0x2097('0x43')](function(_0x5daafd){_0xfe13c8(_0x5daafd);});});};exports['isMiddleware']=function(_0x23acf3,_0x21829d,_0x1b4de6){_0x23acf3['isMiddleware']=!![];return _0x1b4de6();};exports[_0x2097('0x5d')]=function signToken(_0x2881f8){return signJwt(_0x2881f8);};exports['setTokenCookie']=function(_0x86a05a,_0x2682a9){if(!_0x86a05a[_0x2097('0x3a')]){return _0x2682a9[_0x2097('0x3f')](0x194)[_0x2097('0x40')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x5127d9={'payload':{'id':_0x86a05a[_0x2097('0x3a')]['id'],'role':_0x86a05a[_0x2097('0x3a')][_0x2097('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5127d9)['then'](function(_0x5c1739){_0x2682a9[_0x2097('0x5e')](_0x2097('0x5f'),_0x5c1739);_0x2682a9['redirect'](_0x2097('0x60'));})[_0x2097('0x43')](function(_0x12bdbd){return _0x2682a9[_0x2097('0x3f')](0x1f4)[_0x2097('0x61')](_0x12bdbd);});};exports['retrieveApiKey']=function(_0x42b222){if(_[_0x2097('0x62')](_0x42b222[_0x2097('0x63')])||_['isNil'](_0x42b222[_0x2097('0x64')])){return null;}else{return createJwt(_0x42b222);}};exports[_0x2097('0x65')]=function(_0x4edf1d){_0x4edf1d[_0x2097('0x63')]=generateNonce();_0x4edf1d['apiKeyIat']=generateIssuedAt();return createJwt(_0x4edf1d);};exports[_0x2097('0x66')]=function(_0x56a0d1,_0x48742a){var _0x5d4f35=_0x56a0d1[_0x2097('0x67')]['apikey'];if(_0x5d4f35){var _0x54bea1={'nonce':_0x48742a[_0x2097('0x63')],'iat':_0x48742a['apiKeyIat'],'audience':hardwareConf[_0x2097('0x4e')](),'issuer':hardwareConf[_0x2097('0x4e')]()};return verifyJwt(_0x5d4f35,_0x54bea1)['then'](function(){return generateApiKey(_0x48742a);});}else{throw{'message':_0x2097('0x68')};}};exports[_0x2097('0x69')]=function(_0x3445fc){var _0x924537=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x924537[_0x2097('0x6a')](_0x3445fc))throw new db['Sequelize'][(_0x2097('0x6b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x2097('0x6c')]=function(_0x140e43,_0x24f166,_0x55e3cd){var _0x365499=encryptor[_0x2097('0x6d')](_0x24f166)[_0x2097('0x6e')](',');for(var _0x168a7d=0x0;_0x168a7d<_0x55e3cd;_0x168a7d++){if(!_0x365499[_0x168a7d])break;if(_0x140e43[_0x2097('0x6f')]()===_0x365499[_0x168a7d]['toLowerCase']()){var _0x5b9fa2=util[_0x2097('0x70')](_0x2097('0x71'),_0x55e3cd);if(_0x55e3cd===0x1){_0x5b9fa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x5b9fa2);}}return;};exports['updatePasswordsHistory']=function(_0x14b2d4,_0x4cdc65){var _0x4445ff=_0x4cdc65?encryptor[_0x2097('0x6d')](_0x4cdc65)['split'](','):[];if(_0x4445ff[_0x2097('0x72')]===0x5){_0x4445ff[_0x2097('0x73')](-0x1,0x1);}_0x4445ff[_0x2097('0x74')](_0x14b2d4);return encryptor[_0x2097('0x75')](_0x4445ff[_0x2097('0x76')](','));};function signJwt(_0x60332a){var _0x15aa91=BPromise[_0x2097('0x77')](jwt[_0x2097('0x78')],{'context':jwt});var _0x586922=_0x60332a[_0x2097('0x79')]||config[_0x2097('0xa')][_0x2097('0x7a')];return new BPromise(function(_0x4705e1,_0x412321){_0x15aa91(_0x60332a[_0x2097('0x7b')],_0x586922,_0x60332a['options'])[_0x2097('0x3e')](function(_0x27ed29){_0x4705e1(_0x27ed29);})[_0x2097('0x43')](function(_0x3c3b38){_0x412321(_0x3c3b38);});});}function verifyJwt(_0x1c4156,_0x5d6b8a,_0x437b79){var _0x28dd95=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x580c1e=_0x437b79||config[_0x2097('0xa')][_0x2097('0x7a')];return new BPromise(function(_0x319d3b,_0x3edb3e){_0x28dd95(_0x1c4156,_0x580c1e,_0x5d6b8a)[_0x2097('0x3e')](function(_0x18d90a){_0x319d3b(_0x18d90a);})[_0x2097('0x43')](function(_0x2ce256){_0x3edb3e(_0x2ce256);});});}function generateNonce(){return crypto[_0x2097('0x7c')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0x2097('0x7d')](Date[_0x2097('0x7e')]()/0x3e8)[_0x2097('0x7f')]();}function createJwt(_0x2bdf29){var _0x4649dc={'payload':{'iat':_0x2bdf29[_0x2097('0x64')],'nonce':_0x2bdf29['apiKeyNonce']},'options':{'algorithm':_0x2097('0x80'),'subject':_0x2bdf29['id'][_0x2097('0x7f')](),'issuer':hardwareConf[_0x2097('0x4e')](),'audience':hardwareConf[_0x2097('0x4e')]()}};return signJwt(_0x4649dc)['then'](function(_0x5f4cf9){return{'iat':_0x2bdf29[_0x2097('0x64')],'nonce':_0x2bdf29[_0x2097('0x63')],'token':_0x5f4cf9};});} \ No newline at end of file +var _0xe511=['phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','closed','disposition','then','unmanaged','json','Unmanaged.','headers','authorization','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','startsWith','Unknown\x20authorization\x20format','apikey','getUuid','findOne','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','isMiddleware','setTokenCookie','role','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','encryptString','join','promisify','sign','secret','session','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','fullname','name','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires'];(function(_0x541587,_0x494e6b){var _0x5d8b69=function(_0x32bcca){while(--_0x32bcca){_0x541587['push'](_0x541587['shift']());}};_0x5d8b69(++_0x494e6b);}(_0xe511,0x16f));var _0x1e51=function(_0x1e72d7,_0x46057b){_0x1e72d7=_0x1e72d7-0x0;var _0x5a8f0e=_0xe511[_0x1e72d7];return _0x5a8f0e;};'use strict';var db=require(_0x1e51('0x0'))['db'];var config=require(_0x1e51('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x1e51('0x2'));var encryptor=require('../encryptor');var _=require(_0x1e51('0x3'));var jwt=require(_0x1e51('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x1e51('0x5'));var basicAuth=require(_0x1e51('0x6'));var crypto=require(_0x1e51('0x7'));var BPromise=require(_0x1e51('0x8'));var util=require('util');var moment=require(_0x1e51('0x9'));var validateJwt=expressJwt({'secret':config[_0x1e51('0xa')]['session']});var userAttributes=['id','role',_0x1e51('0xb'),_0x1e51('0xc'),'internal','email',_0x1e51('0xd'),_0x1e51('0xe'),_0x1e51('0xf'),_0x1e51('0x10'),_0x1e51('0x11'),_0x1e51('0x12'),'faxPause',_0x1e51('0x13'),_0x1e51('0x14'),_0x1e51('0x15'),_0x1e51('0x16'),_0x1e51('0x17'),_0x1e51('0x18'),'crudPermissions',_0x1e51('0x19'),_0x1e51('0x1a'),_0x1e51('0x1b'),_0x1e51('0x1c'),_0x1e51('0x1d'),_0x1e51('0x1e'),_0x1e51('0x1f'),_0x1e51('0x20'),_0x1e51('0x21'),_0x1e51('0x22'),'phoneBarPrefixRequired',_0x1e51('0x23'),_0x1e51('0x24'),_0x1e51('0x25'),'interface',_0x1e51('0x26'),'privacyEnabled','settingsEnabled',_0x1e51('0x27'),_0x1e51('0x28'),_0x1e51('0x29'),_0x1e51('0x2a'),_0x1e51('0x2b'),_0x1e51('0x2c'),'chatAutoanswer',_0x1e51('0x2d'),'emailAutoanswer',_0x1e51('0x2e'),_0x1e51('0x2f'),_0x1e51('0x30'),_0x1e51('0x31'),'openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0x1e51('0x32'),'messengerSoundNotification'];exports[_0x1e51('0x33')]=function(){return this[_0x1e51('0x34')](!![])[_0x1e51('0x35')](function(_0x13240f,_0x23c85a,_0xf9298){if(_0x13240f[_0x1e51('0x36')]){_0xf9298();}else{return db[_0x1e51('0x37')]['findOne']({'where':{'id':_0x13240f['params']['id']},'attributes':['id',_0x1e51('0x38'),_0x1e51('0x39')],'raw':!![]})[_0x1e51('0x3a')](function(_0x1386db){if(_0x1386db&&_0x1386db['closed']){return _0x23c85a['status'](_0x1386db['disposition']===_0x1e51('0x3b')?0x195:0x193)[_0x1e51('0x3c')]({'message':_0x1386db[_0x1e51('0x39')]==='unmanaged'?_0x1e51('0x3d'):'Forbidden.'});}else{_0xf9298();}})['catch'](function(_0x3349f0){_0xf9298(_0x3349f0);});}});};exports['isAuthenticated']=function isAuthenticated(_0x170ec6){return compose()[_0x1e51('0x35')](function(_0x56722f,_0x3e6ef2,_0x10ee23){var _0x71c7af;if(_0x56722f[_0x1e51('0x3e')]['authorization']){if(_['startsWith'](_0x56722f['headers'][_0x1e51('0x3f')],_0x1e51('0x40'))){var _0x1ba84a=basicAuth(_0x56722f);db[_0x1e51('0x41')][_0x1e51('0x42')]({'where':{'name':_0x1ba84a[_0x1e51('0xc')]}})[_0x1e51('0x3a')](function(_0x34701c){if(!_0x34701c||!_0x34701c[_0x1e51('0x43')](_0x1ba84a[_0x1e51('0x44')])){return _0x3e6ef2[_0x1e51('0x45')](0x191)['json']({'message':_0x1e51('0x46')});}_0x56722f[_0x1e51('0x36')]={'id':_0x34701c['id']};_0x10ee23();})[_0x1e51('0x47')](function(_0x12da89){_0x10ee23(_0x12da89);});}else if(_[_0x1e51('0x48')](_0x56722f['headers'][_0x1e51('0x3f')],'Bearer')){validateJwt(_0x56722f,_0x3e6ef2,_0x10ee23);}else{if(_0x170ec6){_0x10ee23();}else{return _0x3e6ef2[_0x1e51('0x45')](0x193)[_0x1e51('0x3c')]({'message':_0x1e51('0x49')});}}}else if(_0x56722f['query'][_0x1e51('0x4a')]){try{var _0x58f8b1={'audience':hardwareConf[_0x1e51('0x4b')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x56722f['query'][_0x1e51('0x4a')],_0x58f8b1)[_0x1e51('0x3a')](function(_0x45313e){return db['User'][_0x1e51('0x42')]({'where':{'id':_0x45313e['sub']}})[_0x1e51('0x3a')](function(_0x2df269){_0x71c7af=_0x2df269;return db['Setting'][_0x1e51('0x4c')]({'where':{'id':0x1},'attributes':[_0x1e51('0x4d'),_0x1e51('0x4e')],'raw':!![]});})[_0x1e51('0x3a')](function(_0x146c44){if(!_0x71c7af||!_[_0x1e51('0x4f')](_0x71c7af['apiKeyNonce'],_0x45313e['nonce'])){return _0x3e6ef2[_0x1e51('0x45')](0x191)['json']({'message':_0x1e51('0x50')});}if(_0x71c7af[_0x1e51('0x51')]){return _0x3e6ef2[_0x1e51('0x45')](0x191)[_0x1e51('0x3c')]({'message':_0x1e51('0x52')});}if(_0x71c7af[_0x1e51('0x53')]){if(_0x146c44[_0x1e51('0x4e')]>0x0){if(moment(_0x71c7af[_0x1e51('0x54')])[_0x1e51('0x55')](_0x146c44[_0x1e51('0x4e')],_0x1e51('0x56'))>moment()){return _0x3e6ef2['status'](0x191)[_0x1e51('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x3e6ef2[_0x1e51('0x45')](0x191)[_0x1e51('0x3c')]({'message':_0x1e51('0x52')});}}_0x56722f[_0x1e51('0x36')]={'id':_0x71c7af['id']};_0x10ee23();});})[_0x1e51('0x47')](function(){return _0x3e6ef2[_0x1e51('0x45')](0x191)[_0x1e51('0x3c')]({'message':_0x1e51('0x52')});});}catch(_0x121048){_0x10ee23(_0x121048);}}else if(_0x170ec6){_0x10ee23();}else{return _0x3e6ef2[_0x1e51('0x45')](0x193)[_0x1e51('0x3c')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x13da51,_0x8bb476,_0x3be495){if(_0x13da51[_0x1e51('0x36')]){db[_0x1e51('0x41')][_0x1e51('0x42')]({'where':{'id':_0x13da51[_0x1e51('0x36')]['id']},'attributes':userAttributes})[_0x1e51('0x3a')](function(_0x5a6340){if(!_0x5a6340){return _0x8bb476[_0x1e51('0x45')](0x194)[_0x1e51('0x3c')]({'message':_0x1e51('0x57')});}_0x13da51[_0x1e51('0x36')]=_0x5a6340;_0x3be495();})[_0x1e51('0x47')](function(_0x2131fb){_0x3be495(_0x2131fb);});}else if(_0x170ec6){_0x3be495();}else{return _0x8bb476[_0x1e51('0x45')](0x194)['json']({'message':_0x1e51('0x58')});}});};exports[_0x1e51('0x59')]=function canUpdate(){return compose()['use'](function(_0xfd6521,_0x38e4a7,_0x2b7a25){return licenseUtil['getLicense']()[_0x1e51('0x3a')](function(_0x2ab15a){if(_0x2ab15a[_0x1e51('0x5a')]){_0x2b7a25();}else{return _0x38e4a7[_0x1e51('0x45')](0x193)[_0x1e51('0x3c')]({'message':_0x1e51('0x5b')});}})[_0x1e51('0x47')](function(_0x10f423){_0x2b7a25(_0x10f423);});});};exports[_0x1e51('0x5c')]=function isWebrtcLicence(){return compose()['use'](function(_0x132625,_0x22a898,_0x4b5fa7){return licenseUtil[_0x1e51('0x5d')]()[_0x1e51('0x3a')](function(_0x139e9f){if(_0x139e9f['webrtc']){_0x4b5fa7();}else{return _0x22a898[_0x1e51('0x45')](0x193)[_0x1e51('0x3c')]({'message':_0x1e51('0x5b')});}})['catch'](function(_0x2e9ee2){_0x4b5fa7(_0x2e9ee2);});});};exports['isMiddleware']=function(_0x581f7a,_0x54688b,_0x169e6c){_0x581f7a[_0x1e51('0x5e')]=!![];return _0x169e6c();};exports['signToken']=function signToken(_0x5c81f5){return signJwt(_0x5c81f5);};exports[_0x1e51('0x5f')]=function(_0x7ffc42,_0x2a43dd){if(!_0x7ffc42[_0x1e51('0x36')]){return _0x2a43dd[_0x1e51('0x45')](0x194)[_0x1e51('0x3c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x43a92b={'payload':{'id':_0x7ffc42['user']['id'],'role':_0x7ffc42[_0x1e51('0x36')][_0x1e51('0x60')]},'options':{'expiresIn':0x15180}};return signJwt(_0x43a92b)['then'](function(_0x5ea040){_0x2a43dd['cookie'](_0x1e51('0x61'),_0x5ea040);_0x2a43dd[_0x1e51('0x62')](_0x1e51('0x63'));})['catch'](function(_0x2fdee1){return _0x2a43dd[_0x1e51('0x45')](0x1f4)[_0x1e51('0x64')](_0x2fdee1);});};exports[_0x1e51('0x65')]=function(_0x1ccb55){if(_[_0x1e51('0x66')](_0x1ccb55[_0x1e51('0x67')])||_[_0x1e51('0x66')](_0x1ccb55['apiKeyIat'])){return null;}else{return createJwt(_0x1ccb55);}};exports[_0x1e51('0x68')]=function(_0x7c5f61){_0x7c5f61[_0x1e51('0x67')]=generateNonce();_0x7c5f61[_0x1e51('0x69')]=generateIssuedAt();return createJwt(_0x7c5f61);};exports[_0x1e51('0x6a')]=function(_0x2a88db,_0x5ba6c2){var _0x23ccb5=_0x2a88db['query']['apikey'];if(_0x23ccb5){var _0x4807b9={'nonce':_0x5ba6c2[_0x1e51('0x67')],'iat':_0x5ba6c2[_0x1e51('0x69')],'audience':hardwareConf[_0x1e51('0x4b')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x23ccb5,_0x4807b9)[_0x1e51('0x3a')](function(){return generateApiKey(_0x5ba6c2);});}else{throw{'message':_0x1e51('0x6b')};}};exports[_0x1e51('0x6c')]=function(_0x4f4946){var _0x41385c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x41385c[_0x1e51('0x6d')](_0x4f4946))throw new db[(_0x1e51('0x6e'))]['ValidationError'](_0x1e51('0x6f'));return;};exports[_0x1e51('0x70')]=function(_0x175aa0,_0x30ee67,_0x666ae9){var _0x218273=encryptor[_0x1e51('0x71')](_0x30ee67)[_0x1e51('0x72')](',');for(var _0x517f51=0x0;_0x517f51<_0x666ae9;_0x517f51++){if(!_0x218273[_0x517f51])break;if(_0x175aa0[_0x1e51('0x73')]()===_0x218273[_0x517f51][_0x1e51('0x73')]()){var _0x48848f=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x666ae9);if(_0x666ae9===0x1){_0x48848f=_0x1e51('0x74');}throw new db[(_0x1e51('0x6e'))][(_0x1e51('0x75'))](_0x48848f);}}return;};exports[_0x1e51('0x76')]=function(_0x18e9d1,_0x3c322c){var _0x45b649=_0x3c322c?encryptor[_0x1e51('0x71')](_0x3c322c)[_0x1e51('0x72')](','):[];if(_0x45b649['length']===0x5){_0x45b649['splice'](-0x1,0x1);}_0x45b649['unshift'](_0x18e9d1);return encryptor[_0x1e51('0x77')](_0x45b649[_0x1e51('0x78')](','));};function signJwt(_0x50c202){var _0x4e1fa8=BPromise[_0x1e51('0x79')](jwt[_0x1e51('0x7a')],{'context':jwt});var _0x50b5c0=_0x50c202[_0x1e51('0x7b')]||config[_0x1e51('0xa')][_0x1e51('0x7c')];return new BPromise(function(_0x3e4073,_0x1cf3a3){_0x4e1fa8(_0x50c202[_0x1e51('0x7d')],_0x50b5c0,_0x50c202[_0x1e51('0x7e')])[_0x1e51('0x3a')](function(_0x207d4d){_0x3e4073(_0x207d4d);})[_0x1e51('0x47')](function(_0x486ebd){_0x1cf3a3(_0x486ebd);});});}function verifyJwt(_0x178baf,_0x2f5bf1,_0x3657a2){var _0x402bbd=BPromise[_0x1e51('0x79')](jwt[_0x1e51('0x7f')],{'context':jwt});var _0x47cc50=_0x3657a2||config['secrets'][_0x1e51('0x7c')];return new BPromise(function(_0x1b0459,_0x19ec72){_0x402bbd(_0x178baf,_0x47cc50,_0x2f5bf1)[_0x1e51('0x3a')](function(_0x52a439){_0x1b0459(_0x52a439);})['catch'](function(_0x5db283){_0x19ec72(_0x5db283);});});}function generateNonce(){return crypto[_0x1e51('0x80')](0x10)[_0x1e51('0x81')](_0x1e51('0x82'));}function generateIssuedAt(){return Math[_0x1e51('0x83')](Date[_0x1e51('0x84')]()/0x3e8)['toString']();}function createJwt(_0x16350b){var _0x3f9cea={'payload':{'iat':_0x16350b[_0x1e51('0x69')],'nonce':_0x16350b['apiKeyNonce']},'options':{'algorithm':_0x1e51('0x85'),'subject':_0x16350b['id'][_0x1e51('0x81')](),'issuer':hardwareConf[_0x1e51('0x4b')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x3f9cea)[_0x1e51('0x3a')](function(_0x37b7c6){return{'iat':_0x16350b['apiKeyIat'],'nonce':_0x16350b['apiKeyNonce'],'token':_0x37b7c6};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 6f5cd82..77e4bfe 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 _0xba7f=['then','search','parseAdvancedSearchFilter','where','default','fields','user','clause','tags','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','getFilteredContacts','rows','catch','CmContact','describe','keys','startsWith','slice','length','cf_','fieldType','type','map','lodash','../../mysqldb','findAll','skipContactsQuery','resolve'];(function(_0x5726e9,_0x5cf183){var _0x655893=function(_0x361488){while(--_0x361488){_0x5726e9['push'](_0x5726e9['shift']());}};_0x655893(++_0x5cf183);}(_0xba7f,0x145));var _0xfba7=function(_0x100ff9,_0x5a4021){_0x100ff9=_0x100ff9-0x0;var _0x4ff399=_0xba7f[_0x100ff9];return _0x4ff399;};'use strict';var _=require(_0xfba7('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xfba7('0x1'))['db'];exports[_0xfba7('0x2')]=function(_0x2fa8fe,_0x5ec0bb,_0x3c14b5,_0x527b78){var _0x20a4f1={'count':0x0,'rows':[]};var _0x3a52e8=sqlUtils[_0xfba7('0x3')](_0x5ec0bb,_0x2fa8fe);if(_0x3a52e8){return Promise[_0xfba7('0x4')](_0x20a4f1);}var _0x4389a7=sqlUtils['getContactsSubquery']();var _0x55009e={};var _0x2863bd=![];var _0x2efa0a=![];return Promise[_0xfba7('0x4')]()[_0xfba7('0x5')](function(){if(_0x2fa8fe[_0xfba7('0x6')]){return sqlUtils[_0xfba7('0x7')](_0x2fa8fe[_0xfba7('0x6')],_0x527b78);}else{return sqlUtils['parseQueryParameters'](_0x2fa8fe,_0x527b78);}})[_0xfba7('0x5')](function(_0x21db31){_0x4389a7[_0xfba7('0x8')](_0x21db31[_0xfba7('0x9')]);_0x4389a7[_0xfba7('0x8')](_0x21db31[_0xfba7('0xa')]);_0x4389a7[_0xfba7('0x8')](_0x21db31['filter']);_0x4389a7[_0xfba7('0x8')](_0x21db31[_0xfba7('0xb')][_0xfba7('0xc')]);_0x55009e=_0x21db31[_0xfba7('0xd')];_0x2efa0a=_0x21db31[_0xfba7('0xb')][_0xfba7('0xe')];return sqlUtils[_0xfba7('0xf')](_0x5ec0bb,_0x2fa8fe,_0x2efa0a);})[_0xfba7('0x5')](function(_0x40e471){_0x4389a7[_0xfba7('0x8')](_0x40e471);var _0x3216dd=_0x2fa8fe[_0xfba7('0x6')]?_0x55009e[_0xfba7('0x10')]:_0x2fa8fe['tag'];_0x2863bd=_0x3216dd?!![]:![];return sqlUtils[_0xfba7('0x11')](_0x4389a7,_0x3216dd);})['then'](function(_0x13ed5a){_0x20a4f1[_0xfba7('0x12')]=_0x13ed5a;if(_0x20a4f1['count']===0x0){return;}if(_0x2fa8fe[_0xfba7('0x13')]){_0x2efa0a=!![];}return sqlUtils['buildContactsQuery'](_0x4389a7,_0x2fa8fe[_0xfba7('0xa')],_0x3c14b5,_0x2863bd,_0x55009e[_0xfba7('0xc')],_0x2efa0a);})[_0xfba7('0x5')](function(_0x3ce18c){if(!_0x3ce18c){return[];}return sqlUtils[_0xfba7('0x14')](_0x3ce18c,_0x2fa8fe,_0x3c14b5);})[_0xfba7('0x5')](function(_0x1c7a05){_0x20a4f1[_0xfba7('0x15')]=_0x1c7a05;return _0x20a4f1;})[_0xfba7('0x16')](function(_0x5c6f35){throw _0x5c6f35;});};exports['describe']=function(){var _0x226336={};var _0x4d9cb0=[];return db[_0xfba7('0x17')][_0xfba7('0x18')]()[_0xfba7('0x5')](function(_0x161890){_0x226336=_0x161890;var _0x3b775a=Object[_0xfba7('0x19')](_0x226336)['filter'](function(_0x280ce6){return _[_0xfba7('0x1a')](_0x280ce6,'cf_')?_0x280ce6:undefined;});var _0x51128a=_0x3b775a['map'](function(_0x450ad8){return db['CmCustomField']['findOne']({'where':{'id':_0x450ad8[_0xfba7('0x1b')](0x3)},'raw':!![]});});return Promise['all'](_0x51128a);})[_0xfba7('0x5')](function(_0x48dd15){for(var _0x4d21eb=0x0;_0x4d21eb<_0x48dd15[_0xfba7('0x1c')];_0x4d21eb++){if(_0x48dd15[_0x4d21eb]){var _0x3681eb=_0xfba7('0x1d')+_0x48dd15[_0x4d21eb]['id'];_0x226336[_0x3681eb][_0xfba7('0x1e')]=_0x48dd15[_0x4d21eb][_0xfba7('0x1f')];}}_0x4d9cb0=_[_0xfba7('0x20')](Object['keys'](_0x226336),function(_0x5f2a27){return{'name':_0x5f2a27,'type':_0x226336[_0x5f2a27]['type']};});return _0x4d9cb0;})[_0xfba7('0x16')](function(_0x4a3d1f){throw _0x4a3d1f;});}; \ No newline at end of file +var _0xa32c=['countFilteredContacts','count','User','getFilteredContacts','rows','catch','describe','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','./sql-utils','../../mysqldb','getContactsSubquery','parseAdvancedSearchFilter','search','parseQueryParameters','then','where','default','fields','clause','tags','user','checkListsRestrictions','ids'];(function(_0x17f7b5,_0x5ca2c4){var _0x1681a0=function(_0x43944c){while(--_0x43944c){_0x17f7b5['push'](_0x17f7b5['shift']());}};_0x1681a0(++_0x5ca2c4);}(_0xa32c,0x100));var _0xca32=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa32c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xca32('0x0'));var sqlUtils=require(_0xca32('0x1'));var db=require(_0xca32('0x2'))['db'];exports['findAll']=function(_0x4e23be,_0x29b5af,_0x20f163,_0x3fefc){var _0x3c8963={'count':0x0,'rows':[]};var _0x1afa71=sqlUtils['skipContactsQuery'](_0x29b5af,_0x4e23be);if(_0x1afa71){return Promise['resolve'](_0x3c8963);}var _0x36e7e9=sqlUtils[_0xca32('0x3')]();var _0x54fc66={};var _0x43b00f=![];var _0x3d9fe7=![];return Promise['resolve']()['then'](function(){if(_0x4e23be['search']){return sqlUtils[_0xca32('0x4')](_0x4e23be[_0xca32('0x5')],_0x3fefc);}else{return sqlUtils[_0xca32('0x6')](_0x4e23be,_0x3fefc);}})[_0xca32('0x7')](function(_0x2f867e){_0x36e7e9[_0xca32('0x8')](_0x2f867e[_0xca32('0x9')]);_0x36e7e9['where'](_0x2f867e[_0xca32('0xa')]);_0x36e7e9[_0xca32('0x8')](_0x2f867e['filter']);_0x36e7e9[_0xca32('0x8')](_0x2f867e['user'][_0xca32('0xb')]);_0x54fc66=_0x2f867e[_0xca32('0xc')];_0x3d9fe7=_0x2f867e[_0xca32('0xd')]['skip'];return sqlUtils[_0xca32('0xe')](_0x29b5af,_0x4e23be,_0x3d9fe7);})[_0xca32('0x7')](function(_0x49ff35){_0x36e7e9[_0xca32('0x8')](_0x49ff35);var _0x277436=_0x4e23be[_0xca32('0x5')]?_0x54fc66[_0xca32('0xf')]:_0x4e23be['tag'];_0x43b00f=_0x277436?!![]:![];return sqlUtils[_0xca32('0x10')](_0x36e7e9,_0x277436);})[_0xca32('0x7')](function(_0x3c3059){_0x3c8963[_0xca32('0x11')]=_0x3c3059;if(_0x3c8963[_0xca32('0x11')]===0x0){return;}if(_0x4e23be[_0xca32('0x12')]){_0x3d9fe7=!![];}return sqlUtils['buildContactsQuery'](_0x36e7e9,_0x4e23be[_0xca32('0xa')],_0x20f163,_0x43b00f,_0x54fc66['clause'],_0x3d9fe7);})[_0xca32('0x7')](function(_0x49a384){if(!_0x49a384){return[];}return sqlUtils[_0xca32('0x13')](_0x49a384,_0x4e23be,_0x20f163);})[_0xca32('0x7')](function(_0x494a10){_0x3c8963[_0xca32('0x14')]=_0x494a10;return _0x3c8963;})[_0xca32('0x15')](function(_0x74ecb8){throw _0x74ecb8;});};exports[_0xca32('0x16')]=function(){var _0x536519={};var _0x231620=[];return db['CmContact'][_0xca32('0x16')]()[_0xca32('0x7')](function(_0x5bffd3){_0x536519=_0x5bffd3;var _0xe31d27=Object[_0xca32('0x17')](_0x536519)[_0xca32('0x18')](function(_0x35dfc3){return _[_0xca32('0x19')](_0x35dfc3,_0xca32('0x1a'))?_0x35dfc3:undefined;});var _0x332ffd=_0xe31d27[_0xca32('0x1b')](function(_0x5e8ff9){return db[_0xca32('0x1c')][_0xca32('0x1d')]({'where':{'id':_0x5e8ff9[_0xca32('0x1e')](0x3)},'raw':!![]});});return Promise[_0xca32('0x1f')](_0x332ffd);})[_0xca32('0x7')](function(_0x2088da){for(var _0x20f17f=0x0;_0x20f17f<_0x2088da['length'];_0x20f17f++){if(_0x2088da[_0x20f17f]){var _0x312eb6='cf_'+_0x2088da[_0x20f17f]['id'];_0x536519[_0x312eb6][_0xca32('0x20')]=_0x2088da[_0x20f17f][_0xca32('0x21')];}}_0x231620=_[_0xca32('0x1b')](Object[_0xca32('0x17')](_0x536519),function(_0x28490d){return{'name':_0x28490d,'type':_0x536519[_0x28490d][_0xca32('0x21')]};});return _0x231620;})[_0xca32('0x15')](function(_0x4b756b){throw _0x4b756b;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 6194c89..425bef1 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 _0x655a=['c.id','limit','offset','group','subqry.id','order','subqry.','DESC','findAll','color','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','split','Tags','clone','COUNT(*)','getSelectedTags','isEmpty','where','exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','lastName','mobile','fax','ListId','CompanyId','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','replace','length','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','datetime','castTo','buildExpression','type','default','text','start','value','end','Tag','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes'];(function(_0x336da1,_0x58f3e9){var _0x4fb34d=function(_0x4d5d58){while(--_0x4d5d58){_0x336da1['push'](_0x336da1['shift']());}};_0x4fb34d(++_0x58f3e9);}(_0x655a,0x1cd));var _0xa655=function(_0x446af8,_0x29a80c){_0x446af8=_0x446af8-0x0;var _0x489288=_0x655a[_0x446af8];return _0x489288;};'use strict';var _=require('lodash');var squel=require(_0xa655('0x0'));var as=require(_0xa655('0x1'));var qs=require(_0xa655('0x2'));var utils=require(_0xa655('0x3'));var db=require(_0xa655('0x4'))['db'];function skipContactsQuery(_0x203516,_0x2198f9){var _0xa567c8=![];if(_0x203516[_0xa655('0x5')]===_0xa655('0x6')&&!_0x2198f9[_0xa655('0x7')]&&!_0x2198f9['ListId']&&_0x2198f9['autocomplete']!==_0xa655('0x8')){_0xa567c8=!![];}return _0xa567c8;}function getContactsSubquery(){return squel[_0xa655('0x9')]()[_0xa655('0xa')](_0xa655('0xb'),'c')['where'](_0xa655('0xc'));}function applyJoinClauses(_0x1aae8d,_0x3b7e15){var _0x43f835=_0x3b7e15?'c':_0xa655('0xd');_0x1aae8d['left_join'](_0xa655('0xe'),'uc',_0xa655('0xf')+_0x43f835+_0xa655('0x10'))[_0xa655('0x11')](_0xa655('0x12'),'ct',_0xa655('0x13')+_0x43f835+'.id')[_0xa655('0x11')](_0xa655('0x14'),'t',_0xa655('0x15'));return _0x1aae8d;}function addFieldsToQuery(_0x227231,_0x4d514f,_0xe91bd9,_0x5c4d31,_0x6c1338){var _0xdbcb66=_0x6c1338?'c':_0xa655('0xd');if(!_0x4d514f){_0x4d514f=['id','firstName',_0xa655('0x16'),'phone',_0xa655('0x17'),_0xa655('0x18'),'email',_0xa655('0x19'),_0xa655('0x1a'),'createdAt',_0xa655('0x1b'),_0xa655('0x1c'),_0xa655('0x1d')];}else if(!_0x4d514f[_0xa655('0x1e')]('id')){_0x4d514f[_0xa655('0x1f')]('id');}var _0x32d52e=_0xe91bd9&&_0x6c1338||!_0xe91bd9&&!_0x6c1338;if(_0x5c4d31){_0x32d52e=_0x5c4d31&&_0x6c1338||!_0x5c4d31&&!_0x6c1338;}_0x4d514f[_0xa655('0x20')](function(_0x48059f){if(_0x48059f==='TagIds'){if(_0x32d52e){_0x227231[_0xa655('0x21')](_0xa655('0x22'),_0x48059f);}else if(_0xe91bd9||_0x5c4d31){_0x227231[_0xa655('0x21')](_0xdbcb66+'.'+_0x48059f);}}else{_0x227231[_0xa655('0x21')](_0xdbcb66+'.'+_0x48059f);}});return _0x227231;}function getSqlClauses(){var _0x18cf2c={'default':squel[_0xa655('0x23')](),'fields':squel['expr'](),'filter':squel[_0xa655('0x23')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0xa655('0x23')](),'skip':![]}};return _0x18cf2c;}function parseTagParameter(_0x2287ee){var _0x3ef443=squel[_0xa655('0x23')]();if(_0x2287ee){var _0x26190e=utils['getSelectedTags'](_0x2287ee);_0x26190e[_0xa655('0x20')](function(_0x157410){_0x3ef443['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x157410+',%');});}return _0x3ef443;}function parseSearchFilter(_0x3b8ffe){var _0x2671ea=squel[_0xa655('0x23')]();if(_0x3b8ffe){var _0x1bd42e=_0x3b8ffe[_0xa655('0x24')]('\x5c','\x5c\x5c')[_0xa655('0x24')](/'/g,'\x27\x27');if(_0x1bd42e['split']('\x20')[_0xa655('0x25')]>0x1){_0x2671ea['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1bd42e,!![]),null);}else{if(qs[_0xa655('0x26')](_0x1bd42e)){_0x2671ea['or']('c.id\x20LIKE\x20?',_0x1bd42e+'%');_0x2671ea['or'](_0xa655('0x27'),_0x1bd42e+'%');_0x2671ea['or'](_0xa655('0x28'),_0x1bd42e+'%');_0x2671ea['or'](_0xa655('0x29'),_0x1bd42e+'%');}else if(qs[_0xa655('0x2a')](_0x1bd42e)){_0x2671ea['or'](_0xa655('0x2b'),_0x1bd42e+'%');}else{_0x2671ea['or'](_0xa655('0x2c'),'%'+_0x1bd42e+'%');_0x2671ea['or'](_0xa655('0x2d'),'%'+_0x1bd42e+'%');_0x2671ea['or']('c.email\x20LIKE\x20?','%'+_0x1bd42e+'%');}}}return _0x2671ea;}function parseAdvancedSearchFilter(_0xec355d,_0x3548ac){var _0x3494aa=getSqlClauses();var _0x18121a=as[_0xa655('0x2e')](_0xec355d);var _0x3cd91e=_0x18121a[_0xa655('0x2f')];for(var _0x55fcac=0x0;_0x55fcac<_0x18121a[_0xa655('0x30')]['length'];_0x55fcac++){var _0x2405d4=_0x18121a['conditions'][_0x55fcac];var _0x2b4bbe='c';var _0x6fab15=_['find'](_0x3548ac,[_0xa655('0x31'),_0x2405d4[_0xa655('0x21')]]);if(_0x6fab15){if(_0x2405d4['field']===_0xa655('0x32')||_0x6fab15['fieldType']===_0xa655('0x33')){_0x2405d4[_0xa655('0x34')]='DATE';}var _0xbc5337=as[_0xa655('0x35')](_0x2b4bbe,_0x6fab15[_0xa655('0x36')],_0x2405d4);_0x3494aa[_0xa655('0x37')][_0x3cd91e](_0xbc5337[_0xa655('0x38')],_0xbc5337['value'][_0xa655('0x39')],_0xbc5337[_0xa655('0x3a')][_0xa655('0x3b')]);}else{if(_0x2405d4[_0xa655('0x21')]===_0xa655('0x3c')){var _0x275f6a=_0x2405d4['value']['split'](',')[_0xa655('0x3d')](function(_0x4728b4){return Number(_0x4728b4);});var _0x339287=parseTagParameter(_0x275f6a);_0x3494aa[_0xa655('0x3e')][_0xa655('0x3f')][_0xa655('0x40')](_0x339287);_0x3494aa[_0xa655('0x3e')][_0xa655('0x41')]=_0x275f6a;}else if(_0x2405d4['field']===_0xa655('0x42')){_0x3494aa[_0xa655('0x43')][_0xa655('0x3f')]['and'](_0xa655('0x44'),_0x2405d4[_0xa655('0x3a')]);_0x3494aa[_0xa655('0x43')][_0xa655('0x45')]=!![];}}}return _0x3494aa;}function parseModelFields(_0x1ce7d5,_0x18e0e4){var _0x3f4ace=squel[_0xa655('0x23')]();var _0x4d46f3=_(_0x1ce7d5)[_0xa655('0x46')]()[_0xa655('0x3d')](function(_0x30e96d){return _[_0xa655('0x47')](_0x18e0e4,[_0xa655('0x31'),_0x30e96d])?_0x30e96d:undefined;})['compact']()['value']();if(_0x1ce7d5[_0xa655('0x48')]){_0x4d46f3[_0xa655('0x1f')]('Contact');}if(_0x1ce7d5[_0xa655('0x42')]){_0x4d46f3['push'](_0xa655('0x42'));}if(_0x4d46f3[_0xa655('0x25')]>0x0){_0x4d46f3['forEach'](function(_0x1e8898){if(_0x1e8898===_0xa655('0x19')){_0x3f4ace['and'](_0xa655('0x49'),[]['concat'](_0x1ce7d5[_0x1e8898]));}else if(_0x1e8898===_0xa655('0x48')){var _0x8e96e0='%'+_0x1ce7d5[_0x1e8898]+'%';_0x3f4ace[_0xa655('0x40')](_0xa655('0x4a'),_0x8e96e0);}else if(_0x1e8898==='User'){_0x3f4ace[_0xa655('0x40')](_0xa655('0x44'),_0x1ce7d5[_0x1e8898]);}else{_0x3f4ace[_0xa655('0x40')]('c.'+_0x1e8898+_0xa655('0x4b'),_0x1ce7d5[_0x1e8898]);}});}return _0x3f4ace;}function parseQueryParameters(_0x4492cb,_0x2247e0){var _0x19a727=getSqlClauses();return Promise[_0xa655('0x4c')]()[_0xa655('0x4d')](function(){return parseModelFields(_0x4492cb,_0x2247e0);})[_0xa655('0x4d')](function(_0x36a411){_0x19a727[_0xa655('0x4e')][_0xa655('0x40')](_0x36a411);return parseTagParameter(_0x4492cb[_0xa655('0x4f')]);})[_0xa655('0x4d')](function(_0x4731cf){_0x19a727[_0xa655('0x3e')][_0xa655('0x3f')][_0xa655('0x40')](_0x4731cf);return parseSearchFilter(_0x4492cb[_0xa655('0x50')]);})['then'](function(_0xbfb693){_0x19a727[_0xa655('0x50')]=_0xbfb693;return _0x19a727;});}function checkListsRestrictions(_0x3bcd28,_0x2027f7,_0x49a013){var _0x35c1b7=squel[_0xa655('0x23')]();return Promise[_0xa655('0x4c')]()[_0xa655('0x4d')](function(){if(_0x2027f7['search']&&_0x3bcd28[_0xa655('0x5')]===_0xa655('0x6')&&!_0x49a013){return _0x3bcd28[_0xa655('0x51')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x31f441){if(_0x31f441){if(_0x31f441[_0xa655('0x25')]===0x0){_0x35c1b7['and'](_0xa655('0x52'));}else{_0x35c1b7[_0xa655('0x40')](_0xa655('0x49'),_[_0xa655('0x3d')](_0x31f441,'id'));}}})[_0xa655('0x4d')](function(){return _0x35c1b7;});}function buildContactsQuery(_0x10fc8b,_0x3773c0,_0x5d36cb,_0x3f3076,_0x4c6182,_0x381a7d){if(_0x3773c0){_0x3773c0=_0x5d36cb[_0xa655('0x53')];}_0x10fc8b=addFieldsToQuery(_0x10fc8b,_0x3773c0,_0x3f3076,_0x381a7d,!![]);var _0xc74ccd=squel[_0xa655('0x9')]();_0xc74ccd=addFieldsToQuery(_0xc74ccd,_0x3773c0,_0x3f3076,_0x381a7d,![]);if(_0x3f3076||_0x381a7d){_0x10fc8b=applyJoinClauses(_0x10fc8b,!![]);_0x10fc8b['group'](_0xa655('0x54'));if(_0x5d36cb[_0xa655('0x55')]){_0xc74ccd['limit'](_0x5d36cb['limit']);}if(_0x5d36cb[_0xa655('0x56')]){_0xc74ccd[_0xa655('0x56')](_0x5d36cb[_0xa655('0x56')]);}}else{_0xc74ccd=applyJoinClauses(_0xc74ccd,![]);_0xc74ccd[_0xa655('0x57')](_0xa655('0x58'));if(_0x5d36cb['limit']){_0x10fc8b['limit'](_0x5d36cb[_0xa655('0x55')]);}if(_0x5d36cb[_0xa655('0x56')]){_0x10fc8b['offset'](_0x5d36cb[_0xa655('0x56')]);}}_0xc74ccd['having'](_0x4c6182);if(_0x5d36cb[_0xa655('0x59')]){_0x5d36cb[_0xa655('0x59')][_0xa655('0x20')](function(_0xea9284){_0x10fc8b[_0xa655('0x59')]('c.'+_0xea9284[0x0],_0xea9284[0x1]==='DESC'?![]:!![]);_0xc74ccd[_0xa655('0x59')](_0xa655('0x5a')+_0xea9284[0x0],_0xea9284[0x1]===_0xa655('0x5b')?![]:!![]);});}_0xc74ccd[_0xa655('0xa')](_0x10fc8b,_0xa655('0xd'));return _0xc74ccd;}function getFilteredContacts(_0x406f34){var _0x12ac4a=[];return db[_0xa655('0x3c')][_0xa655('0x5c')]({'attributes':['id',_0xa655('0x31'),_0xa655('0x5d')],'raw':!![]})[_0xa655('0x4d')](function(_0x5116b4){_0x12ac4a=_['keyBy'](_0x5116b4,'id');var _0x533cd0={'type':db[_0xa655('0x5e')][_0xa655('0x5f')][_0xa655('0x60')],'model':db[_0xa655('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xa655('0x62')][_0xa655('0x63')](_0x406f34[_0xa655('0x64')](),_0x533cd0);})[_0xa655('0x4d')](function(_0x214ba0){_0x214ba0[_0xa655('0x20')](function(_0x1149eb){if(_0x1149eb[_0xa655('0x1d')]){_0x1149eb['Tags']=[];_0x1149eb[_0xa655('0x1d')][_0xa655('0x65')](',')[_0xa655('0x20')](function(_0xdf795b){_0x1149eb[_0xa655('0x66')]['push'](_0x12ac4a[_0xdf795b]);});}delete _0x1149eb[_0xa655('0x1d')];});return _0x214ba0;});}function countFilteredContacts(_0x44a007,_0x3dd2e2){var _0x3c0a9e=_0x44a007[_0xa655('0x67')]();_0x3c0a9e[_0xa655('0x21')](_0xa655('0x68'));_0x3c0a9e=applyJoinClauses(_0x3c0a9e,!![]);_0x44a007['group'](_0xa655('0x54'));var _0x5d6efb=utils[_0xa655('0x69')](_0x3dd2e2);if(!_[_0xa655('0x6a')](_0x5d6efb)){_0x3c0a9e[_0xa655('0x6b')]('t.id\x20IN\x20?',_0x5d6efb);}var _0x42634b={'type':db[_0xa655('0x5e')]['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize'][_0xa655('0x63')](_0x3c0a9e[_0xa655('0x64')](),_0x42634b)[_0xa655('0x4d')](function(_0x1b89a2){return _0x1b89a2[0x0][_0xa655('0x68')];});}module[_0xa655('0x6c')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xd247=['query','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','phone','mobile','fax','ListId','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','replace','split','length','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.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','dateOfBirth','fieldType','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','skip','keys','some','name','compact','Contact','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','fields','filter','getLists','c.ListId\x20IS\x20NULL','attributes','limit','offset','subqry.id','order','DESC','findAll','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','group','c.id','getSelectedTags','t.id\x20IN\x20?'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd247,0x143));var _0x7d24=function(_0xe33285,_0x7f474){_0xe33285=_0xe33285-0x0;var _0x31ca6b=_0xd247[_0xe33285];return _0x31ca6b;};'use strict';var _=require(_0x7d24('0x0'));var squel=require('squel');var as=require(_0x7d24('0x1'));var qs=require(_0x7d24('0x2'));var utils=require(_0x7d24('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x1efcbd,_0xeff97b){var _0x58e603=![];if(_0x1efcbd[_0x7d24('0x4')]===_0x7d24('0x5')&&!_0xeff97b[_0x7d24('0x6')]&&!_0xeff97b['ListId']&&_0xeff97b[_0x7d24('0x7')]!==_0x7d24('0x8')){_0x58e603=!![];}return _0x58e603;}function getContactsSubquery(){return squel[_0x7d24('0x9')]()[_0x7d24('0xa')](_0x7d24('0xb'),'c')[_0x7d24('0xc')](_0x7d24('0xd'));}function applyJoinClauses(_0x22080b,_0x1f65b7){var _0x441024=_0x1f65b7?'c':_0x7d24('0xe');_0x22080b['left_join']('cm_user_has_contacts','uc',_0x7d24('0xf')+_0x441024+_0x7d24('0x10'))[_0x7d24('0x11')](_0x7d24('0x12'),'ct',_0x7d24('0x13')+_0x441024+'.id')[_0x7d24('0x11')](_0x7d24('0x14'),'t',_0x7d24('0x15'));return _0x22080b;}function addFieldsToQuery(_0x2bc213,_0x47c13d,_0x579f36,_0x5473ed,_0xc18df0){var _0x489490=_0xc18df0?'c':_0x7d24('0xe');if(!_0x47c13d){_0x47c13d=['id','firstName','lastName',_0x7d24('0x16'),_0x7d24('0x17'),_0x7d24('0x18'),'email',_0x7d24('0x19'),_0x7d24('0x1a'),_0x7d24('0x1b'),_0x7d24('0x1c'),_0x7d24('0x1d'),_0x7d24('0x1e')];}else if(!_0x47c13d[_0x7d24('0x1f')]('id')){_0x47c13d[_0x7d24('0x20')]('id');}var _0x2c1b24=_0x579f36&&_0xc18df0||!_0x579f36&&!_0xc18df0;if(_0x5473ed){_0x2c1b24=_0x5473ed&&_0xc18df0||!_0x5473ed&&!_0xc18df0;}_0x47c13d[_0x7d24('0x21')](function(_0x839159){if(_0x839159==='TagIds'){if(_0x2c1b24){_0x2bc213[_0x7d24('0x22')](_0x7d24('0x23'),_0x839159);}else if(_0x579f36||_0x5473ed){_0x2bc213[_0x7d24('0x22')](_0x489490+'.'+_0x839159);}}else{_0x2bc213[_0x7d24('0x22')](_0x489490+'.'+_0x839159);}});return _0x2bc213;}function getSqlClauses(){var _0x18a22d={'default':squel[_0x7d24('0x24')](),'fields':squel[_0x7d24('0x24')](),'filter':squel[_0x7d24('0x24')](),'tags':{'clause':squel[_0x7d24('0x24')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x18a22d;}function parseTagParameter(_0x5b8d22){var _0x183294=squel[_0x7d24('0x24')]();if(_0x5b8d22){var _0x2b33ba=utils['getSelectedTags'](_0x5b8d22);_0x2b33ba[_0x7d24('0x21')](function(_0x58c6d4){_0x183294['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58c6d4+',%');});}return _0x183294;}function parseSearchFilter(_0x2fe29d){var _0x458009=squel[_0x7d24('0x24')]();if(_0x2fe29d){var _0x34846d=_0x2fe29d[_0x7d24('0x25')]('\x5c','\x5c\x5c')[_0x7d24('0x25')](/'/g,'\x27\x27');if(_0x34846d[_0x7d24('0x26')]('\x20')[_0x7d24('0x27')]>0x1){_0x458009['or'](_0x7d24('0x28'),qs[_0x7d24('0x29')](_0x34846d,!![]),null);}else{if(qs[_0x7d24('0x2a')](_0x34846d)){_0x458009['or'](_0x7d24('0x2b'),_0x34846d+'%');_0x458009['or'](_0x7d24('0x2c'),_0x34846d+'%');_0x458009['or']('c.mobile\x20LIKE\x20?',_0x34846d+'%');_0x458009['or'](_0x7d24('0x2d'),_0x34846d+'%');}else if(qs[_0x7d24('0x2e')](_0x34846d)){_0x458009['or']('c.email\x20LIKE\x20?',_0x34846d+'%');}else{_0x458009['or']('c.firstName\x20LIKE\x20?','%'+_0x34846d+'%');_0x458009['or'](_0x7d24('0x2f'),'%'+_0x34846d+'%');_0x458009['or']('c.email\x20LIKE\x20?','%'+_0x34846d+'%');}}}return _0x458009;}function parseAdvancedSearchFilter(_0x326c6a,_0x5954cb){var _0x102995=getSqlClauses();var _0x5edf4b=as['parseSearch'](_0x326c6a);var _0x97f555=_0x5edf4b[_0x7d24('0x30')];for(var _0x3f0b5d=0x0;_0x3f0b5d<_0x5edf4b[_0x7d24('0x31')]['length'];_0x3f0b5d++){var _0x5e5cfd=_0x5edf4b[_0x7d24('0x31')][_0x3f0b5d];var _0xc35e71='c';var _0x3d3380=_[_0x7d24('0x32')](_0x5954cb,['name',_0x5e5cfd[_0x7d24('0x22')]]);if(_0x3d3380){if(_0x5e5cfd[_0x7d24('0x22')]===_0x7d24('0x33')||_0x3d3380[_0x7d24('0x34')]==='datetime'){_0x5e5cfd[_0x7d24('0x35')]=_0x7d24('0x36');}var _0x5c5d70=as[_0x7d24('0x37')](_0xc35e71,_0x3d3380[_0x7d24('0x38')],_0x5e5cfd);_0x102995[_0x7d24('0x39')][_0x97f555](_0x5c5d70[_0x7d24('0x3a')],_0x5c5d70[_0x7d24('0x3b')][_0x7d24('0x3c')],_0x5c5d70[_0x7d24('0x3b')][_0x7d24('0x3d')]);}else{if(_0x5e5cfd[_0x7d24('0x22')]===_0x7d24('0x3e')){var _0x46c5ad=_0x5e5cfd[_0x7d24('0x3b')][_0x7d24('0x26')](',')[_0x7d24('0x3f')](function(_0x2f0fab){return Number(_0x2f0fab);});var _0x4f3d16=parseTagParameter(_0x46c5ad);_0x102995[_0x7d24('0x40')][_0x7d24('0x41')][_0x7d24('0x42')](_0x4f3d16);_0x102995[_0x7d24('0x40')][_0x7d24('0x43')]=_0x46c5ad;}else if(_0x5e5cfd[_0x7d24('0x22')]===_0x7d24('0x44')){_0x102995['user'][_0x7d24('0x41')][_0x7d24('0x42')](_0x7d24('0x45'),_0x5e5cfd[_0x7d24('0x3b')]);_0x102995['user'][_0x7d24('0x46')]=!![];}}}return _0x102995;}function parseModelFields(_0xdc6f56,_0x2f948f){var _0xfd0887=squel[_0x7d24('0x24')]();var _0x54013a=_(_0xdc6f56)[_0x7d24('0x47')]()[_0x7d24('0x3f')](function(_0x133eb7){return _[_0x7d24('0x48')](_0x2f948f,[_0x7d24('0x49'),_0x133eb7])?_0x133eb7:undefined;})[_0x7d24('0x4a')]()['value']();if(_0xdc6f56['Contact']){_0x54013a[_0x7d24('0x20')](_0x7d24('0x4b'));}if(_0xdc6f56[_0x7d24('0x44')]){_0x54013a[_0x7d24('0x20')](_0x7d24('0x44'));}if(_0x54013a[_0x7d24('0x27')]>0x0){_0x54013a[_0x7d24('0x21')](function(_0x23959e){if(_0x23959e==='ListId'){_0xfd0887[_0x7d24('0x42')](_0x7d24('0x4c'),[]['concat'](_0xdc6f56[_0x23959e]));}else if(_0x23959e===_0x7d24('0x4b')){var _0x54bc98='%'+_0xdc6f56[_0x23959e]+'%';_0xfd0887[_0x7d24('0x42')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x54bc98);}else if(_0x23959e==='User'){_0xfd0887['and'](_0x7d24('0x45'),_0xdc6f56[_0x23959e]);}else{_0xfd0887[_0x7d24('0x42')]('c.'+_0x23959e+_0x7d24('0x4d'),_0xdc6f56[_0x23959e]);}});}return _0xfd0887;}function parseQueryParameters(_0x2e4c00,_0x4a7004){var _0x702613=getSqlClauses();return Promise[_0x7d24('0x4e')]()[_0x7d24('0x4f')](function(){return parseModelFields(_0x2e4c00,_0x4a7004);})[_0x7d24('0x4f')](function(_0x587569){_0x702613[_0x7d24('0x50')][_0x7d24('0x42')](_0x587569);return parseTagParameter(_0x2e4c00['tag']);})[_0x7d24('0x4f')](function(_0x15cef2){_0x702613[_0x7d24('0x40')][_0x7d24('0x41')]['and'](_0x15cef2);return parseSearchFilter(_0x2e4c00[_0x7d24('0x51')]);})[_0x7d24('0x4f')](function(_0x5ed442){_0x702613['filter']=_0x5ed442;return _0x702613;});}function checkListsRestrictions(_0x230799,_0x531e2a,_0xe6db03){var _0xcda4d1=squel['expr']();return Promise[_0x7d24('0x4e')]()[_0x7d24('0x4f')](function(){if(_0x531e2a[_0x7d24('0x6')]&&_0x230799[_0x7d24('0x4')]===_0x7d24('0x5')&&!_0xe6db03){return _0x230799[_0x7d24('0x52')]({'attributes':['id'],'raw':!![]});}})[_0x7d24('0x4f')](function(_0x5277af){if(_0x5277af){if(_0x5277af['length']===0x0){_0xcda4d1[_0x7d24('0x42')](_0x7d24('0x53'));}else{_0xcda4d1[_0x7d24('0x42')](_0x7d24('0x4c'),_[_0x7d24('0x3f')](_0x5277af,'id'));}}})[_0x7d24('0x4f')](function(){return _0xcda4d1;});}function buildContactsQuery(_0x168600,_0x339a9f,_0x1be398,_0x3fc683,_0x506740,_0x1c2a7f){if(_0x339a9f){_0x339a9f=_0x1be398[_0x7d24('0x54')];}_0x168600=addFieldsToQuery(_0x168600,_0x339a9f,_0x3fc683,_0x1c2a7f,!![]);var _0x42d93e=squel[_0x7d24('0x9')]();_0x42d93e=addFieldsToQuery(_0x42d93e,_0x339a9f,_0x3fc683,_0x1c2a7f,![]);if(_0x3fc683||_0x1c2a7f){_0x168600=applyJoinClauses(_0x168600,!![]);_0x168600['group']('c.id');if(_0x1be398[_0x7d24('0x55')]){_0x42d93e[_0x7d24('0x55')](_0x1be398['limit']);}if(_0x1be398[_0x7d24('0x56')]){_0x42d93e[_0x7d24('0x56')](_0x1be398[_0x7d24('0x56')]);}}else{_0x42d93e=applyJoinClauses(_0x42d93e,![]);_0x42d93e['group'](_0x7d24('0x57'));if(_0x1be398[_0x7d24('0x55')]){_0x168600[_0x7d24('0x55')](_0x1be398['limit']);}if(_0x1be398[_0x7d24('0x56')]){_0x168600[_0x7d24('0x56')](_0x1be398[_0x7d24('0x56')]);}}_0x42d93e['having'](_0x506740);if(_0x1be398['order']){_0x1be398[_0x7d24('0x58')][_0x7d24('0x21')](function(_0x34c0eb){_0x168600[_0x7d24('0x58')]('c.'+_0x34c0eb[0x0],_0x34c0eb[0x1]===_0x7d24('0x59')?![]:!![]);_0x42d93e['order']('subqry.'+_0x34c0eb[0x0],_0x34c0eb[0x1]===_0x7d24('0x59')?![]:!![]);});}_0x42d93e['from'](_0x168600,'subqry');return _0x42d93e;}function getFilteredContacts(_0x6fd701){var _0xe257c2=[];return db['Tag'][_0x7d24('0x5a')]({'attributes':['id',_0x7d24('0x49'),'color'],'raw':!![]})['then'](function(_0x445537){_0xe257c2=_[_0x7d24('0x5b')](_0x445537,'id');var _0x32668e={'type':db[_0x7d24('0x5c')][_0x7d24('0x5d')][_0x7d24('0x5e')],'model':db[_0x7d24('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x7d24('0x60')]['query'](_0x6fd701[_0x7d24('0x61')](),_0x32668e);})[_0x7d24('0x4f')](function(_0x1f5a4d){_0x1f5a4d[_0x7d24('0x21')](function(_0xdebc0b){if(_0xdebc0b[_0x7d24('0x1e')]){_0xdebc0b[_0x7d24('0x62')]=[];_0xdebc0b[_0x7d24('0x1e')][_0x7d24('0x26')](',')[_0x7d24('0x21')](function(_0x4bd123){_0xdebc0b[_0x7d24('0x62')][_0x7d24('0x20')](_0xe257c2[_0x4bd123]);});}delete _0xdebc0b[_0x7d24('0x1e')];});return _0x1f5a4d;});}function countFilteredContacts(_0x1ba75d,_0x468b1d){var _0x421282=_0x1ba75d[_0x7d24('0x63')]();_0x421282[_0x7d24('0x22')](_0x7d24('0x64'));_0x421282=applyJoinClauses(_0x421282,!![]);_0x1ba75d[_0x7d24('0x65')](_0x7d24('0x66'));var _0x36e40f=utils[_0x7d24('0x67')](_0x468b1d);if(!_['isEmpty'](_0x36e40f)){_0x421282[_0x7d24('0xc')](_0x7d24('0x68'),_0x36e40f);}var _0x287824={'type':db[_0x7d24('0x5c')][_0x7d24('0x5d')]['SELECT'],'raw':!![]};return db[_0x7d24('0x60')][_0x7d24('0x69')](_0x421282[_0x7d24('0x61')](),_0x287824)[_0x7d24('0x4f')](function(_0x5d864f){return _0x5d864f[0x0][_0x7d24('0x64')];});}module[_0x7d24('0x6a')]={'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 8189fbc..048ecbb 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 _0x7c0c=['createWriteStream','createCipher','data','update','binary','write','final','end','close','decryptFile','createDecipher','unlink','encryptString','secret','utf8','base64','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','indexOf','hasOwnProperty','encryptFile','createReadStream'];(function(_0x283b93,_0x1e48c5){var _0x56c8dd=function(_0x1b707f){while(--_0x1b707f){_0x283b93['push'](_0x283b93['shift']());}};_0x56c8dd(++_0x1e48c5);}(_0x7c0c,0xe2));var _0xc7c0=function(_0x486b88,_0x10faca){_0x486b88=_0x486b88-0x0;var _0x20dee9=_0x7c0c[_0x486b88];return _0x20dee9;};'use strict';var crypto=require(_0xc7c0('0x0'));var fs=require('fs');var BPromise=require(_0xc7c0('0x1'));var _=require(_0xc7c0('0x2'));var config=require(_0xc7c0('0x3'));var logger=require('../../config/logger')(_0xc7c0('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc7c0('0x5')][_0xc7c0('0x6')],'algorithm':_0xc7c0('0x7')};const fileOptions={'algorithm':_0xc7c0('0x8')};if(config[_0xc7c0('0x9')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0xc7c0('0x9')][_0xc7c0('0xa')]);if(isSupported){fileOptions[_0xc7c0('0xa')]=config[_0xc7c0('0x9')][_0xc7c0('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc7c0('0xb')](',\x20');logger[_0xc7c0('0xc')](config['encrypt']['algorithm'],_0xc7c0('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x3dab59){return AES_SUPPORTED_RX[_0xc7c0('0xe')](_0x3dab59);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x5342d6){return getSupportedCiphers()[_0xc7c0('0xf')](_0x5342d6)>-0x1;}function combineOptions(_0x393fc3){var _0x467e3c={};for(var _0x3ecde5 in fileOptions){if(fileOptions[_0xc7c0('0x10')](_0x3ecde5)){_0x467e3c[_0x3ecde5]=fileOptions[_0x3ecde5];}}if(_0x393fc3){for(var _0x13f535 in _0x393fc3){if(_0x393fc3[_0xc7c0('0x10')](_0x13f535)){_0x467e3c[_0x13f535]=_0x393fc3[_0x13f535];}}}return _0x467e3c;}exports[_0xc7c0('0x11')]=function(_0x1aef37,_0x5e047d,_0x1af0bd,_0x754cb3){return new BPromise(function(_0xda7618,_0x6a5d2d){_0x754cb3=combineOptions(_0x754cb3);var _0x319bdb=new Buffer(_0x1af0bd);var _0x23b8f5=fs[_0xc7c0('0x12')](_0x1aef37);var _0x28ff4f=fs[_0xc7c0('0x13')](_0x5e047d);var _0x8d62b9=crypto[_0xc7c0('0x14')](_0x754cb3['algorithm'],_0x319bdb);_0x23b8f5['on'](_0xc7c0('0x15'),function(_0x192aa9){var _0x10fcf1=new Buffer(_0x8d62b9[_0xc7c0('0x16')](_0x192aa9),_0xc7c0('0x17'));_0x28ff4f[_0xc7c0('0x18')](_0x10fcf1);});_0x23b8f5['on']('end',function(){try{var _0x2fb143=new Buffer(_0x8d62b9[_0xc7c0('0x19')](_0xc7c0('0x17')),'binary');_0x28ff4f[_0xc7c0('0x18')](_0x2fb143);_0x28ff4f[_0xc7c0('0x1a')]();_0x28ff4f['on'](_0xc7c0('0x1b'),function(){return _0xda7618(_0x5e047d);});}catch(_0x449250){fs['unlink'](_0x5e047d);return _0x6a5d2d(_0x449250);}});});};exports[_0xc7c0('0x1c')]=function(_0x1edfa6,_0x3b881b,_0x21ae06,_0x2bd401){return new BPromise(function(_0x3fcfd3,_0x47f63b){_0x2bd401=combineOptions(_0x2bd401);var _0x5a5fdb=new Buffer(_0x21ae06);var _0x5de5d0=fs[_0xc7c0('0x12')](_0x1edfa6);var _0x5a677d=fs[_0xc7c0('0x13')](_0x3b881b);var _0x1ed652=crypto[_0xc7c0('0x1d')](_0x2bd401[_0xc7c0('0xa')],_0x5a5fdb);_0x5de5d0['on']('data',function(_0x3fe9a3){var _0x62f65b=new Buffer(_0x1ed652[_0xc7c0('0x16')](_0x3fe9a3),'binary');_0x5a677d[_0xc7c0('0x18')](_0x62f65b);});_0x5de5d0['on'](_0xc7c0('0x1a'),function(){try{var _0x5605ed=new Buffer(_0x1ed652[_0xc7c0('0x19')](_0xc7c0('0x17')),_0xc7c0('0x17'));_0x5a677d['write'](_0x5605ed);_0x5a677d['end']();_0x5a677d['on'](_0xc7c0('0x1b'),function(){return _0x3fcfd3(_0x3b881b);});}catch(_0x215278){fs[_0xc7c0('0x1e')](_0x3b881b);return _0x47f63b(_0x215278);}});});};exports[_0xc7c0('0x1f')]=function(_0x338093,_0x363a93,_0x3785db){var _0x456d16=_0x3785db||stringOptions[_0xc7c0('0xa')];var _0x3458d6=_0x363a93||stringOptions[_0xc7c0('0x20')];var _0x2733c9=crypto[_0xc7c0('0x14')](_0x456d16,_0x3458d6);var _0x24543c=_0x2733c9[_0xc7c0('0x16')](_0x338093,_0xc7c0('0x21'),_0xc7c0('0x22'));_0x24543c+=_0x2733c9[_0xc7c0('0x19')](_0xc7c0('0x22'));return _0x24543c;};exports['decryptString']=function(_0x46e17d,_0x4af487,_0x28c136){var _0x11e368=_0x28c136||stringOptions['algorithm'];var _0x2f891c=_0x4af487||stringOptions[_0xc7c0('0x20')];var _0x3891fe=crypto['createDecipher'](_0x11e368,_0x2f891c);var _0x36dfb0=_0x3891fe[_0xc7c0('0x16')](_0x46e17d,_0xc7c0('0x22'),_0xc7c0('0x21'));_0x36dfb0+=_0x3891fe[_0xc7c0('0x19')](_0xc7c0('0x21'));return _0x36dfb0;}; \ No newline at end of file +var _0xa0b6=['utf8','base64','decryptString','secret','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','aes192','algorithm','encrypt','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','update','write','end','final','binary','unlink','createDecipher','data','close','encryptString'];(function(_0x55f8bc,_0x33017c){var _0x5945b0=function(_0x5459fe){while(--_0x5459fe){_0x55f8bc['push'](_0x55f8bc['shift']());}};_0x5945b0(++_0x33017c);}(_0xa0b6,0x19c));var _0x6a0b=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xa0b6[_0x383356];return _0x32ee5a;};'use strict';var crypto=require(_0x6a0b('0x0'));var fs=require('fs');var BPromise=require(_0x6a0b('0x1'));var _=require(_0x6a0b('0x2'));var config=require(_0x6a0b('0x3'));var logger=require(_0x6a0b('0x4'))(_0x6a0b('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x6a0b('0x6')],'algorithm':_0x6a0b('0x7')};const fileOptions={'algorithm':_0x6a0b('0x8')};if(config['encrypt']&&config['encrypt'][_0x6a0b('0x9')]){var isSupported=isAlgorithmSupported(config[_0x6a0b('0xa')]['algorithm']);if(isSupported){fileOptions[_0x6a0b('0x9')]=config[_0x6a0b('0xa')][_0x6a0b('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6a0b('0xb')](',\x20');logger['error'](config[_0x6a0b('0xa')][_0x6a0b('0x9')],_0x6a0b('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x556039){return AES_SUPPORTED_RX[_0x6a0b('0xd')](_0x556039);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x6a0b('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x534a08){return getSupportedCiphers()[_0x6a0b('0xf')](_0x534a08)>-0x1;}function combineOptions(_0x14c7c5){var _0x174267={};for(var _0xc22605 in fileOptions){if(fileOptions['hasOwnProperty'](_0xc22605)){_0x174267[_0xc22605]=fileOptions[_0xc22605];}}if(_0x14c7c5){for(var _0x183407 in _0x14c7c5){if(_0x14c7c5[_0x6a0b('0x10')](_0x183407)){_0x174267[_0x183407]=_0x14c7c5[_0x183407];}}}return _0x174267;}exports['encryptFile']=function(_0x459baf,_0x2b70ed,_0x3c05d3,_0x7b9f20){return new BPromise(function(_0x18a42d,_0x7aab37){_0x7b9f20=combineOptions(_0x7b9f20);var _0x2898e2=new Buffer(_0x3c05d3);var _0x1c8e63=fs[_0x6a0b('0x11')](_0x459baf);var _0x286f8b=fs[_0x6a0b('0x12')](_0x2b70ed);var _0x7efc3e=crypto[_0x6a0b('0x13')](_0x7b9f20[_0x6a0b('0x9')],_0x2898e2);_0x1c8e63['on']('data',function(_0x10553e){var _0x3e837a=new Buffer(_0x7efc3e[_0x6a0b('0x14')](_0x10553e),'binary');_0x286f8b[_0x6a0b('0x15')](_0x3e837a);});_0x1c8e63['on'](_0x6a0b('0x16'),function(){try{var _0x2bf090=new Buffer(_0x7efc3e[_0x6a0b('0x17')](_0x6a0b('0x18')),_0x6a0b('0x18'));_0x286f8b['write'](_0x2bf090);_0x286f8b[_0x6a0b('0x16')]();_0x286f8b['on']('close',function(){return _0x18a42d(_0x2b70ed);});}catch(_0x440099){fs[_0x6a0b('0x19')](_0x2b70ed);return _0x7aab37(_0x440099);}});});};exports['decryptFile']=function(_0x58b255,_0x4e6523,_0x3e1139,_0x3ed882){return new BPromise(function(_0x4e43b4,_0x1dd0cf){_0x3ed882=combineOptions(_0x3ed882);var _0x41a3ab=new Buffer(_0x3e1139);var _0x819e70=fs[_0x6a0b('0x11')](_0x58b255);var _0x4e3086=fs[_0x6a0b('0x12')](_0x4e6523);var _0xc392e5=crypto[_0x6a0b('0x1a')](_0x3ed882['algorithm'],_0x41a3ab);_0x819e70['on'](_0x6a0b('0x1b'),function(_0x13274a){var _0x2eae39=new Buffer(_0xc392e5[_0x6a0b('0x14')](_0x13274a),_0x6a0b('0x18'));_0x4e3086[_0x6a0b('0x15')](_0x2eae39);});_0x819e70['on']('end',function(){try{var _0x42d548=new Buffer(_0xc392e5[_0x6a0b('0x17')](_0x6a0b('0x18')),_0x6a0b('0x18'));_0x4e3086[_0x6a0b('0x15')](_0x42d548);_0x4e3086[_0x6a0b('0x16')]();_0x4e3086['on'](_0x6a0b('0x1c'),function(){return _0x4e43b4(_0x4e6523);});}catch(_0x3cf000){fs[_0x6a0b('0x19')](_0x4e6523);return _0x1dd0cf(_0x3cf000);}});});};exports[_0x6a0b('0x1d')]=function(_0x27639d,_0x272a40,_0x4fb75c){var _0x5b80a0=_0x4fb75c||stringOptions['algorithm'];var _0x160287=_0x272a40||stringOptions['secret'];var _0x244dcf=crypto[_0x6a0b('0x13')](_0x5b80a0,_0x160287);var _0x5dde9b=_0x244dcf['update'](_0x27639d,_0x6a0b('0x1e'),_0x6a0b('0x1f'));_0x5dde9b+=_0x244dcf[_0x6a0b('0x17')]('base64');return _0x5dde9b;};exports[_0x6a0b('0x20')]=function(_0x41e755,_0x1d117d,_0x515886){var _0x3e439c=_0x515886||stringOptions[_0x6a0b('0x9')];var _0x3744c8=_0x1d117d||stringOptions[_0x6a0b('0x21')];var _0xbf0011=crypto[_0x6a0b('0x1a')](_0x3e439c,_0x3744c8);var _0x3e4f43=_0xbf0011['update'](_0x41e755,_0x6a0b('0x1f'),_0x6a0b('0x1e'));_0x3e4f43+=_0xbf0011[_0x6a0b('0x17')](_0x6a0b('0x1e'));return _0x3e4f43;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f313268..9ae33d8 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 _0x868b=['SELECT','num','Empty','length','range','forEach','push','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x3164cf,_0x2a2fa6){var _0x8fbf99=function(_0x144b35){while(--_0x144b35){_0x3164cf['push'](_0x3164cf['shift']());}};_0x8fbf99(++_0x2a2fa6);}(_0x868b,0x1e9));var _0xb868=function(_0x4d0180,_0x3c182e){_0x4d0180=_0x4d0180-0x0;var _0x3b91a9=_0x868b[_0x4d0180];return _0x3b91a9;};'use strict';var util=require(_0xb868('0x0'));var path=require(_0xb868('0x1'));var _=require(_0xb868('0x2'));var csv=require(_0xb868('0x3'));var fs=require('fs');var BPromise=require(_0xb868('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xb868('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb868('0x6'))['dbH'];var logger=require('../../config/logger')(_0xb868('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xb868('0x8')][0x2]);var QUERY=process[_0xb868('0x8')][0x3];var PATH=process[_0xb868('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e6748,_0x43dd1b){var _0x353dd9={'status':_0x2e6748};var _0x532559={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x43dd1b){_0x353dd9[_0xb868('0x9')]=_0x43dd1b;}return db[_0xb868('0xa')][_0xb868('0xb')](_0x353dd9,_0x532559);}function main(){var _0x152793=0x1388;var _0x28a23e;logger[_0xb868('0xc')](util[_0xb868('0xd')](_0xb868('0xe'),EXTRACTED_REPORT_ID,_0xb868('0xf')));return db[_0xb868('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb868('0x11'),_0xb868('0x12')]})[_0xb868('0x13')](function(_0x4e60b7){if(_0x4e60b7){_0x28a23e=_0x4e60b7;_0x152793=_0x28a23e[_0xb868('0x12')]||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0xb868('0xd')](_0xb868('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xb868('0x15')]});})[_0xb868('0x13')](function(_0xe8f395){if(!_0xe8f395[0x0][_0xb868('0x16')]){return analyticExtractedReport(_0xb868('0x17'));}var _0x2d5792=[];var _0x2da7a2=0x0;if(_0x28a23e[_0xb868('0x11')]){if(_0xe8f395&&_0xe8f395[_0xb868('0x18')]){var _0x292a09=_[_0xb868('0x19')](_0xe8f395[0x0][_0xb868('0x16')]/_0x152793);var _0x477fb8=Number['isInteger'](_0xe8f395[0x0][_0xb868('0x16')]/_0x152793)?_0xe8f395[0x0]['num']%_0x152793:0x0;_0x292a09[_0xb868('0x1a')](function(_0x449154){if(_0x449154>0x0){_0x2da7a2+=_0x152793;}_0x2d5792[_0xb868('0x1b')](dbH[_0xb868('0x1c')][_0xb868('0x1d')](util['format'](_0xb868('0x1e'),QUERY,_0x152793,_0x2da7a2),{'type':dbH['sequelize'][_0xb868('0x1f')][_0xb868('0x15')]}));});if(_0x477fb8>0x0){_0x2da7a2+=_0x152793;_0x2d5792[_0xb868('0x1b')](dbH[_0xb868('0x1c')][_0xb868('0x1d')](util[_0xb868('0xd')](_0xb868('0x1e'),QUERY,_0x477fb8,_0x2da7a2),{'type':dbH[_0xb868('0x1c')]['QueryTypes'][_0xb868('0x15')]}));}}}else{_0x2d5792['push'](dbH[_0xb868('0x1c')][_0xb868('0x1d')](QUERY,{'type':dbH[_0xb868('0x1c')][_0xb868('0x1f')][_0xb868('0x15')]}));}var _0x495ae7=path[_0xb868('0x20')](PATH);var _0x3c1b7e=path[_0xb868('0x21')](PATH,_0xb868('0x22'));var _0x3a8eb9=_0x28a23e[_0xb868('0x11')]&&_0x2d5792['length']>0x1;var _0x384d62=[];if(!fs[_0xb868('0x23')](path[_0xb868('0x24')](_0x495ae7,_0x3c1b7e))&&_0x3a8eb9){fs['mkdirSync'](path[_0xb868('0x24')](_0x495ae7,_0x3c1b7e));}return BPromise[_0xb868('0x25')](_0x2d5792,function(_0x3a9a3e){_0x384d62[_0xb868('0x1b')](_0x3a9a3e);})[_0xb868('0x13')](function(){for(var _0x21f735=0x0;_0x21f735<_0x384d62[_0xb868('0x18')];_0x21f735+=0x1){var _0x1edee3;var _0x397f61=_0x384d62[_0x21f735];if(_0x3a8eb9){_0x1edee3=path['join'](_0x495ae7,_0x3c1b7e,util[_0xb868('0xd')](_0xb868('0x26'),_0x3c1b7e,_0x21f735,_0xb868('0x27')));}else{_0x1edee3=path[_0xb868('0x24')](_0x495ae7,util[_0xb868('0xd')](_0xb868('0x28'),_0x3c1b7e,'csv'));}fs['writeFileSync'](_0x1edee3,csv(_0x397f61));}})[_0xb868('0x13')](function(){if(_0x3a8eb9){return new Promise(function(_0x2675e6){zipdir(path[_0xb868('0x24')](_0x495ae7,_0x3c1b7e),{'saveTo':path[_0xb868('0x24')](_0x495ae7,util['format']('%s.%s',_0x3c1b7e,_0xb868('0x29')))},function(_0x16a50c,_0x5862dc){rimraf(path['join'](_0x495ae7,_0x3c1b7e),function(){});_0x2675e6(_0xb868('0x2a'));});});}})[_0xb868('0x13')](function(){logger[_0xb868('0xc')](util[_0xb868('0xd')](_0xb868('0x2b'),EXTRACTED_REPORT_ID,_0xb868('0xf')));return analyticExtractedReport(_0xb868('0x2c'),_0x3a8eb9?util['format']('%s.%s',_0x3c1b7e,_0x3a8eb9?_0xb868('0x29'):_0xb868('0x27')):null);});})[_0xb868('0x2d')](function(_0x5a1143){logger[_0xb868('0xc')](util['format'](_0xb868('0x2e'),EXTRACTED_REPORT_ID,_0xb868('0xf')),util[_0xb868('0x2f')](_0x5a1143,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb868('0x30'));})[_0xb868('0x31')](function(){process[_0xb868('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x755f=['%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','exit','path','lodash','to-csv','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','query','sequelize','QueryTypes','SELECT','num','length','push'];(function(_0x175ecb,_0x55b4a6){var _0x14449a=function(_0xeee57){while(--_0xeee57){_0x175ecb['push'](_0x175ecb['shift']());}};_0x14449a(++_0x55b4a6);}(_0x755f,0x6c));var _0xf755=function(_0xf84186,_0x4dbffe){_0xf84186=_0xf84186-0x0;var _0x4e397c=_0x755f[_0xf84186];return _0x4e397c;};'use strict';var util=require('util');var path=require(_0xf755('0x0'));var _=require(_0xf755('0x1'));var csv=require(_0xf755('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xf755('0x3'));var rimraf=require('rimraf');var db=require(_0xf755('0x4'))['db'];var dbH=require(_0xf755('0x4'))[_0xf755('0x5')];var logger=require(_0xf755('0x6'))(_0xf755('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xf755('0x8')][0x2]);var QUERY=process[_0xf755('0x8')][0x3];var PATH=process[_0xf755('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b64db,_0x3eeec6){var _0x2f63eb={'status':_0x5b64db};var _0x39e42a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3eeec6){_0x2f63eb[_0xf755('0x9')]=_0x3eeec6;}return db[_0xf755('0xa')][_0xf755('0xb')](_0x2f63eb,_0x39e42a);}function main(){var _0x5a709e=0x1388;var _0x23692c;logger[_0xf755('0xc')](util[_0xf755('0xd')](_0xf755('0xe'),EXTRACTED_REPORT_ID,_0xf755('0xf')));return db['Setting'][_0xf755('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf755('0x11'),_0xf755('0x12')]})[_0xf755('0x13')](function(_0x40ee10){if(_0x40ee10){_0x23692c=_0x40ee10;_0x5a709e=_0x23692c[_0xf755('0x12')]||0x1388;}})[_0xf755('0x13')](function(){return dbH['sequelize'][_0xf755('0x14')](util[_0xf755('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf755('0x15')][_0xf755('0x16')][_0xf755('0x17')]});})[_0xf755('0x13')](function(_0x42feee){if(!_0x42feee[0x0][_0xf755('0x18')]){return analyticExtractedReport('Empty');}var _0x5abb8e=[];var _0x34bdc2=0x0;if(_0x23692c[_0xf755('0x11')]){if(_0x42feee&&_0x42feee[_0xf755('0x19')]){var _0x3d3235=_['range'](_0x42feee[0x0][_0xf755('0x18')]/_0x5a709e);var _0x3e0972=Number['isInteger'](_0x42feee[0x0][_0xf755('0x18')]/_0x5a709e)?_0x42feee[0x0][_0xf755('0x18')]%_0x5a709e:0x0;_0x3d3235['forEach'](function(_0x490630){if(_0x490630>0x0){_0x34bdc2+=_0x5a709e;}_0x5abb8e[_0xf755('0x1a')](dbH[_0xf755('0x15')][_0xf755('0x14')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a709e,_0x34bdc2),{'type':dbH['sequelize'][_0xf755('0x16')]['SELECT']}));});if(_0x3e0972>0x0){_0x34bdc2+=_0x5a709e;_0x5abb8e[_0xf755('0x1a')](dbH[_0xf755('0x15')]['query'](util['format'](_0xf755('0x1b'),QUERY,_0x3e0972,_0x34bdc2),{'type':dbH[_0xf755('0x15')][_0xf755('0x16')][_0xf755('0x17')]}));}}}else{_0x5abb8e[_0xf755('0x1a')](dbH[_0xf755('0x15')]['query'](QUERY,{'type':dbH[_0xf755('0x15')][_0xf755('0x16')][_0xf755('0x17')]}));}var _0x59f1fa=path[_0xf755('0x1c')](PATH);var _0x36017c=path[_0xf755('0x1d')](PATH,_0xf755('0x1e'));var _0x4f5739=_0x23692c[_0xf755('0x11')]&&_0x5abb8e[_0xf755('0x19')]>0x1;var _0x1a26ce=[];if(!fs[_0xf755('0x1f')](path[_0xf755('0x20')](_0x59f1fa,_0x36017c))&&_0x4f5739){fs['mkdirSync'](path[_0xf755('0x20')](_0x59f1fa,_0x36017c));}return BPromise[_0xf755('0x21')](_0x5abb8e,function(_0x2fafee){_0x1a26ce[_0xf755('0x1a')](_0x2fafee);})['then'](function(){for(var _0x5e1a4b=0x0;_0x5e1a4b<_0x1a26ce[_0xf755('0x19')];_0x5e1a4b+=0x1){var _0x14680b;var _0x45546b=_0x1a26ce[_0x5e1a4b];if(_0x4f5739){_0x14680b=path[_0xf755('0x20')](_0x59f1fa,_0x36017c,util[_0xf755('0xd')](_0xf755('0x22'),_0x36017c,_0x5e1a4b,_0xf755('0x23')));}else{_0x14680b=path[_0xf755('0x20')](_0x59f1fa,util['format'](_0xf755('0x24'),_0x36017c,'csv'));}fs[_0xf755('0x25')](_0x14680b,csv(_0x45546b));}})[_0xf755('0x13')](function(){if(_0x4f5739){return new Promise(function(_0x2cb290){zipdir(path[_0xf755('0x20')](_0x59f1fa,_0x36017c),{'saveTo':path['join'](_0x59f1fa,util[_0xf755('0xd')]('%s.%s',_0x36017c,_0xf755('0x26')))},function(_0x3bcab2,_0x8d460e){rimraf(path[_0xf755('0x20')](_0x59f1fa,_0x36017c),function(){});_0x2cb290('zip\x20finished');});});}})['then'](function(){logger[_0xf755('0xc')](util[_0xf755('0xd')](_0xf755('0x27'),EXTRACTED_REPORT_ID,_0xf755('0xf')));return analyticExtractedReport(_0xf755('0x28'),_0x4f5739?util[_0xf755('0xd')](_0xf755('0x24'),_0x36017c,_0x4f5739?_0xf755('0x26'):'csv'):null);});})[_0xf755('0x29')](function(_0x5caf80){logger['info'](util[_0xf755('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf755('0xf')),util[_0xf755('0x2a')](_0x5caf80,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf755('0x2b'));})['finally'](function(){process[_0xf755('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 6647965..4361b3e 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 _0x709d=['sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.pdf','existsSync','join','mkdirSync','each','%s.%s','pdf','all','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','error','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','length','auto','body','push','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','splitSizePdf','then','split','range','forEach'];(function(_0x4c4242,_0xde3ab0){var _0xee38c3=function(_0x201780){while(--_0x201780){_0x4c4242['push'](_0x4c4242['shift']());}};_0xee38c3(++_0xde3ab0);}(_0x709d,0xdc));var _0xd709=function(_0x1821b2,_0x5e82a8){_0x1821b2=_0x1821b2-0x0;var _0x17022d=_0x709d[_0x1821b2];return _0x17022d;};'use strict';var _=require(_0xd709('0x0'));var fs=require('fs');var util=require(_0xd709('0x1'));var path=require(_0xd709('0x2'));var moment=require(_0xd709('0x3'));var htmlToPdfmake=require(_0xd709('0x4'));var PdfPrinter=require(_0xd709('0x5'));var zipdir=require(_0xd709('0x6'));var rimraf=require(_0xd709('0x7'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0xd709('0x8')];var BPromise=require(_0xd709('0x9'));var db=require(_0xd709('0xa'))['db'];var dbH=require(_0xd709('0xa'))[_0xd709('0xb')];var logger=require(_0xd709('0xc'))(_0xd709('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xd709('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd709('0xe')][0x4];var NAME=process[_0xd709('0xe')][0x5];var FORMAT=_0xd709('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2f59cd,_0x2cc520){var _0x5cde0b={'status':_0x2f59cd};var _0x161c94={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2cc520){_0x5cde0b[_0xd709('0x10')]=_0x2cc520;}return db[_0xd709('0x11')]['update'](_0x5cde0b,_0x161c94);}function getHeaders(_0x23774){return _[_0xd709('0x12')](_0x23774,function(_0x57f1e8){return{'text':_0x57f1e8,'style':_0xd709('0x13')};});}function getRows(_0x491e20,_0x3df379){return _[_0xd709('0x12')](_0x3df379,function(_0x37a24a){return _(_0x37a24a)[_0xd709('0x14')](_0x491e20)[_0xd709('0x12')](function(_0x5c0454){return _0x5c0454?_[_0xd709('0x15')](_0x5c0454):'';})[_0xd709('0x16')]();});}function createTable(_0x5d1a37,_0x45e59b){var _0x3ffedc={'widths':_[_0xd709('0x17')](Array(_0x5d1a37[_0xd709('0x18')]),0x91),'heights':function(_0x1cde28){return _0x1cde28===0x0?_0xd709('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x338796=getHeaders(_0x5d1a37);_0x3ffedc[_0xd709('0x1a')][_0xd709('0x1b')](_0x338796);var _0x3f157a=getRows(_0x5d1a37,_0x45e59b);_0x3ffedc[_0xd709('0x1a')]=_0x3ffedc[_0xd709('0x1a')]['concat'](_0x3f157a);return _0x3ffedc;}function createTables(_0x30a882){var _0x1044fb=[];var _0x243683=_[_0xd709('0x1c')](Object[_0xd709('0x1d')](_0x30a882[0x0]),0x5);_0x243683['forEach'](function(_0x23b5ff){_0x1044fb[_0xd709('0x1b')](createTable(_0x23b5ff,_0x30a882));});return _0x1044fb;}function getPDFDocDefinition(_0x48e45c){var _0x1a8c57=util[_0xd709('0x1e')](_0xd709('0x1f'),NAME,EXTRACTED_REPORT[_0xd709('0x20')],moment(EXTRACTED_REPORT[_0xd709('0x21')])[_0xd709('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xd709('0x22')])['format'](FORMAT));var _0x3a18b2=[];for(var _0x20d280=0x0;_0x20d280<_0x48e45c[_0xd709('0x18')];_0x20d280++){var _0x57cd9a=[];if(_0x20d280===0x0){_0x57cd9a[_0xd709('0x1b')]({'text':_0x1a8c57,'style':'header'});}var _0x5b43b7={'table':_0x48e45c[_0x20d280]};if(_0x20d280>0x0){_0x5b43b7[_0xd709('0x23')]=_0xd709('0x24');_0x5b43b7[_0xd709('0x25')]=[0x0,0x46,0x0,0x0];}_0x57cd9a[_0xd709('0x1b')](_0x5b43b7);_0x3a18b2['push'](_0x57cd9a);}return{'pageSize':'A4','pageOrientation':_0xd709('0x26'),'content':_0x3a18b2,'footer':function(_0xcb1fbd,_0x5ab9d9){return{'text':_0xcb1fbd[_0xd709('0x15')]()+_0xd709('0x27')+_0x5ab9d9,'style':_0xd709('0x28')};},'defaultStyle':{'font':_0xd709('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd709('0x2a')},'footer':{'alignment':_0xd709('0x2b'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3f0212){var _0x3bf8bc=0x1388;var _0x206efb;if(!_0x3f0212[0x0][_0xd709('0x2c')]){return analyticExtractedReport(_0xd709('0x2d'));}return db[_0xd709('0x2e')][_0xd709('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd709('0x30')]})[_0xd709('0x31')](function(_0x34015f){if(_0x34015f){_0x206efb=_0x34015f;_0x3bf8bc=_0x206efb[_0xd709('0x30')]||0x3e8;}})['then'](function(){var _0x29b27b=[];var _0x3b85f2=0x0;if(_0x206efb[_0xd709('0x32')]){if(_0x3f0212&&_0x3f0212[_0xd709('0x18')]){var _0x1c7109=_[_0xd709('0x33')](_0x3f0212[0x0][_0xd709('0x2c')]/_0x3bf8bc);var _0x2bc972=Number['isInteger'](_0x3f0212[0x0][_0xd709('0x2c')]/_0x3bf8bc)?_0x3f0212[0x0][_0xd709('0x2c')]%_0x3bf8bc:0x0;_0x1c7109[_0xd709('0x34')](function(_0x1a6c17){if(_0x1a6c17>0x0){_0x3b85f2+=_0x3bf8bc;}_0x29b27b[_0xd709('0x1b')](dbH[_0xd709('0x35')][_0xd709('0x36')](util[_0xd709('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3bf8bc,_0x3b85f2),{'type':dbH[_0xd709('0x35')][_0xd709('0x37')][_0xd709('0x38')]}));});if(_0x2bc972>0x0){_0x3b85f2+=_0x3bf8bc;_0x29b27b['push'](dbH[_0xd709('0x35')][_0xd709('0x36')](util['format'](_0xd709('0x39'),QUERY,_0x2bc972,_0x3b85f2),{'type':dbH[_0xd709('0x35')][_0xd709('0x37')][_0xd709('0x38')]}));}}}else{_0x29b27b[_0xd709('0x1b')](dbH[_0xd709('0x35')]['query'](QUERY,{'type':dbH['sequelize'][_0xd709('0x37')][_0xd709('0x38')]}));}var _0x204176=path[_0xd709('0x3a')](PATH);var _0x196f70=path['basename'](PATH,_0xd709('0x3b'));var _0x2c5a55=_0x206efb[_0xd709('0x32')]&&_0x29b27b[_0xd709('0x18')]>0x1;var _0x1f9ad2=[];if(!fs[_0xd709('0x3c')](path[_0xd709('0x3d')](_0x204176,_0x196f70))&&_0x2c5a55){fs[_0xd709('0x3e')](path[_0xd709('0x3d')](_0x204176,_0x196f70));}return BPromise[_0xd709('0x3f')](_0x29b27b,function(_0x3a332b){_0x1f9ad2[_0xd709('0x1b')](_0x3a332b);})[_0xd709('0x31')](function(){var _0xa4a2d1=[];for(var _0x309745=0x0;_0x309745<_0x1f9ad2['length'];_0x309745+=0x1){var _0x12b54a=_0x1f9ad2[_0x309745];var _0x26f8d7=createTables(_['flatten'](_0x12b54a));var _0x5aa83c;var _0x8395c9=getPDFDocDefinition(_0x26f8d7);var _0x54c032=getPDFPrinter();var _0x1bf521=_0x54c032['createPdfKitDocument'](_0x8395c9);if(_0x2c5a55){_0x5aa83c=path[_0xd709('0x3d')](_0x204176,_0x196f70,util[_0xd709('0x1e')]('%s%d.%s',_0x196f70,_0x309745,'pdf'));}else{_0x5aa83c=path[_0xd709('0x3d')](_0x204176,util['format'](_0xd709('0x40'),_0x196f70,_0xd709('0x41')));}_0xa4a2d1['push'](writePDFDocument(_0x1bf521,_0x5aa83c));}return Promise[_0xd709('0x42')](_0xa4a2d1);})[_0xd709('0x31')](function(){if(_0x2c5a55){return new Promise(function(_0x1e173d){zipdir(path[_0xd709('0x3d')](_0x204176,_0x196f70),{'saveTo':path[_0xd709('0x3d')](_0x204176,util['format'](_0xd709('0x40'),_0x196f70,_0xd709('0x43')))},function(){rimraf(path['join'](_0x204176,_0x196f70),function(){});_0x1e173d('zip\x20finished');});});}})[_0xd709('0x31')](function(){if(!_0x2c5a55)return;rimraf(path[_0xd709('0x3d')](_0x204176,_0x196f70),function(){});})['then'](function(){logger['info'](util[_0xd709('0x1e')](_0xd709('0x44'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xd709('0x45'),_0x2c5a55?util[_0xd709('0x1e')](_0xd709('0x40'),_0x196f70,_0x2c5a55?_0xd709('0x43'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd709('0x46')](util[_0xd709('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd709('0x47')));return db[_0xd709('0x11')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd709('0x31')](function(_0x13c907){EXTRACTED_REPORT=_0x13c907;return dbH[_0xd709('0x35')]['query'](util[_0xd709('0x1e')](_0xd709('0x48'),QUERY),{'type':dbH[_0xd709('0x35')][_0xd709('0x37')][_0xd709('0x38')]});})['then'](extractReport)[_0xd709('0x49')](function(_0x4bfa19){logger[_0xd709('0x46')](util['format'](_0xd709('0x4a'),EXTRACTED_REPORT_ID,_0xd709('0x47')),util['inspect'](_0x4bfa19,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd709('0x4b'));})['finally'](function(){process[_0xd709('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3cb6e0=new PdfPrinter({'Arial':{'normal':__dirname+_0xd709('0x4d'),'bold':__dirname+_0xd709('0x4e'),'italics':__dirname+_0xd709('0x4f'),'bolditalics':__dirname+_0xd709('0x50')}});return _0x3cb6e0;}function getPDFDocDefinitionFromHTML(_0x28ad7a,_0x3ef4b3){var _0x5cb56f=util['format'](_0xd709('0x51'),_0x3ef4b3[_0xd709('0x52')],_0x3ef4b3[_0xd709('0x53')]);var _0x3bfac8=moment()[_0xd709('0x1e')](_0xd709('0x54'))[_0xd709('0x15')]();var _0x2c164c=htmlToPdfmake(_0x28ad7a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2c164c],'defaultStyle':{'font':_0xd709('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd709('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd709('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd709('0x55')}},'header':function(){return[{'text':_0xd709('0x56'),'style':'header'}];},'footer':function(_0x3f4021,_0x7eef76){return[{'text':util[_0xd709('0x1e')](_0xd709('0x57'),_0x5cb56f,_0x3f4021,_0x7eef76,_0x3bfac8),'style':'footer'}];}};}function writePDFDocument(_0x497154,_0x47d921){return new Promise(function(_0x5804bb,_0x29a70a){var _0x2a28fb=_0x497154[_0xd709('0x58')](fs['createWriteStream'](_0x47d921));_0x2a28fb['on']('finish',function(){_0x5804bb('finish');});_0x2a28fb['on'](_0xd709('0x59'),function(_0x218f7a){_0x29a70a(_0x218f7a);});_0x497154['end']();});}exports['createPdfFromHTML']=function(_0x2b503f,_0x3eff71){var _0x5d6ac3=getPDFPrinter();var _0x4fab59=getPDFDocDefinitionFromHTML(_0x2b503f,_0x3eff71);var _0x3ef07f=_0x5d6ac3[_0xd709('0x5a')](_0x4fab59);return writePDFDocument(_0x3ef07f,_0x3eff71[_0xd709('0x2')])[_0xd709('0x49')](function(_0x440604){throw _0x440604;});}; \ No newline at end of file +var _0x74ba=['zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','%s.%s','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','toString','Arial','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','finish','error','createPdfFromHTML','util','path','moment','html-to-pdfmake','zip-dir','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','tableHeader','map','pick','value','fill','length','auto','body','push','concat','keys','forEach','name','startDate','format','header','pageBreak','before','margin','\x20/\x20','black','num','Empty','Setting','find','splitSizePdf','then','split','range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','all'];(function(_0x285f69,_0x534abd){var _0x1b65e4=function(_0x241e13){while(--_0x241e13){_0x285f69['push'](_0x285f69['shift']());}};_0x1b65e4(++_0x534abd);}(_0x74ba,0x111));var _0xa74b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x74ba[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xa74b('0x0'));var path=require(_0xa74b('0x1'));var moment=require(_0xa74b('0x2'));var htmlToPdfmake=require(_0xa74b('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xa74b('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0xa74b('0x5'))[_0xa74b('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0xa74b('0x7'));var db=require(_0xa74b('0x8'))['db'];var dbH=require(_0xa74b('0x8'))[_0xa74b('0x9')];var logger=require(_0xa74b('0xa'))(_0xa74b('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0xa74b('0xc')][0x2]);var QUERY=process[_0xa74b('0xc')][0x3];var PATH=process[_0xa74b('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xa74b('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xd3601a,_0x3456c2){var _0x5e89aa={'status':_0xd3601a};var _0x38ab13={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3456c2){_0x5e89aa[_0xa74b('0xe')]=_0x3456c2;}return db[_0xa74b('0xf')]['update'](_0x5e89aa,_0x38ab13);}function getHeaders(_0x12b7c6){return _['map'](_0x12b7c6,function(_0x5df8e8){return{'text':_0x5df8e8,'style':_0xa74b('0x10')};});}function getRows(_0x4d25e7,_0x3b908a){return _[_0xa74b('0x11')](_0x3b908a,function(_0x426d45){return _(_0x426d45)[_0xa74b('0x12')](_0x4d25e7)['map'](function(_0x30c776){return _0x30c776?_['toString'](_0x30c776):'';})[_0xa74b('0x13')]();});}function createTable(_0xa9f0a4,_0x4b3f7f){var _0x2b359c={'widths':_[_0xa74b('0x14')](Array(_0xa9f0a4[_0xa74b('0x15')]),0x91),'heights':function(_0x2e4d5c){return _0x2e4d5c===0x0?_0xa74b('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1334d6=getHeaders(_0xa9f0a4);_0x2b359c[_0xa74b('0x17')][_0xa74b('0x18')](_0x1334d6);var _0x4c40cd=getRows(_0xa9f0a4,_0x4b3f7f);_0x2b359c[_0xa74b('0x17')]=_0x2b359c[_0xa74b('0x17')][_0xa74b('0x19')](_0x4c40cd);return _0x2b359c;}function createTables(_0x12c243){var _0x1ba48d=[];var _0x945492=_['chunk'](Object[_0xa74b('0x1a')](_0x12c243[0x0]),0x5);_0x945492[_0xa74b('0x1b')](function(_0x59e446){_0x1ba48d[_0xa74b('0x18')](createTable(_0x59e446,_0x12c243));});return _0x1ba48d;}function getPDFDocDefinition(_0xfcca82){var _0x1a1844=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xa74b('0x1c')],moment(EXTRACTED_REPORT[_0xa74b('0x1d')])[_0xa74b('0x1e')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xa74b('0x1e')](FORMAT));var _0x5e5626=[];for(var _0xd1dbee=0x0;_0xd1dbee<_0xfcca82[_0xa74b('0x15')];_0xd1dbee++){var _0x11db4f=[];if(_0xd1dbee===0x0){_0x11db4f[_0xa74b('0x18')]({'text':_0x1a1844,'style':_0xa74b('0x1f')});}var _0x35a300={'table':_0xfcca82[_0xd1dbee]};if(_0xd1dbee>0x0){_0x35a300[_0xa74b('0x20')]=_0xa74b('0x21');_0x35a300[_0xa74b('0x22')]=[0x0,0x46,0x0,0x0];}_0x11db4f[_0xa74b('0x18')](_0x35a300);_0x5e5626[_0xa74b('0x18')](_0x11db4f);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x5e5626,'footer':function(_0x1852ee,_0x3a0e76){return{'text':_0x1852ee['toString']()+_0xa74b('0x23')+_0x3a0e76,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa74b('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3414bf){var _0x1adccd=0x1388;var _0x572e2e;if(!_0x3414bf[0x0][_0xa74b('0x25')]){return analyticExtractedReport(_0xa74b('0x26'));}return db[_0xa74b('0x27')][_0xa74b('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa74b('0x29')]})[_0xa74b('0x2a')](function(_0x1cdb30){if(_0x1cdb30){_0x572e2e=_0x1cdb30;_0x1adccd=_0x572e2e[_0xa74b('0x29')]||0x3e8;}})['then'](function(){var _0x3a6254=[];var _0x146cb7=0x0;if(_0x572e2e[_0xa74b('0x2b')]){if(_0x3414bf&&_0x3414bf[_0xa74b('0x15')]){var _0x3822cf=_[_0xa74b('0x2c')](_0x3414bf[0x0]['num']/_0x1adccd);var _0x528a68=Number['isInteger'](_0x3414bf[0x0]['num']/_0x1adccd)?_0x3414bf[0x0][_0xa74b('0x25')]%_0x1adccd:0x0;_0x3822cf[_0xa74b('0x1b')](function(_0xc8ec32){if(_0xc8ec32>0x0){_0x146cb7+=_0x1adccd;}_0x3a6254[_0xa74b('0x18')](dbH[_0xa74b('0x2d')][_0xa74b('0x2e')](util[_0xa74b('0x1e')](_0xa74b('0x2f'),QUERY,_0x1adccd,_0x146cb7),{'type':dbH[_0xa74b('0x2d')][_0xa74b('0x30')][_0xa74b('0x31')]}));});if(_0x528a68>0x0){_0x146cb7+=_0x1adccd;_0x3a6254[_0xa74b('0x18')](dbH[_0xa74b('0x2d')][_0xa74b('0x2e')](util[_0xa74b('0x1e')](_0xa74b('0x2f'),QUERY,_0x528a68,_0x146cb7),{'type':dbH['sequelize'][_0xa74b('0x30')][_0xa74b('0x31')]}));}}}else{_0x3a6254['push'](dbH[_0xa74b('0x2d')]['query'](QUERY,{'type':dbH['sequelize'][_0xa74b('0x30')][_0xa74b('0x31')]}));}var _0x2dbfc2=path['dirname'](PATH);var _0x4b859d=path['basename'](PATH,_0xa74b('0x32'));var _0x2e6883=_0x572e2e['split']&&_0x3a6254[_0xa74b('0x15')]>0x1;var _0x19e55f=[];if(!fs[_0xa74b('0x33')](path[_0xa74b('0x34')](_0x2dbfc2,_0x4b859d))&&_0x2e6883){fs['mkdirSync'](path[_0xa74b('0x34')](_0x2dbfc2,_0x4b859d));}return BPromise[_0xa74b('0x35')](_0x3a6254,function(_0x3768de){_0x19e55f[_0xa74b('0x18')](_0x3768de);})[_0xa74b('0x2a')](function(){var _0x44ed6c=[];for(var _0x19e90e=0x0;_0x19e90e<_0x19e55f[_0xa74b('0x15')];_0x19e90e+=0x1){var _0x14bd5f=_0x19e55f[_0x19e90e];var _0xe8f13a=createTables(_[_0xa74b('0x36')](_0x14bd5f));var _0x1273c5;var _0x2326ba=getPDFDocDefinition(_0xe8f13a);var _0x1c707e=getPDFPrinter();var _0x272138=_0x1c707e[_0xa74b('0x37')](_0x2326ba);if(_0x2e6883){_0x1273c5=path[_0xa74b('0x34')](_0x2dbfc2,_0x4b859d,util[_0xa74b('0x1e')](_0xa74b('0x38'),_0x4b859d,_0x19e90e,_0xa74b('0x39')));}else{_0x1273c5=path[_0xa74b('0x34')](_0x2dbfc2,util[_0xa74b('0x1e')]('%s.%s',_0x4b859d,_0xa74b('0x39')));}_0x44ed6c['push'](writePDFDocument(_0x272138,_0x1273c5));}return Promise[_0xa74b('0x3a')](_0x44ed6c);})[_0xa74b('0x2a')](function(){if(_0x2e6883){return new Promise(function(_0x3ce479){zipdir(path[_0xa74b('0x34')](_0x2dbfc2,_0x4b859d),{'saveTo':path[_0xa74b('0x34')](_0x2dbfc2,util[_0xa74b('0x1e')]('%s.%s',_0x4b859d,'zip'))},function(){rimraf(path[_0xa74b('0x34')](_0x2dbfc2,_0x4b859d),function(){});_0x3ce479(_0xa74b('0x3b'));});});}})['then'](function(){if(!_0x2e6883)return;rimraf(path['join'](_0x2dbfc2,_0x4b859d),function(){});})[_0xa74b('0x2a')](function(){logger[_0xa74b('0x3c')](util[_0xa74b('0x1e')](_0xa74b('0x3d'),EXTRACTED_REPORT_ID,_0xa74b('0x3e')));return analyticExtractedReport('Completed',_0x2e6883?util[_0xa74b('0x1e')](_0xa74b('0x3f'),_0x4b859d,_0x2e6883?'zip':_0xa74b('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xa74b('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa74b('0x3e')));return db[_0xa74b('0xf')][_0xa74b('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa74b('0x2a')](function(_0x1a3660){EXTRACTED_REPORT=_0x1a3660;return dbH['sequelize'][_0xa74b('0x2e')](util['format'](_0xa74b('0x41'),QUERY),{'type':dbH[_0xa74b('0x2d')][_0xa74b('0x30')][_0xa74b('0x31')]});})[_0xa74b('0x2a')](extractReport)[_0xa74b('0x42')](function(_0x5757ad){logger[_0xa74b('0x3c')](util[_0xa74b('0x1e')](_0xa74b('0x43'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x5757ad,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa74b('0x44')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x280112=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xa74b('0x45'),'italics':__dirname+_0xa74b('0x46'),'bolditalics':__dirname+_0xa74b('0x47')}});return _0x280112;}function getPDFDocDefinitionFromHTML(_0x3b0a98,_0x22d739){var _0x4c3133=util[_0xa74b('0x1e')](_0xa74b('0x48'),_0x22d739['channel'],_0x22d739[_0xa74b('0x49')]);var _0x4e5f5d=moment()['format'](_0xa74b('0x4a'))[_0xa74b('0x4b')]();var _0x3dbe6b=htmlToPdfmake(_0x3b0a98,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3dbe6b],'defaultStyle':{'font':_0xa74b('0x4c')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa74b('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa74b('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa74b('0x4d')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0xa74b('0x1f')}];},'footer':function(_0x580783,_0x20cfd1){return[{'text':util['format'](_0xa74b('0x4e'),_0x4c3133,_0x580783,_0x20cfd1,_0x4e5f5d),'style':_0xa74b('0x4f')}];}};}function writePDFDocument(_0x5c5b03,_0x3d3a08){return new Promise(function(_0x1c769f,_0x339513){var _0x53ae6c=_0x5c5b03['pipe'](fs['createWriteStream'](_0x3d3a08));_0x53ae6c['on'](_0xa74b('0x50'),function(){_0x1c769f(_0xa74b('0x50'));});_0x53ae6c['on'](_0xa74b('0x51'),function(_0x1edb81){_0x339513(_0x1edb81);});_0x5c5b03['end']();});}exports[_0xa74b('0x52')]=function(_0x518683,_0x9e2fc){var _0x51e7ae=getPDFPrinter();var _0x535d43=getPDFDocDefinitionFromHTML(_0x518683,_0x9e2fc);var _0xb5d251=_0x51e7ae[_0xa74b('0x37')](_0x535d43);return writePDFDocument(_0xb5d251,_0x9e2fc[_0xa74b('0x1')])[_0xa74b('0x42')](function(_0xb10b21){throw _0xb10b21;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 8a34dd1..cf8527a 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 _0xe798=['lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','query','dirname','.xlsx','split','join','mkdirSync','each','xlsx','%s.%s','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path'];(function(_0x32b8a9,_0x59d62b){var _0x40105c=function(_0x54c048){while(--_0x54c048){_0x32b8a9['push'](_0x32b8a9['shift']());}};_0x40105c(++_0x59d62b);}(_0xe798,0xe4));var _0x8e79=function(_0x23d666,_0x5deeae){_0x23d666=_0x23d666-0x0;var _0x3150b9=_0xe798[_0x23d666];return _0x3150b9;};'use strict';var util=require(_0x8e79('0x0'));var path=require(_0x8e79('0x1'));var _=require(_0x8e79('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x8e79('0x3'));var zipdir=require(_0x8e79('0x4'));var rimraf=require('rimraf');var db=require(_0x8e79('0x5'))['db'];var dbH=require(_0x8e79('0x5'))[_0x8e79('0x6')];var logger=require(_0x8e79('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x8e79('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x8e79('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x22d41b,_0x19b51d){var _0x8fee14={'status':_0x22d41b};var _0x53bce4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x19b51d){_0x8fee14['savename']=_0x19b51d;}return db[_0x8e79('0x9')][_0x8e79('0xa')](_0x8fee14,_0x53bce4);}function main(){var _0x58f8ae=0x1388;var _0x14147f;logger[_0x8e79('0xb')](util[_0x8e79('0xc')](_0x8e79('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x8e79('0xe')][_0x8e79('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8e79('0x10')]})[_0x8e79('0x11')](function(_0x2e5a33){if(_0x2e5a33){_0x14147f=_0x2e5a33;_0x58f8ae=_0x14147f[_0x8e79('0x10')]||0x1388;}})[_0x8e79('0x11')](function(){return dbH['sequelize']['query'](util['format'](_0x8e79('0x12'),QUERY),{'type':dbH[_0x8e79('0x13')][_0x8e79('0x14')][_0x8e79('0x15')]});})['then'](function(_0x1613b7){if(!_0x1613b7[0x0][_0x8e79('0x16')]){return analyticExtractedReport(_0x8e79('0x17'));}var _0x389d50=[];var _0x76cda6=0x0;if(_0x14147f['split']){if(_0x1613b7&&_0x1613b7[_0x8e79('0x18')]){var _0x49b74e=_[_0x8e79('0x19')](_0x1613b7[0x0][_0x8e79('0x16')]/_0x58f8ae);var _0x41b6c8=Number[_0x8e79('0x1a')](_0x1613b7[0x0][_0x8e79('0x16')]/_0x58f8ae)?_0x1613b7[0x0]['num']%_0x58f8ae:0x0;_0x49b74e[_0x8e79('0x1b')](function(_0x9ebcdb){if(_0x9ebcdb>0x0){_0x76cda6+=_0x58f8ae;}_0x389d50[_0x8e79('0x1c')](dbH[_0x8e79('0x13')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x58f8ae,_0x76cda6),{'type':dbH[_0x8e79('0x13')][_0x8e79('0x14')][_0x8e79('0x15')]}));});if(_0x41b6c8>0x0){_0x76cda6+=_0x58f8ae;_0x389d50[_0x8e79('0x1c')](dbH['sequelize'][_0x8e79('0x1d')](util[_0x8e79('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x41b6c8,_0x76cda6),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x389d50[_0x8e79('0x1c')](dbH[_0x8e79('0x13')][_0x8e79('0x1d')](QUERY,{'type':dbH[_0x8e79('0x13')][_0x8e79('0x14')]['SELECT']}));}var _0x526d02=path[_0x8e79('0x1e')](PATH);var _0x456f8b=path['basename'](PATH,_0x8e79('0x1f'));var _0x58c014=_0x14147f[_0x8e79('0x20')]&&_0x389d50[_0x8e79('0x18')]>0x1;var _0x52c2e1=[];if(!fs['existsSync'](path[_0x8e79('0x21')](_0x526d02,_0x456f8b))&&_0x58c014){fs[_0x8e79('0x22')](path[_0x8e79('0x21')](_0x526d02,_0x456f8b));}return BPromise[_0x8e79('0x23')](_0x389d50,function(_0xb918cf){_0x52c2e1[_0x8e79('0x1c')](_0xb918cf);})['then'](function(){for(var _0x5ba35e=0x0;_0x5ba35e<_0x52c2e1[_0x8e79('0x18')];_0x5ba35e+=0x1){var _0x52faa;var _0x189462=_0x52c2e1[_0x5ba35e];if(_0x58c014){_0x52faa=path['join'](_0x526d02,_0x456f8b,util[_0x8e79('0xc')]('%s%d.%s',_0x456f8b,_0x5ba35e,_0x8e79('0x24')));}else{_0x52faa=path[_0x8e79('0x21')](_0x526d02,util[_0x8e79('0xc')](_0x8e79('0x25'),_0x456f8b,_0x8e79('0x24')));}fs['writeFileSync'](_0x52faa,json2xls(_0x189462),_0x8e79('0x26'));}})['then'](function(){if(_0x58c014){return new Promise(function(_0x49e0d1){zipdir(path[_0x8e79('0x21')](_0x526d02,_0x456f8b),{'saveTo':path[_0x8e79('0x21')](_0x526d02,util['format'](_0x8e79('0x25'),_0x456f8b,_0x8e79('0x27')))},function(_0x6290e1,_0x136a8b){rimraf(path[_0x8e79('0x21')](_0x526d02,_0x456f8b),function(){});_0x49e0d1(_0x8e79('0x28'));});});}})['then'](function(){logger[_0x8e79('0xb')](util[_0x8e79('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x8e79('0x29'),_0x58c014?util[_0x8e79('0xc')]('%s.%s',_0x456f8b,_0x58c014?_0x8e79('0x27'):_0x8e79('0x24')):null);});})[_0x8e79('0x2a')](function(_0x505e78){logger['info'](util[_0x8e79('0xc')](_0x8e79('0x2b'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x8e79('0x2c')](_0x505e78,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8e79('0x2d'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3ffd=['dbH','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','range','num','isInteger','forEach','push','sequelize','QueryTypes','dirname','basename','existsSync','join','mkdirSync','each','length','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','lodash','../../mysqldb'];(function(_0x204b2d,_0x4b4175){var _0x8da4bf=function(_0x491736){while(--_0x491736){_0x204b2d['push'](_0x204b2d['shift']());}};_0x8da4bf(++_0x4b4175);}(_0x3ffd,0x84));var _0xd3ff=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x3ffd[_0x130705];return _0x1fa991;};'use strict';var util=require(_0xd3ff('0x0'));var path=require('path');var _=require(_0xd3ff('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xd3ff('0x2'))[_0xd3ff('0x3')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd3ff('0x4')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd3ff('0x4')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4e3d71,_0x243062){var _0x56dad7={'status':_0x4e3d71};var _0x6370fc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x243062){_0x56dad7[_0xd3ff('0x5')]=_0x243062;}return db[_0xd3ff('0x6')][_0xd3ff('0x7')](_0x56dad7,_0x6370fc);}function main(){var _0x55b1a6=0x1388;var _0x13c298;logger[_0xd3ff('0x8')](util[_0xd3ff('0x9')](_0xd3ff('0xa'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xd3ff('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd3ff('0xc'),_0xd3ff('0xd')]})[_0xd3ff('0xe')](function(_0x56e8b4){if(_0x56e8b4){_0x13c298=_0x56e8b4;_0x55b1a6=_0x13c298[_0xd3ff('0xd')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xd3ff('0xf')](util[_0xd3ff('0x9')](_0xd3ff('0x10'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xd3ff('0x11')]});})[_0xd3ff('0xe')](function(_0x3a55f4){if(!_0x3a55f4[0x0]['num']){return analyticExtractedReport(_0xd3ff('0x12'));}var _0x31f439=[];var _0x4d3eee=0x0;if(_0x13c298['split']){if(_0x3a55f4&&_0x3a55f4['length']){var _0x588e17=_[_0xd3ff('0x13')](_0x3a55f4[0x0][_0xd3ff('0x14')]/_0x55b1a6);var _0x49b2e4=Number[_0xd3ff('0x15')](_0x3a55f4[0x0]['num']/_0x55b1a6)?_0x3a55f4[0x0]['num']%_0x55b1a6:0x0;_0x588e17[_0xd3ff('0x16')](function(_0x4e8f8e){if(_0x4e8f8e>0x0){_0x4d3eee+=_0x55b1a6;}_0x31f439[_0xd3ff('0x17')](dbH[_0xd3ff('0x18')]['query'](util[_0xd3ff('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x55b1a6,_0x4d3eee),{'type':dbH['sequelize']['QueryTypes'][_0xd3ff('0x11')]}));});if(_0x49b2e4>0x0){_0x4d3eee+=_0x55b1a6;_0x31f439[_0xd3ff('0x17')](dbH['sequelize']['query'](util[_0xd3ff('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x49b2e4,_0x4d3eee),{'type':dbH[_0xd3ff('0x18')][_0xd3ff('0x19')][_0xd3ff('0x11')]}));}}}else{_0x31f439[_0xd3ff('0x17')](dbH[_0xd3ff('0x18')][_0xd3ff('0xf')](QUERY,{'type':dbH[_0xd3ff('0x18')]['QueryTypes'][_0xd3ff('0x11')]}));}var _0x45e3a0=path[_0xd3ff('0x1a')](PATH);var _0xd6fdfb=path[_0xd3ff('0x1b')](PATH,'.xlsx');var _0x56fdb9=_0x13c298['split']&&_0x31f439['length']>0x1;var _0x117c6a=[];if(!fs[_0xd3ff('0x1c')](path[_0xd3ff('0x1d')](_0x45e3a0,_0xd6fdfb))&&_0x56fdb9){fs[_0xd3ff('0x1e')](path[_0xd3ff('0x1d')](_0x45e3a0,_0xd6fdfb));}return BPromise[_0xd3ff('0x1f')](_0x31f439,function(_0xd6ba1b){_0x117c6a[_0xd3ff('0x17')](_0xd6ba1b);})['then'](function(){for(var _0x24c5f8=0x0;_0x24c5f8<_0x117c6a[_0xd3ff('0x20')];_0x24c5f8+=0x1){var _0x3e2b70;var _0x1a4d92=_0x117c6a[_0x24c5f8];if(_0x56fdb9){_0x3e2b70=path[_0xd3ff('0x1d')](_0x45e3a0,_0xd6fdfb,util[_0xd3ff('0x9')](_0xd3ff('0x21'),_0xd6fdfb,_0x24c5f8,'xlsx'));}else{_0x3e2b70=path[_0xd3ff('0x1d')](_0x45e3a0,util[_0xd3ff('0x9')](_0xd3ff('0x22'),_0xd6fdfb,_0xd3ff('0x23')));}fs[_0xd3ff('0x24')](_0x3e2b70,json2xls(_0x1a4d92),_0xd3ff('0x25'));}})[_0xd3ff('0xe')](function(){if(_0x56fdb9){return new Promise(function(_0x402242){zipdir(path[_0xd3ff('0x1d')](_0x45e3a0,_0xd6fdfb),{'saveTo':path['join'](_0x45e3a0,util[_0xd3ff('0x9')](_0xd3ff('0x22'),_0xd6fdfb,_0xd3ff('0x26')))},function(_0x3475ab,_0x1beec3){rimraf(path[_0xd3ff('0x1d')](_0x45e3a0,_0xd6fdfb),function(){});_0x402242('zip\x20finished');});});}})[_0xd3ff('0xe')](function(){logger[_0xd3ff('0x8')](util[_0xd3ff('0x9')](_0xd3ff('0x27'),EXTRACTED_REPORT_ID,_0xd3ff('0x28')));return analyticExtractedReport('Completed',_0x56fdb9?util[_0xd3ff('0x9')]('%s.%s',_0xd6fdfb,_0x56fdb9?_0xd3ff('0x26'):_0xd3ff('0x23')):null);});})['catch'](function(_0x214e29){logger[_0xd3ff('0x8')](util[_0xd3ff('0x9')](_0xd3ff('0x29'),EXTRACTED_REPORT_ID,_0xd3ff('0x28')),util[_0xd3ff('0x2a')](_0x214e29,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd3ff('0x2b')](function(){process[_0xd3ff('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 49ed14b..95ef0a3 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 _0x95af=['filter','queue','playback','hasOwnProperty','extensions','extension','find','push','type','CDR(type)=%s','VoiceExtensionId','Set','CDR(routeid)=','context','priority','outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','sortBy','error','rewrite','util','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x95af,0x1d1));var _0xf95a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x95af[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xf95a('0x0'));function rewrite(_0x24ee36,_0x1c6269){var _0x32770d=this;return _0x24ee36[_0xf95a('0x1')]['Interval'][_0xf95a('0x2')]({'raw':!![]})[_0xf95a('0x3')](function(_0x307fa0){_0x32770d[_0xf95a('0x4')]=_0x307fa0;return _0x24ee36[_0xf95a('0x1')][_0xf95a('0x5')][_0xf95a('0x2')]({'where':{'IntervalId':_0x1c6269[_0xf95a('0x6')]},'raw':!![]});})[_0xf95a('0x3')](function(_0x597bf0){return _0x24ee36[_0xf95a('0x1')][_0xf95a('0x5')]['findAll']({'where':{'exten':{'$in':_[_0xf95a('0x7')](_[_0xf95a('0x8')](_0x597bf0,_0xf95a('0x9')))}},'order':[{'raw':_0xf95a('0xa')}],'raw':!![]});})['then'](function(_0x32ed34){var _0x96a7fe=_[_0xf95a('0xb')](_0x32ed34,{'priority':'1'});var _0x232b70=_['filter'](_0x32ed34,{'isApp':0x1});var _0x4c5a2f=_['groupBy'](_0x232b70,_0xf95a('0x9'));var _0x586635=[_0xf95a('0xc'),_0xf95a('0xd')];var _0xe1659f=[];var _0x12040b=[];for(var _0x36dfb0 in _0x4c5a2f){if(_0x4c5a2f[_0xf95a('0xe')](_0x36dfb0)){_0x32770d['priority']=0x2;_0x32770d[_0xf95a('0xf')]=[];_0x32770d[_0xf95a('0x10')]=_[_0xf95a('0x11')](_0x96a7fe,{'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')]});_0x32770d['extensions'][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':'Set','appdata':util['format'](_0xf95a('0x14'),_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')]),'context':_0x4c5a2f[_0x36dfb0][0x0]['context'],'exten':_0x4c5a2f[_0x36dfb0][0x0]['exten'],'priority':_0x32770d['priority']++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});if(_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')]==='inbound'){_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x17')+_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')],'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0]['VoiceExtensionId']});}else if(_0x4c5a2f[_0x36dfb0][0x0]['type']===_0xf95a('0x1a')){if(_0x32770d[_0xf95a('0x10')]){_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':'Set','appdata':_0xf95a('0x1b')+(_0x32770d['extension'][_0xf95a('0x1c')]?'${EXTEN:'+_0x32770d[_0xf95a('0x10')][_0xf95a('0x1c')]+'}':_0xf95a('0x1d')),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d['priority']++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});}_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':'Set','appdata':_0xf95a('0x17')+_0x4c5a2f[_0x36dfb0][0x0]['VoiceExtensionId'],'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});var _0x4766bf=_0x32770d[_0xf95a('0x19')]++;_0x32770d['extensions']['push']({'type':_0x4c5a2f[_0x36dfb0][0x0]['type'],'app':_0xf95a('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4766bf+0x2)+_0xf95a('0x1f')+(_0x4766bf+0x1)+')','context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x4766bf,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0]['VoiceExtensionId']});if(_0x32770d[_0xf95a('0x10')]){_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':'Set','appdata':_0x32770d['extension'][_0xf95a('0x1c')]?_0xf95a('0x20')+_0x32770d['extension'][_0xf95a('0x1c')]+'}':_0xf95a('0x21'),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});}_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':'Set','appdata':_0xf95a('0x22')+_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')],'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d['priority']++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});if(_0x32770d[_0xf95a('0x10')]&&_0x32770d[_0xf95a('0x10')]['hasOwnProperty'](_0xf95a('0x23'))&&_0x32770d[_0xf95a('0x10')][_0xf95a('0x23')]!==_0xf95a('0x24')){_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x25'),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});_0x32770d['extensions'][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0]['type'],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x26')+_0x32770d[_0xf95a('0x10')][_0xf95a('0x23')]||'wav','context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0]['exten'],'priority':_0x32770d['priority']++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});}}_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x27'),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});_0x32770d['extensions'][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x28'),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});_0x32770d[_0xf95a('0xf')]['push']({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x29'),'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'priority':_0x32770d[_0xf95a('0x19')]++,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});for(var _0x325bb6=0x0,_0xc7b276=0x0;_0x325bb6<_0x4c5a2f[_0x36dfb0][_0xf95a('0x2a')];_0x325bb6+=0x1,_0xc7b276=0x0){var _0x2a6304=_0x4c5a2f[_0x36dfb0][_0x325bb6];if(_0x2a6304['type']){_0x2a6304[_0xf95a('0x13')]=_0x2a6304[_0xf95a('0x13')]['toLowerCase']();}var _0x2bdeb7=[];var _0x11dd4b=[];delete _0x2a6304['id'];delete _0x2a6304['createdAt'];delete _0x2a6304['updatedAt'];var _0x418b7f=_0x2a6304[_0xf95a('0x2b')]!==_0xf95a('0x2c')?[_0x2a6304['interval']]:_0x2a6304['IntervalId']?_['map'](_[_0xf95a('0xb')](_0x32770d['intervals'],{'IntervalId':_0x2a6304[_0xf95a('0x6')]}),_0xf95a('0x2b')):[];if(_0x2a6304[_0xf95a('0xe')](_0xf95a('0x2d'))){if(_0x2a6304['tag']&&_0x2a6304[_0xf95a('0x2d')]!=='--'){_0x2bdeb7[_0xf95a('0x12')]({'type':_0x2a6304['type'],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x2e')+_0x2a6304[_0xf95a('0x2d')],'context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d[_0xf95a('0x19')]+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});}}if(_0x2a6304['type']==='outbound'&&_0x2a6304[_0xf95a('0xe')](_0xf95a('0x2f'))){if(_0x2a6304['callerID']){_0x2bdeb7[_0xf95a('0x12')]({'type':_0x2a6304[_0xf95a('0x13')],'app':_0xf95a('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x2a6304[_0xf95a('0x2f')]+')','context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d['priority']+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});}else{_0x2bdeb7[_0xf95a('0x12')]({'type':_0x2a6304[_0xf95a('0x13')],'app':'ExecIf','appdata':_0xf95a('0x30'),'context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d['priority']+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});}}if(_0x2a6304['hasOwnProperty']('answer')){if(_0x586635[_0xf95a('0x31')](_0x2a6304[_0xf95a('0x32')]['toLowerCase']())>=0x0&&_0x2a6304[_0xf95a('0x33')]!==_0xf95a('0x34')){if(_0x2a6304[_0xf95a('0x35')]){_0x2bdeb7[_0xf95a('0x12')]({'type':_0x2a6304[_0xf95a('0x13')],'app':_0xf95a('0x1e'),'appdata':_0xf95a('0x36'),'context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d[_0xf95a('0x19')]+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});_0x2bdeb7['push']({'type':_0x2a6304[_0xf95a('0x13')],'app':'Set','appdata':_0xf95a('0x37'),'context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d[_0xf95a('0x19')]+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});}else{_0x2bdeb7['push']({'type':_0x2a6304['type'],'app':_0xf95a('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2a6304[_0xf95a('0x18')],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d[_0xf95a('0x19')]+_0xc7b276++,'VoiceExtensionId':_0x2a6304[_0xf95a('0x15')]});_0x2bdeb7['push']({'type':_0x2a6304[_0xf95a('0x13')],'app':_0xf95a('0x16'),'appdata':_0xf95a('0x38'),'context':_0x2a6304['context'],'exten':_0x2a6304[_0xf95a('0x9')],'priority':_0x418b7f[_0xf95a('0x2a')]+_0x32770d[_0xf95a('0x19')]+_0xc7b276++,'VoiceExtensionId':_0x2a6304['VoiceExtensionId']});}}}for(var _0x596e3e=0x0;_0x596e3e<_0x418b7f[_0xf95a('0x2a')];_0x596e3e+=0x1){var _0x31ac1f=_0x32770d['priority']+_0x418b7f[_0xf95a('0x2a')];var _0x2a92b1=_0x596e3e===_0x418b7f[_0xf95a('0x2a')]-0x1?_0x32770d[_0xf95a('0x19')]+_0x2bdeb7[_0xf95a('0x2a')]+_0x11dd4b[_0xf95a('0x2a')]+0x2:_0x32770d['priority']+_0x596e3e+0x1;_0x2bdeb7[_0xf95a('0x39')](_0x596e3e,0x0,{'type':_0x2a6304[_0xf95a('0x13')],'app':_0xf95a('0x3a'),'appdata':_0x418b7f[_0x596e3e]+'?'+_0x2a6304[_0xf95a('0x18')]+_0xf95a('0x3b')+_0x31ac1f+':'+_0x2a6304[_0xf95a('0x18')]+',${EXTEN},'+_0x2a92b1,'exten':_0x2a6304['exten'],'context':_0x2a6304['context'],'priority':_0x32770d[_0xf95a('0x19')]+_0x596e3e,'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0]['VoiceExtensionId']});}_0x2a6304[_0xf95a('0x19')]=_0x2bdeb7['length']?_['last'](_0x2bdeb7)[_0xf95a('0x19')]+0x1:_0x32770d[_0xf95a('0x19')];_0x32770d['priority']=(_0x11dd4b[_0xf95a('0x2a')]?_[_0xf95a('0x3c')](_0x11dd4b)[_0xf95a('0x19')]:_0x2a6304[_0xf95a('0x19')])+0x1;_0x32770d[_0xf95a('0xf')]=_['concat'](_0x32770d[_0xf95a('0xf')],_0x2bdeb7,[_0x2a6304],_0x11dd4b);}_0x32770d[_0xf95a('0xf')][_0xf95a('0x12')]({'type':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x13')],'app':_0xf95a('0x3d'),'exten':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x9')],'context':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x18')],'priority':_0x32770d[_0xf95a('0x19')],'VoiceExtensionId':_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]});_0xe1659f[_0xf95a('0x12')](_0x4c5a2f[_0x36dfb0][0x0][_0xf95a('0x15')]);_0x12040b=_[_0xf95a('0x3e')](_0x12040b,_0x32770d['extensions']);}}return _0x24ee36[_0xf95a('0x3f')](function(_0x51f737){return _0x24ee36[_0xf95a('0x1')][_0xf95a('0x5')][_0xf95a('0x40')]({'where':{'VoiceExtensionId':{'$in':_0xe1659f}},'transaction':_0x51f737})[_0xf95a('0x3')](function(_0xc964c9){return _0x24ee36[_0xf95a('0x1')]['VoiceExtension']['bulkCreate'](_[_0xf95a('0x41')](_0x12040b,_0xf95a('0x19')),{'transaction':_0x51f737});});});})['catch'](function(_0x88884b){console[_0xf95a('0x42')](_0x88884b);});}exports[_0xf95a('0x43')]=rewrite; \ No newline at end of file +var _0x89d6=['filter','groupBy','queue','playback','extensions','extension','push','type','format','context','priority','VoiceExtensionId','inbound','Set','outbound','CDR(destination)=','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','interval','*,*,*,*','hasOwnProperty','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}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','transaction','destroy','bulkCreate','sortBy','catch','error','lodash','util','models','Interval','then','VoiceExtension','findAll','IntervalId','uniq','map','exten'];(function(_0x146e9d,_0x2bcc8d){var _0x2f0870=function(_0x4c2fb6){while(--_0x4c2fb6){_0x146e9d['push'](_0x146e9d['shift']());}};_0x2f0870(++_0x2bcc8d);}(_0x89d6,0x1d8));var _0x689d=function(_0x229669,_0x809f6d){_0x229669=_0x229669-0x0;var _0x1366d2=_0x89d6[_0x229669];return _0x1366d2;};'use strict';var _=require(_0x689d('0x0'));var util=require(_0x689d('0x1'));function rewrite(_0x59f82e,_0x387703){var _0x839bee=this;return _0x59f82e[_0x689d('0x2')][_0x689d('0x3')]['findAll']({'raw':!![]})[_0x689d('0x4')](function(_0x158dce){_0x839bee['intervals']=_0x158dce;return _0x59f82e['models'][_0x689d('0x5')][_0x689d('0x6')]({'where':{'IntervalId':_0x387703[_0x689d('0x7')]},'raw':!![]});})[_0x689d('0x4')](function(_0xd593c6){return _0x59f82e[_0x689d('0x2')][_0x689d('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x689d('0x8')](_[_0x689d('0x9')](_0xd593c6,_0x689d('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x689d('0x4')](function(_0x5674b9){var _0x3ae9c6=_['filter'](_0x5674b9,{'priority':'1'});var _0x1e2ff1=_[_0x689d('0xb')](_0x5674b9,{'isApp':0x1});var _0x5bf392=_[_0x689d('0xc')](_0x1e2ff1,_0x689d('0xa'));var _0x38645e=[_0x689d('0xd'),_0x689d('0xe')];var _0x3984bd=[];var _0x5789d5=[];for(var _0x34903e in _0x5bf392){if(_0x5bf392['hasOwnProperty'](_0x34903e)){_0x839bee['priority']=0x2;_0x839bee[_0x689d('0xf')]=[];_0x839bee[_0x689d('0x10')]=_['find'](_0x3ae9c6,{'exten':_0x5bf392[_0x34903e][0x0]['exten']});_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':'Set','appdata':util[_0x689d('0x13')]('CDR(type)=%s',_0x5bf392[_0x34903e][0x0]['type']),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});if(_0x5bf392[_0x34903e][0x0][_0x689d('0x12')]===_0x689d('0x17')){_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':'CDR(routeid)='+_0x5bf392[_0x34903e][0x0][_0x689d('0x16')],'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee['priority']++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});}else if(_0x5bf392[_0x34903e][0x0][_0x689d('0x12')]===_0x689d('0x19')){if(_0x839bee[_0x689d('0x10')]){_0x839bee['extensions'][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':_0x689d('0x1a')+(_0x839bee[_0x689d('0x10')][_0x689d('0x1b')]?'${EXTEN:'+_0x839bee['extension'][_0x689d('0x1b')]+'}':'${EXTEN}'),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});}_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0]['type'],'app':_0x689d('0x18'),'appdata':_0x689d('0x1c')+_0x5bf392[_0x34903e][0x0][_0x689d('0x16')],'context':_0x5bf392[_0x34903e][0x0]['context'],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee['priority']++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});var _0x5ed847=_0x839bee['priority']++;_0x839bee['extensions'][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x1d'),'appdata':_0x689d('0x1e')+(_0x5ed847+0x2)+_0x689d('0x1f')+(_0x5ed847+0x1)+')','context':_0x5bf392[_0x34903e][0x0]['context'],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x5ed847,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});if(_0x839bee[_0x689d('0x10')]){_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':_0x839bee[_0x689d('0x10')][_0x689d('0x1b')]?_0x689d('0x20')+_0x839bee['extension']['cutdigits']+'}':_0x689d('0x21'),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});}_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0]['type'],'app':_0x689d('0x18'),'appdata':_0x689d('0x22')+_0x5bf392[_0x34903e][0x0][_0x689d('0x16')],'context':_0x5bf392[_0x34903e][0x0]['context'],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});if(_0x839bee[_0x689d('0x10')]&&_0x839bee[_0x689d('0x10')]['hasOwnProperty'](_0x689d('0x23'))&&_0x839bee['extension'][_0x689d('0x23')]!==_0x689d('0x24')){_0x839bee[_0x689d('0xf')]['push']({'type':_0x5bf392[_0x34903e][0x0]['type'],'app':_0x689d('0x18'),'appdata':_0x689d('0x25'),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0]['exten'],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x839bee[_0x689d('0x10')][_0x689d('0x23')]||_0x689d('0x26'),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0]['exten'],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});}}_0x839bee[_0x689d('0xf')]['push']({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':_0x689d('0x27'),'context':_0x5bf392[_0x34903e][0x0]['context'],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});_0x839bee[_0x689d('0xf')]['push']({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':'Set','appdata':_0x689d('0x28'),'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee['priority']++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0]['VoiceExtensionId']});_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':'Set','appdata':_0x689d('0x29'),'context':_0x5bf392[_0x34903e][0x0]['context'],'exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'priority':_0x839bee[_0x689d('0x15')]++,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});for(var _0x2d913e=0x0,_0x179aeb=0x0;_0x2d913e<_0x5bf392[_0x34903e][_0x689d('0x2a')];_0x2d913e+=0x1,_0x179aeb=0x0){var _0x310fe3=_0x5bf392[_0x34903e][_0x2d913e];if(_0x310fe3['type']){_0x310fe3[_0x689d('0x12')]=_0x310fe3[_0x689d('0x12')][_0x689d('0x2b')]();}var _0x15e9e1=[];var _0x59b852=[];delete _0x310fe3['id'];delete _0x310fe3['createdAt'];delete _0x310fe3['updatedAt'];var _0x4bb3f2=_0x310fe3[_0x689d('0x2c')]!==_0x689d('0x2d')?[_0x310fe3['interval']]:_0x310fe3[_0x689d('0x7')]?_[_0x689d('0x9')](_[_0x689d('0xb')](_0x839bee['intervals'],{'IntervalId':_0x310fe3[_0x689d('0x7')]}),_0x689d('0x2c')):[];if(_0x310fe3[_0x689d('0x2e')](_0x689d('0x2f'))){if(_0x310fe3[_0x689d('0x2f')]&&_0x310fe3['tag']!=='--'){_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3['type'],'app':_0x689d('0x18'),'appdata':'CDR(tag)='+_0x310fe3[_0x689d('0x2f')],'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee[_0x689d('0x15')]+_0x179aeb++,'VoiceExtensionId':_0x310fe3['VoiceExtensionId']});}}if(_0x310fe3[_0x689d('0x12')]===_0x689d('0x19')&&_0x310fe3[_0x689d('0x2e')](_0x689d('0x30'))){if(_0x310fe3[_0x689d('0x30')]){_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3[_0x689d('0x12')],'app':_0x689d('0x1d'),'appdata':_0x689d('0x31')+_0x310fe3[_0x689d('0x30')]+')','context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee[_0x689d('0x15')]+_0x179aeb++,'VoiceExtensionId':_0x310fe3['VoiceExtensionId']});}else{_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3[_0x689d('0x12')],'app':_0x689d('0x1d'),'appdata':_0x689d('0x32'),'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee[_0x689d('0x15')]+_0x179aeb++,'VoiceExtensionId':_0x310fe3[_0x689d('0x16')]});}}if(_0x310fe3[_0x689d('0x2e')](_0x689d('0x33'))){if(_0x38645e[_0x689d('0x34')](_0x310fe3[_0x689d('0x35')][_0x689d('0x2b')]())>=0x0&&_0x310fe3[_0x689d('0x36')]!==_0x689d('0x37')){if(_0x310fe3['answer']){_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3[_0x689d('0x12')],'app':'ExecIf','appdata':_0x689d('0x38'),'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2['length']+_0x839bee[_0x689d('0x15')]+_0x179aeb++,'VoiceExtensionId':_0x310fe3[_0x689d('0x16')]});_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3['type'],'app':'Set','appdata':_0x689d('0x39'),'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee['priority']+_0x179aeb++,'VoiceExtensionId':_0x310fe3[_0x689d('0x16')]});}else{_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3['type'],'app':_0x689d('0x1d'),'appdata':_0x689d('0x3a'),'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee['priority']+_0x179aeb++,'VoiceExtensionId':_0x310fe3[_0x689d('0x16')]});_0x15e9e1[_0x689d('0x11')]({'type':_0x310fe3[_0x689d('0x12')],'app':_0x689d('0x18'),'appdata':_0x689d('0x3b'),'context':_0x310fe3[_0x689d('0x14')],'exten':_0x310fe3[_0x689d('0xa')],'priority':_0x4bb3f2[_0x689d('0x2a')]+_0x839bee['priority']+_0x179aeb++,'VoiceExtensionId':_0x310fe3[_0x689d('0x16')]});}}}for(var _0x630a20=0x0;_0x630a20<_0x4bb3f2[_0x689d('0x2a')];_0x630a20+=0x1){var _0x4768e5=_0x839bee[_0x689d('0x15')]+_0x4bb3f2[_0x689d('0x2a')];var _0x4c44a3=_0x630a20===_0x4bb3f2[_0x689d('0x2a')]-0x1?_0x839bee[_0x689d('0x15')]+_0x15e9e1['length']+_0x59b852[_0x689d('0x2a')]+0x2:_0x839bee['priority']+_0x630a20+0x1;_0x15e9e1[_0x689d('0x3c')](_0x630a20,0x0,{'type':_0x310fe3[_0x689d('0x12')],'app':'GotoIfTime','appdata':_0x4bb3f2[_0x630a20]+'?'+_0x310fe3[_0x689d('0x14')]+_0x689d('0x3d')+_0x4768e5+':'+_0x310fe3[_0x689d('0x14')]+_0x689d('0x3d')+_0x4c44a3,'exten':_0x310fe3[_0x689d('0xa')],'context':_0x310fe3['context'],'priority':_0x839bee['priority']+_0x630a20,'VoiceExtensionId':_0x5bf392[_0x34903e][0x0]['VoiceExtensionId']});}_0x310fe3[_0x689d('0x15')]=_0x15e9e1[_0x689d('0x2a')]?_['last'](_0x15e9e1)['priority']+0x1:_0x839bee['priority'];_0x839bee[_0x689d('0x15')]=(_0x59b852[_0x689d('0x2a')]?_[_0x689d('0x3e')](_0x59b852)[_0x689d('0x15')]:_0x310fe3['priority'])+0x1;_0x839bee[_0x689d('0xf')]=_['concat'](_0x839bee['extensions'],_0x15e9e1,[_0x310fe3],_0x59b852);}_0x839bee[_0x689d('0xf')][_0x689d('0x11')]({'type':_0x5bf392[_0x34903e][0x0][_0x689d('0x12')],'app':'Hangup','exten':_0x5bf392[_0x34903e][0x0][_0x689d('0xa')],'context':_0x5bf392[_0x34903e][0x0][_0x689d('0x14')],'priority':_0x839bee['priority'],'VoiceExtensionId':_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]});_0x3984bd[_0x689d('0x11')](_0x5bf392[_0x34903e][0x0][_0x689d('0x16')]);_0x5789d5=_['concat'](_0x5789d5,_0x839bee[_0x689d('0xf')]);}}return _0x59f82e[_0x689d('0x3f')](function(_0x3d6182){return _0x59f82e[_0x689d('0x2')][_0x689d('0x5')][_0x689d('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x3984bd}},'transaction':_0x3d6182})[_0x689d('0x4')](function(_0x23765a){return _0x59f82e['models']['VoiceExtension'][_0x689d('0x41')](_[_0x689d('0x42')](_0x5789d5,'priority'),{'transaction':_0x3d6182});});});})[_0x689d('0x43')](function(_0x6bdf1a){console[_0x689d('0x44')](_0x6bdf1a);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 8ca7e29..1c4ef61 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 _0x5463=['inspect','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','\x20=\x20?','insert','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final','VoiceQueue','findAll','outbound','CmList','Lists','then','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','push','all','BlackLists','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','test','isNil','errors','length','message','join','error','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','pick','catch','stringify','cmContact','checkHopper'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x5463,0x17f));var _0x3546=function(_0x3ffbec,_0x27df31){_0x3ffbec=_0x3ffbec-0x0;var _0x503dd3=_0x5463[_0x3ffbec];return _0x503dd3;};'use strict';var BPromise=require(_0x3546('0x0'));var util=require(_0x3546('0x1'));var _=require(_0x3546('0x2'));var fs=require('fs');var squel=require(_0x3546('0x3'));var Papa=require(_0x3546('0x4'));var Redis=require(_0x3546('0x5'));var db=require(_0x3546('0x6'))['db'];var config=require(_0x3546('0x7'));var logger=require(_0x3546('0x8'))('api');config['redis']=_[_0x3546('0x9')](config[_0x3546('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3546('0xb'))(new Redis(config[_0x3546('0xa')]));require(_0x3546('0xc'))['register'](socket);try{if(!process[_0x3546('0xd')][0x2]||process[_0x3546('0xd')][0x2]==='undefined'||process['argv'][0x2]===_0x3546('0xe')){throw new Error(_0x3546('0xf'));}var FILEPATH=process[_0x3546('0xd')][0x2];if(!process[_0x3546('0xd')][0x3]||process['argv'][0x3]===_0x3546('0x10')||process[_0x3546('0xd')][0x3]===_0x3546('0xe')||!process['argv'][0x4]||process['argv'][0x4]===_0x3546('0x10')||process['argv'][0x4]===_0x3546('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x3546('0x11')](process['argv'][0x3][_0x3546('0x12')](','),process['argv'][0x4]['split'](','));if(!process[_0x3546('0xd')][0x5]||process[_0x3546('0xd')][0x5]===_0x3546('0x10')||process[_0x3546('0xd')][0x5]===_0x3546('0xe')){throw new Error(_0x3546('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x3546('0xd')][0x6]&&process[_0x3546('0xd')][0x6]!==_0x3546('0x10')&&process['argv'][0x6]!=='null'?process[_0x3546('0xd')][0x6]:null;var DUPLICATES=process[_0x3546('0xd')][0x7]&&process[_0x3546('0xd')][0x7]!=='undefined'&&process[_0x3546('0xd')][0x7]!==_0x3546('0xe')?process[_0x3546('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0x3546('0xd')][0x8]==='undefined'||process[_0x3546('0xd')][0x8]==='null'){throw new Error(_0x3546('0x14'));}var SOCKET_TIMESTAMP=process[_0x3546('0xd')][0x8];}catch(_0x4524c0){logger['error'](_0x4524c0);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(_0x5ee2a9,_0x27112d,_0x24ed8d,_0xc2750c){var _0x47700d={'message':_0x27112d};_0x47700d[_0x5ee2a9]=!![];if(_0x24ed8d){_0x47700d[_0x3546('0x15')]=_0x24ed8d;}if(_0xc2750c){_0x47700d['index']=_0xc2750c;}return _0x47700d;}function isEmail(_0x42a1fa){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))*$/[_0x3546('0x16')](_0x42a1fa);}function checkRow(_0x370fae,_0x14daa2,_0x25cb25){return new BPromise(function(_0x27e096,_0x5d31ae){if(_[_0x3546('0x17')](_0x370fae)){return _0x5d31ae(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x25cb25));}if(_0x370fae[_0x3546('0x18')]&&_0x370fae['errors'][_0x3546('0x19')]){var _0x47c681=_['map'](_0x370fae[_0x3546('0x18')],_0x3546('0x1a'))[_0x3546('0x1b')](';');return _0x5d31ae(handleCheckRowError(_0x3546('0x1c'),_0x47c681,null,_0x25cb25));}var _0x2c0660={};for(var _0x40b7f3 in FIELDS){if(FIELDS['hasOwnProperty'](_0x40b7f3)&&FIELDS[_0x40b7f3]){_0x2c0660[_0x40b7f3]=_0x370fae[_0x3546('0x1d')][0x0][FIELDS[_0x40b7f3]]||_0x370fae[_0x3546('0x1d')][0x0]['\ufeff'+FIELDS[_0x40b7f3]];}}if(!_0x2c0660['firstName']){return _0x5d31ae(handleCheckRowError('error',_0x3546('0x1e'),null,_0x25cb25));}if(!_0x2c0660[_0x3546('0x1f')]){return _0x5d31ae(handleCheckRowError(_0x3546('0x1c'),_0x3546('0x20'),null,_0x25cb25));}if(_0x2c0660['birthDate']){var _0x1aa038=moment(_0x2c0660[_0x3546('0x21')],_0x3546('0x22'));if(!_0x1aa038[_0x3546('0x23')]()){return _0x5d31ae(handleCheckRowError(_0x3546('0x1c'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x25cb25));}}if(_0x2c0660[_0x3546('0x24')]){if(!isEmail(_0x2c0660['email'])){return _0x5d31ae(handleCheckRowError(_0x3546('0x1c'),'email\x20format\x20is\x20not\x20valid!',null,_0x25cb25));}}_0x2c0660[_0x3546('0x25')]=LISTID;_0x2c0660[_0x3546('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3546('0x19')]&&_0x14daa2){var _0x4fd386={};for(var _0x220eb7=0x0,_0x23b980=DUPLICATES[_0x3546('0x19')];_0x220eb7<_0x23b980;_0x220eb7+=0x1){_0x4fd386[DUPLICATES[_0x220eb7]]=_0x2c0660[DUPLICATES[_0x220eb7]];}var _0x594b3a=_[_0x3546('0x27')](_0x14daa2,_0x4fd386);if(_0x594b3a){return _0x5d31ae(handleCheckRowError(_0x3546('0x28'),_0x3546('0x29'),_0x594b3a,_0x25cb25));}}return db[_0x3546('0x2a')]['create'](_0x2c0660,{'raw':!![],'hooks':![],'fields':_[_0x3546('0x2b')](_0x2c0660)})['then'](function(_0x5a0b9f){if(DUPLICATES&&DUPLICATES[_0x3546('0x19')]&&_0x14daa2){_0x14daa2['push'](_[_0x3546('0x2c')](_0x2c0660,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5a0b9f['id'];return _0x27e096();})[_0x3546('0x2d')](function(_0x1c04cc){return _0x5d31ae(handleCheckRowError(_0x3546('0x1c'),'Error\x20while\x20creating\x20contact:\x20'+(_0x1c04cc[_0x3546('0x1a')]||JSON[_0x3546('0x2e')](_0x1c04cc)),null,_0x25cb25));});});}function checkHopper(){function _0x169bf3(){return function(_0x46f632){logger[_0x3546('0x1c')](_0x3546('0x2f'),_0x3546('0x30'),util[_0x3546('0x31')](_0x46f632,{'showHidden':![],'depth':null}));};}var _0x3341dc=function(_0x38ffb0,_0x1340a9){var _0x1f8545=squel['insert']()[_0x3546('0x32')](_0x3546('0x33'))['fromQuery'](['phone',_0x3546('0x34'),_0x3546('0x35'),_0x3546('0x25'),_0x1340a9,_0x3546('0x36'),_0x3546('0x37')],squel['select']()[_0x3546('0x38')](_0x3546('0x1f'),_0x3546('0x1f'))[_0x3546('0x38')](_0x3546('0x39'),_0x3546('0x34'))['field']('id','ContactId')[_0x3546('0x38')](LISTID[_0x3546('0x3a')](),_0x3546('0x25'))[_0x3546('0x38')](_0x38ffb0['id'][_0x3546('0x3a')](),_0x1340a9)['field'](_0x3546('0x39'),'createdAt')['field'](_0x3546('0x39'),'updatedAt')[_0x3546('0x3b')](_0x3546('0x3c'))[_0x3546('0x3d')](_0x3546('0x3e'))['where'](_0x3546('0x3f'),LISTID[_0x3546('0x3a')]())[_0x3546('0x3d')](_0x3546('0x40'))['where'](_0x3546('0x41'),squel[_0x3546('0x42')]()[_0x3546('0x38')](_0x3546('0x1f'))[_0x3546('0x3b')](_0x3546('0x33'))[_0x3546('0x3d')](_0x1340a9+_0x3546('0x43'),_0x38ffb0['id'][_0x3546('0x3a')]())))[_0x3546('0x3a')]();return _0x1f8545;};var _0x1a8a0c=function(_0x3814e1,_0x26e21a){var _0x1a4e87=squel[_0x3546('0x44')]()[_0x3546('0x32')](_0x3546('0x33'))[_0x3546('0x45')]([_0x3546('0x1f'),_0x3546('0x34'),_0x3546('0x35'),_0x3546('0x25'),_0x26e21a,_0x3546('0x36'),_0x3546('0x37')],squel[_0x3546('0x42')]()[_0x3546('0x38')](_0x3546('0x1f'),_0x3546('0x1f'))[_0x3546('0x38')](_0x3546('0x39'),'scheduledAt')[_0x3546('0x38')]('id','ContactId')[_0x3546('0x38')](LISTID['toString'](),_0x3546('0x25'))[_0x3546('0x38')](_0x3814e1['id'][_0x3546('0x3a')](),_0x26e21a)[_0x3546('0x38')](_0x3546('0x39'),'createdAt')['field']('NOW()',_0x3546('0x37'))[_0x3546('0x3b')](_0x3546('0x3c'))[_0x3546('0x3d')]('deletedAt\x20IS\x20NULL')[_0x3546('0x3d')](_0x3546('0x3f'),LISTID[_0x3546('0x3a')]())[_0x3546('0x3d')](_0x3546('0x46'),squel[_0x3546('0x47')](hopperContacts))['where'](_0x3546('0x40'))[_0x3546('0x3d')](_0x3546('0x41'),squel['select']()[_0x3546('0x38')](_0x3546('0x48'))[_0x3546('0x3b')](_0x3546('0x49'))[_0x3546('0x3d')](_0x26e21a+_0x3546('0x43'),_0x3814e1['id'][_0x3546('0x3a')]()))[_0x3546('0x3d')](_0x3546('0x41'),squel['select']()[_0x3546('0x38')](_0x3546('0x1f'))['from'](_0x3546('0x33'))[_0x3546('0x3d')](_0x26e21a+_0x3546('0x43'),_0x3814e1['id'][_0x3546('0x3a')]())))[_0x3546('0x3a')]();return _0x1a4e87;};function _0x11147a(_0x4dda3f,_0x927442){var _0x555504=squel[_0x3546('0x44')]()[_0x3546('0x32')](_0x3546('0x33'))['fromQuery']([_0x3546('0x1f'),'scheduledAt',_0x3546('0x35'),'ListId',_0x927442,'createdAt','updatedAt'],squel['select']()[_0x3546('0x38')](_0x3546('0x1f'),_0x3546('0x1f'))[_0x3546('0x38')]('NOW()',_0x3546('0x34'))[_0x3546('0x38')]('id','ContactId')[_0x3546('0x38')](LISTID[_0x3546('0x3a')](),_0x3546('0x25'))[_0x3546('0x38')](_0x4dda3f['id'][_0x3546('0x3a')](),_0x927442)[_0x3546('0x38')](_0x3546('0x39'),_0x3546('0x36'))[_0x3546('0x38')](_0x3546('0x39'),_0x3546('0x37'))[_0x3546('0x3b')]('cm_contacts')[_0x3546('0x3d')](_0x3546('0x3e'))[_0x3546('0x3d')](_0x3546('0x3f'),LISTID[_0x3546('0x3a')]())[_0x3546('0x3d')](_0x3546('0x46'),squel[_0x3546('0x47')](hopperContacts))[_0x3546('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x3546('0x3a')]();return _0x555504;}function _0x5ad2e2(_0x200c3c,_0x2907a8){var _0x107a5b=squel[_0x3546('0x44')]()[_0x3546('0x32')]('cm_hopper_black')['fromQuery']([_0x3546('0x1f'),'ContactId',_0x3546('0x25'),_0x2907a8,_0x3546('0x36'),_0x3546('0x37')],squel['select']()[_0x3546('0x38')](_0x3546('0x1f'),_0x3546('0x1f'))['field']('id',_0x3546('0x35'))['field'](LISTID[_0x3546('0x3a')](),_0x3546('0x25'))[_0x3546('0x38')](_0x200c3c['id'][_0x3546('0x3a')](),_0x2907a8)[_0x3546('0x38')]('NOW()','createdAt')[_0x3546('0x38')](_0x3546('0x39'),'updatedAt')[_0x3546('0x3b')](_0x3546('0x3c'))[_0x3546('0x3d')](_0x3546('0x3e'))['where'](_0x3546('0x3f'),LISTID['toString']())[_0x3546('0x3d')](_0x3546('0x46'),squel[_0x3546('0x47')](hopperContacts))['where'](_0x3546('0x40')))[_0x3546('0x3a')]();return _0x107a5b;}return db[_0x3546('0x4a')][_0x3546('0x4b')]({'where':{'type':_0x3546('0x4c')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3546('0x4d')],'as':_0x3546('0x4e'),'where':{'id':LISTID}}]})[_0x3546('0x4f')](function(_0x2a3bed){var _0x295ba2=[];if(_0x2a3bed){var _0x5b62ba;for(var _0x679b07=0x0,_0x3a7ce9;_0x679b07<_0x2a3bed['length'];_0x679b07+=0x1){_0x3a7ce9=_0x2a3bed[_0x679b07][_0x3546('0x50')]({'plain':!![]});switch(_0x3a7ce9[_0x3546('0x51')]){case _0x3546('0x52'):_0x295ba2['push'](db[_0x3546('0x53')][_0x3546('0x54')](_0x1a8a0c(_0x3a7ce9,_0x3546('0x55')))[_0x3546('0x4f')](function(){})[_0x3546('0x2d')](_0x169bf3()));break;case'onlyIfOpen':_0x295ba2['push'](db[_0x3546('0x53')][_0x3546('0x54')](_0x3341dc(_0x3a7ce9,_0x3546('0x55')))[_0x3546('0x4f')](function(){})[_0x3546('0x2d')](_0x169bf3()));break;default:_0x295ba2[_0x3546('0x56')](db[_0x3546('0x53')][_0x3546('0x54')](_0x11147a(_0x3a7ce9,_0x3546('0x55')))['then'](function(){})[_0x3546('0x2d')](_0x169bf3()));}}}return _0x295ba2;})[_0x3546('0x57')]()[_0x3546('0x4f')](function(){return db[_0x3546('0x4a')]['findAll']({'where':{'type':_0x3546('0x4c')},'attributes':['id'],'include':[{'model':db[_0x3546('0x4d')],'as':_0x3546('0x58'),'where':{'id':LISTID}}]})[_0x3546('0x4f')](function(_0x23e470){var _0x4395fe=[];if(_0x23e470){var _0x553aab;for(var _0x10a08c=0x0,_0x552104;_0x10a08c<_0x23e470[_0x3546('0x19')];_0x10a08c+=0x1){_0x552104=_0x23e470[_0x10a08c]['get']({'plain':!![]});_0x4395fe['push'](db[_0x3546('0x53')][_0x3546('0x54')](_0x5ad2e2(_0x552104,_0x3546('0x55')))[_0x3546('0x4f')](function(){})[_0x3546('0x2d')](_0x169bf3()));}}return _0x4395fe;})[_0x3546('0x57')]();})['then'](function(){return db[_0x3546('0x59')][_0x3546('0x4b')]({'attributes':['id',_0x3546('0x51')],'include':[{'model':db[_0x3546('0x4d')],'as':_0x3546('0x4e'),'where':{'id':LISTID}}]})[_0x3546('0x4f')](function(_0x37375e){var _0x3765a3=[];if(_0x37375e){for(var _0x3cb71d=0x0,_0x3c1da4;_0x3cb71d<_0x37375e[_0x3546('0x19')];_0x3cb71d+=0x1){_0x3c1da4=_0x37375e[_0x3cb71d][_0x3546('0x50')]({'plain':!![]});switch(_0x3c1da4[_0x3546('0x51')]){case _0x3546('0x52'):_0x3765a3[_0x3546('0x56')](db[_0x3546('0x53')]['query'](_0x1a8a0c(_0x3c1da4,_0x3546('0x5a')))[_0x3546('0x4f')](function(){})[_0x3546('0x2d')](_0x169bf3()));break;case _0x3546('0x5b'):_0x3765a3[_0x3546('0x56')](db[_0x3546('0x53')][_0x3546('0x54')](_0x3341dc(_0x3c1da4,_0x3546('0x5a')))['then'](function(){})['catch'](_0x169bf3()));break;default:_0x3765a3[_0x3546('0x56')](db[_0x3546('0x53')][_0x3546('0x54')](_0x11147a(_0x3c1da4,_0x3546('0x5a')))[_0x3546('0x4f')](function(){})['catch'](_0x169bf3()));}}}return _0x3765a3;})[_0x3546('0x57')]();})[_0x3546('0x4f')](function(){return db['Campaign'][_0x3546('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x3546('0x4d')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3546('0x4f')](function(_0x1839ac){var _0x10e385=[];if(_0x1839ac){for(var _0x339275=0x0,_0x1548b7;_0x339275<_0x1839ac[_0x3546('0x19')];_0x339275+=0x1){_0x1548b7=_0x1839ac[_0x339275][_0x3546('0x50')]({'plain':!![]});_0x10e385[_0x3546('0x56')](db['sequelize']['query'](_0x5ad2e2(_0x1548b7,_0x3546('0x5a')))[_0x3546('0x4f')](function(){})[_0x3546('0x2d')](_0x169bf3()));}}return _0x10e385;})[_0x3546('0x57')]();})[_0x3546('0x2d')](function(_0xcb9fb0){logger[_0x3546('0x1c')](_0x3546('0x5c'),_0x3546('0x5d'),_0xcb9fb0[_0x3546('0x1a')]);});}var processPromises=function(_0x175b73){return BPromise[_0x3546('0x57')](promises)[_0x3546('0x4f')](function(_0x5547d3){})[_0x3546('0x2d')](function(_0x38eee1){logger['error'](_0x3546('0x5e'),JSON[_0x3546('0x2e')](_0x38eee1));})[_0x3546('0x5f')](function(){socket[_0x3546('0x60')](_0x3546('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x175b73){return _0x175b73[_0x3546('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3546('0x4f')](function(){if(hopperContacts){return checkHopper();}})[_0x3546('0x4f')](function(){socket[_0x3546('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3546('0x63')](FILEPATH);}catch(_0x3e9afc){logger['error'](_0x3546('0x64'),JSON[_0x3546('0x2e')](_0x3e9afc));}finally{process[_0x3546('0x65')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x3546('0x66'));endCsv();});function main(){return BPromise['resolve']()[_0x3546('0x4f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x3546('0x12')](',');return db[_0x3546('0x2a')][_0x3546('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3546('0x4f')](function(_0xc4756f){var _0x30fb03=fs[_0x3546('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x3546('0x68')](_0x30fb03,{'header':!![],'skipEmptyLines':!![],'step':function(_0x41c8a5,_0x2c640f){total+=0x1;var _0x2c5481=total;promises['push'](checkRow(_0x41c8a5,_0xc4756f,_0x2c5481)['then'](function(){success+=0x1;})[_0x3546('0x2d')](function(_0x5e0e35){if(_0x5e0e35['error']){errors+=0x1;delete _0x5e0e35[_0x3546('0x1c')];}else if(_0x5e0e35['duplicate']){duplicates+=0x1;delete _0x5e0e35['duplicate'];}rows[_0x3546('0x56')](_0x5e0e35);}));if(total%0xc8===0x0){_0x2c640f[_0x3546('0x69')]();return processPromises(_0x2c640f);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x3546('0x6a'));endCsv();});},'error':function(_0x1d5be2,_0x1462ee){logger['info'](_0x3546('0x6b'),JSON[_0x3546('0x2e')](_0x1d5be2));endCsv();}});})['catch'](function(_0x5c5fbc){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x3546('0x2e')](_0x5c5fbc));});}main(); \ No newline at end of file +var _0x9c77=['CmContact','create','keys','push','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','deletedAt\x20IS\x20NULL','cm_hopper_black','fromQuery','VoiceQueue','findAll','CmList','Lists','then','get','dialCheckDuplicateType','always','query','VoiceQueueId','sequelize','catch','all','Campaign','CampaignId','BlackLists','generalCheckHopper','message','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','join','data','phone','phone\x20not\x20specified!','birthDate','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact'];(function(_0xdb4e73,_0x30b446){var _0x4578b4=function(_0x119eb5){while(--_0x119eb5){_0xdb4e73['push'](_0xdb4e73['shift']());}};_0x4578b4(++_0x30b446);}(_0x9c77,0x187));var _0x79c7=function(_0x2cc604,_0x5c3480){_0x2cc604=_0x2cc604-0x0;var _0x1af9f9=_0x9c77[_0x2cc604];return _0x1af9f9;};'use strict';var BPromise=require('bluebird');var util=require(_0x79c7('0x0'));var _=require(_0x79c7('0x1'));var fs=require('fs');var squel=require(_0x79c7('0x2'));var Papa=require(_0x79c7('0x3'));var Redis=require('ioredis');var db=require(_0x79c7('0x4'))['db'];var config=require(_0x79c7('0x5'));var logger=require(_0x79c7('0x6'))(_0x79c7('0x7'));config[_0x79c7('0x8')]=_[_0x79c7('0x9')](config[_0x79c7('0x8')],{'host':_0x79c7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x79c7('0x8')]));require(_0x79c7('0xb'))[_0x79c7('0xc')](socket);try{if(!process[_0x79c7('0xd')][0x2]||process[_0x79c7('0xd')][0x2]===_0x79c7('0xe')||process[_0x79c7('0xd')][0x2]===_0x79c7('0xf')){throw new Error(_0x79c7('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x79c7('0xd')][0x3]||process[_0x79c7('0xd')][0x3]===_0x79c7('0xe')||process[_0x79c7('0xd')][0x3]===_0x79c7('0xf')||!process[_0x79c7('0xd')][0x4]||process[_0x79c7('0xd')][0x4]===_0x79c7('0xe')||process[_0x79c7('0xd')][0x4]===_0x79c7('0xf')){throw new Error(_0x79c7('0x11'));}var FIELDS=_[_0x79c7('0x12')](process[_0x79c7('0xd')][0x3][_0x79c7('0x13')](','),process[_0x79c7('0xd')][0x4]['split'](','));if(!process[_0x79c7('0xd')][0x5]||process[_0x79c7('0xd')][0x5]===_0x79c7('0xe')||process[_0x79c7('0xd')][0x5]==='null'){throw new Error(_0x79c7('0x14'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x79c7('0xe')&&process['argv'][0x6]!==_0x79c7('0xf')?process[_0x79c7('0xd')][0x6]:null;var DUPLICATES=process[_0x79c7('0xd')][0x7]&&process[_0x79c7('0xd')][0x7]!==_0x79c7('0xe')&&process[_0x79c7('0xd')][0x7]!==_0x79c7('0xf')?process[_0x79c7('0xd')][0x7]:null;if(!process[_0x79c7('0xd')][0x8]||process[_0x79c7('0xd')][0x8]===_0x79c7('0xe')||process['argv'][0x8]===_0x79c7('0xf')){throw new Error(_0x79c7('0x15'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x52f42c){logger[_0x79c7('0x16')](_0x52f42c);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(_0x241fca,_0x1d7ae0,_0x540dad,_0x113471){var _0x5d48c4={'message':_0x1d7ae0};_0x5d48c4[_0x241fca]=!![];if(_0x540dad){_0x5d48c4[_0x79c7('0x17')]=_0x540dad;}if(_0x113471){_0x5d48c4[_0x79c7('0x18')]=_0x113471;}return _0x5d48c4;}function isEmail(_0x34f2a5){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x34f2a5);}function checkRow(_0x7c47ec,_0x526f85,_0x2017be){return new BPromise(function(_0x55b343,_0x1f3432){if(_[_0x79c7('0x19')](_0x7c47ec)){return _0x1f3432(handleCheckRowError(_0x79c7('0x16'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x2017be));}if(_0x7c47ec['errors']&&_0x7c47ec[_0x79c7('0x1a')][_0x79c7('0x1b')]){var _0x4cc749=_['map'](_0x7c47ec[_0x79c7('0x1a')],'message')[_0x79c7('0x1c')](';');return _0x1f3432(handleCheckRowError('error',_0x4cc749,null,_0x2017be));}var _0x31f677={};for(var _0x1105f1 in FIELDS){if(FIELDS['hasOwnProperty'](_0x1105f1)&&FIELDS[_0x1105f1]){_0x31f677[_0x1105f1]=_0x7c47ec[_0x79c7('0x1d')][0x0][FIELDS[_0x1105f1]]||_0x7c47ec[_0x79c7('0x1d')][0x0]['\ufeff'+FIELDS[_0x1105f1]];}}if(!_0x31f677['firstName']){return _0x1f3432(handleCheckRowError(_0x79c7('0x16'),'firstName\x20not\x20specified!',null,_0x2017be));}if(!_0x31f677[_0x79c7('0x1e')]){return _0x1f3432(handleCheckRowError(_0x79c7('0x16'),_0x79c7('0x1f'),null,_0x2017be));}if(_0x31f677[_0x79c7('0x20')]){var _0x2cf6c8=moment(_0x31f677[_0x79c7('0x20')],'YYYY-MM-DD');if(!_0x2cf6c8[_0x79c7('0x21')]()){return _0x1f3432(handleCheckRowError(_0x79c7('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x2017be));}}if(_0x31f677[_0x79c7('0x22')]){if(!isEmail(_0x31f677[_0x79c7('0x22')])){return _0x1f3432(handleCheckRowError('error',_0x79c7('0x23'),null,_0x2017be));}}_0x31f677[_0x79c7('0x24')]=LISTID;_0x31f677[_0x79c7('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x526f85){var _0x382e91={};for(var _0x2014bc=0x0,_0x4c6ccb=DUPLICATES[_0x79c7('0x1b')];_0x2014bc<_0x4c6ccb;_0x2014bc+=0x1){_0x382e91[DUPLICATES[_0x2014bc]]=_0x31f677[DUPLICATES[_0x2014bc]];}var _0x122596=_[_0x79c7('0x26')](_0x526f85,_0x382e91);if(_0x122596){return _0x1f3432(handleCheckRowError(_0x79c7('0x27'),_0x79c7('0x28'),_0x122596,_0x2017be));}}return db[_0x79c7('0x29')][_0x79c7('0x2a')](_0x31f677,{'raw':!![],'hooks':![],'fields':_[_0x79c7('0x2b')](_0x31f677)})['then'](function(_0x597e95){if(DUPLICATES&&DUPLICATES[_0x79c7('0x1b')]&&_0x526f85){_0x526f85[_0x79c7('0x2c')](_['pick'](_0x31f677,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x597e95['id'];return _0x55b343();})['catch'](function(_0x24aa7b){return _0x1f3432(handleCheckRowError(_0x79c7('0x16'),_0x79c7('0x2d')+(_0x24aa7b['message']||JSON[_0x79c7('0x2e')](_0x24aa7b)),null,_0x2017be));});});}function checkHopper(){function _0x30026a(){return function(_0x1be69){logger[_0x79c7('0x16')](_0x79c7('0x2f'),_0x79c7('0x30'),util[_0x79c7('0x31')](_0x1be69,{'showHidden':![],'depth':null}));};}var _0x18017d=function(_0x4adccd,_0x5838cb){var _0x3a82b5=squel[_0x79c7('0x32')]()[_0x79c7('0x33')](_0x79c7('0x34'))['fromQuery']([_0x79c7('0x1e'),_0x79c7('0x35'),_0x79c7('0x36'),_0x79c7('0x24'),_0x5838cb,_0x79c7('0x37'),_0x79c7('0x38')],squel[_0x79c7('0x39')]()['field'](_0x79c7('0x1e'),_0x79c7('0x1e'))[_0x79c7('0x3a')]('NOW()',_0x79c7('0x35'))[_0x79c7('0x3a')]('id',_0x79c7('0x36'))[_0x79c7('0x3a')](LISTID[_0x79c7('0x3b')](),_0x79c7('0x24'))[_0x79c7('0x3a')](_0x4adccd['id'][_0x79c7('0x3b')](),_0x5838cb)[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x37'))[_0x79c7('0x3a')]('NOW()',_0x79c7('0x38'))[_0x79c7('0x3d')](_0x79c7('0x3e'))[_0x79c7('0x3f')]('deletedAt\x20IS\x20NULL')[_0x79c7('0x3f')](_0x79c7('0x40'),LISTID[_0x79c7('0x3b')]())[_0x79c7('0x3f')](_0x79c7('0x41'))['where'](_0x79c7('0x42'),squel[_0x79c7('0x39')]()[_0x79c7('0x3a')]('phone')[_0x79c7('0x3d')](_0x79c7('0x34'))[_0x79c7('0x3f')](_0x5838cb+_0x79c7('0x43'),_0x4adccd['id'][_0x79c7('0x3b')]())))[_0x79c7('0x3b')]();return _0x3a82b5;};var _0x5a7a48=function(_0x250d3d,_0x4ae647){var _0x3f8c82=squel[_0x79c7('0x32')]()['into'](_0x79c7('0x34'))['fromQuery'](['phone',_0x79c7('0x35'),_0x79c7('0x36'),_0x79c7('0x24'),_0x4ae647,'createdAt','updatedAt'],squel['select']()['field']('phone',_0x79c7('0x1e'))[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x35'))[_0x79c7('0x3a')]('id',_0x79c7('0x36'))[_0x79c7('0x3a')](LISTID[_0x79c7('0x3b')](),_0x79c7('0x24'))[_0x79c7('0x3a')](_0x250d3d['id'][_0x79c7('0x3b')](),_0x4ae647)[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x37'))[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x38'))['from']('cm_contacts')[_0x79c7('0x3f')]('deletedAt\x20IS\x20NULL')[_0x79c7('0x3f')]('ListId\x20=\x20?',LISTID[_0x79c7('0x3b')]())[_0x79c7('0x3f')](_0x79c7('0x44'),squel[_0x79c7('0x45')](hopperContacts))[_0x79c7('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x79c7('0x3f')](_0x79c7('0x42'),squel[_0x79c7('0x39')]()[_0x79c7('0x3a')]('calleridnum')[_0x79c7('0x3d')](_0x79c7('0x46'))['where'](_0x4ae647+_0x79c7('0x43'),_0x250d3d['id']['toString']()))[_0x79c7('0x3f')](_0x79c7('0x42'),squel[_0x79c7('0x39')]()[_0x79c7('0x3a')](_0x79c7('0x1e'))[_0x79c7('0x3d')](_0x79c7('0x34'))[_0x79c7('0x3f')](_0x4ae647+_0x79c7('0x43'),_0x250d3d['id'][_0x79c7('0x3b')]())))[_0x79c7('0x3b')]();return _0x3f8c82;};function _0x1a38e0(_0x4e5aae,_0xd1a2b){var _0x193724=squel[_0x79c7('0x32')]()[_0x79c7('0x33')]('cm_hopper')['fromQuery']([_0x79c7('0x1e'),'scheduledAt','ContactId','ListId',_0xd1a2b,'createdAt','updatedAt'],squel['select']()['field'](_0x79c7('0x1e'),_0x79c7('0x1e'))['field'](_0x79c7('0x3c'),_0x79c7('0x35'))['field']('id',_0x79c7('0x36'))[_0x79c7('0x3a')](LISTID[_0x79c7('0x3b')](),_0x79c7('0x24'))[_0x79c7('0x3a')](_0x4e5aae['id'][_0x79c7('0x3b')](),_0xd1a2b)[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x37'))[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x38'))[_0x79c7('0x3d')](_0x79c7('0x3e'))[_0x79c7('0x3f')](_0x79c7('0x47'))[_0x79c7('0x3f')](_0x79c7('0x40'),LISTID['toString']())[_0x79c7('0x3f')](_0x79c7('0x44'),squel[_0x79c7('0x45')](hopperContacts))[_0x79c7('0x3f')](_0x79c7('0x41')))[_0x79c7('0x3b')]();return _0x193724;}function _0x3830a3(_0x653826,_0x39044d){var _0x5f1f84=squel[_0x79c7('0x32')]()[_0x79c7('0x33')](_0x79c7('0x48'))[_0x79c7('0x49')]([_0x79c7('0x1e'),_0x79c7('0x36'),_0x79c7('0x24'),_0x39044d,_0x79c7('0x37'),_0x79c7('0x38')],squel[_0x79c7('0x39')]()[_0x79c7('0x3a')](_0x79c7('0x1e'),'phone')[_0x79c7('0x3a')]('id',_0x79c7('0x36'))[_0x79c7('0x3a')](LISTID[_0x79c7('0x3b')](),'ListId')[_0x79c7('0x3a')](_0x653826['id']['toString'](),_0x39044d)[_0x79c7('0x3a')](_0x79c7('0x3c'),'createdAt')[_0x79c7('0x3a')](_0x79c7('0x3c'),_0x79c7('0x38'))[_0x79c7('0x3d')](_0x79c7('0x3e'))[_0x79c7('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0x79c7('0x40'),LISTID[_0x79c7('0x3b')]())[_0x79c7('0x3f')]('id\x20IN\x20?',squel[_0x79c7('0x45')](hopperContacts))[_0x79c7('0x3f')](_0x79c7('0x41')))[_0x79c7('0x3b')]();return _0x5f1f84;}return db[_0x79c7('0x4a')][_0x79c7('0x4b')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x79c7('0x4c')],'as':_0x79c7('0x4d'),'where':{'id':LISTID}}]})[_0x79c7('0x4e')](function(_0x4927f6){var _0x4cf6cd=[];if(_0x4927f6){var _0x13dc29;for(var _0x3f9054=0x0,_0x187dc1;_0x3f9054<_0x4927f6[_0x79c7('0x1b')];_0x3f9054+=0x1){_0x187dc1=_0x4927f6[_0x3f9054][_0x79c7('0x4f')]({'plain':!![]});switch(_0x187dc1[_0x79c7('0x50')]){case _0x79c7('0x51'):_0x4cf6cd['push'](db['sequelize'][_0x79c7('0x52')](_0x5a7a48(_0x187dc1,_0x79c7('0x53')))[_0x79c7('0x4e')](function(){})['catch'](_0x30026a()));break;case'onlyIfOpen':_0x4cf6cd['push'](db[_0x79c7('0x54')][_0x79c7('0x52')](_0x18017d(_0x187dc1,_0x79c7('0x53')))[_0x79c7('0x4e')](function(){})[_0x79c7('0x55')](_0x30026a()));break;default:_0x4cf6cd[_0x79c7('0x2c')](db[_0x79c7('0x54')][_0x79c7('0x52')](_0x1a38e0(_0x187dc1,_0x79c7('0x53')))['then'](function(){})['catch'](_0x30026a()));}}}return _0x4cf6cd;})[_0x79c7('0x56')]()[_0x79c7('0x4e')](function(){return db[_0x79c7('0x4a')][_0x79c7('0x4b')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x79c7('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x79c7('0x4e')](function(_0xcc83df){var _0x10e2ba=[];if(_0xcc83df){var _0x4ea469;for(var _0x3bbed3=0x0,_0x51f880;_0x3bbed3<_0xcc83df[_0x79c7('0x1b')];_0x3bbed3+=0x1){_0x51f880=_0xcc83df[_0x3bbed3]['get']({'plain':!![]});_0x10e2ba[_0x79c7('0x2c')](db[_0x79c7('0x54')]['query'](_0x3830a3(_0x51f880,_0x79c7('0x53')))[_0x79c7('0x4e')](function(){})[_0x79c7('0x55')](_0x30026a()));}}return _0x10e2ba;})[_0x79c7('0x56')]();})[_0x79c7('0x4e')](function(){return db[_0x79c7('0x57')][_0x79c7('0x4b')]({'attributes':['id',_0x79c7('0x50')],'include':[{'model':db['CmList'],'as':_0x79c7('0x4d'),'where':{'id':LISTID}}]})[_0x79c7('0x4e')](function(_0x652680){var _0x5132f9=[];if(_0x652680){for(var _0x6e4c02=0x0,_0x309461;_0x6e4c02<_0x652680[_0x79c7('0x1b')];_0x6e4c02+=0x1){_0x309461=_0x652680[_0x6e4c02][_0x79c7('0x4f')]({'plain':!![]});switch(_0x309461[_0x79c7('0x50')]){case _0x79c7('0x51'):_0x5132f9[_0x79c7('0x2c')](db['sequelize'][_0x79c7('0x52')](_0x5a7a48(_0x309461,_0x79c7('0x58')))['then'](function(){})[_0x79c7('0x55')](_0x30026a()));break;case'onlyIfOpen':_0x5132f9['push'](db[_0x79c7('0x54')][_0x79c7('0x52')](_0x18017d(_0x309461,'CampaignId'))[_0x79c7('0x4e')](function(){})['catch'](_0x30026a()));break;default:_0x5132f9[_0x79c7('0x2c')](db['sequelize'][_0x79c7('0x52')](_0x1a38e0(_0x309461,_0x79c7('0x58')))[_0x79c7('0x4e')](function(){})[_0x79c7('0x55')](_0x30026a()));}}}return _0x5132f9;})[_0x79c7('0x56')]();})[_0x79c7('0x4e')](function(){return db[_0x79c7('0x57')][_0x79c7('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x79c7('0x4c')],'as':_0x79c7('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x581bc8){var _0xaf1516=[];if(_0x581bc8){for(var _0x20b1af=0x0,_0x11ac8b;_0x20b1af<_0x581bc8[_0x79c7('0x1b')];_0x20b1af+=0x1){_0x11ac8b=_0x581bc8[_0x20b1af][_0x79c7('0x4f')]({'plain':!![]});_0xaf1516[_0x79c7('0x2c')](db[_0x79c7('0x54')][_0x79c7('0x52')](_0x3830a3(_0x11ac8b,_0x79c7('0x58')))[_0x79c7('0x4e')](function(){})[_0x79c7('0x55')](_0x30026a()));}}return _0xaf1516;})['all']();})[_0x79c7('0x55')](function(_0x4feb87){logger['error']('cmContact,\x20%s,\x20%s',_0x79c7('0x5a'),_0x4feb87[_0x79c7('0x5b')]);});}var processPromises=function(_0xdf345e){return BPromise[_0x79c7('0x56')](promises)[_0x79c7('0x4e')](function(_0x3d8a04){})[_0x79c7('0x55')](function(_0x2d7cd5){logger[_0x79c7('0x16')](_0x79c7('0x5c'),JSON[_0x79c7('0x2e')](_0x2d7cd5));})[_0x79c7('0x5d')](function(){socket['emit'](_0x79c7('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xdf345e){return _0xdf345e[_0x79c7('0x5f')]();}});};var endCsv=function(){return BPromise[_0x79c7('0x60')]()[_0x79c7('0x4e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x79c7('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x79c7('0x61')](FILEPATH);}catch(_0x415240){logger['error'](_0x79c7('0x62'),JSON[_0x79c7('0x2e')](_0x415240));}finally{process[_0x79c7('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0x79c7('0x64')](_0x79c7('0x65'));endCsv();});function main(){return BPromise['resolve']()[_0x79c7('0x4e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x79c7('0x13')](',');return db[_0x79c7('0x29')][_0x79c7('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x79c7('0x4e')](function(_0x38e922){var _0xfdbe49=fs[_0x79c7('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x79c7('0x67')](_0xfdbe49,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5dcd7f,_0x143ac2){total+=0x1;var _0x2f8f1b=total;promises['push'](checkRow(_0x5dcd7f,_0x38e922,_0x2f8f1b)[_0x79c7('0x4e')](function(){success+=0x1;})[_0x79c7('0x55')](function(_0x4c4bf3){if(_0x4c4bf3[_0x79c7('0x16')]){errors+=0x1;delete _0x4c4bf3['error'];}else if(_0x4c4bf3['duplicate']){duplicates+=0x1;delete _0x4c4bf3['duplicate'];}rows[_0x79c7('0x2c')](_0x4c4bf3);}));if(total%0xc8===0x0){_0x143ac2[_0x79c7('0x68')]();return processPromises(_0x143ac2);}},'complete':function(){return processPromises()[_0x79c7('0x4e')](function(){logger['info'](_0x79c7('0x69'));endCsv();});},'error':function(_0x3fec19,_0x259ce8){logger[_0x79c7('0x64')](_0x79c7('0x6a'),JSON['stringify'](_0x3fec19));endCsv();}});})['catch'](function(_0x392088){logger['error'](_0x79c7('0x6b'),JSON['stringify'](_0x392088));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 783d2f8..5deb585 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 _0x418a=['parse','createReadStream','data','rows','find','hasOwnProperty','trim','isValid','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','replace','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','voice_queues','CampaignId','campaigns_has_cm_blacklists','VoiceQueueId','affectedRows','unlink','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment/shared','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','CmContactHasItem','findOne','update','create','inserted','cm_contacts.phone','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.createdAt','insert','updatedAt','fields','.CmListId','field','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.createdAt\x20=\x20?','\x22onlyIfOpen\x22','cm_hopper_black','ListId\x20=\x20?','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','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_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','offset','set','main','stringify','send','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description'];(function(_0x5b8e1c,_0x480fc2){var _0x2b20ec=function(_0x5a4dca){while(--_0x5a4dca){_0x5b8e1c['push'](_0x5b8e1c['shift']());}};_0x2b20ec(++_0x480fc2);}(_0x418a,0xe3));var _0xa418=function(_0x248ca8,_0x23e66e){_0x248ca8=_0x248ca8-0x0;var _0x44006f=_0x418a[_0x248ca8];return _0x44006f;};'use strict';var fs=require('fs');var path=require(_0xa418('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xa418('0x1'));var moment=require(_0xa418('0x2'));var squel=require('squel');var Redis=require(_0xa418('0x3'));var db=require(_0xa418('0x4'))['db'];var config=require('../../../config/environment');var shared=require(_0xa418('0x5'));var logger=require('../../../config/logger')('import');config['redis']=_[_0xa418('0x6')](config[_0xa418('0x7')],{'host':_0xa418('0x8'),'port':0x18eb});var socket=require(_0xa418('0x9'))(new Redis(config[_0xa418('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xa418('0xa'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xa418('0xb')](_0xa418('0xa'));function isEmail(_0x5bd389){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))*$/[_0xa418('0xc')](_0x5bd389);}function selectNotIn(_0x4e4b74,_0x47aa76,_0x4566ed,_0x335a23,_0x34d33b){return squel[_0xa418('0xd')]()['field'](_0xa418('0xe'))[_0xa418('0xf')](_0x335a23)[_0xa418('0x10')](_0x47aa76,null,_0x47aa76+_0xa418('0x11')+_0x335a23+'.'+_0x4566ed)[_0xa418('0x12')](_0x335a23+'.'+_0x4566ed+'\x20=\x20'+_0x4e4b74+'.'+_0x4566ed)[_0xa418('0x12')](_0x47aa76+_0xa418('0x13')+_0x34d33b['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0xcc6af7,_0x4eafa6){promisesAdditionalPhones=[];return db[_0xa418('0x14')][_0xa418('0x15')]({'raw':!![],'attributes':['id',_0xa418('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa418('0x17')](function(_0xfd3053){if(_0xfd3053!==null){var _0x133407=[];for(var _0x15e0ee=0x0;_0x15e0ee<_0xfd3053[_0xa418('0x18')];_0x15e0ee++){var _0x17743a=_0xfd3053[_0x15e0ee];_0x133407[_0xa418('0x19')](insertAdditionalPhones(_0x17743a));}}Promise[_0xa418('0x1a')](_0x133407)[_0xa418('0x17')](function(){_0xcc6af7({'val':0x1});});});});}function insertAdditionalPhones(_0x58b576){return new Promise(function(_0x2fa26e,_0x2968dc){var _0x2a8eaa=_0x58b576['AdditionalPhones'];var _0x362205=_0x2a8eaa[_0xa418('0x1b')](';');var _0x96e363=[];orderBy=0x0;for(var _0x25d250=0x0;_0x25d250<_0x362205[_0xa418('0x18')];_0x25d250++){_0x96e363[_0xa418('0x19')](splitAdditionalPhone(_0x58b576['id'],_0x362205[_0x25d250]));}Promise[_0xa418('0x1a')](_0x96e363)[_0xa418('0x17')](function(){_0x2fa26e({'val':_0x362205[_0xa418('0x18')]});});});}function splitAdditionalPhone(_0x111a43,_0x3fdb71){return new Promise(function(_0x1631d1,_0x143dd5){var _0x69ba12=_0x3fdb71[_0xa418('0x1b')](':');var _0x520517=_0x69ba12[0x0];var _0x4aaac5=_0x69ba12[0x1];if(!_[_0xa418('0x1c')](_0x4aaac5)){var _0xda197f=_0x4aaac5[_0xa418('0x1b')]('|');var _0x311b5e=[];for(var _0x8b54c4=0x0;_0x8b54c4<_0xda197f[_0xa418('0x18')];_0x8b54c4++){if(_0xda197f[_0x8b54c4]!==''){var _0x32af11=_['filter'](promisesAdditionalPhones,{'contactId':_0x111a43,'phone':_0xda197f[_0x8b54c4]});if(_0x32af11['length']==0x0){orderBy++;promisesAdditionalPhones[_0xa418('0x19')]({'contactId':_0x111a43,'contactTypeId':_0x520517,'phone':_0xda197f[_0x8b54c4],'orderBy':orderBy});}}}_0x1631d1({'ok':0x1});}else _0x1631d1({'res':0x0});});}function createAdditionalPhone(_0x47f746,_0x4ad532,_0x201721,_0x1d3dec){var _0x5e5950='';var _0x14706e='';var _0x4ec19c=_0x201721['split']('§');_0x5e5950=_0x4ec19c[0x0];if(_0x4ec19c[_0xa418('0x18')]==0x2)_0x14706e=_0x4ec19c[0x1];return new Promise(function(_0x4f7e80,_0x21a29f){return db[_0xa418('0x1d')][_0xa418('0x1e')]({'where':{'CmContactId':_0x47f746,'item':_0x5e5950}})[_0xa418('0x17')](function(_0x49a1e8){if(_0x49a1e8){return db[_0xa418('0x1d')][_0xa418('0x1f')]({'ItemTypeId':_0x4ad532,'description':_0x14706e,'OrderBy':_0x1d3dec},{'where':{'CmContactId':_0x47f746,'item':_0x5e5950}})[_0xa418('0x17')](function(_0x21cc8d){_0x4f7e80({'res':'updated'});});}else{return db[_0xa418('0x1d')][_0xa418('0x20')]({'CmContactId':_0x47f746,'item':_0x5e5950,'description':_0x14706e,'ItemTypeId':_0x4ad532,'OrderBy':_0x1d3dec,'ItemClass':'PHONE'})[_0xa418('0x17')](function(_0x4e6489){_0x4f7e80({'res':_0xa418('0x21')});});}});});}function insertCmHopper(_0x2372b6,_0x70acf3,_0x10e31d,_0x615ca2,_0x266009){var _0x4e9350=[_0xa418('0x22'),'cm_contacts.scheduledat','cm_contacts.id',_0xa418('0x23'),_0x70acf3+'.'+_0x615ca2,'cm_contacts.createdAt',_0xa418('0x24'),_0xa418('0x25'),_0xa418('0x26'),'\x22'+_0x266009+'\x22'];return squel['insert']()[_0xa418('0x27')](_0xa418('0x28'))[_0xa418('0x29')]([_0xa418('0xe'),_0xa418('0x2a'),_0xa418('0x2b'),_0xa418('0x2c'),_0x615ca2,_0xa418('0x2d'),'updatedAt',_0xa418('0x2e'),_0xa418('0x2f'),'recallme'],squel[_0xa418('0xd')]()['fields'](_0x4e9350)[_0xa418('0xf')](_0x70acf3)['join'](_0xa418('0x30'),null,_0xa418('0x31')+_0x70acf3+'.CmListId')['join'](_0x10e31d,null,_0x10e31d+_0xa418('0x11')+_0x70acf3+'.'+_0x615ca2)[_0xa418('0x12')](_0x70acf3+_0xa418('0x32'),_0x2372b6)[_0xa418('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa418('0x12')](_0xa418('0x33'),selectNotIn(_0x70acf3,_0x10e31d,_0x615ca2,_0xa418('0x28'),[_0xa418('0x34'),'\x22onlyIfOpen\x22']))[_0xa418('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x70acf3,_0x10e31d,_0x615ca2,_0xa418('0x28'),[_0xa418('0x34')])))[_0xa418('0x35')]();}function insertCmHopperBlack(_0x171e61,_0x1159fb,_0x13e5e8,_0x20a6cf){var _0x507967=[_0xa418('0x22'),'cm_contacts.id',_0xa418('0x23'),_0x1159fb+'.'+_0x20a6cf,_0xa418('0x36'),_0xa418('0x24')];return squel[_0xa418('0x37')]()[_0xa418('0x27')]('cm_hopper_black')[_0xa418('0x29')]([_0xa418('0xe'),'ContactId',_0xa418('0x2c'),_0x20a6cf,'createdAt',_0xa418('0x38')],squel[_0xa418('0xd')]()[_0xa418('0x39')](_0x507967)[_0xa418('0xf')](_0x1159fb)['join'](_0xa418('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x1159fb+_0xa418('0x3a'))[_0xa418('0x10')](_0x13e5e8,null,_0x13e5e8+_0xa418('0x11')+_0x1159fb+'.'+_0x20a6cf)[_0xa418('0x12')](_0x1159fb+'.CmListId\x20=\x20?',_0x171e61)[_0xa418('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa418('0x12')](_0xa418('0x33'),squel['select']()[_0xa418('0x3b')](_0xa418('0xe'))['from']('cm_hopper_black')[_0xa418('0x12')]('ListId\x20=\x20?',_0x171e61)['where'](_0x20a6cf+_0xa418('0x3c')+_0x1159fb+'.'+_0x20a6cf)))[_0xa418('0x35')]();}function insertTzCmHopper(_0x2c466b,_0x230935,_0x546d40,_0x336d10,_0xba317b,_0x5533ac){var _0x33bb55=[_0xa418('0x22'),_0xa418('0x3d')+_0x5533ac+_0xa418('0x3e'),'cm_contacts.id','cm_contacts.ListId',_0x230935+'.'+_0x336d10,'cm_contacts.createdAt',_0xa418('0x24'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0xba317b+'\x22'];var _0x3491fb=squel['insert']()[_0xa418('0x27')](_0xa418('0x28'))[_0xa418('0x29')]([_0xa418('0xe'),_0xa418('0x2a'),_0xa418('0x2b'),'ListId',_0x336d10,_0xa418('0x2d'),_0xa418('0x38'),'priority',_0xa418('0x2f'),'recallme'],squel[_0xa418('0xd')]()['fields'](_0x33bb55)[_0xa418('0xf')](_0x230935)['join'](_0xa418('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x230935+_0xa418('0x3a'))['join'](_0x546d40,null,_0x546d40+_0xa418('0x11')+_0x230935+'.'+_0x336d10)[_0xa418('0x10')](_0x5533ac,null,_0x5533ac+_0xa418('0x11')+_0x230935+'.'+_0x336d10)['where'](_0x230935+_0xa418('0x32'),_0x2c466b)[_0xa418('0x12')](_0xa418('0x3f'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x230935,_0x546d40,_0x336d10,_0xa418('0x28'),['\x22always\x22',_0xa418('0x40')]))[_0xa418('0x12')](_0xa418('0x33'),selectNotIn(_0x230935,_0x546d40,_0x336d10,_0xa418('0x28'),[_0xa418('0x34')])))[_0xa418('0x35')]();return _0x3491fb;}function insertTzCmHopperBlack(_0x46e850,_0xef308e,_0xcd4449,_0x1bc38c){var _0x366825=['cm_contacts.phone','cm_contacts.id',_0xa418('0x23'),_0xef308e+'.'+_0x1bc38c,_0xa418('0x36'),'cm_contacts.updatedAt'];return squel[_0xa418('0x37')]()[_0xa418('0x27')](_0xa418('0x41'))[_0xa418('0x29')]([_0xa418('0xe'),_0xa418('0x2b'),_0xa418('0x2c'),_0x1bc38c,_0xa418('0x2d'),_0xa418('0x38')],squel[_0xa418('0xd')]()[_0xa418('0x39')](_0x366825)[_0xa418('0xf')](_0xef308e)[_0xa418('0x10')]('cm_contacts',null,_0xa418('0x31')+_0xef308e+_0xa418('0x3a'))[_0xa418('0x10')](_0xcd4449,null,_0xcd4449+_0xa418('0x11')+_0xef308e+'.'+_0x1bc38c)[_0xa418('0x12')](_0xef308e+'.CmListId\x20=\x20?',_0x46e850)[_0xa418('0x12')](_0xa418('0x3f'),NOW)[_0xa418('0x12')](_0xa418('0x33'),squel[_0xa418('0xd')]()['field'](_0xa418('0xe'))[_0xa418('0xf')](_0xa418('0x41'))[_0xa418('0x12')](_0xa418('0x42'),_0x46e850)[_0xa418('0x12')](_0x1bc38c+_0xa418('0x3c')+_0xef308e+'.'+_0x1bc38c)))['toString']();}function insertCmHopperAdditionalPhones(_0x2b9db9){var _0x1d2d89=['cm_hopper.id','cm_contact_has_items.item',_0xa418('0x43'),_0xa418('0x44'),_0xa418('0x45')];return squel[_0xa418('0x37')]()[_0xa418('0x27')](_0xa418('0x46'))[_0xa418('0x29')](['CmHopperId',_0xa418('0xe'),_0xa418('0x47'),'createdAt','updatedAt'],squel[_0xa418('0xd')]()[_0xa418('0x39')](_0x1d2d89)[_0xa418('0xf')](_0xa418('0x28'))[_0xa418('0x10')]('cm_contacts',null,_0xa418('0x48'))[_0xa418('0x10')](_0xa418('0x49'),null,_0xa418('0x4a'))[_0xa418('0x12')]('cm_hopper.ListId\x20=\x20?',_0x2b9db9)[_0xa418('0x12')](_0xa418('0x3f'),NOW))[_0xa418('0x35')]();}function insertCmContact(_0x53b27b,_0x1dcf3c,_0x7ce709,_0x1f2763){var _0x19bdf0=_[_0xa418('0x4b')](_[_0xa418('0x4c')](_0x1f2763),[_0xa418('0x2c'),_0xa418('0x4d'),_0xa418('0x2d'),_0xa418('0x38'),_0xa418('0x4e')]);return squel[_0xa418('0x37')]()[_0xa418('0x27')](_0xa418('0x30'))[_0xa418('0x29')](_0x19bdf0,squel['select']()[_0xa418('0x39')](_0x19bdf0)['from'](_0x1dcf3c)[_0xa418('0x12')]('('+_0x7ce709[_0xa418('0x10')](',')+_0xa418('0x4f'),squel[_0xa418('0xd')]()['fields'](_0x7ce709)[_0xa418('0xf')](_0xa418('0x30'))[_0xa418('0x12')](_0xa418('0x42'),_0x53b27b)[_0xa418('0x12')](_0xa418('0x50')))['where'](_0xa418('0x51'),squel[_0xa418('0xd')]()[_0xa418('0x3b')](_0xa418('0x52'),_0xa418('0x53'))[_0xa418('0xf')](_0x1dcf3c)[_0xa418('0x54')](_0x7ce709[_0xa418('0x10')](','))))[_0xa418('0x35')]();}function handleStop(){logger['info'](_0xa418('0x55'));stopped=!![];}function handleUncaughtException(_0x50c48f){logger[_0xa418('0x56')](_0x50c48f[_0xa418('0x57')]);process[_0xa418('0x58')](0x1);}function handleError(_0x533fbd,_0x474f47){stats[_0xa418('0x59')][_0xa418('0x19')]({'name':_0x474f47[_0xa418('0x5a')],'message':_0x474f47[_0xa418('0x57')],'row':_0x533fbd});}function handleQuery(_0x3dafc4){logger[_0xa418('0x5b')](_0x3dafc4);return db['sequelize']['query'](_0x3dafc4)[_0xa418('0x5c')](function(_0x1f9f0b){results[_0xa418('0x19')](_0x1f9f0b);})[_0xa418('0x5d')](function(_0x55cb70){logger[_0xa418('0x56')](_0x55cb70[_0xa418('0x57')]);});}function updateTzCampaigns(_0x103d37){return new Promise(function(_0x5d1955,_0x551db3){var _0x3bf8e5=squel[_0xa418('0xd')]()['fields']([_0xa418('0x5e'),_0xa418('0x5f')])[_0xa418('0xf')](_0xa418('0x60'))[_0xa418('0x10')](_0xa418('0x61'),null,_0xa418('0x62'))[_0xa418('0x12')](_0xa418('0x63')+_0x103d37);db[_0xa418('0x64')][_0xa418('0x65')](_0x3bf8e5[_0xa418('0x35')]())[_0xa418('0x5c')](function(_0x91328d){var _0x30e713=[];for(var _0x121087=0x0;_0x121087<_0x91328d[_0xa418('0x18')];_0x121087++){_0x30e713[_0xa418('0x19')](getTimezoneData(_0x91328d[_0x121087],tmp_campaigns));}BPromise[_0xa418('0x1a')](_0x30e713)['then'](function(){_0x5d1955({'val':0x1});});})[_0xa418('0x5d')](function(_0x416463){logger[_0xa418('0x56')](_0x416463[_0xa418('0x57')]);_0x5d1955({'val':0x0});});});}function updateTzVoiceQueues(_0x3ff0c8){return new Promise(function(_0x2808dd,_0x24f465){var _0x3c9b2a=squel['select']()[_0xa418('0x39')]([_0xa418('0x66'),'voice_queues.dialTimezone'])[_0xa418('0xf')]('voice_queues')['join'](_0xa418('0x67'),null,_0xa418('0x68'))['where'](_0xa418('0x69')+_0x3ff0c8);db['sequelize'][_0xa418('0x65')](_0x3c9b2a[_0xa418('0x35')]())['spread'](function(_0x4594a9){var _0x32eccc=[];for(var _0x350dc7=0x0;_0x350dc7<_0x4594a9[_0xa418('0x18')];_0x350dc7++){_0x32eccc['push'](getTimezoneData(_0x4594a9[_0x350dc7],tmp_voice_queues));}BPromise[_0xa418('0x1a')](_0x32eccc)[_0xa418('0x17')](function(){_0x2808dd({'val':0x1});});})[_0xa418('0x5d')](function(_0xd28613){logger[_0xa418('0x56')](_0xd28613[_0xa418('0x57')]);_0x2808dd({'val':0x0});});});}function getTimezoneData(_0x3d0d71,_0x2a98db){return new Promise(function(_0x5d8fa7,_0xe39061){var _0x24e362=shared[_0xa418('0x6a')];var _0x5aec42=_0x24e362[_0x3d0d71[_0xa418('0x6b')]];if(_[_0xa418('0x1c')](_0x5aec42)){_0x5d8fa7({'ret':0x1});}else{var _0x539106=_0x5aec42[_0xa418('0x6c')];var _0x299be0=squel[_0xa418('0x37')]()[_0xa418('0x27')](_0x2a98db)['set']('id',_0x3d0d71['id'])['set'](_0xa418('0x6d'),_0x539106)[_0xa418('0x6e')](_0xa418('0x6b'),_0x3d0d71['dialTimezone'])[_0xa418('0x35')]();return db['sequelize']['query'](_0x299be0)['spread'](function(_0x44ae9b){_0x5d8fa7({'ret':0x1});})['catch'](function(_0x364831){logger[_0xa418('0x56')](_0x364831[_0xa418('0x57')]);_0xe39061({'ret':0x1});});}});}function handleTZQuery(_0x521dc9){logger[_0xa418('0x5b')](_0x521dc9);return db['sequelize'][_0xa418('0x65')](_0x521dc9)[_0xa418('0x5c')](function(_0x3cdb55){})[_0xa418('0x5d')](function(_0x2eb677){logger['error'](_0x2eb677[_0xa418('0x57')]);});}function main(_0x523e5b,_0x37c8fc,_0x49b0c9,_0x38a0b1){logger[_0xa418('0x5b')](_0xa418('0x6f'),_0x523e5b,JSON[_0xa418('0x70')](_0x37c8fc));process[_0xa418('0x71')]('start');var _0x35462b=_0x37c8fc[_0xa418('0x72')];var _0x37afdd=_[_0xa418('0x73')](_0x35462b);var _0x1c0d64=_0x37c8fc[_0xa418('0x74')];var _0x46099c=path['join'](config[_0xa418('0x75')],_0xa418('0x76'),_0x1c0d64+_0xa418('0x77'));hasTZ=_[_0xa418('0x4c')](_0x35462b)[_0xa418('0x78')]('dialTimezone');var _0x56223a=_[_0xa418('0x4c')](_0x35462b)[_0xa418('0x10')]();logger['info'](_0xa418('0x79'),_0x56223a);db[_0xa418('0x7a')][_0xa418('0x15')]({'raw':!![],'attributes':['id',_0xa418('0x7b')]})[_0xa418('0x17')](function(_0x4a694e){for(var _0x1a4323=0x0;_0x1a4323<_0x4a694e[_0xa418('0x18')];_0x1a4323++){if(_0x4a694e[_0x1a4323][_0xa418('0x7b')]in _0x35462b){contactItemTypes['push'](_0x4a694e[_0x1a4323]);delete _0x37afdd[_0x4a694e[_0x1a4323][_0xa418('0x7b')]];hasAdditionalPhones=!![];}for(var _0x4326ad in _0x35462b){if(_0x4a694e[_0x1a4323][_0xa418('0x7b')]+_0xa418('0x7c')===_0x4326ad){phoneDescriptions[_0xa418('0x19')]({'itemTypeId':_0x4a694e[_0x1a4323]['id'],'description':_0x4326ad});delete _0x37afdd[_0x4326ad];}}}if(hasAdditionalPhones)_0x37afdd[_0xa418('0x16')]='';var _0x59a0d5=_[_0xa418('0x4c')](_0x37afdd)[_0xa418('0x10')]();logger[_0xa418('0x5b')]('header',_0x59a0d5);fs['writeFileSync'](_0x46099c,_0x59a0d5+'\x0a');Papa[_0xa418('0x7d')](fs[_0xa418('0x7e')](_0x523e5b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x63309d,_0x31a0de){try{for(var _0x31aae4=0x0,_0x2e651f=[];_0x31aae4<_0x63309d[_0xa418('0x7f')][_0xa418('0x18')];_0x31aae4++){stats[_0xa418('0x80')]+=0x1;if(_0x63309d[_0xa418('0x59')][_0x31aae4]){handleError(_0x63309d[_0xa418('0x7f')][_0x31aae4],_0x63309d[_0xa418('0x59')][_0x31aae4]);}else{var _0x36925f=[];var _0x21d204=[];var _0x4d3ff0={};for(var _0x439676 in _0x35462b){let _0x42068a=contactItemTypes[_0xa418('0x81')](_0x5c8766=>_0x5c8766[_0xa418('0x7b')]===_0x439676);let _0x3d087e=contactItemTypes[_0xa418('0x81')](_0x4f45a9=>_0x4f45a9['name']+_0xa418('0x7c')===_0x439676);if(_['isNil'](_0x42068a)&&_[_0xa418('0x1c')](_0x3d087e)){if(_0x35462b[_0xa418('0x82')](_0x439676)){if(_0x63309d['data'][_0x31aae4][_0x35462b[_0x439676]]){var _0x46e7d8=_[_0xa418('0x83')](_0x63309d['data'][_0x31aae4][_0x35462b[_0x439676]]['replace'](/"/g,'\x27'));switch(_0x439676){case _0xa418('0x2a'):var _0x38efd8=moment(_0x46e7d8,_0xa418('0xa'),!![]);if(_0x38efd8[_0xa418('0x84')]()){_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');}else{_0x36925f[_0xa418('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xa418('0x2e'):var _0x2a9c42=parseInt(_0x46e7d8);_0x46e7d8=_['isNaN'](_0x2a9c42)||_0x2a9c42<0x0||_0x2a9c42>0x4?_0x38a0b1?0x3:0x2:_0x2a9c42;_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');break;case _0xa418('0x2f'):var _0x297670=parseInt(_0x46e7d8);if(_[_0xa418('0x85')](_0x297670)&&_[_0xa418('0x78')](_0x49b0c9,_0x297670)){_0x2e651f[_0xa418('0x19')]('\x22'+_0x297670+'\x22');}else{_0x36925f['push'](_0xa418('0x86'));}break;case'email':if(isEmail(_0x46e7d8)){_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');}else{_0x36925f[_0xa418('0x19')](_0xa418('0x87'));}break;case'dateOfBirth':var _0x5fadfd=moment(_0x46e7d8,'YYYY-MM-DD',!![]);if(_0x5fadfd['isValid']()){_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');}else{_0x36925f[_0xa418('0x19')](_0xa418('0x88'));}break;case _0xa418('0x6b'):var _0x409c61=shared[_0xa418('0x6a')];var _0x3448ca=_0x409c61[_0x46e7d8];if(!_[_0xa418('0x1c')](_0x3448ca)){var _0x41dde2=_0x3448ca[_0xa418('0x6c')];_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');_0x2e651f[_0xa418('0x19')]('\x22'+_0x41dde2+'\x22');}break;default:_0x2e651f[_0xa418('0x19')]('\x22'+_0x46e7d8+'\x22');}}else{switch(_0x439676){case'firstName':case _0xa418('0xe'):_0x36925f[_0xa418('0x19')](_0x439676+'\x20not\x20specified');break;default:_0x2e651f[_0xa418('0x19')]('\x22\x22');}}}}else{var _0xa3f8e6='';if(!_['isNil'](_0x42068a)){if(!_0x4d3ff0['hasOwnProperty'](_0x42068a['id'])){if(!_[_0xa418('0x1c')](_0x63309d[_0xa418('0x7f')][_0x31aae4][_0x35462b[_0x439676]])){var _0x46e7d8=_[_0xa418('0x83')](_0x63309d['data'][_0x31aae4][_0x35462b[_0x439676]][_0xa418('0x89')](/"/g,'\x27'));var _0x3de598=phoneDescriptions[_0xa418('0x81')](_0x17cbe4=>_0x17cbe4['itemTypeId']===_0x42068a['id']);if(!_[_0xa418('0x1c')](_0x3de598)){var _0x4cdff1=_[_0xa418('0x83')](_0x63309d[_0xa418('0x7f')][_0x31aae4][_0x35462b[_0x3de598[_0xa418('0x8a')]]][_0xa418('0x89')](/"/g,'\x27'));if(!_[_0xa418('0x1c')](_0x4cdff1))_0x46e7d8=_0x46e7d8+'§'+_0x4cdff1;}if(_0xa3f8e6=='')_0xa3f8e6=_0x46e7d8;else _0xa3f8e6+='|'+_0x46e7d8;}_0x21d204[_0xa418('0x19')](_0x42068a['id']+':'+_0xa3f8e6);_0x4d3ff0[_0x42068a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2e651f[_0xa418('0x19')]('\x22'+_0x21d204[_0xa418('0x10')](';')+'\x22');}if(_0x36925f[_0xa418('0x18')]){handleError(_0x63309d[_0xa418('0x7f')][_0x31aae4],{'code':_0xa418('0x8b'),'message':_0x36925f[_0xa418('0x10')]()});}else{fs[_0xa418('0x8c')](_0x46099c,_0x2e651f[_0xa418('0x10')]()+'\x0a');}_0x2e651f=[];}if(!(stats[_0xa418('0x80')]%0xc8)){socket[_0xa418('0x8d')](_0xa418('0x8e')+_0x1c0d64,stats);stats[_0xa418('0x59')]=[];}}if(stopped){logger['info'](_0xa418('0x8f'));_0x31a0de[_0xa418('0x90')]();}}catch(_0x33d7e6){handleError(_0x63309d['data'][_0x31aae4],{'code':_0xa418('0x91'),'message':_0x33d7e6[_0xa418('0x57')]});logger[_0xa418('0x56')](_0xa418('0x92'),_0x33d7e6[_0xa418('0x57')]);}},'complete':function(){try{var _0x362a80=[];var _0x133c63=[];var _0x4a7234=_0xa418('0x30');if(_0x37c8fc[_0xa418('0x93')]&&_0x37c8fc[_0xa418('0x93')][_0xa418('0x18')]){_0x4a7234=_0xa418('0x94')+_0x1c0d64;_0x362a80[_0xa418('0x19')](_0xa418('0x95')+_0x4a7234+_0xa418('0x96'));}tmp_campaigns=_0xa418('0x97')+_0x1c0d64;tmp_voice_queues='voice_queues_'+_0x1c0d64;_0x133c63['push'](_0xa418('0x95')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x133c63['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xa418('0x98'));BPromise['each'](_0x133c63,handleTZQuery)['then'](function(_0x24cc17){updateTzCampaigns(_0x37c8fc[_0xa418('0x2c')])[_0xa418('0x17')](function(_0x4d073f){updateTzVoiceQueues(_0x37c8fc[_0xa418('0x2c')])[_0xa418('0x17')](function(_0x2a3994){if(hasTZ)_0x59a0d5=_0x59a0d5[_0xa418('0x89')](_0xa418('0x6b'),_0xa418('0x99'));var _0x2edef5=util[_0xa418('0xb')](_0xa418('0x9a'),_0x46099c,_0x4a7234,_0x59a0d5,_0x37c8fc[_0xa418('0x2c')],_0x37c8fc['CompanyId']||null,NOW,NOW);if(_[_0xa418('0x1c')](_0x35462b['scheduledat'])){_0x2edef5+=',\x20scheduledAt\x20=\x20NOW()';}_0x362a80[_0xa418('0x19')](_0x2edef5);if(_0x37c8fc['duplicates']&&_0x37c8fc[_0xa418('0x93')][_0xa418('0x18')]){_0x362a80[_0xa418('0x19')](insertCmContact(_0x37c8fc['ListId'],_0x4a7234,_0x37c8fc[_0xa418('0x93')],_0x35462b));_0x362a80[_0xa418('0x19')](_0xa418('0x9b')+_0x4a7234+';');}BPromise[_0xa418('0x9c')](_0x362a80,handleQuery)[_0xa418('0x17')](function(_0x118fcb){BPromise[_0xa418('0x1a')]([handleAdditionalPhones()])[_0xa418('0x17')](function(){_0x362a80=[];for(var _0x37c317=0x0;_0x37c317\x20\x20');}var _0x38b30e=path[_0xa418('0x10')](config['root'],_0xa418('0x76'),process['argv'][0x2]);if(!fs[_0xa418('0xa8')](_0x38b30e)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3c7edc={};try{_0x3c7edc=JSON[_0xa418('0x7d')](process[_0xa418('0xa7')][0x3]);if(!_0x3c7edc['binding']){throw new Error(_0xa418('0xa9'));}if(!_0x3c7edc['binding'][_0xa418('0xe')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x3c7edc[_0xa418('0x72')]['firstName']){throw new Error(_0xa418('0xaa'));}var _0x4c95db=0x0;if(_0x3c7edc[_0xa418('0x72')][_0xa418('0x2f')]){_0x4c95db=0x1;}if(!_0x3c7edc['ListId']){throw new Error(_0xa418('0xab'));}}catch(_0x2cc5d1){throw new Error(_0xa418('0xac'));}var _0xf2e236=[];try{_0xf2e236=_[_0xa418('0xad')](JSON[_0xa418('0x7d')](process['argv'][0x4]),'id');}catch(_0x350fda){logger['info'](_0xa418('0xae'));}main(_0x38b30e,_0x3c7edc,_0xf2e236,_0x4c95db);}validate();process['on'](_0xa418('0xaf'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x38da=['cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','fields','join','field','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','UserId','.CmListId','cm_hopper_black','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','set','dialTimezone','main','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','keys','includes','header','ContactItemType','name','writeFileSync','parse','createReadStream','data','rows','find','_description','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','utcOffset','firstName','hasOwnProperty','replace','itemTypeId','trim','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(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','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns','finish','affectedRows','unlink','root','argv','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','findOne','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone'];(function(_0x247064,_0x471718){var _0x287b72=function(_0x857a3e){while(--_0x857a3e){_0x247064['push'](_0x247064['shift']());}};_0x287b72(++_0x471718);}(_0x38da,0x90));var _0xa38d=function(_0xc5cd18,_0x251c74){_0xc5cd18=_0xc5cd18-0x0;var _0x37a5cb=_0x38da[_0xc5cd18];return _0x37a5cb;};'use strict';var fs=require('fs');var path=require(_0xa38d('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0xa38d('0x1'));var BPromise=require(_0xa38d('0x2'));var moment=require(_0xa38d('0x3'));var squel=require(_0xa38d('0x4'));var Redis=require(_0xa38d('0x5'));var db=require(_0xa38d('0x6'))['db'];var config=require(_0xa38d('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0xa38d('0x8'))(_0xa38d('0x9'));config[_0xa38d('0xa')]=_[_0xa38d('0xb')](config[_0xa38d('0xa')],{'host':_0xa38d('0xc'),'port':0x18eb});var socket=require(_0xa38d('0xd'))(new Redis(config[_0xa38d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xa38d('0xe')](_0xa38d('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xa38d('0xe')](_0xa38d('0xf'));function isEmail(_0x1c426f){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))*$/[_0xa38d('0x10')](_0x1c426f);}function selectNotIn(_0x462a71,_0x1ad0b3,_0x14024f,_0x3a70a0,_0x3592bb){return squel[_0xa38d('0x11')]()['field'](_0xa38d('0x12'))[_0xa38d('0x13')](_0x3a70a0)['join'](_0x1ad0b3,null,_0x1ad0b3+_0xa38d('0x14')+_0x3a70a0+'.'+_0x14024f)[_0xa38d('0x15')](_0x3a70a0+'.'+_0x14024f+_0xa38d('0x16')+_0x462a71+'.'+_0x14024f)[_0xa38d('0x15')](_0x1ad0b3+'.dialCheckDuplicateType\x20IN\x20('+_0x3592bb['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x323054,_0x52532e){promisesAdditionalPhones=[];return db[_0xa38d('0x17')][_0xa38d('0x18')]({'raw':!![],'attributes':['id',_0xa38d('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa38d('0x1a')](function(_0x4557d8){if(_0x4557d8!==null){var _0x7cc723=[];for(var _0x4bafed=0x0;_0x4bafed<_0x4557d8[_0xa38d('0x1b')];_0x4bafed++){var _0x4e25b1=_0x4557d8[_0x4bafed];_0x7cc723[_0xa38d('0x1c')](insertAdditionalPhones(_0x4e25b1));}}Promise[_0xa38d('0x1d')](_0x7cc723)['then'](function(){_0x323054({'val':0x1});});});});}function insertAdditionalPhones(_0x367ea4){return new Promise(function(_0x36f154,_0x43dccd){var _0x1b6c5a=_0x367ea4[_0xa38d('0x19')];var _0x1dd3e7=_0x1b6c5a[_0xa38d('0x1e')](';');var _0x43abd2=[];orderBy=0x0;for(var _0x435945=0x0;_0x435945<_0x1dd3e7[_0xa38d('0x1b')];_0x435945++){_0x43abd2[_0xa38d('0x1c')](splitAdditionalPhone(_0x367ea4['id'],_0x1dd3e7[_0x435945]));}Promise[_0xa38d('0x1d')](_0x43abd2)[_0xa38d('0x1a')](function(){_0x36f154({'val':_0x1dd3e7[_0xa38d('0x1b')]});});});}function splitAdditionalPhone(_0x3cc249,_0x408aa6){return new Promise(function(_0x13976e,_0x55c493){var _0x4e322f=_0x408aa6['split'](':');var _0x3c4852=_0x4e322f[0x0];var _0x4c4984=_0x4e322f[0x1];if(!_[_0xa38d('0x1f')](_0x4c4984)){var _0x4c36bd=_0x4c4984[_0xa38d('0x1e')]('|');var _0x512639=[];for(var _0x3e68a0=0x0;_0x3e68a0<_0x4c36bd[_0xa38d('0x1b')];_0x3e68a0++){if(_0x4c36bd[_0x3e68a0]!==''){var _0x5abf83=_[_0xa38d('0x20')](promisesAdditionalPhones,{'contactId':_0x3cc249,'phone':_0x4c36bd[_0x3e68a0]});if(_0x5abf83[_0xa38d('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xa38d('0x1c')]({'contactId':_0x3cc249,'contactTypeId':_0x3c4852,'phone':_0x4c36bd[_0x3e68a0],'orderBy':orderBy});}}}_0x13976e({'ok':0x1});}else _0x13976e({'res':0x0});});}function createAdditionalPhone(_0x294a27,_0x2df2f1,_0x565b93,_0x13f5f2){var _0x312c6d='';var _0xaebcd8='';var _0xdbe215=_0x565b93[_0xa38d('0x1e')]('§');_0x312c6d=_0xdbe215[0x0];if(_0xdbe215[_0xa38d('0x1b')]==0x2)_0xaebcd8=_0xdbe215[0x1];return new Promise(function(_0x254f41,_0x20ec2d){return db['CmContactHasItem'][_0xa38d('0x21')]({'where':{'CmContactId':_0x294a27,'item':_0x312c6d}})[_0xa38d('0x1a')](function(_0xd08c89){if(_0xd08c89){return db[_0xa38d('0x22')][_0xa38d('0x23')]({'ItemTypeId':_0x2df2f1,'description':_0xaebcd8,'OrderBy':_0x13f5f2},{'where':{'CmContactId':_0x294a27,'item':_0x312c6d}})[_0xa38d('0x1a')](function(_0x2f97c1){_0x254f41({'res':_0xa38d('0x24')});});}else{return db['CmContactHasItem'][_0xa38d('0x25')]({'CmContactId':_0x294a27,'item':_0x312c6d,'description':_0xaebcd8,'ItemTypeId':_0x2df2f1,'OrderBy':_0x13f5f2,'ItemClass':_0xa38d('0x26')})[_0xa38d('0x1a')](function(_0x58011e){_0x254f41({'res':_0xa38d('0x27')});});}});});}function insertCmHopper(_0x5d6a9b,_0x50f755,_0x49bfc2,_0x32d6a6,_0x5f37a5){var _0x23ef6=[_0xa38d('0x28'),'cm_contacts.scheduledat',_0xa38d('0x29'),_0xa38d('0x2a'),_0x50f755+'.'+_0x32d6a6,_0xa38d('0x2b'),_0xa38d('0x2c'),'cm_contacts.priority',_0xa38d('0x2d'),'\x22'+_0x5f37a5+'\x22'];return squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')]('cm_hopper')[_0xa38d('0x30')]([_0xa38d('0x12'),'scheduledat',_0xa38d('0x31'),_0xa38d('0x32'),_0x32d6a6,_0xa38d('0x33'),_0xa38d('0x34'),_0xa38d('0x35'),'UserId',_0xa38d('0x36')],squel[_0xa38d('0x11')]()['fields'](_0x23ef6)[_0xa38d('0x13')](_0x50f755)['join'](_0xa38d('0x37'),null,_0xa38d('0x38')+_0x50f755+'.CmListId')['join'](_0x49bfc2,null,_0x49bfc2+_0xa38d('0x14')+_0x50f755+'.'+_0x32d6a6)[_0xa38d('0x15')](_0x50f755+_0xa38d('0x39'),_0x5d6a9b)['where'](_0xa38d('0x3a'),NOW)['where'](_0xa38d('0x3b'),selectNotIn(_0x50f755,_0x49bfc2,_0x32d6a6,_0xa38d('0x3c'),[_0xa38d('0x3d'),_0xa38d('0x3e')]))['where'](_0xa38d('0x3b'),selectNotIn(_0x50f755,_0x49bfc2,_0x32d6a6,_0xa38d('0x3c'),['\x22always\x22'])))[_0xa38d('0x3f')]();}function insertCmHopperBlack(_0xd40c97,_0x2320f0,_0x5ae39d,_0x58f49c){var _0x1965bb=[_0xa38d('0x28'),_0xa38d('0x29'),_0xa38d('0x2a'),_0x2320f0+'.'+_0x58f49c,_0xa38d('0x2b'),_0xa38d('0x2c')];return squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')]('cm_hopper_black')[_0xa38d('0x30')]([_0xa38d('0x12'),_0xa38d('0x31'),'ListId',_0x58f49c,'createdAt','updatedAt'],squel[_0xa38d('0x11')]()[_0xa38d('0x40')](_0x1965bb)[_0xa38d('0x13')](_0x2320f0)['join'](_0xa38d('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x2320f0+'.CmListId')[_0xa38d('0x41')](_0x5ae39d,null,_0x5ae39d+'.id\x20=\x20'+_0x2320f0+'.'+_0x58f49c)['where'](_0x2320f0+_0xa38d('0x39'),_0xd40c97)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xa38d('0x3b'),squel[_0xa38d('0x11')]()[_0xa38d('0x42')](_0xa38d('0x12'))['from']('cm_hopper_black')[_0xa38d('0x15')]('ListId\x20=\x20?',_0xd40c97)[_0xa38d('0x15')](_0x58f49c+_0xa38d('0x16')+_0x2320f0+'.'+_0x58f49c)))[_0xa38d('0x3f')]();}function insertTzCmHopper(_0x5123b7,_0x20d4b4,_0x2bd40a,_0xe10aac,_0x2bf7b8,_0x22dc6e){var _0x436e8c=[_0xa38d('0x28'),_0xa38d('0x43')+_0x22dc6e+_0xa38d('0x44'),'cm_contacts.id',_0xa38d('0x2a'),_0x20d4b4+'.'+_0xe10aac,'cm_contacts.createdAt',_0xa38d('0x2c'),_0xa38d('0x45'),_0xa38d('0x2d'),'\x22'+_0x2bf7b8+'\x22'];var _0x3d3495=squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')]('cm_hopper')['fromQuery']([_0xa38d('0x12'),'scheduledat','ContactId',_0xa38d('0x32'),_0xe10aac,_0xa38d('0x33'),_0xa38d('0x34'),_0xa38d('0x35'),_0xa38d('0x46'),_0xa38d('0x36')],squel[_0xa38d('0x11')]()[_0xa38d('0x40')](_0x436e8c)['from'](_0x20d4b4)['join'](_0xa38d('0x37'),null,_0xa38d('0x38')+_0x20d4b4+_0xa38d('0x47'))['join'](_0x2bd40a,null,_0x2bd40a+'.id\x20=\x20'+_0x20d4b4+'.'+_0xe10aac)[_0xa38d('0x41')](_0x22dc6e,null,_0x22dc6e+_0xa38d('0x14')+_0x20d4b4+'.'+_0xe10aac)[_0xa38d('0x15')](_0x20d4b4+_0xa38d('0x39'),_0x5123b7)[_0xa38d('0x15')](_0xa38d('0x3a'),NOW)[_0xa38d('0x15')](_0xa38d('0x3b'),selectNotIn(_0x20d4b4,_0x2bd40a,_0xe10aac,'cm_hopper',[_0xa38d('0x3d'),_0xa38d('0x3e')]))[_0xa38d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x20d4b4,_0x2bd40a,_0xe10aac,_0xa38d('0x3c'),[_0xa38d('0x3d')])))['toString']();return _0x3d3495;}function insertTzCmHopperBlack(_0x13eb0c,_0x19777f,_0x17ec71,_0xb839c8){var _0xb808d4=['cm_contacts.phone',_0xa38d('0x29'),_0xa38d('0x2a'),_0x19777f+'.'+_0xb839c8,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')]('cm_hopper_black')[_0xa38d('0x30')]([_0xa38d('0x12'),_0xa38d('0x31'),_0xa38d('0x32'),_0xb839c8,'createdAt',_0xa38d('0x34')],squel[_0xa38d('0x11')]()[_0xa38d('0x40')](_0xb808d4)[_0xa38d('0x13')](_0x19777f)[_0xa38d('0x41')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x19777f+_0xa38d('0x47'))['join'](_0x17ec71,null,_0x17ec71+_0xa38d('0x14')+_0x19777f+'.'+_0xb839c8)['where'](_0x19777f+_0xa38d('0x39'),_0x13eb0c)[_0xa38d('0x15')](_0xa38d('0x3a'),NOW)[_0xa38d('0x15')](_0xa38d('0x3b'),squel[_0xa38d('0x11')]()[_0xa38d('0x42')](_0xa38d('0x12'))[_0xa38d('0x13')](_0xa38d('0x48'))[_0xa38d('0x15')](_0xa38d('0x49'),_0x13eb0c)[_0xa38d('0x15')](_0xb839c8+'\x20=\x20'+_0x19777f+'.'+_0xb839c8)))[_0xa38d('0x3f')]();}function insertCmHopperAdditionalPhones(_0x360fe3){var _0x5486a4=[_0xa38d('0x4a'),'cm_contact_has_items.item',_0xa38d('0x4b'),_0xa38d('0x4c'),_0xa38d('0x4d')];return squel['insert']()['into'](_0xa38d('0x4e'))[_0xa38d('0x30')]([_0xa38d('0x4f'),_0xa38d('0x12'),_0xa38d('0x50'),'createdAt',_0xa38d('0x34')],squel[_0xa38d('0x11')]()[_0xa38d('0x40')](_0x5486a4)[_0xa38d('0x13')]('cm_hopper')['join'](_0xa38d('0x37'),null,_0xa38d('0x51'))[_0xa38d('0x41')](_0xa38d('0x52'),null,_0xa38d('0x53'))[_0xa38d('0x15')](_0xa38d('0x54'),_0x360fe3)[_0xa38d('0x15')](_0xa38d('0x3a'),NOW))['toString']();}function insertCmContact(_0x3a2a50,_0x2e041b,_0x41cfff,_0x4849cb){var _0x52a168=_[_0xa38d('0x55')](_['keys'](_0x4849cb),[_0xa38d('0x32'),_0xa38d('0x56'),_0xa38d('0x33'),_0xa38d('0x34'),_0xa38d('0x57')]);return squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')](_0xa38d('0x37'))[_0xa38d('0x30')](_0x52a168,squel[_0xa38d('0x11')]()[_0xa38d('0x40')](_0x52a168)['from'](_0x2e041b)['where']('('+_0x41cfff[_0xa38d('0x41')](',')+')\x20NOT\x20IN\x20?',squel['select']()['fields'](_0x41cfff)[_0xa38d('0x13')](_0xa38d('0x37'))[_0xa38d('0x15')]('ListId\x20=\x20?',_0x3a2a50)[_0xa38d('0x15')](_0xa38d('0x58')))['where'](_0xa38d('0x59'),squel[_0xa38d('0x11')]()[_0xa38d('0x42')](_0xa38d('0x5a'),'min_id')[_0xa38d('0x13')](_0x2e041b)['group'](_0x41cfff['join'](','))))[_0xa38d('0x3f')]();}function handleStop(){logger[_0xa38d('0x5b')](_0xa38d('0x5c'));stopped=!![];}function handleUncaughtException(_0x4a367e){logger[_0xa38d('0x5d')](_0x4a367e[_0xa38d('0x5e')]);process[_0xa38d('0x5f')](0x1);}function handleError(_0x2a8345,_0x365633){stats[_0xa38d('0x60')][_0xa38d('0x1c')]({'name':_0x365633[_0xa38d('0x61')],'message':_0x365633[_0xa38d('0x5e')],'row':_0x2a8345});}function handleQuery(_0x2be4fd){logger[_0xa38d('0x5b')](_0x2be4fd);return db[_0xa38d('0x62')][_0xa38d('0x63')](_0x2be4fd)[_0xa38d('0x64')](function(_0x1ed54b){results[_0xa38d('0x1c')](_0x1ed54b);})[_0xa38d('0x65')](function(_0x2678c4){logger['error'](_0x2678c4[_0xa38d('0x5e')]);});}function updateTzCampaigns(_0x4b97a4){return new Promise(function(_0xce8e3a,_0x4c3705){var _0x496c6f=squel[_0xa38d('0x11')]()[_0xa38d('0x40')]([_0xa38d('0x66'),_0xa38d('0x67')])['from']('campaigns')[_0xa38d('0x41')](_0xa38d('0x68'),null,_0xa38d('0x69'))[_0xa38d('0x15')](_0xa38d('0x6a')+_0x4b97a4);db[_0xa38d('0x62')][_0xa38d('0x63')](_0x496c6f[_0xa38d('0x3f')]())[_0xa38d('0x64')](function(_0x2cce30){var _0x33477c=[];for(var _0x42b712=0x0;_0x42b712<_0x2cce30[_0xa38d('0x1b')];_0x42b712++){_0x33477c[_0xa38d('0x1c')](getTimezoneData(_0x2cce30[_0x42b712],tmp_campaigns));}BPromise[_0xa38d('0x1d')](_0x33477c)[_0xa38d('0x1a')](function(){_0xce8e3a({'val':0x1});});})[_0xa38d('0x65')](function(_0x25f124){logger[_0xa38d('0x5d')](_0x25f124[_0xa38d('0x5e')]);_0xce8e3a({'val':0x0});});});}function updateTzVoiceQueues(_0x5efa7d){return new Promise(function(_0x110467,_0x5699e5){var _0x30c8cf=squel['select']()[_0xa38d('0x40')]([_0xa38d('0x6b'),_0xa38d('0x6c')])[_0xa38d('0x13')](_0xa38d('0x6d'))['join'](_0xa38d('0x6e'),null,_0xa38d('0x6f'))[_0xa38d('0x15')](_0xa38d('0x70')+_0x5efa7d);db[_0xa38d('0x62')]['query'](_0x30c8cf['toString']())[_0xa38d('0x64')](function(_0x25d073){var _0x26ab9c=[];for(var _0x3efd99=0x0;_0x3efd99<_0x25d073[_0xa38d('0x1b')];_0x3efd99++){_0x26ab9c[_0xa38d('0x1c')](getTimezoneData(_0x25d073[_0x3efd99],tmp_voice_queues));}BPromise[_0xa38d('0x1d')](_0x26ab9c)['then'](function(){_0x110467({'val':0x1});});})[_0xa38d('0x65')](function(_0x1bc1a5){logger[_0xa38d('0x5d')](_0x1bc1a5['message']);_0x110467({'val':0x0});});});}function getTimezoneData(_0xb107e6,_0xfc9d61){return new Promise(function(_0x5c2b68,_0x1857f9){var _0x5b6046=shared['timezones'];var _0x565ef1=_0x5b6046[_0xb107e6['dialTimezone']];if(_[_0xa38d('0x1f')](_0x565ef1)){_0x5c2b68({'ret':0x1});}else{var _0x33bcc8=_0x565ef1['utcOffset'];var _0x55411b=squel[_0xa38d('0x2e')]()[_0xa38d('0x2f')](_0xfc9d61)[_0xa38d('0x71')]('id',_0xb107e6['id'])[_0xa38d('0x71')]('offset',_0x33bcc8)[_0xa38d('0x71')](_0xa38d('0x72'),_0xb107e6['dialTimezone'])[_0xa38d('0x3f')]();return db[_0xa38d('0x62')][_0xa38d('0x63')](_0x55411b)[_0xa38d('0x64')](function(_0x390732){_0x5c2b68({'ret':0x1});})[_0xa38d('0x65')](function(_0x4f9542){logger[_0xa38d('0x5d')](_0x4f9542[_0xa38d('0x5e')]);_0x1857f9({'ret':0x1});});}});}function handleTZQuery(_0x551b4f){logger[_0xa38d('0x5b')](_0x551b4f);return db['sequelize'][_0xa38d('0x63')](_0x551b4f)[_0xa38d('0x64')](function(_0x532838){})['catch'](function(_0xfcf76b){logger[_0xa38d('0x5d')](_0xfcf76b['message']);});}function main(_0x704ea1,_0x49baba,_0x3fabb0,_0x391ff4){logger['info'](_0xa38d('0x73'),_0x704ea1,JSON['stringify'](_0x49baba));process[_0xa38d('0x74')](_0xa38d('0x75'));var _0x322161=_0x49baba[_0xa38d('0x76')];var _0x5b1eb0=_[_0xa38d('0x77')](_0x322161);var _0x3638ab=_0x49baba[_0xa38d('0x78')];var _0x3e3ca9=path['join'](config['root'],_0xa38d('0x79'),_0x3638ab+_0xa38d('0x7a'));hasTZ=_[_0xa38d('0x7b')](_0x322161)[_0xa38d('0x7c')](_0xa38d('0x72'));var _0x1896f3=_[_0xa38d('0x7b')](_0x322161)['join']();logger[_0xa38d('0x5b')](_0xa38d('0x7d'),_0x1896f3);db[_0xa38d('0x7e')][_0xa38d('0x18')]({'raw':!![],'attributes':['id',_0xa38d('0x7f')]})[_0xa38d('0x1a')](function(_0x3d6538){for(var _0xab4974=0x0;_0xab4974<_0x3d6538[_0xa38d('0x1b')];_0xab4974++){if(_0x3d6538[_0xab4974]['name']in _0x322161){contactItemTypes['push'](_0x3d6538[_0xab4974]);delete _0x5b1eb0[_0x3d6538[_0xab4974][_0xa38d('0x7f')]];hasAdditionalPhones=!![];}for(var _0x3143a3 in _0x322161){if(_0x3d6538[_0xab4974][_0xa38d('0x7f')]+'_description'===_0x3143a3){phoneDescriptions[_0xa38d('0x1c')]({'itemTypeId':_0x3d6538[_0xab4974]['id'],'description':_0x3143a3});delete _0x5b1eb0[_0x3143a3];}}}if(hasAdditionalPhones)_0x5b1eb0[_0xa38d('0x19')]='';var _0x36b5ec=_['keys'](_0x5b1eb0)['join']();logger[_0xa38d('0x5b')](_0xa38d('0x7d'),_0x36b5ec);fs[_0xa38d('0x80')](_0x3e3ca9,_0x36b5ec+'\x0a');Papa[_0xa38d('0x81')](fs[_0xa38d('0x82')](_0x704ea1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x467c54,_0x2a23cd){try{for(var _0x4b1e38=0x0,_0x4f2114=[];_0x4b1e38<_0x467c54[_0xa38d('0x83')][_0xa38d('0x1b')];_0x4b1e38++){stats[_0xa38d('0x84')]+=0x1;if(_0x467c54['errors'][_0x4b1e38]){handleError(_0x467c54[_0xa38d('0x83')][_0x4b1e38],_0x467c54[_0xa38d('0x60')][_0x4b1e38]);}else{var _0x11b1cd=[];var _0x5c44a5=[];var _0x5dd5ff={};for(var _0x52b038 in _0x322161){let _0x286c69=contactItemTypes[_0xa38d('0x85')](_0x32c322=>_0x32c322[_0xa38d('0x7f')]===_0x52b038);let _0x5fe711=contactItemTypes[_0xa38d('0x85')](_0x2f45e8=>_0x2f45e8[_0xa38d('0x7f')]+_0xa38d('0x86')===_0x52b038);if(_[_0xa38d('0x1f')](_0x286c69)&&_[_0xa38d('0x1f')](_0x5fe711)){if(_0x322161['hasOwnProperty'](_0x52b038)){if(_0x467c54[_0xa38d('0x83')][_0x4b1e38][_0x322161[_0x52b038]]){var _0x832ab4=_['trim'](_0x467c54[_0xa38d('0x83')][_0x4b1e38][_0x322161[_0x52b038]]['replace'](/"/g,'\x27'));switch(_0x52b038){case _0xa38d('0x87'):var _0x5bcdef=moment(_0x832ab4,_0xa38d('0xf'),!![]);if(_0x5bcdef['isValid']()){_0x4f2114[_0xa38d('0x1c')]('\x22'+_0x832ab4+'\x22');}else{_0x11b1cd[_0xa38d('0x1c')](_0xa38d('0x88'));}break;case'priority':var _0x46d72e=parseInt(_0x832ab4);_0x832ab4=_[_0xa38d('0x89')](_0x46d72e)||_0x46d72e<0x0||_0x46d72e>0x4?_0x391ff4?0x3:0x2:_0x46d72e;_0x4f2114[_0xa38d('0x1c')]('\x22'+_0x832ab4+'\x22');break;case'UserId':var _0x291378=parseInt(_0x832ab4);if(_['isNumber'](_0x291378)&&_['includes'](_0x3fabb0,_0x291378)){_0x4f2114[_0xa38d('0x1c')]('\x22'+_0x291378+'\x22');}else{_0x11b1cd[_0xa38d('0x1c')](_0xa38d('0x8a'));}break;case'email':if(isEmail(_0x832ab4)){_0x4f2114[_0xa38d('0x1c')]('\x22'+_0x832ab4+'\x22');}else{_0x11b1cd['push'](_0xa38d('0x8b'));}break;case'dateOfBirth':var _0x2bb53e=moment(_0x832ab4,_0xa38d('0x8c'),!![]);if(_0x2bb53e[_0xa38d('0x8d')]()){_0x4f2114['push']('\x22'+_0x832ab4+'\x22');}else{_0x11b1cd['push'](_0xa38d('0x8e'));}break;case _0xa38d('0x72'):var _0x4ac936=shared['timezones'];var _0x5eef7a=_0x4ac936[_0x832ab4];if(!_['isNil'](_0x5eef7a)){var _0x23eafb=_0x5eef7a[_0xa38d('0x8f')];_0x4f2114['push']('\x22'+_0x832ab4+'\x22');_0x4f2114[_0xa38d('0x1c')]('\x22'+_0x23eafb+'\x22');}break;default:_0x4f2114['push']('\x22'+_0x832ab4+'\x22');}}else{switch(_0x52b038){case _0xa38d('0x90'):case'phone':_0x11b1cd[_0xa38d('0x1c')](_0x52b038+'\x20not\x20specified');break;default:_0x4f2114[_0xa38d('0x1c')]('\x22\x22');}}}}else{var _0x49d6b0='';if(!_[_0xa38d('0x1f')](_0x286c69)){if(!_0x5dd5ff[_0xa38d('0x91')](_0x286c69['id'])){if(!_[_0xa38d('0x1f')](_0x467c54[_0xa38d('0x83')][_0x4b1e38][_0x322161[_0x52b038]])){var _0x832ab4=_['trim'](_0x467c54[_0xa38d('0x83')][_0x4b1e38][_0x322161[_0x52b038]][_0xa38d('0x92')](/"/g,'\x27'));var _0x4efade=phoneDescriptions[_0xa38d('0x85')](_0x423ba9=>_0x423ba9[_0xa38d('0x93')]===_0x286c69['id']);if(!_[_0xa38d('0x1f')](_0x4efade)){var _0x247af9=_[_0xa38d('0x94')](_0x467c54[_0xa38d('0x83')][_0x4b1e38][_0x322161[_0x4efade[_0xa38d('0x95')]]][_0xa38d('0x92')](/"/g,'\x27'));if(!_[_0xa38d('0x1f')](_0x247af9))_0x832ab4=_0x832ab4+'§'+_0x247af9;}if(_0x49d6b0=='')_0x49d6b0=_0x832ab4;else _0x49d6b0+='|'+_0x832ab4;}_0x5c44a5[_0xa38d('0x1c')](_0x286c69['id']+':'+_0x49d6b0);_0x5dd5ff[_0x286c69['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4f2114['push']('\x22'+_0x5c44a5[_0xa38d('0x41')](';')+'\x22');}if(_0x11b1cd[_0xa38d('0x1b')]){handleError(_0x467c54['data'][_0x4b1e38],{'code':'SystemRow','message':_0x11b1cd[_0xa38d('0x41')]()});}else{fs[_0xa38d('0x96')](_0x3e3ca9,_0x4f2114['join']()+'\x0a');}_0x4f2114=[];}if(!(stats[_0xa38d('0x84')]%0xc8)){socket[_0xa38d('0x97')](_0xa38d('0x98')+_0x3638ab,stats);stats[_0xa38d('0x60')]=[];}}if(stopped){logger[_0xa38d('0x5b')](_0xa38d('0x99'));_0x2a23cd[_0xa38d('0x9a')]();}}catch(_0xe99996){handleError(_0x467c54[_0xa38d('0x83')][_0x4b1e38],{'code':_0xa38d('0x9b'),'message':_0xe99996[_0xa38d('0x5e')]});logger['error'](_0xa38d('0x9c'),_0xe99996[_0xa38d('0x5e')]);}},'complete':function(){try{var _0x483623=[];var _0x5c0dec=[];var _0x2339c5=_0xa38d('0x37');if(_0x49baba[_0xa38d('0x9d')]&&_0x49baba[_0xa38d('0x9d')][_0xa38d('0x1b')]){_0x2339c5='cm_contacts_'+_0x3638ab;_0x483623[_0xa38d('0x1c')](_0xa38d('0x9e')+_0x2339c5+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xa38d('0x9f')+_0x3638ab;tmp_voice_queues=_0xa38d('0xa0')+_0x3638ab;_0x5c0dec[_0xa38d('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xa38d('0xa1'));_0x5c0dec[_0xa38d('0x1c')](_0xa38d('0x9e')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xa38d('0xa2')](_0x5c0dec,handleTZQuery)[_0xa38d('0x1a')](function(_0x83f6a8){updateTzCampaigns(_0x49baba[_0xa38d('0x32')])[_0xa38d('0x1a')](function(_0x2e2cfb){updateTzVoiceQueues(_0x49baba[_0xa38d('0x32')])[_0xa38d('0x1a')](function(_0x5cd1e0){if(hasTZ)_0x36b5ec=_0x36b5ec[_0xa38d('0x92')]('dialTimezone',_0xa38d('0xa3'));var _0x608914=util[_0xa38d('0xe')](_0xa38d('0xa4'),_0x3e3ca9,_0x2339c5,_0x36b5ec,_0x49baba[_0xa38d('0x32')],_0x49baba[_0xa38d('0x56')]||null,NOW,NOW);if(_[_0xa38d('0x1f')](_0x322161[_0xa38d('0x87')])){_0x608914+=_0xa38d('0xa5');}_0x483623[_0xa38d('0x1c')](_0x608914);if(_0x49baba[_0xa38d('0x9d')]&&_0x49baba[_0xa38d('0x9d')]['length']){_0x483623['push'](insertCmContact(_0x49baba['ListId'],_0x2339c5,_0x49baba[_0xa38d('0x9d')],_0x322161));_0x483623[_0xa38d('0x1c')](_0xa38d('0xa6')+_0x2339c5+';');}BPromise[_0xa38d('0xa2')](_0x483623,handleQuery)[_0xa38d('0x1a')](function(_0x205c9b){BPromise[_0xa38d('0x1d')]([handleAdditionalPhones()])[_0xa38d('0x1a')](function(){_0x483623=[];for(var _0xb5385d=0x0;_0xb5385d\x20\x20');}var _0x2e1c90=path['join'](config[_0xa38d('0xb0')],_0xa38d('0x79'),process[_0xa38d('0xb1')][0x2]);if(!fs['existsSync'](_0x2e1c90)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3d211f={};try{_0x3d211f=JSON['parse'](process[_0xa38d('0xb1')][0x3]);if(!_0x3d211f[_0xa38d('0x76')]){throw new Error(_0xa38d('0xb2'));}if(!_0x3d211f[_0xa38d('0x76')]['phone']){throw new Error(_0xa38d('0xb3'));}if(!_0x3d211f['binding'][_0xa38d('0x90')]){throw new Error(_0xa38d('0xb4'));}var _0x4ba233=0x0;if(_0x3d211f[_0xa38d('0x76')][_0xa38d('0x46')]){_0x4ba233=0x1;}if(!_0x3d211f[_0xa38d('0x32')]){throw new Error(_0xa38d('0xb5'));}}catch(_0x5bc48e){throw new Error(_0xa38d('0xb6'));}var _0x1e42d6=[];try{_0x1e42d6=_[_0xa38d('0xb7')](JSON[_0xa38d('0x81')](process['argv'][0x4]),'id');}catch(_0x5bbca){logger[_0xa38d('0x5b')]('No\x20agent\x20available');}main(_0x2e1c90,_0x3d211f,_0x1e42d6,_0x4ba233);}validate();process['on'](_0xa38d('0xb8'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 13b3b88..5e51052 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 _0x2b84=['\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','orderBy','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','ioredis','../../../config/environment','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','field','phone','join','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','length','isNil','AdditionalPhones','all','then','catch','error','message','split','push','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_contacts.updatedAt','ListId','select','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','query','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20'];(function(_0x4b755e,_0x4922af){var _0xa834e5=function(_0x4cc937){while(--_0x4cc937){_0x4b755e['push'](_0x4b755e['shift']());}};_0xa834e5(++_0x4922af);}(_0x2b84,0x1ed));var _0x42b8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2b84[_0x19e35c];return _0x3e1fe8;};'use strict';var fs=require('fs');var path=require(_0x42b8('0x0'));var _=require(_0x42b8('0x1'));var Papa=require('papaparse');var util=require(_0x42b8('0x2'));var BPromise=require(_0x42b8('0x3'));var moment=require(_0x42b8('0x4'));var squel=require('squel');var Redis=require(_0x42b8('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x42b8('0x6'));var logger=require('../../../config/logger')(_0x42b8('0x7'));config[_0x42b8('0x8')]=_['defaults'](config['redis'],{'host':_0x42b8('0x9'),'port':0x18eb});var socket=require(_0x42b8('0xa'))(new Redis(config[_0x42b8('0x8')]));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()[_0x42b8('0xb')](_0x42b8('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x42b8('0xb')](_0x42b8('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2a13a3){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))*$/[_0x42b8('0xe')](_0x2a13a3);}function selectNotIn(_0x1cd104,_0x3044eb,_0x296db0,_0x61c061,_0x490ea9){return squel['select']()[_0x42b8('0xf')](_0x42b8('0x10'))['from'](_0x61c061)[_0x42b8('0x11')](_0x3044eb,null,_0x3044eb+'.id\x20=\x20'+_0x61c061+'.'+_0x296db0)['where'](_0x61c061+'.'+_0x296db0+_0x42b8('0x12')+_0x1cd104+'.'+_0x296db0)[_0x42b8('0x13')](_0x3044eb+_0x42b8('0x14')+_0x490ea9[_0x42b8('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xf1fcc1,_0x57c65d){promisesAdditionalPhones=[];promisesContact=[];return db[_0x42b8('0x15')]['query'](_0x42b8('0x16')+tempTableName)['spread'](function(_0x54b74b){if(_0x54b74b!==null){var _0x45a918=[];for(var _0x1ca756=0x0;_0x1ca756<_0x54b74b[_0x42b8('0x17')];_0x1ca756++){var _0x266068=_0x54b74b[_0x1ca756];if(!_[_0x42b8('0x18')](_0x266068[_0x42b8('0x10')])){if(!_['isNil'](_0x266068[_0x42b8('0x19')]))_0x45a918['push'](insertAdditionalPhones(_0x266068));promisesContact['push']({'contact':_0x266068});}}}Promise[_0x42b8('0x1a')](_0x45a918)[_0x42b8('0x1b')](function(){_0xf1fcc1({'val':0x1});});})[_0x42b8('0x1c')](function(_0x43d71c){logger[_0x42b8('0x1d')](_0x43d71c[_0x42b8('0x1e')]);});});}function insertAdditionalPhones(_0x1b4892){return new Promise(function(_0x3dd964,_0x2a28ba){var _0x4e992b=_0x1b4892['AdditionalPhones'];if(_['isNil'](_0x4e992b))_0x2a28ba({'val':0x0});else{var _0x161446=_0x4e992b[_0x42b8('0x1f')](';');var _0x135bab=[];orderBy=0x0;for(var _0x20b35f=0x0;_0x20b35f<_0x161446['length'];_0x20b35f++){_0x135bab[_0x42b8('0x20')](splitAdditionalPhone(_0x1b4892['id'],_0x161446[_0x20b35f]));}Promise[_0x42b8('0x1a')](_0x135bab)['then'](function(){_0x3dd964({'val':_0x161446['length']});});}});}function splitAdditionalPhone(_0x328e72,_0x38d941){return new Promise(function(_0x2b36e9,_0x183bd0){var _0x33bf0a=_0x38d941['split'](':');var _0x30cde3=_0x33bf0a[0x0];var _0xa29e14=_0x33bf0a[0x1];if(_0xa29e14!==''){var _0x3685bc=_0xa29e14[_0x42b8('0x1f')]('|');var _0x37a904=[];for(var _0x48836e=0x0;_0x48836e<_0x3685bc[_0x42b8('0x17')];_0x48836e++){if(_0x3685bc[_0x48836e]!==''){var _0x2a50aa=_['filter'](promisesAdditionalPhones,{'contactId':_0x328e72,'phone':_0x3685bc[_0x48836e]});if(_0x2a50aa[_0x42b8('0x17')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x328e72,'contactTypeId':_0x30cde3,'phone':_0x3685bc[_0x48836e],'orderBy':orderBy});}}}_0x2b36e9({'ok':0x1});}else _0x2b36e9({'res':0x0});});}function createAdditionalPhone(_0x1fd893,_0x124aef,_0x59dc05,_0x42cd34){var _0x47b462='';var _0x31ef39='';var _0x134bee=_0x59dc05[_0x42b8('0x1f')]('§');_0x47b462=_0x134bee[0x0];if(_0x134bee['length']==0x2)_0x31ef39=_0x134bee[0x1];return new Promise(function(_0x1a1604,_0x2dcfc8){return db[_0x42b8('0x21')][_0x42b8('0x22')]({'where':{'CmContactId':_0x1fd893,'item':_0x47b462}})[_0x42b8('0x1b')](function(_0x453227){if(_0x453227){return db[_0x42b8('0x21')][_0x42b8('0x23')]({'ItemTypeId':_0x124aef,'description':_0x31ef39,'OrderBy':_0x42cd34},{'where':{'CmContactId':_0x1fd893,'item':_0x47b462}})[_0x42b8('0x1b')](function(_0x3f7cf4){_0x1a1604({'res':_0x42b8('0x24')});});}else{return db['CmContactHasItem'][_0x42b8('0x25')]({'CmContactId':_0x1fd893,'item':_0x47b462,'ItemTypeId':_0x124aef,'description':_0x31ef39,'OrderBy':_0x42cd34,'ItemClass':_0x42b8('0x26')})['then'](function(_0x2a39b0){_0x1a1604({'res':_0x42b8('0x27')});});}});});}function updateContact(_0xa50343){return new Promise(function(_0x32bf1f,_0x4f36f1){var _0x2662bf=_0xa50343['id'];delete _0xa50343['id'];return db['CmContact'][_0x42b8('0x23')](_0xa50343,{'where':{'id':_0x2662bf}})[_0x42b8('0x1b')](function(_0x5c9255){updatedRows+=0x1;return db[_0x42b8('0x28')][_0x42b8('0x23')]({'phone':_0xa50343[_0x42b8('0x10')]},{'where':{'ContactId':_0x2662bf}})[_0x42b8('0x1b')](function(_0x369235){_0x32bf1f({'ret':'OK'});});});});}function insertCmHopper(_0x10f8c4,_0x227f4e,_0x51e039,_0x4ea166,_0xcae985){var _0x49d73d=['cm_contacts.phone',_0x42b8('0x29'),_0x42b8('0x2a'),_0x42b8('0x2b'),_0x227f4e+'.'+_0x4ea166,_0x42b8('0x2c'),'cm_contacts.updatedAt',_0x42b8('0x2d'),'cm_contacts.UserId','\x22'+_0xcae985+'\x22'];return squel[_0x42b8('0x2e')]()[_0x42b8('0x2f')](_0x42b8('0x30'))[_0x42b8('0x31')]([_0x42b8('0x10'),_0x42b8('0x32'),_0x42b8('0x33'),'ListId',_0x4ea166,_0x42b8('0x34'),_0x42b8('0x35'),_0x42b8('0x36'),'UserId',_0x42b8('0x37')],squel['select']()[_0x42b8('0x38')](_0x49d73d)[_0x42b8('0x39')](_0x227f4e)['join'](_0x42b8('0x3a'),null,_0x42b8('0x3b')+_0x227f4e+_0x42b8('0x3c'))[_0x42b8('0x11')](_0x51e039,null,_0x51e039+_0x42b8('0x3d')+_0x227f4e+'.'+_0x4ea166)[_0x42b8('0x13')](_0x227f4e+_0x42b8('0x3e'),_0x10f8c4)[_0x42b8('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x42b8('0x13')](_0x42b8('0x3f'),selectNotIn(_0x227f4e,_0x51e039,_0x4ea166,'cm_hopper',[_0x42b8('0x40'),_0x42b8('0x41')]))[_0x42b8('0x13')](_0x42b8('0x3f'),selectNotIn(_0x227f4e,_0x51e039,_0x4ea166,'cm_hopper',[_0x42b8('0x40')])))[_0x42b8('0x42')]();}function insertCmHopperBlack(_0x1167fd,_0x3e3508,_0x424cb8,_0x5ded87){var _0x37b11e=[_0x42b8('0x43'),_0x42b8('0x2a'),_0x42b8('0x2b'),_0x3e3508+'.'+_0x5ded87,'cm_contacts.createdAt',_0x42b8('0x44')];return squel[_0x42b8('0x2e')]()[_0x42b8('0x2f')]('cm_hopper_black')['fromQuery']([_0x42b8('0x10'),_0x42b8('0x33'),_0x42b8('0x45'),_0x5ded87,_0x42b8('0x34'),_0x42b8('0x35')],squel[_0x42b8('0x46')]()[_0x42b8('0x38')](_0x37b11e)[_0x42b8('0x39')](_0x3e3508)[_0x42b8('0x11')](_0x42b8('0x3a'),null,'cm_contacts.ListId\x20=\x20'+_0x3e3508+_0x42b8('0x3c'))[_0x42b8('0x11')](_0x424cb8,null,_0x424cb8+'.id\x20=\x20'+_0x3e3508+'.'+_0x5ded87)['where'](_0x3e3508+'.CmListId\x20=\x20?',_0x1167fd)['where'](_0x42b8('0x47'),NOW)[_0x42b8('0x13')](_0x42b8('0x3f'),squel[_0x42b8('0x46')]()[_0x42b8('0xf')](_0x42b8('0x10'))['from'](_0x42b8('0x48'))['where'](_0x42b8('0x49'),_0x1167fd)[_0x42b8('0x13')](_0x5ded87+'\x20=\x20?',_0x3e3508+'.'+_0x5ded87)))[_0x42b8('0x42')]();}function insertCmHopperAdditionalPhones(_0x3aad36){var _0x543ed5=['cm_hopper.id',_0x42b8('0x4a'),_0x42b8('0x4b'),_0x42b8('0x4c'),_0x42b8('0x4d')];return squel[_0x42b8('0x2e')]()[_0x42b8('0x2f')](_0x42b8('0x4e'))[_0x42b8('0x31')](['CmHopperId',_0x42b8('0x10'),_0x42b8('0x4f'),'createdAt',_0x42b8('0x35')],squel[_0x42b8('0x46')]()['fields'](_0x543ed5)[_0x42b8('0x39')]('cm_hopper')[_0x42b8('0x11')](_0x42b8('0x3a'),null,_0x42b8('0x50'))['join'](_0x42b8('0x51'),null,_0x42b8('0x52'))[_0x42b8('0x13')](_0x42b8('0x53'),_0x3aad36)['where'](_0x42b8('0x47'),NOW))['toString']();}function insertCmContact(_0x353511,_0x34f154,_0x544b2a,_0x2667f5){var _0x258e95=_[_0x42b8('0x54')](_[_0x42b8('0x55')](_0x2667f5),[_0x42b8('0x45'),'CompanyId',_0x42b8('0x34'),'updatedAt']);return squel[_0x42b8('0x2e')]()['into'](_0x42b8('0x3a'))[_0x42b8('0x31')](_0x258e95,squel[_0x42b8('0x46')]()[_0x42b8('0x38')](_0x258e95)[_0x42b8('0x39')](_0x34f154)[_0x42b8('0x13')]('('+_0x544b2a['join'](',')+_0x42b8('0x56'),squel[_0x42b8('0x46')]()['fields'](_0x544b2a)[_0x42b8('0x39')](_0x42b8('0x3a'))[_0x42b8('0x13')]('ListId\x20=\x20?',_0x353511))['where']('id\x20IN\x20?',squel[_0x42b8('0x46')]()[_0x42b8('0xf')](_0x42b8('0x57'),_0x42b8('0x58'))['from'](_0x34f154)[_0x42b8('0x59')](_0x544b2a['join'](','))))[_0x42b8('0x42')]();}function handleStop(){logger[_0x42b8('0x5a')](_0x42b8('0x5b'));stopped=!![];}function handleUncaughtException(_0x2bf727){logger['error'](_0x2bf727[_0x42b8('0x1e')]);process[_0x42b8('0x5c')](0x1);}function handleError(_0xc2bdc,_0x41e4c2){stats[_0x42b8('0x5d')][_0x42b8('0x20')]({'name':_0x41e4c2['code'],'message':_0x41e4c2[_0x42b8('0x1e')],'row':_0xc2bdc});}function handleQuery(_0x12a8ee){logger[_0x42b8('0x5a')](_0x12a8ee);return db[_0x42b8('0x15')][_0x42b8('0x5e')](_0x12a8ee)['spread'](function(_0x67cdc5){results[_0x42b8('0x20')](_0x67cdc5);})['catch'](function(_0xcc8b01){logger[_0x42b8('0x1d')](_0xcc8b01['message']);});}function main(_0x1c6c5e,_0x919806,_0x3f2ff0,_0x3d5c19){logger[_0x42b8('0x5a')](_0x42b8('0x5f'),_0x1c6c5e,JSON[_0x42b8('0x60')](_0x919806));process[_0x42b8('0x61')](_0x42b8('0x62'));var _0x6383ce=_0x919806[_0x42b8('0x63')];var _0x52547c=_[_0x42b8('0x64')](_0x6383ce);var _0x2c887e=_0x919806['socket_timestamp'];var _0x286844=path['join'](config[_0x42b8('0x65')],_0x42b8('0x66'),_0x2c887e+_0x42b8('0x67'));logger[_0x42b8('0x5a')](_0x42b8('0x68'),_0x919806);db[_0x42b8('0x69')][_0x42b8('0x6a')]({'raw':!![],'attributes':['id',_0x42b8('0x6b')]})[_0x42b8('0x1b')](function(_0x136777){for(var _0x5ce5f8=0x0;_0x5ce5f8<_0x136777[_0x42b8('0x17')];_0x5ce5f8++){if(_0x136777[_0x5ce5f8][_0x42b8('0x6b')]in _0x6383ce){contactItemTypes['push'](_0x136777[_0x5ce5f8]);delete _0x52547c[_0x136777[_0x5ce5f8]['name']];hasAdditionalPhones=!![];}for(var _0x4e3dbc in _0x6383ce){if(_0x136777[_0x5ce5f8][_0x42b8('0x6b')]+_0x42b8('0x6c')===_0x4e3dbc){phoneDescriptions['push']({'itemTypeId':_0x136777[_0x5ce5f8]['id'],'description':_0x4e3dbc});delete _0x52547c[_0x4e3dbc];}}}if(hasAdditionalPhones)_0x52547c[_0x42b8('0x19')]='';var _0x102a26=_[_0x42b8('0x55')](_0x52547c)[_0x42b8('0x11')]();logger[_0x42b8('0x5a')]('header',_0x102a26);fs['writeFileSync'](_0x286844,_0x102a26+'\x0a');Papa['parse'](fs[_0x42b8('0x6d')](_0x1c6c5e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x490950,_0x22cf66){try{for(var _0xad151=0x0,_0x2787ac=[];_0xad151<_0x490950[_0x42b8('0x6e')][_0x42b8('0x17')];_0xad151++){stats[_0x42b8('0x6f')]+=0x1;if(_0x490950['errors'][_0xad151]){handleError(_0x490950['data'][_0xad151],_0x490950['errors'][_0xad151]);}else{var _0xd12625=[];var _0x556867=[];var _0x3183d1={};for(var _0x5634c8 in _0x6383ce){let _0x48118c=contactItemTypes[_0x42b8('0x70')](_0x4e6581=>_0x4e6581[_0x42b8('0x6b')]===_0x5634c8);let _0x31853d=contactItemTypes[_0x42b8('0x70')](_0x55ceb4=>_0x55ceb4[_0x42b8('0x6b')]+_0x42b8('0x6c')===_0x5634c8);if(_[_0x42b8('0x18')](_0x48118c)&&_[_0x42b8('0x18')](_0x31853d)){if(_0x6383ce[_0x42b8('0x71')](_0x5634c8)){if(_0x490950['data'][_0xad151][_0x6383ce[_0x5634c8]]){var _0x292ed9=_[_0x42b8('0x72')](_0x490950[_0x42b8('0x6e')][_0xad151][_0x6383ce[_0x5634c8]][_0x42b8('0x73')](/"/g,'\x27'));switch(_0x5634c8){case _0x42b8('0x32'):var _0x7c377c=moment(_0x292ed9,_0x42b8('0xc'),!![]);if(_0x7c377c[_0x42b8('0x74')]()){_0x2787ac[_0x42b8('0x20')]('\x22'+_0x292ed9+'\x22');}else{_0xd12625[_0x42b8('0x20')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x42b8('0x36'):var _0x12bdb1=parseInt(_0x292ed9);_0x292ed9=_[_0x42b8('0x75')](_0x12bdb1)||_0x12bdb1<0x0||_0x12bdb1>0x4?_0x3d5c19?0x3:0x2:_0x12bdb1;_0x2787ac[_0x42b8('0x20')]('\x22'+_0x292ed9+'\x22');break;case _0x42b8('0x76'):var _0x40507d=parseInt(_0x292ed9);if(_[_0x42b8('0x77')](_0x40507d)&&_[_0x42b8('0x78')](_0x3f2ff0,_0x40507d)){_0x2787ac[_0x42b8('0x20')]('\x22'+_0x40507d+'\x22');}else{_0xd12625[_0x42b8('0x20')](_0x42b8('0x79'));}break;case _0x42b8('0x7a'):if(isEmail(_0x292ed9)){_0x2787ac[_0x42b8('0x20')]('\x22'+_0x292ed9+'\x22');}else{_0xd12625['push'](_0x42b8('0x7b'));}break;case _0x42b8('0x7c'):var _0x189056=moment(_0x292ed9,'YYYY-MM-DD',!![]);if(_0x189056['isValid']()){_0x2787ac[_0x42b8('0x20')]('\x22'+_0x292ed9+'\x22');}else{_0xd12625[_0x42b8('0x20')](_0x42b8('0x7d'));}break;default:_0x2787ac[_0x42b8('0x20')]('\x22'+_0x292ed9+'\x22');}}else{switch(_0x5634c8){case _0x42b8('0x7e'):case _0x42b8('0x10'):_0xd12625[_0x42b8('0x20')](_0x5634c8+_0x42b8('0x7f'));break;default:_0x2787ac[_0x42b8('0x20')]('\x22\x22');}}}}else{var _0x17c8fb='';if(!_['isNil'](_0x48118c)){if(!_0x3183d1[_0x42b8('0x71')](_0x48118c['id'])){for(var _0x299687=0x0;_0x299687<_0x6383ce[_0x5634c8][_0x42b8('0x17')];_0x299687++){var _0x292ed9=_[_0x42b8('0x72')](_0x490950[_0x42b8('0x6e')][_0xad151][_0x6383ce[_0x5634c8][_0x299687]]['replace'](/"/g,'\x27'));var _0x3e49e9=phoneDescriptions[_0x42b8('0x70')](_0x5dcd57=>_0x5dcd57['itemTypeId']===_0x48118c['id']);if(!_[_0x42b8('0x18')](_0x3e49e9)){var _0x7ad47f=_[_0x42b8('0x72')](_0x490950[_0x42b8('0x6e')][_0xad151][_0x6383ce[_0x3e49e9['description']][0x0]][_0x42b8('0x73')](/"/g,'\x27'));if(!_[_0x42b8('0x18')](_0x7ad47f))_0x292ed9=_0x292ed9+'§'+_0x7ad47f;}if(_0x17c8fb=='')_0x17c8fb=_0x292ed9;else _0x17c8fb+='|'+_0x292ed9;}_0x556867['push'](_0x48118c['id']+':'+_0x17c8fb);_0x3183d1[_0x48118c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2787ac['push']('\x22'+_0x556867[_0x42b8('0x11')](';')+'\x22');}if(_0xd12625[_0x42b8('0x17')]){handleError(_0x490950[_0x42b8('0x6e')][_0xad151],{'code':'SystemRow','message':_0xd12625[_0x42b8('0x11')]()});}else{fs[_0x42b8('0x80')](_0x286844,_0x2787ac[_0x42b8('0x11')]()+'\x0a');}_0x2787ac=[];}if(!(stats[_0x42b8('0x6f')]%0xc8)){socket['emit'](_0x42b8('0x81')+_0x2c887e,stats);stats[_0x42b8('0x5d')]=[];}}if(stopped){logger['info'](_0x42b8('0x82'));_0x22cf66[_0x42b8('0x83')]();}}catch(_0xef7f35){handleError(_0x490950[_0x42b8('0x6e')][_0xad151],{'code':_0x42b8('0x84'),'message':_0xef7f35[_0x42b8('0x1e')]});logger[_0x42b8('0x1d')](_0x42b8('0x85'),_0xef7f35[_0x42b8('0x1e')]);}},'complete':function(){try{var _0x3a9a93=[];var _0x49d871=tempTableName;_0x3a9a93[_0x42b8('0x20')](_0x42b8('0x86')+_0x49d871+_0x42b8('0x87'));logger['info']('CIS\x20len',contactItemTypes[_0x42b8('0x17')]);var _0x30986b=util[_0x42b8('0xb')](_0x42b8('0x88'),_0x286844,_0x49d871,_0x102a26,_0x919806[_0x42b8('0x45')],_0x919806['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x6383ce['scheduledat'])){_0x30986b+=_0x42b8('0x89');}_0x3a9a93['push'](_0x30986b);BPromise[_0x42b8('0x8a')](_0x3a9a93,handleQuery)[_0x42b8('0x1b')](function(_0x406e93){BPromise[_0x42b8('0x1a')]([handleAdditionalPhones()])[_0x42b8('0x1b')](function(){_0x3a9a93=[];for(var _0x198839=0x0;_0x198839_0x404a01[_0xa531('0x68')]===_0x5aac81);let _0x12330f=contactItemTypes[_0xa531('0x70')](_0x165c4e=>_0x165c4e[_0xa531('0x68')]+_0xa531('0x69')===_0x5aac81);if(_[_0xa531('0x71')](_0x250229)&&_[_0xa531('0x71')](_0x12330f)){if(_0x1cf6aa['hasOwnProperty'](_0x5aac81)){if(_0x196ea3[_0xa531('0x6e')][_0x345be8][_0x1cf6aa[_0x5aac81]]){var _0x368039=_['trim'](_0x196ea3[_0xa531('0x6e')][_0x345be8][_0x1cf6aa[_0x5aac81]][_0xa531('0x72')](/"/g,'\x27'));switch(_0x5aac81){case'scheduledat':var _0x36c29c=moment(_0x368039,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x36c29c[_0xa531('0x73')]()){_0x57d0c0[_0xa531('0x1d')]('\x22'+_0x368039+'\x22');}else{_0x4230e9[_0xa531('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x21ca85=parseInt(_0x368039);_0x368039=_['isNaN'](_0x21ca85)||_0x21ca85<0x0||_0x21ca85>0x4?_0x132f9e?0x3:0x2:_0x21ca85;_0x57d0c0[_0xa531('0x1d')]('\x22'+_0x368039+'\x22');break;case _0xa531('0x3c'):var _0x44e590=parseInt(_0x368039);if(_[_0xa531('0x74')](_0x44e590)&&_['includes'](_0x3f01c6,_0x44e590)){_0x57d0c0['push']('\x22'+_0x44e590+'\x22');}else{_0x4230e9['push'](_0xa531('0x75'));}break;case _0xa531('0x76'):if(isEmail(_0x368039)){_0x57d0c0[_0xa531('0x1d')]('\x22'+_0x368039+'\x22');}else{_0x4230e9['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x5418e9=moment(_0x368039,'YYYY-MM-DD',!![]);if(_0x5418e9[_0xa531('0x73')]()){_0x57d0c0[_0xa531('0x1d')]('\x22'+_0x368039+'\x22');}else{_0x4230e9[_0xa531('0x1d')](_0xa531('0x77'));}break;default:_0x57d0c0['push']('\x22'+_0x368039+'\x22');}}else{switch(_0x5aac81){case _0xa531('0x78'):case _0xa531('0x15'):_0x4230e9[_0xa531('0x1d')](_0x5aac81+_0xa531('0x79'));break;default:_0x57d0c0[_0xa531('0x1d')]('\x22\x22');}}}}else{var _0x487b90='';if(!_[_0xa531('0x71')](_0x250229)){if(!_0x16dd7a[_0xa531('0x7a')](_0x250229['id'])){for(var _0xf500cd=0x0;_0xf500cd<_0x1cf6aa[_0x5aac81][_0xa531('0x1b')];_0xf500cd++){var _0x368039=_[_0xa531('0x7b')](_0x196ea3[_0xa531('0x6e')][_0x345be8][_0x1cf6aa[_0x5aac81][_0xf500cd]]['replace'](/"/g,'\x27'));var _0x5ccc51=phoneDescriptions[_0xa531('0x70')](_0x103f56=>_0x103f56[_0xa531('0x7c')]===_0x250229['id']);if(!_[_0xa531('0x71')](_0x5ccc51)){var _0x882fe0=_[_0xa531('0x7b')](_0x196ea3[_0xa531('0x6e')][_0x345be8][_0x1cf6aa[_0x5ccc51[_0xa531('0x7d')]][0x0]][_0xa531('0x72')](/"/g,'\x27'));if(!_[_0xa531('0x71')](_0x882fe0))_0x368039=_0x368039+'§'+_0x882fe0;}if(_0x487b90=='')_0x487b90=_0x368039;else _0x487b90+='|'+_0x368039;}_0x23985e[_0xa531('0x1d')](_0x250229['id']+':'+_0x487b90);_0x16dd7a[_0x250229['id']]=0x1;}}}}if(hasAdditionalPhones){_0x57d0c0[_0xa531('0x1d')]('\x22'+_0x23985e[_0xa531('0x16')](';')+'\x22');}if(_0x4230e9['length']){handleError(_0x196ea3[_0xa531('0x6e')][_0x345be8],{'code':_0xa531('0x7e'),'message':_0x4230e9[_0xa531('0x16')]()});}else{fs['appendFileSync'](_0x41342a,_0x57d0c0[_0xa531('0x16')]()+'\x0a');}_0x57d0c0=[];}if(!(stats[_0xa531('0x6f')]%0xc8)){socket[_0xa531('0x7f')](_0xa531('0x80')+_0x494a30,stats);stats[_0xa531('0x59')]=[];}}if(stopped){logger['info'](_0xa531('0x81'));_0xadbd2d['abort']();}}catch(_0x2c2b95){handleError(_0x196ea3[_0xa531('0x6e')][_0x345be8],{'code':_0xa531('0x82'),'message':_0x2c2b95['message']});logger['error'](_0xa531('0x83'),_0x2c2b95['message']);}},'complete':function(){try{var _0x58b737=[];var _0x38dc89=tempTableName;_0x58b737['push'](_0xa531('0x84')+_0x38dc89+_0xa531('0x85'));logger[_0xa531('0x57')](_0xa531('0x86'),contactItemTypes[_0xa531('0x1b')]);var _0x388022=util[_0xa531('0x87')](_0xa531('0x88'),_0x41342a,_0x38dc89,_0x245cb7,_0x205b48[_0xa531('0x39')],_0x205b48[_0xa531('0x53')]||null,NOW,NOW);if(_['isNil'](_0x1cf6aa[_0xa531('0x37')])){_0x388022+=_0xa531('0x89');}_0x58b737[_0xa531('0x1d')](_0x388022);BPromise[_0xa531('0x8a')](_0x58b737,handleQuery)[_0xa531('0x1e')](function(_0x7a68b7){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x58b737=[];for(var _0x729e1=0x0;_0x729e1\x20\x20');}var _0x4a1a33=path['join'](config[_0xa531('0x62')],_0xa531('0x63'),process['argv'][0x2]);if(!fs['existsSync'](_0x4a1a33)){throw new Error(_0xa531('0x93'));}var _0x522100={};try{_0x522100=JSON[_0xa531('0x6c')](process['argv'][0x3]);if(!_0x522100[_0xa531('0x60')]){throw new Error(_0xa531('0x94'));}var _0x43c8dc=0x0;if(_0x522100['binding'][_0xa531('0x3c')]){_0x43c8dc=0x1;}if(!_0x522100[_0xa531('0x39')]){throw new Error(_0xa531('0x95'));}}catch(_0x21f90e){throw new Error('body\x20id\x20mandatory');}var _0x4b3859=[];try{_0x4b3859=_[_0xa531('0x96')](JSON[_0xa531('0x6c')](process[_0xa531('0x97')][0x4]),'id');}catch(_0x359cac){logger['info']('No\x20agent\x20available');}main(_0x4a1a33,_0x522100,_0x4b3859,_0x43c8dc);}validate();process['on']('SIGINT',handleStop);process['on'](_0xa531('0x98'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 934e890..fe51ac4 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09f4=['answertime','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','queue','push','variable','calleridnum','outbound','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','talktime','Called\x20Number','Member\x20Name','starttime'];(function(_0x11f290,_0x364b25){var _0x3cfa33=function(_0x38c419){while(--_0x38c419){_0x11f290['push'](_0x11f290['shift']());}};_0x3cfa33(++_0x364b25);}(_0x09f4,0xe2));var _0x409f=function(_0x16d793,_0x22f0f7){_0x16d793=_0x16d793-0x0;var _0x444f4f=_0x09f4[_0x16d793];return _0x444f4f;};'use strict';exports[_0x409f('0x0')]=function(_0x2e25e7,_0x15cf32){var _0x595021=[{'type':_0x409f('0x1'),'content':_0x409f('0x2'),'variableName':null}];switch(_0x2e25e7['toLowerCase']()){case'voice':switch(_0x15cf32[_0x409f('0x3')]()){case _0x409f('0x4'):_0x595021['push']({'type':'variable','content':'','variableName':_0x409f('0x5')});_0x595021[_0x409f('0x6')]({'type':_0x409f('0x7'),'content':'','variableName':_0x409f('0x8')});break;case _0x409f('0x9'):_0x595021[_0x409f('0x6')]({'type':_0x409f('0x1'),'content':_0x409f('0xa'),'variableName':null});_0x595021[_0x409f('0x6')]({'type':_0x409f('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x595021;};exports[_0x409f('0xb')]=function(_0x4b2ce9,_0x5540a5){var _0x3d7beb=[];switch(_0x4b2ce9[_0x409f('0x3')]()){case'voice':switch(_0x5540a5[_0x409f('0x3')]()){case _0x409f('0x4'):_0x3d7beb=[{'type':'string','content':_0x409f('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x409f('0xd'),'content':'','key':_0x409f('0xe'),'keyType':_0x409f('0x7'),'variableName':'calleridnum'},{'type':_0x409f('0xd'),'content':'','key':_0x409f('0xf'),'keyType':_0x409f('0x7'),'variableName':_0x409f('0x10')},{'type':'keyValue','content':'','key':_0x409f('0x11'),'keyType':_0x409f('0x7'),'variableName':_0x409f('0x12')},{'type':_0x409f('0xd'),'content':'','key':_0x409f('0x13'),'keyType':_0x409f('0x7'),'variableName':_0x409f('0x5')},{'type':_0x409f('0xd'),'content':'','key':_0x409f('0x14'),'keyType':_0x409f('0x7'),'variableName':_0x409f('0x15')},{'type':_0x409f('0xd'),'content':'','key':_0x409f('0x16'),'keyType':_0x409f('0x7'),'variableName':_0x409f('0x17')},{'type':_0x409f('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x409f('0xd'),'content':'','key':_0x409f('0x18'),'keyType':'variable','variableName':_0x409f('0x19')},{'type':'keyValue','content':'','key':_0x409f('0x1a'),'keyType':_0x409f('0x7'),'variableName':_0x409f('0x1b')},{'type':_0x409f('0x1'),'content':_0x409f('0x1c'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x409f('0x7'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0x409f('0x1d'),'keyType':_0x409f('0x7'),'variableName':_0x409f('0x1e')},{'type':_0x409f('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0x409f('0x7'),'variableName':_0x409f('0x1f')},{'type':'keyValue','content':'','key':_0x409f('0x20'),'keyType':_0x409f('0x7'),'variableName':_0x409f('0x21')},{'type':_0x409f('0xd'),'content':'','key':'Talk\x20Time','keyType':_0x409f('0x7'),'variableName':_0x409f('0x22')}];break;case _0x409f('0x9'):_0x3d7beb=[{'type':'string','content':_0x409f('0xc'),'variableName':null},{'type':_0x409f('0xd'),'content':'','key':_0x409f('0x23'),'keyType':_0x409f('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x409f('0xd'),'content':'','key':_0x409f('0x24'),'keyType':_0x409f('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x409f('0xd'),'content':'','key':_0x409f('0x14'),'keyType':'variable','keyContent':'','variableName':_0x409f('0x15')},{'type':'keyValue','content':'','key':_0x409f('0x16'),'keyType':_0x409f('0x7'),'keyContent':'','variableName':_0x409f('0x25')},{'type':_0x409f('0x1'),'content':_0x409f('0x1c')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0x409f('0x7'),'keyContent':'','variableName':_0x409f('0x26')},{'type':_0x409f('0xd'),'content':'','key':_0x409f('0x27'),'keyType':_0x409f('0x7'),'keyContent':'','variableName':_0x409f('0x28')},{'type':_0x409f('0xd'),'content':'','key':'Duration','keyType':_0x409f('0x7'),'keyContent':'','variableName':_0x409f('0x29')},{'type':'keyValue','content':'','key':_0x409f('0x2a'),'keyType':'variable','keyContent':'','variableName':_0x409f('0x2b')}];break;}}return _0x3d7beb;}; \ No newline at end of file +var _0xaf18=['talktime','Member\x20Name','membername','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','outbound','Outbound\x20Call','getDescriptions','keyValue','Caller\x20Number','calleridnum','destexten','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime'];(function(_0x5ea64f,_0xf0d76f){var _0x56788c=function(_0x119996){while(--_0x119996){_0x5ea64f['push'](_0x5ea64f['shift']());}};_0x56788c(++_0xf0d76f);}(_0xaf18,0x1cc));var _0x8af1=function(_0x4897f6,_0x39bb34){_0x4897f6=_0x4897f6-0x0;var _0x2b56dd=_0xaf18[_0x4897f6];return _0x2b56dd;};'use strict';exports[_0x8af1('0x0')]=function(_0xc21f37,_0x4fb1ab){var _0x234a52=[{'type':_0x8af1('0x1'),'content':_0x8af1('0x2'),'variableName':null}];switch(_0xc21f37[_0x8af1('0x3')]()){case _0x8af1('0x4'):switch(_0x4fb1ab[_0x8af1('0x3')]()){case _0x8af1('0x5'):_0x234a52[_0x8af1('0x6')]({'type':_0x8af1('0x7'),'content':'','variableName':_0x8af1('0x8')});_0x234a52['push']({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x8af1('0x9'):_0x234a52[_0x8af1('0x6')]({'type':_0x8af1('0x1'),'content':_0x8af1('0xa'),'variableName':null});_0x234a52[_0x8af1('0x6')]({'type':_0x8af1('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x234a52;};exports[_0x8af1('0xb')]=function(_0x4cf44b,_0x5fc7ea){var _0x37d687=[];switch(_0x4cf44b[_0x8af1('0x3')]()){case _0x8af1('0x4'):switch(_0x5fc7ea[_0x8af1('0x3')]()){case _0x8af1('0x5'):_0x37d687=[{'type':_0x8af1('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x8af1('0xc'),'content':'','key':_0x8af1('0xd'),'keyType':_0x8af1('0x7'),'variableName':_0x8af1('0xe')},{'type':_0x8af1('0xc'),'content':'','key':'Caller\x20Name','keyType':_0x8af1('0x7'),'variableName':'calleridname'},{'type':_0x8af1('0xc'),'content':'','key':'Call\x20To','keyType':_0x8af1('0x7'),'variableName':_0x8af1('0xf')},{'type':_0x8af1('0xc'),'content':'','key':'Queue','keyType':'variable','variableName':_0x8af1('0x8')},{'type':'keyValue','content':'','key':_0x8af1('0x10'),'keyType':_0x8af1('0x7'),'variableName':_0x8af1('0x11')},{'type':'keyValue','content':'','key':_0x8af1('0x12'),'keyType':_0x8af1('0x7'),'variableName':_0x8af1('0x13')},{'type':_0x8af1('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x8af1('0xc'),'content':'','key':_0x8af1('0x14'),'keyType':_0x8af1('0x7'),'variableName':_0x8af1('0x15')},{'type':_0x8af1('0xc'),'content':'','key':_0x8af1('0x16'),'keyType':_0x8af1('0x7'),'variableName':_0x8af1('0x17')},{'type':'string','content':_0x8af1('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x8af1('0xc'),'content':'','key':_0x8af1('0x19'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x8af1('0xc'),'content':'','key':_0x8af1('0x1a'),'keyType':'variable','variableName':_0x8af1('0x1b')},{'type':'keyValue','content':'','key':_0x8af1('0x1c'),'keyType':_0x8af1('0x7'),'variableName':_0x8af1('0x1d')},{'type':_0x8af1('0xc'),'content':'','key':_0x8af1('0x1e'),'keyType':_0x8af1('0x7'),'variableName':_0x8af1('0x1f')},{'type':_0x8af1('0xc'),'content':'','key':'Talk\x20Time','keyType':_0x8af1('0x7'),'variableName':_0x8af1('0x20')}];break;case _0x8af1('0x9'):_0x37d687=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0x8af1('0x7'),'keyContent':'','variableName':_0x8af1('0x17')},{'type':_0x8af1('0xc'),'content':'','key':_0x8af1('0x21'),'keyType':_0x8af1('0x7'),'keyContent':'','variableName':_0x8af1('0x22')},{'type':_0x8af1('0xc'),'content':'','key':_0x8af1('0x10'),'keyType':_0x8af1('0x7'),'keyContent':'','variableName':_0x8af1('0x11')},{'type':_0x8af1('0xc'),'content':'','key':_0x8af1('0x12'),'keyType':_0x8af1('0x7'),'keyContent':'','variableName':_0x8af1('0x23')},{'type':'string','content':_0x8af1('0x18')},{'type':'keyValue','content':'','key':_0x8af1('0x24'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':_0x8af1('0x25'),'keyType':_0x8af1('0x7'),'keyContent':'','variableName':_0x8af1('0x26')},{'type':_0x8af1('0xc'),'content':'','key':_0x8af1('0x27'),'keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0x8af1('0xc'),'content':'','key':_0x8af1('0x28'),'keyType':_0x8af1('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x37d687;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 04ec08f..522dc02 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd657=['./utils','skipInteractionsQuery','resolve','getInteractionsQuery','parseAdvancedSearchFilter','parseQueryParameters','then','where','body','contact','fields','filter','having','read','tags','group','search','ids','tag','count','order','forEach','contactName','getClosedOrderClause','DESC','rows','catch','tracked','user','query','clone','omit','html','phone','fax','mobile','updateUser','lodash','./sql-utils'];(function(_0x2ec915,_0x5844be){var _0x24df37=function(_0x3b0f38){while(--_0x3b0f38){_0x2ec915['push'](_0x2ec915['shift']());}};_0x24df37(++_0x5844be);}(_0xd657,0x9a));var _0x7d65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd657[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d65('0x0'));var sqlUtils=require(_0x7d65('0x1'));var utils=require(_0x7d65('0x2'));exports['findAll']=function(_0x716e99,_0x16d8b0,_0x12c0cb,_0x5b9a7d,_0x53e387){var _0x49b421={'count':0x0,'rows':[]};var _0x257d8e=sqlUtils[_0x7d65('0x3')](_0x716e99,_0x12c0cb,_0x16d8b0);if(_0x257d8e){return Promise[_0x7d65('0x4')](_0x49b421);}var _0x4e6bc1=sqlUtils[_0x7d65('0x5')](_0x716e99);var _0x3886e7={};return Promise[_0x7d65('0x4')]()['then'](function(){if(_0x16d8b0['search']){return sqlUtils[_0x7d65('0x6')](_0x16d8b0['search'],_0x53e387);}else{return sqlUtils[_0x7d65('0x7')](_0x716e99,_0x16d8b0,_0x53e387);}})[_0x7d65('0x8')](function(_0x12ea25){_0x4e6bc1[_0x7d65('0x9')](_0x12ea25[_0x7d65('0xa')]);_0x4e6bc1['where'](_0x12ea25[_0x7d65('0xb')]);_0x4e6bc1[_0x7d65('0x9')](_0x12ea25['default']);_0x4e6bc1[_0x7d65('0x9')](_0x12ea25[_0x7d65('0xc')]);_0x4e6bc1[_0x7d65('0x9')](_0x12ea25[_0x7d65('0xd')]);_0x4e6bc1[_0x7d65('0x9')](_0x12ea25['user']);_0x4e6bc1[_0x7d65('0xe')](_0x12ea25[_0x7d65('0xf')]);_0x3886e7=_0x12ea25[_0x7d65('0x10')];return sqlUtils['checkAccountsRestrictions'](_0x716e99,_0x12c0cb,_0x16d8b0);})[_0x7d65('0x8')](function(_0x4c48ee){_0x4e6bc1[_0x7d65('0x9')](_0x4c48ee);_0x4e6bc1[_0x7d65('0x11')]('i.id');var _0x3a8074=_0x16d8b0[_0x7d65('0x12')]?_0x3886e7[_0x7d65('0x13')]:_0x16d8b0[_0x7d65('0x14')];return sqlUtils['countFilteredInteractions'](_0x4e6bc1,_0x3a8074);})[_0x7d65('0x8')](function(_0x547acc){_0x49b421[_0x7d65('0x15')]=_0x547acc['length'];if(_0x49b421[_0x7d65('0x15')]===0x0){return[];}_0x4e6bc1[_0x7d65('0xe')](_0x3886e7['clause']);if(_0x5b9a7d[_0x7d65('0x16')]){_0x5b9a7d[_0x7d65('0x16')][_0x7d65('0x17')](function(_0x2820a6){var _0x371e98=_0x2820a6[0x0]===_0x7d65('0x18')?_0x2820a6[0x0]:'i.'+_0x2820a6[0x0];_0x4e6bc1[_0x7d65('0x16')](_0x371e98,_0x2820a6[0x1]==='DESC'?![]:!![]);if(_0x2820a6[0x0]==='closed'){var _0x12a3ac=sqlUtils[_0x7d65('0x19')](_0x716e99,_0x16d8b0);_0x4e6bc1[_0x7d65('0x16')](_0x12a3ac,_0x2820a6[0x1]===_0x7d65('0x1a')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x716e99,_0x4e6bc1,_0x16d8b0,_0x5b9a7d);})[_0x7d65('0x8')](function(_0x2455c1){_0x49b421[_0x7d65('0x1b')]=_0x2455c1;return _0x49b421;})[_0x7d65('0x1c')](function(_0x5d034f){throw _0x5d034f;});};exports[_0x7d65('0x1d')]=function(_0x341a1f,_0x52b551){return function(_0x2abe64,_0x1b97ec,_0xb1c144){var _0x4c31a9=_0x2abe64[_0x7d65('0x1e')];var _0x5e2c84={};var _0x6c3d51=_0x2abe64[_0x7d65('0x1f')];if(_0x5e2c84){_0x5e2c84=_[_0x7d65('0x20')](_0x2abe64[_0x7d65('0xa')]);_0x5e2c84=_[_0x7d65('0x21')](_0x5e2c84,[_0x7d65('0xa'),_0x7d65('0x22'),_0x7d65('0x23'),_0x7d65('0x24'),_0x7d65('0x25')]);}utils[_0x7d65('0x26')](_0x4c31a9,_0x5e2c84,_0x6c3d51,_0x341a1f,_0x52b551);_0xb1c144(null);};}; \ No newline at end of file +var _0x1ce1=['fields','user','having','read','tags','checkAccountsRestrictions','group','i.id','ids','tag','countFilteredInteractions','count','length','order','forEach','DESC','closed','getClosedOrderClause','getFilteredInteractions','catch','tracked','query','clone','body','html','phone','mobile','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','contact','default'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x1ce1,0xb7));var _0x11ce=function(_0x3ee7e2,_0x15cf09){_0x3ee7e2=_0x3ee7e2-0x0;var _0x1c1f18=_0x1ce1[_0x3ee7e2];return _0x1c1f18;};'use strict';var _=require('lodash');var sqlUtils=require(_0x11ce('0x0'));var utils=require(_0x11ce('0x1'));exports[_0x11ce('0x2')]=function(_0x342091,_0x3aa32d,_0x1b76c5,_0x3a19d6,_0x254738){var _0x4f65b3={'count':0x0,'rows':[]};var _0x23610a=sqlUtils[_0x11ce('0x3')](_0x342091,_0x1b76c5,_0x3aa32d);if(_0x23610a){return Promise['resolve'](_0x4f65b3);}var _0x26df6b=sqlUtils['getInteractionsQuery'](_0x342091);var _0x262a5c={};return Promise[_0x11ce('0x4')]()['then'](function(){if(_0x3aa32d[_0x11ce('0x5')]){return sqlUtils[_0x11ce('0x6')](_0x3aa32d[_0x11ce('0x5')],_0x254738);}else{return sqlUtils[_0x11ce('0x7')](_0x342091,_0x3aa32d,_0x254738);}})[_0x11ce('0x8')](function(_0x1e31eb){_0x26df6b[_0x11ce('0x9')](_0x1e31eb['body']);_0x26df6b[_0x11ce('0x9')](_0x1e31eb[_0x11ce('0xa')]);_0x26df6b['where'](_0x1e31eb[_0x11ce('0xb')]);_0x26df6b[_0x11ce('0x9')](_0x1e31eb[_0x11ce('0xc')]);_0x26df6b['where'](_0x1e31eb['filter']);_0x26df6b[_0x11ce('0x9')](_0x1e31eb[_0x11ce('0xd')]);_0x26df6b[_0x11ce('0xe')](_0x1e31eb[_0x11ce('0xf')]);_0x262a5c=_0x1e31eb[_0x11ce('0x10')];return sqlUtils[_0x11ce('0x11')](_0x342091,_0x1b76c5,_0x3aa32d);})['then'](function(_0x2c5b0f){_0x26df6b[_0x11ce('0x9')](_0x2c5b0f);_0x26df6b[_0x11ce('0x12')](_0x11ce('0x13'));var _0x1c3f5d=_0x3aa32d[_0x11ce('0x5')]?_0x262a5c[_0x11ce('0x14')]:_0x3aa32d[_0x11ce('0x15')];return sqlUtils[_0x11ce('0x16')](_0x26df6b,_0x1c3f5d);})[_0x11ce('0x8')](function(_0x24b5e6){_0x4f65b3[_0x11ce('0x17')]=_0x24b5e6[_0x11ce('0x18')];if(_0x4f65b3[_0x11ce('0x17')]===0x0){return[];}_0x26df6b[_0x11ce('0xe')](_0x262a5c['clause']);if(_0x3a19d6[_0x11ce('0x19')]){_0x3a19d6[_0x11ce('0x19')][_0x11ce('0x1a')](function(_0x3eeec3){var _0x3b8650=_0x3eeec3[0x0]==='contactName'?_0x3eeec3[0x0]:'i.'+_0x3eeec3[0x0];_0x26df6b[_0x11ce('0x19')](_0x3b8650,_0x3eeec3[0x1]===_0x11ce('0x1b')?![]:!![]);if(_0x3eeec3[0x0]===_0x11ce('0x1c')){var _0x1e9d5d=sqlUtils[_0x11ce('0x1d')](_0x342091,_0x3aa32d);_0x26df6b[_0x11ce('0x19')](_0x1e9d5d,_0x3eeec3[0x1]===_0x11ce('0x1b')?![]:!![]);}});}return sqlUtils[_0x11ce('0x1e')](_0x342091,_0x26df6b,_0x3aa32d,_0x3a19d6);})[_0x11ce('0x8')](function(_0x4198b9){_0x4f65b3['rows']=_0x4198b9;return _0x4f65b3;})[_0x11ce('0x1f')](function(_0x271a28){throw _0x271a28;});};exports[_0x11ce('0x20')]=function(_0x1a3bb8,_0x36983e){return function(_0x1ed2b0,_0x31b9b6,_0x12b4b4){var _0x6773d8=_0x1ed2b0[_0x11ce('0xd')];var _0xcd2ed5={};var _0x4c35fc=_0x1ed2b0[_0x11ce('0x21')];if(_0xcd2ed5){_0xcd2ed5=_[_0x11ce('0x22')](_0x1ed2b0[_0x11ce('0x23')]);_0xcd2ed5=_['omit'](_0xcd2ed5,['body',_0x11ce('0x24'),_0x11ce('0x25'),'fax',_0x11ce('0x26')]);}utils['updateUser'](_0x6773d8,_0xcd2ed5,_0x4c35fc,_0x1a3bb8,_0x36983e);_0x12b4b4(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index fb0ecd4..4aeefe3 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x627a=['expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','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)','fax','parseSearch','sqlOperator','conditions','find','buildExpression','type','text','start','value','end','unreadMessages','and','Contact','operator','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','map','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','body','keys','some','compact','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','resolve','then','fields','read','tag','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','contactName','i.id','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.ContactId','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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','SELECT','exports','lodash','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','user_has_','u.id','u.fullname','left_join','users','length','where','ui.','\x20IN\x20?','getInteractionFK','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','t.id\x20=\x20it.TagId'];(function(_0x2ea5d6,_0x2ef3e7){var _0x20dcb3=function(_0x22ed56){while(--_0x22ed56){_0x2ea5d6['push'](_0x2ea5d6['shift']());}};_0x20dcb3(++_0x2ef3e7);}(_0x627a,0x1b9));var _0xa627=function(_0x1c7cde,_0x3b54f4){_0x1c7cde=_0x1c7cde-0x0;var _0x523e24=_0x627a[_0x1c7cde];return _0x523e24;};'use strict';var _=require(_0xa627('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var updateInteraction=require(_0xa627('0x1'))[_0xa627('0x2')];var utils=require('./utils');var db=require(_0xa627('0x3'))['db'];function skipInteractionsQuery(_0x4589fa,_0x2ef1cb,_0x58adfc){var _0x3f7de5=![];var _0x4cb1c3=utils[_0xa627('0x4')](_0x4589fa);if(_0x2ef1cb[_0xa627('0x5')]===_0xa627('0x6')&&!_0x58adfc[_0xa627('0x7')]&&!_0x58adfc[_0x4cb1c3]){_0x3f7de5=!![];}return _0x3f7de5;}function getTagsQuery(){return squel[_0xa627('0x8')]()[_0xa627('0x9')]('id')[_0xa627('0x9')](_0xa627('0xa'))['field'](_0xa627('0xb'))[_0xa627('0xc')](_0xa627('0xd'));}function getUsersQuery(_0x1efdd2,_0x5d340c){var _0x38a8df=utils['getInteractionFK'](_0x1efdd2);var _0x5c693d=_0xa627('0xe')+_0x1efdd2+'_interactions';var _0x57f3a7=squel[_0xa627('0x8')]()['field'](_0xa627('0xf'))[_0xa627('0x9')](_0xa627('0x10'))[_0xa627('0x9')]('ui.'+_0x38a8df)[_0xa627('0xc')](_0x5c693d,'ui')[_0xa627('0x11')](_0xa627('0x12'),'u','u.id\x20=\x20ui.UserId');if(_0x5d340c[_0xa627('0x13')]>0x0){_0x57f3a7[_0xa627('0x14')](_0xa627('0x15')+_0x38a8df+_0xa627('0x16'),_['map'](_0x5d340c,'id'));}return _0x57f3a7;}function getInteractionsQuery(_0x27785d){var _0x1f4a4c=utils['getInteractionsTables'](_0x27785d);var _0x2427e4=utils[_0xa627('0x4')](_0x27785d);var _0x220438=utils[_0xa627('0x17')](_0x27785d);return squel[_0xa627('0x8')]()[_0xa627('0xc')](_0x1f4a4c['interactions'],'i')[_0xa627('0x11')](_0xa627('0x18'),'c',_0xa627('0x19'))[_0xa627('0x11')](_0xa627('0x12'),'o',_0xa627('0x1a'))['left_join'](_0x1f4a4c[_0xa627('0x1b')],'a',_0xa627('0x1c')+_0x2427e4)['left_join'](_0x1f4a4c[_0xa627('0x1d')],'me',_0xa627('0x1e')+_0x220438+_0xa627('0x1f'))[_0xa627('0x11')](_0x1f4a4c['interactionsTags'],'it','it.'+_0x220438+_0xa627('0x1f'))[_0xa627('0x11')]('tools_tags','t',_0xa627('0x20'));}function getSqlClauses(){var _0x346d26={'body':squel[_0xa627('0x21')](),'contact':squel[_0xa627('0x21')](),'default':squel[_0xa627('0x21')](),'fields':squel[_0xa627('0x21')](),'filter':squel[_0xa627('0x21')](),'read':squel[_0xa627('0x21')](),'tags':{'clause':squel[_0xa627('0x21')](),'ids':null},'user':squel['expr']()};return _0x346d26;}function parseTagParameter(_0x7fc212){var _0x2fe6c0=squel['expr']();if(_0x7fc212){var _0x1287a6=utils[_0xa627('0x22')](_0x7fc212);_0x1287a6[_0xa627('0x23')](function(_0x42c846){_0x2fe6c0['or'](_0xa627('0x24'),'%,'+_0x42c846+',%');});}return _0x2fe6c0;}function parseReadParameter(_0x1a8c66){var _0x53c51d='';if(_0x1a8c66){_0x53c51d=_0xa627('0x25');if(_0x1a8c66==='1'){_0x53c51d=_0x53c51d['replace'](_0xa627('0x26'),'=');}else{_0x53c51d=_0x53c51d[_0xa627('0x27')]('{OPERATOR}','>');}}return _0x53c51d;}function parseSearchFilter(_0x2f32f0,_0x1ead20){var _0x18d0f7=squel[_0xa627('0x21')]();if(_0x1ead20){var _0x5c7915=_0x1ead20['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5c7915)){_0x18d0f7['or'](_0xa627('0x28'),_0x5c7915+'%');if([_0xa627('0x29'),_0xa627('0x2a')]['includes'](_0x2f32f0)){_0x18d0f7['or'](_0xa627('0x2b'),_0x5c7915+'%');}else if(_0x2f32f0==='fax'){_0x18d0f7['or'](_0xa627('0x2c'),_0x5c7915+'%');}else if(_0x2f32f0==='openchannel'){_0x18d0f7['or']('i.from\x20LIKE\x20?',_0x5c7915+'%');}}else if(_0x2f32f0===_0xa627('0x2d')&&qs[_0xa627('0x2e')](_0x5c7915)){_0x18d0f7['or'](_0xa627('0x2f'),_0x5c7915+'%');}else{if(_0x2f32f0===_0xa627('0x2d')){_0x18d0f7['or'](_0xa627('0x30'),qs[_0xa627('0x31')](_0x5c7915,!![]))['or'](_0xa627('0x32'),qs[_0xa627('0x31')](_0x5c7915));}else if(_0x2f32f0!==_0xa627('0x33')){_0x18d0f7['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5c7915));}_0x18d0f7['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa627('0x31')](_0x5c7915,!![]),null);}}return _0x18d0f7;}function parseAdvancedSearchFilter(_0x5a4790,_0xc33377){var _0x4b1bc8=getSqlClauses();var _0x4fdf19=as[_0xa627('0x34')](_0x5a4790);var _0x115460=_0x4fdf19[_0xa627('0x35')];for(var _0x465b08=0x0;_0x465b08<_0x4fdf19[_0xa627('0x36')][_0xa627('0x13')];_0x465b08++){var _0x5c83da=_0x4fdf19[_0xa627('0x36')][_0x465b08];var _0x2e04c2='i';var _0x2b8c6b=_[_0xa627('0x37')](_0xc33377,[_0xa627('0xa'),_0x5c83da[_0xa627('0x9')]]);if(_0x2b8c6b){var _0x3ebe47=as[_0xa627('0x38')](_0x2e04c2,_0x2b8c6b[_0xa627('0x39')],_0x5c83da);_0x4b1bc8['default'][_0x115460](_0x3ebe47[_0xa627('0x3a')],_0x3ebe47['value'][_0xa627('0x3b')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3d')]);}else{switch(_0x5c83da['field']){case _0xa627('0x3e'):var _0x52d90a=parseReadParameter(_0x5c83da['value']);_0x4b1bc8['read'][_0xa627('0x3f')](_0x52d90a);break;case _0xa627('0x40'):if(_0x5c83da[_0xa627('0x41')]===_0xa627('0x42')){if(_0x5c83da[_0xa627('0x3c')][_0xa627('0x43')]('\x20')[_0xa627('0x13')]>0x1){_0x4b1bc8[_0xa627('0x44')][_0x115460](_0xa627('0x45'),qs[_0xa627('0x31')](_0x5c83da['value'],!![]),null);}else{var _0x2b0de7='%'+_0x5c83da[_0xa627('0x3c')]+'%';_0x4b1bc8[_0xa627('0x44')][_0x115460](_0xa627('0x46'),_0x2b0de7,_0x2b0de7,_0x2b0de7);}}else{_0x2b8c6b=_[_0xa627('0x37')](_0xc33377,['name','ContactId']);_0x5c83da['field']='ContactId';_0x3ebe47=as[_0xa627('0x38')](_0x2e04c2,_0x2b8c6b['type'],_0x5c83da);_0x4b1bc8[_0xa627('0x44')][_0x115460](_0x3ebe47[_0xa627('0x3a')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3b')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3d')]);}break;case'Tag':var _0xf52c38=_0x5c83da[_0xa627('0x3c')][_0xa627('0x43')](',')[_0xa627('0x47')](function(_0x5aa8aa){return Number(_0x5aa8aa);});var _0x4b67bc=parseTagParameter(_0xf52c38);_0x4b1bc8[_0xa627('0x48')][_0xa627('0x49')][_0xa627('0x3f')](_0x4b67bc);_0x4b1bc8[_0xa627('0x48')][_0xa627('0x4a')]=_0xf52c38;break;case _0xa627('0x4b'):if(_0x5c83da[_0xa627('0x41')]===_0xa627('0x42')){_0x4b1bc8[_0xa627('0x4c')][_0x115460](_0xa627('0x4d'),'%'+_0x5c83da['value']+'%',null);}else{_0x2b8c6b=_[_0xa627('0x37')](_0xc33377,['name',_0xa627('0x4e')]);_0x5c83da['field']=_0xa627('0x4e');_0x3ebe47=as[_0xa627('0x38')](_0x2e04c2,_0x2b8c6b[_0xa627('0x39')],_0x5c83da);_0x4b1bc8[_0xa627('0x4c')][_0x115460](_0x3ebe47[_0xa627('0x3a')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3b')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3d')]);}break;case'body':case _0xa627('0x4f'):_0x3ebe47=as[_0xa627('0x38')]('me',null,_0x5c83da);_0x4b1bc8[_0xa627('0x50')][_0x115460](_0x3ebe47[_0xa627('0x3a')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3b')],_0x3ebe47[_0xa627('0x3c')][_0xa627('0x3d')]);break;}}}return _0x4b1bc8;}function parseModelFields(_0x30d551,_0x38e555,_0x42daf3){var _0x251478=utils[_0xa627('0x4')](_0x30d551);var _0x3893ea=squel[_0xa627('0x21')]();var _0x360878=_(_0x38e555)[_0xa627('0x51')]()[_0xa627('0x47')](function(_0x4224ab){return _[_0xa627('0x52')](_0x42daf3,[_0xa627('0xa'),_0x4224ab])?_0x4224ab:undefined;})[_0xa627('0x53')]()[_0xa627('0x3c')]();if(_0x360878[_0xa627('0x13')]>0x0){_0x360878[_0xa627('0x23')](function(_0x104913){if(_0x104913===_0x251478){_0x3893ea[_0xa627('0x3f')]('i.'+_0x251478+_0xa627('0x16'),[]['concat'](_0x38e555[_0x104913]));}else if(_0x104913===_0xa627('0x54')){var _0x470256=JSON[_0xa627('0x55')](_0x38e555[_0x104913])['$gte'];var _0x21b029=JSON[_0xa627('0x55')](_0x38e555[_0x104913])[_0xa627('0x56')];_0x3893ea[_0xa627('0x3f')](_0xa627('0x57'),_0x470256,_0x21b029);}else{if(_0x38e555[_0x104913]===_0xa627('0x58')){_0x3893ea[_0xa627('0x3f')]('i.'+_0x104913+'\x20IS\x20NULL');}else{_0x3893ea[_0xa627('0x3f')]('i.'+_0x104913+'\x20=\x20?',_0x38e555[_0x104913]);}}});}return _0x3893ea;}function parseQueryParameters(_0x322027,_0x154c3d,_0x494c91){var _0x145580=getSqlClauses();return Promise[_0xa627('0x59')]()[_0xa627('0x5a')](function(){return parseModelFields(_0x322027,_0x154c3d,_0x494c91);})[_0xa627('0x5a')](function(_0x30f56b){_0x145580[_0xa627('0x5b')]['and'](_0x30f56b);return parseReadParameter(_0x154c3d[_0xa627('0x5c')]);})[_0xa627('0x5a')](function(_0x557b30){_0x145580[_0xa627('0x5c')]['and'](_0x557b30);return parseTagParameter(_0x154c3d[_0xa627('0x5d')]);})[_0xa627('0x5a')](function(_0x1bbe8c){_0x145580[_0xa627('0x48')]['clause'][_0xa627('0x3f')](_0x1bbe8c);return parseSearchFilter(_0x322027,_0x154c3d[_0xa627('0x5e')]);})[_0xa627('0x5a')](function(_0x39d970){_0x145580[_0xa627('0x5e')]=_0x39d970;return _0x145580;});}function checkAccountsRestrictions(_0x2535fc,_0x4d89a6,_0x67d7f9){var _0x3efa95=utils[_0xa627('0x4')](_0x2535fc);var _0x2776b7=_0xa627('0x5f')+_[_0xa627('0x60')](_0x2535fc)+(_0x2535fc===_0xa627('0x61')?_0xa627('0x62'):_0xa627('0x63'));var _0x1ef3c1=squel[_0xa627('0x21')]();return Promise[_0xa627('0x59')]()[_0xa627('0x5a')](function(){if(_0x67d7f9[_0xa627('0x7')]&&_0x4d89a6[_0xa627('0x5')]===_0xa627('0x6')){return _0x4d89a6[_0x2776b7]({'attributes':['id'],'raw':!![]});}})[_0xa627('0x5a')](function(_0x12974c){if(_0x12974c){if(_0x12974c['length']===0x0){_0x1ef3c1[_0xa627('0x3f')]('i.'+_0x3efa95+_0xa627('0x64'));}else{_0x1ef3c1['and']('i.'+_0x3efa95+_0xa627('0x16'),_[_0xa627('0x47')](_0x12974c,'id'));}}else if(!_0x67d7f9[_0x3efa95]){_0x1ef3c1[_0xa627('0x3f')]('i.'+_0x3efa95+_0xa627('0x65'));}})[_0xa627('0x5a')](function(){return _0x1ef3c1;});}function getClosedOrderClause(_0x3ff420,_0x2a2bcb){var _0x505a25='';var _0x94be6=[_0xa627('0x66'),_0xa627('0x67'),_0xa627('0x68')];if(_0x3ff420===_0xa627('0x2d')){_0x94be6[_0xa627('0x69')](_0xa627('0x6a'));}if(_0x2a2bcb[_0xa627('0x6b')]==='0'&&_0x3ff420==='mail'){_0x505a25=_0xa627('0x6a');}else{if(_0x2a2bcb[_0xa627('0x6b')]==='1'){_0x94be6['shift']();}_0x505a25=_0xa627('0x6c')+_0x94be6[_0xa627('0x6d')](',\x20')+')';}return _0x505a25;}function getFilteredInteractions(_0x295c7,_0x46aaa5,_0x2674cd,_0x197a13){var _0x11b8e9=utils[_0xa627('0x17')](_0x295c7);var _0x17ea9a=_[_0xa627('0x60')](_0x295c7)+_0xa627('0x6e');var _0x1a7972=[];var _0x127e07=getTagsQuery();var _0x2aa193={'type':db[_0xa627('0x6f')]['QueryTypes']['SELECT'],'raw':!![]};var _0x3f3f02=[];var _0x42084b=[];return db[_0xa627('0x70')][_0xa627('0x71')](_0x127e07[_0xa627('0x72')](),_0x2aa193)[_0xa627('0x5a')](function(_0x41af39){_0x1a7972=_[_0xa627('0x73')](_0x41af39,'id');_0x2aa193=_[_0xa627('0x74')](_0x2aa193,{'model':db[_0x17ea9a],'mapToModel':!![],'nest':!![]});if(_0x2674cd['fields']){_0x197a13['attributes'][_0xa627('0x23')](function(_0x177a6e){_0x46aaa5[_0xa627('0x9')]('i.'+_0x177a6e);});}else{_0x46aaa5[_0xa627('0x9')](_0xa627('0x75'),'unreadMessages');_0x46aaa5[_0xa627('0x9')](_0xa627('0x76'),'Account.key');_0x46aaa5['field'](_0xa627('0x77'),'Account.mandatoryDisposition');if(_0x295c7===_0xa627('0x2d')){_0x46aaa5[_0xa627('0x9')]('a.email','Account.email');_0x46aaa5[_0xa627('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',_0xa627('0x78'));_0x46aaa5['field'](_0xa627('0x79'));_0x46aaa5[_0xa627('0x9')]('i.createdAt');_0x46aaa5['field']('i.updatedAt');_0x46aaa5['field']('i.closed');_0x46aaa5[_0xa627('0x9')](_0xa627('0x7a'));_0x46aaa5['field'](_0xa627('0x7b'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x7c'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x7d'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x7e'));_0x46aaa5['field'](_0xa627('0x68'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x67'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x66'));_0x46aaa5[_0xa627('0x9')]('i.substatus');_0x46aaa5[_0xa627('0x9')]('i.to');_0x46aaa5['field'](_0xa627('0x7f'));_0x46aaa5[_0xa627('0x9')]('i.MailAccountId');_0x46aaa5[_0xa627('0x9')](_0xa627('0x80'));}else if(_0x295c7==='openchannel'){_0x46aaa5['field']('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',_0xa627('0x78'));}else{_0x46aaa5[_0xa627('0x9')](_0xa627('0x81'),_0xa627('0x78'));}if(_0x295c7!==_0xa627('0x2d')){_0x46aaa5[_0xa627('0x9')](_0xa627('0x82'));}_0x46aaa5[_0xa627('0x9')](_0xa627('0x83'),_0xa627('0x84'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x85'),_0xa627('0x86'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x87'),_0xa627('0x88'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x89'),_0xa627('0x8a'));_0x46aaa5['field'](_0xa627('0x8b'),'Contact.mobile');_0x46aaa5[_0xa627('0x9')]('c.fax',_0xa627('0x8c'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x8d'),_0xa627('0x8e'));_0x46aaa5[_0xa627('0x9')](_0xa627('0x8f'),_0xa627('0x90'));_0x46aaa5['field'](_0xa627('0x91'),_0xa627('0x92'));}if(_0x197a13[_0xa627('0x93')]){_0x46aaa5[_0xa627('0x93')](_0x197a13[_0xa627('0x93')]);}if(_0x197a13[_0xa627('0x94')]){_0x46aaa5[_0xa627('0x94')](_0x197a13[_0xa627('0x94')]);}return db[_0xa627('0x70')][_0xa627('0x71')](_0x46aaa5['toString'](),_0x2aa193);})[_0xa627('0x5a')](function(_0x44bf39){_0x3f3f02=_0x44bf39;var _0xf3b2ab=getUsersQuery(_0x295c7,_0x3f3f02);return db['sequelize'][_0xa627('0x71')](_0xf3b2ab[_0xa627('0x72')](),_0x2aa193);})[_0xa627('0x5a')](function(_0x16be91){_0x42084b=_[_0xa627('0x95')](_0x16be91,_0x11b8e9);if(_0x295c7===_0xa627('0x2d')){return db[_0xa627('0x96')][_0xa627('0x97')]({'attributes':[_0xa627('0x98')],'raw':!![]});}})[_0xa627('0x5a')](function(_0x30a5e6){var _0x2c8ea8=_0x30a5e6?_0x30a5e6['enableEmailPreview']:undefined;var _0x32452a=_0x3f3f02['map'](function(_0x398bd3){return updateInteraction(_0x398bd3,_0x1a7972,_0x42084b,_0x2c8ea8);});return Promise['all'](_0x32452a);});}function countFilteredInteractions(_0x5a5adc,_0x214f93){var _0x38048d=_0x5a5adc[_0xa627('0x99')]();_0x38048d[_0xa627('0x9')](_0xa627('0x9a'));_0x38048d[_0xa627('0x9')](_0xa627('0x75'),_0xa627('0x3e'));var _0x2fe525=utils[_0xa627('0x22')](_0x214f93);if(!_[_0xa627('0x9b')](_0x2fe525)){_0x38048d[_0xa627('0x14')]('t.id\x20IN\x20?',_0x2fe525);}var _0x2a30fe={'type':db['Sequelize']['QueryTypes'][_0xa627('0x9c')],'raw':!![]};return db[_0xa627('0x70')]['query'](_0x38048d[_0xa627('0x72')](),_0x2a30fe);}module[_0xa627('0x9d')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x1dd4=['tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','start','keys','some','forEach','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','Accounts','role','\x20IS\x20NOT\x20NULL','i.disposition','unshift','i.substatus','CONCAT_WS(\x27\x27,\x20','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','attributes','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','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','Contact.firstName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','agent','search','select','field','name','from','getInteractionFK','user_has_','_interactions','u.id','u.fullname','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','messages','me.','interactionsTags','\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','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','type','default','text','value','end','unreadMessages','read','and','Contact','$substring','split','find','ContactId','buildExpression','contact'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x1dd4,0xfe));var _0x41dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41dd('0x0'));var squel=require(_0x41dd('0x1'));var as=require(_0x41dd('0x2'));var qs=require(_0x41dd('0x3'));var updateInteraction=require(_0x41dd('0x4'))['updateInteraction'];var utils=require(_0x41dd('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x3053ce,_0x1a660c,_0x4f191e){var _0x4a5371=![];var _0x1bbdfe=utils['getAccountFK'](_0x3053ce);if(_0x1a660c['role']===_0x41dd('0x6')&&!_0x4f191e[_0x41dd('0x7')]&&!_0x4f191e[_0x1bbdfe]){_0x4a5371=!![];}return _0x4a5371;}function getTagsQuery(){return squel[_0x41dd('0x8')]()['field']('id')[_0x41dd('0x9')](_0x41dd('0xa'))[_0x41dd('0x9')]('color')[_0x41dd('0xb')]('tools_tags');}function getUsersQuery(_0x526c9c,_0x40971b){var _0x27adac=utils[_0x41dd('0xc')](_0x526c9c);var _0x59f92b=_0x41dd('0xd')+_0x526c9c+_0x41dd('0xe');var _0x3a2b1c=squel[_0x41dd('0x8')]()[_0x41dd('0x9')](_0x41dd('0xf'))[_0x41dd('0x9')](_0x41dd('0x10'))[_0x41dd('0x9')]('ui.'+_0x27adac)[_0x41dd('0xb')](_0x59f92b,'ui')['left_join'](_0x41dd('0x11'),'u',_0x41dd('0x12'));if(_0x40971b[_0x41dd('0x13')]>0x0){_0x3a2b1c[_0x41dd('0x14')]('ui.'+_0x27adac+_0x41dd('0x15'),_[_0x41dd('0x16')](_0x40971b,'id'));}return _0x3a2b1c;}function getInteractionsQuery(_0x3e744a){var _0xf37fca=utils[_0x41dd('0x17')](_0x3e744a);var _0x2518bc=utils[_0x41dd('0x18')](_0x3e744a);var _0xaad7a5=utils[_0x41dd('0xc')](_0x3e744a);return squel[_0x41dd('0x8')]()[_0x41dd('0xb')](_0xf37fca[_0x41dd('0x19')],'i')[_0x41dd('0x1a')]('cm_contacts','c',_0x41dd('0x1b'))[_0x41dd('0x1a')]('users','o',_0x41dd('0x1c'))[_0x41dd('0x1a')](_0xf37fca[_0x41dd('0x1d')],'a','a.id\x20=\x20i.'+_0x2518bc)['left_join'](_0xf37fca[_0x41dd('0x1e')],'me',_0x41dd('0x1f')+_0xaad7a5+'\x20=\x20i.id')[_0x41dd('0x1a')](_0xf37fca[_0x41dd('0x20')],'it','it.'+_0xaad7a5+_0x41dd('0x21'))[_0x41dd('0x1a')](_0x41dd('0x22'),'t',_0x41dd('0x23'));}function getSqlClauses(){var _0x1dd935={'body':squel['expr'](),'contact':squel[_0x41dd('0x24')](),'default':squel['expr'](),'fields':squel[_0x41dd('0x24')](),'filter':squel[_0x41dd('0x24')](),'read':squel[_0x41dd('0x24')](),'tags':{'clause':squel[_0x41dd('0x24')](),'ids':null},'user':squel[_0x41dd('0x24')]()};return _0x1dd935;}function parseTagParameter(_0x11e70e){var _0x34ce72=squel[_0x41dd('0x24')]();if(_0x11e70e){var _0x338b2b=utils[_0x41dd('0x25')](_0x11e70e);_0x338b2b['forEach'](function(_0x3fff46){_0x34ce72['or'](_0x41dd('0x26'),'%,'+_0x3fff46+',%');});}return _0x34ce72;}function parseReadParameter(_0x34fc8f){var _0x580ea4='';if(_0x34fc8f){_0x580ea4=_0x41dd('0x27');if(_0x34fc8f==='1'){_0x580ea4=_0x580ea4[_0x41dd('0x28')](_0x41dd('0x29'),'=');}else{_0x580ea4=_0x580ea4['replace'](_0x41dd('0x29'),'>');}}return _0x580ea4;}function parseSearchFilter(_0x50b89a,_0x43ea8c){var _0x26d0c5=squel[_0x41dd('0x24')]();if(_0x43ea8c){var _0x45ab2b=_0x43ea8c[_0x41dd('0x28')]('\x5c','\x5c\x5c')[_0x41dd('0x28')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x45ab2b)){_0x26d0c5['or'](_0x41dd('0x2a'),_0x45ab2b+'%');if([_0x41dd('0x2b'),'whatsapp'][_0x41dd('0x2c')](_0x50b89a)){_0x26d0c5['or'](_0x41dd('0x2d'),_0x45ab2b+'%');}else if(_0x50b89a===_0x41dd('0x2e')){_0x26d0c5['or']('i.fax\x20LIKE\x20?',_0x45ab2b+'%');}else if(_0x50b89a===_0x41dd('0x2f')){_0x26d0c5['or'](_0x41dd('0x30'),_0x45ab2b+'%');}}else if(_0x50b89a===_0x41dd('0x31')&&qs[_0x41dd('0x32')](_0x45ab2b)){_0x26d0c5['or'](_0x41dd('0x33'),_0x45ab2b+'%');}else{if(_0x50b89a===_0x41dd('0x31')){_0x26d0c5['or'](_0x41dd('0x34'),qs[_0x41dd('0x35')](_0x45ab2b,!![]))['or'](_0x41dd('0x36'),qs[_0x41dd('0x35')](_0x45ab2b));}else if(_0x50b89a!==_0x41dd('0x2e')){_0x26d0c5['or'](_0x41dd('0x37'),qs[_0x41dd('0x35')](_0x45ab2b));}_0x26d0c5['or'](_0x41dd('0x38'),qs[_0x41dd('0x35')](_0x45ab2b,!![]),null);}}return _0x26d0c5;}function parseAdvancedSearchFilter(_0x3da411,_0x1233b0){var _0x5360b5=getSqlClauses();var _0x563896=as['parseSearch'](_0x3da411);var _0x12ee80=_0x563896[_0x41dd('0x39')];for(var _0x415cf4=0x0;_0x415cf4<_0x563896[_0x41dd('0x3a')][_0x41dd('0x13')];_0x415cf4++){var _0x505b46=_0x563896[_0x41dd('0x3a')][_0x415cf4];var _0x412c83='i';var _0x3dba74=_['find'](_0x1233b0,[_0x41dd('0xa'),_0x505b46[_0x41dd('0x9')]]);if(_0x3dba74){var _0x2f1e3d=as['buildExpression'](_0x412c83,_0x3dba74[_0x41dd('0x3b')],_0x505b46);_0x5360b5[_0x41dd('0x3c')][_0x12ee80](_0x2f1e3d[_0x41dd('0x3d')],_0x2f1e3d[_0x41dd('0x3e')]['start'],_0x2f1e3d['value'][_0x41dd('0x3f')]);}else{switch(_0x505b46['field']){case _0x41dd('0x40'):var _0x4f6e01=parseReadParameter(_0x505b46['value']);_0x5360b5[_0x41dd('0x41')][_0x41dd('0x42')](_0x4f6e01);break;case _0x41dd('0x43'):if(_0x505b46['operator']===_0x41dd('0x44')){if(_0x505b46['value'][_0x41dd('0x45')]('\x20')['length']>0x1){_0x5360b5['contact'][_0x12ee80](_0x41dd('0x38'),qs['getFullTextValue'](_0x505b46[_0x41dd('0x3e')],!![]),null);}else{var _0x20d8bd='%'+_0x505b46[_0x41dd('0x3e')]+'%';_0x5360b5['contact'][_0x12ee80]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x20d8bd,_0x20d8bd,_0x20d8bd);}}else{_0x3dba74=_[_0x41dd('0x46')](_0x1233b0,[_0x41dd('0xa'),'ContactId']);_0x505b46[_0x41dd('0x9')]=_0x41dd('0x47');_0x2f1e3d=as[_0x41dd('0x48')](_0x412c83,_0x3dba74[_0x41dd('0x3b')],_0x505b46);_0x5360b5[_0x41dd('0x49')][_0x12ee80](_0x2f1e3d[_0x41dd('0x3d')],_0x2f1e3d[_0x41dd('0x3e')]['start'],_0x2f1e3d[_0x41dd('0x3e')]['end']);}break;case'Tag':var _0x2840bb=_0x505b46[_0x41dd('0x3e')]['split'](',')[_0x41dd('0x16')](function(_0x52b8ec){return Number(_0x52b8ec);});var _0x4344e8=parseTagParameter(_0x2840bb);_0x5360b5[_0x41dd('0x4a')][_0x41dd('0x4b')][_0x41dd('0x42')](_0x4344e8);_0x5360b5[_0x41dd('0x4a')][_0x41dd('0x4c')]=_0x2840bb;break;case _0x41dd('0x4d'):if(_0x505b46['operator']===_0x41dd('0x44')){_0x5360b5[_0x41dd('0x4e')][_0x12ee80](_0x41dd('0x4f'),'%'+_0x505b46['value']+'%',null);}else{_0x3dba74=_[_0x41dd('0x46')](_0x1233b0,[_0x41dd('0xa'),_0x41dd('0x50')]);_0x505b46[_0x41dd('0x9')]=_0x41dd('0x50');_0x2f1e3d=as[_0x41dd('0x48')](_0x412c83,_0x3dba74[_0x41dd('0x3b')],_0x505b46);_0x5360b5[_0x41dd('0x4e')][_0x12ee80](_0x2f1e3d['text'],_0x2f1e3d[_0x41dd('0x3e')]['start'],_0x2f1e3d[_0x41dd('0x3e')][_0x41dd('0x3f')]);}break;case _0x41dd('0x51'):case _0x41dd('0x52'):_0x2f1e3d=as[_0x41dd('0x48')]('me',null,_0x505b46);_0x5360b5[_0x41dd('0x51')][_0x12ee80](_0x2f1e3d['text'],_0x2f1e3d[_0x41dd('0x3e')][_0x41dd('0x53')],_0x2f1e3d[_0x41dd('0x3e')][_0x41dd('0x3f')]);break;}}}return _0x5360b5;}function parseModelFields(_0xdba0d1,_0x23cf06,_0x3d3e39){var _0x44eb27=utils[_0x41dd('0x18')](_0xdba0d1);var _0x5052ee=squel[_0x41dd('0x24')]();var _0x3de09c=_(_0x23cf06)[_0x41dd('0x54')]()[_0x41dd('0x16')](function(_0x2fbe73){return _[_0x41dd('0x55')](_0x3d3e39,[_0x41dd('0xa'),_0x2fbe73])?_0x2fbe73:undefined;})['compact']()[_0x41dd('0x3e')]();if(_0x3de09c[_0x41dd('0x13')]>0x0){_0x3de09c[_0x41dd('0x56')](function(_0x44f9e8){if(_0x44f9e8===_0x44eb27){_0x5052ee[_0x41dd('0x42')]('i.'+_0x44eb27+_0x41dd('0x15'),[][_0x41dd('0x57')](_0x23cf06[_0x44f9e8]));}else if(_0x44f9e8===_0x41dd('0x58')){var _0xb89a07=JSON[_0x41dd('0x59')](_0x23cf06[_0x44f9e8])[_0x41dd('0x5a')];var _0x16b86f=JSON[_0x41dd('0x59')](_0x23cf06[_0x44f9e8])[_0x41dd('0x5b')];_0x5052ee[_0x41dd('0x42')](_0x41dd('0x5c'),_0xb89a07,_0x16b86f);}else{if(_0x23cf06[_0x44f9e8]===_0x41dd('0x5d')){_0x5052ee[_0x41dd('0x42')]('i.'+_0x44f9e8+_0x41dd('0x5e'));}else{_0x5052ee[_0x41dd('0x42')]('i.'+_0x44f9e8+_0x41dd('0x5f'),_0x23cf06[_0x44f9e8]);}}});}return _0x5052ee;}function parseQueryParameters(_0x3126ba,_0x39c96f,_0x5070c4){var _0x951f46=getSqlClauses();return Promise[_0x41dd('0x60')]()[_0x41dd('0x61')](function(){return parseModelFields(_0x3126ba,_0x39c96f,_0x5070c4);})[_0x41dd('0x61')](function(_0x4d6709){_0x951f46[_0x41dd('0x62')][_0x41dd('0x42')](_0x4d6709);return parseReadParameter(_0x39c96f[_0x41dd('0x41')]);})[_0x41dd('0x61')](function(_0x5a0926){_0x951f46['read'][_0x41dd('0x42')](_0x5a0926);return parseTagParameter(_0x39c96f[_0x41dd('0x63')]);})['then'](function(_0x438896){_0x951f46['tags'][_0x41dd('0x4b')][_0x41dd('0x42')](_0x438896);return parseSearchFilter(_0x3126ba,_0x39c96f[_0x41dd('0x64')]);})[_0x41dd('0x61')](function(_0xfd8bea){_0x951f46['filter']=_0xfd8bea;return _0x951f46;});}function checkAccountsRestrictions(_0x49c148,_0xfb66f0,_0x5191c0){var _0x4f5192=utils[_0x41dd('0x18')](_0x49c148);var _0x27f36d=_0x41dd('0x65')+_[_0x41dd('0x66')](_0x49c148)+(_0x49c148==='chat'?'Websites':_0x41dd('0x67'));var _0x80a10c=squel[_0x41dd('0x24')]();return Promise[_0x41dd('0x60')]()[_0x41dd('0x61')](function(){if(_0x5191c0[_0x41dd('0x7')]&&_0xfb66f0[_0x41dd('0x68')]===_0x41dd('0x6')){return _0xfb66f0[_0x27f36d]({'attributes':['id'],'raw':!![]});}})[_0x41dd('0x61')](function(_0x5f0c11){if(_0x5f0c11){if(_0x5f0c11['length']===0x0){_0x80a10c[_0x41dd('0x42')]('i.'+_0x4f5192+_0x41dd('0x5e'));}else{_0x80a10c[_0x41dd('0x42')]('i.'+_0x4f5192+'\x20IN\x20?',_['map'](_0x5f0c11,'id'));}}else if(!_0x5191c0[_0x4f5192]){_0x80a10c[_0x41dd('0x42')]('i.'+_0x4f5192+_0x41dd('0x69'));}})[_0x41dd('0x61')](function(){return _0x80a10c;});}function getClosedOrderClause(_0x3d40b1,_0x539f47){var _0x134ee5='';var _0x78c17a=['i.thirdDisposition','i.secondDisposition',_0x41dd('0x6a')];if(_0x3d40b1===_0x41dd('0x31')){_0x78c17a[_0x41dd('0x6b')](_0x41dd('0x6c'));}if(_0x539f47['closed']==='0'&&_0x3d40b1==='mail'){_0x134ee5=_0x41dd('0x6c');}else{if(_0x539f47['closed']==='1'){_0x78c17a['shift']();}_0x134ee5=_0x41dd('0x6d')+_0x78c17a['join'](',\x20')+')';}return _0x134ee5;}function getFilteredInteractions(_0x222f5e,_0x1a6d58,_0x470951,_0x2eec9f){var _0x53d4d8=utils['getInteractionFK'](_0x222f5e);var _0x45e37b=_[_0x41dd('0x66')](_0x222f5e)+_0x41dd('0x6e');var _0xdc16dd=[];var _0x1a3b88=getTagsQuery();var _0x2ceed3={'type':db[_0x41dd('0x6f')][_0x41dd('0x70')][_0x41dd('0x71')],'raw':!![]};var _0x5bfe36=[];var _0x2ae0cf=[];return db[_0x41dd('0x72')][_0x41dd('0x73')](_0x1a3b88[_0x41dd('0x74')](),_0x2ceed3)[_0x41dd('0x61')](function(_0x58445e){_0xdc16dd=_[_0x41dd('0x75')](_0x58445e,'id');_0x2ceed3=_[_0x41dd('0x76')](_0x2ceed3,{'model':db[_0x45e37b],'mapToModel':!![],'nest':!![]});if(_0x470951[_0x41dd('0x62')]){_0x2eec9f[_0x41dd('0x77')]['forEach'](function(_0x1f9e7f){_0x1a6d58['field']('i.'+_0x1f9e7f);});}else{_0x1a6d58[_0x41dd('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x41dd('0x40'));_0x1a6d58[_0x41dd('0x9')]('a.key',_0x41dd('0x78'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x79'),_0x41dd('0x7a'));if(_0x222f5e===_0x41dd('0x31')){_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x7b'),_0x41dd('0x7c'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x7d'),_0x41dd('0x7e'));_0x1a6d58[_0x41dd('0x9')]('i.id');_0x1a6d58['field'](_0x41dd('0x7f'));_0x1a6d58['field'](_0x41dd('0x80'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x81'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x82'));_0x1a6d58['field']('i.attach');_0x1a6d58[_0x41dd('0x9')]('i.lastMsgAt');_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x83'));_0x1a6d58['field'](_0x41dd('0x84'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x6a'));_0x1a6d58['field'](_0x41dd('0x85'));_0x1a6d58['field'](_0x41dd('0x86'));_0x1a6d58['field']('i.substatus');_0x1a6d58['field'](_0x41dd('0x87'));_0x1a6d58['field'](_0x41dd('0x88'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x89'));_0x1a6d58[_0x41dd('0x9')]('i.UserId');}else if(_0x222f5e===_0x41dd('0x2f')){_0x1a6d58[_0x41dd('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',_0x41dd('0x7e'));}else{_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x8a'),'contactName');}if(_0x222f5e!==_0x41dd('0x31')){_0x1a6d58[_0x41dd('0x9')]('i.*');}_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x8b'),_0x41dd('0x8c'));_0x1a6d58[_0x41dd('0x9')]('c.lastName','Contact.lastName');_0x1a6d58[_0x41dd('0x9')]('c.email',_0x41dd('0x8d'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x8e'),_0x41dd('0x8f'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x90'),_0x41dd('0x91'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x92'),_0x41dd('0x93'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x94'),_0x41dd('0x95'));_0x1a6d58[_0x41dd('0x9')](_0x41dd('0x96'),_0x41dd('0x97'));_0x1a6d58[_0x41dd('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x41dd('0x98'));}if(_0x2eec9f[_0x41dd('0x99')]){_0x1a6d58['limit'](_0x2eec9f[_0x41dd('0x99')]);}if(_0x2eec9f[_0x41dd('0x9a')]){_0x1a6d58['offset'](_0x2eec9f[_0x41dd('0x9a')]);}return db[_0x41dd('0x72')]['query'](_0x1a6d58[_0x41dd('0x74')](),_0x2ceed3);})[_0x41dd('0x61')](function(_0x522568){_0x5bfe36=_0x522568;var _0x2f21c6=getUsersQuery(_0x222f5e,_0x5bfe36);return db[_0x41dd('0x72')]['query'](_0x2f21c6[_0x41dd('0x74')](),_0x2ceed3);})['then'](function(_0x4b6f0d){_0x2ae0cf=_[_0x41dd('0x9b')](_0x4b6f0d,_0x53d4d8);if(_0x222f5e===_0x41dd('0x31')){return db[_0x41dd('0x9c')][_0x41dd('0x9d')]({'attributes':[_0x41dd('0x9e')],'raw':!![]});}})['then'](function(_0xc79e37){var _0x134461=_0xc79e37?_0xc79e37[_0x41dd('0x9e')]:undefined;var _0x1f36b9=_0x5bfe36[_0x41dd('0x16')](function(_0x27d2c3){return updateInteraction(_0x27d2c3,_0xdc16dd,_0x2ae0cf,_0x134461);});return Promise['all'](_0x1f36b9);});}function countFilteredInteractions(_0x16c378,_0xf0dcce){var _0x1a16f4=_0x16c378[_0x41dd('0x9f')]();_0x1a16f4[_0x41dd('0x9')](_0x41dd('0xa0'));_0x1a16f4[_0x41dd('0x9')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x41dd('0x40'));var _0x551d38=utils[_0x41dd('0x25')](_0xf0dcce);if(!_[_0x41dd('0xa1')](_0x551d38)){_0x1a16f4['where'](_0x41dd('0xa2'),_0x551d38);}var _0x92459b={'type':db[_0x41dd('0x6f')][_0x41dd('0x70')]['SELECT'],'raw':!![]};return db['sequelize'][_0x41dd('0x73')](_0x1a16f4['toString'](),_0x92459b);}module[_0x41dd('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 5eda7b0..05d98c7 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 _0x0f07=['lodash','../../mysqldb','map','fullname','split','forEach','waiting','talking','answered','unmanaged','total','closed','abandoned','UserId','disposition','MailMessage','findOne','out','plainBody','then','trimStart','Users','TagIds','Tags','catch'];(function(_0x517ba8,_0x18537d){var _0x6ad1=function(_0x308ef0){while(--_0x308ef0){_0x517ba8['push'](_0x517ba8['shift']());}};_0x6ad1(++_0x18537d);}(_0x0f07,0x113));var _0x70f0=function(_0x19b122,_0x1e76ee){_0x19b122=_0x19b122-0x0;var _0x2134ac=_0x0f07[_0x19b122];return _0x2134ac;};'use strict';var _=require(_0x70f0('0x0'));var db=require(_0x70f0('0x1'))['db'];function getInteractionUsers(_0x13b71e,_0x432b6c){return new Promise(function(_0x5238b3,_0x21f70f){try{var _0x319dcc=[];if(_0x432b6c[_0x13b71e]){_0x319dcc=_0x432b6c[_0x13b71e][_0x70f0('0x2')](function(_0x1e64a0){return{'id':_0x1e64a0['id'],'fullname':_0x1e64a0[_0x70f0('0x3')]};});}return _0x5238b3(_0x319dcc);}catch(_0xb85607){_0x21f70f(_0xb85607);}});}function getInteractionTags(_0x224c17,_0x94f109){var _0x2d1d3b=[];if(_0x224c17){_0x224c17[_0x70f0('0x4')](',')[_0x70f0('0x5')](function(_0x52afb4){_0x2d1d3b['push'](_0x94f109[_0x52afb4]);});}return _0x2d1d3b;}function updateWaitingCounter(_0x180551){if(_0x180551['waiting']){_0x180551[_0x70f0('0x6')]-=0x1;}}function updateInteractionCounters(_0x47e80b){_0x47e80b[_0x70f0('0x6')]=0x0;_0x47e80b[_0x70f0('0x7')]=0x0;_0x47e80b[_0x70f0('0x8')]=0x0;_0x47e80b[_0x70f0('0x9')]=0x0;_0x47e80b['abandoned']=0x0;_0x47e80b[_0x70f0('0xa')]=0x0;if(_0x47e80b[_0x70f0('0xb')]){if(_0x47e80b['disposition']===_0x70f0('0xc')){_0x47e80b[_0x70f0('0xc')]+=0x1;updateWaitingCounter(_0x47e80b);}if(_0x47e80b[_0x70f0('0xd')]){_0x47e80b[_0x70f0('0x8')]+=0x1;if(_0x47e80b[_0x70f0('0x7')]){_0x47e80b[_0x70f0('0x7')]-=0x1;}}else{if(_0x47e80b[_0x70f0('0xe')]){_0x47e80b[_0x70f0('0x9')]+=0x1;updateWaitingCounter(_0x47e80b);}}}else{if(!_0x47e80b[_0x70f0('0xd')]){_0x47e80b[_0x70f0('0x6')]+=0x1;}if(_0x47e80b['UserId']){_0x47e80b['talking']+=0x1;updateWaitingCounter(_0x47e80b);}}_0x47e80b[_0x70f0('0xa')]+=0x1;return _0x47e80b;}function getLastMessageText(_0x4831bb){return db[_0x70f0('0xf')][_0x70f0('0x10')]({'where':{'$and':[{'MailInteractionId':_0x4831bb['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x70f0('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x70f0('0x12')],'order':'-id','raw':!![]})[_0x70f0('0x13')](function(_0xb3ebfd){if(_0xb3ebfd&&_0xb3ebfd[_0x70f0('0x12')]){_0x4831bb['lastMsgText']=_[_0x70f0('0x14')](_0xb3ebfd[_0x70f0('0x12')]);}return _0x4831bb;})['catch'](function(_0x4cb888){throw _0x4cb888;});}exports['updateInteraction']=function(_0x1efd66,_0x5a207e,_0x389e35,_0x435bb1){return new Promise(function(_0x49eb82,_0x3834f3){return getInteractionUsers(_0x1efd66['id'],_0x389e35)[_0x70f0('0x13')](function(_0x524e42){_0x1efd66[_0x70f0('0x15')]=_0x524e42;return getInteractionTags(_0x1efd66[_0x70f0('0x16')],_0x5a207e);})[_0x70f0('0x13')](function(_0x3218b5){_0x1efd66[_0x70f0('0x17')]=_0x3218b5;delete _0x1efd66[_0x70f0('0x16')];return updateInteractionCounters(_0x1efd66);})[_0x70f0('0x13')](function(_0x5d0c69){if(_0x435bb1){return getLastMessageText(_0x5d0c69);}else{return _0x5d0c69;}})[_0x70f0('0x13')](function(_0xa5a287){_0x49eb82(_0xa5a287);})[_0x70f0('0x18')](function(_0x5b6d43){_0x3834f3(_0x5b6d43);});});}; \ No newline at end of file +var _0x70a0=['catch','updateInteraction','TagIds','Tags','map','push','waiting','answered','unmanaged','abandoned','total','closed','disposition','UserId','talking','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart'];(function(_0x340916,_0x2b1417){var _0x489be0=function(_0x43a51a){while(--_0x43a51a){_0x340916['push'](_0x340916['shift']());}};_0x489be0(++_0x2b1417);}(_0x70a0,0x1d0));var _0x070a=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x70a0[_0x36ed48];return _0x51c63a;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x12abb9,_0x3c1e67){return new Promise(function(_0x5e97d8,_0x5d93c7){try{var _0x58c8ca=[];if(_0x3c1e67[_0x12abb9]){_0x58c8ca=_0x3c1e67[_0x12abb9][_0x070a('0x0')](function(_0x508622){return{'id':_0x508622['id'],'fullname':_0x508622['fullname']};});}return _0x5e97d8(_0x58c8ca);}catch(_0x3152cd){_0x5d93c7(_0x3152cd);}});}function getInteractionTags(_0x12935b,_0x3e1d0d){var _0x3cb159=[];if(_0x12935b){_0x12935b['split'](',')['forEach'](function(_0x3e2b33){_0x3cb159[_0x070a('0x1')](_0x3e1d0d[_0x3e2b33]);});}return _0x3cb159;}function updateWaitingCounter(_0x46f998){if(_0x46f998[_0x070a('0x2')]){_0x46f998['waiting']-=0x1;}}function updateInteractionCounters(_0x577aa9){_0x577aa9['waiting']=0x0;_0x577aa9['talking']=0x0;_0x577aa9[_0x070a('0x3')]=0x0;_0x577aa9[_0x070a('0x4')]=0x0;_0x577aa9[_0x070a('0x5')]=0x0;_0x577aa9[_0x070a('0x6')]=0x0;if(_0x577aa9[_0x070a('0x7')]){if(_0x577aa9[_0x070a('0x8')]==='abandoned'){_0x577aa9[_0x070a('0x5')]+=0x1;updateWaitingCounter(_0x577aa9);}if(_0x577aa9[_0x070a('0x9')]){_0x577aa9[_0x070a('0x3')]+=0x1;if(_0x577aa9[_0x070a('0xa')]){_0x577aa9['talking']-=0x1;}}else{if(_0x577aa9[_0x070a('0x8')]){_0x577aa9[_0x070a('0x4')]+=0x1;updateWaitingCounter(_0x577aa9);}}}else{if(!_0x577aa9[_0x070a('0x9')]){_0x577aa9[_0x070a('0x2')]+=0x1;}if(_0x577aa9[_0x070a('0x9')]){_0x577aa9['talking']+=0x1;updateWaitingCounter(_0x577aa9);}}_0x577aa9[_0x070a('0x6')]+=0x1;return _0x577aa9;}function getLastMessageText(_0x1f2033){return db[_0x070a('0xb')][_0x070a('0xc')]({'where':{'$and':[{'MailInteractionId':_0x1f2033['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x070a('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x070a('0xe')],'order':_0x070a('0xf'),'raw':!![]})[_0x070a('0x10')](function(_0xd4e8d6){if(_0xd4e8d6&&_0xd4e8d6[_0x070a('0xe')]){_0x1f2033[_0x070a('0x11')]=_[_0x070a('0x12')](_0xd4e8d6[_0x070a('0xe')]);}return _0x1f2033;})[_0x070a('0x13')](function(_0x316897){throw _0x316897;});}exports[_0x070a('0x14')]=function(_0x429de0,_0x4c33c0,_0x70b33f,_0x5ebfe3){return new Promise(function(_0x46f39e,_0x11f919){return getInteractionUsers(_0x429de0['id'],_0x70b33f)['then'](function(_0x562940){_0x429de0['Users']=_0x562940;return getInteractionTags(_0x429de0[_0x070a('0x15')],_0x4c33c0);})['then'](function(_0x362d24){_0x429de0[_0x070a('0x16')]=_0x362d24;delete _0x429de0[_0x070a('0x15')];return updateInteractionCounters(_0x429de0);})[_0x070a('0x10')](function(_0x3ea95c){if(_0x5ebfe3){return getLastMessageText(_0x3ea95c);}else{return _0x3ea95c;}})[_0x070a('0x10')](function(_0x350caa){_0x46f39e(_0x350caa);})[_0x070a('0x13')](function(_0x1bf676){_0x11f919(_0x1bf676);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index cd76e31..660e489 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 _0xb7b3=['findOne','then','update','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','InteractionId','upperFirst','unknown','chat','_interactions','user_has_','isArray','toLowerCase','toUpperCase','name','role','stringify','null'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xb7b3,0xdc));var _0x3b7b=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xb7b3[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0x3b7b('0x0'));var db=require(_0x3b7b('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x3b7b('0x2')),'mail':require(_0x3b7b('0x3'))(_0x3b7b('0x4')),'fax':require(_0x3b7b('0x3'))(_0x3b7b('0x5')),'sms':require(_0x3b7b('0x3'))('sms-interactions'),'chat':require(_0x3b7b('0x3'))(_0x3b7b('0x6')),'whatsapp':require(_0x3b7b('0x3'))(_0x3b7b('0x7'))};function getAccountFK(_0x504584){return _[_0x3b7b('0x8')](_0x504584)+(_0x504584==='chat'?_0x3b7b('0x9'):'Account')+'Id';}function getInteractionFK(_0x39a065){return _[_0x3b7b('0x8')](_0x39a065)+_0x3b7b('0xa');}function getInteractionId(_0x297865,_0x1c4869,_0xe71c31){if(_0x297865&&_0x297865[_[_0x3b7b('0xb')](_0xe71c31)+'InteractionId']){return _0x297865[_[_0x3b7b('0xb')](_0xe71c31)+_0x3b7b('0xa')];}else if(_0x297865&&_0x297865['id']){return _0x297865['id'];}else if(_0x1c4869&&_0x1c4869['id']){return _0x1c4869['id'];}else{return _0x3b7b('0xc');}}function getInteractionsTables(_0x62c7bc){return{'accounts':_0x62c7bc+'_'+(_0x62c7bc===_0x3b7b('0xd')?'websites':'accounts'),'interactions':_0x62c7bc+_0x3b7b('0xe'),'interactionsTags':_0x62c7bc+'_interaction_has_tags','messages':_0x62c7bc+'_messages','userInteractions':_0x3b7b('0xf')+_0x62c7bc+_0x3b7b('0xe')};}function getSelectedTags(_0x46f55c){var _0x194365=[];if(_0x46f55c){_0x194365=Array[_0x3b7b('0x10')](_0x46f55c)?_0x46f55c:[_0x46f55c];}return _0x194365;}function log(_0x179085,_0x123e16,_0xf250c2,_0x505447,_0x2a5e20,_0x43f9db){loggers[_0x2a5e20[_0x3b7b('0x11')]()][_0x179085]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x43f9db[_0x3b7b('0x12')](),_0x123e16?_0x123e16['id']:null,_0x123e16?_0x123e16[_0x3b7b('0x13')]:null,_0x123e16?_0x123e16[_0x3b7b('0x14')]:null,getInteractionId(_0xf250c2,_0x505447,_0x2a5e20),_0xf250c2?JSON[_0x3b7b('0x15')](_0xf250c2):_0x3b7b('0x16'));}function updateUser(_0x5b7976,_0x491cbf,_0x5a39c9,_0x5a319c,_0x538310){db[_[_0x3b7b('0xb')](_0x5a319c)+'Interaction'][_0x3b7b('0x17')]({'where':{'id':getInteractionId(_0x491cbf,_0x5a39c9,_0x5a319c)}})[_0x3b7b('0x18')](function(_0xecade8){if(_0xecade8){return _0xecade8[_0x3b7b('0x19')]({'UserId':_0x5b7976?_0x5b7976['id']:null});}})[_0x3b7b('0x18')](function(_0x436968){if(_0x436968){log('info',_0x5b7976,_0x491cbf,_0x5a39c9,_0x5a319c,_0x538310);}})['catch'](function(){log('error',_0x5b7976,_0x491cbf,_0x5a39c9,_0x5a319c,_0x538310);});}module[_0x3b7b('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x2aab=['../../mysqldb','../../config/logger','openchannel-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','upperFirst','InteractionId','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray','toLowerCase','name','role','stringify','null','Interaction','findOne','update','then','info','lodash'];(function(_0x2b3043,_0x1a9e4d){var _0x176d45=function(_0x4f09c0){while(--_0x4f09c0){_0x2b3043['push'](_0x2b3043['shift']());}};_0x176d45(++_0x1a9e4d);}(_0x2aab,0x1bf));var _0xb2aa=function(_0x2d37b3,_0x533ad0){_0x2d37b3=_0x2d37b3-0x0;var _0x9aaac0=_0x2aab[_0x2d37b3];return _0x9aaac0;};'use strict';var _=require(_0xb2aa('0x0'));var db=require(_0xb2aa('0x1'))['db'];var loggers={'openchannel':require(_0xb2aa('0x2'))(_0xb2aa('0x3')),'mail':require(_0xb2aa('0x2'))('mail-interactions'),'fax':require('../../config/logger')('fax-interactions'),'sms':require(_0xb2aa('0x2'))(_0xb2aa('0x4')),'chat':require(_0xb2aa('0x2'))(_0xb2aa('0x5')),'whatsapp':require('../../config/logger')(_0xb2aa('0x6'))};function getAccountFK(_0xc9975){return _[_0xb2aa('0x7')](_0xc9975)+(_0xc9975===_0xb2aa('0x8')?_0xb2aa('0x9'):'Account')+'Id';}function getInteractionFK(_0x38643e){return _[_0xb2aa('0x7')](_0x38643e)+'InteractionId';}function getInteractionId(_0x454b18,_0x197ee3,_0xe159c1){if(_0x454b18&&_0x454b18[_[_0xb2aa('0xa')](_0xe159c1)+_0xb2aa('0xb')]){return _0x454b18[_[_0xb2aa('0xa')](_0xe159c1)+_0xb2aa('0xb')];}else if(_0x454b18&&_0x454b18['id']){return _0x454b18['id'];}else if(_0x197ee3&&_0x197ee3['id']){return _0x197ee3['id'];}else{return'unknown';}}function getInteractionsTables(_0x482e2b){return{'accounts':_0x482e2b+'_'+(_0x482e2b===_0xb2aa('0x8')?_0xb2aa('0xc'):_0xb2aa('0xd')),'interactions':_0x482e2b+_0xb2aa('0xe'),'interactionsTags':_0x482e2b+_0xb2aa('0xf'),'messages':_0x482e2b+'_messages','userInteractions':_0xb2aa('0x10')+_0x482e2b+'_interactions'};}function getSelectedTags(_0x3b5ea1){var _0x4a43ac=[];if(_0x3b5ea1){_0x4a43ac=Array[_0xb2aa('0x11')](_0x3b5ea1)?_0x3b5ea1:[_0x3b5ea1];}return _0x4a43ac;}function log(_0x3d438c,_0x205689,_0x563698,_0x274625,_0xd59406,_0x36c70a){loggers[_0xd59406[_0xb2aa('0x12')]()][_0x3d438c]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x36c70a['toUpperCase'](),_0x205689?_0x205689['id']:null,_0x205689?_0x205689[_0xb2aa('0x13')]:null,_0x205689?_0x205689[_0xb2aa('0x14')]:null,getInteractionId(_0x563698,_0x274625,_0xd59406),_0x563698?JSON[_0xb2aa('0x15')](_0x563698):_0xb2aa('0x16'));}function updateUser(_0x16c2b7,_0x46a603,_0x1d3f68,_0x1b1a10,_0x34892d){db[_[_0xb2aa('0xa')](_0x1b1a10)+_0xb2aa('0x17')][_0xb2aa('0x18')]({'where':{'id':getInteractionId(_0x46a603,_0x1d3f68,_0x1b1a10)}})['then'](function(_0x247c0f){if(_0x247c0f){return _0x247c0f[_0xb2aa('0x19')]({'UserId':_0x16c2b7?_0x16c2b7['id']:null});}})[_0xb2aa('0x1a')](function(_0x664bd5){if(_0x664bd5){log(_0xb2aa('0x1b'),_0x16c2b7,_0x46a603,_0x1d3f68,_0x1b1a10,_0x34892d);}})['catch'](function(){log('error',_0x16c2b7,_0x46a603,_0x1d3f68,_0x1b1a10,_0x34892d);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 7c26d76..1c24e45 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 _0x2ab6=['catch','User','admin','user','isUserLimit','crypto','../../mysqldb','../../config/environment','data1','license','split','createDecipher','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count','status','format'];(function(_0x307b12,_0xa3111a){var _0x289091=function(_0x100d93){while(--_0x100d93){_0x307b12['push'](_0x307b12['shift']());}};_0x289091(++_0xa3111a);}(_0x2ab6,0x10d));var _0x62ab=function(_0x1448d0,_0x26e95a){_0x1448d0=_0x1448d0-0x0;var _0xc68ee1=_0x2ab6[_0x1448d0];return _0xc68ee1;};'use strict';var crypto=require(_0x62ab('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0x62ab('0x1'))['db'];var config=require(_0x62ab('0x2'));function getValueFromLicense(_0x94cb78,_0x18969e){if(_0x94cb78&&_0x18969e){if(_0x18969e[_0x62ab('0x3')]&&_0x18969e[_0x62ab('0x4')]){var _0x3df340=_0x18969e[_0x62ab('0x3')];var _0x37050d=_0x18969e[_0x62ab('0x4')];var _0x310ea6=_0x3df340['split']('-')[0x4];var _0x1807fc=_0x3df340[_0x62ab('0x5')]('-')[0x0];var _0x4a2b6a=crypto[_0x62ab('0x6')]('aes-256-ctr',util['format']('%s:%s:%s',_0x310ea6,_0x3df340,_0x1807fc));var _0x3ad465=_0x4a2b6a[_0x62ab('0x7')](_0x37050d,_0x62ab('0x8'),_0x62ab('0x9'));_0x3ad465+=_0x4a2b6a[_0x62ab('0xa')](_0x62ab('0x9'));var _0x11efd5=JSON[_0x62ab('0xb')](_0x3ad465);return _0x11efd5[_0x62ab('0xc')](_0x94cb78)?_0x11efd5[_0x94cb78]:null;}}return null;}function isLimit(_0xfb5331,_0x85e4d,_0x40750a,_0x20e88e){var _0x30c657=_0x85e4d;return compose()[_0x62ab('0xd')](function(_0x435afc,_0x542354,_0xc1cb71){return db[_0x62ab('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x62ab('0xf')](function(_0x1ae2ff){var _0x2ed1b6=getValueFromLicense(_0xfb5331,_0x1ae2ff);return _0x2ed1b6?_0x2ed1b6:_0x30c657;})['then'](function(_0x34019c){_0x30c657=_0x34019c;return _0x40750a[_0x62ab('0x10')](_0x20e88e);})[_0x62ab('0xf')](function(_0x3d316e){if(_0x3d316e>=_0x30c657){return _0x542354[_0x62ab('0x11')](0x193)['json']({'message':util[_0x62ab('0x12')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0xfb5331)});}_0xc1cb71();})[_0x62ab('0x13')](function(_0x233a44){_0xc1cb71(_0x233a44);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x62ab('0x14')],{'where':{'$or':[{'role':_0x62ab('0x15')},{'role':_0x62ab('0x16')}]}});}exports[_0x62ab('0x17')]=isUserLimit; \ No newline at end of file +var _0x34c1=['use','License','findOne','then','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','update','base64','utf8','final','parse','hasOwnProperty'];(function(_0x4e4519,_0x392ae){var _0x340044=function(_0x11721f){while(--_0x11721f){_0x4e4519['push'](_0x4e4519['shift']());}};_0x340044(++_0x392ae);}(_0x34c1,0x16c));var _0x134c=function(_0x6899c7,_0x363413){_0x6899c7=_0x6899c7-0x0;var _0x5186ee=_0x34c1[_0x6899c7];return _0x5186ee;};'use strict';var crypto=require(_0x134c('0x0'));var util=require(_0x134c('0x1'));var compose=require('composable-middleware');var db=require(_0x134c('0x2'))['db'];var config=require(_0x134c('0x3'));function getValueFromLicense(_0x488814,_0x389d09){if(_0x488814&&_0x389d09){if(_0x389d09[_0x134c('0x4')]&&_0x389d09[_0x134c('0x5')]){var _0x138220=_0x389d09['data1'];var _0x41146a=_0x389d09[_0x134c('0x5')];var _0x5718d6=_0x138220[_0x134c('0x6')]('-')[0x4];var _0x521262=_0x138220['split']('-')[0x0];var _0x32d43c=crypto['createDecipher'](_0x134c('0x7'),util['format']('%s:%s:%s',_0x5718d6,_0x138220,_0x521262));var _0x3a206a=_0x32d43c[_0x134c('0x8')](_0x41146a,_0x134c('0x9'),_0x134c('0xa'));_0x3a206a+=_0x32d43c[_0x134c('0xb')](_0x134c('0xa'));var _0x3e04aa=JSON[_0x134c('0xc')](_0x3a206a);return _0x3e04aa[_0x134c('0xd')](_0x488814)?_0x3e04aa[_0x488814]:null;}}return null;}function isLimit(_0x336bb3,_0x534e2c,_0x423b96,_0x40b13d){var _0x253e63=_0x534e2c;return compose()[_0x134c('0xe')](function(_0x44a9c5,_0x54f446,_0xfa5c4c){return db[_0x134c('0xf')][_0x134c('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x134c('0x11')](function(_0x4b7609){var _0x3ad6dd=getValueFromLicense(_0x336bb3,_0x4b7609);return _0x3ad6dd?_0x3ad6dd:_0x253e63;})[_0x134c('0x11')](function(_0x39da36){_0x253e63=_0x39da36;return _0x423b96['count'](_0x40b13d);})[_0x134c('0x11')](function(_0x410793){if(_0x410793>=_0x253e63){return _0x54f446['status'](0x193)[_0x134c('0x12')]({'message':util[_0x134c('0x13')](_0x134c('0x14'),_0x336bb3)});}_0xfa5c4c();})[_0x134c('0x15')](function(_0x2fd135){_0xfa5c4c(_0x2fd135);});});}function isUserLimit(){return isLimit(_0x134c('0x16'),0x1,db[_0x134c('0x17')],{'where':{'$or':[{'role':_0x134c('0x18')},{'role':_0x134c('0x19')}]}});}exports[_0x134c('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index adeb941..05c0155 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 _0xd986=['castTo','text','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','utcOffset','hours','minutes','lodash','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','add','days','format'];(function(_0x4d3ce1,_0x328866){var _0xfba003=function(_0x28ff8f){while(--_0x28ff8f){_0x4d3ce1['push'](_0x4d3ce1['shift']());}};_0xfba003(++_0x328866);}(_0xd986,0x123));var _0x6d98=function(_0x97de28,_0x243e31){_0x97de28=_0x97de28-0x0;var _0x17cd18=_0xd986[_0x97de28];return _0x17cd18;};'use strict';var _=require(_0x6d98('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x38b054){var _0x5359d8={'conditions':[]};_0x5359d8[_0x6d98('0x1')]=_[_0x6d98('0x2')](_0x38b054,_0x6d98('0x3'))?'or':_0x6d98('0x4');var _0x3abeaf=_0x38b054[_0x6d98('0x5')](_0x6d98('0x6'),'')[_0x6d98('0x5')](_0x6d98('0x3'),'')[_0x6d98('0x7')]('||');for(var _0x38785e=0x0;_0x38785e<_0x3abeaf[_0x6d98('0x8')];_0x38785e++){var _0x342fce=_0x3abeaf[_0x38785e][_0x6d98('0x7')](':=');var _0x1908aa=_0x342fce[0x0];var _0x11a3ba=_0x342fce[_0x6d98('0x9')](0x1);_0x11a3ba[_0x6d98('0xa')](function(_0x22ac4e){var _0x69c973=_0x22ac4e['split']('[')['shift']();var _0x219fe7=_0x22ac4e[_0x6d98('0xb')](/\[(.*?)\]/g);_0x219fe7[_0x6d98('0xa')](function(_0x5d5591){var _0x40f29f=_0x5d5591[_0x6d98('0x7')]('[')[_0x6d98('0xc')](function(_0x1490f3){return _0x1490f3[_0x6d98('0xd')](']')>-0x1;})[_0x6d98('0xe')](function(_0x2723b8){return _0x2723b8[_0x6d98('0x7')](']')[0x0];})[0x0];_0x5359d8[_0x6d98('0xf')][_0x6d98('0x10')]({'field':_0x1908aa,'operator':_0x69c973,'value':_0x40f29f});});});}return _0x5359d8;};exports[_0x6d98('0x11')]=function(_0x3ee859,_0x478bf9,_0x4ead59){var _0x11055d={};if(_0x478bf9===_0x6d98('0x12')){if(_0x4ead59[_0x6d98('0x13')]===_0x6d98('0x14')){_0x4ead59[_0x6d98('0x13')]='$between';_0x4ead59['value']+=','+_0x4ead59[_0x6d98('0x15')];}else if(_[_0x6d98('0x16')]([_0x6d98('0x17'),'$lte'],_0x4ead59[_0x6d98('0x13')])){_0x4ead59[_0x6d98('0x15')]=moment(_0x4ead59[_0x6d98('0x15')])[_0x6d98('0x18')](0x1,_0x6d98('0x19'))[_0x6d98('0x1a')]('YYYY-MM-DD');}}if(_0x4ead59[_0x6d98('0x1b')]){_0x478bf9=_0x4ead59[_0x6d98('0x1b')];_0x11055d[_0x6d98('0x1c')]='CAST('+_0x3ee859+'.'+_0x4ead59['field']+_0x6d98('0x1d')+_0x4ead59['castTo']+')\x20'+parseOperator(_0x4ead59[_0x6d98('0x13')]);}else{_0x11055d[_0x6d98('0x1c')]=_0x3ee859+'.'+_0x4ead59[_0x6d98('0x1e')]+'\x20'+parseOperator(_0x4ead59['operator']);}if(_['includes']([_0x6d98('0x1f'),_0x6d98('0x20')],_0x4ead59[_0x6d98('0x13')]))_0x11055d[_0x6d98('0x1c')]='('+_0x11055d[_0x6d98('0x1c')]+_0x6d98('0x21')+_0x3ee859+'.'+_0x4ead59[_0x6d98('0x1e')]+_0x6d98('0x22');_0x11055d[_0x6d98('0x15')]=parseValue(_0x478bf9,_0x4ead59[_0x6d98('0x13')],_0x4ead59[_0x6d98('0x15')]);return _0x11055d;};function parseOperator(_0x2bc6f7){var _0x16e224;switch(_0x2bc6f7){case _0x6d98('0x23'):_0x16e224=_0x6d98('0x24');break;case'$notIn':_0x16e224='NOT\x20IN\x20?';break;case _0x6d98('0x14'):_0x16e224=_0x6d98('0x25');break;case _0x6d98('0x1f'):_0x16e224='<>\x20?';break;case _0x6d98('0x26'):case _0x6d98('0x27'):case _0x6d98('0x28'):_0x16e224='LIKE\x20?';break;case _0x6d98('0x29'):_0x16e224=_0x6d98('0x2a');break;case _0x6d98('0x17'):_0x16e224=_0x6d98('0x2b');break;case'$lte':_0x16e224=_0x6d98('0x2c');break;case _0x6d98('0x2d'):_0x16e224=_0x6d98('0x2e');break;case'$between':_0x16e224=_0x6d98('0x2f');break;}return _0x16e224;}function parseValue(_0x23eeb0,_0x400c2d,_0x4b69bd){var _0x5c88ba={'start':undefined,'end':undefined};switch(_0x400c2d){case _0x6d98('0x23'):case'$notIn':_0x5c88ba['start']=_0x4b69bd[_0x6d98('0x7')](',');break;case _0x6d98('0x26'):_0x5c88ba['start']='%'+_0x4b69bd+'%';break;case _0x6d98('0x27'):_0x5c88ba[_0x6d98('0x30')]=_0x4b69bd+'%';break;case _0x6d98('0x28'):_0x5c88ba['start']='%'+_0x4b69bd;break;case'$between':var _0x240cba=_0x4b69bd[_0x6d98('0x7')](',');var _0x4b69bd=_0x240cba[_0x6d98('0x31')]();var _0x118b02=_0x240cba['pop']();if(_0x23eeb0===_0x6d98('0x12')){_0x4b69bd=moment(_0x4b69bd)[_0x6d98('0x32')](0x0,!![])[_0x6d98('0x1a')]();_0x118b02=moment(_0x118b02)[_0x6d98('0x32')](0x0,!![])[_0x6d98('0x18')](0x17,_0x6d98('0x33'))[_0x6d98('0x18')](0x3b,_0x6d98('0x34'))[_0x6d98('0x18')](0x3b,'seconds')[_0x6d98('0x1a')]();}_0x5c88ba={'start':_0x4b69bd,'end':_0x118b02};break;default:_0x5c88ba[_0x6d98('0x30')]=_0x4b69bd;break;}return _0x5c88ba;} \ No newline at end of file +var _0xb24a=['utcOffset','hours','minutes','seconds','lodash','moment','startsWith','[$or]','and','replace','split','shift','forEach','filter','indexOf','map','push','buildExpression','DATE','operator','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$startsWith','LIKE\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$substring','$endsWith','pop'];(function(_0x11c703,_0x17b6ea){var _0x45136d=function(_0x4930af){while(--_0x4930af){_0x11c703['push'](_0x11c703['shift']());}};_0x45136d(++_0x17b6ea);}(_0xb24a,0xe0));var _0xab24=function(_0x385eb1,_0x497a94){_0x385eb1=_0x385eb1-0x0;var _0x5d40eb=_0xb24a[_0x385eb1];return _0x5d40eb;};'use strict';var _=require(_0xab24('0x0'));var moment=require(_0xab24('0x1'));exports['parseSearch']=function(_0xa50cc5){var _0x53f10c={'conditions':[]};_0x53f10c['sqlOperator']=_[_0xab24('0x2')](_0xa50cc5,_0xab24('0x3'))?'or':_0xab24('0x4');var _0x2989f7=_0xa50cc5[_0xab24('0x5')]('[$and]','')[_0xab24('0x5')](_0xab24('0x3'),'')[_0xab24('0x6')]('||');for(var _0x3c346c=0x0;_0x3c346c<_0x2989f7['length'];_0x3c346c++){var _0xdd0def=_0x2989f7[_0x3c346c]['split'](':=');var _0x343d75=_0xdd0def[0x0];var _0x269331=_0xdd0def['slice'](0x1);_0x269331['forEach'](function(_0x3a289a){var _0x273bec=_0x3a289a[_0xab24('0x6')]('[')[_0xab24('0x7')]();var _0x47baf0=_0x3a289a['match'](/\[(.*?)\]/g);_0x47baf0[_0xab24('0x8')](function(_0x45cc4b){var _0x18cd4f=_0x45cc4b[_0xab24('0x6')]('[')[_0xab24('0x9')](function(_0x283d29){return _0x283d29[_0xab24('0xa')](']')>-0x1;})[_0xab24('0xb')](function(_0x4d1110){return _0x4d1110[_0xab24('0x6')](']')[0x0];})[0x0];_0x53f10c['conditions'][_0xab24('0xc')]({'field':_0x343d75,'operator':_0x273bec,'value':_0x18cd4f});});});}return _0x53f10c;};exports[_0xab24('0xd')]=function(_0x43967a,_0x3c28b3,_0x4d18be){var _0x39e2df={};if(_0x3c28b3===_0xab24('0xe')){if(_0x4d18be[_0xab24('0xf')]==='$eq'){_0x4d18be['operator']='$between';_0x4d18be[_0xab24('0x10')]+=','+_0x4d18be[_0xab24('0x10')];}else if(_['includes']([_0xab24('0x11'),_0xab24('0x12')],_0x4d18be[_0xab24('0xf')])){_0x4d18be['value']=moment(_0x4d18be['value'])[_0xab24('0x13')](0x1,_0xab24('0x14'))[_0xab24('0x15')](_0xab24('0x16'));}}if(_0x4d18be[_0xab24('0x17')]){_0x3c28b3=_0x4d18be[_0xab24('0x17')];_0x39e2df[_0xab24('0x18')]=_0xab24('0x19')+_0x43967a+'.'+_0x4d18be[_0xab24('0x1a')]+_0xab24('0x1b')+_0x4d18be[_0xab24('0x17')]+')\x20'+parseOperator(_0x4d18be[_0xab24('0xf')]);}else{_0x39e2df[_0xab24('0x18')]=_0x43967a+'.'+_0x4d18be[_0xab24('0x1a')]+'\x20'+parseOperator(_0x4d18be[_0xab24('0xf')]);}if(_[_0xab24('0x1c')]([_0xab24('0x1d'),_0xab24('0x1e')],_0x4d18be[_0xab24('0xf')]))_0x39e2df[_0xab24('0x18')]='('+_0x39e2df[_0xab24('0x18')]+_0xab24('0x1f')+_0x43967a+'.'+_0x4d18be[_0xab24('0x1a')]+_0xab24('0x20');_0x39e2df[_0xab24('0x10')]=parseValue(_0x3c28b3,_0x4d18be[_0xab24('0xf')],_0x4d18be[_0xab24('0x10')]);return _0x39e2df;};function parseOperator(_0x5bb1e7){var _0x340443;switch(_0x5bb1e7){case _0xab24('0x21'):_0x340443=_0xab24('0x22');break;case _0xab24('0x1e'):_0x340443=_0xab24('0x23');break;case _0xab24('0x24'):_0x340443=_0xab24('0x25');break;case'$ne':_0x340443=_0xab24('0x26');break;case'$substring':case _0xab24('0x27'):case'$endsWith':_0x340443=_0xab24('0x28');break;case'$lt':_0x340443='<\x20?';break;case _0xab24('0x11'):_0x340443=_0xab24('0x29');break;case _0xab24('0x12'):_0x340443=_0xab24('0x2a');break;case _0xab24('0x2b'):_0x340443=_0xab24('0x2c');break;case _0xab24('0x2d'):_0x340443=_0xab24('0x2e');break;}return _0x340443;}function parseValue(_0x3a8a79,_0x5b1c1c,_0xfec1ae){var _0x39bdb3={'start':undefined,'end':undefined};switch(_0x5b1c1c){case _0xab24('0x21'):case _0xab24('0x1e'):_0x39bdb3[_0xab24('0x2f')]=_0xfec1ae[_0xab24('0x6')](',');break;case _0xab24('0x30'):_0x39bdb3['start']='%'+_0xfec1ae+'%';break;case _0xab24('0x27'):_0x39bdb3[_0xab24('0x2f')]=_0xfec1ae+'%';break;case _0xab24('0x31'):_0x39bdb3[_0xab24('0x2f')]='%'+_0xfec1ae;break;case _0xab24('0x2d'):var _0x563c47=_0xfec1ae[_0xab24('0x6')](',');var _0xfec1ae=_0x563c47[_0xab24('0x7')]();var _0x2b38f=_0x563c47[_0xab24('0x32')]();if(_0x3a8a79==='DATE'){_0xfec1ae=moment(_0xfec1ae)[_0xab24('0x33')](0x0,!![])['format']();_0x2b38f=moment(_0x2b38f)[_0xab24('0x33')](0x0,!![])[_0xab24('0x13')](0x17,_0xab24('0x34'))[_0xab24('0x13')](0x3b,_0xab24('0x35'))[_0xab24('0x13')](0x3b,_0xab24('0x36'))['format']();}_0x39bdb3={'start':_0xfec1ae,'end':_0x2b38f};break;default:_0x39bdb3[_0xab24('0x2f')]=_0xfec1ae;break;}return _0x39bdb3;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 222da3f..b737ec1 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 _0x4534=['limit','offset','map','priority','cast','col','substr','unsigned','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','filters','intersection','attributes','nolimit','sort','where','pick','filter','object','columns','value','lower','merge','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','model','alias','fields','raw','split','isEmpty','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray'];(function(_0x210319,_0x2bbbca){var _0x1c1284=function(_0x4a98d2){while(--_0x4a98d2){_0x210319['push'](_0x210319['shift']());}};_0x1c1284(++_0x2bbbca);}(_0x4534,0x141));var _0x4453=function(_0x349871,_0x12a5cc){_0x349871=_0x349871-0x0;var _0x101f0f=_0x4534[_0x349871];return _0x101f0f;};'use strict';var _=require(_0x4453('0x0'));var sequelize=require(_0x4453('0x1'));var moment=require(_0x4453('0x2'));var db=require(_0x4453('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x516e12){var _0x46eaf1=['ne'];try{var _0x2339f6=JSON[_0x4453('0x4')](_0x516e12);var _0x26bdae=Object['keys'](_0x2339f6)[0x0];return _0x46eaf1['includes'](_0x26bdae);}catch(_0xfa8819){return![];}}function getOperatorValue(_0x456815){var _0x25bf80=JSON[_0x4453('0x4')](_0x456815);var _0x14092d=Object[_0x4453('0x5')](_0x25bf80)[0x0];var _0x1e649b=_0x25bf80[_0x14092d];return{['$'+_0x14092d]:_0x1e649b};}function parseIncludeModel(_0x230dc8){var _0x5c684a=JSON[_0x4453('0x4')](_0x230dc8);return{'model':db[_0x5c684a[_0x4453('0x6')]],'as':_0x5c684a[_0x4453('0x7')],'attributes':_0x5c684a[_0x4453('0x8')],'raw':_0x5c684a[_0x4453('0x9')]};}exports[_0x4453('0x8')]=function(_0x597907){var _0x5651bb=null;if(_0x597907){_0x5651bb=_0x597907[_0x4453('0xa')](',');}return _0x5651bb;};exports['filters']=function(_0x2b9b12,_0x5d795b){var _0x550039={};if(!_[_0x4453('0xb')](_0x2b9b12)){_['forOwn'](_0x2b9b12,function(_0x5019ce,_0x4d076d){try{if(_0x5d795b){var _0x834f05=_[_0x4453('0xc')](_0x5d795b,{'name':_0x4d076d})||{};if(hasSequelizeOperator(_0x5019ce)){_0x550039[_0x4d076d]=getOperatorValue(_0x5019ce);}else if(_0x834f05[_0x4453('0xd')]===_0x4453('0xe')&&_[_0x4453('0xf')](_0x5019ce)){var _0x3f2884=JSON[_0x4453('0x4')](_0x5019ce);var _0x40c574={'$gte':moment(moment(_0x3f2884[_0x4453('0x10')])['format'](_0x4453('0x11')))[_0x4453('0x12')]()[_0x4453('0x13')](),'$lte':moment(moment(_0x3f2884['$lte'])[_0x4453('0x13')]('YYYY-MM-DD'))[_0x4453('0x12')]()[_0x4453('0x14')](0x1,'s')['format']()};_0x550039[_0x4d076d]=_0x40c574;}else if(_0x834f05[_0x4453('0x15')]===_0x4453('0x16')){_0x550039[_0x4d076d]=_0x5019ce;}else{_0x550039[_0x4d076d]=_[_0x4453('0x17')](_0x5019ce)?_0x5019ce:JSON[_0x4453('0x4')](_0x5019ce);}}else{_0x550039[_0x4d076d]=_[_0x4453('0x17')](_0x5019ce)?_0x5019ce:JSON[_0x4453('0x4')](_0x5019ce);}}catch(_0x4a2ccc){_0x550039[_0x4d076d]=_0x5019ce[_0x4453('0xa')](',');}});}return _0x550039;};exports[_0x4453('0x18')]=function(_0x3a20d8){_0x3a20d8=parseInt(_0x3a20d8,0xa);if(!_0x3a20d8||_0x3a20d8<0x0){_0x3a20d8=LIMIT_VALUE;}return _0x3a20d8;};exports[_0x4453('0x19')]=function(_0x4b0162){_0x4b0162=parseInt(_0x4b0162,0xa);if(!_0x4b0162||_0x4b0162<0x0){_0x4b0162=0x0;}return _0x4b0162;};exports['sort']=function(_0x4a8a4f){var _0x114b8e,_0x3e53f5=null;if(_0x4a8a4f){_0x114b8e=_0x4a8a4f[_0x4453('0xa')](',');_0x3e53f5=_[_0x4453('0x1a')](_0x114b8e,function(_0x8e8ce){if(_0x8e8ce['indexOf']('-')===0x0){return[_0x8e8ce===_0x4453('0x1b')?sequelize[_0x4453('0x1c')](sequelize[_0x4453('0x1d')](_0x4453('0x1b')),'unsigned'):_0x8e8ce[_0x4453('0x1e')](0x1),'DESC'];}else{return[_0x8e8ce===_0x4453('0x1b')?sequelize[_0x4453('0x1c')](sequelize[_0x4453('0x1d')](_0x4453('0x1b')),_0x4453('0x1f')):_0x8e8ce,_0x4453('0x20')];}});}return _0x3e53f5;};exports[_0x4453('0x21')]=function(_0x54ec88,_0x590143){if(_[_0x4453('0xb')](_0x54ec88)){return _0x54ec88;}if(_['isArray'](_0x54ec88)){for(var _0x430ca6=0x0;_0x430ca6<_0x54ec88[_0x4453('0x22')];_0x430ca6+=0x1){_0x54ec88[_0x430ca6]=this[_0x4453('0x21')](_0x54ec88[_0x430ca6],_0x590143);}return _0x54ec88;}if(!_[_0x4453('0x23')](_0x54ec88)){return _0x54ec88;}if(_[_0x4453('0x24')](_0x590143)){_0x590143=[_0x590143];}if(!_[_0x4453('0x17')](_0x590143)){return _0x54ec88;}for(var _0x4420ee=0x0;_0x4420ee<_0x590143[_0x4453('0x22')];_0x4420ee+=0x1){_[_0x4453('0x25')](_0x54ec88,_0x590143[_0x4420ee]);}for(var _0x423968 in _0x54ec88){if(_0x54ec88[_0x4453('0x26')](_0x423968)){_0x54ec88[_0x423968]=this[_0x4453('0x21')](_0x54ec88[_0x423968],_0x590143);}}return _0x54ec88;};exports[_0x4453('0x27')]=function(_0xd70da2){return _0xd70da2[_0x4453('0x28')](RegExp(_0x4453('0x29')))?!![]:![];};exports[_0x4453('0x2a')]=function(_0x5456d3){return _0x5456d3[_0x4453('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x4453('0x2b')]=function(_0x2206eb,_0x39f8ac){var _0x3f8dc7=[];var _0x362fce=/[ `!@#$%^&*()_\-?~]/;var _0x3d85dc=_0x39f8ac?_0x4453('0x2c'):_0x4453('0x2d');_0x2206eb[_0x4453('0xa')](/[ ,]+/)[_0x4453('0x2e')](function(_0x4e608e){_0x4e608e=_0x4e608e[_0x4453('0x2f')](/([^:]")"+/g,'$1');_0x4e608e='+'+_0x4e608e+'*';var _0xb20a9=_0x4e608e[_0x4453('0x28')](_0x362fce);if(_0xb20a9){_0x4e608e='\x22'+_0x4e608e+'\x22';}_0x3f8dc7[_0x4453('0x30')](_0x4e608e);});_0x3d85dc=_0x3d85dc[_0x4453('0x2f')](_0x4453('0x2d'),_0x3f8dc7[_0x4453('0x31')]('\x20'));return _0x3d85dc;};exports[_0x4453('0x32')]=function(_0x10b745,_0x45f961,_0x50eeca){var _0x3f0736={},_0x163dfa={};if(_0x45f961[_0x4453('0x33')][_0x4453('0x34')]){_0x45f961[_0x4453('0x33')]['id']=_0x45f961[_0x4453('0x33')][_0x4453('0x34')];delete _0x45f961[_0x4453('0x33')][_0x4453('0x34')];}_0x3f0736[_0x4453('0x6')]=_[_0x4453('0x1a')](_0x10b745,_0x4453('0x15'));_0x3f0736[_0x4453('0x33')]=_[_0x4453('0x5')](_0x45f961['query']);_0x3f0736[_0x4453('0x35')]=_[_0x4453('0x36')](_0x3f0736[_0x4453('0x6')],_0x3f0736[_0x4453('0x33')]);_0x163dfa[_0x4453('0x37')]=_['intersection'](_0x3f0736[_0x4453('0x6')],this[_0x4453('0x8')](_0x45f961['query'][_0x4453('0x8')]));_0x163dfa[_0x4453('0x37')]=_0x163dfa['attributes'][_0x4453('0x22')]?_0x163dfa[_0x4453('0x37')]:_0x3f0736[_0x4453('0x6')];if(!_0x45f961['query'][_0x4453('0x26')](_0x4453('0x38'))){_0x163dfa[_0x4453('0x18')]=this[_0x4453('0x18')](_0x45f961[_0x4453('0x33')][_0x4453('0x18')]);_0x163dfa[_0x4453('0x19')]=this[_0x4453('0x19')](_0x45f961[_0x4453('0x33')][_0x4453('0x19')]);}_0x163dfa['order']=this[_0x4453('0x39')](_0x45f961[_0x4453('0x33')][_0x4453('0x39')]);_0x163dfa[_0x4453('0x3a')]=this[_0x4453('0x35')](_[_0x4453('0x3b')](_0x45f961['query'],_0x3f0736[_0x4453('0x35')]),_0x10b745);if(_0x45f961['query'][_0x4453('0x3c')]){var _0x1f64a4=_0x10b745;var _0x4172c8=_0x45f961['query'][_0x4453('0x3c')];if(typeof _0x4172c8===_0x4453('0x3d')){_0x1f64a4=_[_0x4453('0x3c')](_0x10b745,function(_0x5106a9){return _['includes'](_0x4172c8[_0x4453('0x3e')],_0x5106a9['name']);});_0x4172c8=_0x4172c8[_0x4453('0x3f')];}_0x163dfa[_0x4453('0x3a')]=_['merge'](_0x163dfa[_0x4453('0x3a')],{'$or':_[_0x4453('0x1a')](_0x1f64a4,function(_0x121b8a){if(_0x121b8a[_0x4453('0xd')]!=='VIRTUAL'){if(_0x50eeca){return sequelize['where'](sequelize['fn'](_0x4453('0x40'),sequelize[_0x4453('0x1d')](_0x121b8a[_0x4453('0x15')])),{'$like':sequelize['fn']('lower','%'+_0x45f961[_0x4453('0x33')][_0x4453('0x3c')]+'%')});}else{var _0x11d545={};_0x11d545[_0x121b8a['name']]={'$like':'%'+_0x45f961[_0x4453('0x33')]['filter']+'%'};return _0x11d545;}}})});}_0x163dfa=_[_0x4453('0x41')]({},_0x163dfa,_0x45f961[_0x4453('0x42')]);return _0x163dfa;};exports[_0x4453('0x43')]=function(_0x2e67bd){var _0x28e3a1=[];if(_0x2e67bd[_0x4453('0x44')]){_0x28e3a1[_0x4453('0x30')]({'all':!![]});}else if(_0x2e67bd[_0x4453('0x43')]){if(Array[_0x4453('0x17')](_0x2e67bd[_0x4453('0x43')])){_0x28e3a1=Object[_0x4453('0x5')](_0x2e67bd['include'])['map'](function(_0x307a63){return parseIncludeModel(_0x2e67bd['include'][_0x307a63]);});}else{var _0x238e38=parseIncludeModel(_0x2e67bd['include']);_0x28e3a1['push'](_0x238e38);}}return _0x28e3a1;}; \ No newline at end of file +var _0xdd50=['unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','{EXPR}','join','getOptions','query','$id','model','keys','filters','intersection','attributes','nolimit','order','where','pick','filter','object','columns','value','VIRTUAL','lower','merge','options','include','includeAll','sequelize','moment','../../mysqldb','parse','alias','fields','raw','split','isEmpty','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','substr','DESC','col','unsigned','ASC','omit','length','isString'];(function(_0x475022,_0x1ce40b){var _0x2259c8=function(_0x4d88b2){while(--_0x4d88b2){_0x475022['push'](_0x475022['shift']());}};_0x2259c8(++_0x1ce40b);}(_0xdd50,0x172));var _0x0dd5=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0xdd50[_0x1655bb];return _0x5e2020;};'use strict';var _=require('lodash');var sequelize=require(_0x0dd5('0x0'));var moment=require(_0x0dd5('0x1'));var db=require(_0x0dd5('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x36ae3d){var _0x129bde=['ne'];try{var _0x12af99=JSON['parse'](_0x36ae3d);var _0x51d2d8=Object['keys'](_0x12af99)[0x0];return _0x129bde['includes'](_0x51d2d8);}catch(_0x27ea09){return![];}}function getOperatorValue(_0x4f6b13){var _0x9471f5=JSON[_0x0dd5('0x3')](_0x4f6b13);var _0x91b1a=Object['keys'](_0x9471f5)[0x0];var _0x122096=_0x9471f5[_0x91b1a];return{['$'+_0x91b1a]:_0x122096};}function parseIncludeModel(_0x27611e){var _0x3036fe=JSON['parse'](_0x27611e);return{'model':db[_0x3036fe['model']],'as':_0x3036fe[_0x0dd5('0x4')],'attributes':_0x3036fe[_0x0dd5('0x5')],'raw':_0x3036fe[_0x0dd5('0x6')]};}exports['fields']=function(_0x574b2e){var _0x194b50=null;if(_0x574b2e){_0x194b50=_0x574b2e[_0x0dd5('0x7')](',');}return _0x194b50;};exports['filters']=function(_0x49c5e0,_0x310a22){var _0x320b20={};if(!_[_0x0dd5('0x8')](_0x49c5e0)){_['forOwn'](_0x49c5e0,function(_0x7997d6,_0x4a3edd){try{if(_0x310a22){var _0x165175=_['find'](_0x310a22,{'name':_0x4a3edd})||{};if(hasSequelizeOperator(_0x7997d6)){_0x320b20[_0x4a3edd]=getOperatorValue(_0x7997d6);}else if(_0x165175[_0x0dd5('0x9')]===_0x0dd5('0xa')&&_[_0x0dd5('0xb')](_0x7997d6)){var _0x1afc50=JSON[_0x0dd5('0x3')](_0x7997d6);var _0x259654={'$gte':moment(moment(_0x1afc50['$gte'])[_0x0dd5('0xc')](_0x0dd5('0xd')))[_0x0dd5('0xe')]()[_0x0dd5('0xc')](),'$lte':moment(moment(_0x1afc50['$lte'])[_0x0dd5('0xc')](_0x0dd5('0xd')))[_0x0dd5('0xe')]()['subtract'](0x1,'s')[_0x0dd5('0xc')]()};_0x320b20[_0x4a3edd]=_0x259654;}else if(_0x165175[_0x0dd5('0xf')]===_0x0dd5('0x10')){_0x320b20[_0x4a3edd]=_0x7997d6;}else{_0x320b20[_0x4a3edd]=_[_0x0dd5('0x11')](_0x7997d6)?_0x7997d6:JSON[_0x0dd5('0x3')](_0x7997d6);}}else{_0x320b20[_0x4a3edd]=_[_0x0dd5('0x11')](_0x7997d6)?_0x7997d6:JSON[_0x0dd5('0x3')](_0x7997d6);}}catch(_0x50cc2c){_0x320b20[_0x4a3edd]=_0x7997d6[_0x0dd5('0x7')](',');}});}return _0x320b20;};exports[_0x0dd5('0x12')]=function(_0x5cae24){_0x5cae24=parseInt(_0x5cae24,0xa);if(!_0x5cae24||_0x5cae24<0x0){_0x5cae24=LIMIT_VALUE;}return _0x5cae24;};exports[_0x0dd5('0x13')]=function(_0x2f2b70){_0x2f2b70=parseInt(_0x2f2b70,0xa);if(!_0x2f2b70||_0x2f2b70<0x0){_0x2f2b70=0x0;}return _0x2f2b70;};exports[_0x0dd5('0x14')]=function(_0x2c8eca){var _0x20c7a2,_0x4b2539=null;if(_0x2c8eca){_0x20c7a2=_0x2c8eca[_0x0dd5('0x7')](',');_0x4b2539=_[_0x0dd5('0x15')](_0x20c7a2,function(_0x3998b7){if(_0x3998b7[_0x0dd5('0x16')]('-')===0x0){return[_0x3998b7===_0x0dd5('0x17')?sequelize['cast'](sequelize['col'](_0x0dd5('0x17')),'unsigned'):_0x3998b7[_0x0dd5('0x18')](0x1),_0x0dd5('0x19')];}else{return[_0x3998b7===_0x0dd5('0x17')?sequelize['cast'](sequelize[_0x0dd5('0x1a')]('priority'),_0x0dd5('0x1b')):_0x3998b7,_0x0dd5('0x1c')];}});}return _0x4b2539;};exports[_0x0dd5('0x1d')]=function(_0x36f852,_0x36132f){if(_[_0x0dd5('0x8')](_0x36f852)){return _0x36f852;}if(_[_0x0dd5('0x11')](_0x36f852)){for(var _0x16cf0b=0x0;_0x16cf0b<_0x36f852[_0x0dd5('0x1e')];_0x16cf0b+=0x1){_0x36f852[_0x16cf0b]=this[_0x0dd5('0x1d')](_0x36f852[_0x16cf0b],_0x36132f);}return _0x36f852;}if(!_['isObject'](_0x36f852)){return _0x36f852;}if(_[_0x0dd5('0x1f')](_0x36132f)){_0x36132f=[_0x36132f];}if(!_[_0x0dd5('0x11')](_0x36132f)){return _0x36f852;}for(var _0x134a50=0x0;_0x134a50<_0x36132f[_0x0dd5('0x1e')];_0x134a50+=0x1){_[_0x0dd5('0x20')](_0x36f852,_0x36132f[_0x134a50]);}for(var _0x5ac12e in _0x36f852){if(_0x36f852[_0x0dd5('0x21')](_0x5ac12e)){_0x36f852[_0x5ac12e]=this['omit'](_0x36f852[_0x5ac12e],_0x36132f);}}return _0x36f852;};exports[_0x0dd5('0x22')]=function(_0x44efc1){return _0x44efc1['match'](RegExp(_0x0dd5('0x23')))?!![]:![];};exports[_0x0dd5('0x24')]=function(_0x5d39e0){return _0x5d39e0[_0x0dd5('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x0dd5('0x26')]=function(_0x30a414,_0x51adbd){var _0xabd4a5=[];var _0x3e8853=/[ `!@#$%^&*()_\-?~]/;var _0x278079=_0x51adbd?_0x0dd5('0x27'):'{EXPR}';_0x30a414[_0x0dd5('0x7')](/[ ,]+/)[_0x0dd5('0x28')](function(_0x265bf6){_0x265bf6=_0x265bf6[_0x0dd5('0x29')](/([^:]")"+/g,'$1');_0x265bf6='+'+_0x265bf6+'*';var _0x5c7e82=_0x265bf6[_0x0dd5('0x25')](_0x3e8853);if(_0x5c7e82){_0x265bf6='\x22'+_0x265bf6+'\x22';}_0xabd4a5[_0x0dd5('0x2a')](_0x265bf6);});_0x278079=_0x278079[_0x0dd5('0x29')](_0x0dd5('0x2b'),_0xabd4a5[_0x0dd5('0x2c')]('\x20'));return _0x278079;};exports[_0x0dd5('0x2d')]=function(_0x5e7f7a,_0x2c9b8e,_0x15c84a){var _0x177d95={},_0xf6a95c={};if(_0x2c9b8e[_0x0dd5('0x2e')]['$id']){_0x2c9b8e['query']['id']=_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x2f')];delete _0x2c9b8e[_0x0dd5('0x2e')]['$id'];}_0x177d95[_0x0dd5('0x30')]=_[_0x0dd5('0x15')](_0x5e7f7a,_0x0dd5('0xf'));_0x177d95['query']=_[_0x0dd5('0x31')](_0x2c9b8e[_0x0dd5('0x2e')]);_0x177d95[_0x0dd5('0x32')]=_[_0x0dd5('0x33')](_0x177d95['model'],_0x177d95[_0x0dd5('0x2e')]);_0xf6a95c[_0x0dd5('0x34')]=_['intersection'](_0x177d95[_0x0dd5('0x30')],this['fields'](_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x5')]));_0xf6a95c[_0x0dd5('0x34')]=_0xf6a95c[_0x0dd5('0x34')][_0x0dd5('0x1e')]?_0xf6a95c['attributes']:_0x177d95[_0x0dd5('0x30')];if(!_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x21')](_0x0dd5('0x35'))){_0xf6a95c['limit']=this[_0x0dd5('0x12')](_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x12')]);_0xf6a95c['offset']=this[_0x0dd5('0x13')](_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x13')]);}_0xf6a95c[_0x0dd5('0x36')]=this['sort'](_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x14')]);_0xf6a95c[_0x0dd5('0x37')]=this[_0x0dd5('0x32')](_[_0x0dd5('0x38')](_0x2c9b8e[_0x0dd5('0x2e')],_0x177d95[_0x0dd5('0x32')]),_0x5e7f7a);if(_0x2c9b8e[_0x0dd5('0x2e')]['filter']){var _0x1642c6=_0x5e7f7a;var _0x2ee8d6=_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x39')];if(typeof _0x2ee8d6===_0x0dd5('0x3a')){_0x1642c6=_[_0x0dd5('0x39')](_0x5e7f7a,function(_0x52a50a){return _['includes'](_0x2ee8d6[_0x0dd5('0x3b')],_0x52a50a[_0x0dd5('0xf')]);});_0x2ee8d6=_0x2ee8d6[_0x0dd5('0x3c')];}_0xf6a95c[_0x0dd5('0x37')]=_['merge'](_0xf6a95c[_0x0dd5('0x37')],{'$or':_['map'](_0x1642c6,function(_0xf05106){if(_0xf05106[_0x0dd5('0x9')]!==_0x0dd5('0x3d')){if(_0x15c84a){return sequelize[_0x0dd5('0x37')](sequelize['fn'](_0x0dd5('0x3e'),sequelize[_0x0dd5('0x1a')](_0xf05106[_0x0dd5('0xf')])),{'$like':sequelize['fn'](_0x0dd5('0x3e'),'%'+_0x2c9b8e[_0x0dd5('0x2e')]['filter']+'%')});}else{var _0x422c4e={};_0x422c4e[_0xf05106[_0x0dd5('0xf')]]={'$like':'%'+_0x2c9b8e[_0x0dd5('0x2e')][_0x0dd5('0x39')]+'%'};return _0x422c4e;}}})});}_0xf6a95c=_[_0x0dd5('0x3f')]({},_0xf6a95c,_0x2c9b8e[_0x0dd5('0x40')]);return _0xf6a95c;};exports[_0x0dd5('0x41')]=function(_0x15e4fe){var _0x4ebab8=[];if(_0x15e4fe[_0x0dd5('0x42')]){_0x4ebab8[_0x0dd5('0x2a')]({'all':!![]});}else if(_0x15e4fe[_0x0dd5('0x41')]){if(Array[_0x0dd5('0x11')](_0x15e4fe[_0x0dd5('0x41')])){_0x4ebab8=Object[_0x0dd5('0x31')](_0x15e4fe[_0x0dd5('0x41')])[_0x0dd5('0x15')](function(_0x5c36f9){return parseIncludeModel(_0x15e4fe[_0x0dd5('0x41')][_0x5c36f9]);});}else{var _0x557364=parseIncludeModel(_0x15e4fe[_0x0dd5('0x41')]);_0x4ebab8['push'](_0x557364);}}return _0x4ebab8;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index baaae36..6b626e3 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 _0x8453=['findAll','name','fullname','faxPause','mailPause','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal','internal','validateSortParameter','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','smsPause','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','http','client','chatPause','openchannelPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','pause','*pause','startCase','Queue','map','findOne','getAgents','flatten','uniq','value','getAgentIdsByQueues','includes','busy','resolve','User'];(function(_0x57b80f,_0x4339e5){var _0x4dfdb8=function(_0x192599){while(--_0x192599){_0x57b80f['push'](_0x57b80f['shift']());}};_0x4dfdb8(++_0x4339e5);}(_0x8453,0x1c5));var _0x3845=function(_0x15ba4d,_0xeeb34c){_0x15ba4d=_0x15ba4d-0x0;var _0x32c1fe=_0x8453[_0x15ba4d];return _0x32c1fe;};'use strict';var _=require(_0x3845('0x0'));var jayson=require(_0x3845('0x1'));var db=require(_0x3845('0x2'))['db'];var amiClient=jayson['client'][_0x3845('0x3')]({'port':0x232a});var routingClient=jayson[_0x3845('0x4')][_0x3845('0x3')]({'port':0x232c});function isAgentPaused(_0x5ceea7,_0x1c9f43){var _0x29e03e=[_0x5ceea7[_0x3845('0x5')],_0x5ceea7['faxPause'],_0x5ceea7['mailPause'],_0x5ceea7[_0x3845('0x6')],_0x5ceea7['smsPause'],_0x5ceea7[_0x3845('0x7')],_0x5ceea7[_0x3845('0x8')]];if(!_0x1c9f43)return _[_0x3845('0x9')](_0x29e03e);var _0x1ae5c3=_[_0x3845('0xa')](_0x29e03e);return _0x1ae5c3['length']>0x0&&_0x1ae5c3[_0x3845('0xb')]<_0x29e03e[_0x3845('0xb')]?!![]:![];}function isIdle(_0x2b2099){return _0x2b2099===_0x3845('0xc')||_0x2b2099===_0x3845('0xd')||_0x2b2099===_0x3845('0xe')||_0x2b2099===_0x3845('0xf')||_[_0x3845('0x10')](_0x2b2099);}function isAgentIdle(_0xbc1f9c){if(_0xbc1f9c[_0x3845('0x11')]!==_0x3845('0xc')&&_0xbc1f9c[_0x3845('0x7')]){_0xbc1f9c[_0x3845('0x11')]='pause';return![];}return _[_0x3845('0x9')]([_0xbc1f9c[_0x3845('0x12')],_0xbc1f9c['faxStatus'],_0xbc1f9c[_0x3845('0x13')],_0xbc1f9c[_0x3845('0x14')],_0xbc1f9c[_0x3845('0x15')],_0xbc1f9c['voiceStatus'],_0xbc1f9c[_0x3845('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x3845('0x17')](_0x3845('0x18'),{})[_0x3845('0x19')](function(_0x5d0a4f){if(_0x5d0a4f[_0x3845('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x519b69=_0x5d0a4f[_0x3845('0x1b')];return routingClient['request'](_0x3845('0x18'),{})[_0x3845('0x19')](function(_0x2694da){if(_0x2694da[_0x3845('0x1a')]){throw new Error(_0x3845('0x1c'));}var _0x932c3a=_0x2694da[_0x3845('0x1b')];return _[_0x3845('0x1d')]({},_0x519b69,_0x932c3a);});})[_0x3845('0x1e')](function(_0x329b74){throw _0x329b74;});}exports[_0x3845('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x1455d8){var _0xbca58a=_0x3845('0xd');if(isAgentPaused(_0x1455d8))_0xbca58a=_0x3845('0x20');else if(isAgentPaused(_0x1455d8,!![]))_0xbca58a=_0x3845('0x21');else if(isAgentIdle(_0x1455d8))_0xbca58a=_0x3845('0xc');else _0xbca58a='busy';return _0xbca58a;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x31c744,_0x41eb10){var _0xa55837=_['isArray'](_0x31c744)?_0x31c744:[_0x31c744];var _0x507c70=_[_0x3845('0x22')](_0x41eb10)+_0x3845('0x23');var _0x4904e2=_[_0x3845('0x24')](_0xa55837,function(_0x32d63f){return db[_0x507c70][_0x3845('0x25')]({'where':{'id':_0x32d63f}})['then'](function(_0x54143c){if(!_0x54143c)return[];return _0x54143c[_0x3845('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x4904e2)[_0x3845('0x19')](function(_0x5e47ff){var _0x3cf52d=_(_0x5e47ff)[_0x3845('0x27')]()[_0x3845('0x24')]('id')[_0x3845('0x28')]()[_0x3845('0x29')]();return _0x3cf52d;});}exports[_0x3845('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x42756f,_0x298a19,_0xd4e048){try{if(_0x298a19[_0x3845('0xb')]>0x0){_0x42756f=_0x42756f[_0x3845('0xa')](function(_0xf539c0){return _0x298a19[_0x3845('0x2b')](_0xf539c0['id']);});}var _0x8f219b=_0x42756f[_0x3845('0xa')](function(_0x507161){var _0x4e2efa=_0x3845('0x2c');if(isAgentIdle(_0x507161)){_0x4e2efa=_0x3845('0xc');}return _0x4e2efa===_0xd4e048;});return _[_0x3845('0x24')](_0x8f219b,'id');}catch(_0x2cfc41){throw _0x2cfc41;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xc90aab,_0x3507eb,_0x3a0251){return Promise[_0x3845('0x2d')]()['then'](function(){if(_0x3507eb[_0x3845('0xb')]>0x0){_0xc90aab=_0xc90aab[_0x3845('0xa')](function(_0x4d6e27){return _0x3507eb[_0x3845('0x2b')](_0x4d6e27['id']);});}return _0xc90aab;})[_0x3845('0x19')](function(){return db[_0x3845('0x2e')][_0x3845('0x2f')]({'attributes':['id',_0x3845('0x30'),_0x3845('0x31'),_0x3845('0x5'),_0x3845('0x32'),_0x3845('0x33'),_0x3845('0x6'),'smsPause',_0x3845('0x7'),'whatsappPause','pauseType'],'where':{'id':{'$in':_['map'](_0xc90aab,'id')}},'raw':!![]});})['then'](function(_0x27f123){return _0x27f123[_0x3845('0x24')](function(_0x1cd5ae){var _0x3974ce=_[_0x3845('0x34')](_0xc90aab,['id',_0x1cd5ae['id']]);var _0x334048=filterAgentAttributes(_0x3974ce);_[_0x3845('0x1d')](_0x1cd5ae,_0x334048);_0x1cd5ae[_0x3845('0x35')]=getAgentStatus(_0x1cd5ae);return _0x1cd5ae;});})[_0x3845('0x19')](function(_0xb4ef3b){var _0x4c6640=sortAgentsByStatus(_0xb4ef3b,_0x3a0251);return _[_0x3845('0x24')](_0x4c6640,'id');})[_0x3845('0x1e')](function(_0x2b1681){throw _0x2b1681;});}exports[_0x3845('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x29e597){var _0x302103={'fields':[],'order':null};var _0x5315fa=_0x29e597[_0x3845('0x37')](',');_0x302103[_0x3845('0x38')]=_['filter'](_0x5315fa,function(_0x3e82ae){if(!_0x3e82ae['includes']('globalStatus')){return!![];}_0x302103[_0x3845('0x39')]=_[_0x3845('0x3a')](_0x3e82ae,'-')?'DESC':_0x3845('0x3b');return![];});return _0x302103;}exports[_0x3845('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x433881){if(!_0x433881){_0x433881=_0x3845('0x3d');}if(_0x433881['includes'](_0x3845('0x31'))&&!_0x433881['includes'](_0x3845('0x3e'))){var _0x3e171d=_0x433881['substring'](0x0,_0x433881['indexOf'](_0x3845('0x31')));_0x433881+=','+_0x3e171d+_0x3845('0x3e');}return _0x433881;}exports[_0x3845('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x3251e6,_0x49fd3c){var _0x1cf212=_0x3251e6[_0x3845('0x40')](function(_0xc1e43d,_0x3cf1dd){if(_0xc1e43d[_0x3845('0x35')]===_0x3cf1dd[_0x3845('0x35')]){if(_0xc1e43d[_0x3845('0x35')]===_0x3845('0x20')){if(_0x49fd3c===_0x3845('0x41')){return(_0xc1e43d['pauseType']||'')<(_0x3cf1dd[_0x3845('0x42')]||'')||_0xc1e43d[_0x3845('0x31')][_0x3845('0x43')]()>_0x3cf1dd[_0x3845('0x31')][_0x3845('0x43')]()?0x1:-0x1;}else{return(_0xc1e43d[_0x3845('0x42')]||'')<(_0x3cf1dd[_0x3845('0x42')]||'')||_0xc1e43d[_0x3845('0x31')]['toLowerCase']()>_0x3cf1dd['fullname'][_0x3845('0x43')]()?-0x1:0x1;}}else{if(_0x49fd3c===_0x3845('0x41')){return _0xc1e43d[_0x3845('0x31')][_0x3845('0x43')]()<_0x3cf1dd[_0x3845('0x31')][_0x3845('0x43')]()?0x1:-0x1;}else{return _0xc1e43d[_0x3845('0x31')][_0x3845('0x43')]()<_0x3cf1dd[_0x3845('0x31')][_0x3845('0x43')]()?-0x1:0x1;}}}else{if(_0x49fd3c==='DESC'){return _0xc1e43d[_0x3845('0x35')]<_0x3cf1dd['globalStatus']?0x1:-0x1;}else{return _0xc1e43d[_0x3845('0x35')]<_0x3cf1dd[_0x3845('0x35')]?-0x1:0x1;}}});return _0x1cf212;}exports[_0x3845('0x44')]=sortAgentsByStatus;function filterAgentAttributes(_0x250480){var _0x5e72e3=[_0x3845('0x45'),'online',_0x3845('0x46'),'lastPauseAt',_0x3845('0x42'),_0x3845('0x47'),_0x3845('0x3e'),_0x3845('0x48'),_0x3845('0x5'),'openchannelPause',_0x3845('0x33'),_0x3845('0x49'),_0x3845('0x8'),_0x3845('0x32'),_0x3845('0x7'),_0x3845('0x4a'),_0x3845('0x4b'),_0x3845('0x4c'),'smsCapacity',_0x3845('0x4d'),_0x3845('0x4e'),_0x3845('0x4f'),_0x3845('0x50'),_0x3845('0x51'),_0x3845('0x52'),_0x3845('0x53'),_0x3845('0x54'),_0x3845('0x12'),'openchannelStatus',_0x3845('0x13'),_0x3845('0x15'),'whatsappStatus',_0x3845('0x55'),_0x3845('0x11'),_0x3845('0x56'),'openchannelStatusTime',_0x3845('0x57'),'smsStatusTime',_0x3845('0x58'),'faxStatusTime',_0x3845('0x59'),_0x3845('0x5a'),_0x3845('0x5b'),_0x3845('0x5c'),_0x3845('0x5d'),_0x3845('0x5e'),_0x3845('0x5f')];var _0x397123=['chatPause','openchannelPause',_0x3845('0x33'),_0x3845('0x49'),'whatsappPause',_0x3845('0x32'),_0x3845('0x7'),_0x3845('0x60')];var _0x26ff47=_(_0x250480)[_0x3845('0x61')](_0x397123)[_0x3845('0x62')](_0x5e72e3)['value']();return _0x26ff47;}exports[_0x3845('0x63')]=filterAgentAttributes; \ No newline at end of file +var _0x55c0=['faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','smsStatus','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','length','unavailable','isNil','voiceStatus','idle','voicePause','pause','chatStatus','mailStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','unknown','busy','getAgentStatus','isArray','startCase','map','findOne','all','uniq','value','filter','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','pauseType','find','globalStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','online','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity'];(function(_0x229aba,_0x4c1434){var _0x53ea52=function(_0x4edbd0){while(--_0x4edbd0){_0x229aba['push'](_0x229aba['shift']());}};_0x53ea52(++_0x4c1434);}(_0x55c0,0xc9));var _0x055c=function(_0xec306d,_0x2c44af){_0xec306d=_0xec306d-0x0;var _0x4fd78a=_0x55c0[_0xec306d];return _0x4fd78a;};'use strict';var _=require(_0x055c('0x0'));var jayson=require('jayson/promise');var db=require(_0x055c('0x1'))['db'];var amiClient=jayson[_0x055c('0x2')][_0x055c('0x3')]({'port':0x232a});var routingClient=jayson[_0x055c('0x2')][_0x055c('0x3')]({'port':0x232c});function isAgentPaused(_0x3046b3,_0x1b6630){var _0x232a9f=[_0x3046b3[_0x055c('0x4')],_0x3046b3[_0x055c('0x5')],_0x3046b3[_0x055c('0x6')],_0x3046b3[_0x055c('0x7')],_0x3046b3[_0x055c('0x8')],_0x3046b3['voicePause'],_0x3046b3[_0x055c('0x9')]];if(!_0x1b6630)return _[_0x055c('0xa')](_0x232a9f);var _0x48f1be=_['filter'](_0x232a9f);return _0x48f1be[_0x055c('0xb')]>0x0&&_0x48f1be['length']<_0x232a9f[_0x055c('0xb')]?!![]:![];}function isIdle(_0x4670ab){return _0x4670ab==='idle'||_0x4670ab==='unknown'||_0x4670ab===_0x055c('0xc')||_0x4670ab==='ringing'||_[_0x055c('0xd')](_0x4670ab);}function isAgentIdle(_0x1da7c1){if(_0x1da7c1[_0x055c('0xe')]!==_0x055c('0xf')&&_0x1da7c1[_0x055c('0x10')]){_0x1da7c1[_0x055c('0xe')]=_0x055c('0x11');return![];}return _[_0x055c('0xa')]([_0x1da7c1[_0x055c('0x12')],_0x1da7c1['faxStatus'],_0x1da7c1[_0x055c('0x13')],_0x1da7c1[_0x055c('0x14')],_0x1da7c1['smsStatus'],_0x1da7c1[_0x055c('0xe')],_0x1da7c1[_0x055c('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x055c('0x16')](_0x055c('0x17'),{})[_0x055c('0x18')](function(_0x1efd88){if(_0x1efd88[_0x055c('0x19')]){throw new Error(_0x055c('0x1a'));}var _0x541654=_0x1efd88[_0x055c('0x1b')];return routingClient[_0x055c('0x16')]('Agents',{})['then'](function(_0xbbe33a){if(_0xbbe33a['error']){throw new Error(_0x055c('0x1c'));}var _0x308686=_0xbbe33a[_0x055c('0x1b')];return _[_0x055c('0x1d')]({},_0x541654,_0x308686);});})[_0x055c('0x1e')](function(_0x225d7d){throw _0x225d7d;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x487b04){var _0x529548=_0x055c('0x1f');if(isAgentPaused(_0x487b04))_0x529548='pause';else if(isAgentPaused(_0x487b04,!![]))_0x529548='*pause';else if(isAgentIdle(_0x487b04))_0x529548='idle';else _0x529548=_0x055c('0x20');return _0x529548;}exports[_0x055c('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x12cbab,_0x388f8d){var _0x54b9a7=_[_0x055c('0x22')](_0x12cbab)?_0x12cbab:[_0x12cbab];var _0x2eac8d=_[_0x055c('0x23')](_0x388f8d)+'Queue';var _0x164e5f=_[_0x055c('0x24')](_0x54b9a7,function(_0x141cf5){return db[_0x2eac8d][_0x055c('0x25')]({'where':{'id':_0x141cf5}})[_0x055c('0x18')](function(_0x345831){if(!_0x345831)return[];return _0x345831['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x055c('0x26')](_0x164e5f)[_0x055c('0x18')](function(_0x3727eb){var _0x4e8314=_(_0x3727eb)['flatten']()[_0x055c('0x24')]('id')[_0x055c('0x27')]()[_0x055c('0x28')]();return _0x4e8314;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3e9c51,_0x1a0439,_0x4eab37){try{if(_0x1a0439[_0x055c('0xb')]>0x0){_0x3e9c51=_0x3e9c51[_0x055c('0x29')](function(_0x4e40a0){return _0x1a0439[_0x055c('0x2a')](_0x4e40a0['id']);});}var _0xa93e63=_0x3e9c51['filter'](function(_0x491e5d){var _0xdc3fd5=_0x055c('0x20');if(isAgentIdle(_0x491e5d)){_0xdc3fd5=_0x055c('0xf');}return _0xdc3fd5===_0x4eab37;});return _[_0x055c('0x24')](_0xa93e63,'id');}catch(_0x3fb27f){throw _0x3fb27f;}}exports[_0x055c('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x556bcd,_0x31fdfc,_0x394952){return Promise[_0x055c('0x2c')]()[_0x055c('0x18')](function(){if(_0x31fdfc[_0x055c('0xb')]>0x0){_0x556bcd=_0x556bcd[_0x055c('0x29')](function(_0xbcc912){return _0x31fdfc[_0x055c('0x2a')](_0xbcc912['id']);});}return _0x556bcd;})[_0x055c('0x18')](function(){return db[_0x055c('0x2d')][_0x055c('0x2e')]({'attributes':['id',_0x055c('0x2f'),_0x055c('0x30'),_0x055c('0x4'),_0x055c('0x5'),'mailPause',_0x055c('0x7'),'smsPause',_0x055c('0x10'),'whatsappPause',_0x055c('0x31')],'where':{'id':{'$in':_[_0x055c('0x24')](_0x556bcd,'id')}},'raw':!![]});})[_0x055c('0x18')](function(_0x25fea6){return _0x25fea6[_0x055c('0x24')](function(_0x182acb){var _0x4733b7=_[_0x055c('0x32')](_0x556bcd,['id',_0x182acb['id']]);var _0x4935f6=filterAgentAttributes(_0x4733b7);_['merge'](_0x182acb,_0x4935f6);_0x182acb[_0x055c('0x33')]=getAgentStatus(_0x182acb);return _0x182acb;});})[_0x055c('0x18')](function(_0x1d5fec){var _0x13617b=sortAgentsByStatus(_0x1d5fec,_0x394952);return _[_0x055c('0x24')](_0x13617b,'id');})['catch'](function(_0x59432b){throw _0x59432b;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5d94d8){var _0x24cd00={'fields':[],'order':null};var _0x46eaf5=_0x5d94d8[_0x055c('0x34')](',');_0x24cd00[_0x055c('0x35')]=_[_0x055c('0x29')](_0x46eaf5,function(_0x283fb4){if(!_0x283fb4[_0x055c('0x2a')](_0x055c('0x33'))){return!![];}_0x24cd00[_0x055c('0x36')]=_[_0x055c('0x37')](_0x283fb4,'-')?_0x055c('0x38'):'ASC';return![];});return _0x24cd00;}exports[_0x055c('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x18b78a){if(!_0x18b78a){_0x18b78a=_0x055c('0x3a');}if(_0x18b78a['includes'](_0x055c('0x30'))&&!_0x18b78a['includes'](_0x055c('0x3b'))){var _0x4bfeb6=_0x18b78a[_0x055c('0x3c')](0x0,_0x18b78a[_0x055c('0x3d')]('fullname'));_0x18b78a+=','+_0x4bfeb6+_0x055c('0x3b');}return _0x18b78a;}exports[_0x055c('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x1f6f8d,_0x32fba6){var _0x2eba56=_0x1f6f8d[_0x055c('0x3f')](function(_0x4a0ca9,_0x2f8dbf){if(_0x4a0ca9['globalStatus']===_0x2f8dbf[_0x055c('0x33')]){if(_0x4a0ca9[_0x055c('0x33')]===_0x055c('0x11')){if(_0x32fba6==='DESC'){return(_0x4a0ca9[_0x055c('0x31')]||'')<(_0x2f8dbf[_0x055c('0x31')]||'')||_0x4a0ca9[_0x055c('0x30')][_0x055c('0x40')]()>_0x2f8dbf[_0x055c('0x30')][_0x055c('0x40')]()?0x1:-0x1;}else{return(_0x4a0ca9[_0x055c('0x31')]||'')<(_0x2f8dbf[_0x055c('0x31')]||'')||_0x4a0ca9['fullname']['toLowerCase']()>_0x2f8dbf['fullname'][_0x055c('0x40')]()?-0x1:0x1;}}else{if(_0x32fba6===_0x055c('0x38')){return _0x4a0ca9[_0x055c('0x30')][_0x055c('0x40')]()<_0x2f8dbf[_0x055c('0x30')][_0x055c('0x40')]()?0x1:-0x1;}else{return _0x4a0ca9[_0x055c('0x30')][_0x055c('0x40')]()<_0x2f8dbf[_0x055c('0x30')][_0x055c('0x40')]()?-0x1:0x1;}}}else{if(_0x32fba6===_0x055c('0x38')){return _0x4a0ca9[_0x055c('0x33')]<_0x2f8dbf['globalStatus']?0x1:-0x1;}else{return _0x4a0ca9['globalStatus']<_0x2f8dbf[_0x055c('0x33')]?-0x1:0x1;}}});return _0x2eba56;}exports[_0x055c('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x388f0f){var _0x5a4d4c=['userpic',_0x055c('0x42'),'lastLoginAt',_0x055c('0x43'),_0x055c('0x31'),'lastPauseAt','internal',_0x055c('0x44'),'chatPause',_0x055c('0x7'),_0x055c('0x6'),_0x055c('0x8'),'whatsappPause','faxPause',_0x055c('0x10'),'chatCapacity',_0x055c('0x45'),_0x055c('0x46'),_0x055c('0x47'),'whatsappCapacity',_0x055c('0x48'),_0x055c('0x49'),_0x055c('0x4a'),'mailCurrentCapacity',_0x055c('0x4b'),_0x055c('0x4c'),'faxCurrentCapacity',_0x055c('0x12'),_0x055c('0x14'),_0x055c('0x13'),_0x055c('0x4d'),'whatsappStatus','faxStatus','voiceStatus','chatStatusTime','openchannelStatusTime',_0x055c('0x4e'),_0x055c('0x4f'),_0x055c('0x50'),_0x055c('0x51'),_0x055c('0x52'),_0x055c('0x53'),_0x055c('0x54'),_0x055c('0x55'),_0x055c('0x56'),_0x055c('0x57'),_0x055c('0x58')];var _0x171824=[_0x055c('0x4'),_0x055c('0x7'),_0x055c('0x6'),_0x055c('0x8'),_0x055c('0x9'),_0x055c('0x5'),_0x055c('0x10'),_0x055c('0x42')];var _0x12768e=_(_0x388f0f)[_0x055c('0x59')](_0x171824)[_0x055c('0x5a')](_0x5a4d4c)[_0x055c('0x28')]();return _0x12768e;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 254911e..b129b05 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 _0xc5de=['erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','then','error','format','result','catch','concat','outbound','get','loggedIn','available','busy','merge','pick','initializeQueues','jayson/promise','util','client','http','paused','waiting','inUse','invalid','loggedInDb','notInUse','onHold','talking','unavailable','unknown','pTalking','originated','statusMessage','dialMethod','startPredictive','startProgressive'];(function(_0x58734a,_0x300972){var _0x1f692e=function(_0x1ea701){while(--_0x1ea701){_0x58734a['push'](_0x58734a['shift']());}};_0x1f692e(++_0x300972);}(_0xc5de,0xd7));var _0xec5d=function(_0x22656e,_0x1163dc){_0x22656e=_0x22656e-0x0;var _0x3e4255=_0xc5de[_0x22656e];return _0x3e4255;};'use strict';var _=require('lodash');var jayson=require(_0xec5d('0x0'));var util=require(_0xec5d('0x1'));var amiClient=jayson[_0xec5d('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0xec5d('0x2')][_0xec5d('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn',_0xec5d('0x4'),_0xec5d('0x5')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xec5d('0x6'),_0xec5d('0x7'),_0xec5d('0x8'),_0xec5d('0x9'),_0xec5d('0xa'),'ringing','ringInUse',_0xec5d('0xb'),_0xec5d('0xc'),_0xec5d('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xec5d('0xe'),_0xec5d('0xf'),'message',_0xec5d('0x10'),'dialActive',_0xec5d('0x11'),'Trunk',_0xec5d('0x12'),_0xec5d('0x13'),_0xec5d('0x14'),_0xec5d('0x15'),'erlangAbandonmentRate',_0xec5d('0x16'),'dialPredictiveInterval',_0xec5d('0x17'),_0xec5d('0x18'),'predictiveIntervalAvailable',_0xec5d('0x19'),_0xec5d('0x1a'),_0xec5d('0x1b'),_0xec5d('0x1c'),_0xec5d('0x1d'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x23063c,_0x35cf56){var _0x386b2c=_0x35cf56===_0xec5d('0x1e')?amiClient:routingClient;return _0x386b2c[_0xec5d('0x1f')](_[_0xec5d('0x20')](_0x35cf56)+'Queues',_0x23063c)[_0xec5d('0x21')](function(_0x48dd78){if(_0x48dd78[_0xec5d('0x22')])throw new Error(util[_0xec5d('0x23')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x35cf56));return _0x48dd78[_0xec5d('0x24')];})[_0xec5d('0x25')](function(_0x2422f9){throw _0x2422f9;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0xf7a28f,_0x3e0516,_0x13b7ff,_0x7fe89e){var _0x1dc336=DEFAULT_QUEUE_ATTRIBUTES;if(_0x13b7ff==='voice'){if(_0x7fe89e==='inbound'){_0x1dc336=_0x1dc336[_0xec5d('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x7fe89e===_0xec5d('0x27')){_0x1dc336=_0x1dc336[_0xec5d('0x26')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xf7a28f['map'](function(_0x26fd05){var _0x4c6425=_0x26fd05[_0xec5d('0x28')]({'plain':!![]});_0x4c6425[_0xec5d('0x4')]=0x0;_0x4c6425[_0xec5d('0x8')]=0x0;_0x4c6425[_0xec5d('0x29')]=0x0;_0x4c6425[_0xec5d('0x2a')]=0x0;_0x4c6425[_0xec5d('0x5')]=0x0;if(_0x13b7ff===_0xec5d('0x1e')){_0x4c6425[_0xec5d('0xb')]=0x0;_0x4c6425[_0xec5d('0x2b')]=0x0;if(_0x7fe89e===_0xec5d('0x27')){_0x4c6425[_0xec5d('0xe')]=0x0;_0x4c6425[_0xec5d('0xf')]=0x0;}}var _0x5058fa=_['find'](_0x3e0516,['id',_0x4c6425['id']]);if(_0x5058fa){_[_0xec5d('0x2c')](_0x4c6425,_[_0xec5d('0x2d')](_0x5058fa,_0x1dc336));}return _0x4c6425;});}exports[_0xec5d('0x2e')]=initializeQueues; \ No newline at end of file +var _0xce9b=['dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','outbound','map','get','loggedInDb','busy','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','invalid','notInUse','onHold','ringing','ringInUse','talking','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xce9b,0x123));var _0xbce9=function(_0x570a79,_0x4bfb7e){_0x570a79=_0x570a79-0x0;var _0x2b5456=_0xce9b[_0x570a79];return _0x2b5456;};'use strict';var _=require(_0xbce9('0x0'));var jayson=require(_0xbce9('0x1'));var util=require(_0xbce9('0x2'));var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0xbce9('0x3')][_0xbce9('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xbce9('0x5'),_0xbce9('0x6'),_0xbce9('0x7'),_0xbce9('0x8')];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0xbce9('0x9'),'loggedInDb',_0xbce9('0xa'),_0xbce9('0xb'),_0xbce9('0xc'),_0xbce9('0xd'),_0xbce9('0xe'),'unavailable',_0xbce9('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xbce9('0x10'),_0xbce9('0x11'),_0xbce9('0x12'),_0xbce9('0x13'),_0xbce9('0x14'),_0xbce9('0x15'),'Trunk',_0xbce9('0x16'),_0xbce9('0x17'),_0xbce9('0x18'),_0xbce9('0x19'),'erlangAbandonmentRate',_0xbce9('0x1a'),_0xbce9('0x1b'),_0xbce9('0x1c'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0xbce9('0x1d'),'predictiveIntervalAnsweredCalls',_0xbce9('0x1e'),_0xbce9('0x1f'),_0xbce9('0x20'),_0xbce9('0x21')];function getRealtimeQueues(_0x3af4f1,_0x243375){var _0x13d1ec=_0x243375===_0xbce9('0x22')?amiClient:routingClient;return _0x13d1ec[_0xbce9('0x23')](_[_0xbce9('0x24')](_0x243375)+_0xbce9('0x25'),_0x3af4f1)[_0xbce9('0x26')](function(_0x29802e){if(_0x29802e[_0xbce9('0x27')])throw new Error(util[_0xbce9('0x28')](_0xbce9('0x29'),_0x243375));return _0x29802e[_0xbce9('0x2a')];})['catch'](function(_0x48d7dd){throw _0x48d7dd;});}exports[_0xbce9('0x2b')]=getRealtimeQueues;function initializeQueues(_0x1539fd,_0x4163a7,_0x719906,_0x5c5f7b){var _0xb36094=DEFAULT_QUEUE_ATTRIBUTES;if(_0x719906===_0xbce9('0x22')){if(_0x5c5f7b===_0xbce9('0x2c')){_0xb36094=_0xb36094[_0xbce9('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5c5f7b===_0xbce9('0x2e')){_0xb36094=_0xb36094['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1539fd[_0xbce9('0x2f')](function(_0xd558de){var _0x16b275=_0xd558de[_0xbce9('0x30')]({'plain':!![]});_0x16b275[_0xbce9('0x7')]=0x0;_0x16b275[_0xbce9('0x31')]=0x0;_0x16b275['loggedIn']=0x0;_0x16b275[_0xbce9('0x5')]=0x0;_0x16b275['waiting']=0x0;if(_0x719906===_0xbce9('0x22')){_0x16b275[_0xbce9('0xe')]=0x0;_0x16b275[_0xbce9('0x32')]=0x0;if(_0x5c5f7b===_0xbce9('0x2e')){_0x16b275[_0xbce9('0x10')]=0x0;_0x16b275[_0xbce9('0x11')]=0x0;}}var _0x363884=_['find'](_0x4163a7,['id',_0x16b275['id']]);if(_0x363884){_['merge'](_0x16b275,_[_0xbce9('0x33')](_0x363884,_0xb36094));}return _0x16b275;});}exports[_0xbce9('0x34')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index a8387a8..158dcd2 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(_0x2606d9,_0x49939b){var _0x293d4b=function(_0x35e3c1){while(--_0x35e3c1){_0x2606d9['push'](_0x2606d9['shift']());}};_0x293d4b(++_0x49939b);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 _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(_0x250ebb,_0x33a65f){var _0x1225fb=function(_0x40172e){while(--_0x40172e){_0x250ebb['push'](_0x250ebb['shift']());}};_0x1225fb(++_0x33a65f);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 64efc94..b17de9d 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 _0x467b=['bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','hex','substring','lodash','crypto'];(function(_0xaa3e6f,_0x24a630){var _0x2b0249=function(_0x576666){while(--_0x576666){_0xaa3e6f['push'](_0xaa3e6f['shift']());}};_0x2b0249(++_0x24a630);}(_0x467b,0xbc));var _0xb467=function(_0x3ed4e3,_0x401c7b){_0x3ed4e3=_0x3ed4e3-0x0;var _0xa722c1=_0x467b[_0x3ed4e3];return _0xa722c1;};'use strict';var _=require(_0xb467('0x0'));var os=require('os');var crypto=require(_0xb467('0x1'));var machine=require(_0xb467('0x2'));var exec=require(_0xb467('0x3'))[_0xb467('0x4')];var config=require(_0xb467('0x5'));function getInterfaces(){var _0x139fb8=[];var _0x55cda9=os[_0xb467('0x6')]();var _0x2cb621=_['orderBy'](_[_0xb467('0x7')](_0x55cda9));for(var _0x36433a=0x0;_0x36433a<_0x2cb621[_0xb467('0x8')];_0x36433a++){var _0x59953b=_0x55cda9[_0x2cb621[_0x36433a]]['filter'](function(_0x25f28a){return _0x25f28a[_0xb467('0x9')]==='IPv4'&&_0x25f28a[_0xb467('0xa')]===![];});_0x139fb8=_0x139fb8[_0xb467('0xb')](_0x59953b);}return _0x139fb8;}function getFirstInterface(){var _0x4a02d1=_[_0xb467('0xc')](getInterfaces());return{'macAddress':_0x4a02d1&&_0x4a02d1['mac']?_0x4a02d1[_0xb467('0xd')]:_0xb467('0xe'),'ipAddress':_0x4a02d1&&_0x4a02d1['address']?_0x4a02d1[_0xb467('0xf')]:_0xb467('0x10')};}exports[_0xb467('0x11')]=getFirstInterface;function getCPUhash(){var _0x3ff7a3=_[_0xb467('0x12')](os[_0xb467('0x13')]()[_0xb467('0x14')](function(_0x3e54c9){return _0x3e54c9[_0xb467('0x15')];}))[_0xb467('0x16')](':');return crypto['createHash'](_0xb467('0x17'))[_0xb467('0x18')](_0x3ff7a3)[_0xb467('0x19')]('hex');}exports[_0xb467('0x1a')]=function(){var _0x4c1c4e=os[_0xb467('0x1b')]();var _0x10bf03=/[0-9a-f-]{36}/;if(config[_0xb467('0x1c')]&&_0x10bf03[_0xb467('0x1d')](config[_0xb467('0x1c')])){return config['licenseToken'];}else if(_0x4c1c4e===_0xb467('0x1e')){return exec(_0xb467('0x1f'),{'encoding':_0xb467('0x20')})[_0xb467('0x21')]('\x0d\x0a','');}else{var _0x47364c=getFirstInterface();var _0x3ab1b9=getCPUhash();var _0x3275ba=_0x3ab1b9+'|'+os[_0xb467('0x22')]()+'|'+_0x47364c['macAddress']+'|'+_0x47364c[_0xb467('0x23')];var _0x31180c=crypto['createHash'](_0xb467('0x17'))['update'](_0x3275ba)[_0xb467('0x19')](_0xb467('0x24'));return _0x31180c[_0xb467('0x25')](0x0,0x8)+'-'+_0x31180c[_0xb467('0x25')](0x8,0xc)+'-'+_0x31180c[_0xb467('0x25')](0xc,0x10)+'-'+_0x31180c[_0xb467('0x25')](0x10,0x14)+'-'+_0x31180c[_0xb467('0x25')](0x14);}}; \ No newline at end of file +var _0x776f=['licenseToken','test','win32','replace','hostname','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','map','model','join','md5','update','digest','hex','getUuid','platform'];(function(_0x50d448,_0x25d0eb){var _0x2e7ed4=function(_0x2cb8d4){while(--_0x2cb8d4){_0x50d448['push'](_0x50d448['shift']());}};_0x2e7ed4(++_0x25d0eb);}(_0x776f,0x70));var _0xf776=function(_0x5e2862,_0x4760eb){_0x5e2862=_0x5e2862-0x0;var _0x8dcad4=_0x776f[_0x5e2862];return _0x8dcad4;};'use strict';var _=require(_0xf776('0x0'));var os=require('os');var crypto=require(_0xf776('0x1'));var machine=require(_0xf776('0x2'));var exec=require(_0xf776('0x3'))['execSync'];var config=require(_0xf776('0x4'));function getInterfaces(){var _0x46e51e=[];var _0x499954=os[_0xf776('0x5')]();var _0xaca246=_[_0xf776('0x6')](_[_0xf776('0x7')](_0x499954));for(var _0x50ea8a=0x0;_0x50ea8a<_0xaca246[_0xf776('0x8')];_0x50ea8a++){var _0x4a6eb0=_0x499954[_0xaca246[_0x50ea8a]][_0xf776('0x9')](function(_0x56dcba){return _0x56dcba[_0xf776('0xa')]===_0xf776('0xb')&&_0x56dcba[_0xf776('0xc')]===![];});_0x46e51e=_0x46e51e[_0xf776('0xd')](_0x4a6eb0);}return _0x46e51e;}function getFirstInterface(){var _0x1c8975=_[_0xf776('0xe')](getInterfaces());return{'macAddress':_0x1c8975&&_0x1c8975['mac']?_0x1c8975[_0xf776('0xf')]:_0xf776('0x10'),'ipAddress':_0x1c8975&&_0x1c8975[_0xf776('0x11')]?_0x1c8975[_0xf776('0x11')]:'127.0.0.1'};}exports[_0xf776('0x12')]=getFirstInterface;function getCPUhash(){var _0x491514=_[_0xf776('0x6')](os['cpus']()[_0xf776('0x13')](function(_0x429b46){return _0x429b46[_0xf776('0x14')];}))[_0xf776('0x15')](':');return crypto['createHash'](_0xf776('0x16'))[_0xf776('0x17')](_0x491514)[_0xf776('0x18')](_0xf776('0x19'));}exports[_0xf776('0x1a')]=function(){var _0x4181d0=os[_0xf776('0x1b')]();var _0x317da5=/[0-9a-f-]{36}/;if(config[_0xf776('0x1c')]&&_0x317da5[_0xf776('0x1d')](config['licenseToken'])){return config[_0xf776('0x1c')];}else if(_0x4181d0===_0xf776('0x1e')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xf776('0x1f')]('\x0d\x0a','');}else{var _0x17c2d6=getFirstInterface();var _0x5ec187=getCPUhash();var _0x1e3b3c=_0x5ec187+'|'+os[_0xf776('0x20')]()+'|'+_0x17c2d6['macAddress']+'|'+_0x17c2d6['ipAddress'];var _0x5efe8b=crypto[_0xf776('0x21')]('md5')[_0xf776('0x17')](_0x1e3b3c)[_0xf776('0x18')](_0xf776('0x19'));return _0x5efe8b[_0xf776('0x22')](0x0,0x8)+'-'+_0x5efe8b[_0xf776('0x22')](0x8,0xc)+'-'+_0x5efe8b['substring'](0xc,0x10)+'-'+_0x5efe8b[_0xf776('0x22')](0x10,0x14)+'-'+_0x5efe8b['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 584e392..9b564a6 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 _0xb3b4=['../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','data1','data2','then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','catch','message','finally','getUuid','License','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','version'];(function(_0x79fb36,_0x2f6c6f){var _0x536c1d=function(_0x452815){while(--_0x452815){_0x79fb36['push'](_0x79fb36['shift']());}};_0x536c1d(++_0x2f6c6f);}(_0xb3b4,0x12b));var _0x4b3b=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xb3b4[_0x3e112d];return _0x531c31;};'use strict';var util=require(_0x4b3b('0x0'));var moment=require(_0x4b3b('0x1'));var rp=require(_0x4b3b('0x2'));var BPromise=require(_0x4b3b('0x3'));var pkginfo=require('pkginfo')(module,_0x4b3b('0x4'));var db=require(_0x4b3b('0x5'))['db'];var encryptor=require(_0x4b3b('0x6'));var hardware=require(_0x4b3b('0x7'));var logger=require(_0x4b3b('0x8'))('license');var HOST=_0x4b3b('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x131b45){return new BPromise(function(_0x5579ce,_0x45aa1f){var _0x3e88c7=util[_0x4b3b('0xa')](_0x4b3b('0xb'),HOST,_0x131b45,module[_0x4b3b('0xc')][_0x4b3b('0x4')]);if(oldToken){_0x3e88c7=util['format'](_0x4b3b('0xd'),HOST,_0x131b45,module[_0x4b3b('0xc')]['version'],oldToken);}var _0x1dfd65={'uri':_0x3e88c7,'method':_0x4b3b('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x1dfd65)['then'](function(_0x120577){_0x5579ce(_0x120577);})['catch'](function(_0x31dd8d){_0x45aa1f(_0x31dd8d);});});}function manageLicense(_0x4f4363,_0x4f7c12){var _0x4b3e47=_0x4f7c12['get']({'plain':!![]});if(!isOldTokenSent&&_0x4b3e47[_0x4b3b('0xf')]!==_0x4f4363&&!_0x4b3e47[_0x4b3b('0x10')]){oldToken=_0x4b3e47[_0x4b3b('0xf')];}httpRequest(_0x4f4363)[_0x4b3b('0x11')](function(_0x3980d6){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3980d6[_0x4b3b('0x12')]){isOldTokenSent=![];if(!_0x4b3e47[_0x4b3b('0x13')]&&_0x4b3e47[_0x4b3b('0x13')]!=_0x3980d6[_0x4b3b('0x13')]||_0x4b3e47[_0x4b3b('0x13')]&&_0x4b3e47[_0x4b3b('0x10')]){logger[_0x4b3b('0x14')](_0x4b3b('0x15'));}if(_0x4b3e47['license']&&!_0x4b3e47[_0x4b3b('0x10')]&&_0x4b3e47[_0x4b3b('0x13')]!=_0x3980d6[_0x4b3b('0x13')]){logger['info'](_0x4b3b('0x16'));}if(_0x4b3e47[_0x4b3b('0x13')]&&!_0x4b3e47[_0x4b3b('0x10')]&&_0x4b3e47['license']==_0x3980d6[_0x4b3b('0x13')]){return _0x4f7c12;}return _0x4f7c12[_0x4b3b('0x17')]({'data1':_0x4f4363,'data2':null,'license':_0x3980d6[_0x4b3b('0x13')]});}else{if(_0x3980d6['license']||_0x4b3e47[_0x4b3b('0x13')]){if(!_0x4b3e47[_0x4b3b('0x10')]){if(_0x4b3e47[_0x4b3b('0xf')]==_0x4f4363){GRAY_PERIOD_REASON=_0x4b3b('0x18');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x4b3b('0x19');logger[_0x4b3b('0x14')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4b3e47[_0x4b3b('0xf')],_0x4f4363);}logger[_0x4b3b('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x4b3b('0xa')](_0x4b3b('0x1a')));return _0x4f7c12[_0x4b3b('0x17')]({'data2':encryptor['encryptString'](moment()[_0x4b3b('0xa')](_0x4b3b('0x1a')))});}else{if(moment()[_0x4b3b('0x1b')](encryptor[_0x4b3b('0x1c')](_0x4b3e47[_0x4b3b('0x10')]),_0x4b3b('0x1d'))>DAYS){logger[_0x4b3b('0x14')]('DEMO\x20START\x20AT\x20%s',moment()[_0x4b3b('0xa')](_0x4b3b('0x1a')));isOldTokenSent=![];return _0x4f7c12[_0x4b3b('0x17')]({'data1':_0x4f4363,'data2':null,'license':null});}}}else{if(_0x4b3e47[_0x4b3b('0xf')]!=_0x4f4363){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4b3e47[_0x4b3b('0xf')],_0x4f4363);return _0x4f7c12[_0x4b3b('0x17')]({'data1':_0x4f4363,'data2':null,'license':null});}}}return _0x4f7c12;})[_0x4b3b('0x11')](function(_0x53dd2a){_0x4f7c12=_0x53dd2a;})[_0x4b3b('0x1e')](function(_0x28a2e7){logger['error'](_0x28a2e7[_0x4b3b('0x1f')]);})[_0x4b3b('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x4b3b('0x21')](),_0x4f7c12);},TIME);});}function defaultLicense(){var _0x4cc70f=hardware[_0x4b3b('0x21')]();if(_0x4cc70f){return db[_0x4b3b('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4cc70f}})['spread'](function(_0x3ceba6,_0x4f78c4){logger[_0x4b3b('0x14')](_0x4b3b('0x23'),_0x4cc70f);manageLicense(_0x4cc70f,_0x3ceba6);})[_0x4b3b('0x1e')](function(_0x380fe4){logger[_0x4b3b('0x24')](_0x380fe4[_0x4b3b('0x1f')]);});}}exports[_0x4b3b('0x25')]=defaultLicense; \ No newline at end of file +var _0x5afe=['%s/api/servers/%s/check?version=%s','exports','version','GET','then','catch','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','spread','error','moment','bluebird','pkginfo','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format'];(function(_0x2c1f24,_0x64e52c){var _0x1057f0=function(_0x28b363){while(--_0x28b363){_0x2c1f24['push'](_0x2c1f24['shift']());}};_0x1057f0(++_0x64e52c);}(_0x5afe,0x64));var _0xe5af=function(_0x4c56b6,_0x239082){_0x4c56b6=_0x4c56b6-0x0;var _0x1ee73a=_0x5afe[_0x4c56b6];return _0x1ee73a;};'use strict';var util=require('util');var moment=require(_0xe5af('0x0'));var rp=require('request-promise');var BPromise=require(_0xe5af('0x1'));var pkginfo=require(_0xe5af('0x2'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xe5af('0x3'));var hardware=require('./hardware');var logger=require(_0xe5af('0x4'))(_0xe5af('0x5'));var HOST=_0xe5af('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x41493c){return new BPromise(function(_0x223551,_0x2fae45){var _0x2731c0=util[_0xe5af('0x7')](_0xe5af('0x8'),HOST,_0x41493c,module[_0xe5af('0x9')][_0xe5af('0xa')]);if(oldToken){_0x2731c0=util[_0xe5af('0x7')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x41493c,module[_0xe5af('0x9')]['version'],oldToken);}var _0x159ab9={'uri':_0x2731c0,'method':_0xe5af('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x159ab9)[_0xe5af('0xc')](function(_0x4c5cf5){_0x223551(_0x4c5cf5);})[_0xe5af('0xd')](function(_0x5ae3bd){_0x2fae45(_0x5ae3bd);});});}function manageLicense(_0x182b9f,_0x47be3d){var _0x315f88=_0x47be3d['get']({'plain':!![]});if(!isOldTokenSent&&_0x315f88[_0xe5af('0xe')]!==_0x182b9f&&!_0x315f88['data2']){oldToken=_0x315f88['data1'];}httpRequest(_0x182b9f)[_0xe5af('0xc')](function(_0x2f20cb){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2f20cb['active']){isOldTokenSent=![];if(!_0x315f88[_0xe5af('0x5')]&&_0x315f88[_0xe5af('0x5')]!=_0x2f20cb['license']||_0x315f88[_0xe5af('0x5')]&&_0x315f88[_0xe5af('0xf')]){logger[_0xe5af('0x10')](_0xe5af('0x11'));}if(_0x315f88[_0xe5af('0x5')]&&!_0x315f88[_0xe5af('0xf')]&&_0x315f88[_0xe5af('0x5')]!=_0x2f20cb['license']){logger[_0xe5af('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x315f88['license']&&!_0x315f88[_0xe5af('0xf')]&&_0x315f88[_0xe5af('0x5')]==_0x2f20cb['license']){return _0x47be3d;}return _0x47be3d['update']({'data1':_0x182b9f,'data2':null,'license':_0x2f20cb[_0xe5af('0x5')]});}else{if(_0x2f20cb['license']||_0x315f88[_0xe5af('0x5')]){if(!_0x315f88[_0xe5af('0xf')]){if(_0x315f88[_0xe5af('0xe')]==_0x182b9f){GRAY_PERIOD_REASON=_0xe5af('0x12');logger[_0xe5af('0x10')](_0xe5af('0x13'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xe5af('0x10')](_0xe5af('0x14'),_0x315f88['data1'],_0x182b9f);}logger[_0xe5af('0x10')](_0xe5af('0x15'),GRAY_PERIOD_REASON[_0xe5af('0x16')](),moment()['format'](_0xe5af('0x17')));return _0x47be3d[_0xe5af('0x18')]({'data2':encryptor['encryptString'](moment()[_0xe5af('0x7')](_0xe5af('0x17')))});}else{if(moment()[_0xe5af('0x19')](encryptor[_0xe5af('0x1a')](_0x315f88[_0xe5af('0xf')]),_0xe5af('0x1b'))>DAYS){logger[_0xe5af('0x10')](_0xe5af('0x1c'),moment()['format'](_0xe5af('0x17')));isOldTokenSent=![];return _0x47be3d[_0xe5af('0x18')]({'data1':_0x182b9f,'data2':null,'license':null});}}}else{if(_0x315f88['data1']!=_0x182b9f){logger[_0xe5af('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x315f88[_0xe5af('0xe')],_0x182b9f);return _0x47be3d[_0xe5af('0x18')]({'data1':_0x182b9f,'data2':null,'license':null});}}}return _0x47be3d;})[_0xe5af('0xc')](function(_0x4895b6){_0x47be3d=_0x4895b6;})[_0xe5af('0xd')](function(_0x5b7659){logger['error'](_0x5b7659[_0xe5af('0x1d')]);})[_0xe5af('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0xe5af('0x1f')](),_0x47be3d);},TIME);});}function defaultLicense(){var _0x4c84b1=hardware[_0xe5af('0x1f')]();if(_0x4c84b1){return db[_0xe5af('0x20')][_0xe5af('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x4c84b1}})[_0xe5af('0x22')](function(_0xa25160,_0xd87d4f){logger[_0xe5af('0x10')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x4c84b1);manageLicense(_0x4c84b1,_0xa25160);})['catch'](function(_0x3ef8c1){logger[_0xe5af('0x23')](_0x3ef8c1[_0xe5af('0x1d')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index d62a7b2..e3fb183 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 _0xa535=['admin','user','telephone','users','forEach','pick','countBy','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','defaults','catch','uuid','license','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','machineUuid','deadline','add','days','grayReason','changed','disabled','data1','message','then','User','role','sequelize','COUNT','col','count'];(function(_0x11e213,_0x4f2b14){var _0x504df2=function(_0x439750){while(--_0x439750){_0x11e213['push'](_0x11e213['shift']());}};_0x504df2(++_0x4f2b14);}(_0xa535,0x168));var _0x5a53=function(_0xc36898,_0x41fe81){_0xc36898=_0xc36898-0x0;var _0x583de3=_0xa535[_0xc36898];return _0x583de3;};'use strict';var util=require(_0x5a53('0x0'));var _=require('lodash');var moment=require(_0x5a53('0x1'));var BPromise=require(_0x5a53('0x2'));var hardware=require(_0x5a53('0x3'));var encryptor=require(_0x5a53('0x4'));var db=require(_0x5a53('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5a53('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x5a53('0x7'),'machineUuid':hardware[_0x5a53('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3b9a1d){return new BPromise(function(_0x484fa1,_0x150457){return db[_0x5a53('0x9')]['find'](_[_0x5a53('0xa')](_0x3b9a1d,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3ffbff){return checkLicense(_0x3ffbff,null);})['then'](function(_0x11c124){_0x484fa1(_0x11c124);return;})[_0x5a53('0xb')](function(_0x4fad3d){_0x150457(_0x4fad3d);});});}function checkLicense(_0x5e94b6,_0x424744){if(!_0x5e94b6){demoLicense[_0x5a53('0xc')]=_0x5e94b6['data1'];return demoLicense;}try{var _0x2570a4=_0x424744||_0x5e94b6[_0x5a53('0xd')];if(_['isEmpty'](_0x2570a4)){throw new Error(_0x5a53('0xe'));}var _0x26b3aa=_0x5e94b6['data1'];var _0x23d33e=_0x5e94b6['data2'];var _0x1040fa=_0x26b3aa[_0x5a53('0xf')]('-')[0x4];var _0x276034=_0x26b3aa[_0x5a53('0xf')]('-')[0x0];var _0x365c85=encryptor[_0x5a53('0x10')](_0x2570a4,util[_0x5a53('0x11')](_0x5a53('0x12'),_0x1040fa,_0x26b3aa,_0x276034));var _0x3b415b=JSON[_0x5a53('0x13')](_0x365c85);_0x3b415b['demo']=![];_0x3b415b[_0x5a53('0xc')]=_0x26b3aa;_0x3b415b[_0x5a53('0x14')]=hardware['getUuid']();if(_0x23d33e){var _0x452442=encryptor[_0x5a53('0x10')](_0x23d33e);_0x3b415b['gray']=_0x452442;_0x3b415b[_0x5a53('0x15')]=moment(_0x452442)[_0x5a53('0x16')](0x7,_0x5a53('0x17'))[_0x5a53('0x11')]();_0x3b415b[_0x5a53('0x18')]=_0x3b415b['uuid']!=_0x3b415b[_0x5a53('0x14')]?_0x5a53('0x19'):_0x5a53('0x1a');}return _0x3b415b;}catch(_0x40ed86){breakingLicense['uuid']=_0x5e94b6[_0x5a53('0x1b')];breakingLicense[_0x5a53('0x1c')]=_0x40ed86[_0x5a53('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3d67c0,_0x2f8d74){getLicense()[_0x5a53('0x1d')](function(_0x4ff689){return db[_0x5a53('0x1e')]['findAll']({'attributes':[_0x5a53('0x1f'),[db[_0x5a53('0x20')]['fn'](_0x5a53('0x21'),db[_0x5a53('0x20')][_0x5a53('0x22')](_0x5a53('0x1f'))),_0x5a53('0x23')]],'group':'role','where':{'role':{'$or':[_0x5a53('0x24'),_0x5a53('0x25'),_0x5a53('0x26')]}},'raw':!![]})[_0x5a53('0x1d')](function(_0x2749e0){var _0x1c0ffb={'user':_0x4ff689[_0x5a53('0x27')]||0x0,'telephone':_0x4ff689['telephones']||0x0};_0x2749e0[_0x5a53('0x28')](function(_0x214ad7){var _0x475ced=_0x214ad7[_0x5a53('0x1f')]===_0x5a53('0x24')?_0x5a53('0x25'):_0x214ad7[_0x5a53('0x1f')];_0x1c0ffb[_0x475ced]-=_0x214ad7[_0x5a53('0x23')];if(_0x1c0ffb[_0x475ced]<0x0)_0x1c0ffb[_0x475ced]=0x0;});_0x3d67c0(_0x1c0ffb);return;});})[_0x5a53('0xb')](function(_0x481f29){_0x2f8d74(_0x481f29);});});}function checkUserLimits(_0x3070e0){return new BPromise(function(_0x5b625e,_0x297143){getLimits()[_0x5a53('0x1d')](function(_0x20f00f){var _0x2d616c=_[_0x5a53('0x29')](_[_0x5a53('0x2a')](_0x3070e0,_0x5a53('0x1f')),['admin',_0x5a53('0x25'),_0x5a53('0x26')]);var _0x423538=(_0x2d616c[_0x5a53('0x24')]||0x0)+(_0x2d616c[_0x5a53('0x25')]||0x0);var _0x3e1e1f=_0x2d616c[_0x5a53('0x26')]||0x0;if(_0x423538>_0x20f00f[_0x5a53('0x25')])return _0x297143('License\x20limit\x20reached\x20for\x20users');if(_0x3e1e1f>_0x20f00f['telephone'])return _0x297143('License\x20limit\x20reached\x20for\x20telephones');return _0x5b625e();})['catch'](function(_0x485e8e){_0x297143(_0x485e8e);});});}module[_0x5a53('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x2add=['add','days','changed','message','User','findAll','role','COUNT','sequelize','col','count','admin','telephone','users','telephones','forEach','countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','deadline'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0x2add,0xcd));var _0xd2ad=function(_0x3ec216,_0x3178a1){_0x3ec216=_0x3ec216-0x0;var _0x54274a=_0x2add[_0x3ec216];return _0x54274a;};'use strict';var util=require(_0xd2ad('0x0'));var _=require(_0xd2ad('0x1'));var moment=require(_0xd2ad('0x2'));var BPromise=require('bluebird');var hardware=require(_0xd2ad('0x3'));var encryptor=require(_0xd2ad('0x4'));var db=require(_0xd2ad('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd2ad('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd2ad('0x7'),'machineUuid':hardware[_0xd2ad('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd2ad('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd2ad('0x9'),'machineUuid':hardware[_0xd2ad('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x21ea6c){return new BPromise(function(_0x5acd5c,_0x13e632){return db['License'][_0xd2ad('0xa')](_[_0xd2ad('0xb')](_0x21ea6c,{'raw':!![],'where':{'id':0x1}}))[_0xd2ad('0xc')](function(_0x37a1a2){return checkLicense(_0x37a1a2,null);})[_0xd2ad('0xc')](function(_0x2f92bd){_0x5acd5c(_0x2f92bd);return;})['catch'](function(_0x104682){_0x13e632(_0x104682);});});}function checkLicense(_0x1f93ca,_0x18b815){if(!_0x1f93ca){demoLicense[_0xd2ad('0xd')]=_0x1f93ca[_0xd2ad('0xe')];return demoLicense;}try{var _0x23e424=_0x18b815||_0x1f93ca['license'];if(_[_0xd2ad('0xf')](_0x23e424)){throw new Error(_0xd2ad('0x10'));}var _0x20f19e=_0x1f93ca['data1'];var _0x2df5da=_0x1f93ca['data2'];var _0x55f054=_0x20f19e[_0xd2ad('0x11')]('-')[0x4];var _0xf38a6d=_0x20f19e[_0xd2ad('0x11')]('-')[0x0];var _0xa1b7a5=encryptor[_0xd2ad('0x12')](_0x23e424,util[_0xd2ad('0x13')](_0xd2ad('0x14'),_0x55f054,_0x20f19e,_0xf38a6d));var _0x2923f8=JSON['parse'](_0xa1b7a5);_0x2923f8[_0xd2ad('0x15')]=![];_0x2923f8[_0xd2ad('0xd')]=_0x20f19e;_0x2923f8[_0xd2ad('0x16')]=hardware[_0xd2ad('0x8')]();if(_0x2df5da){var _0x1c7ff6=encryptor[_0xd2ad('0x12')](_0x2df5da);_0x2923f8[_0xd2ad('0x17')]=_0x1c7ff6;_0x2923f8[_0xd2ad('0x18')]=moment(_0x1c7ff6)[_0xd2ad('0x19')](0x7,_0xd2ad('0x1a'))[_0xd2ad('0x13')]();_0x2923f8['grayReason']=_0x2923f8[_0xd2ad('0xd')]!=_0x2923f8['machineUuid']?_0xd2ad('0x1b'):'disabled';}return _0x2923f8;}catch(_0x3a656f){breakingLicense[_0xd2ad('0xd')]=_0x1f93ca[_0xd2ad('0xe')];breakingLicense[_0xd2ad('0x1c')]=_0x3a656f['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2d024f,_0x135780){getLicense()['then'](function(_0x14fab9){return db[_0xd2ad('0x1d')][_0xd2ad('0x1e')]({'attributes':[_0xd2ad('0x1f'),[db['sequelize']['fn'](_0xd2ad('0x20'),db[_0xd2ad('0x21')][_0xd2ad('0x22')](_0xd2ad('0x1f'))),_0xd2ad('0x23')]],'group':'role','where':{'role':{'$or':[_0xd2ad('0x24'),'user',_0xd2ad('0x25')]}},'raw':!![]})[_0xd2ad('0xc')](function(_0x3fc4e4){var _0x49b0c5={'user':_0x14fab9[_0xd2ad('0x26')]||0x0,'telephone':_0x14fab9[_0xd2ad('0x27')]||0x0};_0x3fc4e4[_0xd2ad('0x28')](function(_0x1eabf0){var _0x15e980=_0x1eabf0[_0xd2ad('0x1f')]==='admin'?'user':_0x1eabf0['role'];_0x49b0c5[_0x15e980]-=_0x1eabf0[_0xd2ad('0x23')];if(_0x49b0c5[_0x15e980]<0x0)_0x49b0c5[_0x15e980]=0x0;});_0x2d024f(_0x49b0c5);return;});})['catch'](function(_0x1d9451){_0x135780(_0x1d9451);});});}function checkUserLimits(_0x42d167){return new BPromise(function(_0x5aa1c7,_0x341ea0){getLimits()[_0xd2ad('0xc')](function(_0x742584){var _0x2fa6e7=_['pick'](_[_0xd2ad('0x29')](_0x42d167,_0xd2ad('0x1f')),[_0xd2ad('0x24'),_0xd2ad('0x2a'),_0xd2ad('0x25')]);var _0x392810=(_0x2fa6e7[_0xd2ad('0x24')]||0x0)+(_0x2fa6e7['user']||0x0);var _0x1c42ec=_0x2fa6e7[_0xd2ad('0x25')]||0x0;if(_0x392810>_0x742584['user'])return _0x341ea0(_0xd2ad('0x2b'));if(_0x1c42ec>_0x742584['telephone'])return _0x341ea0(_0xd2ad('0x2c'));return _0x5aa1c7();})['catch'](function(_0x1f9250){_0x341ea0(_0x1f9250);});});}module[_0xd2ad('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index c539929..dfb806e 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 _0x5f66=['app-id','secret','http://localhost:9000'];(function(_0x548e55,_0x309996){var _0x38d80a=function(_0xd40467){while(--_0xd40467){_0x548e55['push'](_0x548e55['shift']());}};_0x38d80a(++_0x309996);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';module['exports']={'DOMAIN':_0x65f6('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x65f6('0x1'),'GOOGLE_SECRET':_0x65f6('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x0120=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x455c85,_0x4ecda9){var _0x506ec4=function(_0x2ae1b0){while(--_0x2ae1b0){_0x455c85['push'](_0x455c85['shift']());}};_0x506ec4(++_0x4ecda9);}(_0x0120,0x6f));var _0x0012=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0120[_0x126558];return _0x1f6d14;};'use strict';module[_0x0012('0x0')]={'DOMAIN':_0x0012('0x1'),'SESSION_SECRET':_0x0012('0x2'),'GOOGLE_ID':_0x0012('0x3'),'GOOGLE_SECRET':_0x0012('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index b719220..d3d94b4 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x550f=['fileLogger','exports'];(function(_0xf66b9,_0x3c0a11){var _0x1305f6=function(_0x468506){while(--_0x468506){_0xf66b9['push'](_0xf66b9['shift']());}};_0x1305f6(++_0x3c0a11);}(_0x550f,0xc6));var _0xf550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550f[_0x3dd15e];return _0x231fd0;};'use strict';var fileLogger=require('../utils/loggers')[_0xf550('0x0')];module[_0xf550('0x1')]=fileLogger; \ No newline at end of file +var _0xf7ad=['exports'];(function(_0x21312c,_0x2b5596){var _0x34d047=function(_0x26d0a4){while(--_0x26d0a4){_0x21312c['push'](_0x21312c['shift']());}};_0x34d047(++_0x2b5596);}(_0xf7ad,0x1cf));var _0xdf7a=function(_0x379008,_0xa1fbaa){_0x379008=_0x379008-0x0;var _0xc436c6=_0xf7ad[_0x379008];return _0xc436c6;};'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module[_0xdf7a('0x0')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 8c18a3e..e1333f9 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 _0x32c0=['legacy-libs','express','ami','join','../../services/ami/index.js','agi','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','../../config/environment','resolve','root'];(function(_0x139c54,_0x53f5a0){var _0x388d4c=function(_0x4d81bd){while(--_0x4d81bd){_0x139c54['push'](_0x139c54['shift']());}};_0x388d4c(++_0x53f5a0);}(_0x32c0,0xa1));var _0x032c=function(_0x43fb3d,_0x114a73){_0x43fb3d=_0x43fb3d-0x0;var _0x47fd81=_0x32c0[_0x43fb3d];return _0x47fd81;};'use strict';var path=require(_0x032c('0x0'));var cfg=require(_0x032c('0x1'));var env={'NODE_PATH':path[_0x032c('0x2')](path['join'](cfg[_0x032c('0x3')],_0x032c('0x4')))};var pm2config={'apps':[{'name':_0x032c('0x5'),'script':path['join'](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x032c('0x6'),'script':path[_0x032c('0x7')](__dirname,_0x032c('0x8')),'env':env},{'name':_0x032c('0x9'),'script':path[_0x032c('0x7')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x032c('0xa'),'script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x032c('0xb'),'script':path[_0x032c('0x7')](__dirname,_0x032c('0xc')),'env':env},{'name':_0x032c('0xd'),'script':path[_0x032c('0x7')](__dirname,_0x032c('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x4c3e=['../../services/routing/index.js','../../services/xdr/index.js','path','../../config/environment','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js'];(function(_0x57aa39,_0x5b7dd9){var _0x1d9f2e=function(_0xda8d8a){while(--_0xda8d8a){_0x57aa39['push'](_0x57aa39['shift']());}};_0x1d9f2e(++_0x5b7dd9);}(_0x4c3e,0x10c));var _0xe4c3=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x4c3e[_0xbb091];return _0x467a04;};'use strict';var path=require(_0xe4c3('0x0'));var cfg=require(_0xe4c3('0x1'));var env={'NODE_PATH':path['resolve'](path[_0xe4c3('0x2')](cfg[_0xe4c3('0x3')],_0xe4c3('0x4')))};var pm2config={'apps':[{'name':_0xe4c3('0x5'),'script':path['join'](__dirname,_0xe4c3('0x6')),'env':env},{'name':_0xe4c3('0x7'),'script':path[_0xe4c3('0x2')](__dirname,_0xe4c3('0x8')),'env':env},{'name':_0xe4c3('0x9'),'script':path['join'](__dirname,_0xe4c3('0xa')),'env':env},{'name':'email','script':path[_0xe4c3('0x2')](__dirname,_0xe4c3('0xb')),'env':env},{'name':'routing','script':path['join'](__dirname,_0xe4c3('0xc')),'env':env},{'name':'xdr','script':path[_0xe4c3('0x2')](__dirname,_0xe4c3('0xd')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 3a1cb58..14b1e37 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 _0xa004=['list','describe','dump','saved','pm2','bluebird','./config','connected','start','disconnect','stop','then','restart'];(function(_0x145b54,_0x267c42){var _0x52007e=function(_0xfc9fdf){while(--_0xfc9fdf){_0x145b54['push'](_0x145b54['shift']());}};_0x52007e(++_0x267c42);}(_0xa004,0x93));var _0x4a00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa004[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x4a00('0x0'));var BPromise=require(_0x4a00('0x1'));var config=require(_0x4a00('0x2'));function connect(){return new BPromise(function(_0x16f4bc,_0x316e75){return pm2['connect'](function(_0x47a489){if(_0x47a489){return _0x316e75(_0x47a489);}return _0x16f4bc(_0x4a00('0x3'));});});};exports[_0x4a00('0x4')]=function(_0x2c28cf){return connect()['then'](function(){return new BPromise(function(_0x53e24f,_0x3b1744){return pm2[_0x4a00('0x4')](_0x2c28cf,function(_0x259d12,_0x42450b){if(_0x259d12){return _0x3b1744(_0x259d12);}pm2[_0x4a00('0x5')]();return _0x53e24f(_0x42450b);});});});};exports[_0x4a00('0x6')]=function(_0x1db5bd){return connect()[_0x4a00('0x7')](function(){return new BPromise(function(_0x31ea4e,_0x2a08cb){return pm2[_0x4a00('0x6')](_0x1db5bd,function(_0x4963cd,_0x2bb2af){if(_0x4963cd){return _0x2a08cb(_0x4963cd);}pm2[_0x4a00('0x5')]();return _0x31ea4e(_0x2bb2af);});});});};exports[_0x4a00('0x8')]=function(_0x2349a7){return connect()['then'](function(){return new BPromise(function(_0x5dcf1e,_0x39fc6d){return pm2[_0x4a00('0x8')](_0x2349a7,function(_0x4e7430,_0xb75f2b){if(_0x4e7430){return _0x39fc6d(_0x4e7430);}pm2[_0x4a00('0x5')]();return _0x5dcf1e(_0xb75f2b);});});});};exports[_0x4a00('0x9')]=function(){return connect()[_0x4a00('0x7')](function(){return new BPromise(function(_0x14fb2a,_0x8ecbe4){return pm2[_0x4a00('0x9')](function(_0x2b4779,_0x12a25c){if(_0x2b4779){return _0x8ecbe4(_0x2b4779);}pm2['disconnect']();return _0x14fb2a(_0x12a25c);});});});};exports[_0x4a00('0xa')]=function(_0xe2c4e9){return connect()[_0x4a00('0x7')](function(){return new BPromise(function(_0x2490d0,_0x3dbee2){return pm2[_0x4a00('0xa')](_0xe2c4e9,function(_0x3ce399,_0x1e1387){if(_0x3ce399){return _0x3dbee2(_0x3ce399);}pm2['disconnect']();return _0x2490d0(_0x1e1387);});});});};exports['delete']=function(_0x160559){return connect()['then'](function(){return new BPromise(function(_0x1da931,_0x26afd9){return pm2['delete'](_0x160559,function(_0xd4010d,_0x402852){if(_0xd4010d){return _0x26afd9(_0xd4010d);}pm2[_0x4a00('0x5')]();return _0x1da931(_0x402852);});});});};exports[_0x4a00('0xb')]=function(){return connect()[_0x4a00('0x7')](function(){return new BPromise(function(_0x260056,_0x3d7fdf){return pm2[_0x4a00('0xb')](function(_0x47596c){if(_0x47596c){return _0x3d7fdf(_0x47596c);}return _0x260056(_0x4a00('0xc'));});});});}; \ No newline at end of file +var _0x3141=['stop','disconnect','restart','list','describe','delete','dump','pm2','./config','connected','start','then'];(function(_0x5df843,_0x35331a){var _0x160f4f=function(_0x48a47d){while(--_0x48a47d){_0x5df843['push'](_0x5df843['shift']());}};_0x160f4f(++_0x35331a);}(_0x3141,0xdf));var _0x1314=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3141[_0x122ef9];return _0x42fba0;};'use strict';var pm2=require(_0x1314('0x0'));var BPromise=require('bluebird');var config=require(_0x1314('0x1'));function connect(){return new BPromise(function(_0x3df58b,_0x5c4278){return pm2['connect'](function(_0x127661){if(_0x127661){return _0x5c4278(_0x127661);}return _0x3df58b(_0x1314('0x2'));});});};exports[_0x1314('0x3')]=function(_0x5630ce){return connect()[_0x1314('0x4')](function(){return new BPromise(function(_0x544522,_0x1587bf){return pm2['start'](_0x5630ce,function(_0x14714a,_0x5722c9){if(_0x14714a){return _0x1587bf(_0x14714a);}pm2['disconnect']();return _0x544522(_0x5722c9);});});});};exports['stop']=function(_0x4757ee){return connect()[_0x1314('0x4')](function(){return new BPromise(function(_0x353770,_0xbf2b4a){return pm2[_0x1314('0x5')](_0x4757ee,function(_0x295873,_0x38a2bb){if(_0x295873){return _0xbf2b4a(_0x295873);}pm2[_0x1314('0x6')]();return _0x353770(_0x38a2bb);});});});};exports['restart']=function(_0x4a18ca){return connect()[_0x1314('0x4')](function(){return new BPromise(function(_0x24e8b2,_0x43d016){return pm2[_0x1314('0x7')](_0x4a18ca,function(_0x496d6f,_0x3f1466){if(_0x496d6f){return _0x43d016(_0x496d6f);}pm2[_0x1314('0x6')]();return _0x24e8b2(_0x3f1466);});});});};exports[_0x1314('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x24d083,_0x2c1f42){return pm2[_0x1314('0x8')](function(_0xc3493f,_0x1c6fec){if(_0xc3493f){return _0x2c1f42(_0xc3493f);}pm2[_0x1314('0x6')]();return _0x24d083(_0x1c6fec);});});});};exports[_0x1314('0x9')]=function(_0x2862bb){return connect()['then'](function(){return new BPromise(function(_0x178923,_0x29ae15){return pm2[_0x1314('0x9')](_0x2862bb,function(_0x42a037,_0x82c3b0){if(_0x42a037){return _0x29ae15(_0x42a037);}pm2['disconnect']();return _0x178923(_0x82c3b0);});});});};exports[_0x1314('0xa')]=function(_0x41f3b1){return connect()[_0x1314('0x4')](function(){return new BPromise(function(_0x3d19e5,_0x2db71f){return pm2['delete'](_0x41f3b1,function(_0x301ff0,_0x14825f){if(_0x301ff0){return _0x2db71f(_0x301ff0);}pm2['disconnect']();return _0x3d19e5(_0x14825f);});});});};exports['dump']=function(){return connect()[_0x1314('0x4')](function(){return new BPromise(function(_0x1d9d57,_0x4e94a1){return pm2[_0x1314('0xb')](function(_0x2468c3){if(_0x2468c3){return _0x4e94a1(_0x2468c3);}return _0x1d9d57('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index afd7171..7e0e966 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 _0x7577=['chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','length','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','defaults','redis','socket.io-emitter','find','then'];(function(_0x81f738,_0x576329){var _0xe6b18c=function(_0x30c5e4){while(--_0x30c5e4){_0x81f738['push'](_0x81f738['shift']());}};_0xe6b18c(++_0x576329);}(_0x7577,0xf2));var _0x7757=function(_0x172e4a,_0x392849){_0x172e4a=_0x172e4a-0x0;var _0x539454=_0x7577[_0x172e4a];return _0x539454;};'use strict';var _=require(_0x7757('0x0'));var moment=require(_0x7757('0x1'));var Redis=require(_0x7757('0x2'));var util=require(_0x7757('0x3'));var config=require(_0x7757('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config['redis']=_[_0x7757('0x5')](config[_0x7757('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x7757('0x7'))(new Redis(config[_0x7757('0x6')]));function closeInteractions(){var _0x3d772e=0x0;var _0xe35884=[];return db['Setting'][_0x7757('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x7757('0x9')](function(_0x46e072){_0x3d772e=_0x46e072[_0x7757('0xa')];if(_0x3d772e){return db[_0x7757('0xb')][_0x7757('0xc')]({'raw':!![],'attributes':['id',_0x7757('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x46e072[_0x7757('0xa')],_0x7757('0xe'))}}});}else{return[];}})['then'](function(_0x1e077a){if(_0x1e077a&&_0x1e077a[_0x7757('0xf')]){_0xe35884=_[_0x7757('0x10')](_0x1e077a||[],'id');logger['info'](_0x7757('0x11'),_0xe35884[_0x7757('0x12')]());return db[_0x7757('0xb')][_0x7757('0x13')]({'closeReason':_0x7757('0x14'),'disposition':_0x7757('0x15'),'closed':!![],'closedAt':moment()['format'](_0x7757('0x16'))},{'where':{'id':_0xe35884}});}})[_0x7757('0x9')](function(){if(_0xe35884&&_0xe35884['length']){logger[_0x7757('0x17')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0xe35884[_0x7757('0x12')]());for(var _0x5a9079=0x0;_0x5a9079<_0xe35884['length'];_0x5a9079++){io['emit']('chatInteraction:update',{'id':_0xe35884[_0x5a9079],'closed':!![]});}}})[_0x7757('0x18')](function(_0x564c39){logger['error'](_0x7757('0x19'),_0x564c39?util[_0x7757('0x1a')](_0x564c39,{'showHidden':![],'depth':null}):'');});}exports[_0x7757('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc6f7=['../../config/environment','../logger','redis','defaults','localhost','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','inspect','start','lodash','moment','ioredis'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xc6f7,0xf9));var _0x7c6f=function(_0x2b3e89,_0x2b91f3){_0x2b3e89=_0x2b3e89-0x0;var _0x439389=_0xc6f7[_0x2b3e89];return _0x439389;};'use strict';var _=require(_0x7c6f('0x0'));var moment=require(_0x7c6f('0x1'));var Redis=require(_0x7c6f('0x2'));var util=require('util');var config=require(_0x7c6f('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x7c6f('0x4'))('schedule');config[_0x7c6f('0x5')]=_[_0x7c6f('0x6')](config[_0x7c6f('0x5')],{'host':_0x7c6f('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7c6f('0x5')]));function closeInteractions(){var _0x3ea144=0x0;var _0x141357=[];return db[_0x7c6f('0x8')][_0x7c6f('0x9')]({'raw':!![],'attributes':['id',_0x7c6f('0xa')],'where':{'id':0x1}})[_0x7c6f('0xb')](function(_0x12ddc3){_0x3ea144=_0x12ddc3[_0x7c6f('0xa')];if(_0x3ea144){return db[_0x7c6f('0xc')][_0x7c6f('0xd')]({'raw':!![],'attributes':['id',_0x7c6f('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7c6f('0xf')](_0x12ddc3[_0x7c6f('0xa')],'minutes')}}});}else{return[];}})[_0x7c6f('0xb')](function(_0x4ec399){if(_0x4ec399&&_0x4ec399[_0x7c6f('0x10')]){_0x141357=_[_0x7c6f('0x11')](_0x4ec399||[],'id');logger[_0x7c6f('0x12')](_0x7c6f('0x13'),_0x141357[_0x7c6f('0x14')]());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0x7c6f('0x15'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x141357}});}})[_0x7c6f('0xb')](function(){if(_0x141357&&_0x141357[_0x7c6f('0x10')]){logger['info'](_0x7c6f('0x16'),_0x141357['join']());for(var _0x244a7d=0x0;_0x244a7d<_0x141357[_0x7c6f('0x10')];_0x244a7d++){io[_0x7c6f('0x17')](_0x7c6f('0x18'),{'id':_0x141357[_0x244a7d],'closed':!![]});}}})['catch'](function(_0xb79c15){logger[_0x7c6f('0x19')]('[CHAT]\x20Error\x20closing\x20interactions',_0xb79c15?util[_0x7c6f('0x1a')](_0xb79c15,{'showHidden':![],'depth':null}):'');});}exports[_0x7c6f('0x1b')]=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 a02869f..b1d3ee5 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 _0x06bc=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x585729,_0x30c1f7){var _0x352998=function(_0x44cbd4){while(--_0x44cbd4){_0x585729['push'](_0x585729['shift']());}};_0x352998(++_0x30c1f7);}(_0x06bc,0x11c));var _0xc06b=function(_0x212e6a,_0x3e6695){_0x212e6a=_0x212e6a-0x0;var _0x4be55b=_0x06bc[_0x212e6a];return _0x4be55b;};'use strict';function start(){var _0x428440=require(_0xc06b('0x0'));return _0x428440[_0xc06b('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x702b=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0x702b,0x158));var _0xb702=function(_0x16f178,_0x4b2042){_0x16f178=_0x16f178-0x0;var _0x5e0d1c=_0x702b[_0x16f178];return _0x5e0d1c;};'use strict';function start(){var _0x419e4e=require(_0xb702('0x0'));return _0x419e4e[_0xb702('0x1')]();}module[_0xb702('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index b97534f..b727f14 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 _0x55eb=['Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','format','%s.%s','basename','extname','join','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','catch','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','difference','intersection','length','exists','stop','toRun','my\x20id','resolve','cron','active','startAt','endAt','add','add\x20cron','deleteJob','stop\x20cron','isBetween','update','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info'];(function(_0xc33007,_0x55a41a){var _0x7c0839=function(_0x3f7af7){while(--_0x3f7af7){_0xc33007['push'](_0xc33007['shift']());}};_0x7c0839(++_0x55a41a);}(_0x55eb,0xf5));var _0xb55e=function(_0x50a5ee,_0x533611){_0x50a5ee=_0x50a5ee-0x0;var _0x46a65b=_0x55eb[_0x50a5ee];return _0x46a65b;};'use strict';var fs=require('fs');var util=require(_0xb55e('0x0'));var path=require(_0xb55e('0x1'));var _=require(_0xb55e('0x2'));var moment=require('moment');var CronJobManager=require(_0xb55e('0x3'));var jayson=require(_0xb55e('0x4'));var BPromise=require(_0xb55e('0x5'));var logger=require(_0xb55e('0x6'))('schedule');var db=require(_0xb55e('0x7'))['db'];var analyticCustomReportController=require(_0xb55e('0x8'));var analyticDefaultReportController=require(_0xb55e('0x9'));var client=jayson[_0xb55e('0xa')][_0xb55e('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2d4329,_0x2c5175){return function(){logger[_0xb55e('0xc')](_0xb55e('0xd'),_0x2d4329[_0xb55e('0xe')]);var _0x3634f5=!![];var _0x577ca3=_0x2d4329[_0xb55e('0xf')]['getSmtpOptions']();var _0xc4724a={'account':_0x577ca3,'message':{'from':util['format'](_0xb55e('0x10'),_0x2d4329[_0xb55e('0xf')][_0xb55e('0x11')],_0x2d4329[_0xb55e('0xf')][_0xb55e('0xe')]||_0x2d4329['MailAccount'][_0xb55e('0x12')][_0xb55e('0x13')]),'to':_0x2d4329[_0xb55e('0xe')],'cc':_0x2d4329['cc'],'bcc':_0x2d4329[_0xb55e('0x14')],'subject':util['format'](_0xb55e('0x15'),_0x2c5175['name'],_0x2d4329[_0xb55e('0x16')],_0x2d4329[_0xb55e('0x17')])}};var _0x1ff7d4=path['join'](__dirname,_0xb55e('0x18'));var _0x56b657=_0x2c5175[_0xb55e('0x19')];var _0x146b72=util[_0xb55e('0x1a')](_0xb55e('0x1b'),path[_0xb55e('0x1c')](_0x2c5175[_0xb55e('0x19')],path[_0xb55e('0x1d')](_0x2c5175[_0xb55e('0x19')])),'zip');var _0x2d9e7c=path[_0xb55e('0x1e')](_0x1ff7d4,_0x56b657);var _0x2f1a15=path[_0xb55e('0x1e')](_0x1ff7d4,_0x146b72);if(fs['existsSync'](_0x2d9e7c)){_0x2c5175[_0xb55e('0x1f')]=_0xb55e('0x20');_0xc4724a[_0xb55e('0x21')][_0xb55e('0x22')]=[{'filename':_0x56b657,'path':_0x2d9e7c}];_0xc4724a[_0xb55e('0x21')][_0xb55e('0x23')]=util['format'](_0xb55e('0x24'),JSON[_0xb55e('0x25')](_0x2c5175,null,0x2));}else if(fs[_0xb55e('0x26')](_0x2f1a15)){_0x2c5175[_0xb55e('0x1f')]=_0xb55e('0x20');_0xc4724a[_0xb55e('0x21')]['attachments']=[{'filename':_0x146b72,'path':_0x2f1a15}];}else{_0xc4724a[_0xb55e('0x21')][_0xb55e('0x23')]=_0xb55e('0x27');if(!_0x2d4329[_0xb55e('0x28')]){_0x3634f5=![];logger[_0xb55e('0xc')](_0xb55e('0x29'));}}if(_0x3634f5){return client[_0xb55e('0x2a')]('SendMail',_0xc4724a)[_0xb55e('0x2b')](function(_0x3577cb){if(_0x3577cb[_0xb55e('0x2c')]){return logger['error'](_0xb55e('0x2d'),JSON[_0xb55e('0x25')](_0x3577cb));}return logger[_0xb55e('0xc')](_0xb55e('0x2e'));})['catch'](function(_0x40169e){return logger[_0xb55e('0x2c')](_0xb55e('0x2d'),JSON[_0xb55e('0x25')](_0x40169e));});}};}function handleError(){return function(_0x2c0f85){return logger[_0xb55e('0x2c')](JSON[_0xb55e('0x25')](_0x2c0f85));};}function handleResult(_0x42d6b9){return function(_0x53591b){logger[_0xb55e('0xc')](_0xb55e('0x2f'),JSON[_0xb55e('0x25')](_0x53591b));if(_0x42d6b9['MailAccount']&&_0x42d6b9[_0xb55e('0xf')][_0xb55e('0x12')]&&!_[_0xb55e('0x30')](_0x42d6b9['email'])){setTimeout(handleSendEmail(_0x42d6b9,_0x53591b),0x3c*0x3e8);}};}function handleJob(_0x4afc72){return function(){try{if(_['isNil'](_0x4afc72[_0xb55e('0x16')])){return logger[_0xb55e('0xc')](_0xb55e('0x31'));}if(_[_0xb55e('0x30')](_0x4afc72[_0xb55e('0x17')])){return logger[_0xb55e('0xc')]('subtractUnit\x20null\x20or\x20undefined');}var _0x4efab8={'startDate':moment()['subtract'](_0x4afc72[_0xb55e('0x16')],_0x4afc72[_0xb55e('0x17')])['format'](_0xb55e('0x32')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xb55e('0x33'),'output':_0x4afc72[_0xb55e('0x34')],'name':_0x4afc72[_0xb55e('0x11')]};if(!_[_0xb55e('0x30')](_0x4afc72[_0xb55e('0x35')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x4afc72['DefaultReportId']);return analyticDefaultReportController[_0xb55e('0x36')]({'id':_0x4afc72[_0xb55e('0x35')]},_0x4efab8)[_0xb55e('0x2b')](handleResult(_0x4afc72))['catch'](handleError());}if(!_[_0xb55e('0x30')](_0x4afc72[_0xb55e('0x37')])){logger[_0xb55e('0xc')](_0xb55e('0x38'),_0x4afc72['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x4afc72[_0xb55e('0x37')]},_0x4efab8)[_0xb55e('0x2b')](handleResult(_0x4afc72))[_0xb55e('0x39')](handleError());}}catch(_0x3a7404){logger[_0xb55e('0x2c')](JSON[_0xb55e('0x25')](_0x3a7404));}return logger[_0xb55e('0xc')](_0xb55e('0x3a'));};}function getJobs(_0xefbb6c){var _0x33097e={};if(_0xefbb6c){_0x33097e['id']=_0xefbb6c;}return db[_0xb55e('0x3b')][_0xb55e('0x3c')]({'where':_0x33097e,'include':[{'model':db['MailAccount'],'attributes':['id','name','email'],'include':[{'model':db[_0xb55e('0x3d')],'as':_0xb55e('0x12'),'include':[{'model':db[_0xb55e('0x3e')],'as':_0xb55e('0x3e')}]}]}]})[_0xb55e('0x2b')](function(_0x1c3258){var _0x559650=_[_0xb55e('0x3f')](manager['jobs']);var _0x3c8dbf=_[_0xb55e('0x40')](_0x1c3258,function(_0x18e81){return _0x18e81['id'][_0xb55e('0x41')]();});var _0xca3d19=_[_0xb55e('0x42')](_0x1c3258,function(_0x336607){return _0x336607['id'][_0xb55e('0x41')]();});var _0x4eebce=_0xefbb6c?_0x3c8dbf:_[_0xb55e('0x43')](_0x3c8dbf,_0x559650);var _0x113c14=_[_0xb55e('0x44')](_0x3c8dbf,_0x559650);var _0x51c051=_[_0xb55e('0x43')](_0x559650,_0x3c8dbf);var _0x5154b3;var _0x11c53e;for(_0x5154b3=0x0;_0x5154b3<_0x51c051[_0xb55e('0x45')]&&!_0xefbb6c;_0x5154b3+=0x1){_0x11c53e=_0x51c051[_0x5154b3][_0xb55e('0x41')]();if(manager[_0xb55e('0x46')](_0x11c53e)){manager[_0xb55e('0x47')](_0x11c53e);manager['deleteJob'](_0x11c53e);logger['info']('delete\x20cron',_0x11c53e);}}logger[_0xb55e('0xc')](_0xb55e('0x48'),JSON[_0xb55e('0x25')](_0x4eebce));for(_0x5154b3=0x0;_0x5154b3<_0x4eebce[_0xb55e('0x45')];_0x5154b3+=0x1){_0x11c53e=_0x4eebce[_0x5154b3][_0xb55e('0x41')]();logger[_0xb55e('0xc')]('index',_0x11c53e);if(_0xefbb6c){logger['info'](_0xb55e('0x49'),_0xefbb6c);logger[_0xb55e('0xc')](JSON[_0xb55e('0x25')](_0xca3d19[_0x11c53e]));BPromise[_0xb55e('0x4a')]()[_0xb55e('0x2b')](handleJob(_0xca3d19[_0x11c53e]));logger[_0xb55e('0xc')]('run\x20job',_0xca3d19[_0x11c53e][_0xb55e('0x11')],_0xca3d19[_0x11c53e][_0xb55e('0x4b')]);}else if(_0xca3d19[_0x11c53e][_0xb55e('0x4b')]&&_0xca3d19[_0x11c53e][_0xb55e('0x4c')]&&moment()['isBetween'](_0xca3d19[_0x11c53e][_0xb55e('0x4d')],_0xca3d19[_0x11c53e][_0xb55e('0x4e')])){manager[_0xb55e('0x4f')](_0x11c53e,_0xca3d19[_0x11c53e][_0xb55e('0x4b')],handleJob(_0xca3d19[_0x11c53e]));manager['start'](_0x11c53e);logger[_0xb55e('0xc')](_0xb55e('0x50'),_0xca3d19[_0x11c53e][_0xb55e('0x11')],_0xca3d19[_0x11c53e]['cron']);}else if(manager[_0xb55e('0x46')](_0x11c53e)){manager[_0xb55e('0x47')](_0x11c53e);manager[_0xb55e('0x51')](_0x11c53e);logger[_0xb55e('0xc')](_0xb55e('0x52'),_0xca3d19[_0x11c53e][_0xb55e('0x11')],_0xca3d19[_0x11c53e]['cron']);}}for(_0x5154b3=0x0,_0x11c53e;_0x5154b3<_0x113c14['length']&&!_0xefbb6c;_0x5154b3+=0x1){_0x11c53e=_0x113c14[_0x5154b3][_0xb55e('0x41')]();if(manager[_0xb55e('0x46')](_0x11c53e)){if(_0xca3d19[_0x11c53e][_0xb55e('0x4b')]&&_0xca3d19[_0x11c53e][_0xb55e('0x4c')]&&moment()[_0xb55e('0x53')](_0xca3d19[_0x11c53e]['startAt'],_0xca3d19[_0x11c53e][_0xb55e('0x4e')])){manager[_0xb55e('0x54')](_0x11c53e,_0xca3d19[_0x11c53e][_0xb55e('0x4b')],handleJob(_0xca3d19[_0x11c53e]));logger[_0xb55e('0xc')]('update\x20cron',_0xca3d19[_0x11c53e]['name'],_0xca3d19[_0x11c53e][_0xb55e('0x4b')]);}else{manager[_0xb55e('0x47')](_0x11c53e);manager[_0xb55e('0x51')](_0x11c53e);logger[_0xb55e('0xc')](_0xb55e('0x52'),_0xca3d19[_0x11c53e][_0xb55e('0x11')],_0xca3d19[_0x11c53e]['cron']);}}}})[_0xb55e('0x39')](function(_0x5e51df){logger[_0xb55e('0x2c')](JSON[_0xb55e('0x25')](_0x5e51df));});}exports[_0xb55e('0x55')]=function(_0x5b9bea){return getJobs(_0x5b9bea);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x4e7c=['schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','catch','data','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','isNil','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','CloudProvider','map','keyBy','difference','intersection','toString','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','update','update\x20cron','stop\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise'];(function(_0x12df52,_0x4dddf5){var _0x228658=function(_0x518081){while(--_0x518081){_0x12df52['push'](_0x12df52['shift']());}};_0x228658(++_0x4dddf5);}(_0x4e7c,0x19f));var _0xc4e7=function(_0x59ce2c,_0x4c60ae){_0x59ce2c=_0x59ce2c-0x0;var _0x22c18f=_0x4e7c[_0x59ce2c];return _0x22c18f;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xc4e7('0x0'));var _=require(_0xc4e7('0x1'));var moment=require(_0xc4e7('0x2'));var CronJobManager=require(_0xc4e7('0x3'));var jayson=require(_0xc4e7('0x4'));var BPromise=require('bluebird');var logger=require('../logger')(_0xc4e7('0x5'));var db=require(_0xc4e7('0x6'))['db'];var analyticCustomReportController=require(_0xc4e7('0x7'));var analyticDefaultReportController=require(_0xc4e7('0x8'));var client=jayson[_0xc4e7('0x9')][_0xc4e7('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4cc991,_0x232a2e){return function(){logger[_0xc4e7('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4cc991[_0xc4e7('0xc')]);var _0x14a8d1=!![];var _0x37ff1f=_0x4cc991[_0xc4e7('0xd')][_0xc4e7('0xe')]();var _0x57b6ed={'account':_0x37ff1f,'message':{'from':util[_0xc4e7('0xf')](_0xc4e7('0x10'),_0x4cc991['MailAccount'][_0xc4e7('0x11')],_0x4cc991[_0xc4e7('0xd')][_0xc4e7('0xc')]||_0x4cc991[_0xc4e7('0xd')][_0xc4e7('0x12')][_0xc4e7('0x13')]),'to':_0x4cc991[_0xc4e7('0xc')],'cc':_0x4cc991['cc'],'bcc':_0x4cc991['bcc'],'subject':util['format'](_0xc4e7('0x14'),_0x232a2e['name'],_0x4cc991['subtractNumber'],_0x4cc991[_0xc4e7('0x15')])}};var _0xc583a0=path[_0xc4e7('0x16')](__dirname,_0xc4e7('0x17'));var _0x1e6db1=_0x232a2e[_0xc4e7('0x18')];var _0x456974=util[_0xc4e7('0xf')](_0xc4e7('0x19'),path[_0xc4e7('0x1a')](_0x232a2e[_0xc4e7('0x18')],path['extname'](_0x232a2e['savename'])),_0xc4e7('0x1b'));var _0x192869=path[_0xc4e7('0x16')](_0xc583a0,_0x1e6db1);var _0x197cbe=path[_0xc4e7('0x16')](_0xc583a0,_0x456974);if(fs[_0xc4e7('0x1c')](_0x192869)){_0x232a2e[_0xc4e7('0x1d')]=_0xc4e7('0x1e');_0x57b6ed['message'][_0xc4e7('0x1f')]=[{'filename':_0x1e6db1,'path':_0x192869}];_0x57b6ed[_0xc4e7('0x20')][_0xc4e7('0x21')]=util[_0xc4e7('0xf')](_0xc4e7('0x22'),JSON[_0xc4e7('0x23')](_0x232a2e,null,0x2));}else if(fs['existsSync'](_0x197cbe)){_0x232a2e[_0xc4e7('0x1d')]='Sent';_0x57b6ed['message'][_0xc4e7('0x1f')]=[{'filename':_0x456974,'path':_0x197cbe}];}else{_0x57b6ed[_0xc4e7('0x20')][_0xc4e7('0x21')]=_0xc4e7('0x24');if(!_0x4cc991['sendIfEmpty']){_0x14a8d1=![];logger[_0xc4e7('0xb')](_0xc4e7('0x25'));}}if(_0x14a8d1){return client['request'](_0xc4e7('0x26'),_0x57b6ed)[_0xc4e7('0x27')](function(_0x4a7de1){if(_0x4a7de1['error']){return logger[_0xc4e7('0x28')](_0xc4e7('0x29'),JSON['stringify'](_0x4a7de1));}return logger['info']('email\x20sent');})[_0xc4e7('0x2a')](function(_0x2e6caf){return logger[_0xc4e7('0x28')](_0xc4e7('0x29'),JSON[_0xc4e7('0x23')](_0x2e6caf));});}};}function handleError(){return function(_0x2e0af8){return logger['error'](JSON[_0xc4e7('0x23')](_0x2e0af8));};}function handleResult(_0x3be9de){return function(_0x2ee4fb){logger['info'](_0xc4e7('0x2b'),JSON[_0xc4e7('0x23')](_0x2ee4fb));if(_0x3be9de[_0xc4e7('0xd')]&&_0x3be9de['MailAccount']['Smtp']&&!_['isNil'](_0x3be9de[_0xc4e7('0xc')])){setTimeout(handleSendEmail(_0x3be9de,_0x2ee4fb),0x3c*0x3e8);}};}function handleJob(_0x4809f4){return function(){try{if(_['isNil'](_0x4809f4[_0xc4e7('0x2c')])){return logger[_0xc4e7('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x4809f4[_0xc4e7('0x15')])){return logger[_0xc4e7('0xb')](_0xc4e7('0x2d'));}var _0x670010={'startDate':moment()[_0xc4e7('0x2e')](_0x4809f4[_0xc4e7('0x2c')],_0x4809f4[_0xc4e7('0x15')])['format'](_0xc4e7('0x2f')),'endDate':moment()['format'](_0xc4e7('0x2f')),'type':_0xc4e7('0x30'),'output':_0x4809f4[_0xc4e7('0x31')],'name':_0x4809f4[_0xc4e7('0x11')]};if(!_[_0xc4e7('0x32')](_0x4809f4[_0xc4e7('0x33')])){logger[_0xc4e7('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x4809f4[_0xc4e7('0x33')]);return analyticDefaultReportController[_0xc4e7('0x34')]({'id':_0x4809f4[_0xc4e7('0x33')]},_0x670010)['then'](handleResult(_0x4809f4))[_0xc4e7('0x2a')](handleError());}if(!_[_0xc4e7('0x32')](_0x4809f4[_0xc4e7('0x35')])){logger[_0xc4e7('0xb')](_0xc4e7('0x36'),_0x4809f4[_0xc4e7('0x35')]);return analyticCustomReportController[_0xc4e7('0x34')]({'id':_0x4809f4['CustomReportId']},_0x670010)[_0xc4e7('0x27')](handleResult(_0x4809f4))['catch'](handleError());}}catch(_0x47ff1d){logger[_0xc4e7('0x28')](JSON['stringify'](_0x47ff1d));}return logger['info'](_0xc4e7('0x37'));};}function getJobs(_0x53d84){var _0x4f9b94={};if(_0x53d84){_0x4f9b94['id']=_0x53d84;}return db['Schedule'][_0xc4e7('0x38')]({'where':_0x4f9b94,'include':[{'model':db[_0xc4e7('0xd')],'attributes':['id',_0xc4e7('0x11'),'email'],'include':[{'model':db[_0xc4e7('0x39')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xc4e7('0x3a')}]}]}]})[_0xc4e7('0x27')](function(_0x42265e){var _0x1c72a6=_['keys'](manager['jobs']);var _0x289d72=_[_0xc4e7('0x3b')](_0x42265e,function(_0x1aa103){return _0x1aa103['id']['toString']();});var _0x52c1b6=_[_0xc4e7('0x3c')](_0x42265e,function(_0x2ee6d7){return _0x2ee6d7['id']['toString']();});var _0x5a0848=_0x53d84?_0x289d72:_[_0xc4e7('0x3d')](_0x289d72,_0x1c72a6);var _0x54315d=_[_0xc4e7('0x3e')](_0x289d72,_0x1c72a6);var _0x51bc8f=_[_0xc4e7('0x3d')](_0x1c72a6,_0x289d72);var _0xc46ed2;var _0x2a3eac;for(_0xc46ed2=0x0;_0xc46ed2<_0x51bc8f['length']&&!_0x53d84;_0xc46ed2+=0x1){_0x2a3eac=_0x51bc8f[_0xc46ed2][_0xc4e7('0x3f')]();if(manager[_0xc4e7('0x40')](_0x2a3eac)){manager[_0xc4e7('0x41')](_0x2a3eac);manager[_0xc4e7('0x42')](_0x2a3eac);logger['info'](_0xc4e7('0x43'),_0x2a3eac);}}logger['info'](_0xc4e7('0x44'),JSON[_0xc4e7('0x23')](_0x5a0848));for(_0xc46ed2=0x0;_0xc46ed2<_0x5a0848[_0xc4e7('0x45')];_0xc46ed2+=0x1){_0x2a3eac=_0x5a0848[_0xc46ed2][_0xc4e7('0x3f')]();logger[_0xc4e7('0xb')](_0xc4e7('0x46'),_0x2a3eac);if(_0x53d84){logger['info'](_0xc4e7('0x47'),_0x53d84);logger['info'](JSON[_0xc4e7('0x23')](_0x52c1b6[_0x2a3eac]));BPromise['resolve']()[_0xc4e7('0x27')](handleJob(_0x52c1b6[_0x2a3eac]));logger[_0xc4e7('0xb')](_0xc4e7('0x48'),_0x52c1b6[_0x2a3eac][_0xc4e7('0x11')],_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]);}else if(_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]&&_0x52c1b6[_0x2a3eac][_0xc4e7('0x4a')]&&moment()[_0xc4e7('0x4b')](_0x52c1b6[_0x2a3eac][_0xc4e7('0x4c')],_0x52c1b6[_0x2a3eac][_0xc4e7('0x4d')])){manager['add'](_0x2a3eac,_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')],handleJob(_0x52c1b6[_0x2a3eac]));manager[_0xc4e7('0x4e')](_0x2a3eac);logger[_0xc4e7('0xb')](_0xc4e7('0x4f'),_0x52c1b6[_0x2a3eac]['name'],_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]);}else if(manager[_0xc4e7('0x40')](_0x2a3eac)){manager[_0xc4e7('0x41')](_0x2a3eac);manager[_0xc4e7('0x42')](_0x2a3eac);logger[_0xc4e7('0xb')]('stop\x20cron',_0x52c1b6[_0x2a3eac][_0xc4e7('0x11')],_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]);}}for(_0xc46ed2=0x0,_0x2a3eac;_0xc46ed2<_0x54315d[_0xc4e7('0x45')]&&!_0x53d84;_0xc46ed2+=0x1){_0x2a3eac=_0x54315d[_0xc46ed2][_0xc4e7('0x3f')]();if(manager['exists'](_0x2a3eac)){if(_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]&&_0x52c1b6[_0x2a3eac]['active']&&moment()['isBetween'](_0x52c1b6[_0x2a3eac][_0xc4e7('0x4c')],_0x52c1b6[_0x2a3eac][_0xc4e7('0x4d')])){manager[_0xc4e7('0x50')](_0x2a3eac,_0x52c1b6[_0x2a3eac]['cron'],handleJob(_0x52c1b6[_0x2a3eac]));logger[_0xc4e7('0xb')](_0xc4e7('0x51'),_0x52c1b6[_0x2a3eac][_0xc4e7('0x11')],_0x52c1b6[_0x2a3eac]['cron']);}else{manager[_0xc4e7('0x41')](_0x2a3eac);manager[_0xc4e7('0x42')](_0x2a3eac);logger[_0xc4e7('0xb')](_0xc4e7('0x52'),_0x52c1b6[_0x2a3eac][_0xc4e7('0x11')],_0x52c1b6[_0x2a3eac][_0xc4e7('0x49')]);}}}})[_0xc4e7('0x2a')](function(_0x54cedd){logger[_0xc4e7('0x28')](JSON['stringify'](_0x54cedd));});}exports[_0xc4e7('0x53')]=function(_0x17151b){return getJobs(_0x17151b);};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 3be3d74..a373d75 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 _0x28f2=['Negative','Neutral','FAILED','FailureReason','resolve','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','getTranscriptionJob','Comprehend','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','fileText','TranscriptionJobStatus','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive'];(function(_0x35821e,_0x1994b6){var _0x44361e=function(_0x512b01){while(--_0x512b01){_0x35821e['push'](_0x35821e['shift']());}};_0x44361e(++_0x1994b6);}(_0x28f2,0x193));var _0x228f=function(_0x907bad,_0x436195){_0x907bad=_0x907bad-0x0;var _0x23b479=_0x28f2[_0x907bad];return _0x23b479;};var _=require(_0x228f('0x0'));var AWS=require(_0x228f('0x1'));var rp=require(_0x228f('0x2'));var util=require(_0x228f('0x3'));var BPromise=require(_0x228f('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x228f('0x5'))(_0x228f('0x6'));function getTranscriptionJob(_0x79ed5f,_0x4303c3,_0x2bb7d7,_0x3439f5){return new Promise(function(_0x32c5c3,_0x485423){var _0x10da58=new AWS['TranscribeService']({'accessKeyId':_0x4303c3,'secretAccessKey':_0x79ed5f,'region':_0x2bb7d7});_0x10da58[_0x228f('0x7')]({'TranscriptionJobName':_0x3439f5},function(_0x455eb6,_0xf4b011){if(_0x455eb6){return _0x485423(_0x455eb6);}else{return _0x32c5c3(_0xf4b011);}});});}function sentiment(_0x5f406c,_0x162ed5,_0x4d0038,_0x212c90,_0x2dfd07){return new Promise(function(_0x4e26fe,_0x3884c6){var _0x40aca5=new AWS[(_0x228f('0x8'))]({'accessKeyId':_0x162ed5,'secretAccessKey':_0x5f406c,'region':_0x4d0038});_0x40aca5[_0x228f('0x9')]({'Text':_0x212c90,'LanguageCode':_0x2dfd07[_0x228f('0xa')](0x0,0x2)},function(_0x4f22af,_0x39616d){if(_0x4f22af){return _0x3884c6(_0x4f22af);}else{return _0x4e26fe(_0x39616d);}});});}function checkTranscribeJob(_0x3e3047,_0x24f69c,_0x14073a){var _0x2e1a43;return new BPromise(function(_0x244d42,_0x18a0cd){logger[_0x228f('0xb')](util['format'](_0x228f('0xc'),_0x3e3047['id'],_0x3e3047[_0x228f('0xd')]));return getTranscriptionJob(_0x14073a[_0x228f('0xe')],_0x14073a[_0x228f('0xf')],_0x24f69c[_0x228f('0x10')],_0x3e3047[_0x228f('0xd')])[_0x228f('0x11')](function(_0x5b5abb){logger[_0x228f('0xb')](util['format'](_0x228f('0x12'),_0x3e3047['id'],_0x3e3047[_0x228f('0xd')],_0x5b5abb[_0x228f('0x13')]['TranscriptionJobStatus']));if(!_0x3e3047[_0x228f('0x14')]){switch(_0x5b5abb['TranscriptionJob'][_0x228f('0x15')]){case'COMPLETED':var _0x30cbc2={'transcribeStatus':_0x5b5abb['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x5b5abb[_0x228f('0x13')]['Transcript'][_0x228f('0x16')]};logger[_0x228f('0xb')](util[_0x228f('0x17')](_0x228f('0x18'),_0x3e3047['id']));return rp({'uri':_0x5b5abb[_0x228f('0x13')][_0x228f('0x19')][_0x228f('0x16')],'json':!![]})[_0x228f('0x11')](function(_0x15d54f){logger['info'](util[_0x228f('0x17')](_0x228f('0x1a'),_0x3e3047['id']));if(_0x15d54f&&_0x15d54f[_0x228f('0x1b')]&&_0x15d54f[_0x228f('0x1b')][_0x228f('0x1c')]&&_0x15d54f[_0x228f('0x1b')][_0x228f('0x1c')][_0x228f('0x1d')]){_0x30cbc2[_0x228f('0x14')]='';for(var _0x56fbc2=0x0;_0x56fbc2<_0x15d54f[_0x228f('0x1b')][_0x228f('0x1c')][_0x228f('0x1d')];_0x56fbc2++){_0x30cbc2[_0x228f('0x14')]+=_0x15d54f[_0x228f('0x1b')]['transcripts'][_0x56fbc2][_0x228f('0x1e')]+'';}}return _0x3e3047['update'](_0x30cbc2);})[_0x228f('0x11')](function(){logger['info'](util['format'](_0x228f('0x1f'),_0x3e3047['id']));if(!_0x3e3047[_0x228f('0x20')]){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x23'));}if(!_0x24f69c[_0x228f('0x24')]||!_0x24f69c[_0x228f('0x25')]||!_0x24f69c[_0x228f('0x26')]||!_0x24f69c[_0x228f('0x27')]||!_0x24f69c[_0x228f('0x28')]){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x29'));}if(!_0x30cbc2[_0x228f('0x14')]){throw new Error(_0x228f('0x2a'));}if(_0x24f69c['sentimentAccountId']===_0x14073a['id']){return _0x14073a;}else{return db[_0x228f('0x2b')][_0x228f('0x2c')]({'where':{'id':_settings[_0x228f('0x25')]}});}})['then'](function(_0x32e0ce){if(!_0x32e0ce){throw new db[(_0x228f('0x21'))]['ValidationError'](_0x228f('0x2d'));}if(!_0x32e0ce[_0x228f('0xe')]||!_0x32e0ce[_0x228f('0xf')]){throw new db[(_0x228f('0x21'))]['ValidationError'](_0x228f('0x2e'));}_0x2e1a43=_0x32e0ce;logger['info'](util[_0x228f('0x17')](_0x228f('0x2f'),_0x3e3047['id']));return sentiment(_0x2e1a43[_0x228f('0xe')],_0x2e1a43[_0x228f('0xf')],_0x24f69c['sentimentRegion'],_0x30cbc2[_0x228f('0x14')],_0x24f69c[_0x228f('0x27')]);})['then'](function(_0x570d01){logger['info'](util[_0x228f('0x17')](_0x228f('0x30'),_0x3e3047['id']));return _0x3e3047[_0x228f('0x31')]({'sentiment':_0x570d01[_0x228f('0x32')],'sPositive':_0x570d01[_0x228f('0x33')][_0x228f('0x34')],'sNegative':_0x570d01[_0x228f('0x33')][_0x228f('0x35')],'sMixed':_0x570d01[_0x228f('0x33')]['Mixed'],'sNeutral':_0x570d01['SentimentScore'][_0x228f('0x36')]});})[_0x228f('0x11')](function(){logger[_0x228f('0xb')](util[_0x228f('0x17')](_0x228f('0x1f'),_0x3e3047['id']));_0x244d42();});case _0x228f('0x37'):return _0x3e3047[_0x228f('0x31')]({'transcribeStatus':_0x228f('0x37'),'failureReason':_0x5b5abb[_0x228f('0x13')][_0x228f('0x38')]})['then'](function(){logger['info'](util[_0x228f('0x17')](_0x228f('0x1f'),_0x3e3047['id']));_0x244d42();});default:logger[_0x228f('0xb')](util[_0x228f('0x17')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3e3047['id']));break;}}else{return BPromise[_0x228f('0x39')]()[_0x228f('0x11')](function(){if(!_0x3e3047['tempSentiment']){throw new db['Sequelize'][(_0x228f('0x22'))](_0x228f('0x23'));}if(!_0x24f69c['sentiment']||!_0x24f69c[_0x228f('0x25')]||!_0x24f69c[_0x228f('0x26')]||!_0x24f69c['language']||!_0x24f69c['bucket']){throw new db[(_0x228f('0x21'))]['ValidationError'](_0x228f('0x29'));}if(!_0x3e3047[_0x228f('0x14')]){throw new Error(_0x228f('0x2a'));}if(_0x24f69c[_0x228f('0x25')]===_0x14073a['id']){return _0x14073a;}else{return db[_0x228f('0x2b')][_0x228f('0x2c')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x228f('0x11')](function(_0x5cdd16){if(!_0x5cdd16){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x2d'));}if(!_0x5cdd16[_0x228f('0xe')]||!_0x5cdd16[_0x228f('0xf')]){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x2e'));}_0x2e1a43=_0x5cdd16;logger[_0x228f('0xb')](util[_0x228f('0x17')](_0x228f('0x2f'),_0x3e3047['id']));return sentiment(_0x2e1a43[_0x228f('0xe')],_0x2e1a43[_0x228f('0xf')],_0x24f69c['sentimentRegion'],_0x3e3047['fileText'],_0x24f69c[_0x228f('0x27')]);})[_0x228f('0x11')](function(_0x34cd3c){logger[_0x228f('0xb')](util[_0x228f('0x17')](_0x228f('0x30'),_0x3e3047['id']));return _0x3e3047[_0x228f('0x31')]({'sentiment':_0x34cd3c[_0x228f('0x32')],'sPositive':_0x34cd3c[_0x228f('0x33')][_0x228f('0x34')],'sNegative':_0x34cd3c['SentimentScore'][_0x228f('0x35')],'sMixed':_0x34cd3c[_0x228f('0x33')]['Mixed'],'sNeutral':_0x34cd3c[_0x228f('0x33')]['Neutral'],'transcribeStatus':_0x228f('0x3a')});})['then'](function(){logger[_0x228f('0xb')](util['format'](_0x228f('0x1f'),_0x3e3047['id']));_0x244d42();});}})[_0x228f('0x3b')](function(_0x43b2cc){if(_0x43b2cc){if(!_0x43b2cc[_0x228f('0x3c')]||_0x43b2cc[_0x228f('0x3c')]!==_0x228f('0x3d')){logger[_0x228f('0x3e')](util[_0x228f('0x17')](_0x228f('0x3f'),_0x3e3047['id']),util[_0x228f('0x40')](_0x43b2cc,{'showHidden':![],'depth':null}));}}_0x244d42();});});}function checkTranscribe(){var _0x2fcf5f;var _0xf940d8;var _0x4099d4;return db[_0x228f('0x41')][_0x228f('0x42')]({'where':{'transcribeStatus':_0x228f('0x43')}})[_0x228f('0x11')](function(_0x102e2a){if(!_0x102e2a||!_0x102e2a[_0x228f('0x1d')]){throw new db['Sequelize']['ValidationError'](_0x228f('0x44'));}_0x2fcf5f=_0x102e2a;return db[_0x228f('0x45')][_0x228f('0x2c')]({'where':{'id':0x1}});})['then'](function(_0x17bcd9){if(!_0x17bcd9){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))]('Settings\x20not\x20available');}_0xf940d8=_0x17bcd9;if(!_0xf940d8['transcribe']||!_0xf940d8['transcribeAccountId']||!_0xf940d8[_0x228f('0x10')]||!_0xf940d8[_0x228f('0x27')]||!_0xf940d8[_0x228f('0x28')]){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x46'));}return db[_0x228f('0x2b')][_0x228f('0x2c')]({'where':{'id':_0xf940d8[_0x228f('0x47')]}});})[_0x228f('0x11')](function(_0x43bbd2){if(!_0x43bbd2){throw new db[(_0x228f('0x21'))]['ValidationError'](_0x228f('0x2d'));}if(!_0x43bbd2[_0x228f('0xe')]||!_0x43bbd2[_0x228f('0xf')]){throw new db[(_0x228f('0x21'))][(_0x228f('0x22'))](_0x228f('0x2e'));}_0x4099d4=_0x43bbd2;var _0x671142=[];_0x2fcf5f[_0x228f('0x48')](function(_0x4feefb){_0x671142[_0x228f('0x49')](checkTranscribeJob(_0x4feefb,_0xf940d8,_0x4099d4));});return BPromise[_0x228f('0x4a')](_0x671142);})[_0x228f('0x3b')](function(_0x22aa23){if(_0x22aa23){if(!_0x22aa23['name']||_0x22aa23[_0x228f('0x3c')]!==_0x228f('0x3d')){logger['error'](util[_0x228f('0x40')](_0x22aa23,{'showHidden':![],'depth':null}));}}});}exports[_0x228f('0x4b')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xb4f4=['aws-sdk','util','bluebird','../../mysqldb','../../config/logger','Comprehend','detectSentiment','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','info','format','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Transcript\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','start','lodash'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xb4f4,0xda));var _0x4b4f=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xb4f4[_0x172747];return _0x509692;};var _=require(_0x4b4f('0x0'));var AWS=require(_0x4b4f('0x1'));var rp=require('request-promise');var util=require(_0x4b4f('0x2'));var BPromise=require(_0x4b4f('0x3'));var db=require(_0x4b4f('0x4'))['db'];var logger=require(_0x4b4f('0x5'))('transcribe');function getTranscriptionJob(_0x2c27ce,_0x40e54b,_0x2de488,_0x183a72){return new Promise(function(_0x1faad4,_0x15e02e){var _0x405321=new AWS['TranscribeService']({'accessKeyId':_0x40e54b,'secretAccessKey':_0x2c27ce,'region':_0x2de488});_0x405321['getTranscriptionJob']({'TranscriptionJobName':_0x183a72},function(_0x108b4e,_0x2c647f){if(_0x108b4e){return _0x15e02e(_0x108b4e);}else{return _0x1faad4(_0x2c647f);}});});}function sentiment(_0x2e744d,_0x2a520b,_0x25e0c9,_0x4d8765,_0x155d17){return new Promise(function(_0x7cd37a,_0x39664b){var _0x5f0f0b=new AWS[(_0x4b4f('0x6'))]({'accessKeyId':_0x2a520b,'secretAccessKey':_0x2e744d,'region':_0x25e0c9});_0x5f0f0b[_0x4b4f('0x7')]({'Text':_0x4d8765,'LanguageCode':_0x155d17['substring'](0x0,0x2)},function(_0x44e469,_0x387a6b){if(_0x44e469){return _0x39664b(_0x44e469);}else{return _0x7cd37a(_0x387a6b);}});});}function checkTranscribeJob(_0xb62931,_0x154b05,_0x42973f){var _0x3ca456;return new BPromise(function(_0x1b7138,_0x13f3a1){logger['info'](util['format'](_0x4b4f('0x8'),_0xb62931['id'],_0xb62931[_0x4b4f('0x9')]));return getTranscriptionJob(_0x42973f['data1'],_0x42973f[_0x4b4f('0xa')],_0x154b05[_0x4b4f('0xb')],_0xb62931[_0x4b4f('0x9')])['then'](function(_0x1c74d4){logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0xb62931['id'],_0xb62931[_0x4b4f('0x9')],_0x1c74d4[_0x4b4f('0xe')][_0x4b4f('0xf')]));if(!_0xb62931[_0x4b4f('0x10')]){switch(_0x1c74d4[_0x4b4f('0xe')][_0x4b4f('0xf')]){case _0x4b4f('0x11'):var _0xcb27ba={'transcribeStatus':_0x1c74d4[_0x4b4f('0xe')]['TranscriptionJobStatus'],'fileUri':_0x1c74d4[_0x4b4f('0xe')][_0x4b4f('0x12')][_0x4b4f('0x13')]};logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')](_0x4b4f('0x14'),_0xb62931['id']));return rp({'uri':_0x1c74d4[_0x4b4f('0xe')][_0x4b4f('0x12')][_0x4b4f('0x13')],'json':!![]})[_0x4b4f('0x15')](function(_0x445605){logger['info'](util[_0x4b4f('0xd')](_0x4b4f('0x16'),_0xb62931['id']));if(_0x445605&&_0x445605[_0x4b4f('0x17')]&&_0x445605['results'][_0x4b4f('0x18')]&&_0x445605['results'][_0x4b4f('0x18')]['length']){_0xcb27ba[_0x4b4f('0x10')]='';for(var _0x5da930=0x0;_0x5da930<_0x445605[_0x4b4f('0x17')][_0x4b4f('0x18')]['length'];_0x5da930++){_0xcb27ba[_0x4b4f('0x10')]+=_0x445605[_0x4b4f('0x17')][_0x4b4f('0x18')][_0x5da930][_0x4b4f('0x19')]+'';}}return _0xb62931[_0x4b4f('0x1a')](_0xcb27ba);})[_0x4b4f('0x15')](function(){logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xb62931['id']));if(!_0xb62931['tempSentiment']){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x1d'));}if(!_0x154b05[_0x4b4f('0x1e')]||!_0x154b05[_0x4b4f('0x1f')]||!_0x154b05[_0x4b4f('0x20')]||!_0x154b05[_0x4b4f('0x21')]||!_0x154b05[_0x4b4f('0x22')]){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x23'));}if(!_0xcb27ba['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x154b05[_0x4b4f('0x1f')]===_0x42973f['id']){return _0x42973f;}else{return db[_0x4b4f('0x24')][_0x4b4f('0x25')]({'where':{'id':_settings[_0x4b4f('0x1f')]}});}})[_0x4b4f('0x15')](function(_0x3ce343){if(!_0x3ce343){throw new db['Sequelize'][(_0x4b4f('0x1c'))](_0x4b4f('0x26'));}if(!_0x3ce343[_0x4b4f('0x27')]||!_0x3ce343['data2']){throw new db[(_0x4b4f('0x1b'))]['ValidationError'](_0x4b4f('0x28'));}_0x3ca456=_0x3ce343;logger['info'](util[_0x4b4f('0xd')](_0x4b4f('0x29'),_0xb62931['id']));return sentiment(_0x3ca456[_0x4b4f('0x27')],_0x3ca456['data2'],_0x154b05[_0x4b4f('0x20')],_0xcb27ba[_0x4b4f('0x10')],_0x154b05[_0x4b4f('0x21')]);})[_0x4b4f('0x15')](function(_0x2f1e16){logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')](_0x4b4f('0x2a'),_0xb62931['id']));return _0xb62931[_0x4b4f('0x1a')]({'sentiment':_0x2f1e16[_0x4b4f('0x2b')],'sPositive':_0x2f1e16[_0x4b4f('0x2c')][_0x4b4f('0x2d')],'sNegative':_0x2f1e16[_0x4b4f('0x2c')][_0x4b4f('0x2e')],'sMixed':_0x2f1e16['SentimentScore'][_0x4b4f('0x2f')],'sNeutral':_0x2f1e16[_0x4b4f('0x2c')]['Neutral']});})[_0x4b4f('0x15')](function(){logger[_0x4b4f('0xc')](util['format'](_0x4b4f('0x30'),_0xb62931['id']));_0x1b7138();});case _0x4b4f('0x31'):return _0xb62931[_0x4b4f('0x1a')]({'transcribeStatus':_0x4b4f('0x31'),'failureReason':_0x1c74d4[_0x4b4f('0xe')][_0x4b4f('0x32')]})[_0x4b4f('0x15')](function(){logger[_0x4b4f('0xc')](util['format'](_0x4b4f('0x30'),_0xb62931['id']));_0x1b7138();});default:logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')](_0x4b4f('0x33'),_0xb62931['id']));break;}}else{return BPromise[_0x4b4f('0x34')]()[_0x4b4f('0x15')](function(){if(!_0xb62931[_0x4b4f('0x35')]){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x1d'));}if(!_0x154b05[_0x4b4f('0x1e')]||!_0x154b05[_0x4b4f('0x1f')]||!_0x154b05[_0x4b4f('0x20')]||!_0x154b05[_0x4b4f('0x21')]||!_0x154b05[_0x4b4f('0x22')]){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x23'));}if(!_0xb62931[_0x4b4f('0x10')]){throw new Error(_0x4b4f('0x36'));}if(_0x154b05[_0x4b4f('0x1f')]===_0x42973f['id']){return _0x42973f;}else{return db[_0x4b4f('0x24')][_0x4b4f('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x4b4f('0x15')](function(_0x4e64e3){if(!_0x4e64e3){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x26'));}if(!_0x4e64e3[_0x4b4f('0x27')]||!_0x4e64e3[_0x4b4f('0xa')]){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0x3ca456=_0x4e64e3;logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xb62931['id']));return sentiment(_0x3ca456[_0x4b4f('0x27')],_0x3ca456[_0x4b4f('0xa')],_0x154b05[_0x4b4f('0x20')],_0xb62931['fileText'],_0x154b05[_0x4b4f('0x21')]);})[_0x4b4f('0x15')](function(_0x5243c0){logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')](_0x4b4f('0x2a'),_0xb62931['id']));return _0xb62931[_0x4b4f('0x1a')]({'sentiment':_0x5243c0[_0x4b4f('0x2b')],'sPositive':_0x5243c0['SentimentScore'][_0x4b4f('0x2d')],'sNegative':_0x5243c0['SentimentScore'][_0x4b4f('0x2e')],'sMixed':_0x5243c0[_0x4b4f('0x2c')]['Mixed'],'sNeutral':_0x5243c0[_0x4b4f('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x4b4f('0x15')](function(){logger[_0x4b4f('0xc')](util[_0x4b4f('0xd')](_0x4b4f('0x30'),_0xb62931['id']));_0x1b7138();});}})[_0x4b4f('0x37')](function(_0x7d55f6){if(_0x7d55f6){if(!_0x7d55f6[_0x4b4f('0x38')]||_0x7d55f6[_0x4b4f('0x38')]!==_0x4b4f('0x39')){logger[_0x4b4f('0x3a')](util['format'](_0x4b4f('0x3b'),_0xb62931['id']),util[_0x4b4f('0x3c')](_0x7d55f6,{'showHidden':![],'depth':null}));}}_0x1b7138();});});}function checkTranscribe(){var _0x29e829;var _0x1255a6;var _0xe6decf;return db['VoiceRecording'][_0x4b4f('0x3d')]({'where':{'transcribeStatus':_0x4b4f('0x3e')}})[_0x4b4f('0x15')](function(_0x361088){if(!_0x361088||!_0x361088[_0x4b4f('0x3f')]){throw new db['Sequelize']['ValidationError'](_0x4b4f('0x40'));}_0x29e829=_0x361088;return db[_0x4b4f('0x41')][_0x4b4f('0x25')]({'where':{'id':0x1}});})[_0x4b4f('0x15')](function(_0x2917d7){if(!_0x2917d7){throw new db['Sequelize'][(_0x4b4f('0x1c'))](_0x4b4f('0x42'));}_0x1255a6=_0x2917d7;if(!_0x1255a6[_0x4b4f('0x43')]||!_0x1255a6[_0x4b4f('0x44')]||!_0x1255a6['transcribeRegion']||!_0x1255a6[_0x4b4f('0x21')]||!_0x1255a6[_0x4b4f('0x22')]){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x45'));}return db['CloudProvider']['findOne']({'where':{'id':_0x1255a6[_0x4b4f('0x44')]}});})[_0x4b4f('0x15')](function(_0x4a5ae6){if(!_0x4a5ae6){throw new db[(_0x4b4f('0x1b'))][(_0x4b4f('0x1c'))](_0x4b4f('0x26'));}if(!_0x4a5ae6[_0x4b4f('0x27')]||!_0x4a5ae6[_0x4b4f('0xa')]){throw new db['Sequelize'][(_0x4b4f('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0xe6decf=_0x4a5ae6;var _0x662fa1=[];_0x29e829[_0x4b4f('0x46')](function(_0x15ce66){_0x662fa1[_0x4b4f('0x47')](checkTranscribeJob(_0x15ce66,_0x1255a6,_0xe6decf));});return BPromise['all'](_0x662fa1);})[_0x4b4f('0x37')](function(_0x47e15d){if(_0x47e15d){if(!_0x47e15d[_0x4b4f('0x38')]||_0x47e15d[_0x4b4f('0x38')]!==_0x4b4f('0x39')){logger[_0x4b4f('0x3a')](util[_0x4b4f('0x3c')](_0x47e15d,{'showHidden':![],'depth':null}));}}});}exports[_0x4b4f('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 21a1615..175d791 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 _0x58ef=['redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','schedule'];(function(_0x542a9b,_0x351513){var _0x4d5032=function(_0x538ed2){while(--_0x538ed2){_0x542a9b['push'](_0x542a9b['shift']());}};_0x4d5032(++_0x351513);}(_0x58ef,0x100));var _0xf58e=function(_0x3cb0a9,_0x172b0a){_0x3cb0a9=_0x3cb0a9-0x0;var _0x5e45fc=_0x58ef[_0x3cb0a9];return _0x5e45fc;};'use strict';var _=require('lodash');var moment=require(_0xf58e('0x0'));var Redis=require(_0xf58e('0x1'));var util=require(_0xf58e('0x2'));var config=require(_0xf58e('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xf58e('0x4'));config[_0xf58e('0x5')]=_['defaults'](config[_0xf58e('0x5')],{'host':_0xf58e('0x6'),'port':0x18eb});var io=require(_0xf58e('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x205da4=[];return db[_0xf58e('0x8')][_0xf58e('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xf58e('0xa'))}}})[_0xf58e('0xb')](function(_0xf7a15d){if(_0xf7a15d&&_0xf7a15d[_0xf58e('0xc')]){_0x205da4=_[_0xf58e('0xd')](_0xf7a15d||[],'id');logger['info'](_0xf58e('0xe'),_0x205da4['join']());return db[_0xf58e('0x8')][_0xf58e('0xf')]({'closeReason':_0xf58e('0x10'),'disposition':_0xf58e('0x11'),'closed':!![],'closedAt':moment()[_0xf58e('0x12')](_0xf58e('0x13'))},{'where':{'id':_0x205da4}});}})[_0xf58e('0xb')](function(){if(_0x205da4&&_0x205da4[_0xf58e('0xc')]){logger['info'](_0xf58e('0x14'),_0x205da4[_0xf58e('0x15')]());for(var _0x1e9f12=0x0;_0x1e9f12<_0x205da4[_0xf58e('0xc')];_0x1e9f12++){io[_0xf58e('0x16')](_0xf58e('0x17'),{'id':_0x205da4[_0x1e9f12],'closed':!![]});}}})[_0xf58e('0x18')](function(_0xdfd1){logger[_0xf58e('0x19')](_0xf58e('0x1a'),_0xdfd1?util[_0xf58e('0x1b')](_0xdfd1,{'showHidden':![],'depth':null}):'');});}exports[_0xf58e('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x55f6=['system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment','../../mysqldb','schedule','redis','socket.io-emitter','WhatsappInteraction','subtract','hours','then','length','map','join'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x55f6,0xc2));var _0x655f=function(_0x20e283,_0x2b5a6e){_0x20e283=_0x20e283-0x0;var _0x199e10=_0x55f6[_0x20e283];return _0x199e10;};'use strict';var _=require(_0x655f('0x0'));var moment=require(_0x655f('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x655f('0x2'));var db=require(_0x655f('0x3'))['db'];var logger=require('../logger')(_0x655f('0x4'));config[_0x655f('0x5')]=_['defaults'](config[_0x655f('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x655f('0x6'))(new Redis(config[_0x655f('0x5')]));function closeInteractions(){var _0x71f9c1=[];return db[_0x655f('0x7')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x655f('0x8')](0x18,_0x655f('0x9'))}}})[_0x655f('0xa')](function(_0x4dca43){if(_0x4dca43&&_0x4dca43[_0x655f('0xb')]){_0x71f9c1=_[_0x655f('0xc')](_0x4dca43||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x71f9c1[_0x655f('0xd')]());return db[_0x655f('0x7')]['update']({'closeReason':_0x655f('0xe'),'disposition':_0x655f('0xf'),'closed':!![],'closedAt':moment()[_0x655f('0x10')](_0x655f('0x11'))},{'where':{'id':_0x71f9c1}});}})['then'](function(){if(_0x71f9c1&&_0x71f9c1['length']){logger[_0x655f('0x12')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x71f9c1[_0x655f('0xd')]());for(var _0x284468=0x0;_0x284468<_0x71f9c1[_0x655f('0xb')];_0x284468++){io[_0x655f('0x13')](_0x655f('0x14'),{'id':_0x71f9c1[_0x284468],'closed':!![]});}}})[_0x655f('0x15')](function(_0x2391ac){logger[_0x655f('0x16')](_0x655f('0x17'),_0x2391ac?util[_0x655f('0x18')](_0x2391ac,{'showHidden':![],'depth':null}):'');});}exports[_0x655f('0x19')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 1ada33d..00b2350 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb0b=['hopper1','contacts2','hopper2','catch','util','../mysqldb','push','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','then','bulkCreate','log','finished\x20populating','destroy','CmHopper'];(function(_0xc79ec1,_0x1ac92f){var _0x1ea29c=function(_0x391922){while(--_0x391922){_0xc79ec1['push'](_0xc79ec1['shift']());}};_0x1ea29c(++_0x1ac92f);}(_0xbb0b,0xee));var _0xbbb0=function(_0x3fb440,_0x420610){_0x3fb440=_0x3fb440-0x0;var _0x2522cd=_0xbb0b[_0x3fb440];return _0x2522cd;};'use strict';var util=require(_0xbbb0('0x0'));var db=require(_0xbbb0('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbbb0('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbbb0('0x3')+i+_0xbbb0('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbbb0('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbbb0('0x5')](),'updatedAt':Date[_0xbbb0('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xbbb0('0x2')]({'id':i,'firstName':_0xbbb0('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbbb0('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbbb0('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xbbb0('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbbb0('0x5')](),'updatedAt':Date[_0xbbb0('0x5')]()});}db[_0xbbb0('0x7')]['destroy']({'where':{}})[_0xbbb0('0x8')](function(){return db[_0xbbb0('0x7')][_0xbbb0('0x9')](contacts);})[_0xbbb0('0x8')](function(){console[_0xbbb0('0xa')](_0xbbb0('0xb'),'contacts1');return db['CmHopper'][_0xbbb0('0xc')]({'where':{}});})[_0xbbb0('0x8')](function(){return db[_0xbbb0('0xd')]['bulkCreate'](hopper);})['then'](function(){console['log'](_0xbbb0('0xb'),_0xbbb0('0xe'));return db[_0xbbb0('0x7')]['bulkCreate'](contacts2);})[_0xbbb0('0x8')](function(){console[_0xbbb0('0xa')](_0xbbb0('0xb'),_0xbbb0('0xf'));return db['CmHopper'][_0xbbb0('0x9')](hopper2);})[_0xbbb0('0x8')](function(){console['log']('finished\x20populating',_0xbbb0('0x10'));})[_0xbbb0('0x11')](function(_0x28e8c1){console['log'](_0x28e8c1);}); \ No newline at end of file +var _0xa0d0=['catch','util','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','push','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','hopper2'];(function(_0x26be65,_0x513b6a){var _0x35b5d8=function(_0x1be774){while(--_0x1be774){_0x26be65['push'](_0x26be65['shift']());}};_0x35b5d8(++_0x513b6a);}(_0xa0d0,0x79));var _0x0a0d=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa0d0[_0x4709c0];return _0x13348b;};'use strict';var util=require(_0x0a0d('0x0'));var db=require(_0x0a0d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x0a0d('0x2')+i,'phone':0xf879fb460+i,'email':_0x0a0d('0x3')+i+_0x0a0d('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x0a0d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0a0d('0x5')](),'updatedAt':Date[_0x0a0d('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x0a0d('0x6')+i,'lastName':_0x0a0d('0x2')+i,'phone':0xf879fb460+i,'email':_0x0a0d('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0a0d('0x7')]({'id':i,'active':![],'scheduledat':Date[_0x0a0d('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0a0d('0x5')](),'updatedAt':Date['now']()});}db[_0x0a0d('0x8')][_0x0a0d('0x9')]({'where':{}})[_0x0a0d('0xa')](function(){return db[_0x0a0d('0x8')][_0x0a0d('0xb')](contacts);})[_0x0a0d('0xa')](function(){console['log'](_0x0a0d('0xc'),_0x0a0d('0xd'));return db[_0x0a0d('0xe')][_0x0a0d('0x9')]({'where':{}});})[_0x0a0d('0xa')](function(){return db[_0x0a0d('0xe')][_0x0a0d('0xb')](hopper);})[_0x0a0d('0xa')](function(){console[_0x0a0d('0xf')](_0x0a0d('0xc'),_0x0a0d('0x10'));return db[_0x0a0d('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0x0a0d('0xf')](_0x0a0d('0xc'),_0x0a0d('0x11'));return db[_0x0a0d('0xe')][_0x0a0d('0xb')](hopper2);})[_0x0a0d('0xa')](function(){console[_0x0a0d('0xf')](_0x0a0d('0xc'),_0x0a0d('0x12'));})[_0x0a0d('0x13')](function(_0x181b75){console[_0x0a0d('0xf')](_0x181b75);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a6f317a..567fd60 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f57=['catch','../mysqldb','format','%s%s','agent','friend','udp','wss','all','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user'];(function(_0x213c93,_0x2146ad){var _0x8ef7cf=function(_0x281e0a){while(--_0x281e0a){_0x213c93['push'](_0x213c93['shift']());}};_0x8ef7cf(++_0x2146ad);}(_0x0f57,0xef));var _0x70f5=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x0f57[_0x21549c];return _0x426cbd;};'use strict';var util=require('util');var db=require(_0x70f5('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x70f5('0x1')](_0x70f5('0x2'),_0x70f5('0x3'),i),'fullname':util[_0x70f5('0x1')](_0x70f5('0x2'),_0x70f5('0x3'),i),'email':util[_0x70f5('0x1')]('%s%s@xcally.com',_0x70f5('0x3'),i),'role':_0x70f5('0x3'),'password':'password','internal':0xfa0+i,'type':_0x70f5('0x4'),'transport':[_0x70f5('0x5'),'ws',_0x70f5('0x6')],'disallow':[_0x70f5('0x7')],'allow':['ulaw'],'defaultuser':util['format']('%s%s',_0x70f5('0x3'),i),'encryption':'yes','avpf':'yes','force_avp':_0x70f5('0x8'),'icesupport':_0x70f5('0x8'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x70f5('0x9'),'callerid':util[_0x70f5('0x1')](_0x70f5('0xa'),util['format'](_0x70f5('0x2'),_0x70f5('0x3'),i),0xfa0+i)});}db[_0x70f5('0xb')][_0x70f5('0xc')](users)[_0x70f5('0xd')](function(){console[_0x70f5('0xe')](_0x70f5('0xf'));})[_0x70f5('0x10')](function(_0x3dec8e){console[_0x70f5('0xe')](_0x3dec8e);}); \ No newline at end of file +var _0xb632=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x1a504a,_0x15d44b){var _0x571c54=function(_0x505c73){while(--_0x505c73){_0x1a504a['push'](_0x1a504a['shift']());}};_0x571c54(++_0x15d44b);}(_0xb632,0xd7));var _0x2b63=function(_0x1fde0f,_0x163737){_0x1fde0f=_0x1fde0f-0x0;var _0x559ec0=_0xb632[_0x1fde0f];return _0x559ec0;};'use strict';var util=require(_0x2b63('0x0'));var db=require(_0x2b63('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2b63('0x2')]({'name':util[_0x2b63('0x3')]('%s%s',_0x2b63('0x4'),i),'fullname':util[_0x2b63('0x3')](_0x2b63('0x5'),_0x2b63('0x4'),i),'email':util[_0x2b63('0x3')](_0x2b63('0x6'),_0x2b63('0x4'),i),'role':'agent','password':_0x2b63('0x7'),'internal':0xfa0+i,'type':_0x2b63('0x8'),'transport':[_0x2b63('0x9'),'ws',_0x2b63('0xa')],'disallow':[_0x2b63('0xb')],'allow':[_0x2b63('0xc')],'defaultuser':util[_0x2b63('0x3')](_0x2b63('0x5'),_0x2b63('0x4'),i),'encryption':_0x2b63('0xd'),'avpf':_0x2b63('0xd'),'force_avp':_0x2b63('0xd'),'icesupport':_0x2b63('0xd'),'dtlsenable':_0x2b63('0xd'),'dtlsverify':'no','dtlscertfile':_0x2b63('0xe'),'dtlsprivatekey':_0x2b63('0xf'),'dtlssetup':_0x2b63('0x10'),'callerid':util[_0x2b63('0x3')](_0x2b63('0x11'),util[_0x2b63('0x3')](_0x2b63('0x5'),_0x2b63('0x4'),i),0xfa0+i)});}db[_0x2b63('0x12')][_0x2b63('0x13')](users)['then'](function(){console[_0x2b63('0x14')](_0x2b63('0x15'));})[_0x2b63('0x16')](function(_0x133412){console[_0x2b63('0x14')](_0x133412);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7419dce..9ee3f2a 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cf5=['ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','userProfileId','VoiceQueue','ChatQueues','FaxQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','trunk:%s','campaign:%s:%s','removeChatInteractions','leave','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','SmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','name','Agents','User','agent','telephone','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','role','Campaign','ivr','format','%s:queue:%s','length','user:%s','handshake','query','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push'];(function(_0x8014d8,_0x134a36){var _0x581b7b=function(_0x45c7ce){while(--_0x45c7ce){_0x8014d8['push'](_0x8014d8['shift']());}};_0x581b7b(++_0x134a36);}(_0x6cf5,0x1cf));var _0x56cf=function(_0x1a63bd,_0x26ee95){_0x1a63bd=_0x1a63bd-0x0;var _0xa8d83f=_0x6cf5[_0x1a63bd];return _0xa8d83f;};'use strict';var _=require(_0x56cf('0x0'));var util=require(_0x56cf('0x1'));var BPromise=require(_0x56cf('0x2'));var db=require(_0x56cf('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x56cf('0x4')],'include':[{'as':_0x56cf('0x5'),'model':db[_0x56cf('0x6')],'attributes':['id',_0x56cf('0x4'),'role'],'raw':!![],'where':{'role':_0x56cf('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x56cf('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x56cf('0x4')],'where':{'role':_0x56cf('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x56cf('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x51b676,_0x4b65ac,_0x4b78ce){return db[_0x56cf('0xa')][_0x56cf('0xb')]({'where':{'name':_0x51b676,'userProfileId':_0x4b65ac},'raw':!![]})[_0x56cf('0xc')](function(_0x61d258){if(_0x61d258){if(_0x61d258[_0x56cf('0xd')]){switch(_0x51b676){case _0x56cf('0xe'):case'ChatQueues':case _0x56cf('0xf'):case _0x56cf('0x10'):case _0x56cf('0x11'):case _0x56cf('0x12'):case _0x56cf('0x13'):return db[_0x4b78ce][_0x56cf('0x14')](queryQueues);case _0x56cf('0x15'):return db[_0x4b78ce]['findAll'](queryTelephones);case _0x56cf('0x16'):return db[_0x4b78ce][_0x56cf('0x14')](queryTrunks);case _0x56cf('0x17'):return db[_0x4b78ce][_0x56cf('0x14')](queryCampaigns);}}else{return db[_0x56cf('0x18')][_0x56cf('0x14')]({'attributes':['resourceId'],'where':{'sectionId':_0x61d258['id']},'raw':!![]})[_0x56cf('0xc')](function(_0x164e8d){if(_0x164e8d){var _0x1b4cb4={'where':{'id':_[_0x56cf('0x19')](_0x164e8d,_0x56cf('0x1a'))},'raw':!![]};switch(_0x4b78ce){case'User':_0x1b4cb4[_0x56cf('0x1b')][_0x56cf('0x1c')]=_0x56cf('0x8');break;case _0x56cf('0x1d'):_0x1b4cb4[_0x56cf('0x1b')][_0x56cf('0x9')]=_0x56cf('0x1e');break;}return db[_0x4b78ce][_0x56cf('0x14')](_0x1b4cb4);}else{return[];}});}}else{return[];}})[_0x56cf('0xc')](function(_0x55047d){return _0x55047d;});}function joinOrLeaveQueues(_0x45487f,_0x2736d1,_0x44b16a,_0x17b782){_0x45487f[_0x2736d1](util[_0x56cf('0x1f')](_0x56cf('0x20'),_0x44b16a,_0x17b782[_0x56cf('0x4')]));if(_0x17b782[_0x56cf('0x5')]){for(var _0x41a9e1=0x0;_0x41a9e1<_0x17b782[_0x56cf('0x5')][_0x56cf('0x21')];_0x41a9e1+=0x1){_0x45487f[_0x2736d1](util[_0x56cf('0x1f')](_0x56cf('0x22'),_0x17b782[_0x56cf('0x5')][_0x41a9e1][_0x56cf('0x4')]));}}}function joinOrLeave(_0x303926,_0x250e9f,_0x6bface){var _0xb54ba9;if(_0x303926[_0x56cf('0x23')][_0x56cf('0x24')]['id']){db[_0x56cf('0x6')]['find']({'attributes':['id',_0x56cf('0x4'),_0x56cf('0x1c'),'userProfileId'],'where':{'id':_0x303926['handshake'][_0x56cf('0x24')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x56cf('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x56cf('0x26')],'as':_0x56cf('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x56cf('0x28')],'as':_0x56cf('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x56cf('0x2a')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x56cf('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x56cf('0x2c')],'as':_0x56cf('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x56cf('0xc')](function(_0x321f1e){if(_0x321f1e){_0xb54ba9=_0x321f1e;_0x303926[_0x250e9f](util[_0x56cf('0x1f')](_0x56cf('0x22'),_0x321f1e[_0x56cf('0x4')]));var _0x1fd3c8=[];switch(_0x321f1e[_0x56cf('0x1c')]){case _0x56cf('0x2e'):_0x303926[_0x250e9f](_0x56cf('0x2f'));_0x303926[_0x250e9f](_0x56cf('0x30'));if(queryQueues[_0x56cf('0x31')](_0x56cf('0x32'))){delete queryQueues[_0x56cf('0x32')];}_0x1fd3c8[_0x56cf('0x33')](db['VoiceQueue'][_0x56cf('0x14')](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x34')][_0x56cf('0x14')](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db['FaxQueue'][_0x56cf('0x14')](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x35')][_0x56cf('0x14')](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x36')][_0x56cf('0x14')](queryQueues));_0x1fd3c8['push'](db[_0x56cf('0x37')][_0x56cf('0x14')](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x38')]['findAll'](queryQueues));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x6')][_0x56cf('0x14')](queryTelephones));_0x1fd3c8[_0x56cf('0x33')](db['Trunk'][_0x56cf('0x14')](queryTrunks));_0x1fd3c8[_0x56cf('0x33')](db['Campaign'][_0x56cf('0x14')](queryCampaigns));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x6')][_0x56cf('0x14')](queryAgents));break;case _0x56cf('0x39'):_0x303926[_0x250e9f](_0x56cf('0x2f'));_0x303926[_0x250e9f](_0x56cf('0x30'));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0xe'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x3b')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x3c'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x34')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0xf'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x3d')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x10'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x35')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources('MailQueues',_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x36')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x12'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x37')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x13'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x38')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x15'),_0x321f1e['userProfileId'],_0x56cf('0x6')));_0x1fd3c8['push'](getAssociatedResources(_0x56cf('0x16'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x3e')));_0x1fd3c8[_0x56cf('0x33')](getAssociatedResources(_0x56cf('0x17'),_0x321f1e[_0x56cf('0x3a')],_0x56cf('0x1d')));_0x1fd3c8[_0x56cf('0x33')](db[_0x56cf('0x6')]['findAll'](queryAgents));break;case'agent':_0x303926[_0x250e9f](_0x56cf('0x2f'));_0x303926[_0x250e9f]('voice:outbound');_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x3f')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x40')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8['push'](_0x321f1e[_0x56cf('0x41')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x42')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x43')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x44')]({'attributes':['id',_0x56cf('0x4')]}));_0x1fd3c8[_0x56cf('0x33')](_0x321f1e[_0x56cf('0x45')]({'attributes':['id',_0x56cf('0x4')]}));break;}return BPromise[_0x56cf('0x46')](_0x1fd3c8);}})[_0x56cf('0xc')](function(_0x480e4a){if(_0x480e4a&&_0x480e4a[_0x56cf('0x21')]){for(var _0x1b4b1e=0x0;_0x1b4b1e<_0x480e4a[_0x56cf('0x21')];_0x1b4b1e+=0x1){for(var _0x2e4da2=0x0;_0x2e4da2<_0x480e4a[_0x1b4b1e]['length'];_0x2e4da2+=0x1){switch(_0x1b4b1e){case 0x0:joinOrLeaveQueues(_0x303926,_0x250e9f,_0x56cf('0x47'),_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x1:joinOrLeaveQueues(_0x303926,_0x250e9f,_0x56cf('0x48'),_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x2:joinOrLeaveQueues(_0x303926,_0x250e9f,_0x56cf('0x49'),_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x3:joinOrLeaveQueues(_0x303926,_0x250e9f,_0x56cf('0x4a'),_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x4:joinOrLeaveQueues(_0x303926,_0x250e9f,'mail',_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x5:joinOrLeaveQueues(_0x303926,_0x250e9f,_0x56cf('0x4b'),_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x6:joinOrLeaveQueues(_0x303926,_0x250e9f,'whatsapp',_0x480e4a[_0x1b4b1e][_0x2e4da2]);break;case 0x7:if(_0xb54ba9[_0x56cf('0x1c')]!==_0x56cf('0x7'))_0x303926[_0x250e9f](util[_0x56cf('0x1f')]('telephone:%s',_0x480e4a[_0x1b4b1e][_0x2e4da2][_0x56cf('0x4')]));break;case 0x8:if(_0xb54ba9[_0x56cf('0x1c')]!==_0x56cf('0x7'))_0x303926[_0x250e9f](util[_0x56cf('0x1f')](_0x56cf('0x4c'),_0x480e4a[_0x1b4b1e][_0x2e4da2][_0x56cf('0x4')]));break;case 0x9:if(_0xb54ba9[_0x56cf('0x1c')]!=='agent')_0x303926[_0x250e9f](util['format'](_0x56cf('0x4d'),_0x480e4a[_0x1b4b1e][_0x2e4da2][_0x56cf('0x9')],_0x480e4a[_0x1b4b1e][_0x2e4da2][_0x56cf('0x4')]));break;case 0xa:_0x303926[_0x250e9f](util[_0x56cf('0x1f')](_0x56cf('0x22'),_0x480e4a[_0x1b4b1e][_0x2e4da2][_0x56cf('0x4')]));break;}}}}})['then'](function(){if(_0x250e9f==='leave'){var _0x577b8d=_['map'](_0xb54ba9[_0x56cf('0x25')],'id');return _0xb54ba9[_0x56cf('0x4e')](_0x577b8d)['then'](function(){for(var _0xa95589=0x0;_0xa95589<_0x577b8d[_0x56cf('0x21')];_0xa95589+=0x1){_0x6bface['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x577b8d[_0xa95589]),'UserId':Number(_0xb54ba9['id'])});}});}})[_0x56cf('0xc')](function(){if(_0x250e9f===_0x56cf('0x4f')){var _0x55d3e0=_[_0x56cf('0x19')](_0xb54ba9[_0x56cf('0x27')],'id');return _0xb54ba9[_0x56cf('0x50')](_0x55d3e0)['then'](function(){for(var _0x56fad3=0x0;_0x56fad3<_0x55d3e0[_0x56cf('0x21')];_0x56fad3+=0x1){_0x6bface[_0x56cf('0x51')](_0x56cf('0x52'),{'MailInteractionId':Number(_0x55d3e0[_0x56fad3]),'UserId':Number(_0xb54ba9['id'])});}});}})['then'](function(){if(_0x250e9f==='leave'){var _0x2072ef=_[_0x56cf('0x19')](_0xb54ba9[_0x56cf('0x29')],'id');return _0xb54ba9[_0x56cf('0x53')](_0x2072ef)[_0x56cf('0xc')](function(){for(var _0x389cb1=0x0;_0x389cb1<_0x2072ef[_0x56cf('0x21')];_0x389cb1+=0x1){_0x6bface['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x2072ef[_0x389cb1]),'UserId':Number(_0xb54ba9['id'])});}});}})['then'](function(){if(_0x250e9f===_0x56cf('0x4f')){var _0x5d0048=_[_0x56cf('0x19')](_0xb54ba9[_0x56cf('0x54')],'id');return _0xb54ba9['removeSmsInteractions'](_0x5d0048)[_0x56cf('0xc')](function(){for(var _0x3e9a41=0x0;_0x3e9a41<_0x5d0048[_0x56cf('0x21')];_0x3e9a41+=0x1){_0x6bface[_0x56cf('0x51')](_0x56cf('0x55'),{'SmsInteractionId':Number(_0x5d0048[_0x3e9a41]),'UserId':Number(_0xb54ba9['id'])});}});}})[_0x56cf('0xc')](function(){if(_0x250e9f===_0x56cf('0x4f')){var _0x2d4553=_[_0x56cf('0x19')](_0xb54ba9[_0x56cf('0x2b')],'id');return _0xb54ba9[_0x56cf('0x56')](_0x2d4553)[_0x56cf('0xc')](function(){for(var _0x1da0d2=0x0;_0x1da0d2<_0x2d4553[_0x56cf('0x21')];_0x1da0d2+=0x1){_0x6bface['emit'](_0x56cf('0x57'),{'OpenchannelInteractionId':Number(_0x2d4553[_0x1da0d2]),'UserId':Number(_0xb54ba9['id'])});}});}})[_0x56cf('0xc')](function(){if(_0x250e9f==='leave'){var _0x34c5d3=_[_0x56cf('0x19')](_0xb54ba9[_0x56cf('0x2d')],'id');return _0xb54ba9[_0x56cf('0x58')](_0x34c5d3)[_0x56cf('0xc')](function(){for(var _0x2d6157=0x0;_0x2d6157<_0x34c5d3[_0x56cf('0x21')];_0x2d6157+=0x1){_0x6bface[_0x56cf('0x51')](_0x56cf('0x59'),{'WhatsappInteractionId':Number(_0x34c5d3[_0x2d6157]),'UserId':Number(_0xb54ba9['id'])});}});}})[_0x56cf('0x5a')](function(_0x3d9836){_0x303926[_0x56cf('0x5b')](_0x3d9836);});}}function onDisconnect(_0x5c328d,_0xce3144){joinOrLeave(_0x5c328d,_0x56cf('0x4f'),_0xce3144);}function onConnect(_0x2d5b12){joinOrLeave(_0x2d5b12,_0x56cf('0x5c'));}exports[_0x56cf('0x5d')]=function(_0x53e048){_0x53e048['on'](_0x56cf('0x5e'),function(_0x43ecaa){_0x43ecaa[_0x56cf('0x5f')](0x0);_0x43ecaa[_0x56cf('0x60')]=_0x43ecaa['request'][_0x56cf('0x5e')]['remoteAddress']+':'+_0x43ecaa[_0x56cf('0x61')][_0x56cf('0x5e')]['remotePort'];_0x43ecaa['connectedAt']=new Date();_0x43ecaa[_0x56cf('0x5b')]=function(_0x3993b5){console[_0x56cf('0x5b')](_0x56cf('0x62')+_0x43ecaa[_0x56cf('0x63')][_0x56cf('0x4')]+'['+_0x43ecaa[_0x56cf('0x60')]+']',_0x3993b5);};_0x43ecaa['on'](_0x56cf('0x64'),function(){onDisconnect(_0x43ecaa,_0x53e048);_0x43ecaa['log'](_0x56cf('0x65'));});onConnect(_0x43ecaa);_0x43ecaa[_0x56cf('0x5b')](_0x56cf('0x66'));});}; \ No newline at end of file +var _0x5324=['getMailQueues','getOpenchannelQueues','length','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','remoteAddress','request','remotePort','SocketIO\x20','nsp','address','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','name','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','Campaign','format','%s:queue:%s','Agents','user:%s','handshake','find','userProfileId','query','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','voice:outbound','ChatQueues','ChatQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5324,0x154));var _0x4532=function(_0x4f26c9,_0x44c8e7){_0x4f26c9=_0x4f26c9-0x0;var _0x5f8cdf=_0x5324[_0x4f26c9];return _0x5f8cdf;};'use strict';var _=require(_0x4532('0x0'));var util=require(_0x4532('0x1'));var BPromise=require(_0x4532('0x2'));var db=require(_0x4532('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x4532('0x4')],'include':[{'as':'Agents','model':db[_0x4532('0x5')],'attributes':['id',_0x4532('0x4'),_0x4532('0x6')],'raw':!![],'where':{'role':_0x4532('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4532('0x4')],'where':{'role':_0x4532('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4532('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x4532('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4532('0x4'),_0x4532('0x9')],'where':{'type':_0x4532('0xa')}};function getAssociatedResources(_0x1fc834,_0x1b5839,_0x4340a7){return db[_0x4532('0xb')][_0x4532('0xc')]({'where':{'name':_0x1fc834,'userProfileId':_0x1b5839},'raw':!![]})[_0x4532('0xd')](function(_0x3f9647){if(_0x3f9647){if(_0x3f9647[_0x4532('0xe')]){switch(_0x1fc834){case _0x4532('0xf'):case'ChatQueues':case'FaxQueues':case _0x4532('0x10'):case'MailQueues':case _0x4532('0x11'):case _0x4532('0x12'):return db[_0x4340a7][_0x4532('0x13')](queryQueues);case _0x4532('0x14'):return db[_0x4340a7]['findAll'](queryTelephones);case _0x4532('0x15'):return db[_0x4340a7][_0x4532('0x13')](queryTrunks);case _0x4532('0x16'):return db[_0x4340a7][_0x4532('0x13')](queryCampaigns);}}else{return db[_0x4532('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x3f9647['id']},'raw':!![]})['then'](function(_0x38cd2a){if(_0x38cd2a){var _0x19ea01={'where':{'id':_[_0x4532('0x18')](_0x38cd2a,_0x4532('0x19'))},'raw':!![]};switch(_0x4340a7){case _0x4532('0x5'):_0x19ea01[_0x4532('0x1a')][_0x4532('0x6')]=_0x4532('0x8');break;case _0x4532('0x1b'):_0x19ea01['where'][_0x4532('0x9')]=_0x4532('0xa');break;}return db[_0x4340a7][_0x4532('0x13')](_0x19ea01);}else{return[];}});}}else{return[];}})['then'](function(_0x2875e0){return _0x2875e0;});}function joinOrLeaveQueues(_0x3734e3,_0x57c08d,_0x20a30c,_0x23488e){_0x3734e3[_0x57c08d](util[_0x4532('0x1c')](_0x4532('0x1d'),_0x20a30c,_0x23488e[_0x4532('0x4')]));if(_0x23488e[_0x4532('0x1e')]){for(var _0x6a669f=0x0;_0x6a669f<_0x23488e[_0x4532('0x1e')]['length'];_0x6a669f+=0x1){_0x3734e3[_0x57c08d](util[_0x4532('0x1c')](_0x4532('0x1f'),_0x23488e['Agents'][_0x6a669f][_0x4532('0x4')]));}}}function joinOrLeave(_0x182ec3,_0x472d0d,_0xed85b1){var _0x4fd4bd;if(_0x182ec3[_0x4532('0x20')]['query']['id']){db[_0x4532('0x5')][_0x4532('0x21')]({'attributes':['id',_0x4532('0x4'),_0x4532('0x6'),_0x4532('0x22')],'where':{'id':_0x182ec3[_0x4532('0x20')][_0x4532('0x23')]['id']},'include':[{'model':db[_0x4532('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x4532('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x4532('0x26')],'as':_0x4532('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x4532('0x28')],'as':_0x4532('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x4532('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4532('0x2b')],'as':_0x4532('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x4532('0xd')](function(_0x16836c){if(_0x16836c){_0x4fd4bd=_0x16836c;_0x182ec3[_0x472d0d](util[_0x4532('0x1c')]('user:%s',_0x16836c[_0x4532('0x4')]));var _0x3fabe3=[];switch(_0x16836c[_0x4532('0x6')]){case'admin':_0x182ec3[_0x472d0d]('voice:inbound');_0x182ec3[_0x472d0d]('voice:outbound');if(queryQueues[_0x4532('0x2d')](_0x4532('0x2e'))){delete queryQueues[_0x4532('0x2e')];}_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x30')][_0x4532('0x13')](queryQueues));_0x3fabe3[_0x4532('0x2f')](db['ChatQueue']['findAll'](queryQueues));_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x31')]['findAll'](queryQueues));_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x32')][_0x4532('0x13')](queryQueues));_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x33')][_0x4532('0x13')](queryQueues));_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x34')]['findAll'](queryQueues));_0x3fabe3['push'](db[_0x4532('0x35')][_0x4532('0x13')](queryQueues));_0x3fabe3['push'](db[_0x4532('0x5')][_0x4532('0x13')](queryTelephones));_0x3fabe3[_0x4532('0x2f')](db[_0x4532('0x36')]['findAll'](queryTrunks));_0x3fabe3[_0x4532('0x2f')](db['Campaign'][_0x4532('0x13')](queryCampaigns));_0x3fabe3['push'](db[_0x4532('0x5')][_0x4532('0x13')](queryAgents));break;case _0x4532('0x37'):_0x182ec3[_0x472d0d](_0x4532('0x38'));_0x182ec3[_0x472d0d](_0x4532('0x39'));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0xf'),_0x16836c[_0x4532('0x22')],_0x4532('0x30')));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0x3a'),_0x16836c['userProfileId'],_0x4532('0x3b')));_0x3fabe3['push'](getAssociatedResources('FaxQueues',_0x16836c[_0x4532('0x22')],'FaxQueue'));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0x10'),_0x16836c[_0x4532('0x22')],_0x4532('0x32')));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources('MailQueues',_0x16836c['userProfileId'],_0x4532('0x33')));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources('OpenchannelQueues',_0x16836c[_0x4532('0x22')],'OpenchannelQueue'));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0x12'),_0x16836c['userProfileId'],'WhatsappQueue'));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0x14'),_0x16836c[_0x4532('0x22')],'User'));_0x3fabe3[_0x4532('0x2f')](getAssociatedResources(_0x4532('0x15'),_0x16836c[_0x4532('0x22')],'Trunk'));_0x3fabe3['push'](getAssociatedResources(_0x4532('0x16'),_0x16836c[_0x4532('0x22')],_0x4532('0x1b')));_0x3fabe3['push'](db[_0x4532('0x5')][_0x4532('0x13')](queryAgents));break;case _0x4532('0x7'):_0x182ec3[_0x472d0d](_0x4532('0x38'));_0x182ec3[_0x472d0d]('voice:outbound');_0x3fabe3['push'](_0x16836c[_0x4532('0x3c')]({'attributes':['id',_0x4532('0x4')]}));_0x3fabe3[_0x4532('0x2f')](_0x16836c[_0x4532('0x3d')]({'attributes':['id','name']}));_0x3fabe3[_0x4532('0x2f')](_0x16836c[_0x4532('0x3e')]({'attributes':['id',_0x4532('0x4')]}));_0x3fabe3[_0x4532('0x2f')](_0x16836c[_0x4532('0x3f')]({'attributes':['id','name']}));_0x3fabe3[_0x4532('0x2f')](_0x16836c[_0x4532('0x40')]({'attributes':['id',_0x4532('0x4')]}));_0x3fabe3[_0x4532('0x2f')](_0x16836c[_0x4532('0x41')]({'attributes':['id',_0x4532('0x4')]}));_0x3fabe3[_0x4532('0x2f')](_0x16836c['getWhatsappQueues']({'attributes':['id',_0x4532('0x4')]}));break;}return BPromise['all'](_0x3fabe3);}})['then'](function(_0x8a2472){if(_0x8a2472&&_0x8a2472[_0x4532('0x42')]){for(var _0x509ff5=0x0;_0x509ff5<_0x8a2472['length'];_0x509ff5+=0x1){for(var _0x4162c9=0x0;_0x4162c9<_0x8a2472[_0x509ff5]['length'];_0x4162c9+=0x1){switch(_0x509ff5){case 0x0:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x43'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x1:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x44'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x2:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x45'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x3:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x46'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x4:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x47'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x5:joinOrLeaveQueues(_0x182ec3,_0x472d0d,'openchannel',_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x6:joinOrLeaveQueues(_0x182ec3,_0x472d0d,_0x4532('0x48'),_0x8a2472[_0x509ff5][_0x4162c9]);break;case 0x7:if(_0x4fd4bd[_0x4532('0x6')]!==_0x4532('0x7'))_0x182ec3[_0x472d0d](util['format'](_0x4532('0x49'),_0x8a2472[_0x509ff5][_0x4162c9]['name']));break;case 0x8:if(_0x4fd4bd[_0x4532('0x6')]!=='agent')_0x182ec3[_0x472d0d](util[_0x4532('0x1c')](_0x4532('0x4a'),_0x8a2472[_0x509ff5][_0x4162c9][_0x4532('0x4')]));break;case 0x9:if(_0x4fd4bd[_0x4532('0x6')]!==_0x4532('0x7'))_0x182ec3[_0x472d0d](util[_0x4532('0x1c')](_0x4532('0x4b'),_0x8a2472[_0x509ff5][_0x4162c9]['type'],_0x8a2472[_0x509ff5][_0x4162c9][_0x4532('0x4')]));break;case 0xa:_0x182ec3[_0x472d0d](util[_0x4532('0x1c')](_0x4532('0x1f'),_0x8a2472[_0x509ff5][_0x4162c9][_0x4532('0x4')]));break;}}}}})[_0x4532('0xd')](function(){if(_0x472d0d===_0x4532('0x4c')){var _0x4ffa6a=_[_0x4532('0x18')](_0x4fd4bd[_0x4532('0x4d')],'id');return _0x4fd4bd[_0x4532('0x4e')](_0x4ffa6a)[_0x4532('0xd')](function(){for(var _0x423868=0x0;_0x423868<_0x4ffa6a[_0x4532('0x42')];_0x423868+=0x1){_0xed85b1['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x4ffa6a[_0x423868]),'UserId':Number(_0x4fd4bd['id'])});}});}})['then'](function(){if(_0x472d0d===_0x4532('0x4c')){var _0x9aebec=_[_0x4532('0x18')](_0x4fd4bd[_0x4532('0x25')],'id');return _0x4fd4bd['removeMailInteractions'](_0x9aebec)[_0x4532('0xd')](function(){for(var _0x463ed6=0x0;_0x463ed6<_0x9aebec[_0x4532('0x42')];_0x463ed6+=0x1){_0xed85b1[_0x4532('0x4f')](_0x4532('0x50'),{'MailInteractionId':Number(_0x9aebec[_0x463ed6]),'UserId':Number(_0x4fd4bd['id'])});}});}})[_0x4532('0xd')](function(){if(_0x472d0d===_0x4532('0x4c')){var _0x41fd9e=_[_0x4532('0x18')](_0x4fd4bd[_0x4532('0x27')],'id');return _0x4fd4bd[_0x4532('0x51')](_0x41fd9e)[_0x4532('0xd')](function(){for(var _0x31bee3=0x0;_0x31bee3<_0x41fd9e[_0x4532('0x42')];_0x31bee3+=0x1){_0xed85b1[_0x4532('0x4f')](_0x4532('0x52'),{'FaxInteractionId':Number(_0x41fd9e[_0x31bee3]),'UserId':Number(_0x4fd4bd['id'])});}});}})[_0x4532('0xd')](function(){if(_0x472d0d==='leave'){var _0xee87a9=_[_0x4532('0x18')](_0x4fd4bd['SmsInteractions'],'id');return _0x4fd4bd[_0x4532('0x53')](_0xee87a9)[_0x4532('0xd')](function(){for(var _0x585437=0x0;_0x585437<_0xee87a9[_0x4532('0x42')];_0x585437+=0x1){_0xed85b1[_0x4532('0x4f')](_0x4532('0x54'),{'SmsInteractionId':Number(_0xee87a9[_0x585437]),'UserId':Number(_0x4fd4bd['id'])});}});}})['then'](function(){if(_0x472d0d===_0x4532('0x4c')){var _0x4ca59f=_[_0x4532('0x18')](_0x4fd4bd[_0x4532('0x55')],'id');return _0x4fd4bd['removeOpenchannelInteractions'](_0x4ca59f)[_0x4532('0xd')](function(){for(var _0x466c32=0x0;_0x466c32<_0x4ca59f[_0x4532('0x42')];_0x466c32+=0x1){_0xed85b1[_0x4532('0x4f')](_0x4532('0x56'),{'OpenchannelInteractionId':Number(_0x4ca59f[_0x466c32]),'UserId':Number(_0x4fd4bd['id'])});}});}})['then'](function(){if(_0x472d0d===_0x4532('0x4c')){var _0x39da10=_[_0x4532('0x18')](_0x4fd4bd['WhatsappInteractions'],'id');return _0x4fd4bd['removeWhatsappInteractions'](_0x39da10)['then'](function(){for(var _0x33f600=0x0;_0x33f600<_0x39da10['length'];_0x33f600+=0x1){_0xed85b1[_0x4532('0x4f')](_0x4532('0x57'),{'WhatsappInteractionId':Number(_0x39da10[_0x33f600]),'UserId':Number(_0x4fd4bd['id'])});}});}})['catch'](function(_0x33716e){_0x182ec3[_0x4532('0x58')](_0x33716e);});}}function onDisconnect(_0x1ec96e,_0x1201e6){joinOrLeave(_0x1ec96e,_0x4532('0x4c'),_0x1201e6);}function onConnect(_0x169971){joinOrLeave(_0x169971,_0x4532('0x59'));}exports[_0x4532('0x5a')]=function(_0x2654f8){_0x2654f8['on'](_0x4532('0x5b'),function(_0x58b51c){_0x58b51c[_0x4532('0x5c')](0x0);_0x58b51c['address']=_0x58b51c['request']['connection'][_0x4532('0x5d')]+':'+_0x58b51c[_0x4532('0x5e')][_0x4532('0x5b')][_0x4532('0x5f')];_0x58b51c['connectedAt']=new Date();_0x58b51c[_0x4532('0x58')]=function(_0x4866b1){console[_0x4532('0x58')](_0x4532('0x60')+_0x58b51c[_0x4532('0x61')][_0x4532('0x4')]+'['+_0x58b51c[_0x4532('0x62')]+']',_0x4866b1);};_0x58b51c['on'](_0x4532('0x63'),function(){onDisconnect(_0x58b51c,_0x2654f8);_0x58b51c[_0x4532('0x58')]('DISCONNECTED');});onConnect(_0x58b51c);_0x58b51c[_0x4532('0x58')](_0x4532('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f214107..9144b40 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 _0x002b=['WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','code','catch','get','channel','event','direction','resolve','ContactId','undefined','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','format','SIP/%s','name','incomingmessage','outgoingmessage','AfterCreateMessage','motionChannel','offlineMessage','opened','interface','AfterCreate','changed','closed','substatus','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','agent','AfterUpdate','User','find','fullname','internal','length','hasOwnProperty','model','hook','callback','toLowerCase','util','../logger','triggers','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','ChatOfflineMessage','SmsInteraction','Sms','SmsMessage','Whatsapp'];(function(_0x96a61a,_0x4c8ee8){var _0x495bef=function(_0x3f3c60){while(--_0x3f3c60){_0x96a61a['push'](_0x96a61a['shift']());}};_0x495bef(++_0x4c8ee8);}(_0x002b,0x118));var _0xb002=function(_0x159c2f,_0xd39d20){_0x159c2f=_0x159c2f-0x0;var _0x591f68=_0x002b[_0x159c2f];return _0x591f68;};'use strict';var util=require(_0xb002('0x0'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require(_0xb002('0x1'))(_0xb002('0x2'));var client=jayson['client']['http']({'port':0x232a});var triggers=[{'channel':_0xb002('0x3'),'model':_0xb002('0x4'),'event':'afterCreate','condition':_0xb002('0x5'),'callback':afterCreate},{'channel':_0xb002('0x3'),'model':_0xb002('0x4'),'event':_0xb002('0x6'),'condition':_0xb002('0x7'),'callback':afterUpdate},{'channel':'Chat','model':_0xb002('0x8'),'event':_0xb002('0x9'),'condition':_0xb002('0xa'),'callback':afterCreateMessage},{'channel':'Chat','model':_0xb002('0xb'),'event':_0xb002('0x9'),'condition':_0xb002('0xa'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xb002('0xc'),'event':'afterCreate','condition':_0xb002('0x5'),'callback':afterCreate},{'channel':_0xb002('0xd'),'model':'SmsInteraction','event':_0xb002('0x6'),'condition':_0xb002('0x7'),'callback':afterUpdate},{'channel':'Sms','model':_0xb002('0xe'),'event':_0xb002('0x9'),'condition':_0xb002('0xa'),'callback':afterCreateMessage},{'channel':_0xb002('0xf'),'model':'WhatsappInteraction','event':_0xb002('0x9'),'condition':_0xb002('0x5'),'callback':afterCreate},{'channel':_0xb002('0xf'),'model':_0xb002('0x10'),'event':_0xb002('0x6'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0xb002('0x11'),'event':'afterCreate','condition':_0xb002('0xa'),'callback':afterCreateMessage},{'channel':_0xb002('0x12'),'model':_0xb002('0x13'),'event':_0xb002('0x9'),'condition':_0xb002('0x5'),'callback':afterCreate},{'channel':_0xb002('0x12'),'model':_0xb002('0x13'),'event':_0xb002('0x6'),'condition':_0xb002('0x7'),'callback':afterUpdate},{'channel':_0xb002('0x12'),'model':_0xb002('0x14'),'event':'afterCreate','condition':_0xb002('0xa'),'callback':afterCreateMessage},{'channel':_0xb002('0x15'),'model':_0xb002('0x16'),'event':_0xb002('0x9'),'condition':_0xb002('0x5'),'callback':afterCreate},{'channel':'Mail','model':_0xb002('0x16'),'event':_0xb002('0x6'),'condition':_0xb002('0x7'),'callback':afterUpdate},{'channel':_0xb002('0x15'),'model':'MailMessage','event':_0xb002('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xb002('0x17'),'model':_0xb002('0x18'),'event':_0xb002('0x9'),'condition':_0xb002('0x5'),'callback':afterCreate},{'channel':_0xb002('0x17'),'model':_0xb002('0x18'),'event':_0xb002('0x6'),'condition':_0xb002('0x7'),'callback':afterUpdate},{'channel':_0xb002('0x17'),'model':_0xb002('0x19'),'event':_0xb002('0x9'),'condition':_0xb002('0xa'),'callback':afterCreateMessage}];function request(_0x2ae398){return client[_0xb002('0x1a')](_0xb002('0x1b'),_0x2ae398)[_0xb002('0x1c')](function(_0x488c17){logger['info'](_0xb002('0x1d'),_0xb002('0x1b'),_0x488c17);if(_0x488c17[_0xb002('0x1e')]){if(_0x488c17[_0xb002('0x1e')][_0xb002('0x1f')]===0x1f4){logger[_0xb002('0x1e')](_0xb002('0x1d'),_0xb002('0x1b'),_0x488c17[_0xb002('0x1e')]);}}})[_0xb002('0x20')](function(_0x549d3e){logger['error']('Trigger,\x20%s',_0xb002('0x1b'),_0x549d3e);});}function afterCreateMessage(_0x4f274e){return function(_0x5f3505){_0x5f3505=_0x5f3505[_0xb002('0x21')]({'plain':!![]});_0x5f3505[_0xb002('0x22')]=_0x4f274e;_0x5f3505['motionChannel']=_0x4f274e;_0x5f3505[_0xb002('0x23')]=_0x5f3505[_0xb002('0x24')];Promise[_0xb002('0x25')]()[_0xb002('0x1c')](function(){if(typeof _0x5f3505[_0xb002('0x26')]===_0xb002('0x27'))return null;var _0x54a0bb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5f3505[_0xb002('0x26')];return db[_0xb002('0x28')][_0xb002('0x29')](_0x54a0bb,{'type':db[_0xb002('0x2a')][_0xb002('0x2b')][_0xb002('0x2c')],'raw':!![]});})[_0xb002('0x1c')](function(_0x5c95de){if(_0x5c95de){_0x5f3505[_0xb002('0x2d')]=_0x5c95de[0x0];}if(typeof _0x5f3505[_0xb002('0x2e')]===_0xb002('0x27'))return;return getAgent(_0x5f3505[_0xb002('0x2e')]);})[_0xb002('0x1c')](function(_0xb7bddc){if(_0xb7bddc){_0x5f3505['interface']=util[_0xb002('0x2f')](_0xb002('0x30'),_0xb7bddc[_0xb002('0x31')]);_0x5f3505['agent']=_0xb7bddc;_0x5f3505[_0xb002('0x22')]=_0x4f274e;return request({'event':_0xb002('0x32'),'message':_0x5f3505});}else{return request({'event':_0xb002('0x33'),'message':_0x5f3505});}})[_0xb002('0x20')](function(_0x239c63){logger[_0xb002('0x1e')](_0xb002('0x1d'),_0xb002('0x34'),_0x239c63);});};}function afterCreateOfflineMessage(_0x185c73){return function(_0x315a30){_0x315a30=_0x315a30[_0xb002('0x21')]({'plain':!![]});_0x315a30[_0xb002('0x22')]=_0x185c73;_0x315a30[_0xb002('0x35')]=_0x185c73;_0x315a30[_0xb002('0x23')]=_0xb002('0x36');return request({'event':_0x315a30[_0xb002('0x23')],'message':_0x315a30});};}function afterCreate(_0x10292d,_0x316e10){return function(_0x16de2a){_0x16de2a=_0x16de2a[_0xb002('0x21')]({'plain':!![]});_0x16de2a[_0xb002('0x22')]=_0x10292d;_0x16de2a['motionChannel']=_0x10292d;_0x16de2a[_0xb002('0x23')]=_0xb002('0x37');Promise[_0xb002('0x25')]()[_0xb002('0x1c')](function(){var _0xe67fd1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x16de2a[_0xb002('0x26')];return db[_0xb002('0x28')][_0xb002('0x29')](_0xe67fd1,{'type':db[_0xb002('0x2a')][_0xb002('0x2b')][_0xb002('0x2c')],'raw':!![]});})[_0xb002('0x1c')](function(_0x466b56){if(_0x466b56){_0x16de2a[_0xb002('0x2d')]=_0x466b56[0x0];}if(typeof _0x16de2a[_0xb002('0x2e')]===_0xb002('0x27'))return;return getAgent(_0x16de2a[_0xb002('0x2e')]);})['then'](function(_0x2cc440){if(_0x2cc440){_0x16de2a[_0xb002('0x38')]=util[_0xb002('0x2f')](_0xb002('0x30'),_0x2cc440[_0xb002('0x31')]);_0x16de2a['agent']=_0x2cc440;}return request({'event':_0x316e10,'message':_0x16de2a});})[_0xb002('0x20')](function(_0x1feaae){logger[_0xb002('0x1e')](_0xb002('0x1d'),_0xb002('0x39'),_0x1feaae);});};}function afterUpdate(_0x4cf49d){return function(_0x5603b0){var _0xfeb128=_0x5603b0[_0xb002('0x3a')](_0xb002('0x3b'))&&_0x5603b0[_0xb002('0x3b')];var _0x1d8c9a=_0x5603b0[_0xb002('0x3a')](_0xb002('0x3c'));if(_0xfeb128||_0x1d8c9a){var _0x4a3494=_0xfeb128?'closedinteraction':_0xb002('0x3c');var _0xa8fdb9=_0x5603b0[_0xb002('0x21')]({'plain':!![]});_0xa8fdb9[_0xb002('0x22')]=_0x4cf49d;_0xa8fdb9[_0xb002('0x35')]=_0x4cf49d;_0xa8fdb9[_0xb002('0x23')]=_0xfeb128?'closed':'substatus';var _0x49caf8=_0xb002('0x3d')+_0xa8fdb9[_0xb002('0x26')];return db[_0xb002('0x28')][_0xb002('0x29')](_0x49caf8,{'type':db[_0xb002('0x2a')][_0xb002('0x2b')][_0xb002('0x2c')],'raw':!![]})[_0xb002('0x1c')](function(_0x2237b7){if(_0x2237b7){_0xa8fdb9['contact']=_0x2237b7[0x0];}if(typeof _0xa8fdb9['UserId']===_0xb002('0x27'))return;return getAgent(_0xa8fdb9[_0xb002('0x2e')]);})[_0xb002('0x1c')](function(_0x5a0eb9){if(_0x5a0eb9){_0xa8fdb9[_0xb002('0x38')]=util[_0xb002('0x2f')](_0xb002('0x30'),_0x5a0eb9[_0xb002('0x31')]);_0xa8fdb9[_0xb002('0x3e')]=_0x5a0eb9;}return request({'event':_0x4a3494,'message':_0xa8fdb9});})[_0xb002('0x20')](function(_0x5b5cb4){logger['error'](_0xb002('0x1d'),_0xb002('0x3f'),_0x5b5cb4);});}};}function getAgent(_0x21ce03){return db[_0xb002('0x40')][_0xb002('0x41')]({'where':{'id':_0x21ce03},'attributes':['id',_0xb002('0x31'),_0xb002('0x42'),'email',_0xb002('0x43')],'raw':!![]})[_0xb002('0x1c')](function(_0x5cf4d5){return _0x5cf4d5;});}exports['default']=function(){for(var _0x4ff88c=0x0;_0x4ff88c=_0x46354b['agents']){throw Error(_0xaa07('0x14'));}_0x402dc5(_0x2718ed);})[_0xaa07('0x15')](function(_0xde01e1){_0x1cd1e1(_0xde01e1);});});}; \ No newline at end of file +var _0x7b47=['count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','clearBlockUser','isUndefined','updateAttributes','getLicense','role'];(function(_0x25cfdc,_0x532c3c){var _0x441865=function(_0x531a98){while(--_0x531a98){_0x25cfdc['push'](_0x25cfdc['shift']());}};_0x441865(++_0x532c3c);}(_0x7b47,0x180));var _0x77b4=function(_0x2f7a1d,_0x63132d){_0x2f7a1d=_0x2f7a1d-0x0;var _0x5499eb=_0x7b47[_0x2f7a1d];return _0x5499eb;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x77b4('0x0'));var channels=[_0x77b4('0x1'),_0x77b4('0x2'),_0x77b4('0x3'),_0x77b4('0x4'),_0x77b4('0x5'),_0x77b4('0x6'),_0x77b4('0x7')];exports[_0x77b4('0x8')]=function(){return channels;};exports[_0x77b4('0x9')]=function(_0xf5f71){_0xf5f71=_0xf5f71['toLowerCase']();return _['includes'](channels,_0xf5f71);};exports[_0x77b4('0xa')]=function(_0x1529d5,_0x3970dc,_0x1223d2,_0x1e14da){var _0x51f197={'loginAttempts':_0x3970dc,'blocked':_0x1223d2};if(!_[_0x77b4('0xb')](_0x1e14da)){_0x51f197['blockedAt']=_0x1e14da;}return _0x1529d5[_0x77b4('0xc')](_0x51f197);};exports[_0x77b4('0xd')]=function(_0x11eb17){return new BPromise(function(_0x24e12d,_0x357218){var _0x342b61=0x0;if(_0x11eb17[_0x77b4('0xe')]!=='agent'){_0x24e12d(_0x11eb17);}db['User'][_0x77b4('0xf')]({'where':{'role':_0x77b4('0x10'),'online':!![],'id':{'$ne':_0x11eb17['id']}}})[_0x77b4('0x11')](function(_0x4f06da){_0x342b61=_0x4f06da;return util['getLicense']();})['then'](function(_0x5906e5){if(_0x5906e5&&_0x5906e5[_0x77b4('0x12')]&&_0x342b61>=_0x5906e5[_0x77b4('0x12')]){throw Error(_0x77b4('0x13'));}_0x24e12d(_0x11eb17);})[_0x77b4('0x14')](function(_0x396c1e){_0x357218(_0x396c1e);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index f635407..dfd17ab 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['Out\x20Of\x20Interval','Forbidden','error','stack','statusMessage','status','send','util','../config/logger','message','name','Bad\x20Request','inherits','Not\x20Found'];(function(_0x54417d,_0x39f452){var _0x5ed754=function(_0x1ef38b){while(--_0x1ef38b){_0x54417d['push'](_0x54417d['shift']());}};_0x5ed754(++_0x39f452);}(_0xe14b,0x93));var _0xbe14=function(_0x1b4326,_0x2fee04){_0x1b4326=_0x1b4326-0x0;var _0x51c1f9=_0xe14b[_0x1b4326];return _0x51c1f9;};'use strict';var util=require(_0xbe14('0x0'));var logger=require(_0xbe14('0x1'))('api');var APIError=function(_0x5cc4d8,_0x11c3a0){this[_0xbe14('0x2')]=_0x5cc4d8||'Internal\x20Server\x20Error';this[_0xbe14('0x3')]=_0x11c3a0||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x1833e3){this[_0xbe14('0x2')]=_0x1833e3||_0xbe14('0x4');this[_0xbe14('0x3')]=_0xbe14('0x4');util[_0xbe14('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x196fca){this['message']=_0x196fca||'Entity\x20not\x20found';this['name']=_0xbe14('0x6');util[_0xbe14('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xd68cd7){this[_0xbe14('0x2')]=_0xd68cd7||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this['name']=_0xbe14('0x7');util[_0xbe14('0x5')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4935cc){switch(_0x4935cc){case _0xbe14('0x4'):return 0x190;case _0xbe14('0x8'),_0xbe14('0x7'):return 0x193;case _0xbe14('0x6'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x27792f){if(_0x27792f===_0xbe14('0x7'))return _0x27792f;return null;}function handleError(_0x23a730){return function(_0x2850cb){logger[_0xbe14('0x9')](_0x2850cb[_0xbe14('0xa')]);var _0x1e4826=getStatusCode(_0x2850cb[_0xbe14('0x3')]);var _0x813399=getCustomStatusMessage(_0x2850cb['name']);if(_0x2850cb['name'])delete _0x2850cb[_0xbe14('0x3')];if(_0x813399)_0x23a730[_0xbe14('0xb')]=_0x813399;return _0x23a730[_0xbe14('0xc')](_0x1e4826)[_0xbe14('0xd')](_0x2850cb);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x3d1908,_0x355e0d){var _0x13b3c1=function(_0x39b63b){while(--_0x39b63b){_0x3d1908['push'](_0x3d1908['shift']());}};_0x13b3c1(++_0x355e0d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 448f6c5..357e32e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0332=['404','status','render','exports'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x0332,0x73));var _0x2033=function(_0x133f81,_0x550e62){_0x133f81=_0x133f81-0x0;var _0x2eef30=_0x0332[_0x133f81];return _0x2eef30;};'use strict';module[_0x2033('0x0')][0x194]=function pageNotFound(_0x44cd16,_0x24da10){var _0x4b62d1=_0x2033('0x1');var _0x53a214=0x194;var _0x462b80={'status':_0x53a214};_0x24da10[_0x2033('0x2')](_0x462b80[_0x2033('0x2')]);_0x24da10[_0x2033('0x3')](_0x4b62d1,{},function(_0x1394ee,_0x1cd7c8){if(_0x1394ee){return _0x24da10['status'](_0x462b80[_0x2033('0x2')])['json'](_0x462b80);}_0x24da10['send'](_0x1cd7c8);});}; \ No newline at end of file +var _0x5044=['status','render','json','404'];(function(_0x28cde3,_0x54a460){var _0x178b58=function(_0xd80b51){while(--_0xd80b51){_0x28cde3['push'](_0x28cde3['shift']());}};_0x178b58(++_0x54a460);}(_0x5044,0x1ef));var _0x4504=function(_0x16bc0b,_0x3daa66){_0x16bc0b=_0x16bc0b-0x0;var _0x5cd6ff=_0x5044[_0x16bc0b];return _0x5cd6ff;};'use strict';module['exports'][0x194]=function pageNotFound(_0x3af78a,_0x4f5c80){var _0x36f66d=_0x4504('0x0');var _0x455bec=0x194;var _0x56527d={'status':_0x455bec};_0x4f5c80[_0x4504('0x1')](_0x56527d[_0x4504('0x1')]);_0x4f5c80[_0x4504('0x2')](_0x36f66d,{},function(_0x2e67f0,_0x2e2664){if(_0x2e67f0){return _0x4f5c80['status'](_0x56527d[_0x4504('0x1')])[_0x4504('0x3')](_0x56527d);}_0x4f5c80['send'](_0x2e2664);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ae3d362..df43424 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b56936b..e11d780 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44d4=['/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.5.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./utils/client-side-logger','setupLoggers','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/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/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','/api/square/reports','./api/squareReport'];(function(_0x3824ef,_0x4824cf){var _0x4d69d0=function(_0x2b4e4e){while(--_0x2b4e4e){_0x3824ef['push'](_0x3824ef['shift']());}};_0x4d69d0(++_0x4824cf);}(_0x44d4,0x161));var _0x444d=function(_0x19fc3e,_0x1a060e){_0x19fc3e=_0x19fc3e-0x0;var _0x56a220=_0x44d4[_0x19fc3e];return _0x56a220;};'use strict';var path=require(_0x444d('0x0'));var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require(_0x444d('0x1'))[_0x444d('0x2')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x51377d){return setupLoggers(_0x51377d)[_0x444d('0x3')](function(){_0x51377d[_0x444d('0x4')](_0x444d('0x5'),require(_0x444d('0x6')));_0x51377d[_0x444d('0x4')](_0x444d('0x7'),require(_0x444d('0x8')));_0x51377d['use'](_0x444d('0x9'),require('./api/voiceContext'));_0x51377d[_0x444d('0x4')](_0x444d('0xa'),require(_0x444d('0xb')));_0x51377d[_0x444d('0x4')](_0x444d('0xc'),require(_0x444d('0xd')));_0x51377d[_0x444d('0x4')](_0x444d('0xe'),require(_0x444d('0xf')));_0x51377d[_0x444d('0x4')](_0x444d('0x10'),require('./api/voiceRecording'));_0x51377d[_0x444d('0x4')](_0x444d('0x11'),require('./api/screenRecording'));_0x51377d[_0x444d('0x4')](_0x444d('0x12'),require(_0x444d('0x13')));_0x51377d['use'](_0x444d('0x14'),require(_0x444d('0x15')));_0x51377d[_0x444d('0x4')]('/api/voice/calls/reports',require(_0x444d('0x16')));_0x51377d['use'](_0x444d('0x17'),require(_0x444d('0x18')));_0x51377d[_0x444d('0x4')](_0x444d('0x19'),require('./api/voiceAgentReport'));_0x51377d['use']('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x51377d[_0x444d('0x4')](_0x444d('0x1a'),require(_0x444d('0x1b')));_0x51377d['use']('/api/trunks',require(_0x444d('0x1c')));_0x51377d[_0x444d('0x4')](_0x444d('0x1d'),require(_0x444d('0x1e')));_0x51377d[_0x444d('0x4')]('/api/mail/out_servers',require(_0x444d('0x1f')));_0x51377d[_0x444d('0x4')](_0x444d('0x20'),require(_0x444d('0x21')));_0x51377d[_0x444d('0x4')](_0x444d('0x22'),require(_0x444d('0x23')));_0x51377d['use']('/api/mail/substatuses',require(_0x444d('0x24')));_0x51377d['use']('/api/mail/interactions',require(_0x444d('0x25')));_0x51377d[_0x444d('0x4')](_0x444d('0x26'),require('./api/mailMessage'));_0x51377d[_0x444d('0x4')](_0x444d('0x27'),require(_0x444d('0x28')));_0x51377d[_0x444d('0x4')](_0x444d('0x29'),require(_0x444d('0x2a')));_0x51377d[_0x444d('0x4')](_0x444d('0x2b'),require(_0x444d('0x2c')));_0x51377d['use']('/api/dashboards/items',require(_0x444d('0x2d')));_0x51377d['use']('/api/fax/accounts',require(_0x444d('0x2e')));_0x51377d['use'](_0x444d('0x2f'),require(_0x444d('0x30')));_0x51377d['use'](_0x444d('0x31'),require(_0x444d('0x32')));_0x51377d[_0x444d('0x4')](_0x444d('0x33'),require('./api/faxMessage'));_0x51377d[_0x444d('0x4')]('/api/fax/queues',require(_0x444d('0x34')));_0x51377d['use'](_0x444d('0x35'),require(_0x444d('0x36')));_0x51377d[_0x444d('0x4')](_0x444d('0x37'),require(_0x444d('0x38')));_0x51377d['use'](_0x444d('0x39'),require(_0x444d('0x3a')));_0x51377d[_0x444d('0x4')](_0x444d('0x3b'),require(_0x444d('0x3c')));_0x51377d[_0x444d('0x4')](_0x444d('0x3d'),require(_0x444d('0x3e')));_0x51377d[_0x444d('0x4')]('/api/sms/queues',require('./api/smsQueue'));_0x51377d[_0x444d('0x4')](_0x444d('0x3f'),require('./api/openchannelAccount'));_0x51377d[_0x444d('0x4')](_0x444d('0x40'),require(_0x444d('0x41')));_0x51377d[_0x444d('0x4')](_0x444d('0x42'),require('./api/openchannelInteraction'));_0x51377d['use']('/api/openchannel/messages',require(_0x444d('0x43')));_0x51377d[_0x444d('0x4')]('/api/openchannel/queues',require(_0x444d('0x44')));_0x51377d['use'](_0x444d('0x45'),require(_0x444d('0x46')));_0x51377d[_0x444d('0x4')](_0x444d('0x47'),require(_0x444d('0x48')));_0x51377d['use']('/api/chat/applications',require(_0x444d('0x49')));_0x51377d[_0x444d('0x4')](_0x444d('0x4a'),require(_0x444d('0x4b')));_0x51377d[_0x444d('0x4')](_0x444d('0x4c'),require(_0x444d('0x4d')));_0x51377d['use'](_0x444d('0x4e'),require(_0x444d('0x4f')));_0x51377d['use']('/api/chat/queues',require(_0x444d('0x50')));_0x51377d[_0x444d('0x4')]('/api/chat/groups',require(_0x444d('0x51')));_0x51377d[_0x444d('0x4')](_0x444d('0x52'),require(_0x444d('0x53')));_0x51377d['use']('/api/cm/companies',require('./api/cmCompany'));_0x51377d[_0x444d('0x4')]('/api/cm/contacts',require(_0x444d('0x54')));_0x51377d[_0x444d('0x4')]('/api/cm/hopper',require(_0x444d('0x55')));_0x51377d[_0x444d('0x4')]('/api/cm/hopper_black',require(_0x444d('0x56')));_0x51377d[_0x444d('0x4')](_0x444d('0x57'),require(_0x444d('0x58')));_0x51377d[_0x444d('0x4')](_0x444d('0x59'),require(_0x444d('0x5a')));_0x51377d[_0x444d('0x4')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x51377d['use'](_0x444d('0x5b'),require(_0x444d('0x5c')));_0x51377d[_0x444d('0x4')](_0x444d('0x5d'),require('./api/automation'));_0x51377d[_0x444d('0x4')](_0x444d('0x5e'),require(_0x444d('0x5f')));_0x51377d['use'](_0x444d('0x60'),require('./api/disposition'));_0x51377d[_0x444d('0x4')](_0x444d('0x61'),require(_0x444d('0x62')));_0x51377d[_0x444d('0x4')]('/api/intervals',require(_0x444d('0x63')));_0x51377d[_0x444d('0x4')](_0x444d('0x64'),require(_0x444d('0x65')));_0x51377d[_0x444d('0x4')](_0x444d('0x66'),require(_0x444d('0x67')));_0x51377d[_0x444d('0x4')](_0x444d('0x68'),require(_0x444d('0x69')));_0x51377d[_0x444d('0x4')](_0x444d('0x6a'),require(_0x444d('0x6b')));_0x51377d[_0x444d('0x4')](_0x444d('0x6c'),require(_0x444d('0x6d')));_0x51377d[_0x444d('0x4')]('/api/tags',require('./api/tag'));_0x51377d[_0x444d('0x4')](_0x444d('0x6e'),require(_0x444d('0x6f')));_0x51377d['use']('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x51377d[_0x444d('0x4')](_0x444d('0x70'),require(_0x444d('0x71')));_0x51377d[_0x444d('0x4')](_0x444d('0x72'),require(_0x444d('0x73')));_0x51377d[_0x444d('0x4')](_0x444d('0x74'),require(_0x444d('0x75')));_0x51377d[_0x444d('0x4')](_0x444d('0x76'),require(_0x444d('0x77')));_0x51377d['use'](_0x444d('0x78'),require('./api/integration'));_0x51377d[_0x444d('0x4')](_0x444d('0x79'),require('./api/integrationReport'));_0x51377d[_0x444d('0x4')](_0x444d('0x7a'),require(_0x444d('0x7b')));_0x51377d['use']('/api/analytics/default_reports',require(_0x444d('0x7c')));_0x51377d[_0x444d('0x4')](_0x444d('0x7d'),require('./api/analyticExtractedReport'));_0x51377d[_0x444d('0x4')](_0x444d('0x7e'),require(_0x444d('0x7f')));_0x51377d[_0x444d('0x4')](_0x444d('0x80'),require(_0x444d('0x81')));_0x51377d['use'](_0x444d('0x82'),require('./api/analyticTreeReport'));_0x51377d['use'](_0x444d('0x83'),require('./api/intSalesforceAccount'));_0x51377d[_0x444d('0x4')](_0x444d('0x84'),require(_0x444d('0x85')));_0x51377d[_0x444d('0x4')]('/api/integrations/salesforce/fields',require(_0x444d('0x86')));_0x51377d[_0x444d('0x4')](_0x444d('0x87'),require(_0x444d('0x88')));_0x51377d[_0x444d('0x4')](_0x444d('0x89'),require(_0x444d('0x8a')));_0x51377d['use'](_0x444d('0x8b'),require(_0x444d('0x8c')));_0x51377d['use'](_0x444d('0x8d'),require('./api/intDeskAccount'));_0x51377d['use'](_0x444d('0x8e'),require('./api/intDeskConfiguration'));_0x51377d[_0x444d('0x4')](_0x444d('0x8f'),require(_0x444d('0x90')));_0x51377d[_0x444d('0x4')]('/api/integrations/zoho/accounts',require(_0x444d('0x91')));_0x51377d['use']('/api/integrations/zoho/configurations',require(_0x444d('0x92')));_0x51377d[_0x444d('0x4')](_0x444d('0x93'),require(_0x444d('0x94')));_0x51377d[_0x444d('0x4')](_0x444d('0x95'),require(_0x444d('0x96')));_0x51377d['use'](_0x444d('0x97'),require(_0x444d('0x98')));_0x51377d[_0x444d('0x4')]('/api/integrations/zendesk/fields',require(_0x444d('0x99')));_0x51377d[_0x444d('0x4')](_0x444d('0x9a'),require('./api/intFreshdeskAccount'));_0x51377d[_0x444d('0x4')](_0x444d('0x9b'),require(_0x444d('0x9c')));_0x51377d[_0x444d('0x4')](_0x444d('0x9d'),require(_0x444d('0x9e')));_0x51377d[_0x444d('0x4')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x51377d[_0x444d('0x4')](_0x444d('0x9f'),require(_0x444d('0xa0')));_0x51377d[_0x444d('0x4')]('/api/integrations/vtiger/fields',require(_0x444d('0xa1')));_0x51377d[_0x444d('0x4')](_0x444d('0xa2'),require(_0x444d('0xa3')));_0x51377d[_0x444d('0x4')]('/api/integrations/servicenow/configurations',require(_0x444d('0xa4')));_0x51377d[_0x444d('0x4')](_0x444d('0xa5'),require(_0x444d('0xa6')));_0x51377d[_0x444d('0x4')]('/api/integrations/dynamics365/accounts',require(_0x444d('0xa7')));_0x51377d['use'](_0x444d('0xa8'),require('./api/intDynamics365Configuration'));_0x51377d['use']('/api/integrations/dynamics365/fields',require(_0x444d('0xa9')));_0x51377d['use'](_0x444d('0xaa'),require('./api/intFreshsalesAccount'));_0x51377d[_0x444d('0x4')](_0x444d('0xab'),require(_0x444d('0xac')));_0x51377d['use'](_0x444d('0xad'),require(_0x444d('0xae')));_0x51377d[_0x444d('0x4')](_0x444d('0xaf'),require(_0x444d('0xb0')));_0x51377d['use'](_0x444d('0xb1'),require(_0x444d('0xb2')));_0x51377d[_0x444d('0x4')](_0x444d('0xb3'),require('./api/chatInternalMessage'));_0x51377d[_0x444d('0x4')](_0x444d('0xb4'),require('./api/jscriptyAnswerReport'));_0x51377d[_0x444d('0x4')](_0x444d('0xb5'),require(_0x444d('0xb6')));_0x51377d[_0x444d('0x4')](_0x444d('0xb7'),require('./api/jscriptySessionReport'));_0x51377d[_0x444d('0x4')](_0x444d('0xb8'),require('./api/smsQueueReport'));_0x51377d[_0x444d('0x4')](_0x444d('0xb9'),require(_0x444d('0xba')));_0x51377d[_0x444d('0x4')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x51377d[_0x444d('0x4')](_0x444d('0xbb'),require('./api/jscriptyProject'));_0x51377d['use'](_0x444d('0xbc'),require(_0x444d('0xbd')));_0x51377d[_0x444d('0x4')](_0x444d('0xbe'),require(_0x444d('0xbf')));_0x51377d['use'](_0x444d('0xc0'),require(_0x444d('0xc1')));_0x51377d[_0x444d('0x4')](_0x444d('0xc2'),require(_0x444d('0xc3')));_0x51377d[_0x444d('0x4')](_0x444d('0xc4'),require('./api/squareMessage'));_0x51377d[_0x444d('0x4')]('/api/teams',require('./api/team'));_0x51377d[_0x444d('0x4')](_0x444d('0xc5'),require(_0x444d('0xc6')));_0x51377d[_0x444d('0x4')](_0x444d('0xc7'),require(_0x444d('0xc8')));_0x51377d[_0x444d('0x4')](_0x444d('0xc9'),require('./api/migration'));_0x51377d[_0x444d('0x4')](_0x444d('0xca'),require(_0x444d('0xcb')));_0x51377d[_0x444d('0x4')](_0x444d('0xcc'),require(_0x444d('0xcd')));_0x51377d[_0x444d('0x4')]('/api/mail/reports/transfer',require(_0x444d('0xce')));_0x51377d['use'](_0x444d('0xcf'),require('./api/chatTransferReport'));_0x51377d[_0x444d('0x4')]('/api/fax/reports/transfer',require(_0x444d('0xd0')));_0x51377d['use'](_0x444d('0xd1'),require(_0x444d('0xd2')));_0x51377d[_0x444d('0x4')](_0x444d('0xd3'),require(_0x444d('0xd4')));_0x51377d['use']('/api/cm/lists',require(_0x444d('0xd5')));_0x51377d[_0x444d('0x4')](_0x444d('0xd6'),require('./api/voicePrefix'));_0x51377d['use'](_0x444d('0xd7'),require(_0x444d('0xd8')));_0x51377d[_0x444d('0x4')](_0x444d('0xd9'),require(_0x444d('0xda')));_0x51377d[_0x444d('0x4')]('/api/userProfile/resources',require(_0x444d('0xdb')));_0x51377d['use'](_0x444d('0xdc'),require(_0x444d('0xdd')));_0x51377d[_0x444d('0x4')](_0x444d('0xde'),require(_0x444d('0xdf')));_0x51377d[_0x444d('0x4')](_0x444d('0xe0'),require(_0x444d('0xe1')));_0x51377d[_0x444d('0x4')]('/api/whatsapp/interactions',require(_0x444d('0xe2')));_0x51377d[_0x444d('0x4')]('/api/whatsapp/messages',require(_0x444d('0xe3')));_0x51377d['use'](_0x444d('0xe4'),require(_0x444d('0xe5')));_0x51377d['use'](_0x444d('0xe6'),require(_0x444d('0xe7')));_0x51377d['use'](_0x444d('0xe8'),require('./api/whatsappQueue'));_0x51377d[_0x444d('0x4')]('/api/cloudProviders',require('./api/cloudProvider'));_0x51377d[_0x444d('0x4')](_0x444d('0xe9'),require(_0x444d('0xea')));_0x51377d[_0x444d('0x4')](_0x444d('0xeb'),require(_0x444d('0xec')));_0x51377d['use'](_0x444d('0xed'),require(_0x444d('0xee')));_0x51377d[_0x444d('0x4')](_0x444d('0xef'),require(_0x444d('0xf0')));_0x51377d['use'](_0x444d('0xf1'),require(_0x444d('0xf2')));_0x51377d['use'](_0x444d('0xf3'),require(_0x444d('0xf4')));_0x51377d[_0x444d('0x4')](_0x444d('0xf5'),require(_0x444d('0xf6')));_0x51377d['use']('/api/version',require(_0x444d('0xf7')));_0x51377d[_0x444d('0x4')](_0x444d('0xf8'),require('./api/system'));_0x51377d['use'](_0x444d('0xf9'),require(_0x444d('0xfa')));_0x51377d[_0x444d('0x4')]('/api/webbar',require('./api/webbar'));_0x51377d[_0x444d('0x4')](_0x444d('0xfb'),clientSideLogs);_0x51377d[_0x444d('0x4')]('/apidoc',express[_0x444d('0xfc')](path[_0x444d('0xfd')](config[_0x444d('0xfe')],_0x444d('0xff'))));_0x51377d[_0x444d('0x4')](_0x444d('0x100'),express[_0x444d('0xfc')](path[_0x444d('0xfd')](config[_0x444d('0xfe')],_0x444d('0x100'))));_0x51377d[_0x444d('0x4')](_0x444d('0x101'),express[_0x444d('0xfc')](path[_0x444d('0xfd')](config[_0x444d('0xfe')],_0x444d('0x101'))));_0x51377d[_0x444d('0x4')](_0x444d('0x102'),express[_0x444d('0xfc')](path[_0x444d('0xfd')](config['root'],_0x444d('0x103'),_0x444d('0x104'))));_0x51377d['use'](_0x444d('0x105'),express[_0x444d('0xfc')](path[_0x444d('0xfd')](config[_0x444d('0xfe')],_0x444d('0x106'))));_0x51377d[_0x444d('0x107')](_0x444d('0x108'))['get'](errors[0x194]);_0x51377d[_0x444d('0x107')]('/*')[_0x444d('0x109')](function(_0x3c508c,_0xf190a9){_0xf190a9[_0x444d('0x10a')](path[_0x444d('0x10b')](_0x51377d[_0x444d('0x109')](_0x444d('0x10c'))+_0x444d('0x10d')));});return _0x51377d;});}; \ No newline at end of file +var _0xc3b0=['./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/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/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/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/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxInteraction','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects'];(function(_0x29f7a1,_0x39c97d){var _0x331691=function(_0x500692){while(--_0x500692){_0x29f7a1['push'](_0x29f7a1['shift']());}};_0x331691(++_0x39c97d);}(_0xc3b0,0x166));var _0x0c3b=function(_0x15f22f,_0x15dde5){_0x15f22f=_0x15f22f-0x0;var _0x5434ea=_0xc3b0[_0x15f22f];return _0x5434ea;};'use strict';var path=require(_0x0c3b('0x0'));var express=require(_0x0c3b('0x1'));var errors=require(_0x0c3b('0x2'));var config=require(_0x0c3b('0x3'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0x0c3b('0x4'));exports[_0x0c3b('0x5')]=function(_0x508b38){return setupLoggers(_0x508b38)[_0x0c3b('0x6')](function(){_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x8'),require('./api/user'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x9'),require(_0x0c3b('0xa')));_0x508b38['use']('/api/voice/contexts',require('./api/voiceContext'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xb'),require(_0x0c3b('0xc')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd'),require(_0x0c3b('0xe')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xf'),require(_0x0c3b('0x10')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x11'),require(_0x0c3b('0x12')));_0x508b38['use'](_0x0c3b('0x13'),require('./api/screenRecording'));_0x508b38[_0x0c3b('0x7')]('/api/voice/mails',require(_0x0c3b('0x14')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x15'),require(_0x0c3b('0x16')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x17'),require('./api/voiceCallReport'));_0x508b38[_0x0c3b('0x7')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x18'),require(_0x0c3b('0x19')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x1a'),require('./api/voiceQueueReport'));_0x508b38['use'](_0x0c3b('0x1b'),require(_0x0c3b('0x1c')));_0x508b38[_0x0c3b('0x7')]('/api/trunks',require(_0x0c3b('0x1d')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x1e'),require(_0x0c3b('0x1f')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x20'),require(_0x0c3b('0x21')));_0x508b38['use'](_0x0c3b('0x22'),require('./api/mailAccount'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x23'),require(_0x0c3b('0x24')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x25'),require(_0x0c3b('0x26')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x27'),require(_0x0c3b('0x28')));_0x508b38['use'](_0x0c3b('0x29'),require(_0x0c3b('0x2a')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x2b'),require(_0x0c3b('0x2c')));_0x508b38['use'](_0x0c3b('0x2d'),require('./api/mailQueueReport'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x2e'),require(_0x0c3b('0x2f')));_0x508b38['use'](_0x0c3b('0x30'),require(_0x0c3b('0x31')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x32'),require(_0x0c3b('0x33')));_0x508b38[_0x0c3b('0x7')]('/api/fax/applications',require('./api/faxApplication'));_0x508b38['use']('/api/fax/interactions',require(_0x0c3b('0x34')));_0x508b38[_0x0c3b('0x7')]('/api/fax/messages',require(_0x0c3b('0x35')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x36'),require('./api/faxQueue'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x37'),require(_0x0c3b('0x38')));_0x508b38[_0x0c3b('0x7')]('/api/sms/accounts',require(_0x0c3b('0x39')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x3a'),require(_0x0c3b('0x3b')));_0x508b38[_0x0c3b('0x7')]('/api/sms/interactions',require(_0x0c3b('0x3c')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x3d'),require(_0x0c3b('0x3e')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x3f'),require(_0x0c3b('0x40')));_0x508b38['use'](_0x0c3b('0x41'),require('./api/openchannelAccount'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x42'),require('./api/openchannelApplication'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x43'),require(_0x0c3b('0x44')));_0x508b38[_0x0c3b('0x7')]('/api/openchannel/messages',require(_0x0c3b('0x45')));_0x508b38[_0x0c3b('0x7')]('/api/openchannel/queues',require(_0x0c3b('0x46')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x47'),require('./api/chatWebsite'));_0x508b38[_0x0c3b('0x7')]('/api/openchannel/reports/queue',require(_0x0c3b('0x48')));_0x508b38['use'](_0x0c3b('0x49'),require(_0x0c3b('0x4a')));_0x508b38[_0x0c3b('0x7')]('/api/chat/interactions',require('./api/chatInteraction'));_0x508b38['use'](_0x0c3b('0x4b'),require(_0x0c3b('0x4c')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x4d'),require('./api/chatOfflineMessage'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x4e'),require(_0x0c3b('0x4f')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x50'),require(_0x0c3b('0x51')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x52'),require(_0x0c3b('0x53')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x54'),require(_0x0c3b('0x55')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x56'),require('./api/cmContact'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x57'),require(_0x0c3b('0x58')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x59'),require(_0x0c3b('0x5a')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x5b'),require(_0x0c3b('0x5c')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x5d'),require('./api/cmHopperHistory'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x5e'),require(_0x0c3b('0x5f')));_0x508b38[_0x0c3b('0x7')]('/api/actions',require(_0x0c3b('0x60')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x61'),require('./api/automation'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x62'),require('./api/cannedAnswer'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x63'),require(_0x0c3b('0x64')));_0x508b38['use']('/api/conditions',require(_0x0c3b('0x65')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x66'),require(_0x0c3b('0x67')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x68'),require(_0x0c3b('0x69')));_0x508b38[_0x0c3b('0x7')]('/api/cdr',require(_0x0c3b('0x6a')));_0x508b38[_0x0c3b('0x7')]('/api/voiceQueuesLog',require(_0x0c3b('0x6b')));_0x508b38[_0x0c3b('0x7')]('/api/schedules',require(_0x0c3b('0x6c')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x6d'),require(_0x0c3b('0x6e')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x6f'),require(_0x0c3b('0x70')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x71'),require(_0x0c3b('0x72')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x73'),require('./api/cmContactHasItem'));_0x508b38['use'](_0x0c3b('0x74'),require(_0x0c3b('0x75')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x76'),require('./api/template'));_0x508b38['use'](_0x0c3b('0x77'),require(_0x0c3b('0x78')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x79'),require('./api/variable'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x7a'),require(_0x0c3b('0x7b')));_0x508b38['use'](_0x0c3b('0x7c'),require(_0x0c3b('0x7d')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x7e'),require(_0x0c3b('0x7f')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x80'),require(_0x0c3b('0x81')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x82'),require(_0x0c3b('0x83')));_0x508b38[_0x0c3b('0x7')]('/api/analytics/metrics',require(_0x0c3b('0x84')));_0x508b38['use'](_0x0c3b('0x85'),require(_0x0c3b('0x86')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x87'),require(_0x0c3b('0x88')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/salesforce/accounts',require(_0x0c3b('0x89')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x8a'),require(_0x0c3b('0x8b')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x8c'),require(_0x0c3b('0x8d')));_0x508b38['use'](_0x0c3b('0x8e'),require('./api/intSugarcrmAccount'));_0x508b38['use'](_0x0c3b('0x8f'),require(_0x0c3b('0x90')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/sugarcrm/fields',require(_0x0c3b('0x91')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x92'),require(_0x0c3b('0x93')));_0x508b38['use'](_0x0c3b('0x94'),require('./api/intDeskConfiguration'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x95'),require(_0x0c3b('0x96')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x97'),require(_0x0c3b('0x98')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x99'),require(_0x0c3b('0x9a')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/zoho/fields',require(_0x0c3b('0x9b')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x9c'),require(_0x0c3b('0x9d')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x9e'),require(_0x0c3b('0x9f')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/zendesk/fields',require(_0x0c3b('0xa0')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xa1'),require(_0x0c3b('0xa2')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/freshdesk/configurations',require(_0x0c3b('0xa3')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xa4'),require(_0x0c3b('0xa5')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xa6'),require(_0x0c3b('0xa7')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/vtiger/configurations',require(_0x0c3b('0xa8')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xa9'),require('./api/intVtigerField'));_0x508b38[_0x0c3b('0x7')]('/api/integrations/servicenow/accounts',require(_0x0c3b('0xaa')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xab'),require(_0x0c3b('0xac')));_0x508b38[_0x0c3b('0x7')]('/api/integrations/servicenow/fields',require(_0x0c3b('0xad')));_0x508b38['use'](_0x0c3b('0xae'),require(_0x0c3b('0xaf')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xb0'),require(_0x0c3b('0xb1')));_0x508b38['use'](_0x0c3b('0xb2'),require(_0x0c3b('0xb3')));_0x508b38['use'](_0x0c3b('0xb4'),require(_0x0c3b('0xb5')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xb6'),require(_0x0c3b('0xb7')));_0x508b38['use'](_0x0c3b('0xb8'),require(_0x0c3b('0xb9')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xba'),require(_0x0c3b('0xbb')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xbc'),require('./api/chatQueueReport'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xbd'),require(_0x0c3b('0xbe')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xbf'),require(_0x0c3b('0xc0')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xc1'),require('./api/jscriptyQuestionReport'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xc2'),require('./api/jscriptySessionReport'));_0x508b38['use'](_0x0c3b('0xc3'),require(_0x0c3b('0xc4')));_0x508b38['use']('/api/square/reports',require(_0x0c3b('0xc5')));_0x508b38[_0x0c3b('0x7')]('/api/square/details/reports',require(_0x0c3b('0xc6')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xc7'),require(_0x0c3b('0xc8')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xc9'),require(_0x0c3b('0xca')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xcb'),require(_0x0c3b('0xcc')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xcd'),require(_0x0c3b('0xce')));_0x508b38[_0x0c3b('0x7')]('/api/square/recordings',require(_0x0c3b('0xcf')));_0x508b38[_0x0c3b('0x7')]('/api/square/messages',require(_0x0c3b('0xd0')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd1'),require('./api/team'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd2'),require(_0x0c3b('0xd3')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd4'),require(_0x0c3b('0xd5')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd6'),require('./api/migration'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xd7'),require(_0x0c3b('0xd8')));_0x508b38[_0x0c3b('0x7')]('/api/plugins',require(_0x0c3b('0xd9')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xda'),require(_0x0c3b('0xdb')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xdc'),require(_0x0c3b('0xdd')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xde'),require(_0x0c3b('0xdf')));_0x508b38['use'](_0x0c3b('0xe0'),require(_0x0c3b('0xe1')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xe2'),require(_0x0c3b('0xe3')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xe4'),require(_0x0c3b('0xe5')));_0x508b38[_0x0c3b('0x7')]('/api/voice/prefixes',require(_0x0c3b('0xe6')));_0x508b38[_0x0c3b('0x7')]('/api/userProfiles',require('./api/userProfile'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xe7'),require(_0x0c3b('0xe8')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xe9'),require('./api/userProfileResource'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xea'),require('./api/userNotification'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xeb'),require(_0x0c3b('0xec')));_0x508b38['use'](_0x0c3b('0xed'),require('./api/whatsappApplication'));_0x508b38[_0x0c3b('0x7')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x508b38['use'](_0x0c3b('0xee'),require('./api/whatsappMessage'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xef'),require(_0x0c3b('0xf0')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xf1'),require(_0x0c3b('0xf2')));_0x508b38[_0x0c3b('0x7')]('/api/whatsapp/queues',require(_0x0c3b('0xf3')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xf4'),require(_0x0c3b('0xf5')));_0x508b38[_0x0c3b('0x7')]('/api/realtime',require(_0x0c3b('0xf6')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xf7'),require(_0x0c3b('0xf8')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xf9'),require(_0x0c3b('0xfa')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xfb'),require(_0x0c3b('0xfc')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xfd'),require('./api/authActiveDirectory'));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0xfe'),require('./api/jira'));_0x508b38[_0x0c3b('0x7')]('/api/rpc',require(_0x0c3b('0xff')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x100'),require(_0x0c3b('0x101')));_0x508b38['use'](_0x0c3b('0x102'),require(_0x0c3b('0x103')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x104'),require(_0x0c3b('0x105')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x106'),require(_0x0c3b('0x107')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x108'),clientSideLogs);_0x508b38['use'](_0x0c3b('0x109'),express[_0x0c3b('0x10a')](path[_0x0c3b('0x10b')](config[_0x0c3b('0x10c')],'/apidoc')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x10d'),express['static'](path[_0x0c3b('0x10b')](config[_0x0c3b('0x10c')],_0x0c3b('0x10d'))));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x10e'),express[_0x0c3b('0x10a')](path[_0x0c3b('0x10b')](config[_0x0c3b('0x10c')],_0x0c3b('0x10e'))));_0x508b38['use']('/snippet',express[_0x0c3b('0x10a')](path[_0x0c3b('0x10b')](config[_0x0c3b('0x10c')],_0x0c3b('0x10f'),'3.5.0')));_0x508b38[_0x0c3b('0x7')](_0x0c3b('0x110'),express[_0x0c3b('0x10a')](path[_0x0c3b('0x10b')](config[_0x0c3b('0x10c')],'/server/files/plugins')));_0x508b38[_0x0c3b('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x0c3b('0x112')](errors[0x194]);_0x508b38[_0x0c3b('0x111')]('/*')[_0x0c3b('0x112')](function(_0x5be0ef,_0x42eba8){_0x42eba8[_0x0c3b('0x113')](path[_0x0c3b('0x114')](_0x508b38[_0x0c3b('0x112')](_0x0c3b('0x115'))+_0x0c3b('0x116')));});return _0x508b38;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 4208fa9..9ba4ebf 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff00=['http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server'];(function(_0x219c94,_0x804879){var _0x15c0a0=function(_0x407ee0){while(--_0x407ee0){_0x219c94['push'](_0x219c94['shift']());}};_0x15c0a0(++_0x804879);}(_0xff00,0x1a6));var _0x0ff0=function(_0x213dc0,_0x50248e){_0x213dc0=_0x213dc0-0x0;var _0x52ed0d=_0xff00[_0x213dc0];return _0x52ed0d;};'use strict';var jayson=require(_0x0ff0('0x0'));var _=require(_0x0ff0('0x1'));var config=require(_0x0ff0('0x2'));exports[_0x0ff0('0x3')]=function(){return new Promise(function(_0x4d8627,_0xf46a0a){var _0x35d4de={};_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x4')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x6')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x7')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x8')));_0x35d4de=_['merge'](_0x35d4de,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x9')));_0x35d4de=_['merge'](_0x35d4de,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/memberReport/memberReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0xa')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0xb')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0xc')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/mailServerIn/mailServerIn.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0xd')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0xe')));_0x35d4de=_['merge'](_0x35d4de,require('../api/mailInteraction/mailInteraction.rpc'));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0xf')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/mailApplication/mailApplication.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x10')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x11')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x12')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/faxMessage/faxMessage.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x13')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x14')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x15')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x16')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x17')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x18')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x19')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x1a')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x1b')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x1c')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x1d')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x1e')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x1f')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x20')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x21')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x22')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x23')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x24')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x25')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x26')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x27')));_0x35d4de=_['merge'](_0x35d4de,require('../api/pause/pause.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x28')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x29')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x2a')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/variable/variable.rpc'));_0x35d4de=_['merge'](_0x35d4de,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x2b')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x2c')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x2d')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x2e')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x2f')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x30')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x35d4de=_['merge'](_0x35d4de,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/squareReport/squareReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x31')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x32')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/squareOdbc/squareOdbc.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x33')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x34')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x35')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/campaign/campaign.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x36')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x37')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x38')));_0x35d4de=_['merge'](_0x35d4de,require(_0x0ff0('0x39')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x3a')));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x35d4de=_[_0x0ff0('0x5')](_0x35d4de,require(_0x0ff0('0x3b')));var _0x16a53d=jayson[_0x0ff0('0x3c')](_0x35d4de)[_0x0ff0('0x3d')]();var _0x5f357b=config[_0x0ff0('0x3e')][_0x0ff0('0x3f')]||config[_0x0ff0('0x3f')]+0x1;var _0x10f571=config[_0x0ff0('0x3e')]['ip']||_0x0ff0('0x40');_0x16a53d['on'](_0x0ff0('0x41'),function(_0x3c74ca){return _0xf46a0a(_0x3c74ca);});_0x16a53d['listen'](_0x5f357b,_0x10f571,function(){console[_0x0ff0('0x42')](_0x0ff0('0x43'),_0x10f571,_0x5f357b);require('../config/triggers')['default']();return _0x4d8627(_0x0ff0('0x44')+_0x10f571+':'+_0x5f357b);});});}; \ No newline at end of file +var _0x1487=['../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueue/whatsappQueue.rpc','rpc','port','localhost','log','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1487,0xf2));var _0x7148=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x1487[_0x34eb31];return _0x254994;};'use strict';var jayson=require('jayson/promise');var _=require(_0x7148('0x0'));var config=require(_0x7148('0x1'));exports[_0x7148('0x2')]=function(){return new Promise(function(_0x52e7c2,_0x1f7003){var _0x474ed6={};_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x3')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x5')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x6')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x7')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x8')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x9')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0xa')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0xb')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0xc')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0xd')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0xe')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0xf')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x10')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x11')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x12')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x13')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x14')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x15')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x16')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x17')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/faxInteraction/faxInteraction.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/faxMessage/faxMessage.rpc'));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x18')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x19')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x1a')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x1b')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x1c')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x1d')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x1e')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x1f')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x20')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x21')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x22')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x23')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x24')));_0x474ed6=_['merge'](_0x474ed6,require('../api/cmContact/cmContact.rpc'));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x25')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x26')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x27')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x28')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/interval/interval.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x29')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2a')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2b')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/template/template.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2c')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/variable/variable.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2d')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2e')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x2f')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x30')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x31')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x32')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x33')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x34')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x35')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x36')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/squareProject/squareProject.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x37')));_0x474ed6=_['merge'](_0x474ed6,require('../api/squareMessage/squareMessage.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x38')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x39')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require(_0x7148('0x3a')));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x3b')));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x474ed6=_[_0x7148('0x4')](_0x474ed6,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x474ed6=_['merge'](_0x474ed6,require(_0x7148('0x3c')));var _0x4344ac=jayson['server'](_0x474ed6)['http']();var _0x2ca4e1=config[_0x7148('0x3d')][_0x7148('0x3e')]||config[_0x7148('0x3e')]+0x1;var _0x3bef50=config[_0x7148('0x3d')]['ip']||_0x7148('0x3f');_0x4344ac['on']('error',function(_0x1cd11c){return _0x1f7003(_0x1cd11c);});_0x4344ac[_0x7148('0x2')](_0x2ca4e1,_0x3bef50,function(){console[_0x7148('0x40')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3bef50,_0x2ca4e1);require(_0x7148('0x41'))[_0x7148('0x42')]();return _0x52e7c2(_0x7148('0x43')+_0x3bef50+':'+_0x2ca4e1);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 28dad3d..db7b7f0 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 _0x99a0=['match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','continueAt','setContext','setPriority','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','AGI','wait','label','exports','util','lodash','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','result=','indexOf','substr','startsWith','split','length'];(function(_0x78068e,_0x536a1a){var _0xb8f50f=function(_0x57db2a){while(--_0x57db2a){_0x78068e['push'](_0x78068e['shift']());}};_0xb8f50f(++_0x536a1a);}(_0x99a0,0x121));var _0x099a=function(_0x1c1447,_0x9166cc){_0x1c1447=_0x1c1447-0x0;var _0x292a43=_0x99a0[_0x1c1447];return _0x292a43;};'use strict';var util=require(_0x099a('0x0'));var _=require(_0x099a('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x3f281a){var _0x2b5e88=this,_0x5d6b40=new AGIReply(),_0x21d681=![],_0x1d3f16={};EventEmitter[_0x099a('0x2')](_0x2b5e88);_0x3f281a[_0x099a('0x3')](_0x099a('0x4'));_0x3f281a[_0x099a('0x5')](0x8*0x3c*0x3c*0x3e8);_0x5d6b40['setEncoding'](_0x099a('0x4'));_0x5d6b40['on'](_0x099a('0x6'),function(_0x268440){for(var _0x4e8958 in _0x268440){_0x2b5e88[_0x4e8958]=_0x268440[_0x4e8958];}_0x2b5e88[_0x099a('0x7')](_0x099a('0x8'));});_0x5d6b40['on'](_0x099a('0x9'),function(_0x14cccc){if(_0x14cccc[_0x099a('0xa')]()==_0x099a('0xb')){_0x2b5e88[_0x099a('0x7')](_0x099a('0xb'));return;}if(_0x14cccc[_0x099a('0xc')](0x0,0xb)==_0x099a('0xd')){_0x21d681=!![];}if(_0x21d681){_0x1d3f16['rx']+=_0x14cccc+'\x0a';if(_0x14cccc[_0x099a('0xe')](_0x099a('0xf'))!=-0x1){_0x21d681=![];}}else{_0x1d3f16['rx']=_0x14cccc;}if(_0x21d681){return;}if(typeof _0x1d3f16['cb']==_0x099a('0x10')){var _0x1e9dc1=_0x1d3f16['rx'][_0x099a('0xc')](0x0,0x3),_0x2e8afc=null,_0x4bd3ee=null;_0x1e9dc1=parseInt(_0x1e9dc1);if(isNaN(_0x1e9dc1)){_0x1d3f16['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x1e9dc1!=0xc8){_0x1d3f16['cb'](null,{'code':_0x1e9dc1,'result':-0x1,'extra':'KO'});return;}_0x2e8afc=_0x1d3f16['rx'][_0x099a('0xc')](0x4)['replace'](_0x099a('0x11'),'');if(_0x2e8afc[_0x099a('0x12')]('\x20')!=-0x1){_0x2e8afc=_0x2e8afc[_0x099a('0x13')](0x0,_0x2e8afc[_0x099a('0x12')]('\x20'));}if(_[_0x099a('0x14')](_0x2e8afc,'-1')){_0x2e8afc=parseInt(_0x2e8afc);}_0x4bd3ee=_0x1d3f16['rx'][_0x099a('0x15')]('\x20');if(_0x4bd3ee['length']==0x3){_0x4bd3ee=_0x4bd3ee[0x2][_0x099a('0xc')](0x1,_0x4bd3ee[0x2][_0x099a('0x16')]-0x1);}else if(_0x4bd3ee[_0x099a('0x16')]>0x3){var _0x371af7=/\((.+)\)/;var _0x5d7b21=_0x1d3f16['rx'][_0x099a('0x17')](_0x371af7);if(_0x5d7b21){_0x4bd3ee=_0x5d7b21[0x1];}else{_0x4bd3ee=null;}}else{_0x4bd3ee=null;}_0x1d3f16['cb'](null,{'code':_0x1e9dc1,'result':_0x2e8afc,'extra':_0x4bd3ee});}});_0x3f281a['on']('error',function(_0x1d3924){_0x2b5e88[_0x099a('0x7')](_0x099a('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x1d3924[_0x099a('0x19')]));});_0x3f281a['on'](_0x099a('0x1a'),function(){_0x2b5e88[_0x099a('0x7')](_0x099a('0x1a'),new AGIError(_0x099a('0x1b')));});_0x3f281a['on']('timeout',function(){_0x2b5e88['emit'](_0x099a('0x1c'),new AGIError(_0x099a('0x1d')));_0x3f281a[_0x099a('0x1e')]();});_0x3f281a[_0x099a('0x1f')](_0x5d6b40);this[_0x099a('0x20')]=function(_0x3c64ce,_0x2b2b9b){var _0x3c64ce=_0x3c64ce||'',_0x2b2b9b=typeof _0x2b2b9b=='function'?_0x2b2b9b:new Function();_0x1d3f16={'tx':_0x3c64ce,'rx':'','cb':_0x2b2b9b};_0x3f281a[_0x099a('0x21')](_0x3c64ce+'\x0a');},this[_0x099a('0x1a')]=function(){_0x3f281a[_0x099a('0x1e')]();};}util[_0x099a('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x099a('0x23')][_0x099a('0x24')]=function(_0x126b05){return this[_0x099a('0x20')][_0x099a('0x25')](this,_0x126b05);};AGIChannel[_0x099a('0x23')][_0x099a('0x26')]=function(){return this['sendRequest'](_0x099a('0x27'));};AGIChannel['prototype'][_0x099a('0x28')]=function(_0x39f520,_0x159a26,_0x4cbc26){_0x39f520=_0x39f520===undefined?_0x099a('0x29'):_0x39f520;_0x159a26=_0x159a26===undefined?'5':_0x159a26;_0x4cbc26=_0x4cbc26===undefined?'1':_0x4cbc26;return this[_0x099a('0x24')](util[_0x099a('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x39f520,_0x159a26*0x3e8,_0x4cbc26));};AGIChannel['prototype']['noop']=function(_0x2b1597){_0x2b1597=_0x2b1597||_0x099a('0x2b');return this['sendRequest'](util[_0x099a('0x2a')](_0x099a('0x2c'),_0x2b1597));};AGIChannel[_0x099a('0x23')][_0x099a('0x2d')]=function(_0x462c0d,_0x36c1b4){if(_['isArray'](_0x36c1b4)){return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x2e'),_0x462c0d,_0x36c1b4[_0x099a('0x2f')](',')));}return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x2e'),_0x462c0d,_0x36c1b4));};AGIChannel[_0x099a('0x23')]['setContext']=function(_0x15ba05){return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x30'),_0x15ba05));};AGIChannel[_0x099a('0x23')][_0x099a('0x31')]=function(_0x4e71d2){return this[_0x099a('0x24')](util['format'](_0x099a('0x32'),_0x4e71d2));};AGIChannel[_0x099a('0x23')]['setPriority']=function(_0x7a5837){return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x33'),_0x7a5837));};AGIChannel[_0x099a('0x23')]['hangup']=function(){return this[_0x099a('0x24')](_0x099a('0x34'));};AGIChannel['prototype'][_0x099a('0x35')]=function(_0x405b07,_0xba763c){var _0x58cb69=_[_0x099a('0x36')](_0xba763c)||_[_0x099a('0x37')](_0xba763c)?_0xba763c[_0x099a('0x38')]():_0xba763c;return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x39'),_0x405b07,_0x58cb69?_0x58cb69['toString']()[_0x099a('0x3a')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x099a('0x3b')]=function(_0x51931b,_0x541173){return this[_0x099a('0x24')](util[_0x099a('0x2a')](_0x099a('0x3c'),_0x51931b,_0x541173));};AGIChannel[_0x099a('0x23')][_0x099a('0x3d')]=function(_0x2911cf,_0x1386cb){return this[_0x099a('0x24')](util[_0x099a('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x2911cf,_0x1386cb));};AGIChannel[_0x099a('0x23')][_0x099a('0x3e')]=function(_0x2efb31,_0x34a601){return this[_0x099a('0x24')](util[_0x099a('0x2a')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2efb31,_0x34a601));};AGIChannel['prototype'][_0x099a('0x3f')]=function(_0x8e5dcc,_0x5dea70,_0x1439fa){_0x5dea70=_0x5dea70||this['extension'];_0x1439fa=_0x1439fa||0x1;this[_0x099a('0x40')](_0x8e5dcc);this[_0x099a('0x31')](_0x5dea70);this[_0x099a('0x41')](_0x1439fa);return this[_0x099a('0x42')](util[_0x099a('0x2a')](_0x099a('0x43'),_0x8e5dcc,_0x5dea70,_0x1439fa));};AGIChannel[_0x099a('0x23')][_0x099a('0x44')]=function(_0x49fc09){return this[_0x099a('0x24')](util['format'](_0x099a('0x45'),_0x49fc09));};AGIChannel['prototype'][_0x099a('0x46')]=function(_0x29dd56,_0xaf5b0c,_0x1f1002,_0x581c05,_0x20c0b6,_0x2ec162){_0xaf5b0c=_0xaf5b0c||'wav';_0x1f1002=_0x1f1002||'';_0x581c05=_0x581c05===undefined?-0x1:_0x581c05==='-1'?-0x1:_0x581c05*0x3e8;_0x20c0b6=_0x20c0b6===undefined?'':'s='+_0x20c0b6;_0x2ec162=_0x2ec162?_0x099a('0x47'):'';return this['sendRequest'](util[_0x099a('0x2a')](_0x099a('0x48'),_0x29dd56,_0xaf5b0c,_0x1f1002,_0x581c05,_0x2ec162,_0x20c0b6));};AGIChannel[_0x099a('0x23')][_0x099a('0x49')]=function(_0x407c0e,_0x3f9308){_0x3f9308=_0x3f9308||'';return this[_0x099a('0x24')](util[_0x099a('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x407c0e,_0x3f9308));};AGIChannel[_0x099a('0x23')]['agi']=function(_0x25a545){return this[_0x099a('0x2d')](_0x099a('0x4a'),_0x25a545);};AGIChannel[_0x099a('0x23')][_0x099a('0x4b')]=function(_0x473b56){return this[_0x099a('0x2d')]('WAIT',_0x473b56);};AGIChannel[_0x099a('0x23')][_0x099a('0x18')]=function(_0x5d6fd8,_0x1c31ff){this[_0x099a('0x42')](util[_0x099a('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5d6fd8['id'],_0x5d6fd8[_0x099a('0x4c')],_0x1c31ff));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x099a('0x4d')]=AGIChannel; \ No newline at end of file +var _0x1d63=['GET\x20VARIABLE\x20\x22%s\x22','wav','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','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','call','setEncoding','setTimeout','headers','line','toLowerCase','emit','hangup','substring','520-Invalid','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','close','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setPriority','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x1d63,0xa4));var _0x31d6=function(_0x4cae17,_0x2830a3){_0x4cae17=_0x4cae17-0x0;var _0x2ac6ef=_0x1d63[_0x4cae17];return _0x2ac6ef;};'use strict';var util=require(_0x31d6('0x0'));var _=require(_0x31d6('0x1'));var EventEmitter=require(_0x31d6('0x2'))[_0x31d6('0x3')];var AGIReply=require(_0x31d6('0x4'));var AGIError=require('./error');function AGIChannel(_0x2aa9f6){var _0x44ebb1=this,_0x27c1c8=new AGIReply(),_0xe4dc8b=![],_0x3e83c7={};EventEmitter[_0x31d6('0x5')](_0x44ebb1);_0x2aa9f6[_0x31d6('0x6')]('utf8');_0x2aa9f6[_0x31d6('0x7')](0x8*0x3c*0x3c*0x3e8);_0x27c1c8[_0x31d6('0x6')]('utf8');_0x27c1c8['on'](_0x31d6('0x8'),function(_0x2c1b36){for(var _0x5ec404 in _0x2c1b36){_0x44ebb1[_0x5ec404]=_0x2c1b36[_0x5ec404];}_0x44ebb1['emit']('ready');});_0x27c1c8['on'](_0x31d6('0x9'),function(_0x341424){if(_0x341424[_0x31d6('0xa')]()=='hangup'){_0x44ebb1[_0x31d6('0xb')](_0x31d6('0xc'));return;}if(_0x341424[_0x31d6('0xd')](0x0,0xb)==_0x31d6('0xe')){_0xe4dc8b=!![];}if(_0xe4dc8b){_0x3e83c7['rx']+=_0x341424+'\x0a';if(_0x341424[_0x31d6('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0xe4dc8b=![];}}else{_0x3e83c7['rx']=_0x341424;}if(_0xe4dc8b){return;}if(typeof _0x3e83c7['cb']==_0x31d6('0x10')){var _0x935b4f=_0x3e83c7['rx'][_0x31d6('0xd')](0x0,0x3),_0x267f2b=null,_0x4639b8=null;_0x935b4f=parseInt(_0x935b4f);if(isNaN(_0x935b4f)){_0x3e83c7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x31d6('0x11')});return;}if(_0x935b4f!=0xc8){_0x3e83c7['cb'](null,{'code':_0x935b4f,'result':-0x1,'extra':'KO'});return;}_0x267f2b=_0x3e83c7['rx']['substring'](0x4)[_0x31d6('0x12')](_0x31d6('0x13'),'');if(_0x267f2b[_0x31d6('0x14')]('\x20')!=-0x1){_0x267f2b=_0x267f2b[_0x31d6('0x15')](0x0,_0x267f2b['indexOf']('\x20'));}if(_[_0x31d6('0x16')](_0x267f2b,'-1')){_0x267f2b=parseInt(_0x267f2b);}_0x4639b8=_0x3e83c7['rx']['split']('\x20');if(_0x4639b8[_0x31d6('0x17')]==0x3){_0x4639b8=_0x4639b8[0x2][_0x31d6('0xd')](0x1,_0x4639b8[0x2][_0x31d6('0x17')]-0x1);}else if(_0x4639b8[_0x31d6('0x17')]>0x3){var _0x189784=/\((.+)\)/;var _0x437d41=_0x3e83c7['rx']['match'](_0x189784);if(_0x437d41){_0x4639b8=_0x437d41[0x1];}else{_0x4639b8=null;}}else{_0x4639b8=null;}_0x3e83c7['cb'](null,{'code':_0x935b4f,'result':_0x267f2b,'extra':_0x4639b8});}});_0x2aa9f6['on'](_0x31d6('0x18'),function(_0x403ef4){_0x44ebb1[_0x31d6('0xb')](_0x31d6('0x18'),new AGIError(_0x31d6('0x19'),_0x403ef4[_0x31d6('0x1a')]));});_0x2aa9f6['on']('close',function(){_0x44ebb1[_0x31d6('0xb')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x2aa9f6['on'](_0x31d6('0x1b'),function(){_0x44ebb1[_0x31d6('0xb')](_0x31d6('0x1b'),new AGIError(_0x31d6('0x1c')));_0x2aa9f6[_0x31d6('0x1d')]();});_0x2aa9f6[_0x31d6('0x1e')](_0x27c1c8);this[_0x31d6('0x1f')]=function(_0x1d0351,_0x2eef78){var _0x1d0351=_0x1d0351||'',_0x2eef78=typeof _0x2eef78=='function'?_0x2eef78:new Function();_0x3e83c7={'tx':_0x1d0351,'rx':'','cb':_0x2eef78};_0x2aa9f6['write'](_0x1d0351+'\x0a');},this[_0x31d6('0x20')]=function(){_0x2aa9f6[_0x31d6('0x1d')]();};}util[_0x31d6('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x31d6('0x22')]=function(_0x2b9cc0){return this[_0x31d6('0x1f')][_0x31d6('0x23')](this,_0x2b9cc0);};AGIChannel[_0x31d6('0x24')][_0x31d6('0x25')]=function(){return this[_0x31d6('0x22')](_0x31d6('0x26'));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x27')]=function(_0x496902,_0x3823e1,_0x48fd41){_0x496902=_0x496902===undefined?'beep':_0x496902;_0x3823e1=_0x3823e1===undefined?'5':_0x3823e1;_0x48fd41=_0x48fd41===undefined?'1':_0x48fd41;return this[_0x31d6('0x22')](util['format'](_0x31d6('0x28'),_0x496902,_0x3823e1*0x3e8,_0x48fd41));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x29')]=function(_0x22f68c){_0x22f68c=_0x22f68c||_0x31d6('0x2a');return this[_0x31d6('0x22')](util[_0x31d6('0x2b')]('VERBOSE\x20\x22%s\x22',_0x22f68c));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x2c')]=function(_0xd5bc4a,_0x30ec61){if(_['isArray'](_0x30ec61)){return this[_0x31d6('0x22')](util['format'](_0x31d6('0x2d'),_0xd5bc4a,_0x30ec61[_0x31d6('0x2e')](',')));}return this[_0x31d6('0x22')](util[_0x31d6('0x2b')]('EXEC\x20%s\x20%s',_0xd5bc4a,_0x30ec61));};AGIChannel['prototype'][_0x31d6('0x2f')]=function(_0x26e822){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x30'),_0x26e822));};AGIChannel['prototype']['setExtension']=function(_0x1304cf){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')]('SET\x20EXTENSION\x20%s',_0x1304cf));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x31')]=function(_0x48dfb3){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')]('SET\x20PRIORITY\x20%s',_0x48dfb3));};AGIChannel['prototype'][_0x31d6('0xc')]=function(){return this[_0x31d6('0x22')](_0x31d6('0x32'));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x33')]=function(_0x2a8dae,_0x405d33){var _0x4049c7=_[_0x31d6('0x34')](_0x405d33)||_['isNumber'](_0x405d33)?_0x405d33[_0x31d6('0x35')]():_0x405d33;return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x36'),_0x2a8dae,_0x4049c7?_0x4049c7['toString']()[_0x31d6('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x31d6('0x37')]=function(_0x92856,_0x472d9c){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x38'),_0x92856,_0x472d9c));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x39')]=function(_0xf44e59,_0xed2655){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x3a'),_0xf44e59,_0xed2655));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x3b')]=function(_0x13c194,_0x4aa0a7){return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x3c'),_0x13c194,_0x4aa0a7));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x3d')]=function(_0x1430e2,_0x4afd05,_0x9e3360){_0x4afd05=_0x4afd05||this[_0x31d6('0x3e')];_0x9e3360=_0x9e3360||0x1;this[_0x31d6('0x2f')](_0x1430e2);this['setExtension'](_0x4afd05);this[_0x31d6('0x31')](_0x9e3360);return this[_0x31d6('0x29')](util[_0x31d6('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x1430e2,_0x4afd05,_0x9e3360));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x3f')]=function(_0x4949d6){return this['sendRequest'](util['format'](_0x31d6('0x40'),_0x4949d6));};AGIChannel['prototype']['recordFile']=function(_0x5c1d85,_0x5613f5,_0x180ae6,_0x2f05c6,_0x20dbb2,_0x38cb97){_0x5613f5=_0x5613f5||_0x31d6('0x41');_0x180ae6=_0x180ae6||'';_0x2f05c6=_0x2f05c6===undefined?-0x1:_0x2f05c6==='-1'?-0x1:_0x2f05c6*0x3e8;_0x20dbb2=_0x20dbb2===undefined?'':'s='+_0x20dbb2;_0x38cb97=_0x38cb97?_0x31d6('0x42'):'';return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x43'),_0x5c1d85,_0x5613f5,_0x180ae6,_0x2f05c6,_0x38cb97,_0x20dbb2));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x44')]=function(_0x35996a,_0x188899){_0x188899=_0x188899||'';return this[_0x31d6('0x22')](util[_0x31d6('0x2b')](_0x31d6('0x45'),_0x35996a,_0x188899));};AGIChannel[_0x31d6('0x24')][_0x31d6('0x46')]=function(_0x16b294){return this[_0x31d6('0x2c')](_0x31d6('0x47'),_0x16b294);};AGIChannel['prototype'][_0x31d6('0x48')]=function(_0x7d4824){return this[_0x31d6('0x2c')](_0x31d6('0x49'),_0x7d4824);};AGIChannel[_0x31d6('0x24')][_0x31d6('0x18')]=function(_0x431092,_0x3471ff){this[_0x31d6('0x29')](util['format'](_0x31d6('0x4a'),_0x431092['id'],_0x431092[_0x31d6('0x4b')],_0x3471ff));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9bfcd03..1fade13 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 _0xbfb7=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','format','apply','util','Undefined\x20error.'];(function(_0x226195,_0x253ae8){var _0x5424ad=function(_0x394081){while(--_0x394081){_0x226195['push'](_0x226195['shift']());}};_0x5424ad(++_0x253ae8);}(_0xbfb7,0x1d2));var _0x7bfb=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xbfb7[_0xf26c2e];return _0x46ecb4;};'use strict';var util=require(_0x7bfb('0x0'));var error={'E_AGI_UNDEFINED':_0x7bfb('0x1'),'E_AGI_ARGUMENT_PORT':_0x7bfb('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x7bfb('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x7bfb('0x4'),'E_AGI_SOCKET_ERROR':_0x7bfb('0x5'),'E_AGI_SOCKET_CLOSE':_0x7bfb('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x7bfb('0x7'),'E_AGI_COMMAND_EMPTY':_0x7bfb('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7bfb('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x14a82e){var _0x14a82e=_0x14a82e||null,_0x5d1e54=_0x5d1e54||[],_0x526e3e=0x1,_0x4f2152='';if(!error[_0x14a82e]){_0x14a82e=_0x7bfb('0xa');}_0x5d1e54['push'](error[_0x14a82e]);while(arguments[_0x526e3e]){_0x5d1e54['push'](arguments[_0x526e3e]);_0x526e3e++;}_0x4f2152=util[_0x7bfb('0xb')][_0x7bfb('0xc')](util,_0x5d1e54);this['message']=_0x4f2152;this['name']=_0x14a82e;}module['exports']=AGIError; \ No newline at end of file +var _0x68b6=['util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','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(_0x3c9a34,_0x2e51a5){var _0x5f5458=function(_0x5de797){while(--_0x5de797){_0x3c9a34['push'](_0x3c9a34['shift']());}};_0x5f5458(++_0x2e51a5);}(_0x68b6,0xff));var _0x668b=function(_0x43f9d7,_0x39e674){_0x43f9d7=_0x43f9d7-0x0;var _0x53c2f4=_0x68b6[_0x43f9d7];return _0x53c2f4;};'use strict';var util=require(_0x668b('0x0'));var error={'E_AGI_UNDEFINED':_0x668b('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x668b('0x2'),'E_AGI_SERVER_CLOSE':_0x668b('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x668b('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x668b('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x668b('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x668b('0x7'),'E_AGI_COMMAND_EMPTY':_0x668b('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x668b('0x9'),'E_AGI_IVR_ENTRY':_0x668b('0xa')};function AGIError(_0xa4ed31){var _0xa4ed31=_0xa4ed31||null,_0x1e7ce2=_0x1e7ce2||[],_0x10136e=0x1,_0x4a37f2='';if(!error[_0xa4ed31]){_0xa4ed31=_0x668b('0xb');}_0x1e7ce2[_0x668b('0xc')](error[_0xa4ed31]);while(arguments[_0x10136e]){_0x1e7ce2[_0x668b('0xc')](arguments[_0x10136e]);_0x10136e++;}_0x4a37f2=util[_0x668b('0xd')]['apply'](util,_0x1e7ce2);this['message']=_0x4a37f2;this[_0x668b('0xe')]=_0xa4ed31;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 61ba675..0f3a666 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 _0x29ab=['error','E_AGI_SERVER_ERROR','agi','parse','emit','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0x29ab,0x123));var _0xb29a=function(_0x32b60e,_0x540349){_0x32b60e=_0x32b60e-0x0;var _0x474832=_0x29ab[_0x32b60e];return _0x474832;};'use strict';var _=require(_0xb29a('0x0'));var EventEmitter=require(_0xb29a('0x1'))[_0xb29a('0x2')];var Redis=require(_0xb29a('0x3'));var AGIError=require(_0xb29a('0x4'));var config=require(_0xb29a('0x5'));config[_0xb29a('0x6')]=_[_0xb29a('0x7')](config['redis'],{'host':_0xb29a('0x8'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe']('agi',function(_0x3d664d){if(_0x3d664d)return eventEmitter['emit'](_0xb29a('0x9'),new AGIError(_0xb29a('0xa'),_0x3d664d));});sub['on']('message',function(_0x2e1790,_0x5373dd){if(_0x2e1790!==_0xb29a('0xb'))return;try{var _0x46b58c=JSON[_0xb29a('0xc')](_0x5373dd);eventEmitter[_0xb29a('0xd')]('projectUpdate',_0x46b58c);}catch(_0x4e871a){eventEmitter[_0xb29a('0xd')](_0xb29a('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x4e871a));}});module[_0xb29a('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xf811=['ioredis','redis','defaults','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','EventEmitter'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0xf811,0x1e8));var _0x1f81=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xf811[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x1f81('0x0'));var EventEmitter=require('events')[_0x1f81('0x1')];var Redis=require(_0x1f81('0x2'));var AGIError=require('./error');var config=require('../../config/environment');config[_0x1f81('0x3')]=_[_0x1f81('0x4')](config[_0x1f81('0x3')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x1f81('0x3')]);sub[_0x1f81('0x5')](_0x1f81('0x6'),function(_0x59bebd){if(_0x59bebd)return eventEmitter[_0x1f81('0x7')](_0x1f81('0x8'),new AGIError(_0x1f81('0x9'),_0x59bebd));});sub['on'](_0x1f81('0xa'),function(_0x462250,_0x2d73c5){if(_0x462250!==_0x1f81('0x6'))return;try{var _0xbf4d55=JSON[_0x1f81('0xb')](_0x2d73c5);eventEmitter[_0x1f81('0x7')](_0x1f81('0xc'),_0xbf4d55);}catch(_0x4fd857){eventEmitter[_0x1f81('0x7')]('error',new AGIError(_0x1f81('0x9'),_0x4fd857));}});module[_0x1f81('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ab4c148..ee6a491 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 _0xb95d=['default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','exports','lodash','../../../config/logger','menu','getdigits','getsecretdigits','vertices','numberOfEdges','edges','prototype','addEdge','push','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid'];(function(_0x265e33,_0x3d5f7b){var _0x4ce44e=function(_0x18f7ca){while(--_0x18f7ca){_0x265e33['push'](_0x265e33['shift']());}};_0x4ce44e(++_0x3d5f7b);}(_0xb95d,0x15f));var _0xdb95=function(_0x28edf8,_0x3ab79f){_0x28edf8=_0x28edf8-0x0;var _0xb0bbba=_0xb95d[_0x28edf8];return _0xb0bbba;};'use strict';var _=require(_0xdb95('0x0'));var logger=require(_0xdb95('0x1'))('agi');var verticesWithRetry=[_0xdb95('0x2'),_0xdb95('0x3'),_0xdb95('0x4')];var Graph=function(){this[_0xdb95('0x5')]={};this['edges']={};this[_0xdb95('0x6')]=0x0;};Graph['prototype']['addVertex']=function(_0xcedeb8){this[_0xdb95('0x5')][_0xcedeb8['id']]=_0xcedeb8;this[_0xdb95('0x7')][_0xcedeb8['id']]=[];};Graph[_0xdb95('0x8')][_0xdb95('0x9')]=function(_0x4eb1a4,_0x2fe0a4,_0x1808f6){this[_0xdb95('0x7')][_0x4eb1a4][_0xdb95('0xa')]({'target':_0x2fe0a4,'condition':_0x1808f6});this[_0xdb95('0x6')]+=0x1;};Graph[_0xdb95('0x8')][_0xdb95('0xb')]=function(){return _[_0xdb95('0xb')](this['vertices']);};Graph['prototype']['relations']=function(){return this[_0xdb95('0x6')];};Graph[_0xdb95('0x8')][_0xdb95('0xc')]=function(_0x15baae){return this[_0xdb95('0x5')][_0x15baae];};Graph['prototype'][_0xdb95('0xd')]=function(_0x416b4d,_0x3b8270){if(!this[_0xdb95('0x5')][_0x416b4d]){return logger[_0xdb95('0xe')](_0xdb95('0xf'));}var _0x56cfb3=_0x3b8270(this[_0xdb95('0x5')][_0x416b4d]);if(!_0x56cfb3){return logger[_0xdb95('0xe')](_0xdb95('0x10'));}if(this['edges'][_0x416b4d][_0xdb95('0x11')]===0x0){return logger[_0xdb95('0xe')](_0xdb95('0x12'));}for(var _0x1513d3=0x0,_0x3a0e00=[],_0x5e6191=![];_0x1513d3\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','stack','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','handleNotFound','production','handleUnpublished','initialize','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','[LICENSE]','finally','./server','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','projectUpdate','nextTick','findIndex','deleted','splice','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','format','[ERROR]\x20%s'];(function(_0x665fe4,_0x11d4e3){var _0x111a32=function(_0x5d5336){while(--_0x5d5336){_0x665fe4['push'](_0x665fe4['shift']());}};_0x111a32(++_0x11d4e3);}(_0xae54,0x95));var _0x4ae5=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0xae54[_0x4cfa2e];return _0x279b50;};'use strict';var _=require(_0x4ae5('0x0'));var syncho=require(_0x4ae5('0x1'));var util=require(_0x4ae5('0x2'));var config=require(_0x4ae5('0x3'));var logger=require(_0x4ae5('0x4'))(_0x4ae5('0x5'));var utilLicense=require(_0x4ae5('0x6'));var rpc=require(_0x4ae5('0x7'));var Project=require(_0x4ae5('0x8'));var AGIEmitter=require(_0x4ae5('0x9'))[_0x4ae5('0xa')];var projects=[];config[_0x4ae5('0x5')]=_[_0x4ae5('0xb')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x4ae5('0xc'),projectUpdateHandler);function connectionHandler(_0x44dce8){process[_0x4ae5('0xd')](function(){syncho(function(){try{setChannelVariables(_0x44dce8);agiHandler(_0x44dce8);}catch(_0x2891c2){logger['error'](_0x2891c2['stack']);}});});}function projectUpdateHandler(_0x4ae4e6){try{var _0x494cf4=_[_0x4ae5('0xe')](projects,['id',_0x4ae4e6['id']]);if(_0x494cf4>-0x1){if(_0x4ae4e6[_0x4ae5('0xf')]===!![]){projects[_0x4ae5('0x10')](_0x494cf4,0x1);}else{projects[_0x494cf4]=_0x4ae4e6;}}else{projects['push'](_0x4ae4e6);}}catch(_0x164ab5){logger[_0x4ae5('0x11')](_0x164ab5['stack']);}}function listeningHandler(){console[_0x4ae5('0x12')](_0x4ae5('0x13'),config['agi'][_0x4ae5('0x14')]);logger['info'](util['format'](_0x4ae5('0x15'),config[_0x4ae5('0x5')]['ip'],config[_0x4ae5('0x5')][_0x4ae5('0x14')]));}function errorHandler(_0x31136c){if(_0x31136c&&_0x31136c[_0x4ae5('0x16')]&&_0x31136c['message']){logger[_0x4ae5('0x11')](util[_0x4ae5('0x17')]('[%s]\x20%s',_0x31136c[_0x4ae5('0x16')],_0x31136c['message']));}else{logger[_0x4ae5('0x11')](util[_0x4ae5('0x17')](_0x4ae5('0x18'),_0x31136c['stack']));}}function closeHandler(){logger[_0x4ae5('0x19')](util[_0x4ae5('0x17')](_0x4ae5('0x1a'),this[_0x4ae5('0x1b')],this['calleridname'],this['callerid'],this[_0x4ae5('0x1c')],this[_0x4ae5('0x1d')]));try{createSquareReport(this);}catch(_0x207289){logger['error'](_0x207289[_0x4ae5('0x1e')]);}}function timeoutHandler(){logger[_0x4ae5('0x19')](util[_0x4ae5('0x17')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4ae5('0x1b')],this[_0x4ae5('0x1f')],this['callerid'],this[_0x4ae5('0x1c')],this[_0x4ae5('0x1d')]));}function hangupHandler(){logger[_0x4ae5('0x19')](util[_0x4ae5('0x17')](_0x4ae5('0x20'),this[_0x4ae5('0x1b')],this[_0x4ae5('0x1f')],this[_0x4ae5('0x21')],this[_0x4ae5('0x1c')],this[_0x4ae5('0x1d')]));this[_0x4ae5('0x22')]=!![];}function createSquareReport(_0x397445,_0x13e4d7){rpc['createSquareReport'](_0x397445)['then'](function(_0xe925cb){if(_0x13e4d7){_0x13e4d7(null,_0xe925cb);}})['catch'](function(_0x12c168){if(_0x13e4d7){_0x13e4d7(null,_0x12c168);}});}function setChannelVariables(_0x1ad704){for(var _0x52b570 in _0x1ad704){if(_0x1ad704['hasOwnProperty'](_0x52b570)){if(_0x52b570['indexOf']('agi_')===0x0){_0x1ad704[_0x52b570[_0x4ae5('0x23')](0x4)]=_0x1ad704[_0x52b570];delete _0x1ad704[_0x52b570];}}}}function agiHandler(_0x3cdbe8){logger[_0x4ae5('0x24')]('variables',JSON[_0x4ae5('0x25')](_0x3cdbe8,null,0x2));logger[_0x4ae5('0x19')](util[_0x4ae5('0x17')](_0x4ae5('0x26'),_0x3cdbe8[_0x4ae5('0x1b')],_0x3cdbe8[_0x4ae5('0x1f')],_0x3cdbe8[_0x4ae5('0x21')],_0x3cdbe8[_0x4ae5('0x1c')],_0x3cdbe8['uniqueid']));_0x3cdbe8['on'](_0x4ae5('0x11'),errorHandler);_0x3cdbe8['on'](_0x4ae5('0x27'),closeHandler);_0x3cdbe8['on'](_0x4ae5('0x28'),timeoutHandler);_0x3cdbe8[_0x4ae5('0x22')]=![];_0x3cdbe8['on']('hangup',hangupHandler);var _0x29c790=_['find'](projects,[_0x4ae5('0x16'),_0x3cdbe8[_0x4ae5('0x1b')]]);if(!_0x29c790)return Project[_0x4ae5('0x29')](_0x3cdbe8);if(!_0x29c790[_0x4ae5('0x2a')])return Project[_0x4ae5('0x2b')](_0x3cdbe8);return Project[_0x4ae5('0x2c')](_0x29c790,_0x3cdbe8);}function main(){var _0x2db37b;return utilLicense[_0x4ae5('0x2d')]()[_0x4ae5('0x2e')](function(_0x8bfbaf){if(!_0x8bfbaf)return;if(_0x8bfbaf[_0x4ae5('0x2f')]){if(_0x8bfbaf[_0x4ae5('0x30')]&&_0x8bfbaf[_0x4ae5('0x30')]>0x0){logger[_0x4ae5('0x19')](util['format'](_0x4ae5('0x31'),_0x8bfbaf[_0x4ae5('0x30')]));_0x2db37b=_0x8bfbaf['callysquare'];}else{logger[_0x4ae5('0x19')](_0x4ae5('0x32'));}}else{logger[_0x4ae5('0x19')](_0x4ae5('0x33'));_0x2db37b=-0x1;}})[_0x4ae5('0x2e')](function(){return Project[_0x4ae5('0x34')]();})[_0x4ae5('0x2e')](function(_0x3fb2df){projects=_0x3fb2df;return;})[_0x4ae5('0x35')](function(_0xea7069){logger[_0x4ae5('0x11')](_0x4ae5('0x36'),_0xea7069['stack']);})[_0x4ae5('0x37')](function(){var _0x50f3bc=require(_0x4ae5('0x38'))(config[_0x4ae5('0x5')]['port'],config['agi']['ip'],_0x2db37b);_0x50f3bc['on'](_0x4ae5('0x11'),errorHandler);_0x50f3bc['on']('listening',listeningHandler);_0x50f3bc['on'](_0x4ae5('0x39'),connectionHandler);_0x50f3bc['on'](_0x4ae5('0x27'),closeHandler);});}main(); \ No newline at end of file +var _0x813d=['findIndex','deleted','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','port','name','format','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','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleUnpublished','initialize','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','connection','lodash','syncho','util','agi','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x813d,0x1b2));var _0xd813=function(_0xdfc347,_0x2aef5e){_0xdfc347=_0xdfc347-0x0;var _0x247fd3=_0x813d[_0xdfc347];return _0x247fd3;};'use strict';var _=require(_0xd813('0x0'));var syncho=require(_0xd813('0x1'));var util=require(_0xd813('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xd813('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0xd813('0x4'));var Project=require(_0xd813('0x5'));var AGIEmitter=require(_0xd813('0x6'))[_0xd813('0x7')];var projects=[];config[_0xd813('0x3')]=_[_0xd813('0x8')](config[_0xd813('0x3')],{'ip':_0xd813('0x9'),'port':0x11dd});AGIEmitter['on'](_0xd813('0xa'),projectUpdateHandler);function connectionHandler(_0x8ed531){process[_0xd813('0xb')](function(){syncho(function(){try{setChannelVariables(_0x8ed531);agiHandler(_0x8ed531);}catch(_0x2d1510){logger[_0xd813('0xc')](_0x2d1510[_0xd813('0xd')]);}});});}function projectUpdateHandler(_0x1289f8){try{var _0x2cd896=_[_0xd813('0xe')](projects,['id',_0x1289f8['id']]);if(_0x2cd896>-0x1){if(_0x1289f8[_0xd813('0xf')]===!![]){projects[_0xd813('0x10')](_0x2cd896,0x1);}else{projects[_0x2cd896]=_0x1289f8;}}else{projects['push'](_0x1289f8);}}catch(_0x48397e){logger[_0xd813('0xc')](_0x48397e[_0xd813('0xd')]);}}function listeningHandler(){console[_0xd813('0x11')](_0xd813('0x12'),config[_0xd813('0x3')]['port']);logger[_0xd813('0x13')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xd813('0x3')]['ip'],config[_0xd813('0x3')][_0xd813('0x14')]));}function errorHandler(_0x43d020){if(_0x43d020&&_0x43d020[_0xd813('0x15')]&&_0x43d020['message']){logger[_0xd813('0xc')](util[_0xd813('0x16')]('[%s]\x20%s',_0x43d020[_0xd813('0x15')],_0x43d020[_0xd813('0x17')]));}else{logger[_0xd813('0xc')](util[_0xd813('0x16')](_0xd813('0x18'),_0x43d020[_0xd813('0xd')]));}}function closeHandler(){logger['info'](util[_0xd813('0x16')](_0xd813('0x19'),this[_0xd813('0x1a')],this[_0xd813('0x1b')],this[_0xd813('0x1c')],this[_0xd813('0x1d')],this[_0xd813('0x1e')]));try{createSquareReport(this);}catch(_0x534e3c){logger[_0xd813('0xc')](_0x534e3c[_0xd813('0xd')]);}}function timeoutHandler(){logger[_0xd813('0x13')](util[_0xd813('0x16')](_0xd813('0x1f'),this[_0xd813('0x1a')],this['calleridname'],this[_0xd813('0x1c')],this[_0xd813('0x1d')],this[_0xd813('0x1e')]));}function hangupHandler(){logger[_0xd813('0x13')](util['format'](_0xd813('0x20'),this[_0xd813('0x1a')],this[_0xd813('0x1b')],this[_0xd813('0x1c')],this['dnid'],this[_0xd813('0x1e')]));this[_0xd813('0x21')]=!![];}function createSquareReport(_0x30abfc,_0x5086e0){rpc[_0xd813('0x22')](_0x30abfc)[_0xd813('0x23')](function(_0xc4ffe4){if(_0x5086e0){_0x5086e0(null,_0xc4ffe4);}})[_0xd813('0x24')](function(_0x51c8af){if(_0x5086e0){_0x5086e0(null,_0x51c8af);}});}function setChannelVariables(_0xbcde04){for(var _0x4eddad in _0xbcde04){if(_0xbcde04[_0xd813('0x25')](_0x4eddad)){if(_0x4eddad[_0xd813('0x26')](_0xd813('0x27'))===0x0){_0xbcde04[_0x4eddad['substring'](0x4)]=_0xbcde04[_0x4eddad];delete _0xbcde04[_0x4eddad];}}}}function agiHandler(_0x10109c){logger['debug']('variables',JSON[_0xd813('0x28')](_0x10109c,null,0x2));logger[_0xd813('0x13')](util[_0xd813('0x16')](_0xd813('0x29'),_0x10109c['arg_1'],_0x10109c['calleridname'],_0x10109c[_0xd813('0x1c')],_0x10109c[_0xd813('0x1d')],_0x10109c['uniqueid']));_0x10109c['on']('error',errorHandler);_0x10109c['on'](_0xd813('0x2a'),closeHandler);_0x10109c['on'](_0xd813('0x2b'),timeoutHandler);_0x10109c[_0xd813('0x21')]=![];_0x10109c['on'](_0xd813('0x2c'),hangupHandler);var _0x3f3c76=_[_0xd813('0x2d')](projects,[_0xd813('0x15'),_0x10109c[_0xd813('0x1a')]]);if(!_0x3f3c76)return Project['handleNotFound'](_0x10109c);if(!_0x3f3c76['production'])return Project[_0xd813('0x2e')](_0x10109c);return Project[_0xd813('0x2f')](_0x3f3c76,_0x10109c);}function main(){var _0x73d72f;return utilLicense['getLicense']()['then'](function(_0x479af6){if(!_0x479af6)return;if(_0x479af6['voice']){if(_0x479af6[_0xd813('0x30')]&&_0x479af6[_0xd813('0x30')]>0x0){logger[_0xd813('0x13')](util['format'](_0xd813('0x31'),_0x479af6[_0xd813('0x30')]));_0x73d72f=_0x479af6[_0xd813('0x30')];}else{logger[_0xd813('0x13')](_0xd813('0x32'));}}else{logger[_0xd813('0x13')](_0xd813('0x33'));_0x73d72f=-0x1;}})['then'](function(){return Project[_0xd813('0x34')]();})['then'](function(_0x53489f){projects=_0x53489f;return;})[_0xd813('0x24')](function(_0x58373f){logger[_0xd813('0xc')]('[LICENSE]',_0x58373f[_0xd813('0xd')]);})[_0xd813('0x35')](function(){var _0x549a04=require(_0xd813('0x36'))(config[_0xd813('0x3')]['port'],config[_0xd813('0x3')]['ip'],_0x73d72f);_0x549a04['on'](_0xd813('0xc'),errorHandler);_0x549a04['on']('listening',listeningHandler);_0x549a04['on'](_0xd813('0x37'),connectionHandler);_0x549a04['on'](_0xd813('0x2a'),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 84adb18..f51e204 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 _0xb999=['http','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','client'];(function(_0x2f1a67,_0x544a01){var _0x35483b=function(_0x5df509){while(--_0x5df509){_0x2f1a67['push'](_0x2f1a67['shift']());}};_0x35483b(++_0x544a01);}(_0xb999,0x120));var _0x9b99=function(_0x28a98f,_0xa005e){_0x28a98f=_0x28a98f-0x0;var _0x4dd211=_0xb999[_0x28a98f];return _0x4dd211;};'use strict';var BPromise=require(_0x9b99('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x9b99('0x1')][_0x9b99('0x2')]({'port':0x232b});function request(_0x7da3d0,_0x509445){return new BPromise(function(_0x157249,_0x54f6cc){return client['request'](_0x7da3d0,_0x509445)[_0x9b99('0x3')](function(_0x15fbe1){if(_0x15fbe1['error']){return _0x54f6cc(_0x15fbe1[_0x9b99('0x4')][_0x9b99('0x5')]);}else{return _0x157249(_0x15fbe1[_0x9b99('0x6')]);}})[_0x9b99('0x7')](function(_0x201bb0){return _0x54f6cc(_0x201bb0);});});}exports[_0x9b99('0x8')]=function(_0x505ad5,_0x4b98ba){return request(_0x9b99('0x9'),{'account':_0x505ad5,'message':_0x4b98ba});}; \ No newline at end of file +var _0x4b2d=['jayson/promise','client','http','request','then','catch','sendMailMessage','bluebird'];(function(_0x4788ca,_0x5cda70){var _0x28a6f5=function(_0xa6db8){while(--_0xa6db8){_0x4788ca['push'](_0x4788ca['shift']());}};_0x28a6f5(++_0x5cda70);}(_0x4b2d,0x1bf));var _0xd4b2=function(_0x449b81,_0x4b2a6f){_0x449b81=_0x449b81-0x0;var _0xb9b60c=_0x4b2d[_0x449b81];return _0xb9b60c;};'use strict';var BPromise=require(_0xd4b2('0x0'));var jayson=require(_0xd4b2('0x1'));var client=jayson[_0xd4b2('0x2')][_0xd4b2('0x3')]({'port':0x232b});function request(_0x51172d,_0xefc7df){return new BPromise(function(_0x41e1e1,_0x2911c5){return client[_0xd4b2('0x4')](_0x51172d,_0xefc7df)[_0xd4b2('0x5')](function(_0x318324){if(_0x318324['error']){return _0x2911c5(_0x318324['error']['message']);}else{return _0x41e1e1(_0x318324['result']);}})[_0xd4b2('0x6')](function(_0x4fe1ab){return _0x2911c5(_0x4fe1ab);});});}exports[_0xd4b2('0x7')]=function(_0x5d7f84,_0x4b2c0f){return request('SendMail',{'account':_0x5d7f84,'message':_0x4b2c0f});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 2168096..c1b23c4 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 _0x03ee=['omit','isArray','length','target','addEdge','mxGraphModel','root','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','uniqueid','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','code','result','isUndefined','agicommand\x20not\x20found','finally','calleridname','dnid','traverseBFS','toString','[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','extension','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash','moment','xml2json','util','../../config/logger','agi','./graph','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x03ee,0x1b2));var _0xe03e=function(_0x2041a4,_0x55946d){_0x2041a4=_0x2041a4-0x0;var _0x5464b8=_0x03ee[_0x2041a4];return _0x5464b8;};'use strict';var _=require(_0xe03e('0x0'));var moment=require(_0xe03e('0x1'));var parser=require(_0xe03e('0x2'));var util=require(_0xe03e('0x3'));var logger=require(_0xe03e('0x4'))(_0xe03e('0x5'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xe03e('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe03e('0x7')]()['catch'](function(_0x25017b){logger[_0xe03e('0x8')](_0xe03e('0x9'),_0x25017b[_0xe03e('0xa')]);return[];});}function addVertex(_0x5183e2,_0xb443e8,_0x13febf){_0xb443e8[_0xe03e('0xb')]=_0x13febf;if(_0xb443e8[_0xe03e('0xc')](_0xe03e('0xd'))){_0xb443e8['maxRetry']=parseInt(_0xb443e8[_0xe03e('0xd')],0xa);}_0x5183e2['addVertex'](_[_0xe03e('0xe')](_0xb443e8,'mxCell'));}function initGraph(_0x1d6287,_0x4fe4bb){var _0x1635de=new Graph();for(var _0x2d8ea4 in _0x1d6287){if(_0x1d6287[_0xe03e('0xc')](_0x2d8ea4)){if(_[_0xe03e('0xf')](_0x1d6287[_0x2d8ea4])){for(var _0x4bc5f7=0x0;_0x4bc5f7<_0x1d6287[_0x2d8ea4][_0xe03e('0x10')];_0x4bc5f7+=0x1){addVertex(_0x1635de,_0x1d6287[_0x2d8ea4][_0x4bc5f7],_0x2d8ea4);}}else{addVertex(_0x1635de,_0x1d6287[_0x2d8ea4],_0x2d8ea4);}}}for(var _0x3800ea=0x0;_0x3800ea<_0x4fe4bb['length'];_0x3800ea+=0x1){if(_0x4fe4bb[_0x3800ea]['source']&&_0x4fe4bb[_0x3800ea][_0xe03e('0x11')]){_0x1635de[_0xe03e('0x12')](_0x4fe4bb[_0x3800ea]['source'],_0x4fe4bb[_0x3800ea]['target'],_0x4fe4bb[_0x3800ea]['value']);}}return _0x1635de;}function getRoot(_0xfdcb2){return parser['toJson'](_0xfdcb2,{'object':!![]})[_0xe03e('0x13')][_0xe03e('0x14')];}function inspect(_0x1fbada){return util['inspect'](_0x1fbada,{'showHidden':![],'depth':null});}function initialize(_0x34d023,_0x20631a){var _0x30807b=getRoot(_0x34d023[_0xe03e('0x15')]);if(!_0x30807b||!_0x30807b[_0xe03e('0x16')])return;var _0x122bb2,_0x4195bb,_0x197c23;logger[_0xe03e('0x17')](_0xe03e('0x14'),JSON[_0xe03e('0x18')](_0x30807b,null,0x2));_0x20631a[_0xe03e('0x19')]=moment()[_0xe03e('0x1a')](_0xe03e('0x1b'));_0x122bb2=initGraph(_[_0xe03e('0xe')](_0x30807b,'mxCell'),_0x30807b[_0xe03e('0x1c')]);_0x4195bb=new Vertices(_0x20631a,rpc,mailRpc);logger[_0xe03e('0x1d')](util[_0xe03e('0x1a')](_0xe03e('0x1e'),_0x20631a[_0xe03e('0x1f')],_0x20631a['calleridname'],_0x20631a[_0xe03e('0x20')],_0x20631a['dnid'],_0x20631a[_0xe03e('0x21')]));_0x122bb2['traverseBFS'](_0x30807b['start']['id'],function(_0x7641cf){try{_0x7641cf=_0x4195bb['clear'](_0x7641cf);logger[_0xe03e('0x17')](_0xe03e('0x22'),JSON[_0xe03e('0x18')](_0x7641cf,null,0x2));if(_0x7641cf[_0xe03e('0xb')]===_0xe03e('0x23')){logger[_0xe03e('0x1d')](_0xe03e('0x24'));_0x20631a[_0xe03e('0x25')]=_0x7641cf[_0xe03e('0x25')]||_0x20631a[_0xe03e('0x25')];_0x20631a['extension']=_0x7641cf['extension'];_0x20631a[_0xe03e('0x26')]=_0x7641cf[_0xe03e('0x26')]?_0x7641cf['priority']-0x1:0x1;return null;}else if(_0x7641cf&&_0x4195bb[_0x7641cf[_0xe03e('0xb')]]){_0x197c23=_0x4195bb[_0x7641cf[_0xe03e('0xb')]](_0x7641cf);logger[_0xe03e('0x1d')](_0xe03e('0x27'),JSON[_0xe03e('0x18')](_0x197c23,null,0x2));if(_0x197c23&&_0x197c23[_0xe03e('0x28')]===AGI_CODE_SUCCESS&&_0x197c23[_0xe03e('0x29')]!==AGI_RESULT_ERROR&&!_0x20631a['evtHangup']){logger['debug'](_0xe03e('0x27'),inspect(_0x197c23));return _[_0xe03e('0x2a')](_0x197c23['result'])?null:_0x197c23['result']['toString']();}else{logger[_0xe03e('0x8')](_0xe03e('0x27'),inspect(_0x197c23));return null;}}else{logger[_0xe03e('0x8')](_0xe03e('0x2b'));return null;}}catch(_0x211a42){logger['error'](_0x211a42['stack']);return null;}});if(_0x30807b[_0xe03e('0x2c')]){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x20631a[_0xe03e('0x1f')],_0x20631a[_0xe03e('0x2d')],_0x20631a['callerid'],_0x20631a[_0xe03e('0x2e')],_0x20631a['uniqueid']));_0x122bb2[_0xe03e('0x2f')](_0x30807b[_0xe03e('0x2c')]['id'],function(_0x180808){try{_0x180808=_0x4195bb['clear'](_0x180808);logger[_0xe03e('0x17')](_0xe03e('0x22'),JSON[_0xe03e('0x18')](_0x180808,null,0x2));if(_0x180808&&_0x4195bb[_0x180808[_0xe03e('0xb')]]){_0x197c23=_0x4195bb[_0x180808[_0xe03e('0xb')]](_0x180808);if(_0x197c23){logger[_0xe03e('0x17')](_0xe03e('0x27'),inspect(_0x197c23));return _['isUndefined'](_0x197c23[_0xe03e('0x29')])?null:_0x197c23[_0xe03e('0x29')][_0xe03e('0x30')]();}else{logger[_0xe03e('0x8')](_0xe03e('0x27'),inspect(_0x197c23));return null;}}else{logger[_0xe03e('0x8')](_0xe03e('0x2b'));return null;}}catch(_0x4781b6){logger[_0xe03e('0x8')](_0x4781b6['stack']);return null;}});}logger['info'](util[_0xe03e('0x1a')](_0xe03e('0x31'),_0x20631a[_0xe03e('0x1f')],_0x20631a['calleridname'],_0x20631a[_0xe03e('0x20')],_0x20631a[_0xe03e('0x2e')],_0x20631a[_0xe03e('0x21')]));logger['info'](util['format'](_0xe03e('0x32'),_0x20631a['context'],_0x20631a[_0xe03e('0x33')],parseInt(_0x20631a[_0xe03e('0x26')],0xa)+0x1));_0x20631a[_0xe03e('0x34')](_0x20631a[_0xe03e('0x25')],_0x20631a['extension'],parseInt(_0x20631a[_0xe03e('0x26')],0xa)+0x1);_0x20631a[_0xe03e('0x35')]();}function handleNotFound(_0x3fb64a){logger[_0xe03e('0x8')](util[_0xe03e('0x1a')](_0xe03e('0x36'),_0x3fb64a['arg_1']));_0x3fb64a[_0xe03e('0x34')](_0x3fb64a['context'],_0x3fb64a[_0xe03e('0x33')],parseInt(_0x3fb64a[_0xe03e('0x26')],0xa)+0x1);_0x3fb64a[_0xe03e('0x35')]();}function handleUnpublished(_0x4c73e1){logger[_0xe03e('0x8')](util[_0xe03e('0x1a')](_0xe03e('0x37'),_0x4c73e1[_0xe03e('0x1f')]));_0x4c73e1[_0xe03e('0x34')](_0x4c73e1[_0xe03e('0x25')],_0x4c73e1['extension'],parseInt(_0x4c73e1[_0xe03e('0x26')],0xa)+0x1);_0x4c73e1[_0xe03e('0x35')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xc243=['util','agi','./rpc','./mailRpc','getSquareProjects','catch','stack','agicommand','retry','addVertex','omit','hasOwnProperty','isArray','length','source','target','value','toJson','root','inspect','production','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','traverseBFS','start','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','toString','error','agicommand\x20not\x20found','finally','dnid','uniqueid','vertex','[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','close','Project\x20%s\x20not\x20found','exports','lodash','xml2json'];(function(_0x40d339,_0xb726c3){var _0x5cbd0b=function(_0xf239d3){while(--_0xf239d3){_0x40d339['push'](_0x40d339['shift']());}};_0x5cbd0b(++_0xb726c3);}(_0xc243,0xb2));var _0x3c24=function(_0x133fe4,_0x1f473b){_0x133fe4=_0x133fe4-0x0;var _0x4c4017=_0xc243[_0x133fe4];return _0x4c4017;};'use strict';var _=require(_0x3c24('0x0'));var moment=require('moment');var parser=require(_0x3c24('0x1'));var util=require(_0x3c24('0x2'));var logger=require('../../config/logger')(_0x3c24('0x3'));var rpc=require(_0x3c24('0x4'));var mailRpc=require(_0x3c24('0x5'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x3c24('0x6')]()[_0x3c24('0x7')](function(_0x2ad3f4){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x2ad3f4[_0x3c24('0x8')]);return[];});}function addVertex(_0x1c8331,_0x287286,_0x15452b){_0x287286[_0x3c24('0x9')]=_0x15452b;if(_0x287286['hasOwnProperty'](_0x3c24('0xa'))){_0x287286['maxRetry']=parseInt(_0x287286[_0x3c24('0xa')],0xa);}_0x1c8331[_0x3c24('0xb')](_[_0x3c24('0xc')](_0x287286,'mxCell'));}function initGraph(_0xab7b9c,_0x1875c8){var _0x15d1a6=new Graph();for(var _0x482ea6 in _0xab7b9c){if(_0xab7b9c[_0x3c24('0xd')](_0x482ea6)){if(_[_0x3c24('0xe')](_0xab7b9c[_0x482ea6])){for(var _0x58131b=0x0;_0x58131b<_0xab7b9c[_0x482ea6][_0x3c24('0xf')];_0x58131b+=0x1){addVertex(_0x15d1a6,_0xab7b9c[_0x482ea6][_0x58131b],_0x482ea6);}}else{addVertex(_0x15d1a6,_0xab7b9c[_0x482ea6],_0x482ea6);}}}for(var _0x367103=0x0;_0x367103<_0x1875c8[_0x3c24('0xf')];_0x367103+=0x1){if(_0x1875c8[_0x367103][_0x3c24('0x10')]&&_0x1875c8[_0x367103][_0x3c24('0x11')]){_0x15d1a6['addEdge'](_0x1875c8[_0x367103][_0x3c24('0x10')],_0x1875c8[_0x367103][_0x3c24('0x11')],_0x1875c8[_0x367103][_0x3c24('0x12')]);}}return _0x15d1a6;}function getRoot(_0x5b36a8){return parser[_0x3c24('0x13')](_0x5b36a8,{'object':!![]})['mxGraphModel'][_0x3c24('0x14')];}function inspect(_0x175740){return util[_0x3c24('0x15')](_0x175740,{'showHidden':![],'depth':null});}function initialize(_0x57955e,_0x1d262b){var _0x3dff52=getRoot(_0x57955e[_0x3c24('0x16')]);if(!_0x3dff52||!_0x3dff52['start'])return;var _0x436d91,_0x172949,_0x1d9daa;logger[_0x3c24('0x17')](_0x3c24('0x14'),JSON[_0x3c24('0x18')](_0x3dff52,null,0x2));_0x1d262b[_0x3c24('0x19')]=moment()[_0x3c24('0x1a')](_0x3c24('0x1b'));_0x436d91=initGraph(_[_0x3c24('0xc')](_0x3dff52,'mxCell'),_0x3dff52[_0x3c24('0x1c')]);_0x172949=new Vertices(_0x1d262b,rpc,mailRpc);logger[_0x3c24('0x1d')](util[_0x3c24('0x1a')](_0x3c24('0x1e'),_0x1d262b[_0x3c24('0x1f')],_0x1d262b[_0x3c24('0x20')],_0x1d262b[_0x3c24('0x21')],_0x1d262b['dnid'],_0x1d262b['uniqueid']));_0x436d91[_0x3c24('0x22')](_0x3dff52[_0x3c24('0x23')]['id'],function(_0x3428e7){try{_0x3428e7=_0x172949[_0x3c24('0x24')](_0x3428e7);logger[_0x3c24('0x17')]('vertex',JSON[_0x3c24('0x18')](_0x3428e7,null,0x2));if(_0x3428e7['agicommand']===_0x3c24('0x25')){logger['info'](_0x3c24('0x26'));_0x1d262b[_0x3c24('0x27')]=_0x3428e7[_0x3c24('0x27')]||_0x1d262b[_0x3c24('0x27')];_0x1d262b[_0x3c24('0x28')]=_0x3428e7['extension'];_0x1d262b[_0x3c24('0x29')]=_0x3428e7[_0x3c24('0x29')]?_0x3428e7['priority']-0x1:0x1;return null;}else if(_0x3428e7&&_0x172949[_0x3428e7[_0x3c24('0x9')]]){_0x1d9daa=_0x172949[_0x3428e7[_0x3c24('0x9')]](_0x3428e7);logger['info'](_0x3c24('0x2a'),JSON[_0x3c24('0x18')](_0x1d9daa,null,0x2));if(_0x1d9daa&&_0x1d9daa[_0x3c24('0x2b')]===AGI_CODE_SUCCESS&&_0x1d9daa['result']!==AGI_RESULT_ERROR&&!_0x1d262b[_0x3c24('0x2c')]){logger[_0x3c24('0x17')](_0x3c24('0x2a'),inspect(_0x1d9daa));return _[_0x3c24('0x2d')](_0x1d9daa[_0x3c24('0x2e')])?null:_0x1d9daa[_0x3c24('0x2e')][_0x3c24('0x2f')]();}else{logger[_0x3c24('0x30')](_0x3c24('0x2a'),inspect(_0x1d9daa));return null;}}else{logger[_0x3c24('0x30')](_0x3c24('0x31'));return null;}}catch(_0x4c385a){logger[_0x3c24('0x30')](_0x4c385a['stack']);return null;}});if(_0x3dff52[_0x3c24('0x32')]){logger[_0x3c24('0x1d')](util[_0x3c24('0x1a')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1d262b[_0x3c24('0x1f')],_0x1d262b[_0x3c24('0x20')],_0x1d262b[_0x3c24('0x21')],_0x1d262b[_0x3c24('0x33')],_0x1d262b[_0x3c24('0x34')]));_0x436d91['traverseBFS'](_0x3dff52[_0x3c24('0x32')]['id'],function(_0x1d568a){try{_0x1d568a=_0x172949[_0x3c24('0x24')](_0x1d568a);logger[_0x3c24('0x17')](_0x3c24('0x35'),JSON[_0x3c24('0x18')](_0x1d568a,null,0x2));if(_0x1d568a&&_0x172949[_0x1d568a[_0x3c24('0x9')]]){_0x1d9daa=_0x172949[_0x1d568a[_0x3c24('0x9')]](_0x1d568a);if(_0x1d9daa){logger[_0x3c24('0x17')](_0x3c24('0x2a'),inspect(_0x1d9daa));return _[_0x3c24('0x2d')](_0x1d9daa[_0x3c24('0x2e')])?null:_0x1d9daa['result']['toString']();}else{logger[_0x3c24('0x30')](_0x3c24('0x2a'),inspect(_0x1d9daa));return null;}}else{logger[_0x3c24('0x30')](_0x3c24('0x31'));return null;}}catch(_0x2120e2){logger[_0x3c24('0x30')](_0x2120e2[_0x3c24('0x8')]);return null;}});}logger['info'](util['format'](_0x3c24('0x36'),_0x1d262b[_0x3c24('0x1f')],_0x1d262b[_0x3c24('0x20')],_0x1d262b['callerid'],_0x1d262b[_0x3c24('0x33')],_0x1d262b['uniqueid']));logger[_0x3c24('0x1d')](util[_0x3c24('0x1a')](_0x3c24('0x37'),_0x1d262b[_0x3c24('0x27')],_0x1d262b[_0x3c24('0x28')],parseInt(_0x1d262b[_0x3c24('0x29')],0xa)+0x1));_0x1d262b[_0x3c24('0x38')](_0x1d262b['context'],_0x1d262b[_0x3c24('0x28')],parseInt(_0x1d262b[_0x3c24('0x29')],0xa)+0x1);_0x1d262b[_0x3c24('0x39')]();}function handleNotFound(_0x686c61){logger[_0x3c24('0x30')](util[_0x3c24('0x1a')](_0x3c24('0x3a'),_0x686c61[_0x3c24('0x1f')]));_0x686c61[_0x3c24('0x38')](_0x686c61[_0x3c24('0x27')],_0x686c61[_0x3c24('0x28')],parseInt(_0x686c61[_0x3c24('0x29')],0xa)+0x1);_0x686c61[_0x3c24('0x39')]();}function handleUnpublished(_0x5401de){logger[_0x3c24('0x30')](util[_0x3c24('0x1a')]('Project\x20%s\x20not\x20published',_0x5401de[_0x3c24('0x1f')]));_0x5401de[_0x3c24('0x38')](_0x5401de[_0x3c24('0x27')],_0x5401de['extension'],parseInt(_0x5401de['priority'],0xa)+0x1);_0x5401de[_0x3c24('0x39')]();}module[_0x3c24('0x3b')]={'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 4721db8..26f6473 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 _0x0901=['trim','length','emit','line','util','stream','Transform','call','_localBuffer','prototype','_transform','_inBody','indexOf','substring','split','slice'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x0901,0x134));var _0x1090=function(_0x5122e2,_0x18df0a){_0x5122e2=_0x5122e2-0x0;var _0x48858e=_0x0901[_0x5122e2];return _0x48858e;};'use strict';var util=require(_0x1090('0x0'));var Transform=require(_0x1090('0x1'))[_0x1090('0x2')];function AGIReply(_0x39882a){Transform[_0x1090('0x3')](this,_0x39882a);this[_0x1090('0x4')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x1090('0x5')][_0x1090('0x6')]=function(_0x3ead6b,_0xf21ed0,_0x9a1121){var _0x395921='\x0a',_0x4c4e89=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x3f569b=-0x1,_0x3c1afe=-0x1,_0x5cd3f0='',_0x3d2f8a=0x0,_0x160356='',_0x2c42b1='';this['_localBuffer']+=_0x3ead6b['toString']();_0x160356=this[_0x1090('0x4')];if(!this[_0x1090('0x7')]){_0x3d2f8a=0x0;while(_0x4c4e89[_0x3d2f8a]){while((_0x3c1afe=_0x160356[_0x1090('0x8')](_0x4c4e89[_0x3d2f8a]))!=-0x1){_0x5cd3f0=_0x4c4e89[_0x3d2f8a];_0x2c42b1=_0x160356['substring'](0x0,_0x3c1afe);_0x160356=_0x160356[_0x1090('0x9')](_0x3c1afe+_0x5cd3f0['length']);var _0x5b653b=_0x2c42b1[_0x1090('0xa')](_0x395921),_0x2c7130=0x0,_0x1693a1={},_0x43f1b6='',_0x2c0afa='',_0x4250c6=-0x1;while(_0x5b653b[_0x2c7130]){_0x4250c6=_0x5b653b[_0x2c7130][_0x1090('0x8')](':');if(_0x4250c6!=-0x1){_0x43f1b6=_0x5b653b[_0x2c7130][_0x1090('0xb')](0x0,_0x4250c6)[_0x1090('0xc')]();_0x2c0afa=_0x5b653b[_0x2c7130][_0x1090('0xb')](_0x4250c6+0x1)[_0x1090('0xc')]();if(_0x43f1b6[_0x1090('0xd')]>0x0){_0x1693a1[_0x43f1b6]=_0x2c0afa;}}else{}_0x2c7130++;}this[_0x1090('0xe')]('headers',_0x1693a1);this[_0x1090('0x7')]=!![];}_0x3d2f8a++;}this[_0x1090('0x4')]=_0x160356;}else{while((_0x3f569b=_0x160356[_0x1090('0x8')](_0x395921))!=-0x1){_0x2c42b1=_0x160356['substring'](0x0,_0x3f569b);this[_0x1090('0xe')](_0x1090('0xf'),_0x2c42b1);_0x160356=_0x160356[_0x1090('0x9')](_0x3f569b+_0x395921[_0x1090('0xd')]);}this[_0x1090('0x4')]=_0x160356;}_0x9a1121();};module['exports']=AGIReply; \ No newline at end of file +var _0x4754=['substring','length','slice','emit','line','exports','Transform','call','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','indexOf'];(function(_0x3e852d,_0x3cd628){var _0x2f1a81=function(_0xbc2bbd){while(--_0xbc2bbd){_0x3e852d['push'](_0x3e852d['shift']());}};_0x2f1a81(++_0x3cd628);}(_0x4754,0x1d4));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var Transform=require('stream')[_0x4475('0x0')];function AGIReply(_0x54d279){Transform[_0x4475('0x1')](this,_0x54d279);this['_localBuffer']='';this[_0x4475('0x2')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x4475('0x3')][_0x4475('0x4')]=function(_0x24e26c,_0x412478,_0x28c3b6){var _0x3b5300='\x0a',_0x4f10b0=['\x0a\x0a',_0x4475('0x5')],_0x3968fe=-0x1,_0x751375=-0x1,_0x52103d='',_0x2fe2c9=0x0,_0x1db9f2='',_0x3ffe94='';this['_localBuffer']+=_0x24e26c['toString']();_0x1db9f2=this[_0x4475('0x6')];if(!this['_inBody']){_0x2fe2c9=0x0;while(_0x4f10b0[_0x2fe2c9]){while((_0x751375=_0x1db9f2[_0x4475('0x7')](_0x4f10b0[_0x2fe2c9]))!=-0x1){_0x52103d=_0x4f10b0[_0x2fe2c9];_0x3ffe94=_0x1db9f2['substring'](0x0,_0x751375);_0x1db9f2=_0x1db9f2[_0x4475('0x8')](_0x751375+_0x52103d[_0x4475('0x9')]);var _0x453d84=_0x3ffe94['split'](_0x3b5300),_0x3f7e62=0x0,_0x5d9183={},_0x5bab57='',_0x29b558='',_0x105924=-0x1;while(_0x453d84[_0x3f7e62]){_0x105924=_0x453d84[_0x3f7e62]['indexOf'](':');if(_0x105924!=-0x1){_0x5bab57=_0x453d84[_0x3f7e62][_0x4475('0xa')](0x0,_0x105924)['trim']();_0x29b558=_0x453d84[_0x3f7e62][_0x4475('0xa')](_0x105924+0x1)['trim']();if(_0x5bab57[_0x4475('0x9')]>0x0){_0x5d9183[_0x5bab57]=_0x29b558;}}else{}_0x3f7e62++;}this[_0x4475('0xb')]('headers',_0x5d9183);this[_0x4475('0x2')]=!![];}_0x2fe2c9++;}this[_0x4475('0x6')]=_0x1db9f2;}else{while((_0x3968fe=_0x1db9f2['indexOf'](_0x3b5300))!=-0x1){_0x3ffe94=_0x1db9f2['substring'](0x0,_0x3968fe);this['emit'](_0x4475('0xc'),_0x3ffe94);_0x1db9f2=_0x1db9f2[_0x4475('0x8')](_0x3968fe+_0x3b5300[_0x4475('0x9')]);}this['_localBuffer']=_0x1db9f2;}_0x28c3b6();};module[_0x4475('0xd')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 69ecab4..5b26cbd 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 _0x383d=['save_name','Interval','Intervals','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','jayson/promise','client','http','request','then','error','message','result','catch','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','getSquareProjectById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById'];(function(_0x59ba05,_0x3248b0){var _0x413f12=function(_0x226f49){while(--_0x226f49){_0x59ba05['push'](_0x59ba05['shift']());}};_0x413f12(++_0x3248b0);}(_0x383d,0x86));var _0xd383=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x383d[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0xd383('0x0'));var client=jayson[_0xd383('0x1')][_0xd383('0x2')]({'port':0x2329});function request(_0x559dd3,_0x7554ef){return new Promise(function(_0x229076,_0x319f67){return client[_0xd383('0x3')](_0x559dd3,_0x7554ef)[_0xd383('0x4')](function(_0x43ab08){if(_0x43ab08['error']){return _0x319f67(_0x43ab08[_0xd383('0x5')][_0xd383('0x6')]);}else{return _0x229076(_0x43ab08[_0xd383('0x7')]);}})[_0xd383('0x8')](function(_0xffa778){return _0x319f67(_0xffa778);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xd383('0x9'),_0xd383('0xa')]}});};exports['getSquareProject']=function(_0x2abc3a){return request(_0xd383('0xb'),{'options':{'raw':![],'where':{'name':_0x2abc3a},'attributes':[_0xd383('0xa')]}});};exports[_0xd383('0xc')]=function(_0x3f6155){return request(_0xd383('0xd'),{'options':{'raw':![],'where':{'id':_0x3f6155},'include':[{'model':'MailServerOut','as':_0xd383('0xe'),'include':[{'model':_0xd383('0xf'),'as':_0xd383('0xf')}]}],'attributes':['id',_0xd383('0x9'),'email'],'smtp':!![]}});};exports[_0xd383('0x10')]=function(_0x23fecb){return request(_0xd383('0xb'),{'options':{'where':{'id':_0x23fecb},'attributes':[_0xd383('0x9')]}});};exports['getVoiceQueueById']=function(_0x39985a){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x39985a},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x11')]=function(_0xf2dcb6){return request(_0xd383('0x12'),{'options':{'where':{'id':_0xf2dcb6},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x13')]=function(_0x5359c6){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5359c6},'attributes':[_0xd383('0x14')]}});};exports[_0xd383('0x15')]=function(_0x8639e8){return request(_0xd383('0x16'),{'options':{'where':{'id':_0x8639e8},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x17')]=function(_0x21d2ed){return request(_0xd383('0x18'),{'options':{'where':{'phone':_0x21d2ed['phone']},'attributes':['id']}});};exports[_0xd383('0x19')]=function(_0x3714c8){return request(_0xd383('0x1a'),{'options':{'where':{'id':_0x3714c8},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x1b')]=function(_0x3618d9){return request('ShowSound',{'options':{'where':{'id':_0x3618d9},'attributes':[_0xd383('0x1c')]}});};exports['getIntervalById']=function(_0x1a8e78){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1a8e78},'include':[{'model':_0xd383('0x1d'),'as':_0xd383('0x1e')}]}});};exports['getSmsAccountById']=function(_0x10c054){return request(_0xd383('0x1f'),{'options':{'where':{'id':_0x10c054},'attributes':['id',_0xd383('0x9')]}});};exports['createSmsMessage']=function(_0x48d34b){return request(_0xd383('0x20'),{'body':_0x48d34b});};exports['createSquareDetailsReport']=function(_0x58bf08){return request(_0xd383('0x21'),{'body':_0x58bf08});};exports['createSquareReport']=function(_0xdc2c45){return request('CreateSquareReport',{'body':_['merge'](_0xdc2c45,{'project_name':_0xdc2c45['arg_1'],'prev_project_name':_0xdc2c45[_0xd383('0x22')]||'','is_subproject':_0xdc2c45[_0xd383('0x22')]?!![]:![],'leaveAt':moment()[_0xd383('0x23')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xd383('0x24')]=function(_0x2b3ab6){return request(_0xd383('0x25'),{'body':_0x2b3ab6});};exports[_0xd383('0x26')]=function(_0x27750a){return request(_0xd383('0x27'),{'body':_0x27750a});};exports[_0xd383('0x28')]=function(_0x208247){return request(_0xd383('0x29'),{'options':{'raw':![],'where':{'phone':_0x208247['phone'],'ListId':_0x208247[_0xd383('0x2a')]}}})[_0xd383('0x4')](function(_0x13924e){if(_0x13924e){return _0x13924e;}return request(_0xd383('0x2b'),{'body':_0x208247});});};exports[_0xd383('0x2c')]=function(_0x16be76){return request(_0xd383('0x2d'),{'options':{'where':{'id':_0x16be76},'attributes':[_0xd383('0x9')]}});};exports[_0xd383('0x2e')]=function(_0xcea4cf,_0x1f87da){return request(_0xd383('0x2f'),{'body':{'interface':_0x1f87da},'options':{'where':_0xcea4cf}});};exports[_0xd383('0x30')]=function(_0x4284dd,_0x15b20b,_0x5a2cc5){return request(_0xd383('0x31'),{'body':{'type':_0x15b20b,'uniqueid':_0x5a2cc5},'options':{'where':_0x4284dd}});};exports[_0xd383('0x32')]=function(_0x12f159){return request(_0xd383('0x33'),{'body':{},'options':{'where':_0x12f159}});};exports[_0xd383('0x34')]=function(_0x18f305){return request(_0xd383('0x35'),{'body':{},'options':{'where':_0x18f305}});}; \ No newline at end of file +var _0x7341=['ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','ShowTrunk','getSoundById','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','jayson/promise','http','request','then','error','result','catch','GetSquareProjects','getSquareProject','ShowSquareProject','production','getMailAccountById'];(function(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0x7341,0xe4));var _0x1734=function(_0x50734f,_0x2bdf65){_0x50734f=_0x50734f-0x0;var _0x2722f9=_0x7341[_0x50734f];return _0x2722f9;};'use strict';var _=require('lodash');var moment=require('moment');var jayson=require(_0x1734('0x0'));var client=jayson['client'][_0x1734('0x1')]({'port':0x2329});function request(_0x36397c,_0x47c889){return new Promise(function(_0x3bf99a,_0x42c26d){return client[_0x1734('0x2')](_0x36397c,_0x47c889)[_0x1734('0x3')](function(_0x2de514){if(_0x2de514[_0x1734('0x4')]){return _0x42c26d(_0x2de514[_0x1734('0x4')]['message']);}else{return _0x3bf99a(_0x2de514[_0x1734('0x5')]);}})[_0x1734('0x6')](function(_0x45c529){return _0x42c26d(_0x45c529);});});}exports['getSquareProjects']=function(){return request(_0x1734('0x7'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x1734('0x8')]=function(_0xcf0632){return request(_0x1734('0x9'),{'options':{'raw':![],'where':{'name':_0xcf0632},'attributes':[_0x1734('0xa')]}});};exports[_0x1734('0xb')]=function(_0x22afe0){return request(_0x1734('0xc'),{'options':{'raw':![],'where':{'id':_0x22afe0},'include':[{'model':_0x1734('0xd'),'as':_0x1734('0xe'),'include':[{'model':_0x1734('0xf'),'as':'CloudProvider'}]}],'attributes':['id',_0x1734('0x10'),_0x1734('0x11')],'smtp':!![]}});};exports[_0x1734('0x12')]=function(_0xcf880f){return request(_0x1734('0x9'),{'options':{'where':{'id':_0xcf880f},'attributes':[_0x1734('0x10')]}});};exports[_0x1734('0x13')]=function(_0xd2f288){return request(_0x1734('0x14'),{'options':{'where':{'id':_0xd2f288},'attributes':[_0x1734('0x10')]}});};exports[_0x1734('0x15')]=function(_0x27679e){return request(_0x1734('0x16'),{'options':{'where':{'id':_0x27679e},'attributes':[_0x1734('0x10')]}});};exports[_0x1734('0x17')]=function(_0x24bbf3){return request(_0x1734('0x18'),{'options':{'where':{'id':_0x24bbf3},'attributes':[_0x1734('0x19')]}});};exports[_0x1734('0x1a')]=function(_0x56756c){return request('ShowUser',{'options':{'where':{'id':_0x56756c},'attributes':[_0x1734('0x10')]}});};exports[_0x1734('0x1b')]=function(_0x4a86d1){return request(_0x1734('0x1c'),{'options':{'where':{'phone':_0x4a86d1['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x5b2789){return request(_0x1734('0x1d'),{'options':{'where':{'id':_0x5b2789},'attributes':['name']}});};exports[_0x1734('0x1e')]=function(_0xc4b4cc){return request('ShowSound',{'options':{'where':{'id':_0xc4b4cc},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x1e7401){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x1e7401},'include':[{'model':_0x1734('0x1f'),'as':'Intervals'}]}});};exports[_0x1734('0x20')]=function(_0x42485f){return request(_0x1734('0x21'),{'options':{'where':{'id':_0x42485f},'attributes':['id',_0x1734('0x10')]}});};exports[_0x1734('0x22')]=function(_0x45593e){return request(_0x1734('0x23'),{'body':_0x45593e});};exports[_0x1734('0x24')]=function(_0x2891bb){return request('CreateSquareDetailsReport',{'body':_0x2891bb});};exports[_0x1734('0x25')]=function(_0x568e0c){return request('CreateSquareReport',{'body':_[_0x1734('0x26')](_0x568e0c,{'project_name':_0x568e0c[_0x1734('0x27')],'prev_project_name':_0x568e0c[_0x1734('0x28')]||'','is_subproject':_0x568e0c[_0x1734('0x28')]?!![]:![],'leaveAt':moment()[_0x1734('0x29')](_0x1734('0x2a'))})});};exports[_0x1734('0x2b')]=function(_0x27d6e5){return request('CreateSquareRecording',{'body':_0x27d6e5});};exports[_0x1734('0x2c')]=function(_0x52eaf5){return request(_0x1734('0x2d'),{'body':_0x52eaf5});};exports[_0x1734('0x2e')]=function(_0xfca2ad){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xfca2ad[_0x1734('0x2f')],'ListId':_0xfca2ad[_0x1734('0x30')]}}})[_0x1734('0x3')](function(_0x50efce){if(_0x50efce){return _0x50efce;}return request(_0x1734('0x31'),{'body':_0xfca2ad});});};exports[_0x1734('0x32')]=function(_0x5594c0){return request(_0x1734('0x33'),{'options':{'where':{'id':_0x5594c0},'attributes':[_0x1734('0x10')]}});};exports[_0x1734('0x34')]=function(_0xf3d22e,_0x4f4d92){return request(_0x1734('0x35'),{'body':{'interface':_0x4f4d92},'options':{'where':_0xf3d22e}});};exports[_0x1734('0x36')]=function(_0x546a94,_0x4dd04a,_0x321718){return request(_0x1734('0x37'),{'body':{'type':_0x4dd04a,'uniqueid':_0x321718},'options':{'where':_0x546a94}});};exports[_0x1734('0x38')]=function(_0x3903a7){return request(_0x1734('0x39'),{'body':{},'options':{'where':_0x3903a7}});};exports[_0x1734('0x3a')]=function(_0x3ba024){return request(_0x1734('0x3b'),{'body':{},'options':{'where':_0x3ba024}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index 28cfe96..da7d733 100644 --- a/server/services/agi/scripts/aws/index.js +++ b/server/services/agi/scripts/aws/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5334=['./polly','./lex','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5334,0x84));var _0x4533=function(_0x2d8c90,_0xebac28){_0x2d8c90=_0x2d8c90-0x0;var _0x118c87=_0x5334[_0x2d8c90];return _0x118c87;};var polly=require(_0x4533('0x0'));var lex=require(_0x4533('0x1'));module[_0x4533('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index c77162a..7b7229a 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 _0x2750=['./lib/api'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x2750,0x13b));var _0x0275=function(_0x21ab61,_0x1c9cb8){_0x21ab61=_0x21ab61-0x0;var _0xb5735b=_0x2750[_0x21ab61];return _0xb5735b;};'use strict';var lex=require(_0x0275('0x0'));module['exports']=function(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06){return lex(_0xf4568,_0xf2ae71,_0x372744,_0x429a37,_0x101b26,_0x41ec06);}; \ No newline at end of file +var _0x91a7=['exports'];(function(_0x41974d,_0x1e20a0){var _0x1985de=function(_0x41c676){while(--_0x41c676){_0x41974d['push'](_0x41974d['shift']());}};_0x1985de(++_0x1e20a0);}(_0x91a7,0xe7));var _0x791a=function(_0x49372a,_0x2970c8){_0x49372a=_0x49372a-0x0;var _0x2b8144=_0x91a7[_0x49372a];return _0x2b8144;};'use strict';var lex=require('./lib/api');module[_0x791a('0x0')]=function(_0x3d6eab,_0x268862,_0x5d2796,_0x415994,_0x5b6f78,_0x2f6392){return lex(_0x3d6eab,_0x268862,_0x5d2796,_0x415994,_0x5b6f78,_0x2f6392);}; \ 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 64568f5..fafcb1d 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(_0x3e0b82,_0x3a8dfd){var _0xe76d75=function(_0x22cb1c){while(--_0x22cb1c){_0x3e0b82['push'](_0x3e0b82['shift']());}};_0xe76d75(++_0x3a8dfd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x5221e5,_0x3d34cc){var _0x57de23=function(_0xa78f50){while(--_0xa78f50){_0x5221e5['push'](_0x5221e5['shift']());}};_0x57de23(++_0x3d34cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 32a96b7..bf5dc71 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 _0x9b9f=['exports'];(function(_0x1cdf9e,_0x26dda3){var _0x1d8128=function(_0x4ac4d9){while(--_0x4ac4d9){_0x1cdf9e['push'](_0x1cdf9e['shift']());}};_0x1d8128(++_0x26dda3);}(_0x9b9f,0x113));var _0xf9b9=function(_0x2cef86,_0xbae0a6){_0x2cef86=_0x2cef86-0x0;var _0x46dfd6=_0x9b9f[_0x2cef86];return _0x46dfd6;};'use strict';var polly=require('./lib/api');module[_0xf9b9('0x0')]=function(_0x401add,_0x568ed8,_0x24eafb,_0x1a0d32,_0xfb402f,_0x3e92e9,_0x4f66ab){return polly(_0x401add,_0x568ed8,_0x24eafb,_0x1a0d32,_0xfb402f,_0x3e92e9,_0x4f66ab);}; \ No newline at end of file +var _0x5c8e=['exports'];(function(_0x17f944,_0x54d249){var _0xb33bde=function(_0x45f723){while(--_0x45f723){_0x17f944['push'](_0x17f944['shift']());}};_0xb33bde(++_0x54d249);}(_0x5c8e,0x111));var _0xe5c8=function(_0x19cf45,_0x4f9308){_0x19cf45=_0x19cf45-0x0;var _0x280cbc=_0x5c8e[_0x19cf45];return _0x280cbc;};'use strict';var polly=require('./lib/api');module[_0xe5c8('0x0')]=function(_0x210117,_0x13c7cc,_0x28fe8a,_0x40e7ed,_0x3d4523,_0x35e679,_0x44ea64){return polly(_0x210117,_0x13c7cc,_0x28fe8a,_0x40e7ed,_0x3d4523,_0x35e679,_0x44ea64);}; \ 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 25c5bcf..41a95a0 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 _0x286c=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x10bf7b,_0x513c95){var _0x38be31=function(_0x10cfbe){while(--_0x10cfbe){_0x10bf7b['push'](_0x10bf7b['shift']());}};_0x38be31(++_0x513c95);}(_0x286c,0xd2));var _0xc286=function(_0x49e310,_0x2f59c2){_0x49e310=_0x49e310-0x0;var _0x334ccf=_0x286c[_0x49e310];return _0x334ccf;};'use strict';var fs=require('fs');var path=require(_0xc286('0x0'));var BPromise=require(_0xc286('0x1'));var rs=require(_0xc286('0x2'));var AWS=require(_0xc286('0x3'));function pollyResult(_0x5701db,_0x3a243b,_0x410c42){return new BPromise(function(_0x471d1b,_0xa7f262){_0x5701db[_0xc286('0x4')](_0x3a243b,function(_0x473872,_0x5e09c1){if(_0x473872){_0xa7f262(_0x473872);}else if(_0x5e09c1){if(_0x5e09c1[_0xc286('0x5')]instanceof Buffer){fs['writeFile'](_0x410c42,_0x5e09c1[_0xc286('0x5')],function(_0xf162a5){if(_0xf162a5){_0xa7f262(_0xf162a5);}else{_0x471d1b();}});}else{_0xa7f262(new Error(_0xc286('0x6')));}}else{_0xa7f262(new Error(_0xc286('0x7')));}});});}module[_0xc286('0x8')]=function(_0x38f86c,_0x3be20b,_0x41c250,_0x3cf68,_0x512e6b,_0x10a740,_0x2255eb){var _0x5703bf=new AWS[(_0xc286('0x9'))]({'accessKeyId':_0x38f86c,'secretAccessKey':_0x3be20b,'region':_0x41c250});var _0x200059={'Text':_0x512e6b,'TextType':_0x10a740||'text','OutputFormat':_0xc286('0xa'),'VoiceId':_0x3cf68};return pollyResult(_0x5703bf,_0x200059,_0x2255eb);}; \ No newline at end of file +var _0xfe08=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','randomstring','aws-sdk','synthesizeSpeech','writeFile'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xfe08,0x11d));var _0x8fe0=function(_0xc498b3,_0x5610b4){_0xc498b3=_0xc498b3-0x0;var _0x1e2530=_0xfe08[_0xc498b3];return _0x1e2530;};'use strict';var fs=require('fs');var path=require(_0x8fe0('0x0'));var BPromise=require('bluebird');var rs=require(_0x8fe0('0x1'));var AWS=require(_0x8fe0('0x2'));function pollyResult(_0x1739ad,_0x91ca4b,_0x1ac81a){return new BPromise(function(_0xca1b6f,_0x452b8a){_0x1739ad[_0x8fe0('0x3')](_0x91ca4b,function(_0x4784a5,_0x1c47ac){if(_0x4784a5){_0x452b8a(_0x4784a5);}else if(_0x1c47ac){if(_0x1c47ac['AudioStream']instanceof Buffer){fs[_0x8fe0('0x4')](_0x1ac81a,_0x1c47ac['AudioStream'],function(_0x16612e){if(_0x16612e){_0x452b8a(_0x16612e);}else{_0xca1b6f();}});}else{_0x452b8a(new Error(_0x8fe0('0x5')));}}else{_0x452b8a(new Error(_0x8fe0('0x6')));}});});}module[_0x8fe0('0x7')]=function(_0x41d7f1,_0x1f77bd,_0x4cc384,_0x433656,_0x3ff4c6,_0x48fd19,_0x12a9a4){var _0x82cf9d=new AWS[(_0x8fe0('0x8'))]({'accessKeyId':_0x41d7f1,'secretAccessKey':_0x1f77bd,'region':_0x4cc384});var _0x15a6a2={'Text':_0x3ff4c6,'TextType':_0x48fd19||'text','OutputFormat':_0x8fe0('0x9'),'VoiceId':_0x433656};return pollyResult(_0x82cf9d,_0x15a6a2,_0x12a9a4);}; \ 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 ee71e49..5e2b97c 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 _0xcf88=['./lib/api','exports'];(function(_0x145eff,_0x269003){var _0x1a7a9e=function(_0x55345f){while(--_0x55345f){_0x145eff['push'](_0x145eff['shift']());}};_0x1a7a9e(++_0x269003);}(_0xcf88,0xb4));var _0x8cf8=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xcf88[_0x55f8b4];return _0x2475f9;};'use strict';var asr=require(_0x8cf8('0x0'));module[_0x8cf8('0x1')]=function(_0x250a6d,_0x277261,_0x76cc38,_0x198f9c){return asr(_0x250a6d,_0x277261,_0x76cc38);}; \ No newline at end of file +var _0xdf22=['exports','./lib/api'];(function(_0x48b029,_0x1d9037){var _0x43347f=function(_0x5d8c90){while(--_0x5d8c90){_0x48b029['push'](_0x48b029['shift']());}};_0x43347f(++_0x1d9037);}(_0xdf22,0xe3));var _0x2df2=function(_0x3a5ac7,_0x493ce8){_0x3a5ac7=_0x3a5ac7-0x0;var _0x486efd=_0xdf22[_0x3a5ac7];return _0x486efd;};'use strict';var asr=require(_0x2df2('0x0'));module[_0x2df2('0x1')]=function(_0x2ee953,_0x4b07ae,_0x5534e1,_0x16399f){return asr(_0x2ee953,_0x4b07ae,_0x5534e1);}; \ 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 a30527d..fc4c7f6 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 _0x1b73=['POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x1b73,0x1d5));var _0x31b7=function(_0x4c7d5d,_0x35d7ba){_0x4c7d5d=_0x4c7d5d-0x0;var _0x54e93b=_0x1b73[_0x4c7d5d];return _0x54e93b;};'use strict';var url=require('url');var BPromise=require(_0x31b7('0x0'));var fs=require('fs');var host=_0x31b7('0x1');module[_0x31b7('0x2')]=function(_0x5c767e,_0x4bf5ae,_0x17c0ef){return new BPromise(function(_0x59e606,_0x40fef2){var _0x3682cc;if(typeof _0x5c767e!=='string'||_0x5c767e[_0x31b7('0x3')]===0x0){return _0x40fef2(_0x31b7('0x4'));}if(typeof _0x4bf5ae!==_0x31b7('0x5')||_0x4bf5ae['length']===0x0){return _0x40fef2(_0x31b7('0x6'));}if(typeof _0x17c0ef!==_0x31b7('0x7')&&(typeof _0x17c0ef!==_0x31b7('0x5')||_0x17c0ef[_0x31b7('0x3')]===0x0)){return _0x40fef2(_0x31b7('0x8'));}try{_0x3682cc=fs[_0x31b7('0x9')](_0x5c767e)[_0x31b7('0xa')]('base64');}catch(_0x268428){return _0x40fef2(_0x268428);}return _0x59e606({'method':_0x31b7('0xb'),'uri':host+_0x31b7('0xc')+_0x4bf5ae,'body':{'config':{'encoding':_0x31b7('0xd'),'sampleRateHertz':_0x31b7('0xe'),'languageCode':_0x17c0ef},'audio':{'content':_0x3682cc}},'json':!![]});});}; \ No newline at end of file +var _0x6f7a=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x44fa9a,_0x2cce12){var _0x16d5df=function(_0x3d86f3){while(--_0x3d86f3){_0x44fa9a['push'](_0x44fa9a['shift']());}};_0x16d5df(++_0x2cce12);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x4c6fcd,_0x28d2a7){_0x4c6fcd=_0x4c6fcd-0x0;var _0x364e82=_0x6f7a[_0x4c6fcd];return _0x364e82;};'use strict';var url=require(_0xa6f7('0x0'));var BPromise=require(_0xa6f7('0x1'));var fs=require('fs');var host=_0xa6f7('0x2');module[_0xa6f7('0x3')]=function(_0x4dd99d,_0x93614a,_0x407de3){return new BPromise(function(_0x12ecb8,_0x1da6dc){var _0x22e529;if(typeof _0x4dd99d!==_0xa6f7('0x4')||_0x4dd99d[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x6'));}if(typeof _0x93614a!==_0xa6f7('0x4')||_0x93614a[_0xa6f7('0x5')]===0x0){return _0x1da6dc(_0xa6f7('0x7'));}if(typeof _0x407de3!=='undefined'&&(typeof _0x407de3!=='string'||_0x407de3[_0xa6f7('0x5')]===0x0)){return _0x1da6dc(_0xa6f7('0x8'));}try{_0x22e529=fs[_0xa6f7('0x9')](_0x4dd99d)[_0xa6f7('0xa')](_0xa6f7('0xb'));}catch(_0x49a451){return _0x1da6dc(_0x49a451);}return _0x12ecb8({'method':'POST','uri':host+_0xa6f7('0xc')+_0x93614a,'body':{'config':{'encoding':_0xa6f7('0xd'),'sampleRateHertz':'8000','languageCode':_0x407de3},'audio':{'content':_0x22e529}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 10cb4be..68370a8 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xf2b9=['exports','./asr'];(function(_0x4a2176,_0x176e35){var _0x29e2c7=function(_0x15ed95){while(--_0x15ed95){_0x4a2176['push'](_0x4a2176['shift']());}};_0x29e2c7(++_0x176e35);}(_0xf2b9,0x99));var _0x9f2b=function(_0x2e89e6,_0x5ba51d){_0x2e89e6=_0x2e89e6-0x0;var _0x2c9992=_0xf2b9[_0x2e89e6];return _0x2c9992;};var asr=require(_0x9f2b('0x0'));module[_0x9f2b('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 c9bce7b..78721ad 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 _0x8842=['pipe','path','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','chmodSync','unlink','googleCloudTTS\x20path','googleTTS','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','info','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','googleDialogflow','textRequest','result','resolvedQuery','action','speech','score','status','code','metadata','endConversation','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','intent','name','displayName','isFallback','languageCode','queryText','responseId','fulfillmentText','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','AudioFromTts','Data','audiofile','dirName','dialogflow','md5','querystring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','request\x20to\x20','createWriteStream','finish\x20download\x20file','download\x20error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8842,0x163));var _0x2884=function(_0x18f7da,_0x40d95e){_0x18f7da=_0x18f7da-0x0;var _0x38a3c4=_0x8842[_0x18f7da];return _0x38a3c4;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x2884('0x0'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x2884('0x1'));var path=require('path');var querystring=require(_0x2884('0x2'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x2884('0x3'));var tts=require(_0x2884('0x4'));var urlParse=require(_0x2884('0x5'))[_0x2884('0x6')];var util=require('util');var aws=require(_0x2884('0x7'));var google=require(_0x2884('0x8'));var sestek=require(_0x2884('0x9'));var tilde=require(_0x2884('0xa'));var logger=require(_0x2884('0xb'))(_0x2884('0xc'));var ISPEECH_API=_0x2884('0xd');function downloadFile(_0x3b63a5,_0x31e016){return new BPromise(function(_0x508965,_0x4ae6df){var _0x8149c8=urlParse(_0x3b63a5);var _0x365238=_0x8149c8['protocol']===_0x2884('0xe')?https:http;var _0x1aa673={'host':_0x8149c8[_0x2884('0xf')],'path':_0x8149c8['path'],'headers':{'user-agent':_0x2884('0x10')}};_0x365238[_0x2884('0x11')](_0x1aa673,function(_0x3cb623){if(_0x3cb623['statusCode']!==0xc8){logger[_0x2884('0x12')]('request\x20to\x20'+_0x3b63a5+_0x2884('0x13')+_0x3cb623[_0x2884('0x14')]+'\x20('+_0x3cb623[_0x2884('0x15')]+')');_0x4ae6df(new Error(_0x2884('0x16')+_0x3b63a5+'\x20failed,\x20status\x20code\x20=\x20'+_0x3cb623[_0x2884('0x14')]+'\x20('+_0x3cb623[_0x2884('0x15')]+')'));return;}var _0x3aae47=fs[_0x2884('0x17')](_0x31e016);_0x3aae47['on']('finish',function(){logger['info'](_0x2884('0x18'));_0x3aae47['close'](_0x508965);});_0x3aae47['on'](_0x2884('0x12'),function(_0xeb945b){fs['unlink'](_0x31e016);logger[_0x2884('0x12')](_0x2884('0x19'),_0xeb945b);_0x4ae6df(_0xeb945b);});_0x3cb623[_0x2884('0x1a')](_0x3aae47);})['on'](_0x2884('0x12'),function(_0x5d6857){logger[_0x2884('0x12')](_0x5d6857);_0x4ae6df(_0x5d6857);})['end']();});}function uploadFile(_0x2b74b9){return new BPromise(function(_0x27cb7e,_0x4f8a1d){var _0xf46a9f=urlParse(_0x2b74b9);var _0x11af38=_0xf46a9f['protocol']===_0x2884('0xe')?https:http;var _0xaf358f={'host':_0xf46a9f[_0x2884('0xf')],'path':_0xf46a9f[_0x2884('0x1b')],'headers':{'user-agent':_0x2884('0x10')}};_0x11af38['get'](_0xaf358f,function(_0x3c34b){if(_0x3c34b[_0x2884('0x14')]!==0xc8){_0x4f8a1d(new Error(_0x2884('0x16')+_0x2b74b9+'\x20failed,\x20status\x20code\x20=\x20'+_0x3c34b[_0x2884('0x14')]+'\x20('+_0x3c34b[_0x2884('0x15')]+')'));return;}var _0x592eff='';_0x3c34b['on'](_0x2884('0x1c'),function(_0x5144b2){_0x592eff+=_0x5144b2;});_0x3c34b['on']('end',function(){_0x27cb7e(_0x592eff);});})['on'](_0x2884('0x12'),function(_0x1b8ec9){_0x4f8a1d(_0x1b8ec9);})[_0x2884('0x1d')]();});}function convertFile(_0x594895,_0x20e861){return new BPromise(function(_0x83885,_0x56a681){var _0x5a8081=sox[_0x2884('0x1e')](_0x594895,_0x20e861,{'sampleRate':0x1f40,'format':_0x2884('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5a8081['on'](_0x2884('0x12'),function(_0x592bfc){logger[_0x2884('0x12')](_0x2884('0x20'),_0x592bfc);_0x56a681(_0x592bfc);});_0x5a8081['on'](_0x2884('0x1d'),function(){logger['info'](_0x2884('0x21'));_0x83885();});_0x5a8081['start']();});}function base64Decode(_0x27eb65,_0x22d73e){var _0x33e786=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs[_0x2884('0x24')](0x4)+_0x2884('0x25'));fs[_0x2884('0x26')](_0x33e786,_0x27eb65,_0x2884('0x27'));return convertFile(_0x33e786,_0x22d73e)[_0x2884('0x28')](function(){try{fs['unlink'](_0x33e786);fs['chmodSync'](_0x22d73e,_0x2884('0x29'));}catch(_0x4a90b1){logger['error'](_0x4a90b1);}return _0x22d73e[_0x2884('0x2a')]('.')[0x0];});}function base64Encode(_0x277257){var _0xa44427=fs[_0x2884('0x2b')](_0x277257);return new Buffer(_0xa44427)[_0x2884('0x2c')](_0x2884('0x27'));}exports['googleCloudTTS']=function(_0x4c865f,_0x1cb7bf,_0x31c6f4,_0x38ee23,_0x26e125,_0x501228){var _0x52be33,_0x33ed5b;var _0x40f785=_0x2884('0x2d');var _0x5ce944=_0x2884('0x2e')+_0x4c865f;var _0x2a5350={};if(_0x1cb7bf==='ssml'){_0x2a5350[_0x2884('0x2f')]={'ssml':_0x31c6f4};}else{_0x2a5350[_0x2884('0x2f')]={'text':_0x31c6f4};};_0x2a5350[_0x2884('0x30')]={'languageCode':_0x38ee23,'ssmlGender':_0x26e125};_0x2a5350[_0x2884('0x31')]={'audioEncoding':_0x2884('0x32'),'sampleRateHertz':0x1f40};var _0x1dc80a={'url':_0x40f785+_0x2884('0x33')+_0x5ce944,'method':_0x2884('0x34'),'json':!![],'body':_0x2a5350};return rp(_0x1dc80a)[_0x2884('0x28')](function(_0x345e1e){return new BPromise(function(_0x530e90,_0x42f7b4){_0x52be33=path[_0x2884('0x22')](__dirname,'tmp',rs['generate'](0x4)+_0x2884('0x35'));var _0x558dd5=Buffer['from'](_0x345e1e[_0x2884('0x36')],_0x2884('0x27'));return fs[_0x2884('0x37')](_0x52be33,_0x558dd5,function(_0x588205){_0x42f7b4(_0x588205);},function(_0x51d941){fs[_0x2884('0x38')](_0x52be33,_0x2884('0x29'));_0x530e90(_0x51d941);});});})[_0x2884('0x28')](function(_0x3a8ce1){_0x33ed5b=path[_0x2884('0x22')](__dirname,'tmp',rs[_0x2884('0x24')](0x4)+_0x2884('0x25'));return convertFile(_0x52be33,_0x33ed5b);})[_0x2884('0x28')](function(){try{fs[_0x2884('0x39')](_0x52be33);fs[_0x2884('0x38')](_0x33ed5b,'777');}catch(_0x183993){logger[_0x2884('0x12')](_0x183993);}logger['info'](_0x2884('0x3a'),_0x33ed5b['split']('.')[0x0]);return _0x33ed5b['split']('.')[0x0];});};exports[_0x2884('0x3b')]=function(_0x261092,_0xe76fd0){var _0x155781='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x573fe3,_0x140549;var _0x5a67b1;var _0x498f1f={'encoding':'utf8','method':_0x2884('0x34'),'timeout':0x2710,'url':_0x155781,'headers':{'Content-Type':_0x2884('0x3c')},'body':_0x2884('0x3d')+encodeURIComponent(JSON[_0x2884('0x3e')]([[[_0x2884('0x3f'),JSON['stringify']([_0x261092,_0xe76fd0||'en',![],'null']),null,_0x2884('0x40')]]]))};return rp(_0x498f1f)[_0x2884('0x28')](function(_0x2b0324){try{_0x5a67b1=eval(_0x2b0324[_0x2884('0x41')](0x5))[0x0][0x2];}catch(_0x5ad0bd){throw new Error('parse\x20response\x20failed:\x0a'+_0x2b0324[_0x2884('0x1c')]);}if(!_0x5a67b1){if(_0x261092['length']>0xc8){throw new Error(_0x2884('0x42'));}else{throw new Error(_0x2884('0x43')+_0xe76fd0+_0x2884('0x44'));}}try{_0x5a67b1=eval(_0x5a67b1)[0x0];}catch(_0x5d9795){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x2884('0x1c')]);}const _0x521864=_0x5a67b1;_0x573fe3=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs['generate'](0x4)+_0x2884('0x35'));fs[_0x2884('0x26')](_0x573fe3,_0x5a67b1,{'encoding':_0x2884('0x27')});_0x140549=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs[_0x2884('0x24')](0x4)+'.wav');return convertFile(_0x573fe3,_0x140549);})[_0x2884('0x28')](function(){try{fs['unlink'](_0x573fe3);fs[_0x2884('0x38')](_0x140549,_0x2884('0x29'));}catch(_0x115824){logger[_0x2884('0x12')](_0x115824);}logger[_0x2884('0x45')]('goggleTTS\x20path',_0x140549[_0x2884('0x2a')]('.')[0x0]);return _0x140549[_0x2884('0x2a')]('.')[0x0];});};exports[_0x2884('0x46')]=function(_0x3f5895,_0x4a4191,_0x28d92f){return google[_0x2884('0x47')](_0x3f5895,_0x4a4191,_0x28d92f)[_0x2884('0x28')](function(_0x302087){logger['info'](_0x302087[_0x2884('0x48')]);return rp(_0x302087);})[_0x2884('0x28')](function(_0x12d356){var _0x37866b='';var _0x33a215=0x0;try{fs[_0x2884('0x39')](_0x3f5895);}catch(_0x2e58b0){logger[_0x2884('0x12')](_0x2e58b0);}if(_0x12d356&&_0x12d356['results']){_0x37866b=_0x12d356[_0x2884('0x49')][_0x2884('0x4a')](function(_0x5bd662){return _0x5bd662&&_0x5bd662[_0x2884('0x4b')][0x0]&&_0x5bd662['alternatives'][0x0][_0x2884('0x4c')]?_0x5bd662[_0x2884('0x4b')][0x0][_0x2884('0x4c')]:'';})[_0x2884('0x4d')]('\x0a');_0x33a215=_0x12d356[_0x2884('0x49')][_0x2884('0x4a')](function(_0xed1061){return _0xed1061&&_0xed1061[_0x2884('0x4b')][0x0]&&_0xed1061[_0x2884('0x4b')][0x0][_0x2884('0x4e')]?_0xed1061['alternatives'][0x0][_0x2884('0x4e')]:0x0;})[_0x2884('0x4d')]('\x0a');}logger['info']('googleASR\x20transcription',_0x37866b);logger[_0x2884('0x45')](_0x2884('0x4f'),_0x33a215);return{'transcript':_0x37866b,'confidence':_0x33a215};})[_0x2884('0x50')](function(_0x286f99){logger['error'](_0x2884('0x51'),_0x286f99[_0x2884('0x14')],_0x286f99['name'],_0x286f99['message']);});};exports[_0x2884('0x52')]=function(_0x3b5c56,_0xb30e66,_0x5c99ac,_0xe3ed87){var _0x5e52dd=apiai(_0xb30e66,{'language':_0xe3ed87||'en'});return _0x5e52dd[_0x2884('0x53')](_0x5c99ac,{'sessionId':md5(_0x3b5c56)})[_0x2884('0x28')](function(_0x19ba55){logger[_0x2884('0x45')](JSON[_0x2884('0x3e')](_0x19ba55));return{'source':_0x19ba55[_0x2884('0x54')]['source'],'resolvedQuery':_0x19ba55['result'][_0x2884('0x55')],'action':_0x19ba55[_0x2884('0x54')][_0x2884('0x56')],'actionIncomplete':_0x19ba55[_0x2884('0x54')]['actionIncomplete'],'speech':_0x19ba55[_0x2884('0x54')]['fulfillment'][_0x2884('0x57')],'score':_0x19ba55[_0x2884('0x54')][_0x2884('0x58')],'statusCode':_0x19ba55[_0x2884('0x59')][_0x2884('0x5a')],'endConversation':_0x19ba55[_0x2884('0x54')][_0x2884('0x5b')][_0x2884('0x5c')]||![],'isFallbackIntent':_0x19ba55[_0x2884('0x54')]['metadata']['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0xdf1db4,_0xc3af,_0x11b46a,_0x55cea3,_0x2c5512,_0x29dccf){var _0x981200=_0x55cea3[_0x2884('0x5d')](/\\n/g,'\x0a');var _0x45897e={'credentials':{'private_key':_0x981200,'client_email':_0x11b46a}};var _0x554680=new dialogflow[(_0x2884('0x5e'))](_0x45897e);var _0x5e47eb=_0x554680['sessionPath'](_0xc3af,md5(_0xdf1db4));var _0x41307e={'session':_0x5e47eb,'queryInput':{'text':{'text':_0x2c5512,'languageCode':_0x29dccf}}};return _0x554680[_0x2884('0x5f')](_0x41307e)[_0x2884('0x28')](function(_0x5239db){if(_0x5239db&&_0x5239db[_0x2884('0x60')]){logger['info'](_0x2884('0x61'),JSON['stringify'](_0x5239db));var _0x1d64ad=_0x5239db[0x0];if(_0x1d64ad){var _0x414ad1={'action':_0x1d64ad[_0x2884('0x62')][_0x2884('0x56')],'allRequiredParamsPresent':_0x1d64ad[_0x2884('0x62')][_0x2884('0x63')],'endConversation':_0x1d64ad[_0x2884('0x62')]['diagnosticInfo']&&_0x1d64ad[_0x2884('0x62')][_0x2884('0x64')][_0x2884('0x65')]?_0x1d64ad['queryResult']['diagnosticInfo'][_0x2884('0x65')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x1d64ad['queryResult']['fulfillmentText'],'intentName':_0x1d64ad[_0x2884('0x62')][_0x2884('0x66')][_0x2884('0x67')],'intentDisplayName':_0x1d64ad[_0x2884('0x62')][_0x2884('0x66')][_0x2884('0x68')],'isFallbackIntent':_0x1d64ad[_0x2884('0x62')][_0x2884('0x66')][_0x2884('0x69')],'languageCode':_0x1d64ad[_0x2884('0x62')][_0x2884('0x6a')],'queryText':_0x1d64ad[_0x2884('0x62')][_0x2884('0x6b')],'responseId':_0x1d64ad[_0x2884('0x6c')],'score':_0x1d64ad[_0x2884('0x62')]['intentDetectionConfidence'],'speech':_0x1d64ad['queryResult'][_0x2884('0x6d')],'providerResponse':JSON[_0x2884('0x3e')](_0x5239db)};return _0x414ad1;}}});};exports['tildeASR']=function(_0x40bb36,_0x472d5a,_0x14f1bd,_0x2257b4){return tilde[_0x2884('0x47')](_0x40bb36,_0x472d5a,_0x14f1bd,_0x2257b4)[_0x2884('0x28')](function(_0x1015d2){try{fs[_0x2884('0x39')](_0x40bb36);}catch(_0x2b0333){logger[_0x2884('0x12')](_0x2b0333);}logger['info']('Tilde\x20ASR\x20transcription',_0x1015d2['transcript']);logger[_0x2884('0x45')](_0x2884('0x6e'),_0x1015d2[_0x2884('0x4e')]);return _0x1015d2;});};exports[_0x2884('0x6f')]=function(_0x385cd0,_0x12bba1,_0xe1267a,_0x3a1696,_0x48cd50,_0x754dc1){var _0x1e0ccc=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs[_0x2884('0x24')](0x4)+_0x2884('0x35'));var _0x299f9e;return aws[_0x2884('0x70')](_0x385cd0,_0x12bba1,_0xe1267a,_0x3a1696,_0x48cd50,_0x754dc1,_0x1e0ccc)[_0x2884('0x28')](function(){_0x299f9e=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs[_0x2884('0x24')](0x4)+'.wav');return convertFile(_0x1e0ccc,_0x299f9e);})[_0x2884('0x28')](function(){try{fs[_0x2884('0x39')](_0x1e0ccc);fs[_0x2884('0x38')](_0x299f9e,'777');}catch(_0x3bd2b3){logger[_0x2884('0x12')](_0x3bd2b3);}return _0x299f9e['split']('.')[0x0];});};exports['awsLex']=function(_0x46fcb4,_0x175bcd,_0x136b4e,_0x442c22,_0x4de1ec,_0x370b63){return aws[_0x2884('0x71')](_0x46fcb4,_0x175bcd,_0x136b4e,_0x442c22,_0x4de1ec,_0x370b63)[_0x2884('0x28')](function(_0x2fa78a){logger['info'](JSON[_0x2884('0x3e')](_0x2fa78a));return _0x2fa78a;});};exports['ispeechTTS']=function(_0x2c9772,_0x3b4a9e,_0x4fcc67,_0x41b18c){var _0x3ae671=util[_0x2884('0x72')](_0x2884('0x73'),ISPEECH_API,_0x2c9772,encodeURIComponent(_0x3b4a9e),_0x4fcc67,_0x41b18c);var _0x49afaa=path[_0x2884('0x22')](__dirname,'tmp',rs[_0x2884('0x24')](0x4)+'.mp3');var _0x5be4e7;return downloadFile(_0x3ae671,_0x49afaa)[_0x2884('0x28')](function(){_0x5be4e7=path[_0x2884('0x22')](__dirname,_0x2884('0x23'),rs['generate'](0x4)+_0x2884('0x25'));return convertFile(_0x49afaa,_0x5be4e7);})[_0x2884('0x28')](function(){try{fs[_0x2884('0x39')](_0x49afaa);fs[_0x2884('0x38')](_0x5be4e7,_0x2884('0x29'));}catch(_0x2799b2){logger[_0x2884('0x12')](_0x2799b2);}return _0x5be4e7[_0x2884('0x2a')]('.')[0x0];});};exports[_0x2884('0x74')]=function(_0x45f495,_0x1fefcf,_0x4a5296,_0x32e082){var _0x9ebdbe=util['format'](_0x2884('0x75'),ISPEECH_API,_0x1fefcf,_0x4a5296,base64Encode(_0x45f495),_0x32e082?util['format'](_0x2884('0x76'),encodeURIComponent(_0x32e082)):'freeform=3');return uploadFile(_0x9ebdbe)[_0x2884('0x28')](function(_0xff6770){return querystring[_0x2884('0x6')](_0xff6770);});};exports[_0x2884('0x77')]=function(_0x2228c5,_0x36209c){return sestek[_0x2884('0x78')](_0x2228c5,_0x36209c)[_0x2884('0x28')](function(_0x2ee5c8){logger[_0x2884('0x45')](JSON['stringify'](_0x2ee5c8));var _0x23a74b={'speech':_0x2ee5c8[_0x2884('0x79')],'action':_0x2ee5c8[_0x2884('0x7a')]?_0x2ee5c8['channelData']['CustomAction']:undefined,'actiondata':_0x2ee5c8[_0x2884('0x7a')]?_0x2ee5c8[_0x2884('0x7a')]['CustomActionData']:undefined};if(_0x2ee5c8['channelData']&&_0x2ee5c8[_0x2884('0x7a')]['AudioFromTts']){return base64Decode(_0x2ee5c8[_0x2884('0x7a')][_0x2884('0x7b')][_0x2884('0x7c')],path['resolve'](__dirname,_0x2884('0x23'),rs['generate'](0x4)+_0x2884('0x25')))[_0x2884('0x28')](function(_0xb00c5b){_0x23a74b[_0x2884('0x7d')]=_0xb00c5b;return _0x23a74b;});}return _0x23a74b;});};exports[_0x2884('0x7e')]=function(){return __dirname;}; \ No newline at end of file +var _0xd39e=['parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','results','map','alternatives','confidence','join','googleASR\x20transcription','googleASR\x20confidence','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','score','status','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fields','diagnosticInfo','boolValue','intent','displayName','languageCode','queryText','responseId','fulfillmentText','tildeASR','asr','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','awsPolly','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','dirName','apiai-promise','dialogflow','http','https','md5','request-promise','google-tts-api','parse','util','./aws','./google','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','close','unlink','pipe','end','protocol','WHAT_EVER','data','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','audioContent','writeFile','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd39e,0xc3));var _0xed39=function(_0x256422,_0x367394){_0x256422=_0x256422-0x0;var _0x55dddc=_0xd39e[_0x256422];return _0x55dddc;};'use strict';var apiai=require(_0xed39('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xed39('0x1'));var fs=require('fs');var http=require(_0xed39('0x2'));var https=require(_0xed39('0x3'));var md5=require(_0xed39('0x4'));var path=require('path');var querystring=require('querystring');var rp=require(_0xed39('0x5'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0xed39('0x6'));var urlParse=require('url')[_0xed39('0x7')];var util=require(_0xed39('0x8'));var aws=require(_0xed39('0x9'));var google=require(_0xed39('0xa'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0xed39('0xb'))(_0xed39('0xc'));var ISPEECH_API=_0xed39('0xd');function downloadFile(_0x359f70,_0x43042f){return new BPromise(function(_0x2dcad1,_0x18c211){var _0x38b6be=urlParse(_0x359f70);var _0x52ce8e=_0x38b6be['protocol']===_0xed39('0xe')?https:http;var _0x4bdc75={'host':_0x38b6be['host'],'path':_0x38b6be['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x52ce8e[_0xed39('0xf')](_0x4bdc75,function(_0x1a4070){if(_0x1a4070[_0xed39('0x10')]!==0xc8){logger[_0xed39('0x11')](_0xed39('0x12')+_0x359f70+_0xed39('0x13')+_0x1a4070[_0xed39('0x10')]+'\x20('+_0x1a4070[_0xed39('0x14')]+')');_0x18c211(new Error(_0xed39('0x12')+_0x359f70+_0xed39('0x13')+_0x1a4070[_0xed39('0x10')]+'\x20('+_0x1a4070[_0xed39('0x14')]+')'));return;}var _0x1c505d=fs['createWriteStream'](_0x43042f);_0x1c505d['on']('finish',function(){logger[_0xed39('0x15')]('finish\x20download\x20file');_0x1c505d[_0xed39('0x16')](_0x2dcad1);});_0x1c505d['on'](_0xed39('0x11'),function(_0x1ffc3c){fs[_0xed39('0x17')](_0x43042f);logger['error']('download\x20error',_0x1ffc3c);_0x18c211(_0x1ffc3c);});_0x1a4070[_0xed39('0x18')](_0x1c505d);})['on'](_0xed39('0x11'),function(_0x1a38d8){logger[_0xed39('0x11')](_0x1a38d8);_0x18c211(_0x1a38d8);})[_0xed39('0x19')]();});}function uploadFile(_0x49476f){return new BPromise(function(_0x3f7205,_0x1d4948){var _0x2b3118=urlParse(_0x49476f);var _0x8481fe=_0x2b3118[_0xed39('0x1a')]===_0xed39('0xe')?https:http;var _0x3b613f={'host':_0x2b3118['host'],'path':_0x2b3118['path'],'headers':{'user-agent':_0xed39('0x1b')}};_0x8481fe['get'](_0x3b613f,function(_0x138aab){if(_0x138aab[_0xed39('0x10')]!==0xc8){_0x1d4948(new Error(_0xed39('0x12')+_0x49476f+'\x20failed,\x20status\x20code\x20=\x20'+_0x138aab[_0xed39('0x10')]+'\x20('+_0x138aab[_0xed39('0x14')]+')'));return;}var _0x2ab55f='';_0x138aab['on'](_0xed39('0x1c'),function(_0x18842b){_0x2ab55f+=_0x18842b;});_0x138aab['on']('end',function(){_0x3f7205(_0x2ab55f);});})['on'](_0xed39('0x11'),function(_0x2cd7bc){_0x1d4948(_0x2cd7bc);})[_0xed39('0x19')]();});}function convertFile(_0x46e559,_0xe400a6){return new BPromise(function(_0x48699c,_0x1545b){var _0x2ac65e=sox[_0xed39('0x1d')](_0x46e559,_0xe400a6,{'sampleRate':0x1f40,'format':_0xed39('0x1e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ac65e['on'](_0xed39('0x11'),function(_0x22188a){logger[_0xed39('0x11')]('error\x20convert',_0x22188a);_0x1545b(_0x22188a);});_0x2ac65e['on'](_0xed39('0x19'),function(){logger[_0xed39('0x15')](_0xed39('0x1f'));_0x48699c();});_0x2ac65e[_0xed39('0x20')]();});}function base64Decode(_0x154f83,_0x33be3c){var _0x2c48cb=path[_0xed39('0x21')](__dirname,_0xed39('0x22'),rs['generate'](0x4)+_0xed39('0x23'));fs[_0xed39('0x24')](_0x2c48cb,_0x154f83,'base64');return convertFile(_0x2c48cb,_0x33be3c)[_0xed39('0x25')](function(){try{fs['unlink'](_0x2c48cb);fs[_0xed39('0x26')](_0x33be3c,_0xed39('0x27'));}catch(_0xd2f909){logger[_0xed39('0x11')](_0xd2f909);}return _0x33be3c[_0xed39('0x28')]('.')[0x0];});}function base64Encode(_0x5803ab){var _0x273b32=fs[_0xed39('0x29')](_0x5803ab);return new Buffer(_0x273b32)[_0xed39('0x2a')](_0xed39('0x2b'));}exports[_0xed39('0x2c')]=function(_0x1255fc,_0x45aff1,_0x4e4f93,_0x29ef6d,_0x562869,_0x31c319){var _0xbf6ce4,_0x54c796;var _0x350762=_0xed39('0x2d');var _0x3d5eb5=_0xed39('0x2e')+_0x1255fc;var _0x5efc62={};if(_0x45aff1===_0xed39('0x2f')){_0x5efc62[_0xed39('0x30')]={'ssml':_0x4e4f93};}else{_0x5efc62['input']={'text':_0x4e4f93};};_0x5efc62[_0xed39('0x31')]={'languageCode':_0x29ef6d,'ssmlGender':_0x562869};_0x5efc62[_0xed39('0x32')]={'audioEncoding':_0xed39('0x33'),'sampleRateHertz':0x1f40};var _0xedc780={'url':_0x350762+_0xed39('0x34')+_0x3d5eb5,'method':_0xed39('0x35'),'json':!![],'body':_0x5efc62};return rp(_0xedc780)['then'](function(_0x31c7e7){return new BPromise(function(_0x11ec6d,_0x45220c){_0xbf6ce4=path['resolve'](__dirname,'tmp',rs[_0xed39('0x36')](0x4)+_0xed39('0x37'));var _0x628f87=Buffer['from'](_0x31c7e7[_0xed39('0x38')],_0xed39('0x2b'));return fs[_0xed39('0x39')](_0xbf6ce4,_0x628f87,function(_0x2ea0e0){_0x45220c(_0x2ea0e0);},function(_0x466074){fs[_0xed39('0x26')](_0xbf6ce4,_0xed39('0x27'));_0x11ec6d(_0x466074);});});})[_0xed39('0x25')](function(_0x5bc228){_0x54c796=path[_0xed39('0x21')](__dirname,_0xed39('0x22'),rs['generate'](0x4)+'.wav');return convertFile(_0xbf6ce4,_0x54c796);})[_0xed39('0x25')](function(){try{fs['unlink'](_0xbf6ce4);fs[_0xed39('0x26')](_0x54c796,_0xed39('0x27'));}catch(_0x61f13d){logger[_0xed39('0x11')](_0x61f13d);}logger[_0xed39('0x15')]('googleCloudTTS\x20path',_0x54c796[_0xed39('0x28')]('.')[0x0]);return _0x54c796['split']('.')[0x0];});};exports[_0xed39('0x3a')]=function(_0x366cc4,_0x308ff8){var _0x1b0204=_0xed39('0x3b');var _0x3f1c90,_0x10709c;var _0x4fb68a;var _0x1dad0f={'encoding':'utf8','method':_0xed39('0x35'),'timeout':0x2710,'url':_0x1b0204,'headers':{'Content-Type':_0xed39('0x3c')},'body':_0xed39('0x3d')+encodeURIComponent(JSON[_0xed39('0x3e')]([[[_0xed39('0x3f'),JSON[_0xed39('0x3e')]([_0x366cc4,_0x308ff8||'en',![],_0xed39('0x40')]),null,_0xed39('0x41')]]]))};return rp(_0x1dad0f)[_0xed39('0x25')](function(_0xb5612d){try{_0x4fb68a=eval(_0xb5612d[_0xed39('0x42')](0x5))[0x0][0x2];}catch(_0x34a50c){throw new Error(_0xed39('0x43')+_0xb5612d[_0xed39('0x1c')]);}if(!_0x4fb68a){if(_0x366cc4['length']>0xc8){throw new Error(_0xed39('0x44'));}else{throw new Error(_0xed39('0x45')+_0x308ff8+_0xed39('0x46'));}}try{_0x4fb68a=eval(_0x4fb68a)[0x0];}catch(_0x18ed15){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x558e3e=_0x4fb68a;_0x3f1c90=path[_0xed39('0x21')](__dirname,'tmp',rs['generate'](0x4)+_0xed39('0x37'));fs[_0xed39('0x24')](_0x3f1c90,_0x4fb68a,{'encoding':_0xed39('0x2b')});_0x10709c=path[_0xed39('0x21')](__dirname,_0xed39('0x22'),rs[_0xed39('0x36')](0x4)+_0xed39('0x23'));return convertFile(_0x3f1c90,_0x10709c);})[_0xed39('0x25')](function(){try{fs[_0xed39('0x17')](_0x3f1c90);fs['chmodSync'](_0x10709c,'777');}catch(_0x4b8c9b){logger[_0xed39('0x11')](_0x4b8c9b);}logger['info'](_0xed39('0x47'),_0x10709c['split']('.')[0x0]);return _0x10709c[_0xed39('0x28')]('.')[0x0];});};exports[_0xed39('0x48')]=function(_0x478361,_0x526e97,_0x1f1ebe){return google['asr'](_0x478361,_0x526e97,_0x1f1ebe)[_0xed39('0x25')](function(_0x117141){logger[_0xed39('0x15')](_0x117141['uri']);return rp(_0x117141);})[_0xed39('0x25')](function(_0x21ab1a){var _0x22f2ef='';var _0x5329d4=0x0;try{fs['unlink'](_0x478361);}catch(_0x2e9ff7){logger[_0xed39('0x11')](_0x2e9ff7);}if(_0x21ab1a&&_0x21ab1a[_0xed39('0x49')]){_0x22f2ef=_0x21ab1a[_0xed39('0x49')][_0xed39('0x4a')](function(_0x1babec){return _0x1babec&&_0x1babec[_0xed39('0x4b')][0x0]&&_0x1babec['alternatives'][0x0]['transcript']?_0x1babec[_0xed39('0x4b')][0x0]['transcript']:'';})['join']('\x0a');_0x5329d4=_0x21ab1a[_0xed39('0x49')][_0xed39('0x4a')](function(_0x471047){return _0x471047&&_0x471047[_0xed39('0x4b')][0x0]&&_0x471047[_0xed39('0x4b')][0x0][_0xed39('0x4c')]?_0x471047['alternatives'][0x0]['confidence']:0x0;})[_0xed39('0x4d')]('\x0a');}logger[_0xed39('0x15')](_0xed39('0x4e'),_0x22f2ef);logger[_0xed39('0x15')](_0xed39('0x4f'),_0x5329d4);return{'transcript':_0x22f2ef,'confidence':_0x5329d4};})['catch'](function(_0x146da1){logger[_0xed39('0x11')]('[%s]\x20%s:%s',_0x146da1['statusCode'],_0x146da1[_0xed39('0x50')],_0x146da1[_0xed39('0x51')]);});};exports[_0xed39('0x52')]=function(_0x4f8f51,_0x505ee9,_0x5e1720,_0x383836){var _0x24bd25=apiai(_0x505ee9,{'language':_0x383836||'en'});return _0x24bd25[_0xed39('0x53')](_0x5e1720,{'sessionId':md5(_0x4f8f51)})[_0xed39('0x25')](function(_0x55229e){logger['info'](JSON[_0xed39('0x3e')](_0x55229e));return{'source':_0x55229e[_0xed39('0x54')][_0xed39('0x55')],'resolvedQuery':_0x55229e[_0xed39('0x54')][_0xed39('0x56')],'action':_0x55229e[_0xed39('0x54')][_0xed39('0x57')],'actionIncomplete':_0x55229e[_0xed39('0x54')][_0xed39('0x58')],'speech':_0x55229e['result'][_0xed39('0x59')]['speech'],'score':_0x55229e['result'][_0xed39('0x5a')],'statusCode':_0x55229e[_0xed39('0x5b')][_0xed39('0x5c')],'endConversation':_0x55229e['result'][_0xed39('0x5d')][_0xed39('0x5e')]||![],'isFallbackIntent':_0x55229e[_0xed39('0x54')][_0xed39('0x5d')][_0xed39('0x5f')]};});};exports['googleDialogflowV2']=function(_0x399009,_0x50472d,_0x8e80ad,_0xb23cb1,_0x21874f,_0x5bdd30){var _0x21c50f=_0xb23cb1[_0xed39('0x60')](/\\n/g,'\x0a');var _0x30641f={'credentials':{'private_key':_0x21c50f,'client_email':_0x8e80ad}};var _0x3b1c94=new dialogflow[(_0xed39('0x61'))](_0x30641f);var _0x5028ad=_0x3b1c94['sessionPath'](_0x50472d,md5(_0x399009));var _0x5ff369={'session':_0x5028ad,'queryInput':{'text':{'text':_0x21874f,'languageCode':_0x5bdd30}}};return _0x3b1c94[_0xed39('0x62')](_0x5ff369)['then'](function(_0x39e525){if(_0x39e525&&_0x39e525[_0xed39('0x63')]){logger['info'](_0xed39('0x64'),JSON['stringify'](_0x39e525));var _0x21b45f=_0x39e525[0x0];if(_0x21b45f){var _0x5274a5={'action':_0x21b45f['queryResult'][_0xed39('0x57')],'allRequiredParamsPresent':_0x21b45f[_0xed39('0x65')][_0xed39('0x66')],'endConversation':_0x21b45f[_0xed39('0x65')]['diagnosticInfo']&&_0x21b45f[_0xed39('0x65')]['diagnosticInfo'][_0xed39('0x67')]?_0x21b45f[_0xed39('0x65')][_0xed39('0x68')][_0xed39('0x67')]['end_conversation'][_0xed39('0x69')]:![],'fulfillmentText':_0x21b45f[_0xed39('0x65')]['fulfillmentText'],'intentName':_0x21b45f[_0xed39('0x65')][_0xed39('0x6a')][_0xed39('0x50')],'intentDisplayName':_0x21b45f[_0xed39('0x65')][_0xed39('0x6a')][_0xed39('0x6b')],'isFallbackIntent':_0x21b45f[_0xed39('0x65')][_0xed39('0x6a')]['isFallback'],'languageCode':_0x21b45f[_0xed39('0x65')][_0xed39('0x6c')],'queryText':_0x21b45f['queryResult'][_0xed39('0x6d')],'responseId':_0x21b45f[_0xed39('0x6e')],'score':_0x21b45f[_0xed39('0x65')]['intentDetectionConfidence'],'speech':_0x21b45f[_0xed39('0x65')][_0xed39('0x6f')],'providerResponse':JSON[_0xed39('0x3e')](_0x39e525)};return _0x5274a5;}}});};exports[_0xed39('0x70')]=function(_0x5861c4,_0x3cb1e0,_0xa26529,_0x4ffe76){return tilde[_0xed39('0x71')](_0x5861c4,_0x3cb1e0,_0xa26529,_0x4ffe76)[_0xed39('0x25')](function(_0x88a033){try{fs[_0xed39('0x17')](_0x5861c4);}catch(_0x55fc3f){logger['error'](_0x55fc3f);}logger[_0xed39('0x15')](_0xed39('0x72'),_0x88a033[_0xed39('0x73')]);logger[_0xed39('0x15')](_0xed39('0x74'),_0x88a033['confidence']);return _0x88a033;});};exports[_0xed39('0x75')]=function(_0x1285e9,_0x477e4c,_0x471b03,_0x16d748,_0x25c7b3,_0x575bcb){var _0x332653=path[_0xed39('0x21')](__dirname,_0xed39('0x22'),rs[_0xed39('0x36')](0x4)+_0xed39('0x37'));var _0x418c9c;return aws['polly'](_0x1285e9,_0x477e4c,_0x471b03,_0x16d748,_0x25c7b3,_0x575bcb,_0x332653)[_0xed39('0x25')](function(){_0x418c9c=path[_0xed39('0x21')](__dirname,'tmp',rs['generate'](0x4)+_0xed39('0x23'));return convertFile(_0x332653,_0x418c9c);})[_0xed39('0x25')](function(){try{fs[_0xed39('0x17')](_0x332653);fs[_0xed39('0x26')](_0x418c9c,_0xed39('0x27'));}catch(_0x4d5b77){logger['error'](_0x4d5b77);}return _0x418c9c['split']('.')[0x0];});};exports['awsLex']=function(_0x1c2c25,_0xb76c27,_0x4cb516,_0x8caff4,_0x31344e,_0x6eb9a4){return aws[_0xed39('0x76')](_0x1c2c25,_0xb76c27,_0x4cb516,_0x8caff4,_0x31344e,_0x6eb9a4)['then'](function(_0x1a7fbe){logger['info'](JSON[_0xed39('0x3e')](_0x1a7fbe));return _0x1a7fbe;});};exports['ispeechTTS']=function(_0x3f2a5d,_0x17f824,_0x2634ec,_0x465fc0){var _0x30f414=util[_0xed39('0x77')](_0xed39('0x78'),ISPEECH_API,_0x3f2a5d,encodeURIComponent(_0x17f824),_0x2634ec,_0x465fc0);var _0x1af671=path[_0xed39('0x21')](__dirname,_0xed39('0x22'),rs[_0xed39('0x36')](0x4)+'.mp3');var _0x4ab5b5;return downloadFile(_0x30f414,_0x1af671)[_0xed39('0x25')](function(){_0x4ab5b5=path[_0xed39('0x21')](__dirname,'tmp',rs['generate'](0x4)+_0xed39('0x23'));return convertFile(_0x1af671,_0x4ab5b5);})[_0xed39('0x25')](function(){try{fs[_0xed39('0x17')](_0x1af671);fs[_0xed39('0x26')](_0x4ab5b5,_0xed39('0x27'));}catch(_0xde7770){logger[_0xed39('0x11')](_0xde7770);}return _0x4ab5b5[_0xed39('0x28')]('.')[0x0];});};exports[_0xed39('0x79')]=function(_0x4007df,_0x24ca13,_0x1cbb51,_0x43683f){var _0x3360c2=util[_0xed39('0x77')](_0xed39('0x7a'),ISPEECH_API,_0x24ca13,_0x1cbb51,base64Encode(_0x4007df),_0x43683f?util[_0xed39('0x77')](_0xed39('0x7b'),encodeURIComponent(_0x43683f)):'freeform=3');return uploadFile(_0x3360c2)[_0xed39('0x25')](function(_0x5bd8a9){return querystring[_0xed39('0x7')](_0x5bd8a9);});};exports[_0xed39('0x7c')]=function(_0x4c4af9,_0x537445){return sestek[_0xed39('0x7d')](_0x4c4af9,_0x537445)['then'](function(_0x299230){logger[_0xed39('0x15')](JSON['stringify'](_0x299230));var _0x41e37f={'speech':_0x299230[_0xed39('0x7e')],'action':_0x299230[_0xed39('0x7f')]?_0x299230[_0xed39('0x7f')]['CustomAction']:undefined,'actiondata':_0x299230[_0xed39('0x7f')]?_0x299230['channelData'][_0xed39('0x80')]:undefined};if(_0x299230[_0xed39('0x7f')]&&_0x299230[_0xed39('0x7f')][_0xed39('0x81')]){return base64Decode(_0x299230['channelData']['AudioFromTts']['Data'],path['resolve'](__dirname,'tmp',rs[_0xed39('0x36')](0x4)+_0xed39('0x23')))[_0xed39('0x25')](function(_0x379cba){_0x41e37f['audiofile']=_0x379cba;return _0x41e37f;});}return _0x41e37f;});};exports[_0xed39('0x82')]=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 785771e..5f388ab 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 _0x97c2=['exports','./nda'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x97c2,0xf7));var _0x297c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x97c2[_0x14add3];return _0x4a174f;};var nda=require(_0x297c('0x0'));module[_0x297c('0x1')]={'nda':nda}; \ No newline at end of file +var _0xa672=['exports'];(function(_0x3ae8f4,_0x2920f4){var _0x367312=function(_0x4dffbf){while(--_0x4dffbf){_0x3ae8f4['push'](_0x3ae8f4['shift']());}};_0x367312(++_0x2920f4);}(_0xa672,0x19f));var _0x2a67=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xa672[_0x3070dc];return _0x431489;};var nda=require('./nda');module[_0x2a67('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index f80303b..c821472 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 _0xb28a=['AudioOutputSettings','CustomAction','custom_action','CustomActionData','info','stringify','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData'];(function(_0x311598,_0x5d4e7b){var _0x39de20=function(_0x444f94){while(--_0x444f94){_0x311598['push'](_0x311598['shift']());}};_0x39de20(++_0x5d4e7b);}(_0xb28a,0x166));var _0xab28=function(_0x215c7b,_0x1e8b6c){_0x215c7b=_0x215c7b-0x0;var _0x867c3d=_0xb28a[_0x215c7b];return _0x867c3d;};'use strict';var rp=require('request-promise');var url=require(_0xab28('0x0'));var logger=require(_0xab28('0x1'))('agi');module[_0xab28('0x2')]=function(_0x4cb73b,_0x5ae2aa){var _0x4b013a={'method':_0xab28('0x3'),'uri':url[_0xab28('0x4')](_0x5ae2aa[_0xab28('0x5')],_0xab28('0x6')),'form':{'grant_type':_0xab28('0x7'),'username':_0x5ae2aa[_0xab28('0x8')],'password':_0x5ae2aa[_0xab28('0x7')]},'json':!![]};return rp(_0x4b013a)[_0xab28('0x9')](function(_0x48949b){var _0x479267={'method':_0xab28('0x3'),'uri':url[_0xab28('0x4')](_0x5ae2aa[_0xab28('0xa')],_0xab28('0xb')),'body':{'type':_0x5ae2aa[_0xab28('0xc')]||_0xab28('0xd'),'channelId':'Nda','conversation':{'id':_0x4cb73b[_0xab28('0xe')]},'from':{'id':_0x4cb73b['callerid'],'name':_0x4cb73b[_0xab28('0xf')]},'recipient':{'id':_0x4cb73b[_0xab28('0x10')],'name':_0x4cb73b[_0xab28('0x11')]},'text':_0x5ae2aa[_0xab28('0x12')],'channelData':{}},'headers':{'Authorization':_0xab28('0x13')+_0x48949b[_0xab28('0x14')]},'json':!![]};if(_0x5ae2aa[_0xab28('0x15')]){_0x479267[_0xab28('0x16')]['channelData'][_0xab28('0x17')]=_0x5ae2aa[_0xab28('0x15')];}if(_0x5ae2aa[_0xab28('0x18')]=='1'){_0x479267[_0xab28('0x16')][_0xab28('0x19')][_0xab28('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5ae2aa['custom_action']){_0x479267[_0xab28('0x16')][_0xab28('0x19')][_0xab28('0x1b')]=_0x5ae2aa[_0xab28('0x1c')];if(_0x5ae2aa['custom_action_data']){_0x479267[_0xab28('0x16')]['channelData'][_0xab28('0x1d')]=_0x5ae2aa['custom_action_data'];}}logger[_0xab28('0x1e')](JSON[_0xab28('0x1f')](_0x479267));return rp(_0x479267);});}; \ No newline at end of file +var _0x35ba=['project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','text','access_token'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x35ba,0x8c));var _0xa35b=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0x35ba[_0x56825b];return _0x69ce77;};'use strict';var rp=require(_0xa35b('0x0'));var url=require(_0xa35b('0x1'));var logger=require(_0xa35b('0x2'))(_0xa35b('0x3'));module['exports']=function(_0x1bd11e,_0x1eb695){var _0x79573b={'method':_0xa35b('0x4'),'uri':url[_0xa35b('0x5')](_0x1eb695[_0xa35b('0x6')],'/token'),'form':{'grant_type':_0xa35b('0x7'),'username':_0x1eb695['username'],'password':_0x1eb695[_0xa35b('0x7')]},'json':!![]};return rp(_0x79573b)[_0xa35b('0x8')](function(_0x2be599){var _0x42da91={'method':_0xa35b('0x4'),'uri':url['resolve'](_0x1eb695[_0xa35b('0x9')],_0xa35b('0xa')),'body':{'type':_0x1eb695[_0xa35b('0xb')]||_0xa35b('0xc'),'channelId':_0xa35b('0xd'),'conversation':{'id':_0x1bd11e[_0xa35b('0xe')]},'from':{'id':_0x1bd11e[_0xa35b('0xf')],'name':_0x1bd11e[_0xa35b('0x10')]},'recipient':{'id':_0x1bd11e[_0xa35b('0x11')],'name':_0x1bd11e['extension']},'text':_0x1eb695[_0xa35b('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2be599[_0xa35b('0x13')]},'json':!![]};if(_0x1eb695[_0xa35b('0x14')]){_0x42da91[_0xa35b('0x15')][_0xa35b('0x16')][_0xa35b('0x17')]=_0x1eb695['project'];}if(_0x1eb695[_0xa35b('0x18')]=='1'){_0x42da91['body'][_0xa35b('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa35b('0x19')};}if(_0x1eb695[_0xa35b('0x1a')]){_0x42da91['body'][_0xa35b('0x16')][_0xa35b('0x1b')]=_0x1eb695[_0xa35b('0x1a')];if(_0x1eb695[_0xa35b('0x1c')]){_0x42da91[_0xa35b('0x15')][_0xa35b('0x16')][_0xa35b('0x1d')]=_0x1eb695[_0xa35b('0x1c')];}}logger[_0xa35b('0x1e')](JSON[_0xa35b('0x1f')](_0x42da91));return rp(_0x42da91);});}; \ 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 6d4c265..59870a1 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 _0x6b43=['exports','./lib/api'];(function(_0x66306a,_0x519133){var _0x3ce3b6=function(_0x22e099){while(--_0x22e099){_0x66306a['push'](_0x66306a['shift']());}};_0x3ce3b6(++_0x519133);}(_0x6b43,0x18d));var _0x36b4=function(_0x2ea770,_0x27e659){_0x2ea770=_0x2ea770-0x0;var _0x2005bb=_0x6b43[_0x2ea770];return _0x2005bb;};'use strict';var asr=require(_0x36b4('0x0'));module[_0x36b4('0x1')]=function(_0x40e0f8,_0x3f8114,_0x21454a,_0x2519c9){return asr(_0x40e0f8,_0x3f8114,_0x21454a,_0x2519c9);}; \ No newline at end of file +var _0x9e1c=['./lib/api','exports'];(function(_0x2a3436,_0x29384d){var _0x28a98b=function(_0x5e1298){while(--_0x5e1298){_0x2a3436['push'](_0x2a3436['shift']());}};_0x28a98b(++_0x29384d);}(_0x9e1c,0x1b0));var _0xc9e1=function(_0x19731e,_0x1d2bba){_0x19731e=_0x19731e-0x0;var _0xb2d62c=_0x9e1c[_0x19731e];return _0xb2d62c;};'use strict';var asr=require(_0xc9e1('0x0'));module[_0xc9e1('0x1')]=function(_0x497876,_0x2ccfb3,_0x6c9595,_0x230e20){return asr(_0x497876,_0x2ccfb3,_0x6c9595,_0x230e20);}; \ 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 9330f68..33b0926 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 _0x6ee8=['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','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','info','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','moment','crypto','agi','exports'];(function(_0x39a302,_0x3cd4a){var _0x25dce9=function(_0x573f16){while(--_0x573f16){_0x39a302['push'](_0x39a302['shift']());}};_0x25dce9(++_0x3cd4a);}(_0x6ee8,0x1b3));var _0x86ee=function(_0x302195,_0x47f65c){_0x302195=_0x302195-0x0;var _0x28a76e=_0x6ee8[_0x302195];return _0x28a76e;};'use strict';var BPromise=require('bluebird');var _=require(_0x86ee('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x86ee('0x1'));var crypto=require(_0x86ee('0x2'));var logger=require('../../../../../../config/logger')(_0x86ee('0x3'));module[_0x86ee('0x4')]=function(_0x62e766,_0x47793d,_0x4186b6,_0x2dc788){return new BPromise(function(_0x3bb1c5,_0x4f81b7){logger['info'](_0x86ee('0x5'),_0x2dc788||_0x86ee('0x6'));var _0x5aec8a=new WebSocket(_0x2dc788||_0x86ee('0x6'),{'perMessageDeflate':![]});var _0x47d72a='';var _0x5ee41c='0';var _0x22836d='1';var _0x1c2529=_0x86ee('0x7');function _0x28f759(_0x3b40ca){var _0x23da13=crypto[_0x86ee('0x8')](_0x86ee('0x9'));_0x23da13[_0x86ee('0xa')](_0x3b40ca);return _0x23da13[_0x86ee('0xb')]('hex');}function _0xcd851f(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x55297b=moment()['unix']();var _0x3682ea=_0x28f759(_0x55297b+_0x47793d+_0x4186b6);_0x5aec8a[_0x86ee('0xc')](JSON[_0x86ee('0xd')]({'appID':_0x47793d,'timestamp':_0x55297b,'appKey':_0x3682ea}));var _0x407d98=fs['createReadStream'](_0x62e766);_0x407d98['on'](_0x86ee('0xe'),function(_0x140918){_0x5aec8a[_0x86ee('0xc')](_0x140918);});_0x407d98['on'](_0x86ee('0xf'),function(){_0x5aec8a[_0x86ee('0xc')](_0x86ee('0x10'));});}catch(_0x154ec4){logger[_0x86ee('0x11')](_0x86ee('0x12'),JSON[_0x86ee('0xd')](_0x154ec4));_0x5aec8a[_0x86ee('0x13')]();}}function _0x4a3c02(_0x175913){try{if(_0x175913){var _0x29f4cc=JSON[_0x86ee('0x14')](_0x175913);switch(_0x29f4cc[_0x86ee('0x15')]){case 0x0:if(_0x29f4cc[_0x86ee('0x16')]){if(_0x29f4cc[_0x86ee('0x16')][_0x86ee('0x17')]){logger['info'](_0x86ee('0x18'),JSON[_0x86ee('0xd')](_0x29f4cc[_0x86ee('0x16')][_0x86ee('0x19')]));_0x47d72a=_0x29f4cc[_0x86ee('0x16')][_0x86ee('0x19')][0x0]['transcript'];_0x5ee41c=_0x29f4cc[_0x86ee('0x16')][_0x86ee('0x19')][0x0][_0x86ee('0x1a')];_0x22836d='0';_0x1c2529=_0x86ee('0x1b');_0x5aec8a['terminate']();}}break;case 0x1:logger[_0x86ee('0x1c')](_0x86ee('0x7'));_0x22836d='1';_0x1c2529='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x86ee('0x1c')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x22836d='2';_0x1c2529=_0x86ee('0x1d');break;case 0x9:logger[_0x86ee('0x1c')](_0x86ee('0x1e'));_0x22836d='9';_0x1c2529=_0x86ee('0x1e');break;case 0xa:logger[_0x86ee('0x1c')]('Authentication\x20failed.');_0x22836d='10';_0x1c2529=_0x86ee('0x1f');break;case 0xb:logger[_0x86ee('0x1c')](_0x86ee('0x20'));_0x22836d='11';_0x1c2529=_0x86ee('0x20');}}}catch(_0x5d08c7){logger[_0x86ee('0x11')](_0x86ee('0x21'),JSON[_0x86ee('0xd')](_0x5d08c7));_0x5aec8a[_0x86ee('0x13')]();}}function _0x19d4bb(){logger[_0x86ee('0x1c')](_0x86ee('0x22'));_0x3bb1c5({'transcript':_0x47d72a,'confidence':_0x5ee41c,'status':_0x22836d,'status_message':_0x1c2529});}function _0x3a9a62(_0x1f5937){logger[_0x86ee('0x11')](_0x86ee('0x23'));if(!_[_0x86ee('0x24')](_0x1f5937)){logger['error'](_[_0x86ee('0x25')](_0x1f5937)?JSON[_0x86ee('0xd')](_0x1f5937):_0x1f5937);}}_0x5aec8a['on'](_0x86ee('0x26'),_0xcd851f);_0x5aec8a['on'](_0x86ee('0x27'),_0x4a3c02);_0x5aec8a['on'](_0x86ee('0xf'),_0x19d4bb);_0x5aec8a['on'](_0x86ee('0x11'),_0x3a9a62);});}; \ No newline at end of file +var _0xb4dd=['stringify','parse','status','result','final','hypotheses','transcript','likelihood','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error'];(function(_0x2c72eb,_0x39429e){var _0x8b232c=function(_0xddc25b){while(--_0xddc25b){_0x2c72eb['push'](_0x2c72eb['shift']());}};_0x8b232c(++_0x39429e);}(_0xb4dd,0x184));var _0xdb4d=function(_0x24cdc6,_0x269fe8){_0x24cdc6=_0x24cdc6-0x0;var _0x5610a0=_0xb4dd[_0x24cdc6];return _0x5610a0;};'use strict';var BPromise=require(_0xdb4d('0x0'));var _=require(_0xdb4d('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xdb4d('0x2'));var crypto=require('crypto');var logger=require(_0xdb4d('0x3'))(_0xdb4d('0x4'));module[_0xdb4d('0x5')]=function(_0x530c56,_0x5a599e,_0x4c0c7f,_0x4c96ca){return new BPromise(function(_0x4fa51a,_0x29dcca){logger[_0xdb4d('0x6')](_0xdb4d('0x7'),_0x4c96ca||_0xdb4d('0x8'));var _0x12793e=new WebSocket(_0x4c96ca||_0xdb4d('0x8'),{'perMessageDeflate':![]});var _0x4e3755='';var _0x4cf003='0';var _0x3bdaba='1';var _0x186eac=_0xdb4d('0x9');function _0x45a48c(_0x5724f8){var _0x10135c=crypto[_0xdb4d('0xa')](_0xdb4d('0xb'));_0x10135c['update'](_0x5724f8);return _0x10135c[_0xdb4d('0xc')](_0xdb4d('0xd'));}function _0x3d5fff(){try{logger[_0xdb4d('0x6')](_0xdb4d('0xe'));var _0x147e43=moment()[_0xdb4d('0xf')]();var _0x370d68=_0x45a48c(_0x147e43+_0x5a599e+_0x4c0c7f);_0x12793e[_0xdb4d('0x10')](JSON['stringify']({'appID':_0x5a599e,'timestamp':_0x147e43,'appKey':_0x370d68}));var _0x3ac1c8=fs[_0xdb4d('0x11')](_0x530c56);_0x3ac1c8['on']('data',function(_0x11c68a){_0x12793e[_0xdb4d('0x10')](_0x11c68a);});_0x3ac1c8['on'](_0xdb4d('0x12'),function(){_0x12793e[_0xdb4d('0x10')](_0xdb4d('0x13'));});}catch(_0x180404){logger[_0xdb4d('0x14')](_0xdb4d('0x15'),JSON[_0xdb4d('0x16')](_0x180404));_0x12793e['terminate']();}}function _0x4fa179(_0x3cad6d){try{if(_0x3cad6d){var _0x4d3ac3=JSON[_0xdb4d('0x17')](_0x3cad6d);switch(_0x4d3ac3[_0xdb4d('0x18')]){case 0x0:if(_0x4d3ac3[_0xdb4d('0x19')]){if(_0x4d3ac3['result'][_0xdb4d('0x1a')]){logger[_0xdb4d('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0xdb4d('0x16')](_0x4d3ac3[_0xdb4d('0x19')][_0xdb4d('0x1b')]));_0x4e3755=_0x4d3ac3['result']['hypotheses'][0x0][_0xdb4d('0x1c')];_0x4cf003=_0x4d3ac3[_0xdb4d('0x19')]['hypotheses'][0x0][_0xdb4d('0x1d')];_0x3bdaba='0';_0x186eac='Success.';_0x12793e[_0xdb4d('0x1e')]();}}break;case 0x1:logger['info'](_0xdb4d('0x9'));_0x3bdaba='1';_0x186eac=_0xdb4d('0x9');break;case 0x2:logger[_0xdb4d('0x6')](_0xdb4d('0x1f'));_0x3bdaba='2';_0x186eac=_0xdb4d('0x1f');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3bdaba='9';_0x186eac=_0xdb4d('0x20');break;case 0xa:logger[_0xdb4d('0x6')](_0xdb4d('0x21'));_0x3bdaba='10';_0x186eac=_0xdb4d('0x21');break;case 0xb:logger[_0xdb4d('0x6')](_0xdb4d('0x22'));_0x3bdaba='11';_0x186eac='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x4a12e1){logger[_0xdb4d('0x14')](_0xdb4d('0x23'),JSON[_0xdb4d('0x16')](_0x4a12e1));_0x12793e['terminate']();}}function _0xad2d6(){logger[_0xdb4d('0x6')](_0xdb4d('0x24'));_0x4fa51a({'transcript':_0x4e3755,'confidence':_0x4cf003,'status':_0x3bdaba,'status_message':_0x186eac});}function _0x2e2bd1(_0x419d11){logger[_0xdb4d('0x14')](_0xdb4d('0x25'));if(!_[_0xdb4d('0x26')](_0x419d11)){logger[_0xdb4d('0x14')](_[_0xdb4d('0x27')](_0x419d11)?JSON['stringify'](_0x419d11):_0x419d11);}}_0x12793e['on']('open',_0x3d5fff);_0x12793e['on'](_0xdb4d('0x28'),_0x4fa179);_0x12793e['on'](_0xdb4d('0x12'),_0xad2d6);_0x12793e['on'](_0xdb4d('0x14'),_0x2e2bd1);});}; \ 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 470f54f..0095f2d 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 _0x9d66=['./asr','exports'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0x9d66,0x1ce));var _0x69d6=function(_0x2a5edb,_0x31a2e7){_0x2a5edb=_0x2a5edb-0x0;var _0x55b07c=_0x9d66[_0x2a5edb];return _0x55b07c;};var asr=require(_0x69d6('0x0'));module[_0x69d6('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4826=['exports','./asr'];(function(_0x3d0528,_0x21a0b7){var _0x4ebb2d=function(_0x536ec8){while(--_0x536ec8){_0x3d0528['push'](_0x3d0528['shift']());}};_0x4ebb2d(++_0x21a0b7);}(_0x4826,0xb3));var _0x6482=function(_0x322722,_0x21e2cf){_0x322722=_0x322722-0x0;var _0x46b082=_0x4826[_0x322722];return _0x46b082;};var asr=require(_0x6482('0x0'));module[_0x6482('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 44f6e9a..013c8b2 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x45ce90,_0x114609){var _0x313c45=function(_0x55102a){while(--_0x55102a){_0x45ce90['push'](_0x45ce90['shift']());}};_0x313c45(++_0x114609);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index e0cbe22..f4bac99 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 _0xafdd=['close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentLogout','agentLogin','internal','LOCAL','shellCommand','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','includes','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','.wav','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','out','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','generate','beep','NOBEEP','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','isEmpty','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','%s_STATUS_CODE','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','Smtp','user','subject','template_id','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','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','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','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','unpause','agentUnpause','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','then','catch','getVoiceQueue','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s'];(function(_0x3a718b,_0x3134ae){var _0x576b76=function(_0x237370){while(--_0x237370){_0x3a718b['push'](_0x3a718b['shift']());}};_0x576b76(++_0x3134ae);}(_0xafdd,0x19a));var _0xdafd=function(_0x4aaa95,_0x2b9c98){_0x4aaa95=_0x4aaa95-0x0;var _0x29e0d0=_0xafdd[_0x4aaa95];return _0x29e0d0;};'use strict';var fs=require('fs');var util=require(_0xdafd('0x0'));var _=require(_0xdafd('0x1'));var sh=require(_0xdafd('0x2'));var odbc=require(_0xdafd('0x3'))();var rs=require(_0xdafd('0x4'));var moment=require(_0xdafd('0x5'));var Mustache=require(_0xdafd('0x6'));var rp=require(_0xdafd('0x7'));var logger=require('../../config/logger')(_0xdafd('0x8'));var config=require(_0xdafd('0x9'));var scripts=require(_0xdafd('0xa'));var FILES_PATH=_0xdafd('0xb');var recursiveMapAttributes=[_0xdafd('0xc'),_0xdafd('0xd')];var verticesWithRetry=[_0xdafd('0xe'),'getdigits',_0xdafd('0xf')];var AGIVertices=function(_0x385520,_0x7a279f,_0x48000b){this[_0xdafd('0x10')]=_0x385520;this[_0xdafd('0x11')]=_0x7a279f;this[_0xdafd('0x12')]=_0x48000b;};AGIVertices[_0xdafd('0x13')]['getVariable']=function(_0x42373f,_0x2fec30){this[_0xdafd('0x11')][_0xdafd('0x14')](_0x42373f)[_0xdafd('0x15')](function(_0x3bf1f7){_0x2fec30(null,_0x3bf1f7?_0x3bf1f7['name']:![]);})[_0xdafd('0x16')](function(_0x594f47){_0x2fec30(_0x594f47);});};AGIVertices['prototype'][_0xdafd('0x17')]=function(_0x35d2e5,_0x55b05a){this[_0xdafd('0x11')]['getVoiceQueueById'](_0x35d2e5)['then'](function(_0x1c312d){_0x55b05a(null,_0x1c312d?_0x1c312d[_0xdafd('0x18')]:![]);})[_0xdafd('0x16')](function(_0x267bfc){_0x55b05a(_0x267bfc);});};AGIVertices[_0xdafd('0x13')]['getSquareProject']=function(_0x47240f,_0x1842d3){this[_0xdafd('0x11')]['getSquareProjectById'](_0x47240f)[_0xdafd('0x15')](function(_0x15beca){_0x1842d3(null,_0x15beca?_0x15beca['name']:![]);})['catch'](function(_0x2569b2){_0x1842d3(_0x2569b2);});};AGIVertices['prototype'][_0xdafd('0x19')]=function(_0x341d3d,_0x1e64d3){this[_0xdafd('0x11')][_0xdafd('0x1a')](_0x341d3d)[_0xdafd('0x15')](function(_0x44f825){_0x1e64d3(null,_0x44f825?_0x44f825[_0xdafd('0x1b')]:![]);})[_0xdafd('0x16')](function(_0x10c353){_0x1e64d3(_0x10c353);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1c')]=function(_0xa6ddd7,_0xf4a521){this['rpc'][_0xdafd('0x1d')](_0xa6ddd7)['then'](function(_0x31bcd1){_0xf4a521(null,_0x31bcd1?_0x31bcd1['name']:![]);})[_0xdafd('0x16')](function(_0x35ef78){_0xf4a521(_0x35ef78);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1e')]=function(_0xfc36d7,_0x31cf35){this[_0xdafd('0x11')][_0xdafd('0x1f')](_0xfc36d7)[_0xdafd('0x15')](function(_0x5cd11d){_0x31cf35(null,_0x5cd11d?_0x5cd11d[_0xdafd('0x18')]:![]);})[_0xdafd('0x16')](function(_0x18554c){_0x31cf35(_0x18554c);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x20')]=function(_0x25f277,_0x383845){var _0x29037e=this;this[_0xdafd('0x11')][_0xdafd('0x21')](_0x25f277)['then'](function(_0x243182){_0x383845(null,_0x243182?_0x29037e[_0xdafd('0x22')](_0x243182[_0xdafd('0x23')]):![]);})[_0xdafd('0x16')](function(_0x21edb6){_0x383845(_0x21edb6);});};AGIVertices[_0xdafd('0x13')]['getMailAccount']=function(_0x549bf2,_0x512562){this[_0xdafd('0x11')][_0xdafd('0x24')](_0x549bf2)['then'](function(_0x4f6cb1){_0x512562(null,_0x4f6cb1?_0x4f6cb1:![]);})[_0xdafd('0x16')](function(_0x3e7b4d){_0x512562(_0x3e7b4d);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x25')]=function(_0x2339c3,_0xa8b2ac,_0x3e1287){this['mailRpc'][_0xdafd('0x25')](_0x2339c3,_0xa8b2ac)[_0xdafd('0x15')](function(){_0x3e1287(null);})[_0xdafd('0x16')](function(_0x500504){_0x3e1287(_0x500504);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x26')]=function(_0x5e0995,_0x5e785a){this[_0xdafd('0x11')][_0xdafd('0x27')](_0x5e0995)['then'](function(_0x41cf77){if(_0x41cf77){if(_0x41cf77[_0xdafd('0x28')]){_0x5e785a(null,[_0x41cf77[_0xdafd('0x29')]]);}else{_0x5e785a(null,_[_0xdafd('0x2a')](_0x41cf77[_0xdafd('0x2b')],_0xdafd('0x29')));}}else{_0x5e785a(null,![]);}})[_0xdafd('0x16')](function(_0x5dc9f2){_0x5e785a(_0x5dc9f2);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x22')]=function(_0x2a711d){return util[_0xdafd('0x2c')](_0xdafd('0x2d'),FILES_PATH,_0x2a711d);};AGIVertices['prototype'][_0xdafd('0x2e')]=function(_0x21d724,_0x501470,_0x3dbdb1){odbc[_0xdafd('0x2f')](_0x21d724,function(_0x360b94){if(_0x360b94){logger[_0xdafd('0x30')](_0xdafd('0x31'),_0x360b94);_0x3dbdb1(_0x360b94);}else{logger[_0xdafd('0x32')](_0xdafd('0x33'));odbc[_0xdafd('0x34')](_0x501470,function(_0x19c501,_0x436201){if(_0x19c501){logger[_0xdafd('0x32')](_0xdafd('0x35'),_0x501470);_0x3dbdb1(_0x19c501);}else{logger[_0xdafd('0x32')](_0xdafd('0x36'),_0x501470);odbc[_0xdafd('0x37')](function(_0x401964){if(_0x401964){logger[_0xdafd('0x30')](_0xdafd('0x38'),_0x401964);}_0x3dbdb1(null,_0x436201);});}});}});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x39')]=function(_0x3f25c2,_0x2605d2){this[_0xdafd('0x11')][_0xdafd('0x3a')](_0x3f25c2)[_0xdafd('0x15')](function(_0x21d43d){_0x2605d2(null,_0x21d43d?_0x21d43d:![]);})['catch'](function(_0x5e68a7){_0x2605d2(_0x5e68a7);});};AGIVertices[_0xdafd('0x13')]['createSmsMessage']=function(_0x12d1ab,_0xde0f32){this['rpc']['createSmsMessage'](_0x12d1ab)[_0xdafd('0x15')](function(_0x3382d3){_0xde0f32(null,_0x3382d3);})[_0xdafd('0x16')](function(_0x1b0e3a){_0xde0f32(_0x1b0e3a);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x3b')]=function(_0x3a3a14,_0x2417f8,_0x11446c){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xdafd('0x10')][_0xdafd('0x3c')],'node':_0x3a3a14[_0xdafd('0x3d')],'application':_0x3a3a14[_0xdafd('0x3e')],'data':_0x2417f8||null,'project_name':this[_0xdafd('0x10')][_0xdafd('0x3f')],'callerid':this[_0xdafd('0x10')][_0xdafd('0x40')]})[_0xdafd('0x15')](function(_0x4694f1){if(_0x11446c){_0x11446c(null,_0x4694f1);}})[_0xdafd('0x16')](function(_0x3a9505){if(_0x11446c){_0x11446c(_0x3a9505);}});};AGIVertices[_0xdafd('0x13')]['createSquareRecording']=function(_0x43c44a,_0x536227,_0x57aea9,_0x4d30c3){this[_0xdafd('0x11')][_0xdafd('0x41')]({'uniqueid':this[_0xdafd('0x10')][_0xdafd('0x3c')],'callerid':this[_0xdafd('0x10')][_0xdafd('0x40')],'calleridname':this['channel'][_0xdafd('0x42')],'context':this[_0xdafd('0x10')][_0xdafd('0x43')],'extension':this[_0xdafd('0x10')][_0xdafd('0x44')],'priority':this['channel']['priority'],'accountcode':this[_0xdafd('0x10')][_0xdafd('0x45')],'dnid':this[_0xdafd('0x10')][_0xdafd('0x46')],'projectName':this[_0xdafd('0x10')][_0xdafd('0x3f')],'saveName':_0x536227,'filename':_0x43c44a[_0xdafd('0x47')]||_0x536227,'savePath':_0x57aea9})[_0xdafd('0x15')](function(_0x2ae4cd){_0x4d30c3(null,_0x2ae4cd);})['catch'](function(_0x6f2f39){_0x4d30c3(_0x6f2f39);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x48')]=function(_0x4555f1,_0x4f204a,_0xf8fcb8,_0x343ef5,_0x254824){this[_0xdafd('0x11')][_0xdafd('0x48')]({'uniqueid':this['channel']['uniqueid'],'body':_0x4555f1,'direction':_0x4f204a,'providerName':_0xf8fcb8,'providerResponse':_0x343ef5})[_0xdafd('0x15')](function(_0x261dc1){if(_0x254824){_0x254824(null,_0x261dc1);}})['catch'](function(_0x5334c3){if(_0x254824){_0x254824(_0x5334c3);}});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x49')]=function(_0x4b138b,_0x2dde06){this[_0xdafd('0x11')][_0xdafd('0x49')]({'firstName':_['isEmpty'](_0x4b138b['name'])||_[_0xdafd('0x4a')](_0x4b138b[_0xdafd('0x18')])?'callback_'+Math[_0xdafd('0x4b')]():_0x4b138b['name'],'lastName':_['isEmpty'](_0x4b138b[_0xdafd('0x4c')])||_[_0xdafd('0x4a')](_0x4b138b[_0xdafd('0x4c')])?null:_0x4b138b[_0xdafd('0x4c')],'phone':_0x4b138b[_0xdafd('0x4d')],'ListId':_0x4b138b[_0xdafd('0x4e')],'scheduledat':_0x4b138b[_0xdafd('0x4f')],'callbackUniqueid':this[_0xdafd('0x10')]['uniqueid'],'tags':_0xdafd('0x50'),'description':_0xdafd('0x51')+_0x4b138b['scheduledAt'][_0xdafd('0x52')](),'priority':_0x4b138b[_0xdafd('0x53')]})[_0xdafd('0x15')](function(_0x126529){_0x2dde06(null,_0x126529);})[_0xdafd('0x16')](function(_0x556f7e){_0x2dde06(_0x556f7e);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x54')]=function(_0x32340c,_0x3f480c){this[_0xdafd('0x11')]['getPauseById'](_0x32340c)[_0xdafd('0x15')](function(_0x810d30){_0x3f480c(null,_0x810d30?_0x810d30['name']:![]);})['catch'](function(_0x219a25){_0x3f480c(_0x219a25);});};AGIVertices['prototype'][_0xdafd('0x55')]=function(_0x4a8ca1,_0x47130c,_0x12c412){var _0x403a3b={'role':'agent'};_0x403a3b[_0x4a8ca1]=this[_0xdafd('0x10')]['callerid'];this[_0xdafd('0x11')][_0xdafd('0x55')](_0x403a3b,_0x47130c,this['channel'][_0xdafd('0x3c')])[_0xdafd('0x15')](function(_0x2846aa){_0x12c412(null,_[_0xdafd('0x4a')](_0x2846aa)?![]:!![]);})[_0xdafd('0x16')](function(_0x4a651e){logger[_0xdafd('0x30')](_0x4a651e);_0x12c412(null,![]);});};AGIVertices[_0xdafd('0x13')]['agentUnpause']=function(_0x316699,_0x46b3fb){var _0x1f5cd2={'role':_0xdafd('0x56')};_0x1f5cd2[_0x316699]=this[_0xdafd('0x10')]['callerid'];this[_0xdafd('0x11')]['agentUnpause'](_0x1f5cd2)['then'](function(_0x2bac93){_0x46b3fb(null,_['isNil'](_0x2bac93)?![]:!![]);})[_0xdafd('0x16')](function(_0x221822){logger[_0xdafd('0x30')](_0x221822);_0x46b3fb(null,![]);});};AGIVertices[_0xdafd('0x13')]['agentLogout']=function(_0x2a9785,_0x40f234){var _0x3f080b={'role':_0xdafd('0x56')};_0x3f080b[_0x2a9785]=this[_0xdafd('0x10')][_0xdafd('0x40')];this[_0xdafd('0x11')][_0xdafd('0x57')](_0x3f080b)[_0xdafd('0x15')](function(_0xbd4ab5){_0x40f234(null,_[_0xdafd('0x4a')](_0xbd4ab5)?![]:!![]);})[_0xdafd('0x16')](function(_0x24a8f2){logger[_0xdafd('0x30')](_0x24a8f2);_0x40f234(null,![]);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x58')]=function(_0x190930,_0x54267d){var _0x30cef1={'role':'agent'};_0x30cef1[_0x190930]=this[_0xdafd('0x10')]['callerid'];var _0x378243=_0x190930!=_0xdafd('0x59')?util['format']('%s/%s@from-sip/n',_0xdafd('0x5a'),this[_0xdafd('0x10')][_0xdafd('0x40')]):undefined;this['rpc']['agentLogin'](_0x30cef1,_0x378243)['then'](function(_0xfe8337){_0x54267d(null,_['isNil'](_0xfe8337)?![]:!![]);})[_0xdafd('0x16')](function(_0x5ee392){logger[_0xdafd('0x30')](_0x5ee392);_0x54267d(null,![]);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x5b')]=function(_0x27e2c9,_0x3f64fe){sh['exec'](_['trim'](_0x27e2c9),function(_0x17b2a9,_0x58b353){var _0x26d218=_0x58b353[_0xdafd('0x5c')](/(\r\n|\n|\r)/gm,'');_0x3f64fe(null,_0x26d218);});};AGIVertices['prototype'][_0xdafd('0x5d')]=function(_0x397a4e,_0x4bfc18){scripts[_0xdafd('0x5d')](_0x397a4e[_0xdafd('0x5e')],_0x397a4e[_0xdafd('0x5f')]||_0xdafd('0x60'),_0x397a4e[_0xdafd('0x60')],_0x397a4e['languageCode']||_0xdafd('0x61'),_0x397a4e[_0xdafd('0x62')]||'MALE',_0x397a4e[_0xdafd('0x63')]||_0xdafd('0x64'))['then'](function(_0x28b09a){_0x4bfc18(null,_0x28b09a);})[_0xdafd('0x16')](function(_0x56adcd){_0x4bfc18(_0x56adcd);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x65')]=function(_0x1e47bf,_0x547571){scripts[_0xdafd('0x65')](_0x1e47bf[_0xdafd('0x60')],_0x1e47bf[_0xdafd('0x66')]||'en',0x1)[_0xdafd('0x15')](function(_0x4ad46f){_0x547571(null,_0x4ad46f);})['catch'](function(_0x42138e){_0x547571(_0x42138e);});};AGIVertices[_0xdafd('0x13')]['restAPI']=function(_0x3bbf21,_0x3d3862){var _0x6f3fec={'uri':_0x3bbf21[_0xdafd('0x67')],'method':_0x3bbf21[_0xdafd('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3bbf21[_0xdafd('0x69')])==='number'&&parseInt(_0x3bbf21[_0xdafd('0x69')])>=0x1?parseInt(_0x3bbf21[_0xdafd('0x69')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xdafd('0x6a'),_0xdafd('0x6b')],_0x6f3fec[_0xdafd('0x68')][_0xdafd('0x6c')]())){try{_0x6f3fec[_0xdafd('0x6d')]=_0x3bbf21[_0xdafd('0xd')]?JSON[_0xdafd('0x6e')](_0x3bbf21[_0xdafd('0xd')]):{};}catch(_0x28f9b3){logger[_0xdafd('0x30')](_0xdafd('0x6f'),_0x28f9b3);}}try{_0x6f3fec['headers']=_0x3bbf21[_0xdafd('0xc')]?JSON[_0xdafd('0x6e')](_0x3bbf21[_0xdafd('0xc')]):{};}catch(_0x42da9f){logger[_0xdafd('0x30')](_0xdafd('0x70'),_0x42da9f);}if(_0x3bbf21[_0xdafd('0x71')]){try{var _0x207098=require(_0x3bbf21[_0xdafd('0x71')])[_0xdafd('0x72')](this,_0x6f3fec);_0x6f3fec[_0xdafd('0x73')]=Mustache['render'](_0x3bbf21[_0xdafd('0x67')],_0x207098,{},['$$','$$']);if(_0x6f3fec[_0xdafd('0x74')]){_0x6f3fec['headers']=JSON[_0xdafd('0x6e')](Mustache[_0xdafd('0x75')](JSON[_0xdafd('0x76')](_0x6f3fec['headers']),_0x207098,{},['$$','$$']));}if(_0x6f3fec[_0xdafd('0x6d')]){_0x6f3fec['body']=JSON[_0xdafd('0x6e')](Mustache[_0xdafd('0x75')](JSON['stringify'](_0x6f3fec[_0xdafd('0x6d')]),_0x207098,{},['$$','$$']));}}catch(_0x1f8091){logger[_0xdafd('0x30')](_0xdafd('0x77'),_0x1f8091);}}rp(_0x6f3fec)[_0xdafd('0x15')](function(_0x2d8032){var _0x3328b1={'statusCode':_0x2d8032[_0xdafd('0x78')]||0xc8,'statusMessage':_0x2d8032[_0xdafd('0x79')]||'OK','headers':_0x2d8032[_0xdafd('0x74')]||{},'body':_0x2d8032[_0xdafd('0x6d')]||{}};_0x3d3862(null,_0x3328b1);})[_0xdafd('0x16')](function(_0x4f6984){var _0x5d8327={'statusCode':_0x4f6984[_0xdafd('0x78')]||0x1f4,'statusMessage':_0x4f6984[_0xdafd('0x7a')]||_0xdafd('0x7b'),'headers':_0x4f6984[_0xdafd('0x7c')][_0xdafd('0x74')]||{},'body':_0x4f6984[_0xdafd('0x7c')][_0xdafd('0x6d')]||{}};_0x3d3862(null,_0x5d8327);});};AGIVertices[_0xdafd('0x13')]['googleDialogflow']=function(_0x705220,_0x368142){scripts[_0xdafd('0x7d')](this[_0xdafd('0x10')]['uniqueid'],_0x705220['key'],_0x705220['text'],_0x705220[_0xdafd('0x7e')]||'en')['then'](function(_0x2f25d5){_0x368142(null,_0x2f25d5);})[_0xdafd('0x16')](function(_0x143221){_0x368142(_0x143221);});};AGIVertices[_0xdafd('0x13')]['googleDialogflowV2']=function(_0xed0633,_0x16172d){scripts[_0xdafd('0x7f')](this[_0xdafd('0x10')][_0xdafd('0x3c')],_0xed0633['dialogflowV2_project_id'],_0xed0633[_0xdafd('0x80')],_0xed0633['private_key'],_0xed0633[_0xdafd('0x60')],_0xed0633[_0xdafd('0x81')]||'en')['then'](function(_0x352f74){_0x16172d(null,_0x352f74);})[_0xdafd('0x16')](function(_0x4d4d66){_0x16172d(_0x4d4d66);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x82')]=function(_0x1387da,_0x54d7db){scripts[_0xdafd('0x82')](this['channel'],_0x1387da)[_0xdafd('0x15')](function(_0x1d8287){_0x54d7db(null,_0x1d8287);})[_0xdafd('0x16')](function(_0x2d5dd4){_0x54d7db(_0x2d5dd4);});};AGIVertices['prototype']['ispeechTTS']=function(_0x393693,_0x1a6070){scripts[_0xdafd('0x83')](_0x393693[_0xdafd('0x84')],_0x393693[_0xdafd('0x60')],_0x393693[_0xdafd('0x85')]||_0xdafd('0x61'),_0x393693[_0xdafd('0x86')])['then'](function(_0xc3f3af){_0x1a6070(null,_0xc3f3af);})[_0xdafd('0x16')](function(_0x105d18){_0x1a6070(_0x105d18);});};AGIVertices[_0xdafd('0x13')]['ispeechASR']=function(_0x2fd239,_0x342ed1,_0x4e5072){scripts[_0xdafd('0x87')](_0x342ed1,_0x2fd239[_0xdafd('0x84')],_0x2fd239['ispeech_asr_language']||_0xdafd('0x61'),this['isConfigured'](_0x2fd239[_0xdafd('0x88')])?_0x2fd239[_0xdafd('0x88')]:undefined)[_0xdafd('0x15')](function(_0x1ae8d1){_0x4e5072(null,_0x1ae8d1);})['catch'](function(_0x5b5236){_0x4e5072(_0x5b5236);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x89')]=function(_0x5e16af,_0x258696){scripts[_0xdafd('0x89')](_0x5e16af[_0xdafd('0x8a')],_0x5e16af[_0xdafd('0x8b')],_0x5e16af['aws_polly_region'],_0x5e16af[_0xdafd('0x8c')]||'Amy',_0x5e16af[_0xdafd('0x60')],_0x5e16af[_0xdafd('0x8d')]||_0xdafd('0x60'))['then'](function(_0x3d1d8e){_0x258696(null,_0x3d1d8e);})['catch'](function(_0x186980){_0x258696(_0x186980);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x8e')]=function(_0x3fa782,_0x1dfb3e){scripts[_0xdafd('0x8e')](this[_0xdafd('0x10')]['uniqueid'],_0x3fa782[_0xdafd('0x8a')],_0x3fa782[_0xdafd('0x8b')],_0x3fa782[_0xdafd('0x8f')],_0x3fa782['text'],_0x3fa782[_0xdafd('0x90')])['then'](function(_0x82945c){_0x1dfb3e(null,_0x82945c);})[_0xdafd('0x16')](function(_0x2bceca){_0x1dfb3e(_0x2bceca);});};AGIVertices[_0xdafd('0x13')]['googleASR']=function(_0x470e0b,_0x2ab87a,_0x5ffaaf){scripts[_0xdafd('0x91')](_0x2ab87a,_0x470e0b[_0xdafd('0x84')],_0x470e0b['google_asr_language']||_0xdafd('0x61'))['then'](function(_0x1268f2){_0x5ffaaf(null,_0x1268f2);})[_0xdafd('0x16')](function(_0x5e404e){_0x5ffaaf(_0x5e404e);});};AGIVertices['prototype'][_0xdafd('0x92')]=function(_0x214ea6,_0x519d21,_0x440a3f){scripts['tildeASR'](_0x519d21,_0x214ea6[_0xdafd('0x93')],_0x214ea6[_0xdafd('0x94')],_0x214ea6[_0xdafd('0x73')])[_0xdafd('0x15')](function(_0x1175a8){_0x440a3f(null,_0x1175a8);})[_0xdafd('0x16')](function(_0x143526){_0x440a3f(_0x143526);});};AGIVertices[_0xdafd('0x13')][_0xdafd('0x95')]=function(_0x227a8e){var _0x42fd4a=_[_0xdafd('0x96')](verticesWithRetry,_0x227a8e[_0xdafd('0x3e')])?_0x227a8e:_['clone'](_0x227a8e);for(var _0x2eb72e in _0x42fd4a){if(_0x42fd4a[_0xdafd('0x97')](_0x2eb72e)){if(_0x42fd4a[_0x2eb72e]&&_[_0xdafd('0x98')](_0x42fd4a[_0x2eb72e])){if(_['includes'](recursiveMapAttributes,_0x2eb72e)){_0x42fd4a[_0x2eb72e]=this[_0xdafd('0x99')](_0x42fd4a[_0x2eb72e]);}else{_0x42fd4a[_0x2eb72e]=this['replaceAllVariables'](_0x42fd4a[_0x2eb72e]);}}}}return _0x42fd4a;};AGIVertices[_0xdafd('0x13')][_0xdafd('0x9a')]=function(_0x677036){for(var _0x418fcc in _0x677036){if(_0x677036['hasOwnProperty'](_0x418fcc)){if(_[_0xdafd('0x9b')](_0x677036[_0x418fcc])){this[_0xdafd('0x9a')](_0x677036[_0x418fcc]);}else if(_[_0xdafd('0x9c')](_0x677036[_0x418fcc])){for(var _0x1fb5c3=0x0;_0x1fb5c3<_0x677036[_0x418fcc][_0xdafd('0x9d')];_0x1fb5c3++){this[_0xdafd('0x9a')](_0x677036[_0x418fcc][_0x1fb5c3]);}}else if(_[_0xdafd('0x98')](_0x677036[_0x418fcc])){_0x677036[_0x418fcc]=this[_0xdafd('0x9e')](_0x677036[_0x418fcc]);}}}};AGIVertices[_0xdafd('0x13')]['saveRestApiResult']=function(_0xd7384e,_0x47e4a2){for(var _0x5cbc6f in _0xd7384e){if(_0xd7384e[_0xdafd('0x97')](_0x5cbc6f)){if(_[_0xdafd('0x9b')](_0xd7384e[_0x5cbc6f])){if(!_['isEmpty'](_0xd7384e[_0x5cbc6f])){this[_0xdafd('0x9f')](_0xd7384e[_0x5cbc6f],util[_0xdafd('0x2c')](_0xdafd('0xa0'),_0x47e4a2,_0x5cbc6f));}}else if(_[_0xdafd('0x9c')](_0xd7384e[_0x5cbc6f])){for(var _0x5a49ab=0x0;_0x5a49ab<_0xd7384e[_0x5cbc6f][_0xdafd('0x9d')];_0x5a49ab++){this[_0xdafd('0x9f')](_0xd7384e[_0x5cbc6f][_0x5a49ab],util[_0xdafd('0x2c')](_0xdafd('0xa0'),_0x47e4a2,_0x5cbc6f+'['+_0x5a49ab+']'));}}else{if(!_[_0xdafd('0x4a')](_0xd7384e[_0x5cbc6f])){this[_0xdafd('0x10')][_0xdafd('0xa1')](util[_0xdafd('0x2c')](_0xdafd('0xa0'),_0x47e4a2,_0x5cbc6f),_0xd7384e[_0x5cbc6f]);}}}}};AGIVertices[_0xdafd('0x13')][_0xdafd('0x99')]=function(_0x52d5fc){try{var _0x5bf65a=JSON[_0xdafd('0x6e')](_0x52d5fc);this[_0xdafd('0x9a')](_0x5bf65a);return JSON[_0xdafd('0x76')](_0x5bf65a);}catch(_0x4d862a){return this['replaceAllVariables'](_0x52d5fc);}};AGIVertices[_0xdafd('0x13')]['replaceAllVariables']=function(_0x3a34d4){var _0x382d68=_0x3a34d4[_0xdafd('0xa2')]('{');for(var _0x48acb9=0x1;_0x48acb9<_0x382d68[_0xdafd('0x9d')];_0x48acb9+=0x1){var _0x13d7e9=_0x382d68[_0x48acb9][_0xdafd('0xa2')]('}');if(_0x13d7e9['length']>0x1){_0x3a34d4=_0x3a34d4[_0xdafd('0xa3')]('{'+_0x13d7e9[0x0]+'}',this[_0xdafd('0x10')][_0xdafd('0xa4')](_0x13d7e9[0x0])[_0xdafd('0xa5')]||_0x13d7e9[0x0]);}}if(_0x382d68[_0xdafd('0x9d')]===0x1){return _0x3a34d4[_0xdafd('0x52')]();}return this[_0xdafd('0x9e')](_0x3a34d4);};AGIVertices['prototype'][_0xdafd('0xa6')]=function(_0x44d6f4,_0x54ae4d){var _0x2f7717=this[_0xdafd('0x10')][_0xdafd('0xa4')](_0x44d6f4);if(_0x2f7717[_0xdafd('0xa7')]===-0x1){return _0x2f7717;}logger['info'](util[_0xdafd('0x2c')](_0xdafd('0xa8'),_0x54ae4d,_0x2f7717[_0xdafd('0xa5')]));return this['channel']['setVariable'](_0x54ae4d,_0x2f7717['extra']);};AGIVertices[_0xdafd('0x13')][_0xdafd('0xa9')]=function(_0x440ba8){return _0x440ba8&&_0x440ba8!=='0'&&_0x440ba8!=='-1'&&_0x440ba8!=='';};AGIVertices[_0xdafd('0x13')][_0xdafd('0xaa')]=function(_0x3b115f){this[_0xdafd('0x3b')]['sync'](this,_0x3b115f,'-');_0x3b115f[_0xdafd('0xab')]=_0x3b115f['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xdafd('0x13')][_0xdafd('0xac')]=function(_0x208eaf){logger[_0xdafd('0x32')](util['format'](_0xdafd('0xad'),_0x208eaf['label']));if(!this[_0xdafd('0xa9')](_0x208eaf['text'])){return this['channel'][_0xdafd('0xae')](_0xdafd('0xaf'));}var _0x4b988a='\x22'+_0x208eaf[_0xdafd('0x60')]+'\x22';if(this['isConfigured'](_0x208eaf[_0xdafd('0x7c')])){_0x4b988a+=','+_0x208eaf[_0xdafd('0x7c')];}var _0x1f65b5=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0xdafd('0xb1'),_0x4b988a);if(_0x1f65b5[_0xdafd('0xa7')]===-0x1){return _0x1f65b5;}return this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0xb2'),_0x4b988a));};AGIVertices['prototype'][_0xdafd('0xb3')]=function(_0x2fecf0){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0xb4'),_0x2fecf0[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x2fecf0[_0xdafd('0xb5')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xb6'));}var _0x54323b=_0x2fecf0[_0xdafd('0xb5')];if(this[_0xdafd('0xa9')](_0x2fecf0['options'])){_0x54323b+=','+_0x2fecf0[_0xdafd('0x7c')];}var _0x1e1c28=this[_0xdafd('0x10')]['exec'](_0xdafd('0xb7'),_0x54323b);if(_0x1e1c28[_0xdafd('0xa7')]===-0x1){return _0x1e1c28;}var _0x5bb826=this[_0xdafd('0xa6')](_0xdafd('0xb8'),_0xdafd('0xb9'));if(_0x5bb826['result']===-0x1){return _0x5bb826;}var _0x47f86f=this[_0xdafd('0xa6')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x47f86f[_0xdafd('0xa7')]===-0x1){return _0x47f86f;}var _0x22636d=this['getAndSetVariable'](_0xdafd('0xba'),_0xdafd('0xbb'));if(_0x22636d['result']===-0x1){return _0x22636d;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x54323b));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x8')]=function(_0x5795db){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0xbc'),_0x5795db[_0xdafd('0x3d')]));return this[_0xdafd('0x10')]['agi']([_0x5795db[_0xdafd('0xbd')],_0x5795db[_0xdafd('0xbe')]]);};AGIVertices[_0xdafd('0x13')][_0xdafd('0xbf')]=function(_0x5b7512){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x5b7512['label']));if(this[_0xdafd('0xa9')](_0x5b7512[_0xdafd('0x69')])){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0xc0'),_0x5b7512['timeout']));var _0x40fe4a=this['channel'][_0xdafd('0xc1')](_0x5b7512[_0xdafd('0x69')]);if(_0x40fe4a[_0xdafd('0xa7')]===-0x1){return _0x40fe4a;}}return this[_0xdafd('0x10')]['answer']();};AGIVertices['prototype'][_0xdafd('0x50')]=function(_0x49397e){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x49397e['label']));if(!this['isConfigured'](_0x49397e[_0xdafd('0x4e')])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x49397e,'no\x20list\x20selected');}_0x49397e[_0xdafd('0x4f')]=moment();if(this[_0xdafd('0xa9')](_0x49397e[_0xdafd('0xc2')])){_0x49397e[_0xdafd('0x4f')]=moment()['add'](_0x49397e['delay'],'minutes');}if(!this[_0xdafd('0xa9')](_0x49397e[_0xdafd('0x53')])){_0x49397e[_0xdafd('0x53')]=0x2;}this[_0xdafd('0x49')][_0xdafd('0x72')](this,_0x49397e);return this[_0xdafd('0x10')]['noop'](util['format'](_0xdafd('0xc3'),_0x49397e[_0xdafd('0x4d')],_0x49397e[_0xdafd('0x4e')],_0x49397e['scheduledAt']));};AGIVertices['prototype'][_0xdafd('0xc4')]=function(_0x4eaa42){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x4eaa42[_0xdafd('0x3d')]));var _0x262b98=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0x4eaa42[_0xdafd('0xc5')],_0x4eaa42['options']);if(_0x262b98[_0xdafd('0xa7')]===-0x1){return _0x262b98;}return this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xc6'),_0x4eaa42[_0xdafd('0xc5')],_0x4eaa42['options']));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xc7')]=function(_0x34ac6b){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x34ac6b['label']));if(!this[_0xdafd('0xa9')](_0x34ac6b['text'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}var _0x993caa='\x22'+_0x34ac6b[_0xdafd('0x60')]+'\x22';if(this[_0xdafd('0xa9')](_0x34ac6b['options'])){_0x993caa+=','+_0x34ac6b[_0xdafd('0x7c')];}var _0x38e41a=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0xdafd('0xb1'),_0x993caa);if(_0x38e41a[_0xdafd('0xa7')]===-0x1){return _0x38e41a;}return this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x993caa));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xc8')]=function(_0x177f08){logger[_0xdafd('0x32')](util['format'](_0xdafd('0xc9'),_0x177f08['label']));if(!this[_0xdafd('0xa9')](_0x177f08[_0xdafd('0x60')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}var _0x341ab1='\x22'+_0x177f08[_0xdafd('0x60')]+'\x22';if(this[_0xdafd('0xa9')](_0x177f08['options'])){_0x341ab1+=','+_0x177f08[_0xdafd('0x7c')];}var _0x57517c=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0xdafd('0xb1'),_0x341ab1);if(_0x57517c[_0xdafd('0xa7')]===-0x1){return _0x57517c;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xb2'),_0x341ab1));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xca')]=function(_0x5b823e){logger[_0xdafd('0x32')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5b823e['label']));if(!this['isConfigured'](_0x5b823e[_0xdafd('0xb5')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0xb6'));}var _0x1449ab=_0x5b823e[_0xdafd('0xb5')];if(this[_0xdafd('0xa9')](_0x5b823e[_0xdafd('0x7c')])){_0x1449ab+=','+_0x5b823e['options'];}var _0x64e1c7=this[_0xdafd('0x10')]['exec'](_0xdafd('0xb7'),_0x1449ab);if(_0x64e1c7['result']===-0x1){return _0x64e1c7;}var _0x8d3e3d=this[_0xdafd('0xa6')](_0xdafd('0xb8'),_0xdafd('0xcb'));if(_0x8d3e3d[_0xdafd('0xa7')]===-0x1){return _0x8d3e3d;}var _0x212ba8=this[_0xdafd('0xa6')](_0xdafd('0xcc'),_0xdafd('0xcd'));if(_0x212ba8[_0xdafd('0xa7')]===-0x1){return _0x212ba8;}var _0x424940=this[_0xdafd('0xa6')](_0xdafd('0xba'),'LUMENVOX_ASR_INSTANCE');if(_0x424940[_0xdafd('0xa7')]===-0x1){return _0x424940;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util['format'](_0xdafd('0xce'),_0x1449ab));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xcf')]=function(_0x587633){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0xd0'),_0x587633[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x587633[_0xdafd('0xb5')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xb6'));}var _0x36346e=_0x587633[_0xdafd('0xb5')];if(this['isConfigured'](_0x587633[_0xdafd('0x7c')])){_0x36346e+=','+_0x587633[_0xdafd('0x7c')];}var _0x498a2b=this[_0xdafd('0x10')]['exec'](_0xdafd('0xb7'),_0x36346e);if(_0x498a2b[_0xdafd('0xa7')]===-0x1){return _0x498a2b;}var _0x49965b=this['getAndSetVariable'](_0xdafd('0xb8'),_0xdafd('0xd1'));if(_0x49965b[_0xdafd('0xa7')]===-0x1){return _0x49965b;}var _0x5d19fd=this[_0xdafd('0xa6')](_0xdafd('0xcc'),_0xdafd('0xd2'));if(_0x5d19fd[_0xdafd('0xa7')]===-0x1){return _0x5d19fd;}var _0xc25a42=this[_0xdafd('0xa6')](_0xdafd('0xba'),_0xdafd('0xd3'));if(_0xc25a42[_0xdafd('0xa7')]===-0x1){return _0xc25a42;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xce'),_0x36346e));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xd4')]=function(_0xe5f90a){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0xd5'),_0xe5f90a[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0xe5f90a[_0xdafd('0xd6')])){return this['channel'][_0xdafd('0x30')](_0xe5f90a,_0xdafd('0xd7'));}var _0x306540=this[_0xdafd('0x19')][_0xdafd('0x72')](this,_0xe5f90a['odbc_id']);if(!_0x306540){return this[_0xdafd('0x10')]['error'](_0xe5f90a,'no\x20odbc\x20database\x20found');}if(!this[_0xdafd('0xa9')](_0xe5f90a[_0xdafd('0x34')])){return this['channel']['error'](_0xe5f90a,_0xdafd('0xd8'));}var _0x1cd2f1=_0xe5f90a[_0xdafd('0x34')][_0xdafd('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xdafd('0xae')](util['format'](_0xdafd('0xd9'),_0x1cd2f1));var _0x4ec24b=this[_0xdafd('0x2e')][_0xdafd('0x72')](this,_0x306540,_0x1cd2f1);this['createSquareDetailsReport'][_0xdafd('0x72')](this,_0xe5f90a,_0x1cd2f1);if(!this[_0xdafd('0xa9')](_0xe5f90a[_0xdafd('0xda')])){return this['channel']['noop'](_0xdafd('0xdb'));}var _0xe87b91=this['getVariable'][_0xdafd('0x72')](this,_0xe5f90a[_0xdafd('0xda')]);if(!_0xe87b91){return this[_0xdafd('0x10')]['error'](_0xe5f90a,_0xdafd('0xdc'));}var _0x3cc897=this;_0x4ec24b[_0xdafd('0xdd')](function(_0x41a23e,_0x5322cb){Object['keys'](_0x41a23e)['forEach'](function(_0x37184b){_0x3cc897['channel']['setVariable'](util[_0xdafd('0x2c')](_0xdafd('0xde'),_0xe87b91,_0x5322cb,_0x37184b),_0x41a23e[_0x37184b]);});});this[_0xdafd('0x10')]['setVariable'](util[_0xdafd('0x2c')](_0xdafd('0xdf'),_0xe87b91),_0x4ec24b[_0xdafd('0x9d')]);return this[_0xdafd('0x10')][_0xdafd('0xae')](util['format'](_0xdafd('0xe0'),_0xe87b91));};AGIVertices['prototype'][_0xdafd('0xe1')]=function(_0x367256){logger[_0xdafd('0xe2')](util[_0xdafd('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x367256[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x367256[_0xdafd('0xe3')])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x367256,_0xdafd('0xe4'));}var _0x3d1deb=this[_0xdafd('0x1c')][_0xdafd('0x72')](this,_0x367256[_0xdafd('0xe3')]);if(!_0x3d1deb){return this[_0xdafd('0x10')]['error'](_0x367256,_0xdafd('0xe5'));}var _0x3632d4=this[_0xdafd('0x10')][_0xdafd('0xb0')]('DIAL',[util[_0xdafd('0x2c')](_0xdafd('0xe6'),_0x3d1deb),_0x367256[_0xdafd('0x69')],_0x367256[_0xdafd('0xe7')],_0x367256['url']]);if(_0x3632d4[_0xdafd('0xa7')]===-0x1){return _0x3632d4;}return this['channel']['noop'](util[_0xdafd('0x2c')](_0xdafd('0xe8'),_0xdafd('0xe9')));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xea')]=function(_0x5bbebc){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0xeb'),_0x5bbebc['label']));if(!this[_0xdafd('0xa9')](_0x5bbebc[_0xdafd('0x84')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xec'));}if(!this[_0xdafd('0xa9')](_0x5bbebc[_0xdafd('0x60')])){return this[_0xdafd('0x10')][_0xdafd('0xae')]('no\x20text\x20configured');}this['channel'][_0xdafd('0xed')]=!![];this[_0xdafd('0x3b')](_0x5bbebc);this['createSquareMessage'](_0x5bbebc['text'],'in','','');this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xee'),_0x5bbebc[_0xdafd('0x60')]));var _0x1b9a74=this['googleDialogflow'][_0xdafd('0x72')](this,_0x5bbebc);if(_0x1b9a74){for(var _0xa4384 in _0x1b9a74){if(_0x1b9a74['hasOwnProperty'](_0xa4384)){this['channel'][_0xdafd('0xa1')](util[_0xdafd('0x2c')](_0xdafd('0xef'),_0xa4384['toUpperCase']()),_0x1b9a74[_0xa4384]);}}this[_0xdafd('0x48')](_0x1b9a74['speech'],'out',_0xdafd('0xea'),'');return this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0xf0'),_0x1b9a74[_0xdafd('0xf1')]));}return this[_0xdafd('0x10')]['error'](_0x5bbebc,_0xdafd('0xf2'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xf3')]=function(_0x43e6c5){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0xf4'),_0x43e6c5[_0xdafd('0x3d')]));if(!this['isConfigured'](_0x43e6c5[_0xdafd('0xf5')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xf6'));}if(!this[_0xdafd('0xa9')](_0x43e6c5[_0xdafd('0x80')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xf7'));}if(!this['isConfigured'](_0x43e6c5[_0xdafd('0xf8')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0xf9'));}if(!this[_0xdafd('0xa9')](_0x43e6c5[_0xdafd('0x81')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0xfa'));}if(!this[_0xdafd('0xa9')](_0x43e6c5[_0xdafd('0x60')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}this[_0xdafd('0x10')][_0xdafd('0xed')]=!![];this[_0xdafd('0x3b')](_0x43e6c5);this[_0xdafd('0x48')](_0x43e6c5[_0xdafd('0x60')],'in','','');this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xfb'),_0x43e6c5['text']));var _0x26107a=this[_0xdafd('0x7f')]['sync'](this,_0x43e6c5);if(_0x26107a){for(var _0x95c234 in _0x26107a){if(_0x26107a['hasOwnProperty'](_0x95c234)){if(_0x95c234!==_0xdafd('0xfc')){this['channel'][_0xdafd('0xa1')](util[_0xdafd('0x2c')](_0xdafd('0xef'),_0x95c234[_0xdafd('0x6c')]()),_0x26107a[_0x95c234]);}}}this['createSquareMessage'](_0x26107a[_0xdafd('0xf1')],'out',_0xdafd('0xf3'),_0x26107a[_0xdafd('0xfc')]);return this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xfd'),_0x26107a[_0xdafd('0xf1')]));}return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x43e6c5,_0xdafd('0xfe'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0xff')]=function(_0x35f0cc){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x100'),_0x35f0cc[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x35f0cc[_0xdafd('0x101')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x102'));}if(!this[_0xdafd('0xa9')](_0x35f0cc[_0xdafd('0x103')])){return this['channel'][_0xdafd('0xae')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x35f0cc['password'])){return this['channel'][_0xdafd('0xae')](_0xdafd('0x104'));}if(!this[_0xdafd('0xa9')](_0x35f0cc[_0xdafd('0x105')])){return this['channel'][_0xdafd('0xae')](_0xdafd('0xaf'));}this[_0xdafd('0x10')][_0xdafd('0xed')]=!![];this[_0xdafd('0x3b')](_0x35f0cc);this[_0xdafd('0x48')](_0x35f0cc[_0xdafd('0x60')],'in','','');this[_0xdafd('0x10')][_0xdafd('0xae')](util['format'](_0xdafd('0x106'),_0x35f0cc[_0xdafd('0x60')]));var _0x5ef632=this[_0xdafd('0x82')][_0xdafd('0x72')](this,_0x35f0cc);if(_0x5ef632){for(var _0x2a1a05 in _0x5ef632){if(_0x5ef632[_0xdafd('0x97')](_0x2a1a05)){this['channel']['setVariable'](util['format']('SESTEK_NDA_%s',_0x2a1a05['toUpperCase']()),_0x5ef632[_0x2a1a05]);}}this[_0xdafd('0x48')](_0x5ef632[_0xdafd('0xf1')],'out',_0xdafd('0xff'),'');if(_0x5ef632[_0xdafd('0x107')]){this[_0xdafd('0x10')][_0xdafd('0xae')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x5ef632[_0xdafd('0x107')]));var _0xbe0421=this['channel'][_0xdafd('0x108')](_0x5ef632['audiofile']);try{fs[_0xdafd('0x109')](_0x5ef632[_0xdafd('0x107')]+_0xdafd('0x10a'));}catch(_0x498600){logger[_0xdafd('0x30')](_0x498600);}return _0xbe0421;}else{return this[_0xdafd('0x10')][_0xdafd('0xae')](util['format']('SestekNDA\x20Result\x20%s',_0x5ef632[_0xdafd('0xf1')]));}}return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x35f0cc,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype']['end']=function(_0x4185b3){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x10b'),_0x4185b3[_0xdafd('0x3d')]));return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x10c'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x10d')]=function(_0x3ecaa0){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x10e'),_0x3ecaa0['label']));var _0x5e4ad6='';if(_0x3ecaa0[_0xdafd('0x10f')]){if(!this[_0xdafd('0xa9')](_0x3ecaa0['trunk_id'])){return this['channel'][_0xdafd('0x30')](_0x3ecaa0,_0xdafd('0x110'));}else{var _0x35db11=parseInt(_0x3ecaa0[_0xdafd('0x10f')],0xa);if(isNaN(_0x35db11)){_0x5e4ad6=_0x3ecaa0[_0xdafd('0x10f')];}else{_0x5e4ad6=this['getTrunk']['sync'](this,_0x3ecaa0[_0xdafd('0x10f')]);if(!_0x5e4ad6){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x3ecaa0,_0xdafd('0x111'));}}}}else if(_0x3ecaa0[_0xdafd('0x112')]){_0x5e4ad6=_0x3ecaa0[_0xdafd('0x112')];}else{return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x3ecaa0,'no\x20trunk\x20selected');}var _0x3740a8=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0xdafd('0xe9'),[util[_0xdafd('0x2c')](_0xdafd('0x113'),_0x5e4ad6,_0x3ecaa0['phone']),_0x3ecaa0[_0xdafd('0x69')],_0x3ecaa0[_0xdafd('0xe7')],_0x3ecaa0['url']]);if(_0x3740a8[_0xdafd('0xa7')]===-0x1){return _0x3740a8;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('Executed\x20command\x20%s',_0xdafd('0xe9')));};AGIVertices['prototype'][_0xdafd('0x114')]=function(_0x20c472){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x20c472['label']));return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x114'));};AGIVertices['prototype'][_0xdafd('0x115')]=function(_0xe45dc5){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x116'),_0xe45dc5['label']));if(_0xe45dc5['retry']===0x0){return this[_0xdafd('0xaa')](_0xe45dc5);}_0xe45dc5[_0xdafd('0xab')]-=0x1;if(!this['isConfigured'](_0xe45dc5['file_id'])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0xe45dc5,_0xdafd('0x117'));}var _0x2dc23b=this[_0xdafd('0x20')][_0xdafd('0x72')](this,_0xe45dc5[_0xdafd('0x118')]);if(!_0x2dc23b){return this['channel'][_0xdafd('0x30')](_0xe45dc5,_0xdafd('0x119'));}if(!this[_0xdafd('0xa9')](_0xe45dc5['variable_id'])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0xdafd('0xdb'));}var _0x4ed1e2=this[_0xdafd('0x10')][_0xdafd('0x11a')](_0x2dc23b,_0xe45dc5[_0xdafd('0x11b')],_0xe45dc5[_0xdafd('0x11c')]);var _0x25a681=_0x4ed1e2[_0xdafd('0xa7')]?_0x4ed1e2[_0xdafd('0xa7')]['toString']():'';logger[_0xdafd('0x32')](_0xdafd('0x11d'),JSON[_0xdafd('0x76')](_0x4ed1e2));if(_0x4ed1e2[_0xdafd('0xa7')]===-0x1){this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0xe45dc5,_0x25a681);return _0x4ed1e2;}else if(_0x4ed1e2[_0xdafd('0xa5')]===_0xdafd('0x69')){_0x4ed1e2[_0xdafd('0xa7')]=_0x25a681[_0xdafd('0x9d')]>=parseInt(_0xe45dc5[_0xdafd('0x11e')])?'x':'i';}else{_0x4ed1e2['result']=_0x25a681[_0xdafd('0x9d')]>=parseInt(_0xe45dc5[_0xdafd('0x11e')])&&_0x25a681['length']<=parseInt(_0xe45dc5[_0xdafd('0x11c')])?'x':'i';}var _0xa0dd9=this['getVariable'][_0xdafd('0x72')](this,_0xe45dc5[_0xdafd('0xda')]);if(!_0xa0dd9){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0xe45dc5,_0xdafd('0xdc'));}this[_0xdafd('0x10')]['setVariable'](_0xa0dd9,_0x25a681);if(this['isConfigured'](_0xe45dc5['hiddendigitsnum'])){var _0x3b18b3=parseInt(_0xe45dc5[_0xdafd('0x11f')],0xa);var _0x1c994a=rs['generate']({'charset':'*','length':_0x3b18b3});var _0x31baa1=_0x25a681[_0xdafd('0x9d')];if(_0x31baa1>0x0){if(_0x31baa1>_0x3b18b3){this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0xe45dc5,_0xe45dc5[_0xdafd('0x120')]===_0xdafd('0x121')?_0x1c994a+_0x25a681[_0xdafd('0x122')](_0x3b18b3):_0x25a681[_0xdafd('0x122')](0x0,_0x31baa1-_0x3b18b3)+_0x1c994a);}else{this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0xe45dc5,rs['generate']({'charset':'*','length':_0x31baa1}));}}else{this[_0xdafd('0x3b')]['sync'](this,_0xe45dc5,'');}}else{this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0xe45dc5,_0x25a681);}return _0x4ed1e2;};AGIVertices[_0xdafd('0x13')]['getsecretdigits']=function(_0x4efc45){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x123'),_0x4efc45[_0xdafd('0x3d')]));return this['getdigits'](_0x4efc45);};AGIVertices['prototype'][_0xdafd('0x124')]=function(_0x20535a){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x125'),_0x20535a[_0xdafd('0x3d')]));this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x20535a,_0x20535a[_0xdafd('0x126')]);return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x127'),_0x20535a[_0xdafd('0x126')]));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x128')]=function(_0x4b4e24){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x129'),_0x4b4e24[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x4b4e24[_0xdafd('0x8a')])||!this['isConfigured'](_0x4b4e24[_0xdafd('0x8b')])){return this['channel'][_0xdafd('0xae')](_0xdafd('0x12a'));}if(!this[_0xdafd('0xa9')](_0x4b4e24[_0xdafd('0x60')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('Trying\x20aws\x20Polly\x20%s',_0x4b4e24[_0xdafd('0x60')]));var _0x5f8402=this[_0xdafd('0x89')][_0xdafd('0x72')](this,_0x4b4e24);if(_0x5f8402){this['channel'][_0xdafd('0xae')](util['format'](_0xdafd('0x12b'),_0x5f8402));var _0x14174d=this['channel'][_0xdafd('0x108')](_0x5f8402);try{fs[_0xdafd('0x109')](_0x5f8402+_0xdafd('0x10a'));}catch(_0x21bda4){logger[_0xdafd('0x30')](_0x21bda4);}return _0x14174d;}return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x4b4e24,_0xdafd('0x12c'));};AGIVertices['prototype'][_0xdafd('0x12d')]=function(_0x318866){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x12e'),_0x318866['label']));if(!this[_0xdafd('0xa9')](_0x318866[_0xdafd('0x8a')])||!this[_0xdafd('0xa9')](_0x318866[_0xdafd('0x8b')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0x12a'));}if(!this[_0xdafd('0xa9')](_0x318866['aws_bot_name'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x12f'));}if(!this[_0xdafd('0xa9')](_0x318866['text'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}this['channel'][_0xdafd('0xed')]=!![];this[_0xdafd('0x3b')](_0x318866);this['createSquareMessage'](_0x318866[_0xdafd('0x60')],'in','','');this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x130'),_0x318866[_0xdafd('0x60')]));var _0x76a8c7=this[_0xdafd('0x8e')]['sync'](this,_0x318866);if(_0x76a8c7){for(var _0x24b4b3 in _0x76a8c7){if(_0x76a8c7[_0xdafd('0x97')](_0x24b4b3)&&_[_0xdafd('0x98')](_0x76a8c7[_0x24b4b3])){this[_0xdafd('0x10')][_0xdafd('0xa1')](util[_0xdafd('0x2c')]('AWS_LEX_%s',_0x24b4b3[_0xdafd('0x6c')]()),_0x76a8c7[_0x24b4b3]);}}if(_[_0xdafd('0x4a')](_0x76a8c7['message'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x131'));}else{this['createSquareMessage'](_0x76a8c7[_0xdafd('0x7a')],_0xdafd('0x132'),'amazonlex','');return this[_0xdafd('0x10')][_0xdafd('0xae')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x76a8c7['message']));}}return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x318866,_0xdafd('0x133'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x134')]=function(_0x1a5ebf){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x135'),_0x1a5ebf[_0xdafd('0x3d')],_0x1a5ebf['timeout']));if(!this['isConfigured'](_0x1a5ebf[_0xdafd('0x84')])){return this['channel']['noop'](_0xdafd('0xec'));}var _0x463794='wav';var _0x2f64ac=util[_0xdafd('0x2c')](_0xdafd('0x136'),FILES_PATH,rs[_0xdafd('0x137')](0x4));var _0x3162f6=util['format']('%s.%s',_0x2f64ac,_0x463794);var _0x147d67=!![];if(_0x1a5ebf[_0xdafd('0x138')]===_0xdafd('0x139')){_0x147d67=![];}var _0x109c54=this[_0xdafd('0x10')]['recordFile'](_0x2f64ac,_0x463794,_0x1a5ebf['intKey'],_0x1a5ebf['timeout'],undefined,_0x147d67);if(_0x109c54['result']!==-0x1){this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x13a'),_0x3162f6));var _0x58a581=this[_0xdafd('0x91')]['sync'](this,_0x1a5ebf,_0x3162f6);if(_0x58a581){for(var _0x248a52 in _0x58a581){if(_0x58a581[_0xdafd('0x97')](_0x248a52)){this[_0xdafd('0x10')][_0xdafd('0xa1')](util[_0xdafd('0x2c')]('GOOGLE_ASR_%s',_0x248a52[_0xdafd('0x6c')]()),_0x58a581[_0x248a52]);}}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x13b'),JSON[_0xdafd('0x76')](_0x58a581)));}}return _0x109c54;};AGIVertices[_0xdafd('0x13')][_0xdafd('0x13c')]=function(_0x4bc4c7){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x13d'),_0x4bc4c7[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x4bc4c7[_0xdafd('0x93')])){return this['channel'][_0xdafd('0xae')](_0xdafd('0x13e'));}if(!this[_0xdafd('0xa9')](_0x4bc4c7['appsecret'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x13f'));}var _0x37b6a8=_0xdafd('0x140');var _0x3324ba=util[_0xdafd('0x2c')](_0xdafd('0x136'),FILES_PATH,rs[_0xdafd('0x137')](0x4));var _0x1bc7be=util['format'](_0xdafd('0xa0'),_0x3324ba,_0x37b6a8);var _0x1fc41f=!![];if(_0x4bc4c7[_0xdafd('0x138')]===_0xdafd('0x139')){_0x1fc41f=![];}var _0x52e244=this[_0xdafd('0x10')]['recordFile'](_0x3324ba,_0x37b6a8,_0x4bc4c7[_0xdafd('0x141')],_0x4bc4c7[_0xdafd('0x69')],undefined,_0x1fc41f);if(_0x52e244[_0xdafd('0xa7')]!==-0x1){this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x142'),_0x1bc7be));var _0x41f268=this[_0xdafd('0x92')]['sync'](this,_0x4bc4c7,_0x1bc7be);if(_0x41f268){for(var _0x35259c in _0x41f268){if(_0x41f268[_0xdafd('0x97')](_0x35259c)){this[_0xdafd('0x10')][_0xdafd('0xa1')](util['format'](_0xdafd('0x143'),_0x35259c[_0xdafd('0x6c')]()),_0x41f268[_0x35259c]);}}return this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x144'),JSON['stringify'](_0x41f268)));}}return _0x52e244;};AGIVertices[_0xdafd('0x13')][_0xdafd('0x145')]=function(_0x6cdcb8){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x146'),_0x6cdcb8[_0xdafd('0x3d')]));return this['channel']['continueAt'](_0x6cdcb8[_0xdafd('0x43')],_0x6cdcb8[_0xdafd('0x44')],_0x6cdcb8[_0xdafd('0x147')]);};AGIVertices[_0xdafd('0x13')]['gotoif']=function(_0x2411ce){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x148'),_0x2411ce[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x2411ce[_0xdafd('0x149')])){return this['channel']['error'](_0x2411ce,_0xdafd('0x14a'));}try{var _0x390c7a=eval(_0x2411ce[_0xdafd('0x149')])?_0xdafd('0x14b'):_0xdafd('0x14c');this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x14d'),_0x2411ce[_0xdafd('0x149')],_0x390c7a));return{'code':0xc8,'result':_0x390c7a};}catch(_0x32a09f){return{'code':0xc8,'result':_0xdafd('0x14c')};}};AGIVertices[_0xdafd('0x13')][_0xdafd('0x14e')]=function(_0x26ddbd){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x14f'),_0x26ddbd[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x26ddbd[_0xdafd('0x150')])){return this['channel']['error'](_0x26ddbd,_0xdafd('0x151'));}var _0x249cee=this[_0xdafd('0x26')][_0xdafd('0x72')](this,_0x26ddbd['interval_id']);if(!_0x249cee){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x26ddbd,_0xdafd('0x152'));}for(var _0x109681=0x0;_0x109681<_0x249cee[_0xdafd('0x9d')];_0x109681+=0x1){var _0x59550e=this['channel'][_0xdafd('0xa4')](util[_0xdafd('0x2c')]('IFTIME(%s?true:false)',_0x249cee[_0x109681]));if(_0x59550e['result']===-0x1){return _0x59550e;}logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x153'),_0x249cee[_0x109681],_0x59550e[_0xdafd('0xa5')]));if(_0x59550e[_0xdafd('0xa5')]===_0xdafd('0x14b')){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x153'),_0x249cee[_0x109681],_0xdafd('0x14b')));this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x153'),_0x249cee[_0x109681],_0xdafd('0x14b')));return{'code':0xc8,'result':_0xdafd('0x14b')};}else{logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('IFTIME\x20%s\x20%s',_0x249cee[_0x109681],_0xdafd('0x14c')));this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('IFTIME\x20%s\x20%s',_0x249cee[_0x109681],_0xdafd('0x14c')));}}return{'code':0xc8,'result':_0xdafd('0x14c')};};AGIVertices[_0xdafd('0x13')][_0xdafd('0x154')]=function(_0x44bd1b){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x155'),_0x44bd1b[_0xdafd('0x3d')]));return this[_0xdafd('0x10')]['hangup']();};AGIVertices['prototype'][_0xdafd('0x156')]=function(_0x49650b){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x157'),_0x49650b['label']));if(!this[_0xdafd('0xa9')](_0x49650b[_0xdafd('0x84')])){return this['channel'][_0xdafd('0xae')](_0xdafd('0xec'));}var _0x4a9ae9='wav';var _0x4a3175=util[_0xdafd('0x2c')](_0xdafd('0x136'),FILES_PATH,rs['generate'](0x4));var _0x50b4b3=util[_0xdafd('0x2c')](_0xdafd('0xa0'),_0x4a3175,_0x4a9ae9);var _0x5cdd57=!![];if(_0x49650b[_0xdafd('0x138')]==='NOBEEP'){_0x5cdd57=![];}var _0x1078ee=this[_0xdafd('0x10')][_0xdafd('0x158')](_0x4a3175,_0x4a9ae9,_0x49650b[_0xdafd('0x141')],_0x49650b[_0xdafd('0x69')],undefined,_0x5cdd57);if(_0x1078ee[_0xdafd('0xa7')]!==-0x1){this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x159'),_0x50b4b3));var _0x103adc=this[_0xdafd('0x87')][_0xdafd('0x72')](this,_0x49650b,_0x50b4b3);if(_0x103adc){for(var _0x3e8800 in _0x103adc){if(_0x103adc['hasOwnProperty'](_0x3e8800)){this['channel'][_0xdafd('0xa1')](util[_0xdafd('0x2c')](_0xdafd('0x15a'),_0x3e8800[_0xdafd('0x6c')]()),_0x103adc[_0x3e8800]);}}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('IspeechASR\x20Result\x20%s',JSON[_0xdafd('0x76')](_0x103adc)));}}return _0x1078ee;};AGIVertices[_0xdafd('0x13')][_0xdafd('0x15b')]=function(_0x19a56e){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x15c'),_0x19a56e[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x19a56e['key'])){return this['channel']['noop'](_0xdafd('0xec'));}if(!this[_0xdafd('0xa9')](_0x19a56e[_0xdafd('0x60')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0xaf'));}this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x15d'),_0x19a56e[_0xdafd('0x60')]));var _0x511016=this[_0xdafd('0x83')]['sync'](this,_0x19a56e);if(_0x511016){this[_0xdafd('0x10')][_0xdafd('0xae')](util['format']('ispeech\x20%s\x20file\x20created',_0x511016));var _0x1c1c70=this[_0xdafd('0x10')][_0xdafd('0x108')](_0x511016,_0x19a56e['intKey']);try{fs['unlink'](_0x511016+_0xdafd('0x10a'));}catch(_0x2e492d){logger['error'](_0x2e492d);}return _0x1c1c70;}return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x19a56e,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xdafd('0x15e')]=function(_0x1ea98c){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x15f'),_0x1ea98c[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x1ea98c['findBy'])){return this['channel'][_0xdafd('0x30')](_0x1ea98c,'no\x20find\x20by\x20configured');}logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x160'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x1ea98c[_0xdafd('0x161')]));var _0x1968b6=this[_0xdafd('0x58')][_0xdafd('0x72')](this,_0x1ea98c[_0xdafd('0x161')]);if(_0x1968b6){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x1ea98c[_0xdafd('0x161')]));this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x1ea98c[_0xdafd('0x161')]));return{'code':0xc8,'result':'success'};}else{logger[_0xdafd('0x32')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xdafd('0x40')],_0x1ea98c[_0xdafd('0x161')]));this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xdafd('0x10')][_0xdafd('0x40')],_0x1ea98c[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x163')};}};AGIVertices[_0xdafd('0x13')][_0xdafd('0x164')]=function(_0x22d7d5){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x165'),_0x22d7d5['label']));if(!this['isConfigured'](_0x22d7d5[_0xdafd('0x161')])){return this[_0xdafd('0x10')]['error'](_0x22d7d5,_0xdafd('0x166'));}logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x160'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x22d7d5['findBy']));var _0x4944e9=this[_0xdafd('0x57')][_0xdafd('0x72')](this,_0x22d7d5[_0xdafd('0x161')]);if(_0x4944e9){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x22d7d5['findBy']));this['channel'][_0xdafd('0xae')](util['format'](_0xdafd('0x162'),this[_0xdafd('0x10')]['callerid'],_0x22d7d5[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x167')};}else{logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x168'),this['channel'][_0xdafd('0x40')],_0x22d7d5[_0xdafd('0x161')]));this[_0xdafd('0x10')][_0xdafd('0xae')](util['format'](_0xdafd('0x168'),this[_0xdafd('0x10')]['callerid'],_0x22d7d5[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x163')};}};AGIVertices[_0xdafd('0x13')]['math']=function(_0x2cb5ac){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x169'),_0x2cb5ac[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x2cb5ac['operation'])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x2cb5ac,_0xdafd('0x16a'));}this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x16b'),_0x2cb5ac[_0xdafd('0x16c')]));var _0x578464=eval(_0x2cb5ac['operation']);if(!this[_0xdafd('0xa9')](_0x2cb5ac[_0xdafd('0xda')])){return this[_0xdafd('0x10')][_0xdafd('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3d86fe=this[_0xdafd('0xa4')]['sync'](this,_0x2cb5ac[_0xdafd('0xda')]);if(!_0x3d86fe){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x2cb5ac,_0xdafd('0xdc'));}if(_[_0xdafd('0x9c')](_0x578464)){var _0x42aebc=this;_0x578464[_0xdafd('0xdd')](function(_0x41e8c,_0x48f2d8){_0x42aebc[_0xdafd('0x10')][_0xdafd('0xa1')](util['format'](_0xdafd('0x16d'),_0x3d86fe,_0x48f2d8),_0x41e8c);});return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x16e'),_0x3d86fe));}else{return this[_0xdafd('0x10')]['setVariable'](_0x3d86fe,_0x578464);}};AGIVertices[_0xdafd('0x13')][_0xdafd('0xe')]=function(_0x4b7c66){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x16f'),_0x4b7c66[_0xdafd('0x3d')]));if(_0x4b7c66['retry']===0x0){return this[_0xdafd('0xaa')](_0x4b7c66);}_0x4b7c66[_0xdafd('0xab')]-=0x1;if(!this[_0xdafd('0xa9')](_0x4b7c66[_0xdafd('0x118')])){return this[_0xdafd('0x10')]['error'](_0x4b7c66,_0xdafd('0x117'));}var _0x39f310=this[_0xdafd('0x20')][_0xdafd('0x72')](this,_0x4b7c66[_0xdafd('0x118')]);if(!_0x39f310){return this['channel'][_0xdafd('0x30')](_0x4b7c66,_0xdafd('0x119'));}var _0x59ac9e=this[_0xdafd('0x10')][_0xdafd('0x11a')](_0x39f310,_0x4b7c66['response'],_0x4b7c66[_0xdafd('0x170')]);var _0x278bf8=_0x59ac9e[_0xdafd('0xa7')];if(_0x59ac9e[_0xdafd('0xa7')]===-0x1){this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x4b7c66,'-1');return _0x59ac9e;}else if(_0x59ac9e[_0xdafd('0xa5')]==='timeout'){_0x59ac9e[_0xdafd('0xa7')]=_0x59ac9e['result'][_0xdafd('0x9d')]>0x0?_0x59ac9e[_0xdafd('0xa7')]:'t';}else if(_[_0xdafd('0x171')](_0x59ac9e[_0xdafd('0xa7')])){_0x59ac9e[_0xdafd('0xa7')]='#';_0x278bf8='#';}if(!this[_0xdafd('0xa9')](_0x4b7c66[_0xdafd('0xda')])){this[_0xdafd('0x10')][_0xdafd('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x27a89d=this['getVariable'][_0xdafd('0x72')](this,_0x4b7c66[_0xdafd('0xda')]);if(!_0x27a89d){return this['channel']['error'](_0x4b7c66,_0xdafd('0xdc'));}this[_0xdafd('0x10')][_0xdafd('0xa1')](_0x27a89d,_0x278bf8);}this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x4b7c66,_0x278bf8);return _0x59ac9e;};AGIVertices['prototype'][_0xdafd('0xae')]=function(_0x24e894){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x24e894[_0xdafd('0x3d')]));return this[_0xdafd('0x10')][_0xdafd('0xae')](_0x24e894[_0xdafd('0x172')]||_0x24e894[_0xdafd('0x3d')]);};AGIVertices['prototype']['pause']=function(_0xf4f25b){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x173'),_0xf4f25b['label']));if(!this[_0xdafd('0xa9')](_0xf4f25b[_0xdafd('0x161')])){return this[_0xdafd('0x10')]['error'](_0xf4f25b,_0xdafd('0x166'));}logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xdafd('0x10')][_0xdafd('0x40')],_0xf4f25b[_0xdafd('0x161')]));var _0xacf4b6=this[_0xdafd('0x54')][_0xdafd('0x72')](this,_0xf4f25b[_0xdafd('0x174')]);var _0x15b4e2=this[_0xdafd('0x55')][_0xdafd('0x72')](this,_0xf4f25b['findBy'],_0xacf4b6);if(_0x15b4e2){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0xf4f25b[_0xdafd('0x161')]));this['channel']['noop'](util['format'](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0xf4f25b[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x167')};}else{logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0xf4f25b['findBy']));this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x162'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0xf4f25b[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x163')};}};AGIVertices[_0xdafd('0x13')]['playback']=function(_0x4020ac){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x175'),_0x4020ac[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x4020ac['file_id'])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x4020ac,'no\x20file\x20audio\x20selected');}var _0x575161=this[_0xdafd('0x20')][_0xdafd('0x72')](this,_0x4020ac[_0xdafd('0x118')]);if(!_0x575161){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x4020ac,_0xdafd('0x119'));}var _0x1c0811=this[_0xdafd('0x10')]['exec'](_0xdafd('0x176'),[_0x575161,_0x4020ac['opts']]);if(_0x1c0811[_0xdafd('0xa7')]===-0x1){return _0x1c0811;}return this['channel']['noop'](util[_0xdafd('0x2c')](_0xdafd('0xc6'),_0xdafd('0x176'),_0x575161));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x177')]=function(_0x192697){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x178'),_0x192697['label']));if(!this[_0xdafd('0xa9')](_0x192697[_0xdafd('0x179')])){return this['channel']['error'](_0x192697,'no\x20queue\x20selected');}var _0x28a9ca='';var _0x208a44=parseInt(_0x192697['queue_id'],0xa);if(isNaN(_0x208a44)){_0x28a9ca=_0x192697[_0xdafd('0x179')];}else{_0x28a9ca=this[_0xdafd('0x17')][_0xdafd('0x72')](this,_0x192697['queue_id']);if(!_0x28a9ca){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x192697,_0xdafd('0x17a'));}}var _0xd8588c='';if(this[_0xdafd('0xa9')](_0x192697[_0xdafd('0x118')])){var _0xc7d026=this[_0xdafd('0x20')][_0xdafd('0x72')](this,_0x192697[_0xdafd('0x118')]);if(_0xc7d026){_0xd8588c=_0xc7d026;}}this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x192697,_0x28a9ca);if(_0x192697['opts'][_0xdafd('0x17b')]('x')<0x0){_0x192697['opts']+='x';}if(_0x192697[_0xdafd('0xe7')][_0xdafd('0x17b')]('X')<0x0){_0x192697['opts']+='X';}this[_0xdafd('0x10')][_0xdafd('0xa1')](_0xdafd('0x17c'),_0x28a9ca?_0x28a9ca[_0xdafd('0x17d')]():'');var _0x4c74e4=this[_0xdafd('0x10')]['exec']('QUEUE',[_0x28a9ca,_0x192697[_0xdafd('0xe7')],_0x192697[_0xdafd('0x67')],_0xd8588c,_0x192697[_0xdafd('0x69')],_0x192697['agi'],_0x192697[_0xdafd('0x17e')],_0x192697['gosub'],'',_0x192697[_0xdafd('0x17f')]]);if(_0x4c74e4[_0xdafd('0xa7')]===-0x1){return _0x4c74e4;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xc6'),_0xdafd('0x180'),_0x28a9ca));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x181')]=function(_0x19ff82){logger['info'](util['format'](_0xdafd('0x182'),_0x19ff82[_0xdafd('0x3d')]));var _0x294478=_0x19ff82['recordingFormat']||_0xdafd('0x140');var _0x24e3e6=util[_0xdafd('0x2c')]('%s_%s',this[_0xdafd('0x10')][_0xdafd('0x3c')],rs[_0xdafd('0x137')](0x5));var _0x3286c5=util[_0xdafd('0x2c')](_0xdafd('0x183'),FILES_PATH,_0x24e3e6,_0x294478);var _0x232bff=util[_0xdafd('0x2c')](_0xdafd('0x136'),FILES_PATH,_0x24e3e6);this[_0xdafd('0x41')][_0xdafd('0x72')](this,_0x19ff82,_0x24e3e6,_0x3286c5);this[_0xdafd('0x10')]['setVariable'](_0xdafd('0x184'),_0x24e3e6);logger[_0xdafd('0x32')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x232bff,_0x294478,_0x19ff82[_0xdafd('0x185')],_0x19ff82[_0xdafd('0x69')]);return this[_0xdafd('0x10')]['recordFile'](_0x232bff,_0x294478,_0x19ff82['escape_digits'],_0x19ff82[_0xdafd('0x69')],undefined,!![]);};AGIVertices[_0xdafd('0x13')]['restapi']=function(_0x1e7591){logger['info'](util['format'](_0xdafd('0x186'),_0x1e7591[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x1e7591[_0xdafd('0x67')])){return this[_0xdafd('0x10')]['noop'](_0xdafd('0x187'));}var _0x4960ee=this[_0xdafd('0x188')]['sync'](this,_0x1e7591);logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x189'),util[_0xdafd('0x18a')](_0x4960ee,{'showHidden':![],'depth':null})));if(!this[_0xdafd('0xa9')](_0x1e7591[_0xdafd('0xda')])){return this[_0xdafd('0x10')][_0xdafd('0xae')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x308328=this[_0xdafd('0xa4')][_0xdafd('0x72')](this,_0x1e7591[_0xdafd('0xda')]);if(!_0x308328){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x1e7591,_0xdafd('0xdc'));}this[_0xdafd('0x10')][_0xdafd('0xa1')](util[_0xdafd('0x2c')](_0xdafd('0x18b'),_0x308328),_0x4960ee[_0xdafd('0x78')]?_0x4960ee[_0xdafd('0x78')]:'200');this[_0xdafd('0x10')][_0xdafd('0xa1')](util['format'](_0xdafd('0x18c'),_0x308328),_0x4960ee[_0xdafd('0x79')]?_0x4960ee[_0xdafd('0x79')]:'OK');if(_0x4960ee[_0xdafd('0x6d')]){try{this[_0xdafd('0x9f')](_0x4960ee[_0xdafd('0x6d')],_0x308328);}catch(_0x192478){logger[_0xdafd('0x30')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x308328));}}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xe0'),_0x308328));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x18d')]=function(_0x18d1f3){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x18e'),_0x18d1f3[_0xdafd('0x3d')]));return this[_0xdafd('0x10')][_0xdafd('0x18f')](_0x18d1f3[_0xdafd('0x190')][_0xdafd('0x5c')](/\s+/g,''),_0x18d1f3['escape_digits']);};AGIVertices['prototype'][_0xdafd('0x191')]=function(_0x338884){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x338884[_0xdafd('0x3d')]));return this['channel'][_0xdafd('0x192')](_0x338884[_0xdafd('0x193')][_0xdafd('0x5c')](/\s+/g,''),_0x338884[_0xdafd('0x185')]);};AGIVertices[_0xdafd('0x13')][_0xdafd('0x194')]=function(_0x33e927){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x195'),_0x33e927['label']));return this[_0xdafd('0x10')]['sayPhonetic'](_0x33e927[_0xdafd('0x60')],_0x33e927[_0xdafd('0x185')]);};AGIVertices[_0xdafd('0x13')][_0xdafd('0x196')]=function(_0x1633af){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x197'),_0x1633af['label']));if(!this['isConfigured'](_0x1633af[_0xdafd('0x198')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x199'));}var _0x4ea75a=this[_0xdafd('0x19a')]['sync'](this,_0x1633af[_0xdafd('0x198')]);if(!_0x4ea75a||!_0x4ea75a['Smtp']){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x1633af,_0xdafd('0x19b'));}var _0x1ab19e={'from':util[_0xdafd('0x2c')]('\x22%s\x22\x20<%s>',_0x4ea75a[_0xdafd('0x18')],_0x4ea75a['email']||_0x4ea75a[_0xdafd('0x19c')][_0xdafd('0x19d')]),'to':_0x1633af['to']||'','cc':_0x1633af['cc']||'','bcc':_0x1633af['bcc']||'','subject':_0x1633af[_0xdafd('0x19e')],'html':_0x1633af[_0xdafd('0x60')],'text':_0x1633af[_0xdafd('0x60')]};if(this['isConfigured'](_0x1633af[_0xdafd('0x19f')])){}logger[_0xdafd('0xe2')]('sendMail\x20message',JSON[_0xdafd('0x76')](_0x1ab19e));this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x1633af,_0x1633af['account_id']);this['channel']['noop'](util[_0xdafd('0x2c')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x4ea75a[_0xdafd('0x18')]));this['sendMailMessage'][_0xdafd('0x72')](this,_0x4ea75a[_0xdafd('0x1a0')],_0x1ab19e);return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x1a1'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1a2')]=function(_0x4edcd8){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x4edcd8[_0xdafd('0x3d')]));return this['channel'][_0xdafd('0xae')](_0xdafd('0x1a3'));};AGIVertices['prototype'][_0xdafd('0x1a4')]=function(_0x2d4b8e){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2d4b8e[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x2d4b8e['sms_account_id'])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x1a5'));}var _0x127edd=this[_0xdafd('0x39')]['sync'](this,_0x2d4b8e['sms_account_id']);if(!_0x127edd){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x2d4b8e,_0xdafd('0x1a6'));}var _0x30e98f={'body':_0x2d4b8e[_0xdafd('0x1a7')],'phone':_0x2d4b8e['to']||'','SmsAccountId':_0x127edd['id']};logger[_0xdafd('0xe2')](_0xdafd('0x1a8'),JSON['stringify'](_0x30e98f));this['createSquareDetailsReport'][_0xdafd('0x72')](this,_0x2d4b8e,_0x2d4b8e[_0xdafd('0x1a9')]);this[_0xdafd('0x10')]['noop'](util['format'](_0xdafd('0x1aa'),_0x127edd['name']));this[_0xdafd('0x1ab')][_0xdafd('0x72')](this,_0x30e98f);return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x1ac'));};AGIVertices['prototype'][_0xdafd('0x1ad')]=function(_0x34cc13){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x34cc13[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x34cc13[_0xdafd('0xda')])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x34cc13,'no\x20variable\x20selected');}var _0x32b33e=this[_0xdafd('0xa4')][_0xdafd('0x72')](this,_0x34cc13[_0xdafd('0xda')]);if(!_0x32b33e){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x34cc13,_0xdafd('0xdc'));}return this['channel']['setVariable'](_0x32b33e,_0x34cc13[_0xdafd('0x1ae')]);};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1af')]=function(_0x4b69f3){logger['info'](util['format'](_0xdafd('0x1b0'),_0x4b69f3[_0xdafd('0x3d')]));this['channel']['noop'](_0xdafd('0x1b1'));var _0x1736ff=this[_0xdafd('0x10')]['getVariable']('XMCS-UNIQUEID');if(!_[_0xdafd('0x171')](_0x1736ff[_0xdafd('0xa5')])){this[_0xdafd('0x10')][_0xdafd('0x3c')]=_0x1736ff[_0xdafd('0xa5')];}if(_0x4b69f3[_0xdafd('0xbf')]===_0xdafd('0x1b2')){this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x1b3'));return this[_0xdafd('0x10')]['answer']();}return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0x1b4'));};AGIVertices[_0xdafd('0x13')]['subproject']=function(_0x564bb8){logger['info'](util['format'](_0xdafd('0x1b5'),_0x564bb8[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x564bb8['project_id'])){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x564bb8,'no\x20subproject\x20selected');}var _0x3ddf4e=this[_0xdafd('0x1b6')][_0xdafd('0x72')](this,_0x564bb8[_0xdafd('0x1b7')]);if(!this[_0xdafd('0xa9')](_0x3ddf4e)){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x564bb8,util[_0xdafd('0x2c')](_0xdafd('0x1b8'),_0x564bb8[_0xdafd('0x1b7')]));}if(_0x3ddf4e===this[_0xdafd('0x10')][_0xdafd('0x3f')]){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x564bb8,_0xdafd('0x1b9'));}this['createSquareDetailsReport'][_0xdafd('0x72')](this,_0x564bb8,_0x3ddf4e);var _0x4c9c92=this[_0xdafd('0x10')][_0xdafd('0xb0')](_0xdafd('0x1ba'),util[_0xdafd('0x2c')](_0xdafd('0x1bb'),config[_0xdafd('0x8')][_0xdafd('0x1bc')]||_0xdafd('0x1bd'),_0x3ddf4e,this[_0xdafd('0x10')][_0xdafd('0x3f')]));if(_0x4c9c92[_0xdafd('0xa7')]===-0x1){return _0x4c9c92;}return this['channel'][_0xdafd('0xae')](util['format'](_0xdafd('0xc6'),'AGI',_0x3ddf4e));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1be')]=function(_0x31dbab){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x1bf'),_0x31dbab['label']));var _0x489e53=this[_0xdafd('0x5b')][_0xdafd('0x72')](this,_0x31dbab[_0xdafd('0xbd')]);this[_0xdafd('0x3b')][_0xdafd('0x72')](this,_0x31dbab,_0x31dbab[_0xdafd('0xbd')]);if(this[_0xdafd('0xa9')](_0x31dbab[_0xdafd('0xda')])){var _0x214c52=this[_0xdafd('0xa4')][_0xdafd('0x72')](this,_0x31dbab[_0xdafd('0xda')]);if(_0x214c52){this['channel'][_0xdafd('0xa1')](_0x214c52,_0x489e53);return this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x1c0'),_0x31dbab[_0xdafd('0xbd')],_0x214c52));}}return this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x1c1'),_0x31dbab[_0xdafd('0xbd')]));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1c2')]=function(_0x3b0aa7){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3b0aa7['label']));_0x3b0aa7[_0xdafd('0x60')]=_0x3b0aa7[_0xdafd('0x60')][_0xdafd('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xdafd('0xa9')](_0x3b0aa7[_0xdafd('0x5e')])){return this[_0xdafd('0x10')][_0xdafd('0xae')]('no\x20apiKey\x20configured');}if(!this[_0xdafd('0xa9')](_0x3b0aa7[_0xdafd('0x60')])){return this['channel'][_0xdafd('0xae')](_0xdafd('0xaf'));}this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')](_0xdafd('0x1c3'),_0x3b0aa7[_0xdafd('0x60')]));var _0x3c489f=this[_0xdafd('0x5d')]['sync'](this,_0x3b0aa7);if(_0x3c489f){this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x1c4'),_0x3c489f));var _0x30ea13=this[_0xdafd('0x10')][_0xdafd('0x108')](_0x3c489f);try{fs[_0xdafd('0x109')](_0x3c489f+_0xdafd('0x10a'));}catch(_0x247df7){logger[_0xdafd('0x30')](_0x247df7);}return _0x30ea13;}return this['channel'][_0xdafd('0x30')](_0x3b0aa7,_0xdafd('0x1c5'));};AGIVertices['prototype'][_0xdafd('0x1c6')]=function(_0x5cd58e){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x1c7'),_0x5cd58e[_0xdafd('0x3d')]));_0x5cd58e[_0xdafd('0x60')]=_0x5cd58e[_0xdafd('0x60')][_0xdafd('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xdafd('0xa9')](_0x5cd58e[_0xdafd('0x60')])){return this[_0xdafd('0x10')][_0xdafd('0xae')](_0xdafd('0xaf'));}this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')]('Trying\x20Google\x20TTS\x20%s',_0x5cd58e[_0xdafd('0x60')]));var _0x4dbd7b=this[_0xdafd('0x65')][_0xdafd('0x72')](this,_0x5cd58e);if(_0x4dbd7b){this[_0xdafd('0x10')]['noop'](util[_0xdafd('0x2c')]('Google\x20TTS\x20%s\x20file\x20created',_0x4dbd7b));var _0x3da425=this[_0xdafd('0x10')]['streamFile'](_0x4dbd7b);try{fs[_0xdafd('0x109')](_0x4dbd7b+'.wav');}catch(_0x7a7252){logger[_0xdafd('0x30')](_0x7a7252);}return _0x3da425;}return this['channel'][_0xdafd('0x30')](_0x5cd58e,_0xdafd('0x1c8'));};AGIVertices[_0xdafd('0x13')][_0xdafd('0x1c9')]=function(_0x2234a6){logger['info'](util[_0xdafd('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x2234a6[_0xdafd('0x3d')]));if(!this['isConfigured'](_0x2234a6['findBy'])){return this[_0xdafd('0x10')]['error'](_0x2234a6,_0xdafd('0x166'));}logger[_0xdafd('0x32')](util[_0xdafd('0x2c')](_0xdafd('0x160'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x2234a6[_0xdafd('0x161')]));var _0x408eaa=this[_0xdafd('0x1ca')][_0xdafd('0x72')](this,_0x2234a6[_0xdafd('0x161')]);if(_0x408eaa){logger['info'](util[_0xdafd('0x2c')](_0xdafd('0x162'),this[_0xdafd('0x10')]['callerid'],_0x2234a6[_0xdafd('0x161')]));this[_0xdafd('0x10')][_0xdafd('0xae')](util['format'](_0xdafd('0x162'),this[_0xdafd('0x10')]['callerid'],_0x2234a6[_0xdafd('0x161')]));return{'code':0xc8,'result':_0xdafd('0x167')};}else{logger['info'](util['format'](_0xdafd('0x168'),this[_0xdafd('0x10')][_0xdafd('0x40')],_0x2234a6['findBy']));this['channel'][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0x168'),this[_0xdafd('0x10')]['callerid'],_0x2234a6['findBy']));return{'code':0xc8,'result':_0xdafd('0x163')};}};AGIVertices[_0xdafd('0x13')]['voicemail']=function(_0x30aadd){logger[_0xdafd('0x32')](util[_0xdafd('0x2c')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x30aadd['label']));var _0xc6eaf2=this[_0xdafd('0x10')]['exec'](_0xdafd('0x1cb'),[_0x30aadd[_0xdafd('0x1cc')],_0x30aadd[_0xdafd('0x7c')]]);if(_0xc6eaf2[_0xdafd('0xa7')]===-0x1){return _0xc6eaf2;}return this[_0xdafd('0x10')][_0xdafd('0xae')](util[_0xdafd('0x2c')](_0xdafd('0xc6'),_0xdafd('0x1cb'),_0x30aadd['mailbox']));};AGIVertices[_0xdafd('0x13')]['vswitch']=function(_0x4fbd57){logger[_0xdafd('0x32')](util['format'](_0xdafd('0x1cd'),_0x4fbd57[_0xdafd('0x3d')]));if(!this[_0xdafd('0xa9')](_0x4fbd57[_0xdafd('0xda')])){return this['channel'][_0xdafd('0x30')](_0x4fbd57,_0xdafd('0x1ce'));}var _0x5c5d5e=this['getVariable'][_0xdafd('0x72')](this,_0x4fbd57['variable_id']);if(!_0x5c5d5e){return this[_0xdafd('0x10')][_0xdafd('0x30')](_0x4fbd57,_0xdafd('0xdc'));}var _0x4dbe2e=this[_0xdafd('0x10')][_0xdafd('0xa4')](_0x5c5d5e);return{'code':0xc8,'result':_0x4dbe2e['extra']?_0x4dbe2e[_0xdafd('0xa5')]:'-'};};String[_0xdafd('0x13')]['replaceAll']=function(_0xd39485,_0x49c146){return this[_0xdafd('0xa2')](_0xd39485)[_0xdafd('0x1cf')](_0x49c146);};module[_0xdafd('0x1d0')]=AGIVertices; \ No newline at end of file +var _0xcb66=['map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','arg_1','callerid','createSquareRecording','uniqueid','context','priority','accountcode','dnid','createSquareMessage','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','MALE','MP3','googleTTS','restAPI','timeout','includes','POST','PUT','method','toUpperCase','body','parse','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','createCmContact','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','forEach','keys','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','no\x20text\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','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','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','toString','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','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','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','no\x20operation\x20configured','math\x20%s','operation','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','digits','saynumber','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','debug','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','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','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','lodash','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','then','dsn','getUserById','getTrunkById','getSoundById','getSoundPath','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval'];(function(_0x7789e,_0x6cf9ae){var _0x284e64=function(_0x134898){while(--_0x134898){_0x7789e['push'](_0x7789e['shift']());}};_0x284e64(++_0x6cf9ae);}(_0xcb66,0x19f));var _0x6cb6=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0xcb66[_0x23e6bb];return _0x1e3b4c;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x6cb6('0x0'));var sh=require(_0x6cb6('0x1'));var odbc=require(_0x6cb6('0x2'))();var rs=require(_0x6cb6('0x3'));var moment=require(_0x6cb6('0x4'));var Mustache=require('mustache');var rp=require(_0x6cb6('0x5'));var logger=require(_0x6cb6('0x6'))(_0x6cb6('0x7'));var config=require(_0x6cb6('0x8'));var scripts=require(_0x6cb6('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x6cb6('0xa')];var verticesWithRetry=[_0x6cb6('0xb'),_0x6cb6('0xc'),_0x6cb6('0xd')];var AGIVertices=function(_0x1d0ee9,_0x4298d2,_0x3a5927){this[_0x6cb6('0xe')]=_0x1d0ee9;this[_0x6cb6('0xf')]=_0x4298d2;this[_0x6cb6('0x10')]=_0x3a5927;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x12')]=function(_0x1828f6,_0x592c78){this['rpc']['getVariableById'](_0x1828f6)['then'](function(_0x21de58){_0x592c78(null,_0x21de58?_0x21de58[_0x6cb6('0x13')]:![]);})[_0x6cb6('0x14')](function(_0x2604e7){_0x592c78(_0x2604e7);});};AGIVertices['prototype'][_0x6cb6('0x15')]=function(_0x3c6267,_0x57ee3b){this[_0x6cb6('0xf')][_0x6cb6('0x16')](_0x3c6267)['then'](function(_0x107492){_0x57ee3b(null,_0x107492?_0x107492[_0x6cb6('0x13')]:![]);})['catch'](function(_0x5ab865){_0x57ee3b(_0x5ab865);});};AGIVertices['prototype']['getSquareProject']=function(_0x380edc,_0x298daa){this[_0x6cb6('0xf')][_0x6cb6('0x17')](_0x380edc)[_0x6cb6('0x18')](function(_0x40d445){_0x298daa(null,_0x40d445?_0x40d445['name']:![]);})[_0x6cb6('0x14')](function(_0xc0bdea){_0x298daa(_0xc0bdea);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x5ef3d2,_0x5b5dab){this['rpc']['getSquareOdbcById'](_0x5ef3d2)[_0x6cb6('0x18')](function(_0xcd1afa){_0x5b5dab(null,_0xcd1afa?_0xcd1afa[_0x6cb6('0x19')]:![]);})[_0x6cb6('0x14')](function(_0xc5dea0){_0x5b5dab(_0xc5dea0);});};AGIVertices['prototype']['getUser']=function(_0x2dffa4,_0x1d35d1){this[_0x6cb6('0xf')][_0x6cb6('0x1a')](_0x2dffa4)['then'](function(_0x34d1a6){_0x1d35d1(null,_0x34d1a6?_0x34d1a6[_0x6cb6('0x13')]:![]);})['catch'](function(_0x5ad4f2){_0x1d35d1(_0x5ad4f2);});};AGIVertices[_0x6cb6('0x11')]['getTrunk']=function(_0x5c91a2,_0x457865){this[_0x6cb6('0xf')][_0x6cb6('0x1b')](_0x5c91a2)[_0x6cb6('0x18')](function(_0x16db1d){_0x457865(null,_0x16db1d?_0x16db1d[_0x6cb6('0x13')]:![]);})[_0x6cb6('0x14')](function(_0x1cc1ed){_0x457865(_0x1cc1ed);});};AGIVertices[_0x6cb6('0x11')]['getSound']=function(_0x5c525b,_0x4ea573){var _0x2dc6c9=this;this[_0x6cb6('0xf')][_0x6cb6('0x1c')](_0x5c525b)[_0x6cb6('0x18')](function(_0x1f8c9d){_0x4ea573(null,_0x1f8c9d?_0x2dc6c9[_0x6cb6('0x1d')](_0x1f8c9d['save_name']):![]);})[_0x6cb6('0x14')](function(_0x4d4ad9){_0x4ea573(_0x4d4ad9);});};AGIVertices[_0x6cb6('0x11')]['getMailAccount']=function(_0x13126c,_0x1f59cd){this[_0x6cb6('0xf')]['getMailAccountById'](_0x13126c)[_0x6cb6('0x18')](function(_0x1b7428){_0x1f59cd(null,_0x1b7428?_0x1b7428:![]);})[_0x6cb6('0x14')](function(_0x4a3785){_0x1f59cd(_0x4a3785);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1e')]=function(_0x386ef2,_0x573135,_0x16b653){this[_0x6cb6('0x10')]['sendMailMessage'](_0x386ef2,_0x573135)[_0x6cb6('0x18')](function(){_0x16b653(null);})[_0x6cb6('0x14')](function(_0x98abe0){_0x16b653(_0x98abe0);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1f')]=function(_0xb463fd,_0x3b05fe){this[_0x6cb6('0xf')][_0x6cb6('0x20')](_0xb463fd)[_0x6cb6('0x18')](function(_0x5a88be){if(_0x5a88be){if(_0x5a88be[_0x6cb6('0x21')]){_0x3b05fe(null,[_0x5a88be[_0x6cb6('0x22')]]);}else{_0x3b05fe(null,_[_0x6cb6('0x23')](_0x5a88be[_0x6cb6('0x24')],'interval'));}}else{_0x3b05fe(null,![]);}})['catch'](function(_0x59dd76){_0x3b05fe(_0x59dd76);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1d')]=function(_0x272f54){return util[_0x6cb6('0x25')](_0x6cb6('0x26'),FILES_PATH,_0x272f54);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x27')]=function(_0x950248,_0x4bbecb,_0x44d970){odbc['open'](_0x950248,function(_0x549368){if(_0x549368){logger[_0x6cb6('0x28')](_0x6cb6('0x29'),_0x549368);_0x44d970(_0x549368);}else{logger[_0x6cb6('0x2a')](_0x6cb6('0x2b'));odbc[_0x6cb6('0x2c')](_0x4bbecb,function(_0x1bb1e4,_0x5becea){if(_0x1bb1e4){logger[_0x6cb6('0x2a')]('Error\x20executing\x20query\x20%s',_0x4bbecb);_0x44d970(_0x1bb1e4);}else{logger[_0x6cb6('0x2a')](_0x6cb6('0x2d'),_0x4bbecb);odbc[_0x6cb6('0x2e')](function(_0x5a60a0){if(_0x5a60a0){logger['error'](_0x6cb6('0x2f'),_0x5a60a0);}_0x44d970(null,_0x5becea);});}});}});};AGIVertices['prototype'][_0x6cb6('0x30')]=function(_0x296a3b,_0xac22c9){this[_0x6cb6('0xf')][_0x6cb6('0x31')](_0x296a3b)[_0x6cb6('0x18')](function(_0x3652ca){_0xac22c9(null,_0x3652ca?_0x3652ca:![]);})['catch'](function(_0x359bd1){_0xac22c9(_0x359bd1);});};AGIVertices[_0x6cb6('0x11')]['createSmsMessage']=function(_0x163a8b,_0x4c6b9f){this[_0x6cb6('0xf')][_0x6cb6('0x32')](_0x163a8b)[_0x6cb6('0x18')](function(_0x3b435e){_0x4c6b9f(null,_0x3b435e);})['catch'](function(_0x5ba15f){_0x4c6b9f(_0x5ba15f);});};AGIVertices[_0x6cb6('0x11')]['createSquareDetailsReport']=function(_0x588ea4,_0x605673,_0x49beec){this[_0x6cb6('0xf')][_0x6cb6('0x33')]({'uniqueid':this['channel']['uniqueid'],'node':_0x588ea4[_0x6cb6('0x34')],'application':_0x588ea4['agicommand'],'data':_0x605673||null,'project_name':this[_0x6cb6('0xe')][_0x6cb6('0x35')],'callerid':this['channel'][_0x6cb6('0x36')]})[_0x6cb6('0x18')](function(_0x5ec0e1){if(_0x49beec){_0x49beec(null,_0x5ec0e1);}})[_0x6cb6('0x14')](function(_0x5b560d){if(_0x49beec){_0x49beec(_0x5b560d);}});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x37')]=function(_0x5b9d1d,_0x33a337,_0x2fc403,_0x591438){this['rpc'][_0x6cb6('0x37')]({'uniqueid':this[_0x6cb6('0xe')][_0x6cb6('0x38')],'callerid':this['channel'][_0x6cb6('0x36')],'calleridname':this[_0x6cb6('0xe')]['calleridname'],'context':this[_0x6cb6('0xe')][_0x6cb6('0x39')],'extension':this[_0x6cb6('0xe')]['extension'],'priority':this[_0x6cb6('0xe')][_0x6cb6('0x3a')],'accountcode':this[_0x6cb6('0xe')][_0x6cb6('0x3b')],'dnid':this[_0x6cb6('0xe')][_0x6cb6('0x3c')],'projectName':this['channel'][_0x6cb6('0x35')],'saveName':_0x33a337,'filename':_0x5b9d1d['file']||_0x33a337,'savePath':_0x2fc403})['then'](function(_0x29cb39){_0x591438(null,_0x29cb39);})[_0x6cb6('0x14')](function(_0x4b4137){_0x591438(_0x4b4137);});};AGIVertices[_0x6cb6('0x11')]['createSquareMessage']=function(_0x17b229,_0x2ae4ed,_0x3ed800,_0x5ee84a,_0x394f72){this[_0x6cb6('0xf')][_0x6cb6('0x3d')]({'uniqueid':this['channel'][_0x6cb6('0x38')],'body':_0x17b229,'direction':_0x2ae4ed,'providerName':_0x3ed800,'providerResponse':_0x5ee84a})['then'](function(_0x7e4104){if(_0x394f72){_0x394f72(null,_0x7e4104);}})[_0x6cb6('0x14')](function(_0x1bb142){if(_0x394f72){_0x394f72(_0x1bb142);}});};AGIVertices['prototype']['createCmContact']=function(_0xbf4f5f,_0x3dca6c){this[_0x6cb6('0xf')]['createCmContact']({'firstName':_[_0x6cb6('0x3e')](_0xbf4f5f[_0x6cb6('0x13')])||_[_0x6cb6('0x3f')](_0xbf4f5f['name'])?_0x6cb6('0x40')+Math[_0x6cb6('0x41')]():_0xbf4f5f[_0x6cb6('0x13')],'lastName':_['isEmpty'](_0xbf4f5f[_0x6cb6('0x42')])||_[_0x6cb6('0x3f')](_0xbf4f5f[_0x6cb6('0x42')])?null:_0xbf4f5f[_0x6cb6('0x42')],'phone':_0xbf4f5f[_0x6cb6('0x43')],'ListId':_0xbf4f5f[_0x6cb6('0x44')],'scheduledat':_0xbf4f5f[_0x6cb6('0x45')],'callbackUniqueid':this[_0x6cb6('0xe')][_0x6cb6('0x38')],'tags':_0x6cb6('0x46'),'description':_0x6cb6('0x47')+_0xbf4f5f[_0x6cb6('0x45')]['toString'](),'priority':_0xbf4f5f[_0x6cb6('0x48')]})[_0x6cb6('0x18')](function(_0x5f08e2){_0x3dca6c(null,_0x5f08e2);})[_0x6cb6('0x14')](function(_0x2e4382){_0x3dca6c(_0x2e4382);});};AGIVertices['prototype'][_0x6cb6('0x49')]=function(_0x23eba3,_0x4ece92){this['rpc'][_0x6cb6('0x4a')](_0x23eba3)[_0x6cb6('0x18')](function(_0x46ae66){_0x4ece92(null,_0x46ae66?_0x46ae66[_0x6cb6('0x13')]:![]);})[_0x6cb6('0x14')](function(_0x9f2d9f){_0x4ece92(_0x9f2d9f);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x4b')]=function(_0x4e36d8,_0x142386,_0x4e9c3f){var _0x24d57c={'role':_0x6cb6('0x4c')};_0x24d57c[_0x4e36d8]=this['channel'][_0x6cb6('0x36')];this['rpc']['agentPause'](_0x24d57c,_0x142386,this[_0x6cb6('0xe')][_0x6cb6('0x38')])[_0x6cb6('0x18')](function(_0x34ccd7){_0x4e9c3f(null,_[_0x6cb6('0x3f')](_0x34ccd7)?![]:!![]);})['catch'](function(_0x217165){logger[_0x6cb6('0x28')](_0x217165);_0x4e9c3f(null,![]);});};AGIVertices['prototype'][_0x6cb6('0x4d')]=function(_0x43084b,_0x39b7c8){var _0x51ab15={'role':_0x6cb6('0x4c')};_0x51ab15[_0x43084b]=this[_0x6cb6('0xe')][_0x6cb6('0x36')];this[_0x6cb6('0xf')][_0x6cb6('0x4d')](_0x51ab15)['then'](function(_0x34f98c){_0x39b7c8(null,_['isNil'](_0x34f98c)?![]:!![]);})[_0x6cb6('0x14')](function(_0x5d2091){logger[_0x6cb6('0x28')](_0x5d2091);_0x39b7c8(null,![]);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x4e')]=function(_0x2884b1,_0x72525b){var _0x5b7de3={'role':_0x6cb6('0x4c')};_0x5b7de3[_0x2884b1]=this[_0x6cb6('0xe')][_0x6cb6('0x36')];this[_0x6cb6('0xf')][_0x6cb6('0x4e')](_0x5b7de3)[_0x6cb6('0x18')](function(_0x5be76b){_0x72525b(null,_['isNil'](_0x5be76b)?![]:!![]);})[_0x6cb6('0x14')](function(_0x1aec61){logger[_0x6cb6('0x28')](_0x1aec61);_0x72525b(null,![]);});};AGIVertices['prototype'][_0x6cb6('0x4f')]=function(_0x33829b,_0x84d0cc){var _0x51d1bd={'role':_0x6cb6('0x4c')};_0x51d1bd[_0x33829b]=this[_0x6cb6('0xe')][_0x6cb6('0x36')];var _0x22ec81=_0x33829b!='internal'?util[_0x6cb6('0x25')]('%s/%s@from-sip/n',_0x6cb6('0x50'),this[_0x6cb6('0xe')][_0x6cb6('0x36')]):undefined;this['rpc']['agentLogin'](_0x51d1bd,_0x22ec81)[_0x6cb6('0x18')](function(_0x301b33){_0x84d0cc(null,_['isNil'](_0x301b33)?![]:!![]);})[_0x6cb6('0x14')](function(_0x47f528){logger[_0x6cb6('0x28')](_0x47f528);_0x84d0cc(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x4ad974,_0x2b542d){sh[_0x6cb6('0x51')](_[_0x6cb6('0x52')](_0x4ad974),function(_0x3556da,_0x4d2eaf){var _0x4fe51b=_0x4d2eaf[_0x6cb6('0x53')](/(\r\n|\n|\r)/gm,'');_0x2b542d(null,_0x4fe51b);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x302c63,_0x30f1f9){scripts[_0x6cb6('0x54')](_0x302c63[_0x6cb6('0x55')],_0x302c63['google_cloud_tts_text_type']||_0x6cb6('0x56'),_0x302c63[_0x6cb6('0x56')],_0x302c63[_0x6cb6('0x57')]||'en-US',_0x302c63['ssmlGender']||_0x6cb6('0x58'),_0x302c63['audioEncoding']||_0x6cb6('0x59'))['then'](function(_0x5adb9a){_0x30f1f9(null,_0x5adb9a);})[_0x6cb6('0x14')](function(_0x2448dd){_0x30f1f9(_0x2448dd);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x5a')]=function(_0xe28845,_0x2c3d4c){scripts[_0x6cb6('0x5a')](_0xe28845[_0x6cb6('0x56')],_0xe28845['google_tts_language']||'en',0x1)[_0x6cb6('0x18')](function(_0x11644d){_0x2c3d4c(null,_0x11644d);})[_0x6cb6('0x14')](function(_0x4283a7){_0x2c3d4c(_0x4283a7);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x5b')]=function(_0x27b851,_0xeaa6ab){var _0x285c9b={'uri':_0x27b851['url'],'method':_0x27b851['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x27b851['timeout'])==='number'&&parseInt(_0x27b851[_0x6cb6('0x5c')])>=0x1?parseInt(_0x27b851['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x6cb6('0x5d')]([_0x6cb6('0x5e'),_0x6cb6('0x5f')],_0x285c9b[_0x6cb6('0x60')][_0x6cb6('0x61')]())){try{_0x285c9b[_0x6cb6('0x62')]=_0x27b851[_0x6cb6('0xa')]?JSON[_0x6cb6('0x63')](_0x27b851[_0x6cb6('0xa')]):{};}catch(_0x2f46bc){logger[_0x6cb6('0x28')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2f46bc);}}try{_0x285c9b['headers']=_0x27b851[_0x6cb6('0x64')]?JSON[_0x6cb6('0x63')](_0x27b851[_0x6cb6('0x64')]):{};}catch(_0x2b8f2c){logger[_0x6cb6('0x28')](_0x6cb6('0x65'),_0x2b8f2c);}if(_0x27b851['computedVariables']){try{var _0x526467=require(_0x27b851['computedVariables'])[_0x6cb6('0x66')](this,_0x285c9b);_0x285c9b[_0x6cb6('0x67')]=Mustache[_0x6cb6('0x68')](_0x27b851[_0x6cb6('0x69')],_0x526467,{},['$$','$$']);if(_0x285c9b[_0x6cb6('0x6a')]){_0x285c9b[_0x6cb6('0x6a')]=JSON[_0x6cb6('0x63')](Mustache['render'](JSON['stringify'](_0x285c9b['headers']),_0x526467,{},['$$','$$']));}if(_0x285c9b[_0x6cb6('0x62')]){_0x285c9b[_0x6cb6('0x62')]=JSON[_0x6cb6('0x63')](Mustache[_0x6cb6('0x68')](JSON[_0x6cb6('0x6b')](_0x285c9b[_0x6cb6('0x62')]),_0x526467,{},['$$','$$']));}}catch(_0x2b00ad){logger[_0x6cb6('0x28')](_0x6cb6('0x6c'),_0x2b00ad);}}rp(_0x285c9b)['then'](function(_0x2d646c){var _0x3e1d6c={'statusCode':_0x2d646c[_0x6cb6('0x6d')]||0xc8,'statusMessage':_0x2d646c[_0x6cb6('0x6e')]||'OK','headers':_0x2d646c[_0x6cb6('0x6a')]||{},'body':_0x2d646c[_0x6cb6('0x62')]||{}};_0xeaa6ab(null,_0x3e1d6c);})[_0x6cb6('0x14')](function(_0x4e53cd){var _0x54b00b={'statusCode':_0x4e53cd[_0x6cb6('0x6d')]||0x1f4,'statusMessage':_0x4e53cd[_0x6cb6('0x6f')]||_0x6cb6('0x70'),'headers':_0x4e53cd[_0x6cb6('0x71')]['headers']||{},'body':_0x4e53cd[_0x6cb6('0x71')][_0x6cb6('0x62')]||{}};_0xeaa6ab(null,_0x54b00b);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x72')]=function(_0x208f7b,_0x53e4e3){scripts[_0x6cb6('0x72')](this[_0x6cb6('0xe')][_0x6cb6('0x38')],_0x208f7b[_0x6cb6('0x73')],_0x208f7b[_0x6cb6('0x56')],_0x208f7b[_0x6cb6('0x74')]||'en')[_0x6cb6('0x18')](function(_0x41a918){_0x53e4e3(null,_0x41a918);})[_0x6cb6('0x14')](function(_0x3d891b){_0x53e4e3(_0x3d891b);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x75')]=function(_0x4c3672,_0x3bdddb){scripts['googleDialogflowV2'](this['channel']['uniqueid'],_0x4c3672[_0x6cb6('0x76')],_0x4c3672['client_email'],_0x4c3672[_0x6cb6('0x77')],_0x4c3672[_0x6cb6('0x56')],_0x4c3672[_0x6cb6('0x78')]||'en')[_0x6cb6('0x18')](function(_0x2087d8){_0x3bdddb(null,_0x2087d8);})[_0x6cb6('0x14')](function(_0xaf5181){_0x3bdddb(_0xaf5181);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x79')]=function(_0x253a1f,_0x4943f3){scripts[_0x6cb6('0x79')](this[_0x6cb6('0xe')],_0x253a1f)['then'](function(_0x8d3531){_0x4943f3(null,_0x8d3531);})['catch'](function(_0x47f625){_0x4943f3(_0x47f625);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x7a')]=function(_0x3a7be0,_0x3369ca){scripts[_0x6cb6('0x7a')](_0x3a7be0[_0x6cb6('0x73')],_0x3a7be0['text'],_0x3a7be0[_0x6cb6('0x7b')]||_0x6cb6('0x7c'),_0x3a7be0['speed'])[_0x6cb6('0x18')](function(_0x58a31a){_0x3369ca(null,_0x58a31a);})[_0x6cb6('0x14')](function(_0x40fe72){_0x3369ca(_0x40fe72);});};AGIVertices['prototype'][_0x6cb6('0x7d')]=function(_0x146bed,_0x38a305,_0x32d8cf){scripts[_0x6cb6('0x7d')](_0x38a305,_0x146bed[_0x6cb6('0x73')],_0x146bed['ispeech_asr_language']||_0x6cb6('0x7c'),this[_0x6cb6('0x7e')](_0x146bed[_0x6cb6('0x7f')])?_0x146bed[_0x6cb6('0x7f')]:undefined)[_0x6cb6('0x18')](function(_0x312a4a){_0x32d8cf(null,_0x312a4a);})['catch'](function(_0x16f774){_0x32d8cf(_0x16f774);});};AGIVertices['prototype']['awsPolly']=function(_0x3cd8bb,_0xfc4f5e){scripts['awsPolly'](_0x3cd8bb[_0x6cb6('0x80')],_0x3cd8bb[_0x6cb6('0x81')],_0x3cd8bb['aws_polly_region'],_0x3cd8bb[_0x6cb6('0x82')]||_0x6cb6('0x83'),_0x3cd8bb[_0x6cb6('0x56')],_0x3cd8bb['aws_text_type']||'text')[_0x6cb6('0x18')](function(_0xc256c4){_0xfc4f5e(null,_0xc256c4);})[_0x6cb6('0x14')](function(_0x429572){_0xfc4f5e(_0x429572);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x84')]=function(_0x3fef21,_0xcd0781){scripts[_0x6cb6('0x84')](this[_0x6cb6('0xe')][_0x6cb6('0x38')],_0x3fef21['aws_access_key_id'],_0x3fef21[_0x6cb6('0x81')],_0x3fef21[_0x6cb6('0x85')],_0x3fef21[_0x6cb6('0x56')],_0x3fef21[_0x6cb6('0x86')])[_0x6cb6('0x18')](function(_0x129fa7){_0xcd0781(null,_0x129fa7);})['catch'](function(_0x1a2172){_0xcd0781(_0x1a2172);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x87')]=function(_0x5733af,_0x11ba2f,_0x161600){scripts['googleASR'](_0x11ba2f,_0x5733af['key'],_0x5733af[_0x6cb6('0x88')]||'en-US')[_0x6cb6('0x18')](function(_0x2af6e6){_0x161600(null,_0x2af6e6);})['catch'](function(_0x282c3d){_0x161600(_0x282c3d);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x89')]=function(_0x303c38,_0x22858a,_0x4b0b04){scripts[_0x6cb6('0x89')](_0x22858a,_0x303c38[_0x6cb6('0x8a')],_0x303c38[_0x6cb6('0x8b')],_0x303c38[_0x6cb6('0x67')])['then'](function(_0x419b66){_0x4b0b04(null,_0x419b66);})[_0x6cb6('0x14')](function(_0x34641c){_0x4b0b04(_0x34641c);});};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x8c')]=function(_0x5217d7){var _0x49486a=_['includes'](verticesWithRetry,_0x5217d7[_0x6cb6('0x8d')])?_0x5217d7:_[_0x6cb6('0x8e')](_0x5217d7);for(var _0x399831 in _0x49486a){if(_0x49486a[_0x6cb6('0x8f')](_0x399831)){if(_0x49486a[_0x399831]&&_['isString'](_0x49486a[_0x399831])){if(_[_0x6cb6('0x5d')](recursiveMapAttributes,_0x399831)){_0x49486a[_0x399831]=this[_0x6cb6('0x90')](_0x49486a[_0x399831]);}else{_0x49486a[_0x399831]=this[_0x6cb6('0x91')](_0x49486a[_0x399831]);}}}}return _0x49486a;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x92')]=function(_0x49e78f){for(var _0x5e541e in _0x49e78f){if(_0x49e78f[_0x6cb6('0x8f')](_0x5e541e)){if(_[_0x6cb6('0x93')](_0x49e78f[_0x5e541e])){this[_0x6cb6('0x92')](_0x49e78f[_0x5e541e]);}else if(_[_0x6cb6('0x94')](_0x49e78f[_0x5e541e])){for(var _0x1c6ac8=0x0;_0x1c6ac8<_0x49e78f[_0x5e541e][_0x6cb6('0x95')];_0x1c6ac8++){this[_0x6cb6('0x92')](_0x49e78f[_0x5e541e][_0x1c6ac8]);}}else if(_[_0x6cb6('0x96')](_0x49e78f[_0x5e541e])){_0x49e78f[_0x5e541e]=this[_0x6cb6('0x91')](_0x49e78f[_0x5e541e]);}}}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x97')]=function(_0x1e4b50,_0x5c1116){for(var _0x445eb3 in _0x1e4b50){if(_0x1e4b50[_0x6cb6('0x8f')](_0x445eb3)){if(_[_0x6cb6('0x93')](_0x1e4b50[_0x445eb3])){if(!_[_0x6cb6('0x3e')](_0x1e4b50[_0x445eb3])){this[_0x6cb6('0x97')](_0x1e4b50[_0x445eb3],util[_0x6cb6('0x25')]('%s.%s',_0x5c1116,_0x445eb3));}}else if(_[_0x6cb6('0x94')](_0x1e4b50[_0x445eb3])){for(var _0x53c85e=0x0;_0x53c85e<_0x1e4b50[_0x445eb3][_0x6cb6('0x95')];_0x53c85e++){this[_0x6cb6('0x97')](_0x1e4b50[_0x445eb3][_0x53c85e],util[_0x6cb6('0x25')](_0x6cb6('0x98'),_0x5c1116,_0x445eb3+'['+_0x53c85e+']'));}}else{if(!_[_0x6cb6('0x3f')](_0x1e4b50[_0x445eb3])){this[_0x6cb6('0xe')][_0x6cb6('0x99')](util['format']('%s.%s',_0x5c1116,_0x445eb3),_0x1e4b50[_0x445eb3]);}}}}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x90')]=function(_0x478fea){try{var _0x2a6aff=JSON[_0x6cb6('0x63')](_0x478fea);this['recursiveNodeIndex'](_0x2a6aff);return JSON['stringify'](_0x2a6aff);}catch(_0x49a59f){return this[_0x6cb6('0x91')](_0x478fea);}};AGIVertices[_0x6cb6('0x11')]['replaceAllVariables']=function(_0xc079e8){var _0x32906c=_0xc079e8[_0x6cb6('0x9a')]('{');for(var _0x4e0c9e=0x1;_0x4e0c9e<_0x32906c[_0x6cb6('0x95')];_0x4e0c9e+=0x1){var _0x4ca47b=_0x32906c[_0x4e0c9e]['split']('}');if(_0x4ca47b['length']>0x1){_0xc079e8=_0xc079e8[_0x6cb6('0x9b')]('{'+_0x4ca47b[0x0]+'}',this['channel'][_0x6cb6('0x12')](_0x4ca47b[0x0])[_0x6cb6('0x9c')]||_0x4ca47b[0x0]);}}if(_0x32906c[_0x6cb6('0x95')]===0x1){return _0xc079e8['toString']();}return this[_0x6cb6('0x91')](_0xc079e8);};AGIVertices['prototype']['getAndSetVariable']=function(_0x956faa,_0x32f2f4){var _0x535241=this[_0x6cb6('0xe')][_0x6cb6('0x12')](_0x956faa);if(_0x535241[_0x6cb6('0x9d')]===-0x1){return _0x535241;}logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x9e'),_0x32f2f4,_0x535241[_0x6cb6('0x9c')]));return this[_0x6cb6('0xe')]['setVariable'](_0x32f2f4,_0x535241[_0x6cb6('0x9c')]);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x7e')]=function(_0x53a8ef){return _0x53a8ef&&_0x53a8ef!=='0'&&_0x53a8ef!=='-1'&&_0x53a8ef!=='';};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x9f')]=function(_0x27ef33){this[_0x6cb6('0x33')]['sync'](this,_0x27ef33,'-');_0x27ef33[_0x6cb6('0xa0')]=_0x27ef33[_0x6cb6('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x6cb6('0x11')]['mrcpsynth']=function(_0x7c1691){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0xa1'),_0x7c1691[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x7c1691['text'])){return this[_0x6cb6('0xe')]['noop']('no\x20text\x20configured');}var _0x299acf='\x22'+_0x7c1691['text']+'\x22';if(this[_0x6cb6('0x7e')](_0x7c1691['options'])){_0x299acf+=','+_0x7c1691['options'];}var _0x37a01b=this['channel']['exec'](_0x6cb6('0xa2'),_0x299acf);if(_0x37a01b[_0x6cb6('0x9d')]===-0x1){return _0x37a01b;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xa4'),_0x299acf));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xa5')]=function(_0x279907){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x279907[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x279907['grammar'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20grammar\x20configured');}var _0x24159b=_0x279907[_0x6cb6('0xa6')];if(this['isConfigured'](_0x279907[_0x6cb6('0x71')])){_0x24159b+=','+_0x279907['options'];}var _0x274650=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xa7'),_0x24159b);if(_0x274650[_0x6cb6('0x9d')]===-0x1){return _0x274650;}var _0x12bce9=this[_0x6cb6('0xa8')](_0x6cb6('0xa9'),'MRCP_RECOG_CONFIDENCE');if(_0x12bce9[_0x6cb6('0x9d')]===-0x1){return _0x12bce9;}var _0x56465e=this[_0x6cb6('0xa8')]('RECOG_INPUT()',_0x6cb6('0xaa'));if(_0x56465e[_0x6cb6('0x9d')]===-0x1){return _0x56465e;}var _0x9385e7=this[_0x6cb6('0xa8')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x9385e7[_0x6cb6('0x9d')]===-0x1){return _0x9385e7;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x24159b));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x7')]=function(_0x400bae){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xab'),_0x400bae[_0x6cb6('0x34')]));return this['channel'][_0x6cb6('0x7')]([_0x400bae[_0x6cb6('0xac')],_0x400bae[_0x6cb6('0xad')]]);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xae')]=function(_0x19d0cd){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0xaf'),_0x19d0cd[_0x6cb6('0x34')]));if(this['isConfigured'](_0x19d0cd[_0x6cb6('0x5c')])){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x19d0cd[_0x6cb6('0x5c')]));var _0x5431ff=this[_0x6cb6('0xe')]['wait'](_0x19d0cd[_0x6cb6('0x5c')]);if(_0x5431ff[_0x6cb6('0x9d')]===-0x1){return _0x5431ff;}}return this['channel']['answer']();};AGIVertices['prototype']['callback']=function(_0x476c52){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xb0'),_0x476c52[_0x6cb6('0x34')]));if(!this['isConfigured'](_0x476c52['list_id'])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x476c52,_0x6cb6('0xb1'));}_0x476c52[_0x6cb6('0x45')]=moment();if(this[_0x6cb6('0x7e')](_0x476c52[_0x6cb6('0xb2')])){_0x476c52['scheduledAt']=moment()[_0x6cb6('0xb3')](_0x476c52[_0x6cb6('0xb2')],_0x6cb6('0xb4'));}if(!this[_0x6cb6('0x7e')](_0x476c52[_0x6cb6('0x48')])){_0x476c52['callback_priority']=0x2;}this[_0x6cb6('0xb5')][_0x6cb6('0x66')](this,_0x476c52);return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x476c52[_0x6cb6('0x43')],_0x476c52['list_id'],_0x476c52[_0x6cb6('0x45')]));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xb6')]=function(_0x218d6f){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x218d6f['label']));var _0x156c78=this['channel'][_0x6cb6('0x51')](_0x218d6f[_0x6cb6('0xb7')],_0x218d6f[_0x6cb6('0x71')]);if(_0x156c78['result']===-0x1){return _0x156c78;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xb8'),_0x218d6f[_0x6cb6('0xb7')],_0x218d6f[_0x6cb6('0x71')]));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xb9')]=function(_0x51e260){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0xba'),_0x51e260['label']));if(!this[_0x6cb6('0x7e')](_0x51e260[_0x6cb6('0x56')])){return this['channel'][_0x6cb6('0xa3')]('no\x20text\x20configured');}var _0x50f33e='\x22'+_0x51e260[_0x6cb6('0x56')]+'\x22';if(this[_0x6cb6('0x7e')](_0x51e260[_0x6cb6('0x71')])){_0x50f33e+=','+_0x51e260[_0x6cb6('0x71')];}var _0x2fd9ff=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xa2'),_0x50f33e);if(_0x2fd9ff[_0x6cb6('0x9d')]===-0x1){return _0x2fd9ff;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xa4'),_0x50f33e));};AGIVertices[_0x6cb6('0x11')]['sestektts']=function(_0x1853ce){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x1853ce[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x1853ce['text'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20text\x20configured');}var _0x4c7b6c='\x22'+_0x1853ce['text']+'\x22';if(this[_0x6cb6('0x7e')](_0x1853ce['options'])){_0x4c7b6c+=','+_0x1853ce[_0x6cb6('0x71')];}var _0x4e5661=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xa2'),_0x4c7b6c);if(_0x4e5661['result']===-0x1){return _0x4e5661;}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0xa4'),_0x4c7b6c));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xbb')]=function(_0x3295f6){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xbc'),_0x3295f6[_0x6cb6('0x34')]));if(!this['isConfigured'](_0x3295f6['grammar'])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0xbd'));}var _0x2ba800=_0x3295f6[_0x6cb6('0xa6')];if(this['isConfigured'](_0x3295f6[_0x6cb6('0x71')])){_0x2ba800+=','+_0x3295f6[_0x6cb6('0x71')];}var _0x565cd7=this[_0x6cb6('0xe')]['exec'](_0x6cb6('0xa7'),_0x2ba800);if(_0x565cd7['result']===-0x1){return _0x565cd7;}var _0x15fd77=this[_0x6cb6('0xa8')](_0x6cb6('0xa9'),'LUMENVOX_ASR_CONFIDENCE');if(_0x15fd77[_0x6cb6('0x9d')]===-0x1){return _0x15fd77;}var _0x1da669=this[_0x6cb6('0xa8')]('RECOG_INPUT()',_0x6cb6('0xbe'));if(_0x1da669['result']===-0x1){return _0x1da669;}var _0x210741=this[_0x6cb6('0xa8')](_0x6cb6('0xbf'),_0x6cb6('0xc0'));if(_0x210741[_0x6cb6('0x9d')]===-0x1){return _0x210741;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x2ba800));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xc1')]=function(_0xe3988){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xc2'),_0xe3988['label']));if(!this[_0x6cb6('0x7e')](_0xe3988['grammar'])){return this[_0x6cb6('0xe')]['noop']('no\x20grammar\x20configured');}var _0x49f842=_0xe3988[_0x6cb6('0xa6')];if(this[_0x6cb6('0x7e')](_0xe3988[_0x6cb6('0x71')])){_0x49f842+=','+_0xe3988[_0x6cb6('0x71')];}var _0x267233=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xa7'),_0x49f842);if(_0x267233[_0x6cb6('0x9d')]===-0x1){return _0x267233;}var _0x57fd05=this[_0x6cb6('0xa8')](_0x6cb6('0xa9'),_0x6cb6('0xc3'));if(_0x57fd05['result']===-0x1){return _0x57fd05;}var _0x124218=this[_0x6cb6('0xa8')](_0x6cb6('0xc4'),_0x6cb6('0xc5'));if(_0x124218[_0x6cb6('0x9d')]===-0x1){return _0x124218;}var _0x130593=this['getAndSetVariable'](_0x6cb6('0xbf'),_0x6cb6('0xc6'));if(_0x130593[_0x6cb6('0x9d')]===-0x1){return _0x130593;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('Executed\x20command\x20MRCPRecog\x20%s',_0x49f842));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xc7')]=function(_0x5129a7){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0xc8'),_0x5129a7[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x5129a7['odbc_id'])){return this[_0x6cb6('0xe')]['error'](_0x5129a7,_0x6cb6('0xc9'));}var _0x60086b=this['getSquareOdbc'][_0x6cb6('0x66')](this,_0x5129a7[_0x6cb6('0xca')]);if(!_0x60086b){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x5129a7,_0x6cb6('0xcb'));}if(!this[_0x6cb6('0x7e')](_0x5129a7[_0x6cb6('0x2c')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x5129a7,_0x6cb6('0xcc'));}var _0xb02e89=_0x5129a7[_0x6cb6('0x2c')][_0x6cb6('0x53')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('query:\x20%s',_0xb02e89));var _0x4e5593=this['getQueryOdbc'][_0x6cb6('0x66')](this,_0x60086b,_0xb02e89);this['createSquareDetailsReport']['sync'](this,_0x5129a7,_0xb02e89);if(!this[_0x6cb6('0x7e')](_0x5129a7[_0x6cb6('0xcd')])){return this[_0x6cb6('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x414926=this[_0x6cb6('0x12')]['sync'](this,_0x5129a7[_0x6cb6('0xcd')]);if(!_0x414926){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x5129a7,'no\x20variable\x20found');}var _0x3209b9=this;_0x4e5593[_0x6cb6('0xce')](function(_0x3f98a6,_0x45b2d3){Object[_0x6cb6('0xcf')](_0x3f98a6)[_0x6cb6('0xce')](function(_0x478180){_0x3209b9[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')]('%s[%s][%s]',_0x414926,_0x45b2d3,_0x478180),_0x3f98a6[_0x478180]);});});this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0xd0'),_0x414926),_0x4e5593[_0x6cb6('0x95')]);return this['channel'][_0x6cb6('0xa3')](util['format']('variable\x20%s\x20set',_0x414926));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xd1')]=function(_0x5ef860){logger['debug'](util[_0x6cb6('0x25')](_0x6cb6('0xd2'),_0x5ef860['label']));if(!this['isConfigured'](_0x5ef860[_0x6cb6('0xd3')])){return this['channel'][_0x6cb6('0x28')](_0x5ef860,'no\x20user\x20selected');}var _0x91122f=this[_0x6cb6('0xd4')][_0x6cb6('0x66')](this,_0x5ef860[_0x6cb6('0xd3')]);if(!_0x91122f){return this[_0x6cb6('0xe')]['error'](_0x5ef860,_0x6cb6('0xd5'));}var _0x110f1d=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xd6'),[util['format']('SIP/%s',_0x91122f),_0x5ef860[_0x6cb6('0x5c')],_0x5ef860[_0x6cb6('0xd7')],_0x5ef860[_0x6cb6('0x69')]]);if(_0x110f1d['result']===-0x1){return _0x110f1d;}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0xd8'),_0x6cb6('0xd6')));};AGIVertices['prototype'][_0x6cb6('0xd9')]=function(_0x2993be){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xda'),_0x2993be[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x2993be['key'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xdb'));}if(!this[_0x6cb6('0x7e')](_0x2993be[_0x6cb6('0x56')])){return this['channel'][_0x6cb6('0xa3')](_0x6cb6('0xdc'));}this['channel'][_0x6cb6('0xdd')]=!![];this['createSquareDetailsReport'](_0x2993be);this[_0x6cb6('0x3d')](_0x2993be['text'],'in','','');this['channel'][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xde'),_0x2993be[_0x6cb6('0x56')]));var _0x38310b=this[_0x6cb6('0x72')][_0x6cb6('0x66')](this,_0x2993be);if(_0x38310b){for(var _0x1cb98e in _0x38310b){if(_0x38310b['hasOwnProperty'](_0x1cb98e)){this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0xdf'),_0x1cb98e[_0x6cb6('0x61')]()),_0x38310b[_0x1cb98e]);}}this[_0x6cb6('0x3d')](_0x38310b[_0x6cb6('0xe0')],_0x6cb6('0xe1'),'dialogflow','');return this['channel'][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xe2'),_0x38310b['speech']));}return this['channel']['error'](_0x2993be,_0x6cb6('0xe3'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xe4')]=function(_0x230ec6){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xe5'),_0x230ec6[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x230ec6[_0x6cb6('0x76')])){return this['channel'][_0x6cb6('0xa3')](_0x6cb6('0xe6'));}if(!this[_0x6cb6('0x7e')](_0x230ec6[_0x6cb6('0xe7')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xe8'));}if(!this[_0x6cb6('0x7e')](_0x230ec6[_0x6cb6('0x77')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xe9'));}if(!this[_0x6cb6('0x7e')](_0x230ec6[_0x6cb6('0x78')])){return this['channel'][_0x6cb6('0xa3')](_0x6cb6('0xea'));}if(!this[_0x6cb6('0x7e')](_0x230ec6['text'])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')][_0x6cb6('0xdd')]=!![];this['createSquareDetailsReport'](_0x230ec6);this['createSquareMessage'](_0x230ec6[_0x6cb6('0x56')],'in','','');this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x230ec6[_0x6cb6('0x56')]));var _0x5f1cc7=this[_0x6cb6('0x75')]['sync'](this,_0x230ec6);if(_0x5f1cc7){for(var _0x2eba4a in _0x5f1cc7){if(_0x5f1cc7['hasOwnProperty'](_0x2eba4a)){if(_0x2eba4a!==_0x6cb6('0xeb')){this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0xdf'),_0x2eba4a['toUpperCase']()),_0x5f1cc7[_0x2eba4a]);}}}this[_0x6cb6('0x3d')](_0x5f1cc7['speech'],'out','dialogflowV2',_0x5f1cc7[_0x6cb6('0xeb')]);return this['channel']['noop'](util[_0x6cb6('0x25')](_0x6cb6('0xec'),_0x5f1cc7[_0x6cb6('0xe0')]));}return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x230ec6,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0x6cb6('0xed')]=function(_0x3de187){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0xee'),_0x3de187[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x3de187['ndauth_url'])){return this['channel']['noop'](_0x6cb6('0xef'));}if(!this[_0x6cb6('0x7e')](_0x3de187[_0x6cb6('0xf0')])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0xf1'));}if(!this[_0x6cb6('0x7e')](_0x3de187[_0x6cb6('0xf2')])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0xf3'));}if(!this[_0x6cb6('0x7e')](_0x3de187[_0x6cb6('0xf4')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x3de187);this[_0x6cb6('0x3d')](_0x3de187[_0x6cb6('0x56')],'in','','');this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('Trying\x20SestekNDA:\x20%s',_0x3de187[_0x6cb6('0x56')]));var _0x393f3f=this['sestekNDA'][_0x6cb6('0x66')](this,_0x3de187);if(_0x393f3f){for(var _0x34af51 in _0x393f3f){if(_0x393f3f[_0x6cb6('0x8f')](_0x34af51)){this['channel'][_0x6cb6('0x99')](util['format']('SESTEK_NDA_%s',_0x34af51[_0x6cb6('0x61')]()),_0x393f3f[_0x34af51]);}}this[_0x6cb6('0x3d')](_0x393f3f[_0x6cb6('0xe0')],_0x6cb6('0xe1'),_0x6cb6('0xed'),'');if(_0x393f3f['audiofile']){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xf5'),_0x393f3f[_0x6cb6('0xf6')]));var _0x12b908=this['channel'][_0x6cb6('0xf7')](_0x393f3f[_0x6cb6('0xf6')]);try{fs[_0x6cb6('0xf8')](_0x393f3f['audiofile']+_0x6cb6('0xf9'));}catch(_0x433c42){logger[_0x6cb6('0x28')](_0x433c42);}return _0x12b908;}else{return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('SestekNDA\x20Result\x20%s',_0x393f3f[_0x6cb6('0xe0')]));}}return this['channel'][_0x6cb6('0x28')](_0x3de187,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xfa')]=function(_0x33aca9){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20END\x20(%s)\x20block',_0x33aca9[_0x6cb6('0x34')]));return this['channel'][_0x6cb6('0xa3')]('end');};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xfb')]=function(_0x2a64ee){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0xfc'),_0x2a64ee[_0x6cb6('0x34')]));var _0x352d9a='';if(_0x2a64ee[_0x6cb6('0xfd')]){if(!this['isConfigured'](_0x2a64ee[_0x6cb6('0xfd')])){return this[_0x6cb6('0xe')]['error'](_0x2a64ee,_0x6cb6('0xfe'));}else{var _0x55cc81=parseInt(_0x2a64ee['trunk_id'],0xa);if(isNaN(_0x55cc81)){_0x352d9a=_0x2a64ee[_0x6cb6('0xfd')];}else{_0x352d9a=this['getTrunk']['sync'](this,_0x2a64ee['trunk_id']);if(!_0x352d9a){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x2a64ee,_0x6cb6('0xff'));}}}}else if(_0x2a64ee[_0x6cb6('0x100')]){_0x352d9a=_0x2a64ee[_0x6cb6('0x100')];}else{return this['channel'][_0x6cb6('0x28')](_0x2a64ee,_0x6cb6('0xfe'));}var _0xdd11eb=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0xd6'),[util['format']('SIP/%s/%s',_0x352d9a,_0x2a64ee[_0x6cb6('0x43')]),_0x2a64ee[_0x6cb6('0x5c')],_0x2a64ee[_0x6cb6('0xd7')],_0x2a64ee[_0x6cb6('0x69')]]);if(_0xdd11eb['result']===-0x1){return _0xdd11eb;}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')]('Executed\x20command\x20%s',_0x6cb6('0xd6')));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x101')]=function(_0xe0dde4){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0xe0dde4[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x101'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xc')]=function(_0x23a5e7){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x102'),_0x23a5e7[_0x6cb6('0x34')]));if(_0x23a5e7[_0x6cb6('0xa0')]===0x0){return this[_0x6cb6('0x9f')](_0x23a5e7);}_0x23a5e7[_0x6cb6('0xa0')]-=0x1;if(!this['isConfigured'](_0x23a5e7[_0x6cb6('0x103')])){return this['channel'][_0x6cb6('0x28')](_0x23a5e7,_0x6cb6('0x104'));}var _0x29a79b=this[_0x6cb6('0x105')][_0x6cb6('0x66')](this,_0x23a5e7[_0x6cb6('0x103')]);if(!_0x29a79b){return this['channel'][_0x6cb6('0x28')](_0x23a5e7,_0x6cb6('0x106'));}if(!this[_0x6cb6('0x7e')](_0x23a5e7[_0x6cb6('0xcd')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x45650b=this[_0x6cb6('0xe')][_0x6cb6('0x107')](_0x29a79b,_0x23a5e7[_0x6cb6('0x108')],_0x23a5e7[_0x6cb6('0x109')]);var _0x306a95=_0x45650b['result']?_0x45650b[_0x6cb6('0x9d')][_0x6cb6('0x10a')]():'';logger[_0x6cb6('0x2a')](_0x6cb6('0x10b'),JSON['stringify'](_0x45650b));if(_0x45650b[_0x6cb6('0x9d')]===-0x1){this[_0x6cb6('0x33')]['sync'](this,_0x23a5e7,_0x306a95);return _0x45650b;}else if(_0x45650b[_0x6cb6('0x9c')]===_0x6cb6('0x5c')){_0x45650b['result']=_0x306a95[_0x6cb6('0x95')]>=parseInt(_0x23a5e7['mindigit'])?'x':'i';}else{_0x45650b['result']=_0x306a95['length']>=parseInt(_0x23a5e7[_0x6cb6('0x10c')])&&_0x306a95[_0x6cb6('0x95')]<=parseInt(_0x23a5e7[_0x6cb6('0x109')])?'x':'i';}var _0x4676fb=this[_0x6cb6('0x12')][_0x6cb6('0x66')](this,_0x23a5e7[_0x6cb6('0xcd')]);if(!_0x4676fb){return this['channel']['error'](_0x23a5e7,_0x6cb6('0x10d'));}this['channel']['setVariable'](_0x4676fb,_0x306a95);if(this[_0x6cb6('0x7e')](_0x23a5e7[_0x6cb6('0x10e')])){var _0x3f0cfb=parseInt(_0x23a5e7[_0x6cb6('0x10e')],0xa);var _0x2ff472=rs[_0x6cb6('0x10f')]({'charset':'*','length':_0x3f0cfb});var _0x512620=_0x306a95[_0x6cb6('0x95')];if(_0x512620>0x0){if(_0x512620>_0x3f0cfb){this[_0x6cb6('0x33')]['sync'](this,_0x23a5e7,_0x23a5e7[_0x6cb6('0x110')]===_0x6cb6('0x111')?_0x2ff472+_0x306a95[_0x6cb6('0x112')](_0x3f0cfb):_0x306a95[_0x6cb6('0x112')](0x0,_0x512620-_0x3f0cfb)+_0x2ff472);}else{this[_0x6cb6('0x33')]['sync'](this,_0x23a5e7,rs[_0x6cb6('0x10f')]({'charset':'*','length':_0x512620}));}}else{this[_0x6cb6('0x33')][_0x6cb6('0x66')](this,_0x23a5e7,'');}}else{this[_0x6cb6('0x33')]['sync'](this,_0x23a5e7,_0x306a95);}return _0x45650b;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xd')]=function(_0x2d4699){logger['info'](util['format'](_0x6cb6('0x113'),_0x2d4699[_0x6cb6('0x34')]));return this[_0x6cb6('0xc')](_0x2d4699);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x114')]=function(_0x5f32e3){logger['info'](util['format'](_0x6cb6('0x115'),_0x5f32e3['label']));this['createSquareDetailsReport']['sync'](this,_0x5f32e3,_0x5f32e3['goalname']);return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0x116'),_0x5f32e3['goalname']));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x117')]=function(_0x27ba97){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x118'),_0x27ba97[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x27ba97['aws_access_key_id'])||!this[_0x6cb6('0x7e')](_0x27ba97[_0x6cb6('0x81')])){return this[_0x6cb6('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x27ba97[_0x6cb6('0x56')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('Trying\x20aws\x20Polly\x20%s',_0x27ba97['text']));var _0x1c3311=this['awsPolly']['sync'](this,_0x27ba97);if(_0x1c3311){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('aws\x20Polly\x20%s\x20file\x20created',_0x1c3311));var _0x48296e=this[_0x6cb6('0xe')][_0x6cb6('0xf7')](_0x1c3311);try{fs[_0x6cb6('0xf8')](_0x1c3311+_0x6cb6('0xf9'));}catch(_0x28ee8c){logger[_0x6cb6('0x28')](_0x28ee8c);}return _0x48296e;}return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x27ba97,_0x6cb6('0x119'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x11a')]=function(_0x15201f){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x11b'),_0x15201f[_0x6cb6('0x34')]));if(!this['isConfigured'](_0x15201f[_0x6cb6('0x80')])||!this[_0x6cb6('0x7e')](_0x15201f['aws_secret_access_key'])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0x11c'));}if(!this['isConfigured'](_0x15201f[_0x6cb6('0x86')])){return this['channel'][_0x6cb6('0xa3')](_0x6cb6('0x11d'));}if(!this[_0x6cb6('0x7e')](_0x15201f['text'])){return this['channel']['noop'](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')][_0x6cb6('0xdd')]=!![];this[_0x6cb6('0x33')](_0x15201f);this['createSquareMessage'](_0x15201f['text'],'in','','');this['channel'][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x11e'),_0x15201f['text']));var _0x5c16b2=this['awsLex'][_0x6cb6('0x66')](this,_0x15201f);if(_0x5c16b2){for(var _0x1daaec in _0x5c16b2){if(_0x5c16b2[_0x6cb6('0x8f')](_0x1daaec)&&_['isString'](_0x5c16b2[_0x1daaec])){this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0x11f'),_0x1daaec[_0x6cb6('0x61')]()),_0x5c16b2[_0x1daaec]);}}if(_['isNil'](_0x5c16b2['message'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x120'));}else{this[_0x6cb6('0x3d')](_0x5c16b2['message'],'out',_0x6cb6('0x121'),'');return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x122'),_0x5c16b2[_0x6cb6('0x6f')]));}}return this[_0x6cb6('0xe')]['error'](_0x15201f,_0x6cb6('0x123'));};AGIVertices['prototype']['googleasr']=function(_0x234755){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x234755[_0x6cb6('0x34')],_0x234755[_0x6cb6('0x5c')]));if(!this[_0x6cb6('0x7e')](_0x234755['key'])){return this[_0x6cb6('0xe')]['noop']('no\x20key\x20configured');}var _0x20fb85=_0x6cb6('0x124');var _0x51334f=util[_0x6cb6('0x25')](_0x6cb6('0x125'),FILES_PATH,rs['generate'](0x4));var _0x2974e0=util['format'](_0x6cb6('0x98'),_0x51334f,_0x20fb85);var _0x4b671c=!![];if(_0x234755['beep']===_0x6cb6('0x126')){_0x4b671c=![];}var _0x1bb5b9=this[_0x6cb6('0xe')]['recordFile'](_0x51334f,_0x20fb85,_0x234755[_0x6cb6('0x127')],_0x234755[_0x6cb6('0x5c')],undefined,_0x4b671c);if(_0x1bb5b9[_0x6cb6('0x9d')]!==-0x1){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x128'),_0x2974e0));var _0x12fb7c=this['googleASR'][_0x6cb6('0x66')](this,_0x234755,_0x2974e0);if(_0x12fb7c){for(var _0x3cbfd6 in _0x12fb7c){if(_0x12fb7c['hasOwnProperty'](_0x3cbfd6)){this[_0x6cb6('0xe')]['setVariable'](util[_0x6cb6('0x25')]('GOOGLE_ASR_%s',_0x3cbfd6[_0x6cb6('0x61')]()),_0x12fb7c[_0x3cbfd6]);}}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x129'),JSON[_0x6cb6('0x6b')](_0x12fb7c)));}}return _0x1bb5b9;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x12a')]=function(_0x3b062c){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x12b'),_0x3b062c['label']));if(!this[_0x6cb6('0x7e')](_0x3b062c['appid'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x12c'));}if(!this[_0x6cb6('0x7e')](_0x3b062c[_0x6cb6('0x8b')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x12d'));}var _0x310e38=_0x6cb6('0x124');var _0x4e09c4=util[_0x6cb6('0x25')](_0x6cb6('0x125'),FILES_PATH,rs[_0x6cb6('0x10f')](0x4));var _0x21277e=util[_0x6cb6('0x25')](_0x6cb6('0x98'),_0x4e09c4,_0x310e38);var _0x521ba4=!![];if(_0x3b062c[_0x6cb6('0x12e')]==='NOBEEP'){_0x521ba4=![];}var _0x349596=this[_0x6cb6('0xe')][_0x6cb6('0x12f')](_0x4e09c4,_0x310e38,_0x3b062c[_0x6cb6('0x127')],_0x3b062c['timeout'],undefined,_0x521ba4);if(_0x349596[_0x6cb6('0x9d')]!==-0x1){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x130'),_0x21277e));var _0x17a168=this[_0x6cb6('0x89')]['sync'](this,_0x3b062c,_0x21277e);if(_0x17a168){for(var _0x56db63 in _0x17a168){if(_0x17a168[_0x6cb6('0x8f')](_0x56db63)){this['channel'][_0x6cb6('0x99')](util['format'](_0x6cb6('0x131'),_0x56db63[_0x6cb6('0x61')]()),_0x17a168[_0x56db63]);}}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0x132'),JSON[_0x6cb6('0x6b')](_0x17a168)));}}return _0x349596;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x133')]=function(_0x1f6bb3){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x1f6bb3[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')]['continueAt'](_0x1f6bb3[_0x6cb6('0x39')],_0x1f6bb3[_0x6cb6('0x134')],_0x1f6bb3['priority']);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x135')]=function(_0x31d329){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x136'),_0x31d329[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x31d329[_0x6cb6('0x137')])){return this['channel'][_0x6cb6('0x28')](_0x31d329,'no\x20condition\x20configured');}try{var _0x381838=eval(_0x31d329[_0x6cb6('0x137')])?_0x6cb6('0x138'):_0x6cb6('0x139');this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0x13a'),_0x31d329[_0x6cb6('0x137')],_0x381838));return{'code':0xc8,'result':_0x381838};}catch(_0x51d82d){return{'code':0xc8,'result':_0x6cb6('0x139')};}};AGIVertices[_0x6cb6('0x11')]['gotoiftime']=function(_0x5bfbb5){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5bfbb5[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x5bfbb5[_0x6cb6('0x13b')])){return this['channel'][_0x6cb6('0x28')](_0x5bfbb5,_0x6cb6('0x13c'));}var _0x1170a2=this['getIntervals'][_0x6cb6('0x66')](this,_0x5bfbb5[_0x6cb6('0x13b')]);if(!_0x1170a2){return this['channel'][_0x6cb6('0x28')](_0x5bfbb5,_0x6cb6('0x13d'));}for(var _0x52da7a=0x0;_0x52da7a<_0x1170a2[_0x6cb6('0x95')];_0x52da7a+=0x1){var _0x9c5b5d=this[_0x6cb6('0xe')][_0x6cb6('0x12')](util[_0x6cb6('0x25')](_0x6cb6('0x13e'),_0x1170a2[_0x52da7a]));if(_0x9c5b5d['result']===-0x1){return _0x9c5b5d;}logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x13f'),_0x1170a2[_0x52da7a],_0x9c5b5d[_0x6cb6('0x9c')]));if(_0x9c5b5d['extra']==='true'){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x13f'),_0x1170a2[_0x52da7a],_0x6cb6('0x138')));this['channel']['noop'](util[_0x6cb6('0x25')]('IFTIME\x20%s\x20%s',_0x1170a2[_0x52da7a],_0x6cb6('0x138')));return{'code':0xc8,'result':_0x6cb6('0x138')};}else{logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x13f'),_0x1170a2[_0x52da7a],'false'));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x13f'),_0x1170a2[_0x52da7a],_0x6cb6('0x139')));}}return{'code':0xc8,'result':_0x6cb6('0x139')};};AGIVertices[_0x6cb6('0x11')]['hangup']=function(_0x5906a1){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x5906a1['label']));return this['channel'][_0x6cb6('0x140')]();};AGIVertices[_0x6cb6('0x11')]['ispeechasr']=function(_0x60f307){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x141'),_0x60f307[_0x6cb6('0x34')]));if(!this['isConfigured'](_0x60f307[_0x6cb6('0x73')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20key\x20configured');}var _0x4bb493='wav';var _0x12e7f4=util[_0x6cb6('0x25')](_0x6cb6('0x125'),FILES_PATH,rs[_0x6cb6('0x10f')](0x4));var _0x151ebd=util[_0x6cb6('0x25')](_0x6cb6('0x98'),_0x12e7f4,_0x4bb493);var _0x2d187d=!![];if(_0x60f307[_0x6cb6('0x12e')]===_0x6cb6('0x126')){_0x2d187d=![];}var _0x4c1a74=this[_0x6cb6('0xe')][_0x6cb6('0x12f')](_0x12e7f4,_0x4bb493,_0x60f307[_0x6cb6('0x127')],_0x60f307[_0x6cb6('0x5c')],undefined,_0x2d187d);if(_0x4c1a74['result']!==-0x1){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x142'),_0x151ebd));var _0x3a241f=this[_0x6cb6('0x7d')]['sync'](this,_0x60f307,_0x151ebd);if(_0x3a241f){for(var _0x51214f in _0x3a241f){if(_0x3a241f['hasOwnProperty'](_0x51214f)){this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0x143'),_0x51214f[_0x6cb6('0x61')]()),_0x3a241f[_0x51214f]);}}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x3a241f)));}}return _0x4c1a74;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x144')]=function(_0x15ae44){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0x145'),_0x15ae44[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x15ae44[_0x6cb6('0x73')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xdb'));}if(!this[_0x6cb6('0x7e')](_0x15ae44['text'])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x146'),_0x15ae44[_0x6cb6('0x56')]));var _0x5258a1=this[_0x6cb6('0x7a')][_0x6cb6('0x66')](this,_0x15ae44);if(_0x5258a1){this['channel']['noop'](util['format'](_0x6cb6('0x142'),_0x5258a1));var _0x364ba6=this[_0x6cb6('0xe')][_0x6cb6('0xf7')](_0x5258a1,_0x15ae44[_0x6cb6('0x127')]);try{fs[_0x6cb6('0xf8')](_0x5258a1+_0x6cb6('0xf9'));}catch(_0x211142){logger[_0x6cb6('0x28')](_0x211142);}return _0x364ba6;}return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x15ae44,_0x6cb6('0x147'));};AGIVertices['prototype']['login']=function(_0x54eecb){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x148'),_0x54eecb[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x54eecb[_0x6cb6('0x149')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x54eecb,_0x6cb6('0x14a'));}logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0x14b'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x54eecb[_0x6cb6('0x149')]));var _0x5f0fed=this[_0x6cb6('0x4f')]['sync'](this,_0x54eecb[_0x6cb6('0x149')]);if(_0x5f0fed){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14c'),this[_0x6cb6('0xe')]['callerid'],_0x54eecb[_0x6cb6('0x149')]));this['channel'][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x54eecb[_0x6cb6('0x149')]));return{'code':0xc8,'result':_0x6cb6('0x14d')};}else{logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14e'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x54eecb['findBy']));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6cb6('0xe')]['callerid'],_0x54eecb[_0x6cb6('0x149')]));return{'code':0xc8,'result':_0x6cb6('0x14f')};}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x150')]=function(_0x328965){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x328965[_0x6cb6('0x34')]));if(!this['isConfigured'](_0x328965['findBy'])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x328965,_0x6cb6('0x14a'));}logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14b'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x328965[_0x6cb6('0x149')]));var _0x382cba=this[_0x6cb6('0x4e')][_0x6cb6('0x66')](this,_0x328965[_0x6cb6('0x149')]);if(_0x382cba){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x14c'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x328965[_0x6cb6('0x149')]));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x328965['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14e'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x328965[_0x6cb6('0x149')]));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x14e'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x328965[_0x6cb6('0x149')]));return{'code':0xc8,'result':_0x6cb6('0x14f')};}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x151')]=function(_0x581c12){logger['info'](util['format'](_0x6cb6('0x152'),_0x581c12['label']));if(!this['isConfigured'](_0x581c12['operation'])){return this['channel'][_0x6cb6('0x28')](_0x581c12,_0x6cb6('0x153'));}this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x154'),_0x581c12[_0x6cb6('0x155')]));var _0x536903=eval(_0x581c12[_0x6cb6('0x155')]);if(!this[_0x6cb6('0x7e')](_0x581c12['variable_id'])){return this['channel']['noop'](_0x6cb6('0x156'));}var _0x30405a=this[_0x6cb6('0x12')]['sync'](this,_0x581c12[_0x6cb6('0xcd')]);if(!_0x30405a){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x581c12,_0x6cb6('0x10d'));}if(_['isArray'](_0x536903)){var _0x54e001=this;_0x536903[_0x6cb6('0xce')](function(_0x374dff,_0x2156e2){_0x54e001[_0x6cb6('0xe')]['setVariable'](util[_0x6cb6('0x25')](_0x6cb6('0x157'),_0x30405a,_0x2156e2),_0x374dff);});return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')]('variable\x20%s[key]\x20set',_0x30405a));}else{return this[_0x6cb6('0xe')][_0x6cb6('0x99')](_0x30405a,_0x536903);}};AGIVertices[_0x6cb6('0x11')]['menu']=function(_0x8b6b2f){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0x158'),_0x8b6b2f[_0x6cb6('0x34')]));if(_0x8b6b2f['retry']===0x0){return this[_0x6cb6('0x9f')](_0x8b6b2f);}_0x8b6b2f['retry']-=0x1;if(!this[_0x6cb6('0x7e')](_0x8b6b2f[_0x6cb6('0x103')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x8b6b2f,_0x6cb6('0x104'));}var _0x4cf526=this[_0x6cb6('0x105')][_0x6cb6('0x66')](this,_0x8b6b2f[_0x6cb6('0x103')]);if(!_0x4cf526){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x8b6b2f,'no\x20file\x20audio\x20found');}var _0x5a6d8b=this[_0x6cb6('0xe')][_0x6cb6('0x107')](_0x4cf526,_0x8b6b2f[_0x6cb6('0x108')],_0x8b6b2f[_0x6cb6('0x159')]);var _0xf1b2ed=_0x5a6d8b[_0x6cb6('0x9d')];if(_0x5a6d8b[_0x6cb6('0x9d')]===-0x1){this[_0x6cb6('0x33')][_0x6cb6('0x66')](this,_0x8b6b2f,'-1');return _0x5a6d8b;}else if(_0x5a6d8b[_0x6cb6('0x9c')]==='timeout'){_0x5a6d8b[_0x6cb6('0x9d')]=_0x5a6d8b['result'][_0x6cb6('0x95')]>0x0?_0x5a6d8b[_0x6cb6('0x9d')]:'t';}else if(_['isEmpty'](_0x5a6d8b[_0x6cb6('0x9d')])){_0x5a6d8b[_0x6cb6('0x9d')]='#';_0xf1b2ed='#';}if(!this[_0x6cb6('0x7e')](_0x8b6b2f['variable_id'])){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x156'));}else{var _0x2c7dfd=this[_0x6cb6('0x12')][_0x6cb6('0x66')](this,_0x8b6b2f[_0x6cb6('0xcd')]);if(!_0x2c7dfd){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x8b6b2f,_0x6cb6('0x10d'));}this[_0x6cb6('0xe')]['setVariable'](_0x2c7dfd,_0xf1b2ed);}this['createSquareDetailsReport']['sync'](this,_0x8b6b2f,_0xf1b2ed);return _0x5a6d8b;};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0xa3')]=function(_0x589e5b){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x15a'),_0x589e5b[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')]['noop'](_0x589e5b[_0x6cb6('0x15b')]||_0x589e5b['label']);};AGIVertices['prototype'][_0x6cb6('0x15c')]=function(_0x49f22a){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x15d'),_0x49f22a['label']));if(!this[_0x6cb6('0x7e')](_0x49f22a['findBy'])){return this['channel'][_0x6cb6('0x28')](_0x49f22a,'no\x20find\x20by\x20configured');}logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14b'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x49f22a['findBy']));var _0xa6702b=this['getPause'][_0x6cb6('0x66')](this,_0x49f22a[_0x6cb6('0x15e')]);var _0x61d00a=this[_0x6cb6('0x4b')][_0x6cb6('0x66')](this,_0x49f22a['findBy'],_0xa6702b);if(_0x61d00a){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x14c'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x49f22a['findBy']));this['channel'][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x49f22a[_0x6cb6('0x149')]));return{'code':0xc8,'result':'success'};}else{logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x14e'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x49f22a[_0x6cb6('0x149')]));this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0x14c'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0x49f22a['findBy']));return{'code':0xc8,'result':_0x6cb6('0x14f')};}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x15f')]=function(_0x27aa82){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x160'),_0x27aa82['label']));if(!this[_0x6cb6('0x7e')](_0x27aa82[_0x6cb6('0x103')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x27aa82,_0x6cb6('0x104'));}var _0x46071c=this['getSound']['sync'](this,_0x27aa82[_0x6cb6('0x103')]);if(!_0x46071c){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x27aa82,_0x6cb6('0x106'));}var _0x690476=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0x161'),[_0x46071c,_0x27aa82[_0x6cb6('0xd7')]]);if(_0x690476[_0x6cb6('0x9d')]===-0x1){return _0x690476;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0xb8'),_0x6cb6('0x161'),_0x46071c));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x162')]=function(_0x12ce7c){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x12ce7c[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x12ce7c['queue_id'])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x12ce7c,_0x6cb6('0x163'));}var _0x527014='';var _0x494969=parseInt(_0x12ce7c[_0x6cb6('0x164')],0xa);if(isNaN(_0x494969)){_0x527014=_0x12ce7c[_0x6cb6('0x164')];}else{_0x527014=this[_0x6cb6('0x15')][_0x6cb6('0x66')](this,_0x12ce7c[_0x6cb6('0x164')]);if(!_0x527014){return this['channel'][_0x6cb6('0x28')](_0x12ce7c,_0x6cb6('0x165'));}}var _0x129c57='';if(this[_0x6cb6('0x7e')](_0x12ce7c['file_id'])){var _0x5a8f78=this['getSound'][_0x6cb6('0x66')](this,_0x12ce7c[_0x6cb6('0x103')]);if(_0x5a8f78){_0x129c57=_0x5a8f78;}}this[_0x6cb6('0x33')][_0x6cb6('0x66')](this,_0x12ce7c,_0x527014);if(_0x12ce7c[_0x6cb6('0xd7')]['indexOf']('x')<0x0){_0x12ce7c[_0x6cb6('0xd7')]+='x';}if(_0x12ce7c['opts'][_0x6cb6('0x166')]('X')<0x0){_0x12ce7c[_0x6cb6('0xd7')]+='X';}this['channel'][_0x6cb6('0x99')]('XMCS-QUEUE',_0x527014?_0x527014[_0x6cb6('0x167')]():'');var _0x5d46fc=this[_0x6cb6('0xe')][_0x6cb6('0x51')](_0x6cb6('0x168'),[_0x527014,_0x12ce7c[_0x6cb6('0xd7')],_0x12ce7c[_0x6cb6('0x69')],_0x129c57,_0x12ce7c[_0x6cb6('0x5c')],_0x12ce7c[_0x6cb6('0x7')],_0x12ce7c[_0x6cb6('0x169')],_0x12ce7c[_0x6cb6('0x16a')],'',_0x12ce7c[_0x6cb6('0x16b')]]);if(_0x5d46fc[_0x6cb6('0x9d')]===-0x1){return _0x5d46fc;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xb8'),_0x6cb6('0x168'),_0x527014));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x16c')]=function(_0x4a5943){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x16d'),_0x4a5943[_0x6cb6('0x34')]));var _0xc3d4b4=_0x4a5943[_0x6cb6('0x16e')]||_0x6cb6('0x124');var _0x194428=util[_0x6cb6('0x25')](_0x6cb6('0x16f'),this[_0x6cb6('0xe')][_0x6cb6('0x38')],rs[_0x6cb6('0x10f')](0x5));var _0x5bdf1f=util['format'](_0x6cb6('0x170'),FILES_PATH,_0x194428,_0xc3d4b4);var _0x41786f=util[_0x6cb6('0x25')](_0x6cb6('0x125'),FILES_PATH,_0x194428);this[_0x6cb6('0x37')]['sync'](this,_0x4a5943,_0x194428,_0x5bdf1f);this[_0x6cb6('0xe')][_0x6cb6('0x99')](_0x6cb6('0x171'),_0x194428);logger[_0x6cb6('0x2a')](_0x6cb6('0x172'),_0x41786f,_0xc3d4b4,_0x4a5943[_0x6cb6('0x173')],_0x4a5943['timeout']);return this[_0x6cb6('0xe')][_0x6cb6('0x12f')](_0x41786f,_0xc3d4b4,_0x4a5943[_0x6cb6('0x173')],_0x4a5943[_0x6cb6('0x5c')],undefined,!![]);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x174')]=function(_0x15e1d7){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x175'),_0x15e1d7['label']));if(!this[_0x6cb6('0x7e')](_0x15e1d7[_0x6cb6('0x69')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20url\x20configured');}var _0x23634b=this['restAPI']['sync'](this,_0x15e1d7);logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x176'),util[_0x6cb6('0x177')](_0x23634b,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x15e1d7['variable_id'])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0x178'));}var _0x4a71de=this['getVariable']['sync'](this,_0x15e1d7[_0x6cb6('0xcd')]);if(!_0x4a71de){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x15e1d7,'no\x20variable\x20found');}this[_0x6cb6('0xe')][_0x6cb6('0x99')](util[_0x6cb6('0x25')](_0x6cb6('0x179'),_0x4a71de),_0x23634b[_0x6cb6('0x6d')]?_0x23634b[_0x6cb6('0x6d')]:_0x6cb6('0x17a'));this[_0x6cb6('0xe')][_0x6cb6('0x99')](util['format']('%s_STATUS_MESSAGE',_0x4a71de),_0x23634b['statusMessage']?_0x23634b[_0x6cb6('0x6e')]:'OK');if(_0x23634b[_0x6cb6('0x62')]){try{this['saveRestApiResult'](_0x23634b[_0x6cb6('0x62')],_0x4a71de);}catch(_0x31e888){logger['error'](util['format'](_0x6cb6('0x17b'),_0x4a71de));}}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x17c'),_0x4a71de));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x17d')]=function(_0x49b21d){logger[_0x6cb6('0x2a')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x49b21d[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')]['sayDigits'](_0x49b21d[_0x6cb6('0x17e')]['replace'](/\s+/g,''),_0x49b21d['escape_digits']);};AGIVertices['prototype'][_0x6cb6('0x17f')]=function(_0x1fcfdf){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1fcfdf[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')][_0x6cb6('0x180')](_0x1fcfdf[_0x6cb6('0x181')][_0x6cb6('0x53')](/\s+/g,''),_0x1fcfdf['escape_digits']);};AGIVertices[_0x6cb6('0x11')]['sayphonetic']=function(_0x1a41b9){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x182'),_0x1a41b9[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')][_0x6cb6('0x183')](_0x1a41b9[_0x6cb6('0x56')],_0x1a41b9['escape_digits']);};AGIVertices['prototype'][_0x6cb6('0x184')]=function(_0x4dcdf7){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x185'),_0x4dcdf7[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x4dcdf7[_0x6cb6('0x186')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20mail\x20account\x20configured');}var _0x5e3063=this[_0x6cb6('0x187')][_0x6cb6('0x66')](this,_0x4dcdf7[_0x6cb6('0x186')]);if(!_0x5e3063||!_0x5e3063[_0x6cb6('0x188')]){return this['channel'][_0x6cb6('0x28')](_0x4dcdf7,'no\x20mail\x20account\x20found');}var _0x311c5e={'from':util['format'](_0x6cb6('0x189'),_0x5e3063['name'],_0x5e3063[_0x6cb6('0x18a')]||_0x5e3063[_0x6cb6('0x188')][_0x6cb6('0x18b')]),'to':_0x4dcdf7['to']||'','cc':_0x4dcdf7['cc']||'','bcc':_0x4dcdf7[_0x6cb6('0x18c')]||'','subject':_0x4dcdf7[_0x6cb6('0x18d')],'html':_0x4dcdf7['text'],'text':_0x4dcdf7['text']};if(this[_0x6cb6('0x7e')](_0x4dcdf7[_0x6cb6('0x18e')])){}logger[_0x6cb6('0x18f')](_0x6cb6('0x190'),JSON['stringify'](_0x311c5e));this['createSquareDetailsReport'][_0x6cb6('0x66')](this,_0x4dcdf7,_0x4dcdf7[_0x6cb6('0x186')]);this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x5e3063['name']));this['sendMailMessage']['sync'](this,_0x5e3063[_0x6cb6('0x191')],_0x311c5e);return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x192'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x193')]=function(_0x5f2422){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x194'),_0x5f2422[_0x6cb6('0x34')]));return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x195'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x196')]=function(_0xbb748d){logger['info'](util[_0x6cb6('0x25')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xbb748d[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0xbb748d[_0x6cb6('0x197')])){return this[_0x6cb6('0xe')]['noop']('no\x20sms\x20account\x20configured');}var _0x470308=this[_0x6cb6('0x30')][_0x6cb6('0x66')](this,_0xbb748d[_0x6cb6('0x197')]);if(!_0x470308){return this['channel'][_0x6cb6('0x28')](_0xbb748d,'no\x20sms\x20account\x20found');}var _0x12c8d9={'body':_0xbb748d[_0x6cb6('0x198')],'phone':_0xbb748d['to']||'','SmsAccountId':_0x470308['id']};logger['debug'](_0x6cb6('0x199'),JSON[_0x6cb6('0x6b')](_0x12c8d9));this[_0x6cb6('0x33')][_0x6cb6('0x66')](this,_0xbb748d,_0xbb748d[_0x6cb6('0x197')]);this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x19a'),_0x470308[_0x6cb6('0x13')]));this[_0x6cb6('0x32')][_0x6cb6('0x66')](this,_0x12c8d9);return this['channel'][_0x6cb6('0xa3')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x6cb6('0x11')]['set']=function(_0x4428c3){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x19b'),_0x4428c3[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x4428c3[_0x6cb6('0xcd')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x4428c3,_0x6cb6('0x19c'));}var _0x5ce075=this[_0x6cb6('0x12')][_0x6cb6('0x66')](this,_0x4428c3['variable_id']);if(!_0x5ce075){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x4428c3,_0x6cb6('0x10d'));}return this[_0x6cb6('0xe')][_0x6cb6('0x99')](_0x5ce075,_0x4428c3[_0x6cb6('0x19d')]);};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x19e')]=function(_0x91c12a){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x19f'),_0x91c12a[_0x6cb6('0x34')]));this[_0x6cb6('0xe')]['noop'](_0x6cb6('0x1a0'));var _0x3a9a8e=this[_0x6cb6('0xe')][_0x6cb6('0x12')]('XMCS-UNIQUEID');if(!_[_0x6cb6('0x3e')](_0x3a9a8e[_0x6cb6('0x9c')])){this[_0x6cb6('0xe')]['uniqueid']=_0x3a9a8e[_0x6cb6('0x9c')];}if(_0x91c12a[_0x6cb6('0xae')]===_0x6cb6('0x1a1')){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x1a2'));return this[_0x6cb6('0xe')][_0x6cb6('0xae')]();}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](_0x6cb6('0x1a3'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1a4')]=function(_0xd0ba58){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x1a5'),_0xd0ba58[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0xd0ba58[_0x6cb6('0x1a6')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0xd0ba58,_0x6cb6('0x1a7'));}var _0x391c50=this[_0x6cb6('0x1a8')][_0x6cb6('0x66')](this,_0xd0ba58['project_id']);if(!this['isConfigured'](_0x391c50)){return this['channel'][_0x6cb6('0x28')](_0xd0ba58,util[_0x6cb6('0x25')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0xd0ba58['project_id']));}if(_0x391c50===this[_0x6cb6('0xe')][_0x6cb6('0x35')]){return this[_0x6cb6('0xe')]['error'](_0xd0ba58,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x6cb6('0x33')][_0x6cb6('0x66')](this,_0xd0ba58,_0x391c50);var _0x156fcc=this[_0x6cb6('0xe')][_0x6cb6('0x51')]('AGI',util[_0x6cb6('0x25')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x6cb6('0x7')][_0x6cb6('0x1a9')]||_0x6cb6('0x1aa'),_0x391c50,this[_0x6cb6('0xe')]['arg_1']));if(_0x156fcc['result']===-0x1){return _0x156fcc;}return this[_0x6cb6('0xe')]['noop'](util[_0x6cb6('0x25')](_0x6cb6('0xb8'),_0x6cb6('0x1ab'),_0x391c50));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1ac')]=function(_0x3ba9d6){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')](_0x6cb6('0x1ad'),_0x3ba9d6[_0x6cb6('0x34')]));var _0x4625ba=this[_0x6cb6('0x1ae')][_0x6cb6('0x66')](this,_0x3ba9d6[_0x6cb6('0xac')]);this['createSquareDetailsReport']['sync'](this,_0x3ba9d6,_0x3ba9d6[_0x6cb6('0xac')]);if(this[_0x6cb6('0x7e')](_0x3ba9d6[_0x6cb6('0xcd')])){var _0x296314=this[_0x6cb6('0x12')][_0x6cb6('0x66')](this,_0x3ba9d6[_0x6cb6('0xcd')]);if(_0x296314){this[_0x6cb6('0xe')][_0x6cb6('0x99')](_0x296314,_0x4625ba);return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3ba9d6[_0x6cb6('0xac')],_0x296314));}}return this['channel']['noop'](util[_0x6cb6('0x25')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x3ba9d6[_0x6cb6('0xac')]));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1af')]=function(_0xa2d575){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x1b0'),_0xa2d575[_0x6cb6('0x34')]));_0xa2d575[_0x6cb6('0x56')]=_0xa2d575[_0x6cb6('0x56')][_0x6cb6('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6cb6('0x7e')](_0xa2d575[_0x6cb6('0x55')])){return this['channel'][_0x6cb6('0xa3')](_0x6cb6('0x1b1'));}if(!this['isConfigured'](_0xa2d575[_0x6cb6('0x56')])){return this[_0x6cb6('0xe')]['noop'](_0x6cb6('0xdc'));}this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x1b2'),_0xa2d575['text']));var _0x6ffd=this[_0x6cb6('0x54')]['sync'](this,_0xa2d575);if(_0x6ffd){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0x1b3'),_0x6ffd));var _0x2ec658=this['channel'][_0x6cb6('0xf7')](_0x6ffd);try{fs[_0x6cb6('0xf8')](_0x6ffd+'.wav');}catch(_0x3195f8){logger[_0x6cb6('0x28')](_0x3195f8);}return _0x2ec658;}return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0xa2d575,_0x6cb6('0x1b4'));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1b5')]=function(_0x3d2d1a){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x1b6'),_0x3d2d1a['label']));_0x3d2d1a[_0x6cb6('0x56')]=_0x3d2d1a[_0x6cb6('0x56')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x6cb6('0x7e')](_0x3d2d1a[_0x6cb6('0x56')])){return this[_0x6cb6('0xe')][_0x6cb6('0xa3')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x6cb6('0x25')](_0x6cb6('0x1b7'),_0x3d2d1a[_0x6cb6('0x56')]));var _0x20515f=this[_0x6cb6('0x5a')]['sync'](this,_0x3d2d1a);if(_0x20515f){this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x20515f));var _0x34dc21=this[_0x6cb6('0xe')][_0x6cb6('0xf7')](_0x20515f);try{fs[_0x6cb6('0xf8')](_0x20515f+_0x6cb6('0xf9'));}catch(_0x803de5){logger[_0x6cb6('0x28')](_0x803de5);}return _0x34dc21;}return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x3d2d1a,_0x6cb6('0x1b8'));};AGIVertices['prototype'][_0x6cb6('0x1b9')]=function(_0xb14047){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0x1ba'),_0xb14047[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0xb14047[_0x6cb6('0x149')])){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0xb14047,_0x6cb6('0x14a'));}logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0xb14047[_0x6cb6('0x149')]));var _0x36fb63=this[_0x6cb6('0x4d')]['sync'](this,_0xb14047[_0x6cb6('0x149')]);if(_0x36fb63){logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0xb14047[_0x6cb6('0x149')]));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util['format'](_0x6cb6('0x14c'),this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0xb14047[_0x6cb6('0x149')]));return{'code':0xc8,'result':_0x6cb6('0x14d')};}else{logger[_0x6cb6('0x2a')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0xb14047[_0x6cb6('0x149')]));this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6cb6('0xe')][_0x6cb6('0x36')],_0xb14047[_0x6cb6('0x149')]));return{'code':0xc8,'result':_0x6cb6('0x14f')};}};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1bb')]=function(_0x5acd5d){logger[_0x6cb6('0x2a')](util['format'](_0x6cb6('0x1bc'),_0x5acd5d['label']));var _0x403bf3=this['channel'][_0x6cb6('0x51')](_0x6cb6('0x1bd'),[_0x5acd5d[_0x6cb6('0x1be')],_0x5acd5d[_0x6cb6('0x71')]]);if(_0x403bf3[_0x6cb6('0x9d')]===-0x1){return _0x403bf3;}return this[_0x6cb6('0xe')][_0x6cb6('0xa3')](util[_0x6cb6('0x25')](_0x6cb6('0xb8'),_0x6cb6('0x1bd'),_0x5acd5d[_0x6cb6('0x1be')]));};AGIVertices[_0x6cb6('0x11')][_0x6cb6('0x1bf')]=function(_0x46ef87){logger['info'](util[_0x6cb6('0x25')](_0x6cb6('0x1c0'),_0x46ef87[_0x6cb6('0x34')]));if(!this[_0x6cb6('0x7e')](_0x46ef87[_0x6cb6('0xcd')])){return this[_0x6cb6('0xe')]['error'](_0x46ef87,_0x6cb6('0x19c'));}var _0x42f355=this['getVariable'][_0x6cb6('0x66')](this,_0x46ef87[_0x6cb6('0xcd')]);if(!_0x42f355){return this[_0x6cb6('0xe')][_0x6cb6('0x28')](_0x46ef87,_0x6cb6('0x10d'));}var _0x3a0c3f=this[_0x6cb6('0xe')][_0x6cb6('0x12')](_0x42f355);return{'code':0xc8,'result':_0x3a0c3f[_0x6cb6('0x9c')]?_0x3a0c3f['extra']:'-'};};String[_0x6cb6('0x11')]['replaceAll']=function(_0x2314ca,_0x598505){return this['split'](_0x2314ca)[_0x6cb6('0x1c1')](_0x598505);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e14d5df..c95d18f 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 _0x6b1b=['voiceQueues','agents','timers','channels','agentconnect','bind','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','queue','mandatoryDisposition','name','resolve','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','error','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport'];(function(_0x2d3622,_0x41ca4a){var _0x14b9ab=function(_0x39712d){while(--_0x39712d){_0x2d3622['push'](_0x2d3622['shift']());}};_0x14b9ab(++_0x41ca4a);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x6b1b[_0x2a6809];return _0x11c371;};'use strict';var _=require('lodash');var moment=require(_0xb6b1('0x0'));var ami=require(_0xb6b1('0x1'));var logger=require(_0xb6b1('0x2'))('acw');var RpcUser=require(_0xb6b1('0x3'));var RpcVoiceAgentReport=require(_0xb6b1('0x4'));function Acw(_0x28daf9){this[_0xb6b1('0x5')]=_0x28daf9[_0xb6b1('0x5')];this[_0xb6b1('0x6')]=_0x28daf9[_0xb6b1('0x6')];this[_0xb6b1('0x7')]=_0x28daf9[_0xb6b1('0x7')];this[_0xb6b1('0x8')]={};ami['on'](_0xb6b1('0x9'),this['syncAgentConnect'][_0xb6b1('0xa')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xb6b1('0xa')](this));ami['on']('hangup',this[_0xb6b1('0xb')]['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xb6b1('0xc'),this[_0xb6b1('0xd')]['bind'](this));ami['on'](_0xb6b1('0xe'),this['syncBlindTransfer']['bind'](this));ami['on'](_0xb6b1('0xf'),this[_0xb6b1('0x10')][_0xb6b1('0xa')](this));}function getDiff(_0x327eee){var _0x23881d=moment()[_0xb6b1('0x11')](0x0);var _0x360fc7=moment(_0x327eee)[_0xb6b1('0x11')](0x0);return _0x23881d[_0xb6b1('0x12')](_0x360fc7,_0xb6b1('0x13'));}Acw[_0xb6b1('0x14')][_0xb6b1('0x15')]=function(_0x4f770a,_0x57572a){var _0x513207=this;var _0x51f25f=getDiff(_0x513207[_0xb6b1('0x7')][_0x4f770a][_0xb6b1('0x16')]);clearTimeout(_0x513207[_0xb6b1('0x7')][_0x4f770a][_0xb6b1('0x17')]);_0x513207[_0xb6b1('0x7')][_0x4f770a][_0xb6b1('0x17')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x51f25f},_0x513207['timers'][_0x4f770a][_0xb6b1('0x18')],_0x4f770a)[_0xb6b1('0x19')](function(_0x16d969){logger[_0xb6b1('0x1a')](_0xb6b1('0x1b'),_0x57572a,_0x51f25f,_0x16d969);})[_0xb6b1('0x1c')](function(_0x5ba14d){logger['error'](_0xb6b1('0x1d'),_0x57572a,_0x5ba14d);})[_0xb6b1('0x1e')](function(){delete _0x513207['timers'][_0x4f770a];});};Acw['prototype'][_0xb6b1('0x1f')]=function(_0x5c8529){try{var _0x509c55=this;var _0x232157=this[_0xb6b1('0x8')][_0x5c8529][_0xb6b1('0x20')];var _0x305865=this[_0xb6b1('0x8')][_0x5c8529][_0xb6b1('0x21')];var _0x1eb1b2=this[_0xb6b1('0x5')][_0x305865];var _0x472585=![];var _0x20066f='ACW';if(_0x1eb1b2[_0xb6b1('0x22')]&&_0x1eb1b2['mandatoryDispositionPause'][_0xb6b1('0x23')]){_0x472585=!![];_0x20066f=_0x1eb1b2['mandatoryDispositionPause'][_0xb6b1('0x23')];}if(!_0x509c55['agents'][_0x232157]){return Promise[_0xb6b1('0x24')]();}return RpcUser[_0xb6b1('0x25')](_0x509c55[_0xb6b1('0x6')][_0x232157]['id'])[_0xb6b1('0x19')](function(_0x13e841){if(!_0x13e841||_0x13e841[_0xb6b1('0x26')]){logger[_0xb6b1('0x1a')](_0xb6b1('0x27'),_0x5c8529,_0x232157,_0x305865);return;}logger[_0xb6b1('0x1a')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x5c8529,_0x232157,_0x305865);var _0xf40426=_0x509c55['channels'][_0x5c8529][_0xb6b1('0x28')]&&_0x509c55[_0xb6b1('0x8')][_0x5c8529][_0xb6b1('0x29')]?_0x509c55[_0xb6b1('0x8')][_0x5c8529][_0xb6b1('0x29')]:_0x5c8529;return RpcUser[_0xb6b1('0x2a')](_0x509c55[_0xb6b1('0x6')][_0x232157],_0x20066f,_0xf40426);})['then'](function(_0x427797){if(_0x472585||!_0x427797){return;}_0x509c55[_0xb6b1('0x7')][_0x232157]={};logger[_0xb6b1('0x1a')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5c8529,_0x509c55[_0xb6b1('0x5')][_0x305865][_0xb6b1('0x2b')],_0x232157,_0x305865);_0x509c55['timers'][_0x232157][_0xb6b1('0x17')]=setTimeout(_0x509c55[_0xb6b1('0x2c')][_0xb6b1('0xa')](_0x509c55,_0x232157),_0x509c55[_0xb6b1('0x5')][_0x305865][_0xb6b1('0x2b')]*0x3e8);_0x509c55[_0xb6b1('0x7')][_0x232157]['lastPauseAt']=moment()[_0xb6b1('0x2d')](_0xb6b1('0x2e'));_0x509c55['timers'][_0x232157][_0xb6b1('0x18')]=_0x5c8529;_0x509c55['timers'][_0x232157][_0xb6b1('0x21')]=_0x305865;_0x509c55[_0xb6b1('0x7')][_0x232157][_0xb6b1('0x15')]=_0x509c55[_0xb6b1('0x15')][_0xb6b1('0xa')](_0x509c55,_0x232157,_0x5c8529);})[_0xb6b1('0x1c')](function(){logger['error'](_0xb6b1('0x2f'),_0x5c8529,_0x509c55[_0xb6b1('0x5')][_0x305865][_0xb6b1('0x2b')],_0x232157,_0x305865);})[_0xb6b1('0x1e')](function(){delete _0x509c55['channels'][_0x5c8529];});}catch(_0x56f1ff){logger['error'](_0xb6b1('0x30'),_0x56f1ff[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')][_0xb6b1('0x2c')]=function(_0x1c83c4){try{var _0x15cace=this;if(_0x15cace[_0xb6b1('0x7')][_0x1c83c4]){_0x15cace[_0xb6b1('0x7')][_0x1c83c4][_0xb6b1('0x17')]=![];var _0x25d6a2=_0x15cace[_0xb6b1('0x7')][_0x1c83c4][_0xb6b1('0x18')];var _0x5b8a57=_0x15cace[_0xb6b1('0x7')][_0x1c83c4][_0xb6b1('0x21')];var _0x2f0427=_0x15cace[_0xb6b1('0x5')][_0x5b8a57][_0xb6b1('0x2b')];logger[_0xb6b1('0x1a')](_0xb6b1('0x32'),_0x25d6a2,_0x1c83c4);RpcUser[_0xb6b1('0x33')](this[_0xb6b1('0x6')][_0x1c83c4]);RpcVoiceAgentReport[_0xb6b1('0x34')]({'acwtime':_0x2f0427,'agentacw':!![]},_0x25d6a2,_0x1c83c4)[_0xb6b1('0x19')](function(_0x56470a){logger[_0xb6b1('0x1a')](_0xb6b1('0x1b'),_0x25d6a2,_0x2f0427,_0x56470a);})[_0xb6b1('0x1c')](function(_0x2d6b2b){logger[_0xb6b1('0x35')](_0xb6b1('0x1d'),_0x25d6a2,_0x2d6b2b);});}else{logger[_0xb6b1('0x35')](_0xb6b1('0x36'),_0x1c83c4);if(_0x15cace['timers']){logger['info'](_0xb6b1('0x37'),JSON[_0xb6b1('0x38')](_0x15cace[_0xb6b1('0x7')]));}}}catch(_0x541eb5){logger[_0xb6b1('0x35')](_0xb6b1('0x39'),_0x541eb5[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')][_0xb6b1('0x3a')]=function(_0x3c2780){try{if(this[_0xb6b1('0x5')][_0x3c2780[_0xb6b1('0x21')]]&&(this['voiceQueues'][_0x3c2780[_0xb6b1('0x21')]]['acw']||this[_0xb6b1('0x5')][_0x3c2780[_0xb6b1('0x21')]][_0xb6b1('0x22')])){if(this[_0xb6b1('0x6')][_0x3c2780[_0xb6b1('0x20')]]){this[_0xb6b1('0x8')][_0x3c2780['uniqueid']]={'queue':_0x3c2780[_0xb6b1('0x21')],'interface':_0x3c2780[_0xb6b1('0x20')],'destlinkedid':_0x3c2780['destlinkedid']};}}}catch(_0x27bf19){logger['error'](_0xb6b1('0x3b'),_0x27bf19[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')][_0xb6b1('0x10')]=function(_0x2016a1){try{if(this[_0xb6b1('0x5')][_0x2016a1[_0xb6b1('0x21')]]&&(this[_0xb6b1('0x5')][_0x2016a1[_0xb6b1('0x21')]]['acw']||this['voiceQueues'][_0x2016a1[_0xb6b1('0x21')]][_0xb6b1('0x22')])){if(this['agents'][_0x2016a1[_0xb6b1('0x20')]]){this[_0xb6b1('0x8')][_0x2016a1[_0xb6b1('0x18')]]={'queue':_0x2016a1[_0xb6b1('0x21')],'interface':_0x2016a1[_0xb6b1('0x20')]};}}}catch(_0x505a80){logger[_0xb6b1('0x35')](_0xb6b1('0x3c'),_0x505a80[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')]['syncHangupRequest']=function(_0x5bfd0e){try{if(this[_0xb6b1('0x8')][_0x5bfd0e['uniqueid']]&&_[_0xb6b1('0x3d')](this[_0xb6b1('0x8')][_0x5bfd0e['uniqueid']][_0xb6b1('0x28')])){logger['info'](_0xb6b1('0x3e'),_0x5bfd0e[_0xb6b1('0x18')]);this[_0xb6b1('0x1f')](_0x5bfd0e[_0xb6b1('0x18')]);}else if(this[_0xb6b1('0x8')][_0x5bfd0e[_0xb6b1('0x3f')]]&&_[_0xb6b1('0x3d')](this[_0xb6b1('0x8')][_0x5bfd0e[_0xb6b1('0x3f')]][_0xb6b1('0x28')])){logger['info'](_0xb6b1('0x40'),_0x5bfd0e[_0xb6b1('0x3f')]);this[_0xb6b1('0x1f')](_0x5bfd0e[_0xb6b1('0x3f')]);}}catch(_0x46c4ef){logger[_0xb6b1('0x35')](_0xb6b1('0x41'),_0x46c4ef[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')]['syncHangup']=function(_0x16e0be){try{if(this['channels'][_0x16e0be['uniqueid']]&&this[_0xb6b1('0x8')][_0x16e0be[_0xb6b1('0x18')]]['attended']){logger[_0xb6b1('0x1a')](_0xb6b1('0x42'),_0x16e0be[_0xb6b1('0x18')]);this['startAcw'](_0x16e0be[_0xb6b1('0x18')]);}else if(this['channels'][_0x16e0be['linkedid']]&&this[_0xb6b1('0x8')][_0x16e0be[_0xb6b1('0x3f')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x16e0be[_0xb6b1('0x3f')]);this['startAcw'](_0x16e0be['linkedid']);}}catch(_0x47e64e){logger[_0xb6b1('0x35')](_0xb6b1('0x43'),_0x47e64e[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')][_0xb6b1('0xd')]=function(_0x3e441e){try{if(!_['isNil'](this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x44')]])){this['startAcw'](_0x3e441e['transfereeuniqueid']);if(this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x45')]]){this['channels'][_0x3e441e['secondtransfereruniqueid']][_0xb6b1('0x28')]=!![];this['channels'][_0x3e441e[_0xb6b1('0x46')]]=this[_0xb6b1('0x8')][_0x3e441e['secondtransfereruniqueid']];delete this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x45')]];}}else if(!_[_0xb6b1('0x47')](this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x46')]])){this[_0xb6b1('0x1f')](_0x3e441e[_0xb6b1('0x46')]);if(this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x48')]]){this[_0xb6b1('0x8')][_0x3e441e['origtransfereruniqueid']][_0xb6b1('0x28')]=!![];this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x44')]]=this[_0xb6b1('0x8')][_0x3e441e['origtransfereruniqueid']];delete this[_0xb6b1('0x8')][_0x3e441e[_0xb6b1('0x48')]];}}}catch(_0x2da39e){logger[_0xb6b1('0x35')](_0xb6b1('0x49'),_0x2da39e[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')]['syncBlindTransfer']=function(_0x485800){try{if(this[_0xb6b1('0x8')][_0x485800['transfereruniqueid']]){logger[_0xb6b1('0x1a')](_0xb6b1('0x4a'),JSON[_0xb6b1('0x38')](_0x485800['transfereruniqueid']));this[_0xb6b1('0x1f')](_0x485800[_0xb6b1('0x4b')]);}else if(this[_0xb6b1('0x8')][_0x485800[_0xb6b1('0x4c')]]){logger[_0xb6b1('0x1a')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x485800[_0xb6b1('0x4c')]));this[_0xb6b1('0x1f')](_0x485800[_0xb6b1('0x4c')]);}}catch(_0x28b4c9){logger[_0xb6b1('0x35')](_0xb6b1('0x4d'),_0x28b4c9[_0xb6b1('0x31')]);}};Acw[_0xb6b1('0x14')][_0xb6b1('0x4e')]=function(_0x3634a8){try{if(this[_0xb6b1('0x5')][_0x3634a8[_0xb6b1('0x21')]]&&this['voiceQueues'][_0x3634a8[_0xb6b1('0x21')]]['autopause']===_0xb6b1('0x4f')){if(this[_0xb6b1('0x6')][_0x3634a8[_0xb6b1('0x20')]]){logger['info'](_0xb6b1('0x50'),_0x3634a8['uniqueid'],_0x3634a8['interface'],_0x3634a8[_0xb6b1('0x21')]);return RpcUser['savePause'](this[_0xb6b1('0x6')][_0x3634a8[_0xb6b1('0x20')]],'Auto-Pause',_0x3634a8[_0xb6b1('0x18')]);}}}catch(_0x58fddf){logger[_0xb6b1('0x35')](_0xb6b1('0x51'),_0x58fddf[_0xb6b1('0x31')]);}};module['exports']=Acw; \ No newline at end of file +var _0x964b=['stopAcw','uniqueid','updateAcw','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','all','Auto-Pause','exports','lodash','moment','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','syncHangupRequest','syncHangup','bind','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','lastPauseAt','timer','update','info','[%s][UPDATE][ACWTIME:%s]','catch','error','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','resolve','getAgent','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','acwTimeout'];(function(_0x24ee21,_0x3c9459){var _0x48b697=function(_0xa468f){while(--_0xa468f){_0x24ee21['push'](_0x24ee21['shift']());}};_0x48b697(++_0x3c9459);}(_0x964b,0x112));var _0xb964=function(_0x1e9de2,_0x190648){_0x1e9de2=_0x1e9de2-0x0;var _0x5eeab0=_0x964b[_0x1e9de2];return _0x5eeab0;};'use strict';var _=require(_0xb964('0x0'));var moment=require(_0xb964('0x1'));var ami=require('../ami');var logger=require(_0xb964('0x2'))(_0xb964('0x3'));var RpcUser=require(_0xb964('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5c4f01){this[_0xb964('0x5')]=_0x5c4f01['voiceQueues'];this[_0xb964('0x6')]=_0x5c4f01[_0xb964('0x6')];this[_0xb964('0x7')]=_0x5c4f01[_0xb964('0x7')];this[_0xb964('0x8')]={};ami['on'](_0xb964('0x9'),this[_0xb964('0xa')]['bind'](this));ami['on']('hanguprequest',this[_0xb964('0xb')]['bind'](this));ami['on']('hangup',this[_0xb964('0xc')][_0xb964('0xd')](this));ami['on'](_0xb964('0xe'),this[_0xb964('0xf')][_0xb964('0xd')](this));ami['on'](_0xb964('0x10'),this['syncAttendedTransfer'][_0xb964('0xd')](this));ami['on'](_0xb964('0x11'),this[_0xb964('0x12')][_0xb964('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xb964('0x13')]['bind'](this));}function getDiff(_0x556533){var _0x3ce73e=moment()[_0xb964('0x14')](0x0);var _0xe111d2=moment(_0x556533)[_0xb964('0x14')](0x0);return _0x3ce73e[_0xb964('0x15')](_0xe111d2,_0xb964('0x16'));}Acw[_0xb964('0x17')]['updateAcw']=function(_0x3f507a,_0x5a2ce4){var _0x538d2e=this;var _0xd775d5=getDiff(_0x538d2e[_0xb964('0x7')][_0x3f507a][_0xb964('0x18')]);clearTimeout(_0x538d2e[_0xb964('0x7')][_0x3f507a][_0xb964('0x19')]);_0x538d2e[_0xb964('0x7')][_0x3f507a][_0xb964('0x19')]=![];return RpcVoiceAgentReport[_0xb964('0x1a')]({'acwtime':_0xd775d5},_0x538d2e[_0xb964('0x7')][_0x3f507a]['uniqueid'],_0x3f507a)['then'](function(_0x49a066){logger[_0xb964('0x1b')](_0xb964('0x1c'),_0x5a2ce4,_0xd775d5,_0x49a066);})[_0xb964('0x1d')](function(_0x527f62){logger[_0xb964('0x1e')]('[%s][UPDATE][ERRORS:%s]',_0x5a2ce4,_0x527f62);})['finally'](function(){delete _0x538d2e['timers'][_0x3f507a];});};Acw[_0xb964('0x17')][_0xb964('0x1f')]=function(_0x30d78f){try{var _0x4e5160=this;var _0x3cc265=this[_0xb964('0x8')][_0x30d78f][_0xb964('0x20')];var _0x5d85d9=this['channels'][_0x30d78f][_0xb964('0x21')];var _0x5469c2=this[_0xb964('0x5')][_0x5d85d9];var _0x2bace5=![];var _0x2b9b74=_0xb964('0x22');if(_0x5469c2['mandatoryDisposition']&&_0x5469c2[_0xb964('0x23')][_0xb964('0x24')]){_0x2bace5=!![];_0x2b9b74=_0x5469c2[_0xb964('0x23')][_0xb964('0x24')];}if(!_0x4e5160[_0xb964('0x6')][_0x3cc265]){return Promise[_0xb964('0x25')]();}return RpcUser[_0xb964('0x26')](_0x4e5160[_0xb964('0x6')][_0x3cc265]['id'])[_0xb964('0x27')](function(_0x4d82e2){if(!_0x4d82e2||_0x4d82e2[_0xb964('0x28')]){logger[_0xb964('0x1b')](_0xb964('0x29'),_0x30d78f,_0x3cc265,_0x5d85d9);return;}logger[_0xb964('0x1b')](_0xb964('0x2a'),_0x30d78f,_0x3cc265,_0x5d85d9);var _0x24cc22=_0x4e5160[_0xb964('0x8')][_0x30d78f]['attended']&&_0x4e5160[_0xb964('0x8')][_0x30d78f][_0xb964('0x2b')]?_0x4e5160[_0xb964('0x8')][_0x30d78f]['destlinkedid']:_0x30d78f;return RpcUser[_0xb964('0x2c')](_0x4e5160[_0xb964('0x6')][_0x3cc265],_0x2b9b74,_0x24cc22);})[_0xb964('0x27')](function(_0x2cc8b6){if(_0x2bace5||!_0x2cc8b6){return;}_0x4e5160[_0xb964('0x7')][_0x3cc265]={};logger[_0xb964('0x1b')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x30d78f,_0x4e5160['voiceQueues'][_0x5d85d9][_0xb964('0x2d')],_0x3cc265,_0x5d85d9);_0x4e5160[_0xb964('0x7')][_0x3cc265][_0xb964('0x19')]=setTimeout(_0x4e5160[_0xb964('0x2e')]['bind'](_0x4e5160,_0x3cc265),_0x4e5160[_0xb964('0x5')][_0x5d85d9]['acwTimeout']*0x3e8);_0x4e5160[_0xb964('0x7')][_0x3cc265][_0xb964('0x18')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4e5160[_0xb964('0x7')][_0x3cc265][_0xb964('0x2f')]=_0x30d78f;_0x4e5160[_0xb964('0x7')][_0x3cc265][_0xb964('0x21')]=_0x5d85d9;_0x4e5160[_0xb964('0x7')][_0x3cc265][_0xb964('0x30')]=_0x4e5160['updateAcw']['bind'](_0x4e5160,_0x3cc265,_0x30d78f);})['catch'](function(){logger[_0xb964('0x1e')](_0xb964('0x31'),_0x30d78f,_0x4e5160[_0xb964('0x5')][_0x5d85d9][_0xb964('0x2d')],_0x3cc265,_0x5d85d9);})[_0xb964('0x32')](function(){delete _0x4e5160[_0xb964('0x8')][_0x30d78f];});}catch(_0x4e3eae){logger['error'](_0xb964('0x33'),_0x4e3eae[_0xb964('0x34')]);}};Acw[_0xb964('0x17')][_0xb964('0x2e')]=function(_0x173de5){try{var _0x51e007=this;if(_0x51e007[_0xb964('0x7')][_0x173de5]){_0x51e007[_0xb964('0x7')][_0x173de5][_0xb964('0x19')]=![];var _0x5f3244=_0x51e007[_0xb964('0x7')][_0x173de5][_0xb964('0x2f')];var _0x4286c3=_0x51e007['timers'][_0x173de5][_0xb964('0x21')];var _0x575023=_0x51e007[_0xb964('0x5')][_0x4286c3]['acwTimeout'];logger[_0xb964('0x1b')](_0xb964('0x35'),_0x5f3244,_0x173de5);RpcUser['saveUnpause'](this['agents'][_0x173de5]);RpcVoiceAgentReport[_0xb964('0x1a')]({'acwtime':_0x575023,'agentacw':!![]},_0x5f3244,_0x173de5)[_0xb964('0x27')](function(_0x2f9e6d){logger[_0xb964('0x1b')](_0xb964('0x1c'),_0x5f3244,_0x575023,_0x2f9e6d);})['catch'](function(_0x1f7ee0){logger[_0xb964('0x1e')](_0xb964('0x36'),_0x5f3244,_0x1f7ee0);});}else{logger['error'](_0xb964('0x37'),_0x173de5);if(_0x51e007[_0xb964('0x7')]){logger[_0xb964('0x1b')](_0xb964('0x38'),JSON[_0xb964('0x39')](_0x51e007['timers']));}}}catch(_0xe962f9){logger[_0xb964('0x1e')]('[ACW][STOP]\x20%s',_0xe962f9[_0xb964('0x34')]);}};Acw[_0xb964('0x17')][_0xb964('0xa')]=function(_0x379b31){try{if(this['voiceQueues'][_0x379b31['queue']]&&(this[_0xb964('0x5')][_0x379b31[_0xb964('0x21')]][_0xb964('0x3')]||this[_0xb964('0x5')][_0x379b31[_0xb964('0x21')]][_0xb964('0x3a')])){if(this[_0xb964('0x6')][_0x379b31[_0xb964('0x20')]]){this['channels'][_0x379b31[_0xb964('0x2f')]]={'queue':_0x379b31['queue'],'interface':_0x379b31[_0xb964('0x20')],'destlinkedid':_0x379b31[_0xb964('0x2b')]};}}}catch(_0xea21db){logger['error'](_0xb964('0x3b'),_0xea21db[_0xb964('0x34')]);}};Acw[_0xb964('0x17')][_0xb964('0x13')]=function(_0x43fcd0){try{if(this[_0xb964('0x5')][_0x43fcd0[_0xb964('0x21')]]&&(this[_0xb964('0x5')][_0x43fcd0[_0xb964('0x21')]]['acw']||this['voiceQueues'][_0x43fcd0['queue']][_0xb964('0x3a')])){if(this[_0xb964('0x6')][_0x43fcd0['interface']]){this[_0xb964('0x8')][_0x43fcd0[_0xb964('0x2f')]]={'queue':_0x43fcd0['queue'],'interface':_0x43fcd0['interface']};}}}catch(_0x343942){logger[_0xb964('0x1e')](_0xb964('0x3c'),_0x343942[_0xb964('0x34')]);}};Acw['prototype'][_0xb964('0xb')]=function(_0x52fbe7){try{if(this[_0xb964('0x8')][_0x52fbe7[_0xb964('0x2f')]]&&_[_0xb964('0x3d')](this[_0xb964('0x8')][_0x52fbe7[_0xb964('0x2f')]][_0xb964('0x3e')])){logger[_0xb964('0x1b')](_0xb964('0x3f'),_0x52fbe7['uniqueid']);this[_0xb964('0x1f')](_0x52fbe7[_0xb964('0x2f')]);}else if(this[_0xb964('0x8')][_0x52fbe7[_0xb964('0x40')]]&&_['isUndefined'](this[_0xb964('0x8')][_0x52fbe7[_0xb964('0x40')]][_0xb964('0x3e')])){logger[_0xb964('0x1b')](_0xb964('0x41'),_0x52fbe7[_0xb964('0x40')]);this[_0xb964('0x1f')](_0x52fbe7[_0xb964('0x40')]);}}catch(_0x3a0e8d){logger[_0xb964('0x1e')](_0xb964('0x42'),_0x3a0e8d[_0xb964('0x34')]);}};Acw[_0xb964('0x17')][_0xb964('0xc')]=function(_0x2f2a8a){try{if(this['channels'][_0x2f2a8a[_0xb964('0x2f')]]&&this['channels'][_0x2f2a8a[_0xb964('0x2f')]][_0xb964('0x3e')]){logger[_0xb964('0x1b')](_0xb964('0x43'),_0x2f2a8a['uniqueid']);this[_0xb964('0x1f')](_0x2f2a8a[_0xb964('0x2f')]);}else if(this[_0xb964('0x8')][_0x2f2a8a[_0xb964('0x40')]]&&this[_0xb964('0x8')][_0x2f2a8a['linkedid']]['attended']){logger[_0xb964('0x1b')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x2f2a8a[_0xb964('0x40')]);this[_0xb964('0x1f')](_0x2f2a8a['linkedid']);}}catch(_0x35d9f1){logger[_0xb964('0x1e')]('[ACW][syncHangup]\x20%s',_0x35d9f1[_0xb964('0x34')]);}};Acw[_0xb964('0x17')]['syncAttendedTransfer']=function(_0x1ac423){try{if(!_['isNil'](this[_0xb964('0x8')][_0x1ac423[_0xb964('0x44')]])){this[_0xb964('0x1f')](_0x1ac423[_0xb964('0x44')]);if(this[_0xb964('0x8')][_0x1ac423[_0xb964('0x45')]]){this[_0xb964('0x8')][_0x1ac423['secondtransfereruniqueid']][_0xb964('0x3e')]=!![];this['channels'][_0x1ac423[_0xb964('0x46')]]=this['channels'][_0x1ac423[_0xb964('0x45')]];delete this[_0xb964('0x8')][_0x1ac423[_0xb964('0x45')]];}}else if(!_[_0xb964('0x47')](this[_0xb964('0x8')][_0x1ac423[_0xb964('0x46')]])){this['startAcw'](_0x1ac423[_0xb964('0x46')]);if(this[_0xb964('0x8')][_0x1ac423['origtransfereruniqueid']]){this[_0xb964('0x8')][_0x1ac423[_0xb964('0x48')]]['attended']=!![];this[_0xb964('0x8')][_0x1ac423[_0xb964('0x44')]]=this[_0xb964('0x8')][_0x1ac423['origtransfereruniqueid']];delete this[_0xb964('0x8')][_0x1ac423[_0xb964('0x48')]];}}}catch(_0x3840a0){logger[_0xb964('0x1e')](_0xb964('0x49'),_0x3840a0[_0xb964('0x34')]);}};Acw[_0xb964('0x17')][_0xb964('0x12')]=function(_0x1f8303){try{if(this['channels'][_0x1f8303[_0xb964('0x4a')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xb964('0x39')](_0x1f8303['transfereruniqueid']));this[_0xb964('0x1f')](_0x1f8303[_0xb964('0x4a')]);}else if(this[_0xb964('0x8')][_0x1f8303['transfererlinkedid']]){logger[_0xb964('0x1b')](_0xb964('0x4b'),JSON['stringify'](_0x1f8303[_0xb964('0x4c')]));this[_0xb964('0x1f')](_0x1f8303[_0xb964('0x4c')]);}}catch(_0x4f75fe){logger[_0xb964('0x1e')]('[ACW][syncBlindTransfer]\x20%s',_0x4f75fe[_0xb964('0x34')]);}};Acw['prototype'][_0xb964('0xf')]=function(_0x120de2){try{if(this[_0xb964('0x5')][_0x120de2[_0xb964('0x21')]]&&this['voiceQueues'][_0x120de2[_0xb964('0x21')]]['autopause']===_0xb964('0x4d')){if(this[_0xb964('0x6')][_0x120de2[_0xb964('0x20')]]){logger[_0xb964('0x1b')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x120de2[_0xb964('0x2f')],_0x120de2[_0xb964('0x20')],_0x120de2[_0xb964('0x21')]);return RpcUser[_0xb964('0x2c')](this[_0xb964('0x6')][_0x120de2[_0xb964('0x20')]],_0xb964('0x4e'),_0x120de2[_0xb964('0x2f')]);}}}catch(_0x1fdcbd){logger[_0xb964('0x1e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1fdcbd[_0xb964('0x34')]);}};module[_0xb964('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index cc9d583..3c1e38a 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 _0xe9e8=['resolve','then','actionCoreShowChannels','catch','[ami.js][fullybooted]','exports','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s'];(function(_0x2366b1,_0x578f99){var _0x287e79=function(_0x529aec){while(--_0x529aec){_0x2366b1['push'](_0x2366b1['shift']());}};_0x287e79(++_0x578f99);}(_0xe9e8,0x177));var _0x8e9e=function(_0x35599c,_0x36d3db){_0x35599c=_0x35599c-0x0;var _0x54eb4c=_0xe9e8[_0x35599c];return _0x54eb4c;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var logger=require(_0x8e9e('0x2'))(_0x8e9e('0x3'));var config=require(_0x8e9e('0x4'));var ami=new Manager(config[_0x8e9e('0x5')]['port'],config[_0x8e9e('0x5')]['ip'],config[_0x8e9e('0x5')][_0x8e9e('0x6')],config[_0x8e9e('0x5')][_0x8e9e('0x7')],!![]);ami[_0x8e9e('0x8')]();ami[_0x8e9e('0x9')]=BPromise[_0x8e9e('0xa')](ami[_0x8e9e('0xb')]);function error(_0xd06721){logger[_0x8e9e('0xc')](util[_0x8e9e('0xd')](_0x8e9e('0xe'),config[_0x8e9e('0x5')][_0x8e9e('0x6')],config[_0x8e9e('0x5')]['ip'],config['asterisk'][_0x8e9e('0xf')],util[_0x8e9e('0x10')](_0xd06721,![],null)));}function close(){logger[_0x8e9e('0xc')](util[_0x8e9e('0xd')](_0x8e9e('0x11'),config[_0x8e9e('0x5')][_0x8e9e('0x6')],config[_0x8e9e('0x5')]['ip'],config[_0x8e9e('0x5')][_0x8e9e('0xf')]));}ami[_0x8e9e('0x12')]=function(){return function(){return ami['Action']({'action':_0x8e9e('0x13')});};};ami[_0x8e9e('0x14')]=function(){return function(){return ami[_0x8e9e('0x9')]({'action':_0x8e9e('0x15')});};};ami[_0x8e9e('0x16')]=function(){return function(){return ami[_0x8e9e('0x9')]({'action':_0x8e9e('0x17')});};};ami[_0x8e9e('0x18')]=function(){return function(){return ami[_0x8e9e('0x9')]({'action':_0x8e9e('0x19')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x8e9e('0x9')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0x8e9e('0xd')](_0x8e9e('0x1a'),config[_0x8e9e('0x5')][_0x8e9e('0x6')],config[_0x8e9e('0x5')]['ip'],config['asterisk'][_0x8e9e('0xf')]));ami['once'](_0x8e9e('0xc'),error);ami[_0x8e9e('0x1b')](_0x8e9e('0x1c'),close);}ami['on'](_0x8e9e('0x1d'),connect);ami['on'](_0x8e9e('0x1e'),function(_0x5408b1){logger['info'](util[_0x8e9e('0xd')](_0x8e9e('0x1f'),config[_0x8e9e('0x5')]['username'],config[_0x8e9e('0x5')]['ip'],config[_0x8e9e('0x5')][_0x8e9e('0xf')],util[_0x8e9e('0x10')](_0x5408b1,![],null)));});ami['on'](_0x8e9e('0x20'),function(){logger[_0x8e9e('0x21')](util[_0x8e9e('0xd')](_0x8e9e('0x22'),config['asterisk'][_0x8e9e('0x6')],config['asterisk']['ip'],config['asterisk'][_0x8e9e('0xf')]));return Promise[_0x8e9e('0x23')]()[_0x8e9e('0x24')](ami[_0x8e9e('0x12')]())[_0x8e9e('0x24')](ami['actionDeviceStateList']())[_0x8e9e('0x24')](ami[_0x8e9e('0x16')]())[_0x8e9e('0x24')](ami[_0x8e9e('0x18')]())[_0x8e9e('0x24')](ami[_0x8e9e('0x25')]())[_0x8e9e('0x26')](function(_0x51eb62){logger[_0x8e9e('0xc')](_0x8e9e('0x27'),util['inspect'](_0x51eb62,{'showHidden':![],'depth':null}));});});ami[_0x8e9e('0x1b')]('error',error);ami[_0x8e9e('0x1b')](_0x8e9e('0x1c'),close);module[_0x8e9e('0x28')]=ami; \ No newline at end of file +var _0x9613=['then','exports','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','resolve'];(function(_0x2a2898,_0x531d10){var _0x50a6b3=function(_0x25aef9){while(--_0x25aef9){_0x2a2898['push'](_0x2a2898['shift']());}};_0x50a6b3(++_0x531d10);}(_0x9613,0xf0));var _0x3961=function(_0x4b0cef,_0x4038ce){_0x4b0cef=_0x4b0cef-0x0;var _0x48f2b8=_0x9613[_0x4b0cef];return _0x48f2b8;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x3961('0x0'));var util=require(_0x3961('0x1'));var logger=require(_0x3961('0x2'))(_0x3961('0x3'));var config=require(_0x3961('0x4'));var ami=new Manager(config[_0x3961('0x5')][_0x3961('0x6')],config[_0x3961('0x5')]['ip'],config[_0x3961('0x5')][_0x3961('0x7')],config[_0x3961('0x5')][_0x3961('0x8')],!![]);ami[_0x3961('0x9')]();ami[_0x3961('0xa')]=BPromise[_0x3961('0xb')](ami['action']);function error(_0xb2d165){logger[_0x3961('0xc')](util[_0x3961('0xd')](_0x3961('0xe'),config[_0x3961('0x5')][_0x3961('0x7')],config[_0x3961('0x5')]['ip'],config[_0x3961('0x5')][_0x3961('0x6')],util[_0x3961('0xf')](_0xb2d165,![],null)));}function close(){logger[_0x3961('0xc')](util['format'](_0x3961('0x10'),config[_0x3961('0x5')][_0x3961('0x7')],config['asterisk']['ip'],config[_0x3961('0x5')][_0x3961('0x6')]));}ami[_0x3961('0x11')]=function(){return function(){return ami[_0x3961('0xa')]({'action':_0x3961('0x12')});};};ami[_0x3961('0x13')]=function(){return function(){return ami['Action']({'action':_0x3961('0x14')});};};ami[_0x3961('0x15')]=function(){return function(){return ami[_0x3961('0xa')]({'action':_0x3961('0x16')});};};ami[_0x3961('0x17')]=function(){return function(){return ami['Action']({'action':_0x3961('0x18')});};};ami[_0x3961('0x19')]=function(){return function(){return ami[_0x3961('0xa')]({'action':'coreshowchannels'});};};function connect(){logger[_0x3961('0x1a')](util[_0x3961('0xd')](_0x3961('0x1b'),config[_0x3961('0x5')][_0x3961('0x7')],config[_0x3961('0x5')]['ip'],config['asterisk']['port']));ami[_0x3961('0x1c')](_0x3961('0xc'),error);ami[_0x3961('0x1c')](_0x3961('0x1d'),close);}ami['on']('connect',connect);ami['on'](_0x3961('0x1e'),function(_0x4057ad){logger[_0x3961('0x1a')](util[_0x3961('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config[_0x3961('0x5')]['ip'],config[_0x3961('0x5')][_0x3961('0x6')],util[_0x3961('0xf')](_0x4057ad,![],null)));});ami['on']('fullybooted',function(){logger[_0x3961('0x1a')](util[_0x3961('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0x3961('0x7')],config[_0x3961('0x5')]['ip'],config[_0x3961('0x5')][_0x3961('0x6')]));return Promise[_0x3961('0x1f')]()[_0x3961('0x20')](ami[_0x3961('0x11')]())[_0x3961('0x20')](ami[_0x3961('0x13')]())[_0x3961('0x20')](ami[_0x3961('0x15')]())[_0x3961('0x20')](ami[_0x3961('0x17')]())[_0x3961('0x20')](ami[_0x3961('0x19')]())['catch'](function(_0x151ed2){logger[_0x3961('0xc')]('[ami.js][fullybooted]',util['inspect'](_0x151ed2,{'showHidden':![],'depth':null}));});});ami[_0x3961('0x1c')](_0x3961('0xc'),error);ami[_0x3961('0x1c')](_0x3961('0x1d'),close);module[_0x3961('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index b30e8e4..671f3f8 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 _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x55e3d5,_0x2656cc){var _0xdad6e4=function(_0x1d15f8){while(--_0x1d15f8){_0x55e3d5['push'](_0x55e3d5['shift']());}};_0xdad6e4(++_0x2656cc);}(_0xb43b,0x1b2));var _0xbb43=function(_0x195a3b,_0x565acf){_0x195a3b=_0x195a3b-0x0;var _0x47e31e=_0xb43b[_0x195a3b];return _0x47e31e;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 0599a41..82f50f2 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 _0x2bb8=['dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','object','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','startMethodPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','agentBusyFactor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','run','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[getContactCampaign2]','dialLimitQueue','booked','not_inuse','getContactDialer','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','countReScheduled','[countReScheduled]\x20','emptyContact','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Amax\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','lodash','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/hangup','env','XCALLY_IP_AGI','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','syncOriginateResponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','then','previewRecallmeReminderInterval','isUndefined','emit','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\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','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','getSeconds','debug','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','inspect','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','queueStatusComplete','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','active','SIP/%s','status','unmonitored','checkIsTrunkReachable','Trunk','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','true','content','indexOf','catch','all','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','checkDialMethod','predictive','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_INTERVAL','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueid','type','ivr','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','syncQueueCallerAbandon','updateOriginated','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','queueCallerAbandonCreateState','rescheduleContact','minutes','ListId','VoiceQueueId','CampaignId','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','voiceQueue','countabandonedretry','dialAbandonedMaxRetry','ContactId','[syncAgentComplete][createHistory][11]','syncNewExten','channel','syncQueueMember','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','idHopper','rrmemory','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','stringify','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','value','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','Machine','amd','countbusyretry','countcongestionretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','[syncAgentComplete][createHistory][0]','countnoanswerretry','reason19\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','moveContactManagedDialer','[syncHangupIvr]','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','filter','reachable','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncAgentComplete][createHistory]','Agent','handleIvr','actionOriginate','phone','originate','contact\x20is\x20undefine','getCaller','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2bb8,0x92));var _0x82bb=function(_0x8e96dd,_0x29bdd1){_0x8e96dd=_0x8e96dd-0x0;var _0x1bbda0=_0x2bb8[_0x8e96dd];return _0x1bbda0;};'use strict';var util=require('util');var _=require(_0x82bb('0x0'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require('./utils');var hopperUtils=require(_0x82bb('0x1'));var ut=require(_0x82bb('0x2'));var config=require(_0x82bb('0x3'));var logger=require(_0x82bb('0x4'))(_0x82bb('0x5'));var loggerBooked=require(_0x82bb('0x4'))('booked');var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0x82bb('0x4'))(_0x82bb('0x6'));var loggerSyncQueueSummary=require(_0x82bb('0x4'))(_0x82bb('0x7'));var ami=require(_0x82bb('0x8'));config[_0x82bb('0x9')]=_[_0x82bb('0xa')](config[_0x82bb('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x82bb('0xb'))(new Redis(config[_0x82bb('0x9')]));var cmHopper=require(_0x82bb('0xc'));var voiceQueueRt=require(_0x82bb('0xd'));var RpcSetting=require(_0x82bb('0xe'));var Interval=require(_0x82bb('0xf'));var Action=require(_0x82bb('0x10'));var History=require(_0x82bb('0x11'));var Final=require(_0x82bb('0x12'));var AgentComplete=require(_0x82bb('0x13'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x82bb('0x14'));var ipAgi=process[_0x82bb('0x15')][_0x82bb('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x82bb('0x17')]=function(_0x4d479e){this['tail']=this[_0x82bb('0x18')]?this['tail'][_0x82bb('0x19')](_0x4d479e):_0x4d479e();};function Dialer(_0x105a39,_0x94fd88){this[_0x82bb('0x1a')]=new Sequence();this[_0x82bb('0x1b')]=_0x94fd88;this['voiceQueues']=_0x105a39[_0x82bb('0x1c')];this[_0x82bb('0x1d')]=_0x105a39[_0x82bb('0x1d')];this[_0x82bb('0x1e')]=_0x105a39[_0x82bb('0x1e')];this['trunks']=_0x105a39[_0x82bb('0x1f')];this[_0x82bb('0x20')]=config[_0x82bb('0x20')]||0x2;this[_0x82bb('0x21')]={};this[_0x82bb('0x22')]={};this[_0x82bb('0x23')]={};this[_0x82bb('0x24')]={};this[_0x82bb('0x25')]={};this['startPredictive']={};this[_0x82bb('0x26')]={};this['ivrOriginated']={};this[_0x82bb('0x27')]={};this['queueBookedRR']={};this[_0x82bb('0x28')]={};ami['on'](_0x82bb('0x29'),this[_0x82bb('0x2a')][_0x82bb('0x2b')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x82bb('0x2b')](this));ami['on']('originateresponse',this[_0x82bb('0x2c')][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x2d'),this['syncAgentComplete'][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x2e'),this[_0x82bb('0x7')][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x2f'),this[_0x82bb('0x30')][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x31'),this[_0x82bb('0x32')]['bind'](this));ami['on'](_0x82bb('0x33'),this['syncNewExten'][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x34'),this[_0x82bb('0x35')]['bind'](this));ami['on'](_0x82bb('0x36'),this['syncQueueMember'][_0x82bb('0x2b')](this));ami['on'](_0x82bb('0x37'),this[_0x82bb('0x38')][_0x82bb('0x2b')](this));this[_0x82bb('0x39')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0x82bb('0x3a')](function(_0x725bf){previewRecallmeReminderInterval=_0x725bf[_0x82bb('0x3b')];});}function isNotNull(_0x2c5bc5){return _0x2c5bc5!==null&&!_[_0x82bb('0x3c')](_0x2c5bc5);}function msgResponse(_0x3bef85,_0x35ffa9,_0x3271fc){return{'action':_0x3bef85,'response':_0x35ffa9,'message':_0x3271fc,'stack':_0x3271fc};}function emit(_0x461079,_0x7c1190,_0x3973c8){io['to'](_0x461079)[_0x82bb('0x3d')](_0x7c1190,_0x3973c8);}function emitOutboundVoiceQueueSummary(_0x414ef6){if(_0x414ef6['type']==='outbound'){logger['debug'](_0x82bb('0x3e'),util['inspect'](_0x414ef6,{'showHidden':![],'depth':null}));emit(util[_0x82bb('0x3f')](_0x82bb('0x40'),_0x414ef6[_0x82bb('0x41')]),_0x82bb('0x42'),_0x414ef6);}}function checkGetDataPredictive(_0x19e7f1){if(isNotNull(_0x19e7f1)&&!_[_0x82bb('0x43')](_0x19e7f1)){loggerPredictive[_0x82bb('0x44')](_0x82bb('0x45'));loggerPredictive['info'](_0x82bb('0x46'),_0x19e7f1[_0x82bb('0x47')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19e7f1[_0x82bb('0x48')]);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x49'),_0x19e7f1['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x82bb('0x44')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19e7f1[_0x82bb('0x4a')]);loggerPredictive['info'](_0x82bb('0x4b'),_0x19e7f1['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19e7f1[_0x82bb('0x4c')]);loggerPredictive[_0x82bb('0x44')]('---------------------------');if(_0x19e7f1['predictiveIntervalTotalCalls']>0x0){if(!_[_0x82bb('0x3c')](_0x19e7f1['predictiveIntervalAvgTalktime'])&&_0x19e7f1[_0x82bb('0x4c')]>0x0){return!![];}loggerPredictive[_0x82bb('0x44')](_0x82bb('0x4d'));if(!_['isUndefined'](_0x19e7f1[_0x82bb('0x4e')])&&_0x19e7f1[_0x82bb('0x4e')]>0x0){return!![];}loggerPredictive[_0x82bb('0x44')](_0x82bb('0x4f'));}else{loggerPredictive[_0x82bb('0x44')](_0x82bb('0x50'));}}else{loggerPredictive[_0x82bb('0x44')](_0x82bb('0x51'));}return![];}function mergeDataErlangB(_0x50cf67){return function(_0x872ced){loggerPredictive['info'](_0x82bb('0x52'));loggerPredictive[_0x82bb('0x44')](_0x82bb('0x53'),_0x872ced[_0x82bb('0x54')]);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x55'),_0x872ced[_0x82bb('0x56')]);loggerPredictive[_0x82bb('0x44')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x872ced[_0x82bb('0x57')]);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x58'),_0x872ced['erlangBusyFactor']);loggerPredictive[_0x82bb('0x44')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x872ced[_0x82bb('0x57')]);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x59'));_[_0x82bb('0x5a')](_0x50cf67,_0x872ced);};}function ifInterval(_0xb24dea,_0x3869c2){if(_['isUndefined'](_0x3869c2)){return![];}return utils[_0x82bb('0x5b')](undefined,_0x3869c2)<_0xb24dea*0x3c;}function clearPredictiveAttributes(_0x258cad){if(_0x258cad['startProgressive']){_0x258cad['startProgressive']=undefined;loggerPredictive[_0x82bb('0x5c')](_0x258cad['name'],'startProgressive\x20value\x20cleared');}if(_0x258cad[_0x82bb('0x5d')]){_0x258cad[_0x82bb('0x5d')]=undefined;loggerPredictive['debug'](_0x258cad[_0x82bb('0x41')],_0x82bb('0x5e'));}if(_0x258cad[_0x82bb('0x5f')]){clearInterval(_0x258cad[_0x82bb('0x5f')]);_0x258cad[_0x82bb('0x5f')]=undefined;loggerPredictive[_0x82bb('0x5c')](_0x258cad[_0x82bb('0x41')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1dd115,_0x11579b){return function(_0x3f9470){loggerPredictive[_0x82bb('0x60')](_0x11579b[_0x82bb('0x41')],_0x1dd115);loggerPredictive['error'](_0x3f9470[_0x82bb('0x61')]);clearPredictiveAttributes(_0x11579b);};}function loggerCatch(_0x187743){return function(_0xb3a110){logger[_0x82bb('0x60')](_0x187743,util['inspect'](_0xb3a110,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x345f9c,_0x18fd48,_0x2fe5d9){return function(_0xe1e969){utils[_0x82bb('0x62')](_0x18fd48,_0x2fe5d9,0x0);_0x18fd48['temp']=0x0;logger[_0x82bb('0x60')](_0x345f9c,util[_0x82bb('0x63')](_0xe1e969,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5b66c6){return function(_0x2b4966){if(isNotNull(_0x2b4966)&&isNotNull(_0x2b4966[0x0])){if(_0x2b4966[0x0][_0x82bb('0x64')]>0x0){_0x5b66c6['message']=utils[_0x82bb('0x65')][_0x82bb('0x66')];logger['info'](_0x82bb('0x67')+_0x5b66c6[_0x82bb('0x41')],_0x2b4966[0x0][_0x82bb('0x64')],_0x82bb('0x68'));}else{_0x5b66c6[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x6a')];logger[_0x82bb('0x44')](_0x82bb('0x6b')+_0x5b66c6[_0x82bb('0x41')]);}}};}function createObjHistory(_0x2c75d6,_0x26ff05,_0x1efdb8,_0x31b132,_0x89e97e){_0x2c75d6[_0x82bb('0x69')]=_0x1efdb8;var _0x231021=new Action(_0x2c75d6,_0x26ff05);var _0x29feba=new History(_0x231021);_0x29feba[_0x82bb('0x6c')]=_0x31b132;_0x29feba[_0x82bb('0x6d')]=_0x89e97e;_0x29feba[_0x82bb('0x6e')]=_0x231021[_0x82bb('0x6f')];return _0x29feba;}function unlockQueueStatus(_0xf85b9,_0x3b57f1){setTimeout(function(){if(_[_0x82bb('0x3c')](_0xf85b9['queueStatusComplete'])){loggerBooked[_0x82bb('0x60')](_0x82bb('0x70'),_0x3b57f1);}_0xf85b9['queueStatusComplete']=!![];loggerBooked[_0x82bb('0x44')](_0x82bb('0x71'),_0x3b57f1,JSON['stringify'](_[_0x82bb('0x72')](_0xf85b9,[_0x82bb('0x41'),_0x82bb('0x73')])));},0x1f3);}function checkInterval(_0x24e974){return function(){if(!isNotNull(_0x24e974[_0x82bb('0x74')])){_0x24e974[_0x82bb('0x69')]=utils['CAMPAIGN_STATUS'][_0x82bb('0x75')];throw _0x24e974[_0x82bb('0x41')]+_0x82bb('0x76');}if(!isNotNull(_0x24e974[_0x82bb('0x74')][_0x82bb('0x77')])){_0x24e974['message']=utils['CAMPAIGN_STATUS'][_0x82bb('0x75')];throw _0x24e974[_0x82bb('0x41')]+_0x82bb('0x76');}if(!isNotNull(_[_0x82bb('0x43')](_0x24e974['Interval']['Intervals']))){_0x24e974[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x75')];throw _0x24e974[_0x82bb('0x41')]+_0x82bb('0x76');}};}function checkIsIVRCampaignActive(_0x5921fd){return function(){if(!utils['isIVRCampaignActive'](_0x5921fd)){_0x5921fd['message']=utils[_0x82bb('0x65')][_0x82bb('0x78')];throw _0x5921fd[_0x82bb('0x41')]+_0x82bb('0x79');}};}function emitCampaignSummary(_0x402625){if(utils[_0x82bb('0x7a')](_0x402625)){emit(util[_0x82bb('0x3f')](_0x82bb('0x7b'),_0x402625[_0x82bb('0x41')]),_0x82bb('0x7c'),_0x402625);}}function loggerCatchQueueSummary(_0x5b8bb2,_0x43e875){return function(_0x5ebbc6){clearPredictiveAttributes(_0x43e875);emitCampaignSummary(_0x43e875);loggerSyncQueueSummary[_0x82bb('0x5c')](_0x5b8bb2,util[_0x82bb('0x63')](_0x5ebbc6,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x4008bd){if(_0x4008bd[_0x82bb('0x7d')]){if(_0x4008bd[_0x82bb('0x7e')]===0x0){_0x4008bd[_0x82bb('0x7d')]=![];_0x4008bd[_0x82bb('0x69')]=utils['CAMPAIGN_STATUS'][_0x82bb('0x78')];loggerSyncQueueSummary['debug'](_0x82bb('0x7f'),_0x4008bd[_0x82bb('0x41')],_0x82bb('0x80'));}else{_0x4008bd['message']=utils[_0x82bb('0x65')][_0x82bb('0x81')];loggerSyncQueueSummary[_0x82bb('0x5c')](_0x82bb('0x7f'),_0x4008bd[_0x82bb('0x41')],_0x82bb('0x82'));}emitCampaignSummary(_0x4008bd);}}function myreject(_0x5da212){return function(_0xcb0207){return _0x5da212(msgResponse(_0x82bb('0x83'),_0x82bb('0x84'),JSON['stringify'](_0xcb0207)));};}Dialer[_0x82bb('0x85')]['isTrunkReachable']=function(_0x18c57c){return!_[_0x82bb('0x3c')](_0x18c57c)&&_0x18c57c&&!_[_0x82bb('0x3c')](_0x18c57c['name'])&&!_[_0x82bb('0x3c')](_0x18c57c[_0x82bb('0x86')])&&_0x18c57c[_0x82bb('0x86')]&&(this[_0x82bb('0x1f')][util[_0x82bb('0x3f')](_0x82bb('0x87'),_0x18c57c['name'])][_0x82bb('0x88')]==='reachable'||this[_0x82bb('0x1f')][util[_0x82bb('0x3f')](_0x82bb('0x87'),_0x18c57c['name'])][_0x82bb('0x88')]===_0x82bb('0x89'));};Dialer[_0x82bb('0x85')][_0x82bb('0x8a')]=function(_0x20af53){var _0x456854=this;return function(){if(!_0x456854['isTrunkReachable'](_0x20af53[_0x82bb('0x8b')])){if(!_0x456854[_0x82bb('0x8c')](_0x20af53[_0x82bb('0x8d')])){_0x20af53[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x8e')];throw _0x20af53[_0x82bb('0x41')]+_0x82bb('0x8f');}}};};Dialer['prototype'][_0x82bb('0x90')]=function(_0x2266ad,_0x505816,_0x793a96,_0x35689f){var _0x102a4b=this;return function(){var _0x416323=!![];return _0x102a4b[_0x82bb('0x91')](_0x2266ad,_0x505816,_0x793a96,_0x35689f,_0x416323);};};Dialer[_0x82bb('0x85')][_0x82bb('0x92')]=function(_0x14833c,_0x504428,_0x45f96c,_0x17d3c0){var _0x5b1dee=this;return function(){var _0x487fc9=![];return _0x5b1dee[_0x82bb('0x91')](_0x14833c[_0x82bb('0x77')],_0x504428,_0x45f96c,_0x17d3c0,_0x487fc9);};};Dialer[_0x82bb('0x85')][_0x82bb('0x91')]=function(_0x1f48fc,_0x53229c,_0x1743a4,_0xe684e6,_0x465caf){var _0x8464ac=[];return new Promise(function(_0x4b3973,_0x1c6e4a){if(!isNotNull(_0x1f48fc)){_0xe684e6['message']=utils[_0x82bb('0x65')]['NULL_INTERVAL'];return _0x1c6e4a(msgResponse('ifTime','Failure',_0x1743a4+_0x82bb('0x93')));}if(_[_0x82bb('0x43')](_0x1f48fc)){_0xe684e6[_0x82bb('0x69')]=utils['CAMPAIGN_STATUS'][_0x82bb('0x94')];return _0x1c6e4a(msgResponse(_0x82bb('0x95'),_0x82bb('0x96'),_0x1743a4+_0x82bb('0x97')));}if(_0x53229c&&_[_0x82bb('0x3c')](config[_0x82bb('0x98')][_0x53229c])){_0xe684e6[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x99')];return _0x1c6e4a(msgResponse(_0x82bb('0x95'),_0x82bb('0x96'),_0x1743a4+_0x82bb('0x9a')+_0x53229c));}if(_[_0x82bb('0x9b')](_0x1f48fc)){for(var _0x13807b=0x0;_0x13807b<_0x1f48fc[_0x82bb('0x9c')];_0x13807b+=0x1){_0x8464ac[_0x82bb('0x9d')](ami[_0x82bb('0x9e')]({'action':_0x82bb('0x9f'),'command':util[_0x82bb('0x3f')](_0x82bb('0xa0'),_0x1f48fc[_0x13807b]['interval'],!_[_0x82bb('0x3c')](config[_0x82bb('0x98')][_0x53229c])?_0x53229c:'')})[_0x82bb('0x3a')](function(_0x1b326e){return _0x1b326e['content']['indexOf'](_0x82bb('0xa1'))>=0x0;})['catch'](myreject(_0x1c6e4a)));}}else{_0x8464ac[_0x82bb('0x9d')](ami[_0x82bb('0x9e')]({'action':_0x82bb('0x9f'),'command':util[_0x82bb('0x3f')](_0x82bb('0xa0'),_0x1f48fc,!_[_0x82bb('0x3c')](config[_0x82bb('0x98')][_0x53229c])?_0x53229c:'')})[_0x82bb('0x3a')](function(_0x26bc53){return _0x26bc53[_0x82bb('0xa2')][_0x82bb('0xa3')](_0x82bb('0xa1'))>=0x0;})[_0x82bb('0xa4')](myreject(_0x1c6e4a)));}Promise[_0x82bb('0xa5')](_0x8464ac)['then'](function(_0x597cd6){var _0x59dd47=_['some'](_0x597cd6);if(_0x59dd47){return _0x4b3973(_0x59dd47);}else{_0xe684e6['message']=_0x465caf?utils[_0x82bb('0x65')][_0x82bb('0xa6')]:utils[_0x82bb('0x65')]['OVERTIME_INTERVAL'];return _0x1c6e4a(msgResponse(_0x82bb('0xa7'),_0x82bb('0x96'),_0x82bb('0xa8')+_0x465caf+'\x20'+_0x1743a4+'\x20Interval\x20is\x20overtime:\x20'+util[_0x82bb('0x63')](_0x1f48fc,{'showHidden':![],'depth':null})+_0x82bb('0xa9')+_0x53229c));}})[_0x82bb('0xa4')](function(_0x1764cb){return _0x1c6e4a(msgResponse(_0x82bb('0x95'),_0x82bb('0x96'),JSON['stringify'](_0x1764cb)));});});};Dialer[_0x82bb('0x85')][_0x82bb('0x39')]=function(){var _0x59be41=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x82bb('0x3a')](function(){setInterval(function(){_0x59be41[_0x82bb('0xaa')]();},0x3e8);});};Dialer['prototype'][_0x82bb('0xaa')]=function(){var _0x39bee2=this;var _0x3a404d;for(var _0x5c1fec in this['campaigns']){if(typeof this['campaigns'][_0x5c1fec]!==_0x82bb('0xab')){_0x3a404d=this[_0x82bb('0x1d')][_0x5c1fec];if(utils[_0x82bb('0x7a')](_0x3a404d)&&utils['isIVRCampaignActive'](_0x3a404d)){_0x3a404d[_0x82bb('0x7d')]=!![];Promise[_0x82bb('0xac')]()[_0x82bb('0x3a')](checkIsIVRCampaignActive(_0x3a404d))[_0x82bb('0x3a')](checkInterval(_0x3a404d))[_0x82bb('0x3a')](_0x39bee2['checkIsTrunkReachable'](_0x3a404d))[_0x82bb('0x3a')](_0x39bee2['checkIfTime'](_0x3a404d[_0x82bb('0xad')],_0x3a404d[_0x82bb('0xae')],_0x3a404d[_0x82bb('0x41')],_0x3a404d))['then'](_0x39bee2[_0x82bb('0x92')](_0x3a404d[_0x82bb('0x74')],_0x3a404d['dialTimezone'],_0x3a404d[_0x82bb('0x41')],_0x3a404d))[_0x82bb('0x3a')](_0x39bee2[_0x82bb('0xaf')](_0x3a404d))[_0x82bb('0xa4')](loggerCatchQueueSummary('[syncCampaigns]',_0x3a404d));}else{notSendMessagesCampaign(_0x3a404d);}}}};Dialer[_0x82bb('0x85')][_0x82bb('0xb0')]=function(_0x50a86c){if(_0x50a86c['dialMethod']!==_0x82bb('0xb1')){clearPredictiveAttributes(_0x50a86c);}switch(_0x50a86c[_0x82bb('0xb2')]){case _0x82bb('0xb3'):this[_0x82bb('0xb4')](_0x50a86c,0x1);break;case _0x82bb('0xb5'):this[_0x82bb('0xb4')](_0x50a86c,_0x50a86c[_0x82bb('0xb6')]);break;case _0x82bb('0xb1'):this[_0x82bb('0xb1')](_0x50a86c);break;case'booked':this[_0x82bb('0xb4')](_0x50a86c,0x1);break;default:logger['error'](_0x82bb('0xb7'),_0x50a86c['name'],'method\x20not\x20recognized');}};Dialer[_0x82bb('0x85')]['ifTime']=function(_0x4b8043,_0x331654){var _0x23af6d=_0x4b8043[_0x82bb('0xae')];var _0x6ac72b=_0x331654?_0x4b8043[_0x82bb('0xad')]:_0x4b8043['Interval'][_0x82bb('0x77')];logger[_0x82bb('0xb8')](_0x82bb('0xb9'),_0x6ac72b,_0x23af6d,_0x4b8043[_0x82bb('0x41')],util[_0x82bb('0x3f')](_0x82bb('0xba'),_0x4b8043['name'],_0x4b8043['id']));var _0x3254e1=null;return Interval[_0x82bb('0xbb')](_0x6ac72b,_0x23af6d)[_0x82bb('0x3a')](function(_0x425568){if(_0x425568===!![]){return _0x425568;}else{_0x4b8043['message']=_0x331654?utils[_0x82bb('0x65')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x82bb('0x65')][_0x82bb('0xbc')];_0x3254e1=msgResponse('[ifTime][promiseAll]',_0x82bb('0x96'),_0x82bb('0xa8')+_0x331654+'\x20'+_0x4b8043['name']+_0x82bb('0xbd')+util[_0x82bb('0x63')](_0x6ac72b,{'showHidden':![],'depth':null})+_0x82bb('0xa9')+_0x23af6d);}if(_0x3254e1!==null){logger[_0x82bb('0xb8')](_0x82bb('0xbe'),_0x3254e1);_0x3254e1['isGlobal']=_0x331654;throw _0x3254e1;}})[_0x82bb('0xa4')](function(_0x33e72c){logger['error'](_0x82bb('0xbf'),_0x33e72c);throw msgResponse('[ifTime][Action]',_0x82bb('0x84'),util[_0x82bb('0x63')](_0x33e72c,{'showHidden':![],'depth':null}));});};Dialer[_0x82bb('0x85')]['syncAgentConnect']=function(_0x45ae33){if(this[_0x82bb('0x1c')][_0x45ae33[_0x82bb('0xc0')]]){if(this[_0x82bb('0x24')][_0x45ae33[_0x82bb('0xc1')]]&&this[_0x82bb('0x24')][_0x45ae33[_0x82bb('0xc1')]][_0x82bb('0xc2')]!==_0x82bb('0xc3')){this['updateOriginated'](this[_0x82bb('0x1c')][_0x45ae33[_0x82bb('0xc0')]]);this[_0x82bb('0x24')][_0x45ae33[_0x82bb('0xc1')]]['answertime']=moment()[_0x82bb('0x3f')](_0x82bb('0xc4'));}}};Dialer[_0x82bb('0x85')][_0x82bb('0xc5')]=function(_0x224b43){var _0x18c89d=this[_0x82bb('0x24')][_0x224b43[_0x82bb('0xc1')]];if(this['voiceQueues'][_0x224b43[_0x82bb('0xc0')]]){if(_0x18c89d&&_0x18c89d['type']!==_0x82bb('0xc3')){delete this[_0x82bb('0x24')][_0x224b43['uniqueid']];this['voiceQueues'][_0x224b43[_0x82bb('0xc0')]]['outboundAnswerCallsDay']+=0x1;var _0x55b2b6=new AgentComplete(_0x18c89d,_0x224b43);if(_0x224b43[_0x82bb('0xc6')]===_0x82bb('0xc7')){_0x55b2b6[_0x82bb('0xc8')]=this[_0x82bb('0x1c')][_0x224b43['queue']][_0x82bb('0xc9')]&&this[_0x82bb('0x1c')][_0x224b43[_0x82bb('0xc0')]][_0x82bb('0xca')]?moment()[_0x82bb('0x3f')](_0x82bb('0xc4')):undefined;}hopperUtils['createHistory'](_0x55b2b6)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x55b2b6)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0xcb')));}}};Dialer[_0x82bb('0x85')][_0x82bb('0xcc')]=function(_0x4c8e5d){var _0x477653=this[_0x82bb('0x24')][_0x4c8e5d[_0x82bb('0xc1')]];var _0x59ebfc=this;var _0x291462=![];var _0x2ecd3b;var _0x56fa62;if(this[_0x82bb('0x1c')][_0x4c8e5d['queue']]){if(_0x477653&&_0x477653[_0x82bb('0xc2')]!==_0x82bb('0xc3')){delete this[_0x82bb('0x24')][_0x4c8e5d['uniqueid']];this[_0x82bb('0xcd')](this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]]);_0x477653['droptime']=moment()[_0x82bb('0x3f')](_0x82bb('0xc4'));var _0xc6b588=new QueueCallerAbandon(_0x477653,_0x4c8e5d);if(utils[_0x82bb('0x5b')](_0x477653[_0x82bb('0xce')],_0x477653[_0x82bb('0xcf')])>=_0x477653[_0x82bb('0xd0')]){this[_0x82bb('0x1c')][_0x4c8e5d['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xd1')]+=0x1;this[_0x82bb('0x1c')][_0x4c8e5d['queue']][_0x82bb('0xd2')]+=0x1;_0xc6b588[_0x82bb('0x6c')]=0xa;_0xc6b588[_0x82bb('0x6d')]=_0x82bb('0xd3');_0xc6b588[_0x82bb('0xd4')]=_0x82bb('0xd5');_0xc6b588[_0x82bb('0xc8')]=this['voiceQueues'][_0x4c8e5d['queue']]['dialQueueProject2']?moment()[_0x82bb('0x3f')](_0x82bb('0xc4')):undefined;_0xc6b588[_0x82bb('0xd6')]+=0x1;_0xc6b588[_0x82bb('0xd7')]+=0x1;_0x2ecd3b=this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xd8')];_0x56fa62=this['voiceQueues'][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xd9')];hopperUtils[_0x82bb('0xda')](_0xc6b588,_0xc6b588[_0x82bb('0x6c')],_0x477653['voiceQueue'])['then'](function(_0x543377){_0x291462=_0x543377[_0x82bb('0xdb')]==0x1;if(_0xc6b588[_0x82bb('0xd6')]>=_0x59ebfc[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]]['dialDropMaxRetry']){_0x59ebfc[_0x82bb('0xdc')](_0xc6b588,_0x543377['additional']);}else{hopperUtils[_0x82bb('0xdd')]({'active':![],'countdropretry':_0xc6b588[_0x82bb('0xd6')],'scheduledat':moment()['add'](_0x59ebfc[_0x82bb('0x1c')][_0x4c8e5d['queue']][_0x82bb('0xd8')],_0x82bb('0xde'))[_0x82bb('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x477653['ContactId'],'ListId':_0x477653[_0x82bb('0xdf')],'VoiceQueueId':_0x477653[_0x82bb('0xe0')]||undefined,'CampaignId':_0x477653[_0x82bb('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x3f9c9e=new History(_0xc6b588);_0x3f9c9e[_0x82bb('0x6c')]=0xa;_0x3f9c9e[_0x82bb('0x6d')]=_0x82bb('0xd3');_0x3f9c9e[_0x82bb('0x6f')]=moment()['format'](_0x82bb('0xc4'));_0x3f9c9e[_0x82bb('0x6e')]=_0x3f9c9e[_0x82bb('0x6f')];_0x3f9c9e[_0x82bb('0xe2')]=_0xc6b588[_0x82bb('0xe2')];_0x3f9c9e[_0x82bb('0xe3')]=_0xc6b588['calleridnum'];hopperUtils[_0x82bb('0xe4')](_0x3f9c9e)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0xe5')));}})[_0x82bb('0x3a')](function(){if(_0x291462)hopperUtils[_0x82bb('0xe6')](_0xc6b588,_0x2ecd3b,_0x56fa62)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0x4a')]+=0x1;this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]]['outboundDropCallsDayCallersExit']+=0x1;_0xc6b588['state']=0xb;_0xc6b588[_0x82bb('0x6d')]=_0x82bb('0xe7');_0xc6b588['dropreason']=_0x82bb('0xe8');_0xc6b588['countabandonedretry']+=0x1;_0xc6b588[_0x82bb('0xd7')]+=0x1;_0x2ecd3b=this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xe9')];_0x56fa62=this[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xd9')];hopperUtils[_0x82bb('0xda')](_0xc6b588,_0xc6b588['state'],_0x477653[_0x82bb('0xea')])[_0x82bb('0x3a')](function(_0x2515d8){if(_0xc6b588[_0x82bb('0xeb')]>=_0x59ebfc[_0x82bb('0x1c')][_0x4c8e5d[_0x82bb('0xc0')]][_0x82bb('0xec')]){_0x59ebfc[_0x82bb('0xdc')](_0xc6b588,_0x2515d8['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0xc6b588[_0x82bb('0xeb')],'scheduledat':moment()['add'](_0x59ebfc[_0x82bb('0x1c')][_0x4c8e5d['queue']][_0x82bb('0xe9')],'minutes')['format'](_0x82bb('0xc4')),'ContactId':_0x477653[_0x82bb('0xed')],'ListId':_0x477653['ListId'],'VoiceQueueId':_0x477653[_0x82bb('0xe0')]||undefined,'CampaignId':_0x477653['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x3e2cca=new History(_0xc6b588);_0x3e2cca[_0x82bb('0x6c')]=0xb;_0x3e2cca['statedesc']=_0x82bb('0xe7');_0x3e2cca[_0x82bb('0x6f')]=moment()[_0x82bb('0x3f')](_0x82bb('0xc4'));_0x3e2cca[_0x82bb('0x6e')]=_0x3e2cca['starttime'];_0x3e2cca[_0x82bb('0xe2')]=_0xc6b588[_0x82bb('0xe2')];_0x3e2cca['calleridnum']=_0xc6b588[_0x82bb('0xe3')];hopperUtils[_0x82bb('0xe4')](_0x3e2cca)['catch'](loggerCatch(_0x82bb('0xee')));}})[_0x82bb('0x3a')](function(){if(_0x291462)hopperUtils['swapAdditionalPhones'](_0xc6b588,_0x2ecd3b,_0x56fa62)['then'](function(){return 0x1;});});}}}};Dialer[_0x82bb('0x85')][_0x82bb('0xef')]=function(_0xf17e77){if(this[_0x82bb('0x22')][_0xf17e77[_0x82bb('0xc1')]]){this[_0x82bb('0x22')][_0xf17e77[_0x82bb('0xc1')]][_0x82bb('0xf0')]=_0xf17e77[_0x82bb('0xf0')];}if(this[_0x82bb('0x24')][_0xf17e77[_0x82bb('0xc1')]]){this[_0x82bb('0x24')][_0xf17e77['uniqueid']][_0x82bb('0xf0')]=_0xf17e77['channel'];}};Dialer[_0x82bb('0x85')][_0x82bb('0xf1')]=function(_0x2c79aa){if(!this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]]){return;}var _0x5169c0=this[_0x82bb('0x1c')][this[_0x82bb('0x22')][_0x2c79aa['actionid']][_0x82bb('0xc0')]][_0x82bb('0xf3')]||'rrmemory';if(_0x5169c0===_0x82bb('0xf4')){if(this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]]&&_[_0x82bb('0xf5')](this[_0x82bb('0x22')][_0x2c79aa['actionid']][_0x82bb('0xf6')])&&_0x2c79aa[_0x82bb('0x88')]==='1'&&_0x2c79aa[_0x82bb('0xf7')]==='0'){if(this['agents'][_0x2c79aa['stateinterface']]){if(!this[_0x82bb('0x1e')][_0x2c79aa[_0x82bb('0xf8')]][_0x82bb('0xf6')]){this['agents'][_0x2c79aa['stateinterface']]['locked']=!![];this['actions'][_0x2c79aa[_0x82bb('0xf2')]]['locked']=!![];this[_0x82bb('0x22')][_0x2c79aa['actionid']][_0x82bb('0xf8')]=_0x2c79aa[_0x82bb('0xf8')];}}}}else if(_0x5169c0==='rrmemory'){if(this['actions'][_0x2c79aa['actionid']]){if(this['agents'][_0x2c79aa[_0x82bb('0xf8')]]){this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]]['stateinterface']=_0x2c79aa[_0x82bb('0xf8')];if(_['isNil'](this[_0x82bb('0x27')][this[_0x82bb('0x22')][_0x2c79aa['actionid']][_0x82bb('0xc0')]])){this[_0x82bb('0x27')][this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]][_0x82bb('0xc0')]]=[];}this[_0x82bb('0x27')][this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]][_0x82bb('0xc0')]][_0x82bb('0x9d')](_[_0x82bb('0x5a')](_[_0x82bb('0x72')](this[_0x82bb('0x22')][_0x2c79aa[_0x82bb('0xf2')]],[_0x82bb('0xf9'),'stateinterface']),{'status':_0x2c79aa[_0x82bb('0x88')],'paused':_0x2c79aa[_0x82bb('0xf7')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x47fb19){if(!this[_0x82bb('0x22')][_0x47fb19['actionid']]){return;}var _0x12ffac=this;var _0x181438=this['voiceQueues'][this['actions'][_0x47fb19['actionid']][_0x82bb('0xc0')]];var _0x3a3e88=_0x181438['strategy']||_0x82bb('0xfa');if(_0x3a3e88===_0x82bb('0xf4')){if(this['actions'][_0x47fb19[_0x82bb('0xf2')]]&&this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xf8')]){this['preview']['run'](this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]]['idHopper'],this[_0x82bb('0x22')][_0x47fb19['actionid']][_0x82bb('0xf8')])[_0x82bb('0xa4')](function(_0x3af837){logger[_0x82bb('0x60')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x82bb('0x63')](_0x3af837,{'showHidden':![],'depth':null}));})[_0x82bb('0x19')](function(){_0x12ffac[_0x82bb('0xcd')](_0x12ffac['voiceQueues'][_0x12ffac[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]);_0x12ffac[_0x82bb('0x1e')][_0x12ffac[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xf8')]]['locked']=![];delete _0x12ffac[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]];unlockQueueStatus(_0x181438);});}else{this['updateOriginated'](this[_0x82bb('0x1c')][this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xed')],'ListId':this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]]['ListId'],'VoiceQueueId':this[_0x82bb('0x22')][_0x47fb19['actionid']][_0x82bb('0xe0')]||undefined,'CampaignId':this[_0x82bb('0x22')][_0x47fb19['actionid']]['CampaignId']||undefined})['catch'](loggerCatch(_0x82bb('0xfb')));delete this[_0x82bb('0x22')][_0x47fb19['actionid']];unlockQueueStatus(_0x181438);}}else if(_0x3a3e88===_0x82bb('0xfa')){var _0x52b754;if(this['actions'][_0x47fb19[_0x82bb('0xf2')]]&&!_[_0x82bb('0x43')](this[_0x82bb('0x27')][this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]]['queue']])){if(this[_0x82bb('0xfc')][_0x12ffac[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]){this[_0x82bb('0xfc')][_0x12ffac[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]=this['queueBookedRR'][this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]?this['queueBookedRR'][this['actions'][_0x47fb19['actionid']]['queue']]:this[_0x82bb('0x27')][this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]]?this[_0x82bb('0x27')][this['actions'][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]][_0x82bb('0xfd')]||0x0:0x0;}this[_0x82bb('0x27')][this['actions'][_0x47fb19[_0x82bb('0xf2')]][_0x82bb('0xc0')]][_0x82bb('0xfd')]=this[_0x82bb('0xfc')][this[_0x82bb('0x22')][_0x47fb19[_0x82bb('0xf2')]]['queue']];for(var _0x5a12b4=0x0;_0x5a12b4=_0x297c69[_0x82bb('0x125')]){_0x135cc1[_0x82bb('0x126')](_0x4ba875,_0x7e270b,_0x27d683,'reason19\x20machine....');}else{if(_0x4ba875[_0x82bb('0x123')]>=_0x297c69[_0x82bb('0x127')]){_0x135cc1[_0x82bb('0x128')](_0x4ba875,_0x7e270b,_0x27d683,_0x82bb('0x129'));}else{hopperUtils[_0x82bb('0xdd')]({'active':![],'countmachineretry':_0x4ba875[_0x82bb('0x123')],'scheduledat':moment()[_0x82bb('0x12a')](_0x297c69['dialMachineRetryFrequency'],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x4ba875[_0x82bb('0xed')],'ListId':_0x4ba875[_0x82bb('0xdf')],'VoiceQueueId':_0x4ba875[_0x82bb('0xe0')]||undefined,'CampaignId':_0x4ba875[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x12b')));_0x7e270b({'reschedule':0x1});}}});}if(_0x3ab93e[_0x82bb('0xc2')]===_0x82bb('0xc3')&&this[_0x82bb('0x1d')][_0x3ab93e[_0x82bb('0xc0')]][_0x82bb('0x11d')]&&_0x58883e[_0x82bb('0x111')]===_0x82bb('0x112')){delete this['uniqueId'][_0x58883e['uniqueid']];this[_0x82bb('0xcd')](this[_0x82bb('0x1d')][_0x3ab93e['queue']]);_0x345d43=new Hangup(_0x3ab93e,_0x58883e);_0x345d43[_0x82bb('0x6c')]=0x12;_0x345d43[_0x82bb('0x6d')]=_0x82bb('0x115');_0x345d43[_0x82bb('0x116')]=_0x82bb('0x117');ami[_0x82bb('0x3d')]('custom:amd',ut['buildObj'](_0x345d43,_0x82bb('0x11f')));this[_0x82bb('0x11a')](_0x345d43,_0x82bb('0x12c'),_0x82bb('0x12d'));}if(_0x3ab93e['type']===_0x82bb('0xc3')&&this[_0x82bb('0x1d')][_0x3ab93e[_0x82bb('0xc0')]][_0x82bb('0x11d')]&&_0x58883e[_0x82bb('0x111')]===_0x82bb('0x12e')){return new Promise(function(_0x4aa24a,_0x2d4150){delete _0x135cc1[_0x82bb('0x24')][_0x58883e['uniqueid']];_0x135cc1['updateOriginated'](_0x135cc1[_0x82bb('0x1d')][_0x3ab93e[_0x82bb('0xc0')]]);_0x135cc1[_0x82bb('0x1d')][_0x3ab93e['queue']][_0x82bb('0x113')]+=0x1;_0x135cc1[_0x82bb('0x1d')][_0x3ab93e[_0x82bb('0xc0')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x343f99=_0x135cc1[_0x82bb('0x1d')][_0x3ab93e[_0x82bb('0xc0')]];var _0x256d7d=new Hangup(_0x3ab93e,_0x58883e);_0x256d7d[_0x82bb('0x6c')]=0x13;_0x256d7d[_0x82bb('0x6d')]=_0x82bb('0x11e');_0x256d7d[_0x82bb('0x116')]=_0x82bb('0x117');_0x256d7d[_0x82bb('0x123')]+=0x1;_0x256d7d['countglobal']+=0x1;_0x256d7d[_0x82bb('0x11f')]=!![];ami[_0x82bb('0x3d')]('custom:amd',ut[_0x82bb('0x119')](_0x256d7d,'amd'));hopperUtils['createHistory'](_0x256d7d)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x12f')));if(_0x256d7d[_0x82bb('0x120')]+_0x256d7d[_0x82bb('0x121')]+_0x256d7d[_0x82bb('0x130')]+_0x256d7d[_0x82bb('0x122')]+_0x256d7d[_0x82bb('0xd6')]+_0x256d7d[_0x82bb('0xeb')]+_0x256d7d[_0x82bb('0x123')]+_0x256d7d[_0x82bb('0x124')]>=_0x343f99[_0x82bb('0x125')]){_0x135cc1['stateGlobal'](_0x256d7d,_0x4aa24a,_0x2d4150,_0x82bb('0x131'));}else{if(_0x256d7d[_0x82bb('0x123')]>=_0x343f99[_0x82bb('0x127')]){_0x135cc1[_0x82bb('0x128')](_0x256d7d,_0x4aa24a,_0x2d4150,_0x82bb('0x129'));}else{hopperUtils[_0x82bb('0xdd')]({'active':![],'countmachineretry':_0x256d7d[_0x82bb('0x123')],'scheduledat':moment()[_0x82bb('0x12a')](_0x343f99['dialMachineRetryFrequency'],_0x82bb('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x256d7d[_0x82bb('0xed')],'ListId':_0x256d7d[_0x82bb('0xdf')],'VoiceQueueId':_0x256d7d[_0x82bb('0xe0')]||undefined,'CampaignId':_0x256d7d[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x12b')));_0x4aa24a({'reschedule':0x1});}}});}}};Dialer[_0x82bb('0x85')]['syncHangup']=function(_0x2df3ed){var _0x46a2b2=this[_0x82bb('0x24')][_0x2df3ed[_0x82bb('0xc1')]];var _0x299c8a;if(_0x46a2b2&&_0x46a2b2[_0x82bb('0xc2')]===_0x82bb('0xc3')){delete this[_0x82bb('0x24')][_0x2df3ed[_0x82bb('0xc1')]];this[_0x82bb('0xcd')](this['campaigns'][_0x46a2b2[_0x82bb('0xc0')]]);this[_0x82bb('0x1d')][_0x46a2b2[_0x82bb('0xc0')]][_0x82bb('0x132')]+=0x1;_0x299c8a=new Hangup(_0x46a2b2,_0x2df3ed);hopperUtils[_0x82bb('0xe4')](_0x299c8a)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x133')));hopperUtils[_0x82bb('0x134')](_0x299c8a)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x135')));}if(_0x46a2b2&&_0x46a2b2[_0x82bb('0xc2')]!==_0x82bb('0xc3')&&isNotNull(this['voiceQueues'][_0x46a2b2[_0x82bb('0xc0')]]['dialQueueProject'])){delete this['uniqueId'][_0x2df3ed[_0x82bb('0xc1')]];this['updateOriginated'](this[_0x82bb('0x1c')][_0x46a2b2[_0x82bb('0xc0')]]);this[_0x82bb('0x1c')][_0x46a2b2[_0x82bb('0xc0')]]['outboundAnswerCallsDay']+=0x1;this[_0x82bb('0x1c')][_0x46a2b2[_0x82bb('0xc0')]][_0x82bb('0x114')]+=0x1;_0x299c8a=new Hangup(_0x46a2b2,_0x2df3ed);_0x299c8a[_0x82bb('0x6c')]=0x10;_0x299c8a[_0x82bb('0x6d')]=_0x82bb('0x136');_0x299c8a[_0x82bb('0x116')]=_0x82bb('0x137');hopperUtils[_0x82bb('0xe4')](_0x299c8a)['catch'](loggerCatch(_0x82bb('0x133')));hopperUtils[_0x82bb('0x134')](_0x299c8a)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x135')));}if(_0x46a2b2&&_0x46a2b2[_0x82bb('0xc2')]!==_0x82bb('0xc3')&&!isNotNull(this['voiceQueues'][_0x46a2b2[_0x82bb('0xc0')]]['dialQueueProject'])){delete this[_0x82bb('0x24')][_0x2df3ed[_0x82bb('0xc1')]];this[_0x82bb('0xcd')](this[_0x82bb('0x1c')][_0x46a2b2['queue']]);this['voiceQueues'][_0x46a2b2['queue']][_0x82bb('0x138')]+=0x1;_0x299c8a=new Hangup(_0x46a2b2,_0x2df3ed);_0x299c8a[_0x82bb('0x6c')]=0xc;_0x299c8a['statedesc']=_0x2df3ed[_0x82bb('0x139')];_0x299c8a[_0x82bb('0x116')]=_0x82bb('0x13a');hopperUtils[_0x82bb('0xe4')](_0x299c8a)[_0x82bb('0xa4')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x82bb('0x134')](_0x299c8a)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x82bb('0x85')][_0x82bb('0x7')]=function(_0x586ec1){var _0x48bed9=this;if(!_0x48bed9[_0x82bb('0x28')][_0x586ec1['name']]){_0x48bed9['queuesSummary'][_0x586ec1[_0x82bb('0x41')]]={'running':![]};}else if(_0x48bed9[_0x82bb('0x28')][_0x586ec1[_0x82bb('0x41')]]['running']===!![]){return;}else if(_0x48bed9['queuesSummary'][_0x586ec1[_0x82bb('0x41')]]['running']===![]){_0x48bed9[_0x82bb('0x28')][_0x586ec1[_0x82bb('0x41')]][_0x82bb('0x13b')]=!![];}var _0xa41dee=_0x48bed9[_0x82bb('0x1c')][_0x586ec1[_0x82bb('0x41')]];var _0x58f206=_0xa41dee['message']!==utils[_0x82bb('0x65')][_0x82bb('0x78')];var _0x13d970=utils[_0x82bb('0x13c')](_0xa41dee);_0xa41dee[_0x82bb('0x13d')]=utils[_0x82bb('0x13e')](_0xa41dee,_0x48bed9['trunks']);Promise['resolve']()['then'](function(){if(_0xa41dee['statusMessage']===utils[_0x82bb('0x65')][_0x82bb('0x78')]){if(_0x58f206){clearPredictiveAttributes(_0xa41dee);_0x586ec1[_0x82bb('0x5d')]=undefined;_0x586ec1[_0x82bb('0x26')]=undefined;}if(_0xa41dee['statusMessage']===utils['CAMPAIGN_STATUS'][_0x82bb('0x78')]){_0x586ec1[_0x82bb('0x13f')]=0x0;_0x586ec1[_0x82bb('0xf7')]=0x0;_0x586ec1[_0x82bb('0x140')]=0x0;_0x586ec1[_0x82bb('0x141')]=0x0;_0x586ec1[_0x82bb('0x142')]=0x0;}}else if(_0xa41dee['statusMessage']===utils[_0x82bb('0x65')][_0x82bb('0x143')]&&!_0x13d970){return _0x48bed9[_0x82bb('0x95')](_0xa41dee,!![])['then'](function(){return _0x48bed9[_0x82bb('0x95')](_0xa41dee,![]);})[_0x82bb('0x3a')](function(){return _0x48bed9[_0x82bb('0xb0')](_0xa41dee);})[_0x82bb('0xa4')](function(_0x74b684){loggerSyncQueueSummary[_0x82bb('0x5c')]('[syncQueueSummary]',util['inspect'](_0x74b684,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xa41dee);});}else{clearPredictiveAttributes(_0xa41dee);}})['then'](function(){var _0x505586=_0x586ec1[_0x82bb('0x144')](_0xa41dee);if(_0x505586||_0xa41dee['queueSummaryCountersUpdated']){_0xa41dee[_0x82bb('0x145')]=![];_0x586ec1[_0x82bb('0x146')](_0xa41dee);Object[_0x82bb('0x147')](_0xa41dee,_0x586ec1);emitOutboundVoiceQueueSummary(_0x586ec1);}_0x48bed9[_0x82bb('0x28')][_0xa41dee['name']][_0x82bb('0x13b')]=![];})[_0x82bb('0xa4')](function(_0x29f6a5){logger[_0x82bb('0x60')](_0x82bb('0x148'),util['inspect'](_0x29f6a5,{'showHidden':![],'depth':null}));_0x48bed9[_0x82bb('0x28')][_0xa41dee[_0x82bb('0x41')]][_0x82bb('0x13b')]=![];});};Dialer[_0x82bb('0x85')][_0x82bb('0x30')]=_[_0x82bb('0x149')](function(){var _0x2bcdff=_['filter'](this[_0x82bb('0x1c')],function(_0x11be52){return _0x11be52[_0x82bb('0x14a')];});var _0x5224d1=_[_0x82bb('0x14b')](this[_0x82bb('0x1e')],function(_0x2a6d44){return _0x2a6d44['online']&&_0x2a6d44[_0x82bb('0x88')]===_0x82bb('0x14c');});if(_0x2bcdff['length']>0x0&&_0x5224d1[_0x82bb('0x9c')]>0x0){return Promise['resolve']()[_0x82bb('0x3a')](cmHopper[_0x82bb('0x14d')](_[_0x82bb('0x14e')](_0x2bcdff,'id'),previewRecallmeReminderInterval,_[_0x82bb('0x14e')](_0x5224d1,'id')))['then'](function(_0x2a896a){for(var _0x3bed1b=0x0;_0x3bed1b<_0x2a896a[_0x82bb('0x9c')];_0x3bed1b++){var _0x371345=_0x2a896a[_0x3bed1b]['Agent'][_0x82bb('0x41')];if(_0x371345)io['to'](util[_0x82bb('0x3f')](_0x82bb('0x14f'),_0x371345))['emit'](_0x82bb('0x150'),{'hopper':_0x2a896a[_0x3bed1b]});}})['catch'](function(_0x3b6054){logger[_0x82bb('0x60')]('checkPreviewRecallReminder',_0x3b6054);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x82bb('0x85')]['loopClearZombieChannels']=function(){var _0x389c4e=this;setInterval(function(){_0x389c4e[_0x82bb('0x151')](_0x389c4e[_0x82bb('0x24')],_0x82bb('0x152'));_0x389c4e[_0x82bb('0x151')](_0x389c4e['actions'],_0x82bb('0x153'));},0x32c8);};Dialer[_0x82bb('0x85')][_0x82bb('0x151')]=function(_0x310860,_0x1a9ea6){var _0x78e470=this;for(var _0x3eb46c in _0x310860){if(typeof _0x310860[_0x3eb46c]!==_0x82bb('0xab')){this[_0x82bb('0x1a')][_0x82bb('0x17')](function(){if(!_[_0x82bb('0xf5')](_0x310860[_0x3eb46c])){return ami[_0x82bb('0x9e')]({'action':_0x82bb('0x88'),'channel':_0x310860[_0x3eb46c]['channel']})[_0x82bb('0xa4')](function(_0x5f5cc9){if(_0x5f5cc9[_0x82bb('0x69')]===_0x82bb('0x154')){setTimeout(function(){if(_0x310860[_0x3eb46c]&&_0x310860[_0x3eb46c][_0x82bb('0xc2')]!=='ivr'){_0x78e470[_0x82bb('0xcd')](_0x78e470['voiceQueues'][_0x310860[_0x3eb46c][_0x82bb('0xc0')]]);logger[_0x82bb('0x60')]('[Dialer][checkChannel]',_0x1a9ea6,_0x3eb46c,_0x310860[_0x3eb46c][_0x82bb('0xc0')]);delete _0x310860[_0x3eb46c];}if(_0x310860[_0x3eb46c]&&_0x310860[_0x3eb46c][_0x82bb('0xc2')]==='ivr'){_0x78e470[_0x82bb('0xcd')](_0x78e470[_0x82bb('0x1d')][_0x310860[_0x3eb46c][_0x82bb('0xc0')]]);logger[_0x82bb('0x60')](_0x82bb('0x155'),_0x1a9ea6,_0x3eb46c,_0x310860[_0x3eb46c][_0x82bb('0xc0')]);delete _0x310860[_0x3eb46c];}},0x2328);}});}});}}};Dialer[_0x82bb('0x85')][_0x82bb('0x156')]=function(_0x441efb){return Promise['resolve']()['then'](voiceQueueRt[_0x82bb('0x156')](_0x441efb))['catch'](loggerCatch(_0x82bb('0x157')));};Dialer[_0x82bb('0x85')][_0x82bb('0xcd')]=function(_0x492ed5){if(!_[_0x82bb('0x3c')](_0x492ed5)&&_0x492ed5!==null){if(typeof _0x492ed5[_0x82bb('0x7e')]!==_0x82bb('0xab')){if(_0x492ed5[_0x82bb('0x7e')]>0x0){_0x492ed5[_0x82bb('0x7e')]-=0x1;}else{logger[_0x82bb('0x60')](_0x82bb('0x158'));}}}else{logger[_0x82bb('0x60')](_0x82bb('0x159'));}};Dialer['prototype'][_0x82bb('0x15a')]=function(_0x1e2844,_0x7d93e4){var _0x3419fe=this;return function(_0x75d628){_0x3419fe[_0x82bb('0xcd')](_0x7d93e4);logger['error'](_0x1e2844,util[_0x82bb('0x63')](_0x75d628,{'showHidden':![],'depth':null}));};};Dialer[_0x82bb('0x85')]['emptyContact']=function(_0x2d24af,_0x1291d8,_0x4d2b68){var _0x428b6e={'state':0x19,'statedesc':_0x82bb('0x15b')};this[_0x82bb('0xcd')](_0x1291d8);this[_0x82bb('0x11a')](_['merge'](_0x428b6e,_['pick'](_0x4d2b68,['ContactId',_0x82bb('0xdf'),_0x82bb('0x15c'),_0x82bb('0xe0'),_0x82bb('0xe1')])),_0x82bb('0x15d'),_0x82bb('0x15e'));logger['error'](_0x2d24af);};Dialer[_0x82bb('0x85')]['saveInDb']=function(_0x29332f,_0x320cb5,_0x16f799){hopperUtils['createHistory'](_0x29332f)[_0x82bb('0xa4')](loggerCatch(_0x320cb5));hopperUtils[_0x82bb('0x134')](_0x29332f)[_0x82bb('0xa4')](loggerCatch(_0x16f799));};Dialer[_0x82bb('0x85')][_0x82bb('0xdc')]=function(_0x1d1823,_0x54c1e6){hopperUtils['createHistory'](_0x1d1823)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x15f')));if(_0x54c1e6==0x0){hopperUtils['moveContactManagedDialer'](_0x1d1823)[_0x82bb('0xa4')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x13909c){return Promise['resolve']()[_0x82bb('0x3a')](cmHopper[_0x82bb('0x14d')](_0x13909c['id'],previewRecallmeReminderInterval))[_0x82bb('0x3a')](function(_0x3c2a96){for(var _0x972fe=0x0;_0x972fe<_0x3c2a96[_0x82bb('0x9c')];_0x972fe++){var _0x534c0a=_0x3c2a96[_0x972fe][_0x82bb('0x160')][_0x82bb('0x41')];if(_0x534c0a)io['to'](util['format'](_0x82bb('0x14f'),_0x534c0a))[_0x82bb('0x3d')]('user:dialPreviewRecallReminder',{'hopper':_0x3c2a96[_0x972fe]});}})[_0x82bb('0xa4')](function(){});};Dialer[_0x82bb('0x85')][_0x82bb('0xaf')]=function(_0x2bbfa2){var _0x169740=this;return function(){_0x169740[_0x82bb('0x161')](_0x2bbfa2);};};Dialer['prototype'][_0x82bb('0x162')]=function(_0x168ec8,_0x21eae8){var _0x3c304c=this;var _0x2656a0=uuid['v4']();this['actions'][_0x2656a0]=new Action(_0x168ec8,_0x21eae8,_0x2656a0);return new Promise(function(_0x43f50b,_0x3558fa){if(_[_0x82bb('0x3c')](_0x168ec8)&&typeof _0x168ec8!=='object'){return _0x3558fa(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x21eae8['phone'])||_0x21eae8[_0x82bb('0x163')]===null){return _0x3558fa(msgResponse(_0x82bb('0x164'),_0x82bb('0x96'),_0x82bb('0x165')));}var _0x3adcd8={'XMD-CALLERID':_0x3c304c[_0x82bb('0x22')][_0x2656a0][_0x82bb('0x166')](),'XMD-AGI':_0x168ec8[_0x82bb('0x167')]?util['format'](_0x82bb('0x168'),ipAgi,_0x168ec8[_0x82bb('0x167')]):_0x82bb('0x169'),'XMD-AGIAFTER':_0x168ec8[_0x82bb('0xc9')]?util['format'](_0x82bb('0x168'),ipAgi,_0x168ec8[_0x82bb('0xc9')]):_0x82bb('0x169'),'XMD-QUEUE':utils[_0x82bb('0x16a')](_0x168ec8)?util['format']('\x22%s,%s%s,,,%s\x22',_0x168ec8[_0x82bb('0x41')],_0x168ec8[_0x82bb('0x16b')]||'',_0x168ec8['dialAgiAfterHangupAgent']?'c':'',_0x168ec8['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x21eae8[_0x82bb('0xed')],'XMD-CDRTYPE':_0x82bb('0x5'),'CALLERID(all)':_0x3c304c['actions'][_0x2656a0][_0x82bb('0x166')](),'XMD-AMD':_0x168ec8[_0x82bb('0x11d')]?'ACTIVE':_0x82bb('0x169'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x168ec8[_0x82bb('0x11d')]){_0x3adcd8['XMD-AMDINITIALSILENCE']=_0x168ec8[_0x82bb('0x16c')]||0x9c4;_0x3adcd8[_0x82bb('0x16d')]=_0x168ec8[_0x82bb('0x16e')]||0x5dc;_0x3adcd8[_0x82bb('0x16f')]=_0x168ec8[_0x82bb('0x170')]||0x320;_0x3adcd8['XMD-AMDTOTALANALYSISTIME']=_0x168ec8[_0x82bb('0x171')]||0x1388;_0x3adcd8[_0x82bb('0x172')]=_0x168ec8['dialAMDMinWordLength']||0x64;_0x3adcd8['XMD-AMDBETWEENWORDSSILENCE']=_0x168ec8[_0x82bb('0x173')]||0x32;_0x3adcd8[_0x82bb('0x174')]=_0x168ec8[_0x82bb('0x175')]||0x3;_0x3adcd8[_0x82bb('0x176')]=_0x168ec8['dialAMDSilenceThreshold']||0x100;_0x3adcd8[_0x82bb('0x177')]=_0x168ec8[_0x82bb('0x178')]||0x1388;}if(utils[_0x82bb('0x16a')](_0x168ec8)){_0x3adcd8[_0x82bb('0x179')]=_0x21eae8[_0x82bb('0xe0')];}else{_0x3adcd8[_0x82bb('0x17a')]=_0x21eae8[_0x82bb('0xe1')];}var _0x416a97=utils['setXMDContactVariables'](_0x21eae8[_0x82bb('0x17b')]);Object[_0x82bb('0x147')](_0x3adcd8,_0x416a97);var _0x374e7b=_0x3c304c['isTrunkReachable'](_0x168ec8[_0x82bb('0x8b')])?utils['getCallerId'](_0x168ec8[_0x82bb('0x8b')][_0x82bb('0x17c')],_0x168ec8[_0x82bb('0x17d')],_0x168ec8[_0x82bb('0x17e')]>0x0?utils['getCallerIdRandom'](_0x168ec8[_0x82bb('0x17f')],_0x168ec8[_0x82bb('0x17e')]):_0x168ec8[_0x82bb('0x17f')]):utils[_0x82bb('0x180')](_[_0x82bb('0xf5')](_0x168ec8[_0x82bb('0x8d')])?_0x168ec8[_0x82bb('0x8b')]['callerid']:_0x168ec8[_0x82bb('0x8d')][_0x82bb('0x17c')],_0x168ec8[_0x82bb('0x17d')],_0x168ec8[_0x82bb('0x17e')]>0x0?utils[_0x82bb('0x181')](_0x168ec8['dialOriginateCallerIdNumber'],_0x168ec8[_0x82bb('0x17e')]):_0x168ec8[_0x82bb('0x17f')]);if(_0x374e7b){_0x3adcd8[_0x82bb('0x182')]=_0x3c304c[_0x82bb('0x22')][_0x2656a0][_0x82bb('0x183')]=utils['extractCalleridName'](_0x374e7b);_0x3adcd8[_0x82bb('0x184')]=_0x21eae8['phone'];}_0x168ec8[_0x82bb('0x185')]=_0x3adcd8;return ami['Action']({'actionid':_0x2656a0,'action':'originate','channel':_0x3c304c[_0x82bb('0x8c')](_0x168ec8['Trunk'])?util[_0x82bb('0x3f')]('SIP/%s/%s%s',_0x168ec8[_0x82bb('0x8b')]['name'],isNotNull(_0x168ec8[_0x82bb('0x186')])?_0x168ec8[_0x82bb('0x186')][_0x82bb('0x187')]()||'':'',_0x168ec8[_0x82bb('0x188')]>0x0?_0x21eae8['phone'][_0x82bb('0x189')](_0x168ec8[_0x82bb('0x188')]):_0x21eae8[_0x82bb('0x163')]):util[_0x82bb('0x3f')](_0x82bb('0x18a'),_['isNil'](_0x168ec8['TrunkBackup'])?_0x168ec8['Trunk'][_0x82bb('0x41')]:_0x168ec8[_0x82bb('0x8d')][_0x82bb('0x41')],isNotNull(_0x168ec8[_0x82bb('0x186')])?_0x168ec8[_0x82bb('0x186')][_0x82bb('0x187')]()||'':'',_0x168ec8[_0x82bb('0x188')]>0x0?_0x21eae8[_0x82bb('0x163')][_0x82bb('0x189')](_0x168ec8[_0x82bb('0x188')]):_0x21eae8[_0x82bb('0x163')]),'callerid':_0x374e7b,'Exten':_0x82bb('0x110'),'Context':'from-sip','Priority':'1','variable':_0x3adcd8,'timeout':(_0x168ec8[_0x82bb('0x18b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2656a0})[_0x82bb('0x3a')](function(_0x2230c5){return _0x43f50b(_0x2230c5);})['catch'](function(_0x531a72){_0x168ec8[_0x82bb('0x18c')]+=0x1;var _0x313819=new History(_0x3c304c['actions'][_0x2656a0]);logger[_0x82bb('0x60')](util[_0x82bb('0x3f')](_0x82bb('0x18d'),JSON[_0x82bb('0x101')](_0x531a72)));_0x313819[_0x82bb('0x6c')]=0xe;_0x313819[_0x82bb('0x6d')]=_0x82bb('0x18e');_0x313819[_0x82bb('0x6f')]=moment()[_0x82bb('0x3f')](_0x82bb('0xc4'));_0x313819[_0x82bb('0x6e')]=_0x313819[_0x82bb('0x6f')];hopperUtils[_0x82bb('0xe4')](_0x313819)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x18f')));_0x3c304c[_0x82bb('0x134')](_0x313819)['catch'](loggerCatch(_0x82bb('0x18f')))[_0x82bb('0x19')](function(){delete _0x3c304c['actions'][_0x2656a0];return _0x3558fa(msgResponse(_0x82bb('0x164'),_0x82bb('0x84'),'originate\x20action\x20Error'));});});});};Dialer[_0x82bb('0x85')]['checkRetriveMax']=function(_0x5c5393,_0x16b6d4,_0x2227c5){var _0x41d9a9=new History(_0x16b6d4);if(_0x41d9a9[_0x82bb('0x120')]+_0x41d9a9['countcongestionretry']+_0x41d9a9[_0x82bb('0x130')]+_0x41d9a9['countnosuchnumberretry']+_0x41d9a9[_0x82bb('0xd6')]+_0x41d9a9[_0x82bb('0xeb')]+_0x41d9a9[_0x82bb('0x123')]+_0x41d9a9[_0x82bb('0x124')]>=_0x2227c5['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5c5393){case 0x3:if(_0x41d9a9[_0x82bb('0x130')]>=_0x2227c5['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countnoanswerretry':_0x41d9a9[_0x82bb('0x130')]+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5['dialNoAnswerRetryFrequency'],_0x82bb('0xde'))['format'](_0x82bb('0xc4')),'ContactId':_0x41d9a9[_0x82bb('0xed')],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9['CampaignId']||undefined})['catch'](loggerCatch(_0x82bb('0x190')));break;case 0x5:if(_0x41d9a9[_0x82bb('0x120')]>=_0x2227c5[_0x82bb('0x191')]-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countbusyretry':_0x41d9a9[_0x82bb('0x120')]+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0x192')],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x41d9a9[_0x82bb('0xed')],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x193')));break;case 0x8:if(_0x41d9a9[_0x82bb('0x121')]>=_0x2227c5[_0x82bb('0x194')]-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countcongestionretry':_0x41d9a9[_0x82bb('0x121')]+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0x195')],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x41d9a9['ContactId'],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x41d9a9[_0x82bb('0x122')]>=_0x2227c5[_0x82bb('0x196')]-0x1){return!![];}else{hopperUtils[_0x82bb('0xdd')]({'active':![],'countnosuchnumberretry':_0x41d9a9['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0x197')],_0x82bb('0xde'))[_0x82bb('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x41d9a9[_0x82bb('0xed')],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x198')));}break;case 0xa:if(_0x41d9a9['countdropretry']>=_0x2227c5[_0x82bb('0x199')]-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countdropretry':_0x41d9a9['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x2227c5[_0x82bb('0xd8')],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x41d9a9['ContactId'],'ListId':_0x41d9a9['ListId'],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x19a')));break;case 0xb:if(_0x41d9a9['countabandonedretry']>=_0x2227c5[_0x82bb('0xec')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x41d9a9[_0x82bb('0xeb')]+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0xe9')],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x41d9a9[_0x82bb('0xed')],'ListId':_0x41d9a9['ListId'],'VoiceQueueId':_0x41d9a9['VoiceQueueId']||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x19b')));break;case 0x13:if(_0x41d9a9['countmachineretry']>=_0x2227c5[_0x82bb('0x127')]-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countmachineretry':_0x41d9a9[_0x82bb('0x123')]+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0x19c')],_0x82bb('0xde'))[_0x82bb('0x3f')](_0x82bb('0xc4')),'ContactId':_0x41d9a9[_0x82bb('0xed')],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x12b')));break;case 0x14:if(_0x41d9a9[_0x82bb('0x124')]>=_0x2227c5[_0x82bb('0x19d')]-0x1){return!![];}hopperUtils[_0x82bb('0xdd')]({'active':![],'countagentrejectretry':_0x41d9a9['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x82bb('0x12a')](_0x2227c5[_0x82bb('0x19e')],'minutes')[_0x82bb('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x41d9a9['ContactId'],'ListId':_0x41d9a9[_0x82bb('0xdf')],'VoiceQueueId':_0x41d9a9[_0x82bb('0xe0')]||undefined,'CampaignId':_0x41d9a9[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x19f')));break;default:return!![];}};Dialer['prototype'][_0x82bb('0x10c')]=function(_0x455cb2,_0x666745,_0x4f89a1){var _0x2c6973=this;var _0x2cebc8=new History(_0x455cb2);var _0x2a070b=![];var _0x35234e;var _0x274bf9;return new Promise(function(_0x32c790,_0x4da3ab){if(_[_0x82bb('0x3c')](_0x666745)&&typeof _0x666745!=='object'){return _0x4da3ab(msgResponse('[callProgressDetecting]',_0x82bb('0x96'),_0x82bb('0x1a0')));}if(_[_0x82bb('0x3c')](_0x4f89a1)&&typeof _0x4f89a1!==_0x82bb('0x1a1')){return _0x4da3ab(msgResponse(_0x82bb('0x1a2'),_0x82bb('0x96'),_0x82bb('0x1a3')));}hopperUtils['verifyAdditionalPhones'](_0x2cebc8,_0x4f89a1[_0x82bb('0xc6')],_0x666745)[_0x82bb('0x3a')](function(_0x59a6b3){if(_0x59a6b3[_0x82bb('0xdb')]==0x1)_0x2a070b=!![];switch(_0x4f89a1[_0x82bb('0xc6')]){case'0':_0x666745[_0x82bb('0x1a4')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0x0;_0x2cebc8[_0x82bb('0x6d')]=_0x82bb('0x1a5');_0x2cebc8['countnosuchnumberretry']+=0x1;_0x2cebc8['countglobal']+=0x1;ami[_0x82bb('0x3d')]('custom:agentnosuchnumber',ut['buildObj'](_0x455cb2,_0x82bb('0x1a6')));_0x35234e=_0x666745[_0x82bb('0x197')];_0x274bf9=_0x666745[_0x82bb('0xd9')];hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x12f')));if(_0x2c6973[_0x82bb('0x1a7')](0x0,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8[_0x82bb('0x122')]>=_0x666745[_0x82bb('0x196')]){_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1a8'));}else{_0x2c6973[_0x82bb('0x126')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1a8'));}}break;case'3':_0x666745[_0x82bb('0x1a9')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0x3;_0x2cebc8['statedesc']=_0x82bb('0x1aa');_0x2cebc8[_0x82bb('0x130')]+=0x1;_0x2cebc8['countglobal']+=0x1;var _0xdc2d37=ut['buildNoAnswerEventPayload'](_0x455cb2,_0x666745);ami[_0x82bb('0x3d')](_0x82bb('0x1ab'),_0xdc2d37);_0x35234e=_0x666745['dialNoAnswerRetryFrequency'];_0x274bf9=_0x666745[_0x82bb('0xd9')];hopperUtils['createHistory'](_0x2cebc8)['catch'](loggerCatch(_0x82bb('0x1ac')));if(_0x2c6973[_0x82bb('0x1a7')](0x3,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8[_0x82bb('0x130')]>=_0x666745[_0x82bb('0x1ad')]){_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1ae'));}else{_0x2c6973[_0x82bb('0x126')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1ae'));}}break;case'5':_0x666745[_0x82bb('0x1af')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0x5;_0x2cebc8['statedesc']='Busy';_0x2cebc8[_0x82bb('0x120')]+=0x1;_0x2cebc8[_0x82bb('0xd7')]+=0x1;ami[_0x82bb('0x3d')]('custom:agentbusy',ut[_0x82bb('0x119')](_0x455cb2,'busy'));_0x35234e=_0x666745[_0x82bb('0x192')];_0x274bf9=_0x666745[_0x82bb('0xd9')];hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2c6973['checkRetriveMax'](0x5,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8[_0x82bb('0x120')]>=_0x666745[_0x82bb('0x191')]){_0x2c6973['createStateFinal'](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b0'));}else{_0x2c6973[_0x82bb('0x126')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b0'));}}break;case'8':_0x666745[_0x82bb('0x1b1')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0x8;_0x2cebc8[_0x82bb('0x6d')]=_0x82bb('0x1b2');_0x2cebc8[_0x82bb('0x121')]+=0x1;_0x2cebc8['countglobal']+=0x1;_0x35234e=_0x666745[_0x82bb('0x195')];_0x274bf9=_0x666745[_0x82bb('0xd9')];ami[_0x82bb('0x3d')]('custom:agentcongestion',ut[_0x82bb('0x119')](_0x455cb2,_0x82bb('0x1b3')));hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x2c6973[_0x82bb('0x1a7')](0x8,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8['countcongestionretry']>=_0x666745['dialCongestionMaxRetry']){_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b4'));}else{_0x2c6973['stateGlobal'](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b4'));}}break;case'11':_0x666745[_0x82bb('0x1b5')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0xb;_0x2cebc8[_0x82bb('0x6d')]=_0x82bb('0xe7');_0x2cebc8[_0x82bb('0xeb')]+=0x1;_0x2cebc8['countglobal']+=0x1;_0x35234e=_0x666745['dialAbandonedRetryFrequency'];_0x274bf9=_0x666745[_0x82bb('0xd9')];hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2c6973[_0x82bb('0x1a7')](0xb,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8[_0x82bb('0xeb')]>=_0x666745[_0x82bb('0xec')]){_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b6'));}else{_0x2c6973[_0x82bb('0x126')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1b6'));}}break;case'20':_0x666745[_0x82bb('0x1b7')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0x14;_0x2cebc8[_0x82bb('0x6d')]=_0x82bb('0x1b8');_0x2cebc8[_0x82bb('0x124')]+=0x1;_0x2cebc8[_0x82bb('0xd7')]+=0x1;_0x35234e=_0x666745['dialAgentRejectRetryFrequency'];_0x274bf9=_0x666745[_0x82bb('0xd9')];ami[_0x82bb('0x3d')](_0x82bb('0x1b9'),ut[_0x82bb('0x119')](_0x455cb2,_0x82bb('0x1ba')));hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x1bb')));if(_0x2c6973[_0x82bb('0x1a7')](0x14,_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8[_0x82bb('0x124')]>=_0x666745[_0x82bb('0x19d')]){_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x82bb('0x1bc'));}else{_0x2c6973['stateGlobal'](_0x2cebc8,_0x32c790,_0x4da3ab,'reason\x2020\x20agentreject');}}break;default:_0x666745[_0x82bb('0x138')]+=0x1;_0x2cebc8[_0x82bb('0x6c')]=0xc;_0x2cebc8['statedesc']=_0x4f89a1[_0x82bb('0xc6')];_0x35234e=_0x666745[_0x82bb('0x19e')];_0x274bf9=_0x666745[_0x82bb('0xd9')];hopperUtils[_0x82bb('0xe4')](_0x2cebc8)[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x1bd')));if(_0x2c6973[_0x82bb('0x1a7')](_0x4f89a1[_0x82bb('0xc6')],_0x455cb2,_0x666745)&&!_0x2a070b){if(_0x2cebc8['countbusyretry']+_0x2cebc8[_0x82bb('0x121')]+_0x2cebc8[_0x82bb('0x130')]+_0x2cebc8[_0x82bb('0x122')]+_0x2cebc8['countdropretry']+_0x2cebc8[_0x82bb('0xeb')]+_0x2cebc8[_0x82bb('0x123')]+_0x2cebc8[_0x82bb('0x124')]>=_0x666745['dialGlobalMaxRetry']){_0x2c6973['stateGlobal'](_0x2cebc8,_0x32c790,_0x4da3ab,_0x4f89a1['reason']);}else{_0x2c6973[_0x82bb('0x128')](_0x2cebc8,_0x32c790,_0x4da3ab,_0x4f89a1[_0x82bb('0xc6')]);}}}})[_0x82bb('0x3a')](function(){if(_0x2a070b){hopperUtils['swapAdditionalPhones'](_0x2cebc8,_0x35234e,_0x274bf9)[_0x82bb('0x3a')](function(){return _0x32c790(0x1);});}});});};Dialer[_0x82bb('0x85')][_0x82bb('0x126')]=function(_0x282d77,_0x2b740a,_0x795a0b,_0x5005f1){var _0x193f3e=new Final(_0x282d77);_0x193f3e[_0x82bb('0x6c')]=0xf;_0x193f3e[_0x82bb('0x6d')]='Global';this['createStateFinal'](_0x193f3e,_0x2b740a,_0x795a0b,_0x5005f1);};Dialer[_0x82bb('0x85')][_0x82bb('0x128')]=function(_0x353658,_0x4e723a,_0x30b9b2,_0x583427){hopperUtils[_0x82bb('0x134')](_0x353658)['then'](function(){return _0x4e723a(msgResponse(_0x82bb('0x1a2'),_0x82bb('0x10b'),_0x583427));})[_0x82bb('0xa4')](function(){return _0x30b9b2(msgResponse(_0x82bb('0x1be'),_0x82bb('0x96'),_0x82bb('0x1bf')));});};Dialer[_0x82bb('0x85')][_0x82bb('0xb1')]=function(_0x131444){var _0x521db2=_0x131444[_0x82bb('0x1c0')]/0x64;var _0x5d6468=_0x131444[_0x82bb('0xd1')]/(_0x131444[_0x82bb('0xd1')]+_0x131444[_0x82bb('0x113')]);var _0x1f77b9=Math[_0x82bb('0x1c1')](_0x131444[_0x82bb('0x1c2')]*(_0x131444[_0x82bb('0x1c3')]/0x64));var _0x5c2c31=Math['round'](_0x131444['predictiveIntervalAvailable']*(_0x131444['predictiveIntervalMinThreshold']/0x64));var _0x3daadc=_0x131444[_0x82bb('0x13f')]+_0x131444[_0x82bb('0x141')];var _0x266d8b=Math[_0x82bb('0x1c4')](_0x131444[_0x82bb('0x54')]*_0x131444['erlangAbandonmentRate']*_0x131444[_0x82bb('0x1c5')]*_0x131444[_0x82bb('0x1c6')]);if(_[_0x82bb('0x3c')](_0x131444['startProgressive'])){if(!_['isUndefined'](_0x131444[_0x82bb('0x5d')])){_0x131444[_0x82bb('0x5d')]=undefined;loggerPredictive['error'](_0x82bb('0x1c7'),_0x82bb('0x1c8'));}if(!_[_0x82bb('0x3c')](_0x131444[_0x82bb('0x5f')])){loggerPredictive[_0x82bb('0x60')](_0x82bb('0x1c7'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x131444[_0x82bb('0x5f')]);_0x131444[_0x82bb('0x5f')]=undefined;}_0x131444[_0x82bb('0x26')]=moment()['format'](_0x82bb('0xc4'));loggerPredictive[_0x82bb('0x44')](_0x131444[_0x82bb('0x41')],_0x82bb('0x1c9'),_0x131444['startProgressive']);this[_0x82bb('0xb4')](_0x131444,0x1);}else if(ifInterval(_0x131444[_0x82bb('0x1ca')],_0x131444[_0x82bb('0x26')])){this[_0x82bb('0xb4')](_0x131444,0x1);loggerPredictiveCalls[_0x82bb('0x44')](_0x82bb('0x1cb'),_0x131444[_0x82bb('0x26')],_0x131444[_0x82bb('0x41')]);_0x131444[_0x82bb('0x54')]=0x0;_0x131444[_0x82bb('0xd2')]=0x0;}else if(_0x521db2<_0x5d6468&&_0x131444['dialPredictiveOptimization']===_0x82bb('0x1cc')){clearPredictiveAttributes(_0x131444);loggerPredictive['info'](_0x82bb('0x1cd'),_0x82bb('0x1ce'),_0x5d6468,_0x82bb('0x26'),_0x131444[_0x82bb('0x41')]);}else if(_0x266d8b<_0x131444[_0x82bb('0xd2')]&&_0x131444[_0x82bb('0x1cf')]==='dropRate'){clearPredictiveAttributes(_0x131444);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x1d0'),_0x82bb('0x1d1'),_0x266d8b,_0x82bb('0x1d2'),_0x131444['predictiveIntervalErlangCallsDroppedCalls'],_0x82bb('0x26'),_0x131444[_0x82bb('0x41')]);}else if(!ifInterval(_0x131444[_0x82bb('0x1ca')],_0x131444[_0x82bb('0x26')])&&_[_0x82bb('0x3c')](_0x131444[_0x82bb('0x5d')])&&!_[_0x82bb('0x3c')](_0x131444[_0x82bb('0x26')])){_0x131444[_0x82bb('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x82bb('0x44')](_0x131444[_0x82bb('0x41')],_0x82bb('0x1d3'),_0x131444[_0x82bb('0x5d')]);hopperUtils['avgHandleTime'](_0x131444[_0x82bb('0x1ca')])[_0x82bb('0x3a')](this['getDataPredictive'](_0x131444))[_0x82bb('0x3a')](mergeDataErlangB(_0x131444))['then'](this['startMethodPredictive'](_0x131444))['catch'](loggerCatchPredictive(_0x82bb('0x1d4'),_0x131444));}else if(!ifInterval(_0x131444[_0x82bb('0x1ca')],_0x131444[_0x82bb('0x5d')])){_0x131444[_0x82bb('0xd2')]=0x0;_0x131444[_0x82bb('0x5d')]=moment()[_0x82bb('0x3f')](_0x82bb('0xc4'));loggerPredictive[_0x82bb('0x44')](_0x131444['name'],_0x82bb('0x1d5'),_0x131444[_0x82bb('0x5d')]);clearInterval(_0x131444['handlePredictive']);_0x131444[_0x82bb('0x5f')]=undefined;hopperUtils['avgHandleTime'](_0x131444[_0x82bb('0x1ca')])[_0x82bb('0x3a')](this[_0x82bb('0x1d6')](_0x131444))['then'](mergeDataErlangB(_0x131444))['then'](this[_0x82bb('0x1d7')](_0x131444))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x131444));}else if(_0x131444[_0x82bb('0x1c2')]&&_0x3daadc<_0x131444[_0x82bb('0x1c2')]-_0x5c2c31){clearPredictiveAttributes(_0x131444);loggerPredictive[_0x82bb('0x44')](_0x131444[_0x82bb('0x41')],_0x82bb('0x1d8'),_0x3daadc,')\x20are\x20less\x20than\x20threshold\x20(',_0x131444[_0x82bb('0x1c2')],'-',_0x5c2c31,'=',_0x131444['predictiveIntervalAvailable']-_0x5c2c31,')');}else if(_0x131444['predictiveIntervalAvailable']&&_0x3daadc>_0x131444[_0x82bb('0x1c2')]+_0x1f77b9){clearPredictiveAttributes(_0x131444);loggerPredictive['info'](_0x131444[_0x82bb('0x41')],_0x82bb('0x1d8'),_0x3daadc,_0x82bb('0x1d9'),_0x131444['predictiveIntervalAvailable'],'+',_0x1f77b9,'=',_0x131444[_0x82bb('0x1c2')]+_0x1f77b9,')');}};Dialer['prototype']['getDataPredictive']=function(_0x2286f0){var _0x3667a1=this;return function(_0x53c2e4){return new Promise(function(_0x16d265,_0x441702){_[_0x82bb('0x5a')](_0x2286f0,_0x53c2e4[0x0]);if(checkGetDataPredictive(_0x53c2e4[0x0])){var _0x3447ef=_0x2286f0[_0x82bb('0x1c2')]=_0x2286f0[_0x82bb('0x141')]+_0x2286f0['available'];var _0x4a3dee=_0x2286f0[_0x82bb('0x1ca')]*0x3c;var _0x549304=_0x53c2e4[0x0][_0x82bb('0x4c')]+_0x53c2e4[0x0][_0x82bb('0x4e')];var _0x250b83=(_0x53c2e4[0x0]['predictiveIntervalAnsweredCalls']+_0x53c2e4[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x53c2e4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x53c2e4[0x0][_0x82bb('0x47')];_0x2286f0[_0x82bb('0x1c5')]=_0x250b83>0x0?_0x250b83:0x1;switch(_0x2286f0['dialPredictiveOptimization']){case _0x82bb('0x1cc'):var _0x4e7ced=_0x2286f0['dialPredictiveOptimizationPercentage']/0x64;return _0x3667a1[_0x82bb('0x1da')](_0x3447ef,_0x4a3dee,_0x549304,_0x250b83,_0x4e7ced)[_0x82bb('0x3a')](function(_0x4bd4c7){return _0x16d265(_0x4bd4c7);});case'agentBusyFactor':var _0x680aa0=_0x2286f0[_0x82bb('0x1c0')]/0x64;return _0x3667a1['busyFactor'](_0x3447ef,_0x4a3dee,_0x549304,_0x250b83,_0x680aa0)[_0x82bb('0x3a')](function(_0x232d1){return _0x16d265(_0x232d1);});default:return _0x441702(msgResponse(_0x82bb('0x1db'),_0x82bb('0x96'),'Unknown\x20Predictive'));}}else{return _0x441702(msgResponse('[getDataPredictive]','Failure',_0x82bb('0x1dc')));}});};};Dialer[_0x82bb('0x85')][_0x82bb('0x1dd')]=function(_0x507a74){var _0x275389=this;return function(_0x4be240){return new Promise(function(_0x23912d,_0x3cbcfd){_['merge'](_0x507a74,_0x4be240[0x0]);if(checkGetDataPredictive(_0x4be240[0x0])){loggerPredictive[_0x82bb('0x44')](JSON[_0x82bb('0x101')](_0x4be240[0x0]));if(_0x507a74[_0x82bb('0x1cf')]===_0x82bb('0x1cc')){return _0x275389[_0x82bb('0x156')](_0x507a74['id'])[_0x82bb('0x3a')](function(_0x266cb4){var _0x2ffaef=_0x507a74[_0x82bb('0x1de')]-_0x266cb4[0x0][_0x82bb('0x1df')];var _0x1deb58=_0x507a74[_0x82bb('0x1ca')]*0x3c;var _0x129623=_0x4be240[0x0]['predictiveIntervalAvgTalktime']+_0x4be240[0x0][_0x82bb('0x4e')];var _0xba26ef=(_0x4be240[0x0][_0x82bb('0x48')]+_0x4be240[0x0][_0x82bb('0x1e0')]+_0x4be240[0x0][_0x82bb('0x4a')])/_0x4be240[0x0][_0x82bb('0x47')];var _0x1c3459=_0x507a74['dialPredictiveOptimizationPercentage']/0x64;_0x507a74[_0x82bb('0x1e1')]=_0x266cb4[0x0][_0x82bb('0x1df')]||0x0;_0x507a74[_0x82bb('0x1c5')]=_0xba26ef>0x0?_0xba26ef:0x1;return _0x275389[_0x82bb('0x1da')](_0x2ffaef,_0x1deb58,_0x129623,_0xba26ef,_0x1c3459);})['then'](function(_0x44d218){return _0x23912d(_0x44d218);})[_0x82bb('0xa4')](function(_0x2a018d){return _0x3cbcfd(msgResponse('[CatchErlangB]',_0x82bb('0x96'),JSON[_0x82bb('0x101')](_0x2a018d)));});}if(_0x507a74['dialPredictiveOptimization']===_0x82bb('0x1e2')){return _0x275389[_0x82bb('0x156')](_0x507a74['id'])['then'](function(_0x552fad){var _0x248a3a=_0x507a74[_0x82bb('0x1de')]-_0x552fad[0x0][_0x82bb('0x1df')];var _0x3d5e8f=_0x507a74[_0x82bb('0x1ca')]*0x3c;var _0xc10edf=_0x4be240[0x0][_0x82bb('0x4c')]+_0x4be240[0x0][_0x82bb('0x4e')];var _0x201142=(_0x4be240[0x0][_0x82bb('0x48')]+_0x4be240[0x0][_0x82bb('0x1e0')]+_0x4be240[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4be240[0x0][_0x82bb('0x47')];var _0x4f18c8=_0x507a74[_0x82bb('0x1c0')]/0x64;_0x507a74[_0x82bb('0x1e1')]=_0x552fad[0x0][_0x82bb('0x1df')]||0x0;_0x507a74[_0x82bb('0x1c5')]=_0x201142>0x0?_0x201142:0x1;return _0x275389['busyFactor'](_0x248a3a,_0x3d5e8f,_0xc10edf,_0x201142,_0x4f18c8);})[_0x82bb('0x3a')](function(_0x445642){return _0x23912d(_0x445642);})[_0x82bb('0xa4')](function(_0x42679a){return _0x3cbcfd(msgResponse('[CatchErlangB]',_0x82bb('0x96'),JSON[_0x82bb('0x101')](_0x42679a)));});}}else{return _0x3cbcfd(msgResponse('[getDataPredictive]',_0x82bb('0x96'),_0x82bb('0x1dc')));}});};};Dialer[_0x82bb('0x85')][_0x82bb('0x1d7')]=function(_0xbe0309){var _0x2d9ffe=this;return function(){var _0x2208d7=0x0;var _0x5d92f7=Math[_0x82bb('0x1c4')](_0xbe0309['erlangCallToSecond']*0x3e8);if(_0x5d92f7>0x0){_0x5d92f7=_0x5d92f7<0x64?0x64:_0x5d92f7;loggerPredictive[_0x82bb('0x44')](_0xbe0309[_0x82bb('0x41')],_0x82bb('0x1e3'),_0x5d92f7,_0x82bb('0x1e4'));_0xbe0309[_0x82bb('0x5f')]=setInterval(function(){_0x2d9ffe[_0x82bb('0x5f')](_0xbe0309);loggerPredictiveCalls['info'](_0x82bb('0x1e5'),_0x2208d7+=0x1);},_0x5d92f7);}else{loggerPredictive[_0x82bb('0x44')](_0xbe0309['name'],_0x82bb('0x1e6'));}};};Dialer[_0x82bb('0x85')]['checkContactBlack']=function(_0x396a16,_0x4e886f){var _0x2c8747=this;return function(_0x3f4800){if(_['isEmpty'](_0x3f4800)){if(_[_0x82bb('0xf5')](_0x4e886f['UserId'])||!_0x4e886f[_0x82bb('0x1e7')]){if(_0x396a16[_0x82bb('0xb2')]==='booked'){_0x396a16['queueStatusComplete']=_[_0x82bb('0x3c')](_0x396a16[_0x82bb('0x73')])?!![]:_0x396a16[_0x82bb('0x73')];var _0x568eb5=uuid['v4']();_0x2c8747[_0x82bb('0x22')][_0x568eb5]=new Action(_0x396a16,_0x4e886f,_0x568eb5);loggerBooked['info'](_0x82bb('0x1e8'),_0x568eb5,_0x82bb('0x1e9'),JSON[_0x82bb('0x101')](_0x396a16[_0x82bb('0x73')]),_0x82bb('0x1ea'),_0x396a16[_0x82bb('0x41')]);if(_0x396a16['queueStatusComplete']){_0x396a16[_0x82bb('0x73')]=![];_0x2c8747[_0x82bb('0x27')][_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xc0')]]=[];ami[_0x82bb('0x9e')]({'actionid':_0x568eb5,'action':_0x82bb('0x1eb'),'queue':_0x396a16['name']})[_0x82bb('0xa4')](function(){_0x2c8747[_0x82bb('0xcd')](_0x396a16);hopperUtils[_0x82bb('0xdd')]({'active':![],'ContactId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xed')],'ListId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xdf')],'VoiceQueueId':_0x2c8747['actions'][_0x568eb5][_0x82bb('0xe0')]||undefined,'CampaignId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x1ec')));delete _0x2c8747[_0x82bb('0x22')][_0x568eb5];});}else{loggerBooked[_0x82bb('0x44')](_0x82bb('0x1ed'),JSON[_0x82bb('0x101')](_0x396a16[_0x82bb('0x73')]),'Queue:\x20',_0x396a16[_0x82bb('0x41')]);_0x2c8747[_0x82bb('0xcd')](_0x396a16);hopperUtils[_0x82bb('0xdd')]({'active':![],'ContactId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xed')],'ListId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xdf')],'VoiceQueueId':_0x2c8747[_0x82bb('0x22')][_0x568eb5][_0x82bb('0xe0')]||undefined,'CampaignId':_0x2c8747['actions'][_0x568eb5][_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x1ec')));delete _0x2c8747[_0x82bb('0x22')][_0x568eb5];}}else{return _0x2c8747[_0x82bb('0x162')](_0x396a16,_0x4e886f);}}else{if(utils[_0x82bb('0x5b')](undefined,_0x4e886f[_0x82bb('0x1ee')])<_0x396a16['dialRecallMeTimeout']*0x3c){if(_0x4e886f[_0x82bb('0x160')]&&!_0x4e886f[_0x82bb('0x160')]['voicePause']){_0x2c8747['preview'][_0x82bb('0x1ef')](_0x4e886f['id'])[_0x82bb('0x19')](function(){_0x2c8747[_0x82bb('0xcd')](_0x396a16);});}else{hopperUtils[_0x82bb('0x1f0')]({'active':![]},_0x4e886f['id'],0x1)[_0x82bb('0x19')](function(){_0x2c8747['updateOriginated'](_0x396a16);});}}else{_0x396a16[_0x82bb('0x1f1')]+=0x1;_0x2c8747[_0x82bb('0xcd')](_0x396a16);if(_0x396a16[_0x82bb('0x1f2')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4e886f['ContactId'],'ListId':_0x4e886f['ListId'],'VoiceQueueId':_0x4e886f[_0x82bb('0xe0')]||undefined,'CampaignId':_0x4e886f[_0x82bb('0xe1')]||undefined})[_0x82bb('0xa4')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x82bb('0xe4')](createObjHistory(_0x396a16,_0x4e886f,utils[_0x82bb('0x65')][_0x82bb('0x1f3')],0x17,_0x82bb('0x1f4')))[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x1f5')));}else{_0x2c8747[_0x82bb('0x11a')](createObjHistory(_0x396a16,_0x4e886f,utils[_0x82bb('0x65')][_0x82bb('0x1f6')],0x16,'RecallFailedTimeout'),_0x82bb('0x1f7'),_0x82bb('0x1f8'));}}}}else{_0x396a16[_0x82bb('0x1f9')]+=0x1;_0x2c8747[_0x82bb('0x11a')](createObjHistory(_0x396a16,_0x4e886f,utils[_0x82bb('0x65')][_0x82bb('0x1fa')],0xd,_0x82bb('0x1fb')),_0x82bb('0x1fc'),_0x82bb('0x1fd'));throw _0x82bb('0x1fe');}};};Dialer[_0x82bb('0x85')]['handleIvr']=function(_0x5ccdf4){var _0x405c2b=this;var _0x4b65a7=_0x5ccdf4[_0x82bb('0x1ff')]-_0x5ccdf4[_0x82bb('0x7e')];emitCampaignSummary(_0x5ccdf4);if(_0x4b65a7>0x0&&_0x5ccdf4[_0x82bb('0x200')]==0x0){if(_0x4b65a7>this[_0x82bb('0x20')]){_0x4b65a7=this[_0x82bb('0x20')];}_0x5ccdf4[_0x82bb('0x200')]=0x1;hopperUtils[_0x82bb('0x201')](_0x5ccdf4,_0x4b65a7)[_0x82bb('0x3a')](function(_0x480d81){_0x5ccdf4[_0x82bb('0x200')]=0x0;if(_0x480d81){if(!utils[_0x82bb('0x202')](_0x480d81)){_0x5ccdf4[_0x82bb('0x69')]=utils['CAMPAIGN_STATUS'][_0x82bb('0x6a')];logger[_0x82bb('0x44')](_0x82bb('0x203')+_0x5ccdf4[_0x82bb('0x41')]);}else{_0x5ccdf4[_0x82bb('0x7e')]+=_0x480d81[_0x82bb('0x9c')];_0x5ccdf4[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x204')];for(var _0x4ac9e0=0x0;_0x4ac9e0<_0x480d81[_0x82bb('0x9c')];_0x4ac9e0+=0x1){_0x5ccdf4[_0x82bb('0x205')]+=0x1;if(_[_0x82bb('0xf5')](_0x480d81[_0x4ac9e0])||_['isNil'](_0x480d81[_0x4ac9e0][_0x82bb('0x17b')])||_[_0x82bb('0xf5')](_0x480d81[_0x4ac9e0][_0x82bb('0x163')])){_0x405c2b['emptyContact'](_0x82bb('0x206'),_0x5ccdf4,_0x480d81[_0x4ac9e0]);}else{hopperUtils[_0x82bb('0x207')](_['pick'](_0x480d81[_0x4ac9e0],['CampaignId',_0x82bb('0x163')]))['then'](_0x405c2b[_0x82bb('0x208')](_0x5ccdf4,_0x480d81[_0x4ac9e0]))[_0x82bb('0xa4')](_0x405c2b[_0x82bb('0x15a')]('[actionOriginateIvr]\x20',_0x5ccdf4));}}}}})[_0x82bb('0xa4')](loggerGetContactDialer(_0x82bb('0x209'),_0x5ccdf4,_0x4b65a7));}};Dialer[_0x82bb('0x85')]['handlePower']=function(_0x190cf7,_0x21a415){var _0x11a888=this;var _0x554032=[];if(_0x21a415<0x1||_0x190cf7['dialMethod']==='booked'){_0x21a415=0x1;}var _0x3536b2=Math[_0x82bb('0x1c4')](_0x190cf7[_0x82bb('0x13f')]*_0x21a415)-_0x190cf7[_0x82bb('0x7e')];if(_0x190cf7[_0x82bb('0x20a')]>0x0){var _0x24ee4d=_0x190cf7['dialLimitQueue']-_0x190cf7[_0x82bb('0x7e')]-_0x190cf7['talking']-_0x190cf7[_0x82bb('0x142')];if(_0x3536b2>_0x24ee4d){_0x3536b2=_0x24ee4d;}}if(_0x3536b2>0x0&&_0x190cf7[_0x82bb('0x200')]==0x0){if(_0x190cf7['dialMethod']===_0x82bb('0x20b')){_0x3536b2=0x1;}if(_0x3536b2>this['maxNumberOriginate']){_0x3536b2=this[_0x82bb('0x20')];}for(var _0x3b3a36 in this['agents']){if(typeof this[_0x82bb('0x1e')][_0x3b3a36]!=='undefined'){if(this[_0x82bb('0x1e')][_0x3b3a36]['state']===_0x82bb('0x20c')&&this[_0x82bb('0x1e')][_0x3b3a36]['status']===_0x82bb('0x14c')){_0x554032[_0x82bb('0x9d')](this['agents'][_0x3b3a36]['id']);}}}_0x190cf7[_0x82bb('0x200')]=0x1;hopperUtils[_0x82bb('0x20d')](_0x190cf7,_0x554032,_0x3536b2)['then'](function(_0x4b8a96){_0x190cf7[_0x82bb('0x200')]=0x0;if(_0x4b8a96){if(!utils['checkContactEmpty'](_0x4b8a96)){hopperUtils['countReScheduled'](_0x190cf7)['then'](sendMessageReschedule(_0x190cf7))[_0x82bb('0xa4')](loggerCatch('[countReScheduled]\x20'));}else{_0x190cf7[_0x82bb('0x7e')]+=_0x4b8a96[_0x82bb('0x9c')];_0x190cf7['message']=_0x190cf7[_0x82bb('0xb2')]===_0x82bb('0x20b')?utils[_0x82bb('0x65')][_0x82bb('0x143')]:utils[_0x82bb('0x65')][_0x82bb('0x204')];for(var _0x5e7ed2=0x0;_0x5e7ed2<_0x4b8a96[_0x82bb('0x9c')];_0x5e7ed2+=0x1){if(_[_0x82bb('0xf5')](_0x4b8a96[_0x5e7ed2])||_[_0x82bb('0xf5')](_0x4b8a96[_0x5e7ed2]['Contact'])||_[_0x82bb('0xf5')](_0x4b8a96[_0x5e7ed2][_0x82bb('0x163')])){_0x11a888['emptyContact']('[actionOriginate]\x20',_0x190cf7,_0x4b8a96[_0x5e7ed2]);}else{hopperUtils[_0x82bb('0x20e')](_['pick'](_0x4b8a96[_0x5e7ed2],['VoiceQueueId','phone']))[_0x82bb('0x3a')](_0x11a888[_0x82bb('0x208')](_0x190cf7,_0x4b8a96[_0x5e7ed2]))['catch'](_0x11a888[_0x82bb('0x15a')](_0x82bb('0x206'),_0x190cf7));}}}}})[_0x82bb('0xa4')](loggerGetContactDialer(_0x82bb('0x20f'),_0x190cf7,_0x3536b2));}};Dialer[_0x82bb('0x85')][_0x82bb('0x5f')]=function(_0xf44acf){if(_0xf44acf[_0x82bb('0x20a')]>0x0){var _0x31652a=_0xf44acf[_0x82bb('0x20a')]-_0xf44acf[_0x82bb('0x7e')]-_0xf44acf['talking'];if(_0x31652a>0x0&&_0xf44acf[_0x82bb('0x200')]==0x0){this[_0x82bb('0x210')](_0xf44acf);}else{loggerPredictiveCalls[_0x82bb('0x44')](_0x82bb('0x211'));}}else{this[_0x82bb('0x210')](_0xf44acf);}};Dialer[_0x82bb('0x85')][_0x82bb('0x210')]=function(_0x2e973f){var _0x51ac72=this;var _0x28a993=[];_0x2e973f[_0x82bb('0x7e')]+=0x1;for(var _0x4b82a2 in this[_0x82bb('0x1e')]){if(typeof this[_0x82bb('0x1e')][_0x4b82a2]!==_0x82bb('0xab')){if(this['agents'][_0x4b82a2][_0x82bb('0x6c')]===_0x82bb('0x20c')&&this[_0x82bb('0x1e')][_0x4b82a2]['status']===_0x82bb('0x14c')){_0x28a993[_0x82bb('0x9d')](this[_0x82bb('0x1e')][_0x4b82a2]['id']);}}}_0x2e973f[_0x82bb('0x200')]=0x1;return this[_0x82bb('0x20d')](_0x2e973f['id'],_0x28a993,0x1,_0x2e973f[_0x82bb('0x212')],_0x2e973f)[_0x82bb('0x3a')](function(_0x50f7ad){_0x2e973f[_0x82bb('0x200')]=0x1;if(_0x50f7ad){if(!utils[_0x82bb('0x202')](_0x50f7ad)){utils[_0x82bb('0x62')](_0x2e973f,0x1,0x0);return hopperUtils[_0x82bb('0x213')](_0x2e973f)['then'](sendMessageReschedule(_0x2e973f))[_0x82bb('0xa4')](loggerCatch(_0x82bb('0x214')));}else{_0x2e973f[_0x82bb('0x69')]=utils[_0x82bb('0x65')][_0x82bb('0x204')];if(_[_0x82bb('0xf5')](_0x50f7ad[0x0])||_[_0x82bb('0xf5')](_0x50f7ad[0x0][_0x82bb('0x17b')])||_[_0x82bb('0xf5')](_0x50f7ad[0x0]['phone'])){_0x51ac72[_0x82bb('0x215')](_0x82bb('0x206'),_0x2e973f,_0x50f7ad[0x0]);}else{return hopperUtils[_0x82bb('0x20e')](_[_0x82bb('0x72')](_0x50f7ad[0x0],['VoiceQueueId','phone']))[_0x82bb('0x3a')](_0x51ac72[_0x82bb('0x208')](_0x2e973f,_0x50f7ad[0x0]))[_0x82bb('0xa4')](_0x51ac72[_0x82bb('0x15a')]('[actionOriginatePredictive]\x20',_0x2e973f));}}}})[_0x82bb('0xa4')](loggerGetContactDialer(_0x82bb('0x216'),_0x2e973f,0x1));};Dialer[_0x82bb('0x85')][_0x82bb('0x1da')]=function(_0x2babbf,_0x33b2b0,_0x51be6d,_0x5232be,_0x453c15,_0x925c91){loggerPredictive[_0x82bb('0x44')](_0x82bb('0x217'));loggerPredictive[_0x82bb('0x44')](_0x82bb('0x218'),_0x2babbf);loggerPredictive[_0x82bb('0x44')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x33b2b0);loggerPredictive['info'](_0x82bb('0x219'),_0x51be6d);loggerPredictive['info'](_0x82bb('0x21a'),_0x5232be);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x21b'),_0x453c15);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x59'));return new Promise(function(_0x26af1d,_0x2f52a3){if(_0x2babbf<=0x0||isNaN(_0x2babbf)){return _0x2f52a3(msgResponse('[abandonmentRate]',_0x82bb('0x84'),_0x82bb('0x21c')+_0x2babbf));}if(_0x51be6d<=0x0||isNaN(_0x51be6d)){return _0x2f52a3(msgResponse(_0x82bb('0x21d'),_0x82bb('0x84'),_0x82bb('0x21e')+_0x51be6d));}if(_0x5232be<=0x0||isNaN(_0x5232be)){return _0x2f52a3(msgResponse(_0x82bb('0x21d'),_0x82bb('0x84'),_0x82bb('0x21f')+_0x5232be));}if(_0x33b2b0<=0x0||isNaN(_0x33b2b0)){return _0x2f52a3(msgResponse(_0x82bb('0x21d'),'Error',_0x82bb('0x220')+_0x33b2b0));}if(_0x453c15<=0x0||isNaN(_0x453c15)){return _0x2f52a3(msgResponse(_0x82bb('0x21d'),_0x82bb('0x84'),_0x82bb('0x221')+_0x453c15));}_0x925c91=_0x925c91||0x0;var _0x5ccf36=0x1/_0x51be6d;var _0x3b507c=0x0;var _0x27808e=0x0;var _0x183580=0x0;var _0x3d68b2=0x0;for(var _0xc10333=0x0;_0x183580<_0x453c15;_0xc10333+=0x1){_0x27808e=_0xc10333/_0x33b2b0;_0x3b507c=(_0x5232be*_0x27808e+_0x925c91)/_0x5ccf36;_0x183580=utils[_0x82bb('0x222')](_0x3b507c,_0x2babbf);_0x3d68b2=_0x3b507c/_0x2babbf*(0x1-utils[_0x82bb('0x222')](_0x3b507c,_0x2babbf));}return _0x26af1d({'erlangCalls':_0xc10333,'erlangCallToSecond':_0x33b2b0/_0xc10333,'erlangAbandonmentRate':_0x183580,'erlangBusyFactor':_0x3d68b2});});};Dialer['prototype'][_0x82bb('0x223')]=function(_0x49df73,_0x1c1bbc,_0x5c2cda,_0x2e28c3,_0x97a3b0,_0x1acde1){loggerPredictive['info'](_0x82bb('0x224'));loggerPredictive['info'](_0x82bb('0x218'),_0x49df73);loggerPredictive[_0x82bb('0x44')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c1bbc);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x219'),_0x5c2cda);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x21a'),_0x2e28c3);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x225'),_0x97a3b0);loggerPredictive[_0x82bb('0x44')](_0x82bb('0x59'));return new Promise(function(_0x1cb73e,_0x4bccaa){if(_0x49df73<=0x0||isNaN(_0x49df73)){return _0x4bccaa(msgResponse(_0x82bb('0x226'),_0x82bb('0x84'),_0x82bb('0x21c')+_0x49df73));}if(_0x5c2cda<=0x0||isNaN(_0x5c2cda)){return _0x4bccaa(msgResponse('[busyFactor]',_0x82bb('0x84'),_0x82bb('0x21e')+_0x5c2cda));}if(_0x2e28c3<=0x0||isNaN(_0x2e28c3)){return _0x4bccaa(msgResponse('[busyFactor]',_0x82bb('0x84'),_0x82bb('0x21f')+_0x2e28c3));}if(_0x1c1bbc<=0x0||isNaN(_0x1c1bbc)){return _0x4bccaa(msgResponse(_0x82bb('0x226'),_0x82bb('0x84'),_0x82bb('0x220')+_0x1c1bbc));}if(_0x97a3b0<=0x0||isNaN(_0x97a3b0)){return _0x4bccaa(msgResponse(_0x82bb('0x226'),_0x82bb('0x84'),'Umin\x20=\x20'+_0x97a3b0));}_0x1acde1=_0x1acde1||0x0;var _0x352c18=0x1/_0x5c2cda;var _0x4e58c9=0x0;var _0x3cfa0c=0x0;var _0x2b6c2b=0x0;var _0x2ff4a2=0x0;for(var _0x58dcd2=0x0;_0x2ff4a2<_0x97a3b0;_0x58dcd2+=0x1){_0x3cfa0c=_0x58dcd2/_0x1c1bbc;_0x4e58c9=(_0x2e28c3*_0x3cfa0c+_0x1acde1)/_0x352c18;_0x2b6c2b=utils[_0x82bb('0x222')](_0x4e58c9,_0x49df73);_0x2ff4a2=_0x4e58c9/_0x49df73*(0x1-utils[_0x82bb('0x222')](_0x4e58c9,_0x49df73));}return _0x1cb73e({'erlangCalls':_0x58dcd2,'erlangCallToSecond':_0x1c1bbc/_0x58dcd2,'erlangAbandonmentRate':_0x2b6c2b,'erlangBusyFactor':_0x2ff4a2});});};module['exports']=Dialer; \ No newline at end of file +var _0xfc33=['dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','UserId','[emptyContact][createHistory]','handleIvr','actionOriginate','object','voiceQueue\x20is\x20undefine','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','assign','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','TrunkBackup','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','phone','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','util','lodash','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/final','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','getSettings','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','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','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','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','error','checkContactLowerLimitOriginate','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','\x20INTERVAL_IS_NULL','Intervals','NULL_INTERVAL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','reachable','status','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','Action','command','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','syncCampaigns','undefined','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','uniqueid','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','Drop','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','paused','stateinterface','locked','push','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnoanswerretry','dialMachineRetryFrequency','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','getQueueCampaignStatusMessage','resolve','statusMessage','available','inUse','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter'];(function(_0x48dcda,_0x32c378){var _0x3fb549=function(_0x3a734e){while(--_0x3a734e){_0x48dcda['push'](_0x48dcda['shift']());}};_0x3fb549(++_0x32c378);}(_0xfc33,0xd2));var _0x3fc3=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xfc33[_0x36ed48];return _0x51c63a;};'use strict';var util=require(_0x3fc3('0x0'));var _=require(_0x3fc3('0x1'));var uuid=require(_0x3fc3('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x3fc3('0x3'));var utils=require(_0x3fc3('0x4'));var hopperUtils=require(_0x3fc3('0x5'));var ut=require(_0x3fc3('0x6'));var config=require(_0x3fc3('0x7'));var logger=require(_0x3fc3('0x8'))(_0x3fc3('0x9'));var loggerBooked=require(_0x3fc3('0x8'))(_0x3fc3('0xa'));var loggerPredictive=require(_0x3fc3('0x8'))('predictive');var loggerPredictiveCalls=require(_0x3fc3('0x8'))(_0x3fc3('0xb'));var loggerSyncQueueSummary=require(_0x3fc3('0x8'))('syncQueueSummary');var ami=require(_0x3fc3('0xc'));config[_0x3fc3('0xd')]=_['defaults'](config[_0x3fc3('0xd')],{'host':_0x3fc3('0xe'),'port':0x18eb});var io=require(_0x3fc3('0xf'))(new Redis(config[_0x3fc3('0xd')]));var cmHopper=require(_0x3fc3('0x10'));var voiceQueueRt=require(_0x3fc3('0x11'));var RpcSetting=require(_0x3fc3('0x12'));var Interval=require(_0x3fc3('0x13'));var Action=require(_0x3fc3('0x14'));var History=require('./models/history');var Final=require(_0x3fc3('0x15'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x3fc3('0x16'));var Hangup=require('./models/hangup');var ipAgi=process[_0x3fc3('0x17')][_0x3fc3('0x18')]||_0x3fc3('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x3fc3('0x1a')]['enqueue']=function(_0x2fbbc6){this[_0x3fc3('0x1b')]=this['tail']?this[_0x3fc3('0x1b')]['finally'](_0x2fbbc6):_0x2fbbc6();};function Dialer(_0x51080e,_0x54c10f){this[_0x3fc3('0x1c')]=new Sequence();this[_0x3fc3('0x1d')]=_0x54c10f;this['voiceQueues']=_0x51080e[_0x3fc3('0x1e')];this[_0x3fc3('0x1f')]=_0x51080e[_0x3fc3('0x1f')];this[_0x3fc3('0x20')]=_0x51080e['agents'];this[_0x3fc3('0x21')]=_0x51080e[_0x3fc3('0x21')];this[_0x3fc3('0x22')]=config['maxNumberOriginate']||0x2;this[_0x3fc3('0x23')]={};this[_0x3fc3('0x24')]={};this['contactsId']={};this[_0x3fc3('0x25')]={};this[_0x3fc3('0x26')]={};this[_0x3fc3('0x27')]={};this[_0x3fc3('0x28')]={};this[_0x3fc3('0x29')]={};this[_0x3fc3('0x2a')]={};this[_0x3fc3('0x2b')]={};this[_0x3fc3('0x2c')]={};ami['on'](_0x3fc3('0x2d'),this[_0x3fc3('0x2e')][_0x3fc3('0x2f')](this));ami['on']('queuecallerabandon',this[_0x3fc3('0x30')][_0x3fc3('0x2f')](this));ami['on']('originateresponse',this[_0x3fc3('0x31')][_0x3fc3('0x2f')](this));ami['on']('agentcomplete',this[_0x3fc3('0x32')][_0x3fc3('0x2f')](this));ami['on'](_0x3fc3('0x33'),this[_0x3fc3('0x34')][_0x3fc3('0x2f')](this));ami['on']('custom:queuesummarycomplete',this[_0x3fc3('0x35')][_0x3fc3('0x2f')](this));ami['on'](_0x3fc3('0x36'),this[_0x3fc3('0x37')][_0x3fc3('0x2f')](this));ami['on'](_0x3fc3('0x38'),this[_0x3fc3('0x39')]['bind'](this));ami['on'](_0x3fc3('0x3a'),this[_0x3fc3('0x3b')][_0x3fc3('0x2f')](this));ami['on']('queuemember',this[_0x3fc3('0x3c')][_0x3fc3('0x2f')](this));ami['on'](_0x3fc3('0x3d'),this[_0x3fc3('0x3e')][_0x3fc3('0x2f')](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting[_0x3fc3('0x3f')]()['then'](function(_0x1a29a2){previewRecallmeReminderInterval=_0x1a29a2['previewRecallmeReminderInterval'];});}function isNotNull(_0x354e52){return _0x354e52!==null&&!_[_0x3fc3('0x40')](_0x354e52);}function msgResponse(_0x3e4985,_0x330d9d,_0x326cd2){return{'action':_0x3e4985,'response':_0x330d9d,'message':_0x326cd2,'stack':_0x326cd2};}function emit(_0xd18620,_0x16ffeb,_0x2de34f){io['to'](_0xd18620)['emit'](_0x16ffeb,_0x2de34f);}function emitOutboundVoiceQueueSummary(_0x255467){if(_0x255467[_0x3fc3('0x41')]===_0x3fc3('0x42')){logger[_0x3fc3('0x43')](_0x3fc3('0x44'),util[_0x3fc3('0x45')](_0x255467,{'showHidden':![],'depth':null}));emit(util[_0x3fc3('0x46')](_0x3fc3('0x47'),_0x255467[_0x3fc3('0x48')]),_0x3fc3('0x49'),_0x255467);}}function checkGetDataPredictive(_0x306ae0){if(isNotNull(_0x306ae0)&&!_[_0x3fc3('0x4a')](_0x306ae0)){loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x4c'));loggerPredictive['info'](_0x3fc3('0x4d'),_0x306ae0[_0x3fc3('0x4e')]);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x4f'),_0x306ae0[_0x3fc3('0x50')]);loggerPredictive['info'](_0x3fc3('0x51'),_0x306ae0['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x52'),_0x306ae0[_0x3fc3('0x53')]);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x54'),_0x306ae0['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x3fc3('0x4b')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x306ae0[_0x3fc3('0x55')]);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x56'));if(_0x306ae0[_0x3fc3('0x4e')]>0x0){if(!_[_0x3fc3('0x40')](_0x306ae0['predictiveIntervalAvgTalktime'])&&_0x306ae0[_0x3fc3('0x55')]>0x0){return!![];}loggerPredictive['info'](_0x3fc3('0x57'));if(!_[_0x3fc3('0x40')](_0x306ae0[_0x3fc3('0x58')])&&_0x306ae0[_0x3fc3('0x58')]>0x0){return!![];}loggerPredictive[_0x3fc3('0x4b')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x3fc3('0x59'));}}else{loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x5a'));}return![];}function mergeDataErlangB(_0x1fb17f){return function(_0x45e437){loggerPredictive[_0x3fc3('0x4b')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x5b'),_0x45e437[_0x3fc3('0x5c')]);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x5d'),_0x45e437[_0x3fc3('0x5e')]);loggerPredictive[_0x3fc3('0x4b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45e437[_0x3fc3('0x5f')]);loggerPredictive['info'](_0x3fc3('0x60'),_0x45e437[_0x3fc3('0x61')]);loggerPredictive[_0x3fc3('0x4b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45e437[_0x3fc3('0x5f')]);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x56'));_['merge'](_0x1fb17f,_0x45e437);};}function ifInterval(_0x1a823b,_0x43fbd2){if(_[_0x3fc3('0x40')](_0x43fbd2)){return![];}return utils[_0x3fc3('0x62')](undefined,_0x43fbd2)<_0x1a823b*0x3c;}function clearPredictiveAttributes(_0x2e14ad){if(_0x2e14ad[_0x3fc3('0x28')]){_0x2e14ad[_0x3fc3('0x28')]=undefined;loggerPredictive[_0x3fc3('0x43')](_0x2e14ad[_0x3fc3('0x48')],_0x3fc3('0x63'));}if(_0x2e14ad[_0x3fc3('0x27')]){_0x2e14ad[_0x3fc3('0x27')]=undefined;loggerPredictive[_0x3fc3('0x43')](_0x2e14ad[_0x3fc3('0x48')],'startPredictive\x20value\x20cleared');}if(_0x2e14ad[_0x3fc3('0x64')]){clearInterval(_0x2e14ad[_0x3fc3('0x64')]);_0x2e14ad[_0x3fc3('0x64')]=undefined;loggerPredictive[_0x3fc3('0x43')](_0x2e14ad[_0x3fc3('0x48')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x190b3b,_0x513619){return function(_0x1a61e0){loggerPredictive[_0x3fc3('0x65')](_0x513619[_0x3fc3('0x48')],_0x190b3b);loggerPredictive[_0x3fc3('0x65')](_0x1a61e0['stack']);clearPredictiveAttributes(_0x513619);};}function loggerCatch(_0x192469){return function(_0x4fe942){logger[_0x3fc3('0x65')](_0x192469,util[_0x3fc3('0x45')](_0x4fe942,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xa0f031,_0x1e935d,_0x105b32){return function(_0x374db5){utils[_0x3fc3('0x66')](_0x1e935d,_0x105b32,0x0);_0x1e935d['temp']=0x0;logger[_0x3fc3('0x65')](_0xa0f031,util[_0x3fc3('0x45')](_0x374db5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x547b85){return function(_0x57e968){if(isNotNull(_0x57e968)&&isNotNull(_0x57e968[0x0])){if(_0x57e968[0x0][_0x3fc3('0x67')]>0x0){_0x547b85['message']=utils[_0x3fc3('0x68')][_0x3fc3('0x69')];logger[_0x3fc3('0x4b')](_0x3fc3('0x6a')+_0x547b85[_0x3fc3('0x48')],_0x57e968[0x0][_0x3fc3('0x67')],_0x3fc3('0x6b'));}else{_0x547b85[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x6d')];logger[_0x3fc3('0x4b')](_0x3fc3('0x6e')+_0x547b85[_0x3fc3('0x48')]);}}};}function createObjHistory(_0x12abe5,_0x82fb36,_0x1a0dea,_0x5fdf94,_0x4c2977){_0x12abe5[_0x3fc3('0x6c')]=_0x1a0dea;var _0xaf6783=new Action(_0x12abe5,_0x82fb36);var _0x436caa=new History(_0xaf6783);_0x436caa[_0x3fc3('0x6f')]=_0x5fdf94;_0x436caa[_0x3fc3('0x70')]=_0x4c2977;_0x436caa['endtime']=_0xaf6783[_0x3fc3('0x71')];return _0x436caa;}function unlockQueueStatus(_0x50a53f,_0x2e21e2){setTimeout(function(){if(_['isUndefined'](_0x50a53f[_0x3fc3('0x72')])){loggerBooked[_0x3fc3('0x65')]('[unlockQueueStatus][undefined]',_0x2e21e2);}_0x50a53f[_0x3fc3('0x72')]=!![];loggerBooked[_0x3fc3('0x4b')](_0x3fc3('0x73'),_0x2e21e2,JSON[_0x3fc3('0x74')](_[_0x3fc3('0x75')](_0x50a53f,['name','queueStatusComplete'])));},0x1f3);}function checkInterval(_0x984a42){return function(){if(!isNotNull(_0x984a42[_0x3fc3('0x76')])){_0x984a42[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')]['NULL_INTERVAL'];throw _0x984a42[_0x3fc3('0x48')]+_0x3fc3('0x77');}if(!isNotNull(_0x984a42['Interval'][_0x3fc3('0x78')])){_0x984a42[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x79')];throw _0x984a42[_0x3fc3('0x48')]+_0x3fc3('0x77');}if(!isNotNull(_[_0x3fc3('0x4a')](_0x984a42[_0x3fc3('0x76')][_0x3fc3('0x78')]))){_0x984a42[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x79')];throw _0x984a42[_0x3fc3('0x48')]+_0x3fc3('0x77');}};}function checkIsIVRCampaignActive(_0x37d456){return function(){if(!utils[_0x3fc3('0x7a')](_0x37d456)){_0x37d456[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x7b')];throw _0x37d456[_0x3fc3('0x48')]+_0x3fc3('0x7c');}};}function emitCampaignSummary(_0x46ca33){if(utils[_0x3fc3('0x7d')](_0x46ca33)){emit(util[_0x3fc3('0x46')](_0x3fc3('0x7e'),_0x46ca33[_0x3fc3('0x48')]),_0x3fc3('0x7f'),_0x46ca33);}}function loggerCatchQueueSummary(_0x9bdd0a,_0x53a8b2){return function(_0x5cdb5c){clearPredictiveAttributes(_0x53a8b2);emitCampaignSummary(_0x53a8b2);loggerSyncQueueSummary['debug'](_0x9bdd0a,util['inspect'](_0x5cdb5c,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x39aef2){if(_0x39aef2['sendMessageOneNotActive']){if(_0x39aef2[_0x3fc3('0x80')]===0x0){_0x39aef2[_0x3fc3('0x81')]=![];_0x39aef2[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0x3fc3('0x82'),_0x39aef2[_0x3fc3('0x48')],_0x3fc3('0x83'));}else{_0x39aef2[_0x3fc3('0x6c')]=utils['CAMPAIGN_STATUS'][_0x3fc3('0x84')];loggerSyncQueueSummary[_0x3fc3('0x43')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x39aef2[_0x3fc3('0x48')],'is\x20disactive');}emitCampaignSummary(_0x39aef2);}}function myreject(_0x1078c8){return function(_0xadde65){return _0x1078c8(msgResponse(_0x3fc3('0x85'),_0x3fc3('0x86'),JSON[_0x3fc3('0x74')](_0xadde65)));};}Dialer[_0x3fc3('0x1a')][_0x3fc3('0x87')]=function(_0x49dc68){return!_[_0x3fc3('0x40')](_0x49dc68)&&_0x49dc68&&!_['isUndefined'](_0x49dc68[_0x3fc3('0x48')])&&!_[_0x3fc3('0x40')](_0x49dc68[_0x3fc3('0x88')])&&_0x49dc68['active']&&(this[_0x3fc3('0x21')][util[_0x3fc3('0x46')](_0x3fc3('0x89'),_0x49dc68[_0x3fc3('0x48')])]['status']===_0x3fc3('0x8a')||this[_0x3fc3('0x21')][util[_0x3fc3('0x46')](_0x3fc3('0x89'),_0x49dc68['name'])][_0x3fc3('0x8b')]==='unmonitored');};Dialer['prototype']['checkIsTrunkReachable']=function(_0x4d5ce9){var _0x3df1c6=this;return function(){if(!_0x3df1c6[_0x3fc3('0x87')](_0x4d5ce9[_0x3fc3('0x8c')])){if(!_0x3df1c6[_0x3fc3('0x87')](_0x4d5ce9['TrunkBackup'])){_0x4d5ce9[_0x3fc3('0x6c')]=utils['CAMPAIGN_STATUS'][_0x3fc3('0x8d')];throw _0x4d5ce9[_0x3fc3('0x48')]+_0x3fc3('0x8e');}}};};Dialer['prototype'][_0x3fc3('0x8f')]=function(_0xefc17,_0x300cbe,_0x5ad812,_0x5925f9){var _0x3d9327=this;return function(){var _0xe6bd3e=!![];return _0x3d9327[_0x3fc3('0x90')](_0xefc17,_0x300cbe,_0x5ad812,_0x5925f9,_0xe6bd3e);};};Dialer['prototype'][_0x3fc3('0x91')]=function(_0x116bb5,_0x71f1c3,_0x53c95d,_0x421809){var _0xaf2467=this;return function(){var _0x28de0f=![];return _0xaf2467[_0x3fc3('0x90')](_0x116bb5[_0x3fc3('0x78')],_0x71f1c3,_0x53c95d,_0x421809,_0x28de0f);};};Dialer['prototype']['ifTimeIvr']=function(_0x395036,_0x34985c,_0x2fd1f8,_0x18a6c3,_0x1174f){var _0x38b0ad=[];return new Promise(function(_0x3096de,_0x13dbed){if(!isNotNull(_0x395036)){_0x18a6c3[_0x3fc3('0x6c')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0x13dbed(msgResponse(_0x3fc3('0x92'),_0x3fc3('0x93'),_0x2fd1f8+_0x3fc3('0x94')));}if(_[_0x3fc3('0x4a')](_0x395036)){_0x18a6c3[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x95')];return _0x13dbed(msgResponse('ifTime',_0x3fc3('0x93'),_0x2fd1f8+_0x3fc3('0x96')));}if(_0x34985c&&_[_0x3fc3('0x40')](config[_0x3fc3('0x97')][_0x34985c])){_0x18a6c3[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x98')];return _0x13dbed(msgResponse(_0x3fc3('0x92'),_0x3fc3('0x93'),_0x2fd1f8+'\x20Timezone\x20unknow\x20'+_0x34985c));}if(_[_0x3fc3('0x99')](_0x395036)){for(var _0x41e8d4=0x0;_0x41e8d4<_0x395036[_0x3fc3('0x9a')];_0x41e8d4+=0x1){_0x38b0ad['push'](ami[_0x3fc3('0x9b')]({'action':_0x3fc3('0x9c'),'command':util[_0x3fc3('0x46')](_0x3fc3('0x9d'),_0x395036[_0x41e8d4][_0x3fc3('0x9e')],!_['isUndefined'](config[_0x3fc3('0x97')][_0x34985c])?_0x34985c:'')})[_0x3fc3('0x9f')](function(_0xf413e8){return _0xf413e8[_0x3fc3('0xa0')][_0x3fc3('0xa1')](_0x3fc3('0xa2'))>=0x0;})[_0x3fc3('0xa3')](myreject(_0x13dbed)));}}else{_0x38b0ad['push'](ami[_0x3fc3('0x9b')]({'action':_0x3fc3('0x9c'),'command':util[_0x3fc3('0x46')]('iftime\x20%s,%s',_0x395036,!_['isUndefined'](config[_0x3fc3('0x97')][_0x34985c])?_0x34985c:'')})['then'](function(_0x59f613){return _0x59f613[_0x3fc3('0xa0')]['indexOf'](_0x3fc3('0xa2'))>=0x0;})['catch'](myreject(_0x13dbed)));}Promise['all'](_0x38b0ad)[_0x3fc3('0x9f')](function(_0x1128bc){var _0x3b98be=_[_0x3fc3('0xa4')](_0x1128bc);if(_0x3b98be){return _0x3096de(_0x3b98be);}else{_0x18a6c3[_0x3fc3('0x6c')]=_0x1174f?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x3fc3('0x68')][_0x3fc3('0xa5')];return _0x13dbed(msgResponse(_0x3fc3('0xa6'),_0x3fc3('0x93'),_0x3fc3('0xa7')+_0x1174f+'\x20'+_0x2fd1f8+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x395036,{'showHidden':![],'depth':null})+_0x3fc3('0xa8')+_0x34985c));}})[_0x3fc3('0xa3')](function(_0x3d5c96){return _0x13dbed(msgResponse('ifTime',_0x3fc3('0x93'),JSON[_0x3fc3('0x74')](_0x3d5c96)));});});};Dialer[_0x3fc3('0x1a')]['loopCampaigns']=function(){var _0x28d96c=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x3fc3('0x9f')](function(){setInterval(function(){_0x28d96c['syncCampaigns']();},0x3e8);});};Dialer[_0x3fc3('0x1a')][_0x3fc3('0xa9')]=function(){var _0x29460d=this;var _0x4c8754;for(var _0x493b07 in this[_0x3fc3('0x1f')]){if(typeof this[_0x3fc3('0x1f')][_0x493b07]!==_0x3fc3('0xaa')){_0x4c8754=this[_0x3fc3('0x1f')][_0x493b07];if(utils[_0x3fc3('0x7d')](_0x4c8754)&&utils['isIVRCampaignActive'](_0x4c8754)){_0x4c8754[_0x3fc3('0x81')]=!![];Promise['resolve']()[_0x3fc3('0x9f')](checkIsIVRCampaignActive(_0x4c8754))[_0x3fc3('0x9f')](checkInterval(_0x4c8754))[_0x3fc3('0x9f')](_0x29460d['checkIsTrunkReachable'](_0x4c8754))[_0x3fc3('0x9f')](_0x29460d[_0x3fc3('0x8f')](_0x4c8754['dialGlobalInterval'],_0x4c8754[_0x3fc3('0xab')],_0x4c8754['name'],_0x4c8754))[_0x3fc3('0x9f')](_0x29460d[_0x3fc3('0x91')](_0x4c8754[_0x3fc3('0x76')],_0x4c8754[_0x3fc3('0xab')],_0x4c8754[_0x3fc3('0x48')],_0x4c8754))[_0x3fc3('0x9f')](_0x29460d[_0x3fc3('0xac')](_0x4c8754))[_0x3fc3('0xa3')](loggerCatchQueueSummary(_0x3fc3('0xad'),_0x4c8754));}else{notSendMessagesCampaign(_0x4c8754);}}}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0xae')]=function(_0x123412){if(_0x123412[_0x3fc3('0xaf')]!==_0x3fc3('0xb0')){clearPredictiveAttributes(_0x123412);}switch(_0x123412[_0x3fc3('0xaf')]){case _0x3fc3('0xb1'):this[_0x3fc3('0xb2')](_0x123412,0x1);break;case _0x3fc3('0xb3'):this[_0x3fc3('0xb2')](_0x123412,_0x123412[_0x3fc3('0xb4')]);break;case _0x3fc3('0xb0'):this[_0x3fc3('0xb0')](_0x123412);break;case _0x3fc3('0xa'):this['handlePower'](_0x123412,0x1);break;default:logger[_0x3fc3('0x65')](_0x3fc3('0xb5'),_0x123412[_0x3fc3('0x48')],_0x3fc3('0xb6'));}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x92')]=function(_0x52d595,_0xbc1c73){var _0x3fe09a=_0x52d595[_0x3fc3('0xab')];var _0x91df36=_0xbc1c73?_0x52d595[_0x3fc3('0xb7')]:_0x52d595[_0x3fc3('0x76')][_0x3fc3('0x78')];logger[_0x3fc3('0xb8')](_0x3fc3('0xb9'),_0x91df36,_0x3fe09a,_0x52d595[_0x3fc3('0x48')],util['format'](_0x3fc3('0xba'),_0x52d595[_0x3fc3('0x48')],_0x52d595['id']));var _0x5badec=null;return Interval[_0x3fc3('0xbb')](_0x91df36,_0x3fe09a)[_0x3fc3('0x9f')](function(_0x1df017){if(_0x1df017===!![]){return _0x1df017;}else{_0x52d595[_0x3fc3('0x6c')]=_0xbc1c73?utils[_0x3fc3('0x68')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x3fc3('0x68')][_0x3fc3('0xa5')];_0x5badec=msgResponse(_0x3fc3('0xa6'),'Failure',_0x3fc3('0xa7')+_0xbc1c73+'\x20'+_0x52d595['name']+'\x20Interval\x20is\x20overtime:\x20'+util[_0x3fc3('0x45')](_0x91df36,{'showHidden':![],'depth':null})+_0x3fc3('0xa8')+_0x3fe09a);}if(_0x5badec!==null){logger[_0x3fc3('0xb8')](_0x3fc3('0xbc'),_0x5badec);_0x5badec['isGlobal']=_0xbc1c73;throw _0x5badec;}})[_0x3fc3('0xa3')](function(_0x56fbc7){logger[_0x3fc3('0x65')](_0x3fc3('0xbd'),_0x56fbc7);throw msgResponse(_0x3fc3('0x85'),_0x3fc3('0x86'),util[_0x3fc3('0x45')](_0x56fbc7,{'showHidden':![],'depth':null}));});};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x2e')]=function(_0x51b321){if(this[_0x3fc3('0x1e')][_0x51b321['queue']]){if(this[_0x3fc3('0x25')][_0x51b321[_0x3fc3('0xbe')]]&&this['uniqueId'][_0x51b321[_0x3fc3('0xbe')]][_0x3fc3('0x41')]!==_0x3fc3('0xbf')){this[_0x3fc3('0xc0')](this[_0x3fc3('0x1e')][_0x51b321[_0x3fc3('0xc1')]]);this[_0x3fc3('0x25')][_0x51b321[_0x3fc3('0xbe')]][_0x3fc3('0xc2')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));}}};Dialer[_0x3fc3('0x1a')]['syncAgentComplete']=function(_0x3ba94a){var _0x1d12b7=this[_0x3fc3('0x25')][_0x3ba94a['uniqueid']];if(this['voiceQueues'][_0x3ba94a[_0x3fc3('0xc1')]]){if(_0x1d12b7&&_0x1d12b7[_0x3fc3('0x41')]!=='ivr'){delete this[_0x3fc3('0x25')][_0x3ba94a[_0x3fc3('0xbe')]];this['voiceQueues'][_0x3ba94a['queue']][_0x3fc3('0xc4')]+=0x1;var _0x317b26=new AgentComplete(_0x1d12b7,_0x3ba94a);if(_0x3ba94a[_0x3fc3('0xc5')]===_0x3fc3('0xc6')){_0x317b26[_0x3fc3('0xc7')]=this[_0x3fc3('0x1e')][_0x3ba94a['queue']][_0x3fc3('0xc8')]&&this[_0x3fc3('0x1e')][_0x3ba94a[_0x3fc3('0xc1')]][_0x3fc3('0xc9')]?moment()[_0x3fc3('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x3fc3('0xca')](_0x317b26)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xcb')));hopperUtils[_0x3fc3('0xcc')](_0x317b26)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xcd')));}}};Dialer['prototype'][_0x3fc3('0x30')]=function(_0x1443de){var _0x5f28e1=this['uniqueId'][_0x1443de[_0x3fc3('0xbe')]];var _0x200abb=this;var _0x5f533c=![];var _0x4825ba;var _0x373093;if(this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]]){if(_0x5f28e1&&_0x5f28e1[_0x3fc3('0x41')]!==_0x3fc3('0xbf')){delete this[_0x3fc3('0x25')][_0x1443de[_0x3fc3('0xbe')]];this['updateOriginated'](this[_0x3fc3('0x1e')][_0x1443de['queue']]);_0x5f28e1[_0x3fc3('0xce')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));var _0x4e811d=new QueueCallerAbandon(_0x5f28e1,_0x1443de);if(utils[_0x3fc3('0x62')](_0x5f28e1['droptime'],_0x5f28e1[_0x3fc3('0xcf')])>=_0x5f28e1[_0x3fc3('0xd0')]){this[_0x3fc3('0x1e')][_0x1443de['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xd1')]+=0x1;this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xd2')]+=0x1;_0x4e811d['state']=0xa;_0x4e811d[_0x3fc3('0x70')]='Drop';_0x4e811d['dropreason']=_0x3fc3('0xd3');_0x4e811d['agiafterat']=this['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xc8')]?moment()[_0x3fc3('0x46')](_0x3fc3('0xc3')):undefined;_0x4e811d[_0x3fc3('0xd4')]+=0x1;_0x4e811d[_0x3fc3('0xd5')]+=0x1;_0x4825ba=this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]]['dialDropRetryFrequency'];_0x373093=this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xd6')];hopperUtils[_0x3fc3('0xd7')](_0x4e811d,_0x4e811d[_0x3fc3('0x6f')],_0x5f28e1['voiceQueue'])[_0x3fc3('0x9f')](function(_0x4893d4){_0x5f533c=_0x4893d4[_0x3fc3('0xd8')]==0x1;if(_0x4e811d[_0x3fc3('0xd4')]>=_0x200abb['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]]['dialDropMaxRetry']){_0x200abb[_0x3fc3('0xd9')](_0x4e811d,_0x4893d4[_0x3fc3('0xd8')]);}else{hopperUtils[_0x3fc3('0xda')]({'active':![],'countdropretry':_0x4e811d['countdropretry'],'scheduledat':moment()[_0x3fc3('0xdb')](_0x200abb[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]]['dialDropRetryFrequency'],_0x3fc3('0xdc'))['format'](_0x3fc3('0xc3')),'ContactId':_0x5f28e1[_0x3fc3('0xdd')],'ListId':_0x5f28e1[_0x3fc3('0xde')],'VoiceQueueId':_0x5f28e1[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x5f28e1[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact][Drop]'));var _0x158c44=new History(_0x4e811d);_0x158c44[_0x3fc3('0x6f')]=0xa;_0x158c44[_0x3fc3('0x70')]=_0x3fc3('0xe1');_0x158c44[_0x3fc3('0x71')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));_0x158c44[_0x3fc3('0xe2')]=_0x158c44[_0x3fc3('0x71')];_0x158c44[_0x3fc3('0xe3')]=_0x4e811d[_0x3fc3('0xe3')];_0x158c44[_0x3fc3('0xe4')]=_0x4e811d[_0x3fc3('0xe4')];hopperUtils[_0x3fc3('0xca')](_0x158c44)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xe5')));}})[_0x3fc3('0x9f')](function(){if(_0x5f533c)hopperUtils[_0x3fc3('0xe6')](_0x4e811d,_0x4825ba,_0x373093)[_0x3fc3('0x9f')](function(){return 0x1;});});}else{this[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0x53')]+=0x1;this['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xe7')]+=0x1;_0x4e811d['state']=0xb;_0x4e811d[_0x3fc3('0x70')]=_0x3fc3('0xe8');_0x4e811d['dropreason']=_0x3fc3('0xe9');_0x4e811d[_0x3fc3('0xea')]+=0x1;_0x4e811d[_0x3fc3('0xd5')]+=0x1;_0x4825ba=this['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xeb')];_0x373093=this['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xd6')];hopperUtils[_0x3fc3('0xd7')](_0x4e811d,_0x4e811d[_0x3fc3('0x6f')],_0x5f28e1['voiceQueue'])[_0x3fc3('0x9f')](function(_0xf9a468){if(_0x4e811d[_0x3fc3('0xea')]>=_0x200abb['voiceQueues'][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xec')]){_0x200abb[_0x3fc3('0xd9')](_0x4e811d,_0xf9a468[_0x3fc3('0xd8')]);}else{hopperUtils[_0x3fc3('0xda')]({'active':![],'countabandonedretry':_0x4e811d[_0x3fc3('0xea')],'scheduledat':moment()[_0x3fc3('0xdb')](_0x200abb[_0x3fc3('0x1e')][_0x1443de[_0x3fc3('0xc1')]][_0x3fc3('0xeb')],_0x3fc3('0xdc'))[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x5f28e1[_0x3fc3('0xdd')],'ListId':_0x5f28e1[_0x3fc3('0xde')],'VoiceQueueId':_0x5f28e1[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x5f28e1[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xed')));var _0x275b04=new History(_0x4e811d);_0x275b04[_0x3fc3('0x6f')]=0xb;_0x275b04[_0x3fc3('0x70')]=_0x3fc3('0xe8');_0x275b04['starttime']=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));_0x275b04[_0x3fc3('0xe2')]=_0x275b04[_0x3fc3('0x71')];_0x275b04[_0x3fc3('0xe3')]=_0x4e811d[_0x3fc3('0xe3')];_0x275b04['calleridnum']=_0x4e811d[_0x3fc3('0xe4')];hopperUtils[_0x3fc3('0xca')](_0x275b04)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xee')));}})[_0x3fc3('0x9f')](function(){if(_0x5f533c)hopperUtils['swapAdditionalPhones'](_0x4e811d,_0x4825ba,_0x373093)[_0x3fc3('0x9f')](function(){return 0x1;});});}}}};Dialer[_0x3fc3('0x1a')]['syncNewExten']=function(_0x34d0cd){if(this['actions'][_0x34d0cd[_0x3fc3('0xbe')]]){this[_0x3fc3('0x24')][_0x34d0cd['uniqueid']][_0x3fc3('0xef')]=_0x34d0cd[_0x3fc3('0xef')];}if(this['uniqueId'][_0x34d0cd[_0x3fc3('0xbe')]]){this[_0x3fc3('0x25')][_0x34d0cd[_0x3fc3('0xbe')]][_0x3fc3('0xef')]=_0x34d0cd[_0x3fc3('0xef')];}};Dialer[_0x3fc3('0x1a')]['syncQueueMember']=function(_0x15b986){if(!this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]){return;}var _0x552116=this[_0x3fc3('0x1e')][this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]][_0x3fc3('0xf1')]||_0x3fc3('0xf2');if(_0x552116===_0x3fc3('0xf3')){if(this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]&&_[_0x3fc3('0xf4')](this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]['locked'])&&_0x15b986[_0x3fc3('0x8b')]==='1'&&_0x15b986[_0x3fc3('0xf5')]==='0'){if(this[_0x3fc3('0x20')][_0x15b986['stateinterface']]){if(!this[_0x3fc3('0x20')][_0x15b986[_0x3fc3('0xf6')]][_0x3fc3('0xf7')]){this[_0x3fc3('0x20')][_0x15b986[_0x3fc3('0xf6')]][_0x3fc3('0xf7')]=!![];this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]['locked']=!![];this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]][_0x3fc3('0xf6')]=_0x15b986[_0x3fc3('0xf6')];}}}}else if(_0x552116==='rrmemory'){if(this[_0x3fc3('0x24')][_0x15b986['actionid']]){if(this['agents'][_0x15b986['stateinterface']]){this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]][_0x3fc3('0xf6')]=_0x15b986[_0x3fc3('0xf6')];if(_[_0x3fc3('0xf4')](this[_0x3fc3('0x2a')][this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]['queue']])){this[_0x3fc3('0x2a')][this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]]['queue']]=[];}this[_0x3fc3('0x2a')][this[_0x3fc3('0x24')][_0x15b986[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]][_0x3fc3('0xf8')](_['merge'](_['pick'](this[_0x3fc3('0x24')][_0x15b986['actionid']],[_0x3fc3('0xf9'),_0x3fc3('0xf6')]),{'status':_0x15b986[_0x3fc3('0x8b')],'paused':_0x15b986[_0x3fc3('0xf5')]}));}}}};Dialer[_0x3fc3('0x1a')]['syncQueueStatusComplete']=function(_0x194a2c){if(!this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]){return;}var _0x5192f0=this;var _0x2b1855=this['voiceQueues'][this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]];var _0x4d9fca=_0x2b1855['strategy']||_0x3fc3('0xf2');if(_0x4d9fca===_0x3fc3('0xf3')){if(this[_0x3fc3('0x24')][_0x194a2c['actionid']]&&this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]['stateinterface']){this[_0x3fc3('0x1d')][_0x3fc3('0xfa')](this['actions'][_0x194a2c['actionid']][_0x3fc3('0xf9')],this['actions'][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xf6')])[_0x3fc3('0xa3')](function(_0x4bc226){logger[_0x3fc3('0x65')](_0x3fc3('0xfb'),util[_0x3fc3('0x45')](_0x4bc226,{'showHidden':![],'depth':null}));})[_0x3fc3('0xfc')](function(){_0x5192f0[_0x3fc3('0xc0')](_0x5192f0[_0x3fc3('0x1e')][_0x5192f0['actions'][_0x194a2c[_0x3fc3('0xf0')]]['queue']]);_0x5192f0[_0x3fc3('0x20')][_0x5192f0[_0x3fc3('0x24')][_0x194a2c['actionid']]['stateinterface']]['locked']=![];delete _0x5192f0[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]];unlockQueueStatus(_0x2b1855);});}else{this['updateOriginated'](this[_0x3fc3('0x1e')][this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]['queue']]);hopperUtils[_0x3fc3('0xda')]({'active':![],'ContactId':this['actions'][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xdd')],'ListId':this[_0x3fc3('0x24')][_0x194a2c['actionid']][_0x3fc3('0xde')],'VoiceQueueId':this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xdf')]||undefined,'CampaignId':this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xe0')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]];unlockQueueStatus(_0x2b1855);}}else if(_0x4d9fca===_0x3fc3('0xf2')){var _0x2b86ae;if(this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]&&!_[_0x3fc3('0x4a')](this[_0x3fc3('0x2a')][this['actions'][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]])){if(this[_0x3fc3('0x2b')][_0x5192f0[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]]){this[_0x3fc3('0x2b')][_0x5192f0[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]['queue']]=this[_0x3fc3('0x2b')][this['actions'][_0x194a2c['actionid']][_0x3fc3('0xc1')]]?this['queueBookedRR'][this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]]:this[_0x3fc3('0x2a')][this['actions'][_0x194a2c['actionid']][_0x3fc3('0xc1')]]?this[_0x3fc3('0x2a')][this[_0x3fc3('0x24')][_0x194a2c['actionid']][_0x3fc3('0xc1')]]['_rr']||0x0:0x0;}this[_0x3fc3('0x2a')][this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]][_0x3fc3('0xc1')]][_0x3fc3('0xfd')]=this[_0x3fc3('0x2b')][this[_0x3fc3('0x24')][_0x194a2c[_0x3fc3('0xf0')]]['queue']];for(var _0x52445a=0x0;_0x52445a=_0x6b8036[_0x3fc3('0x125')]){_0x329003[_0x3fc3('0x126')](_0xffe864,_0x561d16,_0x2b77a1,_0x3fc3('0x127'));}else{if(_0xffe864[_0x3fc3('0x11e')]>=_0x6b8036[_0x3fc3('0x128')]){_0x329003[_0x3fc3('0x129')](_0xffe864,_0x561d16,_0x2b77a1,_0x3fc3('0x12a'));}else{hopperUtils[_0x3fc3('0xda')]({'active':![],'countmachineretry':_0xffe864[_0x3fc3('0x11e')],'scheduledat':moment()[_0x3fc3('0xdb')](_0x6b8036['dialMachineRetryFrequency'],_0x3fc3('0xdc'))[_0x3fc3('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xffe864['ContactId'],'ListId':_0xffe864[_0x3fc3('0xde')],'VoiceQueueId':_0xffe864[_0x3fc3('0xdf')]||undefined,'CampaignId':_0xffe864[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact][Machine]'));_0x561d16({'reschedule':0x1});}}});}if(_0x58f6b1[_0x3fc3('0x41')]===_0x3fc3('0xbf')&&this['campaigns'][_0x58f6b1[_0x3fc3('0xc1')]]['dialAMDActive']&&_0xdc1c03[_0x3fc3('0x110')]===_0x3fc3('0x111')){delete this['uniqueId'][_0xdc1c03['uniqueid']];this[_0x3fc3('0xc0')](this[_0x3fc3('0x1f')][_0x58f6b1[_0x3fc3('0xc1')]]);_0x50bd8b=new Hangup(_0x58f6b1,_0xdc1c03);_0x50bd8b[_0x3fc3('0x6f')]=0x12;_0x50bd8b['statedesc']=_0x3fc3('0x113');_0x50bd8b[_0x3fc3('0x114')]='AMD';ami[_0x3fc3('0x116')](_0x3fc3('0x117'),ut['buildObj'](_0x50bd8b,_0x3fc3('0x118')));this[_0x3fc3('0x119')](_0x50bd8b,_0x3fc3('0x12b'),_0x3fc3('0x12c'));}if(_0x58f6b1[_0x3fc3('0x41')]===_0x3fc3('0xbf')&&this[_0x3fc3('0x1f')][_0x58f6b1[_0x3fc3('0xc1')]][_0x3fc3('0x10f')]&&_0xdc1c03['value']===_0x3fc3('0x11c')){return new Promise(function(_0x65e61b,_0x424bb5){delete _0x329003[_0x3fc3('0x25')][_0xdc1c03[_0x3fc3('0xbe')]];_0x329003[_0x3fc3('0xc0')](_0x329003[_0x3fc3('0x1f')][_0x58f6b1[_0x3fc3('0xc1')]]);_0x329003['campaigns'][_0x58f6b1[_0x3fc3('0xc1')]][_0x3fc3('0xc4')]+=0x1;_0x329003[_0x3fc3('0x1f')][_0x58f6b1[_0x3fc3('0xc1')]][_0x3fc3('0x112')]+=0x1;var _0x1f2b9e=_0x329003[_0x3fc3('0x1f')][_0x58f6b1[_0x3fc3('0xc1')]];var _0x58dc5e=new Hangup(_0x58f6b1,_0xdc1c03);_0x58dc5e[_0x3fc3('0x6f')]=0x13;_0x58dc5e[_0x3fc3('0x70')]='Machine';_0x58dc5e['membername']=_0x3fc3('0x115');_0x58dc5e[_0x3fc3('0x11e')]+=0x1;_0x58dc5e[_0x3fc3('0xd5')]+=0x1;_0x58dc5e[_0x3fc3('0x118')]=!![];ami[_0x3fc3('0x116')](_0x3fc3('0x117'),ut[_0x3fc3('0x11f')](_0x58dc5e,_0x3fc3('0x118')));hopperUtils['createHistory'](_0x58dc5e)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x120')));if(_0x58dc5e['countbusyretry']+_0x58dc5e[_0x3fc3('0x122')]+_0x58dc5e[_0x3fc3('0x12d')]+_0x58dc5e[_0x3fc3('0x123')]+_0x58dc5e[_0x3fc3('0xd4')]+_0x58dc5e[_0x3fc3('0xea')]+_0x58dc5e[_0x3fc3('0x11e')]+_0x58dc5e[_0x3fc3('0x124')]>=_0x1f2b9e['dialGlobalMaxRetry']){_0x329003[_0x3fc3('0x126')](_0x58dc5e,_0x65e61b,_0x424bb5,'reason19\x20machine....');}else{if(_0x58dc5e[_0x3fc3('0x11e')]>=_0x1f2b9e[_0x3fc3('0x128')]){_0x329003[_0x3fc3('0x129')](_0x58dc5e,_0x65e61b,_0x424bb5,_0x3fc3('0x12a'));}else{hopperUtils[_0x3fc3('0xda')]({'active':![],'countmachineretry':_0x58dc5e[_0x3fc3('0x11e')],'scheduledat':moment()['add'](_0x1f2b9e[_0x3fc3('0x12e')],_0x3fc3('0xdc'))[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x58dc5e['ContactId'],'ListId':_0x58dc5e[_0x3fc3('0xde')],'VoiceQueueId':_0x58dc5e[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x58dc5e['CampaignId']||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x12f')));_0x65e61b({'reschedule':0x1});}}});}}};Dialer[_0x3fc3('0x1a')]['syncHangup']=function(_0x429137){var _0x51ac83=this['uniqueId'][_0x429137[_0x3fc3('0xbe')]];var _0x56b742;if(_0x51ac83&&_0x51ac83[_0x3fc3('0x41')]==='ivr'){delete this[_0x3fc3('0x25')][_0x429137[_0x3fc3('0xbe')]];this[_0x3fc3('0xc0')](this[_0x3fc3('0x1f')][_0x51ac83[_0x3fc3('0xc1')]]);this[_0x3fc3('0x1f')][_0x51ac83['queue']][_0x3fc3('0x130')]+=0x1;_0x56b742=new Hangup(_0x51ac83,_0x429137);hopperUtils['createHistory'](_0x56b742)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x131')));hopperUtils[_0x3fc3('0xcc')](_0x56b742)['catch'](loggerCatch(_0x3fc3('0x132')));}if(_0x51ac83&&_0x51ac83[_0x3fc3('0x41')]!=='ivr'&&isNotNull(this[_0x3fc3('0x1e')][_0x51ac83['queue']][_0x3fc3('0x133')])){delete this['uniqueId'][_0x429137[_0x3fc3('0xbe')]];this['updateOriginated'](this[_0x3fc3('0x1e')][_0x51ac83['queue']]);this[_0x3fc3('0x1e')][_0x51ac83[_0x3fc3('0xc1')]][_0x3fc3('0xc4')]+=0x1;this[_0x3fc3('0x1e')][_0x51ac83[_0x3fc3('0xc1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x56b742=new Hangup(_0x51ac83,_0x429137);_0x56b742['state']=0x10;_0x56b742['statedesc']=_0x3fc3('0x134');_0x56b742[_0x3fc3('0x114')]=_0x3fc3('0x135');hopperUtils[_0x3fc3('0xca')](_0x56b742)['catch'](loggerCatch(_0x3fc3('0x131')));hopperUtils[_0x3fc3('0xcc')](_0x56b742)['catch'](loggerCatch(_0x3fc3('0x132')));}if(_0x51ac83&&_0x51ac83[_0x3fc3('0x41')]!==_0x3fc3('0xbf')&&!isNotNull(this[_0x3fc3('0x1e')][_0x51ac83[_0x3fc3('0xc1')]][_0x3fc3('0x133')])){delete this[_0x3fc3('0x25')][_0x429137['uniqueid']];this[_0x3fc3('0xc0')](this[_0x3fc3('0x1e')][_0x51ac83[_0x3fc3('0xc1')]]);this[_0x3fc3('0x1e')][_0x51ac83[_0x3fc3('0xc1')]][_0x3fc3('0x136')]+=0x1;_0x56b742=new Hangup(_0x51ac83,_0x429137);_0x56b742[_0x3fc3('0x6f')]=0xc;_0x56b742[_0x3fc3('0x70')]=_0x429137[_0x3fc3('0x137')];_0x56b742[_0x3fc3('0x114')]=_0x3fc3('0x138');hopperUtils[_0x3fc3('0xca')](_0x56b742)[_0x3fc3('0xa3')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x56b742)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x132')));}};Dialer['prototype'][_0x3fc3('0x34')]=function(_0x419d97){var _0x5d1b60=this;if(!_0x5d1b60[_0x3fc3('0x2c')][_0x419d97['name']]){_0x5d1b60[_0x3fc3('0x2c')][_0x419d97['name']]={'running':![]};}else if(_0x5d1b60[_0x3fc3('0x2c')][_0x419d97[_0x3fc3('0x48')]][_0x3fc3('0x139')]===!![]){return;}else if(_0x5d1b60['queuesSummary'][_0x419d97[_0x3fc3('0x48')]][_0x3fc3('0x139')]===![]){_0x5d1b60[_0x3fc3('0x2c')][_0x419d97['name']]['running']=!![];}var _0xf6f499=_0x5d1b60['voiceQueues'][_0x419d97[_0x3fc3('0x48')]];var _0x2f838c=_0xf6f499[_0x3fc3('0x6c')]!==utils['CAMPAIGN_STATUS'][_0x3fc3('0x7b')];var _0x47c3e7=utils[_0x3fc3('0x13a')](_0xf6f499);_0xf6f499['statusMessage']=utils[_0x3fc3('0x13b')](_0xf6f499,_0x5d1b60['trunks']);Promise[_0x3fc3('0x13c')]()[_0x3fc3('0x9f')](function(){if(_0xf6f499[_0x3fc3('0x13d')]===utils[_0x3fc3('0x68')][_0x3fc3('0x7b')]){if(_0x2f838c){clearPredictiveAttributes(_0xf6f499);_0x419d97[_0x3fc3('0x27')]=undefined;_0x419d97['startProgressive']=undefined;}if(_0xf6f499[_0x3fc3('0x13d')]===utils[_0x3fc3('0x68')][_0x3fc3('0x7b')]){_0x419d97[_0x3fc3('0x13e')]=0x0;_0x419d97['paused']=0x0;_0x419d97[_0x3fc3('0x13f')]=0x0;_0x419d97['talking']=0x0;_0x419d97['pTalking']=0x0;}}else if(_0xf6f499['statusMessage']===utils['CAMPAIGN_STATUS'][_0x3fc3('0x140')]&&!_0x47c3e7){return _0x5d1b60[_0x3fc3('0x92')](_0xf6f499,!![])['then'](function(){return _0x5d1b60[_0x3fc3('0x92')](_0xf6f499,![]);})[_0x3fc3('0x9f')](function(){return _0x5d1b60[_0x3fc3('0xae')](_0xf6f499);})['catch'](function(_0x50ffbf){loggerSyncQueueSummary[_0x3fc3('0x43')](_0x3fc3('0x141'),util[_0x3fc3('0x45')](_0x50ffbf,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xf6f499);});}else{clearPredictiveAttributes(_0xf6f499);}})[_0x3fc3('0x9f')](function(){var _0x488f8a=_0x419d97[_0x3fc3('0x142')](_0xf6f499);if(_0x488f8a||_0xf6f499[_0x3fc3('0x143')]){_0xf6f499[_0x3fc3('0x143')]=![];_0x419d97[_0x3fc3('0x144')](_0xf6f499);Object['assign'](_0xf6f499,_0x419d97);emitOutboundVoiceQueueSummary(_0x419d97);}_0x5d1b60['queuesSummary'][_0xf6f499['name']][_0x3fc3('0x139')]=![];})[_0x3fc3('0xa3')](function(_0x108102){logger[_0x3fc3('0x65')](_0x3fc3('0x141'),util['inspect'](_0x108102,{'showHidden':![],'depth':null}));_0x5d1b60[_0x3fc3('0x2c')][_0xf6f499[_0x3fc3('0x48')]][_0x3fc3('0x139')]=![];});};Dialer['prototype'][_0x3fc3('0x35')]=_[_0x3fc3('0x145')](function(){var _0x30b42d=_[_0x3fc3('0x146')](this['voiceQueues'],function(_0x170592){return _0x170592[_0x3fc3('0x147')];});var _0x18c2e5=_[_0x3fc3('0x146')](this['agents'],function(_0x4ef2c4){return _0x4ef2c4['online']&&_0x4ef2c4[_0x3fc3('0x8b')]===_0x3fc3('0x8a');});if(_0x30b42d['length']>0x0&&_0x18c2e5['length']>0x0){return Promise[_0x3fc3('0x13c')]()[_0x3fc3('0x9f')](cmHopper[_0x3fc3('0x148')](_[_0x3fc3('0x149')](_0x30b42d,'id'),previewRecallmeReminderInterval,_[_0x3fc3('0x149')](_0x18c2e5,'id')))[_0x3fc3('0x9f')](function(_0x351df3){for(var _0x220645=0x0;_0x220645<_0x351df3[_0x3fc3('0x9a')];_0x220645++){var _0x4fb9a8=_0x351df3[_0x220645][_0x3fc3('0x14a')]['name'];if(_0x4fb9a8)io['to'](util[_0x3fc3('0x46')](_0x3fc3('0x14b'),_0x4fb9a8))[_0x3fc3('0x116')](_0x3fc3('0x14c'),{'hopper':_0x351df3[_0x220645]});}})[_0x3fc3('0xa3')](function(_0x5485f5){logger['error'](_0x3fc3('0x14d'),_0x5485f5);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3fc3('0x1a')][_0x3fc3('0x14e')]=function(){var _0x40fbdb=this;setInterval(function(){_0x40fbdb[_0x3fc3('0x14f')](_0x40fbdb[_0x3fc3('0x25')],_0x3fc3('0x150'));_0x40fbdb[_0x3fc3('0x14f')](_0x40fbdb[_0x3fc3('0x24')],'[actions]');},0x32c8);};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x14f')]=function(_0xeb3cba,_0x49711f){var _0x3f70d9=this;for(var _0x5e189b in _0xeb3cba){if(typeof _0xeb3cba[_0x5e189b]!==_0x3fc3('0xaa')){this[_0x3fc3('0x1c')]['enqueue'](function(){if(!_[_0x3fc3('0xf4')](_0xeb3cba[_0x5e189b])){return ami[_0x3fc3('0x9b')]({'action':_0x3fc3('0x8b'),'channel':_0xeb3cba[_0x5e189b][_0x3fc3('0xef')]})[_0x3fc3('0xa3')](function(_0x47ebb7){if(_0x47ebb7[_0x3fc3('0x6c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xeb3cba[_0x5e189b]&&_0xeb3cba[_0x5e189b]['type']!==_0x3fc3('0xbf')){_0x3f70d9[_0x3fc3('0xc0')](_0x3f70d9[_0x3fc3('0x1e')][_0xeb3cba[_0x5e189b][_0x3fc3('0xc1')]]);logger[_0x3fc3('0x65')](_0x3fc3('0x151'),_0x49711f,_0x5e189b,_0xeb3cba[_0x5e189b][_0x3fc3('0xc1')]);delete _0xeb3cba[_0x5e189b];}if(_0xeb3cba[_0x5e189b]&&_0xeb3cba[_0x5e189b][_0x3fc3('0x41')]==='ivr'){_0x3f70d9[_0x3fc3('0xc0')](_0x3f70d9[_0x3fc3('0x1f')][_0xeb3cba[_0x5e189b][_0x3fc3('0xc1')]]);logger['error'](_0x3fc3('0x152'),_0x49711f,_0x5e189b,_0xeb3cba[_0x5e189b][_0x3fc3('0xc1')]);delete _0xeb3cba[_0x5e189b];}},0x2328);}});}});}}};Dialer['prototype'][_0x3fc3('0x153')]=function(_0x2da6b6){return Promise[_0x3fc3('0x13c')]()[_0x3fc3('0x9f')](voiceQueueRt['getVoiceQueueRtPauses'](_0x2da6b6))[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x154')));};Dialer[_0x3fc3('0x1a')][_0x3fc3('0xc0')]=function(_0x3b81ce){if(!_[_0x3fc3('0x40')](_0x3b81ce)&&_0x3b81ce!==null){if(typeof _0x3b81ce['originated']!=='undefined'){if(_0x3b81ce[_0x3fc3('0x80')]>0x0){_0x3b81ce[_0x3fc3('0x80')]-=0x1;}else{logger[_0x3fc3('0x65')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x3fc3('0x65')](_0x3fc3('0x155'));}};Dialer['prototype'][_0x3fc3('0x156')]=function(_0x2d8eed,_0xdacde2){var _0x563b2d=this;return function(_0xe09033){_0x563b2d['updateOriginated'](_0xdacde2);logger[_0x3fc3('0x65')](_0x2d8eed,util[_0x3fc3('0x45')](_0xe09033,{'showHidden':![],'depth':null}));};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x157')]=function(_0x4db501,_0x1641dc,_0x18e333){var _0x327614={'state':0x19,'statedesc':_0x3fc3('0x158')};this[_0x3fc3('0xc0')](_0x1641dc);this['saveInDb'](_[_0x3fc3('0x159')](_0x327614,_[_0x3fc3('0x75')](_0x18e333,[_0x3fc3('0xdd'),_0x3fc3('0xde'),_0x3fc3('0x15a'),_0x3fc3('0xdf'),_0x3fc3('0xe0')])),_0x3fc3('0x15b'),'[emptyContact]');logger[_0x3fc3('0x65')](_0x4db501);};Dialer['prototype'][_0x3fc3('0x119')]=function(_0x4da77a,_0x428593,_0x1e281c){hopperUtils['createHistory'](_0x4da77a)[_0x3fc3('0xa3')](loggerCatch(_0x428593));hopperUtils['moveContactManagedDialer'](_0x4da77a)[_0x3fc3('0xa3')](loggerCatch(_0x1e281c));};Dialer[_0x3fc3('0x1a')]['queueCallerAbandonCreateState']=function(_0x279a81,_0xce881d){hopperUtils[_0x3fc3('0xca')](_0x279a81)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xcb')));if(_0xce881d==0x0){hopperUtils['moveContactManagedDialer'](_0x279a81)[_0x3fc3('0xa3')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x14d')]=function(_0x4b32af){return Promise[_0x3fc3('0x13c')]()['then'](cmHopper[_0x3fc3('0x148')](_0x4b32af['id'],previewRecallmeReminderInterval))['then'](function(_0x2736ba){for(var _0x168c9f=0x0;_0x168c9f<_0x2736ba[_0x3fc3('0x9a')];_0x168c9f++){var _0x26b625=_0x2736ba[_0x168c9f][_0x3fc3('0x14a')]['name'];if(_0x26b625)io['to'](util['format'](_0x3fc3('0x14b'),_0x26b625))[_0x3fc3('0x116')]('user:dialPreviewRecallReminder',{'hopper':_0x2736ba[_0x168c9f]});}})['catch'](function(){});};Dialer[_0x3fc3('0x1a')]['launchHandleIvr']=function(_0x1cd4dc){var _0x3ff05a=this;return function(){_0x3ff05a[_0x3fc3('0x15c')](_0x1cd4dc);};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x15d')]=function(_0x146451,_0x161cb6){var _0x3049cb=this;var _0x1b85bd=uuid['v4']();this[_0x3fc3('0x24')][_0x1b85bd]=new Action(_0x146451,_0x161cb6,_0x1b85bd);return new Promise(function(_0x11e281,_0x10117b){if(_['isUndefined'](_0x146451)&&typeof _0x146451!==_0x3fc3('0x15e')){return _0x10117b(msgResponse('originate',_0x3fc3('0x93'),_0x3fc3('0x15f')));}if(_[_0x3fc3('0x40')](_0x161cb6['phone'])||_0x161cb6['phone']===null){return _0x10117b(msgResponse(_0x3fc3('0x160'),_0x3fc3('0x93'),_0x3fc3('0x161')));}var _0x248ade={'XMD-CALLERID':_0x3049cb['actions'][_0x1b85bd][_0x3fc3('0x162')](),'XMD-AGI':_0x146451[_0x3fc3('0x133')]?util[_0x3fc3('0x46')](_0x3fc3('0x163'),ipAgi,_0x146451[_0x3fc3('0x133')]):_0x3fc3('0x164'),'XMD-AGIAFTER':_0x146451[_0x3fc3('0xc8')]?util['format'](_0x3fc3('0x163'),ipAgi,_0x146451['dialQueueProject2']):_0x3fc3('0x164'),'XMD-QUEUE':utils[_0x3fc3('0x165')](_0x146451)?util[_0x3fc3('0x46')]('\x22%s,%s%s,,,%s\x22',_0x146451[_0x3fc3('0x48')],_0x146451['dialQueueOptions']||'',_0x146451['dialAgiAfterHangupAgent']?'c':'',_0x146451[_0x3fc3('0xd0')]||0x3):_0x3fc3('0x164'),'XMD-CONTACTID':_0x161cb6['ContactId'],'XMD-CDRTYPE':_0x3fc3('0x9'),'CALLERID(all)':_0x3049cb[_0x3fc3('0x24')][_0x1b85bd][_0x3fc3('0x162')](),'XMD-AMD':_0x146451[_0x3fc3('0x10f')]?_0x3fc3('0x140'):_0x3fc3('0x164'),'XMD-DESTINATION':_0x3fc3('0x166')};if(_0x146451[_0x3fc3('0x10f')]){_0x248ade[_0x3fc3('0x167')]=_0x146451['dialAMDInitialSilence']||0x9c4;_0x248ade['XMD-AMDGREETING']=_0x146451[_0x3fc3('0x168')]||0x5dc;_0x248ade[_0x3fc3('0x169')]=_0x146451[_0x3fc3('0x16a')]||0x320;_0x248ade['XMD-AMDTOTALANALYSISTIME']=_0x146451[_0x3fc3('0x16b')]||0x1388;_0x248ade[_0x3fc3('0x16c')]=_0x146451[_0x3fc3('0x16d')]||0x64;_0x248ade[_0x3fc3('0x16e')]=_0x146451[_0x3fc3('0x16f')]||0x32;_0x248ade[_0x3fc3('0x170')]=_0x146451['dialAMDMaximumNumberOfWords']||0x3;_0x248ade['XMD-AMDSILENCETHRESHOLD']=_0x146451['dialAMDSilenceThreshold']||0x100;_0x248ade['XMD-AMDMAXIMUMWORDLENGTH']=_0x146451[_0x3fc3('0x171')]||0x1388;}if(utils[_0x3fc3('0x165')](_0x146451)){_0x248ade[_0x3fc3('0x172')]=_0x161cb6[_0x3fc3('0xdf')];}else{_0x248ade['XMD-CAMPAIGNID']=_0x161cb6[_0x3fc3('0xe0')];}var _0x343416=utils[_0x3fc3('0x173')](_0x161cb6[_0x3fc3('0x174')]);Object[_0x3fc3('0x175')](_0x248ade,_0x343416);var _0x16204f=_0x3049cb[_0x3fc3('0x87')](_0x146451[_0x3fc3('0x8c')])?utils[_0x3fc3('0x176')](_0x146451[_0x3fc3('0x8c')]['callerid'],_0x146451[_0x3fc3('0x177')],_0x146451[_0x3fc3('0x178')]>0x0?utils[_0x3fc3('0x179')](_0x146451[_0x3fc3('0x17a')],_0x146451[_0x3fc3('0x178')]):_0x146451[_0x3fc3('0x17a')]):utils[_0x3fc3('0x176')](_[_0x3fc3('0xf4')](_0x146451[_0x3fc3('0x17b')])?_0x146451[_0x3fc3('0x8c')][_0x3fc3('0x17c')]:_0x146451[_0x3fc3('0x17b')][_0x3fc3('0x17c')],_0x146451['dialOriginateCallerIdName'],_0x146451['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x3fc3('0x179')](_0x146451[_0x3fc3('0x17a')],_0x146451['dialRandomLastDigitCallerIdNumber']):_0x146451[_0x3fc3('0x17a')]);if(_0x16204f){_0x248ade[_0x3fc3('0x17d')]=_0x3049cb[_0x3fc3('0x24')][_0x1b85bd][_0x3fc3('0x17e')]=utils[_0x3fc3('0x17f')](_0x16204f);_0x248ade[_0x3fc3('0x180')]=_0x161cb6[_0x3fc3('0x181')];}_0x146451[_0x3fc3('0x182')]=_0x248ade;return ami[_0x3fc3('0x9b')]({'actionid':_0x1b85bd,'action':_0x3fc3('0x160'),'channel':_0x3049cb['isTrunkReachable'](_0x146451[_0x3fc3('0x8c')])?util['format'](_0x3fc3('0x183'),_0x146451[_0x3fc3('0x8c')]['name'],isNotNull(_0x146451[_0x3fc3('0x184')])?_0x146451[_0x3fc3('0x184')][_0x3fc3('0x185')]()||'':'',_0x146451[_0x3fc3('0x186')]>0x0?_0x161cb6['phone']['substring'](_0x146451['dialCutDigit']):_0x161cb6[_0x3fc3('0x181')]):util[_0x3fc3('0x46')]('SIP/%s/%s%s',_[_0x3fc3('0xf4')](_0x146451[_0x3fc3('0x17b')])?_0x146451['Trunk'][_0x3fc3('0x48')]:_0x146451['TrunkBackup'][_0x3fc3('0x48')],isNotNull(_0x146451[_0x3fc3('0x184')])?_0x146451['dialPrefix'][_0x3fc3('0x185')]()||'':'',_0x146451[_0x3fc3('0x186')]>0x0?_0x161cb6[_0x3fc3('0x181')]['substring'](_0x146451[_0x3fc3('0x186')]):_0x161cb6[_0x3fc3('0x181')]),'callerid':_0x16204f,'Exten':'xcally-motion-dialer','Context':_0x3fc3('0x187'),'Priority':'1','variable':_0x248ade,'timeout':(_0x146451[_0x3fc3('0x188')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1b85bd})[_0x3fc3('0x9f')](function(_0x38b28c){return _0x11e281(_0x38b28c);})[_0x3fc3('0xa3')](function(_0x4c3aa8){_0x146451[_0x3fc3('0x189')]+=0x1;var _0x3c19e7=new History(_0x3049cb['actions'][_0x1b85bd]);logger['error'](util[_0x3fc3('0x46')](_0x3fc3('0x18a'),JSON['stringify'](_0x4c3aa8)));_0x3c19e7[_0x3fc3('0x6f')]=0xe;_0x3c19e7[_0x3fc3('0x70')]='OriginateError';_0x3c19e7[_0x3fc3('0x71')]=moment()['format'](_0x3fc3('0xc3'));_0x3c19e7[_0x3fc3('0xe2')]=_0x3c19e7[_0x3fc3('0x71')];hopperUtils[_0x3fc3('0xca')](_0x3c19e7)['catch'](loggerCatch(_0x3fc3('0x18b')));_0x3049cb[_0x3fc3('0xcc')](_0x3c19e7)[_0x3fc3('0xa3')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x3049cb['actions'][_0x1b85bd];return _0x10117b(msgResponse(_0x3fc3('0x160'),_0x3fc3('0x86'),_0x3fc3('0x18c')));});});});};Dialer['prototype'][_0x3fc3('0x18d')]=function(_0xe49628,_0x53ce2a,_0x1f18ff){var _0x27eeb9=new History(_0x53ce2a);if(_0x27eeb9['countbusyretry']+_0x27eeb9['countcongestionretry']+_0x27eeb9[_0x3fc3('0x12d')]+_0x27eeb9[_0x3fc3('0x123')]+_0x27eeb9[_0x3fc3('0xd4')]+_0x27eeb9[_0x3fc3('0xea')]+_0x27eeb9[_0x3fc3('0x11e')]+_0x27eeb9[_0x3fc3('0x124')]>=_0x1f18ff[_0x3fc3('0x125')]-0x1){return!![];}switch(_0xe49628){case 0x3:if(_0x27eeb9[_0x3fc3('0x12d')]>=_0x1f18ff[_0x3fc3('0x18e')]-0x1){return!![];}hopperUtils[_0x3fc3('0xda')]({'active':![],'countnoanswerretry':_0x27eeb9[_0x3fc3('0x12d')]+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff['dialNoAnswerRetryFrequency'],_0x3fc3('0xdc'))[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x27eeb9[_0x3fc3('0x121')]>=_0x1f18ff['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x27eeb9['countbusyretry']+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff['dialBusyRetryFrequency'],_0x3fc3('0xdc'))['format'](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9['CampaignId']||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x27eeb9[_0x3fc3('0x122')]>=_0x1f18ff[_0x3fc3('0x18f')]-0x1){return!![];}hopperUtils[_0x3fc3('0xda')]({'active':![],'countcongestionretry':_0x27eeb9[_0x3fc3('0x122')]+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff[_0x3fc3('0x190')],_0x3fc3('0xdc'))['format'](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x191')));break;case 0x0:if(_0x27eeb9[_0x3fc3('0x123')]>=_0x1f18ff[_0x3fc3('0x192')]-0x1){return!![];}else{hopperUtils[_0x3fc3('0xda')]({'active':![],'countnosuchnumberretry':_0x27eeb9[_0x3fc3('0x123')]+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff[_0x3fc3('0x193')],_0x3fc3('0xdc'))[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x27eeb9[_0x3fc3('0xd4')]>=_0x1f18ff[_0x3fc3('0x194')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x27eeb9[_0x3fc3('0xd4')]+=0x1,'scheduledat':moment()['add'](_0x1f18ff[_0x3fc3('0x195')],'minutes')[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9['ListId'],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x27eeb9[_0x3fc3('0xea')]>=_0x1f18ff[_0x3fc3('0xec')]-0x1){return!![];}hopperUtils[_0x3fc3('0xda')]({'active':![],'countabandonedretry':_0x27eeb9[_0x3fc3('0xea')]+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff['dialAbandonedRetryFrequency'],_0x3fc3('0xdc'))[_0x3fc3('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x27eeb9['ContactId'],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9['VoiceQueueId']||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xed')));break;case 0x13:if(_0x27eeb9[_0x3fc3('0x11e')]>=_0x1f18ff[_0x3fc3('0x128')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x27eeb9[_0x3fc3('0x11e')]+=0x1,'scheduledat':moment()[_0x3fc3('0xdb')](_0x1f18ff[_0x3fc3('0x12e')],_0x3fc3('0xdc'))['format'](_0x3fc3('0xc3')),'ContactId':_0x27eeb9['ContactId'],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9[_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x12f')));break;case 0x14:if(_0x27eeb9[_0x3fc3('0x124')]>=_0x1f18ff['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x3fc3('0xda')]({'active':![],'countagentrejectretry':_0x27eeb9[_0x3fc3('0x124')]+=0x1,'scheduledat':moment()['add'](_0x1f18ff[_0x3fc3('0x196')],'minutes')[_0x3fc3('0x46')](_0x3fc3('0xc3')),'ContactId':_0x27eeb9[_0x3fc3('0xdd')],'ListId':_0x27eeb9[_0x3fc3('0xde')],'VoiceQueueId':_0x27eeb9[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x27eeb9['CampaignId']||undefined})[_0x3fc3('0xa3')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x10a')]=function(_0x22f790,_0x5f3cdc,_0x57141c){var _0x277dcd=this;var _0x46bd51=new History(_0x22f790);var _0x5d4d38=![];var _0x525b5d;var _0x288647;return new Promise(function(_0x47b404,_0x200386){if(_[_0x3fc3('0x40')](_0x5f3cdc)&&typeof _0x5f3cdc!==_0x3fc3('0x15e')){return _0x200386(msgResponse(_0x3fc3('0x197'),_0x3fc3('0x93'),_0x3fc3('0x198')));}if(_['isUndefined'](_0x57141c)&&typeof _0x57141c!=='object'){return _0x200386(msgResponse('[callProgressDetecting]',_0x3fc3('0x93'),_0x3fc3('0x199')));}hopperUtils[_0x3fc3('0xd7')](_0x46bd51,_0x57141c[_0x3fc3('0xc5')],_0x5f3cdc)[_0x3fc3('0x9f')](function(_0x440a6c){if(_0x440a6c['additional']==0x1)_0x5d4d38=!![];switch(_0x57141c[_0x3fc3('0xc5')]){case'0':_0x5f3cdc[_0x3fc3('0x19a')]+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0x0;_0x46bd51[_0x3fc3('0x70')]=_0x3fc3('0x19b');_0x46bd51[_0x3fc3('0x123')]+=0x1;_0x46bd51[_0x3fc3('0xd5')]+=0x1;ami[_0x3fc3('0x116')](_0x3fc3('0x19c'),ut['buildObj'](_0x22f790,_0x3fc3('0x19d')));_0x525b5d=_0x5f3cdc[_0x3fc3('0x193')];_0x288647=_0x5f3cdc[_0x3fc3('0xd6')];hopperUtils[_0x3fc3('0xca')](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x120')));if(_0x277dcd[_0x3fc3('0x18d')](0x0,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51[_0x3fc3('0x123')]>=_0x5f3cdc[_0x3fc3('0x192')]){_0x277dcd[_0x3fc3('0x129')](_0x46bd51,_0x47b404,_0x200386,'reason\x200\x20no\x20such\x20number....');}else{_0x277dcd[_0x3fc3('0x126')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x19e'));}}break;case'3':_0x5f3cdc[_0x3fc3('0x19f')]+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0x3;_0x46bd51[_0x3fc3('0x70')]=_0x3fc3('0x1a0');_0x46bd51['countnoanswerretry']+=0x1;_0x46bd51['countglobal']+=0x1;var _0x3009b0=ut['buildNoAnswerEventPayload'](_0x22f790,_0x5f3cdc);ami[_0x3fc3('0x116')]('custom:agentnoanswer',_0x3009b0);_0x525b5d=_0x5f3cdc[_0x3fc3('0x1a1')];_0x288647=_0x5f3cdc[_0x3fc3('0xd6')];hopperUtils[_0x3fc3('0xca')](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1a2')));if(_0x277dcd[_0x3fc3('0x18d')](0x3,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51[_0x3fc3('0x12d')]>=_0x5f3cdc[_0x3fc3('0x18e')]){_0x277dcd[_0x3fc3('0x129')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1a3'));}else{_0x277dcd['stateGlobal'](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1a3'));}}break;case'5':_0x5f3cdc[_0x3fc3('0x1a4')]+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0x5;_0x46bd51[_0x3fc3('0x70')]=_0x3fc3('0x1a5');_0x46bd51['countbusyretry']+=0x1;_0x46bd51[_0x3fc3('0xd5')]+=0x1;ami[_0x3fc3('0x116')](_0x3fc3('0x1a6'),ut[_0x3fc3('0x11f')](_0x22f790,_0x3fc3('0x1a7')));_0x525b5d=_0x5f3cdc[_0x3fc3('0x1a8')];_0x288647=_0x5f3cdc[_0x3fc3('0xd6')];hopperUtils['createHistory'](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1a9')));if(_0x277dcd[_0x3fc3('0x18d')](0x5,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51[_0x3fc3('0x121')]>=_0x5f3cdc[_0x3fc3('0x1aa')]){_0x277dcd[_0x3fc3('0x129')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1ab'));}else{_0x277dcd[_0x3fc3('0x126')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1ab'));}}break;case'8':_0x5f3cdc[_0x3fc3('0x1ac')]+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0x8;_0x46bd51['statedesc']='Congestion';_0x46bd51['countcongestionretry']+=0x1;_0x46bd51[_0x3fc3('0xd5')]+=0x1;_0x525b5d=_0x5f3cdc[_0x3fc3('0x190')];_0x288647=_0x5f3cdc['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut['buildObj'](_0x22f790,_0x3fc3('0x1ad')));hopperUtils[_0x3fc3('0xca')](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1ae')));if(_0x277dcd[_0x3fc3('0x18d')](0x8,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51[_0x3fc3('0x122')]>=_0x5f3cdc[_0x3fc3('0x18f')]){_0x277dcd[_0x3fc3('0x129')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1af'));}else{_0x277dcd['stateGlobal'](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1af'));}}break;case'11':_0x5f3cdc['outboundAbandonedCallsDay']+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0xb;_0x46bd51[_0x3fc3('0x70')]=_0x3fc3('0xe8');_0x46bd51[_0x3fc3('0xea')]+=0x1;_0x46bd51[_0x3fc3('0xd5')]+=0x1;_0x525b5d=_0x5f3cdc['dialAbandonedRetryFrequency'];_0x288647=_0x5f3cdc[_0x3fc3('0xd6')];hopperUtils[_0x3fc3('0xca')](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0xee')));if(_0x277dcd['checkRetriveMax'](0xb,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51['countabandonedretry']>=_0x5f3cdc[_0x3fc3('0xec')]){_0x277dcd[_0x3fc3('0x129')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1b0'));}else{_0x277dcd['stateGlobal'](_0x46bd51,_0x47b404,_0x200386,'reason\x2011\x20abandoned');}}break;case'20':_0x5f3cdc[_0x3fc3('0x1b1')]+=0x1;_0x46bd51[_0x3fc3('0x6f')]=0x14;_0x46bd51[_0x3fc3('0x70')]=_0x3fc3('0x1b2');_0x46bd51['countagentrejectretry']+=0x1;_0x46bd51[_0x3fc3('0xd5')]+=0x1;_0x525b5d=_0x5f3cdc[_0x3fc3('0x196')];_0x288647=_0x5f3cdc[_0x3fc3('0xd6')];ami[_0x3fc3('0x116')]('custom:agentreject',ut[_0x3fc3('0x11f')](_0x22f790,_0x3fc3('0x1b3')));hopperUtils['createHistory'](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1b4')));if(_0x277dcd['checkRetriveMax'](0x14,_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51['countagentrejectretry']>=_0x5f3cdc['dialAgentRejectMaxRetry']){_0x277dcd['createStateFinal'](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1b5'));}else{_0x277dcd[_0x3fc3('0x126')](_0x46bd51,_0x47b404,_0x200386,_0x3fc3('0x1b5'));}}break;default:_0x5f3cdc[_0x3fc3('0x136')]+=0x1;_0x46bd51['state']=0xc;_0x46bd51[_0x3fc3('0x70')]=_0x57141c['reason'];_0x525b5d=_0x5f3cdc[_0x3fc3('0x196')];_0x288647=_0x5f3cdc['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x46bd51)[_0x3fc3('0xa3')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x277dcd[_0x3fc3('0x18d')](_0x57141c[_0x3fc3('0xc5')],_0x22f790,_0x5f3cdc)&&!_0x5d4d38){if(_0x46bd51['countbusyretry']+_0x46bd51[_0x3fc3('0x122')]+_0x46bd51['countnoanswerretry']+_0x46bd51['countnosuchnumberretry']+_0x46bd51[_0x3fc3('0xd4')]+_0x46bd51[_0x3fc3('0xea')]+_0x46bd51[_0x3fc3('0x11e')]+_0x46bd51['countagentrejectretry']>=_0x5f3cdc[_0x3fc3('0x125')]){_0x277dcd[_0x3fc3('0x126')](_0x46bd51,_0x47b404,_0x200386,_0x57141c[_0x3fc3('0xc5')]);}else{_0x277dcd['createStateFinal'](_0x46bd51,_0x47b404,_0x200386,_0x57141c[_0x3fc3('0xc5')]);}}}})[_0x3fc3('0x9f')](function(){if(_0x5d4d38){hopperUtils[_0x3fc3('0xe6')](_0x46bd51,_0x525b5d,_0x288647)[_0x3fc3('0x9f')](function(){return _0x47b404(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x2cd904,_0x2ea17e,_0x3bf034,_0x2aabdc){var _0x220e4a=new Final(_0x2cd904);_0x220e4a[_0x3fc3('0x6f')]=0xf;_0x220e4a[_0x3fc3('0x70')]=_0x3fc3('0x1b6');this[_0x3fc3('0x129')](_0x220e4a,_0x2ea17e,_0x3bf034,_0x2aabdc);};Dialer['prototype']['createStateFinal']=function(_0x422b19,_0x2fb80a,_0x4a6cf8,_0x1ecab5){hopperUtils[_0x3fc3('0xcc')](_0x422b19)[_0x3fc3('0x9f')](function(){return _0x2fb80a(msgResponse(_0x3fc3('0x197'),_0x3fc3('0x109'),_0x1ecab5));})['catch'](function(){return _0x4a6cf8(msgResponse(_0x3fc3('0x1b7'),_0x3fc3('0x93'),_0x3fc3('0x1b8')));});};Dialer['prototype'][_0x3fc3('0xb0')]=function(_0x411777){var _0x30887d=_0x411777[_0x3fc3('0x1b9')]/0x64;var _0x56ae65=_0x411777[_0x3fc3('0xd1')]/(_0x411777['outboundDropCallsDayTimeout']+_0x411777[_0x3fc3('0xc4')]);var _0xc5739b=Math[_0x3fc3('0x1ba')](_0x411777[_0x3fc3('0x1bb')]*(_0x411777[_0x3fc3('0x1bc')]/0x64));var _0x21fffa=Math['round'](_0x411777[_0x3fc3('0x1bb')]*(_0x411777[_0x3fc3('0x1bd')]/0x64));var _0x56c131=_0x411777[_0x3fc3('0x13e')]+_0x411777[_0x3fc3('0x1be')];var _0x4f286c=Math[_0x3fc3('0x1bf')](_0x411777[_0x3fc3('0x5c')]*_0x411777['erlangAbandonmentRate']*_0x411777['predictiveIntervalHitRate']*_0x411777['predictiveIntervalMultiplicativeFactor']);if(_[_0x3fc3('0x40')](_0x411777[_0x3fc3('0x28')])){if(!_[_0x3fc3('0x40')](_0x411777[_0x3fc3('0x27')])){_0x411777['startPredictive']=undefined;loggerPredictive[_0x3fc3('0x65')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x3fc3('0x40')](_0x411777[_0x3fc3('0x64')])){loggerPredictive[_0x3fc3('0x65')](_0x3fc3('0x1c0'),_0x3fc3('0x1c1'));clearInterval(_0x411777[_0x3fc3('0x64')]);_0x411777['handlePredictive']=undefined;}_0x411777[_0x3fc3('0x28')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));loggerPredictive[_0x3fc3('0x4b')](_0x411777[_0x3fc3('0x48')],'collection\x20data\x20in\x20progressive\x20at',_0x411777[_0x3fc3('0x28')]);this[_0x3fc3('0xb2')](_0x411777,0x1);}else if(ifInterval(_0x411777['dialPredictiveInterval'],_0x411777[_0x3fc3('0x28')])){this[_0x3fc3('0xb2')](_0x411777,0x1);loggerPredictiveCalls[_0x3fc3('0x4b')]('[startMethodPredictive][StartProgressive][Loop]',_0x411777['startProgressive'],_0x411777[_0x3fc3('0x48')]);_0x411777['erlangCalls']=0x0;_0x411777['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x30887d<_0x56ae65&&_0x411777[_0x3fc3('0x1c2')]==='dropRate'){clearPredictiveAttributes(_0x411777);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x1c3'),_0x3fc3('0x1c4'),_0x56ae65,_0x3fc3('0x28'),_0x411777[_0x3fc3('0x48')]);}else if(_0x4f286c<_0x411777[_0x3fc3('0xd2')]&&_0x411777['dialPredictiveOptimization']===_0x3fc3('0x1c5')){clearPredictiveAttributes(_0x411777);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x1c6'),_0x3fc3('0x1c7'),_0x4f286c,_0x3fc3('0x1c8'),_0x411777[_0x3fc3('0xd2')],_0x3fc3('0x28'),_0x411777[_0x3fc3('0x48')]);}else if(!ifInterval(_0x411777['dialPredictiveInterval'],_0x411777[_0x3fc3('0x28')])&&_[_0x3fc3('0x40')](_0x411777['startPredictive'])&&!_[_0x3fc3('0x40')](_0x411777[_0x3fc3('0x28')])){_0x411777[_0x3fc3('0x27')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));loggerPredictive[_0x3fc3('0x4b')](_0x411777[_0x3fc3('0x48')],_0x3fc3('0x1c9'),_0x411777['startPredictive']);hopperUtils[_0x3fc3('0x1ca')](_0x411777[_0x3fc3('0x1cb')])['then'](this[_0x3fc3('0x1cc')](_0x411777))[_0x3fc3('0x9f')](mergeDataErlangB(_0x411777))[_0x3fc3('0x9f')](this[_0x3fc3('0x1cd')](_0x411777))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x411777));}else if(!ifInterval(_0x411777[_0x3fc3('0x1cb')],_0x411777['startPredictive'])){_0x411777[_0x3fc3('0xd2')]=0x0;_0x411777[_0x3fc3('0x27')]=moment()[_0x3fc3('0x46')](_0x3fc3('0xc3'));loggerPredictive[_0x3fc3('0x4b')](_0x411777[_0x3fc3('0x48')],'recalculate\x20predictive\x20at',_0x411777['startPredictive']);clearInterval(_0x411777[_0x3fc3('0x64')]);_0x411777[_0x3fc3('0x64')]=undefined;hopperUtils[_0x3fc3('0x1ca')](_0x411777[_0x3fc3('0x1cb')])[_0x3fc3('0x9f')](this[_0x3fc3('0x1cc')](_0x411777))[_0x3fc3('0x9f')](mergeDataErlangB(_0x411777))[_0x3fc3('0x9f')](this[_0x3fc3('0x1cd')](_0x411777))[_0x3fc3('0xa3')](loggerCatchPredictive(_0x3fc3('0x1ce'),_0x411777));}else if(_0x411777[_0x3fc3('0x1bb')]&&_0x56c131<_0x411777[_0x3fc3('0x1bb')]-_0x21fffa){clearPredictiveAttributes(_0x411777);loggerPredictive['info'](_0x411777[_0x3fc3('0x48')],_0x3fc3('0x1cf'),_0x56c131,_0x3fc3('0x1d0'),_0x411777[_0x3fc3('0x1bb')],'-',_0x21fffa,'=',_0x411777[_0x3fc3('0x1bb')]-_0x21fffa,')');}else if(_0x411777[_0x3fc3('0x1bb')]&&_0x56c131>_0x411777[_0x3fc3('0x1bb')]+_0xc5739b){clearPredictiveAttributes(_0x411777);loggerPredictive[_0x3fc3('0x4b')](_0x411777[_0x3fc3('0x48')],_0x3fc3('0x1cf'),_0x56c131,_0x3fc3('0x1d1'),_0x411777['predictiveIntervalAvailable'],'+',_0xc5739b,'=',_0x411777[_0x3fc3('0x1bb')]+_0xc5739b,')');}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x1cc')]=function(_0x1798d0){var _0x4ec91a=this;return function(_0x2d5877){return new Promise(function(_0x645408,_0x3921ac){_[_0x3fc3('0x159')](_0x1798d0,_0x2d5877[0x0]);if(checkGetDataPredictive(_0x2d5877[0x0])){var _0x2a191e=_0x1798d0['predictiveIntervalAvailable']=_0x1798d0[_0x3fc3('0x1be')]+_0x1798d0['available'];var _0xff1e0b=_0x1798d0[_0x3fc3('0x1cb')]*0x3c;var _0x4f2c5b=_0x2d5877[0x0]['predictiveIntervalAvgTalktime']+_0x2d5877[0x0][_0x3fc3('0x58')];var _0x10ea7a=(_0x2d5877[0x0][_0x3fc3('0x50')]+_0x2d5877[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2d5877[0x0][_0x3fc3('0x53')])/_0x2d5877[0x0][_0x3fc3('0x4e')];_0x1798d0[_0x3fc3('0x1d2')]=_0x10ea7a>0x0?_0x10ea7a:0x1;switch(_0x1798d0[_0x3fc3('0x1c2')]){case'dropRate':var _0x6599a8=_0x1798d0[_0x3fc3('0x1b9')]/0x64;return _0x4ec91a[_0x3fc3('0x1d3')](_0x2a191e,_0xff1e0b,_0x4f2c5b,_0x10ea7a,_0x6599a8)[_0x3fc3('0x9f')](function(_0x616933){return _0x645408(_0x616933);});case _0x3fc3('0x1d4'):var _0x2590a6=_0x1798d0[_0x3fc3('0x1b9')]/0x64;return _0x4ec91a[_0x3fc3('0x1d5')](_0x2a191e,_0xff1e0b,_0x4f2c5b,_0x10ea7a,_0x2590a6)['then'](function(_0x566b59){return _0x645408(_0x566b59);});default:return _0x3921ac(msgResponse(_0x3fc3('0x1d6'),_0x3fc3('0x93'),_0x3fc3('0x1d7')));}}else{return _0x3921ac(msgResponse(_0x3fc3('0x1d6'),'Failure',_0x3fc3('0x1d8')));}});};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x1d9')]=function(_0x52df69){var _0x576606=this;return function(_0x2b2e71){return new Promise(function(_0x42f486,_0x4d2e4e){_['merge'](_0x52df69,_0x2b2e71[0x0]);if(checkGetDataPredictive(_0x2b2e71[0x0])){loggerPredictive[_0x3fc3('0x4b')](JSON[_0x3fc3('0x74')](_0x2b2e71[0x0]));if(_0x52df69[_0x3fc3('0x1c2')]==='dropRate'){return _0x576606['getVoiceQueueRtPauses'](_0x52df69['id'])['then'](function(_0x413a90){var _0x4e824e=_0x52df69[_0x3fc3('0x1da')]-_0x413a90[0x0][_0x3fc3('0x1db')];var _0x772b4e=_0x52df69[_0x3fc3('0x1cb')]*0x3c;var _0xc91c7e=_0x2b2e71[0x0][_0x3fc3('0x55')]+_0x2b2e71[0x0]['predictiveIntervalAvgHoldtime'];var _0x3b8137=(_0x2b2e71[0x0][_0x3fc3('0x50')]+_0x2b2e71[0x0][_0x3fc3('0x1dc')]+_0x2b2e71[0x0][_0x3fc3('0x53')])/_0x2b2e71[0x0][_0x3fc3('0x4e')];var _0x31cc4e=_0x52df69['dialPredictiveOptimizationPercentage']/0x64;_0x52df69[_0x3fc3('0x1dd')]=_0x413a90[0x0][_0x3fc3('0x1db')]||0x0;_0x52df69['predictiveIntervalHitRate']=_0x3b8137>0x0?_0x3b8137:0x1;return _0x576606[_0x3fc3('0x1d3')](_0x4e824e,_0x772b4e,_0xc91c7e,_0x3b8137,_0x31cc4e);})[_0x3fc3('0x9f')](function(_0x1c3558){return _0x42f486(_0x1c3558);})['catch'](function(_0x22b55a){return _0x4d2e4e(msgResponse(_0x3fc3('0x1de'),'Failure',JSON[_0x3fc3('0x74')](_0x22b55a)));});}if(_0x52df69[_0x3fc3('0x1c2')]===_0x3fc3('0x1d4')){return _0x576606[_0x3fc3('0x153')](_0x52df69['id'])[_0x3fc3('0x9f')](function(_0x4390b9){var _0x3e88e8=_0x52df69[_0x3fc3('0x1da')]-_0x4390b9[0x0]['outboundQueuePauses'];var _0x322091=_0x52df69[_0x3fc3('0x1cb')]*0x3c;var _0xe32d24=_0x2b2e71[0x0][_0x3fc3('0x55')]+_0x2b2e71[0x0][_0x3fc3('0x58')];var _0x5a2040=(_0x2b2e71[0x0][_0x3fc3('0x50')]+_0x2b2e71[0x0][_0x3fc3('0x1dc')]+_0x2b2e71[0x0][_0x3fc3('0x53')])/_0x2b2e71[0x0]['predictiveIntervalTotalCalls'];var _0x414646=_0x52df69[_0x3fc3('0x1b9')]/0x64;_0x52df69['predictiveIntervalPauses']=_0x4390b9[0x0][_0x3fc3('0x1db')]||0x0;_0x52df69[_0x3fc3('0x1d2')]=_0x5a2040>0x0?_0x5a2040:0x1;return _0x576606[_0x3fc3('0x1d5')](_0x3e88e8,_0x322091,_0xe32d24,_0x5a2040,_0x414646);})['then'](function(_0x4775ee){return _0x42f486(_0x4775ee);})[_0x3fc3('0xa3')](function(_0x4c910e){return _0x4d2e4e(msgResponse(_0x3fc3('0x1de'),_0x3fc3('0x93'),JSON['stringify'](_0x4c910e)));});}}else{return _0x4d2e4e(msgResponse(_0x3fc3('0x1d6'),_0x3fc3('0x93'),_0x3fc3('0x1d8')));}});};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x1cd')]=function(_0x4d8fab){var _0x29cf67=this;return function(){var _0x342177=0x0;var _0xc6859=Math[_0x3fc3('0x1bf')](_0x4d8fab[_0x3fc3('0x5e')]*0x3e8);if(_0xc6859>0x0){_0xc6859=_0xc6859<0x64?0x64:_0xc6859;loggerPredictive['info'](_0x4d8fab['name'],_0x3fc3('0x1df'),_0xc6859,'milliseconds');_0x4d8fab['handlePredictive']=setInterval(function(){_0x29cf67[_0x3fc3('0x64')](_0x4d8fab);loggerPredictiveCalls[_0x3fc3('0x4b')](_0x3fc3('0x1e0'),_0x342177+=0x1);},_0xc6859);}else{loggerPredictive[_0x3fc3('0x4b')](_0x4d8fab[_0x3fc3('0x48')],_0x3fc3('0x1e1'));}};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x1e2')]=function(_0xe6bce6,_0x390232){var _0x316831=this;return function(_0xfdbb97){if(_[_0x3fc3('0x4a')](_0xfdbb97)){if(_[_0x3fc3('0xf4')](_0x390232[_0x3fc3('0x15a')])||!_0x390232[_0x3fc3('0x1e3')]){if(_0xe6bce6[_0x3fc3('0xaf')]==='booked'){_0xe6bce6[_0x3fc3('0x72')]=_[_0x3fc3('0x40')](_0xe6bce6['queueStatusComplete'])?!![]:_0xe6bce6[_0x3fc3('0x72')];var _0x3f3c32=uuid['v4']();_0x316831[_0x3fc3('0x24')][_0x3f3c32]=new Action(_0xe6bce6,_0x390232,_0x3f3c32);loggerBooked[_0x3fc3('0x4b')](_0x3fc3('0x1e4'),_0x3f3c32,_0x3fc3('0x1e5'),JSON[_0x3fc3('0x74')](_0xe6bce6[_0x3fc3('0x72')]),'Queue:\x20',_0xe6bce6['name']);if(_0xe6bce6[_0x3fc3('0x72')]){_0xe6bce6[_0x3fc3('0x72')]=![];_0x316831['queueBooked'][_0x316831[_0x3fc3('0x24')][_0x3f3c32][_0x3fc3('0xc1')]]=[];ami[_0x3fc3('0x9b')]({'actionid':_0x3f3c32,'action':_0x3fc3('0x1e6'),'queue':_0xe6bce6[_0x3fc3('0x48')]})[_0x3fc3('0xa3')](function(){_0x316831['updateOriginated'](_0xe6bce6);hopperUtils[_0x3fc3('0xda')]({'active':![],'ContactId':_0x316831['actions'][_0x3f3c32][_0x3fc3('0xdd')],'ListId':_0x316831[_0x3fc3('0x24')][_0x3f3c32][_0x3fc3('0xde')],'VoiceQueueId':_0x316831[_0x3fc3('0x24')][_0x3f3c32][_0x3fc3('0xdf')]||undefined,'CampaignId':_0x316831[_0x3fc3('0x24')][_0x3f3c32][_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1e7')));delete _0x316831[_0x3fc3('0x24')][_0x3f3c32];});}else{loggerBooked[_0x3fc3('0x4b')]('[booked][checkContactBlack][else]',JSON['stringify'](_0xe6bce6[_0x3fc3('0x72')]),'Queue:\x20',_0xe6bce6['name']);_0x316831[_0x3fc3('0xc0')](_0xe6bce6);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x316831['actions'][_0x3f3c32][_0x3fc3('0xdd')],'ListId':_0x316831['actions'][_0x3f3c32][_0x3fc3('0xde')],'VoiceQueueId':_0x316831['actions'][_0x3f3c32][_0x3fc3('0xdf')]||undefined,'CampaignId':_0x316831['actions'][_0x3f3c32][_0x3fc3('0xe0')]||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1e7')));delete _0x316831[_0x3fc3('0x24')][_0x3f3c32];}}else{return _0x316831[_0x3fc3('0x15d')](_0xe6bce6,_0x390232);}}else{if(utils[_0x3fc3('0x62')](undefined,_0x390232[_0x3fc3('0x1e8')])<_0xe6bce6[_0x3fc3('0x1e9')]*0x3c){if(_0x390232['Agent']&&!_0x390232[_0x3fc3('0x14a')]['voicePause']){_0x316831['preview'][_0x3fc3('0xfa')](_0x390232['id'])[_0x3fc3('0xfc')](function(){_0x316831[_0x3fc3('0xc0')](_0xe6bce6);});}else{hopperUtils[_0x3fc3('0x1ea')]({'active':![]},_0x390232['id'],0x1)[_0x3fc3('0xfc')](function(){_0x316831['updateOriginated'](_0xe6bce6);});}}else{_0xe6bce6[_0x3fc3('0x1eb')]+=0x1;_0x316831[_0x3fc3('0xc0')](_0xe6bce6);if(_0xe6bce6['dialRecallInQueue']){hopperUtils[_0x3fc3('0xda')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x390232['ContactId'],'ListId':_0x390232[_0x3fc3('0xde')],'VoiceQueueId':_0x390232[_0x3fc3('0xdf')]||undefined,'CampaignId':_0x390232['CampaignId']||undefined})[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x1ec')));hopperUtils['createHistory'](createObjHistory(_0xe6bce6,_0x390232,utils[_0x3fc3('0x68')][_0x3fc3('0x1ed')],0x17,'RecallInQueue'))[_0x3fc3('0xa3')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x316831[_0x3fc3('0x119')](createObjHistory(_0xe6bce6,_0x390232,utils[_0x3fc3('0x68')]['RECALL_TIMEOUT'],0x16,_0x3fc3('0x1ee')),'[Originate][HistoryRecallClose][historyCatch]',_0x3fc3('0x1ef'));}}}}else{_0xe6bce6[_0x3fc3('0x1f0')]+=0x1;_0x316831['saveInDb'](createObjHistory(_0xe6bce6,_0x390232,utils[_0x3fc3('0x68')][_0x3fc3('0x1f1')],0xd,'Blacklist'),_0x3fc3('0x1f2'),_0x3fc3('0x1f3'));throw _0x3fc3('0x1f4');}};};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x15c')]=function(_0x48a73c){var _0x255d9f=this;var _0x2c9ba7=_0x48a73c[_0x3fc3('0x1f5')]-_0x48a73c['originated'];emitCampaignSummary(_0x48a73c);if(_0x2c9ba7>0x0&&_0x48a73c[_0x3fc3('0x1f6')]==0x0){if(_0x2c9ba7>this[_0x3fc3('0x22')]){_0x2c9ba7=this[_0x3fc3('0x22')];}_0x48a73c[_0x3fc3('0x1f6')]=0x1;hopperUtils[_0x3fc3('0x1f7')](_0x48a73c,_0x2c9ba7)[_0x3fc3('0x9f')](function(_0x29ae71){_0x48a73c[_0x3fc3('0x1f6')]=0x0;if(_0x29ae71){if(!utils[_0x3fc3('0x1f8')](_0x29ae71)){_0x48a73c[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x6d')];logger[_0x3fc3('0x4b')](_0x3fc3('0x1f9')+_0x48a73c[_0x3fc3('0x48')]);}else{_0x48a73c[_0x3fc3('0x80')]+=_0x29ae71[_0x3fc3('0x9a')];_0x48a73c[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')][_0x3fc3('0x1fa')];for(var _0x16a585=0x0;_0x16a585<_0x29ae71[_0x3fc3('0x9a')];_0x16a585+=0x1){_0x48a73c[_0x3fc3('0x1fb')]+=0x1;if(_[_0x3fc3('0xf4')](_0x29ae71[_0x16a585])||_['isNil'](_0x29ae71[_0x16a585][_0x3fc3('0x174')])||_['isNil'](_0x29ae71[_0x16a585][_0x3fc3('0x181')])){_0x255d9f[_0x3fc3('0x157')]('[actionOriginate]\x20',_0x48a73c,_0x29ae71[_0x16a585]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x3fc3('0x75')](_0x29ae71[_0x16a585],[_0x3fc3('0xe0'),_0x3fc3('0x181')]))[_0x3fc3('0x9f')](_0x255d9f[_0x3fc3('0x1e2')](_0x48a73c,_0x29ae71[_0x16a585]))[_0x3fc3('0xa3')](_0x255d9f['loggerHandler'](_0x3fc3('0x1fc'),_0x48a73c));}}}}})[_0x3fc3('0xa3')](loggerGetContactDialer(_0x3fc3('0x1fd'),_0x48a73c,_0x2c9ba7));}};Dialer['prototype'][_0x3fc3('0xb2')]=function(_0xd96e23,_0xb495ec){var _0x1d8910=this;var _0x243b19=[];if(_0xb495ec<0x1||_0xd96e23[_0x3fc3('0xaf')]==='booked'){_0xb495ec=0x1;}var _0x2c562e=Math[_0x3fc3('0x1bf')](_0xd96e23[_0x3fc3('0x13e')]*_0xb495ec)-_0xd96e23[_0x3fc3('0x80')];if(_0xd96e23[_0x3fc3('0x1fe')]>0x0){var _0x22abb8=_0xd96e23[_0x3fc3('0x1fe')]-_0xd96e23[_0x3fc3('0x80')]-_0xd96e23[_0x3fc3('0x1be')]-_0xd96e23[_0x3fc3('0x1ff')];if(_0x2c562e>_0x22abb8){_0x2c562e=_0x22abb8;}}if(_0x2c562e>0x0&&_0xd96e23[_0x3fc3('0x1f6')]==0x0){if(_0xd96e23[_0x3fc3('0xaf')]==='booked'){_0x2c562e=0x1;}if(_0x2c562e>this[_0x3fc3('0x22')]){_0x2c562e=this[_0x3fc3('0x22')];}for(var _0x1144cf in this[_0x3fc3('0x20')]){if(typeof this['agents'][_0x1144cf]!=='undefined'){if(this['agents'][_0x1144cf][_0x3fc3('0x6f')]===_0x3fc3('0x200')&&this[_0x3fc3('0x20')][_0x1144cf][_0x3fc3('0x8b')]===_0x3fc3('0x8a')){_0x243b19[_0x3fc3('0xf8')](this[_0x3fc3('0x20')][_0x1144cf]['id']);}}}_0xd96e23[_0x3fc3('0x1f6')]=0x1;hopperUtils['getContactDialer'](_0xd96e23,_0x243b19,_0x2c562e)[_0x3fc3('0x9f')](function(_0x3f452e){_0xd96e23[_0x3fc3('0x1f6')]=0x0;if(_0x3f452e){if(!utils['checkContactEmpty'](_0x3f452e)){hopperUtils[_0x3fc3('0x201')](_0xd96e23)['then'](sendMessageReschedule(_0xd96e23))[_0x3fc3('0xa3')](loggerCatch(_0x3fc3('0x202')));}else{_0xd96e23[_0x3fc3('0x80')]+=_0x3f452e[_0x3fc3('0x9a')];_0xd96e23[_0x3fc3('0x6c')]=_0xd96e23['dialMethod']==='booked'?utils['CAMPAIGN_STATUS'][_0x3fc3('0x140')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x3bd188=0x0;_0x3bd188<_0x3f452e[_0x3fc3('0x9a')];_0x3bd188+=0x1){if(_[_0x3fc3('0xf4')](_0x3f452e[_0x3bd188])||_['isNil'](_0x3f452e[_0x3bd188][_0x3fc3('0x174')])||_[_0x3fc3('0xf4')](_0x3f452e[_0x3bd188][_0x3fc3('0x181')])){_0x1d8910['emptyContact'](_0x3fc3('0x203'),_0xd96e23,_0x3f452e[_0x3bd188]);}else{hopperUtils['checkIsBlackList'](_[_0x3fc3('0x75')](_0x3f452e[_0x3bd188],[_0x3fc3('0xdf'),_0x3fc3('0x181')]))['then'](_0x1d8910[_0x3fc3('0x1e2')](_0xd96e23,_0x3f452e[_0x3bd188]))[_0x3fc3('0xa3')](_0x1d8910[_0x3fc3('0x156')]('[actionOriginate]\x20',_0xd96e23));}}}}})[_0x3fc3('0xa3')](loggerGetContactDialer(_0x3fc3('0x204'),_0xd96e23,_0x2c562e));}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x64')]=function(_0x2bc45e){if(_0x2bc45e[_0x3fc3('0x1fe')]>0x0){var _0x50cff6=_0x2bc45e['dialLimitQueue']-_0x2bc45e['originated']-_0x2bc45e[_0x3fc3('0x1be')];if(_0x50cff6>0x0&&_0x2bc45e['temp']==0x0){this[_0x3fc3('0x205')](_0x2bc45e);}else{loggerPredictiveCalls[_0x3fc3('0x4b')](_0x3fc3('0x206'));}}else{this[_0x3fc3('0x205')](_0x2bc45e);}};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x205')]=function(_0x4c8b1e){var _0x29cf00=this;var _0x318e78=[];_0x4c8b1e[_0x3fc3('0x80')]+=0x1;for(var _0x24641c in this[_0x3fc3('0x20')]){if(typeof this[_0x3fc3('0x20')][_0x24641c]!==_0x3fc3('0xaa')){if(this[_0x3fc3('0x20')][_0x24641c][_0x3fc3('0x6f')]===_0x3fc3('0x200')&&this[_0x3fc3('0x20')][_0x24641c]['status']===_0x3fc3('0x8a')){_0x318e78[_0x3fc3('0xf8')](this['agents'][_0x24641c]['id']);}}}_0x4c8b1e[_0x3fc3('0x1f6')]=0x1;return this['getContactDialer'](_0x4c8b1e['id'],_0x318e78,0x1,_0x4c8b1e['dialOrderByScheduledAt'],_0x4c8b1e)[_0x3fc3('0x9f')](function(_0x430de5){_0x4c8b1e['temp']=0x1;if(_0x430de5){if(!utils[_0x3fc3('0x1f8')](_0x430de5)){utils[_0x3fc3('0x66')](_0x4c8b1e,0x1,0x0);return hopperUtils[_0x3fc3('0x201')](_0x4c8b1e)[_0x3fc3('0x9f')](sendMessageReschedule(_0x4c8b1e))['catch'](loggerCatch(_0x3fc3('0x202')));}else{_0x4c8b1e[_0x3fc3('0x6c')]=utils[_0x3fc3('0x68')]['RUNNING'];if(_['isNil'](_0x430de5[0x0])||_[_0x3fc3('0xf4')](_0x430de5[0x0][_0x3fc3('0x174')])||_[_0x3fc3('0xf4')](_0x430de5[0x0][_0x3fc3('0x181')])){_0x29cf00[_0x3fc3('0x157')](_0x3fc3('0x203'),_0x4c8b1e,_0x430de5[0x0]);}else{return hopperUtils[_0x3fc3('0x207')](_[_0x3fc3('0x75')](_0x430de5[0x0],[_0x3fc3('0xdf'),_0x3fc3('0x181')]))[_0x3fc3('0x9f')](_0x29cf00[_0x3fc3('0x1e2')](_0x4c8b1e,_0x430de5[0x0]))['catch'](_0x29cf00[_0x3fc3('0x156')](_0x3fc3('0x208'),_0x4c8b1e));}}}})['catch'](loggerGetContactDialer(_0x3fc3('0x209'),_0x4c8b1e,0x1));};Dialer[_0x3fc3('0x1a')][_0x3fc3('0x1d3')]=function(_0x39fec3,_0x46e0c7,_0x3b3c1c,_0xb14310,_0x3c28c7,_0x2a29b6){loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20a'));loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20b'),_0x39fec3);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20c'),_0x46e0c7);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20d'),_0x3b3c1c);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20e'),_0xb14310);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20f'),_0x3c28c7);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x56'));return new Promise(function(_0x4cce3b,_0x2f6924){if(_0x39fec3<=0x0||isNaN(_0x39fec3)){return _0x2f6924(msgResponse('[abandonmentRate]',_0x3fc3('0x86'),'m\x20=\x20'+_0x39fec3));}if(_0x3b3c1c<=0x0||isNaN(_0x3b3c1c)){return _0x2f6924(msgResponse(_0x3fc3('0x210'),'Error',_0x3fc3('0x211')+_0x3b3c1c));}if(_0xb14310<=0x0||isNaN(_0xb14310)){return _0x2f6924(msgResponse('[abandonmentRate]',_0x3fc3('0x86'),_0x3fc3('0x212')+_0xb14310));}if(_0x46e0c7<=0x0||isNaN(_0x46e0c7)){return _0x2f6924(msgResponse(_0x3fc3('0x210'),_0x3fc3('0x86'),_0x3fc3('0x213')+_0x46e0c7));}if(_0x3c28c7<=0x0||isNaN(_0x3c28c7)){return _0x2f6924(msgResponse(_0x3fc3('0x210'),_0x3fc3('0x86'),_0x3fc3('0x214')+_0x3c28c7));}_0x2a29b6=_0x2a29b6||0x0;var _0x360f25=0x1/_0x3b3c1c;var _0x42cbe3=0x0;var _0x114031=0x0;var _0x3f2a59=0x0;var _0x43070a=0x0;for(var _0x1d973a=0x0;_0x3f2a59<_0x3c28c7;_0x1d973a+=0x1){_0x114031=_0x1d973a/_0x46e0c7;_0x42cbe3=(_0xb14310*_0x114031+_0x2a29b6)/_0x360f25;_0x3f2a59=utils[_0x3fc3('0x215')](_0x42cbe3,_0x39fec3);_0x43070a=_0x42cbe3/_0x39fec3*(0x1-utils['erlangb'](_0x42cbe3,_0x39fec3));}return _0x4cce3b({'erlangCalls':_0x1d973a,'erlangCallToSecond':_0x46e0c7/_0x1d973a,'erlangAbandonmentRate':_0x3f2a59,'erlangBusyFactor':_0x43070a});});};Dialer['prototype'][_0x3fc3('0x1d5')]=function(_0x159865,_0x48783e,_0x128cd6,_0x31167a,_0x1cc6c0,_0x5435d7){loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x216'));loggerPredictive[_0x3fc3('0x4b')]('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',_0x159865);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20c'),_0x48783e);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x20d'),_0x128cd6);loggerPredictive['info'](_0x3fc3('0x20e'),_0x31167a);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x217'),_0x1cc6c0);loggerPredictive[_0x3fc3('0x4b')](_0x3fc3('0x56'));return new Promise(function(_0x59a0a2,_0x31c005){if(_0x159865<=0x0||isNaN(_0x159865)){return _0x31c005(msgResponse('[busyFactor]',_0x3fc3('0x86'),'m\x20=\x20'+_0x159865));}if(_0x128cd6<=0x0||isNaN(_0x128cd6)){return _0x31c005(msgResponse(_0x3fc3('0x218'),_0x3fc3('0x86'),_0x3fc3('0x211')+_0x128cd6));}if(_0x31167a<=0x0||isNaN(_0x31167a)){return _0x31c005(msgResponse(_0x3fc3('0x218'),_0x3fc3('0x86'),_0x3fc3('0x212')+_0x31167a));}if(_0x48783e<=0x0||isNaN(_0x48783e)){return _0x31c005(msgResponse(_0x3fc3('0x218'),'Error',_0x3fc3('0x213')+_0x48783e));}if(_0x1cc6c0<=0x0||isNaN(_0x1cc6c0)){return _0x31c005(msgResponse(_0x3fc3('0x218'),_0x3fc3('0x86'),'Umin\x20=\x20'+_0x1cc6c0));}_0x5435d7=_0x5435d7||0x0;var _0x25ceea=0x1/_0x128cd6;var _0x1a76ac=0x0;var _0x20f2a7=0x0;var _0xa4124a=0x0;var _0x469471=0x0;for(var _0x4ea9a9=0x0;_0x469471<_0x1cc6c0;_0x4ea9a9+=0x1){_0x20f2a7=_0x4ea9a9/_0x48783e;_0x1a76ac=(_0x31167a*_0x20f2a7+_0x5435d7)/_0x25ceea;_0xa4124a=utils[_0x3fc3('0x215')](_0x1a76ac,_0x159865);_0x469471=_0x1a76ac/_0x159865*(0x1-utils['erlangb'](_0x1a76ac,_0x159865));}return _0x59a0a2({'erlangCalls':_0x4ea9a9,'erlangCallToSecond':_0x48783e/_0x4ea9a9,'erlangAbandonmentRate':_0xa4124a,'erlangBusyFactor':_0x469471});});};module['exports']=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 17fa91e..f0e6d3a 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 _0x709f=['\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','util','lodash','moment','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller'];(function(_0x36558c,_0x3fb001){var _0x273208=function(_0xcb8afa){while(--_0xcb8afa){_0x36558c['push'](_0x36558c['shift']());}};_0x273208(++_0x3fb001);}(_0x709f,0xb9));var _0xf709=function(_0x36c87d,_0x2ab247){_0x36c87d=_0x36c87d-0x0;var _0x54dc55=_0x709f[_0x36c87d];return _0x54dc55;};'use strict';var util=require(_0xf709('0x0'));var _=require(_0xf709('0x1'));var moment=require(_0xf709('0x2'));function checkNameSurname(_0x1aac54,_0x2bcefe,_0x3069f3){var _0xf9a029='';if(!_[_0xf709('0x3')](_0x2bcefe)&&'string'===typeof _0x2bcefe){_0xf9a029+=_0x2bcefe;}if(!_[_0xf709('0x3')](_0x3069f3)&&_0xf709('0x4')===typeof _0x3069f3){_0xf9a029+='\x20'+_0x3069f3;}if(_0xf9a029!==''){return _0xf9a029;}return _0x1aac54;}function Action(_0x6b59d0,_0x2bd64a,_0x49f036){this[_0xf709('0x5')]=_0x6b59d0;this['uniqueid']=_0x49f036||undefined;this[_0xf709('0x6')]=checkNameSurname(_0x2bd64a[_0xf709('0x7')][_0xf709('0x8')],_0x2bd64a[_0xf709('0x7')][_0xf709('0x9')],_0x2bd64a[_0xf709('0x7')][_0xf709('0xa')]);this[_0xf709('0xb')]=_0x2bd64a[_0xf709('0x8')];this['queue']=_0x6b59d0[_0xf709('0x6')];this[_0xf709('0xc')]=_0x2bd64a['active']||![];this['type']=_0x6b59d0[_0xf709('0xd')];this[_0xf709('0xe')]=_0x6b59d0['dialQueueTimeout']||0x3;this[_0xf709('0xf')]=_0x2bd64a[_0xf709('0xf')];this['countbusyretry']=_0x2bd64a[_0xf709('0x10')];this[_0xf709('0x11')]=_0x2bd64a[_0xf709('0x11')];this[_0xf709('0x12')]=_0x2bd64a[_0xf709('0x12')];this['countnosuchnumberretry']=_0x2bd64a[_0xf709('0x13')];this['countdropretry']=_0x2bd64a[_0xf709('0x14')];this['countabandonedretry']=_0x2bd64a[_0xf709('0x15')];this[_0xf709('0x16')]=_0x2bd64a[_0xf709('0x16')];this[_0xf709('0x17')]=_0x2bd64a[_0xf709('0x17')];this[_0xf709('0x18')]=_0x2bd64a[_0xf709('0x18')];this['ListId']=_0x2bd64a['ListId'];this[_0xf709('0x19')]=_0x2bd64a[_0xf709('0x19')];this[_0xf709('0x1a')]=_0x2bd64a[_0xf709('0x1a')];this[_0xf709('0x1b')]=_0x2bd64a[_0xf709('0x1b')];this[_0xf709('0x1c')]=_0x2bd64a['id'];this[_0xf709('0x1d')]=_0x2bd64a[_0xf709('0x7')][_0xf709('0x9')]||'';this[_0xf709('0x1e')]=moment()[_0xf709('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf709('0x20')]=_0x2bd64a[_0xf709('0x20')];this['callbackuniqueid']=_0x2bd64a[_0xf709('0x21')];this[_0xf709('0x22')]=_0x2bd64a['callbackat'];this[_0xf709('0x23')]=_0x2bd64a['recallme'];this[_0xf709('0x24')]='';this[_0xf709('0x25')]='';}Action[_0xf709('0x26')][_0xf709('0x27')]=function(){return util[_0xf709('0x1f')](_0xf709('0x28'),this[_0xf709('0x6')],this[_0xf709('0x5')][_0xf709('0x29')]>0x0?this[_0xf709('0xb')][_0xf709('0x2a')](this['voiceQueue'][_0xf709('0x29')]):this[_0xf709('0xb')]);};Action['prototype'][_0xf709('0x2b')]=function(){return this[_0xf709('0x2c')];};module['exports']=Action; \ No newline at end of file +var _0x1657=['UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','prototype','getQueue','exports','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId'];(function(_0x24d288,_0x14ca69){var _0x4115f7=function(_0x1f3200){while(--_0x1f3200){_0x24d288['push'](_0x24d288['shift']());}};_0x4115f7(++_0x14ca69);}(_0x1657,0x6d));var _0x7165=function(_0x4c4ae4,_0x3ef806){_0x4c4ae4=_0x4c4ae4-0x0;var _0x430b4a=_0x1657[_0x4c4ae4];return _0x430b4a;};'use strict';var util=require(_0x7165('0x0'));var _=require(_0x7165('0x1'));var moment=require('moment');function checkNameSurname(_0x37a34f,_0x1cfceb,_0x35acda){var _0xcd7372='';if(!_[_0x7165('0x2')](_0x1cfceb)&&_0x7165('0x3')===typeof _0x1cfceb){_0xcd7372+=_0x1cfceb;}if(!_['isNil'](_0x35acda)&&_0x7165('0x3')===typeof _0x35acda){_0xcd7372+='\x20'+_0x35acda;}if(_0xcd7372!==''){return _0xcd7372;}return _0x37a34f;}function Action(_0x564753,_0x138e31,_0x17de3c){this[_0x7165('0x4')]=_0x564753;this[_0x7165('0x5')]=_0x17de3c||undefined;this[_0x7165('0x6')]=checkNameSurname(_0x138e31[_0x7165('0x7')][_0x7165('0x8')],_0x138e31[_0x7165('0x7')]['firstName'],_0x138e31[_0x7165('0x7')][_0x7165('0x9')]);this[_0x7165('0xa')]=_0x138e31[_0x7165('0x8')];this[_0x7165('0xb')]=_0x564753[_0x7165('0x6')];this[_0x7165('0xc')]=_0x138e31['active']||![];this[_0x7165('0xd')]=_0x564753['type'];this[_0x7165('0xe')]=_0x564753[_0x7165('0xe')]||0x3;this[_0x7165('0xf')]=_0x138e31[_0x7165('0xf')];this[_0x7165('0x10')]=_0x138e31[_0x7165('0x10')];this[_0x7165('0x11')]=_0x138e31['countcongestionretry'];this[_0x7165('0x12')]=_0x138e31[_0x7165('0x12')];this[_0x7165('0x13')]=_0x138e31['countnosuchnumberretry'];this[_0x7165('0x14')]=_0x138e31['countdropretry'];this['countabandonedretry']=_0x138e31[_0x7165('0x15')];this[_0x7165('0x16')]=_0x138e31['countmachineretry'];this[_0x7165('0x17')]=_0x138e31['countagentrejectretry'];this[_0x7165('0x18')]=_0x138e31[_0x7165('0x18')];this[_0x7165('0x19')]=_0x138e31[_0x7165('0x19')];this[_0x7165('0x1a')]=_0x138e31[_0x7165('0x1a')];this[_0x7165('0x1b')]=_0x138e31[_0x7165('0x1b')];this[_0x7165('0x1c')]=_0x138e31[_0x7165('0x1c')];this[_0x7165('0x1d')]=_0x138e31['id'];this[_0x7165('0x1e')]=_0x138e31[_0x7165('0x7')][_0x7165('0x1f')]||'';this['starttime']=moment()[_0x7165('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7165('0x21')]=_0x138e31['callback'];this[_0x7165('0x22')]=_0x138e31[_0x7165('0x22')];this[_0x7165('0x23')]=_0x138e31['callbackat'];this[_0x7165('0x24')]=_0x138e31[_0x7165('0x24')];this[_0x7165('0x25')]='';this[_0x7165('0x26')]='';}Action['prototype'][_0x7165('0x27')]=function(){return util[_0x7165('0x20')](_0x7165('0x28'),this[_0x7165('0x6')],this[_0x7165('0x4')][_0x7165('0x29')]>0x0?this[_0x7165('0xa')]['substring'](this[_0x7165('0x4')][_0x7165('0x29')]):this['number']);};Action[_0x7165('0x2a')][_0x7165('0x2b')]=function(){return this['queue'];};module[_0x7165('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index b0d7de7..cf037e1 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 _0xaa59=['holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','scheduledat','campaigntype','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','ringtime','getSeconds'];(function(_0x39a5a4,_0x200ab1){var _0xe9ffd8=function(_0x100595){while(--_0x100595){_0x39a5a4['push'](_0x39a5a4['shift']());}};_0xe9ffd8(++_0x200ab1);}(_0xaa59,0x1ea));var _0x9aa5=function(_0x329543,_0x2e03ff){_0x329543=_0x329543-0x0;var _0x1cf066=_0xaa59[_0x329543];return _0x1cf066;};'use strict';var moment=require('moment');var utils=require(_0x9aa5('0x0'));function AgentComplete(_0x1e27f0,_0x480868){this[_0x9aa5('0x1')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x1e27f0[_0x9aa5('0x2')];this['type']=_0x1e27f0['type'];this[_0x9aa5('0x3')]=_0x1e27f0[_0x9aa5('0x4')]==='outbound'?_0x9aa5('0x5'):_0x1e27f0[_0x9aa5('0x4')];this[_0x9aa5('0x6')]=_0x1e27f0[_0x9aa5('0x6')];this['countcongestionretry']=_0x1e27f0[_0x9aa5('0x7')];this[_0x9aa5('0x8')]=_0x1e27f0['countnoanswerretry'];this[_0x9aa5('0x9')]=_0x1e27f0['countbusyretry']+_0x1e27f0[_0x9aa5('0x7')]+_0x1e27f0[_0x9aa5('0x8')]+_0x1e27f0[_0x9aa5('0xa')]+_0x1e27f0['countdropretry']+_0x1e27f0['countabandonedretry']+_0x1e27f0[_0x9aa5('0xb')]+_0x1e27f0['countagentrejectretry'];this['countnosuchnumberretry']=_0x1e27f0[_0x9aa5('0xa')];this[_0x9aa5('0xc')]=_0x1e27f0[_0x9aa5('0xc')];this[_0x9aa5('0xd')]=_0x1e27f0[_0x9aa5('0xd')];this[_0x9aa5('0xb')]=_0x1e27f0[_0x9aa5('0xb')];this[_0x9aa5('0xe')]=_0x1e27f0[_0x9aa5('0xe')];this[_0x9aa5('0xf')]=_0x480868[_0x9aa5('0xf')];this[_0x9aa5('0x10')]=_0x1e27f0[_0x9aa5('0x11')];this[_0x9aa5('0x12')]=_0x1e27f0[_0x9aa5('0x13')];this[_0x9aa5('0x14')]=_0x1e27f0['starttime'];this[_0x9aa5('0x15')]=_0x1e27f0[_0x9aa5('0x15')];this[_0x9aa5('0x16')]=_0x1e27f0[_0x9aa5('0x16')];this[_0x9aa5('0x17')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x9aa5('0x18')]=utils[_0x9aa5('0x19')](_0x1e27f0[_0x9aa5('0x15')],_0x1e27f0['starttime']);this[_0x9aa5('0x1a')]=utils[_0x9aa5('0x19')](_0x1e27f0[_0x9aa5('0x16')],_0x1e27f0[_0x9aa5('0x15')]);this[_0x9aa5('0x1b')]=utils[_0x9aa5('0x19')](this[_0x9aa5('0x17')],_0x1e27f0[_0x9aa5('0x16')]);this[_0x9aa5('0x5')]=_0x480868[_0x9aa5('0x5')];this[_0x9aa5('0x1c')]=_0x480868[_0x9aa5('0x1c')];this[_0x9aa5('0x1d')]=_0x480868['reason'];this[_0x9aa5('0x1e')]=_0x1e27f0[_0x9aa5('0x1e')];this[_0x9aa5('0x1f')]=_0x1e27f0[_0x9aa5('0x1f')];this[_0x9aa5('0x20')]=_0x1e27f0[_0x9aa5('0x20')];this[_0x9aa5('0x21')]=_0x1e27f0[_0x9aa5('0x21')];this[_0x9aa5('0x22')]=_0x1e27f0[_0x9aa5('0x22')];this[_0x9aa5('0x23')]=_0x1e27f0['ListId'];this['UserId']=_0x1e27f0[_0x9aa5('0x24')];this[_0x9aa5('0x25')]=_0x1e27f0['VoiceQueueId'];this['CampaignId']=_0x1e27f0[_0x9aa5('0x26')];this[_0x9aa5('0x27')]=_0x1e27f0[_0x9aa5('0x27')]||'';this[_0x9aa5('0x28')]=_0x1e27f0[_0x9aa5('0x28')]||'';this[_0x9aa5('0x29')]=_0x1e27f0[_0x9aa5('0x29')];}module[_0x9aa5('0x2a')]=AgentComplete; \ No newline at end of file +var _0x8004=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','starttime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x36e0b3,_0x97f10){var _0x2ba55c=function(_0x22072){while(--_0x22072){_0x36e0b3['push'](_0x36e0b3['shift']());}};_0x2ba55c(++_0x97f10);}(_0x8004,0x129));var _0x4800=function(_0x13c645,_0x2ed23b){_0x13c645=_0x13c645-0x0;var _0x2a09e2=_0x8004[_0x13c645];return _0x2a09e2;};'use strict';var moment=require(_0x4800('0x0'));var utils=require('../utils');function AgentComplete(_0x5577e8,_0x387051){this['state']=0x4;this['statedesc']=_0x4800('0x1');this[_0x4800('0x2')]=_0x5577e8[_0x4800('0x2')];this[_0x4800('0x3')]=_0x5577e8[_0x4800('0x3')];this[_0x4800('0x4')]=_0x5577e8['type']===_0x4800('0x5')?_0x4800('0x6'):_0x5577e8[_0x4800('0x3')];this['countbusyretry']=_0x5577e8[_0x4800('0x7')];this['countcongestionretry']=_0x5577e8[_0x4800('0x8')];this['countnoanswerretry']=_0x5577e8[_0x4800('0x9')];this[_0x4800('0xa')]=_0x5577e8[_0x4800('0x7')]+_0x5577e8[_0x4800('0x8')]+_0x5577e8[_0x4800('0x9')]+_0x5577e8[_0x4800('0xb')]+_0x5577e8[_0x4800('0xc')]+_0x5577e8[_0x4800('0xd')]+_0x5577e8[_0x4800('0xe')]+_0x5577e8[_0x4800('0xf')];this[_0x4800('0xb')]=_0x5577e8[_0x4800('0xb')];this[_0x4800('0xc')]=_0x5577e8[_0x4800('0xc')];this['countabandonedretry']=_0x5577e8['countabandonedretry'];this[_0x4800('0xe')]=_0x5577e8[_0x4800('0xe')];this['countagentrejectretry']=_0x5577e8[_0x4800('0xf')];this['uniqueid']=_0x387051[_0x4800('0x10')];this[_0x4800('0x11')]=_0x5577e8[_0x4800('0x12')];this['calleridnum']=_0x5577e8[_0x4800('0x13')];this['starttime']=_0x5577e8['starttime'];this[_0x4800('0x14')]=_0x5577e8[_0x4800('0x14')];this['answertime']=_0x5577e8[_0x4800('0x15')];this[_0x4800('0x16')]=moment()[_0x4800('0x17')](_0x4800('0x18'));this[_0x4800('0x19')]=utils[_0x4800('0x1a')](_0x5577e8[_0x4800('0x14')],_0x5577e8[_0x4800('0x1b')]);this[_0x4800('0x1c')]=utils[_0x4800('0x1a')](_0x5577e8['answertime'],_0x5577e8[_0x4800('0x14')]);this[_0x4800('0x1d')]=utils[_0x4800('0x1a')](this[_0x4800('0x16')],_0x5577e8[_0x4800('0x15')]);this[_0x4800('0x6')]=_0x387051['queue'];this['membername']=_0x387051[_0x4800('0x1e')];this['reason']=_0x387051[_0x4800('0x1f')];this[_0x4800('0x20')]=_0x5577e8[_0x4800('0x20')];this['callbackuniqueid']=_0x5577e8[_0x4800('0x21')];this['callbackat']=_0x5577e8[_0x4800('0x22')];this['recallme']=_0x5577e8[_0x4800('0x23')];this['ContactId']=_0x5577e8[_0x4800('0x24')];this['ListId']=_0x5577e8[_0x4800('0x25')];this['UserId']=_0x5577e8['UserId'];this[_0x4800('0x26')]=_0x5577e8[_0x4800('0x26')];this[_0x4800('0x27')]=_0x5577e8[_0x4800('0x27')];this['originatecalleridnum']=_0x5577e8[_0x4800('0x28')]||'';this['originatecalleridname']=_0x5577e8[_0x4800('0x29')]||'';this['agiafterat']=_0x5577e8[_0x4800('0x2a')];}module[_0x4800('0x2b')]=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 8f87cad..df15ebb 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 _0x5be4=['countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','countcongestionretry'];(function(_0xe5cdb3,_0x16dd7a){var _0x4ce3c7=function(_0x454bbe){while(--_0x454bbe){_0xe5cdb3['push'](_0xe5cdb3['shift']());}};_0x4ce3c7(++_0x16dd7a);}(_0x5be4,0x162));var _0x45be=function(_0xb8e996,_0x5df044){_0xb8e996=_0xb8e996-0x0;var _0xea66d=_0x5be4[_0xb8e996];return _0xea66d;};'use strict';function Final(_0x40e9f6){this['uniqueid']=_0x40e9f6[_0x45be('0x0')];this['scheduledat']=_0x40e9f6[_0x45be('0x1')];this[_0x45be('0x2')]=_0x40e9f6[_0x45be('0x2')];this[_0x45be('0x3')]=_0x40e9f6[_0x45be('0x2')]===_0x45be('0x4')?'queue':_0x40e9f6[_0x45be('0x2')];this['countbusyretry']=_0x40e9f6['countbusyretry'];this[_0x45be('0x5')]=_0x40e9f6[_0x45be('0x5')];this[_0x45be('0x6')]=_0x40e9f6[_0x45be('0x6')];this[_0x45be('0x7')]=_0x40e9f6[_0x45be('0x8')]+_0x40e9f6[_0x45be('0x5')]+_0x40e9f6['countnoanswerretry']+_0x40e9f6[_0x45be('0x9')]+_0x40e9f6['countdropretry']+_0x40e9f6[_0x45be('0xa')]+_0x40e9f6[_0x45be('0xb')]+_0x40e9f6[_0x45be('0xc')];this['countnosuchnumberretry']=_0x40e9f6['countnosuchnumberretry'];this['countdropretry']=_0x40e9f6[_0x45be('0xd')];this[_0x45be('0xa')]=_0x40e9f6[_0x45be('0xa')];this[_0x45be('0xb')]=_0x40e9f6['countmachineretry'];this[_0x45be('0xc')]=_0x40e9f6[_0x45be('0xc')];this[_0x45be('0xe')]=_0x40e9f6[_0x45be('0xe')];this['calleridname']=_0x40e9f6[_0x45be('0xf')];this[_0x45be('0x10')]=_0x40e9f6[_0x45be('0x10')];this[_0x45be('0x11')]=_0x40e9f6[_0x45be('0x11')];this['responsetime']=_0x40e9f6[_0x45be('0x12')];this[_0x45be('0x13')]=_0x40e9f6[_0x45be('0x12')];this[_0x45be('0x14')]=_0x40e9f6[_0x45be('0x14')]||0x0;this[_0x45be('0x15')]=_0x40e9f6[_0x45be('0x15')]||0x0;this[_0x45be('0x16')]=_0x40e9f6[_0x45be('0x16')]||0x0;this['callback']=_0x40e9f6[_0x45be('0x17')];this[_0x45be('0x18')]=_0x40e9f6['callbackuniqueid'];this[_0x45be('0x19')]=_0x40e9f6[_0x45be('0x19')];this[_0x45be('0x1a')]=_0x40e9f6[_0x45be('0x1a')];this[_0x45be('0x1b')]=_0x40e9f6[_0x45be('0x1b')];this[_0x45be('0x1c')]=_0x40e9f6['ListId'];this[_0x45be('0x1d')]=_0x40e9f6[_0x45be('0x1d')];this[_0x45be('0x1e')]=_0x40e9f6['VoiceQueueId'];this[_0x45be('0x1f')]=_0x40e9f6[_0x45be('0x1f')];this[_0x45be('0x20')]=_0x40e9f6['originatecalleridnum']||'';this[_0x45be('0x21')]=_0x40e9f6[_0x45be('0x21')]||'';this[_0x45be('0x22')]=_0x40e9f6[_0x45be('0x22')];this['statedesc']=_0x40e9f6[_0x45be('0x23')];}module['exports']=Final; \ No newline at end of file +var _0x9292=['ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','responsetime','endtime'];(function(_0xd0dbec,_0x1315d7){var _0x328a4d=function(_0x4509d5){while(--_0x4509d5){_0xd0dbec['push'](_0xd0dbec['shift']());}};_0x328a4d(++_0x1315d7);}(_0x9292,0x105));var _0x2929=function(_0x4dd0e0,_0x393873){_0x4dd0e0=_0x4dd0e0-0x0;var _0x3d86bd=_0x9292[_0x4dd0e0];return _0x3d86bd;};'use strict';function Final(_0xef3aa){this[_0x2929('0x0')]=_0xef3aa[_0x2929('0x0')];this[_0x2929('0x1')]=_0xef3aa[_0x2929('0x1')];this['type']=_0xef3aa['type'];this[_0x2929('0x2')]=_0xef3aa['type']===_0x2929('0x3')?_0x2929('0x4'):_0xef3aa['type'];this[_0x2929('0x5')]=_0xef3aa['countbusyretry'];this[_0x2929('0x6')]=_0xef3aa['countcongestionretry'];this[_0x2929('0x7')]=_0xef3aa[_0x2929('0x7')];this[_0x2929('0x8')]=_0xef3aa[_0x2929('0x5')]+_0xef3aa[_0x2929('0x6')]+_0xef3aa['countnoanswerretry']+_0xef3aa[_0x2929('0x9')]+_0xef3aa['countdropretry']+_0xef3aa[_0x2929('0xa')]+_0xef3aa[_0x2929('0xb')]+_0xef3aa[_0x2929('0xc')];this['countnosuchnumberretry']=_0xef3aa[_0x2929('0x9')];this['countdropretry']=_0xef3aa[_0x2929('0xd')];this[_0x2929('0xa')]=_0xef3aa['countabandonedretry'];this[_0x2929('0xb')]=_0xef3aa[_0x2929('0xb')];this[_0x2929('0xc')]=_0xef3aa['countagentrejectretry'];this['queue']=_0xef3aa[_0x2929('0x4')];this['calleridname']=_0xef3aa[_0x2929('0xe')];this[_0x2929('0xf')]=_0xef3aa[_0x2929('0xf')];this[_0x2929('0x10')]=_0xef3aa[_0x2929('0x10')];this[_0x2929('0x11')]=_0xef3aa[_0x2929('0x11')];this[_0x2929('0x12')]=_0xef3aa[_0x2929('0x11')];this[_0x2929('0x13')]=_0xef3aa[_0x2929('0x13')]||0x0;this[_0x2929('0x14')]=_0xef3aa[_0x2929('0x14')]||0x0;this['talktime']=_0xef3aa[_0x2929('0x15')]||0x0;this[_0x2929('0x16')]=_0xef3aa[_0x2929('0x16')];this[_0x2929('0x17')]=_0xef3aa[_0x2929('0x17')];this[_0x2929('0x18')]=_0xef3aa[_0x2929('0x18')];this[_0x2929('0x19')]=_0xef3aa['recallme'];this[_0x2929('0x1a')]=_0xef3aa[_0x2929('0x1a')];this['ListId']=_0xef3aa[_0x2929('0x1b')];this[_0x2929('0x1c')]=_0xef3aa[_0x2929('0x1c')];this[_0x2929('0x1d')]=_0xef3aa[_0x2929('0x1d')];this[_0x2929('0x1e')]=_0xef3aa['CampaignId'];this[_0x2929('0x1f')]=_0xef3aa['originatecalleridnum']||'';this[_0x2929('0x20')]=_0xef3aa[_0x2929('0x20')]||'';this[_0x2929('0x21')]=_0xef3aa[_0x2929('0x21')];this['statedesc']=_0xef3aa[_0x2929('0x22')];}module['exports']=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 35ba9b3..d5ae16e 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 _0x0d70=['responsetime','endtime','ringtime','getSeconds','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime'];(function(_0x54c926,_0x3880cb){var _0x4805d8=function(_0x66d1aa){while(--_0x66d1aa){_0x54c926['push'](_0x54c926['shift']());}};_0x4805d8(++_0x3880cb);}(_0x0d70,0x91));var _0x00d7=function(_0x859f36,_0x30dffb){_0x859f36=_0x859f36-0x0;var _0x35107b=_0x0d70[_0x859f36];return _0x35107b;};'use strict';var moment=require(_0x00d7('0x0'));var utils=require('../utils');function Hangup(_0x56cab8,_0x4c4580){this[_0x00d7('0x1')]=0x4;this[_0x00d7('0x2')]=_0x00d7('0x3');this[_0x00d7('0x4')]=_0x56cab8['scheduledat'];this['type']=_0x56cab8[_0x00d7('0x5')];this[_0x00d7('0x6')]=_0x56cab8[_0x00d7('0x5')]===_0x00d7('0x7')?_0x00d7('0x8'):_0x56cab8['type'];this[_0x00d7('0x9')]=_0x56cab8[_0x00d7('0x9')]||![];this['countbusyretry']=_0x56cab8[_0x00d7('0xa')];this[_0x00d7('0xb')]=_0x56cab8[_0x00d7('0xb')];this['countnoanswerretry']=_0x56cab8[_0x00d7('0xc')];this[_0x00d7('0xd')]=_0x56cab8[_0x00d7('0xa')]+_0x56cab8[_0x00d7('0xb')]+_0x56cab8[_0x00d7('0xc')]+_0x56cab8[_0x00d7('0xe')]+_0x56cab8[_0x00d7('0xf')]+_0x56cab8[_0x00d7('0x10')]+_0x56cab8[_0x00d7('0x11')]+_0x56cab8[_0x00d7('0x12')];this['countnosuchnumberretry']=_0x56cab8['countnosuchnumberretry'];this[_0x00d7('0xf')]=_0x56cab8[_0x00d7('0xf')];this['countabandonedretry']=_0x56cab8[_0x00d7('0x10')];this[_0x00d7('0x11')]=_0x56cab8['countmachineretry'];this[_0x00d7('0x12')]=_0x56cab8[_0x00d7('0x12')];this[_0x00d7('0x13')]=_0x4c4580[_0x00d7('0x13')];this['calleridname']=_0x56cab8[_0x00d7('0x14')];this[_0x00d7('0x15')]=_0x56cab8['number'];this[_0x00d7('0x16')]=_0x56cab8[_0x00d7('0x16')];this['responsetime']=_0x56cab8[_0x00d7('0x17')];this[_0x00d7('0x18')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x00d7('0x19')]=utils[_0x00d7('0x1a')](_0x56cab8['responsetime'],_0x56cab8[_0x00d7('0x16')]);this[_0x00d7('0x1b')]=0x0;this['talktime']=utils[_0x00d7('0x1a')](this['endtime'],_0x56cab8['responsetime']);this['queue']=_0x56cab8[_0x00d7('0x8')];this[_0x00d7('0x1c')]=_0x00d7('0x1d');this[_0x00d7('0x1e')]=_0x4c4580[_0x00d7('0x1f')];this[_0x00d7('0x20')]=_0x56cab8[_0x00d7('0x20')];this['callbackuniqueid']=_0x56cab8[_0x00d7('0x21')];this[_0x00d7('0x22')]=_0x56cab8[_0x00d7('0x22')];this['recallme']=_0x56cab8[_0x00d7('0x23')];this[_0x00d7('0x24')]=_0x56cab8[_0x00d7('0x24')];this[_0x00d7('0x25')]=_0x56cab8[_0x00d7('0x25')];this[_0x00d7('0x26')]=_0x56cab8[_0x00d7('0x26')];this[_0x00d7('0x27')]=_0x56cab8['VoiceQueueId'];this[_0x00d7('0x28')]=_0x56cab8['CampaignId'];}module[_0x00d7('0x29')]=Hangup; \ No newline at end of file +var _0xb498=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','holdtime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x5ce00e,_0x5be1b1){var _0x2f825b=function(_0xe8ed6){while(--_0xe8ed6){_0x5ce00e['push'](_0x5ce00e['shift']());}};_0x2f825b(++_0x5be1b1);}(_0xb498,0x6f));var _0x8b49=function(_0x1dfc39,_0x1debca){_0x1dfc39=_0x1dfc39-0x0;var _0x41a1cb=_0xb498[_0x1dfc39];return _0x41a1cb;};'use strict';var moment=require(_0x8b49('0x0'));var utils=require(_0x8b49('0x1'));function Hangup(_0x1435ce,_0x1ee3b3){this['state']=0x4;this[_0x8b49('0x2')]='Answer';this['scheduledat']=_0x1435ce['scheduledat'];this['type']=_0x1435ce[_0x8b49('0x3')];this[_0x8b49('0x4')]=_0x1435ce['type']===_0x8b49('0x5')?_0x8b49('0x6'):_0x1435ce[_0x8b49('0x3')];this[_0x8b49('0x7')]=_0x1435ce[_0x8b49('0x7')]||![];this[_0x8b49('0x8')]=_0x1435ce[_0x8b49('0x8')];this[_0x8b49('0x9')]=_0x1435ce['countcongestionretry'];this['countnoanswerretry']=_0x1435ce[_0x8b49('0xa')];this[_0x8b49('0xb')]=_0x1435ce[_0x8b49('0x8')]+_0x1435ce[_0x8b49('0x9')]+_0x1435ce[_0x8b49('0xa')]+_0x1435ce['countnosuchnumberretry']+_0x1435ce[_0x8b49('0xc')]+_0x1435ce[_0x8b49('0xd')]+_0x1435ce[_0x8b49('0xe')]+_0x1435ce[_0x8b49('0xf')];this[_0x8b49('0x10')]=_0x1435ce[_0x8b49('0x10')];this[_0x8b49('0xc')]=_0x1435ce[_0x8b49('0xc')];this[_0x8b49('0xd')]=_0x1435ce[_0x8b49('0xd')];this['countmachineretry']=_0x1435ce[_0x8b49('0xe')];this[_0x8b49('0xf')]=_0x1435ce[_0x8b49('0xf')];this['uniqueid']=_0x1ee3b3[_0x8b49('0x11')];this[_0x8b49('0x12')]=_0x1435ce['name'];this['calleridnum']=_0x1435ce[_0x8b49('0x13')];this[_0x8b49('0x14')]=_0x1435ce['starttime'];this['responsetime']=_0x1435ce['responsetime'];this[_0x8b49('0x15')]=moment()[_0x8b49('0x16')](_0x8b49('0x17'));this[_0x8b49('0x18')]=utils[_0x8b49('0x19')](_0x1435ce[_0x8b49('0x1a')],_0x1435ce['starttime']);this[_0x8b49('0x1b')]=0x0;this['talktime']=utils[_0x8b49('0x19')](this[_0x8b49('0x15')],_0x1435ce[_0x8b49('0x1a')]);this[_0x8b49('0x6')]=_0x1435ce[_0x8b49('0x6')];this['membername']=_0x8b49('0x1c');this[_0x8b49('0x1d')]=_0x1ee3b3[_0x8b49('0x1e')];this[_0x8b49('0x1f')]=_0x1435ce['callback'];this[_0x8b49('0x20')]=_0x1435ce['callbackuniqueid'];this['callbackat']=_0x1435ce[_0x8b49('0x21')];this[_0x8b49('0x22')]=_0x1435ce[_0x8b49('0x22')];this[_0x8b49('0x23')]=_0x1435ce[_0x8b49('0x23')];this[_0x8b49('0x24')]=_0x1435ce[_0x8b49('0x24')];this[_0x8b49('0x25')]=_0x1435ce['UserId'];this[_0x8b49('0x26')]=_0x1435ce[_0x8b49('0x26')];this[_0x8b49('0x27')]=_0x1435ce[_0x8b49('0x27')];}module[_0x8b49('0x28')]=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 7004f2c..69efa2b 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 _0xa7af=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','exports','../utils','uniqueid','scheduledat','type','campaigntype'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa7af,0x6a));var _0xfa7a=function(_0x2c75b7,_0x1b0bb9){_0x2c75b7=_0x2c75b7-0x0;var _0x3c8f91=_0xa7af[_0x2c75b7];return _0x3c8f91;};'use strict';var utils=require(_0xfa7a('0x0'));function History(_0x122c9f){this['uniqueid']=_0x122c9f[_0xfa7a('0x1')];this[_0xfa7a('0x2')]=_0x122c9f['scheduledat']||undefined;this[_0xfa7a('0x3')]=_0x122c9f[_0xfa7a('0x3')];this[_0xfa7a('0x4')]=_0x122c9f['type']===_0xfa7a('0x5')?_0xfa7a('0x6'):_0x122c9f[_0xfa7a('0x3')];this[_0xfa7a('0x7')]=_0x122c9f[_0xfa7a('0x7')];this['countcongestionretry']=_0x122c9f[_0xfa7a('0x8')];this[_0xfa7a('0x9')]=_0x122c9f[_0xfa7a('0x9')];this[_0xfa7a('0xa')]=_0x122c9f[_0xfa7a('0x7')]+_0x122c9f[_0xfa7a('0x8')]+_0x122c9f[_0xfa7a('0x9')]+_0x122c9f['countnosuchnumberretry']+_0x122c9f['countdropretry']+_0x122c9f[_0xfa7a('0xb')]+_0x122c9f['countmachineretry']+_0x122c9f[_0xfa7a('0xc')];this['countnosuchnumberretry']=_0x122c9f[_0xfa7a('0xd')];this[_0xfa7a('0xe')]=_0x122c9f[_0xfa7a('0xe')];this[_0xfa7a('0xb')]=_0x122c9f[_0xfa7a('0xb')];this[_0xfa7a('0xf')]=_0x122c9f[_0xfa7a('0xf')];this['countagentrejectretry']=_0x122c9f[_0xfa7a('0xc')];this['queue']=_0x122c9f[_0xfa7a('0x6')];this[_0xfa7a('0x10')]=_0x122c9f[_0xfa7a('0x11')];this[_0xfa7a('0x12')]=_0x122c9f[_0xfa7a('0x13')];this['starttime']=_0x122c9f[_0xfa7a('0x14')];this[_0xfa7a('0x15')]=_0x122c9f[_0xfa7a('0x15')];this[_0xfa7a('0x16')]=_0x122c9f[_0xfa7a('0x15')];this[_0xfa7a('0x17')]=utils['getSeconds'](_0x122c9f['responsetime'],_0x122c9f[_0xfa7a('0x14')]);this['holdtime']=0x0;this[_0xfa7a('0x18')]=0x0;this['callback']=_0x122c9f[_0xfa7a('0x19')];this['callbackuniqueid']=_0x122c9f[_0xfa7a('0x1a')];this[_0xfa7a('0x1b')]=_0x122c9f[_0xfa7a('0x1b')];this[_0xfa7a('0x1c')]=_0x122c9f[_0xfa7a('0x1c')];this[_0xfa7a('0x1d')]=_0x122c9f[_0xfa7a('0x1d')];this['ListId']=_0x122c9f['ListId'];this['UserId']=_0x122c9f[_0xfa7a('0x1e')];this[_0xfa7a('0x1f')]=_0x122c9f[_0xfa7a('0x1f')];this[_0xfa7a('0x20')]=_0x122c9f[_0xfa7a('0x20')];this[_0xfa7a('0x21')]=_0x122c9f[_0xfa7a('0x21')]||'';this[_0xfa7a('0x22')]=_0x122c9f[_0xfa7a('0x22')]||'';this[_0xfa7a('0x23')]=_0x122c9f[_0xfa7a('0x23')];this['statedesc']=_0x122c9f['statedesc'];}module[_0xfa7a('0x24')]=History; \ No newline at end of file +var _0xc04a=['../utils','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports'];(function(_0x950588,_0x402c50){var _0xa8db75=function(_0x302d4e){while(--_0x302d4e){_0x950588['push'](_0x950588['shift']());}};_0xa8db75(++_0x402c50);}(_0xc04a,0xaf));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xac04('0x0'));function History(_0xd1447c){this[_0xac04('0x1')]=_0xd1447c['uniqueid'];this[_0xac04('0x2')]=_0xd1447c[_0xac04('0x2')]||undefined;this[_0xac04('0x3')]=_0xd1447c['type'];this['campaigntype']=_0xd1447c[_0xac04('0x3')]==='outbound'?_0xac04('0x4'):_0xd1447c[_0xac04('0x3')];this[_0xac04('0x5')]=_0xd1447c['countbusyretry'];this[_0xac04('0x6')]=_0xd1447c[_0xac04('0x6')];this[_0xac04('0x7')]=_0xd1447c[_0xac04('0x7')];this['countglobal']=_0xd1447c['countbusyretry']+_0xd1447c[_0xac04('0x6')]+_0xd1447c[_0xac04('0x7')]+_0xd1447c['countnosuchnumberretry']+_0xd1447c[_0xac04('0x8')]+_0xd1447c['countabandonedretry']+_0xd1447c[_0xac04('0x9')]+_0xd1447c[_0xac04('0xa')];this[_0xac04('0xb')]=_0xd1447c[_0xac04('0xb')];this[_0xac04('0x8')]=_0xd1447c['countdropretry'];this[_0xac04('0xc')]=_0xd1447c[_0xac04('0xc')];this[_0xac04('0x9')]=_0xd1447c['countmachineretry'];this[_0xac04('0xa')]=_0xd1447c['countagentrejectretry'];this[_0xac04('0x4')]=_0xd1447c['queue'];this[_0xac04('0xd')]=_0xd1447c[_0xac04('0xe')];this[_0xac04('0xf')]=_0xd1447c[_0xac04('0x10')];this['starttime']=_0xd1447c[_0xac04('0x11')];this['responsetime']=_0xd1447c[_0xac04('0x12')];this['endtime']=_0xd1447c[_0xac04('0x12')];this[_0xac04('0x13')]=utils[_0xac04('0x14')](_0xd1447c[_0xac04('0x12')],_0xd1447c[_0xac04('0x11')]);this[_0xac04('0x15')]=0x0;this[_0xac04('0x16')]=0x0;this[_0xac04('0x17')]=_0xd1447c[_0xac04('0x17')];this[_0xac04('0x18')]=_0xd1447c[_0xac04('0x18')];this[_0xac04('0x19')]=_0xd1447c[_0xac04('0x19')];this[_0xac04('0x1a')]=_0xd1447c[_0xac04('0x1a')];this[_0xac04('0x1b')]=_0xd1447c[_0xac04('0x1b')];this[_0xac04('0x1c')]=_0xd1447c['ListId'];this['UserId']=_0xd1447c['UserId'];this[_0xac04('0x1d')]=_0xd1447c['VoiceQueueId'];this[_0xac04('0x1e')]=_0xd1447c[_0xac04('0x1e')];this['originatecalleridnum']=_0xd1447c['originatecalleridnum']||'';this[_0xac04('0x1f')]=_0xd1447c[_0xac04('0x1f')]||'';this[_0xac04('0x20')]=_0xd1447c['state'];this[_0xac04('0x21')]=_0xd1447c[_0xac04('0x21')];}module[_0xac04('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 7bc0dd8..9801b77 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 _0xbf9f=['number','starttime','responsetime','droptime','dropreason','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum'];(function(_0x1365c0,_0x10bd93){var _0x106612=function(_0x1c67fb){while(--_0x1c67fb){_0x1365c0['push'](_0x1365c0['shift']());}};_0x106612(++_0x10bd93);}(_0xbf9f,0x97));var _0xfbf9=function(_0xf93a2f,_0xc2b785){_0xf93a2f=_0xf93a2f-0x0;var _0x5f0741=_0xbf9f[_0xf93a2f];return _0x5f0741;};'use strict';var utils=require(_0xfbf9('0x0'));function QueueCallerAbandon(_0x11cf17,_0x556fc7){this[_0xfbf9('0x1')]=_0x11cf17[_0xfbf9('0x1')];this[_0xfbf9('0x2')]=_0x11cf17['type'];this[_0xfbf9('0x3')]=_0x11cf17[_0xfbf9('0x2')]===_0xfbf9('0x4')?_0xfbf9('0x5'):_0x11cf17['type'];this['countbusyretry']=_0x11cf17[_0xfbf9('0x6')];this[_0xfbf9('0x7')]=_0x11cf17[_0xfbf9('0x7')];this[_0xfbf9('0x8')]=_0x11cf17[_0xfbf9('0x8')];this['countglobal']=_0x11cf17[_0xfbf9('0x6')]+_0x11cf17[_0xfbf9('0x7')]+_0x11cf17[_0xfbf9('0x8')]+_0x11cf17[_0xfbf9('0x9')]+_0x11cf17[_0xfbf9('0xa')]+_0x11cf17[_0xfbf9('0xb')]+_0x11cf17[_0xfbf9('0xc')]+_0x11cf17['countagentrejectretry'];this[_0xfbf9('0x9')]=_0x11cf17[_0xfbf9('0x9')];this['countdropretry']=_0x11cf17[_0xfbf9('0xa')];this[_0xfbf9('0xb')]=_0x11cf17['countabandonedretry'];this[_0xfbf9('0xc')]=_0x11cf17[_0xfbf9('0xc')];this[_0xfbf9('0xd')]=_0x11cf17['countagentrejectretry'];this['uniqueid']=_0x556fc7[_0xfbf9('0xe')];this['calleridname']=_0x11cf17[_0xfbf9('0xf')];this[_0xfbf9('0x10')]=_0x11cf17[_0xfbf9('0x11')];this[_0xfbf9('0x12')]=_0x11cf17['starttime'];this[_0xfbf9('0x13')]=_0x11cf17[_0xfbf9('0x13')];this[_0xfbf9('0x14')]=_0x11cf17[_0xfbf9('0x14')];this['dropreason']=_0x11cf17[_0xfbf9('0x15')];this['endtime']=this['droptime'];this['ringtime']=utils[_0xfbf9('0x16')](_0x11cf17[_0xfbf9('0x13')],_0x11cf17['starttime']);this[_0xfbf9('0x17')]=utils['getSeconds'](this['droptime'],_0x11cf17['responsetime']);this[_0xfbf9('0x18')]=0x0;this['queue']=_0x556fc7[_0xfbf9('0x5')];this['membername']=_0x556fc7[_0xfbf9('0x19')];this['reason']=_0x556fc7[_0xfbf9('0x1a')];this[_0xfbf9('0x1b')]=_0x11cf17['callback'];this[_0xfbf9('0x1c')]=_0x11cf17[_0xfbf9('0x1c')];this[_0xfbf9('0x1d')]=_0x11cf17['callbackat'];this[_0xfbf9('0x1e')]=_0x11cf17['recallme'];this[_0xfbf9('0x1f')]=_0x11cf17['ContactId'];this[_0xfbf9('0x20')]=_0x11cf17['ListId'];this['UserId']=_0x11cf17[_0xfbf9('0x21')];this[_0xfbf9('0x22')]=_0x11cf17[_0xfbf9('0x22')];this['CampaignId']=_0x11cf17[_0xfbf9('0x23')];this['originatecalleridnum']=_0x11cf17[_0xfbf9('0x24')]||'';this[_0xfbf9('0x25')]=_0x11cf17[_0xfbf9('0x25')]||'';this['agiafterat']=_0x11cf17[_0xfbf9('0x26')];this['state']=_0x11cf17[_0xfbf9('0x27')];this[_0xfbf9('0x28')]=_0x11cf17[_0xfbf9('0x28')];}module[_0xfbf9('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x50ce=['endtime','ringtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','name','number','starttime','responsetime','droptime','dropreason'];(function(_0x3edf8e,_0x45b865){var _0x4fbd0c=function(_0x4b03ab){while(--_0x4b03ab){_0x3edf8e['push'](_0x3edf8e['shift']());}};_0x4fbd0c(++_0x45b865);}(_0x50ce,0x15d));var _0xe50c=function(_0x324496,_0x3a4cdd){_0x324496=_0x324496-0x0;var _0x899545=_0x50ce[_0x324496];return _0x899545;};'use strict';var utils=require(_0xe50c('0x0'));function QueueCallerAbandon(_0x4203e2,_0x1d1ed4){this[_0xe50c('0x1')]=_0x4203e2[_0xe50c('0x1')];this[_0xe50c('0x2')]=_0x4203e2[_0xe50c('0x2')];this['campaigntype']=_0x4203e2[_0xe50c('0x2')]===_0xe50c('0x3')?_0xe50c('0x4'):_0x4203e2[_0xe50c('0x2')];this[_0xe50c('0x5')]=_0x4203e2['countbusyretry'];this[_0xe50c('0x6')]=_0x4203e2[_0xe50c('0x6')];this['countnoanswerretry']=_0x4203e2['countnoanswerretry'];this['countglobal']=_0x4203e2[_0xe50c('0x5')]+_0x4203e2['countcongestionretry']+_0x4203e2[_0xe50c('0x7')]+_0x4203e2['countnosuchnumberretry']+_0x4203e2[_0xe50c('0x8')]+_0x4203e2['countabandonedretry']+_0x4203e2[_0xe50c('0x9')]+_0x4203e2[_0xe50c('0xa')];this[_0xe50c('0xb')]=_0x4203e2[_0xe50c('0xb')];this[_0xe50c('0x8')]=_0x4203e2[_0xe50c('0x8')];this['countabandonedretry']=_0x4203e2[_0xe50c('0xc')];this[_0xe50c('0x9')]=_0x4203e2[_0xe50c('0x9')];this[_0xe50c('0xa')]=_0x4203e2['countagentrejectretry'];this[_0xe50c('0xd')]=_0x1d1ed4[_0xe50c('0xd')];this['calleridname']=_0x4203e2[_0xe50c('0xe')];this['calleridnum']=_0x4203e2[_0xe50c('0xf')];this[_0xe50c('0x10')]=_0x4203e2[_0xe50c('0x10')];this['responsetime']=_0x4203e2[_0xe50c('0x11')];this[_0xe50c('0x12')]=_0x4203e2[_0xe50c('0x12')];this[_0xe50c('0x13')]=_0x4203e2[_0xe50c('0x13')];this[_0xe50c('0x14')]=this[_0xe50c('0x12')];this[_0xe50c('0x15')]=utils[_0xe50c('0x16')](_0x4203e2[_0xe50c('0x11')],_0x4203e2['starttime']);this['holdtime']=utils['getSeconds'](this[_0xe50c('0x12')],_0x4203e2[_0xe50c('0x11')]);this[_0xe50c('0x17')]=0x0;this['queue']=_0x1d1ed4[_0xe50c('0x4')];this[_0xe50c('0x18')]=_0x1d1ed4[_0xe50c('0x19')];this[_0xe50c('0x1a')]=_0x1d1ed4['reason'];this[_0xe50c('0x1b')]=_0x4203e2[_0xe50c('0x1b')];this[_0xe50c('0x1c')]=_0x4203e2[_0xe50c('0x1c')];this[_0xe50c('0x1d')]=_0x4203e2[_0xe50c('0x1d')];this[_0xe50c('0x1e')]=_0x4203e2[_0xe50c('0x1e')];this[_0xe50c('0x1f')]=_0x4203e2[_0xe50c('0x1f')];this['ListId']=_0x4203e2[_0xe50c('0x20')];this[_0xe50c('0x21')]=_0x4203e2[_0xe50c('0x21')];this[_0xe50c('0x22')]=_0x4203e2[_0xe50c('0x22')];this[_0xe50c('0x23')]=_0x4203e2[_0xe50c('0x23')];this[_0xe50c('0x24')]=_0x4203e2[_0xe50c('0x24')]||'';this[_0xe50c('0x25')]=_0x4203e2['originatecalleridname']||'';this[_0xe50c('0x26')]=_0x4203e2[_0xe50c('0x26')];this['state']=_0x4203e2['state'];this[_0xe50c('0x27')]=_0x4203e2[_0xe50c('0x27')];}module[_0xe50c('0x28')]=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 a0fc2b0..6223f3e 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 _0x2675=['[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp'];(function(_0x278f81,_0x2196ef){var _0x5d3c09=function(_0x51321e){while(--_0x51321e){_0x278f81['push'](_0x278f81['shift']());}};_0x5d3c09(++_0x2196ef);}(_0x2675,0x75));var _0x5267=function(_0x3e396,_0x2e4f24){_0x3e396=_0x3e396-0x0;var _0x4de253=_0x2675[_0x3e396];return _0x4de253;};'use strict';var util=require(_0x5267('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x5267('0x1'));var cmHopperBlack=require(_0x5267('0x2'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x4600fa){return util[_0x5267('0x3')](_0x4600fa,{'showHidden':![],'depth':null});}function getContactDialer(_0x4e2548,_0x328776,_0xf2b350){return cmHopper[_0x5267('0x4')](_0x4e2548['id'],_0x328776,_0xf2b350,_0x4e2548[_0x5267('0x5')])[_0x5267('0x6')](function(_0xc56cd5){_0x4e2548['temp']=0x0;logger[_0x5267('0x7')](_0x5267('0x8'),inspectError(_0xc56cd5));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x799fcc,_0x5d6645){return cmHopper[_0x5267('0x9')](_0x799fcc['id'],_0x5d6645,_0x799fcc[_0x5267('0x5')])[_0x5267('0x6')](function(_0x534c2b){_0x799fcc[_0x5267('0xa')]=0x0;logger['error'](_0x5267('0xb'),inspectError(_0x534c2b));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x31ea34){return cmHopper[_0x5267('0xc')](_0x31ea34)[_0x5267('0x6')](function(_0x1f9be3){logger[_0x5267('0x7')](_0x5267('0xd'),inspectError(_0x1f9be3));});}exports[_0x5267('0xc')]=countReScheduled;function rescheduleContact(_0x36dc17){return cmHopper[_0x5267('0xe')](_0x36dc17)[_0x5267('0x6')](function(_0x16e5a7){logger[_0x5267('0x7')](_0x5267('0xf'),inspectError(_0x16e5a7));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x52e24e,_0xa593fb,_0x40d897){return cmHopper[_0x5267('0x10')](_0x52e24e,_0xa593fb,_0x40d897)[_0x5267('0x6')](function(_0x46b2c2){logger[_0x5267('0x7')](_0x5267('0x11'),inspectError(_0x46b2c2));});}exports[_0x5267('0x10')]=unlockContact;function moveContactManagedDialer(_0x15d81e){return cmHopper[_0x5267('0x12')](_0x15d81e)[_0x5267('0x6')](function(_0x1ab03){logger['error'](_0x5267('0x13'),inspectError(_0x1ab03));});}exports[_0x5267('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x5069e8){return cmHopperBlack[_0x5267('0x14')](_0x5069e8)['catch'](function(_0x1cf835){logger[_0x5267('0x7')](_0x5267('0x15'),inspectError(_0x1cf835));});}exports[_0x5267('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x5ca9c6){return cmHopperBlack['checkIsBlackListIvr'](_0x5ca9c6)[_0x5267('0x6')](function(_0x5aebdd){logger[_0x5267('0x7')](_0x5267('0x16'),inspectError(_0x5aebdd));});}exports[_0x5267('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x56dd95,_0x499f19,_0x5546e2){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x56dd95,_0x499f19,_0x5546e2)['catch'](function(_0x26c7f8){logger[_0x5267('0x7')](_0x5267('0x18'),inspectError(_0x26c7f8));});}exports[_0x5267('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x11c8ea,_0x40d1be,_0x126a97){return cmHopperAdditionalPhone[_0x5267('0x1a')](_0x11c8ea,_0x40d1be,_0x126a97)[_0x5267('0x6')](function(_0x59f112){logger['error'](_0x5267('0x1b'),inspectError(_0x59f112));});}exports[_0x5267('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x5abf95){return cmHopperHistory[_0x5267('0x1c')](_0x5abf95)['catch'](function(_0x4d7c2a){logger[_0x5267('0x7')](_0x5267('0x1d'),inspectError(_0x4d7c2a));});}exports[_0x5267('0x1c')]=avgHandleTime;function createHistory(_0x2d2ace){return cmHopperHistory[_0x5267('0x1e')](_0x2d2ace)['catch'](function(_0x5e87eb){logger[_0x5267('0x7')](_0x5267('0x1f'),inspectError(_0x5e87eb));});}exports[_0x5267('0x1e')]=createHistory; \ No newline at end of file +var _0x3e24=['[countReScheduled]','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','temp','countReScheduled'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x3e24,0x167));var _0x43e2=function(_0xa1bf55,_0xc0f3f){_0xa1bf55=_0xa1bf55-0x0;var _0x51a788=_0x3e24[_0xa1bf55];return _0x51a788;};'use strict';var util=require(_0x43e2('0x0'));var logger=require(_0x43e2('0x1'))(_0x43e2('0x2'));var cmHopper=require(_0x43e2('0x3'));var cmHopperAdditionalPhone=require(_0x43e2('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x43e2('0x5'));function inspectError(_0x1ff04b){return util['inspect'](_0x1ff04b,{'showHidden':![],'depth':null});}function getContactDialer(_0x1dd127,_0x18629c,_0x1a89fc){return cmHopper[_0x43e2('0x6')](_0x1dd127['id'],_0x18629c,_0x1a89fc,_0x1dd127[_0x43e2('0x7')])[_0x43e2('0x8')](function(_0x23b2d8){_0x1dd127['temp']=0x0;logger[_0x43e2('0x9')](_0x43e2('0xa'),inspectError(_0x23b2d8));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1c96f9,_0x2fdf85){return cmHopper['getContactDialerIvr'](_0x1c96f9['id'],_0x2fdf85,_0x1c96f9[_0x43e2('0x7')])[_0x43e2('0x8')](function(_0x52146c){_0x1c96f9[_0x43e2('0xb')]=0x0;logger['error']('[getContactDialerIvr]',inspectError(_0x52146c));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x103220){return cmHopper[_0x43e2('0xc')](_0x103220)[_0x43e2('0x8')](function(_0x44781a){logger[_0x43e2('0x9')](_0x43e2('0xd'),inspectError(_0x44781a));});}exports[_0x43e2('0xc')]=countReScheduled;function rescheduleContact(_0x802e2d){return cmHopper[_0x43e2('0xe')](_0x802e2d)[_0x43e2('0x8')](function(_0x377097){logger[_0x43e2('0x9')]('[rescheduleContact]',inspectError(_0x377097));});}exports[_0x43e2('0xe')]=rescheduleContact;function unlockContact(_0x40fb7b,_0xb929b5,_0x2a0fb0){return cmHopper['unlockContact'](_0x40fb7b,_0xb929b5,_0x2a0fb0)['catch'](function(_0x241da2){logger[_0x43e2('0x9')](_0x43e2('0xf'),inspectError(_0x241da2));});}exports[_0x43e2('0x10')]=unlockContact;function moveContactManagedDialer(_0x105cb8){return cmHopper[_0x43e2('0x11')](_0x105cb8)[_0x43e2('0x8')](function(_0x15ecb5){logger[_0x43e2('0x9')](_0x43e2('0x12'),inspectError(_0x15ecb5));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x3ee34c){return cmHopperBlack[_0x43e2('0x13')](_0x3ee34c)['catch'](function(_0x115c0a){logger['error'](_0x43e2('0x14'),inspectError(_0x115c0a));});}exports[_0x43e2('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x1fac53){return cmHopperBlack[_0x43e2('0x15')](_0x1fac53)[_0x43e2('0x8')](function(_0x5ae97b){logger[_0x43e2('0x9')](_0x43e2('0x16'),inspectError(_0x5ae97b));});}exports[_0x43e2('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x52e361,_0x234a1d,_0x32f048){return cmHopperAdditionalPhone[_0x43e2('0x17')](_0x52e361,_0x234a1d,_0x32f048)[_0x43e2('0x8')](function(_0x4f20e6){logger[_0x43e2('0x9')](_0x43e2('0x18'),inspectError(_0x4f20e6));});}exports[_0x43e2('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x3b7b22,_0x178223,_0x2a593e){return cmHopperAdditionalPhone[_0x43e2('0x19')](_0x3b7b22,_0x178223,_0x2a593e)[_0x43e2('0x8')](function(_0xd29b7b){logger[_0x43e2('0x9')](_0x43e2('0x1a'),inspectError(_0xd29b7b));});}exports[_0x43e2('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x52ed49){return cmHopperHistory[_0x43e2('0x1b')](_0x52ed49)[_0x43e2('0x8')](function(_0x545246){logger[_0x43e2('0x9')](_0x43e2('0x1c'),inspectError(_0x545246));});}exports[_0x43e2('0x1b')]=avgHandleTime;function createHistory(_0x404483){return cmHopperHistory[_0x43e2('0x1d')](_0x404483)['catch'](function(_0x42f495){logger[_0x43e2('0x9')](_0x43e2('0x1e'),inspectError(_0x42f495));});}exports[_0x43e2('0x1d')]=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 1aa12f6..5ede925 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 _0x42aa=['INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','message','available','loggedIn','loggedInDb','talking','pTalking','waiting','inUse','originated','Trunk','name','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','SIP/','reachable','unmonitored','includes','TrunkBackup','status','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','replace','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','tags','updatedAt','undefined','%s%s','XMD-','setXMDContactVariables','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE'];(function(_0x50d623,_0x5829bb){var _0x510b6b=function(_0x5d5ae9){while(--_0x5d5ae9){_0x50d623['push'](_0x50d623['shift']());}};_0x510b6b(++_0x5829bb);}(_0x42aa,0x1e6));var _0xa42a=function(_0x2d926e,_0x180843){_0x2d926e=_0x2d926e-0x0;var _0x146ae9=_0x42aa[_0x2d926e];return _0x146ae9;};'use strict';var _=require('lodash');var moment=require(_0xa42a('0x0'));var util=require(_0xa42a('0x1'));var logger=require(_0xa42a('0x2'))(_0xa42a('0x3'));var timezones=require(_0xa42a('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xa42a('0x5'),'BLACKLIST':_0xa42a('0x6'),'CONTACTS_RESCHEDULED':_0xa42a('0x7'),'DEACTIVATED':_0xa42a('0x8'),'DISACTIVED':_0xa42a('0x9'),'EMPTY_INTERVAL':_0xa42a('0xa'),'INACTIVE':_0xa42a('0xb'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xa42a('0xc'),'OVERTIME_INTERVAL':_0xa42a('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xa42a('0xe'),'QUEUE_RECALL':_0xa42a('0xf'),'RECALL_TIMEOUT':_0xa42a('0x10'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xa42a('0x11'),'UNREACHABLE_TRUNK':_0xa42a('0x12')};exports[_0xa42a('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5102d3){return _0x5102d3[_0xa42a('0x14')]==='preview';}exports[_0xa42a('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x18a3c7){return _0x18a3c7[_0xa42a('0x16')]===_0xa42a('0x17');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x46e7cf){return _0x46e7cf[_0xa42a('0x16')]===_0xa42a('0x18');}exports[_0xa42a('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x96d852){return _0x96d852[_0xa42a('0x1a')];}exports[_0xa42a('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x17a7c2){return _0x17a7c2[_0xa42a('0x1c')];}exports[_0xa42a('0x1d')]=isIVRCampaignActive;function getSeconds(_0x474b69,_0x5efdb3){var _0x41312a=moment(_0x474b69)[_0xa42a('0x1e')](0x0);var _0x27577c=moment(_0x5efdb3)['milliseconds'](0x0);return _0x41312a['diff'](_0x27577c,_0xa42a('0x1f'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x508df9,_0x34d907){var _0x4ecd92=![];var _0x47560b=_0x508df9[_0xa42a('0x14')]!==_0x34d907[_0xa42a('0x14')]||_0x508df9['dialActive']!==_0x34d907[_0xa42a('0x1a')]||_0x508df9[_0xa42a('0x20')]!==_0x34d907[_0xa42a('0x20')];var _0x45a7e2=_0x508df9[_0xa42a('0x21')]!==_0x34d907[_0xa42a('0x21')]||_0x508df9[_0xa42a('0x22')]!==_0x34d907[_0xa42a('0x22')]||_0x508df9[_0xa42a('0x23')]!==_0x34d907[_0xa42a('0x23')]||_0x508df9['paused']!==_0x34d907['paused']||_0x508df9[_0xa42a('0x24')]!==_0x34d907['talking']||_0x508df9[_0xa42a('0x25')]!==_0x34d907[_0xa42a('0x25')]||_0x508df9[_0xa42a('0x26')]!==_0x34d907[_0xa42a('0x26')]||_0x508df9[_0xa42a('0x27')]!==_0x34d907[_0xa42a('0x27')]||_0x508df9[_0xa42a('0x28')]!==_0x34d907[_0xa42a('0x28')];if(_0x508df9[_0xa42a('0x29')]&&_0x34d907[_0xa42a('0x29')]){_0x4ecd92=_0x508df9[_0xa42a('0x29')][_0xa42a('0x2a')]!==_0x34d907[_0xa42a('0x29')][_0xa42a('0x2a')]||_0x508df9['Trunk'][_0xa42a('0x1c')]!==_0x34d907[_0xa42a('0x29')][_0xa42a('0x1c')];}return _0x47560b||_0x45a7e2||_0x4ecd92;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x504ec1){var _0xcdc1a=null;var _0x1a7b54=_0x504ec1['dialTimezone'];if(_[_0xa42a('0x2b')](_0x504ec1[_0xa42a('0x2c')])||_[_0xa42a('0x2b')](_0x504ec1[_0xa42a('0x2d')])||_[_0xa42a('0x2b')](_0x504ec1[_0xa42a('0x2d')][_0xa42a('0x2e')])){_0xcdc1a=CAMPAIGN_STATUS[_0xa42a('0x2f')];}else if(_[_0xa42a('0x30')](_0x504ec1[_0xa42a('0x2c')])||_[_0xa42a('0x30')](_0x504ec1[_0xa42a('0x2d')][_0xa42a('0x2e')])){_0xcdc1a=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x1a7b54&&!timezones[_0x1a7b54]){_0xcdc1a=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0xcdc1a;}function checkAnyValidTrunk(_0x17bdfe,_0x2d8e48){var _0xbf8b39=null;var _0x2b5539=_0xa42a('0x31');var _0x2bc0ec=[_0xa42a('0x32'),_0xa42a('0x33')];var _0x3b25d1=!![];if(_0x17bdfe['Trunk']&&_0x17bdfe[_0xa42a('0x29')][_0xa42a('0x1c')]){_0x2b5539+=_0x17bdfe[_0xa42a('0x29')][_0xa42a('0x2a')];_0xbf8b39=_0x2d8e48[_0x2b5539];_0x3b25d1=_0x2bc0ec[_0xa42a('0x34')](_0xbf8b39['status']);}else if(_0x17bdfe[_0xa42a('0x35')]&&_0x17bdfe[_0xa42a('0x35')][_0xa42a('0x1c')]){_0x2b5539+=_0x17bdfe['TrunkBackup'][_0xa42a('0x2a')];_0xbf8b39=_0x2d8e48[_0x2b5539];_0x3b25d1=_0x2bc0ec[_0xa42a('0x34')](_0xbf8b39[_0xa42a('0x36')]);}return _0x3b25d1;}function getQueueCampaignStatusMessage(_0xb4652f,_0x4d8774){var _0x1d121d=CAMPAIGN_STATUS[_0xa42a('0x5')];var _0x4c345e=isPreviewCampaign(_0xb4652f);if(!isQueueCampaignActive(_0xb4652f)){if(_0x4c345e){_0x1d121d=CAMPAIGN_STATUS[_0xa42a('0x37')];}else{if(_0xb4652f[_0xa42a('0x28')]===0x0&&_0xb4652f[_0xa42a('0x24')]===0x0&&_0xb4652f['waiting']===0x0&&(_0xb4652f[_0xa42a('0x25')]||0x0)===0x0){_0x1d121d=CAMPAIGN_STATUS['INACTIVE'];}else{_0x1d121d=CAMPAIGN_STATUS[_0xa42a('0x38')];}}}else if(_0xb4652f[_0xa42a('0x22')]===0x0){_0x1d121d=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0xb4652f,_0x4d8774)){_0x1d121d=CAMPAIGN_STATUS[_0xa42a('0x39')];}else if(!isPreviewCampaign(_0xb4652f)){var _0x581260=checkAnyValidQueueCampaignInterval(_0xb4652f);if(_0x581260){_0x1d121d=_0x581260;}}return _0x1d121d;}exports[_0xa42a('0x3a')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x584db0){var _0x31e685=CAMPAIGN_STATUS[_0xa42a('0x38')];if(_0x584db0[_0xa42a('0x28')]===0x0&&_0x584db0[_0xa42a('0x24')]===0x0&&_0x584db0[_0xa42a('0x26')]===0x0&&(_0x584db0['pTalking']||0x0)===0x0){_0x31e685=CAMPAIGN_STATUS['INACTIVE'];}return _0x31e685;}exports[_0xa42a('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2c367b){var _0x11f548=_0x2c367b[_0xa42a('0x3c')](/"(.*?)"/);return _0x11f548?_0x11f548[0x1]:_0x2c367b;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x2d6582,_0x5e0ae2,_0x428fab){if(!_[_0xa42a('0x3d')](_0x428fab)&&typeof _0x428fab===_0xa42a('0x3e')&&!_[_0xa42a('0x30')](_0x428fab)){if(!_[_0xa42a('0x3d')](_0x5e0ae2)&&typeof _0x5e0ae2===_0xa42a('0x3e')&&!_[_0xa42a('0x30')](_0x5e0ae2)){return util[_0xa42a('0x3f')](_0xa42a('0x40'),_0x5e0ae2,_0x428fab);}return util['format'](_0xa42a('0x40'),_0x428fab,_0x428fab);}if(!_['isUndefined'](_0x2d6582)&&typeof _0x2d6582===_0xa42a('0x3e')&&!_[_0xa42a('0x30')](_0x2d6582)){return _0x2d6582;}return _0xa42a('0x41');}exports[_0xa42a('0x42')]=getCallerId;function getCallerIdRandom(_0x4a107f,_0x38599a){var _0x4e28a7;var _0x13e7ee;var _0x30087f;if(_0x38599a<=0x0){_0x38599a=0x1;}_0x4e28a7=new RegExp('\x5cw{0,'+_0x38599a+'}$');_0x13e7ee=Math[_0xa42a('0x43')](0xa,_0x38599a-0x1);_0x30087f=Math['pow'](0xa,_0x38599a)-0x1;return util[_0xa42a('0x3f')]('%s',_[_0xa42a('0x44')](_0x4a107f,_0x4e28a7,_['random'](_0x13e7ee,_0x30087f)['toString']()));}exports[_0xa42a('0x45')]=getCallerIdRandom;function decrementOriginate(_0x4acd0d){if(_0x4acd0d[_0xa42a('0x28')]&&_0x4acd0d[_0xa42a('0x28')]>0x0){_0x4acd0d[_0xa42a('0x28')]-=0x1;}else{logger[_0xa42a('0x46')](_0xa42a('0x47'));}}exports[_0xa42a('0x48')]=decrementOriginate;function checkContactEmpty(_0x26a41d){return _0x26a41d&&_0x26a41d[_0xa42a('0x49')]>0x0;}exports[_0xa42a('0x4a')]=checkContactEmpty;function erlangb(_0x3e9d20,_0x2826f4){if(_0x2826f4===0x0){return 0x0;}var _0x3b9e95=0x1;for(var _0x455b95=0x1;_0x455b95<=_0x2826f4;_0x455b95+=0x1){_0x3b9e95=0x1+_0x3b9e95*_0x455b95/_0x3e9d20;}return 0x1/_0x3b9e95;}exports[_0xa42a('0x4b')]=erlangb;function checkContactLowerLimitOriginate(_0x282a17,_0x25e0db,_0x5f0481){if(_0x25e0db>_0x5f0481){for(var _0x50e573=0x0;_0x50e573<_0x25e0db-_0x5f0481;_0x50e573+=0x1){decrementOriginate(_0x282a17);}}}exports[_0xa42a('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x5a3980){var _0x5a5695={};var _0x3c6f7e=['id','createdAt','description',_0xa42a('0x4d'),_0xa42a('0x4e')];if(_0x5a3980){for(var _0x5a702e in _0x5a3980){if(typeof _0x5a3980[_0x5a702e]!==_0xa42a('0x4f')){if(!_['isNil'](_0x5a3980[_0x5a702e])&&!_0x3c6f7e['includes'](_0x5a702e)){_0x5a5695[util[_0xa42a('0x3f')](_0xa42a('0x50'),_0xa42a('0x51'),_0x5a702e['toUpperCase']())]=_0x5a3980[_0x5a702e];}}}}return _0x5a5695;}exports[_0xa42a('0x52')]=setXMDContactVariables; \ No newline at end of file +var _0x095e=['moment','util','dialer','../../../../config/environment/shared','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','error','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash'];(function(_0xdb703f,_0x383320){var _0x331202=function(_0x2692a6){while(--_0x2692a6){_0xdb703f['push'](_0xdb703f['shift']());}};_0x331202(++_0x383320);}(_0x095e,0x157));var _0xe095=function(_0x6290de,_0x380679){_0x6290de=_0x6290de-0x0;var _0x5e564d=_0x095e[_0x6290de];return _0x5e564d;};'use strict';var _=require(_0xe095('0x0'));var moment=require(_0xe095('0x1'));var util=require(_0xe095('0x2'));var logger=require('../../../../config/logger')(_0xe095('0x3'));var timezones=require(_0xe095('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0xe095('0x5'),'CONTACTS_RESCHEDULED':_0xe095('0x6'),'DEACTIVATED':_0xe095('0x7'),'DISACTIVED':_0xe095('0x8'),'EMPTY_INTERVAL':_0xe095('0x9'),'INACTIVE':_0xe095('0xa'),'NO_AGENTS_LOGGED':_0xe095('0xb'),'NO_AVAILABLE_CONTACTS':_0xe095('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xe095('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xe095('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xe095('0xf'),'RUNNING':_0xe095('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xe095('0x11')};exports[_0xe095('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x128773){return _0x128773[_0xe095('0x13')]===_0xe095('0x14');}exports[_0xe095('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x1914d2){return _0x1914d2[_0xe095('0x16')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x3c139d){return _0x3c139d['type']===_0xe095('0x17');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0xdeda54){return _0xdeda54[_0xe095('0x18')];}exports[_0xe095('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1fef3e){return _0x1fef3e[_0xe095('0x1a')];}exports[_0xe095('0x1b')]=isIVRCampaignActive;function getSeconds(_0x4b2224,_0x3bee31){var _0x59dc2c=moment(_0x4b2224)['milliseconds'](0x0);var _0x2b928a=moment(_0x3bee31)['milliseconds'](0x0);return _0x59dc2c['diff'](_0x2b928a,_0xe095('0x1c'));}exports[_0xe095('0x1d')]=getSeconds;function hasQueueCampaignDataChanged(_0x3a5018,_0x4b6da9){var _0x52ab07=![];var _0x394513=_0x3a5018[_0xe095('0x13')]!==_0x4b6da9[_0xe095('0x13')]||_0x3a5018[_0xe095('0x18')]!==_0x4b6da9[_0xe095('0x18')]||_0x3a5018[_0xe095('0x1e')]!==_0x4b6da9[_0xe095('0x1e')];var _0x1d9a2b=_0x3a5018['available']!==_0x4b6da9[_0xe095('0x1f')]||_0x3a5018[_0xe095('0x20')]!==_0x4b6da9[_0xe095('0x20')]||_0x3a5018[_0xe095('0x21')]!==_0x4b6da9['loggedInDb']||_0x3a5018['paused']!==_0x4b6da9[_0xe095('0x22')]||_0x3a5018[_0xe095('0x23')]!==_0x4b6da9[_0xe095('0x23')]||_0x3a5018['pTalking']!==_0x4b6da9[_0xe095('0x24')]||_0x3a5018[_0xe095('0x25')]!==_0x4b6da9[_0xe095('0x25')]||_0x3a5018[_0xe095('0x26')]!==_0x4b6da9['inUse']||_0x3a5018['originated']!==_0x4b6da9[_0xe095('0x27')];if(_0x3a5018[_0xe095('0x28')]&&_0x4b6da9['Trunk']){_0x52ab07=_0x3a5018[_0xe095('0x28')][_0xe095('0x29')]!==_0x4b6da9[_0xe095('0x28')]['name']||_0x3a5018[_0xe095('0x28')][_0xe095('0x1a')]!==_0x4b6da9[_0xe095('0x28')][_0xe095('0x1a')];}return _0x394513||_0x1d9a2b||_0x52ab07;}exports[_0xe095('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x59d0d0){var _0x4f8848=null;var _0x18082f=_0x59d0d0['dialTimezone'];if(_['isNil'](_0x59d0d0[_0xe095('0x2b')])||_['isNil'](_0x59d0d0['Interval'])||_[_0xe095('0x2c')](_0x59d0d0[_0xe095('0x2d')][_0xe095('0x2e')])){_0x4f8848=CAMPAIGN_STATUS[_0xe095('0x2f')];}else if(_[_0xe095('0x30')](_0x59d0d0[_0xe095('0x2b')])||_[_0xe095('0x30')](_0x59d0d0[_0xe095('0x2d')][_0xe095('0x2e')])){_0x4f8848=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x18082f&&!timezones[_0x18082f]){_0x4f8848=CAMPAIGN_STATUS[_0xe095('0x31')];}return _0x4f8848;}function checkAnyValidTrunk(_0x4e68ca,_0x1f4f0a){var _0x3bb0c1=null;var _0xc6b4ba=_0xe095('0x32');var _0x14a889=['reachable',_0xe095('0x33')];var _0x40dbc1=!![];if(_0x4e68ca[_0xe095('0x28')]&&_0x4e68ca['Trunk'][_0xe095('0x1a')]){_0xc6b4ba+=_0x4e68ca[_0xe095('0x28')][_0xe095('0x29')];_0x3bb0c1=_0x1f4f0a[_0xc6b4ba];_0x40dbc1=_0x14a889[_0xe095('0x34')](_0x3bb0c1[_0xe095('0x35')]);}else if(_0x4e68ca['TrunkBackup']&&_0x4e68ca['TrunkBackup']['active']){_0xc6b4ba+=_0x4e68ca[_0xe095('0x36')]['name'];_0x3bb0c1=_0x1f4f0a[_0xc6b4ba];_0x40dbc1=_0x14a889[_0xe095('0x34')](_0x3bb0c1[_0xe095('0x35')]);}return _0x40dbc1;}function getQueueCampaignStatusMessage(_0x3a6b5c,_0x19d2e2){var _0x986f25=CAMPAIGN_STATUS['ACTIVE'];var _0x2dd1e4=isPreviewCampaign(_0x3a6b5c);if(!isQueueCampaignActive(_0x3a6b5c)){if(_0x2dd1e4){_0x986f25=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x3a6b5c[_0xe095('0x27')]===0x0&&_0x3a6b5c['talking']===0x0&&_0x3a6b5c[_0xe095('0x25')]===0x0&&(_0x3a6b5c[_0xe095('0x24')]||0x0)===0x0){_0x986f25=CAMPAIGN_STATUS[_0xe095('0x37')];}else{_0x986f25=CAMPAIGN_STATUS[_0xe095('0x38')];}}}else if(_0x3a6b5c[_0xe095('0x20')]===0x0){_0x986f25=CAMPAIGN_STATUS[_0xe095('0x39')];}else if(!checkAnyValidTrunk(_0x3a6b5c,_0x19d2e2)){_0x986f25=CAMPAIGN_STATUS[_0xe095('0x3a')];}else if(!isPreviewCampaign(_0x3a6b5c)){var _0x1700ab=checkAnyValidQueueCampaignInterval(_0x3a6b5c);if(_0x1700ab){_0x986f25=_0x1700ab;}}return _0x986f25;}exports[_0xe095('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xdd18b8){var _0x459e2b=CAMPAIGN_STATUS[_0xe095('0x38')];if(_0xdd18b8['originated']===0x0&&_0xdd18b8[_0xe095('0x23')]===0x0&&_0xdd18b8[_0xe095('0x25')]===0x0&&(_0xdd18b8[_0xe095('0x24')]||0x0)===0x0){_0x459e2b=CAMPAIGN_STATUS[_0xe095('0x37')];}return _0x459e2b;}exports[_0xe095('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1842c2){var _0x1e1b73=_0x1842c2[_0xe095('0x3d')](/"(.*?)"/);return _0x1e1b73?_0x1e1b73[0x1]:_0x1842c2;}exports[_0xe095('0x3e')]=extractCalleridName;function getCallerId(_0xb57a7c,_0x3379fc,_0x13bccb){if(!_[_0xe095('0x3f')](_0x13bccb)&&typeof _0x13bccb==='string'&&!_[_0xe095('0x30')](_0x13bccb)){if(!_[_0xe095('0x3f')](_0x3379fc)&&typeof _0x3379fc==='string'&&!_[_0xe095('0x30')](_0x3379fc)){return util[_0xe095('0x40')](_0xe095('0x41'),_0x3379fc,_0x13bccb);}return util[_0xe095('0x40')]('\x22%s\x22\x20<%s>',_0x13bccb,_0x13bccb);}if(!_[_0xe095('0x3f')](_0xb57a7c)&&typeof _0xb57a7c===_0xe095('0x42')&&!_[_0xe095('0x30')](_0xb57a7c)){return _0xb57a7c;}return _0xe095('0x43');}exports[_0xe095('0x44')]=getCallerId;function getCallerIdRandom(_0x2afa1a,_0x17b51f){var _0x56e257;var _0x1c8039;var _0x172f3d;if(_0x17b51f<=0x0){_0x17b51f=0x1;}_0x56e257=new RegExp(_0xe095('0x45')+_0x17b51f+'}$');_0x1c8039=Math[_0xe095('0x46')](0xa,_0x17b51f-0x1);_0x172f3d=Math[_0xe095('0x46')](0xa,_0x17b51f)-0x1;return util[_0xe095('0x40')]('%s',_[_0xe095('0x47')](_0x2afa1a,_0x56e257,_[_0xe095('0x48')](_0x1c8039,_0x172f3d)['toString']()));}exports[_0xe095('0x49')]=getCallerIdRandom;function decrementOriginate(_0x3e19c8){if(_0x3e19c8[_0xe095('0x27')]&&_0x3e19c8[_0xe095('0x27')]>0x0){_0x3e19c8[_0xe095('0x27')]-=0x1;}else{logger[_0xe095('0x4a')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x210fa4){return _0x210fa4&&_0x210fa4['length']>0x0;}exports[_0xe095('0x4b')]=checkContactEmpty;function erlangb(_0x26fe69,_0xd1b3ff){if(_0xd1b3ff===0x0){return 0x0;}var _0x8815d0=0x1;for(var _0x446e26=0x1;_0x446e26<=_0xd1b3ff;_0x446e26+=0x1){_0x8815d0=0x1+_0x8815d0*_0x446e26/_0x26fe69;}return 0x1/_0x8815d0;}exports[_0xe095('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x34abb2,_0x5aaa9e,_0x4e0cd6){if(_0x5aaa9e>_0x4e0cd6){for(var _0x1d7483=0x0;_0x1d7483<_0x5aaa9e-_0x4e0cd6;_0x1d7483+=0x1){decrementOriginate(_0x34abb2);}}}exports[_0xe095('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x57f49b){var _0x515fec={};var _0x164c86=['id',_0xe095('0x4e'),_0xe095('0x4f'),_0xe095('0x50'),'updatedAt'];if(_0x57f49b){for(var _0x2566ff in _0x57f49b){if(typeof _0x57f49b[_0x2566ff]!==_0xe095('0x51')){if(!_[_0xe095('0x2c')](_0x57f49b[_0x2566ff])&&!_0x164c86['includes'](_0x2566ff)){_0x515fec[util[_0xe095('0x40')](_0xe095('0x52'),_0xe095('0x53'),_0x2566ff[_0xe095('0x54')]())]=_0x57f49b[_0x2566ff];}}}}return _0x515fec;}exports[_0xe095('0x55')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index f2f01bf..2c75da4 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(_0x2846fc,_0x51e861){var _0x779dd6=function(_0x5da470){while(--_0x5da470){_0x2846fc['push'](_0x2846fc['shift']());}};_0x779dd6(++_0x51e861);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x35c464,_0x1d976b){var _0xb83aac=function(_0x27ef81){while(--_0x27ef81){_0x35c464['push'](_0x35c464['shift']());}};_0xb83aac(++_0x1d976b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 b5a32b5..c80afff 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 _0x7ce1=['../../../config/logger','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','hasOwnProperty','value','syncNewState','channelstate','channelstatedesc','variable','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','error','stringify','\x20receiveFax\x20','actions','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','format','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs'];(function(_0x24e1bd,_0x4213ee){var _0x339468=function(_0x55b1eb){while(--_0x55b1eb){_0x24e1bd['push'](_0x24e1bd['shift']());}};_0x339468(++_0x4213ee);}(_0x7ce1,0x1e1));var _0x17ce=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x7ce1[_0x4350c2];return _0x8b6406;};'use strict';var util=require('util');var _=require(_0x17ce('0x0'));var BPromise=require(_0x17ce('0x1'));var uuid=require(_0x17ce('0x2'));var moment=require(_0x17ce('0x3'));var path=require(_0x17ce('0x4'));var tiff2pdf=require(_0x17ce('0x5'));var gs=require(_0x17ce('0x6'));var logger=require(_0x17ce('0x7'))('fax');var ami=require('../ami');var rpcDb=require(_0x17ce('0x8'));var Channel=require('./channel');var ut=require(_0x17ce('0x9'));var Action=require(_0x17ce('0xa'));var faxAccount=require(_0x17ce('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x17ce('0xc'));function Fax(_0xcdd45b){this[_0x17ce('0xd')]={};this['faxAccounts']=_0xcdd45b[_0x17ce('0xe')];this[_0x17ce('0xf')]=_0xcdd45b[_0x17ce('0xf')];this['actions']={};ami['on'](_0x17ce('0x10'),this[_0x17ce('0x11')]['bind'](this));ami['on'](_0x17ce('0x12'),this[_0x17ce('0x13')][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x15'),this['syncNewState'][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x16'),this[_0x17ce('0x17')][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x18'),this[_0x17ce('0x19')][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x1a'),this['syncReceiveFax'][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x1b'),this[_0x17ce('0x1c')][_0x17ce('0x14')](this));ami['on'](_0x17ce('0x1d'),this[_0x17ce('0x1e')]['bind'](this));}Fax[_0x17ce('0x1f')]['syncNewchannel']=function(_0x9513d0){if(_0x9513d0[_0x17ce('0x20')]===_0x17ce('0x21')){for(var _0xfbef3f in this['faxAccounts']){if(this[_0x17ce('0xe')]['hasOwnProperty'](_0xfbef3f)){if(_0x9513d0[_0x17ce('0x22')]===this[_0x17ce('0xe')][_0xfbef3f][_0x17ce('0x23')]){this[_0x17ce('0xd')][_0x9513d0[_0x17ce('0x24')]]={};this[_0x17ce('0xd')][_0x9513d0['uniqueid']][_0x17ce('0x25')]=_0x9513d0[_0x17ce('0x25')];this[_0x17ce('0xd')][_0x9513d0[_0x17ce('0x24')]]['id']=this[_0x17ce('0xe')][_0xfbef3f]['id'];this[_0x17ce('0xd')][_0x9513d0[_0x17ce('0x24')]][_0x17ce('0x26')]=this['faxAccounts'][_0xfbef3f][_0x17ce('0x26')];logger['info'](_0x9513d0[_0x17ce('0x24')],_0x17ce('0x27'));}}}}if(this['actions'][_0x9513d0['uniqueid']]){this[_0x17ce('0xd')][_0x9513d0['uniqueid']]={};this['channels'][_0x9513d0[_0x17ce('0x24')]]['channel']=_0x9513d0[_0x17ce('0x25')];logger[_0x17ce('0x28')](_0x9513d0[_0x17ce('0x24')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x17ce('0x13')]=function(_0x1cba39){if(this[_0x17ce('0xd')][_0x1cba39[_0x17ce('0x24')]]){for(var _0x52d05c in _0x1cba39['variable']){if(_0x1cba39['variable'][_0x17ce('0x29')](_0x52d05c)){this[_0x17ce('0xd')][_0x1cba39[_0x17ce('0x24')]][_0x52d05c]=_0x1cba39[_0x17ce('0x2a')];}}}};Fax['prototype'][_0x17ce('0x2b')]=function(_0x923802){if(this[_0x17ce('0xd')][_0x923802[_0x17ce('0x24')]]){this['channels'][_0x923802[_0x17ce('0x24')]]['channelstate']=_0x923802[_0x17ce('0x2c')];this[_0x17ce('0xd')][_0x923802[_0x17ce('0x24')]]['channelstatedesc']=_0x923802[_0x17ce('0x2d')];}};Fax[_0x17ce('0x1f')][_0x17ce('0x17')]=function(_0x463f20){if(this['channels'][_0x463f20[_0x17ce('0x24')]]){for(var _0x270072 in _0x463f20[_0x17ce('0x2e')]){if(_0x463f20['variable']['hasOwnProperty'](_0x270072)){this[_0x17ce('0xd')][_0x463f20[_0x17ce('0x24')]][_0x270072]=_0x463f20[_0x17ce('0x2a')];}}}};Fax[_0x17ce('0x1f')][_0x17ce('0x19')]=function(_0x4c5d50){if(this[_0x17ce('0xd')][_0x4c5d50['uniqueid']]){this[_0x17ce('0xd')][_0x4c5d50['uniqueid']][_0x17ce('0x2f')]=_0x4c5d50[_0x17ce('0x2f')];this[_0x17ce('0xd')][_0x4c5d50[_0x17ce('0x24')]][_0x17ce('0x30')]=_0x4c5d50[_0x17ce('0x30')];this['channels'][_0x4c5d50[_0x17ce('0x24')]]['localstationid']=_0x4c5d50[_0x17ce('0x23')];this[_0x17ce('0xd')][_0x4c5d50[_0x17ce('0x24')]][_0x17ce('0x31')]=_0x4c5d50[_0x17ce('0x31')];logger[_0x17ce('0x28')](_0x4c5d50['uniqueid'],_0x17ce('0x32'));}};Fax[_0x17ce('0x1f')]['syncReceiveFax']=function(_0xdc51b){var _0x283db6=this;if(this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]]){var _0x1064bf=this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]]['id'];this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]][_0x17ce('0x33')]=_0xdc51b['remotestationid'];this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]][_0x17ce('0x34')]=_0xdc51b[_0x17ce('0x34')];this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]][_0x17ce('0x23')]=_0xdc51b[_0x17ce('0x23')];this['channels'][_0xdc51b[_0x17ce('0x24')]]['resolution']=_0xdc51b[_0x17ce('0x35')];this['channels'][_0xdc51b[_0x17ce('0x24')]][_0x17ce('0x36')]=_0xdc51b[_0x17ce('0x36')];this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]]['filename']=_0xdc51b[_0x17ce('0x31')];this['channels'][_0xdc51b[_0x17ce('0x24')]]['calleridnum']=_0xdc51b[_0x17ce('0x37')];if(this[_0x17ce('0xd')][_0xdc51b[_0x17ce('0x24')]][_0x17ce('0x34')]>0x0){tiff2pdf(_0xdc51b[_0x17ce('0x31')],_0x17ce('0x38'),function(_0x3291ff){logger[_0x17ce('0x28')](_0xdc51b[_0x17ce('0x24')],_0x17ce('0x39'),_0x3291ff[_0x17ce('0x3a')]);attachment[_0x17ce('0x3b')]({'name':path[_0x17ce('0x3c')](_0xdc51b[_0x17ce('0x31')])['name'],'basename':path['parse'](_0xdc51b['filename'])[_0x17ce('0x26')]+_0x17ce('0x3d'),'type':_0x17ce('0x3e')})[_0x17ce('0x3f')](function(_0x5a16c0){faxAccount[_0x17ce('0x40')](_0x1064bf,{'from':_0xdc51b['calleridnum'],'mapKey':_0x17ce('0x41'),'body':path[_0x17ce('0x3c')](_0xdc51b['filename'])[_0x17ce('0x26')]+'.pdf','AttachmentId':_0x5a16c0['id']})['catch'](function(_0x5a02d5){logger[_0x17ce('0x42')](_0xdc51b[_0x17ce('0x24')],'\x20notify\x20',JSON[_0x17ce('0x43')](_0x5a02d5));});})['catch'](function(_0x4e2484){logger[_0x17ce('0x42')](_0xdc51b[_0x17ce('0x24')],_0x17ce('0x44'),JSON['stringify'](_0x4e2484));});});}logger[_0x17ce('0x28')](_0xdc51b['uniqueid'],'\x20receiveFax\x20');}};Fax['prototype'][_0x17ce('0x1e')]=function(_0x5b7d24){if(this[_0x17ce('0x45')][_0x5b7d24[_0x17ce('0x24')]]){_['merge'](this[_0x17ce('0xd')][_0x5b7d24[_0x17ce('0x24')]],_['pick'](_0x5b7d24,[_0x17ce('0x46'),_0x17ce('0x47')]));}};function updateStatus(_0x5f5144){if(_0x5f5144[_0x17ce('0x48')]){faxMessage[_0x17ce('0x49')](_0x5f5144[_0x17ce('0x48')],{'failMessage':_0x17ce('0x4a')})[_0x17ce('0x3f')](function(_0x2fb461){ut[_0x17ce('0x4b')](_0x17ce('0x4c'),_0x2fb461);})[_0x17ce('0x4d')](function(_0xa92c49){ut[_0x17ce('0x4b')](_0x17ce('0x4e'),_0xa92c49);});}else{ut[_0x17ce('0x4b')](_0x17ce('0x4f'));}}Fax[_0x17ce('0x1f')]['updateStatus']=function(_0x40d30e,_0x305cbe,_0x213c33){var _0x545873=this;var _0x30bef4={};if(_0x305cbe){_0x30bef4={'read':_0x305cbe};}else{_0x30bef4={'failMessage':_0x213c33};}if(this[_0x17ce('0x45')][_0x40d30e][_0x17ce('0x48')]){faxMessage['update'](this[_0x17ce('0x45')][_0x40d30e][_0x17ce('0x48')],_0x30bef4)['then'](function(_0x417094){ut[_0x17ce('0x4b')](_0x17ce('0x50'),_0x417094);})['catch'](function(_0x24ab11){ut[_0x17ce('0x4b')]('[Fax][Message][NoUpdate1]',_0x24ab11);})[_0x17ce('0x51')](function(){delete _0x545873[_0x17ce('0xd')][_0x40d30e];delete _0x545873[_0x17ce('0x45')][_0x40d30e];});}else{ut[_0x17ce('0x4b')](_0x17ce('0x52'));delete this[_0x17ce('0xd')][_0x40d30e];delete this[_0x17ce('0x45')][_0x40d30e];}};Fax[_0x17ce('0x1f')][_0x17ce('0x1c')]=function(_0x2add8e){var _0x3ca810=this;if(this['channels'][_0x2add8e[_0x17ce('0x24')]]){if(this['actions'][_0x2add8e[_0x17ce('0x24')]]){this['channels'][_0x2add8e[_0x17ce('0x24')]]['id']=this['actions'][_0x2add8e[_0x17ce('0x24')]]['id'];this['channels'][_0x2add8e[_0x17ce('0x24')]]['name']=this[_0x17ce('0x45')][_0x2add8e[_0x17ce('0x24')]]['name'];}logger[_0x17ce('0x28')](_0x2add8e[_0x17ce('0x24')],this[_0x17ce('0x45')][_0x2add8e[_0x17ce('0x24')]]?_0x17ce('0x53'):_0x17ce('0x54'),JSON[_0x17ce('0x43')](this[_0x17ce('0xd')][_0x2add8e[_0x17ce('0x24')]]));if(this[_0x17ce('0x45')][_0x2add8e[_0x17ce('0x24')]]){if(this[_0x17ce('0xd')][_0x2add8e[_0x17ce('0x24')]][_0x17ce('0x55')]>0x0&&this[_0x17ce('0xd')][_0x2add8e['uniqueid']]['faxstatus']==='SUCCESS'){this[_0x17ce('0x56')](_0x2add8e[_0x17ce('0x24')],!![]);}else{this['updateStatus'](_0x2add8e[_0x17ce('0x24')],![],this[_0x17ce('0xd')][_0x2add8e[_0x17ce('0x24')]][_0x17ce('0x57')]?_0x17ce('0x58')+this['channels'][_0x2add8e[_0x17ce('0x24')]][_0x17ce('0x57')]:'SENDING\x20FAILED');}}}};Fax[_0x17ce('0x1f')][_0x17ce('0x59')]=function(_0x3323ca){var _0x5d820e=this;return new BPromise(function(_0x31e395,_0x4360b2){_0x5d820e[_0x17ce('0x5a')](_0x3323ca,_0x5d820e[_0x17ce('0xe')][_0x3323ca[_0x17ce('0x5b')]])[_0x17ce('0x3f')](function(_0x488f3b){ut['logger'](_0x17ce('0x5c'),_0x488f3b);_0x31e395(ut[_0x17ce('0x3a')](_0x17ce('0x5d')));})[_0x17ce('0x4d')](function(_0x2a638a){ut['logger'](_0x17ce('0x5e'),_0x2a638a);updateStatus(_0x3323ca);_0x4360b2(ut[_0x17ce('0x3a')](_0x17ce('0x5f')));});});};Fax[_0x17ce('0x1f')][_0x17ce('0x60')]=function(_0x484962){var _0x51614b=this;return new BPromise(function(_0x3cf0af,_0x5379b8){var _0x170e17=_0x51614b['checkTrunk'](_0x51614b[_0x17ce('0xe')][_0x484962['FaxAccountId']][_0x17ce('0x61')],_0x484962);if(_0x170e17[_0x17ce('0x62')]){_0x3cf0af(ut['message']('Trunk\x20Reachable'));}else{_0x5379b8(ut[_0x17ce('0x3a')](_0x170e17[_0x17ce('0x3a')]));}});};function originate(_0x57fe7e,_0x375816,_0x56c02f){return new BPromise(function(_0x2356d1,_0x157312){if(_0x56c02f){var _0x3c5d5c=util[_0x17ce('0x63')]('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['parse'](_0x57fe7e['path'])['name'],_0x57fe7e[_0x17ce('0x4')]);gs[_0x17ce('0x64')](_0x3c5d5c)['then'](function(){_0x57fe7e[_0x17ce('0x4')]=util[_0x17ce('0x63')](_0x17ce('0x65'),path[_0x17ce('0x3c')](_0x57fe7e[_0x17ce('0x4')])[_0x17ce('0x66')],path[_0x17ce('0x3c')](_0x57fe7e[_0x17ce('0x4')])[_0x17ce('0x26')]);_0x375816['XMF-PATH']=_0x57fe7e['path'];ut[_0x17ce('0x4b')](_0x17ce('0x67'),'');ami[_0x17ce('0x68')](ut[_0x17ce('0x69')](_0x57fe7e,_0x375816))[_0x17ce('0x3f')](function(_0x53c36f){_0x2356d1(_0x53c36f);})['catch'](function(_0x5e5189){_0x157312(_0x5e5189);});})[_0x17ce('0x4d')](function(_0x27a508){_0x157312(_0x27a508);});}else{ami[_0x17ce('0x68')](ut['variablesAction'](_0x57fe7e,_0x375816))[_0x17ce('0x3f')](function(_0x59f341){_0x2356d1(_0x59f341);})[_0x17ce('0x4d')](function(_0x279ed3){_0x157312(_0x279ed3);});}});}Fax[_0x17ce('0x1f')][_0x17ce('0x5a')]=function(_0x4355a8,_0x3dfa0c){var _0x4e4534=this;return new BPromise(function(_0x3f226c,_0x27e0f0){var _0x2affcb=uuid['v4']();var _0x34f2af=ut['addVariables'](_0x4355a8,_0x3dfa0c);_0x4e4534[_0x17ce('0x45')][_0x2affcb]=new Action(_0x2affcb,_0x3dfa0c,_0x4355a8);var _0x22dd32=_0x4e4534['actions'][_0x2affcb];if(path[_0x17ce('0x3c')](_0x4355a8[_0x17ce('0x4')])[_0x17ce('0x6a')]===_0x17ce('0x3d')){originate(_0x22dd32,_0x34f2af,!![])[_0x17ce('0x3f')](function(_0x4f3fcd){_0x3f226c(_0x4f3fcd);})['catch'](function(_0x17f8af){_0x27e0f0(_0x17f8af);});}else{originate(_0x22dd32,_0x34f2af,![])[_0x17ce('0x3f')](function(_0x1b251d){_0x3f226c(_0x1b251d);})[_0x17ce('0x4d')](function(_0x1273ec){_0x27e0f0(_0x1273ec);});}});};Fax[_0x17ce('0x1f')][_0x17ce('0x6b')]=function(_0x5bf7ee){return!_['isNil'](_0x5bf7ee)&&!_[_0x17ce('0x6c')](_0x5bf7ee[_0x17ce('0x26')])&&!_['isNil'](_0x5bf7ee[_0x17ce('0x6d')])&&_0x5bf7ee[_0x17ce('0x6d')]&&!_[_0x17ce('0x6c')](this[_0x17ce('0xf')][util[_0x17ce('0x63')](_0x17ce('0x6e'),_0x5bf7ee['name'])])&&!_[_0x17ce('0x6c')](this[_0x17ce('0xf')][util[_0x17ce('0x63')]('SIP/%s',_0x5bf7ee[_0x17ce('0x26')])][_0x17ce('0x30')])&&(this[_0x17ce('0xf')][util[_0x17ce('0x63')](_0x17ce('0x6e'),_0x5bf7ee[_0x17ce('0x26')])]['status']===_0x17ce('0x6f')||this[_0x17ce('0xf')][util[_0x17ce('0x63')](_0x17ce('0x6e'),_0x5bf7ee[_0x17ce('0x26')])][_0x17ce('0x30')]===_0x17ce('0x70'));};Fax[_0x17ce('0x1f')][_0x17ce('0x71')]=function(_0x951acb,_0x124853){if(!this[_0x17ce('0x6b')](_0x951acb)){ut[_0x17ce('0x4b')](_0x17ce('0x72'),_['isNil'](_0x951acb)?'':_0x951acb[_0x17ce('0x26')]+_0x17ce('0x73'));return{'isValid':![],'message':_0x17ce('0x74')};}if(_[_0x17ce('0x6c')](_0x124853[_0x17ce('0x41')])){ut[_0x17ce('0x4b')](_0x17ce('0x75'),JSON[_0x17ce('0x43')](_0x124853));return{'isValid':![],'message':_0x17ce('0x76')};}if(_[_0x17ce('0x6c')](_0x124853[_0x17ce('0x4')])){ut[_0x17ce('0x4b')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x17ce('0x43')](_0x124853));return{'isValid':![],'message':_0x17ce('0x77')};}return{'isValid':!![],'message':_0x17ce('0x78')};};module[_0x17ce('0x79')]=Fax; \ No newline at end of file +var _0x9012=['bind','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','syncVarSet','variable','value','channelstate','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','reason','AttachmentId','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','finally','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','uuid','moment','path','tiff2pdf','../../../config/logger','fax','./rpcDb','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','varset'];(function(_0x50db0d,_0x8c4eb7){var _0x2b8907=function(_0x470e12){while(--_0x470e12){_0x50db0d['push'](_0x50db0d['shift']());}};_0x2b8907(++_0x8c4eb7);}(_0x9012,0x1b0));var _0x2901=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x9012[_0x2a0350];return _0x425220;};'use strict';var util=require(_0x2901('0x0'));var _=require(_0x2901('0x1'));var BPromise=require('bluebird');var uuid=require(_0x2901('0x2'));var moment=require(_0x2901('0x3'));var path=require(_0x2901('0x4'));var tiff2pdf=require(_0x2901('0x5'));var gs=require('./util/gs');var logger=require(_0x2901('0x6'))(_0x2901('0x7'));var ami=require('../ami');var rpcDb=require(_0x2901('0x8'));var Channel=require('./channel');var ut=require(_0x2901('0x9'));var Action=require(_0x2901('0xa'));var faxAccount=require(_0x2901('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x35b8fd){this[_0x2901('0xc')]={};this[_0x2901('0xd')]=_0x35b8fd[_0x2901('0xd')];this[_0x2901('0xe')]=_0x35b8fd['trunks'];this['actions']={};ami['on']('newchannel',this['syncNewchannel']['bind'](this));ami['on'](_0x2901('0xf'),this['syncVarSet'][_0x2901('0x10')](this));ami['on'](_0x2901('0x11'),this[_0x2901('0x12')][_0x2901('0x10')](this));ami['on']('newexten',this[_0x2901('0x13')][_0x2901('0x10')](this));ami['on'](_0x2901('0x14'),this[_0x2901('0x15')][_0x2901('0x10')](this));ami['on'](_0x2901('0x16'),this[_0x2901('0x17')]['bind'](this));ami['on'](_0x2901('0x18'),this[_0x2901('0x19')][_0x2901('0x10')](this));ami['on'](_0x2901('0x1a'),this[_0x2901('0x1b')][_0x2901('0x10')](this));}Fax[_0x2901('0x1c')][_0x2901('0x1d')]=function(_0x3d3472){if(_0x3d3472[_0x2901('0x1e')]===_0x2901('0x1f')){for(var _0x51a414 in this[_0x2901('0xd')]){if(this[_0x2901('0xd')][_0x2901('0x20')](_0x51a414)){if(_0x3d3472[_0x2901('0x21')]===this['faxAccounts'][_0x51a414]['localstationid']){this[_0x2901('0xc')][_0x3d3472['uniqueid']]={};this[_0x2901('0xc')][_0x3d3472[_0x2901('0x22')]][_0x2901('0x23')]=_0x3d3472[_0x2901('0x23')];this[_0x2901('0xc')][_0x3d3472[_0x2901('0x22')]]['id']=this[_0x2901('0xd')][_0x51a414]['id'];this[_0x2901('0xc')][_0x3d3472[_0x2901('0x22')]]['name']=this[_0x2901('0xd')][_0x51a414][_0x2901('0x24')];logger[_0x2901('0x25')](_0x3d3472[_0x2901('0x22')],_0x2901('0x26'));}}}}if(this[_0x2901('0x27')][_0x3d3472[_0x2901('0x22')]]){this[_0x2901('0xc')][_0x3d3472[_0x2901('0x22')]]={};this[_0x2901('0xc')][_0x3d3472['uniqueid']]['channel']=_0x3d3472[_0x2901('0x23')];logger[_0x2901('0x25')](_0x3d3472[_0x2901('0x22')],_0x2901('0x26'));}};Fax[_0x2901('0x1c')][_0x2901('0x28')]=function(_0x927ec6){if(this[_0x2901('0xc')][_0x927ec6['uniqueid']]){for(var _0x36efc0 in _0x927ec6[_0x2901('0x29')]){if(_0x927ec6['variable'][_0x2901('0x20')](_0x36efc0)){this[_0x2901('0xc')][_0x927ec6[_0x2901('0x22')]][_0x36efc0]=_0x927ec6[_0x2901('0x2a')];}}}};Fax[_0x2901('0x1c')][_0x2901('0x12')]=function(_0x260272){if(this[_0x2901('0xc')][_0x260272[_0x2901('0x22')]]){this['channels'][_0x260272[_0x2901('0x22')]]['channelstate']=_0x260272[_0x2901('0x2b')];this[_0x2901('0xc')][_0x260272[_0x2901('0x22')]]['channelstatedesc']=_0x260272['channelstatedesc'];}};Fax['prototype'][_0x2901('0x13')]=function(_0x2d4dd){if(this['channels'][_0x2d4dd[_0x2901('0x22')]]){for(var _0x480dac in _0x2d4dd[_0x2901('0x29')]){if(_0x2d4dd[_0x2901('0x29')][_0x2901('0x20')](_0x480dac)){this[_0x2901('0xc')][_0x2d4dd['uniqueid']][_0x480dac]=_0x2d4dd['value'];}}}};Fax[_0x2901('0x1c')][_0x2901('0x15')]=function(_0x3507c4){if(this[_0x2901('0xc')][_0x3507c4['uniqueid']]){this[_0x2901('0xc')][_0x3507c4[_0x2901('0x22')]]['operation']=_0x3507c4[_0x2901('0x2c')];this[_0x2901('0xc')][_0x3507c4['uniqueid']][_0x2901('0x2d')]=_0x3507c4[_0x2901('0x2d')];this['channels'][_0x3507c4[_0x2901('0x22')]][_0x2901('0x2e')]=_0x3507c4[_0x2901('0x2e')];this['channels'][_0x3507c4[_0x2901('0x22')]][_0x2901('0x2f')]=_0x3507c4[_0x2901('0x2f')];logger[_0x2901('0x25')](_0x3507c4[_0x2901('0x22')],_0x2901('0x30'));}};Fax[_0x2901('0x1c')]['syncReceiveFax']=function(_0x4c6ce0){var _0x29d764=this;if(this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]]){var _0x2ea0df=this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]]['id'];this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x31')]=_0x4c6ce0[_0x2901('0x31')];this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x32')]=_0x4c6ce0['pagestransferred'];this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x2e')]=_0x4c6ce0[_0x2901('0x2e')];this['channels'][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x33')]=_0x4c6ce0[_0x2901('0x33')];this['channels'][_0x4c6ce0['uniqueid']][_0x2901('0x34')]=_0x4c6ce0[_0x2901('0x34')];this[_0x2901('0xc')][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x2f')]=_0x4c6ce0[_0x2901('0x2f')];this['channels'][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x35')]=_0x4c6ce0[_0x2901('0x35')];if(this['channels'][_0x4c6ce0[_0x2901('0x22')]][_0x2901('0x32')]>0x0){tiff2pdf(_0x4c6ce0[_0x2901('0x2f')],_0x2901('0x36'),function(_0x4a5339){logger['info'](_0x4c6ce0[_0x2901('0x22')],_0x2901('0x37'),_0x4a5339[_0x2901('0x38')]);attachment[_0x2901('0x39')]({'name':path['parse'](_0x4c6ce0[_0x2901('0x2f')])['name'],'basename':path[_0x2901('0x3a')](_0x4c6ce0[_0x2901('0x2f')])['name']+'.pdf','type':_0x2901('0x3b')})[_0x2901('0x3c')](function(_0x4a8c45){faxAccount[_0x2901('0x3d')](_0x2ea0df,{'from':_0x4c6ce0[_0x2901('0x35')],'mapKey':_0x2901('0x7'),'body':path[_0x2901('0x3a')](_0x4c6ce0[_0x2901('0x2f')])['name']+_0x2901('0x3e'),'AttachmentId':_0x4a8c45['id']})[_0x2901('0x3f')](function(_0x486018){logger[_0x2901('0x40')](_0x4c6ce0[_0x2901('0x22')],_0x2901('0x41'),JSON[_0x2901('0x42')](_0x486018));});})['catch'](function(_0x3f9371){logger[_0x2901('0x40')](_0x4c6ce0[_0x2901('0x22')],_0x2901('0x43'),JSON[_0x2901('0x42')](_0x3f9371));});});}logger[_0x2901('0x25')](_0x4c6ce0[_0x2901('0x22')],_0x2901('0x43'));}};Fax[_0x2901('0x1c')][_0x2901('0x1b')]=function(_0x374c46){if(this['actions'][_0x374c46['uniqueid']]){_[_0x2901('0x44')](this[_0x2901('0xc')][_0x374c46['uniqueid']],_['pick'](_0x374c46,[_0x2901('0x45'),_0x2901('0x46')]));}};function updateStatus(_0x47ee96){if(_0x47ee96[_0x2901('0x47')]){faxMessage['update'](_0x47ee96[_0x2901('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x2901('0x3c')](function(_0x2bf38b){ut[_0x2901('0x48')]('[Fax][Message][Error][Updated]',_0x2bf38b);})[_0x2901('0x3f')](function(_0x40ac9b){ut[_0x2901('0x48')]('[Fax][Message][Error][NoUpdate1]',_0x40ac9b);});}else{ut[_0x2901('0x48')](_0x2901('0x49'));}}Fax[_0x2901('0x1c')][_0x2901('0x4a')]=function(_0x1bcaab,_0x6a1a24,_0x2ace66){var _0x12956d=this;var _0x178820={};if(_0x6a1a24){_0x178820={'read':_0x6a1a24};}else{_0x178820={'failMessage':_0x2ace66};}if(this[_0x2901('0x27')][_0x1bcaab][_0x2901('0x47')]){faxMessage[_0x2901('0x4b')](this[_0x2901('0x27')][_0x1bcaab]['AttachmentId'],_0x178820)[_0x2901('0x3c')](function(_0x19cb2a){ut[_0x2901('0x48')]('[Fax][Message][Updated]',_0x19cb2a);})[_0x2901('0x3f')](function(_0x50f000){ut['logger'](_0x2901('0x4c'),_0x50f000);})[_0x2901('0x4d')](function(){delete _0x12956d['channels'][_0x1bcaab];delete _0x12956d[_0x2901('0x27')][_0x1bcaab];});}else{ut[_0x2901('0x48')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x1bcaab];delete this[_0x2901('0x27')][_0x1bcaab];}};Fax[_0x2901('0x1c')][_0x2901('0x19')]=function(_0x343aae){var _0x4597df=this;if(this[_0x2901('0xc')][_0x343aae[_0x2901('0x22')]]){if(this[_0x2901('0x27')][_0x343aae[_0x2901('0x22')]]){this[_0x2901('0xc')][_0x343aae[_0x2901('0x22')]]['id']=this[_0x2901('0x27')][_0x343aae[_0x2901('0x22')]]['id'];this[_0x2901('0xc')][_0x343aae['uniqueid']][_0x2901('0x24')]=this[_0x2901('0x27')][_0x343aae[_0x2901('0x22')]]['name'];}logger['info'](_0x343aae[_0x2901('0x22')],this['actions'][_0x343aae[_0x2901('0x22')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x2901('0x42')](this['channels'][_0x343aae[_0x2901('0x22')]]));if(this['actions'][_0x343aae['uniqueid']]){if(this[_0x2901('0xc')][_0x343aae[_0x2901('0x22')]][_0x2901('0x4e')]>0x0&&this[_0x2901('0xc')][_0x343aae[_0x2901('0x22')]]['faxstatus']===_0x2901('0x4f')){this[_0x2901('0x4a')](_0x343aae[_0x2901('0x22')],!![]);}else{this[_0x2901('0x4a')](_0x343aae[_0x2901('0x22')],![],this[_0x2901('0xc')][_0x343aae['uniqueid']][_0x2901('0x50')]?_0x2901('0x51')+this[_0x2901('0xc')][_0x343aae[_0x2901('0x22')]][_0x2901('0x50')]:'SENDING\x20FAILED');}}}};Fax[_0x2901('0x1c')][_0x2901('0x52')]=function(_0x43ed36){var _0xb61888=this;return new BPromise(function(_0x57bafa,_0x3489c3){_0xb61888[_0x2901('0x53')](_0x43ed36,_0xb61888[_0x2901('0xd')][_0x43ed36['FaxAccountId']])['then'](function(_0x573094){ut[_0x2901('0x48')](_0x2901('0x54'),_0x573094);_0x57bafa(ut[_0x2901('0x38')](_0x2901('0x55')));})[_0x2901('0x3f')](function(_0x7cf0c6){ut[_0x2901('0x48')](_0x2901('0x56'),_0x7cf0c6);updateStatus(_0x43ed36);_0x3489c3(ut['message'](_0x2901('0x57')));});});};Fax[_0x2901('0x1c')][_0x2901('0x58')]=function(_0x44ee4e){var _0x579351=this;return new BPromise(function(_0x2e9a58,_0x28aa3f){var _0x4502fa=_0x579351[_0x2901('0x59')](_0x579351[_0x2901('0xd')][_0x44ee4e['FaxAccountId']][_0x2901('0x5a')],_0x44ee4e);if(_0x4502fa[_0x2901('0x5b')]){_0x2e9a58(ut[_0x2901('0x38')]('Trunk\x20Reachable'));}else{_0x28aa3f(ut[_0x2901('0x38')](_0x4502fa[_0x2901('0x38')]));}});};function originate(_0x2d76d1,_0x17a031,_0x2452fa){return new BPromise(function(_0x588c5a,_0xea8337){if(_0x2452fa){var _0x394dcb=util[_0x2901('0x5c')](_0x2901('0x5d'),path['parse'](_0x2d76d1[_0x2901('0x4')])[_0x2901('0x24')],_0x2d76d1[_0x2901('0x4')]);gs[_0x2901('0x5e')](_0x394dcb)[_0x2901('0x3c')](function(){_0x2d76d1[_0x2901('0x4')]=util[_0x2901('0x5c')](_0x2901('0x5f'),path['parse'](_0x2d76d1[_0x2901('0x4')])['dir'],path['parse'](_0x2d76d1[_0x2901('0x4')])[_0x2901('0x24')]);_0x17a031[_0x2901('0x60')]=_0x2d76d1[_0x2901('0x4')];ut['logger'](_0x2901('0x61'),'');ami[_0x2901('0x62')](ut[_0x2901('0x63')](_0x2d76d1,_0x17a031))[_0x2901('0x3c')](function(_0x2de2b0){_0x588c5a(_0x2de2b0);})['catch'](function(_0x5aee91){_0xea8337(_0x5aee91);});})[_0x2901('0x3f')](function(_0x3bb530){_0xea8337(_0x3bb530);});}else{ami[_0x2901('0x62')](ut[_0x2901('0x63')](_0x2d76d1,_0x17a031))[_0x2901('0x3c')](function(_0x3e31b9){_0x588c5a(_0x3e31b9);})[_0x2901('0x3f')](function(_0x7649cf){_0xea8337(_0x7649cf);});}});}Fax[_0x2901('0x1c')][_0x2901('0x53')]=function(_0x257988,_0x3edf0a){var _0x429821=this;return new BPromise(function(_0x48ac1e,_0xa08a37){var _0x3f33b5=uuid['v4']();var _0x4a89c3=ut['addVariables'](_0x257988,_0x3edf0a);_0x429821[_0x2901('0x27')][_0x3f33b5]=new Action(_0x3f33b5,_0x3edf0a,_0x257988);var _0x25b732=_0x429821[_0x2901('0x27')][_0x3f33b5];if(path[_0x2901('0x3a')](_0x257988[_0x2901('0x4')])[_0x2901('0x64')]===_0x2901('0x3e')){originate(_0x25b732,_0x4a89c3,!![])[_0x2901('0x3c')](function(_0x3ecd0b){_0x48ac1e(_0x3ecd0b);})['catch'](function(_0x958a1b){_0xa08a37(_0x958a1b);});}else{originate(_0x25b732,_0x4a89c3,![])[_0x2901('0x3c')](function(_0x4f8678){_0x48ac1e(_0x4f8678);})[_0x2901('0x3f')](function(_0x2cdbee){_0xa08a37(_0x2cdbee);});}});};Fax['prototype']['isTrunkReachable']=function(_0x21d0c6){return!_[_0x2901('0x65')](_0x21d0c6)&&!_[_0x2901('0x65')](_0x21d0c6['name'])&&!_[_0x2901('0x65')](_0x21d0c6[_0x2901('0x66')])&&_0x21d0c6['active']&&!_['isNil'](this[_0x2901('0xe')][util[_0x2901('0x5c')](_0x2901('0x67'),_0x21d0c6[_0x2901('0x24')])])&&!_['isNil'](this[_0x2901('0xe')][util[_0x2901('0x5c')](_0x2901('0x67'),_0x21d0c6[_0x2901('0x24')])][_0x2901('0x2d')])&&(this[_0x2901('0xe')][util[_0x2901('0x5c')](_0x2901('0x67'),_0x21d0c6[_0x2901('0x24')])][_0x2901('0x2d')]===_0x2901('0x68')||this[_0x2901('0xe')][util[_0x2901('0x5c')]('SIP/%s',_0x21d0c6[_0x2901('0x24')])][_0x2901('0x2d')]===_0x2901('0x69'));};Fax[_0x2901('0x1c')][_0x2901('0x59')]=function(_0x4a1dce,_0x40faa4){if(!this['isTrunkReachable'](_0x4a1dce)){ut[_0x2901('0x48')](_0x2901('0x6a'),_[_0x2901('0x65')](_0x4a1dce)?'':_0x4a1dce['name']+_0x2901('0x6b'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x2901('0x65')](_0x40faa4[_0x2901('0x7')])){ut[_0x2901('0x48')](_0x2901('0x6c'),JSON[_0x2901('0x42')](_0x40faa4));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x2901('0x65')](_0x40faa4['path'])){ut[_0x2901('0x48')](_0x2901('0x6d'),JSON[_0x2901('0x42')](_0x40faa4));return{'isValid':![],'message':_0x2901('0x6e')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x2901('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d7ca259..6742bb1 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 _0x1567=['inspect','notify','resolve','then','catch','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x51730d,_0xdab6e1){var _0x10ca0d=function(_0xbf64cf){while(--_0xbf64cf){_0x51730d['push'](_0x51730d['shift']());}};_0x10ca0d(++_0xdab6e1);}(_0x1567,0x171));var _0x7156=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1567[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require('util');var BPromise=require(_0x7156('0x0'));var logger=require(_0x7156('0x1'))(_0x7156('0x2'));var _=require(_0x7156('0x3'));var faxAccount=require(_0x7156('0x4'));function loggerCatch(_0x83aaf6){return function(_0x4bd815){logger['error'](_0x83aaf6,util[_0x7156('0x5')](_0x4bd815,{'showHidden':![],'depth':null}));};}exports[_0x7156('0x6')]=function(_0x16839f,_0x4741f5){return BPromise[_0x7156('0x7')]()[_0x7156('0x8')](faxAccount[_0x7156('0x6')](_0x16839f,_0x4741f5))[_0x7156('0x9')](loggerCatch(_0x7156('0xa')));}; \ No newline at end of file +var _0x9435=['lodash','../rpc/faxAccount','inspect','notify','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x9435,0x130));var _0x5943=function(_0x40ad1b,_0x375280){_0x40ad1b=_0x40ad1b-0x0;var _0x2997c0=_0x9435[_0x40ad1b];return _0x2997c0;};'use strict';var util=require(_0x5943('0x0'));var BPromise=require(_0x5943('0x1'));var logger=require(_0x5943('0x2'))(_0x5943('0x3'));var _=require(_0x5943('0x4'));var faxAccount=require(_0x5943('0x5'));function loggerCatch(_0x22b2fb){return function(_0x35d858){logger['error'](_0x22b2fb,util[_0x5943('0x6')](_0x35d858,{'showHidden':![],'depth':null}));};}exports[_0x5943('0x7')]=function(_0x591bd3,_0x40e1a0){return BPromise[_0x5943('0x8')]()['then'](faxAccount['notify'](_0x591bd3,_0x40e1a0))[_0x5943('0x9')](loggerCatch(_0x5943('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index e90fcb9..5682892 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 _0x251f=['fax','bluebird','child_process','exec','info','Exec\x20gs','inspect'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x251f,0x181));var _0xf251=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x251f[_0x2160a9];return _0xa88cf7;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0xf251('0x0'));var BPromise=require(_0xf251('0x1'));var exec=require(_0xf251('0x2'))[_0xf251('0x3')];exports['execute']=function(_0x50eaae){return new BPromise(function(_0x1f31ee,_0xf21655){exec(_0x50eaae,function(_0x2e334d,_0x408613,_0x389fa8){logger[_0xf251('0x4')](_0xf251('0x5'),_0x408613);if(_0x2e334d){logger[_0xf251('0x4')](_0xf251('0x5'),'\x20Error\x20:',util[_0xf251('0x6')](_0x2e334d,{'showHidden':![],'depth':null}),_0x408613,_0x389fa8);_0xf21655(_0x2e334d);}_0x1f31ee(_0x408613);});});}; \ No newline at end of file +var _0x46c6=['Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird','execute','info'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0x46c6,0x17a));var _0x646c=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x46c6[_0x36884e];return _0x1cc367;};'use strict';var util=require(_0x646c('0x0'));var logger=require(_0x646c('0x1'))(_0x646c('0x2'));var BPromise=require(_0x646c('0x3'));var exec=require('child_process')['exec'];exports[_0x646c('0x4')]=function(_0x1c8178){return new BPromise(function(_0xcefe93,_0x2c03fc){exec(_0x1c8178,function(_0x14cd28,_0x1e595a,_0x3e1fa0){logger[_0x646c('0x5')](_0x646c('0x6'),_0x1e595a);if(_0x14cd28){logger[_0x646c('0x5')](_0x646c('0x6'),_0x646c('0x7'),util['inspect'](_0x14cd28,{'showHidden':![],'depth':null}),_0x1e595a,_0x3e1fa0);_0x2c03fc(_0x14cd28);}_0xcefe93(_0x1e595a);});});}; \ 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 473007d..9d6fa38 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 _0xc9ef=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','t38timeout','path','variablesAction','uniqueid','originate'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0xc9ef,0xa4));var _0xfc9e=function(_0x401936,_0x4acf75){_0x401936=_0x401936-0x0;var _0x350b85=_0xc9ef[_0x401936];return _0x350b85;};'use strict';var util=require(_0xfc9e('0x0'));var _=require(_0xfc9e('0x1'));var moment=require(_0xfc9e('0x2'));var logger=require(_0xfc9e('0x3'))(_0xfc9e('0x4'));exports['message']=function(_0x226470){return{'message':_0x226470};};exports[_0xfc9e('0x5')]=function(_0x277cc4,_0x1a8a4b){logger[_0xfc9e('0x6')](_0x277cc4,util[_0xfc9e('0x7')](_0x1a8a4b,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x21880f,_0x5eab65){var _0xe0967c={'XMF-ECM':_0x5eab65[_0xfc9e('0x8')],'XMF-HEADERINFO':_0x5eab65[_0xfc9e('0x9')],'XMF-MINRATE':_0x5eab65[_0xfc9e('0xa')],'XMF-MAXRATE':_0x5eab65[_0xfc9e('0xb')],'XMF-MODEM':util[_0xfc9e('0xc')](_0xfc9e('0xd'),_0x5eab65[_0xfc9e('0xe')]),'XMF-GATEWAY':_0x5eab65['gateway'],'XMF-FAXDETECT':_0x5eab65['faxdetect'],'XMF-T38TIMEOUT':_0x5eab65[_0xfc9e('0xf')],'XMF-LOCALSTATIONID':_0x5eab65['localstationid'],'XMF-PATH':_0x21880f[_0xfc9e('0x10')]};return _0xe0967c;};exports[_0xfc9e('0x11')]=function(_0x53d31c,_0xdd46){return{'actionid':_0x53d31c[_0xfc9e('0x12')],'action':_0xfc9e('0x13'),'channel':_0x53d31c['channel'],'Exten':_0xfc9e('0x14'),'Context':_0xfc9e('0x15'),'Priority':'1','callerid':util[_0xfc9e('0xc')](_0xfc9e('0x16'),_0x53d31c['headerinfo']?_0x53d31c[_0xfc9e('0x9')]:'',_0x53d31c['localstationid']),'variable':_0xdd46,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x53d31c[_0xfc9e('0x12')]};}; \ No newline at end of file +var _0x9e15=['util','lodash','moment','../../../../config/logger','fax','message','info','inspect','addVariables','ecm','maxrate','format','\x22%s\x22','gateway','faxdetect','path','variablesAction','originate','xcally-motion-fax','from-sip','headerinfo','uniqueid'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x9e15,0xc6));var _0x59e1=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x9e15[_0x82129b];return _0x2ae5dc;};'use strict';var util=require(_0x59e1('0x0'));var _=require(_0x59e1('0x1'));var moment=require(_0x59e1('0x2'));var logger=require(_0x59e1('0x3'))(_0x59e1('0x4'));exports[_0x59e1('0x5')]=function(_0x25108b){return{'message':_0x25108b};};exports['logger']=function(_0x46bed5,_0x44b845){logger[_0x59e1('0x6')](_0x46bed5,util[_0x59e1('0x7')](_0x44b845,{'showHidden':![],'depth':null}));};exports[_0x59e1('0x8')]=function(_0x3f39ae,_0x1899c1){var _0x34a346={'XMF-ECM':_0x1899c1[_0x59e1('0x9')],'XMF-HEADERINFO':_0x1899c1['headerinfo'],'XMF-MINRATE':_0x1899c1['minrate'],'XMF-MAXRATE':_0x1899c1[_0x59e1('0xa')],'XMF-MODEM':util[_0x59e1('0xb')](_0x59e1('0xc'),_0x1899c1['modem']),'XMF-GATEWAY':_0x1899c1[_0x59e1('0xd')],'XMF-FAXDETECT':_0x1899c1[_0x59e1('0xe')],'XMF-T38TIMEOUT':_0x1899c1['t38timeout'],'XMF-LOCALSTATIONID':_0x1899c1['localstationid'],'XMF-PATH':_0x3f39ae[_0x59e1('0xf')]};return _0x34a346;};exports[_0x59e1('0x10')]=function(_0x472a19,_0x2350b2){return{'actionid':_0x472a19['uniqueid'],'action':_0x59e1('0x11'),'channel':_0x472a19['channel'],'Exten':_0x59e1('0x12'),'Context':_0x59e1('0x13'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x472a19[_0x59e1('0x14')]?_0x472a19[_0x59e1('0x14')]:'',_0x472a19['localstationid']),'variable':_0x2350b2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x472a19[_0x59e1('0x15')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index e06128a..caae541 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 _0xc0b7=['then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','error','inspect','listen','catch','[index.js][main]','util','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve'];(function(_0x2fbd91,_0x46b020){var _0xdf8756=function(_0x1e19a1){while(--_0x1e19a1){_0x2fbd91['push'](_0x2fbd91['shift']());}};_0xdf8756(++_0x46b020);}(_0xc0b7,0x14f));var _0x7c0b=function(_0xc8d438,_0x3768fd){_0xc8d438=_0xc8d438-0x0;var _0x515c8b=_0xc0b7[_0xc8d438];return _0x515c8b;};'use strict';var util=require(_0x7c0b('0x0'));var moment=require(_0x7c0b('0x1'));var server=require(_0x7c0b('0x2'));var Realtime=require('./realtime');var Report=require(_0x7c0b('0x3'));var Acw=require(_0x7c0b('0x4'));var Trigger=require(_0x7c0b('0x5'));var Dialer=require(_0x7c0b('0x6'));var Preview=require(_0x7c0b('0x7'));var Fax=require(_0x7c0b('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0x7c0b('0x9'));var voiceQueueReport=require(_0x7c0b('0xa'));var voiceCallReport=require(_0x7c0b('0xb'));var trunk=require(_0x7c0b('0xc'));var trigger=require(_0x7c0b('0xd'));var template=require(_0x7c0b('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x7c0b('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x7c0b('0x10'));var zendesk=require(_0x7c0b('0x11'));var salesforce=require(_0x7c0b('0x12'));var sugarcrm=require(_0x7c0b('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x7c0b('0x14'));var zoho=require(_0x7c0b('0x15'));var vtiger=require(_0x7c0b('0x16'));var freshsales=require(_0x7c0b('0x17'));var servicenow=require(_0x7c0b('0x18'));var dynamics365=require(_0x7c0b('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x7c0b('0x1a'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7c0b('0x1b')](_0x7c0b('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x7c0b('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x7c0b('0x1d')]()[_0x7c0b('0x1e')](user[_0x7c0b('0x1f')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x20')]())['then'](user[_0x7c0b('0x21')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x22')]())[_0x7c0b('0x1e')](trunk[_0x7c0b('0x23')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x24')]())[_0x7c0b('0x1e')](voiceQueue['getVoiceQueues']())[_0x7c0b('0x1e')](realtime['initVoiceQueues']())[_0x7c0b('0x1e')](trigger[_0x7c0b('0x25')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x26')]())[_0x7c0b('0x1e')](template[_0x7c0b('0x27')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x28')]())[_0x7c0b('0x1e')](zendesk[_0x7c0b('0x29')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x2a')]())[_0x7c0b('0x1e')](salesforce['getSalesforceAccounts']())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x2b')]())[_0x7c0b('0x1e')](sugarcrm[_0x7c0b('0x2c')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x2d')]())[_0x7c0b('0x1e')](freshdesk['getFreshdeskAccounts']())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x2e')]())[_0x7c0b('0x1e')](desk[_0x7c0b('0x2f')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x30')]())[_0x7c0b('0x1e')](zoho[_0x7c0b('0x31')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x32')]())[_0x7c0b('0x1e')](vtiger[_0x7c0b('0x33')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x34')]())[_0x7c0b('0x1e')](freshsales[_0x7c0b('0x35')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x36')]())[_0x7c0b('0x1e')](servicenow['getServicenowAccounts']())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x37')]())[_0x7c0b('0x1e')](dynamics365[_0x7c0b('0x38')]())['then'](realtime[_0x7c0b('0x39')]())['then'](campaign[_0x7c0b('0x3a')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x3b')]())[_0x7c0b('0x1e')](voiceExtension[_0x7c0b('0x3c')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x3d')]())[_0x7c0b('0x1e')](faxAccount[_0x7c0b('0x3e')]())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x3f')]())[_0x7c0b('0x1e')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0x7c0b('0x40')]())[_0x7c0b('0x1e')](realtime['initVoiceQueueReports']())[_0x7c0b('0x1e')](cmHopperHistory[_0x7c0b('0x41')]())[_0x7c0b('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0x7c0b('0x1e')](cmHopperHistory['getCampaignHopperHistory']())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x42')]())[_0x7c0b('0x1e')](voiceCallReport['getVoiceCallReports']())[_0x7c0b('0x1e')](realtime[_0x7c0b('0x43')]())['catch'](function(_0x269bf9){logger[_0x7c0b('0x44')]('[index.js][initParams]',util[_0x7c0b('0x45')](_0x269bf9,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7c0b('0x46')](realtime,preview,fax)['then'](function(){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x7c0b('0x47')](function(_0x59661e){logger[_0x7c0b('0x44')](_0x7c0b('0x48'),util[_0x7c0b('0x45')](_0x59661e,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xc7c3=['./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','getVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','listen','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce'];(function(_0x51191b,_0x2d2a78){var _0x260047=function(_0x4c39e9){while(--_0x4c39e9){_0x51191b['push'](_0x51191b['shift']());}};_0x260047(++_0x2d2a78);}(_0xc7c3,0x178));var _0x3c7c=function(_0x5b35a5,_0x393761){_0x5b35a5=_0x5b35a5-0x0;var _0x468b1e=_0xc7c3[_0x5b35a5];return _0x468b1e;};'use strict';var util=require(_0x3c7c('0x0'));var moment=require(_0x3c7c('0x1'));var server=require(_0x3c7c('0x2'));var Realtime=require(_0x3c7c('0x3'));var Report=require(_0x3c7c('0x4'));var Acw=require(_0x3c7c('0x5'));var Trigger=require('./trigger');var Dialer=require(_0x3c7c('0x6'));var Preview=require(_0x3c7c('0x7'));var Fax=require(_0x3c7c('0x8'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x3c7c('0x9'));var voiceCallReport=require(_0x3c7c('0xa'));var trunk=require(_0x3c7c('0xb'));var trigger=require(_0x3c7c('0xc'));var template=require(_0x3c7c('0xd'));var cmHopperHistory=require(_0x3c7c('0xe'));var campaign=require(_0x3c7c('0xf'));var voiceExtension=require(_0x3c7c('0x10'));var faxAccount=require(_0x3c7c('0x11'));var zendesk=require(_0x3c7c('0x12'));var salesforce=require(_0x3c7c('0x13'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x3c7c('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x3c7c('0x15'));var vtiger=require(_0x3c7c('0x16'));var freshsales=require(_0x3c7c('0x17'));var servicenow=require(_0x3c7c('0x18'));var dynamics365=require(_0x3c7c('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x3c7c('0x1a'))(_0x3c7c('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x3c7c('0x1c')](_0x3c7c('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x3c7c('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x3c7c('0x1e')]()[_0x3c7c('0x1f')](user[_0x3c7c('0x20')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x21')]())[_0x3c7c('0x1f')](user['getTelephones']())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x22')]())[_0x3c7c('0x1f')](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0x3c7c('0x1f')](voiceQueue[_0x3c7c('0x23')]())[_0x3c7c('0x1f')](realtime['initVoiceQueues']())[_0x3c7c('0x1f')](trigger[_0x3c7c('0x24')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x25')]())[_0x3c7c('0x1f')](template[_0x3c7c('0x26')]())[_0x3c7c('0x1f')](realtime['initTemplates']())[_0x3c7c('0x1f')](zendesk[_0x3c7c('0x27')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x28')]())['then'](salesforce[_0x3c7c('0x29')]())[_0x3c7c('0x1f')](realtime['initSalesforceAccounts']())[_0x3c7c('0x1f')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0x3c7c('0x2a')]())[_0x3c7c('0x1f')](freshdesk['getFreshdeskAccounts']())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x2b')]())[_0x3c7c('0x1f')](desk['getDeskAccounts']())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x2c')]())['then'](zoho['getZohoAccounts']())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x2d')]())['then'](vtiger[_0x3c7c('0x2e')]())[_0x3c7c('0x1f')](realtime['initVtigerAccounts']())['then'](freshsales[_0x3c7c('0x2f')]())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x3c7c('0x30')]())['then'](realtime[_0x3c7c('0x31')]())['then'](dynamics365['getDynamics365Accounts']())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x32')]())[_0x3c7c('0x1f')](campaign[_0x3c7c('0x33')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x34')]())[_0x3c7c('0x1f')](voiceExtension[_0x3c7c('0x35')]())[_0x3c7c('0x1f')](realtime['initVoiceExtensions']())[_0x3c7c('0x1f')](faxAccount[_0x3c7c('0x36')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x37')]())[_0x3c7c('0x1f')](function(){return realtime;});}function initParams(){return Promise[_0x3c7c('0x1e')]()[_0x3c7c('0x1f')](voiceQueueReport[_0x3c7c('0x38')]())[_0x3c7c('0x1f')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0x3c7c('0x39')]())['then'](cmHopperHistory[_0x3c7c('0x3a')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x3b')]())[_0x3c7c('0x1f')](voiceCallReport[_0x3c7c('0x3c')]())[_0x3c7c('0x1f')](realtime[_0x3c7c('0x3d')]())[_0x3c7c('0x3e')](function(_0xcf3237){logger[_0x3c7c('0x3f')]('[index.js][initParams]',util[_0x3c7c('0x40')](_0xcf3237,{'showHidden':![],'depth':null}));});}function main(){return server[_0x3c7c('0x41')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x3c7c('0x1f')](function(){return initParams();})[_0x3c7c('0x1f')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x4acba3){logger[_0x3c7c('0x3f')]('[index.js][main]',util['inspect'](_0x4acba3,{'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 c4db869..d79d209 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 _0xea89=['prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','talking','statePause','toNumber','format','onhold','emit','user:ami:update','user:presence','lodash','util','moment','ioredis','../../../config/environment','defaults','localhost','redis','name','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0xea89,0x1e2));var _0x9ea8=function(_0x389265,_0x272da7){_0x389265=_0x389265-0x0;var _0x593345=_0xea89[_0x389265];return _0x593345;};'use strict';var _=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var moment=require(_0x9ea8('0x2'));var Redis=require(_0x9ea8('0x3'));var config=require(_0x9ea8('0x4'));config['redis']=_[_0x9ea8('0x5')](config['redis'],{'host':_0x9ea8('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9ea8('0x7')]));function Agent(_0x3ec628){this['id']=_0x3ec628['id']||0x0;this[_0x9ea8('0x8')]=_0x3ec628[_0x9ea8('0x8')]||'';this[_0x9ea8('0x9')]=_0x3ec628[_0x9ea8('0x9')]||'';this[_0x9ea8('0xa')]=_0x3ec628['accountcode']||'';this[_0x9ea8('0xb')]=_0x3ec628[_0x9ea8('0xb')]||'';this['state']=_0x9ea8('0xc');this[_0x9ea8('0xd')]=0x0;this[_0x9ea8('0xe')]='unknown';this[_0x9ea8('0xf')]='';this[_0x9ea8('0x10')]='';this[_0x9ea8('0x11')]='';this[_0x9ea8('0x12')]='';this[_0x9ea8('0x13')]=_0x3ec628[_0x9ea8('0x13')]||![];this[_0x9ea8('0x14')]='unknown';this[_0x9ea8('0x15')]=0x0;this[_0x9ea8('0x16')]='';this[_0x9ea8('0x17')]='';this['onhold']=![];this[_0x9ea8('0x18')]=![];}Agent[_0x9ea8('0x19')][_0x9ea8('0x1a')]=function(_0x1b8bd6){if(!_0x1b8bd6[_0x9ea8('0x1b')]){return;}var _0x19324d=null;var _0x8d81f7=_0x1b8bd6['state'][_0x9ea8('0x1c')]();switch(_0x8d81f7){case _0x9ea8('0x1d'):_0x8d81f7=_0x9ea8('0x1e');break;case'inuse':_0x8d81f7=_0x9ea8('0x1f');break;}if(this['voiceStatus']!==_0x8d81f7||_0x1b8bd6[_0x9ea8('0x20')]){_0x19324d=_[_0x9ea8('0x21')](moment()[_0x9ea8('0x22')]('x'));}var _0x475fcf={'id':this['id'],'name':this[_0x9ea8('0x8')],'email':this[_0x9ea8('0x9')],'accountcode':this[_0x9ea8('0xa')],'fullname':this['fullname'],'state':this[_0x9ea8('0x1b')],'stateTime':this[_0x9ea8('0xd')],'status':this[_0x9ea8('0xe')],'address':this[_0x9ea8('0xf')],'voiceStatus':_0x8d81f7||this[_0x9ea8('0x14')],'voiceStatusTime':_0x19324d||this[_0x9ea8('0x15')],'voiceStatusCallerIdNumber':this[_0x9ea8('0x16')],'voiceStatusQueue':this[_0x9ea8('0x17')],'interface':this[_0x9ea8('0x12')],'onhold':this[_0x9ea8('0x23')]};if(this[_0x9ea8('0x14')]!==_0x8d81f7){this['voiceStatus']=_0x8d81f7;io['to'](util[_0x9ea8('0x22')]('user:%s',_0x475fcf[_0x9ea8('0x8')]))[_0x9ea8('0x24')](_0x9ea8('0x25'),_0x475fcf);io[_0x9ea8('0x24')](_0x9ea8('0x26'),_0x475fcf);}};module['exports']=Agent; \ No newline at end of file +var _0x9de3=['onhold','format','user:%s','user:ami:update','emit','user:presence','lodash','moment','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','email','accountcode','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','inuse','talking','voiceStatus','statePause'];(function(_0x564a65,_0x25cc30){var _0x48e722=function(_0x146511){while(--_0x146511){_0x564a65['push'](_0x564a65['shift']());}};_0x48e722(++_0x25cc30);}(_0x9de3,0xea));var _0x39de=function(_0x509d66,_0x2eb933){_0x509d66=_0x509d66-0x0;var _0x5011c8=_0x9de3[_0x509d66];return _0x5011c8;};'use strict';var _=require(_0x39de('0x0'));var util=require('util');var moment=require(_0x39de('0x1'));var Redis=require(_0x39de('0x2'));var config=require(_0x39de('0x3'));config['redis']=_[_0x39de('0x4')](config['redis'],{'host':_0x39de('0x5'),'port':0x18eb});var io=require(_0x39de('0x6'))(new Redis(config[_0x39de('0x7')]));function Agent(_0x1d59d6){this['id']=_0x1d59d6['id']||0x0;this['name']=_0x1d59d6[_0x39de('0x8')]||'';this[_0x39de('0x9')]=_0x1d59d6[_0x39de('0x9')]||'';this[_0x39de('0xa')]=_0x1d59d6[_0x39de('0xa')]||'';this['fullname']=_0x1d59d6['fullname']||'';this['state']=_0x39de('0xb');this[_0x39de('0xc')]=0x0;this[_0x39de('0xd')]=_0x39de('0xb');this[_0x39de('0xe')]='';this[_0x39de('0xf')]='';this[_0x39de('0x10')]='';this[_0x39de('0x11')]='';this['online']=_0x1d59d6[_0x39de('0x12')]||![];this['voiceStatus']='unknown';this[_0x39de('0x13')]=0x0;this[_0x39de('0x14')]='';this[_0x39de('0x15')]='';this['onhold']=![];this[_0x39de('0x16')]=![];}Agent[_0x39de('0x17')][_0x39de('0x18')]=function(_0x905132){if(!_0x905132[_0x39de('0x19')]){return;}var _0x3ebd39=null;var _0x229ecc=_0x905132[_0x39de('0x19')][_0x39de('0x1a')]();switch(_0x229ecc){case _0x39de('0x1b'):_0x229ecc='idle';break;case _0x39de('0x1c'):_0x229ecc=_0x39de('0x1d');break;}if(this[_0x39de('0x1e')]!==_0x229ecc||_0x905132[_0x39de('0x1f')]){_0x3ebd39=_['toNumber'](moment()['format']('x'));}var _0x2d355b={'id':this['id'],'name':this['name'],'email':this[_0x39de('0x9')],'accountcode':this[_0x39de('0xa')],'fullname':this['fullname'],'state':this[_0x39de('0x19')],'stateTime':this['stateTime'],'status':this[_0x39de('0xd')],'address':this[_0x39de('0xe')],'voiceStatus':_0x229ecc||this['voiceStatus'],'voiceStatusTime':_0x3ebd39||this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x39de('0x14')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x39de('0x20')]};if(this[_0x39de('0x1e')]!==_0x229ecc){this[_0x39de('0x1e')]=_0x229ecc;io['to'](util[_0x39de('0x21')](_0x39de('0x22'),_0x2d355b[_0x39de('0x8')]))['emit'](_0x39de('0x23'),_0x2d355b);io[_0x39de('0x24')](_0x39de('0x25'),_0x2d355b);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 578c66a..50a2605 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 _0xd3db=['type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name'];(function(_0x260f8f,_0x238a09){var _0x224b24=function(_0x2fdde3){while(--_0x2fdde3){_0x260f8f['push'](_0x260f8f['shift']());}};_0x224b24(++_0x238a09);}(_0xd3db,0x1b8));var _0xbd3d=function(_0x5efdbb,_0x539a9c){_0x5efdbb=_0x5efdbb-0x0;var _0xad34c=_0xd3db[_0x5efdbb];return _0xad34c;};'use strict';function Campaign(_0x1ab8e5){this['id']=_0x1ab8e5['id']||0x0;this[_0xbd3d('0x0')]=_0x1ab8e5[_0xbd3d('0x0')]||'';this[_0xbd3d('0x1')]=_0x1ab8e5[_0xbd3d('0x1')]||_0xbd3d('0x2');this[_0xbd3d('0x3')]=0x0;this[_0xbd3d('0x4')]=0x0;this[_0xbd3d('0x5')]=0x0;this[_0xbd3d('0x6')]=0x0;this['message']='';this[_0xbd3d('0x7')]=!![];this[_0xbd3d('0x8')]=_0x1ab8e5[_0xbd3d('0x8')];this['limitCalls']=_0x1ab8e5['limitCalls'];this['dialTimezone']=_0x1ab8e5[_0xbd3d('0x9')]||null;this[_0xbd3d('0xa')]=_0x1ab8e5[_0xbd3d('0xa')]?_0x1ab8e5[_0xbd3d('0xa')]:null;this['dialOriginateCallerIdName']=_0x1ab8e5[_0xbd3d('0xb')];this[_0xbd3d('0xc')]=_0x1ab8e5[_0xbd3d('0xc')];this['dialOriginateTimeout']=_0x1ab8e5[_0xbd3d('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x1ab8e5[_0xbd3d('0xe')];this[_0xbd3d('0xf')]=_0x1ab8e5['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x1ab8e5[_0xbd3d('0x10')];this[_0xbd3d('0x11')]=_0x1ab8e5[_0xbd3d('0x11')];this[_0xbd3d('0x12')]=_0x1ab8e5['dialNoAnswerMaxRetry'];this[_0xbd3d('0x13')]=_0x1ab8e5[_0xbd3d('0x13')];this[_0xbd3d('0x14')]=_0x1ab8e5[_0xbd3d('0x14')];this[_0xbd3d('0x15')]=_0x1ab8e5[_0xbd3d('0x15')]||0x3;this[_0xbd3d('0x16')]=_0x1ab8e5['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x1ab8e5[_0xbd3d('0x17')]||0x3;this[_0xbd3d('0x18')]=_0x1ab8e5[_0xbd3d('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x1ab8e5[_0xbd3d('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x1ab8e5[_0xbd3d('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x1ab8e5['dialMachineMaxRetry']||0x3;this[_0xbd3d('0x1b')]=_0x1ab8e5[_0xbd3d('0x1b')]||0x96;this[_0xbd3d('0x1c')]=_0x1ab8e5[_0xbd3d('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1ab8e5[_0xbd3d('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x1ab8e5[_0xbd3d('0x1e')]||'DESC';this[_0xbd3d('0x1f')]=_0x1ab8e5[_0xbd3d('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x1ab8e5[_0xbd3d('0x20')]||undefined;this['dialCutDigit']=_0x1ab8e5[_0xbd3d('0x21')]||undefined;this[_0xbd3d('0x22')]=_0x1ab8e5[_0xbd3d('0x22')]?_0x1ab8e5['TrunkBackup']:undefined;this[_0xbd3d('0x23')]=_0x1ab8e5[_0xbd3d('0x23')]?_0x1ab8e5[_0xbd3d('0x23')]:undefined;this['Interval']=_0x1ab8e5[_0xbd3d('0x24')]?_0x1ab8e5[_0xbd3d('0x24')]:undefined;this[_0xbd3d('0x25')]=_0x1ab8e5[_0xbd3d('0x25')]?_0x1ab8e5[_0xbd3d('0x25')]:undefined;this[_0xbd3d('0x26')]=_0x1ab8e5[_0xbd3d('0x25')]?_0x1ab8e5[_0xbd3d('0x25')][_0xbd3d('0x0')]:undefined;this[_0xbd3d('0x27')]=_0x1ab8e5[_0xbd3d('0x27')]||![];this[_0xbd3d('0x28')]=_0x1ab8e5[_0xbd3d('0x28')];this['dialAMDGreeting']=_0x1ab8e5[_0xbd3d('0x29')];this[_0xbd3d('0x2a')]=_0x1ab8e5[_0xbd3d('0x2a')];this[_0xbd3d('0x2b')]=_0x1ab8e5[_0xbd3d('0x2b')];this[_0xbd3d('0x2c')]=_0x1ab8e5[_0xbd3d('0x2c')];this[_0xbd3d('0x2d')]=_0x1ab8e5[_0xbd3d('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x1ab8e5[_0xbd3d('0x2e')];this['dialAMDSilenceThreshold']=_0x1ab8e5['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x1ab8e5[_0xbd3d('0x2f')];}module[_0xbd3d('0x30')]=Campaign; \ No newline at end of file +var _0x9ade=['limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9ade,0x8e));var _0xe9ad=function(_0x1a87a8,_0x127bc9){_0x1a87a8=_0x1a87a8-0x0;var _0x51b8b7=_0x9ade[_0x1a87a8];return _0x51b8b7;};'use strict';function Campaign(_0x121db6){this['id']=_0x121db6['id']||0x0;this[_0xe9ad('0x0')]=_0x121db6[_0xe9ad('0x0')]||'';this[_0xe9ad('0x1')]=_0x121db6[_0xe9ad('0x1')]||_0xe9ad('0x2');this[_0xe9ad('0x3')]=0x0;this[_0xe9ad('0x4')]=0x0;this[_0xe9ad('0x5')]=0x0;this[_0xe9ad('0x6')]=0x0;this['message']='';this[_0xe9ad('0x7')]=!![];this['active']=_0x121db6['active'];this[_0xe9ad('0x8')]=_0x121db6[_0xe9ad('0x8')];this[_0xe9ad('0x9')]=_0x121db6[_0xe9ad('0x9')]||null;this[_0xe9ad('0xa')]=_0x121db6[_0xe9ad('0xa')]?_0x121db6[_0xe9ad('0xa')]:null;this[_0xe9ad('0xb')]=_0x121db6[_0xe9ad('0xb')];this[_0xe9ad('0xc')]=_0x121db6[_0xe9ad('0xc')];this['dialOriginateTimeout']=_0x121db6[_0xe9ad('0xd')]||0x1e;this[_0xe9ad('0xe')]=_0x121db6['dialCongestionMaxRetry'];this[_0xe9ad('0xf')]=_0x121db6[_0xe9ad('0xf')];this[_0xe9ad('0x10')]=_0x121db6['dialBusyMaxRetry'];this[_0xe9ad('0x11')]=_0x121db6['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x121db6[_0xe9ad('0x12')];this[_0xe9ad('0x13')]=_0x121db6[_0xe9ad('0x13')];this[_0xe9ad('0x14')]=_0x121db6[_0xe9ad('0x14')];this[_0xe9ad('0x15')]=_0x121db6[_0xe9ad('0x15')]||0x3;this[_0xe9ad('0x16')]=_0x121db6['dialNoSuchNumberRetryFrequency']||0x96;this[_0xe9ad('0x17')]=_0x121db6[_0xe9ad('0x17')]||0x3;this[_0xe9ad('0x18')]=_0x121db6[_0xe9ad('0x18')]||0x96;this[_0xe9ad('0x19')]=_0x121db6[_0xe9ad('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x121db6[_0xe9ad('0x1a')]||0x96;this[_0xe9ad('0x1b')]=_0x121db6[_0xe9ad('0x1b')]||0x3;this[_0xe9ad('0x1c')]=_0x121db6[_0xe9ad('0x1c')]||0x96;this[_0xe9ad('0x1d')]=_0x121db6[_0xe9ad('0x1d')]||0x3;this[_0xe9ad('0x1e')]=_0x121db6[_0xe9ad('0x1e')]||0x96;this[_0xe9ad('0x1f')]=_0x121db6[_0xe9ad('0x1f')]||'DESC';this[_0xe9ad('0x20')]=_0x121db6['dialPrefix']||undefined;this[_0xe9ad('0x21')]=_0x121db6['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xe9ad('0x22')]=_0x121db6['dialCutDigit']||undefined;this[_0xe9ad('0x23')]=_0x121db6[_0xe9ad('0x23')]?_0x121db6[_0xe9ad('0x23')]:undefined;this['Trunk']=_0x121db6['Trunk']?_0x121db6[_0xe9ad('0x24')]:undefined;this[_0xe9ad('0x25')]=_0x121db6['Interval']?_0x121db6[_0xe9ad('0x25')]:undefined;this[_0xe9ad('0x26')]=_0x121db6[_0xe9ad('0x26')]?_0x121db6['SquareProject']:undefined;this[_0xe9ad('0x27')]=_0x121db6[_0xe9ad('0x26')]?_0x121db6[_0xe9ad('0x26')][_0xe9ad('0x0')]:undefined;this[_0xe9ad('0x28')]=_0x121db6['dialAMDActive']||![];this[_0xe9ad('0x29')]=_0x121db6[_0xe9ad('0x29')];this[_0xe9ad('0x2a')]=_0x121db6[_0xe9ad('0x2a')];this[_0xe9ad('0x2b')]=_0x121db6[_0xe9ad('0x2b')];this['dialAMDTotalAnalysisTime']=_0x121db6['dialAMDTotalAnalysisTime'];this[_0xe9ad('0x2c')]=_0x121db6['dialAMDMinWordLength'];this[_0xe9ad('0x2d')]=_0x121db6[_0xe9ad('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x121db6[_0xe9ad('0x2e')];this[_0xe9ad('0x2f')]=_0x121db6[_0xe9ad('0x2f')];this[_0xe9ad('0x30')]=_0x121db6[_0xe9ad('0x30')];}module[_0xe9ad('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 30fd31c..5045f78 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 _0x87e5=['uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinename','accountcode','context'];(function(_0xf392ee,_0x4293c3){var _0x2b18b6=function(_0x4e154f){while(--_0x4e154f){_0xf392ee['push'](_0xf392ee['shift']());}};_0x2b18b6(++_0x4293c3);}(_0x87e5,0xc1));var _0x587e=function(_0x128443,_0x2fe025){_0x128443=_0x128443-0x0;var _0x1a4ce1=_0x87e5[_0x128443];return _0x1a4ce1;};'use strict';function Channel(){this[_0x587e('0x0')]=null;this[_0x587e('0x1')]='';this['destinationchannel']='';this[_0x587e('0x2')]=0x0;this[_0x587e('0x3')]='';this['connectedlinenum']=undefined;this[_0x587e('0x4')]=undefined;this[_0x587e('0x5')]=0x0;this[_0x587e('0x6')]='';this[_0x587e('0x7')]=0x0;this[_0x587e('0x8')]=0x0;this[_0x587e('0x9')]=0x0;this['answered']=![];this[_0x587e('0xa')]=null;this[_0x587e('0xb')]=null;this[_0x587e('0xc')]=![];this[_0x587e('0xd')]=![];this[_0x587e('0xe')]='';this['lastdata']='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this['type']=null;this[_0x587e('0xf')]=null;this[_0x587e('0x10')]=null;this[_0x587e('0x11')]=![];this[_0x587e('0x12')]=null;this[_0x587e('0x13')]=null;this[_0x587e('0x14')]=[];this[_0x587e('0x15')]=undefined;this[_0x587e('0x16')]=undefined;this[_0x587e('0x17')]=undefined;this[_0x587e('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xb01c=['accountcode','context','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xb01c,0xbe));var _0xcb01=function(_0x3144e4,_0x107c42){_0x3144e4=_0x3144e4-0x0;var _0x39b7ff=_0xb01c[_0x3144e4];return _0x39b7ff;};'use strict';function Channel(){this[_0xcb01('0x0')]=null;this['channel']='';this[_0xcb01('0x1')]='';this[_0xcb01('0x2')]=0x0;this[_0xcb01('0x3')]='';this[_0xcb01('0x4')]=undefined;this[_0xcb01('0x5')]=undefined;this[_0xcb01('0x6')]=0x0;this[_0xcb01('0x7')]='';this['uniqueid']=0x0;this[_0xcb01('0x8')]=0x0;this[_0xcb01('0x9')]=0x0;this[_0xcb01('0xa')]=![];this[_0xcb01('0xb')]=null;this[_0xcb01('0xc')]=null;this[_0xcb01('0xd')]=![];this[_0xcb01('0xe')]=![];this['lastapplication']='';this[_0xcb01('0xf')]='';this[_0xcb01('0x10')]=0x0;this[_0xcb01('0x11')]=0x0;this[_0xcb01('0x12')]=0x0;this['type']=null;this[_0xcb01('0x13')]=null;this[_0xcb01('0x14')]=null;this[_0xcb01('0x15')]=![];this['monitorFilename']=null;this[_0xcb01('0x16')]=null;this[_0xcb01('0x17')]=[];this[_0xcb01('0x18')]=undefined;this[_0xcb01('0x19')]=undefined;this[_0xcb01('0x1a')]=undefined;this['mohtime']=0x0;}module[_0xcb01('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 9bb5470..2406fe0 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 _0x48a6=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','token','tokenSecret','type','serverUrl'];(function(_0x3f1504,_0x1a9318){var _0x17177f=function(_0x39f214){while(--_0x39f214){_0x3f1504['push'](_0x3f1504['shift']());}};_0x17177f(++_0x1a9318);}(_0x48a6,0xf2));var _0x648a=function(_0x15106b,_0x4d96f6){_0x15106b=_0x15106b-0x0;var _0x521203=_0x48a6[_0x15106b];return _0x521203;};'use strict';function DeskAccount(_0x2548e5){this['id']=_0x2548e5['id']||0x0;this[_0x648a('0x0')]=_0x2548e5[_0x648a('0x0')]||'';this['username']=_0x2548e5[_0x648a('0x1')]||'';this[_0x648a('0x2')]=_0x2548e5['remoteUri']||'';this[_0x648a('0x3')]=_0x2548e5[_0x648a('0x3')]||'';this[_0x648a('0x4')]=_0x2548e5['password']||'';this[_0x648a('0x5')]=_0x2548e5['consumerKey']||'';this['consumerSecret']=_0x2548e5['consumerSecret']||'';this[_0x648a('0x6')]=_0x2548e5[_0x648a('0x6')]||'';this['tokenSecret']=_0x2548e5[_0x648a('0x7')]||'';this[_0x648a('0x8')]=_0x2548e5[_0x648a('0x8')]||'';this['serverUrl']=_0x2548e5[_0x648a('0x9')]||'';this['Configurations']=_0x2548e5[_0x648a('0xa')]||{};}module[_0x648a('0xb')]=DeskAccount; \ No newline at end of file +var _0x9106=['token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9106,0x1cd));var _0x6910=function(_0x22fefb,_0x105065){_0x22fefb=_0x22fefb-0x0;var _0x49a5e0=_0x9106[_0x22fefb];return _0x49a5e0;};'use strict';function DeskAccount(_0x255aa8){this['id']=_0x255aa8['id']||0x0;this[_0x6910('0x0')]=_0x255aa8[_0x6910('0x0')]||'';this[_0x6910('0x1')]=_0x255aa8[_0x6910('0x1')]||'';this[_0x6910('0x2')]=_0x255aa8[_0x6910('0x2')]||'';this['authType']=_0x255aa8[_0x6910('0x3')]||'';this[_0x6910('0x4')]=_0x255aa8[_0x6910('0x4')]||'';this['consumerKey']=_0x255aa8[_0x6910('0x5')]||'';this['consumerSecret']=_0x255aa8[_0x6910('0x6')]||'';this[_0x6910('0x7')]=_0x255aa8[_0x6910('0x7')]||'';this['tokenSecret']=_0x255aa8[_0x6910('0x8')]||'';this[_0x6910('0x9')]=_0x255aa8[_0x6910('0x9')]||'';this[_0x6910('0xa')]=_0x255aa8[_0x6910('0xa')]||'';this[_0x6910('0xb')]=_0x255aa8[_0x6910('0xb')]||{};}module[_0x6910('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 4bd0113..78c0f8f 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 _0x96ad=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x173acc,_0x3b336c){var _0x292b33=function(_0x3be03c){while(--_0x3be03c){_0x173acc['push'](_0x173acc['shift']());}};_0x292b33(++_0x3b336c);}(_0x96ad,0x10d));var _0xd96a=function(_0x3d00db,_0x3692b3){_0x3d00db=_0x3d00db-0x0;var _0x41f115=_0x96ad[_0x3d00db];return _0x41f115;};'use strict';function Dynamics365Account(_0x3bd2c7){this['id']=_0x3bd2c7['id']||0x0;this[_0xd96a('0x0')]=_0x3bd2c7[_0xd96a('0x0')]||'';this[_0xd96a('0x1')]=_0x3bd2c7[_0xd96a('0x1')]||'';this[_0xd96a('0x2')]=_0x3bd2c7['password']||'';this['remoteUri']=_0x3bd2c7[_0xd96a('0x3')]||'';this[_0xd96a('0x4')]=_0x3bd2c7['tenantId']||'';this[_0xd96a('0x5')]=_0x3bd2c7[_0xd96a('0x5')]||'';this['clientSecret']=_0x3bd2c7[_0xd96a('0x6')]||{};this['serverUrl']=_0x3bd2c7[_0xd96a('0x7')]||'';this[_0xd96a('0x8')]=_0x3bd2c7[_0xd96a('0x8')]||![];this[_0xd96a('0x9')]=_0x3bd2c7[_0xd96a('0x9')]||{};this[_0xd96a('0xa')]=_0x3bd2c7['CloudProvider']||{};}module[_0xd96a('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x3e90=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','password','remoteUri','clientId','clientSecret'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x3e90,0x18b));var _0x03e9=function(_0x5071a8,_0x53ce34){_0x5071a8=_0x5071a8-0x0;var _0x54fc76=_0x3e90[_0x5071a8];return _0x54fc76;};'use strict';function Dynamics365Account(_0x48c1f3){this['id']=_0x48c1f3['id']||0x0;this[_0x03e9('0x0')]=_0x48c1f3['name']||'';this['username']=_0x48c1f3['username']||'';this[_0x03e9('0x1')]=_0x48c1f3[_0x03e9('0x1')]||'';this[_0x03e9('0x2')]=_0x48c1f3[_0x03e9('0x2')]||'';this['tenantId']=_0x48c1f3['tenantId']||'';this['clientId']=_0x48c1f3[_0x03e9('0x3')]||'';this[_0x03e9('0x4')]=_0x48c1f3[_0x03e9('0x4')]||{};this[_0x03e9('0x5')]=_0x48c1f3[_0x03e9('0x5')]||'';this[_0x03e9('0x6')]=_0x48c1f3['modernAuthentication']||![];this[_0x03e9('0x7')]=_0x48c1f3[_0x03e9('0x7')]||{};this['CloudProvider']=_0x48c1f3[_0x03e9('0x8')]||{};}module[_0x03e9('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 04bd66d..4a66914 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 _0x1ec9=['gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0xb20667,_0x3ca210){var _0x12f141=function(_0x10b542){while(--_0x10b542){_0xb20667['push'](_0xb20667['shift']());}};_0x12f141(++_0x3ca210);}(_0x1ec9,0xa1));var _0x91ec=function(_0x178c78,_0x27b1bb){_0x178c78=_0x178c78-0x0;var _0x323aa9=_0x1ec9[_0x178c78];return _0x323aa9;};'use strict';function FaxAccount(_0x36fb3a){this['id']=_0x36fb3a['id']||0x0;this[_0x91ec('0x0')]=_0x36fb3a[_0x91ec('0x0')]||'';this[_0x91ec('0x1')]=_0x36fb3a['description'];this[_0x91ec('0x2')]=_0x36fb3a[_0x91ec('0x2')];this[_0x91ec('0x3')]=_0x36fb3a[_0x91ec('0x3')];this[_0x91ec('0x4')]=_0x36fb3a['localstationid'];this[_0x91ec('0x5')]=_0x36fb3a[_0x91ec('0x5')]||0x960;this[_0x91ec('0x6')]=_0x36fb3a[_0x91ec('0x6')]||0x3840;this[_0x91ec('0x7')]=_0x36fb3a[_0x91ec('0x7')]||_0x91ec('0x8');this[_0x91ec('0x9')]=_0x36fb3a[_0x91ec('0x9')]||'no';this[_0x91ec('0xa')]=_0x36fb3a['faxdetect']||'no';this[_0x91ec('0xb')]=_0x36fb3a[_0x91ec('0xb')]||0x1388;this[_0x91ec('0xc')]=_0x36fb3a[_0x91ec('0xc')]||'SIP';this['Trunk']=_0x36fb3a[_0x91ec('0xd')]?_0x36fb3a[_0x91ec('0xd')]:undefined;this['ListId']=_0x36fb3a[_0x91ec('0xe')];this['key']=_0x36fb3a[_0x91ec('0xf')];}module[_0x91ec('0x10')]=FaxAccount; \ No newline at end of file +var _0x35f8=['name','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','exports'];(function(_0x54db8f,_0x27ff93){var _0x49fa81=function(_0x48cf74){while(--_0x48cf74){_0x54db8f['push'](_0x54db8f['shift']());}};_0x49fa81(++_0x27ff93);}(_0x35f8,0x69));var _0x835f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x35f8[_0x432682];return _0x463d05;};'use strict';function FaxAccount(_0x22370d){this['id']=_0x22370d['id']||0x0;this[_0x835f('0x0')]=_0x22370d[_0x835f('0x0')]||'';this['description']=_0x22370d[_0x835f('0x1')];this[_0x835f('0x2')]=_0x22370d['ecm'];this['headerinfo']=_0x22370d['headerinfo'];this[_0x835f('0x3')]=_0x22370d[_0x835f('0x3')];this[_0x835f('0x4')]=_0x22370d['minrate']||0x960;this[_0x835f('0x5')]=_0x22370d[_0x835f('0x5')]||0x3840;this[_0x835f('0x6')]=_0x22370d[_0x835f('0x6')]||_0x835f('0x7');this[_0x835f('0x8')]=_0x22370d[_0x835f('0x8')]||'no';this[_0x835f('0x9')]=_0x22370d[_0x835f('0x9')]||'no';this[_0x835f('0xa')]=_0x22370d['t38timeout']||0x1388;this[_0x835f('0xb')]=_0x22370d[_0x835f('0xb')]||_0x835f('0xc');this[_0x835f('0xd')]=_0x22370d[_0x835f('0xd')]?_0x22370d[_0x835f('0xd')]:undefined;this['ListId']=_0x22370d['ListId'];this['key']=_0x22370d['key'];}module[_0x835f('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 1face3c..bbdb3d5 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 _0xebae=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x2dd0c7,_0x55c703){var _0x30a7fe=function(_0x1858d3){while(--_0x1858d3){_0x2dd0c7['push'](_0x2dd0c7['shift']());}};_0x30a7fe(++_0x55c703);}(_0xebae,0x182));var _0xeeba=function(_0x54b749,_0x45913f){_0x54b749=_0x54b749-0x0;var _0x5a1b77=_0xebae[_0x54b749];return _0x5a1b77;};'use strict';function FreshdeskAccount(_0x360d86){this['id']=_0x360d86['id']||0x0;this['name']=_0x360d86[_0xeeba('0x0')]||'';this[_0xeeba('0x1')]=_0x360d86['username']||'';this[_0xeeba('0x2')]=_0x360d86[_0xeeba('0x3')]||'';this[_0xeeba('0x4')]=_0x360d86[_0xeeba('0x4')]||'';this['serverUrl']=_0x360d86[_0xeeba('0x5')]||'';this[_0xeeba('0x6')]=_0x360d86[_0xeeba('0x6')]||{};}module[_0xeeba('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x05e2=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x13ccfe,_0x53d873){var _0x34b1b3=function(_0x551527){while(--_0x551527){_0x13ccfe['push'](_0x13ccfe['shift']());}};_0x34b1b3(++_0x53d873);}(_0x05e2,0x169));var _0x205e=function(_0xfed299,_0x21b8d0){_0xfed299=_0xfed299-0x0;var _0x4ef1f2=_0x05e2[_0xfed299];return _0x4ef1f2;};'use strict';function FreshdeskAccount(_0x1ada7a){this['id']=_0x1ada7a['id']||0x0;this['name']=_0x1ada7a[_0x205e('0x0')]||'';this[_0x205e('0x1')]=_0x1ada7a[_0x205e('0x1')]||'';this[_0x205e('0x2')]=_0x1ada7a[_0x205e('0x3')]||'';this['remoteUri']=_0x1ada7a[_0x205e('0x4')]||'';this[_0x205e('0x5')]=_0x1ada7a[_0x205e('0x5')]||'';this[_0x205e('0x6')]=_0x1ada7a[_0x205e('0x6')]||{};}module[_0x205e('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 a91dde6..1ecabed 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 _0x77f7=['name','username','apiKey','token','remoteUri','Configurations','exports'];(function(_0x43ae25,_0x58d524){var _0x53c4bc=function(_0x1e9dda){while(--_0x1e9dda){_0x43ae25['push'](_0x43ae25['shift']());}};_0x53c4bc(++_0x58d524);}(_0x77f7,0xbd));var _0x777f=function(_0x23dd9e,_0x1273eb){_0x23dd9e=_0x23dd9e-0x0;var _0x18d239=_0x77f7[_0x23dd9e];return _0x18d239;};'use strict';function FreshsalesAccount(_0x545be6){this['id']=_0x545be6['id']||0x0;this[_0x777f('0x0')]=_0x545be6[_0x777f('0x0')]||'';this[_0x777f('0x1')]=_0x545be6[_0x777f('0x1')]||'';this[_0x777f('0x2')]=_0x545be6[_0x777f('0x3')]||'';this[_0x777f('0x4')]=_0x545be6[_0x777f('0x4')]||'';this['serverUrl']=_0x545be6['serverUrl']||'';this[_0x777f('0x5')]=_0x545be6[_0x777f('0x5')]||{};}module[_0x777f('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x4351=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x158b4f,_0x1cd927){var _0x175036=function(_0x4ea028){while(--_0x4ea028){_0x158b4f['push'](_0x158b4f['shift']());}};_0x175036(++_0x1cd927);}(_0x4351,0x1b5));var _0x1435=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4351[_0x422905];return _0x33dc6c;};'use strict';function FreshsalesAccount(_0x203408){this['id']=_0x203408['id']||0x0;this[_0x1435('0x0')]=_0x203408[_0x1435('0x0')]||'';this[_0x1435('0x1')]=_0x203408[_0x1435('0x1')]||'';this[_0x1435('0x2')]=_0x203408[_0x1435('0x3')]||'';this[_0x1435('0x4')]=_0x203408[_0x1435('0x4')]||'';this[_0x1435('0x5')]=_0x203408[_0x1435('0x5')]||'';this[_0x1435('0x6')]=_0x203408[_0x1435('0x6')]||{};}module[_0x1435('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 150e043..b7c375e 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 _0x2a35=['priority','holdtime','assigned','motionChannel','voice','routealias','mohtime','variables','type','inbound','uniqueid','queue','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinename','accountcode','context','exten'];(function(_0xf3ae5e,_0x385757){var _0x353c92=function(_0x39670f){while(--_0x39670f){_0xf3ae5e['push'](_0xf3ae5e['shift']());}};_0x353c92(++_0x385757);}(_0x2a35,0x18f));var _0x52a3=function(_0xb3f00b,_0x78e86a){_0xb3f00b=_0xb3f00b-0x0;var _0x488351=_0x2a35[_0xb3f00b];return _0x488351;};'use strict';function QueueReport(){this[_0x52a3('0x0')]=_0x52a3('0x1');this[_0x52a3('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0x52a3('0x3')]='';this['queuecallerjoinAt']=null;this[_0x52a3('0x4')]=null;this[_0x52a3('0x5')]=0x1;this['count']=0x1;this[_0x52a3('0x6')]=![];this[_0x52a3('0x7')]=null;this['queuecallercomplete']=![];this[_0x52a3('0x8')]=null;this['queuecallerexit']=![];this[_0x52a3('0x9')]=null;this[_0x52a3('0xa')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x52a3('0xb')]='';this[_0x52a3('0xc')]='';this[_0x52a3('0xd')]='';this[_0x52a3('0xe')]='';this[_0x52a3('0xf')]='';this[_0x52a3('0x10')]=0x0;this[_0x52a3('0x11')]=![];this['lastAssignedTo']='';this[_0x52a3('0x12')]=_0x52a3('0x13');this[_0x52a3('0x14')]=null;this[_0x52a3('0x15')]=0x0;this[_0x52a3('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xf74d=['type','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','motionChannel','voice','mohtime','variables'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xf74d,0x168));var _0xdf74=function(_0x122fac,_0x4b9447){_0x122fac=_0x122fac-0x0;var _0x462833=_0xf74d[_0x122fac];return _0x462833;};'use strict';function QueueReport(){this[_0xdf74('0x0')]='inbound';this['uniqueid']='';this[_0xdf74('0x1')]='';this[_0xdf74('0x2')]='';this[_0xdf74('0x3')]='';this[_0xdf74('0x4')]=null;this[_0xdf74('0x5')]=null;this[_0xdf74('0x6')]=0x1;this['count']=0x1;this[_0xdf74('0x7')]=![];this[_0xdf74('0x8')]=null;this[_0xdf74('0x9')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0xdf74('0xa')]=null;this[_0xdf74('0xb')]=0x1;this[_0xdf74('0xc')]='';this[_0xdf74('0xd')]='';this['connectedlinename']='';this[_0xdf74('0xe')]='';this[_0xdf74('0xf')]='';this[_0xdf74('0x10')]='';this[_0xdf74('0x11')]='';this[_0xdf74('0x12')]=0x0;this[_0xdf74('0x13')]=![];this['lastAssignedTo']='';this[_0xdf74('0x14')]=_0xdf74('0x15');this['routealias']=null;this[_0xdf74('0x16')]=0x0;this[_0xdf74('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 916c464..1e5568c 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 _0x416b=['securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x416b,0x1c8));var _0xb416=function(_0x34dd23,_0x50ce42){_0x34dd23=_0x34dd23-0x0;var _0x18a648=_0x416b[_0x34dd23];return _0x18a648;};'use strict';function SalesforceAccount(_0x4d81c7){this['id']=_0x4d81c7['id']||0x0;this[_0xb416('0x0')]=_0x4d81c7['name']||'';this['username']=_0x4d81c7[_0xb416('0x1')]||'';this['remoteUri']=_0x4d81c7[_0xb416('0x2')]||'';this[_0xb416('0x3')]=_0x4d81c7[_0xb416('0x3')]||'';this[_0xb416('0x4')]=_0x4d81c7[_0xb416('0x4')]||'';this[_0xb416('0x5')]=_0x4d81c7[_0xb416('0x5')]||'';this[_0xb416('0x6')]=_0x4d81c7[_0xb416('0x6')]||'';this[_0xb416('0x7')]=_0x4d81c7[_0xb416('0x7')]||'integrationTab';this[_0xb416('0x8')]=_0x4d81c7[_0xb416('0x8')]||'';this[_0xb416('0x9')]=_0x4d81c7['Configurations']||{};}module[_0xb416('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x3e94=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x340708,_0x537c03){var _0x25ea19=function(_0x1fa759){while(--_0x1fa759){_0x340708['push'](_0x340708['shift']());}};_0x25ea19(++_0x537c03);}(_0x3e94,0x67));var _0x43e9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3e94[_0x17d9e3];return _0x14192d;};'use strict';function SalesforceAccount(_0x2a8809){this['id']=_0x2a8809['id']||0x0;this[_0x43e9('0x0')]=_0x2a8809['name']||'';this[_0x43e9('0x1')]=_0x2a8809[_0x43e9('0x1')]||'';this[_0x43e9('0x2')]=_0x2a8809['remoteUri']||'';this[_0x43e9('0x3')]=_0x2a8809[_0x43e9('0x3')]||'';this[_0x43e9('0x4')]=_0x2a8809['clientId']||'';this[_0x43e9('0x5')]=_0x2a8809['clientSecret']||'';this[_0x43e9('0x6')]=_0x2a8809['securityToken']||'';this[_0x43e9('0x7')]=_0x2a8809[_0x43e9('0x7')]||_0x43e9('0x8');this['serverUrl']=_0x2a8809[_0x43e9('0x9')]||'';this[_0x43e9('0xa')]=_0x2a8809[_0x43e9('0xa')]||{};}module[_0x43e9('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index bb83a6b..f049888 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 _0x482f=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x482f,0x95));var _0xf482=function(_0x12c0f7,_0x5e0640){_0x12c0f7=_0x12c0f7-0x0;var _0x5733a0=_0x482f[_0x12c0f7];return _0x5733a0;};'use strict';function ServicenowAccount(_0x155bb6){this['id']=_0x155bb6['id']||0x0;this['name']=_0x155bb6[_0xf482('0x0')]||'';this[_0xf482('0x1')]=_0x155bb6[_0xf482('0x1')]||'';this[_0xf482('0x2')]=_0x155bb6['password']||'';this[_0xf482('0x3')]=_0x155bb6[_0xf482('0x3')]||'';this[_0xf482('0x4')]=_0x155bb6[_0xf482('0x4')]||'';this[_0xf482('0x5')]=_0x155bb6['Configurations']||{};}module[_0xf482('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xb59c=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x30fd47,_0x389fe6){var _0x2916a8=function(_0x13a003){while(--_0x13a003){_0x30fd47['push'](_0x30fd47['shift']());}};_0x2916a8(++_0x389fe6);}(_0xb59c,0x1f1));var _0xcb59=function(_0x3a676b,_0x297c77){_0x3a676b=_0x3a676b-0x0;var _0x1aac22=_0xb59c[_0x3a676b];return _0x1aac22;};'use strict';function ServicenowAccount(_0x2f916f){this['id']=_0x2f916f['id']||0x0;this['name']=_0x2f916f[_0xcb59('0x0')]||'';this[_0xcb59('0x1')]=_0x2f916f[_0xcb59('0x1')]||'';this['password']=_0x2f916f[_0xcb59('0x2')]||'';this['remoteUri']=_0x2f916f[_0xcb59('0x3')]||'';this[_0xcb59('0x4')]=_0x2f916f[_0xcb59('0x4')]||'';this[_0xcb59('0x5')]=_0x2f916f['Configurations']||{};}module[_0xcb59('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 510a8d9..52507c2 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 _0xac05=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x3d417f,_0x3709f1){var _0x40f867=function(_0x303131){while(--_0x303131){_0x3d417f['push'](_0x3d417f['shift']());}};_0x40f867(++_0x3709f1);}(_0xac05,0x1c3));var _0x5ac0=function(_0x348fe3,_0x3afd31){_0x348fe3=_0x348fe3-0x0;var _0x21b4ec=_0xac05[_0x348fe3];return _0x21b4ec;};'use strict';function SugarcrmAccount(_0x9be826){this['id']=_0x9be826['id']||0x0;this[_0x5ac0('0x0')]=_0x9be826[_0x5ac0('0x0')]||'';this[_0x5ac0('0x1')]=_0x9be826[_0x5ac0('0x1')]||'';this[_0x5ac0('0x2')]=_0x9be826[_0x5ac0('0x2')]||'';this[_0x5ac0('0x3')]=_0x9be826[_0x5ac0('0x3')]||'';this[_0x5ac0('0x4')]=_0x9be826['serverUrl']||'';this[_0x5ac0('0x5')]=_0x9be826[_0x5ac0('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x06b7=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1c59cf,_0x1ab506){var _0x4ba4ac=function(_0x30d7fa){while(--_0x30d7fa){_0x1c59cf['push'](_0x1c59cf['shift']());}};_0x4ba4ac(++_0x1ab506);}(_0x06b7,0x17d));var _0x706b=function(_0x2acc4a,_0x24b538){_0x2acc4a=_0x2acc4a-0x0;var _0x59f0c7=_0x06b7[_0x2acc4a];return _0x59f0c7;};'use strict';function SugarcrmAccount(_0x140102){this['id']=_0x140102['id']||0x0;this['name']=_0x140102[_0x706b('0x0')]||'';this[_0x706b('0x1')]=_0x140102['username']||'';this[_0x706b('0x2')]=_0x140102['password']||'';this[_0x706b('0x3')]=_0x140102[_0x706b('0x3')]||'';this[_0x706b('0x4')]=_0x140102[_0x706b('0x4')]||'';this[_0x706b('0x5')]=_0x140102[_0x706b('0x5')]||{};}module[_0x706b('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 747a7f3..3cc246d 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 _0xb62e=['status','address','name','accountcode','state','unknown','stateTime'];(function(_0x3be06d,_0x23e756){var _0x41cb5d=function(_0x401c24){while(--_0x401c24){_0x3be06d['push'](_0x3be06d['shift']());}};_0x41cb5d(++_0x23e756);}(_0xb62e,0x1de));var _0xeb62=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb62e[_0x160c73];return _0xd9302;};'use strict';function Telephone(_0x175b5c){this['id']=_0x175b5c['id']||0x0;this[_0xeb62('0x0')]=_0x175b5c[_0xeb62('0x0')]||'';this[_0xeb62('0x1')]=_0x175b5c['accountcode']||'';this[_0xeb62('0x2')]=_0xeb62('0x3');this[_0xeb62('0x4')]=0x0;this[_0xeb62('0x5')]=_0xeb62('0x3');this[_0xeb62('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x9f98=['state','unknown','status','exports','name','accountcode'];(function(_0x10106a,_0x343b68){var _0x5da8b9=function(_0x18801c){while(--_0x18801c){_0x10106a['push'](_0x10106a['shift']());}};_0x5da8b9(++_0x343b68);}(_0x9f98,0xac));var _0x89f9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9f98[_0x3ab51d];return _0x29a04e;};'use strict';function Telephone(_0x4c1204){this['id']=_0x4c1204['id']||0x0;this[_0x89f9('0x0')]=_0x4c1204[_0x89f9('0x0')]||'';this[_0x89f9('0x1')]=_0x4c1204['accountcode']||'';this[_0x89f9('0x2')]=_0x89f9('0x3');this['stateTime']=0x0;this[_0x89f9('0x4')]=_0x89f9('0x3');this['address']='';}module[_0x89f9('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 8d61cb7..2cc37f8 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(_0x239a13,_0x4987a8){var _0x4c28f8=function(_0x50203e){while(--_0x50203e){_0x239a13['push'](_0x239a13['shift']());}};_0x4c28f8(++_0x4987a8);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ec09b,_0x12d654){_0x5ec09b=_0x5ec09b-0x0;var _0x5a8482=_0xb10b[_0x5ec09b];return _0x5a8482;};'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 _0xa9e0=['exports','name'];(function(_0x4297ad,_0x1db93d){var _0x37a5f6=function(_0x4a95c8){while(--_0x4a95c8){_0x4297ad['push'](_0x4297ad['shift']());}};_0x37a5f6(++_0x1db93d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 861bf7c..8278d35 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 _0x5f2f=['AnyConditions','Actions','exports','name','channel','voice','status'];(function(_0x3f3b7d,_0x1c16b9){var _0x22cd3b=function(_0x5a0e24){while(--_0x5a0e24){_0x3f3b7d['push'](_0x3f3b7d['shift']());}};_0x22cd3b(++_0x1c16b9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x16cfeb,_0x3cc891){_0x16cfeb=_0x16cfeb-0x0;var _0xdd837a=_0x5f2f[_0x16cfeb];return _0xdd837a;};'use strict';function Trigger(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||_0xf5f2('0x2');this[_0xf5f2('0x3')]=_0x7c86d8[_0xf5f2('0x3')]||![];this['AllConditions']=_0x7c86d8['AllConditions']||[];this[_0xf5f2('0x4')]=_0x7c86d8[_0xf5f2('0x4')]||[];this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||[];}module[_0xf5f2('0x6')]=Trigger; \ No newline at end of file +var _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 3fa752c..5d98343 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 _0xc6dd=['registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domainport','refresh','stateRegistry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6dd,0x1c6));var _0xdc6d=function(_0x2bafcf,_0x56574c){_0x2bafcf=_0x2bafcf-0x0;var _0x5945a0=_0xc6dd[_0x2bafcf];return _0x5945a0;};'use strict';function Trunk(_0x896ad1){this['id']=_0x896ad1['id']||0x0;this[_0xdc6d('0x0')]=_0x896ad1[_0xdc6d('0x0')]||![];this[_0xdc6d('0x1')]=_0x896ad1['name']||'';this[_0xdc6d('0x2')]=_0xdc6d('0x3');this[_0xdc6d('0x4')]=0x0;this[_0xdc6d('0x5')]=_0xdc6d('0x3');this[_0xdc6d('0x6')]=_0x896ad1[_0xdc6d('0x6')]&&_0x896ad1[_0xdc6d('0x6')][_0xdc6d('0x7')](':')?_0x896ad1[_0xdc6d('0x6')][_0xdc6d('0x8')](':')[0x0]:'';this[_0xdc6d('0x9')]='';this[_0xdc6d('0xa')]='';this['domain']='';this[_0xdc6d('0xb')]='';this[_0xdc6d('0xc')]='';this[_0xdc6d('0xd')]=_0xdc6d('0x3');this[_0xdc6d('0xe')]='';this[_0xdc6d('0xf')]='';this['defaultuser']=_0x896ad1[_0xdc6d('0x10')]||'';}module[_0xdc6d('0x11')]=Trunk; \ No newline at end of file +var _0x9c30=['stateTime','status','registry','indexOf','host','stateRegistry','address','defaultuser','exports','active','name','unknown'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9c30,0xb1));var _0x09c3=function(_0x2bb8e4,_0xe5bc48){_0x2bb8e4=_0x2bb8e4-0x0;var _0x30c048=_0x9c30[_0x2bb8e4];return _0x30c048;};'use strict';function Trunk(_0x111e1f){this['id']=_0x111e1f['id']||0x0;this[_0x09c3('0x0')]=_0x111e1f[_0x09c3('0x0')]||![];this[_0x09c3('0x1')]=_0x111e1f[_0x09c3('0x1')]||'';this['state']=_0x09c3('0x2');this[_0x09c3('0x3')]=0x0;this[_0x09c3('0x4')]='unknown';this[_0x09c3('0x5')]=_0x111e1f[_0x09c3('0x5')]&&_0x111e1f[_0x09c3('0x5')][_0x09c3('0x6')](':')?_0x111e1f['registry']['split'](':')[0x0]:'';this[_0x09c3('0x7')]='';this['port']='';this['domain']='';this['domainport']='';this['refresh']='';this[_0x09c3('0x8')]=_0x09c3('0x2');this['registrationtime']='';this[_0x09c3('0x9')]='';this[_0x09c3('0xa')]=_0x111e1f[_0x09c3('0xa')]||'';}module[_0x09c3('0xb')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index be84b34..0bfe165 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 _0x8e7a=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x1fe9d8,_0x1b8bca){var _0xc894d7=function(_0x1bb97c){while(--_0x1bb97c){_0x1fe9d8['push'](_0x1fe9d8['shift']());}};_0xc894d7(++_0x1b8bca);}(_0x8e7a,0x175));var _0xa8e7=function(_0x1f0265,_0x498b5d){_0x1f0265=_0x1f0265-0x0;var _0x5965af=_0x8e7a[_0x1f0265];return _0x5965af;};'use strict';function voiceExtension(_0x453815){this['id']=_0x453815['id']||0x0;this[_0xa8e7('0x0')]=_0x453815[_0xa8e7('0x0')]||'';this['recordingFormat']=_0x453815[_0xa8e7('0x1')]||_0xa8e7('0x2');this[_0xa8e7('0x3')]=_0x453815[_0xa8e7('0x3')]||![];}module[_0xa8e7('0x4')]=voiceExtension; \ No newline at end of file +var _0x286a=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x157f80,_0x5dc3eb){var _0x19784=function(_0x5b62c0){while(--_0x5b62c0){_0x157f80['push'](_0x157f80['shift']());}};_0x19784(++_0x5dc3eb);}(_0x286a,0x11f));var _0xa286=function(_0x37dc02,_0xa88670){_0x37dc02=_0x37dc02-0x0;var _0x2a8046=_0x286a[_0x37dc02];return _0x2a8046;};'use strict';function voiceExtension(_0x1419ca){this['id']=_0x1419ca['id']||0x0;this[_0xa286('0x0')]=_0x1419ca[_0xa286('0x0')]||'';this['recordingFormat']=_0x1419ca[_0xa286('0x1')]||_0xa286('0x2');this[_0xa286('0x3')]=_0x1419ca[_0xa286('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 6c4b8ae..139c2df 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 _0x58b9=['strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','answered','sumHoldTime','sumBillable','unmanaged','available','busy','inUse','invalid','loggedIn','notInUse','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0xac5d25,_0xabfab3){var _0x5a310b=function(_0x2d5898){while(--_0x2d5898){_0xac5d25['push'](_0xac5d25['shift']());}};_0x5a310b(++_0xabfab3);}(_0x58b9,0xad));var _0x958b=function(_0xe324d0,_0xcba278){_0xe324d0=_0xe324d0-0x0;var _0x8e4c88=_0x58b9[_0xe324d0];return _0x8e4c88;};'use strict';var monitorFormat={'wav':_0x958b('0x0'),'wav49':'wav49','gsm':_0x958b('0x1')};var strategy={'fewestcalls':_0x958b('0x2'),'leastrecent':_0x958b('0x3'),'linear':_0x958b('0x4'),'random':_0x958b('0x5'),'ringall':_0x958b('0x6'),'rr':_0x958b('0x7'),'rrmemory':_0x958b('0x8'),'rrordered':_0x958b('0x9'),'wrandom':_0x958b('0xa')};function VoiceQueue(_0x1d3ffd){this['id']=_0x1d3ffd['id']||0x0;this[_0x958b('0xb')]=_0x1d3ffd[_0x958b('0xb')]||'';this[_0x958b('0xc')]=_0x1d3ffd[_0x958b('0xc')]||'';this[_0x958b('0xd')]=_0x1d3ffd[_0x958b('0xd')]||_0x958b('0xe');this[_0x958b('0xf')]=0x0;this['total']=0x0;this[_0x958b('0x10')]=0x0;this['sumDuration']=0x0;this[_0x958b('0x11')]=0x0;this[_0x958b('0x12')]=0x0;this[_0x958b('0x13')]=0x0;this['abandoned']=0x0;this[_0x958b('0x14')]=0x0;this[_0x958b('0x15')]=0x0;this[_0x958b('0x16')]=0x0;this[_0x958b('0x17')]=0x0;this[_0x958b('0x18')]=0x0;this[_0x958b('0x19')]=0x0;this['onHold']=0x0;this['paused']=0x0;this[_0x958b('0x1a')]=0x0;this[_0x958b('0x1b')]=0x0;this['talking']=0x0;this[_0x958b('0x1c')]=0x0;this[_0x958b('0x1d')]=0x0;this['acw']=_0x1d3ffd[_0x958b('0x1e')]||![];this[_0x958b('0x1f')]=_0x1d3ffd[_0x958b('0x1f')]||0xa;this[_0x958b('0x20')]=_0x1d3ffd['autopause']||'no';this[_0x958b('0x21')]=!![];this[_0x958b('0x22')]='';this['statusMessage']='';this[_0x958b('0x23')]=0x0;this[_0x958b('0x24')]=0x0;this[_0x958b('0x25')]=_0x1d3ffd[_0x958b('0x25')]||null;this['dialGlobalInterval']=_0x1d3ffd[_0x958b('0x26')]?_0x1d3ffd[_0x958b('0x26')]:null;this[_0x958b('0x27')]=_0x1d3ffd[_0x958b('0x27')];this['dialMethod']=_0x1d3ffd[_0x958b('0x28')]||'progressive';this[_0x958b('0x29')]=_0x1d3ffd[_0x958b('0x29')]||0x0;this['dialLimitQueue']=_0x1d3ffd[_0x958b('0x2a')]||0x0;this[_0x958b('0x2b')]=_0x1d3ffd['dialPowerLevel']||0x1;this[_0x958b('0x2c')]=_0x1d3ffd[_0x958b('0x2c')]||_0x958b('0x2d');this['dialPredictiveOptimizationPercentage']=_0x1d3ffd['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x1d3ffd[_0x958b('0x2e')]||0x258;this[_0x958b('0x2f')]=_0x1d3ffd[_0x958b('0x2f')]||_0x958b('0x30');this['dialOriginateCallerIdNumber']=_0x1d3ffd[_0x958b('0x31')]||_0x958b('0x30');this[_0x958b('0x32')]=_0x1d3ffd[_0x958b('0x32')]||0x1e;this[_0x958b('0x33')]=_0x1d3ffd['dialQueueOptions']||'tTxX';this[_0x958b('0x34')]=_0x1d3ffd['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x1d3ffd[_0x958b('0x35')]||undefined;this[_0x958b('0x36')]=_0x1d3ffd[_0x958b('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x1d3ffd['dialCongestionRetryFrequency']||0x96;this[_0x958b('0x37')]=_0x1d3ffd[_0x958b('0x37')]||0x3;this[_0x958b('0x38')]=_0x1d3ffd['dialBusyRetryFrequency']||0x96;this[_0x958b('0x39')]=_0x1d3ffd[_0x958b('0x39')]||0x3;this[_0x958b('0x3a')]=_0x1d3ffd[_0x958b('0x3a')]||0x96;this[_0x958b('0x3b')]=_0x1d3ffd[_0x958b('0x3b')]||0x3;this[_0x958b('0x3c')]=_0x1d3ffd[_0x958b('0x3c')]||0x96;this[_0x958b('0x3d')]=_0x1d3ffd[_0x958b('0x3d')]||0x3;this[_0x958b('0x3e')]=_0x1d3ffd['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x1d3ffd[_0x958b('0x3f')]||0x3;this[_0x958b('0x40')]=_0x1d3ffd[_0x958b('0x40')]||0x96;this[_0x958b('0x41')]=_0x1d3ffd['dialMachineMaxRetry']||0x3;this[_0x958b('0x42')]=_0x1d3ffd['dialMachineRetryFrequency']||0x96;this[_0x958b('0x43')]=_0x1d3ffd[_0x958b('0x43')]||0x3;this[_0x958b('0x44')]=_0x1d3ffd[_0x958b('0x44')]||0x96;this[_0x958b('0x45')]=_0x1d3ffd['callAdditionalPhoneAfterMin']||0x3;this[_0x958b('0x46')]=_0x1d3ffd[_0x958b('0x46')]||0x4;this[_0x958b('0x47')]=_0x1d3ffd['Trunk']?_0x1d3ffd['Trunk']:undefined;this['TrunkBackup']=_0x1d3ffd[_0x958b('0x48')]?_0x1d3ffd[_0x958b('0x48')]:undefined;this[_0x958b('0x49')]=_0x1d3ffd[_0x958b('0x49')]||undefined;this[_0x958b('0x4a')]=_0x1d3ffd[_0x958b('0x4a')]?_0x1d3ffd[_0x958b('0x4a')]:undefined;this[_0x958b('0x4b')]=_0x1d3ffd[_0x958b('0x4b')]||_0x958b('0x4c');this[_0x958b('0x4d')]=_0x1d3ffd[_0x958b('0x4d')]||undefined;this[_0x958b('0x4e')]=_0x1d3ffd[_0x958b('0x4e')]||undefined;this['strategy']=strategy[_0x1d3ffd[_0x958b('0x4f')]];this[_0x958b('0x50')]=!![];this[_0x958b('0x51')]=_0x1d3ffd[_0x958b('0x51')]||![];this[_0x958b('0x52')]=_0x1d3ffd[_0x958b('0x52')];this[_0x958b('0x53')]=_0x1d3ffd[_0x958b('0x53')];this[_0x958b('0x54')]=_0x1d3ffd[_0x958b('0x54')];this[_0x958b('0x55')]=_0x1d3ffd[_0x958b('0x55')];this[_0x958b('0x56')]=_0x1d3ffd[_0x958b('0x56')];this[_0x958b('0x57')]=_0x1d3ffd[_0x958b('0x57')];this['dialAMDMaximumNumberOfWords']=_0x1d3ffd[_0x958b('0x58')];this[_0x958b('0x59')]=_0x1d3ffd[_0x958b('0x59')];this['dialAMDMaximumWordLength']=_0x1d3ffd['dialAMDMaximumWordLength'];this[_0x958b('0x5a')]=0x0;this[_0x958b('0x5b')]=0x0;this['timeout']=_0x1d3ffd[_0x958b('0x5c')];this[_0x958b('0x5d')]=0x0;this[_0x958b('0x5e')]=0x0;this[_0x958b('0x5f')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x958b('0x60')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x958b('0x61')]=0x0;this[_0x958b('0x62')]=0x0;this[_0x958b('0x63')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x958b('0x64')]=0x0;this[_0x958b('0x65')]=0x0;this[_0x958b('0x66')]=undefined;this[_0x958b('0x67')]=undefined;this[_0x958b('0x68')]=undefined;this[_0x958b('0x69')]=1.05;this[_0x958b('0x6a')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x958b('0x6b')]=0x0;this[_0x958b('0x6c')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x958b('0x6d')]=0x0;this['predictiveIntervalMaxThreshold']=_0x1d3ffd['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x1d3ffd[_0x958b('0x6e')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x958b('0x6f')]=0x1;this[_0x958b('0x70')]=0x0;this[_0x958b('0x71')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x958b('0x72')]=0x0;this[_0x958b('0x73')]=_0x1d3ffd[_0x958b('0x73')]||0x1e;this['dialRecallInQueue']=_0x1d3ffd[_0x958b('0x74')]||![];this[_0x958b('0x75')]=!!_0x1d3ffd[_0x958b('0x75')]||![];this[_0x958b('0x76')]=!!_0x1d3ffd[_0x958b('0x76')]||![];this[_0x958b('0x77')]=_0x1d3ffd['dialQueueProject2']||undefined;this[_0x958b('0x78')]=_0x1d3ffd[_0x958b('0x78')]||![];this[_0x958b('0x79')]=_0x1d3ffd[_0x958b('0x79')]||![];this[_0x958b('0xc')]=monitorFormat[_0x1d3ffd[_0x958b('0xc')]]?monitorFormat[_0x1d3ffd['monitor_format']]:undefined;this[_0x958b('0x7a')]=_0x1d3ffd['mandatoryDisposition']||![];this[_0x958b('0x7b')]=_0x1d3ffd[_0x958b('0x7b')]?_0x1d3ffd[_0x958b('0x7b')]:undefined;this[_0x958b('0x7c')]=![];}module[_0x958b('0x7d')]=VoiceQueue; \ No newline at end of file +var _0xc962=['busy','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','acw','acwTimeout','autopause','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','leastrecent','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumHoldTime','sumBillable','unmanaged','abandoned','available'];(function(_0xfd125f,_0x40d8ab){var _0x104251=function(_0x4f0f33){while(--_0x4f0f33){_0xfd125f['push'](_0xfd125f['shift']());}};_0x104251(++_0x40d8ab);}(_0xc962,0x6d));var _0x2c96=function(_0x8377e1,_0x3bd9c5){_0x8377e1=_0x8377e1-0x0;var _0x1b0d61=_0xc962[_0x8377e1];return _0x1b0d61;};'use strict';var monitorFormat={'wav':_0x2c96('0x0'),'wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x2c96('0x1'),'linear':_0x2c96('0x2'),'random':_0x2c96('0x3'),'ringall':_0x2c96('0x4'),'rr':_0x2c96('0x5'),'rrmemory':_0x2c96('0x6'),'rrordered':_0x2c96('0x7'),'wrandom':_0x2c96('0x8')};function VoiceQueue(_0x599a47){this['id']=_0x599a47['id']||0x0;this[_0x2c96('0x9')]=_0x599a47[_0x2c96('0x9')]||'';this[_0x2c96('0xa')]=_0x599a47[_0x2c96('0xa')]||'';this[_0x2c96('0xb')]=_0x599a47[_0x2c96('0xb')]||_0x2c96('0xc');this[_0x2c96('0xd')]=0x0;this[_0x2c96('0xe')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x2c96('0xf')]=0x0;this[_0x2c96('0x10')]=0x0;this[_0x2c96('0x11')]=0x0;this[_0x2c96('0x12')]=0x0;this[_0x2c96('0x13')]=0x0;this[_0x2c96('0x14')]=0x0;this['inUse']=0x0;this['invalid']=0x0;this[_0x2c96('0x15')]=0x0;this[_0x2c96('0x16')]=0x0;this[_0x2c96('0x17')]=0x0;this[_0x2c96('0x18')]=0x0;this[_0x2c96('0x19')]=0x0;this[_0x2c96('0x1a')]=0x0;this[_0x2c96('0x1b')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this['acw']=_0x599a47[_0x2c96('0x1c')]||![];this[_0x2c96('0x1d')]=_0x599a47['acwTimeout']||0xa;this[_0x2c96('0x1e')]=_0x599a47[_0x2c96('0x1e')]||'no';this['sendMessageOneNotActive']=!![];this[_0x2c96('0x1f')]='';this[_0x2c96('0x20')]='';this[_0x2c96('0x21')]=0x0;this[_0x2c96('0x22')]=0x0;this[_0x2c96('0x23')]=_0x599a47[_0x2c96('0x23')]||null;this[_0x2c96('0x24')]=_0x599a47[_0x2c96('0x24')]?_0x599a47[_0x2c96('0x24')]:null;this['dialActive']=_0x599a47['dialActive'];this[_0x2c96('0x25')]=_0x599a47[_0x2c96('0x25')]||_0x2c96('0x26');this['dialLimitChannel']=_0x599a47[_0x2c96('0x27')]||0x0;this[_0x2c96('0x28')]=_0x599a47[_0x2c96('0x28')]||0x0;this['dialPowerLevel']=_0x599a47[_0x2c96('0x29')]||0x1;this[_0x2c96('0x2a')]=_0x599a47['dialPredictiveOptimization']||_0x2c96('0x2b');this[_0x2c96('0x2c')]=_0x599a47[_0x2c96('0x2c')]||0.03;this[_0x2c96('0x2d')]=_0x599a47[_0x2c96('0x2d')]||0x258;this[_0x2c96('0x2e')]=_0x599a47[_0x2c96('0x2e')]||'anonymous';this[_0x2c96('0x2f')]=_0x599a47['dialOriginateCallerIdNumber']||'anonymous';this[_0x2c96('0x30')]=_0x599a47['dialOriginateTimeout']||0x1e;this[_0x2c96('0x31')]=_0x599a47[_0x2c96('0x31')]||_0x2c96('0x32');this[_0x2c96('0x33')]=_0x599a47['dialQueueTimeout']||0x3;this[_0x2c96('0x34')]=_0x599a47[_0x2c96('0x34')]||undefined;this['dialCongestionMaxRetry']=_0x599a47[_0x2c96('0x35')]||0x3;this[_0x2c96('0x36')]=_0x599a47[_0x2c96('0x36')]||0x96;this[_0x2c96('0x37')]=_0x599a47['dialBusyMaxRetry']||0x3;this[_0x2c96('0x38')]=_0x599a47[_0x2c96('0x38')]||0x96;this[_0x2c96('0x39')]=_0x599a47[_0x2c96('0x39')]||0x3;this['dialNoAnswerRetryFrequency']=_0x599a47[_0x2c96('0x3a')]||0x96;this[_0x2c96('0x3b')]=_0x599a47['dialNoSuchNumberMaxRetry']||0x3;this[_0x2c96('0x3c')]=_0x599a47['dialNoSuchNumberRetryFrequency']||0x96;this[_0x2c96('0x3d')]=_0x599a47[_0x2c96('0x3d')]||0x3;this[_0x2c96('0x3e')]=_0x599a47[_0x2c96('0x3e')]||0x96;this[_0x2c96('0x3f')]=_0x599a47[_0x2c96('0x3f')]||0x3;this[_0x2c96('0x40')]=_0x599a47[_0x2c96('0x40')]||0x96;this['dialMachineMaxRetry']=_0x599a47[_0x2c96('0x41')]||0x3;this[_0x2c96('0x42')]=_0x599a47[_0x2c96('0x42')]||0x96;this['dialAgentRejectMaxRetry']=_0x599a47[_0x2c96('0x43')]||0x3;this[_0x2c96('0x44')]=_0x599a47[_0x2c96('0x44')]||0x96;this['callAdditionalPhoneAfterMin']=_0x599a47[_0x2c96('0x45')]||0x3;this[_0x2c96('0x46')]=_0x599a47[_0x2c96('0x46')]||0x4;this[_0x2c96('0x47')]=_0x599a47[_0x2c96('0x47')]?_0x599a47['Trunk']:undefined;this[_0x2c96('0x48')]=_0x599a47[_0x2c96('0x48')]?_0x599a47[_0x2c96('0x48')]:undefined;this[_0x2c96('0x49')]=_0x599a47[_0x2c96('0x49')]||undefined;this[_0x2c96('0x4a')]=_0x599a47[_0x2c96('0x4a')]?_0x599a47[_0x2c96('0x4a')]:undefined;this['dialOrderByScheduledAt']=_0x599a47['dialOrderByScheduledAt']||_0x2c96('0x4b');this[_0x2c96('0x4c')]=_0x599a47[_0x2c96('0x4c')]||undefined;this[_0x2c96('0x4d')]=_0x599a47['dialCutDigit']||undefined;this[_0x2c96('0x4e')]=strategy[_0x599a47['strategy']];this[_0x2c96('0x4f')]=!![];this[_0x2c96('0x50')]=_0x599a47[_0x2c96('0x50')]||![];this[_0x2c96('0x51')]=_0x599a47[_0x2c96('0x51')];this['dialAMDGreeting']=_0x599a47[_0x2c96('0x52')];this['dialAMDAfterGreetingSilence']=_0x599a47[_0x2c96('0x53')];this[_0x2c96('0x54')]=_0x599a47['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x599a47[_0x2c96('0x55')];this[_0x2c96('0x56')]=_0x599a47[_0x2c96('0x56')];this[_0x2c96('0x57')]=_0x599a47[_0x2c96('0x57')];this[_0x2c96('0x58')]=_0x599a47['dialAMDSilenceThreshold'];this[_0x2c96('0x59')]=_0x599a47[_0x2c96('0x59')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x2c96('0x5a')]=_0x599a47[_0x2c96('0x5a')];this[_0x2c96('0x5b')]=0x0;this[_0x2c96('0x5c')]=0x0;this[_0x2c96('0x5d')]=0x0;this[_0x2c96('0x5e')]=0x0;this[_0x2c96('0x5f')]=0x0;this[_0x2c96('0x60')]=0x0;this[_0x2c96('0x61')]=0x0;this[_0x2c96('0x62')]=0x0;this[_0x2c96('0x63')]=0x0;this[_0x2c96('0x64')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x2c96('0x65')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x2c96('0x66')]=undefined;this[_0x2c96('0x67')]=undefined;this[_0x2c96('0x68')]=undefined;this[_0x2c96('0x69')]=1.05;this[_0x2c96('0x6a')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x2c96('0x6b')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x2c96('0x6c')]=0x0;this[_0x2c96('0x6d')]=0x0;this[_0x2c96('0x6e')]=0x0;this[_0x2c96('0x6f')]=_0x599a47[_0x2c96('0x70')]||0x14;this['predictiveIntervalMinThreshold']=_0x599a47[_0x2c96('0x70')]||0xa;this[_0x2c96('0x71')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x2c96('0x72')]=0x1;this['erlangCalls']=0x0;this[_0x2c96('0x73')]=0x0;this[_0x2c96('0x74')]=0x0;this[_0x2c96('0x75')]=0x0;this[_0x2c96('0x76')]=_0x599a47[_0x2c96('0x76')]||0x1e;this[_0x2c96('0x77')]=_0x599a47[_0x2c96('0x77')]||![];this[_0x2c96('0x78')]=!!_0x599a47['dialPreviewAutoRecallMe']||![];this[_0x2c96('0x79')]=!!_0x599a47[_0x2c96('0x79')]||![];this[_0x2c96('0x7a')]=_0x599a47[_0x2c96('0x7a')]||undefined;this['dialAgiAfterHangupClient']=_0x599a47[_0x2c96('0x7b')]||![];this[_0x2c96('0x7c')]=_0x599a47[_0x2c96('0x7c')]||![];this[_0x2c96('0xa')]=monitorFormat[_0x599a47[_0x2c96('0xa')]]?monitorFormat[_0x599a47['monitor_format']]:undefined;this[_0x2c96('0x7d')]=_0x599a47[_0x2c96('0x7d')]||![];this['mandatoryDispositionPause']=_0x599a47[_0x2c96('0x7e')]?_0x599a47['mandatoryDispositionPause']:undefined;this[_0x2c96('0x7f')]=![];}module[_0x2c96('0x80')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 21f3ddc..b1ce87b 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 _0x4fde=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','onHold','loggedin','callers','length','SIP/','online','incall','includes','status','keys','queue','type','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','exports','available','loggedIn','loggedInDb','paused','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','busy','invalid','notInUse','ringing','ringInUse','sumBillable','sumHoldTime','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName'];(function(_0x32c19f,_0x441579){var _0x4e1575=function(_0x1c50bb){while(--_0x1c50bb){_0x32c19f['push'](_0x32c19f['shift']());}};_0x4e1575(++_0x441579);}(_0x4fde,0x19f));var _0xe4fd=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0x4fde[_0x4f3c9b];return _0x84e58a;};'use strict';var INBOUND_COUNTERS=[_0xe4fd('0x0'),_0xe4fd('0x1'),_0xe4fd('0x2'),_0xe4fd('0x3'),'ringing',_0xe4fd('0x4'),_0xe4fd('0x5')];var OUTBOUND_COUNTERS=['available',_0xe4fd('0x6'),_0xe4fd('0x7'),_0xe4fd('0x1'),_0xe4fd('0x2'),_0xe4fd('0x8'),_0xe4fd('0x9'),_0xe4fd('0xa'),_0xe4fd('0xb'),_0xe4fd('0xc'),'outboundCongestionCallsDay',_0xe4fd('0xd'),'outboundNoSuchCallsDay',_0xe4fd('0xe'),'outboundRejectCallsDay','outboundUnknownCallsDay',_0xe4fd('0x3'),_0xe4fd('0xf'),'talking','sumBillable',_0xe4fd('0x10'),_0xe4fd('0x11'),_0xe4fd('0x5')];function VoiceQueueSummary(_0x5c4dc7){this['id']=_0x5c4dc7['id'];this[_0xe4fd('0x12')]=_0x5c4dc7[_0xe4fd('0x12')];this[_0xe4fd('0x13')]=_0x5c4dc7[_0xe4fd('0x13')];this[_0xe4fd('0x14')]=_0x5c4dc7[_0xe4fd('0x14')]||0x0;this['answered']=_0x5c4dc7[_0xe4fd('0x6')]||0x0;this[_0xe4fd('0x0')]=_0x5c4dc7[_0xe4fd('0x0')]||0x0;this['busy']=_0x5c4dc7[_0xe4fd('0x15')]||0x0;this[_0xe4fd('0x7')]=_0x5c4dc7['inUse']||0x0;this['invalid']=_0x5c4dc7[_0xe4fd('0x16')]||0x0;this[_0xe4fd('0x1')]=_0x5c4dc7[_0xe4fd('0x1')]||0x0;this['loggedInDb']=_0x5c4dc7[_0xe4fd('0x2')]||0x0;this['onHold']=_0x5c4dc7['onHold']||0x0;this[_0xe4fd('0x17')]=_0x5c4dc7[_0xe4fd('0x17')]||0x0;this[_0xe4fd('0x3')]=_0x5c4dc7[_0xe4fd('0x3')]||0x0;this[_0xe4fd('0x18')]=_0x5c4dc7['ringing']||0x0;this[_0xe4fd('0x19')]=_0x5c4dc7[_0xe4fd('0x19')];this[_0xe4fd('0x1a')]=_0x5c4dc7[_0xe4fd('0x1a')];this[_0xe4fd('0x10')]=_0x5c4dc7[_0xe4fd('0x10')];this[_0xe4fd('0x1b')]=_0x5c4dc7[_0xe4fd('0x1b')]||0x0;this[_0xe4fd('0x4')]=_0x5c4dc7['talking']||0x0;this[_0xe4fd('0x11')]=_0x5c4dc7[_0xe4fd('0x11')]||0x0;this['type']=_0x5c4dc7['type'];this['unavailable']=_0x5c4dc7[_0xe4fd('0x1c')]||0x0;this['unknown']=_0x5c4dc7[_0xe4fd('0x1d')]||0x0;this['unmanaged']=_0x5c4dc7[_0xe4fd('0x1e')]||0x0;this[_0xe4fd('0x5')]=_0x5c4dc7[_0xe4fd('0x5')]||0x0;if(_0x5c4dc7['type']===_0xe4fd('0x1f')){this[_0xe4fd('0xf')]=_0x5c4dc7[_0xe4fd('0xf')]||0x0;this[_0xe4fd('0x20')]=_0x5c4dc7[_0xe4fd('0x20')];this['dialMethod']=_0x5c4dc7[_0xe4fd('0x21')];this[_0xe4fd('0x22')]=_0x5c4dc7[_0xe4fd('0x22')];this[_0xe4fd('0x23')]=_0x5c4dc7[_0xe4fd('0x23')];this[_0xe4fd('0x24')]=_0x5c4dc7[_0xe4fd('0x24')];this[_0xe4fd('0x25')]=_0x5c4dc7[_0xe4fd('0x25')];this[_0xe4fd('0x26')]=_0x5c4dc7[_0xe4fd('0x26')];this[_0xe4fd('0x27')]=_0x5c4dc7[_0xe4fd('0x27')];this[_0xe4fd('0xa')]=_0x5c4dc7[_0xe4fd('0xa')];this[_0xe4fd('0xb')]=_0x5c4dc7[_0xe4fd('0xb')];this['outboundBusyCallsDay']=_0x5c4dc7[_0xe4fd('0xc')];this[_0xe4fd('0x28')]=_0x5c4dc7[_0xe4fd('0x28')];this['outboundDropCallsDayACS']=_0x5c4dc7[_0xe4fd('0x29')];this[_0xe4fd('0x2a')]=_0x5c4dc7[_0xe4fd('0x2a')];this[_0xe4fd('0x2b')]=_0x5c4dc7[_0xe4fd('0x2b')];this['outboundNoAnswerCallsDay']=_0x5c4dc7[_0xe4fd('0xd')];this[_0xe4fd('0x2c')]=_0x5c4dc7[_0xe4fd('0x2c')];this[_0xe4fd('0x2d')]=_0x5c4dc7[_0xe4fd('0x2d')];this[_0xe4fd('0xe')]=_0x5c4dc7[_0xe4fd('0xe')];this[_0xe4fd('0x2e')]=_0x5c4dc7[_0xe4fd('0x2e')];this[_0xe4fd('0x2f')]=_0x5c4dc7[_0xe4fd('0x2f')];this[_0xe4fd('0x30')]=_0x5c4dc7[_0xe4fd('0x30')];this[_0xe4fd('0x31')]=_0x5c4dc7[_0xe4fd('0x31')];this[_0xe4fd('0x32')]=_0x5c4dc7[_0xe4fd('0x32')];this[_0xe4fd('0x33')]=_0x5c4dc7[_0xe4fd('0x33')];this[_0xe4fd('0x34')]=_0x5c4dc7[_0xe4fd('0x34')];this[_0xe4fd('0x35')]=_0x5c4dc7[_0xe4fd('0x35')];this[_0xe4fd('0x36')]=_0x5c4dc7[_0xe4fd('0x36')];this['predictiveIntervalHitRate']=_0x5c4dc7['predictiveIntervalHitRate'];this[_0xe4fd('0x37')]=_0x5c4dc7[_0xe4fd('0x37')];this[_0xe4fd('0x38')]=_0x5c4dc7[_0xe4fd('0x38')];this['predictiveIntervalAvailable']=_0x5c4dc7[_0xe4fd('0x39')];this[_0xe4fd('0x3a')]=_0x5c4dc7[_0xe4fd('0x3a')];this[_0xe4fd('0x8')]=_0x5c4dc7[_0xe4fd('0x8')];this[_0xe4fd('0x3b')]=_0x5c4dc7[_0xe4fd('0x3b')];this[_0xe4fd('0x3c')]=_0x5c4dc7[_0xe4fd('0x3c')];this['erlangAbandonmentRate']=_0x5c4dc7[_0xe4fd('0x3d')];this['erlangBusyFactor']=_0x5c4dc7[_0xe4fd('0x3e')];this[_0xe4fd('0x3f')]=_0x5c4dc7[_0xe4fd('0x3f')];this[_0xe4fd('0x40')]=_0x5c4dc7[_0xe4fd('0x40')];this['message']=_0x5c4dc7[_0xe4fd('0x41')];this[_0xe4fd('0x42')]=_0x5c4dc7[_0xe4fd('0x42')];}if(_0x5c4dc7[_0xe4fd('0x43')]){this[_0xe4fd('0x43')]={'id':_0x5c4dc7[_0xe4fd('0x43')]['id'],'name':_0x5c4dc7['Trunk'][_0xe4fd('0x12')],'active':_0x5c4dc7[_0xe4fd('0x43')][_0xe4fd('0x44')],'callerid':_0x5c4dc7['Trunk'][_0xe4fd('0x45')]};}}VoiceQueueSummary[_0xe4fd('0x46')][_0xe4fd('0x47')]=function(_0x12a961,_0x596915,_0x38a48f,_0x38f266){this[_0xe4fd('0x2')]=0x0;this[_0xe4fd('0x4')]=0x0;this['paused']=0x0;this['unknown']=0x0;this[_0xe4fd('0x17')]=0x0;this[_0xe4fd('0x7')]=0x0;this['busy']=0x0;this[_0xe4fd('0x16')]=0x0;this[_0xe4fd('0x1c')]=0x0;this[_0xe4fd('0x18')]=0x0;this[_0xe4fd('0x19')]=0x0;this[_0xe4fd('0x48')]=0x0;if(_0x38a48f){if(_0x38a48f[_0xe4fd('0x0')]){this['available']=Number(_0x38a48f['available']);}if(_0x38a48f['loggedin']){this[_0xe4fd('0x1')]=Number(_0x38a48f[_0xe4fd('0x49')]);}if(_0x38a48f[_0xe4fd('0x4a')]){this[_0xe4fd('0x5')]=Number(_0x38a48f[_0xe4fd('0x4a')]);}}for(var _0x28898c=0x0;_0x28898c<_0x12a961[_0xe4fd('0x4b')];_0x28898c++){var _0x43c5af=_0x596915[_0xe4fd('0x4c')+_0x12a961[_0x28898c][_0xe4fd('0x12')]];if(_0x43c5af&&_0x43c5af[_0xe4fd('0x4d')]){this[_0xe4fd('0x2')]+=0x1;}if(_0x12a961[_0x28898c][_0xe4fd('0x4e')]==='1'){this[_0xe4fd('0x4')]+=0x1;}if(_0x12a961[_0x28898c]['paused']==='1'&&!['2','7','8'][_0xe4fd('0x4f')](_0x12a961[_0x28898c][_0xe4fd('0x50')])){this[_0xe4fd('0x3')]+=0x1;}switch(_0x12a961[_0x28898c]['status']){case'0':this[_0xe4fd('0x1d')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xe4fd('0x15')]+=0x1;break;case'4':this[_0xe4fd('0x16')]+=0x1;break;case'5':this[_0xe4fd('0x1c')]+=0x1;break;case'6':this[_0xe4fd('0x18')]+=0x1;break;case'7':this[_0xe4fd('0x19')]+=0x1;break;case'8':this[_0xe4fd('0x48')]+=0x1;break;}}if(this[_0xe4fd('0x21')]==='booked'){var _0x415582=Object[_0xe4fd('0x51')](_0x38f266);for(var _0x16bd52=0x0;_0x16bd52<_0x415582[_0xe4fd('0x4b')];_0x16bd52++){var _0x27a8d4=_0x415582[_0x16bd52];var _0x3f5398=_0x38f266[_0x27a8d4];if(_0x3f5398[_0xe4fd('0x52')]===this[_0xe4fd('0x12')]&&_0x3f5398[_0xe4fd('0x53')]===_0xe4fd('0x54')&&_0x3f5398[_0xe4fd('0x55')]===_0xe4fd('0x56')){this[_0xe4fd('0x4')]+=0x1;}}if(this[_0xe4fd('0x4')]>this[_0xe4fd('0x7')]){this['talking']=this[_0xe4fd('0x7')];}this[_0xe4fd('0xf')]=0x0;}return this;};VoiceQueueSummary[_0xe4fd('0x46')][_0xe4fd('0x57')]=function(_0x51d32e){var _0x59ba00=![];if(_0x51d32e){_0x59ba00=INBOUND_COUNTERS[_0xe4fd('0x58')](function(_0x1e3423){return this[_0x1e3423]!==_0x51d32e[_0x1e3423];},this);}return _0x59ba00;};VoiceQueueSummary[_0xe4fd('0x46')]['compareToOutboundQueue']=function(_0x4232be){var _0x20c37f=![];var _0x4cbc10=![];var _0xa1d3e0=![];if(_0x4232be){_0x20c37f=this[_0xe4fd('0x21')]!==_0x4232be[_0xe4fd('0x21')]||this[_0xe4fd('0x20')]!==_0x4232be[_0xe4fd('0x20')]||this[_0xe4fd('0x41')]!==_0x4232be[_0xe4fd('0x41')]||this[_0xe4fd('0x42')]!==_0x4232be[_0xe4fd('0x42')];_0x4cbc10=OUTBOUND_COUNTERS['some'](function(_0x4e0158){return this[_0x4e0158]!==_0x4232be[_0x4e0158];},this);if(this['Trunk']&&_0x4232be[_0xe4fd('0x43')]){_0xa1d3e0=this[_0xe4fd('0x43')]['name']!==_0x4232be[_0xe4fd('0x43')][_0xe4fd('0x12')]||this[_0xe4fd('0x43')][_0xe4fd('0x44')]!==_0x4232be['Trunk']['active'];}}return _0x20c37f||_0x4cbc10||_0xa1d3e0;};VoiceQueueSummary['prototype']['updateReportFromOutboundQueue']=function(_0x2342bf){this[_0xe4fd('0x6')]=_0x2342bf[_0xe4fd('0x6')];this[_0xe4fd('0x41')]=_0x2342bf[_0xe4fd('0x41')];this['statusMessage']=_0x2342bf[_0xe4fd('0x42')];this['originated']=_0x2342bf['originated'];this[_0xe4fd('0x9')]=_0x2342bf[_0xe4fd('0x9')];this[_0xe4fd('0xa')]=_0x2342bf['outboundAnswerCallsDay'];this[_0xe4fd('0xb')]=_0x2342bf[_0xe4fd('0xb')];this['outboundBusyCallsDay']=_0x2342bf[_0xe4fd('0xc')];this[_0xe4fd('0x28')]=_0x2342bf[_0xe4fd('0x28')];this[_0xe4fd('0xd')]=_0x2342bf[_0xe4fd('0xd')];this['outboundNoSuchCallsDay']=_0x2342bf['outboundNoSuchCallsDay'];this[_0xe4fd('0xe')]=_0x2342bf[_0xe4fd('0xe')];this[_0xe4fd('0x2e')]=_0x2342bf[_0xe4fd('0x2e')];this[_0xe4fd('0x2f')]=_0x2342bf['outboundUnknownCallsDay'];this[_0xe4fd('0x1a')]=_0x2342bf[_0xe4fd('0x1a')];this[_0xe4fd('0x10')]=_0x2342bf[_0xe4fd('0x10')];this[_0xe4fd('0x11')]=_0x2342bf[_0xe4fd('0x11')];if(this[_0xe4fd('0x21')]==='preview'){this[_0xe4fd('0xf')]=_0x2342bf[_0xe4fd('0xf')];}};module[_0xe4fd('0x59')]=VoiceQueueSummary; \ No newline at end of file +var _0x044a=['length','SIP/','online','includes','status','booked','keys','queue','dialer','xcally-motion-preview','some','message','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','total','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','statusMessage','Trunk','name','active','prototype','createReport','loggedin','callers'];(function(_0x1ad347,_0x475e2b){var _0x290698=function(_0x3bd333){while(--_0x3bd333){_0x1ad347['push'](_0x1ad347['shift']());}};_0x290698(++_0x475e2b);}(_0x044a,0x173));var _0xa044=function(_0x571a10,_0x2ff4ea){_0x571a10=_0x571a10-0x0;var _0xf88c42=_0x044a[_0x571a10];return _0xf88c42;};'use strict';var INBOUND_COUNTERS=[_0xa044('0x0'),_0xa044('0x1'),_0xa044('0x2'),_0xa044('0x3'),_0xa044('0x4'),_0xa044('0x5'),_0xa044('0x6')];var OUTBOUND_COUNTERS=[_0xa044('0x0'),_0xa044('0x7'),_0xa044('0x8'),'loggedIn',_0xa044('0x2'),_0xa044('0x9'),_0xa044('0xa'),_0xa044('0xb'),'outboundBlacklistCallsDay',_0xa044('0xc'),_0xa044('0xd'),_0xa044('0xe'),_0xa044('0xf'),'outboundReCallsDay',_0xa044('0x10'),_0xa044('0x11'),_0xa044('0x3'),'pTalking',_0xa044('0x5'),_0xa044('0x12'),_0xa044('0x13'),_0xa044('0x14'),'waiting'];function VoiceQueueSummary(_0x195edf){this['id']=_0x195edf['id'];this['name']=_0x195edf['name'];this[_0xa044('0x15')]=_0x195edf[_0xa044('0x15')];this[_0xa044('0x16')]=_0x195edf[_0xa044('0x16')]||0x0;this[_0xa044('0x7')]=_0x195edf[_0xa044('0x7')]||0x0;this[_0xa044('0x0')]=_0x195edf['available']||0x0;this[_0xa044('0x17')]=_0x195edf['busy']||0x0;this[_0xa044('0x8')]=_0x195edf[_0xa044('0x8')]||0x0;this[_0xa044('0x18')]=_0x195edf[_0xa044('0x18')]||0x0;this[_0xa044('0x1')]=_0x195edf['loggedIn']||0x0;this['loggedInDb']=_0x195edf[_0xa044('0x2')]||0x0;this['onHold']=_0x195edf[_0xa044('0x19')]||0x0;this[_0xa044('0x1a')]=_0x195edf[_0xa044('0x1a')]||0x0;this[_0xa044('0x3')]=_0x195edf[_0xa044('0x3')]||0x0;this['ringing']=_0x195edf['ringing']||0x0;this['ringInUse']=_0x195edf[_0xa044('0x1b')];this[_0xa044('0x12')]=_0x195edf[_0xa044('0x12')];this['sumDuration']=_0x195edf[_0xa044('0x13')];this[_0xa044('0x1c')]=_0x195edf['sumHoldTime']||0x0;this[_0xa044('0x5')]=_0x195edf[_0xa044('0x5')]||0x0;this[_0xa044('0x14')]=_0x195edf['total']||0x0;this[_0xa044('0x1d')]=_0x195edf[_0xa044('0x1d')];this[_0xa044('0x1e')]=_0x195edf[_0xa044('0x1e')]||0x0;this[_0xa044('0x1f')]=_0x195edf[_0xa044('0x1f')]||0x0;this[_0xa044('0x20')]=_0x195edf[_0xa044('0x20')]||0x0;this[_0xa044('0x6')]=_0x195edf['waiting']||0x0;if(_0x195edf['type']===_0xa044('0x21')){this[_0xa044('0x22')]=_0x195edf[_0xa044('0x22')]||0x0;this['dialActive']=_0x195edf[_0xa044('0x23')];this[_0xa044('0x24')]=_0x195edf['dialMethod'];this[_0xa044('0x25')]=_0x195edf[_0xa044('0x25')];this['dialOriginateCallerIdNumber']=_0x195edf[_0xa044('0x26')];this[_0xa044('0x27')]=_0x195edf['dialOriginateTimeout'];this['dialPrefix']=_0x195edf['dialPrefix'];this[_0xa044('0x28')]=_0x195edf[_0xa044('0x28')];this[_0xa044('0x29')]=_0x195edf['outboundAnswerAgiCallsDay'];this[_0xa044('0xb')]=_0x195edf[_0xa044('0xb')];this['outboundBlacklistCallsDay']=_0x195edf[_0xa044('0x2a')];this['outboundBusyCallsDay']=_0x195edf['outboundBusyCallsDay'];this[_0xa044('0xd')]=_0x195edf['outboundCongestionCallsDay'];this[_0xa044('0x2b')]=_0x195edf[_0xa044('0x2b')];this[_0xa044('0x2c')]=_0x195edf[_0xa044('0x2c')];this[_0xa044('0x2d')]=_0x195edf[_0xa044('0x2d')];this['outboundNoAnswerCallsDay']=_0x195edf[_0xa044('0xe')];this[_0xa044('0xf')]=_0x195edf[_0xa044('0xf')];this[_0xa044('0x2e')]=_0x195edf['outboundOriginateFailureCallsDay'];this[_0xa044('0x2f')]=_0x195edf[_0xa044('0x2f')];this['outboundRejectCallsDay']=_0x195edf['outboundRejectCallsDay'];this[_0xa044('0x11')]=_0x195edf[_0xa044('0x11')];this['predictiveIntervalAnsweredCalls']=_0x195edf[_0xa044('0x30')];this[_0xa044('0x31')]=_0x195edf[_0xa044('0x31')];this['predictiveIntervalAvgTalktime']=_0x195edf[_0xa044('0x32')];this[_0xa044('0x33')]=_0x195edf[_0xa044('0x33')];this[_0xa044('0x34')]=_0x195edf[_0xa044('0x34')];this['predictiveIntervalErlangCalls']=_0x195edf[_0xa044('0x35')];this[_0xa044('0x36')]=_0x195edf[_0xa044('0x36')];this['predictiveIntervalHitRate']=_0x195edf[_0xa044('0x37')];this[_0xa044('0x38')]=_0x195edf['predictiveIntervalMultiplicativeFactor'];this[_0xa044('0x39')]=_0x195edf[_0xa044('0x39')];this[_0xa044('0x3a')]=_0x195edf[_0xa044('0x3a')];this[_0xa044('0x3b')]=_0x195edf[_0xa044('0x3b')];this[_0xa044('0x9')]=_0x195edf[_0xa044('0x9')];this['erlangCalls']=_0x195edf[_0xa044('0x3c')];this[_0xa044('0x3d')]=_0x195edf[_0xa044('0x3d')];this[_0xa044('0x3e')]=_0x195edf[_0xa044('0x3e')];this['erlangBusyFactor']=_0x195edf[_0xa044('0x3f')];this['startPredictive']=_0x195edf[_0xa044('0x40')];this[_0xa044('0x41')]=_0x195edf['startProgressive'];this['message']=_0x195edf['message'];this[_0xa044('0x42')]=_0x195edf[_0xa044('0x42')];}if(_0x195edf[_0xa044('0x43')]){this[_0xa044('0x43')]={'id':_0x195edf[_0xa044('0x43')]['id'],'name':_0x195edf[_0xa044('0x43')][_0xa044('0x44')],'active':_0x195edf[_0xa044('0x43')][_0xa044('0x45')],'callerid':_0x195edf[_0xa044('0x43')]['callerid']};}}VoiceQueueSummary[_0xa044('0x46')][_0xa044('0x47')]=function(_0x1e84c1,_0x7d768b,_0xde6a4c,_0x1295c0){this[_0xa044('0x2')]=0x0;this[_0xa044('0x5')]=0x0;this[_0xa044('0x3')]=0x0;this[_0xa044('0x1f')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0xa044('0x17')]=0x0;this['invalid']=0x0;this[_0xa044('0x1e')]=0x0;this[_0xa044('0x4')]=0x0;this[_0xa044('0x1b')]=0x0;this[_0xa044('0x19')]=0x0;if(_0xde6a4c){if(_0xde6a4c[_0xa044('0x0')]){this[_0xa044('0x0')]=Number(_0xde6a4c['available']);}if(_0xde6a4c[_0xa044('0x48')]){this['loggedIn']=Number(_0xde6a4c[_0xa044('0x48')]);}if(_0xde6a4c[_0xa044('0x49')]){this[_0xa044('0x6')]=Number(_0xde6a4c['callers']);}}for(var _0x543e64=0x0;_0x543e64<_0x1e84c1[_0xa044('0x4a')];_0x543e64++){var _0x1e4a4f=_0x7d768b[_0xa044('0x4b')+_0x1e84c1[_0x543e64][_0xa044('0x44')]];if(_0x1e4a4f&&_0x1e4a4f[_0xa044('0x4c')]){this[_0xa044('0x2')]+=0x1;}if(_0x1e84c1[_0x543e64]['incall']==='1'){this[_0xa044('0x5')]+=0x1;}if(_0x1e84c1[_0x543e64][_0xa044('0x3')]==='1'&&!['2','7','8'][_0xa044('0x4d')](_0x1e84c1[_0x543e64][_0xa044('0x4e')])){this[_0xa044('0x3')]+=0x1;}switch(_0x1e84c1[_0x543e64][_0xa044('0x4e')]){case'0':this[_0xa044('0x1f')]+=0x1;break;case'1':this[_0xa044('0x1a')]+=0x1;break;case'2':this[_0xa044('0x8')]+=0x1;break;case'3':this[_0xa044('0x17')]+=0x1;break;case'4':this[_0xa044('0x18')]+=0x1;break;case'5':this[_0xa044('0x1e')]+=0x1;break;case'6':this[_0xa044('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xa044('0x19')]+=0x1;break;}}if(this[_0xa044('0x24')]===_0xa044('0x4f')){var _0x228fc0=Object[_0xa044('0x50')](_0x1295c0);for(var _0x230ecf=0x0;_0x230ecf<_0x228fc0[_0xa044('0x4a')];_0x230ecf++){var _0x5c2498=_0x228fc0[_0x230ecf];var _0x57261c=_0x1295c0[_0x5c2498];if(_0x57261c[_0xa044('0x51')]===this[_0xa044('0x44')]&&_0x57261c[_0xa044('0x1d')]===_0xa044('0x52')&&_0x57261c['exten']===_0xa044('0x53')){this[_0xa044('0x5')]+=0x1;}}if(this[_0xa044('0x5')]>this[_0xa044('0x8')]){this[_0xa044('0x5')]=this[_0xa044('0x8')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xa044('0x46')]['compareToInboundQueue']=function(_0x5ad9fa){var _0x4152c7=![];if(_0x5ad9fa){_0x4152c7=INBOUND_COUNTERS[_0xa044('0x54')](function(_0x3ea870){return this[_0x3ea870]!==_0x5ad9fa[_0x3ea870];},this);}return _0x4152c7;};VoiceQueueSummary[_0xa044('0x46')]['compareToOutboundQueue']=function(_0x55f25d){var _0x4e50d5=![];var _0x26e66a=![];var _0x698e27=![];if(_0x55f25d){_0x4e50d5=this['dialMethod']!==_0x55f25d[_0xa044('0x24')]||this[_0xa044('0x23')]!==_0x55f25d['dialActive']||this['message']!==_0x55f25d[_0xa044('0x55')]||this[_0xa044('0x42')]!==_0x55f25d[_0xa044('0x42')];_0x26e66a=OUTBOUND_COUNTERS[_0xa044('0x54')](function(_0x4c91d0){return this[_0x4c91d0]!==_0x55f25d[_0x4c91d0];},this);if(this[_0xa044('0x43')]&&_0x55f25d[_0xa044('0x43')]){_0x698e27=this[_0xa044('0x43')][_0xa044('0x44')]!==_0x55f25d[_0xa044('0x43')][_0xa044('0x44')]||this[_0xa044('0x43')][_0xa044('0x45')]!==_0x55f25d[_0xa044('0x43')][_0xa044('0x45')];}}return _0x4e50d5||_0x26e66a||_0x698e27;};VoiceQueueSummary[_0xa044('0x46')][_0xa044('0x56')]=function(_0x2b6fa4){this[_0xa044('0x7')]=_0x2b6fa4[_0xa044('0x7')];this['message']=_0x2b6fa4[_0xa044('0x55')];this[_0xa044('0x42')]=_0x2b6fa4[_0xa044('0x42')];this[_0xa044('0x9')]=_0x2b6fa4[_0xa044('0x9')];this[_0xa044('0xa')]=_0x2b6fa4['outboundAbandonedCallsDay'];this[_0xa044('0xb')]=_0x2b6fa4[_0xa044('0xb')];this[_0xa044('0x2a')]=_0x2b6fa4[_0xa044('0x2a')];this[_0xa044('0xc')]=_0x2b6fa4['outboundBusyCallsDay'];this[_0xa044('0xd')]=_0x2b6fa4['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x2b6fa4[_0xa044('0xe')];this[_0xa044('0xf')]=_0x2b6fa4['outboundNoSuchCallsDay'];this[_0xa044('0x2f')]=_0x2b6fa4[_0xa044('0x2f')];this['outboundRejectCallsDay']=_0x2b6fa4[_0xa044('0x10')];this['outboundUnknownCallsDay']=_0x2b6fa4['outboundUnknownCallsDay'];this[_0xa044('0x12')]=_0x2b6fa4['sumBillable'];this['sumDuration']=_0x2b6fa4[_0xa044('0x13')];this[_0xa044('0x14')]=_0x2b6fa4[_0xa044('0x14')];if(this['dialMethod']===_0xa044('0x57')){this[_0xa044('0x22')]=_0x2b6fa4[_0xa044('0x22')];}};module[_0xa044('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 8f3630d..a55e0de 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 _0x4074=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x4ad644,_0x521a51){var _0x442f2b=function(_0x346beb){while(--_0x346beb){_0x4ad644['push'](_0x4ad644['shift']());}};_0x442f2b(++_0x521a51);}(_0x4074,0xf0));var _0x4407=function(_0x1deb2a,_0x401cf1){_0x1deb2a=_0x1deb2a-0x0;var _0x8b98d0=_0x4074[_0x1deb2a];return _0x8b98d0;};'use strict';function VtigerAccount(_0x4dc38f){this['id']=_0x4dc38f['id']||0x0;this[_0x4407('0x0')]=_0x4dc38f[_0x4407('0x0')]||'';this['username']=_0x4dc38f[_0x4407('0x1')]||'';this[_0x4407('0x2')]=_0x4dc38f[_0x4407('0x2')]||'';this[_0x4407('0x3')]=_0x4dc38f[_0x4407('0x3')]||'';this[_0x4407('0x4')]=_0x4dc38f[_0x4407('0x4')]||'';this[_0x4407('0x5')]=_0x4dc38f[_0x4407('0x5')]||{};}module[_0x4407('0x6')]=VtigerAccount; \ No newline at end of file +var _0xb9ae=['exports','name','username','accessKey','remoteUri','Configurations'];(function(_0x5d77fd,_0x923869){var _0xf60f8a=function(_0x349896){while(--_0x349896){_0x5d77fd['push'](_0x5d77fd['shift']());}};_0xf60f8a(++_0x923869);}(_0xb9ae,0xaf));var _0xeb9a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb9ae[_0x40a045];return _0x1a687c;};'use strict';function VtigerAccount(_0x39a7c7){this['id']=_0x39a7c7['id']||0x0;this[_0xeb9a('0x0')]=_0x39a7c7['name']||'';this['username']=_0x39a7c7[_0xeb9a('0x1')]||'';this[_0xeb9a('0x2')]=_0x39a7c7[_0xeb9a('0x2')]||'';this['remoteUri']=_0x39a7c7[_0xeb9a('0x3')]||'';this['serverUrl']=_0x39a7c7['serverUrl']||'';this[_0xeb9a('0x4')]=_0x39a7c7[_0xeb9a('0x4')]||{};}module[_0xeb9a('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 6b68a31..25d75e3 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 _0xc2be=['remoteUri','authType','type','serverUrl','Configurations','name','username','password','token'];(function(_0x5520af,_0x41002d){var _0x2e6299=function(_0x100033){while(--_0x100033){_0x5520af['push'](_0x5520af['shift']());}};_0x2e6299(++_0x41002d);}(_0xc2be,0x1c7));var _0xec2b=function(_0xb71c35,_0x129343){_0xb71c35=_0xb71c35-0x0;var _0x39224f=_0xc2be[_0xb71c35];return _0x39224f;};'use strict';function ZendeskAccount(_0x326c66){this['id']=_0x326c66['id']||0x0;this['name']=_0x326c66[_0xec2b('0x0')]||'';this[_0xec2b('0x1')]=_0x326c66[_0xec2b('0x1')]||'';this[_0xec2b('0x2')]=_0x326c66[_0xec2b('0x2')]||'';this[_0xec2b('0x3')]=_0x326c66[_0xec2b('0x3')]||'';this[_0xec2b('0x4')]=_0x326c66[_0xec2b('0x4')]||'';this[_0xec2b('0x5')]=_0x326c66[_0xec2b('0x5')]||'';this[_0xec2b('0x6')]=_0x326c66[_0xec2b('0x6')]||'integrationTab';this[_0xec2b('0x7')]=_0x326c66[_0xec2b('0x7')]||'';this['Configurations']=_0x326c66[_0xec2b('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xbe89=['exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xbe89,0x12a));var _0x9be8=function(_0x42f0b6,_0x47dcfd){_0x42f0b6=_0x42f0b6-0x0;var _0x4ee770=_0xbe89[_0x42f0b6];return _0x4ee770;};'use strict';function ZendeskAccount(_0x5f0c9e){this['id']=_0x5f0c9e['id']||0x0;this[_0x9be8('0x0')]=_0x5f0c9e[_0x9be8('0x0')]||'';this[_0x9be8('0x1')]=_0x5f0c9e[_0x9be8('0x1')]||'';this[_0x9be8('0x2')]=_0x5f0c9e[_0x9be8('0x2')]||'';this[_0x9be8('0x3')]=_0x5f0c9e[_0x9be8('0x3')]||'';this[_0x9be8('0x4')]=_0x5f0c9e['remoteUri']||'';this[_0x9be8('0x5')]=_0x5f0c9e[_0x9be8('0x5')]||'';this[_0x9be8('0x6')]=_0x5f0c9e['type']||_0x9be8('0x7');this[_0x9be8('0x8')]=_0x5f0c9e[_0x9be8('0x8')]||'';this[_0x9be8('0x9')]=_0x5f0c9e[_0x9be8('0x9')]||{};}module[_0x9be8('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c570381..803519c 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 _0x0c92=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x598206,_0x5bd0cf){var _0x2f914c=function(_0x57c450){while(--_0x57c450){_0x598206['push'](_0x598206['shift']());}};_0x2f914c(++_0x5bd0cf);}(_0x0c92,0xc0));var _0x20c9=function(_0x183256,_0x1a596d){_0x183256=_0x183256-0x0;var _0x5394a2=_0x0c92[_0x183256];return _0x5394a2;};'use strict';function ZohoAccount(_0x432acf){this['id']=_0x432acf['id']||0x0;this[_0x20c9('0x0')]=_0x432acf[_0x20c9('0x0')]||'';this['description']=_0x432acf[_0x20c9('0x1')]||'';this[_0x20c9('0x2')]=_0x432acf['host']||'';this['zone']=_0x432acf[_0x20c9('0x3')]||'';this[_0x20c9('0x4')]=_0x432acf[_0x20c9('0x4')]||'';this[_0x20c9('0x5')]=_0x432acf[_0x20c9('0x5')]||'';this[_0x20c9('0x6')]=_0x432acf[_0x20c9('0x6')]||'';this[_0x20c9('0x7')]=_0x432acf[_0x20c9('0x7')]||'';this[_0x20c9('0x8')]=_0x432acf['refreshToken']||'';this[_0x20c9('0x9')]=_0x432acf[_0x20c9('0x9')]||{};}module[_0x20c9('0xa')]=ZohoAccount; \ No newline at end of file +var _0x32fe=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x32fe,0x154));var _0xe32f=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0x32fe[_0x285c85];return _0x2f81cd;};'use strict';function ZohoAccount(_0x326fef){this['id']=_0x326fef['id']||0x0;this[_0xe32f('0x0')]=_0x326fef['name']||'';this[_0xe32f('0x1')]=_0x326fef[_0xe32f('0x1')]||'';this[_0xe32f('0x2')]=_0x326fef[_0xe32f('0x2')]||'';this[_0xe32f('0x3')]=_0x326fef[_0xe32f('0x3')]||'';this['clientId']=_0x326fef[_0xe32f('0x4')]||'';this[_0xe32f('0x5')]=_0x326fef[_0xe32f('0x5')]||'';this[_0xe32f('0x6')]=_0x326fef[_0xe32f('0x6')]||'';this[_0xe32f('0x7')]=_0x326fef[_0xe32f('0x7')]||'';this[_0xe32f('0x8')]=_0x326fef['refreshToken']||'';this['Configurations']=_0x326fef[_0xe32f('0x9')]||{};}module[_0xe32f('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 25b0ef9..a1f6f32 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 _0x32f4=['isNil','uniqueid','queue','type','campaigntype','dialAnswer','Agent','channelAgent','membername','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','format','calleridname','exports','util','lodash','moment','string'];(function(_0xfee5a0,_0x3253a4){var _0x1961ad=function(_0x245375){while(--_0x245375){_0xfee5a0['push'](_0xfee5a0['shift']());}};_0x1961ad(++_0x3253a4);}(_0x32f4,0x154));var _0x432f=function(_0x2e202d,_0x43c9f8){_0x2e202d=_0x2e202d-0x0;var _0x219cf6=_0x32f4[_0x2e202d];return _0x219cf6;};'use strict';var util=require(_0x432f('0x0'));var _=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));function checkNameSurname(_0x2b22ad,_0x5ee65a,_0x2a4628){var _0x6f0e8a='';if(!_['isNil'](_0x5ee65a)&&_0x432f('0x3')===typeof _0x5ee65a){_0x6f0e8a+=_0x5ee65a;}if(!_[_0x432f('0x4')](_0x2a4628)&&_0x432f('0x3')===typeof _0x2a4628){_0x6f0e8a+='\x20'+_0x2a4628;}if(_0x6f0e8a!==''){return _0x6f0e8a;}return _0x2b22ad;}function Action(_0x355b02,_0x2f5f03,_0x5d8cc0,_0x5b5f08,_0x2f66fd){this[_0x432f('0x5')]=_0x5d8cc0||undefined;this['idContact']=_0x355b02['id'];this[_0x432f('0x6')]=_0x2f5f03['name'];this[_0x432f('0x7')]=_0x2f5f03[_0x432f('0x7')];this[_0x432f('0x8')]=_0x432f('0x6');this[_0x432f('0x9')]=![];this['membername']=_[_0x432f('0x4')](_0x355b02['Agent'])?undefined:_0x355b02[_0x432f('0xa')]['name'];this[_0x432f('0xb')]=this[_0x432f('0xc')]?util['format'](_0x432f('0xd'),this[_0x432f('0xc')]):_0x5b5f08||undefined;this['calleridname']=checkNameSurname(_0x355b02[_0x432f('0xe')][_0x432f('0xf')],_0x355b02['Contact']['firstName'],_0x355b02[_0x432f('0xe')][_0x432f('0x10')]);this[_0x432f('0x11')]=_0x355b02[_0x432f('0x11')]||![];this[_0x432f('0x12')]=_0x355b02['phone'];this[_0x432f('0x13')]=_0x355b02[_0x432f('0x13')];this[_0x432f('0x14')]=_0x355b02[_0x432f('0x14')]||0x0;this['countcongestionretry']=_0x355b02[_0x432f('0x15')]||0x0;this[_0x432f('0x16')]=_0x355b02[_0x432f('0x16')]||0x0;this[_0x432f('0x17')]=(_0x355b02[_0x432f('0x14')]||0x0)+(_0x355b02[_0x432f('0x15')]||0x0)+(_0x355b02['countnoanswerretry']||0x0)+(_0x355b02[_0x432f('0x18')]||0x0)+(_0x355b02['countdropretry']||0x0)+(_0x355b02[_0x432f('0x19')]||0x0)+(_0x355b02[_0x432f('0x1a')]||0x0)+(_0x355b02[_0x432f('0x1b')]||0x0);this[_0x432f('0x18')]=_0x355b02[_0x432f('0x18')]||0x0;this[_0x432f('0x1c')]=_0x355b02[_0x432f('0x1c')]||0x0;this[_0x432f('0x19')]=_0x355b02[_0x432f('0x19')]||0x0;this[_0x432f('0x1a')]=_0x355b02[_0x432f('0x1a')]||0x0;this[_0x432f('0x1b')]=_0x355b02['countagentrejectretry']||0x0;this['callback']=_0x355b02[_0x432f('0x1d')];this['callbackuniqueid']=_0x355b02[_0x432f('0x1e')];this['callbackat']=_0x355b02[_0x432f('0x1f')];this[_0x432f('0x20')]=_0x355b02[_0x432f('0x20')];this[_0x432f('0x21')]=_0x355b02[_0x432f('0x21')];this[_0x432f('0x22')]=_0x355b02['ListId'];this[_0x432f('0x23')]=_[_0x432f('0x4')](_0x355b02['Agent'])?_0x355b02[_0x432f('0x23')]:_0x355b02[_0x432f('0xa')]['id'];this[_0x432f('0x24')]=_0x355b02[_0x432f('0x24')];this[_0x432f('0x25')]='';this[_0x432f('0x26')]='';}Action[_0x432f('0x27')]['getCaller']=function(){return util[_0x432f('0x28')]('\x22%s\x22\x20<%s>',this[_0x432f('0x29')],this['number']);};module[_0x432f('0x2a')]=Action; \ No newline at end of file +var _0xd943=['countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','uniqueid','idContact','type','campaigntype','dialAnswer','Agent','name','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xd943,0x15d));var _0x3d94=function(_0x403fff,_0xecb737){_0x403fff=_0x403fff-0x0;var _0xe048c2=_0xd943[_0x403fff];return _0xe048c2;};'use strict';var util=require(_0x3d94('0x0'));var _=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));function checkNameSurname(_0x440dd8,_0x5495df,_0x691e28){var _0x3edd1b='';if(!_[_0x3d94('0x3')](_0x5495df)&&_0x3d94('0x4')===typeof _0x5495df){_0x3edd1b+=_0x5495df;}if(!_[_0x3d94('0x3')](_0x691e28)&&'string'===typeof _0x691e28){_0x3edd1b+='\x20'+_0x691e28;}if(_0x3edd1b!==''){return _0x3edd1b;}return _0x440dd8;}function Action(_0x54e692,_0x34c9c3,_0x51cf1f,_0x54e81f,_0x4d29e7){this[_0x3d94('0x5')]=_0x51cf1f||undefined;this[_0x3d94('0x6')]=_0x54e692['id'];this['queue']=_0x34c9c3['name'];this[_0x3d94('0x7')]=_0x34c9c3[_0x3d94('0x7')];this[_0x3d94('0x8')]='queue';this[_0x3d94('0x9')]=![];this['membername']=_[_0x3d94('0x3')](_0x54e692[_0x3d94('0xa')])?undefined:_0x54e692['Agent'][_0x3d94('0xb')];this[_0x3d94('0xc')]=this[_0x3d94('0xd')]?util[_0x3d94('0xe')](_0x3d94('0xf'),this['membername']):_0x54e81f||undefined;this[_0x3d94('0x10')]=checkNameSurname(_0x54e692[_0x3d94('0x11')][_0x3d94('0x12')],_0x54e692['Contact'][_0x3d94('0x13')],_0x54e692[_0x3d94('0x11')][_0x3d94('0x14')]);this['active']=_0x54e692[_0x3d94('0x15')]||![];this[_0x3d94('0x16')]=_0x54e692[_0x3d94('0x12')];this[_0x3d94('0x17')]=_0x54e692[_0x3d94('0x17')];this[_0x3d94('0x18')]=_0x54e692[_0x3d94('0x18')]||0x0;this[_0x3d94('0x19')]=_0x54e692['countcongestionretry']||0x0;this[_0x3d94('0x1a')]=_0x54e692[_0x3d94('0x1a')]||0x0;this[_0x3d94('0x1b')]=(_0x54e692[_0x3d94('0x18')]||0x0)+(_0x54e692[_0x3d94('0x19')]||0x0)+(_0x54e692[_0x3d94('0x1a')]||0x0)+(_0x54e692[_0x3d94('0x1c')]||0x0)+(_0x54e692['countdropretry']||0x0)+(_0x54e692[_0x3d94('0x1d')]||0x0)+(_0x54e692['countmachineretry']||0x0)+(_0x54e692[_0x3d94('0x1e')]||0x0);this[_0x3d94('0x1c')]=_0x54e692[_0x3d94('0x1c')]||0x0;this[_0x3d94('0x1f')]=_0x54e692[_0x3d94('0x1f')]||0x0;this['countabandonedretry']=_0x54e692['countabandonedretry']||0x0;this[_0x3d94('0x20')]=_0x54e692[_0x3d94('0x20')]||0x0;this[_0x3d94('0x1e')]=_0x54e692['countagentrejectretry']||0x0;this[_0x3d94('0x21')]=_0x54e692[_0x3d94('0x21')];this[_0x3d94('0x22')]=_0x54e692[_0x3d94('0x22')];this[_0x3d94('0x23')]=_0x54e692[_0x3d94('0x23')];this[_0x3d94('0x24')]=_0x54e692[_0x3d94('0x24')];this[_0x3d94('0x25')]=_0x54e692[_0x3d94('0x25')];this[_0x3d94('0x26')]=_0x54e692[_0x3d94('0x26')];this[_0x3d94('0x27')]=_[_0x3d94('0x3')](_0x54e692[_0x3d94('0xa')])?_0x54e692['UserId']:_0x54e692[_0x3d94('0xa')]['id'];this['VoiceQueueId']=_0x54e692[_0x3d94('0x28')];this[_0x3d94('0x29')]='';this[_0x3d94('0x2a')]='';}Action[_0x3d94('0x2b')][_0x3d94('0x2c')]=function(){return util[_0x3d94('0xe')](_0x3d94('0x2d'),this['calleridname'],this['number']);};module[_0x3d94('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 01d6828..ab49b02 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 _0x9bda=['AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact\x20is\x20undefined','Queue','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','status','unmonitored','execRun','unlock','getContactPreview','recallme','isValid','phone','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','callerid','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','setXMDContactVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','syncNewExten','syncOriginateResponse','lookAgent','isFailure','response','rejected','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','unlockContact','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','destuniqueid','syncHangupRequest','filterKey','variable','addVariable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','actionPreview','../rpc/cmHopperAdditionalPhone','./util/util','../dialer/utils','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','bind','hangup','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','loopCampaigns','campaignsPreview','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','emit','sendMessageOneNotActive','originated','available','paused','INACTIVE','logger','message','CAMPAIGN_STATUS','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','dialMethod','preview','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','stringify','pTalking:\x20','pTalking','pick','contactId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','isNil','length','getDiff','scheduledat','Agent','run','then','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','idContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','dialAnswer','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','buildObj','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','incrementPreviewCounters','swapAdditionalPhones','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','verifyAdditionalPhones','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]'];(function(_0x16e881,_0x8e7243){var _0x48f1fc=function(_0x43ddf3){while(--_0x43ddf3){_0x16e881['push'](_0x16e881['shift']());}};_0x48f1fc(++_0x8e7243);}(_0x9bda,0x19e));var _0xa9bd=function(_0x2d8f6c,_0x44db4c){_0x2d8f6c=_0x2d8f6c-0x0;var _0x3a00f6=_0x9bda[_0x2d8f6c];return _0x3a00f6;};'use strict';var util=require(_0xa9bd('0x0'));var _=require(_0xa9bd('0x1'));var uuid=require(_0xa9bd('0x2'));var moment=require(_0xa9bd('0x3'));var Redis=require(_0xa9bd('0x4'));var config=require(_0xa9bd('0x5'));var logger=require(_0xa9bd('0x6'))('preview');var loggerAction=require(_0xa9bd('0x6'))(_0xa9bd('0x7'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xa9bd('0x8'));var Action=require('./action');var ut=require(_0xa9bd('0x9'));var utils=require(_0xa9bd('0xa'));config[_0xa9bd('0xb')]=_[_0xa9bd('0xc')](config[_0xa9bd('0xb')],{'host':_0xa9bd('0xd'),'port':0x18eb});var io=require(_0xa9bd('0xe'))(new Redis(config[_0xa9bd('0xb')]));var Sequence=function(){};Sequence[_0xa9bd('0xf')][_0xa9bd('0x10')]=function(_0x11bb82){this[_0xa9bd('0x11')]=this[_0xa9bd('0x11')]?this[_0xa9bd('0x11')][_0xa9bd('0x12')](_0x11bb82):_0x11bb82();};function Preview(_0xafddf5){this[_0xa9bd('0x13')]=new Sequence();this['campaignsPreview']=_0xafddf5[_0xa9bd('0x14')];this[_0xa9bd('0x15')]=_0xafddf5[_0xa9bd('0x15')];this[_0xa9bd('0x16')]={};this[_0xa9bd('0x17')]=_0xafddf5[_0xa9bd('0x17')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xa9bd('0x18')](this));ami['on'](_0xa9bd('0x19'),this[_0xa9bd('0x1a')][_0xa9bd('0x18')](this));ami['on'](_0xa9bd('0x1b'),this['syncHangupRequest'][_0xa9bd('0x18')](this));ami['on'](_0xa9bd('0x1c'),this[_0xa9bd('0x1d')]['bind'](this));ami['on'](_0xa9bd('0x1e'),this['syncNewExten'][_0xa9bd('0x18')](this));ami['on'](_0xa9bd('0x1f'),this[_0xa9bd('0x20')][_0xa9bd('0x18')](this));ami['on'](_0xa9bd('0x21'),this[_0xa9bd('0x22')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xa9bd('0x18')](this));this[_0xa9bd('0x23')](this[_0xa9bd('0x24')]);}function emit(_0x19cbed,_0x1bd7e8,_0x27b8bb){io['to'](_0x19cbed)['emit'](_0x1bd7e8,_0x27b8bb);}function emitVoiceQueueChannelRemove(_0x26f6bb){logger[_0xa9bd('0x25')](_0xa9bd('0x26'),JSON['stringify'](_0x26f6bb));emit(util[_0xa9bd('0x27')](_0xa9bd('0x28'),_0x26f6bb[_0xa9bd('0x29')]),_0xa9bd('0x2a'),_0x26f6bb);io[_0xa9bd('0x2b')]('voice_queue_presence:remove',_0x26f6bb);}function notSendMessagesQueue(_0x6fb9c){if(_0x6fb9c[_0xa9bd('0x2c')]){if(_0x6fb9c[_0xa9bd('0x2d')]===0x0&&_0x6fb9c['pTalking']===0x0){_0x6fb9c['sendMessageOneNotActive']=![];_0x6fb9c[_0xa9bd('0x2e')]=0x0;_0x6fb9c[_0xa9bd('0x2f')]=0x0;_0x6fb9c['message']=utils['CAMPAIGN_STATUS'][_0xa9bd('0x30')];ut[_0xa9bd('0x31')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x6fb9c[_0xa9bd('0x29')]+'\x20is\x20not\x20active');}else{_0x6fb9c[_0xa9bd('0x32')]=utils[_0xa9bd('0x33')][_0xa9bd('0x34')];ut[_0xa9bd('0x31')](_0xa9bd('0x35'),_0x6fb9c[_0xa9bd('0x29')]+_0xa9bd('0x36'));}}}Preview['prototype']['loopCampaigns']=function(){var _0x21face=this;setInterval(function(){_0x21face[_0xa9bd('0x37')]();},0x7cf);};Preview[_0xa9bd('0xf')][_0xa9bd('0x37')]=function(){var _0x30b9f8=this['campaignsPreview'];this[_0xa9bd('0x38')]+=0x1;for(var _0x68c821 in _0x30b9f8){if(_0x30b9f8['hasOwnProperty'](_0x68c821)&&(_0x30b9f8[_0x68c821][_0xa9bd('0x39')]===_0xa9bd('0x3a')||_0x30b9f8[_0x68c821][_0xa9bd('0x39')]===_0xa9bd('0x3b'))&&_0x30b9f8[_0x68c821][_0xa9bd('0x3c')]===_0xa9bd('0x3d')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0xa9bd('0x3e')]();}}if(_0x30b9f8['hasOwnProperty'](_0x68c821)&&_0x30b9f8[_0x68c821]['dialMethod']===_0xa9bd('0x3a')&&_0x30b9f8[_0x68c821][_0xa9bd('0x3c')]===_0xa9bd('0x3d')){if(_0x30b9f8[_0x68c821][_0xa9bd('0x3f')]){this[_0xa9bd('0x40')](_0x30b9f8[_0x68c821]);if(_0x30b9f8[_0x68c821][_0xa9bd('0x41')])this[_0xa9bd('0x42')](_0x30b9f8[_0x68c821]);}else{notSendMessagesQueue(_0x30b9f8[_0x68c821]);}}}};Preview[_0xa9bd('0xf')][_0xa9bd('0x43')]=function(_0x5c2b1f){var _0x189b79=this;this['sequence'][_0xa9bd('0x10')](function(){if(!_['isNil'](_0x189b79[_0xa9bd('0x16')][_0x5c2b1f])){loggerAction[_0xa9bd('0x25')](_0xa9bd('0x44'),_0x5c2b1f,'Queue',_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')],_0xa9bd('0x46'),JSON[_0xa9bd('0x47')](_0x189b79[_0xa9bd('0x24')][_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')]][_0xa9bd('0x2d')]),_0xa9bd('0x48'),JSON[_0xa9bd('0x47')](_0x189b79[_0xa9bd('0x24')][_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')]][_0xa9bd('0x49')]),JSON[_0xa9bd('0x47')](_0x189b79[_0xa9bd('0x16')][_0x5c2b1f]['dialAnswer']),JSON['stringify'](_[_0xa9bd('0x4a')](_0x189b79[_0xa9bd('0x16')][_0x5c2b1f],[_0xa9bd('0x4b'),'UserId',_0xa9bd('0x4c'),_0xa9bd('0x4d')])));return ami[_0xa9bd('0x4e')]({'action':'status','channel':_0x189b79['actions'][_0x5c2b1f][_0xa9bd('0x4f')]})[_0xa9bd('0x50')](function(_0x3b8f0e){if(_0x3b8f0e[_0xa9bd('0x32')]===_0xa9bd('0x51')){setTimeout(function(){if(_0x189b79['actions'][_0x5c2b1f]){ut[_0xa9bd('0x52')](_0x189b79['campaignsPreview'][_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')]],_0xa9bd('0x53'));if(_0x189b79[_0xa9bd('0x16')][_0x5c2b1f]['dialAnswer']===!![]){ut[_0xa9bd('0x54')](_0x189b79[_0xa9bd('0x24')][_0x189b79['actions'][_0x5c2b1f][_0xa9bd('0x45')]],_0xa9bd('0x53'));ut[_0xa9bd('0x55')]('[Dialer][checkChannel][pTalking][Preview]'+_0x5c2b1f,_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')]);}ut['loggerError'](_0xa9bd('0x56')+_0x5c2b1f,_0x189b79[_0xa9bd('0x16')][_0x5c2b1f][_0xa9bd('0x45')]);delete _0x189b79[_0xa9bd('0x16')][_0x5c2b1f];}},0x2328);}});}});};Preview[_0xa9bd('0xf')][_0xa9bd('0x3e')]=function(){var _0x3a0e27=this;loggerAction[_0xa9bd('0x25')]('[action]',_[_0xa9bd('0x57')](this[_0xa9bd('0x16')]));for(var _0x47905c in this['actions']){if(_0x3a0e27[_0xa9bd('0x16')]['hasOwnProperty'](_0x47905c)){_0x3a0e27[_0xa9bd('0x43')](_0x47905c);}}};Preview['prototype'][_0xa9bd('0x42')]=function(_0x38bada){var _0x20f9cc=this;rpcDb[_0xa9bd('0x58')](_0x38bada['id'],ut[_0xa9bd('0x59')](this[_0xa9bd('0x17')]))['then'](function(_0x92c43c){if(!_[_0xa9bd('0x5a')](_0x92c43c)){for(var _0x56d736=0x0;_0x56d736<_0x92c43c[_0xa9bd('0x5b')];_0x56d736+=0x1){if(ut[_0xa9bd('0x5c')](_0x92c43c[_0x56d736][_0xa9bd('0x5d')])<_0x38bada['dialRecallMeTimeout']*0x3c){if(_0x92c43c[_0x56d736][_0xa9bd('0x5e')]&&!_0x92c43c[_0x56d736][_0xa9bd('0x5e')]['voicePause']){_0x20f9cc[_0xa9bd('0x5f')](_0x92c43c[_0x56d736]['id'])[_0xa9bd('0x60')](ut[_0xa9bd('0x61')](_0xa9bd('0x62')))[_0xa9bd('0x50')](ut[_0xa9bd('0x61')](_0xa9bd('0x62')));}else{rpcDb[_0xa9bd('0x63')](_0x92c43c[_0x56d736]['id']);}}else{var _0x141070=new Action(_0x92c43c[_0x56d736],_0x38bada);_0x141070[_0xa9bd('0x64')]=moment()[_0xa9bd('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x38bada['outboundReCallsDay']+=0x1;ut[_0xa9bd('0x65')](_0x141070,0x17,_0xa9bd('0x66'));if(_0x38bada[_0xa9bd('0x67')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x92c43c[_0x56d736]));rpcDb[_0xa9bd('0x68')](_0x141070,_0xa9bd('0x69'));}else{ut['logCustomer'](_0x141070,0x16,'RecallFailedTimeout');rpcDb[_0xa9bd('0x68')](_0x141070,_0xa9bd('0x6a'));rpcDb[_0xa9bd('0x6b')](_0x141070,'[HistoryRecallClose]');}}}}})[_0xa9bd('0x50')](ut[_0xa9bd('0x61')](_0xa9bd('0x6c')));};Preview[_0xa9bd('0xf')][_0xa9bd('0x40')]=function(_0x3a2f34){_0x3a2f34[_0xa9bd('0x2c')]=!![];if(ut[_0xa9bd('0x6d')](_0x3a2f34[_0xa9bd('0x6e')])){_0x3a2f34['message']=utils[_0xa9bd('0x33')][_0xa9bd('0x6f')];}else if(!ut[_0xa9bd('0x70')](_0x3a2f34[_0xa9bd('0x3f')])){_0x3a2f34[_0xa9bd('0x32')]=utils[_0xa9bd('0x33')][_0xa9bd('0x30')];}else if(!this[_0xa9bd('0x71')](_0x3a2f34[_0xa9bd('0x72')])){if(!this[_0xa9bd('0x71')](_0x3a2f34[_0xa9bd('0x73')])){_0x3a2f34[_0xa9bd('0x32')]=utils[_0xa9bd('0x33')][_0xa9bd('0x74')];}else{_0x3a2f34[_0xa9bd('0x32')]=utils[_0xa9bd('0x33')][_0xa9bd('0x75')];}}else{_0x3a2f34[_0xa9bd('0x32')]=utils['CAMPAIGN_STATUS'][_0xa9bd('0x75')];}};Preview['prototype'][_0xa9bd('0x76')]=function(_0x118256,_0x476967,_0xd4ec6d){var _0x56d7e9=this;var _0x4e0800=this[_0xa9bd('0x16')][_0x476967];var _0x4b0e07=this[_0xa9bd('0x24')][_0x4e0800[_0xa9bd('0x45')]];var _0x54d23b;var _0x482a17=![];var _0x3f9c9c=0x2;var _0x207a11=0x3;if(_0x4b0e07){switch(_0xd4ec6d){case'1':_0x4b0e07[_0xa9bd('0x77')]+=0x1;_0x4e0800[_0xa9bd('0x78')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut[_0xa9bd('0x65')](_0x4e0800,0x0,_0xa9bd('0x7b'));ami[_0xa9bd('0x2b')](_0xa9bd('0x7c'),ut['buildObj'](_0x4e0800,_0xa9bd('0x7d')));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0x7e'));_0x56d7e9['verifyAdditionalPhones'](_0x4e0800,'0',_0x4b0e07)['then'](function(_0x4ef512){_0x482a17=_0x4ef512[_0xa9bd('0x7f')]==0x1;_0x3f9c9c=_0x4b0e07[_0xa9bd('0x80')];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut['cloneAction'](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0x84'));}else{if(_0x4e0800[_0xa9bd('0x78')]>=_0x4b0e07[_0xa9bd('0x85')]){rpcDb['createCustomerFinal'](_0x4e0800,_0xa9bd('0x84'));}else{rpcDb['rescheduleContact'](ut[_0xa9bd('0x86')](_0x4e0800,_0xa9bd('0x78'),_0x4b0e07['dialNoSuchNumberRetryFrequency']),_0x4e0800[_0xa9bd('0x87')],_0x4e0800[_0xa9bd('0x88')]);}}delete this[_0xa9bd('0x16')][_0x118256[_0xa9bd('0x89')]];}else{_0x4e0800[_0xa9bd('0x78')]++;logger[_0xa9bd('0x25')]('actioncountonusuch',_0x4e0800[_0xa9bd('0x78')]);logger[_0xa9bd('0x25')]('id',_0x4e0800['idContact']);_0x56d7e9['incrementPreviewCounters']({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countnosuchnumberretry':_0x4e0800['countnosuchnumberretry']}})[_0xa9bd('0x60')](function(){_0x56d7e9['swapAdditionalPhones'](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case _0xa9bd('0x8b'):var _0x29028f=moment()[_0xa9bd('0x27')](_0xa9bd('0x8c'));_0x4e0800[_0xa9bd('0x8d')]=_0x29028f;_0x4e0800[_0xa9bd('0x8e')]=_0x29028f;_0x4e0800[_0xa9bd('0x8f')]=!![];_0x4b0e07['pTalking']+=0x1;logger[_0xa9bd('0x25')]('[syncHangup][talking][increment]',_0x4e0800[_0xa9bd('0x90')],_0xa9bd('0x91'),_0x4b0e07[_0xa9bd('0x29')],_0xa9bd('0x48'),_0x4b0e07['pTalking']);ami[_0xa9bd('0x2b')](_0xa9bd('0x92'),ut['buildObj'](_0x4e0800,'connect',this[_0xa9bd('0x24')][_0x4e0800[_0xa9bd('0x45')]]));if(_0x4b0e07[_0xa9bd('0x93')]){ami[_0xa9bd('0x2b')](_0xa9bd('0x94'),ut[_0xa9bd('0x95')](_0x4e0800));}break;case'16':ami['emit'](_0xa9bd('0x96'),ut[_0xa9bd('0x97')](_0x4e0800,_0xa9bd('0x98'),this[_0xa9bd('0x24')][_0x4e0800[_0xa9bd('0x45')]]));emitVoiceQueueChannelRemove(ut[_0xa9bd('0x97')](_0x4e0800,_0xa9bd('0x98')));_0x4b0e07[_0xa9bd('0x99')]+=0x1;_0x4b0e07['total']+=0x1;_0x4b0e07['answered']+=0x1;ut['decrementTalkink'](_0x4b0e07,_0xa9bd('0x9a'));_0x4e0800[_0xa9bd('0x79')]=ut['totalGlobal'](_0x4e0800);ut['logCustomer'](_0x4e0800,0x4,_0xa9bd('0x9b'));rpcDb[_0xa9bd('0x68')](_0x4e0800,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0x9c'));rpcDb[_0xa9bd('0x9d')](_0x4e0800);_0x4b0e07['sumDuration']+=_0x4e0800[_0xa9bd('0x9e')];_0x4b0e07[_0xa9bd('0x9f')]+=_0x4e0800[_0xa9bd('0x9e')];logger['info'](_0xa9bd('0xa0'),_0x4e0800[_0xa9bd('0x90')],'\x20Queue',_0x4b0e07[_0xa9bd('0x29')],_0xa9bd('0x48'),_0x4b0e07['pTalking']);delete this['actions'][_0x118256[_0xa9bd('0x89')]];break;case _0xa9bd('0xa1'):_0x4b0e07[_0xa9bd('0xa2')]+=0x1;_0x4e0800[_0xa9bd('0xa3')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut['logCustomer'](_0x4e0800,0x5,_0xa9bd('0xa4'));_0x3f9c9c=_0x4b0e07['dialBusyRetryFrequency'];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];ami['emit'](_0xa9bd('0xa5'),ut[_0xa9bd('0x97')](_0x4e0800,_0xa9bd('0xa6')));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xa7'));_0x56d7e9['verifyAdditionalPhones'](_0x4e0800,'5',_0x4b0e07)[_0xa9bd('0x60')](function(_0x1449f6){_0x482a17=_0x1449f6['additional']==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07['dialGlobalMaxRetry']){_0x54d23b=ut[_0xa9bd('0xa8')](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb['createCustomerFinal'](_0x54d23b,_0xa9bd('0xa9'));}else{if(_0x4e0800[_0xa9bd('0xa3')]>=_0x4b0e07[_0xa9bd('0xaa')]){rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xa7'));}else{rpcDb[_0xa9bd('0xab')](ut['scheduledAt'](_0x4e0800,'countbusyretry',_0x4b0e07['dialBusyRetryFrequency']),_0x4e0800[_0xa9bd('0x87')],_0x4e0800[_0xa9bd('0x88')]);}}}else{_0x4e0800[_0xa9bd('0xa3')]++;_0x56d7e9[_0xa9bd('0xac')]({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countbusyretry':_0x4e0800[_0xa9bd('0xa3')]}})[_0xa9bd('0x60')](function(){_0x56d7e9[_0xa9bd('0xad')](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case _0xa9bd('0xae'):_0x4b0e07[_0xa9bd('0xaf')]+=0x1;_0x4e0800[_0xa9bd('0xb0')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut['logCustomer'](_0x4e0800,0x3,_0xa9bd('0xb1'));_0x3f9c9c=_0x4b0e07['dialNoAnswerRetryFrequency'];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];var _0x172e0d=ut[_0xa9bd('0xb2')](_0x4e0800,_0x4b0e07);ami['emit']('custom:agentnoanswer',_0x172e0d);rpcDb['createCustomerHistory'](_0x4e0800,_0xa9bd('0xb3'));_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'3',_0x4b0e07)[_0xa9bd('0x60')](function(_0x2eee1a){_0x482a17=_0x2eee1a[_0xa9bd('0x7f')]==0x1;if(!_0x482a17){if(ut['totalGlobal'](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut['cloneAction'](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x4e0800['countnoanswerretry']>=_0x4b0e07[_0xa9bd('0xb5')]){rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xb3'));}else{rpcDb[_0xa9bd('0xab')](ut[_0xa9bd('0x86')](_0x4e0800,'countnoanswerretry',_0x4b0e07['dialNoAnswerRetryFrequency']),_0x4e0800[_0xa9bd('0x87')],_0x4e0800['activeContact']);}}}else{_0x4e0800[_0xa9bd('0xb0')]++;_0x56d7e9[_0xa9bd('0xac')]({'id':_0x4e0800['idContact'],'field':{'countnoanswerretry':_0x4e0800[_0xa9bd('0xb0')]}})[_0xa9bd('0x60')](function(){_0x56d7e9['swapAdditionalPhones'](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case _0xa9bd('0xb6'):_0x4b0e07[_0xa9bd('0xb7')]+=0x1;_0x4e0800[_0xa9bd('0xb8')]+=0x1;_0x4e0800['countglobal']=ut['totalGlobal'](_0x4e0800);ut['logCustomer'](_0x4e0800,0x8,_0xa9bd('0xb9'));_0x3f9c9c=_0x4b0e07[_0xa9bd('0xba')];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];ami[_0xa9bd('0x2b')](_0xa9bd('0xbb'),ut[_0xa9bd('0x97')](_0x4e0800,_0xa9bd('0xbc')));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xbd'));_0x56d7e9['verifyAdditionalPhones'](_0x4e0800,'8',_0x4b0e07)[_0xa9bd('0x60')](function(_0x22bcc5){_0x482a17=_0x22bcc5['additional']==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut['cloneAction'](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0xbe'));}else{if(_0x4e0800[_0xa9bd('0xb8')]>=_0x4b0e07[_0xa9bd('0xbf')]){rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xbd'));}else{rpcDb[_0xa9bd('0xab')](ut[_0xa9bd('0x86')](_0x4e0800,_0xa9bd('0xb8'),_0x4b0e07['dialBusyRetryFrequency']),_0x4e0800[_0xa9bd('0x87')],_0x4e0800[_0xa9bd('0x88')]);}}}else{_0x4e0800['countcongestionretry']++;_0x56d7e9[_0xa9bd('0xac')]({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countcongestionretry':_0x4e0800[_0xa9bd('0xb8')]}})['then'](function(){_0x56d7e9[_0xa9bd('0xad')](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case _0xa9bd('0xc0'):_0x4b0e07[_0xa9bd('0xc1')]+=0x1;_0x4e0800[_0xa9bd('0xc2')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut['logCustomer'](_0x4e0800,0x14,'AgentReject');_0x3f9c9c=_0x4b0e07['dialAgentRejectRetryFrequency'];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];ami['emit'](_0xa9bd('0xc3'),ut[_0xa9bd('0x97')](_0x4e0800,'agentreject'));rpcDb[_0xa9bd('0x68')](_0x4e0800,'[syncHangupRequest][logAgentReject]');_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'20',_0x4b0e07)['then'](function(_0x4b3d18){_0x482a17=_0x4b3d18[_0xa9bd('0x7f')]==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut[_0xa9bd('0xa8')](_0x4e0800,0x14,'AgentReject');rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0xc4'));}else{if(_0x4e0800['countagentrejectretry']>=_0x4b0e07['dialAgentRejectMaxRetry']){rpcDb[_0xa9bd('0x6b')](_0x4e0800,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xa9bd('0xab')](ut[_0xa9bd('0x86')](_0x4e0800,_0xa9bd('0xc2'),_0x4b0e07[_0xa9bd('0xc5')]),_0x4e0800[_0xa9bd('0x87')],_0x4e0800[_0xa9bd('0x88')]);}}}else{_0x4e0800[_0xa9bd('0xb0')]++;_0x56d7e9[_0xa9bd('0xac')]({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countnoanswerretry':_0x4e0800[_0xa9bd('0xb0')]}})[_0xa9bd('0x60')](function(){_0x56d7e9[_0xa9bd('0xad')](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case'ABANDONED':_0x4b0e07['outboundAbandonedCallsDay']+=0x1;_0x4e0800[_0xa9bd('0xc6')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut[_0xa9bd('0x65')](_0x4e0800,0xb,_0xa9bd('0xc7'));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xc8'));_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'11',_0x4b0e07)[_0xa9bd('0x60')](function(_0x35447d){_0x482a17=_0x35447d['additional']==0x1;if(!_0x482a17){if(ut['totalGlobal'](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut['cloneAction'](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0xc8'));}else{if(_0x4e0800[_0xa9bd('0xc9')]>=_0x4b0e07[_0xa9bd('0xca')]){rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xc8'));}else{rpcDb['rescheduleContact'](ut[_0xa9bd('0x86')](_0x4e0800,_0xa9bd('0xc6'),_0x4b0e07['dialAbandonedRetryFrequency']),_0x4e0800['unlockAgent'],_0x4e0800[_0xa9bd('0x88')]);}}}else{_0x4e0800[_0xa9bd('0xb0')]++;_0x56d7e9[_0xa9bd('0xac')]({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countnoanswerretry':_0x4e0800[_0xa9bd('0xb0')]}})['then'](function(){_0x56d7e9['swapAdditionalPhones'](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});break;case'18':_0x4b0e07[_0xa9bd('0xcb')]+=0x1;_0x4e0800[_0xa9bd('0xcc')]+=0x1;_0x4e0800['countglobal']=ut[_0xa9bd('0x7a')](_0x4e0800);ut[_0xa9bd('0x65')](_0x4e0800,0x12,_0x118256['cause-txt']||_0x118256[_0xa9bd('0xcd')]);ami[_0xa9bd('0x2b')](_0xa9bd('0xce'),ut[_0xa9bd('0x97')](_0x4e0800,_0xa9bd('0xcf')));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xd0'));_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'18',_0x4b0e07)[_0xa9bd('0x60')](function(_0x2fe5bb){_0x482a17=_0x2fe5bb[_0xa9bd('0x7f')]==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut[_0xa9bd('0xa8')](_0x4e0800,0x12,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0xd0'));}else{rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xd0'));}}else{_0x4e0800['countnoanswerretry']++;_0x56d7e9['incrementPreviewCounters']({'id':_0x4e0800[_0xa9bd('0x8a')],'field':{'countnoanswerretry':_0x4e0800[_0xa9bd('0xb0')]}})[_0xa9bd('0x60')](function(){_0x56d7e9['swapAdditionalPhones'](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});delete this[_0xa9bd('0x16')][_0x118256['linkedid']];break;case'19':_0x4b0e07[_0xa9bd('0xcb')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut[_0xa9bd('0x7a')](_0x4e0800);ut['logCustomer'](_0x4e0800,0x13,_0x118256[_0xa9bd('0xd1')]||_0x118256[_0xa9bd('0xcd')]);ami[_0xa9bd('0x2b')]('custom:amd',ut[_0xa9bd('0x97')](_0x4e0800,'amd'));rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xd2'));_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'18',_0x4b0e07)[_0xa9bd('0x60')](function(_0x27f75d){_0x482a17=_0x27f75d['additional']==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut[_0xa9bd('0xa8')](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb['createCustomerFinal'](_0x54d23b,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xa9bd('0x6b')](_0x4e0800,_0xa9bd('0xd2'));}}else{_0x4e0800[_0xa9bd('0xb0')]++;_0x56d7e9['incrementPreviewCounters']({'id':_0x4e0800['idContact'],'field':{'countnoanswerretry':_0x4e0800[_0xa9bd('0xb0')]}})[_0xa9bd('0x60')](function(){_0x56d7e9[_0xa9bd('0xad')](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});});}});delete this['actions'][_0x118256[_0xa9bd('0x89')]];break;default:if(_0x4e0800['dialAnswer']){ut[_0xa9bd('0x54')](_0x4b0e07,'[default]');ut[_0xa9bd('0x55')](_0xa9bd('0xd3')+_0x4b0e07[_0xa9bd('0x29')],_0x118256);}_0x4b0e07[_0xa9bd('0xcb')]+=0x1;_0x4e0800[_0xa9bd('0x79')]=ut['totalGlobal'](_0x4e0800);ut[_0xa9bd('0x65')](_0x4e0800,0xc,_0x118256[_0xa9bd('0xd1')]||_0x118256['dialstatus']);_0x3f9c9c=_0x4b0e07[_0xa9bd('0xc5')];_0x207a11=_0x4b0e07[_0xa9bd('0x81')];rpcDb[_0xa9bd('0x68')](_0x4e0800,_0xa9bd('0xd4'));_0x56d7e9[_0xa9bd('0xb4')](_0x4e0800,'20',_0x4b0e07)['then'](function(_0x58f22a){_0x482a17=_0x58f22a[_0xa9bd('0x7f')]==0x1;if(!_0x482a17){if(ut[_0xa9bd('0x7a')](_0x4e0800)>=_0x4b0e07[_0xa9bd('0x82')]){_0x54d23b=ut[_0xa9bd('0xa8')](_0x4e0800,0xf,_0xa9bd('0x83'));rpcDb[_0xa9bd('0x6b')](_0x54d23b,_0xa9bd('0xd5'));}else{rpcDb[_0xa9bd('0x6b')](_0x4e0800,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x118256[_0xa9bd('0x89')]];}else{_0x56d7e9[_0xa9bd('0xad')](_0x4e0800,_0x3f9c9c,_0x207a11)[_0xa9bd('0x60')](function(){});}});}if(!(_0x4e0800[_0xa9bd('0x8f')]&&_0xd4ec6d==='16')){ut[_0xa9bd('0x52')](_0x4b0e07,_0xa9bd('0xd6'));logger[_0xa9bd('0x25')](_0xa9bd('0xd7'),_0x4e0800['uniqueid'],_0xa9bd('0x91'),_0x4b0e07[_0xa9bd('0x29')],_0xa9bd('0x46'),_0x4b0e07['originated']);}if(_0xd4ec6d!==_0xa9bd('0x8b')){delete this[_0xa9bd('0x16')][_0x118256[_0xa9bd('0x89')]];delete this[_0xa9bd('0x16')][_0x118256['destlinkedid']];}_0x4b0e07[_0xa9bd('0xd8')]=!![];}};Preview['prototype'][_0xa9bd('0xd9')]=function(_0xc03c85,_0x1e2652,_0x2a1613){if(_[_0xa9bd('0xda')](_0x1e2652)&&_0xa9bd('0xdb')!==typeof _0x1e2652){return;}if(_['isUndefined'](_0x2a1613)&&_0xa9bd('0xdb')!==typeof _0x2a1613){return;}switch(_0x2a1613[_0xa9bd('0xdc')]){case'0':ut[_0xa9bd('0xdd')](_0xc03c85,0x0,_0xa9bd('0x7b'));rpcDb['createAgentHistory'](_0xc03c85,_0xa9bd('0xde'));break;case'3':ut['logAgent'](_0xc03c85,0x3,'NoAnswer');rpcDb[_0xa9bd('0xdf')](_0xc03c85,_0xa9bd('0xe0'));break;case'5':ut[_0xa9bd('0xdd')](_0xc03c85,0x5,_0xa9bd('0xa4'));rpcDb[_0xa9bd('0xdf')](_0xc03c85,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0xc03c85,0x8,_0xa9bd('0xb9'));rpcDb[_0xa9bd('0xdf')](_0xc03c85,_0xa9bd('0xe1'));break;case'22':ut[_0xa9bd('0xdd')](_0xc03c85,0x16,_0xa9bd('0xe2'));rpcDb['createAgentHistory'](_0xc03c85,_0xa9bd('0xe3'));break;default:ut['logAgent'](_0xc03c85,0xc,_0x2a1613['reason']);rpcDb[_0xa9bd('0xdf')](_0xc03c85,_0xa9bd('0xe1'));}ut[_0xa9bd('0x52')](_0x1e2652,_0xa9bd('0xe4'));logger[_0xa9bd('0x25')]('[originated][decrement][callProgressDetectingAgent]',_0xc03c85['uniqueid'],_0xa9bd('0x91'),_0x1e2652[_0xa9bd('0x29')],_0xa9bd('0x46'),_0x1e2652[_0xa9bd('0x2d')]);delete this['actions'][_0xc03c85['uniqueid']];};Preview[_0xa9bd('0xf')][_0xa9bd('0xb4')]=function(_0x57724f,_0x5b1914,_0x729499){return cmHopperAdditionalPhone[_0xa9bd('0xb4')](_0x57724f,_0x5b1914,_0x729499)[_0xa9bd('0x50')](logger[_0xa9bd('0x25')]('[verifyAdditionalPhone]\x20'));};Preview[_0xa9bd('0xf')]['swapAdditionalPhones']=function(_0x48b103,_0x2f8bb0,_0xcea7f7){return cmHopperAdditionalPhone[_0xa9bd('0xad')](_0x48b103,_0x2f8bb0,_0xcea7f7)['catch'](logger['info'](_0xa9bd('0xe5')));};Preview[_0xa9bd('0xf')]['incrementPreviewCounters']=function(_0x5ee139){return Promise[_0xa9bd('0xe6')]()['then'](cmHopperAdditionalPhone[_0xa9bd('0xac')](_0x5ee139))['catch'](logger[_0xa9bd('0x25')](_0xa9bd('0xe7')));};Preview[_0xa9bd('0xf')][_0xa9bd('0xe8')]=function(_0x1a789d,_0x423796,_0x22ccb0,_0x4bf128,_0x3ea8a2){var _0x189643=this;return new Promise(function(_0x4351b5,_0x1c295d){if(_['isNil'](_0x423796)||_['isNil'](_0x423796['Contact'])||_['isNil'](_0x423796['phone'])||_[_0xa9bd('0x5a')](_0x423796[_0xa9bd('0x4c')])){_0x1c295d(ut['message'](_0xa9bd('0xe9'),_0x4bf128,_0x3ea8a2));return;}var _0x40a9dc=uuid['v4']();var _0x55478a=_0x189643[_0xa9bd('0x24')][_0x423796[_0xa9bd('0xea')][_0xa9bd('0x29')]];var _0x13ec55=_0x22ccb0?_0x189643[_0xa9bd('0x17')][_0x22ccb0]['id']:undefined;_0x189643['actions'][_0x40a9dc]=new Action(_0x423796,_0x55478a,_0x40a9dc,_0x22ccb0,_0x13ec55);var _0x262337=_0x189643[_0xa9bd('0x16')][_0x40a9dc];_0x262337['unlockAgent']=_0x4bf128;_0x262337[_0xa9bd('0x88')]=_0x3ea8a2;_0x262337['lookAgent']=_0x22ccb0;if(_['isEmpty'](_0x1a789d)){_0x189643[_0xa9bd('0xeb')](_0x262337,_0x55478a,_0x423796,_0x22ccb0)[_0xa9bd('0x60')](function(_0xedc181){logger[_0xa9bd('0x25')](_0xa9bd('0xec'),_0xa9bd('0xed')+_0x262337[_0xa9bd('0x45')]+'\x20IdHopper:\x20'+_0x262337[_0xa9bd('0x8a')],JSON[_0xa9bd('0x47')](_0xedc181));ami['emit'](_0xa9bd('0xee'),ut[_0xa9bd('0x97')](_0x262337,_0xa9bd('0xef'),_0x189643[_0xa9bd('0x24')][_0x262337[_0xa9bd('0x45')]]));_0x4351b5(ut[_0xa9bd('0x32')](_0xa9bd('0xf0')));})[_0xa9bd('0x50')](function(_0x596dce){ut[_0xa9bd('0x31')](_0xa9bd('0xf1'),_0x596dce);_0x1c295d(ut[_0xa9bd('0x32')](_0xa9bd('0xf2'),_0x4bf128,_0x3ea8a2));});}else{_0x55478a[_0xa9bd('0xf3')]+=0x1;ut['logBlacklist'](_0x262337);rpcDb[_0xa9bd('0xf4')](_0x262337,'[Blacklist][error]');delete _0x189643[_0xa9bd('0x16')][_0x40a9dc];_0x1c295d(ut[_0xa9bd('0x32')](_0xa9bd('0xf5'),_0x4bf128,_0x3ea8a2));}});};Preview[_0xa9bd('0xf')][_0xa9bd('0x71')]=function(_0x3712b6){return!_[_0xa9bd('0x5a')](_0x3712b6)&&!_['isNil'](_0x3712b6[_0xa9bd('0x29')])&&!_[_0xa9bd('0x5a')](_0x3712b6[_0xa9bd('0xf6')])&&_0x3712b6['active']&&!_[_0xa9bd('0x5a')](this[_0xa9bd('0x15')][util[_0xa9bd('0x27')](_0xa9bd('0xf7'),_0x3712b6['name'])])&&!_['isNil'](this[_0xa9bd('0x15')][util['format']('SIP/%s',_0x3712b6['name'])][_0xa9bd('0xf8')])&&(this[_0xa9bd('0x15')][util['format']('SIP/%s',_0x3712b6[_0xa9bd('0x29')])]['status']==='reachable'||this[_0xa9bd('0x15')][util[_0xa9bd('0x27')](_0xa9bd('0xf7'),_0x3712b6[_0xa9bd('0x29')])][_0xa9bd('0xf8')]===_0xa9bd('0xf9'));};Preview[_0xa9bd('0xf')][_0xa9bd('0x5f')]=function(_0x22dcda,_0x3c5e91){return this[_0xa9bd('0xfa')](_0x22dcda,_0x3c5e91)['then'](function(_0x2647f8){return _[_0xa9bd('0x4a')](_0x2647f8,[_0xa9bd('0x32')]);})[_0xa9bd('0x50')](function(_0x13c8a3){if(_0x13c8a3[_0xa9bd('0xfb')]){rpcDb['unlockContact'](_0x22dcda);}if(_0x13c8a3[_0xa9bd('0xf6')]){rpcDb[_0xa9bd('0x63')](_0x22dcda);}throw _['pick'](_0x13c8a3,['message']);});};Preview['prototype'][_0xa9bd('0xfa')]=function(_0x3ca013,_0xe25d1e){var _0x296d52=this;var _0xa5c3b6,_0x34ba0f;return rpcDb[_0xa9bd('0xfc')](_0x3ca013)[_0xa9bd('0x60')](function(_0xfa93b0){if(!_[_0xa9bd('0x5a')](_0xfa93b0[0x0])){_0x34ba0f=_0xfa93b0[0x0][_0xa9bd('0xfd')]?![]:!![];_0xa5c3b6=_0xfa93b0[0x0]['recallme']?!![]:![];_0xa5c3b6=_0xe25d1e?!![]:_0xa5c3b6;}var _0x326667=_0x296d52['validateContact'](_0xfa93b0);if(_0x326667[_0xa9bd('0xfe')]){rpcDb['checkIsBlackList'](_[_0xa9bd('0x4a')](_0xfa93b0[0x0],['VoiceQueueId',_0xa9bd('0xff')]))[_0xa9bd('0x60')](function(_0x146f8b){_0x296d52[_0xa9bd('0xe8')](_0x146f8b,_0xfa93b0[0x0],_0xe25d1e,_0x34ba0f,_0xa5c3b6)[_0xa9bd('0x60')](function(_0x1635e2){return _0x1635e2;})['catch'](function(_0x29c220){throw _0x29c220;});})[_0xa9bd('0x50')](function(_0x513252){ut[_0xa9bd('0x31')]('[Preview][checkIsBlackList]',_0x513252);throw ut[_0xa9bd('0x32')]('Call\x20unsuccessful',_0x34ba0f,_0xa5c3b6);});}else{throw ut[_0xa9bd('0x32')](_0x326667['message'],_0x34ba0f,_0xa5c3b6);}})['catch'](function(_0x23c83d){ut[_0xa9bd('0x31')](_0xa9bd('0x100'),_0x23c83d);throw ut[_0xa9bd('0x32')](_0xa9bd('0x101'),![],!![]);});};Preview[_0xa9bd('0xf')][_0xa9bd('0x102')]=function(_0x1e818c){if(_[_0xa9bd('0x5a')](_0x1e818c)||_['isEmpty'](_0x1e818c)||!_[_0xa9bd('0x5a')](_0x1e818c[0x0]['Agent'])&&_['isNil'](_0x1e818c[0x0][_0xa9bd('0x5e')][_0xa9bd('0x29')])){ut['logger'](_0xa9bd('0x103'),_0x1e818c);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2dd9b5=this['campaignsPreview'][_0x1e818c[0x0][_0xa9bd('0xea')]['name']];_0x2dd9b5[_0xa9bd('0x32')]=utils['CAMPAIGN_STATUS'][_0xa9bd('0x75')];if(_[_0xa9bd('0x5a')](_0x2dd9b5)){ut[_0xa9bd('0x31')](_0xa9bd('0x104'),_0x2dd9b5);return{'isValid':![],'message':_0xa9bd('0x105')};}if(!this[_0xa9bd('0x71')](_0x2dd9b5[_0xa9bd('0x72')])){ut[_0xa9bd('0x31')](_0xa9bd('0x106'),_0xa9bd('0x107')+_0x2dd9b5[_0xa9bd('0x29')]+_0xa9bd('0x108'));if(!this[_0xa9bd('0x71')](_0x2dd9b5['TrunkBackup'])){ut[_0xa9bd('0x31')](_0xa9bd('0x106'),_0x2dd9b5[_0xa9bd('0x29')]+_0xa9bd('0x109'));return{'isValid':![],'message':_0xa9bd('0x10a')};}}if(!ut[_0xa9bd('0x70')](_0x2dd9b5[_0xa9bd('0x3f')])){ut[_0xa9bd('0x31')](_0xa9bd('0x10b'),_0x2dd9b5[_0xa9bd('0x29')]+_0xa9bd('0x10c'));return{'isValid':![],'message':_0xa9bd('0x107')+_0x2dd9b5[_0xa9bd('0x29')]+_0xa9bd('0x10c')};}return{'isValid':!![],'message':_0xa9bd('0x10d')};};Preview[_0xa9bd('0xf')]['execCall']=function(_0xf7ec7c,_0x2c578a,_0x4cd963,_0x247333){var _0x419084=this;return new Promise(function(_0x542d82,_0x592738){var _0x36346c=_0xf7ec7c[_0xa9bd('0x90')];var _0x447422=_0x419084[_0xa9bd('0x71')](_0x2c578a[_0xa9bd('0x72')])?util[_0xa9bd('0x27')](_0xa9bd('0x10e'),_0x2c578a[_0xa9bd('0x72')][_0xa9bd('0x29')],_[_0xa9bd('0x5a')](_0x2c578a[_0xa9bd('0x10f')])?'':_0x2c578a[_0xa9bd('0x10f')]['trim']()||'',_0x2c578a[_0xa9bd('0x110')]>0x0?_0x4cd963[_0xa9bd('0xff')][_0xa9bd('0x111')](_0x2c578a[_0xa9bd('0x110')]):_0x4cd963['phone']):util[_0xa9bd('0x27')]('SIP/%s/%s%s',_[_0xa9bd('0x5a')](_0x2c578a['TrunkBackup'])?_0x2c578a['Trunk']['name']:_0x2c578a[_0xa9bd('0x73')][_0xa9bd('0x29')],_[_0xa9bd('0x5a')](_0x2c578a[_0xa9bd('0x10f')])?'':_0x2c578a[_0xa9bd('0x10f')][_0xa9bd('0x112')]()||'',_0x2c578a[_0xa9bd('0x110')]>0x0?_0x4cd963[_0xa9bd('0xff')]['substring'](_0x2c578a[_0xa9bd('0x110')]):_0x4cd963[_0xa9bd('0xff')]);var _0x2ee7cc=_0x419084[_0xa9bd('0x71')](_0x2c578a[_0xa9bd('0x72')])?ut[_0xa9bd('0x113')](_0x2c578a[_0xa9bd('0x72')]['callerid'],_0x2c578a[_0xa9bd('0x114')],_0x2c578a[_0xa9bd('0x115')]>0x0?ut[_0xa9bd('0x116')](_0x2c578a['dialOriginateCallerIdNumber'],_0x2c578a['dialRandomLastDigitCallerIdNumber']):_0x2c578a['dialOriginateCallerIdNumber']):ut[_0xa9bd('0x113')](_[_0xa9bd('0x5a')](_0x2c578a[_0xa9bd('0x73')])?_0x2c578a[_0xa9bd('0x72')][_0xa9bd('0x117')]:_0x2c578a[_0xa9bd('0x73')]['callerid'],_0x2c578a[_0xa9bd('0x114')],_0x2c578a['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x2c578a[_0xa9bd('0x118')],_0x2c578a['dialRandomLastDigitCallerIdNumber']):_0x2c578a[_0xa9bd('0x118')]);if(_0x2ee7cc){_0xf7ec7c[_0xa9bd('0x119')]=ut[_0xa9bd('0x11a')](_0x2ee7cc);_0xf7ec7c[_0xa9bd('0x11b')]=ut['extractCalleridNumber'](_0x2ee7cc);}var _0x5d6db7=ut['addVariables'](_0x2c578a,_0x4cd963,_0x447422,_0x2ee7cc,_0x36346c,_0xf7ec7c);var _0x13557d=utils[_0xa9bd('0x11c')](_0x4cd963['Contact']);Object[_0xa9bd('0x11d')](_0x5d6db7,_0x13557d);_[_0xa9bd('0x11e')](_0xf7ec7c,ut[_0xa9bd('0x11f')](_0x5d6db7));_0xf7ec7c[_0xa9bd('0x64')]=moment()[_0xa9bd('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c578a[_0xa9bd('0x120')]=_0x5d6db7;var _0x2f8352=ut[_0xa9bd('0x121')](_0xf7ec7c,_0x2c578a,_0x5d6db7,_0xf7ec7c['activeContact'],_0x247333);return ami[_0xa9bd('0x4e')](_0x2f8352)[_0xa9bd('0x60')](function(_0x25fbd4){_0x2c578a['originated']+=0x1;logger[_0xa9bd('0x25')](_0xa9bd('0x122'),_0x36346c,'\x20Queue',_0x2c578a['name'],_0xa9bd('0x46'),_0x2c578a[_0xa9bd('0x2d')]);_0x542d82(_0x25fbd4);})[_0xa9bd('0x50')](function(_0x1ed030){ut['logAgent'](_0xf7ec7c,0xe,_0xa9bd('0x123'));rpcDb[_0xa9bd('0xdf')](_0xf7ec7c,'[originateFailure][logOriginateFailure]');_0x592738(_0x1ed030);});});};Preview['prototype'][_0xa9bd('0x124')]=function(_0x43ae11){if(this[_0xa9bd('0x16')][_0x43ae11[_0xa9bd('0x89')]]){this[_0xa9bd('0x16')][_0x43ae11[_0xa9bd('0x89')]][_0xa9bd('0x4f')]=_0x43ae11[_0xa9bd('0x4f')];}};Preview[_0xa9bd('0xf')][_0xa9bd('0x125')]=function(_0x2bc51e){var _0x180dac=this;var _0x5c9c26=this[_0xa9bd('0x16')][_0x2bc51e['actionid']];if(_0x5c9c26){if(_0x5c9c26[_0xa9bd('0x126')]&&this[_0xa9bd('0x17')][_0x5c9c26['lookAgent']]){ut['logLookAgent'](_0x5c9c26,this[_0xa9bd('0x17')][_0x5c9c26['lookAgent']][_0xa9bd('0x29')],this[_0xa9bd('0x17')][_0x5c9c26['lookAgent']]['id']);}var _0x21589b=_['clone'](_0x5c9c26);_0x21589b[_0xa9bd('0x8d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x5a051a=_0x180dac[_0xa9bd('0x24')][_0x5c9c26['queue']];if(ut[_0xa9bd('0x127')](_0x2bc51e[_0xa9bd('0x128')])){if(_0x5c9c26[_0xa9bd('0x87')]){rpcDb['unlockContact'](_0x5c9c26[_0xa9bd('0x8a')]);}if(_0x5c9c26[_0xa9bd('0x88')]){rpcDb[_0xa9bd('0x63')](_0x5c9c26[_0xa9bd('0x8a')]);}ami[_0xa9bd('0x2b')]('custom:agentringnoanswer',ut[_0xa9bd('0x97')](_0x5c9c26,_0xa9bd('0x129'),this[_0xa9bd('0x24')][_0x5c9c26[_0xa9bd('0x45')]]));this['callProgressDetectingAgent'](_0x21589b,_0x5a051a,_0x2bc51e);}else{_0x5c9c26[_0xa9bd('0x64')]=moment()['format'](_0xa9bd('0x8c'));ut[_0xa9bd('0xdd')](_0x21589b,0x4,_0xa9bd('0x9b'));rpcDb[_0xa9bd('0xdf')](_0x21589b,_0xa9bd('0x12a'));}}};Preview[_0xa9bd('0xf')][_0xa9bd('0x1a')]=function(_0x53ea2b){var _0x19aec8=this[_0xa9bd('0x16')][_0x53ea2b['linkedid']];var _0x218e13;if(_0x19aec8){_0x218e13=this[_0xa9bd('0x24')][_0x19aec8['queue']];logger['info']('[syncHangup][talking]',_0x53ea2b[_0xa9bd('0x89')],_0xa9bd('0x91'),_0x218e13[_0xa9bd('0x29')],_0xa9bd('0x48'),_0x218e13[_0xa9bd('0x49')]);}if(this[_0xa9bd('0x16')][_0x53ea2b['linkedid']]&&_0x53ea2b['linkedid']!==_0x53ea2b[_0xa9bd('0x90')]){if(_0x53ea2b[_0xa9bd('0x12b')]==='16'&&this[_0xa9bd('0x16')][_0x53ea2b[_0xa9bd('0x89')]][_0xa9bd('0x8f')]){this['callProgressDetectingCustomer'](_0x53ea2b,_0x53ea2b[_0xa9bd('0x89')],_0x53ea2b[_0xa9bd('0x12b')]);}else if(this['actions'][_0x53ea2b['linkedid']][_0xa9bd('0x8f')]){logger[_0xa9bd('0x25')]('[syncHangup][talking][cause]',_0x53ea2b['linkedid'],_0x53ea2b[_0xa9bd('0x12b')],'\x20Queue',_0x218e13['name'],'pTalking:\x20',_0x218e13[_0xa9bd('0x49')]);this['callProgressDetectingCustomer'](_0x53ea2b,_0x53ea2b[_0xa9bd('0x89')],_0x53ea2b[_0xa9bd('0x12b')]);}}else if(_0x19aec8&&_[_0xa9bd('0x5a')](_0x19aec8[_0xa9bd('0x12c')])&&_0x218e13[_0xa9bd('0x12d')]&&_0x53ea2b[_0xa9bd('0x89')]===_0x53ea2b[_0xa9bd('0x90')]&&_[_0xa9bd('0x5a')](_0x53ea2b[_0xa9bd('0xdc')])&&_0x53ea2b[_0xa9bd('0x12b')]==='16'&&_0x53ea2b['channelstate']==='6'&&_[_0xa9bd('0xda')](_0x19aec8['transfer'])){if(_0x19aec8[_0xa9bd('0x87')]){rpcDb[_0xa9bd('0x12e')](_0x19aec8[_0xa9bd('0x8a')]);}if(_0x19aec8[_0xa9bd('0x88')]){rpcDb[_0xa9bd('0x63')](_0x19aec8['idContact']);}_0x53ea2b[_0xa9bd('0xdc')]='22';this[_0xa9bd('0xd9')](_0x19aec8,_0x218e13,_0x53ea2b);}else if(_0x19aec8&&_0x19aec8['transfer']){if(_0x53ea2b[_0xa9bd('0x12b')]==='16'&&this[_0xa9bd('0x16')][_0x53ea2b['linkedid']][_0xa9bd('0x8f')]){logger[_0xa9bd('0x25')](_0xa9bd('0x12f'),_0x53ea2b['linkedid'],_0x53ea2b[_0xa9bd('0x12b')],_0xa9bd('0x91'),_0x218e13[_0xa9bd('0x29')],_0xa9bd('0x48'),_0x218e13[_0xa9bd('0x49')]);this[_0xa9bd('0x76')](_0x53ea2b,_0x53ea2b[_0xa9bd('0x89')],_0x53ea2b[_0xa9bd('0x12b')]);}else if(this[_0xa9bd('0x16')][_0x53ea2b[_0xa9bd('0x89')]][_0xa9bd('0x8f')]){logger['info'](_0xa9bd('0x130'),_0x53ea2b[_0xa9bd('0x89')],_0x53ea2b[_0xa9bd('0x12b')],_0xa9bd('0x91'),_0x218e13[_0xa9bd('0x29')],'pTalking:\x20',_0x218e13[_0xa9bd('0x49')]);this[_0xa9bd('0x76')](_0x53ea2b,_0x53ea2b[_0xa9bd('0x89')],_0x53ea2b[_0xa9bd('0x12b')]);}}};Preview[_0xa9bd('0xf')]['syncDialEnd']=function(_0x57ffce){if(this['actions'][_0x57ffce[_0xa9bd('0x131')]]&&_0x57ffce[_0xa9bd('0x131')]!==_0x57ffce[_0xa9bd('0x132')]){this[_0xa9bd('0x76')](_0x57ffce,_0x57ffce[_0xa9bd('0x131')],_0x57ffce['dialstatus']);}};Preview[_0xa9bd('0xf')][_0xa9bd('0x133')]=function(_0x33b775){if(this[_0xa9bd('0x16')][_0x33b775[_0xa9bd('0x89')]]&&_0x33b775[_0xa9bd('0x89')]!==_0x33b775['uniqueid']&&!this[_0xa9bd('0x16')][_0x33b775[_0xa9bd('0x89')]][_0xa9bd('0x8f')]){if(_0x33b775[_0xa9bd('0x12b')]==='1'){this[_0xa9bd('0x76')](_0x33b775,_0x33b775[_0xa9bd('0x89')],_0x33b775[_0xa9bd('0x12b')]);}}};Preview[_0xa9bd('0xf')]['addVariable']=function(_0x4c3f49,_0x183e80,_0x4e1c73){if(this[_0xa9bd('0x16')][_0x4c3f49]){if(_['isNil'](this['actions'][_0x4c3f49]['variables'])){this[_0xa9bd('0x16')][_0x4c3f49][_0xa9bd('0x120')]={};}this['actions'][_0x4c3f49][_0xa9bd('0x120')][_0x183e80]=_0x4e1c73;}};Preview[_0xa9bd('0xf')][_0xa9bd('0x20')]=function(_0x556ba3){try{if(!_['isNil'](_0x556ba3)){if(ut[_0xa9bd('0x134')](_['keys'](_0x556ba3[_0xa9bd('0x135')])[0x0])){this[_0xa9bd('0x136')](_0x556ba3[_0xa9bd('0x90')],_[_0xa9bd('0x137')](_0x556ba3[_0xa9bd('0x135')])[0x0],_0x556ba3[_0xa9bd('0x138')]);}}}catch(_0x5d1913){logger[_0xa9bd('0x139')](_0xa9bd('0x13a'),util[_0xa9bd('0x13b')](_0x5d1913,{'showHidden':![],'depth':null}));}};Preview[_0xa9bd('0xf')][_0xa9bd('0x22')]=function(_0x33971e){if(_0x33971e){if(this[_0xa9bd('0x16')][_0x33971e[_0xa9bd('0x13c')]]){this[_0xa9bd('0x16')][_0x33971e[_0xa9bd('0x13c')]][_0xa9bd('0x13d')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x26e506){if(_0x26e506){if(this[_0xa9bd('0x16')][_0x26e506[_0xa9bd('0x13e')]]){this['actions'][_0x26e506[_0xa9bd('0x13e')]][_0xa9bd('0x13d')]=!![];}}};module[_0xa9bd('0x13f')]=Preview; \ No newline at end of file +var _0x07d7=['CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','\x20Queue','queueSummaryCountersUpdated','callProgressDetectingAgent','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','VoiceQueueId','Contact\x20is\x20undefined','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','unmonitored','execRun','pick','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','phone','substring','dialCutDigit','callerid','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','getCallerId','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','assign','merge','toLowerVariables','variablesAction','Action','OriginateError','lookAgent','logLookAgent','clone','isFailure','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','setMessage','recallMe','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','ListId','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','activeContact','linkedid','actioncountonusuch','idContact','ANSWER','responsetime','answertime','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','total','answered','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','Busy','dialBusyRetryFrequency','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','unlockAgent','countbusyretry','incrementPreviewCounters','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','swapAdditionalPhones','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]'];(function(_0x5eb1a8,_0x2188da){var _0x3abfaf=function(_0x3b22d9){while(--_0x3b22d9){_0x5eb1a8['push'](_0x5eb1a8['shift']());}};_0x3abfaf(++_0x2188da);}(_0x07d7,0x85));var _0x707d=function(_0x54f7c0,_0x27af83){_0x54f7c0=_0x54f7c0-0x0;var _0x245d03=_0x07d7[_0x54f7c0];return _0x245d03;};'use strict';var util=require(_0x707d('0x0'));var _=require(_0x707d('0x1'));var uuid=require(_0x707d('0x2'));var moment=require(_0x707d('0x3'));var Redis=require(_0x707d('0x4'));var config=require(_0x707d('0x5'));var logger=require(_0x707d('0x6'))(_0x707d('0x7'));var loggerAction=require(_0x707d('0x6'))(_0x707d('0x8'));var ami=require(_0x707d('0x9'));var rpcDb=require(_0x707d('0xa'));var cmHopperAdditionalPhone=require(_0x707d('0xb'));var Action=require(_0x707d('0xc'));var ut=require(_0x707d('0xd'));var utils=require(_0x707d('0xe'));config['redis']=_['defaults'](config[_0x707d('0xf')],{'host':_0x707d('0x10'),'port':0x18eb});var io=require(_0x707d('0x11'))(new Redis(config[_0x707d('0xf')]));var Sequence=function(){};Sequence[_0x707d('0x12')]['enqueue']=function(_0x3f45f5){this[_0x707d('0x13')]=this[_0x707d('0x13')]?this['tail'][_0x707d('0x14')](_0x3f45f5):_0x3f45f5();};function Preview(_0x355ce4){this[_0x707d('0x15')]=new Sequence();this['campaignsPreview']=_0x355ce4['voiceQueues'];this['trunks']=_0x355ce4[_0x707d('0x16')];this[_0x707d('0x17')]={};this[_0x707d('0x18')]=_0x355ce4['agents'];this[_0x707d('0x19')]=0x0;ami['on']('originateresponse',this[_0x707d('0x1a')][_0x707d('0x1b')](this));ami['on']('hangup',this['syncHangup'][_0x707d('0x1b')](this));ami['on']('hanguprequest',this[_0x707d('0x1c')][_0x707d('0x1b')](this));ami['on'](_0x707d('0x1d'),this[_0x707d('0x1e')][_0x707d('0x1b')](this));ami['on'](_0x707d('0x1f'),this[_0x707d('0x20')]['bind'](this));ami['on'](_0x707d('0x21'),this[_0x707d('0x22')][_0x707d('0x1b')](this));ami['on']('attendedtransfer',this[_0x707d('0x23')][_0x707d('0x1b')](this));ami['on'](_0x707d('0x24'),this[_0x707d('0x25')][_0x707d('0x1b')](this));this[_0x707d('0x26')](this[_0x707d('0x27')]);}function emit(_0x446629,_0x33a726,_0x10d192){io['to'](_0x446629)[_0x707d('0x28')](_0x33a726,_0x10d192);}function emitVoiceQueueChannelRemove(_0x366ef7){logger[_0x707d('0x29')](_0x707d('0x2a'),JSON[_0x707d('0x2b')](_0x366ef7));emit(util[_0x707d('0x2c')](_0x707d('0x2d'),_0x366ef7['name']),_0x707d('0x2e'),_0x366ef7);io['emit'](_0x707d('0x2f'),_0x366ef7);}function notSendMessagesQueue(_0x139ad5){if(_0x139ad5[_0x707d('0x30')]){if(_0x139ad5[_0x707d('0x31')]===0x0&&_0x139ad5[_0x707d('0x32')]===0x0){_0x139ad5['sendMessageOneNotActive']=![];_0x139ad5[_0x707d('0x33')]=0x0;_0x139ad5[_0x707d('0x34')]=0x0;_0x139ad5[_0x707d('0x35')]=utils[_0x707d('0x36')][_0x707d('0x37')];ut[_0x707d('0x38')](_0x707d('0x39'),_0x139ad5[_0x707d('0x3a')]+_0x707d('0x3b'));}else{_0x139ad5[_0x707d('0x35')]=utils[_0x707d('0x36')][_0x707d('0x3c')];ut[_0x707d('0x38')](_0x707d('0x39'),_0x139ad5[_0x707d('0x3a')]+_0x707d('0x3d'));}}}Preview[_0x707d('0x12')][_0x707d('0x26')]=function(){var _0x599ba6=this;setInterval(function(){_0x599ba6[_0x707d('0x3e')]();},0x7cf);};Preview[_0x707d('0x12')][_0x707d('0x3e')]=function(){var _0x4a3d8e=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x18c7e4 in _0x4a3d8e){if(_0x4a3d8e[_0x707d('0x3f')](_0x18c7e4)&&(_0x4a3d8e[_0x18c7e4][_0x707d('0x40')]===_0x707d('0x7')||_0x4a3d8e[_0x18c7e4][_0x707d('0x40')]===_0x707d('0x41'))&&_0x4a3d8e[_0x18c7e4][_0x707d('0x42')]===_0x707d('0x43')){if(this[_0x707d('0x19')]>0x7){this[_0x707d('0x19')]=0x0;this[_0x707d('0x44')]();}}if(_0x4a3d8e[_0x707d('0x3f')](_0x18c7e4)&&_0x4a3d8e[_0x18c7e4]['dialMethod']===_0x707d('0x7')&&_0x4a3d8e[_0x18c7e4][_0x707d('0x42')]===_0x707d('0x43')){if(_0x4a3d8e[_0x18c7e4][_0x707d('0x45')]){this[_0x707d('0x46')](_0x4a3d8e[_0x18c7e4]);if(_0x4a3d8e[_0x18c7e4]['dialPreviewAutoRecallMe'])this[_0x707d('0x47')](_0x4a3d8e[_0x18c7e4]);}else{notSendMessagesQueue(_0x4a3d8e[_0x18c7e4]);}}}};Preview[_0x707d('0x12')]['clearZombieChannel']=function(_0x325bd9){var _0x260b2=this;this[_0x707d('0x15')][_0x707d('0x48')](function(){if(!_[_0x707d('0x49')](_0x260b2[_0x707d('0x17')][_0x325bd9])){loggerAction[_0x707d('0x29')](_0x707d('0x4a'),_0x325bd9,_0x707d('0x4b'),_0x260b2['actions'][_0x325bd9][_0x707d('0x4c')],_0x707d('0x4d'),JSON[_0x707d('0x2b')](_0x260b2[_0x707d('0x27')][_0x260b2[_0x707d('0x17')][_0x325bd9]['queue']][_0x707d('0x31')]),_0x707d('0x4e'),JSON[_0x707d('0x2b')](_0x260b2['campaignsPreview'][_0x260b2[_0x707d('0x17')][_0x325bd9]['queue']][_0x707d('0x32')]),JSON[_0x707d('0x2b')](_0x260b2[_0x707d('0x17')][_0x325bd9][_0x707d('0x4f')]),JSON['stringify'](_['pick'](_0x260b2[_0x707d('0x17')][_0x325bd9],[_0x707d('0x50'),'UserId','VoiceQueueId',_0x707d('0x51')])));return ami['Action']({'action':'status','channel':_0x260b2[_0x707d('0x17')][_0x325bd9][_0x707d('0x52')]})[_0x707d('0x53')](function(_0x14772e){if(_0x14772e[_0x707d('0x35')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x260b2[_0x707d('0x17')][_0x325bd9]){ut[_0x707d('0x54')](_0x260b2[_0x707d('0x27')][_0x260b2[_0x707d('0x17')][_0x325bd9][_0x707d('0x4c')]],_0x707d('0x55'));if(_0x260b2[_0x707d('0x17')][_0x325bd9][_0x707d('0x4f')]===!![]){ut[_0x707d('0x56')](_0x260b2[_0x707d('0x27')][_0x260b2[_0x707d('0x17')][_0x325bd9]['queue']],_0x707d('0x55'));ut[_0x707d('0x57')]('[Dialer][checkChannel][pTalking][Preview]'+_0x325bd9,_0x260b2[_0x707d('0x17')][_0x325bd9][_0x707d('0x4c')]);}ut[_0x707d('0x57')](_0x707d('0x58')+_0x325bd9,_0x260b2[_0x707d('0x17')][_0x325bd9]['queue']);delete _0x260b2[_0x707d('0x17')][_0x325bd9];}},0x2328);}});}});};Preview[_0x707d('0x12')][_0x707d('0x44')]=function(){var _0x5b718=this;loggerAction[_0x707d('0x29')](_0x707d('0x59'),_[_0x707d('0x5a')](this[_0x707d('0x17')]));for(var _0x3de8b3 in this['actions']){if(_0x5b718[_0x707d('0x17')]['hasOwnProperty'](_0x3de8b3)){_0x5b718[_0x707d('0x5b')](_0x3de8b3);}}};Preview[_0x707d('0x12')][_0x707d('0x47')]=function(_0x208fdf){var _0x467397=this;rpcDb[_0x707d('0x5c')](_0x208fdf['id'],ut[_0x707d('0x5d')](this[_0x707d('0x18')]))['then'](function(_0x1cfde2){if(!_[_0x707d('0x49')](_0x1cfde2)){for(var _0x39b291=0x0;_0x39b291<_0x1cfde2[_0x707d('0x5e')];_0x39b291+=0x1){if(ut[_0x707d('0x5f')](_0x1cfde2[_0x39b291][_0x707d('0x60')])<_0x208fdf['dialRecallMeTimeout']*0x3c){if(_0x1cfde2[_0x39b291][_0x707d('0x61')]&&!_0x1cfde2[_0x39b291][_0x707d('0x61')][_0x707d('0x62')]){_0x467397[_0x707d('0x63')](_0x1cfde2[_0x39b291]['id'])[_0x707d('0x64')](ut[_0x707d('0x65')]('[RecallMe]'))['catch'](ut[_0x707d('0x65')](_0x707d('0x66')));}else{rpcDb['disableContact'](_0x1cfde2[_0x39b291]['id']);}}else{var _0x31ac73=new Action(_0x1cfde2[_0x39b291],_0x208fdf);_0x31ac73[_0x707d('0x67')]=moment()[_0x707d('0x2c')](_0x707d('0x68'));_0x208fdf['outboundReCallsDay']+=0x1;ut[_0x707d('0x69')](_0x31ac73,0x17,_0x707d('0x6a'));if(_0x208fdf[_0x707d('0x6b')]){rpcDb['rescheduleContactInQueue'](ut[_0x707d('0x6c')](_0x1cfde2[_0x39b291]));rpcDb[_0x707d('0x6d')](_0x31ac73,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x707d('0x69')](_0x31ac73,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x31ac73,'[HistoryRecallClose]');rpcDb[_0x707d('0x6e')](_0x31ac73,_0x707d('0x6f'));}}}}})[_0x707d('0x53')](ut[_0x707d('0x65')](_0x707d('0x70')));};Preview[_0x707d('0x12')]['setMessage']=function(_0x439281){_0x439281[_0x707d('0x30')]=!![];if(ut['IsNotLoggedIn'](_0x439281['loggedIn'])){_0x439281[_0x707d('0x35')]=utils['CAMPAIGN_STATUS'][_0x707d('0x71')];}else if(!ut[_0x707d('0x72')](_0x439281['dialActive'])){_0x439281[_0x707d('0x35')]=utils['CAMPAIGN_STATUS'][_0x707d('0x37')];}else if(!this[_0x707d('0x73')](_0x439281[_0x707d('0x74')])){if(!this[_0x707d('0x73')](_0x439281[_0x707d('0x75')])){_0x439281['message']=utils[_0x707d('0x36')][_0x707d('0x76')];}else{_0x439281[_0x707d('0x35')]=utils['CAMPAIGN_STATUS'][_0x707d('0x77')];}}else{_0x439281['message']=utils[_0x707d('0x36')][_0x707d('0x77')];}};Preview[_0x707d('0x12')]['callProgressDetectingCustomer']=function(_0x530dd2,_0x36ae56,_0x211c37){var _0x3283f1=this;var _0xb72911=this[_0x707d('0x17')][_0x36ae56];var _0x234b90=this[_0x707d('0x27')][_0xb72911[_0x707d('0x4c')]];var _0x54940d;var _0x475dbc=![];var _0x145c60=0x2;var _0xc3867b=0x3;if(_0x234b90){switch(_0x211c37){case'1':_0x234b90[_0x707d('0x78')]+=0x1;_0xb72911[_0x707d('0x79')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0x0,_0x707d('0x7c'));ami[_0x707d('0x28')](_0x707d('0x7d'),ut[_0x707d('0x7e')](_0xb72911,_0x707d('0x7f')));rpcDb[_0x707d('0x6d')](_0xb72911,_0x707d('0x80'));_0x3283f1[_0x707d('0x81')](_0xb72911,'0',_0x234b90)['then'](function(_0x1d05d9){_0x475dbc=_0x1d05d9[_0x707d('0x82')]==0x1;_0x145c60=_0x234b90[_0x707d('0x83')];_0xc3867b=_0x234b90[_0x707d('0x84')];if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90['dialGlobalMaxRetry']){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb[_0x707d('0x6e')](_0x54940d,_0x707d('0x87'));}else{if(_0xb72911[_0x707d('0x79')]>=_0x234b90[_0x707d('0x88')]){rpcDb[_0x707d('0x6e')](_0xb72911,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x707d('0x89')](ut['scheduledAt'](_0xb72911,_0x707d('0x79'),_0x234b90[_0x707d('0x83')]),_0xb72911['unlockAgent'],_0xb72911[_0x707d('0x8a')]);}}delete this[_0x707d('0x17')][_0x530dd2[_0x707d('0x8b')]];}else{_0xb72911[_0x707d('0x79')]++;logger['info'](_0x707d('0x8c'),_0xb72911[_0x707d('0x79')]);logger[_0x707d('0x29')]('id',_0xb72911[_0x707d('0x8d')]);_0x3283f1['incrementPreviewCounters']({'id':_0xb72911[_0x707d('0x8d')],'field':{'countnosuchnumberretry':_0xb72911['countnosuchnumberretry']}})[_0x707d('0x64')](function(){_0x3283f1['swapAdditionalPhones'](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});break;case _0x707d('0x8e'):var _0x5aa44c=moment()[_0x707d('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');_0xb72911[_0x707d('0x8f')]=_0x5aa44c;_0xb72911[_0x707d('0x90')]=_0x5aa44c;_0xb72911['dialAnswer']=!![];_0x234b90[_0x707d('0x32')]+=0x1;logger[_0x707d('0x29')]('[syncHangup][talking][increment]',_0xb72911[_0x707d('0x91')],'\x20Queue',_0x234b90[_0x707d('0x3a')],_0x707d('0x4e'),_0x234b90[_0x707d('0x32')]);ami[_0x707d('0x28')](_0x707d('0x92'),ut[_0x707d('0x7e')](_0xb72911,_0x707d('0x93'),this[_0x707d('0x27')][_0xb72911[_0x707d('0x4c')]]));if(_0x234b90[_0x707d('0x94')]){ami[_0x707d('0x28')](_0x707d('0x95'),ut[_0x707d('0x96')](_0xb72911));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x707d('0x7e')](_0xb72911,'complete',this[_0x707d('0x27')][_0xb72911[_0x707d('0x4c')]]));emitVoiceQueueChannelRemove(ut[_0x707d('0x7e')](_0xb72911,_0x707d('0x97')));_0x234b90[_0x707d('0x98')]+=0x1;_0x234b90[_0x707d('0x99')]+=0x1;_0x234b90[_0x707d('0x9a')]+=0x1;ut['decrementTalkink'](_0x234b90,'[16]');_0xb72911['countglobal']=ut[_0x707d('0x7b')](_0xb72911);ut['logCustomer'](_0xb72911,0x4,_0x707d('0x9b'));rpcDb[_0x707d('0x6d')](_0xb72911,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0x9c'));rpcDb[_0x707d('0x9d')](_0xb72911);_0x234b90[_0x707d('0x9e')]+=_0xb72911[_0x707d('0x9f')];_0x234b90[_0x707d('0xa0')]+=_0xb72911[_0x707d('0x9f')];logger[_0x707d('0x29')](_0x707d('0xa1'),_0xb72911[_0x707d('0x91')],'\x20Queue',_0x234b90['name'],_0x707d('0x4e'),_0x234b90[_0x707d('0x32')]);delete this[_0x707d('0x17')][_0x530dd2[_0x707d('0x8b')]];break;case _0x707d('0xa2'):_0x234b90[_0x707d('0xa3')]+=0x1;_0xb72911['countbusyretry']+=0x1;_0xb72911[_0x707d('0x7a')]=ut['totalGlobal'](_0xb72911);ut['logCustomer'](_0xb72911,0x5,_0x707d('0xa4'));_0x145c60=_0x234b90[_0x707d('0xa5')];_0xc3867b=_0x234b90['callAdditionalPhoneAfterMin'];ami[_0x707d('0x28')]('custom:agentbusy',ut['buildObj'](_0xb72911,_0x707d('0xa6')));rpcDb[_0x707d('0x6d')](_0xb72911,'[callProgressDetectingCustomer][logBusy]');_0x3283f1[_0x707d('0x81')](_0xb72911,'5',_0x234b90)[_0x707d('0x64')](function(_0x22eed7){_0x475dbc=_0x22eed7[_0x707d('0x82')]==0x1;if(!_0x475dbc){if(ut['totalGlobal'](_0xb72911)>=_0x234b90[_0x707d('0xa7')]){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb['createCustomerFinal'](_0x54940d,_0x707d('0xa8'));}else{if(_0xb72911['countbusyretry']>=_0x234b90[_0x707d('0xa9')]){rpcDb[_0x707d('0x6e')](_0xb72911,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x707d('0x89')](ut[_0x707d('0xaa')](_0xb72911,'countbusyretry',_0x234b90[_0x707d('0xa5')]),_0xb72911[_0x707d('0xab')],_0xb72911[_0x707d('0x8a')]);}}}else{_0xb72911[_0x707d('0xac')]++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911['idContact'],'field':{'countbusyretry':_0xb72911['countbusyretry']}})['then'](function(){_0x3283f1['swapAdditionalPhones'](_0xb72911,_0x145c60,_0xc3867b)['then'](function(){});});}});break;case _0x707d('0xae'):_0x234b90[_0x707d('0xaf')]+=0x1;_0xb72911[_0x707d('0xb0')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0x3,_0x707d('0xb1'));_0x145c60=_0x234b90[_0x707d('0xb2')];_0xc3867b=_0x234b90['callAdditionalPhoneAfterMin'];var _0x1cd37d=ut['buildNoAnswerEventPayload'](_0xb72911,_0x234b90);ami[_0x707d('0x28')](_0x707d('0xb3'),_0x1cd37d);rpcDb[_0x707d('0x6d')](_0xb72911,_0x707d('0xb4'));_0x3283f1[_0x707d('0x81')](_0xb72911,'3',_0x234b90)['then'](function(_0x3a4665){_0x475dbc=_0x3a4665['additional']==0x1;if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90[_0x707d('0xa7')]){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb[_0x707d('0x6e')](_0x54940d,_0x707d('0xb5'));}else{if(_0xb72911[_0x707d('0xb0')]>=_0x234b90[_0x707d('0xb6')]){rpcDb[_0x707d('0x6e')](_0xb72911,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x707d('0x89')](ut[_0x707d('0xaa')](_0xb72911,'countnoanswerretry',_0x234b90[_0x707d('0xb2')]),_0xb72911[_0x707d('0xab')],_0xb72911['activeContact']);}}}else{_0xb72911[_0x707d('0xb0')]++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911[_0x707d('0x8d')],'field':{'countnoanswerretry':_0xb72911[_0x707d('0xb0')]}})['then'](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});break;case _0x707d('0xb8'):_0x234b90['outboundCongestionCallsDay']+=0x1;_0xb72911[_0x707d('0xb9')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0x8,_0x707d('0xba'));_0x145c60=_0x234b90[_0x707d('0xbb')];_0xc3867b=_0x234b90['callAdditionalPhoneAfterMin'];ami['emit'](_0x707d('0xbc'),ut[_0x707d('0x7e')](_0xb72911,_0x707d('0xbd')));rpcDb[_0x707d('0x6d')](_0xb72911,_0x707d('0xbe'));_0x3283f1[_0x707d('0x81')](_0xb72911,'8',_0x234b90)[_0x707d('0x64')](function(_0x2a7c12){_0x475dbc=_0x2a7c12['additional']==0x1;if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90[_0x707d('0xa7')]){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb[_0x707d('0x6e')](_0x54940d,_0x707d('0xbf'));}else{if(_0xb72911['countcongestionretry']>=_0x234b90['dialCongestionMaxRetry']){rpcDb[_0x707d('0x6e')](_0xb72911,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x707d('0x89')](ut[_0x707d('0xaa')](_0xb72911,_0x707d('0xb9'),_0x234b90[_0x707d('0xa5')]),_0xb72911[_0x707d('0xab')],_0xb72911[_0x707d('0x8a')]);}}}else{_0xb72911['countcongestionretry']++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911[_0x707d('0x8d')],'field':{'countcongestionretry':_0xb72911[_0x707d('0xb9')]}})[_0x707d('0x64')](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});break;case _0x707d('0xc0'):_0x234b90[_0x707d('0xc1')]+=0x1;_0xb72911[_0x707d('0xc2')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0x14,_0x707d('0xc3'));_0x145c60=_0x234b90[_0x707d('0xc4')];_0xc3867b=_0x234b90[_0x707d('0x84')];ami[_0x707d('0x28')](_0x707d('0xc5'),ut[_0x707d('0x7e')](_0xb72911,_0x707d('0xc6')));rpcDb[_0x707d('0x6d')](_0xb72911,'[syncHangupRequest][logAgentReject]');_0x3283f1[_0x707d('0x81')](_0xb72911,'20',_0x234b90)[_0x707d('0x64')](function(_0x3f4918){_0x475dbc=_0x3f4918[_0x707d('0x82')]==0x1;if(!_0x475dbc){if(ut['totalGlobal'](_0xb72911)>=_0x234b90[_0x707d('0xa7')]){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0x14,_0x707d('0xc3'));rpcDb[_0x707d('0x6e')](_0x54940d,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0xb72911[_0x707d('0xc2')]>=_0x234b90['dialAgentRejectMaxRetry']){rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0xc7'));}else{rpcDb[_0x707d('0x89')](ut[_0x707d('0xaa')](_0xb72911,_0x707d('0xc2'),_0x234b90['dialAgentRejectRetryFrequency']),_0xb72911[_0x707d('0xab')],_0xb72911['activeContact']);}}}else{_0xb72911[_0x707d('0xb0')]++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911[_0x707d('0x8d')],'field':{'countnoanswerretry':_0xb72911['countnoanswerretry']}})[_0x707d('0x64')](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)['then'](function(){});});}});break;case'ABANDONED':_0x234b90[_0x707d('0xc8')]+=0x1;_0xb72911[_0x707d('0xc9')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0xb,_0x707d('0xca'));rpcDb['createCustomerHistory'](_0xb72911,_0x707d('0xcb'));_0x3283f1[_0x707d('0x81')](_0xb72911,'11',_0x234b90)[_0x707d('0x64')](function(_0x9e3646){_0x475dbc=_0x9e3646['additional']==0x1;if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90['dialGlobalMaxRetry']){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb['createCustomerFinal'](_0x54940d,_0x707d('0xcb'));}else{if(_0xb72911[_0x707d('0xcc')]>=_0x234b90[_0x707d('0xcd')]){rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0xcb'));}else{rpcDb['rescheduleContact'](ut[_0x707d('0xaa')](_0xb72911,_0x707d('0xc9'),_0x234b90['dialAbandonedRetryFrequency']),_0xb72911[_0x707d('0xab')],_0xb72911[_0x707d('0x8a')]);}}}else{_0xb72911[_0x707d('0xb0')]++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911['idContact'],'field':{'countnoanswerretry':_0xb72911['countnoanswerretry']}})[_0x707d('0x64')](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});break;case'18':_0x234b90['outboundUnknownCallsDay']+=0x1;_0xb72911[_0x707d('0xce')]+=0x1;_0xb72911[_0x707d('0x7a')]=ut['totalGlobal'](_0xb72911);ut['logCustomer'](_0xb72911,0x12,_0x530dd2[_0x707d('0xcf')]||_0x530dd2[_0x707d('0xd0')]);ami[_0x707d('0x28')](_0x707d('0xd1'),ut[_0x707d('0x7e')](_0xb72911,_0x707d('0xd2')));rpcDb['createCustomerHistory'](_0xb72911,_0x707d('0xd3'));_0x3283f1[_0x707d('0x81')](_0xb72911,'18',_0x234b90)[_0x707d('0x64')](function(_0x1f6deb){_0x475dbc=_0x1f6deb[_0x707d('0x82')]==0x1;if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90['dialGlobalMaxRetry']){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0x12,_0x707d('0x86'));rpcDb['createCustomerFinal'](_0x54940d,_0x707d('0xd3'));}else{rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0xd3'));}}else{_0xb72911['countnoanswerretry']++;_0x3283f1['incrementPreviewCounters']({'id':_0xb72911[_0x707d('0x8d')],'field':{'countnoanswerretry':_0xb72911[_0x707d('0xb0')]}})[_0x707d('0x64')](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});delete this[_0x707d('0x17')][_0x530dd2[_0x707d('0x8b')]];break;case'19':_0x234b90[_0x707d('0xd4')]+=0x1;_0xb72911['countglobal']=ut[_0x707d('0x7b')](_0xb72911);ut[_0x707d('0x69')](_0xb72911,0x13,_0x530dd2[_0x707d('0xcf')]||_0x530dd2[_0x707d('0xd0')]);ami[_0x707d('0x28')]('custom:amd',ut[_0x707d('0x7e')](_0xb72911,'amd'));rpcDb[_0x707d('0x6d')](_0xb72911,_0x707d('0xd5'));_0x3283f1['verifyAdditionalPhones'](_0xb72911,'18',_0x234b90)['then'](function(_0x384d90){_0x475dbc=_0x384d90['additional']==0x1;if(!_0x475dbc){if(ut[_0x707d('0x7b')](_0xb72911)>=_0x234b90['dialGlobalMaxRetry']){_0x54940d=ut['cloneAction'](_0xb72911,0xf,_0x707d('0x86'));rpcDb[_0x707d('0x6e')](_0x54940d,_0x707d('0xd5'));}else{rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0xd5'));}}else{_0xb72911[_0x707d('0xb0')]++;_0x3283f1[_0x707d('0xad')]({'id':_0xb72911[_0x707d('0x8d')],'field':{'countnoanswerretry':_0xb72911[_0x707d('0xb0')]}})[_0x707d('0x64')](function(){_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});});}});delete this[_0x707d('0x17')][_0x530dd2[_0x707d('0x8b')]];break;default:if(_0xb72911[_0x707d('0x4f')]){ut[_0x707d('0x56')](_0x234b90,_0x707d('0xd6'));ut[_0x707d('0x57')](_0x707d('0xd7')+_0x234b90[_0x707d('0x3a')],_0x530dd2);}_0x234b90['outboundUnknownCallsDay']+=0x1;_0xb72911[_0x707d('0x7a')]=ut[_0x707d('0x7b')](_0xb72911);ut['logCustomer'](_0xb72911,0xc,_0x530dd2[_0x707d('0xcf')]||_0x530dd2[_0x707d('0xd0')]);_0x145c60=_0x234b90[_0x707d('0xc4')];_0xc3867b=_0x234b90['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0xb72911,_0x707d('0xd8'));_0x3283f1[_0x707d('0x81')](_0xb72911,'20',_0x234b90)[_0x707d('0x64')](function(_0xa0f8e2){_0x475dbc=_0xa0f8e2[_0x707d('0x82')]==0x1;if(!_0x475dbc){if(ut['totalGlobal'](_0xb72911)>=_0x234b90['dialGlobalMaxRetry']){_0x54940d=ut[_0x707d('0x85')](_0xb72911,0xf,_0x707d('0x86'));rpcDb[_0x707d('0x6e')](_0x54940d,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x707d('0x6e')](_0xb72911,_0x707d('0xd9'));}delete this[_0x707d('0x17')][_0x530dd2[_0x707d('0x8b')]];}else{_0x3283f1[_0x707d('0xb7')](_0xb72911,_0x145c60,_0xc3867b)[_0x707d('0x64')](function(){});}});}if(!(_0xb72911[_0x707d('0x4f')]&&_0x211c37==='16')){ut[_0x707d('0x54')](_0x234b90,_0x707d('0xda'));logger[_0x707d('0x29')]('[originated][decrement][callProgressDetectingCustomer]',_0xb72911[_0x707d('0x91')],_0x707d('0xdb'),_0x234b90[_0x707d('0x3a')],_0x707d('0x4d'),_0x234b90['originated']);}if(_0x211c37!==_0x707d('0x8e')){delete this['actions'][_0x530dd2[_0x707d('0x8b')]];delete this[_0x707d('0x17')][_0x530dd2['destlinkedid']];}_0x234b90[_0x707d('0xdc')]=!![];}};Preview['prototype'][_0x707d('0xdd')]=function(_0x4ed922,_0x52fe2e,_0x54ad2c){if(_['isUndefined'](_0x52fe2e)&&_0x707d('0xde')!==typeof _0x52fe2e){return;}if(_['isUndefined'](_0x54ad2c)&&_0x707d('0xde')!==typeof _0x54ad2c){return;}switch(_0x54ad2c[_0x707d('0xdf')]){case'0':ut[_0x707d('0xe0')](_0x4ed922,0x0,_0x707d('0x7c'));rpcDb[_0x707d('0xe1')](_0x4ed922,_0x707d('0xe2'));break;case'3':ut['logAgent'](_0x4ed922,0x3,_0x707d('0xb1'));rpcDb[_0x707d('0xe1')](_0x4ed922,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x707d('0xe0')](_0x4ed922,0x5,_0x707d('0xa4'));rpcDb[_0x707d('0xe1')](_0x4ed922,_0x707d('0xe3'));break;case'8':ut[_0x707d('0xe0')](_0x4ed922,0x8,_0x707d('0xba'));rpcDb[_0x707d('0xe1')](_0x4ed922,_0x707d('0xe4'));break;case'22':ut['logAgent'](_0x4ed922,0x16,_0x707d('0xe5'));rpcDb[_0x707d('0xe1')](_0x4ed922,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x4ed922,0xc,_0x54ad2c[_0x707d('0xdf')]);rpcDb['createAgentHistory'](_0x4ed922,_0x707d('0xe4'));}ut[_0x707d('0x54')](_0x52fe2e,'[callProgressDetectingAgent]');logger[_0x707d('0x29')](_0x707d('0xe6'),_0x4ed922[_0x707d('0x91')],_0x707d('0xdb'),_0x52fe2e[_0x707d('0x3a')],_0x707d('0x4d'),_0x52fe2e[_0x707d('0x31')]);delete this[_0x707d('0x17')][_0x4ed922[_0x707d('0x91')]];};Preview[_0x707d('0x12')][_0x707d('0x81')]=function(_0x24f34f,_0x5ebd4c,_0x31d3f9){return cmHopperAdditionalPhone[_0x707d('0x81')](_0x24f34f,_0x5ebd4c,_0x31d3f9)[_0x707d('0x53')](logger[_0x707d('0x29')](_0x707d('0xe7')));};Preview[_0x707d('0x12')][_0x707d('0xb7')]=function(_0x1a9ebd,_0x3ead19,_0x1993dd){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1a9ebd,_0x3ead19,_0x1993dd)[_0x707d('0x53')](logger[_0x707d('0x29')](_0x707d('0xe8')));};Preview[_0x707d('0x12')][_0x707d('0xad')]=function(_0x116b4a){return Promise[_0x707d('0xe9')]()['then'](cmHopperAdditionalPhone[_0x707d('0xad')](_0x116b4a))[_0x707d('0x53')](logger['info'](_0x707d('0xea')));};Preview[_0x707d('0x12')][_0x707d('0xeb')]=function(_0x4f081d,_0x5cb579,_0x422342,_0x27251d,_0x4952cb){var _0x1018d2=this;return new Promise(function(_0x306f98,_0x5ee5cf){if(_[_0x707d('0x49')](_0x5cb579)||_[_0x707d('0x49')](_0x5cb579[_0x707d('0xec')])||_[_0x707d('0x49')](_0x5cb579['phone'])||_[_0x707d('0x49')](_0x5cb579[_0x707d('0xed')])){_0x5ee5cf(ut[_0x707d('0x35')](_0x707d('0xee'),_0x27251d,_0x4952cb));return;}var _0x5712eb=uuid['v4']();var _0x1baeb5=_0x1018d2[_0x707d('0x27')][_0x5cb579[_0x707d('0x4b')][_0x707d('0x3a')]];var _0x2bf44d=_0x422342?_0x1018d2[_0x707d('0x18')][_0x422342]['id']:undefined;_0x1018d2[_0x707d('0x17')][_0x5712eb]=new Action(_0x5cb579,_0x1baeb5,_0x5712eb,_0x422342,_0x2bf44d);var _0x33040c=_0x1018d2['actions'][_0x5712eb];_0x33040c[_0x707d('0xab')]=_0x27251d;_0x33040c[_0x707d('0x8a')]=_0x4952cb;_0x33040c['lookAgent']=_0x422342;if(_['isEmpty'](_0x4f081d)){_0x1018d2[_0x707d('0xef')](_0x33040c,_0x1baeb5,_0x5cb579,_0x422342)[_0x707d('0x64')](function(_0x3c76cb){logger['info'](_0x707d('0xf0'),_0x707d('0xf1')+_0x33040c[_0x707d('0x4c')]+_0x707d('0xf2')+_0x33040c['idContact'],JSON[_0x707d('0x2b')](_0x3c76cb));ami['emit'](_0x707d('0xf3'),ut['buildObj'](_0x33040c,'called',_0x1018d2['campaignsPreview'][_0x33040c[_0x707d('0x4c')]]));_0x306f98(ut['message'](_0x707d('0xf4')));})['catch'](function(_0x51e554){ut[_0x707d('0x38')](_0x707d('0xf5'),_0x51e554);_0x5ee5cf(ut[_0x707d('0x35')]('Call\x20failed',_0x27251d,_0x4952cb));});}else{_0x1baeb5['outboundBlacklistCallsDay']+=0x1;ut[_0x707d('0xf6')](_0x33040c);rpcDb[_0x707d('0xf7')](_0x33040c,_0x707d('0xf8'));delete _0x1018d2[_0x707d('0x17')][_0x5712eb];_0x5ee5cf(ut['message'](_0x707d('0xf9'),_0x27251d,_0x4952cb));}});};Preview[_0x707d('0x12')][_0x707d('0x73')]=function(_0x5cb102){return!_[_0x707d('0x49')](_0x5cb102)&&!_[_0x707d('0x49')](_0x5cb102[_0x707d('0x3a')])&&!_['isNil'](_0x5cb102[_0x707d('0xfa')])&&_0x5cb102['active']&&!_[_0x707d('0x49')](this[_0x707d('0x16')][util[_0x707d('0x2c')](_0x707d('0xfb'),_0x5cb102[_0x707d('0x3a')])])&&!_[_0x707d('0x49')](this[_0x707d('0x16')][util['format'](_0x707d('0xfb'),_0x5cb102[_0x707d('0x3a')])][_0x707d('0xfc')])&&(this['trunks'][util[_0x707d('0x2c')](_0x707d('0xfb'),_0x5cb102[_0x707d('0x3a')])]['status']==='reachable'||this['trunks'][util[_0x707d('0x2c')](_0x707d('0xfb'),_0x5cb102[_0x707d('0x3a')])][_0x707d('0xfc')]===_0x707d('0xfd'));};Preview['prototype'][_0x707d('0x63')]=function(_0x110e19,_0x273e85){return this[_0x707d('0xfe')](_0x110e19,_0x273e85)['then'](function(_0x59f284){return _[_0x707d('0xff')](_0x59f284,[_0x707d('0x35')]);})[_0x707d('0x53')](function(_0x386fdb){if(_0x386fdb[_0x707d('0x100')]){rpcDb[_0x707d('0x101')](_0x110e19);}if(_0x386fdb[_0x707d('0xfa')]){rpcDb[_0x707d('0x102')](_0x110e19);}throw _[_0x707d('0xff')](_0x386fdb,['message']);});};Preview[_0x707d('0x12')][_0x707d('0xfe')]=function(_0x264f53,_0x4cbce0){var _0x1c6178=this;var _0x11f075,_0x35f12f;return rpcDb[_0x707d('0x103')](_0x264f53)[_0x707d('0x64')](function(_0x1402f9){if(!_[_0x707d('0x49')](_0x1402f9[0x0])){_0x35f12f=_0x1402f9[0x0]['recallme']?![]:!![];_0x11f075=_0x1402f9[0x0][_0x707d('0x104')]?!![]:![];_0x11f075=_0x4cbce0?!![]:_0x11f075;}var _0x46eb5b=_0x1c6178[_0x707d('0x105')](_0x1402f9);if(_0x46eb5b[_0x707d('0x106')]){rpcDb[_0x707d('0x107')](_[_0x707d('0xff')](_0x1402f9[0x0],[_0x707d('0xed'),'phone']))['then'](function(_0x2ef96b){_0x1c6178[_0x707d('0xeb')](_0x2ef96b,_0x1402f9[0x0],_0x4cbce0,_0x35f12f,_0x11f075)[_0x707d('0x64')](function(_0x37a62f){return _0x37a62f;})['catch'](function(_0x2bdb10){throw _0x2bdb10;});})[_0x707d('0x53')](function(_0x26cdb8){ut['logger']('[Preview][checkIsBlackList]',_0x26cdb8);throw ut[_0x707d('0x35')]('Call\x20unsuccessful',_0x35f12f,_0x11f075);});}else{throw ut[_0x707d('0x35')](_0x46eb5b[_0x707d('0x35')],_0x35f12f,_0x11f075);}})['catch'](function(_0xcc477c){ut[_0x707d('0x38')]('[Preview][getContactPreview]',_0xcc477c);throw ut[_0x707d('0x35')](_0x707d('0x108'),![],!![]);});};Preview['prototype'][_0x707d('0x105')]=function(_0x56560c){if(_[_0x707d('0x49')](_0x56560c)||_['isEmpty'](_0x56560c)||!_[_0x707d('0x49')](_0x56560c[0x0]['Agent'])&&_['isNil'](_0x56560c[0x0][_0x707d('0x61')]['name'])){ut[_0x707d('0x38')](_0x707d('0x109'),_0x56560c);return{'isValid':![],'message':_0x707d('0x10a')};}var _0x57601e=this[_0x707d('0x27')][_0x56560c[0x0][_0x707d('0x4b')][_0x707d('0x3a')]];_0x57601e['message']=utils['CAMPAIGN_STATUS'][_0x707d('0x77')];if(_[_0x707d('0x49')](_0x57601e)){ut[_0x707d('0x38')](_0x707d('0x10b'),_0x57601e);return{'isValid':![],'message':_0x707d('0x10c')};}if(!this['isTrunkReachable'](_0x57601e[_0x707d('0x74')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x57601e[_0x707d('0x3a')]+_0x707d('0x10d'));if(!this[_0x707d('0x73')](_0x57601e[_0x707d('0x75')])){ut['logger'](_0x707d('0x10e'),_0x57601e[_0x707d('0x3a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x707d('0x10f')};}}if(!ut[_0x707d('0x72')](_0x57601e[_0x707d('0x45')])){ut[_0x707d('0x38')]('[Preview][validateContact][Campaign\x20Active]',_0x57601e[_0x707d('0x3a')]+_0x707d('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x57601e[_0x707d('0x3a')]+_0x707d('0x110')};}return{'isValid':!![],'message':_0x707d('0x111')};};Preview['prototype'][_0x707d('0xef')]=function(_0x17147b,_0x394e78,_0x209632,_0x13c988){var _0x4f477b=this;return new Promise(function(_0x26080d,_0x53e8c0){var _0x1ab5c4=_0x17147b['uniqueid'];var _0x24572b=_0x4f477b['isTrunkReachable'](_0x394e78['Trunk'])?util[_0x707d('0x2c')](_0x707d('0x112'),_0x394e78[_0x707d('0x74')][_0x707d('0x3a')],_['isNil'](_0x394e78['dialPrefix'])?'':_0x394e78[_0x707d('0x113')][_0x707d('0x114')]()||'',_0x394e78['dialCutDigit']>0x0?_0x209632[_0x707d('0x115')][_0x707d('0x116')](_0x394e78[_0x707d('0x117')]):_0x209632['phone']):util['format'](_0x707d('0x112'),_[_0x707d('0x49')](_0x394e78[_0x707d('0x75')])?_0x394e78['Trunk'][_0x707d('0x3a')]:_0x394e78['TrunkBackup'][_0x707d('0x3a')],_[_0x707d('0x49')](_0x394e78[_0x707d('0x113')])?'':_0x394e78[_0x707d('0x113')][_0x707d('0x114')]()||'',_0x394e78[_0x707d('0x117')]>0x0?_0x209632['phone'][_0x707d('0x116')](_0x394e78[_0x707d('0x117')]):_0x209632[_0x707d('0x115')]);var _0x285df0=_0x4f477b[_0x707d('0x73')](_0x394e78[_0x707d('0x74')])?ut['getCallerId'](_0x394e78[_0x707d('0x74')][_0x707d('0x118')],_0x394e78[_0x707d('0x119')],_0x394e78['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x394e78[_0x707d('0x11a')],_0x394e78[_0x707d('0x11b')]):_0x394e78[_0x707d('0x11a')]):ut[_0x707d('0x11c')](_[_0x707d('0x49')](_0x394e78['TrunkBackup'])?_0x394e78[_0x707d('0x74')][_0x707d('0x118')]:_0x394e78[_0x707d('0x75')][_0x707d('0x118')],_0x394e78['dialOriginateCallerIdName'],_0x394e78[_0x707d('0x11b')]>0x0?ut[_0x707d('0x11d')](_0x394e78['dialOriginateCallerIdNumber'],_0x394e78[_0x707d('0x11b')]):_0x394e78[_0x707d('0x11a')]);if(_0x285df0){_0x17147b[_0x707d('0x11e')]=ut[_0x707d('0x11f')](_0x285df0);_0x17147b[_0x707d('0x120')]=ut[_0x707d('0x121')](_0x285df0);}var _0x557cd8=ut[_0x707d('0x122')](_0x394e78,_0x209632,_0x24572b,_0x285df0,_0x1ab5c4,_0x17147b);var _0x17c223=utils['setXMDContactVariables'](_0x209632[_0x707d('0xec')]);Object[_0x707d('0x123')](_0x557cd8,_0x17c223);_[_0x707d('0x124')](_0x17147b,ut[_0x707d('0x125')](_0x557cd8));_0x17147b[_0x707d('0x67')]=moment()[_0x707d('0x2c')](_0x707d('0x68'));_0x394e78['variables']=_0x557cd8;var _0x4ef2dc=ut[_0x707d('0x126')](_0x17147b,_0x394e78,_0x557cd8,_0x17147b[_0x707d('0x8a')],_0x13c988);return ami[_0x707d('0x127')](_0x4ef2dc)[_0x707d('0x64')](function(_0x1a6179){_0x394e78[_0x707d('0x31')]+=0x1;logger['info']('[originated][increment]',_0x1ab5c4,'\x20Queue',_0x394e78[_0x707d('0x3a')],_0x707d('0x4d'),_0x394e78['originated']);_0x26080d(_0x1a6179);})[_0x707d('0x53')](function(_0xd457f){ut[_0x707d('0xe0')](_0x17147b,0xe,_0x707d('0x128'));rpcDb[_0x707d('0xe1')](_0x17147b,'[originateFailure][logOriginateFailure]');_0x53e8c0(_0xd457f);});});};Preview['prototype'][_0x707d('0x20')]=function(_0xfbf1e0){if(this[_0x707d('0x17')][_0xfbf1e0[_0x707d('0x8b')]]){this['actions'][_0xfbf1e0[_0x707d('0x8b')]][_0x707d('0x52')]=_0xfbf1e0[_0x707d('0x52')];}};Preview[_0x707d('0x12')][_0x707d('0x1a')]=function(_0xac12f7){var _0x465b66=this;var _0x5300eb=this[_0x707d('0x17')][_0xac12f7['actionid']];if(_0x5300eb){if(_0x5300eb[_0x707d('0x129')]&&this['agents'][_0x5300eb[_0x707d('0x129')]]){ut[_0x707d('0x12a')](_0x5300eb,this[_0x707d('0x18')][_0x5300eb['lookAgent']][_0x707d('0x3a')],this[_0x707d('0x18')][_0x5300eb['lookAgent']]['id']);}var _0x56a533=_[_0x707d('0x12b')](_0x5300eb);_0x56a533['responsetime']=moment()[_0x707d('0x2c')](_0x707d('0x68'));var _0x22aa7b=_0x465b66[_0x707d('0x27')][_0x5300eb['queue']];if(ut[_0x707d('0x12c')](_0xac12f7['response'])){if(_0x5300eb[_0x707d('0xab')]){rpcDb[_0x707d('0x101')](_0x5300eb[_0x707d('0x8d')]);}if(_0x5300eb['activeContact']){rpcDb[_0x707d('0x102')](_0x5300eb[_0x707d('0x8d')]);}ami['emit']('custom:agentringnoanswer',ut[_0x707d('0x7e')](_0x5300eb,_0x707d('0x12d'),this['campaignsPreview'][_0x5300eb[_0x707d('0x4c')]]));this['callProgressDetectingAgent'](_0x56a533,_0x22aa7b,_0xac12f7);}else{_0x5300eb['starttime']=moment()[_0x707d('0x2c')](_0x707d('0x68'));ut[_0x707d('0xe0')](_0x56a533,0x4,_0x707d('0x9b'));rpcDb[_0x707d('0xe1')](_0x56a533,_0x707d('0x12e'));}}};Preview[_0x707d('0x12')]['syncHangup']=function(_0x516799){var _0x2473c0=this[_0x707d('0x17')][_0x516799[_0x707d('0x8b')]];var _0x2c40d3;if(_0x2473c0){_0x2c40d3=this[_0x707d('0x27')][_0x2473c0[_0x707d('0x4c')]];logger[_0x707d('0x29')](_0x707d('0x12f'),_0x516799['linkedid'],'\x20Queue',_0x2c40d3[_0x707d('0x3a')],_0x707d('0x4e'),_0x2c40d3['pTalking']);}if(this['actions'][_0x516799[_0x707d('0x8b')]]&&_0x516799[_0x707d('0x8b')]!==_0x516799[_0x707d('0x91')]){if(_0x516799[_0x707d('0x130')]==='16'&&this[_0x707d('0x17')][_0x516799['linkedid']]['dialAnswer']){this[_0x707d('0x131')](_0x516799,_0x516799[_0x707d('0x8b')],_0x516799['cause']);}else if(this[_0x707d('0x17')][_0x516799[_0x707d('0x8b')]]['dialAnswer']){logger[_0x707d('0x29')](_0x707d('0x132'),_0x516799[_0x707d('0x8b')],_0x516799[_0x707d('0x130')],'\x20Queue',_0x2c40d3['name'],'pTalking:\x20',_0x2c40d3[_0x707d('0x32')]);this[_0x707d('0x131')](_0x516799,_0x516799[_0x707d('0x8b')],_0x516799['cause']);}}else if(_0x2473c0&&_[_0x707d('0x49')](_0x2473c0[_0x707d('0x133')])&&_0x2c40d3[_0x707d('0x134')]&&_0x516799[_0x707d('0x8b')]===_0x516799[_0x707d('0x91')]&&_[_0x707d('0x49')](_0x516799[_0x707d('0xdf')])&&_0x516799[_0x707d('0x130')]==='16'&&_0x516799[_0x707d('0x135')]==='6'&&_[_0x707d('0x136')](_0x2473c0['transfer'])){if(_0x2473c0[_0x707d('0xab')]){rpcDb['unlockContact'](_0x2473c0[_0x707d('0x8d')]);}if(_0x2473c0[_0x707d('0x8a')]){rpcDb[_0x707d('0x102')](_0x2473c0[_0x707d('0x8d')]);}_0x516799[_0x707d('0xdf')]='22';this[_0x707d('0xdd')](_0x2473c0,_0x2c40d3,_0x516799);}else if(_0x2473c0&&_0x2473c0[_0x707d('0x137')]){if(_0x516799[_0x707d('0x130')]==='16'&&this[_0x707d('0x17')][_0x516799['linkedid']][_0x707d('0x4f')]){logger[_0x707d('0x29')](_0x707d('0x138'),_0x516799['linkedid'],_0x516799['cause'],_0x707d('0xdb'),_0x2c40d3[_0x707d('0x3a')],_0x707d('0x4e'),_0x2c40d3['pTalking']);this[_0x707d('0x131')](_0x516799,_0x516799[_0x707d('0x8b')],_0x516799['cause']);}else if(this[_0x707d('0x17')][_0x516799['linkedid']][_0x707d('0x4f')]){logger[_0x707d('0x29')]('[syncHangup][talking][cause]',_0x516799[_0x707d('0x8b')],_0x516799[_0x707d('0x130')],_0x707d('0xdb'),_0x2c40d3[_0x707d('0x3a')],_0x707d('0x4e'),_0x2c40d3['pTalking']);this[_0x707d('0x131')](_0x516799,_0x516799[_0x707d('0x8b')],_0x516799[_0x707d('0x130')]);}}};Preview[_0x707d('0x12')][_0x707d('0x1e')]=function(_0x33452c){if(this['actions'][_0x33452c[_0x707d('0x139')]]&&_0x33452c[_0x707d('0x139')]!==_0x33452c[_0x707d('0x13a')]){this['callProgressDetectingCustomer'](_0x33452c,_0x33452c['destlinkedid'],_0x33452c['dialstatus']);}};Preview[_0x707d('0x12')]['syncHangupRequest']=function(_0x391d59){if(this[_0x707d('0x17')][_0x391d59['linkedid']]&&_0x391d59['linkedid']!==_0x391d59[_0x707d('0x91')]&&!this[_0x707d('0x17')][_0x391d59[_0x707d('0x8b')]][_0x707d('0x4f')]){if(_0x391d59[_0x707d('0x130')]==='1'){this['callProgressDetectingCustomer'](_0x391d59,_0x391d59[_0x707d('0x8b')],_0x391d59[_0x707d('0x130')]);}}};Preview[_0x707d('0x12')]['addVariable']=function(_0x264768,_0x12ef1d,_0xd3587b){if(this[_0x707d('0x17')][_0x264768]){if(_['isNil'](this[_0x707d('0x17')][_0x264768][_0x707d('0x13b')])){this[_0x707d('0x17')][_0x264768][_0x707d('0x13b')]={};}this[_0x707d('0x17')][_0x264768][_0x707d('0x13b')][_0x12ef1d]=_0xd3587b;}};Preview[_0x707d('0x12')][_0x707d('0x22')]=function(_0x28bd5a){try{if(!_[_0x707d('0x49')](_0x28bd5a)){if(ut[_0x707d('0x13c')](_[_0x707d('0x13d')](_0x28bd5a[_0x707d('0x13e')])[0x0])){this['addVariable'](_0x28bd5a[_0x707d('0x91')],_[_0x707d('0x13d')](_0x28bd5a[_0x707d('0x13e')])[0x0],_0x28bd5a[_0x707d('0x13f')]);}}}catch(_0x5c3f62){logger['error'](_0x707d('0x140'),util[_0x707d('0x141')](_0x5c3f62,{'showHidden':![],'depth':null}));}};Preview[_0x707d('0x12')]['syncAttendedTransfer']=function(_0x34db41){if(_0x34db41){if(this['actions'][_0x34db41[_0x707d('0x142')]]){this[_0x707d('0x17')][_0x34db41[_0x707d('0x142')]]['transfer']=!![];}}};Preview['prototype'][_0x707d('0x25')]=function(_0x245354){if(_0x245354){if(this[_0x707d('0x17')][_0x245354['transfererlinkedid']]){this[_0x707d('0x17')][_0x245354[_0x707d('0x143')]][_0x707d('0x137')]=!![];}}};module[_0x707d('0x144')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 3abcd26..548e018 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 _0xb9ee=['checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb9ee,0xd5));var _0xeb9e=function(_0xffa1cd,_0x533c8c){_0xffa1cd=_0xffa1cd-0x0;var _0x231e13=_0xb9ee[_0xffa1cd];return _0x231e13;};'use strict';var util=require(_0xeb9e('0x0'));var BPromise=require(_0xeb9e('0x1'));var logger=require(_0xeb9e('0x2'))(_0xeb9e('0x3'));var cmHopper=require(_0xeb9e('0x4'));var cmHopperHistory=require(_0xeb9e('0x5'));var cmHopperBlack=require(_0xeb9e('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xeb9e('0x7'));function loggerCatch(_0x45d3f5){return function(_0x3f995a){logger[_0xeb9e('0x8')](_0x45d3f5,util[_0xeb9e('0x9')](_0x3f995a,{'showHidden':![],'depth':null}));};}function create(_0x4e961a){return cmHopperHistory[_0xeb9e('0xa')](_0x4e961a)[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0xc')));}function createAgent(_0x384795){return BPromise['resolve']()['then'](agentReportPreview['createHistory'](_0x384795))['catch'](loggerCatch(_0xeb9e('0xc')));}function moveContact(_0x1af5e1){return cmHopper[_0xeb9e('0xd')](_0x1af5e1,!![])[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0xe')));}exports[_0xeb9e('0xf')]=function(_0x1c833b){return cmHopperBlack[_0xeb9e('0xf')](_0x1c833b)[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0x10')));};exports[_0xeb9e('0x11')]=function(_0x2b7ad2){return BPromise[_0xeb9e('0x12')]()[_0xeb9e('0x13')](cmHopper[_0xeb9e('0x11')](_0x2b7ad2))['catch'](loggerCatch(_0xeb9e('0x14')));};exports['createHistory']=function(_0x4ae1a3,_0x24f757){create(_0x4ae1a3)[_0xeb9e('0xb')](loggerCatch(_0x24f757));moveContact(_0x4ae1a3)[_0xeb9e('0xb')](loggerCatch(_0x24f757));};exports[_0xeb9e('0x15')]=function(_0x1ca5e3,_0xf9d641){createAgent(_0x1ca5e3)[_0xeb9e('0xb')](loggerCatch(_0xf9d641));};exports[_0xeb9e('0x16')]=function(_0x1b7f49,_0x75e27e){create(_0x1b7f49)[_0xeb9e('0xb')](loggerCatch(_0x75e27e));};exports['createCustomerFinal']=function(_0x3c8df1,_0x4e714d){moveContact(_0x3c8df1)[_0xeb9e('0xb')](loggerCatch(_0x4e714d));};exports[_0xeb9e('0x17')]=function(_0x4a38ea,_0x14fd06,_0x518407){if(_0x14fd06){_0x4a38ea['UserId']=null;}if(_0x518407){_0x4a38ea[_0xeb9e('0x18')]=![];}return cmHopper[_0xeb9e('0x17')](_0x4a38ea)[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0x19')));};exports[_0xeb9e('0x1a')]=function(_0x4f0c0f){return cmHopper[_0xeb9e('0x1a')](_0x4f0c0f)[_0xeb9e('0xb')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x5439dd){return cmHopper[_0xeb9e('0x1b')]({'UserId':null},_0x5439dd,0x1)[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0x1c')));};exports[_0xeb9e('0x1d')]=function(_0x1d5c79){return cmHopper['unlockContact']({'active':![]},_0x1d5c79,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xeb9e('0x1e')]=function(_0x5441be){var _0xebd7a8={};_0xebd7a8[_0xeb9e('0x1f')]=_0x5441be[_0xeb9e('0x1f')];_0xebd7a8[_0xeb9e('0x20')]=_0x5441be[_0xeb9e('0x20')];_0xebd7a8[_0xeb9e('0x21')]=_0x5441be['calleridnum'];_0xebd7a8['calleridname']=_0x5441be[_0xeb9e('0x22')];_0xebd7a8['queue']=_0x5441be[_0xeb9e('0x23')];_0xebd7a8[_0xeb9e('0x24')]=_0x5441be[_0xeb9e('0x25')];_0xebd7a8[_0xeb9e('0x26')]=_0x5441be['answertime'];_0xebd7a8[_0xeb9e('0x27')]=0x1;_0xebd7a8[_0xeb9e('0x28')]=_0x5441be[_0xeb9e('0x29')];_0xebd7a8['connectedlinename']=_0x5441be['membername'];_0xebd7a8[_0xeb9e('0x2a')]=_0xeb9e('0x2b');_0xebd7a8['exten']=_0xeb9e('0x2c');_0xebd7a8[_0xeb9e('0x2d')]=0x0;_0xebd7a8[_0xeb9e('0x2e')]=0x1;_0xebd7a8[_0xeb9e('0x2f')]=_0x5441be[_0xeb9e('0x30')];_0xebd7a8[_0xeb9e('0x31')]=_0xeb9e('0x32');return BPromise[_0xeb9e('0x12')]()[_0xeb9e('0x13')](voiceQueueReport[_0xeb9e('0x33')](_0xebd7a8))[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0x34')));};exports[_0xeb9e('0x35')]=function(_0x4216c7,_0x2f7869){return BPromise[_0xeb9e('0x12')]()[_0xeb9e('0x13')](cmHopper[_0xeb9e('0x35')](_0x4216c7,_0x2f7869))[_0xeb9e('0xb')](loggerCatch(_0xeb9e('0x36')));};exports[_0xeb9e('0x37')]=function(_0x1aabb1){return cmHopper[_0xeb9e('0x17')](_0x1aabb1,!![],!![])['catch'](loggerCatch(_0xeb9e('0x38')));}; \ No newline at end of file +var _0xe5d8=['then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueReport','createHistory','catch','[createHistory]\x20','resolve'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xe5d8,0xf4));var _0x8e5d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe5d8[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x8e5d('0x0'));var BPromise=require(_0x8e5d('0x1'));var logger=require(_0x8e5d('0x2'))(_0x8e5d('0x3'));var cmHopper=require(_0x8e5d('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x8e5d('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x8e5d('0x6'));function loggerCatch(_0x3903da){return function(_0x43e50c){logger['error'](_0x3903da,util['inspect'](_0x43e50c,{'showHidden':![],'depth':null}));};}function create(_0xfc0aa5){return cmHopperHistory[_0x8e5d('0x7')](_0xfc0aa5)[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x9')));}function createAgent(_0x1cae45){return BPromise[_0x8e5d('0xa')]()[_0x8e5d('0xb')](agentReportPreview[_0x8e5d('0x7')](_0x1cae45))[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x9')));}function moveContact(_0x55ec5d){return cmHopper[_0x8e5d('0xc')](_0x55ec5d,!![])['catch'](loggerCatch(_0x8e5d('0xd')));}exports[_0x8e5d('0xe')]=function(_0x4b41a3){return cmHopperBlack[_0x8e5d('0xe')](_0x4b41a3)[_0x8e5d('0x8')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x8e5d('0xf')]=function(_0x2c5705){return BPromise[_0x8e5d('0xa')]()['then'](cmHopper[_0x8e5d('0xf')](_0x2c5705))['catch'](loggerCatch(_0x8e5d('0x10')));};exports[_0x8e5d('0x7')]=function(_0xd7dfe4,_0x491402){create(_0xd7dfe4)[_0x8e5d('0x8')](loggerCatch(_0x491402));moveContact(_0xd7dfe4)[_0x8e5d('0x8')](loggerCatch(_0x491402));};exports[_0x8e5d('0x11')]=function(_0x153aec,_0x2f3b7d){createAgent(_0x153aec)['catch'](loggerCatch(_0x2f3b7d));};exports[_0x8e5d('0x12')]=function(_0x534428,_0x10687b){create(_0x534428)[_0x8e5d('0x8')](loggerCatch(_0x10687b));};exports[_0x8e5d('0x13')]=function(_0x532265,_0x376b3d){moveContact(_0x532265)[_0x8e5d('0x8')](loggerCatch(_0x376b3d));};exports[_0x8e5d('0x14')]=function(_0x5f1e30,_0x1560c9,_0x4d5c39){if(_0x1560c9){_0x5f1e30[_0x8e5d('0x15')]=null;}if(_0x4d5c39){_0x5f1e30['active']=![];}return cmHopper['rescheduleContact'](_0x5f1e30)[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x16')));};exports[_0x8e5d('0x17')]=function(_0x2e0575){return cmHopper[_0x8e5d('0x17')](_0x2e0575)[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x18')));};exports['unlockContact']=function(_0x5a5984){return cmHopper['unlockContact']({'UserId':null},_0x5a5984,0x1)[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x19')));};exports[_0x8e5d('0x1a')]=function(_0x337fc7){return cmHopper[_0x8e5d('0x1b')]({'active':![]},_0x337fc7,0x1)[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x1c')));};exports[_0x8e5d('0x1d')]=function(_0x5a952f){var _0x436d0e={};_0x436d0e[_0x8e5d('0x1e')]=_0x5a952f[_0x8e5d('0x1e')];_0x436d0e[_0x8e5d('0x1f')]=_0x5a952f['uniqueid'];_0x436d0e[_0x8e5d('0x20')]=_0x5a952f[_0x8e5d('0x20')];_0x436d0e[_0x8e5d('0x21')]=_0x5a952f['calleridname'];_0x436d0e[_0x8e5d('0x22')]=_0x5a952f[_0x8e5d('0x22')];_0x436d0e[_0x8e5d('0x23')]=_0x5a952f['answertime'];_0x436d0e[_0x8e5d('0x24')]=_0x5a952f[_0x8e5d('0x25')];_0x436d0e[_0x8e5d('0x26')]=0x1;_0x436d0e[_0x8e5d('0x27')]=_0x5a952f['endtime'];_0x436d0e[_0x8e5d('0x28')]=_0x5a952f[_0x8e5d('0x29')];_0x436d0e[_0x8e5d('0x2a')]='from-sip';_0x436d0e[_0x8e5d('0x2b')]=_0x8e5d('0x2c');_0x436d0e[_0x8e5d('0x2d')]=0x0;_0x436d0e[_0x8e5d('0x2e')]=0x1;_0x436d0e[_0x8e5d('0x2f')]=_0x5a952f[_0x8e5d('0x29')];_0x436d0e['queuecallerexitreason']=_0x8e5d('0x30');return BPromise['resolve']()[_0x8e5d('0xb')](voiceQueueReport['create'](_0x436d0e))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x8e5d('0x31')]=function(_0x6fdf8d,_0x48ff39){return BPromise[_0x8e5d('0xa')]()['then'](cmHopper[_0x8e5d('0x31')](_0x6fdf8d,_0x48ff39))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0xe0275e){return cmHopper['rescheduleContact'](_0xe0275e,!![],!![])[_0x8e5d('0x8')](loggerCatch(_0x8e5d('0x32')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 5e1d47b..243b2f0 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 _0x9b5f=['addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','updateOriginated','isNil','hasOwnProperty','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','UserId','logCustomer','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','name','queue','interface','motionChannel','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','membername','active','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','env','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive'];(function(_0xff838d,_0x8ba8cb){var _0x44112a=function(_0x2c288a){while(--_0x2c288a){_0xff838d['push'](_0xff838d['shift']());}};_0x44112a(++_0x8ba8cb);}(_0x9b5f,0x7f));var _0xf9b5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x9b5f[_0x27af45];return _0x18df21;};'use strict';var util=require(_0xf9b5('0x0'));var _=require(_0xf9b5('0x1'));var moment=require('moment');var logger=require(_0xf9b5('0x2'))(_0xf9b5('0x3'));var ipAgi=process[_0xf9b5('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0xf9b5('0x5'));exports[_0xf9b5('0x6')]=function(_0x4ea59a){return function(_0x224f10){logger[_0xf9b5('0x7')](_0x4ea59a,util[_0xf9b5('0x8')](_0x224f10,{'showHidden':![],'depth':null}));};};exports[_0xf9b5('0x9')]=function(_0x477e94,_0x4a4206){logger[_0xf9b5('0xa')](_0x477e94,util[_0xf9b5('0x8')](_0x4a4206,{'showHidden':![],'depth':null}));};exports[_0xf9b5('0xb')]=function(_0x28e352,_0x4d7cca){logger[_0xf9b5('0x7')](_0x28e352,util[_0xf9b5('0x8')](_0x4d7cca,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3714f6){return function(_0x334ffb){logger[_0xf9b5('0xa')](_0x3714f6,util[_0xf9b5('0x8')](_0x334ffb,{'showHidden':![],'depth':null}));};};exports[_0xf9b5('0xc')]=function(_0x1ca0ba,_0x4c75b7,_0x5db53b){return{'message':_0x1ca0ba,'unlock':_0x4c75b7,'active':_0x5db53b};};exports[_0xf9b5('0xd')]=function(_0x4534d1,_0x424b3d,_0x8ad2de){if(!_[_0xf9b5('0xe')](_0x8ad2de)&&_0xf9b5('0xf')===typeof _0x8ad2de&&!_[_0xf9b5('0x10')](_0x8ad2de)){if(!_['isUndefined'](_0x424b3d)&&_0xf9b5('0xf')===typeof _0x424b3d&&!_[_0xf9b5('0x10')](_0x424b3d)){return util[_0xf9b5('0x11')](_0xf9b5('0x12'),_0x424b3d,_0x8ad2de);}return util[_0xf9b5('0x11')](_0xf9b5('0x12'),_0x8ad2de,_0x8ad2de);}if(!_[_0xf9b5('0xe')](_0x4534d1)&&_0xf9b5('0xf')===typeof _0x4534d1&&!_[_0xf9b5('0x10')](_0x4534d1)){return _0x4534d1;}return _0xf9b5('0x13');};exports[_0xf9b5('0x14')]=function(_0xe978a3){if(_['isNil'](_0xe978a3)){return![];}return _0xe978a3;};exports[_0xf9b5('0x15')]=function(_0x58b05e,_0x295539,_0x4fa230,_0x2721b4,_0x52c3ad,_0x1b335d){var _0x13b4ba={'XMD-QUEUE':_0x295539[_0xf9b5('0x16')]?_0x295539[_0xf9b5('0x16')]['name']:'','XMD-CALLERID':_0x2721b4,'XMD-CALLERID-PREVIEW':_0x1b335d?util['format'](_0xf9b5('0x12'),_0x1b335d[_0xf9b5('0x17')],_0x1b335d[_0xf9b5('0x18')]):_0x2721b4,'XMD-DIALID':_0x52c3ad,'XMD-CONTACTID':_0x295539[_0xf9b5('0x19')],'XMD-CDRTYPE':_0xf9b5('0x1a'),'CALLERID(all)':_0x2721b4,'XMD-VOICEQUEUEID':_0x295539[_0xf9b5('0x1b')],'XMD-DIALCHANNEL':_0x4fa230,'XMD-DIALTIMEOUT':_0x58b05e['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xf9b5('0x11')](_0xf9b5('0x1c'),_0x58b05e[_0xf9b5('0x1d')]?'g':'',_[_0xf9b5('0x10')](_0x58b05e[_0xf9b5('0x1e')])?'':_0xf9b5('0x1f')),'XMD-DIALURL':_0x58b05e['dialPreviewUrl']||'','XMD-AGI':_0x58b05e[_0xf9b5('0x20')]?util[_0xf9b5('0x11')](_0xf9b5('0x21'),ipAgi,_0x58b05e[_0xf9b5('0x20')]):'NONE','XMD-AGIAFTER':_0x58b05e[_0xf9b5('0x1d')]?util['format'](_0xf9b5('0x21'),ipAgi,_0x58b05e['dialQueueProject2']):_0xf9b5('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x1b335d?_0x1b335d['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1b335d?_0x1b335d[_0xf9b5('0x23')]:'','XMD-DESTINATION':_0xf9b5('0x24'),'SIPADDHEADER':_0xf9b5('0x25')};if(!_[_0xf9b5('0x10')](_0x58b05e[_0xf9b5('0x1e')])){_0x13b4ba[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x58b05e['monitor_format'];_0x13b4ba[util['format']('%s',_0xf9b5('0x26'))]=_0x52c3ad;}return _0x13b4ba;};exports[_0xf9b5('0x27')]=function(_0x485c87){var _0x12a2f9={};for(var _0x4feb57 in _0x485c87){if(_0x485c87['hasOwnProperty'](_0x4feb57)){_0x12a2f9[util['format']('%s',_[_0xf9b5('0x28')](_0x4feb57))]=_0x485c87[_0x4feb57];}}return{'variables':_0x12a2f9};};exports[_0xf9b5('0x29')]=function(_0x2a66dd,_0xd18602){if(!_[_0xf9b5('0x2a')](_0x2a66dd)){if(_0x2a66dd[_0xf9b5('0x2b')](_0xf9b5('0x2c'))){if(_0x2a66dd[_0xf9b5('0x2c')]>0x0){_0x2a66dd[_0xf9b5('0x2c')]-=0x1;}else{logger[_0xf9b5('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0xd18602);}}}else{logger[_0xf9b5('0x7')](_0xf9b5('0x2d'),_0xd18602);}};exports[_0xf9b5('0x2e')]=function(_0x4073d6){var _0x550824=moment()[_0xf9b5('0x11')](_0xf9b5('0x2f'));_0x4073d6[_0xf9b5('0x30')]=0xd;_0x4073d6['statedesc']=_0xf9b5('0x31');_0x4073d6[_0xf9b5('0x32')]=_0x550824;_0x4073d6[_0xf9b5('0x33')]=_0x550824;_0x4073d6[_0xf9b5('0x34')]=_0x550824;};exports[_0xf9b5('0x35')]=function(_0x457eb6,_0x4abf08,_0x23be5a){var _0x5e5030=moment()[_0xf9b5('0x11')](_0xf9b5('0x2f'));_0x457eb6[_0xf9b5('0x30')]=_0x4abf08;_0x457eb6[_0xf9b5('0x36')]=_0x23be5a;_0x457eb6[_0xf9b5('0x33')]=_0x5e5030;_0x457eb6[_0xf9b5('0x37')]=utils['getSeconds'](_0x457eb6['responsetime'],_0x457eb6['starttime']);};exports['logLookAgent']=function(_0xe106f1,_0x3d5247,_0x3d671b){_0xe106f1['membername']=_0x3d5247;_0xe106f1[_0xf9b5('0x38')]=_0x3d671b;};exports[_0xf9b5('0x39')]=function(_0x3cca39,_0x3ad066,_0x297593){var _0x3da572=moment()[_0xf9b5('0x11')](_0xf9b5('0x2f'));_0x3cca39['state']=_0x3ad066;_0x3cca39[_0xf9b5('0x36')]=_0x297593;_0x3cca39['responsetime']=_0x3cca39[_0xf9b5('0x33')]?_0x3cca39[_0xf9b5('0x33')]:_0x3da572;_0x3cca39[_0xf9b5('0x34')]=_0x3cca39[_0xf9b5('0x34')]?_0x3cca39[_0xf9b5('0x34')]:_0x3da572;_0x3cca39['ringtime']=utils['getSeconds'](_0x3cca39[_0xf9b5('0x33')]||0x0,_0x3cca39[_0xf9b5('0x32')]||0x0);_0x3cca39[_0xf9b5('0x3a')]=_0x3cca39[_0xf9b5('0x3b')]?utils['getSeconds'](_0x3cca39[_0xf9b5('0x34')],_0x3cca39[_0xf9b5('0x3b')]):0x0;};exports[_0xf9b5('0x3c')]=function(_0x3376b1){return _0x3376b1===_0xf9b5('0x3d');};exports['variablesAction']=function(_0x507d18,_0x34ec6d,_0xe47997,_0x5b48cb,_0x3ec052){var _0x167425=_0x5b48cb?_0xf9b5('0x3e'):_0x507d18[_0xf9b5('0x17')];_0x167425=_0x3ec052?_0xf9b5('0x3f'):_0x167425;return{'actionid':_0x507d18[_0xf9b5('0x40')],'action':_0xf9b5('0x41'),'channel':_0x507d18[_0xf9b5('0x42')],'callerid':util[_0xf9b5('0x11')]('\x22%s\x22\x20<%s>',_0x167425,_0x507d18[_0xf9b5('0x18')]),'Exten':_0xf9b5('0x24'),'Context':_0xf9b5('0x43'),'Priority':'1','variable':_0xe47997,'timeout':(_0x34ec6d['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x507d18[_0xf9b5('0x40')]};};exports[_0xf9b5('0x44')]=function(_0x20e993){return _0x20e993['countbusyretry']+_0x20e993[_0xf9b5('0x45')]+_0x20e993[_0xf9b5('0x46')]+_0x20e993[_0xf9b5('0x47')]+_0x20e993[_0xf9b5('0x48')];};exports[_0xf9b5('0x49')]=function(_0x45318d){var _0x332120=_['clone'](_0x45318d);_0x332120[_0xf9b5('0x30')]=0xf;_0x332120[_0xf9b5('0x36')]=_0xf9b5('0x4a');return _0x332120;};exports[_0xf9b5('0x4b')]=function(_0x38890f,_0x4dfadd,_0x26b2e6){var _0x494c8c={};_0x494c8c[_0x4dfadd]=_0x38890f[_0x4dfadd];_0x494c8c['active']=![];_0x494c8c[_0xf9b5('0x4c')]=moment()[_0xf9b5('0x4d')](_0x26b2e6,_0xf9b5('0x4e'))[_0xf9b5('0x11')](_0xf9b5('0x2f'));_0x494c8c[_0xf9b5('0x19')]=_0x38890f[_0xf9b5('0x19')];_0x494c8c[_0xf9b5('0x4f')]=_0x38890f[_0xf9b5('0x4f')];_0x494c8c['VoiceQueueId']=_0x38890f[_0xf9b5('0x1b')]||undefined;return _0x494c8c;};exports[_0xf9b5('0x50')]=function(_0x36634f,_0x207f47){if(!_[_0xf9b5('0x2a')](_0x36634f)){if(_0x36634f[_0xf9b5('0x51')]>0x0){_0x36634f['pTalking']-=0x1;}else{logger[_0xf9b5('0x7')](_0x207f47,_0xf9b5('0x52'));}}else{logger[_0xf9b5('0x7')](_0x207f47,_0xf9b5('0x53'));}};exports['IsNotLoggedIn']=function(_0xb7660a){if(_0xb7660a<=0x0){return!![];}return![];};function buildObj(_0x4c9e2b,_0x1926f6,_0x42645a){_0x4c9e2b[_0xf9b5('0x54')]=_0x1926f6;_0x4c9e2b[_0xf9b5('0x55')]=_0x4c9e2b[_0xf9b5('0x56')];_0x4c9e2b[_0xf9b5('0x57')]=_0x4c9e2b['channelAgent'];_0x4c9e2b[_0xf9b5('0x58')]='voice';if(_0x42645a){_0x4c9e2b['mandatoryDisposition']=_0x42645a[_0xf9b5('0x59')];}return _0x4c9e2b;}exports[_0xf9b5('0x5a')]=buildObj;exports[_0xf9b5('0x5b')]=function(_0x118fc0){var _0x2ded10={};_0x2ded10[_0xf9b5('0x56')]=_0x118fc0[_0xf9b5('0x56')];_0x2ded10[_0xf9b5('0x57')]=_0x118fc0[_0xf9b5('0x42')];_0x2ded10[_0xf9b5('0x40')]=_0x118fc0[_0xf9b5('0x40')];return _0x2ded10;};exports[_0xf9b5('0x5c')]=function(_0x5ecbd2){var _0x1f788c=[];for(var _0x50f986 in _0x5ecbd2){if(_0x5ecbd2[_0xf9b5('0x2b')](_0x50f986)){if(!_['isNil'](_0x5ecbd2[_0x50f986])&&_0x5ecbd2[_0x50f986][_0xf9b5('0x30')]===_0xf9b5('0x5d')&&_0x5ecbd2[_0x50f986][_0xf9b5('0x5e')]===_0xf9b5('0x5f')){_0x1f788c[_0xf9b5('0x60')](_0x5ecbd2[_0x50f986]['id']);}}}return _0x1f788c;};exports[_0xf9b5('0x61')]=function(_0x1e37ee){var _0x26a338=moment()[_0xf9b5('0x62')](0x0);var _0x1d0c18=moment(_0x1e37ee)['milliseconds'](0x0);return _0x26a338[_0xf9b5('0x63')](_0x1d0c18,_0xf9b5('0x64'));};exports[_0xf9b5('0x65')]=function(_0x4edd74){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4edd74[_0xf9b5('0x19')],'ListId':_0x4edd74[_0xf9b5('0x4f')],'VoiceQueueId':_0x4edd74[_0xf9b5('0x1b')]||undefined,'CampaignId':_0x4edd74[_0xf9b5('0x66')]||undefined};};exports[_0xf9b5('0x67')]=function(_0x150ff3){if(_0x150ff3===_0xf9b5('0x40')||_0x150ff3===_0xf9b5('0x68')||_0x150ff3===_0xf9b5('0x56')||_0x150ff3===_0xf9b5('0x69')||_0x150ff3==='campaigntype'||_0x150ff3===_0xf9b5('0x6a')||_0x150ff3===_0xf9b5('0x6b')||_0x150ff3===_0xf9b5('0x42')||_0x150ff3===_0xf9b5('0x17')||_0x150ff3===_0xf9b5('0x6c')||_0x150ff3===_0xf9b5('0x18')||_0x150ff3===_0xf9b5('0x4c')||_0x150ff3==='countbusyretry'||_0x150ff3===_0xf9b5('0x45')||_0x150ff3===_0xf9b5('0x46')||_0x150ff3===_0xf9b5('0x6d')||_0x150ff3===_0xf9b5('0x6e')||_0x150ff3===_0xf9b5('0x6f')||_0x150ff3===_0xf9b5('0x70')||_0x150ff3===_0xf9b5('0x71')||_0x150ff3===_0xf9b5('0x19')||_0x150ff3==='ListId'||_0x150ff3===_0xf9b5('0x38')||_0x150ff3===_0xf9b5('0x1b')||_0x150ff3===_0xf9b5('0x72')||_0x150ff3===_0xf9b5('0x73')||_0x150ff3===_0xf9b5('0x74')||_0x150ff3===_0xf9b5('0x75')||_0x150ff3===_0xf9b5('0x76')||_0x150ff3===_0xf9b5('0x77')||_0x150ff3===_0xf9b5('0x78')||_0x150ff3===_0xf9b5('0x79')||_0x150ff3===_0xf9b5('0x7a')||_0x150ff3==='xmd-dialchannel'||_0x150ff3==='xmd-contactid'||_0x150ff3===_0xf9b5('0x7b')||_0x150ff3===_0xf9b5('0x7c')||_0x150ff3===_0xf9b5('0x7d')||_0x150ff3===_0xf9b5('0x7e')||_0x150ff3===_0xf9b5('0x7f')||_0x150ff3===_0xf9b5('0x80')||_0x150ff3===_0xf9b5('0x81')||_0x150ff3==='rtpaudioqosjitterbridged'||_0x150ff3===_0xf9b5('0x82')||_0x150ff3===_0xf9b5('0x83')||_0x150ff3===_0xf9b5('0x84')||_0x150ff3===_0xf9b5('0x85')||_0x150ff3===_0xf9b5('0x7f')||_0x150ff3===_0xf9b5('0x80')||_0x150ff3===_0xf9b5('0x81')||_0x150ff3==='rtpaudioqosjitterbridged'||_0x150ff3===_0xf9b5('0x82')||_0x150ff3===_0xf9b5('0x83')||_0x150ff3===_0xf9b5('0x84')||_0x150ff3===_0xf9b5('0x85')||_0x150ff3===_0xf9b5('0x86')||_0x150ff3===_0xf9b5('0x87')||_0x150ff3===_0xf9b5('0x30')||_0x150ff3===_0xf9b5('0x36')){return![];}return!![];};exports[_0xf9b5('0x88')]=function(_0x4913ee,_0x117678){var _0x4b91e4,_0x3a820f,_0x296d00;if(_0x117678<=0x0){_0x117678=0x1;}_0x4b91e4=new RegExp(_0xf9b5('0x89')+_0x117678+'}$');_0x3a820f=Math['pow'](0xa,_0x117678-0x1);_0x296d00=Math[_0xf9b5('0x8a')](0xa,_0x117678)-0x1;return util['format']('%s',_[_0xf9b5('0x8b')](_0x4913ee,_0x4b91e4,_[_0xf9b5('0x8c')](_0x3a820f,_0x296d00)));};exports['extractCalleridName']=function(_0x3f2cb6){var _0xfe7d25=_0x3f2cb6[_0xf9b5('0x8d')](/"(.*?)"/);return _0xfe7d25?_0xfe7d25[0x1]:_0x3f2cb6;};exports['extractCalleridNumber']=function(_0x48bea3){var _0x151b0c=_0x48bea3[_0xf9b5('0x8d')](/<(.*?)>/);return _0x151b0c?_0x151b0c[0x1]:_0x48bea3;};function buildNoAnswerEventPayload(_0x250e6d,_0x8465f6){var _0x4f39be=buildObj(_0x250e6d,_0xf9b5('0x8e'));if(!_[_0xf9b5('0x10')](_0x8465f6[_0xf9b5('0x8f')])){Object[_0xf9b5('0x90')](_0x8465f6[_0xf9b5('0x8f')])[_0xf9b5('0x91')](function(_0x1fc495){_0x4f39be[_0x1fc495[_0xf9b5('0x92')]()]=_0x8465f6['variables'][_0x1fc495];});}return _0x4f39be;}exports[_0xf9b5('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x8cbc=['monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','Blacklist','starttime','endtime','logAgent','statedesc','responsetime','ringtime','getSeconds','logLookAgent','membername','UserId','YYYY-MM-DD\x20HH:mm:ss','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','motionChannel','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','CampaignId','idContact','campaigntype','dialAnswer','active','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','isActive','isNil','Queue','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2'];(function(_0x4e005f,_0x3e7ba0){var _0x990170=function(_0x4c6549){while(--_0x4c6549){_0x4e005f['push'](_0x4e005f['shift']());}};_0x990170(++_0x3e7ba0);}(_0x8cbc,0x18b));var _0xc8cb=function(_0x2277e3,_0x21e6bf){_0x2277e3=_0x2277e3-0x0;var _0xeded2a=_0x8cbc[_0x2277e3];return _0xeded2a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xc8cb('0x0'));var logger=require(_0xc8cb('0x1'))(_0xc8cb('0x2'));var ipAgi=process[_0xc8cb('0x3')][_0xc8cb('0x4')]||_0xc8cb('0x5');var utils=require(_0xc8cb('0x6'));exports[_0xc8cb('0x7')]=function(_0x5e6acd){return function(_0x1c38cb){logger[_0xc8cb('0x8')](_0x5e6acd,util[_0xc8cb('0x9')](_0x1c38cb,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5756bf,_0x1d3b5f){logger[_0xc8cb('0xa')](_0x5756bf,util['inspect'](_0x1d3b5f,{'showHidden':![],'depth':null}));};exports[_0xc8cb('0xb')]=function(_0x50b2bc,_0x16bfbe){logger[_0xc8cb('0x8')](_0x50b2bc,util[_0xc8cb('0x9')](_0x16bfbe,{'showHidden':![],'depth':null}));};exports[_0xc8cb('0xc')]=function(_0x106d75){return function(_0x475d4d){logger[_0xc8cb('0xa')](_0x106d75,util[_0xc8cb('0x9')](_0x475d4d,{'showHidden':![],'depth':null}));};};exports[_0xc8cb('0xd')]=function(_0x14f881,_0x447159,_0x112b67){return{'message':_0x14f881,'unlock':_0x447159,'active':_0x112b67};};exports[_0xc8cb('0xe')]=function(_0x3dcaf0,_0xda8acf,_0x2083b5){if(!_[_0xc8cb('0xf')](_0x2083b5)&&'string'===typeof _0x2083b5&&!_[_0xc8cb('0x10')](_0x2083b5)){if(!_[_0xc8cb('0xf')](_0xda8acf)&&_0xc8cb('0x11')===typeof _0xda8acf&&!_['isEmpty'](_0xda8acf)){return util[_0xc8cb('0x12')](_0xc8cb('0x13'),_0xda8acf,_0x2083b5);}return util[_0xc8cb('0x12')](_0xc8cb('0x13'),_0x2083b5,_0x2083b5);}if(!_[_0xc8cb('0xf')](_0x3dcaf0)&&_0xc8cb('0x11')===typeof _0x3dcaf0&&!_[_0xc8cb('0x10')](_0x3dcaf0)){return _0x3dcaf0;}return'\x22\x22\x20<>';};exports[_0xc8cb('0x14')]=function(_0x15c39d){if(_[_0xc8cb('0x15')](_0x15c39d)){return![];}return _0x15c39d;};exports['addVariables']=function(_0x3cd48f,_0xe1cf06,_0x4c8abd,_0x1512dd,_0x479156,_0xdeae61){var _0x1c9694={'XMD-QUEUE':_0xe1cf06[_0xc8cb('0x16')]?_0xe1cf06[_0xc8cb('0x16')]['name']:'','XMD-CALLERID':_0x1512dd,'XMD-CALLERID-PREVIEW':_0xdeae61?util[_0xc8cb('0x12')](_0xc8cb('0x13'),_0xdeae61['calleridname'],_0xdeae61[_0xc8cb('0x17')]):_0x1512dd,'XMD-DIALID':_0x479156,'XMD-CONTACTID':_0xe1cf06[_0xc8cb('0x18')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1512dd,'XMD-VOICEQUEUEID':_0xe1cf06['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4c8abd,'XMD-DIALTIMEOUT':_0x3cd48f[_0xc8cb('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0xc8cb('0x12')](_0xc8cb('0x1a'),_0x3cd48f[_0xc8cb('0x1b')]?'g':'',_[_0xc8cb('0x10')](_0x3cd48f[_0xc8cb('0x1c')])?'':_0xc8cb('0x1d')),'XMD-DIALURL':_0x3cd48f['dialPreviewUrl']||'','XMD-AGI':_0x3cd48f['dialQueueProject']?util['format'](_0xc8cb('0x1e'),ipAgi,_0x3cd48f[_0xc8cb('0x1f')]):_0xc8cb('0x20'),'XMD-AGIAFTER':_0x3cd48f[_0xc8cb('0x1b')]?util[_0xc8cb('0x12')](_0xc8cb('0x1e'),ipAgi,_0x3cd48f[_0xc8cb('0x1b')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0xdeae61?_0xdeae61[_0xc8cb('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0xdeae61?_0xdeae61[_0xc8cb('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xc8cb('0x10')](_0x3cd48f[_0xc8cb('0x1c')])){_0x1c9694[util[_0xc8cb('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x3cd48f[_0xc8cb('0x1c')];_0x1c9694[util[_0xc8cb('0x12')]('%s',_0xc8cb('0x23'))]=_0x479156;}return _0x1c9694;};exports['toLowerVariables']=function(_0x6e5a1a){var _0x242aaf={};for(var _0x15d431 in _0x6e5a1a){if(_0x6e5a1a[_0xc8cb('0x24')](_0x15d431)){_0x242aaf[util[_0xc8cb('0x12')]('%s',_[_0xc8cb('0x25')](_0x15d431))]=_0x6e5a1a[_0x15d431];}}return{'variables':_0x242aaf};};exports[_0xc8cb('0x26')]=function(_0x126da7,_0x80c67d){if(!_[_0xc8cb('0x15')](_0x126da7)){if(_0x126da7[_0xc8cb('0x24')]('originated')){if(_0x126da7[_0xc8cb('0x27')]>0x0){_0x126da7[_0xc8cb('0x27')]-=0x1;}else{logger[_0xc8cb('0x8')](_0xc8cb('0x28'),_0x80c67d);}}}else{logger[_0xc8cb('0x8')](_0xc8cb('0x29'),_0x80c67d);}};exports[_0xc8cb('0x2a')]=function(_0x2c057e){var _0x581bf2=moment()[_0xc8cb('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c057e[_0xc8cb('0x2b')]=0xd;_0x2c057e['statedesc']=_0xc8cb('0x2c');_0x2c057e[_0xc8cb('0x2d')]=_0x581bf2;_0x2c057e['responsetime']=_0x581bf2;_0x2c057e[_0xc8cb('0x2e')]=_0x581bf2;};exports[_0xc8cb('0x2f')]=function(_0x2489f0,_0x1ab30e,_0xbaf9d1){var _0x37bdba=moment()[_0xc8cb('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2489f0[_0xc8cb('0x2b')]=_0x1ab30e;_0x2489f0[_0xc8cb('0x30')]=_0xbaf9d1;_0x2489f0[_0xc8cb('0x31')]=_0x37bdba;_0x2489f0[_0xc8cb('0x32')]=utils[_0xc8cb('0x33')](_0x2489f0['responsetime'],_0x2489f0[_0xc8cb('0x2d')]);};exports[_0xc8cb('0x34')]=function(_0x309750,_0x35205c,_0x216b36){_0x309750[_0xc8cb('0x35')]=_0x35205c;_0x309750[_0xc8cb('0x36')]=_0x216b36;};exports['logCustomer']=function(_0x3d5a26,_0x3785c8,_0xdbb364){var _0x13b691=moment()[_0xc8cb('0x12')](_0xc8cb('0x37'));_0x3d5a26[_0xc8cb('0x2b')]=_0x3785c8;_0x3d5a26[_0xc8cb('0x30')]=_0xdbb364;_0x3d5a26[_0xc8cb('0x31')]=_0x3d5a26['responsetime']?_0x3d5a26[_0xc8cb('0x31')]:_0x13b691;_0x3d5a26[_0xc8cb('0x2e')]=_0x3d5a26[_0xc8cb('0x2e')]?_0x3d5a26[_0xc8cb('0x2e')]:_0x13b691;_0x3d5a26[_0xc8cb('0x32')]=utils[_0xc8cb('0x33')](_0x3d5a26[_0xc8cb('0x31')]||0x0,_0x3d5a26['starttime']||0x0);_0x3d5a26['talktime']=_0x3d5a26[_0xc8cb('0x38')]?utils[_0xc8cb('0x33')](_0x3d5a26['endtime'],_0x3d5a26[_0xc8cb('0x38')]):0x0;};exports[_0xc8cb('0x39')]=function(_0x2264b7){return _0x2264b7===_0xc8cb('0x3a');};exports[_0xc8cb('0x3b')]=function(_0x3e1e4f,_0x463933,_0x487235,_0x4cbeb9,_0x320923){var _0x51b9a8=_0x4cbeb9?_0xc8cb('0x3c'):_0x3e1e4f[_0xc8cb('0x3d')];_0x51b9a8=_0x320923?_0xc8cb('0x3e'):_0x51b9a8;return{'actionid':_0x3e1e4f[_0xc8cb('0x3f')],'action':_0xc8cb('0x40'),'channel':_0x3e1e4f[_0xc8cb('0x41')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x51b9a8,_0x3e1e4f[_0xc8cb('0x17')]),'Exten':_0xc8cb('0x42'),'Context':_0xc8cb('0x43'),'Priority':'1','variable':_0x487235,'timeout':(_0x463933[_0xc8cb('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3e1e4f[_0xc8cb('0x3f')]};};exports[_0xc8cb('0x45')]=function(_0x41fe24){return _0x41fe24[_0xc8cb('0x46')]+_0x41fe24['countcongestionretry']+_0x41fe24[_0xc8cb('0x47')]+_0x41fe24[_0xc8cb('0x48')]+_0x41fe24[_0xc8cb('0x49')];};exports['cloneAction']=function(_0x447a15){var _0x271ed0=_[_0xc8cb('0x4a')](_0x447a15);_0x271ed0[_0xc8cb('0x2b')]=0xf;_0x271ed0['statedesc']=_0xc8cb('0x4b');return _0x271ed0;};exports[_0xc8cb('0x4c')]=function(_0x42039d,_0x11e28a,_0x1a0661){var _0x68f8d7={};_0x68f8d7[_0x11e28a]=_0x42039d[_0x11e28a];_0x68f8d7['active']=![];_0x68f8d7[_0xc8cb('0x4d')]=moment()[_0xc8cb('0x4e')](_0x1a0661,_0xc8cb('0x4f'))[_0xc8cb('0x12')](_0xc8cb('0x37'));_0x68f8d7['ContactId']=_0x42039d[_0xc8cb('0x18')];_0x68f8d7[_0xc8cb('0x50')]=_0x42039d[_0xc8cb('0x50')];_0x68f8d7[_0xc8cb('0x51')]=_0x42039d[_0xc8cb('0x51')]||undefined;return _0x68f8d7;};exports[_0xc8cb('0x52')]=function(_0x2f2903,_0x153ed9){if(!_[_0xc8cb('0x15')](_0x2f2903)){if(_0x2f2903['pTalking']>0x0){_0x2f2903[_0xc8cb('0x53')]-=0x1;}else{logger['error'](_0x153ed9,_0xc8cb('0x54'));}}else{logger[_0xc8cb('0x8')](_0x153ed9,_0xc8cb('0x55'));}};exports[_0xc8cb('0x56')]=function(_0x9dd061){if(_0x9dd061<=0x0){return!![];}return![];};function buildObj(_0x5edcd1,_0x251166,_0x41802e){_0x5edcd1[_0xc8cb('0x57')]=_0x251166;_0x5edcd1[_0xc8cb('0x58')]=_0x5edcd1[_0xc8cb('0x59')];_0x5edcd1['interface']=_0x5edcd1[_0xc8cb('0x41')];_0x5edcd1[_0xc8cb('0x5a')]='voice';if(_0x41802e){_0x5edcd1['mandatoryDisposition']=_0x41802e[_0xc8cb('0x5b')];}return _0x5edcd1;}exports['buildObj']=buildObj;exports[_0xc8cb('0x5c')]=function(_0x3160bd){var _0x42c45a={};_0x42c45a['queue']=_0x3160bd[_0xc8cb('0x59')];_0x42c45a[_0xc8cb('0x5d')]=_0x3160bd[_0xc8cb('0x41')];_0x42c45a[_0xc8cb('0x3f')]=_0x3160bd[_0xc8cb('0x3f')];return _0x42c45a;};exports[_0xc8cb('0x5e')]=function(_0xf76de9){var _0x2ffca6=[];for(var _0x139036 in _0xf76de9){if(_0xf76de9[_0xc8cb('0x24')](_0x139036)){if(!_[_0xc8cb('0x15')](_0xf76de9[_0x139036])&&_0xf76de9[_0x139036][_0xc8cb('0x2b')]===_0xc8cb('0x5f')&&_0xf76de9[_0x139036][_0xc8cb('0x60')]===_0xc8cb('0x61')){_0x2ffca6[_0xc8cb('0x62')](_0xf76de9[_0x139036]['id']);}}}return _0x2ffca6;};exports[_0xc8cb('0x63')]=function(_0x1954c3){var _0x481355=moment()[_0xc8cb('0x64')](0x0);var _0x1e4cc4=moment(_0x1954c3)[_0xc8cb('0x64')](0x0);return _0x481355['diff'](_0x1e4cc4,'seconds');};exports['createBody']=function(_0x30d454){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x30d454[_0xc8cb('0x18')],'ListId':_0x30d454[_0xc8cb('0x50')],'VoiceQueueId':_0x30d454['VoiceQueueId']||undefined,'CampaignId':_0x30d454[_0xc8cb('0x65')]||undefined};};exports['filterKey']=function(_0x4ac9dd){if(_0x4ac9dd===_0xc8cb('0x3f')||_0x4ac9dd===_0xc8cb('0x66')||_0x4ac9dd==='queue'||_0x4ac9dd==='type'||_0x4ac9dd===_0xc8cb('0x67')||_0x4ac9dd===_0xc8cb('0x68')||_0x4ac9dd===_0xc8cb('0x35')||_0x4ac9dd===_0xc8cb('0x41')||_0x4ac9dd===_0xc8cb('0x3d')||_0x4ac9dd===_0xc8cb('0x69')||_0x4ac9dd==='calleridnum'||_0x4ac9dd===_0xc8cb('0x4d')||_0x4ac9dd===_0xc8cb('0x46')||_0x4ac9dd===_0xc8cb('0x6a')||_0x4ac9dd===_0xc8cb('0x47')||_0x4ac9dd==='countglobal'||_0x4ac9dd===_0xc8cb('0x6b')||_0x4ac9dd===_0xc8cb('0x6c')||_0x4ac9dd===_0xc8cb('0x6d')||_0x4ac9dd===_0xc8cb('0x6e')||_0x4ac9dd===_0xc8cb('0x18')||_0x4ac9dd===_0xc8cb('0x50')||_0x4ac9dd===_0xc8cb('0x36')||_0x4ac9dd===_0xc8cb('0x51')||_0x4ac9dd===_0xc8cb('0x6f')||_0x4ac9dd===_0xc8cb('0x70')||_0x4ac9dd===_0xc8cb('0x71')||_0x4ac9dd===_0xc8cb('0x72')||_0x4ac9dd==='xmd-listid'||_0x4ac9dd==='xmd-dialurl'||_0x4ac9dd===_0xc8cb('0x73')||_0x4ac9dd===_0xc8cb('0x74')||_0x4ac9dd===_0xc8cb('0x75')||_0x4ac9dd===_0xc8cb('0x76')||_0x4ac9dd===_0xc8cb('0x77')||_0x4ac9dd===_0xc8cb('0x78')||_0x4ac9dd===_0xc8cb('0x79')||_0x4ac9dd===_0xc8cb('0x7a')||_0x4ac9dd==='xmd-agi'||_0x4ac9dd===_0xc8cb('0x7b')||_0x4ac9dd===_0xc8cb('0x7c')||_0x4ac9dd==='rtpaudioqosjitter'||_0x4ac9dd==='rtpaudioqosjitterbridged'||_0x4ac9dd===_0xc8cb('0x7d')||_0x4ac9dd===_0xc8cb('0x7e')||_0x4ac9dd===_0xc8cb('0x7f')||_0x4ac9dd===_0xc8cb('0x80')||_0x4ac9dd===_0xc8cb('0x7b')||_0x4ac9dd===_0xc8cb('0x7c')||_0x4ac9dd===_0xc8cb('0x81')||_0x4ac9dd==='rtpaudioqosjitterbridged'||_0x4ac9dd==='rtpaudioqosloss'||_0x4ac9dd===_0xc8cb('0x7e')||_0x4ac9dd===_0xc8cb('0x7f')||_0x4ac9dd===_0xc8cb('0x80')||_0x4ac9dd==='bridgepeer'||_0x4ac9dd===_0xc8cb('0x82')||_0x4ac9dd===_0xc8cb('0x2b')||_0x4ac9dd===_0xc8cb('0x30')){return![];}return!![];};exports[_0xc8cb('0x83')]=function(_0x5e1b12,_0x168040){var _0x54bf12,_0x130a4d,_0xdd1119;if(_0x168040<=0x0){_0x168040=0x1;}_0x54bf12=new RegExp('\x5cw{0,'+_0x168040+'}$');_0x130a4d=Math[_0xc8cb('0x84')](0xa,_0x168040-0x1);_0xdd1119=Math[_0xc8cb('0x84')](0xa,_0x168040)-0x1;return util[_0xc8cb('0x12')]('%s',_['replace'](_0x5e1b12,_0x54bf12,_[_0xc8cb('0x85')](_0x130a4d,_0xdd1119)));};exports[_0xc8cb('0x86')]=function(_0x226327){var _0x1fe180=_0x226327[_0xc8cb('0x87')](/"(.*?)"/);return _0x1fe180?_0x1fe180[0x1]:_0x226327;};exports[_0xc8cb('0x88')]=function(_0x34e171){var _0x48ef88=_0x34e171[_0xc8cb('0x87')](/<(.*?)>/);return _0x48ef88?_0x48ef88[0x1]:_0x34e171;};function buildNoAnswerEventPayload(_0x43c985,_0x525449){var _0x91da5a=buildObj(_0x43c985,_0xc8cb('0x89'));if(!_[_0xc8cb('0x10')](_0x525449[_0xc8cb('0x8a')])){Object[_0xc8cb('0x8b')](_0x525449[_0xc8cb('0x8a')])[_0xc8cb('0x8c')](function(_0x25e9d6){_0x91da5a[_0x25e9d6['toLowerCase']()]=_0x525449[_0xc8cb('0x8a')][_0x25e9d6];});}return _0x91da5a;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index bfeecfa..6f58cb2 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 _0x1600=['string','number','boolean','queueremove','reload','voicechannel'];(function(_0x43d16c,_0x2b5447){var _0x208cce=function(_0x371720){while(--_0x371720){_0x43d16c['push'](_0x43d16c['shift']());}};_0x208cce(++_0x2b5447);}(_0x1600,0x174));var _0x0160=function(_0x5311ea,_0x5d9796){_0x5311ea=_0x5311ea-0x0;var _0x3e7726=_0x1600[_0x5311ea];return _0x3e7726;};'use strict';exports['queueadd']={'queue':{'type':_0x0160('0x0'),'required':!![]},'interface':{'type':_0x0160('0x0'),'required':!![]},'membername':{'type':_0x0160('0x0'),'required':!![]},'penalty':{'type':_0x0160('0x1'),'required':![]},'paused':{'type':_0x0160('0x2'),'required':![]}};exports[_0x0160('0x3')]={'queue':{'type':_0x0160('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x0160('0x0'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x0160('0x0'),'required':![]}};exports[_0x0160('0x4')]={'module':{'type':_0x0160('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x0160('0x0'),'required':!![]}};exports[_0x0160('0x5')]={'uniqueid':{'type':_0x0160('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x0160('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x0160('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x0160('0x0')}}; \ No newline at end of file +var _0xa6ed=['boolean','queueremove','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0x527e4a,_0x18b84c){var _0x2b6622=function(_0x1404e8){while(--_0x1404e8){_0x527e4a['push'](_0x527e4a['shift']());}};_0x2b6622(++_0x18b84c);}(_0xa6ed,0x1bf));var _0xda6e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa6ed[_0x2c91e9];return _0x13f0ff;};'use strict';exports[_0xda6e('0x0')]={'queue':{'type':_0xda6e('0x1'),'required':!![]},'interface':{'type':_0xda6e('0x1'),'required':!![]},'membername':{'type':_0xda6e('0x1'),'required':!![]},'penalty':{'type':_0xda6e('0x2'),'required':![]},'paused':{'type':_0xda6e('0x3'),'required':![]}};exports[_0xda6e('0x4')]={'queue':{'type':_0xda6e('0x1'),'required':!![]},'interface':{'type':_0xda6e('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xda6e('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xda6e('0x1'),'required':![]}};exports[_0xda6e('0x5')]={'module':{'type':_0xda6e('0x1'),'required':![]}};exports[_0xda6e('0x6')]={'uniqueid':{'type':_0xda6e('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xda6e('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xda6e('0x1')},'mixmonitorid':{'type':_0xda6e('0x1')}};exports[_0xda6e('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xda6e('0x8')]={'uniqueid':{'type':_0xda6e('0x1'),'required':!![]},'exten':{'type':_0xda6e('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 2e38d35..fc6af32 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x16155b,_0x327ce6){var _0xffdd06=function(_0x16dccc){while(--_0x16dccc){_0x16155b['push'](_0x16155b['shift']());}};_0xffdd06(++_0x327ce6);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ad9b4,_0x5df9ed){_0x1ad9b4=_0x1ad9b4-0x0;var _0xbbee74=_0xb10b[_0x1ad9b4];return _0xbbee74;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _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(_0xa6bc7b,_0x2169e8){var _0x1e77b8=function(_0x2bf02c){while(--_0x2bf02c){_0xa6bc7b['push'](_0xa6bc7b['shift']());}};_0x1e77b8(++_0x2169e8);}(_0xb10b,0x12a));var _0xbb10=function(_0x5baf32,_0x103278){_0x5baf32=_0x5baf32-0x0;var _0x539cae=_0xb10b[_0x5baf32];return _0x539cae;};'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 3659197..e96a26b 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 _0xa651=['hasOwnProperty'];(function(_0x450095,_0x46c13e){var _0x37cabc=function(_0x68defb){while(--_0x68defb){_0x450095['push'](_0x450095['shift']());}};_0x37cabc(++_0x46c13e);}(_0xa651,0xfb));var _0x1a65=function(_0x254bbe,_0x44612d){_0x254bbe=_0x254bbe-0x0;var _0x42aae4=_0xa651[_0x254bbe];return _0x42aae4;};'use strict';function mergeDBDataToRealtime(_0x49bf92,_0x17b170){var _0x48fcd3=Object['assign']({},_0x49bf92);for(var _0x2e66b9 in _0x17b170){if(_0x48fcd3[_0x1a65('0x0')](_0x2e66b9)){_0x48fcd3[_0x2e66b9]=_0x17b170[_0x2e66b9];}}return _0x48fcd3;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0xa33a=['assign','mergeDBDataToRealtime'];(function(_0x230ce1,_0x3c463a){var _0x1e05fc=function(_0x251938){while(--_0x251938){_0x230ce1['push'](_0x230ce1['shift']());}};_0x1e05fc(++_0x3c463a);}(_0xa33a,0x15a));var _0xaa33=function(_0x41da76,_0x4055a3){_0x41da76=_0x41da76-0x0;var _0x3a6ece=_0xa33a[_0x41da76];return _0x3a6ece;};'use strict';function mergeDBDataToRealtime(_0x34e444,_0x388b64){var _0x1248cf=Object[_0xaa33('0x0')]({},_0x34e444);for(var _0x3d5731 in _0x388b64){if(_0x1248cf['hasOwnProperty'](_0x3d5731)){_0x1248cf[_0x3d5731]=_0x388b64[_0x3d5731];}}return _0x1248cf;}exports[_0xaa33('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 61101f7..613cfb1 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 _0xfe7f=['monitor','monitorFilename','monitors','filename','createdAt','calleridname','connectedlinename','isArray','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','voiceDialReport','blindTransfer','transfererlinkedid','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','agents','telephones','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','blindtransfer','prototype','findAgent','accountcode','name','isNil','find','format','length','connectedlinenum','assigned','lastAssignedTo','interface','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','channel','split','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','membername'];(function(_0x304708,_0x243f40){var _0x5ea96e=function(_0xdbbdaf){while(--_0xdbbdaf){_0x304708['push'](_0x304708['shift']());}};_0x5ea96e(++_0x243f40);}(_0xfe7f,0x132));var _0xffe7=function(_0x2520eb,_0x54c6b3){_0x2520eb=_0x2520eb-0x0;var _0x3ca1b6=_0xfe7f[_0x2520eb];return _0x3ca1b6;};'use strict';var _=require(_0xffe7('0x0'));var moment=require(_0xffe7('0x1'));var util=require(_0xffe7('0x2'));var config=require(_0xffe7('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xffe7('0x4'));var RpcVoiceCallReport=require(_0xffe7('0x5'));var RpcVoiceDialReport=require(_0xffe7('0x6'));var RpcMemberReport=require(_0xffe7('0x7'));var RpcVoiceQueueReport=require(_0xffe7('0x8'));var RpcVoiceRecording=require(_0xffe7('0x9'));var RpcVoiceTransferReport=require(_0xffe7('0xa'));var VoiceQueueReport=require(_0xffe7('0xb'));var VoiceCallReport=require(_0xffe7('0xc'));var VoiceAgentReport=require(_0xffe7('0xd'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0xa7fdbd){this['realtime']=_0xa7fdbd;this[_0xffe7('0xe')]=_0xa7fdbd['agents'];this[_0xffe7('0xf')]=_0xa7fdbd['telephones'];}Report['prototype'][_0xffe7('0x10')]=function(_0x470e9f){var _0x13077f=new VoiceQueueReport(this['realtime']);var _0x9f64a7=new VoiceAgentReport(this['realtime']);var _0x4be8fe=new VoiceDialReport(this[_0xffe7('0x11')]);var _0x25f4e7=new VoiceCallReport(this[_0xffe7('0x11')]);var _0x10a123=new UserReport(this['realtime']);if(config[_0xffe7('0x12')]&&config['xdr'][_0xffe7('0x13')]){ami['on'](_0xffe7('0x14'),this[_0xffe7('0x15')]['bind'](this));ami['on'](_0xffe7('0x16'),this[_0xffe7('0x17')]['bind'](this));ami['on'](_0xffe7('0x18'),this[_0xffe7('0x19')][_0xffe7('0x1a')](this));ami['on'](_0xffe7('0x1b'),this['voiceDialReport'][_0xffe7('0x1a')](this));ami['on'](_0xffe7('0x1c'),this['blindTransfer'][_0xffe7('0x1a')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0xffe7('0x1a')](this));}};Report[_0xffe7('0x1d')][_0xffe7('0x1e')]=function(_0x21a8a5){var _0x2442c9;_0x2442c9=_['find'](this[_0xffe7('0xe')],function(_0x40ec27){return _0x40ec27[_0xffe7('0x1f')]==_0x21a8a5||_0x40ec27[_0xffe7('0x20')]==_0x21a8a5;});if(_[_0xffe7('0x21')](_0x2442c9)){var _0x398cde=_[_0xffe7('0x22')](this[_0xffe7('0xf')],function(_0xb14f92){return _0xb14f92[_0xffe7('0x1f')]==_0x21a8a5||_0xb14f92[_0xffe7('0x20')]==_0x21a8a5;});if(_0x398cde){_0x2442c9=_['find'](this[_0xffe7('0xe')],function(_0x75df5){return _0x75df5['interface']==util[_0xffe7('0x23')]('SIP/%s',_0x398cde[_0xffe7('0x20')]);});}}return _0x2442c9;};Report[_0xffe7('0x1d')]['voiceQueueReport']=function(_0x300bbc){for(var _0x41a5ac=0x0;_0x41a5ac<_0x300bbc[_0xffe7('0x24')];_0x41a5ac+=0x1){var _0x58785f=this['findAgent'](_0x300bbc[_0x41a5ac][_0xffe7('0x25')]);if(_0x58785f){_0x300bbc[_0x41a5ac][_0xffe7('0x1f')]=_0x58785f[_0xffe7('0x1f')];_0x300bbc[_0x41a5ac][_0xffe7('0x26')]=!![];_0x300bbc[_0x41a5ac][_0xffe7('0x27')]=_0x58785f[_0xffe7('0x20')];_0x300bbc[_0x41a5ac][_0xffe7('0x28')]=_['isNil'](_0x58785f[_0xffe7('0x28')])?util[_0xffe7('0x23')](_0xffe7('0x29'),_0x58785f[_0xffe7('0x20')]):_0x58785f[_0xffe7('0x28')];if(_0x300bbc[_0x41a5ac][_0xffe7('0x2a')]){_0x300bbc[_0x41a5ac][_0xffe7('0x2b')]=moment()['format'](_0xffe7('0x2c'));}if(_0x300bbc[_0x41a5ac]['queuecallerexit']){_0x300bbc[_0x41a5ac][_0xffe7('0x2d')]=moment()[_0xffe7('0x23')](_0xffe7('0x2c'));}RpcMemberReport[_0xffe7('0x15')](_0x300bbc[_0x41a5ac]);}RpcVoiceQueueReport[_0xffe7('0x2e')](_0x300bbc[_0x41a5ac]);}};function extractCalleridNumber(_0x11d9e2){var _0x32917f=_0x11d9e2[_0xffe7('0x2f')](/<(.*?)>/);return _0x32917f?_0x32917f[0x1]:_0x11d9e2;}Report[_0xffe7('0x1d')][_0xffe7('0x30')]=function(_0x1cff98){for(var _0x12b239=0x0;_0x12b239/);return _0x95e440?_0x95e440[0x1]:_0x552e03;}Report[_0x51a7('0x1c')][_0x51a7('0x2d')]=function(_0x66596e){for(var _0x1e9672=0x0;_0x1e9672',_0x479c63['calleridname'],_0x479c63[_0x51a7('0x32')]);}if(RpcVoiceTransferReport[_0x51a7('0x43')][_0x479c63['linkedid']]){var _0x50ea84=RpcVoiceTransferReport[_0x51a7('0x43')][_0x479c63[_0x51a7('0x44')]];_0x50ea84[_0x51a7('0x45')]=_0x479c63[_0x51a7('0x46')];RpcVoiceTransferReport['blindTransfer'](_0x50ea84);delete RpcVoiceTransferReport[_0x51a7('0x43')][_0x479c63[_0x51a7('0x44')]];}if(_[_0x51a7('0x27')](_0x479c63[_0x51a7('0x35')])){_0x479c63[_0x51a7('0x35')]=this[_0x51a7('0x2f')](_0x479c63);}if(_['isNil'](_0x479c63[_0x51a7('0x47')])){var _0x5233e0=_0x479c63[_0x51a7('0x30')][_0x51a7('0x31')]('-')[0x0];var _0x4a39f7=this[_0x51a7('0xe')][_0x5233e0];if(!_0x4a39f7)_0x4a39f7=this[_0x51a7('0x2d')](_0x479c63[_0x51a7('0x1e')]);if(_0x4a39f7){_0x479c63[_0x51a7('0x47')]=_0x4a39f7['id'];_0x479c63['membername']=_0x4a39f7[_0x51a7('0x1f')];}}RpcVoiceCallReport['create'](_0x479c63);if(_0x479c63[_0x51a7('0x48')]){for(var _0x243861=0x0;_0x243861<_0x479c63[_0x51a7('0x49')]['length'];_0x243861+=0x1){_0x479c63['monitorFilename']=_0x479c63[_0x51a7('0x49')][_0x243861][_0x51a7('0x4a')];_0x479c63[_0x51a7('0x4b')]=_0x479c63[_0x51a7('0x49')][_0x243861][_0x51a7('0x4b')];if(_0x479c63[_0x51a7('0x4c')]==_0x51a7('0x3d')){_0x479c63['calleridnum']=_0x479c63['connectedlinenum'];_0x479c63[_0x51a7('0x4d')]=_0x479c63['connectedlinename'];_0x479c63[_0x51a7('0x25')]=_0x479c63['accountcode'];_0x479c63[_0x51a7('0x4e')]=_0x479c63[_0x51a7('0x4f')];_0x479c63[_0x51a7('0x4c')]=_0x479c63['originatecalleridnum'];}else if(_0x479c63[_0x51a7('0x4c')]=='xcally-motion-dialer'){_0x479c63[_0x51a7('0x32')]=_0x479c63['destination'];_0x479c63[_0x51a7('0x4c')]=_0x479c63['originatecalleridnum'];}RpcVoiceRecording['create'](_0x479c63);}}};Report[_0x51a7('0x1c')][_0x51a7('0x50')]=function(_0x6f7d31){if(_[_0x51a7('0x51')](_0x6f7d31)){_0x6f7d31[_0x51a7('0x52')](function(_0x2275da){RpcVoiceAgentReport['create'](_0x2275da);});}else{RpcVoiceAgentReport[_0x51a7('0x2b')](_0x6f7d31);}};Report[_0x51a7('0x1c')][_0x51a7('0x18')]=function(_0x54494e){RpcVoiceDialReport['create'](_0x54494e);var _0x794e19;var _0x2fab9e;var _0x3f70bb=_0x54494e['channel'];if(_['startsWith'](_0x3f70bb,_0x51a7('0x53'))){_0x2fab9e=_0x3f70bb[_0x51a7('0x54')](_0x3f70bb[_0x51a7('0x55')]('/')+0x1,_0x3f70bb[_0x51a7('0x55')]('@'));_0x794e19=_[_0x51a7('0x20')](this['agents'],function(_0x2f8fd1){return _0x2f8fd1['mobile']==_0x2fab9e||_0x2f8fd1[_0x51a7('0x56')]==_0x2fab9e||_0x2f8fd1[_0x51a7('0x1e')]==_0x2fab9e;});}else{_0x2fab9e=_0x3f70bb[_0x51a7('0x54')](_0x3f70bb[_0x51a7('0x55')]('/')+0x1,_0x3f70bb[_0x51a7('0x57')]('-'));_0x794e19=this[_0x51a7('0x1d')](_0x2fab9e);}if(_0x794e19){_0x54494e[_0x51a7('0x21')]=_[_0x51a7('0x27')](_0x794e19[_0x51a7('0x21')])?util[_0x51a7('0x22')](_0x51a7('0x23'),_0x794e19[_0x51a7('0x1f')]):_0x794e19[_0x51a7('0x21')];_0x54494e[_0x51a7('0x4f')]=_0x794e19['name'];_0x54494e['accountcode']=_0x794e19['accountcode'];RpcMemberReport[_0x51a7('0x18')](_0x54494e);}};Report[_0x51a7('0x1c')][_0x51a7('0x1a')]=function(_0x5952b0){RpcVoiceTransferReport[_0x51a7('0x43')][_0x5952b0[_0x51a7('0x58')]]=_0x5952b0;};Report[_0x51a7('0x1c')][_0x51a7('0x59')]=function(_0x1844c7){RpcVoiceTransferReport['attendedTransfer'](_0x1844c7);};module[_0x51a7('0x5a')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 0f75827..103ee13 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0465=['util','ioredis','bluebird','../../../config/environment','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isNotNull','isUndefined','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','emit','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]','local','toLowerCase','device','stateTime','updateStatusRealtime','toNumber','telephone:%s','telephone:save','startsWith','substring','indexOf','mobile','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','registered','peer','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment'];(function(_0x3038ae,_0x3a7344){var _0x4fa5ac=function(_0x4a4166){while(--_0x4a4166){_0x3038ae['push'](_0x3038ae['shift']());}};_0x4fa5ac(++_0x3a7344);}(_0x0465,0xd6));var _0x5046=function(_0x15fc0a,_0x3758ca){_0x15fc0a=_0x15fc0a-0x0;var _0x3eccc2=_0x0465[_0x15fc0a];return _0x3eccc2;};'use strict';var _=require(_0x5046('0x0'));var moment=require(_0x5046('0x1'));var util=require(_0x5046('0x2'));var Redis=require(_0x5046('0x3'));var BPromise=require(_0x5046('0x4'));var config=require(_0x5046('0x5'));var logger=require('../../../config/logger')('ami');var ami=require(_0x5046('0x6'));config[_0x5046('0x7')]=_[_0x5046('0x8')](config[_0x5046('0x7')],{'host':_0x5046('0x9'),'port':0x18eb});var io=require(_0x5046('0xa'))(new Redis(config[_0x5046('0x7')]));function UserReport(_0x2c9c14){this[_0x5046('0xb')]=_0x2c9c14['trunks'];this[_0x5046('0xc')]=_0x2c9c14[_0x5046('0xc')];this['telephones']=_0x2c9c14[_0x5046('0xd')];ami['on'](_0x5046('0xe'),this[_0x5046('0xf')][_0x5046('0x10')](this));ami['on'](_0x5046('0x11'),this[_0x5046('0xf')][_0x5046('0x10')](this));ami['on']('devicestatechange',this[_0x5046('0x12')][_0x5046('0x10')](this));ami['on'](_0x5046('0x13'),this[_0x5046('0x14')][_0x5046('0x10')](this));return this[_0x5046('0x15')]();}function showSipRegistrations(){Promise[_0x5046('0x16')]()[_0x5046('0x17')](ami[_0x5046('0x18')]())[_0x5046('0x19')](function(_0x18901f){logger[_0x5046('0x1a')](_0x5046('0x1b'),util[_0x5046('0x1c')](_0x18901f,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x5046('0x16')]()[_0x5046('0x17')](ami[_0x5046('0x1d')]())[_0x5046('0x19')](function(_0x33e2ef){logger['error'](_0x5046('0x1e'),util[_0x5046('0x1c')](_0x33e2ef,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x5046('0x17')](ami[_0x5046('0x1f')]())[_0x5046('0x19')](function(_0x2e3adb){logger['error']('[userReport][sippeerstatus]',util[_0x5046('0x1c')](_0x2e3adb,{'showHidden':![],'depth':null}));});}UserReport[_0x5046('0x20')][_0x5046('0x15')]=function(){setInterval(function(){BPromise[_0x5046('0x16')]()[_0x5046('0x17')](showSipRegistrations())[_0x5046('0x17')](listDeviceStates())[_0x5046('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x5046('0x20')][_0x5046('0x21')]=function(_0x469a43){return _0x469a43!==null&&!_[_0x5046('0x22')](_0x469a43);};UserReport[_0x5046('0x20')]['emit']=function(_0x4567ed,_0x2434f7,_0x3b9086){io['to'](_0x4567ed)['emit'](_0x2434f7,_0x3b9086);};UserReport[_0x5046('0x20')][_0x5046('0xf')]=function(_0x1aa566){try{if(this['isNotNull'](_0x1aa566)){logger['info']('[userReport][registry]\x20registry:%s\x20state:%s',_0x1aa566[_0x5046('0x23')],_0x1aa566[_0x5046('0x24')]);logger[_0x5046('0x25')](_0x5046('0x26'),util[_0x5046('0x1c')](_0x1aa566,{'showHidden':![],'depth':null}));var _0x1c8e65=_[_0x5046('0x27')](this[_0x5046('0xb')],{'defaultuser':_0x1aa566[_0x5046('0x23')]});if(_0x1c8e65){_0x1aa566[_0x5046('0x28')]=_0x1aa566['state'];_[_0x5046('0x29')](_0x1c8e65,_[_0x5046('0x2a')](_0x1aa566,[_0x5046('0x2b'),_0x5046('0x2c'),_0x5046('0x23'),_0x5046('0x24')]));logger[_0x5046('0x25')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x1c8e65,{'showHidden':![],'depth':null}));this[_0x5046('0x2d')](util[_0x5046('0x2e')](_0x5046('0x2f'),_0x1c8e65[_0x5046('0x30')]),_0x5046('0x31'),_0x1c8e65);}}}catch(_0x15740d){logger[_0x5046('0x1a')]('[userReport][registry]',util[_0x5046('0x1c')](_0x15740d,{'showHidden':![],'depth':null}));}};UserReport[_0x5046('0x20')][_0x5046('0x12')]=function(_0x3107c0){try{if(this[_0x5046('0x21')](_0x3107c0)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x3107c0['device'],_0x3107c0[_0x5046('0x24')]);logger[_0x5046('0x25')](_0x5046('0x32'),util[_0x5046('0x1c')](_0x3107c0,{'showHidden':![],'depth':null}));if(this[_0x5046('0xc')][_0x3107c0['device']]){if(!this[_0x5046('0xc')][_0x3107c0['device']][_0x5046('0x33')]||_0x3107c0[_0x5046('0x24')][_0x5046('0x34')]()=='inuse'){this['agents'][_0x3107c0[_0x5046('0x35')]][_0x5046('0x33')]=![];if(this[_0x5046('0xc')][_0x3107c0[_0x5046('0x35')]][_0x5046('0x24')]!==_0x3107c0[_0x5046('0x24')][_0x5046('0x34')]()){this[_0x5046('0xc')][_0x3107c0[_0x5046('0x35')]][_0x5046('0x36')]=_['toNumber'](moment()[_0x5046('0x2e')]('x'));}this['agents'][_0x3107c0[_0x5046('0x35')]][_0x5046('0x24')]=_0x3107c0[_0x5046('0x24')][_0x5046('0x34')]();this['agents'][_0x3107c0['device']][_0x5046('0x37')](_0x3107c0);}}else if(this[_0x5046('0xd')][_0x3107c0['device']]){if(this[_0x5046('0xd')][_0x3107c0['device']]['state']!==_0x3107c0[_0x5046('0x24')]['toLowerCase']()){this['telephones'][_0x3107c0[_0x5046('0x35')]]['stateTime']=_[_0x5046('0x38')](moment()[_0x5046('0x2e')]('x'));}this[_0x5046('0xd')][_0x3107c0[_0x5046('0x35')]][_0x5046('0x24')]=_0x3107c0[_0x5046('0x24')]['toLowerCase']();logger[_0x5046('0x25')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x5046('0x1c')](this['telephones'][_0x3107c0[_0x5046('0x35')]],{'showHidden':![],'depth':null}));this[_0x5046('0x2d')](util[_0x5046('0x2e')](_0x5046('0x39'),this[_0x5046('0xd')][_0x3107c0[_0x5046('0x35')]]['name']),_0x5046('0x3a'),this[_0x5046('0xd')][_0x3107c0['device']]);}else if(this[_0x5046('0xb')][_0x3107c0['device']]){if(this[_0x5046('0xb')][_0x3107c0[_0x5046('0x35')]][_0x5046('0x24')]!==_0x3107c0['state'][_0x5046('0x34')]()){this[_0x5046('0xb')][_0x3107c0[_0x5046('0x35')]][_0x5046('0x36')]=_['toNumber'](moment()[_0x5046('0x2e')]('x'));}this[_0x5046('0xb')][_0x3107c0[_0x5046('0x35')]][_0x5046('0x24')]=_0x3107c0[_0x5046('0x24')]['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x5046('0x1c')](this[_0x5046('0xb')][_0x3107c0[_0x5046('0x35')]],{'showHidden':![],'depth':null}));this[_0x5046('0x2d')](util[_0x5046('0x2e')](_0x5046('0x2f'),this[_0x5046('0xb')][_0x3107c0[_0x5046('0x35')]][_0x5046('0x30')]),_0x5046('0x31'),this[_0x5046('0xb')][_0x3107c0[_0x5046('0x35')]]);}else if(_[_0x5046('0x3b')](_0x3107c0[_0x5046('0x35')],'Local')){var _0x5240db=_0x3107c0['device'];var _0xdb352=_0x5240db[_0x5046('0x3c')](_0x5240db[_0x5046('0x3d')]('/')+0x1,_0x5240db[_0x5046('0x3d')]('@'));var _0x48d847=_['find'](this[_0x5046('0xc')],function(_0x1e5816){return _0x1e5816[_0x5046('0x3e')]==_0xdb352||_0x1e5816['phone']==_0xdb352||_0x1e5816[_0x5046('0x3f')]==_0xdb352;});if(_0x48d847){if(_0x48d847[_0x5046('0x24')]!==_0x3107c0[_0x5046('0x24')][_0x5046('0x34')]()){_0x48d847[_0x5046('0x36')]=_[_0x5046('0x38')](moment()[_0x5046('0x2e')]('x'));}_0x48d847[_0x5046('0x24')]=_0x3107c0[_0x5046('0x24')]['toLowerCase']();_0x48d847[_0x5046('0x33')]=!![];_0x48d847[_0x5046('0x37')](_0x3107c0);}}}}catch(_0x484a39){logger[_0x5046('0x1a')]('[userReport][devicestatechange]',util['inspect'](_0x484a39,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x45ad4e){try{if(this['isNotNull'](_0x45ad4e)&&this[_0x5046('0x21')](_0x45ad4e[_0x5046('0x13')])){logger['info'](_0x5046('0x40'),_0x45ad4e['peer'],_0x45ad4e[_0x5046('0x41')],_0x45ad4e['peerstatus']);logger[_0x5046('0x25')](_0x5046('0x42'),util['inspect'](_0x45ad4e,{'showHidden':![],'depth':null}));if(this['agents'][_0x45ad4e['peer']]){if(!this['agents'][_0x45ad4e['peer']][_0x5046('0x33')]||_0x45ad4e['peerstatus']['toLowerCase']()==_0x5046('0x43')){this[_0x5046('0xc')][_0x45ad4e[_0x5046('0x44')]][_0x5046('0x33')]=![];this[_0x5046('0xc')][_0x45ad4e['peer']][_0x5046('0x45')]=_0x45ad4e[_0x5046('0x13')]['toLowerCase']();this[_0x5046('0xc')][_0x45ad4e[_0x5046('0x44')]][_0x5046('0x41')]=_0x45ad4e[_0x5046('0x41')];this[_0x5046('0xc')][_0x45ad4e[_0x5046('0x44')]][_0x5046('0x37')](_0x45ad4e);}}else if(this[_0x5046('0xd')][_0x45ad4e[_0x5046('0x44')]]){this['telephones'][_0x45ad4e[_0x5046('0x44')]][_0x5046('0x45')]=_0x45ad4e[_0x5046('0x13')][_0x5046('0x34')]();this[_0x5046('0xd')][_0x45ad4e[_0x5046('0x44')]][_0x5046('0x41')]=_0x45ad4e[_0x5046('0x41')];logger['debug']('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0x5046('0xd')][_0x45ad4e[_0x5046('0x44')]],{'showHidden':![],'depth':null}));this[_0x5046('0x2d')](util[_0x5046('0x2e')](_0x5046('0x39'),this['telephones'][_0x45ad4e['peer']][_0x5046('0x30')]),_0x5046('0x3a'),this[_0x5046('0xd')][_0x45ad4e[_0x5046('0x44')]]);}else if(this[_0x5046('0xb')][_0x45ad4e[_0x5046('0x44')]]){this['trunks'][_0x45ad4e[_0x5046('0x44')]][_0x5046('0x45')]=_0x45ad4e[_0x5046('0x13')][_0x5046('0x34')]();this['trunks'][_0x45ad4e[_0x5046('0x44')]][_0x5046('0x41')]=_0x45ad4e[_0x5046('0x41')];logger['debug'](_0x5046('0x46'),util['inspect'](this[_0x5046('0xb')][_0x45ad4e[_0x5046('0x44')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x5046('0x2e')](_0x5046('0x2f'),this[_0x5046('0xb')][_0x45ad4e[_0x5046('0x44')]][_0x5046('0x30')]),_0x5046('0x31'),this['trunks'][_0x45ad4e[_0x5046('0x44')]]);}}}catch(_0x427ea3){logger[_0x5046('0x1a')](_0x5046('0x42'),util['inspect'](_0x427ea3,{'showHidden':![],'depth':null}));}};module[_0x5046('0x47')]=UserReport; \ No newline at end of file +var _0x98e7=['defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]','find','stateRegistry','merge','omit','event','debug','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','format','telephone:%s','startsWith','Local','indexOf','mobile','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:save','[userReport][peerstatus]','lodash','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x98e7,0xd2));var _0x798e=function(_0x110dbf,_0x16a620){_0x110dbf=_0x110dbf-0x0;var _0x49e064=_0x98e7[_0x110dbf];return _0x49e064;};'use strict';var _=require(_0x798e('0x0'));var moment=require('moment');var util=require(_0x798e('0x1'));var Redis=require(_0x798e('0x2'));var BPromise=require(_0x798e('0x3'));var config=require(_0x798e('0x4'));var logger=require(_0x798e('0x5'))(_0x798e('0x6'));var ami=require(_0x798e('0x7'));config[_0x798e('0x8')]=_[_0x798e('0x9')](config[_0x798e('0x8')],{'host':_0x798e('0xa'),'port':0x18eb});var io=require(_0x798e('0xb'))(new Redis(config[_0x798e('0x8')]));function UserReport(_0x176a43){this[_0x798e('0xc')]=_0x176a43[_0x798e('0xc')];this[_0x798e('0xd')]=_0x176a43[_0x798e('0xd')];this['telephones']=_0x176a43[_0x798e('0xe')];ami['on']('registryentry',this[_0x798e('0xf')][_0x798e('0x10')](this));ami['on'](_0x798e('0x11'),this[_0x798e('0xf')][_0x798e('0x10')](this));ami['on'](_0x798e('0x12'),this[_0x798e('0x13')][_0x798e('0x10')](this));ami['on'](_0x798e('0x14'),this[_0x798e('0x15')][_0x798e('0x10')](this));return this[_0x798e('0x16')]();}function showSipRegistrations(){Promise[_0x798e('0x17')]()[_0x798e('0x18')](ami[_0x798e('0x19')]())[_0x798e('0x1a')](function(_0x49043b){logger[_0x798e('0x1b')](_0x798e('0x1c'),util[_0x798e('0x1d')](_0x49043b,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x798e('0x17')]()[_0x798e('0x18')](ami['actionDeviceStateList']())[_0x798e('0x1a')](function(_0x29ff96){logger[_0x798e('0x1b')](_0x798e('0x1e'),util[_0x798e('0x1d')](_0x29ff96,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami['actionSipPeerStatus']())[_0x798e('0x1a')](function(_0x46a52a){logger[_0x798e('0x1b')](_0x798e('0x1f'),util[_0x798e('0x1d')](_0x46a52a,{'showHidden':![],'depth':null}));});}UserReport[_0x798e('0x20')][_0x798e('0x16')]=function(){setInterval(function(){BPromise[_0x798e('0x17')]()['then'](showSipRegistrations())[_0x798e('0x18')](listDeviceStates())[_0x798e('0x18')](showPeersStatus());},0x32c8);};UserReport[_0x798e('0x20')]['isNotNull']=function(_0x13f13c){return _0x13f13c!==null&&!_[_0x798e('0x21')](_0x13f13c);};UserReport[_0x798e('0x20')]['emit']=function(_0x168b71,_0x351a1f,_0x320d96){io['to'](_0x168b71)[_0x798e('0x22')](_0x351a1f,_0x320d96);};UserReport[_0x798e('0x20')][_0x798e('0xf')]=function(_0x180b84){try{if(this[_0x798e('0x23')](_0x180b84)){logger[_0x798e('0x24')](_0x798e('0x25'),_0x180b84[_0x798e('0x26')],_0x180b84[_0x798e('0x27')]);logger['debug'](_0x798e('0x28'),util[_0x798e('0x1d')](_0x180b84,{'showHidden':![],'depth':null}));var _0x9477cf=_[_0x798e('0x29')](this[_0x798e('0xc')],{'defaultuser':_0x180b84['username']});if(_0x9477cf){_0x180b84[_0x798e('0x2a')]=_0x180b84['state'];_[_0x798e('0x2b')](_0x9477cf,_[_0x798e('0x2c')](_0x180b84,[_0x798e('0x2d'),'actionid',_0x798e('0x26'),_0x798e('0x27')]));logger[_0x798e('0x2e')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x9477cf,{'showHidden':![],'depth':null}));this[_0x798e('0x22')](util['format'](_0x798e('0x2f'),_0x9477cf[_0x798e('0x30')]),'trunk:save',_0x9477cf);}}}catch(_0x39280e){logger['error'](_0x798e('0x28'),util['inspect'](_0x39280e,{'showHidden':![],'depth':null}));}};UserReport[_0x798e('0x20')][_0x798e('0x13')]=function(_0x535402){try{if(this[_0x798e('0x23')](_0x535402)){logger['info'](_0x798e('0x31'),_0x535402[_0x798e('0x32')],_0x535402[_0x798e('0x27')]);logger[_0x798e('0x2e')](_0x798e('0x33'),util[_0x798e('0x1d')](_0x535402,{'showHidden':![],'depth':null}));if(this[_0x798e('0xd')][_0x535402['device']]){if(!this[_0x798e('0xd')][_0x535402[_0x798e('0x32')]][_0x798e('0x34')]||_0x535402[_0x798e('0x27')][_0x798e('0x35')]()==_0x798e('0x36')){this['agents'][_0x535402['device']][_0x798e('0x34')]=![];if(this['agents'][_0x535402[_0x798e('0x32')]][_0x798e('0x27')]!==_0x535402[_0x798e('0x27')][_0x798e('0x35')]()){this[_0x798e('0xd')][_0x535402[_0x798e('0x32')]][_0x798e('0x37')]=_[_0x798e('0x38')](moment()['format']('x'));}this[_0x798e('0xd')][_0x535402[_0x798e('0x32')]][_0x798e('0x27')]=_0x535402[_0x798e('0x27')][_0x798e('0x35')]();this[_0x798e('0xd')][_0x535402['device']][_0x798e('0x39')](_0x535402);}}else if(this[_0x798e('0xe')][_0x535402[_0x798e('0x32')]]){if(this[_0x798e('0xe')][_0x535402[_0x798e('0x32')]][_0x798e('0x27')]!==_0x535402[_0x798e('0x27')][_0x798e('0x35')]()){this['telephones'][_0x535402[_0x798e('0x32')]][_0x798e('0x37')]=_[_0x798e('0x38')](moment()[_0x798e('0x3a')]('x'));}this['telephones'][_0x535402['device']][_0x798e('0x27')]=_0x535402[_0x798e('0x27')]['toLowerCase']();logger[_0x798e('0x2e')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x798e('0x1d')](this[_0x798e('0xe')][_0x535402['device']],{'showHidden':![],'depth':null}));this[_0x798e('0x22')](util[_0x798e('0x3a')](_0x798e('0x3b'),this[_0x798e('0xe')][_0x535402['device']][_0x798e('0x30')]),'telephone:save',this[_0x798e('0xe')][_0x535402[_0x798e('0x32')]]);}else if(this[_0x798e('0xc')][_0x535402['device']]){if(this[_0x798e('0xc')][_0x535402[_0x798e('0x32')]]['state']!==_0x535402[_0x798e('0x27')][_0x798e('0x35')]()){this['trunks'][_0x535402[_0x798e('0x32')]][_0x798e('0x37')]=_[_0x798e('0x38')](moment()[_0x798e('0x3a')]('x'));}this[_0x798e('0xc')][_0x535402[_0x798e('0x32')]][_0x798e('0x27')]=_0x535402[_0x798e('0x27')][_0x798e('0x35')]();logger[_0x798e('0x2e')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x798e('0x1d')](this['trunks'][_0x535402[_0x798e('0x32')]],{'showHidden':![],'depth':null}));this[_0x798e('0x22')](util['format'](_0x798e('0x2f'),this[_0x798e('0xc')][_0x535402[_0x798e('0x32')]]['name']),'trunk:save',this[_0x798e('0xc')][_0x535402['device']]);}else if(_[_0x798e('0x3c')](_0x535402[_0x798e('0x32')],_0x798e('0x3d'))){var _0xcd573a=_0x535402[_0x798e('0x32')];var _0x3860bd=_0xcd573a['substring'](_0xcd573a[_0x798e('0x3e')]('/')+0x1,_0xcd573a[_0x798e('0x3e')]('@'));var _0x3bd3b7=_[_0x798e('0x29')](this[_0x798e('0xd')],function(_0x16899f){return _0x16899f[_0x798e('0x3f')]==_0x3860bd||_0x16899f['phone']==_0x3860bd||_0x16899f['accountcode']==_0x3860bd;});if(_0x3bd3b7){if(_0x3bd3b7[_0x798e('0x27')]!==_0x535402[_0x798e('0x27')][_0x798e('0x35')]()){_0x3bd3b7[_0x798e('0x37')]=_[_0x798e('0x38')](moment()[_0x798e('0x3a')]('x'));}_0x3bd3b7[_0x798e('0x27')]=_0x535402[_0x798e('0x27')]['toLowerCase']();_0x3bd3b7[_0x798e('0x34')]=!![];_0x3bd3b7[_0x798e('0x39')](_0x535402);}}}}catch(_0x7b2dd5){logger[_0x798e('0x1b')]('[userReport][devicestatechange]',util[_0x798e('0x1d')](_0x7b2dd5,{'showHidden':![],'depth':null}));}};UserReport[_0x798e('0x20')][_0x798e('0x15')]=function(_0x1fc5d2){try{if(this[_0x798e('0x23')](_0x1fc5d2)&&this['isNotNull'](_0x1fc5d2[_0x798e('0x14')])){logger['info'](_0x798e('0x40'),_0x1fc5d2[_0x798e('0x41')],_0x1fc5d2[_0x798e('0x42')],_0x1fc5d2[_0x798e('0x14')]);logger[_0x798e('0x2e')]('[userReport][peerstatus]',util[_0x798e('0x1d')](_0x1fc5d2,{'showHidden':![],'depth':null}));if(this['agents'][_0x1fc5d2[_0x798e('0x41')]]){if(!this['agents'][_0x1fc5d2[_0x798e('0x41')]][_0x798e('0x34')]||_0x1fc5d2[_0x798e('0x14')][_0x798e('0x35')]()==_0x798e('0x43')){this['agents'][_0x1fc5d2[_0x798e('0x41')]][_0x798e('0x34')]=![];this[_0x798e('0xd')][_0x1fc5d2[_0x798e('0x41')]][_0x798e('0x44')]=_0x1fc5d2[_0x798e('0x14')][_0x798e('0x35')]();this['agents'][_0x1fc5d2[_0x798e('0x41')]][_0x798e('0x42')]=_0x1fc5d2[_0x798e('0x42')];this[_0x798e('0xd')][_0x1fc5d2[_0x798e('0x41')]][_0x798e('0x39')](_0x1fc5d2);}}else if(this[_0x798e('0xe')][_0x1fc5d2[_0x798e('0x41')]]){this[_0x798e('0xe')][_0x1fc5d2[_0x798e('0x41')]]['status']=_0x1fc5d2['peerstatus'][_0x798e('0x35')]();this[_0x798e('0xe')][_0x1fc5d2['peer']][_0x798e('0x42')]=_0x1fc5d2[_0x798e('0x42')];logger['debug'](_0x798e('0x45'),util[_0x798e('0x1d')](this[_0x798e('0xe')][_0x1fc5d2[_0x798e('0x41')]],{'showHidden':![],'depth':null}));this[_0x798e('0x22')](util[_0x798e('0x3a')](_0x798e('0x3b'),this[_0x798e('0xe')][_0x1fc5d2[_0x798e('0x41')]][_0x798e('0x30')]),'telephone:save',this[_0x798e('0xe')][_0x1fc5d2[_0x798e('0x41')]]);}else if(this[_0x798e('0xc')][_0x1fc5d2['peer']]){this[_0x798e('0xc')][_0x1fc5d2[_0x798e('0x41')]][_0x798e('0x44')]=_0x1fc5d2[_0x798e('0x14')][_0x798e('0x35')]();this['trunks'][_0x1fc5d2[_0x798e('0x41')]][_0x798e('0x42')]=_0x1fc5d2[_0x798e('0x42')];logger['debug'](_0x798e('0x46'),util[_0x798e('0x1d')](this[_0x798e('0xc')][_0x1fc5d2[_0x798e('0x41')]],{'showHidden':![],'depth':null}));this[_0x798e('0x22')](util[_0x798e('0x3a')](_0x798e('0x2f'),this['trunks'][_0x1fc5d2[_0x798e('0x41')]][_0x798e('0x30')]),_0x798e('0x47'),this[_0x798e('0xc')][_0x1fc5d2[_0x798e('0x41')]]);}}}catch(_0x2e4f4d){logger[_0x798e('0x1b')](_0x798e('0x48'),util['inspect'](_0x2e4f4d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 3565cac..a93b8c1 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb85f=['user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','isNotNull','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','routealias','destconnectedlinenum','name','exten','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acw','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','syncVarSet','addVariable','hasOwnProperty','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','isNil','includes','syncHangup','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','agentcomplete','varset','musiconholdstart','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','syncAgentCalled','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','interface','variables','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','queue'];(function(_0x588630,_0x34ece7){var _0x5360bb=function(_0x4037d7){while(--_0x4037d7){_0x588630['push'](_0x588630['shift']());}};_0x5360bb(++_0x34ece7);}(_0xb85f,0x1a0));var _0xfb85=function(_0x56c6e2,_0x4e97db){_0x56c6e2=_0x56c6e2-0x0;var _0x47f783=_0xb85f[_0x56c6e2];return _0x47f783;};'use strict';var _=require('lodash');var moment=require(_0xfb85('0x0'));var util=require(_0xfb85('0x1'));var Redis=require(_0xfb85('0x2'));var config=require(_0xfb85('0x3'));var logger=require('../../../config/logger')(_0xfb85('0x4'));var ami=require(_0xfb85('0x5'));config[_0xfb85('0x6')]=_[_0xfb85('0x7')](config['redis'],{'host':_0xfb85('0x8'),'port':0x18eb});var io=require(_0xfb85('0x9'))(new Redis(config[_0xfb85('0x6')]));function VoiceAgentReport(_0x8afa45){this[_0xfb85('0xa')]={};this[_0xfb85('0xb')]=_0x8afa45['channels'];this[_0xfb85('0xc')]=_0x8afa45[_0xfb85('0xc')];this[_0xfb85('0xd')]=_0x8afa45[_0xfb85('0xd')];this['variables']={};ami['on'](_0xfb85('0xe'),this['syncAgentCalled']['bind'](this));ami['on'](_0xfb85('0xf'),this[_0xfb85('0x10')]['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xfb85('0x11')](this));ami['on']('queuecallerabandon',this[_0xfb85('0x12')]['bind'](this));ami['on'](_0xfb85('0x13'),this['syncAgentComplete'][_0xfb85('0x11')](this));ami['on'](_0xfb85('0x14'),this['syncVarSet'][_0xfb85('0x11')](this));ami['on']('hangup',this['syncHangup'][_0xfb85('0x11')](this));ami['on'](_0xfb85('0x15'),this['syncMusicOnHoldStart'][_0xfb85('0x11')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));ami['on'](_0xfb85('0x16'),this[_0xfb85('0x17')][_0xfb85('0x11')](this));ami['on'](_0xfb85('0x18'),this[_0xfb85('0x19')][_0xfb85('0x11')](this));}VoiceAgentReport[_0xfb85('0x1a')][_0xfb85('0x1b')]=function(_0x2c26a8,_0x4eb284,_0xd1cdbe){io['to'](_0x2c26a8)[_0xfb85('0x1b')](_0x4eb284,_0xd1cdbe);};VoiceAgentReport['prototype']['isNotNull']=function(_0x1863a8){return _0x1863a8!==null&&!_['isUndefined'](_0x1863a8);};VoiceAgentReport[_0xfb85('0x1a')][_0xfb85('0x1c')]=function(_0x277c4e){try{if(this['isNotNull'](_0x277c4e)){logger[_0xfb85('0x1d')](_0xfb85('0x1e'),_0x277c4e[_0xfb85('0x1f')],_0x277c4e[_0xfb85('0x20')],_0x277c4e[_0xfb85('0x21')]);logger[_0xfb85('0x22')](_0xfb85('0x23'),_0x277c4e[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x277c4e,{'showHidden':![],'depth':null}));if(_[_0xfb85('0x25')](this[_0xfb85('0xa')][_0x277c4e['uniqueid']])){this['channels'][_0x277c4e[_0xfb85('0x1f')]]={};}var _0x253f8c=this['agents'][_0x277c4e[_0xfb85('0x26')]];var _0x54ad39=this[_0xfb85('0xa')][_0x277c4e[_0xfb85('0x1f')]][_0x277c4e[_0xfb85('0x21')]];var _0x432165=this[_0xfb85('0xc')][_0x277c4e['queue']];var _0xcbe693=this[_0xfb85('0x27')][_0x277c4e[_0xfb85('0x1f')]];if(_[_0xfb85('0x25')](_0x54ad39)){_0x54ad39={'agentcalledAt':moment()[_0xfb85('0x28')](_0xfb85('0x29')),'lastevent':_0xfb85('0x2a'),'mandatoryDisposition':_0x432165&&_0x432165[_0xfb85('0x2b')]?_0x432165[_0xfb85('0x2b')]:![],'type':_0x432165&&_0x432165[_0xfb85('0x2c')]?_0x432165[_0xfb85('0x2c')]:_0xfb85('0x2d'),'variables':_0xcbe693,'motionChannel':_0xfb85('0x2e')};}Object[_0xfb85('0x2f')](_0x54ad39,_[_0xfb85('0x30')](_0x277c4e,[_0xfb85('0x31'),_0xfb85('0x32')]));this['channels'][_0x277c4e[_0xfb85('0x1f')]][_0x277c4e[_0xfb85('0x21')]]=_0x54ad39;logger['debug'](_0xfb85('0x33'),_0x277c4e['uniqueid'],util[_0xfb85('0x24')](_0x54ad39,{'showHidden':![],'depth':null}));ami[_0xfb85('0x1b')](_0xfb85('0x34'),_0x54ad39);var _0x489f51={'id':_0x253f8c['id'],'calleridnum':_0x54ad39[_0xfb85('0x35')],'queue':_0x54ad39[_0xfb85('0x36')],'variables':_0x54ad39['variables'],'uniqueid':_0x277c4e[_0xfb85('0x1f')]};logger[_0xfb85('0x22')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x277c4e[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x489f51,{'showHidden':![],'depth':null}));this[_0xfb85('0x1b')](util[_0xfb85('0x28')](_0xfb85('0x37'),_0x277c4e[_0xfb85('0x20')]),_0xfb85('0x38'),_0x489f51);}}catch(_0x2274fc){logger[_0xfb85('0x39')](_0xfb85('0x3a'),_0x277c4e[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x2274fc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb85('0x1a')][_0xfb85('0x10')]=function(_0x1349d1){try{if(this[_0xfb85('0x3b')](_0x1349d1)){if(this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]]){for(var _0x257837 in this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]]){if(this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]]['hasOwnProperty'](_0x257837)){if(_0x1349d1['destuniqueid']===_0x257837){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x1349d1[_0xfb85('0x1f')],_0x1349d1['membername'],_0x1349d1[_0xfb85('0x21')]);this[_0xfb85('0xa')][_0x1349d1['uniqueid']][_0x257837][_0xfb85('0x3c')]=moment()['format'](_0xfb85('0x29'));this[_0xfb85('0xa')][_0x1349d1['uniqueid']][_0x257837][_0xfb85('0x3d')]=_0x1349d1[_0xfb85('0x3d')];this['channels'][_0x1349d1[_0xfb85('0x1f')]][_0x257837][_0xfb85('0x3e')]=_0x1349d1['connectedlinenum'];this[_0xfb85('0xa')][_0x1349d1['uniqueid']][_0x257837]['destchannelstate']=_0x1349d1[_0xfb85('0x3f')];this[_0xfb85('0xa')][_0x1349d1['uniqueid']][_0x257837][_0xfb85('0x40')]=_0x1349d1['destchannelstatedesc'];this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x257837][_0xfb85('0x41')]=_0x1349d1['holdtime'];this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x257837]['lastevent']='connect';if(this['voiceChannels'][this[_0xfb85('0xa')][_0x1349d1['uniqueid']][_0x257837][_0xfb85('0x1f')]]){var _0x12c4bc=this[_0xfb85('0xb')][this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x257837][_0xfb85('0x1f')]][_0xfb85('0x42')];this['channels'][_0x1349d1[_0xfb85('0x1f')]][_0x257837]['routealias']=_0x12c4bc;_0x1349d1[_0xfb85('0x42')]=_0x12c4bc;}_['merge'](this[_0xfb85('0xd')][_0x1349d1[_0xfb85('0x26')]],_['pick'](_0x1349d1,[_0xfb85('0x36'),_0xfb85('0x43'),_0xfb85('0x42')]));var _0x285177=this[_0xfb85('0xd')][_0x1349d1[_0xfb85('0x26')]];var _0x1b234d={'id':_0x285177['id'],'name':_0x285177[_0xfb85('0x44')],'agentconnected':!![],'destaccountcode':_0x285177['accountcode'],'destconnectedlinenum':this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x1349d1[_0xfb85('0x21')]][_0xfb85('0x45')],'queue':this['channels'][_0x1349d1[_0xfb85('0x1f')]][_0x1349d1[_0xfb85('0x21')]]['queue'],'routealias':this['channels'][_0x1349d1[_0xfb85('0x1f')]][_0x1349d1['destuniqueid']][_0xfb85('0x42')],'uniqueid':this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x1349d1[_0xfb85('0x21')]][_0xfb85('0x1f')]};ami['emit'](_0xfb85('0x46'),this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x1349d1['destuniqueid']]);this['emit'](util[_0xfb85('0x28')](_0xfb85('0x37'),_0x1349d1['membername']),_0xfb85('0x47'),_0x1b234d);}else if(!this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x257837][_0xfb85('0x48')]&&!this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x257837][_0xfb85('0x13')]){logger[_0xfb85('0x1d')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x1349d1[_0xfb85('0x1f')],this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x257837][_0xfb85('0x20')],_0x257837);this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x257837][_0xfb85('0x48')]=!![];this['channels'][_0x1349d1[_0xfb85('0x1f')]][_0x257837][_0xfb85('0x49')]=moment()[_0xfb85('0x28')](_0xfb85('0x29'));this['channels'][_0x1349d1[_0xfb85('0x1f')]][_0x257837]['answeredelsewheredestinationuniqueid']=_0x1349d1[_0xfb85('0x21')];this['channels'][_0x1349d1[_0xfb85('0x1f')]][_0x257837]['answeredelsewheremembername']=_0x1349d1[_0xfb85('0x20')];this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x257837]['lastevent']=_0xfb85('0x4a');this[_0xfb85('0xa')][_0x1349d1['uniqueid']][_0x257837][_0xfb85('0x4b')]='answered_elsewhere';logger[_0xfb85('0x22')](_0xfb85('0x4c'),_0x1349d1[_0xfb85('0x1f')],util[_0xfb85('0x24')](this[_0xfb85('0xa')][_0x1349d1[_0xfb85('0x1f')]][_0x257837],{'showHidden':![],'depth':null}));ami[_0xfb85('0x1b')](_0xfb85('0x4d'),this[_0xfb85('0xa')][_0x1349d1['uniqueid']][_0x257837]);}else{logger[_0xfb85('0x22')](_0xfb85('0x4e'),_0x1349d1[_0xfb85('0x1f')]);}}}}}}catch(_0x5def6a){logger[_0xfb85('0x39')](_0xfb85('0x4f'),_0x1349d1['uniqueid'],util['inspect'](_0x5def6a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb85('0x1a')]['syncAgentRingNoAnswer']=function(_0x37c6c4){try{if(this[_0xfb85('0x3b')](_0x37c6c4)){logger[_0xfb85('0x22')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x37c6c4['uniqueid'],util[_0xfb85('0x24')](_0x37c6c4,{'showHidden':![],'depth':null}));if(this['channels'][_0x37c6c4[_0xfb85('0x1f')]]&&this[_0xfb85('0xa')][_0x37c6c4[_0xfb85('0x1f')]][_0x37c6c4[_0xfb85('0x21')]]){logger['info'](_0xfb85('0x50'),_0x37c6c4[_0xfb85('0x1f')],_0x37c6c4[_0xfb85('0x20')],_0x37c6c4[_0xfb85('0x21')]);var _0x1d0b9e=this['agents'][_0x37c6c4[_0xfb85('0x26')]];var _0x58c162=this[_0xfb85('0xa')][_0x37c6c4['uniqueid']][_0x37c6c4[_0xfb85('0x21')]];_0x58c162[_0xfb85('0x48')]=!![];_0x58c162[_0xfb85('0x49')]=moment()[_0xfb85('0x28')](_0xfb85('0x29'));_0x58c162[_0xfb85('0x51')]='rejected';_0x58c162[_0xfb85('0x4b')]=_0xfb85('0x52');var _0x20b729={'id':_0x1d0b9e['id'],'name':_0x1d0b9e[_0xfb85('0x44')],'queue':_0x58c162[_0xfb85('0x36')],'uniqueid':_0x58c162[_0xfb85('0x1f')]};logger[_0xfb85('0x22')](_0xfb85('0x53'),_0x37c6c4[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x20b729,{'showHidden':![],'depth':null}));this['emit'](util[_0xfb85('0x28')](_0xfb85('0x37'),_0x1d0b9e[_0xfb85('0x44')]),_0xfb85('0x54'),_0x20b729);ami['emit'](_0xfb85('0x55'),_0x58c162);this[_0xfb85('0xa')][_0x37c6c4[_0xfb85('0x1f')]][_0x37c6c4[_0xfb85('0x21')]]=Object['assign']({},_0x58c162);}}}catch(_0x3579e6){logger[_0xfb85('0x39')](_0xfb85('0x56'),_0x37c6c4[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x3579e6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfb85('0x12')]=function(_0x5bef26){try{if(this[_0xfb85('0x3b')](_0x5bef26)){logger['debug'](_0xfb85('0x57'),_0x5bef26[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x5bef26,{'showHidden':![],'depth':null}));if(this[_0xfb85('0xa')][_0x5bef26[_0xfb85('0x1f')]]){for(var _0xc37331 in this[_0xfb85('0xa')][_0x5bef26[_0xfb85('0x1f')]]){if(this[_0xfb85('0xa')][_0x5bef26[_0xfb85('0x1f')]]['hasOwnProperty'](_0xc37331)&&!this[_0xfb85('0xa')][_0x5bef26[_0xfb85('0x1f')]][_0xc37331][_0xfb85('0x48')]&&!this[_0xfb85('0xa')][_0x5bef26[_0xfb85('0x1f')]][_0xc37331]['agentcomplete']){logger[_0xfb85('0x1d')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x5bef26[_0xfb85('0x1f')],this[_0xfb85('0xa')][_0x5bef26[_0xfb85('0x1f')]][_0xc37331][_0xfb85('0x20')],_0xc37331);this['channels'][_0x5bef26['uniqueid']][_0xc37331][_0xfb85('0x48')]=!![];this[_0xfb85('0xa')][_0x5bef26[_0xfb85('0x1f')]][_0xc37331][_0xfb85('0x49')]=moment()[_0xfb85('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5bef26[_0xfb85('0x1f')]][_0xc37331][_0xfb85('0x51')]=_0xfb85('0x58');this[_0xfb85('0xa')][_0x5bef26[_0xfb85('0x1f')]][_0xc37331][_0xfb85('0x4b')]=_0xfb85('0x58');logger['debug'](_0xfb85('0x59'),_0x5bef26[_0xfb85('0x1f')],util[_0xfb85('0x24')](this[_0xfb85('0xa')][_0x5bef26[_0xfb85('0x1f')]][_0xc37331],{'showHidden':![],'depth':null}));ami[_0xfb85('0x1b')]('custom:agentqueuecallerabandon',this[_0xfb85('0xa')][_0x5bef26['uniqueid']][_0xc37331]);}}}}}catch(_0x2ef516){logger[_0xfb85('0x39')](_0xfb85('0x5a'),_0x5bef26['uniqueid'],util[_0xfb85('0x24')](_0x2ef516,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfb85('0x5b')]=function(_0x543fc0){try{if(this[_0xfb85('0x3b')](_0x543fc0)){logger[_0xfb85('0x22')](_0xfb85('0x5c'),_0x543fc0[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x543fc0,{'showHidden':![],'depth':null}));if(this[_0xfb85('0xa')][_0x543fc0[_0xfb85('0x1f')]]){for(var _0xdc90cf in this[_0xfb85('0xa')][_0x543fc0['uniqueid']]){if(this[_0xfb85('0xa')][_0x543fc0[_0xfb85('0x1f')]]['hasOwnProperty'](_0xdc90cf)){if(this[_0xfb85('0xa')][_0x543fc0[_0xfb85('0x1f')]][_0xdc90cf][_0xfb85('0x3c')]&&!this['channels'][_0x543fc0['uniqueid']][_0xdc90cf][_0xfb85('0x13')]){logger['info'](_0xfb85('0x5d'),_0x543fc0[_0xfb85('0x1f')],this[_0xfb85('0xa')][_0x543fc0[_0xfb85('0x1f')]][_0xdc90cf]['membername'],_0xdc90cf);this['channels'][_0x543fc0[_0xfb85('0x1f')]][_0xdc90cf][_0xfb85('0x13')]=!![];this['channels'][_0x543fc0[_0xfb85('0x1f')]][_0xdc90cf][_0xfb85('0x5e')]=moment()[_0xfb85('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x543fc0[_0xfb85('0x1f')]][_0xdc90cf][_0xfb85('0x51')]=_0xfb85('0x5f');this[_0xfb85('0xa')][_0x543fc0[_0xfb85('0x1f')]][_0xdc90cf]['reason']=_0x543fc0[_0xfb85('0x4b')]=='transfer'?_0xfb85('0x60'):_0x543fc0[_0xfb85('0x4b')];this[_0xfb85('0xa')][_0x543fc0[_0xfb85('0x1f')]][_0xdc90cf]['talktime']=_0x543fc0[_0xfb85('0x61')];if(this[_0xfb85('0xc')][_0x543fc0[_0xfb85('0x36')]]&&this[_0xfb85('0xc')][_0x543fc0[_0xfb85('0x36')]][_0xfb85('0x62')]){this[_0xfb85('0xa')][_0x543fc0[_0xfb85('0x1f')]][_0xdc90cf]['acwtime']=this['voiceQueues'][_0x543fc0['queue']][_0xfb85('0x63')];this[_0xfb85('0xa')][_0x543fc0[_0xfb85('0x1f')]][_0xdc90cf]['agentacw']=!![];}this[_0xfb85('0xd')][_0x543fc0[_0xfb85('0x26')]]=_[_0xfb85('0x30')](this['agents'][_0x543fc0[_0xfb85('0x26')]],[_0xfb85('0x36'),_0xfb85('0x43')]);logger[_0xfb85('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x543fc0[_0xfb85('0x1f')],util['inspect'](this[_0xfb85('0xa')][_0x543fc0[_0xfb85('0x1f')]][_0xdc90cf],{'showHidden':![],'depth':null}));ami[_0xfb85('0x1b')](_0xfb85('0x64'),this[_0xfb85('0xa')][_0x543fc0['uniqueid']][_0xdc90cf]);logger[_0xfb85('0x22')](_0xfb85('0x65'),_0x543fc0[_0xfb85('0x1f')],util[_0xfb85('0x24')]({'id':this['agents'][_0x543fc0[_0xfb85('0x26')]]['id'],'destaccountcode':_0x543fc0[_0xfb85('0x66')]},{'showHidden':![],'depth':null}));this[_0xfb85('0x1b')](util['format']('user:%s',_0x543fc0[_0xfb85('0x20')]),_0xfb85('0x67'),{'id':this[_0xfb85('0xd')][_0x543fc0[_0xfb85('0x26')]]['id'],'destaccountcode':Number(_0x543fc0[_0xfb85('0x66')])});}}}}}}catch(_0x349921){logger[_0xfb85('0x39')](_0xfb85('0x68'),_0x543fc0[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x349921,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb85('0x1a')][_0xfb85('0x69')]=function(_0x4df545){try{if(this['isNotNull'](_0x4df545)){logger[_0xfb85('0x22')]('[%s][voiceAgentReport][varset]\x20event:',_0x4df545['uniqueid'],util[_0xfb85('0x24')](_0x4df545,{'showHidden':![],'depth':null}));this[_0xfb85('0x6a')](_0x4df545['uniqueid'],_['keys'](_0x4df545['variable'])[0x0],_0x4df545['value']);if(this['channels'][_0x4df545[_0xfb85('0x1f')]]){for(var _0x217ccd in this[_0xfb85('0xa')][_0x4df545[_0xfb85('0x1f')]]){if(this[_0xfb85('0xa')][_0x4df545[_0xfb85('0x1f')]][_0xfb85('0x6b')](_0x217ccd)){logger[_0xfb85('0x1d')](_0xfb85('0x6c'),_0x4df545['uniqueid'],_0x217ccd,_[_0xfb85('0x6d')](_0x4df545[_0xfb85('0x6e')])[0x0],_0x4df545['value']);if(_[_0xfb85('0x25')](this[_0xfb85('0xa')][_0x4df545[_0xfb85('0x1f')]][_0x217ccd][_0xfb85('0x27')])){this[_0xfb85('0xa')][_0x4df545[_0xfb85('0x1f')]][_0x217ccd][_0xfb85('0x27')]={};}this[_0xfb85('0xa')][_0x4df545[_0xfb85('0x1f')]][_0x217ccd][_0xfb85('0x27')]=this[_0xfb85('0x27')][_0x4df545[_0xfb85('0x1f')]];}}}}}catch(_0xf1dc12){logger['error'](_0xfb85('0x6f'),_0x4df545[_0xfb85('0x1f')],util['inspect'](_0xf1dc12,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb85('0x1a')][_0xfb85('0x6a')]=function(_0x3b5416,_0x1b82a7,_0xb2b793){var _0x4045f3=[_0xfb85('0x70'),_0xfb85('0x71'),_0xfb85('0x72'),_0xfb85('0x73'),_0xfb85('0x74'),_0xfb85('0x75'),'rtpaudioqosrtt',_0xfb85('0x76'),_0xfb85('0x77'),_0xfb85('0x78'),_0xfb85('0x79'),_0xfb85('0x7a'),_0xfb85('0x7b'),_0xfb85('0x7c'),'memberinterface','memberlastcall','membername',_0xfb85('0x7d'),_0xfb85('0x7e')];if(!_[_0xfb85('0x7f')](_0x1b82a7)&&!_[_0xfb85('0x80')](_0x4045f3,_0x1b82a7)){if(_['isUndefined'](this['variables'][_0x3b5416])){this[_0xfb85('0x27')][_0x3b5416]={};}this['variables'][_0x3b5416][_0x1b82a7]=_0xb2b793;}};VoiceAgentReport[_0xfb85('0x1a')][_0xfb85('0x81')]=function(_0x11d94c){try{if(this[_0xfb85('0x3b')](_0x11d94c)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x11d94c[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x11d94c,{'showHidden':![],'depth':null}));if(this[_0xfb85('0xa')][_0x11d94c[_0xfb85('0x1f')]]){for(var _0x4b2996 in this[_0xfb85('0xa')][_0x11d94c['uniqueid']]){if(this[_0xfb85('0xa')][_0x11d94c['uniqueid']][_0xfb85('0x6b')](_0x4b2996)){if(this[_0xfb85('0xa')][_0x11d94c[_0xfb85('0x1f')]][_0x4b2996][_0xfb85('0x4b')]==_0xfb85('0x82')&&this[_0xfb85('0xa')][_0x11d94c[_0xfb85('0x1f')]][_0x4b2996]['agentcomplete']){logger[_0xfb85('0x1d')](_0xfb85('0x83'),_0x11d94c[_0xfb85('0x1f')],_0x4b2996);this['channels'][_0x11d94c[_0xfb85('0x1f')]][_0x4b2996]['agentcompleteAt']=moment()[_0xfb85('0x28')](_0xfb85('0x29'));}}}logger[_0xfb85('0x22')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x11d94c['uniqueid'],util['inspect'](_['values'](this[_0xfb85('0xa')][_0x11d94c['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xfb85('0x1b')](_0xfb85('0x84'),_[_0xfb85('0x85')](this[_0xfb85('0xa')][_0x11d94c[_0xfb85('0x1f')]]));delete this[_0xfb85('0xa')][_0x11d94c['uniqueid']];}if(this[_0xfb85('0x27')][_0x11d94c[_0xfb85('0x1f')]]){delete this['variables'][_0x11d94c['uniqueid']];}}}catch(_0x5b991a){logger[_0xfb85('0x39')](_0xfb85('0x86'),_0x11d94c[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x5b991a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x185d4c){try{if(this[_0xfb85('0x3b')](_0x185d4c)){logger[_0xfb85('0x22')](_0xfb85('0x87'),_0x185d4c[_0xfb85('0x1f')],util['inspect'](_0x185d4c,{'showHidden':![],'depth':null}));if(this[_0xfb85('0xa')][_0x185d4c['transfereeuniqueid']]){for(var _0x1929ba in this[_0xfb85('0xa')][_0x185d4c[_0xfb85('0x88')]]){if(this[_0xfb85('0xa')][_0x185d4c[_0xfb85('0x88')]][_0xfb85('0x6b')](_0x1929ba)){if(_0x185d4c[_0xfb85('0x89')]===_0x1929ba){logger[_0xfb85('0x1d')](_0xfb85('0x8a'),_0x185d4c[_0xfb85('0x1f')],this[_0xfb85('0xa')][_0x185d4c['transfereeuniqueid']][_0x1929ba][_0xfb85('0x20')],_0x1929ba);var _0xda30a0=moment();this['channels'][_0x185d4c['transfereeuniqueid']][_0x1929ba][_0xfb85('0x13')]=!![];this[_0xfb85('0xa')][_0x185d4c[_0xfb85('0x88')]][_0x1929ba][_0xfb85('0x5e')]=moment()[_0xfb85('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfb85('0xa')][_0x185d4c['transfereeuniqueid']][_0x1929ba][_0xfb85('0x51')]=_0xfb85('0x5f');this[_0xfb85('0xa')][_0x185d4c[_0xfb85('0x88')]][_0x1929ba]['reason']=_0xfb85('0x82');this[_0xfb85('0xa')][_0x185d4c[_0xfb85('0x88')]][_0x1929ba][_0xfb85('0x61')]=_0xda30a0[_0xfb85('0x8b')](this[_0xfb85('0xa')][_0x185d4c[_0xfb85('0x88')]][_0x1929ba]['agentconnectAt'],'seconds');}}}}if(this[_0xfb85('0xa')][_0x185d4c['secondtransfereruniqueid']]){var _0xd75032=this[_0xfb85('0xa')][_0x185d4c['secondtransfereruniqueid']];this[_0xfb85('0xa')][_0x185d4c[_0xfb85('0x8c')]]=this['channels'][_0x185d4c[_0xfb85('0x88')]];this['channels'][_0x185d4c[_0xfb85('0x88')]]=_0xd75032;}}}catch(_0xda8855){logger[_0xfb85('0x39')](_0xfb85('0x8d'),_0x185d4c[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0xda8855,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfb85('0x19')]=function(_0x59fede){try{if(this[_0xfb85('0x3b')](_0x59fede)){logger[_0xfb85('0x22')](_0xfb85('0x8e'),_0x59fede[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x59fede,{'showHidden':![],'depth':null}));if(this[_0xfb85('0xa')][_0x59fede[_0xfb85('0x88')]]){for(var _0x2dd416 in this[_0xfb85('0xa')][_0x59fede[_0xfb85('0x88')]]){if(this['channels'][_0x59fede['transfereeuniqueid']][_0xfb85('0x6b')](_0x2dd416)){if(_0x59fede['transfereruniqueid']===_0x2dd416){logger[_0xfb85('0x1d')](_0xfb85('0x8f'),_0x59fede[_0xfb85('0x1f')],this[_0xfb85('0xa')][_0x59fede[_0xfb85('0x88')]][_0x2dd416][_0xfb85('0x20')],_0x2dd416);var _0x1ac556=moment();this[_0xfb85('0xa')][_0x59fede[_0xfb85('0x88')]][_0x2dd416][_0xfb85('0x13')]=!![];this[_0xfb85('0xa')][_0x59fede[_0xfb85('0x88')]][_0x2dd416][_0xfb85('0x5e')]=_0x1ac556;this[_0xfb85('0xa')][_0x59fede[_0xfb85('0x88')]][_0x2dd416]['lastevent']=_0xfb85('0x5f');this['channels'][_0x59fede[_0xfb85('0x88')]][_0x2dd416]['reason']=_0xfb85('0x82');this['channels'][_0x59fede[_0xfb85('0x88')]][_0x2dd416][_0xfb85('0x61')]=_0x1ac556[_0xfb85('0x8b')](this[_0xfb85('0xa')][_0x59fede[_0xfb85('0x88')]][_0x2dd416][_0xfb85('0x3c')],_0xfb85('0x90'));}}}}}}catch(_0x29eba5){logger[_0xfb85('0x39')]('[%s][voiceAgentReport][blindtransfer]',_0x59fede[_0xfb85('0x1f')],util['inspect'](_0x29eba5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb85('0x1a')][_0xfb85('0x91')]=function(_0x3f9b7a){var _0x46e67b='';try{if(this[_0xfb85('0x3b')](_0x3f9b7a)){logger[_0xfb85('0x22')](_0xfb85('0x92'),_0x3f9b7a[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x3f9b7a,{'showHidden':![],'depth':null}));if(_0x3f9b7a[_0xfb85('0x93')]){_0x46e67b=_0x3f9b7a[_0xfb85('0x93')][_0xfb85('0x94')](0x0,_0x3f9b7a[_0xfb85('0x93')][_0xfb85('0x95')]('-'));if(this[_0xfb85('0xd')][_0x46e67b]){logger['info'](_0xfb85('0x96'),_0x3f9b7a[_0xfb85('0x1f')],_0x46e67b);this['agents'][_0x46e67b]['onhold']=!![];}}}}catch(_0x1f262b){logger[_0xfb85('0x39')](_0xfb85('0x97'),_0x3f9b7a['uniqueid'],util[_0xfb85('0x24')](_0x1f262b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb85('0x1a')][_0xfb85('0x98')]=function(_0x4c38ed){var _0x1d421b='';try{if(this[_0xfb85('0x3b')](_0x4c38ed)){logger[_0xfb85('0x22')](_0xfb85('0x99'),_0x4c38ed[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x4c38ed,{'showHidden':![],'depth':null}));if(_0x4c38ed[_0xfb85('0x93')]){_0x1d421b=_0x4c38ed[_0xfb85('0x93')]['substring'](0x0,_0x4c38ed['channel'][_0xfb85('0x95')]('-'));if(this[_0xfb85('0xd')][_0x1d421b]){logger['info'](_0xfb85('0x9a'),_0x4c38ed[_0xfb85('0x1f')],_0x1d421b);this[_0xfb85('0xd')][_0x1d421b]['onhold']=![];}}}}catch(_0x424e6e){logger[_0xfb85('0x39')](_0xfb85('0x9b'),_0x4c38ed[_0xfb85('0x1f')],util[_0xfb85('0x24')](_0x424e6e,{'showHidden':![],'depth':null}));}};module[_0xfb85('0x9c')]=VoiceAgentReport; \ No newline at end of file +var _0x1248=['[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncAttendedTransfer','prototype','emit','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','interface','queue','format','called','mandatoryDisposition','type','voice','assign','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','merge','pick','destconnectedlinenum','name','custom:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','info','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acwtime','acwTimeout','omit','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf'];(function(_0x375c4d,_0x510fcd){var _0x331af0=function(_0x7a9158){while(--_0x7a9158){_0x375c4d['push'](_0x375c4d['shift']());}};_0x331af0(++_0x510fcd);}(_0x1248,0x9a));var _0x8124=function(_0x39e25f,_0x3e6f00){_0x39e25f=_0x39e25f-0x0;var _0x56af62=_0x1248[_0x39e25f];return _0x56af62;};'use strict';var _=require(_0x8124('0x0'));var moment=require(_0x8124('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x8124('0x2'))(_0x8124('0x3'));var ami=require('../ami');config[_0x8124('0x4')]=_[_0x8124('0x5')](config[_0x8124('0x4')],{'host':_0x8124('0x6'),'port':0x18eb});var io=require(_0x8124('0x7'))(new Redis(config[_0x8124('0x4')]));function VoiceAgentReport(_0x4af8eb){this[_0x8124('0x8')]={};this[_0x8124('0x9')]=_0x4af8eb['channels'];this[_0x8124('0xa')]=_0x4af8eb['voiceQueues'];this[_0x8124('0xb')]=_0x4af8eb[_0x8124('0xb')];this[_0x8124('0xc')]={};ami['on'](_0x8124('0xd'),this[_0x8124('0xe')][_0x8124('0xf')](this));ami['on']('agentconnect',this[_0x8124('0x10')]['bind'](this));ami['on'](_0x8124('0x11'),this['syncAgentRingNoAnswer'][_0x8124('0xf')](this));ami['on']('queuecallerabandon',this[_0x8124('0x12')][_0x8124('0xf')](this));ami['on'](_0x8124('0x13'),this[_0x8124('0x14')][_0x8124('0xf')](this));ami['on'](_0x8124('0x15'),this['syncVarSet'][_0x8124('0xf')](this));ami['on'](_0x8124('0x16'),this[_0x8124('0x17')][_0x8124('0xf')](this));ami['on']('musiconholdstart',this[_0x8124('0x18')][_0x8124('0xf')](this));ami['on'](_0x8124('0x19'),this['syncMusicOnHoldStop'][_0x8124('0xf')](this));ami['on']('attendedtransfer',this[_0x8124('0x1a')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x8124('0xf')](this));}VoiceAgentReport[_0x8124('0x1b')][_0x8124('0x1c')]=function(_0x5945f0,_0x244545,_0x4f57ef){io['to'](_0x5945f0)[_0x8124('0x1c')](_0x244545,_0x4f57ef);};VoiceAgentReport[_0x8124('0x1b')][_0x8124('0x1d')]=function(_0x362e6c){return _0x362e6c!==null&&!_[_0x8124('0x1e')](_0x362e6c);};VoiceAgentReport[_0x8124('0x1b')]['syncAgentCalled']=function(_0x4949e8){try{if(this['isNotNull'](_0x4949e8)){logger['info'](_0x8124('0x1f'),_0x4949e8[_0x8124('0x20')],_0x4949e8[_0x8124('0x21')],_0x4949e8[_0x8124('0x22')]);logger[_0x8124('0x23')](_0x8124('0x24'),_0x4949e8['uniqueid'],util[_0x8124('0x25')](_0x4949e8,{'showHidden':![],'depth':null}));if(_[_0x8124('0x1e')](this[_0x8124('0x8')][_0x4949e8['uniqueid']])){this['channels'][_0x4949e8[_0x8124('0x20')]]={};}var _0x5947ac=this[_0x8124('0xb')][_0x4949e8[_0x8124('0x26')]];var _0x22f214=this[_0x8124('0x8')][_0x4949e8['uniqueid']][_0x4949e8[_0x8124('0x22')]];var _0x28ba02=this['voiceQueues'][_0x4949e8[_0x8124('0x27')]];var _0x583022=this[_0x8124('0xc')][_0x4949e8[_0x8124('0x20')]];if(_['isUndefined'](_0x22f214)){_0x22f214={'agentcalledAt':moment()[_0x8124('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x8124('0x29'),'mandatoryDisposition':_0x28ba02&&_0x28ba02[_0x8124('0x2a')]?_0x28ba02[_0x8124('0x2a')]:![],'type':_0x28ba02&&_0x28ba02[_0x8124('0x2b')]?_0x28ba02[_0x8124('0x2b')]:'inbound','variables':_0x583022,'motionChannel':_0x8124('0x2c')};}Object[_0x8124('0x2d')](_0x22f214,_['omit'](_0x4949e8,['event','privilege']));this[_0x8124('0x8')][_0x4949e8['uniqueid']][_0x4949e8['destuniqueid']]=_0x22f214;logger['debug'](_0x8124('0x2e'),_0x4949e8[_0x8124('0x20')],util[_0x8124('0x25')](_0x22f214,{'showHidden':![],'depth':null}));ami[_0x8124('0x1c')](_0x8124('0x2f'),_0x22f214);var _0xd2cf49={'id':_0x5947ac['id'],'calleridnum':_0x22f214[_0x8124('0x30')],'queue':_0x22f214[_0x8124('0x27')],'variables':_0x22f214[_0x8124('0xc')],'uniqueid':_0x4949e8[_0x8124('0x20')]};logger[_0x8124('0x23')](_0x8124('0x31'),_0x4949e8[_0x8124('0x20')],util[_0x8124('0x25')](_0xd2cf49,{'showHidden':![],'depth':null}));this[_0x8124('0x1c')](util['format'](_0x8124('0x32'),_0x4949e8[_0x8124('0x21')]),_0x8124('0x33'),_0xd2cf49);}}catch(_0x4dfff8){logger[_0x8124('0x34')](_0x8124('0x35'),_0x4949e8[_0x8124('0x20')],util[_0x8124('0x25')](_0x4dfff8,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0xb8232f){try{if(this[_0x8124('0x1d')](_0xb8232f)){if(this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]]){for(var _0x654ace in this['channels'][_0xb8232f[_0x8124('0x20')]]){if(this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x8124('0x36')](_0x654ace)){if(_0xb8232f[_0x8124('0x22')]===_0x654ace){logger['info'](_0x8124('0x37'),_0xb8232f['uniqueid'],_0xb8232f[_0x8124('0x21')],_0xb8232f[_0x8124('0x22')]);this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace][_0x8124('0x38')]=moment()[_0x8124('0x28')](_0x8124('0x39'));this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace][_0x8124('0x3a')]=_0xb8232f['connectedlinename'];this['channels'][_0xb8232f['uniqueid']][_0x654ace][_0x8124('0x3b')]=_0xb8232f['connectedlinenum'];this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace][_0x8124('0x3c')]=_0xb8232f[_0x8124('0x3c')];this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace]['destchannelstatedesc']=_0xb8232f[_0x8124('0x3d')];this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace][_0x8124('0x3e')]=_0xb8232f['holdtime'];this[_0x8124('0x8')][_0xb8232f['uniqueid']][_0x654ace]['lastevent']=_0x8124('0x3f');if(this[_0x8124('0x9')][this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace][_0x8124('0x20')]]){var _0x35ae72=this['voiceChannels'][this['channels'][_0xb8232f[_0x8124('0x20')]][_0x654ace]['uniqueid']]['routealias'];this['channels'][_0xb8232f[_0x8124('0x20')]][_0x654ace][_0x8124('0x40')]=_0x35ae72;_0xb8232f['routealias']=_0x35ae72;}_[_0x8124('0x41')](this[_0x8124('0xb')][_0xb8232f[_0x8124('0x26')]],_[_0x8124('0x42')](_0xb8232f,[_0x8124('0x27'),_0x8124('0x43'),'routealias']));var _0x3ba03b=this['agents'][_0xb8232f[_0x8124('0x26')]];var _0x72cb38={'id':_0x3ba03b['id'],'name':_0x3ba03b[_0x8124('0x44')],'agentconnected':!![],'destaccountcode':_0x3ba03b['accountcode'],'destconnectedlinenum':this['channels'][_0xb8232f['uniqueid']][_0xb8232f[_0x8124('0x22')]]['exten'],'queue':this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0xb8232f[_0x8124('0x22')]][_0x8124('0x27')],'routealias':this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0xb8232f['destuniqueid']][_0x8124('0x40')],'uniqueid':this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0xb8232f[_0x8124('0x22')]][_0x8124('0x20')]};ami[_0x8124('0x1c')](_0x8124('0x45'),this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0xb8232f[_0x8124('0x22')]]);this[_0x8124('0x1c')](util[_0x8124('0x28')]('user:%s',_0xb8232f[_0x8124('0x21')]),'user:agentconnect',_0x72cb38);}else if(!this[_0x8124('0x8')][_0xb8232f['uniqueid']][_0x654ace][_0x8124('0x11')]&&!this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace][_0x8124('0x13')]){logger['info'](_0x8124('0x46'),_0xb8232f[_0x8124('0x20')],this['channels'][_0xb8232f['uniqueid']][_0x654ace][_0x8124('0x21')],_0x654ace);this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace]['agentringnoanswer']=!![];this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace][_0x8124('0x47')]=moment()[_0x8124('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace]['answeredelsewheredestinationuniqueid']=_0xb8232f[_0x8124('0x22')];this[_0x8124('0x8')][_0xb8232f['uniqueid']][_0x654ace]['answeredelsewheremembername']=_0xb8232f[_0x8124('0x21')];this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace][_0x8124('0x48')]=_0x8124('0x49');this[_0x8124('0x8')][_0xb8232f['uniqueid']][_0x654ace][_0x8124('0x4a')]='answered_elsewhere';logger[_0x8124('0x23')](_0x8124('0x4b'),_0xb8232f[_0x8124('0x20')],util['inspect'](this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace],{'showHidden':![],'depth':null}));ami[_0x8124('0x1c')](_0x8124('0x4c'),this[_0x8124('0x8')][_0xb8232f[_0x8124('0x20')]][_0x654ace]);}else{logger[_0x8124('0x23')]('[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken',_0xb8232f[_0x8124('0x20')]);}}}}}}catch(_0x214329){logger[_0x8124('0x34')](_0x8124('0x4d'),_0xb8232f[_0x8124('0x20')],util['inspect'](_0x214329,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8124('0x4e')]=function(_0x197e6f){try{if(this[_0x8124('0x1d')](_0x197e6f)){logger[_0x8124('0x23')](_0x8124('0x4f'),_0x197e6f['uniqueid'],util[_0x8124('0x25')](_0x197e6f,{'showHidden':![],'depth':null}));if(this[_0x8124('0x8')][_0x197e6f['uniqueid']]&&this[_0x8124('0x8')][_0x197e6f['uniqueid']][_0x197e6f[_0x8124('0x22')]]){logger[_0x8124('0x50')](_0x8124('0x51'),_0x197e6f[_0x8124('0x20')],_0x197e6f[_0x8124('0x21')],_0x197e6f[_0x8124('0x22')]);var _0x3bde07=this[_0x8124('0xb')][_0x197e6f[_0x8124('0x26')]];var _0xd0cc00=this['channels'][_0x197e6f[_0x8124('0x20')]][_0x197e6f['destuniqueid']];_0xd0cc00[_0x8124('0x11')]=!![];_0xd0cc00[_0x8124('0x47')]=moment()[_0x8124('0x28')](_0x8124('0x39'));_0xd0cc00[_0x8124('0x48')]='rejected';_0xd0cc00[_0x8124('0x4a')]=_0x8124('0x52');var _0x293a0d={'id':_0x3bde07['id'],'name':_0x3bde07['name'],'queue':_0xd0cc00[_0x8124('0x27')],'uniqueid':_0xd0cc00[_0x8124('0x20')]};logger[_0x8124('0x23')](_0x8124('0x53'),_0x197e6f[_0x8124('0x20')],util[_0x8124('0x25')](_0x293a0d,{'showHidden':![],'depth':null}));this['emit'](util[_0x8124('0x28')](_0x8124('0x32'),_0x3bde07[_0x8124('0x44')]),_0x8124('0x54'),_0x293a0d);ami['emit'](_0x8124('0x55'),_0xd0cc00);this[_0x8124('0x8')][_0x197e6f[_0x8124('0x20')]][_0x197e6f[_0x8124('0x22')]]=Object['assign']({},_0xd0cc00);}}}catch(_0x175da5){logger[_0x8124('0x34')](_0x8124('0x56'),_0x197e6f['uniqueid'],util[_0x8124('0x25')](_0x175da5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8124('0x1b')][_0x8124('0x12')]=function(_0x5b4791){try{if(this[_0x8124('0x1d')](_0x5b4791)){logger[_0x8124('0x23')](_0x8124('0x57'),_0x5b4791[_0x8124('0x20')],util[_0x8124('0x25')](_0x5b4791,{'showHidden':![],'depth':null}));if(this[_0x8124('0x8')][_0x5b4791['uniqueid']]){for(var _0x5c79f2 in this[_0x8124('0x8')][_0x5b4791[_0x8124('0x20')]]){if(this[_0x8124('0x8')][_0x5b4791[_0x8124('0x20')]]['hasOwnProperty'](_0x5c79f2)&&!this[_0x8124('0x8')][_0x5b4791[_0x8124('0x20')]][_0x5c79f2][_0x8124('0x11')]&&!this[_0x8124('0x8')][_0x5b4791[_0x8124('0x20')]][_0x5c79f2][_0x8124('0x13')]){logger[_0x8124('0x50')](_0x8124('0x58'),_0x5b4791[_0x8124('0x20')],this[_0x8124('0x8')][_0x5b4791[_0x8124('0x20')]][_0x5c79f2][_0x8124('0x21')],_0x5c79f2);this[_0x8124('0x8')][_0x5b4791[_0x8124('0x20')]][_0x5c79f2][_0x8124('0x11')]=!![];this['channels'][_0x5b4791[_0x8124('0x20')]][_0x5c79f2][_0x8124('0x47')]=moment()[_0x8124('0x28')](_0x8124('0x39'));this[_0x8124('0x8')][_0x5b4791[_0x8124('0x20')]][_0x5c79f2][_0x8124('0x48')]=_0x8124('0x59');this['channels'][_0x5b4791[_0x8124('0x20')]][_0x5c79f2][_0x8124('0x4a')]=_0x8124('0x59');logger[_0x8124('0x23')](_0x8124('0x5a'),_0x5b4791[_0x8124('0x20')],util[_0x8124('0x25')](this[_0x8124('0x8')][_0x5b4791[_0x8124('0x20')]][_0x5c79f2],{'showHidden':![],'depth':null}));ami[_0x8124('0x1c')](_0x8124('0x5b'),this[_0x8124('0x8')][_0x5b4791['uniqueid']][_0x5c79f2]);}}}}}catch(_0x226d7f){logger[_0x8124('0x34')](_0x8124('0x5c'),_0x5b4791[_0x8124('0x20')],util['inspect'](_0x226d7f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8124('0x1b')][_0x8124('0x14')]=function(_0x3792e4){try{if(this[_0x8124('0x1d')](_0x3792e4)){logger[_0x8124('0x23')](_0x8124('0x5d'),_0x3792e4[_0x8124('0x20')],util[_0x8124('0x25')](_0x3792e4,{'showHidden':![],'depth':null}));if(this[_0x8124('0x8')][_0x3792e4[_0x8124('0x20')]]){for(var _0x5b2965 in this[_0x8124('0x8')][_0x3792e4['uniqueid']]){if(this[_0x8124('0x8')][_0x3792e4[_0x8124('0x20')]]['hasOwnProperty'](_0x5b2965)){if(this['channels'][_0x3792e4[_0x8124('0x20')]][_0x5b2965][_0x8124('0x38')]&&!this['channels'][_0x3792e4[_0x8124('0x20')]][_0x5b2965]['agentcomplete']){logger[_0x8124('0x50')](_0x8124('0x5e'),_0x3792e4[_0x8124('0x20')],this[_0x8124('0x8')][_0x3792e4['uniqueid']][_0x5b2965][_0x8124('0x21')],_0x5b2965);this[_0x8124('0x8')][_0x3792e4[_0x8124('0x20')]][_0x5b2965][_0x8124('0x13')]=!![];this[_0x8124('0x8')][_0x3792e4[_0x8124('0x20')]][_0x5b2965][_0x8124('0x5f')]=moment()[_0x8124('0x28')](_0x8124('0x39'));this['channels'][_0x3792e4['uniqueid']][_0x5b2965][_0x8124('0x48')]=_0x8124('0x60');this[_0x8124('0x8')][_0x3792e4[_0x8124('0x20')]][_0x5b2965][_0x8124('0x4a')]=_0x3792e4['reason']==_0x8124('0x61')?_0x8124('0x62'):_0x3792e4['reason'];this[_0x8124('0x8')][_0x3792e4['uniqueid']][_0x5b2965][_0x8124('0x63')]=_0x3792e4[_0x8124('0x63')];if(this[_0x8124('0xa')][_0x3792e4[_0x8124('0x27')]]&&this[_0x8124('0xa')][_0x3792e4[_0x8124('0x27')]]['acw']){this['channels'][_0x3792e4[_0x8124('0x20')]][_0x5b2965][_0x8124('0x64')]=this[_0x8124('0xa')][_0x3792e4[_0x8124('0x27')]][_0x8124('0x65')];this[_0x8124('0x8')][_0x3792e4[_0x8124('0x20')]][_0x5b2965]['agentacw']=!![];}this['agents'][_0x3792e4['interface']]=_[_0x8124('0x66')](this[_0x8124('0xb')][_0x3792e4[_0x8124('0x26')]],[_0x8124('0x27'),_0x8124('0x43')]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x3792e4['uniqueid'],util[_0x8124('0x25')](this[_0x8124('0x8')][_0x3792e4[_0x8124('0x20')]][_0x5b2965],{'showHidden':![],'depth':null}));ami[_0x8124('0x1c')]('custom:agentcomplete',this[_0x8124('0x8')][_0x3792e4[_0x8124('0x20')]][_0x5b2965]);logger[_0x8124('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x3792e4[_0x8124('0x20')],util['inspect']({'id':this[_0x8124('0xb')][_0x3792e4[_0x8124('0x26')]]['id'],'destaccountcode':_0x3792e4['destaccountcode']},{'showHidden':![],'depth':null}));this[_0x8124('0x1c')](util['format'](_0x8124('0x32'),_0x3792e4[_0x8124('0x21')]),_0x8124('0x67'),{'id':this[_0x8124('0xb')][_0x3792e4['interface']]['id'],'destaccountcode':Number(_0x3792e4[_0x8124('0x68')])});}}}}}}catch(_0x3aba46){logger['error'](_0x8124('0x69'),_0x3792e4[_0x8124('0x20')],util[_0x8124('0x25')](_0x3aba46,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8124('0x1b')][_0x8124('0x6a')]=function(_0x183f35){try{if(this['isNotNull'](_0x183f35)){logger[_0x8124('0x23')](_0x8124('0x6b'),_0x183f35['uniqueid'],util[_0x8124('0x25')](_0x183f35,{'showHidden':![],'depth':null}));this[_0x8124('0x6c')](_0x183f35[_0x8124('0x20')],_[_0x8124('0x6d')](_0x183f35['variable'])[0x0],_0x183f35[_0x8124('0x6e')]);if(this[_0x8124('0x8')][_0x183f35[_0x8124('0x20')]]){for(var _0x54a49c in this[_0x8124('0x8')][_0x183f35[_0x8124('0x20')]]){if(this[_0x8124('0x8')][_0x183f35[_0x8124('0x20')]][_0x8124('0x36')](_0x54a49c)){logger[_0x8124('0x50')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x183f35[_0x8124('0x20')],_0x54a49c,_[_0x8124('0x6d')](_0x183f35['variable'])[0x0],_0x183f35[_0x8124('0x6e')]);if(_[_0x8124('0x1e')](this[_0x8124('0x8')][_0x183f35[_0x8124('0x20')]][_0x54a49c][_0x8124('0xc')])){this['channels'][_0x183f35[_0x8124('0x20')]][_0x54a49c][_0x8124('0xc')]={};}this['channels'][_0x183f35['uniqueid']][_0x54a49c][_0x8124('0xc')]=this[_0x8124('0xc')][_0x183f35[_0x8124('0x20')]];}}}}}catch(_0x737903){logger['error'](_0x8124('0x6f'),_0x183f35[_0x8124('0x20')],util[_0x8124('0x25')](_0x737903,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8124('0x1b')][_0x8124('0x6c')]=function(_0x3bb0ff,_0x5850ce,_0x1bfa9e){var _0x5e30e5=['rtpaudioqos',_0x8124('0x70'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x8124('0x71'),_0x8124('0x72'),'rtpaudioqosrtt',_0x8124('0x73'),_0x8124('0x74'),_0x8124('0x75'),'bridgepeer',_0x8124('0x76'),_0x8124('0x77'),_0x8124('0x78'),_0x8124('0x79'),_0x8124('0x7a'),'membername',_0x8124('0x7b'),_0x8124('0x7c')];if(!_[_0x8124('0x7d')](_0x5850ce)&&!_[_0x8124('0x7e')](_0x5e30e5,_0x5850ce)){if(_[_0x8124('0x1e')](this[_0x8124('0xc')][_0x3bb0ff])){this['variables'][_0x3bb0ff]={};}this[_0x8124('0xc')][_0x3bb0ff][_0x5850ce]=_0x1bfa9e;}};VoiceAgentReport['prototype']['syncHangup']=function(_0xf2568d){try{if(this[_0x8124('0x1d')](_0xf2568d)){logger[_0x8124('0x23')]('[%s][voiceAgentReport][hangup]\x20event:',_0xf2568d[_0x8124('0x20')],util[_0x8124('0x25')](_0xf2568d,{'showHidden':![],'depth':null}));if(this[_0x8124('0x8')][_0xf2568d[_0x8124('0x20')]]){for(var _0x41d042 in this[_0x8124('0x8')][_0xf2568d[_0x8124('0x20')]]){if(this['channels'][_0xf2568d[_0x8124('0x20')]]['hasOwnProperty'](_0x41d042)){if(this[_0x8124('0x8')][_0xf2568d[_0x8124('0x20')]][_0x41d042][_0x8124('0x4a')]==_0x8124('0x61')&&this[_0x8124('0x8')][_0xf2568d['uniqueid']][_0x41d042]['agentcomplete']){logger[_0x8124('0x50')](_0x8124('0x7f'),_0xf2568d[_0x8124('0x20')],_0x41d042);this['channels'][_0xf2568d[_0x8124('0x20')]][_0x41d042][_0x8124('0x5f')]=moment()[_0x8124('0x28')](_0x8124('0x39'));}}}logger[_0x8124('0x23')](_0x8124('0x80'),_0xf2568d[_0x8124('0x20')],util[_0x8124('0x25')](_['values'](this[_0x8124('0x8')][_0xf2568d[_0x8124('0x20')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x8124('0x81'),_['values'](this['channels'][_0xf2568d[_0x8124('0x20')]]));delete this[_0x8124('0x8')][_0xf2568d[_0x8124('0x20')]];}if(this[_0x8124('0xc')][_0xf2568d[_0x8124('0x20')]]){delete this[_0x8124('0xc')][_0xf2568d[_0x8124('0x20')]];}}}catch(_0x2a7ac5){logger[_0x8124('0x34')](_0x8124('0x82'),_0xf2568d[_0x8124('0x20')],util[_0x8124('0x25')](_0x2a7ac5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8124('0x1b')]['syncAttendedTransfer']=function(_0x15915b){try{if(this['isNotNull'](_0x15915b)){logger[_0x8124('0x23')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x15915b[_0x8124('0x20')],util[_0x8124('0x25')](_0x15915b,{'showHidden':![],'depth':null}));if(this[_0x8124('0x8')][_0x15915b[_0x8124('0x83')]]){for(var _0x2e23f2 in this[_0x8124('0x8')][_0x15915b['transfereeuniqueid']]){if(this['channels'][_0x15915b[_0x8124('0x83')]]['hasOwnProperty'](_0x2e23f2)){if(_0x15915b[_0x8124('0x84')]===_0x2e23f2){logger[_0x8124('0x50')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x15915b['uniqueid'],this['channels'][_0x15915b[_0x8124('0x83')]][_0x2e23f2][_0x8124('0x21')],_0x2e23f2);var _0x461e07=moment();this[_0x8124('0x8')][_0x15915b[_0x8124('0x83')]][_0x2e23f2]['agentcomplete']=!![];this[_0x8124('0x8')][_0x15915b['transfereeuniqueid']][_0x2e23f2]['agentcompleteAt']=moment()['format'](_0x8124('0x39'));this[_0x8124('0x8')][_0x15915b['transfereeuniqueid']][_0x2e23f2][_0x8124('0x48')]=_0x8124('0x60');this[_0x8124('0x8')][_0x15915b['transfereeuniqueid']][_0x2e23f2][_0x8124('0x4a')]=_0x8124('0x61');this[_0x8124('0x8')][_0x15915b[_0x8124('0x83')]][_0x2e23f2]['talktime']=_0x461e07[_0x8124('0x85')](this['channels'][_0x15915b[_0x8124('0x83')]][_0x2e23f2][_0x8124('0x38')],_0x8124('0x86'));}}}}if(this[_0x8124('0x8')][_0x15915b[_0x8124('0x87')]]){var _0x1e212e=this[_0x8124('0x8')][_0x15915b[_0x8124('0x87')]];this[_0x8124('0x8')][_0x15915b['secondtransfereruniqueid']]=this[_0x8124('0x8')][_0x15915b[_0x8124('0x83')]];this[_0x8124('0x8')][_0x15915b[_0x8124('0x83')]]=_0x1e212e;}}}catch(_0x2d525d){logger[_0x8124('0x34')](_0x8124('0x88'),_0x15915b['uniqueid'],util['inspect'](_0x2d525d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8124('0x1b')][_0x8124('0x89')]=function(_0x13662b){try{if(this['isNotNull'](_0x13662b)){logger[_0x8124('0x23')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x13662b[_0x8124('0x20')],util[_0x8124('0x25')](_0x13662b,{'showHidden':![],'depth':null}));if(this[_0x8124('0x8')][_0x13662b[_0x8124('0x83')]]){for(var _0x1c8e3c in this[_0x8124('0x8')][_0x13662b[_0x8124('0x83')]]){if(this[_0x8124('0x8')][_0x13662b[_0x8124('0x83')]][_0x8124('0x36')](_0x1c8e3c)){if(_0x13662b[_0x8124('0x8a')]===_0x1c8e3c){logger[_0x8124('0x50')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x13662b['uniqueid'],this[_0x8124('0x8')][_0x13662b[_0x8124('0x83')]][_0x1c8e3c]['membername'],_0x1c8e3c);var _0x12b7fa=moment();this['channels'][_0x13662b[_0x8124('0x83')]][_0x1c8e3c][_0x8124('0x13')]=!![];this[_0x8124('0x8')][_0x13662b[_0x8124('0x83')]][_0x1c8e3c][_0x8124('0x5f')]=_0x12b7fa;this[_0x8124('0x8')][_0x13662b[_0x8124('0x83')]][_0x1c8e3c]['lastevent']='complete';this[_0x8124('0x8')][_0x13662b[_0x8124('0x83')]][_0x1c8e3c][_0x8124('0x4a')]='transfer';this[_0x8124('0x8')][_0x13662b[_0x8124('0x83')]][_0x1c8e3c][_0x8124('0x63')]=_0x12b7fa[_0x8124('0x85')](this[_0x8124('0x8')][_0x13662b[_0x8124('0x83')]][_0x1c8e3c][_0x8124('0x38')],_0x8124('0x86'));}}}}}}catch(_0x2769fa){logger[_0x8124('0x34')](_0x8124('0x8b'),_0x13662b[_0x8124('0x20')],util[_0x8124('0x25')](_0x2769fa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8124('0x1b')][_0x8124('0x18')]=function(_0x403a02){var _0x4054ab='';try{if(this[_0x8124('0x1d')](_0x403a02)){logger['debug'](_0x8124('0x8c'),_0x403a02[_0x8124('0x20')],util[_0x8124('0x25')](_0x403a02,{'showHidden':![],'depth':null}));if(_0x403a02[_0x8124('0x8d')]){_0x4054ab=_0x403a02[_0x8124('0x8d')][_0x8124('0x8e')](0x0,_0x403a02[_0x8124('0x8d')][_0x8124('0x8f')]('-'));if(this[_0x8124('0xb')][_0x4054ab]){logger['info'](_0x8124('0x90'),_0x403a02[_0x8124('0x20')],_0x4054ab);this[_0x8124('0xb')][_0x4054ab][_0x8124('0x91')]=!![];}}}}catch(_0x513780){logger[_0x8124('0x34')]('[%s][voiceAgentReport][musiconholdstart]',_0x403a02[_0x8124('0x20')],util[_0x8124('0x25')](_0x513780,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8124('0x1b')][_0x8124('0x92')]=function(_0x23fae1){var _0x8a03af='';try{if(this[_0x8124('0x1d')](_0x23fae1)){logger[_0x8124('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x23fae1[_0x8124('0x20')],util[_0x8124('0x25')](_0x23fae1,{'showHidden':![],'depth':null}));if(_0x23fae1['channel']){_0x8a03af=_0x23fae1[_0x8124('0x8d')][_0x8124('0x8e')](0x0,_0x23fae1['channel'][_0x8124('0x8f')]('-'));if(this[_0x8124('0xb')][_0x8a03af]){logger[_0x8124('0x50')](_0x8124('0x93'),_0x23fae1[_0x8124('0x20')],_0x8a03af);this[_0x8124('0xb')][_0x8a03af][_0x8124('0x91')]=![];}}}}catch(_0x257e6f){logger[_0x8124('0x34')](_0x8124('0x94'),_0x23fae1['uniqueid'],util[_0x8124('0x25')](_0x257e6f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 0700ce6..8830950 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 _0x6aa7=['path','ioredis','../../../config/environment','ami','../ami','../model/channel','queue','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','blindTransfers','bind','syncNewExten','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','from-sip','channel','split','xcally-motion-preview','connectedlinenum','format','user:agentconnect','accountcode','debug','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','duration','seconds','lastapplication','lastdata','set','cdr(','type','isNil','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','starttime','holdtime','connectedlinename','destinationchannel','UserId','membername','answertime','diff','routealias','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','find','monitors','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','then','getSettings','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','outbound','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','BlindTransfer','transfereruniqueid','transfererchannel','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','util'];(function(_0x37ace6,_0x357846){var _0x3de2f8=function(_0x49e8ad){while(--_0x49e8ad){_0x37ace6['push'](_0x37ace6['shift']());}};_0x3de2f8(++_0x357846);}(_0x6aa7,0x178));var _0x76aa=function(_0x52d440,_0x194823){_0x52d440=_0x52d440-0x0;var _0x28db72=_0x6aa7[_0x52d440];return _0x28db72;};'use strict';var _=require(_0x76aa('0x0'));var moment=require('moment');var util=require(_0x76aa('0x1'));var path=require(_0x76aa('0x2'));var Redis=require(_0x76aa('0x3'));var config=require(_0x76aa('0x4'));var logger=require('../../../config/logger')(_0x76aa('0x5'));var ami=require(_0x76aa('0x6'));var Channel=require(_0x76aa('0x7'));var RpcSetting=require('../rpc/setting');var applications=['set',_0x76aa('0x8'),'agi',_0x76aa('0x9'),_0x76aa('0xa'),_0x76aa('0xb')];var dispositions=['NO\x20ANSWER',_0x76aa('0xc'),_0x76aa('0xc'),_0x76aa('0xd'),'NO\x20ANSWER',_0x76aa('0xd'),_0x76aa('0xe'),_0x76aa('0xf'),_0x76aa('0xc'),_0x76aa('0xc'),_0x76aa('0xc')];config[_0x76aa('0x10')]=_[_0x76aa('0x11')](config[_0x76aa('0x10')],{'host':_0x76aa('0x12'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x76aa('0x10')]));function VoiceCallReport(_0x5df49c){this[_0x76aa('0x13')]=_0x5df49c[_0x76aa('0x13')];this[_0x76aa('0x14')]=_0x5df49c[_0x76aa('0x14')];this[_0x76aa('0x15')]={};ami['on']('coreshowchannel',this['syncNewExten'][_0x76aa('0x16')](this));ami['on']('newexten',this[_0x76aa('0x17')][_0x76aa('0x16')](this));ami['on']('newchannel',this[_0x76aa('0x18')]['bind'](this));ami['on'](_0x76aa('0x19'),this['syncNewState'][_0x76aa('0x16')](this));ami['on'](_0x76aa('0x1a'),this[_0x76aa('0x1b')][_0x76aa('0x16')](this));ami['on'](_0x76aa('0x1c'),this[_0x76aa('0x1d')]['bind'](this));ami['on']('newcallerid',this[_0x76aa('0x1e')][_0x76aa('0x16')](this));ami['on'](_0x76aa('0x1f'),this[_0x76aa('0x20')][_0x76aa('0x16')](this));ami['on'](_0x76aa('0x21'),this[_0x76aa('0x22')][_0x76aa('0x16')](this));ami['on'](_0x76aa('0x23'),this['syncMusicOnHoldStart'][_0x76aa('0x16')](this));ami['on'](_0x76aa('0x24'),this[_0x76aa('0x25')]['bind'](this));try{logger[_0x76aa('0x26')](_0x76aa('0x27'));ami[_0x76aa('0x28')]();}catch(_0x2bd2c6){logger[_0x76aa('0x29')](_0x76aa('0x2a'),util[_0x76aa('0x2b')](_0x2bd2c6,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x76aa('0x2c')][_0x76aa('0x2d')]=function(_0x2cba6d){return _0x2cba6d!==null&&!_[_0x76aa('0x2e')](_0x2cba6d);};VoiceCallReport[_0x76aa('0x2c')][_0x76aa('0x2f')]=function(_0x4ef9b0,_0xb5e8a9,_0x1d6d15){io['to'](_0x4ef9b0)[_0x76aa('0x2f')](_0xb5e8a9,_0x1d6d15);};VoiceCallReport[_0x76aa('0x2c')][_0x76aa('0x1e')]=function(_0x2f9316){try{if(this[_0x76aa('0x2d')](_0x2f9316)){logger[_0x76aa('0x26')](_0x76aa('0x30'),_0x2f9316[_0x76aa('0x31')],_0x2f9316['calleridname'],_0x2f9316[_0x76aa('0x32')]);logger['debug'](_0x76aa('0x33'),_0x2f9316[_0x76aa('0x31')],util[_0x76aa('0x2b')](_0x2f9316,{'showHidden':![],'depth':null}));if(_0x2f9316[_0x76aa('0x31')]===_0x2f9316[_0x76aa('0x34')]){if(!_[_0x76aa('0x2e')](this[_0x76aa('0x13')][_0x2f9316[_0x76aa('0x31')]])){_[_0x76aa('0x35')](this[_0x76aa('0x13')][_0x2f9316['uniqueid']],_[_0x76aa('0x36')](_0x2f9316,_[_0x76aa('0x37')](this[_0x76aa('0x13')][_0x2f9316[_0x76aa('0x31')]])));}}if(_0x2f9316[_0x76aa('0x38')]===_0x76aa('0x39')){var _0x35a705=this['agents'][_0x2f9316[_0x76aa('0x3a')][_0x76aa('0x3b')]('-')[0x0]];if(_0x35a705){if(_0x2f9316['exten']==_0x76aa('0x3c')){_0x35a705['destconnectedlinenum']=_0x2f9316[_0x76aa('0x3d')];this['emit'](util[_0x76aa('0x3e')]('user:%s',_0x35a705['name']),_0x76aa('0x3f'),{'id':_0x35a705['id'],'destaccountcode':_0x35a705[_0x76aa('0x40')],'destconnectedlinenum':_0x2f9316[_0x76aa('0x3d')]});}}}}}catch(_0x37dfab){logger['error']('[%s][voiceCallReport][newcallerid]',_0x2f9316[_0x76aa('0x31')],util[_0x76aa('0x2b')](_0x37dfab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x76aa('0x2c')][_0x76aa('0x18')]=function(_0x23029e){try{if(this['isNotNull'](_0x23029e)){logger[_0x76aa('0x41')]('[%s][voiceCallReport][newchannel]\x20event:',_0x23029e['uniqueid'],util[_0x76aa('0x2b')](_0x23029e,{'showHidden':![],'depth':null}));if(this[_0x76aa('0x13')][_0x23029e[_0x76aa('0x31')]]){return;}if(_0x23029e[_0x76aa('0x3a')]==='OutgoingSpoolFailed'){return;}if(_0x23029e[_0x76aa('0x31')]!==_0x23029e[_0x76aa('0x34')]&&!this[_0x76aa('0x15')][_0x23029e['linkedid']]){return;}logger[_0x76aa('0x26')](_0x76aa('0x42'),_0x23029e[_0x76aa('0x31')],_0x23029e[_0x76aa('0x38')],_0x23029e[_0x76aa('0x43')]);this[_0x76aa('0x13')][_0x23029e[_0x76aa('0x31')]]=new Channel();this[_0x76aa('0x13')][_0x23029e[_0x76aa('0x31')]]['starttime']=moment()[_0x76aa('0x3e')](_0x76aa('0x44'));this[_0x76aa('0x13')][_0x23029e[_0x76aa('0x31')]][_0x76aa('0x45')]=dispositions[_[_0x76aa('0x46')](_0x23029e['channelstate'])];_['merge'](this[_0x76aa('0x13')][_0x23029e[_0x76aa('0x31')]],_[_0x76aa('0x36')](_0x23029e,_[_0x76aa('0x37')](this['channels'][_0x23029e[_0x76aa('0x31')]])));if(_0x23029e[_0x76aa('0x38')]===_0x76aa('0x39')){var _0x30cdcb=this[_0x76aa('0x14')][_0x23029e['channel'][_0x76aa('0x3b')]('-')[0x0]];if(_0x30cdcb&&typeof _0x30cdcb['destconnectedlinenum']===_0x76aa('0x47')){_0x30cdcb['destconnectedlinenum']=_0x23029e['exten'];logger['debug'](_0x76aa('0x48'),_0x23029e['uniqueid'],util['inspect']({'id':_0x30cdcb['id'],'destaccountcode':_0x30cdcb['accountcode'],'destconnectedlinenum':_0x23029e[_0x76aa('0x43')]},{'showHidden':![],'depth':null}));this[_0x76aa('0x2f')](util[_0x76aa('0x3e')](_0x76aa('0x49'),_0x30cdcb[_0x76aa('0x4a')]),'user:agentconnect',{'id':_0x30cdcb['id'],'destaccountcode':_0x30cdcb[_0x76aa('0x40')],'destconnectedlinenum':_0x23029e[_0x76aa('0x43')]});}}}}catch(_0x2a629d){logger[_0x76aa('0x29')](_0x76aa('0x4b'),_0x23029e['uniqueid'],util[_0x76aa('0x2b')](_0x2a629d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x76aa('0x2c')]['syncNewExten']=function(_0x2d3441){try{if(this['isNotNull'](_0x2d3441)){logger[_0x76aa('0x41')](_0x76aa('0x4c'),_0x2d3441[_0x76aa('0x31')],util[_0x76aa('0x2b')](_0x2d3441,{'showHidden':![],'depth':null}));if(_0x2d3441[_0x76aa('0x3a')]===_0x76aa('0x4d')||_0x2d3441[_0x76aa('0x43')]==='h')return;if(_0x2d3441[_0x76aa('0x31')]===_0x2d3441[_0x76aa('0x34')]||this[_0x76aa('0x15')][_0x2d3441['linkedid']]){_0x2d3441[_0x76aa('0x4e')]=_0x2d3441['application']?_0x2d3441[_0x76aa('0x4e')][_0x76aa('0x4f')]():undefined;_0x2d3441[_0x76aa('0x50')]=_0x2d3441[_0x76aa('0x51')]||_0x2d3441['applicationdata'];if(_0x2d3441['appdata']&&!_0x2d3441[_0x76aa('0x51')]['startsWith'](_0x76aa('0x52'))&&_0x2d3441[_0x76aa('0x4e')]!==_0x76aa('0x8')){_0x2d3441[_0x76aa('0x50')]=_0x2d3441[_0x76aa('0x50')][_0x76aa('0x4f')]();}logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x2d3441[_0x76aa('0x31')],_0x2d3441[_0x76aa('0x4e')],_0x2d3441[_0x76aa('0x50')]);if(_[_0x76aa('0x2e')](this[_0x76aa('0x13')][_0x2d3441[_0x76aa('0x31')]])){this['channels'][_0x2d3441[_0x76aa('0x31')]]=new Channel();this[_0x76aa('0x13')][_0x2d3441[_0x76aa('0x31')]]['starttime']=_0x2d3441[_0x76aa('0x53')]?moment()['subtract'](moment[_0x76aa('0x53')](_0x2d3441['duration'])[_0x76aa('0x54')](),_0x76aa('0x54'))[_0x76aa('0x3e')](_0x76aa('0x44')):moment()[_0x76aa('0x3e')](_0x76aa('0x44'));this[_0x76aa('0x13')][_0x2d3441['uniqueid']][_0x76aa('0x45')]='NO\x20ANSWER';}_[_0x76aa('0x35')](this[_0x76aa('0x13')][_0x2d3441[_0x76aa('0x31')]],_[_0x76aa('0x36')](_0x2d3441,_[_0x76aa('0x37')](this[_0x76aa('0x13')][_0x2d3441[_0x76aa('0x31')]])));if(_['includes'](applications,_0x2d3441[_0x76aa('0x4e')])){this[_0x76aa('0x13')][_0x2d3441[_0x76aa('0x31')]][_0x76aa('0x55')]=_0x2d3441['application'];this[_0x76aa('0x13')][_0x2d3441[_0x76aa('0x31')]][_0x76aa('0x56')]=_0x2d3441[_0x76aa('0x50')];if(_0x2d3441[_0x76aa('0x4e')]===_0x76aa('0x57')&&_['startsWith'](_0x2d3441[_0x76aa('0x50')][_0x76aa('0x4f')](),_0x76aa('0x58'))){var _0x3620d0=_0x2d3441[_0x76aa('0x50')][_0x76aa('0x3b')]('=');var _0x37babe=_0x3620d0[0x0]['toLowerCase']()['match'](/cdr\((.*)\)/);if(_0x37babe){if(_0x37babe[0x1]===_0x76aa('0x59')&&!_[_0x76aa('0x5a')](this['channels'][_0x2d3441[_0x76aa('0x31')]][_0x37babe[0x1]]))return;this[_0x76aa('0x13')][_0x2d3441['uniqueid']][_0x37babe[0x1]]=_0x3620d0[0x1];}}else if(_0x2d3441[_0x76aa('0x4e')]===_0x76aa('0x8')){this[_0x76aa('0x13')][_0x2d3441[_0x76aa('0x31')]][_0x76aa('0x8')]=_0x2d3441[_0x76aa('0x50')][_0x76aa('0x3b')](',')[0x0];}}}}}catch(_0x30573a){logger[_0x76aa('0x29')]('[%s][voiceCallReport][newexten]',_0x2d3441[_0x76aa('0x31')],util['inspect'](_0x30573a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x76aa('0x2c')][_0x76aa('0x5b')]=function(_0x2fef92){try{if(this[_0x76aa('0x2d')](_0x2fef92)){logger[_0x76aa('0x26')](_0x76aa('0x5c'),_0x2fef92[_0x76aa('0x31')],_0x2fef92[_0x76aa('0x34')],_0x2fef92[_0x76aa('0x5d')],_0x2fef92['calleridnum']);logger[_0x76aa('0x41')](_0x76aa('0x5e'),_0x2fef92[_0x76aa('0x31')],util[_0x76aa('0x2b')](_0x2fef92,{'showHidden':![],'depth':null}));if(_0x2fef92[_0x76aa('0x5f')]!=='6')return;var _0x884b8b=this[_0x76aa('0x14')][_0x2fef92[_0x76aa('0x3a')]['split']('-')[0x0]];if(_0x2fef92[_0x76aa('0x31')]!==_0x2fef92['linkedid']){var _0x35bd2b=moment();if(this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x34')]]){if(!this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x34')]][_0x76aa('0x60')]){this[_0x76aa('0x13')][_0x2fef92['linkedid']][_0x76aa('0x60')]=!![];this[_0x76aa('0x13')][_0x2fef92['linkedid']]['answertime']=_0x35bd2b[_0x76aa('0x3e')](_0x76aa('0x44'));if(this['channels'][_0x2fef92[_0x76aa('0x34')]][_0x76aa('0x61')]){this[_0x76aa('0x13')][_0x2fef92['linkedid']][_0x76aa('0x62')]=_0x35bd2b['diff'](this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x34')]][_0x76aa('0x61')],_0x76aa('0x54'));}}this['channels'][_0x2fef92['linkedid']][_0x76aa('0x34')]=_0x2fef92['uniqueid'];if(_0x2fef92[_0x76aa('0x32')]!==_0x76aa('0x3c')){this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x34')]][_0x76aa('0x3d')]=_0x2fef92[_0x76aa('0x32')];}this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x34')]][_0x76aa('0x63')]=_0x2fef92['calleridname'];this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x34')]][_0x76aa('0x64')]=_0x2fef92[_0x76aa('0x3a')];this['channels'][_0x2fef92['linkedid']]['disposition']=dispositions[_[_0x76aa('0x46')](_0x2fef92['channelstate'])];if(_0x884b8b){this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x34')]][_0x76aa('0x65')]=_0x884b8b['id'];this[_0x76aa('0x13')][_0x2fef92['linkedid']][_0x76aa('0x66')]=_0x884b8b['name'];}}if(this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x31')]]){if(!this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x31')]][_0x76aa('0x60')]){this['channels'][_0x2fef92[_0x76aa('0x31')]][_0x76aa('0x60')]=!![];this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x31')]][_0x76aa('0x67')]=_0x35bd2b[_0x76aa('0x3e')](_0x76aa('0x44'));if(this[_0x76aa('0x13')][_0x2fef92['uniqueid']][_0x76aa('0x61')]){this[_0x76aa('0x13')][_0x2fef92['uniqueid']][_0x76aa('0x62')]=_0x35bd2b[_0x76aa('0x68')](this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x31')]][_0x76aa('0x61')],_0x76aa('0x54'));}}if(_0x2fef92[_0x76aa('0x32')]!=='xcally-motion-preview'){this[_0x76aa('0x13')][_0x2fef92['uniqueid']]['connectedlinenum']=_0x2fef92[_0x76aa('0x32')];}this[_0x76aa('0x13')][_0x2fef92['uniqueid']]['connectedlinename']=_0x2fef92[_0x76aa('0x5d')];this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x31')]]['destinationchannel']=_0x2fef92['channel'];this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x31')]][_0x76aa('0x45')]=dispositions[_['toNumber'](_0x2fef92[_0x76aa('0x5f')])];}}else{if(this['channels'][_0x2fef92[_0x76aa('0x31')]]){if(_0x884b8b){this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x31')]][_0x76aa('0x65')]=_0x884b8b['id'];this[_0x76aa('0x13')][_0x2fef92['uniqueid']]['membername']=_0x884b8b[_0x76aa('0x4a')];}}}if(_0x2fef92[_0x76aa('0x38')]===_0x76aa('0x39')){if(_0x884b8b){_0x884b8b['destconnectedlinenum']=_0x2fef92[_0x76aa('0x43')];var _0x3b6e44,_0x2ce07f;if(this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x31')]]){_0x3b6e44=this['channels'][_0x2fef92[_0x76aa('0x31')]]['routealias'];_0x2ce07f=this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x31')]][_0x76aa('0x8')];}else if(this[_0x76aa('0x13')][_0x2fef92[_0x76aa('0x34')]]){_0x3b6e44=this[_0x76aa('0x13')][_0x2fef92['linkedid']]['routealias'];_0x2ce07f=this['channels'][_0x2fef92['linkedid']]['queue'];}_0x884b8b[_0x76aa('0x8')]=_0x2ce07f;_0x884b8b[_0x76aa('0x69')]=_0x3b6e44;var _0x52c5be={'id':_0x884b8b['id'],'name':_0x884b8b['name'],'agentconnected':!![],'destaccountcode':_0x884b8b['accountcode'],'destconnectedlinenum':_0x2fef92[_0x76aa('0x43')],'queue':_0x2ce07f||undefined,'routealias':_0x3b6e44,'uniqueid':_0x2fef92[_0x76aa('0x34')]};logger[_0x76aa('0x41')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x2fef92['uniqueid'],util[_0x76aa('0x2b')](_0x52c5be,{'showHidden':![],'depth':null}));this[_0x76aa('0x2f')](util[_0x76aa('0x3e')](_0x76aa('0x49'),_0x884b8b[_0x76aa('0x4a')]),'user:agentconnect',_0x52c5be);}}}}catch(_0x5ea4e4){logger[_0x76aa('0x29')]('[%s][voiceCallReport][newstate]',_0x2fef92['uniqueid'],util['inspect'](_0x5ea4e4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x76aa('0x2c')][_0x76aa('0x6a')]=function(_0x52d5ce,_0x3e8df6){try{if(this[_0x76aa('0x13')][_0x52d5ce]){logger['info'](_0x76aa('0x6b'),_0x52d5ce,_0x3e8df6);this[_0x76aa('0x13')][_0x52d5ce][_0x76aa('0x6c')]=!![];if(_[_0x76aa('0x6d')](_0x3e8df6,_0x76aa('0x6e'))){_0x3e8df6=_0x3e8df6[_0x76aa('0x6f')](_0x76aa('0x6e'),_0x76aa('0x70'));}this[_0x76aa('0x13')][_0x52d5ce]['monitorFilename']=_0x3e8df6;var _0x84bc91=_[_0x76aa('0x71')](this['channels'][_0x52d5ce][_0x76aa('0x72')],{'filename':_0x3e8df6});if(_[_0x76aa('0x5a')](_0x84bc91)){this[_0x76aa('0x13')][_0x52d5ce]['monitors'][_0x76aa('0x73')]({'filename':_0x3e8df6,'createdAt':moment()[_0x76aa('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x76aa('0x74')});}}}catch(_0x3320a2){logger[_0x76aa('0x29')]('[%s][voiceCallReport][mixMonitorFilename]',_0x52d5ce,util[_0x76aa('0x2b')](_0x3320a2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x76aa('0x2c')]['syncVarSet']=function(_0x5aabe5){try{if(this['isNotNull'](_0x5aabe5)){logger[_0x76aa('0x41')](_0x76aa('0x75'),_0x5aabe5[_0x76aa('0x31')],util[_0x76aa('0x2b')](_0x5aabe5,{'showHidden':![],'depth':null}));if(this['channels'][_0x5aabe5['uniqueid']]&&_0x5aabe5['channel']!=_0x76aa('0x4d')){if(this['isNotNull'](_0x5aabe5[_0x76aa('0x76')])){if(this[_0x76aa('0x2d')](_0x5aabe5['variable'][_0x76aa('0x77')])){logger[_0x76aa('0x26')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5aabe5[_0x76aa('0x31')],_0x5aabe5[_0x76aa('0x78')]);this[_0x76aa('0x6a')](_0x5aabe5[_0x76aa('0x31')],_0x5aabe5[_0x76aa('0x78')]);}else if(this[_0x76aa('0x2d')](_0x5aabe5['variable'][_0x76aa('0x79')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x5aabe5['uniqueid'],_0x5aabe5['value']);this['channels'][_0x5aabe5[_0x76aa('0x31')]][_0x76aa('0x32')]=_0x5aabe5[_0x76aa('0x78')];}else if(this[_0x76aa('0x2d')](_0x5aabe5['variable'][_0x76aa('0x7a')])){logger[_0x76aa('0x26')](_0x76aa('0x7b'),_0x5aabe5[_0x76aa('0x31')],_0x5aabe5[_0x76aa('0x78')]);this['channels'][_0x5aabe5[_0x76aa('0x31')]][_0x76aa('0x7c')]=_0x5aabe5[_0x76aa('0x78')];}else if(this[_0x76aa('0x2d')](_0x5aabe5[_0x76aa('0x76')][_0x76aa('0x7d')])){logger[_0x76aa('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5aabe5[_0x76aa('0x31')],_0x5aabe5[_0x76aa('0x78')]);this['channels'][_0x5aabe5['uniqueid']][_0x76aa('0x59')]=_0x5aabe5[_0x76aa('0x78')];}else if(this['isNotNull'](_0x5aabe5[_0x76aa('0x76')]['xmd-queue'])){logger[_0x76aa('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x5aabe5[_0x76aa('0x31')],_0x5aabe5[_0x76aa('0x78')][_0x76aa('0x3b')](',')[0x0]);this[_0x76aa('0x13')][_0x5aabe5[_0x76aa('0x31')]]['queue']=_0x5aabe5[_0x76aa('0x78')]['split'](',')[0x0];}else if(this[_0x76aa('0x2d')](_0x5aabe5[_0x76aa('0x76')]['xmd-originatecalleridnum'])){logger['info'](_0x76aa('0x7e'),_0x5aabe5[_0x76aa('0x31')],_0x5aabe5[_0x76aa('0x78')]);this[_0x76aa('0x13')][_0x5aabe5['uniqueid']]['originatecalleridnum']=_0x5aabe5[_0x76aa('0x78')];}else if(this['isNotNull'](_0x5aabe5[_0x76aa('0x76')]['xmd-destination'])){logger[_0x76aa('0x26')](_0x76aa('0x7f'),_0x5aabe5['uniqueid'],_0x5aabe5[_0x76aa('0x78')]);this['channels'][_0x5aabe5['uniqueid']][_0x76aa('0x80')]=_0x5aabe5[_0x76aa('0x78')];}else if(this['isNotNull'](_0x5aabe5[_0x76aa('0x76')][_0x76aa('0x81')])){logger[_0x76aa('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x5aabe5[_0x76aa('0x31')],_0x5aabe5[_0x76aa('0x78')]);this[_0x76aa('0x13')][_0x5aabe5[_0x76aa('0x31')]][_0x76aa('0x82')]=_0x5aabe5[_0x76aa('0x78')];}else if(this[_0x76aa('0x2d')](_0x5aabe5[_0x76aa('0x76')][_0x76aa('0x83')])){logger[_0x76aa('0x26')](_0x76aa('0x84'),_0x5aabe5[_0x76aa('0x31')],_0x5aabe5['value']);this[_0x76aa('0x13')][_0x5aabe5[_0x76aa('0x31')]]['queue']=_0x5aabe5[_0x76aa('0x78')];}else if(this[_0x76aa('0x2d')](_0x5aabe5['variable']['sipcallid'])){logger[_0x76aa('0x26')](_0x76aa('0x85'),_0x5aabe5['uniqueid'],_0x5aabe5[_0x76aa('0x78')]);this[_0x76aa('0x13')][_0x5aabe5[_0x76aa('0x31')]]['sipcalluniqueid']=_0x5aabe5[_0x76aa('0x78')];}}}else if(this[_0x76aa('0x2d')](_0x5aabe5['variable'][_0x76aa('0x77')])){if(_0x5aabe5[_0x76aa('0x78')]){var _0x64ee60=path[_0x76aa('0x86')](_0x5aabe5[_0x76aa('0x78')])[_0x76aa('0x4a')];logger['info'](_0x76aa('0x87'),_0x64ee60,_0x5aabe5['value']);this[_0x76aa('0x6a')](_0x64ee60,_0x5aabe5[_0x76aa('0x78')]);}}else if(this[_0x76aa('0x13')][_0x5aabe5['linkedid']]){if(this['isNotNull'](_0x5aabe5[_0x76aa('0x76')])){if(this[_0x76aa('0x2d')](_0x5aabe5[_0x76aa('0x76')][_0x76aa('0x88')])){logger[_0x76aa('0x26')](_0x76aa('0x85'),_0x5aabe5['linkedid'],_0x5aabe5['value']);this[_0x76aa('0x13')][_0x5aabe5[_0x76aa('0x34')]][_0x76aa('0x89')]=_0x5aabe5[_0x76aa('0x78')];}}}}}catch(_0x507d7f){logger[_0x76aa('0x29')]('[%s][voiceCallReport][varset]',_0x5aabe5['uniqueid'],util[_0x76aa('0x2b')](_0x507d7f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x76aa('0x2c')][_0x76aa('0x1d')]=function(_0x5b4916){try{if(this[_0x76aa('0x2d')](_0x5b4916)){logger[_0x76aa('0x41')](_0x76aa('0x8a'),_0x5b4916[_0x76aa('0x31')],util[_0x76aa('0x2b')](_0x5b4916,{'showHidden':![],'depth':null}));if(this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]]){if(this['channels'][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x34')]]){this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]]['linkedid']][_0x76aa('0x31')]=_0x5b4916[_0x76aa('0x31')];this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916['linkedid']][_0x76aa('0x34')]][_0x76aa('0x60')]=this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]][_0x76aa('0x60')];this['channels'][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]]['linkedid']]['answertime']=this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]][_0x76aa('0x67')];this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]]['linkedid']][_0x76aa('0x64')]=this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x34')]][_0x76aa('0x3a')];this['channels'][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x34')]][_0x76aa('0x45')]=this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]]['disposition'];this[_0x76aa('0x13')][_0x5b4916['uniqueid']]=this[_0x76aa('0x13')][this['blindTransfers'][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x34')]];delete this['channels'][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x34')]];}else if(this['channels'][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]]['uniqueid']]){this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x31')]][_0x76aa('0x31')]=[this[_0x76aa('0x13')][this['blindTransfers'][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x31')]][_0x76aa('0x34')],this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x31')]][_0x76aa('0x34')]=this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]]['uniqueid']][_0x76aa('0x31')]][0x0];this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x31')]][_0x76aa('0x60')]=this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]]['answered'];this[_0x76aa('0x13')][this['blindTransfers'][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x31')]][_0x76aa('0x67')]=this['channels'][_0x5b4916[_0x76aa('0x31')]][_0x76aa('0x67')];this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]]['uniqueid']][_0x76aa('0x64')]=this['channels'][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]]['uniqueid']][_0x76aa('0x3a')];this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x31')]][_0x76aa('0x45')]=this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]]['disposition'];this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]]=this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916[_0x76aa('0x34')]][_0x76aa('0x31')]];delete this[_0x76aa('0x13')][this[_0x76aa('0x15')][_0x5b4916['linkedid']][_0x76aa('0x31')]];}}if(this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]]){logger['info'](_0x76aa('0x8b'),_0x5b4916[_0x76aa('0x31')],_0x5b4916[_0x76aa('0x8c')]);var _0x286451=moment();this[_0x76aa('0x13')][_0x5b4916['uniqueid']][_0x76aa('0x8d')]=_0x286451['format'](_0x76aa('0x44'));this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]][_0x76aa('0x53')]=_0x286451[_0x76aa('0x68')](this['channels'][_0x5b4916[_0x76aa('0x31')]]['starttime'],_0x76aa('0x54'));if(this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]]['answered']){this[_0x76aa('0x13')][_0x5b4916['uniqueid']][_0x76aa('0x8e')]=_0x286451[_0x76aa('0x68')](this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]][_0x76aa('0x67')],_0x76aa('0x54'));this['channels'][_0x5b4916[_0x76aa('0x31')]][_0x76aa('0x62')]=this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]][_0x76aa('0x53')]-this[_0x76aa('0x13')][_0x5b4916[_0x76aa('0x31')]][_0x76aa('0x8e')];}if(_0x5b4916[_0x76aa('0x38')]===_0x76aa('0x39')){if(this[_0x76aa('0x14')][_0x5b4916[_0x76aa('0x3a')][_0x76aa('0x3b')]('-')[0x0]]){this[_0x76aa('0x14')][_0x5b4916[_0x76aa('0x3a')][_0x76aa('0x3b')]('-')[0x0]]=_[_0x76aa('0x8f')](this[_0x76aa('0x14')][_0x5b4916['channel'][_0x76aa('0x3b')]('-')[0x0]],['destconnectedlinenum']);logger[_0x76aa('0x41')](_0x76aa('0x90'),_0x5b4916['uniqueid'],util[_0x76aa('0x2b')]({'id':this['agents'][_0x5b4916[_0x76aa('0x3a')][_0x76aa('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x76aa('0x14')][_0x5b4916['channel'][_0x76aa('0x3b')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0x76aa('0x3e')]('user:%s',this[_0x76aa('0x14')][_0x5b4916['channel']['split']('-')[0x0]][_0x76aa('0x4a')]),_0x76aa('0x91'),{'id':this[_0x76aa('0x14')][_0x5b4916[_0x76aa('0x3a')][_0x76aa('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x76aa('0x14')][_0x5b4916[_0x76aa('0x3a')][_0x76aa('0x3b')]('-')[0x0]][_0x76aa('0x40')]});for(var _0x167f5c=0x0;_0x167f5c0x0?!![]:![];if(!_0x5c51cb){return this[_0x9f20('0x1a')](this['summary'][_0x9f20('0x75')]);}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x1c')]=function(_0x12e57f){var _0x34777a=this[_0x9f20('0x4d')]['id'];if(this[_0x9f20('0x4d')][_0x9f20('0x71')][_0x34777a]&&this['summary'][_0x9f20('0x71')][_0x34777a][_0x12e57f[_0x9f20('0x68')]]){this[_0x9f20('0x4d')][_0x9f20('0x71')][_0x34777a][_0x12e57f[_0x9f20('0x68')]][_0x9f20('0x12')][_0x9f20('0x76')](_0x12e57f);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x57764d){var _0x8a5f64=this;try{if(this['isNotNull'](_0x57764d)&&this[_0x9f20('0x77')](_0x57764d[_0x9f20('0x56')])){logger[_0x9f20('0x51')](_0x9f20('0x78'),util[_0x9f20('0x46')](_0x57764d,{'showHidden':![],'depth':null}));var _0x305ae4=this[_0x9f20('0x14')][_0x57764d[_0x9f20('0x56')]];if(_0x305ae4){logger[_0x9f20('0x51')](_0x9f20('0x79'),_0x305ae4[_0x9f20('0x61')]);this[_0x9f20('0x4d')][_0x9f20('0x64')][_0x305ae4[_0x9f20('0x61')]]={'summaryEvent':_0x57764d};this['summary'][_0x9f20('0x74')]+=0x1;return ami[_0x9f20('0x41')]({'action':'queuestatus','queue':_0x305ae4[_0x9f20('0x61')]})[_0x9f20('0x67')](function(_0x3c3332){if(!_0x8a5f64[_0x9f20('0x4d')][_0x9f20('0x71')][_0x57764d[_0x9f20('0x68')]]){_0x8a5f64[_0x9f20('0x4d')][_0x9f20('0x71')][_0x57764d[_0x9f20('0x68')]]={};}_0x8a5f64['summary'][_0x9f20('0x71')][_0x57764d['actionid']][_0x3c3332['actionid']]={'queue':_0x305ae4[_0x9f20('0x61')],'agents':[]};})[_0x9f20('0x43')](function(_0x561fe5){throw _0x561fe5;});}}}catch(_0x42ba72){logger[_0x9f20('0x47')]('[voiceQueueReport][queuesummary]',util[_0x9f20('0x46')](_0x42ba72,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x1a')]=function(_0x2f2901){if(this[_0x9f20('0x4d')][_0x9f20('0x74')]>0x0){this[_0x9f20('0x4d')][_0x9f20('0x75')]=_0x2f2901;return;}logger[_0x9f20('0x51')](_0x9f20('0x7a'),util[_0x9f20('0x46')](_0x2f2901,{'showHidden':![],'depth':null}));this[_0x9f20('0x4d')]=initializeSummary();ami['emit'](_0x9f20('0x7b'),{});};VoiceQueueReport['prototype'][_0x9f20('0x20')]=function(_0x50f477){try{if(this[_0x9f20('0x77')](_0x50f477)){logger[_0x9f20('0x51')](_0x9f20('0x7c'),_0x50f477[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x50f477,{'showHidden':![],'depth':null}));if(_[_0x9f20('0x63')](this[_0x9f20('0x11')][_0x50f477[_0x9f20('0x54')]])){this[_0x9f20('0x11')][_0x50f477[_0x9f20('0x54')]]=[];}if(_[_0x9f20('0x63')](this['channels'][_0x50f477[_0x9f20('0x54')]])){this['channels'][_0x50f477[_0x9f20('0x54')]]={};}var _0x2b686d=new QueueReport();_0x2b686d['queue']=_0x50f477[_0x9f20('0x56')];_0x2b686d['type']=this[_0x9f20('0x14')][_0x2b686d['queue']]&&this[_0x9f20('0x14')][_0x2b686d[_0x9f20('0x56')]]['type']?this[_0x9f20('0x14')][_0x2b686d['queue']][_0x9f20('0x5e')]||_0x9f20('0x5f'):_0x9f20('0x5f');_0x2b686d[_0x9f20('0x7d')]=moment()[_0x9f20('0x7e')](_0x9f20('0x7f'));_0x2b686d['position']=_0x50f477[_0x9f20('0x80')];_0x2b686d[_0x9f20('0x81')]=_0x50f477[_0x9f20('0x81')];_0x2b686d['uniqueid']=_0x50f477[_0x9f20('0x54')];_0x2b686d[_0x9f20('0x82')]=this['channels'][_0x50f477[_0x9f20('0x54')]][_0x9f20('0x82')];logger[_0x9f20('0x83')](_0x9f20('0x84'),_0x2b686d[_0x9f20('0x56')],_0x2b686d[_0x9f20('0x5e')]);Object[_0x9f20('0x6f')](_0x2b686d,_['pick'](_0x50f477,_[_0x9f20('0x85')](_0x2b686d)));this[_0x9f20('0x11')][_0x50f477['uniqueid']][_0x9f20('0x76')](_0x2b686d);this[_0x9f20('0x13')][_0x50f477[_0x9f20('0x54')]]=_0x2b686d;this[_0x9f20('0x86')](_0x2b686d,_0x9f20('0x1f'));}}catch(_0x481dd1){logger[_0x9f20('0x47')]('[%s][voiceQueueReport][queuecallerjoin]',_0x50f477[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x481dd1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')]['syncQueueCallerAbandon']=function(_0x286af9){try{if(this[_0x9f20('0x77')](_0x286af9)){logger[_0x9f20('0x51')](_0x9f20('0x87'),_0x286af9[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x286af9,{'showHidden':![],'depth':null}));if(this[_0x9f20('0x11')][_0x286af9[_0x9f20('0x54')]]){var _0x36e90c=_[_0x9f20('0x88')](this[_0x9f20('0x11')][_0x286af9['uniqueid']]);_0x36e90c[_0x9f20('0x3e')]=![];_0x36e90c[_0x9f20('0x89')]=null;_0x36e90c['holdtime']=_0x286af9[_0x9f20('0x8a')];_0x36e90c[_0x9f20('0x8b')]=_0x286af9['originalposition'];_0x36e90c[_0x9f20('0x21')]=!![];_0x36e90c[_0x9f20('0x8c')]=moment()[_0x9f20('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x36e90c[_0x9f20('0x5a')]=_0x9f20('0x8d');_0x36e90c[_0x9f20('0x8e')]=null;logger[_0x9f20('0x83')](_0x9f20('0x8f'),_0x36e90c[_0x9f20('0x56')],_0x36e90c[_0x9f20('0x5e')]);this[_0x9f20('0x13')][_0x286af9['uniqueid']]=_0x36e90c;this['emitVoiceQueueChannelRemove'](_0x36e90c,_0x9f20('0x21'));}}}catch(_0x2042aa){logger[_0x9f20('0x47')](_0x9f20('0x87'),_0x286af9[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x2042aa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x24')]=function(_0x1db51e){try{if(this['isNotNull'](_0x1db51e)){logger[_0x9f20('0x51')](_0x9f20('0x90'),_0x1db51e[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x1db51e,{'showHidden':![],'depth':null}));if(this[_0x9f20('0x11')][_0x1db51e[_0x9f20('0x54')]]){var _0x2a6b59=_[_0x9f20('0x88')](this[_0x9f20('0x11')][_0x1db51e['uniqueid']]);_0x2a6b59[_0x9f20('0x91')]=moment()[_0x9f20('0x7e')](_0x9f20('0x7f'));_0x2a6b59[_0x9f20('0x92')]=_0x1db51e['connectedlinenum'];_0x2a6b59[_0x9f20('0x93')]=_0x1db51e[_0x9f20('0x93')];logger[_0x9f20('0x83')](_0x9f20('0x94'),_0x2a6b59[_0x9f20('0x56')],_0x2a6b59[_0x9f20('0x5e')],_0x1db51e[_0x9f20('0x92')],_0x1db51e[_0x9f20('0x93')]);this[_0x9f20('0x13')][_0x1db51e[_0x9f20('0x54')]]=_0x2a6b59;this[_0x9f20('0x86')](_0x2a6b59,_0x9f20('0x23'));}}}catch(_0x3bb25b){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x1db51e[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x3bb25b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x27')]=function(_0x5cf34c){try{if(this['isNotNull'](_0x5cf34c)){logger[_0x9f20('0x51')](_0x9f20('0x95'),_0x5cf34c[_0x9f20('0x54')],util['inspect'](_0x5cf34c,{'showHidden':![],'depth':null}));if(this[_0x9f20('0x11')][_0x5cf34c[_0x9f20('0x54')]]){var _0x1b7e55=_[_0x9f20('0x88')](this['queueReports'][_0x5cf34c['uniqueid']]);_0x1b7e55[_0x9f20('0x3e')]=!![];_0x1b7e55[_0x9f20('0x5a')]=_0x9f20('0x96');logger[_0x9f20('0x83')](_0x9f20('0x97'),_0x1b7e55[_0x9f20('0x56')],_0x1b7e55[_0x9f20('0x5e')]);}}}catch(_0x414218){logger[_0x9f20('0x47')](_0x9f20('0x95'),_0x5cf34c[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x414218,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x98')]=function(_0x164d13){try{if(this[_0x9f20('0x77')](_0x164d13)){logger[_0x9f20('0x51')](_0x9f20('0x99'),_0x164d13['uniqueid'],util[_0x9f20('0x46')](_0x164d13,{'showHidden':![],'depth':null}));if(this[_0x9f20('0x11')][_0x164d13[_0x9f20('0x54')]]){var _0x4ceb0a=_['last'](this['queueReports'][_0x164d13['uniqueid']]);_0x4ceb0a[_0x9f20('0x21')]=![];_0x4ceb0a[_0x9f20('0x8c')]=null;_0x4ceb0a[_0x9f20('0x9a')]=!![];_0x4ceb0a['lastAssignedTo']=_0x164d13['membername'];_0x4ceb0a[_0x9f20('0x8a')]=_0x164d13[_0x9f20('0x8a')];_0x4ceb0a[_0x9f20('0x3e')]=!![];_0x4ceb0a[_0x9f20('0x3d')]=![];_0x4ceb0a[_0x9f20('0x9b')]=null;if(!_0x4ceb0a[_0x9f20('0x9c')]){if(_0x164d13[_0x9f20('0x9d')]==_0x9f20('0x9c')){_0x4ceb0a[_0x9f20('0x5a')]=_0x9f20('0x9e');logger[_0x9f20('0x83')](_0x9f20('0x9f'),_0x4ceb0a['queue'],_0x4ceb0a[_0x9f20('0x5e')]);}else{if(_[_0x9f20('0xa0')](_0x164d13[_0x9f20('0x42')][_0x9f20('0xa1')](),_0x9f20('0xa2'))){if(this[_0x9f20('0x11')][_0x164d13[_0x9f20('0xa3')]]){var _0x138a94=_[_0x9f20('0x88')](this[_0x9f20('0x11')][_0x164d13[_0x9f20('0xa3')]]);_0x138a94['queuecallercomplete']=![];_0x138a94[_0x9f20('0x3d')]=!![];_0x138a94[_0x9f20('0x9b')]=moment(_0x4ceb0a[_0x9f20('0x7d')])[_0x9f20('0xa4')](_0x164d13[_0x9f20('0x8a')],_0x9f20('0xa5'))[_0x9f20('0x7e')](_0x9f20('0x7f'));_0x138a94['queuecallerexitreason']=_0x9f20('0xa6');_0x138a94['transfer']=!![];_0x138a94[_0x9f20('0xa7')]='FORWARD';_0x138a94[_0x9f20('0xa8')]=_0x164d13['destexten'];_0x138a94[_0x9f20('0xa9')]=_0x164d13[_0x9f20('0x54')];logger[_0x9f20('0x83')](_0x9f20('0xaa'),_0x138a94[_0x9f20('0x56')],_0x138a94[_0x9f20('0x5e')]);var _0x3046ba=this[_0x9f20('0x11')][_0x164d13[_0x9f20('0xa3')]];this[_0x9f20('0x11')][_0x164d13[_0x9f20('0xa3')]]=this['queueReports'][_0x164d13[_0x9f20('0x54')]];this[_0x9f20('0x11')][_0x164d13[_0x9f20('0x54')]]=_0x3046ba;}}else{_0x4ceb0a['queuecallerexitreason']=_0x9f20('0xab')+_0x164d13[_0x9f20('0x9d')][_0x9f20('0xac')]();logger[_0x9f20('0x83')](_0x9f20('0xad'),_0x4ceb0a[_0x9f20('0x56')],_0x4ceb0a[_0x9f20('0x5e')],_0x4ceb0a[_0x9f20('0x5a')]);}}}this[_0x9f20('0x13')][_0x164d13[_0x9f20('0x54')]]=_0x4ceb0a;}}}catch(_0x1cf10c){logger[_0x9f20('0x47')](_0x9f20('0x99'),_0x164d13[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x1cf10c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0x29')]=function(_0x326289){try{if(this[_0x9f20('0x77')](_0x326289)){logger[_0x9f20('0x51')](_0x9f20('0xae'),_0x326289[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x326289,{'showHidden':![],'depth':null}));this[_0x9f20('0xaf')](_0x326289[_0x9f20('0x54')],_[_0x9f20('0x85')](_0x326289[_0x9f20('0xb0')])[0x0],_0x326289[_0x9f20('0xb1')]);if(this[_0x9f20('0x11')][_0x326289[_0x9f20('0x54')]]){var _0x85c809=_[_0x9f20('0x88')](this['queueReports'][_0x326289[_0x9f20('0x54')]]);if(_0x85c809){if(this[_0x9f20('0x77')](_0x326289['variable'])&&this[_0x9f20('0x77')](_0x326289[_0x9f20('0xb0')][_0x9f20('0x71')])){switch(_0x326289[_0x9f20('0xb1')]){case _0x9f20('0xb2'):_0x85c809['queuecallerexit']=![];_0x85c809['queuecallerexitAt']=null;break;case _0x9f20('0xb3'):_0x85c809[_0x9f20('0xb4')]=_0x9f20('0xb5');_0x85c809['queuecallerexit']=!![];_0x85c809['queuecallerexitAt']=moment()['format'](_0x9f20('0x7f'));_0x85c809['queuecallerleaveAt']=moment()['format'](_0x9f20('0x7f'));logger[_0x9f20('0x51')](_0x9f20('0xb6'),_0x326289[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x85c809,{'showHidden':![],'depth':null}));ami['emit'](_0x9f20('0xb7'),_0x85c809);break;default:_0x85c809[_0x9f20('0x3d')]=!![];_0x85c809[_0x9f20('0x9b')]=moment()[_0x9f20('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x85c809[_0x9f20('0x91')]=moment()[_0x9f20('0x7e')](_0x9f20('0x7f'));}_0x85c809[_0x9f20('0x21')]=![];_0x85c809['queuecallerabandonAt']=null;_0x85c809['queuecallerexitreason']=_0x326289[_0x9f20('0xb1')];this[_0x9f20('0x13')][_0x326289[_0x9f20('0x54')]]=_0x85c809;this[_0x9f20('0x4e')](_0x85c809,_0x9f20('0x28'));}else if(this[_0x9f20('0x77')](_0x326289[_0x9f20('0xb0')])&&this[_0x9f20('0x77')](_0x326289['variable'][_0x9f20('0xb8')])){if(!_0x85c809['queuecallerabandon']){_0x85c809['queuecallerexit']=!![];_0x85c809[_0x9f20('0x9b')]=moment()[_0x9f20('0x7e')](_0x9f20('0x7f'));_0x85c809[_0x9f20('0x5a')]=_0x9f20('0xb9');_0x85c809[_0x9f20('0x91')]=moment()[_0x9f20('0x7e')](_0x9f20('0x7f'));this[_0x9f20('0x13')][_0x326289['uniqueid']]=_0x85c809;}}logger[_0x9f20('0x83')](_0x9f20('0xba'),_0x326289[_0x9f20('0x54')],_0x85c809['queue'],_0x85c809[_0x9f20('0x5e')],_[_0x9f20('0x85')](_0x326289[_0x9f20('0xb0')])[0x0],_0x326289['value']);_0x85c809[_0x9f20('0x16')]=this[_0x9f20('0x16')][_0x326289[_0x9f20('0x54')]];}}}}catch(_0x167461){logger['error'](_0x9f20('0xae'),_0x326289[_0x9f20('0x54')],util[_0x9f20('0x46')](_0x167461,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0xaf')]=function(_0x4ab093,_0x224004,_0x500018){var _0x52f67d=[_0x9f20('0xbb'),_0x9f20('0xbc'),_0x9f20('0xbd'),_0x9f20('0xbe'),_0x9f20('0xbf'),_0x9f20('0xc0'),_0x9f20('0xc1'),'rtpaudioqosrttbridged',_0x9f20('0xc2'),_0x9f20('0xc3'),_0x9f20('0xc4'),_0x9f20('0xc5'),'membercalls',_0x9f20('0xc6'),_0x9f20('0xc7'),_0x9f20('0xc8'),_0x9f20('0xc9'),_0x9f20('0xca'),'memberrealtime'];if(!_[_0x9f20('0x40')](_0x224004)&&!_[_0x9f20('0xcb')](_0x52f67d,_0x224004)){if(_[_0x9f20('0x63')](this[_0x9f20('0x16')][_0x4ab093])){this[_0x9f20('0x16')][_0x4ab093]={};}this[_0x9f20('0x16')][_0x4ab093][_0x224004]=_0x500018;}};VoiceQueueReport[_0x9f20('0x4a')][_0x9f20('0xcc')]=function(_0x2bc071,_0x59a117,_0x42ec40){try{var _0x87515f={};if(this[_0x9f20('0x11')][_0x2bc071]){for(var _0x421d0d=0x0;_0x421d0d0x0?!![]:![];if(!_0x1f53be){return this[_0xef53('0x1b')](this[_0xef53('0x17')][_0xef53('0x70')]);}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0x1e')]=function(_0x3fe689){var _0x371cef=this['summary']['id'];if(this[_0xef53('0x17')][_0xef53('0x69')][_0x371cef]&&this[_0xef53('0x17')][_0xef53('0x69')][_0x371cef][_0x3fe689[_0xef53('0x67')]]){this[_0xef53('0x17')][_0xef53('0x69')][_0x371cef][_0x3fe689[_0xef53('0x67')]][_0xef53('0x12')][_0xef53('0x71')](_0x3fe689);}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0x72')]=function(_0x443e38){var _0x9793d1=this;try{if(this[_0xef53('0x73')](_0x443e38)&&this[_0xef53('0x73')](_0x443e38[_0xef53('0x54')])){logger[_0xef53('0x4e')](_0xef53('0x74'),util['inspect'](_0x443e38,{'showHidden':![],'depth':null}));var _0x2604ec=this[_0xef53('0x15')][_0x443e38['queue']];if(_0x2604ec){logger[_0xef53('0x4e')](_0xef53('0x75'),_0x2604ec['name']);this[_0xef53('0x17')][_0xef53('0x63')][_0x2604ec[_0xef53('0x5f')]]={'summaryEvent':_0x443e38};this[_0xef53('0x17')]['statusRequests']+=0x1;return ami[_0xef53('0x62')]({'action':'queuestatus','queue':_0x2604ec['name']})['then'](function(_0x3d6166){if(!_0x9793d1[_0xef53('0x17')][_0xef53('0x69')][_0x443e38[_0xef53('0x67')]]){_0x9793d1[_0xef53('0x17')][_0xef53('0x69')][_0x443e38[_0xef53('0x67')]]={};}_0x9793d1['summary'][_0xef53('0x69')][_0x443e38[_0xef53('0x67')]][_0x3d6166['actionid']]={'queue':_0x2604ec[_0xef53('0x5f')],'agents':[]};})['catch'](function(_0x4602f7){throw _0x4602f7;});}}}catch(_0x5f311c){logger['error'](_0xef53('0x76'),util[_0xef53('0x46')](_0x5f311c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xef53('0x1b')]=function(_0x567d6e){if(this['summary'][_0xef53('0x6f')]>0x0){this[_0xef53('0x17')][_0xef53('0x70')]=_0x567d6e;return;}logger[_0xef53('0x4e')](_0xef53('0x77'),util[_0xef53('0x46')](_0x567d6e,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xef53('0x4c')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xef53('0xb')][_0xef53('0x22')]=function(_0x533d31){try{if(this[_0xef53('0x73')](_0x533d31)){logger[_0xef53('0x4e')](_0xef53('0x78'),_0x533d31[_0xef53('0x51')],util[_0xef53('0x46')](_0x533d31,{'showHidden':![],'depth':null}));if(_[_0xef53('0x61')](this[_0xef53('0x10')][_0x533d31[_0xef53('0x51')]])){this[_0xef53('0x10')][_0x533d31[_0xef53('0x51')]]=[];}if(_[_0xef53('0x61')](this[_0xef53('0x13')][_0x533d31[_0xef53('0x51')]])){this[_0xef53('0x13')][_0x533d31[_0xef53('0x51')]]={};}var _0x1d4ce0=new QueueReport();_0x1d4ce0[_0xef53('0x54')]=_0x533d31['queue'];_0x1d4ce0['type']=this[_0xef53('0x15')][_0x1d4ce0[_0xef53('0x54')]]&&this['voiceQueues'][_0x1d4ce0[_0xef53('0x54')]][_0xef53('0x5c')]?this[_0xef53('0x15')][_0x1d4ce0[_0xef53('0x54')]][_0xef53('0x5c')]||_0xef53('0x5d'):'inbound';_0x1d4ce0[_0xef53('0x79')]=moment()[_0xef53('0x52')](_0xef53('0x7a'));_0x1d4ce0[_0xef53('0x7b')]=_0x533d31[_0xef53('0x7b')];_0x1d4ce0['count']=_0x533d31[_0xef53('0x7c')];_0x1d4ce0[_0xef53('0x51')]=_0x533d31[_0xef53('0x51')];_0x1d4ce0[_0xef53('0x7d')]=this[_0xef53('0x13')][_0x533d31[_0xef53('0x51')]][_0xef53('0x7d')];logger[_0xef53('0x7e')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1d4ce0['queue'],_0x1d4ce0['type']);Object[_0xef53('0x6e')](_0x1d4ce0,_[_0xef53('0x7f')](_0x533d31,_['keys'](_0x1d4ce0)));this[_0xef53('0x10')][_0x533d31['uniqueid']][_0xef53('0x71')](_0x1d4ce0);this[_0xef53('0x13')][_0x533d31[_0xef53('0x51')]]=_0x1d4ce0;this[_0xef53('0x4d')](_0x1d4ce0,_0xef53('0x21'));}}catch(_0x4baaf8){logger[_0xef53('0x44')](_0xef53('0x78'),_0x533d31[_0xef53('0x51')],util[_0xef53('0x46')](_0x4baaf8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0x24')]=function(_0x235491){try{if(this[_0xef53('0x73')](_0x235491)){logger[_0xef53('0x4e')](_0xef53('0x80'),_0x235491['uniqueid'],util[_0xef53('0x46')](_0x235491,{'showHidden':![],'depth':null}));if(this[_0xef53('0x10')][_0x235491[_0xef53('0x51')]]){var _0x3b8288=_[_0xef53('0x81')](this['queueReports'][_0x235491['uniqueid']]);_0x3b8288[_0xef53('0x3b')]=![];_0x3b8288[_0xef53('0x82')]=null;_0x3b8288['holdtime']=_0x235491[_0xef53('0x83')];_0x3b8288['originalposition']=_0x235491[_0xef53('0x84')];_0x3b8288[_0xef53('0x23')]=!![];_0x3b8288[_0xef53('0x85')]=moment()[_0xef53('0x52')](_0xef53('0x7a'));_0x3b8288['queuecallerexitreason']=_0xef53('0x86');_0x3b8288[_0xef53('0x87')]=null;logger['info'](_0xef53('0x88'),_0x3b8288['queue'],_0x3b8288[_0xef53('0x5c')]);this[_0xef53('0x13')][_0x235491[_0xef53('0x51')]]=_0x3b8288;this[_0xef53('0x89')](_0x3b8288,_0xef53('0x23'));}}}catch(_0x526a05){logger[_0xef53('0x44')](_0xef53('0x80'),_0x235491[_0xef53('0x51')],util['inspect'](_0x526a05,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xef53('0x8a')]=function(_0x104be5){try{if(this['isNotNull'](_0x104be5)){logger['debug'](_0xef53('0x8b'),_0x104be5['uniqueid'],util[_0xef53('0x46')](_0x104be5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x104be5[_0xef53('0x51')]]){var _0xf35bbf=_['last'](this[_0xef53('0x10')][_0x104be5['uniqueid']]);_0xf35bbf[_0xef53('0x8c')]=moment()[_0xef53('0x52')](_0xef53('0x7a'));_0xf35bbf['connectedlinenum']=_0x104be5['connectedlinenum'];_0xf35bbf[_0xef53('0x8d')]=_0x104be5[_0xef53('0x8d')];logger[_0xef53('0x7e')](_0xef53('0x8e'),_0xf35bbf['queue'],_0xf35bbf[_0xef53('0x5c')],_0x104be5[_0xef53('0x8f')],_0x104be5['connectedlinename']);this['channels'][_0x104be5['uniqueid']]=_0xf35bbf;this[_0xef53('0x4d')](_0xf35bbf,'queuecallerleave');}}}catch(_0x257442){logger[_0xef53('0x44')]('[%s][voiceQueueReport][queuecallerleave]',_0x104be5[_0xef53('0x51')],util[_0xef53('0x46')](_0x257442,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0x28')]=function(_0x1d7ecc){try{if(this[_0xef53('0x73')](_0x1d7ecc)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x1d7ecc['uniqueid'],util[_0xef53('0x46')](_0x1d7ecc,{'showHidden':![],'depth':null}));if(this[_0xef53('0x10')][_0x1d7ecc[_0xef53('0x51')]]){var _0x3e6f5c=_['last'](this[_0xef53('0x10')][_0x1d7ecc['uniqueid']]);_0x3e6f5c[_0xef53('0x3b')]=!![];_0x3e6f5c[_0xef53('0x57')]=_0xef53('0x90');logger[_0xef53('0x7e')](_0xef53('0x91'),_0x3e6f5c[_0xef53('0x54')],_0x3e6f5c[_0xef53('0x5c')]);}}}catch(_0x41efb1){logger[_0xef53('0x44')](_0xef53('0x92'),_0x1d7ecc[_0xef53('0x51')],util['inspect'](_0x41efb1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xef53('0x26')]=function(_0x16ca3c){try{if(this[_0xef53('0x73')](_0x16ca3c)){logger[_0xef53('0x4e')](_0xef53('0x93'),_0x16ca3c[_0xef53('0x51')],util[_0xef53('0x46')](_0x16ca3c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x16ca3c[_0xef53('0x51')]]){var _0x33e00f=_[_0xef53('0x81')](this[_0xef53('0x10')][_0x16ca3c[_0xef53('0x51')]]);_0x33e00f[_0xef53('0x23')]=![];_0x33e00f['queuecallerabandonAt']=null;_0x33e00f[_0xef53('0x94')]=!![];_0x33e00f[_0xef53('0x87')]=_0x16ca3c[_0xef53('0x95')];_0x33e00f['holdtime']=_0x16ca3c[_0xef53('0x83')];_0x33e00f[_0xef53('0x3b')]=!![];_0x33e00f[_0xef53('0x3a')]=![];_0x33e00f[_0xef53('0x96')]=null;if(!_0x33e00f[_0xef53('0x97')]){if(_0x16ca3c[_0xef53('0x98')]==_0xef53('0x97')){_0x33e00f[_0xef53('0x57')]=_0xef53('0x99');logger[_0xef53('0x7e')](_0xef53('0x9a'),_0x33e00f[_0xef53('0x54')],_0x33e00f[_0xef53('0x5c')]);}else{if(_['startsWith'](_0x16ca3c[_0xef53('0x40')][_0xef53('0x9b')](),'local/')){if(this[_0xef53('0x10')][_0x16ca3c[_0xef53('0x9c')]]){var _0x5578b6=_['last'](this[_0xef53('0x10')][_0x16ca3c[_0xef53('0x9c')]]);_0x5578b6['queuecallercomplete']=![];_0x5578b6['queuecallerexit']=!![];_0x5578b6[_0xef53('0x96')]=moment(_0x33e00f['queuecallerjoinAt'])[_0xef53('0x9d')](_0x16ca3c[_0xef53('0x83')],_0xef53('0x9e'))[_0xef53('0x52')](_0xef53('0x7a'));_0x5578b6[_0xef53('0x57')]=_0xef53('0x9f');_0x5578b6[_0xef53('0x97')]=!![];_0x5578b6[_0xef53('0xa0')]='FORWARD';_0x5578b6['transferexten']=_0x16ca3c['destexten'];_0x5578b6[_0xef53('0xa1')]=_0x16ca3c[_0xef53('0x51')];logger[_0xef53('0x7e')](_0xef53('0xa2'),_0x5578b6[_0xef53('0x54')],_0x5578b6['type']);var _0x465829=this['queueReports'][_0x16ca3c[_0xef53('0x9c')]];this[_0xef53('0x10')][_0x16ca3c['linkedid']]=this[_0xef53('0x10')][_0x16ca3c[_0xef53('0x51')]];this['queueReports'][_0x16ca3c[_0xef53('0x51')]]=_0x465829;}}else{_0x33e00f[_0xef53('0x57')]='COMPLETEDBY'+_0x16ca3c[_0xef53('0x98')]['toUpperCase']();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x33e00f[_0xef53('0x54')],_0x33e00f['type'],_0x33e00f[_0xef53('0x57')]);}}}this[_0xef53('0x13')][_0x16ca3c[_0xef53('0x51')]]=_0x33e00f;}}}catch(_0x58c1e6){logger[_0xef53('0x44')](_0xef53('0x93'),_0x16ca3c[_0xef53('0x51')],util[_0xef53('0x46')](_0x58c1e6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0xa3')]=function(_0x5aa501){try{if(this['isNotNull'](_0x5aa501)){logger['debug'](_0xef53('0xa4'),_0x5aa501[_0xef53('0x51')],util[_0xef53('0x46')](_0x5aa501,{'showHidden':![],'depth':null}));this[_0xef53('0xa5')](_0x5aa501[_0xef53('0x51')],_[_0xef53('0xa6')](_0x5aa501[_0xef53('0xa7')])[0x0],_0x5aa501[_0xef53('0xa8')]);if(this[_0xef53('0x10')][_0x5aa501[_0xef53('0x51')]]){var _0x5c0953=_[_0xef53('0x81')](this['queueReports'][_0x5aa501['uniqueid']]);if(_0x5c0953){if(this[_0xef53('0x73')](_0x5aa501[_0xef53('0xa7')])&&this[_0xef53('0x73')](_0x5aa501[_0xef53('0xa7')][_0xef53('0x69')])){switch(_0x5aa501['value']){case _0xef53('0xa9'):_0x5c0953[_0xef53('0x3a')]=![];_0x5c0953[_0xef53('0x96')]=null;break;case'TIMEOUT':_0x5c0953[_0xef53('0xaa')]=_0xef53('0xab');_0x5c0953[_0xef53('0x3a')]=!![];_0x5c0953[_0xef53('0x96')]=moment()[_0xef53('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c0953['queuecallerleaveAt']=moment()[_0xef53('0x52')](_0xef53('0x7a'));logger[_0xef53('0x4e')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5aa501[_0xef53('0x51')],util[_0xef53('0x46')](_0x5c0953,{'showHidden':![],'depth':null}));ami[_0xef53('0x4c')](_0xef53('0xac'),_0x5c0953);break;default:_0x5c0953[_0xef53('0x3a')]=!![];_0x5c0953['queuecallerexitAt']=moment()[_0xef53('0x52')](_0xef53('0x7a'));_0x5c0953[_0xef53('0x8c')]=moment()[_0xef53('0x52')](_0xef53('0x7a'));}_0x5c0953[_0xef53('0x23')]=![];_0x5c0953[_0xef53('0x85')]=null;_0x5c0953[_0xef53('0x57')]=_0x5aa501['value'];this[_0xef53('0x13')][_0x5aa501['uniqueid']]=_0x5c0953;this[_0xef53('0x89')](_0x5c0953,_0xef53('0x29'));}else if(this[_0xef53('0x73')](_0x5aa501['variable'])&&this['isNotNull'](_0x5aa501['variable'][_0xef53('0xad')])){if(!_0x5c0953['queuecallerabandon']){_0x5c0953[_0xef53('0x3a')]=!![];_0x5c0953[_0xef53('0x96')]=moment()[_0xef53('0x52')](_0xef53('0x7a'));_0x5c0953[_0xef53('0x57')]=_0xef53('0xae');_0x5c0953['queuecallerleaveAt']=moment()['format'](_0xef53('0x7a'));this['channels'][_0x5aa501[_0xef53('0x51')]]=_0x5c0953;}}logger[_0xef53('0x7e')](_0xef53('0xaf'),_0x5aa501[_0xef53('0x51')],_0x5c0953[_0xef53('0x54')],_0x5c0953[_0xef53('0x5c')],_[_0xef53('0xa6')](_0x5aa501['variable'])[0x0],_0x5aa501[_0xef53('0xa8')]);_0x5c0953['variables']=this['variables'][_0x5aa501['uniqueid']];}}}}catch(_0x42e375){logger['error'](_0xef53('0xa4'),_0x5aa501[_0xef53('0x51')],util['inspect'](_0x42e375,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xef53('0xb')][_0xef53('0xa5')]=function(_0x536984,_0x512451,_0x6e2db2){var _0x2df3e5=[_0xef53('0xb0'),_0xef53('0xb1'),_0xef53('0xb2'),_0xef53('0xb3'),'rtpaudioqosloss',_0xef53('0xb4'),'rtpaudioqosrtt',_0xef53('0xb5'),_0xef53('0xb6'),_0xef53('0xb7'),'bridgepeer',_0xef53('0xb8'),_0xef53('0xb9'),_0xef53('0xba'),_0xef53('0xbb'),_0xef53('0xbc'),_0xef53('0x95'),_0xef53('0xbd'),_0xef53('0xbe')];if(!_['isNil'](_0x512451)&&!_[_0xef53('0xbf')](_0x2df3e5,_0x512451)){if(_[_0xef53('0x61')](this[_0xef53('0x18')][_0x536984])){this['variables'][_0x536984]={};}this[_0xef53('0x18')][_0x536984][_0x512451]=_0x6e2db2;}};VoiceQueueReport['prototype']['handleHangup']=function(_0xdf1126,_0x4e7129,_0x19f699){try{var _0x47d619={};if(this['queueReports'][_0xdf1126]){for(var _0x334774=0x0;_0x334774=0x0?moment(_0x2dac04[_0x6b26('0x18')])[_0x6b26('0xd')](_0x2dac04[_0x6b26('0x17')],_0x6b26('0xe')):null,'data1':_0x6b26('0x19'),'data2':_0x2dac04['accountcode'],'data3':_0x2dac04[_0x6b26('0x1a')],'data4':_0x2dac04[_0x6b26('0x1b')]||null,'role':_0x6b26('0x1c'),'internal':_0x2dac04[_0x6b26('0x12')]?_[_0x6b26('0x11')](_0x2dac04[_0x6b26('0x12')]):undefined,'uniqueid':_0x2dac04[_0x6b26('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xcbe1=['endtime','diff','dialstring','moment','lodash','util','../client','Request','CreateMemberReport','lastAssignedTo','interface','format','TALKING','queuecallerleaveAt','seconds','calleridnum','exten','agent','accountcode','toNumber','uniqueid','voiceDialReport','voice','membername','starttime'];(function(_0x236487,_0x39046f){var _0x1c64cc=function(_0x5e1bfb){while(--_0x5e1bfb){_0x236487['push'](_0x236487['shift']());}};_0x1c64cc(++_0x39046f);}(_0xcbe1,0x148));var _0x1cbe=function(_0x293fa4,_0x3ee6cc){_0x293fa4=_0x293fa4-0x0;var _0x58d190=_0xcbe1[_0x293fa4];return _0x58d190;};'use strict';var moment=require(_0x1cbe('0x0'));var _=require(_0x1cbe('0x1'));var util=require(_0x1cbe('0x2'));var client=require(_0x1cbe('0x3'));exports['voiceQueueReport']=function(_0x3c883c){var _0x5294f1=_0x3c883c['queuecallercompleteAt']||_0x3c883c['queuecallerexitAt'];return client[_0x1cbe('0x4')](_0x1cbe('0x5'),{'body':{'channel':'voice','membername':_0x3c883c[_0x1cbe('0x6')],'interface':_['isNil'](_0x3c883c[_0x1cbe('0x7')])?util[_0x1cbe('0x8')]('SIP/%s',_0x3c883c[_0x1cbe('0x6')]):_0x3c883c[_0x1cbe('0x7')],'type':_0x1cbe('0x9'),'enterAt':_0x3c883c[_0x1cbe('0xa')],'exitAt':_0x5294f1,'duration':moment(_0x5294f1)['diff'](_0x3c883c['queuecallerleaveAt'],_0x1cbe('0xb')),'data1':'inbound','data2':_0x3c883c[_0x1cbe('0xc')],'data3':_0x3c883c[_0x1cbe('0xd')],'data4':null,'data5':_0x3c883c['queue'],'role':_0x1cbe('0xe'),'internal':_0x3c883c[_0x1cbe('0xf')]?_[_0x1cbe('0x10')](_0x3c883c[_0x1cbe('0xf')]):undefined,'uniqueid':_0x3c883c[_0x1cbe('0x11')]},'log':'CreateMemberReport'});};exports[_0x1cbe('0x12')]=function(_0x2dce4d){return client[_0x1cbe('0x4')]('CreateMemberReport',{'body':{'channel':_0x1cbe('0x13'),'membername':_0x2dce4d[_0x1cbe('0x14')],'interface':_0x2dce4d['interface'],'type':'TALKING','enterAt':_0x2dce4d[_0x1cbe('0x15')],'exitAt':_0x2dce4d[_0x1cbe('0x16')],'duration':moment(_0x2dce4d[_0x1cbe('0x16')])[_0x1cbe('0x17')](_0x2dce4d[_0x1cbe('0x15')],_0x1cbe('0xb'))>=0x0?moment(_0x2dce4d[_0x1cbe('0x16')])[_0x1cbe('0x17')](_0x2dce4d['starttime'],_0x1cbe('0xb')):null,'data1':'outbound','data2':_0x2dce4d[_0x1cbe('0xf')],'data3':_0x2dce4d['exten'],'data4':_0x2dce4d[_0x1cbe('0x18')]||null,'role':_0x1cbe('0xe'),'internal':_0x2dce4d[_0x1cbe('0xf')]?_[_0x1cbe('0x10')](_0x2dce4d[_0x1cbe('0xf')]):undefined,'uniqueid':_0x2dce4d[_0x1cbe('0x11')]},'log':_0x1cbe('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index b894488..90a3379 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 _0x8130=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x8130,0x146));var _0x0813=function(_0x2bbc0a,_0x3bf877){_0x2bbc0a=_0x2bbc0a-0x0;var _0x43869d=_0x8130[_0x2bbc0a];return _0x43869d;};'use strict';var client=require(_0x0813('0x0'));exports[_0x0813('0x1')]=function(){return client['Request'](_0x0813('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0813('0x3'),_0x0813('0x4')]},'log':_0x0813('0x5')});}; \ No newline at end of file +var _0x04bc=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x3902c1,_0x1c9eb2){var _0x1266cc=function(_0x50c2c5){while(--_0x50c2c5){_0x3902c1['push'](_0x3902c1['shift']());}};_0x1266cc(++_0x1c9eb2);}(_0x04bc,0xeb));var _0xc04b=function(_0x2cf365,_0x1ae23d){_0x2cf365=_0x2cf365-0x0;var _0x4d440b=_0x04bc[_0x2cf365];return _0x4d440b;};'use strict';var client=require(_0xc04b('0x0'));exports[_0xc04b('0x1')]=function(){return client[_0xc04b('0x2')](_0xc04b('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc04b('0x4'),'previewRecallmeReminderInterval']},'log':_0xc04b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index b49abbd..47b125b 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 _0x6df5=['getTemplates','name','html','GetTemplate','../client'];(function(_0x4195c4,_0x38ebec){var _0x56de43=function(_0x718b2f){while(--_0x718b2f){_0x4195c4['push'](_0x4195c4['shift']());}};_0x56de43(++_0x38ebec);}(_0x6df5,0x1e9));var _0x56df=function(_0x2118f2,_0x294cfa){_0x2118f2=_0x2118f2-0x0;var _0x4769df=_0x6df5[_0x2118f2];return _0x4769df;};'use strict';var client=require(_0x56df('0x0'));exports[_0x56df('0x1')]=function(_0x33eca1){return function(_0x2006f7){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x56df('0x2'),_0x56df('0x3')]},'log':_0x56df('0x4')});};}; \ No newline at end of file +var _0x60aa=['GetTemplate','name','html','getTemplates','Request'];(function(_0x4801bd,_0x368071){var _0x3cf6fc=function(_0x4d376c){while(--_0x4d376c){_0x4801bd['push'](_0x4801bd['shift']());}};_0x3cf6fc(++_0x368071);}(_0x60aa,0x13e));var _0xa60a=function(_0x31b761,_0x1f1619){_0x31b761=_0x31b761-0x0;var _0x1fd625=_0x60aa[_0x31b761];return _0x1fd625;};'use strict';var client=require('../client');exports[_0xa60a('0x0')]=function(_0x55582f){return function(_0x1ab7ec){return client[_0xa60a('0x1')](_0xa60a('0x2'),{'options':{'raw':!![],'attributes':['id',_0xa60a('0x3'),_0xa60a('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 90f00f3..693374b 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 _0x9b9a=['GetTrigger','name','channel','Condition','AllConditions','field','value','operator','Action','Actions','action','data2','data3','data4','data5','data6','data7','../client','getTriggers'];(function(_0x4f49f7,_0x37517b){var _0x244178=function(_0x1f3b2d){while(--_0x1f3b2d){_0x4f49f7['push'](_0x4f49f7['shift']());}};_0x244178(++_0x37517b);}(_0x9b9a,0x12e));var _0xa9b9=function(_0x25b590,_0x3e174d){_0x25b590=_0x25b590-0x0;var _0x247a49=_0x9b9a[_0x25b590];return _0x247a49;};'use strict';var client=require(_0xa9b9('0x0'));exports[_0xa9b9('0x1')]=function(_0x3ae085){return function(_0x17f05c){return client['Request'](_0xa9b9('0x2'),{'options':{'raw':![],'attributes':['id',_0xa9b9('0x3'),_0xa9b9('0x4'),'status'],'include':[{'model':_0xa9b9('0x5'),'as':_0xa9b9('0x6'),'attributes':['id',_0xa9b9('0x7'),'operator',_0xa9b9('0x8')]},{'model':_0xa9b9('0x5'),'as':'AnyConditions','attributes':['id','field',_0xa9b9('0x9'),_0xa9b9('0x8')]},{'model':_0xa9b9('0xa'),'as':_0xa9b9('0xb'),'attributes':['id',_0xa9b9('0xc'),'data1',_0xa9b9('0xd'),_0xa9b9('0xe'),_0xa9b9('0xf'),_0xa9b9('0x10'),_0xa9b9('0x11'),_0xa9b9('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xf81e=['Request','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data2','data3','data4','data6','GetTrigger','../client'];(function(_0x19f7ec,_0x523430){var _0x4eba4=function(_0x2aa362){while(--_0x2aa362){_0x19f7ec['push'](_0x19f7ec['shift']());}};_0x4eba4(++_0x523430);}(_0xf81e,0x1ed));var _0xef81=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf81e[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0xef81('0x0'));exports['getTriggers']=function(_0x5161ed){return function(_0x137c04){return client[_0xef81('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xef81('0x2'),_0xef81('0x3'),_0xef81('0x4')],'include':[{'model':_0xef81('0x5'),'as':_0xef81('0x6'),'attributes':['id',_0xef81('0x7'),_0xef81('0x8'),_0xef81('0x9')]},{'model':_0xef81('0x5'),'as':_0xef81('0xa'),'attributes':['id',_0xef81('0x7'),_0xef81('0x8'),'value']},{'model':_0xef81('0xb'),'as':_0xef81('0xc'),'attributes':['id',_0xef81('0xd'),'data1',_0xef81('0xe'),_0xef81('0xf'),_0xef81('0x10'),'data5',_0xef81('0x11'),'data7']}]},'log':_0xef81('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 426ca63..2faa74e 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 _0x1beb=['GetTrunk','name','registry','defaultuser','../client','getTrunks','Request'];(function(_0x343580,_0xfb5951){var _0xd2dcca=function(_0x36b557){while(--_0x36b557){_0x343580['push'](_0x343580['shift']());}};_0xd2dcca(++_0xfb5951);}(_0x1beb,0x1d2));var _0xb1be=function(_0x6ca26,_0x2ef4c3){_0x6ca26=_0x6ca26-0x0;var _0x322326=_0x1beb[_0x6ca26];return _0x322326;};'use strict';var client=require(_0xb1be('0x0'));exports[_0xb1be('0x1')]=function(_0x125a54){return function(_0x53e224){return client[_0xb1be('0x2')](_0xb1be('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb1be('0x4'),_0xb1be('0x5'),_0xb1be('0x6')]},'log':_0xb1be('0x3')});};}; \ No newline at end of file +var _0xb150=['getTrunks','Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb150,0x18e));var _0x0b15=function(_0x2a6b68,_0x422702){_0x2a6b68=_0x2a6b68-0x0;var _0x1fb369=_0xb150[_0x2a6b68];return _0x1fb369;};'use strict';var client=require(_0x0b15('0x0'));exports[_0x0b15('0x1')]=function(_0x416729){return function(_0x234c4c){return client[_0x0b15('0x2')](_0x0b15('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x0b15('0x4'),_0x0b15('0x5'),_0x0b15('0x6')]},'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 a0d1ce8..4f14a26 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x38f293,_0x551b97){var _0x4f3a26=function(_0x507680){while(--_0x507680){_0x38f293['push'](_0x38f293['shift']());}};_0x4f3a26(++_0x551b97);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0xcb91[_0x119cd8];return _0x7072a3;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe706,0xa3));var _0x6e70=function(_0x512f81,_0x4a7986){_0x512f81=_0x512f81-0x0;var _0xa15099=_0xe706[_0x512f81];return _0xa15099;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index f803e1e..bc8b8fd 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 _0x360e=['UpdateVoiceAgentReport','create','CreateVoiceAgentReport','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x360e,0xb1));var _0xe360=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x360e[_0x1559a5];return _0x17a783;};'use strict';var client=require('../client');exports[_0xe360('0x0')]=function(_0x3c088e){return client['Request'](_0xe360('0x1'),{'body':_0x3c088e,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x159779,_0x144523,_0x5f370c){return client[_0xe360('0x2')](_0xe360('0x3'),{'body':_0x159779,'options':{'where':{'uniqueid':_0x144523,'interface':_0x5f370c,'agentcomplete':!![]}},'log':_0xe360('0x3')});}; \ No newline at end of file +var _0xe523=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x4f15d3,_0x387363){var _0x3b9205=function(_0x75a864){while(--_0x75a864){_0x4f15d3['push'](_0x4f15d3['shift']());}};_0x3b9205(++_0x387363);}(_0xe523,0x180));var _0x3e52=function(_0x21c246,_0x498740){_0x21c246=_0x21c246-0x0;var _0x23af98=_0xe523[_0x21c246];return _0x23af98;};'use strict';var client=require(_0x3e52('0x0'));exports['create']=function(_0xbe8cd2){return client[_0x3e52('0x1')](_0x3e52('0x2'),{'body':_0xbe8cd2,'log':_0x3e52('0x2')});};exports[_0x3e52('0x3')]=function(_0xb9e4af,_0x177732,_0x4eea91){return client[_0x3e52('0x1')](_0x3e52('0x4'),{'body':_0xb9e4af,'options':{'where':{'uniqueid':_0x177732,'interface':_0x4eea91,'agentcomplete':!![]}},'log':_0x3e52('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 07f374b..adea720 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 _0xa2cf=['util','lodash','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','GetVoiceCallReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa2cf,0x1a1));var _0xfa2c=function(_0x46c425,_0x82512){_0x46c425=_0x46c425-0x0;var _0x264589=_0xa2cf[_0x46c425];return _0x264589;};'use strict';var moment=require(_0xfa2c('0x0'));var util=require(_0xfa2c('0x1'));var _=require(_0xfa2c('0x2'));var client=require('../client');exports['create']=function(_0x5a032e){return client[_0xfa2c('0x3')](_0xfa2c('0x4'),{'body':_[_0xfa2c('0x5')](_0x5a032e,{'source':_0x5a032e[_0xfa2c('0x6')],'destinationcontext':_0x5a032e[_0xfa2c('0x7')],'callerid':_0x5a032e[_0xfa2c('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0xfa2c('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xfa2c('0x3')](_0xfa2c('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xfa2c('0xa')](_0xfa2c('0xb'))[_0xfa2c('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xfa2c('0xd')](_0xfa2c('0xb'))[_0xfa2c('0xc')](_0xfa2c('0xe'))]}},'attributes':[_0xfa2c('0xf'),_0xfa2c('0x10'),_0xfa2c('0x11'),'billableseconds']},'log':_0xfa2c('0x12')});};}; \ No newline at end of file +var _0xcef1=['disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type'];(function(_0x1f1170,_0x3b5783){var _0x127b7b=function(_0x30c5ed){while(--_0x30c5ed){_0x1f1170['push'](_0x1f1170['shift']());}};_0x127b7b(++_0x3b5783);}(_0xcef1,0x1e7));var _0x1cef=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcef1[_0x2c91e9];return _0x13f0ff;};'use strict';var moment=require(_0x1cef('0x0'));var util=require(_0x1cef('0x1'));var _=require(_0x1cef('0x2'));var client=require(_0x1cef('0x3'));exports[_0x1cef('0x4')]=function(_0x48206f){return client[_0x1cef('0x5')](_0x1cef('0x6'),{'body':_['merge'](_0x48206f,{'source':_0x48206f['calleridnum'],'destinationcontext':_0x48206f[_0x1cef('0x7')],'callerid':_0x48206f[_0x1cef('0x8')],'amaflags':_0x1cef('0x9')}),'log':_0x1cef('0x6')});};exports[_0x1cef('0xa')]=function(){return function(){return client[_0x1cef('0x5')](_0x1cef('0xb'),{'options':{'where':{'type':[_0x1cef('0xc')],'createdAt':{'$between':[moment()[_0x1cef('0xd')](_0x1cef('0xe'))[_0x1cef('0xf')](_0x1cef('0x10')),moment()[_0x1cef('0x11')](_0x1cef('0xe'))['format'](_0x1cef('0x10'))]}},'attributes':[_0x1cef('0x12'),_0x1cef('0x13'),_0x1cef('0x14'),_0x1cef('0x15')]},'log':_0x1cef('0x16')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 12828b4..0b9331d 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 _0x7428=['../client','Request','CreateVoiceDialReport'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7428,0x1b6));var _0x8742=function(_0x456cbe,_0x5919cd){_0x456cbe=_0x456cbe-0x0;var _0x45df67=_0x7428[_0x456cbe];return _0x45df67;};'use strict';var client=require(_0x8742('0x0'));exports['create']=function(_0x3b8f38){return client[_0x8742('0x1')](_0x8742('0x2'),{'body':_0x3b8f38,'log':_0x8742('0x2')});}; \ No newline at end of file +var _0x3489=['Request','CreateVoiceDialReport','../client','create'];(function(_0xaa3788,_0x16b35f){var _0x43db9e=function(_0x50556a){while(--_0x50556a){_0xaa3788['push'](_0xaa3788['shift']());}};_0x43db9e(++_0x16b35f);}(_0x3489,0x10e));var _0x9348=function(_0x20843b,_0x56958f){_0x20843b=_0x20843b-0x0;var _0x36f583=_0x3489[_0x20843b];return _0x36f583;};'use strict';var client=require(_0x9348('0x0'));exports[_0x9348('0x1')]=function(_0x3582a5){return client[_0x9348('0x2')](_0x9348('0x3'),{'body':_0x3582a5,'log':_0x9348('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 6224a62..83c564d 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 _0x6b19=['GetVoiceExtension','../client','getVoiceExtensions'];(function(_0x103c5b,_0x1dafeb){var _0x45451d=function(_0x2dfecc){while(--_0x2dfecc){_0x103c5b['push'](_0x103c5b['shift']());}};_0x45451d(++_0x1dafeb);}(_0x6b19,0xe8));var _0x96b1=function(_0x173262,_0x1ae936){_0x173262=_0x173262-0x0;var _0x370336=_0x6b19[_0x173262];return _0x370336;};'use strict';var client=require(_0x96b1('0x0'));exports[_0x96b1('0x1')]=function(){return function(){return client['Request'](_0x96b1('0x2'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x96b1('0x1')});};}; \ No newline at end of file +var _0x85b5=['getVoiceExtensions','GetVoiceExtension','recordingFormat','../client'];(function(_0x27650e,_0x278f7a){var _0x28fe08=function(_0x476eee){while(--_0x476eee){_0x27650e['push'](_0x27650e['shift']());}};_0x28fe08(++_0x278f7a);}(_0x85b5,0x7f));var _0x585b=function(_0x6fe03d,_0x2ce6f3){_0x6fe03d=_0x6fe03d-0x0;var _0x2f9534=_0x85b5[_0x6fe03d];return _0x2f9534;};'use strict';var client=require(_0x585b('0x0'));exports[_0x585b('0x1')]=function(){return function(){return client['Request'](_0x585b('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x585b('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 1f7f5ef..0180fb8 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 _0xaf57=['dialQueueOptions','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x10c9d1,_0x43d60f){var _0x2bcd1c=function(_0x48f8ce){while(--_0x48f8ce){_0x10c9d1['push'](_0x10c9d1['shift']());}};_0x2bcd1c(++_0x43d60f);}(_0xaf57,0x11a));var _0x7af5=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xaf57[_0x47aa64];return _0x549c7a;};'use strict';var client=require(_0x7af5('0x0'));exports[_0x7af5('0x1')]=function(){return function(){return client[_0x7af5('0x2')](_0x7af5('0x3'),{'options':{'raw':![],'attributes':['id',_0x7af5('0x4'),_0x7af5('0x5'),'acwTimeout',_0x7af5('0x6'),_0x7af5('0x7'),'type',_0x7af5('0x8'),_0x7af5('0x9'),_0x7af5('0xa'),'dialLimitQueue',_0x7af5('0xb'),_0x7af5('0xc'),_0x7af5('0xd'),_0x7af5('0xe'),_0x7af5('0xf'),_0x7af5('0x10'),_0x7af5('0x11'),_0x7af5('0x12'),'dialQueueTimeout','dialQueueProject',_0x7af5('0x13'),_0x7af5('0x14'),'dialBusyMaxRetry',_0x7af5('0x15'),_0x7af5('0x16'),'dialNoAnswerRetryFrequency',_0x7af5('0x17'),_0x7af5('0x18'),_0x7af5('0x19'),_0x7af5('0x1a'),_0x7af5('0x1b'),_0x7af5('0x1c'),_0x7af5('0x1d'),_0x7af5('0x1e'),_0x7af5('0x1f'),_0x7af5('0x20'),_0x7af5('0x21'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x7af5('0x22'),_0x7af5('0x23'),_0x7af5('0x24'),_0x7af5('0x25'),_0x7af5('0x26'),'dialOrderByScheduledAt',_0x7af5('0x27'),_0x7af5('0x28'),_0x7af5('0x29'),_0x7af5('0x7'),_0x7af5('0x2a'),'dialRandomLastDigitCallerIdNumber',_0x7af5('0x2b'),_0x7af5('0x2c'),_0x7af5('0x2d'),'dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0x7af5('0x2e'),_0x7af5('0x2f'),_0x7af5('0x30'),_0x7af5('0x31'),_0x7af5('0x32'),_0x7af5('0x33'),'dialPredictiveIntervalMinThreshold',_0x7af5('0x34'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x7af5('0x35'),'as':_0x7af5('0x35'),'attributes':['id','name',_0x7af5('0x36'),_0x7af5('0x37')]},{'model':_0x7af5('0x38'),'as':_0x7af5('0x39'),'attributes':['id',_0x7af5('0x4')]},{'model':'Trunk','as':'TrunkBackup','attributes':['id',_0x7af5('0x4'),'callerid',_0x7af5('0x37')]},{'model':_0x7af5('0x3a'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x7af5('0x3a'),'as':_0x7af5('0x3b'),'attributes':['id','name','interval']}]}]},'log':_0x7af5('0x1')});};}; \ No newline at end of file +var _0x9612=['dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout'];(function(_0x447602,_0x1a7052){var _0x43437b=function(_0x460128){while(--_0x460128){_0x447602['push'](_0x447602['shift']());}};_0x43437b(++_0x1a7052);}(_0x9612,0x180));var _0x2961=function(_0x50158c,_0x43a68d){_0x50158c=_0x50158c-0x0;var _0x5b8134=_0x9612[_0x50158c];return _0x5b8134;};'use strict';var client=require(_0x2961('0x0'));exports[_0x2961('0x1')]=function(){return function(){return client[_0x2961('0x2')](_0x2961('0x3'),{'options':{'raw':![],'attributes':['id',_0x2961('0x4'),_0x2961('0x5'),'acwTimeout','autopause',_0x2961('0x6'),_0x2961('0x7'),_0x2961('0x8'),_0x2961('0x9'),_0x2961('0xa'),_0x2961('0xb'),'dialPowerLevel',_0x2961('0xc'),_0x2961('0xd'),'dialPredictiveInterval',_0x2961('0xe'),'dialOriginateCallerIdNumber',_0x2961('0xf'),_0x2961('0x10'),_0x2961('0x11'),_0x2961('0x12'),_0x2961('0x13'),_0x2961('0x14'),_0x2961('0x15'),_0x2961('0x16'),'dialNoAnswerMaxRetry',_0x2961('0x17'),_0x2961('0x18'),_0x2961('0x19'),'dialGlobalInterval','dialPrefix',_0x2961('0x1a'),_0x2961('0x1b'),_0x2961('0x1c'),'dialAMDGreeting',_0x2961('0x1d'),_0x2961('0x1e'),_0x2961('0x1f'),_0x2961('0x20'),_0x2961('0x21'),_0x2961('0x22'),'dialAMDMaximumWordLength',_0x2961('0x23'),'dialRecallMeTimeout',_0x2961('0x24'),'dialOrderByScheduledAt',_0x2961('0x25'),_0x2961('0x26'),_0x2961('0x27'),_0x2961('0x6'),_0x2961('0x28'),_0x2961('0x29'),'dialCutDigit',_0x2961('0x2a'),_0x2961('0x2b'),_0x2961('0x2c'),_0x2961('0x2d'),_0x2961('0x2e'),_0x2961('0x2f'),_0x2961('0x30'),_0x2961('0x31'),_0x2961('0x32'),_0x2961('0x33'),_0x2961('0x34'),'dialPredictiveIntervalMaxThreshold',_0x2961('0x35'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x2961('0x36'),'as':'Trunk','attributes':['id',_0x2961('0x4'),_0x2961('0x37'),_0x2961('0x38')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0x2961('0x4')]},{'model':_0x2961('0x36'),'as':_0x2961('0x39'),'attributes':['id','name',_0x2961('0x37'),'active']},{'model':_0x2961('0x3a'),'as':_0x2961('0x3a'),'attributes':['id',_0x2961('0x4')],'include':[{'model':_0x2961('0x3a'),'as':'Intervals','attributes':['id',_0x2961('0x4'),_0x2961('0x3b')]}]}]},'log':_0x2961('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b37eb66..496390c 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(_0x285d7d,_0x1448a9){var _0x29a9a3=function(_0x3b7cfb){while(--_0x3b7cfb){_0x285d7d['push'](_0x285d7d['shift']());}};_0x29a9a3(++_0x1448a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x7243d,_0x1545bb){var _0x7c39da=function(_0xa1dfb2){while(--_0xa1dfb2){_0x7243d['push'](_0x7243d['shift']());}};_0x7c39da(++_0x1545bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 875dc3b..89c4842 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 _0x962b=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client','Request'];(function(_0x161fb5,_0x35d253){var _0x2749e1=function(_0x9e2d68){while(--_0x9e2d68){_0x161fb5['push'](_0x161fb5['shift']());}};_0x2749e1(++_0x35d253);}(_0x962b,0xca));var _0xb962=function(_0x5c06f8,_0x46c725){_0x5c06f8=_0x5c06f8-0x0;var _0x260794=_0x962b[_0x5c06f8];return _0x260794;};'use strict';var client=require(_0xb962('0x0'));exports['getVoiceQueueRtPauses']=function(_0x5dc65e){return function(){return client[_0xb962('0x1')](_0xb962('0x2'),{'options':{'where':{'VoiceQueueId':_0x5dc65e,'paused':!![]},'raw':!![]},'log':_0xb962('0x3')});};}; \ No newline at end of file +var _0x82b1=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x82b1,0x16e));var _0x182b=function(_0x1fdd1c,_0x3bd87f){_0x1fdd1c=_0x1fdd1c-0x0;var _0x3950a0=_0x82b1[_0x1fdd1c];return _0x3950a0;};'use strict';var client=require(_0x182b('0x0'));exports[_0x182b('0x1')]=function(_0x26468c){return function(){return client[_0x182b('0x2')](_0x182b('0x3'),{'options':{'where':{'VoiceQueueId':_0x26468c,'paused':!![]},'raw':!![]},'log':_0x182b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 34de0f6..e470aef 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x41efaf,_0x4adf45){var _0x941460=function(_0x5e5623){while(--_0x5e5623){_0x41efaf['push'](_0x41efaf['shift']());}};_0x941460(++_0x4adf45);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0xebba26,_0x2b213d){var _0x1e574c=function(_0x43ba75){while(--_0x43ba75){_0xebba26['push'](_0xebba26['shift']());}};_0x1e574c(++_0x2b213d);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 501f0a4..2ba5740 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 _0x38e2=['blindTransfer','Request','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfereraccountcode','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','isexternal','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridname','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers'];(function(_0x1b591b,_0xdf3e44){var _0x21d671=function(_0x25783e){while(--_0x25783e){_0x1b591b['push'](_0x1b591b['shift']());}};_0x21d671(++_0xdf3e44);}(_0x38e2,0x12e));var _0x238e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x38e2[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x238e('0x0'));exports[_0x238e('0x1')]={};exports[_0x238e('0x2')]=function(_0x3e1e5a){return client[_0x238e('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x3e1e5a[_0x238e('0x4')],'transfererchannel':_0x3e1e5a[_0x238e('0x5')],'transferercalleridnum':_0x3e1e5a[_0x238e('0x6')],'transferercalleridname':_0x3e1e5a['transferercalleridname'],'transfererconnectedlinenum':_0x3e1e5a[_0x238e('0x7')],'transfererconnectedlinename':_0x3e1e5a['transfererconnectedlinename'],'transfereraccountcode':_0x3e1e5a[_0x238e('0x8')],'transferercontext':_0x3e1e5a['transferercontext'],'transfererexten':_0x3e1e5a[_0x238e('0x9')],'transfererlinkedid':_0x3e1e5a['transfererlinkedid'],'transfereechannel':_0x3e1e5a[_0x238e('0xa')],'transfereecalleridnum':_0x3e1e5a[_0x238e('0xb')],'transfereecalleridname':_0x3e1e5a[_0x238e('0xc')],'transfereeconnectedlinenum':_0x3e1e5a[_0x238e('0xd')],'transfereeconnectedlinename':_0x3e1e5a[_0x238e('0xe')],'transfereeaccountcode':_0x3e1e5a[_0x238e('0xf')],'transfereecontext':_0x3e1e5a['transfereecontext'],'transfereeexten':_0x3e1e5a['transfereeexten'],'transfereelinkedid':_0x3e1e5a['transfereelinkedid'],'isexternal':_0x3e1e5a[_0x238e('0x10')],'context':_0x3e1e5a[_0x238e('0x11')],'extension':_0x3e1e5a[_0x238e('0x12')],'type':_0x238e('0x13')},'log':'CreateVoiceTransferReport'});};exports[_0x238e('0x14')]=function(_0x5d9a9f){return client[_0x238e('0x3')](_0x238e('0x15'),{'body':{'result':_0x5d9a9f['result'],'transfererchannel':_0x5d9a9f[_0x238e('0x16')],'transferercalleridnum':_0x5d9a9f['origtransferercalleridnum'],'transferercalleridname':_0x5d9a9f[_0x238e('0x17')],'transfererconnectedlinenum':_0x5d9a9f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5d9a9f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5d9a9f['origtransfereraccountcode'],'transferercontext':_0x5d9a9f['secondtransferercontext'],'transfererexten':_0x5d9a9f[_0x238e('0x18')],'transfererlinkedid':_0x5d9a9f[_0x238e('0x19')],'transfereechannel':_0x5d9a9f[_0x238e('0x1a')],'transfereecalleridnum':_0x5d9a9f[_0x238e('0x1b')],'transfereecalleridname':_0x5d9a9f[_0x238e('0x1c')],'transfereeconnectedlinenum':_0x5d9a9f[_0x238e('0x1d')],'transfereeconnectedlinename':_0x5d9a9f[_0x238e('0x1e')],'transfereeaccountcode':_0x5d9a9f[_0x238e('0x1f')],'transfereecontext':_0x5d9a9f[_0x238e('0x20')],'transfereeexten':_0x5d9a9f[_0x238e('0x21')],'transfereelinkedid':_0x5d9a9f[_0x238e('0x22')],'isexternal':_0x5d9a9f['isexternal'],'context':_0x5d9a9f[_0x238e('0x23')],'extension':_0x5d9a9f[_0x238e('0x24')],'type':_0x238e('0x25')},'log':_0x238e('0x15')});}; \ No newline at end of file +var _0x943e=['transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel'];(function(_0x31b99c,_0x93660d){var _0x5ee164=function(_0x223521){while(--_0x223521){_0x31b99c['push'](_0x31b99c['shift']());}};_0x5ee164(++_0x93660d);}(_0x943e,0x120));var _0xe943=function(_0x3671f0,_0x214142){_0x3671f0=_0x3671f0-0x0;var _0x1de473=_0x943e[_0x3671f0];return _0x1de473;};'use strict';var client=require(_0xe943('0x0'));exports[_0xe943('0x1')]={};exports[_0xe943('0x2')]=function(_0x1627e4){return client['Request'](_0xe943('0x3'),{'body':{'result':_0x1627e4[_0xe943('0x4')],'transfererchannel':_0x1627e4[_0xe943('0x5')],'transferercalleridnum':_0x1627e4['transferercalleridnum'],'transferercalleridname':_0x1627e4[_0xe943('0x6')],'transfererconnectedlinenum':_0x1627e4[_0xe943('0x7')],'transfererconnectedlinename':_0x1627e4['transfererconnectedlinename'],'transfereraccountcode':_0x1627e4[_0xe943('0x8')],'transferercontext':_0x1627e4[_0xe943('0x9')],'transfererexten':_0x1627e4[_0xe943('0xa')],'transfererlinkedid':_0x1627e4[_0xe943('0xb')],'transfereechannel':_0x1627e4[_0xe943('0xc')],'transfereecalleridnum':_0x1627e4[_0xe943('0xd')],'transfereecalleridname':_0x1627e4[_0xe943('0xe')],'transfereeconnectedlinenum':_0x1627e4[_0xe943('0xf')],'transfereeconnectedlinename':_0x1627e4[_0xe943('0x10')],'transfereeaccountcode':_0x1627e4[_0xe943('0x11')],'transfereecontext':_0x1627e4[_0xe943('0x12')],'transfereeexten':_0x1627e4[_0xe943('0x13')],'transfereelinkedid':_0x1627e4[_0xe943('0x14')],'isexternal':_0x1627e4[_0xe943('0x15')],'context':_0x1627e4['context'],'extension':_0x1627e4[_0xe943('0x16')],'type':_0xe943('0x17')},'log':_0xe943('0x3')});};exports[_0xe943('0x18')]=function(_0x554bae){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x554bae[_0xe943('0x4')],'transfererchannel':_0x554bae[_0xe943('0x19')],'transferercalleridnum':_0x554bae[_0xe943('0x1a')],'transferercalleridname':_0x554bae['origtransferercalleridname'],'transfererconnectedlinenum':_0x554bae[_0xe943('0x1b')],'transfererconnectedlinename':_0x554bae[_0xe943('0x1c')],'transfereraccountcode':_0x554bae[_0xe943('0x1d')],'transferercontext':_0x554bae[_0xe943('0x1e')],'transfererexten':_0x554bae['secondtransfererexten'],'transfererlinkedid':_0x554bae[_0xe943('0x1f')],'transfereechannel':_0x554bae[_0xe943('0x20')],'transfereecalleridnum':_0x554bae[_0xe943('0x21')],'transfereecalleridname':_0x554bae[_0xe943('0x22')],'transfereeconnectedlinenum':_0x554bae[_0xe943('0x23')],'transfereeconnectedlinename':_0x554bae[_0xe943('0x24')],'transfereeaccountcode':_0x554bae[_0xe943('0x25')],'transfereecontext':_0x554bae['transfertargetcontext'],'transfereeexten':_0x554bae['transfertargetexten'],'transfereelinkedid':_0x554bae[_0xe943('0x26')],'isexternal':_0x554bae[_0xe943('0x15')],'context':_0x554bae[_0xe943('0x27')],'extension':_0x554bae[_0xe943('0x28')],'type':_0xe943('0x29')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index bbfa774..4814742 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x2f5680,_0x22ef3b){var _0x17e006=function(_0x14b073){while(--_0x14b073){_0x2f5680['push'](_0x2f5680['shift']());}};_0x17e006(++_0x22ef3b);}(_0xb10b,0x12a));var _0xbb10=function(_0x101134,_0x1ed1d3){_0x101134=_0x101134-0x0;var _0xc47acc=_0xb10b[_0x101134];return _0xc47acc;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _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(_0x1117e7,_0x5ea033){var _0x20f175=function(_0x15ae91){while(--_0x15ae91){_0x1117e7['push'](_0x1117e7['shift']());}};_0x20f175(++_0x5ea033);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e9e3d,_0x567718){_0x5e9e3d=_0x5e9e3d-0x0;var _0x579c2c=_0xb10b[_0x5e9e3d];return _0x579c2c;};'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 30366e6..932ebda 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 _0x83d9=['emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','calleridnum','routeId','firstName','lastName','phone','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','destcalleridnum','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','action','toLowerCase','merge','length','bluebird','ioredis','util','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]'];(function(_0x5cf84b,_0x15d72f){var _0x537d56=function(_0x6f8e9d){while(--_0x6f8e9d){_0x5cf84b['push'](_0x5cf84b['shift']());}};_0x537d56(++_0x15d72f);}(_0x83d9,0x134));var _0x983d=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x83d9[_0x24259d];return _0x5a701;};'use strict';var _=require('lodash');var BPromise=require(_0x983d('0x0'));var Redis=require(_0x983d('0x1'));var util=require(_0x983d('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x983d('0x3'));config[_0x983d('0x4')]=_[_0x983d('0x5')](config[_0x983d('0x4')],{'host':_0x983d('0x6'),'port':0x18eb});var io=require(_0x983d('0x7'))(new Redis(config[_0x983d('0x4')]));function emit(_0x3011e3,_0x1c8924,_0x17e962,_0x4b473d,_0x5cb4d2){logger[_0x983d('0x8')](_0x983d('0x9'),_0x3011e3,_0x1c8924['id'],_0x17e962,_0x4b473d,JSON['stringify'](_0x5cb4d2));io['to'](_0x17e962)[_0x983d('0xa')](_0x4b473d,_0x5cb4d2);}exports[_0x983d('0xb')]=function(_0x27fdaa,_0x4caedc,_0x198b4e,_0x3a4d2b){var _0x36f130,_0x586c25;var _0x5c1fbc={};var _0x48c409;var _0x212e9c=Number(_0x198b4e['data1']);var _0x53575a=_0x198b4e['data2']?Boolean(Number(_0x198b4e[_0x983d('0xc')])):![];var _0x165a8a;var _0x26c313=![];if(!_[_0x983d('0xd')](_0x198b4e[_0x983d('0xe')])){if(_0x198b4e[_0x983d('0xe')]=='1')_0x26c313=!![];}if(!_0x26c313){if(_0x3a4d2b[_0x983d('0xf')]){_0x5c1fbc['id']=_0x3a4d2b['xmd-contactid'];}}if(!_0x5c1fbc['id']){_0x5c1fbc[_0x983d('0x10')]=_0x212e9c;_0x165a8a=_0x198b4e['data3']&&_0x198b4e[_0x983d('0x11')]!=='0'?_0x198b4e[_0x983d('0x11')][_0x983d('0x12')](','):['phone'];_0x5c1fbc[_0x983d('0x13')]=_[_0x983d('0x14')](_0x165a8a,function(_0x1dbe66){var _0x25f5d0={};_0x25f5d0[_0x1dbe66]=_0x3a4d2b['routeId']?_0x3a4d2b['destcalleridnum']:_0x3a4d2b[_0x983d('0x15')];return _0x25f5d0;});_0x48c409=_0x3a4d2b[_0x983d('0x16')]?_0x3a4d2b['destcalleridnum']:_0x3a4d2b[_0x983d('0x15')];}var _0xb84d59=['id',_0x983d('0x17'),_0x983d('0x18'),_0x983d('0x19'),_0x983d('0x1a'),'fax',_0x983d('0x10'),_0x983d('0x1b'),_0x983d('0x1c'),_0x983d('0x1d')];var _0x1e9da1=_[_0x983d('0x1e')](_0xb84d59,_0x165a8a);BPromise[_0x983d('0x1f')]()[_0x983d('0x20')](cmContactRpc['getContacts']({'attributes':_0x1e9da1,'where':_0x5c1fbc,'phone':_0x48c409}))[_0x983d('0x20')](function(_0xa8d5ab){_0x586c25=_0xa8d5ab;if(!_[_0x983d('0x21')](_0x586c25)){if(_0x586c25['length']===0x1){_0x36f130=_0x586c25[0x0];logger[_0x983d('0x8')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x3a4d2b[_0x983d('0x22')],_0x4caedc['id'],_0x36f130['id']);}else{logger[_0x983d('0x8')](_0x983d('0x23'),_0x3a4d2b[_0x983d('0x22')],_0x4caedc['id'],_[_0x983d('0x14')](_0x586c25,'id')[_0x983d('0x24')](','));}return;}else{logger[_0x983d('0x8')](_0x983d('0x25'),_0x3a4d2b['uniqueid'],_0x4caedc['id']);var _0x4ca386={'ListId':_0x212e9c};var _0x4bdacb=_0x198b4e['data4']&&_0x198b4e[_0x983d('0x26')]!=='0'?_0x198b4e['data4']:_0x983d('0x19');if(_0x53575a){logger[_0x983d('0x8')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x3a4d2b[_0x983d('0x22')],_0x4caedc['id']);_0x4ca386[_0x4bdacb]=_[_0x983d('0xd')](_0x3a4d2b[_0x983d('0x16')])?_0x3a4d2b[_0x983d('0x15')]:_0x3a4d2b[_0x983d('0x27')];if(_[_0x983d('0xd')](_0x3a4d2b[_0x983d('0x16')])){_0x4ca386[_0x983d('0x17')]=_0x3a4d2b[_0x983d('0x28')]&&_0x3a4d2b[_0x983d('0x28')]!==_0x983d('0x29')?_0x3a4d2b[_0x983d('0x28')]:'Unknown';}else{_0x4ca386[_0x983d('0x17')]=_0x3a4d2b[_0x983d('0x2a')]&&_0x3a4d2b[_0x983d('0x2a')]!==_0x983d('0x29')?_0x3a4d2b['destcalleridname']:_0x983d('0x2b');}return BPromise['resolve']()[_0x983d('0x20')](cmContactRpc[_0x983d('0x2c')](_0x4ca386))['then'](function(_0x42fb72){_0x36f130=_0x42fb72;_0x586c25[_0x983d('0x2d')](_0x42fb72);if(_0x36f130){logger[_0x983d('0x8')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x3a4d2b['uniqueid'],_0x4caedc['id'],_0x36f130['id']);}return;});}else{logger[_0x983d('0x8')](_0x983d('0x2e'),_0x3a4d2b[_0x983d('0x22')],_0x4caedc['id']);_0x4ca386[_0x4bdacb]=_[_0x983d('0xd')](_0x3a4d2b['routeId'])?_0x3a4d2b[_0x983d('0x15')]:_0x3a4d2b[_0x983d('0x27')];if(_[_0x983d('0xd')](_0x3a4d2b[_0x983d('0x16')])){_0x4ca386[_0x983d('0x17')]=_0x3a4d2b[_0x983d('0x28')]&&_0x3a4d2b['calleridname']!==_0x983d('0x29')?_0x3a4d2b[_0x983d('0x28')]:_0x983d('0x2b');}else{_0x4ca386[_0x983d('0x17')]=_0x3a4d2b[_0x983d('0x2a')]&&_0x3a4d2b[_0x983d('0x2a')]!==_0x983d('0x29')?_0x3a4d2b[_0x983d('0x2a')]:'Unknown';}_0x36f130=_0x4ca386;_0x586c25['push'](_0x4ca386);return;}}})[_0x983d('0x20')](function(){if(_0x27fdaa){emit(_0x3a4d2b['uniqueid'],_0x4caedc,util[_0x983d('0x2f')]('user:%s',_0x27fdaa[_0x983d('0x30')]),util['format']('trigger:%s',_0x198b4e[_0x983d('0x31')][_0x983d('0x32')]()),{'evt':_[_0x983d('0x33')](_0x3a4d2b,{'autoCreate':_0x53575a}),'contact':_0x36f130===undefined?{}:_0x36f130,'contacts':_0x586c25[_0x983d('0x34')]===0x0?undefined:_0x586c25});}});}; \ No newline at end of file +var _0x3f19=['util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','socket.io-emitter','[CM][%s][%s]','stringify','exec','data1','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','calleridnum','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','info','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','trigger:%s','action','merge','lodash','bluebird','ioredis'];(function(_0x521981,_0x16e063){var _0x369d6a=function(_0x2ae424){while(--_0x2ae424){_0x521981['push'](_0x521981['shift']());}};_0x369d6a(++_0x16e063);}(_0x3f19,0x1b5));var _0x93f1=function(_0x507458,_0x1096bf){_0x507458=_0x507458-0x0;var _0x5f43ad=_0x3f19[_0x507458];return _0x5f43ad;};'use strict';var _=require(_0x93f1('0x0'));var BPromise=require(_0x93f1('0x1'));var Redis=require(_0x93f1('0x2'));var util=require(_0x93f1('0x3'));var config=require(_0x93f1('0x4'));var logger=require(_0x93f1('0x5'))(_0x93f1('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x93f1('0x7')]=_[_0x93f1('0x8')](config[_0x93f1('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x93f1('0x9'))(new Redis(config[_0x93f1('0x7')]));function emit(_0xc4cff5,_0x2cf4ba,_0x24f294,_0x4a4e83,_0x22269a){logger['info'](_0x93f1('0xa'),_0xc4cff5,_0x2cf4ba['id'],_0x24f294,_0x4a4e83,JSON[_0x93f1('0xb')](_0x22269a));io['to'](_0x24f294)['emit'](_0x4a4e83,_0x22269a);}exports[_0x93f1('0xc')]=function(_0x4aed9a,_0x3dea6b,_0x21d4f2,_0x2e6a62){var _0x3fb3ae,_0x5c1df4;var _0x3a3a22={};var _0x20146;var _0x33c5e5=Number(_0x21d4f2[_0x93f1('0xd')]);var _0x3d979c=_0x21d4f2['data2']?Boolean(Number(_0x21d4f2['data2'])):![];var _0x3d70a2;var _0x2c496f=![];if(!_['isNil'](_0x21d4f2[_0x93f1('0xe')])){if(_0x21d4f2[_0x93f1('0xe')]=='1')_0x2c496f=!![];}if(!_0x2c496f){if(_0x2e6a62[_0x93f1('0xf')]){_0x3a3a22['id']=_0x2e6a62[_0x93f1('0xf')];}}if(!_0x3a3a22['id']){_0x3a3a22[_0x93f1('0x10')]=_0x33c5e5;_0x3d70a2=_0x21d4f2[_0x93f1('0x11')]&&_0x21d4f2[_0x93f1('0x11')]!=='0'?_0x21d4f2[_0x93f1('0x11')][_0x93f1('0x12')](','):[_0x93f1('0x13')];_0x3a3a22['$or']=_[_0x93f1('0x14')](_0x3d70a2,function(_0x374c22){var _0x1b80bd={};_0x1b80bd[_0x374c22]=_0x2e6a62[_0x93f1('0x15')]?_0x2e6a62['destcalleridnum']:_0x2e6a62[_0x93f1('0x16')];return _0x1b80bd;});_0x20146=_0x2e6a62[_0x93f1('0x15')]?_0x2e6a62[_0x93f1('0x17')]:_0x2e6a62[_0x93f1('0x16')];}var _0x3ee4ec=['id',_0x93f1('0x18'),_0x93f1('0x19'),_0x93f1('0x13'),_0x93f1('0x1a'),_0x93f1('0x1b'),'ListId',_0x93f1('0x1c'),_0x93f1('0x1d'),_0x93f1('0x1e')];var _0x303fe1=_['union'](_0x3ee4ec,_0x3d70a2);BPromise[_0x93f1('0x1f')]()[_0x93f1('0x20')](cmContactRpc[_0x93f1('0x21')]({'attributes':_0x303fe1,'where':_0x3a3a22,'phone':_0x20146}))[_0x93f1('0x20')](function(_0x1d2b00){_0x5c1df4=_0x1d2b00;if(!_[_0x93f1('0x22')](_0x5c1df4)){if(_0x5c1df4[_0x93f1('0x23')]===0x1){_0x3fb3ae=_0x5c1df4[0x0];logger[_0x93f1('0x24')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x2e6a62[_0x93f1('0x25')],_0x3dea6b['id'],_0x3fb3ae['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2e6a62[_0x93f1('0x25')],_0x3dea6b['id'],_[_0x93f1('0x14')](_0x5c1df4,'id')[_0x93f1('0x26')](','));}return;}else{logger[_0x93f1('0x24')](_0x93f1('0x27'),_0x2e6a62[_0x93f1('0x25')],_0x3dea6b['id']);var _0x1c089d={'ListId':_0x33c5e5};var _0x49af7e=_0x21d4f2[_0x93f1('0x28')]&&_0x21d4f2['data4']!=='0'?_0x21d4f2[_0x93f1('0x28')]:_0x93f1('0x13');if(_0x3d979c){logger['info'](_0x93f1('0x29'),_0x2e6a62['uniqueid'],_0x3dea6b['id']);_0x1c089d[_0x49af7e]=_[_0x93f1('0x2a')](_0x2e6a62[_0x93f1('0x15')])?_0x2e6a62[_0x93f1('0x16')]:_0x2e6a62['destcalleridnum'];if(_[_0x93f1('0x2a')](_0x2e6a62[_0x93f1('0x15')])){_0x1c089d['firstName']=_0x2e6a62[_0x93f1('0x2b')]&&_0x2e6a62[_0x93f1('0x2b')]!==''?_0x2e6a62[_0x93f1('0x2b')]:_0x93f1('0x2c');}else{_0x1c089d[_0x93f1('0x18')]=_0x2e6a62[_0x93f1('0x2d')]&&_0x2e6a62[_0x93f1('0x2d')]!==''?_0x2e6a62[_0x93f1('0x2d')]:_0x93f1('0x2c');}return BPromise['resolve']()[_0x93f1('0x20')](cmContactRpc[_0x93f1('0x2e')](_0x1c089d))[_0x93f1('0x20')](function(_0xe53c30){_0x3fb3ae=_0xe53c30;_0x5c1df4[_0x93f1('0x2f')](_0xe53c30);if(_0x3fb3ae){logger[_0x93f1('0x24')](_0x93f1('0x30'),_0x2e6a62['uniqueid'],_0x3dea6b['id'],_0x3fb3ae['id']);}return;});}else{logger['info'](_0x93f1('0x31'),_0x2e6a62[_0x93f1('0x25')],_0x3dea6b['id']);_0x1c089d[_0x49af7e]=_[_0x93f1('0x2a')](_0x2e6a62[_0x93f1('0x15')])?_0x2e6a62[_0x93f1('0x16')]:_0x2e6a62[_0x93f1('0x17')];if(_['isNil'](_0x2e6a62['routeId'])){_0x1c089d['firstName']=_0x2e6a62[_0x93f1('0x2b')]&&_0x2e6a62[_0x93f1('0x2b')]!==_0x93f1('0x32')?_0x2e6a62['calleridname']:_0x93f1('0x2c');}else{_0x1c089d[_0x93f1('0x18')]=_0x2e6a62[_0x93f1('0x2d')]&&_0x2e6a62[_0x93f1('0x2d')]!==_0x93f1('0x32')?_0x2e6a62[_0x93f1('0x2d')]:_0x93f1('0x2c');}_0x3fb3ae=_0x1c089d;_0x5c1df4[_0x93f1('0x2f')](_0x1c089d);return;}}})[_0x93f1('0x20')](function(){if(_0x4aed9a){emit(_0x2e6a62[_0x93f1('0x25')],_0x3dea6b,util['format']('user:%s',_0x4aed9a['name']),util[_0x93f1('0x33')](_0x93f1('0x34'),_0x21d4f2[_0x93f1('0x35')]['toLowerCase']()),{'evt':_[_0x93f1('0x36')](_0x2e6a62,{'autoCreate':_0x3d979c}),'contact':_0x3fb3ae===undefined?{}:_0x3fb3ae,'contacts':_0x5c1df4[_0x93f1('0x23')]===0x0?undefined:_0x5c1df4});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 1608e64..c348218 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 _0x167a=['socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','zohoAccounts','servicenowAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:offlineMessage','prototype','emit','info','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','status','checkTrigger','variables','Actions','length','interface','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','data1','merge','jscripty','trigger:%s','exec','accounts','queue','routeId','urlforward','query','search','replace','channel','every','AllConditions','checkConditions','AnyConditions','checkTrigger:\x20trigger','evt','field','chat','ChatWebsiteId','value','AccountId','operator','interaction','message','event','agent','membername','lastevent','mailSubstatus','substatus','offlineMessage','created','exports','util','lodash','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/logger','trigger','../ami','defaults','redis','localhost'];(function(_0x5772e9,_0xc7c10){var _0x1195f6=function(_0x26c584){while(--_0x26c584){_0x5772e9['push'](_0x5772e9['shift']());}};_0x1195f6(++_0xc7c10);}(_0x167a,0xfa));var _0xa167=function(_0x344784,_0xbd0943){_0x344784=_0x344784-0x0;var _0x2ae6f=_0x167a[_0x344784];return _0x2ae6f;};'use strict';var util=require(_0xa167('0x0'));var _=require(_0xa167('0x1'));var url=require(_0xa167('0x2'));var Mustache=require(_0xa167('0x3'));var Redis=require(_0xa167('0x4'));var urlforward=require(_0xa167('0x5'));var integration=require('./integration');var cmContact=require(_0xa167('0x6'));var script=require(_0xa167('0x7'));var config=require('../../../config/environment');var logger=require(_0xa167('0x8'))(_0xa167('0x9'));var ami=require(_0xa167('0xa'));config['redis']=_[_0xa167('0xb')](config[_0xa167('0xc')],{'host':_0xa167('0xd'),'port':0x18eb});var io=require(_0xa167('0xe'))(new Redis(config[_0xa167('0xc')]));var operators={'equals':function(_0x27c570,_0x12079c){return _0x27c570==_0x12079c;},'not_equals':function(_0xeacda4,_0xbe362f){return _0xeacda4!=_0xbe362f;}};var barAndWebActions=[_0xa167('0xf'),_0xa167('0x2'),_0xa167('0x10')];function Trigger(_0x16ae32){this[_0xa167('0x11')]=_0x16ae32[_0xa167('0x11')];this[_0xa167('0x12')]=_0x16ae32[_0xa167('0x12')];this['voiceQueues']=_0x16ae32[_0xa167('0x13')];this[_0xa167('0x14')]=_0x16ae32['templates'];this[_0xa167('0x15')]=_0x16ae32[_0xa167('0x15')];this[_0xa167('0x16')]=_0x16ae32['zendeskAccounts'];this[_0xa167('0x17')]=_0x16ae32['freshdeskAccounts'];this[_0xa167('0x18')]=_0x16ae32[_0xa167('0x18')];this[_0xa167('0x19')]=_0x16ae32[_0xa167('0x19')];this['zohoAccounts']=_0x16ae32['zohoAccounts'];this[_0xa167('0x1a')]=_0x16ae32[_0xa167('0x1a')];this[_0xa167('0x1b')]=_0x16ae32[_0xa167('0x1b')];this['servicenowAccounts']=_0x16ae32['servicenowAccounts'];this[_0xa167('0x1c')]=_0x16ae32[_0xa167('0x1c')];this['freshsalesAccounts']=_0x16ae32[_0xa167('0x1d')];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xa167('0x18')],'freshdesk':this[_0xa167('0x17')],'sugarcrm':this[_0xa167('0x19')],'zoho':this[_0xa167('0x1e')],'desk':this[_0xa167('0x1a')],'vtiger':this[_0xa167('0x1b')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xa167('0x1d')],'servicenow':this[_0xa167('0x1f')]};ami['on'](_0xa167('0x20'),this[_0xa167('0x21')][_0xa167('0x22')](this));ami['on']('custom:agentconnect',this[_0xa167('0x21')]['bind'](this));ami['on'](_0xa167('0x23'),this[_0xa167('0x21')][_0xa167('0x22')](this));ami['on'](_0xa167('0x24'),this[_0xa167('0x21')]['bind'](this));ami['on'](_0xa167('0x25'),this[_0xa167('0x21')][_0xa167('0x22')](this));ami['on'](_0xa167('0x26'),this[_0xa167('0x21')][_0xa167('0x22')](this));ami['on'](_0xa167('0x27'),this[_0xa167('0x21')][_0xa167('0x22')](this));ami['on'](_0xa167('0x28'),this['syncCustomEvent'][_0xa167('0x22')](this));ami['on'](_0xa167('0x29'),this[_0xa167('0x21')][_0xa167('0x22')](this));ami['on'](_0xa167('0x2a'),this[_0xa167('0x21')]['bind'](this));ami['on'](_0xa167('0x2b'),this[_0xa167('0x21')][_0xa167('0x22')](this));ami['on']('custom:timeout',this[_0xa167('0x21')][_0xa167('0x22')](this));ami['on'](_0xa167('0x2c'),this['syncAgentDial']['bind'](this));ami['on'](_0xa167('0x2d'),this[_0xa167('0x2e')]['bind'](this));ami['on'](_0xa167('0x2f'),this['syncAgentDial'][_0xa167('0x22')](this));ami['on']('custom:newinteraction',this[_0xa167('0x21')][_0xa167('0x22')](this));ami['on'](_0xa167('0x30'),this[_0xa167('0x21')][_0xa167('0x22')](this));ami['on'](_0xa167('0x31'),this['syncCustomEvent'][_0xa167('0x22')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0xa167('0x32'),this['syncCustomEvent'][_0xa167('0x22')](this));ami['on']('custom:acceptmessage',this[_0xa167('0x21')]['bind'](this));ami['on']('custom:rejectmessage',this[_0xa167('0x21')][_0xa167('0x22')](this));ami['on'](_0xa167('0x33'),this[_0xa167('0x21')][_0xa167('0x22')](this));}Trigger[_0xa167('0x34')][_0xa167('0x35')]=function(_0x4759e1,_0x4ad9ba,_0x4b9521){logger[_0xa167('0x36')](_0x4759e1,_0x4ad9ba,JSON['stringify'](_0x4b9521));io['to'](_0x4759e1)[_0xa167('0x35')](_0x4ad9ba,_0x4b9521);};Trigger[_0xa167('0x34')][_0xa167('0x21')]=function(_0x510fa5){var _0x528179=_[_0xa167('0x37')](_0x510fa5);if(typeof _0x528179[_0xa167('0x38')]===_0xa167('0x39')){_0x528179[_0xa167('0x38')]=_0xa167('0x3a');}logger[_0xa167('0x3b')](_0xa167('0x21'),util[_0xa167('0x3c')](_0x528179,{'showHidden':!![],'depth':null}));this[_0xa167('0x3d')](_0x528179);};Trigger[_0xa167('0x34')][_0xa167('0x2e')]=function(_0x21718f){if(this[_0xa167('0x12')][_0x21718f['interface']]){this['syncCustomEvent'](_0x21718f);}};Trigger[_0xa167('0x34')][_0xa167('0x3d')]=function(_0xc3766){var _0x59e59c;for(var _0x50e4a0 in this[_0xa167('0x11')]){if(this[_0xa167('0x11')]['hasOwnProperty'](_0x50e4a0)){if(this[_0xa167('0x11')][_0x50e4a0][_0xa167('0x3e')]){_0x59e59c=this[_0xa167('0x3f')](this[_0xa167('0x11')][_0x50e4a0],_0xc3766);if(_0x59e59c){_['merge'](_0xc3766,_0xc3766[_0xa167('0x40')]);for(var _0x27f3c=0x0,_0x5228fc,_0x369908,_0x9b50b5;_0x27f3c0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','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','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x285732,_0x3650bc){var _0x18be54=function(_0x24ef3c){while(--_0x24ef3c){_0x285732['push'](_0x285732['shift']());}};_0x18be54(++_0x3650bc);}(_0x814b,0x1a2));var _0xb814=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x814b[_0x27d958];return _0x53e63e;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 7dc8275..43767f0 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 _0x3345=['clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info','userEmail','length','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','Subjects','getString','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','assign','Descriptions','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data5','POST'];(function(_0xc1a7d3,_0x6ac180){var _0x576e8d=function(_0x46d9cb){while(--_0x46d9cb){_0xc1a7d3['push'](_0xc1a7d3['shift']());}};_0x576e8d(++_0x6ac180);}(_0x3345,0xce));var _0x5334=function(_0x1ec113,_0x5bc007){_0x1ec113=_0x1ec113-0x0;var _0x3e30d7=_0x3345[_0x1ec113];return _0x3e30d7;};'use strict';var _=require(_0x5334('0x0'));var rp=require('request-promise');var util=require(_0x5334('0x1'));var intUtil=require(_0x5334('0x2'));var md5=require(_0x5334('0x3'));var Redis=require(_0x5334('0x4'));var logger=require('../../../../config/logger')(_0x5334('0x5'));var config=require(_0x5334('0x6'));config[_0x5334('0x7')]=_['defaults'](config['redis'],{'host':_0x5334('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5334('0x7')]));function getAuthToken(_0x1d2bd2,_0x2a6e8d,_0x22565e){if(_0x1d2bd2[_0x5334('0x9')]){_0x1d2bd2[_0x5334('0xa')]=_0x1d2bd2[_0x5334('0xb')][_0x5334('0xc')];_0x1d2bd2[_0x5334('0xd')]=_0x1d2bd2[_0x5334('0xb')]['data2'];return Promise['resolve'](_0x1d2bd2[_0x5334('0xb')][_0x5334('0xe')]);}var _0x1c8526={'method':_0x5334('0xf'),'uri':_0x2a6e8d,'form':{'client_id':_0x1d2bd2[_0x5334('0x10')],'resource':_0x1d2bd2[_0x5334('0xa')],'username':_0x1d2bd2[_0x5334('0x11')],'password':_0x1d2bd2[_0x5334('0x12')],'grant_type':'password','client_secret':_0x1d2bd2[_0x5334('0x13')]},'json':!![]};return rp(_0x1c8526)[_0x5334('0x14')](function(_0x308fd2){return _0x308fd2[_0x5334('0x15')];})[_0x5334('0x16')](function(_0x195ec2){logger[_0x5334('0x17')]('['+[_0x22565e[_0x5334('0x18')]()]+_0x5334('0x19'));return _0x195ec2[_0x5334('0x1a')];});}function getUser(_0x4d40bb,_0x27ad37,_0x4f652c,_0x3c2f18,_0x2831c4,_0x33c251){return new Promise(function(_0x17dda3,_0x2d19b9){return getAuthToken(_0x27ad37,_0x3c2f18,_0x33c251)['then'](function(_0xdbdc44){var _0x396e28={'method':_0x5334('0x1b'),'uri':_0x2831c4+_0x5334('0x1c'),'headers':{'Authorization':_0x5334('0x1d')+_0xdbdc44,'OData-Version':_0x5334('0x1e')},'json':!![]};return rp(_0x396e28);})[_0x5334('0x14')](function(_0x30c6af){var _0x533530=_0x30c6af[_0x5334('0x1f')];var _0x32c5eb=![];var _0x1ae209=null;if(!_[_0x5334('0x20')](_0x4f652c)){if(intUtil['validateEmail'](_0x4f652c[_0x5334('0x21')])){_0x4d40bb['userEmail']=_0x4f652c[_0x5334('0x21')];for(_0x1ae209=0x0;_0x1ae209<_0x533530['length'];_0x1ae209++){if(_0x533530[_0x1ae209]['internalemailaddress']===_0x4f652c[_0x5334('0x21')]&&!_0x533530[_0x1ae209][_0x5334('0x22')]){_0x32c5eb=!![];logger['info']('['+[_0x33c251[_0x5334('0x18')]()]+_0x5334('0x23')+_0x533530[_0x1ae209][_0x5334('0x24')]+'!');_0x4d40bb[_0x5334('0x25')]=_0x533530[_0x1ae209][_0x5334('0x24')];}}}}if(!_0x32c5eb){logger[_0x5334('0x26')]('['+[_0x33c251[_0x5334('0x18')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4d40bb[_0x5334('0x27')]=_0x27ad37[_0x5334('0x11')];for(_0x1ae209=0x0;_0x1ae209<_0x533530[_0x5334('0x28')];_0x1ae209++){if(_0x533530[_0x1ae209][_0x5334('0x29')]===_0x27ad37[_0x5334('0x11')]){_0x4d40bb[_0x5334('0x25')]=_0x533530[_0x1ae209][_0x5334('0x24')];}}}_0x17dda3(_0x4d40bb);})[_0x5334('0x16')](function(_0x2f2171){_0x2d19b9(_0x2f2171[_0x5334('0x1a')]);});});}function createEndUser(_0x40d1d3,_0x3e4c87,_0x40279d,_0x3c361e,_0x52d53a,_0x33ae55,_0x3d1a00){return new Promise(function(_0x145ce7,_0x4b07a1){return getAuthToken(_0x3e4c87,_0x40279d,_0x33ae55)['then'](function(_0x194d2e){var _0xc50cf2=_0x33ae55[_0x5334('0x2a')]()===_0x5334('0x2b')?_0x52d53a[_0x5334('0x2c')]:_0x52d53a[_0x5334('0x2d')];var _0x3ea395={'method':_0x5334('0xf'),'uri':_0x3c361e+'contacts','body':{'fullname':_0xc50cf2,'firstname':_0xc50cf2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5334('0x2e')+_0x40d1d3[_0x5334('0x25')]+')'},'headers':{'Authorization':_0x5334('0x1d')+_0x194d2e,'OData-Version':_0x5334('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x3ea395[_0x5334('0x2f')][_0x3d1a00]=_0xc50cf2;return rp(_0x3ea395);})['then'](function(_0x5bd5d5){var _0x193b0d=_0x5bd5d5[_0x5334('0x30')][_0x5334('0x31')];var _0x435b89=_0x193b0d[_0x5334('0x32')](_0x193b0d[_0x5334('0x33')]('(')+0x1,_0x193b0d[_0x5334('0x33')](')'));_0x40d1d3[_0x5334('0x34')]=_0x435b89;_0x145ce7(_0x40d1d3);})[_0x5334('0x16')](function(_0x956948){_0x4b07a1(_0x956948[_0x5334('0x1a')]);});});}function getEndUser(_0x19d12a,_0x56e744,_0x148370,_0x40b996,_0x11b8da,_0x7c4c68,_0x990a40,_0x4911fd){var _0x4595c3=_0x7c4c68['toLowerCase']()===_0x5334('0x2b')?_0x11b8da[_0x5334('0x2c')]:_0x11b8da['calleridnum'];return getAuthToken(_0x56e744,_0x148370,_0x7c4c68)['then'](function(_0x57eb75){_0x4911fd=_0x4911fd?_0x4911fd:_0x5334('0x35');var _0x14ffae={'method':_0x5334('0x1b'),'uri':_0x40b996+_0x5334('0x36')+_0x4911fd+_0x5334('0x37')+_0x4911fd+_0x5334('0x38')+_0x4595c3['replace']('+',_0x5334('0x39'))+'\x27','headers':{'Authorization':_0x5334('0x1d')+_0x57eb75,'If-None-Match':null,'OData-Version':_0x5334('0x1e')},'json':!![]};return rp(_0x14ffae);})[_0x5334('0x14')](function(_0xdc558d){var _0x306719=![];if(!_0xdc558d)return _0x306719;var _0x3565ea=_0xdc558d['value'];for(var _0x20328a=0x0;_0x20328a<_0x3565ea[_0x5334('0x28')];_0x20328a++){if(_0x3565ea[_0x20328a][_0x4911fd]===_0x4595c3){_0x306719=!![];_0x19d12a[_0x5334('0x34')]=_0x3565ea[_0x20328a][_0x5334('0x3a')];}}return _0x306719;})[_0x5334('0x14')](function(_0x3559d6){if(_0x3559d6)return _0x19d12a;if(_0x990a40===_0x5334('0x3b')){logger[_0x5334('0x26')]('['+[_0x7c4c68[_0x5334('0x18')]()]+_0x5334('0x3c'));return _0x19d12a;}return createEndUser(_0x19d12a,_0x56e744,_0x148370,_0x40b996,_0x11b8da,_0x7c4c68,_0x4911fd)[_0x5334('0x14')](function(_0x2066f0){logger[_0x5334('0x26')]('['+[_0x7c4c68[_0x5334('0x18')]()]+_0x5334('0x3d'),_0x2066f0[_0x5334('0x34')]);return _0x2066f0;});});}function getCustomFields(_0x4cfd73,_0x4c0115,_0x3cf342){var _0x291768={};if(_0x4cfd73[_0x5334('0x28')]>0x0){_['forEach'](_0x4cfd73,function(_0x3d7c50){if(_['includes']([_0x5334('0x3e'),_0x5334('0x3f')],_0x3d7c50[_0x5334('0x40')])&&_0x3d7c50[_0x5334('0x41')]&&!_0x3d7c50[_0x5334('0x42')]){var _0x1b685b=_0x3d7c50[_0x5334('0x43')][_0x5334('0x2a')]();var _0x1a1fd9=_0x1b685b[_0x5334('0x32')](0x0,_0x1b685b[_0x5334('0x44')]('_'));var _0x5643cf=_0x1b685b[_0x5334('0x32')](_0x1b685b['indexOf']('_')+0x1);if(_0x1a1fd9===_0x3cf342){_0x291768[_0x5643cf]=_0x3d7c50[_0x5334('0x45')];}}});}return _0x291768;}function getTicket(_0x4e8421,_0x3c8423,_0x494bfd,_0xc9d781,_0x4b7e36,_0x48d6f0,_0x3b2dbd){return new Promise(function(_0x387932,_0x472cc3){var _0x1a1db3;return getAuthToken(_0x3c8423,_0x494bfd,_0x3b2dbd)[_0x5334('0x14')](function(_0x188019){if(_0x48d6f0[_0x5334('0x46')]===_0x5334('0x47')){_0x1a1db3={'method':_0x5334('0xf'),'uri':_0xc9d781+_0x5334('0x48'),'body':Object['assign']({},{'title':intUtil['getString'](_0x48d6f0[_0x5334('0x49')],_0x4b7e36,'\x20'),'description':intUtil[_0x5334('0x4a')](_0x48d6f0['Descriptions'],_0x4b7e36,'\x0a'),'customerid_contact@odata.bind':_0x4e8421['enduserId']?_0x5334('0x4b')+_0x4e8421[_0x5334('0x34')]+')':undefined,'ownerid@odata.bind':_0x5334('0x2e')+_0x4e8421[_0x5334('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x48d6f0[_0x5334('0x4c')],_0x4b7e36,_0x48d6f0[_0x5334('0x46')])),'headers':{'Authorization':_0x5334('0x1d')+_0x188019,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x48d6f0['ticketType']===_0x5334('0x4d')){var _0x4cce55=_0x4e8421['enduserId']?[{'partyid_systemuser@odata.bind':_0x5334('0x2e')+_0x4e8421['userId']+')','participationtypemask':_0x4e8421[_0x5334('0x4e')]===_0x5334('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x5334('0x4b')+_0x4e8421[_0x5334('0x34')]+')','participationtypemask':_0x4e8421[_0x5334('0x4e')]===_0x5334('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5334('0x2e')+_0x4e8421[_0x5334('0x25')]+')','participationtypemask':_0x4e8421['callDirection']===_0x5334('0x4f')?0x2:0x1}];_0x1a1db3={'method':_0x5334('0xf'),'uri':_0xc9d781+_0x5334('0x50'),'body':Object[_0x5334('0x51')]({},{'subject':intUtil[_0x5334('0x4a')](_0x48d6f0[_0x5334('0x49')],_0x4b7e36,'\x20'),'phonenumber':String(_0x4b7e36[_0x5334('0x2d')]),'description':intUtil[_0x5334('0x4a')](_0x48d6f0[_0x5334('0x52')],_0x4b7e36,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4e8421[_0x5334('0x34')]?_0x5334('0x4b')+_0x4e8421[_0x5334('0x34')]+')':undefined,'ownerid@odata.bind':_0x5334('0x2e')+_0x4e8421[_0x5334('0x25')]+')','directioncode':_0x4e8421[_0x5334('0x4e')]===_0x5334('0x4f')?![]:!![],'phonecall_activity_parties':_0x4cce55},getCustomFields(_0x48d6f0[_0x5334('0x4c')],_0x4b7e36,_0x48d6f0[_0x5334('0x46')])),'headers':{'Authorization':_0x5334('0x1d')+_0x188019,'OData-Version':_0x5334('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1a1db3);})[_0x5334('0x14')](function(_0x571541){var _0x1d6a62=_0x571541[_0x5334('0x30')][_0x5334('0x31')];var _0x55c93b=_0x1d6a62[_0x5334('0x32')](_0x1d6a62[_0x5334('0x33')]('(')+0x1,_0x1d6a62['lastIndexOf'](')'));_0x4e8421['ticketId']=_0x55c93b;_0x387932(_0x4e8421);})['catch'](function(_0x17e58a){_0x472cc3(_0x17e58a[_0x5334('0x1a')]);});});}function emit(_0x104853,_0x556a53,_0x392128,_0x57c2a5){var _0x159df0={'uri':util[_0x5334('0x53')](_0x5334('0x54'),_0x104853,_0x392128,_0x57c2a5)};io['to'](util['format']('user:%s',_0x556a53))[_0x5334('0x55')]('trigger:browser:url',_0x159df0);}exports['cs']=function(_0x1e515b,_0x4021e0,_0xe07245,_0x8fc4e1,_0x1d2151,_0x5f1bc4,_0x143742,_0x3824d2){var _0x435b24={};_0x5f1bc4[_0x5334('0xa')]=_0x5f1bc4[_0x5334('0x9')]?intUtil[_0x5334('0x56')](_0x5f1bc4[_0x5334('0xb')]['data7']):intUtil[_0x5334('0x56')](_0x5f1bc4[_0x5334('0xa')]);_0x5f1bc4[_0x5334('0x57')]=intUtil[_0x5334('0x56')](_0x5f1bc4[_0x5334('0x57')]);_0x435b24[_0x5334('0x4e')]=_0x3824d2===_0x5334('0x4f')||_0x3824d2===_0x5334('0x58')?'queue':'outbound';var _0x2cd66f=_0x5f1bc4['modernAuthentication']?util['format']('%s/api/data/v9.0/',_0x5f1bc4['CloudProvider'][_0x5334('0xc')]):util[_0x5334('0x53')](_0x5334('0x59'),_0x5f1bc4[_0x5334('0xa')]);var _0x517d11=util[_0x5334('0x53')](_0x5334('0x5a'),_0x5f1bc4[_0x5334('0xd')]);var _0x37f808=util[_0x5334('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5f1bc4[_0x5334('0x57')],_0x4021e0[_0x5334('0x5b')],md5(_0x4021e0['uniqueid']));if(_0x1d2151&&_0x1d2151[_0x5334('0x5c')]){logger[_0x5334('0x26')](_0x5334('0x5d'),_0x5334('0x5e'));_0x4021e0[_0x5334('0x5f')]=_0x37f808;}else if(_0x143742&&_0x143742['recordingFormat']&&_0x143742[_0x5334('0x60')]!==_0x5334('0x61')){logger[_0x5334('0x26')](_0x5334('0x62'),_0x5334('0x5e'));_0x4021e0['recordingURL']=_0x37f808;}else{_0x4021e0[_0x5334('0x5f')]='';}return getUser(_0x435b24,_0x5f1bc4,_0x8fc4e1,_0x517d11,_0x2cd66f,_0x3824d2)[_0x5334('0x14')](function(_0x382927){logger['info']('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x63'),_0x382927[_0x5334('0x25')]);logger['info']('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x64'),_0x382927[_0x5334('0x27')]);return getEndUser(_0x382927,_0x5f1bc4,_0x517d11,_0x2cd66f,_0x4021e0,_0x3824d2,_0xe07245['moduleCreate'],_0xe07245[_0x5334('0x65')]);})[_0x5334('0x14')](function(_0x1710bf){logger[_0x5334('0x26')]('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x66'),_0x1710bf['enduserId']);logger['info']('['+_0x3824d2['toUpperCase']()+_0x5334('0x67'),_0x4021e0[_0x5334('0x2d')]);return getTicket(_0x1710bf,_0x5f1bc4,_0x517d11,_0x2cd66f,_0x4021e0,_0xe07245,_0x3824d2);})['then'](function(_0x328ee1){logger['info'](util[_0x5334('0x53')]('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x68'),_0xe07245[_0x5334('0x46')],_0x328ee1['ticketId']));logger['info'](util[_0x5334('0x53')]('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x69'),_0x3824d2));if(_0x3824d2!=='unmanaged'&&_0xe07245[_0x5334('0x6a')]){logger[_0x5334('0x26')]('['+_0x3824d2[_0x5334('0x18')]()+']',_0x5334('0x6b'));emit(_0x5f1bc4[_0x5334('0xa')],_0x8fc4e1[_0x5334('0x6c')],_0xe07245[_0x5334('0x46')],_0x328ee1[_0x5334('0x6d')]);}})[_0x5334('0x16')](function(_0x5e4705){logger['error']('['+_0x3824d2[_0x5334('0x18')]()+_0x5334('0x6e'),_0x5e4705[_0x5334('0x1a')]);console[_0x5334('0x17')]('Error\x20running\x20Dynamics365\x20integration',_0x5e4705);});}; \ No newline at end of file +var _0x3eb1=['Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','remoteUri','data7','tenantId','CloudProvider','data2','POST','clientId','password','then','access_token','catch','error','toUpperCase','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','GET','contacts?$select=','\x20eq\x20\x27','replace','%2b','Bearer\x20','enduserId',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','Fields','phonecall','callDirection','queue','/contacts(','phonecalls','calleridnum','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab'];(function(_0x45dfd0,_0x43439b){var _0x1df4a2=function(_0x5f7f9a){while(--_0x5f7f9a){_0x45dfd0['push'](_0x45dfd0['shift']());}};_0x1df4a2(++_0x43439b);}(_0x3eb1,0xd5));var _0x13eb=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x3eb1[_0x5d31f3];return _0x1cc88c;};'use strict';var _=require(_0x13eb('0x0'));var rp=require('request-promise');var util=require(_0x13eb('0x1'));var intUtil=require(_0x13eb('0x2'));var md5=require(_0x13eb('0x3'));var Redis=require(_0x13eb('0x4'));var logger=require('../../../../config/logger')(_0x13eb('0x5'));var config=require(_0x13eb('0x6'));config[_0x13eb('0x7')]=_['defaults'](config['redis'],{'host':_0x13eb('0x8'),'port':0x18eb});var io=require(_0x13eb('0x9'))(new Redis(config['redis']));function getAuthToken(_0x401fa6,_0xc1e42b,_0x1e5155){if(_0x401fa6['modernAuthentication']){_0x401fa6[_0x13eb('0xa')]=_0x401fa6['CloudProvider'][_0x13eb('0xb')];_0x401fa6[_0x13eb('0xc')]=_0x401fa6[_0x13eb('0xd')][_0x13eb('0xe')];return Promise['resolve'](_0x401fa6['CloudProvider']['data5']);}var _0x41466a={'method':_0x13eb('0xf'),'uri':_0xc1e42b,'form':{'client_id':_0x401fa6[_0x13eb('0x10')],'resource':_0x401fa6[_0x13eb('0xa')],'username':_0x401fa6['username'],'password':_0x401fa6[_0x13eb('0x11')],'grant_type':_0x13eb('0x11'),'client_secret':_0x401fa6['clientSecret']},'json':!![]};return rp(_0x41466a)[_0x13eb('0x12')](function(_0x317d07){return _0x317d07[_0x13eb('0x13')];})[_0x13eb('0x14')](function(_0x385fdd){logger[_0x13eb('0x15')]('['+[_0x1e5155[_0x13eb('0x16')]()]+']\x20Wrong\x20credentials!');return _0x385fdd[_0x13eb('0x17')];});}function getUser(_0x5b2b6c,_0x55ae8c,_0x5163a9,_0x4c3b8f,_0x592185,_0x29f454){return new Promise(function(_0x61f216,_0x4d7b72){return getAuthToken(_0x55ae8c,_0x4c3b8f,_0x29f454)[_0x13eb('0x12')](function(_0x388cb0){var _0x226b1e={'method':'GET','uri':_0x592185+_0x13eb('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x388cb0,'OData-Version':_0x13eb('0x19')},'json':!![]};return rp(_0x226b1e);})[_0x13eb('0x12')](function(_0x3279e1){var _0x17cd8d=_0x3279e1[_0x13eb('0x1a')];var _0x2cae53=![];var _0x4f6d05=null;if(!_[_0x13eb('0x1b')](_0x5163a9)){if(intUtil[_0x13eb('0x1c')](_0x5163a9[_0x13eb('0x1d')])){_0x5b2b6c[_0x13eb('0x1e')]=_0x5163a9[_0x13eb('0x1d')];for(_0x4f6d05=0x0;_0x4f6d05<_0x17cd8d[_0x13eb('0x1f')];_0x4f6d05++){if(_0x17cd8d[_0x4f6d05][_0x13eb('0x20')]===_0x5163a9['email']&&!_0x17cd8d[_0x4f6d05]['isdisabled']){_0x2cae53=!![];logger[_0x13eb('0x21')]('['+[_0x29f454[_0x13eb('0x16')]()]+']\x20Agent\x20found\x20'+_0x17cd8d[_0x4f6d05][_0x13eb('0x22')]+'!');_0x5b2b6c[_0x13eb('0x23')]=_0x17cd8d[_0x4f6d05][_0x13eb('0x22')];}}}}if(!_0x2cae53){logger[_0x13eb('0x21')]('['+[_0x29f454[_0x13eb('0x16')]()]+_0x13eb('0x24'));_0x5b2b6c[_0x13eb('0x1e')]=_0x55ae8c[_0x13eb('0x25')];for(_0x4f6d05=0x0;_0x4f6d05<_0x17cd8d['length'];_0x4f6d05++){if(_0x17cd8d[_0x4f6d05][_0x13eb('0x20')]===_0x55ae8c[_0x13eb('0x25')]){_0x5b2b6c[_0x13eb('0x23')]=_0x17cd8d[_0x4f6d05][_0x13eb('0x22')];}}}_0x61f216(_0x5b2b6c);})[_0x13eb('0x14')](function(_0x55ec81){_0x4d7b72(_0x55ec81[_0x13eb('0x17')]);});});}function createEndUser(_0x177500,_0x34b1ea,_0xef6ff3,_0x9da625,_0x2b5882,_0x4fc1f0,_0x571d39){return new Promise(function(_0x3325f6,_0x46ea17){return getAuthToken(_0x34b1ea,_0xef6ff3,_0x4fc1f0)[_0x13eb('0x12')](function(_0x17b5fa){var _0x18b8ab=_0x4fc1f0[_0x13eb('0x26')]()===_0x13eb('0x27')?_0x2b5882[_0x13eb('0x28')]:_0x2b5882['calleridnum'];var _0x518895={'method':_0x13eb('0xf'),'uri':_0x9da625+_0x13eb('0x29'),'body':{'fullname':_0x18b8ab,'firstname':_0x18b8ab,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x13eb('0x2a')+_0x177500[_0x13eb('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x17b5fa,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x518895['body'][_0x571d39]=_0x18b8ab;return rp(_0x518895);})[_0x13eb('0x12')](function(_0x40a5dc){var _0x4c47ed=_0x40a5dc['headers'][_0x13eb('0x2b')];var _0x2f5648=_0x4c47ed[_0x13eb('0x2c')](_0x4c47ed[_0x13eb('0x2d')]('(')+0x1,_0x4c47ed[_0x13eb('0x2d')](')'));_0x177500['enduserId']=_0x2f5648;_0x3325f6(_0x177500);})[_0x13eb('0x14')](function(_0x1e1841){_0x46ea17(_0x1e1841[_0x13eb('0x17')]);});});}function getEndUser(_0xec82c0,_0x305f6e,_0x402b6f,_0x3e92b4,_0xb49c5c,_0x4bcf3a,_0x5dc347,_0x15c2fe){var _0x17b325=_0x4bcf3a[_0x13eb('0x26')]()===_0x13eb('0x27')?_0xb49c5c[_0x13eb('0x28')]:_0xb49c5c['calleridnum'];return getAuthToken(_0x305f6e,_0x402b6f,_0x4bcf3a)[_0x13eb('0x12')](function(_0x12b864){_0x15c2fe=_0x15c2fe?_0x15c2fe:'telephone1';var _0xab3cda={'method':_0x13eb('0x2e'),'uri':_0x3e92b4+_0x13eb('0x2f')+_0x15c2fe+'&$filter='+_0x15c2fe+_0x13eb('0x30')+_0x17b325[_0x13eb('0x31')]('+',_0x13eb('0x32'))+'\x27','headers':{'Authorization':_0x13eb('0x33')+_0x12b864,'If-None-Match':null,'OData-Version':_0x13eb('0x19')},'json':!![]};return rp(_0xab3cda);})[_0x13eb('0x12')](function(_0xbfa558){var _0x734a82=![];if(!_0xbfa558)return _0x734a82;var _0x2c9735=_0xbfa558[_0x13eb('0x1a')];for(var _0x1c7691=0x0;_0x1c7691<_0x2c9735['length'];_0x1c7691++){if(_0x2c9735[_0x1c7691][_0x15c2fe]===_0x17b325){_0x734a82=!![];_0xec82c0[_0x13eb('0x34')]=_0x2c9735[_0x1c7691]['contactid'];}}return _0x734a82;})[_0x13eb('0x12')](function(_0x560d57){if(_0x560d57)return _0xec82c0;if(_0x5dc347==='nothing'){logger[_0x13eb('0x21')]('['+[_0x4bcf3a[_0x13eb('0x16')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0xec82c0;}return createEndUser(_0xec82c0,_0x305f6e,_0x402b6f,_0x3e92b4,_0xb49c5c,_0x4bcf3a,_0x15c2fe)[_0x13eb('0x12')](function(_0x44a716){logger['info']('['+[_0x4bcf3a[_0x13eb('0x16')]()]+_0x13eb('0x35'),_0x44a716[_0x13eb('0x34')]);return _0x44a716;});});}function getCustomFields(_0x5bd6ca,_0x6eba08,_0x54d4e2){var _0x239486={};if(_0x5bd6ca[_0x13eb('0x1f')]>0x0){_[_0x13eb('0x36')](_0x5bd6ca,function(_0x51d241){if(_[_0x13eb('0x37')]([_0x13eb('0x38'),'picklist'],_0x51d241[_0x13eb('0x39')])&&_0x51d241[_0x13eb('0x3a')]&&!_0x51d241[_0x13eb('0x3b')]){var _0x447971=_0x51d241['idField'][_0x13eb('0x26')]();var _0x335bd3=_0x447971[_0x13eb('0x2c')](0x0,_0x447971[_0x13eb('0x3c')]('_'));var _0x24161b=_0x447971['substring'](_0x447971['indexOf']('_')+0x1);if(_0x335bd3===_0x54d4e2){_0x239486[_0x24161b]=_0x51d241[_0x13eb('0x3d')];}}});}return _0x239486;}function getTicket(_0x3ece8f,_0x4dd4e6,_0x2a1cb2,_0x335dbd,_0x97ba43,_0x50b7e7,_0x512f5c){return new Promise(function(_0x8663a9,_0x2bd581){var _0x51e679;return getAuthToken(_0x4dd4e6,_0x2a1cb2,_0x512f5c)[_0x13eb('0x12')](function(_0x5187a4){if(_0x50b7e7[_0x13eb('0x3e')]==='incident'){_0x51e679={'method':_0x13eb('0xf'),'uri':_0x335dbd+_0x13eb('0x3f'),'body':Object[_0x13eb('0x40')]({},{'title':intUtil[_0x13eb('0x41')](_0x50b7e7[_0x13eb('0x42')],_0x97ba43,'\x20'),'description':intUtil['getString'](_0x50b7e7[_0x13eb('0x43')],_0x97ba43,'\x0a'),'customerid_contact@odata.bind':_0x3ece8f['enduserId']?'/contacts('+_0x3ece8f['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3ece8f[_0x13eb('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x50b7e7[_0x13eb('0x44')],_0x97ba43,_0x50b7e7[_0x13eb('0x3e')])),'headers':{'Authorization':_0x13eb('0x33')+_0x5187a4,'OData-Version':_0x13eb('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x50b7e7[_0x13eb('0x3e')]===_0x13eb('0x45')){var _0x4566f9=_0x3ece8f['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3ece8f[_0x13eb('0x23')]+')','participationtypemask':_0x3ece8f[_0x13eb('0x46')]===_0x13eb('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x13eb('0x48')+_0x3ece8f['enduserId']+')','participationtypemask':_0x3ece8f[_0x13eb('0x46')]===_0x13eb('0x47')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x13eb('0x2a')+_0x3ece8f['userId']+')','participationtypemask':_0x3ece8f['callDirection']===_0x13eb('0x47')?0x2:0x1}];_0x51e679={'method':'POST','uri':_0x335dbd+_0x13eb('0x49'),'body':Object[_0x13eb('0x40')]({},{'subject':intUtil['getString'](_0x50b7e7[_0x13eb('0x42')],_0x97ba43,'\x20'),'phonenumber':String(_0x97ba43[_0x13eb('0x4a')]),'description':intUtil[_0x13eb('0x41')](_0x50b7e7['Descriptions'],_0x97ba43,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3ece8f['enduserId']?'/contacts('+_0x3ece8f[_0x13eb('0x34')]+')':undefined,'ownerid@odata.bind':_0x13eb('0x2a')+_0x3ece8f[_0x13eb('0x23')]+')','directioncode':_0x3ece8f[_0x13eb('0x46')]===_0x13eb('0x47')?![]:!![],'phonecall_activity_parties':_0x4566f9},getCustomFields(_0x50b7e7[_0x13eb('0x44')],_0x97ba43,_0x50b7e7[_0x13eb('0x3e')])),'headers':{'Authorization':_0x13eb('0x33')+_0x5187a4,'OData-Version':_0x13eb('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x51e679);})[_0x13eb('0x12')](function(_0x12e0db){var _0x4ea909=_0x12e0db['headers'][_0x13eb('0x2b')];var _0x5a4a7c=_0x4ea909['substring'](_0x4ea909[_0x13eb('0x2d')]('(')+0x1,_0x4ea909[_0x13eb('0x2d')](')'));_0x3ece8f['ticketId']=_0x5a4a7c;_0x8663a9(_0x3ece8f);})[_0x13eb('0x14')](function(_0x31f515){_0x2bd581(_0x31f515[_0x13eb('0x17')]);});});}function emit(_0x21329e,_0xf66384,_0x224e9a,_0x7c9cf9){var _0x4ac79b={'uri':util[_0x13eb('0x4b')](_0x13eb('0x4c'),_0x21329e,_0x224e9a,_0x7c9cf9)};io['to'](util[_0x13eb('0x4b')](_0x13eb('0x4d'),_0xf66384))[_0x13eb('0x4e')](_0x13eb('0x4f'),_0x4ac79b);}exports['cs']=function(_0x2fd299,_0x54d5bf,_0x5a8c89,_0x1dce61,_0x55356e,_0x34f52c,_0x132f8d,_0x1c2128){var _0x225931={};_0x34f52c['remoteUri']=_0x34f52c[_0x13eb('0x50')]?intUtil['stripTrailingSlash'](_0x34f52c[_0x13eb('0xd')][_0x13eb('0xb')]):intUtil[_0x13eb('0x51')](_0x34f52c[_0x13eb('0xa')]);_0x34f52c[_0x13eb('0x52')]=intUtil[_0x13eb('0x51')](_0x34f52c[_0x13eb('0x52')]);_0x225931[_0x13eb('0x46')]=_0x1c2128===_0x13eb('0x47')||_0x1c2128===_0x13eb('0x53')?_0x13eb('0x47'):_0x13eb('0x27');var _0x59b096=_0x34f52c[_0x13eb('0x50')]?util[_0x13eb('0x4b')](_0x13eb('0x54'),_0x34f52c[_0x13eb('0xd')]['data7']):util[_0x13eb('0x4b')]('%s/api/data/v9.0/',_0x34f52c['remoteUri']);var _0x22dec7=util[_0x13eb('0x4b')]('https://login.microsoftonline.com/%s/oauth2/token',_0x34f52c['tenantId']);var _0x8a4090=util[_0x13eb('0x4b')](_0x13eb('0x55'),_0x34f52c[_0x13eb('0x52')],_0x54d5bf[_0x13eb('0x56')],md5(_0x54d5bf['uniqueid']));if(_0x55356e&&_0x55356e['monitor_format']){logger[_0x13eb('0x21')](_0x13eb('0x57'),_0x13eb('0x58'));_0x54d5bf[_0x13eb('0x59')]=_0x8a4090;}else if(_0x132f8d&&_0x132f8d[_0x13eb('0x5a')]&&_0x132f8d[_0x13eb('0x5a')]!=='none'){logger[_0x13eb('0x21')](_0x13eb('0x5b'),'Recording\x20is\x20enabled!');_0x54d5bf[_0x13eb('0x59')]=_0x8a4090;}else{_0x54d5bf[_0x13eb('0x59')]='';}return getUser(_0x225931,_0x34f52c,_0x1dce61,_0x22dec7,_0x59b096,_0x1c2128)['then'](function(_0x14d409){logger[_0x13eb('0x21')]('['+_0x1c2128['toUpperCase']()+_0x13eb('0x5c'),_0x14d409[_0x13eb('0x23')]);logger[_0x13eb('0x21')]('['+_0x1c2128[_0x13eb('0x16')]()+_0x13eb('0x5d'),_0x14d409[_0x13eb('0x1e')]);return getEndUser(_0x14d409,_0x34f52c,_0x22dec7,_0x59b096,_0x54d5bf,_0x1c2128,_0x5a8c89[_0x13eb('0x5e')],_0x5a8c89[_0x13eb('0x5f')]);})[_0x13eb('0x12')](function(_0x41b479){logger[_0x13eb('0x21')]('['+_0x1c2128[_0x13eb('0x16')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x41b479['enduserId']);logger[_0x13eb('0x21')]('['+_0x1c2128['toUpperCase']()+_0x13eb('0x60'),_0x54d5bf[_0x13eb('0x4a')]);return getTicket(_0x41b479,_0x34f52c,_0x22dec7,_0x59b096,_0x54d5bf,_0x5a8c89,_0x1c2128);})[_0x13eb('0x12')](function(_0x2e4564){logger[_0x13eb('0x21')](util[_0x13eb('0x4b')]('['+_0x1c2128['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x5a8c89[_0x13eb('0x3e')],_0x2e4564['ticketId']));logger[_0x13eb('0x21')](util[_0x13eb('0x4b')]('['+_0x1c2128[_0x13eb('0x16')]()+_0x13eb('0x61'),_0x1c2128));if(_0x1c2128!=='unmanaged'&&_0x5a8c89[_0x13eb('0x62')]){logger[_0x13eb('0x21')]('['+_0x1c2128[_0x13eb('0x16')]()+']',_0x13eb('0x63'));emit(_0x34f52c['remoteUri'],_0x1dce61[_0x13eb('0x64')],_0x5a8c89[_0x13eb('0x3e')],_0x2e4564[_0x13eb('0x65')]);}})[_0x13eb('0x14')](function(_0x514a0c){logger[_0x13eb('0x15')]('['+_0x1c2128[_0x13eb('0x16')]()+_0x13eb('0x66'),_0x514a0c[_0x13eb('0x17')]);console[_0x13eb('0x15')](_0x13eb('0x67'),_0x514a0c);});}; \ 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 3b36f43..af63dc0 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 _0x61f8=['Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','base64','[HTTP]','stringify','map','forEach','includes','string','picklist','nameField','content','type','idField','customField','push','toString','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','user:%s','trigger:browser:url','catch','unmanaged','lastevent','toUpperCase','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Tags','name','Fields','custom_fields','keyBy','value','POST','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!'];(function(_0x4f0132,_0xd4ba7){var _0x1b3324=function(_0x2ac785){while(--_0x2ac785){_0x4f0132['push'](_0x4f0132['shift']());}};_0x1b3324(++_0xd4ba7);}(_0x61f8,0xe8));var _0x861f=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0x61f8[_0x592e40];return _0x5d4288;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x861f('0x0'));var Redis=require(_0x861f('0x1'));var intUtil=require(_0x861f('0x2'));var config=require('../../../../config/environment');var logger=require(_0x861f('0x3'))(_0x861f('0x4'));config[_0x861f('0x5')]=_[_0x861f('0x6')](config[_0x861f('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x861f('0x5')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x24df72,_0x27218f,_0x50eded){io['to'](_0x24df72)[_0x861f('0x7')](_0x27218f,_0x50eded);}function getTicket(_0x1d4ad8,_0x2d05a8,_0x25dd4d,_0x474db7,_0x29e4a5){logger['info'](_0x861f('0x8'));var _0x3cead7=_['merge']({'responder_id':_0x2d05a8['id'],'requester_id':_0x25dd4d['id'],'name':util[_0x861f('0x9')](_0x861f('0xa'),_0x29e4a5[_0x861f('0xb')]),'phone':_0x29e4a5['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x861f('0xc')](_0x474db7['Subjects'],_0x29e4a5,'\x20'),'description':intUtil[_0x861f('0xc')](_0x474db7['Descriptions'],_0x29e4a5,'
'),'tags':getTags(_0x474db7[_0x861f('0xd')],_0x861f('0xe'))},getCustomFields(_0x474db7[_0x861f('0xf')],_0x29e4a5));_0x3cead7[_0x861f('0x10')]=_['mapValues'](_[_0x861f('0x11')](_0x3cead7[_0x861f('0x10')],'id'),_0x861f('0x12'));return request({'uri':util[_0x861f('0x9')]('%s/api/v2/tickets',_0x1d4ad8['remoteUri']),'method':_0x861f('0x13'),'body':_0x3cead7})['then'](function(_0x52fd90){logger[_0x861f('0x14')](_0x861f('0x15'));return _0x52fd90;});}function getUser(_0x160d9d,_0x2138ea){if(intUtil[_0x861f('0x16')](_0x2138ea)){return request({'uri':util[_0x861f('0x9')](_0x861f('0x17'),_0x160d9d[_0x861f('0x18')]),'qs':{'email':_0x2138ea}})[_0x861f('0x19')](function(_0x4404c5){if(_0x4404c5['length']){logger['info'](_0x861f('0x1a'));return _[_0x861f('0x1b')](_0x4404c5,function(_0x20a926){return _0x20a926[_0x861f('0x1c')][_0x861f('0x1d')]===_0x2138ea;});}else{logger[_0x861f('0x14')](_0x861f('0x1e'));return request({'uri':util[_0x861f('0x9')]('%s/api/v2/agents/me',_0x160d9d[_0x861f('0x18')])})[_0x861f('0x19')](function(_0x49bdbe){logger[_0x861f('0x14')]('Admin\x20account\x20selected.');return _0x49bdbe;});}});}else{logger[_0x861f('0x14')](_0x861f('0x1f'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x160d9d[_0x861f('0x18')])})['then'](function(_0x353142){logger[_0x861f('0x14')](_0x861f('0x20'));return _0x353142;});}}function getEndUser(_0x3c7e2e,_0xeb6788,_0x366f93){logger[_0x861f('0x14')](_0x861f('0x21'),_0x366f93);return request({'uri':util[_0x861f('0x9')]('%s/api/v2/contacts',_0x3c7e2e[_0x861f('0x18')]),'qs':{'phone':_0x366f93}})[_0x861f('0x19')](function(_0xf0c58e){if(_0xf0c58e[_0x861f('0x22')]){logger[_0x861f('0x14')](_0x861f('0x23'));return _['find'](_0xf0c58e,{'phone':_0x366f93});}else{logger['info'](_0x861f('0x24'));return request({'uri':util[_0x861f('0x9')](_0x861f('0x25'),_0x3c7e2e[_0x861f('0x18')]),'method':_0x861f('0x13'),'body':{'name':_0xeb6788,'phone':_0x366f93}})[_0x861f('0x19')](function(_0x5e06e6){logger[_0x861f('0x14')](_0x861f('0x26'));return _0x5e06e6;});}});}function getAuth(_0x37cb90){return util[_0x861f('0x9')](_0x861f('0x27'),new Buffer(_0x37cb90[_0x861f('0x28')]+':X')['toString'](_0x861f('0x29')));}function request(_0x413d7f){logger['debug'](_0x861f('0x2a'),JSON[_0x861f('0x2b')](_0x413d7f));return rp(_[_0x861f('0x6')](_0x413d7f,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5a7edb,_0x586268){var _0x295c73=[];if(_0x5a7edb&&_0x5a7edb[_0x861f('0x22')]>0x0){_0x295c73=_[_0x861f('0x2c')](_0x5a7edb,_0x586268);}return _0x295c73;}function getCustomFields(_0xd80697,_0x132dba){var _0x3c0e02=[];var _0x24584f={'custom_fields':[]};if(_0xd80697['length']>0x0){_[_0x861f('0x2d')](_0xd80697,function(_0x49b64a){if(_[_0x861f('0x2e')]([_0x861f('0x2f'),_0x861f('0x30')],_0x49b64a['type'])&&_0x49b64a['nameField']&&!_0x49b64a['customField']){_0x24584f[_0x49b64a[_0x861f('0x31')]['toLowerCase']()]=_0x49b64a[_0x861f('0x32')]['toString']();}else if(_['includes'](['string','picklist'],_0x49b64a[_0x861f('0x33')])&&_0x49b64a[_0x861f('0x34')]&&_0x49b64a[_0x861f('0x35')]){_0x24584f[_0x861f('0x10')][_0x861f('0x36')]({'id':_0x49b64a[_0x861f('0x34')],'value':_0x49b64a[_0x861f('0x32')][_0x861f('0x37')]()});}else if(_0x49b64a[_0x861f('0x33')]===_0x861f('0x38')&&_0x49b64a[_0x861f('0x39')]&&_0x49b64a[_0x861f('0x34')]&&_0x49b64a[_0x861f('0x35')]){_0x132dba[_0x49b64a[_0x861f('0x39')]]&&_0x24584f[_0x861f('0x10')]['push']({'id':_0x49b64a[_0x861f('0x34')],'value':_0x132dba[_0x49b64a[_0x861f('0x39')]][_0x861f('0x37')]()});}else if(_0x49b64a[_0x861f('0x33')]===_0x861f('0x3a')&&_0x49b64a[_0x861f('0x3b')]&&_0x49b64a[_0x861f('0x3b')][_0x861f('0xe')]&&_0x49b64a[_0x861f('0x34')]&&_0x49b64a[_0x861f('0x35')]){_0x132dba[_0x49b64a[_0x861f('0x3b')][_0x861f('0xe')]['toLowerCase']()]&&_0x24584f[_0x861f('0x10')][_0x861f('0x36')]({'id':_0x49b64a[_0x861f('0x34')],'value':_0x132dba[_0x49b64a[_0x861f('0x3b')][_0x861f('0xe')][_0x861f('0x3c')]()][_0x861f('0x37')]()});}});}return _0x24584f;}exports[_0x861f('0x3d')]=function(_0x31c57e,_0x5355e0,_0x4ccdcb,_0x8c57b7,_0xdb94a,_0x524b62){var _0x3a17f7,_0x1521fb;_0x524b62[_0x861f('0x18')]=intUtil[_0x861f('0x3e')](_0x524b62[_0x861f('0x18')]);_0x524b62[_0x861f('0x3f')]=intUtil['stripTrailingSlash'](_0x524b62['serverUrl']);if(_0xdb94a&&_0xdb94a[_0x861f('0x40')]){logger['info'](_0x861f('0x41'),_0x861f('0x42'));_0x5355e0[_0x861f('0x43')]=util[_0x861f('0x9')](_0x861f('0x44'),_0x524b62[_0x861f('0x3f')],_0x5355e0[_0x861f('0x45')],md5(_0x5355e0[_0x861f('0x45')]));}else{_0x5355e0[_0x861f('0x43')]='';}headers[_0x861f('0x46')]=getAuth(_0x524b62);return getUser(_0x524b62,_0x8c57b7[_0x861f('0x1d')])['then'](function(_0x572cca){_0x3a17f7=_0x572cca;logger[_0x861f('0x14')](_0x861f('0x47'),_0x3a17f7['id']);return getEndUser(_0x524b62,_0x5355e0[_0x861f('0xb')],_0x5355e0[_0x861f('0x48')]);})[_0x861f('0x19')](function(_0x39517f){_0x1521fb=_0x39517f;logger[_0x861f('0x14')](_0x861f('0x49'),_0x1521fb['id']);return getTicket(_0x524b62,_0x3a17f7,_0x1521fb,_0x4ccdcb,_0x5355e0);})['then'](function(_0x418b93){if(_0x418b93&&_0x418b93['id']){logger['info'](_0x861f('0x15'));logger[_0x861f('0x14')]('The\x20Ticket\x20ID\x20is:',_0x418b93['id']);logger[_0x861f('0x14')](_0x861f('0x41'),_0x861f('0x4a'));emit(util['format']('user:%s',_0x8c57b7[_0x861f('0xe')]),'trigger:browser:url',{'uri':util[_0x861f('0x9')](_0x861f('0x4b'),_0x524b62[_0x861f('0x18')],_0x418b93['id'])});}})['catch'](function(_0x31e968){logger[_0x861f('0x4c')](_0x861f('0x41'),JSON[_0x861f('0x2b')](_0x31e968));});};exports[_0x861f('0x4d')]=function(_0x519ff6,_0x5b6188,_0x2185de,_0x95265d,_0x4680af,_0x2fec57,_0x801ef1){var _0x4dc184,_0x2549d0;_0x2fec57[_0x861f('0x18')]=intUtil[_0x861f('0x3e')](_0x2fec57[_0x861f('0x18')]);_0x2fec57['serverUrl']=intUtil['stripTrailingSlash'](_0x2fec57[_0x861f('0x3f')]);if(_0x801ef1&&_0x801ef1[_0x861f('0x4e')]&&_0x801ef1[_0x861f('0x4e')]!==_0x861f('0x4f')){logger['info'](_0x861f('0x50'),_0x861f('0x42'));_0x5b6188['recordingURL']=util[_0x861f('0x9')](_0x861f('0x44'),_0x2fec57[_0x861f('0x3f')],_0x5b6188[_0x861f('0x45')],md5(_0x5b6188[_0x861f('0x45')]));}headers[_0x861f('0x46')]=getAuth(_0x2fec57);return getUser(_0x2fec57,_0x95265d[_0x861f('0x1d')])[_0x861f('0x19')](function(_0x1c824b){_0x4dc184=_0x1c824b;logger[_0x861f('0x14')]('The\x20User\x20ID\x20is:',_0x4dc184['id']);return getEndUser(_0x2fec57,_0x5b6188['destcalleridname'],_0x5b6188[_0x861f('0x51')]);})[_0x861f('0x19')](function(_0x4011a6){_0x2549d0=_0x4011a6;logger[_0x861f('0x14')](_0x861f('0x49'),_0x2549d0['id']);return getTicket(_0x2fec57,_0x4dc184,_0x2549d0,_0x2185de,_0x5b6188);})['then'](function(_0x2cd2f7){if(_0x2cd2f7&&_0x2cd2f7['id']){logger[_0x861f('0x14')](_0x861f('0x15'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2cd2f7['id']);logger[_0x861f('0x14')](_0x861f('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x861f('0x9')](_0x861f('0x52'),_0x95265d['name']),_0x861f('0x53'),{'uri':util['format'](_0x861f('0x4b'),_0x2fec57[_0x861f('0x18')],_0x2cd2f7['id'])});}})[_0x861f('0x54')](function(_0x219ab2){logger[_0x861f('0x4c')](_0x861f('0x50'),JSON['stringify'](_0x219ab2));});};exports[_0x861f('0x55')]=function(_0x6c5641,_0x277abe,_0x2c06b8,_0x523656,_0x32af36,_0x5de384){var _0x5eacb6,_0x183eb8;_0x5de384[_0x861f('0x18')]=intUtil['stripTrailingSlash'](_0x5de384['remoteUri']);_0x5de384['serverUrl']=intUtil['stripTrailingSlash'](_0x5de384[_0x861f('0x3f')]);if(_0x32af36&&_0x32af36[_0x861f('0x40')]){logger[_0x861f('0x14')]('['+_0x277abe[_0x861f('0x56')]['toUpperCase']()+']',_0x861f('0x42'));_0x277abe[_0x861f('0x43')]=util[_0x861f('0x9')](_0x861f('0x44'),_0x5de384['serverUrl'],_0x277abe['uniqueid'],md5(_0x277abe[_0x861f('0x45')]));}else{_0x277abe[_0x861f('0x43')]='';}headers['Authorization']=getAuth(_0x5de384);return getUser(_0x5de384,'')['then'](function(_0x5701cb){_0x5eacb6=_0x5701cb;logger[_0x861f('0x14')]('The\x20User\x20ID\x20is:',_0x5eacb6['id']);return getEndUser(_0x5de384,_0x277abe[_0x861f('0xb')],_0x277abe[_0x861f('0x48')]);})[_0x861f('0x19')](function(_0x2bc59e){_0x183eb8=_0x2bc59e;logger[_0x861f('0x14')](_0x861f('0x49'),_0x183eb8['id']);return getTicket(_0x5de384,_0x5eacb6,_0x183eb8,_0x2c06b8,_0x277abe);})[_0x861f('0x19')](function(_0xc317cb){if(_0xc317cb){logger[_0x861f('0x14')]('Ticket\x20created!');logger[_0x861f('0x14')]('The\x20Ticket\x20ID\x20is:',_0xc317cb['id']);}})['catch'](function(_0x3d8ca2){logger[_0x861f('0x4c')]('['+_0x277abe['lastevent'][_0x861f('0x57')]()+']',JSON['stringify'](_0x3d8ca2));});}; \ No newline at end of file +var _0x2929=['trigger:browser:url','catch','error','outbound','serverUrl','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','[OUTBOUND]','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','application/json','emit','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','push','Variable','name','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x17f7c1,_0x2fa7b9){var _0x13c24a=function(_0x4a7f44){while(--_0x4a7f44){_0x17f7c1['push'](_0x17f7c1['shift']());}};_0x13c24a(++_0x2fa7b9);}(_0x2929,0x129));var _0x9292=function(_0x21d2c6,_0x4fc7e7){_0x21d2c6=_0x21d2c6-0x0;var _0x39fc00=_0x2929[_0x21d2c6];return _0x39fc00;};'use strict';var _=require(_0x9292('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x9292('0x1'));var Redis=require(_0x9292('0x2'));var intUtil=require('./util');var config=require(_0x9292('0x3'));var logger=require(_0x9292('0x4'))(_0x9292('0x5'));config[_0x9292('0x6')]=_[_0x9292('0x7')](config[_0x9292('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9292('0x6')]));var headers={'Content-Type':_0x9292('0x8'),'Accept':'application/json'};function emit(_0xbec757,_0x2c8581,_0x430305){io['to'](_0xbec757)[_0x9292('0x9')](_0x2c8581,_0x430305);}function getTicket(_0x2860e7,_0x5ae9f8,_0x11b092,_0x3a3b79,_0x3121c6){logger['info'](_0x9292('0xa'));var _0x90d1ff=_['merge']({'responder_id':_0x5ae9f8['id'],'requester_id':_0x11b092['id'],'name':util['format'](_0x9292('0xb'),_0x3121c6[_0x9292('0xc')]),'phone':_0x3121c6[_0x9292('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9292('0xe')](_0x3a3b79[_0x9292('0xf')],_0x3121c6,'\x20'),'description':intUtil[_0x9292('0xe')](_0x3a3b79[_0x9292('0x10')],_0x3121c6,_0x9292('0x11')),'tags':getTags(_0x3a3b79[_0x9292('0x12')],'name')},getCustomFields(_0x3a3b79[_0x9292('0x13')],_0x3121c6));_0x90d1ff[_0x9292('0x14')]=_[_0x9292('0x15')](_[_0x9292('0x16')](_0x90d1ff[_0x9292('0x14')],'id'),_0x9292('0x17'));return request({'uri':util[_0x9292('0x18')](_0x9292('0x19'),_0x2860e7['remoteUri']),'method':_0x9292('0x1a'),'body':_0x90d1ff})[_0x9292('0x1b')](function(_0x46baf1){logger[_0x9292('0x1c')](_0x9292('0x1d'));return _0x46baf1;});}function getUser(_0x2520ac,_0x252c99){if(intUtil[_0x9292('0x1e')](_0x252c99)){return request({'uri':util['format'](_0x9292('0x1f'),_0x2520ac['remoteUri']),'qs':{'email':_0x252c99}})[_0x9292('0x1b')](function(_0x329523){if(_0x329523[_0x9292('0x20')]){logger[_0x9292('0x1c')](_0x9292('0x21'));return _[_0x9292('0x22')](_0x329523,function(_0x3359ff){return _0x3359ff[_0x9292('0x23')]['email']===_0x252c99;});}else{logger[_0x9292('0x1c')](_0x9292('0x24'));return request({'uri':util[_0x9292('0x18')](_0x9292('0x25'),_0x2520ac[_0x9292('0x26')])})[_0x9292('0x1b')](function(_0x71a216){logger['info'](_0x9292('0x27'));return _0x71a216;});}});}else{logger[_0x9292('0x1c')](_0x9292('0x28'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x2520ac['remoteUri'])})['then'](function(_0x75f59a){logger[_0x9292('0x1c')]('Admin\x20account\x20selected.');return _0x75f59a;});}}function getEndUser(_0x2c824c,_0xf22c26,_0x6387c8){logger[_0x9292('0x1c')]('Searching\x20enduser\x20with\x20phone',_0x6387c8);return request({'uri':util[_0x9292('0x18')](_0x9292('0x29'),_0x2c824c[_0x9292('0x26')]),'qs':{'phone':_0x6387c8}})[_0x9292('0x1b')](function(_0x11d3ea){if(_0x11d3ea[_0x9292('0x20')]){logger[_0x9292('0x1c')](_0x9292('0x2a'));return _[_0x9292('0x22')](_0x11d3ea,{'phone':_0x6387c8});}else{logger[_0x9292('0x1c')](_0x9292('0x2b'));return request({'uri':util[_0x9292('0x18')](_0x9292('0x29'),_0x2c824c[_0x9292('0x26')]),'method':_0x9292('0x1a'),'body':{'name':_0xf22c26,'phone':_0x6387c8}})[_0x9292('0x1b')](function(_0x56f534){logger[_0x9292('0x1c')](_0x9292('0x2c'));return _0x56f534;});}});}function getAuth(_0x130657){return util[_0x9292('0x18')](_0x9292('0x2d'),new Buffer(_0x130657[_0x9292('0x2e')]+':X')[_0x9292('0x2f')]('base64'));}function request(_0x149183){logger[_0x9292('0x30')](_0x9292('0x31'),JSON['stringify'](_0x149183));return rp(_['defaults'](_0x149183,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4f55b9,_0xcb9ce6){var _0x29e0a0=[];if(_0x4f55b9&&_0x4f55b9[_0x9292('0x20')]>0x0){_0x29e0a0=_['map'](_0x4f55b9,_0xcb9ce6);}return _0x29e0a0;}function getCustomFields(_0xe028b6,_0x9247c9){var _0x2e2045=[];var _0xc52f27={'custom_fields':[]};if(_0xe028b6[_0x9292('0x20')]>0x0){_[_0x9292('0x32')](_0xe028b6,function(_0x4d8ae9){if(_[_0x9292('0x33')]([_0x9292('0x34'),_0x9292('0x35')],_0x4d8ae9[_0x9292('0x36')])&&_0x4d8ae9[_0x9292('0x37')]&&!_0x4d8ae9[_0x9292('0x38')]){_0xc52f27[_0x4d8ae9[_0x9292('0x37')][_0x9292('0x39')]()]=_0x4d8ae9[_0x9292('0x3a')][_0x9292('0x2f')]();}else if(_[_0x9292('0x33')]([_0x9292('0x34'),'picklist'],_0x4d8ae9[_0x9292('0x36')])&&_0x4d8ae9[_0x9292('0x3b')]&&_0x4d8ae9['customField']){_0xc52f27[_0x9292('0x14')]['push']({'id':_0x4d8ae9[_0x9292('0x3b')],'value':_0x4d8ae9[_0x9292('0x3a')]['toString']()});}else if(_0x4d8ae9[_0x9292('0x36')]===_0x9292('0x3c')&&_0x4d8ae9[_0x9292('0x3d')]&&_0x4d8ae9[_0x9292('0x3b')]&&_0x4d8ae9[_0x9292('0x38')]){_0x9247c9[_0x4d8ae9[_0x9292('0x3d')]]&&_0xc52f27[_0x9292('0x14')][_0x9292('0x3e')]({'id':_0x4d8ae9[_0x9292('0x3b')],'value':_0x9247c9[_0x4d8ae9[_0x9292('0x3d')]][_0x9292('0x2f')]()});}else if(_0x4d8ae9[_0x9292('0x36')]==='customVariable'&&_0x4d8ae9[_0x9292('0x3f')]&&_0x4d8ae9['Variable'][_0x9292('0x40')]&&_0x4d8ae9[_0x9292('0x3b')]&&_0x4d8ae9['customField']){_0x9247c9[_0x4d8ae9['Variable'][_0x9292('0x40')]['toLowerCase']()]&&_0xc52f27[_0x9292('0x14')]['push']({'id':_0x4d8ae9[_0x9292('0x3b')],'value':_0x9247c9[_0x4d8ae9[_0x9292('0x3f')][_0x9292('0x40')][_0x9292('0x39')]()][_0x9292('0x2f')]()});}});}return _0xc52f27;}exports[_0x9292('0x41')]=function(_0x5b2db2,_0x4a8c56,_0x35ff95,_0x156482,_0x54a17c,_0x379084){var _0x3501e0,_0xe85fc0;_0x379084['remoteUri']=intUtil[_0x9292('0x42')](_0x379084['remoteUri']);_0x379084['serverUrl']=intUtil['stripTrailingSlash'](_0x379084['serverUrl']);if(_0x54a17c&&_0x54a17c[_0x9292('0x43')]){logger[_0x9292('0x1c')](_0x9292('0x44'),_0x9292('0x45'));_0x4a8c56[_0x9292('0x46')]=util[_0x9292('0x18')](_0x9292('0x47'),_0x379084['serverUrl'],_0x4a8c56[_0x9292('0x48')],md5(_0x4a8c56[_0x9292('0x48')]));}else{_0x4a8c56[_0x9292('0x46')]='';}headers['Authorization']=getAuth(_0x379084);return getUser(_0x379084,_0x156482[_0x9292('0x49')])[_0x9292('0x1b')](function(_0x5d5238){_0x3501e0=_0x5d5238;logger[_0x9292('0x1c')](_0x9292('0x4a'),_0x3501e0['id']);return getEndUser(_0x379084,_0x4a8c56['calleridname'],_0x4a8c56[_0x9292('0xd')]);})[_0x9292('0x1b')](function(_0x32b420){_0xe85fc0=_0x32b420;logger[_0x9292('0x1c')](_0x9292('0x4b'),_0xe85fc0['id']);return getTicket(_0x379084,_0x3501e0,_0xe85fc0,_0x35ff95,_0x4a8c56);})[_0x9292('0x1b')](function(_0x2326ae){if(_0x2326ae&&_0x2326ae['id']){logger[_0x9292('0x1c')]('Ticket\x20created!');logger[_0x9292('0x1c')](_0x9292('0x4c'),_0x2326ae['id']);logger['info']('[QUEUE]',_0x9292('0x4d'));emit(util[_0x9292('0x18')](_0x9292('0x4e'),_0x156482[_0x9292('0x40')]),_0x9292('0x4f'),{'uri':util[_0x9292('0x18')]('%s/helpdesk/tickets/%d',_0x379084[_0x9292('0x26')],_0x2326ae['id'])});}})[_0x9292('0x50')](function(_0x3b044c){logger[_0x9292('0x51')]('[QUEUE]',JSON['stringify'](_0x3b044c));});};exports[_0x9292('0x52')]=function(_0x352017,_0x59a1a6,_0x441154,_0x47a293,_0x4626a4,_0x21cded,_0x5cbda6){var _0x588ddd,_0x307473;_0x21cded[_0x9292('0x26')]=intUtil[_0x9292('0x42')](_0x21cded[_0x9292('0x26')]);_0x21cded[_0x9292('0x53')]=intUtil[_0x9292('0x42')](_0x21cded[_0x9292('0x53')]);if(_0x5cbda6&&_0x5cbda6[_0x9292('0x54')]&&_0x5cbda6['recordingFormat']!==_0x9292('0x55')){logger[_0x9292('0x1c')]('[OUTBOUND]',_0x9292('0x45'));_0x59a1a6['recordingURL']=util[_0x9292('0x18')](_0x9292('0x47'),_0x21cded['serverUrl'],_0x59a1a6[_0x9292('0x48')],md5(_0x59a1a6[_0x9292('0x48')]));}headers[_0x9292('0x56')]=getAuth(_0x21cded);return getUser(_0x21cded,_0x47a293['email'])['then'](function(_0x1deafe){_0x588ddd=_0x1deafe;logger['info'](_0x9292('0x4a'),_0x588ddd['id']);return getEndUser(_0x21cded,_0x59a1a6[_0x9292('0x57')],_0x59a1a6[_0x9292('0x58')]);})[_0x9292('0x1b')](function(_0x2dc689){_0x307473=_0x2dc689;logger[_0x9292('0x1c')](_0x9292('0x4b'),_0x307473['id']);return getTicket(_0x21cded,_0x588ddd,_0x307473,_0x441154,_0x59a1a6);})[_0x9292('0x1b')](function(_0x549e11){if(_0x549e11&&_0x549e11['id']){logger[_0x9292('0x1c')](_0x9292('0x1d'));logger[_0x9292('0x1c')](_0x9292('0x4c'),_0x549e11['id']);logger[_0x9292('0x1c')](_0x9292('0x59'),_0x9292('0x4d'));emit(util['format'](_0x9292('0x4e'),_0x47a293[_0x9292('0x40')]),_0x9292('0x4f'),{'uri':util[_0x9292('0x18')]('%s/helpdesk/tickets/%d',_0x21cded['remoteUri'],_0x549e11['id'])});}})[_0x9292('0x50')](function(_0x3bdf23){logger[_0x9292('0x51')](_0x9292('0x59'),JSON[_0x9292('0x5a')](_0x3bdf23));});};exports[_0x9292('0x5b')]=function(_0x21ba1c,_0x473069,_0x21961c,_0x4f0f1f,_0xb782ec,_0x1a35ee){var _0x2017eb,_0x59e16c;_0x1a35ee[_0x9292('0x26')]=intUtil['stripTrailingSlash'](_0x1a35ee[_0x9292('0x26')]);_0x1a35ee[_0x9292('0x53')]=intUtil[_0x9292('0x42')](_0x1a35ee[_0x9292('0x53')]);if(_0xb782ec&&_0xb782ec['monitor_format']){logger[_0x9292('0x1c')]('['+_0x473069[_0x9292('0x5c')][_0x9292('0x5d')]()+']','Recording\x20is\x20enabled!');_0x473069['recordingURL']=util[_0x9292('0x18')](_0x9292('0x47'),_0x1a35ee[_0x9292('0x53')],_0x473069['uniqueid'],md5(_0x473069[_0x9292('0x48')]));}else{_0x473069[_0x9292('0x46')]='';}headers['Authorization']=getAuth(_0x1a35ee);return getUser(_0x1a35ee,'')['then'](function(_0x393c2c){_0x2017eb=_0x393c2c;logger['info'](_0x9292('0x4a'),_0x2017eb['id']);return getEndUser(_0x1a35ee,_0x473069['calleridname'],_0x473069['calleridnum']);})[_0x9292('0x1b')](function(_0x4b16be){_0x59e16c=_0x4b16be;logger[_0x9292('0x1c')](_0x9292('0x4b'),_0x59e16c['id']);return getTicket(_0x1a35ee,_0x2017eb,_0x59e16c,_0x21961c,_0x473069);})[_0x9292('0x1b')](function(_0x21fdff){if(_0x21fdff){logger[_0x9292('0x1c')](_0x9292('0x1d'));logger[_0x9292('0x1c')](_0x9292('0x4c'),_0x21fdff['id']);}})[_0x9292('0x50')](function(_0x31fb37){logger['error']('['+_0x473069[_0x9292('0x5c')][_0x9292('0x5d')]()+']',JSON[_0x9292('0x5a')](_0x31fb37));});}; \ 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 29479e3..d8ae71c 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 _0x2f51=['Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','toLowerCase','outbound','destcalleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','defaults','redis','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','length','User\x20found:','Admin\x20selected','userEmail','adminEmail','userId','message','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','error','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions'];(function(_0x200b38,_0x45c552){var _0x2f0fec=function(_0x1b1fa9){while(--_0x1b1fa9){_0x200b38['push'](_0x200b38['shift']());}};_0x2f0fec(++_0x45c552);}(_0x2f51,0x16d));var _0x12f5=function(_0x221a6f,_0x1674c8){_0x221a6f=_0x221a6f-0x0;var _0x3db53d=_0x2f51[_0x221a6f];return _0x3db53d;};'use strict';var _=require(_0x12f5('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x12f5('0x1'));var moment=require(_0x12f5('0x2'));var Promise=require(_0x12f5('0x3'));var Redis=require(_0x12f5('0x4'));var intUtil=require(_0x12f5('0x5'));var config=require(_0x12f5('0x6'));var logger=require('../../../../config/logger')(_0x12f5('0x7'));config['redis']=_[_0x12f5('0x8')](config[_0x12f5('0x9')],{'host':_0x12f5('0xa'),'port':0x18eb});var io=require(_0x12f5('0xb'))(new Redis(config['redis']));function getAdminId(_0x12a366,_0x49341e,_0x1dbb2b,_0x3b5ff4){return new Promise(function(_0x26fb83,_0x56d511){var _0x47ea7b=![];var _0x159485={'method':_0x12f5('0xc'),'uri':_0x3b5ff4+'/api/selector/owners','json':!![]};_0x159485[_0x12f5('0xd')]=_0x1dbb2b;logger[_0x12f5('0xe')](_0x12f5('0xf'));return rp(_0x159485)[_0x12f5('0x10')](function(_0x265694){if(_0x265694){var _0x21c76b=_0x265694[_0x12f5('0x11')];var _0x3ef9e1=null;for(_0x3ef9e1=0x0;_0x3ef9e1<_0x21c76b['length'];_0x3ef9e1++){if(_0x21c76b[_0x3ef9e1][_0x12f5('0x12')]===_0x12a366['adminEmail']){_0x12a366[_0x12f5('0x13')]=_0x21c76b[_0x3ef9e1]['id'];_0x47ea7b=!![];}}if(_0x47ea7b){logger[_0x12f5('0xe')](_0x12f5('0x14'),_0x12a366[_0x12f5('0x13')]);_0x26fb83(_0x12a366);}else{_0x56d511({'statusCode':0x194,'message':_0x12f5('0x15')});}}else{_0x56d511({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x12f5('0x16')](function(_0x2543b4){logger['error']('['+[_0x49341e[_0x12f5('0x17')]()]+']',_0x2543b4['message']);_0x56d511(_0x2543b4);});});}function getUser(_0x2e26bb,_0x57fc24,_0x458ca4){return function(_0x199b80){return new Promise(function(_0x2ff7f0,_0x323c06){var _0x13d437={'method':'GET','uri':_0x458ca4+_0x12f5('0x18'),'json':!![]};_0x13d437['headers']=_0x57fc24;logger['info'](_0x12f5('0x19'));return rp(_0x13d437)[_0x12f5('0x10')](function(_0x3312de){if(_0x3312de){var _0x2cd6d4=_0x3312de[_0x12f5('0x11')];var _0x253aef=![];var _0x172cc4=null;if(_0x199b80[_0x12f5('0x1a')]!==null){logger[_0x12f5('0xe')](_0x12f5('0x1b'),_0x199b80[_0x12f5('0x1a')]);_0x199b80['userEmail']=_0x199b80['agentEmail'];for(_0x172cc4=0x0;_0x172cc4<_0x2cd6d4[_0x12f5('0x1c')];_0x172cc4++){if(_0x2cd6d4[_0x172cc4][_0x12f5('0x12')]===_0x199b80[_0x12f5('0x1a')]){_0x253aef=!![];_0x199b80['userId']=_0x2cd6d4[_0x172cc4]['id'];logger[_0x12f5('0xe')](_0x12f5('0x1d'),_0x199b80['userId']);}}}if(!_0x253aef){logger[_0x12f5('0xe')](_0x12f5('0x1e'));_0x199b80[_0x12f5('0x1f')]=_0x199b80[_0x12f5('0x20')];_0x199b80[_0x12f5('0x21')]=_0x199b80['adminId'];_0x253aef=!![];}if(_0x253aef){_0x2ff7f0(_0x199b80);}else{_0x323c06({'statusCode':0x194,'message':_0x12f5('0x15')});}}else{_0x323c06({'statusCode':0x194,'message':_0x12f5('0x15')});}})[_0x12f5('0x16')](function(_0xc1cb4b){logger['error']('['+[_0x2e26bb[_0x12f5('0x17')]()]+']',_0xc1cb4b[_0x12f5('0x22')]);_0x323c06(_0xc1cb4b);});});};}function searchContact(_0x81306e,_0x49d806,_0x3d088d,_0x1b6b89){return new Promise(function(_0xf2f266,_0x58fbb5){var _0x4f8f2a={'method':'GET','headers':_0x49d806,'uri':_0x81306e+_0x12f5('0x23')+_0x1b6b89+_0x12f5('0x24')+_0x3d088d+_0x12f5('0x25'),'json':!![]};rp(_0x4f8f2a)[_0x12f5('0x10')](function(_0x3ab23b){var _0x109dc2=_['find'](_0x3ab23b[_0x12f5('0x26')][_0x12f5('0x26')],[_0x3d088d,_0x1b6b89]);_0xf2f266(_0x109dc2);})['catch'](function(_0x214dc4){_0x58fbb5(_0x214dc4);});});}function getEndUser(_0x33c987,_0x4fb025,_0x1b754e){return function(_0x15b3da){return new Promise(function(_0x5bd042,_0x38b028){logger['info'](util[_0x12f5('0x27')](_0x12f5('0x28'),_0x15b3da[_0x12f5('0x29')]));searchContact(_0x1b754e,_0x4fb025,_0x12f5('0x2a'),_0x15b3da[_0x12f5('0x29')])[_0x12f5('0x10')](function(_0x1aa050){if(_0x1aa050){_0x15b3da[_0x12f5('0x2b')]=_0x1aa050['id'];logger[_0x12f5('0xe')](_0x12f5('0x2c'),_0x15b3da[_0x12f5('0x2b')]);return _0x5bd042(_0x15b3da);}searchContact(_0x1b754e,_0x4fb025,_0x12f5('0x2d'),_0x15b3da[_0x12f5('0x29')])[_0x12f5('0x10')](function(_0x204243){if(_0x204243){_0x15b3da['endUserId']=_0x204243['id'];logger[_0x12f5('0xe')]('Contact\x20found\x20work_number:',_0x15b3da[_0x12f5('0x2b')]);return _0x5bd042(_0x15b3da);}createEndUser(_0x15b3da,_0x33c987,_0x4fb025,_0x1b754e)[_0x12f5('0x10')](function(_0x32a203){logger[_0x12f5('0xe')](_0x12f5('0x2e'),_0x32a203[_0x12f5('0x2b')]);return _0x5bd042(_0x32a203);});});})[_0x12f5('0x16')](function(_0xec39d0){_0x38b028(_0xec39d0);});});};}function createEndUser(_0x19a056,_0x4654a0,_0x2ff300,_0x3abd9b){return new Promise(function(_0x25885e,_0x30f434){var _0x55f8dc=moment();var _0x4d8635={'method':'POST','uri':_0x3abd9b+'/api/contacts','body':{'contact':{'last_name':_0x19a056[_0x12f5('0x29')],'work_number':_0x19a056['contactNumber'],'mobile_number':_0x19a056[_0x12f5('0x29')],'owner_id':_0x19a056[_0x12f5('0x21')],'created_at':_0x55f8dc[_0x12f5('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x4d8635[_0x12f5('0xd')]=_0x2ff300;logger[_0x12f5('0xe')](_0x12f5('0x2f'));return rp(_0x4d8635)[_0x12f5('0x10')](function(_0x214e05){_0x19a056[_0x12f5('0x2b')]=_0x214e05[_0x12f5('0x30')]['id'];_0x25885e(_0x19a056);})[_0x12f5('0x16')](function(_0x304f51){logger[_0x12f5('0x31')]('['+[_0x4654a0[_0x12f5('0x17')]()]+']',_0x304f51[_0x12f5('0x22')]);_0x30f434(_0x304f51[_0x12f5('0x22')]);});});}function getTicket(_0x1aa1d5,_0x15fcb7,_0x440206,_0xe9d5af,_0x13a14e){return function(_0xa2dd09){logger[_0x12f5('0xe')](_0x12f5('0x32'));return new Promise(function(_0x496860,_0xc98387){var _0x2948b8=moment();var _0x229ba1={'method':_0x12f5('0x33'),'uri':_0x440206+_0x12f5('0x34'),'body':{'title':intUtil[_0x12f5('0x35')](_0xe9d5af['Subjects'],_0x13a14e,'\x20'),'description':intUtil[_0x12f5('0x35')](_0xe9d5af[_0x12f5('0x36')],_0x13a14e,'\x0a'),'owner_id':_0xa2dd09[_0x12f5('0x21')],'creater_id':_0xa2dd09[_0x12f5('0x13')],'targetable_id':_0xa2dd09[_0x12f5('0x2b')],'targetable_type':_0x12f5('0x37'),'created_at':_0x2948b8[_0x12f5('0x27')](_0x12f5('0x38')),'due_date':_0x2948b8[_0x12f5('0x39')](0x1e,'m')[_0x12f5('0x27')](_0x12f5('0x38'))},'json':!![]};_0x229ba1[_0x12f5('0xd')]=_0x15fcb7;return rp(_0x229ba1)[_0x12f5('0x10')](function(_0x2767f3){_0xa2dd09[_0x12f5('0x3a')]=_0x2767f3['task']['id'];logger[_0x12f5('0xe')]('Task\x20created:',_0xa2dd09[_0x12f5('0x3a')]);_0x496860(_0xa2dd09);})['catch'](function(_0x49489a){logger[_0x12f5('0x31')]('['+[_0x1aa1d5['toUpperCase']()]+']',_0x49489a[_0x12f5('0x22')]);_0xc98387(_0x49489a['message']);});});};}function emit(_0x108339,_0x130de3,_0x535ec1){var _0x4297cf={'uri':_0x108339+_0x12f5('0x3b')+_0x535ec1};io['to'](util['format'](_0x12f5('0x3c'),_0x130de3))['emit'](_0x12f5('0x3d'),_0x4297cf);}exports['cs']=function(_0x1704c0,_0x2f38cb,_0x43fc73,_0xddff57,_0xfb3fea,_0x1360c0,_0x1d2440,_0xd3adfb){var _0x2245d5={};var _0x51eecb={'Authorization':_0x12f5('0x3e')+_0x1360c0[_0x12f5('0x3f')]};_0x1360c0['remoteUri']=intUtil[_0x12f5('0x40')](_0x1360c0[_0x12f5('0x41')]);_0x1360c0[_0x12f5('0x42')]=intUtil[_0x12f5('0x40')](_0x1360c0['serverUrl']);var _0x5b4e3b=_0x1360c0[_0x12f5('0x41')];_0x2245d5[_0x12f5('0x20')]=_0x1360c0['username'];_0x2245d5[_0x12f5('0x29')]=_0xd3adfb[_0x12f5('0x43')]()===_0x12f5('0x44')?_0x2f38cb[_0x12f5('0x45')]:_0x2f38cb['calleridnum'];_0x2245d5['callDirection']=_0xd3adfb===_0x12f5('0x46')||_0xd3adfb===_0x12f5('0x47')?_0x12f5('0x46'):_0x12f5('0x44');if(_0xddff57){_0x2245d5[_0x12f5('0x1a')]=_0xddff57[_0x12f5('0x12')];}var _0x1b7537=util[_0x12f5('0x27')](_0x12f5('0x48'),_0x1360c0[_0x12f5('0x42')],_0x2f38cb[_0x12f5('0x49')],md5(_0x2f38cb[_0x12f5('0x49')]));if(_0xfb3fea&&_0xfb3fea['monitor_format']){logger[_0x12f5('0xe')](_0x12f5('0x4a'),_0x12f5('0x4b'));_0x2f38cb[_0x12f5('0x4c')]=_0x1b7537;}else if(_0x1d2440&&_0x1d2440[_0x12f5('0x4d')]&&_0x1d2440['recordingFormat']!==_0x12f5('0x4e')){logger[_0x12f5('0xe')](_0x12f5('0x4f'),_0x12f5('0x4b'));_0x2f38cb[_0x12f5('0x4c')]=_0x1b7537;}else{_0x2f38cb['recordingURL']='';}return getAdminId(_0x2245d5,_0xd3adfb,_0x51eecb,_0x5b4e3b)[_0x12f5('0x10')](getUser(_0xd3adfb,_0x51eecb,_0x5b4e3b))[_0x12f5('0x10')](getEndUser(_0xd3adfb,_0x51eecb,_0x5b4e3b))['then'](getTicket(_0xd3adfb,_0x51eecb,_0x5b4e3b,_0x43fc73,_0x2f38cb))[_0x12f5('0x10')](function(_0x8e780f){logger[_0x12f5('0xe')](util[_0x12f5('0x27')](_0x12f5('0x50'),_0x8e780f[_0x12f5('0x3a')]));if(_0xd3adfb!=='unmanaged'){logger['info']('['+[_0xd3adfb[_0x12f5('0x17')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5b4e3b,_0xddff57[_0x12f5('0x51')],_0x8e780f['endUserId']);}})[_0x12f5('0x16')](function(_0x4af822){logger[_0x12f5('0x31')]('['+[_0xd3adfb[_0x12f5('0x17')]()]+_0x12f5('0x52'),util[_0x12f5('0x53')](_0x4af822,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5191=['contact','Creating\x20new\x20task','getString','Subjects','Contact','format','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','adminEmail','error','toUpperCase','message','/api/lookup?q=','&f=','find','contacts','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','userId','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact'];(function(_0x21e93e,_0x1b1b75){var _0x68e4e0=function(_0xde87b6){while(--_0xde87b6){_0x21e93e['push'](_0x21e93e['shift']());}};_0x68e4e0(++_0x1b1b75);}(_0x5191,0x117));var _0x1519=function(_0x4b9298,_0x40ddcf){_0x4b9298=_0x4b9298-0x0;var _0x369af0=_0x5191[_0x4b9298];return _0x369af0;};'use strict';var _=require(_0x1519('0x0'));var rp=require('request-promise');var md5=require(_0x1519('0x1'));var util=require(_0x1519('0x2'));var moment=require(_0x1519('0x3'));var Promise=require(_0x1519('0x4'));var Redis=require(_0x1519('0x5'));var intUtil=require(_0x1519('0x6'));var config=require(_0x1519('0x7'));var logger=require(_0x1519('0x8'))(_0x1519('0x9'));config['redis']=_[_0x1519('0xa')](config[_0x1519('0xb')],{'host':_0x1519('0xc'),'port':0x18eb});var io=require(_0x1519('0xd'))(new Redis(config[_0x1519('0xb')]));function getAdminId(_0x12e0a3,_0x583dbf,_0x4dca22,_0x3e88eb){return new Promise(function(_0x34bf37,_0x18b1e1){var _0x122dc7=![];var _0xc4b6c0={'method':_0x1519('0xe'),'uri':_0x3e88eb+_0x1519('0xf'),'json':!![]};_0xc4b6c0[_0x1519('0x10')]=_0x4dca22;logger[_0x1519('0x11')](_0x1519('0x12'));return rp(_0xc4b6c0)[_0x1519('0x13')](function(_0x3c82a2){if(_0x3c82a2){var _0x49c546=_0x3c82a2[_0x1519('0x14')];var _0x1f283e=null;for(_0x1f283e=0x0;_0x1f283e<_0x49c546['length'];_0x1f283e++){if(_0x49c546[_0x1f283e][_0x1519('0x15')]===_0x12e0a3['adminEmail']){_0x12e0a3[_0x1519('0x16')]=_0x49c546[_0x1f283e]['id'];_0x122dc7=!![];}}if(_0x122dc7){logger[_0x1519('0x11')](_0x1519('0x17'),_0x12e0a3['adminId']);_0x34bf37(_0x12e0a3);}else{_0x18b1e1({'statusCode':0x194,'message':_0x1519('0x18')});}}else{_0x18b1e1({'statusCode':0x194,'message':_0x1519('0x18')});}})[_0x1519('0x19')](function(_0x506248){logger['error']('['+[_0x583dbf['toUpperCase']()]+']',_0x506248['message']);_0x18b1e1(_0x506248);});});}function getUser(_0x524a20,_0xed37b7,_0x2a6e69){return function(_0x26efd2){return new Promise(function(_0x563d3d,_0x1b80dd){var _0x28e652={'method':_0x1519('0xe'),'uri':_0x2a6e69+_0x1519('0xf'),'json':!![]};_0x28e652[_0x1519('0x10')]=_0xed37b7;logger[_0x1519('0x11')](_0x1519('0x1a'));return rp(_0x28e652)[_0x1519('0x13')](function(_0x5bb4b0){if(_0x5bb4b0){var _0x45df52=_0x5bb4b0[_0x1519('0x14')];var _0x522937=![];var _0x27be1b=null;if(_0x26efd2[_0x1519('0x1b')]!==null){logger[_0x1519('0x11')](_0x1519('0x1c'),_0x26efd2[_0x1519('0x1b')]);_0x26efd2[_0x1519('0x1d')]=_0x26efd2[_0x1519('0x1b')];for(_0x27be1b=0x0;_0x27be1b<_0x45df52['length'];_0x27be1b++){if(_0x45df52[_0x27be1b][_0x1519('0x15')]===_0x26efd2[_0x1519('0x1b')]){_0x522937=!![];_0x26efd2['userId']=_0x45df52[_0x27be1b]['id'];logger['info'](_0x1519('0x1e'),_0x26efd2['userId']);}}}if(!_0x522937){logger[_0x1519('0x11')]('Admin\x20selected');_0x26efd2['userEmail']=_0x26efd2[_0x1519('0x1f')];_0x26efd2['userId']=_0x26efd2[_0x1519('0x16')];_0x522937=!![];}if(_0x522937){_0x563d3d(_0x26efd2);}else{_0x1b80dd({'statusCode':0x194,'message':_0x1519('0x18')});}}else{_0x1b80dd({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x1519('0x19')](function(_0xdd9266){logger[_0x1519('0x20')]('['+[_0x524a20[_0x1519('0x21')]()]+']',_0xdd9266[_0x1519('0x22')]);_0x1b80dd(_0xdd9266);});});};}function searchContact(_0x493cac,_0x585254,_0x5c6b91,_0xe8628b){return new Promise(function(_0x2c4b6a,_0x52c54b){var _0x53b699={'method':_0x1519('0xe'),'headers':_0x585254,'uri':_0x493cac+_0x1519('0x23')+_0xe8628b+_0x1519('0x24')+_0x5c6b91+'&entities=contact','json':!![]};rp(_0x53b699)[_0x1519('0x13')](function(_0x155c71){var _0x1ae951=_[_0x1519('0x25')](_0x155c71[_0x1519('0x26')][_0x1519('0x26')],[_0x5c6b91,_0xe8628b]);_0x2c4b6a(_0x1ae951);})[_0x1519('0x19')](function(_0x449fe7){_0x52c54b(_0x449fe7);});});}function getEndUser(_0x1a4be9,_0x1534e5,_0x21c852){return function(_0x11d497){return new Promise(function(_0x30db8f,_0x5bbe6e){logger[_0x1519('0x11')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x11d497[_0x1519('0x27')]));searchContact(_0x21c852,_0x1534e5,_0x1519('0x28'),_0x11d497[_0x1519('0x27')])['then'](function(_0x4140af){if(_0x4140af){_0x11d497[_0x1519('0x29')]=_0x4140af['id'];logger[_0x1519('0x11')](_0x1519('0x2a'),_0x11d497[_0x1519('0x29')]);return _0x30db8f(_0x11d497);}searchContact(_0x21c852,_0x1534e5,_0x1519('0x2b'),_0x11d497[_0x1519('0x27')])[_0x1519('0x13')](function(_0x240078){if(_0x240078){_0x11d497[_0x1519('0x29')]=_0x240078['id'];logger[_0x1519('0x11')](_0x1519('0x2c'),_0x11d497[_0x1519('0x29')]);return _0x30db8f(_0x11d497);}createEndUser(_0x11d497,_0x1a4be9,_0x1534e5,_0x21c852)[_0x1519('0x13')](function(_0x54c6cb){logger[_0x1519('0x11')]('Contact\x20created:',_0x54c6cb[_0x1519('0x29')]);return _0x30db8f(_0x54c6cb);});});})[_0x1519('0x19')](function(_0x1bd5fa){_0x5bbe6e(_0x1bd5fa);});});};}function createEndUser(_0x431bc3,_0x5bd8f3,_0x1f2aa4,_0x3d355f){return new Promise(function(_0x1f6d2b,_0x2dbc4f){var _0x37eebd=moment();var _0xb1baa1={'method':_0x1519('0x2d'),'uri':_0x3d355f+_0x1519('0x2e'),'body':{'contact':{'last_name':_0x431bc3[_0x1519('0x27')],'work_number':_0x431bc3[_0x1519('0x27')],'mobile_number':_0x431bc3['contactNumber'],'owner_id':_0x431bc3[_0x1519('0x2f')],'created_at':_0x37eebd['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0xb1baa1[_0x1519('0x10')]=_0x1f2aa4;logger[_0x1519('0x11')](_0x1519('0x30'));return rp(_0xb1baa1)['then'](function(_0x5ee6fd){_0x431bc3[_0x1519('0x29')]=_0x5ee6fd[_0x1519('0x31')]['id'];_0x1f6d2b(_0x431bc3);})['catch'](function(_0x32b530){logger[_0x1519('0x20')]('['+[_0x5bd8f3[_0x1519('0x21')]()]+']',_0x32b530['message']);_0x2dbc4f(_0x32b530[_0x1519('0x22')]);});});}function getTicket(_0x169195,_0x2c22cb,_0x38bc4c,_0x317eae,_0x4ce1f5){return function(_0x1f04dc){logger[_0x1519('0x11')](_0x1519('0x32'));return new Promise(function(_0x3e9dd3,_0xf8ae8b){var _0x14f6c5=moment();var _0x3c700f={'method':'POST','uri':_0x38bc4c+'/api/tasks','body':{'title':intUtil[_0x1519('0x33')](_0x317eae[_0x1519('0x34')],_0x4ce1f5,'\x20'),'description':intUtil['getString'](_0x317eae['Descriptions'],_0x4ce1f5,'\x0a'),'owner_id':_0x1f04dc[_0x1519('0x2f')],'creater_id':_0x1f04dc[_0x1519('0x16')],'targetable_id':_0x1f04dc[_0x1519('0x29')],'targetable_type':_0x1519('0x35'),'created_at':_0x14f6c5[_0x1519('0x36')](_0x1519('0x37')),'due_date':_0x14f6c5[_0x1519('0x38')](0x1e,'m')[_0x1519('0x36')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3c700f[_0x1519('0x10')]=_0x2c22cb;return rp(_0x3c700f)[_0x1519('0x13')](function(_0x49718c){_0x1f04dc[_0x1519('0x39')]=_0x49718c[_0x1519('0x3a')]['id'];logger['info'](_0x1519('0x3b'),_0x1f04dc['ticketId']);_0x3e9dd3(_0x1f04dc);})['catch'](function(_0x43af2e){logger[_0x1519('0x20')]('['+[_0x169195[_0x1519('0x21')]()]+']',_0x43af2e['message']);_0xf8ae8b(_0x43af2e[_0x1519('0x22')]);});});};}function emit(_0x5ea96e,_0x547761,_0x20d38a){var _0x2e5127={'uri':_0x5ea96e+_0x1519('0x3c')+_0x20d38a};io['to'](util[_0x1519('0x36')](_0x1519('0x3d'),_0x547761))['emit']('trigger:browser:url',_0x2e5127);}exports['cs']=function(_0x59cba3,_0x2a3013,_0x3f2405,_0x461648,_0x34759a,_0x38ce02,_0x514d08,_0x2102d3){var _0x15d207={};var _0x31206e={'Authorization':_0x1519('0x3e')+_0x38ce02[_0x1519('0x3f')]};_0x38ce02[_0x1519('0x40')]=intUtil[_0x1519('0x41')](_0x38ce02[_0x1519('0x40')]);_0x38ce02[_0x1519('0x42')]=intUtil[_0x1519('0x41')](_0x38ce02[_0x1519('0x42')]);var _0x2334a6=_0x38ce02[_0x1519('0x40')];_0x15d207[_0x1519('0x1f')]=_0x38ce02[_0x1519('0x43')];_0x15d207[_0x1519('0x27')]=_0x2102d3[_0x1519('0x44')]()===_0x1519('0x45')?_0x2a3013['destcalleridnum']:_0x2a3013[_0x1519('0x46')];_0x15d207[_0x1519('0x47')]=_0x2102d3===_0x1519('0x48')||_0x2102d3===_0x1519('0x49')?_0x1519('0x48'):_0x1519('0x45');if(_0x461648){_0x15d207[_0x1519('0x1b')]=_0x461648[_0x1519('0x15')];}var _0x23a298=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38ce02['serverUrl'],_0x2a3013['uniqueid'],md5(_0x2a3013[_0x1519('0x4a')]));if(_0x34759a&&_0x34759a['monitor_format']){logger['info'](_0x1519('0x4b'),'Recording\x20is\x20enabled!');_0x2a3013[_0x1519('0x4c')]=_0x23a298;}else if(_0x514d08&&_0x514d08[_0x1519('0x4d')]&&_0x514d08[_0x1519('0x4d')]!==_0x1519('0x4e')){logger[_0x1519('0x11')](_0x1519('0x4f'),'Recording\x20is\x20enabled!');_0x2a3013['recordingURL']=_0x23a298;}else{_0x2a3013[_0x1519('0x4c')]='';}return getAdminId(_0x15d207,_0x2102d3,_0x31206e,_0x2334a6)[_0x1519('0x13')](getUser(_0x2102d3,_0x31206e,_0x2334a6))['then'](getEndUser(_0x2102d3,_0x31206e,_0x2334a6))['then'](getTicket(_0x2102d3,_0x31206e,_0x2334a6,_0x3f2405,_0x2a3013))[_0x1519('0x13')](function(_0x332fd2){logger[_0x1519('0x11')](util[_0x1519('0x36')]('The\x20ticket\x20ID\x20is:\x20%s',_0x332fd2[_0x1519('0x39')]));if(_0x2102d3!==_0x1519('0x49')){logger[_0x1519('0x11')]('['+[_0x2102d3[_0x1519('0x21')]()]+']',_0x1519('0x50'));emit(_0x2334a6,_0x461648['name'],_0x332fd2[_0x1519('0x29')]);}})['catch'](function(_0xd9d581){logger[_0x1519('0x20')]('['+[_0x2102d3[_0x1519('0x21')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x1519('0x51')](_0xd9d581,{'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 5250e1c..1d66099 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 _0x077b=['toLowerCase','data2','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','data1','zoho','vtiger','log','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','zendesk','salesforce','sugarcrm','freshdesk','dynamics365','freshsales','servicenow','exec','includes'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x077b,0xbc));var _0xb077=function(_0x55bc0b,_0x95ab1b){_0x55bc0b=_0x55bc0b-0x0;var _0x10ffd6=_0x077b[_0x55bc0b];return _0x10ffd6;};'use strict';var _=require(_0xb077('0x0'));var util=require('util');var zendesk=require(_0xb077('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xb077('0x2'));var freshdesk=require(_0xb077('0x3'));var zoho=require(_0xb077('0x4'));var desk=require(_0xb077('0x5'));var vtiger=require(_0xb077('0x6'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0xb077('0x7'),_0xb077('0x8'),_0xb077('0x9'),_0xb077('0xa'),'zoho','desk','vtiger',_0xb077('0xb'),_0xb077('0xc'),_0xb077('0xd')];exports[_0xb077('0xe')]=function(_0x4b15b3,_0x46e1fe,_0x1b9f2c,_0x5a6067,_0x375ff8,_0x21117b){if(_0x1b9f2c){if(_[_0xb077('0xf')](integrations,_0x4b15b3['data1'][_0xb077('0x10')]())){try{var _0x26637c=null;var _0x1a2681='';var _0xa12382=_0x1b9f2c[_0x4b15b3['data1'][_0xb077('0x10')]()];if(_0xa12382){var _0x16cf21=_0xa12382[_0x4b15b3[_0xb077('0x11')]];if(_0x16cf21){var _0x491a18=_['find'](_0x16cf21[_0xb077('0x12')],{'id':parseInt(_0x4b15b3[_0xb077('0x13')],0xa)});if(_0x491a18){if(_0x5a6067){if(_0x375ff8&&_0x46e1fe[_0xb077('0x14')]){_0x1a2681='queue';}else if(_0x46e1fe[_0xb077('0x15')]){_0x1a2681=_0xb077('0x16');}else{console['log'](_0xb077('0x17'),_0x46e1fe);}}else{_0x1a2681='unmanaged';}switch(_0x4b15b3[_0xb077('0x18')]['toLowerCase']()){case _0xb077('0x7'):zendesk[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case _0xb077('0x8'):salesforce[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case _0xb077('0x9'):sugarcrm[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case'freshdesk':freshdesk[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case _0xb077('0x19'):zoho[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case'desk':desk[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case _0xb077('0x1a'):vtiger[_0x1a2681](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b);break;case'freshsales':freshsales['cs'](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b,_0x1a2681);break;case _0xb077('0xd'):servicenow['cs'](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b,_0x1a2681);break;case _0xb077('0xb'):dynamics365['cs'](_0x4b15b3,_0x46e1fe,_0x491a18,_0x5a6067,_0x375ff8,_0x16cf21,_0x21117b,_0x1a2681);break;default:console[_0xb077('0x1b')]('unknown\x20integration');}}else{_0x26637c=require(_0xb077('0x1c'))(_0x4b15b3[_0xb077('0x18')][_0xb077('0x10')]());_0x26637c['error'](_0xb077('0x1d'),util[_0xb077('0x1e')](_0xb077('0x1f'),_0x4b15b3[_0xb077('0x18')]['toLowerCase'](),_0x4b15b3[_0xb077('0x13')]));}}else{_0x26637c=require(_0xb077('0x1c'))(_0x4b15b3['data1']['toLowerCase']());_0x26637c[_0xb077('0x20')](_0xb077('0x1d'),util[_0xb077('0x1e')](_0xb077('0x21'),_0x4b15b3[_0xb077('0x18')][_0xb077('0x10')](),_0x4b15b3[_0xb077('0x11')]));}}else{}}catch(_0x39e163){console[_0xb077('0x20')](_0x39e163);}}}}; \ No newline at end of file +var _0x5010=['%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','unknown\x20integration','data1','error','[EXEC]','format'];(function(_0x5e235c,_0x4e02dd){var _0x5d3c59=function(_0x66f3e6){while(--_0x66f3e6){_0x5e235c['push'](_0x5e235c['shift']());}};_0x5d3c59(++_0x4e02dd);}(_0x5010,0x78));var _0x0501=function(_0x4b8118,_0xf1377d){_0x4b8118=_0x4b8118-0x0;var _0x532a26=_0x5010[_0x4b8118];return _0x532a26;};'use strict';var _=require(_0x0501('0x0'));var util=require(_0x0501('0x1'));var zendesk=require(_0x0501('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x0501('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x0501('0x4'));var desk=require(_0x0501('0x5'));var vtiger=require(_0x0501('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0x0501('0x7'));var freshsales=require(_0x0501('0x8'));var integrations=[_0x0501('0x9'),_0x0501('0xa'),'sugarcrm',_0x0501('0xb'),_0x0501('0xc'),_0x0501('0xd'),_0x0501('0xe'),_0x0501('0xf'),_0x0501('0x10'),_0x0501('0x11')];exports[_0x0501('0x12')]=function(_0xe0cd7e,_0x3f64a1,_0x272160,_0x35a675,_0x52b49e,_0x5176af){if(_0x272160){if(_[_0x0501('0x13')](integrations,_0xe0cd7e['data1']['toLowerCase']())){try{var _0x383a11=null;var _0x59d0f5='';var _0x20e90c=_0x272160[_0xe0cd7e['data1'][_0x0501('0x14')]()];if(_0x20e90c){var _0xb9f083=_0x20e90c[_0xe0cd7e[_0x0501('0x15')]];if(_0xb9f083){var _0x3e8dc1=_[_0x0501('0x16')](_0xb9f083[_0x0501('0x17')],{'id':parseInt(_0xe0cd7e[_0x0501('0x18')],0xa)});if(_0x3e8dc1){if(_0x35a675){if(_0x52b49e&&_0x3f64a1[_0x0501('0x19')]){_0x59d0f5=_0x0501('0x19');}else if(_0x3f64a1[_0x0501('0x1a')]){_0x59d0f5='outbound';}else{console[_0x0501('0x1b')](_0x0501('0x1c'),_0x3f64a1);}}else{_0x59d0f5=_0x0501('0x1d');}switch(_0xe0cd7e['data1'][_0x0501('0x14')]()){case _0x0501('0x9'):zendesk[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0xa'):salesforce[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0x1e'):sugarcrm[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0xb'):freshdesk[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0xc'):zoho[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0xd'):desk[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0xe'):vtiger[_0x59d0f5](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af);break;case _0x0501('0x10'):freshsales['cs'](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af,_0x59d0f5);break;case _0x0501('0x11'):servicenow['cs'](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af,_0x59d0f5);break;case _0x0501('0xf'):dynamics365['cs'](_0xe0cd7e,_0x3f64a1,_0x3e8dc1,_0x35a675,_0x52b49e,_0xb9f083,_0x5176af,_0x59d0f5);break;default:console[_0x0501('0x1b')](_0x0501('0x1f'));}}else{_0x383a11=require('../../../../config/logger')(_0xe0cd7e[_0x0501('0x20')][_0x0501('0x14')]());_0x383a11[_0x0501('0x21')](_0x0501('0x22'),util[_0x0501('0x23')](_0x0501('0x24'),_0xe0cd7e[_0x0501('0x20')][_0x0501('0x14')](),_0xe0cd7e['data3']));}}else{_0x383a11=require(_0x0501('0x25'))(_0xe0cd7e['data1'][_0x0501('0x14')]());_0x383a11[_0x0501('0x21')](_0x0501('0x22'),util['format'](_0x0501('0x26'),_0xe0cd7e['data1'][_0x0501('0x14')](),_0xe0cd7e[_0x0501('0x15')]));}}else{}}catch(_0x115fd6){console[_0x0501('0x21')](_0x115fd6);}}}}; \ 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 7902b96..cecdf24 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 _0x15fc=['info','sobject','create','validateEmail','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','identity','then','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Account','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','LastName','','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','user:%s','trigger:browser:url','instanceUrl','error','catch','recordingFormat','none','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil','calleridname',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','Case','ContactId','leadId'];(function(_0x36c0c1,_0x370be5){var _0x4b1734=function(_0xdf3d55){while(--_0xdf3d55){_0x36c0c1['push'](_0x36c0c1['shift']());}};_0x4b1734(++_0x370be5);}(_0x15fc,0x1e8));var _0xc15f=function(_0x430f53,_0x47ec74){_0x430f53=_0x430f53-0x0;var _0x179ebd=_0x15fc[_0x430f53];return _0x179ebd;};'use strict';var _=require(_0xc15f('0x0'));var rp=require(_0xc15f('0x1'));var moment=require(_0xc15f('0x2'));var BPromise=require(_0xc15f('0x3'));var md5=require(_0xc15f('0x4'));var jsforce=require(_0xc15f('0x5'));var util=require(_0xc15f('0x6'));var Redis=require('ioredis');var intUtil=require(_0xc15f('0x7'));var config=require(_0xc15f('0x8'));var logger=require('../../../../config/logger')(_0xc15f('0x9'));config[_0xc15f('0xa')]=_[_0xc15f('0xb')](config[_0xc15f('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xc15f('0xc'))(new Redis(config['redis']));function emit(_0x10e2f5,_0x15139c,_0x532fcb){io['to'](_0x10e2f5)[_0xc15f('0xd')](_0x15139c,_0x532fcb);}function getTicket(_0x258988,_0x18609c,_0xb821c1,_0x2a3a1b,_0x483298,_0x53b283,_0x50f384,_0x5235be){var _0x39bcc6=Object[_0xc15f('0xe')]({},{'OwnerId':_0x18609c['id'],'Subject':intUtil[_0xc15f('0xf')](_0x2a3a1b[_0xc15f('0x10')],_0x483298,'\x20'),'Description':intUtil[_0xc15f('0xf')](_0x2a3a1b[_0xc15f('0x11')],_0x483298,'\x0a')},getCustomFields(_0x53b283,_0x483298));if(_0xb821c1){if(_0x2a3a1b[_0xc15f('0x12')]===_0xc15f('0x13')){_0x39bcc6[_0xc15f('0x14')]=moment[_0xc15f('0x15')]();_0x39bcc6['IsReminderSet']=![];_0x39bcc6[_0xc15f('0x16')]=![];if(_0xb821c1['endUserType']===_0xc15f('0x17')||_0xb821c1[_0xc15f('0x18')]===_0xc15f('0x19')){_0x39bcc6[_0xc15f('0x1a')]=_0xb821c1['id'];}else if(_0xb821c1[_0xc15f('0x18')]===_0xc15f('0x1b')){_0x39bcc6[_0xc15f('0x1c')]=_0xb821c1['id'];}}else if(_0x2a3a1b['ticketType']===_0xc15f('0x1d')){if(_0xb821c1[_0xc15f('0x18')]===_0xc15f('0x17')){_0x39bcc6[_0xc15f('0x1e')]=_0xb821c1['id'];}else if(_0xb821c1['endUserType']===_0xc15f('0x1b')){_0x39bcc6['AccountId']=_0xb821c1['id'];}else if(_0xb821c1[_0xc15f('0x18')]==='lead'&&_0x2a3a1b[_0xc15f('0x1f')]){_0x39bcc6[_0x2a3a1b[_0xc15f('0x1f')]]=_0xb821c1['id'];}else{logger[_0xc15f('0x20')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x50f384[_0xc15f('0x21')](_0x2a3a1b[_0xc15f('0x12')])[_0xc15f('0x22')](_0x39bcc6);}function getUser(_0x3d0633,_0x382691,_0x160bed){if(!_['isNil'](_0x382691)&&intUtil[_0xc15f('0x23')](_0x382691)){var _0x421018={'Email':_0x382691};var _0x1046eb={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x160bed['sobject']('User')[_0xc15f('0x24')](_0x421018,_0x1046eb)[_0xc15f('0x25')]()['then'](function(_0xaaad90){if(_0xaaad90[_0xc15f('0x26')]){var _0x3cd8c3=_['find'](_0xaaad90,function(_0x16f118){return _0x16f118[_0xc15f('0x27')]===_0x382691;});if(_0x3cd8c3){logger['info'](_0xc15f('0x28'),_0x382691);return BPromise[_0xc15f('0x29')]({'id':_0x3cd8c3['Id'],'name':_0x3cd8c3[_0xc15f('0x2a')]});}}else{logger[_0xc15f('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x382691);return _0x160bed[_0xc15f('0x2b')]()[_0xc15f('0x2c')](function(_0x1aba0c){return BPromise[_0xc15f('0x29')]({'id':_0x1aba0c[_0xc15f('0x2d')],'name':_0x1aba0c['display_name']});});}});}else{logger[_0xc15f('0x20')](_0xc15f('0x2e'),_0x382691);return _0x160bed['identity']()[_0xc15f('0x2c')](function(_0x445b7e){return BPromise[_0xc15f('0x29')]({'id':_0x445b7e['user_id'],'name':_0x445b7e['display_name']});});}}function getEndUser(_0x4bb168,_0x3e3523,_0x29f9da,_0x405470,_0x4e681e){var _0x57b6c9={'$or':{'Phone':_0x405470}};var _0x37500b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc15f('0x29')]()[_0xc15f('0x2c')](function(){logger[_0xc15f('0x20')](_0xc15f('0x2f'),_0x405470,_0x3e3523[_0xc15f('0x30')]);switch(_0x3e3523['moduleSearch']){case _0xc15f('0x31'):var _0x4b3fb1=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523['additionalSearchContact']){var _0x433529={};_0x433529[_0x3e3523[_0xc15f('0x33')]]=_0x405470;_[_0xc15f('0x34')](_0x4b3fb1['$or'],_0x433529);}return _0x4e681e['sobject'](_0xc15f('0x35'))[_0xc15f('0x24')](_0x4b3fb1,_0x37500b)[_0xc15f('0x25')]()[_0xc15f('0x2c')](function(_0x330da3){if(_0x330da3&&_0x330da3[_0xc15f('0x26')]){return _0x330da3;}else{var _0x4cff3c=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523['additionalSearchLead']){var _0x2ec377={};_0x2ec377[_0x3e3523[_0xc15f('0x36')]]=_0x405470;_['merge'](_0x4cff3c['$or'],_0x2ec377);}return _0x4e681e[_0xc15f('0x21')](_0xc15f('0x37'))['find'](_0x4cff3c,_0x37500b);}});case _0xc15f('0x38'):var _0x2430c1=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523[_0xc15f('0x39')]){var _0x433529={};_0x433529[_0x3e3523[_0xc15f('0x39')]]=_0x405470;_[_0xc15f('0x34')](_0x2430c1[_0xc15f('0x3a')],_0x433529);}return _0x4e681e[_0xc15f('0x21')](_0xc15f('0x3b'))[_0xc15f('0x24')](_0x2430c1,_0x37500b)['execute']()[_0xc15f('0x2c')](function(_0x51df3f){if(_0x51df3f&&_0x51df3f[_0xc15f('0x26')]){return _0x51df3f;}else{var _0x2acff4=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523[_0xc15f('0x33')]){var _0x140a1c={};_0x140a1c[_0x3e3523['additionalSearchContact']]=_0x405470;_['merge'](_0x2acff4[_0xc15f('0x3a')],_0x140a1c);}return _0x4e681e['sobject'](_0xc15f('0x35'))['find'](_0x2acff4,_0x37500b)['then'](function(_0x5b20ed){if(_0x5b20ed&&_0x5b20ed['length']){return _0x5b20ed;}else{var _0x3fbe57=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523[_0xc15f('0x36')]){var _0x31e2b7={};_0x31e2b7[_0x3e3523['additionalSearchLead']]=_0x405470;_[_0xc15f('0x34')](_0x3fbe57[_0xc15f('0x3a')],_0x31e2b7);}return _0x4e681e['sobject'](_0xc15f('0x37'))[_0xc15f('0x24')](_0x3fbe57,_0x37500b);}});}});case'contact':var _0x4b3fb1=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523[_0xc15f('0x33')]){var _0x433529={};_0x433529[_0x3e3523[_0xc15f('0x33')]]=_0x405470;_['merge'](_0x4b3fb1['$or'],_0x433529);}return _0x4e681e[_0xc15f('0x21')](_0xc15f('0x35'))[_0xc15f('0x24')](_0x4b3fb1,_0x37500b)[_0xc15f('0x25')]();case _0xc15f('0x19'):var _0x4a873e=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523['additionalSearchLead']){var _0x433529={};_0x433529[_0x3e3523[_0xc15f('0x36')]]=_0x405470;_[_0xc15f('0x34')](_0x4a873e[_0xc15f('0x3a')],_0x433529);}return _0x4e681e['sobject']('Lead')[_0xc15f('0x24')](_0x4a873e,_0x37500b);case _0xc15f('0x1b'):var _0x2430c1=_[_0xc15f('0x32')](_0x57b6c9);if(_0x3e3523[_0xc15f('0x39')]){var _0x433529={};_0x433529[_0x3e3523[_0xc15f('0x39')]]=_0x405470;_[_0xc15f('0x34')](_0x2430c1['$or'],_0x433529);}return _0x4e681e[_0xc15f('0x21')](_0xc15f('0x3b'))[_0xc15f('0x24')](_0x2430c1,_0x37500b);default:return null;}})[_0xc15f('0x2c')](function(_0x298d69){if(_0x298d69&&_0x298d69[_0xc15f('0x26')]){var _0xa159b7=_[_0xc15f('0x3c')](_0x298d69);if(_0xa159b7){return BPromise[_0xc15f('0x29')]({'id':_0xa159b7['Id'],'name':_0xa159b7[_0xc15f('0x2a')],'phone':_0xa159b7[_0xc15f('0x3d')],'endUserType':_0xa159b7['attributes'][_0xc15f('0x3e')][_0xc15f('0x3f')]()});}}})[_0xc15f('0x2c')](function(_0x13e598){if(_0x13e598){logger[_0xc15f('0x20')](_0xc15f('0x40'),_0x13e598[_0xc15f('0x18')],_0x405470);return BPromise[_0xc15f('0x29')](_0x13e598);}else{logger[_0xc15f('0x20')](_0xc15f('0x41'),_0x405470);var _0x388d17={'Phone':_0x405470};if(_0x3e3523['moduleCreate']){if(_0x3e3523[_0xc15f('0x42')]===_0xc15f('0x17')){logger[_0xc15f('0x20')](_0xc15f('0x43'),_0x405470,_0x3e3523[_0xc15f('0x42')]);_0x388d17['LastName']=_0x29f9da!==''?_0x29f9da:util[_0xc15f('0x44')]('Caller\x20-\x20%s',_0x405470);}else if(_0x3e3523[_0xc15f('0x42')]===_0xc15f('0x19')){logger[_0xc15f('0x20')](_0xc15f('0x43'),_0x405470,_0x3e3523[_0xc15f('0x42')]);_0x388d17[_0xc15f('0x45')]=_0x29f9da!==_0xc15f('0x46')?_0x29f9da:util[_0xc15f('0x44')](_0xc15f('0x47'),_0x405470);_0x388d17[_0xc15f('0x48')]=_0xc15f('0x49');}else if(_0x3e3523['moduleCreate']===_0xc15f('0x1b')){logger['info'](_0xc15f('0x43'),_0x405470,_0x3e3523['moduleCreate']);_0x388d17[_0xc15f('0x2a')]=_0x29f9da!==_0xc15f('0x46')?_0x29f9da:util[_0xc15f('0x44')](_0xc15f('0x47'),_0x405470);}else{return null;}}return _0x4e681e['sobject'](_[_0xc15f('0x4a')](_0x3e3523[_0xc15f('0x42')]))[_0xc15f('0x22')](_0x388d17)['then'](function(_0x7bf8ff){return BPromise['resolve']({'id':_0x7bf8ff['id'],'endUserType':_0x3e3523['moduleCreate']});});}});}function getCustomFields(_0x572f39,_0x46d46d){var _0x2baab0={};if(_0x572f39[_0xc15f('0x26')]>0x0){_[_0xc15f('0x4b')](_0x572f39,function(_0x4048c0){if(_[_0xc15f('0x4c')]([_0xc15f('0x4d'),_0xc15f('0x4e')],_0x4048c0[_0xc15f('0x3e')])&&_0x4048c0[_0xc15f('0x4f')]){_0x2baab0[_0x4048c0[_0xc15f('0x4f')]]=_0x4048c0[_0xc15f('0x50')][_0xc15f('0x51')]();}else if(_0x4048c0['type']===_0xc15f('0x52')&&_0x4048c0[_0xc15f('0x53')]&&_0x4048c0[_0xc15f('0x4f')]){_0x46d46d[_0x4048c0[_0xc15f('0x53')]]&&(_0x2baab0[_0x4048c0[_0xc15f('0x4f')]]=_0x46d46d[_0x4048c0[_0xc15f('0x53')]][_0xc15f('0x51')]());}else if(_0x4048c0[_0xc15f('0x3e')]==='customVariable'&&_0x4048c0[_0xc15f('0x54')]&&_0x4048c0[_0xc15f('0x54')][_0xc15f('0x55')]&&_0x4048c0[_0xc15f('0x4f')]){_0x46d46d[_0x4048c0['Variable'][_0xc15f('0x55')][_0xc15f('0x3f')]()]&&(_0x2baab0[_0x4048c0['idField']]=_0x46d46d[_0x4048c0['Variable'][_0xc15f('0x55')][_0xc15f('0x3f')]()][_0xc15f('0x51')]());}});}return _0x2baab0;}function getConnection(_0x3ea00f){var _0x1f4c89=_0x3ea00f[_0xc15f('0x56')]['concat'](_0x3ea00f[_0xc15f('0x57')]);var _0x5342ed=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3ea00f[_0xc15f('0x58')]||_0xc15f('0x59'),'clientId':_0x3ea00f[_0xc15f('0x5a')],'clientSecret':_0x3ea00f[_0xc15f('0x5b')]}});return _0x5342ed['login'](_0x3ea00f[_0xc15f('0x5c')],_0x1f4c89)[_0xc15f('0x2c')](function(){logger[_0xc15f('0x20')](_0xc15f('0x5d'));return _0x5342ed;});}exports[_0xc15f('0x5e')]=function(_0xc9a8e1,_0x213a5c,_0x3bbecc,_0x3a7518,_0x5840f5,_0x2835fa){var _0x39a7d1,_0x13c2ab,_0x581a48,_0x5d5cc5;_0x2835fa[_0xc15f('0x5f')]=intUtil['stripTrailingSlash'](_0x2835fa['serverUrl']);_0x2835fa['remoteUri']=intUtil[_0xc15f('0x60')](_0x2835fa[_0xc15f('0x58')]);if(_0x5840f5&&_0x5840f5[_0xc15f('0x61')]){logger[_0xc15f('0x20')](_0xc15f('0x62'),_0xc15f('0x63'));_0x213a5c['recordingURL']=util['format'](_0xc15f('0x64'),_0x2835fa[_0xc15f('0x5f')],_0x213a5c[_0xc15f('0x65')],md5(_0x213a5c[_0xc15f('0x65')]));}else{_0x213a5c[_0xc15f('0x66')]='';}return getConnection(_0x2835fa)[_0xc15f('0x2c')](function(_0x254c84){_0x5d5cc5=_0x254c84;return getUser(_0x2835fa,_0x3a7518[_0xc15f('0x67')],_0x5d5cc5);})[_0xc15f('0x2c')](function(_0x493a8d){_0x39a7d1=_0x493a8d;return getEndUser(_0x2835fa,_0x3bbecc,_0x213a5c['calleridname'],_0x213a5c[_0xc15f('0x68')],_0x5d5cc5);})[_0xc15f('0x2c')](function(_0x59b4c1){_0x13c2ab=_0x59b4c1;return getTicket(_0x2835fa,_0x39a7d1,_0x13c2ab,_0x3bbecc,_0x213a5c,_0x3bbecc[_0xc15f('0x69')],_0x5d5cc5,'queue');})[_0xc15f('0x2c')](function(_0x24e238){_0x581a48=_0x24e238;logger['info'](_0xc15f('0x6a'),_0x581a48['id']);logger[_0xc15f('0x20')](_0xc15f('0x6b'),_0x581a48['id'],_0x3a7518[_0xc15f('0x55')],_0x2835fa['type']);switch(_0x2835fa['type']){case'integrationTab':emit(util[_0xc15f('0x44')]('user:%s',_0x3a7518['name']),'trigger:salesforce:display',{'recordId':_0x581a48['id']});break;case _0xc15f('0x6c'):emit(util['format'](_0xc15f('0x6d'),_0x3a7518[_0xc15f('0x55')]),_0xc15f('0x6e'),{'uri':util[_0xc15f('0x44')]('%s/%s/e',_0x5d5cc5[_0xc15f('0x6f')],_0x581a48['id'])});break;default:logger[_0xc15f('0x70')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xc15f('0x71')](function(_0x3e197b){logger[_0xc15f('0x70')](_0xc15f('0x62'),_0x3e197b);});};exports['outbound']=function(_0x3d714c,_0x5c5296,_0x524c7e,_0x5a1246,_0x2ef485,_0x312a94,_0x264c99){var _0x47387a,_0x369d7c,_0x55596d,_0xd108c5;_0x312a94['serverUrl']=intUtil[_0xc15f('0x60')](_0x312a94[_0xc15f('0x5f')]);_0x312a94[_0xc15f('0x58')]=intUtil['stripTrailingSlash'](_0x312a94[_0xc15f('0x58')]);if(_0x264c99&&_0x264c99['recordingFormat']&&_0x264c99[_0xc15f('0x72')]!==_0xc15f('0x73')){logger[_0xc15f('0x20')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5c5296[_0xc15f('0x66')]=util[_0xc15f('0x44')](_0xc15f('0x64'),_0x312a94[_0xc15f('0x5f')],_0x5c5296[_0xc15f('0x65')],md5(_0x5c5296[_0xc15f('0x65')]));}return getConnection(_0x312a94)[_0xc15f('0x2c')](function(_0x4b5260){_0xd108c5=_0x4b5260;return getUser(_0x312a94,_0x5a1246[_0xc15f('0x67')],_0xd108c5);})['then'](function(_0x4ebf5c){_0x47387a=_0x4ebf5c;return getEndUser(_0x312a94,_0x524c7e,_0x5c5296[_0xc15f('0x74')],_0x5c5296['destcalleridnum'],_0xd108c5);})['then'](function(_0x3e48ab){_0x369d7c=_0x3e48ab;return getTicket(_0x312a94,_0x47387a,_0x369d7c,_0x524c7e,_0x5c5296,_0x524c7e[_0xc15f('0x69')],_0xd108c5,_0xc15f('0x75'));})['then'](function(_0x59468c){_0x55596d=_0x59468c;logger[_0xc15f('0x20')](_0xc15f('0x76'),_0x55596d['id']);logger[_0xc15f('0x20')](_0xc15f('0x77'),_0x55596d['id'],_0x5a1246['name'],_0x312a94['type']);switch(_0x312a94[_0xc15f('0x3e')]){case _0xc15f('0x78'):emit(util[_0xc15f('0x44')](_0xc15f('0x6d'),_0x5a1246[_0xc15f('0x55')]),'trigger:salesforce:display',{'recordId':_0x55596d['id']});break;case _0xc15f('0x6c'):emit(util[_0xc15f('0x44')](_0xc15f('0x6d'),_0x5a1246[_0xc15f('0x55')]),'trigger:browser:url',{'uri':util[_0xc15f('0x44')](_0xc15f('0x79'),_0xd108c5[_0xc15f('0x6f')],_0x55596d['id'])});break;default:logger[_0xc15f('0x70')](_0xc15f('0x7a'),_0xc15f('0x7b'));}})[_0xc15f('0x71')](function(_0x6fa554){logger[_0xc15f('0x70')](_0xc15f('0x7a'),_0x6fa554);});};exports[_0xc15f('0x7c')]=function(_0xc4bb84,_0x428d29,_0x4c5dfc,_0x3d09ef,_0x5d5549,_0x10d539){var _0x21b936,_0x3dd3e7,_0x4e45db,_0x2d2572;_0x10d539['serverUrl']=intUtil[_0xc15f('0x60')](_0x10d539[_0xc15f('0x5f')]);_0x10d539[_0xc15f('0x58')]=intUtil['stripTrailingSlash'](_0x10d539[_0xc15f('0x58')]);if(_0x5d5549&&_0x5d5549['monitor_format']){logger[_0xc15f('0x20')]('['+_0x428d29[_0xc15f('0x7d')][_0xc15f('0x7e')]()+']',_0xc15f('0x63'));_0x428d29[_0xc15f('0x66')]=util[_0xc15f('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10d539['serverUrl'],_0x428d29['uniqueid'],md5(_0x428d29[_0xc15f('0x65')]));}else{_0x428d29[_0xc15f('0x66')]='';}return getConnection(_0x10d539)[_0xc15f('0x2c')](function(_0x1cc1da){_0x2d2572=_0x1cc1da;if(!_[_0xc15f('0x7f')](_0x3d09ef)){return getUser(_0x10d539,_0x3d09ef[_0xc15f('0x55')],_0x2d2572);}else{return getUser(_0x10d539,null,_0x2d2572);}})[_0xc15f('0x2c')](function(_0x362fca){_0x21b936=_0x362fca;return getEndUser(_0x10d539,_0x4c5dfc,_0x428d29[_0xc15f('0x80')],_0x428d29[_0xc15f('0x68')],_0x2d2572);})['then'](function(_0x5d4ad7){_0x3dd3e7=_0x5d4ad7;return getTicket(_0x10d539,_0x21b936,_0x3dd3e7,_0x4c5dfc,_0x428d29,_0x4c5dfc[_0xc15f('0x69')],_0x2d2572);})['then'](function(_0x12c4d5){_0x4e45db=_0x12c4d5;logger[_0xc15f('0x20')]('['+_0x428d29[_0xc15f('0x7d')][_0xc15f('0x7e')]()+']\x20Ticket\x20%s\x20created.',_0x4e45db['id']);logger['info']('['+_0x428d29[_0xc15f('0x7d')][_0xc15f('0x7e')]()+_0xc15f('0x81'),_0x10d539[_0xc15f('0x3e')]);})[_0xc15f('0x71')](function(_0x148540){logger['error']('['+_0x428d29[_0xc15f('0x7d')][_0xc15f('0x7e')]()+']',_0x148540);});}; \ No newline at end of file +var _0x1f79=['lodash','request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','WhoId','WhatId','account','leadId','sobject','create','validateEmail','User','find','execute','then','length','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','$or','Contact','cloneDeep','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','Company','No\x20Company','format','forEach','includes','picklist','idField','content','variable','variableName','toString','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x1f79,0x7e));var _0x91f7=function(_0x3a4559,_0xa90b89){_0x3a4559=_0x3a4559-0x0;var _0x56cde0=_0x1f79[_0x3a4559];return _0x56cde0;};'use strict';var _=require(_0x91f7('0x0'));var rp=require(_0x91f7('0x1'));var moment=require(_0x91f7('0x2'));var BPromise=require(_0x91f7('0x3'));var md5=require(_0x91f7('0x4'));var jsforce=require('jsforce');var util=require(_0x91f7('0x5'));var Redis=require(_0x91f7('0x6'));var intUtil=require(_0x91f7('0x7'));var config=require(_0x91f7('0x8'));var logger=require(_0x91f7('0x9'))(_0x91f7('0xa'));config['redis']=_['defaults'](config[_0x91f7('0xb')],{'host':_0x91f7('0xc'),'port':0x18eb});var io=require(_0x91f7('0xd'))(new Redis(config['redis']));function emit(_0x51d0f7,_0x2472ef,_0x4a681e){io['to'](_0x51d0f7)[_0x91f7('0xe')](_0x2472ef,_0x4a681e);}function getTicket(_0x1405c0,_0x43abb9,_0x40c9e2,_0x298270,_0x326423,_0x38f60e,_0x2058bd,_0x526b5c){var _0x1a42c3=Object[_0x91f7('0xf')]({},{'OwnerId':_0x43abb9['id'],'Subject':intUtil['getString'](_0x298270[_0x91f7('0x10')],_0x326423,'\x20'),'Description':intUtil['getString'](_0x298270[_0x91f7('0x11')],_0x326423,'\x0a')},getCustomFields(_0x38f60e,_0x326423));if(_0x40c9e2){if(_0x298270[_0x91f7('0x12')]===_0x91f7('0x13')){_0x1a42c3[_0x91f7('0x14')]=moment[_0x91f7('0x15')]();_0x1a42c3['IsReminderSet']=![];_0x1a42c3[_0x91f7('0x16')]=![];if(_0x40c9e2[_0x91f7('0x17')]===_0x91f7('0x18')||_0x40c9e2[_0x91f7('0x17')]==='lead'){_0x1a42c3[_0x91f7('0x19')]=_0x40c9e2['id'];}else if(_0x40c9e2[_0x91f7('0x17')]==='account'){_0x1a42c3[_0x91f7('0x1a')]=_0x40c9e2['id'];}}else if(_0x298270['ticketType']==='Case'){if(_0x40c9e2[_0x91f7('0x17')]==='contact'){_0x1a42c3['ContactId']=_0x40c9e2['id'];}else if(_0x40c9e2[_0x91f7('0x17')]===_0x91f7('0x1b')){_0x1a42c3['AccountId']=_0x40c9e2['id'];}else if(_0x40c9e2[_0x91f7('0x17')]==='lead'&&_0x298270[_0x91f7('0x1c')]){_0x1a42c3[_0x298270['leadId']]=_0x40c9e2['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x2058bd[_0x91f7('0x1d')](_0x298270[_0x91f7('0x12')])[_0x91f7('0x1e')](_0x1a42c3);}function getUser(_0x3d0d2d,_0x45b7a7,_0x1b7b91){if(!_['isNil'](_0x45b7a7)&&intUtil[_0x91f7('0x1f')](_0x45b7a7)){var _0x305887={'Email':_0x45b7a7};var _0x171a94={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1b7b91['sobject'](_0x91f7('0x20'))[_0x91f7('0x21')](_0x305887,_0x171a94)[_0x91f7('0x22')]()[_0x91f7('0x23')](function(_0x5acce0){if(_0x5acce0[_0x91f7('0x24')]){var _0x1ebd21=_[_0x91f7('0x21')](_0x5acce0,function(_0x3463e2){return _0x3463e2[_0x91f7('0x25')]===_0x45b7a7;});if(_0x1ebd21){logger[_0x91f7('0x26')]('Agent\x20%s\x20found.',_0x45b7a7);return BPromise[_0x91f7('0x27')]({'id':_0x1ebd21['Id'],'name':_0x1ebd21[_0x91f7('0x28')]});}}else{logger[_0x91f7('0x26')](_0x91f7('0x29'),_0x45b7a7);return _0x1b7b91[_0x91f7('0x2a')]()[_0x91f7('0x23')](function(_0x3aea50){return BPromise['resolve']({'id':_0x3aea50[_0x91f7('0x2b')],'name':_0x3aea50['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x45b7a7);return _0x1b7b91['identity']()['then'](function(_0x36702a){return BPromise[_0x91f7('0x27')]({'id':_0x36702a[_0x91f7('0x2b')],'name':_0x36702a[_0x91f7('0x2c')]});});}}function getEndUser(_0x231aba,_0x5cd23b,_0x43f430,_0x3bc309,_0x33a3b6){var _0x278ecb={'$or':{'Phone':_0x3bc309}};var _0x25227d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x91f7('0x27')]()['then'](function(){logger[_0x91f7('0x26')](_0x91f7('0x2d'),_0x3bc309,_0x5cd23b[_0x91f7('0x2e')]);switch(_0x5cd23b[_0x91f7('0x2e')]){case'contact_lead':var _0x52ef41=_['cloneDeep'](_0x278ecb);if(_0x5cd23b[_0x91f7('0x2f')]){var _0x553329={};_0x553329[_0x5cd23b[_0x91f7('0x2f')]]=_0x3bc309;_['merge'](_0x52ef41[_0x91f7('0x30')],_0x553329);}return _0x33a3b6['sobject'](_0x91f7('0x31'))['find'](_0x52ef41,_0x25227d)[_0x91f7('0x22')]()['then'](function(_0x449fdc){if(_0x449fdc&&_0x449fdc[_0x91f7('0x24')]){return _0x449fdc;}else{var _0x1fac4f=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b[_0x91f7('0x33')]){var _0xbd63de={};_0xbd63de[_0x5cd23b[_0x91f7('0x33')]]=_0x3bc309;_[_0x91f7('0x34')](_0x1fac4f[_0x91f7('0x30')],_0xbd63de);}return _0x33a3b6[_0x91f7('0x1d')](_0x91f7('0x35'))[_0x91f7('0x21')](_0x1fac4f,_0x25227d);}});case'account_contact_lead':var _0x54425d=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b[_0x91f7('0x36')]){var _0x553329={};_0x553329[_0x5cd23b[_0x91f7('0x36')]]=_0x3bc309;_[_0x91f7('0x34')](_0x54425d[_0x91f7('0x30')],_0x553329);}return _0x33a3b6['sobject'](_0x91f7('0x37'))[_0x91f7('0x21')](_0x54425d,_0x25227d)[_0x91f7('0x22')]()[_0x91f7('0x23')](function(_0x134c1f){if(_0x134c1f&&_0x134c1f[_0x91f7('0x24')]){return _0x134c1f;}else{var _0x56568c=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b['additionalSearchContact']){var _0x5c2385={};_0x5c2385[_0x5cd23b[_0x91f7('0x2f')]]=_0x3bc309;_[_0x91f7('0x34')](_0x56568c[_0x91f7('0x30')],_0x5c2385);}return _0x33a3b6['sobject'](_0x91f7('0x31'))[_0x91f7('0x21')](_0x56568c,_0x25227d)[_0x91f7('0x23')](function(_0xa97eca){if(_0xa97eca&&_0xa97eca['length']){return _0xa97eca;}else{var _0xd715d4=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b[_0x91f7('0x33')]){var _0x3a1837={};_0x3a1837[_0x5cd23b[_0x91f7('0x33')]]=_0x3bc309;_[_0x91f7('0x34')](_0xd715d4[_0x91f7('0x30')],_0x3a1837);}return _0x33a3b6[_0x91f7('0x1d')](_0x91f7('0x35'))[_0x91f7('0x21')](_0xd715d4,_0x25227d);}});}});case _0x91f7('0x18'):var _0x52ef41=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b['additionalSearchContact']){var _0x553329={};_0x553329[_0x5cd23b[_0x91f7('0x2f')]]=_0x3bc309;_[_0x91f7('0x34')](_0x52ef41[_0x91f7('0x30')],_0x553329);}return _0x33a3b6[_0x91f7('0x1d')](_0x91f7('0x31'))['find'](_0x52ef41,_0x25227d)[_0x91f7('0x22')]();case'lead':var _0x52d5b3=_[_0x91f7('0x32')](_0x278ecb);if(_0x5cd23b[_0x91f7('0x33')]){var _0x553329={};_0x553329[_0x5cd23b['additionalSearchLead']]=_0x3bc309;_[_0x91f7('0x34')](_0x52d5b3[_0x91f7('0x30')],_0x553329);}return _0x33a3b6['sobject'](_0x91f7('0x35'))['find'](_0x52d5b3,_0x25227d);case _0x91f7('0x1b'):var _0x54425d=_['cloneDeep'](_0x278ecb);if(_0x5cd23b[_0x91f7('0x36')]){var _0x553329={};_0x553329[_0x5cd23b[_0x91f7('0x36')]]=_0x3bc309;_[_0x91f7('0x34')](_0x54425d[_0x91f7('0x30')],_0x553329);}return _0x33a3b6[_0x91f7('0x1d')]('Account')['find'](_0x54425d,_0x25227d);default:return null;}})['then'](function(_0x54585a){if(_0x54585a&&_0x54585a[_0x91f7('0x24')]){var _0x294bb5=_[_0x91f7('0x38')](_0x54585a);if(_0x294bb5){return BPromise['resolve']({'id':_0x294bb5['Id'],'name':_0x294bb5[_0x91f7('0x28')],'phone':_0x294bb5[_0x91f7('0x39')],'endUserType':_0x294bb5[_0x91f7('0x3a')][_0x91f7('0x3b')][_0x91f7('0x3c')]()});}}})[_0x91f7('0x23')](function(_0x509af7){if(_0x509af7){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x509af7[_0x91f7('0x17')],_0x3bc309);return BPromise[_0x91f7('0x27')](_0x509af7);}else{logger['info'](_0x91f7('0x3d'),_0x3bc309);var _0x42e4ac={'Phone':_0x3bc309};if(_0x5cd23b[_0x91f7('0x3e')]){if(_0x5cd23b[_0x91f7('0x3e')]==='contact'){logger[_0x91f7('0x26')](_0x91f7('0x3f'),_0x3bc309,_0x5cd23b[_0x91f7('0x3e')]);_0x42e4ac[_0x91f7('0x40')]=_0x43f430!==_0x91f7('0x41')?_0x43f430:util['format'](_0x91f7('0x42'),_0x3bc309);}else if(_0x5cd23b[_0x91f7('0x3e')]==='lead'){logger[_0x91f7('0x26')](_0x91f7('0x3f'),_0x3bc309,_0x5cd23b['moduleCreate']);_0x42e4ac['LastName']=_0x43f430!==_0x91f7('0x41')?_0x43f430:util['format'](_0x91f7('0x42'),_0x3bc309);_0x42e4ac[_0x91f7('0x43')]=_0x91f7('0x44');}else if(_0x5cd23b[_0x91f7('0x3e')]===_0x91f7('0x1b')){logger['info'](_0x91f7('0x3f'),_0x3bc309,_0x5cd23b[_0x91f7('0x3e')]);_0x42e4ac[_0x91f7('0x28')]=_0x43f430!==_0x91f7('0x41')?_0x43f430:util[_0x91f7('0x45')](_0x91f7('0x42'),_0x3bc309);}else{return null;}}return _0x33a3b6[_0x91f7('0x1d')](_['upperFirst'](_0x5cd23b['moduleCreate']))[_0x91f7('0x1e')](_0x42e4ac)['then'](function(_0x58a17a){return BPromise[_0x91f7('0x27')]({'id':_0x58a17a['id'],'endUserType':_0x5cd23b['moduleCreate']});});}});}function getCustomFields(_0x5d18c8,_0x376e3b){var _0x1c4bfe={};if(_0x5d18c8[_0x91f7('0x24')]>0x0){_[_0x91f7('0x46')](_0x5d18c8,function(_0xa47ebd){if(_[_0x91f7('0x47')](['string',_0x91f7('0x48')],_0xa47ebd['type'])&&_0xa47ebd[_0x91f7('0x49')]){_0x1c4bfe[_0xa47ebd[_0x91f7('0x49')]]=_0xa47ebd[_0x91f7('0x4a')]['toString']();}else if(_0xa47ebd['type']===_0x91f7('0x4b')&&_0xa47ebd['variableName']&&_0xa47ebd[_0x91f7('0x49')]){_0x376e3b[_0xa47ebd['variableName']]&&(_0x1c4bfe[_0xa47ebd[_0x91f7('0x49')]]=_0x376e3b[_0xa47ebd[_0x91f7('0x4c')]][_0x91f7('0x4d')]());}else if(_0xa47ebd['type']==='customVariable'&&_0xa47ebd['Variable']&&_0xa47ebd[_0x91f7('0x4e')]['name']&&_0xa47ebd['idField']){_0x376e3b[_0xa47ebd[_0x91f7('0x4e')][_0x91f7('0x4f')]['toLowerCase']()]&&(_0x1c4bfe[_0xa47ebd['idField']]=_0x376e3b[_0xa47ebd['Variable'][_0x91f7('0x4f')][_0x91f7('0x3c')]()][_0x91f7('0x4d')]());}});}return _0x1c4bfe;}function getConnection(_0x2414bb){var _0x394a5f=_0x2414bb[_0x91f7('0x50')]['concat'](_0x2414bb[_0x91f7('0x51')]);var _0x3109e0=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2414bb[_0x91f7('0x52')]||_0x91f7('0x53'),'clientId':_0x2414bb['clientId'],'clientSecret':_0x2414bb[_0x91f7('0x54')]}});return _0x3109e0[_0x91f7('0x55')](_0x2414bb[_0x91f7('0x56')],_0x394a5f)['then'](function(){logger[_0x91f7('0x26')]('Connection\x20established.');return _0x3109e0;});}exports[_0x91f7('0x57')]=function(_0x2f3043,_0x4ed061,_0x5e211e,_0x58fda2,_0x37e105,_0x177b3b){var _0x668318,_0xe8e8cf,_0x40c648,_0x2be900;_0x177b3b[_0x91f7('0x58')]=intUtil[_0x91f7('0x59')](_0x177b3b[_0x91f7('0x58')]);_0x177b3b['remoteUri']=intUtil[_0x91f7('0x59')](_0x177b3b[_0x91f7('0x52')]);if(_0x37e105&&_0x37e105[_0x91f7('0x5a')]){logger['info'](_0x91f7('0x5b'),_0x91f7('0x5c'));_0x4ed061[_0x91f7('0x5d')]=util[_0x91f7('0x45')](_0x91f7('0x5e'),_0x177b3b[_0x91f7('0x58')],_0x4ed061['uniqueid'],md5(_0x4ed061[_0x91f7('0x5f')]));}else{_0x4ed061[_0x91f7('0x5d')]='';}return getConnection(_0x177b3b)[_0x91f7('0x23')](function(_0x49d946){_0x2be900=_0x49d946;return getUser(_0x177b3b,_0x58fda2[_0x91f7('0x60')],_0x2be900);})[_0x91f7('0x23')](function(_0x38475f){_0x668318=_0x38475f;return getEndUser(_0x177b3b,_0x5e211e,_0x4ed061[_0x91f7('0x61')],_0x4ed061[_0x91f7('0x62')],_0x2be900);})[_0x91f7('0x23')](function(_0x291dba){_0xe8e8cf=_0x291dba;return getTicket(_0x177b3b,_0x668318,_0xe8e8cf,_0x5e211e,_0x4ed061,_0x5e211e[_0x91f7('0x63')],_0x2be900,_0x91f7('0x57'));})[_0x91f7('0x23')](function(_0x181763){_0x40c648=_0x181763;logger[_0x91f7('0x26')](_0x91f7('0x64'),_0x40c648['id']);logger[_0x91f7('0x26')](_0x91f7('0x65'),_0x40c648['id'],_0x58fda2[_0x91f7('0x4f')],_0x177b3b[_0x91f7('0x3b')]);switch(_0x177b3b[_0x91f7('0x3b')]){case'integrationTab':emit(util['format'](_0x91f7('0x66'),_0x58fda2[_0x91f7('0x4f')]),_0x91f7('0x67'),{'recordId':_0x40c648['id']});break;case _0x91f7('0x68'):emit(util[_0x91f7('0x45')](_0x91f7('0x66'),_0x58fda2['name']),_0x91f7('0x69'),{'uri':util[_0x91f7('0x45')]('%s/%s/e',_0x2be900[_0x91f7('0x6a')],_0x40c648['id'])});break;default:logger[_0x91f7('0x6b')](_0x91f7('0x6c'));}})[_0x91f7('0x6d')](function(_0x11570e){logger['error'](_0x91f7('0x5b'),_0x11570e);});};exports[_0x91f7('0x6e')]=function(_0x39aaf7,_0x4f8738,_0x44cbf4,_0x13c5b9,_0x354289,_0x182300,_0x154b08){var _0x15252b,_0x313967,_0x3f95ec,_0x59c8c6;_0x182300[_0x91f7('0x58')]=intUtil[_0x91f7('0x59')](_0x182300['serverUrl']);_0x182300[_0x91f7('0x52')]=intUtil['stripTrailingSlash'](_0x182300[_0x91f7('0x52')]);if(_0x154b08&&_0x154b08[_0x91f7('0x6f')]&&_0x154b08[_0x91f7('0x6f')]!==_0x91f7('0x70')){logger[_0x91f7('0x26')]('[OUTBOUND]',_0x91f7('0x5c'));_0x4f8738[_0x91f7('0x5d')]=util[_0x91f7('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x182300[_0x91f7('0x58')],_0x4f8738['uniqueid'],md5(_0x4f8738[_0x91f7('0x5f')]));}return getConnection(_0x182300)[_0x91f7('0x23')](function(_0x1cd107){_0x59c8c6=_0x1cd107;return getUser(_0x182300,_0x13c5b9[_0x91f7('0x60')],_0x59c8c6);})[_0x91f7('0x23')](function(_0x1f2238){_0x15252b=_0x1f2238;return getEndUser(_0x182300,_0x44cbf4,_0x4f8738[_0x91f7('0x71')],_0x4f8738['destcalleridnum'],_0x59c8c6);})[_0x91f7('0x23')](function(_0x30f299){_0x313967=_0x30f299;return getTicket(_0x182300,_0x15252b,_0x313967,_0x44cbf4,_0x4f8738,_0x44cbf4[_0x91f7('0x63')],_0x59c8c6,'outbound');})[_0x91f7('0x23')](function(_0x4721c5){_0x3f95ec=_0x4721c5;logger[_0x91f7('0x26')](_0x91f7('0x72'),_0x3f95ec['id']);logger[_0x91f7('0x26')](_0x91f7('0x73'),_0x3f95ec['id'],_0x13c5b9[_0x91f7('0x4f')],_0x182300[_0x91f7('0x3b')]);switch(_0x182300['type']){case _0x91f7('0x74'):emit(util[_0x91f7('0x45')](_0x91f7('0x66'),_0x13c5b9[_0x91f7('0x4f')]),_0x91f7('0x67'),{'recordId':_0x3f95ec['id']});break;case _0x91f7('0x68'):emit(util[_0x91f7('0x45')]('user:%s',_0x13c5b9[_0x91f7('0x4f')]),_0x91f7('0x69'),{'uri':util['format'](_0x91f7('0x75'),_0x59c8c6[_0x91f7('0x6a')],_0x3f95ec['id'])});break;default:logger[_0x91f7('0x6b')](_0x91f7('0x76'),_0x91f7('0x77'));}})[_0x91f7('0x6d')](function(_0x228cf8){logger['error'](_0x91f7('0x76'),_0x228cf8);});};exports[_0x91f7('0x78')]=function(_0x2bec4e,_0x12c682,_0x5dab7f,_0x41fe05,_0x3af914,_0x3f529b){var _0x3cdb6b,_0x9b88b8,_0x15c647,_0x3d3545;_0x3f529b[_0x91f7('0x58')]=intUtil['stripTrailingSlash'](_0x3f529b[_0x91f7('0x58')]);_0x3f529b[_0x91f7('0x52')]=intUtil['stripTrailingSlash'](_0x3f529b['remoteUri']);if(_0x3af914&&_0x3af914['monitor_format']){logger[_0x91f7('0x26')]('['+_0x12c682[_0x91f7('0x79')][_0x91f7('0x7a')]()+']',_0x91f7('0x5c'));_0x12c682[_0x91f7('0x5d')]=util[_0x91f7('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f529b[_0x91f7('0x58')],_0x12c682['uniqueid'],md5(_0x12c682['uniqueid']));}else{_0x12c682[_0x91f7('0x5d')]='';}return getConnection(_0x3f529b)[_0x91f7('0x23')](function(_0x8b9b4b){_0x3d3545=_0x8b9b4b;if(!_[_0x91f7('0x7b')](_0x41fe05)){return getUser(_0x3f529b,_0x41fe05[_0x91f7('0x4f')],_0x3d3545);}else{return getUser(_0x3f529b,null,_0x3d3545);}})[_0x91f7('0x23')](function(_0x534d00){_0x3cdb6b=_0x534d00;return getEndUser(_0x3f529b,_0x5dab7f,_0x12c682[_0x91f7('0x61')],_0x12c682[_0x91f7('0x62')],_0x3d3545);})['then'](function(_0x3f215c){_0x9b88b8=_0x3f215c;return getTicket(_0x3f529b,_0x3cdb6b,_0x9b88b8,_0x5dab7f,_0x12c682,_0x5dab7f[_0x91f7('0x63')],_0x3d3545);})['then'](function(_0x53308a){_0x15c647=_0x53308a;logger[_0x91f7('0x26')]('['+_0x12c682['lastevent'][_0x91f7('0x7a')]()+_0x91f7('0x7c'),_0x15c647['id']);logger['info']('['+_0x12c682['lastevent'][_0x91f7('0x7a')]()+_0x91f7('0x7d'),_0x3f529b[_0x91f7('0x3b')]);})[_0x91f7('0x6d')](function(_0x22552a){logger[_0x91f7('0x6b')]('['+_0x12c682[_0x91f7('0x79')][_0x91f7('0x7a')]()+']',_0x22552a);});}; \ 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 e8f4b0a..49b7ae3 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 _0x070f=['%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/logger','servicenow','defaults','redis','localhost','GET','then','result','length','adminId','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','idField','content','toString','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x070f,0x154));var _0xf070=function(_0x105564,_0x1dd73b){_0x105564=_0x105564-0x0;var _0x44cbd7=_0x070f[_0x105564];return _0x44cbd7;};'use strict';var _=require(_0xf070('0x0'));var Promise=require(_0xf070('0x1'));var rp=require(_0xf070('0x2'));var util=require(_0xf070('0x3'));var md5=require(_0xf070('0x4'));var Redis=require(_0xf070('0x5'));var intUtil=require(_0xf070('0x6'));var config=require('../../../../config/environment');var logger=require(_0xf070('0x7'))(_0xf070('0x8'));config['redis']=_[_0xf070('0x9')](config[_0xf070('0xa')],{'host':_0xf070('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf070('0xa')]));function getAdminUser(_0x504a7e,_0xcf8adf,_0x187cf8,_0x54d65d,_0x1a5620,_0x3ca09c){return new Promise(function(_0x14f6eb,_0xc54f75){var _0x5d74d0={'method':_0xf070('0xc'),'uri':_0x54d65d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x1a5620+'&'+_0x3ca09c,'auth':_0xcf8adf,'json':!![]};return rp(_0x5d74d0)[_0xf070('0xd')](function(_0x18da6f){if(_0x18da6f[_0xf070('0xe')][_0xf070('0xf')]>0x0){_0x187cf8[_0xf070('0x10')]=_0x18da6f[_0xf070('0xe')][0x0]['sys_id'];}logger[_0xf070('0x11')]('['+[_0x504a7e[_0xf070('0x12')]()]+'],\x20getAdminUser\x20crm',_0x187cf8);_0x14f6eb(_0x187cf8);})[_0xf070('0x13')](function(_0x2234a5){logger[_0xf070('0x14')]('['+[_0x504a7e['toUpperCase']()]+']',_0x2234a5['message']);_0xc54f75(_0x2234a5[_0xf070('0x15')]);});});}function getUser(_0x4cad5f,_0x14a316,_0x23772b,_0x18b4e0,_0x4edc99){return function(_0x579e73){logger[_0xf070('0x11')]('['+[_0x4cad5f['toUpperCase']()]+_0xf070('0x16'),_0x579e73);return new Promise(function(_0x1d5105,_0x3de791){if(intUtil['validateEmail'](_0x579e73[_0xf070('0x17')])){var _0x1d721b={'method':_0xf070('0xc'),'uri':_0x23772b+_0xf070('0x18')+_0x579e73[_0xf070('0x17')]+'&'+_0x18b4e0+'&'+_0x4edc99,'auth':_0x14a316,'json':!![]};logger[_0xf070('0x11')]('['+[_0x4cad5f[_0xf070('0x12')]()]+_0xf070('0x19'),_0x1d721b);return rp(_0x1d721b)[_0xf070('0xd')](function(_0x3e766a){logger[_0xf070('0x11')]('['+[_0x4cad5f[_0xf070('0x12')]()]+'],\x20getUser\x20entity',_0x3e766a);if(_0x3e766a['result'][_0xf070('0xf')]>0x0&&String(_0x3e766a[_0xf070('0xe')][0x0][_0xf070('0x1a')])==='true'){_0x579e73['userId']=_0x3e766a[_0xf070('0xe')][0x0][_0xf070('0x1b')];}else{_0x579e73['userId']=_0x579e73[_0xf070('0x10')];_0x579e73[_0xf070('0x17')]=_0x579e73[_0xf070('0x1c')];}logger[_0xf070('0x11')]('['+[_0x4cad5f[_0xf070('0x12')]()]+_0xf070('0x1d'),_0x579e73);_0x1d5105(_0x579e73);})[_0xf070('0x13')](function(_0x304b09){logger['error']('['+[_0x4cad5f[_0xf070('0x12')]()]+']',_0x304b09[_0xf070('0x15')]);_0x3de791(_0x304b09[_0xf070('0x15')]);});}else{logger[_0xf070('0x11')]('['+[_0x4cad5f[_0xf070('0x12')]()]+_0xf070('0x1e'));_0x579e73[_0xf070('0x1f')]=_0x579e73['adminId'];_0x579e73[_0xf070('0x17')]=_0x579e73[_0xf070('0x1c')];_0x1d5105(_0x579e73);}});};}function createEndUser(_0x30380e,_0x49a08d,_0x415435,_0x11de18,_0x356171){logger['info']('['+[_0x30380e[_0xf070('0x12')]()]+_0xf070('0x20'),_0x415435);return new Promise(function(_0x3fc3f5,_0x2fb260){var _0xcfc154={'method':_0xf070('0x21'),'uri':_0x11de18+_0xf070('0x22')+_0x356171,'body':{'user_name':_0x415435[_0xf070('0x23')],'roles':_0xf070('0x24'),'first_name':_0x415435[_0xf070('0x23')],'active':_0xf070('0x25'),'date_format':_0xf070('0x26'),'phone':_0x415435['endUserNumber']},'auth':_0x49a08d,'json':!![]};return rp(_0xcfc154)[_0xf070('0xd')](function(_0x2f3c22){logger[_0xf070('0x11')]('['+[_0x30380e[_0xf070('0x12')]()]+_0xf070('0x27'),_0x2f3c22[_0xf070('0xe')]);_0x415435['endUserId']=_0x2f3c22['result'][_0xf070('0x1b')];_0x3fc3f5(_0x415435);})[_0xf070('0x13')](function(_0x43c0cb){logger[_0xf070('0x14')]('['+[_0x30380e[_0xf070('0x12')]()]+']',_0x43c0cb[_0xf070('0x15')]);_0x2fb260(_0x43c0cb[_0xf070('0x15')]);});});}function getEndUser(_0x2b0a19,_0x4b9f7c,_0x1650b5,_0x5d2cd9,_0x18f20b){return function(_0xaabb42){logger[_0xf070('0x11')]('['+[_0x2b0a19[_0xf070('0x12')]()]+'],\x20getEndUser\x20input\x20crm',_0xaabb42);return new Promise(function(_0x3b9039,_0xd9d5fc){var _0x30439c={'method':_0xf070('0xc'),'uri':_0x1650b5+_0xf070('0x28')+_0xaabb42[_0xf070('0x23')]+'&'+_0x5d2cd9+'&'+_0x18f20b,'auth':_0x4b9f7c,'json':!![]};return rp(_0x30439c)[_0xf070('0xd')](function(_0x485b35){if(_0x485b35['result'][_0xf070('0xf')]>0x0){_0xaabb42['endUserId']=_0x485b35['result'][0x0][_0xf070('0x1b')];logger[_0xf070('0x11')]('['+[_0x2b0a19[_0xf070('0x12')]()]+_0xf070('0x29'),_0xaabb42);_0x3b9039(_0xaabb42);}else{return createEndUser(_0x2b0a19,_0x4b9f7c,_0xaabb42,_0x1650b5,_0x5d2cd9)['then'](function(_0x561716){logger[_0xf070('0x11')]('['+[_0x2b0a19[_0xf070('0x12')]()]+_0xf070('0x2a'),_0x561716);_0x3b9039(_0x561716);});}})[_0xf070('0x13')](function(_0x31c825){logger[_0xf070('0x14')]('['+[_0x2b0a19[_0xf070('0x12')]()]+']',_0x31c825[_0xf070('0x15')]);_0xd9d5fc(_0x31c825[_0xf070('0x15')]);});});};}function getCustomFields(_0x168682,_0x319ec4){var _0x10fe9e={};if(_0x168682['length']>0x0){_['forEach'](_0x168682,function(_0x464abd){if(_['includes']([_0xf070('0x2b'),_0xf070('0x2c')],_0x464abd[_0xf070('0x2d')])&&_0x464abd[_0xf070('0x2e')]&&!_0x464abd[_0xf070('0x2f')]){_0x10fe9e[_0x464abd[_0xf070('0x2e')][_0xf070('0x30')]()]=_0x464abd['content']['toString']();}else if(_['includes'](['string',_0xf070('0x2c')],_0x464abd[_0xf070('0x2d')])&&_0x464abd[_0xf070('0x31')]&&_0x464abd[_0xf070('0x2f')]){_0x10fe9e[_0x464abd[_0xf070('0x31')][_0xf070('0x30')]()]=_0x464abd[_0xf070('0x32')][_0xf070('0x33')]();}else if(_0x464abd['type']==='variable'&&_0x464abd[_0xf070('0x34')]&&_0x464abd[_0xf070('0x31')]&&_0x464abd[_0xf070('0x2f')]){_0x10fe9e[_0x464abd[_0xf070('0x31')][_0xf070('0x30')]()]=_0x319ec4[_0x464abd[_0xf070('0x34')]]['toString']();}else if(_0x464abd[_0xf070('0x2d')]==='customVariable'&&_0x464abd[_0xf070('0x35')]&&_0x464abd[_0xf070('0x35')][_0xf070('0x36')]&&_0x464abd[_0xf070('0x31')]&&_0x464abd[_0xf070('0x2f')]){_0x10fe9e[_0x464abd[_0xf070('0x31')][_0xf070('0x30')]()]=_0x319ec4[_0x464abd[_0xf070('0x35')][_0xf070('0x36')]['toLowerCase']()][_0xf070('0x33')]();}});}return _0x10fe9e;}function getTicket(_0x3b02c1,_0x162249,_0x13cc81,_0x364a79,_0x6c0051,_0x574193){return function(_0x9ae64){logger[_0xf070('0x11')]('['+[_0x3b02c1[_0xf070('0x12')]()]+_0xf070('0x37'),_0x9ae64);return new Promise(function(_0x4eca9e,_0x38c3fc){var _0xd686d5=_0x3b02c1['toLowerCase']()===_0xf070('0x38')?_0x9ae64[_0xf070('0x1f')]:_0x9ae64['endUserId'];var _0x3789c4={'method':'POST','uri':_0x13cc81+_0xf070('0x39')+'?'+_0x574193,'body':Object[_0xf070('0x3a')]({},{'active':_0xf070('0x25'),'caller_id':_0xd686d5,'assigned_to':_0x9ae64['userId'],'short_description':intUtil[_0xf070('0x3b')](_0x364a79[_0xf070('0x3c')],_0x6c0051,'\x20'),'description':intUtil[_0xf070('0x3b')](_0x364a79[_0xf070('0x3d')],_0x6c0051,'\x0a')},getCustomFields(_0x364a79[_0xf070('0x3e')],_0x6c0051)),'auth':_0x162249,'json':!![]};return rp(_0x3789c4)[_0xf070('0xd')](function(_0x54d32b){logger[_0xf070('0x11')]('['+[_0x3b02c1[_0xf070('0x12')]()]+_0xf070('0x3f'),_0x54d32b[_0xf070('0xe')]);_0x9ae64[_0xf070('0x40')]=_0x54d32b[_0xf070('0xe')][_0xf070('0x1b')];_0x9ae64[_0xf070('0x41')]=_0x54d32b['result']['number'];logger[_0xf070('0x11')]('['+[_0x3b02c1[_0xf070('0x12')]()]+_0xf070('0x42'),_0x9ae64);_0x4eca9e(_0x9ae64);})[_0xf070('0x13')](function(_0x413f3c){logger[_0xf070('0x14')]('['+[_0x3b02c1[_0xf070('0x12')]()]+']',_0x413f3c[_0xf070('0x15')]);_0x38c3fc(_0x413f3c['message']);});});};}function createRemoteTag(_0x489ca6,_0x5c3d14,_0xa023cf,_0x211394){return new Promise(function(_0x7e933e,_0x3ea7e7){var _0x3b3e8d={'method':'POST','uri':_0xa023cf+_0xf070('0x43')+'?'+_0x211394,'body':{'short_description':_0x489ca6,'global':!![],'active':!![],'name':_0x489ca6},'auth':_0x5c3d14,'json':!![]};return rp(_0x3b3e8d)[_0xf070('0xd')](function(_0x435ad8){var _0x2afc9b=_0x435ad8[_0xf070('0xe')][_0xf070('0x1b')];_0x7e933e(_0x2afc9b);});});}function getRemoteTag(_0x4d27b6,_0x1f4650,_0x7c296d,_0x2adb8a,_0x17dabf){return new Promise(function(_0x45f5e7,_0x4b03fc){var _0x3eddc3={'method':_0xf070('0xc'),'uri':_0x7c296d+_0xf070('0x43')+_0xf070('0x44')+_0x4d27b6+'&'+_0x2adb8a,'auth':_0x1f4650,'json':!![]};return rp(_0x3eddc3)[_0xf070('0xd')](function(_0x6609e6){if(_0x6609e6[_0xf070('0xe')]['length']>0x0){var _0x39b921=_0x6609e6[_0xf070('0xe')][0x0]['sys_id'];_0x45f5e7(_0x39b921);}else{return createRemoteTag(_0x4d27b6,_0x1f4650,_0x7c296d,_0x2adb8a)[_0xf070('0xd')](function(_0x564c80){_0x45f5e7(_0x564c80);});}});});}function assignTagToIncident(_0x3149d7,_0x3387ef,_0x4fdaaf,_0x6115c6,_0x5193c6){return new Promise(function(_0x3c1ff8,_0x19b941){var _0x3ecdeb={'method':_0xf070('0x21'),'uri':_0x4fdaaf+_0xf070('0x45')+'?'+_0x5193c6,'body':{'label':_0x3149d7,'table':_0xf070('0x39'),'id_type':'Incident','table_key':_0x6115c6[_0xf070('0x40')],'title':'Incident\x20-\x20'+_0x6115c6[_0xf070('0x41')],'id_display':_0x6115c6[_0xf070('0x41')]},'auth':_0x3387ef,'json':!![]};return rp(_0x3ecdeb)[_0xf070('0xd')](function(_0x25c21f){_0x3c1ff8();})[_0xf070('0x13')](function(){_0x3c1ff8();});});}function manageTags(_0x123c0f,_0x1ba85e,_0x143618,_0x98cc96,_0x396eac,_0x3ebeae,_0x10974d){return new Promise(function(_0x3fc16e,_0x1dcd84){var _0x52a94b=[];_0x1ba85e['forEach'](function(_0xebebdd){_0x52a94b[_0xf070('0x46')](getRemoteTag(_0xebebdd,_0x143618,_0x98cc96,_0x3ebeae,_0x10974d));});return Promise[_0xf070('0x47')](_0x52a94b)['then'](function(_0x3c85e4){if(_0x3c85e4[_0xf070('0xf')]){logger[_0xf070('0x11')]('['+[_0x123c0f[_0xf070('0x12')]()]+_0xf070('0x48'),_0x3c85e4);var _0x5e2565=[];_0x3c85e4['forEach'](function(_0x212d6a){_0x5e2565[_0xf070('0x46')](assignTagToIncident(_0x212d6a,_0x143618,_0x98cc96,_0x396eac,_0x3ebeae));});return Promise[_0xf070('0x47')](_0x5e2565)[_0xf070('0xd')](function(){_0x3fc16e();})[_0xf070('0x13')](function(){_0x3fc16e();});}else{_0x3fc16e();}});});}function getTags(_0x184536,_0x563447,_0x5dc313,_0x397042,_0x485584,_0x4896dd){return function(_0x1556d2){return new Promise(function(_0x36c80c,_0x748135){var _0x42ecb7=[];var _0x48ae26=_0x397042[_0xf070('0x49')];if(_0x48ae26&&_0x48ae26['length']>0x0){_0x42ecb7=_[_0xf070('0x4a')](_0x48ae26,_0xf070('0x36'));}if(_0x42ecb7[_0xf070('0xf')]>0x0){return manageTags(_0x184536,_0x42ecb7,_0x563447,_0x5dc313,_0x1556d2,_0x485584,_0x4896dd)[_0xf070('0xd')](function(){_0x36c80c(_0x1556d2);});}else{_0x36c80c(_0x1556d2);}});};}function emit(_0x5620d1,_0x3c77d7,_0x55df23){var _0x24e05d=_0xf070('0x4b')+_0xf070('0x4c')+_0xf070('0x4d')+'%255EORDERBYDESCnumber';var _0x153a05={'uri':_0x5620d1+_0xf070('0x4e')+_0x55df23+_0x24e05d};io['to'](util[_0xf070('0x4f')]('user:%s',_0x3c77d7))[_0xf070('0x50')]('trigger:browser:url',_0x153a05);}exports['cs']=function(_0x1fbece,_0x2de784,_0x103a93,_0x2dc799,_0x1856d9,_0x58e0fa,_0x4c9215,_0x5c8868){var _0x3e0308={};var _0x5546f8={'user':_0x58e0fa[_0xf070('0x51')],'pass':_0x58e0fa['password']};var _0x581ad3=_0xf070('0x52');var _0x2fa337=_0xf070('0x53');_0x58e0fa[_0xf070('0x54')]=intUtil[_0xf070('0x55')](_0x58e0fa[_0xf070('0x54')]);_0x58e0fa[_0xf070('0x56')]=intUtil[_0xf070('0x55')](_0x58e0fa[_0xf070('0x56')]);var _0x22f00a=util['format'](_0xf070('0x57'),_0x58e0fa[_0xf070('0x54')]);_0x3e0308[_0xf070('0x17')]=!_[_0xf070('0x58')](_0x2dc799)?_0x2dc799['email']:null;_0x3e0308[_0xf070('0x1c')]=_0x58e0fa[_0xf070('0x59')];_0x3e0308[_0xf070('0x23')]=_0x5c8868['toLowerCase']()===_0xf070('0x38')?_0x2de784['destcalleridnum']:_0x2de784[_0xf070('0x5a')];_0x3e0308[_0xf070('0x5b')]=_0x5c8868===_0xf070('0x5c')||_0x5c8868===_0xf070('0x5d')?_0xf070('0x5c'):'outbound';var _0x488b33=util['format'](_0xf070('0x5e'),_0x58e0fa['serverUrl'],_0x2de784[_0xf070('0x5f')],md5(_0x2de784[_0xf070('0x5f')]));if(_0x1856d9&&_0x1856d9['monitor_format']){logger[_0xf070('0x11')]('[QUEUE]',_0xf070('0x60'));_0x2de784['recordingURL']=_0x488b33;}else if(_0x4c9215&&_0x4c9215[_0xf070('0x61')]&&_0x4c9215[_0xf070('0x61')]!=='none'){logger[_0xf070('0x11')](_0xf070('0x62'),'Recording\x20is\x20enabled!');_0x2de784[_0xf070('0x63')]=_0x488b33;}else{_0x2de784['recordingURL']='';}return getAdminUser(_0x5c8868,_0x5546f8,_0x3e0308,_0x22f00a,_0x2fa337,_0x581ad3)['then'](getUser(_0x5c8868,_0x5546f8,_0x22f00a,_0x2fa337,_0x581ad3))[_0xf070('0xd')](getEndUser(_0x5c8868,_0x5546f8,_0x22f00a,_0x2fa337,_0x581ad3))['then'](getTicket(_0x5c8868,_0x5546f8,_0x22f00a,_0x103a93,_0x2de784,_0x2fa337))[_0xf070('0xd')](function(_0x4b9cae){logger[_0xf070('0x11')](util[_0xf070('0x4f')](_0xf070('0x64'),_0x4b9cae[_0xf070('0x40')]));logger[_0xf070('0x11')](util[_0xf070('0x4f')]('call\x20direction:\x20%s',_0x5c8868));if(_0x5c8868!=='unmanaged'){logger['info']('['+[_0x5c8868[_0xf070('0x12')]()]+']',_0xf070('0x65'));emit(_0x58e0fa[_0xf070('0x54')],_0x2dc799[_0xf070('0x36')],_0x4b9cae[_0xf070('0x40')]);}})[_0xf070('0x13')](function(_0x19172e){logger[_0xf070('0x14')]('['+[_0x5c8868[_0xf070('0x12')]()]+_0xf070('0x66'),util[_0xf070('0x67')](_0x19172e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0077=['includes','idField','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','forEach','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','format','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','inspect','lodash','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','then','result','length','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','userId','adminId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','content','toString'];(function(_0x4bddef,_0x4b34f1){var _0x570ced=function(_0x19941d){while(--_0x19941d){_0x4bddef['push'](_0x4bddef['shift']());}};_0x570ced(++_0x4b34f1);}(_0x0077,0x16b));var _0x7007=function(_0x4a5939,_0x3e370d){_0x4a5939=_0x4a5939-0x0;var _0x118f42=_0x0077[_0x4a5939];return _0x118f42;};'use strict';var _=require(_0x7007('0x0'));var Promise=require('bluebird');var rp=require(_0x7007('0x1'));var util=require('util');var md5=require(_0x7007('0x2'));var Redis=require('ioredis');var intUtil=require(_0x7007('0x3'));var config=require(_0x7007('0x4'));var logger=require(_0x7007('0x5'))('servicenow');config[_0x7007('0x6')]=_[_0x7007('0x7')](config[_0x7007('0x6')],{'host':_0x7007('0x8'),'port':0x18eb});var io=require(_0x7007('0x9'))(new Redis(config[_0x7007('0x6')]));function getAdminUser(_0x33e0c4,_0x31636a,_0x500afc,_0xb5ec0a,_0x3699ec,_0x144765){return new Promise(function(_0x290041,_0x467654){var _0x1da6a6={'method':_0x7007('0xa'),'uri':_0xb5ec0a+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x3699ec+'&'+_0x144765,'auth':_0x31636a,'json':!![]};return rp(_0x1da6a6)[_0x7007('0xb')](function(_0x29dd04){if(_0x29dd04[_0x7007('0xc')][_0x7007('0xd')]>0x0){_0x500afc['adminId']=_0x29dd04[_0x7007('0xc')][0x0][_0x7007('0xe')];}logger[_0x7007('0xf')]('['+[_0x33e0c4['toUpperCase']()]+_0x7007('0x10'),_0x500afc);_0x290041(_0x500afc);})[_0x7007('0x11')](function(_0x593135){logger[_0x7007('0x12')]('['+[_0x33e0c4[_0x7007('0x13')]()]+']',_0x593135['message']);_0x467654(_0x593135[_0x7007('0x14')]);});});}function getUser(_0x545fb9,_0x4fe9b6,_0x32b21a,_0x21d1b4,_0x34e5fc){return function(_0x34f4f1){logger[_0x7007('0xf')]('['+[_0x545fb9[_0x7007('0x13')]()]+_0x7007('0x15'),_0x34f4f1);return new Promise(function(_0x3429cb,_0x4cb79e){if(intUtil[_0x7007('0x16')](_0x34f4f1[_0x7007('0x17')])){var _0x123c5f={'method':_0x7007('0xa'),'uri':_0x32b21a+_0x7007('0x18')+_0x34f4f1[_0x7007('0x17')]+'&'+_0x21d1b4+'&'+_0x34e5fc,'auth':_0x4fe9b6,'json':!![]};logger[_0x7007('0xf')]('['+[_0x545fb9['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x123c5f);return rp(_0x123c5f)[_0x7007('0xb')](function(_0x1d2f73){logger['info']('['+[_0x545fb9[_0x7007('0x13')]()]+_0x7007('0x19'),_0x1d2f73);if(_0x1d2f73[_0x7007('0xc')][_0x7007('0xd')]>0x0&&String(_0x1d2f73[_0x7007('0xc')][0x0][_0x7007('0x1a')])==='true'){_0x34f4f1[_0x7007('0x1b')]=_0x1d2f73['result'][0x0][_0x7007('0xe')];}else{_0x34f4f1[_0x7007('0x1b')]=_0x34f4f1[_0x7007('0x1c')];_0x34f4f1['userEmail']=_0x34f4f1[_0x7007('0x1d')];}logger[_0x7007('0xf')]('['+[_0x545fb9['toUpperCase']()]+_0x7007('0x1e'),_0x34f4f1);_0x3429cb(_0x34f4f1);})[_0x7007('0x11')](function(_0x122672){logger[_0x7007('0x12')]('['+[_0x545fb9[_0x7007('0x13')]()]+']',_0x122672[_0x7007('0x14')]);_0x4cb79e(_0x122672[_0x7007('0x14')]);});}else{logger['info']('['+[_0x545fb9[_0x7007('0x13')]()]+']\x20using\x20admin\x20profile');_0x34f4f1['userId']=_0x34f4f1[_0x7007('0x1c')];_0x34f4f1['userEmail']=_0x34f4f1[_0x7007('0x1d')];_0x3429cb(_0x34f4f1);}});};}function createEndUser(_0x4c6187,_0x40f984,_0x1ca8d1,_0x2d763e,_0x21a819){logger[_0x7007('0xf')]('['+[_0x4c6187[_0x7007('0x13')]()]+_0x7007('0x1f'),_0x1ca8d1);return new Promise(function(_0x2ec9ad,_0x6efe5a){var _0x1c3263={'method':_0x7007('0x20'),'uri':_0x2d763e+_0x7007('0x21')+_0x21a819,'body':{'user_name':_0x1ca8d1[_0x7007('0x22')],'roles':_0x7007('0x23'),'first_name':_0x1ca8d1['endUserNumber'],'active':_0x7007('0x24'),'date_format':_0x7007('0x25'),'phone':_0x1ca8d1[_0x7007('0x22')]},'auth':_0x40f984,'json':!![]};return rp(_0x1c3263)[_0x7007('0xb')](function(_0x2a0897){logger[_0x7007('0xf')]('['+[_0x4c6187[_0x7007('0x13')]()]+_0x7007('0x26'),_0x2a0897['result']);_0x1ca8d1['endUserId']=_0x2a0897[_0x7007('0xc')]['sys_id'];_0x2ec9ad(_0x1ca8d1);})[_0x7007('0x11')](function(_0x3fe2df){logger[_0x7007('0x12')]('['+[_0x4c6187['toUpperCase']()]+']',_0x3fe2df[_0x7007('0x14')]);_0x6efe5a(_0x3fe2df['message']);});});}function getEndUser(_0x2844f5,_0x1f76da,_0x43447b,_0x417db9,_0x2928c0){return function(_0x342e0a){logger[_0x7007('0xf')]('['+[_0x2844f5[_0x7007('0x13')]()]+_0x7007('0x27'),_0x342e0a);return new Promise(function(_0x5bcaeb,_0x30810c){var _0x1f31d9={'method':'GET','uri':_0x43447b+'sys_user?sysparm_query=phone%3D'+_0x342e0a[_0x7007('0x22')]+'&'+_0x417db9+'&'+_0x2928c0,'auth':_0x1f76da,'json':!![]};return rp(_0x1f31d9)[_0x7007('0xb')](function(_0x1ba447){if(_0x1ba447[_0x7007('0xc')][_0x7007('0xd')]>0x0){_0x342e0a['endUserId']=_0x1ba447[_0x7007('0xc')][0x0][_0x7007('0xe')];logger[_0x7007('0xf')]('['+[_0x2844f5[_0x7007('0x13')]()]+'],\x20getEndUser\x20crm',_0x342e0a);_0x5bcaeb(_0x342e0a);}else{return createEndUser(_0x2844f5,_0x1f76da,_0x342e0a,_0x43447b,_0x417db9)['then'](function(_0x4c91c2){logger[_0x7007('0xf')]('['+[_0x2844f5['toUpperCase']()]+_0x7007('0x28'),_0x4c91c2);_0x5bcaeb(_0x4c91c2);});}})[_0x7007('0x11')](function(_0x49661d){logger[_0x7007('0x12')]('['+[_0x2844f5[_0x7007('0x13')]()]+']',_0x49661d[_0x7007('0x14')]);_0x30810c(_0x49661d['message']);});});};}function getCustomFields(_0x3763ce,_0x14efbd){var _0x13aec8={};if(_0x3763ce[_0x7007('0xd')]>0x0){_['forEach'](_0x3763ce,function(_0x269e9f){if(_['includes']([_0x7007('0x29'),_0x7007('0x2a')],_0x269e9f[_0x7007('0x2b')])&&_0x269e9f[_0x7007('0x2c')]&&!_0x269e9f[_0x7007('0x2d')]){_0x13aec8[_0x269e9f[_0x7007('0x2c')][_0x7007('0x2e')]()]=_0x269e9f[_0x7007('0x2f')][_0x7007('0x30')]();}else if(_[_0x7007('0x31')]([_0x7007('0x29'),_0x7007('0x2a')],_0x269e9f[_0x7007('0x2b')])&&_0x269e9f[_0x7007('0x32')]&&_0x269e9f[_0x7007('0x2d')]){_0x13aec8[_0x269e9f[_0x7007('0x32')]['toLowerCase']()]=_0x269e9f[_0x7007('0x2f')][_0x7007('0x30')]();}else if(_0x269e9f['type']==='variable'&&_0x269e9f['variableName']&&_0x269e9f[_0x7007('0x32')]&&_0x269e9f[_0x7007('0x2d')]){_0x13aec8[_0x269e9f['idField'][_0x7007('0x2e')]()]=_0x14efbd[_0x269e9f['variableName']][_0x7007('0x30')]();}else if(_0x269e9f[_0x7007('0x2b')]==='customVariable'&&_0x269e9f['Variable']&&_0x269e9f[_0x7007('0x33')]['name']&&_0x269e9f['idField']&&_0x269e9f[_0x7007('0x2d')]){_0x13aec8[_0x269e9f[_0x7007('0x32')][_0x7007('0x2e')]()]=_0x14efbd[_0x269e9f[_0x7007('0x33')][_0x7007('0x34')]['toLowerCase']()][_0x7007('0x30')]();}});}return _0x13aec8;}function getTicket(_0x5c895c,_0x225a25,_0x228d6b,_0x50f6df,_0x4d51aa,_0x4cecf0){return function(_0x24de9f){logger[_0x7007('0xf')]('['+[_0x5c895c[_0x7007('0x13')]()]+_0x7007('0x35'),_0x24de9f);return new Promise(function(_0x1b073e,_0x48e36d){var _0x12dbfb=_0x5c895c[_0x7007('0x2e')]()===_0x7007('0x36')?_0x24de9f[_0x7007('0x1b')]:_0x24de9f[_0x7007('0x37')];var _0x1476a2={'method':_0x7007('0x20'),'uri':_0x228d6b+_0x7007('0x38')+'?'+_0x4cecf0,'body':Object[_0x7007('0x39')]({},{'active':_0x7007('0x24'),'caller_id':_0x12dbfb,'assigned_to':_0x24de9f[_0x7007('0x1b')],'short_description':intUtil[_0x7007('0x3a')](_0x50f6df[_0x7007('0x3b')],_0x4d51aa,'\x20'),'description':intUtil['getString'](_0x50f6df['Descriptions'],_0x4d51aa,'\x0a')},getCustomFields(_0x50f6df[_0x7007('0x3c')],_0x4d51aa)),'auth':_0x225a25,'json':!![]};return rp(_0x1476a2)[_0x7007('0xb')](function(_0x1008c0){logger[_0x7007('0xf')]('['+[_0x5c895c[_0x7007('0x13')]()]+_0x7007('0x3d'),_0x1008c0[_0x7007('0xc')]);_0x24de9f['ticketId']=_0x1008c0[_0x7007('0xc')][_0x7007('0xe')];_0x24de9f[_0x7007('0x3e')]=_0x1008c0['result'][_0x7007('0x3f')];logger[_0x7007('0xf')]('['+[_0x5c895c['toUpperCase']()]+_0x7007('0x40'),_0x24de9f);_0x1b073e(_0x24de9f);})[_0x7007('0x11')](function(_0x442141){logger[_0x7007('0x12')]('['+[_0x5c895c[_0x7007('0x13')]()]+']',_0x442141[_0x7007('0x14')]);_0x48e36d(_0x442141[_0x7007('0x14')]);});});};}function createRemoteTag(_0x2fe269,_0x3bef72,_0x942e18,_0x3c4aed){return new Promise(function(_0x486fc2,_0x48be12){var _0x5a268a={'method':_0x7007('0x20'),'uri':_0x942e18+_0x7007('0x41')+'?'+_0x3c4aed,'body':{'short_description':_0x2fe269,'global':!![],'active':!![],'name':_0x2fe269},'auth':_0x3bef72,'json':!![]};return rp(_0x5a268a)[_0x7007('0xb')](function(_0x1e4b1f){var _0x3f2370=_0x1e4b1f['result'][_0x7007('0xe')];_0x486fc2(_0x3f2370);});});}function getRemoteTag(_0x2ea974,_0x2fa411,_0x37b345,_0x4e94eb,_0x5bd079){return new Promise(function(_0x20b01f,_0x1999a1){var _0x660dcc={'method':_0x7007('0xa'),'uri':_0x37b345+_0x7007('0x41')+'?sysparm_query=name%3D'+_0x2ea974+'&'+_0x4e94eb,'auth':_0x2fa411,'json':!![]};return rp(_0x660dcc)['then'](function(_0x2a3f4a){if(_0x2a3f4a[_0x7007('0xc')][_0x7007('0xd')]>0x0){var _0x1e873c=_0x2a3f4a[_0x7007('0xc')][0x0][_0x7007('0xe')];_0x20b01f(_0x1e873c);}else{return createRemoteTag(_0x2ea974,_0x2fa411,_0x37b345,_0x4e94eb)[_0x7007('0xb')](function(_0x77f40b){_0x20b01f(_0x77f40b);});}});});}function assignTagToIncident(_0x492be3,_0x3a16df,_0x1be342,_0x6b8e36,_0x2f895c){return new Promise(function(_0xf34cf,_0x3181b0){var _0x3dfbfb={'method':_0x7007('0x20'),'uri':_0x1be342+'label_entry'+'?'+_0x2f895c,'body':{'label':_0x492be3,'table':_0x7007('0x38'),'id_type':_0x7007('0x42'),'table_key':_0x6b8e36[_0x7007('0x43')],'title':_0x7007('0x44')+_0x6b8e36[_0x7007('0x3e')],'id_display':_0x6b8e36[_0x7007('0x3e')]},'auth':_0x3a16df,'json':!![]};return rp(_0x3dfbfb)[_0x7007('0xb')](function(_0x14d9da){_0xf34cf();})[_0x7007('0x11')](function(){_0xf34cf();});});}function manageTags(_0x39dbe6,_0x149e19,_0x51e136,_0x430421,_0x56af2b,_0x200986,_0x2ace9a){return new Promise(function(_0x45742c,_0x5bd7f8){var _0x55f0ef=[];_0x149e19['forEach'](function(_0x45b96e){_0x55f0ef[_0x7007('0x45')](getRemoteTag(_0x45b96e,_0x51e136,_0x430421,_0x200986,_0x2ace9a));});return Promise['all'](_0x55f0ef)['then'](function(_0x288d9d){if(_0x288d9d[_0x7007('0xd')]){logger[_0x7007('0xf')]('['+[_0x39dbe6[_0x7007('0x13')]()]+_0x7007('0x46'),_0x288d9d);var _0x23c598=[];_0x288d9d[_0x7007('0x47')](function(_0x582584){_0x23c598[_0x7007('0x45')](assignTagToIncident(_0x582584,_0x51e136,_0x430421,_0x56af2b,_0x200986));});return Promise[_0x7007('0x48')](_0x23c598)[_0x7007('0xb')](function(){_0x45742c();})[_0x7007('0x11')](function(){_0x45742c();});}else{_0x45742c();}});});}function getTags(_0x44997e,_0x599513,_0x4e3bf8,_0x59edb5,_0x5cb568,_0xd01633){return function(_0x49ac3d){return new Promise(function(_0x25e7db,_0x52db6f){var _0x588531=[];var _0x36e648=_0x59edb5[_0x7007('0x49')];if(_0x36e648&&_0x36e648[_0x7007('0xd')]>0x0){_0x588531=_[_0x7007('0x4a')](_0x36e648,'name');}if(_0x588531[_0x7007('0xd')]>0x0){return manageTags(_0x44997e,_0x588531,_0x599513,_0x4e3bf8,_0x49ac3d,_0x5cb568,_0xd01633)[_0x7007('0xb')](function(){_0x25e7db(_0x49ac3d);});}else{_0x25e7db(_0x49ac3d);}});};}function emit(_0x3b81b0,_0x2e5b42,_0x17a0c1){var _0x5120d2=_0x7007('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x7007('0x4c')+_0x7007('0x4d');var _0x95b754={'uri':_0x3b81b0+_0x7007('0x4e')+_0x17a0c1+_0x5120d2};io['to'](util['format'](_0x7007('0x4f'),_0x2e5b42))['emit'](_0x7007('0x50'),_0x95b754);}exports['cs']=function(_0xbce6ac,_0x568fca,_0x4c1488,_0x64ca2,_0x39ef0b,_0x4e8ca9,_0x38f539,_0x26521e){var _0x9d7674={};var _0x4883f1={'user':_0x4e8ca9[_0x7007('0x51')],'pass':_0x4e8ca9[_0x7007('0x52')]};var _0x5bb92f='sysparm_limit=1';var _0x1704d1=_0x7007('0x53');_0x4e8ca9[_0x7007('0x54')]=intUtil[_0x7007('0x55')](_0x4e8ca9[_0x7007('0x54')]);_0x4e8ca9['serverUrl']=intUtil['stripTrailingSlash'](_0x4e8ca9['serverUrl']);var _0x33ca9e=util[_0x7007('0x56')]('%s/api/now/table/',_0x4e8ca9[_0x7007('0x54')]);_0x9d7674['userEmail']=!_['isNil'](_0x64ca2)?_0x64ca2['email']:null;_0x9d7674[_0x7007('0x1d')]=_0x4e8ca9[_0x7007('0x57')];_0x9d7674[_0x7007('0x22')]=_0x26521e['toLowerCase']()==='outbound'?_0x568fca['destcalleridnum']:_0x568fca[_0x7007('0x58')];_0x9d7674[_0x7007('0x59')]=_0x26521e===_0x7007('0x5a')||_0x26521e===_0x7007('0x5b')?_0x7007('0x5a'):_0x7007('0x36');var _0x2a5d8c=util[_0x7007('0x56')](_0x7007('0x5c'),_0x4e8ca9[_0x7007('0x5d')],_0x568fca[_0x7007('0x5e')],md5(_0x568fca[_0x7007('0x5e')]));if(_0x39ef0b&&_0x39ef0b['monitor_format']){logger[_0x7007('0xf')]('[QUEUE]',_0x7007('0x5f'));_0x568fca['recordingURL']=_0x2a5d8c;}else if(_0x38f539&&_0x38f539[_0x7007('0x60')]&&_0x38f539['recordingFormat']!==_0x7007('0x61')){logger[_0x7007('0xf')](_0x7007('0x62'),_0x7007('0x5f'));_0x568fca[_0x7007('0x63')]=_0x2a5d8c;}else{_0x568fca[_0x7007('0x63')]='';}return getAdminUser(_0x26521e,_0x4883f1,_0x9d7674,_0x33ca9e,_0x1704d1,_0x5bb92f)[_0x7007('0xb')](getUser(_0x26521e,_0x4883f1,_0x33ca9e,_0x1704d1,_0x5bb92f))[_0x7007('0xb')](getEndUser(_0x26521e,_0x4883f1,_0x33ca9e,_0x1704d1,_0x5bb92f))[_0x7007('0xb')](getTicket(_0x26521e,_0x4883f1,_0x33ca9e,_0x4c1488,_0x568fca,_0x1704d1))[_0x7007('0xb')](function(_0x3c5fb0){logger[_0x7007('0xf')](util['format'](_0x7007('0x64'),_0x3c5fb0[_0x7007('0x43')]));logger[_0x7007('0xf')](util['format'](_0x7007('0x65'),_0x26521e));if(_0x26521e!==_0x7007('0x5b')){logger[_0x7007('0xf')]('['+[_0x26521e['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4e8ca9[_0x7007('0x54')],_0x64ca2['name'],_0x3c5fb0[_0x7007('0x43')]);}})[_0x7007('0x11')](function(_0x31d9a0){logger[_0x7007('0x12')]('['+[_0x26521e[_0x7007('0x13')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x7007('0x66')](_0x31d9a0,{'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 3d21be5..22a390f 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 _0x561d=['length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','toString','custom_fields','variable','customVariable','Variable','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','uri','%s/service/v4_1/rest.php','remoteUri','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','catch','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','direction'];(function(_0x250b1c,_0x5887f4){var _0x30d864=function(_0x1b8aec){while(--_0x1b8aec){_0x250b1c['push'](_0x250b1c['shift']());}};_0x30d864(++_0x5887f4);}(_0x561d,0x14f));var _0xd561=function(_0xbc6cf2,_0x31be69){_0xbc6cf2=_0xbc6cf2-0x0;var _0x55bf76=_0x561d[_0xbc6cf2];return _0x55bf76;};'use strict';var _=require('lodash');var rp=require(_0xd561('0x0'));var BPromise=require(_0xd561('0x1'));var md5=require('md5');var util=require(_0xd561('0x2'));var Redis=require(_0xd561('0x3'));var intUtil=require(_0xd561('0x4'));var config=require(_0xd561('0x5'));var logger=require(_0xd561('0x6'))(_0xd561('0x7'));config[_0xd561('0x8')]=_['defaults'](config[_0xd561('0x8')],{'host':_0xd561('0x9'),'port':0x18eb});var io=require(_0xd561('0xa'))(new Redis(config[_0xd561('0x8')]));var def={'method':_0xd561('0xb'),'json':!![]};function emit(_0x1ef746,_0x15801d,_0x55bf0e){io['to'](_0x1ef746)[_0xd561('0xc')](_0x15801d,_0x55bf0e);}function getTicket(_0x3229eb,_0x4a428c,_0x4fb345,_0x4c0c18,_0x2729b5,_0x56e7e0,_0x86b192,_0x6d616){logger[_0xd561('0xd')](_0xd561('0xe'));var _0x4fff22=new Date();var _0x6d942e=[{'name':_0xd561('0xf'),'value':intUtil[_0xd561('0x10')](_0x4c0c18[_0xd561('0x11')],_0x2729b5,'\x20')},{'name':'assigned_user_id','value':_0x4a428c['id']},{'name':_0xd561('0x12'),'value':_0x4a428c['id']},{'name':'description','value':intUtil['getString'](_0x4c0c18[_0xd561('0x13')],_0x2729b5,'\x0a')},{'name':_0xd561('0x14'),'value':_0x4fff22[_0xd561('0x15')]()['slice'](0x0,0x13)[_0xd561('0x16')]('T','\x20')},{'name':_0xd561('0x17'),'value':'0'},{'name':_0xd561('0x18'),'value':'15'},{'name':_0xd561('0x19'),'value':_0x4fb345['id']},{'name':_0xd561('0x1a'),'value':'Contacts'},{'name':'parent_name','value':_0x4fb345['name']},{'name':_0xd561('0x1b'),'value':_0x6d616}];if(_0x56e7e0[_0xd561('0x1c')]){_[_0xd561('0x1d')](_0x56e7e0,function(_0x306dea){if(_0x2729b5[_0x306dea[_0xd561('0x1e')]]){_0x6d942e[_0xd561('0x1f')]({'name':_0x306dea[_0xd561('0x20')],'value':_0x2729b5[_0x306dea[_0xd561('0x1e')]]});}});}return request({'form':{'method':_0xd561('0x21'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x86b192['id'],'module_name':_0xd561('0x24'),'name_value_list':_0x6d942e})}});}function getAuth(_0x50272d){return util[_0xd561('0x25')]('Basic\x20%s',new Buffer(_0x50272d[_0xd561('0x26')]+':X')['toString']('base64'));}function getServerInfo(_0x36d622){return request({'form':{'method':_0xd561('0x27'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x36d622['id']})}});}function getUser(_0x597229,_0x4a9fb3,_0x102b3b){if(!_[_0xd561('0x28')](_0x4a9fb3)){logger[_0xd561('0xd')](_0xd561('0x29'),_0x4a9fb3);return request({'form':{'method':_0xd561('0x2a'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x102b3b['id'],'module_name':_0xd561('0x2b'),'query':util[_0xd561('0x25')](_0xd561('0x2c'),_0x4a9fb3),'order_by':'','offset':'0','select_fields':['id',_0xd561('0xf'),_0xd561('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd561('0x2e')](function(_0x33f090){if(_0x33f090[_0xd561('0x2f')][_0xd561('0x1c')]){var _0x52711f=_['find'](_0x33f090[_0xd561('0x2f')],function(_0x2570a8){return _0x2570a8[_0xd561('0x30')]['user_name'][_0xd561('0x31')]===_0x4a9fb3;});if(_0x52711f){logger[_0xd561('0xd')]('Agent\x20found!');return BPromise[_0xd561('0x32')]({'id':_0x52711f[_0xd561('0x30')]['id']['value'],'name':_0x52711f[_0xd561('0x30')][_0xd561('0xf')][_0xd561('0x31')]});}}logger[_0xd561('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd561('0x32')]({'id':_0x102b3b['name_value_list'][_0xd561('0x33')]['value'],'name':_0x102b3b[_0xd561('0x30')][_0xd561('0x2d')]['value']});});}else{logger[_0xd561('0xd')](_0xd561('0x34'));return BPromise['resolve']({'id':_0x102b3b[_0xd561('0x30')][_0xd561('0x33')][_0xd561('0x31')],'name':_0x102b3b['name_value_list']['user_name'][_0xd561('0x31')]});}}function getEndUser(_0x1ac8d1,_0x6725f0,_0x58d333,_0x498436){logger[_0xd561('0xd')](_0xd561('0x35'),_0x58d333);return request({'form':{'method':_0xd561('0x2a'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x498436['id'],'module_name':_0xd561('0x36'),'query':util[_0xd561('0x25')](_0xd561('0x37'),_0x58d333),'order_by':'','offset':'0','select_fields':['id','name',_0xd561('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd561('0x2e')](function(_0x4cbb38){if(_0x4cbb38[_0xd561('0x2f')][_0xd561('0x1c')]){var _0x4817ae=_[_0xd561('0x39')](_0x4cbb38[_0xd561('0x2f')],function(_0x582e74){return _0x582e74['name_value_list'][_0xd561('0x38')][_0xd561('0x31')]===_0x58d333;});if(_0x4817ae){logger['info'](_0xd561('0x3a'));return BPromise[_0xd561('0x32')]({'id':_0x4817ae['name_value_list']['id'][_0xd561('0x31')],'name':_0x4817ae[_0xd561('0x30')][_0xd561('0xf')][_0xd561('0x31')],'phone':_0x4817ae['name_value_list'][_0xd561('0x38')][_0xd561('0x31')]});}}else{logger[_0xd561('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xd561('0x21'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x498436['id'],'module_name':_0xd561('0x36'),'name_value_list':[{'name':_0xd561('0x3b'),'value':_0x6725f0!==_0xd561('0x3c')?_0x6725f0:util[_0xd561('0x25')](_0xd561('0x3d'),_0x58d333)},{'name':_0xd561('0x38'),'value':_0x58d333}]})}})[_0xd561('0x2e')](function(_0x2114ac){logger[_0xd561('0xd')]('Enduser\x20created.');return BPromise[_0xd561('0x32')]({'id':_0x2114ac['id'],'name':_0x2114ac[_0xd561('0x2f')][_0xd561('0x3b')]['value'],'phone':_0x2114ac['entry_list']['phone_home'][_0xd561('0x31')]});});}});}function request(_0x3a24e2){logger[_0xd561('0x3e')](_0xd561('0x3f'),JSON[_0xd561('0x23')](_0x3a24e2));return rp(_['merge'](def,_0x3a24e2));}function getTags(_0x195b6a,_0xb4afd1){var _0x2aaf7e=[];if(_0x195b6a&&_0x195b6a[_0xd561('0x1c')]>0x0){_0x2aaf7e=_[_0xd561('0x40')](_0x195b6a,_0xb4afd1);}return _0x2aaf7e;}function getCustomFields(_0x3d5450,_0x254b9c){var _0x4d6dda=[];var _0x10ec35={'custom_fields':[]};if(_0x3d5450[_0xd561('0x1c')]>0x0){_[_0xd561('0x1d')](_0x3d5450,function(_0x2b8d40){if(_0x2b8d40[_0xd561('0x41')]===_0xd561('0x42')&&_0x2b8d40[_0xd561('0x43')]&&!_0x2b8d40[_0xd561('0x44')]){_0x10ec35[_0x2b8d40[_0xd561('0x43')][_0xd561('0x45')]()]=_0x2b8d40[_0xd561('0x46')][_0xd561('0x47')]();}else if(_0x2b8d40[_0xd561('0x41')]===_0xd561('0x42')&&_0x2b8d40[_0xd561('0x20')]&&_0x2b8d40[_0xd561('0x44')]){_0x10ec35[_0xd561('0x48')][_0xd561('0x1f')]({'id':_0x2b8d40[_0xd561('0x20')],'value':_0x2b8d40[_0xd561('0x46')][_0xd561('0x47')]()});}else if(_0x2b8d40['type']===_0xd561('0x49')&&_0x2b8d40[_0xd561('0x1e')]&&_0x2b8d40[_0xd561('0x20')]&&_0x2b8d40[_0xd561('0x44')]){_0x254b9c[_0x2b8d40['variableName']]&&_0x10ec35[_0xd561('0x48')]['push']({'id':_0x2b8d40[_0xd561('0x20')],'value':_0x254b9c[_0x2b8d40[_0xd561('0x1e')]][_0xd561('0x47')]()});}else if(_0x2b8d40[_0xd561('0x41')]===_0xd561('0x4a')&&_0x2b8d40[_0xd561('0x4b')]&&_0x2b8d40['Variable'][_0xd561('0xf')]&&_0x2b8d40['idField']&&_0x2b8d40[_0xd561('0x44')]){_0x254b9c[_0x2b8d40['Variable']['name'][_0xd561('0x45')]()]&&_0x10ec35[_0xd561('0x48')][_0xd561('0x1f')]({'id':_0x2b8d40[_0xd561('0x20')],'value':_0x254b9c[_0x2b8d40['Variable'][_0xd561('0xf')][_0xd561('0x45')]()][_0xd561('0x47')]()});}});}return _0x10ec35;}function getConnection(_0x303ed9){return request({'method':'POST','form':{'method':'login','input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'user_auth':{'user_name':_0x303ed9['username'],'password':_0x303ed9['password'],'encryption':_0xd561('0x4c')},'application':_0xd561('0x4d')})}})[_0xd561('0x2e')](function(_0x482f0e){var _0x56eeab=_0x482f0e;if(_0x56eeab['id']){def['sessionID']=_0x56eeab['id'];return BPromise[_0xd561('0x32')](_0x56eeab);}else{throw new Error(util[_0xd561('0x25')](_0xd561('0x4e'),_0x303ed9['id']));}});}function setRelationship(_0x56a73d,_0x5097b4,_0xe803b,_0x1add77){return request({'form':{'method':_0xd561('0x4f'),'input_type':_0xd561('0x22'),'response_type':_0xd561('0x22'),'rest_data':JSON[_0xd561('0x23')]({'session':_0x56a73d['id'],'module_name':_0xd561('0x24'),'module_id':_0xe803b['id'],'link_field_name':_0x1add77,'related_ids':[_0x5097b4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd561('0x50')]=function(_0x1672d2,_0x11ba9c,_0x2f4c7a,_0x47a911,_0x54f32a,_0x56d4e2){var _0x334b55,_0x2dfc68,_0x4df6bb,_0x772766;_0x56d4e2['remoteUri']=intUtil[_0xd561('0x51')](_0x56d4e2['remoteUri']);_0x56d4e2['serverUrl']=intUtil[_0xd561('0x51')](_0x56d4e2['serverUrl']);def[_0xd561('0x52')]=util[_0xd561('0x25')](_0xd561('0x53'),_0x56d4e2[_0xd561('0x54')]);if(_0x54f32a&&_0x54f32a['monitor_format']){logger[_0xd561('0xd')]('[QUEUE]',_0xd561('0x55'));_0x11ba9c[_0xd561('0x56')]=util[_0xd561('0x25')](_0xd561('0x57'),_0x56d4e2[_0xd561('0x58')],_0x11ba9c[_0xd561('0x59')],md5(_0x11ba9c['uniqueid']));}else{_0x11ba9c[_0xd561('0x56')]='';}return getConnection(_0x56d4e2)[_0xd561('0x2e')](function(_0x4b3d2e){_0x772766=_0x4b3d2e;return getUser(_0x56d4e2,_0x47a911['name'],_0x772766);})[_0xd561('0x2e')](function(_0x5bd2b5){_0x334b55=_0x5bd2b5;logger[_0xd561('0xd')](_0xd561('0x5a'),_0x334b55['id']);return getEndUser(_0x56d4e2,_0x11ba9c[_0xd561('0x5b')],_0x11ba9c['calleridnum'],_0x772766);})[_0xd561('0x2e')](function(_0x22f16a){_0x2dfc68=_0x22f16a;logger[_0xd561('0xd')](_0xd561('0x5c'),_0x2dfc68['id']);return getTicket(_0x56d4e2,_0x334b55,_0x2dfc68,_0x2f4c7a,_0x11ba9c,_0x2f4c7a[_0xd561('0x5d')],_0x772766,_0xd561('0x5e'));})[_0xd561('0x2e')](function(_0x2c96a2){_0x4df6bb=_0x2c96a2;logger[_0xd561('0xd')]('Ticket\x20created!');logger[_0xd561('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4df6bb['id']);return setRelationship(_0x772766,_0x334b55,_0x4df6bb,_0xd561('0x5f'));})[_0xd561('0x2e')](function(){return setRelationship(_0x772766,_0x2dfc68,_0x4df6bb,_0xd561('0x60'));})[_0xd561('0x2e')](function(){return getServerInfo(_0x772766);})['then'](function(_0x84a64f){var _0x3ef25a=parseInt(_0x84a64f[_0xd561('0x61')]['charAt'](0x0));var _0xf85f21=util[_0xd561('0x25')](_0xd561('0x62'),_0x56d4e2[_0xd561('0x54')],_0x4df6bb['id']);if(_0x3ef25a>0x6){_0xf85f21=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x56d4e2[_0xd561('0x54')],_0x4df6bb['id']);}logger[_0xd561('0xd')](_0xd561('0x63'),_0xd561('0x64'));emit(util['format'](_0xd561('0x65'),_0x47a911[_0xd561('0xf')]),_0xd561('0x66'),{'uri':_0xf85f21});})['catch'](function(_0x3f9f26){logger[_0xd561('0x67')](_0xd561('0x63'),JSON[_0xd561('0x23')](_0x3f9f26));});};exports[_0xd561('0x68')]=function(_0x4b8af5,_0x2a9ccc,_0x4690ab,_0x189209,_0x5ab76a,_0x3970d3,_0x1cca06){var _0xa03815,_0x29e9db,_0x49d727,_0x4a794f;_0x3970d3[_0xd561('0x54')]=intUtil[_0xd561('0x51')](_0x3970d3[_0xd561('0x54')]);_0x3970d3['serverUrl']=intUtil['stripTrailingSlash'](_0x3970d3[_0xd561('0x58')]);def[_0xd561('0x52')]=util[_0xd561('0x25')](_0xd561('0x53'),_0x3970d3[_0xd561('0x54')]);if(_0x1cca06&&_0x1cca06[_0xd561('0x69')]&&_0x1cca06[_0xd561('0x69')]!==_0xd561('0x6a')){logger[_0xd561('0xd')]('[OUTBOUND]',_0xd561('0x55'));_0x2a9ccc[_0xd561('0x56')]=util[_0xd561('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3970d3[_0xd561('0x58')],_0x2a9ccc[_0xd561('0x59')],md5(_0x2a9ccc[_0xd561('0x59')]));}return getConnection(_0x3970d3)[_0xd561('0x2e')](function(_0x2aa00c){_0x4a794f=_0x2aa00c;return getUser(_0x3970d3,_0x189209[_0xd561('0xf')],_0x4a794f);})['then'](function(_0xe0a3b2){_0xa03815=_0xe0a3b2;logger[_0xd561('0xd')]('The\x20User\x20ID\x20is:',_0xa03815['id']);return getEndUser(_0x3970d3,_0x2a9ccc[_0xd561('0x6b')],_0x2a9ccc[_0xd561('0x6c')],_0x4a794f);})[_0xd561('0x2e')](function(_0x3f543a){_0x29e9db=_0x3f543a;logger['info'](_0xd561('0x5c'),_0x29e9db['id']);return getTicket(_0x3970d3,_0xa03815,_0x29e9db,_0x4690ab,_0x2a9ccc,_0x4690ab['Fields'],_0x4a794f,_0xd561('0x6d'));})[_0xd561('0x2e')](function(_0x1e1260){_0x49d727=_0x1e1260;logger['info'](_0xd561('0x6e'));logger[_0xd561('0xd')](_0xd561('0x6f'),_0x49d727['id']);return setRelationship(_0x4a794f,_0xa03815,_0x49d727,_0xd561('0x5f'));})['then'](function(){return setRelationship(_0x4a794f,_0x29e9db,_0x49d727,'contacts');})[_0xd561('0x2e')](function(){return getServerInfo(_0x4a794f);})['then'](function(_0x22a6d0){var _0x3e81ec=parseInt(_0x22a6d0[_0xd561('0x61')][_0xd561('0x70')](0x0));var _0x2ad72c=util['format'](_0xd561('0x62'),_0x3970d3[_0xd561('0x54')],_0x49d727['id']);if(_0x3e81ec>0x6){_0x2ad72c=util[_0xd561('0x25')](_0xd561('0x71'),_0x3970d3[_0xd561('0x54')],_0x49d727['id']);}logger[_0xd561('0xd')](_0xd561('0x72'),_0xd561('0x64'));emit(util['format'](_0xd561('0x65'),_0x189209[_0xd561('0xf')]),_0xd561('0x66'),{'uri':_0x2ad72c});})[_0xd561('0x73')](function(_0x4d8eba){logger[_0xd561('0x67')](_0xd561('0x72'),JSON['stringify'](_0x4d8eba));});};exports[_0xd561('0x74')]=function(_0x38e8dc,_0x1a2cb7,_0x493043,_0x4e3def,_0x314777,_0xb7fac4){var _0x20a0b7,_0x2da93a,_0x4b51f2,_0x15b6de;_0xb7fac4[_0xd561('0x54')]=intUtil['stripTrailingSlash'](_0xb7fac4[_0xd561('0x54')]);_0xb7fac4[_0xd561('0x58')]=intUtil[_0xd561('0x51')](_0xb7fac4[_0xd561('0x58')]);def['uri']=util[_0xd561('0x25')](_0xd561('0x53'),_0xb7fac4[_0xd561('0x54')]);if(_0x314777&&_0x314777[_0xd561('0x75')]){logger[_0xd561('0xd')]('['+_0x1a2cb7[_0xd561('0x76')][_0xd561('0x77')]()+']',_0xd561('0x55'));_0x1a2cb7['recordingURL']=util[_0xd561('0x25')](_0xd561('0x57'),_0xb7fac4[_0xd561('0x58')],_0x1a2cb7[_0xd561('0x59')],md5(_0x1a2cb7[_0xd561('0x59')]));}else{_0x1a2cb7[_0xd561('0x56')]='';}return getConnection(_0xb7fac4)[_0xd561('0x2e')](function(_0x911465){_0x15b6de=_0x911465;if(!_[_0xd561('0x28')](_0x4e3def)){return getUser(_0xb7fac4,_0x4e3def[_0xd561('0xf')],_0x15b6de);}else{return getUser(_0xb7fac4,null,_0x15b6de);}})['then'](function(_0x31426b){_0x20a0b7=_0x31426b;logger['info'](_0xd561('0x5a'),_0x20a0b7['id']);return getEndUser(_0xb7fac4,_0x1a2cb7['calleridname'],_0x1a2cb7[_0xd561('0x78')],_0x15b6de);})[_0xd561('0x2e')](function(_0x3f75be){_0x2da93a=_0x3f75be;logger[_0xd561('0xd')](_0xd561('0x5c'),_0x2da93a['id']);return getTicket(_0xb7fac4,_0x20a0b7,_0x2da93a,_0x493043,_0x1a2cb7,_0x493043[_0xd561('0x5d')],_0x15b6de,_0xd561('0x5e'));})[_0xd561('0x2e')](function(_0x3e73b9){_0x4b51f2=_0x3e73b9;logger['info'](_0xd561('0x6e'));logger[_0xd561('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4b51f2['id']);return setRelationship(_0x15b6de,_0x20a0b7,_0x4b51f2,'users');})[_0xd561('0x2e')](function(){return setRelationship(_0x15b6de,_0x2da93a,_0x4b51f2,'contacts');})[_0xd561('0x2e')](function(){return getServerInfo(_0x15b6de);})[_0xd561('0x73')](function(_0x15ee39){logger[_0xd561('0x67')]('['+_0x1a2cb7[_0xd561('0x76')]['toUpperCase']()+']',JSON[_0xd561('0x23')](_0x15ee39));});}; \ No newline at end of file +var _0x7327=['stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','debug','merge','map','type','string','customField','nameField','toLowerCase','content','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','outbound','recordingFormat','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Fields','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','unmanaged','lastevent','toUpperCase','users','error','lodash','request-promise','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','getString','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','name','direction','length','forEach','variableName','push','idField','set_entry','JSON'];(function(_0x30631b,_0x50799b){var _0x3d57c6=function(_0x3ecce0){while(--_0x3ecce0){_0x30631b['push'](_0x30631b['shift']());}};_0x3d57c6(++_0x50799b);}(_0x7327,0x147));var _0x7732=function(_0x594245,_0x37fa88){_0x594245=_0x594245-0x0;var _0x538195=_0x7327[_0x594245];return _0x538195;};'use strict';var _=require(_0x7732('0x0'));var rp=require(_0x7732('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x7732('0x2'));var Redis=require(_0x7732('0x3'));var intUtil=require(_0x7732('0x4'));var config=require(_0x7732('0x5'));var logger=require('../../../../config/logger')(_0x7732('0x6'));config[_0x7732('0x7')]=_[_0x7732('0x8')](config[_0x7732('0x7')],{'host':_0x7732('0x9'),'port':0x18eb});var io=require(_0x7732('0xa'))(new Redis(config[_0x7732('0x7')]));var def={'method':_0x7732('0xb'),'json':!![]};function emit(_0x21e30e,_0x1117fd,_0x4f3789){io['to'](_0x21e30e)[_0x7732('0xc')](_0x1117fd,_0x4f3789);}function getTicket(_0x1f6a1e,_0x298949,_0x4d1cf6,_0x2cc9d6,_0x44cc62,_0x5dde8c,_0x532388,_0x3f0088){logger[_0x7732('0xd')]('Creating\x20new\x20ticket...');var _0x4c3282=new Date();var _0x468f3b=[{'name':'name','value':intUtil[_0x7732('0xe')](_0x2cc9d6['Subjects'],_0x44cc62,'\x20')},{'name':_0x7732('0xf'),'value':_0x298949['id']},{'name':'created_by','value':_0x298949['id']},{'name':_0x7732('0x10'),'value':intUtil[_0x7732('0xe')](_0x2cc9d6[_0x7732('0x11')],_0x44cc62,'\x0a')},{'name':_0x7732('0x12'),'value':_0x4c3282[_0x7732('0x13')]()[_0x7732('0x14')](0x0,0x13)[_0x7732('0x15')]('T','\x20')},{'name':_0x7732('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x7732('0x17'),'value':_0x4d1cf6['id']},{'name':_0x7732('0x18'),'value':_0x7732('0x19')},{'name':_0x7732('0x1a'),'value':_0x4d1cf6[_0x7732('0x1b')]},{'name':_0x7732('0x1c'),'value':_0x3f0088}];if(_0x5dde8c[_0x7732('0x1d')]){_[_0x7732('0x1e')](_0x5dde8c,function(_0x313526){if(_0x44cc62[_0x313526[_0x7732('0x1f')]]){_0x468f3b[_0x7732('0x20')]({'name':_0x313526[_0x7732('0x21')],'value':_0x44cc62[_0x313526[_0x7732('0x1f')]]});}});}return request({'form':{'method':_0x7732('0x22'),'input_type':_0x7732('0x23'),'response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'session':_0x532388['id'],'module_name':_0x7732('0x25'),'name_value_list':_0x468f3b})}});}function getAuth(_0x359524){return util[_0x7732('0x26')](_0x7732('0x27'),new Buffer(_0x359524[_0x7732('0x28')]+':X')[_0x7732('0x29')]('base64'));}function getServerInfo(_0x4da4e6){return request({'form':{'method':_0x7732('0x2a'),'input_type':_0x7732('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4da4e6['id']})}});}function getUser(_0x10c427,_0x5b46fb,_0x4eb1a0){if(!_[_0x7732('0x2b')](_0x5b46fb)){logger['info'](_0x7732('0x2c'),_0x5b46fb);return request({'form':{'method':_0x7732('0x2d'),'input_type':'JSON','response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'session':_0x4eb1a0['id'],'module_name':_0x7732('0x2e'),'query':util[_0x7732('0x26')](_0x7732('0x2f'),_0x5b46fb),'order_by':'','offset':'0','select_fields':['id',_0x7732('0x1b'),_0x7732('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7732('0x31')](function(_0x138a8f){if(_0x138a8f[_0x7732('0x32')][_0x7732('0x1d')]){var _0x4aacbc=_[_0x7732('0x33')](_0x138a8f['entry_list'],function(_0x27fafe){return _0x27fafe['name_value_list']['user_name'][_0x7732('0x34')]===_0x5b46fb;});if(_0x4aacbc){logger['info'](_0x7732('0x35'));return BPromise[_0x7732('0x36')]({'id':_0x4aacbc[_0x7732('0x37')]['id'][_0x7732('0x34')],'name':_0x4aacbc[_0x7732('0x37')]['name']['value']});}}logger[_0x7732('0xd')](_0x7732('0x38'));return BPromise[_0x7732('0x36')]({'id':_0x4eb1a0[_0x7732('0x37')][_0x7732('0x39')]['value'],'name':_0x4eb1a0[_0x7732('0x37')][_0x7732('0x30')][_0x7732('0x34')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7732('0x36')]({'id':_0x4eb1a0['name_value_list']['user_id'][_0x7732('0x34')],'name':_0x4eb1a0[_0x7732('0x37')][_0x7732('0x30')]['value']});}}function getEndUser(_0x227091,_0x2877e8,_0x3585bd,_0x156787){logger[_0x7732('0xd')](_0x7732('0x3a'),_0x3585bd);return request({'form':{'method':_0x7732('0x2d'),'input_type':'JSON','response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'session':_0x156787['id'],'module_name':'Contacts','query':util[_0x7732('0x26')](_0x7732('0x3b'),_0x3585bd),'order_by':'','offset':'0','select_fields':['id',_0x7732('0x1b'),_0x7732('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7732('0x31')](function(_0x2f84f0){if(_0x2f84f0['entry_list']['length']){var _0x2547cd=_[_0x7732('0x33')](_0x2f84f0[_0x7732('0x32')],function(_0x3c1db6){return _0x3c1db6['name_value_list'][_0x7732('0x3c')]['value']===_0x3585bd;});if(_0x2547cd){logger[_0x7732('0xd')](_0x7732('0x3d'));return BPromise[_0x7732('0x36')]({'id':_0x2547cd[_0x7732('0x37')]['id'][_0x7732('0x34')],'name':_0x2547cd[_0x7732('0x37')][_0x7732('0x1b')]['value'],'phone':_0x2547cd[_0x7732('0x37')][_0x7732('0x3c')][_0x7732('0x34')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x7732('0x22'),'input_type':_0x7732('0x23'),'response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'session':_0x156787['id'],'module_name':_0x7732('0x19'),'name_value_list':[{'name':_0x7732('0x3e'),'value':_0x2877e8!==_0x7732('0x3f')?_0x2877e8:util[_0x7732('0x26')](_0x7732('0x40'),_0x3585bd)},{'name':_0x7732('0x3c'),'value':_0x3585bd}]})}})[_0x7732('0x31')](function(_0x38689f){logger['info']('Enduser\x20created.');return BPromise[_0x7732('0x36')]({'id':_0x38689f['id'],'name':_0x38689f[_0x7732('0x32')]['first_name'][_0x7732('0x34')],'phone':_0x38689f['entry_list'][_0x7732('0x3c')]['value']});});}});}function request(_0x389fcc){logger[_0x7732('0x41')]('[HTTP]',JSON[_0x7732('0x24')](_0x389fcc));return rp(_[_0x7732('0x42')](def,_0x389fcc));}function getTags(_0x502359,_0x578ca1){var _0x27c183=[];if(_0x502359&&_0x502359[_0x7732('0x1d')]>0x0){_0x27c183=_[_0x7732('0x43')](_0x502359,_0x578ca1);}return _0x27c183;}function getCustomFields(_0x1b4c36,_0x4f1225){var _0x5222f5=[];var _0x281759={'custom_fields':[]};if(_0x1b4c36['length']>0x0){_['forEach'](_0x1b4c36,function(_0x3cea22){if(_0x3cea22[_0x7732('0x44')]===_0x7732('0x45')&&_0x3cea22['nameField']&&!_0x3cea22[_0x7732('0x46')]){_0x281759[_0x3cea22[_0x7732('0x47')][_0x7732('0x48')]()]=_0x3cea22[_0x7732('0x49')][_0x7732('0x29')]();}else if(_0x3cea22[_0x7732('0x44')]===_0x7732('0x45')&&_0x3cea22['idField']&&_0x3cea22[_0x7732('0x46')]){_0x281759['custom_fields'][_0x7732('0x20')]({'id':_0x3cea22[_0x7732('0x21')],'value':_0x3cea22[_0x7732('0x49')][_0x7732('0x29')]()});}else if(_0x3cea22['type']==='variable'&&_0x3cea22[_0x7732('0x1f')]&&_0x3cea22['idField']&&_0x3cea22['customField']){_0x4f1225[_0x3cea22[_0x7732('0x1f')]]&&_0x281759[_0x7732('0x4a')][_0x7732('0x20')]({'id':_0x3cea22[_0x7732('0x21')],'value':_0x4f1225[_0x3cea22['variableName']][_0x7732('0x29')]()});}else if(_0x3cea22[_0x7732('0x44')]===_0x7732('0x4b')&&_0x3cea22[_0x7732('0x4c')]&&_0x3cea22[_0x7732('0x4c')][_0x7732('0x1b')]&&_0x3cea22['idField']&&_0x3cea22[_0x7732('0x46')]){_0x4f1225[_0x3cea22['Variable'][_0x7732('0x1b')][_0x7732('0x48')]()]&&_0x281759['custom_fields']['push']({'id':_0x3cea22[_0x7732('0x21')],'value':_0x4f1225[_0x3cea22['Variable'][_0x7732('0x1b')][_0x7732('0x48')]()][_0x7732('0x29')]()});}});}return _0x281759;}function getConnection(_0x5933e){return request({'method':_0x7732('0xb'),'form':{'method':_0x7732('0x4d'),'input_type':_0x7732('0x23'),'response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'user_auth':{'user_name':_0x5933e[_0x7732('0x4e')],'password':_0x5933e[_0x7732('0x4f')],'encryption':_0x7732('0x50')},'application':_0x7732('0x51')})}})[_0x7732('0x31')](function(_0x4cd028){var _0x29ba63=_0x4cd028;if(_0x29ba63['id']){def[_0x7732('0x52')]=_0x29ba63['id'];return BPromise[_0x7732('0x36')](_0x29ba63);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x5933e['id']));}});}function setRelationship(_0x226c52,_0x48f35e,_0xa41474,_0x56a076){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0x7732('0x23'),'rest_data':JSON[_0x7732('0x24')]({'session':_0x226c52['id'],'module_name':_0x7732('0x25'),'module_id':_0xa41474['id'],'link_field_name':_0x56a076,'related_ids':[_0x48f35e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x7732('0x53')]=function(_0x25ac81,_0x4cae72,_0x22cc9d,_0x5e7301,_0x15fd3e,_0x32e0d0){var _0x107d67,_0x1a7f5d,_0x6df4b,_0x50ab78;_0x32e0d0[_0x7732('0x54')]=intUtil[_0x7732('0x55')](_0x32e0d0[_0x7732('0x54')]);_0x32e0d0['serverUrl']=intUtil[_0x7732('0x55')](_0x32e0d0['serverUrl']);def[_0x7732('0x56')]=util[_0x7732('0x26')](_0x7732('0x57'),_0x32e0d0[_0x7732('0x54')]);if(_0x15fd3e&&_0x15fd3e[_0x7732('0x58')]){logger[_0x7732('0xd')](_0x7732('0x59'),'Recording\x20is\x20enabled!');_0x4cae72[_0x7732('0x5a')]=util[_0x7732('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32e0d0[_0x7732('0x5b')],_0x4cae72[_0x7732('0x5c')],md5(_0x4cae72['uniqueid']));}else{_0x4cae72[_0x7732('0x5a')]='';}return getConnection(_0x32e0d0)['then'](function(_0x349d11){_0x50ab78=_0x349d11;return getUser(_0x32e0d0,_0x5e7301[_0x7732('0x1b')],_0x50ab78);})[_0x7732('0x31')](function(_0x10301e){_0x107d67=_0x10301e;logger[_0x7732('0xd')](_0x7732('0x5d'),_0x107d67['id']);return getEndUser(_0x32e0d0,_0x4cae72[_0x7732('0x5e')],_0x4cae72[_0x7732('0x5f')],_0x50ab78);})[_0x7732('0x31')](function(_0x57d266){_0x1a7f5d=_0x57d266;logger[_0x7732('0xd')](_0x7732('0x60'),_0x1a7f5d['id']);return getTicket(_0x32e0d0,_0x107d67,_0x1a7f5d,_0x22cc9d,_0x4cae72,_0x22cc9d['Fields'],_0x50ab78,_0x7732('0x61'));})[_0x7732('0x31')](function(_0x4a444b){_0x6df4b=_0x4a444b;logger['info'](_0x7732('0x62'));logger[_0x7732('0xd')](_0x7732('0x63'),_0x6df4b['id']);return setRelationship(_0x50ab78,_0x107d67,_0x6df4b,'users');})[_0x7732('0x31')](function(){return setRelationship(_0x50ab78,_0x1a7f5d,_0x6df4b,_0x7732('0x64'));})[_0x7732('0x31')](function(){return getServerInfo(_0x50ab78);})[_0x7732('0x31')](function(_0x4b0bcd){var _0x444572=parseInt(_0x4b0bcd[_0x7732('0x65')][_0x7732('0x66')](0x0));var _0x42d84c=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x32e0d0['remoteUri'],_0x6df4b['id']);if(_0x444572>0x6){_0x42d84c=util['format'](_0x7732('0x67'),_0x32e0d0[_0x7732('0x54')],_0x6df4b['id']);}logger[_0x7732('0xd')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7732('0x26')](_0x7732('0x68'),_0x5e7301['name']),_0x7732('0x69'),{'uri':_0x42d84c});})[_0x7732('0x6a')](function(_0x2c363e){logger['error'](_0x7732('0x59'),JSON[_0x7732('0x24')](_0x2c363e));});};exports[_0x7732('0x6b')]=function(_0xe43094,_0x2a6a04,_0x115772,_0x3367ce,_0xa387e4,_0x59938e,_0x9cb1f4){var _0x2c4a46,_0x592ac5,_0x357c91,_0x314912;_0x59938e[_0x7732('0x54')]=intUtil[_0x7732('0x55')](_0x59938e[_0x7732('0x54')]);_0x59938e['serverUrl']=intUtil[_0x7732('0x55')](_0x59938e[_0x7732('0x5b')]);def[_0x7732('0x56')]=util[_0x7732('0x26')](_0x7732('0x57'),_0x59938e[_0x7732('0x54')]);if(_0x9cb1f4&&_0x9cb1f4[_0x7732('0x6c')]&&_0x9cb1f4[_0x7732('0x6c')]!=='none'){logger[_0x7732('0xd')]('[OUTBOUND]',_0x7732('0x6d'));_0x2a6a04[_0x7732('0x5a')]=util['format'](_0x7732('0x6e'),_0x59938e['serverUrl'],_0x2a6a04[_0x7732('0x5c')],md5(_0x2a6a04['uniqueid']));}return getConnection(_0x59938e)['then'](function(_0x1c3551){_0x314912=_0x1c3551;return getUser(_0x59938e,_0x3367ce['name'],_0x314912);})[_0x7732('0x31')](function(_0x4faf4e){_0x2c4a46=_0x4faf4e;logger[_0x7732('0xd')]('The\x20User\x20ID\x20is:',_0x2c4a46['id']);return getEndUser(_0x59938e,_0x2a6a04['destcalleridname'],_0x2a6a04[_0x7732('0x6f')],_0x314912);})[_0x7732('0x31')](function(_0x34fdce){_0x592ac5=_0x34fdce;logger[_0x7732('0xd')](_0x7732('0x60'),_0x592ac5['id']);return getTicket(_0x59938e,_0x2c4a46,_0x592ac5,_0x115772,_0x2a6a04,_0x115772[_0x7732('0x70')],_0x314912,_0x7732('0x71'));})[_0x7732('0x31')](function(_0x588d0b){_0x357c91=_0x588d0b;logger['info'](_0x7732('0x62'));logger[_0x7732('0xd')](_0x7732('0x63'),_0x357c91['id']);return setRelationship(_0x314912,_0x2c4a46,_0x357c91,'users');})['then'](function(){return setRelationship(_0x314912,_0x592ac5,_0x357c91,_0x7732('0x64'));})[_0x7732('0x31')](function(){return getServerInfo(_0x314912);})['then'](function(_0x38fae9){var _0x234170=parseInt(_0x38fae9[_0x7732('0x65')][_0x7732('0x66')](0x0));var _0x309ba3=util['format'](_0x7732('0x72'),_0x59938e[_0x7732('0x54')],_0x357c91['id']);if(_0x234170>0x6){_0x309ba3=util['format'](_0x7732('0x67'),_0x59938e[_0x7732('0x54')],_0x357c91['id']);}logger[_0x7732('0xd')](_0x7732('0x73'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7732('0x26')]('user:%s',_0x3367ce[_0x7732('0x1b')]),_0x7732('0x69'),{'uri':_0x309ba3});})[_0x7732('0x6a')](function(_0x3aecfa){logger['error'](_0x7732('0x73'),JSON[_0x7732('0x24')](_0x3aecfa));});};exports[_0x7732('0x74')]=function(_0x4022a7,_0x2532c3,_0x2c13a1,_0x23d622,_0x9d1217,_0x647267){var _0x2d5606,_0x1e5dc0,_0x17bc41,_0x1e84bd;_0x647267[_0x7732('0x54')]=intUtil['stripTrailingSlash'](_0x647267[_0x7732('0x54')]);_0x647267[_0x7732('0x5b')]=intUtil[_0x7732('0x55')](_0x647267[_0x7732('0x5b')]);def[_0x7732('0x56')]=util['format'](_0x7732('0x57'),_0x647267[_0x7732('0x54')]);if(_0x9d1217&&_0x9d1217[_0x7732('0x58')]){logger['info']('['+_0x2532c3[_0x7732('0x75')][_0x7732('0x76')]()+']',_0x7732('0x6d'));_0x2532c3[_0x7732('0x5a')]=util['format'](_0x7732('0x6e'),_0x647267[_0x7732('0x5b')],_0x2532c3[_0x7732('0x5c')],md5(_0x2532c3['uniqueid']));}else{_0x2532c3[_0x7732('0x5a')]='';}return getConnection(_0x647267)[_0x7732('0x31')](function(_0x114824){_0x1e84bd=_0x114824;if(!_[_0x7732('0x2b')](_0x23d622)){return getUser(_0x647267,_0x23d622[_0x7732('0x1b')],_0x1e84bd);}else{return getUser(_0x647267,null,_0x1e84bd);}})[_0x7732('0x31')](function(_0x4b1266){_0x2d5606=_0x4b1266;logger[_0x7732('0xd')](_0x7732('0x5d'),_0x2d5606['id']);return getEndUser(_0x647267,_0x2532c3[_0x7732('0x5e')],_0x2532c3['calleridnum'],_0x1e84bd);})['then'](function(_0x5e4582){_0x1e5dc0=_0x5e4582;logger[_0x7732('0xd')](_0x7732('0x60'),_0x1e5dc0['id']);return getTicket(_0x647267,_0x2d5606,_0x1e5dc0,_0x2c13a1,_0x2532c3,_0x2c13a1['Fields'],_0x1e84bd,_0x7732('0x61'));})[_0x7732('0x31')](function(_0x487f75){_0x17bc41=_0x487f75;logger['info'](_0x7732('0x62'));logger[_0x7732('0xd')]('The\x20Ticket\x20ID\x20is:',_0x17bc41['id']);return setRelationship(_0x1e84bd,_0x2d5606,_0x17bc41,_0x7732('0x77'));})['then'](function(){return setRelationship(_0x1e84bd,_0x1e5dc0,_0x17bc41,_0x7732('0x64'));})[_0x7732('0x31')](function(){return getServerInfo(_0x1e84bd);})[_0x7732('0x6a')](function(_0xbd98b3){logger[_0x7732('0x78')]('['+_0x2532c3[_0x7732('0x75')][_0x7732('0x76')]()+']',JSON[_0x7732('0x24')](_0xbd98b3));});}; \ 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 35b76ae..b0b670a 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 _0x0946=['lastIndexOf','validateEmail','isNil','test','lodash','util','sortBy','length','type','string','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','keyContent','format','%s:\x20%s','join','slice','substring'];(function(_0x2d6566,_0x74d6da){var _0x3ec4c3=function(_0x3e4342){while(--_0x3e4342){_0x2d6566['push'](_0x2d6566['shift']());}};_0x3ec4c3(++_0x74d6da);}(_0x0946,0x163));var _0x6094=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x0946[_0x276468];return _0x36dc3a;};'use strict';var _=require(_0x6094('0x0'));var util=require(_0x6094('0x1'));exports['getString']=function(_0x42d205,_0x1ac5db,_0x1020eb){var _0x36844b=[];if(_0x42d205['length']>0x0){var _0x1c72ac=_[_0x6094('0x2')](_0x42d205,['id']);for(var _0x599f74=0x0;_0x599f74<_0x1c72ac[_0x6094('0x3')];_0x599f74++){var _0x55c4fb=_0x1c72ac[_0x599f74];if(_0x55c4fb[_0x6094('0x4')]===_0x6094('0x5')){_0x36844b['push'](_0x55c4fb['content']);}else if(_0x55c4fb[_0x6094('0x4')]===_0x6094('0x6')&&_0x55c4fb[_0x6094('0x7')]){_0x1ac5db[_0x55c4fb['variableName']]&&_0x36844b[_0x6094('0x8')](_0x1ac5db[_0x55c4fb[_0x6094('0x7')]][_0x6094('0x9')]());}else if(_0x55c4fb[_0x6094('0x4')]===_0x6094('0xa')&&_0x55c4fb[_0x6094('0xb')]&&_0x55c4fb[_0x6094('0xb')][_0x6094('0xc')]){_0x1ac5db[_0x55c4fb[_0x6094('0xb')]['name'][_0x6094('0xd')]()]&&_0x36844b[_0x6094('0x8')](_0x1ac5db[_0x55c4fb[_0x6094('0xb')]['name'][_0x6094('0xd')]()][_0x6094('0x9')]());}else if(_0x55c4fb[_0x6094('0x4')]===_0x6094('0xe')){if(_0x55c4fb[_0x6094('0xf')]===_0x6094('0x5')&&_0x55c4fb[_0x6094('0x10')]){_0x36844b[_0x6094('0x8')](util['format']('%s:\x20%s',_0x55c4fb[_0x6094('0x10')],_0x55c4fb[_0x6094('0x11')]));}else if(_0x55c4fb[_0x6094('0xf')]===_0x6094('0x6')&&_0x55c4fb[_0x6094('0x7')]&&_0x55c4fb[_0x6094('0x10')]){_0x1ac5db[_0x55c4fb[_0x6094('0x7')]]&&_0x36844b[_0x6094('0x8')](util[_0x6094('0x12')](_0x6094('0x13'),_0x55c4fb['key'],_0x1ac5db[_0x55c4fb['variableName']]));}else if(_0x55c4fb[_0x6094('0xf')]===_0x6094('0xa')&&_0x55c4fb['Variable']&&_0x55c4fb[_0x6094('0xb')]['name']&&_0x55c4fb['key']){_0x1ac5db[_0x55c4fb['Variable'][_0x6094('0xc')][_0x6094('0xd')]()]&&_0x36844b[_0x6094('0x8')](util[_0x6094('0x12')](_0x6094('0x13'),_0x55c4fb[_0x6094('0x10')],_0x1ac5db[_0x55c4fb[_0x6094('0xb')][_0x6094('0xc')][_0x6094('0xd')]()]));}}}}return _0x36844b[_0x6094('0x14')](_0x1020eb);};exports['stripTrailingSlash']=function(_0x32e1ca){var _0x42e26b=_0x32e1ca[_0x6094('0x15')](-0x1);if(_0x42e26b==='/'){_0x32e1ca=_0x32e1ca[_0x6094('0x16')](0x0,_0x32e1ca[_0x6094('0x17')](_0x42e26b));}return _0x32e1ca;};exports[_0x6094('0x18')]=function(_0x496bc8){if(!_[_0x6094('0x19')](_0x496bc8)&&_0x496bc8!==''){var _0x52ea3c=/^(([^<>()\[\]\\.,;:\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 _0x52ea3c[_0x6094('0x1a')](String(_0x496bc8)[_0x6094('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xe7da=['substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','%s:\x20%s','format','join','stripTrailingSlash'];(function(_0x151045,_0x1affb8){var _0xbff17c=function(_0x36460d){while(--_0x36460d){_0x151045['push'](_0x151045['shift']());}};_0xbff17c(++_0x1affb8);}(_0xe7da,0x171));var _0xae7d=function(_0x592f23,_0x128334){_0x592f23=_0x592f23-0x0;var _0x3afb4e=_0xe7da[_0x592f23];return _0x3afb4e;};'use strict';var _=require(_0xae7d('0x0'));var util=require(_0xae7d('0x1'));exports[_0xae7d('0x2')]=function(_0x2d326d,_0x5dd398,_0x192994){var _0x4c5365=[];if(_0x2d326d[_0xae7d('0x3')]>0x0){var _0x16e32b=_['sortBy'](_0x2d326d,['id']);for(var _0x5bb0cc=0x0;_0x5bb0cc<_0x16e32b['length'];_0x5bb0cc++){var _0x34a8f5=_0x16e32b[_0x5bb0cc];if(_0x34a8f5[_0xae7d('0x4')]===_0xae7d('0x5')){_0x4c5365[_0xae7d('0x6')](_0x34a8f5[_0xae7d('0x7')]);}else if(_0x34a8f5[_0xae7d('0x4')]===_0xae7d('0x8')&&_0x34a8f5[_0xae7d('0x9')]){_0x5dd398[_0x34a8f5[_0xae7d('0x9')]]&&_0x4c5365[_0xae7d('0x6')](_0x5dd398[_0x34a8f5[_0xae7d('0x9')]][_0xae7d('0xa')]());}else if(_0x34a8f5[_0xae7d('0x4')]===_0xae7d('0xb')&&_0x34a8f5['Variable']&&_0x34a8f5[_0xae7d('0xc')][_0xae7d('0xd')]){_0x5dd398[_0x34a8f5['Variable']['name'][_0xae7d('0xe')]()]&&_0x4c5365['push'](_0x5dd398[_0x34a8f5[_0xae7d('0xc')]['name'][_0xae7d('0xe')]()][_0xae7d('0xa')]());}else if(_0x34a8f5[_0xae7d('0x4')]==='keyValue'){if(_0x34a8f5[_0xae7d('0xf')]===_0xae7d('0x5')&&_0x34a8f5[_0xae7d('0x10')]){_0x4c5365[_0xae7d('0x6')](util['format'](_0xae7d('0x11'),_0x34a8f5[_0xae7d('0x10')],_0x34a8f5['keyContent']));}else if(_0x34a8f5['keyType']===_0xae7d('0x8')&&_0x34a8f5[_0xae7d('0x9')]&&_0x34a8f5[_0xae7d('0x10')]){_0x5dd398[_0x34a8f5[_0xae7d('0x9')]]&&_0x4c5365['push'](util['format'](_0xae7d('0x11'),_0x34a8f5['key'],_0x5dd398[_0x34a8f5['variableName']]));}else if(_0x34a8f5[_0xae7d('0xf')]===_0xae7d('0xb')&&_0x34a8f5['Variable']&&_0x34a8f5[_0xae7d('0xc')][_0xae7d('0xd')]&&_0x34a8f5[_0xae7d('0x10')]){_0x5dd398[_0x34a8f5[_0xae7d('0xc')][_0xae7d('0xd')][_0xae7d('0xe')]()]&&_0x4c5365['push'](util[_0xae7d('0x12')](_0xae7d('0x11'),_0x34a8f5[_0xae7d('0x10')],_0x5dd398[_0x34a8f5[_0xae7d('0xc')]['name'][_0xae7d('0xe')]()]));}}}}return _0x4c5365[_0xae7d('0x13')](_0x192994);};exports[_0xae7d('0x14')]=function(_0x19aab9){var _0x5c28fc=_0x19aab9['slice'](-0x1);if(_0x5c28fc==='/'){_0x19aab9=_0x19aab9[_0xae7d('0x15')](0x0,_0x19aab9[_0xae7d('0x16')](_0x5c28fc));}return _0x19aab9;};exports[_0xae7d('0x17')]=function(_0x317e69){if(!_[_0xae7d('0x18')](_0x317e69)&&_0x317e69!==''){var _0x8aa7a9=/^(([^<>()\[\]\\.,;:\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 _0x8aa7a9[_0xae7d('0x19')](String(_0x317e69)[_0xae7d('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 63c9df3..34bfdcc 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x418cd3,_0x221e00){var _0x356a7c=function(_0x1e812e){while(--_0x1e812e){_0x418cd3['push'](_0x418cd3['shift']());}};_0x356a7c(++_0x221e00);}(_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 diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 035f92d..a0a3bf3 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 _0x93d6=['map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','custom_fields','variable','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','Authorization','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','POST','[OUTBOUND]','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','length'];(function(_0x40e082,_0x48e38c){var _0x174e4f=function(_0x3b6acd){while(--_0x3b6acd){_0x40e082['push'](_0x40e082['shift']());}};_0x174e4f(++_0x48e38c);}(_0x93d6,0x19c));var _0x693d=function(_0xfc600d,_0x42c951){_0xfc600d=_0xfc600d-0x0;var _0xae26d6=_0x93d6[_0xfc600d];return _0xae26d6;};'use strict';var _=require(_0x693d('0x0'));var rp=require(_0x693d('0x1'));var md5=require(_0x693d('0x2'));var util=require(_0x693d('0x3'));var Redis=require(_0x693d('0x4'));var intUtil=require('./util');var config=require(_0x693d('0x5'));var logger=require(_0x693d('0x6'))(_0x693d('0x7'));config[_0x693d('0x8')]=_[_0x693d('0x9')](config[_0x693d('0x8')],{'host':_0x693d('0xa'),'port':0x18eb});var io=require(_0x693d('0xb'))(new Redis(config[_0x693d('0x8')]));function emit(_0x3b5e69,_0x44b4ec,_0x4844d2){io['to'](_0x3b5e69)['emit'](_0x44b4ec,_0x4844d2);}var headers={'Content-Type':_0x693d('0xc'),'Accept':_0x693d('0xc')};function getTicket(_0x2207c8,_0x314713,_0x35d953,_0x29b735,_0xe59afe){logger[_0x693d('0xd')](_0x693d('0xe'));return request({'uri':util[_0x693d('0xf')](_0x693d('0x10'),_0x2207c8[_0x693d('0x11')]),'method':'POST','body':{'ticket':_[_0x693d('0x12')]({'requester_id':_0x35d953['id'],'submitter_id':_0x314713?_0x314713['id']:undefined,'assignee_id':_0x314713?_0x314713['id']:undefined,'tags':getTags(_0x29b735[_0x693d('0x13')],'name'),'subject':intUtil[_0x693d('0x14')](_0x29b735[_0x693d('0x15')],_0xe59afe,'\x20'),'description':intUtil[_0x693d('0x14')](_0x29b735[_0x693d('0x16')],_0xe59afe,'\x0a'),'comment':{'public':![],'body':intUtil[_0x693d('0x14')](_0x29b735[_0x693d('0x16')],_0xe59afe,'\x0a')}},getCustomFields(_0x29b735[_0x693d('0x17')],_0xe59afe))}})[_0x693d('0x18')](function(_0x139d1b){logger[_0x693d('0xd')](_0x693d('0x19'));return _0x139d1b[_0x693d('0x1a')];});}function getUser(_0xe02afd,_0xb6892c){if(intUtil[_0x693d('0x1b')](_0xb6892c)){logger['info']('Getting\x20agent\x20with\x20email',_0xb6892c);return request({'uri':util[_0x693d('0xf')](_0x693d('0x1c'),_0xe02afd[_0x693d('0x11')]),'qs':{'query':util[_0x693d('0xf')](_0x693d('0x1d'),_0xb6892c)}})[_0x693d('0x18')](function(_0xe57e83){if(_0xe57e83[_0x693d('0x1e')]){logger['info'](_0x693d('0x1f'));return _['find'](_0xe57e83[_0x693d('0x20')],{'email':_0xb6892c,'role':'agent'});}else{logger['info'](_0x693d('0x21'));return request({'uri':util[_0x693d('0xf')](_0x693d('0x22'),_0xe02afd[_0x693d('0x11')])})[_0x693d('0x18')](function(_0x1935af){logger['info'](_0x693d('0x23'));return _0x1935af[_0x693d('0x24')];});}});}else{logger[_0x693d('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x693d('0xf')](_0x693d('0x22'),_0xe02afd[_0x693d('0x11')])})[_0x693d('0x18')](function(_0x1c861a){logger['info'](_0x693d('0x23'));return _0x1c861a['user'];});}}function getEndUser(_0xe93aa,_0x30d526,_0x32b36b){logger[_0x693d('0xd')](_0x693d('0x25'),_0x32b36b);return request({'uri':util[_0x693d('0xf')](_0x693d('0x1c'),_0xe93aa[_0x693d('0x11')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x32b36b)}})[_0x693d('0x18')](function(_0x368945){var _0x5651de;if(_0x368945['results']['length']){_0x368945[_0x693d('0x20')]=_[_0x693d('0x26')](_0x368945[_0x693d('0x20')],{'suspended':![],'role':_0x693d('0x27')});if(_0x368945[_0x693d('0x20')]['length']){_0x5651de=_[_0x693d('0x28')](_0x368945['results']);}}if(_0x5651de){logger['info'](_0x693d('0x29'));return _0x5651de;}else{logger[_0x693d('0xd')](_0x693d('0x2a'));return request({'uri':util[_0x693d('0xf')](_0x693d('0x2b'),_0xe93aa[_0x693d('0x11')]),'method':'POST','body':{'user':{'role':_0x693d('0x27'),'name':util[_0x693d('0xf')](_0x693d('0x2c'),_0x30d526||_0x32b36b),'phone':_0x32b36b}}})['then'](function(_0x5d723f){logger[_0x693d('0xd')](_0x693d('0x2d'));return _0x5d723f[_0x693d('0x24')];});}});}function getAuth(_0x353b8a){var _0x460ed3;if(_0x353b8a[_0x693d('0x2e')]===_0x693d('0x2f')){_0x460ed3=util['format'](_0x693d('0x30'),_0x353b8a['username'],_0x353b8a[_0x693d('0x2f')]);}else if(_0x353b8a['authType']===_0x693d('0x31')){_0x460ed3=util[_0x693d('0xf')](_0x693d('0x32'),_0x353b8a[_0x693d('0x33')],_0x353b8a[_0x693d('0x31')]);}return util[_0x693d('0xf')](_0x693d('0x34'),new Buffer(_0x460ed3)[_0x693d('0x35')](_0x693d('0x36')));}function request(_0x5d7791){logger[_0x693d('0x37')](_0x693d('0x38'),JSON[_0x693d('0x39')](_0x5d7791));return rp(_[_0x693d('0x9')](_0x5d7791,{'method':_0x693d('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x9561a8,_0x4f9d31){var _0x51417b=[];if(_0x9561a8&&_0x9561a8[_0x693d('0x3b')]>0x0){_0x51417b=_[_0x693d('0x3c')](_0x9561a8,_0x4f9d31);}return _0x51417b;}function getCustomFields(_0x108f3a,_0x42b280){var _0x5984bc=[];var _0x2e00be={'custom_fields':[]};if(_0x108f3a[_0x693d('0x3b')]>0x0){_[_0x693d('0x3d')](_0x108f3a,function(_0x4e98c0){if(_['includes']([_0x693d('0x3e'),_0x693d('0x3f')],_0x4e98c0[_0x693d('0x40')])&&_0x4e98c0[_0x693d('0x41')]&&!_0x4e98c0[_0x693d('0x42')]){_0x2e00be[_0x4e98c0[_0x693d('0x41')][_0x693d('0x43')]()]=_0x4e98c0[_0x693d('0x44')][_0x693d('0x35')]();}else if(_[_0x693d('0x45')](['string',_0x693d('0x3f')],_0x4e98c0['type'])&&_0x4e98c0[_0x693d('0x46')]&&_0x4e98c0[_0x693d('0x42')]){_0x2e00be[_0x693d('0x47')]['push']({'id':_0x4e98c0[_0x693d('0x46')],'value':_0x4e98c0[_0x693d('0x44')][_0x693d('0x35')]()});}else if(_0x4e98c0['type']===_0x693d('0x48')&&_0x4e98c0[_0x693d('0x49')]&&_0x4e98c0[_0x693d('0x46')]&&_0x4e98c0[_0x693d('0x42')]){_0x42b280[_0x4e98c0[_0x693d('0x49')]]&&_0x2e00be[_0x693d('0x47')][_0x693d('0x4a')]({'id':_0x4e98c0['idField'],'value':_0x42b280[_0x4e98c0['variableName']][_0x693d('0x35')]()});}else if(_0x4e98c0['type']===_0x693d('0x4b')&&_0x4e98c0[_0x693d('0x4c')]&&_0x4e98c0[_0x693d('0x4c')][_0x693d('0x4d')]&&_0x4e98c0[_0x693d('0x46')]&&_0x4e98c0[_0x693d('0x42')]){_0x42b280[_0x4e98c0['Variable'][_0x693d('0x4d')][_0x693d('0x43')]()]&&_0x2e00be[_0x693d('0x47')]['push']({'id':_0x4e98c0['idField'],'value':_0x42b280[_0x4e98c0['Variable'][_0x693d('0x4d')][_0x693d('0x43')]()][_0x693d('0x35')]()});}});}return _0x2e00be;}exports[_0x693d('0x4e')]=function(_0x1cb3e9,_0x1fb4d7,_0x49bef1,_0x5c8077,_0x246e2f,_0x2517f6){var _0x4fdf95,_0x463190;_0x2517f6[_0x693d('0x11')]=intUtil[_0x693d('0x4f')](_0x2517f6['remoteUri']);_0x2517f6['serverUrl']=intUtil[_0x693d('0x4f')](_0x2517f6[_0x693d('0x50')]);if(_0x246e2f&&_0x246e2f['monitor_format']){logger[_0x693d('0xd')](_0x693d('0x51'),'Recording\x20is\x20enabled!');_0x1fb4d7['recordingURL']=util['format'](_0x693d('0x52'),_0x2517f6[_0x693d('0x50')],_0x1fb4d7[_0x693d('0x53')],md5(_0x1fb4d7[_0x693d('0x53')]));}else{_0x1fb4d7[_0x693d('0x54')]='';}headers['Authorization']=getAuth(_0x2517f6);return getUser(_0x2517f6,_0x5c8077['email'])[_0x693d('0x18')](function(_0x54a224){_0x4fdf95=_0x54a224;logger[_0x693d('0xd')](_0x693d('0x55'),_0x4fdf95['id']);return getEndUser(_0x2517f6,_0x1fb4d7['calleridname'],_0x1fb4d7[_0x693d('0x56')]);})[_0x693d('0x18')](function(_0x13aca7){_0x463190=_0x13aca7;logger[_0x693d('0xd')]('The\x20Enduser\x20ID\x20is:',_0x463190['id']);return getTicket(_0x2517f6,_0x4fdf95,_0x463190,_0x49bef1,_0x1fb4d7);})[_0x693d('0x18')](function(_0x3cd03b){if(_0x3cd03b){logger[_0x693d('0xd')](_0x693d('0x57'),_0x3cd03b['id']);switch(_0x2517f6[_0x693d('0x40')]){case'integrationTab':logger[_0x693d('0xd')](_0x693d('0x51'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x693d('0x58'),_0x2517f6[_0x693d('0x11')],_0x4fdf95['id'],_0x3cd03b['id']),'method':'POST'});case _0x693d('0x59'):logger[_0x693d('0xd')](_0x693d('0x51'),_0x693d('0x5a'));emit(util[_0x693d('0xf')]('user:%s',_0x5c8077['name']),_0x693d('0x5b'),{'uri':util[_0x693d('0xf')]('%s/agent/tickets/%s',_0x2517f6[_0x693d('0x11')][_0x693d('0x5c')](_0x693d('0x5d'),''),_0x3cd03b['id'])});break;default:logger['error']('[QUEUE]',_0x693d('0x5e'));}}})[_0x693d('0x5f')](function(_0xd5a450){logger[_0x693d('0x60')](_0x693d('0x61'),util[_0x693d('0x62')](_0xd5a450,{'showHidden':!![],'depth':null}));});};exports[_0x693d('0x63')]=function(_0x48742b,_0x194360,_0x13a51d,_0x1bd803,_0x5a5487,_0xc3d8e8,_0x29c598){var _0x5af64f,_0x4828d5;_0xc3d8e8['remoteUri']=intUtil[_0x693d('0x4f')](_0xc3d8e8['remoteUri']);_0xc3d8e8[_0x693d('0x50')]=intUtil[_0x693d('0x4f')](_0xc3d8e8[_0x693d('0x50')]);if(_0x29c598&&_0x29c598[_0x693d('0x64')]&&_0x29c598[_0x693d('0x64')]!==_0x693d('0x65')){logger[_0x693d('0xd')]('[OUTBOUND]',_0x693d('0x66'));_0x194360[_0x693d('0x54')]=util[_0x693d('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc3d8e8[_0x693d('0x50')],_0x194360['uniqueid'],md5(_0x194360[_0x693d('0x53')]));}headers[_0x693d('0x67')]=getAuth(_0xc3d8e8);return getUser(_0xc3d8e8,_0x1bd803[_0x693d('0x68')])[_0x693d('0x18')](function(_0x291de3){_0x5af64f=_0x291de3;logger[_0x693d('0xd')](_0x693d('0x55'),_0x5af64f['id']);return getEndUser(_0xc3d8e8,_0x194360[_0x693d('0x69')],_0x194360[_0x693d('0x6a')]);})[_0x693d('0x18')](function(_0x2b60d9){_0x4828d5=_0x2b60d9;logger[_0x693d('0xd')](_0x693d('0x6b'),_0x4828d5['id']);return getTicket(_0xc3d8e8,_0x5af64f,_0x4828d5,_0x13a51d,_0x194360);})['then'](function(_0x1472cc){if(_0x1472cc){logger['info'](_0x693d('0x57'),_0x1472cc['id']);switch(_0xc3d8e8[_0x693d('0x40')]){case _0x693d('0x6c'):logger[_0x693d('0xd')]('[OUTBOUND]',_0x693d('0x6d'));return request({'uri':util[_0x693d('0xf')](_0x693d('0x58'),_0xc3d8e8[_0x693d('0x11')],_0x5af64f['id'],_0x1472cc['id']),'method':_0x693d('0x6e')});case _0x693d('0x59'):logger[_0x693d('0xd')](_0x693d('0x6f'),_0x693d('0x5a'));emit(util[_0x693d('0xf')]('user:%s',_0x1bd803[_0x693d('0x4d')]),_0x693d('0x5b'),{'uri':util[_0x693d('0xf')]('%s/agent/tickets/%s',_0xc3d8e8['remoteUri'][_0x693d('0x5c')]('/api/v2',''),_0x1472cc['id'])});break;default:logger[_0x693d('0x60')](_0x693d('0x6f'),_0x693d('0x5e'));}}})[_0x693d('0x5f')](function(_0xaf33b){logger[_0x693d('0x60')](_0x693d('0x70'),util[_0x693d('0x62')](_0xaf33b,{'showHidden':!![],'depth':null}));});};exports[_0x693d('0x71')]=function(_0x42472d,_0x1cb86c,_0x582ecd,_0x5aa307,_0x25fe86,_0x5d4034){var _0x5bd2b3,_0x5cc1df;_0x5d4034[_0x693d('0x11')]=intUtil[_0x693d('0x4f')](_0x5d4034['remoteUri']);_0x5d4034[_0x693d('0x50')]=intUtil['stripTrailingSlash'](_0x5d4034[_0x693d('0x50')]);if(_0x25fe86&&_0x25fe86[_0x693d('0x72')]){logger[_0x693d('0xd')]('['+_0x1cb86c['lastevent'][_0x693d('0x73')]()+']',_0x693d('0x66'));_0x1cb86c[_0x693d('0x54')]=util['format'](_0x693d('0x52'),_0x5d4034['serverUrl'],_0x1cb86c[_0x693d('0x53')],md5(_0x1cb86c['uniqueid']));}else{_0x1cb86c[_0x693d('0x54')]='';}headers[_0x693d('0x67')]=getAuth(_0x5d4034);return getUser(_0x5d4034)[_0x693d('0x18')](function(_0x5b2bb7){_0x5bd2b3=_0x5b2bb7;logger[_0x693d('0xd')]('The\x20User\x20ID\x20is:',_0x5bd2b3['id']);return getEndUser(_0x5d4034,_0x1cb86c[_0x693d('0x74')],_0x1cb86c[_0x693d('0x56')]);})['then'](function(_0x2b4722){_0x5cc1df=_0x2b4722;logger[_0x693d('0xd')](_0x693d('0x6b'),_0x5cc1df['id']);return getTicket(_0x5d4034,_0x5bd2b3,_0x5cc1df,_0x582ecd,_0x1cb86c);})[_0x693d('0x18')](function(_0xf713fb){if(_0xf713fb){logger[_0x693d('0xd')](_0x693d('0x57'),_0xf713fb['id']);}})[_0x693d('0x5f')](function(_0xd55bd2){logger[_0x693d('0x60')]('['+_0x1cb86c[_0x693d('0x75')][_0x693d('0x73')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0xd55bd2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0222=['content','picklist','idField','push','variable','variableName','custom_fields','customVariable','Variable','toLowerCase','serverUrl','[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:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','stripTrailingSlash','recordingFormat','none','destcalleridname','[OUTBOUND]','/api/v2','catch','toUpperCase','Recording\x20is\x20enabled!','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','password','%s:%s','username','authType','token','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','includes','string','type','nameField','customField'];(function(_0x54cfcf,_0x3ecf5b){var _0x1c2060=function(_0x484a41){while(--_0x484a41){_0x54cfcf['push'](_0x54cfcf['shift']());}};_0x1c2060(++_0x3ecf5b);}(_0x0222,0x1ec));var _0x2022=function(_0x285723,_0x2c0b04){_0x285723=_0x285723-0x0;var _0x172e0a=_0x0222[_0x285723];return _0x172e0a;};'use strict';var _=require(_0x2022('0x0'));var rp=require(_0x2022('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x2022('0x2'));var intUtil=require('./util');var config=require(_0x2022('0x3'));var logger=require(_0x2022('0x4'))(_0x2022('0x5'));config[_0x2022('0x6')]=_['defaults'](config['redis'],{'host':_0x2022('0x7'),'port':0x18eb});var io=require(_0x2022('0x8'))(new Redis(config['redis']));function emit(_0x1aebfe,_0x941ffd,_0x4d9b57){io['to'](_0x1aebfe)[_0x2022('0x9')](_0x941ffd,_0x4d9b57);}var headers={'Content-Type':'application/json','Accept':_0x2022('0xa')};function getTicket(_0x185a41,_0x8e3836,_0xcec50e,_0x4da4b9,_0x1a5770){logger[_0x2022('0xb')](_0x2022('0xc'));return request({'uri':util[_0x2022('0xd')](_0x2022('0xe'),_0x185a41[_0x2022('0xf')]),'method':'POST','body':{'ticket':_[_0x2022('0x10')]({'requester_id':_0xcec50e['id'],'submitter_id':_0x8e3836?_0x8e3836['id']:undefined,'assignee_id':_0x8e3836?_0x8e3836['id']:undefined,'tags':getTags(_0x4da4b9[_0x2022('0x11')],_0x2022('0x12')),'subject':intUtil[_0x2022('0x13')](_0x4da4b9[_0x2022('0x14')],_0x1a5770,'\x20'),'description':intUtil[_0x2022('0x13')](_0x4da4b9['Descriptions'],_0x1a5770,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2022('0x13')](_0x4da4b9[_0x2022('0x15')],_0x1a5770,'\x0a')}},getCustomFields(_0x4da4b9[_0x2022('0x16')],_0x1a5770))}})[_0x2022('0x17')](function(_0x53ec54){logger[_0x2022('0xb')](_0x2022('0x18'));return _0x53ec54[_0x2022('0x19')];});}function getUser(_0x4259b7,_0x1ddd90){if(intUtil['validateEmail'](_0x1ddd90)){logger[_0x2022('0xb')](_0x2022('0x1a'),_0x1ddd90);return request({'uri':util[_0x2022('0xd')](_0x2022('0x1b'),_0x4259b7[_0x2022('0xf')]),'qs':{'query':util[_0x2022('0xd')](_0x2022('0x1c'),_0x1ddd90)}})[_0x2022('0x17')](function(_0x12a293){if(_0x12a293[_0x2022('0x1d')]){logger[_0x2022('0xb')](_0x2022('0x1e'));return _[_0x2022('0x1f')](_0x12a293[_0x2022('0x20')],{'email':_0x1ddd90,'role':_0x2022('0x21')});}else{logger['info'](_0x2022('0x22'));return request({'uri':util[_0x2022('0xd')](_0x2022('0x23'),_0x4259b7[_0x2022('0xf')])})[_0x2022('0x17')](function(_0xd788da){logger[_0x2022('0xb')](_0x2022('0x24'));return _0xd788da[_0x2022('0x25')];});}});}else{logger[_0x2022('0xb')](_0x2022('0x22'));return request({'uri':util[_0x2022('0xd')](_0x2022('0x23'),_0x4259b7[_0x2022('0xf')])})[_0x2022('0x17')](function(_0x30aca6){logger[_0x2022('0xb')](_0x2022('0x24'));return _0x30aca6[_0x2022('0x25')];});}}function getEndUser(_0x3e3d24,_0x2127f7,_0x2fc019){logger['info']('Searching\x20enduser\x20with\x20phone',_0x2fc019);return request({'uri':util[_0x2022('0xd')](_0x2022('0x1b'),_0x3e3d24[_0x2022('0xf')]),'qs':{'query':util[_0x2022('0xd')](_0x2022('0x26'),_0x2fc019)}})[_0x2022('0x17')](function(_0x283aab){var _0x55ba79;if(_0x283aab[_0x2022('0x20')][_0x2022('0x27')]){_0x283aab['results']=_[_0x2022('0x28')](_0x283aab[_0x2022('0x20')],{'suspended':![],'role':_0x2022('0x29')});if(_0x283aab[_0x2022('0x20')][_0x2022('0x27')]){_0x55ba79=_['first'](_0x283aab[_0x2022('0x20')]);}}if(_0x55ba79){logger[_0x2022('0xb')](_0x2022('0x2a'));return _0x55ba79;}else{logger[_0x2022('0xb')](_0x2022('0x2b'));return request({'uri':util[_0x2022('0xd')]('%s/users.json',_0x3e3d24[_0x2022('0xf')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x2022('0xd')]('Caller\x20-\x20%s',_0x2127f7||_0x2fc019),'phone':_0x2fc019}}})[_0x2022('0x17')](function(_0x49e8a2){logger['info'](_0x2022('0x2c'));return _0x49e8a2['user'];});}});}function getAuth(_0x2e183e){var _0x127135;if(_0x2e183e['authType']===_0x2022('0x2d')){_0x127135=util['format'](_0x2022('0x2e'),_0x2e183e[_0x2022('0x2f')],_0x2e183e[_0x2022('0x2d')]);}else if(_0x2e183e[_0x2022('0x30')]===_0x2022('0x31')){_0x127135=util[_0x2022('0xd')]('%s/token:%s',_0x2e183e[_0x2022('0x2f')],_0x2e183e['token']);}return util[_0x2022('0xd')]('Basic\x20%s',new Buffer(_0x127135)[_0x2022('0x32')](_0x2022('0x33')));}function request(_0xb1e9cf){logger[_0x2022('0x34')](_0x2022('0x35'),JSON[_0x2022('0x36')](_0xb1e9cf));return rp(_[_0x2022('0x37')](_0xb1e9cf,{'method':_0x2022('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x381632,_0x1f81e1){var _0x4077b1=[];if(_0x381632&&_0x381632[_0x2022('0x27')]>0x0){_0x4077b1=_[_0x2022('0x39')](_0x381632,_0x1f81e1);}return _0x4077b1;}function getCustomFields(_0x2adade,_0x12b2bc){var _0x3f759b=[];var _0x2e646e={'custom_fields':[]};if(_0x2adade[_0x2022('0x27')]>0x0){_['forEach'](_0x2adade,function(_0x224ca7){if(_[_0x2022('0x3a')]([_0x2022('0x3b'),'picklist'],_0x224ca7[_0x2022('0x3c')])&&_0x224ca7[_0x2022('0x3d')]&&!_0x224ca7[_0x2022('0x3e')]){_0x2e646e[_0x224ca7['nameField']['toLowerCase']()]=_0x224ca7[_0x2022('0x3f')][_0x2022('0x32')]();}else if(_[_0x2022('0x3a')]([_0x2022('0x3b'),_0x2022('0x40')],_0x224ca7[_0x2022('0x3c')])&&_0x224ca7[_0x2022('0x41')]&&_0x224ca7[_0x2022('0x3e')]){_0x2e646e['custom_fields'][_0x2022('0x42')]({'id':_0x224ca7['idField'],'value':_0x224ca7['content'][_0x2022('0x32')]()});}else if(_0x224ca7[_0x2022('0x3c')]===_0x2022('0x43')&&_0x224ca7[_0x2022('0x44')]&&_0x224ca7[_0x2022('0x41')]&&_0x224ca7[_0x2022('0x3e')]){_0x12b2bc[_0x224ca7[_0x2022('0x44')]]&&_0x2e646e[_0x2022('0x45')][_0x2022('0x42')]({'id':_0x224ca7[_0x2022('0x41')],'value':_0x12b2bc[_0x224ca7[_0x2022('0x44')]]['toString']()});}else if(_0x224ca7[_0x2022('0x3c')]===_0x2022('0x46')&&_0x224ca7['Variable']&&_0x224ca7['Variable']['name']&&_0x224ca7[_0x2022('0x41')]&&_0x224ca7[_0x2022('0x3e')]){_0x12b2bc[_0x224ca7[_0x2022('0x47')]['name'][_0x2022('0x48')]()]&&_0x2e646e[_0x2022('0x45')][_0x2022('0x42')]({'id':_0x224ca7[_0x2022('0x41')],'value':_0x12b2bc[_0x224ca7[_0x2022('0x47')][_0x2022('0x12')][_0x2022('0x48')]()]['toString']()});}});}return _0x2e646e;}exports['queue']=function(_0x1583c4,_0x19e518,_0x12b1e6,_0x145a6c,_0x2ca082,_0x31eae5){var _0x1e0c03,_0x2bc8ad;_0x31eae5[_0x2022('0xf')]=intUtil['stripTrailingSlash'](_0x31eae5[_0x2022('0xf')]);_0x31eae5['serverUrl']=intUtil['stripTrailingSlash'](_0x31eae5[_0x2022('0x49')]);if(_0x2ca082&&_0x2ca082['monitor_format']){logger[_0x2022('0xb')](_0x2022('0x4a'),'Recording\x20is\x20enabled!');_0x19e518[_0x2022('0x4b')]=util[_0x2022('0xd')](_0x2022('0x4c'),_0x31eae5[_0x2022('0x49')],_0x19e518[_0x2022('0x4d')],md5(_0x19e518[_0x2022('0x4d')]));}else{_0x19e518[_0x2022('0x4b')]='';}headers[_0x2022('0x4e')]=getAuth(_0x31eae5);return getUser(_0x31eae5,_0x145a6c[_0x2022('0x4f')])['then'](function(_0x2b531b){_0x1e0c03=_0x2b531b;logger['info'](_0x2022('0x50'),_0x1e0c03['id']);return getEndUser(_0x31eae5,_0x19e518[_0x2022('0x51')],_0x19e518[_0x2022('0x52')]);})[_0x2022('0x17')](function(_0x40639b){_0x2bc8ad=_0x40639b;logger[_0x2022('0xb')](_0x2022('0x53'),_0x2bc8ad['id']);return getTicket(_0x31eae5,_0x1e0c03,_0x2bc8ad,_0x12b1e6,_0x19e518);})['then'](function(_0x1ac68d){if(_0x1ac68d){logger[_0x2022('0xb')](_0x2022('0x54'),_0x1ac68d['id']);switch(_0x31eae5[_0x2022('0x3c')]){case _0x2022('0x55'):logger[_0x2022('0xb')](_0x2022('0x4a'),_0x2022('0x56'));return request({'uri':util['format'](_0x2022('0x57'),_0x31eae5['remoteUri'],_0x1e0c03['id'],_0x1ac68d['id']),'method':_0x2022('0x58')});case _0x2022('0x59'):logger['info'](_0x2022('0x4a'),_0x2022('0x5a'));emit(util['format'](_0x2022('0x5b'),_0x145a6c[_0x2022('0x12')]),_0x2022('0x5c'),{'uri':util['format'](_0x2022('0x5d'),_0x31eae5[_0x2022('0xf')][_0x2022('0x5e')]('/api/v2',''),_0x1ac68d['id'])});break;default:logger[_0x2022('0x5f')]('[QUEUE]',_0x2022('0x60'));}}})['catch'](function(_0x2dbbfb){logger[_0x2022('0x5f')](_0x2022('0x61'),util[_0x2022('0x62')](_0x2dbbfb,{'showHidden':!![],'depth':null}));});};exports[_0x2022('0x63')]=function(_0x2dd757,_0x53e017,_0x2d5890,_0x175eb5,_0x2aff37,_0x1bd304,_0x12d83c){var _0x29ca5d,_0x217974;_0x1bd304[_0x2022('0xf')]=intUtil[_0x2022('0x64')](_0x1bd304[_0x2022('0xf')]);_0x1bd304[_0x2022('0x49')]=intUtil[_0x2022('0x64')](_0x1bd304[_0x2022('0x49')]);if(_0x12d83c&&_0x12d83c[_0x2022('0x65')]&&_0x12d83c[_0x2022('0x65')]!==_0x2022('0x66')){logger[_0x2022('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x53e017[_0x2022('0x4b')]=util[_0x2022('0xd')](_0x2022('0x4c'),_0x1bd304['serverUrl'],_0x53e017[_0x2022('0x4d')],md5(_0x53e017[_0x2022('0x4d')]));}headers[_0x2022('0x4e')]=getAuth(_0x1bd304);return getUser(_0x1bd304,_0x175eb5['email'])[_0x2022('0x17')](function(_0x2fca20){_0x29ca5d=_0x2fca20;logger['info'](_0x2022('0x50'),_0x29ca5d['id']);return getEndUser(_0x1bd304,_0x53e017[_0x2022('0x67')],_0x53e017['destcalleridnum']);})[_0x2022('0x17')](function(_0x1a0af9){_0x217974=_0x1a0af9;logger['info'](_0x2022('0x53'),_0x217974['id']);return getTicket(_0x1bd304,_0x29ca5d,_0x217974,_0x2d5890,_0x53e017);})[_0x2022('0x17')](function(_0x2c719e){if(_0x2c719e){logger[_0x2022('0xb')](_0x2022('0x54'),_0x2c719e['id']);switch(_0x1bd304['type']){case'integrationTab':logger[_0x2022('0xb')](_0x2022('0x68'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x2022('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1bd304[_0x2022('0xf')],_0x29ca5d['id'],_0x2c719e['id']),'method':_0x2022('0x58')});case'newTab':logger[_0x2022('0xb')]('[OUTBOUND]',_0x2022('0x5a'));emit(util[_0x2022('0xd')]('user:%s',_0x175eb5[_0x2022('0x12')]),_0x2022('0x5c'),{'uri':util['format'](_0x2022('0x5d'),_0x1bd304['remoteUri'][_0x2022('0x5e')](_0x2022('0x69'),''),_0x2c719e['id'])});break;default:logger['error'](_0x2022('0x68'),_0x2022('0x60'));}}})[_0x2022('0x6a')](function(_0x6bafc7){logger[_0x2022('0x5f')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2022('0x62')](_0x6bafc7,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1bace7,_0x190fcf,_0x268c8d,_0x3eda66,_0x3b4d19,_0x588a32){var _0x2cd90f,_0x485f82;_0x588a32[_0x2022('0xf')]=intUtil['stripTrailingSlash'](_0x588a32[_0x2022('0xf')]);_0x588a32[_0x2022('0x49')]=intUtil[_0x2022('0x64')](_0x588a32[_0x2022('0x49')]);if(_0x3b4d19&&_0x3b4d19['monitor_format']){logger[_0x2022('0xb')]('['+_0x190fcf['lastevent'][_0x2022('0x6b')]()+']',_0x2022('0x6c'));_0x190fcf['recordingURL']=util['format'](_0x2022('0x4c'),_0x588a32[_0x2022('0x49')],_0x190fcf['uniqueid'],md5(_0x190fcf[_0x2022('0x4d')]));}else{_0x190fcf[_0x2022('0x4b')]='';}headers[_0x2022('0x4e')]=getAuth(_0x588a32);return getUser(_0x588a32)[_0x2022('0x17')](function(_0x2f3fe3){_0x2cd90f=_0x2f3fe3;logger[_0x2022('0xb')](_0x2022('0x50'),_0x2cd90f['id']);return getEndUser(_0x588a32,_0x190fcf[_0x2022('0x51')],_0x190fcf[_0x2022('0x52')]);})[_0x2022('0x17')](function(_0x44ec07){_0x485f82=_0x44ec07;logger[_0x2022('0xb')](_0x2022('0x53'),_0x485f82['id']);return getTicket(_0x588a32,_0x2cd90f,_0x485f82,_0x268c8d,_0x190fcf);})[_0x2022('0x17')](function(_0x48e871){if(_0x48e871){logger[_0x2022('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48e871['id']);}})[_0x2022('0x6a')](function(_0x4b0e11){logger[_0x2022('0x5f')]('['+_0x190fcf[_0x2022('0x6d')]['toUpperCase']()+']'+_0x2022('0x6e'),util[_0x2022('0x62')](_0x4b0e11,{'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 6146d98..2e126b0 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 _0x9ddd=['agentcalledAt','Call_Type','Inbound','Fields','code','SUCCESS','Call\x20created!','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','[OUTBOUND]','destcalleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lodash','request-promise','util','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','Using\x20the\x20admin\x20account!','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','lead','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','format','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound'];(function(_0x48eb39,_0x2df1c5){var _0xbed037=function(_0x321119){while(--_0x321119){_0x48eb39['push'](_0x48eb39['shift']());}};_0xbed037(++_0x2df1c5);}(_0x9ddd,0xbc));var _0xd9dd=function(_0x20d535,_0x5957e7){_0x20d535=_0x20d535-0x0;var _0x4de6d4=_0x9ddd[_0x20d535];return _0x4de6d4;};'use strict';var _=require(_0xd9dd('0x0'));var rp=require(_0xd9dd('0x1'));var md5=require('md5');var util=require(_0xd9dd('0x2'));var intUtil=require(_0xd9dd('0x3'));var moment=require('moment');var Redis=require(_0xd9dd('0x4'));var BPromise=require('bluebird');var config=require(_0xd9dd('0x5'));var logger=require(_0xd9dd('0x6'))(_0xd9dd('0x7'));config[_0xd9dd('0x8')]=_[_0xd9dd('0x9')](config[_0xd9dd('0x8')],{'host':_0xd9dd('0xa'),'port':0x18eb});var io=require(_0xd9dd('0xb'))(new Redis(config['redis']));function emit(_0x3b3c98,_0x367549,_0x3942b1){io['to'](_0x3b3c98)[_0xd9dd('0xc')](_0x367549,_0x3942b1);}function request(_0x412b94){logger[_0xd9dd('0xd')](_0xd9dd('0xe'),JSON[_0xd9dd('0xf')](_0x412b94));return rp(_0x412b94);}function getCustomFields(_0x42048f,_0x247ef2){var _0x597a7e={};if(_0x42048f['length']>0x0){_['forEach'](_0x42048f,function(_0x18ee89){if(_[_0xd9dd('0x10')]([_0xd9dd('0x11'),_0xd9dd('0x12')],_0x18ee89[_0xd9dd('0x13')])&&_0x18ee89[_0xd9dd('0x14')]){_0x597a7e[_0x18ee89['idField']]=_0x18ee89[_0xd9dd('0x15')][_0xd9dd('0x16')]();}else if(_0x18ee89[_0xd9dd('0x13')]==='variable'&&_0x18ee89[_0xd9dd('0x17')]&&_0x18ee89[_0xd9dd('0x14')]&&_0x247ef2[_0x18ee89['variableName']]){_0x597a7e[_0x18ee89['idField']]=_0x247ef2[_0x18ee89[_0xd9dd('0x17')]][_0xd9dd('0x16')]();}else if(_0x18ee89['type']===_0xd9dd('0x18')&&_0x18ee89[_0xd9dd('0x19')]&&_0x18ee89['Variable'][_0xd9dd('0x1a')]&&_0x18ee89[_0xd9dd('0x14')]&&_0x247ef2[_0x18ee89[_0xd9dd('0x19')][_0xd9dd('0x1a')]['toLowerCase']()]){_0x597a7e[_0x18ee89[_0xd9dd('0x14')]]=_0x247ef2[_0x18ee89[_0xd9dd('0x19')][_0xd9dd('0x1a')][_0xd9dd('0x1b')]()]['toString']();}});}return _0x597a7e;}function getName(_0x463aaf){if(_0x463aaf['indexOf']('\x20')>0x0){var _0x96f376=_0x463aaf[_0xd9dd('0x1c')](/ (.+)/);if(_0x96f376[0x1]){return _0x96f376;}}return[_0x463aaf,_0x463aaf];}var accountsTokens={};function getAccessToken(_0x145c98){return new Promise(function(_0x3f244a,_0x1781fc){if(!_['isNil'](accountsTokens[_0x145c98['id']])&&!_[_0xd9dd('0x1d')](accountsTokens[_0x145c98['id']][_0xd9dd('0x1e')])){if(moment()['isBefore'](accountsTokens[_0x145c98['id']][_0xd9dd('0x1f')])){_0x3f244a(accountsTokens[_0x145c98['id']]['access_token']);}}var _0x2fcdf6;switch(_0x145c98['zone']){case'US':_0x2fcdf6=_0xd9dd('0x20');break;case'AU':_0x2fcdf6=_0xd9dd('0x21');break;case'EU':_0x2fcdf6='https://accounts.zoho.eu';break;case'IN':_0x2fcdf6=_0xd9dd('0x22');break;case'CN':_0x2fcdf6=_0xd9dd('0x23');break;default:_0x2fcdf6='https://accounts.zoho.eu';break;}var _0x565c7c={'method':_0xd9dd('0x24'),'uri':_0x2fcdf6+'/oauth/v2/token','qs':{'refresh_token':_0x145c98[_0xd9dd('0x25')],'client_id':_0x145c98[_0xd9dd('0x26')],'client_secret':_0x145c98[_0xd9dd('0x27')],'grant_type':_0xd9dd('0x28')},'json':!![]};return rp(_0x565c7c)[_0xd9dd('0x29')](function(_0x219715){accountsTokens[_0x145c98['id']]={'access_token':_0x219715[_0xd9dd('0x1e')],'expires_in':moment()[_0xd9dd('0x2a')](_0x219715[_0xd9dd('0x1f')],_0xd9dd('0x2b'))};_0x3f244a(_0x219715[_0xd9dd('0x1e')]);})[_0xd9dd('0x2c')](function(_0x429f6e){logger[_0xd9dd('0x2d')](_0xd9dd('0x2e'),_0x429f6e['stack']);_0x1781fc(_0x429f6e);});});}function getUser(_0x3624c0,_0x543613,_0x9199bc,_0x3bb46f){logger[_0xd9dd('0x2f')](_0xd9dd('0x30'));return request({'method':_0xd9dd('0x31'),'uri':util['format'](_0xd9dd('0x32'),_0x543613),'qs':{'type':_0xd9dd('0x33')},'headers':{'Authorization':_0xd9dd('0x34')+_0x3624c0},'json':!![]})[_0xd9dd('0x29')](function(_0x25ebe8){if(_0x25ebe8[_0xd9dd('0x35')]){var _0x4a2356=-0x1;if(_['isArrayLikeObject'](_0x25ebe8[_0xd9dd('0x35')])){if(!_[_0xd9dd('0x1d')](_0x3bb46f)){_0x4a2356=_[_0xd9dd('0x36')](_0x25ebe8['users'],function(_0x2e83a4){return _0x2e83a4['email']===_0x3bb46f;});}if(_0x4a2356>=0x0){logger[_0xd9dd('0x2f')]('Agent\x20found!');}else{logger[_0xd9dd('0x2f')](_0xd9dd('0x37'));_0x4a2356=_[_0xd9dd('0x36')](_0x25ebe8[_0xd9dd('0x35')],function(_0x352fde){return _0x352fde[_0xd9dd('0x38')][_0xd9dd('0x1a')]==='Administrator';});}return _0x25ebe8['users'][_0x4a2356];}else{if(_0x25ebe8[_0xd9dd('0x39')]['profile']['name']===_0xd9dd('0x3a')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x25ebe8[_0xd9dd('0x39')];return user;}else{logger[_0xd9dd('0x2d')](_0xd9dd('0x3b'),JSON[_0xd9dd('0xf')](_0x25ebe8));throw new Error(_0xd9dd('0x3c')+JSON[_0xd9dd('0xf')](_0x25ebe8));}}}else{logger[_0xd9dd('0x2d')](_0xd9dd('0x3b'),JSON[_0xd9dd('0xf')](_0x25ebe8));throw new Error(_0xd9dd('0x3c')+JSON[_0xd9dd('0xf')](_0x25ebe8));}})[_0xd9dd('0x2c')](function(_0x45a5ec){console[_0xd9dd('0x2d')](_0x45a5ec);});}function getZohoUser(_0x3f5233,_0x8951b4){return new BPromise(function(_0x4c29dc,_0x31d04a){request(_0x3f5233)[_0xd9dd('0x29')](function(_0xe90cda){var _0x116842=null;if(_0xe90cda){_0x116842=_0xe90cda[_0xd9dd('0x3d')][0x0];_0x116842[_0xd9dd('0x3e')]=_0x8951b4;}_0x4c29dc(_0x116842);})[_0xd9dd('0x2c')](function(_0xe8c506){_0x31d04a(_0xe8c506);});});}function createEndUser(_0x183bd2,_0x15c0e9,_0x258ecc,_0x3d1f12,_0x2828bb,_0x3b4168){var _0x258ecc=getName(_0x258ecc);return request({'method':_0xd9dd('0x24'),'uri':_0xd9dd('0x3f')+_0x15c0e9+_0xd9dd('0x40')+_[_0xd9dd('0x41')](_0x3b4168[_0xd9dd('0x42')])+'s','body':{'data':[{'Last_Name':_0x258ecc[0x1],'First_Name':_0x258ecc[0x0],'Phone':_0x3d1f12,'Owner':{'name':!_['isNil'](_0x2828bb[_0xd9dd('0x43')][_0xd9dd('0x1a')])?_0x2828bb['role']['name']:!_[_0xd9dd('0x1d')](_0x2828bb[_0xd9dd('0x44')])?_0x2828bb['first_name']+'\x20'+_0x2828bb[_0xd9dd('0x45')]:_0x2828bb[_0xd9dd('0x45')],'id':_0x2828bb['id']}}]},'headers':{'Authorization':_0xd9dd('0x34')+_0x183bd2},'json':!![]})[_0xd9dd('0x29')](function(_0x4cbbda){if(_0x4cbbda&&_0x4cbbda[_0xd9dd('0x3d')][0x0]['code']==='SUCCESS'){var _0x4cd3bc=_0x4cbbda['data'][0x0][_0xd9dd('0x46')];_0x4cd3bc[_0xd9dd('0x3e')]=_['startCase'](_0x3b4168['moduleCreate'])+'s';return _0x4cd3bc;}logger[_0xd9dd('0x2d')]('The\x20failing\x20result\x20is',JSON[_0xd9dd('0xf')](data));throw new Error(_0xd9dd('0x47')+JSON[_0xd9dd('0xf')](data));})[_0xd9dd('0x2c')](function(_0x30e345){console[_0xd9dd('0x48')](_0xd9dd('0x49'),_0x30e345);});}function getEndUser(_0x4bb37d,_0x56e231,_0xe76b48,_0xc62f00,_0x337877,_0x466bee,_0xfd4e43){var _0xaa9a00={'method':'GET','uri':'','headers':{'Authorization':_0xd9dd('0x34')+_0x4bb37d},'json':!![]};switch(_0xfd4e43[_0xd9dd('0x4a')]){case _0xd9dd('0x4b'):_0xaa9a00[_0xd9dd('0x4c')]=_0xd9dd('0x3f')+_0x56e231+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x337877+'))';return getZohoUser(_0xaa9a00,'Contacts')[_0xd9dd('0x29')](function(_0x123ff2){if(_0x123ff2)return _0x123ff2;_0xaa9a00[_0xd9dd('0x4c')]='https://www.zohoapis.'+_0x56e231+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x337877+'))';return getZohoUser(_0xaa9a00,'Leads')[_0xd9dd('0x29')](function(_0x4d1a82){if(_0x4d1a82)return _0x4d1a82;if(_0xfd4e43[_0xd9dd('0x42')]!=_0xd9dd('0x4d')){return createEndUser(_0x4bb37d,_0x56e231,_0xc62f00,_0x337877,_0x466bee,_0xfd4e43);}else{return{};}});});break;case _0xd9dd('0x4e'):_0xaa9a00['uri']=_0xd9dd('0x3f')+_0x56e231+_0xd9dd('0x4f')+_0x337877+'))';return getZohoUser(_0xaa9a00,_0xd9dd('0x50'))[_0xd9dd('0x29')](function(_0x32d8ec){if(_0x32d8ec)return _0x32d8ec;if(_0xfd4e43[_0xd9dd('0x42')]!='nothing'){return createEndUser(_0x4bb37d,_0x56e231,_0xc62f00,_0x337877,_0x466bee,_0xfd4e43);}else{return{};}});break;case _0xd9dd('0x51'):_0xaa9a00['uri']=_0xd9dd('0x3f')+_0x56e231+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x337877+'))';return getZohoUser(_0xaa9a00,_0xd9dd('0x52'))[_0xd9dd('0x29')](function(_0x47dab5){if(_0x47dab5)return _0x47dab5;if(_0xfd4e43['moduleCreate']!=_0xd9dd('0x4d')){return createEndUser(_0x4bb37d,_0x56e231,_0xc62f00,_0x337877,_0x466bee,_0xfd4e43);}else{return{};}});break;}}function getCall(_0x50a764,_0x204d31,_0x136c6f,_0x3c9327,_0x4e420a,_0x2b6987,_0x4ed49d,_0x34ea){logger[_0xd9dd('0x2f')](_0xd9dd('0x53'));var _0x3820de={};_0x3820de[_0xd9dd('0x54')]={'name':!_[_0xd9dd('0x1d')](_0x3c9327[_0xd9dd('0x43')][_0xd9dd('0x1a')])&&!_[_0xd9dd('0x1d')](_0x3c9327['profile'][_0xd9dd('0x1a')])&&_0x3c9327[_0xd9dd('0x38')][_0xd9dd('0x1a')]===_0xd9dd('0x55')?_0x3c9327[_0xd9dd('0x43')][_0xd9dd('0x1a')]:!_[_0xd9dd('0x1d')](_0x3c9327[_0xd9dd('0x44')])?_0x3c9327['first_name']+'\x20'+_0x3c9327[_0xd9dd('0x45')]:_0x3c9327['last_name'],'id':_0x3c9327['id']};_0x3820de[_0xd9dd('0x56')]=intUtil['getString'](_0x2b6987[_0xd9dd('0x57')],_0x4ed49d,'\x20');_0x3820de[_0xd9dd('0x58')]=intUtil[_0xd9dd('0x59')](_0x2b6987[_0xd9dd('0x5a')],_0x4ed49d,'\x0a');if(_0x4e420a[_0xd9dd('0x3e')]===_0xd9dd('0x50')){_0x3820de[_0xd9dd('0x5b')]={'name':!_[_0xd9dd('0x1d')](_0x4e420a[_0xd9dd('0x5c')])?_0x4e420a[_0xd9dd('0x5c')]:!_[_0xd9dd('0x1d')](_0x4e420a[_0xd9dd('0x5d')])?_0x4e420a['First_Name']+'\x20'+_0x4e420a[_0xd9dd('0x5e')]:_0x4e420a[_0xd9dd('0x5e')],'id':_0x4e420a['id']};}if(_0x4e420a[_0xd9dd('0x3e')]===_0xd9dd('0x52')){_0x3820de['What_Id']={'name':!_[_0xd9dd('0x1d')](_0x4e420a[_0xd9dd('0x5c')])?_0x4e420a[_0xd9dd('0x5c')]:!_[_0xd9dd('0x1d')](_0x4e420a[_0xd9dd('0x5d')])?_0x4e420a[_0xd9dd('0x5d')]+'\x20'+_0x4e420a[_0xd9dd('0x5e')]:_0x4e420a[_0xd9dd('0x5e')],'id':_0x4e420a['id']};_0x3820de[_0xd9dd('0x5f')]=_[_0xd9dd('0x41')](_0x4e420a[_0xd9dd('0x3e')]);}if(_0x4ed49d[_0xd9dd('0x60')]){_0x3820de[_0xd9dd('0x61')]=moment['utc'](parseInt(_0x4ed49d[_0xd9dd('0x60')])*0x3e8)[_0xd9dd('0x62')](_0xd9dd('0x63'));}else if(_0x4ed49d[_0xd9dd('0x64')]&&_0x4ed49d[_0xd9dd('0x65')]){_0x3820de[_0xd9dd('0x61')]=moment[_0xd9dd('0x66')](moment(_0x4ed49d['endtime'],_0xd9dd('0x67'))[_0xd9dd('0x68')](moment(_0x4ed49d[_0xd9dd('0x69')],_0xd9dd('0x67'))))[_0xd9dd('0x62')](_0xd9dd('0x63'));}switch(_0x4ed49d[_0xd9dd('0x6a')]){case _0xd9dd('0x6b'):_0x3820de[_0xd9dd('0x6c')]=_0xd9dd('0x6d');break;case _0xd9dd('0x6e'):case _0xd9dd('0x6f'):_0x3820de['Call_Result']='Answered';break;case _0xd9dd('0x70'):_0x3820de[_0xd9dd('0x6c')]='Rejected';break;case'abandoned':_0x3820de['Call_Result']=_0xd9dd('0x71');break;case _0xd9dd('0x72'):_0x3820de['Call_Result']=_0xd9dd('0x73');default:}_0x3820de[_0xd9dd('0x74')]=(_0x34ea===_0xd9dd('0x75')?moment(_0x4ed49d['starttime'])[_0xd9dd('0x62')](_0xd9dd('0x67')):moment(_0x4ed49d[_0xd9dd('0x76')])[_0xd9dd('0x62')](_0xd9dd('0x67')))||moment()[_0xd9dd('0x62')]('YYYY-MM-DDTHH:mm:ss');_0x3820de[_0xd9dd('0x77')]=_0x34ea||_0xd9dd('0x78');_0x3820de=_['merge'](_0x3820de,getCustomFields(_0x2b6987[_0xd9dd('0x79')],_0x4ed49d));return request({'method':_0xd9dd('0x24'),'uri':'https://www.zohoapis.'+_0x204d31+'/crm/v2/Calls','headers':{'Authorization':_0xd9dd('0x34')+_0x50a764},'body':{'data':[_0x3820de]},'json':!![]})[_0xd9dd('0x29')](function(_0x499b3f){if(_0x499b3f&&_0x499b3f[_0xd9dd('0x3d')][0x0][_0xd9dd('0x7a')]===_0xd9dd('0x7b')){logger[_0xd9dd('0x2f')](_0xd9dd('0x7c'));return{'id':_0x499b3f[_0xd9dd('0x3d')][0x0][_0xd9dd('0x46')]['id']};}})['catch'](function(_0x144915){logger['info']('err',_0x144915[_0xd9dd('0x7d')]);console[_0xd9dd('0x48')]('err',_0x144915);});}exports[_0xd9dd('0x7e')]=function(_0x3c9b96,_0x12d634,_0x5540d4,_0x1d6c83,_0xc0bea,_0x3fc0e5){var _0x524a9c,_0x585371,_0x440420;_0x3fc0e5[_0xd9dd('0x7f')]=intUtil[_0xd9dd('0x80')](_0x3fc0e5[_0xd9dd('0x7f')]);_0x3fc0e5[_0xd9dd('0x81')]=intUtil[_0xd9dd('0x80')](_0x3fc0e5[_0xd9dd('0x81')]);if(_0xc0bea&&_0xc0bea[_0xd9dd('0x82')]){logger[_0xd9dd('0x2f')]('[QUEUE]',_0xd9dd('0x83'));_0x12d634[_0xd9dd('0x84')]=_0x3fc0e5[_0xd9dd('0x81')]+_0xd9dd('0x85')+_0x12d634['uniqueid']+_0xd9dd('0x86')+md5(_0x12d634[_0xd9dd('0x87')]);}else{_0x12d634[_0xd9dd('0x84')]='';}var _0x58a959=_0x3fc0e5[_0xd9dd('0x7f')]===_0xd9dd('0x88')?'eu':_0xd9dd('0x89');return getAccessToken(_0x3fc0e5)['then'](function(_0x41cc0b){_0x440420=_0x41cc0b;return getUser(_0x440420,_0x58a959,_0x3fc0e5,_0x1d6c83[_0xd9dd('0x8a')]);})['then'](function(_0x5a3531){_0x524a9c=_0x5a3531;logger[_0xd9dd('0x2f')](_0xd9dd('0x8b'),_0x524a9c['id']);return getEndUser(_0x440420,_0x58a959,_0x3fc0e5,_0x12d634[_0xd9dd('0x8c')],_0x12d634[_0xd9dd('0x8d')],_0x524a9c,_0x5540d4);})[_0xd9dd('0x29')](function(_0x18e685){_0x585371=_0x18e685;return getCall(_0x440420,_0x58a959,_0x3fc0e5,_0x524a9c,_0x585371,_0x5540d4,_0x12d634,_0xd9dd('0x78'));})['then'](function(_0x369c2a){if(_0x369c2a){logger['info'](_0xd9dd('0x8e'),_0x369c2a['id']);logger[_0xd9dd('0x2f')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd9dd('0x62')](_0xd9dd('0x8f'),_0x1d6c83[_0xd9dd('0x1a')]),_0xd9dd('0x90'),{'uri':'https://crm.'+_0x3fc0e5[_0xd9dd('0x7f')]+_0xd9dd('0x91')+_0x369c2a['id']});}})['catch'](function(_0x530bc4){logger[_0xd9dd('0x2d')](_0xd9dd('0x92'),JSON[_0xd9dd('0xf')](_0x530bc4));});};exports['outbound']=function(_0x3163e0,_0x57fdb4,_0x5c2dc8,_0x449587,_0x4bdae3,_0x5ac6ae,_0x55466a){var _0x59eda6,_0x2ac067,_0x3b4814;_0x5ac6ae[_0xd9dd('0x7f')]=intUtil[_0xd9dd('0x80')](_0x5ac6ae['host']);_0x5ac6ae[_0xd9dd('0x81')]=intUtil[_0xd9dd('0x80')](_0x5ac6ae['serverUrl']);if(_0x55466a&&_0x55466a[_0xd9dd('0x93')]&&_0x55466a[_0xd9dd('0x93')]!=='none'){logger[_0xd9dd('0x2f')](_0xd9dd('0x94'),_0xd9dd('0x83'));_0x57fdb4[_0xd9dd('0x84')]=_0x5ac6ae[_0xd9dd('0x81')]+_0xd9dd('0x85')+_0x57fdb4['uniqueid']+_0xd9dd('0x86')+md5(_0x57fdb4[_0xd9dd('0x87')]);}var _0x1a3125=_0x5ac6ae['host']===_0xd9dd('0x88')?'eu':_0xd9dd('0x89');return getAccessToken(_0x5ac6ae)[_0xd9dd('0x29')](function(_0x249105){_0x3b4814=_0x249105;return getUser(_0x3b4814,_0x1a3125,_0x5ac6ae,_0x449587[_0xd9dd('0x8a')]);})[_0xd9dd('0x29')](function(_0x53fea8){_0x59eda6=_0x53fea8;logger[_0xd9dd('0x2f')](_0xd9dd('0x8b'),_0x59eda6['id']);return getEndUser(_0x3b4814,_0x1a3125,_0x5ac6ae,_0x57fdb4[_0xd9dd('0x95')],_0x57fdb4['destcalleridnum'],_0x59eda6,_0x5c2dc8);})[_0xd9dd('0x29')](function(_0x589163){_0x2ac067=_0x589163;return getCall(_0x3b4814,_0x1a3125,_0x5ac6ae,_0x59eda6,_0x2ac067,_0x5c2dc8,_0x57fdb4,'Outbound');})['then'](function(_0x331460){if(_0x331460){logger[_0xd9dd('0x2f')]('The\x20Call\x20ID\x20is:',_0x331460['id']);logger[_0xd9dd('0x2f')](_0xd9dd('0x94'),_0xd9dd('0x96'));emit(util['format'](_0xd9dd('0x8f'),_0x449587[_0xd9dd('0x1a')]),_0xd9dd('0x90'),{'uri':'https://crm.'+_0x5ac6ae[_0xd9dd('0x7f')]+_0xd9dd('0x91')+_0x331460['id']});}})[_0xd9dd('0x2c')](function(_0xd0932a){logger[_0xd9dd('0x2d')](_0xd9dd('0x94'),JSON['stringify'](_0xd0932a));});};exports[_0xd9dd('0x97')]=function(_0x13f148,_0x3e1caf,_0x270f70,_0x65b9b7,_0x220fdc,_0x25b87c){var _0x512259,_0x316699,_0x3a7550;_0x25b87c[_0xd9dd('0x7f')]=intUtil['stripTrailingSlash'](_0x25b87c[_0xd9dd('0x7f')]);_0x25b87c['serverUrl']=intUtil[_0xd9dd('0x80')](_0x25b87c[_0xd9dd('0x81')]);if(_0x220fdc&&_0x220fdc['monitor_format']){logger[_0xd9dd('0x2f')]('['+_0x3e1caf[_0xd9dd('0x6a')]['toUpperCase']()+']',_0xd9dd('0x83'));_0x3e1caf['recordingURL']=_0x25b87c[_0xd9dd('0x81')]+_0xd9dd('0x85')+_0x3e1caf[_0xd9dd('0x87')]+_0xd9dd('0x86')+md5(_0x3e1caf[_0xd9dd('0x87')]);}else{_0x3e1caf[_0xd9dd('0x84')]='';}var _0x144456=_0x25b87c['host']===_0xd9dd('0x88')?'eu':_0xd9dd('0x89');return getAccessToken(_0x25b87c)[_0xd9dd('0x29')](function(_0x2474b0){_0x3a7550=_0x2474b0;return getUser(_0x3a7550,_0x144456,_0x25b87c);})[_0xd9dd('0x29')](function(_0x2ba05b){_0x512259=_0x2ba05b;logger[_0xd9dd('0x2f')](_0xd9dd('0x8b'),_0x512259['id']);return getEndUser(_0x3a7550,_0x144456,_0x25b87c,_0x3e1caf[_0xd9dd('0x8c')],_0x3e1caf[_0xd9dd('0x8d')],_0x512259,_0x270f70);})[_0xd9dd('0x29')](function(_0xe9aefc){_0x316699=_0xe9aefc;return getCall(_0x3a7550,_0x144456,_0x25b87c,_0x512259,_0x316699,_0x270f70,_0x3e1caf,_0xd9dd('0x78'));})[_0xd9dd('0x29')](function(_0x2baa2d){if(_0x2baa2d){logger[_0xd9dd('0x2f')](_0xd9dd('0x8e'),_0x2baa2d['id']);}})[_0xd9dd('0x2c')](function(_0x1c0b05){logger[_0xd9dd('0x2d')]('['+_0x3e1caf[_0xd9dd('0x6a')][_0xd9dd('0x98')]()+']',JSON[_0xd9dd('0xf')](_0x1c0b05));});}; \ No newline at end of file +var _0x4f88=['profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','code','SUCCESS','details','enduserType','log','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','last_name','Subject','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','Rejected','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','user:%s','trigger:browser:url','https://crm.','host','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridname','The\x20Call\x20ID\x20is:','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','Recording\x20is\x20enabled!','toUpperCase','lodash','request-promise','util','./util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','then','seconds','catch','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f88,0xf3));var _0x84f8=function(_0x59b2a1,_0x1f631f){_0x59b2a1=_0x59b2a1-0x0;var _0x4908d1=_0x4f88[_0x59b2a1];return _0x4908d1;};'use strict';var _=require(_0x84f8('0x0'));var rp=require(_0x84f8('0x1'));var md5=require('md5');var util=require(_0x84f8('0x2'));var intUtil=require(_0x84f8('0x3'));var moment=require(_0x84f8('0x4'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x84f8('0x5'));var logger=require(_0x84f8('0x6'))(_0x84f8('0x7'));config[_0x84f8('0x8')]=_[_0x84f8('0x9')](config[_0x84f8('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x84f8('0xa'))(new Redis(config[_0x84f8('0x8')]));function emit(_0x4ae430,_0x4a09d3,_0x3f2c92){io['to'](_0x4ae430)[_0x84f8('0xb')](_0x4a09d3,_0x3f2c92);}function request(_0x432edd){logger[_0x84f8('0xc')](_0x84f8('0xd'),JSON[_0x84f8('0xe')](_0x432edd));return rp(_0x432edd);}function getCustomFields(_0x46243d,_0x79fd17){var _0x51cffb={};if(_0x46243d['length']>0x0){_[_0x84f8('0xf')](_0x46243d,function(_0x3b6539){if(_[_0x84f8('0x10')]([_0x84f8('0x11'),_0x84f8('0x12')],_0x3b6539['type'])&&_0x3b6539[_0x84f8('0x13')]){_0x51cffb[_0x3b6539[_0x84f8('0x13')]]=_0x3b6539[_0x84f8('0x14')][_0x84f8('0x15')]();}else if(_0x3b6539[_0x84f8('0x16')]==='variable'&&_0x3b6539[_0x84f8('0x17')]&&_0x3b6539[_0x84f8('0x13')]&&_0x79fd17[_0x3b6539[_0x84f8('0x17')]]){_0x51cffb[_0x3b6539[_0x84f8('0x13')]]=_0x79fd17[_0x3b6539['variableName']][_0x84f8('0x15')]();}else if(_0x3b6539['type']===_0x84f8('0x18')&&_0x3b6539[_0x84f8('0x19')]&&_0x3b6539[_0x84f8('0x19')]['name']&&_0x3b6539[_0x84f8('0x13')]&&_0x79fd17[_0x3b6539[_0x84f8('0x19')][_0x84f8('0x1a')][_0x84f8('0x1b')]()]){_0x51cffb[_0x3b6539[_0x84f8('0x13')]]=_0x79fd17[_0x3b6539[_0x84f8('0x19')]['name'][_0x84f8('0x1b')]()][_0x84f8('0x15')]();}});}return _0x51cffb;}function getName(_0x20c99d){if(_0x20c99d['indexOf']('\x20')>0x0){var _0x51092d=_0x20c99d[_0x84f8('0x1c')](/ (.+)/);if(_0x51092d[0x1]){return _0x51092d;}}return[_0x20c99d,_0x20c99d];}var accountsTokens={};function getAccessToken(_0x5ecb0d){return new Promise(function(_0x224909,_0x44ee39){if(!_[_0x84f8('0x1d')](accountsTokens[_0x5ecb0d['id']])&&!_[_0x84f8('0x1d')](accountsTokens[_0x5ecb0d['id']]['access_token'])){if(moment()[_0x84f8('0x1e')](accountsTokens[_0x5ecb0d['id']][_0x84f8('0x1f')])){_0x224909(accountsTokens[_0x5ecb0d['id']][_0x84f8('0x20')]);}}var _0x2d5c99;switch(_0x5ecb0d['zone']){case'US':_0x2d5c99=_0x84f8('0x21');break;case'AU':_0x2d5c99=_0x84f8('0x22');break;case'EU':_0x2d5c99=_0x84f8('0x23');break;case'IN':_0x2d5c99='https://accounts.zoho.in';break;case'CN':_0x2d5c99=_0x84f8('0x24');break;default:_0x2d5c99=_0x84f8('0x23');break;}var _0x230ea3={'method':_0x84f8('0x25'),'uri':_0x2d5c99+_0x84f8('0x26'),'qs':{'refresh_token':_0x5ecb0d['refreshToken'],'client_id':_0x5ecb0d[_0x84f8('0x27')],'client_secret':_0x5ecb0d['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x230ea3)[_0x84f8('0x28')](function(_0x17123a){accountsTokens[_0x5ecb0d['id']]={'access_token':_0x17123a[_0x84f8('0x20')],'expires_in':moment()['add'](_0x17123a[_0x84f8('0x1f')],_0x84f8('0x29'))};_0x224909(_0x17123a['access_token']);})[_0x84f8('0x2a')](function(_0x255d10){logger['error']('Failing\x20creating\x20the\x20access_token',_0x255d10[_0x84f8('0x2b')]);_0x44ee39(_0x255d10);});});}function getUser(_0x32d5e7,_0x826794,_0x262a31,_0x5d839e){logger[_0x84f8('0x2c')](_0x84f8('0x2d'));return request({'method':_0x84f8('0x2e'),'uri':util[_0x84f8('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x826794),'qs':{'type':_0x84f8('0x30')},'headers':{'Authorization':_0x84f8('0x31')+_0x32d5e7},'json':!![]})[_0x84f8('0x28')](function(_0x407dee){if(_0x407dee['users']){var _0x506c08=-0x1;if(_['isArrayLikeObject'](_0x407dee[_0x84f8('0x32')])){if(!_[_0x84f8('0x1d')](_0x5d839e)){_0x506c08=_[_0x84f8('0x33')](_0x407dee[_0x84f8('0x32')],function(_0xc2a605){return _0xc2a605[_0x84f8('0x34')]===_0x5d839e;});}if(_0x506c08>=0x0){logger[_0x84f8('0x2c')](_0x84f8('0x35'));}else{logger[_0x84f8('0x2c')](_0x84f8('0x36'));_0x506c08=_[_0x84f8('0x33')](_0x407dee[_0x84f8('0x32')],function(_0xb4b03a){return _0xb4b03a[_0x84f8('0x37')][_0x84f8('0x1a')]===_0x84f8('0x38');});}return _0x407dee['users'][_0x506c08];}else{if(_0x407dee[_0x84f8('0x39')]['profile'][_0x84f8('0x1a')]===_0x84f8('0x38')){logger['info'](_0x84f8('0x36'));user=_0x407dee[_0x84f8('0x39')];return user;}else{logger[_0x84f8('0x3a')]('The\x20failing\x20result\x20is',JSON[_0x84f8('0xe')](_0x407dee));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x407dee));}}}else{logger['error'](_0x84f8('0x3b'),JSON[_0x84f8('0xe')](_0x407dee));throw new Error(_0x84f8('0x3c')+JSON[_0x84f8('0xe')](_0x407dee));}})[_0x84f8('0x2a')](function(_0x1bdcd3){console[_0x84f8('0x3a')](_0x1bdcd3);});}function getZohoUser(_0x3a54c2,_0x43ccf4){return new BPromise(function(_0x3d105a,_0x1025b8){request(_0x3a54c2)[_0x84f8('0x28')](function(_0x1bb75f){var _0x472a05=null;if(_0x1bb75f){_0x472a05=_0x1bb75f[_0x84f8('0x3d')][0x0];_0x472a05['enduserType']=_0x43ccf4;}_0x3d105a(_0x472a05);})[_0x84f8('0x2a')](function(_0x423168){_0x1025b8(_0x423168);});});}function createEndUser(_0x2ff8c8,_0x544e0a,_0x13fd0e,_0x43a9b6,_0x51284e,_0x57f0e6){var _0x13fd0e=getName(_0x13fd0e);return request({'method':_0x84f8('0x25'),'uri':_0x84f8('0x3e')+_0x544e0a+_0x84f8('0x3f')+_[_0x84f8('0x40')](_0x57f0e6[_0x84f8('0x41')])+'s','body':{'data':[{'Last_Name':_0x13fd0e[0x1],'First_Name':_0x13fd0e[0x0],'Phone':_0x43a9b6,'Owner':{'name':!_['isNil'](_0x51284e[_0x84f8('0x42')]['name'])?_0x51284e[_0x84f8('0x42')][_0x84f8('0x1a')]:!_[_0x84f8('0x1d')](_0x51284e['first_name'])?_0x51284e[_0x84f8('0x43')]+'\x20'+_0x51284e['last_name']:_0x51284e['last_name'],'id':_0x51284e['id']}}]},'headers':{'Authorization':_0x84f8('0x31')+_0x2ff8c8},'json':!![]})['then'](function(_0x224cc0){if(_0x224cc0&&_0x224cc0[_0x84f8('0x3d')][0x0][_0x84f8('0x44')]===_0x84f8('0x45')){var _0x21ea0b=_0x224cc0['data'][0x0][_0x84f8('0x46')];_0x21ea0b[_0x84f8('0x47')]=_[_0x84f8('0x40')](_0x57f0e6[_0x84f8('0x41')])+'s';return _0x21ea0b;}logger['error'](_0x84f8('0x3b'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x84f8('0xe')](data));})[_0x84f8('0x2a')](function(_0x2861c5){console[_0x84f8('0x48')]('CREATE\x20ERROR',_0x2861c5);});}function getEndUser(_0xbc0efd,_0x1d1f12,_0x4f8e3e,_0x1a6aaa,_0x28d36d,_0x43586f,_0x30f473){var _0x4d8e1b={'method':_0x84f8('0x2e'),'uri':'','headers':{'Authorization':_0x84f8('0x31')+_0xbc0efd},'json':!![]};switch(_0x30f473['moduleSearch']){case'contact_lead':_0x4d8e1b[_0x84f8('0x49')]=_0x84f8('0x3e')+_0x1d1f12+_0x84f8('0x4a')+_0x28d36d+'))';return getZohoUser(_0x4d8e1b,_0x84f8('0x4b'))['then'](function(_0x363bd8){if(_0x363bd8)return _0x363bd8;_0x4d8e1b[_0x84f8('0x49')]=_0x84f8('0x3e')+_0x1d1f12+_0x84f8('0x4c')+_0x28d36d+'))';return getZohoUser(_0x4d8e1b,_0x84f8('0x4d'))[_0x84f8('0x28')](function(_0x449cf2){if(_0x449cf2)return _0x449cf2;if(_0x30f473[_0x84f8('0x41')]!=_0x84f8('0x4e')){return createEndUser(_0xbc0efd,_0x1d1f12,_0x1a6aaa,_0x28d36d,_0x43586f,_0x30f473);}else{return{};}});});break;case _0x84f8('0x4f'):_0x4d8e1b[_0x84f8('0x49')]=_0x84f8('0x3e')+_0x1d1f12+_0x84f8('0x4a')+_0x28d36d+'))';return getZohoUser(_0x4d8e1b,_0x84f8('0x4b'))[_0x84f8('0x28')](function(_0x3e9b4d){if(_0x3e9b4d)return _0x3e9b4d;if(_0x30f473[_0x84f8('0x41')]!=_0x84f8('0x4e')){return createEndUser(_0xbc0efd,_0x1d1f12,_0x1a6aaa,_0x28d36d,_0x43586f,_0x30f473);}else{return{};}});break;case'lead':_0x4d8e1b['uri']='https://www.zohoapis.'+_0x1d1f12+_0x84f8('0x4c')+_0x28d36d+'))';return getZohoUser(_0x4d8e1b,'Leads')[_0x84f8('0x28')](function(_0x3a67f1){if(_0x3a67f1)return _0x3a67f1;if(_0x30f473['moduleCreate']!=_0x84f8('0x4e')){return createEndUser(_0xbc0efd,_0x1d1f12,_0x1a6aaa,_0x28d36d,_0x43586f,_0x30f473);}else{return{};}});break;}}function getCall(_0x212e2e,_0x3ef66b,_0x11d392,_0x4230bd,_0x47e60d,_0x4e41ae,_0x2e453a,_0x57ca09){logger[_0x84f8('0x2c')](_0x84f8('0x50'));var _0xe6c4fe={};_0xe6c4fe[_0x84f8('0x51')]={'name':!_[_0x84f8('0x1d')](_0x4230bd[_0x84f8('0x42')][_0x84f8('0x1a')])&&!_[_0x84f8('0x1d')](_0x4230bd[_0x84f8('0x37')][_0x84f8('0x1a')])&&_0x4230bd[_0x84f8('0x37')]['name']===_0x84f8('0x52')?_0x4230bd['role'][_0x84f8('0x1a')]:!_[_0x84f8('0x1d')](_0x4230bd[_0x84f8('0x43')])?_0x4230bd[_0x84f8('0x43')]+'\x20'+_0x4230bd[_0x84f8('0x53')]:_0x4230bd[_0x84f8('0x53')],'id':_0x4230bd['id']};_0xe6c4fe[_0x84f8('0x54')]=intUtil['getString'](_0x4e41ae[_0x84f8('0x55')],_0x2e453a,'\x20');_0xe6c4fe[_0x84f8('0x56')]=intUtil['getString'](_0x4e41ae[_0x84f8('0x57')],_0x2e453a,'\x0a');if(_0x47e60d[_0x84f8('0x47')]===_0x84f8('0x4b')){_0xe6c4fe[_0x84f8('0x58')]={'name':!_[_0x84f8('0x1d')](_0x47e60d[_0x84f8('0x59')])?_0x47e60d[_0x84f8('0x59')]:!_['isNil'](_0x47e60d[_0x84f8('0x5a')])?_0x47e60d[_0x84f8('0x5a')]+'\x20'+_0x47e60d['Last_Name']:_0x47e60d[_0x84f8('0x5b')],'id':_0x47e60d['id']};}if(_0x47e60d[_0x84f8('0x47')]===_0x84f8('0x4d')){_0xe6c4fe['What_Id']={'name':!_[_0x84f8('0x1d')](_0x47e60d[_0x84f8('0x59')])?_0x47e60d[_0x84f8('0x59')]:!_[_0x84f8('0x1d')](_0x47e60d['First_Name'])?_0x47e60d[_0x84f8('0x5a')]+'\x20'+_0x47e60d[_0x84f8('0x5b')]:_0x47e60d[_0x84f8('0x5b')],'id':_0x47e60d['id']};_0xe6c4fe[_0x84f8('0x5c')]=_[_0x84f8('0x40')](_0x47e60d[_0x84f8('0x47')]);}if(_0x2e453a[_0x84f8('0x5d')]){_0xe6c4fe[_0x84f8('0x5e')]=moment[_0x84f8('0x5f')](parseInt(_0x2e453a[_0x84f8('0x5d')])*0x3e8)[_0x84f8('0x2f')]('mm:ss');}else if(_0x2e453a[_0x84f8('0x60')]&&_0x2e453a[_0x84f8('0x61')]){_0xe6c4fe[_0x84f8('0x5e')]=moment[_0x84f8('0x5f')](moment(_0x2e453a[_0x84f8('0x61')],_0x84f8('0x62'))[_0x84f8('0x63')](moment(_0x2e453a[_0x84f8('0x64')],_0x84f8('0x62'))))['format'](_0x84f8('0x65'));}switch(_0x2e453a[_0x84f8('0x66')]){case _0x84f8('0x67'):_0xe6c4fe[_0x84f8('0x68')]=_0x84f8('0x69');break;case _0x84f8('0x6a'):case _0x84f8('0x6b'):_0xe6c4fe[_0x84f8('0x68')]=_0x84f8('0x6c');break;case'rejected':_0xe6c4fe['Call_Result']=_0x84f8('0x6d');break;case'abandoned':_0xe6c4fe[_0x84f8('0x68')]=_0x84f8('0x6e');break;case _0x84f8('0x6f'):_0xe6c4fe[_0x84f8('0x68')]=_0x84f8('0x70');default:}_0xe6c4fe['Call_Start_Time']=(_0x57ca09===_0x84f8('0x71')?moment(_0x2e453a[_0x84f8('0x64')])[_0x84f8('0x2f')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x2e453a[_0x84f8('0x72')])['format'](_0x84f8('0x62')))||moment()['format'](_0x84f8('0x62'));_0xe6c4fe[_0x84f8('0x73')]=_0x57ca09||_0x84f8('0x74');_0xe6c4fe=_[_0x84f8('0x75')](_0xe6c4fe,getCustomFields(_0x4e41ae[_0x84f8('0x76')],_0x2e453a));return request({'method':_0x84f8('0x25'),'uri':_0x84f8('0x3e')+_0x3ef66b+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x212e2e},'body':{'data':[_0xe6c4fe]},'json':!![]})[_0x84f8('0x28')](function(_0xdd821b){if(_0xdd821b&&_0xdd821b[_0x84f8('0x3d')][0x0][_0x84f8('0x44')]===_0x84f8('0x45')){logger[_0x84f8('0x2c')](_0x84f8('0x77'));return{'id':_0xdd821b[_0x84f8('0x3d')][0x0][_0x84f8('0x46')]['id']};}})[_0x84f8('0x2a')](function(_0x1d900c){logger[_0x84f8('0x2c')]('err',_0x1d900c[_0x84f8('0x2b')]);console[_0x84f8('0x48')](_0x84f8('0x78'),_0x1d900c);});}exports[_0x84f8('0x79')]=function(_0x16a8a4,_0x290d06,_0x59b976,_0x2e6964,_0x2d1e29,_0x213a28){var _0x5c90f7,_0x3ee3a3,_0x3b8b48;_0x213a28['host']=intUtil[_0x84f8('0x7a')](_0x213a28['host']);_0x213a28[_0x84f8('0x7b')]=intUtil[_0x84f8('0x7a')](_0x213a28[_0x84f8('0x7b')]);if(_0x2d1e29&&_0x2d1e29['monitor_format']){logger['info'](_0x84f8('0x7c'),'Recording\x20is\x20enabled!');_0x290d06['recordingURL']=_0x213a28['serverUrl']+_0x84f8('0x7d')+_0x290d06[_0x84f8('0x7e')]+_0x84f8('0x7f')+md5(_0x290d06[_0x84f8('0x7e')]);}else{_0x290d06[_0x84f8('0x80')]='';}var _0x3536d2=_0x213a28['host']===_0x84f8('0x81')?'eu':_0x84f8('0x82');return getAccessToken(_0x213a28)[_0x84f8('0x28')](function(_0x216dde){_0x3b8b48=_0x216dde;return getUser(_0x3b8b48,_0x3536d2,_0x213a28,_0x2e6964[_0x84f8('0x34')]);})[_0x84f8('0x28')](function(_0x32bb4e){_0x5c90f7=_0x32bb4e;logger[_0x84f8('0x2c')](_0x84f8('0x83'),_0x5c90f7['id']);return getEndUser(_0x3b8b48,_0x3536d2,_0x213a28,_0x290d06[_0x84f8('0x84')],_0x290d06[_0x84f8('0x85')],_0x5c90f7,_0x59b976);})[_0x84f8('0x28')](function(_0x36e001){_0x3ee3a3=_0x36e001;return getCall(_0x3b8b48,_0x3536d2,_0x213a28,_0x5c90f7,_0x3ee3a3,_0x59b976,_0x290d06,_0x84f8('0x74'));})[_0x84f8('0x28')](function(_0x61d96f){if(_0x61d96f){logger[_0x84f8('0x2c')]('The\x20Call\x20ID\x20is:',_0x61d96f['id']);logger[_0x84f8('0x2c')](_0x84f8('0x7c'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x84f8('0x2f')](_0x84f8('0x86'),_0x2e6964['name']),_0x84f8('0x87'),{'uri':_0x84f8('0x88')+_0x213a28[_0x84f8('0x89')]+_0x84f8('0x8a')+_0x61d96f['id']});}})[_0x84f8('0x2a')](function(_0x137989){logger[_0x84f8('0x3a')](_0x84f8('0x7c'),JSON['stringify'](_0x137989));});};exports['outbound']=function(_0x669946,_0x4dc4ad,_0x5cfb3c,_0x45662c,_0x28142e,_0x462be9,_0xf412dc){var _0x1b1419,_0x30fc98,_0x3357c6;_0x462be9[_0x84f8('0x89')]=intUtil[_0x84f8('0x7a')](_0x462be9[_0x84f8('0x89')]);_0x462be9['serverUrl']=intUtil['stripTrailingSlash'](_0x462be9[_0x84f8('0x7b')]);if(_0xf412dc&&_0xf412dc[_0x84f8('0x8b')]&&_0xf412dc[_0x84f8('0x8b')]!==_0x84f8('0x8c')){logger[_0x84f8('0x2c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4dc4ad[_0x84f8('0x80')]=_0x462be9[_0x84f8('0x7b')]+_0x84f8('0x7d')+_0x4dc4ad['uniqueid']+_0x84f8('0x7f')+md5(_0x4dc4ad['uniqueid']);}var _0x5437a4=_0x462be9['host']===_0x84f8('0x81')?'eu':_0x84f8('0x82');return getAccessToken(_0x462be9)['then'](function(_0x27d4e8){_0x3357c6=_0x27d4e8;return getUser(_0x3357c6,_0x5437a4,_0x462be9,_0x45662c[_0x84f8('0x34')]);})[_0x84f8('0x28')](function(_0xccead){_0x1b1419=_0xccead;logger['info'](_0x84f8('0x83'),_0x1b1419['id']);return getEndUser(_0x3357c6,_0x5437a4,_0x462be9,_0x4dc4ad[_0x84f8('0x8d')],_0x4dc4ad['destcalleridnum'],_0x1b1419,_0x5cfb3c);})[_0x84f8('0x28')](function(_0x12c643){_0x30fc98=_0x12c643;return getCall(_0x3357c6,_0x5437a4,_0x462be9,_0x1b1419,_0x30fc98,_0x5cfb3c,_0x4dc4ad,'Outbound');})[_0x84f8('0x28')](function(_0x10e85c){if(_0x10e85c){logger[_0x84f8('0x2c')](_0x84f8('0x8e'),_0x10e85c['id']);logger[_0x84f8('0x2c')](_0x84f8('0x8f'),_0x84f8('0x90'));emit(util['format'](_0x84f8('0x86'),_0x45662c['name']),_0x84f8('0x87'),{'uri':_0x84f8('0x88')+_0x462be9[_0x84f8('0x89')]+_0x84f8('0x8a')+_0x10e85c['id']});}})[_0x84f8('0x2a')](function(_0x2675f5){logger['error'](_0x84f8('0x8f'),JSON['stringify'](_0x2675f5));});};exports[_0x84f8('0x91')]=function(_0x461d67,_0x11b764,_0x122f21,_0x31272f,_0x3dedb2,_0x5d246f){var _0x3328fa,_0x3f5d70,_0x131387;_0x5d246f[_0x84f8('0x89')]=intUtil[_0x84f8('0x7a')](_0x5d246f[_0x84f8('0x89')]);_0x5d246f[_0x84f8('0x7b')]=intUtil[_0x84f8('0x7a')](_0x5d246f[_0x84f8('0x7b')]);if(_0x3dedb2&&_0x3dedb2[_0x84f8('0x92')]){logger[_0x84f8('0x2c')]('['+_0x11b764[_0x84f8('0x66')]['toUpperCase']()+']',_0x84f8('0x93'));_0x11b764['recordingURL']=_0x5d246f['serverUrl']+'/api/voice/recordings/'+_0x11b764[_0x84f8('0x7e')]+'/downloads?type=uniqueid&token='+md5(_0x11b764[_0x84f8('0x7e')]);}else{_0x11b764[_0x84f8('0x80')]='';}var _0x4aa01d=_0x5d246f[_0x84f8('0x89')]===_0x84f8('0x81')?'eu':_0x84f8('0x82');return getAccessToken(_0x5d246f)[_0x84f8('0x28')](function(_0x1283ef){_0x131387=_0x1283ef;return getUser(_0x131387,_0x4aa01d,_0x5d246f);})[_0x84f8('0x28')](function(_0x5a49d9){_0x3328fa=_0x5a49d9;logger[_0x84f8('0x2c')](_0x84f8('0x83'),_0x3328fa['id']);return getEndUser(_0x131387,_0x4aa01d,_0x5d246f,_0x11b764[_0x84f8('0x84')],_0x11b764[_0x84f8('0x85')],_0x3328fa,_0x122f21);})[_0x84f8('0x28')](function(_0x10ab65){_0x3f5d70=_0x10ab65;return getCall(_0x131387,_0x4aa01d,_0x5d246f,_0x3328fa,_0x3f5d70,_0x122f21,_0x11b764,_0x84f8('0x74'));})[_0x84f8('0x28')](function(_0x45a35b){if(_0x45a35b){logger[_0x84f8('0x2c')]('The\x20Call\x20ID\x20is:',_0x45a35b['id']);}})['catch'](function(_0x3bafdf){logger[_0x84f8('0x3a')]('['+_0x11b764[_0x84f8('0x66')][_0x84f8('0x94')]()+']',JSON[_0x84f8('0xe')](_0x3bafdf));});}; \ 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 ea8d072..15f63a0 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 _0xf0e6=['data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2','Script'];(function(_0x389500,_0x55d66e){var _0x3fa9cc=function(_0x2e9966){while(--_0x2e9966){_0x389500['push'](_0x389500['shift']());}};_0x3fa9cc(++_0x55d66e);}(_0xf0e6,0x1a6));var _0x6f0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0e6[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x6f0e('0x0'));var sh=require(_0x6f0e('0x1'));var Mustache=require(_0x6f0e('0x2'));var logger=require('../../../../config/logger')(_0x6f0e('0x3'));exports[_0x6f0e('0x4')]=function(_0xe54218,_0x361c06){var _0x4f0d19=_0xe54218[_0x6f0e('0x5')]?_0xe54218[_0x6f0e('0x5')]:_0x6f0e('0x6');var _0x3291fb=_0xe54218[_0x6f0e('0x7')]?Mustache[_0x6f0e('0x8')](_0xe54218['data3'],_0x361c06):_0x361c06;sh['exec'](_0x3291fb,function(_0xd4a207,_0x5717d6,_0x43f963){if(_0xd4a207!==0x0){logger[_0x6f0e('0x9')](util[_0x6f0e('0xa')](_0x6f0e('0xb'),_0x4f0d19,_0x3291fb,_0xd4a207,_0x43f963));}else{logger['info'](util[_0x6f0e('0xa')](_0x6f0e('0xc'),_0x4f0d19,_0x3291fb,_0x5717d6));}});}; \ No newline at end of file +var _0x8723=['format','shelljs','mustache','trigger','data2','Script','data3','render','exec','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8723,0xe7));var _0x3872=function(_0x2fa523,_0x174b28){_0x2fa523=_0x2fa523-0x0;var _0x3e78f5=_0x8723[_0x2fa523];return _0x3e78f5;};'use strict';var util=require('util');var sh=require(_0x3872('0x0'));var Mustache=require(_0x3872('0x1'));var logger=require('../../../../config/logger')(_0x3872('0x2'));exports['exec']=function(_0x4f780c,_0x4f2426){var _0x4df559=_0x4f780c[_0x3872('0x3')]?_0x4f780c['data2']:_0x3872('0x4');var _0x4b67b8=_0x4f780c[_0x3872('0x5')]?Mustache[_0x3872('0x6')](_0x4f780c[_0x3872('0x5')],_0x4f2426):_0x4f2426;sh[_0x3872('0x7')](_0x4b67b8,function(_0x5e81c6,_0x212225,_0x15f683){if(_0x5e81c6!==0x0){logger[_0x3872('0x8')](util[_0x3872('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x4df559,_0x4b67b8,_0x5e81c6,_0x15f683));}else{logger['info'](util[_0x3872('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4df559,_0x4b67b8,_0x212225));}});}; \ 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 085c93c..0a7cd49 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 _0x50f6=['toUpperCase','GET','PUT','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','stringify','then','isNil',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','mustache','render','data2','number','data5','headers','parse','data6','error','stack','data1'];(function(_0x46c5d3,_0x591ff9){var _0x280fc2=function(_0x5e7d2c){while(--_0x5e7d2c){_0x46c5d3['push'](_0x46c5d3['shift']());}};_0x280fc2(++_0x591ff9);}(_0x50f6,0x89));var _0x650f=function(_0xcffcbe,_0x143d81){_0xcffcbe=_0xcffcbe-0x0;var _0x447d0d=_0x50f6[_0xcffcbe];return _0x447d0d;};'use strict';var rp=require(_0x650f('0x0'));var util=require(_0x650f('0x1'));var _=require('lodash');var Mustache=require(_0x650f('0x2'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x47ba84,_0x4a1ea7){var _0x222e77,_0x3fa5e4;var _0x32ad47={'method':_0x47ba84['data1']['toUpperCase'](),'uri':Mustache[_0x650f('0x3')](_0x47ba84[_0x650f('0x4')],_0x4a1ea7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x47ba84['data5'])===_0x650f('0x5')&&parseInt(_0x47ba84[_0x650f('0x6')])>=0x1&&parseInt(_0x47ba84[_0x650f('0x6')])<=0xa?parseInt(_0x47ba84[_0x650f('0x6')])*0x3e8:0x5*0x3e8};try{_0x32ad47[_0x650f('0x7')]=_0x47ba84['data6']?JSON[_0x650f('0x8')](Mustache[_0x650f('0x3')](_0x47ba84[_0x650f('0x9')],_0x4a1ea7)):{};}catch(_0x27b41d){logger[_0x650f('0xa')](_0x27b41d[_0x650f('0xb')]);}switch(_0x47ba84[_0x650f('0xc')][_0x650f('0xd')]()){case _0x650f('0xe'):case'DELETE':_0x222e77=null;_0x32ad47['qs']=_0x4a1ea7;break;case'POST':case _0x650f('0xf'):if(_0x47ba84['data7']){try{_0x222e77=JSON['parse'](Mustache['render'](_0x47ba84['data7'],_0x4a1ea7));_0x32ad47[_0x650f('0x10')]=_0x222e77;}catch(_0x312a0f){logger[_0x650f('0xa')](_0x312a0f[_0x650f('0xb')]);logger[_0x650f('0xa')](_0x650f('0x11'));}}else{_0x222e77=_0x4a1ea7;_0x32ad47[_0x650f('0x10')]=_0x222e77;}break;}logger[_0x650f('0x12')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x47ba84['data1'],_0x47ba84['data2'],JSON[_0x650f('0x13')](_0x32ad47)));rp(_0x32ad47)[_0x650f('0x14')](function(_0x7a9593){_0x222e77=!_[_0x650f('0x15')](_0x222e77)?_0x650f('0x16')+_0x222e77:'';_0x3fa5e4=typeof _0x7a9593[_0x650f('0x10')]===_0x650f('0x17')?JSON[_0x650f('0x13')](_0x7a9593[_0x650f('0x10')]):_0x7a9593[_0x650f('0x10')];logger['info'](util[_0x650f('0x18')](_0x650f('0x19'),_0x47ba84[_0x650f('0xc')],_0x47ba84[_0x650f('0x4')],_0x7a9593['statusCode'],_0x3fa5e4));})['catch'](function(_0x3da51d){logger[_0x650f('0xa')](util[_0x650f('0x18')](_0x650f('0x1a'),_0x47ba84[_0x650f('0xc')],_0x47ba84['data2'],_0x3da51d[_0x650f('0x1b')],_0x3da51d[_0x650f('0x1c')],_0x3da51d[_0x650f('0x1d')]));});}; \ No newline at end of file +var _0x1c41=['DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','parse','data6','error','stack','GET'];(function(_0x3316de,_0x29382e){var _0x58f8b4=function(_0x3aad10){while(--_0x3aad10){_0x3316de['push'](_0x3316de['shift']());}};_0x58f8b4(++_0x29382e);}(_0x1c41,0xba));var _0x11c4=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x1c41[_0x5d0609];return _0xaa3fd1;};'use strict';var rp=require('request-promise');var util=require(_0x11c4('0x0'));var _=require(_0x11c4('0x1'));var Mustache=require(_0x11c4('0x2'));var logger=require(_0x11c4('0x3'))(_0x11c4('0x4'));exports[_0x11c4('0x5')]=function(_0x544ae8,_0x10344d){var _0x207d97,_0x12237e;var _0x5d4827={'method':_0x544ae8[_0x11c4('0x6')][_0x11c4('0x7')](),'uri':Mustache[_0x11c4('0x8')](_0x544ae8[_0x11c4('0x9')],_0x10344d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x544ae8[_0x11c4('0xa')])===_0x11c4('0xb')&&parseInt(_0x544ae8['data5'])>=0x1&&parseInt(_0x544ae8['data5'])<=0xa?parseInt(_0x544ae8[_0x11c4('0xa')])*0x3e8:0x5*0x3e8};try{_0x5d4827[_0x11c4('0xc')]=_0x544ae8['data6']?JSON[_0x11c4('0xd')](Mustache[_0x11c4('0x8')](_0x544ae8[_0x11c4('0xe')],_0x10344d)):{};}catch(_0x3ae9d3){logger[_0x11c4('0xf')](_0x3ae9d3[_0x11c4('0x10')]);}switch(_0x544ae8[_0x11c4('0x6')]['toUpperCase']()){case _0x11c4('0x11'):case _0x11c4('0x12'):_0x207d97=null;_0x5d4827['qs']=_0x10344d;break;case _0x11c4('0x13'):case'PUT':if(_0x544ae8[_0x11c4('0x14')]){try{_0x207d97=JSON[_0x11c4('0xd')](Mustache['render'](_0x544ae8[_0x11c4('0x14')],_0x10344d));_0x5d4827[_0x11c4('0x15')]=_0x207d97;}catch(_0x2acbc0){logger[_0x11c4('0xf')](_0x2acbc0[_0x11c4('0x10')]);logger[_0x11c4('0xf')](_0x11c4('0x16'));}}else{_0x207d97=_0x10344d;_0x5d4827['body']=_0x207d97;}break;}logger[_0x11c4('0x17')](util[_0x11c4('0x18')](_0x11c4('0x19'),_0x544ae8[_0x11c4('0x6')],_0x544ae8[_0x11c4('0x9')],JSON[_0x11c4('0x1a')](_0x5d4827)));rp(_0x5d4827)[_0x11c4('0x1b')](function(_0x5313cd){_0x207d97=!_[_0x11c4('0x1c')](_0x207d97)?_0x11c4('0x1d')+_0x207d97:'';_0x12237e=typeof _0x5313cd[_0x11c4('0x15')]==='object'?JSON['stringify'](_0x5313cd['body']):_0x5313cd[_0x11c4('0x15')];logger[_0x11c4('0x17')](util[_0x11c4('0x18')](_0x11c4('0x1e'),_0x544ae8['data1'],_0x544ae8['data2'],_0x5313cd[_0x11c4('0x1f')],_0x12237e));})['catch'](function(_0x509fcc){logger[_0x11c4('0xf')](util['format'](_0x11c4('0x20'),_0x544ae8[_0x11c4('0x6')],_0x544ae8['data2'],_0x509fcc[_0x11c4('0x1f')],_0x509fcc[_0x11c4('0x21')],_0x509fcc['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 20a3af8..8df1903 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 _0x44d0=['request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x44d0,0x1c9));var _0x044d=function(_0x18675e,_0x4ae5e8){_0x18675e=_0x18675e-0x0;var _0x306559=_0x44d0[_0x18675e];return _0x306559;};'use strict';var jayson=require(_0x044d('0x0'));var BPromise=require(_0x044d('0x1'));var logger=require(_0x044d('0x2'))(_0x044d('0x3'));var client=jayson[_0x044d('0x4')][_0x044d('0x5')]({'port':0x2329});client[_0x044d('0x6')]=function(_0xa40f91,_0x4aca82){return new BPromise(function(_0x4a6f4a,_0x521a97){return client[_0x044d('0x7')](_0xa40f91,_0x4aca82)[_0x044d('0x8')](function(_0x1213ac){logger[_0x044d('0x9')](_0x044d('0xa'),'routing',_0xa40f91,_0x4aca82,_0x1213ac);if(_0x1213ac[_0x044d('0xb')]){logger[_0x044d('0xb')](_0x044d('0xa'),'routing',_0xa40f91,_0x1213ac[_0x044d('0xb')][_0x044d('0xc')],_0x4aca82);return _0x521a97(_0x1213ac['error'][_0x044d('0xc')]);}else{return _0x4a6f4a(_0x1213ac[_0x044d('0xd')]);}})[_0x044d('0xe')](function(_0x4c1ed9){logger[_0x044d('0xb')](_0x044d('0xa'),_0x044d('0x3'),_0xa40f91,_0x4c1ed9,_0x4aca82);return _0x521a97(_0x4c1ed9);});});};module[_0x044d('0xf')]=client; \ No newline at end of file +var _0x585a=['message','catch','exports','bluebird','routing','client','http','Request','request','then','debug','error','rpc'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x585a,0x155));var _0xa585=function(_0x3a3c81,_0x253ca1){_0x3a3c81=_0x3a3c81-0x0;var _0x53acaf=_0x585a[_0x3a3c81];return _0x53acaf;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa585('0x0'));var logger=require('../../config/logger')(_0xa585('0x1'));var client=jayson[_0xa585('0x2')][_0xa585('0x3')]({'port':0x2329});client[_0xa585('0x4')]=function(_0x439328,_0x1cd338){return new BPromise(function(_0x16b6ae,_0x223ab5){return client[_0xa585('0x5')](_0x439328,_0x1cd338)[_0xa585('0x6')](function(_0x2d38bb){logger[_0xa585('0x7')]('rpc','routing',_0x439328,_0x1cd338,_0x2d38bb);if(_0x2d38bb[_0xa585('0x8')]){logger[_0xa585('0x8')](_0xa585('0x9'),'routing',_0x439328,_0x2d38bb['error'][_0xa585('0xa')],_0x1cd338);return _0x223ab5(_0x2d38bb[_0xa585('0x8')]['message']);}else{return _0x16b6ae(_0x2d38bb['result']);}})[_0xa585('0xb')](function(_0x2327b0){logger[_0xa585('0x8')](_0xa585('0x9'),_0xa585('0x1'),_0x439328,_0x2327b0,_0x1cd338);return _0x223ab5(_0x2327b0);});});};module[_0xa585('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 1cfbb20..564a3b2 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 _0x92d2=['./rpc/mailAccount','../../config/logger','email','resolve','then','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email'];(function(_0x2fbd0e,_0x3460a9){var _0x481c9f=function(_0x4bc402){while(--_0x4bc402){_0x2fbd0e['push'](_0x2fbd0e['shift']());}};_0x481c9f(++_0x3460a9);}(_0x92d2,0xb3));var _0x292d=function(_0x134c96,_0xf5e3a4){_0x134c96=_0x134c96-0x0;var _0x3990c8=_0x92d2[_0x134c96];return _0x3990c8;};'use strict';var server=require(_0x292d('0x0'));var Realtime=require(_0x292d('0x1'));var EmailChannel=require(_0x292d('0x2'));var mailAccount=require(_0x292d('0x3'));var setting=require('./rpc/setting');var logger=require(_0x292d('0x4'))(_0x292d('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x292d('0x6')]()[_0x292d('0x7')](mailAccount['getMailAccounts']())[_0x292d('0x7')](realtime['initMailAccounts']())[_0x292d('0x7')](function(){email['refresh'](realtime[_0x292d('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x292d('0x7')](function(){return initRealtime();})[_0x292d('0x7')](function(){return setting[_0x292d('0x9')]();})[_0x292d('0x7')](function(_0x4b653e){return setInterval(initRealtime,_0x4b653e[_0x292d('0xa')]*0x3e8);})[_0x292d('0xb')](function(_0x179bff){logger[_0x292d('0xc')](_0x292d('0xd'),_0x179bff);});}main(); \ No newline at end of file +var _0xde5a=['getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','resolve','getMailAccounts','then','initMailAccounts','refresh'];(function(_0x5b474b,_0x136b79){var _0x3640bb=function(_0x196aaf){while(--_0x196aaf){_0x5b474b['push'](_0x5b474b['shift']());}};_0x3640bb(++_0x136b79);}(_0xde5a,0x1a8));var _0xade5=function(_0x4c9bb9,_0xa701af){_0x4c9bb9=_0x4c9bb9-0x0;var _0x454e00=_0xde5a[_0x4c9bb9];return _0x454e00;};'use strict';var server=require('./server');var Realtime=require(_0xade5('0x0'));var EmailChannel=require(_0xade5('0x1'));var mailAccount=require(_0xade5('0x2'));var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xade5('0x3')]()['then'](mailAccount[_0xade5('0x4')]())[_0xade5('0x5')](realtime[_0xade5('0x6')]())['then'](function(){email[_0xade5('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0xade5('0x5')](function(){return setting[_0xade5('0x8')]();})[_0xade5('0x5')](function(_0x2cc3e5){return setInterval(initRealtime,_0x2cc3e5[_0xade5('0x9')]*0x3e8);})['catch'](function(_0x3a287a){logger[_0xade5('0xa')](_0xade5('0xb'),_0x3a287a);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 2b75823..dbc7f1a 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 _0x30aa=['name','Imap','messageStatus','total','isNil','mailAccount:update','hasOwnProperty','active','service','provider','custom','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','lastSync','verify','exports','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit'];(function(_0xb8b43f,_0x32f81f){var _0x1f9efa=function(_0x4b4bac){while(--_0x4b4bac){_0xb8b43f['push'](_0xb8b43f['shift']());}};_0x1f9efa(++_0x32f81f);}(_0x30aa,0x10b));var _0xa30a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x30aa[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var moment=require(_0xa30a('0x0'));var BPromise=require(_0xa30a('0x1'));var md5=require(_0xa30a('0x2'));var Redis=require('ioredis');var config=require(_0xa30a('0x3'));var logger=require(_0xa30a('0x4'))(_0xa30a('0x5'));config[_0xa30a('0x6')]=_[_0xa30a('0x7')](config[_0xa30a('0x6')],{'host':_0xa30a('0x8'),'port':0x18eb});var io=require(_0xa30a('0x9'))(new Redis(config[_0xa30a('0x6')]));var EmailImap=require(_0xa30a('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0xa30a('0xb'));var md5Accounts={};function EmailChannel(_0xd948bf){logger[_0xa30a('0xc')]('start\x20email\x20channel');this[_0xa30a('0xd')]=_0xd948bf['mailAccounts'];this[_0xa30a('0xe')]={};this[_0xa30a('0xf')]=new EmailSmtp();}EmailChannel[_0xa30a('0x10')][_0xa30a('0x11')]=function(_0x38c5c8){var _0x39a6ab=this[_0xa30a('0xd')][_0x38c5c8];var _0x4aa572={'id':_0x39a6ab['id'],'name':_0x39a6ab[_0xa30a('0x12')],'key':_0x39a6ab['key'],'active':_0x39a6ab['active'],'Imap':{'status':_0x39a6ab[_0xa30a('0x13')]['status'],'messageStatus':_0x39a6ab[_0xa30a('0x13')][_0xa30a('0x14')],'total':_0x39a6ab[_0xa30a('0x13')][_0xa30a('0x15')]}};if(_[_0xa30a('0x16')](md5Accounts[_0x38c5c8])){md5Accounts[_0x38c5c8]={};}var _0x4eab01=md5(JSON['stringify'](_0x4aa572));if(md5Accounts[_0x38c5c8][_0xa30a('0x2')]!==_0x4eab01){md5Accounts[_0x38c5c8][_0xa30a('0x2')]=_0x4eab01;io[_0xa30a('0x11')](_0xa30a('0x17'),_0x4aa572);}};EmailChannel[_0xa30a('0x10')]['refresh']=function(_0x49ee2b){for(var _0x9deae3 in _0x49ee2b){if(_0x49ee2b[_0xa30a('0x18')](_0x9deae3)){if(_0x49ee2b[_0x9deae3][_0xa30a('0x13')]&&_0x49ee2b[_0x9deae3][_0xa30a('0x19')]){var _0x42cd00=_0x49ee2b[_0x9deae3][_0xa30a('0x13')];if(!_0x42cd00[_0xa30a('0x1a')]&&_0x49ee2b[_0x9deae3][_0xa30a('0x1b')]!==_0xa30a('0x1c'))_0x42cd00[_0xa30a('0x1a')]=_0x49ee2b[_0x9deae3][_0xa30a('0x1b')];if(!this[_0xa30a('0xe')][_0xa30a('0x18')](_0x42cd00['id'])){this[_0xa30a('0xe')][_0x42cd00['id']]=new EmailImap(_0x42cd00,_0x49ee2b[_0x9deae3][_0xa30a('0x5')]);this['imapAccounts'][_0x42cd00['id']]['on'](_0xa30a('0x1d'),this['handleImapBox'][_0xa30a('0x1e')](this,_0x9deae3));this['imapAccounts'][_0x42cd00['id']]['on'](_0xa30a('0x5'),this[_0xa30a('0x1f')][_0xa30a('0x1e')](this,_0x9deae3));this[_0xa30a('0xe')][_0x42cd00['id']]['on'](_0xa30a('0x20'),this[_0xa30a('0x21')][_0xa30a('0x1e')](this,_0x9deae3));this[_0xa30a('0xe')][_0x42cd00['id']]['on'](_0xa30a('0x22'),this[_0xa30a('0x23')][_0xa30a('0x1e')](this,_0x9deae3));}}else{if(_[_0xa30a('0x16')](this[_0xa30a('0xd')][_0x9deae3][_0xa30a('0x13')])){this[_0xa30a('0xd')][_0x9deae3]['Imap']={};}this['mailAccounts'][_0x9deae3][_0xa30a('0x13')][_0xa30a('0x24')]=_0xa30a('0x25');this[_0xa30a('0xd')][_0x9deae3]['Imap']['messageStatus']='';this[_0xa30a('0x11')](_0x9deae3);}}}};EmailChannel[_0xa30a('0x10')][_0xa30a('0x26')]=function(_0x58a22d,_0x2cb3cd){if(this[_0xa30a('0xd')][_0x58a22d]){this['mailAccounts'][_0x58a22d][_0xa30a('0x13')][_0xa30a('0x24')]=_0xa30a('0x27');this['mailAccounts'][_0x58a22d]['Imap']['messageStatus']=_0x2cb3cd[_0xa30a('0x12')];if(_0x2cb3cd[_0xa30a('0x28')]){this[_0xa30a('0xd')][_0x58a22d][_0xa30a('0x13')][_0xa30a('0x15')]=_0x2cb3cd[_0xa30a('0x28')][_0xa30a('0x15')];}return this[_0xa30a('0x11')](_0x58a22d);}};EmailChannel[_0xa30a('0x10')][_0xa30a('0x1f')]=function(_0x4d6f2d,_0x3d8077){logger[_0xa30a('0xc')](_0xa30a('0x29'),_0x3d8077[_0xa30a('0x2a')],_0x3d8077[_0xa30a('0x2b')],_0x3d8077[_0xa30a('0x2c')],_0x4d6f2d);if(this[_0xa30a('0xd')][_0x4d6f2d]){return mailAccount['notify'](_0x4d6f2d,_0x3d8077)[_0xa30a('0x2d')](function(_0x1a8f41){if(_0x1a8f41){logger[_0xa30a('0xc')](_0xa30a('0x2e'));}})[_0xa30a('0x2f')](function(_0x589840){logger[_0xa30a('0x22')](_0xa30a('0x30'),JSON[_0xa30a('0x31')](_0x589840));});}};EmailChannel[_0xa30a('0x10')]['handleImapEnd']=function(_0x5eeded){if(this[_0xa30a('0xd')][_0x5eeded]&&this['mailAccounts'][_0x5eeded][_0xa30a('0x13')]){if(this[_0xa30a('0xe')][this[_0xa30a('0xd')][_0x5eeded][_0xa30a('0x13')]['id']]){delete this[_0xa30a('0xe')][this[_0xa30a('0xd')][_0x5eeded][_0xa30a('0x13')]['id']];}this[_0xa30a('0xd')][_0x5eeded][_0xa30a('0x13')]['lastSync']=moment();this[_0xa30a('0x11')](_0x5eeded);}};EmailChannel['prototype']['handleImapError']=function(_0x5af2a6,_0x38a167){if(this[_0xa30a('0xd')][_0x5af2a6]){this['mailAccounts'][_0x5af2a6][_0xa30a('0x13')][_0xa30a('0x24')]=_0xa30a('0x22');this[_0xa30a('0xd')][_0x5af2a6][_0xa30a('0x13')]['messageStatus']=_0x38a167;return this[_0xa30a('0x11')](_0x5af2a6);}};EmailChannel[_0xa30a('0x10')][_0xa30a('0x32')]=function(_0x5815b5,_0x244f51){return this['smtp'][_0xa30a('0x33')](_0x5815b5,_0x244f51);};EmailChannel['prototype'][_0xa30a('0x34')]=function(_0x58ffa5){var _0x1223b2=this;if(this['mailAccounts'][_0x58ffa5['id']]){if(_[_0xa30a('0x16')](this[_0xa30a('0xd')][_0x58ffa5['id']][_0xa30a('0x35')])){this[_0xa30a('0xd')][_0x58ffa5['id']]['Smtp']={};}this[_0xa30a('0xd')][_0x58ffa5['id']][_0xa30a('0x35')][_0xa30a('0x36')]=moment();return new BPromise(function(_0x52bafa,_0x54e106){return _0x1223b2[_0xa30a('0xf')][_0xa30a('0x37')](_0x58ffa5)[_0xa30a('0x2d')](function(_0x18345b){_0x1223b2[_0xa30a('0xd')][_0x58ffa5['id']]['Smtp'][_0xa30a('0x24')]='verified';_0x1223b2[_0xa30a('0xd')][_0x58ffa5['id']][_0xa30a('0x35')]['messageStatus']='';_0x1223b2[_0xa30a('0x11')](_0x58ffa5['id']);_0x52bafa(_0x18345b);})[_0xa30a('0x2f')](function(_0x30ce0b){_0x1223b2[_0xa30a('0xd')][_0x58ffa5['id']][_0xa30a('0x35')][_0xa30a('0x24')]=_0xa30a('0x22');_0x1223b2['mailAccounts'][_0x58ffa5['id']][_0xa30a('0x35')][_0xa30a('0x14')]=_0x30ce0b;_0x1223b2[_0xa30a('0x11')](_0x58ffa5['id']);_0x54e106(_0x30ce0b);});});}return this[_0xa30a('0xf')]['verify'](_0x58ffa5);};module[_0xa30a('0x38')]=EmailChannel; \ No newline at end of file +var _0x1591=['Imap','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','defaults','redis','localhost','./smtp','info','mailAccounts','imapAccounts','emit','name','key','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x1591,0xf4));var _0x1159=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0x1591[_0x1b3564];return _0x504069;};'use strict';var _=require(_0x1159('0x0'));var moment=require(_0x1159('0x1'));var BPromise=require(_0x1159('0x2'));var md5=require(_0x1159('0x3'));var Redis=require(_0x1159('0x4'));var config=require(_0x1159('0x5'));var logger=require('../../../config/logger')(_0x1159('0x6'));config['redis']=_[_0x1159('0x7')](config[_0x1159('0x8')],{'host':_0x1159('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1159('0x8')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x1159('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2ed2f3){logger[_0x1159('0xb')]('start\x20email\x20channel');this[_0x1159('0xc')]=_0x2ed2f3[_0x1159('0xc')];this[_0x1159('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x1159('0xe')]=function(_0x5066ac){var _0x30eb08=this['mailAccounts'][_0x5066ac];var _0x40aa55={'id':_0x30eb08['id'],'name':_0x30eb08[_0x1159('0xf')],'key':_0x30eb08[_0x1159('0x10')],'active':_0x30eb08['active'],'Imap':{'status':_0x30eb08['Imap'][_0x1159('0x11')],'messageStatus':_0x30eb08['Imap'][_0x1159('0x12')],'total':_0x30eb08['Imap'][_0x1159('0x13')]}};if(_[_0x1159('0x14')](md5Accounts[_0x5066ac])){md5Accounts[_0x5066ac]={};}var _0x33774f=md5(JSON[_0x1159('0x15')](_0x40aa55));if(md5Accounts[_0x5066ac]['md5']!==_0x33774f){md5Accounts[_0x5066ac][_0x1159('0x3')]=_0x33774f;io['emit'](_0x1159('0x16'),_0x40aa55);}};EmailChannel[_0x1159('0x17')][_0x1159('0x18')]=function(_0x485c8d){for(var _0x1473a9 in _0x485c8d){if(_0x485c8d[_0x1159('0x19')](_0x1473a9)){if(_0x485c8d[_0x1473a9][_0x1159('0x1a')]&&_0x485c8d[_0x1473a9]['active']){var _0x36b092=_0x485c8d[_0x1473a9][_0x1159('0x1a')];if(!_0x36b092[_0x1159('0x1b')]&&_0x485c8d[_0x1473a9][_0x1159('0x1c')]!==_0x1159('0x1d'))_0x36b092[_0x1159('0x1b')]=_0x485c8d[_0x1473a9][_0x1159('0x1c')];if(!this[_0x1159('0xd')][_0x1159('0x19')](_0x36b092['id'])){this['imapAccounts'][_0x36b092['id']]=new EmailImap(_0x36b092,_0x485c8d[_0x1473a9]['email']);this[_0x1159('0xd')][_0x36b092['id']]['on'](_0x1159('0x1e'),this[_0x1159('0x1f')][_0x1159('0x20')](this,_0x1473a9));this[_0x1159('0xd')][_0x36b092['id']]['on'](_0x1159('0x6'),this[_0x1159('0x21')]['bind'](this,_0x1473a9));this[_0x1159('0xd')][_0x36b092['id']]['on'](_0x1159('0x22'),this[_0x1159('0x23')][_0x1159('0x20')](this,_0x1473a9));this[_0x1159('0xd')][_0x36b092['id']]['on'](_0x1159('0x24'),this[_0x1159('0x25')][_0x1159('0x20')](this,_0x1473a9));}}else{if(_[_0x1159('0x14')](this[_0x1159('0xc')][_0x1473a9][_0x1159('0x1a')])){this[_0x1159('0xc')][_0x1473a9]['Imap']={};}this[_0x1159('0xc')][_0x1473a9]['Imap'][_0x1159('0x11')]=_0x1159('0x26');this['mailAccounts'][_0x1473a9][_0x1159('0x1a')]['messageStatus']='';this['emit'](_0x1473a9);}}}};EmailChannel[_0x1159('0x17')][_0x1159('0x1f')]=function(_0x4631e4,_0x48725f){if(this[_0x1159('0xc')][_0x4631e4]){this[_0x1159('0xc')][_0x4631e4]['Imap'][_0x1159('0x11')]=_0x1159('0x27');this['mailAccounts'][_0x4631e4]['Imap']['messageStatus']=_0x48725f[_0x1159('0xf')];if(_0x48725f[_0x1159('0x28')]){this[_0x1159('0xc')][_0x4631e4][_0x1159('0x1a')]['total']=_0x48725f['messages'][_0x1159('0x13')];}return this[_0x1159('0xe')](_0x4631e4);}};EmailChannel[_0x1159('0x17')][_0x1159('0x21')]=function(_0x3c37ef,_0x16cfa3){logger[_0x1159('0xb')](_0x1159('0x29'),_0x16cfa3[_0x1159('0x2a')],_0x16cfa3[_0x1159('0x2b')],_0x16cfa3['from'],_0x3c37ef);if(this['mailAccounts'][_0x3c37ef]){return mailAccount[_0x1159('0x2c')](_0x3c37ef,_0x16cfa3)['then'](function(_0x27d2a2){if(_0x27d2a2){logger[_0x1159('0xb')](_0x1159('0x2d'));}})[_0x1159('0x2e')](function(_0x21f01d){logger[_0x1159('0x24')](_0x1159('0x2f'),JSON[_0x1159('0x15')](_0x21f01d));});}};EmailChannel[_0x1159('0x17')]['handleImapEnd']=function(_0x554dc6){if(this['mailAccounts'][_0x554dc6]&&this[_0x1159('0xc')][_0x554dc6][_0x1159('0x1a')]){if(this[_0x1159('0xd')][this['mailAccounts'][_0x554dc6][_0x1159('0x1a')]['id']]){delete this[_0x1159('0xd')][this[_0x1159('0xc')][_0x554dc6][_0x1159('0x1a')]['id']];}this[_0x1159('0xc')][_0x554dc6][_0x1159('0x1a')]['lastSync']=moment();this[_0x1159('0xe')](_0x554dc6);}};EmailChannel[_0x1159('0x17')]['handleImapError']=function(_0x50821d,_0xc1dfb1){if(this['mailAccounts'][_0x50821d]){this[_0x1159('0xc')][_0x50821d][_0x1159('0x1a')][_0x1159('0x11')]=_0x1159('0x24');this[_0x1159('0xc')][_0x50821d][_0x1159('0x1a')]['messageStatus']=_0xc1dfb1;return this['emit'](_0x50821d);}};EmailChannel[_0x1159('0x17')]['sendMail']=function(_0xb213af,_0x52d416){return this['smtp'][_0x1159('0x30')](_0xb213af,_0x52d416);};EmailChannel[_0x1159('0x17')][_0x1159('0x31')]=function(_0x34b53c){var _0x48d450=this;if(this[_0x1159('0xc')][_0x34b53c['id']]){if(_[_0x1159('0x14')](this[_0x1159('0xc')][_0x34b53c['id']][_0x1159('0x32')])){this[_0x1159('0xc')][_0x34b53c['id']][_0x1159('0x32')]={};}this[_0x1159('0xc')][_0x34b53c['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x12e42a,_0x476eae){return _0x48d450['smtp'][_0x1159('0x33')](_0x34b53c)['then'](function(_0x22b05a){_0x48d450[_0x1159('0xc')][_0x34b53c['id']]['Smtp'][_0x1159('0x11')]=_0x1159('0x34');_0x48d450[_0x1159('0xc')][_0x34b53c['id']][_0x1159('0x32')]['messageStatus']='';_0x48d450[_0x1159('0xe')](_0x34b53c['id']);_0x12e42a(_0x22b05a);})['catch'](function(_0xb61721){_0x48d450[_0x1159('0xc')][_0x34b53c['id']][_0x1159('0x32')][_0x1159('0x11')]='error';_0x48d450['mailAccounts'][_0x34b53c['id']][_0x1159('0x32')][_0x1159('0x12')]=_0xb61721;_0x48d450['emit'](_0x34b53c['id']);_0x476eae(_0xb61721);});});}return this['smtp'][_0x1159('0x33')](_0x34b53c);};module[_0x1159('0x35')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 7955baa..1bda369 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 _0x4ba9=['tls','required','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageEnd','handleMessageBody','handleMessageAttributes','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','generateXOAuth2Token','CloudProvider','data5','password','anonymous@xcally.com','host','port'];(function(_0x3ad8b1,_0x11b5f2){var _0x171c6d=function(_0x3a57c8){while(--_0x3a57c8){_0x3ad8b1['push'](_0x3ad8b1['shift']());}};_0x171c6d(++_0x11b5f2);}(_0x4ba9,0x18f));var _0x94ba=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x4ba9[_0x5e709a];return _0x57401a;};'use strict';var _=require(_0x94ba('0x0'));var util=require(_0x94ba('0x1'));var Imap=require(_0x94ba('0x2'));var simpleParser=require(_0x94ba('0x3'))['simpleParser'];var Iconv=require(_0x94ba('0x4'))[_0x94ba('0x5')];var EventEmitter=require(_0x94ba('0x6'))[_0x94ba('0x7')];var utils=require(_0x94ba('0x8'));var logger=require(_0x94ba('0x9'))(_0x94ba('0xa'));function EmailImap(_0x494061,_0x3aa516){this[_0x94ba('0xb')]=_0x494061['mailbox'];this[_0x94ba('0xc')]=this[_0x94ba('0xd')](_0x494061,_0x3aa516);this[_0x94ba('0x2')]=new Imap(this[_0x94ba('0xc')]);this[_0x94ba('0x2')]['once'](_0x94ba('0xe'),this[_0x94ba('0xf')][_0x94ba('0x10')](this));this['imap'][_0x94ba('0x11')](_0x94ba('0x12'),this[_0x94ba('0x13')]['bind'](this));this['imap']['on']('error',this[_0x94ba('0x14')][_0x94ba('0x10')](this));this[_0x94ba('0x2')][_0x94ba('0x15')]();}util[_0x94ba('0x16')](EmailImap,EventEmitter);EmailImap[_0x94ba('0x17')][_0x94ba('0xd')]=function(_0xc092,_0x44e354){var _0x1a64a5={'connTimeout':_0xc092[_0x94ba('0x18')]?_0xc092['connTimeout']*0x3e8:0x2710,'authTimeout':_0xc092[_0x94ba('0x19')]?_0xc092[_0x94ba('0x19')]*0x3e8:0x1388};if(_0xc092[_0x94ba('0x1a')]){_0x1a64a5[_0x94ba('0x1b')]=_0xc092['user'];if(_0xc092['modernAuthentication']){_0x1a64a5['xoauth2']=utils[_0x94ba('0x1c')](_0xc092[_0x94ba('0x1d')][_0x94ba('0x1e')],_0xc092['user']);}else{_0x1a64a5[_0x94ba('0x1f')]=_0xc092[_0x94ba('0x1f')];}}else{if(_0xc092['authentication']){_0x1a64a5[_0x94ba('0x1b')]=_0xc092[_0x94ba('0x1b')];_0x1a64a5['password']=_0xc092['password'];}}_0x1a64a5[_0x94ba('0xa')]=_0x44e354||_0xc092['user']||_0x94ba('0x20');_0x1a64a5[_0x94ba('0x21')]=_0xc092[_0x94ba('0x21')];_0x1a64a5[_0x94ba('0x22')]=_0xc092[_0x94ba('0x22')]||0x3e1;if(_0xc092['tls']){_0x1a64a5[_0x94ba('0x23')]=!![];}else{_0x1a64a5[_0x94ba('0x23')]=![];_0x1a64a5['autotls']=_0x94ba('0x24');}return _0x1a64a5;};EmailImap['prototype']['handleReady']=function(){this[_0x94ba('0x2')][_0x94ba('0x25')](this['mailbox'],![],this[_0x94ba('0x26')][_0x94ba('0x10')](this));};EmailImap[_0x94ba('0x17')]['handleOpenBox']=function(_0x344c8d,_0x393370){if(_0x344c8d){this[_0x94ba('0x14')](_0x344c8d,!![]);}else{this[_0x94ba('0x27')]('box',_0x393370);this[_0x94ba('0x28')]();}};EmailImap[_0x94ba('0x17')][_0x94ba('0x29')]=function(_0x14a2af){if(_0x14a2af){this[_0x94ba('0x14')](_0x14a2af,!![]);}else{this['imap']['end']();}};EmailImap[_0x94ba('0x17')][_0x94ba('0x28')]=function(){this[_0x94ba('0x2')]['search']([_0x94ba('0x2a')],this['handleReadUnseen']['bind'](this));};EmailImap[_0x94ba('0x17')][_0x94ba('0x2b')]=function(_0xda464d,_0x348c76){if(_0xda464d){this[_0x94ba('0x14')](_0xda464d,!![]);}else{if(_0x348c76[_0x94ba('0x2c')]){try{var _0x53eb12=this[_0x94ba('0x2')][_0x94ba('0x2d')](_0x348c76,{'bodies':'','markSeen':!![]});_0x53eb12['on']('message',this[_0x94ba('0x2e')][_0x94ba('0x10')](this));_0x53eb12[_0x94ba('0x11')](_0x94ba('0x2f'),this[_0x94ba('0x30')]['bind'](this));_0x53eb12['once']('end',this[_0x94ba('0x31')][_0x94ba('0x10')](this));}catch(_0x3dbf70){logger[_0x94ba('0x2f')](_0x3dbf70);}}else{this[_0x94ba('0x2')][_0x94ba('0x32')](!![],this[_0x94ba('0x29')]['bind'](this));}}};EmailImap[_0x94ba('0x17')]['handleFetchMessage']=function(_0x2398cf){_0x2398cf['on'](_0x94ba('0x33'),this['handleMessageBody'][_0x94ba('0x10')](this));_0x2398cf[_0x94ba('0x11')]('attributes',this['handleMessageAttributes'][_0x94ba('0x10')](this));_0x2398cf[_0x94ba('0x11')]('end',this[_0x94ba('0x34')][_0x94ba('0x10')](this));};EmailImap['prototype'][_0x94ba('0x35')]=function(_0x3087f4){simpleParser(_0x3087f4,{'Iconv':Iconv},this['handleSimpleParser'][_0x94ba('0x10')](this));};EmailImap[_0x94ba('0x17')][_0x94ba('0x36')]=function(){};EmailImap[_0x94ba('0x17')][_0x94ba('0x34')]=function(){};EmailImap[_0x94ba('0x17')][_0x94ba('0x37')]=function(_0x27b3ef,_0x424720){if(_0x27b3ef){logger[_0x94ba('0x2f')](_0x27b3ef);}else{var _0x800111=this;utils[_0x94ba('0x38')](this['account'],_0x424720,function(_0x665a1){_0x800111['emit']('email',_0x665a1);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x94ba('0x2')][_0x94ba('0x32')](!![],this[_0x94ba('0x29')][_0x94ba('0x10')](this));};EmailImap['prototype'][_0x94ba('0x30')]=function(_0x467132){this[_0x94ba('0x14')](_0x467132);this['imap'][_0x94ba('0x32')](!![],this[_0x94ba('0x29')][_0x94ba('0x10')](this));};EmailImap[_0x94ba('0x17')][_0x94ba('0x13')]=function(){this[_0x94ba('0x27')](_0x94ba('0x12'));};EmailImap[_0x94ba('0x17')][_0x94ba('0x14')]=function(_0x8200,_0x546e41){logger[_0x94ba('0x2f')](_0x94ba('0x14'),this[_0x94ba('0xc')][_0x94ba('0xa')],JSON[_0x94ba('0x39')](_0x8200));var _0xf58b5f='';if(_0x8200){if(_0x8200['textCode']){_0xf58b5f=_0x8200[_0x94ba('0x3a')];}else{for(var _0x7bdf6f in _0x8200){if(_0x8200[_0x94ba('0x3b')](_0x7bdf6f)){_0xf58b5f+=_[_0x94ba('0x3c')](_0x7bdf6f)+':\x20'+_0x8200[_0x7bdf6f]+'\x0a';}}}}if(_0x546e41){this[_0x94ba('0x2')][_0x94ba('0x12')]();}else{this[_0x94ba('0x27')](_0x94ba('0x2f'),_0xf58b5f);this[_0x94ba('0x27')](_0x94ba('0x12'));}};module[_0x94ba('0x3d')]=EmailImap; \ No newline at end of file +var _0xaadf=['handleReadUnseen','length','fetch','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleFetchMessage','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','once','ready','bind','end','handleEnd','error','handleError','inherits','connTimeout','authTimeout','service','user','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','tls','autotls','required','prototype','handleReady','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN'];(function(_0x431dbc,_0x1cd214){var _0x2e5bed=function(_0x1d3faf){while(--_0x1d3faf){_0x431dbc['push'](_0x431dbc['shift']());}};_0x2e5bed(++_0x1cd214);}(_0xaadf,0x114));var _0xfaad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaadf[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfaad('0x0'));var util=require(_0xfaad('0x1'));var Imap=require(_0xfaad('0x2'));var simpleParser=require('mailparser')[_0xfaad('0x3')];var Iconv=require('iconv')[_0xfaad('0x4')];var EventEmitter=require(_0xfaad('0x5'))[_0xfaad('0x6')];var utils=require(_0xfaad('0x7'));var logger=require(_0xfaad('0x8'))('email');function EmailImap(_0x320228,_0x3418ce){this[_0xfaad('0x9')]=_0x320228[_0xfaad('0x9')];this[_0xfaad('0xa')]=this[_0xfaad('0xb')](_0x320228,_0x3418ce);this[_0xfaad('0x2')]=new Imap(this[_0xfaad('0xa')]);this[_0xfaad('0x2')][_0xfaad('0xc')](_0xfaad('0xd'),this['handleReady'][_0xfaad('0xe')](this));this[_0xfaad('0x2')][_0xfaad('0xc')](_0xfaad('0xf'),this[_0xfaad('0x10')][_0xfaad('0xe')](this));this[_0xfaad('0x2')]['on'](_0xfaad('0x11'),this[_0xfaad('0x12')][_0xfaad('0xe')](this));this[_0xfaad('0x2')]['connect']();}util[_0xfaad('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0xfaad('0xb')]=function(_0x2e4177,_0x2844c5){var _0x6dae3e={'connTimeout':_0x2e4177[_0xfaad('0x14')]?_0x2e4177[_0xfaad('0x14')]*0x3e8:0x2710,'authTimeout':_0x2e4177[_0xfaad('0x15')]?_0x2e4177[_0xfaad('0x15')]*0x3e8:0x1388};if(_0x2e4177[_0xfaad('0x16')]){_0x6dae3e[_0xfaad('0x17')]=_0x2e4177[_0xfaad('0x17')];if(_0x2e4177['modernAuthentication']){_0x6dae3e['xoauth2']=utils[_0xfaad('0x18')](_0x2e4177[_0xfaad('0x19')][_0xfaad('0x1a')],_0x2e4177[_0xfaad('0x17')]);}else{_0x6dae3e[_0xfaad('0x1b')]=_0x2e4177[_0xfaad('0x1b')];}}else{if(_0x2e4177[_0xfaad('0x1c')]){_0x6dae3e['user']=_0x2e4177[_0xfaad('0x17')];_0x6dae3e[_0xfaad('0x1b')]=_0x2e4177['password'];}}_0x6dae3e[_0xfaad('0x1d')]=_0x2844c5||_0x2e4177[_0xfaad('0x17')]||_0xfaad('0x1e');_0x6dae3e['host']=_0x2e4177[_0xfaad('0x1f')];_0x6dae3e['port']=_0x2e4177['port']||0x3e1;if(_0x2e4177[_0xfaad('0x20')]){_0x6dae3e[_0xfaad('0x20')]=!![];}else{_0x6dae3e['tls']=![];_0x6dae3e[_0xfaad('0x21')]=_0xfaad('0x22');}return _0x6dae3e;};EmailImap[_0xfaad('0x23')][_0xfaad('0x24')]=function(){this[_0xfaad('0x2')][_0xfaad('0x25')](this[_0xfaad('0x9')],![],this[_0xfaad('0x26')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')][_0xfaad('0x26')]=function(_0x5aa382,_0x376c94){if(_0x5aa382){this[_0xfaad('0x12')](_0x5aa382,!![]);}else{this[_0xfaad('0x27')](_0xfaad('0x28'),_0x376c94);this[_0xfaad('0x29')]();}};EmailImap[_0xfaad('0x23')]['handleCloseBox']=function(_0x4a9dc7){if(_0x4a9dc7){this[_0xfaad('0x12')](_0x4a9dc7,!![]);}else{this[_0xfaad('0x2')][_0xfaad('0xf')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xfaad('0x2')][_0xfaad('0x2a')]([_0xfaad('0x2b')],this[_0xfaad('0x2c')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')]['handleReadUnseen']=function(_0x54712e,_0x367655){if(_0x54712e){this[_0xfaad('0x12')](_0x54712e,!![]);}else{if(_0x367655[_0xfaad('0x2d')]){try{var _0x2688a9=this[_0xfaad('0x2')][_0xfaad('0x2e')](_0x367655,{'bodies':'','markSeen':!![]});_0x2688a9['on']('message',this['handleFetchMessage'][_0xfaad('0xe')](this));_0x2688a9['once'](_0xfaad('0x11'),this[_0xfaad('0x2f')]['bind'](this));_0x2688a9['once'](_0xfaad('0xf'),this[_0xfaad('0x30')]['bind'](this));}catch(_0xf7dad2){logger[_0xfaad('0x11')](_0xf7dad2);}}else{this[_0xfaad('0x2')][_0xfaad('0x31')](!![],this[_0xfaad('0x32')]['bind'](this));}}};EmailImap[_0xfaad('0x23')][_0xfaad('0x33')]=function(_0x4b7c4b){_0x4b7c4b['on'](_0xfaad('0x34'),this['handleMessageBody']['bind'](this));_0x4b7c4b[_0xfaad('0xc')](_0xfaad('0x35'),this['handleMessageAttributes'][_0xfaad('0xe')](this));_0x4b7c4b['once'](_0xfaad('0xf'),this[_0xfaad('0x36')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')][_0xfaad('0x37')]=function(_0x7ed1a3){simpleParser(_0x7ed1a3,{'Iconv':Iconv},this[_0xfaad('0x38')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')][_0xfaad('0x39')]=function(){};EmailImap['prototype'][_0xfaad('0x36')]=function(){};EmailImap[_0xfaad('0x23')][_0xfaad('0x38')]=function(_0x1feac6,_0x15894b){if(_0x1feac6){logger[_0xfaad('0x11')](_0x1feac6);}else{var _0x577a42=this;utils[_0xfaad('0x3a')](this[_0xfaad('0xa')],_0x15894b,function(_0x5a22be){_0x577a42[_0xfaad('0x27')](_0xfaad('0x1d'),_0x5a22be);});}};EmailImap[_0xfaad('0x23')][_0xfaad('0x30')]=function(){this['imap'][_0xfaad('0x31')](!![],this[_0xfaad('0x32')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')][_0xfaad('0x2f')]=function(_0xdace4d){this['handleError'](_0xdace4d);this[_0xfaad('0x2')][_0xfaad('0x31')](!![],this[_0xfaad('0x32')][_0xfaad('0xe')](this));};EmailImap[_0xfaad('0x23')][_0xfaad('0x10')]=function(){this[_0xfaad('0x27')](_0xfaad('0xf'));};EmailImap[_0xfaad('0x23')][_0xfaad('0x12')]=function(_0x4a7406,_0x3766ba){logger[_0xfaad('0x11')](_0xfaad('0x12'),this[_0xfaad('0xa')]['email'],JSON[_0xfaad('0x3b')](_0x4a7406));var _0x2748a0='';if(_0x4a7406){if(_0x4a7406[_0xfaad('0x3c')]){_0x2748a0=_0x4a7406[_0xfaad('0x3c')];}else{for(var _0x31296e in _0x4a7406){if(_0x4a7406[_0xfaad('0x3d')](_0x31296e)){_0x2748a0+=_[_0xfaad('0x3e')](_0x31296e)+':\x20'+_0x4a7406[_0x31296e]+'\x0a';}}}}if(_0x3766ba){this[_0xfaad('0x2')][_0xfaad('0xf')]();}else{this[_0xfaad('0x27')]('error',_0x2748a0);this[_0xfaad('0x27')](_0xfaad('0xf'));}};module[_0xfaad('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 6697338..9da6184 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2ed=['toString','Not\x20verifired','exports','nodemailer','prototype','send','createTransport','use','sendMail','verify'];(function(_0x3c3cc0,_0x26af62){var _0x1ee282=function(_0x4872a3){while(--_0x4872a3){_0x3c3cc0['push'](_0x3c3cc0['shift']());}};_0x1ee282(++_0x26af62);}(_0xb2ed,0xdf));var _0xdb2e=function(_0x4d180c,_0x45c68e){_0x4d180c=_0x4d180c-0x0;var _0x49b57e=_0xb2ed[_0x4d180c];return _0x49b57e;};'use strict';var nodemailer=require(_0xdb2e('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xdb2e('0x1')][_0xdb2e('0x2')]=function(_0x363b6b,_0x5ae36d){return new Promise(function(_0x5a24c6,_0x35fd89){var _0x2d52dc=nodemailer[_0xdb2e('0x3')](_0x363b6b);_0x2d52dc[_0xdb2e('0x4')]('compile',inlineBase64());_0x2d52dc[_0xdb2e('0x5')](_0x5ae36d,function(_0x4c9555,_0x597afb){if(_0x4c9555){_0x35fd89(_0x4c9555['toString']());}else{_0x5a24c6(_0x597afb);}});});};EmailSmtp[_0xdb2e('0x1')][_0xdb2e('0x6')]=function(_0xa16c6c){return new Promise(function(_0x7a4a33,_0x148954){var _0x484a03=nodemailer[_0xdb2e('0x3')](_0xa16c6c);_0x484a03[_0xdb2e('0x6')](function(_0x534968,_0x545a18){if(_0x534968){_0x148954(_0x534968[_0xdb2e('0x7')]());}else{if(_0x545a18){_0x7a4a33(_0x545a18);}else{_0x148954(_0xdb2e('0x8'));}}});});};module[_0xdb2e('0x9')]=EmailSmtp; \ No newline at end of file +var _0xbb4e=['compile','sendMail','verify','toString','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use'];(function(_0x2ced4f,_0x3e2bec){var _0x4cf01a=function(_0x1c0a08){while(--_0x1c0a08){_0x2ced4f['push'](_0x2ced4f['shift']());}};_0x4cf01a(++_0x3e2bec);}(_0xbb4e,0x7d));var _0xebb4=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0xbb4e[_0x2f54b6];return _0x169f21;};'use strict';var nodemailer=require(_0xebb4('0x0'));var inlineBase64=require(_0xebb4('0x1'));function EmailSmtp(){}EmailSmtp[_0xebb4('0x2')]['send']=function(_0x491e14,_0x350236){return new Promise(function(_0x154ede,_0x2872bd){var _0x380eb9=nodemailer[_0xebb4('0x3')](_0x491e14);_0x380eb9[_0xebb4('0x4')](_0xebb4('0x5'),inlineBase64());_0x380eb9[_0xebb4('0x6')](_0x350236,function(_0x1c95bd,_0x2a6f43){if(_0x1c95bd){_0x2872bd(_0x1c95bd['toString']());}else{_0x154ede(_0x2a6f43);}});});};EmailSmtp[_0xebb4('0x2')][_0xebb4('0x7')]=function(_0x36d77a){return new Promise(function(_0x579053,_0x15a2d8){var _0x5d79fd=nodemailer[_0xebb4('0x3')](_0x36d77a);_0x5d79fd[_0xebb4('0x7')](function(_0x200168,_0x2b8c9d){if(_0x200168){_0x15a2d8(_0x200168[_0xebb4('0x8')]());}else{if(_0x2b8c9d){_0x579053(_0x2b8c9d);}else{_0x15a2d8('Not\x20verifired');}}});});};module[_0xebb4('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index b718ed4..1a14511 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb83=['forEach','filename','replace','_SRC','_IMG','\x20[Attachment:\x20','textAsHtml','body','Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','generate','name','substring','indexOf','split','length','slice','join','Anonymous','pop','test','html','includes','attachments'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xfb83,0x78));var _0x3fb8=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0xfb83[_0x259d17];return _0x407535;};'use strict';var _=require(_0x3fb8('0x0'));var moment=require(_0x3fb8('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x3fb8('0x2'));var util=require(_0x3fb8('0x3'));var tnef=require('node-tnef');var logger=require(_0x3fb8('0x4'))('email');var config=require(_0x3fb8('0x5'));function getAddress(_0x37fc9a){var _0x3cadad=_[_0x3fb8('0x6')](_0x37fc9a[_0x3fb8('0x7')]);return _0x3cadad&&_0x3cadad[_0x3fb8('0x8')]?_0x3cadad[_0x3fb8('0x8')]:_0x3fb8('0x9')+random[_0x3fb8('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x9e3fc6){var _0x59d9de=_[_0x3fb8('0x6')](_0x9e3fc6[_0x3fb8('0x7')]);if(_0x59d9de&&_0x59d9de[_0x3fb8('0xb')]){if(_0x59d9de[_0x3fb8('0xb')]==_0x59d9de[_0x3fb8('0x8')]){return _0x59d9de[_0x3fb8('0xb')][_0x3fb8('0xc')](0x0,_0x59d9de[_0x3fb8('0xb')][_0x3fb8('0xd')]('@'));}var _0x26ed8f=_0x59d9de[_0x3fb8('0xb')][_0x3fb8('0xe')](/\s+/);return _0x26ed8f[_0x3fb8('0xf')]>0x1?_0x26ed8f[_0x3fb8('0x10')](0x0,-0x1)[_0x3fb8('0x11')]('\x20'):_0x59d9de[_0x3fb8('0xb')];}return _0x3fb8('0x12');}function getLastName(_0x303432){var _0x5782d6=_[_0x3fb8('0x6')](_0x303432['value']);if(_0x5782d6&&_0x5782d6['name']){var _0x267c69=_0x5782d6[_0x3fb8('0xb')][_0x3fb8('0xe')](/\s+/);return _0x267c69[_0x3fb8('0xf')]>0x1?_0x267c69[_0x3fb8('0x13')]():'';}return'';}function getMails(_0x4b84f3,_0x6b0c85){var _0x5ae8cb='';for(var _0xaa6923=0x0;_0xaa6923<_0x6b0c85[_0x3fb8('0x7')]['length'];_0xaa6923+=0x1){if(_0x6b0c85[_0x3fb8('0x7')][_0xaa6923][_0x3fb8('0x8')]!==_0x4b84f3){if(!_['isEmpty'](_0x5ae8cb)){_0x5ae8cb+=',';}_0x5ae8cb+=_0x6b0c85[_0x3fb8('0x7')][_0xaa6923][_0x3fb8('0xb')]||_0x6b0c85[_0x3fb8('0x7')][_0xaa6923]['address']||'';_0x5ae8cb+='\x20<';_0x5ae8cb+=_0x6b0c85[_0x3fb8('0x7')][_0xaa6923][_0x3fb8('0x8')]?_0x6b0c85[_0x3fb8('0x7')][_0xaa6923]['address']:'anonymous'+random[_0x3fb8('0xa')](0x6)+'@xcally.com';_0x5ae8cb+='>';}}return _0x5ae8cb;}function parseEmail(_0x74b970,_0x4bdbe2,_0x533b59){if(_0x4bdbe2['html']){var _0x317cee=/)<[^<]*)*<\/script>/gi;while(_0x317cee[_0x3fb8('0x14')](_0x4bdbe2['html'])){_0x4bdbe2[_0x3fb8('0x15')]=_0x4bdbe2['html']['replace'](_0x317cee,'');}if(_0x4bdbe2['html'][_0x3fb8('0x16')]('{_0x52e31a['push'](_0x12a06e[_0x3fb8('0x19')]);});var _0x5a2efd=/]+>/g;var _0x4f49b3=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x460f53=_0x4bdbe2[_0x3fb8('0x15')][_0x3fb8('0x1a')](_0x4f49b3,_0x3fb8('0x1b'));var _0x4defc4=_0x460f53[_0x3fb8('0x1a')](_0x5a2efd,_0x3fb8('0x1c'));for(let _0xcfd23f=0x0;_0xcfd23f<_0x52e31a[_0x3fb8('0xf')];_0xcfd23f++){var _0x2a2a6a=_0x4defc4[_0x3fb8('0x1a')]('_IMG',_0x3fb8('0x1d')+_0x52e31a[_0xcfd23f]+'\x20]');_0x4defc4=_0x2a2a6a;}_0x4bdbe2['html']=_0x4defc4;}_0x533b59['body']=_0x4bdbe2[_0x3fb8('0x15')];}else{_0x533b59['body']=_0x4bdbe2[_0x3fb8('0x1e')];}if(_0x533b59[_0x3fb8('0x1f')]){_0x533b59['body']=_0x533b59['body']['replace'](/0x0){var _0x5a11bf=['Auto-Submitted:\x20auto-replied',_0x3fb8('0x32'),_0x3fb8('0x33')];for(var _0x278863=0x0;_0x278863<_0x4bdbe2[_0x3fb8('0x31')][_0x3fb8('0xf')];_0x278863++){var _0x683494=_[_0x3fb8('0xd')](_0x5a11bf,_0x4bdbe2[_0x3fb8('0x31')][_0x278863]['line']);if(_0x683494>=0x0){_0x533b59[_0x3fb8('0x34')]=!![];}}}return _0x533b59;}exports[_0x3fb8('0x35')]=function(_0xe17a40,_0x18a913,_0x5928bf){var _0x2ef290={'from':getAddress(_0x18a913[_0x3fb8('0x36')]),'firstName':getFirstName(_0x18a913[_0x3fb8('0x36')]),'lastName':getLastName(_0x18a913[_0x3fb8('0x36')]),'mapKey':_0x3fb8('0x24'),'message':{'from':getMails(_0xe17a40[_0x3fb8('0x24')],_0x18a913[_0x3fb8('0x36')]),'to':_0xe17a40['email'],'cc':'','subject':_0x18a913[_0x3fb8('0x37')]||'','messageId':_0x18a913[_0x3fb8('0x38')],'inReplyTo':_0x18a913['inReplyTo'],'sentAt':moment(_0x18a913[_0x3fb8('0x39')])[_0x3fb8('0x2a')](_0x3fb8('0x3a')),'attach':![],'attachments':[]}};if(!_0x18a913[_0x3fb8('0x15')]&&!_0x18a913['textAsHtml']){var _0x47294c=_[_0x3fb8('0x3b')](_0x18a913[_0x3fb8('0x17')],{'contentType':'application/ms-tnef'});if(_0x47294c[_0x3fb8('0xf')]){logger['info'](util[_0x3fb8('0x2a')](_0x3fb8('0x3c'),_0x18a913['messageId']));tnef[_0x3fb8('0x3d')](_[_0x3fb8('0x3e')](_0x47294c)[_0x3fb8('0x2e')],function(_0x5ae25c,_0x3f5fa2){if(_0x3f5fa2){_0x18a913[_0x3fb8('0x15')]=_0x3f5fa2[_0x3fb8('0x3f')]||'

Empty\x20message

';if(_0x3f5fa2[_0x3fb8('0x40')]){for(var _0x59a1db=0x0;_0x59a1db<_0x3f5fa2['Attachments'][_0x3fb8('0xf')];_0x59a1db++){var _0x156f56=_0x3f5fa2[_0x3fb8('0x40')][_0x59a1db];_0x2ef290[_0x3fb8('0x25')][_0x3fb8('0x17')][_0x3fb8('0x2f')]({'filename':_0x156f56['Title'],'content':Buffer['from'](_0x156f56[_0x3fb8('0x41')])});}}}_0x5928bf(parseEmail(_0xe17a40,_0x18a913,_0x2ef290));});}else{_0x18a913[_0x3fb8('0x15')]=_0x3fb8('0x42');_0x5928bf(parseEmail(_0xe17a40,_0x18a913,_0x2ef290));}}else{_0x5928bf(parseEmail(_0xe17a40,_0x18a913,_0x2ef290));}};exports[_0x3fb8('0x43')]=function(_0x2ed2af,_0x412aae){var _0x78f9ac=['user='+(_0x412aae||''),_0x3fb8('0x44')+_0x2ed2af,'',''];return Buffer[_0x3fb8('0x36')](_0x78f9ac['join'](''),_0x3fb8('0x45'))[_0x3fb8('0x46')](_0x3fb8('0x47'));}; \ No newline at end of file +var _0xa4bb=['info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','address','anonymous','generate','value','name','substring','split','slice','join','Anonymous','length','pop','isEmpty','@xcally.com','html','test','replace','includes','attachments','forEach','push','filename','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x403306[_0xba4b('0x10')](0x0,-0x1)[_0xba4b('0x11')]('\x20'):_0x3b0e52[_0xba4b('0xd')];}return _0xba4b('0x12');}function getLastName(_0x3f40cf){var _0x336b06=_[_0xba4b('0x8')](_0x3f40cf[_0xba4b('0xc')]);if(_0x336b06&&_0x336b06['name']){var _0xe5108d=_0x336b06[_0xba4b('0xd')][_0xba4b('0xf')](/\s+/);return _0xe5108d[_0xba4b('0x13')]>0x1?_0xe5108d[_0xba4b('0x14')]():'';}return'';}function getMails(_0x446249,_0x41d5e3){var _0x2881ff='';for(var _0x165a91=0x0;_0x165a91<_0x41d5e3[_0xba4b('0xc')]['length'];_0x165a91+=0x1){if(_0x41d5e3['value'][_0x165a91][_0xba4b('0x9')]!==_0x446249){if(!_[_0xba4b('0x15')](_0x2881ff)){_0x2881ff+=',';}_0x2881ff+=_0x41d5e3[_0xba4b('0xc')][_0x165a91][_0xba4b('0xd')]||_0x41d5e3[_0xba4b('0xc')][_0x165a91][_0xba4b('0x9')]||'';_0x2881ff+='\x20<';_0x2881ff+=_0x41d5e3[_0xba4b('0xc')][_0x165a91]['address']?_0x41d5e3[_0xba4b('0xc')][_0x165a91][_0xba4b('0x9')]:_0xba4b('0xa')+random[_0xba4b('0xb')](0x6)+_0xba4b('0x16');_0x2881ff+='>';}}return _0x2881ff;}function parseEmail(_0x54493d,_0x3d4b73,_0x7c7a88){if(_0x3d4b73[_0xba4b('0x17')]){var _0x4b9de1=/)<[^<]*)*<\/script>/gi;while(_0x4b9de1[_0xba4b('0x18')](_0x3d4b73[_0xba4b('0x17')])){_0x3d4b73[_0xba4b('0x17')]=_0x3d4b73['html'][_0xba4b('0x19')](_0x4b9de1,'');}if(_0x3d4b73['html'][_0xba4b('0x1a')]('{_0x18effd[_0xba4b('0x1d')](_0x3c0667[_0xba4b('0x1e')]);});var _0x40ccaf=/]+>/g;var _0x2efbf1=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1e4b46=_0x3d4b73[_0xba4b('0x17')][_0xba4b('0x19')](_0x2efbf1,'_SRC');var _0x1827de=_0x1e4b46['replace'](_0x40ccaf,'_IMG');for(let _0x2250a1=0x0;_0x2250a1<_0x18effd['length'];_0x2250a1++){var _0x416d48=_0x1827de[_0xba4b('0x19')]('_IMG',_0xba4b('0x1f')+_0x18effd[_0x2250a1]+_0xba4b('0x20'));_0x1827de=_0x416d48;}_0x3d4b73[_0xba4b('0x17')]=_0x1827de;}_0x7c7a88[_0xba4b('0x21')]=_0x3d4b73['html'];}else{_0x7c7a88[_0xba4b('0x21')]=_0x3d4b73[_0xba4b('0x22')];}if(_0x7c7a88[_0xba4b('0x21')]){_0x7c7a88[_0xba4b('0x21')]=_0x7c7a88[_0xba4b('0x21')]['replace'](/0x0){var _0x58a6fb=[_0xba4b('0x30'),_0xba4b('0x31'),_0xba4b('0x32')];for(var _0x1260ef=0x0;_0x1260ef<_0x3d4b73['headerLines'][_0xba4b('0x13')];_0x1260ef++){var _0x3a270b=_['indexOf'](_0x58a6fb,_0x3d4b73[_0xba4b('0x2f')][_0x1260ef][_0xba4b('0x33')]);if(_0x3a270b>=0x0){_0x7c7a88['isAutoreply']=!![];}}}return _0x7c7a88;}exports[_0xba4b('0x34')]=function(_0x935542,_0x591e0d,_0x31b6b9){var _0x1277ae={'from':getAddress(_0x591e0d[_0xba4b('0x35')]),'firstName':getFirstName(_0x591e0d[_0xba4b('0x35')]),'lastName':getLastName(_0x591e0d[_0xba4b('0x35')]),'mapKey':_0xba4b('0x25'),'message':{'from':getMails(_0x935542[_0xba4b('0x25')],_0x591e0d[_0xba4b('0x35')]),'to':_0x935542['email'],'cc':'','subject':_0x591e0d[_0xba4b('0x36')]||'','messageId':_0x591e0d[_0xba4b('0x37')],'inReplyTo':_0x591e0d[_0xba4b('0x38')],'sentAt':moment(_0x591e0d['date'])['format'](_0xba4b('0x39')),'attach':![],'attachments':[]}};if(!_0x591e0d[_0xba4b('0x17')]&&!_0x591e0d[_0xba4b('0x22')]){var _0x5f24bc=_[_0xba4b('0x3a')](_0x591e0d[_0xba4b('0x1b')],{'contentType':_0xba4b('0x3b')});if(_0x5f24bc[_0xba4b('0x13')]){logger[_0xba4b('0x3c')](util['format'](_0xba4b('0x3d'),_0x591e0d[_0xba4b('0x37')]));tnef['parseBuffer'](_[_0xba4b('0x3e')](_0x5f24bc)['content'],function(_0x5407e3,_0x2df606){if(_0x2df606){_0x591e0d[_0xba4b('0x17')]=_0x2df606[_0xba4b('0x3f')]||_0xba4b('0x40');if(_0x2df606['Attachments']){for(var _0x3bfbba=0x0;_0x3bfbba<_0x2df606[_0xba4b('0x41')]['length'];_0x3bfbba++){var _0x323149=_0x2df606[_0xba4b('0x41')][_0x3bfbba];_0x1277ae['message'][_0xba4b('0x1b')][_0xba4b('0x1d')]({'filename':_0x323149['Title'],'content':Buffer['from'](_0x323149['Data'])});}}}_0x31b6b9(parseEmail(_0x935542,_0x591e0d,_0x1277ae));});}else{_0x591e0d[_0xba4b('0x17')]=_0xba4b('0x40');_0x31b6b9(parseEmail(_0x935542,_0x591e0d,_0x1277ae));}}else{_0x31b6b9(parseEmail(_0x935542,_0x591e0d,_0x1277ae));}};exports[_0xba4b('0x42')]=function(_0x5f168b,_0xb62289){var _0x2df47f=[_0xba4b('0x43')+(_0xb62289||''),_0xba4b('0x44')+_0x5f168b,'',''];return Buffer['from'](_0x2df47f[_0xba4b('0x11')](''),_0xba4b('0x45'))[_0xba4b('0x46')](_0xba4b('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b4879dd..983f999 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 _0xe813=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe813,0xe5));var _0x3e81=function(_0x105c51,_0x412d34){_0x105c51=_0x105c51-0x0;var _0x1f727d=_0xe813[_0x105c51];return _0x1f727d;};'use strict';var _=require(_0x3e81('0x0'));function MailAccount(_0x5ba7e7){this['id']=_0x5ba7e7['id']||0x0;this[_0x3e81('0x1')]=_0x5ba7e7[_0x3e81('0x1')]||_0x3e81('0x2');this[_0x3e81('0x3')]=_0x5ba7e7[_0x3e81('0x3')]||_0x3e81('0x4');this[_0x3e81('0x5')]=_0x5ba7e7[_0x3e81('0x5')]||![];this[_0x3e81('0x6')]=_0x5ba7e7[_0x3e81('0x6')]||[];this[_0x3e81('0x7')]=_0x5ba7e7[_0x3e81('0x7')]||[];}module[_0x3e81('0x8')]=MailAccount; \ No newline at end of file +var _0x457f=['exports','lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x473791,_0x4f69bf){var _0x41917b=function(_0x2270d7){while(--_0x2270d7){_0x473791['push'](_0x473791['shift']());}};_0x41917b(++_0x4f69bf);}(_0x457f,0xd9));var _0xf457=function(_0x4ba981,_0x37f3f9){_0x4ba981=_0x4ba981-0x0;var _0x1159e2=_0x457f[_0x4ba981];return _0x1159e2;};'use strict';var _=require(_0xf457('0x0'));function MailAccount(_0x40baa3){this['id']=_0x40baa3['id']||0x0;this[_0xf457('0x1')]=_0x40baa3['name']||_0xf457('0x2');this[_0xf457('0x3')]=_0x40baa3[_0xf457('0x3')]||_0xf457('0x4');this[_0xf457('0x5')]=_0x40baa3[_0xf457('0x5')]||![];this[_0xf457('0x6')]=_0x40baa3[_0xf457('0x6')]||[];this[_0xf457('0x7')]=_0x40baa3['Smtp']||[];}module[_0xf457('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 0d5b225..5e7cb37 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 _0xbe5a=['prototype','mergeFromDatabase','initMailAccounts','isUndefined','lodash','../model/mailAccount','mailAccounts','hasOwnProperty'];(function(_0x3541f3,_0x605588){var _0x5dcf70=function(_0x2d2e9c){while(--_0x2d2e9c){_0x3541f3['push'](_0x3541f3['shift']());}};_0x5dcf70(++_0x605588);}(_0xbe5a,0xfc));var _0xabe5=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xbe5a[_0x280f4a];return _0x1bb157;};'use strict';var _=require(_0xabe5('0x0'));var MailAccount=require(_0xabe5('0x1'));var Realtime=function(){this[_0xabe5('0x2')]={};};function freeIsNotKey(_0x545cf4,_0x1a86f1,_0x5c8f2b){var _0x16418a=_['mapKeys'](_0x545cf4,function(_0x27abb5,_0x1110ee){return _0x27abb5[_0x5c8f2b];});for(var _0x3aa75f in _0x1a86f1){if(_0x1a86f1[_0xabe5('0x3')](_0x3aa75f)){if(!_0x16418a[_0x3aa75f]){delete _0x1a86f1[_0x3aa75f];}}}}Realtime[_0xabe5('0x4')][_0xabe5('0x5')]=function(_0x414784,_0x5a2425){for(var _0x5296cf in _0x5a2425){if(_0x414784[_0xabe5('0x3')](_0x5296cf)){_0x414784[_0x5296cf]=_0x5a2425[_0x5296cf];}}};Realtime[_0xabe5('0x4')][_0xabe5('0x6')]=function(){var _0x33b1c9=this;return function(_0x597e81){if(_0x597e81){freeIsNotKey(_0x597e81,_0x33b1c9[_0xabe5('0x2')],'id');for(var _0x420173=0x0,_0x38a59a={},_0x503e8f={};_0x420173<_0x597e81['length'];_0x420173+=0x1){_0x38a59a=_0x597e81[_0x420173];if(_[_0xabe5('0x7')](_0x33b1c9[_0xabe5('0x2')][_0x38a59a['id']])){_0x33b1c9[_0xabe5('0x2')][_0x38a59a['id']]=new MailAccount(_0x38a59a);}else{_['merge'](_0x33b1c9[_0xabe5('0x2')][_0x38a59a['id']],_0x38a59a);}}}return _0x33b1c9[_0xabe5('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0xb89c=['lodash','../model/mailAccount','mailAccounts','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined'];(function(_0xf6a7f3,_0x259f77){var _0x1a6a53=function(_0x44eb0c){while(--_0x44eb0c){_0xf6a7f3['push'](_0xf6a7f3['shift']());}};_0x1a6a53(++_0x259f77);}(_0xb89c,0x130));var _0xcb89=function(_0x41e8d7,_0x45934a){_0x41e8d7=_0x41e8d7-0x0;var _0x2b001a=_0xb89c[_0x41e8d7];return _0x2b001a;};'use strict';var _=require(_0xcb89('0x0'));var MailAccount=require(_0xcb89('0x1'));var Realtime=function(){this[_0xcb89('0x2')]={};};function freeIsNotKey(_0x3ac4e6,_0x43deb4,_0x271120){var _0x57e7e4=_['mapKeys'](_0x3ac4e6,function(_0x201824,_0x4e17a9){return _0x201824[_0x271120];});for(var _0x4a8b4b in _0x43deb4){if(_0x43deb4[_0xcb89('0x3')](_0x4a8b4b)){if(!_0x57e7e4[_0x4a8b4b]){delete _0x43deb4[_0x4a8b4b];}}}}Realtime[_0xcb89('0x4')][_0xcb89('0x5')]=function(_0x21b80c,_0x2f47b9){for(var _0x5ce137 in _0x2f47b9){if(_0x21b80c[_0xcb89('0x3')](_0x5ce137)){_0x21b80c[_0x5ce137]=_0x2f47b9[_0x5ce137];}}};Realtime[_0xcb89('0x4')]['initMailAccounts']=function(){var _0xa38ccb=this;return function(_0x405251){if(_0x405251){freeIsNotKey(_0x405251,_0xa38ccb[_0xcb89('0x2')],'id');for(var _0x1b6a47=0x0,_0x5eccc5={},_0x4d987d={};_0x1b6a47<_0x405251[_0xcb89('0x6')];_0x1b6a47+=0x1){_0x5eccc5=_0x405251[_0x1b6a47];if(_[_0xcb89('0x7')](_0xa38ccb[_0xcb89('0x2')][_0x5eccc5['id']])){_0xa38ccb['mailAccounts'][_0x5eccc5['id']]=new MailAccount(_0x5eccc5);}else{_['merge'](_0xa38ccb[_0xcb89('0x2')][_0x5eccc5['id']],_0x5eccc5);}}}return _0xa38ccb[_0xcb89('0x2')];};};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 5d8f635..0aa6d21 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 _0xcb07=['../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','ListId','MailServerIn','Imap','type','data5','CloudProvider','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount'];(function(_0x4b871a,_0x255bbf){var _0x1ddcf0=function(_0xb6cde8){while(--_0xb6cde8){_0x4b871a['push'](_0x4b871a['shift']());}};_0x1ddcf0(++_0x255bbf);}(_0xcb07,0x98));var _0x7cb0=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xcb07[_0x2c7618];return _0x5ce3f0;};'use strict';var client=require(_0x7cb0('0x0'));exports[_0x7cb0('0x1')]=function(){return function(){return client[_0x7cb0('0x2')](_0x7cb0('0x3'),{'options':{'attributes':['id',_0x7cb0('0x4'),'provider',_0x7cb0('0x5'),_0x7cb0('0x6'),_0x7cb0('0x7'),'key',_0x7cb0('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x7cb0('0x9'),'as':_0x7cb0('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0x7cb0('0x4'),_0x7cb0('0x5'),_0x7cb0('0xb'),_0x7cb0('0xc')],'as':_0x7cb0('0xd')}]},{'model':_0x7cb0('0xe'),'as':_0x7cb0('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0x7cb0('0x4'),_0x7cb0('0x5'),_0x7cb0('0xb'),'data5'],'as':'CloudProvider'}]}]},'log':_0x7cb0('0x10')});};};exports[_0x7cb0('0x11')]=function(_0x543c8a,_0x57f3cf){return client['Request'](_0x7cb0('0x12'),{'account':{'id':_0x543c8a},'body':_0x57f3cf,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x3946=['MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','ListId','MailServerIn','Imap','type','data5','CloudProvider'];(function(_0xdb0b7d,_0x14a8ad){var _0x5765c0=function(_0x365766){while(--_0x365766){_0xdb0b7d['push'](_0xdb0b7d['shift']());}};_0x5765c0(++_0x14a8ad);}(_0x3946,0x10e));var _0x6394=function(_0x14b74f,_0xf24abd){_0x14b74f=_0x14b74f-0x0;var _0x11f35e=_0x3946[_0x14b74f];return _0x11f35e;};'use strict';var client=require(_0x6394('0x0'));exports[_0x6394('0x1')]=function(){return function(){return client[_0x6394('0x2')](_0x6394('0x3'),{'options':{'attributes':['id',_0x6394('0x4'),_0x6394('0x5'),_0x6394('0x6'),_0x6394('0x7'),_0x6394('0x8'),'key',_0x6394('0x9'),'TemplateId'],'raw':![],'include':[{'model':_0x6394('0xa'),'as':_0x6394('0xb'),'include':[{'model':'CloudProvider','attributes':['id',_0x6394('0x4'),_0x6394('0x6'),_0x6394('0xc'),_0x6394('0xd')],'as':_0x6394('0xe')}]},{'model':_0x6394('0xf'),'as':_0x6394('0x10'),'include':[{'model':_0x6394('0xe'),'attributes':['id',_0x6394('0x4'),_0x6394('0x6'),_0x6394('0xc'),'data5'],'as':_0x6394('0xe')}]}]},'log':_0x6394('0x11')});};};exports['notify']=function(_0x21e9bc,_0x7d218e){return client[_0x6394('0x2')](_0x6394('0x12'),{'account':{'id':_0x21e9bc},'body':_0x7d218e,'log':_0x6394('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 27235e6..5b8f9ec 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 _0x5f86=['Request','ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x36315f,_0x2f6eec){var _0x32c1fe=function(_0x4e9185){while(--_0x4e9185){_0x36315f['push'](_0x36315f['shift']());}};_0x32c1fe(++_0x2f6eec);}(_0x5f86,0x14e));var _0x65f8=function(_0x2e221d,_0x3bfb1c){_0x2e221d=_0x2e221d-0x0;var _0x22c3b5=_0x5f86[_0x2e221d];return _0x22c3b5;};'use strict';var client=require(_0x65f8('0x0'));exports[_0x65f8('0x1')]=function(){return client[_0x65f8('0x2')](_0x65f8('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x65f8('0x4')]},'log':_0x65f8('0x5')});}; \ No newline at end of file +var _0x5b81=['GetSettings','Request'];(function(_0x269f84,_0x3fc79a){var _0x190cd9=function(_0x4b7f5a){while(--_0x4b7f5a){_0x269f84['push'](_0x269f84['shift']());}};_0x190cd9(++_0x3fc79a);}(_0x5b81,0x159));var _0x15b8=function(_0x36b7ca,_0x51f49d){_0x36b7ca=_0x36b7ca-0x0;var _0x3771ae=_0x5b81[_0x36b7ca];return _0x3771ae;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x15b8('0x0')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x15b8('0x1')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 192b636..a2dee4e 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 1f5f5ff..0ebafa4 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 _0xc5e4=['../../config/triggers','../../config/socketio','default','../../config/express','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','ioredis','createServer','timeout','listen','port','socket.io','websocket','polling','redis','localhost','adapter'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc5e4,0x194));var _0x4c5e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc5e4[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var http=require(_0x4c5e('0x0'));var express=require(_0x4c5e('0x1'));var sticky=require(_0x4c5e('0x2'));var Redis=require(_0x4c5e('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x4c5e('0x4')](app);server[_0x4c5e('0x5')]=0xdbba0;if(sticky[_0x4c5e('0x6')](server,config[_0x4c5e('0x7')])){var socketio=require(_0x4c5e('0x8'))(server,{'transports':[_0x4c5e('0x9'),_0x4c5e('0xa')]});config[_0x4c5e('0xb')]=_['defaults'](config[_0x4c5e('0xb')],{'host':_0x4c5e('0xc'),'port':0x18eb});socketio[_0x4c5e('0xd')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x4c5e('0xb')])}));require(_0x4c5e('0xe'))['default']();require(_0x4c5e('0xf'))[_0x4c5e('0x10')](socketio);require(_0x4c5e('0x11'))[_0x4c5e('0x10')](app);require('../../routes')[_0x4c5e('0x10')](app);}else{server[_0x4c5e('0x12')](_0x4c5e('0x13'),function(){console['log'](_0x4c5e('0x14'),config[_0x4c5e('0x7')]);});}exports=module[_0x4c5e('0x15')]=app; \ No newline at end of file +var _0x281b=['http','express','sticky-session','../../config/environment','createServer','timeout','listen','port','websocket','polling','redis','localhost','default','../../config/socketio','../../config/express','../../routes','once','listening','log','lodash'];(function(_0x1e849f,_0x1ab5de){var _0x258194=function(_0x588a53){while(--_0x588a53){_0x1e849f['push'](_0x1e849f['shift']());}};_0x258194(++_0x1ab5de);}(_0x281b,0x1a3));var _0xb281=function(_0x217cfd,_0x1e3094){_0x217cfd=_0x217cfd-0x0;var _0x1e887f=_0x281b[_0x217cfd];return _0x1e887f;};'use strict';var _=require(_0xb281('0x0'));var http=require(_0xb281('0x1'));var express=require(_0xb281('0x2'));var sticky=require(_0xb281('0x3'));var Redis=require('ioredis');var config=require(_0xb281('0x4'));var app=express();var server=http[_0xb281('0x5')](app);server[_0xb281('0x6')]=0xdbba0;if(sticky[_0xb281('0x7')](server,config[_0xb281('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0xb281('0x9'),_0xb281('0xa')]});config[_0xb281('0xb')]=_['defaults'](config[_0xb281('0xb')],{'host':_0xb281('0xc'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xb281('0xb')])}));require('../../config/triggers')[_0xb281('0xd')]();require(_0xb281('0xe'))[_0xb281('0xd')](socketio);require(_0xb281('0xf'))['default'](app);require(_0xb281('0x10'))[_0xb281('0xd')](app);}else{server[_0xb281('0x11')](_0xb281('0x12'),function(){console[_0xb281('0x13')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 7e570ca..4b53528 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 _0xfb9e=['then','debug','rpc','error','message','result','exports','bluebird','../../config/logger','routing','client','http','Request','request'];(function(_0x1a2107,_0x146585){var _0x3ad213=function(_0x119f22){while(--_0x119f22){_0x1a2107['push'](_0x1a2107['shift']());}};_0x3ad213(++_0x146585);}(_0xfb9e,0x181));var _0xefb9=function(_0x10f50d,_0x1b200c){_0x10f50d=_0x10f50d-0x0;var _0x24128c=_0xfb9e[_0x10f50d];return _0x24128c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xefb9('0x0'));var logger=require(_0xefb9('0x1'))(_0xefb9('0x2'));var client=jayson[_0xefb9('0x3')][_0xefb9('0x4')]({'port':0x2329});client[_0xefb9('0x5')]=function(_0xa1d1c1,_0x127dc0){return new BPromise(function(_0x194e7d,_0x1fc141){return client[_0xefb9('0x6')](_0xa1d1c1,_0x127dc0)[_0xefb9('0x7')](function(_0x363b00){logger[_0xefb9('0x8')](_0xefb9('0x9'),_0xefb9('0x2'),_0xa1d1c1,_0x127dc0,_0x363b00);if(_0x363b00[_0xefb9('0xa')]){logger[_0xefb9('0xa')](_0xefb9('0x9'),_0xefb9('0x2'),_0xa1d1c1,_0x363b00['error'][_0xefb9('0xb')],_0x127dc0);return _0x1fc141(_0x363b00[_0xefb9('0xa')]['message']);}else{return _0x194e7d(_0x363b00[_0xefb9('0xc')]);}})['catch'](function(_0x9fdf3e){logger['error'](_0xefb9('0x9'),_0xefb9('0x2'),_0xa1d1c1,_0x9fdf3e,_0x127dc0);return _0x1fc141(_0x9fdf3e);});});};module[_0xefb9('0xd')]=client; \ No newline at end of file +var _0x289d=['catch','jayson/promise','../../config/logger','client','http','request','then','debug','rpc','routing','error','message','result'];(function(_0x478970,_0x5df032){var _0x1759f1=function(_0x58579d){while(--_0x58579d){_0x478970['push'](_0x478970['shift']());}};_0x1759f1(++_0x5df032);}(_0x289d,0x90));var _0xd289=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x289d[_0x1facfa];return _0x9ec701;};'use strict';var jayson=require(_0xd289('0x0'));var BPromise=require('bluebird');var logger=require(_0xd289('0x1'))('routing');var client=jayson[_0xd289('0x2')][_0xd289('0x3')]({'port':0x2329});client['Request']=function(_0x1d5a07,_0x26847c){return new BPromise(function(_0x2dd820,_0x133151){return client[_0xd289('0x4')](_0x1d5a07,_0x26847c)[_0xd289('0x5')](function(_0x3d9f64){logger[_0xd289('0x6')](_0xd289('0x7'),_0xd289('0x8'),_0x1d5a07,_0x26847c,_0x3d9f64);if(_0x3d9f64[_0xd289('0x9')]){logger[_0xd289('0x9')](_0xd289('0x7'),'routing',_0x1d5a07,_0x3d9f64[_0xd289('0x9')]['message'],_0x26847c);return _0x133151(_0x3d9f64[_0xd289('0x9')][_0xd289('0xa')]);}else{return _0x2dd820(_0x3d9f64[_0xd289('0xb')]);}})[_0xd289('0xc')](function(_0x5ed15d){logger['error']('rpc',_0xd289('0x8'),_0x1d5a07,_0x5ed15d,_0x26847c);return _0x133151(_0x5ed15d);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 88c87d9..83442e6 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 _0x156d=['initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents'];(function(_0x134f89,_0x54401f){var _0xc8cf54=function(_0x4fccfd){while(--_0x4fccfd){_0x134f89['push'](_0x134f89['shift']());}};_0xc8cf54(++_0x54401f);}(_0x156d,0x1e7));var _0xd156=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x156d[_0x42cae2];return _0x5f256f;};'use strict';var BPromise=require(_0xd156('0x0'));var server=require(_0xd156('0x1'));var Realtime=require(_0xd156('0x2'));var user=require(_0xd156('0x3'));var interval=require(_0xd156('0x4'));var openchannelQueue=require(_0xd156('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xd156('0x6'));var mailQueue=require(_0xd156('0x7'));var faxQueue=require(_0xd156('0x8'));var whatsappQueue=require(_0xd156('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd156('0xa')]()[_0xd156('0xb')](user[_0xd156('0xc')]())['then'](realtime['initAgents']())['then'](interval['getIntervals']())[_0xd156('0xb')](realtime[_0xd156('0xd')]())[_0xd156('0xb')](openchannelQueue[_0xd156('0xe')]())[_0xd156('0xb')](realtime[_0xd156('0xf')]())[_0xd156('0xb')](chatQueue['getChatQueues']())[_0xd156('0xb')](realtime[_0xd156('0x10')]())[_0xd156('0xb')](smsQueue['getSmsQueues']())[_0xd156('0xb')](realtime['initSmsQueues']())['then'](mailQueue[_0xd156('0x11')]())['then'](realtime[_0xd156('0x12')]())[_0xd156('0xb')](faxQueue[_0xd156('0x13')]())[_0xd156('0xb')](realtime['initFaxQueues']())[_0xd156('0xb')](whatsappQueue[_0xd156('0x14')]())[_0xd156('0xb')](realtime[_0xd156('0x15')]())[_0xd156('0xb')](function(){return realtime;});}function main(){return server[_0xd156('0x16')](realtime)[_0xd156('0xb')](function(_0xa5c8c){return initRealtime();})[_0xd156('0xb')](function(_0x1d9721){return setInterval(initRealtime,0x1388);})[_0xd156('0x17')](function(_0x3d1e21){console[_0xd156('0x18')](_0x3d1e21);});}main(); \ No newline at end of file +var _0xd4a1=['log','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch'];(function(_0x8dbd41,_0x4da4cd){var _0x4f00ee=function(_0xe26ca8){while(--_0xe26ca8){_0x8dbd41['push'](_0x8dbd41['shift']());}};_0x4f00ee(++_0x4da4cd);}(_0xd4a1,0x135));var _0x1d4a=function(_0x3ac8ed,_0x338754){_0x3ac8ed=_0x3ac8ed-0x0;var _0x2bb0d7=_0xd4a1[_0x3ac8ed];return _0x2bb0d7;};'use strict';var BPromise=require('bluebird');var server=require(_0x1d4a('0x0'));var Realtime=require(_0x1d4a('0x1'));var user=require(_0x1d4a('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x1d4a('0x3'));var chatQueue=require(_0x1d4a('0x4'));var smsQueue=require(_0x1d4a('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x1d4a('0x6'));var whatsappQueue=require(_0x1d4a('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x1d4a('0x8')]()[_0x1d4a('0x9')](user[_0x1d4a('0xa')]())[_0x1d4a('0x9')](realtime['initAgents']())[_0x1d4a('0x9')](interval[_0x1d4a('0xb')]())[_0x1d4a('0x9')](realtime['initIntervals']())['then'](openchannelQueue[_0x1d4a('0xc')]())[_0x1d4a('0x9')](realtime[_0x1d4a('0xd')]())[_0x1d4a('0x9')](chatQueue[_0x1d4a('0xe')]())[_0x1d4a('0x9')](realtime['initChatQueues']())[_0x1d4a('0x9')](smsQueue[_0x1d4a('0xf')]())['then'](realtime['initSmsQueues']())['then'](mailQueue['getMailQueues']())[_0x1d4a('0x9')](realtime['initMailQueues']())['then'](faxQueue['getFaxQueues']())[_0x1d4a('0x9')](realtime[_0x1d4a('0x10')]())[_0x1d4a('0x9')](whatsappQueue[_0x1d4a('0x11')]())['then'](realtime[_0x1d4a('0x12')]())[_0x1d4a('0x9')](function(){return realtime;});}function main(){return server[_0x1d4a('0x13')](realtime)[_0x1d4a('0x9')](function(_0x216aea){return initRealtime();})[_0x1d4a('0x9')](function(_0x2b79f7){return setInterval(initRealtime,0x1388);})[_0x1d4a('0x14')](function(_0x557ddd){console[_0x1d4a('0x15')](_0x557ddd);});}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 2e238b7..41a14f4 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 _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x607300,_0x57d85b){var _0x4d0fd6=function(_0x421924){while(--_0x421924){_0x607300['push'](_0x607300['shift']());}};_0x4d0fd6(++_0x57d85b);}(_0xe14b,0x93));var _0xbe14=function(_0x5d72f7,_0x3a3a87){_0x5d72f7=_0x5d72f7-0x0;var _0x276690=_0xe14b[_0x5d72f7];return _0x276690;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x404a11,_0x268dc0){var _0x435823=function(_0x8bf3a){while(--_0x8bf3a){_0x404a11['push'](_0x404a11['shift']());}};_0x435823(++_0x268dc0);}(_0x326f,0xd1));var _0xf326=function(_0x516070,_0x40a332){_0x516070=_0x516070-0x0;var _0x46eaf5=_0x326f[_0x516070];return _0x46eaf5;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 5c822d2..336b503 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 _0xed8b=['error','message','result','sendMailMessage','bluebird','request','then'];(function(_0x23dd5a,_0x17c458){var _0x438754=function(_0x5bc33c){while(--_0x5bc33c){_0x23dd5a['push'](_0x23dd5a['shift']());}};_0x438754(++_0x17c458);}(_0xed8b,0x115));var _0xbed8=function(_0x4f7a5b,_0x3ef4b9){_0x4f7a5b=_0x4f7a5b-0x0;var _0x175d9a=_0xed8b[_0x4f7a5b];return _0x175d9a;};'use strict';var BPromise=require(_0xbed8('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x2227dc,_0x29c862){return new BPromise(function(_0x18b77b,_0x510a41){return client[_0xbed8('0x1')](_0x2227dc,_0x29c862)[_0xbed8('0x2')](function(_0x36d157){if(_0x36d157[_0xbed8('0x3')]){return _0x510a41(_0x36d157[_0xbed8('0x3')][_0xbed8('0x4')]);}else{return _0x18b77b(_0x36d157[_0xbed8('0x5')]);}})['catch'](function(_0x2efc77){return _0x510a41(_0x2efc77);});});}exports[_0xbed8('0x6')]=function(_0x25ddbe,_0x41f37f){return request('SendMail',{'account':_0x25ddbe,'message':_0x41f37f});}; \ No newline at end of file +var _0x4320=['sendMailMessage','SendMail','jayson/promise','client','http','then','error','message','result'];(function(_0x1b1a55,_0x258f35){var _0x259c77=function(_0x469a9e){while(--_0x469a9e){_0x1b1a55['push'](_0x1b1a55['shift']());}};_0x259c77(++_0x258f35);}(_0x4320,0x80));var _0x0432=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x4320[_0x409353];return _0x4f4b59;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0432('0x0'));var client=jayson[_0x0432('0x1')][_0x0432('0x2')]({'port':0x232b});function request(_0x4b1c31,_0x2971f1){return new BPromise(function(_0x54117d,_0x84387){return client['request'](_0x4b1c31,_0x2971f1)[_0x0432('0x3')](function(_0x30a618){if(_0x30a618[_0x0432('0x4')]){return _0x84387(_0x30a618[_0x0432('0x4')][_0x0432('0x5')]);}else{return _0x54117d(_0x30a618[_0x0432('0x6')]);}})['catch'](function(_0x911a95){return _0x84387(_0x911a95);});});}exports[_0x0432('0x7')]=function(_0x7638df,_0x2f119c){return request(_0x0432('0x8'),{'account':_0x7638df,'message':_0x2f119c});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 2f346f6..f5320f4 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 _0x388d=['toNumber','format','chatCurrentCapacity','mailStatus','mailCurrentCapacity','whatsappCurrentCapacity','chatWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','omit','emit','user:routing:update','exports','lodash','moment','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','faxWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','openchannel','fax','sms','whatsapp','Status','StatusTime'];(function(_0x156147,_0x16978e){var _0x532175=function(_0x3ff117){while(--_0x3ff117){_0x156147['push'](_0x156147['shift']());}};_0x532175(++_0x16978e);}(_0x388d,0xc7));var _0xd388=function(_0x1b2d3e,_0x1a311b){_0x1b2d3e=_0x1b2d3e-0x0;var _0x5c2113=_0x388d[_0x1b2d3e];return _0x5c2113;};'use strict';var _=require(_0xd388('0x0'));var moment=require(_0xd388('0x1'));var Redis=require(_0xd388('0x2'));var config=require('../../../config/environment');config[_0xd388('0x3')]=_['defaults'](config['redis'],{'host':_0xd388('0x4'),'port':0x18eb});var io=require(_0xd388('0x5'))(new Redis(config[_0xd388('0x3')]));function Agent(_0x408eeb){this['id']=_0x408eeb['id']||0x0;this[_0xd388('0x6')]=_0x408eeb[_0xd388('0x6')]||'';this['online']=_0x408eeb[_0xd388('0x7')]||!![];this[_0xd388('0x8')]=_0x408eeb[_0xd388('0x8')]||![];this[_0xd388('0x9')]=_0x408eeb[_0xd388('0x9')]||![];this['mailPause']=_0x408eeb[_0xd388('0xa')]||![];this[_0xd388('0xb')]=_0x408eeb[_0xd388('0xb')]||![];this['smsPause']=_0x408eeb[_0xd388('0xc')]||![];this[_0xd388('0xd')]=_0x408eeb[_0xd388('0xd')]||![];this[_0xd388('0xe')]=_0xd388('0xf');this[_0xd388('0x10')]=0x0;this[_0xd388('0x11')]=_0x408eeb[_0xd388('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']='unknown';this['mailStatusTime']=0x0;this['mailCapacity']=_0x408eeb[_0xd388('0x12')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xd388('0x13')]='unknown';this[_0xd388('0x14')]=0x0;this[_0xd388('0x15')]=_0x408eeb[_0xd388('0x15')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0xd388('0xf');this[_0xd388('0x16')]=0x0;this[_0xd388('0x17')]=_0x408eeb[_0xd388('0x17')]||0x0;this[_0xd388('0x18')]=0x0;this['whatsappStatus']=_0xd388('0xf');this[_0xd388('0x19')]=0x0;this[_0xd388('0x1a')]=_0x408eeb[_0xd388('0x1a')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xd388('0x1b')]=_0xd388('0xf');this[_0xd388('0x1c')]=0x0;this[_0xd388('0x1d')]=_0x408eeb[_0xd388('0x1d')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xd388('0x1e')]=![];this[_0xd388('0x1f')]=undefined;this['chatWaitingInteractions']={};this[_0xd388('0x20')]={};this['mailWaitingInteractions']={};this[_0xd388('0x21')]={};this['smsWaitingInteractions']={};this[_0xd388('0x22')]={};this[_0xd388('0x23')]();}Agent[_0xd388('0x24')][_0xd388('0x25')]=function(_0x1b1d5c){if(this[_0x1b1d5c+'CurrentCapacity']>0x0){if(this[_0x1b1d5c+'Capacity']>0x0&&this[_0x1b1d5c+_0xd388('0x26')]>=this[_0x1b1d5c+_0xd388('0x27')]){return _0xd388('0x28');}else{return _0xd388('0x29');}}else{return'idle';}};Agent['prototype'][_0xd388('0x23')]=function(){var _0x22909f=[_0xd388('0x2a'),'chat',_0xd388('0x2b'),_0xd388('0x2c'),_0xd388('0x2d'),_0xd388('0x2e')];for(var _0x519b10=0x0;_0x519b10<_0x22909f['length'];_0x519b10+=0x1){var _0x5d15e1=this[_0xd388('0x25')](_0x22909f[_0x519b10]);if(this[_0x22909f[_0x519b10]+_0xd388('0x2f')]!==_0x5d15e1){this[_0x22909f[_0x519b10]+_0xd388('0x30')]=_[_0xd388('0x31')](moment()[_0xd388('0x32')]('x'));}this[_0x22909f[_0x519b10]+_0xd388('0x2f')]=_0x5d15e1;}var _0x5f11b6={'id':this['id'],'name':this[_0xd388('0x6')],'online':this[_0xd388('0x7')],'voicePause':this[_0xd388('0x8')],'chatPause':this[_0xd388('0x9')],'mailPause':this[_0xd388('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0xd388('0xb')],'openchannelPause':this[_0xd388('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xd388('0x11')],'chatCurrentCapacity':this[_0xd388('0x33')],'mailStatus':this[_0xd388('0x34')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xd388('0x12')],'mailCurrentCapacity':this[_0xd388('0x35')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xd388('0x17')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xd388('0x19')],'whatsappCapacity':this[_0xd388('0x1a')],'whatsappCurrentCapacity':this[_0xd388('0x36')],'openchannelStatus':this[_0xd388('0x1b')],'openchannelStatusTime':this[_0xd388('0x1c')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xd388('0x1e')],'busyQueue':this[_0xd388('0x1f')],'chatWaitingInteractions':this[_0xd388('0x37')],'faxWaitingInteractions':this[_0xd388('0x20')],'mailWaitingInteractions':this[_0xd388('0x38')],'openchannelWaitingInteractions':this[_0xd388('0x21')],'smsWaitingInteractions':this[_0xd388('0x39')],'whatsappWaitingInteractions':this[_0xd388('0x22')]};if(!_['isEqual'](_[_0xd388('0x3a')](this,['online']),_[_0xd388('0x3a')](_0x5f11b6,[_0xd388('0x7')]))){io[_0xd388('0x3b')](_0xd388('0x3c'),_0x5f11b6);}};module[_0xd388('0x3d')]=Agent; \ No newline at end of file +var _0xdb28=['user:routing:update','exports','lodash','md5','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','idle','mail','chat','fax','sms','whatsapp','Status','StatusTime','toNumber','format','mailStatusTime','whatsappCurrentCapacity','openchannelStatus','openchannelCurrentCapacity','stringify'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0xdb28,0x106));var _0x8db2=function(_0x106cf1,_0x12dc65){_0x106cf1=_0x106cf1-0x0;var _0x10bb37=_0xdb28[_0x106cf1];return _0x10bb37;};'use strict';var _=require(_0x8db2('0x0'));var md5=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var Redis=require(_0x8db2('0x3'));var config=require('../../../config/environment');config[_0x8db2('0x4')]=_[_0x8db2('0x5')](config[_0x8db2('0x4')],{'host':_0x8db2('0x6'),'port':0x18eb});var io=require(_0x8db2('0x7'))(new Redis(config['redis']));function Agent(_0x21a03e){this['id']=_0x21a03e['id']||0x0;this[_0x8db2('0x8')]=_0x21a03e['name']||'';this['online']=_0x21a03e[_0x8db2('0x9')]||!![];this[_0x8db2('0xa')]=_0x21a03e[_0x8db2('0xa')]||![];this[_0x8db2('0xb')]=_0x21a03e[_0x8db2('0xb')]||![];this[_0x8db2('0xc')]=_0x21a03e[_0x8db2('0xc')]||![];this['faxPause']=_0x21a03e[_0x8db2('0xd')]||![];this[_0x8db2('0xe')]=_0x21a03e[_0x8db2('0xe')]||![];this['openchannelPause']=_0x21a03e[_0x8db2('0xf')]||![];this[_0x8db2('0x10')]='unknown';this[_0x8db2('0x11')]=0x0;this[_0x8db2('0x12')]=_0x21a03e[_0x8db2('0x12')]||0x0;this[_0x8db2('0x13')]=0x0;this[_0x8db2('0x14')]='unknown';this['mailStatusTime']=0x0;this[_0x8db2('0x15')]=_0x21a03e[_0x8db2('0x15')]||0x0;this[_0x8db2('0x16')]=0x0;this[_0x8db2('0x17')]=_0x8db2('0x18');this[_0x8db2('0x19')]=0x0;this[_0x8db2('0x1a')]=_0x21a03e[_0x8db2('0x1a')]||0x0;this[_0x8db2('0x1b')]=0x0;this[_0x8db2('0x1c')]='unknown';this[_0x8db2('0x1d')]=0x0;this[_0x8db2('0x1e')]=_0x21a03e['smsCapacity']||0x0;this[_0x8db2('0x1f')]=0x0;this[_0x8db2('0x20')]=_0x8db2('0x18');this[_0x8db2('0x21')]=0x0;this[_0x8db2('0x22')]=_0x21a03e[_0x8db2('0x22')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x8db2('0x18');this[_0x8db2('0x23')]=0x0;this[_0x8db2('0x24')]=_0x21a03e[_0x8db2('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x8db2('0x25')]=![];this[_0x8db2('0x26')]=undefined;this[_0x8db2('0x1')]='';this[_0x8db2('0x27')]={};this[_0x8db2('0x28')]={};this['mailWaitingInteractions']={};this[_0x8db2('0x29')]={};this[_0x8db2('0x2a')]={};this[_0x8db2('0x2b')]={};this[_0x8db2('0x2c')]();}Agent[_0x8db2('0x2d')][_0x8db2('0x2e')]=function(_0x796ec1){if(this[_0x796ec1+'CurrentCapacity']>0x0){if(this[_0x796ec1+_0x8db2('0x2f')]>0x0&&this[_0x796ec1+'CurrentCapacity']>=this[_0x796ec1+'Capacity']){return'maxcapacity';}else{return'working';}}else{return _0x8db2('0x30');}};Agent[_0x8db2('0x2d')][_0x8db2('0x2c')]=function(){var _0x2baed0=[_0x8db2('0x31'),_0x8db2('0x32'),'openchannel',_0x8db2('0x33'),_0x8db2('0x34'),_0x8db2('0x35')];for(var _0x8b7cec=0x0;_0x8b7cec<_0x2baed0['length'];_0x8b7cec+=0x1){var _0x2e0691=this[_0x8db2('0x2e')](_0x2baed0[_0x8b7cec]);if(this[_0x2baed0[_0x8b7cec]+_0x8db2('0x36')]!==_0x2e0691){this[_0x2baed0[_0x8b7cec]+_0x8db2('0x37')]=_[_0x8db2('0x38')](moment()[_0x8db2('0x39')]('x'));}this[_0x2baed0[_0x8b7cec]+_0x8db2('0x36')]=_0x2e0691;}var _0x3124d5={'id':this['id'],'name':this[_0x8db2('0x8')],'online':this['online'],'voicePause':this[_0x8db2('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x8db2('0xe')],'faxPause':this[_0x8db2('0xd')],'openchannelPause':this[_0x8db2('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x8db2('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x8db2('0x13')],'mailStatus':this[_0x8db2('0x14')],'mailStatusTime':this[_0x8db2('0x3a')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x8db2('0x17')],'faxStatusTime':this[_0x8db2('0x19')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x8db2('0x1c')],'smsStatusTime':this[_0x8db2('0x1d')],'smsCapacity':this[_0x8db2('0x1e')],'smsCurrentCapacity':this[_0x8db2('0x1f')],'whatsappStatus':this[_0x8db2('0x20')],'whatsappStatusTime':this[_0x8db2('0x21')],'whatsappCapacity':this[_0x8db2('0x22')],'whatsappCurrentCapacity':this[_0x8db2('0x3b')],'openchannelStatus':this[_0x8db2('0x3c')],'openchannelStatusTime':this[_0x8db2('0x23')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x8db2('0x3d')],'busy':this[_0x8db2('0x25')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x8db2('0x27')],'faxWaitingInteractions':this[_0x8db2('0x28')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x8db2('0x2a')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x3dfbaa=md5(JSON[_0x8db2('0x3e')](_0x3124d5));if(this[_0x8db2('0x1')]!==_0x3dfbaa){this[_0x8db2('0x1')]=_0x3dfbaa;io['emit'](_0x8db2('0x3f'),_['omit'](_0x3124d5,[_0x8db2('0x9')]));}};module[_0x8db2('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 7cb9761..1a25021 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 _0xf6e1=['updateRealtime','loggedIn','length','online','chatPause','paused','available','format','emit','chat_queue:save','exports','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','mapAgentsId','_rr','map'];(function(_0x31504c,_0x296c3e){var _0x173831=function(_0x5450d5){while(--_0x5450d5){_0x31504c['push'](_0x31504c['shift']());}};_0x173831(++_0x296c3e);}(_0xf6e1,0x11e));var _0x1f6e=function(_0x3fb736,_0x2e5efe){_0x3fb736=_0x3fb736-0x0;var _0x33cefd=_0xf6e1[_0x3fb736];return _0x33cefd;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x1f6e('0x0'));var config=require('../../../config/environment');config[_0x1f6e('0x1')]=_['defaults'](config[_0x1f6e('0x1')],{'host':_0x1f6e('0x2'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1f6e('0x1')]));function ChatQueue(_0x22a16d){this['id']=_0x22a16d['id']||0x0;this['name']=_0x22a16d[_0x1f6e('0x3')]||'';this[_0x1f6e('0x4')]=_0x22a16d[_0x1f6e('0x4')]||0xa;this[_0x1f6e('0x5')]=_0x22a16d[_0x1f6e('0x5')]||_0x1f6e('0x6');this['Agents']=_0x22a16d[_0x1f6e('0x7')];this['mapAgentsId']={};this[_0x1f6e('0x8')]=0x0;this[_0x1f6e('0x9')]='';this[_0x1f6e('0xa')]();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0xf7a18d=this[_0x1f6e('0xb')][_0x1f6e('0xc')];this['mapAgentsId']=_[_0x1f6e('0xd')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0xf7a18d;};ChatQueue['prototype'][_0x1f6e('0xe')]=function(){this[_0x1f6e('0xf')]=0x0;this['paused']=0x0;for(var _0x31a99f=0x0;_0x31a99f=0x0?this[_0x1f6e('0x14')]:0x0;var _0x4ae767={'id':this['id'],'available':this[_0x1f6e('0x14')],'loggedIn':this[_0x1f6e('0xf')],'name':this['name'],'paused':this[_0x1f6e('0x13')],'waiting':this[_0x1f6e('0x8')]};var _0x5a0ac3=md5(JSON['stringify'](_0x4ae767));if(this[_0x1f6e('0x9')]!==_0x5a0ac3){this[_0x1f6e('0x9')]=_0x5a0ac3;io['to'](util[_0x1f6e('0x15')]('chat:queue:%s',_0x4ae767[_0x1f6e('0x3')]))[_0x1f6e('0x16')](_0x1f6e('0x17'),_0x4ae767);}};module[_0x1f6e('0x18')]=ChatQueue; \ No newline at end of file +var _0x50cc=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','chatPause','paused','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','redis','defaults','localhost','name','timeout'];(function(_0x5bfd3b,_0x4f9a9f){var _0x1f37f5=function(_0x147fac){while(--_0x147fac){_0x5bfd3b['push'](_0x5bfd3b['shift']());}};_0x1f37f5(++_0x4f9a9f);}(_0x50cc,0x142));var _0xc50c=function(_0x2d9653,_0xa29f22){_0x2d9653=_0x2d9653-0x0;var _0x59ac24=_0x50cc[_0x2d9653];return _0x59ac24;};'use strict';var _=require(_0xc50c('0x0'));var md5=require(_0xc50c('0x1'));var util=require(_0xc50c('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xc50c('0x3')]=_[_0xc50c('0x4')](config['redis'],{'host':_0xc50c('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x20fd75){this['id']=_0x20fd75['id']||0x0;this[_0xc50c('0x6')]=_0x20fd75['name']||'';this[_0xc50c('0x7')]=_0x20fd75['timeout']||0xa;this[_0xc50c('0x8')]=_0x20fd75[_0xc50c('0x8')]||_0xc50c('0x9');this[_0xc50c('0xa')]=_0x20fd75[_0xc50c('0xa')];this[_0xc50c('0xb')]={};this[_0xc50c('0xc')]=0x0;this[_0xc50c('0x1')]='';this[_0xc50c('0xd')]();this[_0xc50c('0xe')]();}ChatQueue['prototype'][_0xc50c('0xd')]=function(){var _0x41863=this['mapAgentsId'][_0xc50c('0xf')];this[_0xc50c('0xb')]=_[_0xc50c('0x10')](this[_0xc50c('0xa')],'id');this[_0xc50c('0xb')]['_rr']=_0x41863;};ChatQueue[_0xc50c('0x11')][_0xc50c('0xe')]=function(){this[_0xc50c('0x12')]=0x0;this['paused']=0x0;for(var _0x2c507a=0x0;_0x2c507a=0x0?this[_0xc50c('0x17')]:0x0;var _0x273648={'id':this['id'],'available':this[_0xc50c('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xc50c('0x6')],'paused':this['paused'],'waiting':this[_0xc50c('0xc')]};var _0x58541a=md5(JSON[_0xc50c('0x18')](_0x273648));if(this['md5']!==_0x58541a){this[_0xc50c('0x1')]=_0x58541a;io['to'](util[_0xc50c('0x19')](_0xc50c('0x1a'),_0x273648[_0xc50c('0x6')]))[_0xc50c('0x1b')](_0xc50c('0x1c'),_0x273648);}};module[_0xc50c('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 21c5403..b7bef63 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 _0x76a1=['beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length','online','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','name','timeout','strategy'];(function(_0x35674e,_0x3f6452){var _0x107863=function(_0x19b1d4){while(--_0x19b1d4){_0x35674e['push'](_0x35674e['shift']());}};_0x107863(++_0x3f6452);}(_0x76a1,0x153));var _0x176a=function(_0x995c2e,_0x10a89a){_0x995c2e=_0x995c2e-0x0;var _0x335f3c=_0x76a1[_0x995c2e];return _0x335f3c;};'use strict';var _=require(_0x176a('0x0'));var md5=require(_0x176a('0x1'));var util=require(_0x176a('0x2'));var Redis=require('ioredis');var config=require(_0x176a('0x3'));config[_0x176a('0x4')]=_['defaults'](config[_0x176a('0x4')],{'host':_0x176a('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x53a15c){this['id']=_0x53a15c['id']||0x0;this[_0x176a('0x6')]=_0x53a15c[_0x176a('0x6')]||'';this[_0x176a('0x7')]=_0x53a15c[_0x176a('0x7')]||0xa;this['strategy']=_0x53a15c[_0x176a('0x8')]||_0x176a('0x9');this[_0x176a('0xa')]=_0x53a15c[_0x176a('0xa')];this['mapAgentsId']={};this[_0x176a('0xb')]=0x0;this[_0x176a('0x1')]='';this[_0x176a('0xc')]();this[_0x176a('0xd')]();}FaxQueue[_0x176a('0xe')][_0x176a('0xc')]=function(){var _0x2914b6=this['mapAgentsId'][_0x176a('0xf')];this[_0x176a('0x10')]=_[_0x176a('0x11')](this['Agents'],'id');this[_0x176a('0x10')][_0x176a('0xf')]=_0x2914b6;};FaxQueue[_0x176a('0xe')][_0x176a('0xd')]=function(){this[_0x176a('0x12')]=0x0;this[_0x176a('0x13')]=0x0;for(var _0x12e6c3=0x0;_0x12e6c3=0x0?this[_0x176a('0x16')]:0x0;var _0x49c508={'id':this['id'],'available':this[_0x176a('0x16')],'loggedIn':this[_0x176a('0x12')],'name':this[_0x176a('0x6')],'paused':this[_0x176a('0x13')],'waiting':this['waiting']};var _0x7fcb3a=md5(JSON[_0x176a('0x17')](_0x49c508));if(this['md5']!==_0x7fcb3a){this['md5']=_0x7fcb3a;io['to'](util[_0x176a('0x18')](_0x176a('0x19'),_0x49c508[_0x176a('0x6')]))[_0x176a('0x1a')](_0x176a('0x1b'),_0x49c508);}};module[_0x176a('0x1c')]=FaxQueue; \ No newline at end of file +var _0x8949=['util','redis','defaults','name','timeout','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','format','emit','fax_queue:save','exports','lodash'];(function(_0x25ae55,_0x4a7244){var _0x55a9af=function(_0x50176e){while(--_0x50176e){_0x25ae55['push'](_0x25ae55['shift']());}};_0x55a9af(++_0x4a7244);}(_0x8949,0x15d));var _0x9894=function(_0x4e0090,_0x803be0){_0x4e0090=_0x4e0090-0x0;var _0x180148=_0x8949[_0x4e0090];return _0x180148;};'use strict';var _=require(_0x9894('0x0'));var md5=require('md5');var util=require(_0x9894('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x9894('0x2')]=_[_0x9894('0x3')](config[_0x9894('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x30be5c){this['id']=_0x30be5c['id']||0x0;this[_0x9894('0x4')]=_0x30be5c['name']||'';this[_0x9894('0x5')]=_0x30be5c[_0x9894('0x5')]||0xa;this['strategy']=_0x30be5c['strategy']||'beepall';this[_0x9894('0x6')]=_0x30be5c[_0x9894('0x6')];this[_0x9894('0x7')]={};this[_0x9894('0x8')]=0x0;this[_0x9894('0x9')]='';this[_0x9894('0xa')]();this[_0x9894('0xb')]();}FaxQueue['prototype']['updateRouting']=function(){var _0x16ca49=this[_0x9894('0x7')][_0x9894('0xc')];this['mapAgentsId']=_[_0x9894('0xd')](this[_0x9894('0x6')],'id');this[_0x9894('0x7')][_0x9894('0xc')]=_0x16ca49;};FaxQueue[_0x9894('0xe')][_0x9894('0xb')]=function(){this[_0x9894('0xf')]=0x0;this[_0x9894('0x10')]=0x0;for(var _0x96466c=0x0;_0x96466c=0x0?this['available']:0x0;var _0x31a22a={'id':this['id'],'available':this[_0x9894('0x14')],'loggedIn':this[_0x9894('0xf')],'name':this[_0x9894('0x4')],'paused':this[_0x9894('0x10')],'waiting':this['waiting']};var _0x2ac863=md5(JSON['stringify'](_0x31a22a));if(this[_0x9894('0x9')]!==_0x2ac863){this[_0x9894('0x9')]=_0x2ac863;io['to'](util[_0x9894('0x15')]('fax:queue:%s',_0x31a22a[_0x9894('0x4')]))[_0x9894('0x16')](_0x9894('0x17'),_0x31a22a);}};module[_0x9894('0x18')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 600ddcf..21a94dd 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 _0xa3d0=['Intervals','exports','name'];(function(_0xd8813a,_0x315766){var _0x487db6=function(_0x538ca9){while(--_0x538ca9){_0xd8813a['push'](_0xd8813a['shift']());}};_0x487db6(++_0x315766);}(_0xa3d0,0x152));var _0x0a3d=function(_0x21a8ef,_0x5f4873){_0x21a8ef=_0x21a8ef-0x0;var _0x546160=_0xa3d0[_0x21a8ef];return _0x546160;};'use strict';function Interval(_0x3b82d2){this['id']=_0x3b82d2['id']||0x0;this[_0x0a3d('0x0')]=_0x3b82d2[_0x0a3d('0x0')]||'';this[_0x0a3d('0x1')]=_0x3b82d2['Intervals']||{};}module[_0x0a3d('0x2')]=Interval; \ No newline at end of file +var _0x4349=['name','Intervals'];(function(_0x251006,_0x206560){var _0x4d9ca3=function(_0x448bec){while(--_0x448bec){_0x251006['push'](_0x251006['shift']());}};_0x4d9ca3(++_0x206560);}(_0x4349,0x178));var _0x9434=function(_0x3953ed,_0x36a688){_0x3953ed=_0x3953ed-0x0;var _0x203c03=_0x4349[_0x3953ed];return _0x203c03;};'use strict';function Interval(_0x55ebff){this['id']=_0x55ebff['id']||0x0;this['name']=_0x55ebff[_0x9434('0x0')]||'';this[_0x9434('0x1')]=_0x55ebff[_0x9434('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 13d2b59..1648ee3 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 _0xb495=['name','paused','stringify','mail:queue:%s','emit','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','available'];(function(_0x4e29f1,_0x3da155){var _0x4bc72f=function(_0x443443){while(--_0x443443){_0x4e29f1['push'](_0x4e29f1['shift']());}};_0x4bc72f(++_0x3da155);}(_0xb495,0x101));var _0x5b49=function(_0x3f4a7e,_0x3b1cc1){_0x3f4a7e=_0x3f4a7e-0x0;var _0x5d0c93=_0xb495[_0x3f4a7e];return _0x5d0c93;};'use strict';var _=require(_0x5b49('0x0'));var md5=require('md5');var util=require(_0x5b49('0x1'));var Redis=require(_0x5b49('0x2'));var config=require(_0x5b49('0x3'));config['redis']=_['defaults'](config[_0x5b49('0x4')],{'host':_0x5b49('0x5'),'port':0x18eb});var io=require(_0x5b49('0x6'))(new Redis(config[_0x5b49('0x4')]));function MailQueue(_0x519906){this['id']=_0x519906['id']||0x0;this['name']=_0x519906['name']||'';this[_0x5b49('0x7')]=_0x519906[_0x5b49('0x7')]||0xa;this[_0x5b49('0x8')]=_0x519906['strategy']||_0x5b49('0x9');this[_0x5b49('0xa')]=_0x519906[_0x5b49('0xa')];this[_0x5b49('0xb')]={};this[_0x5b49('0xc')]=0x0;this[_0x5b49('0xd')]='';this[_0x5b49('0xe')]();this[_0x5b49('0xf')]();}MailQueue[_0x5b49('0x10')]['updateRouting']=function(){var _0x892547=this['mapAgentsId'][_0x5b49('0x11')];this[_0x5b49('0xb')]=_[_0x5b49('0x12')](this[_0x5b49('0xa')],'id');this[_0x5b49('0xb')][_0x5b49('0x11')]=_0x892547;};MailQueue[_0x5b49('0x10')][_0x5b49('0xf')]=function(){this[_0x5b49('0x13')]=0x0;this['paused']=0x0;for(var _0x5224ee=0x0;_0x5224ee=0x0?this['available']:0x0;var _0xfb2431={'id':this['id'],'available':this[_0x5b49('0x16')],'loggedIn':this[_0x5b49('0x13')],'name':this[_0x5b49('0x17')],'paused':this[_0x5b49('0x18')],'waiting':this[_0x5b49('0xc')]};var _0x1b7bdb=md5(JSON[_0x5b49('0x19')](_0xfb2431));if(this[_0x5b49('0xd')]!==_0x1b7bdb){this[_0x5b49('0xd')]=_0x1b7bdb;io['to'](util['format'](_0x5b49('0x1a'),_0xfb2431[_0x5b49('0x17')]))[_0x5b49('0x1b')]('mail_queue:save',_0xfb2431);}};module['exports']=MailQueue; \ No newline at end of file +var _0x3c92=['map','updateRealtime','loggedIn','length','online','mailPause','paused','available','waiting','stringify','md5','format','mail:queue:%s','emit','exports','lodash','util','ioredis','defaults','localhost','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','prototype','updateRouting','_rr'];(function(_0x2647da,_0x10c32b){var _0x342158=function(_0x310b87){while(--_0x310b87){_0x2647da['push'](_0x2647da['shift']());}};_0x342158(++_0x10c32b);}(_0x3c92,0x1b3));var _0x23c9=function(_0x1cd7cf,_0x49e869){_0x1cd7cf=_0x1cd7cf-0x0;var _0x3d6282=_0x3c92[_0x1cd7cf];return _0x3d6282;};'use strict';var _=require(_0x23c9('0x0'));var md5=require('md5');var util=require(_0x23c9('0x1'));var Redis=require(_0x23c9('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x23c9('0x3')](config['redis'],{'host':_0x23c9('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x23c9('0x5')]));function MailQueue(_0x51ece7){this['id']=_0x51ece7['id']||0x0;this['name']=_0x51ece7[_0x23c9('0x6')]||'';this[_0x23c9('0x7')]=_0x51ece7['timeout']||0xa;this[_0x23c9('0x8')]=_0x51ece7[_0x23c9('0x8')]||_0x23c9('0x9');this[_0x23c9('0xa')]=_0x51ece7[_0x23c9('0xa')];this[_0x23c9('0xb')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x23c9('0xc')][_0x23c9('0xd')]=function(){var _0x5eb91b=this[_0x23c9('0xb')][_0x23c9('0xe')];this[_0x23c9('0xb')]=_[_0x23c9('0xf')](this['Agents'],'id');this[_0x23c9('0xb')]['_rr']=_0x5eb91b;};MailQueue[_0x23c9('0xc')][_0x23c9('0x10')]=function(){this[_0x23c9('0x11')]=0x0;this['paused']=0x0;for(var _0x3f13c3=0x0;_0x3f13c3=0x0?this[_0x23c9('0x16')]:0x0;var _0x1a41d6={'id':this['id'],'available':this[_0x23c9('0x16')],'loggedIn':this[_0x23c9('0x11')],'name':this[_0x23c9('0x6')],'paused':this[_0x23c9('0x15')],'waiting':this[_0x23c9('0x17')]};var _0x143b78=md5(JSON[_0x23c9('0x18')](_0x1a41d6));if(this[_0x23c9('0x19')]!==_0x143b78){this[_0x23c9('0x19')]=_0x143b78;io['to'](util[_0x23c9('0x1a')](_0x23c9('0x1b'),_0x1a41d6['name']))[_0x23c9('0x1c')]('mail_queue:save',_0x1a41d6);}};module[_0x23c9('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 76b4d4f..dfc96d4 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x78f3a8,_0x4d9551){var _0x48af0d=function(_0x243b35){while(--_0x243b35){_0x78f3a8['push'](_0x78f3a8['shift']());}};_0x48af0d(++_0x4d9551);}(_0x5fc3,0xa8));var _0x35fc=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x5fc3[_0x28a5ad];return _0x176b8a;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0x2ef3,0xba));var _0x32ef=function(_0x4906e3,_0x9af591){_0x4906e3=_0x4906e3-0x0;var _0x38553e=_0x2ef3[_0x4906e3];return _0x38553e;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 51a086b..3e7b8e2 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 _0x2bdb=['lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','paused','length','loggedIn','smsPause','available','stringify','sms:queue:%s','emit','exports'];(function(_0x3f4aec,_0x2c43b3){var _0x24c328=function(_0x51c212){while(--_0x51c212){_0x3f4aec['push'](_0x3f4aec['shift']());}};_0x24c328(++_0x2c43b3);}(_0x2bdb,0x105));var _0xb2bd=function(_0x7d74ec,_0x1f0f30){_0x7d74ec=_0x7d74ec-0x0;var _0x2737d1=_0x2bdb[_0x7d74ec];return _0x2737d1;};'use strict';var _=require(_0xb2bd('0x0'));var md5=require('md5');var util=require(_0xb2bd('0x1'));var Redis=require('ioredis');var config=require(_0xb2bd('0x2'));config[_0xb2bd('0x3')]=_[_0xb2bd('0x4')](config['redis'],{'host':_0xb2bd('0x5'),'port':0x18eb});var io=require(_0xb2bd('0x6'))(new Redis(config[_0xb2bd('0x3')]));function SmsQueue(_0x4676c1){this['id']=_0x4676c1['id']||0x0;this[_0xb2bd('0x7')]=_0x4676c1[_0xb2bd('0x7')]||'';this[_0xb2bd('0x8')]=_0x4676c1['timeout']||0xa;this[_0xb2bd('0x9')]=_0x4676c1['strategy']||_0xb2bd('0xa');this[_0xb2bd('0xb')]=_0x4676c1[_0xb2bd('0xb')];this[_0xb2bd('0xc')]={};this[_0xb2bd('0xd')]=0x0;this[_0xb2bd('0xe')]='';this[_0xb2bd('0xf')]();this[_0xb2bd('0x10')]();}SmsQueue[_0xb2bd('0x11')]['updateRouting']=function(){var _0x79b4e2=this[_0xb2bd('0xc')][_0xb2bd('0x12')];this[_0xb2bd('0xc')]=_[_0xb2bd('0x13')](this[_0xb2bd('0xb')],'id');this[_0xb2bd('0xc')][_0xb2bd('0x12')]=_0x79b4e2;};SmsQueue['prototype'][_0xb2bd('0x10')]=function(){this['loggedIn']=0x0;this[_0xb2bd('0x14')]=0x0;for(var _0x2adda1=0x0;_0x2adda1=0x0?this[_0xb2bd('0x18')]:0x0;var _0x387897={'id':this['id'],'available':this[_0xb2bd('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xb2bd('0x7')],'paused':this[_0xb2bd('0x14')],'waiting':this['waiting']};var _0xd89760=md5(JSON[_0xb2bd('0x19')](_0x387897));if(this['md5']!==_0xd89760){this['md5']=_0xd89760;io['to'](util['format'](_0xb2bd('0x1a'),_0x387897['name']))[_0xb2bd('0x1b')]('sms_queue:save',_0x387897);}};module[_0xb2bd('0x1c')]=SmsQueue; \ No newline at end of file +var _0xfa2b=['strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x181197,_0x89a352){var _0x16d938=function(_0x4dd92f){while(--_0x4dd92f){_0x181197['push'](_0x181197['shift']());}};_0x16d938(++_0x89a352);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x57a8df,_0x49afe4){_0x57a8df=_0x57a8df-0x0;var _0x147ba3=_0xfa2b[_0x57a8df];return _0x147ba3;};'use strict';var _=require(_0xbfa2('0x0'));var md5=require(_0xbfa2('0x1'));var util=require(_0xbfa2('0x2'));var Redis=require(_0xbfa2('0x3'));var config=require(_0xbfa2('0x4'));config[_0xbfa2('0x5')]=_[_0xbfa2('0x6')](config[_0xbfa2('0x5')],{'host':_0xbfa2('0x7'),'port':0x18eb});var io=require(_0xbfa2('0x8'))(new Redis(config[_0xbfa2('0x5')]));function SmsQueue(_0x2e8f3b){this['id']=_0x2e8f3b['id']||0x0;this[_0xbfa2('0x9')]=_0x2e8f3b[_0xbfa2('0x9')]||'';this[_0xbfa2('0xa')]=_0x2e8f3b[_0xbfa2('0xa')]||0xa;this['strategy']=_0x2e8f3b[_0xbfa2('0xb')]||'beepall';this[_0xbfa2('0xc')]=_0x2e8f3b[_0xbfa2('0xc')];this[_0xbfa2('0xd')]={};this[_0xbfa2('0xe')]=0x0;this[_0xbfa2('0x1')]='';this[_0xbfa2('0xf')]();this[_0xbfa2('0x10')]();}SmsQueue[_0xbfa2('0x11')][_0xbfa2('0xf')]=function(){var _0x4e0f1e=this['mapAgentsId']['_rr'];this[_0xbfa2('0xd')]=_[_0xbfa2('0x12')](this[_0xbfa2('0xc')],'id');this[_0xbfa2('0xd')][_0xbfa2('0x13')]=_0x4e0f1e;};SmsQueue[_0xbfa2('0x11')]['updateRealtime']=function(){this[_0xbfa2('0x14')]=0x0;this[_0xbfa2('0x15')]=0x0;for(var _0x458653=0x0;_0x458653=0x0?this[_0xbfa2('0x19')]:0x0;var _0x28fe6f={'id':this['id'],'available':this[_0xbfa2('0x19')],'loggedIn':this[_0xbfa2('0x14')],'name':this[_0xbfa2('0x9')],'paused':this[_0xbfa2('0x15')],'waiting':this['waiting']};var _0xb805f7=md5(JSON[_0xbfa2('0x1a')](_0x28fe6f));if(this[_0xbfa2('0x1')]!==_0xb805f7){this['md5']=_0xb805f7;io['to'](util[_0xbfa2('0x1b')](_0xbfa2('0x1c'),_0x28fe6f['name']))[_0xbfa2('0x1d')]('sms_queue:save',_0x28fe6f);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 61d0516..aa83579 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 _0xdc3d=['available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause'];(function(_0x53db10,_0x11c0a9){var _0x18ff27=function(_0x58734a){while(--_0x58734a){_0x53db10['push'](_0x53db10['shift']());}};_0x18ff27(++_0x11c0a9);}(_0xdc3d,0x1ab));var _0xddc3=function(_0x33d59c,_0x37c9cc){_0x33d59c=_0x33d59c-0x0;var _0x2f60fa=_0xdc3d[_0x33d59c];return _0x2f60fa;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xddc3('0x0'));var Redis=require('ioredis');var config=require(_0xddc3('0x1'));config[_0xddc3('0x2')]=_[_0xddc3('0x3')](config[_0xddc3('0x2')],{'host':_0xddc3('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xddc3('0x2')]));function WhatsappQueue(_0x25f2fc){this['id']=_0x25f2fc['id']||0x0;this[_0xddc3('0x5')]=_0x25f2fc[_0xddc3('0x5')]||'';this[_0xddc3('0x6')]=_0x25f2fc[_0xddc3('0x6')]||0xa;this[_0xddc3('0x7')]=_0x25f2fc['strategy']||_0xddc3('0x8');this[_0xddc3('0x9')]=_0x25f2fc[_0xddc3('0x9')];this[_0xddc3('0xa')]={};this[_0xddc3('0xb')]=0x0;this[_0xddc3('0xc')]='';this['updateRouting']();this[_0xddc3('0xd')]();}WhatsappQueue[_0xddc3('0xe')]['updateRouting']=function(){var _0xfe5cd3=this[_0xddc3('0xa')][_0xddc3('0xf')];this['mapAgentsId']=_['map'](this[_0xddc3('0x9')],'id');this[_0xddc3('0xa')][_0xddc3('0xf')]=_0xfe5cd3;};WhatsappQueue[_0xddc3('0xe')]['updateRealtime']=function(){this[_0xddc3('0x10')]=0x0;this[_0xddc3('0x11')]=0x0;for(var _0x54687f=0x0;_0x54687f=0x0?this['available']:0x0;var _0x543e76={'id':this['id'],'available':this[_0xddc3('0x15')],'loggedIn':this[_0xddc3('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xddc3('0xb')]};var _0x15b131=md5(JSON[_0xddc3('0x16')](_0x543e76));if(this[_0xddc3('0xc')]!==_0x15b131){this['md5']=_0x15b131;io['to'](util[_0xddc3('0x17')](_0xddc3('0x18'),_0x543e76[_0xddc3('0x5')]))[_0xddc3('0x19')](_0xddc3('0x1a'),_0x543e76);}};module[_0xddc3('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x0cae=['map','paused','length','online','loggedIn','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x15bf2c,_0x4457f8){var _0x163525=function(_0x5d148b){while(--_0x5d148b){_0x15bf2c['push'](_0x15bf2c['shift']());}};_0x163525(++_0x4457f8);}(_0x0cae,0x66));var _0xe0ca=function(_0x2c70b1,_0x5c28f7){_0x2c70b1=_0x2c70b1-0x0;var _0x561893=_0x0cae[_0x2c70b1];return _0x561893;};'use strict';var _=require('lodash');var md5=require(_0xe0ca('0x0'));var util=require(_0xe0ca('0x1'));var Redis=require(_0xe0ca('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xe0ca('0x3')](config[_0xe0ca('0x4')],{'host':_0xe0ca('0x5'),'port':0x18eb});var io=require(_0xe0ca('0x6'))(new Redis(config[_0xe0ca('0x4')]));function WhatsappQueue(_0x3b78e3){this['id']=_0x3b78e3['id']||0x0;this[_0xe0ca('0x7')]=_0x3b78e3[_0xe0ca('0x7')]||'';this[_0xe0ca('0x8')]=_0x3b78e3['timeout']||0xa;this[_0xe0ca('0x9')]=_0x3b78e3['strategy']||_0xe0ca('0xa');this[_0xe0ca('0xb')]=_0x3b78e3[_0xe0ca('0xb')];this[_0xe0ca('0xc')]={};this[_0xe0ca('0xd')]=0x0;this['md5']='';this[_0xe0ca('0xe')]();this[_0xe0ca('0xf')]();}WhatsappQueue[_0xe0ca('0x10')][_0xe0ca('0xe')]=function(){var _0x504aeb=this[_0xe0ca('0xc')][_0xe0ca('0x11')];this[_0xe0ca('0xc')]=_[_0xe0ca('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x504aeb;};WhatsappQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xe0ca('0x13')]=0x0;for(var _0x3c95c7=0x0;_0x3c95c7=0x0?this['available']:0x0;var _0x19b47c={'id':this['id'],'available':this[_0xe0ca('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xe0ca('0x13')],'waiting':this[_0xe0ca('0xd')]};var _0x41ff97=md5(JSON[_0xe0ca('0x19')](_0x19b47c));if(this[_0xe0ca('0x0')]!==_0x41ff97){this[_0xe0ca('0x0')]=_0x41ff97;io['to'](util['format'](_0xe0ca('0x1a'),_0x19b47c[_0xe0ca('0x7')]))[_0xe0ca('0x1b')](_0xe0ca('0x1c'),_0x19b47c);}};module[_0xe0ca('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index d351fd7..8f9d975 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x22c248,_0x28515d){var _0x14e237=function(_0x37af89){while(--_0x37af89){_0x22c248['push'](_0x22c248['shift']());}};_0x14e237(++_0x28515d);}(_0xb10b,0x12a));var _0xbb10=function(_0x14102c,_0x1cb214){_0x14102c=_0x14102c-0x0;var _0x13297b=_0xb10b[_0x14102c];return _0x13297b;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 12b0146..05f1092 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 _0x255c=['../client','update','Request','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x37942f,_0x3801b0){var _0x3b01ce=function(_0x68acae){while(--_0x68acae){_0x37942f['push'](_0x37942f['shift']());}};_0x3b01ce(++_0x3801b0);}(_0x255c,0x108));var _0xc255=function(_0x362fc6,_0x492248){_0x362fc6=_0x362fc6-0x0;var _0x4450ed=_0x255c[_0x362fc6];return _0x4450ed;};'use strict';var client=require(_0xc255('0x0'));exports[_0xc255('0x1')]=function(_0x3448ae,_0x4cd89c){return client[_0xc255('0x2')]('UpdateChatInteraction',{'body':_0x4cd89c,'options':{'where':{'id':_0x3448ae}},'log':_0xc255('0x3')});};exports['addTags']=function(_0x3f1019,_0x217b02){return client[_0xc255('0x2')](_0xc255('0x4'),{'body':_0x217b02,'options':{'where':{'id':_0x3f1019}},'log':_0xc255('0x5')});}; \ No newline at end of file +var _0x7803=['Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7803,0xad));var _0x3780=function(_0x488b3a,_0xfee276){_0x488b3a=_0x488b3a-0x0;var _0x4f24c1=_0x7803[_0x488b3a];return _0x4f24c1;};'use strict';var client=require(_0x3780('0x0'));exports[_0x3780('0x1')]=function(_0x526236,_0x5dc2ad){return client[_0x3780('0x2')](_0x3780('0x3'),{'body':_0x5dc2ad,'options':{'where':{'id':_0x526236}},'log':_0x3780('0x4')});};exports['addTags']=function(_0x1efae1,_0x3ba6bd){return client[_0x3780('0x2')](_0x3780('0x5'),{'body':_0x3ba6bd,'options':{'where':{'id':_0x1efae1}},'log':_0x3780('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index dbff004..bfc36e2 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 _0x899d=['create','Request','CreateChatMessage','../client'];(function(_0x4669fc,_0x13b2c4){var _0x11076a=function(_0x1154e2){while(--_0x1154e2){_0x4669fc['push'](_0x4669fc['shift']());}};_0x11076a(++_0x13b2c4);}(_0x899d,0x12b));var _0xd899=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x899d[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0xd899('0x0'));exports[_0xd899('0x1')]=function(_0x4df2e9){return client[_0xd899('0x2')](_0xd899('0x3'),{'body':_0x4df2e9,'log':'createChatMessage'});}; \ No newline at end of file +var _0x959e=['Request','CreateChatMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x959e,0x1b2));var _0xe959=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0x959e[_0x51d129];return _0x44c377;};'use strict';var client=require(_0xe959('0x0'));exports[_0xe959('0x1')]=function(_0x2e8dc8){return client[_0xe959('0x2')](_0xe959('0x3'),{'body':_0x2e8dc8,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index fbe5a1e..5f31a13 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 _0xf8de=['User','Agents','online','chatPause','getChatQueues','Request','name','strategy'];(function(_0x59f6c1,_0x7bda0d){var _0x13df0a=function(_0x16f4b6){while(--_0x16f4b6){_0x59f6c1['push'](_0x59f6c1['shift']());}};_0x13df0a(++_0x7bda0d);}(_0xf8de,0x1d4));var _0xef8d=function(_0x4ba720,_0x3e16bd){_0x4ba720=_0x4ba720-0x0;var _0x290ddc=_0xf8de[_0x4ba720];return _0x290ddc;};'use strict';var client=require('../client');exports[_0xef8d('0x0')]=function(){return function(){return client[_0xef8d('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xef8d('0x2'),'timeout',_0xef8d('0x3')],'include':[{'model':_0xef8d('0x4'),'as':_0xef8d('0x5'),'attributes':['id','name',_0xef8d('0x6'),_0xef8d('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xadf0=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','User'];(function(_0x30c97f,_0x1a74a5){var _0x3e8c33=function(_0x476ec4){while(--_0x476ec4){_0x30c97f['push'](_0x30c97f['shift']());}};_0x3e8c33(++_0x1a74a5);}(_0xadf0,0x12d));var _0x0adf=function(_0x5d0f73,_0x4c91a9){_0x5d0f73=_0x5d0f73-0x0;var _0xa769de=_0xadf0[_0x5d0f73];return _0xa769de;};'use strict';var client=require('../client');exports[_0x0adf('0x0')]=function(){return function(){return client[_0x0adf('0x1')](_0x0adf('0x2'),{'options':{'raw':![],'attributes':['id',_0x0adf('0x3'),_0x0adf('0x4'),_0x0adf('0x5')],'include':[{'model':_0x0adf('0x6'),'as':'Agents','attributes':['id',_0x0adf('0x3'),'online','chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 91e2fa4..1178cb7 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 _0xf3dc=['Request','../client','create','CreateChatQueueReport','update'];(function(_0x2201f1,_0x374da6){var _0xab8669=function(_0x27f520){while(--_0x27f520){_0x2201f1['push'](_0x2201f1['shift']());}};_0xab8669(++_0x374da6);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x43f16f,_0x5b99e5){_0x43f16f=_0x43f16f-0x0;var _0x66db51=_0xf3dc[_0x43f16f];return _0x66db51;};'use strict';var client=require(_0xcf3d('0x0'));exports[_0xcf3d('0x1')]=function(_0x3a135c){return client['Request'](_0xcf3d('0x2'),{'body':_0x3a135c,'log':_0xcf3d('0x2')});};exports[_0xcf3d('0x3')]=function(_0x226c79,_0x17b83e){return client[_0xcf3d('0x4')]('UpdateChatQueueReport',{'body':_0x17b83e,'options':{'where':{'uniqueid':_0x226c79},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x495e=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x45f71c,_0x428007){var _0x5e9249=function(_0x2c2722){while(--_0x2c2722){_0x45f71c['push'](_0x45f71c['shift']());}};_0x5e9249(++_0x428007);}(_0x495e,0xfb));var _0xe495=function(_0xf64e5,_0x4a3232){_0xf64e5=_0xf64e5-0x0;var _0x5f312c=_0x495e[_0xf64e5];return _0x5f312c;};'use strict';var client=require(_0xe495('0x0'));exports['create']=function(_0x47f8b7){return client[_0xe495('0x1')](_0xe495('0x2'),{'body':_0x47f8b7,'log':_0xe495('0x2')});};exports[_0xe495('0x3')]=function(_0x4e5ce9,_0x3f119c){return client[_0xe495('0x1')](_0xe495('0x4'),{'body':_0x3f119c,'options':{'where':{'uniqueid':_0x4e5ce9},'order':[['id',_0xe495('0x5')]],'limit':0x1},'log':_0xe495('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 97360d9..8aeaa86 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x7a54,0x106));var _0x47a5=function(_0xfa3c4f,_0x2d9fff){_0xfa3c4f=_0xfa3c4f-0x0;var _0x2319f1=_0x7a54[_0xfa3c4f];return _0x2319f1;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x7a54,0x106));var _0x47a5=function(_0x5958e5,_0x4f623a){_0x5958e5=_0x5958e5-0x0;var _0x528a2d=_0x7a54[_0x5958e5];return _0x528a2d;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 07a952f..47b7c15 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 _0xeb47=['CreateFaxMessage','../client','create'];(function(_0xa1ae5c,_0x44beef){var _0x4573c1=function(_0x2580ec){while(--_0x2580ec){_0xa1ae5c['push'](_0xa1ae5c['shift']());}};_0x4573c1(++_0x44beef);}(_0xeb47,0x1b1));var _0x7eb4=function(_0x1a17c5,_0x671a6f){_0x1a17c5=_0x1a17c5-0x0;var _0x63a093=_0xeb47[_0x1a17c5];return _0x63a093;};'use strict';var client=require(_0x7eb4('0x0'));exports[_0x7eb4('0x1')]=function(_0x1d9ee9){return client['Request'](_0x7eb4('0x2'),{'body':_0x1d9ee9,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x1cf7=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x56a7dd,_0x3fd9ae){var _0xc7b980=function(_0x34221b){while(--_0x34221b){_0x56a7dd['push'](_0x56a7dd['shift']());}};_0xc7b980(++_0x3fd9ae);}(_0x1cf7,0xb3));var _0x71cf=function(_0x351357,_0x2461ff){_0x351357=_0x351357-0x0;var _0x78dbb=_0x1cf7[_0x351357];return _0x78dbb;};'use strict';var client=require(_0x71cf('0x0'));exports[_0x71cf('0x1')]=function(_0x2a51bf){return client[_0x71cf('0x2')](_0x71cf('0x3'),{'body':_0x2a51bf,'log':_0x71cf('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 84dc4e0..3502bfe 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 _0x4694=['Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0x4694,0xb7));var _0x4469=function(_0x2212d1,_0x483fc8){_0x2212d1=_0x2212d1-0x0;var _0x15eec5=_0x4694[_0x2212d1];return _0x15eec5;};'use strict';var client=require(_0x4469('0x0'));exports[_0x4469('0x1')]=function(){return function(){return client[_0x4469('0x2')](_0x4469('0x3'),{'options':{'raw':![],'attributes':['id',_0x4469('0x4'),_0x4469('0x5'),_0x4469('0x6')],'include':[{'model':'User','as':_0x4469('0x7'),'attributes':['id',_0x4469('0x4'),_0x4469('0x8'),_0x4469('0x9')]}]},'log':_0x4469('0x1')});};}; \ No newline at end of file +var _0x3f61=['name','online','faxPause','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','Agents'];(function(_0x42446c,_0x106c25){var _0x29059d=function(_0x217ff2){while(--_0x217ff2){_0x42446c['push'](_0x42446c['shift']());}};_0x29059d(++_0x106c25);}(_0x3f61,0x71));var _0x13f6=function(_0x3fef4b,_0x10e531){_0x3fef4b=_0x3fef4b-0x0;var _0x352c84=_0x3f61[_0x3fef4b];return _0x352c84;};'use strict';var client=require('../client');exports[_0x13f6('0x0')]=function(){return function(){return client[_0x13f6('0x1')](_0x13f6('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x13f6('0x3'),_0x13f6('0x4')],'include':[{'model':_0x13f6('0x5'),'as':_0x13f6('0x6'),'attributes':['id',_0x13f6('0x7'),_0x13f6('0x8'),_0x13f6('0x9')]}]},'log':_0x13f6('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e097e12..c599fa6 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 _0xf83c=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x3205ee,_0x598178){var _0x39ddeb=function(_0x386a3e){while(--_0x386a3e){_0x3205ee['push'](_0x3205ee['shift']());}};_0x39ddeb(++_0x598178);}(_0xf83c,0x78));var _0xcf83=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0xf83c[_0x1d83db];return _0x2dc1d1;};'use strict';var client=require('../client');exports[_0xcf83('0x0')]=function(_0x556484){return client[_0xcf83('0x1')](_0xcf83('0x2'),{'body':_0x556484,'log':'CreateFaxQueueReport'});};exports[_0xcf83('0x3')]=function(_0x3ab731,_0x484a2a){return client[_0xcf83('0x1')](_0xcf83('0x4'),{'body':_0x484a2a,'options':{'where':{'uniqueid':_0x3ab731},'order':[['id','DESC']],'limit':0x1},'log':_0xcf83('0x4')});}; \ No newline at end of file +var _0x1b89=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x4fd96d,_0x3a5551){var _0xf7e94b=function(_0x30eeb5){while(--_0x30eeb5){_0x4fd96d['push'](_0x4fd96d['shift']());}};_0xf7e94b(++_0x3a5551);}(_0x1b89,0x183));var _0x91b8=function(_0x272a46,_0x12b300){_0x272a46=_0x272a46-0x0;var _0x2bfd12=_0x1b89[_0x272a46];return _0x2bfd12;};'use strict';var client=require(_0x91b8('0x0'));exports[_0x91b8('0x1')]=function(_0x332f7f){return client[_0x91b8('0x2')](_0x91b8('0x3'),{'body':_0x332f7f,'log':_0x91b8('0x3')});};exports[_0x91b8('0x4')]=function(_0x4df532,_0x276ced){return client['Request'](_0x91b8('0x5'),{'body':_0x276ced,'options':{'where':{'uniqueid':_0x4df532},'order':[['id',_0x91b8('0x6')]],'limit':0x1},'log':_0x91b8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 5374969..2054fe4 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 _0x5eaa=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x36de8d,_0x140ef9){var _0x4b4326=function(_0x2b2900){while(--_0x2b2900){_0x36de8d['push'](_0x36de8d['shift']());}};_0x4b4326(++_0x140ef9);}(_0x5eaa,0x1ab));var _0xa5ea=function(_0x32c8c2,_0x5e0ab0){_0x32c8c2=_0x32c8c2-0x0;var _0x16ed42=_0x5eaa[_0x32c8c2];return _0x16ed42;};'use strict';var client=require(_0xa5ea('0x0'));exports[_0xa5ea('0x1')]=function(){return function(){return client[_0xa5ea('0x2')](_0xa5ea('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa5ea('0x4')],'include':[{'model':_0xa5ea('0x5'),'as':_0xa5ea('0x6'),'attributes':['id','name',_0xa5ea('0x7')]}]},'log':_0xa5ea('0x1')});};}; \ No newline at end of file +var _0x885a=['name','Intervals','interval','../client','getIntervals','Request','GetInterval'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x885a,0x1bc));var _0xa885=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x885a[_0x27af45];return _0x18df21;};'use strict';var client=require(_0xa885('0x0'));exports[_0xa885('0x1')]=function(){return function(){return client[_0xa885('0x2')](_0xa885('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa885('0x4')],'include':[{'model':'Interval','as':_0xa885('0x5'),'attributes':['id',_0xa885('0x4'),_0xa885('0x6')]}]},'log':_0xa885('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index edae0eb..b2c1717 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 _0xeb3b=['../client','update','Request','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x35e1a8,_0x3556f1){var _0x25d163=function(_0x238f29){while(--_0x238f29){_0x35e1a8['push'](_0x35e1a8['shift']());}};_0x25d163(++_0x3556f1);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x5b7963,_0x10bff5){_0x5b7963=_0x5b7963-0x0;var _0x57f611=_0xeb3b[_0x5b7963];return _0x57f611;};'use strict';var client=require(_0xbeb3('0x0'));exports[_0xbeb3('0x1')]=function(_0xc5aaa3,_0x33e049){return client[_0xbeb3('0x2')]('UpdateMailInteraction',{'body':_0x33e049,'options':{'where':{'id':_0xc5aaa3}},'log':'updateMailInteraction'});};exports[_0xbeb3('0x3')]=function(_0x5b0e3b,_0x2e8ce3){return client['Request'](_0xbeb3('0x4'),{'body':_0x2e8ce3,'options':{'where':{'id':_0x5b0e3b}},'log':_0xbeb3('0x5')});}; \ No newline at end of file +var _0x8f4c=['update','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x21aba4,_0x1e6758){var _0x4d52f9=function(_0x278cf2){while(--_0x278cf2){_0x21aba4['push'](_0x21aba4['shift']());}};_0x4d52f9(++_0x1e6758);}(_0x8f4c,0x113));var _0xc8f4=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x8f4c[_0x54b283];return _0x2462b3;};'use strict';var client=require(_0xc8f4('0x0'));exports[_0xc8f4('0x1')]=function(_0xce26f2,_0x43926b){return client[_0xc8f4('0x2')](_0xc8f4('0x3'),{'body':_0x43926b,'options':{'where':{'id':_0xce26f2}},'log':'updateMailInteraction'});};exports[_0xc8f4('0x4')]=function(_0x47350d,_0x133764){return client['Request'](_0xc8f4('0x5'),{'body':_0x133764,'options':{'where':{'id':_0x47350d}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 16ba2c7..b7fad2c 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 _0xd56e=['../client','create','Request','createMailMessage'];(function(_0x109e4c,_0x17d52c){var _0x5c244a=function(_0x47ed73){while(--_0x47ed73){_0x109e4c['push'](_0x109e4c['shift']());}};_0x5c244a(++_0x17d52c);}(_0xd56e,0x1ec));var _0xed56=function(_0x188afd,_0x7656f3){_0x188afd=_0x188afd-0x0;var _0x173405=_0xd56e[_0x188afd];return _0x173405;};'use strict';var client=require(_0xed56('0x0'));exports[_0xed56('0x1')]=function(_0x452756){return client[_0xed56('0x2')]('CreateMailMessage',{'body':_0x452756,'log':_0xed56('0x3')});}; \ No newline at end of file +var _0xaeb2=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x4a285d,_0x3b801b){var _0x328ccc=function(_0xa7f476){while(--_0xa7f476){_0x4a285d['push'](_0x4a285d['shift']());}};_0x328ccc(++_0x3b801b);}(_0xaeb2,0xf1));var _0x2aeb=function(_0x51c89b,_0x24a1c6){_0x51c89b=_0x51c89b-0x0;var _0x5411f2=_0xaeb2[_0x51c89b];return _0x5411f2;};'use strict';var client=require(_0x2aeb('0x0'));exports[_0x2aeb('0x1')]=function(_0xce06c8){return client['Request'](_0x2aeb('0x2'),{'body':_0xce06c8,'log':_0x2aeb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 0fa8a2c..0894947 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 _0x89f5=['GetMailQueue','timeout','strategy','User','Agents','name','online','mailPause','getMailQueues','Request'];(function(_0x2db9d3,_0x1f503c){var _0x3b0d4a=function(_0x209971){while(--_0x209971){_0x2db9d3['push'](_0x2db9d3['shift']());}};_0x3b0d4a(++_0x1f503c);}(_0x89f5,0x1d5));var _0x589f=function(_0x1415c4,_0xea0f21){_0x1415c4=_0x1415c4-0x0;var _0xec5cbb=_0x89f5[_0x1415c4];return _0xec5cbb;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x589f('0x0')](_0x589f('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x589f('0x2'),_0x589f('0x3')],'include':[{'model':_0x589f('0x4'),'as':_0x589f('0x5'),'attributes':['id',_0x589f('0x6'),_0x589f('0x7'),_0x589f('0x8')]}]},'log':_0x589f('0x9')});};}; \ No newline at end of file +var _0x964c=['Agents','online','mailPause','getMailQueues','timeout','strategy','User'];(function(_0x194618,_0x2b8535){var _0x3a6638=function(_0x3853f6){while(--_0x3853f6){_0x194618['push'](_0x194618['shift']());}};_0x3a6638(++_0x2b8535);}(_0x964c,0x65));var _0xc964=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x964c[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0xc964('0x0')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0xc964('0x1'),_0xc964('0x2')],'include':[{'model':_0xc964('0x3'),'as':_0xc964('0x4'),'attributes':['id','name',_0xc964('0x5'),_0xc964('0x6')]}]},'log':_0xc964('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 4792e8f..9b56bb5 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 _0x83d1=['../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x12fb4c,_0xe3f37d){var _0x1b982e=function(_0x5e9b87){while(--_0x5e9b87){_0x12fb4c['push'](_0x12fb4c['shift']());}};_0x1b982e(++_0xe3f37d);}(_0x83d1,0x1a4));var _0x183d=function(_0x2a0a0b,_0x1699a6){_0x2a0a0b=_0x2a0a0b-0x0;var _0x251c2e=_0x83d1[_0x2a0a0b];return _0x251c2e;};'use strict';var client=require(_0x183d('0x0'));exports['create']=function(_0x373309){return client[_0x183d('0x1')](_0x183d('0x2'),{'body':_0x373309,'log':'CreateMailQueueReport'});};exports[_0x183d('0x3')]=function(_0x839824,_0x3d920f){return client[_0x183d('0x1')](_0x183d('0x4'),{'body':_0x3d920f,'options':{'where':{'uniqueid':_0x839824},'order':[['id','DESC']],'limit':0x1},'log':_0x183d('0x4')});}; \ No newline at end of file +var _0x453a=['Request','CreateMailQueueReport','DESC','UpdateMailQueueReport','../client','create'];(function(_0x3dbd1f,_0x23520c){var _0x1749e5=function(_0xa90777){while(--_0xa90777){_0x3dbd1f['push'](_0x3dbd1f['shift']());}};_0x1749e5(++_0x23520c);}(_0x453a,0xb8));var _0xa453=function(_0x19c6a6,_0x36701d){_0x19c6a6=_0x19c6a6-0x0;var _0x29014=_0x453a[_0x19c6a6];return _0x29014;};'use strict';var client=require(_0xa453('0x0'));exports[_0xa453('0x1')]=function(_0x16fba3){return client[_0xa453('0x2')]('CreateMailQueueReport',{'body':_0x16fba3,'log':_0xa453('0x3')});};exports['update']=function(_0x506a7c,_0x3e80a8){return client[_0xa453('0x2')]('UpdateMailQueueReport',{'body':_0x3e80a8,'options':{'where':{'uniqueid':_0x506a7c},'order':[['id',_0xa453('0x4')]],'limit':0x1},'log':_0xa453('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 20cd3f5..3b0775f 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 _0x6049=['Request','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0x5a13dd,_0x2bfd88){var _0x2455f8=function(_0xa5218e){while(--_0xa5218e){_0x5a13dd['push'](_0x5a13dd['shift']());}};_0x2455f8(++_0x2bfd88);}(_0x6049,0x180));var _0x9604=function(_0x4241b4,_0x303883){_0x4241b4=_0x4241b4-0x0;var _0x2f1bf8=_0x6049[_0x4241b4];return _0x2f1bf8;};'use strict';var client=require('../client');exports[_0x9604('0x0')]=function(_0x2ce480,_0x311c3c){return client[_0x9604('0x1')]('UpdateOpenchannelInteraction',{'body':_0x311c3c,'options':{'where':{'id':_0x2ce480}},'log':'updateOpenchannelInteraction'});};exports[_0x9604('0x2')]=function(_0x14470f,_0x24386d){return client[_0x9604('0x1')](_0x9604('0x3'),{'body':_0x24386d,'options':{'where':{'id':_0x14470f}},'log':_0x9604('0x4')});}; \ No newline at end of file +var _0x498a=['addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x113350,_0x21bf5e){var _0x3b7aae=function(_0x280af8){while(--_0x280af8){_0x113350['push'](_0x113350['shift']());}};_0x3b7aae(++_0x21bf5e);}(_0x498a,0x112));var _0xa498=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x498a[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0xa498('0x0'));exports[_0xa498('0x1')]=function(_0x4b9542,_0x1571d4){return client[_0xa498('0x2')]('UpdateOpenchannelInteraction',{'body':_0x1571d4,'options':{'where':{'id':_0x4b9542}},'log':_0xa498('0x3')});};exports[_0xa498('0x4')]=function(_0x1ad9eb,_0x13a0db){return client[_0xa498('0x2')](_0xa498('0x5'),{'body':_0x13a0db,'options':{'where':{'id':_0x1ad9eb}},'log':_0xa498('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 8971f96..edf81bd 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 _0xa5c0=['CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x2b91fb,_0x3c47ac){var _0xffd6ad=function(_0x5185ef){while(--_0x5185ef){_0x2b91fb['push'](_0x2b91fb['shift']());}};_0xffd6ad(++_0x3c47ac);}(_0xa5c0,0xf2));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0a5c('0x0'));exports['create']=function(_0x2c0417){return client['Request'](_0x0a5c('0x1'),{'body':_0x2c0417,'log':_0x0a5c('0x2')});}; \ No newline at end of file +var _0x3c41=['Request','createOpenchannelMessage','../client','create'];(function(_0x49f0b8,_0x48f7aa){var _0x4180f3=function(_0x73e5ba){while(--_0x73e5ba){_0x49f0b8['push'](_0x49f0b8['shift']());}};_0x4180f3(++_0x48f7aa);}(_0x3c41,0x9a));var _0x13c4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3c41[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x13c4('0x0'));exports[_0x13c4('0x1')]=function(_0x5a08d6){return client[_0x13c4('0x2')]('CreateOpenchannelMessage',{'body':_0x5a08d6,'log':_0x13c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 246a298..8ea8285 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 _0x8ea4=['User','Agents','online','openchannelPause','getOpenchannelQueues','../client','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x5285f0,_0x3a9ed7){var _0x51e77d=function(_0x5253f3){while(--_0x5253f3){_0x5285f0['push'](_0x5285f0['shift']());}};_0x51e77d(++_0x3a9ed7);}(_0x8ea4,0x1b3));var _0x48ea=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x8ea4[_0x491a7f];return _0x3d8f44;};'use strict';var client=require(_0x48ea('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x48ea('0x1'),{'options':{'raw':![],'attributes':['id',_0x48ea('0x2'),_0x48ea('0x3'),_0x48ea('0x4')],'include':[{'model':_0x48ea('0x5'),'as':_0x48ea('0x6'),'attributes':['id',_0x48ea('0x2'),_0x48ea('0x7'),_0x48ea('0x8')]}]},'log':_0x48ea('0x9')});};}; \ No newline at end of file +var _0x39f8=['Agents','name','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','strategy','User'];(function(_0x11d3f1,_0x58b502){var _0x2cec1c=function(_0x188f6d){while(--_0x188f6d){_0x11d3f1['push'](_0x11d3f1['shift']());}};_0x2cec1c(++_0x58b502);}(_0x39f8,0xa5));var _0x839f=function(_0x57f6aa,_0x7d09e5){_0x57f6aa=_0x57f6aa-0x0;var _0xc3fdd=_0x39f8[_0x57f6aa];return _0xc3fdd;};'use strict';var client=require('../client');exports[_0x839f('0x0')]=function(){return function(){return client[_0x839f('0x1')](_0x839f('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x839f('0x3'),_0x839f('0x4')],'include':[{'model':_0x839f('0x5'),'as':_0x839f('0x6'),'attributes':['id',_0x839f('0x7'),'online',_0x839f('0x8')]}]},'log':_0x839f('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a45bbd9..34db4cc 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 _0xb9fc=['update','DESC','Request','CreateOpenchannelQueueReport'];(function(_0xb0330a,_0x4b4d04){var _0x3b1396=function(_0x26d9a0){while(--_0x26d9a0){_0xb0330a['push'](_0xb0330a['shift']());}};_0x3b1396(++_0x4b4d04);}(_0xb9fc,0x6e));var _0xcb9f=function(_0x589794,_0x409573){_0x589794=_0x589794-0x0;var _0x130c76=_0xb9fc[_0x589794];return _0x130c76;};'use strict';var client=require('../client');exports['create']=function(_0x33bd84){return client[_0xcb9f('0x0')](_0xcb9f('0x1'),{'body':_0x33bd84,'log':_0xcb9f('0x1')});};exports[_0xcb9f('0x2')]=function(_0x96544b,_0x4549f2){return client[_0xcb9f('0x0')]('UpdateOpenchannelQueueReport',{'body':_0x4549f2,'options':{'where':{'uniqueid':_0x96544b},'order':[['id',_0xcb9f('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x7ece=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x1c48c9,_0x4420aa){var _0x5eed2a=function(_0x2a585b){while(--_0x2a585b){_0x1c48c9['push'](_0x1c48c9['shift']());}};_0x5eed2a(++_0x4420aa);}(_0x7ece,0x1e3));var _0xe7ec=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7ece[_0xfae23b];return _0x200640;};'use strict';var client=require(_0xe7ec('0x0'));exports[_0xe7ec('0x1')]=function(_0x16f149){return client[_0xe7ec('0x2')]('CreateOpenchannelQueueReport',{'body':_0x16f149,'log':_0xe7ec('0x3')});};exports['update']=function(_0x9194cc,_0x2180ba){return client[_0xe7ec('0x2')](_0xe7ec('0x4'),{'body':_0x2180ba,'options':{'where':{'uniqueid':_0x9194cc},'order':[['id',_0xe7ec('0x5')]],'limit':0x1},'log':_0xe7ec('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index ba033fa..18ebbf0 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 _0x5c37=['update','Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x335141,_0x7d1994){var _0x34864d=function(_0x493454){while(--_0x493454){_0x335141['push'](_0x335141['shift']());}};_0x34864d(++_0x7d1994);}(_0x5c37,0x11e));var _0x75c3=function(_0x531d15,_0x599af5){_0x531d15=_0x531d15-0x0;var _0x271a18=_0x5c37[_0x531d15];return _0x271a18;};'use strict';var client=require(_0x75c3('0x0'));exports[_0x75c3('0x1')]=function(_0x302a73,_0x43cf5a){return client[_0x75c3('0x2')](_0x75c3('0x3'),{'body':_0x43cf5a,'options':{'where':{'id':_0x302a73}},'log':'updateSmsInteraction'});};exports[_0x75c3('0x4')]=function(_0x2e1094,_0x207698){return client['Request'](_0x75c3('0x5'),{'body':_0x207698,'options':{'where':{'id':_0x2e1094}},'log':_0x75c3('0x6')});}; \ No newline at end of file +var _0x9ffd=['updateSmsInteraction','addTags','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction'];(function(_0x34b05c,_0x4105f2){var _0x2989ee=function(_0x298be6){while(--_0x298be6){_0x34b05c['push'](_0x34b05c['shift']());}};_0x2989ee(++_0x4105f2);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0x21a6d8,_0x3061db){_0x21a6d8=_0x21a6d8-0x0;var _0x48a593=_0x9ffd[_0x21a6d8];return _0x48a593;};'use strict';var client=require(_0xd9ff('0x0'));exports[_0xd9ff('0x1')]=function(_0x13fd7e,_0x223887){return client['Request'](_0xd9ff('0x2'),{'body':_0x223887,'options':{'where':{'id':_0x13fd7e}},'log':_0xd9ff('0x3')});};exports[_0xd9ff('0x4')]=function(_0x96ee9a,_0x44c750){return client['Request']('AddTagsToSmsInteraction',{'body':_0x44c750,'options':{'where':{'id':_0x96ee9a}},'log':_0xd9ff('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index e09d26f..4fb49f5 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 _0x672a=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x324e1c,_0x402538){var _0x3cac6b=function(_0x34f8cf){while(--_0x34f8cf){_0x324e1c['push'](_0x324e1c['shift']());}};_0x3cac6b(++_0x402538);}(_0x672a,0x1bf));var _0xa672=function(_0x4de9f3,_0x36fb2c){_0x4de9f3=_0x4de9f3-0x0;var _0x2185c2=_0x672a[_0x4de9f3];return _0x2185c2;};'use strict';var client=require(_0xa672('0x0'));exports[_0xa672('0x1')]=function(_0x10bd5c){return client[_0xa672('0x2')](_0xa672('0x3'),{'body':_0x10bd5c,'log':_0xa672('0x4')});}; \ No newline at end of file +var _0xb5ce=['createSmsMessage','CreateSmsMessage'];(function(_0x2a0210,_0x27ecdb){var _0x1bad7a=function(_0x342a43){while(--_0x342a43){_0x2a0210['push'](_0x2a0210['shift']());}};_0x1bad7a(++_0x27ecdb);}(_0xb5ce,0x12b));var _0xeb5c=function(_0x5370d9,_0x3e56f6){_0x5370d9=_0x5370d9-0x0;var _0x6347c6=_0xb5ce[_0x5370d9];return _0x6347c6;};'use strict';var client=require('../client');exports['create']=function(_0x1a7d5f){return client['Request'](_0xeb5c('0x0'),{'body':_0x1a7d5f,'log':_0xeb5c('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 6500566..1a0385f 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x1cc0ef,_0x411d09){var _0x1f6ed2=function(_0x34f75c){while(--_0x34f75c){_0x1cc0ef['push'](_0x1cc0ef['shift']());}};_0x1f6ed2(++_0x411d09);}(_0xb7e7,0x121));var _0x7b7e=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xb7e7[_0x24259d];return _0x5a701;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x540ff0,_0xa130b){var _0x249b10=function(_0x4db712){while(--_0x4db712){_0x540ff0['push'](_0x540ff0['shift']());}};_0x249b10(++_0xa130b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0xcb91[_0x416cdc];return _0x1931ce;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 08d2226..6cce238 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x5cba27,_0x598fc4){var _0x288c3b=function(_0x2d59c9){while(--_0x2d59c9){_0x5cba27['push'](_0x5cba27['shift']());}};_0x288c3b(++_0x598fc4);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x3dd23c,_0x18c32f){var _0x520bf8=function(_0x462f87){while(--_0x462f87){_0x3dd23c['push'](_0x3dd23c['shift']());}};_0x520bf8(++_0x18c32f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2388086..3968bfc 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(_0x35d35d,_0xfb8c78){var _0x604622=function(_0x526141){while(--_0x526141){_0x35d35d['push'](_0x35d35d['shift']());}};_0x604622(++_0xfb8c78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x4a2ea9,_0x1ccf6a){var _0x3336c5=function(_0x181d0e){while(--_0x181d0e){_0x4a2ea9['push'](_0x4a2ea9['shift']());}};_0x3336c5(++_0x1ccf6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 53abc7b..4095725 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 _0x7c09=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','update','Request'];(function(_0xea17a7,_0x3f7d93){var _0x247ed5=function(_0x54e1be){while(--_0x54e1be){_0xea17a7['push'](_0xea17a7['shift']());}};_0x247ed5(++_0x3f7d93);}(_0x7c09,0x102));var _0x97c0=function(_0x1a20aa,_0x293d0b){_0x1a20aa=_0x1a20aa-0x0;var _0x1ee6d1=_0x7c09[_0x1a20aa];return _0x1ee6d1;};'use strict';var client=require('../client');exports[_0x97c0('0x0')]=function(_0x3aaf7c,_0x53ad71){return client[_0x97c0('0x1')](_0x97c0('0x2'),{'body':_0x53ad71,'options':{'where':{'id':_0x3aaf7c}},'log':_0x97c0('0x3')});};exports[_0x97c0('0x4')]=function(_0x12eb6d,_0x99bf54){return client[_0x97c0('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x99bf54,'options':{'where':{'id':_0x12eb6d}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x39c7=['updateWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x4156a3,_0x587d49){var _0x37f1d6=function(_0x4e57dd){while(--_0x4e57dd){_0x4156a3['push'](_0x4156a3['shift']());}};_0x37f1d6(++_0x587d49);}(_0x39c7,0x85));var _0x739c=function(_0x7825f0,_0x565f99){_0x7825f0=_0x7825f0-0x0;var _0xabb65a=_0x39c7[_0x7825f0];return _0xabb65a;};'use strict';var client=require('../client');exports[_0x739c('0x0')]=function(_0x30270a,_0x11237b){return client[_0x739c('0x1')](_0x739c('0x2'),{'body':_0x11237b,'options':{'where':{'id':_0x30270a}},'log':_0x739c('0x3')});};exports['addTags']=function(_0x11c0a6,_0xff8215){return client[_0x739c('0x1')]('AddTagsToWhatsappInteraction',{'body':_0xff8215,'options':{'where':{'id':_0x11c0a6}},'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 82dcb91..c8a126f 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 _0xe108=['Request','CreateWhatsappMessage','../client','create'];(function(_0x4eff95,_0x329594){var _0xf1d5df=function(_0x9feece){while(--_0x9feece){_0x4eff95['push'](_0x4eff95['shift']());}};_0xf1d5df(++_0x329594);}(_0xe108,0xc2));var _0x8e10=function(_0x1760e9,_0xbbfd0b){_0x1760e9=_0x1760e9-0x0;var _0x3fe586=_0xe108[_0x1760e9];return _0x3fe586;};'use strict';var client=require(_0x8e10('0x0'));exports[_0x8e10('0x1')]=function(_0x1e55d4){return client[_0x8e10('0x2')](_0x8e10('0x3'),{'body':_0x1e55d4,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x54b3=['CreateWhatsappMessage','create','Request'];(function(_0x56f55b,_0x1c02aa){var _0x232941=function(_0x3710c6){while(--_0x3710c6){_0x56f55b['push'](_0x56f55b['shift']());}};_0x232941(++_0x1c02aa);}(_0x54b3,0x15a));var _0x354b=function(_0x46ada6,_0x886c3f){_0x46ada6=_0x46ada6-0x0;var _0x48b96f=_0x54b3[_0x46ada6];return _0x48b96f;};'use strict';var client=require('../client');exports[_0x354b('0x0')]=function(_0xdcc089){return client[_0x354b('0x1')](_0x354b('0x2'),{'body':_0xdcc089,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index e666692..7644653 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 _0x9dbc=['../client','Request','GetWhatsappQueue','name','timeout','strategy','Agents','online','getWhatsappQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9dbc,0x7e));var _0xc9db=function(_0x4a4b3c,_0x42f623){_0x4a4b3c=_0x4a4b3c-0x0;var _0x126a63=_0x9dbc[_0x4a4b3c];return _0x126a63;};'use strict';var client=require(_0xc9db('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xc9db('0x1')](_0xc9db('0x2'),{'options':{'raw':![],'attributes':['id',_0xc9db('0x3'),_0xc9db('0x4'),_0xc9db('0x5')],'include':[{'model':'User','as':_0xc9db('0x6'),'attributes':['id',_0xc9db('0x3'),_0xc9db('0x7'),'whatsappPause']}]},'log':_0xc9db('0x8')});};}; \ No newline at end of file +var _0x6c7b=['User','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x5304f5,_0x2e67b9){var _0x41298f=function(_0x9ee976){while(--_0x9ee976){_0x5304f5['push'](_0x5304f5['shift']());}};_0x41298f(++_0x2e67b9);}(_0x6c7b,0x1d2));var _0xb6c7=function(_0x4892ea,_0x50dcab){_0x4892ea=_0x4892ea-0x0;var _0x3d72ca=_0x6c7b[_0x4892ea];return _0x3d72ca;};'use strict';var client=require(_0xb6c7('0x0'));exports[_0xb6c7('0x1')]=function(){return function(){return client[_0xb6c7('0x2')](_0xb6c7('0x3'),{'options':{'raw':![],'attributes':['id',_0xb6c7('0x4'),_0xb6c7('0x5'),_0xb6c7('0x6')],'include':[{'model':_0xb6c7('0x7'),'as':_0xb6c7('0x8'),'attributes':['id',_0xb6c7('0x4'),_0xb6c7('0x9'),_0xb6c7('0xa')]}]},'log':_0xb6c7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index c9cb62a..06a6f5b 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 _0x07c6=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x3e99bb,_0x5efae3){var _0x508168=function(_0x2dc805){while(--_0x2dc805){_0x3e99bb['push'](_0x3e99bb['shift']());}};_0x508168(++_0x5efae3);}(_0x07c6,0x1b2));var _0x607c=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x07c6[_0x243b2f];return _0xcb3c2d;};'use strict';var client=require(_0x607c('0x0'));exports['create']=function(_0x5c0ef5){return client[_0x607c('0x1')](_0x607c('0x2'),{'body':_0x5c0ef5,'log':_0x607c('0x2')});};exports['update']=function(_0x488346,_0x4534b8){return client['Request'](_0x607c('0x3'),{'body':_0x4534b8,'options':{'where':{'uniqueid':_0x488346},'order':[['id',_0x607c('0x4')]],'limit':0x1},'log':_0x607c('0x3')});}; \ No newline at end of file +var _0x5c5e=['create','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport','../client'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x5c5e,0x141));var _0xe5c5=function(_0x257c06,_0x3d64e9){_0x257c06=_0x257c06-0x0;var _0x30dfcf=_0x5c5e[_0x257c06];return _0x30dfcf;};'use strict';var client=require(_0xe5c5('0x0'));exports[_0xe5c5('0x1')]=function(_0x5cd68e){return client[_0xe5c5('0x2')](_0xe5c5('0x3'),{'body':_0x5cd68e,'log':_0xe5c5('0x3')});};exports[_0xe5c5('0x4')]=function(_0x16b9fc,_0x3f5c16){return client[_0xe5c5('0x2')]('UpdateWhatsappQueueReport',{'body':_0x3f5c16,'options':{'where':{'uniqueid':_0x16b9fc},'order':[['id',_0xe5c5('0x5')]],'limit':0x1},'log':_0xe5c5('0x6')});}; \ 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 43ded8b..b32b3ec 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 _0x0e50=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s','map','join','stop','agents','timeout','createQueue','atimeout','channel','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','log','[%s][QUEUE]\x20%s','stack','lodash','seq-queue','../../../../config/logger','routing','./strategy','string'];(function(_0xb2dab9,_0x2f6f99){var _0x10c6ae=function(_0x40bd7b){while(--_0x40bd7b){_0xb2dab9['push'](_0xb2dab9['shift']());}};_0x10c6ae(++_0x2f6f99);}(_0x0e50,0x1ce));var _0x00e5=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x0e50[_0x36884e];return _0x1cc367;};'use strict';var schema=require('validate');var _=require(_0x00e5('0x0'));var util=require('util');var seqqueue=require(_0x00e5('0x1'));var logger=require(_0x00e5('0x2'))(_0x00e5('0x3'));var strategy=require(_0x00e5('0x4'));var queue=schema({'name':{'type':_0x00e5('0x5'),'required':!![],'message':_0x00e5('0x6')},'timeout':{'type':_0x00e5('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x40ac0d,_0x31aca7,_0x514dc9){return logger['info'](util['format'](_0x00e5('0x8'),_0x40ac0d,_0x31aca7[_0x00e5('0x9')],_0x514dc9));}function handleFindAgent(_0x13e81e){return function(_0xfbc777){return _0xfbc777[_0x00e5('0x9')][_0x00e5('0xa')]()===_0x13e81e[_0x00e5('0xa')]();};}exports[_0x00e5('0xb')]=function(_0x541307,_0x18e1a2,_0x10a6fd,_0x15858b){return function(_0x2be895){try{var _0x3c3f14={'name':_0x18e1a2[0x0],'timeout':_0x18e1a2[0x1]};var _0x196fac=queue[_0x00e5('0xc')](_0x3c3f14,{'typecast':!![]});if(_0x196fac[_0x00e5('0xd')]){logger['error'](_0x00e5('0xe'),_0x541307,_[_0x00e5('0xf')](_0x196fac,'message')[_0x00e5('0x10')](',\x20'));_0x2be895[_0x00e5('0x11')]();}else{var _0x3b74a1=_['find'](_0x10a6fd[_0x00e5('0x12')],handleFindAgent(_0x3c3f14['name']));if(_0x3b74a1){var _0x2b374a=(_0x3c3f14[_0x00e5('0x13')]||0xa)*0x3e8;var _0x124d85,_0x2a7900;var _0x2e4b2d=seqqueue[_0x00e5('0x14')](_0x2b374a);_0x2e4b2d['id']=_0x541307;_0x2e4b2d[_0x00e5('0x15')]=_0x2b374a;_0x2e4b2d[_0x00e5('0x16')]=_0x15858b[_0x00e5('0x16')];writeLog(_0x541307,_0x3b74a1,util['format']('START:%s',_0x2b374a));_0x10a6fd[_0x00e5('0x17')][_0x541307]['on'](_0x00e5('0x18'),function(){logger[_0x00e5('0x19')](_0x00e5('0x1a'),_0x541307);clearTimeout(_0x2a7900);_0x2a7900=undefined;_0x2e4b2d[_0x00e5('0x1b')]();if(_0x10a6fd['rules'][_0x541307]){delete _0x10a6fd['rules'][_0x541307];}_0x2be895[_0x00e5('0x11')]();});_0x10a6fd[_0x00e5('0x17')][_0x541307]['on'](_0x00e5('0x1c'),function(){if(_0x10a6fd['rules'][_0x541307]){delete _0x10a6fd[_0x00e5('0x17')][_0x541307];}});_0x2a7900=setTimeout(function(){logger[_0x00e5('0x19')](_0x00e5('0x1d'),_0x541307);clearTimeout(_0x2a7900);_0x2e4b2d[_0x00e5('0x1b')]();_0x2be895[_0x00e5('0x1e')]();},_0x2b374a);strategy[_0x00e5('0x1f')](_0x2e4b2d,_0x3b74a1,_0x10a6fd,_0x15858b);}else{logger[_0x00e5('0x20')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x541307,_0x3c3f14[_0x00e5('0x9')]);_0x2be895['stop']();}}}catch(_0xb5ae6c){console[_0x00e5('0x21')](_0xb5ae6c);logger['error'](_0x00e5('0x22'),_0x541307,_0xb5ae6c[_0x00e5('0x23')]);_0x2be895[_0x00e5('0x11')]();}};}; \ No newline at end of file +var _0xc048=['map','message','join','stop','find','timeout','atimeout','channel','format','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','name','toLowerCase','validate','length','error','[%s][AGENT]\x20%s'];(function(_0x2959ac,_0x3b0f8a){var _0x8aecf=function(_0x2255a5){while(--_0x2255a5){_0x2959ac['push'](_0x2959ac['shift']());}};_0x8aecf(++_0x3b0f8a);}(_0xc048,0x102));var _0x8c04=function(_0x391b77,_0x26c60f){_0x391b77=_0x391b77-0x0;var _0x1accc5=_0xc048[_0x391b77];return _0x1accc5;};'use strict';var schema=require('validate');var _=require(_0x8c04('0x0'));var util=require(_0x8c04('0x1'));var seqqueue=require(_0x8c04('0x2'));var logger=require(_0x8c04('0x3'))(_0x8c04('0x4'));var strategy=require(_0x8c04('0x5'));var queue=schema({'name':{'type':_0x8c04('0x6'),'required':!![],'message':_0x8c04('0x7')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x3d60e5,_0x4e06b1,_0xca5639){return logger['info'](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x3d60e5,_0x4e06b1[_0x8c04('0x8')],_0xca5639));}function handleFindAgent(_0x7fed9d){return function(_0x2a3952){return _0x2a3952[_0x8c04('0x8')][_0x8c04('0x9')]()===_0x7fed9d[_0x8c04('0x9')]();};}exports['consequence']=function(_0xfb994d,_0x337221,_0x129d50,_0x4d22b5){return function(_0x39a1c5){try{var _0x7b1180={'name':_0x337221[0x0],'timeout':_0x337221[0x1]};var _0x2414ba=queue[_0x8c04('0xa')](_0x7b1180,{'typecast':!![]});if(_0x2414ba[_0x8c04('0xb')]){logger[_0x8c04('0xc')](_0x8c04('0xd'),_0xfb994d,_[_0x8c04('0xe')](_0x2414ba,_0x8c04('0xf'))[_0x8c04('0x10')](',\x20'));_0x39a1c5[_0x8c04('0x11')]();}else{var _0x322967=_[_0x8c04('0x12')](_0x129d50['agents'],handleFindAgent(_0x7b1180[_0x8c04('0x8')]));if(_0x322967){var _0x52aaf4=(_0x7b1180[_0x8c04('0x13')]||0xa)*0x3e8;var _0x268e36,_0x4a9357;var _0xcdb4aa=seqqueue['createQueue'](_0x52aaf4);_0xcdb4aa['id']=_0xfb994d;_0xcdb4aa[_0x8c04('0x14')]=_0x52aaf4;_0xcdb4aa[_0x8c04('0x15')]=_0x4d22b5[_0x8c04('0x15')];writeLog(_0xfb994d,_0x322967,util[_0x8c04('0x16')]('START:%s',_0x52aaf4));_0x129d50['rules'][_0xfb994d]['on'](_0x8c04('0x17'),function(){logger['info'](_0x8c04('0x18'),_0xfb994d);clearTimeout(_0x4a9357);_0x4a9357=undefined;_0xcdb4aa[_0x8c04('0x19')]();if(_0x129d50['rules'][_0xfb994d]){delete _0x129d50[_0x8c04('0x1a')][_0xfb994d];}_0x39a1c5['stop']();});_0x129d50[_0x8c04('0x1a')][_0xfb994d]['on']('complete',function(){if(_0x129d50[_0x8c04('0x1a')][_0xfb994d]){delete _0x129d50[_0x8c04('0x1a')][_0xfb994d];}});_0x4a9357=setTimeout(function(){logger[_0x8c04('0x1b')](_0x8c04('0x1c'),_0xfb994d);clearTimeout(_0x4a9357);_0xcdb4aa[_0x8c04('0x19')]();_0x39a1c5[_0x8c04('0x1d')]();},_0x52aaf4);strategy[_0x8c04('0x1e')](_0xcdb4aa,_0x322967,_0x129d50,_0x4d22b5);}else{logger[_0x8c04('0xc')](_0x8c04('0x1f'),_0xfb994d,_0x7b1180[_0x8c04('0x8')]);_0x39a1c5[_0x8c04('0x11')]();}}}catch(_0x1fa704){console[_0x8c04('0x20')](_0x1fa704);logger[_0x8c04('0xc')]('[%s][QUEUE]\x20%s',_0xfb994d,_0x1fa704[_0x8c04('0x21')]);_0x39a1c5[_0x8c04('0x11')]();}};}; \ 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 728a72b..f1b71a7 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 _0xa0d8=['ChatWebsiteId','AccountId','account','created','isEmpty','body','Message','create','[%s][AMAZONLEX]\x20%s','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','postText','amazonlex','providerName','providerResponse','stringify','then','dialogState','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone'];(function(_0x26bdb0,_0x5b6eef){var _0xe5070=function(_0xb58e02){while(--_0xb58e02){_0x26bdb0['push'](_0x26bdb0['shift']());}};_0xe5070(++_0x5b6eef);}(_0xa0d8,0x1ce));var _0x8a0d=function(_0x2db098,_0x2a5133){_0x2db098=_0x2db098-0x0;var _0x1cb4d7=_0xa0d8[_0x2db098];return _0x1cb4d7;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x8a0d('0x0'));var utils=require(_0x8a0d('0x1'));var logger=require('../../../../config/logger')(_0x8a0d('0x2'));var rpc={'chatMessage':require(_0x8a0d('0x3')),'openchannelMessage':require(_0x8a0d('0x4')),'mailMessage':require(_0x8a0d('0x5')),'smsMessage':require(_0x8a0d('0x6')),'faxMessage':require(_0x8a0d('0x7')),'whatsappMessage':require(_0x8a0d('0x8'))};exports[_0x8a0d('0x9')]=function(_0x3c2d18,_0x56c1c9){return function(_0x2f83c9){try{if(!_[_0x8a0d('0xa')](this[_0x8a0d('0xb')][_0x8a0d('0xc')])){logger[_0x8a0d('0xd')]('[%s][AMAZONLEX]\x20%s',_0x3c2d18,_0x8a0d('0xe'));return _0x2f83c9[_0x8a0d('0xf')]();}var _0x14e8f6={'ContactId':this['contact']['id'],'sentAt':moment()[_0x8a0d('0x10')](_0x8a0d('0x11')),'direction':_0x8a0d('0x12')};if(this[_0x8a0d('0x13')]==='sms'||this[_0x8a0d('0x13')]===_0x8a0d('0x14')){_0x14e8f6[_0x8a0d('0x15')]=this[_0x8a0d('0xb')][_0x8a0d('0x15')];}var _0x2ce029=this[_0x8a0d('0x13')];if(_0x2ce029==='chat'){_0x14e8f6[_0x8a0d('0x16')]=this['account']['id'];}else{_0x14e8f6[_['upperFirst'](_0x2ce029)+_0x8a0d('0x17')]=this[_0x8a0d('0x18')]['id'];}_0x14e8f6[_['upperFirst'](_0x2ce029)+'InteractionId']=this[_0x8a0d('0xb')]['id'];if(this[_0x8a0d('0xb')][_0x8a0d('0x19')]){var _0x3c13c8=_0x56c1c9[0x4];if(!_[_0x8a0d('0x1a')](_0x3c13c8)){_0x14e8f6[_0x8a0d('0x1b')]=utils['getMustacheRender'](_0x3c13c8,this);return rpc[_0x2ce029+_0x8a0d('0x1c')][_0x8a0d('0x1d')](_0x14e8f6)['then'](function(_0x543430){logger['info'](_0x8a0d('0x1e'),_0x3c2d18,_0x14e8f6[_0x8a0d('0x1b')]);})[_0x8a0d('0x1f')](function(_0x42707){logger[_0x8a0d('0x20')]('[%s][AMAZONLEX]\x20%s',_0x3c2d18,JSON['stringify'](_0x42707));})[_0x8a0d('0x21')](function(){logger[_0x8a0d('0xd')](_0x8a0d('0x22'),_0x3c2d18);_0x2f83c9[_0x8a0d('0x23')]();});}else{logger[_0x8a0d('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3c2d18);_0x2f83c9['stop']();}}else{var _0x4c98fa=this;var _0x38fe70=new AWS['LexRuntime']({'accessKeyId':_0x56c1c9[0x0],'secretAccessKey':_0x56c1c9[0x1],'region':_0x56c1c9[0x2]});var _0x2fffe9={'botAlias':'$LATEST','botName':_0x56c1c9[0x3],'inputText':this[_0x8a0d('0x24')][_0x8a0d('0x1b')],'userId':this[_0x8a0d('0x13')]+':'+this[_0x8a0d('0xb')]['id']['toString']()};_0x38fe70[_0x8a0d('0x25')](_0x2fffe9,function(_0x21713c,_0x4c1df6){if(_0x21713c){logger[_0x8a0d('0x20')](_0x8a0d('0x1e'),_0x3c2d18,_0x21713c[_0x8a0d('0x24')]);_0x2f83c9[_0x8a0d('0xf')]();}else if(_0x4c1df6&&_0x4c1df6['message']){_0x4c98fa[_0x8a0d('0x1b')][_0x8a0d('0x26')]=_0x4c1df6;_0x14e8f6[_0x8a0d('0x1b')]=_0x4c1df6['message'];_0x14e8f6[_0x8a0d('0x27')]=_0x8a0d('0x26');_0x14e8f6[_0x8a0d('0x28')]=JSON[_0x8a0d('0x29')](_0x4c1df6);return rpc[_0x2ce029+_0x8a0d('0x1c')][_0x8a0d('0x1d')](_0x14e8f6)[_0x8a0d('0x2a')](function(_0x1c5efe){logger[_0x8a0d('0xd')](_0x8a0d('0x1e'),_0x3c2d18,_0x14e8f6[_0x8a0d('0x1b')]);if(_0x4c1df6[_0x8a0d('0x2b')]=='Failed'){_0x2f83c9[_0x8a0d('0xf')]();}else{_0x2f83c9['stop']();}})[_0x8a0d('0x1f')](function(_0x4bfb82){logger['error'](_0x8a0d('0x1e'),_0x3c2d18,JSON[_0x8a0d('0x29')](_0x4bfb82));_0x2f83c9[_0x8a0d('0xf')]();});}else{_0x2f83c9[_0x8a0d('0xf')]();}});}}catch(_0x396791){logger[_0x8a0d('0x20')]('[%s][AMAZONLEX]\x20%s',_0x3c2d18,JSON[_0x8a0d('0x29')](_0x396791));_0x2f83c9[_0x8a0d('0x23')]();}};}; \ No newline at end of file +var _0xe896=['getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','postText','error','providerResponse','dialogState','Failed','catch','stringify','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','created','isEmpty','body'];(function(_0x209ef5,_0x564d45){var _0x123dde=function(_0x3f4422){while(--_0x3f4422){_0x209ef5['push'](_0x209ef5['shift']());}};_0x123dde(++_0x564d45);}(_0xe896,0x15c));var _0x6e89=function(_0x591f98,_0xb77375){_0x591f98=_0x591f98-0x0;var _0x3d0e97=_0xe896[_0x591f98];return _0x3d0e97;};'use strict';var _=require(_0x6e89('0x0'));var moment=require(_0x6e89('0x1'));var AWS=require(_0x6e89('0x2'));var utils=require(_0x6e89('0x3'));var logger=require('../../../../config/logger')(_0x6e89('0x4'));var rpc={'chatMessage':require(_0x6e89('0x5')),'openchannelMessage':require(_0x6e89('0x6')),'mailMessage':require(_0x6e89('0x7')),'smsMessage':require(_0x6e89('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x6e89('0x9'))};exports[_0x6e89('0xa')]=function(_0x23dd2b,_0x2270b1){return function(_0x32f78c){try{if(!_[_0x6e89('0xb')](this[_0x6e89('0xc')]['UserId'])){logger[_0x6e89('0xd')]('[%s][AMAZONLEX]\x20%s',_0x23dd2b,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x32f78c[_0x6e89('0xe')]();}var _0x3be664={'ContactId':this[_0x6e89('0xf')]['id'],'sentAt':moment()['format'](_0x6e89('0x10')),'direction':_0x6e89('0x11')};if(this['channel']===_0x6e89('0x12')||this[_0x6e89('0x13')]===_0x6e89('0x14')){_0x3be664[_0x6e89('0x15')]=this['interaction'][_0x6e89('0x15')];}var _0x613bbb=this[_0x6e89('0x13')];if(_0x613bbb==='chat'){_0x3be664[_0x6e89('0x16')]=this[_0x6e89('0x17')]['id'];}else{_0x3be664[_[_0x6e89('0x18')](_0x613bbb)+'AccountId']=this['account']['id'];}_0x3be664[_[_0x6e89('0x18')](_0x613bbb)+'InteractionId']=this[_0x6e89('0xc')]['id'];if(this[_0x6e89('0xc')][_0x6e89('0x19')]){var _0x11a69b=_0x2270b1[0x4];if(!_[_0x6e89('0x1a')](_0x11a69b)){_0x3be664[_0x6e89('0x1b')]=utils[_0x6e89('0x1c')](_0x11a69b,this);return rpc[_0x613bbb+_0x6e89('0x1d')][_0x6e89('0x1e')](_0x3be664)[_0x6e89('0x1f')](function(_0x25d0bb){logger[_0x6e89('0xd')]('[%s][AMAZONLEX]\x20%s',_0x23dd2b,_0x3be664[_0x6e89('0x1b')]);})['catch'](function(_0x2c610a){logger['error'](_0x6e89('0x20'),_0x23dd2b,JSON['stringify'](_0x2c610a));})[_0x6e89('0x21')](function(){logger[_0x6e89('0xd')](_0x6e89('0x22'),_0x23dd2b);_0x32f78c['stop']();});}else{logger[_0x6e89('0xd')](_0x6e89('0x23'),_0x23dd2b);_0x32f78c[_0x6e89('0x24')]();}}else{var _0x560ed0=this;var _0x41bf25=new AWS[(_0x6e89('0x25'))]({'accessKeyId':_0x2270b1[0x0],'secretAccessKey':_0x2270b1[0x1],'region':_0x2270b1[0x2]});var _0x4fc982={'botAlias':_0x6e89('0x26'),'botName':_0x2270b1[0x3],'inputText':this[_0x6e89('0x27')][_0x6e89('0x1b')],'userId':this[_0x6e89('0x13')]+':'+this[_0x6e89('0xc')]['id']['toString']()};_0x41bf25[_0x6e89('0x28')](_0x4fc982,function(_0x526555,_0x22af30){if(_0x526555){logger[_0x6e89('0x29')](_0x6e89('0x20'),_0x23dd2b,_0x526555['message']);_0x32f78c[_0x6e89('0xe')]();}else if(_0x22af30&&_0x22af30[_0x6e89('0x27')]){_0x560ed0[_0x6e89('0x1b')]['amazonlex']=_0x22af30;_0x3be664['body']=_0x22af30[_0x6e89('0x27')];_0x3be664['providerName']='amazonlex';_0x3be664[_0x6e89('0x2a')]=JSON['stringify'](_0x22af30);return rpc[_0x613bbb+_0x6e89('0x1d')][_0x6e89('0x1e')](_0x3be664)[_0x6e89('0x1f')](function(_0x353629){logger[_0x6e89('0xd')](_0x6e89('0x20'),_0x23dd2b,_0x3be664[_0x6e89('0x1b')]);if(_0x22af30[_0x6e89('0x2b')]==_0x6e89('0x2c')){_0x32f78c[_0x6e89('0xe')]();}else{_0x32f78c[_0x6e89('0x24')]();}})[_0x6e89('0x2d')](function(_0x2972ad){logger[_0x6e89('0x29')](_0x6e89('0x20'),_0x23dd2b,JSON[_0x6e89('0x2e')](_0x2972ad));_0x32f78c[_0x6e89('0xe')]();});}else{_0x32f78c[_0x6e89('0xe')]();}});}}catch(_0x1a9dc2){logger['error']('[%s][AMAZONLEX]\x20%s',_0x23dd2b,JSON[_0x6e89('0x2e')](_0x1a9dc2));_0x32f78c['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 57d4787..e0c25c0 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 _0xed0b=['autoreplyExecuted','One\x20Time\x20already\x20sent','next','format','out','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','account','AccountId','upperFirst','InteractionId','Message','messageId','','replace','','headers','auto-replied','All','sendMailMessage','smtpOptions','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','resolve','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','interaction','created','Autoreply\x20already\x20sent'];(function(_0x1a6a0a,_0x40aa84){var _0x3295e4=function(_0x50b37f){while(--_0x50b37f){_0x1a6a0a['push'](_0x1a6a0a['shift']());}};_0x3295e4(++_0x40aa84);}(_0xed0b,0x16f));var _0xbed0=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xed0b[_0x243217];return _0x478029;};'use strict';var _=require(_0xbed0('0x0'));var moment=require('moment');var utils=require(_0xbed0('0x1'));var logger=require(_0xbed0('0x2'))(_0xbed0('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xbed0('0x4')),'smsMessage':require(_0xbed0('0x5')),'faxMessage':require(_0xbed0('0x6')),'whatsappMessage':require(_0xbed0('0x7')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xbed0('0x8')),'mailInteraction':require(_0xbed0('0x9')),'smsInteraction':require(_0xbed0('0xa')),'faxInteraction':require(_0xbed0('0xb')),'whatsappInteraction':require(_0xbed0('0xc'))};var mailRpc=require(_0xbed0('0xd'));exports['consequence']=function(_0x4d331c,_0x53626b,_0x300ccb,_0x227af1){return function(_0x210331){try{var _0x107727=this[_0xbed0('0xe')];if(_0x107727==='mail'&&_0x227af1[_0xbed0('0xf')][_0xbed0('0x10')]){logger[_0xbed0('0x11')](_0xbed0('0x12'),_0x4d331c,_0xbed0('0x13'));return _0x210331['next']();}if(_0x53626b[0x0]==='1'&&(_['isNil'](this[_0xbed0('0x14')][_0xbed0('0x15')])||!this[_0xbed0('0x14')][_0xbed0('0x15')])){logger[_0xbed0('0x11')]('[%s][AUTOREPLY]\x20%s',_0x4d331c,_0xbed0('0x16'));return _0x210331['next']();}if(_0x53626b[0x0]==='2'&&this[_0xbed0('0x14')][_0xbed0('0x17')]){logger[_0xbed0('0x11')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4d331c,_0xbed0('0x18'));return _0x210331[_0xbed0('0x19')]();}var _0x39561b={'ContactId':this['contact']['id'],'sentAt':moment()[_0xbed0('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xbed0('0x1b')};if(this[_0xbed0('0xe')]===_0xbed0('0x1c')){_0x39561b[_0xbed0('0xf')]=utils[_0xbed0('0x1d')](_0x53626b[0x2],this);}else{_0x39561b[_0xbed0('0xf')]=utils['getMustacheRender'](_0x53626b[0x1],this);}if(this['message']){_0x39561b['to']=this[_0xbed0('0x1e')][_0xbed0('0x1f')]||'';if(this[_0xbed0('0xe')]===_0xbed0('0x1c')&&_0x53626b[0x1]==='1'){_0x39561b['cc']=this[_0xbed0('0x1e')]['cc']||'';}_0x39561b[_0xbed0('0x1f')]=this[_0xbed0('0x1e')]['to']||'';_0x39561b[_0xbed0('0x20')]=this[_0xbed0('0x1e')]['phone']||'';_0x39561b[_0xbed0('0x21')]=!![];if(this[_0xbed0('0x1e')][_0xbed0('0x22')]){_0x39561b['subject']='';_0x39561b['subject']+=_[_0xbed0('0x23')](this[_0xbed0('0x1e')][_0xbed0('0x22')],_0xbed0('0x24'))?'':'Re:\x20';_0x39561b['subject']+=this['message']['subject'];}}if(this['channel']===_0xbed0('0x25')){_0x39561b['ChatWebsiteId']=this[_0xbed0('0x26')]['id'];}else{_0x39561b[_['upperFirst'](this[_0xbed0('0xe')])+_0xbed0('0x27')]=this[_0xbed0('0x26')]['id'];}_0x39561b[_[_0xbed0('0x28')](this[_0xbed0('0xe')])+_0xbed0('0x29')]=this[_0xbed0('0x14')]['id'];var _0x310157=this[_0xbed0('0x14')];if(rpc[this[_0xbed0('0xe')]+_0xbed0('0x2a')]){if(this[_0xbed0('0xe')]===_0xbed0('0x1c')){_0x39561b['inReplyTo']=this['message'][_0xbed0('0x2b')];_0x39561b['html']=_0xbed0('0x2c')+_[_0xbed0('0x2d')](_0x39561b[_0xbed0('0xf')],_0xbed0('0x2e'),_0xbed0('0x2f'))+_0xbed0('0x30');_0x39561b[_0xbed0('0x31')]={'Auto-Submitted':_0xbed0('0x32'),'X-Auto-Response-Suppress':_0xbed0('0x33'),'Precedence':'auto_reply'};return mailRpc[_0xbed0('0x34')](this['account'][_0xbed0('0x35')],_0x39561b)['then'](function(_0x202e74){logger[_0xbed0('0x11')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x4d331c);_0x39561b[_0xbed0('0x2b')]=_0x202e74['message'][_0xbed0('0x2b')];return rpc[_0x107727+_0xbed0('0x2a')][_0xbed0('0x36')](_0x39561b);})[_0xbed0('0x37')](function(_0x4fe4fd){logger[_0xbed0('0x11')](_0xbed0('0x12'),_0x4d331c,JSON[_0xbed0('0x38')](_0x4fe4fd));})[_0xbed0('0x39')](function(_0x4e3b5d){logger[_0xbed0('0x3a')](_0xbed0('0x3b'),_0x4d331c,JSON['stringify'](_0x4e3b5d));})[_0xbed0('0x3c')](function(){Promise['resolve']()[_0xbed0('0x37')](function(){if(_0x53626b[0x0]!=='2'||_0x310157[_0xbed0('0x17')])return;return rpc[_0x107727+_0xbed0('0x3d')][_0xbed0('0x3e')](_0x310157['id'],{'autoreplyExecuted':!![]})['then'](function(_0x14050a){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4d331c,JSON[_0xbed0('0x38')](_0x14050a));})[_0xbed0('0x39')](function(_0x2e5ac4){logger[_0xbed0('0x3a')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4d331c,JSON[_0xbed0('0x38')](_0x2e5ac4));});})[_0xbed0('0x37')](function(){_0x210331[_0xbed0('0x19')]();});});}else{return rpc[this[_0xbed0('0xe')]+_0xbed0('0x2a')][_0xbed0('0x36')](_0x39561b)['then'](function(){logger[_0xbed0('0x11')](_0xbed0('0x12'),_0x4d331c,_0x39561b[_0xbed0('0xf')]);})['catch'](function(_0x376849){logger[_0xbed0('0x3a')](_0xbed0('0x12'),_0x4d331c,JSON[_0xbed0('0x38')](_0x376849));})[_0xbed0('0x3c')](function(){Promise[_0xbed0('0x3f')]()[_0xbed0('0x37')](function(){if(_0x53626b[0x0]!=='2'||_0x310157['autoreplyExecuted'])return;return rpc[_0x107727+_0xbed0('0x3d')][_0xbed0('0x3e')](_0x310157['id'],{'autoreplyExecuted':!![]})[_0xbed0('0x37')](function(_0x5a8253){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x4d331c,JSON[_0xbed0('0x38')](_0x5a8253));})['catch'](function(_0x5c88a5){logger[_0xbed0('0x3a')](_0xbed0('0x40'),_0x4d331c,JSON[_0xbed0('0x38')](_0x5c88a5));});})[_0xbed0('0x37')](function(){_0x210331[_0xbed0('0x19')]();});});}}}catch(_0x3466de){logger['error'](_0xbed0('0x12'),_0x4d331c,JSON[_0xbed0('0x38')](_0x3466de));_0x210331['stop']();}};}; \ No newline at end of file +var _0x1bea=['finally','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','Interaction','stop','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','out','getMustacheRender','from','message','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','messageId','html','','replace','';_0x1ac782[_0xa1be('0x31')]={'Auto-Submitted':_0xa1be('0x32'),'X-Auto-Response-Suppress':_0xa1be('0x33'),'Precedence':_0xa1be('0x34')};return mailRpc[_0xa1be('0x35')](this[_0xa1be('0x26')][_0xa1be('0x36')],_0x1ac782)[_0xa1be('0x37')](function(_0x5cbd7e){logger[_0xa1be('0x11')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x16dbb2);_0x1ac782[_0xa1be('0x2b')]=_0x5cbd7e[_0xa1be('0x1f')]['messageId'];return rpc[_0x288747+_0xa1be('0x2a')][_0xa1be('0x38')](_0x1ac782);})[_0xa1be('0x37')](function(_0x266873){logger[_0xa1be('0x11')](_0xa1be('0x12'),_0x16dbb2,JSON['stringify'](_0x266873));})[_0xa1be('0x39')](function(_0xe82fe7){logger[_0xa1be('0x3a')]('[RPC][%s][AUTOREPLY]\x20%s',_0x16dbb2,JSON[_0xa1be('0x3b')](_0xe82fe7));})[_0xa1be('0x3c')](function(){Promise['resolve']()[_0xa1be('0x37')](function(){if(_0x411d1c[0x0]!=='2'||_0x31513d[_0xa1be('0x18')])return;return rpc[_0x288747+'Interaction'][_0xa1be('0x3d')](_0x31513d['id'],{'autoreplyExecuted':!![]})[_0xa1be('0x37')](function(_0x2db73b){logger[_0xa1be('0x11')](_0xa1be('0x19'),_0x16dbb2,JSON['stringify'](_0x2db73b));})[_0xa1be('0x39')](function(_0x53d99d){logger['error'](_0xa1be('0x3e'),_0x16dbb2,JSON[_0xa1be('0x3b')](_0x53d99d));});})[_0xa1be('0x37')](function(){_0x26c18b[_0xa1be('0x14')]();});});}else{return rpc[this[_0xa1be('0xe')]+'Message'][_0xa1be('0x38')](_0x1ac782)[_0xa1be('0x37')](function(){logger[_0xa1be('0x11')](_0xa1be('0x12'),_0x16dbb2,_0x1ac782[_0xa1be('0x10')]);})[_0xa1be('0x39')](function(_0x1900d3){logger[_0xa1be('0x3a')](_0xa1be('0x12'),_0x16dbb2,JSON['stringify'](_0x1900d3));})[_0xa1be('0x3c')](function(){Promise[_0xa1be('0x3f')]()['then'](function(){if(_0x411d1c[0x0]!=='2'||_0x31513d['autoreplyExecuted'])return;return rpc[_0x288747+_0xa1be('0x40')]['update'](_0x31513d['id'],{'autoreplyExecuted':!![]})[_0xa1be('0x37')](function(_0x522f5f){logger[_0xa1be('0x11')](_0xa1be('0x19'),_0x16dbb2,JSON[_0xa1be('0x3b')](_0x522f5f));})[_0xa1be('0x39')](function(_0x897964){logger[_0xa1be('0x3a')](_0xa1be('0x3e'),_0x16dbb2,JSON[_0xa1be('0x3b')](_0x897964));});})['then'](function(){_0x26c18b['next']();});});}}}catch(_0x3266ec){logger[_0xa1be('0x3a')](_0xa1be('0x12'),_0x16dbb2,JSON[_0xa1be('0x3b')](_0x3266ec));_0x26c18b[_0xa1be('0x41')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 020321b..d84847a 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6895=['../../rpc/whatsappInteraction','consequence','info','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction'];(function(_0x119ef1,_0x14d235){var _0x1e60bb=function(_0x28d0e1){while(--_0x28d0e1){_0x119ef1['push'](_0x119ef1['shift']());}};_0x1e60bb(++_0x14d235);}(_0x6895,0x175));var _0x5689=function(_0x43e61d,_0x27d424){_0x43e61d=_0x43e61d-0x0;var _0x3a9d5b=_0x6895[_0x43e61d];return _0x3a9d5b;};'use strict';var moment=require(_0x5689('0x0'));var logger=require('../../../../config/logger')(_0x5689('0x1'));var rpc={'chatInteraction':require(_0x5689('0x2')),'openchannelInteraction':require(_0x5689('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x5689('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x5689('0x5'))};exports[_0x5689('0x6')]=function(_0xb8ddb5,_0x1907dc,_0x1c99fa,_0x4e3997){return function(_0x109a2a){try{logger[_0x5689('0x7')]('[%s][CLOSE]\x20reason\x20%s',_0xb8ddb5,_0x1907dc[0x0]);var _0x557628={'closed':0x1,'closedAt':moment()['format'](_0x5689('0x8')),'closeReason':'system','disposition':_0x1907dc[0x0]};if(rpc[_0x4e3997[_0x5689('0x9')]+_0x5689('0xa')]){rpc[_0x4e3997['channel']+_0x5689('0xa')][_0x5689('0xb')](_0x4e3997[_0x5689('0xc')]['id'],_0x557628)['then'](function(_0x43bd12){logger[_0x5689('0x7')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0xb8ddb5,_0x4e3997[_0x5689('0xc')]['id']);})[_0x5689('0xd')](function(_0x478d49){logger['error'](_0x5689('0xe'),_0xb8ddb5,JSON[_0x5689('0xf')](_0x478d49));})[_0x5689('0x10')](function(){_0x109a2a[_0x5689('0x11')]();});}}catch(_0x32be0f){logger['error'](_0x5689('0xe'),_0xb8ddb5,JSON[_0x5689('0xf')](_0x32be0f));_0x109a2a[_0x5689('0x11')]();}};}; \ No newline at end of file +var _0xa984=['[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error'];(function(_0x505d51,_0x21b91a){var _0xbe3a2e=function(_0x50affa){while(--_0x50affa){_0x505d51['push'](_0x505d51['shift']());}};_0xbe3a2e(++_0x21b91a);}(_0xa984,0x64));var _0x4a98=function(_0x4f12b1,_0x3ed71d){_0x4f12b1=_0x4f12b1-0x0;var _0x54d002=_0xa984[_0x4f12b1];return _0x54d002;};'use strict';var moment=require('moment');var logger=require(_0x4a98('0x0'))(_0x4a98('0x1'));var rpc={'chatInteraction':require(_0x4a98('0x2')),'openchannelInteraction':require(_0x4a98('0x3')),'smsInteraction':require(_0x4a98('0x4')),'mailInteraction':require(_0x4a98('0x5')),'faxInteraction':require(_0x4a98('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x4a98('0x7')]=function(_0x57f727,_0x4146c7,_0x103215,_0x17c5e3){return function(_0x1ecf0a){try{logger[_0x4a98('0x8')](_0x4a98('0x9'),_0x57f727,_0x4146c7[0x0]);var _0x5ca562={'closed':0x1,'closedAt':moment()[_0x4a98('0xa')](_0x4a98('0xb')),'closeReason':_0x4a98('0xc'),'disposition':_0x4146c7[0x0]};if(rpc[_0x17c5e3[_0x4a98('0xd')]+'Interaction']){rpc[_0x17c5e3[_0x4a98('0xd')]+_0x4a98('0xe')][_0x4a98('0xf')](_0x17c5e3[_0x4a98('0x10')]['id'],_0x5ca562)[_0x4a98('0x11')](function(_0x4fbcf2){logger[_0x4a98('0x8')](_0x4a98('0x12'),_0x57f727,_0x17c5e3[_0x4a98('0x10')]['id']);})['catch'](function(_0x4d037f){logger[_0x4a98('0x13')](_0x4a98('0x14'),_0x57f727,JSON[_0x4a98('0x15')](_0x4d037f));})[_0x4a98('0x16')](function(){_0x1ecf0a[_0x4a98('0x17')]();});}}catch(_0x1e33d8){logger[_0x4a98('0x13')]('[%s][CLOSE]\x20%s',_0x57f727,JSON[_0x4a98('0x15')](_0x1e33d8));_0x1ecf0a[_0x4a98('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index e59aed8..f98f5b5 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa423=['result','fulfillment','speech','providerName','stringify','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','created','getMustacheRender','Message','create','then','body','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa423,0x16c));var _0x3a42=function(_0x21ce77,_0x41ed85){_0x21ce77=_0x21ce77-0x0;var _0x21aa27=_0xa423[_0x21ce77];return _0x21aa27;};'use strict';var _=require(_0x3a42('0x0'));var moment=require(_0x3a42('0x1'));var apiai=require(_0x3a42('0x2'));var md5=require(_0x3a42('0x3'));var utils=require(_0x3a42('0x4'));var logger=require('../../../../config/logger')(_0x3a42('0x5'));var rpc={'chatMessage':require(_0x3a42('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3a42('0x7')),'smsMessage':require(_0x3a42('0x8')),'faxMessage':require(_0x3a42('0x9')),'whatsappMessage':require(_0x3a42('0xa'))};exports[_0x3a42('0xb')]=function(_0x563134,_0x65e0ba){return function(_0x439418){try{if(!_[_0x3a42('0xc')](this[_0x3a42('0xd')][_0x3a42('0xe')])){logger[_0x3a42('0xf')](_0x3a42('0x10'),_0x563134,_0x3a42('0x11'));return _0x439418[_0x3a42('0x12')]();}var _0x2a25c0={'ContactId':this[_0x3a42('0x13')]['id'],'sentAt':moment()['format'](_0x3a42('0x14')),'direction':_0x3a42('0x15')};if(this[_0x3a42('0x16')]===_0x3a42('0x17')||this['channel']==='whatsapp'){_0x2a25c0[_0x3a42('0x18')]=this['interaction'][_0x3a42('0x18')];}var _0x2f210f=this[_0x3a42('0x16')];if(_0x2f210f===_0x3a42('0x19')){_0x2a25c0[_0x3a42('0x1a')]=this[_0x3a42('0x1b')]['id'];}else{_0x2a25c0[_['upperFirst'](_0x2f210f)+_0x3a42('0x1c')]=this['account']['id'];}_0x2a25c0[_[_0x3a42('0x1d')](_0x2f210f)+'InteractionId']=this[_0x3a42('0xd')]['id'];if(this[_0x3a42('0xd')][_0x3a42('0x1e')]){var _0x4edcf5=_0x65e0ba[0x2];if(!_['isEmpty'](_0x4edcf5)){_0x2a25c0['body']=utils[_0x3a42('0x1f')](_0x4edcf5,this);return rpc[_0x2f210f+_0x3a42('0x20')][_0x3a42('0x21')](_0x2a25c0)[_0x3a42('0x22')](function(_0x318526){logger['info'](_0x3a42('0x10'),_0x563134,_0x2a25c0[_0x3a42('0x23')]);})[_0x3a42('0x24')](function(_0x151835){logger[_0x3a42('0x25')](_0x3a42('0x10'),_0x563134,JSON['stringify'](_0x151835));})[_0x3a42('0x26')](function(){logger[_0x3a42('0xf')](_0x3a42('0x27'),_0x563134);_0x439418[_0x3a42('0x28')]();});}else{logger[_0x3a42('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x563134);_0x439418[_0x3a42('0x28')]();}}else{var _0x42b40f=this;var _0x379fe6=apiai(_0x65e0ba[0x0],{'language':_0x65e0ba[0x1]||'en'});return _0x379fe6[_0x3a42('0x29')](this[_0x3a42('0x2a')]['body'],{'sessionId':md5(this[_0x3a42('0xd')]['id'])})[_0x3a42('0x22')](function(_0x477cb9){_0x42b40f[_0x3a42('0x23')][_0x3a42('0x2b')]=_0x477cb9;_0x2a25c0[_0x3a42('0x23')]=_0x477cb9[_0x3a42('0x2c')][_0x3a42('0x2d')][_0x3a42('0x2e')];_0x2a25c0[_0x3a42('0x2f')]=_0x3a42('0x2b');_0x2a25c0['providerResponse']=JSON[_0x3a42('0x30')](_0x477cb9);return rpc[_0x2f210f+_0x3a42('0x20')]['create'](_0x2a25c0)[_0x3a42('0x22')](function(_0x5b5897){logger[_0x3a42('0xf')](_0x3a42('0x10'),_0x563134,_0x2a25c0[_0x3a42('0x23')]);if(_0x477cb9[_0x3a42('0x2c')][_0x3a42('0x31')][_0x3a42('0x32')]){_0x439418['next']();}else{_0x439418[_0x3a42('0x28')]();}})[_0x3a42('0x24')](function(_0x1dc0c0){logger[_0x3a42('0x25')](_0x3a42('0x10'),_0x563134,JSON[_0x3a42('0x30')](_0x1dc0c0));_0x439418[_0x3a42('0x12')]();});})['catch'](function(_0x2d6192){logger[_0x3a42('0x25')](_0x3a42('0x10'),_0x563134,_0x2d6192[_0x3a42('0x2a')]);_0x439418[_0x3a42('0x12')]();});}}catch(_0x50ece0){logger['error'](_0x3a42('0x10'),_0x563134,JSON['stringify'](_0x50ece0));_0x439418[_0x3a42('0x28')]();}};}; \ No newline at end of file +var _0x53ec=['[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','fulfillment','speech','providerName','dialogflow','providerResponse','metadata','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally'];(function(_0x3146ce,_0x375b66){var _0x2afd56=function(_0x1d19a2){while(--_0x1d19a2){_0x3146ce['push'](_0x3146ce['shift']());}};_0x2afd56(++_0x375b66);}(_0x53ec,0x192));var _0xc53e=function(_0x559499,_0x2ecc11){_0x559499=_0x559499-0x0;var _0x476cb7=_0x53ec[_0x559499];return _0x476cb7;};'use strict';var _=require(_0xc53e('0x0'));var moment=require(_0xc53e('0x1'));var apiai=require(_0xc53e('0x2'));var md5=require(_0xc53e('0x3'));var utils=require(_0xc53e('0x4'));var logger=require(_0xc53e('0x5'))('routing');var rpc={'chatMessage':require(_0xc53e('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc53e('0x7')),'smsMessage':require(_0xc53e('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc53e('0x9'))};exports['consequence']=function(_0x41a9e8,_0x2de88b){return function(_0x5d3b28){try{if(!_[_0xc53e('0xa')](this[_0xc53e('0xb')][_0xc53e('0xc')])){logger[_0xc53e('0xd')](_0xc53e('0xe'),_0x41a9e8,_0xc53e('0xf'));return _0x5d3b28[_0xc53e('0x10')]();}var _0x361e9d={'ContactId':this[_0xc53e('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xc53e('0x12')};if(this['channel']==='sms'||this[_0xc53e('0x13')]===_0xc53e('0x14')){_0x361e9d[_0xc53e('0x15')]=this[_0xc53e('0xb')]['phone'];}var _0x4e74c9=this[_0xc53e('0x13')];if(_0x4e74c9===_0xc53e('0x16')){_0x361e9d[_0xc53e('0x17')]=this[_0xc53e('0x18')]['id'];}else{_0x361e9d[_[_0xc53e('0x19')](_0x4e74c9)+_0xc53e('0x1a')]=this[_0xc53e('0x18')]['id'];}_0x361e9d[_[_0xc53e('0x19')](_0x4e74c9)+_0xc53e('0x1b')]=this[_0xc53e('0xb')]['id'];if(this['interaction'][_0xc53e('0x1c')]){var _0x191567=_0x2de88b[0x2];if(!_[_0xc53e('0x1d')](_0x191567)){_0x361e9d[_0xc53e('0x1e')]=utils[_0xc53e('0x1f')](_0x191567,this);return rpc[_0x4e74c9+_0xc53e('0x20')][_0xc53e('0x21')](_0x361e9d)[_0xc53e('0x22')](function(_0x3b550e){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x41a9e8,_0x361e9d[_0xc53e('0x1e')]);})[_0xc53e('0x23')](function(_0x421641){logger[_0xc53e('0x24')](_0xc53e('0xe'),_0x41a9e8,JSON[_0xc53e('0x25')](_0x421641));})[_0xc53e('0x26')](function(){logger[_0xc53e('0xd')](_0xc53e('0x27'),_0x41a9e8);_0x5d3b28[_0xc53e('0x28')]();});}else{logger[_0xc53e('0xd')](_0xc53e('0x29'),_0x41a9e8);_0x5d3b28[_0xc53e('0x28')]();}}else{var _0x4fb695=this;var _0x47cfdd=apiai(_0x2de88b[0x0],{'language':_0x2de88b[0x1]||'en'});return _0x47cfdd['textRequest'](this[_0xc53e('0x2a')][_0xc53e('0x1e')],{'sessionId':md5(this[_0xc53e('0xb')]['id'])})[_0xc53e('0x22')](function(_0x180811){_0x4fb695['body']['dialogflow']=_0x180811;_0x361e9d[_0xc53e('0x1e')]=_0x180811['result'][_0xc53e('0x2b')][_0xc53e('0x2c')];_0x361e9d[_0xc53e('0x2d')]=_0xc53e('0x2e');_0x361e9d[_0xc53e('0x2f')]=JSON['stringify'](_0x180811);return rpc[_0x4e74c9+_0xc53e('0x20')]['create'](_0x361e9d)['then'](function(_0x5c65d3){logger[_0xc53e('0xd')]('[%s][DIALOGFLOW]\x20%s',_0x41a9e8,_0x361e9d[_0xc53e('0x1e')]);if(_0x180811['result'][_0xc53e('0x30')]['endConversation']){_0x5d3b28['next']();}else{_0x5d3b28[_0xc53e('0x28')]();}})[_0xc53e('0x23')](function(_0x42dec1){logger[_0xc53e('0x24')](_0xc53e('0xe'),_0x41a9e8,JSON[_0xc53e('0x25')](_0x42dec1));_0x5d3b28[_0xc53e('0x10')]();});})[_0xc53e('0x23')](function(_0x4ace0b){logger[_0xc53e('0x24')](_0xc53e('0xe'),_0x41a9e8,_0x4ace0b[_0xc53e('0x2a')]);_0x5d3b28['next']();});}}catch(_0x4057f9){logger['error'](_0xc53e('0xe'),_0x41a9e8,JSON[_0xc53e('0x25')](_0x4057f9));_0x5d3b28['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index ee4232f..20cb478 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d65=['../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','length','push','fulfillmentText','message','stack','next','lodash','dialogflow','md5','moment','bluebird','./utils'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0x5d65,0xcf));var _0x55d6=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x5d65[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x55d6('0x0'));var dialogflow=require(_0x55d6('0x1'));var md5=require(_0x55d6('0x2'));var moment=require(_0x55d6('0x3'));var Promise=require(_0x55d6('0x4'));var logger=require('../../../../config/logger')('routing');var utils=require(_0x55d6('0x5'));var rpc={'chatMessage':require(_0x55d6('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x55d6('0x7')),'faxMessage':require(_0x55d6('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x238049,_0x289829,_0x356888,_0x1cffc9){return new Promise(function(_0x95ea04,_0x4889fb){var _0x5b9444=_['clone'](_0x356888);_0x5b9444[_0x55d6('0x9')]=_0x1cffc9;return rpc[_0x289829+_0x55d6('0xa')][_0x55d6('0xb')](_0x5b9444)[_0x55d6('0xc')](function(){logger[_0x55d6('0xd')](_0x55d6('0xe'),_0x238049,_0x5b9444[_0x55d6('0x9')]);_0x95ea04();})[_0x55d6('0xf')](function(_0x3d3abd){logger[_0x55d6('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x238049,JSON[_0x55d6('0x11')](_0x3d3abd));_0x4889fb(_0x3d3abd);});});}exports[_0x55d6('0x12')]=function(_0x1658f2,_0x301eed){return function(_0x52766d){try{if(!_[_0x55d6('0x13')](this[_0x55d6('0x14')][_0x55d6('0x15')])){logger[_0x55d6('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x1658f2,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x52766d['next']();}var _0xc191de={'ContactId':this[_0x55d6('0x16')]['id'],'sentAt':moment()[_0x55d6('0x17')](_0x55d6('0x18')),'direction':_0x55d6('0x19')};if(this[_0x55d6('0x1a')]===_0x55d6('0x1b')||this[_0x55d6('0x1a')]===_0x55d6('0x1c')){_0xc191de[_0x55d6('0x1d')]=this[_0x55d6('0x14')][_0x55d6('0x1d')];}var _0x84000b=this['channel'];if(_0x84000b===_0x55d6('0x1e')){_0xc191de[_0x55d6('0x1f')]=this[_0x55d6('0x20')]['id'];}else{_0xc191de[_[_0x55d6('0x21')](_0x84000b)+'AccountId']=this[_0x55d6('0x20')]['id'];}_0xc191de[_[_0x55d6('0x21')](_0x84000b)+_0x55d6('0x22')]=this[_0x55d6('0x14')]['id'];if(this[_0x55d6('0x14')][_0x55d6('0x23')]){var _0x170afe=_0x301eed[0x4];if(!_[_0x55d6('0x24')](_0x170afe)){_0xc191de[_0x55d6('0x9')]=utils['getMustacheRender'](_0x170afe,this);return rpc[_0x84000b+_0x55d6('0xa')][_0x55d6('0xb')](_0xc191de)[_0x55d6('0xc')](function(_0xa1159b){logger['info'](_0x55d6('0xe'),_0x1658f2,_0xc191de[_0x55d6('0x9')]);})['catch'](function(_0x443d6c){logger[_0x55d6('0x10')](_0x55d6('0xe'),_0x1658f2,JSON[_0x55d6('0x11')](_0x443d6c));})[_0x55d6('0x25')](function(){logger[_0x55d6('0xd')](_0x55d6('0x26'),_0x1658f2);_0x52766d[_0x55d6('0x27')]();});}else{logger[_0x55d6('0xd')](_0x55d6('0x28'),_0x1658f2);_0x52766d[_0x55d6('0x27')]();}}else{var _0x537dfe=this;var _0x110ce4=_0x301eed[0x2]['replace'](/\\n/g,'\x0a');var _0x117702={'credentials':{'private_key':_0x110ce4,'client_email':_0x301eed[0x1]}};var _0x47b952=new dialogflow['SessionsClient'](_0x117702);var _0x47ead5=_0x47b952['sessionPath'](_0x301eed[0x0],md5(_0x537dfe[_0x55d6('0x14')]['id']));var _0x140e67={'session':_0x47ead5,'queryInput':{'text':{'text':_0x537dfe['message'][_0x55d6('0x9')],'languageCode':_0x301eed[0x3]||'en'}}};return _0x47b952[_0x55d6('0x29')](_0x140e67)[_0x55d6('0xc')](function(_0xf803bd){if(_0xf803bd&&_0xf803bd['length']){_0x537dfe[_0x55d6('0x9')][_0x55d6('0x2a')]=_0xf803bd;var _0x5e0243=_0xf803bd[0x0];var _0x2ca3ff=_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x2c')]&&_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x2c')][_0x55d6('0x2d')]?_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x2c')][_0x55d6('0x2d')][_0x55d6('0x2e')][_0x55d6('0x2f')]:![];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x30')]=_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x31')];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x32')]=_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x33')];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x34')]=_0x5e0243[_0x55d6('0x2b')]['diagnosticInfo']&&_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x2c')]['fields']?_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x2c')][_0x55d6('0x2d')][_0x55d6('0x2e')]['boolValue']:![];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x35')]=_0x5e0243['queryResult'][_0x55d6('0x36')][_0x55d6('0x37')];_0x537dfe['body'][_0x55d6('0x38')]=_0x5e0243['queryResult'][_0x55d6('0x36')]['displayName'];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x39')]=_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x36')][_0x55d6('0x3a')];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x3b')]=_0x5e0243[_0x55d6('0x2b')]['languageCode'];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x3c')]=_0x5e0243[_0x55d6('0x2b')][_0x55d6('0x3d')];_0x537dfe[_0x55d6('0x9')][_0x55d6('0x3e')]=_0x5e0243['queryResult'][_0x55d6('0x3f')];_0xc191de[_0x55d6('0x40')]=_0x55d6('0x2a');_0xc191de['providerResponse']=JSON['stringify'](_0xf803bd);var _0x42cbea=[];for(var _0x135456=0x0;_0x135456<_0xf803bd[_0x55d6('0x41')];_0x135456++){var _0x3a79a1=_0xf803bd[_0x135456];if(_0x3a79a1&&_0x3a79a1[_0x55d6('0x2b')]&&_0x3a79a1[_0x55d6('0x2b')]['fulfillmentText']){_0x42cbea[_0x55d6('0x42')](createMessage(_0x1658f2,_0x84000b,_0xc191de,_0x3a79a1['queryResult'][_0x55d6('0x43')]));}}return Promise['all'](_0x42cbea)[_0x55d6('0xc')](function(){if(_0x2ca3ff){_0x52766d['next']();}else{_0x52766d[_0x55d6('0x27')]();}})[_0x55d6('0xf')](function(_0x1ef823){logger[_0x55d6('0x10')](_0x55d6('0xe'),_0x1658f2,JSON['stringify'](_0x1ef823));_0x52766d['next']();});}})[_0x55d6('0xf')](function(_0x3c19fc){logger['error'](_0x55d6('0xe'),_0x1658f2,_0x3c19fc[_0x55d6('0x44')],_0x3c19fc[_0x55d6('0x45')]);_0x52766d[_0x55d6('0x46')]();});}}catch(_0x29b7bf){logger[_0x55d6('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x1658f2,JSON[_0x55d6('0x11')](_0x29b7bf));_0x52766d['stop']();}};}; \ No newline at end of file +var _0xd772=['all','stack','lodash','dialogflow','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','isNil','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','account','upperFirst','isEmpty','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','message','detectIntent','length','dialogflowV2','queryResult','fields','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','name','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText'];(function(_0x415a90,_0x17b944){var _0x2b8fe7=function(_0x4f0322){while(--_0x4f0322){_0x415a90['push'](_0x415a90['shift']());}};_0x2b8fe7(++_0x17b944);}(_0xd772,0x1a6));var _0x2d77=function(_0x275a11,_0x2bfb91){_0x275a11=_0x275a11-0x0;var _0x36c3ef=_0xd772[_0x275a11];return _0x36c3ef;};'use strict';var _=require(_0x2d77('0x0'));var dialogflow=require(_0x2d77('0x1'));var md5=require(_0x2d77('0x2'));var moment=require(_0x2d77('0x3'));var Promise=require(_0x2d77('0x4'));var logger=require('../../../../config/logger')(_0x2d77('0x5'));var utils=require(_0x2d77('0x6'));var rpc={'chatMessage':require(_0x2d77('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2d77('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2d77('0x9'))};function createMessage(_0xb41f5e,_0x5ea2ad,_0x593785,_0x23100d){return new Promise(function(_0x2e019b,_0x247873){var _0x552aae=_[_0x2d77('0xa')](_0x593785);_0x552aae[_0x2d77('0xb')]=_0x23100d;return rpc[_0x5ea2ad+_0x2d77('0xc')][_0x2d77('0xd')](_0x552aae)[_0x2d77('0xe')](function(){logger[_0x2d77('0xf')](_0x2d77('0x10'),_0xb41f5e,_0x552aae[_0x2d77('0xb')]);_0x2e019b();})[_0x2d77('0x11')](function(_0xd8e188){logger[_0x2d77('0x12')](_0x2d77('0x10'),_0xb41f5e,JSON['stringify'](_0xd8e188));_0x247873(_0xd8e188);});});}exports[_0x2d77('0x13')]=function(_0x30e7cc,_0x26b871){return function(_0x39c2a2){try{if(!_[_0x2d77('0x14')](this[_0x2d77('0x15')][_0x2d77('0x16')])){logger['info'](_0x2d77('0x10'),_0x30e7cc,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x39c2a2[_0x2d77('0x17')]();}var _0x25599e={'ContactId':this[_0x2d77('0x18')]['id'],'sentAt':moment()[_0x2d77('0x19')](_0x2d77('0x1a')),'direction':_0x2d77('0x1b')};if(this[_0x2d77('0x1c')]==='sms'||this[_0x2d77('0x1c')]===_0x2d77('0x1d')){_0x25599e[_0x2d77('0x1e')]=this[_0x2d77('0x15')][_0x2d77('0x1e')];}var _0x5a70aa=this[_0x2d77('0x1c')];if(_0x5a70aa===_0x2d77('0x1f')){_0x25599e['ChatWebsiteId']=this[_0x2d77('0x20')]['id'];}else{_0x25599e[_[_0x2d77('0x21')](_0x5a70aa)+'AccountId']=this[_0x2d77('0x20')]['id'];}_0x25599e[_['upperFirst'](_0x5a70aa)+'InteractionId']=this[_0x2d77('0x15')]['id'];if(this['interaction']['created']){var _0x3839d8=_0x26b871[0x4];if(!_[_0x2d77('0x22')](_0x3839d8)){_0x25599e[_0x2d77('0xb')]=utils['getMustacheRender'](_0x3839d8,this);return rpc[_0x5a70aa+_0x2d77('0xc')][_0x2d77('0xd')](_0x25599e)['then'](function(_0x38f69a){logger[_0x2d77('0xf')](_0x2d77('0x10'),_0x30e7cc,_0x25599e[_0x2d77('0xb')]);})[_0x2d77('0x11')](function(_0x53307f){logger['error'](_0x2d77('0x10'),_0x30e7cc,JSON[_0x2d77('0x23')](_0x53307f));})[_0x2d77('0x24')](function(){logger[_0x2d77('0xf')](_0x2d77('0x25'),_0x30e7cc);_0x39c2a2[_0x2d77('0x26')]();});}else{logger[_0x2d77('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x30e7cc);_0x39c2a2[_0x2d77('0x26')]();}}else{var _0xb3ee6f=this;var _0x5cdfcf=_0x26b871[0x2][_0x2d77('0x27')](/\\n/g,'\x0a');var _0x5d3010={'credentials':{'private_key':_0x5cdfcf,'client_email':_0x26b871[0x1]}};var _0x342475=new dialogflow['SessionsClient'](_0x5d3010);var _0x36bce9=_0x342475['sessionPath'](_0x26b871[0x0],md5(_0xb3ee6f[_0x2d77('0x15')]['id']));var _0xd6c19e={'session':_0x36bce9,'queryInput':{'text':{'text':_0xb3ee6f[_0x2d77('0x28')][_0x2d77('0xb')],'languageCode':_0x26b871[0x3]||'en'}}};return _0x342475[_0x2d77('0x29')](_0xd6c19e)[_0x2d77('0xe')](function(_0x4cec31){if(_0x4cec31&&_0x4cec31[_0x2d77('0x2a')]){_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x2b')]=_0x4cec31;var _0xab8244=_0x4cec31[0x0];var _0x34fc16=_0xab8244[_0x2d77('0x2c')]['diagnosticInfo']&&_0xab8244['queryResult']['diagnosticInfo'][_0x2d77('0x2d')]?_0xab8244[_0x2d77('0x2c')][_0x2d77('0x2e')][_0x2d77('0x2d')][_0x2d77('0x2f')][_0x2d77('0x30')]:![];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x31')]=_0xab8244[_0x2d77('0x2c')][_0x2d77('0x32')];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x33')]=_0xab8244['queryResult'][_0x2d77('0x34')];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x35')]=_0xab8244[_0x2d77('0x2c')][_0x2d77('0x2e')]&&_0xab8244[_0x2d77('0x2c')][_0x2d77('0x2e')][_0x2d77('0x2d')]?_0xab8244['queryResult']['diagnosticInfo'][_0x2d77('0x2d')][_0x2d77('0x2f')][_0x2d77('0x30')]:![];_0xb3ee6f[_0x2d77('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0xab8244[_0x2d77('0x2c')]['intent'][_0x2d77('0x36')];_0xb3ee6f[_0x2d77('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0xab8244[_0x2d77('0x2c')][_0x2d77('0x37')]['displayName'];_0xb3ee6f['body'][_0x2d77('0x38')]=_0xab8244['queryResult'][_0x2d77('0x37')][_0x2d77('0x39')];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x3a')]=_0xab8244['queryResult'][_0x2d77('0x3b')];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x3c')]=_0xab8244[_0x2d77('0x2c')][_0x2d77('0x3d')];_0xb3ee6f[_0x2d77('0xb')][_0x2d77('0x3e')]=_0xab8244[_0x2d77('0x2c')][_0x2d77('0x3f')];_0x25599e[_0x2d77('0x40')]=_0x2d77('0x2b');_0x25599e[_0x2d77('0x41')]=JSON['stringify'](_0x4cec31);var _0x293127=[];for(var _0x5c8f04=0x0;_0x5c8f04<_0x4cec31[_0x2d77('0x2a')];_0x5c8f04++){var _0x43cde9=_0x4cec31[_0x5c8f04];if(_0x43cde9&&_0x43cde9[_0x2d77('0x2c')]&&_0x43cde9[_0x2d77('0x2c')]['fulfillmentText']){_0x293127[_0x2d77('0x42')](createMessage(_0x30e7cc,_0x5a70aa,_0x25599e,_0x43cde9[_0x2d77('0x2c')][_0x2d77('0x43')]));}}return Promise[_0x2d77('0x44')](_0x293127)[_0x2d77('0xe')](function(){if(_0x34fc16){_0x39c2a2['next']();}else{_0x39c2a2[_0x2d77('0x26')]();}})[_0x2d77('0x11')](function(_0x1b356d){logger['error'](_0x2d77('0x10'),_0x30e7cc,JSON[_0x2d77('0x23')](_0x1b356d));_0x39c2a2['next']();});}})[_0x2d77('0x11')](function(_0x136ed5){logger[_0x2d77('0x12')](_0x2d77('0x10'),_0x30e7cc,_0x136ed5[_0x2d77('0x28')],_0x136ed5[_0x2d77('0x45')]);_0x39c2a2['next']();});}}catch(_0x59273d){logger[_0x2d77('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x30e7cc,JSON[_0x2d77('0x23')](_0x59273d));_0x39c2a2[_0x2d77('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 4679fba..3f467c3 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe082=['fromString','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','stop','stringify','./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0xdf79a0,_0x5ba2ed){var _0x145390=function(_0x4da834){while(--_0x4da834){_0xdf79a0['push'](_0xdf79a0['shift']());}};_0x145390(++_0x5ba2ed);}(_0xe082,0xb6));var _0x2e08=function(_0x5967c0,_0x452377){_0x5967c0=_0x5967c0-0x0;var _0x2ad249=_0xe082[_0x5967c0];return _0x2ad249;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x2e08('0x0'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0x2e08('0x1'),'required':!![],'message':_0x2e08('0x2')},'priorityTrue':{'type':_0x2e08('0x3'),'message':_0x2e08('0x4')},'priorityFalse':{'type':_0x2e08('0x3'),'message':_0x2e08('0x5')}});exports[_0x2e08('0x6')]=function(_0x405f18,_0x554b0c){return function(_0x3866ef){try{var _0x5641a5={'condition':htmlToText[_0x2e08('0x7')](utils['getMustacheRender'](_0x554b0c[0x0],this),{'wordwrap':![]})[_0x2e08('0x8')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x554b0c[0x1],'priorityFalse':_0x554b0c[0x2]};var _0x47d954=gotoif[_0x2e08('0x9')](_0x5641a5,{'typecast':!![]});if(_0x47d954[_0x2e08('0xa')]){logger[_0x2e08('0xb')](_0x2e08('0xc'),_0x405f18,_[_0x2e08('0xd')](_0x47d954,_0x2e08('0xe'))[_0x2e08('0xf')](',\x20'));_0x3866ef['stop']();}else{try{var _0x59c468=eval('('+_0x5641a5[_0x2e08('0x10')]+')');var _0x421756=_0x59c468?_0x5641a5[_0x2e08('0x11')]:_0x5641a5[_0x2e08('0x12')];logger[_0x2e08('0x13')](_0x2e08('0x14'),_0x405f18,_0x5641a5[_0x2e08('0x10')],_0x59c468,_0x421756||'next');if(_0x421756){var _0x54ce0f=_['findIndex'](_0x3866ef[_0x2e08('0x15')](),{'p':_0x421756});if(_0x54ce0f>=0x0){logger[_0x2e08('0x13')](_0x2e08('0x16'),_0x405f18,_0x421756||'next',_0x54ce0f);_0x3866ef[_0x2e08('0x17')](_0x54ce0f);}else{logger[_0x2e08('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x405f18,_0x421756||'next');_0x3866ef['stop']();}}else{_0x3866ef['next']();}}catch(_0xa8c2bd){logger['error'](_0x2e08('0x18'),_0x405f18,_0xa8c2bd[_0x2e08('0xe')]);_0x3866ef[_0x2e08('0x19')]();}}}catch(_0x29d36a){logger['error'](_0x2e08('0xc'),_0x405f18,JSON[_0x2e08('0x1a')](_0x29d36a));_0x3866ef[_0x2e08('0x19')]();}};}; \ No newline at end of file +var _0xab32=['replace','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString'];(function(_0x1635dc,_0x1ec827){var _0x412bf3=function(_0x1b2943){while(--_0x1b2943){_0x1635dc['push'](_0x1635dc['shift']());}};_0x412bf3(++_0x1ec827);}(_0xab32,0x169));var _0x2ab3=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xab32[_0x3d42d8];return _0x27fc41;};'use strict';var schema=require(_0x2ab3('0x0'));var _=require(_0x2ab3('0x1'));var htmlToText=require(_0x2ab3('0x2'));var utils=require('./utils');var logger=require(_0x2ab3('0x3'))('routing');var gotoif=schema({'condition':{'type':_0x2ab3('0x4'),'required':!![],'message':_0x2ab3('0x5')},'priorityTrue':{'type':'number','message':_0x2ab3('0x6')},'priorityFalse':{'type':_0x2ab3('0x7'),'message':_0x2ab3('0x8')}});exports[_0x2ab3('0x9')]=function(_0x3f0aea,_0x4a9383){return function(_0x4534d7){try{var _0xe6bd39={'condition':htmlToText[_0x2ab3('0xa')](utils['getMustacheRender'](_0x4a9383[0x0],this),{'wordwrap':![]})[_0x2ab3('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4a9383[0x1],'priorityFalse':_0x4a9383[0x2]};var _0x4ec43a=gotoif[_0x2ab3('0x0')](_0xe6bd39,{'typecast':!![]});if(_0x4ec43a[_0x2ab3('0xc')]){logger[_0x2ab3('0xd')](_0x2ab3('0xe'),_0x3f0aea,_[_0x2ab3('0xf')](_0x4ec43a,'message')[_0x2ab3('0x10')](',\x20'));_0x4534d7[_0x2ab3('0x11')]();}else{try{var _0x4b38d0=eval('('+_0xe6bd39[_0x2ab3('0x12')]+')');var _0x105bcc=_0x4b38d0?_0xe6bd39[_0x2ab3('0x13')]:_0xe6bd39[_0x2ab3('0x14')];logger[_0x2ab3('0x15')](_0x2ab3('0x16'),_0x3f0aea,_0xe6bd39[_0x2ab3('0x12')],_0x4b38d0,_0x105bcc||_0x2ab3('0x17'));if(_0x105bcc){var _0x5ad50e=_[_0x2ab3('0x18')](_0x4534d7[_0x2ab3('0x19')](),{'p':_0x105bcc});if(_0x5ad50e>=0x0){logger[_0x2ab3('0x15')](_0x2ab3('0x1a'),_0x3f0aea,_0x105bcc||'next',_0x5ad50e);_0x4534d7[_0x2ab3('0x17')](_0x5ad50e);}else{logger[_0x2ab3('0x15')](_0x2ab3('0x1b'),_0x3f0aea,_0x105bcc||_0x2ab3('0x17'));_0x4534d7[_0x2ab3('0x11')]();}}else{_0x4534d7['next']();}}catch(_0x1d0b5b){logger[_0x2ab3('0xd')](_0x2ab3('0x1c'),_0x3f0aea,_0x1d0b5b[_0x2ab3('0x1d')]);_0x4534d7['stop']();}}}catch(_0xd02d17){logger[_0x2ab3('0xd')](_0x2ab3('0xe'),_0x3f0aea,JSON[_0x2ab3('0x1e')](_0xd02d17));_0x4534d7[_0x2ab3('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 4cf4ee8..9c940ef 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 _0xd6d0=['message','join','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map'];(function(_0x552e24,_0x312fcc){var _0x500753=function(_0x30cfad){while(--_0x30cfad){_0x552e24['push'](_0x552e24['shift']());}};_0x500753(++_0x312fcc);}(_0xd6d0,0xb4));var _0x0d6d=function(_0x102f07,_0x4ddd65){_0x102f07=_0x102f07-0x0;var _0x4e7ff5=_0xd6d0[_0x102f07];return _0x4e7ff5;};'use strict';var schema=require('validate');var _=require(_0x0d6d('0x0'));var logger=require(_0x0d6d('0x1'))(_0x0d6d('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x0d6d('0x3')}});exports[_0x0d6d('0x4')]=function(_0x56fa52,_0x4bf9d1){return function(_0x2b6fe8){try{var _0x432d6b={'priority':_0x4bf9d1[0x0]};var _0x4e68ef=gotop[_0x0d6d('0x5')](_0x432d6b,{'typecast':!![]});if(_0x4e68ef[_0x0d6d('0x6')]){logger[_0x0d6d('0x7')](_0x0d6d('0x8'),_0x56fa52,_[_0x0d6d('0x9')](_0x4e68ef,_0x0d6d('0xa'))[_0x0d6d('0xb')](',\x20'));_0x2b6fe8['stop']();}else{logger[_0x0d6d('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x56fa52,_0x432d6b[_0x0d6d('0xd')]);if(_0x432d6b['priority']){var _0x3b1254=_[_0x0d6d('0xe')](_0x2b6fe8['rules'](),{'p':_0x432d6b[_0x0d6d('0xd')]});if(_0x3b1254>=0x0){logger[_0x0d6d('0xc')](_0x0d6d('0xf'),_0x56fa52,_0x432d6b[_0x0d6d('0xd')]||_0x0d6d('0x10'),_0x3b1254);_0x2b6fe8['next'](_0x3b1254);}else{logger[_0x0d6d('0xc')](_0x0d6d('0x11'),_0x56fa52,_0x432d6b[_0x0d6d('0xd')]||'next');_0x2b6fe8[_0x0d6d('0x12')]();}}else{_0x2b6fe8[_0x0d6d('0x10')]();}}}catch(_0x58bb92){logger[_0x0d6d('0x7')]('[%s][GOTOP]\x20%s',_0x56fa52,JSON['stringify'](_0x58bb92));_0x2b6fe8[_0x0d6d('0x12')]();}};}; \ No newline at end of file +var _0x4e2d=['map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOP]\x20%s','stringify','validate','lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length'];(function(_0x5bdfe5,_0x1cd02f){var _0x4e14a1=function(_0x58447e){while(--_0x58447e){_0x5bdfe5['push'](_0x5bdfe5['shift']());}};_0x4e14a1(++_0x1cd02f);}(_0x4e2d,0x11c));var _0xd4e2=function(_0x23a8e2,_0x49fb66){_0x23a8e2=_0x23a8e2-0x0;var _0x5ea28e=_0x4e2d[_0x23a8e2];return _0x5ea28e;};'use strict';var schema=require(_0xd4e2('0x0'));var _=require(_0xd4e2('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0xd4e2('0x2'),'required':!![],'message':_0xd4e2('0x3')}});exports['consequence']=function(_0x4525da,_0x4ed207){return function(_0x696f4f){try{var _0x160fed={'priority':_0x4ed207[0x0]};var _0x2aa8d8=gotop['validate'](_0x160fed,{'typecast':!![]});if(_0x2aa8d8[_0xd4e2('0x4')]){logger['error']('[%s][GOTOP]\x20%s',_0x4525da,_[_0xd4e2('0x5')](_0x2aa8d8,_0xd4e2('0x6'))['join'](',\x20'));_0x696f4f[_0xd4e2('0x7')]();}else{logger[_0xd4e2('0x8')](_0xd4e2('0x9'),_0x4525da,_0x160fed[_0xd4e2('0xa')]);if(_0x160fed['priority']){var _0xc58eff=_['findIndex'](_0x696f4f['rules'](),{'p':_0x160fed[_0xd4e2('0xa')]});if(_0xc58eff>=0x0){logger[_0xd4e2('0x8')](_0xd4e2('0xb'),_0x4525da,_0x160fed[_0xd4e2('0xa')]||_0xd4e2('0xc'),_0xc58eff);_0x696f4f['next'](_0xc58eff);}else{logger[_0xd4e2('0x8')](_0xd4e2('0xd'),_0x4525da,_0x160fed[_0xd4e2('0xa')]||_0xd4e2('0xc'));_0x696f4f[_0xd4e2('0x7')]();}}else{_0x696f4f[_0xd4e2('0xc')]();}}}catch(_0x2d60e7){logger[_0xd4e2('0xe')](_0xd4e2('0xf'),_0x4525da,JSON[_0xd4e2('0x10')](_0x2d60e7));_0x696f4f[_0xd4e2('0x7')]();}};}; \ 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 aab1232..9a12f34 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 _0x01bb=['../../rpc/faxMessage','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage'];(function(_0x4375c4,_0x2677d2){var _0x5b9765=function(_0x400b86){while(--_0x400b86){_0x4375c4['push'](_0x4375c4['shift']());}};_0x5b9765(++_0x2677d2);}(_0x01bb,0x171));var _0xb01b=function(_0x4ce71c,_0x22a42c){_0x4ce71c=_0x4ce71c-0x0;var _0x59322d=_0x01bb[_0x4ce71c];return _0x59322d;};'use strict';var _=require(_0xb01b('0x0'));var utils=require(_0xb01b('0x1'));var logger=require(_0xb01b('0x2'))(_0xb01b('0x3'));var rpc={'chatMessage':require(_0xb01b('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb01b('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb01b('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x17c73a,_0x13afdd){return function(_0x3e3360){try{var _0xc9f593={'body':utils[_0xb01b('0x7')](_0x13afdd[0x0],this),'ContactId':this[_0xb01b('0x8')]['id']};if(this[_0xb01b('0x9')]===_0xb01b('0xa')){_0xc9f593['ChatWebsiteId']=this[_0xb01b('0xb')]['id'];}else{_0xc9f593[_[_0xb01b('0xc')](this[_0xb01b('0x9')])+_0xb01b('0xd')]=this[_0xb01b('0xb')]['id'];}_0xc9f593[_['upperFirst'](this[_0xb01b('0x9')])+_0xb01b('0xe')]=this[_0xb01b('0xf')]['id'];if(rpc[this[_0xb01b('0x9')]+'Message']){return rpc[this[_0xb01b('0x9')]+_0xb01b('0x10')]['create'](_0xc9f593)['then'](function(_0x1ee445){logger[_0xb01b('0x11')](_0xb01b('0x12'),_0x17c73a,_0xc9f593[_0xb01b('0x13')]);_0x3e3360[_0xb01b('0x14')]();})[_0xb01b('0x15')](function(_0x358c09){logger[_0xb01b('0x16')](_0xb01b('0x12'),_0x17c73a,JSON[_0xb01b('0x17')](_0x358c09));_0x3e3360['stop']();});}}catch(_0x3788be){logger[_0xb01b('0x16')](_0xb01b('0x12'),_0x17c73a,JSON[_0xb01b('0x17')](_0x3788be));_0x3e3360[_0xb01b('0x18')]();}};}; \ No newline at end of file +var _0x95c3=['body','error','[%s][MESSAGE]\x20%s','stringify','stop','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info'];(function(_0x35068b,_0x5eab86){var _0x3536ad=function(_0x5080ca){while(--_0x5080ca){_0x35068b['push'](_0x35068b['shift']());}};_0x3536ad(++_0x5eab86);}(_0x95c3,0x6d));var _0x395c=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x95c3[_0x2c1dcd];return _0x158ce5;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x395c('0x0'))(_0x395c('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x395c('0x2')),'smsMessage':require(_0x395c('0x3')),'faxMessage':require(_0x395c('0x4')),'whatsappMessage':require(_0x395c('0x5'))};exports[_0x395c('0x6')]=function(_0x4afa8a,_0x1df05d){return function(_0x3b952c){try{var _0x3d2d61={'body':utils[_0x395c('0x7')](_0x1df05d[0x0],this),'ContactId':this[_0x395c('0x8')]['id']};if(this[_0x395c('0x9')]===_0x395c('0xa')){_0x3d2d61[_0x395c('0xb')]=this[_0x395c('0xc')]['id'];}else{_0x3d2d61[_[_0x395c('0xd')](this[_0x395c('0x9')])+_0x395c('0xe')]=this['account']['id'];}_0x3d2d61[_[_0x395c('0xd')](this[_0x395c('0x9')])+_0x395c('0xf')]=this[_0x395c('0x10')]['id'];if(rpc[this['channel']+_0x395c('0x11')]){return rpc[this[_0x395c('0x9')]+'Message'][_0x395c('0x12')](_0x3d2d61)[_0x395c('0x13')](function(_0x2d5125){logger[_0x395c('0x14')]('[%s][MESSAGE]\x20%s',_0x4afa8a,_0x3d2d61[_0x395c('0x15')]);_0x3b952c['next']();})['catch'](function(_0x493e3b){logger[_0x395c('0x16')](_0x395c('0x17'),_0x4afa8a,JSON[_0x395c('0x18')](_0x493e3b));_0x3b952c[_0x395c('0x19')]();});}}catch(_0x2a60d6){logger[_0x395c('0x16')](_0x395c('0x17'),_0x4afa8a,JSON[_0x395c('0x18')](_0x2a60d6));_0x3b952c[_0x395c('0x19')]();}};}; \ 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 affcb9b..8b9122d 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 _0xc830=['info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','consequence'];(function(_0x438ab6,_0x57ee95){var _0x13317b=function(_0x11c5c7){while(--_0x11c5c7){_0x438ab6['push'](_0x438ab6['shift']());}};_0x13317b(++_0x57ee95);}(_0xc830,0x85));var _0x0c83=function(_0x58a064,_0x1c4d59){_0x58a064=_0x58a064-0x0;var _0x5a295f=_0xc830[_0x58a064];return _0x5a295f;};'use strict';var utils=require(_0x0c83('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0x0c83('0x1')]=function(_0x872e2,_0xbcef1c){return function(_0x2d8241){try{logger[_0x0c83('0x2')](_0x0c83('0x3'),_0x872e2,utils[_0x0c83('0x4')](_0xbcef1c[0x0],this));_0x2d8241[_0x0c83('0x5')]();}catch(_0x10a7f8){logger[_0x0c83('0x6')]('[%s][NOOP]\x20%s',_0x872e2,JSON[_0x0c83('0x7')](_0x10a7f8));_0x2d8241[_0x0c83('0x8')]();}};}; \ No newline at end of file +var _0x72cf=['info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','./utils','../../../../config/logger','consequence'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x72cf,0x69));var _0xf72c=function(_0x6895d7,_0x5b7024){_0x6895d7=_0x6895d7-0x0;var _0x20dde8=_0x72cf[_0x6895d7];return _0x20dde8;};'use strict';var utils=require(_0xf72c('0x0'));var logger=require(_0xf72c('0x1'))('routing');exports[_0xf72c('0x2')]=function(_0xd5453c,_0x9ff54){return function(_0x38dc5c){try{logger[_0xf72c('0x3')]('[%s][NOOP]\x20%s',_0xd5453c,utils[_0xf72c('0x4')](_0x9ff54[0x0],this));_0x38dc5c[_0xf72c('0x5')]();}catch(_0x28dbf1){logger[_0xf72c('0x6')](_0xf72c('0x7'),_0xd5453c,JSON[_0xf72c('0x8')](_0x28dbf1));_0x38dc5c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index db048ad..2051962 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 _0x9c79=['upperFirst','interaction','MessageId','message','chat','AccountId','WebsiteId','account','name','QueueReport','create','catch','error','accepted','info','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','createQueue','qtimeout','rules','end','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','from','emit','clone','queue','push','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel'];(function(_0x19c788,_0x2cf31d){var _0x364e70=function(_0x4106ce){while(--_0x4106ce){_0x19c788['push'](_0x19c788['shift']());}};_0x364e70(++_0x2cf31d);}(_0x9c79,0x1d6));var _0x99c7=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0x9c79[_0xacb1e2];return _0x463815;};'use strict';var schema=require(_0x99c7('0x0'));var _=require(_0x99c7('0x1'));var util=require(_0x99c7('0x2'));var seqqueue=require(_0x99c7('0x3'));var moment=require(_0x99c7('0x4'));var Redis=require(_0x99c7('0x5'));var config=require(_0x99c7('0x6'));var logger=require('../../../../config/logger')(_0x99c7('0x7'));var strategy=require(_0x99c7('0x8'));config[_0x99c7('0x9')]=_[_0x99c7('0xa')](config[_0x99c7('0x9')],{'host':_0x99c7('0xb'),'port':0x18eb});var io=require(_0x99c7('0xc'))(new Redis(config[_0x99c7('0x9')]));var attributes=['id',_0x99c7('0xd'),'account','queue',_0x99c7('0xe'),'joinAt'];function emit(_0x5993cd,_0x433d33,_0x13c9e6){io['to'](_0x5993cd)[_0x99c7('0xf')](_0x433d33,_0x13c9e6);}function emitChannelQueueInteraction(_0x2bab2f,_0x1dc799,_0x5864f8,_0xe634ad,_0x245464,_0x6ed154,_0x5de676,_0x506bc4){var _0x1fce2b=_[_0x99c7('0x10')](_0x5864f8);_0x1fce2b['queue_id']=_0x506bc4;_0x1fce2b[_0x99c7('0x11')]=_0x1dc799;_0x1fce2b['account']=_0xe634ad;_0x1fce2b['id']=_0x245464;if(_0x6ed154){attributes[_0x99c7('0x12')](_['capitalize'](_0x2bab2f)+_0x99c7('0x13'));_0x5de676[util['format'](_0x99c7('0x14'),_0x2bab2f)][_0x245464]=_[_0x99c7('0x15')](_0x1fce2b,attributes);}else{delete _0x5de676[util[_0x99c7('0x16')](_0x99c7('0x14'),_0x2bab2f)][_0x245464];}emit(util[_0x99c7('0x16')](_0x99c7('0x17'),_0x2bab2f,_0x1dc799),util['format'](_0x99c7('0x18'),_0x2bab2f,_0x6ed154?_0x99c7('0x19'):_0x99c7('0x1a')),_[_0x99c7('0x15')](_0x1fce2b,attributes));}var rpc={'openchannelQueueReport':require(_0x99c7('0x1b')),'mailQueueReport':require(_0x99c7('0x1c')),'chatQueueReport':require(_0x99c7('0x1d')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x99c7('0x1e')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x99c7('0x1f')),'faxInteraction':require(_0x99c7('0x20')),'mailInteraction':require(_0x99c7('0x21')),'openchannelInteraction':require(_0x99c7('0x22')),'smsInteraction':require(_0x99c7('0x23')),'whatsappInteraction':require(_0x99c7('0x24'))};var queue=schema({'name':{'type':_0x99c7('0x25'),'required':!![],'message':_0x99c7('0x26')},'timeout':{'type':_0x99c7('0x27'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0xcdab88,_0x44e208,_0x1c4735,_0x4fbac0){if(_0xcdab88&&_0x44e208&&_0x1c4735){_0x44e208[_0x99c7('0x28')]+=0x1;var _0x2f968d={'uniqueid':_0xcdab88,'from':_0x1c4735[_0x99c7('0x29')]?_0x1c4735[_0x99c7('0x29')][_0x99c7('0xe')]:'','joinAt':moment()[_0x99c7('0x16')](_0x99c7('0x2a')),'ContactId':_0x1c4735['contact']?_0x1c4735[_0x99c7('0x2b')]['id']:null,'ListId':_0x1c4735[_0x99c7('0x2c')]?_0x1c4735['list']['id']:null};_0x2f968d[_['upperFirst'](_0x1c4735[_0x99c7('0x2d')])+'QueueId']=_0x44e208['id']||null;_0x2f968d[_[_0x99c7('0x2e')](_0x1c4735[_0x99c7('0x2d')])+'InteractionId']=_0x1c4735[_0x99c7('0x2f')]?_0x1c4735['interaction']['id']:null;_0x2f968d[_[_0x99c7('0x2e')](_0x1c4735[_0x99c7('0x2d')])+_0x99c7('0x30')]=_0x1c4735[_0x99c7('0x31')]?_0x1c4735[_0x99c7('0x31')]['id']:null;_0x2f968d[_[_0x99c7('0x2e')](_0x1c4735['channel'])+(_0x1c4735['channel']!==_0x99c7('0x32')?_0x99c7('0x33'):_0x99c7('0x34'))]=_0x1c4735[_0x99c7('0x35')]?_0x1c4735[_0x99c7('0x35')]['id']:null;logger['info'](util[_0x99c7('0x16')]('[%s][START:QUEUE][NAME:%s]',_0xcdab88,_0x44e208[_0x99c7('0x36')]));emitChannelQueueInteraction(_0x1c4735[_0x99c7('0x2d')],_0x44e208[_0x99c7('0x36')],_0x2f968d,_0x1c4735[_0x99c7('0x35')][_0x99c7('0x36')],_0x1c4735[_0x99c7('0x31')]['id'],!![],_0x4fbac0,_0x44e208['id']);if(rpc[_0x1c4735['channel']+'QueueReport']){return rpc[_0x1c4735[_0x99c7('0x2d')]+_0x99c7('0x37')][_0x99c7('0x38')](_0x2f968d)[_0x99c7('0x39')](function(_0x505c42){logger[_0x99c7('0x3a')]('create\x20queue\x20report',_0x505c42);});}}}function stopRouting(_0x56132c,_0x17a484,_0x35628f,_0x850ebf){if(_0x56132c&&_0x17a484){_0x17a484[_0x99c7('0x28')]-=0x1;var _0x5e8392={'leaveAt':moment()[_0x99c7('0x16')](_0x99c7('0x2a')),'acceptAt':moment()['format'](_0x99c7('0x2a')),'reason':_0x99c7('0x3b')};logger[_0x99c7('0x3c')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x56132c,_0x17a484[_0x99c7('0x36')]));emitChannelQueueInteraction(_0x35628f['channel'],_0x17a484[_0x99c7('0x36')],_0x35628f[_0x99c7('0x29')],_0x35628f[_0x99c7('0x35')]['name'],_0x35628f['message']['id'],![],_0x850ebf,_0x17a484['id']);return rpc[_0x35628f[_0x99c7('0x2d')]+_0x99c7('0x3d')][_0x99c7('0x3e')](_0x35628f[_0x99c7('0x2f')]['id'],{'queueId':_0x17a484['id']})[_0x99c7('0x3f')](function(){if(rpc[_0x35628f[_0x99c7('0x2d')]+_0x99c7('0x37')]){return rpc[_0x35628f[_0x99c7('0x2d')]+_0x99c7('0x37')][_0x99c7('0x3e')](_0x56132c,_0x5e8392)['catch'](function(_0xa98165){logger[_0x99c7('0x3a')](_0x99c7('0x40'),_0xa98165);});}});}}function endRouting(_0x4ecf69,_0x221d77,_0x3e0951,_0x33d802){if(_0x4ecf69&&_0x221d77){_0x221d77['waiting']-=0x1;var _0x4af252={'leaveAt':moment()[_0x99c7('0x16')](_0x99c7('0x2a')),'exitAt':moment()[_0x99c7('0x16')](_0x99c7('0x2a')),'reason':_0x99c7('0x41')};logger[_0x99c7('0x3c')](util[_0x99c7('0x16')](_0x99c7('0x42'),_0x4ecf69,_0x221d77[_0x99c7('0x36')]));emitChannelQueueInteraction(_0x3e0951[_0x99c7('0x2d')],_0x221d77[_0x99c7('0x36')],_0x3e0951[_0x99c7('0x29')],_0x3e0951[_0x99c7('0x35')][_0x99c7('0x36')],_0x3e0951[_0x99c7('0x31')]['id'],![],_0x33d802);if(rpc[_0x3e0951[_0x99c7('0x2d')]+_0x99c7('0x37')]){return rpc[_0x3e0951['channel']+_0x99c7('0x37')][_0x99c7('0x3e')](_0x4ecf69,_0x4af252)[_0x99c7('0x39')](function(_0x3fe6d9){logger[_0x99c7('0x3a')](_0x99c7('0x40'),_0x3fe6d9);});}}}function handleFindQueue(_0x3a679d){return function(_0x30cdc3){return _0x30cdc3[_0x99c7('0x36')][_0x99c7('0x43')]()===_0x3a679d[_0x99c7('0x43')]();};}exports[_0x99c7('0x44')]=function(_0x55eb9d,_0x3f8078,_0x5bf252,_0x16e21b){return function(_0x3662ff){try{var _0x27a6c3={'name':_0x3f8078[0x0],'timeout':_0x3f8078[0x1]};var _0x54c1c7=queue[_0x99c7('0x0')](_0x27a6c3,{'typecast':!![]});if(_0x54c1c7[_0x99c7('0x45')]){logger[_0x99c7('0x3a')](_0x99c7('0x46'),_0x55eb9d,_[_0x99c7('0x47')](_0x54c1c7,_0x99c7('0x31'))['join'](',\x20'));_0x3662ff[_0x99c7('0x48')]();}else{var _0x39ccf2=_[_0x99c7('0x49')](_0x5bf252[_0x16e21b[_0x99c7('0x2d')]+'Queues'],handleFindQueue(_0x27a6c3[_0x99c7('0x36')]));if(_0x39ccf2){startRouting(_0x55eb9d,_0x39ccf2,_0x16e21b,_0x5bf252);var _0x405432=(_0x39ccf2[_0x99c7('0x41')]||0xa)*0x3e8;var _0x500064=(_0x27a6c3[_0x99c7('0x41')]||0x14)*0x3e8;var _0x196ac6;if(_0x405432>_0x500064){_0x500064=_0x405432;}var _0x3e65bc=seqqueue[_0x99c7('0x4a')](_0x405432);_0x3e65bc['id']=_0x55eb9d;_0x3e65bc['atimeout']=_0x405432;_0x3e65bc[_0x99c7('0x4b')]=_0x500064;_0x3e65bc[_0x99c7('0x2d')]=_0x16e21b[_0x99c7('0x2d')];_0x5bf252[_0x99c7('0x4c')][_0x55eb9d]['on'](_0x99c7('0x4d'),function(){logger[_0x99c7('0x3c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x55eb9d);stopRouting(_0x55eb9d,_0x39ccf2,_0x16e21b,_0x5bf252);clearTimeout(_0x196ac6);_0x196ac6=undefined;_0x3e65bc[_0x99c7('0x4e')](!![]);if(_0x5bf252[_0x99c7('0x4c')][_0x55eb9d]){delete _0x5bf252[_0x99c7('0x4c')][_0x55eb9d];}_0x3662ff[_0x99c7('0x48')]();});_0x5bf252['rules'][_0x55eb9d]['on'](_0x99c7('0x4f'),function(){if(_0x5bf252[_0x99c7('0x4c')][_0x55eb9d]){delete _0x5bf252['rules'][_0x55eb9d];}});_0x196ac6=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x55eb9d);endRouting(_0x55eb9d,_0x39ccf2,_0x16e21b,_0x5bf252);clearTimeout(_0x196ac6);_0x3e65bc[_0x99c7('0x4e')](!![]);_0x3662ff[_0x99c7('0x50')]();},_0x500064);switch(_0x39ccf2[_0x99c7('0x51')]){case _0x99c7('0x52'):strategy['rrmemory'](_0x3e65bc,_0x39ccf2,_0x5bf252,_0x16e21b);break;default:strategy[_0x99c7('0x53')](_0x3e65bc,_0x39ccf2,_0x5bf252,_0x16e21b);}}else{logger[_0x99c7('0x3a')](_0x99c7('0x54'),_0x55eb9d,_0x27a6c3[_0x99c7('0x36')]);_0x3662ff[_0x99c7('0x48')]();}}}catch(_0x2cc147){logger[_0x99c7('0x3a')](_0x99c7('0x46'),_0x55eb9d,_0x2cc147[_0x99c7('0x55')]);_0x3662ff[_0x99c7('0x48')]();}};}; \ No newline at end of file +var _0x6a8e=['localhost','socket.io-emitter','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','body','Interaction','update','then','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6a8e,0x9b));var _0xe6a8=function(_0x36975e,_0x103ce0){_0x36975e=_0x36975e-0x0;var _0x51ded9=_0x6a8e[_0x36975e];return _0x51ded9;};'use strict';var schema=require(_0xe6a8('0x0'));var _=require(_0xe6a8('0x1'));var util=require(_0xe6a8('0x2'));var seqqueue=require(_0xe6a8('0x3'));var moment=require(_0xe6a8('0x4'));var Redis=require('ioredis');var config=require(_0xe6a8('0x5'));var logger=require(_0xe6a8('0x6'))(_0xe6a8('0x7'));var strategy=require(_0xe6a8('0x8'));config[_0xe6a8('0x9')]=_[_0xe6a8('0xa')](config[_0xe6a8('0x9')],{'host':_0xe6a8('0xb'),'port':0x18eb});var io=require(_0xe6a8('0xc'))(new Redis(config['redis']));var attributes=['id',_0xe6a8('0xd'),_0xe6a8('0xe'),_0xe6a8('0xf'),_0xe6a8('0x10'),'joinAt'];function emit(_0x392b51,_0x3ed910,_0x160a58){io['to'](_0x392b51)[_0xe6a8('0x11')](_0x3ed910,_0x160a58);}function emitChannelQueueInteraction(_0x5cf1f6,_0x6e7be6,_0x6c2823,_0x5be69c,_0x46501b,_0x4bfad3,_0x4f3abb,_0x44ed15){var _0x43bdbf=_[_0xe6a8('0x12')](_0x6c2823);_0x43bdbf[_0xe6a8('0xd')]=_0x44ed15;_0x43bdbf[_0xe6a8('0xf')]=_0x6e7be6;_0x43bdbf['account']=_0x5be69c;_0x43bdbf['id']=_0x46501b;if(_0x4bfad3){attributes['push'](_['capitalize'](_0x5cf1f6)+'InteractionId');_0x4f3abb[util[_0xe6a8('0x13')](_0xe6a8('0x14'),_0x5cf1f6)][_0x46501b]=_[_0xe6a8('0x15')](_0x43bdbf,attributes);}else{delete _0x4f3abb[util[_0xe6a8('0x13')](_0xe6a8('0x14'),_0x5cf1f6)][_0x46501b];}emit(util[_0xe6a8('0x13')](_0xe6a8('0x16'),_0x5cf1f6,_0x6e7be6),util[_0xe6a8('0x13')](_0xe6a8('0x17'),_0x5cf1f6,_0x4bfad3?'save':_0xe6a8('0x18')),_[_0xe6a8('0x15')](_0x43bdbf,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0xe6a8('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xe6a8('0x1a')),'whatsappQueueReport':require(_0xe6a8('0x1b')),'chatInteraction':require(_0xe6a8('0x1c')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0xe6a8('0x1d')),'openchannelInteraction':require(_0xe6a8('0x1e')),'smsInteraction':require(_0xe6a8('0x1f')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0xe6a8('0x20'),'required':!![],'message':_0xe6a8('0x21')},'timeout':{'type':'number','message':_0xe6a8('0x22')}});function startRouting(_0xd9cce0,_0x577e50,_0x17b336,_0x3f2543){if(_0xd9cce0&&_0x577e50&&_0x17b336){_0x577e50['waiting']+=0x1;var _0xc11cf6={'uniqueid':_0xd9cce0,'from':_0x17b336['body']?_0x17b336['body']['from']:'','joinAt':moment()[_0xe6a8('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17b336[_0xe6a8('0x23')]?_0x17b336[_0xe6a8('0x23')]['id']:null,'ListId':_0x17b336[_0xe6a8('0x24')]?_0x17b336[_0xe6a8('0x24')]['id']:null};_0xc11cf6[_['upperFirst'](_0x17b336[_0xe6a8('0x25')])+_0xe6a8('0x26')]=_0x577e50['id']||null;_0xc11cf6[_[_0xe6a8('0x27')](_0x17b336[_0xe6a8('0x25')])+_0xe6a8('0x28')]=_0x17b336['interaction']?_0x17b336[_0xe6a8('0x29')]['id']:null;_0xc11cf6[_['upperFirst'](_0x17b336[_0xe6a8('0x25')])+_0xe6a8('0x2a')]=_0x17b336[_0xe6a8('0x2b')]?_0x17b336['message']['id']:null;_0xc11cf6[_['upperFirst'](_0x17b336[_0xe6a8('0x25')])+(_0x17b336[_0xe6a8('0x25')]!==_0xe6a8('0x2c')?_0xe6a8('0x2d'):_0xe6a8('0x2e'))]=_0x17b336[_0xe6a8('0xe')]?_0x17b336[_0xe6a8('0xe')]['id']:null;logger[_0xe6a8('0x2f')](util[_0xe6a8('0x13')](_0xe6a8('0x30'),_0xd9cce0,_0x577e50[_0xe6a8('0x31')]));emitChannelQueueInteraction(_0x17b336[_0xe6a8('0x25')],_0x577e50[_0xe6a8('0x31')],_0xc11cf6,_0x17b336[_0xe6a8('0xe')][_0xe6a8('0x31')],_0x17b336['message']['id'],!![],_0x3f2543,_0x577e50['id']);if(rpc[_0x17b336[_0xe6a8('0x25')]+_0xe6a8('0x32')]){return rpc[_0x17b336[_0xe6a8('0x25')]+_0xe6a8('0x32')]['create'](_0xc11cf6)[_0xe6a8('0x33')](function(_0x9933c9){logger[_0xe6a8('0x34')](_0xe6a8('0x35'),_0x9933c9);});}}}function stopRouting(_0x4f120f,_0xc974ce,_0x20c41f,_0x43a97f){if(_0x4f120f&&_0xc974ce){_0xc974ce['waiting']-=0x1;var _0x11d157={'leaveAt':moment()[_0xe6a8('0x13')](_0xe6a8('0x36')),'acceptAt':moment()[_0xe6a8('0x13')](_0xe6a8('0x36')),'reason':_0xe6a8('0x37')};logger[_0xe6a8('0x2f')](util['format'](_0xe6a8('0x38'),_0x4f120f,_0xc974ce['name']));emitChannelQueueInteraction(_0x20c41f['channel'],_0xc974ce[_0xe6a8('0x31')],_0x20c41f[_0xe6a8('0x39')],_0x20c41f['account'][_0xe6a8('0x31')],_0x20c41f[_0xe6a8('0x2b')]['id'],![],_0x43a97f,_0xc974ce['id']);return rpc[_0x20c41f['channel']+_0xe6a8('0x3a')][_0xe6a8('0x3b')](_0x20c41f[_0xe6a8('0x29')]['id'],{'queueId':_0xc974ce['id']})[_0xe6a8('0x3c')](function(){if(rpc[_0x20c41f['channel']+_0xe6a8('0x32')]){return rpc[_0x20c41f[_0xe6a8('0x25')]+_0xe6a8('0x32')][_0xe6a8('0x3b')](_0x4f120f,_0x11d157)[_0xe6a8('0x33')](function(_0x5cdcfc){logger[_0xe6a8('0x34')](_0xe6a8('0x3d'),_0x5cdcfc);});}});}}function endRouting(_0x67d010,_0x3efd12,_0x3680f9,_0xb51c00){if(_0x67d010&&_0x3efd12){_0x3efd12[_0xe6a8('0x3e')]-=0x1;var _0x168ef7={'leaveAt':moment()[_0xe6a8('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xe6a8('0x13')](_0xe6a8('0x36')),'reason':_0xe6a8('0x3f')};logger[_0xe6a8('0x2f')](util['format'](_0xe6a8('0x40'),_0x67d010,_0x3efd12['name']));emitChannelQueueInteraction(_0x3680f9[_0xe6a8('0x25')],_0x3efd12['name'],_0x3680f9[_0xe6a8('0x39')],_0x3680f9['account'][_0xe6a8('0x31')],_0x3680f9[_0xe6a8('0x2b')]['id'],![],_0xb51c00);if(rpc[_0x3680f9['channel']+'QueueReport']){return rpc[_0x3680f9[_0xe6a8('0x25')]+_0xe6a8('0x32')][_0xe6a8('0x3b')](_0x67d010,_0x168ef7)[_0xe6a8('0x33')](function(_0x50d23b){logger[_0xe6a8('0x34')](_0xe6a8('0x3d'),_0x50d23b);});}}}function handleFindQueue(_0x1fc963){return function(_0x57cfe3){return _0x57cfe3[_0xe6a8('0x31')][_0xe6a8('0x41')]()===_0x1fc963['toLowerCase']();};}exports[_0xe6a8('0x42')]=function(_0x411fb6,_0x33b17a,_0x5d9da0,_0x51394a){return function(_0x2cb42d){try{var _0x2ab960={'name':_0x33b17a[0x0],'timeout':_0x33b17a[0x1]};var _0x374775=queue[_0xe6a8('0x0')](_0x2ab960,{'typecast':!![]});if(_0x374775[_0xe6a8('0x43')]){logger[_0xe6a8('0x34')](_0xe6a8('0x44'),_0x411fb6,_['map'](_0x374775,_0xe6a8('0x2b'))[_0xe6a8('0x45')](',\x20'));_0x2cb42d[_0xe6a8('0x46')]();}else{var _0x5ee536=_[_0xe6a8('0x47')](_0x5d9da0[_0x51394a[_0xe6a8('0x25')]+_0xe6a8('0x48')],handleFindQueue(_0x2ab960[_0xe6a8('0x31')]));if(_0x5ee536){startRouting(_0x411fb6,_0x5ee536,_0x51394a,_0x5d9da0);var _0x28b9dd=(_0x5ee536[_0xe6a8('0x3f')]||0xa)*0x3e8;var _0x23c5cc=(_0x2ab960[_0xe6a8('0x3f')]||0x14)*0x3e8;var _0x5973a4;if(_0x28b9dd>_0x23c5cc){_0x23c5cc=_0x28b9dd;}var _0x2d7387=seqqueue['createQueue'](_0x28b9dd);_0x2d7387['id']=_0x411fb6;_0x2d7387['atimeout']=_0x28b9dd;_0x2d7387['qtimeout']=_0x23c5cc;_0x2d7387[_0xe6a8('0x25')]=_0x51394a[_0xe6a8('0x25')];_0x5d9da0['rules'][_0x411fb6]['on']('end',function(){logger['info'](_0xe6a8('0x49'),_0x411fb6);stopRouting(_0x411fb6,_0x5ee536,_0x51394a,_0x5d9da0);clearTimeout(_0x5973a4);_0x5973a4=undefined;_0x2d7387[_0xe6a8('0x4a')](!![]);if(_0x5d9da0[_0xe6a8('0x4b')][_0x411fb6]){delete _0x5d9da0[_0xe6a8('0x4b')][_0x411fb6];}_0x2cb42d[_0xe6a8('0x46')]();});_0x5d9da0[_0xe6a8('0x4b')][_0x411fb6]['on'](_0xe6a8('0x4c'),function(){if(_0x5d9da0[_0xe6a8('0x4b')][_0x411fb6]){delete _0x5d9da0['rules'][_0x411fb6];}});_0x5973a4=setTimeout(function(){logger[_0xe6a8('0x2f')](_0xe6a8('0x4d'),_0x411fb6);endRouting(_0x411fb6,_0x5ee536,_0x51394a,_0x5d9da0);clearTimeout(_0x5973a4);_0x2d7387[_0xe6a8('0x4a')](!![]);_0x2cb42d[_0xe6a8('0x4e')]();},_0x23c5cc);switch(_0x5ee536['strategy']){case _0xe6a8('0x4f'):strategy['rrmemory'](_0x2d7387,_0x5ee536,_0x5d9da0,_0x51394a);break;default:strategy[_0xe6a8('0x50')](_0x2d7387,_0x5ee536,_0x5d9da0,_0x51394a);}}else{logger[_0xe6a8('0x34')](_0xe6a8('0x51'),_0x411fb6,_0x2ab960[_0xe6a8('0x31')]);_0x2cb42d[_0xe6a8('0x46')]();}}}catch(_0x1fd97e){logger['error'](_0xe6a8('0x44'),_0x411fb6,_0x1fd97e[_0xe6a8('0x52')]);_0x2cb42d[_0xe6a8('0x46')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index a9cf30d..d7ede30 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 _0x826a=['forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','removeWaitingNotification','TIMEOUT','exports','uuid','../../../../../config/logger','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','agents','debug','isAgentAvailable','channel','showNotification','notificationId','writeLog','RINGING'];(function(_0x22f50a,_0x293bae){var _0xc90790=function(_0x16d718){while(--_0x16d718){_0x22f50a['push'](_0x22f50a['shift']());}};_0xc90790(++_0x293bae);}(_0x826a,0x1aa));var _0xa826=function(_0xc0ab42,_0x5d4821){_0xc0ab42=_0xc0ab42-0x0;var _0x50645c=_0x826a[_0xc0ab42];return _0x50645c;};'use strict';var _=require('lodash');var uuid=require(_0xa826('0x0'));var util=require('./util');var logger=require(_0xa826('0x1'))('routing');var Agent=function(_0x376d53,_0x19ba11,_0x2212a4,_0x34e1ad){this['notificationId']=uuid['v4']();this[_0xa826('0x2')]=_0x376d53;this[_0xa826('0x3')]=_0x19ba11;this[_0xa826('0x4')]=_0x2212a4;this[_0xa826('0x5')]=_0x34e1ad;this[_0xa826('0x2')][_0xa826('0x6')](this[_0xa826('0x7')][_0xa826('0x8')](this),this[_0xa826('0x9')][_0xa826('0x8')](this));this[_0xa826('0x2')]['on'](_0xa826('0xa'),this[_0xa826('0x9')][_0xa826('0x8')](this));this[_0xa826('0x2')]['on'](_0xa826('0xb'),this['handleDrained'][_0xa826('0x8')](this));};Agent['prototype'][_0xa826('0x6')]=function(){this[_0xa826('0x2')][_0xa826('0x6')](this[_0xa826('0x7')][_0xa826('0x8')](this),this[_0xa826('0x9')][_0xa826('0x8')](this));};Agent['prototype'][_0xa826('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xa826('0xd')][_0xa826('0x7')]=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xa826('0x3')]['id']);if(_['isNil'](this['realtime'][_0xa826('0xe')][this[_0xa826('0x3')]['id']])){logger[_0xa826('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xa826('0x2')]['id'],this[_0xa826('0x3')]['id']);setTimeout(this[_0xa826('0x6')][_0xa826('0x8')](this),0x3e8);}else{if(this[_0xa826('0x5')]['forcedOwnership']||util[_0xa826('0x10')](this[_0xa826('0x2')]['id'],this[_0xa826('0x4')]['agents'][this['agent']['id']],this[_0xa826('0x2')][_0xa826('0x11')],![])){this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']]['busy']=!![];this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']]['busyQueue']=undefined;util['saveWaitingNotification'](this[_0xa826('0x4')],this[_0xa826('0x5')],this[_0xa826('0x3')],this['squeue'][_0xa826('0x11')]);util[_0xa826('0x12')](this[_0xa826('0x13')],this[_0xa826('0x2')]['id'],this[_0xa826('0x4')]['agents'][this[_0xa826('0x3')]['id']],null,this['routing']);util[_0xa826('0x14')](this[_0xa826('0x2')]['id'],this['realtime'][_0xa826('0xe')][this[_0xa826('0x3')]['id']],_0xa826('0x15')+(this[_0xa826('0x5')][_0xa826('0x16')]?_0xa826('0x17'):''));}else{logger[_0xa826('0xf')](_0xa826('0x18'),this[_0xa826('0x2')]['id'],this[_0xa826('0x3')]['id']);setTimeout(this[_0xa826('0x6')][_0xa826('0x8')](this),0x3e8);}}};Agent[_0xa826('0xd')][_0xa826('0x9')]=function(_0x2253c7){if(_[_0xa826('0x19')](this['realtime'][_0xa826('0xe')][this['agent']['id']])){return logger[_0xa826('0xf')](_0xa826('0x1a'),this[_0xa826('0x2')]['id'],this[_0xa826('0x3')]['id']);}else{logger[_0xa826('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xa826('0x3')]['id']);util[_0xa826('0x1b')](this[_0xa826('0x13')],this[_0xa826('0x2')]['id'],this['realtime'][_0xa826('0xe')][this[_0xa826('0x3')]['id']],null,this['routing']);this[_0xa826('0x4')]['agents'][this[_0xa826('0x3')]['id']][_0xa826('0x1c')]=![];this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']]['busyQueue']=undefined;util[_0xa826('0x1d')](this[_0xa826('0x4')],this[_0xa826('0x5')],this[_0xa826('0x3')],this[_0xa826('0x2')][_0xa826('0x11')]);util[_0xa826('0x14')](this[_0xa826('0x2')]['id'],this[_0xa826('0x4')][_0xa826('0xe')][this[_0xa826('0x3')]['id']],_0x2253c7?'STOP':_0xa826('0x1e'));}if(!_0x2253c7){setTimeout(this['push'][_0xa826('0x8')](this),0x3e8);}};function agent(_0x4d8c2a,_0x179c29,_0x2bae70,_0x31889f){return new Agent(_0x4d8c2a,_0x179c29,_0x2bae70,_0x31889f);}module[_0xa826('0x1f')]=agent; \ No newline at end of file +var _0x34e8=['busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel'];(function(_0x52bfa5,_0x42cf21){var _0x26f80b=function(_0x73c5b0){while(--_0x73c5b0){_0x52bfa5['push'](_0x52bfa5['shift']());}};_0x26f80b(++_0x42cf21);}(_0x34e8,0x12c));var _0x834e=function(_0x54c386,_0x311a75){_0x54c386=_0x54c386-0x0;var _0x239be2=_0x34e8[_0x54c386];return _0x239be2;};'use strict';var _=require(_0x834e('0x0'));var uuid=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var logger=require(_0x834e('0x3'))('routing');var Agent=function(_0x832422,_0x21e2e0,_0x472111,_0x31bf20){this[_0x834e('0x4')]=uuid['v4']();this[_0x834e('0x5')]=_0x832422;this[_0x834e('0x6')]=_0x21e2e0;this['realtime']=_0x472111;this[_0x834e('0x7')]=_0x31bf20;this['squeue'][_0x834e('0x8')](this[_0x834e('0x9')][_0x834e('0xa')](this),this[_0x834e('0xb')][_0x834e('0xa')](this));this[_0x834e('0x5')]['on'](_0x834e('0xc'),this[_0x834e('0xb')][_0x834e('0xa')](this));this[_0x834e('0x5')]['on'](_0x834e('0xd'),this[_0x834e('0xe')][_0x834e('0xa')](this));};Agent[_0x834e('0xf')][_0x834e('0x8')]=function(){this[_0x834e('0x5')][_0x834e('0x8')](this['handleRun'][_0x834e('0xa')](this),this[_0x834e('0xb')]['bind'](this));};Agent[_0x834e('0xf')][_0x834e('0xe')]=function(){this[_0x834e('0xb')](!![]);};Agent[_0x834e('0xf')]['handleRun']=function(){logger[_0x834e('0x10')](_0x834e('0x11'),this['squeue']['id'],this[_0x834e('0x6')]['id']);if(_['isNil'](this[_0x834e('0x12')][_0x834e('0x13')][this['agent']['id']])){logger[_0x834e('0x10')](_0x834e('0x14'),this[_0x834e('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x834e('0x8')][_0x834e('0xa')](this),0x3e8);}else{if(this[_0x834e('0x7')][_0x834e('0x15')]||util[_0x834e('0x16')](this[_0x834e('0x5')]['id'],this[_0x834e('0x12')]['agents'][this[_0x834e('0x6')]['id']],this[_0x834e('0x5')][_0x834e('0x17')],![])){this[_0x834e('0x12')]['agents'][this[_0x834e('0x6')]['id']][_0x834e('0x18')]=!![];this['realtime'][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x19')]=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x834e('0x7')],this[_0x834e('0x6')],this['squeue'][_0x834e('0x17')]);util[_0x834e('0x1a')](this['notificationId'],this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this['agent']['id']],null,this[_0x834e('0x7')]);util[_0x834e('0x1b')](this['squeue']['id'],this['realtime'][_0x834e('0x13')][this['agent']['id']],_0x834e('0x1c')+(this[_0x834e('0x7')][_0x834e('0x15')]?_0x834e('0x1d'):''));}else{logger[_0x834e('0x10')](_0x834e('0x1e'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x834e('0xf')][_0x834e('0xb')]=function(_0x106d6a){if(_['isNil'](this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']])){return logger[_0x834e('0x10')](_0x834e('0x14'),this[_0x834e('0x5')]['id'],this[_0x834e('0x6')]['id']);}else{logger[_0x834e('0x10')](_0x834e('0x1f'),this['squeue']['id'],this[_0x834e('0x6')]['id']);util['hideNotification'](this[_0x834e('0x4')],this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']],null,this[_0x834e('0x7')]);this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x18')]=![];this['realtime'][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x19')]=undefined;util[_0x834e('0x20')](this['realtime'],this[_0x834e('0x7')],this[_0x834e('0x6')],this['squeue']['channel']);util['writeLog'](this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']],_0x106d6a?_0x834e('0x21'):_0x834e('0x22'));}if(!_0x106d6a){setTimeout(this['push'][_0x834e('0xa')](this),0x3e8);}};function agent(_0x513f36,_0xe103fe,_0x6a3ac,_0x47abed){return new Agent(_0x513f36,_0xe103fe,_0x6a3ac,_0x47abed);}module[_0x834e('0x23')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 0ff2f89..fda6522 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 _0x60c4=['push','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','busy','busyQueue','name','showNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','notificationId','queue','realtime','routing','handleRun','bind','handleTimeout','squeue','timeout','handleDrained','prototype'];(function(_0x55a8e1,_0x22d97f){var _0x6b8779=function(_0x566168){while(--_0x566168){_0x55a8e1['push'](_0x55a8e1['shift']());}};_0x6b8779(++_0x22d97f);}(_0x60c4,0x76));var _0x460c=function(_0x50d5f9,_0x2c630e){_0x50d5f9=_0x50d5f9-0x0;var _0x5d5da0=_0x60c4[_0x50d5f9];return _0x5d5da0;};'use strict';var _=require(_0x460c('0x0'));var uuid=require('uuid');var util=require(_0x460c('0x1'));var logger=require(_0x460c('0x2'))('routing');var Beepall=function(_0x58f6e,_0x492d2e,_0x34e782,_0x2cf458){this[_0x460c('0x3')]=uuid['v4']();this['squeue']=_0x58f6e;this[_0x460c('0x4')]=_0x492d2e;this[_0x460c('0x5')]=_0x34e782;this[_0x460c('0x6')]=_0x2cf458;this['squeue']['push'](this[_0x460c('0x7')][_0x460c('0x8')](this),this[_0x460c('0x9')][_0x460c('0x8')](this));this[_0x460c('0xa')]['on'](_0x460c('0xb'),this[_0x460c('0x9')][_0x460c('0x8')](this));this[_0x460c('0xa')]['on']('drained',this[_0x460c('0xc')][_0x460c('0x8')](this));};Beepall[_0x460c('0xd')][_0x460c('0xe')]=function(){this[_0x460c('0xa')][_0x460c('0xe')](this['handleRun'][_0x460c('0x8')](this),this[_0x460c('0x9')][_0x460c('0x8')](this));};Beepall[_0x460c('0xd')][_0x460c('0xc')]=function(){this[_0x460c('0x9')](!![]);};Beepall['prototype'][_0x460c('0x7')]=function(){var _0x421514=!![];if(!_[_0x460c('0xf')](this[_0x460c('0x4')])&&!_[_0x460c('0xf')](this[_0x460c('0x4')][_0x460c('0x10')])&&this[_0x460c('0x4')]['Agents'][_0x460c('0x11')]>0x0){for(var _0x16507c=0x0,_0x3d98c5;_0x16507c0x0){for(var _0x25ad85=0x0,_0x363fbe;_0x25ad850x0&&_0x5c2e25[_0x53c0b6+_0x656a('0x25')]>=_0x5c2e25[_0x53c0b6+_0x656a('0x24')]){writeLog(_0x507cad,_0x5c2e25,_0x53c0b6[_0x656a('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x656a('0x27')]=function(_0x4c79cd,_0x223d67,_0x568066,_0x2008fe,_0x505680){return sendNotification(!![],_0x4c79cd,_0x223d67,_0x568066,_0x2008fe,_0x505680);};exports[_0x656a('0x28')]=function(_0x4b60f0,_0x5b5bd4,_0x5b580a,_0x55abd2,_0x47bcc0){return sendNotification(![],_0x4b60f0,_0x5b5bd4,_0x5b580a,_0x55abd2,_0x47bcc0);};exports[_0x656a('0x29')]=function(_0x49a723,_0xb19ba7,_0x5a756c){var _0x2ac965=_0xb19ba7[_0x656a('0x2a')][_0x656a('0x2b')];if(!_0x2ac965&&_0x5a756c){_0x2ac965=_0x5a756c['id'];}var _0x2db0d3=_['some'](_0x49a723[_0xb19ba7['channel']+_0x656a('0x2c')],function(_0x3a877b){var _0x503b06=_[_0x656a('0x2d')](_0xb19ba7[_0x656a('0x2e')])+_0x656a('0x2f');return _0x3a877b[_0x503b06]===_0xb19ba7[_0x656a('0x2a')]['id'];});if(!_0x2db0d3&&_0x2ac965&&_0x49a723['agents'][_0x2ac965]){_0x2db0d3=_['some'](_0x49a723[_0x656a('0x30')][_0x2ac965][_0xb19ba7[_0x656a('0x2e')]+'WaitingInteractions'],function(_0x5ee4f4){return _0x5ee4f4['id']===_0xb19ba7[_0x656a('0x2a')]['id'];});}return _0x2db0d3;};exports[_0x656a('0x31')]=function(_0x2e835e,_0x4c4457,_0x5422f3,_0x3d6d8a){if(_0x5422f3&&_0x5422f3['id']&&_0x2e835e[_0x656a('0x30')]&&_0x2e835e[_0x656a('0x30')][_0x5422f3['id']]){_0x2e835e[_0x656a('0x30')][_0x5422f3['id']][_0x3d6d8a+_0x656a('0x32')][_0x4c4457[_0x656a('0x19')]['id']]={'id':_0x4c4457['interaction']['id']};}};exports['removeWaitingNotification']=function(_0x375b4b,_0x401b45,_0x4cc1db,_0x377763){if(_0x4cc1db&&_0x4cc1db['id']&&_0x375b4b[_0x656a('0x30')]&&_0x375b4b['agents'][_0x4cc1db['id']]){delete _0x375b4b[_0x656a('0x30')][_0x4cc1db['id']][_0x377763+_0x656a('0x32')][_0x401b45[_0x656a('0x19')]['id']];}};exports[_0x656a('0x33')]=writeLog; \ No newline at end of file +var _0xb138=['localhost','format','user:%s','user:save','split','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','saveWaitingNotification','WaitingInteractions','removeWaitingNotification','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb138,0x1dd));var _0x8b13=function(_0x3333e9,_0x4d1d0e){_0x3333e9=_0x3333e9-0x0;var _0x48b7bb=_0xb138[_0x3333e9];return _0x48b7bb;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var utils=require(_0x8b13('0x2'));var Redis=require(_0x8b13('0x3'));var config=require(_0x8b13('0x4'));var logger=require(_0x8b13('0x5'))(_0x8b13('0x6'));config['redis']=_[_0x8b13('0x7')](config[_0x8b13('0x8')],{'host':_0x8b13('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8b13('0x8')]));function sendNotification(_0x13f7bd,_0x5d51b1,_0x3fdf4d,_0x33d1a7,_0x22e157,_0x498832){io['to'](util[_0x8b13('0xa')](_0x8b13('0xb'),_0x33d1a7['name']))['emit'](_0x8b13('0xc'),_0x33d1a7);var _0x21fcd9=_0x498832||{};var _0x13fbd1=_0x3fdf4d[_0x8b13('0xd')]('.');var _0x3e8eca={'uniqueid':_0x5d51b1,'channel':_0x13fbd1[0x0],'id':_0x13fbd1[0x1],'title':_0x13fbd1[0x0]+'\x20interaction','interactionId':_0x13fbd1[0x2],'queue':_0x22e157?_0x22e157[_0x8b13('0xe')]:null,'sound':_0x21fcd9[_0x8b13('0xf')][_0x8b13('0x10')],'shake':_0x21fcd9[_0x8b13('0xf')][_0x8b13('0x11')]};try{if(!_0x21fcd9[_0x8b13('0x12')]){_0x21fcd9['body']={};}if(_0x22e157){_0x21fcd9['body'][_0x8b13('0x13')]=_0x22e157;}else if(_0x21fcd9[_0x8b13('0x12')]['queue']){delete _0x21fcd9['body']['queue'];}_0x3e8eca[_0x8b13('0x14')]=utils[_0x8b13('0x15')](_0x21fcd9[_0x8b13('0xf')][_0x8b13('0x16')],_0x21fcd9);}catch(_0x13f956){_0x3e8eca['msg']=_0x8b13('0x17');logger[_0x8b13('0x18')](util[_0x8b13('0xa')](_0x8b13('0x19'),_0x5d51b1,_0x13f956[_0x8b13('0x1a')]));}io['to'](util[_0x8b13('0xa')](_0x8b13('0xb'),_0x33d1a7[_0x8b13('0xe')]))['emit'](util['format'](_0x8b13('0x1b'),_0x13f7bd?_0x8b13('0x1c'):_0x8b13('0x1d')),_0x3e8eca);}function writeLog(_0x9c03b4,_0x1e0fe3,_0x3cc9a0){return logger['debug'](util[_0x8b13('0xa')](_0x8b13('0x1e'),_0x9c03b4,_0x1e0fe3[_0x8b13('0xe')],_0x3cc9a0));}exports['isAgentAvailable']=function(_0x51dd1d,_0xe73329,_0xcb7621,_0x4f9902){if(_0xe73329[_0x8b13('0x1f')]){writeLog(_0x51dd1d,_0xe73329,_0x8b13('0x20'));return![];}if(!_0xe73329[_0x8b13('0x21')]){writeLog(_0x51dd1d,_0xe73329,_0x8b13('0x22'));return![];}if(_0xe73329[_0xcb7621+_0x8b13('0x23')]){writeLog(_0x51dd1d,_0xe73329,'PAUSE');return![];}if(_0x4f9902&&_0xe73329[_0x8b13('0x24')](_0xcb7621+_0x8b13('0x25'))&&_0xe73329['hasOwnProperty'](_0xcb7621+_0x8b13('0x26'))){if(_0xe73329[_0xcb7621+'Capacity']>0x0&&_0xe73329[_0xcb7621+_0x8b13('0x26')]>=_0xe73329[_0xcb7621+_0x8b13('0x25')]){writeLog(_0x51dd1d,_0xe73329,_0xcb7621['toUpperCase']()+_0x8b13('0x27'));return![];}}return!![];};exports[_0x8b13('0x28')]=function(_0x4f8e58,_0x134c5e,_0x14a739,_0x410122,_0x4048e4){return sendNotification(!![],_0x4f8e58,_0x134c5e,_0x14a739,_0x410122,_0x4048e4);};exports[_0x8b13('0x29')]=function(_0x54cdfc,_0x6023f5,_0x1b09e2,_0x3475d8,_0x1511bf){return sendNotification(![],_0x54cdfc,_0x6023f5,_0x1b09e2,_0x3475d8,_0x1511bf);};exports[_0x8b13('0x2a')]=function(_0x2bb51d,_0x5ab161,_0x35fdca){var _0xfec033=_0x5ab161[_0x8b13('0x2b')][_0x8b13('0x2c')];if(!_0xfec033&&_0x35fdca){_0xfec033=_0x35fdca['id'];}var _0x23fde7=_[_0x8b13('0x2d')](_0x2bb51d[_0x5ab161[_0x8b13('0x2e')]+_0x8b13('0x2f')],function(_0x36f732){var _0x5751db=_[_0x8b13('0x30')](_0x5ab161[_0x8b13('0x2e')])+_0x8b13('0x31');return _0x36f732[_0x5751db]===_0x5ab161[_0x8b13('0x2b')]['id'];});if(!_0x23fde7&&_0xfec033&&_0x2bb51d['agents'][_0xfec033]){_0x23fde7=_['some'](_0x2bb51d[_0x8b13('0x32')][_0xfec033][_0x5ab161['channel']+'WaitingInteractions'],function(_0x3b1dfa){return _0x3b1dfa['id']===_0x5ab161['interaction']['id'];});}return _0x23fde7;};exports[_0x8b13('0x33')]=function(_0x408626,_0x40fc29,_0x39a3d2,_0x11657e){if(_0x39a3d2&&_0x39a3d2['id']&&_0x408626[_0x8b13('0x32')]&&_0x408626[_0x8b13('0x32')][_0x39a3d2['id']]){_0x408626[_0x8b13('0x32')][_0x39a3d2['id']][_0x11657e+_0x8b13('0x34')][_0x40fc29[_0x8b13('0x1a')]['id']]={'id':_0x40fc29['interaction']['id']};}};exports[_0x8b13('0x35')]=function(_0x31f5bd,_0x19b21c,_0x4141db,_0x1ff25c){if(_0x4141db&&_0x4141db['id']&&_0x31f5bd[_0x8b13('0x32')]&&_0x31f5bd[_0x8b13('0x32')][_0x4141db['id']]){delete _0x31f5bd[_0x8b13('0x32')][_0x4141db['id']][_0x1ff25c+'WaitingInteractions'][_0x19b21c[_0x8b13('0x1a')]['id']];}};exports['writeLog']=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 73fed4f..e5e31af 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 _0x1832=['stringify','validate','shelljs','./utils','routing','string','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','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject'];(function(_0x20a1fa,_0x52f364){var _0x114327=function(_0x10fc2d){while(--_0x10fc2d){_0x20a1fa['push'](_0x20a1fa['shift']());}};_0x114327(++_0x52f364);}(_0x1832,0x12a));var _0x2183=function(_0x53119d,_0x1b1a45){_0x53119d=_0x53119d-0x0;var _0x297a30=_0x1832[_0x53119d];return _0x297a30;};'use strict';var schema=require(_0x2183('0x0'));var sh=require(_0x2183('0x1'));var _=require('lodash');var utils=require(_0x2183('0x2'));var logger=require('../../../../config/logger')(_0x2183('0x3'));var system=schema({'command':{'type':_0x2183('0x4'),'required':!![],'message':_0x2183('0x5')}});exports[_0x2183('0x6')]=function(_0x29b67a,_0x16fac5){return function(_0x204056){try{var _0x4059fa={'command':_0x16fac5[0x0]};var _0x2a8215=system['validate'](_0x4059fa,{'typecast':!![]});if(_0x2a8215[_0x2183('0x7')]){logger[_0x2183('0x8')](_0x2183('0x9'),_0x29b67a,_[_0x2183('0xa')](_0x2a8215,_0x2183('0xb'))[_0x2183('0xc')](',\x20'));logger[_0x2183('0xd')](_0x2183('0xe'),_0x29b67a);_0x204056[_0x2183('0xf')]();}else{var _0x247234=this;var _0x36febf=utils['getMustacheRender'](_0x16fac5[0x0],this);logger[_0x2183('0xd')](_0x2183('0x10'),_0x29b67a,_0x36febf);sh[_0x2183('0x11')](_['trim'](_0x36febf),function(_0x161a67,_0x36d150){logger[_0x2183('0xd')](_0x2183('0x12'),_0x29b67a,_0x161a67);if(_0x161a67==0x0){var _0x33971f=_0x36d150[_0x2183('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x2183('0x14')](_0x16fac5[0x1])||_[_0x2183('0x15')](_0x16fac5[0x1])){logger[_0x2183('0xd')](_0x2183('0x16'),_0x29b67a);_0x247234[_0x2183('0x17')][_0x16fac5[0x1]]=_0x33971f;}else{logger[_0x2183('0xd')](_0x2183('0x18'),_0x29b67a,_0x16fac5[0x1],_0x33971f);_0x247234[_0x2183('0x17')][_0x16fac5[0x1]]=_0x33971f;}}_0x204056[_0x2183('0xf')]();});}}catch(_0x4f01f9){logger['error'](_0x2183('0x9'),_0x29b67a,_[_0x2183('0x19')](_0x4f01f9)?JSON[_0x2183('0x1a')](_0x4f01f9):_0x4f01f9);logger[_0x2183('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x29b67a);_0x204056['next']();}};}; \ No newline at end of file +var _0x4fdb=['validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x25c227,_0x43301a){_0x25c227=_0x25c227-0x0;var _0x4c813c=_0x4fdb[_0x25c227];return _0x4c813c;};'use strict';var schema=require(_0xb4fd('0x0'));var sh=require(_0xb4fd('0x1'));var _=require(_0xb4fd('0x2'));var utils=require(_0xb4fd('0x3'));var logger=require(_0xb4fd('0x4'))(_0xb4fd('0x5'));var system=schema({'command':{'type':_0xb4fd('0x6'),'required':!![],'message':_0xb4fd('0x7')}});exports[_0xb4fd('0x8')]=function(_0x5b73bb,_0x308de6){return function(_0x5c07c5){try{var _0x14052b={'command':_0x308de6[0x0]};var _0x5d8b39=system['validate'](_0x14052b,{'typecast':!![]});if(_0x5d8b39[_0xb4fd('0x9')]){logger[_0xb4fd('0xa')](_0xb4fd('0xb'),_0x5b73bb,_['map'](_0x5d8b39,'message')[_0xb4fd('0xc')](',\x20'));logger[_0xb4fd('0xd')](_0xb4fd('0xe'),_0x5b73bb);_0x5c07c5['next']();}else{var _0x1e1e16=this;var _0x17ac4b=utils[_0xb4fd('0xf')](_0x308de6[0x0],this);logger[_0xb4fd('0xd')](_0xb4fd('0x10'),_0x5b73bb,_0x17ac4b);sh['exec'](_[_0xb4fd('0x11')](_0x17ac4b),function(_0x1f3e30,_0x2e8ee1){logger[_0xb4fd('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x5b73bb,_0x1f3e30);if(_0x1f3e30==0x0){var _0x38173d=_0x2e8ee1[_0xb4fd('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xb4fd('0x13')](_0x308de6[0x1])||_['isEmpty'](_0x308de6[0x1])){logger[_0xb4fd('0xd')](_0xb4fd('0x14'),_0x5b73bb);_0x1e1e16[_0xb4fd('0x15')][_0x308de6[0x1]]=_0x38173d;}else{logger[_0xb4fd('0xd')](_0xb4fd('0x16'),_0x5b73bb,_0x308de6[0x1],_0x38173d);_0x1e1e16[_0xb4fd('0x15')][_0x308de6[0x1]]=_0x38173d;}}_0x5c07c5[_0xb4fd('0x17')]();});}}catch(_0x47e288){logger[_0xb4fd('0xa')](_0xb4fd('0xb'),_0x5b73bb,_[_0xb4fd('0x18')](_0x47e288)?JSON[_0xb4fd('0x19')](_0x47e288):_0x47e288);logger[_0xb4fd('0xd')](_0xb4fd('0xe'),_0x5b73bb);_0x5c07c5[_0xb4fd('0x17')]();}};}; \ 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 0c3d72d..30b6b66 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 _0x4119=['error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','consequence','length'];(function(_0x42aeb7,_0x51ea14){var _0x23db20=function(_0x3a8392){while(--_0x3a8392){_0x42aeb7['push'](_0x42aeb7['shift']());}};_0x23db20(++_0x51ea14);}(_0x4119,0x64));var _0x9411=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4119[_0x4cf98e];return _0x1623ac;};'use strict';var schema=require(_0x9411('0x0'));var _=require(_0x9411('0x1'));var rpc={'chatInteraction':require(_0x9411('0x2')),'openchannelInteraction':require(_0x9411('0x3')),'smsInteraction':require(_0x9411('0x4')),'mailInteraction':require(_0x9411('0x5')),'faxInteraction':require(_0x9411('0x6')),'whatsappInteraction':require(_0x9411('0x7'))};var logger=require(_0x9411('0x8'))('routing');var tag=schema({'tag':{'type':_0x9411('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9411('0xa')]=function(_0xd03ec5,_0x4c1f6c,_0xb5c9cf,_0x47733f){return function(_0x53500d){try{var _0x1118e8={'tag':_0x4c1f6c[0x0]};var _0x959a3e=tag[_0x9411('0x0')](_0x1118e8,{'typecast':!![]});if(_0x959a3e[_0x9411('0xb')]){logger[_0x9411('0xc')](_0x9411('0xd'),_0xd03ec5,_[_0x9411('0xe')](_0x959a3e,'message')[_0x9411('0xf')](',\x20'));logger[_0x9411('0x10')](_0x9411('0x11'),_0xd03ec5);_0x53500d[_0x9411('0x12')]();}else{var _0x269a96={'ids':[_0x4c1f6c[0x0]]};if(rpc[_0x47733f[_0x9411('0x13')]+'Interaction']){rpc[_0x47733f[_0x9411('0x13')]+_0x9411('0x14')][_0x9411('0x15')](_0x47733f['interaction']['id'],_0x269a96)[_0x9411('0x16')](function(_0x21bcb2){logger[_0x9411('0x10')](_0x9411('0x17'),_0xd03ec5,_0x4c1f6c[0x1],_0x47733f[_0x9411('0x13')],_0x47733f[_0x9411('0x18')]['id']);})[_0x9411('0x19')](function(_0x328144){logger['error'](_0x9411('0xd'),_0xd03ec5,JSON['stringify'](_0x328144));logger['info'](_0x9411('0x11'),_0xd03ec5);})['finally'](function(){_0x53500d[_0x9411('0x12')]();});}}}catch(_0x38b06e){logger[_0x9411('0xc')](_0x9411('0xd'),_0xd03ec5,_[_0x9411('0x1a')](_0x38b06e)?JSON[_0x9411('0x1b')](_0x38b06e):_0x38b06e);logger['info'](_0x9411('0x11'),_0xd03ec5);_0x53500d[_0x9411('0x12')]();}};}; \ No newline at end of file +var _0x2f38=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','join','next','channel','Interaction','addTags','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','[%s][TAG]\x20%s','stringify','finally','isObject'];(function(_0x22a341,_0x18d485){var _0x92ab4d=function(_0x1790c2){while(--_0x1790c2){_0x22a341['push'](_0x22a341['shift']());}};_0x92ab4d(++_0x18d485);}(_0x2f38,0x153));var _0x82f3=function(_0x583f66,_0x196e7d){_0x583f66=_0x583f66-0x0;var _0x547eb3=_0x2f38[_0x583f66];return _0x547eb3;};'use strict';var schema=require(_0x82f3('0x0'));var _=require(_0x82f3('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x82f3('0x2')),'faxInteraction':require(_0x82f3('0x3')),'whatsappInteraction':require(_0x82f3('0x4'))};var logger=require(_0x82f3('0x5'))(_0x82f3('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x82f3('0x7')}});exports[_0x82f3('0x8')]=function(_0x211440,_0x14ab06,_0x10c564,_0x21741a){return function(_0x127350){try{var _0x327ef2={'tag':_0x14ab06[0x0]};var _0x3597c3=tag['validate'](_0x327ef2,{'typecast':!![]});if(_0x3597c3[_0x82f3('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x211440,_[_0x82f3('0xa')](_0x3597c3,'message')[_0x82f3('0xb')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x211440);_0x127350[_0x82f3('0xc')]();}else{var _0x33716b={'ids':[_0x14ab06[0x0]]};if(rpc[_0x21741a[_0x82f3('0xd')]+_0x82f3('0xe')]){rpc[_0x21741a[_0x82f3('0xd')]+_0x82f3('0xe')][_0x82f3('0xf')](_0x21741a[_0x82f3('0x10')]['id'],_0x33716b)['then'](function(_0x214214){logger[_0x82f3('0x11')](_0x82f3('0x12'),_0x211440,_0x14ab06[0x1],_0x21741a[_0x82f3('0xd')],_0x21741a['interaction']['id']);})[_0x82f3('0x13')](function(_0x218587){logger[_0x82f3('0x14')](_0x82f3('0x15'),_0x211440,JSON[_0x82f3('0x16')](_0x218587));logger[_0x82f3('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x211440);})[_0x82f3('0x17')](function(){_0x127350[_0x82f3('0xc')]();});}}}catch(_0x309f60){logger[_0x82f3('0x14')]('[%s][TAG]\x20%s',_0x211440,_[_0x82f3('0x18')](_0x309f60)?JSON[_0x82f3('0x16')](_0x309f60):_0x309f60);logger[_0x82f3('0x11')](_0x82f3('0x19'),_0x211440);_0x127350['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 6012d1e..80c5cd2 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 _0x9b8c=['Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','push','title','jsonrpc','2.0','login','params','stringify','utf8','application/json-rpc','parse','result','logged'];(function(_0x4560f3,_0x517d6e){var _0x531125=function(_0x5bacb4){while(--_0x5bacb4){_0x4560f3['push'](_0x4560f3['shift']());}};_0x531125(++_0x517d6e);}(_0x9b8c,0x6a));var _0xc9b8=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x9b8c[_0x25b4a4];return _0x707267;};'use strict';var rp=require(_0xc9b8('0x0'));var logger=require(_0xc9b8('0x1'))(_0xc9b8('0x2'));var _=require(_0xc9b8('0x3'));var arr=[];exports[_0xc9b8('0x4')]=function(_0x35ff7d,_0x124eb7){return function(_0x5baccc){var _0x3c2399=_0x124eb7[0xa];var _0x346a70=_0x124eb7[0xb];var _0x3a8b7e=_0x124eb7[0xc];var _0x5ae694=_0x124eb7[0xd];var _0x25c8a7=_0x124eb7[0xe];var _0x4b2604=_0x124eb7[0xf][_0xc9b8('0x5')](/\n/g,'\x20-\x20');var _0x35d2b3=_0x124eb7[0x10][_0xc9b8('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x346a70)){arr[_0xc9b8('0x6')](_0x346a70);var _0x2d8f57=_0x124eb7[0x3];var _0x54df35=_0x124eb7[0x4];var _0x2bd2f9=_0x124eb7[0x1];var _0xd4d94a=_0x124eb7[0x0];var _0x2f65a4={};_0x2f65a4['urlOnAnswer']=_0x124eb7[0x8]+'?params='+_0x3a8b7e+'|'+_0x3c2399+'|'+_0x5ae694+'|'+_0x346a70+'|'+_0x25c8a7;_0x2f65a4['urlOnRing']=_0x124eb7[0x7]+'?params='+_0x3a8b7e+'|'+_0x3c2399+'|'+_0x5ae694+'|'+_0x346a70+'|'+_0x25c8a7+'|'+_0x4b2604+'|'+_0x35d2b3;_0x2f65a4[_0xc9b8('0x7')]=_0x124eb7[0x9];var _0x45be46={};_0x45be46[_0xc9b8('0x8')]=_0xc9b8('0x9');_0x45be46['method']=_0xc9b8('0xa');var _0x2f5d53=[];_0x2f5d53[_0xc9b8('0x6')](_0x124eb7[0x2]);_0x2f5d53[_0xc9b8('0x6')](_0x124eb7[0x5]);_0x2f5d53[_0xc9b8('0x6')](_0x124eb7[0x6]);_0x45be46[_0xc9b8('0xb')]=_0x2f5d53;_0x45be46['id']=0x1;var _0x16e49d=JSON[_0xc9b8('0xc')](_0x45be46);var _0x35e08a={'encoding':_0xc9b8('0xd'),'method':'POST','timeout':0x2710,'url':_0x2d8f57,'headers':{'Content-Type':_0xc9b8('0xe')},'body':_0x16e49d};return rp(_0x35e08a)['then'](function(_0x39aff9){const _0x385570=JSON[_0xc9b8('0xf')](_0x39aff9);if(!_0x385570[_0xc9b8('0x10')][_0xc9b8('0x11')]){throw new Error(_0xc9b8('0x12'));}var _0x5c82b9=_0x346a70;var _0x3de4a0=_0xc9b8('0x13')+_0x2bd2f9+_0xc9b8('0x14')+_0xd4d94a+'&sessionId='+_0x5c82b9+_0xc9b8('0x15')+JSON[_0xc9b8('0xc')](_0x2f65a4);var _0x2807c1=_0x54df35+'?'+_0x3de4a0;return rp(_0x2807c1);})[_0xc9b8('0x16')](function(_0x1bf8d4){logger[_0xc9b8('0x17')](_0xc9b8('0x18'),_0x35ff7d,_0x1bf8d4);_0x5baccc[_0xc9b8('0x19')]();})[_0xc9b8('0x1a')](function(_0x5421fb){logger[_0xc9b8('0x1b')](_0xc9b8('0x1c'),_0x35ff7d,_[_0xc9b8('0x1d')](_0x5421fb)?JSON[_0xc9b8('0xc')](_0x5421fb):_0x5421fb);_0x5baccc[_0xc9b8('0x19')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x35ff7d);_0x5baccc[_0xc9b8('0x1e')]();}};}; \ No newline at end of file +var _0x73d2=['jsonrpc','2.0','login','push','stringify','utf8','POST','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','stop','catch','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','urlOnAnswer','?params=','title'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73d2,0x16a));var _0x273d=function(_0xb6245,_0x55bdbc){_0xb6245=_0xb6245-0x0;var _0x5c1f1d=_0x73d2[_0xb6245];return _0x5c1f1d;};'use strict';var rp=require(_0x273d('0x0'));var logger=require(_0x273d('0x1'))(_0x273d('0x2'));var _=require(_0x273d('0x3'));var arr=[];exports[_0x273d('0x4')]=function(_0x2d726b,_0x5cfd39){return function(_0x31741a){var _0x463fd0=_0x5cfd39[0xa];var _0x358dc=_0x5cfd39[0xb];var _0x3c0e6c=_0x5cfd39[0xc];var _0x3e2b74=_0x5cfd39[0xd];var _0x51a700=_0x5cfd39[0xe];var _0xc39831=_0x5cfd39[0xf][_0x273d('0x5')](/\n/g,'\x20-\x20');var _0x34eaa9=_0x5cfd39[0x10][_0x273d('0x5')](/\n/g,'\x20');if(!arr[_0x273d('0x6')](_0x358dc)){arr['push'](_0x358dc);var _0x4788ef=_0x5cfd39[0x3];var _0x5b2c80=_0x5cfd39[0x4];var _0xfed993=_0x5cfd39[0x1];var _0x587c6a=_0x5cfd39[0x0];var _0x20ee6c={};_0x20ee6c[_0x273d('0x7')]=_0x5cfd39[0x8]+'?params='+_0x3c0e6c+'|'+_0x463fd0+'|'+_0x3e2b74+'|'+_0x358dc+'|'+_0x51a700;_0x20ee6c['urlOnRing']=_0x5cfd39[0x7]+_0x273d('0x8')+_0x3c0e6c+'|'+_0x463fd0+'|'+_0x3e2b74+'|'+_0x358dc+'|'+_0x51a700+'|'+_0xc39831+'|'+_0x34eaa9;_0x20ee6c[_0x273d('0x9')]=_0x5cfd39[0x9];var _0x58fc18={};_0x58fc18[_0x273d('0xa')]=_0x273d('0xb');_0x58fc18['method']=_0x273d('0xc');var _0x14cd11=[];_0x14cd11[_0x273d('0xd')](_0x5cfd39[0x2]);_0x14cd11[_0x273d('0xd')](_0x5cfd39[0x5]);_0x14cd11[_0x273d('0xd')](_0x5cfd39[0x6]);_0x58fc18['params']=_0x14cd11;_0x58fc18['id']=0x1;var _0x31a368=JSON[_0x273d('0xe')](_0x58fc18);var _0x819c94={'encoding':_0x273d('0xf'),'method':_0x273d('0x10'),'timeout':0x2710,'url':_0x4788ef,'headers':{'Content-Type':'application/json-rpc'},'body':_0x31a368};return rp(_0x819c94)[_0x273d('0x11')](function(_0xe05e3a){const _0x4a4336=JSON['parse'](_0xe05e3a);if(!_0x4a4336[_0x273d('0x12')][_0x273d('0x13')]){throw new Error(_0x273d('0x14'));}var _0xd6e130=_0x358dc;var _0x9caab2=_0x273d('0x15')+_0xfed993+_0x273d('0x16')+_0x587c6a+_0x273d('0x17')+_0xd6e130+_0x273d('0x18')+JSON[_0x273d('0xe')](_0x20ee6c);var _0x1c40b3=_0x5b2c80+'?'+_0x9caab2;return rp(_0x1c40b3);})['then'](function(_0xa40f01){logger[_0x273d('0x19')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x2d726b,_0xa40f01);_0x31741a[_0x273d('0x1a')]();})[_0x273d('0x1b')](function(_0x2ef8bc){logger['error'](_0x273d('0x1c'),_0x2d726b,_[_0x273d('0x1d')](_0x2ef8bc)?JSON[_0x273d('0xe')](_0x2ef8bc):_0x2ef8bc);_0x31741a[_0x273d('0x1a')]();});}else{logger[_0x273d('0x19')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x2d726b);_0x31741a[_0x273d('0x1e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 7fc51ab..02f97a3 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x1e06c7,_0x216c56){var _0x2a8b1a=function(_0x21297b){while(--_0x21297b){_0x1e06c7['push'](_0x1e06c7['shift']());}};_0x2a8b1a(++_0x216c56);}(_0xe706,0xa3));var _0x6e70=function(_0x56bcff,_0x158e5f){_0x56bcff=_0x56bcff-0x0;var _0x340351=_0xe706[_0x56bcff];return _0x340351;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x56809e,_0x6d1ac2){var _0x3df1fa=function(_0x2e6b61){while(--_0x2e6b61){_0x56809e['push'](_0x56809e['shift']());}};_0x3df1fa(++_0x6d1ac2);}(_0xe706,0xa3));var _0x6e70=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0xe706[_0xb0fe92];return _0x41787f;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 788416b..cf16adb 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 _0xf966=['smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','toLowerCase','appdata','split','mail','push','slice','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','.js','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions'];(function(_0x11259a,_0x23221e){var _0x2e9148=function(_0x554f16){while(--_0x554f16){_0x11259a['push'](_0x11259a['shift']());}};_0x2e9148(++_0x23221e);}(_0xf966,0x6c));var _0x6f96=function(_0x4ae27d,_0x4cf5ae){_0x4ae27d=_0x4ae27d-0x0;var _0x42eae7=_0xf966[_0x4ae27d];return _0x42eae7;};'use strict';var _=require(_0x6f96('0x0'));var util=require(_0x6f96('0x1'));var path=require(_0x6f96('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x6f96('0x3'));var utils=require(_0x6f96('0x4'));var sUtils=require('./applications/strategy/util');var logger=require(_0x6f96('0x5'))(_0x6f96('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6f96('0x7')),'chatQueueReport':require(_0x6f96('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x6f96('0x9')),'whatsappQueueReport':require(_0x6f96('0xa'))};var RuleEngine=require(_0x6f96('0xb'));function getId(_0x4832af,_0x2a344d,_0x247c1c){return util[_0x6f96('0xc')]('%s.%s.%s',_0x4832af,_0x2a344d||0x0,_0x247c1c||0x0);}function getIntervals(_0xd8c2b0,_0x51e137){var _0xe87a04=[];if(!_[_0x6f96('0xd')](_0x51e137[_0x6f96('0xe')])&&!_[_0x6f96('0xd')](_0xd8c2b0[_0x51e137[_0x6f96('0xe')]])&&!_[_0x6f96('0xd')](_0xd8c2b0[_0x51e137[_0x6f96('0xe')]][_0x6f96('0xf')])){_0xe87a04=_[_0x6f96('0x10')](_0xd8c2b0[_0x51e137[_0x6f96('0xe')]]['Intervals'],_0x6f96('0x11'));}else if(!_['isNil'](_0x51e137[_0x6f96('0x11')])){_0xe87a04=[_0x51e137['interval']];}return _0xe87a04;}exports[_0x6f96('0x12')]=function(_0x357e18){_0x357e18[_0x6f96('0x13')]={};return new BPromise(function(_0x42583f,_0x1bcdf1){var _0x570693={'Start':function(_0x5a02a7){var _0xb5e924=this;return new Promise(function(_0x58fe22,_0x347c80){if(_0x5a02a7){try{var _0x12bacd=[];var _0x6f4b57=getId(_0x5a02a7[_0x6f96('0x14')],_0x5a02a7[_0x6f96('0x15')]?_0x5a02a7[_0x6f96('0x15')]['id']:0x0,_0x5a02a7[_0x6f96('0x16')]?_0x5a02a7[_0x6f96('0x16')]['id']:0x0);var _0xd7076c=sUtils[_0x6f96('0x17')](_0x357e18,_0x5a02a7);if(!_0xd7076c&&_0x5a02a7[_0x6f96('0x18')]&&_[_0x6f96('0x19')](_0x5a02a7[_0x6f96('0x18')])&&_0x5a02a7[_0x6f96('0x18')][_0x6f96('0x1a')]){for(var _0x32e87a=0x0;_0x32e87a<_0x5a02a7[_0x6f96('0x18')][_0x6f96('0x1a')];_0x32e87a+=0x1){var _0x451588=_0x5a02a7[_0x6f96('0x18')][_0x32e87a];if(fs[_0x6f96('0x1b')](path[_0x6f96('0x1c')](__dirname,_0x6f96('0x18'),_0x451588[_0x6f96('0x1d')]+'.js'))){var _0x5e013a=[];switch(_0x451588[_0x6f96('0x1d')][_0x6f96('0x1e')]()){case'autoreply':var _0x4facd1=_0x451588[_0x6f96('0x1f')][_0x6f96('0x20')](',');if(_0x5a02a7[_0x6f96('0x14')]===_0x6f96('0x21')){_0x5e013a[_0x6f96('0x22')](_0x4facd1[0x0]);_0x5e013a[_0x6f96('0x22')](_0x4facd1[0x1]);_0x5e013a[_0x6f96('0x22')](_0x4facd1[_0x6f96('0x23')](0x2,_0x4facd1[_0x6f96('0x1a')])['join'](','));}else{_0x5e013a[_0x6f96('0x22')](_0x4facd1[0x0]);_0x5e013a[_0x6f96('0x22')](_0x4facd1['slice'](0x1,_0x4facd1['length'])[_0x6f96('0x1c')](','));}break;case'dialogflow':var _0x235613=_0x451588[_0x6f96('0x1f')][_0x6f96('0x20')](',');_0x5e013a[_0x6f96('0x22')](_0x235613[0x0]);_0x5e013a[_0x6f96('0x22')](_0x235613[0x1]);_0x5e013a['push'](_0x235613['slice'](0x2,_0x235613['length'])[_0x6f96('0x1c')](','));break;case _0x6f96('0x24'):var _0x3e5376=_0x451588[_0x6f96('0x1f')]['split'](',');_0x5e013a[_0x6f96('0x22')](_0x3e5376[0x0]);_0x5e013a[_0x6f96('0x22')](_0x3e5376[0x1]);_0x5e013a['push'](_0x3e5376[0x2]);_0x5e013a[_0x6f96('0x22')](_0x3e5376[0x3]);_0x5e013a['push'](_0x3e5376[_0x6f96('0x23')](0x4,_0x3e5376[_0x6f96('0x1a')])[_0x6f96('0x1c')](','));break;case _0x6f96('0x25'):var _0x29223d=_0x451588[_0x6f96('0x1f')]['split'](',');_0x5e013a['push'](_0x29223d[0x0]);_0x5e013a[_0x6f96('0x22')](_0x29223d[0x1]);_0x5e013a['push'](_0x29223d[0x2]);_0x5e013a[_0x6f96('0x22')](_0x29223d[0x3]);_0x5e013a[_0x6f96('0x22')](_0x29223d[_0x6f96('0x23')](0x4,_0x29223d[_0x6f96('0x1a')])[_0x6f96('0x1c')](','));break;case'message':_0x5e013a[_0x6f96('0x22')](_0x451588[_0x6f96('0x1f')]);break;case _0x6f96('0x26'):_0x5e013a['push'](_0x451588[_0x6f96('0x27')]);_0x5e013a[_0x6f96('0x22')](_0x451588[_0x6f96('0x1f')]);break;case _0x6f96('0x28'):var _0x20d906=utils[_0x6f96('0x29')](_0x5a02a7[_0x6f96('0x2a')][_0x6f96('0x2b')],_0x5a02a7);var _0x33108=_0x451588[_0x6f96('0x1f')][_0x6f96('0x20')](',');_0x5e013a['push'](_0x33108[0x0]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x1]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x2]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x3]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x4]);_0x5e013a['push'](_0x33108[0x5]);_0x5e013a['push'](_0x33108[0x6]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x7]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x8]);_0x5e013a[_0x6f96('0x22')](_0x33108[0x9]);_0x5e013a[_0x6f96('0x22')](_0x33108[0xa]);_0x5e013a[_0x6f96('0x22')](_0x5a02a7[_0x6f96('0x16')]['id']);_0x5e013a[_0x6f96('0x22')](_0x5a02a7[_0x6f96('0x15')]['id']);_0x5e013a[_0x6f96('0x22')](_0x451588['ChatWebsiteId']);_0x5e013a['push'](_0x5a02a7[_0x6f96('0x16')][_0x6f96('0x2c')]);_0x5e013a['push'](_0x5a02a7['body'][_0x6f96('0x2d')]);_0x5e013a[_0x6f96('0x22')](_0x20d906);break;default:_0x5e013a=_[_0x6f96('0xd')](_0x451588[_0x6f96('0x1f')])?[]:_0x451588[_0x6f96('0x1f')][_0x6f96('0x20')](',');}var _0x3a9cdb={'id':util['format'](_0x6f96('0x2e'),_0x6f4b57,_0x451588['id'],_0x451588[_0x6f96('0x1d')]),'condition':require(_0x6f96('0x2f'))[_0x6f96('0x30')](_0x6f4b57,getIntervals(_0x357e18[_0x6f96('0x31')],_0x451588),_0x357e18),'consequence':require(_0x6f96('0x32')+_0x451588[_0x6f96('0x1d')])[_0x6f96('0x33')](_0x6f4b57,_0x5e013a,_0x357e18,_0x5a02a7),'p':_0x451588[_0x6f96('0x34')]||0x0};logger[_0x6f96('0x35')]('Push\x20new\x20rule',_0x3a9cdb['id'],_0x6f96('0x36'),getIntervals(_0x357e18[_0x6f96('0x31')],_0x451588)[_0x6f96('0x1c')](_0x6f96('0x37')));_0x12bacd['push'](_0x3a9cdb);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x6f96('0x1c')](__dirname,_0x6f96('0x18'),_0x451588['app']+_0x6f96('0x38')));}}_0x357e18['rules'][_0x6f4b57]=new RuleEngine(_0x12bacd);_0x357e18[_0x6f96('0x13')][_0x6f4b57]['execute'](_0x5a02a7,function(_0x598bc3){logger[_0x6f96('0x35')](_0x6f96('0x39'),JSON[_0x6f96('0x3a')](_0x598bc3[_0x6f96('0x3b')]));if(_0x357e18[_0x6f96('0x13')][_0x6f4b57]){_0x357e18[_0x6f96('0x13')][_0x6f4b57][_0x6f96('0x3c')](_0x6f96('0x3d'));}});return _0x58fe22({'code':0xc8,'message':_0x5a02a7});}else{if(_0xd7076c){logger['info'](util[_0x6f96('0xc')]('Skipped\x20routing\x20for\x20%s',_0x6f4b57));}else{logger[_0x6f96('0x35')](_0x6f96('0x3e'));}return _0x58fe22({'code':0xc8,'message':_0x5a02a7});}}catch(_0x81c2f4){logger[_0x6f96('0x3f')](_0x81c2f4[_0x6f96('0x40')]);return _0x347c80(_0xb5e924[_0x6f96('0x3f')](0x1f4,_0x81c2f4));}}return _0x347c80('routing\x20is\x20empty');});},'AcceptMessage':function(_0x52a645){var _0x487206=this;return new Promise(function(_0x10611e,_0x133637){if(_0x52a645[_0x6f96('0x41')]&&_0x52a645[_0x6f96('0x41')]['id']){if(_0x357e18['agents'][_0x52a645[_0x6f96('0x41')]['id']]){_0x357e18[_0x6f96('0x42')][_0x52a645[_0x6f96('0x41')]['id']][_0x6f96('0x43')]=![];_0x357e18[_0x6f96('0x42')][_0x52a645['agent']['id']][_0x6f96('0x44')]=undefined;}}if(_0x52a645[_0x6f96('0x15')]&&_0x52a645[_0x6f96('0x15')]['id']){try{var _0x374bb4=getId(_0x52a645[_0x6f96('0x14')],_0x52a645['message']?_0x52a645['message']['id']:0x0,_0x52a645['interaction']?_0x52a645['interaction']['id']:0x0);if(_0x357e18[_0x6f96('0x13')][_0x374bb4]){_0x357e18[_0x6f96('0x13')][_0x374bb4][_0x6f96('0x3c')](_0x6f96('0x45'));if(rpc[_0x52a645[_0x6f96('0x14')]+_0x6f96('0x46')]){rpc[_0x52a645[_0x6f96('0x14')]+'QueueReport'][_0x6f96('0x47')](_0x374bb4,{'UserId':_0x52a645[_0x6f96('0x15')][_0x6f96('0x48')]})['catch'](function(){logger['error'](_0x6f96('0x49'));});}}return _0x10611e({'code':0xc8,'message':_0x52a645});}catch(_0x1ae293){logger[_0x6f96('0x3f')](_0x1ae293[_0x6f96('0x40')]);return _0x133637(_0x487206[_0x6f96('0x3f')](0x1f4,_0x1ae293));}}logger['error'](_0x6f96('0x4a'));return _0x133637(_0x487206[_0x6f96('0x3f')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x878469){var _0x1a8d30=this;return new Promise(function(_0x499670,_0x8660af){if(_0x878469['agent']&&_0x878469[_0x6f96('0x41')]['id']){try{if(_0x357e18[_0x6f96('0x42')][_0x878469[_0x6f96('0x41')]['id']]){_0x357e18[_0x6f96('0x42')][_0x878469[_0x6f96('0x41')]['id']][_0x6f96('0x43')]=![];_0x357e18[_0x6f96('0x42')][_0x878469['agent']['id']][_0x6f96('0x44')]=undefined;}return _0x499670({'code':0xc8,'message':_0x878469});}catch(_0x531372){logger[_0x6f96('0x3f')](_0x531372[_0x6f96('0x40')]);return _0x8660af(_0x1a8d30['error'](0x1f4,_0x531372));}}logger[_0x6f96('0x3f')](_0x6f96('0x4a'));return _0x8660af(_0x1a8d30[_0x6f96('0x3f')](0x1f4,_0x6f96('0x4a')));});},'AbandonInteraction':function(_0x3b81be){var _0x5821d2=this;return new Promise(function(_0x3ffe4c,_0x4ca5ea){if(_0x3b81be[_0x6f96('0x14')]&&_0x3b81be[_0x6f96('0x16')]&&_0x3b81be[_0x6f96('0x16')]['id']){try{var _0x5f3a18=getId(_0x3b81be[_0x6f96('0x14')],_0x3b81be[_0x6f96('0x15')]?_0x3b81be[_0x6f96('0x15')]['id']:0x0,_0x3b81be[_0x6f96('0x16')]?_0x3b81be[_0x6f96('0x16')]['id']:0x0);if(_0x357e18[_0x6f96('0x13')][_0x5f3a18]){_0x357e18['rules'][_0x5f3a18]['emit'](_0x6f96('0x45'));}return _0x3ffe4c({'code':0xc8,'message':_0x3b81be});}catch(_0x2f226f){logger[_0x6f96('0x3f')](_0x2f226f[_0x6f96('0x40')]);return _0x4ca5ea(_0x5821d2['error'](0x1f4,_0x2f226f));}}logger[_0x6f96('0x3f')](_0x6f96('0x4a'));return _0x4ca5ea(_0x5821d2['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x16f08d){var _0x318592=this;return new Promise(function(_0x12d1f1,_0x2d78de){if(_0x357e18[_0x6f96('0x42')][_0x6f96('0x4b')](_0x16f08d['id'])){for(var _0x5c588f in _0x16f08d[_0x6f96('0x4c')]){if(_0x16f08d[_0x6f96('0x4c')]['hasOwnProperty'](_0x5c588f)){if(_0x357e18[_0x6f96('0x42')][_0x16f08d['id']][_0x6f96('0x4b')](_0x5c588f+_0x6f96('0x4d'))){_0x357e18[_0x6f96('0x42')][_0x16f08d['id']][_0x5c588f+'CurrentCapacity']=parseInt(_0x16f08d[_0x6f96('0x4c')][_0x5c588f],0xa);}}}_0x357e18[_0x6f96('0x42')][_0x16f08d['id']][_0x6f96('0x4e')]();return _0x12d1f1({'code':0xc8,'message':_0x357e18['agents'][_0x16f08d['id']]});}else{return _0x2d78de(_0x318592[_0x6f96('0x3f')](0x1f4,_0x6f96('0x4f')));}});},'Agents':function(_0x16a3f3){return new Promise(function(_0x394a85){var _0x8c5df4=_[_0x6f96('0x50')](_0x357e18[_0x6f96('0x42')]);if(_0x16a3f3&&_0x16a3f3['id']){var _0xa8353a=_['find'](_0x8c5df4,function(_0x470f04){return _0x470f04['id']===_0x16a3f3['id'];});_0x394a85(_0xa8353a);}else{_0x394a85({'count':_0x8c5df4[_0x6f96('0x1a')],'rows':_0x8c5df4});}});},'ChatQueues':function(){return new Promise(function(_0x4b0e9b){var _0x597597=[];for(var _0x2b0890 in _0x357e18[_0x6f96('0x51')]){if(_0x357e18[_0x6f96('0x51')][_0x6f96('0x4b')](_0x2b0890)){var _0x254f30=_0x357e18['chatQueues'][_0x2b0890];var _0x403335={'id':_0x254f30['id'],'available':_0x254f30[_0x6f96('0x52')],'loggedIn':_0x254f30[_0x6f96('0x53')],'name':_0x254f30[_0x6f96('0x54')],'paused':_0x254f30['paused'],'waiting':_0x254f30[_0x6f96('0x55')]};_0x597597[_0x6f96('0x22')](_0x403335);}}_0x4b0e9b({'count':_0x597597[_0x6f96('0x1a')],'rows':_0x597597});});},'MailQueues':function(){return new Promise(function(_0x3f3dff){var _0x29c57c=[];for(var _0x20a203 in _0x357e18['mailQueues']){if(_0x357e18[_0x6f96('0x56')][_0x6f96('0x4b')](_0x20a203)){var _0x5071f3=_0x357e18[_0x6f96('0x56')][_0x20a203];var _0x5178f1={'id':_0x5071f3['id'],'available':_0x5071f3[_0x6f96('0x52')],'loggedIn':_0x5071f3['loggedIn'],'name':_0x5071f3[_0x6f96('0x54')],'paused':_0x5071f3[_0x6f96('0x57')],'waiting':_0x5071f3[_0x6f96('0x55')]};_0x29c57c[_0x6f96('0x22')](_0x5178f1);}}_0x3f3dff({'count':_0x29c57c['length'],'rows':_0x29c57c});});},'OpenchannelQueues':function(){return new Promise(function(_0x1f4f9c){var _0x4719bd=[];for(var _0x1b5bb7 in _0x357e18[_0x6f96('0x58')]){if(_0x357e18[_0x6f96('0x58')][_0x6f96('0x4b')](_0x1b5bb7)){var _0x4a5c91=_0x357e18['openchannelQueues'][_0x1b5bb7];var _0x1da454={'id':_0x4a5c91['id'],'available':_0x4a5c91[_0x6f96('0x52')],'loggedIn':_0x4a5c91[_0x6f96('0x53')],'name':_0x4a5c91[_0x6f96('0x54')],'paused':_0x4a5c91['paused'],'waiting':_0x4a5c91[_0x6f96('0x55')]};_0x4719bd[_0x6f96('0x22')](_0x1da454);}}_0x1f4f9c({'count':_0x4719bd[_0x6f96('0x1a')],'rows':_0x4719bd});});},'SmsQueues':function(){return new Promise(function(_0x5dc979){var _0x33d51f=[];for(var _0x33a06f in _0x357e18['smsQueues']){if(_0x357e18[_0x6f96('0x59')]['hasOwnProperty'](_0x33a06f)){var _0xdc966=_0x357e18[_0x6f96('0x59')][_0x33a06f];var _0x567f1e={'id':_0xdc966['id'],'available':_0xdc966[_0x6f96('0x52')],'loggedIn':_0xdc966['loggedIn'],'name':_0xdc966[_0x6f96('0x54')],'paused':_0xdc966['paused'],'waiting':_0xdc966['waiting']};_0x33d51f['push'](_0x567f1e);}}_0x5dc979({'count':_0x33d51f[_0x6f96('0x1a')],'rows':_0x33d51f});});},'FaxQueues':function(){return new Promise(function(_0xdae9fd){var _0xdebc04=[];for(var _0x4ea81a in _0x357e18[_0x6f96('0x5a')]){if(_0x357e18[_0x6f96('0x5a')][_0x6f96('0x4b')](_0x4ea81a)){var _0x419c43=_0x357e18[_0x6f96('0x5a')][_0x4ea81a];var _0x32ff05={'id':_0x419c43['id'],'available':_0x419c43[_0x6f96('0x52')],'loggedIn':_0x419c43[_0x6f96('0x53')],'name':_0x419c43[_0x6f96('0x54')],'paused':_0x419c43['paused'],'waiting':_0x419c43[_0x6f96('0x55')]};_0xdebc04['push'](_0x32ff05);}}_0xdae9fd({'count':_0xdebc04['length'],'rows':_0xdebc04});});},'WhatsappQueues':function(){return new Promise(function(_0x5133ce){var _0x383f1f=[];for(var _0x51066c in _0x357e18[_0x6f96('0x5b')]){if(_0x357e18['whatsappQueues'][_0x6f96('0x4b')](_0x51066c)){var _0x4b75b1=_0x357e18['whatsappQueues'][_0x51066c];var _0x1dda41={'id':_0x4b75b1['id'],'available':_0x4b75b1['available'],'loggedIn':_0x4b75b1[_0x6f96('0x53')],'name':_0x4b75b1['name'],'paused':_0x4b75b1[_0x6f96('0x57')],'waiting':_0x4b75b1[_0x6f96('0x55')]};_0x383f1f[_0x6f96('0x22')](_0x1dda41);}}_0x5133ce({'count':_0x383f1f[_0x6f96('0x1a')],'rows':_0x383f1f});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x5e1deb){var _0x2cfe36=_[_0x6f96('0x50')](_0x357e18[_0x6f96('0x5c')]);_0x5e1deb({'count':_0x2cfe36[_0x6f96('0x1a')],'rows':_0x2cfe36});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x25146c){var _0x4f0023=_[_0x6f96('0x50')](_0x357e18['mailQueuesWaitingInteractions']);_0x25146c({'count':_0x4f0023['length'],'rows':_0x4f0023});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x571008){var _0x5777f4=_[_0x6f96('0x50')](_0x357e18[_0x6f96('0x5d')]);_0x571008({'count':_0x5777f4[_0x6f96('0x1a')],'rows':_0x5777f4});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x130cfc){var _0x66f441=_['values'](_0x357e18[_0x6f96('0x5e')]);_0x130cfc({'count':_0x66f441[_0x6f96('0x1a')],'rows':_0x66f441});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1c884a){var _0x5882ca=_[_0x6f96('0x50')](_0x357e18['faxQueuesWaitingInteractions']);_0x1c884a({'count':_0x5882ca[_0x6f96('0x1a')],'rows':_0x5882ca});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x19b97a){var _0x4fa3af=_[_0x6f96('0x50')](_0x357e18[_0x6f96('0x5f')]);_0x19b97a({'count':_0x4fa3af[_0x6f96('0x1a')],'rows':_0x4fa3af});});}};var _0x10200b=jayson[_0x6f96('0x60')](_0x570693)[_0x6f96('0x61')]();_0x10200b['on'](_0x6f96('0x3f'),function(_0x1a43ca){logger[_0x6f96('0x3f')](JSON[_0x6f96('0x3a')](_0x1a43ca));return _0x1bcdf1(_0x1a43ca);});_0x10200b['listen'](0x232c,_0x6f96('0x62'),function(){console['log'](_0x6f96('0x63'),0x232c);return _0x42583f(_0x6f96('0x64')+0x232c);});});}; \ No newline at end of file +var _0xe3e6=['agents','busyQueue','end','QueueReport','catch','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','name','paused','waiting','mailQueues','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','mail','push','slice','dialogflowv2','amazonlex','split','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','consequence','priority','info','Push\x20new\x20rule','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent'];(function(_0x122eac,_0x192e03){var _0x19e458=function(_0x236d08){while(--_0x236d08){_0x122eac['push'](_0x122eac['shift']());}};_0x19e458(++_0x192e03);}(_0xe3e6,0x80));var _0x6e3e=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xe3e6[_0x295314];return _0x584b0c;};'use strict';var _=require(_0x6e3e('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x6e3e('0x1'));var BPromise=require(_0x6e3e('0x2'));var utils=require(_0x6e3e('0x3'));var sUtils=require('./applications/strategy/util');var logger=require(_0x6e3e('0x4'))(_0x6e3e('0x5'));var rpc={'openchannelQueueReport':require(_0x6e3e('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x6e3e('0x7')),'smsQueueReport':require(_0x6e3e('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x6e3e('0x9'))};var RuleEngine=require(_0x6e3e('0xa'));function getId(_0x3cf17b,_0x492464,_0x26e7f0){return util[_0x6e3e('0xb')](_0x6e3e('0xc'),_0x3cf17b,_0x492464||0x0,_0x26e7f0||0x0);}function getIntervals(_0x2c0477,_0x3a0a10){var _0x3d9a0b=[];if(!_[_0x6e3e('0xd')](_0x3a0a10[_0x6e3e('0xe')])&&!_['isNil'](_0x2c0477[_0x3a0a10['IntervalId']])&&!_[_0x6e3e('0xd')](_0x2c0477[_0x3a0a10['IntervalId']]['Intervals'])){_0x3d9a0b=_[_0x6e3e('0xf')](_0x2c0477[_0x3a0a10[_0x6e3e('0xe')]]['Intervals'],'interval');}else if(!_[_0x6e3e('0xd')](_0x3a0a10[_0x6e3e('0x10')])){_0x3d9a0b=[_0x3a0a10['interval']];}return _0x3d9a0b;}exports[_0x6e3e('0x11')]=function(_0x9d5431){_0x9d5431[_0x6e3e('0x12')]={};return new BPromise(function(_0x2ff4aa,_0x547636){var _0xf369d5={'Start':function(_0x45c947){var _0x44e959=this;return new Promise(function(_0x28e4de,_0x267b8c){if(_0x45c947){try{var _0x5131c7=[];var _0x538f68=getId(_0x45c947[_0x6e3e('0x13')],_0x45c947[_0x6e3e('0x14')]?_0x45c947['message']['id']:0x0,_0x45c947['interaction']?_0x45c947[_0x6e3e('0x15')]['id']:0x0);var _0x2e6306=sUtils[_0x6e3e('0x16')](_0x9d5431,_0x45c947);if(!_0x2e6306&&_0x45c947[_0x6e3e('0x17')]&&_[_0x6e3e('0x18')](_0x45c947[_0x6e3e('0x17')])&&_0x45c947[_0x6e3e('0x17')][_0x6e3e('0x19')]){for(var _0x2abfaa=0x0;_0x2abfaa<_0x45c947[_0x6e3e('0x17')][_0x6e3e('0x19')];_0x2abfaa+=0x1){var _0x38cdaf=_0x45c947[_0x6e3e('0x17')][_0x2abfaa];if(fs[_0x6e3e('0x1a')](path[_0x6e3e('0x1b')](__dirname,_0x6e3e('0x17'),_0x38cdaf[_0x6e3e('0x1c')]+_0x6e3e('0x1d')))){var _0xfd60b8=[];switch(_0x38cdaf['app'][_0x6e3e('0x1e')]()){case'autoreply':var _0x1cb983=_0x38cdaf[_0x6e3e('0x1f')]['split'](',');if(_0x45c947['channel']===_0x6e3e('0x20')){_0xfd60b8[_0x6e3e('0x21')](_0x1cb983[0x0]);_0xfd60b8[_0x6e3e('0x21')](_0x1cb983[0x1]);_0xfd60b8['push'](_0x1cb983['slice'](0x2,_0x1cb983[_0x6e3e('0x19')])[_0x6e3e('0x1b')](','));}else{_0xfd60b8['push'](_0x1cb983[0x0]);_0xfd60b8['push'](_0x1cb983[_0x6e3e('0x22')](0x1,_0x1cb983[_0x6e3e('0x19')])[_0x6e3e('0x1b')](','));}break;case'dialogflow':var _0x24aaef=_0x38cdaf[_0x6e3e('0x1f')]['split'](',');_0xfd60b8[_0x6e3e('0x21')](_0x24aaef[0x0]);_0xfd60b8[_0x6e3e('0x21')](_0x24aaef[0x1]);_0xfd60b8[_0x6e3e('0x21')](_0x24aaef[_0x6e3e('0x22')](0x2,_0x24aaef['length'])[_0x6e3e('0x1b')](','));break;case _0x6e3e('0x23'):var _0x25843a=_0x38cdaf[_0x6e3e('0x1f')]['split'](',');_0xfd60b8['push'](_0x25843a[0x0]);_0xfd60b8[_0x6e3e('0x21')](_0x25843a[0x1]);_0xfd60b8['push'](_0x25843a[0x2]);_0xfd60b8['push'](_0x25843a[0x3]);_0xfd60b8[_0x6e3e('0x21')](_0x25843a[_0x6e3e('0x22')](0x4,_0x25843a[_0x6e3e('0x19')])[_0x6e3e('0x1b')](','));break;case _0x6e3e('0x24'):var _0x98436e=_0x38cdaf[_0x6e3e('0x1f')][_0x6e3e('0x25')](',');_0xfd60b8[_0x6e3e('0x21')](_0x98436e[0x0]);_0xfd60b8['push'](_0x98436e[0x1]);_0xfd60b8['push'](_0x98436e[0x2]);_0xfd60b8['push'](_0x98436e[0x3]);_0xfd60b8[_0x6e3e('0x21')](_0x98436e['slice'](0x4,_0x98436e[_0x6e3e('0x19')])[_0x6e3e('0x1b')](','));break;case _0x6e3e('0x14'):_0xfd60b8[_0x6e3e('0x21')](_0x38cdaf[_0x6e3e('0x1f')]);break;case _0x6e3e('0x26'):_0xfd60b8[_0x6e3e('0x21')](_0x38cdaf[_0x6e3e('0x27')]);_0xfd60b8['push'](_0x38cdaf['appdata']);break;case _0x6e3e('0x28'):var _0x21f385=utils[_0x6e3e('0x29')](_0x45c947[_0x6e3e('0x2a')][_0x6e3e('0x2b')],_0x45c947);var _0x254f56=_0x38cdaf['appdata'][_0x6e3e('0x25')](',');_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x0]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x1]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x2]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x3]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x4]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x5]);_0xfd60b8['push'](_0x254f56[0x6]);_0xfd60b8['push'](_0x254f56[0x7]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x8]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0x9]);_0xfd60b8[_0x6e3e('0x21')](_0x254f56[0xa]);_0xfd60b8['push'](_0x45c947['interaction']['id']);_0xfd60b8[_0x6e3e('0x21')](_0x45c947[_0x6e3e('0x14')]['id']);_0xfd60b8[_0x6e3e('0x21')](_0x38cdaf['ChatWebsiteId']);_0xfd60b8[_0x6e3e('0x21')](_0x45c947['interaction'][_0x6e3e('0x2c')]);_0xfd60b8[_0x6e3e('0x21')](_0x45c947['body'][_0x6e3e('0x2d')]);_0xfd60b8[_0x6e3e('0x21')](_0x21f385);break;default:_0xfd60b8=_['isNil'](_0x38cdaf[_0x6e3e('0x1f')])?[]:_0x38cdaf['appdata']['split'](',');}var _0x5e4d6b={'id':util['format'](_0x6e3e('0x2e'),_0x538f68,_0x38cdaf['id'],_0x38cdaf[_0x6e3e('0x1c')]),'condition':require('./interval')['condition'](_0x538f68,getIntervals(_0x9d5431['intervals'],_0x38cdaf),_0x9d5431),'consequence':require('./applications/'+_0x38cdaf['app'])[_0x6e3e('0x2f')](_0x538f68,_0xfd60b8,_0x9d5431,_0x45c947),'p':_0x38cdaf[_0x6e3e('0x30')]||0x0};logger[_0x6e3e('0x31')](_0x6e3e('0x32'),_0x5e4d6b['id'],'on\x20interval',getIntervals(_0x9d5431[_0x6e3e('0x33')],_0x38cdaf)[_0x6e3e('0x1b')]('\x20|\x20'));_0x5131c7[_0x6e3e('0x21')](_0x5e4d6b);}else{logger[_0x6e3e('0x34')](_0x6e3e('0x35'),path[_0x6e3e('0x1b')](__dirname,_0x6e3e('0x17'),_0x38cdaf[_0x6e3e('0x1c')]+'.js'));}}_0x9d5431[_0x6e3e('0x12')][_0x538f68]=new RuleEngine(_0x5131c7);_0x9d5431[_0x6e3e('0x12')][_0x538f68][_0x6e3e('0x36')](_0x45c947,function(_0x9eb5dd){logger[_0x6e3e('0x31')](_0x6e3e('0x37'),JSON['stringify'](_0x9eb5dd[_0x6e3e('0x38')]));if(_0x9d5431[_0x6e3e('0x12')][_0x538f68]){_0x9d5431[_0x6e3e('0x12')][_0x538f68][_0x6e3e('0x39')]('complete');}});return _0x28e4de({'code':0xc8,'message':_0x45c947});}else{if(_0x2e6306){logger['info'](util['format'](_0x6e3e('0x3a'),_0x538f68));}else{logger[_0x6e3e('0x31')](_0x6e3e('0x3b'));}return _0x28e4de({'code':0xc8,'message':_0x45c947});}}catch(_0x4f196c){logger[_0x6e3e('0x34')](_0x4f196c[_0x6e3e('0x3c')]);return _0x267b8c(_0x44e959['error'](0x1f4,_0x4f196c));}}return _0x267b8c('routing\x20is\x20empty');});},'AcceptMessage':function(_0x41b722){var _0x3992b9=this;return new Promise(function(_0x35fd7d,_0xe1e629){if(_0x41b722[_0x6e3e('0x3d')]&&_0x41b722[_0x6e3e('0x3d')]['id']){if(_0x9d5431[_0x6e3e('0x3e')][_0x41b722[_0x6e3e('0x3d')]['id']]){_0x9d5431[_0x6e3e('0x3e')][_0x41b722[_0x6e3e('0x3d')]['id']]['busy']=![];_0x9d5431['agents'][_0x41b722[_0x6e3e('0x3d')]['id']][_0x6e3e('0x3f')]=undefined;}}if(_0x41b722[_0x6e3e('0x14')]&&_0x41b722[_0x6e3e('0x14')]['id']){try{var _0x451e90=getId(_0x41b722[_0x6e3e('0x13')],_0x41b722[_0x6e3e('0x14')]?_0x41b722[_0x6e3e('0x14')]['id']:0x0,_0x41b722[_0x6e3e('0x15')]?_0x41b722[_0x6e3e('0x15')]['id']:0x0);if(_0x9d5431[_0x6e3e('0x12')][_0x451e90]){_0x9d5431[_0x6e3e('0x12')][_0x451e90][_0x6e3e('0x39')](_0x6e3e('0x40'));if(rpc[_0x41b722['channel']+_0x6e3e('0x41')]){rpc[_0x41b722[_0x6e3e('0x13')]+_0x6e3e('0x41')]['update'](_0x451e90,{'UserId':_0x41b722[_0x6e3e('0x14')]['UserId']})[_0x6e3e('0x42')](function(){logger[_0x6e3e('0x34')]('error\x20update\x20queue\x20report');});}}return _0x35fd7d({'code':0xc8,'message':_0x41b722});}catch(_0x50ccc5){logger[_0x6e3e('0x34')](_0x50ccc5['stack']);return _0xe1e629(_0x3992b9[_0x6e3e('0x34')](0x1f4,_0x50ccc5));}}logger[_0x6e3e('0x34')](_0x6e3e('0x43'));return _0xe1e629(_0x3992b9[_0x6e3e('0x34')](0x1f4,_0x6e3e('0x43')));});},'RejectMessage':function(_0x128781){var _0xe8aed2=this;return new Promise(function(_0x20a5df,_0x14f6eb){if(_0x128781[_0x6e3e('0x3d')]&&_0x128781[_0x6e3e('0x3d')]['id']){try{if(_0x9d5431['agents'][_0x128781['agent']['id']]){_0x9d5431[_0x6e3e('0x3e')][_0x128781[_0x6e3e('0x3d')]['id']][_0x6e3e('0x44')]=![];_0x9d5431[_0x6e3e('0x3e')][_0x128781[_0x6e3e('0x3d')]['id']]['busyQueue']=undefined;}return _0x20a5df({'code':0xc8,'message':_0x128781});}catch(_0x381b41){logger[_0x6e3e('0x34')](_0x381b41[_0x6e3e('0x3c')]);return _0x14f6eb(_0xe8aed2[_0x6e3e('0x34')](0x1f4,_0x381b41));}}logger['error'](_0x6e3e('0x43'));return _0x14f6eb(_0xe8aed2['error'](0x1f4,_0x6e3e('0x43')));});},'AbandonInteraction':function(_0x13275a){var _0x4721f1=this;return new Promise(function(_0xbcdc6e,_0x57966b){if(_0x13275a[_0x6e3e('0x13')]&&_0x13275a[_0x6e3e('0x15')]&&_0x13275a[_0x6e3e('0x15')]['id']){try{var _0x23ec15=getId(_0x13275a[_0x6e3e('0x13')],_0x13275a['message']?_0x13275a['message']['id']:0x0,_0x13275a[_0x6e3e('0x15')]?_0x13275a['interaction']['id']:0x0);if(_0x9d5431[_0x6e3e('0x12')][_0x23ec15]){_0x9d5431['rules'][_0x23ec15][_0x6e3e('0x39')](_0x6e3e('0x40'));}return _0xbcdc6e({'code':0xc8,'message':_0x13275a});}catch(_0x56f86f){logger['error'](_0x56f86f['stack']);return _0x57966b(_0x4721f1['error'](0x1f4,_0x56f86f));}}logger[_0x6e3e('0x34')](_0x6e3e('0x43'));return _0x57966b(_0x4721f1[_0x6e3e('0x34')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x1c9496){var _0x3c8a57=this;return new Promise(function(_0x42daf1,_0x239ed8){if(_0x9d5431[_0x6e3e('0x3e')]['hasOwnProperty'](_0x1c9496['id'])){for(var _0x2a8986 in _0x1c9496[_0x6e3e('0x45')]){if(_0x1c9496[_0x6e3e('0x45')]['hasOwnProperty'](_0x2a8986)){if(_0x9d5431[_0x6e3e('0x3e')][_0x1c9496['id']][_0x6e3e('0x46')](_0x2a8986+_0x6e3e('0x47'))){_0x9d5431['agents'][_0x1c9496['id']][_0x2a8986+_0x6e3e('0x47')]=parseInt(_0x1c9496['capacity'][_0x2a8986],0xa);}}}_0x9d5431[_0x6e3e('0x3e')][_0x1c9496['id']][_0x6e3e('0x48')]();return _0x42daf1({'code':0xc8,'message':_0x9d5431[_0x6e3e('0x3e')][_0x1c9496['id']]});}else{return _0x239ed8(_0x3c8a57[_0x6e3e('0x34')](0x1f4,_0x6e3e('0x49')));}});},'Agents':function(_0x1bacac){return new Promise(function(_0x1528a9){var _0x1ef9df=_['values'](_0x9d5431['agents']);if(_0x1bacac&&_0x1bacac['id']){var _0x5868c3=_['find'](_0x1ef9df,function(_0x24716d){return _0x24716d['id']===_0x1bacac['id'];});_0x1528a9(_0x5868c3);}else{_0x1528a9({'count':_0x1ef9df[_0x6e3e('0x19')],'rows':_0x1ef9df});}});},'ChatQueues':function(){return new Promise(function(_0x56dc45){var _0x787f6a=[];for(var _0x58a402 in _0x9d5431['chatQueues']){if(_0x9d5431[_0x6e3e('0x4a')][_0x6e3e('0x46')](_0x58a402)){var _0x11cdfb=_0x9d5431[_0x6e3e('0x4a')][_0x58a402];var _0x5edeac={'id':_0x11cdfb['id'],'available':_0x11cdfb[_0x6e3e('0x4b')],'loggedIn':_0x11cdfb['loggedIn'],'name':_0x11cdfb[_0x6e3e('0x4c')],'paused':_0x11cdfb[_0x6e3e('0x4d')],'waiting':_0x11cdfb[_0x6e3e('0x4e')]};_0x787f6a['push'](_0x5edeac);}}_0x56dc45({'count':_0x787f6a[_0x6e3e('0x19')],'rows':_0x787f6a});});},'MailQueues':function(){return new Promise(function(_0x2a8435){var _0x2aba3d=[];for(var _0x1f4724 in _0x9d5431[_0x6e3e('0x4f')]){if(_0x9d5431[_0x6e3e('0x4f')][_0x6e3e('0x46')](_0x1f4724)){var _0x3d3487=_0x9d5431[_0x6e3e('0x4f')][_0x1f4724];var _0x3e407f={'id':_0x3d3487['id'],'available':_0x3d3487['available'],'loggedIn':_0x3d3487['loggedIn'],'name':_0x3d3487['name'],'paused':_0x3d3487[_0x6e3e('0x4d')],'waiting':_0x3d3487[_0x6e3e('0x4e')]};_0x2aba3d[_0x6e3e('0x21')](_0x3e407f);}}_0x2a8435({'count':_0x2aba3d[_0x6e3e('0x19')],'rows':_0x2aba3d});});},'OpenchannelQueues':function(){return new Promise(function(_0x2e5141){var _0x2de622=[];for(var _0x2a4efb in _0x9d5431[_0x6e3e('0x50')]){if(_0x9d5431[_0x6e3e('0x50')][_0x6e3e('0x46')](_0x2a4efb)){var _0x353bf0=_0x9d5431['openchannelQueues'][_0x2a4efb];var _0x2c7ebe={'id':_0x353bf0['id'],'available':_0x353bf0[_0x6e3e('0x4b')],'loggedIn':_0x353bf0[_0x6e3e('0x51')],'name':_0x353bf0[_0x6e3e('0x4c')],'paused':_0x353bf0[_0x6e3e('0x4d')],'waiting':_0x353bf0[_0x6e3e('0x4e')]};_0x2de622[_0x6e3e('0x21')](_0x2c7ebe);}}_0x2e5141({'count':_0x2de622[_0x6e3e('0x19')],'rows':_0x2de622});});},'SmsQueues':function(){return new Promise(function(_0x23d3eb){var _0x2a185c=[];for(var _0x53c38e in _0x9d5431[_0x6e3e('0x52')]){if(_0x9d5431['smsQueues'][_0x6e3e('0x46')](_0x53c38e)){var _0x10da5a=_0x9d5431[_0x6e3e('0x52')][_0x53c38e];var _0x167f55={'id':_0x10da5a['id'],'available':_0x10da5a[_0x6e3e('0x4b')],'loggedIn':_0x10da5a['loggedIn'],'name':_0x10da5a['name'],'paused':_0x10da5a['paused'],'waiting':_0x10da5a[_0x6e3e('0x4e')]};_0x2a185c[_0x6e3e('0x21')](_0x167f55);}}_0x23d3eb({'count':_0x2a185c[_0x6e3e('0x19')],'rows':_0x2a185c});});},'FaxQueues':function(){return new Promise(function(_0x528e0e){var _0x70d2cc=[];for(var _0x45bcd8 in _0x9d5431[_0x6e3e('0x53')]){if(_0x9d5431[_0x6e3e('0x53')][_0x6e3e('0x46')](_0x45bcd8)){var _0x5d0143=_0x9d5431[_0x6e3e('0x53')][_0x45bcd8];var _0x3ccaab={'id':_0x5d0143['id'],'available':_0x5d0143[_0x6e3e('0x4b')],'loggedIn':_0x5d0143[_0x6e3e('0x51')],'name':_0x5d0143[_0x6e3e('0x4c')],'paused':_0x5d0143[_0x6e3e('0x4d')],'waiting':_0x5d0143[_0x6e3e('0x4e')]};_0x70d2cc[_0x6e3e('0x21')](_0x3ccaab);}}_0x528e0e({'count':_0x70d2cc['length'],'rows':_0x70d2cc});});},'WhatsappQueues':function(){return new Promise(function(_0x1a5f0c){var _0x54a8f8=[];for(var _0x245fdd in _0x9d5431[_0x6e3e('0x54')]){if(_0x9d5431[_0x6e3e('0x54')][_0x6e3e('0x46')](_0x245fdd)){var _0x30b20c=_0x9d5431['whatsappQueues'][_0x245fdd];var _0xbee09={'id':_0x30b20c['id'],'available':_0x30b20c[_0x6e3e('0x4b')],'loggedIn':_0x30b20c[_0x6e3e('0x51')],'name':_0x30b20c[_0x6e3e('0x4c')],'paused':_0x30b20c[_0x6e3e('0x4d')],'waiting':_0x30b20c[_0x6e3e('0x4e')]};_0x54a8f8[_0x6e3e('0x21')](_0xbee09);}}_0x1a5f0c({'count':_0x54a8f8[_0x6e3e('0x19')],'rows':_0x54a8f8});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x8b8129){var _0x799d67=_[_0x6e3e('0x55')](_0x9d5431[_0x6e3e('0x56')]);_0x8b8129({'count':_0x799d67['length'],'rows':_0x799d67});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2a8aed){var _0x3653b5=_['values'](_0x9d5431[_0x6e3e('0x57')]);_0x2a8aed({'count':_0x3653b5[_0x6e3e('0x19')],'rows':_0x3653b5});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x47073a){var _0x5914e4=_[_0x6e3e('0x55')](_0x9d5431[_0x6e3e('0x58')]);_0x47073a({'count':_0x5914e4[_0x6e3e('0x19')],'rows':_0x5914e4});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xcc87bb){var _0x1fdf48=_[_0x6e3e('0x55')](_0x9d5431[_0x6e3e('0x59')]);_0xcc87bb({'count':_0x1fdf48['length'],'rows':_0x1fdf48});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5f0683){var _0x25bd67=_[_0x6e3e('0x55')](_0x9d5431['faxQueuesWaitingInteractions']);_0x5f0683({'count':_0x25bd67[_0x6e3e('0x19')],'rows':_0x25bd67});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2756cb){var _0x18e832=_[_0x6e3e('0x55')](_0x9d5431[_0x6e3e('0x5a')]);_0x2756cb({'count':_0x18e832['length'],'rows':_0x18e832});});}};var _0xeaa441=jayson[_0x6e3e('0x5b')](_0xf369d5)[_0x6e3e('0x5c')]();_0xeaa441['on'](_0x6e3e('0x34'),function(_0x337af7){logger[_0x6e3e('0x34')](JSON['stringify'](_0x337af7));return _0x547636(_0x337af7);});_0xeaa441[_0x6e3e('0x11')](0x232c,'127.0.0.1',function(){console[_0x6e3e('0x5d')](_0x6e3e('0x5e'),0x232c);return _0x2ff4aa('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index f04bb0b..4cd8d1e 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 _0x71a9=['lodash','../../../utils/iftime','iftime','../../../config/logger','routing','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71a9,0x150));var _0x971a=function(_0x4418c7,_0x618c1a){_0x4418c7=_0x4418c7-0x0;var _0x4d8504=_0x71a9[_0x4418c7];return _0x4d8504;};'use strict';var _=require(_0x971a('0x0'));var iftime=require(_0x971a('0x1'))[_0x971a('0x2')];var logger=require(_0x971a('0x3'))(_0x971a('0x4'));exports['condition']=function(_0x57f1c7,_0x1ff0ee,_0x295b20){return function(_0x3b86a7){if(_0x295b20[_0x971a('0x5')]&&!_0x295b20['rules'][_0x57f1c7]){logger[_0x971a('0x6')](_0x971a('0x7'),_0x57f1c7);return _0x3b86a7[_0x971a('0x8')]();}var _0x21af72=_0x1ff0ee[_0x971a('0x9')](function(_0x3eb30e){return iftime(_0x3eb30e);});var _0x4b69a5=_[_0x971a('0xa')](_0x21af72);if(_0x4b69a5){logger[_0x971a('0x6')](_0x971a('0xb'),_0x57f1c7,_0x1ff0ee['join'](_0x971a('0xc')),_0x4b69a5);_0x3b86a7[_0x971a('0xd')](_0x4b69a5);}else{logger[_0x971a('0x6')](_0x971a('0xe'),_0x57f1c7,_0x1ff0ee[_0x971a('0xf')](_0x971a('0xc')));_0x3b86a7['stop']();}};}; \ No newline at end of file +var _0xe5ca=['stop','lodash','../../../utils/iftime','iftime','routing','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','map','some','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0xe5ca,0x141));var _0xae5c=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xe5ca[_0x365e54];return _0x13317a;};'use strict';var _=require(_0xae5c('0x0'));var iftime=require(_0xae5c('0x1'))[_0xae5c('0x2')];var logger=require('../../../config/logger')(_0xae5c('0x3'));exports[_0xae5c('0x4')]=function(_0x2e71d2,_0x3e33bb,_0x56556a){return function(_0x22cf01){if(_0x56556a[_0xae5c('0x5')]&&!_0x56556a[_0xae5c('0x5')][_0x2e71d2]){logger[_0xae5c('0x6')](_0xae5c('0x7'),_0x2e71d2);return _0x22cf01['stop']();}var _0x5232c6=_0x3e33bb[_0xae5c('0x8')](function(_0xe034b){return iftime(_0xe034b);});var _0x369e9d=_[_0xae5c('0x9')](_0x5232c6);if(_0x369e9d){logger[_0xae5c('0x6')](_0xae5c('0xa'),_0x2e71d2,_0x3e33bb[_0xae5c('0xb')](_0xae5c('0xc')),_0x369e9d);_0x22cf01[_0xae5c('0xd')](_0x369e9d);}else{logger['info'](_0xae5c('0xe'),_0x2e71d2,_0x3e33bb[_0xae5c('0xb')](_0xae5c('0xc')));_0x22cf01[_0xae5c('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index a4b0e5e..af293d7 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 _0xe706=['then','type','agentacw','agentcomplete','acw','acwtime','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','now','called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName'];(function(_0x251202,_0x35b6d1){var _0x53b928=function(_0x9c5dde){while(--_0x9c5dde){_0x251202['push'](_0x251202['shift']());}};_0x53b928(++_0x35b6d1);}(_0xe706,0xa3));var _0x6e70=function(_0x19bf5f,_0x1ca6b9){_0x19bf5f=_0x19bf5f-0x0;var _0x237efa=_0xe706[_0x19bf5f];return _0x237efa;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var utils=require(_0x6e70('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e8446,_0x2cae77){utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x5'),_0x5e8446[_0x6e70('0x6')],_0x5e8446[_0x6e70('0x7')],_0x5e8446[_0x6e70('0x8')],_0x5e8446[_0x6e70('0x9')],_0x5e8446[_0x6e70('0xa')],_0x5e8446[_0x6e70('0xb')],_0x5e8446[_0x6e70('0xc')],_0x5e8446[_0x6e70('0xd')]));if(_0x5e8446[_0x6e70('0x8')]){utils[_0x6e70('0xe')](_0x5e8446[_0x6e70('0x8')])[_0x6e70('0xf')](function(_0x954545){if(_0x954545){_0x5e8446[_0x6e70('0x10')]=_0x954545[_0x6e70('0x10')];_0x5e8446[_0x6e70('0x11')]=_0x5e8446[_0x6e70('0x12')]?_0x954545[_0x6e70('0x13')]:![];_0x5e8446[_0x6e70('0x14')]=_0x5e8446[_0x6e70('0x11')]?_0x954545['acwTimeout']:0x0;}utils['request'](_0x6e70('0x15'),_0x5e8446);});}else{utils[_0x6e70('0x16')](_0x6e70('0x15'),_0x5e8446);}if(_0x2cae77){delete transfers[_0x5e8446[_0x6e70('0x6')]];}else{delete agents[_0x5e8446[_0x6e70('0x17')]];}}exports[_0x6e70('0x18')]=function(_0xa1eb74){try{utils[_0x6e70('0x19')](util['format']('[%s][agents][agentcalled]',_0xa1eb74['uniqueid']),_0xa1eb74);agents[_0xa1eb74[_0x6e70('0x17')]]=_0xa1eb74;agents[_0xa1eb74['destuniqueid']]['agentcalledAt']=utils[_0x6e70('0x1a')]();agents[_0xa1eb74[_0x6e70('0x17')]]['lastevent']=_0x6e70('0x1b');agents[_0xa1eb74['destuniqueid']][_0x6e70('0xc')]=null;agents[_0xa1eb74[_0x6e70('0x17')]]['connectedlinename']=null;utils['info'](util[_0x6e70('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xa1eb74[_0x6e70('0x6')],agents[_0xa1eb74[_0x6e70('0x17')]]['membername'],_0xa1eb74['destuniqueid']));}catch(_0xc238ba){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x1d'),_0xa1eb74[_0x6e70('0x6')]),_0xc238ba);}};exports[_0x6e70('0x1e')]=function(_0x1b2453){try{if(!_[_0x6e70('0x1f')](agents[_0x1b2453[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x1b2453);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x21'),_0x1b2453[_0x6e70('0x6')],agents[_0x1b2453[_0x6e70('0x17')]]['membername'],_0x1b2453[_0x6e70('0x17')]));agents[_0x1b2453['destuniqueid']]['agentringnoanswer']=!![];agents[_0x1b2453['destuniqueid']][_0x6e70('0x22')]=utils[_0x6e70('0x1a')]();agents[_0x1b2453['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x23');agents[_0x1b2453['destuniqueid']][_0x6e70('0x24')]=_0x6e70('0x23');agents[_0x1b2453[_0x6e70('0x17')]]['holdtime']=_0x1b2453['ringtime']?parseInt(_0x1b2453[_0x6e70('0x25')])/0x3e8:0x0;agents[_0x1b2453[_0x6e70('0x17')]][_0x6e70('0x26')]=0x0;unanswered[_0x6e70('0x27')](_0x1b2453[_0x6e70('0x17')]);}}catch(_0x5d772a){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x5d772a);}};exports[_0x6e70('0x28')]=function(_0x20a225){try{_[_0x6e70('0x29')](agents,function(_0x24114a,_0x3a0821){if(_0x24114a[_0x6e70('0x6')]==_0x20a225['uniqueid']&&!_[_0x6e70('0x2a')](unanswered,_0x24114a['destuniqueid'])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x2b'),_0x20a225[_0x6e70('0x6')]),_0x20a225);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x2c'),_0x20a225[_0x6e70('0x6')],_0x24114a['membername'],_0x24114a[_0x6e70('0x17')]));_0x24114a[_0x6e70('0x1e')]=!![];_0x24114a['agentringnoanswerAt']=utils[_0x6e70('0x1a')]();_0x24114a[_0x6e70('0xd')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x24')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x2e')]=_0x20a225[_0x6e70('0x2e')];_0x24114a[_0x6e70('0x26')]=0x0;writeDB(_0x24114a);}});}catch(_0xf146fd){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x2b'),_0x20a225['uniqueid']),_0xf146fd);}};exports[_0x6e70('0x2f')]=function(_0x3222a2){try{if(agents[_0x3222a2[_0x6e70('0x17')]]){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x30'),_0x3222a2[_0x6e70('0x6')]),_0x3222a2);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x31'),_0x3222a2[_0x6e70('0x6')],agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x9')],_0x3222a2['destuniqueid']));agents[_0x3222a2['destuniqueid']]['agentconnectAt']=utils[_0x6e70('0x1a')]();agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xc')]=_0x3222a2[_0x6e70('0xc')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x32')]=_0x3222a2['connectedlinename'];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xd')]=_0x6e70('0x33');_[_0x6e70('0x29')](agents,function(_0x16fc7d,_0x5be100){if(_0x16fc7d[_0x6e70('0x17')]!=_0x3222a2[_0x6e70('0x17')]&&_0x16fc7d[_0x6e70('0x6')]==_0x3222a2[_0x6e70('0x6')]){_0x16fc7d[_0x6e70('0x26')]=0x0;_0x16fc7d[_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];_0x16fc7d['agentringnoanswer']=!![];_0x16fc7d['agentringnoanswerAt']=utils['now']();_0x16fc7d[_0x6e70('0xd')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x24')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x35')]=_0x3222a2['destuniqueid'];_0x16fc7d[_0x6e70('0x36')]=_0x3222a2[_0x6e70('0x9')];writeDB(_0x16fc7d);}});}}catch(_0x2a2aca){utils['error'](util['format']('[%s][agents][agentconnect]',_0x3222a2[_0x6e70('0x6')]),_0x2a2aca);}};exports['agentcomplete']=function(_0x42f49a){try{if(!_[_0x6e70('0x1f')](agents[_0x42f49a[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x42f49a);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x38'),_0x42f49a[_0x6e70('0x6')],agents[_0x42f49a['destuniqueid']][_0x6e70('0x9')],_0x42f49a[_0x6e70('0x17')]));agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x12')]=!![];agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')]=utils[_0x6e70('0x1a')]();agents[_0x42f49a['destuniqueid']][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')],agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x3b')]);agents[_0x42f49a[_0x6e70('0x17')]]['reason']=_0x42f49a[_0x6e70('0x24')];agents[_0x42f49a['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x3c');writeDB(agents[_0x42f49a['destuniqueid']]);}}catch(_0x53efc3){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x53efc3);}};exports['blindtransfer']=function(_0x238ebb){try{if(!_[_0x6e70('0x1f')](agents[_0x238ebb[_0x6e70('0x3d')]])){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb['uniqueid']),_0x238ebb);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x3f'),_0x238ebb[_0x6e70('0x6')],agents[_0x238ebb[_0x6e70('0x3d')]]['membername'],agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')]));agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x40')]=!![];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x41')]='blind';agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x42')]=_0x238ebb[_0x6e70('0x43')];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x44')]=agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')];}}catch(_0x1dd242){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb[_0x6e70('0x6')]),_0x1dd242);}};exports['attendedtransfer']=function(_0x40e7c6){try{utils[_0x6e70('0x19')](util['format'](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x40e7c6);if(_0x40e7c6['origtransfereruniqueid']==_0x40e7c6[_0x6e70('0x47')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x48')]])){utils[_0x6e70('0x3')](util[_0x6e70('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x9')]));agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x40')]=!![];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x41')]=_0x6e70('0x49');agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x42')]=_0x40e7c6[_0x6e70('0x4a')];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x46')];}if(_0x40e7c6[_0x6e70('0x4b')]&&agents[_0x40e7c6[_0x6e70('0x4b')]]){agents[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x4b')]]=_[_0x6e70('0x4d')](agents[_0x40e7c6['transfereeuniqueid']]);transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0xb')];transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4e')]=agents[_0x40e7c6['secondtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x4b')]]['agentcalledAt']=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x3b')]=utils['now']();transfers[_0x40e7c6['transfereeuniqueid']][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x2;}}else if(_0x40e7c6[_0x6e70('0x48')]==_0x40e7c6[_0x6e70('0x4f')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x46')]])){utils['info'](util['format'](_0x6e70('0x50'),_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x9')]));agents[_0x40e7c6['origtransfereruniqueid']]['transfer']=!![];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x41')]='ATTENDED';agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x42')]=_0x40e7c6['secondtransfererexten'];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x48')];}if(_0x40e7c6[_0x6e70('0x51')]&&agents[_0x40e7c6[_0x6e70('0x51')]]){agents[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x51')]]=_['clone'](agents[_0x40e7c6[_0x6e70('0x51')]]);transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0xb')];transfers[_0x40e7c6['transfertargetuniqueid']]['calleridname']=agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x52')]=utils['now']();transfers[_0x40e7c6['transfertargetuniqueid']][_0x6e70('0x3b')]=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x2;}}}catch(_0x5eb6f0){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x5eb6f0);}};exports['hangup']=function(_0xce964b){try{utils['debug'](util['format'](_0x6e70('0x53'),_0xce964b[_0x6e70('0x6')]),_0xce964b);if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]===_0x6e70('0x23')){if(_0xce964b['cause']==='21'){agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x54');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x54');}utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')],agents[_0xce964b['uniqueid']]['lastevent']));writeDB(agents[_0xce964b[_0x6e70('0x6')]]);var _0x18ecf0=unanswered[_0x6e70('0x56')](_0xce964b[_0x6e70('0x6')]);if(_0x18ecf0>-0x1){unanswered[_0x6e70('0x57')](_0x18ecf0,0x1);}}if(transfers[_0xce964b['uniqueid']]){transfers[_0xce964b['uniqueid']][_0x6e70('0x12')]=!![];transfers[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x3b')]);transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x58');transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils['info'](util['format'](_0x6e70('0x55'),_0xce964b['uniqueid'],transfers[_0xce964b[_0x6e70('0x6')]]['membername'],transfers[_0xce964b['uniqueid']][_0x6e70('0x24')],transfers[_0xce964b['uniqueid']]['lastevent']));writeDB(transfers[_0xce964b[_0x6e70('0x6')]],!![]);}if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']){agents[_0xce964b['uniqueid']]['agentcomplete']=!![];agents[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']);agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=agents[_0xce964b[_0x6e70('0x6')]]['transfer']?_0x6e70('0x40'):_0x6e70('0x58');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]]['reason'],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]));writeDB(agents[_0xce964b['uniqueid']]);}}catch(_0x596d71){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x53'),_0xce964b['uniqueid']),_0x596d71);}}; \ No newline at end of file +var _0x3f8c=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','./utils','info','membername','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','error','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','rejected','indexOf','splice','agent'];(function(_0xc9a9dd,_0x184e67){var _0x321497=function(_0x558ea1){while(--_0x558ea1){_0xc9a9dd['push'](_0xc9a9dd['shift']());}};_0x321497(++_0x184e67);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4aa918,_0x53621f){_0x4aa918=_0x4aa918-0x0;var _0x13c549=_0x3f8c[_0x4aa918];return _0x13c549;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xc3f8('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3a1f6a,_0x2e70c4){utils[_0xc3f8('0x1')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3a1f6a['uniqueid'],_0x3a1f6a['channel'],_0x3a1f6a['queue'],_0x3a1f6a[_0xc3f8('0x2')],_0x3a1f6a[_0xc3f8('0x3')],_0x3a1f6a[_0xc3f8('0x4')],_0x3a1f6a[_0xc3f8('0x5')],_0x3a1f6a[_0xc3f8('0x6')]));if(_0x3a1f6a[_0xc3f8('0x7')]){utils['getVoiceQueueByName'](_0x3a1f6a[_0xc3f8('0x7')])[_0xc3f8('0x8')](function(_0x15cb3b){if(_0x15cb3b){_0x3a1f6a[_0xc3f8('0x9')]=_0x15cb3b[_0xc3f8('0x9')];_0x3a1f6a[_0xc3f8('0xa')]=_0x3a1f6a[_0xc3f8('0xb')]?_0x15cb3b['acw']:![];_0x3a1f6a[_0xc3f8('0xc')]=_0x3a1f6a[_0xc3f8('0xa')]?_0x15cb3b[_0xc3f8('0xd')]:0x0;}utils[_0xc3f8('0xe')]('CreateVoiceAgentReport',_0x3a1f6a);});}else{utils[_0xc3f8('0xe')](_0xc3f8('0xf'),_0x3a1f6a);}if(_0x2e70c4){delete transfers[_0x3a1f6a[_0xc3f8('0x10')]];}else{delete agents[_0x3a1f6a[_0xc3f8('0x11')]];}}exports['agentcalled']=function(_0x84f489){try{utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x14'),_0x84f489[_0xc3f8('0x10')]),_0x84f489);agents[_0x84f489[_0xc3f8('0x11')]]=_0x84f489;agents[_0x84f489[_0xc3f8('0x11')]][_0xc3f8('0x15')]=utils[_0xc3f8('0x16')]();agents[_0x84f489[_0xc3f8('0x11')]][_0xc3f8('0x6')]=_0xc3f8('0x17');agents[_0x84f489[_0xc3f8('0x11')]]['connectedlinenum']=null;agents[_0x84f489[_0xc3f8('0x11')]]['connectedlinename']=null;utils['info'](util[_0xc3f8('0x13')](_0xc3f8('0x18'),_0x84f489[_0xc3f8('0x10')],agents[_0x84f489[_0xc3f8('0x11')]]['membername'],_0x84f489[_0xc3f8('0x11')]));}catch(_0x1db809){utils['error'](util[_0xc3f8('0x13')]('[%s][agents][agentcalled]',_0x84f489[_0xc3f8('0x10')]),_0x1db809);}};exports[_0xc3f8('0x19')]=function(_0x3b2e98){try{if(!_['isNil'](agents[_0x3b2e98['destuniqueid']])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x1a'),_0x3b2e98[_0xc3f8('0x10')]),_0x3b2e98);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x1b'),_0x3b2e98[_0xc3f8('0x10')],agents[_0x3b2e98['destuniqueid']]['membername'],_0x3b2e98['destuniqueid']));agents[_0x3b2e98[_0xc3f8('0x11')]]['agentringnoanswer']=!![];agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1c')]=utils['now']();agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x6')]=_0xc3f8('0x1d');agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1e')]=_0xc3f8('0x1d');agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1f')]=_0x3b2e98[_0xc3f8('0x20')]?parseInt(_0x3b2e98[_0xc3f8('0x20')])/0x3e8:0x0;agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x21')]=0x0;unanswered[_0xc3f8('0x22')](_0x3b2e98[_0xc3f8('0x11')]);}}catch(_0x59e4dd){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x1a'),_0x3b2e98['uniqueid']),_0x59e4dd);}};exports[_0xc3f8('0x24')]=function(_0x4d39a0){try{_[_0xc3f8('0x25')](agents,function(_0x32343e,_0x47ab53){if(_0x32343e['uniqueid']==_0x4d39a0[_0xc3f8('0x10')]&&!_[_0xc3f8('0x26')](unanswered,_0x32343e[_0xc3f8('0x11')])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x27'),_0x4d39a0[_0xc3f8('0x10')]),_0x4d39a0);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x28'),_0x4d39a0['uniqueid'],_0x32343e[_0xc3f8('0x2')],_0x32343e[_0xc3f8('0x11')]));_0x32343e[_0xc3f8('0x19')]=!![];_0x32343e[_0xc3f8('0x1c')]=utils[_0xc3f8('0x16')]();_0x32343e['lastevent']='abandoned';_0x32343e[_0xc3f8('0x1e')]=_0xc3f8('0x29');_0x32343e[_0xc3f8('0x1f')]=_0x4d39a0[_0xc3f8('0x1f')];_0x32343e[_0xc3f8('0x21')]=0x0;writeDB(_0x32343e);}});}catch(_0x4e51ac){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x27'),_0x4d39a0['uniqueid']),_0x4e51ac);}};exports[_0xc3f8('0x2a')]=function(_0x11ecc2){try{if(agents[_0x11ecc2[_0xc3f8('0x11')]]){utils['debug'](util[_0xc3f8('0x13')](_0xc3f8('0x2b'),_0x11ecc2['uniqueid']),_0x11ecc2);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x2c'),_0x11ecc2[_0xc3f8('0x10')],agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2')],_0x11ecc2['destuniqueid']));agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2d')]=utils[_0xc3f8('0x16')]();agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x5')]=_0x11ecc2['connectedlinenum'];agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2e')]=_0x11ecc2[_0xc3f8('0x2e')];agents[_0x11ecc2['destuniqueid']][_0xc3f8('0x1f')]=_0x11ecc2[_0xc3f8('0x20')];agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x6')]='connect';_[_0xc3f8('0x25')](agents,function(_0x45d416,_0x2df096){if(_0x45d416[_0xc3f8('0x11')]!=_0x11ecc2['destuniqueid']&&_0x45d416[_0xc3f8('0x10')]==_0x11ecc2['uniqueid']){_0x45d416['talktime']=0x0;_0x45d416[_0xc3f8('0x1f')]=_0x11ecc2[_0xc3f8('0x20')];_0x45d416[_0xc3f8('0x19')]=!![];_0x45d416[_0xc3f8('0x1c')]=utils['now']();_0x45d416['lastevent']=_0xc3f8('0x2f');_0x45d416[_0xc3f8('0x1e')]=_0xc3f8('0x2f');_0x45d416[_0xc3f8('0x30')]=_0x11ecc2[_0xc3f8('0x11')];_0x45d416[_0xc3f8('0x31')]=_0x11ecc2[_0xc3f8('0x2')];writeDB(_0x45d416);}});}}catch(_0x45e6ea){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x2b'),_0x11ecc2['uniqueid']),_0x45e6ea);}};exports[_0xc3f8('0xb')]=function(_0x22e9b3){try{if(!_['isNil'](agents[_0x22e9b3[_0xc3f8('0x11')]])){utils[_0xc3f8('0x12')](util['format'](_0xc3f8('0x32'),_0x22e9b3[_0xc3f8('0x10')]),_0x22e9b3);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x33'),_0x22e9b3[_0xc3f8('0x10')],agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x2')],_0x22e9b3[_0xc3f8('0x11')]));agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0xb')]=!![];agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x34')]=utils[_0xc3f8('0x16')]();agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x21')]=utils[_0xc3f8('0x35')](agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x34')],agents[_0x22e9b3['destuniqueid']]['agentconnectAt']);agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x1e')]=_0x22e9b3[_0xc3f8('0x1e')];agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x6')]=_0xc3f8('0x36');writeDB(agents[_0x22e9b3[_0xc3f8('0x11')]]);}}catch(_0xe3d5c4){utils[_0xc3f8('0x23')](util['format'](_0xc3f8('0x32'),_0x22e9b3[_0xc3f8('0x10')]),_0xe3d5c4);}};exports['blindtransfer']=function(_0x1becae){try{if(!_[_0xc3f8('0x37')](agents[_0x1becae[_0xc3f8('0x38')]])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x39'),_0x1becae[_0xc3f8('0x10')]),_0x1becae);utils['info'](util[_0xc3f8('0x13')](_0xc3f8('0x3a'),_0x1becae['uniqueid'],agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x2')],agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x10')]));agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3b')]=!![];agents[_0x1becae[_0xc3f8('0x38')]]['transfertype']=_0xc3f8('0x3c');agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3d')]=_0x1becae[_0xc3f8('0x3e')];agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3f')]=agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x10')];}}catch(_0x4fc02c){utils['error'](util[_0xc3f8('0x13')](_0xc3f8('0x39'),_0x1becae['uniqueid']),_0x4fc02c);}};exports['attendedtransfer']=function(_0x773d56){try{utils['debug'](util[_0xc3f8('0x13')](_0xc3f8('0x40'),_0x773d56[_0xc3f8('0x41')]),_0x773d56);if(_0x773d56['origtransfereruniqueid']==_0x773d56[_0xc3f8('0x42')]){if(!_['isNil'](agents[_0x773d56['secondtransfereruniqueid']])){utils[_0xc3f8('0x1')](util['format'](_0xc3f8('0x43'),_0x773d56[_0xc3f8('0x41')],agents[_0x773d56[_0xc3f8('0x44')]]['membername']));agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x3b')]=!![];agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x45')]=_0xc3f8('0x46');agents[_0x773d56['secondtransfereruniqueid']]['transferexten']=_0x773d56[_0xc3f8('0x47')];agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x3f')]=_0x773d56[_0xc3f8('0x41')];}if(_0x773d56[_0xc3f8('0x48')]&&agents[_0x773d56['transfereeuniqueid']]){agents[_0x773d56[_0xc3f8('0x48')]]['agententerreason']=0x1;transfers[_0x773d56[_0xc3f8('0x48')]]=_[_0xc3f8('0x49')](agents[_0x773d56[_0xc3f8('0x48')]]);transfers[_0x773d56[_0xc3f8('0x48')]]['calleridnum']=agents[_0x773d56[_0xc3f8('0x44')]]['calleridnum'];transfers[_0x773d56['transfereeuniqueid']]['calleridname']=agents[_0x773d56['secondtransfereruniqueid']][_0xc3f8('0x4a')];transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x15')]=utils[_0xc3f8('0x16')]();transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x2d')]=utils[_0xc3f8('0x16')]();transfers[_0x773d56[_0xc3f8('0x48')]]['holdtime']=0x0;transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x4b')]=0x2;}}else if(_0x773d56[_0xc3f8('0x44')]==_0x773d56[_0xc3f8('0x4c')]){if(!_[_0xc3f8('0x37')](agents[_0x773d56['origtransfereruniqueid']])){utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x43'),_0x773d56[_0xc3f8('0x41')],agents[_0x773d56[_0xc3f8('0x41')]]['membername']));agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x3b')]=!![];agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x45')]=_0xc3f8('0x46');agents[_0x773d56[_0xc3f8('0x41')]]['transferexten']=_0x773d56[_0xc3f8('0x4d')];agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x3f')]=_0x773d56['secondtransfereruniqueid'];}if(_0x773d56[_0xc3f8('0x4e')]&&agents[_0x773d56[_0xc3f8('0x4e')]]){agents[_0x773d56['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x773d56[_0xc3f8('0x4e')]]=_[_0xc3f8('0x49')](agents[_0x773d56['transfertargetuniqueid']]);transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4')]=agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x4')];transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4a')]=agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x4a')];transfers[_0x773d56['transfertargetuniqueid']]['agentcalledAt']=utils[_0xc3f8('0x16')]();transfers[_0x773d56['transfertargetuniqueid']]['agentconnectAt']=utils['now']();transfers[_0x773d56['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4b')]=0x2;}}}catch(_0x188d39){utils[_0xc3f8('0x23')](util['format'](_0xc3f8('0x40'),_0x773d56[_0xc3f8('0x41')]),_0x188d39);}};exports['hangup']=function(_0x3b9b47){try{utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')]('[%s][agents][hangup]',_0x3b9b47[_0xc3f8('0x10')]),_0x3b9b47);if(agents[_0x3b9b47['uniqueid']]&&agents[_0x3b9b47['uniqueid']]['reason']===_0xc3f8('0x1d')){if(_0x3b9b47[_0xc3f8('0x4f')]==='21'){agents[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')]=_0xc3f8('0x50');agents[_0x3b9b47['uniqueid']][_0xc3f8('0x6')]=_0xc3f8('0x50');}utils['info'](util[_0xc3f8('0x13')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3b9b47[_0xc3f8('0x10')],agents[_0x3b9b47[_0xc3f8('0x10')]]['membername'],agents[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')],agents[_0x3b9b47[_0xc3f8('0x10')]]['lastevent']));writeDB(agents[_0x3b9b47[_0xc3f8('0x10')]]);var _0x5de19e=unanswered[_0xc3f8('0x51')](_0x3b9b47['uniqueid']);if(_0x5de19e>-0x1){unanswered[_0xc3f8('0x52')](_0x5de19e,0x1);}}if(transfers[_0x3b9b47[_0xc3f8('0x10')]]){transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0xb')]=!![];transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')]=utils[_0xc3f8('0x16')]();transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x21')]=utils['diffTime'](transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')],transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x2d')]);transfers[_0x3b9b47[_0xc3f8('0x10')]]['reason']=_0xc3f8('0x53');transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]=_0xc3f8('0x36');utils[_0xc3f8('0x1')](util['format'](_0xc3f8('0x54'),_0x3b9b47[_0xc3f8('0x10')],transfers[_0x3b9b47[_0xc3f8('0x10')]]['membername'],transfers[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')],transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]));writeDB(transfers[_0x3b9b47[_0xc3f8('0x10')]],!![]);}if(agents[_0x3b9b47['uniqueid']]&&agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x2d')]){agents[_0x3b9b47[_0xc3f8('0x10')]]['agentcomplete']=!![];agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')]=utils['now']();agents[_0x3b9b47['uniqueid']][_0xc3f8('0x21')]=utils[_0xc3f8('0x35')](agents[_0x3b9b47['uniqueid']][_0xc3f8('0x34')],agents[_0x3b9b47[_0xc3f8('0x10')]]['agentconnectAt']);agents[_0x3b9b47[_0xc3f8('0x10')]]['reason']=agents[_0x3b9b47[_0xc3f8('0x10')]]['transfer']?_0xc3f8('0x3b'):_0xc3f8('0x53');agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]=_0xc3f8('0x36');utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x54'),_0x3b9b47[_0xc3f8('0x10')],agents[_0x3b9b47['uniqueid']]['membername'],agents[_0x3b9b47[_0xc3f8('0x10')]]['reason'],agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]));writeDB(agents[_0x3b9b47[_0xc3f8('0x10')]]);}}catch(_0xfb05eb){utils['error'](util[_0xc3f8('0x13')](_0xc3f8('0x55'),_0x3b9b47[_0xc3f8('0x10')]),_0xfb05eb);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 19ac7f3..6e72b3c 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 _0x9eb9=['attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','substring','lastIndexOf','noop','execif','set','gotoif','toLowerCase','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','BUSY','info','format','uniqueid','membername','interface','calleridnum','connectedlinenum','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','channel','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','channelstate','transfer','destinationchannel','answertime','disposition','toNumber','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime'];(function(_0x33881e,_0x37ef12){var _0x2fc09f=function(_0x1522ab){while(--_0x1522ab){_0x33881e['push'](_0x33881e['shift']());}};_0x2fc09f(++_0x37ef12);}(_0x9eb9,0x1d3));var _0x99eb=function(_0x1b99dc,_0x2e894e){_0x1b99dc=_0x1b99dc-0x0;var _0x5a72e1=_0x9eb9[_0x1b99dc];return _0x5a72e1;};'use strict';var _=require(_0x99eb('0x0'));var util=require(_0x99eb('0x1'));var utils=require('./utils');var dispositions=[_0x99eb('0x2'),'FAILED',_0x99eb('0x3'),_0x99eb('0x2'),_0x99eb('0x2'),'NO\x20ANSWER','ANSWERED',_0x99eb('0x4'),_0x99eb('0x3'),_0x99eb('0x3'),_0x99eb('0x3')];var channels={};function writeDB(_0x348ffb){utils[_0x99eb('0x5')](util[_0x99eb('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x348ffb[_0x99eb('0x7')],_0x348ffb['channel'],_0x348ffb['queue'],_0x348ffb[_0x99eb('0x8')],_0x348ffb[_0x99eb('0x9')],_0x348ffb[_0x99eb('0xa')],_0x348ffb[_0x99eb('0xb')],_0x348ffb['lastevent']));if(_0x348ffb[_0x99eb('0xc')]){utils['getUserByInternal'](_0x348ffb['accountcode'])[_0x99eb('0xd')](function(_0x360dfc){if(_0x360dfc){_0x348ffb[_0x99eb('0xe')]=_0x360dfc['id'];}utils[_0x99eb('0xf')](_0x99eb('0x10'),_0x348ffb);});}else{utils[_0x99eb('0xf')](_0x99eb('0x10'),_0x348ffb);}if(channels[_0x348ffb['uniqueid']]){delete channels[_0x348ffb[_0x99eb('0x7')]];}}exports[_0x99eb('0x11')]=function(_0x29f48e){try{utils[_0x99eb('0x12')](util[_0x99eb('0x6')]('[%s][calls][newchannel]',_0x29f48e[_0x99eb('0x7')]),_0x29f48e);if(_0x29f48e[_0x99eb('0x7')]==_0x29f48e[_0x99eb('0x13')]&&_0x29f48e[_0x99eb('0x14')]!=_0x99eb('0x15')){utils[_0x99eb('0x5')](util[_0x99eb('0x6')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x29f48e[_0x99eb('0x7')],_0x29f48e[_0x99eb('0x16')],_0x29f48e[_0x99eb('0x17')]));channels[_0x29f48e[_0x99eb('0x7')]]={'uniqueid':_0x29f48e[_0x99eb('0x7')],'accountcode':_0x29f48e[_0x99eb('0xc')],'source':_0x29f48e[_0x99eb('0xa')],'destination':_0x29f48e[_0x99eb('0x17')],'destinationcontext':_0x29f48e['context'],'channel':_0x29f48e[_0x99eb('0x14')],'starttime':utils[_0x99eb('0x18')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x99eb('0x2'),'amaflags':_0x99eb('0x19')};}}catch(_0x5f6d0a){utils[_0x99eb('0x1a')](util[_0x99eb('0x6')]('[%s][calls][newchannel]',_0x29f48e[_0x99eb('0x7')]),_0x5f6d0a);}};exports[_0x99eb('0x1b')]=function(_0x100c4a){try{utils[_0x99eb('0x12')](util[_0x99eb('0x6')](_0x99eb('0x1c'),_0x100c4a['uniqueid']),_0x100c4a);if(!_['isNil'](channels[_0x100c4a[_0x99eb('0x7')]])&&_0x100c4a['channelstate']==0x6){utils[_0x99eb('0x5')](util[_0x99eb('0x6')](_0x99eb('0x1d'),_0x100c4a[_0x99eb('0x7')],_0x100c4a['context'],_0x100c4a[_0x99eb('0x14')]));if(_[_0x99eb('0x1e')](channels[_0x100c4a[_0x99eb('0x7')]][_0x99eb('0x1f')])){channels[_0x100c4a['uniqueid']][_0x99eb('0x1f')]=utils[_0x99eb('0x18')]();}}else if(!_[_0x99eb('0x1e')](channels[_0x100c4a['linkedid']])&&_0x100c4a[_0x99eb('0x20')]==0x6&&_0x100c4a[_0x99eb('0x16')]!=_0x99eb('0x21')){utils[_0x99eb('0x5')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x100c4a[_0x99eb('0x7')],_0x100c4a['linkedid'],_0x100c4a[_0x99eb('0x16')],_0x100c4a['channel']));channels[_0x100c4a[_0x99eb('0x13')]]['accountcode']=_0x100c4a['accountcode'];channels[_0x100c4a[_0x99eb('0x13')]][_0x99eb('0x22')]=_0x100c4a[_0x99eb('0x14')];if(_[_0x99eb('0x1e')](channels[_0x100c4a[_0x99eb('0x13')]][_0x99eb('0x23')])){channels[_0x100c4a[_0x99eb('0x13')]][_0x99eb('0x23')]=utils[_0x99eb('0x18')]();}channels[_0x100c4a['linkedid']][_0x99eb('0x24')]=dispositions[_[_0x99eb('0x25')](_0x100c4a[_0x99eb('0x20')])]||_0x99eb('0x26');}}catch(_0x2c65d9){utils[_0x99eb('0x1a')](util[_0x99eb('0x6')](_0x99eb('0x1c'),_0x100c4a[_0x99eb('0x7')]),_0x2c65d9);}};exports[_0x99eb('0x27')]=function(_0x1f948e){try{if(!_[_0x99eb('0x1e')](channels[_0x1f948e[_0x99eb('0x7')]])){utils[_0x99eb('0x12')](util[_0x99eb('0x6')](_0x99eb('0x28'),_0x1f948e['uniqueid']),_0x1f948e);if(_['isNil'](channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x29')])){channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x29')]=_0x1f948e[_0x99eb('0x2a')]+'\x20<'+_0x1f948e[_0x99eb('0xa')]+'>';}utils[_0x99eb('0x5')](util['format'](_0x99eb('0x2b'),_0x1f948e['uniqueid'],channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x29')],_0x1f948e[_0x99eb('0x2c')]));channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x2d')]=utils[_0x99eb('0x18')]();channels[_0x1f948e[_0x99eb('0x7')]]['duration']=utils[_0x99eb('0x2e')](channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x2d')],channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x2f')]);channels[_0x1f948e[_0x99eb('0x7')]]['billableseconds']=channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x23')]?utils[_0x99eb('0x2e')](channels[_0x1f948e[_0x99eb('0x7')]][_0x99eb('0x2d')],channels[_0x1f948e[_0x99eb('0x7')]]['answertime']):0x0;writeDB(channels[_0x1f948e[_0x99eb('0x7')]]);}}catch(_0x474548){utils['error'](util[_0x99eb('0x6')]('[%s][calls][hangup]',_0x1f948e['uniqueid']),_0x474548);}};exports[_0x99eb('0x30')]=function(_0x26dd49){try{if(!_[_0x99eb('0x1e')](channels[_0x26dd49[_0x99eb('0x31')]])){utils[_0x99eb('0x12')](util['format'](_0x99eb('0x32'),_0x26dd49[_0x99eb('0x33')]),_0x26dd49);if(channels[_0x26dd49[_0x99eb('0x31')]]['channel']==_0x26dd49[_0x99eb('0x34')]){utils[_0x99eb('0x5')](util['format'](_0x99eb('0x35'),_0x26dd49[_0x99eb('0x33')],_0x26dd49[_0x99eb('0x31')],_0x26dd49[_0x99eb('0x36')]));channels[_0x26dd49[_0x99eb('0x31')]][_0x99eb('0x22')]=_0x26dd49[_0x99eb('0x36')];channels[_0x26dd49['localtwolinkedid']][_0x99eb('0x37')]=_0x99eb('0x38');}else if(channels[_0x26dd49[_0x99eb('0x31')]]['channel']=_0x26dd49[_0x99eb('0x39')]){utils[_0x99eb('0x5')](util['format'](_0x99eb('0x35'),_0x26dd49[_0x99eb('0x33')],_0x26dd49[_0x99eb('0x31')],_0x26dd49['origtransfererchannel']));channels[_0x26dd49[_0x99eb('0x31')]]['destinationchannel']=_0x26dd49['origtransfererchannel'];channels[_0x26dd49['localtwolinkedid']][_0x99eb('0x37')]='_attended';}}}catch(_0x17e8f4){utils['error'](util[_0x99eb('0x6')](_0x99eb('0x32'),_0x26dd49[_0x99eb('0x33')]),_0x17e8f4);}};exports[_0x99eb('0x3a')]=function(_0x243e91){try{if(!_[_0x99eb('0x1e')](channels[_0x243e91[_0x99eb('0x7')]])){utils['debug'](util[_0x99eb('0x6')](_0x99eb('0x3b'),_0x243e91[_0x99eb('0x7')]),_0x243e91);channels[_0x243e91[_0x99eb('0x7')]][_0x99eb('0x3c')]=utils[_0x99eb('0x18')]();utils[_0x99eb('0x5')](util[_0x99eb('0x6')](_0x99eb('0x3d'),_0x243e91[_0x99eb('0x7')],channels[_0x243e91[_0x99eb('0x7')]][_0x99eb('0x3c')]));}}catch(_0x5d7361){utils[_0x99eb('0x1a')](util['format'](_0x99eb('0x3b'),_0x243e91[_0x99eb('0x7')]),_0x5d7361);}};exports[_0x99eb('0x3e')]=function(_0x588b3e){try{if(!_[_0x99eb('0x1e')](channels[_0x588b3e[_0x99eb('0x7')]])){utils['debug'](util[_0x99eb('0x6')](_0x99eb('0x3f'),_0x588b3e[_0x99eb('0x7')]),_0x588b3e);if(!_[_0x99eb('0x1e')](channels[_0x588b3e['uniqueid']][_0x99eb('0x3c')])){channels[_0x588b3e[_0x99eb('0x7')]][_0x99eb('0x40')]+=utils[_0x99eb('0x2e')](utils['now'](),channels[_0x588b3e[_0x99eb('0x7')]][_0x99eb('0x3c')]);utils[_0x99eb('0x5')](util[_0x99eb('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x588b3e[_0x99eb('0x7')],channels[_0x588b3e['uniqueid']][_0x99eb('0x40')]));delete channels[_0x588b3e[_0x99eb('0x7')]][_0x99eb('0x3c')];}}}catch(_0x30bb30){utils[_0x99eb('0x1a')](util[_0x99eb('0x6')]('[%s][calls][musiconholdstop]',_0x588b3e[_0x99eb('0x7')]),_0x30bb30);}};exports[_0x99eb('0x41')]=function(_0x40e0ec){try{if(!_[_0x99eb('0x1e')](channels[_0x40e0ec[_0x99eb('0x7')]])){utils['debug'](util['format']('[%s][calls][varset]',_0x40e0ec[_0x99eb('0x7')]),_0x40e0ec);if(!_['isNil'](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x43')])){utils[_0x99eb('0x5')](util[_0x99eb('0x6')](_0x99eb('0x44'),_0x40e0ec[_0x99eb('0x7')],_0x40e0ec[_0x99eb('0x45')]));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x46')]=_0x40e0ec[_0x99eb('0x45')];}if(!_['isNil'](_0x40e0ec['variable'][_0x99eb('0x47')])){utils[_0x99eb('0x5')](util[_0x99eb('0x6')](_0x99eb('0x48'),_0x40e0ec['uniqueid'],_0x40e0ec['value']));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x49')]=_0x40e0ec[_0x99eb('0x45')];channels[_0x40e0ec['uniqueid']][_0x99eb('0x29')]='\x22'+_0x40e0ec['value']+_0x99eb('0x4a')+_0x40e0ec[_0x99eb('0x45')]+'>';}if(!_['isNil'](_0x40e0ec[_0x99eb('0x42')]['xmd-callerid-preview'])||!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x4b')])){utils[_0x99eb('0x5')](util['format'](_0x99eb('0x4c'),_0x40e0ec[_0x99eb('0x7')],!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x4d')])?_0x99eb('0x4d'):_0x99eb('0x4b'),_0x40e0ec[_0x99eb('0x45')]));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x29')]=_0x40e0ec[_0x99eb('0x45')];}if(!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x4e')])||!_['isNil'](_0x40e0ec['variable'][_0x99eb('0x4f')])){utils[_0x99eb('0x5')](util[_0x99eb('0x6')](_0x99eb('0x4c'),_0x40e0ec[_0x99eb('0x7')],!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x4e')])?'xmd-queue':_0x99eb('0x4f'),_0x40e0ec[_0x99eb('0x45')]));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x50')]=_0x99eb('0x51');channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x52')]=_0x40e0ec['value'];channels[_0x40e0ec['uniqueid']]['queue']=!![];}if(!_['isNil'](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x53')])){utils['info'](util[_0x99eb('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x40e0ec[_0x99eb('0x7')],_0x40e0ec['value']));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x54')]=_0x40e0ec[_0x99eb('0x45')];}if(!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x55')])){utils['info'](util[_0x99eb('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x40e0ec[_0x99eb('0x7')],_0x40e0ec[_0x99eb('0x45')]));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x56')]=_0x40e0ec[_0x99eb('0x45')];}if(!_['isNil'](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x57')])){utils[_0x99eb('0x5')](util[_0x99eb('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x40e0ec[_0x99eb('0x7')],_0x40e0ec['value']));channels[_0x40e0ec[_0x99eb('0x7')]][_0x99eb('0x58')]=_0x40e0ec[_0x99eb('0x45')];}if(!_[_0x99eb('0x1e')](_0x40e0ec[_0x99eb('0x42')][_0x99eb('0x59')])){utils[_0x99eb('0x5')](util[_0x99eb('0x6')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x40e0ec[_0x99eb('0x7')],_0x40e0ec[_0x99eb('0x45')]));channels[_0x40e0ec[_0x99eb('0x7')]]['sipcallid']=_0x40e0ec['value'];}}}catch(_0x28131c){utils['error'](util[_0x99eb('0x6')](_0x99eb('0x5a'),_0x40e0ec['uniqueid']),_0x28131c);}};exports['newexten']=function(_0x3de104){try{if(!_[_0x99eb('0x1e')](channels[_0x3de104[_0x99eb('0x7')]])){utils[_0x99eb('0x12')](util[_0x99eb('0x6')]('[%s][calls][newexten]',_0x3de104[_0x99eb('0x7')]),_0x3de104);utils[_0x99eb('0x5')](util['format'](_0x99eb('0x5b'),_0x3de104[_0x99eb('0x7')],_0x3de104[_0x99eb('0x5c')],_0x3de104[_0x99eb('0x5d')]));if(_0x3de104['application']['toLowerCase']()=='set'&&_[_0x99eb('0x5e')](_0x3de104[_0x99eb('0x5d')]['toLowerCase'](),'cdr')){var _0x54f017=_0x3de104[_0x99eb('0x5d')]['split']('=');var _0x527b04=_0x54f017[0x0][_0x99eb('0x5f')](_0x54f017[0x0][_0x99eb('0x60')]('(')+0x1,_0x54f017[0x0][_0x99eb('0x60')](')'));var _0x4dd52b=_0x54f017[0x1];channels[_0x3de104[_0x99eb('0x7')]][_0x527b04]=_0x4dd52b;}if(!_['includes']([_0x99eb('0x27'),_0x99eb('0x61'),_0x99eb('0x62'),_0x99eb('0x63'),_0x99eb('0x64')],_0x3de104[_0x99eb('0x5c')][_0x99eb('0x65')]())){channels[_0x3de104[_0x99eb('0x7')]][_0x99eb('0x50')]=_0x3de104[_0x99eb('0x5c')];channels[_0x3de104[_0x99eb('0x7')]][_0x99eb('0x52')]=_0x3de104[_0x99eb('0x5d')];}}}catch(_0x236565){utils[_0x99eb('0x1a')](util[_0x99eb('0x6')](_0x99eb('0x66'),_0x3de104[_0x99eb('0x7')]),_0x236565);}}; \ No newline at end of file +var _0x14e1=['execif','set','gotoif','lastapplication','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','calleridnum','connectedlinenum','then','UserId','request','CreateVoiceCallReport','newchannel','debug','format','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','destinationchannel','channel','answertime','toNumber','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','callerid','xmcs-queue','xmd-queue','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','hangup'];(function(_0x2f7a9b,_0x2a102d){var _0x2cc3ae=function(_0x2e384a){while(--_0x2e384a){_0x2f7a9b['push'](_0x2f7a9b['shift']());}};_0x2cc3ae(++_0x2a102d);}(_0x14e1,0xd0));var _0x114e=function(_0x4eb4ca,_0x46c303){_0x4eb4ca=_0x4eb4ca-0x0;var _0x1d3367=_0x14e1[_0x4eb4ca];return _0x1d3367;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x114e('0x0'));var dispositions=[_0x114e('0x1'),_0x114e('0x2'),_0x114e('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0x114e('0x1'),_0x114e('0x3'),'BUSY',_0x114e('0x2'),'FAILED',_0x114e('0x2')];var channels={};function writeDB(_0x97da60){utils[_0x114e('0x4')](util['format'](_0x114e('0x5'),_0x97da60[_0x114e('0x6')],_0x97da60['channel'],_0x97da60[_0x114e('0x7')],_0x97da60['membername'],_0x97da60[_0x114e('0x8')],_0x97da60[_0x114e('0x9')],_0x97da60[_0x114e('0xa')],_0x97da60['lastevent']));if(_0x97da60['accountcode']){utils['getUserByInternal'](_0x97da60['accountcode'])[_0x114e('0xb')](function(_0x3bdb14){if(_0x3bdb14){_0x97da60[_0x114e('0xc')]=_0x3bdb14['id'];}utils[_0x114e('0xd')]('CreateVoiceCallReport',_0x97da60);});}else{utils[_0x114e('0xd')](_0x114e('0xe'),_0x97da60);}if(channels[_0x97da60['uniqueid']]){delete channels[_0x97da60[_0x114e('0x6')]];}}exports[_0x114e('0xf')]=function(_0x3327f8){try{utils[_0x114e('0x10')](util[_0x114e('0x11')]('[%s][calls][newchannel]',_0x3327f8[_0x114e('0x6')]),_0x3327f8);if(_0x3327f8['uniqueid']==_0x3327f8[_0x114e('0x12')]&&_0x3327f8['channel']!='OutgoingSpoolFailed'){utils['info'](util[_0x114e('0x11')](_0x114e('0x13'),_0x3327f8[_0x114e('0x6')],_0x3327f8[_0x114e('0x14')],_0x3327f8[_0x114e('0x15')]));channels[_0x3327f8[_0x114e('0x6')]]={'uniqueid':_0x3327f8[_0x114e('0x6')],'accountcode':_0x3327f8[_0x114e('0x16')],'source':_0x3327f8[_0x114e('0x9')],'destination':_0x3327f8[_0x114e('0x15')],'destinationcontext':_0x3327f8['context'],'channel':_0x3327f8['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x114e('0x1'),'amaflags':'DOCUMENTATION'};}}catch(_0x50bdd8){utils[_0x114e('0x17')](util['format'](_0x114e('0x18'),_0x3327f8[_0x114e('0x6')]),_0x50bdd8);}};exports[_0x114e('0x19')]=function(_0x4a51f1){try{utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x1a'),_0x4a51f1[_0x114e('0x6')]),_0x4a51f1);if(!_[_0x114e('0x1b')](channels[_0x4a51f1[_0x114e('0x6')]])&&_0x4a51f1[_0x114e('0x1c')]==0x6){utils['info'](util['format'](_0x114e('0x1d'),_0x4a51f1[_0x114e('0x6')],_0x4a51f1[_0x114e('0x14')],_0x4a51f1['channel']));if(_['isNil'](channels[_0x4a51f1[_0x114e('0x6')]][_0x114e('0x1e')])){channels[_0x4a51f1[_0x114e('0x6')]][_0x114e('0x1e')]=utils[_0x114e('0x1f')]();}}else if(!_[_0x114e('0x1b')](channels[_0x4a51f1[_0x114e('0x12')]])&&_0x4a51f1[_0x114e('0x1c')]==0x6&&_0x4a51f1[_0x114e('0x14')]!=_0x114e('0x20')){utils['info'](util[_0x114e('0x11')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4a51f1['uniqueid'],_0x4a51f1[_0x114e('0x12')],_0x4a51f1[_0x114e('0x14')],_0x4a51f1['channel']));channels[_0x4a51f1[_0x114e('0x12')]][_0x114e('0x16')]=_0x4a51f1[_0x114e('0x16')];channels[_0x4a51f1[_0x114e('0x12')]][_0x114e('0x21')]=_0x4a51f1[_0x114e('0x22')];if(_['isNil'](channels[_0x4a51f1[_0x114e('0x12')]][_0x114e('0x23')])){channels[_0x4a51f1[_0x114e('0x12')]][_0x114e('0x23')]=utils[_0x114e('0x1f')]();}channels[_0x4a51f1[_0x114e('0x12')]]['disposition']=dispositions[_[_0x114e('0x24')](_0x4a51f1[_0x114e('0x1c')])]||_0x114e('0x3');}}catch(_0x17ebe9){utils[_0x114e('0x17')](util['format'](_0x114e('0x1a'),_0x4a51f1[_0x114e('0x6')]),_0x17ebe9);}};exports['hangup']=function(_0x5253b5){try{if(!_[_0x114e('0x1b')](channels[_0x5253b5[_0x114e('0x6')]])){utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x25'),_0x5253b5[_0x114e('0x6')]),_0x5253b5);if(_[_0x114e('0x1b')](channels[_0x5253b5[_0x114e('0x6')]]['callerid'])){channels[_0x5253b5[_0x114e('0x6')]]['callerid']=_0x5253b5[_0x114e('0x26')]+'\x20<'+_0x5253b5[_0x114e('0x9')]+'>';}utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x27'),_0x5253b5[_0x114e('0x6')],channels[_0x5253b5[_0x114e('0x6')]]['callerid'],_0x5253b5[_0x114e('0x28')]));channels[_0x5253b5[_0x114e('0x6')]][_0x114e('0x29')]=utils[_0x114e('0x1f')]();channels[_0x5253b5['uniqueid']]['duration']=utils['diffTime'](channels[_0x5253b5['uniqueid']][_0x114e('0x29')],channels[_0x5253b5['uniqueid']][_0x114e('0x2a')]);channels[_0x5253b5[_0x114e('0x6')]][_0x114e('0x2b')]=channels[_0x5253b5[_0x114e('0x6')]][_0x114e('0x23')]?utils[_0x114e('0x2c')](channels[_0x5253b5[_0x114e('0x6')]]['endtime'],channels[_0x5253b5['uniqueid']][_0x114e('0x23')]):0x0;writeDB(channels[_0x5253b5['uniqueid']]);}}catch(_0x4c863e){utils['error'](util['format']('[%s][calls][hangup]',_0x5253b5['uniqueid']),_0x4c863e);}};exports[_0x114e('0x2d')]=function(_0x216601){try{if(!_[_0x114e('0x1b')](channels[_0x216601[_0x114e('0x2e')]])){utils[_0x114e('0x10')](util['format'](_0x114e('0x2f'),_0x216601[_0x114e('0x30')]),_0x216601);if(channels[_0x216601['localtwolinkedid']][_0x114e('0x22')]==_0x216601[_0x114e('0x31')]){utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x32'),_0x216601['origtransfereruniqueid'],_0x216601[_0x114e('0x2e')],_0x216601['secondtransfererchannel']));channels[_0x216601[_0x114e('0x2e')]][_0x114e('0x21')]=_0x216601['secondtransfererchannel'];channels[_0x216601[_0x114e('0x2e')]]['userfield']=_0x114e('0x33');}else if(channels[_0x216601[_0x114e('0x2e')]]['channel']=_0x216601[_0x114e('0x34')]){utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x32'),_0x216601[_0x114e('0x30')],_0x216601['localtwolinkedid'],_0x216601[_0x114e('0x35')]));channels[_0x216601[_0x114e('0x2e')]][_0x114e('0x21')]=_0x216601[_0x114e('0x35')];channels[_0x216601[_0x114e('0x2e')]][_0x114e('0x36')]='_attended';}}}catch(_0x11775d){utils[_0x114e('0x17')](util['format']('[%s][calls][attendedtransfer]',_0x216601['origtransfereruniqueid']),_0x11775d);}};exports[_0x114e('0x37')]=function(_0x202dc2){try{if(!_[_0x114e('0x1b')](channels[_0x202dc2[_0x114e('0x6')]])){utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x38'),_0x202dc2[_0x114e('0x6')]),_0x202dc2);channels[_0x202dc2['uniqueid']][_0x114e('0x39')]=utils[_0x114e('0x1f')]();utils[_0x114e('0x4')](util[_0x114e('0x11')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x202dc2[_0x114e('0x6')],channels[_0x202dc2[_0x114e('0x6')]]['musiconholdstartAt']));}}catch(_0x5013f8){utils[_0x114e('0x17')](util[_0x114e('0x11')](_0x114e('0x38'),_0x202dc2[_0x114e('0x6')]),_0x5013f8);}};exports[_0x114e('0x3a')]=function(_0xfccc8a){try{if(!_[_0x114e('0x1b')](channels[_0xfccc8a[_0x114e('0x6')]])){utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x3b'),_0xfccc8a[_0x114e('0x6')]),_0xfccc8a);if(!_[_0x114e('0x1b')](channels[_0xfccc8a[_0x114e('0x6')]][_0x114e('0x39')])){channels[_0xfccc8a[_0x114e('0x6')]][_0x114e('0x3c')]+=utils[_0x114e('0x2c')](utils['now'](),channels[_0xfccc8a[_0x114e('0x6')]][_0x114e('0x39')]);utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x3d'),_0xfccc8a[_0x114e('0x6')],channels[_0xfccc8a[_0x114e('0x6')]][_0x114e('0x3c')]));delete channels[_0xfccc8a[_0x114e('0x6')]][_0x114e('0x39')];}}}catch(_0x3bbc68){utils[_0x114e('0x17')](util['format'](_0x114e('0x3b'),_0xfccc8a['uniqueid']),_0x3bbc68);}};exports[_0x114e('0x3e')]=function(_0x4c6507){try{if(!_['isNil'](channels[_0x4c6507[_0x114e('0x6')]])){utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x3f'),_0x4c6507[_0x114e('0x6')]),_0x4c6507);if(!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')][_0x114e('0x41')])){utils[_0x114e('0x4')](util[_0x114e('0x11')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4c6507['uniqueid'],_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507['uniqueid']][_0x114e('0x43')]=_0x4c6507[_0x114e('0x42')];}if(!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')][_0x114e('0x44')])){utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x45'),_0x4c6507[_0x114e('0x6')],_0x4c6507['value']));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x46')]=_0x4c6507[_0x114e('0x42')];channels[_0x4c6507['uniqueid']]['callerid']='\x22'+_0x4c6507[_0x114e('0x42')]+'\x22\x20<'+_0x4c6507[_0x114e('0x42')]+'>';}if(!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')][_0x114e('0x47')])||!_[_0x114e('0x1b')](_0x4c6507['variable']['xmd-callerid'])){utils['info'](util[_0x114e('0x11')](_0x114e('0x48'),_0x4c6507[_0x114e('0x6')],!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')]['xmd-callerid-preview'])?_0x114e('0x47'):_0x114e('0x49'),_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x4a')]=_0x4c6507[_0x114e('0x42')];}if(!_[_0x114e('0x1b')](_0x4c6507['variable']['xmd-queue'])||!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')][_0x114e('0x4b')])){utils['info'](util[_0x114e('0x11')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4c6507[_0x114e('0x6')],!_[_0x114e('0x1b')](_0x4c6507['variable'][_0x114e('0x4c')])?_0x114e('0x4c'):_0x114e('0x4b'),_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]]['lastapplication']=_0x114e('0x4d');channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x4e')]=_0x4c6507[_0x114e('0x42')];channels[_0x4c6507[_0x114e('0x6')]]['queue']=!![];}if(!_[_0x114e('0x1b')](_0x4c6507['variable']['xmd-contactid'])){utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x4f'),_0x4c6507[_0x114e('0x6')],_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x50')]=_0x4c6507[_0x114e('0x42')];}if(!_['isNil'](_0x4c6507[_0x114e('0x40')]['xmd-cdrtype'])){utils[_0x114e('0x4')](util[_0x114e('0x11')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4c6507[_0x114e('0x6')],_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x51')]=_0x4c6507['value'];}if(!_[_0x114e('0x1b')](_0x4c6507['variable']['outboundrouteid'])){utils[_0x114e('0x4')](util[_0x114e('0x11')](_0x114e('0x52'),_0x4c6507[_0x114e('0x6')],_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x53')]=_0x4c6507[_0x114e('0x42')];}if(!_[_0x114e('0x1b')](_0x4c6507[_0x114e('0x40')][_0x114e('0x54')])){utils[_0x114e('0x4')](util['format'](_0x114e('0x55'),_0x4c6507[_0x114e('0x6')],_0x4c6507[_0x114e('0x42')]));channels[_0x4c6507[_0x114e('0x6')]][_0x114e('0x54')]=_0x4c6507[_0x114e('0x42')];}}}catch(_0x3904b9){utils[_0x114e('0x17')](util[_0x114e('0x11')](_0x114e('0x3f'),_0x4c6507[_0x114e('0x6')]),_0x3904b9);}};exports[_0x114e('0x56')]=function(_0x19fe35){try{if(!_[_0x114e('0x1b')](channels[_0x19fe35[_0x114e('0x6')]])){utils[_0x114e('0x10')](util[_0x114e('0x11')](_0x114e('0x57'),_0x19fe35[_0x114e('0x6')]),_0x19fe35);utils[_0x114e('0x4')](util[_0x114e('0x11')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x19fe35[_0x114e('0x6')],_0x19fe35[_0x114e('0x58')],_0x19fe35[_0x114e('0x59')]));if(_0x19fe35[_0x114e('0x58')][_0x114e('0x5a')]()=='set'&&_[_0x114e('0x5b')](_0x19fe35['appdata'][_0x114e('0x5a')](),_0x114e('0x5c'))){var _0x4dfacf=_0x19fe35[_0x114e('0x59')][_0x114e('0x5d')]('=');var _0x15a3b4=_0x4dfacf[0x0][_0x114e('0x5e')](_0x4dfacf[0x0]['lastIndexOf']('(')+0x1,_0x4dfacf[0x0][_0x114e('0x5f')](')'));var _0x58fa13=_0x4dfacf[0x1];channels[_0x19fe35['uniqueid']][_0x15a3b4]=_0x58fa13;}if(!_[_0x114e('0x60')]([_0x114e('0x61'),'noop',_0x114e('0x62'),_0x114e('0x63'),_0x114e('0x64')],_0x19fe35[_0x114e('0x58')][_0x114e('0x5a')]())){channels[_0x19fe35[_0x114e('0x6')]][_0x114e('0x65')]=_0x19fe35[_0x114e('0x58')];channels[_0x19fe35[_0x114e('0x6')]][_0x114e('0x4e')]=_0x19fe35[_0x114e('0x59')];}}}catch(_0x140b01){utils[_0x114e('0x17')](util[_0x114e('0x11')](_0x114e('0x57'),_0x19fe35[_0x114e('0x6')]),_0x140b01);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 6d31976..da841d1 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 _0x9d93=['./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x25a0b9,_0x86e28f){var _0x30b9ab=function(_0x883a4){while(--_0x883a4){_0x25a0b9['push'](_0x25a0b9['shift']());}};_0x30b9ab(++_0x86e28f);}(_0x9d93,0x15c));var _0x39d9=function(_0x123e27,_0xd0fb68){_0x123e27=_0x123e27-0x0;var _0x5e5be4=_0x9d93[_0x123e27];return _0x5e5be4;};'use strict';var utils=require(_0x39d9('0x0'));exports['connect']=function(){utils[_0x39d9('0x1')](_0x39d9('0x2'));};exports[_0x39d9('0x3')]=function(){utils[_0x39d9('0x1')](_0x39d9('0x4'));};exports[_0x39d9('0x5')]=function(){utils['info'](_0x39d9('0x6'));};exports['error']=function(_0x54a55a){utils[_0x39d9('0x7')](_0x39d9('0x8'),_0x54a55a);};exports[_0x39d9('0x9')]=function(){utils[_0x39d9('0x1')](_0x39d9('0xa'));};exports[_0x39d9('0xb')]=function(_0x2170a4){}; \ No newline at end of file +var _0xd4ab=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info'];(function(_0x404deb,_0x700f79){var _0x41b21e=function(_0x52eb51){while(--_0x52eb51){_0x404deb['push'](_0x404deb['shift']());}};_0x41b21e(++_0x700f79);}(_0xd4ab,0x112));var _0xbd4a=function(_0x439ab1,_0x7c2913){_0x439ab1=_0x439ab1-0x0;var _0x500ea1=_0xd4ab[_0x439ab1];return _0x500ea1;};'use strict';var utils=require('./utils');exports[_0xbd4a('0x0')]=function(){utils[_0xbd4a('0x1')](_0xbd4a('0x2'));};exports[_0xbd4a('0x3')]=function(){utils['info'](_0xbd4a('0x4'));};exports[_0xbd4a('0x5')]=function(){utils[_0xbd4a('0x1')](_0xbd4a('0x6'));};exports['error']=function(_0x1ace15){utils[_0xbd4a('0x7')](_0xbd4a('0x8'),_0x1ace15);};exports[_0xbd4a('0x9')]=function(){utils[_0xbd4a('0x1')](_0xbd4a('0xa'));};exports[_0xbd4a('0xb')]=function(_0x3705e6){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c3c3d9a..0df1219 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 _0x7953=['[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','complete','duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format'];(function(_0x3a57b0,_0x23145a){var _0x2b8f3e=function(_0x1c721a){while(--_0x1c721a){_0x3a57b0['push'](_0x3a57b0['shift']());}};_0x2b8f3e(++_0x23145a);}(_0x7953,0x1e1));var _0x3795=function(_0x1f0679,_0x53d43c){_0x1f0679=_0x1f0679-0x0;var _0x3dc3a4=_0x7953[_0x1f0679];return _0x3dc3a4;};'use strict';var _=require(_0x3795('0x0'));var util=require(_0x3795('0x1'));var utils=require(_0x3795('0x2'));var dials={};function writeDB(_0x24fa17){utils[_0x3795('0x3')](util[_0x3795('0x4')](_0x3795('0x5'),_0x24fa17[_0x3795('0x6')],_0x24fa17[_0x3795('0x7')],_0x24fa17[_0x3795('0x8')],_0x24fa17['calleridnum'],_0x24fa17[_0x3795('0x9')],_0x24fa17[_0x3795('0xa')]));utils[_0x3795('0xb')](_0x3795('0xc'),_0x24fa17);delete dials[_0x24fa17[_0x3795('0x6')]];}exports[_0x3795('0xd')]=function(_0x565ddd){try{utils[_0x3795('0xe')](util[_0x3795('0x4')]('[%s][dials][newexten]',_0x565ddd[_0x3795('0x6')]),_0x565ddd);utils[_0x3795('0x3')](util['format'](_0x3795('0xf'),_0x565ddd[_0x3795('0x6')],_0x565ddd[_0x3795('0x10')],_0x565ddd[_0x3795('0x11')]));if(_0x565ddd[_0x3795('0x10')]['toLowerCase']()==_0x3795('0x12')&&_[_0x3795('0x13')](_0x565ddd['appdata'][_0x3795('0x14')](),_0x3795('0x15'))){var _0x564a28=_0x565ddd[_0x3795('0x11')][_0x3795('0x16')]('=');dials[_0x565ddd[_0x3795('0x6')]]={'routeId':_0x564a28[0x1]};}}catch(_0x364e82){utils[_0x3795('0x17')](util[_0x3795('0x4')](_0x3795('0x18'),_0x565ddd['uniqueid']),_0x364e82);}};exports[_0x3795('0x19')]=function(_0x452bfc){try{utils[_0x3795('0xe')](util[_0x3795('0x4')](_0x3795('0x1a'),_0x452bfc[_0x3795('0x6')]),_0x452bfc);if(!_[_0x3795('0x1b')](_0x452bfc['variable'][_0x3795('0x1c')])){utils[_0x3795('0x3')](util[_0x3795('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x452bfc['uniqueid'],_0x452bfc[_0x3795('0x1d')]));dials[_0x452bfc[_0x3795('0x6')]]={'routeId':_0x452bfc[_0x3795('0x1d')]};}}catch(_0x5e91b2){utils[_0x3795('0x17')](util[_0x3795('0x4')](_0x3795('0x1a'),_0x452bfc[_0x3795('0x6')]),_0x5e91b2);}};exports[_0x3795('0x1e')]=function(_0x50ba22){try{if(!_[_0x3795('0x1b')](dials[_0x50ba22['uniqueid']])){utils[_0x3795('0xe')](util['format'](_0x3795('0x1f'),_0x50ba22[_0x3795('0x6')]),_0x50ba22);dials[_0x50ba22[_0x3795('0x6')]]=_[_0x3795('0x20')](dials[_0x50ba22[_0x3795('0x6')]],_0x50ba22);dials[_0x50ba22[_0x3795('0x6')]][_0x3795('0x21')]=utils['now']();dials[_0x50ba22[_0x3795('0x6')]][_0x3795('0x22')]=_0x3795('0x23');utils['info'](util[_0x3795('0x4')](_0x3795('0x24'),_0x50ba22[_0x3795('0x6')],dials[_0x50ba22[_0x3795('0x6')]]['starttime']));}}catch(_0x36f5aa){utils[_0x3795('0x17')](util[_0x3795('0x4')](_0x3795('0x1f'),_0x50ba22[_0x3795('0x6')]),_0x36f5aa);}};exports[_0x3795('0x25')]=function(_0x10689a){try{if(!_[_0x3795('0x1b')](dials[_0x10689a[_0x3795('0x6')]])){utils[_0x3795('0xe')](util[_0x3795('0x4')](_0x3795('0x26'),_0x10689a[_0x3795('0x6')]),_0x10689a);dials[_0x10689a[_0x3795('0x6')]]['dialstatus']=_0x10689a['dialstatus'];if(_0x10689a[_0x3795('0xa')]=='ANSWER'){dials[_0x10689a[_0x3795('0x6')]]=_['assign'](dials[_0x10689a[_0x3795('0x6')]],_0x10689a);dials[_0x10689a[_0x3795('0x6')]][_0x3795('0x27')]=utils[_0x3795('0x28')]();dials[_0x10689a[_0x3795('0x6')]][_0x3795('0x22')]=_0x3795('0x29');utils['info'](util['format'](_0x3795('0x2a'),_0x10689a['uniqueid'],_0x10689a[_0x3795('0xa')],dials[_0x10689a[_0x3795('0x6')]][_0x3795('0x27')]));}else{utils[_0x3795('0x3')](util[_0x3795('0x4')](_0x3795('0x2b'),_0x10689a['uniqueid'],_0x10689a[_0x3795('0xa')]));}}}catch(_0xd5fbb6){utils['error'](util[_0x3795('0x4')](_0x3795('0x26'),_0x10689a[_0x3795('0x6')]),_0xd5fbb6);}};exports[_0x3795('0x2c')]=function(_0x104b05){try{if(!_[_0x3795('0x1b')](dials[_0x104b05[_0x3795('0x6')]])){utils['debug'](util[_0x3795('0x4')](_0x3795('0x2d'),_0x104b05[_0x3795('0x6')]),_0x104b05);utils[_0x3795('0x3')](util[_0x3795('0x4')](_0x3795('0x2e'),_0x104b05[_0x3795('0x6')],_0x104b05[_0x3795('0x2f')],_0x104b05['calleridname'],_0x104b05[_0x3795('0x30')]));dials[_0x104b05[_0x3795('0x6')]]=_[_0x3795('0x20')](dials[_0x104b05[_0x3795('0x6')]],{'endtime':utils[_0x3795('0x28')](),'lastevent':_0x3795('0x31')});dials[_0x104b05[_0x3795('0x6')]][_0x3795('0x32')]=utils[_0x3795('0x33')](dials[_0x104b05[_0x3795('0x6')]]['endtime'],dials[_0x104b05['uniqueid']]['starttime']);dials[_0x104b05[_0x3795('0x6')]]['holdtime']=utils[_0x3795('0x33')](dials[_0x104b05['uniqueid']][_0x3795('0x27')]||dials[_0x104b05['uniqueid']][_0x3795('0x34')],dials[_0x104b05[_0x3795('0x6')]][_0x3795('0x21')]);dials[_0x104b05['uniqueid']][_0x3795('0x35')]=dials[_0x104b05[_0x3795('0x6')]][_0x3795('0x27')]?utils[_0x3795('0x33')](dials[_0x104b05[_0x3795('0x6')]][_0x3795('0x34')],dials[_0x104b05[_0x3795('0x6')]]['answertime']):0x0;writeDB(dials[_0x104b05[_0x3795('0x6')]]);}}catch(_0x15ea10){utils['error'](util['format']('[%s][dials][hangup]',_0x104b05[_0x3795('0x6')]),_0x15ea10);}}; \ No newline at end of file +var _0x8bac=['toLowerCase','startsWith','appdata','error','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','now','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','answertime','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x8bac,0x177));var _0xc8ba=function(_0x3d34da,_0x3abcc1){_0x3d34da=_0x3d34da-0x0;var _0xcf6af8=_0x8bac[_0x3d34da];return _0xcf6af8;};'use strict';var _=require(_0xc8ba('0x0'));var util=require(_0xc8ba('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x32e0cb){utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0x4'),_0x32e0cb['uniqueid'],_0x32e0cb[_0xc8ba('0x5')],_0x32e0cb[_0xc8ba('0x6')],_0x32e0cb[_0xc8ba('0x7')],_0x32e0cb[_0xc8ba('0x8')],_0x32e0cb['dialstatus']));utils[_0xc8ba('0x9')](_0xc8ba('0xa'),_0x32e0cb);delete dials[_0x32e0cb[_0xc8ba('0xb')]];}exports[_0xc8ba('0xc')]=function(_0x337e3c){try{utils[_0xc8ba('0xd')](util[_0xc8ba('0x3')](_0xc8ba('0xe'),_0x337e3c[_0xc8ba('0xb')]),_0x337e3c);utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0xf'),_0x337e3c[_0xc8ba('0xb')],_0x337e3c[_0xc8ba('0x10')],_0x337e3c['appdata']));if(_0x337e3c[_0xc8ba('0x10')][_0xc8ba('0x11')]()=='set'&&_[_0xc8ba('0x12')](_0x337e3c[_0xc8ba('0x13')]['toLowerCase'](),'cdr(routeid)')){var _0x377184=_0x337e3c[_0xc8ba('0x13')]['split']('=');dials[_0x337e3c[_0xc8ba('0xb')]]={'routeId':_0x377184[0x1]};}}catch(_0x58121b){utils[_0xc8ba('0x14')](util[_0xc8ba('0x3')](_0xc8ba('0xe'),_0x337e3c[_0xc8ba('0xb')]),_0x58121b);}};exports['varset']=function(_0x468cbf){try{utils[_0xc8ba('0xd')](util[_0xc8ba('0x3')](_0xc8ba('0x15'),_0x468cbf[_0xc8ba('0xb')]),_0x468cbf);if(!_[_0xc8ba('0x16')](_0x468cbf['variable'][_0xc8ba('0x17')])){utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0x18'),_0x468cbf['uniqueid'],_0x468cbf[_0xc8ba('0x19')]));dials[_0x468cbf[_0xc8ba('0xb')]]={'routeId':_0x468cbf[_0xc8ba('0x19')]};}}catch(_0x3771ec){utils[_0xc8ba('0x14')](util[_0xc8ba('0x3')](_0xc8ba('0x15'),_0x468cbf['uniqueid']),_0x3771ec);}};exports[_0xc8ba('0x1a')]=function(_0x54a0f2){try{if(!_[_0xc8ba('0x16')](dials[_0x54a0f2[_0xc8ba('0xb')]])){utils['debug'](util[_0xc8ba('0x3')]('[%s][dials][dialbegin]',_0x54a0f2['uniqueid']),_0x54a0f2);dials[_0x54a0f2[_0xc8ba('0xb')]]=_[_0xc8ba('0x1b')](dials[_0x54a0f2[_0xc8ba('0xb')]],_0x54a0f2);dials[_0x54a0f2['uniqueid']][_0xc8ba('0x1c')]=utils['now']();dials[_0x54a0f2[_0xc8ba('0xb')]]['lastevent']='called';utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0x1d'),_0x54a0f2['uniqueid'],dials[_0x54a0f2[_0xc8ba('0xb')]][_0xc8ba('0x1c')]));}}catch(_0x1b613c){utils[_0xc8ba('0x14')](util[_0xc8ba('0x3')](_0xc8ba('0x1e'),_0x54a0f2['uniqueid']),_0x1b613c);}};exports[_0xc8ba('0x1f')]=function(_0x31ffd6){try{if(!_[_0xc8ba('0x16')](dials[_0x31ffd6['uniqueid']])){utils[_0xc8ba('0xd')](util[_0xc8ba('0x3')](_0xc8ba('0x20'),_0x31ffd6[_0xc8ba('0xb')]),_0x31ffd6);dials[_0x31ffd6[_0xc8ba('0xb')]][_0xc8ba('0x21')]=_0x31ffd6['dialstatus'];if(_0x31ffd6[_0xc8ba('0x21')]=='ANSWER'){dials[_0x31ffd6[_0xc8ba('0xb')]]=_[_0xc8ba('0x1b')](dials[_0x31ffd6[_0xc8ba('0xb')]],_0x31ffd6);dials[_0x31ffd6[_0xc8ba('0xb')]]['answertime']=utils[_0xc8ba('0x22')]();dials[_0x31ffd6[_0xc8ba('0xb')]][_0xc8ba('0x23')]=_0xc8ba('0x24');utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0x25'),_0x31ffd6[_0xc8ba('0xb')],_0x31ffd6[_0xc8ba('0x21')],dials[_0x31ffd6['uniqueid']]['answertime']));}else{utils['info'](util[_0xc8ba('0x3')](_0xc8ba('0x26'),_0x31ffd6[_0xc8ba('0xb')],_0x31ffd6[_0xc8ba('0x21')]));}}}catch(_0x37d31e){utils[_0xc8ba('0x14')](util[_0xc8ba('0x3')](_0xc8ba('0x20'),_0x31ffd6[_0xc8ba('0xb')]),_0x37d31e);}};exports[_0xc8ba('0x27')]=function(_0x16e450){try{if(!_[_0xc8ba('0x16')](dials[_0x16e450['uniqueid']])){utils[_0xc8ba('0xd')](util[_0xc8ba('0x3')](_0xc8ba('0x28'),_0x16e450[_0xc8ba('0xb')]),_0x16e450);utils[_0xc8ba('0x2')](util[_0xc8ba('0x3')](_0xc8ba('0x29'),_0x16e450[_0xc8ba('0xb')],_0x16e450[_0xc8ba('0x7')],_0x16e450[_0xc8ba('0x2a')],_0x16e450['cause-txt']));dials[_0x16e450[_0xc8ba('0xb')]]=_[_0xc8ba('0x1b')](dials[_0x16e450[_0xc8ba('0xb')]],{'endtime':utils[_0xc8ba('0x22')](),'lastevent':_0xc8ba('0x2b')});dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x2c')]=utils[_0xc8ba('0x2d')](dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x2e')],dials[_0x16e450[_0xc8ba('0xb')]]['starttime']);dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x2f')]=utils[_0xc8ba('0x2d')](dials[_0x16e450[_0xc8ba('0xb')]]['answertime']||dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x2e')],dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x1c')]);dials[_0x16e450['uniqueid']]['billableseconds']=dials[_0x16e450['uniqueid']][_0xc8ba('0x30')]?utils['diffTime'](dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x2e')],dials[_0x16e450[_0xc8ba('0xb')]][_0xc8ba('0x30')]):0x0;writeDB(dials[_0x16e450['uniqueid']]);}}catch(_0x29f18c){utils['error'](util[_0xc8ba('0x3')]('[%s][dials][hangup]',_0x16e450[_0xc8ba('0xb')]),_0x29f18c);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index b6289b9..9bd8799 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 _0xa5ae=['dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','local','asterisk','port','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa5ae,0x90));var _0xea5a=function(_0x4ebb5d,_0x1e92b6){_0x4ebb5d=_0x4ebb5d-0x0;var _0x5abafd=_0xa5ae[_0x4ebb5d];return _0x5abafd;};var AsteriskManager=require(_0xea5a('0x0'));var config=require('../../config/environment');var utils=require(_0xea5a('0x1'));var util=require(_0xea5a('0x2'));var isXDREnabled=config[_0xea5a('0x3')]&&config[_0xea5a('0x3')]['disabled']?!config[_0xea5a('0x3')][_0xea5a('0x4')]:!![];var isProduction=config[_0xea5a('0x5')]==='production'||![];var isLocalAsterisk=config[_0xea5a('0x3')]&&config[_0xea5a('0x3')][_0xea5a('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xea5a('0x7')][_0xea5a('0x8')],config[_0xea5a('0x7')]['ip'],config[_0xea5a('0x7')][_0xea5a('0x9')],config['asterisk'][_0xea5a('0xa')],!![]);ami[_0xea5a('0xb')]();if(!isXDREnabled){utils[_0xea5a('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xea5a('0xd'));}else{var agents=require(_0xea5a('0xe'));var calls=require(_0xea5a('0xf'));var queues=require(_0xea5a('0x10'));var recordings=require(_0xea5a('0x11'));var members=require('./members.controller');var dials=require(_0xea5a('0x12'));var transfers=require(_0xea5a('0x13'));var core=require('./core.controller');ami['on'](_0xea5a('0x14'),core[_0xea5a('0x14')]);ami['on'](_0xea5a('0x15'),core['shutdown']);ami['on'](_0xea5a('0x16'),core[_0xea5a('0x16')]);ami['on'](_0xea5a('0x17'),core[_0xea5a('0x17')]);ami['on'](_0xea5a('0x18'),core['close']);ami['on'](_0xea5a('0x19'),core[_0xea5a('0x19')]);ami['on'](_0xea5a('0x1a'),function(_0x13de52){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x1d'),_0x13de52[_0xea5a('0x1e')]),_0x13de52);members[_0xea5a('0x1a')](_0x13de52);}catch(_0x4d32b9){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')]('[%s][index][devicestatechange]',_0x13de52[_0xea5a('0x1e')]),_0x4d32b9);}});ami['on'](_0xea5a('0x1f'),function(_0x477b0f){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')]('[%s][index][agentcalled]',_0x477b0f[_0xea5a('0x20')]),_0x477b0f);agents[_0xea5a('0x1f')](_0x477b0f);}catch(_0x185360){utils[_0xea5a('0x17')](util['format'](_0xea5a('0x21'),_0x477b0f[_0xea5a('0x20')]),_0x185360);}});ami['on']('agentringnoanswer',function(_0x318586){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x22'),_0x318586[_0xea5a('0x20')]),_0x318586);agents[_0xea5a('0x23')](_0x318586);}catch(_0x5e2a5e){utils['error'](util[_0xea5a('0x1c')](_0xea5a('0x22'),_0x318586['uniqueid']),_0x5e2a5e);}});ami['on'](_0xea5a('0x24'),function(_0x239d1c){try{utils['debug'](util[_0xea5a('0x1c')](_0xea5a('0x25'),_0x239d1c[_0xea5a('0x20')]),_0x239d1c);agents['agentconnect'](_0x239d1c);queues[_0xea5a('0x24')](_0x239d1c);}catch(_0x397207){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x25'),_0x239d1c['uniqueid']),_0x397207);}});ami['on'](_0xea5a('0x26'),function(_0x4d41a7){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x27'),_0x4d41a7[_0xea5a('0x20')]),_0x4d41a7);agents[_0xea5a('0x26')](_0x4d41a7);queues[_0xea5a('0x26')](_0x4d41a7);members[_0xea5a('0x26')](_0x4d41a7);}catch(_0x1e2f89){utils['error'](util['format'](_0xea5a('0x27'),_0x4d41a7['uniqueid']),_0x1e2f89);}});ami['on'](_0xea5a('0x28'),function(_0x1be830){try{utils[_0xea5a('0x1b')](util['format'](_0xea5a('0x29'),_0x1be830[_0xea5a('0x20')]),_0x1be830);agents[_0xea5a('0x28')](_0x1be830);queues[_0xea5a('0x28')](_0x1be830);}catch(_0x5eae60){utils[_0xea5a('0x17')](util['format'](_0xea5a('0x29'),_0x1be830[_0xea5a('0x20')]),_0x5eae60);}});ami['on'](_0xea5a('0x2a'),function(_0x48d938){try{utils[_0xea5a('0x1b')](util['format'](_0xea5a('0x2b'),_0x48d938[_0xea5a('0x20')]),_0x48d938);queues[_0xea5a('0x2a')](_0x48d938);recordings[_0xea5a('0x2a')](_0x48d938);}catch(_0x35c82d){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x2b'),_0x48d938[_0xea5a('0x20')]),_0x35c82d);}});ami['on']('queuecallerleave',function(_0xa1feef){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x2c'),_0xa1feef[_0xea5a('0x20')]),_0xa1feef);queues['queuecallerleave'](_0xa1feef);}catch(_0x282e30){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x2c'),_0xa1feef[_0xea5a('0x20')]),_0x282e30);}});ami['on'](_0xea5a('0x2d'),function(_0x259a9a){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x2e'),_0x259a9a[_0xea5a('0x20')]),_0x259a9a);queues['musiconholdstart'](_0x259a9a);calls[_0xea5a('0x2d')](_0x259a9a);}catch(_0x1ce08d){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x2e'),_0x259a9a[_0xea5a('0x20')]),_0x1ce08d);}});ami['on']('musiconholdstop',function(_0x590fbd){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x2f'),_0x590fbd[_0xea5a('0x20')]),_0x590fbd);queues[_0xea5a('0x30')](_0x590fbd);calls[_0xea5a('0x30')](_0x590fbd);}catch(_0x2cb62c){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x2f'),_0x590fbd[_0xea5a('0x20')]),_0x2cb62c);}});ami['on']('newstate',function(_0x1baee5){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x31'),_0x1baee5[_0xea5a('0x20')]),_0x1baee5);calls[_0xea5a('0x32')](_0x1baee5);recordings['newstate'](_0x1baee5);}catch(_0x2917de){utils[_0xea5a('0x17')](util['format'](_0xea5a('0x31'),_0x1baee5[_0xea5a('0x20')]),_0x2917de);}});ami['on']('hangup',function(_0x141d78){try{utils['debug'](util['format'](_0xea5a('0x33'),_0x141d78[_0xea5a('0x20')]),_0x141d78);calls[_0xea5a('0x34')](_0x141d78);recordings['hangup'](_0x141d78);dials[_0xea5a('0x34')](_0x141d78);agents[_0xea5a('0x34')](_0x141d78);queues[_0xea5a('0x34')](_0x141d78);}catch(_0xc20291){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x33'),_0x141d78['uniqueid']),_0xc20291);}});ami['on'](_0xea5a('0x35'),function(_0xfe82b2){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x36'),_0xfe82b2['uniqueid']),_0xfe82b2);members[_0xea5a('0x35')](_0xfe82b2);}catch(_0x3474ed){utils['error'](util['format'](_0xea5a('0x36'),_0xfe82b2[_0xea5a('0x20')]),_0x3474ed);}});ami['on'](_0xea5a('0x37'),function(_0x2f33c5){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x38'),_0x2f33c5['uniqueid']),_0x2f33c5);queues[_0xea5a('0x37')](_0x2f33c5);agents[_0xea5a('0x37')](_0x2f33c5);transfers[_0xea5a('0x37')](_0x2f33c5);}catch(_0x26e7dc){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x38'),_0x2f33c5[_0xea5a('0x20')]),_0x26e7dc);}});ami['on'](_0xea5a('0x39'),function(_0x25c561){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')]('[%s][index][attendedtransfer]',_0x25c561[_0xea5a('0x3a')]),_0x25c561);queues[_0xea5a('0x39')](_0x25c561);transfers['attendedtransfer'](_0x25c561);agents['attendedtransfer'](_0x25c561);calls[_0xea5a('0x39')](_0x25c561);}catch(_0x35624b){utils['error'](util[_0xea5a('0x1c')](_0xea5a('0x3b'),_0x25c561[_0xea5a('0x3a')]),_0x35624b);}});ami['on']('varset',function(_0x867bc){try{utils['debug'](util[_0xea5a('0x1c')]('[%s][index][varset]',_0x867bc[_0xea5a('0x20')]),_0x867bc);queues['varset'](_0x867bc);recordings[_0xea5a('0x3c')](_0x867bc);calls['varset'](_0x867bc);dials[_0xea5a('0x3c')](_0x867bc);}catch(_0xbc5416){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x3d'),_0x867bc['uniqueid']),_0xbc5416);}});ami['on'](_0xea5a('0x3e'),function(_0x36ef4f){try{utils['debug'](util[_0xea5a('0x1c')](_0xea5a('0x3f'),_0x36ef4f[_0xea5a('0x20')]),_0x36ef4f);calls[_0xea5a('0x3e')](_0x36ef4f);recordings[_0xea5a('0x3e')](_0x36ef4f);dials[_0xea5a('0x3e')](_0x36ef4f);}catch(_0x374ca5){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x3f'),_0x36ef4f[_0xea5a('0x20')]),_0x374ca5);}});ami['on'](_0xea5a('0x40'),function(_0x48bb9f){try{utils[_0xea5a('0x1b')](util['format'](_0xea5a('0x41'),_0x48bb9f[_0xea5a('0x20')]),_0x48bb9f);calls[_0xea5a('0x40')](_0x48bb9f);recordings['newchannel'](_0x48bb9f);}catch(_0x1d579b){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')]('[%s][index][newchannel]',_0x48bb9f[_0xea5a('0x20')]),_0x1d579b);}});ami['on'](_0xea5a('0x42'),function(_0x1595bf){try{utils[_0xea5a('0x1b')](util['format'](_0xea5a('0x43'),_0x1595bf[_0xea5a('0x20')]),_0x1595bf);dials[_0xea5a('0x42')](_0x1595bf);}catch(_0x3a66e7){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')](_0xea5a('0x44'),_0x1595bf[_0xea5a('0x20')]),_0x3a66e7);}});ami['on'](_0xea5a('0x45'),function(_0x2929fb){try{utils[_0xea5a('0x1b')](util[_0xea5a('0x1c')](_0xea5a('0x46'),_0x2929fb['uniqueid']),_0x2929fb);dials['dialend'](_0x2929fb);}catch(_0x3436ab){utils[_0xea5a('0x17')](util[_0xea5a('0x1c')]('[%s][index][dialend]',_0x2929fb['uniqueid']),_0x3436ab);}});} \ No newline at end of file +var _0xed58=['[%s][index][dialend]','../../config/environment','./utils','util','disabled','xdr','env','production','local','asterisk','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','uniqueid','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','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]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend'];(function(_0x596ee2,_0x12009a){var _0x1d22ea=function(_0x50a31d){while(--_0x50a31d){_0x596ee2['push'](_0x596ee2['shift']());}};_0x1d22ea(++_0x12009a);}(_0xed58,0x85));var _0x8ed5=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xed58[_0x465028];return _0xb783d4;};var AsteriskManager=require('asterisk-manager');var config=require(_0x8ed5('0x0'));var utils=require(_0x8ed5('0x1'));var util=require(_0x8ed5('0x2'));var isXDREnabled=config['xdr']&&config['xdr'][_0x8ed5('0x3')]?!config[_0x8ed5('0x4')]['disabled']:!![];var isProduction=config[_0x8ed5('0x5')]===_0x8ed5('0x6')||![];var isLocalAsterisk=config[_0x8ed5('0x4')]&&config[_0x8ed5('0x4')][_0x8ed5('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x8ed5('0x8')]['port'],config[_0x8ed5('0x8')]['ip'],config[_0x8ed5('0x8')]['username'],config[_0x8ed5('0x8')]['password'],!![]);ami[_0x8ed5('0x9')]();if(!isXDREnabled){utils[_0x8ed5('0xa')](_0x8ed5('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x8ed5('0xa')](_0x8ed5('0xc'));}else{var agents=require(_0x8ed5('0xd'));var calls=require('./calls.controller');var queues=require(_0x8ed5('0xe'));var recordings=require(_0x8ed5('0xf'));var members=require('./members.controller');var dials=require(_0x8ed5('0x10'));var transfers=require(_0x8ed5('0x11'));var core=require(_0x8ed5('0x12'));ami['on'](_0x8ed5('0x13'),core[_0x8ed5('0x13')]);ami['on'](_0x8ed5('0x14'),core[_0x8ed5('0x14')]);ami['on']('fullybooted',core[_0x8ed5('0x15')]);ami['on'](_0x8ed5('0x16'),core[_0x8ed5('0x16')]);ami['on'](_0x8ed5('0x17'),core[_0x8ed5('0x17')]);ami['on'](_0x8ed5('0x18'),core[_0x8ed5('0x18')]);ami['on']('devicestatechange',function(_0x187b09){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x1b'),_0x187b09[_0x8ed5('0x1c')]),_0x187b09);members['devicestatechange'](_0x187b09);}catch(_0x1f4ee1){utils[_0x8ed5('0x16')](util['format']('[%s][index][devicestatechange]',_0x187b09[_0x8ed5('0x1c')]),_0x1f4ee1);}});ami['on']('agentcalled',function(_0x47db5b){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')]('[%s][index][agentcalled]',_0x47db5b[_0x8ed5('0x1d')]),_0x47db5b);agents[_0x8ed5('0x1e')](_0x47db5b);}catch(_0x4e2721){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x1f'),_0x47db5b[_0x8ed5('0x1d')]),_0x4e2721);}});ami['on'](_0x8ed5('0x20'),function(_0x1faf72){try{utils['debug'](util['format'](_0x8ed5('0x21'),_0x1faf72[_0x8ed5('0x1d')]),_0x1faf72);agents['agentringnoanswer'](_0x1faf72);}catch(_0x1688c0){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x21'),_0x1faf72['uniqueid']),_0x1688c0);}});ami['on'](_0x8ed5('0x22'),function(_0x3c212a){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')]('[%s][index][agentconnect]',_0x3c212a['uniqueid']),_0x3c212a);agents[_0x8ed5('0x22')](_0x3c212a);queues[_0x8ed5('0x22')](_0x3c212a);}catch(_0x4f3e25){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')]('[%s][index][agentconnect]',_0x3c212a[_0x8ed5('0x1d')]),_0x4f3e25);}});ami['on'](_0x8ed5('0x23'),function(_0x52bfa8){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x24'),_0x52bfa8[_0x8ed5('0x1d')]),_0x52bfa8);agents['agentcomplete'](_0x52bfa8);queues['agentcomplete'](_0x52bfa8);members[_0x8ed5('0x23')](_0x52bfa8);}catch(_0x448cbd){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x24'),_0x52bfa8['uniqueid']),_0x448cbd);}});ami['on'](_0x8ed5('0x25'),function(_0x1b83af){try{utils[_0x8ed5('0x19')](util['format'](_0x8ed5('0x26'),_0x1b83af[_0x8ed5('0x1d')]),_0x1b83af);agents['queuecallerabandon'](_0x1b83af);queues[_0x8ed5('0x25')](_0x1b83af);}catch(_0x2355e2){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x26'),_0x1b83af[_0x8ed5('0x1d')]),_0x2355e2);}});ami['on'](_0x8ed5('0x27'),function(_0x120b57){try{utils['debug'](util['format'](_0x8ed5('0x28'),_0x120b57['uniqueid']),_0x120b57);queues[_0x8ed5('0x27')](_0x120b57);recordings[_0x8ed5('0x27')](_0x120b57);}catch(_0x5f3767){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')]('[%s][index][queuecallerjoin]',_0x120b57[_0x8ed5('0x1d')]),_0x5f3767);}});ami['on'](_0x8ed5('0x29'),function(_0xabd1ff){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x2a'),_0xabd1ff[_0x8ed5('0x1d')]),_0xabd1ff);queues[_0x8ed5('0x29')](_0xabd1ff);}catch(_0x4ad7a8){utils[_0x8ed5('0x16')](util['format']('[%s][index][queuecallerleave]',_0xabd1ff['uniqueid']),_0x4ad7a8);}});ami['on'](_0x8ed5('0x2b'),function(_0x193380){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x2c'),_0x193380['uniqueid']),_0x193380);queues[_0x8ed5('0x2b')](_0x193380);calls[_0x8ed5('0x2b')](_0x193380);}catch(_0x27adde){utils[_0x8ed5('0x16')](util['format']('[%s][index][musiconholdstart]',_0x193380[_0x8ed5('0x1d')]),_0x27adde);}});ami['on']('musiconholdstop',function(_0x4a0274){try{utils['debug'](util['format']('[%s][index][musiconholdstop]',_0x4a0274[_0x8ed5('0x1d')]),_0x4a0274);queues['musiconholdstop'](_0x4a0274);calls[_0x8ed5('0x2d')](_0x4a0274);}catch(_0x3b49ab){utils['error'](util[_0x8ed5('0x1a')](_0x8ed5('0x2e'),_0x4a0274[_0x8ed5('0x1d')]),_0x3b49ab);}});ami['on'](_0x8ed5('0x2f'),function(_0x556745){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')]('[%s][index][newstate]',_0x556745[_0x8ed5('0x1d')]),_0x556745);calls['newstate'](_0x556745);recordings[_0x8ed5('0x2f')](_0x556745);}catch(_0x55ad87){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x30'),_0x556745[_0x8ed5('0x1d')]),_0x55ad87);}});ami['on'](_0x8ed5('0x31'),function(_0xfd24b2){try{utils['debug'](util[_0x8ed5('0x1a')]('[%s][index][hangup]',_0xfd24b2[_0x8ed5('0x1d')]),_0xfd24b2);calls[_0x8ed5('0x31')](_0xfd24b2);recordings['hangup'](_0xfd24b2);dials[_0x8ed5('0x31')](_0xfd24b2);agents[_0x8ed5('0x31')](_0xfd24b2);queues['hangup'](_0xfd24b2);}catch(_0x5b1b09){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x32'),_0xfd24b2['uniqueid']),_0x5b1b09);}});ami['on'](_0x8ed5('0x33'),function(_0x312cd0){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x34'),_0x312cd0['uniqueid']),_0x312cd0);members['cdr'](_0x312cd0);}catch(_0x25bf18){utils['error'](util[_0x8ed5('0x1a')](_0x8ed5('0x34'),_0x312cd0[_0x8ed5('0x1d')]),_0x25bf18);}});ami['on']('blindtransfer',function(_0x19c533){try{utils[_0x8ed5('0x19')](util['format'](_0x8ed5('0x35'),_0x19c533[_0x8ed5('0x1d')]),_0x19c533);queues[_0x8ed5('0x36')](_0x19c533);agents[_0x8ed5('0x36')](_0x19c533);transfers[_0x8ed5('0x36')](_0x19c533);}catch(_0x55dc57){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x35'),_0x19c533['uniqueid']),_0x55dc57);}});ami['on'](_0x8ed5('0x37'),function(_0x6257dc){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x38'),_0x6257dc['origtransfereruniqueid']),_0x6257dc);queues[_0x8ed5('0x37')](_0x6257dc);transfers[_0x8ed5('0x37')](_0x6257dc);agents[_0x8ed5('0x37')](_0x6257dc);calls[_0x8ed5('0x37')](_0x6257dc);}catch(_0x45433b){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x38'),_0x6257dc['origtransfereruniqueid']),_0x45433b);}});ami['on'](_0x8ed5('0x39'),function(_0x48bd9d){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')]('[%s][index][varset]',_0x48bd9d[_0x8ed5('0x1d')]),_0x48bd9d);queues[_0x8ed5('0x39')](_0x48bd9d);recordings[_0x8ed5('0x39')](_0x48bd9d);calls[_0x8ed5('0x39')](_0x48bd9d);dials[_0x8ed5('0x39')](_0x48bd9d);}catch(_0x2808a8){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')](_0x8ed5('0x3a'),_0x48bd9d[_0x8ed5('0x1d')]),_0x2808a8);}});ami['on'](_0x8ed5('0x3b'),function(_0x141dae){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x3c'),_0x141dae['uniqueid']),_0x141dae);calls[_0x8ed5('0x3b')](_0x141dae);recordings[_0x8ed5('0x3b')](_0x141dae);dials[_0x8ed5('0x3b')](_0x141dae);}catch(_0x4cff35){utils['error'](util[_0x8ed5('0x1a')](_0x8ed5('0x3c'),_0x141dae[_0x8ed5('0x1d')]),_0x4cff35);}});ami['on'](_0x8ed5('0x3d'),function(_0x4a7ae7){try{utils[_0x8ed5('0x19')](util[_0x8ed5('0x1a')](_0x8ed5('0x3e'),_0x4a7ae7[_0x8ed5('0x1d')]),_0x4a7ae7);calls[_0x8ed5('0x3d')](_0x4a7ae7);recordings[_0x8ed5('0x3d')](_0x4a7ae7);}catch(_0x5bc8de){utils['error'](util[_0x8ed5('0x1a')]('[%s][index][newchannel]',_0x4a7ae7[_0x8ed5('0x1d')]),_0x5bc8de);}});ami['on']('dialbegin',function(_0x51e57d){try{utils['debug'](util[_0x8ed5('0x1a')]('[%s][index][dialbegin]',_0x51e57d[_0x8ed5('0x1d')]),_0x51e57d);dials[_0x8ed5('0x3f')](_0x51e57d);}catch(_0x35f3b9){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')]('[%s]dialbegin',_0x51e57d['uniqueid']),_0x35f3b9);}});ami['on'](_0x8ed5('0x40'),function(_0x41b53d){try{utils[_0x8ed5('0x19')](util['format'](_0x8ed5('0x41'),_0x41b53d[_0x8ed5('0x1d')]),_0x41b53d);dials['dialend'](_0x41b53d);}catch(_0xe442bb){utils[_0x8ed5('0x16')](util[_0x8ed5('0x1a')]('[%s][index][dialend]',_0x41b53d[_0x8ed5('0x1d')]),_0xe442bb);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 2205e67..b2c1de1 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 _0x9b87=['data2','membername','type','name','internal','request','CreateMemberReport','getUserByName','then','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','exitAt','duration','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][cdr]','split','assign','data1','source','data3','destination','destinationchannel','isNil','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x9b87,0x8e));var _0x79b8=function(_0x1154d4,_0x5b94d7){_0x1154d4=_0x1154d4-0x0;var _0x1d328e=_0x9b87[_0x1154d4];return _0x1d328e;};'use strict';var _=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var utils=require(_0x79b8('0x2'));var members={};var exclude=[_0x79b8('0x3'),_0x79b8('0x4')];function writeDB(_0x4386a6){utils[_0x79b8('0x5')](util[_0x79b8('0x6')](_0x79b8('0x7'),_0x4386a6[_0x79b8('0x8')],_0x4386a6[_0x79b8('0x9')],_0x4386a6[_0x79b8('0xa')],_0x4386a6[_0x79b8('0xb')],_0x4386a6[_0x79b8('0xc')],_0x4386a6[_0x79b8('0xd')]));if(_0x4386a6[_0x79b8('0x9')]){utils['getUserByInterface'](_0x4386a6['interface'])['then'](function(_0x4c058b){if(_0x4c058b){_0x4386a6[_0x79b8('0xc')]=_0x4c058b[_0x79b8('0xe')];_0x4386a6[_0x79b8('0xf')]=_0x4c058b['internal'];utils[_0x79b8('0x10')](_0x79b8('0x11'),_0x4386a6);}else{utils[_0x79b8('0x12')](_0x4386a6['interface']['split']('/')[0x1])[_0x79b8('0x13')](function(_0x476e35){if(_0x476e35){_0x4386a6[_0x79b8('0xc')]=_0x476e35[_0x79b8('0xe')];_0x4386a6[_0x79b8('0xf')]=_0x476e35[_0x79b8('0xf')];utils[_0x79b8('0x10')](_0x79b8('0x11'),_0x4386a6);}});}})[_0x79b8('0x14')](function(_0x1614fe){utils[_0x79b8('0x15')](util['format'](_0x79b8('0x16'),_0x4386a6['uniqueid']),_0x1614fe);});}delete members[_0x4386a6['interface']];}function startsWith(_0x3142e9,_0x21aae0){return _[_0x79b8('0x17')](_0x3142e9,function(_0x5ddab5){return _[_0x79b8('0x18')](_0x21aae0,_0x5ddab5);});}exports['devicestatechange']=function(_0x5ef869){try{utils[_0x79b8('0x19')](util[_0x79b8('0x6')](_0x79b8('0x1a'),members[_0x5ef869[_0x79b8('0x1b')]]?members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x8')]:_0x5ef869['device']),_0x5ef869);utils[_0x79b8('0x5')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x5ef869[_0x79b8('0x1b')]]?members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x8')]:_0x5ef869[_0x79b8('0x1b')],_0x5ef869[_0x79b8('0x1c')],_0x5ef869[_0x79b8('0x1b')]));switch(_0x5ef869[_0x79b8('0x1c')]){case _0x79b8('0x1d'):case _0x79b8('0x1e'):if(!startsWith(exclude,_0x5ef869['device'])){members[_0x5ef869[_0x79b8('0x1b')]]={'channel':_0x79b8('0x1f'),'interface':_0x5ef869['device'],'type':_0x79b8('0x20'),'enterAt':utils[_0x79b8('0x21')](),'role':'agent'};}break;case _0x79b8('0x22'):if(!_['isNil'](members[_0x5ef869['device']])){members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x23')]=utils[_0x79b8('0x21')]();members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x24')]=utils['diffTime'](members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x23')],members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x25')]);if(members[_0x5ef869['device']][_0x79b8('0x8')]){writeDB(members[_0x5ef869[_0x79b8('0x1b')]]);}}break;default:break;}}catch(_0x14a4d6){utils['error'](util[_0x79b8('0x6')](_0x79b8('0x1a'),members[_0x5ef869[_0x79b8('0x1b')]]?members[_0x5ef869[_0x79b8('0x1b')]][_0x79b8('0x8')]:_0x5ef869[_0x79b8('0x1b')]),_0x14a4d6);}};exports['agentcomplete']=function(_0x434ecd){try{if(!_['isNil'](members[_0x434ecd[_0x79b8('0x9')]])){utils['debug'](util[_0x79b8('0x6')](_0x79b8('0x26'),_0x434ecd[_0x79b8('0x8')]),_0x434ecd);utils['info'](util[_0x79b8('0x6')](_0x79b8('0x27'),_0x434ecd[_0x79b8('0x8')],_0x434ecd[_0x79b8('0x9')],_0x434ecd['queue']));members[_0x434ecd[_0x79b8('0x9')]]=_['assign'](members[_0x434ecd['interface']],{'data4':_0x434ecd[_0x79b8('0x28')],'uniqueid':_0x434ecd[_0x79b8('0x8')]});}}catch(_0x4a038b){utils[_0x79b8('0x15')](util['format']('[%s][members][agentcomplete]',_0x434ecd[_0x79b8('0x8')]),_0x4a038b);}};exports['cdr']=function(_0x1ad785){try{utils[_0x79b8('0x19')](util['format'](_0x79b8('0x29'),_0x1ad785[_0x79b8('0x8')]),_0x1ad785);if(_0x1ad785[_0x79b8('0xa')]){var _0x1e5bd9=_0x1ad785[_0x79b8('0xa')][_0x79b8('0x2a')]('-')[0x0];if(!_['isNil'](members[_0x1e5bd9])){members[_0x1e5bd9]=_[_0x79b8('0x2b')](members[_0x1e5bd9],{'data1':members[_0x1e5bd9][_0x79b8('0x2c')]||_0x1ad785[_0x79b8('0xd')],'data2':members[_0x1e5bd9][_0x79b8('0xb')]||_0x1ad785[_0x79b8('0x2d')],'data3':members[_0x1e5bd9][_0x79b8('0x2e')]||_0x1ad785[_0x79b8('0x2f')],'uniqueid':members[_0x1e5bd9][_0x79b8('0x8')]||_0x1ad785[_0x79b8('0x8')]});utils[_0x79b8('0x5')](util[_0x79b8('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1ad785[_0x79b8('0x8')],members[_0x1e5bd9][_0x79b8('0x2c')],members[_0x1e5bd9][_0x79b8('0xb')],members[_0x1e5bd9]['data3']));if(members[_0x1e5bd9][_0x79b8('0x23')]){writeDB(members[_0x1e5bd9]);}}}if(_0x1ad785[_0x79b8('0x30')]){var _0x2252b8=_0x1ad785[_0x79b8('0x30')][_0x79b8('0x2a')]('-')[0x0];if(!_[_0x79b8('0x31')](members[_0x2252b8])){members[_0x2252b8]=_['assign'](members[_0x2252b8],{'data1':members[_0x2252b8][_0x79b8('0x2c')]||_0x1ad785['type'],'data2':members[_0x2252b8]['data2']||_0x1ad785[_0x79b8('0x2d')],'data3':members[_0x2252b8]['data3']||_0x1ad785['destination'],'uniqueid':members[_0x2252b8][_0x79b8('0x8')]||_0x1ad785[_0x79b8('0x8')]});utils[_0x79b8('0x5')](util[_0x79b8('0x6')](_0x79b8('0x32'),_0x1ad785[_0x79b8('0x8')],members[_0x2252b8][_0x79b8('0x2c')],members[_0x2252b8][_0x79b8('0xb')],members[_0x2252b8][_0x79b8('0x2e')]));if(members[_0x2252b8][_0x79b8('0x23')]){writeDB(members[_0x2252b8]);}}}}catch(_0x10f8e1){utils[_0x79b8('0x15')](util[_0x79b8('0x6')]('[%s][members][cdr]',_0x1ad785[_0x79b8('0x8')]),_0x10f8e1);}}; \ No newline at end of file +var _0xad53=['now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','type','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','data2','membername','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING'];(function(_0x183c00,_0x5327b8){var _0x4a8361=function(_0x126739){while(--_0x126739){_0x183c00['push'](_0x183c00['shift']());}};_0x4a8361(++_0x5327b8);}(_0xad53,0x1ea));var _0x3ad5=function(_0x4d18c7,_0x1bda95){_0x4d18c7=_0x4d18c7-0x0;var _0x27bfc1=_0xad53[_0x4d18c7];return _0x27bfc1;};'use strict';var _=require(_0x3ad5('0x0'));var util=require(_0x3ad5('0x1'));var utils=require(_0x3ad5('0x2'));var members={};var exclude=[_0x3ad5('0x3'),_0x3ad5('0x4')];function writeDB(_0x34f953){utils[_0x3ad5('0x5')](util[_0x3ad5('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x34f953[_0x3ad5('0x7')],_0x34f953[_0x3ad5('0x8')],_0x34f953[_0x3ad5('0x9')],_0x34f953[_0x3ad5('0xa')],_0x34f953[_0x3ad5('0xb')],_0x34f953['type']));if(_0x34f953['interface']){utils['getUserByInterface'](_0x34f953[_0x3ad5('0x8')])[_0x3ad5('0xc')](function(_0x2e07f){if(_0x2e07f){_0x34f953[_0x3ad5('0xb')]=_0x2e07f[_0x3ad5('0xd')];_0x34f953[_0x3ad5('0xe')]=_0x2e07f[_0x3ad5('0xe')];utils[_0x3ad5('0xf')]('CreateMemberReport',_0x34f953);}else{utils[_0x3ad5('0x10')](_0x34f953[_0x3ad5('0x8')][_0x3ad5('0x11')]('/')[0x1])[_0x3ad5('0xc')](function(_0x4c93e7){if(_0x4c93e7){_0x34f953[_0x3ad5('0xb')]=_0x4c93e7[_0x3ad5('0xd')];_0x34f953[_0x3ad5('0xe')]=_0x4c93e7['internal'];utils[_0x3ad5('0xf')](_0x3ad5('0x12'),_0x34f953);}});}})[_0x3ad5('0x13')](function(_0x214a29){utils[_0x3ad5('0x14')](util[_0x3ad5('0x6')]('[%s][members][writeDB]',_0x34f953['uniqueid']),_0x214a29);});}delete members[_0x34f953[_0x3ad5('0x8')]];}function startsWith(_0x278364,_0xabcbc0){return _[_0x3ad5('0x15')](_0x278364,function(_0x1d5868){return _[_0x3ad5('0x16')](_0xabcbc0,_0x1d5868);});}exports['devicestatechange']=function(_0x56123a){try{utils[_0x3ad5('0x17')](util[_0x3ad5('0x6')]('[%s][members][devicestatechange]',members[_0x56123a['device']]?members[_0x56123a[_0x3ad5('0x18')]][_0x3ad5('0x7')]:_0x56123a[_0x3ad5('0x18')]),_0x56123a);utils[_0x3ad5('0x5')](util['format'](_0x3ad5('0x19'),members[_0x56123a[_0x3ad5('0x18')]]?members[_0x56123a[_0x3ad5('0x18')]][_0x3ad5('0x7')]:_0x56123a[_0x3ad5('0x18')],_0x56123a[_0x3ad5('0x1a')],_0x56123a[_0x3ad5('0x18')]));switch(_0x56123a[_0x3ad5('0x1a')]){case _0x3ad5('0x1b'):case'BUSY':if(!startsWith(exclude,_0x56123a[_0x3ad5('0x18')])){members[_0x56123a['device']]={'channel':_0x3ad5('0x1c'),'interface':_0x56123a['device'],'type':_0x3ad5('0x1d'),'enterAt':utils[_0x3ad5('0x1e')](),'role':_0x3ad5('0x1f')};}break;case _0x3ad5('0x20'):if(!_[_0x3ad5('0x21')](members[_0x56123a[_0x3ad5('0x18')]])){members[_0x56123a['device']][_0x3ad5('0x22')]=utils[_0x3ad5('0x1e')]();members[_0x56123a['device']][_0x3ad5('0x23')]=utils[_0x3ad5('0x24')](members[_0x56123a[_0x3ad5('0x18')]]['exitAt'],members[_0x56123a[_0x3ad5('0x18')]][_0x3ad5('0x25')]);if(members[_0x56123a[_0x3ad5('0x18')]]['uniqueid']){writeDB(members[_0x56123a['device']]);}}break;default:break;}}catch(_0x578463){utils[_0x3ad5('0x14')](util[_0x3ad5('0x6')](_0x3ad5('0x26'),members[_0x56123a['device']]?members[_0x56123a[_0x3ad5('0x18')]][_0x3ad5('0x7')]:_0x56123a['device']),_0x578463);}};exports['agentcomplete']=function(_0x2a402c){try{if(!_['isNil'](members[_0x2a402c[_0x3ad5('0x8')]])){utils[_0x3ad5('0x17')](util[_0x3ad5('0x6')](_0x3ad5('0x27'),_0x2a402c[_0x3ad5('0x7')]),_0x2a402c);utils['info'](util['format'](_0x3ad5('0x28'),_0x2a402c[_0x3ad5('0x7')],_0x2a402c[_0x3ad5('0x8')],_0x2a402c[_0x3ad5('0x29')]));members[_0x2a402c['interface']]=_[_0x3ad5('0x2a')](members[_0x2a402c[_0x3ad5('0x8')]],{'data4':_0x2a402c[_0x3ad5('0x29')],'uniqueid':_0x2a402c[_0x3ad5('0x7')]});}}catch(_0x2df2f6){utils[_0x3ad5('0x14')](util[_0x3ad5('0x6')](_0x3ad5('0x27'),_0x2a402c[_0x3ad5('0x7')]),_0x2df2f6);}};exports[_0x3ad5('0x2b')]=function(_0x53a00c){try{utils[_0x3ad5('0x17')](util[_0x3ad5('0x6')](_0x3ad5('0x2c'),_0x53a00c[_0x3ad5('0x7')]),_0x53a00c);if(_0x53a00c[_0x3ad5('0x9')]){var _0x41240f=_0x53a00c[_0x3ad5('0x9')]['split']('-')[0x0];if(!_['isNil'](members[_0x41240f])){members[_0x41240f]=_[_0x3ad5('0x2a')](members[_0x41240f],{'data1':members[_0x41240f][_0x3ad5('0x2d')]||_0x53a00c['type'],'data2':members[_0x41240f][_0x3ad5('0xa')]||_0x53a00c[_0x3ad5('0x2e')],'data3':members[_0x41240f][_0x3ad5('0x2f')]||_0x53a00c[_0x3ad5('0x30')],'uniqueid':members[_0x41240f][_0x3ad5('0x7')]||_0x53a00c[_0x3ad5('0x7')]});utils[_0x3ad5('0x5')](util[_0x3ad5('0x6')](_0x3ad5('0x31'),_0x53a00c[_0x3ad5('0x7')],members[_0x41240f][_0x3ad5('0x2d')],members[_0x41240f][_0x3ad5('0xa')],members[_0x41240f][_0x3ad5('0x2f')]));if(members[_0x41240f]['exitAt']){writeDB(members[_0x41240f]);}}}if(_0x53a00c[_0x3ad5('0x32')]){var _0x5cf352=_0x53a00c[_0x3ad5('0x32')][_0x3ad5('0x11')]('-')[0x0];if(!_[_0x3ad5('0x21')](members[_0x5cf352])){members[_0x5cf352]=_[_0x3ad5('0x2a')](members[_0x5cf352],{'data1':members[_0x5cf352][_0x3ad5('0x2d')]||_0x53a00c[_0x3ad5('0x33')],'data2':members[_0x5cf352][_0x3ad5('0xa')]||_0x53a00c['source'],'data3':members[_0x5cf352]['data3']||_0x53a00c[_0x3ad5('0x30')],'uniqueid':members[_0x5cf352][_0x3ad5('0x7')]||_0x53a00c[_0x3ad5('0x7')]});utils[_0x3ad5('0x5')](util[_0x3ad5('0x6')](_0x3ad5('0x31'),_0x53a00c[_0x3ad5('0x7')],members[_0x5cf352][_0x3ad5('0x2d')],members[_0x5cf352][_0x3ad5('0xa')],members[_0x5cf352][_0x3ad5('0x2f')]));if(members[_0x5cf352][_0x3ad5('0x22')]){writeDB(members[_0x5cf352]);}}}}catch(_0x3ea7e5){utils[_0x3ad5('0x14')](util[_0x3ad5('0x6')](_0x3ad5('0x2c'),_0x53a00c[_0x3ad5('0x7')]),_0x3ea7e5);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index c2774b6..c9961c3 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 _0xcb93=['origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','variable','queuestatus','toUpperCase','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','now','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xcb93,0x1a6));var _0x3cb9=function(_0x3807de,_0x53e08d){_0x3807de=_0x3807de-0x0;var _0x6fbce=_0xcb93[_0x3807de];return _0x6fbce;};'use strict';var _=require(_0x3cb9('0x0'));var util=require('util');var utils=require(_0x3cb9('0x1'));var queues={};function writeDB(_0xd6cab5){utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x4'),_0xd6cab5[_0x3cb9('0x5')],_0xd6cab5['channel'],_0xd6cab5[_0x3cb9('0x6')],_0xd6cab5[_0x3cb9('0x7')],_0xd6cab5[_0x3cb9('0x8')],_0xd6cab5[_0x3cb9('0x9')],_0xd6cab5[_0x3cb9('0xa')]));if(_0xd6cab5[_0x3cb9('0x6')]){utils[_0x3cb9('0xb')](_0xd6cab5[_0x3cb9('0x6')])[_0x3cb9('0xc')](function(_0x52f95e){if(_0x52f95e){_0xd6cab5[_0x3cb9('0xd')]=_0x52f95e[_0x3cb9('0xd')];}utils[_0x3cb9('0xe')](_0x3cb9('0xf'),_0xd6cab5);});}else{utils['request'](_0x3cb9('0xf'),_0xd6cab5);}if(_0xd6cab5['transfereduniqueid']){delete queues[_0xd6cab5[_0x3cb9('0x10')]];}else{delete queues[_0xd6cab5[_0x3cb9('0x5')]];}}exports[_0x3cb9('0x11')]=function(_0x1ce6aa){try{utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')](_0x3cb9('0x13'),_0x1ce6aa[_0x3cb9('0x5')]),_0x1ce6aa);utils['info'](util[_0x3cb9('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x1ce6aa['uniqueid'],_0x1ce6aa['queue'],_0x1ce6aa[_0x3cb9('0x14')]));queues[_0x1ce6aa[_0x3cb9('0x5')]]=_['assign'](_0x1ce6aa,{'originalposition':_0x1ce6aa[_0x3cb9('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4438d8){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')](_0x3cb9('0x13'),_0x1ce6aa[_0x3cb9('0x5')]),_0x4438d8);}};exports[_0x3cb9('0x16')]=function(_0x28feaa){try{if(!_['isNil'](queues[_0x28feaa[_0x3cb9('0x5')]])){utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')](_0x3cb9('0x17'),_0x28feaa[_0x3cb9('0x5')]),_0x28feaa);if(queues[_0x28feaa['uniqueid']][_0x3cb9('0x18')]){if(!queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0x19')]&&!queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0x1a')]){queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0x1b')]=!![];queues[_0x28feaa[_0x3cb9('0x5')]]['queuecallercompleteAt']=utils['now']();queues[_0x28feaa[_0x3cb9('0x5')]]['queuecallerexitreason']=_0x3cb9('0x1c');}utils['info'](util[_0x3cb9('0x3')](_0x3cb9('0x1d'),_0x28feaa[_0x3cb9('0x5')],queues[_0x28feaa[_0x3cb9('0x5')]]['name'],queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0xa')]));writeDB(queues[_0x28feaa['uniqueid']]);}else if(queues[_0x28feaa['uniqueid']]['transfereduniqueid']){utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x1e'),_0x28feaa[_0x3cb9('0x5')],queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0x1f')],queues[_0x28feaa[_0x3cb9('0x5')]]['transfereduniqueid']));queues[queues[_0x28feaa['uniqueid']][_0x3cb9('0x10')]]=queues[_0x28feaa[_0x3cb9('0x5')]];queues[queues[_0x28feaa[_0x3cb9('0x5')]][_0x3cb9('0x10')]][_0x3cb9('0x20')]=0x2;delete queues[_0x28feaa[_0x3cb9('0x5')]];}}}catch(_0x19cdf6){utils['error'](util['format'](_0x3cb9('0x17'),_0x28feaa[_0x3cb9('0x5')]),_0x19cdf6);}};exports[_0x3cb9('0x21')]=function(_0x46eee1){try{utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')](_0x3cb9('0x22'),_0x46eee1[_0x3cb9('0x5')]),_0x46eee1);if(!_[_0x3cb9('0x23')](_0x46eee1[_0x3cb9('0x24')][_0x3cb9('0x25')])&&_0x46eee1['value'][_0x3cb9('0x26')]()!=='CONTINUE'){if(!_[_0x3cb9('0x23')](queues[_0x46eee1[_0x3cb9('0x5')]])){queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x19')]=![];queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x27')]=null;queues[_0x46eee1['uniqueid']]['queuecallerexit']=!![];queues[_0x46eee1['uniqueid']][_0x3cb9('0x28')]=utils['now']();queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0xa')]=_0x46eee1[_0x3cb9('0x29')][_0x3cb9('0x26')]();utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x2a'),_0x46eee1[_0x3cb9('0x5')],queues[_0x46eee1[_0x3cb9('0x5')]]['name'],_0x46eee1['value'],queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0xa')]));writeDB(queues[_0x46eee1['uniqueid']]);}}else if(!_[_0x3cb9('0x23')](_0x46eee1[_0x3cb9('0x24')][_0x3cb9('0x2b')])){if(!_[_0x3cb9('0x23')](queues[_0x46eee1[_0x3cb9('0x5')]])&&!queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x19')]){queues[_0x46eee1['uniqueid']]['queuecallerabandon']=![];queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x27')]=null;queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x1a')]=!![];queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x28')]=utils[_0x3cb9('0x2c')]();queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0xa')]=_0x3cb9('0x2d');utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x2e'),_0x46eee1[_0x3cb9('0x5')],queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0x1f')],_0x46eee1[_0x3cb9('0x29')],queues[_0x46eee1[_0x3cb9('0x5')]][_0x3cb9('0xa')]));}}}catch(_0x27f8a8){utils[_0x3cb9('0x15')](util['format'](_0x3cb9('0x22'),_0x46eee1[_0x3cb9('0x5')]),_0x27f8a8);}};exports['queuecallerabandon']=function(_0x1266b5){try{if(!_[_0x3cb9('0x23')](queues[_0x1266b5[_0x3cb9('0x5')]])){utils[_0x3cb9('0x12')](util['format'](_0x3cb9('0x2f'),_0x1266b5[_0x3cb9('0x5')]),_0x1266b5);queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0x1a')]=![];queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0x28')]=null;queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0x19')]=!![];queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0x27')]=utils['now']();queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0xa')]=_0x3cb9('0x30');utils['info'](util[_0x3cb9('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1266b5[_0x3cb9('0x5')],queues[_0x1266b5[_0x3cb9('0x5')]][_0x3cb9('0x1f')],queues[_0x1266b5['uniqueid']][_0x3cb9('0xa')]));}}catch(_0x5979c3){utils[_0x3cb9('0x15')](util['format']('[%s][queues][queuecallerabandon]',_0x1266b5[_0x3cb9('0x5')]),_0x5979c3);}};exports[_0x3cb9('0x31')]=function(_0x134cd7){try{if(!_[_0x3cb9('0x23')](queues[_0x134cd7[_0x3cb9('0x5')]])){utils['debug'](util['format']('[%s][queues][queuecallerleave]',_0x134cd7['uniqueid']),_0x134cd7);utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x32'),_0x134cd7[_0x3cb9('0x5')],queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x1f')],_0x134cd7['connectedlinenum'],_0x134cd7[_0x3cb9('0x33')]));queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x31')]=!![];queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x18')]=utils[_0x3cb9('0x2c')]();queues[_0x134cd7['uniqueid']][_0x3cb9('0x34')]=utils[_0x3cb9('0x35')](queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x18')],queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x36')]);queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x14')]=_0x134cd7[_0x3cb9('0x14')];queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x37')]=_0x134cd7[_0x3cb9('0x37')];queues[_0x134cd7[_0x3cb9('0x5')]][_0x3cb9('0x38')]=_0x134cd7[_0x3cb9('0x38')];queues[_0x134cd7['uniqueid']]['connectedlinename']=_0x134cd7[_0x3cb9('0x33')];}}catch(_0x3878ee){utils[_0x3cb9('0x15')](util['format']('[%s][queues][queuecallerleave]',_0x134cd7[_0x3cb9('0x5')]),_0x3878ee);}};exports[_0x3cb9('0x39')]=function(_0x5b63b8){try{if(!_[_0x3cb9('0x23')](queues[_0x5b63b8[_0x3cb9('0x5')]])){utils[_0x3cb9('0x12')](util['format'](_0x3cb9('0x3a'),_0x5b63b8[_0x3cb9('0x5')]),_0x5b63b8);utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5b63b8['uniqueid'],queues[_0x5b63b8[_0x3cb9('0x5')]][_0x3cb9('0x1f')],_0x5b63b8[_0x3cb9('0x3b')],_0x5b63b8[_0x3cb9('0x3c')]));queues[_0x5b63b8[_0x3cb9('0x5')]]['queuecallerabandon']=![];queues[_0x5b63b8['uniqueid']]['queuecallerabandon']=![];queues[_0x5b63b8[_0x3cb9('0x5')]][_0x3cb9('0x27')]=null;queues[_0x5b63b8[_0x3cb9('0x5')]]['queuecallerexit']=![];queues[_0x5b63b8[_0x3cb9('0x5')]][_0x3cb9('0xa')]=null;queues[_0x5b63b8[_0x3cb9('0x5')]][_0x3cb9('0x28')]=null;queues[_0x5b63b8[_0x3cb9('0x5')]][_0x3cb9('0x3d')]=!![];queues[_0x5b63b8['uniqueid']][_0x3cb9('0x9')]=_0x5b63b8[_0x3cb9('0x3c')];queues[_0x5b63b8[_0x3cb9('0x5')]]['lastAssignedTo']=_0x5b63b8[_0x3cb9('0x3b')];}}catch(_0xdadb8a){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')](_0x3cb9('0x3a'),_0x5b63b8[_0x3cb9('0x5')]),_0xdadb8a);}};exports['agentcomplete']=function(_0x11cfdd){try{if(!_[_0x3cb9('0x23')](queues[_0x11cfdd[_0x3cb9('0x5')]])){if(queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x18')]){utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')](_0x3cb9('0x3e'),_0x11cfdd[_0x3cb9('0x5')]),_0x11cfdd);queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x19')]=![];queues[_0x11cfdd['uniqueid']][_0x3cb9('0x19')]=![];queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x27')]=null;queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x1a')]=![];queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x28')]=null;queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x3d')]=!![];queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x7')]=_0x11cfdd[_0x3cb9('0x3b')];queues[_0x11cfdd[_0x3cb9('0x5')]]['queuecallercomplete']=!![];queues[_0x11cfdd[_0x3cb9('0x5')]]['queuecallercompleteAt']=utils['now']();if(_0x11cfdd[_0x3cb9('0x3f')]==_0x3cb9('0x40')){if(!queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x40')]){queues[_0x11cfdd['uniqueid']]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0xa')]='COMPLETEDBY'+_0x11cfdd[_0x3cb9('0x3f')][_0x3cb9('0x26')]();}utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x41'),_0x11cfdd[_0x3cb9('0x5')],queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0x1f')],_0x11cfdd['membername'],queues[_0x11cfdd[_0x3cb9('0x5')]][_0x3cb9('0xa')]));writeDB(queues[_0x11cfdd[_0x3cb9('0x5')]]);}}}catch(_0x241adb){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')](_0x3cb9('0x3e'),_0x11cfdd[_0x3cb9('0x5')]),_0x241adb);}};exports[_0x3cb9('0x42')]=function(_0x4a0eb0){try{if(!_[_0x3cb9('0x23')](queues[_0x4a0eb0[_0x3cb9('0x43')]])){utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')](_0x3cb9('0x44'),_0x4a0eb0['uniqueid']),_0x4a0eb0);queues[_0x4a0eb0[_0x3cb9('0x43')]][_0x3cb9('0x40')]=!![];queues[_0x4a0eb0[_0x3cb9('0x43')]][_0x3cb9('0x45')]=_0x3cb9('0x46');queues[_0x4a0eb0[_0x3cb9('0x43')]][_0x3cb9('0x47')]=_0x4a0eb0[_0x3cb9('0x48')];queues[_0x4a0eb0[_0x3cb9('0x43')]]['transferuniqueid']=_0x4a0eb0[_0x3cb9('0x43')];queues[_0x4a0eb0[_0x3cb9('0x43')]][_0x3cb9('0xa')]='BLINDTRANSFER';utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x49'),_0x4a0eb0[_0x3cb9('0x5')],queues[_0x4a0eb0[_0x3cb9('0x43')]][_0x3cb9('0x1f')],_0x4a0eb0[_0x3cb9('0x43')],_0x4a0eb0['extension']));}}catch(_0x3391ad){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')](_0x3cb9('0x44'),_0x4a0eb0[_0x3cb9('0x5')]),_0x3391ad);}};exports[_0x3cb9('0x4a')]=function(_0x2c52d7){try{utils[_0x3cb9('0x12')](util['format'](_0x3cb9('0x4b'),_0x2c52d7[_0x3cb9('0x4c')]),_0x2c52d7);if(_0x2c52d7[_0x3cb9('0x4c')]==_0x2c52d7['origtransfererlinkedid']){if(!_[_0x3cb9('0x23')](queues[_0x2c52d7['secondtransfererlinkedid']])){utils['info'](util['format'](_0x3cb9('0x4d'),_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x1f')],_0x2c52d7[_0x3cb9('0x4f')]));queues[_0x2c52d7['secondtransfererlinkedid']][_0x3cb9('0x40')]=!![];queues[_0x2c52d7['secondtransfererlinkedid']][_0x3cb9('0x45')]=_0x3cb9('0x50');queues[_0x2c52d7[_0x3cb9('0x4e')]]['transferexten']=_0x2c52d7['origtransfererexten'];queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x51')]=_0x2c52d7[_0x3cb9('0x4c')];queues[_0x2c52d7['secondtransfererlinkedid']]['queuecallerexitreason']=_0x3cb9('0x52');}if(!_[_0x3cb9('0x23')](queues[_0x2c52d7[_0x3cb9('0x53')]])){if(_0x2c52d7[_0x3cb9('0x54')]&&queues[_0x2c52d7[_0x3cb9('0x54')]]){queues[_0x2c52d7[_0x3cb9('0x54')]]['queuecallerenterreason']=0x1;queues[_0x2c52d7[_0x3cb9('0x43')]]=_['clone'](queues[_0x2c52d7[_0x3cb9('0x54')]]);queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x10')]=_0x2c52d7[_0x3cb9('0x55')];queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x20')]=0x2;queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x8')]=queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x8')];queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x56')]=queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x56')];queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x36')]=utils[_0x3cb9('0x2c')]();queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x18')]=utils['now']();queues[_0x2c52d7[_0x3cb9('0x43')]]['holdtime']=0x0;queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x57')]=0x0;utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x58'),_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7['transfereeuniqueid']]['name'],queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x8')],queues[_0x2c52d7[_0x3cb9('0x43')]][_0x3cb9('0x56')]));}else{utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x59'),_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0x1f')],_0x2c52d7[_0x3cb9('0x4e')]));queues[_0x2c52d7['origtransfererlinkedid']][_0x3cb9('0x10')]=_0x2c52d7['secondtransfererlinkedid'];}}}else if(_0x2c52d7[_0x3cb9('0x5a')]==_0x2c52d7['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x2c52d7['origtransfererlinkedid']])){utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7[_0x3cb9('0x53')]]['name'],_0x2c52d7['secondtransfereruniqueid'],_0x2c52d7[_0x3cb9('0x5b')]));queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0x40')]=!![];queues[_0x2c52d7['origtransfererlinkedid']][_0x3cb9('0x45')]=_0x3cb9('0x50');queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0x47')]=_0x2c52d7[_0x3cb9('0x5b')];queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0x51')]=_0x2c52d7[_0x3cb9('0x5a')];queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0xa')]=_0x3cb9('0x52');}if(!_[_0x3cb9('0x23')](queues[_0x2c52d7[_0x3cb9('0x4e')]])){if(_0x2c52d7[_0x3cb9('0x5c')]&&queues[_0x2c52d7['transfertargetlinkedid']]){queues[_0x2c52d7[_0x3cb9('0x5c')]]['queuecallerenterreason']=0x1;queues[_0x2c52d7[_0x3cb9('0x55')]]=_[_0x3cb9('0x5d')](queues[_0x2c52d7['transfertargetlinkedid']]);queues[_0x2c52d7['transfertargetuniqueid']]['transfereduniqueid']=_0x2c52d7['transfertargetuniqueid'];queues[_0x2c52d7[_0x3cb9('0x55')]]['queuecallerenterreason']=0x2;queues[_0x2c52d7['transfertargetuniqueid']][_0x3cb9('0x8')]=queues[_0x2c52d7[_0x3cb9('0x53')]][_0x3cb9('0x8')];queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x56')]=queues[_0x2c52d7['origtransfererlinkedid']][_0x3cb9('0x56')];queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x36')]=utils[_0x3cb9('0x2c')]();queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x18')]=utils[_0x3cb9('0x2c')]();queues[_0x2c52d7['transfertargetuniqueid']][_0x3cb9('0x34')]=0x0;queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x57')]=0x0;utils['info'](util[_0x3cb9('0x3')](_0x3cb9('0x5e'),_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x1f')],queues[_0x2c52d7[_0x3cb9('0x55')]][_0x3cb9('0x10')],queues[_0x2c52d7['transfertargetuniqueid']][_0x3cb9('0x8')],queues[_0x2c52d7[_0x3cb9('0x55')]]['calleridname']));}else{utils['info'](util[_0x3cb9('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2c52d7[_0x3cb9('0x4c')],queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x1f')],_0x2c52d7[_0x3cb9('0x53')]));queues[_0x2c52d7[_0x3cb9('0x4e')]][_0x3cb9('0x10')]=_0x2c52d7[_0x3cb9('0x53')];}}}}catch(_0x3cba57){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')](_0x3cb9('0x4b'),_0x2c52d7[_0x3cb9('0x4c')]),_0x3cba57);}};exports[_0x3cb9('0x5f')]=function(_0x18cbd3){try{if(!_[_0x3cb9('0x23')](queues[_0x18cbd3['uniqueid']])){utils['debug'](util['format'](_0x3cb9('0x60'),_0x18cbd3['uniqueid']),_0x18cbd3);queues[_0x18cbd3[_0x3cb9('0x5')]]['musiconholdstartAt']=utils['now']();utils[_0x3cb9('0x2')](util[_0x3cb9('0x3')](_0x3cb9('0x61'),_0x18cbd3['uniqueid'],queues[_0x18cbd3[_0x3cb9('0x5')]][_0x3cb9('0x1f')],queues[_0x18cbd3[_0x3cb9('0x5')]][_0x3cb9('0x62')]));}}catch(_0x2f745f){utils[_0x3cb9('0x15')](util[_0x3cb9('0x3')]('[%s][queues][musiconholdstart]',_0x18cbd3[_0x3cb9('0x5')]),_0x2f745f);}};exports[_0x3cb9('0x63')]=function(_0x3460d5){try{if(!_['isNil'](queues[_0x3460d5[_0x3cb9('0x5')]])){if(!_[_0x3cb9('0x23')](queues[_0x3460d5[_0x3cb9('0x5')]][_0x3cb9('0x62')])){utils[_0x3cb9('0x12')](util[_0x3cb9('0x3')]('[%s][queues][musiconholdstop]',_0x3460d5[_0x3cb9('0x5')]),_0x3460d5);queues[_0x3460d5[_0x3cb9('0x5')]]['mohtime']+=utils[_0x3cb9('0x35')](utils[_0x3cb9('0x2c')](),queues[_0x3460d5[_0x3cb9('0x5')]][_0x3cb9('0x62')]);utils['info'](util[_0x3cb9('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x3460d5[_0x3cb9('0x5')],queues[_0x3460d5['uniqueid']][_0x3cb9('0x1f')],queues[_0x3460d5[_0x3cb9('0x5')]][_0x3cb9('0x57')]));delete queues[_0x3460d5[_0x3cb9('0x5')]]['musiconholdstartAt'];}}}catch(_0x2f1380){utils['error'](util['format'](_0x3cb9('0x64'),_0x3460d5['uniqueid']),_0x2f1380);}}; \ No newline at end of file +var _0x8c10=['lodash','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','membername','destaccountcode','assigned','[%s][queues][agentconnect]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]'];(function(_0x3b18ce,_0x4e0e0d){var _0x1e3be0=function(_0x5b0b4e){while(--_0x5b0b4e){_0x3b18ce['push'](_0x3b18ce['shift']());}};_0x1e3be0(++_0x4e0e0d);}(_0x8c10,0x138));var _0x08c1=function(_0x5c8523,_0x4ea9bb){_0x5c8523=_0x5c8523-0x0;var _0x496c1c=_0x8c10[_0x5c8523];return _0x496c1c;};'use strict';var _=require(_0x08c1('0x0'));var util=require('util');var utils=require(_0x08c1('0x1'));var queues={};function writeDB(_0x26620b){utils[_0x08c1('0x2')](util['format'](_0x08c1('0x3'),_0x26620b['uniqueid'],_0x26620b[_0x08c1('0x4')],_0x26620b[_0x08c1('0x5')],_0x26620b[_0x08c1('0x6')],_0x26620b[_0x08c1('0x7')],_0x26620b[_0x08c1('0x8')],_0x26620b[_0x08c1('0x9')]));if(_0x26620b[_0x08c1('0x5')]){utils[_0x08c1('0xa')](_0x26620b['queue'])[_0x08c1('0xb')](function(_0x55d5da){if(_0x55d5da){_0x26620b[_0x08c1('0xc')]=_0x55d5da[_0x08c1('0xc')];}utils['request'](_0x08c1('0xd'),_0x26620b);});}else{utils[_0x08c1('0xe')](_0x08c1('0xd'),_0x26620b);}if(_0x26620b['transfereduniqueid']){delete queues[_0x26620b[_0x08c1('0xf')]];}else{delete queues[_0x26620b[_0x08c1('0x10')]];}}exports['queuecallerjoin']=function(_0x3155d9){try{utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x13'),_0x3155d9[_0x08c1('0x10')]),_0x3155d9);utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x14'),_0x3155d9['uniqueid'],_0x3155d9[_0x08c1('0x5')],_0x3155d9['position']));queues[_0x3155d9[_0x08c1('0x10')]]=_[_0x08c1('0x15')](_0x3155d9,{'originalposition':_0x3155d9[_0x08c1('0x16')],'queuecallerjoinAt':utils[_0x08c1('0x17')](),'mohtime':0x0});}catch(_0x170298){utils[_0x08c1('0x18')](util['format'](_0x08c1('0x13'),_0x3155d9[_0x08c1('0x10')]),_0x170298);}};exports[_0x08c1('0x19')]=function(_0x4ac18e){try{if(!_[_0x08c1('0x1a')](queues[_0x4ac18e['uniqueid']])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x1b'),_0x4ac18e[_0x08c1('0x10')]),_0x4ac18e);if(queues[_0x4ac18e[_0x08c1('0x10')]]['queuecallerleaveAt']){if(!queues[_0x4ac18e[_0x08c1('0x10')]]['queuecallerabandon']&&!queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0x1c')]){queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0x1d')]=!![];queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0x1e')]=utils[_0x08c1('0x17')]();queues[_0x4ac18e['uniqueid']][_0x08c1('0x9')]=_0x08c1('0x1f');}utils[_0x08c1('0x2')](util['format'](_0x08c1('0x20'),_0x4ac18e[_0x08c1('0x10')],queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0x21')],queues[_0x4ac18e[_0x08c1('0x10')]]['queuecallerexitreason']));writeDB(queues[_0x4ac18e[_0x08c1('0x10')]]);}else if(queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0xf')]){utils['info'](util[_0x08c1('0x12')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4ac18e[_0x08c1('0x10')],queues[_0x4ac18e['uniqueid']]['name'],queues[_0x4ac18e[_0x08c1('0x10')]][_0x08c1('0xf')]));queues[queues[_0x4ac18e[_0x08c1('0x10')]]['transfereduniqueid']]=queues[_0x4ac18e[_0x08c1('0x10')]];queues[queues[_0x4ac18e['uniqueid']][_0x08c1('0xf')]][_0x08c1('0x22')]=0x2;delete queues[_0x4ac18e[_0x08c1('0x10')]];}}}catch(_0x285974){utils[_0x08c1('0x18')](util[_0x08c1('0x12')](_0x08c1('0x1b'),_0x4ac18e['uniqueid']),_0x285974);}};exports[_0x08c1('0x23')]=function(_0x43502a){try{utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x24'),_0x43502a['uniqueid']),_0x43502a);if(!_[_0x08c1('0x1a')](_0x43502a[_0x08c1('0x25')][_0x08c1('0x26')])&&_0x43502a['value'][_0x08c1('0x27')]()!==_0x08c1('0x28')){if(!_['isNil'](queues[_0x43502a['uniqueid']])){queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x29')]=![];queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x2a')]=null;queues[_0x43502a[_0x08c1('0x10')]]['queuecallerexit']=!![];queues[_0x43502a['uniqueid']][_0x08c1('0x2b')]=utils['now']();queues[_0x43502a[_0x08c1('0x10')]]['queuecallerexitreason']=_0x43502a[_0x08c1('0x2c')][_0x08c1('0x27')]();utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x2d'),_0x43502a[_0x08c1('0x10')],queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x21')],_0x43502a[_0x08c1('0x2c')],queues[_0x43502a['uniqueid']][_0x08c1('0x9')]));writeDB(queues[_0x43502a[_0x08c1('0x10')]]);}}else if(!_[_0x08c1('0x1a')](_0x43502a[_0x08c1('0x25')][_0x08c1('0x2e')])){if(!_[_0x08c1('0x1a')](queues[_0x43502a[_0x08c1('0x10')]])&&!queues[_0x43502a[_0x08c1('0x10')]]['queuecallerabandon']){queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x29')]=![];queues[_0x43502a[_0x08c1('0x10')]]['queuecallerabandonAt']=null;queues[_0x43502a['uniqueid']][_0x08c1('0x1c')]=!![];queues[_0x43502a[_0x08c1('0x10')]]['queuecallerexitAt']=utils['now']();queues[_0x43502a[_0x08c1('0x10')]]['queuecallerexitreason']='EXITWITHKEY';utils['info'](util[_0x08c1('0x12')](_0x08c1('0x2f'),_0x43502a[_0x08c1('0x10')],queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x21')],_0x43502a[_0x08c1('0x2c')],queues[_0x43502a[_0x08c1('0x10')]][_0x08c1('0x9')]));}}}catch(_0x514918){utils[_0x08c1('0x18')](util['format'](_0x08c1('0x24'),_0x43502a[_0x08c1('0x10')]),_0x514918);}};exports[_0x08c1('0x29')]=function(_0x551db4){try{if(!_[_0x08c1('0x1a')](queues[_0x551db4[_0x08c1('0x10')]])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x30'),_0x551db4[_0x08c1('0x10')]),_0x551db4);queues[_0x551db4[_0x08c1('0x10')]][_0x08c1('0x1c')]=![];queues[_0x551db4['uniqueid']][_0x08c1('0x2b')]=null;queues[_0x551db4['uniqueid']][_0x08c1('0x29')]=!![];queues[_0x551db4[_0x08c1('0x10')]][_0x08c1('0x2a')]=utils[_0x08c1('0x17')]();queues[_0x551db4[_0x08c1('0x10')]][_0x08c1('0x9')]=_0x08c1('0x31');utils[_0x08c1('0x2')](util[_0x08c1('0x12')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x551db4[_0x08c1('0x10')],queues[_0x551db4[_0x08c1('0x10')]][_0x08c1('0x21')],queues[_0x551db4[_0x08c1('0x10')]][_0x08c1('0x9')]));}}catch(_0x2891af){utils['error'](util['format'](_0x08c1('0x30'),_0x551db4[_0x08c1('0x10')]),_0x2891af);}};exports[_0x08c1('0x32')]=function(_0x1f50d0){try{if(!_[_0x08c1('0x1a')](queues[_0x1f50d0[_0x08c1('0x10')]])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')]('[%s][queues][queuecallerleave]',_0x1f50d0['uniqueid']),_0x1f50d0);utils[_0x08c1('0x2')](util['format'](_0x08c1('0x33'),_0x1f50d0[_0x08c1('0x10')],queues[_0x1f50d0['uniqueid']][_0x08c1('0x21')],_0x1f50d0['connectedlinenum'],_0x1f50d0[_0x08c1('0x34')]));queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x32')]=!![];queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x35')]=utils['now']();queues[_0x1f50d0[_0x08c1('0x10')]]['holdtime']=utils[_0x08c1('0x36')](queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x35')],queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x37')]);queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x16')]=_0x1f50d0[_0x08c1('0x16')];queues[_0x1f50d0[_0x08c1('0x10')]]['count']=_0x1f50d0[_0x08c1('0x38')];queues[_0x1f50d0[_0x08c1('0x10')]]['connectedlinenum']=_0x1f50d0['connectedlinenum'];queues[_0x1f50d0[_0x08c1('0x10')]][_0x08c1('0x34')]=_0x1f50d0[_0x08c1('0x34')];}}catch(_0x424065){utils[_0x08c1('0x18')](util[_0x08c1('0x12')](_0x08c1('0x39'),_0x1f50d0[_0x08c1('0x10')]),_0x424065);}};exports['agentconnect']=function(_0x4242ea){try{if(!_[_0x08c1('0x1a')](queues[_0x4242ea[_0x08c1('0x10')]])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')]('[%s][queues][agentconnect]',_0x4242ea[_0x08c1('0x10')]),_0x4242ea);utils[_0x08c1('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4242ea['uniqueid'],queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x21')],_0x4242ea[_0x08c1('0x3a')],_0x4242ea[_0x08c1('0x3b')]));queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x29')]=![];queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x29')]=![];queues[_0x4242ea['uniqueid']][_0x08c1('0x2a')]=null;queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x1c')]=![];queues[_0x4242ea['uniqueid']]['queuecallerexitreason']=null;queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x2b')]=null;queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x3c')]=!![];queues[_0x4242ea['uniqueid']][_0x08c1('0x8')]=_0x4242ea[_0x08c1('0x3b')];queues[_0x4242ea[_0x08c1('0x10')]][_0x08c1('0x6')]=_0x4242ea[_0x08c1('0x3a')];}}catch(_0x1764fe){utils[_0x08c1('0x18')](util['format'](_0x08c1('0x3d'),_0x4242ea[_0x08c1('0x10')]),_0x1764fe);}};exports['agentcomplete']=function(_0x577282){try{if(!_[_0x08c1('0x1a')](queues[_0x577282[_0x08c1('0x10')]])){if(queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x35')]){utils[_0x08c1('0x11')](util[_0x08c1('0x12')]('[%s][queues][agentcomplete]',_0x577282[_0x08c1('0x10')]),_0x577282);queues[_0x577282['uniqueid']]['queuecallerabandon']=![];queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x29')]=![];queues[_0x577282['uniqueid']][_0x08c1('0x2a')]=null;queues[_0x577282[_0x08c1('0x10')]]['queuecallerexit']=![];queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x2b')]=null;queues[_0x577282[_0x08c1('0x10')]]['assigned']=!![];queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x6')]=_0x577282[_0x08c1('0x3a')];queues[_0x577282['uniqueid']]['queuecallercomplete']=!![];queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x1e')]=utils['now']();if(_0x577282[_0x08c1('0x3e')]=='transfer'){if(!queues[_0x577282['uniqueid']][_0x08c1('0x3f')]){queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x9')]=_0x08c1('0x40');}}else{queues[_0x577282[_0x08c1('0x10')]]['queuecallerexitreason']=_0x08c1('0x41')+_0x577282[_0x08c1('0x3e')][_0x08c1('0x27')]();}utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x42'),_0x577282[_0x08c1('0x10')],queues[_0x577282['uniqueid']]['name'],_0x577282[_0x08c1('0x3a')],queues[_0x577282[_0x08c1('0x10')]][_0x08c1('0x9')]));writeDB(queues[_0x577282[_0x08c1('0x10')]]);}}}catch(_0x27ccdc){utils[_0x08c1('0x18')](util[_0x08c1('0x12')](_0x08c1('0x43'),_0x577282[_0x08c1('0x10')]),_0x27ccdc);}};exports[_0x08c1('0x44')]=function(_0x49682f){try{if(!_[_0x08c1('0x1a')](queues[_0x49682f[_0x08c1('0x45')]])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x46'),_0x49682f[_0x08c1('0x10')]),_0x49682f);queues[_0x49682f['transfereeuniqueid']][_0x08c1('0x3f')]=!![];queues[_0x49682f['transfereeuniqueid']]['transfertype']=_0x08c1('0x47');queues[_0x49682f[_0x08c1('0x45')]][_0x08c1('0x48')]=_0x49682f['extension'];queues[_0x49682f[_0x08c1('0x45')]][_0x08c1('0x49')]=_0x49682f[_0x08c1('0x45')];queues[_0x49682f[_0x08c1('0x45')]][_0x08c1('0x9')]='BLINDTRANSFER';utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x4a'),_0x49682f[_0x08c1('0x10')],queues[_0x49682f[_0x08c1('0x45')]][_0x08c1('0x21')],_0x49682f['transfereeuniqueid'],_0x49682f[_0x08c1('0x4b')]));}}catch(_0x575398){utils[_0x08c1('0x18')](util['format'](_0x08c1('0x46'),_0x49682f[_0x08c1('0x10')]),_0x575398);}};exports[_0x08c1('0x4c')]=function(_0x18ea39){try{utils[_0x08c1('0x11')](util[_0x08c1('0x12')](_0x08c1('0x4d'),_0x18ea39[_0x08c1('0x4e')]),_0x18ea39);if(_0x18ea39[_0x08c1('0x4e')]==_0x18ea39[_0x08c1('0x4f')]){if(!_['isNil'](queues[_0x18ea39[_0x08c1('0x50')]])){utils['info'](util[_0x08c1('0x12')](_0x08c1('0x51'),_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39['secondtransfererlinkedid']][_0x08c1('0x21')],_0x18ea39[_0x08c1('0x52')]));queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x3f')]=!![];queues[_0x18ea39['secondtransfererlinkedid']][_0x08c1('0x53')]=_0x08c1('0x54');queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x48')]=_0x18ea39[_0x08c1('0x52')];queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x49')]=_0x18ea39[_0x08c1('0x4e')];queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x9')]=_0x08c1('0x55');}if(!_[_0x08c1('0x1a')](queues[_0x18ea39['origtransfererlinkedid']])){if(_0x18ea39[_0x08c1('0x56')]&&queues[_0x18ea39['transfereelinkedid']]){queues[_0x18ea39[_0x08c1('0x56')]][_0x08c1('0x22')]=0x1;queues[_0x18ea39[_0x08c1('0x45')]]=_[_0x08c1('0x57')](queues[_0x18ea39[_0x08c1('0x56')]]);queues[_0x18ea39[_0x08c1('0x45')]]['transfereduniqueid']=_0x18ea39['transfertargetuniqueid'];queues[_0x18ea39[_0x08c1('0x45')]]['queuecallerenterreason']=0x2;queues[_0x18ea39['transfereeuniqueid']]['calleridnum']=queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x7')];queues[_0x18ea39['transfereeuniqueid']][_0x08c1('0x58')]=queues[_0x18ea39[_0x08c1('0x50')]]['calleridname'];queues[_0x18ea39[_0x08c1('0x45')]][_0x08c1('0x37')]=utils[_0x08c1('0x17')]();queues[_0x18ea39[_0x08c1('0x45')]][_0x08c1('0x35')]=utils[_0x08c1('0x17')]();queues[_0x18ea39['transfereeuniqueid']][_0x08c1('0x59')]=0x0;queues[_0x18ea39['transfereeuniqueid']][_0x08c1('0x5a')]=0x0;utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x5b'),_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39[_0x08c1('0x45')]][_0x08c1('0x21')],queues[_0x18ea39[_0x08c1('0x45')]][_0x08c1('0x7')],queues[_0x18ea39[_0x08c1('0x45')]][_0x08c1('0x58')]));}else{utils[_0x08c1('0x2')](util[_0x08c1('0x12')](_0x08c1('0x5c'),_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39['origtransfererlinkedid']][_0x08c1('0x21')],_0x18ea39[_0x08c1('0x50')]));queues[_0x18ea39['origtransfererlinkedid']][_0x08c1('0xf')]=_0x18ea39['secondtransfererlinkedid'];}}}else if(_0x18ea39[_0x08c1('0x5d')]==_0x18ea39[_0x08c1('0x50')]){if(!_[_0x08c1('0x1a')](queues[_0x18ea39[_0x08c1('0x4f')]])){utils['info'](util[_0x08c1('0x12')](_0x08c1('0x5e'),_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39[_0x08c1('0x4f')]][_0x08c1('0x21')],_0x18ea39[_0x08c1('0x5d')],_0x18ea39[_0x08c1('0x5f')]));queues[_0x18ea39[_0x08c1('0x4f')]][_0x08c1('0x3f')]=!![];queues[_0x18ea39[_0x08c1('0x4f')]]['transfertype']=_0x08c1('0x54');queues[_0x18ea39[_0x08c1('0x4f')]][_0x08c1('0x48')]=_0x18ea39[_0x08c1('0x5f')];queues[_0x18ea39[_0x08c1('0x4f')]][_0x08c1('0x49')]=_0x18ea39[_0x08c1('0x5d')];queues[_0x18ea39[_0x08c1('0x4f')]]['queuecallerexitreason']=_0x08c1('0x55');}if(!_[_0x08c1('0x1a')](queues[_0x18ea39[_0x08c1('0x50')]])){if(_0x18ea39['transfertargetlinkedid']&&queues[_0x18ea39[_0x08c1('0x60')]]){queues[_0x18ea39[_0x08c1('0x60')]][_0x08c1('0x22')]=0x1;queues[_0x18ea39['transfertargetuniqueid']]=_['clone'](queues[_0x18ea39['transfertargetlinkedid']]);queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0xf')]=_0x18ea39['transfertargetuniqueid'];queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x22')]=0x2;queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x7')]=queues[_0x18ea39['origtransfererlinkedid']][_0x08c1('0x7')];queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x58')]=queues[_0x18ea39[_0x08c1('0x4f')]][_0x08c1('0x58')];queues[_0x18ea39['transfertargetuniqueid']][_0x08c1('0x37')]=utils[_0x08c1('0x17')]();queues[_0x18ea39['transfertargetuniqueid']][_0x08c1('0x35')]=utils[_0x08c1('0x17')]();queues[_0x18ea39[_0x08c1('0x61')]]['holdtime']=0x0;queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x5a')]=0x0;utils[_0x08c1('0x2')](util[_0x08c1('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x21')],queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0xf')],queues[_0x18ea39[_0x08c1('0x61')]][_0x08c1('0x7')],queues[_0x18ea39['transfertargetuniqueid']][_0x08c1('0x58')]));}else{utils[_0x08c1('0x2')](util['format'](_0x08c1('0x5c'),_0x18ea39[_0x08c1('0x4e')],queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0x21')],_0x18ea39[_0x08c1('0x4f')]));queues[_0x18ea39[_0x08c1('0x50')]][_0x08c1('0xf')]=_0x18ea39[_0x08c1('0x4f')];}}}}catch(_0x252cb7){utils[_0x08c1('0x18')](util[_0x08c1('0x12')](_0x08c1('0x4d'),_0x18ea39[_0x08c1('0x4e')]),_0x252cb7);}};exports['musiconholdstart']=function(_0x778dfd){try{if(!_[_0x08c1('0x1a')](queues[_0x778dfd[_0x08c1('0x10')]])){utils[_0x08c1('0x11')](util['format'](_0x08c1('0x62'),_0x778dfd[_0x08c1('0x10')]),_0x778dfd);queues[_0x778dfd[_0x08c1('0x10')]][_0x08c1('0x63')]=utils[_0x08c1('0x17')]();utils['info'](util[_0x08c1('0x12')](_0x08c1('0x64'),_0x778dfd['uniqueid'],queues[_0x778dfd[_0x08c1('0x10')]][_0x08c1('0x21')],queues[_0x778dfd[_0x08c1('0x10')]][_0x08c1('0x63')]));}}catch(_0x1a9ae6){utils[_0x08c1('0x18')](util[_0x08c1('0x12')]('[%s][queues][musiconholdstart]',_0x778dfd['uniqueid']),_0x1a9ae6);}};exports[_0x08c1('0x65')]=function(_0x16b7f4){try{if(!_[_0x08c1('0x1a')](queues[_0x16b7f4[_0x08c1('0x10')]])){if(!_[_0x08c1('0x1a')](queues[_0x16b7f4[_0x08c1('0x10')]][_0x08c1('0x63')])){utils[_0x08c1('0x11')](util[_0x08c1('0x12')]('[%s][queues][musiconholdstop]',_0x16b7f4[_0x08c1('0x10')]),_0x16b7f4);queues[_0x16b7f4['uniqueid']][_0x08c1('0x5a')]+=utils['diffTime'](utils[_0x08c1('0x17')](),queues[_0x16b7f4[_0x08c1('0x10')]][_0x08c1('0x63')]);utils['info'](util[_0x08c1('0x12')](_0x08c1('0x66'),_0x16b7f4[_0x08c1('0x10')],queues[_0x16b7f4[_0x08c1('0x10')]][_0x08c1('0x21')],queues[_0x16b7f4['uniqueid']][_0x08c1('0x5a')]));delete queues[_0x16b7f4[_0x08c1('0x10')]][_0x08c1('0x63')];}}}catch(_0x1ee456){utils[_0x08c1('0x18')](util[_0x08c1('0x12')](_0x08c1('0x67'),_0x16b7f4[_0x08c1('0x10')]),_0x1ee456);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 508ea72..7655f55 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 _0x8778=['mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','error','varset','variable'];(function(_0x39a475,_0x56eaba){var _0x3e36c1=function(_0x108ee0){while(--_0x108ee0){_0x39a475['push'](_0x39a475['shift']());}};_0x3e36c1(++_0x56eaba);}(_0x8778,0x10f));var _0x8877=function(_0x1d497a,_0x217cab){_0x1d497a=_0x1d497a-0x0;var _0x13fadc=_0x8778[_0x1d497a];return _0x13fadc;};'use strict';var _=require(_0x8877('0x0'));var util=require(_0x8877('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x1fa072){utils[_0x8877('0x2')](util[_0x8877('0x3')](_0x8877('0x4'),_0x1fa072[_0x8877('0x5')]));if(_0x1fa072['accountcode']){utils[_0x8877('0x6')](_0x1fa072[_0x8877('0x7')])[_0x8877('0x8')](function(_0x4b7ba8){if(_0x4b7ba8){_0x1fa072['membername']=_0x4b7ba8[_0x8877('0x9')];_0x1fa072['UserId']=_0x4b7ba8['id'];}utils[_0x8877('0xa')](_0x8877('0xb'),_0x1fa072);});}else{utils[_0x8877('0xa')]('CreateVoiceRecording',_0x1fa072);}}exports[_0x8877('0xc')]=function(_0x4bc7a9){try{utils[_0x8877('0xd')](util[_0x8877('0x3')]('[%s][recordings][newchannel]',_0x4bc7a9[_0x8877('0x5')]),_0x4bc7a9);if(_0x4bc7a9[_0x8877('0x5')]==_0x4bc7a9['linkedid']){utils[_0x8877('0x2')](util['format'](_0x8877('0xe'),_0x4bc7a9[_0x8877('0x5')],_0x4bc7a9[_0x8877('0xf')],_0x4bc7a9[_0x8877('0x10')]));recordings[_0x4bc7a9[_0x8877('0x5')]]={'uniqueid':_0x4bc7a9[_0x8877('0x5')],'accountcode':_0x4bc7a9[_0x8877('0x7')],'exten':_0x4bc7a9[_0x8877('0x10')],'context':_0x4bc7a9[_0x8877('0xf')],'channel':_0x4bc7a9[_0x8877('0x11')],'monitors':[]};}}catch(_0x2e4c64){utils['error'](util['format']('[%s][recordings][newchannel]',_0x4bc7a9[_0x8877('0x5')]),_0x2e4c64);}};exports[_0x8877('0x12')]=function(_0xe2169){try{utils[_0x8877('0xd')](util[_0x8877('0x3')](_0x8877('0x13'),_0xe2169[_0x8877('0x5')]),_0xe2169);if(!_[_0x8877('0x14')](recordings[_0xe2169[_0x8877('0x5')]])&&_0xe2169[_0x8877('0x15')]==0x6){utils['info'](util['format'](_0x8877('0x16'),_0xe2169[_0x8877('0x5')],_0xe2169['context'],_0xe2169[_0x8877('0x11')]));}else if(!_[_0x8877('0x14')](recordings[_0xe2169['linkedid']])&&_0xe2169[_0x8877('0x15')]==0x6&&_0xe2169['context']!=_0x8877('0x17')){utils[_0x8877('0x2')](util[_0x8877('0x3')](_0x8877('0x18'),_0xe2169[_0x8877('0x5')],_0xe2169[_0x8877('0x19')],_0xe2169[_0x8877('0xf')],_0xe2169[_0x8877('0x11')]));recordings[_0xe2169['linkedid']][_0x8877('0x7')]=_0xe2169[_0x8877('0x7')];}}catch(_0x30360c){utils[_0x8877('0x1a')](util[_0x8877('0x3')](_0x8877('0x13'),_0xe2169[_0x8877('0x5')]),_0x30360c);}};exports[_0x8877('0x1b')]=function(_0x18d03e){try{if(!_[_0x8877('0x14')](_0x18d03e[_0x8877('0x1c')])&&!_[_0x8877('0x14')](_0x18d03e[_0x8877('0x1c')][_0x8877('0x1d')])){utils[_0x8877('0xd')](util[_0x8877('0x3')](_0x8877('0x1e'),_0x18d03e[_0x8877('0x5')]),_0x18d03e);utils['info'](util[_0x8877('0x3')](_0x8877('0x1f'),_0x18d03e[_0x8877('0x5')],_0x18d03e[_0x8877('0x1c')],_0x18d03e[_0x8877('0x20')]));if(_[_0x8877('0x21')](_0x18d03e[_0x8877('0x20')],_0x8877('0x22'))){_0x18d03e[_0x8877('0x20')]=_0x18d03e[_0x8877('0x20')][_0x8877('0x23')](_0x8877('0x22'),_0x8877('0x24'));}if(recordings[_0x18d03e[_0x8877('0x19')]]){var _0x56ebab=_[_0x8877('0x25')](recordings[_0x18d03e[_0x8877('0x19')]]['monitors'],{'value':_0x18d03e[_0x8877('0x20')]});if(_[_0x8877('0x14')](_0x56ebab)){recordings[_0x18d03e[_0x8877('0x19')]][_0x8877('0x26')][_0x8877('0x27')]({'value':_0x18d03e[_0x8877('0x20')]});}}}}catch(_0x2bc83f){utils[_0x8877('0x1a')](util[_0x8877('0x3')]('[%s][recordings][varset]',_0x18d03e[_0x8877('0x5')]),_0x2bc83f);}};exports['hangup']=function(_0x47fc1b){try{if(!_[_0x8877('0x14')](recordings[_0x47fc1b[_0x8877('0x5')]])){utils[_0x8877('0xd')](util[_0x8877('0x3')](_0x8877('0x28'),_0x47fc1b[_0x8877('0x5')]),_0x47fc1b);utils[_0x8877('0x2')](util[_0x8877('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x47fc1b[_0x8877('0x5')],_0x47fc1b[_0x8877('0x29')],_0x47fc1b['calleridname'],_0x47fc1b[_0x8877('0x2a')]));recordings[_0x47fc1b[_0x8877('0x5')]]['calleridnum']=_0x47fc1b['calleridnum'];recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x2b')]=_0x47fc1b[_0x8877('0x2b')];recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x2c')]=_0x47fc1b[_0x8877('0x2c')];recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x2d')]=_0x47fc1b[_0x8877('0x2d')];if(recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x2e')]=='outbound'&&recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x7')]){recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x2c')]=recordings[_0x47fc1b[_0x8877('0x5')]][_0x8877('0x7')];recordings[_0x47fc1b[_0x8877('0x5')]]['connectedlinename']='';}recordings[_0x47fc1b['uniqueid']][_0x8877('0x26')]['forEach'](function(_0x39d3b9){var _0x163a03=_['clone'](recordings[_0x47fc1b['uniqueid']]);_0x163a03['value']=_0x39d3b9['value'];writeDB(_0x163a03);});delete recordings[_0x47fc1b['uniqueid']];}}catch(_0x10840c){utils[_0x8877('0x1a')](util['format']('[%s][recordings][hangup]',_0x47fc1b[_0x8877('0x5')]),_0x10840c);}};exports[_0x8877('0x2f')]=function(_0xbbb0e8){try{if(!_[_0x8877('0x14')](recordings[_0xbbb0e8[_0x8877('0x5')]])){utils[_0x8877('0xd')](util['format'](_0x8877('0x30'),_0xbbb0e8[_0x8877('0x5')]),_0xbbb0e8);utils[_0x8877('0x2')](util[_0x8877('0x3')](_0x8877('0x31'),_0xbbb0e8[_0x8877('0x5')],_0xbbb0e8[_0x8877('0x32')],_0xbbb0e8[_0x8877('0x33')]));if(_0xbbb0e8[_0x8877('0x32')]['toLowerCase']()==_0x8877('0x34')&&_['startsWith'](_0xbbb0e8[_0x8877('0x33')][_0x8877('0x35')](),_0x8877('0x36'))){var _0xea270a=_0xbbb0e8[_0x8877('0x33')]['split']('=');var _0x268e98=_0xea270a[0x0]['substring'](_0xea270a[0x0][_0x8877('0x37')]('(')+0x1,_0xea270a[0x0][_0x8877('0x37')](')'));var _0xe6dcd0=_0xea270a[0x1];recordings[_0xbbb0e8[_0x8877('0x5')]][_0x268e98]=_0xe6dcd0;}}}catch(_0x603a48){utils[_0x8877('0x1a')](util[_0x8877('0x3')](_0x8877('0x30'),_0xbbb0e8['uniqueid']),_0x603a48);}};exports[_0x8877('0x38')]=function(_0x1d3bca){try{if(!_[_0x8877('0x14')](recordings[_0x1d3bca['uniqueid']])){utils[_0x8877('0xd')](util[_0x8877('0x3')](_0x8877('0x39'),_0x1d3bca[_0x8877('0x5')]),_0x1d3bca);utils[_0x8877('0x2')](util['format'](_0x8877('0x3a'),_0x1d3bca[_0x8877('0x5')],_0x1d3bca[_0x8877('0x3b')]));recordings[_0x1d3bca[_0x8877('0x5')]][_0x8877('0x3b')]=_0x1d3bca['queue'];}}catch(_0x3c6cd8){utils[_0x8877('0x1a')](util[_0x8877('0x3')](_0x8877('0x39'),_0x1d3bca[_0x8877('0x5')]),_0x3c6cd8);}}; \ No newline at end of file +var _0x7c8c=['getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','debug','format','uniqueid','linkedid','context','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','endsWith','value','replace','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','[%s][recordings][writeDB]','accountcode'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c8c,0xef));var _0xc7c8=function(_0x857b31,_0x4427fd){_0x857b31=_0x857b31-0x0;var _0x5b6dab=_0x7c8c[_0x857b31];return _0x5b6dab;};'use strict';var _=require('lodash');var util=require(_0xc7c8('0x0'));var utils=require(_0xc7c8('0x1'));var recordings={};function writeDB(_0x242ba4){utils[_0xc7c8('0x2')](util['format'](_0xc7c8('0x3'),_0x242ba4['uniqueid']));if(_0x242ba4[_0xc7c8('0x4')]){utils[_0xc7c8('0x5')](_0x242ba4[_0xc7c8('0x4')])['then'](function(_0x1035c4){if(_0x1035c4){_0x242ba4[_0xc7c8('0x6')]=_0x1035c4[_0xc7c8('0x7')];_0x242ba4[_0xc7c8('0x8')]=_0x1035c4['id'];}utils[_0xc7c8('0x9')](_0xc7c8('0xa'),_0x242ba4);});}else{utils[_0xc7c8('0x9')](_0xc7c8('0xa'),_0x242ba4);}}exports['newchannel']=function(_0x244458){try{utils[_0xc7c8('0xb')](util[_0xc7c8('0xc')]('[%s][recordings][newchannel]',_0x244458[_0xc7c8('0xd')]),_0x244458);if(_0x244458['uniqueid']==_0x244458[_0xc7c8('0xe')]){utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x244458[_0xc7c8('0xd')],_0x244458[_0xc7c8('0xf')],_0x244458['exten']));recordings[_0x244458['uniqueid']]={'uniqueid':_0x244458[_0xc7c8('0xd')],'accountcode':_0x244458[_0xc7c8('0x4')],'exten':_0x244458[_0xc7c8('0x10')],'context':_0x244458[_0xc7c8('0xf')],'channel':_0x244458['channel'],'monitors':[]};}}catch(_0x40f6b2){utils[_0xc7c8('0x11')](util[_0xc7c8('0xc')]('[%s][recordings][newchannel]',_0x244458[_0xc7c8('0xd')]),_0x40f6b2);}};exports[_0xc7c8('0x12')]=function(_0x795057){try{utils[_0xc7c8('0xb')](util[_0xc7c8('0xc')](_0xc7c8('0x13'),_0x795057[_0xc7c8('0xd')]),_0x795057);if(!_[_0xc7c8('0x14')](recordings[_0x795057[_0xc7c8('0xd')]])&&_0x795057[_0xc7c8('0x15')]==0x6){utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')](_0xc7c8('0x16'),_0x795057['uniqueid'],_0x795057[_0xc7c8('0xf')],_0x795057[_0xc7c8('0x17')]));}else if(!_[_0xc7c8('0x14')](recordings[_0x795057[_0xc7c8('0xe')]])&&_0x795057['channelstate']==0x6&&_0x795057[_0xc7c8('0xf')]!=_0xc7c8('0x18')){utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x795057[_0xc7c8('0xd')],_0x795057[_0xc7c8('0xe')],_0x795057[_0xc7c8('0xf')],_0x795057[_0xc7c8('0x17')]));recordings[_0x795057[_0xc7c8('0xe')]][_0xc7c8('0x4')]=_0x795057[_0xc7c8('0x4')];}}catch(_0x1eb0d8){utils['error'](util[_0xc7c8('0xc')](_0xc7c8('0x13'),_0x795057[_0xc7c8('0xd')]),_0x1eb0d8);}};exports[_0xc7c8('0x19')]=function(_0x5f0cd2){try{if(!_[_0xc7c8('0x14')](_0x5f0cd2[_0xc7c8('0x1a')])&&!_['isNil'](_0x5f0cd2[_0xc7c8('0x1a')][_0xc7c8('0x1b')])){utils[_0xc7c8('0xb')](util[_0xc7c8('0xc')](_0xc7c8('0x1c'),_0x5f0cd2['uniqueid']),_0x5f0cd2);utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5f0cd2[_0xc7c8('0xd')],_0x5f0cd2[_0xc7c8('0x1a')],_0x5f0cd2['value']));if(_[_0xc7c8('0x1d')](_0x5f0cd2[_0xc7c8('0x1e')],'.wav49')){_0x5f0cd2[_0xc7c8('0x1e')]=_0x5f0cd2[_0xc7c8('0x1e')][_0xc7c8('0x1f')](_0xc7c8('0x20'),'.WAV');}if(recordings[_0x5f0cd2['linkedid']]){var _0x3049a6=_[_0xc7c8('0x21')](recordings[_0x5f0cd2[_0xc7c8('0xe')]]['monitors'],{'value':_0x5f0cd2['value']});if(_[_0xc7c8('0x14')](_0x3049a6)){recordings[_0x5f0cd2[_0xc7c8('0xe')]][_0xc7c8('0x22')][_0xc7c8('0x23')]({'value':_0x5f0cd2['value']});}}}}catch(_0x49e32a){utils['error'](util['format']('[%s][recordings][varset]',_0x5f0cd2[_0xc7c8('0xd')]),_0x49e32a);}};exports[_0xc7c8('0x24')]=function(_0x3be7a0){try{if(!_[_0xc7c8('0x14')](recordings[_0x3be7a0[_0xc7c8('0xd')]])){utils[_0xc7c8('0xb')](util[_0xc7c8('0xc')](_0xc7c8('0x25'),_0x3be7a0['uniqueid']),_0x3be7a0);utils[_0xc7c8('0x2')](util['format'](_0xc7c8('0x26'),_0x3be7a0[_0xc7c8('0xd')],_0x3be7a0['calleridnum'],_0x3be7a0[_0xc7c8('0x27')],_0x3be7a0[_0xc7c8('0x28')]));recordings[_0x3be7a0[_0xc7c8('0xd')]]['calleridnum']=_0x3be7a0[_0xc7c8('0x29')];recordings[_0x3be7a0[_0xc7c8('0xd')]]['calleridname']=_0x3be7a0[_0xc7c8('0x27')];recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x2a')]=_0x3be7a0[_0xc7c8('0x2a')];recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x2b')]=_0x3be7a0[_0xc7c8('0x2b')];if(recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x2c')]==_0xc7c8('0x2d')&&recordings[_0x3be7a0['uniqueid']][_0xc7c8('0x4')]){recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x2a')]=recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x4')];recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x2b')]='';}recordings[_0x3be7a0[_0xc7c8('0xd')]][_0xc7c8('0x22')]['forEach'](function(_0x3a9d03){var _0xc2aff1=_['clone'](recordings[_0x3be7a0['uniqueid']]);_0xc2aff1[_0xc7c8('0x1e')]=_0x3a9d03[_0xc7c8('0x1e')];writeDB(_0xc2aff1);});delete recordings[_0x3be7a0[_0xc7c8('0xd')]];}}catch(_0x252782){utils['error'](util[_0xc7c8('0xc')](_0xc7c8('0x25'),_0x3be7a0['uniqueid']),_0x252782);}};exports[_0xc7c8('0x2e')]=function(_0x869866){try{if(!_[_0xc7c8('0x14')](recordings[_0x869866[_0xc7c8('0xd')]])){utils['debug'](util['format'](_0xc7c8('0x2f'),_0x869866['uniqueid']),_0x869866);utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')](_0xc7c8('0x30'),_0x869866['uniqueid'],_0x869866[_0xc7c8('0x31')],_0x869866[_0xc7c8('0x32')]));if(_0x869866['application']['toLowerCase']()==_0xc7c8('0x33')&&_[_0xc7c8('0x34')](_0x869866[_0xc7c8('0x32')][_0xc7c8('0x35')](),_0xc7c8('0x36'))){var _0x740169=_0x869866[_0xc7c8('0x32')][_0xc7c8('0x37')]('=');var _0x526a7a=_0x740169[0x0][_0xc7c8('0x38')](_0x740169[0x0][_0xc7c8('0x39')]('(')+0x1,_0x740169[0x0][_0xc7c8('0x39')](')'));var _0x1fd411=_0x740169[0x1];recordings[_0x869866['uniqueid']][_0x526a7a]=_0x1fd411;}}}catch(_0xafea0d){utils['error'](util[_0xc7c8('0xc')]('[%s][recordings][newexten]',_0x869866[_0xc7c8('0xd')]),_0xafea0d);}};exports['queuecallerjoin']=function(_0xfef08a){try{if(!_[_0xc7c8('0x14')](recordings[_0xfef08a[_0xc7c8('0xd')]])){utils[_0xc7c8('0xb')](util['format'](_0xc7c8('0x3a'),_0xfef08a['uniqueid']),_0xfef08a);utils[_0xc7c8('0x2')](util[_0xc7c8('0xc')](_0xc7c8('0x3b'),_0xfef08a['uniqueid'],_0xfef08a[_0xc7c8('0x3c')]));recordings[_0xfef08a[_0xc7c8('0xd')]]['queue']=_0xfef08a[_0xc7c8('0x3c')];}}catch(_0x488a25){utils[_0xc7c8('0x11')](util[_0xc7c8('0xc')](_0xc7c8('0x3a'),_0xfef08a[_0xc7c8('0xd')]),_0x488a25);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a5a736a..9158888 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 _0x7355=['attended','transfereechannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','CreateVoiceTransferReport','blindtransfer','debug','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten'];(function(_0x1af930,_0x505ec6){var _0x26e706=function(_0x9523b1){while(--_0x9523b1){_0x1af930['push'](_0x1af930['shift']());}};_0x26e706(++_0x505ec6);}(_0x7355,0xa0));var _0x5735=function(_0x4354ee,_0x27a0d0){_0x4354ee=_0x4354ee-0x0;var _0x19ca89=_0x7355[_0x4354ee];return _0x19ca89;};'use strict';var _=require(_0x5735('0x0'));var util=require(_0x5735('0x1'));var utils=require('./utils');function writeDB(_0x16bcf0){utils[_0x5735('0x2')](util[_0x5735('0x3')](_0x5735('0x4'),_0x16bcf0[_0x5735('0x5')]==='attended'?_0x16bcf0[_0x5735('0x6')]:_0x16bcf0['uniqueid'],_0x16bcf0[_0x5735('0x5')]));utils['request'](_0x5735('0x7'),_0x16bcf0);}exports[_0x5735('0x8')]=function(_0xa964ff){try{utils[_0x5735('0x9')](util[_0x5735('0x3')]('[%s][transfers][blindtransfer]',_0xa964ff[_0x5735('0xa')]),_0xa964ff);utils[_0x5735('0x2')](util[_0x5735('0x3')](_0x5735('0xb'),_0xa964ff['uniqueid'],_0xa964ff['transferercalleridnum'],_0xa964ff[_0x5735('0xc')],_0xa964ff[_0x5735('0xd')],_0xa964ff[_0x5735('0xe')]));_0xa964ff['type']=_0x5735('0xf');writeDB(_0xa964ff);}catch(_0x52bc2b){utils[_0x5735('0x10')](util[_0x5735('0x3')](_0x5735('0x11'),_0xa964ff[_0x5735('0xa')]),_0x52bc2b);}};exports[_0x5735('0x12')]=function(_0x1ad259){try{utils[_0x5735('0x9')](util[_0x5735('0x3')]('[%s][transfers][attendedtransfer]',_0x1ad259[_0x5735('0x6')]),_0x1ad259);utils['info'](util[_0x5735('0x3')](_0x5735('0x13'),_0x1ad259['origtransfereruniqueid'],_0x1ad259['origtransferercalleridnum'],_0x1ad259[_0x5735('0x14')],_0x1ad259[_0x5735('0x15')],_0x1ad259[_0x5735('0x16')]));_0x1ad259=_[_0x5735('0x17')](_0x1ad259,{'transfererchannel':_0x1ad259['origtransfererchannel'],'transferercalleridnum':_0x1ad259[_0x5735('0x18')],'transferercalleridname':_0x1ad259['origtransferercalleridname'],'transfererconnectedlinenum':_0x1ad259[_0x5735('0x19')],'transfererconnectedlinename':_0x1ad259['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1ad259[_0x5735('0x1a')],'transferercontext':_0x1ad259['secondtransferercontext'],'transfererexten':_0x1ad259[_0x5735('0x1b')],'transfererlinkedid':_0x1ad259[_0x5735('0x1c')],'context':_0x1ad259['origtransferercontext'],'extension':_0x1ad259[_0x5735('0x1d')],'type':_0x5735('0x1e')});if(_['isNil'](_0x1ad259[_0x5735('0x1f')])){_0x1ad259=_[_0x5735('0x17')](_0x1ad259,{'transfereechannel':_0x1ad259['transfertargetchannel'],'transfereecalleridnum':_0x1ad259[_0x5735('0x15')],'transfereecalleridname':_0x1ad259[_0x5735('0x16')],'transfereeconnectedlinenum':_0x1ad259[_0x5735('0x20')],'transfereeconnectedlinename':_0x1ad259['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1ad259[_0x5735('0x21')],'transfereecontext':_0x1ad259[_0x5735('0x22')],'transfereeexten':_0x1ad259[_0x5735('0x23')],'transfereelinkedid':_0x1ad259[_0x5735('0x24')]});}writeDB(_0x1ad259);}catch(_0x2fd19e){utils['error'](util['format'](_0x5735('0x25'),_0x1ad259[_0x5735('0x6')]),_0x2fd19e);}}; \ No newline at end of file +var _0x791b=['transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','./utils','type','attended','origtransfereruniqueid','uniqueid','blindtransfer','debug','info','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridname','blind','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel'];(function(_0x2eade3,_0x5be0b9){var _0x5c4845=function(_0x19fbe7){while(--_0x19fbe7){_0x2eade3['push'](_0x2eade3['shift']());}};_0x5c4845(++_0x5be0b9);}(_0x791b,0xcb));var _0xb791=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x791b[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xb791('0x0'));var util=require('util');var utils=require(_0xb791('0x1'));function writeDB(_0x4bcddd){utils['info'](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x4bcddd[_0xb791('0x2')]===_0xb791('0x3')?_0x4bcddd[_0xb791('0x4')]:_0x4bcddd[_0xb791('0x5')],_0x4bcddd[_0xb791('0x2')]));utils['request']('CreateVoiceTransferReport',_0x4bcddd);}exports[_0xb791('0x6')]=function(_0x4bdd9f){try{utils[_0xb791('0x7')](util['format']('[%s][transfers][blindtransfer]',_0x4bdd9f[_0xb791('0x5')]),_0x4bdd9f);utils[_0xb791('0x8')](util[_0xb791('0x9')](_0xb791('0xa'),_0x4bdd9f['uniqueid'],_0x4bdd9f[_0xb791('0xb')],_0x4bdd9f['transferercalleridname'],_0x4bdd9f['transfereecalleridnum'],_0x4bdd9f[_0xb791('0xc')]));_0x4bdd9f[_0xb791('0x2')]=_0xb791('0xd');writeDB(_0x4bdd9f);}catch(_0x34e5d5){utils['error'](util[_0xb791('0x9')](_0xb791('0xe'),_0x4bdd9f[_0xb791('0x5')]),_0x34e5d5);}};exports['attendedtransfer']=function(_0x4810f4){try{utils['debug'](util[_0xb791('0x9')](_0xb791('0xf'),_0x4810f4['origtransfereruniqueid']),_0x4810f4);utils[_0xb791('0x8')](util['format'](_0xb791('0x10'),_0x4810f4[_0xb791('0x4')],_0x4810f4[_0xb791('0x11')],_0x4810f4[_0xb791('0x12')],_0x4810f4[_0xb791('0x13')],_0x4810f4[_0xb791('0x14')]));_0x4810f4=_[_0xb791('0x15')](_0x4810f4,{'transfererchannel':_0x4810f4[_0xb791('0x16')],'transferercalleridnum':_0x4810f4[_0xb791('0x11')],'transferercalleridname':_0x4810f4[_0xb791('0x12')],'transfererconnectedlinenum':_0x4810f4[_0xb791('0x17')],'transfererconnectedlinename':_0x4810f4['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4810f4[_0xb791('0x18')],'transferercontext':_0x4810f4[_0xb791('0x19')],'transfererexten':_0x4810f4[_0xb791('0x1a')],'transfererlinkedid':_0x4810f4[_0xb791('0x1b')],'context':_0x4810f4[_0xb791('0x1c')],'extension':_0x4810f4[_0xb791('0x1d')],'type':'attended'});if(_['isNil'](_0x4810f4[_0xb791('0x1e')])){_0x4810f4=_[_0xb791('0x15')](_0x4810f4,{'transfereechannel':_0x4810f4[_0xb791('0x1f')],'transfereecalleridnum':_0x4810f4['transfertargetcalleridnum'],'transfereecalleridname':_0x4810f4[_0xb791('0x14')],'transfereeconnectedlinenum':_0x4810f4[_0xb791('0x20')],'transfereeconnectedlinename':_0x4810f4[_0xb791('0x21')],'transfereeaccountcode':_0x4810f4[_0xb791('0x22')],'transfereecontext':_0x4810f4[_0xb791('0x23')],'transfereeexten':_0x4810f4[_0xb791('0x24')],'transfereelinkedid':_0x4810f4[_0xb791('0x25')]});}writeDB(_0x4810f4);}catch(_0x2450bd){utils[_0xb791('0x26')](util[_0xb791('0x9')](_0xb791('0xf'),_0x4810f4[_0xb791('0x4')]),_0x2450bd);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c8f83e1..79500cc 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 _0xf34f=['catch','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s'];(function(_0x3afb73,_0xaa578f){var _0x5165f2=function(_0x142ac9){while(--_0x142ac9){_0x3afb73['push'](_0x3afb73['shift']());}};_0x5165f2(++_0xaa578f);}(_0xf34f,0x16b));var _0xff34=function(_0x1e6543,_0x57aff3){_0x1e6543=_0x1e6543-0x0;var _0x1abf8b=_0xf34f[_0x1e6543];return _0x1abf8b;};'use strict';var BPromise=require(_0xff34('0x0'));var jayson=require('jayson/promise');var moment=require(_0xff34('0x1'));var util=require(_0xff34('0x2'));var client=jayson['client'][_0xff34('0x3')]({'port':0x2329});var logger=require(_0xff34('0x4'))(_0xff34('0x5'));exports[_0xff34('0x6')]=function(_0x284405,_0x2c74d2){logger[_0xff34('0x6')](_0x284405,_0x2c74d2?util[_0xff34('0x7')](_0x2c74d2,{'showHidden':![],'depth':null}):'');};exports[_0xff34('0x8')]=function(_0x380b91,_0x5d8f59){logger['debug'](_0x380b91,_0x5d8f59?util['inspect'](_0x5d8f59,{'showHidden':![],'depth':null}):'');};exports[_0xff34('0x9')]=function(_0x4cd392,_0x1d2128){logger['error'](_0x4cd392,_0x1d2128?util[_0xff34('0x7')](_0x1d2128,{'showHidden':![],'depth':null}):'');};exports[_0xff34('0xa')]=function(_0x28647e,_0x35918f){return client[_0xff34('0xa')](_0x28647e,{'body':_0x35918f})[_0xff34('0xb')](function(_0x58c77a){logger['debug'](_0xff34('0xc'),_0x28647e,_0x58c77a?util[_0xff34('0x7')](_0x58c77a,{'showHidden':![],'depth':null}):'');})[_0xff34('0xd')](function(_0x4d0d6a){logger[_0xff34('0x9')]('[utils][request]\x20name:%s',_0x28647e,_0x4d0d6a?util[_0xff34('0x7')](_0x4d0d6a,{'showHidden':![],'depth':null}):'');});};function getUser(_0x28d34c){return client[_0xff34('0xa')](_0xff34('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0xff34('0xf'),_0xff34('0x10')],'where':_0x28d34c,'limit':0x1}})[_0xff34('0xb')](function(_0x3a3a72){logger[_0xff34('0x8')](_0xff34('0x11'),JSON[_0xff34('0x12')](_0x28d34c),_0x3a3a72?util[_0xff34('0x7')](_0x3a3a72,{'showHidden':![],'depth':null}):'');return _0x3a3a72[_0xff34('0x13')]['length']?_0x3a3a72[_0xff34('0x13')][0x0]:null;});}exports[_0xff34('0x14')]=function(_0x28d233){return new BPromise(function(_0x4f6c77,_0x30fb87){if(_0x28d233){return getUser({'internal':_0x28d233})['then'](function(_0x5f11eb){logger[_0xff34('0x6')](_0xff34('0x15'),_0x28d233,_0x5f11eb?_0xff34('0x16'):_0xff34('0x17'));return _0x4f6c77(_0x5f11eb);})[_0xff34('0xd')](function(_0x4ac8fe){logger['error']('[utils][getUserByInternal]',_0x4ac8fe?util[_0xff34('0x7')](_0x4ac8fe,{'showHidden':![],'depth':null}):'');return _0x4f6c77(null);});}return _0x4f6c77(null);});};exports[_0xff34('0x18')]=function(_0x1de513){return new BPromise(function(_0x32fb48,_0x53dfe8){if(_0x1de513){return getUser({'interface':_0x1de513})['then'](function(_0x2d0505){logger[_0xff34('0x6')](_0xff34('0x19'),_0x1de513,_0x2d0505?_0xff34('0x16'):'notfound');return _0x32fb48(_0x2d0505);})[_0xff34('0xd')](function(_0xb82a33){logger['error'](_0xff34('0x1a'),_0xb82a33?util[_0xff34('0x7')](_0xb82a33,{'showHidden':![],'depth':null}):'');return _0x32fb48(null);});}return _0x32fb48(null);});};exports[_0xff34('0x1b')]=function(_0x4feed6){return new BPromise(function(_0x48cdab,_0xb9d85e){if(_0x4feed6){return getUser({'name':_0x4feed6})[_0xff34('0xb')](function(_0x48fe93){logger[_0xff34('0x6')](_0xff34('0x1c'),_0x4feed6,_0x48fe93?_0xff34('0x16'):_0xff34('0x17'));return _0x48cdab(_0x48fe93);})['catch'](function(_0x12844b){logger[_0xff34('0x9')](_0xff34('0x1d'),_0x12844b?util[_0xff34('0x7')](_0x12844b,{'showHidden':![],'depth':null}):'');return _0x48cdab(null);});}return _0x48cdab(null);});};exports[_0xff34('0x1e')]=function(_0x22c568){return new BPromise(function(_0x11ab1e,_0x401472){if(_0x22c568){return client[_0xff34('0xa')](_0xff34('0x1f'),{'options':{'raw':!![],'attributes':['id','name',_0xff34('0x20'),_0xff34('0x21'),_0xff34('0x22')],'where':{'name':_0x22c568},'limit':0x1}})[_0xff34('0xb')](function(_0x2bfa20){logger['debug'](_0xff34('0x23'),_0x22c568,_0x2bfa20?util[_0xff34('0x7')](_0x2bfa20,{'showHidden':![],'depth':null}):'');logger[_0xff34('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x22c568,_0x2bfa20?_0xff34('0x16'):_0xff34('0x17'));return _0x11ab1e(_0x2bfa20[_0xff34('0x13')]['length']?_0x2bfa20[_0xff34('0x13')][0x0]:null);})[_0xff34('0xd')](function(_0x59f4fd){logger[_0xff34('0x9')](_0xff34('0x24'),_0x59f4fd?util['inspect'](_0x59f4fd,{'showHidden':![],'depth':null}):'');return _0x11ab1e(null);});}return _0x11ab1e(null);});};exports['addTime']=function(_0x6ca582,_0xef3cfe){return moment(_0x6ca582)[_0xff34('0x25')](_0xef3cfe,_0xff34('0x26'))[_0xff34('0x27')](_0xff34('0x28'));};exports[_0xff34('0x29')]=function(_0x4a8b6d,_0x181fc7){return moment(_0x4a8b6d)['subtract'](_0x181fc7,_0xff34('0x26'))[_0xff34('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x1893c2,_0x40021f){return moment(_0x1893c2)[_0xff34('0x2a')](moment(_0x40021f),'seconds');};exports[_0xff34('0x2b')]=function(_0x371374,_0x2a6d84){return parseInt(_0x371374,0xa)+parseInt(_0x2a6d84,0xa);};exports[_0xff34('0x2c')]=function(){return moment()[_0xff34('0x27')](_0xff34('0x28'));};exports[_0xff34('0x2d')]=function(_0x426ffa,_0x2bb5a2){if(_0x2bb5a2){return moment(_0x426ffa)['isAfter'](_0x2bb5a2);}return!![];};exports[_0xff34('0x2e')]=function(_0xf3481c,_0x3b5d7d){if(_0x3b5d7d){return moment(_0xf3481c)['isBefore'](_0x3b5d7d);}else if(_0xf3481c){return!![];}return![];}; \ No newline at end of file +var _0xceca=['[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','diff','sumTime','now','bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','error','then','[utils][request]\x20name:%s','request','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal'];(function(_0x4a6979,_0x5f3d1a){var _0x226f93=function(_0x471572){while(--_0x471572){_0x4a6979['push'](_0x4a6979['shift']());}};_0x226f93(++_0x5f3d1a);}(_0xceca,0x163));var _0xacec=function(_0x179340,_0x5e0d90){_0x179340=_0x179340-0x0;var _0x4d4d3e=_0xceca[_0x179340];return _0x4d4d3e;};'use strict';var BPromise=require(_0xacec('0x0'));var jayson=require(_0xacec('0x1'));var moment=require(_0xacec('0x2'));var util=require(_0xacec('0x3'));var client=jayson['client'][_0xacec('0x4')]({'port':0x2329});var logger=require(_0xacec('0x5'))(_0xacec('0x6'));exports[_0xacec('0x7')]=function(_0x3b9feb,_0x24733a){logger[_0xacec('0x7')](_0x3b9feb,_0x24733a?util[_0xacec('0x8')](_0x24733a,{'showHidden':![],'depth':null}):'');};exports[_0xacec('0x9')]=function(_0x3b5d3f,_0x3a3be6){logger[_0xacec('0x9')](_0x3b5d3f,_0x3a3be6?util['inspect'](_0x3a3be6,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x2c54af,_0x28f5a7){logger[_0xacec('0xa')](_0x2c54af,_0x28f5a7?util[_0xacec('0x8')](_0x28f5a7,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0xa5286e,_0x32358a){return client['request'](_0xa5286e,{'body':_0x32358a})[_0xacec('0xb')](function(_0x558ed1){logger[_0xacec('0x9')](_0xacec('0xc'),_0xa5286e,_0x558ed1?util[_0xacec('0x8')](_0x558ed1,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x5721ed){logger['error'](_0xacec('0xc'),_0xa5286e,_0x5721ed?util[_0xacec('0x8')](_0x5721ed,{'showHidden':![],'depth':null}):'');});};function getUser(_0xbf6e6){return client[_0xacec('0xd')](_0xacec('0xe'),{'options':{'raw':!![],'attributes':['id',_0xacec('0xf'),_0xacec('0x10'),'interface'],'where':_0xbf6e6,'limit':0x1}})[_0xacec('0xb')](function(_0x1a7d3a){logger[_0xacec('0x9')](_0xacec('0x11'),JSON[_0xacec('0x12')](_0xbf6e6),_0x1a7d3a?util['inspect'](_0x1a7d3a,{'showHidden':![],'depth':null}):'');return _0x1a7d3a[_0xacec('0x13')]['length']?_0x1a7d3a[_0xacec('0x13')][0x0]:null;});}exports[_0xacec('0x14')]=function(_0x3a1019){return new BPromise(function(_0x5738e7,_0x463834){if(_0x3a1019){return getUser({'internal':_0x3a1019})[_0xacec('0xb')](function(_0x39392f){logger[_0xacec('0x7')](_0xacec('0x15'),_0x3a1019,_0x39392f?_0xacec('0x16'):'notfound');return _0x5738e7(_0x39392f);})[_0xacec('0x17')](function(_0x1d8949){logger['error']('[utils][getUserByInternal]',_0x1d8949?util[_0xacec('0x8')](_0x1d8949,{'showHidden':![],'depth':null}):'');return _0x5738e7(null);});}return _0x5738e7(null);});};exports[_0xacec('0x18')]=function(_0x56e73e){return new BPromise(function(_0x187f4a,_0x4f8805){if(_0x56e73e){return getUser({'interface':_0x56e73e})[_0xacec('0xb')](function(_0x319360){logger[_0xacec('0x7')](_0xacec('0x19'),_0x56e73e,_0x319360?'found':'notfound');return _0x187f4a(_0x319360);})[_0xacec('0x17')](function(_0x1e7c69){logger[_0xacec('0xa')]('[utils][getUserByInterface]',_0x1e7c69?util[_0xacec('0x8')](_0x1e7c69,{'showHidden':![],'depth':null}):'');return _0x187f4a(null);});}return _0x187f4a(null);});};exports[_0xacec('0x1a')]=function(_0x59fde7){return new BPromise(function(_0x48b3f6,_0x4f44d1){if(_0x59fde7){return getUser({'name':_0x59fde7})[_0xacec('0xb')](function(_0x2aef51){logger[_0xacec('0x7')](_0xacec('0x1b'),_0x59fde7,_0x2aef51?'found':_0xacec('0x1c'));return _0x48b3f6(_0x2aef51);})[_0xacec('0x17')](function(_0x57c310){logger['error'](_0xacec('0x1d'),_0x57c310?util[_0xacec('0x8')](_0x57c310,{'showHidden':![],'depth':null}):'');return _0x48b3f6(null);});}return _0x48b3f6(null);});};exports[_0xacec('0x1e')]=function(_0x5edfd9){return new BPromise(function(_0xefcd2d,_0x1b833e){if(_0x5edfd9){return client[_0xacec('0xd')](_0xacec('0x1f'),{'options':{'raw':!![],'attributes':['id','name','type',_0xacec('0x20'),_0xacec('0x21')],'where':{'name':_0x5edfd9},'limit':0x1}})[_0xacec('0xb')](function(_0x18ba88){logger[_0xacec('0x9')](_0xacec('0x22'),_0x5edfd9,_0x18ba88?util[_0xacec('0x8')](_0x18ba88,{'showHidden':![],'depth':null}):'');logger[_0xacec('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x5edfd9,_0x18ba88?_0xacec('0x16'):_0xacec('0x1c'));return _0xefcd2d(_0x18ba88[_0xacec('0x13')][_0xacec('0x23')]?_0x18ba88[_0xacec('0x13')][0x0]:null);})['catch'](function(_0x96618c){logger[_0xacec('0xa')](_0xacec('0x24'),_0x96618c?util[_0xacec('0x8')](_0x96618c,{'showHidden':![],'depth':null}):'');return _0xefcd2d(null);});}return _0xefcd2d(null);});};exports[_0xacec('0x25')]=function(_0x5506fe,_0x352416){return moment(_0x5506fe)[_0xacec('0x26')](_0x352416,_0xacec('0x27'))['format'](_0xacec('0x28'));};exports[_0xacec('0x29')]=function(_0x13b143,_0x668cde){return moment(_0x13b143)['subtract'](_0x668cde,'seconds')[_0xacec('0x2a')](_0xacec('0x28'));};exports[_0xacec('0x2b')]=function(_0x16d1b0,_0x5cf046){return moment(_0x16d1b0)[_0xacec('0x2c')](moment(_0x5cf046),_0xacec('0x27'));};exports[_0xacec('0x2d')]=function(_0x200044,_0x5cad30){return parseInt(_0x200044,0xa)+parseInt(_0x5cad30,0xa);};exports[_0xacec('0x2e')]=function(){return moment()[_0xacec('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x330687,_0x129b77){if(_0x129b77){return moment(_0x330687)['isAfter'](_0x129b77);}return!![];};exports['isBefore']=function(_0x27347f,_0x164b65){if(_0x164b65){return moment(_0x27347f)['isBefore'](_0x164b65);}else if(_0x27347f){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 2fff2c6..ca291ad 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 _0xa3a9=['test','setupLoggers','fs-extra','express-winston','path','util','fileLogger','maskSensitiveData','/var','log','xcally','client','role','name','ensureDir','join','then','catch','user','data','timestamp','api','auth','set','logger','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','format','device','other','agent_name'];(function(_0x2a86e6,_0x3f3bc9){var _0x121c19=function(_0x2022fc){while(--_0x2022fc){_0x2a86e6['push'](_0x2a86e6['shift']());}};_0x121c19(++_0x3f3bc9);}(_0xa3a9,0x80));var _0x9a3a=function(_0x4d444f,_0x5eeef0){_0x4d444f=_0x4d444f-0x0;var _0x2f917d=_0xa3a9[_0x4d444f];return _0x2f917d;};var fs=require(_0x9a3a('0x0'));var _=require('lodash');var ewinston=require(_0x9a3a('0x1'));var path=require(_0x9a3a('0x2'));var util=require(_0x9a3a('0x3'));var fileLogger=require('./loggers')[_0x9a3a('0x4')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require('./mask-sensitive-data')[_0x9a3a('0x5')];function ClientSideLogger(){function _0x194409(_0x16cf51){var _0x5ca685=path['join'](_0x9a3a('0x6'),_0x9a3a('0x7'),_0x9a3a('0x8'));var _0x1a1b1f=path['join'](_0x9a3a('0x9'),_0x16cf51[_0x9a3a('0xa')]+'-'+_0x16cf51[_0x9a3a('0xb')]);return fs[_0x9a3a('0xc')](path[_0x9a3a('0xd')](_0x5ca685,_0x1a1b1f))[_0x9a3a('0xe')](function(){var _0x5ac1e6=fileLogger(_0x9a3a('0x9'),path[_0x9a3a('0xd')](_0x5ca685,_0x1a1b1f));return _0x5ac1e6;})[_0x9a3a('0xf')](function(_0x5141ed){throw _0x5141ed;});}this[_0x9a3a('0x7')]=function(_0x5bf03b,_0x3dc2e6,_0x497321,_0x4e52cb){return _0x194409(_0x5bf03b[_0x9a3a('0x10')])[_0x9a3a('0xe')](function(_0x446baf){var _0x2a4128=_0x446baf[_0x3dc2e6];return _0x2a4128;})[_0x9a3a('0xe')](function(_0x3d8f68){var _0x3f0105=_0x5bf03b[_0x9a3a('0x10')]?_0x5bf03b[_0x9a3a('0x10')]['id']:'no-user';var _0x3493bf=_0x4e52cb[_0x9a3a('0x11')];var _0x3eb670=_0x4e52cb[_0x9a3a('0x12')];var _0x33ac30=new Date(Number(_0x3eb670));return _0x3d8f68(_0x3f0105,_0x33ac30,_0x497321,_0x3493bf);})[_0x9a3a('0xf')](function(_0x20d346){fileLogger(_0x9a3a('0x9'))['error'](_0x20d346);});};}function setupLoggers(_0x3a5d2b){return new Promise(function(_0x235283){var _0x3416f2=new ClientSideLogger();var _0x143079=fileLogger(_0x9a3a('0x13'));var _0x146df0=fileLogger(_0x9a3a('0x14'));_0x3a5d2b[_0x9a3a('0x15')]('client-side-logger',_0x3416f2);_0x3a5d2b['use'](ewinston[_0x9a3a('0x16')]({'winstonInstance':_0x143079,'meta':![],'statusLevels':!![],'msg':function(_0x335c0c,_0x5ab25d){var _0x1a7aca='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x335c0c[_0x9a3a('0x17')])){_0x1a7aca+=_0x9a3a('0x18');var _0x16852b=_0x335c0c[_0x9a3a('0x17')];maskSensitiveData(_0x16852b);}return safeTemplate(util['format'](_0x1a7aca,_0x335c0c[_0x9a3a('0x19')],_0x335c0c[_0x9a3a('0x1a')]['x-forwarded-for']?_0x335c0c[_0x9a3a('0x1a')][_0x9a3a('0x1b')]:_0x335c0c[_0x9a3a('0x1c')][_0x9a3a('0x1d')]||_0x335c0c['ip'],_0x335c0c[_0x9a3a('0x1e')],_0x5ab25d[_0x9a3a('0x1f')],_0x5ab25d[_0x9a3a('0x20')],_0x335c0c[_0x9a3a('0x10')]?_0x335c0c[_0x9a3a('0x10')]['id']:null,_0x335c0c[_0x9a3a('0x10')]?_0x335c0c[_0x9a3a('0x10')][_0x9a3a('0xb')]:null,_0x335c0c['user']?_0x335c0c[_0x9a3a('0x10')][_0x9a3a('0xa')]:null,_0x16852b?util['inspect'](_0x16852b,![],null):''));}}));_0x3a5d2b[_0x9a3a('0x21')](ewinston[_0x9a3a('0x16')]({'winstonInstance':_0x146df0,'meta':![],'statusLevels':!![],'msg':function(_0x24a744,_0x22fecf){var _0x2c7342=_0x9a3a('0x22');if(_0x24a744['body']&&_0x24a744['body']['device']&&_0x24a744[_0x9a3a('0x17')][_0x9a3a('0x23')]){_0x2c7342='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x9a3a('0x24')](_0x2c7342,_0x24a744[_0x9a3a('0x19')],_0x24a744[_0x9a3a('0x1a')][_0x9a3a('0x1b')]?_0x24a744[_0x9a3a('0x1a')][_0x9a3a('0x1b')]:_0x24a744['connection'][_0x9a3a('0x1d')]||_0x24a744['ip'],_0x24a744[_0x9a3a('0x1e')],_0x22fecf['statusCode'],_0x22fecf[_0x9a3a('0x20')],_0x24a744[_0x9a3a('0x10')]?_0x24a744[_0x9a3a('0x10')]['id']:null,_0x24a744[_0x9a3a('0x10')]?_0x24a744[_0x9a3a('0x10')]['name']:null,_0x24a744[_0x9a3a('0x10')]?_0x24a744['user'][_0x9a3a('0xa')]:null,_0x24a744['body']&&_0x24a744[_0x9a3a('0x17')][_0x9a3a('0x25')]?_0x24a744[_0x9a3a('0x17')]['device']:_0x9a3a('0x26'),_0x24a744[_0x9a3a('0x17')]&&_0x24a744[_0x9a3a('0x17')][_0x9a3a('0x23')]?_0x24a744[_0x9a3a('0x17')][_0x9a3a('0x23')]:'',_0x24a744[_0x9a3a('0x17')]&&_0x24a744[_0x9a3a('0x17')][_0x9a3a('0x27')]?_0x24a744['body'][_0x9a3a('0x27')]:'');},'ignoreRoute':function(_0x147a6a){var _0x4dab1c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4dab1c[_0x9a3a('0x28')](_0x147a6a[_0x9a3a('0x1e')]);}}));return _0x235283();});}exports[_0x9a3a('0x29')]=setupLoggers; \ No newline at end of file +var _0x7ef8=['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','x-forwarded-for','remoteAddress','other','agent_name','fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','log','role','ensureDir','then','user','no-user','data','timestamp','client','error','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','connection','url','statusCode','responseTime','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device'];(function(_0x2cb7ff,_0x316573){var _0x5e01c2=function(_0x5f38b0){while(--_0x5f38b0){_0x2cb7ff['push'](_0x2cb7ff['shift']());}};_0x5e01c2(++_0x316573);}(_0x7ef8,0x1bf));var _0x87ef=function(_0x27ff0a,_0x469915){_0x27ff0a=_0x27ff0a-0x0;var _0x590123=_0x7ef8[_0x27ff0a];return _0x590123;};var fs=require(_0x87ef('0x0'));var _=require(_0x87ef('0x1'));var ewinston=require(_0x87ef('0x2'));var path=require('path');var util=require(_0x87ef('0x3'));var fileLogger=require(_0x87ef('0x4'))[_0x87ef('0x5')];var safeTemplate=require(_0x87ef('0x6'))[_0x87ef('0x7')];var maskSensitiveData=require(_0x87ef('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0xf2b2ad(_0x2b63c1){var _0x40583f=path[_0x87ef('0x9')]('/var',_0x87ef('0xa'),'xcally');var _0xdf7d1e=path[_0x87ef('0x9')]('client',_0x2b63c1[_0x87ef('0xb')]+'-'+_0x2b63c1['name']);return fs[_0x87ef('0xc')](path['join'](_0x40583f,_0xdf7d1e))[_0x87ef('0xd')](function(){var _0x101d20=fileLogger('client',path[_0x87ef('0x9')](_0x40583f,_0xdf7d1e));return _0x101d20;})['catch'](function(_0x13dea6){throw _0x13dea6;});}this[_0x87ef('0xa')]=function(_0x16c314,_0x4fb2de,_0x5a3b50,_0x1fb056){return _0xf2b2ad(_0x16c314[_0x87ef('0xe')])[_0x87ef('0xd')](function(_0x36d232){var _0x1d9956=_0x36d232[_0x4fb2de];return _0x1d9956;})[_0x87ef('0xd')](function(_0x353975){var _0x1cbe4a=_0x16c314[_0x87ef('0xe')]?_0x16c314[_0x87ef('0xe')]['id']:_0x87ef('0xf');var _0x29d159=_0x1fb056[_0x87ef('0x10')];var _0x431fcd=_0x1fb056[_0x87ef('0x11')];var _0x7c7769=new Date(Number(_0x431fcd));return _0x353975(_0x1cbe4a,_0x7c7769,_0x5a3b50,_0x29d159);})['catch'](function(_0x43a5e6){fileLogger(_0x87ef('0x12'))[_0x87ef('0x13')](_0x43a5e6);});};}function setupLoggers(_0x189fb5){return new Promise(function(_0x1937fc){var _0x542119=new ClientSideLogger();var _0x235357=fileLogger('api');var _0x14d9fb=fileLogger('auth');_0x189fb5[_0x87ef('0x14')](_0x87ef('0x15'),_0x542119);_0x189fb5['use'](ewinston[_0x87ef('0x16')]({'winstonInstance':_0x235357,'meta':![],'statusLevels':!![],'msg':function(_0x3ab86d,_0x51b8c4){var _0x110116=_0x87ef('0x17');if(!_[_0x87ef('0x18')](_0x3ab86d[_0x87ef('0x19')])){_0x110116+=_0x87ef('0x1a');var _0x3ce66d=_0x3ab86d[_0x87ef('0x19')];maskSensitiveData(_0x3ce66d);}return safeTemplate(util['format'](_0x110116,_0x3ab86d[_0x87ef('0x1b')],_0x3ab86d[_0x87ef('0x1c')]['x-forwarded-for']?_0x3ab86d[_0x87ef('0x1c')]['x-forwarded-for']:_0x3ab86d[_0x87ef('0x1d')]['remoteAddress']||_0x3ab86d['ip'],_0x3ab86d[_0x87ef('0x1e')],_0x51b8c4[_0x87ef('0x1f')],_0x51b8c4[_0x87ef('0x20')],_0x3ab86d[_0x87ef('0xe')]?_0x3ab86d[_0x87ef('0xe')]['id']:null,_0x3ab86d['user']?_0x3ab86d[_0x87ef('0xe')]['name']:null,_0x3ab86d[_0x87ef('0xe')]?_0x3ab86d[_0x87ef('0xe')][_0x87ef('0xb')]:null,_0x3ce66d?util[_0x87ef('0x21')](_0x3ce66d,![],null):''));}}));_0x189fb5[_0x87ef('0x22')](ewinston['logger']({'winstonInstance':_0x14d9fb,'meta':![],'statusLevels':!![],'msg':function(_0x3ba677,_0x9dcac){var _0x5c0c03=_0x87ef('0x23');if(_0x3ba677['body']&&_0x3ba677[_0x87ef('0x19')][_0x87ef('0x24')]&&_0x3ba677[_0x87ef('0x19')][_0x87ef('0x25')]){_0x5c0c03=_0x87ef('0x26');}return util[_0x87ef('0x27')](_0x5c0c03,_0x3ba677[_0x87ef('0x1b')],_0x3ba677[_0x87ef('0x1c')][_0x87ef('0x28')]?_0x3ba677['headers'][_0x87ef('0x28')]:_0x3ba677[_0x87ef('0x1d')][_0x87ef('0x29')]||_0x3ba677['ip'],_0x3ba677[_0x87ef('0x1e')],_0x9dcac['statusCode'],_0x9dcac[_0x87ef('0x20')],_0x3ba677[_0x87ef('0xe')]?_0x3ba677['user']['id']:null,_0x3ba677[_0x87ef('0xe')]?_0x3ba677[_0x87ef('0xe')]['name']:null,_0x3ba677['user']?_0x3ba677[_0x87ef('0xe')][_0x87ef('0xb')]:null,_0x3ba677[_0x87ef('0x19')]&&_0x3ba677[_0x87ef('0x19')]['device']?_0x3ba677[_0x87ef('0x19')][_0x87ef('0x24')]:_0x87ef('0x2a'),_0x3ba677[_0x87ef('0x19')]&&_0x3ba677[_0x87ef('0x19')]['agent_id']?_0x3ba677[_0x87ef('0x19')][_0x87ef('0x25')]:'',_0x3ba677[_0x87ef('0x19')]&&_0x3ba677[_0x87ef('0x19')]['agent_name']?_0x3ba677[_0x87ef('0x19')][_0x87ef('0x2b')]:'');},'ignoreRoute':function(_0x444c48){var _0x51a387=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x51a387['test'](_0x444c48['url']);}}));return _0x1937fc();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 4035a55..efe02f1 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf23d=['ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','clone','hours','minutes','day','endOf','isBetween','timeCompare','format'];(function(_0x3544a1,_0x175b4d){var _0x556878=function(_0x45a88e){while(--_0x45a88e){_0x3544a1['push'](_0x3544a1['shift']());}};_0x556878(++_0x175b4d);}(_0xf23d,0x18c));var _0xdf23=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xf23d[_0xd0b415];return _0x2bdf2c;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xdf23('0x0')](function(_0x3c5f7a){return _0x3c5f7a[_0xdf23('0x1')];})[_0xdf23('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xdf23('0x3');var EINVALID_DATE=_0xdf23('0x4');function throwIfDateNotValid(_0x3eb05d){if(!_0x3eb05d[_0xdf23('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xdb1b27){var _0x41d8bf=_0xdb1b27[_0xdf23('0x6')](':')[_0xdf23('0x0')](function(_0x5a137b){return parseInt(_0x5a137b,0xa);});var _0x4c4b05=_0x41d8bf[0x0];var _0x148b9a=_0x41d8bf[0x1];if(_0x4c4b05<0x0||_0x4c4b05>0x17||_0x148b9a<0x0||_0x148b9a>0x3b){throw new Error(EINVALID_DATE);}return[_0x4c4b05,_0x148b9a];}function circularDoWInterval(_0xe834f,_0x3ec292){if(_0xe834f===_0x3ec292){return[_0xe834f];}else{var _0x23d0f0=moment[_0xdf23('0x7')]();moment['locale']('en');var _0x112fe9=moment['weekdaysShort']()[_0xdf23('0x0')](function(_0x1d0bed){return _0x1d0bed[_0xdf23('0x8')]();});moment[_0xdf23('0x7')](_0x23d0f0);var _0x39fc51=_0x112fe9[_0xdf23('0x9')](_0xe834f);var _0x1dc56b=_0x112fe9[_0xdf23('0x9')](_0x3ec292);if(_0x1dc56b>_0x39fc51){return _0x112fe9[_0xdf23('0xa')](_0x39fc51,_0x1dc56b+0x1);}else{var _0x3d2767=_0x112fe9['slice'](0x0,_0x1dc56b+0x1);var _0x50f596=_0x112fe9[_0xdf23('0xa')](_0x39fc51);return _0x50f596[_0xdf23('0xb')](_0x3d2767);}}}module[_0xdf23('0xc')][_0xdf23('0xd')]=circularDoWInterval;function circularMonthInterval(_0x508a0c,_0x2662f8){if(_0x508a0c===_0x2662f8){return[_0x508a0c];}else{var _0x1ba8ef=moment[_0xdf23('0x7')]();moment['locale']('en');var _0x3fde2e=moment['monthsShort']()[_0xdf23('0x0')](function(_0x28169e){return _0x28169e[_0xdf23('0x8')]();});moment[_0xdf23('0x7')](_0x1ba8ef);var _0x1fd5bf=_0x3fde2e[_0xdf23('0x9')](_0x508a0c);var _0x54d038=_0x3fde2e[_0xdf23('0x9')](_0x2662f8);if(_0x54d038>_0x1fd5bf){return _0x3fde2e['slice'](_0x1fd5bf,_0x54d038+0x1);}else{var _0x1b613b=_0x3fde2e['slice'](0x0,_0x54d038+0x1);var _0x1aa133=_0x3fde2e[_0xdf23('0xa')](_0x1fd5bf);return _0x1aa133[_0xdf23('0xb')](_0x1b613b);}}}module[_0xdf23('0xc')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x51ad74){var _0x6f2b8a=parseInt(_0x51ad74,0xa);if(_0x6f2b8a<0x1||_0x6f2b8a>0x1f){throw new Error(EINVALID_DATE);}return _0x6f2b8a;}function timeCompare(_0x384174,_0x4d3a1c,_0x3b5d45){var _0x2fadb9=_0x384174['clone']();var _0x59e84c=extractTime(_0x4d3a1c);var _0xf0242e=_0x59e84c[0x0];var _0x4e62ac=_0x59e84c[0x1];var _0x2fa9f4=_0x384174[_0xdf23('0xe')]()[_0xdf23('0xf')](_0xf0242e)[_0xdf23('0x10')](_0x4e62ac);throwIfDateNotValid(_0x2fa9f4);var _0x9f695d=extractTime(_0x3b5d45);var _0x257fa1=_0x9f695d[0x0];var _0x34727f=_0x9f695d[0x1];var _0x47eaf3=_0x384174['clone']()[_0xdf23('0xf')](_0x257fa1)[_0xdf23('0x10')](_0x34727f);throwIfDateNotValid(_0x47eaf3);if(_0x47eaf3['isBefore'](_0x2fa9f4)){var _0x22af12=_0x2fadb9[_0xdf23('0xe')]()['startOf'](_0xdf23('0x11'));var _0x5bfbc4=_0x2fadb9['clone']()[_0xdf23('0x12')]('day');return _0x2fadb9[_0xdf23('0x13')](_0x2fa9f4,_0x5bfbc4,undefined,'[]')||_0x2fadb9[_0xdf23('0x13')](_0x22af12,_0x47eaf3,undefined,'[]');}else{return _0x2fadb9[_0xdf23('0x13')](_0x2fa9f4,_0x47eaf3,undefined,'[]');}}module[_0xdf23('0xc')][_0xdf23('0x14')]=timeCompare;function dowCompare(_0x26b36d,_0x5773be,_0x53ef2f){var _0x351210=_0x26b36d[_0xdf23('0x7')]('en')[_0xdf23('0x15')](_0xdf23('0x16'))[_0xdf23('0x8')]();return circularDoWInterval(_0x5773be,_0x53ef2f)[_0xdf23('0x17')](_0x351210);}module[_0xdf23('0xc')][_0xdf23('0x18')]=dowCompare;function domCompare(_0x1f1295,_0x4da499,_0xedf1ef){var _0x3e3ba2=_0x1f1295[_0xdf23('0x19')]();if(_0x4da499===_0xedf1ef){return _0x3e3ba2===_0x4da499;}else{var _0x19861c=_0x1f1295[_0xdf23('0x1a')]();var _0x4faf56=_0x4da499<_0xedf1ef;let _0x470c66=![];var _0x5bd824=0x0;var _0x378d3b=0x0;if(_0x4faf56){_0x5bd824=Math[_0xdf23('0x1b')](0x1,_0x4da499);_0x378d3b=Math[_0xdf23('0x1c')](_0xedf1ef,_0x19861c);_0x470c66=_0x3e3ba2>=_0x5bd824&&_0x3e3ba2<=_0x378d3b;}else{_0x5bd824=Math[_0xdf23('0x1c')](_0x4da499,_0x19861c);_0x378d3b=Math[_0xdf23('0x1b')](0x1,_0xedf1ef);_0x470c66=_0x3e3ba2>=_0x5bd824||_0x3e3ba2<=_0x378d3b;}return _0x470c66;}}module['exports'][_0xdf23('0x1d')]=domCompare;function monthCompare(_0x25d3d6,_0x56c1c5,_0x518420){var _0x7776a2=_0x25d3d6[_0xdf23('0x7')]('en')[_0xdf23('0x15')](_0xdf23('0x1e'))[_0xdf23('0x8')]();return circularMonthInterval(_0x56c1c5,_0x518420)[_0xdf23('0x17')](_0x7776a2);}module[_0xdf23('0xc')][_0xdf23('0x1f')]=monthCompare;function iftime(_0x52a2de,_0x2637d9=moment['tz'][_0xdf23('0x20')](),_0x502bae=moment()){if(!validateRx[_0xdf23('0x21')](_0x52a2de)){throw new Error(EINVALID_STRING);}else{var _0x531225=(moment[_0xdf23('0x22')](_0x502bae)?_0x502bae[_0xdf23('0xe')]():moment(_0x502bae))['tz'](_0x2637d9)['locale']('en');throwIfDateNotValid(_0x531225);var _0x2ec76b=_0x52a2de[_0xdf23('0x6')](',');var _0x784665=_0x2ec76b[0x0];var _0x11c22d=_0x2ec76b[0x1];var _0x55ebf2=_0x2ec76b[0x2];var _0x3f6413=_0x2ec76b[0x3];let _0x276a2c=!![];if(_0x784665!=='*'){var _0x3793c7=_0x784665[_0xdf23('0x6')]('-');var _0x487589=_[_0xdf23('0x23')](_0x3793c7[0x0],0x5,'0');var _0x248382=_0x3793c7[_0xdf23('0x24')]===0x2?_[_0xdf23('0x23')](_0x3793c7[0x1],0x5,'0'):_0x487589;_0x276a2c=timeCompare(_0x531225,_0x487589,_0x248382);}let _0x4228ac=!![];if(_0x11c22d!=='*'){var _0x1f91f3=_0x11c22d[_0xdf23('0x6')]('-');var _0x71757d=_0x1f91f3[0x0];var _0x413ce2=_0x1f91f3[_0xdf23('0x24')]===0x2?_0x1f91f3[0x1]:_0x71757d;_0x4228ac=dowCompare(_0x531225,_0x71757d,_0x413ce2);}let _0x2c0634=!![];if(_0x55ebf2!=='*'){var _0x81308b=_0x55ebf2['split']('-');var _0x9e1626=parseDom(_0x81308b[0x0]);var _0x45a132=_0x81308b[_0xdf23('0x24')]===0x2?parseDom(_0x81308b[0x1]):_0x9e1626;_0x2c0634=domCompare(_0x531225,_0x9e1626,_0x45a132);}let _0x330c73=!![];if(_0x3f6413!=='*'){var _0x52003b=_0x3f6413[_0xdf23('0x6')]('-');var _0x5750f8=_0x52003b[0x0];var _0x4a4b69=_0x52003b[_0xdf23('0x24')]===0x2?_0x52003b[0x1]:_0x52003b[0x0];_0x330c73=monthCompare(_0x531225,_0x5750f8,_0x4a4b69);}return _0x276a2c&&_0x4228ac&&_0x2c0634&&_0x330c73;}}module[_0xdf23('0xc')][_0xdf23('0x25')]=iftime; \ No newline at end of file +var _0x2036=['minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','date','daysInMonth','max','min','domCompare','MMM','includes','guess','split','padStart','length','iftime','lodash','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours'];(function(_0xe1e424,_0x5ad7a2){var _0xc40fbc=function(_0x53bed0){while(--_0x53bed0){_0xe1e424['push'](_0xe1e424['shift']());}};_0xc40fbc(++_0x5ad7a2);}(_0x2036,0x64));var _0x6203=function(_0x3688e8,_0x5e1826){_0x3688e8=_0x3688e8-0x0;var _0x33c03d=_0x2036[_0x3688e8];return _0x33c03d;};var _=require(_0x6203('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]['map'](function(_0x1b0a4a){return _0x1b0a4a['source'];})[_0x6203('0x1')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x6203('0x2');var EINVALID_DATE=_0x6203('0x3');function throwIfDateNotValid(_0x52ab66){if(!_0x52ab66['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x305b45){var _0x22f42c=_0x305b45['split'](':')[_0x6203('0x4')](function(_0x265fe1){return parseInt(_0x265fe1,0xa);});var _0x3edcd0=_0x22f42c[0x0];var _0x55ce16=_0x22f42c[0x1];if(_0x3edcd0<0x0||_0x3edcd0>0x17||_0x55ce16<0x0||_0x55ce16>0x3b){throw new Error(EINVALID_DATE);}return[_0x3edcd0,_0x55ce16];}function circularDoWInterval(_0x4d31a4,_0x29464b){if(_0x4d31a4===_0x29464b){return[_0x4d31a4];}else{var _0x2d7625=moment[_0x6203('0x5')]();moment[_0x6203('0x5')]('en');var _0x11382c=moment[_0x6203('0x6')]()[_0x6203('0x4')](function(_0x1821d5){return _0x1821d5[_0x6203('0x7')]();});moment[_0x6203('0x5')](_0x2d7625);var _0x7c5153=_0x11382c['indexOf'](_0x4d31a4);var _0x102e8c=_0x11382c[_0x6203('0x8')](_0x29464b);if(_0x102e8c>_0x7c5153){return _0x11382c[_0x6203('0x9')](_0x7c5153,_0x102e8c+0x1);}else{var _0x2e2b64=_0x11382c[_0x6203('0x9')](0x0,_0x102e8c+0x1);var _0x3f2ecf=_0x11382c['slice'](_0x7c5153);return _0x3f2ecf[_0x6203('0xa')](_0x2e2b64);}}}module[_0x6203('0xb')][_0x6203('0xc')]=circularDoWInterval;function circularMonthInterval(_0x502c20,_0x5b097b){if(_0x502c20===_0x5b097b){return[_0x502c20];}else{var _0x519ee6=moment[_0x6203('0x5')]();moment[_0x6203('0x5')]('en');var _0x439c84=moment[_0x6203('0xd')]()['map'](function(_0x55d41f){return _0x55d41f[_0x6203('0x7')]();});moment[_0x6203('0x5')](_0x519ee6);var _0x13cae9=_0x439c84[_0x6203('0x8')](_0x502c20);var _0x1ca86e=_0x439c84['indexOf'](_0x5b097b);if(_0x1ca86e>_0x13cae9){return _0x439c84[_0x6203('0x9')](_0x13cae9,_0x1ca86e+0x1);}else{var _0x1850b3=_0x439c84[_0x6203('0x9')](0x0,_0x1ca86e+0x1);var _0xdd9565=_0x439c84[_0x6203('0x9')](_0x13cae9);return _0xdd9565[_0x6203('0xa')](_0x1850b3);}}}module[_0x6203('0xb')][_0x6203('0xe')]=circularMonthInterval;function parseDom(_0xeee5a4){var _0x570cc1=parseInt(_0xeee5a4,0xa);if(_0x570cc1<0x1||_0x570cc1>0x1f){throw new Error(EINVALID_DATE);}return _0x570cc1;}function timeCompare(_0x1637f8,_0x5ad32c,_0x10aa40){var _0x1d4a9f=_0x1637f8[_0x6203('0xf')]();var _0x99e80e=extractTime(_0x5ad32c);var _0x217848=_0x99e80e[0x0];var _0x312d6b=_0x99e80e[0x1];var _0x4bcf5f=_0x1637f8[_0x6203('0xf')]()[_0x6203('0x10')](_0x217848)[_0x6203('0x11')](_0x312d6b);throwIfDateNotValid(_0x4bcf5f);var _0x5493ae=extractTime(_0x10aa40);var _0x359bc0=_0x5493ae[0x0];var _0x43c4a6=_0x5493ae[0x1];var _0x551994=_0x1637f8[_0x6203('0xf')]()[_0x6203('0x10')](_0x359bc0)[_0x6203('0x11')](_0x43c4a6);throwIfDateNotValid(_0x551994);if(_0x551994[_0x6203('0x12')](_0x4bcf5f)){var _0x407963=_0x1d4a9f[_0x6203('0xf')]()[_0x6203('0x13')](_0x6203('0x14'));var _0x5f2994=_0x1d4a9f[_0x6203('0xf')]()[_0x6203('0x15')](_0x6203('0x14'));return _0x1d4a9f[_0x6203('0x16')](_0x4bcf5f,_0x5f2994,undefined,'[]')||_0x1d4a9f['isBetween'](_0x407963,_0x551994,undefined,'[]');}else{return _0x1d4a9f['isBetween'](_0x4bcf5f,_0x551994,undefined,'[]');}}module[_0x6203('0xb')][_0x6203('0x17')]=timeCompare;function dowCompare(_0x2e165f,_0x4ee5ee,_0x125280){var _0x9ca640=_0x2e165f[_0x6203('0x5')]('en')[_0x6203('0x18')](_0x6203('0x19'))[_0x6203('0x7')]();return circularDoWInterval(_0x4ee5ee,_0x125280)['includes'](_0x9ca640);}module['exports'][_0x6203('0x1a')]=dowCompare;function domCompare(_0xe955ab,_0x3aa96b,_0x111abf){var _0x3671f9=_0xe955ab[_0x6203('0x1b')]();if(_0x3aa96b===_0x111abf){return _0x3671f9===_0x3aa96b;}else{var _0xa534a1=_0xe955ab[_0x6203('0x1c')]();var _0x2ab45b=_0x3aa96b<_0x111abf;let _0x66c666=![];var _0x4bff3f=0x0;var _0x4eaaef=0x0;if(_0x2ab45b){_0x4bff3f=Math[_0x6203('0x1d')](0x1,_0x3aa96b);_0x4eaaef=Math[_0x6203('0x1e')](_0x111abf,_0xa534a1);_0x66c666=_0x3671f9>=_0x4bff3f&&_0x3671f9<=_0x4eaaef;}else{_0x4bff3f=Math[_0x6203('0x1e')](_0x3aa96b,_0xa534a1);_0x4eaaef=Math[_0x6203('0x1d')](0x1,_0x111abf);_0x66c666=_0x3671f9>=_0x4bff3f||_0x3671f9<=_0x4eaaef;}return _0x66c666;}}module[_0x6203('0xb')][_0x6203('0x1f')]=domCompare;function monthCompare(_0x3cef09,_0x156eba,_0x4cfc1b){var _0x18222e=_0x3cef09[_0x6203('0x5')]('en')[_0x6203('0x18')](_0x6203('0x20'))[_0x6203('0x7')]();return circularMonthInterval(_0x156eba,_0x4cfc1b)[_0x6203('0x21')](_0x18222e);}module[_0x6203('0xb')]['monthCompare']=monthCompare;function iftime(_0x227396,_0x5b2650=moment['tz'][_0x6203('0x22')](),_0x1c8ffb=moment()){if(!validateRx['test'](_0x227396)){throw new Error(EINVALID_STRING);}else{var _0x4983af=(moment['isMoment'](_0x1c8ffb)?_0x1c8ffb[_0x6203('0xf')]():moment(_0x1c8ffb))['tz'](_0x5b2650)[_0x6203('0x5')]('en');throwIfDateNotValid(_0x4983af);var _0x27a4d6=_0x227396[_0x6203('0x23')](',');var _0x22144f=_0x27a4d6[0x0];var _0x5d0adc=_0x27a4d6[0x1];var _0x1a1548=_0x27a4d6[0x2];var _0x3f8ea2=_0x27a4d6[0x3];let _0x1d8778=!![];if(_0x22144f!=='*'){var _0xd24760=_0x22144f[_0x6203('0x23')]('-');var _0x57da7e=_[_0x6203('0x24')](_0xd24760[0x0],0x5,'0');var _0x55c0b0=_0xd24760['length']===0x2?_[_0x6203('0x24')](_0xd24760[0x1],0x5,'0'):_0x57da7e;_0x1d8778=timeCompare(_0x4983af,_0x57da7e,_0x55c0b0);}let _0x137e41=!![];if(_0x5d0adc!=='*'){var _0x465f62=_0x5d0adc[_0x6203('0x23')]('-');var _0x12bacb=_0x465f62[0x0];var _0x5750a4=_0x465f62[_0x6203('0x25')]===0x2?_0x465f62[0x1]:_0x12bacb;_0x137e41=dowCompare(_0x4983af,_0x12bacb,_0x5750a4);}let _0x256752=!![];if(_0x1a1548!=='*'){var _0xc0b456=_0x1a1548[_0x6203('0x23')]('-');var _0x148423=parseDom(_0xc0b456[0x0]);var _0x4e0571=_0xc0b456[_0x6203('0x25')]===0x2?parseDom(_0xc0b456[0x1]):_0x148423;_0x256752=domCompare(_0x4983af,_0x148423,_0x4e0571);}let _0xdd143=!![];if(_0x3f8ea2!=='*'){var _0x14d25f=_0x3f8ea2[_0x6203('0x23')]('-');var _0x59e7b9=_0x14d25f[0x0];var _0x1c05f0=_0x14d25f[_0x6203('0x25')]===0x2?_0x14d25f[0x1]:_0x14d25f[0x0];_0xdd143=monthCompare(_0x4983af,_0x59e7b9,_0x1c05f0);}return _0x1d8778&&_0x137e41&&_0x256752&&_0xdd143;}}module[_0x6203('0xb')][_0x6203('0x26')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 50cae51..1e9f465 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d30=['warn','File','%s-%s','error','consoleLogger','fileLogger','path','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan','/var/log/xcally','join','%s-%s.log','message','replace','{{{','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','}}}','meta','keys','length','toUpperCase','Logger','transports','Console'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x3d30,0x75));var _0x03d3=function(_0x45496c,_0xb76fb1){_0x45496c=_0x45496c-0x0;var _0x17945a=_0x3d30[_0x45496c];return _0x17945a;};'use strict';var path=require(_0x03d3('0x0'));var util=require('util');var moment=require('moment');var winston=require('winston');var config=require(_0x03d3('0x1'));var debugLevel=config[_0x03d3('0x2')]?config['debugLevel'][_0x03d3('0x3')]():_0x03d3('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x03d3('0x5'),'error':_0x03d3('0x6'),'warn':_0x03d3('0x7'),'info':'white','print':_0x03d3('0x8'),'success':_0x03d3('0x9'),'http':_0x03d3('0xa'),'verbose':'bold\x20magenta','debug':_0x03d3('0xb'),'silly':_0x03d3('0xc')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x367d3b,_0x33ef59,_0x19df6f){var _0x27e3f0=_0x367d3b||_0x03d3('0xd');return path[_0x03d3('0xe')](_0x27e3f0,util['format'](_0x03d3('0xf'),_0x33ef59,_0x19df6f));}function formatter(_0x3e3ad8,_0xde4969){_0xde4969[_0x03d3('0x10')]=_0xde4969[_0x03d3('0x10')][_0x03d3('0x11')](/@@{/g,_0x03d3('0x12'))['replace'](/}@@/g,'}}}')[_0x03d3('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x03d3('0x13')](_0x03d3('0x14'),moment()[_0x03d3('0x13')](_0x03d3('0x15')),_0xde4969[_0x03d3('0x16')]['toUpperCase'](),_0x3e3ad8,_0xde4969[_0x03d3('0x10')]);}function fileFormat(_0x1a06e8,_0x886469){_0x886469[_0x03d3('0x10')]=_0x886469['message'][_0x03d3('0x11')](/@@{/g,'{{{')[_0x03d3('0x11')](/}@@/g,_0x03d3('0x17'))[_0x03d3('0x11')](/@{/g,'{{')[_0x03d3('0x11')](/}@/g,'}}');var _0x5125cb=_0x886469[_0x03d3('0x18')]&&Object[_0x03d3('0x19')](_0x886469[_0x03d3('0x18')])[_0x03d3('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x886469[_0x03d3('0x18')]):'';return util[_0x03d3('0x13')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x03d3('0x13')](_0x03d3('0x15')),_0x886469[_0x03d3('0x16')][_0x03d3('0x1b')](),_0x1a06e8,_0x886469[_0x03d3('0x10')],_0x5125cb);}function consoleLogger(){var _0x304663=new winston[(_0x03d3('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x03d3('0x1d'))][(_0x03d3('0x1e'))]({'level':_0x03d3('0x1f'),'json':![],'formatter':function(_0x5e21c2){return formatter('',_0x5e21c2);}})]});return _0x304663;}function fileLogger(_0x1ada68,_0xd0e79f){var _0x4421e0=new winston[(_0x03d3('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x03d3('0x1d'))][(_0x03d3('0x20'))]({'name':util[_0x03d3('0x13')](_0x03d3('0x21'),_0x1ada68,_0x03d3('0x22')),'filename':getLogFileName(_0xd0e79f,_0x1ada68,'error'),'level':_0x03d3('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2a5d20){return fileFormat(_0x1ada68,_0x2a5d20);}}),new winston[(_0x03d3('0x1d'))][(_0x03d3('0x20'))]({'name':util[_0x03d3('0x13')]('%s-%s',_0x1ada68,debugLevel),'filename':getLogFileName(_0xd0e79f,_0x1ada68,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x58bba1){return fileFormat(_0x1ada68,_0x58bba1);}}),new winston['transports']['Console']({'level':_0x03d3('0x1f'),'json':![],'formatter':function(_0x3c5bfd){return fileFormat(_0x1ada68,_0x3c5bfd);}})]});return _0x4421e0;}exports[_0x03d3('0x23')]=consoleLogger;exports[_0x03d3('0x24')]=fileLogger; \ No newline at end of file +var _0x31f2=['stringify','Logger','transports','Console','File','error','%s-%s','warn','consoleLogger','path','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20cyan','/var/log/xcally','format','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','keys','meta','length'];(function(_0x1b270a,_0x5ede7f){var _0x5bf3b2=function(_0x384f32){while(--_0x384f32){_0x1b270a['push'](_0x1b270a['shift']());}};_0x5bf3b2(++_0x5ede7f);}(_0x31f2,0xe1));var _0x231f=function(_0x27612c,_0x4707b4){_0x27612c=_0x27612c-0x0;var _0x53b6e5=_0x31f2[_0x27612c];return _0x53b6e5;};'use strict';var path=require(_0x231f('0x0'));var util=require(_0x231f('0x1'));var moment=require(_0x231f('0x2'));var winston=require(_0x231f('0x3'));var config=require('../config/environment');var debugLevel=config[_0x231f('0x4')]?config[_0x231f('0x4')][_0x231f('0x5')]():_0x231f('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':_0x231f('0x7'),'error':_0x231f('0x8'),'warn':_0x231f('0x9'),'info':_0x231f('0xa'),'print':_0x231f('0xb'),'success':_0x231f('0xc'),'http':'gray','verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0x231f('0xd')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x22f239,_0xcb1be,_0x4846c3){var _0x388fb0=_0x22f239||_0x231f('0xe');return path['join'](_0x388fb0,util[_0x231f('0xf')]('%s-%s.log',_0xcb1be,_0x4846c3));}function formatter(_0x1a7412,_0x329152){_0x329152['message']=_0x329152['message'][_0x231f('0x10')](/@@{/g,_0x231f('0x11'))[_0x231f('0x10')](/}@@/g,_0x231f('0x12'))['replace'](/@{/g,'{{')[_0x231f('0x10')](/}@/g,'}}');return util[_0x231f('0xf')](_0x231f('0x13'),moment()[_0x231f('0xf')](_0x231f('0x14')),_0x329152[_0x231f('0x15')][_0x231f('0x16')](),_0x1a7412,_0x329152[_0x231f('0x17')]);}function fileFormat(_0x4eee42,_0x5cbb0b){_0x5cbb0b[_0x231f('0x17')]=_0x5cbb0b[_0x231f('0x17')][_0x231f('0x10')](/@@{/g,_0x231f('0x11'))['replace'](/}@@/g,_0x231f('0x12'))[_0x231f('0x10')](/@{/g,'{{')[_0x231f('0x10')](/}@/g,'}}');var _0x4f485f=_0x5cbb0b['meta']&&Object[_0x231f('0x18')](_0x5cbb0b[_0x231f('0x19')])[_0x231f('0x1a')]?'\x0a\x09'+JSON[_0x231f('0x1b')](_0x5cbb0b[_0x231f('0x19')]):'';return util[_0x231f('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x231f('0xf')](_0x231f('0x14')),_0x5cbb0b[_0x231f('0x15')][_0x231f('0x16')](),_0x4eee42,_0x5cbb0b[_0x231f('0x17')],_0x4f485f);}function consoleLogger(){var _0x1b1e4c=new winston[(_0x231f('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x231f('0x1d'))][(_0x231f('0x1e'))]({'level':'warn','json':![],'formatter':function(_0x340bab){return formatter('',_0x340bab);}})]});return _0x1b1e4c;}function fileLogger(_0x2ee925,_0x2825e2){var _0x21e6dc=new winston[(_0x231f('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x231f('0x1f'))]({'name':util[_0x231f('0xf')]('%s-%s',_0x2ee925,'error'),'filename':getLogFileName(_0x2825e2,_0x2ee925,_0x231f('0x20')),'level':_0x231f('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2c3e25){return fileFormat(_0x2ee925,_0x2c3e25);}}),new winston[(_0x231f('0x1d'))]['File']({'name':util[_0x231f('0xf')](_0x231f('0x21'),_0x2ee925,debugLevel),'filename':getLogFileName(_0x2825e2,_0x2ee925,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x7ea040){return fileFormat(_0x2ee925,_0x7ea040);}}),new winston['transports'][(_0x231f('0x1e'))]({'level':_0x231f('0x22'),'json':![],'formatter':function(_0x574d01){return fileFormat(_0x2ee925,_0x574d01);}})]});return _0x21e6dc;}exports[_0x231f('0x23')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 28f9b68..ceff56c 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 _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x57ca,0x108));var _0xa57c=function(_0x1fe30b,_0x1ac73e){_0x1fe30b=_0x1fe30b-0x0;var _0x458980=_0x57ca[_0x1fe30b];return _0x458980;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x1a85,0x178));var _0x51a8=function(_0x1aa13e,_0x12a40b){_0x1aa13e=_0x1aa13e-0x0;var _0x1144bd=_0x1a85[_0x1aa13e];return _0x1144bd;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index d01410a..8815955 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 _0xed3c=['{\x20{\x20','\x20}\x20}','string','replace','isPlainObject','keys','reduce','safeTemplate','lodash'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xed3c,0x1a6));var _0xced3=function(_0x2b6453,_0xbaeaf){_0x2b6453=_0x2b6453-0x0;var _0x3fa2dc=_0xed3c[_0x2b6453];return _0x3fa2dc;};var _=require(_0xced3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x408853){return _0x408853==='{{'?_0xced3('0x1'):_0xced3('0x2');}function safeTemplate(_0x558ee8){var _0xfdc1ed=_0x558ee8;if(typeof _0x558ee8===_0xced3('0x3')){_0xfdc1ed=_0x558ee8[_0xced3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x558ee8)){_0xfdc1ed=_0x558ee8['map'](function(_0x3d3aa0){return safeTemplate(_0x3d3aa0);});}else if(_[_0xced3('0x5')](_0x558ee8)){_0xfdc1ed=Object[_0xced3('0x6')](_0x558ee8)[_0xced3('0x7')](function(_0x4795cd,_0x510164){_0x4795cd[_0x510164]=safeTemplate(_0x558ee8[_0x510164]);return _0x4795cd;},{});}return _0xfdc1ed;}module['exports'][_0xced3('0x8')]=safeTemplate; \ No newline at end of file +var _0xf4f4=['replace','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}','string'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x2cbd8c,_0x4f5428){_0x2cbd8c=_0x2cbd8c-0x0;var _0xf554ad=_0xf4f4[_0x2cbd8c];return _0xf554ad;};var _=require(_0x4f4f('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x230375){return _0x230375==='{{'?'{\x20{\x20':_0x4f4f('0x1');}function safeTemplate(_0x304b11){var _0x19aa05=_0x304b11;if(typeof _0x304b11===_0x4f4f('0x2')){_0x19aa05=_0x304b11[_0x4f4f('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x304b11)){_0x19aa05=_0x304b11[_0x4f4f('0x4')](function(_0x593952){return safeTemplate(_0x593952);});}else if(_[_0x4f4f('0x5')](_0x304b11)){_0x19aa05=Object[_0x4f4f('0x6')](_0x304b11)[_0x4f4f('0x7')](function(_0x1ff75a,_0x3c4877){_0x1ff75a[_0x3c4877]=safeTemplate(_0x304b11[_0x3c4877]);return _0x1ff75a;},{});}return _0x19aa05;}module[_0x4f4f('0x8')][_0x4f4f('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 146d710..a846fee 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 _0xfa97=['apps','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','resolve','legacy-libs'];(function(_0x27d84f,_0x38caf4){var _0x419d56=function(_0xf74fa2){while(--_0xf74fa2){_0x27d84f['push'](_0x27d84f['shift']());}};_0x419d56(++_0x38caf4);}(_0xfa97,0x109));var _0x7fa9=function(_0x346379,_0xd5f749){_0x346379=_0x346379-0x0;var _0x9c1bb6=_0xfa97[_0x346379];return _0x9c1bb6;};var fs=require(_0x7fa9('0x0'));var path=require(_0x7fa9('0x1'));var config=require(_0x7fa9('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x7fa9('0x3')](root,'server/app.json');var NODEPATH=path[_0x7fa9('0x3')](root,_0x7fa9('0x4'));function setLegacyLibsNodeEnvPath(_0xa72c9e){let _0xd04997=![];if(Array['isArray'](_0xa72c9e['apps'])){var _0x72b054=_0xa72c9e[_0x7fa9('0x5')]['findIndex'](function(_0x4f4f47){return _0x4f4f47['name']===_0x7fa9('0x6');});if(_0x72b054>-0x1){var _0x5ee5f4=_0xa72c9e['apps'][_0x72b054];if(typeof _0x5ee5f4[_0x7fa9('0x7')][_0x7fa9('0x8')]!==_0x7fa9('0x9')){_0x5ee5f4[_0x7fa9('0x7')][_0x7fa9('0x8')]=NODEPATH;_0xd04997=!![];}}return{'appConfig':_0xa72c9e,'updated':_0xd04997};}}function updateAppConfig(_0x2a88cb){return fs[_0x7fa9('0xa')](APP_JSON_PATH)[_0x7fa9('0xb')](function(_0x435f75){if(_0x435f75){return fs[_0x7fa9('0xc')](APP_JSON_PATH)['then'](function(_0x8cec94){var _0x2089e6=setLegacyLibsNodeEnvPath(_0x8cec94);if(_0x2089e6[_0x7fa9('0xd')]){_0x2a88cb[_0x7fa9('0xe')](_0x7fa9('0xf'));return fs[_0x7fa9('0x10')](APP_JSON_PATH,_0x8cec94,{'spaces':0x2});}else{return Promise[_0x7fa9('0x3')]();}});}else{return Promise[_0x7fa9('0x3')]();}});}module[_0x7fa9('0x11')]=updateAppConfig; \ No newline at end of file +var _0x7283=['exports','../config/environment','root','server/app.json','resolve','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','Updating\x20app.json','writeJSON'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7283,0x16a));var _0x3728=function(_0x1b29aa,_0x4cb6a8){_0x1b29aa=_0x1b29aa-0x0;var _0x20b95d=_0x7283[_0x1b29aa];return _0x20b95d;};var fs=require('fs-extra');var path=require('path');var config=require(_0x3728('0x0'));var root=config[_0x3728('0x1')];var APP_JSON_PATH=path['resolve'](root,_0x3728('0x2'));var NODEPATH=path[_0x3728('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x3f76b8){let _0x2d390a=![];if(Array[_0x3728('0x4')](_0x3f76b8['apps'])){var _0x1a0204=_0x3f76b8[_0x3728('0x5')][_0x3728('0x6')](function(_0xd8c0d6){return _0xd8c0d6[_0x3728('0x7')]===_0x3728('0x8');});if(_0x1a0204>-0x1){var _0x2a637a=_0x3f76b8['apps'][_0x1a0204];if(typeof _0x2a637a[_0x3728('0x9')][_0x3728('0xa')]!==_0x3728('0xb')){_0x2a637a['env'][_0x3728('0xa')]=NODEPATH;_0x2d390a=!![];}}return{'appConfig':_0x3f76b8,'updated':_0x2d390a};}}function updateAppConfig(_0x172a7e){return fs[_0x3728('0xc')](APP_JSON_PATH)[_0x3728('0xd')](function(_0xf7a359){if(_0xf7a359){return fs[_0x3728('0xe')](APP_JSON_PATH)[_0x3728('0xd')](function(_0x19a98d){var _0x222291=setLegacyLibsNodeEnvPath(_0x19a98d);if(_0x222291[_0x3728('0xf')]){_0x172a7e['info'](_0x3728('0x10'));return fs[_0x3728('0x11')](APP_JSON_PATH,_0x19a98d,{'spaces':0x2});}else{return Promise[_0x3728('0x3')]();}});}else{return Promise[_0x3728('0x3')]();}});}module[_0x3728('0x12')]=updateAppConfig; \ No newline at end of file